From 613f31d4ad2833d12ec05fac8f60a87fd8671311 Mon Sep 17 00:00:00 2001 From: support Date: Wed, 15 Jun 2022 12:08:32 +0000 Subject: [PATCH] Built motion from commit d1c16722.|2.6.11 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- .../authActiveDirectory.controller.js | 2 +- server/api/authActiveDirectory/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage.events.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- server/api/client-side-logs.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.oauth.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../cmContactHasItem.attributes.js | 2 +- .../cmContactHasItem.controller.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.model.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.rpc.js | 2 +- server/api/cmContactHasItem/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../cmHopperAdditionalPhone.attributes.js | 2 +- .../cmHopperAdditionalPhone.controller.js | 2 +- .../cmHopperAdditionalPhone.model.js | 2 +- .../cmHopperAdditionalPhone.rpc.js | 2 +- server/api/cmHopperAdditionalPhone/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- .../contactItemType/contactItemType.attributes.js | 2 +- .../contactItemType/contactItemType.controller.js | 2 +- .../api/contactItemType/contactItemType.model.js | 2 +- server/api/contactItemType/contactItemType.rpc.js | 2 +- server/api/contactItemType/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.events.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user-setting/index.js | 2 +- server/api/user-setting/user-setting.attributes.js | 2 +- server/api/user-setting/user-setting.controller.js | 2 +- server/api/user-setting/user-setting.events.js | 2 +- server/api/user-setting/user-setting.model.js | 2 +- server/api/user-setting/user-setting.socket.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/contacts/index.js | 2 +- server/components/contacts/sql-utils.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/import/cm/csvUpdates.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/interaction/sql-utils.js | 2 +- .../components/interaction/update-interaction.js | 2 +- server/components/interaction/utils.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/components/realtime/agents.js | 2 +- server/components/realtime/queues.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/cloud-provider.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/api.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/events.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/project.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/models/action.js | 2 +- server/services/ami/dialer/models/agentComplete.js | 2 +- server/services/ami/dialer/models/final.js | 2 +- server/services/ami/dialer/models/hangup.js | 2 +- server/services/ami/dialer/models/history.js | 2 +- .../ami/dialer/models/queueCallerAbandon.js | 2 +- server/services/ami/dialer/utils/hopper.js | 2 +- server/services/ami/dialer/utils/index.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/voiceQueueSummary.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/realtime/utils.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperAdditionalPhone.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/interval.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/tvox.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- server/utils/client-side-logger.js | 2 +- server/utils/iftime.js | 2 +- server/utils/loggers.js | 2 +- server/utils/mask-sensitive-data.js | 2 +- server/utils/safe-template.js | 2 +- 1202 files changed, 1202 insertions(+), 1202 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9a6746d..301729d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-15T10:35:22.368Z", + "time": "2022-06-15T12:00:34.431Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ba31ad1..68170c1 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-06-15T10:35:22.368Z", + "time": "2022-06-15T12:00:34.431Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 0d426ae..0b7ddc8 100644 --- a/server/api/action/action.attributes.js +++ b/server/api/action/action.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74bb=['getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','VIRTUAL'];(function(_0x13d423,_0x2f1969){var _0xf18f30=function(_0xbadbab){while(--_0xbadbab){_0x13d423['push'](_0x13d423['shift']());}};_0xf18f30(++_0x2f1969);}(_0x74bb,0x1de));var _0xb74b=function(_0x388ee3,_0xeb2f22){_0x388ee3=_0x388ee3-0x0;var _0x1b314=_0x74bb[_0x388ee3];return _0x1b314;};'use strict';var Sequelize=require(_0xb74b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb74b('0x1')],'get':function(_0x450214){return this[_0xb74b('0x2')](_0xb74b('0x3'));}},'action':{'type':Sequelize[_0xb74b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb74b('0x5'),'integration',_0xb74b('0x6'),_0xb74b('0x7'),_0xb74b('0x8'),'browser','bot',_0xb74b('0x9')]],'msg':_0xb74b('0xa')}},'comment':_0xb74b('0xa')},'data1':{'type':Sequelize[_0xb74b('0x4')](0x1000),'comment':_0xb74b('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xb74b('0x4')](0x1000),'comment':_0xb74b('0xc')},'data4':{'type':Sequelize[_0xb74b('0x4')](0x1000),'comments':_0xb74b('0xd')},'data5':{'type':Sequelize[_0xb74b('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xb74b('0x4')],'comments':_0xb74b('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':_0xb74b('0xf')}}; \ No newline at end of file +var _0x58c0=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x44b9e5,_0x4e0988){var _0x157cd0=function(_0x5c6a6c){while(--_0x5c6a6c){_0x44b9e5['push'](_0x44b9e5['shift']());}};_0x157cd0(++_0x4e0988);}(_0x58c0,0x1de));var _0x058c=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x58c0[_0x1ae4a9];return _0x54d0b0;};'use strict';var Sequelize=require('sequelize');module[_0x058c('0x0')]={'name':{'type':Sequelize[_0x058c('0x1')],'get':function(_0x3b79fc){return this[_0x058c('0x2')](_0x058c('0x3'));}},'action':{'type':Sequelize[_0x058c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x058c('0x5'),'integration',_0x058c('0x6'),_0x058c('0x7'),_0x058c('0x8'),_0x058c('0x9'),_0x058c('0xa'),_0x058c('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x058c('0xc')},'data1':{'type':Sequelize[_0x058c('0x4')](0x1000),'comment':_0x058c('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x058c('0xe')},'data3':{'type':Sequelize[_0x058c('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x058c('0x4')](0x1000),'comments':_0x058c('0xf')},'data5':{'type':Sequelize[_0x058c('0x4')](0x1000),'comments':_0x058c('0x10')},'data6':{'type':Sequelize[_0x058c('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x058c('0x11')],'comments':_0x058c('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5f22058..0c26710 100644 --- a/server/api/action/action.controller.js +++ b/server/api/action/action.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e89=['undefined','limit','count','Content-Range','save','update','then','end','stack','name','body','find','params','catch','destroy','Action','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0xd70344,_0x304eac){var _0x338d4b=function(_0x4d42a8){while(--_0x4d42a8){_0xd70344['push'](_0xd70344['shift']());}};_0x338d4b(++_0x304eac);}(_0x1e89,0x118));var _0x91e8=function(_0x23909e,_0x270bf4){_0x23909e=_0x23909e-0x0;var _0x218b62=_0x1e89[_0x23909e];return _0x218b62;};'use strict';var emlformat=require(_0x91e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91e8('0x1'));var jsonpatch=require(_0x91e8('0x2'));var rp=require(_0x91e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x91e8('0x4'));var util=require(_0x91e8('0x5'));var path=require(_0x91e8('0x6'));var sox=require(_0x91e8('0x7'));var csv=require(_0x91e8('0x8'));var ejs=require(_0x91e8('0x9'));var fs=require('fs');var fs_extra=require(_0x91e8('0xa'));var _=require(_0x91e8('0xb'));var squel=require('squel');var crypto=require(_0x91e8('0xc'));var jsforce=require(_0x91e8('0xd'));var deskjs=require(_0x91e8('0xe'));var toCsv=require(_0x91e8('0x8'));var querystring=require(_0x91e8('0xf'));var Papa=require(_0x91e8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x91e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91e8('0x12'));var logger=require(_0x91e8('0x13'))(_0x91e8('0x14'));var utils=require(_0x91e8('0x15'));var config=require(_0x91e8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x91e8('0x17'))['db'];function respondWithStatusCode(_0x34cfe3,_0x147d95){_0x147d95=_0x147d95||0xcc;return function(_0x553f12){if(_0x553f12){return _0x34cfe3[_0x91e8('0x18')](_0x147d95);}return _0x34cfe3['status'](_0x147d95)['end']();};}function respondWithResult(_0x34c353,_0x5badf6){_0x5badf6=_0x5badf6||0xc8;return function(_0x52f782){if(_0x52f782){return _0x34c353[_0x91e8('0x19')](_0x5badf6)[_0x91e8('0x1a')](_0x52f782);}};}function respondWithFilteredResult(_0xbcd0fb,_0x169d77){return function(_0x43a99b){if(_0x43a99b){var _0x3986cd=typeof _0x169d77[_0x91e8('0x1b')]===_0x91e8('0x1c')&&typeof _0x169d77[_0x91e8('0x1d')]===_0x91e8('0x1c');var _0x5e178a=_0x43a99b[_0x91e8('0x1e')];var _0x55b43f=_0x3986cd?0x0:_0x169d77['offset'];var _0x41b767=_0x3986cd?_0x43a99b[_0x91e8('0x1e')]:_0x169d77[_0x91e8('0x1b')]+_0x169d77[_0x91e8('0x1d')];var _0x197d80;if(_0x41b767>=_0x5e178a){_0x41b767=_0x5e178a;_0x197d80=0xc8;}else{_0x197d80=0xce;}_0xbcd0fb[_0x91e8('0x19')](_0x197d80);return _0xbcd0fb['set'](_0x91e8('0x1f'),_0x55b43f+'-'+_0x41b767+'/'+_0x5e178a)[_0x91e8('0x1a')](_0x43a99b);}return null;};}function patchUpdates(_0x2b13a4){return function(_0x42f23b){try{jsonpatch['apply'](_0x42f23b,_0x2b13a4,!![]);}catch(_0x1abd44){return BPromise['reject'](_0x1abd44);}return _0x42f23b[_0x91e8('0x20')]();};}function saveUpdates(_0x1afdbd,_0x5c2208){return function(_0x3c595d){if(_0x3c595d){return _0x3c595d[_0x91e8('0x21')](_0x1afdbd)['then'](function(_0x4f29dd){return _0x4f29dd;});}return null;};}function removeEntity(_0x14a3d4,_0x30f609){return function(_0x23eecb){if(_0x23eecb){return _0x23eecb['destroy']()[_0x91e8('0x22')](function(){_0x14a3d4['status'](0xcc)[_0x91e8('0x23')]();});}};}function handleEntityNotFound(_0x2331d4,_0x26c203){return function(_0x4d264d){if(!_0x4d264d){_0x2331d4['sendStatus'](0x194);}return _0x4d264d;};}function handleError(_0x339d13,_0x4611f0){_0x4611f0=_0x4611f0||0x1f4;return function(_0xe3c8ba){logger['error'](_0xe3c8ba[_0x91e8('0x24')]);if(_0xe3c8ba[_0x91e8('0x25')]){delete _0xe3c8ba[_0x91e8('0x25')];}_0x339d13[_0x91e8('0x19')](_0x4611f0)['send'](_0xe3c8ba);};}exports[_0x91e8('0x21')]=function(_0x37c59e,_0x45fb43){if(_0x37c59e['body']['id']){delete _0x37c59e[_0x91e8('0x26')]['id'];}return db['Action'][_0x91e8('0x27')]({'where':{'id':_0x37c59e[_0x91e8('0x28')]['id']}})['then'](handleEntityNotFound(_0x45fb43,null))['then'](saveUpdates(_0x37c59e[_0x91e8('0x26')],null))[_0x91e8('0x22')](respondWithResult(_0x45fb43,null))[_0x91e8('0x29')](handleError(_0x45fb43,null));};exports[_0x91e8('0x2a')]=function(_0x443f32,_0x41f4f9){return db[_0x91e8('0x2b')][_0x91e8('0x27')]({'where':{'id':_0x443f32[_0x91e8('0x28')]['id']}})[_0x91e8('0x22')](handleEntityNotFound(_0x41f4f9,null))[_0x91e8('0x22')](removeEntity(_0x41f4f9,null))[_0x91e8('0x29')](handleError(_0x41f4f9,null));}; \ No newline at end of file +var _0xdfca=['sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','then','error','name','send','body','Action','find','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5e115f,_0x4eebf1){var _0x36d700=function(_0x1af0b1){while(--_0x1af0b1){_0x5e115f['push'](_0x5e115f['shift']());}};_0x36d700(++_0x4eebf1);}(_0xdfca,0xfc));var _0xadfc=function(_0x26766a,_0x704cdd){_0x26766a=_0x26766a-0x0;var _0x196a52=_0xdfca[_0x26766a];return _0x196a52;};'use strict';var emlformat=require(_0xadfc('0x0'));var rimraf=require(_0xadfc('0x1'));var zipdir=require(_0xadfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadfc('0x3'));var moment=require(_0xadfc('0x4'));var BPromise=require(_0xadfc('0x5'));var Mustache=require(_0xadfc('0x6'));var util=require(_0xadfc('0x7'));var path=require(_0xadfc('0x8'));var sox=require('sox');var csv=require(_0xadfc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xadfc('0xa'));var _=require(_0xadfc('0xb'));var squel=require(_0xadfc('0xc'));var crypto=require(_0xadfc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xadfc('0xe'));var toCsv=require(_0xadfc('0x9'));var querystring=require(_0xadfc('0xf'));var Papa=require(_0xadfc('0x10'));var Redis=require(_0xadfc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xadfc('0x12'));var as=require(_0xadfc('0x13'));var hardwareService=require(_0xadfc('0x14'));var logger=require(_0xadfc('0x15'))(_0xadfc('0x16'));var utils=require(_0xadfc('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x164c5e,_0x4bf00d){_0x4bf00d=_0x4bf00d||0xcc;return function(_0x3d728e){if(_0x3d728e){return _0x164c5e[_0xadfc('0x18')](_0x4bf00d);}return _0x164c5e[_0xadfc('0x19')](_0x4bf00d)[_0xadfc('0x1a')]();};}function respondWithResult(_0x53f293,_0x4ce48c){_0x4ce48c=_0x4ce48c||0xc8;return function(_0x218028){if(_0x218028){return _0x53f293[_0xadfc('0x19')](_0x4ce48c)['json'](_0x218028);}};}function respondWithFilteredResult(_0x142ee1,_0xcb274){return function(_0x28938d){if(_0x28938d){var _0x3ce36e=typeof _0xcb274[_0xadfc('0x1b')]===_0xadfc('0x1c')&&typeof _0xcb274[_0xadfc('0x1d')]===_0xadfc('0x1c');var _0x1de6c8=_0x28938d[_0xadfc('0x1e')];var _0x3b3e8e=_0x3ce36e?0x0:_0xcb274[_0xadfc('0x1b')];var _0x45e0c3=_0x3ce36e?_0x28938d['count']:_0xcb274[_0xadfc('0x1b')]+_0xcb274[_0xadfc('0x1d')];var _0x17b305;if(_0x45e0c3>=_0x1de6c8){_0x45e0c3=_0x1de6c8;_0x17b305=0xc8;}else{_0x17b305=0xce;}_0x142ee1['status'](_0x17b305);return _0x142ee1['set']('Content-Range',_0x3b3e8e+'-'+_0x45e0c3+'/'+_0x1de6c8)[_0xadfc('0x1f')](_0x28938d);}return null;};}function patchUpdates(_0x499c1d){return function(_0x335c67){try{jsonpatch[_0xadfc('0x20')](_0x335c67,_0x499c1d,!![]);}catch(_0x4f5b0f){return BPromise[_0xadfc('0x21')](_0x4f5b0f);}return _0x335c67[_0xadfc('0x22')]();};}function saveUpdates(_0x5f26dc,_0x127329){return function(_0x3152a3){if(_0x3152a3){return _0x3152a3[_0xadfc('0x23')](_0x5f26dc)['then'](function(_0x2e2993){return _0x2e2993;});}return null;};}function removeEntity(_0x311189,_0x26c408){return function(_0x1048aa){if(_0x1048aa){return _0x1048aa[_0xadfc('0x24')]()[_0xadfc('0x25')](function(){_0x311189[_0xadfc('0x19')](0xcc)[_0xadfc('0x1a')]();});}};}function handleEntityNotFound(_0x27e978,_0x539571){return function(_0x2d4f99){if(!_0x2d4f99){_0x27e978[_0xadfc('0x18')](0x194);}return _0x2d4f99;};}function handleError(_0x58199a,_0x961aae){_0x961aae=_0x961aae||0x1f4;return function(_0x1e1e89){logger[_0xadfc('0x26')](_0x1e1e89['stack']);if(_0x1e1e89['name']){delete _0x1e1e89[_0xadfc('0x27')];}_0x58199a[_0xadfc('0x19')](_0x961aae)[_0xadfc('0x28')](_0x1e1e89);};}exports[_0xadfc('0x23')]=function(_0x329fcc,_0x1ce3ce){if(_0x329fcc[_0xadfc('0x29')]['id']){delete _0x329fcc['body']['id'];}return db[_0xadfc('0x2a')][_0xadfc('0x2b')]({'where':{'id':_0x329fcc['params']['id']}})[_0xadfc('0x25')](handleEntityNotFound(_0x1ce3ce,null))[_0xadfc('0x25')](saveUpdates(_0x329fcc[_0xadfc('0x29')],null))[_0xadfc('0x25')](respondWithResult(_0x1ce3ce,null))[_0xadfc('0x2c')](handleError(_0x1ce3ce,null));};exports[_0xadfc('0x24')]=function(_0x561904,_0x5cb5c3){return db[_0xadfc('0x2a')][_0xadfc('0x2b')]({'where':{'id':_0x561904[_0xadfc('0x2d')]['id']}})[_0xadfc('0x25')](handleEntityNotFound(_0x5cb5c3,null))[_0xadfc('0x25')](removeEntity(_0x5cb5c3,null))[_0xadfc('0x2c')](handleError(_0x5cb5c3,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3d42b8b..fc78f82 100644 --- a/server/api/action/action.model.js +++ b/server/api/action/action.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe171=['../../config/environment','./action.attributes','define','Action','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xe171,0xeb));var _0x1e17=function(_0x675a2b,_0x2b12c0){_0x675a2b=_0x675a2b-0x0;var _0x449c09=_0xe171[_0x675a2b];return _0x449c09;};'use strict';var _=require(_0x1e17('0x0'));var util=require('util');var logger=require(_0x1e17('0x1'))(_0x1e17('0x2'));var moment=require(_0x1e17('0x3'));var BPromise=require('bluebird');var rp=require(_0x1e17('0x4'));var fs=require('fs');var path=require(_0x1e17('0x5'));var rimraf=require(_0x1e17('0x6'));var config=require(_0x1e17('0x7'));var attributes=require(_0x1e17('0x8'));module['exports']=function(_0x364dae,_0x5b14ad){return _0x364dae[_0x1e17('0x9')](_0x1e17('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbed=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x34e337,_0x3f5675){var _0x1b43d5=function(_0x40f444){while(--_0x40f444){_0x34e337['push'](_0x34e337['shift']());}};_0x1b43d5(++_0x3f5675);}(_0xcbed,0x17f));var _0xdcbe=function(_0x2438cd,_0x42315f){_0x2438cd=_0x2438cd-0x0;var _0xce4cc4=_0xcbed[_0x2438cd];return _0xce4cc4;};'use strict';var _=require(_0xdcbe('0x0'));var util=require(_0xdcbe('0x1'));var logger=require(_0xdcbe('0x2'))('api');var moment=require(_0xdcbe('0x3'));var BPromise=require(_0xdcbe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcbe('0x5'));var rimraf=require(_0xdcbe('0x6'));var config=require(_0xdcbe('0x7'));var attributes=require(_0xdcbe('0x8'));module[_0xdcbe('0x9')]=function(_0x11ea3d,_0x1aff03){return _0x11ea3d[_0xdcbe('0xa')](_0xdcbe('0xb'),attributes,{'tableName':_0xdcbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 4f54fcb..63251c7 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x484b3a,_0xaf92a9){var _0x589b4c=function(_0x4f9145){while(--_0x4f9145){_0x484b3a['push'](_0x484b3a['shift']());}};_0x589b4c(++_0xaf92a9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x5fc3[_0x58c851];return _0x534d8a;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x503d83,_0x8ba1fd){var _0x5b4023=function(_0x49ab80){while(--_0x49ab80){_0x503d83['push'](_0x503d83['shift']());}};_0x5b4023(++_0x8ba1fd);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4a1423,_0x5b4611){_0x4a1423=_0x4a1423-0x0;var _0x20d862=_0x8ef6[_0x4a1423];return _0x20d862;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b54cffc..4c36d49 100644 --- a/server/api/action/index.js +++ b/server/api/action/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b78=['./action.controller','put','/:id','update','delete','isAuthenticated','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x6ec9ef,_0x554295){var _0x43bc06=function(_0x5eba8d){while(--_0x5eba8d){_0x6ec9ef['push'](_0x6ec9ef['shift']());}};_0x43bc06(++_0x554295);}(_0x6b78,0xd9));var _0x86b7=function(_0x484a6e,_0x2c5949){_0x484a6e=_0x484a6e-0x0;var _0x571693=_0x6b78[_0x484a6e];return _0x571693;};'use strict';var multer=require(_0x86b7('0x0'));var util=require(_0x86b7('0x1'));var path=require(_0x86b7('0x2'));var timeout=require('connect-timeout');var express=require(_0x86b7('0x3'));var router=express[_0x86b7('0x4')]();var fs_extra=require(_0x86b7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x86b7('0x6'));var config=require(_0x86b7('0x7'));var controller=require(_0x86b7('0x8'));router[_0x86b7('0x9')](_0x86b7('0xa'),auth['isAuthenticated'](),controller[_0x86b7('0xb')]);router[_0x86b7('0xc')](_0x86b7('0xa'),auth[_0x86b7('0xd')](),controller['destroy']);module[_0x86b7('0xe')]=router; \ No newline at end of file +var _0x0a15=['delete','/:id','exports','multer','util','path','connect-timeout','Router','./action.controller','put','isAuthenticated','update'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x0a15,0xb7));var _0x50a1=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x0a15[_0x32b542];return _0x554d54;};'use strict';var multer=require(_0x50a1('0x0'));var util=require(_0x50a1('0x1'));var path=require(_0x50a1('0x2'));var timeout=require(_0x50a1('0x3'));var express=require('express');var router=express[_0x50a1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x50a1('0x5'));router[_0x50a1('0x6')]('/:id',auth[_0x50a1('0x7')](),controller[_0x50a1('0x8')]);router[_0x50a1('0x9')](_0x50a1('0xa'),auth[_0x50a1('0x7')](),controller['destroy']);module[_0x50a1('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index aa0c0b1..9d720c1 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda19=['exports','STRING','TEXT'];(function(_0x20d161,_0x487655){var _0x35d9e9=function(_0x1ed96a){while(--_0x1ed96a){_0x20d161['push'](_0x20d161['shift']());}};_0x35d9e9(++_0x487655);}(_0xda19,0xd5));var _0x9da1=function(_0x18079d,_0x73a61c){_0x18079d=_0x18079d-0x0;var _0x698079=_0xda19[_0x18079d];return _0x698079;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x1881ac,_0x57ecf4){var _0x3b966e=function(_0x134036){while(--_0x134036){_0x1881ac['push'](_0x1881ac['shift']());}};_0x3b966e(++_0x57ecf4);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5101f1,_0x1868d5){_0x5101f1=_0x5101f1-0x0;var _0x2d8b7e=_0x3eea[_0x5101f1];return _0x2d8b7e;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2ceab26..b0bcdd0 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.controller.js +++ b/server/api/analyticCustomReport/analyticCustomReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7b1=['options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','right_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','orderBy','order','DESC','alias','joins','parse','parentKey','%s.%s\x20=\x20%s.%s','foreignTable','foreignKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','Sequelize','groupBy','clone','web','fullPath','randomstring','generate','output','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','savename','countTable','run','runReport','operator','ValidationErrorItem','metric','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL'];(function(_0x57dfc8,_0x5f35b8){var _0x4213aa=function(_0x3266ab){while(--_0x3266ab){_0x57dfc8['push'](_0x57dfc8['shift']());}};_0x4213aa(++_0x5f35b8);}(_0xd7b1,0x1ab));var _0x1d7b=function(_0x1bf828,_0xd3919d){_0x1bf828=_0x1bf828-0x0;var _0x5deba2=_0xd7b1[_0x1bf828];return _0x5deba2;};'use strict';var emlformat=require(_0x1d7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d7b('0x1'));var jsonpatch=require(_0x1d7b('0x2'));var rp=require(_0x1d7b('0x3'));var moment=require(_0x1d7b('0x4'));var BPromise=require(_0x1d7b('0x5'));var Mustache=require(_0x1d7b('0x6'));var util=require(_0x1d7b('0x7'));var path=require(_0x1d7b('0x8'));var sox=require(_0x1d7b('0x9'));var csv=require(_0x1d7b('0xa'));var ejs=require(_0x1d7b('0xb'));var fs=require('fs');var fs_extra=require(_0x1d7b('0xc'));var _=require('lodash');var squel=require(_0x1d7b('0xd'));var crypto=require(_0x1d7b('0xe'));var jsforce=require(_0x1d7b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1d7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d7b('0x11'));var as=require(_0x1d7b('0x12'));var hardwareService=require(_0x1d7b('0x13'));var logger=require(_0x1d7b('0x14'))(_0x1d7b('0x15'));var utils=require(_0x1d7b('0x16'));var config=require(_0x1d7b('0x17'));var licenseUtil=require(_0x1d7b('0x18'));var db=require(_0x1d7b('0x19'))['db'];var dbH=require(_0x1d7b('0x19'))['dbH'];function respondWithStatusCode(_0x592204,_0xbbb68f){_0xbbb68f=_0xbbb68f||0xcc;return function(_0x58ee0f){if(_0x58ee0f){return _0x592204[_0x1d7b('0x1a')](_0xbbb68f);}return _0x592204['status'](_0xbbb68f)[_0x1d7b('0x1b')]();};}function respondWithResult(_0x46e964,_0x5189a9){_0x5189a9=_0x5189a9||0xc8;return function(_0x35597){if(_0x35597){return _0x46e964[_0x1d7b('0x1c')](_0x5189a9)[_0x1d7b('0x1d')](_0x35597);}};}function respondWithFilteredResult(_0x7de54f,_0x924d9b){return function(_0x239bad){if(_0x239bad){var _0x3c914b=typeof _0x924d9b[_0x1d7b('0x1e')]===_0x1d7b('0x1f')&&typeof _0x924d9b[_0x1d7b('0x20')]===_0x1d7b('0x1f');var _0x13bf43=_0x239bad[_0x1d7b('0x21')];var _0x3085c7=_0x3c914b?0x0:_0x924d9b[_0x1d7b('0x1e')];var _0x4ea19f=_0x3c914b?_0x239bad['count']:_0x924d9b['offset']+_0x924d9b[_0x1d7b('0x20')];var _0x44b4d5;if(_0x4ea19f>=_0x13bf43){_0x4ea19f=_0x13bf43;_0x44b4d5=0xc8;}else{_0x44b4d5=0xce;}_0x7de54f[_0x1d7b('0x1c')](_0x44b4d5);return _0x7de54f[_0x1d7b('0x22')](_0x1d7b('0x23'),_0x3085c7+'-'+_0x4ea19f+'/'+_0x13bf43)[_0x1d7b('0x1d')](_0x239bad);}return null;};}function patchUpdates(_0x3eb36c){return function(_0x98b4ad){try{jsonpatch[_0x1d7b('0x24')](_0x98b4ad,_0x3eb36c,!![]);}catch(_0x37ee16){return BPromise[_0x1d7b('0x25')](_0x37ee16);}return _0x98b4ad[_0x1d7b('0x26')]();};}function saveUpdates(_0x1becdc,_0x3a15bf){return function(_0x3abec3){if(_0x3abec3){return _0x3abec3[_0x1d7b('0x27')](_0x1becdc)[_0x1d7b('0x28')](function(_0x1aac9){return _0x1aac9;});}return null;};}function removeEntity(_0x23d537,_0x53a94b){return function(_0x323575){if(_0x323575){return _0x323575[_0x1d7b('0x29')]()['then'](function(){var _0x17ea1c=_0x323575[_0x1d7b('0x2a')]({'plain':!![]});var _0x1209c5=_0x1d7b('0x2b');return db[_0x1d7b('0x2c')][_0x1d7b('0x29')]({'where':{'type':_0x1209c5,'resourceId':_0x17ea1c['id']}})[_0x1d7b('0x28')](function(){return _0x323575;});})[_0x1d7b('0x28')](function(){_0x23d537[_0x1d7b('0x1c')](0xcc)[_0x1d7b('0x1b')]();});}};}function handleEntityNotFound(_0x481e96,_0x6dd12e){return function(_0x3764b0){if(!_0x3764b0){_0x481e96[_0x1d7b('0x1a')](0x194);}return _0x3764b0;};}function handleError(_0x1ad048,_0x51ac00){_0x51ac00=_0x51ac00||0x1f4;return function(_0x7a6bc3){logger[_0x1d7b('0x2d')](_0x7a6bc3['stack']);if(_0x7a6bc3['name']){delete _0x7a6bc3[_0x1d7b('0x2e')];}_0x1ad048['status'](_0x51ac00)[_0x1d7b('0x2f')](_0x7a6bc3);};}exports['index']=function(_0x182b95,_0x233b52){var _0x2b4da5={},_0x3d427d={},_0x29f18e={'count':0x0,'rows':[]};var _0x18e4e4=_[_0x1d7b('0x30')](db[_0x1d7b('0x31')][_0x1d7b('0x32')],function(_0x3efcba){return{'name':_0x3efcba['fieldName'],'type':_0x3efcba[_0x1d7b('0x33')][_0x1d7b('0x34')]};});_0x3d427d[_0x1d7b('0x35')]=_[_0x1d7b('0x30')](_0x18e4e4,_0x1d7b('0x2e'));_0x3d427d[_0x1d7b('0x36')]=_[_0x1d7b('0x37')](_0x182b95['query']);_0x3d427d[_0x1d7b('0x38')]=_[_0x1d7b('0x39')](_0x3d427d[_0x1d7b('0x35')],_0x3d427d[_0x1d7b('0x36')]);_0x2b4da5[_0x1d7b('0x3a')]=_['intersection'](_0x3d427d['model'],qs[_0x1d7b('0x3b')](_0x182b95[_0x1d7b('0x36')][_0x1d7b('0x3b')]));_0x2b4da5[_0x1d7b('0x3a')]=_0x2b4da5['attributes'][_0x1d7b('0x3c')]?_0x2b4da5[_0x1d7b('0x3a')]:_0x3d427d[_0x1d7b('0x35')];if(!_0x182b95['query'][_0x1d7b('0x3d')](_0x1d7b('0x3e'))){_0x2b4da5[_0x1d7b('0x20')]=qs[_0x1d7b('0x20')](_0x182b95['query']['limit']);_0x2b4da5[_0x1d7b('0x1e')]=qs[_0x1d7b('0x1e')](_0x182b95['query'][_0x1d7b('0x1e')]);}_0x2b4da5['order']=qs[_0x1d7b('0x3f')](_0x182b95['query']['sort']);_0x2b4da5['where']=qs['filters'](_['pick'](_0x182b95[_0x1d7b('0x36')],_0x3d427d[_0x1d7b('0x38')]),_0x18e4e4);if(_0x182b95[_0x1d7b('0x36')][_0x1d7b('0x40')]){_0x2b4da5[_0x1d7b('0x41')]=_[_0x1d7b('0x42')](_0x2b4da5[_0x1d7b('0x41')],{'$or':_[_0x1d7b('0x30')](_0x18e4e4,function(_0x4af89b){if(_0x4af89b['type']!==_0x1d7b('0x43')){var _0x565baf={};_0x565baf[_0x4af89b[_0x1d7b('0x2e')]]={'$like':'%'+_0x182b95[_0x1d7b('0x36')][_0x1d7b('0x40')]+'%'};return _0x565baf;}})});}_0x2b4da5=_[_0x1d7b('0x42')]({},_0x2b4da5,_0x182b95[_0x1d7b('0x44')]);var _0x4d08d6={'where':_0x2b4da5[_0x1d7b('0x41')]};return db['AnalyticCustomReport']['count'](_0x4d08d6)[_0x1d7b('0x28')](function(_0x4e4ed7){_0x29f18e['count']=_0x4e4ed7;if(_0x182b95[_0x1d7b('0x36')][_0x1d7b('0x45')]){_0x2b4da5[_0x1d7b('0x46')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x1d7b('0x47')](_0x2b4da5);})[_0x1d7b('0x28')](function(_0x428548){_0x29f18e[_0x1d7b('0x48')]=_0x428548;return _0x29f18e;})[_0x1d7b('0x28')](respondWithFilteredResult(_0x233b52,_0x2b4da5))[_0x1d7b('0x49')](handleError(_0x233b52,null));};exports[_0x1d7b('0x4a')]=function(_0x43ec1c,_0x28a7a0){var _0x186f77={'raw':![],'where':{'id':_0x43ec1c['params']['id']}},_0x381361={};_0x381361[_0x1d7b('0x35')]=_['keys'](db[_0x1d7b('0x31')]['rawAttributes']);_0x381361[_0x1d7b('0x36')]=_['keys'](_0x43ec1c[_0x1d7b('0x36')]);_0x381361['filters']=_['intersection'](_0x381361[_0x1d7b('0x35')],_0x381361['query']);_0x186f77['attributes']=_[_0x1d7b('0x39')](_0x381361[_0x1d7b('0x35')],qs[_0x1d7b('0x3b')](_0x43ec1c[_0x1d7b('0x36')][_0x1d7b('0x3b')]));_0x186f77['attributes']=_0x186f77[_0x1d7b('0x3a')][_0x1d7b('0x3c')]?_0x186f77[_0x1d7b('0x3a')]:_0x381361[_0x1d7b('0x35')];if(_0x43ec1c[_0x1d7b('0x36')][_0x1d7b('0x45')]){_0x186f77['include']=[{'all':!![]}];}_0x186f77=_[_0x1d7b('0x42')]({},_0x186f77,_0x43ec1c[_0x1d7b('0x44')]);return db[_0x1d7b('0x31')][_0x1d7b('0x4b')](_0x186f77)[_0x1d7b('0x28')](handleEntityNotFound(_0x28a7a0,null))['then'](respondWithResult(_0x28a7a0,null))[_0x1d7b('0x49')](handleError(_0x28a7a0,null));};exports[_0x1d7b('0x4c')]=function(_0x4d5b4e,_0x1b46a5){return db[_0x1d7b('0x31')][_0x1d7b('0x4c')](_0x4d5b4e[_0x1d7b('0x4d')],{})[_0x1d7b('0x28')](function(_0x266144){var _0x285b80=_0x4d5b4e[_0x1d7b('0x4e')][_0x1d7b('0x2a')]({'plain':!![]});if(!_0x285b80)throw new Error(_0x1d7b('0x4f'));if(_0x285b80[_0x1d7b('0x50')]==='user'){var _0x1ea7b8=_0x266144[_0x1d7b('0x2a')]({'plain':!![]});var _0x4a04c9=_0x1d7b('0x51');return db[_0x1d7b('0x52')][_0x1d7b('0x4b')]({'where':{'name':_0x4a04c9,'userProfileId':_0x285b80[_0x1d7b('0x53')]},'raw':!![]})[_0x1d7b('0x28')](function(_0x5b4e82){if(_0x5b4e82&&_0x5b4e82[_0x1d7b('0x54')]===0x0){return db[_0x1d7b('0x2c')][_0x1d7b('0x4c')]({'name':_0x1ea7b8[_0x1d7b('0x2e')],'resourceId':_0x1ea7b8['id'],'type':'CustomReports','sectionId':_0x5b4e82['id']},{})[_0x1d7b('0x28')](function(){return _0x266144;});}else{return _0x266144;}})['catch'](function(_0x952c54){logger[_0x1d7b('0x2d')](_0x1d7b('0x55'),_0x952c54);throw _0x952c54;});}return _0x266144;})[_0x1d7b('0x28')](respondWithResult(_0x1b46a5,0xc9))[_0x1d7b('0x49')](handleError(_0x1b46a5,null));};exports[_0x1d7b('0x27')]=function(_0x260392,_0xcc0c50){if(_0x260392[_0x1d7b('0x4d')]['id']){delete _0x260392[_0x1d7b('0x4d')]['id'];}return db[_0x1d7b('0x31')][_0x1d7b('0x4b')]({'where':{'id':_0x260392['params']['id']}})[_0x1d7b('0x28')](handleEntityNotFound(_0xcc0c50,null))[_0x1d7b('0x28')](saveUpdates(_0x260392['body'],null))['then'](respondWithResult(_0xcc0c50,null))[_0x1d7b('0x49')](handleError(_0xcc0c50,null));};exports[_0x1d7b('0x29')]=function(_0x4e74d7,_0x3e47bc){return db['AnalyticCustomReport'][_0x1d7b('0x4b')]({'where':{'id':_0x4e74d7[_0x1d7b('0x56')]['id']}})[_0x1d7b('0x28')](handleEntityNotFound(_0x3e47bc,null))['then'](removeEntity(_0x3e47bc,null))[_0x1d7b('0x49')](handleError(_0x3e47bc,null));};exports['preview']=function(_0x4a550a,_0x445798){var _0x184cc5=0xa;var _0xc2af=[_0x1d7b('0x57'),_0x1d7b('0x58'),_0x1d7b('0x59'),'cross_join'];var _0x351d5b={'SUM':_0x1d7b('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1d7b('0x5b'),'MIN':_0x1d7b('0x5c'),'AVG':_0x1d7b('0x5d'),'GROUP_CONCAT':_0x1d7b('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1d7b('0x5f')};var _0x3fb99a={'SEC_TO_TIME':_0x1d7b('0x60'),'DATE':_0x1d7b('0x61'),'HOUR':_0x1d7b('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1d7b('0x63')};var _0x1bf231=function(_0x406ff2){return!_[_0x1d7b('0x64')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1d7b('0x65'),_0x1d7b('0x66')],_0x406ff2);};var _0x2da1fe=function(_0x5b04dc){if(!_0x5b04dc||!_0x5b04dc[_0x1d7b('0x67')][_0x1d7b('0x3c')]){return'';}for(var _0x55a81e='(',_0x5d8277=0x0;_0x5d8277<_0x5b04dc[_0x1d7b('0x67')][_0x1d7b('0x3c')];_0x5d8277+=0x1){_0x5d8277>0x0&&(_0x55a81e+='\x20'+_0x5b04dc['operator']+'\x20');_0x55a81e+=_0x5b04dc[_0x1d7b('0x67')][_0x5d8277][_0x1d7b('0x68')]?_0x2da1fe(_0x5b04dc[_0x1d7b('0x67')][_0x5d8277][_0x1d7b('0x68')]):_0x5b04dc['rules'][_0x5d8277][_0x1d7b('0x69')]+'\x20'+_0x5b04dc[_0x1d7b('0x67')][_0x5d8277][_0x1d7b('0x6a')]+(_0x1bf231(_0x5b04dc[_0x1d7b('0x67')][_0x5d8277][_0x1d7b('0x6a')])?'\x20'+_0x5b04dc['rules'][_0x5d8277][_0x1d7b('0x6b')]:'');}return _0x55a81e+')';};var _0x2d110c={'where':{'id':_0x4a550a['params']['id']}},_0x3ac628,_0x110781,_0x2d59a5,_0x1ebb8c,_0x25e7fb;_0x2d110c=_[_0x1d7b('0x42')]({},_0x2d110c,_0x4a550a[_0x1d7b('0x44')]);return db[_0x1d7b('0x31')][_0x1d7b('0x4b')](_0x2d110c)['then'](function(_0x192ba5){if(_0x192ba5){_0x3ac628=_0x192ba5;return _0x192ba5[_0x1d7b('0x6c')]();}return null;})[_0x1d7b('0x28')](function(_0x5ef1dd){if(_0x5ef1dd){if(!_0x5ef1dd[_0x1d7b('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x1d7b('0x6d'),0x193);}_0x110781=_0x5ef1dd;return db[_0x1d7b('0x6e')][_0x1d7b('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3b3a4b){if(_0x3b3a4b){_0x2d59a5=_[_0x1d7b('0x6f')](_0x3b3a4b,'id');var _0x2a66c1;var _0x3dc199=squel[_0x1d7b('0x70')]();_0x3dc199[_0x1d7b('0x71')](_0x3ac628[_0x1d7b('0x72')]);for(var _0x56b5c0=0x0;_0x56b5c0<_0x110781[_0x1d7b('0x3c')];_0x56b5c0+=0x1){_0x2a66c1=_0x110781[_0x56b5c0][_0x1d7b('0x73')]?_0x2d59a5[_0x110781[_0x56b5c0]['MetricId']]['metric']:_0x110781[_0x56b5c0][_0x1d7b('0x69')];_0x2a66c1=_0x110781[_0x56b5c0][_0x1d7b('0x74')]?_[_0x1d7b('0x75')](_0x351d5b[_0x110781[_0x56b5c0][_0x1d7b('0x74')]],'%s',_0x2a66c1):_0x2a66c1;_0x2a66c1=_0x110781[_0x56b5c0][_0x1d7b('0x76')]?_[_0x1d7b('0x75')](_0x3fb99a[_0x110781[_0x56b5c0]['format']],'%s',_0x2a66c1):_0x2a66c1;if(_0x110781[_0x56b5c0]['groupBy']){_0x3dc199[_0x1d7b('0x68')](_0x2a66c1);}_0x110781[_0x56b5c0][_0x1d7b('0x77')]&&_0x3dc199[_0x1d7b('0x78')](_0x2a66c1,_0x110781[_0x56b5c0]['orderBy']===_0x1d7b('0x79')?![]:!![]);_0x3dc199['field'](_0x2a66c1,_0x110781[_0x56b5c0][_0x1d7b('0x7a')]||_0x2a66c1);}if(_0x3ac628['joins']){_0x3ac628[_0x1d7b('0x7b')]=JSON[_0x1d7b('0x7c')](_0x3ac628['joins']);for(var _0x482297=0x0;_0x482297<_0x3ac628[_0x1d7b('0x7b')][_0x1d7b('0x3c')];_0x482297+=0x1){if(_0x3ac628[_0x1d7b('0x7b')][_0x482297][_0x1d7b('0x33')]&&_[_0x1d7b('0x64')](_0xc2af,_0x3ac628[_0x1d7b('0x7b')][_0x482297][_0x1d7b('0x33')])&&_0x3ac628['joins'][_0x482297][_0x1d7b('0x7d')]&&_0x3ac628[_0x1d7b('0x7b')][_0x482297]['foreignTable']&&_0x3ac628[_0x1d7b('0x7b')][_0x482297]['foreignKey']){_0x3dc199[_0x3ac628['joins'][_0x482297]['type']](_0x3ac628[_0x1d7b('0x7b')][_0x482297]['foreignTable'],null,util['format'](_0x1d7b('0x7e'),_0x3ac628['table'],_0x3ac628[_0x1d7b('0x7b')][_0x482297]['parentKey'],_0x3ac628[_0x1d7b('0x7b')][_0x482297][_0x1d7b('0x7f')],_0x3ac628[_0x1d7b('0x7b')][_0x482297][_0x1d7b('0x80')]));}}}if(_0x3ac628['conditions']){_0x3ac628[_0x1d7b('0x81')]=JSON['parse'](_0x3ac628[_0x1d7b('0x81')]);_0x3dc199[_0x1d7b('0x41')](_0x2da1fe(_0x3ac628[_0x1d7b('0x81')][_0x1d7b('0x68')]));}_0x25e7fb=_0x3dc199['clone']();_0x3dc199[_0x1d7b('0x20')](_0x184cc5);_0x3dc199['offset'](0x0);logger['debug'](_0x1d7b('0x82'),_0x3dc199[_0x1d7b('0x83')]());return dbH['sequelize']['query'](_0x3dc199['toString'](),{'type':dbH[_0x1d7b('0x84')][_0x1d7b('0x85')][_0x1d7b('0x86')]});}})[_0x1d7b('0x28')](respondWithResult(_0x445798,null))[_0x1d7b('0x49')](handleError(_0x445798,null));};function runReport(_0xe18960,_0x204703,_0x5cd5eb){var _0x3bc633=_0x204703[_0x1d7b('0x2e')];var _0x44ac92=0xa;var _0x1a6350=['join',_0x1d7b('0x58'),_0x1d7b('0x59'),_0x1d7b('0x87')];var _0x572358={'SUM':_0x1d7b('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1d7b('0x88'),'MAX':'MAX(%s)','MIN':_0x1d7b('0x5c'),'AVG':_0x1d7b('0x5d'),'GROUP_CONCAT':_0x1d7b('0x5e'),'GROUP_CONCAT ASC':_0x1d7b('0x89'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x581ba7={'SEC_TO_TIME':_0x1d7b('0x60'),'DATE':_0x1d7b('0x61'),'HOUR':_0x1d7b('0x62'),'ROUND':_0x1d7b('0x8a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x35a702=function(_0x1f48b8){return!_[_0x1d7b('0x64')]([_0x1d7b('0x8b'),'IS\x20NOT\x20NULL',_0x1d7b('0x65'),'IS\x20NOT\x20EMPTY'],_0x1f48b8);};var _0x32eea6=function(_0x1c4665){if(!_0x1c4665||!_0x1c4665[_0x1d7b('0x67')]['length']){return'';}for(var _0x439082='(',_0x103b16=0x0;_0x103b16<_0x1c4665[_0x1d7b('0x67')]['length'];_0x103b16+=0x1){_0x103b16>0x0&&(_0x439082+='\x20'+_0x1c4665['operator']+'\x20');_0x439082+=_0x1c4665[_0x1d7b('0x67')][_0x103b16]['group']?_0x32eea6(_0x1c4665[_0x1d7b('0x67')][_0x103b16]['group']):_0x1c4665[_0x1d7b('0x67')][_0x103b16][_0x1d7b('0x69')]+'\x20'+_0x1c4665[_0x1d7b('0x67')][_0x103b16]['condition']+(_0x35a702(_0x1c4665[_0x1d7b('0x67')][_0x103b16][_0x1d7b('0x6a')])?'\x20'+_0x1c4665[_0x1d7b('0x67')][_0x103b16][_0x1d7b('0x6b')]:'');}return _0x439082+')';};var _0xd7ea4={'where':{'id':_0xe18960['id']}},_0x32bf05,_0x1d00d3,_0x233018,_0x572a70,_0x5e2924;_0xd7ea4=_[_0x1d7b('0x42')]({},_0xd7ea4,_0x5cd5eb);return db[_0x1d7b('0x31')][_0x1d7b('0x4b')](_0xd7ea4)['then'](function(_0x4079da){if(_0x4079da){_0x32bf05=_0x4079da;return _0x4079da['getFields']();}return null;})[_0x1d7b('0x28')](function(_0x459791){if(_0x459791){if(!_0x459791[_0x1d7b('0x3c')]){throw new db[(_0x1d7b('0x8c'))]['ValidationErrorItem'](_0x1d7b('0x6d'),0x193);}_0x1d00d3=_0x459791;return db[_0x1d7b('0x6e')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x30912e){if(_0x30912e){_0x233018=_['keyBy'](_0x30912e,'id');var _0x9e23f;var _0x4cad20=squel[_0x1d7b('0x70')]();_0x4cad20['from'](_0x32bf05['table']);for(var _0x51c0f1=0x0;_0x51c0f1<_0x1d00d3[_0x1d7b('0x3c')];_0x51c0f1+=0x1){_0x9e23f=_0x1d00d3[_0x51c0f1][_0x1d7b('0x73')]?_0x233018[_0x1d00d3[_0x51c0f1][_0x1d7b('0x73')]]['metric']:_0x1d00d3[_0x51c0f1][_0x1d7b('0x69')];_0x9e23f=_0x1d00d3[_0x51c0f1][_0x1d7b('0x74')]?_['replace'](_0x572358[_0x1d00d3[_0x51c0f1][_0x1d7b('0x74')]],'%s',_0x9e23f):_0x9e23f;_0x9e23f=_0x1d00d3[_0x51c0f1][_0x1d7b('0x76')]?_[_0x1d7b('0x75')](_0x581ba7[_0x1d00d3[_0x51c0f1][_0x1d7b('0x76')]],'%s',_0x9e23f):_0x9e23f;if(_0x1d00d3[_0x51c0f1][_0x1d7b('0x8d')]){_0x4cad20[_0x1d7b('0x68')](_0x9e23f);}_0x1d00d3[_0x51c0f1][_0x1d7b('0x77')]&&_0x4cad20[_0x1d7b('0x78')](_0x9e23f,_0x1d00d3[_0x51c0f1][_0x1d7b('0x77')]===_0x1d7b('0x79')?![]:!![]);_0x4cad20[_0x1d7b('0x69')](_0x9e23f,_0x1d00d3[_0x51c0f1][_0x1d7b('0x7a')]||_0x9e23f);}if(_0x32bf05[_0x1d7b('0x7b')]){_0x32bf05[_0x1d7b('0x7b')]=JSON[_0x1d7b('0x7c')](_0x32bf05[_0x1d7b('0x7b')]);for(var _0x1d31e0=0x0;_0x1d31e0<_0x32bf05['joins'][_0x1d7b('0x3c')];_0x1d31e0+=0x1){if(_0x32bf05[_0x1d7b('0x7b')][_0x1d31e0][_0x1d7b('0x33')]&&_[_0x1d7b('0x64')](_0x1a6350,_0x32bf05['joins'][_0x1d31e0][_0x1d7b('0x33')])&&_0x32bf05[_0x1d7b('0x7b')][_0x1d31e0][_0x1d7b('0x7d')]&&_0x32bf05['joins'][_0x1d31e0]['foreignTable']&&_0x32bf05[_0x1d7b('0x7b')][_0x1d31e0][_0x1d7b('0x80')]){_0x4cad20[_0x32bf05['joins'][_0x1d31e0]['type']](_0x32bf05['joins'][_0x1d31e0][_0x1d7b('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x32bf05[_0x1d7b('0x72')],_0x32bf05[_0x1d7b('0x7b')][_0x1d31e0][_0x1d7b('0x7d')],_0x32bf05[_0x1d7b('0x7b')][_0x1d31e0][_0x1d7b('0x7f')],_0x32bf05[_0x1d7b('0x7b')][_0x1d31e0]['foreignKey']));}}}if(_0x32bf05[_0x1d7b('0x81')]){_0x32bf05[_0x1d7b('0x81')]=JSON[_0x1d7b('0x7c')](_0x32bf05[_0x1d7b('0x81')]);_0x4cad20[_0x1d7b('0x41')](_0x32eea6(_0x32bf05[_0x1d7b('0x81')][_0x1d7b('0x68')]));}_0x5e2924=_0x4cad20[_0x1d7b('0x8e')]();_0x4cad20[_0x1d7b('0x20')](_0x44ac92);_0x4cad20['offset'](0x0);return;}})['then'](function(){if(_0x204703['output']===_0x1d7b('0x8f')){return null;}var _0x59b8ee=_[_0x1d7b('0x42')](_0x204703,{'name':_0x204703[_0x1d7b('0x90')]||_0x204703[_0x1d7b('0x2e')]||_0x32bf05[_0x1d7b('0x2e')],'basename':_0x3bc633,'savename':util[_0x1d7b('0x76')]('%s-%s.%s',_0x204703[_0x1d7b('0x2e')]||_0x32bf05['name'],require(_0x1d7b('0x91'))[_0x1d7b('0x92')](0x4),_0x204703[_0x1d7b('0x93')]||'csv'),'reportId':_0x32bf05['id'],'reportType':_0x1d7b('0x94')});return db['AnalyticExtractedReport'][_0x1d7b('0x4c')](_0x59b8ee,{'raw':!![]});})[_0x1d7b('0x28')](function(_0x5061c0){if(_0x32bf05['table']===_0x1d7b('0x95')){_0x5e2924[_0x1d7b('0x41')](_0x32bf05['table']+_0x1d7b('0x96'),_0x204703['startDate'],_0x204703[_0x1d7b('0x97')]);}else{_0x5e2924['where'](_0x32bf05[_0x1d7b('0x72')]+_0x1d7b('0x98'),_0x204703[_0x1d7b('0x99')],_0x204703[_0x1d7b('0x97')]);}if(_0x5061c0){logger[_0x1d7b('0x9a')](_0x1d7b('0x9b'),_0x5e2924[_0x1d7b('0x83')]());require('child_process')[_0x1d7b('0x9c')](path[_0x1d7b('0x57')](__dirname,'../../components/export/',_0x5061c0[_0x1d7b('0x93')]),[_0x5061c0['id'],_0x5e2924['toString'](),path[_0x1d7b('0x57')](__dirname,'../../files/reports',_0x5061c0[_0x1d7b('0x9d')]),_0x3bc633]);return _0x5061c0;}else{var _0x395b16=squel[_0x1d7b('0x70')]();_0x395b16[_0x1d7b('0x71')]('('+_0x5e2924[_0x1d7b('0x83')]()+')',_0x1d7b('0x9e'));_0x395b16[_0x1d7b('0x69')]('COUNT(*)','count');_0x5e2924[_0x1d7b('0x20')](_0x204703[_0x1d7b('0x20')]||_0x44ac92);_0x5e2924[_0x1d7b('0x1e')](_0x204703[_0x1d7b('0x1e')]||0x0);return dbH['sequelize'][_0x1d7b('0x36')](_0x395b16[_0x1d7b('0x83')](),{'type':dbH[_0x1d7b('0x84')]['QueryTypes']['SELECT']})['then'](function(_0x342482){if(!_0x342482[_0x1d7b('0x3c')]){_0x572a70=0x0;}else{_0x572a70=_0x342482[0x0][_0x1d7b('0x21')]||0x0;}return dbH[_0x1d7b('0x84')]['query'](_0x5e2924[_0x1d7b('0x83')](),{'type':dbH['sequelize'][_0x1d7b('0x85')][_0x1d7b('0x86')]});})['then'](function(_0x307a79){return{'rows':_0x307a79||[],'count':_0x572a70};});}});}exports[_0x1d7b('0x9f')]=function(_0x3d64b7,_0x5024c4){return runReport(_0x3d64b7[_0x1d7b('0x56')],_0x3d64b7[_0x1d7b('0x36')],_0x3d64b7['options'])[_0x1d7b('0x28')](respondWithResult(_0x5024c4,null))[_0x1d7b('0x49')](handleError(_0x5024c4,null));};exports[_0x1d7b('0xa0')]=runReport;exports[_0x1d7b('0x36')]=function(_0x3009c2,_0x21804b){var _0x445380=0xa;var _0x122701=[_0x1d7b('0x57'),_0x1d7b('0x58'),'right_join',_0x1d7b('0x87')];var _0x5e4ec9={'SUM':_0x1d7b('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1d7b('0x88'),'MAX':_0x1d7b('0x5b'),'MIN':_0x1d7b('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1d7b('0x5e'),'GROUP_CONCAT ASC':_0x1d7b('0x89'),'GROUP_CONCAT DESC':_0x1d7b('0x5f')};var _0x171aa6={'SEC_TO_TIME':_0x1d7b('0x60'),'DATE':_0x1d7b('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x1d7b('0x8a'),'UNIX_TIMESTAMP':_0x1d7b('0x63')};var _0x22d4a2=function(_0x31c2c3){return!_[_0x1d7b('0x64')]([_0x1d7b('0x8b'),'IS\x20NOT\x20NULL',_0x1d7b('0x65'),'IS\x20NOT\x20EMPTY'],_0x31c2c3);};var _0x13f066=function(_0x1679b4){if(!_0x1679b4||!_0x1679b4[_0x1d7b('0x67')]['length']){return'';}for(var _0x17c099='(',_0x1ac92f=0x0;_0x1ac92f<_0x1679b4[_0x1d7b('0x67')]['length'];_0x1ac92f+=0x1){_0x1ac92f>0x0&&(_0x17c099+='\x20'+_0x1679b4[_0x1d7b('0xa1')]+'\x20');_0x17c099+=_0x1679b4[_0x1d7b('0x67')][_0x1ac92f][_0x1d7b('0x68')]?_0x13f066(_0x1679b4[_0x1d7b('0x67')][_0x1ac92f]['group']):_0x1679b4[_0x1d7b('0x67')][_0x1ac92f][_0x1d7b('0x69')]+'\x20'+_0x1679b4[_0x1d7b('0x67')][_0x1ac92f][_0x1d7b('0x6a')]+(_0x22d4a2(_0x1679b4[_0x1d7b('0x67')][_0x1ac92f][_0x1d7b('0x6a')])?'\x20'+_0x1679b4[_0x1d7b('0x67')][_0x1ac92f][_0x1d7b('0x6b')]:'');}return _0x17c099+')';};var _0x53935d={'where':{'id':_0x3009c2[_0x1d7b('0x56')]['id']}},_0x38a89f,_0x37797b,_0xf7b486,_0x31cd71,_0xdbd38b;_0x53935d=_['merge']({},_0x53935d,_0x3009c2['options']);return db[_0x1d7b('0x31')][_0x1d7b('0x4b')](_0x53935d)['then'](function(_0x48267b){if(_0x48267b){_0x38a89f=_0x48267b;return _0x48267b['getFields']();}return null;})['then'](function(_0x425d86){if(_0x425d86){if(!_0x425d86[_0x1d7b('0x3c')]){throw new db[(_0x1d7b('0x8c'))][(_0x1d7b('0xa2'))](_0x1d7b('0x6d'),0x193);}_0x37797b=_0x425d86;return db[_0x1d7b('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x1d7b('0x28')](function(_0x3f0254){if(_0x3f0254){_0xf7b486=_[_0x1d7b('0x6f')](_0x3f0254,'id');var _0x56ceea;var _0x39776a=squel[_0x1d7b('0x70')]();_0x39776a['from'](_0x38a89f[_0x1d7b('0x72')]);for(var _0x6d5e8c=0x0;_0x6d5e8c<_0x37797b[_0x1d7b('0x3c')];_0x6d5e8c+=0x1){_0x56ceea=_0x37797b[_0x6d5e8c][_0x1d7b('0x73')]?_0xf7b486[_0x37797b[_0x6d5e8c]['MetricId']][_0x1d7b('0xa3')]:_0x37797b[_0x6d5e8c][_0x1d7b('0x69')];_0x56ceea=_0x37797b[_0x6d5e8c][_0x1d7b('0x74')]?_[_0x1d7b('0x75')](_0x5e4ec9[_0x37797b[_0x6d5e8c]['function']],'%s',_0x56ceea):_0x56ceea;_0x56ceea=_0x37797b[_0x6d5e8c]['format']?_[_0x1d7b('0x75')](_0x171aa6[_0x37797b[_0x6d5e8c][_0x1d7b('0x76')]],'%s',_0x56ceea):_0x56ceea;if(_0x37797b[_0x6d5e8c][_0x1d7b('0x8d')]){_0x39776a['group'](_0x56ceea);}_0x37797b[_0x6d5e8c][_0x1d7b('0x77')]&&_0x39776a['order'](_0x56ceea,_0x37797b[_0x6d5e8c][_0x1d7b('0x77')]==='DESC'?![]:!![]);_0x39776a[_0x1d7b('0x69')](_0x56ceea,_0x37797b[_0x6d5e8c][_0x1d7b('0x7a')]||_0x56ceea);}if(_0x38a89f[_0x1d7b('0x7b')]){_0x38a89f[_0x1d7b('0x7b')]=JSON[_0x1d7b('0x7c')](_0x38a89f[_0x1d7b('0x7b')]);for(var _0x52a8a4=0x0;_0x52a8a4<_0x38a89f['joins'][_0x1d7b('0x3c')];_0x52a8a4+=0x1){if(_0x38a89f[_0x1d7b('0x7b')][_0x52a8a4][_0x1d7b('0x33')]&&_[_0x1d7b('0x64')](_0x122701,_0x38a89f['joins'][_0x52a8a4]['type'])&&_0x38a89f[_0x1d7b('0x7b')][_0x52a8a4]['parentKey']&&_0x38a89f[_0x1d7b('0x7b')][_0x52a8a4][_0x1d7b('0x7f')]&&_0x38a89f[_0x1d7b('0x7b')][_0x52a8a4][_0x1d7b('0x80')]){_0x39776a[_0x38a89f[_0x1d7b('0x7b')][_0x52a8a4][_0x1d7b('0x33')]](_0x38a89f['joins'][_0x52a8a4][_0x1d7b('0x7f')],null,util[_0x1d7b('0x76')](_0x1d7b('0x7e'),_0x38a89f[_0x1d7b('0x72')],_0x38a89f['joins'][_0x52a8a4][_0x1d7b('0x7d')],_0x38a89f['joins'][_0x52a8a4][_0x1d7b('0x7f')],_0x38a89f[_0x1d7b('0x7b')][_0x52a8a4]['foreignKey']));}}}if(_0x38a89f[_0x1d7b('0x81')]){_0x38a89f['conditions']=JSON[_0x1d7b('0x7c')](_0x38a89f[_0x1d7b('0x81')]);_0x39776a[_0x1d7b('0x41')](_0x13f066(_0x38a89f[_0x1d7b('0x81')]['group']));}_0xdbd38b=_0x39776a[_0x1d7b('0x8e')]();_0x39776a[_0x1d7b('0x20')](_0x445380);_0x39776a[_0x1d7b('0x1e')](0x0);logger[_0x1d7b('0xa4')](_0x1d7b('0x82'),_0x39776a[_0x1d7b('0x83')]());return dbH[_0x1d7b('0x84')][_0x1d7b('0x36')](_0x39776a[_0x1d7b('0x83')](),{'type':dbH['sequelize'][_0x1d7b('0x85')][_0x1d7b('0x86')]});}})[_0x1d7b('0x28')](function(){return{'sql':_0xdbd38b[_0x1d7b('0x83')]()};})[_0x1d7b('0x28')](respondWithResult(_0x21804b,null))[_0x1d7b('0x49')](handleError(_0x21804b,null));}; \ No newline at end of file +var _0xae5f=['rows','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','cross_join','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','foreignTable','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','AnalyticCustomReport','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','includeAll','include','findAll'];(function(_0x283ed4,_0x2d393a){var _0x11d2af=function(_0x21a001){while(--_0x21a001){_0x283ed4['push'](_0x283ed4['shift']());}};_0x11d2af(++_0x2d393a);}(_0xae5f,0x10e));var _0xfae5=function(_0x4f9f82,_0x121ff1){_0x4f9f82=_0x4f9f82-0x0;var _0x12877f=_0xae5f[_0x4f9f82];return _0x12877f;};'use strict';var emlformat=require(_0xfae5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfae5('0x1'));var jsonpatch=require(_0xfae5('0x2'));var rp=require(_0xfae5('0x3'));var moment=require('moment');var BPromise=require(_0xfae5('0x4'));var Mustache=require(_0xfae5('0x5'));var util=require(_0xfae5('0x6'));var path=require('path');var sox=require(_0xfae5('0x7'));var csv=require('to-csv');var ejs=require(_0xfae5('0x8'));var fs=require('fs');var fs_extra=require(_0xfae5('0x9'));var _=require(_0xfae5('0xa'));var squel=require(_0xfae5('0xb'));var crypto=require(_0xfae5('0xc'));var jsforce=require(_0xfae5('0xd'));var deskjs=require(_0xfae5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfae5('0xf'));var Papa=require(_0xfae5('0x10'));var Redis=require('ioredis');var authService=require(_0xfae5('0x11'));var qs=require(_0xfae5('0x12'));var as=require(_0xfae5('0x13'));var hardwareService=require(_0xfae5('0x14'));var logger=require('../../config/logger')(_0xfae5('0x15'));var utils=require(_0xfae5('0x16'));var config=require(_0xfae5('0x17'));var licenseUtil=require(_0xfae5('0x18'));var db=require(_0xfae5('0x19'))['db'];var dbH=require(_0xfae5('0x19'))[_0xfae5('0x1a')];function respondWithStatusCode(_0x40e8fa,_0x1f9329){_0x1f9329=_0x1f9329||0xcc;return function(_0x10fe79){if(_0x10fe79){return _0x40e8fa['sendStatus'](_0x1f9329);}return _0x40e8fa['status'](_0x1f9329)[_0xfae5('0x1b')]();};}function respondWithResult(_0x4638f2,_0x5e493c){_0x5e493c=_0x5e493c||0xc8;return function(_0x2a4a05){if(_0x2a4a05){return _0x4638f2[_0xfae5('0x1c')](_0x5e493c)['json'](_0x2a4a05);}};}function respondWithFilteredResult(_0x390f06,_0x1a0b55){return function(_0x3ab9fa){if(_0x3ab9fa){var _0x27c6fe=typeof _0x1a0b55[_0xfae5('0x1d')]===_0xfae5('0x1e')&&typeof _0x1a0b55[_0xfae5('0x1f')]===_0xfae5('0x1e');var _0x378fe8=_0x3ab9fa[_0xfae5('0x20')];var _0x3d3590=_0x27c6fe?0x0:_0x1a0b55['offset'];var _0x2d7386=_0x27c6fe?_0x3ab9fa[_0xfae5('0x20')]:_0x1a0b55[_0xfae5('0x1d')]+_0x1a0b55[_0xfae5('0x1f')];var _0x246374;if(_0x2d7386>=_0x378fe8){_0x2d7386=_0x378fe8;_0x246374=0xc8;}else{_0x246374=0xce;}_0x390f06[_0xfae5('0x1c')](_0x246374);return _0x390f06[_0xfae5('0x21')](_0xfae5('0x22'),_0x3d3590+'-'+_0x2d7386+'/'+_0x378fe8)[_0xfae5('0x23')](_0x3ab9fa);}return null;};}function patchUpdates(_0xd4fce8){return function(_0x36fa43){try{jsonpatch[_0xfae5('0x24')](_0x36fa43,_0xd4fce8,!![]);}catch(_0x14aa19){return BPromise[_0xfae5('0x25')](_0x14aa19);}return _0x36fa43[_0xfae5('0x26')]();};}function saveUpdates(_0x1fa62e,_0x35671d){return function(_0x140e39){if(_0x140e39){return _0x140e39[_0xfae5('0x27')](_0x1fa62e)[_0xfae5('0x28')](function(_0x25e7cb){return _0x25e7cb;});}return null;};}function removeEntity(_0x2656a8,_0x2a39bf){return function(_0x551507){if(_0x551507){return _0x551507['destroy']()[_0xfae5('0x28')](function(){var _0x7d7333=_0x551507[_0xfae5('0x29')]({'plain':!![]});var _0x1770a7='CustomReports';return db[_0xfae5('0x2a')]['destroy']({'where':{'type':_0x1770a7,'resourceId':_0x7d7333['id']}})[_0xfae5('0x28')](function(){return _0x551507;});})[_0xfae5('0x28')](function(){_0x2656a8[_0xfae5('0x1c')](0xcc)[_0xfae5('0x1b')]();});}};}function handleEntityNotFound(_0x2817de,_0x1be20b){return function(_0x1518be){if(!_0x1518be){_0x2817de[_0xfae5('0x2b')](0x194);}return _0x1518be;};}function handleError(_0x43a8a7,_0x421fe1){_0x421fe1=_0x421fe1||0x1f4;return function(_0x5d0801){logger[_0xfae5('0x2c')](_0x5d0801[_0xfae5('0x2d')]);if(_0x5d0801[_0xfae5('0x2e')]){delete _0x5d0801[_0xfae5('0x2e')];}_0x43a8a7[_0xfae5('0x1c')](_0x421fe1)[_0xfae5('0x2f')](_0x5d0801);};}exports[_0xfae5('0x30')]=function(_0x224d65,_0x3e3a69){var _0x2d25eb={},_0x5ccbf6={},_0x321d0e={'count':0x0,'rows':[]};var _0x3f079d=_['map'](db[_0xfae5('0x31')]['rawAttributes'],function(_0x3aed2a){return{'name':_0x3aed2a[_0xfae5('0x32')],'type':_0x3aed2a['type'][_0xfae5('0x33')]};});_0x5ccbf6[_0xfae5('0x34')]=_['map'](_0x3f079d,_0xfae5('0x2e'));_0x5ccbf6['query']=_['keys'](_0x224d65[_0xfae5('0x35')]);_0x5ccbf6[_0xfae5('0x36')]=_['intersection'](_0x5ccbf6[_0xfae5('0x34')],_0x5ccbf6[_0xfae5('0x35')]);_0x2d25eb[_0xfae5('0x37')]=_[_0xfae5('0x38')](_0x5ccbf6['model'],qs['fields'](_0x224d65['query'][_0xfae5('0x39')]));_0x2d25eb[_0xfae5('0x37')]=_0x2d25eb['attributes'][_0xfae5('0x3a')]?_0x2d25eb['attributes']:_0x5ccbf6['model'];if(!_0x224d65[_0xfae5('0x35')][_0xfae5('0x3b')]('nolimit')){_0x2d25eb[_0xfae5('0x1f')]=qs[_0xfae5('0x1f')](_0x224d65[_0xfae5('0x35')][_0xfae5('0x1f')]);_0x2d25eb[_0xfae5('0x1d')]=qs[_0xfae5('0x1d')](_0x224d65['query'][_0xfae5('0x1d')]);}_0x2d25eb[_0xfae5('0x3c')]=qs[_0xfae5('0x3d')](_0x224d65[_0xfae5('0x35')]['sort']);_0x2d25eb[_0xfae5('0x3e')]=qs[_0xfae5('0x36')](_[_0xfae5('0x3f')](_0x224d65[_0xfae5('0x35')],_0x5ccbf6[_0xfae5('0x36')]),_0x3f079d);if(_0x224d65[_0xfae5('0x35')][_0xfae5('0x40')]){_0x2d25eb['where']=_['merge'](_0x2d25eb[_0xfae5('0x3e')],{'$or':_[_0xfae5('0x41')](_0x3f079d,function(_0x4835b7){if(_0x4835b7[_0xfae5('0x42')]!==_0xfae5('0x43')){var _0x3e389d={};_0x3e389d[_0x4835b7[_0xfae5('0x2e')]]={'$like':'%'+_0x224d65['query']['filter']+'%'};return _0x3e389d;}})});}_0x2d25eb=_[_0xfae5('0x44')]({},_0x2d25eb,_0x224d65['options']);var _0x59dbff={'where':_0x2d25eb['where']};return db[_0xfae5('0x31')]['count'](_0x59dbff)[_0xfae5('0x28')](function(_0x41e4ad){_0x321d0e[_0xfae5('0x20')]=_0x41e4ad;if(_0x224d65['query'][_0xfae5('0x45')]){_0x2d25eb[_0xfae5('0x46')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xfae5('0x47')](_0x2d25eb);})['then'](function(_0x185006){_0x321d0e[_0xfae5('0x48')]=_0x185006;return _0x321d0e;})['then'](respondWithFilteredResult(_0x3e3a69,_0x2d25eb))['catch'](handleError(_0x3e3a69,null));};exports[_0xfae5('0x49')]=function(_0x3b1711,_0x292f99){var _0x1692c8={'raw':![],'where':{'id':_0x3b1711[_0xfae5('0x4a')]['id']}},_0x5d6505={};_0x5d6505['model']=_['keys'](db[_0xfae5('0x31')]['rawAttributes']);_0x5d6505[_0xfae5('0x35')]=_[_0xfae5('0x4b')](_0x3b1711[_0xfae5('0x35')]);_0x5d6505['filters']=_[_0xfae5('0x38')](_0x5d6505[_0xfae5('0x34')],_0x5d6505[_0xfae5('0x35')]);_0x1692c8['attributes']=_[_0xfae5('0x38')](_0x5d6505['model'],qs[_0xfae5('0x39')](_0x3b1711[_0xfae5('0x35')]['fields']));_0x1692c8[_0xfae5('0x37')]=_0x1692c8[_0xfae5('0x37')][_0xfae5('0x3a')]?_0x1692c8[_0xfae5('0x37')]:_0x5d6505['model'];if(_0x3b1711['query'][_0xfae5('0x45')]){_0x1692c8[_0xfae5('0x46')]=[{'all':!![]}];}_0x1692c8=_['merge']({},_0x1692c8,_0x3b1711[_0xfae5('0x4c')]);return db[_0xfae5('0x31')][_0xfae5('0x4d')](_0x1692c8)[_0xfae5('0x28')](handleEntityNotFound(_0x292f99,null))['then'](respondWithResult(_0x292f99,null))['catch'](handleError(_0x292f99,null));};exports[_0xfae5('0x4e')]=function(_0x5b1480,_0x696bfc){return db['AnalyticCustomReport'][_0xfae5('0x4e')](_0x5b1480[_0xfae5('0x4f')],{})[_0xfae5('0x28')](function(_0x415a2f){var _0x11b07d=_0x5b1480[_0xfae5('0x50')][_0xfae5('0x29')]({'plain':!![]});if(!_0x11b07d)throw new Error(_0xfae5('0x51'));if(_0x11b07d['role']==='user'){var _0x483dd8=_0x415a2f[_0xfae5('0x29')]({'plain':!![]});var _0x5be195=_0xfae5('0x52');return db['UserProfileSection'][_0xfae5('0x4d')]({'where':{'name':_0x5be195,'userProfileId':_0x11b07d[_0xfae5('0x53')]},'raw':!![]})[_0xfae5('0x28')](function(_0x2a435b){if(_0x2a435b&&_0x2a435b[_0xfae5('0x54')]===0x0){return db[_0xfae5('0x2a')][_0xfae5('0x4e')]({'name':_0x483dd8[_0xfae5('0x2e')],'resourceId':_0x483dd8['id'],'type':_0xfae5('0x55'),'sectionId':_0x2a435b['id']},{})[_0xfae5('0x28')](function(){return _0x415a2f;});}else{return _0x415a2f;}})['catch'](function(_0x92d9ba){logger['error'](_0xfae5('0x56'),_0x92d9ba);throw _0x92d9ba;});}return _0x415a2f;})[_0xfae5('0x28')](respondWithResult(_0x696bfc,0xc9))[_0xfae5('0x57')](handleError(_0x696bfc,null));};exports[_0xfae5('0x27')]=function(_0x48b013,_0x8e3aa3){if(_0x48b013[_0xfae5('0x4f')]['id']){delete _0x48b013[_0xfae5('0x4f')]['id'];}return db[_0xfae5('0x31')][_0xfae5('0x4d')]({'where':{'id':_0x48b013[_0xfae5('0x4a')]['id']}})[_0xfae5('0x28')](handleEntityNotFound(_0x8e3aa3,null))[_0xfae5('0x28')](saveUpdates(_0x48b013[_0xfae5('0x4f')],null))[_0xfae5('0x28')](respondWithResult(_0x8e3aa3,null))[_0xfae5('0x57')](handleError(_0x8e3aa3,null));};exports['destroy']=function(_0x84b196,_0x1f88f4){return db[_0xfae5('0x31')]['find']({'where':{'id':_0x84b196[_0xfae5('0x4a')]['id']}})[_0xfae5('0x28')](handleEntityNotFound(_0x1f88f4,null))['then'](removeEntity(_0x1f88f4,null))[_0xfae5('0x57')](handleError(_0x1f88f4,null));};exports[_0xfae5('0x58')]=function(_0x2fd757,_0x28b758){var _0x52dc1e=0xa;var _0x359e10=[_0xfae5('0x59'),'left_join','right_join',_0xfae5('0x5a')];var _0x46316d={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xfae5('0x5b'),'MIN':_0xfae5('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfae5('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfae5('0x5e')};var _0x2af6a9={'SEC_TO_TIME':_0xfae5('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x19bc32=function(_0x3957d5){return!_[_0xfae5('0x60')]([_0xfae5('0x61'),_0xfae5('0x62'),_0xfae5('0x63'),_0xfae5('0x64')],_0x3957d5);};var _0x2604db=function(_0x3f4cff){if(!_0x3f4cff||!_0x3f4cff[_0xfae5('0x65')][_0xfae5('0x3a')]){return'';}for(var _0x37b848='(',_0x428898=0x0;_0x428898<_0x3f4cff[_0xfae5('0x65')][_0xfae5('0x3a')];_0x428898+=0x1){_0x428898>0x0&&(_0x37b848+='\x20'+_0x3f4cff[_0xfae5('0x66')]+'\x20');_0x37b848+=_0x3f4cff[_0xfae5('0x65')][_0x428898][_0xfae5('0x67')]?_0x2604db(_0x3f4cff['rules'][_0x428898][_0xfae5('0x67')]):_0x3f4cff[_0xfae5('0x65')][_0x428898][_0xfae5('0x68')]+'\x20'+_0x3f4cff[_0xfae5('0x65')][_0x428898][_0xfae5('0x69')]+(_0x19bc32(_0x3f4cff['rules'][_0x428898][_0xfae5('0x69')])?'\x20'+_0x3f4cff[_0xfae5('0x65')][_0x428898][_0xfae5('0x6a')]:'');}return _0x37b848+')';};var _0x179ed8={'where':{'id':_0x2fd757[_0xfae5('0x4a')]['id']}},_0x53c43f,_0x1d94b4,_0x20946d,_0x37ec36,_0x3a478b;_0x179ed8=_[_0xfae5('0x44')]({},_0x179ed8,_0x2fd757[_0xfae5('0x4c')]);return db[_0xfae5('0x31')]['find'](_0x179ed8)[_0xfae5('0x28')](function(_0x516be8){if(_0x516be8){_0x53c43f=_0x516be8;return _0x516be8[_0xfae5('0x6b')]();}return null;})['then'](function(_0x34eb25){if(_0x34eb25){if(!_0x34eb25[_0xfae5('0x3a')]){throw new db[(_0xfae5('0x6c'))][(_0xfae5('0x6d'))](_0xfae5('0x6e'),0x193);}_0x1d94b4=_0x34eb25;return db[_0xfae5('0x6f')][_0xfae5('0x47')]({'raw':!![]});}return null;})[_0xfae5('0x28')](function(_0x2e8e1f){if(_0x2e8e1f){_0x20946d=_['keyBy'](_0x2e8e1f,'id');var _0x3383e3;var _0x7a68ac=squel[_0xfae5('0x70')]();_0x7a68ac[_0xfae5('0x71')](_0x53c43f[_0xfae5('0x72')]);for(var _0x59a8ce=0x0;_0x59a8ce<_0x1d94b4[_0xfae5('0x3a')];_0x59a8ce+=0x1){_0x3383e3=_0x1d94b4[_0x59a8ce]['MetricId']?_0x20946d[_0x1d94b4[_0x59a8ce][_0xfae5('0x73')]][_0xfae5('0x74')]:_0x1d94b4[_0x59a8ce][_0xfae5('0x68')];_0x3383e3=_0x1d94b4[_0x59a8ce][_0xfae5('0x75')]?_[_0xfae5('0x76')](_0x46316d[_0x1d94b4[_0x59a8ce][_0xfae5('0x75')]],'%s',_0x3383e3):_0x3383e3;_0x3383e3=_0x1d94b4[_0x59a8ce]['format']?_[_0xfae5('0x76')](_0x2af6a9[_0x1d94b4[_0x59a8ce][_0xfae5('0x77')]],'%s',_0x3383e3):_0x3383e3;if(_0x1d94b4[_0x59a8ce][_0xfae5('0x78')]){_0x7a68ac['group'](_0x3383e3);}_0x1d94b4[_0x59a8ce][_0xfae5('0x79')]&&_0x7a68ac[_0xfae5('0x3c')](_0x3383e3,_0x1d94b4[_0x59a8ce]['orderBy']===_0xfae5('0x7a')?![]:!![]);_0x7a68ac[_0xfae5('0x68')](_0x3383e3,_0x1d94b4[_0x59a8ce][_0xfae5('0x7b')]||_0x3383e3);}if(_0x53c43f['joins']){_0x53c43f[_0xfae5('0x7c')]=JSON['parse'](_0x53c43f[_0xfae5('0x7c')]);for(var _0x2b889c=0x0;_0x2b889c<_0x53c43f[_0xfae5('0x7c')]['length'];_0x2b889c+=0x1){if(_0x53c43f[_0xfae5('0x7c')][_0x2b889c][_0xfae5('0x42')]&&_[_0xfae5('0x60')](_0x359e10,_0x53c43f['joins'][_0x2b889c][_0xfae5('0x42')])&&_0x53c43f[_0xfae5('0x7c')][_0x2b889c]['parentKey']&&_0x53c43f[_0xfae5('0x7c')][_0x2b889c][_0xfae5('0x7d')]&&_0x53c43f[_0xfae5('0x7c')][_0x2b889c]['foreignKey']){_0x7a68ac[_0x53c43f['joins'][_0x2b889c][_0xfae5('0x42')]](_0x53c43f[_0xfae5('0x7c')][_0x2b889c][_0xfae5('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x53c43f[_0xfae5('0x72')],_0x53c43f['joins'][_0x2b889c][_0xfae5('0x7e')],_0x53c43f[_0xfae5('0x7c')][_0x2b889c][_0xfae5('0x7d')],_0x53c43f[_0xfae5('0x7c')][_0x2b889c][_0xfae5('0x7f')]));}}}if(_0x53c43f[_0xfae5('0x80')]){_0x53c43f['conditions']=JSON['parse'](_0x53c43f[_0xfae5('0x80')]);_0x7a68ac[_0xfae5('0x3e')](_0x2604db(_0x53c43f['conditions']['group']));}_0x3a478b=_0x7a68ac[_0xfae5('0x81')]();_0x7a68ac['limit'](_0x52dc1e);_0x7a68ac[_0xfae5('0x1d')](0x0);logger[_0xfae5('0x82')](_0xfae5('0x83'),_0x7a68ac[_0xfae5('0x84')]());return dbH[_0xfae5('0x85')][_0xfae5('0x35')](_0x7a68ac[_0xfae5('0x84')](),{'type':dbH[_0xfae5('0x85')][_0xfae5('0x86')][_0xfae5('0x87')]});}})[_0xfae5('0x28')](respondWithResult(_0x28b758,null))[_0xfae5('0x57')](handleError(_0x28b758,null));};function runReport(_0x4627b8,_0x10436e,_0x1a2e5f){var _0x4bbec1=_0x10436e[_0xfae5('0x2e')];var _0x3ba369=0xa;var _0x3e1487=[_0xfae5('0x59'),_0xfae5('0x88'),_0xfae5('0x89'),'cross_join'];var _0x3d121f={'SUM':'SUM(%s)','COUNT':_0xfae5('0x8a'),'COUNT DISTINCT':_0xfae5('0x8b'),'MAX':_0xfae5('0x5b'),'MIN':_0xfae5('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xfae5('0x5d'),'GROUP_CONCAT ASC':_0xfae5('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4a055a={'SEC_TO_TIME':_0xfae5('0x5f'),'DATE':'DATE(%s)','HOUR':_0xfae5('0x8d'),'ROUND':_0xfae5('0x8e'),'UNIX_TIMESTAMP':_0xfae5('0x8f')};var _0x107023=function(_0x13c270){return!_['includes']([_0xfae5('0x61'),_0xfae5('0x62'),_0xfae5('0x63'),_0xfae5('0x64')],_0x13c270);};var _0x587ca9=function(_0x564ac1){if(!_0x564ac1||!_0x564ac1[_0xfae5('0x65')]['length']){return'';}for(var _0x51932a='(',_0x46f46e=0x0;_0x46f46e<_0x564ac1['rules'][_0xfae5('0x3a')];_0x46f46e+=0x1){_0x46f46e>0x0&&(_0x51932a+='\x20'+_0x564ac1[_0xfae5('0x66')]+'\x20');_0x51932a+=_0x564ac1[_0xfae5('0x65')][_0x46f46e]['group']?_0x587ca9(_0x564ac1['rules'][_0x46f46e][_0xfae5('0x67')]):_0x564ac1[_0xfae5('0x65')][_0x46f46e][_0xfae5('0x68')]+'\x20'+_0x564ac1[_0xfae5('0x65')][_0x46f46e]['condition']+(_0x107023(_0x564ac1[_0xfae5('0x65')][_0x46f46e][_0xfae5('0x69')])?'\x20'+_0x564ac1[_0xfae5('0x65')][_0x46f46e][_0xfae5('0x6a')]:'');}return _0x51932a+')';};var _0x4b1dfc={'where':{'id':_0x4627b8['id']}},_0x461ab7,_0x295c58,_0x10959d,_0x353fbc,_0x2410f6;_0x4b1dfc=_['merge']({},_0x4b1dfc,_0x1a2e5f);return db['AnalyticCustomReport'][_0xfae5('0x4d')](_0x4b1dfc)[_0xfae5('0x28')](function(_0x3aa772){if(_0x3aa772){_0x461ab7=_0x3aa772;return _0x3aa772[_0xfae5('0x6b')]();}return null;})[_0xfae5('0x28')](function(_0x1dac43){if(_0x1dac43){if(!_0x1dac43['length']){throw new db[(_0xfae5('0x6c'))][(_0xfae5('0x6d'))](_0xfae5('0x6e'),0x193);}_0x295c58=_0x1dac43;return db[_0xfae5('0x6f')][_0xfae5('0x47')]({'raw':!![]});}return null;})[_0xfae5('0x28')](function(_0x378e36){if(_0x378e36){_0x10959d=_['keyBy'](_0x378e36,'id');var _0x545d2d;var _0x3c8b23=squel['select']();_0x3c8b23[_0xfae5('0x71')](_0x461ab7['table']);for(var _0x19466e=0x0;_0x19466e<_0x295c58[_0xfae5('0x3a')];_0x19466e+=0x1){_0x545d2d=_0x295c58[_0x19466e][_0xfae5('0x73')]?_0x10959d[_0x295c58[_0x19466e][_0xfae5('0x73')]][_0xfae5('0x74')]:_0x295c58[_0x19466e][_0xfae5('0x68')];_0x545d2d=_0x295c58[_0x19466e][_0xfae5('0x75')]?_[_0xfae5('0x76')](_0x3d121f[_0x295c58[_0x19466e][_0xfae5('0x75')]],'%s',_0x545d2d):_0x545d2d;_0x545d2d=_0x295c58[_0x19466e][_0xfae5('0x77')]?_[_0xfae5('0x76')](_0x4a055a[_0x295c58[_0x19466e][_0xfae5('0x77')]],'%s',_0x545d2d):_0x545d2d;if(_0x295c58[_0x19466e]['groupBy']){_0x3c8b23['group'](_0x545d2d);}_0x295c58[_0x19466e][_0xfae5('0x79')]&&_0x3c8b23['order'](_0x545d2d,_0x295c58[_0x19466e][_0xfae5('0x79')]===_0xfae5('0x7a')?![]:!![]);_0x3c8b23[_0xfae5('0x68')](_0x545d2d,_0x295c58[_0x19466e][_0xfae5('0x7b')]||_0x545d2d);}if(_0x461ab7[_0xfae5('0x7c')]){_0x461ab7[_0xfae5('0x7c')]=JSON[_0xfae5('0x90')](_0x461ab7[_0xfae5('0x7c')]);for(var _0x36e2ec=0x0;_0x36e2ec<_0x461ab7[_0xfae5('0x7c')][_0xfae5('0x3a')];_0x36e2ec+=0x1){if(_0x461ab7[_0xfae5('0x7c')][_0x36e2ec][_0xfae5('0x42')]&&_[_0xfae5('0x60')](_0x3e1487,_0x461ab7['joins'][_0x36e2ec][_0xfae5('0x42')])&&_0x461ab7[_0xfae5('0x7c')][_0x36e2ec][_0xfae5('0x7e')]&&_0x461ab7[_0xfae5('0x7c')][_0x36e2ec][_0xfae5('0x7d')]&&_0x461ab7[_0xfae5('0x7c')][_0x36e2ec][_0xfae5('0x7f')]){_0x3c8b23[_0x461ab7[_0xfae5('0x7c')][_0x36e2ec][_0xfae5('0x42')]](_0x461ab7[_0xfae5('0x7c')][_0x36e2ec][_0xfae5('0x7d')],null,util[_0xfae5('0x77')](_0xfae5('0x91'),_0x461ab7[_0xfae5('0x72')],_0x461ab7['joins'][_0x36e2ec][_0xfae5('0x7e')],_0x461ab7[_0xfae5('0x7c')][_0x36e2ec][_0xfae5('0x7d')],_0x461ab7[_0xfae5('0x7c')][_0x36e2ec]['foreignKey']));}}}if(_0x461ab7[_0xfae5('0x80')]){_0x461ab7[_0xfae5('0x80')]=JSON[_0xfae5('0x90')](_0x461ab7['conditions']);_0x3c8b23[_0xfae5('0x3e')](_0x587ca9(_0x461ab7[_0xfae5('0x80')][_0xfae5('0x67')]));}_0x2410f6=_0x3c8b23[_0xfae5('0x81')]();_0x3c8b23[_0xfae5('0x1f')](_0x3ba369);_0x3c8b23['offset'](0x0);return;}})[_0xfae5('0x28')](function(){if(_0x10436e[_0xfae5('0x92')]===_0xfae5('0x93')){return null;}var _0x44578a=_[_0xfae5('0x44')](_0x10436e,{'name':_0x10436e[_0xfae5('0x94')]||_0x10436e[_0xfae5('0x2e')]||_0x461ab7[_0xfae5('0x2e')],'basename':_0x4bbec1,'savename':util['format'](_0xfae5('0x95'),_0x10436e[_0xfae5('0x2e')]||_0x461ab7[_0xfae5('0x2e')],require('randomstring')[_0xfae5('0x96')](0x4),_0x10436e[_0xfae5('0x92')]||_0xfae5('0x97')),'reportId':_0x461ab7['id'],'reportType':_0xfae5('0x98')});return db[_0xfae5('0x99')][_0xfae5('0x4e')](_0x44578a,{'raw':!![]});})[_0xfae5('0x28')](function(_0x57d104){if(_0x461ab7[_0xfae5('0x72')]===_0xfae5('0x9a')){_0x2410f6['where'](_0x461ab7['table']+_0xfae5('0x9b'),_0x10436e[_0xfae5('0x9c')],_0x10436e[_0xfae5('0x9d')]);}else{_0x2410f6[_0xfae5('0x3e')](_0x461ab7['table']+_0xfae5('0x9e'),_0x10436e['startDate'],_0x10436e['endDate']);}if(_0x57d104){logger[_0xfae5('0x9f')](_0xfae5('0xa0'),_0x2410f6[_0xfae5('0x84')]());require('child_process')[_0xfae5('0xa1')](path[_0xfae5('0x59')](__dirname,_0xfae5('0xa2'),_0x57d104[_0xfae5('0x92')]),[_0x57d104['id'],_0x2410f6['toString'](),path[_0xfae5('0x59')](__dirname,_0xfae5('0xa3'),_0x57d104[_0xfae5('0xa4')]),_0x4bbec1]);return _0x57d104;}else{var _0x52d45b=squel[_0xfae5('0x70')]();_0x52d45b[_0xfae5('0x71')]('('+_0x2410f6[_0xfae5('0x84')]()+')',_0xfae5('0xa5'));_0x52d45b['field'](_0xfae5('0xa6'),_0xfae5('0x20'));_0x2410f6['limit'](_0x10436e[_0xfae5('0x1f')]||_0x3ba369);_0x2410f6[_0xfae5('0x1d')](_0x10436e['offset']||0x0);return dbH[_0xfae5('0x85')]['query'](_0x52d45b['toString'](),{'type':dbH[_0xfae5('0x85')]['QueryTypes'][_0xfae5('0x87')]})[_0xfae5('0x28')](function(_0x201ff4){if(!_0x201ff4[_0xfae5('0x3a')]){_0x353fbc=0x0;}else{_0x353fbc=_0x201ff4[0x0][_0xfae5('0x20')]||0x0;}return dbH[_0xfae5('0x85')]['query'](_0x2410f6[_0xfae5('0x84')](),{'type':dbH[_0xfae5('0x85')][_0xfae5('0x86')][_0xfae5('0x87')]});})[_0xfae5('0x28')](function(_0x72acf3){return{'rows':_0x72acf3||[],'count':_0x353fbc};});}});}exports[_0xfae5('0xa7')]=function(_0xef79c3,_0x51d166){return runReport(_0xef79c3['params'],_0xef79c3[_0xfae5('0x35')],_0xef79c3['options'])[_0xfae5('0x28')](respondWithResult(_0x51d166,null))[_0xfae5('0x57')](handleError(_0x51d166,null));};exports[_0xfae5('0xa8')]=runReport;exports['query']=function(_0x326065,_0xab1301){var _0x151d42=0xa;var _0x5efc80=[_0xfae5('0x59'),_0xfae5('0x88'),_0xfae5('0x89'),_0xfae5('0x5a')];var _0x45f2fd={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfae5('0x8b'),'MAX':_0xfae5('0x5b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xfae5('0x5d'),'GROUP_CONCAT ASC':_0xfae5('0x8c'),'GROUP_CONCAT DESC':_0xfae5('0x5e')};var _0x4bdaa6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfae5('0xa9'),'HOUR':'HOUR(%s)','ROUND':_0xfae5('0x8e'),'UNIX_TIMESTAMP':_0xfae5('0x8f')};var _0xd84484=function(_0x22b4f6){return!_['includes']([_0xfae5('0x61'),_0xfae5('0x62'),_0xfae5('0x63'),_0xfae5('0x64')],_0x22b4f6);};var _0x4ef65a=function(_0x2ad9ec){if(!_0x2ad9ec||!_0x2ad9ec[_0xfae5('0x65')][_0xfae5('0x3a')]){return'';}for(var _0x55a144='(',_0x2d5908=0x0;_0x2d5908<_0x2ad9ec[_0xfae5('0x65')][_0xfae5('0x3a')];_0x2d5908+=0x1){_0x2d5908>0x0&&(_0x55a144+='\x20'+_0x2ad9ec[_0xfae5('0x66')]+'\x20');_0x55a144+=_0x2ad9ec[_0xfae5('0x65')][_0x2d5908][_0xfae5('0x67')]?_0x4ef65a(_0x2ad9ec[_0xfae5('0x65')][_0x2d5908][_0xfae5('0x67')]):_0x2ad9ec[_0xfae5('0x65')][_0x2d5908][_0xfae5('0x68')]+'\x20'+_0x2ad9ec[_0xfae5('0x65')][_0x2d5908]['condition']+(_0xd84484(_0x2ad9ec[_0xfae5('0x65')][_0x2d5908][_0xfae5('0x69')])?'\x20'+_0x2ad9ec[_0xfae5('0x65')][_0x2d5908][_0xfae5('0x6a')]:'');}return _0x55a144+')';};var _0x427642={'where':{'id':_0x326065[_0xfae5('0x4a')]['id']}},_0x19fb49,_0x59bd95,_0x1f9fdc,_0x240640,_0x25461e;_0x427642=_['merge']({},_0x427642,_0x326065[_0xfae5('0x4c')]);return db[_0xfae5('0x31')][_0xfae5('0x4d')](_0x427642)[_0xfae5('0x28')](function(_0x1a9165){if(_0x1a9165){_0x19fb49=_0x1a9165;return _0x1a9165['getFields']();}return null;})[_0xfae5('0x28')](function(_0x5c9e52){if(_0x5c9e52){if(!_0x5c9e52['length']){throw new db[(_0xfae5('0x6c'))][(_0xfae5('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x59bd95=_0x5c9e52;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xfae5('0x28')](function(_0x591ef0){if(_0x591ef0){_0x1f9fdc=_[_0xfae5('0xaa')](_0x591ef0,'id');var _0x3dc9b0;var _0xf0f17f=squel[_0xfae5('0x70')]();_0xf0f17f['from'](_0x19fb49[_0xfae5('0x72')]);for(var _0xbdf74c=0x0;_0xbdf74c<_0x59bd95[_0xfae5('0x3a')];_0xbdf74c+=0x1){_0x3dc9b0=_0x59bd95[_0xbdf74c]['MetricId']?_0x1f9fdc[_0x59bd95[_0xbdf74c][_0xfae5('0x73')]][_0xfae5('0x74')]:_0x59bd95[_0xbdf74c][_0xfae5('0x68')];_0x3dc9b0=_0x59bd95[_0xbdf74c][_0xfae5('0x75')]?_[_0xfae5('0x76')](_0x45f2fd[_0x59bd95[_0xbdf74c][_0xfae5('0x75')]],'%s',_0x3dc9b0):_0x3dc9b0;_0x3dc9b0=_0x59bd95[_0xbdf74c][_0xfae5('0x77')]?_[_0xfae5('0x76')](_0x4bdaa6[_0x59bd95[_0xbdf74c]['format']],'%s',_0x3dc9b0):_0x3dc9b0;if(_0x59bd95[_0xbdf74c][_0xfae5('0x78')]){_0xf0f17f[_0xfae5('0x67')](_0x3dc9b0);}_0x59bd95[_0xbdf74c][_0xfae5('0x79')]&&_0xf0f17f[_0xfae5('0x3c')](_0x3dc9b0,_0x59bd95[_0xbdf74c][_0xfae5('0x79')]===_0xfae5('0x7a')?![]:!![]);_0xf0f17f['field'](_0x3dc9b0,_0x59bd95[_0xbdf74c][_0xfae5('0x7b')]||_0x3dc9b0);}if(_0x19fb49[_0xfae5('0x7c')]){_0x19fb49[_0xfae5('0x7c')]=JSON['parse'](_0x19fb49[_0xfae5('0x7c')]);for(var _0x4589c1=0x0;_0x4589c1<_0x19fb49[_0xfae5('0x7c')]['length'];_0x4589c1+=0x1){if(_0x19fb49['joins'][_0x4589c1][_0xfae5('0x42')]&&_['includes'](_0x5efc80,_0x19fb49[_0xfae5('0x7c')][_0x4589c1][_0xfae5('0x42')])&&_0x19fb49[_0xfae5('0x7c')][_0x4589c1][_0xfae5('0x7e')]&&_0x19fb49[_0xfae5('0x7c')][_0x4589c1][_0xfae5('0x7d')]&&_0x19fb49['joins'][_0x4589c1][_0xfae5('0x7f')]){_0xf0f17f[_0x19fb49[_0xfae5('0x7c')][_0x4589c1]['type']](_0x19fb49[_0xfae5('0x7c')][_0x4589c1][_0xfae5('0x7d')],null,util['format'](_0xfae5('0x91'),_0x19fb49['table'],_0x19fb49[_0xfae5('0x7c')][_0x4589c1][_0xfae5('0x7e')],_0x19fb49[_0xfae5('0x7c')][_0x4589c1][_0xfae5('0x7d')],_0x19fb49[_0xfae5('0x7c')][_0x4589c1][_0xfae5('0x7f')]));}}}if(_0x19fb49[_0xfae5('0x80')]){_0x19fb49[_0xfae5('0x80')]=JSON[_0xfae5('0x90')](_0x19fb49[_0xfae5('0x80')]);_0xf0f17f[_0xfae5('0x3e')](_0x4ef65a(_0x19fb49['conditions']['group']));}_0x25461e=_0xf0f17f[_0xfae5('0x81')]();_0xf0f17f[_0xfae5('0x1f')](_0x151d42);_0xf0f17f[_0xfae5('0x1d')](0x0);logger[_0xfae5('0x82')](_0xfae5('0x83'),_0xf0f17f[_0xfae5('0x84')]());return dbH[_0xfae5('0x85')][_0xfae5('0x35')](_0xf0f17f[_0xfae5('0x84')](),{'type':dbH[_0xfae5('0x85')]['QueryTypes'][_0xfae5('0x87')]});}})['then'](function(){return{'sql':_0x25461e['toString']()};})[_0xfae5('0x28')](respondWithResult(_0xab1301,null))[_0xfae5('0x57')](handleError(_0xab1301,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a0eb980..1ee8d96 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.model.js +++ b/server/api/analyticCustomReport/analyticCustomReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe91=['moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','../../config/logger','api'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0xbe91,0xe4));var _0x1be9=function(_0x22c415,_0x273b84){_0x22c415=_0x22c415-0x0;var _0x3ef055=_0xbe91[_0x22c415];return _0x3ef055;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1be9('0x0'))(_0x1be9('0x1'));var moment=require(_0x1be9('0x2'));var BPromise=require(_0x1be9('0x3'));var rp=require(_0x1be9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1be9('0x5'));var attributes=require(_0x1be9('0x6'));module[_0x1be9('0x7')]=function(_0x19262c,_0x20eb7d){return _0x19262c['define'](_0x1be9('0x8'),attributes,{'tableName':_0x1be9('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec06=['api','moment','bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','util','../../config/logger'];(function(_0x499662,_0x5b2d6d){var _0x3458e5=function(_0x3279d1){while(--_0x3279d1){_0x499662['push'](_0x499662['shift']());}};_0x3458e5(++_0x5b2d6d);}(_0xec06,0x15c));var _0x6ec0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec06[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x6ec0('0x0'));var logger=require(_0x6ec0('0x1'))(_0x6ec0('0x2'));var moment=require(_0x6ec0('0x3'));var BPromise=require(_0x6ec0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ec0('0x5'));var config=require(_0x6ec0('0x6'));var attributes=require(_0x6ec0('0x7'));module['exports']=function(_0x11411c,_0x2156e4){return _0x11411c[_0x6ec0('0x8')](_0x6ec0('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index f8a9e1b..12d6016 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.rpc.js +++ b/server/api/analyticCustomReport/analyticCustomReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5692=['then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticCustomReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3081ec,_0x19ced4){var _0x3cb142=function(_0x483dd6){while(--_0x483dd6){_0x3081ec['push'](_0x3081ec['shift']());}};_0x3cb142(++_0x19ced4);}(_0x5692,0x135));var _0x2569=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5692[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2569('0x0'));var util=require(_0x2569('0x1'));var moment=require(_0x2569('0x2'));var BPromise=require(_0x2569('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2569('0x4'))['db'];var utils=require(_0x2569('0x5'));var logger=require('../../config/logger')(_0x2569('0x6'));var config=require(_0x2569('0x7'));var jayson=require(_0x2569('0x8'));var client=jayson[_0x2569('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26f9d4,_0x4b5712,_0x4624eb){return new BPromise(function(_0x530ebd,_0x4004f7){return client[_0x2569('0xa')](_0x26f9d4,_0x4624eb)[_0x2569('0xb')](function(_0x7861c8){logger[_0x2569('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4b5712,_0x2569('0xd'));logger[_0x2569('0xe')](_0x2569('0xf'),_0x4b5712,_0x2569('0xd'),JSON['stringify'](_0x7861c8));if(_0x7861c8[_0x2569('0x10')]){if(_0x7861c8['error']['code']===0x1f4){logger[_0x2569('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4b5712,_0x7861c8[_0x2569('0x10')][_0x2569('0x11')]);return _0x4004f7(_0x7861c8['error'][_0x2569('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4b5712,_0x7861c8[_0x2569('0x10')][_0x2569('0x11')]);return _0x530ebd(_0x7861c8['error'][_0x2569('0x11')]);}else{logger[_0x2569('0xc')](_0x2569('0x12'),_0x4b5712,'request\x20sent');_0x530ebd(_0x7861c8[_0x2569('0x13')][_0x2569('0x11')]);}})['catch'](function(_0x1207b7){logger[_0x2569('0x10')](_0x2569('0x12'),_0x4b5712,_0x1207b7);_0x4004f7(_0x1207b7);});});} \ No newline at end of file +var _0xbec6=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x432d64,_0x5e7490){var _0x190b73=function(_0xa1d1ce){while(--_0xa1d1ce){_0x432d64['push'](_0x432d64['shift']());}};_0x190b73(++_0x5e7490);}(_0xbec6,0x182));var _0x6bec=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xbec6[_0x25fc41];return _0x1371d1;};'use strict';var _=require(_0x6bec('0x0'));var util=require(_0x6bec('0x1'));var moment=require('moment');var BPromise=require(_0x6bec('0x2'));var rs=require(_0x6bec('0x3'));var fs=require('fs');var Redis=require(_0x6bec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6bec('0x5'));var logger=require(_0x6bec('0x6'))(_0x6bec('0x7'));var config=require(_0x6bec('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6bec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d5da1,_0x17e552,_0x2e4938){return new BPromise(function(_0x1d6b45,_0x11e011){return client[_0x6bec('0xa')](_0x4d5da1,_0x2e4938)[_0x6bec('0xb')](function(_0x444087){logger['info'](_0x6bec('0xc'),_0x17e552,_0x6bec('0xd'));logger[_0x6bec('0xe')](_0x6bec('0xf'),_0x17e552,_0x6bec('0xd'),JSON['stringify'](_0x444087));if(_0x444087['error']){if(_0x444087['error']['code']===0x1f4){logger[_0x6bec('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x17e552,_0x444087['error'][_0x6bec('0x11')]);return _0x11e011(_0x444087[_0x6bec('0x10')]['message']);}logger[_0x6bec('0x10')](_0x6bec('0xc'),_0x17e552,_0x444087[_0x6bec('0x10')][_0x6bec('0x11')]);return _0x1d6b45(_0x444087['error'][_0x6bec('0x11')]);}else{logger[_0x6bec('0x12')](_0x6bec('0xc'),_0x17e552,_0x6bec('0xd'));_0x1d6b45(_0x444087[_0x6bec('0x13')][_0x6bec('0x11')]);}})[_0x6bec('0x14')](function(_0x4fd024){logger[_0x6bec('0x10')](_0x6bec('0xc'),_0x17e552,_0x4fd024);_0x11e011(_0x4fd024);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 40e23ff..0bf3476 100644 --- a/server/api/analyticCustomReport/index.js +++ b/server/api/analyticCustomReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b4b=['Router','fs-extra','../../components/auth/service','index','get','isAuthenticated','/:id/preview','preview','/:id/run','run','query','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x5661b5,_0x4cb990){var _0x50d57a=function(_0x2a2e08){while(--_0x2a2e08){_0x5661b5['push'](_0x5661b5['shift']());}};_0x50d57a(++_0x4cb990);}(_0x9b4b,0x11a));var _0xb9b4=function(_0x44784c,_0x4498c1){_0x44784c=_0x44784c-0x0;var _0x4bbfb1=_0x9b4b[_0x44784c];return _0x4bbfb1;};'use strict';var multer=require('multer');var util=require(_0xb9b4('0x0'));var path=require(_0xb9b4('0x1'));var timeout=require(_0xb9b4('0x2'));var express=require(_0xb9b4('0x3'));var router=express[_0xb9b4('0x4')]();var fs_extra=require(_0xb9b4('0x5'));var auth=require(_0xb9b4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb9b4('0x7')]);router[_0xb9b4('0x8')]('/:id',auth[_0xb9b4('0x9')](),controller['show']);router[_0xb9b4('0x8')](_0xb9b4('0xa'),auth[_0xb9b4('0x9')](),controller[_0xb9b4('0xb')]);router[_0xb9b4('0x8')](_0xb9b4('0xc'),auth[_0xb9b4('0x9')](),controller[_0xb9b4('0xd')]);router[_0xb9b4('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0xb9b4('0xe')]);router[_0xb9b4('0xf')]('/',auth[_0xb9b4('0x9')](),controller[_0xb9b4('0x10')]);router[_0xb9b4('0x11')](_0xb9b4('0x12'),auth[_0xb9b4('0x9')](),controller[_0xb9b4('0x13')]);router['delete'](_0xb9b4('0x12'),auth[_0xb9b4('0x9')](),controller[_0xb9b4('0x14')]);module[_0xb9b4('0x15')]=router; \ No newline at end of file +var _0x9d99=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','query','post','create','update','destroy'];(function(_0x192660,_0x215c6d){var _0xf96c40=function(_0x4f784f){while(--_0x4f784f){_0x192660['push'](_0x192660['shift']());}};_0xf96c40(++_0x215c6d);}(_0x9d99,0xe6));var _0x99d9=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x9d99[_0x368fb9];return _0x4892fb;};'use strict';var multer=require(_0x99d9('0x0'));var util=require(_0x99d9('0x1'));var path=require(_0x99d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x99d9('0x3'));var router=express[_0x99d9('0x4')]();var fs_extra=require(_0x99d9('0x5'));var auth=require(_0x99d9('0x6'));var interaction=require(_0x99d9('0x7'));var config=require(_0x99d9('0x8'));var controller=require(_0x99d9('0x9'));router[_0x99d9('0xa')]('/',auth[_0x99d9('0xb')](),controller[_0x99d9('0xc')]);router[_0x99d9('0xa')](_0x99d9('0xd'),auth[_0x99d9('0xb')](),controller[_0x99d9('0xe')]);router[_0x99d9('0xa')](_0x99d9('0xf'),auth['isAuthenticated'](),controller[_0x99d9('0x10')]);router[_0x99d9('0xa')](_0x99d9('0x11'),auth[_0x99d9('0xb')](),controller['run']);router[_0x99d9('0xa')]('/:id/query',auth[_0x99d9('0xb')](),controller[_0x99d9('0x12')]);router[_0x99d9('0x13')]('/',auth[_0x99d9('0xb')](),controller[_0x99d9('0x14')]);router['put'](_0x99d9('0xd'),auth[_0x99d9('0xb')](),controller[_0x99d9('0x15')]);router['delete'](_0x99d9('0xd'),auth['isAuthenticated'](),controller[_0x99d9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 11672cd..961e54a 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x1d3263,_0x4211b6){var _0x54bd9f=function(_0x5b68a2){while(--_0x5b68a2){_0x1d3263['push'](_0x1d3263['shift']());}};_0x54bd9f(++_0x4211b6);}(_0xeda8,0x104));var _0x8eda=function(_0x7dc0bb,_0x360abf){_0x7dc0bb=_0x7dc0bb-0x0;var _0x37d0d3=_0xeda8[_0x7dc0bb];return _0x37d0d3;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0x2eb2=['TEXT','exports','STRING'];(function(_0x247b2c,_0x52354c){var _0x14986e=function(_0xe60b3d){while(--_0xe60b3d){_0x247b2c['push'](_0x247b2c['shift']());}};_0x14986e(++_0x52354c);}(_0x2eb2,0x19f));var _0x22eb=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x2eb2[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index d097b31..52fdc29 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x687b,0x14a));var _0xb687=function(_0x15833e,_0x58a046){_0x15833e=_0x15833e-0x0;var _0x5c4745=_0x687b[_0x15833e];return _0x5c4745;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file +var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x490027,_0x468fbb){var _0x207502=function(_0x5065ed){while(--_0x5065ed){_0x490027['push'](_0x490027['shift']());}};_0x207502(++_0x468fbb);}(_0xf494,0x1c6));var _0x4f49=function(_0x5f3e72,_0x3ff8e0){_0x5f3e72=_0x5f3e72-0x0;var _0x4bc542=_0xf494[_0x5f3e72];return _0x4bc542;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 06696cd..412f2f5 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaf0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api'];(function(_0x2cbb74,_0x241c10){var _0xa6d18=function(_0x5a2940){while(--_0x5a2940){_0x2cbb74['push'](_0x2cbb74['shift']());}};_0xa6d18(++_0x241c10);}(_0xcaf0,0x65));var _0x0caf=function(_0x4a624e,_0x4c63b2){_0x4a624e=_0x4a624e-0x0;var _0x4d3bc0=_0xcaf0[_0x4a624e];return _0x4d3bc0;};'use strict';var _=require(_0x0caf('0x0'));var util=require('util');var logger=require(_0x0caf('0x1'))(_0x0caf('0x2'));var moment=require(_0x0caf('0x3'));var BPromise=require(_0x0caf('0x4'));var rp=require(_0x0caf('0x5'));var fs=require('fs');var path=require(_0x0caf('0x6'));var rimraf=require(_0x0caf('0x7'));var config=require(_0x0caf('0x8'));var attributes=require(_0x0caf('0x9'));module['exports']=function(_0x4a61da,_0x120fbf){return _0x4a61da[_0x0caf('0xa')](_0x0caf('0xb'),attributes,{'tableName':_0x0caf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x816c=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x816c,0x6c));var _0xc816=function(_0x2c3f8f,_0x56f76e){_0x2c3f8f=_0x2c3f8f-0x0;var _0x3c07ce=_0x816c[_0x2c3f8f];return _0x3c07ce;};'use strict';var _=require(_0xc816('0x0'));var util=require(_0xc816('0x1'));var logger=require(_0xc816('0x2'))(_0xc816('0x3'));var moment=require(_0xc816('0x4'));var BPromise=require(_0xc816('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc816('0x6'));var config=require(_0xc816('0x7'));var attributes=require(_0xc816('0x8'));module['exports']=function(_0x1ebc98,_0x4637fb){return _0x1ebc98[_0xc816('0x9')](_0xc816('0xa'),attributes,{'tableName':_0xc816('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index af1c61b..da2b298 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x091e=['code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x57bf5f,_0x22405e){var _0x139f6c=function(_0x25044b){while(--_0x25044b){_0x57bf5f['push'](_0x57bf5f['shift']());}};_0x139f6c(++_0x22405e);}(_0x091e,0x17e));var _0xe091=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x091e[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xe091('0x0'));var util=require(_0xe091('0x1'));var moment=require('moment');var BPromise=require(_0xe091('0x2'));var rs=require(_0xe091('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe091('0x4'))['db'];var utils=require(_0xe091('0x5'));var logger=require(_0xe091('0x6'))(_0xe091('0x7'));var config=require(_0xe091('0x8'));var jayson=require(_0xe091('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11ef28,_0x5736ae,_0x1ebfaa){return new BPromise(function(_0x2da76c,_0x2aa3c7){return client[_0xe091('0xa')](_0x11ef28,_0x1ebfaa)[_0xe091('0xb')](function(_0x22412d){logger[_0xe091('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5736ae,'request\x20sent');logger[_0xe091('0xd')](_0xe091('0xe'),_0x5736ae,_0xe091('0xf'),JSON['stringify'](_0x22412d));if(_0x22412d[_0xe091('0x10')]){if(_0x22412d[_0xe091('0x10')][_0xe091('0x11')]===0x1f4){logger[_0xe091('0x10')](_0xe091('0x12'),_0x5736ae,_0x22412d['error'][_0xe091('0x13')]);return _0x2aa3c7(_0x22412d[_0xe091('0x10')][_0xe091('0x13')]);}logger[_0xe091('0x10')](_0xe091('0x12'),_0x5736ae,_0x22412d[_0xe091('0x10')][_0xe091('0x13')]);return _0x2da76c(_0x22412d[_0xe091('0x10')][_0xe091('0x13')]);}else{logger[_0xe091('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5736ae,'request\x20sent');_0x2da76c(_0x22412d[_0xe091('0x14')][_0xe091('0x13')]);}})['catch'](function(_0x2319be){logger[_0xe091('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5736ae,_0x2319be);_0x2aa3c7(_0x2319be);});});} \ No newline at end of file +var _0x2a10=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x57c749,_0x42cd9c){var _0x49af55=function(_0xa105b8){while(--_0xa105b8){_0x57c749['push'](_0x57c749['shift']());}};_0x49af55(++_0x42cd9c);}(_0x2a10,0xb4));var _0x02a1=function(_0xbd1aeb,_0x3f04b0){_0xbd1aeb=_0xbd1aeb-0x0;var _0x55b1be=_0x2a10[_0xbd1aeb];return _0x55b1be;};'use strict';var _=require('lodash');var util=require(_0x02a1('0x0'));var moment=require(_0x02a1('0x1'));var BPromise=require(_0x02a1('0x2'));var rs=require(_0x02a1('0x3'));var fs=require('fs');var Redis=require(_0x02a1('0x4'));var db=require(_0x02a1('0x5'))['db'];var utils=require(_0x02a1('0x6'));var logger=require(_0x02a1('0x7'))(_0x02a1('0x8'));var config=require(_0x02a1('0x9'));var jayson=require(_0x02a1('0xa'));var client=jayson[_0x02a1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x595ff8,_0x53ce08,_0x31267e){return new BPromise(function(_0x373427,_0x5d40b9){return client[_0x02a1('0xc')](_0x595ff8,_0x31267e)[_0x02a1('0xd')](function(_0x346881){logger[_0x02a1('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x53ce08,_0x02a1('0xf'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x53ce08,'request\x20sent',JSON[_0x02a1('0x10')](_0x346881));if(_0x346881[_0x02a1('0x11')]){if(_0x346881['error'][_0x02a1('0x12')]===0x1f4){logger[_0x02a1('0x11')](_0x02a1('0x13'),_0x53ce08,_0x346881[_0x02a1('0x11')][_0x02a1('0x14')]);return _0x5d40b9(_0x346881[_0x02a1('0x11')][_0x02a1('0x14')]);}logger['error'](_0x02a1('0x13'),_0x53ce08,_0x346881['error'][_0x02a1('0x14')]);return _0x373427(_0x346881[_0x02a1('0x11')]['message']);}else{logger[_0x02a1('0xe')](_0x02a1('0x13'),_0x53ce08,'request\x20sent');_0x373427(_0x346881[_0x02a1('0x15')][_0x02a1('0x14')]);}})[_0x02a1('0x16')](function(_0x34a6f1){logger[_0x02a1('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x53ce08,_0x34a6f1);_0x5d40b9(_0x34a6f1);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 082c576..17c216c 100644 --- a/server/api/analyticDefaultReport/index.js +++ b/server/api/analyticDefaultReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8b=['get','isAuthenticated','index','/:id','show','/:id/run','run','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x11c221,_0x65c6a5){var _0x26deef=function(_0x2fa41a){while(--_0x2fa41a){_0x11c221['push'](_0x11c221['shift']());}};_0x26deef(++_0x65c6a5);}(_0x3f8b,0x1c4));var _0xb3f8=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0x3f8b[_0x11946c];return _0x383935;};'use strict';var multer=require(_0xb3f8('0x0'));var util=require(_0xb3f8('0x1'));var path=require('path');var timeout=require(_0xb3f8('0x2'));var express=require(_0xb3f8('0x3'));var router=express['Router']();var fs_extra=require(_0xb3f8('0x4'));var auth=require(_0xb3f8('0x5'));var interaction=require(_0xb3f8('0x6'));var config=require(_0xb3f8('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0xb3f8('0x8')]('/',auth[_0xb3f8('0x9')](),controller[_0xb3f8('0xa')]);router['get'](_0xb3f8('0xb'),auth['isAuthenticated'](),controller[_0xb3f8('0xc')]);router[_0xb3f8('0x8')]('/:id/preview',auth[_0xb3f8('0x9')](),controller['preview']);router[_0xb3f8('0x8')](_0xb3f8('0xd'),auth[_0xb3f8('0x9')](),controller[_0xb3f8('0xe')]);router[_0xb3f8('0x8')]('/:id/query',auth[_0xb3f8('0x9')](),controller['query']);router['post']('/',auth[_0xb3f8('0x9')](),controller[_0xb3f8('0xf')]);router[_0xb3f8('0x10')](_0xb3f8('0xb'),auth[_0xb3f8('0x9')](),controller[_0xb3f8('0x11')]);router[_0xb3f8('0x12')](_0xb3f8('0xb'),auth[_0xb3f8('0x9')](),controller['destroy']);module[_0xb3f8('0x13')]=router; \ No newline at end of file +var _0x6e06=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','index','/:id','isAuthenticated','show','get','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6e06,0x9a));var _0x66e0=function(_0x16d22f,_0x26c599){_0x16d22f=_0x16d22f-0x0;var _0x49272f=_0x6e06[_0x16d22f];return _0x49272f;};'use strict';var multer=require(_0x66e0('0x0'));var util=require(_0x66e0('0x1'));var path=require(_0x66e0('0x2'));var timeout=require(_0x66e0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x66e0('0x4'));var auth=require(_0x66e0('0x5'));var interaction=require(_0x66e0('0x6'));var config=require(_0x66e0('0x7'));var controller=require(_0x66e0('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x66e0('0x9')]);router['get'](_0x66e0('0xa'),auth[_0x66e0('0xb')](),controller[_0x66e0('0xc')]);router[_0x66e0('0xd')](_0x66e0('0xe'),auth['isAuthenticated'](),controller[_0x66e0('0xf')]);router[_0x66e0('0xd')](_0x66e0('0x10'),auth[_0x66e0('0xb')](),controller['run']);router['get'](_0x66e0('0x11'),auth['isAuthenticated'](),controller[_0x66e0('0x12')]);router[_0x66e0('0x13')]('/',auth[_0x66e0('0xb')](),controller[_0x66e0('0x14')]);router[_0x66e0('0x15')]('/:id',auth[_0x66e0('0xb')](),controller[_0x66e0('0x16')]);router[_0x66e0('0x17')](_0x66e0('0xa'),auth[_0x66e0('0xb')](),controller[_0x66e0('0x18')]);module[_0x66e0('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2a5d07c..715eba5 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0d0=['ENUM','pdf','csv','DATE','Loading','manual','scheduled','sequelize','moment','exports','STRING'];(function(_0x3a99c3,_0x4b254c){var _0x525117=function(_0x17e8bd){while(--_0x17e8bd){_0x3a99c3['push'](_0x3a99c3['shift']());}};_0x525117(++_0x4b254c);}(_0xe0d0,0x1e0));var _0x0e0d=function(_0x4325f8,_0xf8fee0){_0x4325f8=_0x4325f8-0x0;var _0x566582=_0xe0d0[_0x4325f8];return _0x566582;};'use strict';var Sequelize=require(_0x0e0d('0x0'));var moment=require(_0x0e0d('0x1'));module[_0x0e0d('0x2')]={'name':{'type':Sequelize[_0x0e0d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x0e0d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x0e0d('0x4')]('csv',_0x0e0d('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x0e0d('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x0e0d('0x7')]},'endDate':{'type':Sequelize[_0x0e0d('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x0e0d('0x8')},'type':{'type':Sequelize[_0x0e0d('0x4')](_0x0e0d('0x9'),_0x0e0d('0xa')),'allowNull':![],'defaultValue':_0x0e0d('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x0e0d('0x3')]}}; \ No newline at end of file +var _0xa964=['csv','pdf','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM'];(function(_0x1b45e8,_0x2477f0){var _0x16f2bb=function(_0x1d70d8){while(--_0x1d70d8){_0x1b45e8['push'](_0x1b45e8['shift']());}};_0x16f2bb(++_0x2477f0);}(_0xa964,0xa1));var _0x4a96=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0xa964[_0x347471];return _0x422b6a;};'use strict';var Sequelize=require(_0x4a96('0x0'));var moment=require('moment');module[_0x4a96('0x1')]={'name':{'type':Sequelize[_0x4a96('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x4a96('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x4a96('0x3')](_0x4a96('0x4'),_0x4a96('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0x4a96('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4a96('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x4a96('0x7')},'type':{'type':Sequelize[_0x4a96('0x3')](_0x4a96('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x4a96('0x8')},'reportId':{'type':Sequelize[_0x4a96('0x9')](0xb)[_0x4a96('0xa')]},'reportType':{'type':Sequelize[_0x4a96('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 22014cc..6aedcc4 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a38=['type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','savename','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','name','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','filter'];(function(_0x23a823,_0x4dbde0){var _0x5cbe93=function(_0x511fc9){while(--_0x511fc9){_0x23a823['push'](_0x23a823['shift']());}};_0x5cbe93(++_0x4dbde0);}(_0x6a38,0x189));var _0x86a3=function(_0xb204aa,_0x1809b2){_0xb204aa=_0xb204aa-0x0;var _0x2b2ee1=_0x6a38[_0xb204aa];return _0x2b2ee1;};'use strict';var emlformat=require(_0x86a3('0x0'));var rimraf=require(_0x86a3('0x1'));var zipdir=require(_0x86a3('0x2'));var jsonpatch=require(_0x86a3('0x3'));var rp=require('request-promise');var moment=require(_0x86a3('0x4'));var BPromise=require(_0x86a3('0x5'));var Mustache=require(_0x86a3('0x6'));var util=require(_0x86a3('0x7'));var path=require('path');var sox=require(_0x86a3('0x8'));var csv=require(_0x86a3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86a3('0xa'));var _=require('lodash');var squel=require(_0x86a3('0xb'));var crypto=require(_0x86a3('0xc'));var jsforce=require(_0x86a3('0xd'));var deskjs=require(_0x86a3('0xe'));var toCsv=require(_0x86a3('0x9'));var querystring=require('querystring');var Papa=require(_0x86a3('0xf'));var Redis=require(_0x86a3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x86a3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86a3('0x12'));var logger=require(_0x86a3('0x13'))('api');var utils=require(_0x86a3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x86a3('0x15'));var db=require(_0x86a3('0x16'))['db'];function respondWithStatusCode(_0x34111e,_0x7f5c7a){_0x7f5c7a=_0x7f5c7a||0xcc;return function(_0x3a13a9){if(_0x3a13a9){return _0x34111e[_0x86a3('0x17')](_0x7f5c7a);}return _0x34111e[_0x86a3('0x18')](_0x7f5c7a)[_0x86a3('0x19')]();};}function respondWithResult(_0x23e247,_0x383a7d){_0x383a7d=_0x383a7d||0xc8;return function(_0x196fbe){if(_0x196fbe){return _0x23e247['status'](_0x383a7d)[_0x86a3('0x1a')](_0x196fbe);}};}function respondWithFilteredResult(_0x4c2b31,_0xc68a9f){return function(_0x28ebe7){if(_0x28ebe7){var _0x19591f=typeof _0xc68a9f['offset']===_0x86a3('0x1b')&&typeof _0xc68a9f[_0x86a3('0x1c')]===_0x86a3('0x1b');var _0xc7b4e0=_0x28ebe7['count'];var _0x4ac139=_0x19591f?0x0:_0xc68a9f[_0x86a3('0x1d')];var _0x126ecb=_0x19591f?_0x28ebe7[_0x86a3('0x1e')]:_0xc68a9f[_0x86a3('0x1d')]+_0xc68a9f[_0x86a3('0x1c')];var _0x4298df;if(_0x126ecb>=_0xc7b4e0){_0x126ecb=_0xc7b4e0;_0x4298df=0xc8;}else{_0x4298df=0xce;}_0x4c2b31[_0x86a3('0x18')](_0x4298df);return _0x4c2b31[_0x86a3('0x1f')](_0x86a3('0x20'),_0x4ac139+'-'+_0x126ecb+'/'+_0xc7b4e0)[_0x86a3('0x1a')](_0x28ebe7);}return null;};}function patchUpdates(_0x59fc3e){return function(_0x34ee32){try{jsonpatch['apply'](_0x34ee32,_0x59fc3e,!![]);}catch(_0x2c1fe2){return BPromise[_0x86a3('0x21')](_0x2c1fe2);}return _0x34ee32[_0x86a3('0x22')]();};}function saveUpdates(_0x9619ad,_0xf88977){return function(_0x198f7b){if(_0x198f7b){return _0x198f7b['update'](_0x9619ad)[_0x86a3('0x23')](function(_0xe5e0a9){return _0xe5e0a9;});}return null;};}function removeEntity(_0x855eb4,_0x2479ea){return function(_0x228476){if(_0x228476){return _0x228476[_0x86a3('0x24')]()['then'](function(){var _0x47e99c=_0x228476[_0x86a3('0x25')]({'plain':!![]});var _0x1c6036='ExtractedReports';return db[_0x86a3('0x26')][_0x86a3('0x24')]({'where':{'type':_0x1c6036,'resourceId':_0x47e99c['id']}})['then'](function(){return _0x228476;});})[_0x86a3('0x23')](function(){_0x855eb4[_0x86a3('0x18')](0xcc)[_0x86a3('0x19')]();});}};}function handleEntityNotFound(_0x41cbbd,_0x4d9d3d){return function(_0x2965d4){if(!_0x2965d4){_0x41cbbd[_0x86a3('0x17')](0x194);}return _0x2965d4;};}function handleError(_0x4bd969,_0x4ecbb6){_0x4ecbb6=_0x4ecbb6||0x1f4;return function(_0x48fed9){logger[_0x86a3('0x27')](_0x48fed9['stack']);if(_0x48fed9[_0x86a3('0x28')]){delete _0x48fed9[_0x86a3('0x28')];}_0x4bd969[_0x86a3('0x18')](_0x4ecbb6)['send'](_0x48fed9);};}exports['index']=function(_0x239928,_0x16116d){var _0x23e27d={},_0x3ad8ec={},_0x3b0d67={'count':0x0,'rows':[]};var _0x34b529=_[_0x86a3('0x29')](db[_0x86a3('0x2a')][_0x86a3('0x2b')],function(_0x49d1a8){return{'name':_0x49d1a8[_0x86a3('0x2c')],'type':_0x49d1a8['type'][_0x86a3('0x2d')]};});_0x3ad8ec[_0x86a3('0x2e')]=_[_0x86a3('0x29')](_0x34b529,_0x86a3('0x28'));_0x3ad8ec[_0x86a3('0x2f')]=_[_0x86a3('0x30')](_0x239928['query']);_0x3ad8ec[_0x86a3('0x31')]=_[_0x86a3('0x32')](_0x3ad8ec[_0x86a3('0x2e')],_0x3ad8ec[_0x86a3('0x2f')]);_0x23e27d['attributes']=_['intersection'](_0x3ad8ec[_0x86a3('0x2e')],qs[_0x86a3('0x33')](_0x239928[_0x86a3('0x2f')][_0x86a3('0x33')]));_0x23e27d['attributes']=_0x23e27d[_0x86a3('0x34')][_0x86a3('0x35')]?_0x23e27d['attributes']:_0x3ad8ec['model'];if(!_0x239928[_0x86a3('0x2f')]['hasOwnProperty']('nolimit')){_0x23e27d['limit']=qs[_0x86a3('0x1c')](_0x239928['query'][_0x86a3('0x1c')]);_0x23e27d[_0x86a3('0x1d')]=qs['offset'](_0x239928[_0x86a3('0x2f')][_0x86a3('0x1d')]);}_0x23e27d['order']=qs[_0x86a3('0x36')](_0x239928[_0x86a3('0x2f')][_0x86a3('0x36')]);_0x23e27d[_0x86a3('0x37')]=qs[_0x86a3('0x31')](_['pick'](_0x239928[_0x86a3('0x2f')],_0x3ad8ec[_0x86a3('0x31')]),_0x34b529);if(_0x239928['query'][_0x86a3('0x38')]){_0x23e27d[_0x86a3('0x37')]=_['merge'](_0x23e27d[_0x86a3('0x37')],{'$or':_[_0x86a3('0x29')](_0x34b529,function(_0x26e8a5){if(_0x26e8a5[_0x86a3('0x39')]!==_0x86a3('0x3a')){var _0x51ce42={};_0x51ce42[_0x26e8a5['name']]={'$like':'%'+_0x239928[_0x86a3('0x2f')][_0x86a3('0x38')]+'%'};return _0x51ce42;}})});}_0x23e27d=_[_0x86a3('0x3b')]({},_0x23e27d,_0x239928[_0x86a3('0x3c')]);var _0x1081d7={'where':_0x23e27d['where']};return db[_0x86a3('0x2a')][_0x86a3('0x1e')](_0x1081d7)[_0x86a3('0x23')](function(_0x2b8f7b){_0x3b0d67['count']=_0x2b8f7b;if(_0x239928[_0x86a3('0x2f')][_0x86a3('0x3d')]){_0x23e27d[_0x86a3('0x3e')]=[{'all':!![]}];}return db[_0x86a3('0x2a')][_0x86a3('0x3f')](_0x23e27d);})[_0x86a3('0x23')](function(_0x593f30){_0x3b0d67[_0x86a3('0x40')]=_0x593f30;return _0x3b0d67;})[_0x86a3('0x23')](respondWithFilteredResult(_0x16116d,_0x23e27d))['catch'](handleError(_0x16116d,null));};exports[_0x86a3('0x41')]=function(_0x53e571,_0xe497bb){var _0x3b0d1b={'raw':!![],'where':{'id':_0x53e571[_0x86a3('0x42')]['id']}},_0x4ae206={};_0x4ae206[_0x86a3('0x2e')]=_[_0x86a3('0x30')](db[_0x86a3('0x2a')][_0x86a3('0x2b')]);_0x4ae206[_0x86a3('0x2f')]=_['keys'](_0x53e571[_0x86a3('0x2f')]);_0x4ae206[_0x86a3('0x31')]=_[_0x86a3('0x32')](_0x4ae206[_0x86a3('0x2e')],_0x4ae206['query']);_0x3b0d1b[_0x86a3('0x34')]=_[_0x86a3('0x32')](_0x4ae206[_0x86a3('0x2e')],qs[_0x86a3('0x33')](_0x53e571['query'][_0x86a3('0x33')]));_0x3b0d1b[_0x86a3('0x34')]=_0x3b0d1b[_0x86a3('0x34')][_0x86a3('0x35')]?_0x3b0d1b[_0x86a3('0x34')]:_0x4ae206[_0x86a3('0x2e')];if(_0x53e571[_0x86a3('0x2f')][_0x86a3('0x3d')]){_0x3b0d1b[_0x86a3('0x3e')]=[{'all':!![]}];}_0x3b0d1b=_[_0x86a3('0x3b')]({},_0x3b0d1b,_0x53e571[_0x86a3('0x3c')]);return db[_0x86a3('0x2a')][_0x86a3('0x43')](_0x3b0d1b)[_0x86a3('0x23')](handleEntityNotFound(_0xe497bb,null))[_0x86a3('0x23')](respondWithResult(_0xe497bb,null))['catch'](handleError(_0xe497bb,null));};exports[_0x86a3('0x44')]=function(_0x5d4f6c,_0x2181ea){return db[_0x86a3('0x2a')][_0x86a3('0x44')](_0x5d4f6c[_0x86a3('0x45')],{})[_0x86a3('0x23')](function(_0x40af65){var _0x311e6a=_0x5d4f6c[_0x86a3('0x46')][_0x86a3('0x25')]({'plain':!![]});if(!_0x311e6a)throw new Error(_0x86a3('0x47'));if(_0x311e6a[_0x86a3('0x48')]===_0x86a3('0x46')){var _0x24b3a1=_0x40af65['get']({'plain':!![]});var _0x58af52='ExtractedReports';return db[_0x86a3('0x49')]['find']({'where':{'name':_0x58af52,'userProfileId':_0x311e6a[_0x86a3('0x4a')]},'raw':!![]})[_0x86a3('0x23')](function(_0x14e14b){if(_0x14e14b&&_0x14e14b[_0x86a3('0x4b')]===0x0){return db[_0x86a3('0x26')][_0x86a3('0x44')]({'name':_0x24b3a1['name'],'resourceId':_0x24b3a1['id'],'type':_0x14e14b[_0x86a3('0x28')],'sectionId':_0x14e14b['id']},{})[_0x86a3('0x23')](function(){return _0x40af65;});}else{return _0x40af65;}})[_0x86a3('0x4c')](function(_0xc1807f){logger['error'](_0x86a3('0x4d'),_0xc1807f);throw _0xc1807f;});}return _0x40af65;})[_0x86a3('0x23')](respondWithResult(_0x2181ea,0xc9))['catch'](handleError(_0x2181ea,null));};exports['update']=function(_0x2602ee,_0xfdccbf){if(_0x2602ee['body']['id']){delete _0x2602ee[_0x86a3('0x45')]['id'];}return db[_0x86a3('0x2a')]['find']({'where':{'id':_0x2602ee['params']['id']}})[_0x86a3('0x23')](handleEntityNotFound(_0xfdccbf,null))[_0x86a3('0x23')](saveUpdates(_0x2602ee[_0x86a3('0x45')],null))[_0x86a3('0x23')](respondWithResult(_0xfdccbf,null))[_0x86a3('0x4c')](handleError(_0xfdccbf,null));};exports[_0x86a3('0x24')]=function(_0x591785,_0x19b572){return db['AnalyticExtractedReport'][_0x86a3('0x43')]({'where':{'id':_0x591785['params']['id']}})['then'](handleEntityNotFound(_0x19b572,null))[_0x86a3('0x23')](removeEntity(_0x19b572,null))[_0x86a3('0x4c')](handleError(_0x19b572,null));};exports[_0x86a3('0x4e')]=function(_0x597153,_0x450e83,_0x483e64){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x597153[_0x86a3('0x42')]['id']},'attributes':[_0x86a3('0x28'),_0x86a3('0x4f'),'savename',_0x86a3('0x50')],'raw':!![]})[_0x86a3('0x23')](handleEntityNotFound(_0x450e83,null))[_0x86a3('0x23')](function(_0x4b7c85){if(_0x4b7c85){if(!fs[_0x86a3('0x51')](path[_0x86a3('0x52')](config[_0x86a3('0x53')],_0x86a3('0x54'),_0x4b7c85['savename']))){throw new db['Sequelize']['ValidationError'](_0x86a3('0x55'));}if(_0x597153[_0x86a3('0x2f')][_0x86a3('0x56')]){return _0x450e83[_0x86a3('0x17')](0xc8);}return _0x450e83[_0x86a3('0x4e')](path[_0x86a3('0x52')](config['root'],_0x86a3('0x54'),_0x4b7c85[_0x86a3('0x57')]),util['format'](_0x86a3('0x58'),_0x4b7c85['basename']||_0x4b7c85[_0x86a3('0x28')],_0x4b7c85[_0x86a3('0x50')][_0x86a3('0x59')]()));}})[_0x86a3('0x4c')](handleError(_0x450e83,null));}; \ No newline at end of file +var _0x4aa2=['VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','download','savename','output','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','root','format','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge'];(function(_0x67d9db,_0x269b5f){var _0x1c31d9=function(_0x5d706e){while(--_0x5d706e){_0x67d9db['push'](_0x67d9db['shift']());}};_0x1c31d9(++_0x269b5f);}(_0x4aa2,0x14d));var _0x24aa=function(_0x2bf65d,_0x4e60e5){_0x2bf65d=_0x2bf65d-0x0;var _0x15c520=_0x4aa2[_0x2bf65d];return _0x15c520;};'use strict';var emlformat=require(_0x24aa('0x0'));var rimraf=require(_0x24aa('0x1'));var zipdir=require(_0x24aa('0x2'));var jsonpatch=require(_0x24aa('0x3'));var rp=require(_0x24aa('0x4'));var moment=require(_0x24aa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x24aa('0x6'));var path=require('path');var sox=require(_0x24aa('0x7'));var csv=require(_0x24aa('0x8'));var ejs=require(_0x24aa('0x9'));var fs=require('fs');var fs_extra=require(_0x24aa('0xa'));var _=require(_0x24aa('0xb'));var squel=require('squel');var crypto=require(_0x24aa('0xc'));var jsforce=require(_0x24aa('0xd'));var deskjs=require(_0x24aa('0xe'));var toCsv=require('to-csv');var querystring=require(_0x24aa('0xf'));var Papa=require('papaparse');var Redis=require(_0x24aa('0x10'));var authService=require(_0x24aa('0x11'));var qs=require(_0x24aa('0x12'));var as=require(_0x24aa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24aa('0x14'))(_0x24aa('0x15'));var utils=require(_0x24aa('0x16'));var config=require(_0x24aa('0x17'));var licenseUtil=require(_0x24aa('0x18'));var db=require(_0x24aa('0x19'))['db'];function respondWithStatusCode(_0x2c6ed2,_0x169ad8){_0x169ad8=_0x169ad8||0xcc;return function(_0x248bf9){if(_0x248bf9){return _0x2c6ed2['sendStatus'](_0x169ad8);}return _0x2c6ed2[_0x24aa('0x1a')](_0x169ad8)[_0x24aa('0x1b')]();};}function respondWithResult(_0x202a6c,_0x177713){_0x177713=_0x177713||0xc8;return function(_0x46e913){if(_0x46e913){return _0x202a6c['status'](_0x177713)[_0x24aa('0x1c')](_0x46e913);}};}function respondWithFilteredResult(_0x1ac9e2,_0x844681){return function(_0x75190a){if(_0x75190a){var _0x3867de=typeof _0x844681['offset']===_0x24aa('0x1d')&&typeof _0x844681['limit']==='undefined';var _0xe6413=_0x75190a[_0x24aa('0x1e')];var _0x5153e4=_0x3867de?0x0:_0x844681[_0x24aa('0x1f')];var _0xe13a38=_0x3867de?_0x75190a[_0x24aa('0x1e')]:_0x844681[_0x24aa('0x1f')]+_0x844681[_0x24aa('0x20')];var _0xaf137e;if(_0xe13a38>=_0xe6413){_0xe13a38=_0xe6413;_0xaf137e=0xc8;}else{_0xaf137e=0xce;}_0x1ac9e2['status'](_0xaf137e);return _0x1ac9e2[_0x24aa('0x21')](_0x24aa('0x22'),_0x5153e4+'-'+_0xe13a38+'/'+_0xe6413)[_0x24aa('0x1c')](_0x75190a);}return null;};}function patchUpdates(_0x111201){return function(_0x1c9feb){try{jsonpatch[_0x24aa('0x23')](_0x1c9feb,_0x111201,!![]);}catch(_0x1c8ed8){return BPromise[_0x24aa('0x24')](_0x1c8ed8);}return _0x1c9feb[_0x24aa('0x25')]();};}function saveUpdates(_0xacf0e7,_0x3f44ce){return function(_0x46350a){if(_0x46350a){return _0x46350a[_0x24aa('0x26')](_0xacf0e7)['then'](function(_0xaf975a){return _0xaf975a;});}return null;};}function removeEntity(_0x41f18a,_0x392460){return function(_0x22ae7e){if(_0x22ae7e){return _0x22ae7e['destroy']()[_0x24aa('0x27')](function(){var _0x59d430=_0x22ae7e[_0x24aa('0x28')]({'plain':!![]});var _0x524ed9=_0x24aa('0x29');return db[_0x24aa('0x2a')][_0x24aa('0x2b')]({'where':{'type':_0x524ed9,'resourceId':_0x59d430['id']}})[_0x24aa('0x27')](function(){return _0x22ae7e;});})[_0x24aa('0x27')](function(){_0x41f18a['status'](0xcc)[_0x24aa('0x1b')]();});}};}function handleEntityNotFound(_0x73428d,_0x3171f8){return function(_0x5dab9d){if(!_0x5dab9d){_0x73428d[_0x24aa('0x2c')](0x194);}return _0x5dab9d;};}function handleError(_0x5b742a,_0x16ce05){_0x16ce05=_0x16ce05||0x1f4;return function(_0x55da2f){logger[_0x24aa('0x2d')](_0x55da2f[_0x24aa('0x2e')]);if(_0x55da2f[_0x24aa('0x2f')]){delete _0x55da2f[_0x24aa('0x2f')];}_0x5b742a[_0x24aa('0x1a')](_0x16ce05)[_0x24aa('0x30')](_0x55da2f);};}exports[_0x24aa('0x31')]=function(_0x467e22,_0x36a6ee){var _0x5cdbc8={},_0x1b8c49={},_0x313592={'count':0x0,'rows':[]};var _0x270a09=_['map'](db['AnalyticExtractedReport'][_0x24aa('0x32')],function(_0x259b5b){return{'name':_0x259b5b[_0x24aa('0x33')],'type':_0x259b5b[_0x24aa('0x34')]['key']};});_0x1b8c49[_0x24aa('0x35')]=_[_0x24aa('0x36')](_0x270a09,_0x24aa('0x2f'));_0x1b8c49[_0x24aa('0x37')]=_[_0x24aa('0x38')](_0x467e22[_0x24aa('0x37')]);_0x1b8c49[_0x24aa('0x39')]=_[_0x24aa('0x3a')](_0x1b8c49[_0x24aa('0x35')],_0x1b8c49[_0x24aa('0x37')]);_0x5cdbc8[_0x24aa('0x3b')]=_['intersection'](_0x1b8c49[_0x24aa('0x35')],qs[_0x24aa('0x3c')](_0x467e22['query'][_0x24aa('0x3c')]));_0x5cdbc8['attributes']=_0x5cdbc8[_0x24aa('0x3b')]['length']?_0x5cdbc8[_0x24aa('0x3b')]:_0x1b8c49[_0x24aa('0x35')];if(!_0x467e22['query'][_0x24aa('0x3d')](_0x24aa('0x3e'))){_0x5cdbc8[_0x24aa('0x20')]=qs['limit'](_0x467e22['query'][_0x24aa('0x20')]);_0x5cdbc8[_0x24aa('0x1f')]=qs[_0x24aa('0x1f')](_0x467e22[_0x24aa('0x37')][_0x24aa('0x1f')]);}_0x5cdbc8['order']=qs[_0x24aa('0x3f')](_0x467e22[_0x24aa('0x37')][_0x24aa('0x3f')]);_0x5cdbc8['where']=qs['filters'](_[_0x24aa('0x40')](_0x467e22[_0x24aa('0x37')],_0x1b8c49[_0x24aa('0x39')]),_0x270a09);if(_0x467e22[_0x24aa('0x37')]['filter']){_0x5cdbc8[_0x24aa('0x41')]=_[_0x24aa('0x42')](_0x5cdbc8[_0x24aa('0x41')],{'$or':_[_0x24aa('0x36')](_0x270a09,function(_0x36cf2e){if(_0x36cf2e[_0x24aa('0x34')]!==_0x24aa('0x43')){var _0x17478e={};_0x17478e[_0x36cf2e[_0x24aa('0x2f')]]={'$like':'%'+_0x467e22[_0x24aa('0x37')][_0x24aa('0x44')]+'%'};return _0x17478e;}})});}_0x5cdbc8=_[_0x24aa('0x42')]({},_0x5cdbc8,_0x467e22[_0x24aa('0x45')]);var _0x3ff049={'where':_0x5cdbc8['where']};return db[_0x24aa('0x46')][_0x24aa('0x1e')](_0x3ff049)[_0x24aa('0x27')](function(_0x3e0fab){_0x313592[_0x24aa('0x1e')]=_0x3e0fab;if(_0x467e22['query'][_0x24aa('0x47')]){_0x5cdbc8[_0x24aa('0x48')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x24aa('0x49')](_0x5cdbc8);})[_0x24aa('0x27')](function(_0x1bac8e){_0x313592[_0x24aa('0x4a')]=_0x1bac8e;return _0x313592;})[_0x24aa('0x27')](respondWithFilteredResult(_0x36a6ee,_0x5cdbc8))[_0x24aa('0x4b')](handleError(_0x36a6ee,null));};exports[_0x24aa('0x4c')]=function(_0x536ccd,_0xf79581){var _0x227288={'raw':!![],'where':{'id':_0x536ccd[_0x24aa('0x4d')]['id']}},_0x1b38d8={};_0x1b38d8[_0x24aa('0x35')]=_[_0x24aa('0x38')](db[_0x24aa('0x46')]['rawAttributes']);_0x1b38d8[_0x24aa('0x37')]=_['keys'](_0x536ccd[_0x24aa('0x37')]);_0x1b38d8[_0x24aa('0x39')]=_[_0x24aa('0x3a')](_0x1b38d8[_0x24aa('0x35')],_0x1b38d8[_0x24aa('0x37')]);_0x227288['attributes']=_[_0x24aa('0x3a')](_0x1b38d8[_0x24aa('0x35')],qs['fields'](_0x536ccd[_0x24aa('0x37')][_0x24aa('0x3c')]));_0x227288[_0x24aa('0x3b')]=_0x227288['attributes'][_0x24aa('0x4e')]?_0x227288[_0x24aa('0x3b')]:_0x1b38d8['model'];if(_0x536ccd['query']['includeAll']){_0x227288[_0x24aa('0x48')]=[{'all':!![]}];}_0x227288=_[_0x24aa('0x42')]({},_0x227288,_0x536ccd['options']);return db[_0x24aa('0x46')][_0x24aa('0x4f')](_0x227288)[_0x24aa('0x27')](handleEntityNotFound(_0xf79581,null))['then'](respondWithResult(_0xf79581,null))[_0x24aa('0x4b')](handleError(_0xf79581,null));};exports[_0x24aa('0x50')]=function(_0x47d7c3,_0xceab26){return db[_0x24aa('0x46')][_0x24aa('0x50')](_0x47d7c3[_0x24aa('0x51')],{})[_0x24aa('0x27')](function(_0x4c3c25){var _0x21d4cb=_0x47d7c3[_0x24aa('0x52')][_0x24aa('0x28')]({'plain':!![]});if(!_0x21d4cb)throw new Error(_0x24aa('0x53'));if(_0x21d4cb[_0x24aa('0x54')]==='user'){var _0x3754eb=_0x4c3c25[_0x24aa('0x28')]({'plain':!![]});var _0x13047a='ExtractedReports';return db[_0x24aa('0x55')]['find']({'where':{'name':_0x13047a,'userProfileId':_0x21d4cb[_0x24aa('0x56')]},'raw':!![]})[_0x24aa('0x27')](function(_0xd0b16){if(_0xd0b16&&_0xd0b16[_0x24aa('0x57')]===0x0){return db[_0x24aa('0x2a')][_0x24aa('0x50')]({'name':_0x3754eb['name'],'resourceId':_0x3754eb['id'],'type':_0xd0b16['name'],'sectionId':_0xd0b16['id']},{})[_0x24aa('0x27')](function(){return _0x4c3c25;});}else{return _0x4c3c25;}})[_0x24aa('0x4b')](function(_0xa49096){logger[_0x24aa('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa49096);throw _0xa49096;});}return _0x4c3c25;})[_0x24aa('0x27')](respondWithResult(_0xceab26,0xc9))[_0x24aa('0x4b')](handleError(_0xceab26,null));};exports['update']=function(_0xd618d8,_0x36fa8e){if(_0xd618d8[_0x24aa('0x51')]['id']){delete _0xd618d8[_0x24aa('0x51')]['id'];}return db[_0x24aa('0x46')][_0x24aa('0x4f')]({'where':{'id':_0xd618d8[_0x24aa('0x4d')]['id']}})[_0x24aa('0x27')](handleEntityNotFound(_0x36fa8e,null))['then'](saveUpdates(_0xd618d8[_0x24aa('0x51')],null))[_0x24aa('0x27')](respondWithResult(_0x36fa8e,null))[_0x24aa('0x4b')](handleError(_0x36fa8e,null));};exports[_0x24aa('0x2b')]=function(_0x3fc971,_0x4eac63){return db[_0x24aa('0x46')][_0x24aa('0x4f')]({'where':{'id':_0x3fc971['params']['id']}})[_0x24aa('0x27')](handleEntityNotFound(_0x4eac63,null))[_0x24aa('0x27')](removeEntity(_0x4eac63,null))[_0x24aa('0x4b')](handleError(_0x4eac63,null));};exports[_0x24aa('0x58')]=function(_0x19a213,_0x308283,_0x5d17e8){return db['AnalyticExtractedReport'][_0x24aa('0x4f')]({'where':{'id':_0x19a213[_0x24aa('0x4d')]['id']},'attributes':[_0x24aa('0x2f'),'basename',_0x24aa('0x59'),_0x24aa('0x5a')],'raw':!![]})['then'](handleEntityNotFound(_0x308283,null))[_0x24aa('0x27')](function(_0x487728){if(_0x487728){if(!fs['existsSync'](path['join'](config['root'],_0x24aa('0x5b'),_0x487728[_0x24aa('0x59')]))){throw new db['Sequelize'][(_0x24aa('0x5c'))](_0x24aa('0x5d'));}if(_0x19a213[_0x24aa('0x37')][_0x24aa('0x5e')]){return _0x308283[_0x24aa('0x2c')](0xc8);}return _0x308283[_0x24aa('0x58')](path[_0x24aa('0x5f')](config[_0x24aa('0x60')],_0x24aa('0x5b'),_0x487728['savename']),util[_0x24aa('0x61')]('%s.%s',_0x487728[_0x24aa('0x62')]||_0x487728[_0x24aa('0x2f')],_0x487728['output'][_0x24aa('0x63')]()));}})[_0x24aa('0x4b')](handleError(_0x308283,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f92f39d..87d8185 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.model.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd314=['define','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x3ea5e1,_0x17c486){var _0x1b81d7=function(_0x5af999){while(--_0x5af999){_0x3ea5e1['push'](_0x3ea5e1['shift']());}};_0x1b81d7(++_0x17c486);}(_0xd314,0x9e));var _0x4d31=function(_0x4daa9b,_0x4a0596){_0x4daa9b=_0x4daa9b-0x0;var _0x33b857=_0xd314[_0x4daa9b];return _0x33b857;};'use strict';var _=require(_0x4d31('0x0'));var util=require(_0x4d31('0x1'));var logger=require(_0x4d31('0x2'))(_0x4d31('0x3'));var moment=require('moment');var BPromise=require(_0x4d31('0x4'));var rp=require(_0x4d31('0x5'));var fs=require('fs');var path=require(_0x4d31('0x6'));var rimraf=require('rimraf');var config=require(_0x4d31('0x7'));var attributes=require(_0x4d31('0x8'));module[_0x4d31('0x9')]=function(_0x3508c4,_0x64e3ca){return _0x3508c4[_0x4d31('0xa')](_0x4d31('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd0b=['moment','bluebird','path','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcd0b,0x193));var _0xbcd0=function(_0x532f2a,_0x23560c){_0x532f2a=_0x532f2a-0x0;var _0x1b9649=_0xcd0b[_0x532f2a];return _0x1b9649;};'use strict';var _=require(_0xbcd0('0x0'));var util=require(_0xbcd0('0x1'));var logger=require(_0xbcd0('0x2'))(_0xbcd0('0x3'));var moment=require(_0xbcd0('0x4'));var BPromise=require(_0xbcd0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcd0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbcd0('0x7'));module[_0xbcd0('0x8')]=function(_0x4017c7,_0x1b1ff5){return _0x4017c7[_0xbcd0('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xbcd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 4356a48..46d7c4c 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd840=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d1d48,_0x342cf8){var _0x4abd7d=function(_0x262dae){while(--_0x262dae){_0x5d1d48['push'](_0x5d1d48['shift']());}};_0x4abd7d(++_0x342cf8);}(_0xd840,0xd7));var _0x0d84=function(_0x11cd06,_0x48a90a){_0x11cd06=_0x11cd06-0x0;var _0x16290f=_0xd840[_0x11cd06];return _0x16290f;};'use strict';var _=require(_0x0d84('0x0'));var util=require(_0x0d84('0x1'));var moment=require(_0x0d84('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d84('0x3'));var fs=require('fs');var Redis=require(_0x0d84('0x4'));var db=require(_0x0d84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d84('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0d84('0x7'));var client=jayson['client'][_0x0d84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5df0e9,_0x4edba8,_0x95403c){return new BPromise(function(_0x3147a1,_0x4e633e){return client[_0x0d84('0x9')](_0x5df0e9,_0x95403c)[_0x0d84('0xa')](function(_0x3b7164){logger['info'](_0x0d84('0xb'),_0x4edba8,_0x0d84('0xc'));logger[_0x0d84('0xd')](_0x0d84('0xe'),_0x4edba8,'request\x20sent',JSON[_0x0d84('0xf')](_0x3b7164));if(_0x3b7164[_0x0d84('0x10')]){if(_0x3b7164['error'][_0x0d84('0x11')]===0x1f4){logger['error'](_0x0d84('0xb'),_0x4edba8,_0x3b7164[_0x0d84('0x10')]['message']);return _0x4e633e(_0x3b7164[_0x0d84('0x10')][_0x0d84('0x12')]);}logger['error'](_0x0d84('0xb'),_0x4edba8,_0x3b7164[_0x0d84('0x10')]['message']);return _0x3147a1(_0x3b7164[_0x0d84('0x10')][_0x0d84('0x12')]);}else{logger['info'](_0x0d84('0xb'),_0x4edba8,'request\x20sent');_0x3147a1(_0x3b7164[_0x0d84('0x13')][_0x0d84('0x12')]);}})[_0x0d84('0x14')](function(_0x12e5c0){logger[_0x0d84('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4edba8,_0x12e5c0);_0x4e633e(_0x12e5c0);});});} \ No newline at end of file +var _0xf609=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x55b776,_0x4ad313){var _0x10a1c2=function(_0x5be11e){while(--_0x5be11e){_0x55b776['push'](_0x55b776['shift']());}};_0x10a1c2(++_0x4ad313);}(_0xf609,0x18b));var _0x9f60=function(_0x267086,_0x4103f8){_0x267086=_0x267086-0x0;var _0x1f29ce=_0xf609[_0x267086];return _0x1f29ce;};'use strict';var _=require('lodash');var util=require(_0x9f60('0x0'));var moment=require(_0x9f60('0x1'));var BPromise=require(_0x9f60('0x2'));var rs=require(_0x9f60('0x3'));var fs=require('fs');var Redis=require(_0x9f60('0x4'));var db=require(_0x9f60('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9f60('0x6'));var config=require(_0x9f60('0x7'));var jayson=require(_0x9f60('0x8'));var client=jayson[_0x9f60('0x9')][_0x9f60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xda67d0,_0x8fb51c,_0x12d850){return new BPromise(function(_0x169b6c,_0x21ee61){return client[_0x9f60('0xb')](_0xda67d0,_0x12d850)[_0x9f60('0xc')](function(_0x528963){logger[_0x9f60('0xd')](_0x9f60('0xe'),_0x8fb51c,_0x9f60('0xf'));logger[_0x9f60('0x10')](_0x9f60('0x11'),_0x8fb51c,'request\x20sent',JSON[_0x9f60('0x12')](_0x528963));if(_0x528963[_0x9f60('0x13')]){if(_0x528963[_0x9f60('0x13')][_0x9f60('0x14')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x8fb51c,_0x528963['error'][_0x9f60('0x15')]);return _0x21ee61(_0x528963['error'][_0x9f60('0x15')]);}logger[_0x9f60('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x8fb51c,_0x528963[_0x9f60('0x13')][_0x9f60('0x15')]);return _0x169b6c(_0x528963[_0x9f60('0x13')]['message']);}else{logger[_0x9f60('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x8fb51c,_0x9f60('0xf'));_0x169b6c(_0x528963[_0x9f60('0x16')][_0x9f60('0x15')]);}})[_0x9f60('0x17')](function(_0x456c49){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x8fb51c,_0x456c49);_0x21ee61(_0x456c49);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1c47b50..47c828f 100644 --- a/server/api/analyticExtractedReport/index.js +++ b/server/api/analyticExtractedReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae03=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put','update','destroy'];(function(_0xc7ed0c,_0x1d50c8){var _0x4f6662=function(_0x4c1108){while(--_0x4c1108){_0xc7ed0c['push'](_0xc7ed0c['shift']());}};_0x4f6662(++_0x1d50c8);}(_0xae03,0x1e4));var _0x3ae0=function(_0x192882,_0x76baac){_0x192882=_0x192882-0x0;var _0x3ccd45=_0xae03[_0x192882];return _0x3ccd45;};'use strict';var multer=require(_0x3ae0('0x0'));var util=require(_0x3ae0('0x1'));var path=require(_0x3ae0('0x2'));var timeout=require(_0x3ae0('0x3'));var express=require(_0x3ae0('0x4'));var router=express[_0x3ae0('0x5')]();var fs_extra=require(_0x3ae0('0x6'));var auth=require(_0x3ae0('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3ae0('0x8'));router[_0x3ae0('0x9')]('/',auth['isAuthenticated'](),controller[_0x3ae0('0xa')]);router['get'](_0x3ae0('0xb'),auth[_0x3ae0('0xc')](),controller[_0x3ae0('0xd')]);router[_0x3ae0('0x9')](_0x3ae0('0xe'),auth[_0x3ae0('0xc')](),controller['download']);router[_0x3ae0('0xf')]('/',auth[_0x3ae0('0xc')](),controller[_0x3ae0('0x10')]);router[_0x3ae0('0x11')](_0x3ae0('0xb'),auth[_0x3ae0('0xc')](),controller[_0x3ae0('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3ae0('0x13')]);module[_0x3ae0('0x14')]=router; \ No newline at end of file +var _0xfef4=['download','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0xfef4,0x1ea));var _0x4fef=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xfef4[_0x50a004];return _0x5e9992;};'use strict';var multer=require(_0x4fef('0x0'));var util=require('util');var path=require(_0x4fef('0x1'));var timeout=require(_0x4fef('0x2'));var express=require(_0x4fef('0x3'));var router=express[_0x4fef('0x4')]();var fs_extra=require(_0x4fef('0x5'));var auth=require(_0x4fef('0x6'));var interaction=require(_0x4fef('0x7'));var config=require(_0x4fef('0x8'));var controller=require(_0x4fef('0x9'));router[_0x4fef('0xa')]('/',auth[_0x4fef('0xb')](),controller[_0x4fef('0xc')]);router[_0x4fef('0xa')](_0x4fef('0xd'),auth['isAuthenticated'](),controller[_0x4fef('0xe')]);router[_0x4fef('0xa')](_0x4fef('0xf'),auth[_0x4fef('0xb')](),controller[_0x4fef('0x10')]);router[_0x4fef('0x11')]('/',auth[_0x4fef('0xb')](),controller[_0x4fef('0x12')]);router[_0x4fef('0x13')](_0x4fef('0xd'),auth[_0x4fef('0xb')](),controller[_0x4fef('0x14')]);router[_0x4fef('0x15')](_0x4fef('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4fef('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 594040f..88d5bd5 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63a7=['exports','STRING','BOOLEAN','sequelize'];(function(_0x267eeb,_0x58cefa){var _0x1dcd83=function(_0x3a7fb4){while(--_0x3a7fb4){_0x267eeb['push'](_0x267eeb['shift']());}};_0x1dcd83(++_0x58cefa);}(_0x63a7,0xd3));var _0x763a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x63a7[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x763a('0x0'));module[_0x763a('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x763a('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x763a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x763a('0x2')]},'custom':{'type':Sequelize[_0x763a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa929=['BOOLEAN','exports','TEXT','STRING'];(function(_0x11cef4,_0x801d11){var _0x1b0649=function(_0x56ac4c){while(--_0x56ac4c){_0x11cef4['push'](_0x11cef4['shift']());}};_0x1b0649(++_0x801d11);}(_0xa929,0x7d));var _0x9a92=function(_0x5f5120,_0x3fec51){_0x5f5120=_0x5f5120-0x0;var _0x3f76e1=_0xa929[_0x5f5120];return _0x3f76e1;};'use strict';var Sequelize=require('sequelize');module[_0x9a92('0x0')]={'field':{'type':Sequelize[_0x9a92('0x1')]},'alias':{'type':Sequelize[_0x9a92('0x2')]},'function':{'type':Sequelize[_0x9a92('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9a92('0x2')]},'custom':{'type':Sequelize[_0x9a92('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 26a0cb4..8e57b06 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.controller.js +++ b/server/api/analyticFieldReport/analyticFieldReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1633=['request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','reject','save','update','then','sendStatus','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','options','catch','create','bulkCreate','body','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','zip-dir'];(function(_0x20695e,_0x5929df){var _0x3746cf=function(_0x54f2a2){while(--_0x54f2a2){_0x20695e['push'](_0x20695e['shift']());}};_0x3746cf(++_0x5929df);}(_0x1633,0x19d));var _0x3163=function(_0x1f6a9f,_0x2b0a69){_0x1f6a9f=_0x1f6a9f-0x0;var _0x56842c=_0x1633[_0x1f6a9f];return _0x56842c;};'use strict';var emlformat=require(_0x3163('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3163('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3163('0x2'));var moment=require('moment');var BPromise=require(_0x3163('0x3'));var Mustache=require(_0x3163('0x4'));var util=require(_0x3163('0x5'));var path=require(_0x3163('0x6'));var sox=require(_0x3163('0x7'));var csv=require('to-csv');var ejs=require(_0x3163('0x8'));var fs=require('fs');var fs_extra=require(_0x3163('0x9'));var _=require(_0x3163('0xa'));var squel=require(_0x3163('0xb'));var crypto=require(_0x3163('0xc'));var jsforce=require(_0x3163('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3163('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3163('0xf'));var authService=require(_0x3163('0x10'));var qs=require(_0x3163('0x11'));var as=require(_0x3163('0x12'));var hardwareService=require(_0x3163('0x13'));var logger=require(_0x3163('0x14'))(_0x3163('0x15'));var utils=require(_0x3163('0x16'));var config=require(_0x3163('0x17'));var licenseUtil=require(_0x3163('0x18'));var db=require(_0x3163('0x19'))['db'];function respondWithStatusCode(_0x3f9d8d,_0x39f8d9){_0x39f8d9=_0x39f8d9||0xcc;return function(_0x38bc0e){if(_0x38bc0e){return _0x3f9d8d['sendStatus'](_0x39f8d9);}return _0x3f9d8d[_0x3163('0x1a')](_0x39f8d9)[_0x3163('0x1b')]();};}function respondWithResult(_0x1ab4d9,_0x4defb0){_0x4defb0=_0x4defb0||0xc8;return function(_0x5684d0){if(_0x5684d0){return _0x1ab4d9[_0x3163('0x1a')](_0x4defb0)['json'](_0x5684d0);}};}function respondWithFilteredResult(_0x131a86,_0x371231){return function(_0x576ee7){if(_0x576ee7){var _0x25f451=typeof _0x371231[_0x3163('0x1c')]===_0x3163('0x1d')&&typeof _0x371231[_0x3163('0x1e')]==='undefined';var _0x29629e=_0x576ee7['count'];var _0x539784=_0x25f451?0x0:_0x371231[_0x3163('0x1c')];var _0x16613a=_0x25f451?_0x576ee7[_0x3163('0x1f')]:_0x371231[_0x3163('0x1c')]+_0x371231[_0x3163('0x1e')];var _0x2218f8;if(_0x16613a>=_0x29629e){_0x16613a=_0x29629e;_0x2218f8=0xc8;}else{_0x2218f8=0xce;}_0x131a86['status'](_0x2218f8);return _0x131a86['set']('Content-Range',_0x539784+'-'+_0x16613a+'/'+_0x29629e)[_0x3163('0x20')](_0x576ee7);}return null;};}function patchUpdates(_0x5890a4){return function(_0x344a18){try{jsonpatch['apply'](_0x344a18,_0x5890a4,!![]);}catch(_0x2d6198){return BPromise[_0x3163('0x21')](_0x2d6198);}return _0x344a18[_0x3163('0x22')]();};}function saveUpdates(_0xc196db,_0x3694fc){return function(_0x3631cb){if(_0x3631cb){return _0x3631cb[_0x3163('0x23')](_0xc196db)[_0x3163('0x24')](function(_0x537087){return _0x537087;});}return null;};}function removeEntity(_0x504333,_0x8ca862){return function(_0x1f3bcd){if(_0x1f3bcd){return _0x1f3bcd['destroy']()['then'](function(){_0x504333[_0x3163('0x1a')](0xcc)[_0x3163('0x1b')]();});}};}function handleEntityNotFound(_0x59e921,_0x24f1f8){return function(_0x39009a){if(!_0x39009a){_0x59e921[_0x3163('0x25')](0x194);}return _0x39009a;};}function handleError(_0x424064,_0x125dca){_0x125dca=_0x125dca||0x1f4;return function(_0x4e472e){logger[_0x3163('0x26')](_0x4e472e[_0x3163('0x27')]);if(_0x4e472e['name']){delete _0x4e472e[_0x3163('0x28')];}_0x424064['status'](_0x125dca)[_0x3163('0x29')](_0x4e472e);};}exports[_0x3163('0x2a')]=function(_0x34b1d8,_0x406c79){var _0x14ab47={},_0x572d8a={},_0x6d7ad1={'count':0x0,'rows':[]};var _0x46395d=_['map'](db[_0x3163('0x2b')][_0x3163('0x2c')],function(_0x5787b5){return{'name':_0x5787b5[_0x3163('0x2d')],'type':_0x5787b5['type'][_0x3163('0x2e')]};});_0x572d8a['model']=_[_0x3163('0x2f')](_0x46395d,_0x3163('0x28'));_0x572d8a['query']=_[_0x3163('0x30')](_0x34b1d8[_0x3163('0x31')]);_0x572d8a[_0x3163('0x32')]=_[_0x3163('0x33')](_0x572d8a[_0x3163('0x34')],_0x572d8a[_0x3163('0x31')]);_0x14ab47[_0x3163('0x35')]=_[_0x3163('0x33')](_0x572d8a[_0x3163('0x34')],qs[_0x3163('0x36')](_0x34b1d8['query'][_0x3163('0x36')]));_0x14ab47[_0x3163('0x35')]=_0x14ab47[_0x3163('0x35')][_0x3163('0x37')]?_0x14ab47['attributes']:_0x572d8a[_0x3163('0x34')];if(!_0x34b1d8[_0x3163('0x31')]['hasOwnProperty'](_0x3163('0x38'))){_0x14ab47[_0x3163('0x1e')]=qs[_0x3163('0x1e')](_0x34b1d8[_0x3163('0x31')][_0x3163('0x1e')]);_0x14ab47['offset']=qs[_0x3163('0x1c')](_0x34b1d8[_0x3163('0x31')]['offset']);}_0x14ab47[_0x3163('0x39')]=qs[_0x3163('0x3a')](_0x34b1d8[_0x3163('0x31')]['sort']);_0x14ab47[_0x3163('0x3b')]=qs[_0x3163('0x32')](_['pick'](_0x34b1d8['query'],_0x572d8a[_0x3163('0x32')]),_0x46395d);if(_0x34b1d8[_0x3163('0x31')][_0x3163('0x3c')]){_0x14ab47[_0x3163('0x3b')]=_[_0x3163('0x3d')](_0x14ab47[_0x3163('0x3b')],{'$or':_[_0x3163('0x2f')](_0x46395d,function(_0x31876f){if(_0x31876f[_0x3163('0x3e')]!==_0x3163('0x3f')){var _0x5bf6da={};_0x5bf6da[_0x31876f[_0x3163('0x28')]]={'$like':'%'+_0x34b1d8[_0x3163('0x31')]['filter']+'%'};return _0x5bf6da;}})});}_0x14ab47=_[_0x3163('0x3d')]({},_0x14ab47,_0x34b1d8['options']);var _0x513aaf={'where':_0x14ab47[_0x3163('0x3b')]};return db[_0x3163('0x2b')][_0x3163('0x1f')](_0x513aaf)[_0x3163('0x24')](function(_0x20c9be){_0x6d7ad1[_0x3163('0x1f')]=_0x20c9be;if(_0x34b1d8[_0x3163('0x31')][_0x3163('0x40')]){_0x14ab47['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x3163('0x41')](_0x14ab47);})['then'](function(_0x438964){_0x6d7ad1[_0x3163('0x42')]=_0x438964;return _0x6d7ad1;})[_0x3163('0x24')](respondWithFilteredResult(_0x406c79,_0x14ab47))['catch'](handleError(_0x406c79,null));};exports[_0x3163('0x43')]=function(_0x261ad3,_0x3c34c2){var _0x5c38df={'raw':![],'where':{'id':_0x261ad3[_0x3163('0x44')]['id']}},_0x334fab={};_0x334fab[_0x3163('0x34')]=_[_0x3163('0x30')](db['AnalyticFieldReport'][_0x3163('0x2c')]);_0x334fab[_0x3163('0x31')]=_[_0x3163('0x30')](_0x261ad3[_0x3163('0x31')]);_0x334fab[_0x3163('0x32')]=_[_0x3163('0x33')](_0x334fab[_0x3163('0x34')],_0x334fab['query']);_0x5c38df['attributes']=_[_0x3163('0x33')](_0x334fab[_0x3163('0x34')],qs['fields'](_0x261ad3['query'][_0x3163('0x36')]));_0x5c38df['attributes']=_0x5c38df['attributes'][_0x3163('0x37')]?_0x5c38df[_0x3163('0x35')]:_0x334fab[_0x3163('0x34')];if(_0x261ad3[_0x3163('0x31')][_0x3163('0x40')]){_0x5c38df[_0x3163('0x45')]=[{'all':!![]}];}_0x5c38df=_[_0x3163('0x3d')]({},_0x5c38df,_0x261ad3[_0x3163('0x46')]);return db[_0x3163('0x2b')]['find'](_0x5c38df)[_0x3163('0x24')](handleEntityNotFound(_0x3c34c2,null))[_0x3163('0x24')](respondWithResult(_0x3c34c2,null))[_0x3163('0x47')](handleError(_0x3c34c2,null));};exports[_0x3163('0x48')]=function(_0x3bf0d7,_0x49e389){return db[_0x3163('0x2b')]['create'](_0x3bf0d7['body'],{})[_0x3163('0x24')](respondWithResult(_0x49e389,0xc9))[_0x3163('0x47')](handleError(_0x49e389,null));};exports[_0x3163('0x49')]=function(_0x12bd77,_0x9fbf4d){return db[_0x3163('0x2b')][_0x3163('0x49')](_0x12bd77['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x9fbf4d,0xc9))[_0x3163('0x47')](handleError(_0x9fbf4d,null));};exports[_0x3163('0x23')]=function(_0x39e601,_0x5ad0bc){if(_0x39e601[_0x3163('0x4a')]['id']){delete _0x39e601[_0x3163('0x4a')]['id'];}return db[_0x3163('0x2b')][_0x3163('0x4b')]({'where':{'id':_0x39e601[_0x3163('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ad0bc,null))[_0x3163('0x24')](saveUpdates(_0x39e601[_0x3163('0x4a')],null))['then'](respondWithResult(_0x5ad0bc,null))[_0x3163('0x47')](handleError(_0x5ad0bc,null));};exports['destroy']=function(_0x2d4383,_0x5820a7){return db['AnalyticFieldReport'][_0x3163('0x4b')]({'where':{'id':_0x2d4383[_0x3163('0x44')]['id']}})[_0x3163('0x24')](handleEntityNotFound(_0x5820a7,null))[_0x3163('0x24')](removeEntity(_0x5820a7,null))['catch'](handleError(_0x5820a7,null));};exports[_0x3163('0x4c')]=function(_0x17f9d3,_0x563556){return db[_0x3163('0x2b')]['destroy']({'where':{'id':_0x17f9d3['query'][_0x3163('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x3163('0x24')](respondWithResult(_0x563556,0xcc))[_0x3163('0x47')](handleError(_0x563556,null));};exports[_0x3163('0x4e')]=function(_0x34c704,_0x5e7661,_0xf3cda1){return db[_0x3163('0x4f')][_0x3163('0x50')]({'where':{'id':_0x34c704[_0x3163('0x44')]['id']}})[_0x3163('0x24')](handleEntityNotFound(_0x5e7661,null))[_0x3163('0x24')](function(_0x490c77){if(_0x490c77){return db['sequelize'][_0x3163('0x51')](function(_0x3c96dd){return db[_0x3163('0x2b')]['destroy']({'where':{'CustomReportId':_0x34c704[_0x3163('0x44')]['id']},'transaction':_0x3c96dd})[_0x3163('0x24')](function(_0x436669){var _0x1d1a11=_[_0x3163('0x2f')](_0x34c704[_0x3163('0x4a')],function(_0x27d83b){delete _0x27d83b['id'];_0x27d83b[_0x3163('0x52')]=_0x34c704[_0x3163('0x44')]['id'];return _0x27d83b;});return db[_0x3163('0x2b')][_0x3163('0x49')](_0x1d1a11,{'transaction':_0x3c96dd});});})[_0x3163('0x24')](function(){return db[_0x3163('0x2b')][_0x3163('0x41')]({'where':{'CustomReportId':_0x34c704[_0x3163('0x44')]['id']}});});}})[_0x3163('0x24')](respondWithResult(_0x5e7661,null))['catch'](handleError(_0x5e7661,null));}; \ No newline at end of file +var _0x3de0=['findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','error','name','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','include'];(function(_0x33f31b,_0x550ae9){var _0x33514e=function(_0x266538){while(--_0x266538){_0x33f31b['push'](_0x33f31b['shift']());}};_0x33514e(++_0x550ae9);}(_0x3de0,0x143));var _0x03de=function(_0x38ad8e,_0x33ebc2){_0x38ad8e=_0x38ad8e-0x0;var _0xe17df5=_0x3de0[_0x38ad8e];return _0xe17df5;};'use strict';var emlformat=require(_0x03de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03de('0x1'));var jsonpatch=require(_0x03de('0x2'));var rp=require('request-promise');var moment=require(_0x03de('0x3'));var BPromise=require(_0x03de('0x4'));var Mustache=require('mustache');var util=require(_0x03de('0x5'));var path=require(_0x03de('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x03de('0x7'));var fs=require('fs');var fs_extra=require(_0x03de('0x8'));var _=require(_0x03de('0x9'));var squel=require(_0x03de('0xa'));var crypto=require(_0x03de('0xb'));var jsforce=require(_0x03de('0xc'));var deskjs=require(_0x03de('0xd'));var toCsv=require(_0x03de('0xe'));var querystring=require('querystring');var Papa=require(_0x03de('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03de('0x10'));var as=require(_0x03de('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03de('0x12'))(_0x03de('0x13'));var utils=require('../../config/utils');var config=require(_0x03de('0x14'));var licenseUtil=require(_0x03de('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d6629,_0x10ab8b){_0x10ab8b=_0x10ab8b||0xcc;return function(_0x40dd5d){if(_0x40dd5d){return _0x3d6629[_0x03de('0x16')](_0x10ab8b);}return _0x3d6629[_0x03de('0x17')](_0x10ab8b)['end']();};}function respondWithResult(_0xf9553d,_0x1b467e){_0x1b467e=_0x1b467e||0xc8;return function(_0x14d19c){if(_0x14d19c){return _0xf9553d[_0x03de('0x17')](_0x1b467e)['json'](_0x14d19c);}};}function respondWithFilteredResult(_0x453564,_0xedbc6b){return function(_0x1aa88d){if(_0x1aa88d){var _0x45881e=typeof _0xedbc6b[_0x03de('0x18')]===_0x03de('0x19')&&typeof _0xedbc6b[_0x03de('0x1a')]===_0x03de('0x19');var _0x313a71=_0x1aa88d['count'];var _0x4835c0=_0x45881e?0x0:_0xedbc6b[_0x03de('0x18')];var _0x42962e=_0x45881e?_0x1aa88d[_0x03de('0x1b')]:_0xedbc6b['offset']+_0xedbc6b[_0x03de('0x1a')];var _0x5f6058;if(_0x42962e>=_0x313a71){_0x42962e=_0x313a71;_0x5f6058=0xc8;}else{_0x5f6058=0xce;}_0x453564[_0x03de('0x17')](_0x5f6058);return _0x453564[_0x03de('0x1c')](_0x03de('0x1d'),_0x4835c0+'-'+_0x42962e+'/'+_0x313a71)[_0x03de('0x1e')](_0x1aa88d);}return null;};}function patchUpdates(_0x3cb6ff){return function(_0x5cb66b){try{jsonpatch['apply'](_0x5cb66b,_0x3cb6ff,!![]);}catch(_0x528862){return BPromise[_0x03de('0x1f')](_0x528862);}return _0x5cb66b[_0x03de('0x20')]();};}function saveUpdates(_0x512d82,_0x12337f){return function(_0x4447d7){if(_0x4447d7){return _0x4447d7[_0x03de('0x21')](_0x512d82)['then'](function(_0x23e463){return _0x23e463;});}return null;};}function removeEntity(_0x396a57,_0x5f2317){return function(_0x13fb22){if(_0x13fb22){return _0x13fb22[_0x03de('0x22')]()[_0x03de('0x23')](function(){_0x396a57[_0x03de('0x17')](0xcc)[_0x03de('0x24')]();});}};}function handleEntityNotFound(_0x54b4fc,_0xf54687){return function(_0x13ab64){if(!_0x13ab64){_0x54b4fc[_0x03de('0x16')](0x194);}return _0x13ab64;};}function handleError(_0x1ed415,_0x5a9631){_0x5a9631=_0x5a9631||0x1f4;return function(_0x14e785){logger[_0x03de('0x25')](_0x14e785['stack']);if(_0x14e785['name']){delete _0x14e785[_0x03de('0x26')];}_0x1ed415[_0x03de('0x17')](_0x5a9631)['send'](_0x14e785);};}exports['index']=function(_0x261b19,_0x17463b){var _0x514232={},_0x405c25={},_0x270b75={'count':0x0,'rows':[]};var _0x25f7bf=_[_0x03de('0x27')](db['AnalyticFieldReport']['rawAttributes'],function(_0x191534){return{'name':_0x191534[_0x03de('0x28')],'type':_0x191534[_0x03de('0x29')][_0x03de('0x2a')]};});_0x405c25[_0x03de('0x2b')]=_[_0x03de('0x27')](_0x25f7bf,'name');_0x405c25[_0x03de('0x2c')]=_[_0x03de('0x2d')](_0x261b19[_0x03de('0x2c')]);_0x405c25[_0x03de('0x2e')]=_[_0x03de('0x2f')](_0x405c25[_0x03de('0x2b')],_0x405c25['query']);_0x514232[_0x03de('0x30')]=_[_0x03de('0x2f')](_0x405c25['model'],qs[_0x03de('0x31')](_0x261b19[_0x03de('0x2c')][_0x03de('0x31')]));_0x514232[_0x03de('0x30')]=_0x514232['attributes'][_0x03de('0x32')]?_0x514232[_0x03de('0x30')]:_0x405c25[_0x03de('0x2b')];if(!_0x261b19[_0x03de('0x2c')]['hasOwnProperty'](_0x03de('0x33'))){_0x514232[_0x03de('0x1a')]=qs[_0x03de('0x1a')](_0x261b19['query'][_0x03de('0x1a')]);_0x514232[_0x03de('0x18')]=qs[_0x03de('0x18')](_0x261b19[_0x03de('0x2c')][_0x03de('0x18')]);}_0x514232[_0x03de('0x34')]=qs[_0x03de('0x35')](_0x261b19['query'][_0x03de('0x35')]);_0x514232[_0x03de('0x36')]=qs['filters'](_['pick'](_0x261b19[_0x03de('0x2c')],_0x405c25[_0x03de('0x2e')]),_0x25f7bf);if(_0x261b19[_0x03de('0x2c')][_0x03de('0x37')]){_0x514232[_0x03de('0x36')]=_[_0x03de('0x38')](_0x514232[_0x03de('0x36')],{'$or':_[_0x03de('0x27')](_0x25f7bf,function(_0x294c92){if(_0x294c92[_0x03de('0x29')]!==_0x03de('0x39')){var _0x43b642={};_0x43b642[_0x294c92[_0x03de('0x26')]]={'$like':'%'+_0x261b19[_0x03de('0x2c')][_0x03de('0x37')]+'%'};return _0x43b642;}})});}_0x514232=_[_0x03de('0x38')]({},_0x514232,_0x261b19[_0x03de('0x3a')]);var _0x305187={'where':_0x514232[_0x03de('0x36')]};return db[_0x03de('0x3b')]['count'](_0x305187)[_0x03de('0x23')](function(_0x2b2dc3){_0x270b75['count']=_0x2b2dc3;if(_0x261b19[_0x03de('0x2c')][_0x03de('0x3c')]){_0x514232[_0x03de('0x3d')]=[{'all':!![]}];}return db[_0x03de('0x3b')][_0x03de('0x3e')](_0x514232);})[_0x03de('0x23')](function(_0x4053c1){_0x270b75[_0x03de('0x3f')]=_0x4053c1;return _0x270b75;})['then'](respondWithFilteredResult(_0x17463b,_0x514232))[_0x03de('0x40')](handleError(_0x17463b,null));};exports[_0x03de('0x41')]=function(_0x45615f,_0x1b62ee){var _0x373db0={'raw':![],'where':{'id':_0x45615f[_0x03de('0x42')]['id']}},_0x42dfd0={};_0x42dfd0[_0x03de('0x2b')]=_['keys'](db[_0x03de('0x3b')]['rawAttributes']);_0x42dfd0['query']=_[_0x03de('0x2d')](_0x45615f[_0x03de('0x2c')]);_0x42dfd0[_0x03de('0x2e')]=_['intersection'](_0x42dfd0['model'],_0x42dfd0[_0x03de('0x2c')]);_0x373db0[_0x03de('0x30')]=_[_0x03de('0x2f')](_0x42dfd0[_0x03de('0x2b')],qs['fields'](_0x45615f[_0x03de('0x2c')]['fields']));_0x373db0[_0x03de('0x30')]=_0x373db0[_0x03de('0x30')][_0x03de('0x32')]?_0x373db0[_0x03de('0x30')]:_0x42dfd0[_0x03de('0x2b')];if(_0x45615f[_0x03de('0x2c')]['includeAll']){_0x373db0[_0x03de('0x3d')]=[{'all':!![]}];}_0x373db0=_['merge']({},_0x373db0,_0x45615f[_0x03de('0x3a')]);return db['AnalyticFieldReport'][_0x03de('0x43')](_0x373db0)[_0x03de('0x23')](handleEntityNotFound(_0x1b62ee,null))[_0x03de('0x23')](respondWithResult(_0x1b62ee,null))['catch'](handleError(_0x1b62ee,null));};exports['create']=function(_0x393d69,_0x1bd748){return db[_0x03de('0x3b')][_0x03de('0x44')](_0x393d69[_0x03de('0x45')],{})[_0x03de('0x23')](respondWithResult(_0x1bd748,0xc9))[_0x03de('0x40')](handleError(_0x1bd748,null));};exports['bulkCreate']=function(_0x2ae2c6,_0x1b6c6e){return db['AnalyticFieldReport'][_0x03de('0x46')](_0x2ae2c6[_0x03de('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1b6c6e,0xc9))[_0x03de('0x40')](handleError(_0x1b6c6e,null));};exports[_0x03de('0x21')]=function(_0x4e4f13,_0x2eef5b){if(_0x4e4f13['body']['id']){delete _0x4e4f13['body']['id'];}return db[_0x03de('0x3b')][_0x03de('0x43')]({'where':{'id':_0x4e4f13[_0x03de('0x42')]['id']}})[_0x03de('0x23')](handleEntityNotFound(_0x2eef5b,null))[_0x03de('0x23')](saveUpdates(_0x4e4f13['body'],null))['then'](respondWithResult(_0x2eef5b,null))[_0x03de('0x40')](handleError(_0x2eef5b,null));};exports['destroy']=function(_0x4df110,_0x154cc6){return db['AnalyticFieldReport'][_0x03de('0x43')]({'where':{'id':_0x4df110[_0x03de('0x42')]['id']}})[_0x03de('0x23')](handleEntityNotFound(_0x154cc6,null))['then'](removeEntity(_0x154cc6,null))[_0x03de('0x40')](handleError(_0x154cc6,null));};exports[_0x03de('0x47')]=function(_0x4921f9,_0x2124e2){return db[_0x03de('0x3b')]['destroy']({'where':{'id':_0x4921f9[_0x03de('0x2c')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x03de('0x23')](respondWithResult(_0x2124e2,0xcc))[_0x03de('0x40')](handleError(_0x2124e2,null));};exports[_0x03de('0x48')]=function(_0x312c9a,_0x23fb43,_0x3cc009){return db[_0x03de('0x49')][_0x03de('0x4a')]({'where':{'id':_0x312c9a['params']['id']}})['then'](handleEntityNotFound(_0x23fb43,null))[_0x03de('0x23')](function(_0x33b7ea){if(_0x33b7ea){return db[_0x03de('0x4b')]['transaction'](function(_0x2dfed6){return db[_0x03de('0x3b')]['destroy']({'where':{'CustomReportId':_0x312c9a['params']['id']},'transaction':_0x2dfed6})[_0x03de('0x23')](function(_0x5d33fb){var _0x20f0c4=_[_0x03de('0x27')](_0x312c9a[_0x03de('0x45')],function(_0x48debe){delete _0x48debe['id'];_0x48debe[_0x03de('0x4c')]=_0x312c9a[_0x03de('0x42')]['id'];return _0x48debe;});return db['AnalyticFieldReport'][_0x03de('0x46')](_0x20f0c4,{'transaction':_0x2dfed6});});})[_0x03de('0x23')](function(){return db[_0x03de('0x3b')]['findAll']({'where':{'CustomReportId':_0x312c9a[_0x03de('0x42')]['id']}});});}})['then'](respondWithResult(_0x23fb43,null))[_0x03de('0x40')](handleError(_0x23fb43,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 92cc198..8fa0d64 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.model.js +++ b/server/api/analyticFieldReport/analyticFieldReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf195=['api','request-promise','path','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger'];(function(_0x30a2d6,_0x43201d){var _0x10bff2=function(_0x1eee56){while(--_0x1eee56){_0x30a2d6['push'](_0x30a2d6['shift']());}};_0x10bff2(++_0x43201d);}(_0xf195,0xd0));var _0x5f19=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xf195[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require(_0x5f19('0x0'));var util=require('util');var logger=require(_0x5f19('0x1'))(_0x5f19('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f19('0x3'));var fs=require('fs');var path=require(_0x5f19('0x4'));var rimraf=require('rimraf');var config=require(_0x5f19('0x5'));var attributes=require(_0x5f19('0x6'));module['exports']=function(_0x243370,_0xf554d5){return _0x243370[_0x5f19('0x7')](_0x5f19('0x8'),attributes,{'tableName':_0x5f19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0762=['request-promise','path','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','bluebird'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0x0762,0x8b));var _0x2076=function(_0x3ed02b,_0x54a618){_0x3ed02b=_0x3ed02b-0x0;var _0x54fccf=_0x0762[_0x3ed02b];return _0x54fccf;};'use strict';var _=require(_0x2076('0x0'));var util=require(_0x2076('0x1'));var logger=require('../../config/logger')(_0x2076('0x2'));var moment=require('moment');var BPromise=require(_0x2076('0x3'));var rp=require(_0x2076('0x4'));var fs=require('fs');var path=require(_0x2076('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2076('0x6'));module[_0x2076('0x7')]=function(_0x525c3b,_0x232a80){return _0x525c3b[_0x2076('0x8')](_0x2076('0x9'),attributes,{'tableName':_0x2076('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index b9c7cbd..3cf0e15 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.rpc.js +++ b/server/api/analyticFieldReport/analyticFieldReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25d3=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x7058e5,_0x4304b8){var _0xcadefd=function(_0x105666){while(--_0x105666){_0x7058e5['push'](_0x7058e5['shift']());}};_0xcadefd(++_0x4304b8);}(_0x25d3,0x1b7));var _0x325d=function(_0x20365c,_0x25227d){_0x20365c=_0x20365c-0x0;var _0x5df8ba=_0x25d3[_0x20365c];return _0x5df8ba;};'use strict';var _=require(_0x325d('0x0'));var util=require(_0x325d('0x1'));var moment=require(_0x325d('0x2'));var BPromise=require(_0x325d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x325d('0x4'));var db=require(_0x325d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x325d('0x6'))(_0x325d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x325d('0x8')][_0x325d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x236ee2,_0x165a3c,_0x318b56){return new BPromise(function(_0x161acb,_0x3efc86){return client[_0x325d('0xa')](_0x236ee2,_0x318b56)[_0x325d('0xb')](function(_0x163c2b){logger[_0x325d('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x165a3c,_0x325d('0xd'));logger[_0x325d('0xe')](_0x325d('0xf'),_0x165a3c,_0x325d('0xd'),JSON['stringify'](_0x163c2b));if(_0x163c2b[_0x325d('0x10')]){if(_0x163c2b[_0x325d('0x10')][_0x325d('0x11')]===0x1f4){logger['error'](_0x325d('0x12'),_0x165a3c,_0x163c2b['error'][_0x325d('0x13')]);return _0x3efc86(_0x163c2b[_0x325d('0x10')][_0x325d('0x13')]);}logger['error'](_0x325d('0x12'),_0x165a3c,_0x163c2b[_0x325d('0x10')][_0x325d('0x13')]);return _0x161acb(_0x163c2b[_0x325d('0x10')][_0x325d('0x13')]);}else{logger[_0x325d('0xc')](_0x325d('0x12'),_0x165a3c,_0x325d('0xd'));_0x161acb(_0x163c2b['result'][_0x325d('0x13')]);}})[_0x325d('0x14')](function(_0x586194){logger['error'](_0x325d('0x12'),_0x165a3c,_0x586194);_0x3efc86(_0x586194);});});} \ No newline at end of file +var _0xe512=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x3c719c,_0x29afd9){var _0x160782=function(_0x317dc4){while(--_0x317dc4){_0x3c719c['push'](_0x3c719c['shift']());}};_0x160782(++_0x29afd9);}(_0xe512,0x17e));var _0x2e51=function(_0x4deb98,_0x29ebdd){_0x4deb98=_0x4deb98-0x0;var _0x2c5f93=_0xe512[_0x4deb98];return _0x2c5f93;};'use strict';var _=require(_0x2e51('0x0'));var util=require('util');var moment=require(_0x2e51('0x1'));var BPromise=require(_0x2e51('0x2'));var rs=require(_0x2e51('0x3'));var fs=require('fs');var Redis=require(_0x2e51('0x4'));var db=require(_0x2e51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e51('0x6'))(_0x2e51('0x7'));var config=require(_0x2e51('0x8'));var jayson=require(_0x2e51('0x9'));var client=jayson[_0x2e51('0xa')][_0x2e51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ddd57,_0x4123a4,_0x77809){return new BPromise(function(_0x2758e4,_0x5d32f9){return client[_0x2e51('0xc')](_0x3ddd57,_0x77809)[_0x2e51('0xd')](function(_0x4863e7){logger['info'](_0x2e51('0xe'),_0x4123a4,_0x2e51('0xf'));logger['debug'](_0x2e51('0x10'),_0x4123a4,_0x2e51('0xf'),JSON[_0x2e51('0x11')](_0x4863e7));if(_0x4863e7[_0x2e51('0x12')]){if(_0x4863e7['error'][_0x2e51('0x13')]===0x1f4){logger[_0x2e51('0x12')](_0x2e51('0xe'),_0x4123a4,_0x4863e7[_0x2e51('0x12')]['message']);return _0x5d32f9(_0x4863e7['error'][_0x2e51('0x14')]);}logger['error'](_0x2e51('0xe'),_0x4123a4,_0x4863e7[_0x2e51('0x12')][_0x2e51('0x14')]);return _0x2758e4(_0x4863e7[_0x2e51('0x12')]['message']);}else{logger[_0x2e51('0x15')](_0x2e51('0xe'),_0x4123a4,_0x2e51('0xf'));_0x2758e4(_0x4863e7[_0x2e51('0x16')][_0x2e51('0x14')]);}})[_0x2e51('0x17')](function(_0x4f9643){logger[_0x2e51('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4123a4,_0x4f9643);_0x5d32f9(_0x4f9643);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1509918..c0a417c 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0xa059ea,_0x5cb91e){var _0x156a4c=function(_0x1b4717){while(--_0x1b4717){_0xa059ea['push'](_0xa059ea['shift']());}};_0x156a4c(++_0x5cb91e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x26ed80,_0x5b73b6){var _0x2175c6=function(_0x191fc3){while(--_0x191fc3){_0x26ed80['push'](_0x26ed80['shift']());}};_0x2175c6(++_0x5b73b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index f19afc7..9d9b8eb 100644 --- a/server/api/analyticMetric/analyticMetric.attributes.js +++ b/server/api/analyticMetric/analyticMetric.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['name','TEXT','sequelize','exports','STRING'];(function(_0x270323,_0x72160){var _0x48a027=function(_0x4cb12e){while(--_0x4cb12e){_0x270323['push'](_0x270323['shift']());}};_0x48a027(++_0x72160);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x37065a,_0xd1f059){_0x37065a=_0x37065a-0x0;var _0x293d11=_0xbdb7[_0x37065a];return _0x293d11;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'unique':_0x7bdb('0x3')},'table':{'type':Sequelize[_0x7bdb('0x2')]},'metric':{'type':Sequelize[_0x7bdb('0x4')]},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file +var _0x48bc=['STRING','TEXT','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x48bc,0x1b6));var _0xc48b=function(_0x27717f,_0x528231){_0x27717f=_0x27717f-0x0;var _0x999d8c=_0x48bc[_0x27717f];return _0x999d8c;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'name':{'type':Sequelize[_0xc48b('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xc48b('0x2')]},'metric':{'type':Sequelize[_0xc48b('0x3')]},'description':{'type':Sequelize[_0xc48b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index bff8ca2..2b2909c 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','options','where','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','get','Metrics','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7da7,0x10d));var _0x77da=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x7da7[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){var _0x4885ec=_0x270318[_0x77da('0x23')]({'plain':!![]});var _0x2d009f=_0x77da('0x24');return db[_0x77da('0x25')]['destroy']({'where':{'type':_0x2d009f,'resourceId':_0x4885ec['id']}})[_0x77da('0x21')](function(){return _0x270318;});})[_0x77da('0x21')](function(){_0x27b6c7[_0x77da('0x18')](0xcc)[_0x77da('0x26')]();});}};}function handleEntityNotFound(_0x446ae7,_0x5997b6){return function(_0xce24b8){if(!_0xce24b8){_0x446ae7[_0x77da('0x17')](0x194);}return _0xce24b8;};}function handleError(_0x1f2279,_0x2913f7){_0x2913f7=_0x2913f7||0x1f4;return function(_0x496ecd){logger['error'](_0x496ecd['stack']);if(_0x496ecd[_0x77da('0x27')]){delete _0x496ecd[_0x77da('0x27')];}_0x1f2279[_0x77da('0x18')](_0x2913f7)[_0x77da('0x28')](_0x496ecd);};}exports[_0x77da('0x29')]=function(_0x4eeb99,_0x350b4e){var _0x26f5a0={},_0x356bfb={},_0x1d381b={'count':0x0,'rows':[]};var _0x1e7853=_[_0x77da('0x2a')](db['AnalyticMetric'][_0x77da('0x2b')],function(_0x228851){return{'name':_0x228851[_0x77da('0x2c')],'type':_0x228851[_0x77da('0x2d')][_0x77da('0x2e')]};});_0x356bfb[_0x77da('0x2f')]=_[_0x77da('0x2a')](_0x1e7853,_0x77da('0x27'));_0x356bfb['query']=_['keys'](_0x4eeb99[_0x77da('0x30')]);_0x356bfb[_0x77da('0x31')]=_['intersection'](_0x356bfb[_0x77da('0x2f')],_0x356bfb[_0x77da('0x30')]);_0x26f5a0[_0x77da('0x32')]=_[_0x77da('0x33')](_0x356bfb[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x4eeb99[_0x77da('0x30')]['fields']));_0x26f5a0[_0x77da('0x32')]=_0x26f5a0['attributes']['length']?_0x26f5a0['attributes']:_0x356bfb[_0x77da('0x2f')];if(!_0x4eeb99['query'][_0x77da('0x35')](_0x77da('0x36'))){_0x26f5a0[_0x77da('0x1c')]=qs[_0x77da('0x1c')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x1c')]);_0x26f5a0[_0x77da('0x19')]=qs['offset'](_0x4eeb99[_0x77da('0x30')][_0x77da('0x19')]);}_0x26f5a0[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x4eeb99[_0x77da('0x30')][_0x77da('0x38')]);_0x26f5a0['where']=qs[_0x77da('0x31')](_[_0x77da('0x39')](_0x4eeb99[_0x77da('0x30')],_0x356bfb['filters']),_0x1e7853);if(_0x4eeb99[_0x77da('0x30')]['filter']){_0x26f5a0['where']=_['merge'](_0x26f5a0['where'],{'$or':_[_0x77da('0x2a')](_0x1e7853,function(_0x1adba5){if(_0x1adba5[_0x77da('0x2d')]!=='VIRTUAL'){var _0x21d337={};_0x21d337[_0x1adba5['name']]={'$like':'%'+_0x4eeb99[_0x77da('0x30')]['filter']+'%'};return _0x21d337;}})});}_0x26f5a0=_[_0x77da('0x3a')]({},_0x26f5a0,_0x4eeb99[_0x77da('0x3b')]);var _0x290667={'where':_0x26f5a0[_0x77da('0x3c')]};return db[_0x77da('0x3d')]['count'](_0x290667)[_0x77da('0x21')](function(_0x1f48bd){_0x1d381b[_0x77da('0x1b')]=_0x1f48bd;if(_0x4eeb99[_0x77da('0x30')][_0x77da('0x3e')]){_0x26f5a0[_0x77da('0x3f')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x77da('0x40')](_0x26f5a0);})[_0x77da('0x21')](function(_0x21de41){_0x1d381b[_0x77da('0x41')]=_0x21de41;return _0x1d381b;})[_0x77da('0x21')](respondWithFilteredResult(_0x350b4e,_0x26f5a0))[_0x77da('0x42')](handleError(_0x350b4e,null));};exports['show']=function(_0x10957b,_0x5abcd9){var _0x1ae806={'raw':!![],'where':{'id':_0x10957b[_0x77da('0x43')]['id']}},_0x373fb2={};_0x373fb2['model']=_[_0x77da('0x44')](db[_0x77da('0x3d')][_0x77da('0x2b')]);_0x373fb2[_0x77da('0x30')]=_[_0x77da('0x44')](_0x10957b[_0x77da('0x30')]);_0x373fb2[_0x77da('0x31')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],_0x373fb2['query']);_0x1ae806[_0x77da('0x32')]=_[_0x77da('0x33')](_0x373fb2[_0x77da('0x2f')],qs[_0x77da('0x34')](_0x10957b[_0x77da('0x30')][_0x77da('0x34')]));_0x1ae806['attributes']=_0x1ae806['attributes'][_0x77da('0x45')]?_0x1ae806[_0x77da('0x32')]:_0x373fb2[_0x77da('0x2f')];if(_0x10957b[_0x77da('0x30')][_0x77da('0x3e')]){_0x1ae806[_0x77da('0x3f')]=[{'all':!![]}];}_0x1ae806=_['merge']({},_0x1ae806,_0x10957b[_0x77da('0x3b')]);return db[_0x77da('0x3d')][_0x77da('0x46')](_0x1ae806)[_0x77da('0x21')](handleEntityNotFound(_0x5abcd9,null))['then'](respondWithResult(_0x5abcd9,null))[_0x77da('0x42')](handleError(_0x5abcd9,null));};exports['create']=function(_0x518fd5,_0x36263b){return db[_0x77da('0x3d')][_0x77da('0x47')](_0x518fd5[_0x77da('0x48')],{})['then'](function(_0x16bf4b){var _0x1e36ee=_0x518fd5['user'][_0x77da('0x23')]({'plain':!![]});if(!_0x1e36ee)throw new Error(_0x77da('0x49'));if(_0x1e36ee['role']===_0x77da('0x4a')){var _0x3aaf5b=_0x16bf4b[_0x77da('0x23')]({'plain':!![]});var _0xef2496=_0x77da('0x24');return db[_0x77da('0x4b')][_0x77da('0x46')]({'where':{'name':_0xef2496,'userProfileId':_0x1e36ee[_0x77da('0x4c')]},'raw':!![]})[_0x77da('0x21')](function(_0x3a34a8){if(_0x3a34a8&&_0x3a34a8['autoAssociation']===0x0){return db[_0x77da('0x25')]['create']({'name':_0x3aaf5b[_0x77da('0x27')],'resourceId':_0x3aaf5b['id'],'type':_0x3a34a8[_0x77da('0x27')],'sectionId':_0x3a34a8['id']},{})[_0x77da('0x21')](function(){return _0x16bf4b;});}else{return _0x16bf4b;}})[_0x77da('0x42')](function(_0x374179){logger[_0x77da('0x4d')](_0x77da('0x4e'),_0x374179);throw _0x374179;});}return _0x16bf4b;})['then'](respondWithResult(_0x36263b,0xc9))[_0x77da('0x42')](handleError(_0x36263b,null));};exports[_0x77da('0x20')]=function(_0x1a7115,_0x353be9){if(_0x1a7115['body']['id']){delete _0x1a7115[_0x77da('0x48')]['id'];}return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x1a7115['params']['id']}})['then'](handleEntityNotFound(_0x353be9,null))[_0x77da('0x21')](saveUpdates(_0x1a7115[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x353be9,null))[_0x77da('0x42')](handleError(_0x353be9,null));};exports[_0x77da('0x22')]=function(_0x528a32,_0x50437b){return db[_0x77da('0x3d')][_0x77da('0x46')]({'where':{'id':_0x528a32['params']['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x50437b,null))[_0x77da('0x21')](removeEntity(_0x50437b,null))[_0x77da('0x42')](handleError(_0x50437b,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x544ffc,_0x5d702a){var _0x1edd96=function(_0x476c4b){while(--_0x476c4b){_0x544ffc['push'](_0x544ffc['shift']());}};_0x1edd96(++_0x5d702a);}(_0x55ca,0x126));var _0xa55c=function(_0x11bc40,_0x537bbc){_0x11bc40=_0x11bc40-0x0;var _0x2b7a99=_0x55ca[_0x11bc40];return _0x2b7a99;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 831a411..89f0941 100644 --- a/server/api/analyticMetric/analyticMetric.model.js +++ b/server/api/analyticMetric/analyticMetric.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6299=['analytics_metrics','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x4c619b,_0x28457f){var _0x39e0fd=function(_0x6436fd){while(--_0x6436fd){_0x4c619b['push'](_0x4c619b['shift']());}};_0x39e0fd(++_0x28457f);}(_0x6299,0x169));var _0x9629=function(_0x2c5238,_0x15312b){_0x2c5238=_0x2c5238-0x0;var _0x392df2=_0x6299[_0x2c5238];return _0x392df2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9629('0x0'))(_0x9629('0x1'));var moment=require(_0x9629('0x2'));var BPromise=require(_0x9629('0x3'));var rp=require(_0x9629('0x4'));var fs=require('fs');var path=require(_0x9629('0x5'));var rimraf=require('rimraf');var config=require(_0x9629('0x6'));var attributes=require(_0x9629('0x7'));module[_0x9629('0x8')]=function(_0x1edc13,_0x1206bf){return _0x1edc13['define']('AnalyticMetric',attributes,{'tableName':_0x9629('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x297f=['analytics_metrics','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x189684,_0xcdee06){var _0x187830=function(_0x465763){while(--_0x465763){_0x189684['push'](_0x189684['shift']());}};_0x187830(++_0xcdee06);}(_0x297f,0x1f0));var _0xf297=function(_0x54cda1,_0x1fc425){_0x54cda1=_0x54cda1-0x0;var _0x3e0f18=_0x297f[_0x54cda1];return _0x3e0f18;};'use strict';var _=require(_0xf297('0x0'));var util=require(_0xf297('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf297('0x2'));var BPromise=require(_0xf297('0x3'));var rp=require(_0xf297('0x4'));var fs=require('fs');var path=require(_0xf297('0x5'));var rimraf=require('rimraf');var config=require(_0xf297('0x6'));var attributes=require('./analyticMetric.attributes');module[_0xf297('0x7')]=function(_0x353e78,_0x2282eb){return _0x353e78['define']('AnalyticMetric',attributes,{'tableName':_0xf297('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index fdbc43c..b4ab8cb 100644 --- a/server/api/analyticMetric/analyticMetric.rpc.js +++ b/server/api/analyticMetric/analyticMetric.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf118=['../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ebe76,_0x590dfc){var _0x2d0fdd=function(_0x5ef78e){while(--_0x5ef78e){_0x5ebe76['push'](_0x5ebe76['shift']());}};_0x2d0fdd(++_0x590dfc);}(_0xf118,0x116));var _0x8f11=function(_0xce3d93,_0x504f1c){_0xce3d93=_0xce3d93-0x0;var _0x16bcf8=_0xf118[_0xce3d93];return _0x16bcf8;};'use strict';var _=require(_0x8f11('0x0'));var util=require(_0x8f11('0x1'));var moment=require(_0x8f11('0x2'));var BPromise=require(_0x8f11('0x3'));var rs=require(_0x8f11('0x4'));var fs=require('fs');var Redis=require(_0x8f11('0x5'));var db=require(_0x8f11('0x6'))['db'];var utils=require(_0x8f11('0x7'));var logger=require(_0x8f11('0x8'))(_0x8f11('0x9'));var config=require(_0x8f11('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8f11('0xb')][_0x8f11('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x542890,_0xc1041a,_0x312d7f){return new BPromise(function(_0x55de07,_0x21b42c){return client[_0x8f11('0xd')](_0x542890,_0x312d7f)[_0x8f11('0xe')](function(_0x3bec4d){logger['info'](_0x8f11('0xf'),_0xc1041a,_0x8f11('0x10'));logger[_0x8f11('0x11')](_0x8f11('0x12'),_0xc1041a,_0x8f11('0x10'),JSON[_0x8f11('0x13')](_0x3bec4d));if(_0x3bec4d[_0x8f11('0x14')]){if(_0x3bec4d['error'][_0x8f11('0x15')]===0x1f4){logger['error'](_0x8f11('0xf'),_0xc1041a,_0x3bec4d[_0x8f11('0x14')]['message']);return _0x21b42c(_0x3bec4d['error'][_0x8f11('0x16')]);}logger[_0x8f11('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0xc1041a,_0x3bec4d[_0x8f11('0x14')][_0x8f11('0x16')]);return _0x55de07(_0x3bec4d[_0x8f11('0x14')]['message']);}else{logger[_0x8f11('0x17')](_0x8f11('0xf'),_0xc1041a,_0x8f11('0x10'));_0x55de07(_0x3bec4d[_0x8f11('0x18')][_0x8f11('0x16')]);}})[_0x8f11('0x19')](function(_0x183c98){logger[_0x8f11('0x14')](_0x8f11('0xf'),_0xc1041a,_0x183c98);_0x21b42c(_0x183c98);});});} \ No newline at end of file +var _0x4931=['error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b1e69,_0x2af64c){var _0x37f2ea=function(_0x20dc0e){while(--_0x20dc0e){_0x1b1e69['push'](_0x1b1e69['shift']());}};_0x37f2ea(++_0x2af64c);}(_0x4931,0x148));var _0x1493=function(_0x197d97,_0x3992ff){_0x197d97=_0x197d97-0x0;var _0x42ab81=_0x4931[_0x197d97];return _0x42ab81;};'use strict';var _=require(_0x1493('0x0'));var util=require(_0x1493('0x1'));var moment=require(_0x1493('0x2'));var BPromise=require(_0x1493('0x3'));var rs=require(_0x1493('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1493('0x5'));var logger=require(_0x1493('0x6'))(_0x1493('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1493('0x8')][_0x1493('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57cb1d,_0x46b5a5,_0x5c0798){return new BPromise(function(_0x2b975b,_0xf46338){return client[_0x1493('0xa')](_0x57cb1d,_0x5c0798)[_0x1493('0xb')](function(_0x49a385){logger[_0x1493('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x46b5a5,_0x1493('0xd'));logger[_0x1493('0xe')](_0x1493('0xf'),_0x46b5a5,'request\x20sent',JSON[_0x1493('0x10')](_0x49a385));if(_0x49a385[_0x1493('0x11')]){if(_0x49a385[_0x1493('0x11')][_0x1493('0x12')]===0x1f4){logger['error'](_0x1493('0x13'),_0x46b5a5,_0x49a385['error']['message']);return _0xf46338(_0x49a385[_0x1493('0x11')][_0x1493('0x14')]);}logger['error'](_0x1493('0x13'),_0x46b5a5,_0x49a385[_0x1493('0x11')][_0x1493('0x14')]);return _0x2b975b(_0x49a385[_0x1493('0x11')][_0x1493('0x14')]);}else{logger['info'](_0x1493('0x13'),_0x46b5a5,'request\x20sent');_0x2b975b(_0x49a385[_0x1493('0x15')]['message']);}})[_0x1493('0x16')](function(_0x58231f){logger[_0x1493('0x11')](_0x1493('0x13'),_0x46b5a5,_0x58231f);_0xf46338(_0x58231f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 173ac63..06c0e02 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf52f=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x19e9fa,_0x512f17){var _0x4e7f68=function(_0x5b5e49){while(--_0x5b5e49){_0x19e9fa['push'](_0x19e9fa['shift']());}};_0x4e7f68(++_0x512f17);}(_0xf52f,0x113));var _0xff52=function(_0x365dbe,_0x4d3979){_0x365dbe=_0x365dbe-0x0;var _0xaa71bb=_0xf52f[_0x365dbe];return _0xaa71bb;};'use strict';var multer=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var path=require(_0xff52('0x2'));var timeout=require('connect-timeout');var express=require(_0xff52('0x3'));var router=express[_0xff52('0x4')]();var fs_extra=require(_0xff52('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xff52('0x6'));var config=require(_0xff52('0x7'));var controller=require('./analyticMetric.controller');router[_0xff52('0x8')]('/',auth[_0xff52('0x9')](),controller[_0xff52('0xa')]);router[_0xff52('0x8')](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0xc')]);router[_0xff52('0xd')]('/',auth[_0xff52('0x9')](),controller[_0xff52('0xe')]);router[_0xff52('0xf')](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0x10')]);router[_0xff52('0x11')](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0x12')]);module[_0xff52('0x13')]=router; \ No newline at end of file +var _0xe5e0=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','/:id','show'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x1d3ea0,_0x12025c){_0x1d3ea0=_0x1d3ea0-0x0;var _0x384cd7=_0xe5e0[_0x1d3ea0];return _0x384cd7;};'use strict';var multer=require(_0x0e5e('0x0'));var util=require(_0x0e5e('0x1'));var path=require(_0x0e5e('0x2'));var timeout=require(_0x0e5e('0x3'));var express=require(_0x0e5e('0x4'));var router=express[_0x0e5e('0x5')]();var fs_extra=require(_0x0e5e('0x6'));var auth=require(_0x0e5e('0x7'));var interaction=require(_0x0e5e('0x8'));var config=require('../../config/environment');var controller=require(_0x0e5e('0x9'));router[_0x0e5e('0xa')]('/',auth[_0x0e5e('0xb')](),controller['index']);router[_0x0e5e('0xa')](_0x0e5e('0xc'),auth[_0x0e5e('0xb')](),controller[_0x0e5e('0xd')]);router[_0x0e5e('0xe')]('/',auth[_0x0e5e('0xb')](),controller[_0x0e5e('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0e5e('0x10')]);router[_0x0e5e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0e5e('0x12')]);module[_0x0e5e('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 161bf94..31f81c8 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6bb=['exports','sequelize'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0xe6bb,0x133));var _0xbe6b=function(_0x49a264,_0x3e2dd7){_0x49a264=_0x49a264-0x0;var _0x255927=_0xe6bb[_0x49a264];return _0x255927;};'use strict';var Sequelize=require(_0xbe6b('0x0'));module[_0xbe6b('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x0399=['sequelize','exports','TEXT'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x0399,0x180));var _0x9039=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0399[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x9039('0x0'));module[_0x9039('0x1')]={'tree':{'type':Sequelize[_0x9039('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 378cd0f..c037bef 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.controller.js +++ b/server/api/analyticTreeReport/analyticTreeReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1aae=['limit','count','set','save','update','then','error','stack','name','send','AnalyticTreeReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','fields','catch','create','body','find','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined'];(function(_0x18bef8,_0x1a7772){var _0x146dcb=function(_0x27a7c8){while(--_0x27a7c8){_0x18bef8['push'](_0x18bef8['shift']());}};_0x146dcb(++_0x1a7772);}(_0x1aae,0xfb));var _0xe1aa=function(_0x48f8b2,_0x464731){_0x48f8b2=_0x48f8b2-0x0;var _0x47ebb4=_0x1aae[_0x48f8b2];return _0x47ebb4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe1aa('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1aa('0x1'));var moment=require(_0xe1aa('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe1aa('0x3'));var util=require(_0xe1aa('0x4'));var path=require(_0xe1aa('0x5'));var sox=require(_0xe1aa('0x6'));var csv=require(_0xe1aa('0x7'));var ejs=require(_0xe1aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe1aa('0x9'));var squel=require(_0xe1aa('0xa'));var crypto=require('crypto');var jsforce=require(_0xe1aa('0xb'));var deskjs=require(_0xe1aa('0xc'));var toCsv=require(_0xe1aa('0x7'));var querystring=require(_0xe1aa('0xd'));var Papa=require(_0xe1aa('0xe'));var Redis=require(_0xe1aa('0xf'));var authService=require(_0xe1aa('0x10'));var qs=require(_0xe1aa('0x11'));var as=require(_0xe1aa('0x12'));var hardwareService=require(_0xe1aa('0x13'));var logger=require(_0xe1aa('0x14'))(_0xe1aa('0x15'));var utils=require(_0xe1aa('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34c561,_0x13d989){_0x13d989=_0x13d989||0xcc;return function(_0x12fcb9){if(_0x12fcb9){return _0x34c561[_0xe1aa('0x17')](_0x13d989);}return _0x34c561[_0xe1aa('0x18')](_0x13d989)[_0xe1aa('0x19')]();};}function respondWithResult(_0x128070,_0x29061d){_0x29061d=_0x29061d||0xc8;return function(_0x1f9cf6){if(_0x1f9cf6){return _0x128070[_0xe1aa('0x18')](_0x29061d)[_0xe1aa('0x1a')](_0x1f9cf6);}};}function respondWithFilteredResult(_0xfe1274,_0x3e4e42){return function(_0x1056c6){if(_0x1056c6){var _0x227fa0=typeof _0x3e4e42[_0xe1aa('0x1b')]===_0xe1aa('0x1c')&&typeof _0x3e4e42[_0xe1aa('0x1d')]===_0xe1aa('0x1c');var _0x2bb125=_0x1056c6[_0xe1aa('0x1e')];var _0xc19bf4=_0x227fa0?0x0:_0x3e4e42[_0xe1aa('0x1b')];var _0x33135b=_0x227fa0?_0x1056c6[_0xe1aa('0x1e')]:_0x3e4e42[_0xe1aa('0x1b')]+_0x3e4e42[_0xe1aa('0x1d')];var _0x5b2c16;if(_0x33135b>=_0x2bb125){_0x33135b=_0x2bb125;_0x5b2c16=0xc8;}else{_0x5b2c16=0xce;}_0xfe1274[_0xe1aa('0x18')](_0x5b2c16);return _0xfe1274[_0xe1aa('0x1f')]('Content-Range',_0xc19bf4+'-'+_0x33135b+'/'+_0x2bb125)['json'](_0x1056c6);}return null;};}function patchUpdates(_0x39d49f){return function(_0x57efca){try{jsonpatch['apply'](_0x57efca,_0x39d49f,!![]);}catch(_0x37b650){return BPromise['reject'](_0x37b650);}return _0x57efca[_0xe1aa('0x20')]();};}function saveUpdates(_0x3bda1e,_0x191649){return function(_0x56aa38){if(_0x56aa38){return _0x56aa38[_0xe1aa('0x21')](_0x3bda1e)[_0xe1aa('0x22')](function(_0x20024e){return _0x20024e;});}return null;};}function removeEntity(_0x4c5b92,_0x3c7103){return function(_0x107618){if(_0x107618){return _0x107618['destroy']()[_0xe1aa('0x22')](function(){_0x4c5b92[_0xe1aa('0x18')](0xcc)[_0xe1aa('0x19')]();});}};}function handleEntityNotFound(_0x1e6655,_0x400adb){return function(_0x3d69f8){if(!_0x3d69f8){_0x1e6655[_0xe1aa('0x17')](0x194);}return _0x3d69f8;};}function handleError(_0x2c11cd,_0x456147){_0x456147=_0x456147||0x1f4;return function(_0x183cab){logger[_0xe1aa('0x23')](_0x183cab[_0xe1aa('0x24')]);if(_0x183cab[_0xe1aa('0x25')]){delete _0x183cab['name'];}_0x2c11cd[_0xe1aa('0x18')](_0x456147)[_0xe1aa('0x26')](_0x183cab);};}exports['index']=function(_0x5b927e,_0x2481bf){var _0x327c2b={},_0x53bffc={},_0x1c7f6d={'count':0x0,'rows':[]};var _0x846e5a=_['map'](db[_0xe1aa('0x27')][_0xe1aa('0x28')],function(_0x58bb53){return{'name':_0x58bb53['fieldName'],'type':_0x58bb53[_0xe1aa('0x29')][_0xe1aa('0x2a')]};});_0x53bffc[_0xe1aa('0x2b')]=_[_0xe1aa('0x2c')](_0x846e5a,_0xe1aa('0x25'));_0x53bffc[_0xe1aa('0x2d')]=_[_0xe1aa('0x2e')](_0x5b927e['query']);_0x53bffc[_0xe1aa('0x2f')]=_[_0xe1aa('0x30')](_0x53bffc[_0xe1aa('0x2b')],_0x53bffc[_0xe1aa('0x2d')]);_0x327c2b['attributes']=_['intersection'](_0x53bffc[_0xe1aa('0x2b')],qs['fields'](_0x5b927e[_0xe1aa('0x2d')]['fields']));_0x327c2b[_0xe1aa('0x31')]=_0x327c2b['attributes'][_0xe1aa('0x32')]?_0x327c2b[_0xe1aa('0x31')]:_0x53bffc[_0xe1aa('0x2b')];if(!_0x5b927e['query'][_0xe1aa('0x33')]('nolimit')){_0x327c2b[_0xe1aa('0x1d')]=qs[_0xe1aa('0x1d')](_0x5b927e[_0xe1aa('0x2d')][_0xe1aa('0x1d')]);_0x327c2b[_0xe1aa('0x1b')]=qs[_0xe1aa('0x1b')](_0x5b927e['query'][_0xe1aa('0x1b')]);}_0x327c2b[_0xe1aa('0x34')]=qs[_0xe1aa('0x35')](_0x5b927e[_0xe1aa('0x2d')][_0xe1aa('0x35')]);_0x327c2b[_0xe1aa('0x36')]=qs['filters'](_[_0xe1aa('0x37')](_0x5b927e['query'],_0x53bffc['filters']),_0x846e5a);if(_0x5b927e[_0xe1aa('0x2d')][_0xe1aa('0x38')]){_0x327c2b[_0xe1aa('0x36')]=_['merge'](_0x327c2b[_0xe1aa('0x36')],{'$or':_[_0xe1aa('0x2c')](_0x846e5a,function(_0x135548){if(_0x135548[_0xe1aa('0x29')]!==_0xe1aa('0x39')){var _0x1324fb={};_0x1324fb[_0x135548[_0xe1aa('0x25')]]={'$like':'%'+_0x5b927e[_0xe1aa('0x2d')]['filter']+'%'};return _0x1324fb;}})});}_0x327c2b=_[_0xe1aa('0x3a')]({},_0x327c2b,_0x5b927e[_0xe1aa('0x3b')]);var _0x34a217={'where':_0x327c2b['where']};return db[_0xe1aa('0x27')][_0xe1aa('0x1e')](_0x34a217)[_0xe1aa('0x22')](function(_0x22b7ab){_0x1c7f6d[_0xe1aa('0x1e')]=_0x22b7ab;if(_0x5b927e['query'][_0xe1aa('0x3c')]){_0x327c2b['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xe1aa('0x3d')](_0x327c2b);})[_0xe1aa('0x22')](function(_0x56e979){_0x1c7f6d[_0xe1aa('0x3e')]=_0x56e979;return _0x1c7f6d;})[_0xe1aa('0x22')](respondWithFilteredResult(_0x2481bf,_0x327c2b))['catch'](handleError(_0x2481bf,null));};exports[_0xe1aa('0x3f')]=function(_0x3a23f7,_0x21727f){var _0x2159a5={'raw':!![],'where':{'id':_0x3a23f7[_0xe1aa('0x40')]['id']}},_0x233741={};_0x233741['model']=_[_0xe1aa('0x2e')](db['AnalyticTreeReport'][_0xe1aa('0x28')]);_0x233741[_0xe1aa('0x2d')]=_[_0xe1aa('0x2e')](_0x3a23f7['query']);_0x233741['filters']=_[_0xe1aa('0x30')](_0x233741[_0xe1aa('0x2b')],_0x233741['query']);_0x2159a5[_0xe1aa('0x31')]=_['intersection'](_0x233741[_0xe1aa('0x2b')],qs['fields'](_0x3a23f7[_0xe1aa('0x2d')][_0xe1aa('0x41')]));_0x2159a5[_0xe1aa('0x31')]=_0x2159a5[_0xe1aa('0x31')]['length']?_0x2159a5[_0xe1aa('0x31')]:_0x233741[_0xe1aa('0x2b')];if(_0x3a23f7[_0xe1aa('0x2d')][_0xe1aa('0x3c')]){_0x2159a5['include']=[{'all':!![]}];}_0x2159a5=_[_0xe1aa('0x3a')]({},_0x2159a5,_0x3a23f7[_0xe1aa('0x3b')]);return db[_0xe1aa('0x27')]['find'](_0x2159a5)[_0xe1aa('0x22')](handleEntityNotFound(_0x21727f,null))[_0xe1aa('0x22')](respondWithResult(_0x21727f,null))[_0xe1aa('0x42')](handleError(_0x21727f,null));};exports['create']=function(_0x30b771,_0x31b5a7){return db[_0xe1aa('0x27')][_0xe1aa('0x43')](_0x30b771[_0xe1aa('0x44')],{})['then'](respondWithResult(_0x31b5a7,0xc9))['catch'](handleError(_0x31b5a7,null));};exports[_0xe1aa('0x21')]=function(_0x43cf16,_0x49e952){if(_0x43cf16[_0xe1aa('0x44')]['id']){delete _0x43cf16['body']['id'];}return db['AnalyticTreeReport'][_0xe1aa('0x45')]({'where':{'id':_0x43cf16[_0xe1aa('0x40')]['id']}})[_0xe1aa('0x22')](handleEntityNotFound(_0x49e952,null))[_0xe1aa('0x22')](saveUpdates(_0x43cf16[_0xe1aa('0x44')],null))['then'](respondWithResult(_0x49e952,null))[_0xe1aa('0x42')](handleError(_0x49e952,null));};exports['destroy']=function(_0xefed73,_0x5f5b81){return db[_0xe1aa('0x27')][_0xe1aa('0x45')]({'where':{'id':_0xefed73[_0xe1aa('0x40')]['id']}})[_0xe1aa('0x22')](handleEntityNotFound(_0x5f5b81,null))['then'](removeEntity(_0x5f5b81,null))[_0xe1aa('0x42')](handleError(_0x5f5b81,null));}; \ No newline at end of file +var _0xdf6c=['reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','AnalyticTreeReport','includeAll','catch','show','params','include','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply'];(function(_0x41ed37,_0xbcd1d4){var _0x13f7ea=function(_0x270235){while(--_0x270235){_0x41ed37['push'](_0x41ed37['shift']());}};_0x13f7ea(++_0xbcd1d4);}(_0xdf6c,0x71));var _0xcdf6=function(_0x2da833,_0x5f563d){_0x2da833=_0x2da833-0x0;var _0x3af752=_0xdf6c[_0x2da833];return _0x3af752;};'use strict';var emlformat=require(_0xcdf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcdf6('0x1'));var jsonpatch=require(_0xcdf6('0x2'));var rp=require(_0xcdf6('0x3'));var moment=require(_0xcdf6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcdf6('0x5'));var util=require('util');var path=require(_0xcdf6('0x6'));var sox=require(_0xcdf6('0x7'));var csv=require(_0xcdf6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdf6('0x9'));var _=require(_0xcdf6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcdf6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcdf6('0xc'));var Papa=require('papaparse');var Redis=require(_0xcdf6('0xd'));var authService=require(_0xcdf6('0xe'));var qs=require(_0xcdf6('0xf'));var as=require(_0xcdf6('0x10'));var hardwareService=require(_0xcdf6('0x11'));var logger=require(_0xcdf6('0x12'))(_0xcdf6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcdf6('0x14'));var db=require(_0xcdf6('0x15'))['db'];function respondWithStatusCode(_0x32ee7f,_0x56ae64){_0x56ae64=_0x56ae64||0xcc;return function(_0x3a1df7){if(_0x3a1df7){return _0x32ee7f[_0xcdf6('0x16')](_0x56ae64);}return _0x32ee7f[_0xcdf6('0x17')](_0x56ae64)[_0xcdf6('0x18')]();};}function respondWithResult(_0x42b278,_0x9376bc){_0x9376bc=_0x9376bc||0xc8;return function(_0x2075dd){if(_0x2075dd){return _0x42b278['status'](_0x9376bc)['json'](_0x2075dd);}};}function respondWithFilteredResult(_0x10155e,_0x5a8152){return function(_0x23dd3b){if(_0x23dd3b){var _0x27ffa7=typeof _0x5a8152['offset']==='undefined'&&typeof _0x5a8152[_0xcdf6('0x19')]===_0xcdf6('0x1a');var _0x4540b8=_0x23dd3b[_0xcdf6('0x1b')];var _0x207691=_0x27ffa7?0x0:_0x5a8152[_0xcdf6('0x1c')];var _0x8307cf=_0x27ffa7?_0x23dd3b[_0xcdf6('0x1b')]:_0x5a8152[_0xcdf6('0x1c')]+_0x5a8152[_0xcdf6('0x19')];var _0x18a42e;if(_0x8307cf>=_0x4540b8){_0x8307cf=_0x4540b8;_0x18a42e=0xc8;}else{_0x18a42e=0xce;}_0x10155e[_0xcdf6('0x17')](_0x18a42e);return _0x10155e[_0xcdf6('0x1d')](_0xcdf6('0x1e'),_0x207691+'-'+_0x8307cf+'/'+_0x4540b8)[_0xcdf6('0x1f')](_0x23dd3b);}return null;};}function patchUpdates(_0x13f08a){return function(_0x15bd55){try{jsonpatch[_0xcdf6('0x20')](_0x15bd55,_0x13f08a,!![]);}catch(_0x4b7a69){return BPromise[_0xcdf6('0x21')](_0x4b7a69);}return _0x15bd55[_0xcdf6('0x22')]();};}function saveUpdates(_0x53712d,_0xd965d7){return function(_0x371bd7){if(_0x371bd7){return _0x371bd7['update'](_0x53712d)['then'](function(_0x35fb76){return _0x35fb76;});}return null;};}function removeEntity(_0x351710,_0x10dcc3){return function(_0x54068b){if(_0x54068b){return _0x54068b[_0xcdf6('0x23')]()[_0xcdf6('0x24')](function(){_0x351710[_0xcdf6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x264753,_0x25c5d7){return function(_0x5910fb){if(!_0x5910fb){_0x264753[_0xcdf6('0x16')](0x194);}return _0x5910fb;};}function handleError(_0x3f61db,_0x3e0737){_0x3e0737=_0x3e0737||0x1f4;return function(_0x29f42d){logger[_0xcdf6('0x25')](_0x29f42d[_0xcdf6('0x26')]);if(_0x29f42d[_0xcdf6('0x27')]){delete _0x29f42d[_0xcdf6('0x27')];}_0x3f61db['status'](_0x3e0737)[_0xcdf6('0x28')](_0x29f42d);};}exports[_0xcdf6('0x29')]=function(_0x11d615,_0x59c8b0){var _0x23b6a0={},_0x3b0157={},_0x2011d1={'count':0x0,'rows':[]};var _0x17ca85=_[_0xcdf6('0x2a')](db['AnalyticTreeReport'][_0xcdf6('0x2b')],function(_0x468f0d){return{'name':_0x468f0d[_0xcdf6('0x2c')],'type':_0x468f0d['type'][_0xcdf6('0x2d')]};});_0x3b0157['model']=_[_0xcdf6('0x2a')](_0x17ca85,_0xcdf6('0x27'));_0x3b0157[_0xcdf6('0x2e')]=_[_0xcdf6('0x2f')](_0x11d615[_0xcdf6('0x2e')]);_0x3b0157[_0xcdf6('0x30')]=_[_0xcdf6('0x31')](_0x3b0157['model'],_0x3b0157['query']);_0x23b6a0[_0xcdf6('0x32')]=_[_0xcdf6('0x31')](_0x3b0157[_0xcdf6('0x33')],qs[_0xcdf6('0x34')](_0x11d615[_0xcdf6('0x2e')][_0xcdf6('0x34')]));_0x23b6a0[_0xcdf6('0x32')]=_0x23b6a0[_0xcdf6('0x32')][_0xcdf6('0x35')]?_0x23b6a0[_0xcdf6('0x32')]:_0x3b0157['model'];if(!_0x11d615[_0xcdf6('0x2e')][_0xcdf6('0x36')](_0xcdf6('0x37'))){_0x23b6a0['limit']=qs[_0xcdf6('0x19')](_0x11d615[_0xcdf6('0x2e')][_0xcdf6('0x19')]);_0x23b6a0['offset']=qs[_0xcdf6('0x1c')](_0x11d615[_0xcdf6('0x2e')][_0xcdf6('0x1c')]);}_0x23b6a0[_0xcdf6('0x38')]=qs[_0xcdf6('0x39')](_0x11d615['query'][_0xcdf6('0x39')]);_0x23b6a0['where']=qs['filters'](_['pick'](_0x11d615[_0xcdf6('0x2e')],_0x3b0157['filters']),_0x17ca85);if(_0x11d615['query'][_0xcdf6('0x3a')]){_0x23b6a0[_0xcdf6('0x3b')]=_[_0xcdf6('0x3c')](_0x23b6a0['where'],{'$or':_[_0xcdf6('0x2a')](_0x17ca85,function(_0x2cff38){if(_0x2cff38[_0xcdf6('0x3d')]!==_0xcdf6('0x3e')){var _0x1d9b36={};_0x1d9b36[_0x2cff38[_0xcdf6('0x27')]]={'$like':'%'+_0x11d615[_0xcdf6('0x2e')][_0xcdf6('0x3a')]+'%'};return _0x1d9b36;}})});}_0x23b6a0=_[_0xcdf6('0x3c')]({},_0x23b6a0,_0x11d615['options']);var _0x24560f={'where':_0x23b6a0[_0xcdf6('0x3b')]};return db[_0xcdf6('0x3f')][_0xcdf6('0x1b')](_0x24560f)[_0xcdf6('0x24')](function(_0x23652d){_0x2011d1[_0xcdf6('0x1b')]=_0x23652d;if(_0x11d615[_0xcdf6('0x2e')][_0xcdf6('0x40')]){_0x23b6a0['include']=[{'all':!![]}];}return db[_0xcdf6('0x3f')]['findAll'](_0x23b6a0);})[_0xcdf6('0x24')](function(_0x12e9c8){_0x2011d1['rows']=_0x12e9c8;return _0x2011d1;})[_0xcdf6('0x24')](respondWithFilteredResult(_0x59c8b0,_0x23b6a0))[_0xcdf6('0x41')](handleError(_0x59c8b0,null));};exports[_0xcdf6('0x42')]=function(_0x5011e2,_0x111f2d){var _0x127dc4={'raw':!![],'where':{'id':_0x5011e2[_0xcdf6('0x43')]['id']}},_0x20eab9={};_0x20eab9[_0xcdf6('0x33')]=_[_0xcdf6('0x2f')](db['AnalyticTreeReport']['rawAttributes']);_0x20eab9[_0xcdf6('0x2e')]=_[_0xcdf6('0x2f')](_0x5011e2[_0xcdf6('0x2e')]);_0x20eab9[_0xcdf6('0x30')]=_[_0xcdf6('0x31')](_0x20eab9[_0xcdf6('0x33')],_0x20eab9['query']);_0x127dc4[_0xcdf6('0x32')]=_[_0xcdf6('0x31')](_0x20eab9['model'],qs[_0xcdf6('0x34')](_0x5011e2[_0xcdf6('0x2e')][_0xcdf6('0x34')]));_0x127dc4[_0xcdf6('0x32')]=_0x127dc4[_0xcdf6('0x32')][_0xcdf6('0x35')]?_0x127dc4['attributes']:_0x20eab9[_0xcdf6('0x33')];if(_0x5011e2['query'][_0xcdf6('0x40')]){_0x127dc4[_0xcdf6('0x44')]=[{'all':!![]}];}_0x127dc4=_[_0xcdf6('0x3c')]({},_0x127dc4,_0x5011e2['options']);return db['AnalyticTreeReport'][_0xcdf6('0x45')](_0x127dc4)[_0xcdf6('0x24')](handleEntityNotFound(_0x111f2d,null))['then'](respondWithResult(_0x111f2d,null))['catch'](handleError(_0x111f2d,null));};exports[_0xcdf6('0x46')]=function(_0x5a1fbc,_0x3b7858){return db[_0xcdf6('0x3f')][_0xcdf6('0x46')](_0x5a1fbc[_0xcdf6('0x47')],{})[_0xcdf6('0x24')](respondWithResult(_0x3b7858,0xc9))[_0xcdf6('0x41')](handleError(_0x3b7858,null));};exports[_0xcdf6('0x48')]=function(_0x558392,_0x40e898){if(_0x558392[_0xcdf6('0x47')]['id']){delete _0x558392[_0xcdf6('0x47')]['id'];}return db[_0xcdf6('0x3f')]['find']({'where':{'id':_0x558392[_0xcdf6('0x43')]['id']}})[_0xcdf6('0x24')](handleEntityNotFound(_0x40e898,null))[_0xcdf6('0x24')](saveUpdates(_0x558392['body'],null))['then'](respondWithResult(_0x40e898,null))[_0xcdf6('0x41')](handleError(_0x40e898,null));};exports[_0xcdf6('0x23')]=function(_0x408979,_0x3eaf5b){return db['AnalyticTreeReport'][_0xcdf6('0x45')]({'where':{'id':_0x408979[_0xcdf6('0x43')]['id']}})[_0xcdf6('0x24')](handleEntityNotFound(_0x3eaf5b,null))['then'](removeEntity(_0x3eaf5b,null))['catch'](handleError(_0x3eaf5b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e07a19b..e43fef0 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.model.js +++ b/server/api/analyticTreeReport/analyticTreeReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb69a=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5f159a,_0x4d5a73){var _0x25349b=function(_0x107376){while(--_0x107376){_0x5f159a['push'](_0x5f159a['shift']());}};_0x25349b(++_0x4d5a73);}(_0xb69a,0x1f3));var _0xab69=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb69a[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xab69('0x0'));var util=require(_0xab69('0x1'));var logger=require(_0xab69('0x2'))(_0xab69('0x3'));var moment=require(_0xab69('0x4'));var BPromise=require('bluebird');var rp=require(_0xab69('0x5'));var fs=require('fs');var path=require(_0xab69('0x6'));var rimraf=require(_0xab69('0x7'));var config=require(_0xab69('0x8'));var attributes=require(_0xab69('0x9'));module[_0xab69('0xa')]=function(_0xb1bf8f,_0x57cd46){return _0xb1bf8f['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6ba=['../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','lodash','util','api','bluebird','path'];(function(_0x257041,_0x464937){var _0x3566cb=function(_0x2db896){while(--_0x2db896){_0x257041['push'](_0x257041['shift']());}};_0x3566cb(++_0x464937);}(_0xe6ba,0x163));var _0xae6b=function(_0x263936,_0x1228f8){_0x263936=_0x263936-0x0;var _0x3ff68a=_0xe6ba[_0x263936];return _0x3ff68a;};'use strict';var _=require(_0xae6b('0x0'));var util=require(_0xae6b('0x1'));var logger=require('../../config/logger')(_0xae6b('0x2'));var moment=require('moment');var BPromise=require(_0xae6b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae6b('0x4'));var rimraf=require('rimraf');var config=require(_0xae6b('0x5'));var attributes=require(_0xae6b('0x6'));module['exports']=function(_0x3941f9,_0x48a1ab){return _0x3941f9[_0xae6b('0x7')](_0xae6b('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index f739da0..639a017 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x1dddf5,_0x5171a5){var _0x126fea=function(_0x500527){while(--_0x500527){_0x1dddf5['push'](_0x1dddf5['shift']());}};_0x126fea(++_0x5171a5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x51fae0,_0x2de47c){_0x51fae0=_0x51fae0-0x0;var _0x4201e6=_0x7a54[_0x51fae0];return _0x4201e6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 31a08cc..6670832 100644 --- a/server/api/analyticTreeReport/index.js +++ b/server/api/analyticTreeReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeaca=['connect-timeout','express','Router','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','util','path'];(function(_0x3a9f98,_0x4f5a75){var _0x5cfc6d=function(_0x159532){while(--_0x159532){_0x3a9f98['push'](_0x3a9f98['shift']());}};_0x5cfc6d(++_0x4f5a75);}(_0xeaca,0x196));var _0xaeac=function(_0x301b70,_0x499177){_0x301b70=_0x301b70-0x0;var _0x1a2331=_0xeaca[_0x301b70];return _0x1a2331;};'use strict';var multer=require('multer');var util=require(_0xaeac('0x0'));var path=require(_0xaeac('0x1'));var timeout=require(_0xaeac('0x2'));var express=require(_0xaeac('0x3'));var router=express[_0xaeac('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaeac('0x5'));var config=require('../../config/environment');var controller=require(_0xaeac('0x6'));router[_0xaeac('0x7')]('/',auth[_0xaeac('0x8')](),controller[_0xaeac('0x9')]);router[_0xaeac('0x7')]('/:id',auth[_0xaeac('0x8')](),controller[_0xaeac('0xa')]);router[_0xaeac('0xb')]('/',auth[_0xaeac('0x8')](),controller[_0xaeac('0xc')]);router[_0xaeac('0xd')](_0xaeac('0xe'),auth[_0xaeac('0x8')](),controller[_0xaeac('0xf')]);router['delete'](_0xaeac('0xe'),auth[_0xaeac('0x8')](),controller[_0xaeac('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4f3f=['../../components/auth/service','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','util','path','Router','fs-extra'];(function(_0x30023d,_0x534f9a){var _0x2749d1=function(_0x24a6b8){while(--_0x24a6b8){_0x30023d['push'](_0x30023d['shift']());}};_0x2749d1(++_0x534f9a);}(_0x4f3f,0x1cc));var _0xf4f3=function(_0x42df7a,_0x33bc7a){_0x42df7a=_0x42df7a-0x0;var _0x516290=_0x4f3f[_0x42df7a];return _0x516290;};'use strict';var multer=require('multer');var util=require(_0xf4f3('0x0'));var path=require(_0xf4f3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf4f3('0x2')]();var fs_extra=require(_0xf4f3('0x3'));var auth=require(_0xf4f3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf4f3('0x5'));router['get']('/',auth[_0xf4f3('0x6')](),controller[_0xf4f3('0x7')]);router[_0xf4f3('0x8')](_0xf4f3('0x9'),auth[_0xf4f3('0x6')](),controller[_0xf4f3('0xa')]);router['post']('/',auth[_0xf4f3('0x6')](),controller[_0xf4f3('0xb')]);router[_0xf4f3('0xc')](_0xf4f3('0x9'),auth[_0xf4f3('0x6')](),controller[_0xf4f3('0xd')]);router[_0xf4f3('0xe')](_0xf4f3('0x9'),auth['isAuthenticated'](),controller[_0xf4f3('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1d03c4c..3779412 100644 --- a/server/api/attachment/attachment.attributes.js +++ b/server/api/attachment/attachment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf197=['STRING','sequelize','exports'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xf197,0x130));var _0x7f19=function(_0x26d4f9,_0x39fa0a){_0x26d4f9=_0x26d4f9-0x0;var _0x151fb6=_0xf197[_0x26d4f9];return _0x151fb6;};'use strict';var Sequelize=require(_0x7f19('0x0'));module[_0x7f19('0x1')]={'name':{'type':Sequelize[_0x7f19('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1df5=['STRING','sequelize','exports'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x1df5,0xfd));var _0x51df=function(_0x10c68b,_0x651f83){_0x10c68b=_0x10c68b-0x0;var _0x1c4515=_0x1df5[_0x10c68b];return _0x1c4515;};'use strict';var Sequelize=require(_0x51df('0x0'));module[_0x51df('0x1')]={'name':{'type':Sequelize[_0x51df('0x2')]},'basename':{'type':Sequelize[_0x51df('0x2')]},'type':{'type':Sequelize[_0x51df('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c3c0390..7393130 100644 --- a/server/api/attachment/attachment.controller.js +++ b/server/api/attachment/attachment.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0a5=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll','Attachment','findAll','rows','include','find','catch','clone','params','length','get','omit','createdAt','updatedAt','body','create','originalname','file','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','sendStatus','error','stack','send'];(function(_0x3f802e,_0x3ae1c7){var _0x2cbea2=function(_0x582642){while(--_0x582642){_0x3f802e['push'](_0x3f802e['shift']());}};_0x2cbea2(++_0x3ae1c7);}(_0xf0a5,0x8e));var _0x5f0a=function(_0x329cd9,_0x23a7e8){_0x329cd9=_0x329cd9-0x0;var _0x3fb7c3=_0xf0a5[_0x329cd9];return _0x3fb7c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f0a('0x0'));var zipdir=require(_0x5f0a('0x1'));var jsonpatch=require(_0x5f0a('0x2'));var rp=require(_0x5f0a('0x3'));var moment=require(_0x5f0a('0x4'));var BPromise=require(_0x5f0a('0x5'));var Mustache=require(_0x5f0a('0x6'));var util=require(_0x5f0a('0x7'));var path=require('path');var sox=require(_0x5f0a('0x8'));var csv=require(_0x5f0a('0x9'));var ejs=require(_0x5f0a('0xa'));var fs=require('fs');var fs_extra=require(_0x5f0a('0xb'));var _=require(_0x5f0a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5f0a('0xd'));var toCsv=require(_0x5f0a('0x9'));var querystring=require('querystring');var Papa=require(_0x5f0a('0xe'));var Redis=require('ioredis');var authService=require(_0x5f0a('0xf'));var qs=require(_0x5f0a('0x10'));var as=require(_0x5f0a('0x11'));var hardwareService=require(_0x5f0a('0x12'));var logger=require(_0x5f0a('0x13'))(_0x5f0a('0x14'));var utils=require(_0x5f0a('0x15'));var config=require(_0x5f0a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f0a('0x17'))['db'];function respondWithStatusCode(_0x309155,_0x547872){_0x547872=_0x547872||0xcc;return function(_0x1148a4){if(_0x1148a4){return _0x309155['sendStatus'](_0x547872);}return _0x309155[_0x5f0a('0x18')](_0x547872)[_0x5f0a('0x19')]();};}function respondWithResult(_0x2a09c4,_0x42452a){_0x42452a=_0x42452a||0xc8;return function(_0x3a22f3){if(_0x3a22f3){return _0x2a09c4[_0x5f0a('0x18')](_0x42452a)[_0x5f0a('0x1a')](_0x3a22f3);}};}function respondWithFilteredResult(_0x2c0e25,_0x39ebb2){return function(_0x3f7257){if(_0x3f7257){var _0x2f4f7b=typeof _0x39ebb2[_0x5f0a('0x1b')]===_0x5f0a('0x1c')&&typeof _0x39ebb2[_0x5f0a('0x1d')]===_0x5f0a('0x1c');var _0x1fa5d0=_0x3f7257['count'];var _0x75bca8=_0x2f4f7b?0x0:_0x39ebb2[_0x5f0a('0x1b')];var _0x5927e2=_0x2f4f7b?_0x3f7257[_0x5f0a('0x1e')]:_0x39ebb2[_0x5f0a('0x1b')]+_0x39ebb2[_0x5f0a('0x1d')];var _0x541824;if(_0x5927e2>=_0x1fa5d0){_0x5927e2=_0x1fa5d0;_0x541824=0xc8;}else{_0x541824=0xce;}_0x2c0e25[_0x5f0a('0x18')](_0x541824);return _0x2c0e25[_0x5f0a('0x1f')]('Content-Range',_0x75bca8+'-'+_0x5927e2+'/'+_0x1fa5d0)[_0x5f0a('0x1a')](_0x3f7257);}return null;};}function patchUpdates(_0x5347cd){return function(_0x28b5f3){try{jsonpatch['apply'](_0x28b5f3,_0x5347cd,!![]);}catch(_0x3a78e1){return BPromise[_0x5f0a('0x20')](_0x3a78e1);}return _0x28b5f3['save']();};}function saveUpdates(_0x201ba1,_0xeedb82){return function(_0x108258){if(_0x108258){return _0x108258[_0x5f0a('0x21')](_0x201ba1)[_0x5f0a('0x22')](function(_0x2088cd){return _0x2088cd;});}return null;};}function removeEntity(_0xd734c1,_0x1564a6){return function(_0x1b1176){if(_0x1b1176){return _0x1b1176[_0x5f0a('0x23')]()[_0x5f0a('0x22')](function(){_0xd734c1[_0x5f0a('0x18')](0xcc)[_0x5f0a('0x19')]();});}};}function handleEntityNotFound(_0x3ac41b,_0x2d14b7){return function(_0x1fd400){if(!_0x1fd400){_0x3ac41b[_0x5f0a('0x24')](0x194);}return _0x1fd400;};}function handleError(_0x3d56cb,_0x14df7d){_0x14df7d=_0x14df7d||0x1f4;return function(_0x158c62){logger[_0x5f0a('0x25')](_0x158c62[_0x5f0a('0x26')]);if(_0x158c62['name']){delete _0x158c62['name'];}_0x3d56cb[_0x5f0a('0x18')](_0x14df7d)[_0x5f0a('0x27')](_0x158c62);};}exports[_0x5f0a('0x28')]=function(_0x446ccd,_0x22658e){var _0x4d2d86={},_0x2097c6={},_0x22a798={'count':0x0,'rows':[]};var _0x4e639c=_[_0x5f0a('0x29')](db['Attachment'][_0x5f0a('0x2a')],function(_0x2a26a1){return{'name':_0x2a26a1[_0x5f0a('0x2b')],'type':_0x2a26a1['type'][_0x5f0a('0x2c')]};});_0x2097c6[_0x5f0a('0x2d')]=_['map'](_0x4e639c,'name');_0x2097c6[_0x5f0a('0x2e')]=_[_0x5f0a('0x2f')](_0x446ccd['query']);_0x2097c6[_0x5f0a('0x30')]=_['intersection'](_0x2097c6[_0x5f0a('0x2d')],_0x2097c6[_0x5f0a('0x2e')]);_0x4d2d86['attributes']=_[_0x5f0a('0x31')](_0x2097c6[_0x5f0a('0x2d')],qs[_0x5f0a('0x32')](_0x446ccd[_0x5f0a('0x2e')][_0x5f0a('0x32')]));_0x4d2d86[_0x5f0a('0x33')]=_0x4d2d86[_0x5f0a('0x33')]['length']?_0x4d2d86['attributes']:_0x2097c6['model'];if(!_0x446ccd['query'][_0x5f0a('0x34')](_0x5f0a('0x35'))){_0x4d2d86[_0x5f0a('0x1d')]=qs[_0x5f0a('0x1d')](_0x446ccd[_0x5f0a('0x2e')][_0x5f0a('0x1d')]);_0x4d2d86[_0x5f0a('0x1b')]=qs['offset'](_0x446ccd[_0x5f0a('0x2e')][_0x5f0a('0x1b')]);}_0x4d2d86[_0x5f0a('0x36')]=qs[_0x5f0a('0x37')](_0x446ccd[_0x5f0a('0x2e')][_0x5f0a('0x37')]);_0x4d2d86[_0x5f0a('0x38')]=qs[_0x5f0a('0x30')](_[_0x5f0a('0x39')](_0x446ccd[_0x5f0a('0x2e')],_0x2097c6['filters']),_0x4e639c);if(_0x446ccd['query'][_0x5f0a('0x3a')]){_0x4d2d86[_0x5f0a('0x38')]=_[_0x5f0a('0x3b')](_0x4d2d86['where'],{'$or':_['map'](_0x4e639c,function(_0x380367){if(_0x380367[_0x5f0a('0x3c')]!==_0x5f0a('0x3d')){var _0x45dc34={};_0x45dc34[_0x380367[_0x5f0a('0x3e')]]={'$like':'%'+_0x446ccd[_0x5f0a('0x2e')]['filter']+'%'};return _0x45dc34;}})});}_0x4d2d86=_[_0x5f0a('0x3b')]({},_0x4d2d86,_0x446ccd[_0x5f0a('0x3f')]);var _0xc83c79={'where':_0x4d2d86[_0x5f0a('0x38')]};return db['Attachment'][_0x5f0a('0x1e')](_0xc83c79)[_0x5f0a('0x22')](function(_0x50912f){_0x22a798['count']=_0x50912f;if(_0x446ccd['query'][_0x5f0a('0x40')]){_0x4d2d86['include']=[{'all':!![]}];}return db[_0x5f0a('0x41')][_0x5f0a('0x42')](_0x4d2d86);})[_0x5f0a('0x22')](function(_0x365d7a){_0x22a798[_0x5f0a('0x43')]=_0x365d7a;return _0x22a798;})['then'](respondWithFilteredResult(_0x22658e,_0x4d2d86))['catch'](handleError(_0x22658e,null));};exports['show']=function(_0x1fb3a0,_0x49d2ee){var _0x3ba569={'raw':!![],'where':{'id':_0x1fb3a0['params']['id']}},_0x5aa0de={};_0x5aa0de[_0x5f0a('0x2d')]=_[_0x5f0a('0x2f')](db[_0x5f0a('0x41')][_0x5f0a('0x2a')]);_0x5aa0de['query']=_[_0x5f0a('0x2f')](_0x1fb3a0[_0x5f0a('0x2e')]);_0x5aa0de[_0x5f0a('0x30')]=_[_0x5f0a('0x31')](_0x5aa0de[_0x5f0a('0x2d')],_0x5aa0de[_0x5f0a('0x2e')]);_0x3ba569[_0x5f0a('0x33')]=_[_0x5f0a('0x31')](_0x5aa0de['model'],qs[_0x5f0a('0x32')](_0x1fb3a0[_0x5f0a('0x2e')]['fields']));_0x3ba569[_0x5f0a('0x33')]=_0x3ba569['attributes']['length']?_0x3ba569[_0x5f0a('0x33')]:_0x5aa0de['model'];if(_0x1fb3a0[_0x5f0a('0x2e')][_0x5f0a('0x40')]){_0x3ba569[_0x5f0a('0x44')]=[{'all':!![]}];}_0x3ba569=_['merge']({},_0x3ba569,_0x1fb3a0[_0x5f0a('0x3f')]);return db[_0x5f0a('0x41')][_0x5f0a('0x45')](_0x3ba569)['then'](handleEntityNotFound(_0x49d2ee,null))[_0x5f0a('0x22')](respondWithResult(_0x49d2ee,null))[_0x5f0a('0x46')](handleError(_0x49d2ee,null));};exports[_0x5f0a('0x47')]=function(_0x4dc091,_0x33ed4b){var _0x5734fc={'where':{'id':_0x4dc091[_0x5f0a('0x48')]['id']}},_0x46c6be={};_0x46c6be[_0x5f0a('0x2d')]=_[_0x5f0a('0x2f')](db['Attachment'][_0x5f0a('0x2a')]);_0x5734fc[_0x5f0a('0x33')]=_['intersection'](_0x46c6be[_0x5f0a('0x2d')],qs[_0x5f0a('0x32')](_0x4dc091['query'][_0x5f0a('0x32')]));_0x5734fc[_0x5f0a('0x33')]=_0x5734fc[_0x5f0a('0x33')][_0x5f0a('0x49')]?_0x5734fc['attributes']:_0x46c6be[_0x5f0a('0x2d')];if(_0x4dc091[_0x5f0a('0x2e')]['includeAll']){_0x5734fc[_0x5f0a('0x44')]=[{'all':!![]}];}_0x5734fc=_[_0x5f0a('0x3b')]({},_0x5734fc,_0x4dc091[_0x5f0a('0x3f')]);return db[_0x5f0a('0x41')][_0x5f0a('0x45')](_0x5734fc)['then'](handleEntityNotFound(_0x33ed4b,null))['then'](function(_0x3bd637){if(_0x3bd637){var _0x42e274=_0x3bd637[_0x5f0a('0x4a')]({'plain':!![]});_0x42e274=qs[_0x5f0a('0x4b')](_0x42e274,['id',_0x5f0a('0x4c'),_0x5f0a('0x4d')]);_0x4dc091[_0x5f0a('0x4e')]=_[_0x5f0a('0x4b')](_0x4dc091[_0x5f0a('0x4e')],['id',_0x5f0a('0x4c'),_0x5f0a('0x4d')]);return db['Attachment'][_0x5f0a('0x4f')](_[_0x5f0a('0x3b')](_0x42e274,_0x4dc091[_0x5f0a('0x4e')]),{'include':_0x4dc091['query'][_0x5f0a('0x40')]?[{'all':!![]}]:undefined});}})[_0x5f0a('0x22')](respondWithResult(_0x33ed4b,0xc9))[_0x5f0a('0x46')](handleError(_0x33ed4b,null));};exports[_0x5f0a('0x21')]=function(_0x271080,_0x1d83bf){if(_0x271080[_0x5f0a('0x4e')]['id']){delete _0x271080['body']['id'];}return db[_0x5f0a('0x41')][_0x5f0a('0x45')]({'where':{'id':_0x271080['params']['id']}})[_0x5f0a('0x22')](handleEntityNotFound(_0x1d83bf,null))[_0x5f0a('0x22')](saveUpdates(_0x271080[_0x5f0a('0x4e')],null))[_0x5f0a('0x22')](respondWithResult(_0x1d83bf,null))[_0x5f0a('0x46')](handleError(_0x1d83bf,null));};exports[_0x5f0a('0x23')]=function(_0x57ef3d,_0x3c2cbd){return db[_0x5f0a('0x41')][_0x5f0a('0x45')]({'where':{'id':_0x57ef3d[_0x5f0a('0x48')]['id']}})[_0x5f0a('0x22')](handleEntityNotFound(_0x3c2cbd,null))[_0x5f0a('0x22')](removeEntity(_0x3c2cbd,null))[_0x5f0a('0x46')](handleError(_0x3c2cbd,null));};exports[_0x5f0a('0x4f')]=function(_0x43504c,_0x4c6121,_0x35f15a){_0x43504c[_0x5f0a('0x4e')][_0x5f0a('0x3e')]=_0x43504c['file'][_0x5f0a('0x50')];_0x43504c[_0x5f0a('0x4e')]['basename']=_0x43504c[_0x5f0a('0x51')]['filename'];_0x43504c[_0x5f0a('0x4e')]['type']=_0x43504c[_0x5f0a('0x51')][_0x5f0a('0x52')];return db[_0x5f0a('0x41')]['create'](_0x43504c['body'])['then'](respondWithResult(_0x4c6121,0xc9))[_0x5f0a('0x46')](handleError(_0x4c6121,null));};exports[_0x5f0a('0x53')]=function(_0x50bbd9,_0x2faf92,_0x265200){return db[_0x5f0a('0x41')][_0x5f0a('0x54')]({'where':{'id':_0x50bbd9[_0x5f0a('0x48')]['id']},'raw':!![]})[_0x5f0a('0x22')](handleEntityNotFound(_0x2faf92,null))['then'](function(_0x511c3e){if(_0x511c3e){var _0x169bd6=_0x511c3e[_0x5f0a('0x55')]!==null;var _0x3856f9=path[_0x5f0a('0x56')](config[_0x5f0a('0x57')],_0x5f0a('0x58'));if(_0x169bd6){_0x3856f9=path[_0x5f0a('0x56')](_0x3856f9,_0x5f0a('0x59'));}var _0x3ec80b=path[_0x5f0a('0x56')](_0x3856f9,_0x511c3e[_0x5f0a('0x5a')]);return _0x2faf92[_0x5f0a('0x53')](_0x3ec80b);}})['catch'](handleError(_0x2faf92,null));}; \ No newline at end of file +var _0x1252=['join','root','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','Attachment','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','rawAttributes','length','include','find','clone','get','createdAt','updatedAt','body','create','originalname','basename','file','filename','mimetype','download','ChatOfflineMessageId'];(function(_0x13404a,_0xd9ad06){var _0x161d49=function(_0x5b23fd){while(--_0x5b23fd){_0x13404a['push'](_0x13404a['shift']());}};_0x161d49(++_0xd9ad06);}(_0x1252,0xad));var _0x2125=function(_0x39274b,_0x12b5f2){_0x39274b=_0x39274b-0x0;var _0x3937e3=_0x1252[_0x39274b];return _0x3937e3;};'use strict';var emlformat=require(_0x2125('0x0'));var rimraf=require(_0x2125('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2125('0x2'));var rp=require(_0x2125('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2125('0x4'));var path=require('path');var sox=require(_0x2125('0x5'));var csv=require(_0x2125('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2125('0x7'));var _=require(_0x2125('0x8'));var squel=require(_0x2125('0x9'));var crypto=require('crypto');var jsforce=require(_0x2125('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2125('0xb'));var Papa=require(_0x2125('0xc'));var Redis=require(_0x2125('0xd'));var authService=require(_0x2125('0xe'));var qs=require(_0x2125('0xf'));var as=require(_0x2125('0x10'));var hardwareService=require(_0x2125('0x11'));var logger=require(_0x2125('0x12'))(_0x2125('0x13'));var utils=require(_0x2125('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2125('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22644c,_0x5f0050){_0x5f0050=_0x5f0050||0xcc;return function(_0x276644){if(_0x276644){return _0x22644c[_0x2125('0x16')](_0x5f0050);}return _0x22644c[_0x2125('0x17')](_0x5f0050)[_0x2125('0x18')]();};}function respondWithResult(_0x51ed45,_0xa68514){_0xa68514=_0xa68514||0xc8;return function(_0x382cc7){if(_0x382cc7){return _0x51ed45[_0x2125('0x17')](_0xa68514)[_0x2125('0x19')](_0x382cc7);}};}function respondWithFilteredResult(_0x29ac6e,_0x15c402){return function(_0x1c9ca2){if(_0x1c9ca2){var _0x18cf3d=typeof _0x15c402[_0x2125('0x1a')]===_0x2125('0x1b')&&typeof _0x15c402['limit']===_0x2125('0x1b');var _0x10e451=_0x1c9ca2['count'];var _0x682f4f=_0x18cf3d?0x0:_0x15c402[_0x2125('0x1a')];var _0x11bead=_0x18cf3d?_0x1c9ca2[_0x2125('0x1c')]:_0x15c402[_0x2125('0x1a')]+_0x15c402[_0x2125('0x1d')];var _0x1a9950;if(_0x11bead>=_0x10e451){_0x11bead=_0x10e451;_0x1a9950=0xc8;}else{_0x1a9950=0xce;}_0x29ac6e['status'](_0x1a9950);return _0x29ac6e[_0x2125('0x1e')](_0x2125('0x1f'),_0x682f4f+'-'+_0x11bead+'/'+_0x10e451)[_0x2125('0x19')](_0x1c9ca2);}return null;};}function patchUpdates(_0x3c8485){return function(_0x3e8e3f){try{jsonpatch[_0x2125('0x20')](_0x3e8e3f,_0x3c8485,!![]);}catch(_0x536f15){return BPromise['reject'](_0x536f15);}return _0x3e8e3f['save']();};}function saveUpdates(_0x26a64e,_0x36ca27){return function(_0x426df7){if(_0x426df7){return _0x426df7[_0x2125('0x21')](_0x26a64e)[_0x2125('0x22')](function(_0x27ec44){return _0x27ec44;});}return null;};}function removeEntity(_0x180a13,_0x41eb26){return function(_0x3a34f5){if(_0x3a34f5){return _0x3a34f5[_0x2125('0x23')]()[_0x2125('0x22')](function(){_0x180a13[_0x2125('0x17')](0xcc)[_0x2125('0x18')]();});}};}function handleEntityNotFound(_0x38c1c7,_0x3bb106){return function(_0x1165d3){if(!_0x1165d3){_0x38c1c7[_0x2125('0x16')](0x194);}return _0x1165d3;};}function handleError(_0x1a3b86,_0x53fc43){_0x53fc43=_0x53fc43||0x1f4;return function(_0x1e13c7){logger['error'](_0x1e13c7[_0x2125('0x24')]);if(_0x1e13c7[_0x2125('0x25')]){delete _0x1e13c7['name'];}_0x1a3b86['status'](_0x53fc43)[_0x2125('0x26')](_0x1e13c7);};}exports[_0x2125('0x27')]=function(_0x4add28,_0xab52d3){var _0x16748a={},_0x4d0c45={},_0x50cc4b={'count':0x0,'rows':[]};var _0x74177b=_[_0x2125('0x28')](db[_0x2125('0x29')]['rawAttributes'],function(_0x35106f){return{'name':_0x35106f['fieldName'],'type':_0x35106f[_0x2125('0x2a')][_0x2125('0x2b')]};});_0x4d0c45['model']=_['map'](_0x74177b,_0x2125('0x25'));_0x4d0c45[_0x2125('0x2c')]=_['keys'](_0x4add28['query']);_0x4d0c45['filters']=_[_0x2125('0x2d')](_0x4d0c45[_0x2125('0x2e')],_0x4d0c45[_0x2125('0x2c')]);_0x16748a[_0x2125('0x2f')]=_['intersection'](_0x4d0c45['model'],qs[_0x2125('0x30')](_0x4add28[_0x2125('0x2c')][_0x2125('0x30')]));_0x16748a[_0x2125('0x2f')]=_0x16748a[_0x2125('0x2f')]['length']?_0x16748a['attributes']:_0x4d0c45[_0x2125('0x2e')];if(!_0x4add28[_0x2125('0x2c')][_0x2125('0x31')]('nolimit')){_0x16748a[_0x2125('0x1d')]=qs[_0x2125('0x1d')](_0x4add28['query'][_0x2125('0x1d')]);_0x16748a[_0x2125('0x1a')]=qs[_0x2125('0x1a')](_0x4add28[_0x2125('0x2c')][_0x2125('0x1a')]);}_0x16748a[_0x2125('0x32')]=qs[_0x2125('0x33')](_0x4add28[_0x2125('0x2c')][_0x2125('0x33')]);_0x16748a[_0x2125('0x34')]=qs[_0x2125('0x35')](_[_0x2125('0x36')](_0x4add28[_0x2125('0x2c')],_0x4d0c45[_0x2125('0x35')]),_0x74177b);if(_0x4add28['query']['filter']){_0x16748a[_0x2125('0x34')]=_[_0x2125('0x37')](_0x16748a[_0x2125('0x34')],{'$or':_[_0x2125('0x28')](_0x74177b,function(_0x330859){if(_0x330859['type']!==_0x2125('0x38')){var _0x55927e={};_0x55927e[_0x330859[_0x2125('0x25')]]={'$like':'%'+_0x4add28[_0x2125('0x2c')][_0x2125('0x39')]+'%'};return _0x55927e;}})});}_0x16748a=_[_0x2125('0x37')]({},_0x16748a,_0x4add28[_0x2125('0x3a')]);var _0x5620cc={'where':_0x16748a[_0x2125('0x34')]};return db['Attachment'][_0x2125('0x1c')](_0x5620cc)['then'](function(_0x2b8a9c){_0x50cc4b[_0x2125('0x1c')]=_0x2b8a9c;if(_0x4add28[_0x2125('0x2c')][_0x2125('0x3b')]){_0x16748a['include']=[{'all':!![]}];}return db[_0x2125('0x29')]['findAll'](_0x16748a);})['then'](function(_0x170c1e){_0x50cc4b[_0x2125('0x3c')]=_0x170c1e;return _0x50cc4b;})['then'](respondWithFilteredResult(_0xab52d3,_0x16748a))[_0x2125('0x3d')](handleError(_0xab52d3,null));};exports[_0x2125('0x3e')]=function(_0x38479b,_0x51985a){var _0x245657={'raw':!![],'where':{'id':_0x38479b[_0x2125('0x3f')]['id']}},_0x25017d={};_0x25017d['model']=_[_0x2125('0x40')](db[_0x2125('0x29')][_0x2125('0x41')]);_0x25017d[_0x2125('0x2c')]=_[_0x2125('0x40')](_0x38479b[_0x2125('0x2c')]);_0x25017d[_0x2125('0x35')]=_[_0x2125('0x2d')](_0x25017d[_0x2125('0x2e')],_0x25017d['query']);_0x245657[_0x2125('0x2f')]=_[_0x2125('0x2d')](_0x25017d[_0x2125('0x2e')],qs[_0x2125('0x30')](_0x38479b[_0x2125('0x2c')][_0x2125('0x30')]));_0x245657['attributes']=_0x245657['attributes'][_0x2125('0x42')]?_0x245657[_0x2125('0x2f')]:_0x25017d[_0x2125('0x2e')];if(_0x38479b[_0x2125('0x2c')][_0x2125('0x3b')]){_0x245657[_0x2125('0x43')]=[{'all':!![]}];}_0x245657=_['merge']({},_0x245657,_0x38479b[_0x2125('0x3a')]);return db[_0x2125('0x29')][_0x2125('0x44')](_0x245657)[_0x2125('0x22')](handleEntityNotFound(_0x51985a,null))[_0x2125('0x22')](respondWithResult(_0x51985a,null))[_0x2125('0x3d')](handleError(_0x51985a,null));};exports[_0x2125('0x45')]=function(_0x406b8d,_0x56f8e3){var _0xec678b={'where':{'id':_0x406b8d['params']['id']}},_0x29d66b={};_0x29d66b[_0x2125('0x2e')]=_[_0x2125('0x40')](db[_0x2125('0x29')]['rawAttributes']);_0xec678b[_0x2125('0x2f')]=_[_0x2125('0x2d')](_0x29d66b[_0x2125('0x2e')],qs[_0x2125('0x30')](_0x406b8d[_0x2125('0x2c')][_0x2125('0x30')]));_0xec678b[_0x2125('0x2f')]=_0xec678b['attributes']['length']?_0xec678b['attributes']:_0x29d66b[_0x2125('0x2e')];if(_0x406b8d['query']['includeAll']){_0xec678b[_0x2125('0x43')]=[{'all':!![]}];}_0xec678b=_[_0x2125('0x37')]({},_0xec678b,_0x406b8d[_0x2125('0x3a')]);return db['Attachment'][_0x2125('0x44')](_0xec678b)[_0x2125('0x22')](handleEntityNotFound(_0x56f8e3,null))[_0x2125('0x22')](function(_0x419a2a){if(_0x419a2a){var _0x1f4f27=_0x419a2a[_0x2125('0x46')]({'plain':!![]});_0x1f4f27=qs['omit'](_0x1f4f27,['id',_0x2125('0x47'),_0x2125('0x48')]);_0x406b8d[_0x2125('0x49')]=_['omit'](_0x406b8d[_0x2125('0x49')],['id','createdAt','updatedAt']);return db[_0x2125('0x29')]['create'](_[_0x2125('0x37')](_0x1f4f27,_0x406b8d[_0x2125('0x49')]),{'include':_0x406b8d['query'][_0x2125('0x3b')]?[{'all':!![]}]:undefined});}})[_0x2125('0x22')](respondWithResult(_0x56f8e3,0xc9))[_0x2125('0x3d')](handleError(_0x56f8e3,null));};exports['update']=function(_0x5c3e60,_0x58d50b){if(_0x5c3e60[_0x2125('0x49')]['id']){delete _0x5c3e60[_0x2125('0x49')]['id'];}return db[_0x2125('0x29')][_0x2125('0x44')]({'where':{'id':_0x5c3e60['params']['id']}})['then'](handleEntityNotFound(_0x58d50b,null))['then'](saveUpdates(_0x5c3e60[_0x2125('0x49')],null))['then'](respondWithResult(_0x58d50b,null))[_0x2125('0x3d')](handleError(_0x58d50b,null));};exports[_0x2125('0x23')]=function(_0x4c4937,_0x35bb50){return db[_0x2125('0x29')][_0x2125('0x44')]({'where':{'id':_0x4c4937[_0x2125('0x3f')]['id']}})[_0x2125('0x22')](handleEntityNotFound(_0x35bb50,null))[_0x2125('0x22')](removeEntity(_0x35bb50,null))[_0x2125('0x3d')](handleError(_0x35bb50,null));};exports[_0x2125('0x4a')]=function(_0x70a032,_0xeb16ed,_0x2ff664){_0x70a032['body'][_0x2125('0x25')]=_0x70a032['file'][_0x2125('0x4b')];_0x70a032[_0x2125('0x49')][_0x2125('0x4c')]=_0x70a032[_0x2125('0x4d')][_0x2125('0x4e')];_0x70a032['body']['type']=_0x70a032['file'][_0x2125('0x4f')];return db[_0x2125('0x29')]['create'](_0x70a032[_0x2125('0x49')])['then'](respondWithResult(_0xeb16ed,0xc9))['catch'](handleError(_0xeb16ed,null));};exports[_0x2125('0x50')]=function(_0x3491c8,_0x2ab006,_0x29e33b){return db[_0x2125('0x29')]['findOne']({'where':{'id':_0x3491c8[_0x2125('0x3f')]['id']},'raw':!![]})[_0x2125('0x22')](handleEntityNotFound(_0x2ab006,null))['then'](function(_0x4484ac){if(_0x4484ac){var _0x37e7ef=_0x4484ac[_0x2125('0x51')]!==null;var _0x7e03b4=path[_0x2125('0x52')](config[_0x2125('0x53')],'server/files/attachments/');if(_0x37e7ef){_0x7e03b4=path['join'](_0x7e03b4,_0x2125('0x54'));}var _0x5b15bf=path[_0x2125('0x52')](_0x7e03b4,_0x4484ac[_0x2125('0x4c')]);return _0x2ab006[_0x2125('0x50')](_0x5b15bf);}})[_0x2125('0x3d')](handleError(_0x2ab006,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 513373e..ec05315 100644 --- a/server/api/attachment/attachment.model.js +++ b/server/api/attachment/attachment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22a2=['request-promise','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x4342a4,_0x364d50){var _0x290d36=function(_0x572a41){while(--_0x572a41){_0x4342a4['push'](_0x4342a4['shift']());}};_0x290d36(++_0x364d50);}(_0x22a2,0x13b));var _0x222a=function(_0x560638,_0x55cb9c){_0x560638=_0x560638-0x0;var _0x23b648=_0x22a2[_0x560638];return _0x23b648;};'use strict';var _=require(_0x222a('0x0'));var util=require(_0x222a('0x1'));var logger=require(_0x222a('0x2'))(_0x222a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x222a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x222a('0x5'));var config=require(_0x222a('0x6'));var attributes=require(_0x222a('0x7'));module['exports']=function(_0x53ae35,_0x301c80){return _0x53ae35[_0x222a('0x8')](_0x222a('0x9'),attributes,{'tableName':_0x222a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x793a=['./attachment.attributes','define','request-promise','path','../../config/environment'];(function(_0x53bb41,_0x9c0c36){var _0x59ea07=function(_0x2db917){while(--_0x2db917){_0x53bb41['push'](_0x53bb41['shift']());}};_0x59ea07(++_0x9c0c36);}(_0x793a,0xf7));var _0xa793=function(_0xa91f3d,_0x438596){_0xa91f3d=_0xa91f3d-0x0;var _0x1b31c4=_0x793a[_0xa91f3d];return _0x1b31c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa793('0x0'));var fs=require('fs');var path=require(_0xa793('0x1'));var rimraf=require('rimraf');var config=require(_0xa793('0x2'));var attributes=require(_0xa793('0x3'));module['exports']=function(_0x5b9aad,_0x31d194){return _0x5b9aad[_0xa793('0x4')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index dcddd76..55dc906 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26bc=['Attachment','create','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x134b7d,_0x4377fb){var _0x12d5e1=function(_0x5a4569){while(--_0x5a4569){_0x134b7d['push'](_0x134b7d['shift']());}};_0x12d5e1(++_0x4377fb);}(_0x26bc,0x162));var _0xc26b=function(_0x39843a,_0xf6ddc1){_0x39843a=_0x39843a-0x0;var _0x581f65=_0x26bc[_0x39843a];return _0x581f65;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require(_0xc26b('0x2'));var BPromise=require(_0xc26b('0x3'));var rs=require(_0xc26b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc26b('0x5'))['db'];var utils=require(_0xc26b('0x6'));var logger=require(_0xc26b('0x7'))('rpc');var config=require(_0xc26b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x9')][_0xc26b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d90e,_0x5c2f6f,_0x11c6f5){return new BPromise(function(_0x453491,_0x465c89){return client[_0xc26b('0xb')](_0x13d90e,_0x11c6f5)[_0xc26b('0xc')](function(_0x1fb2b5){logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));logger[_0xc26b('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5c2f6f,_0xc26b('0xf'),JSON[_0xc26b('0x11')](_0x1fb2b5));if(_0x1fb2b5[_0xc26b('0x12')]){if(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x13')]===0x1f4){logger[_0xc26b('0x12')]('Attachment,\x20%s,\x20%s',_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x465c89(_0x1fb2b5['error'][_0xc26b('0x14')]);}logger[_0xc26b('0x12')](_0xc26b('0xe'),_0x5c2f6f,_0x1fb2b5[_0xc26b('0x12')]['message']);return _0x453491(_0x1fb2b5[_0xc26b('0x12')][_0xc26b('0x14')]);}else{logger[_0xc26b('0xd')](_0xc26b('0xe'),_0x5c2f6f,_0xc26b('0xf'));_0x453491(_0x1fb2b5[_0xc26b('0x15')]['message']);}})[_0xc26b('0x16')](function(_0x2713f6){logger['error'](_0xc26b('0xe'),_0x5c2f6f,_0x2713f6);_0x465c89(_0x2713f6);});});}exports['CreateAttachment']=function(_0x4802c7){var _0x7e6ed0=this;return new Promise(function(_0x47e75b,_0x47104f){return db[_0xc26b('0x17')][_0xc26b('0x18')](_0x4802c7[_0xc26b('0x19')],{'raw':_0x4802c7['options']?_0x4802c7[_0xc26b('0x1a')][_0xc26b('0x1b')]===undefined?!![]:![]:!![]})[_0xc26b('0xc')](function(_0x8531d6){logger[_0xc26b('0xd')](_0xc26b('0x1c'),_0x4802c7);logger['debug'](_0xc26b('0x1c'),_0x4802c7,JSON['stringify'](_0x8531d6));_0x47e75b(_0x8531d6);})[_0xc26b('0x16')](function(_0x129080){logger[_0xc26b('0x12')](_0xc26b('0x1c'),_0x129080['message'],_0x4802c7);_0x47104f(_0x7e6ed0[_0xc26b('0x12')](0x1f4,_0x129080[_0xc26b('0x14')]));});});}; \ No newline at end of file +var _0x430e=['stringify','error','message','catch','CreateAttachment','create','body','options','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x598d80,_0x32ff47){var _0x309a43=function(_0x2e5a6b){while(--_0x2e5a6b){_0x598d80['push'](_0x598d80['shift']());}};_0x309a43(++_0x32ff47);}(_0x430e,0x105));var _0xe430=function(_0x59f0ff,_0x2b9d67){_0x59f0ff=_0x59f0ff-0x0;var _0x28e782=_0x430e[_0x59f0ff];return _0x28e782;};'use strict';var _=require('lodash');var util=require(_0xe430('0x0'));var moment=require(_0xe430('0x1'));var BPromise=require('bluebird');var rs=require(_0xe430('0x2'));var fs=require('fs');var Redis=require(_0xe430('0x3'));var db=require(_0xe430('0x4'))['db'];var utils=require(_0xe430('0x5'));var logger=require('../../config/logger')(_0xe430('0x6'));var config=require(_0xe430('0x7'));var jayson=require(_0xe430('0x8'));var client=jayson[_0xe430('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2365,_0x310e0a,_0xf866f4){return new BPromise(function(_0x2bd109,_0xc558e2){return client['request'](_0x1d2365,_0xf866f4)[_0xe430('0xa')](function(_0x2068d8){logger[_0xe430('0xb')](_0xe430('0xc'),_0x310e0a,_0xe430('0xd'));logger['debug'](_0xe430('0xe'),_0x310e0a,_0xe430('0xd'),JSON[_0xe430('0xf')](_0x2068d8));if(_0x2068d8[_0xe430('0x10')]){if(_0x2068d8[_0xe430('0x10')]['code']===0x1f4){logger[_0xe430('0x10')]('Attachment,\x20%s,\x20%s',_0x310e0a,_0x2068d8['error'][_0xe430('0x11')]);return _0xc558e2(_0x2068d8[_0xe430('0x10')][_0xe430('0x11')]);}logger[_0xe430('0x10')](_0xe430('0xc'),_0x310e0a,_0x2068d8[_0xe430('0x10')][_0xe430('0x11')]);return _0x2bd109(_0x2068d8['error'][_0xe430('0x11')]);}else{logger[_0xe430('0xb')](_0xe430('0xc'),_0x310e0a,_0xe430('0xd'));_0x2bd109(_0x2068d8['result']['message']);}})[_0xe430('0x12')](function(_0x5ace8d){logger['error'](_0xe430('0xc'),_0x310e0a,_0x5ace8d);_0xc558e2(_0x5ace8d);});});}exports[_0xe430('0x13')]=function(_0x1e36f9){var _0x6e529b=this;return new Promise(function(_0x161575,_0x4c7b21){return db['Attachment'][_0xe430('0x14')](_0x1e36f9[_0xe430('0x15')],{'raw':_0x1e36f9[_0xe430('0x16')]?_0x1e36f9['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x167c65){logger[_0xe430('0xb')](_0xe430('0x13'),_0x1e36f9);logger['debug'](_0xe430('0x13'),_0x1e36f9,JSON['stringify'](_0x167c65));_0x161575(_0x167c65);})['catch'](function(_0x2d7f76){logger[_0xe430('0x10')]('CreateAttachment',_0x2d7f76[_0xe430('0x11')],_0x1e36f9);_0x4c7b21(_0x6e529b['error'](0x1f4,_0x2d7f76['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6b9e8bd..5e1a4f9 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x4dbe30,_0x1451e1){_0x4dbe30=_0x4dbe30-0x0;var _0x53f0fa=_0xdb28[_0x4dbe30];return _0x53f0fa;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1ad710,_0x3dd4b1){var _0x2c3d41=function(_0x43be25){while(--_0x43be25){_0x1ad710['push'](_0x1ad710['shift']());}};_0x2c3d41(++_0x3dd4b1);}(_0x2032,0xd9));var _0x2203=function(_0x507ba1,_0x25be61){_0x507ba1=_0x507ba1-0x0;var _0x4fdf96=_0x2032[_0x507ba1];return _0x4fdf96;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ca2b5c0..175e4c2 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7de8=['blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','role','blocked','online','user','agent','disabled','blockedAt','add','minutes','getLicense','catch','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','ad-login','User','passport','passport-local','Strategy','moment','bluebird','util','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled'];(function(_0x4f222e,_0x3cbb57){var _0x13afac=function(_0x215cad){while(--_0x215cad){_0x4f222e['push'](_0x4f222e['shift']());}};_0x13afac(++_0x3cbb57);}(_0x7de8,0x133));var _0x87de=function(_0x2b67b8,_0xb562d0){_0x2b67b8=_0x2b67b8-0x0;var _0x448d4c=_0x7de8[_0x2b67b8];return _0x448d4c;};'use strict';var passport=require(_0x87de('0x0'));var LocalStrategy=require(_0x87de('0x1'))[_0x87de('0x2')];var moment=require(_0x87de('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x87de('0x4'));var util=require(_0x87de('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x87de('0x6'));var utils=require('../../config/utils');var config=require(_0x87de('0x7'));var logger=require(_0x87de('0x8'))(_0x87de('0x9'));function isActiveDirectoryConfigured(_0x153f2c){var _0x1f38a9=![];if(typeof _0x153f2c[_0x87de('0xa')]!==_0x87de('0xb')){_0x1f38a9=_0x153f2c['activedirectory'][_0x87de('0xc')]&&_0x153f2c[_0x87de('0xa')]['url']&&_0x153f2c[_0x87de('0xa')][_0x87de('0xd')];}return _0x1f38a9;}function adAuthenticate(_0x3dc540,_0x2332e6,_0x8150dd){return new BPromise(function(_0x44f3bc,_0x127495){try{var _0xcca57d=new ActiveDirectory(_0x3dc540);_0xcca57d[_0x87de('0xe')](_0x2332e6,_0x8150dd,function(_0x9ff3a,_0x2773a8){if(_0x9ff3a){logger['error'](_0x87de('0xf'),_0x2332e6,util['inspect'](_0x9ff3a,{'showHidden':![],'depth':null}));_0x127495('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x2773a8){logger[_0x87de('0x10')](_0x87de('0x11'),_0x2332e6);_0x127495(_0x87de('0x12'));}else{_0x44f3bc(_0x2773a8);}});}catch(_0x1c1b02){_0x127495(_0x1c1b02);}});}function ActiveDirectoryAuthenticate(_0x4ed36d,_0x10cb0e,_0x347d3d,_0x5eb575){var _0x398935,_0x409da1;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x87de('0x13'),_0x10cb0e);return _0x5eb575(null,![],{'message':_0x87de('0x12')});}return db[_0x87de('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0x87de('0x15'),_0x87de('0x16')],'raw':!![]})[_0x87de('0x17')](function(_0x11073a){_0x398935=_0x11073a;if(!_0x398935[_0x87de('0x15')]){logger[_0x87de('0x10')](_0x87de('0x18'),_0x10cb0e);throw new Error(_0x87de('0x12'));}return _0x4ed36d[_0x87de('0x19')]({'attributes':['id',_0x87de('0x1a'),_0x87de('0x1b'),'salt',_0x87de('0x1c'),'disabled',_0x87de('0x1d'),'blockedAt',_0x87de('0x1e')],'where':{'name':_0x10cb0e,'role':{'$or':['admin',_0x87de('0x1f'),_0x87de('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x4a7456){if(!_0x4a7456||_0x4a7456&&_0x4a7456[_0x87de('0x1a')]!==_0x10cb0e){throw new Error(_0x87de('0x12'));}_0x409da1=_0x4a7456;var _0x158c1b=_0x409da1[_0x87de('0x1a')]+'@'+config[_0x87de('0xa')][_0x87de('0xd')];return adAuthenticate(config['activedirectory'],_0x158c1b,_0x347d3d);})[_0x87de('0x17')](function(_0x4405a5){if(_0x409da1[_0x87de('0x21')]){throw new Error(_0x87de('0x12'));}if(_0x398935[_0x87de('0x16')]>0x0){if(_0x409da1['blocked']){if(moment(_0x409da1[_0x87de('0x22')])[_0x87de('0x23')](_0x398935[_0x87de('0x16')],_0x87de('0x24'))>moment()){throw new Error(_0x87de('0x12'));}return utils['clearBlockUser'](_0x409da1,0x0,![],null)['then'](function(){return utils[_0x87de('0x25')](_0x409da1);})['then'](function(){return _0x5eb575(null,_0x409da1);});}else{return utils[_0x87de('0x25')](_0x409da1)[_0x87de('0x17')](function(){return _0x5eb575(null,_0x409da1);});}}else{return utils[_0x87de('0x25')](_0x409da1)['then'](function(){return _0x5eb575(null,_0x409da1);});}})[_0x87de('0x26')](function(_0x4c27aa){return _0x5eb575(null,![],_0x4c27aa);});}function handleError(_0x5b4062,_0x3ab69a,_0x488b79){return _0x5b4062['status'](_0x3ab69a||0x1f4)[_0x87de('0x27')]({'message':_0x488b79?_0x488b79[_0x87de('0x28')]||_0x488b79:''});}exports[_0x87de('0x29')]=function(_0x460569,_0x2340f4,_0x5d72e9){passport['authenticate']('ad-login',function(_0x22e8de,_0x15b9c1,_0x516c89){var _0x2a94c2=_0x22e8de||_0x516c89;if(_0x2a94c2){return handleError(_0x2340f4,0x191,_0x2a94c2);}if(!_0x15b9c1){return handleError(_0x2340f4,0x194,{'message':_0x87de('0x2a')});}else{var _0x103af3={'payload':{'id':_0x15b9c1['id'],'role':_0x15b9c1[_0x87de('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x87de('0x2b')](_0x103af3)[_0x87de('0x17')](function(_0x59a4e8){_0x2340f4[_0x87de('0x2c')]({'id':_0x15b9c1['id'],'token':_0x59a4e8,'statusCall':'','isAlreadyLogged':_0x15b9c1[_0x87de('0x1e')]});});}})(_0x460569,_0x2340f4,_0x5d72e9);};passport['use'](_0x87de('0x2d'),new LocalStrategy({'usernameField':_0x87de('0x1a'),'passwordField':'password'},function(_0x4c00ce,_0xfa228,_0x5079b9){return ActiveDirectoryAuthenticate(db[_0x87de('0x2e')],_0x4c00ce,_0xfa228,_0x5079b9);})); \ No newline at end of file +var _0x0ef1=['api','undefined','activedirectory','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blockedAt','online','user','agent','then','domain','add','getLicense','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0ef1,0xea));var _0x10ef=function(_0x29bbf8,_0x59a34d){_0x29bbf8=_0x29bbf8-0x0;var _0x1185e7=_0x0ef1[_0x29bbf8];return _0x1185e7;};'use strict';var passport=require(_0x10ef('0x0'));var LocalStrategy=require(_0x10ef('0x1'))[_0x10ef('0x2')];var moment=require(_0x10ef('0x3'));var ActiveDirectory=require(_0x10ef('0x4'));var BPromise=require(_0x10ef('0x5'));var util=require(_0x10ef('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x10ef('0x7'));var utils=require(_0x10ef('0x8'));var config=require(_0x10ef('0x9'));var logger=require(_0x10ef('0xa'))(_0x10ef('0xb'));function isActiveDirectoryConfigured(_0x6a5b9b){var _0x4fd1ae=![];if(typeof _0x6a5b9b['activedirectory']!==_0x10ef('0xc')){_0x4fd1ae=_0x6a5b9b[_0x10ef('0xd')][_0x10ef('0xe')]&&_0x6a5b9b[_0x10ef('0xd')][_0x10ef('0xf')]&&_0x6a5b9b['activedirectory']['domain'];}return _0x4fd1ae;}function adAuthenticate(_0x2358be,_0x4058a0,_0x4f8029){return new BPromise(function(_0x3f74cf,_0x28deeb){try{var _0x168823=new ActiveDirectory(_0x2358be);_0x168823[_0x10ef('0x10')](_0x4058a0,_0x4f8029,function(_0xc3de39,_0x56996c){if(_0xc3de39){logger[_0x10ef('0x11')](_0x10ef('0x12'),_0x4058a0,util[_0x10ef('0x13')](_0xc3de39,{'showHidden':![],'depth':null}));_0x28deeb(_0x10ef('0x14'));}else if(!_0x56996c){logger[_0x10ef('0x11')](_0x10ef('0x15'),_0x4058a0);_0x28deeb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x3f74cf(_0x56996c);}});}catch(_0x319ed4){_0x28deeb(_0x319ed4);}});}function ActiveDirectoryAuthenticate(_0x4120c5,_0x6dc964,_0x46be3f,_0x456520){var _0x3c02a0,_0x25863e;if(!isActiveDirectoryConfigured(config)){logger[_0x10ef('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x6dc964);return _0x456520(null,![],{'message':_0x10ef('0x14')});}return db['Setting'][_0x10ef('0x16')]({'where':{'id':0x1},'attributes':[_0x10ef('0x17'),_0x10ef('0x18')],'raw':!![]})['then'](function(_0x4b063c){_0x3c02a0=_0x4b063c;if(!_0x3c02a0[_0x10ef('0x17')]){logger['error'](_0x10ef('0x19'),_0x6dc964);throw new Error(_0x10ef('0x14'));}return _0x4120c5[_0x10ef('0x16')]({'attributes':['id',_0x10ef('0x1a'),_0x10ef('0x1b'),_0x10ef('0x1c'),_0x10ef('0x1d'),_0x10ef('0x1e'),'blocked',_0x10ef('0x1f'),_0x10ef('0x20')],'where':{'name':_0x6dc964,'role':{'$or':['admin',_0x10ef('0x21'),_0x10ef('0x22')]},'adSsoEnabled':!![]}});})[_0x10ef('0x23')](function(_0x879036){if(!_0x879036||_0x879036&&_0x879036[_0x10ef('0x1a')]!==_0x6dc964){throw new Error(_0x10ef('0x14'));}_0x25863e=_0x879036;var _0x23a4dd=_0x25863e[_0x10ef('0x1a')]+'@'+config[_0x10ef('0xd')][_0x10ef('0x24')];return adAuthenticate(config[_0x10ef('0xd')],_0x23a4dd,_0x46be3f);})[_0x10ef('0x23')](function(_0x2b7a20){if(_0x25863e['disabled']){throw new Error(_0x10ef('0x14'));}if(_0x3c02a0[_0x10ef('0x18')]>0x0){if(_0x25863e['blocked']){if(moment(_0x25863e['blockedAt'])[_0x10ef('0x25')](_0x3c02a0[_0x10ef('0x18')],'minutes')>moment()){throw new Error(_0x10ef('0x14'));}return utils['clearBlockUser'](_0x25863e,0x0,![],null)['then'](function(){return utils['getLicense'](_0x25863e);})[_0x10ef('0x23')](function(){return _0x456520(null,_0x25863e);});}else{return utils[_0x10ef('0x26')](_0x25863e)[_0x10ef('0x23')](function(){return _0x456520(null,_0x25863e);});}}else{return utils['getLicense'](_0x25863e)[_0x10ef('0x23')](function(){return _0x456520(null,_0x25863e);});}})['catch'](function(_0x17f2ae){return _0x456520(null,![],_0x17f2ae);});}function handleError(_0x7696c,_0x33d433,_0x5c527a){return _0x7696c[_0x10ef('0x27')](_0x33d433||0x1f4)[_0x10ef('0x28')]({'message':_0x5c527a?_0x5c527a[_0x10ef('0x29')]||_0x5c527a:''});}exports[_0x10ef('0x2a')]=function(_0x337c65,_0x2555d5,_0x45682d){passport[_0x10ef('0x10')]('ad-login',function(_0x4e7e81,_0x3d9398,_0x4265af){var _0x1f54fc=_0x4e7e81||_0x4265af;if(_0x1f54fc){return handleError(_0x2555d5,0x191,_0x1f54fc);}if(!_0x3d9398){return handleError(_0x2555d5,0x194,{'message':_0x10ef('0x2b')});}else{var _0x100a5b={'payload':{'id':_0x3d9398['id'],'role':_0x3d9398[_0x10ef('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x10ef('0x2c')](_0x100a5b)[_0x10ef('0x23')](function(_0x4071ee){_0x2555d5[_0x10ef('0x2d')]({'id':_0x3d9398['id'],'token':_0x4071ee,'statusCall':'','isAlreadyLogged':_0x3d9398[_0x10ef('0x20')]});});}})(_0x337c65,_0x2555d5,_0x45682d);};passport[_0x10ef('0x2e')](_0x10ef('0x2f'),new LocalStrategy({'usernameField':_0x10ef('0x1a'),'passwordField':_0x10ef('0x1b')},function(_0x4eed0d,_0x23447f,_0x3c33e9){return ActiveDirectoryAuthenticate(db[_0x10ef('0x30')],_0x4eed0d,_0x23447f,_0x3c33e9);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 1805ce5..2ebca3e 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2b8=['express','./authActiveDirectory.controller','login','exports'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xd2b8,0xac));var _0x8d2b=function(_0x100a03,_0x50a8f7){_0x100a03=_0x100a03-0x0;var _0x118ce1=_0xd2b8[_0x100a03];return _0x118ce1;};'use strict';var express=require(_0x8d2b('0x0'));var router=express['Router']();var controller=require(_0x8d2b('0x1'));router['post']('/',controller[_0x8d2b('0x2')]);module[_0x8d2b('0x3')]=router; \ No newline at end of file +var _0xb31e=['./authActiveDirectory.controller','exports','express','Router'];(function(_0x19bf7f,_0x54e4cf){var _0xadae96=function(_0x49acb4){while(--_0x49acb4){_0x19bf7f['push'](_0x19bf7f['shift']());}};_0xadae96(++_0x54e4cf);}(_0xb31e,0x12a));var _0xeb31=function(_0x48ea41,_0x437e68){_0x48ea41=_0x48ea41-0x0;var _0xb589f4=_0xb31e[_0x48ea41];return _0xb589f4;};'use strict';var express=require(_0xeb31('0x0'));var router=express[_0xeb31('0x1')]();var controller=require(_0xeb31('0x2'));router['post']('/',controller['login']);module[_0xeb31('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c0eb008..8aa3e34 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x7a54,0x106));var _0x47a5=function(_0x4796fc,_0x24556c){_0x4796fc=_0x4796fc-0x0;var _0x74360d=_0x7a54[_0x4796fc];return _0x74360d;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x7a54,0x106));var _0x47a5=function(_0x134017,_0x257cfc){_0x134017=_0x134017-0x0;var _0x204354=_0x7a54[_0x134017];return _0x204354;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 09054c3..d3d4b62 100644 --- a/server/api/authGoogle/index.js +++ b/server/api/authGoogle/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5231=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','setTokenCookie','exports','express'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0x5231,0x1af));var _0x1523=function(_0x56cacd,_0x10fb73){_0x56cacd=_0x56cacd-0x0;var _0x11ffdc=_0x5231[_0x56cacd];return _0x11ffdc;};'use strict';var express=require(_0x1523('0x0'));var passport=require(_0x1523('0x1'));var router=express[_0x1523('0x2')]();var controller=require(_0x1523('0x3'));var userController=require(_0x1523('0x4'));var authService=require(_0x1523('0x5'));router[_0x1523('0x6')]('/',controller[_0x1523('0x7')]);router[_0x1523('0x6')](_0x1523('0x8'),controller[_0x1523('0x9')],authService['isMiddleware'],userController[_0x1523('0x7')],authService[_0x1523('0xa')]);module[_0x1523('0xb')]=router; \ No newline at end of file +var _0x7def=['login','/callback','callback','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller','../../components/auth/service','get'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x7def,0x74));var _0xf7de=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7def[_0xdc37a1];return _0x99b4fe;};'use strict';var express=require(_0xf7de('0x0'));var passport=require('passport');var router=express[_0xf7de('0x1')]();var controller=require(_0xf7de('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xf7de('0x3'));router[_0xf7de('0x4')]('/',controller[_0xf7de('0x5')]);router[_0xf7de('0x4')](_0xf7de('0x6'),controller[_0xf7de('0x7')],authService[_0xf7de('0x8')],userController[_0xf7de('0x5')],authService[_0xf7de('0x9')]);module[_0xf7de('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6ea0e8f..37d08e0 100644 --- a/server/api/authLocal/authLocal.controller.js +++ b/server/api/authLocal/authLocal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x858a=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordToken','use','local-login','util','passport','passport-local','Strategy','lodash','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','password','salt','role','disabled','blocked','loginAttempts','admin','user','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','send','message','login','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x858a,0x191));var _0xa858=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x858a[_0x18ab2a];return _0x16dcee;};'use strict';var util=require(_0xa858('0x0'));var passport=require(_0xa858('0x1'));var LocalStrategy=require(_0xa858('0x2'))[_0xa858('0x3')];var jayson=require('jayson/promise');var _=require(_0xa858('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require(_0xa858('0x5'))['db'];var authService=require(_0xa858('0x6'));var utils=require(_0xa858('0x7'));var client=jayson['client'][_0xa858('0x8')]({'port':0x232b});function localAuthenticate(_0x574e0e,_0x1f42e2,_0x572f97,_0x6ae260){var _0x9380a8,_0x1b542c;return db[_0xa858('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xa858('0xa'),_0xa858('0xb')],'raw':!![]})[_0xa858('0xc')](function(_0x296951){_0x9380a8=_0x296951;return _0x574e0e[_0xa858('0xd')]({'attributes':['id','name',_0xa858('0xe'),_0xa858('0xf'),_0xa858('0x10'),_0xa858('0x11'),_0xa858('0x12'),'blockedAt',_0xa858('0x13')],'where':{'name':_0x1f42e2,'role':{'$or':[_0xa858('0x14'),_0xa858('0x15'),'agent']}}});})[_0xa858('0xc')](function(_0x29bbdb){if(!_0x29bbdb||_0x29bbdb&&_0x29bbdb[_0xa858('0x16')]!==_0x1f42e2){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1b542c=_0x29bbdb;return _0x1b542c;}})['then'](function(){_0x1b542c[_0xa858('0x17')](_0x572f97,function(_0x349867,_0x5cbc03){var _0x29a5fc=_0x1b542c['loginAttempts']+0x1;if(_0x349867){return _0x6ae260(_0x349867);}else if(!_0x5cbc03){if(_0x1b542c[_0xa858('0x11')]){return _0x6ae260(null,![],{'message':_0xa858('0x18')});}else if(_0x9380a8[_0xa858('0xa')]>0x0){if(_0x1b542c['blocked']){if(_0x9380a8[_0xa858('0xb')]>0x0){if(moment(_0x1b542c[_0xa858('0x19')])['add'](_0x9380a8[_0xa858('0xb')],_0xa858('0x1a'))>moment()){return _0x6ae260(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x1b542c,_0x29a5fc,![],null)[_0xa858('0xc')](function(){return _0x6ae260(null,![],{'message':_0xa858('0x18')});});}}else{return _0x6ae260(null,![],{'message':_0xa858('0x18')});}}else{if(_0x29a5fc>=_0x9380a8[_0xa858('0xa')]){return utils['clearBlockUser'](_0x1b542c,0x0,!![],moment())[_0xa858('0xc')](function(){return _0x6ae260(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xa858('0x1b')](_0x1b542c,_0x29a5fc,![],null)['then'](function(){return _0x6ae260(null,![],{'message':_0xa858('0x18')});});}}}else{return _0x6ae260(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x1b542c[_0xa858('0x11')]){return _0x6ae260(null,![],{'message':_0xa858('0x18')});}else if(_0x9380a8[_0xa858('0xa')]>0x0){if(_0x1b542c[_0xa858('0x12')]){if(_0x9380a8['blockDuration']>0x0){if(moment(_0x1b542c[_0xa858('0x19')])[_0xa858('0x1c')](_0x9380a8[_0xa858('0xb')],'minutes')>moment()){return _0x6ae260(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa858('0x1b')](_0x1b542c,0x0,![],null)['then'](function(){return utils['getLicense'](_0x1b542c);})[_0xa858('0xc')](function(){return _0x6ae260(null,_0x1b542c);});}}else{return _0x6ae260(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xa858('0x1b')](_0x1b542c,0x0,![],null)[_0xa858('0xc')](function(){return utils[_0xa858('0x1d')](_0x1b542c);})[_0xa858('0xc')](function(){return _0x6ae260(null,_0x1b542c);})[_0xa858('0x1e')](function(_0x39a3ef){return _0x6ae260(null,![],_0x39a3ef);});}}else{if(_0x1b542c['blocked']){return _0x6ae260(null,![],{'message':_0xa858('0x18')});}else{return utils[_0xa858('0x1d')](_0x1b542c)[_0xa858('0xc')](function(){return _0x6ae260(null,_0x1b542c);});}}}});})[_0xa858('0x1e')](function(_0x4963f1){return _0x6ae260(null,![],_0x4963f1);});}function sendServiceMail(_0x6257f3){return db[_0xa858('0x1f')][_0xa858('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0xa858('0x21')],'include':[{'model':db[_0xa858('0x22')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x5013f3){if(!_0x5013f3){throw new Error(_0xa858('0x23'));}var _0x118a0e=_0x5013f3[_0xa858('0x24')]();var _0x996c27={'account':_0x118a0e,'message':_['merge']({'from':util[_0xa858('0x25')](_0xa858('0x26'),_0x5013f3[_0xa858('0x16')],_0x5013f3[_0xa858('0x21')]||_0x5013f3[_0xa858('0x27')][_0xa858('0x15')])},_0x6257f3)};return client[_0xa858('0x28')](_0xa858('0x29'),_0x996c27);})['then'](function(_0x15b317){if(_0x15b317[_0xa858('0x2a')]){throw new Error(util[_0xa858('0x25')](_0xa858('0x2b'),_0x15b317[_0xa858('0x2a')]['message']||JSON[_0xa858('0x2c')](_0x15b317['error'])));}return!![];});}function handleError(_0x2a85d6,_0x797d59,_0x38d42f){return _0x2a85d6['status'](_0x797d59||0x1f4)[_0xa858('0x2d')]({'message':_0x38d42f?_0x38d42f[_0xa858('0x2e')]||_0x38d42f:''});}exports[_0xa858('0x2f')]=function(_0x1b78ef,_0x280cdf,_0x4da6d4){passport[_0xa858('0x17')]('local-login',function(_0x470c99,_0x2a76ba,_0x3c161e){var _0x185640=_0x470c99||_0x3c161e;if(_0x185640){return handleError(_0x280cdf,0x191,_0x185640);}if(!_0x2a76ba){return handleError(_0x280cdf,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2dee6f={'payload':{'id':_0x2a76ba['id'],'role':_0x2a76ba[_0xa858('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2dee6f)[_0xa858('0xc')](function(_0x305928){_0x280cdf['json']({'id':_0x2a76ba['id'],'token':_0x305928,'statusCall':'','isAlreadyLogged':_0x2a76ba[_0xa858('0x30')]});});}})(_0x1b78ef,_0x280cdf,_0x4da6d4);};exports[_0xa858('0x31')]=function(_0x410fec,_0x517e0d){if(!_0x410fec[_0xa858('0x32')]['email']){return handleError(_0x517e0d,0x1f4,{'message':_0xa858('0x33')});}var _0x4191ac=rs[_0xa858('0x34')]();_0x410fec[_0xa858('0x32')][_0xa858('0x21')]=_0x410fec[_0xa858('0x32')][_0xa858('0x21')][_0xa858('0x35')]()['toLowerCase']();var _0x1c9694;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xa858('0xa'),_0xa858('0xb')],'raw':!![]})[_0xa858('0xc')](function(_0x3c8969){_0x1c9694=_0x3c8969;return db[_0xa858('0x36')]['find']({'where':{'email':_0x410fec[_0xa858('0x32')][_0xa858('0x21')]}});})[_0xa858('0xc')](function(_0x193826){if(!_0x193826){throw new Error(_0xa858('0x37'));}if(_0x193826[_0xa858('0x11')]){throw new Error(_0xa858('0x38'));}if(_0x193826[_0xa858('0x12')]){if(moment(_0x193826['blockedAt'])['add'](_0x1c9694[_0xa858('0xb')],_0xa858('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x193826[_0xa858('0x12')]=![];_0x193826[_0xa858('0x19')]=null;}}_0x193826['resetPasswordToken']=_0x4191ac;_0x193826[_0xa858('0x39')]=Date[_0xa858('0x3a')]()+0x36ee80;return _0x193826[_0xa858('0x3b')]();})[_0xa858('0xc')](function(){return sendServiceMail({'to':_0x410fec['body'][_0xa858('0x21')],'subject':_0xa858('0x3c'),'text':_0xa858('0x3d')+_0xa858('0x3e')+'https://'+_0x410fec[_0xa858('0x3f')]['host']+'/reset/'+_0x4191ac+'\x0a\x0a'+_0xa858('0x40')});})[_0xa858('0xc')](function(){_0x517e0d[_0xa858('0x41')](0xc8)[_0xa858('0x2d')]({'message':_0xa858('0x42')});})[_0xa858('0x1e')](function(_0x797675){return handleError(_0x517e0d,0x1f4,_0x797675);});};exports[_0xa858('0x43')]=function(_0x390a21,_0x2de2b2){return db[_0xa858('0x36')][_0xa858('0x20')]({'where':{'resetPasswordToken':_0x390a21[_0xa858('0x44')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xa858('0xc')](function(_0x36f662){if(!_0x36f662){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xa858('0x9')]['findOne']({'attributes':['id',_0xa858('0x45'),_0xa858('0x46'),_0xa858('0x47')]})['then'](function(_0x392a80){if(_0x392a80[_0xa858('0x45')])authService['validatePasswordPattern'](_0x390a21['body']['password']);if(!_0x392a80[_0xa858('0x46')]||!_0x36f662[_0xa858('0x48')])return _0x36f662;authService[_0xa858('0x49')](_0x390a21[_0xa858('0x32')][_0xa858('0xe')],_0x36f662['previousPasswords'],_0x392a80[_0xa858('0x47')]);return _0x36f662;})[_0xa858('0xc')](function(){_0x36f662['password']=_0x390a21[_0xa858('0x32')][_0xa858('0xe')];_0x36f662[_0xa858('0x4a')]=null;_0x36f662[_0xa858('0x39')]=null;return _0x36f662['save']();});})[_0xa858('0xc')](function(){_0x2de2b2[_0xa858('0x41')](0xc8)[_0xa858('0x2d')]({'message':'Password\x20reset!'});})['catch'](function(_0x389bd3){return handleError(_0x2de2b2,0x1f4,_0x389bd3);});};passport[_0xa858('0x4b')](_0xa858('0x4c'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x22b280,_0x3bd78c,_0x42cab){return localAuthenticate(db[_0xa858('0x36')],_0x22b280,_0x3bd78c,_0x42cab);})); \ No newline at end of file +var _0xc2e6=['headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','validatePasswordHistory','use','local-login','util','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','user','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://'];(function(_0x41a642,_0x50a513){var _0x4491b0=function(_0xc81c89){while(--_0xc81c89){_0x41a642['push'](_0x41a642['shift']());}};_0x4491b0(++_0x50a513);}(_0xc2e6,0xb4));var _0x6c2e=function(_0x5714c8,_0x5f77fe){_0x5714c8=_0x5714c8-0x0;var _0x1c2adc=_0xc2e6[_0x5714c8];return _0x1c2adc;};'use strict';var util=require(_0x6c2e('0x0'));var passport=require(_0x6c2e('0x1'));var LocalStrategy=require('passport-local')[_0x6c2e('0x2')];var jayson=require(_0x6c2e('0x3'));var _=require(_0x6c2e('0x4'));var rs=require(_0x6c2e('0x5'));var moment=require(_0x6c2e('0x6'));var db=require(_0x6c2e('0x7'))['db'];var authService=require(_0x6c2e('0x8'));var utils=require('../../config/utils');var client=jayson[_0x6c2e('0x9')][_0x6c2e('0xa')]({'port':0x232b});function localAuthenticate(_0x3f1753,_0x2d390b,_0xbd051a,_0xd59b84){var _0x169c89,_0x139517;return db[_0x6c2e('0xb')][_0x6c2e('0xc')]({'where':{'id':0x1},'attributes':[_0x6c2e('0xd'),_0x6c2e('0xe')],'raw':!![]})[_0x6c2e('0xf')](function(_0x10158b){_0x169c89=_0x10158b;return _0x3f1753[_0x6c2e('0xc')]({'attributes':['id',_0x6c2e('0x10'),_0x6c2e('0x11'),_0x6c2e('0x12'),_0x6c2e('0x13'),_0x6c2e('0x14'),_0x6c2e('0x15'),'blockedAt',_0x6c2e('0x16')],'where':{'name':_0x2d390b,'role':{'$or':[_0x6c2e('0x17'),'user',_0x6c2e('0x18')]}}});})[_0x6c2e('0xf')](function(_0x41c2e4){if(!_0x41c2e4||_0x41c2e4&&_0x41c2e4['name']!==_0x2d390b){throw new Error(_0x6c2e('0x19'));}else{_0x139517=_0x41c2e4;return _0x139517;}})[_0x6c2e('0xf')](function(){_0x139517[_0x6c2e('0x1a')](_0xbd051a,function(_0x9fa765,_0x31d46e){var _0xb749f2=_0x139517['loginAttempts']+0x1;if(_0x9fa765){return _0xd59b84(_0x9fa765);}else if(!_0x31d46e){if(_0x139517[_0x6c2e('0x14')]){return _0xd59b84(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x169c89[_0x6c2e('0xd')]>0x0){if(_0x139517[_0x6c2e('0x15')]){if(_0x169c89[_0x6c2e('0xe')]>0x0){if(moment(_0x139517[_0x6c2e('0x1b')])['add'](_0x169c89['blockDuration'],_0x6c2e('0x1c'))>moment()){return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});}else{return utils[_0x6c2e('0x1d')](_0x139517,_0xb749f2,![],null)[_0x6c2e('0xf')](function(){return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});});}}else{return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});}}else{if(_0xb749f2>=_0x169c89[_0x6c2e('0xd')]){return utils[_0x6c2e('0x1d')](_0x139517,0x0,!![],moment())[_0x6c2e('0xf')](function(){return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});});}else{return utils['clearBlockUser'](_0x139517,_0xb749f2,![],null)[_0x6c2e('0xf')](function(){return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});});}}}else{return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});}}else{if(_0x139517[_0x6c2e('0x14')]){return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});}else if(_0x169c89[_0x6c2e('0xd')]>0x0){if(_0x139517[_0x6c2e('0x15')]){if(_0x169c89[_0x6c2e('0xe')]>0x0){if(moment(_0x139517[_0x6c2e('0x1b')])[_0x6c2e('0x1e')](_0x169c89[_0x6c2e('0xe')],_0x6c2e('0x1c'))>moment()){return _0xd59b84(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x6c2e('0x1d')](_0x139517,0x0,![],null)['then'](function(){return utils['getLicense'](_0x139517);})[_0x6c2e('0xf')](function(){return _0xd59b84(null,_0x139517);});}}else{return _0xd59b84(null,![],{'message':_0x6c2e('0x19')});}}else{return utils[_0x6c2e('0x1d')](_0x139517,0x0,![],null)[_0x6c2e('0xf')](function(){return utils[_0x6c2e('0x1f')](_0x139517);})['then'](function(){return _0xd59b84(null,_0x139517);})[_0x6c2e('0x20')](function(_0x3d7cbf){return _0xd59b84(null,![],_0x3d7cbf);});}}else{if(_0x139517[_0x6c2e('0x15')]){return _0xd59b84(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x6c2e('0x1f')](_0x139517)[_0x6c2e('0xf')](function(){return _0xd59b84(null,_0x139517);});}}}});})['catch'](function(_0x17fe80){return _0xd59b84(null,![],_0x17fe80);});}function sendServiceMail(_0x530766){return db[_0x6c2e('0x21')][_0x6c2e('0x22')]({'where':{'service':!![]},'attributes':['id',_0x6c2e('0x10'),_0x6c2e('0x23')],'include':[{'model':db[_0x6c2e('0x24')],'as':'Smtp','include':[{'model':db[_0x6c2e('0x25')],'as':_0x6c2e('0x25')}]}]})[_0x6c2e('0xf')](function(_0x545589){if(!_0x545589){throw new Error(_0x6c2e('0x26'));}var _0x465197=_0x545589[_0x6c2e('0x27')]();var _0x2baff6={'account':_0x465197,'message':_[_0x6c2e('0x28')]({'from':util[_0x6c2e('0x29')](_0x6c2e('0x2a'),_0x545589[_0x6c2e('0x10')],_0x545589[_0x6c2e('0x23')]||_0x545589[_0x6c2e('0x2b')][_0x6c2e('0x2c')])},_0x530766)};return client[_0x6c2e('0x2d')](_0x6c2e('0x2e'),_0x2baff6);})[_0x6c2e('0xf')](function(_0x49ebbb){if(_0x49ebbb['error']){throw new Error(util[_0x6c2e('0x29')](_0x6c2e('0x2f'),_0x49ebbb['error'][_0x6c2e('0x30')]||JSON['stringify'](_0x49ebbb['error'])));}return!![];});}function handleError(_0x32a1be,_0x2eafb4,_0x3ec7ff){return _0x32a1be[_0x6c2e('0x31')](_0x2eafb4||0x1f4)[_0x6c2e('0x32')]({'message':_0x3ec7ff?_0x3ec7ff[_0x6c2e('0x30')]||_0x3ec7ff:''});}exports[_0x6c2e('0x33')]=function(_0xc83d18,_0x3cb367,_0x56cdf3){passport[_0x6c2e('0x1a')]('local-login',function(_0x428b46,_0x4b40ef,_0x199d0f){var _0x19f07a=_0x428b46||_0x199d0f;if(_0x19f07a){return handleError(_0x3cb367,0x191,_0x19f07a);}if(!_0x4b40ef){return handleError(_0x3cb367,0x194,{'message':_0x6c2e('0x34')});}else{var _0x447792={'payload':{'id':_0x4b40ef['id'],'role':_0x4b40ef[_0x6c2e('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0x6c2e('0x35')](_0x447792)['then'](function(_0x5916d8){_0x3cb367[_0x6c2e('0x36')]({'id':_0x4b40ef['id'],'token':_0x5916d8,'statusCall':'','isAlreadyLogged':_0x4b40ef[_0x6c2e('0x37')]});});}})(_0xc83d18,_0x3cb367,_0x56cdf3);};exports[_0x6c2e('0x38')]=function(_0x2a10bd,_0x464c56){if(!_0x2a10bd[_0x6c2e('0x39')][_0x6c2e('0x23')]){return handleError(_0x464c56,0x1f4,{'message':_0x6c2e('0x3a')});}var _0x3b6005=rs['generate']();_0x2a10bd[_0x6c2e('0x39')][_0x6c2e('0x23')]=_0x2a10bd[_0x6c2e('0x39')][_0x6c2e('0x23')][_0x6c2e('0x3b')]()['toLowerCase']();var _0x548f8f;return db['Setting'][_0x6c2e('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x6c2e('0xe')],'raw':!![]})['then'](function(_0x29b964){_0x548f8f=_0x29b964;return db[_0x6c2e('0x3c')][_0x6c2e('0x22')]({'where':{'email':_0x2a10bd['body'][_0x6c2e('0x23')]}});})[_0x6c2e('0xf')](function(_0x597ec8){if(!_0x597ec8){throw new Error(_0x6c2e('0x3d'));}if(_0x597ec8['disabled']){throw new Error(_0x6c2e('0x3e'));}if(_0x597ec8[_0x6c2e('0x15')]){if(moment(_0x597ec8['blockedAt'])[_0x6c2e('0x1e')](_0x548f8f[_0x6c2e('0xe')],_0x6c2e('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x597ec8[_0x6c2e('0x15')]=![];_0x597ec8['blockedAt']=null;}}_0x597ec8[_0x6c2e('0x3f')]=_0x3b6005;_0x597ec8['resetPasswordExpires']=Date[_0x6c2e('0x40')]()+0x36ee80;return _0x597ec8[_0x6c2e('0x41')]();})[_0x6c2e('0xf')](function(){return sendServiceMail({'to':_0x2a10bd[_0x6c2e('0x39')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x6c2e('0x42')+_0x6c2e('0x43')+_0x6c2e('0x44')+_0x2a10bd[_0x6c2e('0x45')]['host']+_0x6c2e('0x46')+_0x3b6005+'\x0a\x0a'+_0x6c2e('0x47')});})[_0x6c2e('0xf')](function(){_0x464c56[_0x6c2e('0x31')](0xc8)[_0x6c2e('0x32')]({'message':_0x6c2e('0x48')});})[_0x6c2e('0x20')](function(_0x26f2d8){return handleError(_0x464c56,0x1f4,_0x26f2d8);});};exports['reset']=function(_0x4f792e,_0xdc76f9){return db[_0x6c2e('0x3c')]['find']({'where':{'resetPasswordToken':_0x4f792e[_0x6c2e('0x49')][_0x6c2e('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x6c2e('0xf')](function(_0x4cb955){if(!_0x4cb955){throw new Error(_0x6c2e('0x4b'));}return db[_0x6c2e('0xb')][_0x6c2e('0xc')]({'attributes':['id','securePassword',_0x6c2e('0x4c'),_0x6c2e('0x4d')]})[_0x6c2e('0xf')](function(_0xb45f67){if(_0xb45f67[_0x6c2e('0x4e')])authService[_0x6c2e('0x4f')](_0x4f792e[_0x6c2e('0x39')][_0x6c2e('0x11')]);if(!_0xb45f67[_0x6c2e('0x4c')]||!_0x4cb955['previousPasswords'])return _0x4cb955;authService[_0x6c2e('0x50')](_0x4f792e[_0x6c2e('0x39')][_0x6c2e('0x11')],_0x4cb955['previousPasswords'],_0xb45f67[_0x6c2e('0x4d')]);return _0x4cb955;})['then'](function(){_0x4cb955[_0x6c2e('0x11')]=_0x4f792e[_0x6c2e('0x39')][_0x6c2e('0x11')];_0x4cb955[_0x6c2e('0x3f')]=null;_0x4cb955['resetPasswordExpires']=null;return _0x4cb955['save']();});})[_0x6c2e('0xf')](function(){_0xdc76f9[_0x6c2e('0x31')](0xc8)[_0x6c2e('0x32')]({'message':'Password\x20reset!'});})[_0x6c2e('0x20')](function(_0x2d2070){return handleError(_0xdc76f9,0x1f4,_0x2d2070);});};passport[_0x6c2e('0x51')](_0x6c2e('0x52'),new LocalStrategy({'usernameField':_0x6c2e('0x10'),'passwordField':_0x6c2e('0x11')},function(_0xabbbc4,_0x521d94,_0x86881d){return localAuthenticate(db['User'],_0xabbbc4,_0x521d94,_0x86881d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a6518cd..0f41f6b 100644 --- a/server/api/authLocal/index.js +++ b/server/api/authLocal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25a8=['express','./authLocal.controller','/forgot','forgot','post','/reset/:token','reset','exports'];(function(_0x3d1ae4,_0x2857b4){var _0x2a7dee=function(_0x4d178f){while(--_0x4d178f){_0x3d1ae4['push'](_0x3d1ae4['shift']());}};_0x2a7dee(++_0x2857b4);}(_0x25a8,0x1a8));var _0x825a=function(_0x3f3724,_0x4ddfe8){_0x3f3724=_0x3f3724-0x0;var _0x324c7f=_0x25a8[_0x3f3724];return _0x324c7f;};'use strict';var express=require(_0x825a('0x0'));var router=express['Router']();var controller=require(_0x825a('0x1'));router['post']('/',controller['login']);router['post'](_0x825a('0x2'),controller[_0x825a('0x3')]);router[_0x825a('0x4')](_0x825a('0x5'),controller[_0x825a('0x6')]);module[_0x825a('0x7')]=router; \ No newline at end of file +var _0x3f9a=['reset','exports','express','Router','./authLocal.controller','post','login','forgot','/reset/:token'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x3f9a,0xc8));var _0xa3f9=function(_0x23e6db,_0x30daad){_0x23e6db=_0x23e6db-0x0;var _0x5c7bba=_0x3f9a[_0x23e6db];return _0x5c7bba;};'use strict';var express=require(_0xa3f9('0x0'));var router=express[_0xa3f9('0x1')]();var controller=require(_0xa3f9('0x2'));router[_0xa3f9('0x3')]('/',controller[_0xa3f9('0x4')]);router[_0xa3f9('0x3')]('/forgot',controller[_0xa3f9('0x5')]);router[_0xa3f9('0x3')](_0xa3f9('0x6'),controller[_0xa3f9('0x7')]);module[_0xa3f9('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ca9def7..e78afa6 100644 --- a/server/api/automation/automation.attributes.js +++ b/server/api/automation/automation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06ed=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x92fb0c,_0x5446af){var _0x4204c4=function(_0x534325){while(--_0x534325){_0x92fb0c['push'](_0x92fb0c['shift']());}};_0x4204c4(++_0x5446af);}(_0x06ed,0x1cd));var _0xd06e=function(_0x268bfc,_0x230a15){_0x268bfc=_0x268bfc-0x0;var _0xf47822=_0x06ed[_0x268bfc];return _0xf47822;};'use strict';var Sequelize=require(_0xd06e('0x0'));module[_0xd06e('0x1')]={'name':{'type':Sequelize[_0xd06e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd06e('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xd06e('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd06e('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x476a=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x5743e3,_0x4a2aab){var _0x24d100=function(_0x10737c){while(--_0x10737c){_0x5743e3['push'](_0x5743e3['shift']());}};_0x24d100(++_0x4a2aab);}(_0x476a,0x1bb));var _0xa476=function(_0x172bb3,_0x38b59c){_0x172bb3=_0x172bb3-0x0;var _0x56c8ed=_0x476a[_0x172bb3];return _0x56c8ed;};'use strict';var Sequelize=require(_0xa476('0x0'));module[_0xa476('0x1')]={'name':{'type':Sequelize[_0xa476('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa476('0x2')]},'status':{'type':Sequelize[_0xa476('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa476('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 5986fec..ca90cde 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bf0=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','Automation','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','addConditions','ids','omit','getConditions','Condition','pick','addActions','Action','getActions','findOne','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x5bf0,0x98));var _0x05bf=function(_0x1c8606,_0x3b75f9){_0x1c8606=_0x1c8606-0x0;var _0x58ff61=_0x5bf0[_0x1c8606];return _0x58ff61;};'use strict';var emlformat=require(_0x05bf('0x0'));var rimraf=require(_0x05bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x05bf('0x2'));var moment=require(_0x05bf('0x3'));var BPromise=require(_0x05bf('0x4'));var Mustache=require(_0x05bf('0x5'));var util=require('util');var path=require(_0x05bf('0x6'));var sox=require(_0x05bf('0x7'));var csv=require(_0x05bf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05bf('0x9'));var _=require(_0x05bf('0xa'));var squel=require(_0x05bf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x05bf('0xc'));var toCsv=require(_0x05bf('0x8'));var querystring=require(_0x05bf('0xd'));var Papa=require('papaparse');var Redis=require(_0x05bf('0xe'));var authService=require(_0x05bf('0xf'));var qs=require(_0x05bf('0x10'));var as=require(_0x05bf('0x11'));var hardwareService=require(_0x05bf('0x12'));var logger=require(_0x05bf('0x13'))(_0x05bf('0x14'));var utils=require(_0x05bf('0x15'));var config=require(_0x05bf('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55c98e,_0x145006){_0x145006=_0x145006||0xcc;return function(_0xfbaea8){if(_0xfbaea8){return _0x55c98e[_0x05bf('0x17')](_0x145006);}return _0x55c98e[_0x05bf('0x18')](_0x145006)[_0x05bf('0x19')]();};}function respondWithResult(_0x544791,_0x21ea0f){_0x21ea0f=_0x21ea0f||0xc8;return function(_0x95b719){if(_0x95b719){return _0x544791[_0x05bf('0x18')](_0x21ea0f)[_0x05bf('0x1a')](_0x95b719);}};}function respondWithFilteredResult(_0x5a1dd8,_0x65481f){return function(_0x3eb6cf){if(_0x3eb6cf){var _0x4a8886=typeof _0x65481f[_0x05bf('0x1b')]===_0x05bf('0x1c')&&typeof _0x65481f['limit']===_0x05bf('0x1c');var _0x1b300a=_0x3eb6cf[_0x05bf('0x1d')];var _0x409d0b=_0x4a8886?0x0:_0x65481f[_0x05bf('0x1b')];var _0x48cdb4=_0x4a8886?_0x3eb6cf[_0x05bf('0x1d')]:_0x65481f[_0x05bf('0x1b')]+_0x65481f[_0x05bf('0x1e')];var _0x234918;if(_0x48cdb4>=_0x1b300a){_0x48cdb4=_0x1b300a;_0x234918=0xc8;}else{_0x234918=0xce;}_0x5a1dd8[_0x05bf('0x18')](_0x234918);return _0x5a1dd8[_0x05bf('0x1f')](_0x05bf('0x20'),_0x409d0b+'-'+_0x48cdb4+'/'+_0x1b300a)['json'](_0x3eb6cf);}return null;};}function patchUpdates(_0x50afb8){return function(_0x8478ec){try{jsonpatch['apply'](_0x8478ec,_0x50afb8,!![]);}catch(_0x824e99){return BPromise[_0x05bf('0x21')](_0x824e99);}return _0x8478ec[_0x05bf('0x22')]();};}function saveUpdates(_0x394e2b,_0x24a484){return function(_0x59a816){if(_0x59a816){return _0x59a816[_0x05bf('0x23')](_0x394e2b)[_0x05bf('0x24')](function(_0x2e0bce){return _0x2e0bce;});}return null;};}function removeEntity(_0xaa91cc,_0x49a027){return function(_0x2654b1){if(_0x2654b1){return _0x2654b1[_0x05bf('0x25')]()[_0x05bf('0x24')](function(){_0xaa91cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x546b15,_0x1701b2){return function(_0x1a1984){if(!_0x1a1984){_0x546b15[_0x05bf('0x17')](0x194);}return _0x1a1984;};}function handleError(_0x889a4e,_0x1dcf49){_0x1dcf49=_0x1dcf49||0x1f4;return function(_0x40f00b){logger[_0x05bf('0x26')](_0x40f00b[_0x05bf('0x27')]);if(_0x40f00b[_0x05bf('0x28')]){delete _0x40f00b[_0x05bf('0x28')];}_0x889a4e[_0x05bf('0x18')](_0x1dcf49)['send'](_0x40f00b);};}exports[_0x05bf('0x29')]=function(_0x2152c1,_0x4f1861){var _0x13e38c={},_0xbbbdd1={},_0x11f5d8={'count':0x0,'rows':[]};var _0x2d98d6=_[_0x05bf('0x2a')](db[_0x05bf('0x2b')]['rawAttributes'],function(_0x1fc136){return{'name':_0x1fc136[_0x05bf('0x2c')],'type':_0x1fc136[_0x05bf('0x2d')][_0x05bf('0x2e')]};});_0xbbbdd1[_0x05bf('0x2f')]=_[_0x05bf('0x2a')](_0x2d98d6,_0x05bf('0x28'));_0xbbbdd1[_0x05bf('0x30')]=_[_0x05bf('0x31')](_0x2152c1['query']);_0xbbbdd1[_0x05bf('0x32')]=_['intersection'](_0xbbbdd1[_0x05bf('0x2f')],_0xbbbdd1[_0x05bf('0x30')]);_0x13e38c[_0x05bf('0x33')]=_[_0x05bf('0x34')](_0xbbbdd1['model'],qs[_0x05bf('0x35')](_0x2152c1[_0x05bf('0x30')]['fields']));_0x13e38c[_0x05bf('0x33')]=_0x13e38c['attributes'][_0x05bf('0x36')]?_0x13e38c[_0x05bf('0x33')]:_0xbbbdd1[_0x05bf('0x2f')];if(!_0x2152c1[_0x05bf('0x30')][_0x05bf('0x37')](_0x05bf('0x38'))){_0x13e38c[_0x05bf('0x1e')]=qs['limit'](_0x2152c1[_0x05bf('0x30')][_0x05bf('0x1e')]);_0x13e38c[_0x05bf('0x1b')]=qs[_0x05bf('0x1b')](_0x2152c1[_0x05bf('0x30')]['offset']);}_0x13e38c[_0x05bf('0x39')]=qs[_0x05bf('0x3a')](_0x2152c1[_0x05bf('0x30')][_0x05bf('0x3a')]);_0x13e38c[_0x05bf('0x3b')]=qs[_0x05bf('0x32')](_['pick'](_0x2152c1[_0x05bf('0x30')],_0xbbbdd1[_0x05bf('0x32')]),_0x2d98d6);if(_0x2152c1[_0x05bf('0x30')][_0x05bf('0x3c')]){_0x13e38c[_0x05bf('0x3b')]=_['merge'](_0x13e38c[_0x05bf('0x3b')],{'$or':_[_0x05bf('0x2a')](_0x2d98d6,function(_0x121dda){if(_0x121dda[_0x05bf('0x2d')]!==_0x05bf('0x3d')){var _0x104ebb={};_0x104ebb[_0x121dda[_0x05bf('0x28')]]={'$like':'%'+_0x2152c1[_0x05bf('0x30')][_0x05bf('0x3c')]+'%'};return _0x104ebb;}})});}_0x13e38c=_[_0x05bf('0x3e')]({},_0x13e38c,_0x2152c1['options']);var _0x3eb50a={'where':_0x13e38c[_0x05bf('0x3b')]};return db[_0x05bf('0x2b')][_0x05bf('0x1d')](_0x3eb50a)['then'](function(_0x19c180){_0x11f5d8['count']=_0x19c180;if(_0x2152c1[_0x05bf('0x30')][_0x05bf('0x3f')]){_0x13e38c[_0x05bf('0x40')]=[{'all':!![]}];}return db[_0x05bf('0x2b')]['findAll'](_0x13e38c);})[_0x05bf('0x24')](function(_0x45aa2f){_0x11f5d8[_0x05bf('0x41')]=_0x45aa2f;return _0x11f5d8;})[_0x05bf('0x24')](respondWithFilteredResult(_0x4f1861,_0x13e38c))[_0x05bf('0x42')](handleError(_0x4f1861,null));};exports[_0x05bf('0x43')]=function(_0x1d6550,_0x3f1464){var _0x191425={'raw':![],'where':{'id':_0x1d6550[_0x05bf('0x44')]['id']}},_0x564ec4={};_0x564ec4[_0x05bf('0x2f')]=_['keys'](db[_0x05bf('0x2b')][_0x05bf('0x45')]);_0x564ec4[_0x05bf('0x30')]=_[_0x05bf('0x31')](_0x1d6550['query']);_0x564ec4[_0x05bf('0x32')]=_[_0x05bf('0x34')](_0x564ec4['model'],_0x564ec4[_0x05bf('0x30')]);_0x191425[_0x05bf('0x33')]=_[_0x05bf('0x34')](_0x564ec4['model'],qs[_0x05bf('0x35')](_0x1d6550[_0x05bf('0x30')][_0x05bf('0x35')]));_0x191425['attributes']=_0x191425[_0x05bf('0x33')][_0x05bf('0x36')]?_0x191425[_0x05bf('0x33')]:_0x564ec4[_0x05bf('0x2f')];if(_0x1d6550[_0x05bf('0x30')][_0x05bf('0x3f')]){_0x191425['include']=[{'all':!![]}];}_0x191425=_[_0x05bf('0x3e')]({},_0x191425,_0x1d6550[_0x05bf('0x46')]);return db['Automation'][_0x05bf('0x47')](_0x191425)[_0x05bf('0x24')](handleEntityNotFound(_0x3f1464,null))[_0x05bf('0x24')](respondWithResult(_0x3f1464,null))[_0x05bf('0x42')](handleError(_0x3f1464,null));};exports[_0x05bf('0x48')]=function(_0x4253c5,_0x48544b){return db['Automation'][_0x05bf('0x48')](_0x4253c5[_0x05bf('0x49')],{})['then'](respondWithResult(_0x48544b,0xc9))[_0x05bf('0x42')](handleError(_0x48544b,null));};exports[_0x05bf('0x23')]=function(_0x474058,_0x1c34cf){if(_0x474058[_0x05bf('0x49')]['id']){delete _0x474058[_0x05bf('0x49')]['id'];}return db[_0x05bf('0x2b')][_0x05bf('0x47')]({'where':{'id':_0x474058[_0x05bf('0x44')]['id']}})[_0x05bf('0x24')](handleEntityNotFound(_0x1c34cf,null))[_0x05bf('0x24')](saveUpdates(_0x474058['body'],null))[_0x05bf('0x24')](respondWithResult(_0x1c34cf,null))[_0x05bf('0x42')](handleError(_0x1c34cf,null));};exports['destroy']=function(_0x47c52b,_0x21621d){return db[_0x05bf('0x2b')]['find']({'where':{'id':_0x47c52b[_0x05bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x21621d,null))['then'](removeEntity(_0x21621d,null))[_0x05bf('0x42')](handleError(_0x21621d,null));};exports[_0x05bf('0x4a')]=function(_0x1d6885,_0x109387,_0xbfd6e0){return db['Condition'][_0x05bf('0x47')]({'where':{'id':_0x1d6885[_0x05bf('0x44')]['id']}})['then'](handleEntityNotFound(_0x109387,null))[_0x05bf('0x24')](function(_0x11b125){if(_0x11b125){return _0x11b125[_0x05bf('0x4a')](_0x1d6885[_0x05bf('0x49')][_0x05bf('0x4b')],_[_0x05bf('0x4c')](_0x1d6885[_0x05bf('0x49')],['ids','id'])||{});}})[_0x05bf('0x24')](respondWithResult(_0x109387,null))['catch'](handleError(_0x109387,null));};exports[_0x05bf('0x4d')]=function(_0x72156c,_0x5d99f5,_0x5daced){var _0x1133b9={};var _0x5730f2={};var _0xbe29cb;var _0x16088c;return db[_0x05bf('0x2b')]['findOne']({'where':{'id':_0x72156c[_0x05bf('0x44')]['id']}})[_0x05bf('0x24')](handleEntityNotFound(_0x5d99f5,null))[_0x05bf('0x24')](function(_0x14889d){if(_0x14889d){_0xbe29cb=_0x14889d;_0x5730f2[_0x05bf('0x2f')]=_[_0x05bf('0x31')](db[_0x05bf('0x4e')]['rawAttributes']);_0x5730f2['query']=_[_0x05bf('0x31')](_0x72156c[_0x05bf('0x30')]);_0x5730f2[_0x05bf('0x32')]=_[_0x05bf('0x34')](_0x5730f2['model'],_0x5730f2[_0x05bf('0x30')]);_0x1133b9[_0x05bf('0x33')]=_[_0x05bf('0x34')](_0x5730f2[_0x05bf('0x2f')],qs[_0x05bf('0x35')](_0x72156c[_0x05bf('0x30')][_0x05bf('0x35')]));_0x1133b9['attributes']=_0x1133b9[_0x05bf('0x33')]['length']?_0x1133b9[_0x05bf('0x33')]:_0x5730f2[_0x05bf('0x2f')];_0x1133b9[_0x05bf('0x39')]=qs[_0x05bf('0x3a')](_0x72156c[_0x05bf('0x30')][_0x05bf('0x3a')]);_0x1133b9['where']=qs[_0x05bf('0x32')](_[_0x05bf('0x4f')](_0x72156c[_0x05bf('0x30')],_0x5730f2[_0x05bf('0x32')]));if(_0x72156c[_0x05bf('0x30')]['filter']){_0x1133b9[_0x05bf('0x3b')]=_['merge'](_0x1133b9[_0x05bf('0x3b')],{'$or':_[_0x05bf('0x2a')](_0x1133b9[_0x05bf('0x33')],function(_0x5a1036){var _0x101806={};_0x101806[_0x5a1036]={'$like':'%'+_0x72156c[_0x05bf('0x30')]['filter']+'%'};return _0x101806;})});}_0x1133b9=_[_0x05bf('0x3e')]({},_0x1133b9,_0x72156c[_0x05bf('0x46')]);return _0xbe29cb['getConditions'](_0x1133b9);}})[_0x05bf('0x24')](function(_0x3b28e4){if(_0x3b28e4){_0x16088c=_0x3b28e4[_0x05bf('0x36')];if(!_0x72156c['query'][_0x05bf('0x37')](_0x05bf('0x38'))){_0x1133b9[_0x05bf('0x1e')]=qs[_0x05bf('0x1e')](_0x72156c[_0x05bf('0x30')][_0x05bf('0x1e')]);_0x1133b9[_0x05bf('0x1b')]=qs['offset'](_0x72156c[_0x05bf('0x30')][_0x05bf('0x1b')]);}return _0xbe29cb[_0x05bf('0x4d')](_0x1133b9);}})['then'](function(_0xf97bf7){if(_0xf97bf7){return _0xf97bf7?{'count':_0x16088c,'rows':_0xf97bf7}:null;}})[_0x05bf('0x24')](respondWithResult(_0x5d99f5,null))[_0x05bf('0x42')](handleError(_0x5d99f5,null));};exports[_0x05bf('0x50')]=function(_0x5c5737,_0x507e2a,_0x43e430){return db[_0x05bf('0x51')][_0x05bf('0x47')]({'where':{'id':_0x5c5737['params']['id']}})[_0x05bf('0x24')](handleEntityNotFound(_0x507e2a,null))[_0x05bf('0x24')](function(_0x1a4252){if(_0x1a4252){return _0x1a4252[_0x05bf('0x50')](_0x5c5737[_0x05bf('0x49')][_0x05bf('0x4b')],_['omit'](_0x5c5737[_0x05bf('0x49')],['ids','id'])||{});}})[_0x05bf('0x24')](respondWithResult(_0x507e2a,null))[_0x05bf('0x42')](handleError(_0x507e2a,null));};exports[_0x05bf('0x52')]=function(_0x56ba5f,_0x50cea7,_0x34edaf){var _0x5248db={};var _0x38a42d={};var _0x31df52;var _0x3b3a1f;return db[_0x05bf('0x2b')][_0x05bf('0x53')]({'where':{'id':_0x56ba5f[_0x05bf('0x44')]['id']}})[_0x05bf('0x24')](handleEntityNotFound(_0x50cea7,null))[_0x05bf('0x24')](function(_0x2ef8cb){if(_0x2ef8cb){_0x31df52=_0x2ef8cb;_0x38a42d['model']=_['keys'](db[_0x05bf('0x51')][_0x05bf('0x45')]);_0x38a42d['query']=_['keys'](_0x56ba5f[_0x05bf('0x30')]);_0x38a42d['filters']=_[_0x05bf('0x34')](_0x38a42d[_0x05bf('0x2f')],_0x38a42d[_0x05bf('0x30')]);_0x5248db[_0x05bf('0x33')]=_[_0x05bf('0x34')](_0x38a42d[_0x05bf('0x2f')],qs[_0x05bf('0x35')](_0x56ba5f[_0x05bf('0x30')][_0x05bf('0x35')]));_0x5248db[_0x05bf('0x33')]=_0x5248db[_0x05bf('0x33')][_0x05bf('0x36')]?_0x5248db[_0x05bf('0x33')]:_0x38a42d[_0x05bf('0x2f')];_0x5248db[_0x05bf('0x39')]=qs[_0x05bf('0x3a')](_0x56ba5f[_0x05bf('0x30')][_0x05bf('0x3a')]);_0x5248db[_0x05bf('0x3b')]=qs[_0x05bf('0x32')](_[_0x05bf('0x4f')](_0x56ba5f[_0x05bf('0x30')],_0x38a42d[_0x05bf('0x32')]));if(_0x56ba5f[_0x05bf('0x30')][_0x05bf('0x3c')]){_0x5248db[_0x05bf('0x3b')]=_[_0x05bf('0x3e')](_0x5248db[_0x05bf('0x3b')],{'$or':_[_0x05bf('0x2a')](_0x5248db[_0x05bf('0x33')],function(_0x3ae49f){var _0x26fd8b={};_0x26fd8b[_0x3ae49f]={'$like':'%'+_0x56ba5f[_0x05bf('0x30')]['filter']+'%'};return _0x26fd8b;})});}_0x5248db=_[_0x05bf('0x3e')]({},_0x5248db,_0x56ba5f[_0x05bf('0x46')]);return _0x31df52[_0x05bf('0x52')](_0x5248db);}})[_0x05bf('0x24')](function(_0x347ee9){if(_0x347ee9){_0x3b3a1f=_0x347ee9[_0x05bf('0x36')];if(!_0x56ba5f[_0x05bf('0x30')][_0x05bf('0x37')](_0x05bf('0x38'))){_0x5248db[_0x05bf('0x1e')]=qs[_0x05bf('0x1e')](_0x56ba5f[_0x05bf('0x30')][_0x05bf('0x1e')]);_0x5248db[_0x05bf('0x1b')]=qs['offset'](_0x56ba5f[_0x05bf('0x30')][_0x05bf('0x1b')]);}return _0x31df52[_0x05bf('0x52')](_0x5248db);}})['then'](function(_0x44a0db){if(_0x44a0db){return _0x44a0db?{'count':_0x3b3a1f,'rows':_0x44a0db}:null;}})[_0x05bf('0x24')](respondWithResult(_0x50cea7,null))[_0x05bf('0x42')](handleError(_0x50cea7,null));}; \ No newline at end of file +var _0x8f31=['key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','Automation','includeAll','include','findAll','rows','show','params','keys','merge','find','catch','create','body','Condition','ids','omit','getConditions','order','addActions','getActions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','name','send','index','rawAttributes','type'];(function(_0x5ad1d7,_0x2dd2cf){var _0xcf4632=function(_0x5f5d9e){while(--_0x5f5d9e){_0x5ad1d7['push'](_0x5ad1d7['shift']());}};_0xcf4632(++_0x2dd2cf);}(_0x8f31,0x112));var _0x18f3=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x8f31[_0x2af160];return _0x439d67;};'use strict';var emlformat=require(_0x18f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18f3('0x2'));var moment=require(_0x18f3('0x3'));var BPromise=require(_0x18f3('0x4'));var Mustache=require(_0x18f3('0x5'));var util=require(_0x18f3('0x6'));var path=require(_0x18f3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18f3('0x8'));var _=require(_0x18f3('0x9'));var squel=require(_0x18f3('0xa'));var crypto=require(_0x18f3('0xb'));var jsforce=require(_0x18f3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x18f3('0xd'));var querystring=require(_0x18f3('0xe'));var Papa=require('papaparse');var Redis=require(_0x18f3('0xf'));var authService=require(_0x18f3('0x10'));var qs=require(_0x18f3('0x11'));var as=require(_0x18f3('0x12'));var hardwareService=require(_0x18f3('0x13'));var logger=require('../../config/logger')(_0x18f3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x18f3('0x15'));var db=require(_0x18f3('0x16'))['db'];function respondWithStatusCode(_0x24e65e,_0x4c990a){_0x4c990a=_0x4c990a||0xcc;return function(_0x3d2265){if(_0x3d2265){return _0x24e65e[_0x18f3('0x17')](_0x4c990a);}return _0x24e65e[_0x18f3('0x18')](_0x4c990a)[_0x18f3('0x19')]();};}function respondWithResult(_0x3960b6,_0x46b99b){_0x46b99b=_0x46b99b||0xc8;return function(_0x1e64fc){if(_0x1e64fc){return _0x3960b6[_0x18f3('0x18')](_0x46b99b)[_0x18f3('0x1a')](_0x1e64fc);}};}function respondWithFilteredResult(_0x352474,_0x351bc3){return function(_0xa24fd9){if(_0xa24fd9){var _0x36f33a=typeof _0x351bc3[_0x18f3('0x1b')]===_0x18f3('0x1c')&&typeof _0x351bc3[_0x18f3('0x1d')]===_0x18f3('0x1c');var _0x190a45=_0xa24fd9[_0x18f3('0x1e')];var _0x2e23f8=_0x36f33a?0x0:_0x351bc3['offset'];var _0x4918e5=_0x36f33a?_0xa24fd9[_0x18f3('0x1e')]:_0x351bc3[_0x18f3('0x1b')]+_0x351bc3[_0x18f3('0x1d')];var _0x272cd0;if(_0x4918e5>=_0x190a45){_0x4918e5=_0x190a45;_0x272cd0=0xc8;}else{_0x272cd0=0xce;}_0x352474[_0x18f3('0x18')](_0x272cd0);return _0x352474['set'](_0x18f3('0x1f'),_0x2e23f8+'-'+_0x4918e5+'/'+_0x190a45)[_0x18f3('0x1a')](_0xa24fd9);}return null;};}function patchUpdates(_0x74b12d){return function(_0x21a303){try{jsonpatch[_0x18f3('0x20')](_0x21a303,_0x74b12d,!![]);}catch(_0x4fdfd2){return BPromise['reject'](_0x4fdfd2);}return _0x21a303[_0x18f3('0x21')]();};}function saveUpdates(_0x4e76ec,_0x2aeace){return function(_0x58d3cc){if(_0x58d3cc){return _0x58d3cc[_0x18f3('0x22')](_0x4e76ec)[_0x18f3('0x23')](function(_0x4f3753){return _0x4f3753;});}return null;};}function removeEntity(_0x9113e4,_0x4def63){return function(_0x2c8d23){if(_0x2c8d23){return _0x2c8d23['destroy']()[_0x18f3('0x23')](function(){_0x9113e4[_0x18f3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x232e51,_0x266c3a){return function(_0x14ca15){if(!_0x14ca15){_0x232e51['sendStatus'](0x194);}return _0x14ca15;};}function handleError(_0x1a4849,_0x2ad6ea){_0x2ad6ea=_0x2ad6ea||0x1f4;return function(_0xff522b){logger[_0x18f3('0x24')](_0xff522b['stack']);if(_0xff522b[_0x18f3('0x25')]){delete _0xff522b[_0x18f3('0x25')];}_0x1a4849[_0x18f3('0x18')](_0x2ad6ea)[_0x18f3('0x26')](_0xff522b);};}exports[_0x18f3('0x27')]=function(_0x383f95,_0x1fe8e3){var _0x3f9107={},_0x1c3d92={},_0x2e7f91={'count':0x0,'rows':[]};var _0x49e414=_['map'](db['Automation'][_0x18f3('0x28')],function(_0x166d19){return{'name':_0x166d19['fieldName'],'type':_0x166d19[_0x18f3('0x29')][_0x18f3('0x2a')]};});_0x1c3d92[_0x18f3('0x2b')]=_[_0x18f3('0x2c')](_0x49e414,_0x18f3('0x25'));_0x1c3d92[_0x18f3('0x2d')]=_['keys'](_0x383f95[_0x18f3('0x2d')]);_0x1c3d92['filters']=_[_0x18f3('0x2e')](_0x1c3d92[_0x18f3('0x2b')],_0x1c3d92[_0x18f3('0x2d')]);_0x3f9107[_0x18f3('0x2f')]=_['intersection'](_0x1c3d92[_0x18f3('0x2b')],qs[_0x18f3('0x30')](_0x383f95['query'][_0x18f3('0x30')]));_0x3f9107['attributes']=_0x3f9107['attributes'][_0x18f3('0x31')]?_0x3f9107['attributes']:_0x1c3d92[_0x18f3('0x2b')];if(!_0x383f95[_0x18f3('0x2d')][_0x18f3('0x32')](_0x18f3('0x33'))){_0x3f9107[_0x18f3('0x1d')]=qs[_0x18f3('0x1d')](_0x383f95[_0x18f3('0x2d')]['limit']);_0x3f9107[_0x18f3('0x1b')]=qs['offset'](_0x383f95[_0x18f3('0x2d')]['offset']);}_0x3f9107['order']=qs['sort'](_0x383f95['query'][_0x18f3('0x34')]);_0x3f9107['where']=qs[_0x18f3('0x35')](_[_0x18f3('0x36')](_0x383f95[_0x18f3('0x2d')],_0x1c3d92['filters']),_0x49e414);if(_0x383f95[_0x18f3('0x2d')][_0x18f3('0x37')]){_0x3f9107[_0x18f3('0x38')]=_['merge'](_0x3f9107[_0x18f3('0x38')],{'$or':_['map'](_0x49e414,function(_0x21fae3){if(_0x21fae3[_0x18f3('0x29')]!==_0x18f3('0x39')){var _0x7ccd6f={};_0x7ccd6f[_0x21fae3['name']]={'$like':'%'+_0x383f95[_0x18f3('0x2d')]['filter']+'%'};return _0x7ccd6f;}})});}_0x3f9107=_['merge']({},_0x3f9107,_0x383f95[_0x18f3('0x3a')]);var _0xf28f3b={'where':_0x3f9107[_0x18f3('0x38')]};return db[_0x18f3('0x3b')][_0x18f3('0x1e')](_0xf28f3b)[_0x18f3('0x23')](function(_0x1a466a){_0x2e7f91[_0x18f3('0x1e')]=_0x1a466a;if(_0x383f95[_0x18f3('0x2d')][_0x18f3('0x3c')]){_0x3f9107[_0x18f3('0x3d')]=[{'all':!![]}];}return db['Automation'][_0x18f3('0x3e')](_0x3f9107);})[_0x18f3('0x23')](function(_0x1b1a0e){_0x2e7f91[_0x18f3('0x3f')]=_0x1b1a0e;return _0x2e7f91;})[_0x18f3('0x23')](respondWithFilteredResult(_0x1fe8e3,_0x3f9107))['catch'](handleError(_0x1fe8e3,null));};exports[_0x18f3('0x40')]=function(_0x2f0e96,_0x2ef998){var _0x15268d={'raw':![],'where':{'id':_0x2f0e96[_0x18f3('0x41')]['id']}},_0x592835={};_0x592835[_0x18f3('0x2b')]=_[_0x18f3('0x42')](db['Automation'][_0x18f3('0x28')]);_0x592835[_0x18f3('0x2d')]=_['keys'](_0x2f0e96[_0x18f3('0x2d')]);_0x592835[_0x18f3('0x35')]=_[_0x18f3('0x2e')](_0x592835[_0x18f3('0x2b')],_0x592835[_0x18f3('0x2d')]);_0x15268d[_0x18f3('0x2f')]=_['intersection'](_0x592835[_0x18f3('0x2b')],qs[_0x18f3('0x30')](_0x2f0e96[_0x18f3('0x2d')][_0x18f3('0x30')]));_0x15268d[_0x18f3('0x2f')]=_0x15268d[_0x18f3('0x2f')]['length']?_0x15268d[_0x18f3('0x2f')]:_0x592835[_0x18f3('0x2b')];if(_0x2f0e96[_0x18f3('0x2d')][_0x18f3('0x3c')]){_0x15268d['include']=[{'all':!![]}];}_0x15268d=_[_0x18f3('0x43')]({},_0x15268d,_0x2f0e96['options']);return db[_0x18f3('0x3b')][_0x18f3('0x44')](_0x15268d)[_0x18f3('0x23')](handleEntityNotFound(_0x2ef998,null))[_0x18f3('0x23')](respondWithResult(_0x2ef998,null))[_0x18f3('0x45')](handleError(_0x2ef998,null));};exports[_0x18f3('0x46')]=function(_0x135887,_0x418072){return db[_0x18f3('0x3b')][_0x18f3('0x46')](_0x135887[_0x18f3('0x47')],{})[_0x18f3('0x23')](respondWithResult(_0x418072,0xc9))['catch'](handleError(_0x418072,null));};exports[_0x18f3('0x22')]=function(_0x994bb7,_0x16c065){if(_0x994bb7['body']['id']){delete _0x994bb7[_0x18f3('0x47')]['id'];}return db['Automation'][_0x18f3('0x44')]({'where':{'id':_0x994bb7[_0x18f3('0x41')]['id']}})[_0x18f3('0x23')](handleEntityNotFound(_0x16c065,null))[_0x18f3('0x23')](saveUpdates(_0x994bb7['body'],null))[_0x18f3('0x23')](respondWithResult(_0x16c065,null))[_0x18f3('0x45')](handleError(_0x16c065,null));};exports['destroy']=function(_0x50f820,_0x4238cd){return db[_0x18f3('0x3b')][_0x18f3('0x44')]({'where':{'id':_0x50f820['params']['id']}})['then'](handleEntityNotFound(_0x4238cd,null))[_0x18f3('0x23')](removeEntity(_0x4238cd,null))[_0x18f3('0x45')](handleError(_0x4238cd,null));};exports['addConditions']=function(_0x4a7bcf,_0x2aec28,_0x102cbd){return db[_0x18f3('0x48')][_0x18f3('0x44')]({'where':{'id':_0x4a7bcf[_0x18f3('0x41')]['id']}})[_0x18f3('0x23')](handleEntityNotFound(_0x2aec28,null))[_0x18f3('0x23')](function(_0x5cdb69){if(_0x5cdb69){return _0x5cdb69['addConditions'](_0x4a7bcf['body'][_0x18f3('0x49')],_[_0x18f3('0x4a')](_0x4a7bcf[_0x18f3('0x47')],['ids','id'])||{});}})[_0x18f3('0x23')](respondWithResult(_0x2aec28,null))['catch'](handleError(_0x2aec28,null));};exports[_0x18f3('0x4b')]=function(_0x50035e,_0x213c3e,_0x380648){var _0x522212={};var _0x319fd8={};var _0x1b7ad7;var _0x263e4d;return db[_0x18f3('0x3b')]['findOne']({'where':{'id':_0x50035e[_0x18f3('0x41')]['id']}})[_0x18f3('0x23')](handleEntityNotFound(_0x213c3e,null))[_0x18f3('0x23')](function(_0x1f3b9c){if(_0x1f3b9c){_0x1b7ad7=_0x1f3b9c;_0x319fd8[_0x18f3('0x2b')]=_[_0x18f3('0x42')](db[_0x18f3('0x48')][_0x18f3('0x28')]);_0x319fd8[_0x18f3('0x2d')]=_[_0x18f3('0x42')](_0x50035e[_0x18f3('0x2d')]);_0x319fd8[_0x18f3('0x35')]=_['intersection'](_0x319fd8[_0x18f3('0x2b')],_0x319fd8[_0x18f3('0x2d')]);_0x522212[_0x18f3('0x2f')]=_['intersection'](_0x319fd8[_0x18f3('0x2b')],qs['fields'](_0x50035e[_0x18f3('0x2d')]['fields']));_0x522212[_0x18f3('0x2f')]=_0x522212[_0x18f3('0x2f')][_0x18f3('0x31')]?_0x522212[_0x18f3('0x2f')]:_0x319fd8[_0x18f3('0x2b')];_0x522212[_0x18f3('0x4c')]=qs[_0x18f3('0x34')](_0x50035e[_0x18f3('0x2d')][_0x18f3('0x34')]);_0x522212[_0x18f3('0x38')]=qs[_0x18f3('0x35')](_[_0x18f3('0x36')](_0x50035e[_0x18f3('0x2d')],_0x319fd8[_0x18f3('0x35')]));if(_0x50035e['query'][_0x18f3('0x37')]){_0x522212[_0x18f3('0x38')]=_[_0x18f3('0x43')](_0x522212[_0x18f3('0x38')],{'$or':_[_0x18f3('0x2c')](_0x522212[_0x18f3('0x2f')],function(_0x3e1bf1){var _0x4126aa={};_0x4126aa[_0x3e1bf1]={'$like':'%'+_0x50035e[_0x18f3('0x2d')][_0x18f3('0x37')]+'%'};return _0x4126aa;})});}_0x522212=_[_0x18f3('0x43')]({},_0x522212,_0x50035e[_0x18f3('0x3a')]);return _0x1b7ad7['getConditions'](_0x522212);}})[_0x18f3('0x23')](function(_0x34ad53){if(_0x34ad53){_0x263e4d=_0x34ad53[_0x18f3('0x31')];if(!_0x50035e[_0x18f3('0x2d')][_0x18f3('0x32')](_0x18f3('0x33'))){_0x522212[_0x18f3('0x1d')]=qs['limit'](_0x50035e[_0x18f3('0x2d')][_0x18f3('0x1d')]);_0x522212[_0x18f3('0x1b')]=qs[_0x18f3('0x1b')](_0x50035e[_0x18f3('0x2d')][_0x18f3('0x1b')]);}return _0x1b7ad7[_0x18f3('0x4b')](_0x522212);}})[_0x18f3('0x23')](function(_0x5af722){if(_0x5af722){return _0x5af722?{'count':_0x263e4d,'rows':_0x5af722}:null;}})[_0x18f3('0x23')](respondWithResult(_0x213c3e,null))[_0x18f3('0x45')](handleError(_0x213c3e,null));};exports[_0x18f3('0x4d')]=function(_0x3d813a,_0x1c8446,_0x56d1d7){return db['Action'][_0x18f3('0x44')]({'where':{'id':_0x3d813a[_0x18f3('0x41')]['id']}})[_0x18f3('0x23')](handleEntityNotFound(_0x1c8446,null))[_0x18f3('0x23')](function(_0x172ed6){if(_0x172ed6){return _0x172ed6[_0x18f3('0x4d')](_0x3d813a['body']['ids'],_[_0x18f3('0x4a')](_0x3d813a[_0x18f3('0x47')],[_0x18f3('0x49'),'id'])||{});}})['then'](respondWithResult(_0x1c8446,null))[_0x18f3('0x45')](handleError(_0x1c8446,null));};exports['getActions']=function(_0x56c16c,_0x1817ce,_0x278a65){var _0x4837d7={};var _0x3a071e={};var _0x20ae4f;var _0x3452b9;return db[_0x18f3('0x3b')]['findOne']({'where':{'id':_0x56c16c[_0x18f3('0x41')]['id']}})[_0x18f3('0x23')](handleEntityNotFound(_0x1817ce,null))[_0x18f3('0x23')](function(_0x3c4c7b){if(_0x3c4c7b){_0x20ae4f=_0x3c4c7b;_0x3a071e[_0x18f3('0x2b')]=_['keys'](db['Action']['rawAttributes']);_0x3a071e[_0x18f3('0x2d')]=_[_0x18f3('0x42')](_0x56c16c[_0x18f3('0x2d')]);_0x3a071e[_0x18f3('0x35')]=_[_0x18f3('0x2e')](_0x3a071e[_0x18f3('0x2b')],_0x3a071e[_0x18f3('0x2d')]);_0x4837d7[_0x18f3('0x2f')]=_[_0x18f3('0x2e')](_0x3a071e[_0x18f3('0x2b')],qs[_0x18f3('0x30')](_0x56c16c[_0x18f3('0x2d')][_0x18f3('0x30')]));_0x4837d7[_0x18f3('0x2f')]=_0x4837d7[_0x18f3('0x2f')][_0x18f3('0x31')]?_0x4837d7[_0x18f3('0x2f')]:_0x3a071e['model'];_0x4837d7[_0x18f3('0x4c')]=qs[_0x18f3('0x34')](_0x56c16c['query']['sort']);_0x4837d7[_0x18f3('0x38')]=qs[_0x18f3('0x35')](_[_0x18f3('0x36')](_0x56c16c['query'],_0x3a071e[_0x18f3('0x35')]));if(_0x56c16c['query'][_0x18f3('0x37')]){_0x4837d7[_0x18f3('0x38')]=_[_0x18f3('0x43')](_0x4837d7[_0x18f3('0x38')],{'$or':_['map'](_0x4837d7['attributes'],function(_0x5e57ef){var _0x42be39={};_0x42be39[_0x5e57ef]={'$like':'%'+_0x56c16c['query'][_0x18f3('0x37')]+'%'};return _0x42be39;})});}_0x4837d7=_['merge']({},_0x4837d7,_0x56c16c[_0x18f3('0x3a')]);return _0x20ae4f['getActions'](_0x4837d7);}})[_0x18f3('0x23')](function(_0x53c8e5){if(_0x53c8e5){_0x3452b9=_0x53c8e5[_0x18f3('0x31')];if(!_0x56c16c['query'][_0x18f3('0x32')]('nolimit')){_0x4837d7[_0x18f3('0x1d')]=qs[_0x18f3('0x1d')](_0x56c16c[_0x18f3('0x2d')][_0x18f3('0x1d')]);_0x4837d7[_0x18f3('0x1b')]=qs['offset'](_0x56c16c['query'][_0x18f3('0x1b')]);}return _0x20ae4f[_0x18f3('0x4e')](_0x4837d7);}})['then'](function(_0xb6b383){if(_0xb6b383){return _0xb6b383?{'count':_0x3452b9,'rows':_0xb6b383}:null;}})[_0x18f3('0x23')](respondWithResult(_0x1817ce,null))[_0x18f3('0x45')](handleError(_0x1817ce,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d8935de..ace8033 100644 --- a/server/api/automation/automation.model.js +++ b/server/api/automation/automation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10bd=['exports','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes'];(function(_0x215d5b,_0xce342a){var _0x41466b=function(_0x52a8c8){while(--_0x52a8c8){_0x215d5b['push'](_0x215d5b['shift']());}};_0x41466b(++_0xce342a);}(_0x10bd,0x1ca));var _0xd10b=function(_0x1b3d60,_0x51583b){_0x1b3d60=_0x1b3d60-0x0;var _0x4abc3d=_0x10bd[_0x1b3d60];return _0x4abc3d;};'use strict';var _=require(_0xd10b('0x0'));var util=require(_0xd10b('0x1'));var logger=require(_0xd10b('0x2'))(_0xd10b('0x3'));var moment=require(_0xd10b('0x4'));var BPromise=require(_0xd10b('0x5'));var rp=require(_0xd10b('0x6'));var fs=require('fs');var path=require(_0xd10b('0x7'));var rimraf=require(_0xd10b('0x8'));var config=require('../../config/environment');var attributes=require(_0xd10b('0x9'));module[_0xd10b('0xa')]=function(_0x3cedda,_0xa2b51c){return _0x3cedda['define'](_0xd10b('0xb'),attributes,{'tableName':_0xd10b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8de=['define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0xd8de,0x86));var _0xed8d=function(_0x4640ac,_0x250a16){_0x4640ac=_0x4640ac-0x0;var _0x91b38c=_0xd8de[_0x4640ac];return _0x91b38c;};'use strict';var _=require(_0xed8d('0x0'));var util=require(_0xed8d('0x1'));var logger=require(_0xed8d('0x2'))(_0xed8d('0x3'));var moment=require(_0xed8d('0x4'));var BPromise=require(_0xed8d('0x5'));var rp=require(_0xed8d('0x6'));var fs=require('fs');var path=require(_0xed8d('0x7'));var rimraf=require(_0xed8d('0x8'));var config=require('../../config/environment');var attributes=require(_0xed8d('0x9'));module['exports']=function(_0x40338f,_0x1aada6){return _0x40338f[_0xed8d('0xa')](_0xed8d('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 54af947..2e490c4 100644 --- a/server/api/automation/automation.rpc.js +++ b/server/api/automation/automation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4910=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5eecc0,_0x43ae17){var _0x1887ad=function(_0x32b1a4){while(--_0x32b1a4){_0x5eecc0['push'](_0x5eecc0['shift']());}};_0x1887ad(++_0x43ae17);}(_0x4910,0x1d9));var _0x0491=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4910[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var moment=require(_0x0491('0x2'));var BPromise=require('bluebird');var rs=require(_0x0491('0x3'));var fs=require('fs');var Redis=require(_0x0491('0x4'));var db=require(_0x0491('0x5'))['db'];var utils=require(_0x0491('0x6'));var logger=require(_0x0491('0x7'))('rpc');var config=require(_0x0491('0x8'));var jayson=require(_0x0491('0x9'));var client=jayson[_0x0491('0xa')][_0x0491('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27e7d5,_0x4ba9e5,_0x3b7b10){return new BPromise(function(_0x29c0d0,_0xf50a53){return client[_0x0491('0xc')](_0x27e7d5,_0x3b7b10)[_0x0491('0xd')](function(_0x4822d5){logger[_0x0491('0xe')]('Automation,\x20%s,\x20%s',_0x4ba9e5,_0x0491('0xf'));logger[_0x0491('0x10')](_0x0491('0x11'),_0x4ba9e5,_0x0491('0xf'),JSON[_0x0491('0x12')](_0x4822d5));if(_0x4822d5[_0x0491('0x13')]){if(_0x4822d5[_0x0491('0x13')][_0x0491('0x14')]===0x1f4){logger[_0x0491('0x13')](_0x0491('0x15'),_0x4ba9e5,_0x4822d5['error'][_0x0491('0x16')]);return _0xf50a53(_0x4822d5['error'][_0x0491('0x16')]);}logger['error']('Automation,\x20%s,\x20%s',_0x4ba9e5,_0x4822d5[_0x0491('0x13')][_0x0491('0x16')]);return _0x29c0d0(_0x4822d5[_0x0491('0x13')][_0x0491('0x16')]);}else{logger[_0x0491('0xe')](_0x0491('0x15'),_0x4ba9e5,_0x0491('0xf'));_0x29c0d0(_0x4822d5[_0x0491('0x17')][_0x0491('0x16')]);}})[_0x0491('0x18')](function(_0x527415){logger[_0x0491('0x13')](_0x0491('0x15'),_0x4ba9e5,_0x527415);_0xf50a53(_0x527415);});});} \ No newline at end of file +var _0x757a=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x591da9,_0x404309){var _0x4fc0fd=function(_0x4611be){while(--_0x4611be){_0x591da9['push'](_0x591da9['shift']());}};_0x4fc0fd(++_0x404309);}(_0x757a,0xde));var _0xa757=function(_0x1cbb84,_0x570915){_0x1cbb84=_0x1cbb84-0x0;var _0x307b87=_0x757a[_0x1cbb84];return _0x307b87;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Automation,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3af0e63..ee05a41 100644 --- a/server/api/automation/index.js +++ b/server/api/automation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bbd=['show','/:id/conditions','getConditions','getActions','addConditions','post','/:id/actions','addActions','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated'];(function(_0x48a73e,_0x39f1ac){var _0x390c0b=function(_0x369beb){while(--_0x369beb){_0x48a73e['push'](_0x48a73e['shift']());}};_0x390c0b(++_0x39f1ac);}(_0x7bbd,0x12c));var _0xd7bb=function(_0x4ecf9d,_0x5e9b0){_0x4ecf9d=_0x4ecf9d-0x0;var _0x49c780=_0x7bbd[_0x4ecf9d];return _0x49c780;};'use strict';var multer=require(_0xd7bb('0x0'));var util=require('util');var path=require(_0xd7bb('0x1'));var timeout=require(_0xd7bb('0x2'));var express=require(_0xd7bb('0x3'));var router=express['Router']();var fs_extra=require(_0xd7bb('0x4'));var auth=require(_0xd7bb('0x5'));var interaction=require(_0xd7bb('0x6'));var config=require(_0xd7bb('0x7'));var controller=require(_0xd7bb('0x8'));router[_0xd7bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd7bb('0x9')](_0xd7bb('0xa'),auth[_0xd7bb('0xb')](),controller[_0xd7bb('0xc')]);router[_0xd7bb('0x9')](_0xd7bb('0xd'),auth['isAuthenticated'](),controller[_0xd7bb('0xe')]);router['get']('/:id/actions',auth[_0xd7bb('0xb')](),controller[_0xd7bb('0xf')]);router['post']('/',auth[_0xd7bb('0xb')](),controller['create']);router['post']('/:id/conditions',auth['isAuthenticated'](),controller[_0xd7bb('0x10')]);router[_0xd7bb('0x11')](_0xd7bb('0x12'),auth[_0xd7bb('0xb')](),controller[_0xd7bb('0x13')]);router[_0xd7bb('0x14')]('/:id',auth[_0xd7bb('0xb')](),controller['update']);router[_0xd7bb('0x15')](_0xd7bb('0xa'),auth[_0xd7bb('0xb')](),controller[_0xd7bb('0x16')]);module[_0xd7bb('0x17')]=router; \ No newline at end of file +var _0xfaec=['get','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addActions','put','update','delete','/:id','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index'];(function(_0x5ad2b3,_0x1d9ec4){var _0x32677d=function(_0x394a3d){while(--_0x394a3d){_0x5ad2b3['push'](_0x5ad2b3['shift']());}};_0x32677d(++_0x1d9ec4);}(_0xfaec,0x12f));var _0xcfae=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfaec[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var path=require(_0xcfae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcfae('0x3'));var auth=require(_0xcfae('0x4'));var interaction=require(_0xcfae('0x5'));var config=require(_0xcfae('0x6'));var controller=require(_0xcfae('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfae('0x8')]);router[_0xcfae('0x9')]('/:id',auth[_0xcfae('0xa')](),controller[_0xcfae('0xb')]);router['get']('/:id/conditions',auth[_0xcfae('0xa')](),controller[_0xcfae('0xc')]);router[_0xcfae('0x9')](_0xcfae('0xd'),auth['isAuthenticated'](),controller[_0xcfae('0xe')]);router[_0xcfae('0xf')]('/',auth['isAuthenticated'](),controller[_0xcfae('0x10')]);router[_0xcfae('0xf')](_0xcfae('0x11'),auth[_0xcfae('0xa')](),controller['addConditions']);router[_0xcfae('0xf')]('/:id/actions',auth[_0xcfae('0xa')](),controller[_0xcfae('0x12')]);router[_0xcfae('0x13')]('/:id',auth[_0xcfae('0xa')](),controller[_0xcfae('0x14')]);router[_0xcfae('0x15')](_0xcfae('0x16'),auth[_0xcfae('0xa')](),controller['destroy']);module[_0xcfae('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5e3d503..3001554 100644 --- a/server/api/campaign/campaign.attributes.js +++ b/server/api/campaign/campaign.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b30=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x48ed45,_0x5d4828){var _0x31c7c5=function(_0x81bd45){while(--_0x81bd45){_0x48ed45['push'](_0x48ed45['shift']());}};_0x31c7c5(++_0x5d4828);}(_0x9b30,0x19b));var _0x09b3=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x9b30[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0x09b3('0x0'));module[_0x09b3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x09b3('0x2')),'allowNull':![],'defaultValue':_0x09b3('0x2')},'description':{'type':Sequelize[_0x09b3('0x3')]},'active':{'type':Sequelize[_0x09b3('0x4')],'defaultValue':0x0,'comment':_0x09b3('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x09b3('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x09b3('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x09b3('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x09b3('0x7')](0x3)[_0x09b3('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x09b3('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x09b3('0x7')](0x3)[_0x09b3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x09b3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x09b3('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x09b3('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x09b3('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x09b3('0x7')](0x5)[_0x09b3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x09b3('0x7')](0x3)[_0x09b3('0x8')],'defaultValue':0x3,'comment':_0x09b3('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x09b3('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x09b3('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x09b3('0xd')},'dialTimezone':{'type':Sequelize[_0x09b3('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x09b3('0x3')],'defaultValue':_0x09b3('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x09b3('0xf')](_0x09b3('0x10'),_0x09b3('0x11'),_0x09b3('0x12')),'defaultValue':_0x09b3('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x09b3('0x7')](0x9)[_0x09b3('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x09b3('0x7')](0x9)[_0x09b3('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x09b3('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x09b3('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x09b3('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x09b3('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x09b3('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x09b3('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x09b3('0x7')](0x9)[_0x09b3('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x09b3('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x09b3('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x09b3('0xf')]('DESC',_0x09b3('0x18')),'defaultValue':_0x09b3('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x09b3('0x7')](0x3)[_0x09b3('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x09b3('0x1a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x09b3('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x09b3('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x09b3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x09b3('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x09b3('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x09b3('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x09b3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x09b3('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x09b3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x09b3('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x09b3('0x7')](0x3)[_0x09b3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x09b3('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x09b3('0x7')](0x3)[_0x09b3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x09b3('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x09b3('0x7')](0x5)[_0x09b3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x09b3('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x09b3('0x7')](0x3)[_0x09b3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x09b3('0x7')](0x5)[_0x09b3('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x09b3('0x23')}}; \ No newline at end of file +var _0xe4c0=['ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name'];(function(_0x3d0678,_0x10e9ae){var _0x7f9a43=function(_0x85d80f){while(--_0x85d80f){_0x3d0678['push'](_0x3d0678['shift']());}};_0x7f9a43(++_0x10e9ae);}(_0xe4c0,0x10c));var _0x0e4c=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xe4c0[_0x4843f9];return _0x193c6a;};'use strict';var Sequelize=require(_0x0e4c('0x0'));module[_0x0e4c('0x1')]={'name':{'type':Sequelize[_0x0e4c('0x2')],'unique':_0x0e4c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0e4c('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x0e4c('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0e4c('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x0e4c('0x7')](0x4)[_0x0e4c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0e4c('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0e4c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0e4c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0e4c('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0e4c('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0e4c('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0e4c('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0e4c('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0e4c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0e4c('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0e4c('0x4')](_0x0e4c('0xf'),_0x0e4c('0x10'),_0x0e4c('0x11')),'defaultValue':_0x0e4c('0xf')},'dialAMDActive':{'type':Sequelize[_0x0e4c('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0e4c('0x7')](0x9)[_0x0e4c('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0e4c('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x0e4c('0x7')](0x9)[_0x0e4c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0e4c('0x7')](0x9)[_0x0e4c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0e4c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0e4c('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x0e4c('0x7')](0x9)[_0x0e4c('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0e4c('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0e4c('0x7')](0x9)[_0x0e4c('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0e4c('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0e4c('0x7')](0x9)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0e4c('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0e4c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0e4c('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0e4c('0x4')](_0x0e4c('0x18'),_0x0e4c('0x19')),'defaultValue':_0x0e4c('0x18')},'dialPrefix':{'type':Sequelize[_0x0e4c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x0e4c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0e4c('0x1a')},'dialCutDigit':{'type':Sequelize[_0x0e4c('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0e4c('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0e4c('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0e4c('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0e4c('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0e4c('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0e4c('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0e4c('0x7')](0x3)[_0x0e4c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0e4c('0x7')](0x5)[_0x0e4c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0e4c('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e4bd7cd..cd218a7 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15f9=['rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','destroy','getHoppers','findOne','CmHopper','hasOwnProperty','order','CampaignId','filter','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper','scheduledAt','phone\x20IS\x20NOT\x20NULL','cmHopperId','OrderBy','ci.OrderBY','join','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','get','IvrCampaigns','UserProfileResource','sendStatus','stack','name','send','index','map','Campaign'];(function(_0x1cfd07,_0x42cdb5){var _0x3d7c1f=function(_0x5b4be1){while(--_0x5b4be1){_0x1cfd07['push'](_0x1cfd07['shift']());}};_0x3d7c1f(++_0x42cdb5);}(_0x15f9,0xf7));var _0x915f=function(_0x379ae3,_0x16a555){_0x379ae3=_0x379ae3-0x0;var _0x80c32e=_0x15f9[_0x379ae3];return _0x80c32e;};'use strict';var emlformat=require(_0x915f('0x0'));var rimraf=require(_0x915f('0x1'));var zipdir=require(_0x915f('0x2'));var jsonpatch=require(_0x915f('0x3'));var rp=require(_0x915f('0x4'));var moment=require(_0x915f('0x5'));var BPromise=require(_0x915f('0x6'));var Mustache=require(_0x915f('0x7'));var util=require(_0x915f('0x8'));var path=require('path');var sox=require(_0x915f('0x9'));var csv=require(_0x915f('0xa'));var ejs=require(_0x915f('0xb'));var fs=require('fs');var fs_extra=require(_0x915f('0xc'));var _=require('lodash');var squel=require(_0x915f('0xd'));var crypto=require(_0x915f('0xe'));var jsforce=require(_0x915f('0xf'));var deskjs=require(_0x915f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x915f('0x11'));var Papa=require(_0x915f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x915f('0x13'));var as=require(_0x915f('0x14'));var hardwareService=require(_0x915f('0x15'));var logger=require(_0x915f('0x16'))(_0x915f('0x17'));var utils=require(_0x915f('0x18'));var config=require(_0x915f('0x19'));var licenseUtil=require(_0x915f('0x1a'));var db=require(_0x915f('0x1b'))['db'];function respondWithStatusCode(_0x35b29f,_0x2a9a10){_0x2a9a10=_0x2a9a10||0xcc;return function(_0x5b9080){if(_0x5b9080){return _0x35b29f['sendStatus'](_0x2a9a10);}return _0x35b29f[_0x915f('0x1c')](_0x2a9a10)[_0x915f('0x1d')]();};}function respondWithResult(_0x25de94,_0x370a91){_0x370a91=_0x370a91||0xc8;return function(_0x53de49){if(_0x53de49){return _0x25de94[_0x915f('0x1c')](_0x370a91)['json'](_0x53de49);}};}function respondWithFilteredResult(_0x80a30f,_0x42c125){return function(_0x5a05cf){if(_0x5a05cf){var _0x1782b0=typeof _0x42c125[_0x915f('0x1e')]==='undefined'&&typeof _0x42c125[_0x915f('0x1f')]===_0x915f('0x20');var _0x28eca1=_0x5a05cf['count'];var _0x18a53b=_0x1782b0?0x0:_0x42c125['offset'];var _0x2d711d=_0x1782b0?_0x5a05cf[_0x915f('0x21')]:_0x42c125['offset']+_0x42c125[_0x915f('0x1f')];var _0x29f228;if(_0x2d711d>=_0x28eca1){_0x2d711d=_0x28eca1;_0x29f228=0xc8;}else{_0x29f228=0xce;}_0x80a30f[_0x915f('0x1c')](_0x29f228);return _0x80a30f[_0x915f('0x22')](_0x915f('0x23'),_0x18a53b+'-'+_0x2d711d+'/'+_0x28eca1)[_0x915f('0x24')](_0x5a05cf);}return null;};}function patchUpdates(_0x2ba00c){return function(_0x57a6b7){try{jsonpatch[_0x915f('0x25')](_0x57a6b7,_0x2ba00c,!![]);}catch(_0x1572ab){return BPromise['reject'](_0x1572ab);}return _0x57a6b7[_0x915f('0x26')]();};}function saveUpdates(_0x2c6db9,_0x16acd2){return function(_0x4f6d8d){if(_0x4f6d8d){return _0x4f6d8d[_0x915f('0x27')](_0x2c6db9)[_0x915f('0x28')](function(_0xed9c88){return _0xed9c88;});}return null;};}function removeEntity(_0x334e01,_0x31932c){return function(_0xfd479b){if(_0xfd479b){return _0xfd479b['destroy']()[_0x915f('0x28')](function(){var _0x1b2067=_0xfd479b[_0x915f('0x29')]({'plain':!![]});var _0x142482=_0x915f('0x2a');return db[_0x915f('0x2b')]['destroy']({'where':{'type':_0x142482,'resourceId':_0x1b2067['id']}})[_0x915f('0x28')](function(){return _0xfd479b;});})['then'](function(){_0x334e01['status'](0xcc)[_0x915f('0x1d')]();});}};}function handleEntityNotFound(_0x4ef141,_0x4c61e0){return function(_0x19e5fc){if(!_0x19e5fc){_0x4ef141[_0x915f('0x2c')](0x194);}return _0x19e5fc;};}function handleError(_0x28e6b9,_0xa4bda4){_0xa4bda4=_0xa4bda4||0x1f4;return function(_0x5a5ee2){logger['error'](_0x5a5ee2[_0x915f('0x2d')]);if(_0x5a5ee2[_0x915f('0x2e')]){delete _0x5a5ee2[_0x915f('0x2e')];}_0x28e6b9[_0x915f('0x1c')](_0xa4bda4)[_0x915f('0x2f')](_0x5a5ee2);};}exports[_0x915f('0x30')]=function(_0x5d3b3f,_0x19822f){var _0x5ed30e={},_0x3cc1e0={},_0x5de558={'count':0x0,'rows':[]};var _0x2df733=_[_0x915f('0x31')](db[_0x915f('0x32')][_0x915f('0x33')],function(_0x171267){return{'name':_0x171267[_0x915f('0x34')],'type':_0x171267['type'][_0x915f('0x35')]};});_0x3cc1e0[_0x915f('0x36')]=_['map'](_0x2df733,_0x915f('0x2e'));_0x3cc1e0['query']=_[_0x915f('0x37')](_0x5d3b3f[_0x915f('0x38')]);_0x3cc1e0[_0x915f('0x39')]=_[_0x915f('0x3a')](_0x3cc1e0[_0x915f('0x36')],_0x3cc1e0['query']);_0x5ed30e[_0x915f('0x3b')]=_[_0x915f('0x3a')](_0x3cc1e0[_0x915f('0x36')],qs['fields'](_0x5d3b3f[_0x915f('0x38')][_0x915f('0x3c')]));_0x5ed30e[_0x915f('0x3b')]=_0x5ed30e[_0x915f('0x3b')][_0x915f('0x3d')]?_0x5ed30e[_0x915f('0x3b')]:_0x3cc1e0['model'];if(!_0x5d3b3f[_0x915f('0x38')]['hasOwnProperty'](_0x915f('0x3e'))){_0x5ed30e['limit']=qs[_0x915f('0x1f')](_0x5d3b3f[_0x915f('0x38')][_0x915f('0x1f')]);_0x5ed30e['offset']=qs[_0x915f('0x1e')](_0x5d3b3f[_0x915f('0x38')][_0x915f('0x1e')]);}_0x5ed30e['order']=qs[_0x915f('0x3f')](_0x5d3b3f[_0x915f('0x38')]['sort']);_0x5ed30e[_0x915f('0x40')]=qs['filters'](_[_0x915f('0x41')](_0x5d3b3f[_0x915f('0x38')],_0x3cc1e0[_0x915f('0x39')]),_0x2df733);if(_0x5d3b3f[_0x915f('0x38')]['filter']){_0x5ed30e[_0x915f('0x40')]=_[_0x915f('0x42')](_0x5ed30e[_0x915f('0x40')],{'$or':_[_0x915f('0x31')](_0x2df733,function(_0x47a01b){if(_0x47a01b['type']!==_0x915f('0x43')){var _0x1a74de={};_0x1a74de[_0x47a01b[_0x915f('0x2e')]]={'$like':'%'+_0x5d3b3f[_0x915f('0x38')]['filter']+'%'};return _0x1a74de;}})});}_0x5ed30e=_[_0x915f('0x42')]({},_0x5ed30e,_0x5d3b3f[_0x915f('0x44')]);var _0x1462c9={'where':_0x5ed30e[_0x915f('0x40')]};return db[_0x915f('0x32')][_0x915f('0x21')](_0x1462c9)[_0x915f('0x28')](function(_0x384763){_0x5de558['count']=_0x384763;if(_0x5d3b3f[_0x915f('0x38')][_0x915f('0x45')]){_0x5ed30e[_0x915f('0x46')]=[{'all':!![]}];}return db[_0x915f('0x32')]['findAll'](_0x5ed30e);})[_0x915f('0x28')](function(_0x92f97d){_0x5de558[_0x915f('0x47')]=_0x92f97d;return _0x5de558;})[_0x915f('0x28')](respondWithFilteredResult(_0x19822f,_0x5ed30e))[_0x915f('0x48')](handleError(_0x19822f,null));};exports[_0x915f('0x49')]=function(_0x5e20ea,_0x283307){var _0x146680={'raw':![],'where':{'id':_0x5e20ea[_0x915f('0x4a')]['id']}},_0x12bfe8={};_0x12bfe8[_0x915f('0x36')]=_[_0x915f('0x37')](db['Campaign'][_0x915f('0x33')]);_0x12bfe8[_0x915f('0x38')]=_['keys'](_0x5e20ea[_0x915f('0x38')]);_0x12bfe8[_0x915f('0x39')]=_[_0x915f('0x3a')](_0x12bfe8[_0x915f('0x36')],_0x12bfe8[_0x915f('0x38')]);_0x146680[_0x915f('0x3b')]=_['intersection'](_0x12bfe8[_0x915f('0x36')],qs[_0x915f('0x3c')](_0x5e20ea['query'][_0x915f('0x3c')]));_0x146680[_0x915f('0x3b')]=_0x146680[_0x915f('0x3b')][_0x915f('0x3d')]?_0x146680['attributes']:_0x12bfe8['model'];if(_0x5e20ea['query'][_0x915f('0x45')]){_0x146680[_0x915f('0x46')]=[{'all':!![]}];}_0x146680=_[_0x915f('0x42')]({},_0x146680,_0x5e20ea[_0x915f('0x44')]);return db['Campaign'][_0x915f('0x4b')](_0x146680)[_0x915f('0x28')](handleEntityNotFound(_0x283307,null))['then'](respondWithResult(_0x283307,null))['catch'](handleError(_0x283307,null));};exports[_0x915f('0x4c')]=function(_0x288400,_0x3cd5d8){return db[_0x915f('0x32')][_0x915f('0x4c')](_0x288400[_0x915f('0x4d')],{})[_0x915f('0x28')](function(_0x5c7fc3){var _0x2d6743=_0x288400[_0x915f('0x4e')][_0x915f('0x29')]({'plain':!![]});if(!_0x2d6743)throw new Error(_0x915f('0x4f'));if(_0x2d6743[_0x915f('0x50')]===_0x915f('0x4e')){var _0x5a13f1=_0x5c7fc3[_0x915f('0x29')]({'plain':!![]});var _0x2d3da6=_0x915f('0x2a');return db[_0x915f('0x51')]['find']({'where':{'name':_0x2d3da6,'userProfileId':_0x2d6743[_0x915f('0x52')]},'raw':!![]})[_0x915f('0x28')](function(_0xc3d4f7){if(_0xc3d4f7&&_0xc3d4f7[_0x915f('0x53')]===0x0){return db['UserProfileResource'][_0x915f('0x4c')]({'name':_0x5a13f1[_0x915f('0x2e')],'resourceId':_0x5a13f1['id'],'type':_0xc3d4f7[_0x915f('0x2e')],'sectionId':_0xc3d4f7['id']},{})['then'](function(){return _0x5c7fc3;});}else{return _0x5c7fc3;}})[_0x915f('0x48')](function(_0x45219b){logger[_0x915f('0x54')](_0x915f('0x55'),_0x45219b);throw _0x45219b;});}return _0x5c7fc3;})[_0x915f('0x28')](respondWithResult(_0x3cd5d8,0xc9))[_0x915f('0x48')](handleError(_0x3cd5d8,null));};exports[_0x915f('0x56')]=function(_0x16d409,_0x47e1df){var _0x37455c={'where':{'id':_0x16d409[_0x915f('0x4a')]['id']}},_0x49664a={};_0x49664a[_0x915f('0x36')]=_[_0x915f('0x37')](db[_0x915f('0x32')]['rawAttributes']);_0x37455c[_0x915f('0x3b')]=_['intersection'](_0x49664a[_0x915f('0x36')],qs['fields'](_0x16d409['query']['fields']));_0x37455c[_0x915f('0x3b')]=_0x37455c[_0x915f('0x3b')][_0x915f('0x3d')]?_0x37455c[_0x915f('0x3b')]:_0x49664a[_0x915f('0x36')];if(_0x16d409['query'][_0x915f('0x45')]){_0x37455c['include']=[{'all':!![]}];}_0x37455c=_['merge']({},_0x37455c,_0x16d409['options']);return db[_0x915f('0x32')]['find'](_0x37455c)[_0x915f('0x28')](handleEntityNotFound(_0x47e1df,null))['then'](function(_0x431214){if(_0x431214){var _0x7c0119=_0x431214[_0x915f('0x29')]({'plain':!![]});_0x7c0119=qs['omit'](_0x7c0119,['id',_0x915f('0x57'),'updatedAt']);_0x16d409[_0x915f('0x4d')]=_[_0x915f('0x58')](_0x16d409[_0x915f('0x4d')],['id',_0x915f('0x57'),_0x915f('0x59')]);return db['Campaign'][_0x915f('0x4c')](_['merge'](_0x7c0119,_0x16d409[_0x915f('0x4d')]),{'include':_0x16d409[_0x915f('0x38')][_0x915f('0x45')]?[{'all':!![]}]:undefined})[_0x915f('0x28')](function(_0x21b68f){var _0x79840b=_0x16d409[_0x915f('0x4e')][_0x915f('0x29')]({'plain':!![]});if(!_0x79840b)throw new Error(_0x915f('0x4f'));if(_0x79840b['role']===_0x915f('0x4e')){var _0x1c02e3=_0x21b68f['get']({'plain':!![]});var _0xc44c40=_0x915f('0x2a');return db[_0x915f('0x51')][_0x915f('0x4b')]({'where':{'name':_0xc44c40,'userProfileId':_0x79840b[_0x915f('0x52')]},'raw':!![]})[_0x915f('0x28')](function(_0x5062a4){if(_0x5062a4&&_0x5062a4[_0x915f('0x53')]===0x0){return db[_0x915f('0x2b')][_0x915f('0x4c')]({'name':_0x1c02e3[_0x915f('0x2e')],'resourceId':_0x1c02e3['id'],'type':_0x5062a4[_0x915f('0x2e')],'sectionId':_0x5062a4['id']},{})[_0x915f('0x28')](function(){return _0x21b68f;});}else{return _0x21b68f;}})['catch'](function(_0x3ff040){logger[_0x915f('0x54')](_0x915f('0x55'),_0x3ff040);throw _0x3ff040;});}return _0x21b68f;});}})[_0x915f('0x28')](respondWithResult(_0x47e1df,0xc9))[_0x915f('0x48')](handleError(_0x47e1df,null));};exports['update']=function(_0x201001,_0x4270cb){if(_0x201001['body']['id']){delete _0x201001['body']['id'];}return db[_0x915f('0x32')][_0x915f('0x4b')]({'where':{'id':_0x201001['params']['id']}})['then'](handleEntityNotFound(_0x4270cb,null))['then'](saveUpdates(_0x201001[_0x915f('0x4d')],null))[_0x915f('0x28')](respondWithResult(_0x4270cb,null))[_0x915f('0x48')](handleError(_0x4270cb,null));};exports[_0x915f('0x5a')]=function(_0x1fc2e4,_0x59358f){return db[_0x915f('0x32')]['find']({'where':{'id':_0x1fc2e4[_0x915f('0x4a')]['id']}})[_0x915f('0x28')](handleEntityNotFound(_0x59358f,null))['then'](removeEntity(_0x59358f,null))[_0x915f('0x48')](handleError(_0x59358f,null));};exports[_0x915f('0x5b')]=function(_0x2eef84,_0x43da65,_0x273660){var _0xc56e7b={'raw':!![],'where':{}};var _0x5a7bd4={};var _0x1b9f25={'count':0x0,'rows':[]};return db['Campaign'][_0x915f('0x5c')]({'where':{'id':_0x2eef84[_0x915f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x43da65,null))[_0x915f('0x28')](function(_0x1481e4){if(_0x1481e4){_0x5a7bd4['model']=_['keys'](db[_0x915f('0x5d')][_0x915f('0x33')]);_0x5a7bd4[_0x915f('0x38')]=_[_0x915f('0x37')](_0x2eef84[_0x915f('0x38')]);_0x5a7bd4[_0x915f('0x39')]=_['intersection'](_0x5a7bd4[_0x915f('0x36')],_0x5a7bd4[_0x915f('0x38')]);_0xc56e7b['attributes']=_['intersection'](_0x5a7bd4[_0x915f('0x36')],qs['fields'](_0x2eef84[_0x915f('0x38')][_0x915f('0x3c')]));_0xc56e7b[_0x915f('0x3b')]=_0xc56e7b[_0x915f('0x3b')][_0x915f('0x3d')]?_0xc56e7b[_0x915f('0x3b')]:_0x5a7bd4['model'];if(!_0x2eef84[_0x915f('0x38')][_0x915f('0x5e')](_0x915f('0x3e'))){_0xc56e7b[_0x915f('0x1f')]=qs['limit'](_0x2eef84[_0x915f('0x38')][_0x915f('0x1f')]);_0xc56e7b[_0x915f('0x1e')]=qs[_0x915f('0x1e')](_0x2eef84['query']['offset']);}_0xc56e7b[_0x915f('0x5f')]=qs[_0x915f('0x3f')](_0x2eef84[_0x915f('0x38')][_0x915f('0x3f')]);_0xc56e7b[_0x915f('0x40')]=qs[_0x915f('0x39')](_[_0x915f('0x41')](_0x2eef84['query'],_0x5a7bd4[_0x915f('0x39')]));_0xc56e7b[_0x915f('0x40')][_0x915f('0x60')]=_0x1481e4['id'];if(_0x2eef84[_0x915f('0x38')][_0x915f('0x61')]){_0xc56e7b[_0x915f('0x40')]=_[_0x915f('0x42')](_0xc56e7b[_0x915f('0x40')],{'$or':_[_0x915f('0x31')](_0xc56e7b[_0x915f('0x3b')],function(_0x31cf3e){var _0x217646={};_0x217646[_0x31cf3e]={'$like':'%'+_0x2eef84[_0x915f('0x38')]['filter']+'%'};return _0x217646;})});}_0xc56e7b=_[_0x915f('0x42')]({},_0xc56e7b,_0x2eef84[_0x915f('0x44')]);return db[_0x915f('0x5d')][_0x915f('0x21')]({'where':_0xc56e7b[_0x915f('0x40')]})[_0x915f('0x28')](function(_0x5a9c96){_0x1b9f25[_0x915f('0x21')]=_0x5a9c96;if(_0x2eef84[_0x915f('0x38')]['includeAll']){_0xc56e7b['include']=[{'all':!![]}];}return db[_0x915f('0x5d')][_0x915f('0x62')](_0xc56e7b);})[_0x915f('0x28')](function(_0x1f0093){_0x1b9f25['rows']=_0x1f0093;return _0x1b9f25;});}})['then'](respondWithFilteredResult(_0x43da65,_0xc56e7b))[_0x915f('0x48')](handleError(_0x43da65,null));};exports[_0x915f('0x63')]=function(_0x4749c4,_0x557169,_0xc3c58f){var _0x13c868={'raw':!![],'where':{}};var _0x3f200f={};var _0x403670={'count':0x0,'rows':[]};return db['Campaign'][_0x915f('0x5c')]({'where':{'id':_0x4749c4[_0x915f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x557169,null))['then'](function(_0x4ab31d){if(_0x4ab31d){_0x3f200f[_0x915f('0x36')]=_[_0x915f('0x37')](db[_0x915f('0x64')][_0x915f('0x33')]);_0x3f200f['query']=_[_0x915f('0x37')](_0x4749c4[_0x915f('0x38')]);_0x3f200f[_0x915f('0x39')]=_['intersection'](_0x3f200f[_0x915f('0x36')],_0x3f200f['query']);_0x13c868[_0x915f('0x3b')]=_[_0x915f('0x3a')](_0x3f200f['model'],qs[_0x915f('0x3c')](_0x4749c4['query']['fields']));_0x13c868[_0x915f('0x3b')]=_0x13c868[_0x915f('0x3b')]['length']?_0x13c868[_0x915f('0x3b')]:_0x3f200f[_0x915f('0x36')];if(!_0x4749c4['query'][_0x915f('0x5e')](_0x915f('0x3e'))){_0x13c868[_0x915f('0x1f')]=qs[_0x915f('0x1f')](_0x4749c4[_0x915f('0x38')][_0x915f('0x1f')]);_0x13c868['offset']=qs[_0x915f('0x1e')](_0x4749c4[_0x915f('0x38')][_0x915f('0x1e')]);}_0x13c868[_0x915f('0x5f')]=qs['sort'](_0x4749c4['query'][_0x915f('0x3f')]);_0x13c868[_0x915f('0x40')]=qs[_0x915f('0x39')](_[_0x915f('0x41')](_0x4749c4[_0x915f('0x38')],_0x3f200f[_0x915f('0x39')]));_0x13c868[_0x915f('0x40')][_0x915f('0x60')]=_0x4ab31d['id'];if(_0x4749c4[_0x915f('0x38')]['filter']){_0x13c868[_0x915f('0x40')]=_[_0x915f('0x42')](_0x13c868[_0x915f('0x40')],{'$or':_[_0x915f('0x31')](_0x13c868[_0x915f('0x3b')],function(_0x193b1a){var _0x3ac1c0={};_0x3ac1c0[_0x193b1a]={'$like':'%'+_0x4749c4[_0x915f('0x38')]['filter']+'%'};return _0x3ac1c0;})});}_0x13c868=_['merge']({},_0x13c868,_0x4749c4['options']);return db[_0x915f('0x64')][_0x915f('0x21')]({'where':_0x13c868[_0x915f('0x40')]})['then'](function(_0x2829f9){_0x403670[_0x915f('0x21')]=_0x2829f9;if(_0x4749c4[_0x915f('0x38')][_0x915f('0x45')]){_0x13c868[_0x915f('0x46')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x13c868);})[_0x915f('0x28')](function(_0x54eaec){_0x403670[_0x915f('0x47')]=_0x54eaec;return _0x403670;});}})[_0x915f('0x28')](respondWithFilteredResult(_0x557169,_0x13c868))[_0x915f('0x48')](handleError(_0x557169,null));};exports['getHopperFinals']=function(_0x1bfbef,_0x58e793,_0x556207){var _0x55ce1d={'raw':!![],'where':{}};var _0x132c25={};var _0x55a329={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1bfbef[_0x915f('0x4a')]['id']}})[_0x915f('0x28')](handleEntityNotFound(_0x58e793,null))[_0x915f('0x28')](function(_0x2d38e0){if(_0x2d38e0){_0x132c25[_0x915f('0x36')]=_[_0x915f('0x37')](db[_0x915f('0x65')][_0x915f('0x33')]);_0x132c25[_0x915f('0x38')]=_[_0x915f('0x37')](_0x1bfbef[_0x915f('0x38')]);_0x132c25[_0x915f('0x39')]=_['intersection'](_0x132c25[_0x915f('0x36')],_0x132c25[_0x915f('0x38')]);_0x55ce1d[_0x915f('0x3b')]=_[_0x915f('0x3a')](_0x132c25[_0x915f('0x36')],qs[_0x915f('0x3c')](_0x1bfbef['query'][_0x915f('0x3c')]));_0x55ce1d[_0x915f('0x3b')]=_0x55ce1d['attributes']['length']?_0x55ce1d[_0x915f('0x3b')]:_0x132c25[_0x915f('0x36')];if(!_0x1bfbef[_0x915f('0x38')]['hasOwnProperty'](_0x915f('0x3e'))){_0x55ce1d[_0x915f('0x1f')]=qs[_0x915f('0x1f')](_0x1bfbef[_0x915f('0x38')][_0x915f('0x1f')]);_0x55ce1d[_0x915f('0x1e')]=qs[_0x915f('0x1e')](_0x1bfbef[_0x915f('0x38')]['offset']);}_0x55ce1d[_0x915f('0x5f')]=qs['sort'](_0x1bfbef[_0x915f('0x38')]['sort']);_0x55ce1d[_0x915f('0x40')]=qs[_0x915f('0x39')](_[_0x915f('0x41')](_0x1bfbef[_0x915f('0x38')],_0x132c25['filters']));_0x55ce1d['where'][_0x915f('0x60')]=_0x2d38e0['id'];if(_0x1bfbef[_0x915f('0x38')]['filter']){_0x55ce1d[_0x915f('0x40')]=_['merge'](_0x55ce1d[_0x915f('0x40')],{'$or':_['map'](_0x55ce1d[_0x915f('0x3b')],function(_0x5f3d66){var _0x3c2e40={};_0x3c2e40[_0x5f3d66]={'$like':'%'+_0x1bfbef[_0x915f('0x38')][_0x915f('0x61')]+'%'};return _0x3c2e40;})});}_0x55ce1d=_[_0x915f('0x42')]({},_0x55ce1d,_0x1bfbef[_0x915f('0x44')]);return db['CmHopperFinal'][_0x915f('0x21')]({'where':_0x55ce1d[_0x915f('0x40')]})[_0x915f('0x28')](function(_0x56718a){_0x55a329[_0x915f('0x21')]=_0x56718a;if(_0x1bfbef['query']['includeAll']){_0x55ce1d[_0x915f('0x46')]=[{'all':!![]}];}return db[_0x915f('0x65')][_0x915f('0x62')](_0x55ce1d);})[_0x915f('0x28')](function(_0x245da2){_0x55a329[_0x915f('0x47')]=_0x245da2;return _0x55a329;});}})[_0x915f('0x28')](respondWithFilteredResult(_0x58e793,_0x55ce1d))['catch'](handleError(_0x58e793,null));};exports[_0x915f('0x66')]=function(_0x409c45,_0x2a210d,_0x1adbad){var _0x5df74e={'raw':!![],'where':{}};var _0x1e1dad={};var _0x5b678b={'count':0x0,'rows':[]};return db[_0x915f('0x32')][_0x915f('0x5c')]({'where':{'id':_0x409c45[_0x915f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a210d,null))['then'](function(_0x2364d9){if(_0x2364d9){_0x1e1dad['model']=_[_0x915f('0x37')](db[_0x915f('0x67')][_0x915f('0x33')]);_0x1e1dad[_0x915f('0x38')]=_[_0x915f('0x37')](_0x409c45[_0x915f('0x38')]);_0x1e1dad[_0x915f('0x39')]=_[_0x915f('0x3a')](_0x1e1dad[_0x915f('0x36')],_0x1e1dad[_0x915f('0x38')]);_0x5df74e['attributes']=_['intersection'](_0x1e1dad['model'],qs['fields'](_0x409c45[_0x915f('0x38')]['fields']));_0x5df74e[_0x915f('0x3b')]=_0x5df74e[_0x915f('0x3b')][_0x915f('0x3d')]?_0x5df74e[_0x915f('0x3b')]:_0x1e1dad[_0x915f('0x36')];if(!_0x409c45[_0x915f('0x38')][_0x915f('0x5e')]('nolimit')){_0x5df74e[_0x915f('0x1f')]=qs[_0x915f('0x1f')](_0x409c45[_0x915f('0x38')][_0x915f('0x1f')]);_0x5df74e[_0x915f('0x1e')]=qs['offset'](_0x409c45[_0x915f('0x38')]['offset']);}_0x5df74e[_0x915f('0x5f')]=qs[_0x915f('0x3f')](_0x409c45['query'][_0x915f('0x3f')]);_0x5df74e[_0x915f('0x40')]=qs[_0x915f('0x39')](_[_0x915f('0x41')](_0x409c45['query'],_0x1e1dad[_0x915f('0x39')]));_0x5df74e[_0x915f('0x40')][_0x915f('0x60')]=_0x2364d9['id'];if(_0x409c45[_0x915f('0x38')]['filter']){_0x5df74e[_0x915f('0x40')]=_[_0x915f('0x42')](_0x5df74e['where'],{'$or':_['map'](_0x5df74e['attributes'],function(_0xd2f34f){var _0x132bc2={};_0x132bc2[_0xd2f34f]={'$like':'%'+_0x409c45[_0x915f('0x38')]['filter']+'%'};return _0x132bc2;})});}_0x5df74e=_[_0x915f('0x42')]({},_0x5df74e,_0x409c45[_0x915f('0x44')]);return db[_0x915f('0x67')][_0x915f('0x21')]({'where':_0x5df74e[_0x915f('0x40')]})[_0x915f('0x28')](function(_0x481e6d){_0x5b678b[_0x915f('0x21')]=_0x481e6d;if(_0x409c45[_0x915f('0x38')]['includeAll']){_0x5df74e[_0x915f('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x915f('0x62')](_0x5df74e);})['then'](function(_0x1a4763){_0x5b678b[_0x915f('0x47')]=_0x1a4763;return _0x5b678b;});}})[_0x915f('0x28')](respondWithFilteredResult(_0x2a210d,_0x5df74e))['catch'](handleError(_0x2a210d,null));};exports[_0x915f('0x68')]=function(_0x2380b6,_0x2ffa64,_0x338262){var _0x4c08a6={};var _0x1c1906={};var _0xed7df2;var _0x2310aa;return db[_0x915f('0x32')][_0x915f('0x5c')]({'where':{'id':_0x2380b6['params']['id']}})[_0x915f('0x28')](handleEntityNotFound(_0x2ffa64,null))['then'](function(_0xd14085){if(_0xd14085){_0xed7df2=_0xd14085;_0x1c1906[_0x915f('0x36')]=_['keys'](db[_0x915f('0x69')][_0x915f('0x33')]);_0x1c1906[_0x915f('0x38')]=_[_0x915f('0x37')](_0x2380b6[_0x915f('0x38')]);_0x1c1906[_0x915f('0x39')]=_['intersection'](_0x1c1906[_0x915f('0x36')],_0x1c1906['query']);_0x4c08a6['attributes']=_[_0x915f('0x3a')](_0x1c1906['model'],qs[_0x915f('0x3c')](_0x2380b6[_0x915f('0x38')][_0x915f('0x3c')]));_0x4c08a6[_0x915f('0x3b')]=_0x4c08a6[_0x915f('0x3b')][_0x915f('0x3d')]?_0x4c08a6[_0x915f('0x3b')]:_0x1c1906['model'];_0x4c08a6['order']=qs['sort'](_0x2380b6['query']['sort']);_0x4c08a6['where']=qs[_0x915f('0x39')](_[_0x915f('0x41')](_0x2380b6[_0x915f('0x38')],_0x1c1906['filters']));if(_0x2380b6['query'][_0x915f('0x61')]){_0x4c08a6[_0x915f('0x40')]=_['merge'](_0x4c08a6[_0x915f('0x40')],{'$or':_[_0x915f('0x31')](_0x4c08a6[_0x915f('0x3b')],function(_0x29f063){var _0x21043e={};_0x21043e[_0x29f063]={'$like':'%'+_0x2380b6[_0x915f('0x38')][_0x915f('0x61')]+'%'};return _0x21043e;})});}_0x4c08a6=_[_0x915f('0x42')]({},_0x4c08a6,_0x2380b6[_0x915f('0x44')]);return _0xed7df2[_0x915f('0x68')](_0x4c08a6);}})[_0x915f('0x28')](function(_0x3aefb0){if(_0x3aefb0){_0x2310aa=_0x3aefb0[_0x915f('0x3d')];if(!_0x2380b6[_0x915f('0x38')][_0x915f('0x5e')]('nolimit')){_0x4c08a6[_0x915f('0x1f')]=qs[_0x915f('0x1f')](_0x2380b6[_0x915f('0x38')][_0x915f('0x1f')]);_0x4c08a6[_0x915f('0x1e')]=qs[_0x915f('0x1e')](_0x2380b6['query']['offset']);}return _0xed7df2[_0x915f('0x68')](_0x4c08a6);}})[_0x915f('0x28')](function(_0x2dda1a){if(_0x2dda1a){return _0x2dda1a?{'count':_0x2310aa,'rows':_0x2dda1a}:null;}})[_0x915f('0x28')](respondWithResult(_0x2ffa64,null))[_0x915f('0x48')](handleError(_0x2ffa64,null));};exports[_0x915f('0x6a')]=function(_0x4f85de,_0x932613,_0x45078b){var _0x5b7496,_0xee1403;var _0xdcb422=[];var _0x5aed6f=moment()[_0x915f('0x6b')](_0x915f('0x6c'));return db[_0x915f('0x32')]['find']({'where':{'id':_0x4f85de[_0x915f('0x4a')]['id']}})[_0x915f('0x28')](handleEntityNotFound(_0x932613,null))[_0x915f('0x28')](function(_0x37d698){if(_0x37d698){_0xee1403=_0x37d698;return _0x37d698[_0x915f('0x6a')](_0x4f85de['body'][_0x915f('0x6d')],_[_0x915f('0x58')](_0x4f85de[_0x915f('0x4d')],[_0x915f('0x6d'),'id'])||{});}return null;})[_0x915f('0x6e')](function(_0x4cb21b){var _0x4ef740;var _0x2b49fb;_0x5b7496=_0x4cb21b||[];var _0x55c5b1=[];if(_0x4cb21b){for(var _0x427957=0x0;_0x427957<_0x4cb21b[_0x915f('0x3d')];_0x427957+=0x1){var _0x5ce0c0=_0x4cb21b[_0x427957][_0x915f('0x29')]({'plain':!![]});_0xee1403[_0x915f('0x6f')]=_0x4f85de['body'][_0x915f('0x6f')]?_0x4f85de[_0x915f('0x4d')]['dialCheckDuplicateType']:_0xee1403[_0x915f('0x6f')];switch(_0xee1403['dialCheckDuplicateType']){case _0x915f('0x70'):_0x4ef740=squel[_0x915f('0x71')]()[_0x915f('0x72')]('cm_hopper')[_0x915f('0x73')]([_0x915f('0x74'),'scheduledAt',_0x915f('0x75'),_0x915f('0x76'),'CampaignId',_0x915f('0x57'),_0x915f('0x59')],squel['select']()[_0x915f('0x77')]('phone',_0x915f('0x74'))[_0x915f('0x77')](_0x915f('0x78'),'scheduledAt')['field']('id','ContactId')[_0x915f('0x77')](_0x5ce0c0[_0x915f('0x79')][_0x915f('0x7a')](),'ListId')[_0x915f('0x77')](_0x4f85de[_0x915f('0x4a')]['id'][_0x915f('0x7a')](),_0x915f('0x60'))[_0x915f('0x77')]('\x27'+_0x5aed6f+'\x27','createdAt')[_0x915f('0x77')]('\x27'+_0x5aed6f+'\x27',_0x915f('0x59'))['from'](_0x915f('0x7b'))[_0x915f('0x40')](_0x915f('0x7c'))[_0x915f('0x40')](_0x915f('0x7d'),_0x5ce0c0[_0x915f('0x79')][_0x915f('0x7a')]())[_0x915f('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x915f('0x40')](_0x915f('0x7e'),squel[_0x915f('0x7f')]()[_0x915f('0x77')]('COALESCE(calleridnum,\x27\x27)')[_0x915f('0x80')](_0x915f('0x81'))[_0x915f('0x40')](_0x915f('0x82'),_0x4f85de[_0x915f('0x4a')]['id'][_0x915f('0x7a')]()))[_0x915f('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x915f('0x7f')]()['field']('COALESCE(phone,\x27\x27)')[_0x915f('0x80')]('cm_hopper')['where'](_0x915f('0x82'),_0x4f85de[_0x915f('0x4a')]['id'][_0x915f('0x7a')]())))[_0x915f('0x7a')]();break;case _0x915f('0x83'):_0x4ef740=squel[_0x915f('0x71')]()[_0x915f('0x72')](_0x915f('0x84'))['fromQuery']([_0x915f('0x74'),_0x915f('0x85'),'ContactId',_0x915f('0x76'),_0x915f('0x60'),'createdAt','updatedAt'],squel[_0x915f('0x7f')]()[_0x915f('0x77')](_0x915f('0x74'),_0x915f('0x74'))[_0x915f('0x77')](_0x915f('0x78'),_0x915f('0x85'))[_0x915f('0x77')]('id',_0x915f('0x75'))[_0x915f('0x77')](_0x5ce0c0['CmListId'][_0x915f('0x7a')](),_0x915f('0x76'))[_0x915f('0x77')](_0x4f85de[_0x915f('0x4a')]['id']['toString'](),_0x915f('0x60'))['field']('\x27'+_0x5aed6f+'\x27',_0x915f('0x57'))[_0x915f('0x77')]('\x27'+_0x5aed6f+'\x27',_0x915f('0x59'))[_0x915f('0x80')](_0x915f('0x7b'))[_0x915f('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x915f('0x7d'),_0x5ce0c0[_0x915f('0x79')][_0x915f('0x7a')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x915f('0x40')](_0x915f('0x7e'),squel[_0x915f('0x7f')]()[_0x915f('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x915f('0x40')]('CampaignId\x20=\x20?',_0x4f85de[_0x915f('0x4a')]['id'][_0x915f('0x7a')]())))[_0x915f('0x7a')]();break;default:_0x4ef740=squel['insert']()[_0x915f('0x72')]('cm_hopper')[_0x915f('0x73')]([_0x915f('0x74'),'scheduledAt',_0x915f('0x75'),'ListId',_0x915f('0x60'),_0x915f('0x57'),'updatedAt'],squel[_0x915f('0x7f')]()[_0x915f('0x77')]('phone','phone')[_0x915f('0x77')](_0x915f('0x78'),'scheduledAt')[_0x915f('0x77')]('id',_0x915f('0x75'))[_0x915f('0x77')](_0x5ce0c0[_0x915f('0x79')]['toString'](),_0x915f('0x76'))[_0x915f('0x77')](_0x4f85de[_0x915f('0x4a')]['id'][_0x915f('0x7a')](),_0x915f('0x60'))[_0x915f('0x77')]('\x27'+_0x5aed6f+'\x27','createdAt')[_0x915f('0x77')]('\x27'+_0x5aed6f+'\x27',_0x915f('0x59'))[_0x915f('0x80')](_0x915f('0x7b'))[_0x915f('0x40')](_0x915f('0x7c'))['where'](_0x915f('0x7d'),_0x5ce0c0['CmListId'][_0x915f('0x7a')]())[_0x915f('0x40')](_0x915f('0x86')))['toString']();}_0x2b49fb=squel[_0x915f('0x71')]()[_0x915f('0x72')]('cm_hopper_additional_phones')[_0x915f('0x73')]([_0x915f('0x87'),_0x915f('0x85'),_0x915f('0x74'),_0x915f('0x88'),'createdAt',_0x915f('0x59')],squel[_0x915f('0x7f')]()[_0x915f('0x77')]('h.id','id')[_0x915f('0x77')](_0x915f('0x78'),_0x915f('0x85'))[_0x915f('0x77')]('ci.item',_0x915f('0x74'))[_0x915f('0x77')](_0x915f('0x89'),_0x915f('0x88'))[_0x915f('0x77')]('\x27'+_0x5aed6f+'\x27',_0x915f('0x57'))[_0x915f('0x77')]('\x27'+_0x5aed6f+'\x27','updatedAt')[_0x915f('0x80')]('cm_contact_has_items','ci')[_0x915f('0x8a')](_0x915f('0x84'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x915f('0x40')](_0x915f('0x8b'),_0x5ce0c0[_0x915f('0x79')][_0x915f('0x7a')]())[_0x915f('0x40')]('h.CampaignId=?',_0x4f85de[_0x915f('0x4a')]['id']['toString']())['where'](_0x915f('0x8c'),_0x5aed6f))[_0x915f('0x7a')]();_0x55c5b1['push'](db[_0x915f('0x8d')][_0x915f('0x38')](_0x4ef740));_0xdcb422[_0x915f('0x8e')](db[_0x915f('0x8d')][_0x915f('0x38')](_0x2b49fb));}return BPromise['all'](_0x55c5b1);}})[_0x915f('0x28')](function(){return BPromise[_0x915f('0x8f')](_0xdcb422);})[_0x915f('0x28')](function(){return _0x5b7496;})[_0x915f('0x28')](respondWithResult(_0x932613,null))[_0x915f('0x48')](handleError(_0x932613,null));};exports[_0x915f('0x90')]=function(_0x42939c,_0x446307,_0x2fb922){return db[_0x915f('0x32')]['find']({'where':{'id':_0x42939c[_0x915f('0x4a')]['id']}})[_0x915f('0x28')](handleEntityNotFound(_0x446307,null))[_0x915f('0x28')](function(_0x501154){if(_0x501154){return _0x501154[_0x915f('0x90')](_0x42939c[_0x915f('0x38')]['ids']);}})['then'](function(_0x3c2473){if(_0x3c2473){return db[_0x915f('0x5d')][_0x915f('0x5a')]({'where':{'ListId':_0x42939c[_0x915f('0x38')][_0x915f('0x6d')],'CampaignId':_0x42939c[_0x915f('0x4a')]['id']}})[_0x915f('0x28')](function(){return _0x3c2473;});}})[_0x915f('0x28')](respondWithStatusCode(_0x446307,null))[_0x915f('0x48')](handleError(_0x446307,null));};exports[_0x915f('0x91')]=function(_0x522828,_0x27fdbd,_0x519bf7){var _0xbdd9ec={};var _0xc5950c={};var _0x500829;var _0x36d61d;return db[_0x915f('0x32')][_0x915f('0x5c')]({'where':{'id':_0x522828[_0x915f('0x4a')]['id']}})[_0x915f('0x28')](handleEntityNotFound(_0x27fdbd,null))[_0x915f('0x28')](function(_0x1048b1){if(_0x1048b1){_0x500829=_0x1048b1;_0xc5950c[_0x915f('0x36')]=_[_0x915f('0x37')](db['CmList'][_0x915f('0x33')]);_0xc5950c[_0x915f('0x38')]=_[_0x915f('0x37')](_0x522828['query']);_0xc5950c[_0x915f('0x39')]=_[_0x915f('0x3a')](_0xc5950c[_0x915f('0x36')],_0xc5950c['query']);_0xbdd9ec[_0x915f('0x3b')]=_[_0x915f('0x3a')](_0xc5950c[_0x915f('0x36')],qs[_0x915f('0x3c')](_0x522828[_0x915f('0x38')][_0x915f('0x3c')]));_0xbdd9ec[_0x915f('0x3b')]=_0xbdd9ec['attributes']['length']?_0xbdd9ec[_0x915f('0x3b')]:_0xc5950c[_0x915f('0x36')];_0xbdd9ec[_0x915f('0x5f')]=qs[_0x915f('0x3f')](_0x522828['query'][_0x915f('0x3f')]);_0xbdd9ec[_0x915f('0x40')]=qs[_0x915f('0x39')](_[_0x915f('0x41')](_0x522828['query'],_0xc5950c[_0x915f('0x39')]));if(_0x522828['query'][_0x915f('0x61')]){_0xbdd9ec['where']=_[_0x915f('0x42')](_0xbdd9ec[_0x915f('0x40')],{'$or':_[_0x915f('0x31')](_0xbdd9ec[_0x915f('0x3b')],function(_0x44eeef){var _0x2527d8={};_0x2527d8[_0x44eeef]={'$like':'%'+_0x522828[_0x915f('0x38')][_0x915f('0x61')]+'%'};return _0x2527d8;})});}_0xbdd9ec=_[_0x915f('0x42')]({},_0xbdd9ec,_0x522828[_0x915f('0x44')]);return _0x500829[_0x915f('0x91')](_0xbdd9ec);}})[_0x915f('0x28')](function(_0x973ec9){if(_0x973ec9){_0x36d61d=_0x973ec9[_0x915f('0x3d')];if(!_0x522828['query']['hasOwnProperty']('nolimit')){_0xbdd9ec[_0x915f('0x1f')]=qs['limit'](_0x522828['query'][_0x915f('0x1f')]);_0xbdd9ec['offset']=qs[_0x915f('0x1e')](_0x522828[_0x915f('0x38')]['offset']);}return _0x500829[_0x915f('0x91')](_0xbdd9ec);}})[_0x915f('0x28')](function(_0x20928d){if(_0x20928d){return _0x20928d?{'count':_0x36d61d,'rows':_0x20928d}:null;}})[_0x915f('0x28')](respondWithResult(_0x27fdbd,null))[_0x915f('0x48')](handleError(_0x27fdbd,null));};exports[_0x915f('0x92')]=function(_0x791b5e,_0x3df3c2,_0x386017){var _0x155b6d,_0x4428e1;var _0x4acce3=[];var _0xb8c9ed=moment()[_0x915f('0x6b')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x915f('0x4b')]({'where':{'id':_0x791b5e[_0x915f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3df3c2,null))[_0x915f('0x28')](function(_0x2130ca){if(_0x2130ca){_0x4428e1=_0x2130ca;return _0x2130ca[_0x915f('0x92')](_0x791b5e[_0x915f('0x4d')][_0x915f('0x6d')],_[_0x915f('0x58')](_0x791b5e[_0x915f('0x4d')],[_0x915f('0x6d'),'id'])||{});}return null;})[_0x915f('0x6e')](function(_0x24ffb1){var _0x4733cf;var _0x14f3f3;_0x155b6d=_0x24ffb1||[];var _0xb9d645=[];if(_0x24ffb1){for(var _0x240753=0x0;_0x240753<_0x24ffb1[_0x915f('0x3d')];_0x240753+=0x1){var _0x21a228=_0x24ffb1[_0x240753]['get']({'plain':!![]});_0x4733cf=squel[_0x915f('0x71')]()[_0x915f('0x72')](_0x915f('0x93'))[_0x915f('0x73')]([_0x915f('0x74'),_0x915f('0x75'),'ListId','CampaignId',_0x915f('0x57'),'updatedAt'],squel[_0x915f('0x7f')]()['field']('phone',_0x915f('0x74'))[_0x915f('0x77')]('id',_0x915f('0x75'))['field'](_0x21a228['CmListId']['toString'](),_0x915f('0x76'))[_0x915f('0x77')](_0x791b5e[_0x915f('0x4a')]['id']['toString'](),_0x915f('0x60'))[_0x915f('0x77')](_0x915f('0x78'),'createdAt')[_0x915f('0x77')](_0x915f('0x78'),_0x915f('0x59'))[_0x915f('0x80')](_0x915f('0x7b'))[_0x915f('0x40')](_0x915f('0x7c'))[_0x915f('0x40')](_0x915f('0x7d'),_0x21a228[_0x915f('0x79')][_0x915f('0x7a')]())[_0x915f('0x40')](_0x915f('0x86')))[_0x915f('0x7a')]();_0xb9d645[_0x915f('0x8e')](db[_0x915f('0x8d')][_0x915f('0x38')](_0x4733cf));}return BPromise[_0x915f('0x8f')](_0xb9d645);}})[_0x915f('0x28')](function(){return _0x155b6d;})[_0x915f('0x28')](respondWithResult(_0x3df3c2,null))[_0x915f('0x48')](handleError(_0x3df3c2,null));};exports[_0x915f('0x94')]=function(_0x2b7129,_0x5c8333,_0x194c2c){return db['Campaign'][_0x915f('0x4b')]({'where':{'id':_0x2b7129[_0x915f('0x4a')]['id']}})[_0x915f('0x28')](handleEntityNotFound(_0x5c8333,null))['then'](function(_0x267a98){if(_0x267a98){return _0x267a98[_0x915f('0x94')](_0x2b7129[_0x915f('0x38')][_0x915f('0x6d')]);}})[_0x915f('0x28')](function(_0x1fcbf8){if(_0x1fcbf8){return db[_0x915f('0x67')][_0x915f('0x5a')]({'where':{'ListId':_0x2b7129[_0x915f('0x38')]['ids'],'CampaignId':_0x2b7129[_0x915f('0x4a')]['id']}})['then'](function(){return _0x1fcbf8;});}})[_0x915f('0x28')](respondWithStatusCode(_0x5c8333,null))[_0x915f('0x48')](handleError(_0x5c8333,null));}; \ No newline at end of file +var _0xbac2=['format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','omit','spread','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','fromQuery','COALESCE(phone,\x27\x27)','into','cm_hopper_additional_phones','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','body','IvrCampaigns','userProfileId','getHoppers','findOne','CmHopper','order','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists'];(function(_0x4fd75e,_0x219e4a){var _0x5b6338=function(_0xf2969c){while(--_0xf2969c){_0x4fd75e['push'](_0x4fd75e['shift']());}};_0x5b6338(++_0x219e4a);}(_0xbac2,0xc6));var _0x2bac=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xbac2[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require(_0x2bac('0x0'));var rimraf=require(_0x2bac('0x1'));var zipdir=require(_0x2bac('0x2'));var jsonpatch=require(_0x2bac('0x3'));var rp=require(_0x2bac('0x4'));var moment=require(_0x2bac('0x5'));var BPromise=require(_0x2bac('0x6'));var Mustache=require(_0x2bac('0x7'));var util=require('util');var path=require(_0x2bac('0x8'));var sox=require(_0x2bac('0x9'));var csv=require('to-csv');var ejs=require(_0x2bac('0xa'));var fs=require('fs');var fs_extra=require(_0x2bac('0xb'));var _=require(_0x2bac('0xc'));var squel=require(_0x2bac('0xd'));var crypto=require(_0x2bac('0xe'));var jsforce=require(_0x2bac('0xf'));var deskjs=require(_0x2bac('0x10'));var toCsv=require(_0x2bac('0x11'));var querystring=require(_0x2bac('0x12'));var Papa=require(_0x2bac('0x13'));var Redis=require(_0x2bac('0x14'));var authService=require(_0x2bac('0x15'));var qs=require(_0x2bac('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2bac('0x17'));var licenseUtil=require(_0x2bac('0x18'));var db=require(_0x2bac('0x19'))['db'];function respondWithStatusCode(_0x322ad2,_0x23f30c){_0x23f30c=_0x23f30c||0xcc;return function(_0x124a93){if(_0x124a93){return _0x322ad2[_0x2bac('0x1a')](_0x23f30c);}return _0x322ad2['status'](_0x23f30c)[_0x2bac('0x1b')]();};}function respondWithResult(_0x4b53f6,_0x3d3a48){_0x3d3a48=_0x3d3a48||0xc8;return function(_0x1ab2a0){if(_0x1ab2a0){return _0x4b53f6[_0x2bac('0x1c')](_0x3d3a48)[_0x2bac('0x1d')](_0x1ab2a0);}};}function respondWithFilteredResult(_0x399a94,_0x141525){return function(_0x4f2637){if(_0x4f2637){var _0x5beb7a=typeof _0x141525[_0x2bac('0x1e')]===_0x2bac('0x1f')&&typeof _0x141525[_0x2bac('0x20')]===_0x2bac('0x1f');var _0x4f04d7=_0x4f2637[_0x2bac('0x21')];var _0x511d81=_0x5beb7a?0x0:_0x141525[_0x2bac('0x1e')];var _0x121d3f=_0x5beb7a?_0x4f2637['count']:_0x141525[_0x2bac('0x1e')]+_0x141525[_0x2bac('0x20')];var _0x596a39;if(_0x121d3f>=_0x4f04d7){_0x121d3f=_0x4f04d7;_0x596a39=0xc8;}else{_0x596a39=0xce;}_0x399a94['status'](_0x596a39);return _0x399a94[_0x2bac('0x22')]('Content-Range',_0x511d81+'-'+_0x121d3f+'/'+_0x4f04d7)[_0x2bac('0x1d')](_0x4f2637);}return null;};}function patchUpdates(_0x97fed3){return function(_0x1710cb){try{jsonpatch[_0x2bac('0x23')](_0x1710cb,_0x97fed3,!![]);}catch(_0x488c51){return BPromise['reject'](_0x488c51);}return _0x1710cb[_0x2bac('0x24')]();};}function saveUpdates(_0x1b9aa5,_0x440e09){return function(_0xaba033){if(_0xaba033){return _0xaba033[_0x2bac('0x25')](_0x1b9aa5)['then'](function(_0x5717b3){return _0x5717b3;});}return null;};}function removeEntity(_0x31b074,_0x32b6c2){return function(_0x1315d3){if(_0x1315d3){return _0x1315d3['destroy']()[_0x2bac('0x26')](function(){var _0x419cde=_0x1315d3[_0x2bac('0x27')]({'plain':!![]});var _0x343106='IvrCampaigns';return db[_0x2bac('0x28')][_0x2bac('0x29')]({'where':{'type':_0x343106,'resourceId':_0x419cde['id']}})[_0x2bac('0x26')](function(){return _0x1315d3;});})[_0x2bac('0x26')](function(){_0x31b074[_0x2bac('0x1c')](0xcc)[_0x2bac('0x1b')]();});}};}function handleEntityNotFound(_0x346acb,_0x325483){return function(_0x11f7a2){if(!_0x11f7a2){_0x346acb[_0x2bac('0x1a')](0x194);}return _0x11f7a2;};}function handleError(_0x101b36,_0xd545f9){_0xd545f9=_0xd545f9||0x1f4;return function(_0x4c8d88){logger[_0x2bac('0x2a')](_0x4c8d88[_0x2bac('0x2b')]);if(_0x4c8d88[_0x2bac('0x2c')]){delete _0x4c8d88[_0x2bac('0x2c')];}_0x101b36['status'](_0xd545f9)[_0x2bac('0x2d')](_0x4c8d88);};}exports[_0x2bac('0x2e')]=function(_0x428922,_0x108ac9){var _0x10f2f6={},_0x11bb2a={},_0x1dcc17={'count':0x0,'rows':[]};var _0x4ef3f5=_[_0x2bac('0x2f')](db[_0x2bac('0x30')]['rawAttributes'],function(_0x10b984){return{'name':_0x10b984['fieldName'],'type':_0x10b984['type'][_0x2bac('0x31')]};});_0x11bb2a[_0x2bac('0x32')]=_[_0x2bac('0x2f')](_0x4ef3f5,'name');_0x11bb2a[_0x2bac('0x33')]=_[_0x2bac('0x34')](_0x428922[_0x2bac('0x33')]);_0x11bb2a[_0x2bac('0x35')]=_[_0x2bac('0x36')](_0x11bb2a[_0x2bac('0x32')],_0x11bb2a[_0x2bac('0x33')]);_0x10f2f6['attributes']=_['intersection'](_0x11bb2a['model'],qs['fields'](_0x428922[_0x2bac('0x33')][_0x2bac('0x37')]));_0x10f2f6[_0x2bac('0x38')]=_0x10f2f6['attributes'][_0x2bac('0x39')]?_0x10f2f6['attributes']:_0x11bb2a[_0x2bac('0x32')];if(!_0x428922[_0x2bac('0x33')][_0x2bac('0x3a')](_0x2bac('0x3b'))){_0x10f2f6[_0x2bac('0x20')]=qs[_0x2bac('0x20')](_0x428922[_0x2bac('0x33')]['limit']);_0x10f2f6[_0x2bac('0x1e')]=qs[_0x2bac('0x1e')](_0x428922['query'][_0x2bac('0x1e')]);}_0x10f2f6['order']=qs[_0x2bac('0x3c')](_0x428922[_0x2bac('0x33')]['sort']);_0x10f2f6['where']=qs[_0x2bac('0x35')](_[_0x2bac('0x3d')](_0x428922['query'],_0x11bb2a[_0x2bac('0x35')]),_0x4ef3f5);if(_0x428922['query'][_0x2bac('0x3e')]){_0x10f2f6[_0x2bac('0x3f')]=_[_0x2bac('0x40')](_0x10f2f6[_0x2bac('0x3f')],{'$or':_['map'](_0x4ef3f5,function(_0x548b16){if(_0x548b16['type']!==_0x2bac('0x41')){var _0x1d9036={};_0x1d9036[_0x548b16[_0x2bac('0x2c')]]={'$like':'%'+_0x428922[_0x2bac('0x33')]['filter']+'%'};return _0x1d9036;}})});}_0x10f2f6=_[_0x2bac('0x40')]({},_0x10f2f6,_0x428922['options']);var _0x561904={'where':_0x10f2f6[_0x2bac('0x3f')]};return db['Campaign'][_0x2bac('0x21')](_0x561904)[_0x2bac('0x26')](function(_0x28dd83){_0x1dcc17[_0x2bac('0x21')]=_0x28dd83;if(_0x428922[_0x2bac('0x33')][_0x2bac('0x42')]){_0x10f2f6['include']=[{'all':!![]}];}return db[_0x2bac('0x30')][_0x2bac('0x43')](_0x10f2f6);})[_0x2bac('0x26')](function(_0x441903){_0x1dcc17[_0x2bac('0x44')]=_0x441903;return _0x1dcc17;})[_0x2bac('0x26')](respondWithFilteredResult(_0x108ac9,_0x10f2f6))[_0x2bac('0x45')](handleError(_0x108ac9,null));};exports[_0x2bac('0x46')]=function(_0x32a764,_0x11fe65){var _0x25dd9a={'raw':![],'where':{'id':_0x32a764[_0x2bac('0x47')]['id']}},_0x3ea52f={};_0x3ea52f[_0x2bac('0x32')]=_[_0x2bac('0x34')](db[_0x2bac('0x30')]['rawAttributes']);_0x3ea52f[_0x2bac('0x33')]=_['keys'](_0x32a764['query']);_0x3ea52f['filters']=_['intersection'](_0x3ea52f[_0x2bac('0x32')],_0x3ea52f[_0x2bac('0x33')]);_0x25dd9a[_0x2bac('0x38')]=_[_0x2bac('0x36')](_0x3ea52f[_0x2bac('0x32')],qs[_0x2bac('0x37')](_0x32a764['query'][_0x2bac('0x37')]));_0x25dd9a[_0x2bac('0x38')]=_0x25dd9a[_0x2bac('0x38')][_0x2bac('0x39')]?_0x25dd9a[_0x2bac('0x38')]:_0x3ea52f[_0x2bac('0x32')];if(_0x32a764['query']['includeAll']){_0x25dd9a[_0x2bac('0x48')]=[{'all':!![]}];}_0x25dd9a=_[_0x2bac('0x40')]({},_0x25dd9a,_0x32a764[_0x2bac('0x49')]);return db[_0x2bac('0x30')]['find'](_0x25dd9a)[_0x2bac('0x26')](handleEntityNotFound(_0x11fe65,null))[_0x2bac('0x26')](respondWithResult(_0x11fe65,null))[_0x2bac('0x45')](handleError(_0x11fe65,null));};exports['create']=function(_0x23b40a,_0x1dfff2){return db[_0x2bac('0x30')][_0x2bac('0x4a')](_0x23b40a['body'],{})[_0x2bac('0x26')](function(_0x1cb6d4){var _0x48b695=_0x23b40a[_0x2bac('0x4b')][_0x2bac('0x27')]({'plain':!![]});if(!_0x48b695)throw new Error(_0x2bac('0x4c'));if(_0x48b695[_0x2bac('0x4d')]===_0x2bac('0x4b')){var _0x7057f3=_0x1cb6d4[_0x2bac('0x27')]({'plain':!![]});var _0x59a7b2='IvrCampaigns';return db[_0x2bac('0x4e')][_0x2bac('0x4f')]({'where':{'name':_0x59a7b2,'userProfileId':_0x48b695['userProfileId']},'raw':!![]})[_0x2bac('0x26')](function(_0x282484){if(_0x282484&&_0x282484[_0x2bac('0x50')]===0x0){return db[_0x2bac('0x28')]['create']({'name':_0x7057f3['name'],'resourceId':_0x7057f3['id'],'type':_0x282484['name'],'sectionId':_0x282484['id']},{})['then'](function(){return _0x1cb6d4;});}else{return _0x1cb6d4;}})[_0x2bac('0x45')](function(_0x2e3abe){logger[_0x2bac('0x2a')](_0x2bac('0x51'),_0x2e3abe);throw _0x2e3abe;});}return _0x1cb6d4;})[_0x2bac('0x26')](respondWithResult(_0x1dfff2,0xc9))[_0x2bac('0x45')](handleError(_0x1dfff2,null));};exports[_0x2bac('0x52')]=function(_0x25612a,_0x4b0990){var _0xa7ad9={'where':{'id':_0x25612a['params']['id']}},_0x571cbf={};_0x571cbf['model']=_[_0x2bac('0x34')](db[_0x2bac('0x30')][_0x2bac('0x53')]);_0xa7ad9[_0x2bac('0x38')]=_[_0x2bac('0x36')](_0x571cbf[_0x2bac('0x32')],qs[_0x2bac('0x37')](_0x25612a[_0x2bac('0x33')][_0x2bac('0x37')]));_0xa7ad9[_0x2bac('0x38')]=_0xa7ad9[_0x2bac('0x38')][_0x2bac('0x39')]?_0xa7ad9[_0x2bac('0x38')]:_0x571cbf['model'];if(_0x25612a['query']['includeAll']){_0xa7ad9[_0x2bac('0x48')]=[{'all':!![]}];}_0xa7ad9=_[_0x2bac('0x40')]({},_0xa7ad9,_0x25612a[_0x2bac('0x49')]);return db[_0x2bac('0x30')][_0x2bac('0x4f')](_0xa7ad9)['then'](handleEntityNotFound(_0x4b0990,null))[_0x2bac('0x26')](function(_0x2e4182){if(_0x2e4182){var _0x1d30ae=_0x2e4182[_0x2bac('0x27')]({'plain':!![]});_0x1d30ae=qs['omit'](_0x1d30ae,['id','createdAt','updatedAt']);_0x25612a[_0x2bac('0x54')]=_['omit'](_0x25612a[_0x2bac('0x54')],['id','createdAt','updatedAt']);return db[_0x2bac('0x30')][_0x2bac('0x4a')](_[_0x2bac('0x40')](_0x1d30ae,_0x25612a['body']),{'include':_0x25612a[_0x2bac('0x33')][_0x2bac('0x42')]?[{'all':!![]}]:undefined})[_0x2bac('0x26')](function(_0x4604fd){var _0x3711b6=_0x25612a[_0x2bac('0x4b')][_0x2bac('0x27')]({'plain':!![]});if(!_0x3711b6)throw new Error(_0x2bac('0x4c'));if(_0x3711b6[_0x2bac('0x4d')]===_0x2bac('0x4b')){var _0x4b4bc0=_0x4604fd[_0x2bac('0x27')]({'plain':!![]});var _0x32276b=_0x2bac('0x55');return db['UserProfileSection'][_0x2bac('0x4f')]({'where':{'name':_0x32276b,'userProfileId':_0x3711b6[_0x2bac('0x56')]},'raw':!![]})[_0x2bac('0x26')](function(_0x4fc65c){if(_0x4fc65c&&_0x4fc65c[_0x2bac('0x50')]===0x0){return db[_0x2bac('0x28')][_0x2bac('0x4a')]({'name':_0x4b4bc0[_0x2bac('0x2c')],'resourceId':_0x4b4bc0['id'],'type':_0x4fc65c[_0x2bac('0x2c')],'sectionId':_0x4fc65c['id']},{})['then'](function(){return _0x4604fd;});}else{return _0x4604fd;}})['catch'](function(_0x221dc5){logger['error'](_0x2bac('0x51'),_0x221dc5);throw _0x221dc5;});}return _0x4604fd;});}})['then'](respondWithResult(_0x4b0990,0xc9))[_0x2bac('0x45')](handleError(_0x4b0990,null));};exports[_0x2bac('0x25')]=function(_0x1fe075,_0x48deae){if(_0x1fe075['body']['id']){delete _0x1fe075['body']['id'];}return db['Campaign'][_0x2bac('0x4f')]({'where':{'id':_0x1fe075[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x48deae,null))[_0x2bac('0x26')](saveUpdates(_0x1fe075[_0x2bac('0x54')],null))[_0x2bac('0x26')](respondWithResult(_0x48deae,null))[_0x2bac('0x45')](handleError(_0x48deae,null));};exports['destroy']=function(_0x302928,_0x38f386){return db['Campaign'][_0x2bac('0x4f')]({'where':{'id':_0x302928['params']['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x38f386,null))['then'](removeEntity(_0x38f386,null))['catch'](handleError(_0x38f386,null));};exports[_0x2bac('0x57')]=function(_0x24615a,_0x1f42ad,_0xe090ab){var _0x2dc7bf={'raw':!![],'where':{}};var _0x3d7342={};var _0x55d56d={'count':0x0,'rows':[]};return db[_0x2bac('0x30')][_0x2bac('0x58')]({'where':{'id':_0x24615a[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x1f42ad,null))['then'](function(_0x4e74b9){if(_0x4e74b9){_0x3d7342[_0x2bac('0x32')]=_['keys'](db[_0x2bac('0x59')][_0x2bac('0x53')]);_0x3d7342[_0x2bac('0x33')]=_['keys'](_0x24615a[_0x2bac('0x33')]);_0x3d7342[_0x2bac('0x35')]=_['intersection'](_0x3d7342[_0x2bac('0x32')],_0x3d7342['query']);_0x2dc7bf[_0x2bac('0x38')]=_[_0x2bac('0x36')](_0x3d7342[_0x2bac('0x32')],qs['fields'](_0x24615a[_0x2bac('0x33')][_0x2bac('0x37')]));_0x2dc7bf[_0x2bac('0x38')]=_0x2dc7bf[_0x2bac('0x38')]['length']?_0x2dc7bf[_0x2bac('0x38')]:_0x3d7342[_0x2bac('0x32')];if(!_0x24615a[_0x2bac('0x33')][_0x2bac('0x3a')]('nolimit')){_0x2dc7bf[_0x2bac('0x20')]=qs[_0x2bac('0x20')](_0x24615a[_0x2bac('0x33')][_0x2bac('0x20')]);_0x2dc7bf[_0x2bac('0x1e')]=qs[_0x2bac('0x1e')](_0x24615a['query'][_0x2bac('0x1e')]);}_0x2dc7bf[_0x2bac('0x5a')]=qs[_0x2bac('0x3c')](_0x24615a[_0x2bac('0x33')][_0x2bac('0x3c')]);_0x2dc7bf[_0x2bac('0x3f')]=qs[_0x2bac('0x35')](_[_0x2bac('0x3d')](_0x24615a['query'],_0x3d7342[_0x2bac('0x35')]));_0x2dc7bf['where'][_0x2bac('0x5b')]=_0x4e74b9['id'];if(_0x24615a[_0x2bac('0x33')][_0x2bac('0x3e')]){_0x2dc7bf[_0x2bac('0x3f')]=_[_0x2bac('0x40')](_0x2dc7bf[_0x2bac('0x3f')],{'$or':_[_0x2bac('0x2f')](_0x2dc7bf[_0x2bac('0x38')],function(_0x2d41a1){var _0x5bd5dd={};_0x5bd5dd[_0x2d41a1]={'$like':'%'+_0x24615a['query'][_0x2bac('0x3e')]+'%'};return _0x5bd5dd;})});}_0x2dc7bf=_[_0x2bac('0x40')]({},_0x2dc7bf,_0x24615a[_0x2bac('0x49')]);return db[_0x2bac('0x59')][_0x2bac('0x21')]({'where':_0x2dc7bf['where']})[_0x2bac('0x26')](function(_0x1db281){_0x55d56d[_0x2bac('0x21')]=_0x1db281;if(_0x24615a[_0x2bac('0x33')][_0x2bac('0x42')]){_0x2dc7bf[_0x2bac('0x48')]=[{'all':!![]}];}return db[_0x2bac('0x59')][_0x2bac('0x43')](_0x2dc7bf);})[_0x2bac('0x26')](function(_0x27fd15){_0x55d56d['rows']=_0x27fd15;return _0x55d56d;});}})['then'](respondWithFilteredResult(_0x1f42ad,_0x2dc7bf))[_0x2bac('0x45')](handleError(_0x1f42ad,null));};exports[_0x2bac('0x5c')]=function(_0x461839,_0x320d42,_0xaf7e15){var _0x51dcf1={'raw':!![],'where':{}};var _0x2ebe60={};var _0x38a1e8={'count':0x0,'rows':[]};return db[_0x2bac('0x30')][_0x2bac('0x58')]({'where':{'id':_0x461839[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x320d42,null))['then'](function(_0x5b1fc3){if(_0x5b1fc3){_0x2ebe60[_0x2bac('0x32')]=_[_0x2bac('0x34')](db[_0x2bac('0x5d')][_0x2bac('0x53')]);_0x2ebe60[_0x2bac('0x33')]=_['keys'](_0x461839[_0x2bac('0x33')]);_0x2ebe60[_0x2bac('0x35')]=_[_0x2bac('0x36')](_0x2ebe60['model'],_0x2ebe60[_0x2bac('0x33')]);_0x51dcf1[_0x2bac('0x38')]=_['intersection'](_0x2ebe60[_0x2bac('0x32')],qs[_0x2bac('0x37')](_0x461839['query']['fields']));_0x51dcf1['attributes']=_0x51dcf1[_0x2bac('0x38')][_0x2bac('0x39')]?_0x51dcf1[_0x2bac('0x38')]:_0x2ebe60[_0x2bac('0x32')];if(!_0x461839[_0x2bac('0x33')][_0x2bac('0x3a')](_0x2bac('0x3b'))){_0x51dcf1[_0x2bac('0x20')]=qs['limit'](_0x461839[_0x2bac('0x33')]['limit']);_0x51dcf1[_0x2bac('0x1e')]=qs[_0x2bac('0x1e')](_0x461839[_0x2bac('0x33')][_0x2bac('0x1e')]);}_0x51dcf1[_0x2bac('0x5a')]=qs[_0x2bac('0x3c')](_0x461839[_0x2bac('0x33')][_0x2bac('0x3c')]);_0x51dcf1[_0x2bac('0x3f')]=qs['filters'](_['pick'](_0x461839[_0x2bac('0x33')],_0x2ebe60[_0x2bac('0x35')]));_0x51dcf1['where'][_0x2bac('0x5b')]=_0x5b1fc3['id'];if(_0x461839[_0x2bac('0x33')][_0x2bac('0x3e')]){_0x51dcf1[_0x2bac('0x3f')]=_[_0x2bac('0x40')](_0x51dcf1[_0x2bac('0x3f')],{'$or':_['map'](_0x51dcf1[_0x2bac('0x38')],function(_0x160ada){var _0x44d7b0={};_0x44d7b0[_0x160ada]={'$like':'%'+_0x461839['query'][_0x2bac('0x3e')]+'%'};return _0x44d7b0;})});}_0x51dcf1=_[_0x2bac('0x40')]({},_0x51dcf1,_0x461839['options']);return db[_0x2bac('0x5d')][_0x2bac('0x21')]({'where':_0x51dcf1[_0x2bac('0x3f')]})['then'](function(_0x3013c6){_0x38a1e8[_0x2bac('0x21')]=_0x3013c6;if(_0x461839[_0x2bac('0x33')][_0x2bac('0x42')]){_0x51dcf1[_0x2bac('0x48')]=[{'all':!![]}];}return db[_0x2bac('0x5d')][_0x2bac('0x43')](_0x51dcf1);})[_0x2bac('0x26')](function(_0x1d4a50){_0x38a1e8[_0x2bac('0x44')]=_0x1d4a50;return _0x38a1e8;});}})[_0x2bac('0x26')](respondWithFilteredResult(_0x320d42,_0x51dcf1))[_0x2bac('0x45')](handleError(_0x320d42,null));};exports['getHopperFinals']=function(_0x11fcdb,_0x279b92,_0x164900){var _0x38267e={'raw':!![],'where':{}};var _0x213762={};var _0x99c497={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x11fcdb[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x279b92,null))['then'](function(_0x123485){if(_0x123485){_0x213762[_0x2bac('0x32')]=_[_0x2bac('0x34')](db['CmHopperFinal'][_0x2bac('0x53')]);_0x213762[_0x2bac('0x33')]=_[_0x2bac('0x34')](_0x11fcdb[_0x2bac('0x33')]);_0x213762[_0x2bac('0x35')]=_['intersection'](_0x213762[_0x2bac('0x32')],_0x213762[_0x2bac('0x33')]);_0x38267e['attributes']=_[_0x2bac('0x36')](_0x213762[_0x2bac('0x32')],qs[_0x2bac('0x37')](_0x11fcdb[_0x2bac('0x33')]['fields']));_0x38267e[_0x2bac('0x38')]=_0x38267e[_0x2bac('0x38')][_0x2bac('0x39')]?_0x38267e['attributes']:_0x213762['model'];if(!_0x11fcdb[_0x2bac('0x33')]['hasOwnProperty'](_0x2bac('0x3b'))){_0x38267e[_0x2bac('0x20')]=qs[_0x2bac('0x20')](_0x11fcdb['query'][_0x2bac('0x20')]);_0x38267e[_0x2bac('0x1e')]=qs['offset'](_0x11fcdb[_0x2bac('0x33')][_0x2bac('0x1e')]);}_0x38267e[_0x2bac('0x5a')]=qs[_0x2bac('0x3c')](_0x11fcdb[_0x2bac('0x33')][_0x2bac('0x3c')]);_0x38267e[_0x2bac('0x3f')]=qs[_0x2bac('0x35')](_[_0x2bac('0x3d')](_0x11fcdb[_0x2bac('0x33')],_0x213762[_0x2bac('0x35')]));_0x38267e[_0x2bac('0x3f')][_0x2bac('0x5b')]=_0x123485['id'];if(_0x11fcdb['query'][_0x2bac('0x3e')]){_0x38267e[_0x2bac('0x3f')]=_[_0x2bac('0x40')](_0x38267e[_0x2bac('0x3f')],{'$or':_[_0x2bac('0x2f')](_0x38267e[_0x2bac('0x38')],function(_0x26d96d){var _0x2ef728={};_0x2ef728[_0x26d96d]={'$like':'%'+_0x11fcdb['query'][_0x2bac('0x3e')]+'%'};return _0x2ef728;})});}_0x38267e=_['merge']({},_0x38267e,_0x11fcdb[_0x2bac('0x49')]);return db['CmHopperFinal']['count']({'where':_0x38267e[_0x2bac('0x3f')]})['then'](function(_0x5ac437){_0x99c497[_0x2bac('0x21')]=_0x5ac437;if(_0x11fcdb['query']['includeAll']){_0x38267e[_0x2bac('0x48')]=[{'all':!![]}];}return db[_0x2bac('0x5e')][_0x2bac('0x43')](_0x38267e);})[_0x2bac('0x26')](function(_0x52675f){_0x99c497[_0x2bac('0x44')]=_0x52675f;return _0x99c497;});}})[_0x2bac('0x26')](respondWithFilteredResult(_0x279b92,_0x38267e))[_0x2bac('0x45')](handleError(_0x279b92,null));};exports[_0x2bac('0x5f')]=function(_0x3d7696,_0x1a0662,_0x5381bc){var _0x51085f={'raw':!![],'where':{}};var _0xd5377={};var _0x17c5ad={'count':0x0,'rows':[]};return db[_0x2bac('0x30')][_0x2bac('0x58')]({'where':{'id':_0x3d7696['params']['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x1a0662,null))[_0x2bac('0x26')](function(_0x3338bd){if(_0x3338bd){_0xd5377[_0x2bac('0x32')]=_[_0x2bac('0x34')](db[_0x2bac('0x60')][_0x2bac('0x53')]);_0xd5377['query']=_[_0x2bac('0x34')](_0x3d7696[_0x2bac('0x33')]);_0xd5377[_0x2bac('0x35')]=_[_0x2bac('0x36')](_0xd5377[_0x2bac('0x32')],_0xd5377[_0x2bac('0x33')]);_0x51085f['attributes']=_['intersection'](_0xd5377['model'],qs[_0x2bac('0x37')](_0x3d7696[_0x2bac('0x33')]['fields']));_0x51085f['attributes']=_0x51085f[_0x2bac('0x38')][_0x2bac('0x39')]?_0x51085f[_0x2bac('0x38')]:_0xd5377[_0x2bac('0x32')];if(!_0x3d7696['query']['hasOwnProperty'](_0x2bac('0x3b'))){_0x51085f[_0x2bac('0x20')]=qs['limit'](_0x3d7696['query']['limit']);_0x51085f[_0x2bac('0x1e')]=qs['offset'](_0x3d7696[_0x2bac('0x33')][_0x2bac('0x1e')]);}_0x51085f[_0x2bac('0x5a')]=qs['sort'](_0x3d7696[_0x2bac('0x33')][_0x2bac('0x3c')]);_0x51085f[_0x2bac('0x3f')]=qs[_0x2bac('0x35')](_[_0x2bac('0x3d')](_0x3d7696['query'],_0xd5377[_0x2bac('0x35')]));_0x51085f[_0x2bac('0x3f')][_0x2bac('0x5b')]=_0x3338bd['id'];if(_0x3d7696[_0x2bac('0x33')]['filter']){_0x51085f[_0x2bac('0x3f')]=_['merge'](_0x51085f[_0x2bac('0x3f')],{'$or':_[_0x2bac('0x2f')](_0x51085f[_0x2bac('0x38')],function(_0x6d31f5){var _0x5f4562={};_0x5f4562[_0x6d31f5]={'$like':'%'+_0x3d7696[_0x2bac('0x33')]['filter']+'%'};return _0x5f4562;})});}_0x51085f=_[_0x2bac('0x40')]({},_0x51085f,_0x3d7696['options']);return db[_0x2bac('0x60')][_0x2bac('0x21')]({'where':_0x51085f[_0x2bac('0x3f')]})[_0x2bac('0x26')](function(_0x970478){_0x17c5ad[_0x2bac('0x21')]=_0x970478;if(_0x3d7696[_0x2bac('0x33')][_0x2bac('0x42')]){_0x51085f['include']=[{'all':!![]}];}return db[_0x2bac('0x60')][_0x2bac('0x43')](_0x51085f);})[_0x2bac('0x26')](function(_0x540d73){_0x17c5ad['rows']=_0x540d73;return _0x17c5ad;});}})['then'](respondWithFilteredResult(_0x1a0662,_0x51085f))[_0x2bac('0x45')](handleError(_0x1a0662,null));};exports[_0x2bac('0x61')]=function(_0xbb10a6,_0x5d52ce,_0x44e8d6){var _0x37a191={};var _0x28c175={};var _0x29da06;var _0x3d73fc;return db['Campaign'][_0x2bac('0x58')]({'where':{'id':_0xbb10a6[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x5d52ce,null))[_0x2bac('0x26')](function(_0x5bf269){if(_0x5bf269){_0x29da06=_0x5bf269;_0x28c175['model']=_[_0x2bac('0x34')](db['CmList']['rawAttributes']);_0x28c175[_0x2bac('0x33')]=_[_0x2bac('0x34')](_0xbb10a6[_0x2bac('0x33')]);_0x28c175[_0x2bac('0x35')]=_[_0x2bac('0x36')](_0x28c175['model'],_0x28c175[_0x2bac('0x33')]);_0x37a191[_0x2bac('0x38')]=_[_0x2bac('0x36')](_0x28c175[_0x2bac('0x32')],qs['fields'](_0xbb10a6[_0x2bac('0x33')][_0x2bac('0x37')]));_0x37a191[_0x2bac('0x38')]=_0x37a191['attributes'][_0x2bac('0x39')]?_0x37a191[_0x2bac('0x38')]:_0x28c175[_0x2bac('0x32')];_0x37a191[_0x2bac('0x5a')]=qs[_0x2bac('0x3c')](_0xbb10a6[_0x2bac('0x33')][_0x2bac('0x3c')]);_0x37a191[_0x2bac('0x3f')]=qs[_0x2bac('0x35')](_[_0x2bac('0x3d')](_0xbb10a6[_0x2bac('0x33')],_0x28c175[_0x2bac('0x35')]));if(_0xbb10a6['query'][_0x2bac('0x3e')]){_0x37a191[_0x2bac('0x3f')]=_[_0x2bac('0x40')](_0x37a191[_0x2bac('0x3f')],{'$or':_['map'](_0x37a191['attributes'],function(_0x3d5506){var _0x4201e8={};_0x4201e8[_0x3d5506]={'$like':'%'+_0xbb10a6[_0x2bac('0x33')][_0x2bac('0x3e')]+'%'};return _0x4201e8;})});}_0x37a191=_[_0x2bac('0x40')]({},_0x37a191,_0xbb10a6[_0x2bac('0x49')]);return _0x29da06[_0x2bac('0x61')](_0x37a191);}})[_0x2bac('0x26')](function(_0x288b7f){if(_0x288b7f){_0x3d73fc=_0x288b7f[_0x2bac('0x39')];if(!_0xbb10a6[_0x2bac('0x33')][_0x2bac('0x3a')](_0x2bac('0x3b'))){_0x37a191[_0x2bac('0x20')]=qs['limit'](_0xbb10a6[_0x2bac('0x33')][_0x2bac('0x20')]);_0x37a191[_0x2bac('0x1e')]=qs[_0x2bac('0x1e')](_0xbb10a6[_0x2bac('0x33')]['offset']);}return _0x29da06['getLists'](_0x37a191);}})[_0x2bac('0x26')](function(_0xaa8715){if(_0xaa8715){return _0xaa8715?{'count':_0x3d73fc,'rows':_0xaa8715}:null;}})[_0x2bac('0x26')](respondWithResult(_0x5d52ce,null))['catch'](handleError(_0x5d52ce,null));};exports['addLists']=function(_0x129c62,_0x2045c5,_0x4ad84f){var _0x4d348c,_0x1938cf;var _0x51bb80=[];var _0xa525d4=moment()[_0x2bac('0x62')](_0x2bac('0x63'));return db[_0x2bac('0x30')][_0x2bac('0x4f')]({'where':{'id':_0x129c62[_0x2bac('0x47')]['id']}})['then'](handleEntityNotFound(_0x2045c5,null))[_0x2bac('0x26')](function(_0x4e6947){if(_0x4e6947){_0x1938cf=_0x4e6947;return _0x4e6947[_0x2bac('0x64')](_0x129c62[_0x2bac('0x54')][_0x2bac('0x65')],_[_0x2bac('0x66')](_0x129c62[_0x2bac('0x54')],[_0x2bac('0x65'),'id'])||{});}return null;})[_0x2bac('0x67')](function(_0x388fc0){var _0xe28c39;var _0x189ba4;_0x4d348c=_0x388fc0||[];var _0x27454c=[];if(_0x388fc0){for(var _0x1d402b=0x0;_0x1d402b<_0x388fc0['length'];_0x1d402b+=0x1){var _0x48e329=_0x388fc0[_0x1d402b][_0x2bac('0x27')]({'plain':!![]});_0x1938cf['dialCheckDuplicateType']=_0x129c62['body'][_0x2bac('0x68')]?_0x129c62[_0x2bac('0x54')][_0x2bac('0x68')]:_0x1938cf[_0x2bac('0x68')];switch(_0x1938cf[_0x2bac('0x68')]){case _0x2bac('0x69'):_0xe28c39=squel[_0x2bac('0x6a')]()['into'](_0x2bac('0x6b'))['fromQuery']([_0x2bac('0x6c'),_0x2bac('0x6d'),'ContactId',_0x2bac('0x6e'),'CampaignId',_0x2bac('0x6f'),_0x2bac('0x70')],squel[_0x2bac('0x71')]()[_0x2bac('0x72')]('phone',_0x2bac('0x6c'))[_0x2bac('0x72')](_0x2bac('0x73'),_0x2bac('0x6d'))[_0x2bac('0x72')]('id',_0x2bac('0x74'))[_0x2bac('0x72')](_0x48e329['CmListId']['toString'](),'ListId')[_0x2bac('0x72')](_0x129c62[_0x2bac('0x47')]['id'][_0x2bac('0x75')](),_0x2bac('0x5b'))['field']('\x27'+_0xa525d4+'\x27','createdAt')['field']('\x27'+_0xa525d4+'\x27',_0x2bac('0x70'))[_0x2bac('0x76')](_0x2bac('0x77'))['where'](_0x2bac('0x78'))['where'](_0x2bac('0x79'),_0x48e329[_0x2bac('0x7a')][_0x2bac('0x75')]())[_0x2bac('0x3f')](_0x2bac('0x7b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2bac('0x71')]()[_0x2bac('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x2bac('0x76')](_0x2bac('0x7c'))[_0x2bac('0x3f')](_0x2bac('0x7d'),_0x129c62['params']['id'][_0x2bac('0x75')]()))['where'](_0x2bac('0x7e'),squel[_0x2bac('0x71')]()['field']('COALESCE(phone,\x27\x27)')[_0x2bac('0x76')]('cm_hopper')[_0x2bac('0x3f')](_0x2bac('0x7d'),_0x129c62[_0x2bac('0x47')]['id'][_0x2bac('0x75')]())))[_0x2bac('0x75')]();break;case _0x2bac('0x7f'):_0xe28c39=squel[_0x2bac('0x6a')]()['into'](_0x2bac('0x6b'))[_0x2bac('0x80')]([_0x2bac('0x6c'),_0x2bac('0x6d'),_0x2bac('0x74'),'ListId','CampaignId',_0x2bac('0x6f'),_0x2bac('0x70')],squel['select']()[_0x2bac('0x72')]('phone',_0x2bac('0x6c'))[_0x2bac('0x72')]('NOW()',_0x2bac('0x6d'))[_0x2bac('0x72')]('id',_0x2bac('0x74'))[_0x2bac('0x72')](_0x48e329['CmListId']['toString'](),_0x2bac('0x6e'))[_0x2bac('0x72')](_0x129c62[_0x2bac('0x47')]['id'][_0x2bac('0x75')](),_0x2bac('0x5b'))[_0x2bac('0x72')]('\x27'+_0xa525d4+'\x27',_0x2bac('0x6f'))[_0x2bac('0x72')]('\x27'+_0xa525d4+'\x27',_0x2bac('0x70'))[_0x2bac('0x76')]('cm_contacts')[_0x2bac('0x3f')](_0x2bac('0x78'))[_0x2bac('0x3f')](_0x2bac('0x79'),_0x48e329['CmListId']['toString']())[_0x2bac('0x3f')](_0x2bac('0x7b'))[_0x2bac('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2bac('0x71')]()['field'](_0x2bac('0x81'))[_0x2bac('0x76')]('cm_hopper')[_0x2bac('0x3f')](_0x2bac('0x7d'),_0x129c62['params']['id'][_0x2bac('0x75')]())))['toString']();break;default:_0xe28c39=squel['insert']()[_0x2bac('0x82')](_0x2bac('0x6b'))[_0x2bac('0x80')](['phone','scheduledAt',_0x2bac('0x74'),'ListId',_0x2bac('0x5b'),_0x2bac('0x6f'),'updatedAt'],squel['select']()[_0x2bac('0x72')]('phone',_0x2bac('0x6c'))['field'](_0x2bac('0x73'),_0x2bac('0x6d'))[_0x2bac('0x72')]('id',_0x2bac('0x74'))[_0x2bac('0x72')](_0x48e329[_0x2bac('0x7a')][_0x2bac('0x75')](),'ListId')[_0x2bac('0x72')](_0x129c62['params']['id']['toString'](),_0x2bac('0x5b'))[_0x2bac('0x72')]('\x27'+_0xa525d4+'\x27',_0x2bac('0x6f'))[_0x2bac('0x72')]('\x27'+_0xa525d4+'\x27',_0x2bac('0x70'))['from'](_0x2bac('0x77'))['where'](_0x2bac('0x78'))[_0x2bac('0x3f')]('ListId\x20=\x20?',_0x48e329[_0x2bac('0x7a')]['toString']())[_0x2bac('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x2bac('0x75')]();}_0x189ba4=squel[_0x2bac('0x6a')]()[_0x2bac('0x82')](_0x2bac('0x83'))[_0x2bac('0x80')](['cmHopperId','scheduledAt','phone','OrderBy',_0x2bac('0x6f'),_0x2bac('0x70')],squel[_0x2bac('0x71')]()[_0x2bac('0x72')]('h.id','id')[_0x2bac('0x72')](_0x2bac('0x73'),_0x2bac('0x6d'))[_0x2bac('0x72')](_0x2bac('0x84'),_0x2bac('0x6c'))[_0x2bac('0x72')](_0x2bac('0x85'),_0x2bac('0x86'))['field']('\x27'+_0xa525d4+'\x27',_0x2bac('0x6f'))[_0x2bac('0x72')]('\x27'+_0xa525d4+'\x27',_0x2bac('0x70'))[_0x2bac('0x76')](_0x2bac('0x87'),'ci')['join']('cm_hopper','h',_0x2bac('0x88'))[_0x2bac('0x3f')](_0x2bac('0x89'),_0x48e329[_0x2bac('0x7a')][_0x2bac('0x75')]())[_0x2bac('0x3f')](_0x2bac('0x8a'),_0x129c62['params']['id'][_0x2bac('0x75')]())[_0x2bac('0x3f')](_0x2bac('0x8b'),_0xa525d4))['toString']();_0x27454c[_0x2bac('0x8c')](db[_0x2bac('0x8d')]['query'](_0xe28c39));_0x51bb80[_0x2bac('0x8c')](db[_0x2bac('0x8d')][_0x2bac('0x33')](_0x189ba4));}return BPromise[_0x2bac('0x8e')](_0x27454c);}})[_0x2bac('0x26')](function(){return BPromise['all'](_0x51bb80);})[_0x2bac('0x26')](function(){return _0x4d348c;})['then'](respondWithResult(_0x2045c5,null))['catch'](handleError(_0x2045c5,null));};exports['removeLists']=function(_0x440021,_0x50801d,_0xf26394){return db[_0x2bac('0x30')][_0x2bac('0x4f')]({'where':{'id':_0x440021[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x50801d,null))[_0x2bac('0x26')](function(_0x124d83){if(_0x124d83){return _0x124d83['removeLists'](_0x440021[_0x2bac('0x33')]['ids']);}})[_0x2bac('0x26')](function(_0x139700){if(_0x139700){return db[_0x2bac('0x59')][_0x2bac('0x29')]({'where':{'ListId':_0x440021[_0x2bac('0x33')]['ids'],'CampaignId':_0x440021[_0x2bac('0x47')]['id']}})['then'](function(){return _0x139700;});}})[_0x2bac('0x26')](respondWithStatusCode(_0x50801d,null))[_0x2bac('0x45')](handleError(_0x50801d,null));};exports[_0x2bac('0x8f')]=function(_0x51a4c5,_0x309771,_0x3db263){var _0x232de8={};var _0x2d3e7f={};var _0x911518;var _0x1fcf59;return db[_0x2bac('0x30')][_0x2bac('0x58')]({'where':{'id':_0x51a4c5[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x309771,null))[_0x2bac('0x26')](function(_0x1b3e9b){if(_0x1b3e9b){_0x911518=_0x1b3e9b;_0x2d3e7f[_0x2bac('0x32')]=_[_0x2bac('0x34')](db[_0x2bac('0x90')]['rawAttributes']);_0x2d3e7f[_0x2bac('0x33')]=_['keys'](_0x51a4c5[_0x2bac('0x33')]);_0x2d3e7f[_0x2bac('0x35')]=_[_0x2bac('0x36')](_0x2d3e7f[_0x2bac('0x32')],_0x2d3e7f[_0x2bac('0x33')]);_0x232de8[_0x2bac('0x38')]=_[_0x2bac('0x36')](_0x2d3e7f['model'],qs[_0x2bac('0x37')](_0x51a4c5['query'][_0x2bac('0x37')]));_0x232de8['attributes']=_0x232de8[_0x2bac('0x38')][_0x2bac('0x39')]?_0x232de8['attributes']:_0x2d3e7f[_0x2bac('0x32')];_0x232de8[_0x2bac('0x5a')]=qs[_0x2bac('0x3c')](_0x51a4c5[_0x2bac('0x33')][_0x2bac('0x3c')]);_0x232de8[_0x2bac('0x3f')]=qs[_0x2bac('0x35')](_[_0x2bac('0x3d')](_0x51a4c5[_0x2bac('0x33')],_0x2d3e7f[_0x2bac('0x35')]));if(_0x51a4c5['query'][_0x2bac('0x3e')]){_0x232de8[_0x2bac('0x3f')]=_[_0x2bac('0x40')](_0x232de8[_0x2bac('0x3f')],{'$or':_[_0x2bac('0x2f')](_0x232de8[_0x2bac('0x38')],function(_0xfc4f28){var _0x2dfb9a={};_0x2dfb9a[_0xfc4f28]={'$like':'%'+_0x51a4c5[_0x2bac('0x33')][_0x2bac('0x3e')]+'%'};return _0x2dfb9a;})});}_0x232de8=_[_0x2bac('0x40')]({},_0x232de8,_0x51a4c5['options']);return _0x911518[_0x2bac('0x8f')](_0x232de8);}})[_0x2bac('0x26')](function(_0x36ea81){if(_0x36ea81){_0x1fcf59=_0x36ea81['length'];if(!_0x51a4c5[_0x2bac('0x33')]['hasOwnProperty'](_0x2bac('0x3b'))){_0x232de8[_0x2bac('0x20')]=qs['limit'](_0x51a4c5[_0x2bac('0x33')][_0x2bac('0x20')]);_0x232de8['offset']=qs[_0x2bac('0x1e')](_0x51a4c5[_0x2bac('0x33')]['offset']);}return _0x911518[_0x2bac('0x8f')](_0x232de8);}})['then'](function(_0x4af0d9){if(_0x4af0d9){return _0x4af0d9?{'count':_0x1fcf59,'rows':_0x4af0d9}:null;}})[_0x2bac('0x26')](respondWithResult(_0x309771,null))[_0x2bac('0x45')](handleError(_0x309771,null));};exports[_0x2bac('0x91')]=function(_0xdc3647,_0x78bfbb,_0xf71a0c){var _0x1d07ca,_0x385db3;var _0x565523=[];var _0x4c2c45=moment()[_0x2bac('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x2bac('0x30')][_0x2bac('0x4f')]({'where':{'id':_0xdc3647[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x78bfbb,null))[_0x2bac('0x26')](function(_0x88fd30){if(_0x88fd30){_0x385db3=_0x88fd30;return _0x88fd30[_0x2bac('0x91')](_0xdc3647[_0x2bac('0x54')][_0x2bac('0x65')],_['omit'](_0xdc3647['body'],[_0x2bac('0x65'),'id'])||{});}return null;})[_0x2bac('0x67')](function(_0x264fe1){var _0x2790a4;var _0x4a43ac;_0x1d07ca=_0x264fe1||[];var _0x4fb662=[];if(_0x264fe1){for(var _0x147711=0x0;_0x147711<_0x264fe1['length'];_0x147711+=0x1){var _0x44599b=_0x264fe1[_0x147711]['get']({'plain':!![]});_0x2790a4=squel[_0x2bac('0x6a')]()['into'](_0x2bac('0x92'))[_0x2bac('0x80')](['phone',_0x2bac('0x74'),_0x2bac('0x6e'),_0x2bac('0x5b'),_0x2bac('0x6f'),'updatedAt'],squel[_0x2bac('0x71')]()['field'](_0x2bac('0x6c'),_0x2bac('0x6c'))[_0x2bac('0x72')]('id','ContactId')[_0x2bac('0x72')](_0x44599b[_0x2bac('0x7a')][_0x2bac('0x75')](),_0x2bac('0x6e'))[_0x2bac('0x72')](_0xdc3647[_0x2bac('0x47')]['id'][_0x2bac('0x75')](),'CampaignId')[_0x2bac('0x72')](_0x2bac('0x73'),_0x2bac('0x6f'))[_0x2bac('0x72')]('NOW()',_0x2bac('0x70'))[_0x2bac('0x76')](_0x2bac('0x77'))[_0x2bac('0x3f')](_0x2bac('0x78'))[_0x2bac('0x3f')]('ListId\x20=\x20?',_0x44599b[_0x2bac('0x7a')][_0x2bac('0x75')]())['where'](_0x2bac('0x7b')))['toString']();_0x4fb662[_0x2bac('0x8c')](db[_0x2bac('0x8d')][_0x2bac('0x33')](_0x2790a4));}return BPromise[_0x2bac('0x8e')](_0x4fb662);}})[_0x2bac('0x26')](function(){return _0x1d07ca;})['then'](respondWithResult(_0x78bfbb,null))[_0x2bac('0x45')](handleError(_0x78bfbb,null));};exports[_0x2bac('0x93')]=function(_0x217113,_0x40d8d1,_0x35a1ac){return db[_0x2bac('0x30')][_0x2bac('0x4f')]({'where':{'id':_0x217113[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](handleEntityNotFound(_0x40d8d1,null))[_0x2bac('0x26')](function(_0x2fdc36){if(_0x2fdc36){return _0x2fdc36[_0x2bac('0x93')](_0x217113['query'][_0x2bac('0x65')]);}})['then'](function(_0x4e49f6){if(_0x4e49f6){return db[_0x2bac('0x60')][_0x2bac('0x29')]({'where':{'ListId':_0x217113[_0x2bac('0x33')][_0x2bac('0x65')],'CampaignId':_0x217113[_0x2bac('0x47')]['id']}})[_0x2bac('0x26')](function(){return _0x4e49f6;});}})[_0x2bac('0x26')](respondWithStatusCode(_0x40d8d1,null))[_0x2bac('0x45')](handleError(_0x40d8d1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index cbbd169..24f7dad 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3be3c61..37e2cfa 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18a5=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','catch','lodash','util','randomstring','../../mysqldb'];(function(_0x2408d4,_0x137e4b){var _0x3fdac1=function(_0x32ea32){while(--_0x32ea32){_0x2408d4['push'](_0x2408d4['shift']());}};_0x3fdac1(++_0x137e4b);}(_0x18a5,0x164));var _0x518a=function(_0x3557ce,_0x6e74c9){_0x3557ce=_0x3557ce-0x0;var _0x3bcff7=_0x18a5[_0x3557ce];return _0x3bcff7;};'use strict';var _=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x518a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x518a('0x3'))['db'];var utils=require(_0x518a('0x4'));var logger=require(_0x518a('0x5'))(_0x518a('0x6'));var config=require(_0x518a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea311,_0x1d4199,_0x19a2df){return new BPromise(function(_0x2a5fa6,_0x8bd966){return client[_0x518a('0x8')](_0x2ea311,_0x19a2df)[_0x518a('0x9')](function(_0xb996c3){logger[_0x518a('0xa')](_0x518a('0xb'),_0x1d4199,_0x518a('0xc'));logger[_0x518a('0xd')](_0x518a('0xe'),_0x1d4199,_0x518a('0xc'),JSON[_0x518a('0xf')](_0xb996c3));if(_0xb996c3['error']){if(_0xb996c3[_0x518a('0x10')]['code']===0x1f4){logger[_0x518a('0x10')]('Campaign,\x20%s,\x20%s',_0x1d4199,_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);return _0x8bd966(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}logger[_0x518a('0x10')](_0x518a('0xb'),_0x1d4199,_0xb996c3[_0x518a('0x10')]['message']);return _0x2a5fa6(_0xb996c3[_0x518a('0x10')][_0x518a('0x11')]);}else{logger[_0x518a('0xa')]('Campaign,\x20%s,\x20%s',_0x1d4199,_0x518a('0xc'));_0x2a5fa6(_0xb996c3[_0x518a('0x12')]['message']);}})['catch'](function(_0x177882){logger['error'](_0x518a('0xb'),_0x1d4199,_0x177882);_0x8bd966(_0x177882);});});}exports[_0x518a('0x13')]=function(_0x244e66){var _0x336da8=this;return new Promise(function(_0xa5f6ac,_0x26330e){return db[_0x518a('0x14')][_0x518a('0x15')]({'raw':_0x244e66[_0x518a('0x16')]?_0x244e66[_0x518a('0x16')][_0x518a('0x17')]===undefined?!![]:![]:!![],'where':_0x244e66[_0x518a('0x16')]?_0x244e66[_0x518a('0x16')]['where']||null:null,'attributes':_0x244e66[_0x518a('0x16')]?_0x244e66['options'][_0x518a('0x18')]||null:null,'limit':_0x244e66['options']?_0x244e66[_0x518a('0x16')][_0x518a('0x19')]||null:null,'include':_0x244e66[_0x518a('0x16')]?_0x244e66[_0x518a('0x16')][_0x518a('0x1a')]?_[_0x518a('0x1b')](_0x244e66['options']['include'],function(_0x590fc2){return{'model':db[_0x590fc2[_0x518a('0x1c')]],'as':_0x590fc2['as'],'attributes':_0x590fc2['attributes'],'include':_0x590fc2[_0x518a('0x1a')]?_[_0x518a('0x1b')](_0x590fc2[_0x518a('0x1a')],function(_0x941f58){return{'model':db[_0x941f58[_0x518a('0x1c')]],'as':_0x941f58['as'],'attributes':_0x941f58[_0x518a('0x18')],'include':_0x941f58[_0x518a('0x1a')]?_[_0x518a('0x1b')](_0x941f58[_0x518a('0x1a')],function(_0x262260){return{'model':db[_0x262260[_0x518a('0x1c')]],'as':_0x262260['as'],'attributes':_0x262260[_0x518a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x518a('0x9')](function(_0x3eadb2){logger['info']('GetCampaign',_0x244e66);logger['debug'](_0x518a('0x13'),_0x244e66,JSON[_0x518a('0xf')](_0x3eadb2));_0xa5f6ac(_0x3eadb2);})[_0x518a('0x1d')](function(_0x4cf043){logger['error'](_0x518a('0x13'),_0x4cf043['message'],_0x244e66);_0x26330e(_0x336da8['error'](0x1f4,_0x4cf043[_0x518a('0x11')]));});});}; \ No newline at end of file +var _0x255f=['message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xe12aa8,_0xd52c23){var _0x3f663a=function(_0x4cd15c){while(--_0x4cd15c){_0xe12aa8['push'](_0xe12aa8['shift']());}};_0x3f663a(++_0xd52c23);}(_0x255f,0x185));var _0xf255=function(_0xf02b6c,_0x27fbdd){_0xf02b6c=_0xf02b6c-0x0;var _0x122898=_0x255f[_0xf02b6c];return _0x122898;};'use strict';var _=require(_0xf255('0x0'));var util=require('util');var moment=require(_0xf255('0x1'));var BPromise=require(_0xf255('0x2'));var rs=require(_0xf255('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf255('0x4'))['db'];var utils=require(_0xf255('0x5'));var logger=require(_0xf255('0x6'))(_0xf255('0x7'));var config=require(_0xf255('0x8'));var jayson=require(_0xf255('0x9'));var client=jayson[_0xf255('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1236fb,_0x4b98fa,_0x481d8c){return new BPromise(function(_0x4a533f,_0x3cc3fc){return client['request'](_0x1236fb,_0x481d8c)[_0xf255('0xb')](function(_0x2f6020){logger['info'](_0xf255('0xc'),_0x4b98fa,'request\x20sent');logger[_0xf255('0xd')](_0xf255('0xe'),_0x4b98fa,_0xf255('0xf'),JSON[_0xf255('0x10')](_0x2f6020));if(_0x2f6020[_0xf255('0x11')]){if(_0x2f6020['error'][_0xf255('0x12')]===0x1f4){logger[_0xf255('0x11')](_0xf255('0xc'),_0x4b98fa,_0x2f6020['error'][_0xf255('0x13')]);return _0x3cc3fc(_0x2f6020[_0xf255('0x11')]['message']);}logger[_0xf255('0x11')](_0xf255('0xc'),_0x4b98fa,_0x2f6020[_0xf255('0x11')]['message']);return _0x4a533f(_0x2f6020[_0xf255('0x11')][_0xf255('0x13')]);}else{logger[_0xf255('0x14')](_0xf255('0xc'),_0x4b98fa,_0xf255('0xf'));_0x4a533f(_0x2f6020[_0xf255('0x15')]['message']);}})[_0xf255('0x16')](function(_0x4ed7c0){logger[_0xf255('0x11')]('Campaign,\x20%s,\x20%s',_0x4b98fa,_0x4ed7c0);_0x3cc3fc(_0x4ed7c0);});});}exports[_0xf255('0x17')]=function(_0x426286){var _0x45b51b=this;return new Promise(function(_0x43902c,_0x186558){return db[_0xf255('0x18')][_0xf255('0x19')]({'raw':_0x426286[_0xf255('0x1a')]?_0x426286[_0xf255('0x1a')][_0xf255('0x1b')]===undefined?!![]:![]:!![],'where':_0x426286[_0xf255('0x1a')]?_0x426286['options'][_0xf255('0x1c')]||null:null,'attributes':_0x426286[_0xf255('0x1a')]?_0x426286[_0xf255('0x1a')][_0xf255('0x1d')]||null:null,'limit':_0x426286[_0xf255('0x1a')]?_0x426286[_0xf255('0x1a')][_0xf255('0x1e')]||null:null,'include':_0x426286['options']?_0x426286[_0xf255('0x1a')][_0xf255('0x1f')]?_[_0xf255('0x20')](_0x426286[_0xf255('0x1a')][_0xf255('0x1f')],function(_0x1b3b1a){return{'model':db[_0x1b3b1a[_0xf255('0x21')]],'as':_0x1b3b1a['as'],'attributes':_0x1b3b1a['attributes'],'include':_0x1b3b1a[_0xf255('0x1f')]?_['map'](_0x1b3b1a['include'],function(_0x3d64c5){return{'model':db[_0x3d64c5[_0xf255('0x21')]],'as':_0x3d64c5['as'],'attributes':_0x3d64c5[_0xf255('0x1d')],'include':_0x3d64c5[_0xf255('0x1f')]?_[_0xf255('0x20')](_0x3d64c5['include'],function(_0x1c3a8e){return{'model':db[_0x1c3a8e[_0xf255('0x21')]],'as':_0x1c3a8e['as'],'attributes':_0x1c3a8e[_0xf255('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b1980){logger[_0xf255('0x14')](_0xf255('0x17'),_0x426286);logger['debug'](_0xf255('0x17'),_0x426286,JSON[_0xf255('0x10')](_0x1b1980));_0x43902c(_0x1b1980);})[_0xf255('0x16')](function(_0x39aac5){logger[_0xf255('0x11')](_0xf255('0x17'),_0x39aac5[_0xf255('0x13')],_0x426286);_0x186558(_0x45b51b[_0xf255('0x11')](0x1f4,_0x39aac5[_0xf255('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 39d7504..4b54c43 100644 --- a/server/api/campaign/index.js +++ b/server/api/campaign/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11db=['show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id'];(function(_0x50a889,_0x2a32f9){var _0x3ff87f=function(_0x2de24b){while(--_0x2de24b){_0x50a889['push'](_0x50a889['shift']());}};_0x3ff87f(++_0x2a32f9);}(_0x11db,0x146));var _0xb11d=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x11db[_0x12f688];return _0x59c3de;};'use strict';var multer=require(_0xb11d('0x0'));var util=require(_0xb11d('0x1'));var path=require(_0xb11d('0x2'));var timeout=require(_0xb11d('0x3'));var express=require(_0xb11d('0x4'));var router=express['Router']();var fs_extra=require(_0xb11d('0x5'));var auth=require(_0xb11d('0x6'));var interaction=require(_0xb11d('0x7'));var config=require(_0xb11d('0x8'));var controller=require(_0xb11d('0x9'));router[_0xb11d('0xa')]('/',auth[_0xb11d('0xb')](),controller[_0xb11d('0xc')]);router[_0xb11d('0xa')](_0xb11d('0xd'),auth['isAuthenticated'](),controller[_0xb11d('0xe')]);router[_0xb11d('0xa')](_0xb11d('0xf'),auth['isAuthenticated'](),controller[_0xb11d('0x10')]);router[_0xb11d('0xa')](_0xb11d('0x11'),auth[_0xb11d('0xb')](),controller[_0xb11d('0x12')]);router[_0xb11d('0xa')]('/:id/hopper_finals',auth[_0xb11d('0xb')](),controller['getHopperFinals']);router[_0xb11d('0xa')]('/:id/hopper_black',auth[_0xb11d('0xb')](),controller[_0xb11d('0x13')]);router[_0xb11d('0xa')](_0xb11d('0x14'),auth['isAuthenticated'](),controller[_0xb11d('0x15')]);router[_0xb11d('0xa')](_0xb11d('0x16'),auth[_0xb11d('0xb')](),controller[_0xb11d('0x17')]);router[_0xb11d('0x18')]('/',auth[_0xb11d('0xb')](),controller[_0xb11d('0x19')]);router['post'](_0xb11d('0x1a'),auth['isAuthenticated'](),controller[_0xb11d('0x1b')]);router[_0xb11d('0x18')]('/:id/lists',auth[_0xb11d('0xb')](),controller[_0xb11d('0x1c')]);router[_0xb11d('0x18')](_0xb11d('0x16'),auth[_0xb11d('0xb')](),controller[_0xb11d('0x1d')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb11d('0x1e')]);router[_0xb11d('0x1f')](_0xb11d('0xd'),auth[_0xb11d('0xb')](),controller[_0xb11d('0x20')]);router[_0xb11d('0x1f')](_0xb11d('0x14'),auth[_0xb11d('0xb')](),controller['removeLists']);router['delete']('/:id/blacklists',auth[_0xb11d('0xb')](),controller['removeBlackLists']);module[_0xb11d('0x21')]=router; \ No newline at end of file +var _0x0b18=['/:id/lists','/:id/blacklists','getBlackLists','post','create','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x0b18,0x199));var _0x80b1=function(_0x121985,_0x252db3){_0x121985=_0x121985-0x0;var _0x20bc79=_0x0b18[_0x121985];return _0x20bc79;};'use strict';var multer=require(_0x80b1('0x0'));var util=require(_0x80b1('0x1'));var path=require(_0x80b1('0x2'));var timeout=require(_0x80b1('0x3'));var express=require(_0x80b1('0x4'));var router=express['Router']();var fs_extra=require(_0x80b1('0x5'));var auth=require(_0x80b1('0x6'));var interaction=require(_0x80b1('0x7'));var config=require(_0x80b1('0x8'));var controller=require(_0x80b1('0x9'));router[_0x80b1('0xa')]('/',auth[_0x80b1('0xb')](),controller['index']);router['get'](_0x80b1('0xc'),auth[_0x80b1('0xb')](),controller[_0x80b1('0xd')]);router['get'](_0x80b1('0xe'),auth[_0x80b1('0xb')](),controller[_0x80b1('0xf')]);router[_0x80b1('0xa')](_0x80b1('0x10'),auth[_0x80b1('0xb')](),controller[_0x80b1('0x11')]);router[_0x80b1('0xa')](_0x80b1('0x12'),auth[_0x80b1('0xb')](),controller['getHopperFinals']);router[_0x80b1('0xa')]('/:id/hopper_black',auth[_0x80b1('0xb')](),controller[_0x80b1('0x13')]);router[_0x80b1('0xa')](_0x80b1('0x14'),auth[_0x80b1('0xb')](),controller['getLists']);router[_0x80b1('0xa')](_0x80b1('0x15'),auth[_0x80b1('0xb')](),controller[_0x80b1('0x16')]);router[_0x80b1('0x17')]('/',auth[_0x80b1('0xb')](),controller[_0x80b1('0x18')]);router[_0x80b1('0x17')]('/:id/clone',auth[_0x80b1('0xb')](),controller['clone']);router[_0x80b1('0x17')](_0x80b1('0x14'),auth[_0x80b1('0xb')](),controller[_0x80b1('0x19')]);router[_0x80b1('0x17')](_0x80b1('0x15'),auth[_0x80b1('0xb')](),controller[_0x80b1('0x1a')]);router[_0x80b1('0x1b')]('/:id',auth[_0x80b1('0xb')](),controller['update']);router[_0x80b1('0x1c')](_0x80b1('0xc'),auth[_0x80b1('0xb')](),controller[_0x80b1('0x1d')]);router[_0x80b1('0x1c')](_0x80b1('0x14'),auth[_0x80b1('0xb')](),controller[_0x80b1('0x1e')]);router[_0x80b1('0x1c')](_0x80b1('0x15'),auth[_0x80b1('0xb')](),controller[_0x80b1('0x1f')]);module[_0x80b1('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e303ea6..f0b07ab 100644 --- a/server/api/cannedAnswer/cannedAnswer.attributes.js +++ b/server/api/cannedAnswer/cannedAnswer.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f12=['exports','STRING','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0f12,0xd1));var _0x20f1=function(_0x53e85e,_0x3f9f42){_0x53e85e=_0x53e85e-0x0;var _0xf2f1e2=_0x0f12[_0x53e85e];return _0xf2f1e2;};'use strict';var Sequelize=require(_0x20f1('0x0'));module[_0x20f1('0x1')]={'key':{'type':Sequelize[_0x20f1('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x20f1('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x20f1('0x2')]},'name':{'type':Sequelize[_0x20f1('0x4')],'get':function(){return this[_0x20f1('0x5')](_0x20f1('0x6'));}}}; \ No newline at end of file +var _0xb4e0=['sequelize','TEXT','getDataValue','key'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb4e0,0xf4));var _0x0b4e=function(_0x2aadfb,_0x489787){_0x2aadfb=_0x2aadfb-0x0;var _0xcd821e=_0xb4e0[_0x2aadfb];return _0xcd821e;};'use strict';var Sequelize=require(_0x0b4e('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x0b4e('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0b4e('0x2')](_0x0b4e('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 234796d..220aa2b 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd0c=['../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1c1804,_0x58de42){var _0x13df22=function(_0x427ee6){while(--_0x427ee6){_0x1c1804['push'](_0x1c1804['shift']());}};_0x13df22(++_0x58de42);}(_0xcd0c,0x1aa));var _0xccd0=function(_0xe9c8e4,_0x3aa2f6){_0xe9c8e4=_0xe9c8e4-0x0;var _0x2037fa=_0xcd0c[_0xe9c8e4];return _0x2037fa;};'use strict';var emlformat=require(_0xccd0('0x0'));var rimraf=require(_0xccd0('0x1'));var zipdir=require(_0xccd0('0x2'));var jsonpatch=require(_0xccd0('0x3'));var rp=require('request-promise');var moment=require(_0xccd0('0x4'));var BPromise=require(_0xccd0('0x5'));var Mustache=require(_0xccd0('0x6'));var util=require(_0xccd0('0x7'));var path=require('path');var sox=require(_0xccd0('0x8'));var csv=require('to-csv');var ejs=require(_0xccd0('0x9'));var fs=require('fs');var fs_extra=require(_0xccd0('0xa'));var _=require(_0xccd0('0xb'));var squel=require(_0xccd0('0xc'));var crypto=require('crypto');var jsforce=require(_0xccd0('0xd'));var deskjs=require(_0xccd0('0xe'));var toCsv=require(_0xccd0('0xf'));var querystring=require(_0xccd0('0x10'));var Papa=require('papaparse');var Redis=require(_0xccd0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xccd0('0x12'));var hardwareService=require(_0xccd0('0x13'));var logger=require(_0xccd0('0x14'))(_0xccd0('0x15'));var utils=require(_0xccd0('0x16'));var config=require(_0xccd0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xccd0('0x18'))['db'];function respondWithStatusCode(_0x5861b6,_0x29644a){_0x29644a=_0x29644a||0xcc;return function(_0x268c84){if(_0x268c84){return _0x5861b6['sendStatus'](_0x29644a);}return _0x5861b6[_0xccd0('0x19')](_0x29644a)[_0xccd0('0x1a')]();};}function respondWithResult(_0x52af9f,_0x270856){_0x270856=_0x270856||0xc8;return function(_0x570e23){if(_0x570e23){return _0x52af9f[_0xccd0('0x19')](_0x270856)[_0xccd0('0x1b')](_0x570e23);}};}function respondWithFilteredResult(_0x4ea865,_0x3448aa){return function(_0x1b10f4){if(_0x1b10f4){var _0x5e1eda=typeof _0x3448aa['offset']===_0xccd0('0x1c')&&typeof _0x3448aa[_0xccd0('0x1d')]===_0xccd0('0x1c');var _0xaed907=_0x1b10f4[_0xccd0('0x1e')];var _0x4f5804=_0x5e1eda?0x0:_0x3448aa['offset'];var _0x3cc938=_0x5e1eda?_0x1b10f4['count']:_0x3448aa[_0xccd0('0x1f')]+_0x3448aa['limit'];var _0x443df5;if(_0x3cc938>=_0xaed907){_0x3cc938=_0xaed907;_0x443df5=0xc8;}else{_0x443df5=0xce;}_0x4ea865[_0xccd0('0x19')](_0x443df5);return _0x4ea865[_0xccd0('0x20')](_0xccd0('0x21'),_0x4f5804+'-'+_0x3cc938+'/'+_0xaed907)['json'](_0x1b10f4);}return null;};}function patchUpdates(_0x1f485b){return function(_0x22fb21){try{jsonpatch['apply'](_0x22fb21,_0x1f485b,!![]);}catch(_0x34f571){return BPromise[_0xccd0('0x22')](_0x34f571);}return _0x22fb21[_0xccd0('0x23')]();};}function saveUpdates(_0x53b40f,_0x47b524){return function(_0x379feb){if(_0x379feb){return _0x379feb[_0xccd0('0x24')](_0x53b40f)[_0xccd0('0x25')](function(_0x3b9194){return _0x3b9194;});}return null;};}function removeEntity(_0x41bc85,_0x225a5d){return function(_0x44ba85){if(_0x44ba85){return _0x44ba85[_0xccd0('0x26')]()[_0xccd0('0x25')](function(){var _0x9579=_0x44ba85[_0xccd0('0x27')]({'plain':!![]});var _0x4671de=_0xccd0('0x28');return db[_0xccd0('0x29')][_0xccd0('0x26')]({'where':{'type':_0x4671de,'resourceId':_0x9579['id']}})[_0xccd0('0x25')](function(){return _0x44ba85;});})['then'](function(){_0x41bc85[_0xccd0('0x19')](0xcc)[_0xccd0('0x1a')]();});}};}function handleEntityNotFound(_0x3fdf49,_0xba71f2){return function(_0x328523){if(!_0x328523){_0x3fdf49[_0xccd0('0x2a')](0x194);}return _0x328523;};}function handleError(_0x584efd,_0x5c40b1){_0x5c40b1=_0x5c40b1||0x1f4;return function(_0x36cde0){logger[_0xccd0('0x2b')](_0x36cde0[_0xccd0('0x2c')]);if(_0x36cde0[_0xccd0('0x2d')]){delete _0x36cde0[_0xccd0('0x2d')];}_0x584efd['status'](_0x5c40b1)[_0xccd0('0x2e')](_0x36cde0);};}exports[_0xccd0('0x2f')]=function(_0x200b83,_0x171294){var _0xf2c2b9={},_0x56282c={},_0x2cfce5={'count':0x0,'rows':[]};var _0x4c2cf8=_[_0xccd0('0x30')](db['CannedAnswer']['rawAttributes'],function(_0x59df45){return{'name':_0x59df45[_0xccd0('0x31')],'type':_0x59df45[_0xccd0('0x32')][_0xccd0('0x33')]};});_0x56282c[_0xccd0('0x34')]=_[_0xccd0('0x30')](_0x4c2cf8,_0xccd0('0x2d'));_0x56282c[_0xccd0('0x35')]=_['keys'](_0x200b83[_0xccd0('0x35')]);_0x56282c['filters']=_[_0xccd0('0x36')](_0x56282c[_0xccd0('0x34')],_0x56282c[_0xccd0('0x35')]);_0xf2c2b9[_0xccd0('0x37')]=_['intersection'](_0x56282c[_0xccd0('0x34')],qs['fields'](_0x200b83[_0xccd0('0x35')][_0xccd0('0x38')]));_0xf2c2b9[_0xccd0('0x37')]=_0xf2c2b9['attributes'][_0xccd0('0x39')]?_0xf2c2b9[_0xccd0('0x37')]:_0x56282c[_0xccd0('0x34')];if(!_0x200b83[_0xccd0('0x35')]['hasOwnProperty'](_0xccd0('0x3a'))){_0xf2c2b9['limit']=qs['limit'](_0x200b83['query'][_0xccd0('0x1d')]);_0xf2c2b9['offset']=qs[_0xccd0('0x1f')](_0x200b83[_0xccd0('0x35')][_0xccd0('0x1f')]);}_0xf2c2b9[_0xccd0('0x3b')]=qs[_0xccd0('0x3c')](_0x200b83[_0xccd0('0x35')][_0xccd0('0x3c')]);_0xf2c2b9[_0xccd0('0x3d')]=qs[_0xccd0('0x3e')](_[_0xccd0('0x3f')](_0x200b83[_0xccd0('0x35')],_0x56282c[_0xccd0('0x3e')]),_0x4c2cf8);if(_0x200b83[_0xccd0('0x35')][_0xccd0('0x40')]){_0xf2c2b9[_0xccd0('0x3d')]=_[_0xccd0('0x41')](_0xf2c2b9[_0xccd0('0x3d')],{'$or':[{'key':{'$like':'%'+_0x200b83[_0xccd0('0x35')][_0xccd0('0x40')]+'%'}},{'value':{'$like':'%'+_0x200b83[_0xccd0('0x35')]['filter']+'%'}}]});}_0xf2c2b9=_[_0xccd0('0x41')]({},_0xf2c2b9,_0x200b83[_0xccd0('0x42')]);var _0x128cc0={'where':_0xf2c2b9[_0xccd0('0x3d')]};return db[_0xccd0('0x43')][_0xccd0('0x1e')](_0x128cc0)['then'](function(_0x50f0d2){_0x2cfce5[_0xccd0('0x1e')]=_0x50f0d2;if(_0x200b83[_0xccd0('0x35')][_0xccd0('0x44')]){_0xf2c2b9[_0xccd0('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0xccd0('0x46')](_0xf2c2b9);})['then'](function(_0x4768df){_0x2cfce5[_0xccd0('0x47')]=_0x4768df;return _0x2cfce5;})[_0xccd0('0x25')](respondWithFilteredResult(_0x171294,_0xf2c2b9))[_0xccd0('0x48')](handleError(_0x171294,null));};exports['show']=function(_0x4dde38,_0x1dc91c){var _0x1f6387={'raw':!![],'where':{'id':_0x4dde38['params']['id']}},_0x2a035f={};_0x2a035f[_0xccd0('0x34')]=_[_0xccd0('0x49')](db['CannedAnswer'][_0xccd0('0x4a')]);_0x2a035f[_0xccd0('0x35')]=_['keys'](_0x4dde38[_0xccd0('0x35')]);_0x2a035f[_0xccd0('0x3e')]=_[_0xccd0('0x36')](_0x2a035f[_0xccd0('0x34')],_0x2a035f[_0xccd0('0x35')]);_0x1f6387[_0xccd0('0x37')]=_['intersection'](_0x2a035f[_0xccd0('0x34')],qs['fields'](_0x4dde38[_0xccd0('0x35')]['fields']));_0x1f6387[_0xccd0('0x37')]=_0x1f6387[_0xccd0('0x37')][_0xccd0('0x39')]?_0x1f6387[_0xccd0('0x37')]:_0x2a035f[_0xccd0('0x34')];if(_0x4dde38[_0xccd0('0x35')][_0xccd0('0x44')]){_0x1f6387['include']=[{'all':!![]}];}_0x1f6387=_[_0xccd0('0x41')]({},_0x1f6387,_0x4dde38['options']);return db[_0xccd0('0x43')][_0xccd0('0x4b')](_0x1f6387)[_0xccd0('0x25')](handleEntityNotFound(_0x1dc91c,null))[_0xccd0('0x25')](respondWithResult(_0x1dc91c,null))[_0xccd0('0x48')](handleError(_0x1dc91c,null));};exports[_0xccd0('0x24')]=function(_0x2369c2,_0xbdeb45){if(_0x2369c2[_0xccd0('0x4c')]['id']){delete _0x2369c2[_0xccd0('0x4c')]['id'];}return db[_0xccd0('0x43')][_0xccd0('0x4b')]({'where':{'id':_0x2369c2[_0xccd0('0x4d')]['id']}})['then'](handleEntityNotFound(_0xbdeb45,null))[_0xccd0('0x25')](saveUpdates(_0x2369c2[_0xccd0('0x4c')],null))[_0xccd0('0x25')](respondWithResult(_0xbdeb45,null))[_0xccd0('0x48')](handleError(_0xbdeb45,null));};exports[_0xccd0('0x26')]=function(_0x2fa3f8,_0x56de5f){return db['CannedAnswer']['find']({'where':{'id':_0x2fa3f8[_0xccd0('0x4d')]['id']}})[_0xccd0('0x25')](handleEntityNotFound(_0x56de5f,null))[_0xccd0('0x25')](removeEntity(_0x56de5f,null))['catch'](handleError(_0x56de5f,null));};exports[_0xccd0('0x4e')]=function(_0x193b21,_0x2ffaf){var _0x23e644={'key':_0x193b21['body'][_0xccd0('0x33')]};if(_0x193b21[_0xccd0('0x4c')]['MailAccountId']){_0x23e644[_0xccd0('0x4f')]=_0x193b21[_0xccd0('0x4c')][_0xccd0('0x4f')];}else if(_0x193b21[_0xccd0('0x4c')][_0xccd0('0x50')]){_0x23e644[_0xccd0('0x50')]=_0x193b21['body'][_0xccd0('0x50')];}else if(_0x193b21[_0xccd0('0x4c')][_0xccd0('0x51')]){_0x23e644['OpenchannelAccountId']=_0x193b21[_0xccd0('0x4c')][_0xccd0('0x51')];}else if(_0x193b21['body'][_0xccd0('0x52')]){_0x23e644['ChatWebsiteId']=_0x193b21[_0xccd0('0x4c')]['ChatWebsiteId'];}return db[_0xccd0('0x43')][_0xccd0('0x4b')]({'where':_0x23e644})['then'](function(_0x2b0ebf){if(_0x2b0ebf){throw new db[(_0xccd0('0x53'))][(_0xccd0('0x54'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xccd0('0x43')][_0xccd0('0x4e')](_0x193b21[_0xccd0('0x4c')]);})[_0xccd0('0x25')](function(_0x43eb1c){var _0x495d8d=_0x193b21['user'][_0xccd0('0x27')]({'plain':!![]});if(!_0x495d8d)throw new Error(_0xccd0('0x55'));if(_0x495d8d[_0xccd0('0x56')]===_0xccd0('0x57')){var _0x998d26=_0x43eb1c[_0xccd0('0x27')]({'plain':!![]});return db[_0xccd0('0x58')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x495d8d[_0xccd0('0x59')]},'raw':!![]})[_0xccd0('0x25')](function(_0x42f0b7){if(_0x42f0b7&&_0x42f0b7['autoAssociation']===0x0){return db['UserProfileResource'][_0xccd0('0x4e')]({'name':_0x998d26[_0xccd0('0x2d')],'resourceId':_0x998d26['id'],'type':_0x42f0b7[_0xccd0('0x2d')],'sectionId':_0x42f0b7['id']},{})[_0xccd0('0x25')](function(){return _0x43eb1c;});}else{return _0x43eb1c;}})['catch'](function(_0x5405fc){logger[_0xccd0('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5405fc);throw _0x5405fc;});}return _0x43eb1c;})[_0xccd0('0x25')](respondWithResult(_0x2ffaf,0xc9))[_0xccd0('0x48')](handleError(_0x2ffaf,null));}; \ No newline at end of file +var _0xafa3=['request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','stack','name','index','map','fieldName','key','keys','filters','query','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','CannedAnswer','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','options','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xafa3,0x104));var _0x3afa=function(_0x3546a5,_0xddb437){_0x3546a5=_0x3546a5-0x0;var _0x13d218=_0xafa3[_0x3546a5];return _0x13d218;};'use strict';var emlformat=require(_0x3afa('0x0'));var rimraf=require(_0x3afa('0x1'));var zipdir=require(_0x3afa('0x2'));var jsonpatch=require(_0x3afa('0x3'));var rp=require(_0x3afa('0x4'));var moment=require('moment');var BPromise=require(_0x3afa('0x5'));var Mustache=require(_0x3afa('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3afa('0x7'));var csv=require(_0x3afa('0x8'));var ejs=require(_0x3afa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3afa('0xa'));var squel=require(_0x3afa('0xb'));var crypto=require('crypto');var jsforce=require(_0x3afa('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3afa('0xd'));var Papa=require(_0x3afa('0xe'));var Redis=require('ioredis');var authService=require(_0x3afa('0xf'));var qs=require(_0x3afa('0x10'));var as=require(_0x3afa('0x11'));var hardwareService=require(_0x3afa('0x12'));var logger=require(_0x3afa('0x13'))(_0x3afa('0x14'));var utils=require(_0x3afa('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3afa('0x16'))['db'];function respondWithStatusCode(_0xeaf9c3,_0x24e26e){_0x24e26e=_0x24e26e||0xcc;return function(_0x15d554){if(_0x15d554){return _0xeaf9c3[_0x3afa('0x17')](_0x24e26e);}return _0xeaf9c3[_0x3afa('0x18')](_0x24e26e)[_0x3afa('0x19')]();};}function respondWithResult(_0x4c93a5,_0x48d766){_0x48d766=_0x48d766||0xc8;return function(_0x58436b){if(_0x58436b){return _0x4c93a5['status'](_0x48d766)[_0x3afa('0x1a')](_0x58436b);}};}function respondWithFilteredResult(_0x595ff1,_0x4bcf00){return function(_0x3d3f43){if(_0x3d3f43){var _0x28736e=typeof _0x4bcf00[_0x3afa('0x1b')]===_0x3afa('0x1c')&&typeof _0x4bcf00['limit']==='undefined';var _0x5c4849=_0x3d3f43[_0x3afa('0x1d')];var _0x42762d=_0x28736e?0x0:_0x4bcf00[_0x3afa('0x1b')];var _0x416058=_0x28736e?_0x3d3f43[_0x3afa('0x1d')]:_0x4bcf00[_0x3afa('0x1b')]+_0x4bcf00['limit'];var _0x54859c;if(_0x416058>=_0x5c4849){_0x416058=_0x5c4849;_0x54859c=0xc8;}else{_0x54859c=0xce;}_0x595ff1[_0x3afa('0x18')](_0x54859c);return _0x595ff1[_0x3afa('0x1e')](_0x3afa('0x1f'),_0x42762d+'-'+_0x416058+'/'+_0x5c4849)[_0x3afa('0x1a')](_0x3d3f43);}return null;};}function patchUpdates(_0x5774ca){return function(_0x305c29){try{jsonpatch[_0x3afa('0x20')](_0x305c29,_0x5774ca,!![]);}catch(_0x521913){return BPromise['reject'](_0x521913);}return _0x305c29[_0x3afa('0x21')]();};}function saveUpdates(_0x4b162a,_0x38c246){return function(_0x479ee4){if(_0x479ee4){return _0x479ee4[_0x3afa('0x22')](_0x4b162a)[_0x3afa('0x23')](function(_0x4c821d){return _0x4c821d;});}return null;};}function removeEntity(_0x2fcba1,_0x565a28){return function(_0x5e00d5){if(_0x5e00d5){return _0x5e00d5[_0x3afa('0x24')]()[_0x3afa('0x23')](function(){var _0x522fc8=_0x5e00d5[_0x3afa('0x25')]({'plain':!![]});var _0x3347a2='CannedAnswers';return db['UserProfileResource'][_0x3afa('0x24')]({'where':{'type':_0x3347a2,'resourceId':_0x522fc8['id']}})['then'](function(){return _0x5e00d5;});})[_0x3afa('0x23')](function(){_0x2fcba1[_0x3afa('0x18')](0xcc)[_0x3afa('0x19')]();});}};}function handleEntityNotFound(_0x48bdae,_0x11dc26){return function(_0x1b8b70){if(!_0x1b8b70){_0x48bdae[_0x3afa('0x17')](0x194);}return _0x1b8b70;};}function handleError(_0xecc5d8,_0x429341){_0x429341=_0x429341||0x1f4;return function(_0x521813){logger['error'](_0x521813[_0x3afa('0x26')]);if(_0x521813['name']){delete _0x521813[_0x3afa('0x27')];}_0xecc5d8['status'](_0x429341)['send'](_0x521813);};}exports[_0x3afa('0x28')]=function(_0x311120,_0x2563e4){var _0x4a5002={},_0x23cdb5={},_0x356011={'count':0x0,'rows':[]};var _0x6771e3=_[_0x3afa('0x29')](db['CannedAnswer']['rawAttributes'],function(_0x12ce13){return{'name':_0x12ce13[_0x3afa('0x2a')],'type':_0x12ce13['type'][_0x3afa('0x2b')]};});_0x23cdb5['model']=_[_0x3afa('0x29')](_0x6771e3,_0x3afa('0x27'));_0x23cdb5['query']=_[_0x3afa('0x2c')](_0x311120['query']);_0x23cdb5[_0x3afa('0x2d')]=_['intersection'](_0x23cdb5['model'],_0x23cdb5[_0x3afa('0x2e')]);_0x4a5002['attributes']=_[_0x3afa('0x2f')](_0x23cdb5[_0x3afa('0x30')],qs['fields'](_0x311120[_0x3afa('0x2e')]['fields']));_0x4a5002['attributes']=_0x4a5002[_0x3afa('0x31')][_0x3afa('0x32')]?_0x4a5002[_0x3afa('0x31')]:_0x23cdb5[_0x3afa('0x30')];if(!_0x311120[_0x3afa('0x2e')][_0x3afa('0x33')](_0x3afa('0x34'))){_0x4a5002[_0x3afa('0x35')]=qs[_0x3afa('0x35')](_0x311120[_0x3afa('0x2e')][_0x3afa('0x35')]);_0x4a5002[_0x3afa('0x1b')]=qs[_0x3afa('0x1b')](_0x311120['query']['offset']);}_0x4a5002[_0x3afa('0x36')]=qs[_0x3afa('0x37')](_0x311120['query'][_0x3afa('0x37')]);_0x4a5002[_0x3afa('0x38')]=qs[_0x3afa('0x2d')](_[_0x3afa('0x39')](_0x311120['query'],_0x23cdb5['filters']),_0x6771e3);if(_0x311120[_0x3afa('0x2e')][_0x3afa('0x3a')]){_0x4a5002[_0x3afa('0x38')]=_['merge'](_0x4a5002['where'],{'$or':[{'key':{'$like':'%'+_0x311120[_0x3afa('0x2e')]['filter']+'%'}},{'value':{'$like':'%'+_0x311120[_0x3afa('0x2e')][_0x3afa('0x3a')]+'%'}}]});}_0x4a5002=_[_0x3afa('0x3b')]({},_0x4a5002,_0x311120['options']);var _0x2b60dc={'where':_0x4a5002[_0x3afa('0x38')]};return db[_0x3afa('0x3c')][_0x3afa('0x1d')](_0x2b60dc)[_0x3afa('0x23')](function(_0x768921){_0x356011[_0x3afa('0x1d')]=_0x768921;if(_0x311120[_0x3afa('0x2e')]['includeAll']){_0x4a5002[_0x3afa('0x3d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3afa('0x3e')](_0x4a5002);})['then'](function(_0xe7e05e){_0x356011[_0x3afa('0x3f')]=_0xe7e05e;return _0x356011;})[_0x3afa('0x23')](respondWithFilteredResult(_0x2563e4,_0x4a5002))[_0x3afa('0x40')](handleError(_0x2563e4,null));};exports[_0x3afa('0x41')]=function(_0x58b8b7,_0x31d483){var _0x3fa194={'raw':!![],'where':{'id':_0x58b8b7['params']['id']}},_0x211630={};_0x211630[_0x3afa('0x30')]=_['keys'](db[_0x3afa('0x3c')][_0x3afa('0x42')]);_0x211630['query']=_['keys'](_0x58b8b7[_0x3afa('0x2e')]);_0x211630[_0x3afa('0x2d')]=_[_0x3afa('0x2f')](_0x211630[_0x3afa('0x30')],_0x211630[_0x3afa('0x2e')]);_0x3fa194[_0x3afa('0x31')]=_['intersection'](_0x211630[_0x3afa('0x30')],qs[_0x3afa('0x43')](_0x58b8b7['query'][_0x3afa('0x43')]));_0x3fa194[_0x3afa('0x31')]=_0x3fa194[_0x3afa('0x31')][_0x3afa('0x32')]?_0x3fa194[_0x3afa('0x31')]:_0x211630[_0x3afa('0x30')];if(_0x58b8b7[_0x3afa('0x2e')][_0x3afa('0x44')]){_0x3fa194[_0x3afa('0x3d')]=[{'all':!![]}];}_0x3fa194=_['merge']({},_0x3fa194,_0x58b8b7[_0x3afa('0x45')]);return db[_0x3afa('0x3c')][_0x3afa('0x46')](_0x3fa194)[_0x3afa('0x23')](handleEntityNotFound(_0x31d483,null))[_0x3afa('0x23')](respondWithResult(_0x31d483,null))[_0x3afa('0x40')](handleError(_0x31d483,null));};exports[_0x3afa('0x22')]=function(_0x4516b0,_0x3f6430){if(_0x4516b0['body']['id']){delete _0x4516b0[_0x3afa('0x47')]['id'];}return db[_0x3afa('0x3c')][_0x3afa('0x46')]({'where':{'id':_0x4516b0[_0x3afa('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f6430,null))[_0x3afa('0x23')](saveUpdates(_0x4516b0[_0x3afa('0x47')],null))[_0x3afa('0x23')](respondWithResult(_0x3f6430,null))[_0x3afa('0x40')](handleError(_0x3f6430,null));};exports[_0x3afa('0x24')]=function(_0x4f7eb5,_0x265b4b){return db[_0x3afa('0x3c')][_0x3afa('0x46')]({'where':{'id':_0x4f7eb5['params']['id']}})[_0x3afa('0x23')](handleEntityNotFound(_0x265b4b,null))[_0x3afa('0x23')](removeEntity(_0x265b4b,null))[_0x3afa('0x40')](handleError(_0x265b4b,null));};exports[_0x3afa('0x49')]=function(_0x3ba261,_0x145f33){var _0x1f27cb={'key':_0x3ba261[_0x3afa('0x47')]['key']};if(_0x3ba261[_0x3afa('0x47')]['MailAccountId']){_0x1f27cb[_0x3afa('0x4a')]=_0x3ba261[_0x3afa('0x47')][_0x3afa('0x4a')];}else if(_0x3ba261[_0x3afa('0x47')]['SmsAccountId']){_0x1f27cb[_0x3afa('0x4b')]=_0x3ba261['body']['SmsAccountId'];}else if(_0x3ba261[_0x3afa('0x47')][_0x3afa('0x4c')]){_0x1f27cb[_0x3afa('0x4c')]=_0x3ba261[_0x3afa('0x47')][_0x3afa('0x4c')];}else if(_0x3ba261[_0x3afa('0x47')]['ChatWebsiteId']){_0x1f27cb[_0x3afa('0x4d')]=_0x3ba261[_0x3afa('0x47')][_0x3afa('0x4d')];}return db[_0x3afa('0x3c')][_0x3afa('0x46')]({'where':_0x1f27cb})[_0x3afa('0x23')](function(_0x91b585){if(_0x91b585){throw new db[(_0x3afa('0x4e'))][(_0x3afa('0x4f'))](_0x3afa('0x50'));}return db[_0x3afa('0x3c')][_0x3afa('0x49')](_0x3ba261['body']);})[_0x3afa('0x23')](function(_0x52e300){var _0x473231=_0x3ba261[_0x3afa('0x51')][_0x3afa('0x25')]({'plain':!![]});if(!_0x473231)throw new Error(_0x3afa('0x52'));if(_0x473231[_0x3afa('0x53')]==='user'){var _0x160db9=_0x52e300[_0x3afa('0x25')]({'plain':!![]});return db[_0x3afa('0x54')][_0x3afa('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x473231[_0x3afa('0x55')]},'raw':!![]})['then'](function(_0x5668be){if(_0x5668be&&_0x5668be[_0x3afa('0x56')]===0x0){return db['UserProfileResource'][_0x3afa('0x49')]({'name':_0x160db9[_0x3afa('0x27')],'resourceId':_0x160db9['id'],'type':_0x5668be[_0x3afa('0x27')],'sectionId':_0x5668be['id']},{})[_0x3afa('0x23')](function(){return _0x52e300;});}else{return _0x52e300;}})['catch'](function(_0x39f974){logger[_0x3afa('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39f974);throw _0x39f974;});}return _0x52e300;})[_0x3afa('0x23')](respondWithResult(_0x145f33,0xc9))[_0x3afa('0x40')](handleError(_0x145f33,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c970a1f..3c2a541 100644 --- a/server/api/cannedAnswer/cannedAnswer.model.js +++ b/server/api/cannedAnswer/cannedAnswer.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5423=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','CannedAnswer','utf8mb4_unicode_ci','lodash'];(function(_0x4f24d6,_0x3573bb){var _0x9a09a1=function(_0x3b48ff){while(--_0x3b48ff){_0x4f24d6['push'](_0x4f24d6['shift']());}};_0x9a09a1(++_0x3573bb);}(_0x5423,0xe3));var _0x3542=function(_0x4b7917,_0x55d679){_0x4b7917=_0x4b7917-0x0;var _0x28fc5b=_0x5423[_0x4b7917];return _0x28fc5b;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3542('0xb')});}; \ No newline at end of file +var _0x7006=['request-promise','rimraf','../../config/environment','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x519a6f,_0x52cb04){var _0x221793=function(_0x2da616){while(--_0x2da616){_0x519a6f['push'](_0x519a6f['shift']());}};_0x221793(++_0x52cb04);}(_0x7006,0xe8));var _0x6700=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x7006[_0x8af54b];return _0x27d8f0;};'use strict';var _=require(_0x6700('0x0'));var util=require(_0x6700('0x1'));var logger=require(_0x6700('0x2'))(_0x6700('0x3'));var moment=require(_0x6700('0x4'));var BPromise=require(_0x6700('0x5'));var rp=require(_0x6700('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6700('0x7'));var config=require(_0x6700('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x6700('0x9')]=function(_0x1032f8,_0xead547){return _0x1032f8[_0x6700('0xa')]('CannedAnswer',attributes,{'tableName':_0x6700('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6700('0xc'),'collate':_0x6700('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 09185f1..0f91831 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x55a1c6,_0xd4e324){var _0x569af0=function(_0x260fa8){while(--_0x260fa8){_0x55a1c6['push'](_0x55a1c6['shift']());}};_0x569af0(++_0xd4e324);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x219dcb,_0x8bedd7){var _0x30d940=function(_0x1bf745){while(--_0x1bf745){_0x219dcb['push'](_0x219dcb['shift']());}};_0x30d940(++_0x8bedd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index fc8eb78..4c027f8 100644 --- a/server/api/cannedAnswer/index.js +++ b/server/api/cannedAnswer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff84=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','post','put','update','delete','multer'];(function(_0x36ee63,_0x54f46d){var _0x27e9bc=function(_0x5bf89b){while(--_0x5bf89b){_0x36ee63['push'](_0x36ee63['shift']());}};_0x27e9bc(++_0x54f46d);}(_0xff84,0x167));var _0x4ff8=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xff84[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0x4ff8('0x0'));var util=require(_0x4ff8('0x1'));var path=require(_0x4ff8('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ff8('0x3'));var router=express[_0x4ff8('0x4')]();var fs_extra=require(_0x4ff8('0x5'));var auth=require(_0x4ff8('0x6'));var interaction=require(_0x4ff8('0x7'));var config=require(_0x4ff8('0x8'));var controller=require(_0x4ff8('0x9'));router[_0x4ff8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ff8('0xa')](_0x4ff8('0xb'),auth[_0x4ff8('0xc')](),controller[_0x4ff8('0xd')]);router[_0x4ff8('0xe')]('/',auth[_0x4ff8('0xc')](),controller['create']);router[_0x4ff8('0xf')](_0x4ff8('0xb'),auth['isAuthenticated'](),controller[_0x4ff8('0x10')]);router[_0x4ff8('0x11')](_0x4ff8('0xb'),auth[_0x4ff8('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4d80=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x4d80,0x171));var _0x04d8=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4d80[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x04d8('0x0'));var util=require(_0x04d8('0x1'));var path=require(_0x04d8('0x2'));var timeout=require(_0x04d8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x04d8('0x4'));var auth=require(_0x04d8('0x5'));var interaction=require(_0x04d8('0x6'));var config=require(_0x04d8('0x7'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0x04d8('0x8')](),controller[_0x04d8('0x9')]);router[_0x04d8('0xa')]('/:id',auth[_0x04d8('0x8')](),controller['show']);router[_0x04d8('0xb')]('/',auth[_0x04d8('0x8')](),controller[_0x04d8('0xc')]);router[_0x04d8('0xd')](_0x04d8('0xe'),auth[_0x04d8('0x8')](),controller[_0x04d8('0xf')]);router[_0x04d8('0x10')](_0x04d8('0xe'),auth[_0x04d8('0x8')](),controller[_0x04d8('0x11')]);module[_0x04d8('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 6ae4c05..7df9f4c 100644 --- a/server/api/cdr/cdr.attributes.js +++ b/server/api/cdr/cdr.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6475=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x38037d,_0x414e99){var _0xc69f8=function(_0x50d820){while(--_0x50d820){_0x38037d['push'](_0x38037d['shift']());}};_0xc69f8(++_0x414e99);}(_0x6475,0x133));var _0x5647=function(_0x27e811,_0x1fad22){_0x27e811=_0x27e811-0x0;var _0x1bfe61=_0x6475[_0x27e811];return _0x1bfe61;};'use strict';var Sequelize=require(_0x5647('0x0'));module[_0x5647('0x1')]={'calldate':{'type':Sequelize[_0x5647('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x5647('0x3')]},'src':{'type':Sequelize[_0x5647('0x3')]},'dst':{'type':Sequelize[_0x5647('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5647('0x3')]},'dstchannel':{'type':Sequelize[_0x5647('0x3')]},'lastapp':{'type':Sequelize[_0x5647('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x5647('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5647('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5647('0x3')]},'uniqueid':{'type':Sequelize[_0x5647('0x3')]},'linkedid':{'type':Sequelize[_0x5647('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5647('0x3')]},'tag':{'type':Sequelize[_0x5647('0x3')]}}; \ No newline at end of file +var _0x0b25=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x0b25,0x155));var _0x50b2=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x0b25[_0x3a04ab];return _0x4bff6d;};'use strict';var Sequelize=require(_0x50b2('0x0'));module[_0x50b2('0x1')]={'calldate':{'type':Sequelize[_0x50b2('0x2')],'allowNull':![],'defaultValue':_0x50b2('0x3')},'clid':{'type':Sequelize[_0x50b2('0x4')]},'src':{'type':Sequelize[_0x50b2('0x4')]},'dst':{'type':Sequelize[_0x50b2('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x50b2('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x50b2('0x4')]},'duration':{'type':Sequelize[_0x50b2('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x50b2('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x50b2('0x4')]},'amaflags':{'type':Sequelize[_0x50b2('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x50b2('0x4')]},'uniqueid':{'type':Sequelize[_0x50b2('0x4')]},'linkedid':{'type':Sequelize[_0x50b2('0x4')]},'sequence':{'type':Sequelize[_0x50b2('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x50b2('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 4985908..6041938 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb81=['save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x4b6622,_0x141e17){var _0x357399=function(_0xf43376){while(--_0xf43376){_0x4b6622['push'](_0x4b6622['shift']());}};_0x357399(++_0x141e17);}(_0xcb81,0x154));var _0x1cb8=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xcb81[_0x4c2dfc];return _0xfd728d;};'use strict';var emlformat=require(_0x1cb8('0x0'));var rimraf=require(_0x1cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1cb8('0x3'));var util=require(_0x1cb8('0x4'));var path=require(_0x1cb8('0x5'));var sox=require(_0x1cb8('0x6'));var csv=require(_0x1cb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb8('0x8'));var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cb8('0x16'))['db'];function respondWithStatusCode(_0x1ffe94,_0x1938ee){_0x1938ee=_0x1938ee||0xcc;return function(_0x299eea){if(_0x299eea){return _0x1ffe94[_0x1cb8('0x17')](_0x1938ee);}return _0x1ffe94['status'](_0x1938ee)[_0x1cb8('0x18')]();};}function respondWithResult(_0x2c600,_0xcb6ad1){_0xcb6ad1=_0xcb6ad1||0xc8;return function(_0x14d84d){if(_0x14d84d){return _0x2c600[_0x1cb8('0x19')](_0xcb6ad1)[_0x1cb8('0x1a')](_0x14d84d);}};}function respondWithFilteredResult(_0x339ad0,_0x243930){return function(_0x5af4a3){if(_0x5af4a3){var _0x17a95d=typeof _0x243930['offset']===_0x1cb8('0x1b')&&typeof _0x243930[_0x1cb8('0x1c')]===_0x1cb8('0x1b');var _0x46abd0=_0x5af4a3[_0x1cb8('0x1d')];var _0x308088=_0x17a95d?0x0:_0x243930[_0x1cb8('0x1e')];var _0x9f0adb=_0x17a95d?_0x5af4a3[_0x1cb8('0x1d')]:_0x243930[_0x1cb8('0x1e')]+_0x243930[_0x1cb8('0x1c')];var _0x3cda27;if(_0x9f0adb>=_0x46abd0){_0x9f0adb=_0x46abd0;_0x3cda27=0xc8;}else{_0x3cda27=0xce;}_0x339ad0['status'](_0x3cda27);return _0x339ad0[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x308088+'-'+_0x9f0adb+'/'+_0x46abd0)[_0x1cb8('0x1a')](_0x5af4a3);}return null;};}function patchUpdates(_0x3d1682){return function(_0x4abf3a){try{jsonpatch[_0x1cb8('0x21')](_0x4abf3a,_0x3d1682,!![]);}catch(_0x4f9220){return BPromise[_0x1cb8('0x22')](_0x4f9220);}return _0x4abf3a[_0x1cb8('0x23')]();};}function saveUpdates(_0x40b914,_0x38ff3a){return function(_0x559916){if(_0x559916){return _0x559916['update'](_0x40b914)[_0x1cb8('0x24')](function(_0x4040be){return _0x4040be;});}return null;};}function removeEntity(_0x22dafe,_0x44a00d){return function(_0x2473b8){if(_0x2473b8){return _0x2473b8[_0x1cb8('0x25')]()[_0x1cb8('0x24')](function(){_0x22dafe['status'](0xcc)[_0x1cb8('0x18')]();});}};}function handleEntityNotFound(_0x4554d5,_0x35c890){return function(_0xeeb21d){if(!_0xeeb21d){_0x4554d5[_0x1cb8('0x17')](0x194);}return _0xeeb21d;};}function handleError(_0x41ab56,_0x4ca3be){_0x4ca3be=_0x4ca3be||0x1f4;return function(_0x1ec995){logger[_0x1cb8('0x26')](_0x1ec995[_0x1cb8('0x27')]);if(_0x1ec995[_0x1cb8('0x28')]){delete _0x1ec995[_0x1cb8('0x28')];}_0x41ab56['status'](_0x4ca3be)[_0x1cb8('0x29')](_0x1ec995);};}exports[_0x1cb8('0x2a')]=function(_0x3a8b53,_0x21c17a){var _0x4fda96={},_0x2a79e0={},_0x2ba8c8={'count':0x0,'rows':[]};var _0x3a6a67=_['map'](db[_0x1cb8('0x2b')][_0x1cb8('0x2c')],function(_0x17abe1){return{'name':_0x17abe1['fieldName'],'type':_0x17abe1[_0x1cb8('0x2d')][_0x1cb8('0x2e')]};});_0x2a79e0[_0x1cb8('0x2f')]=_[_0x1cb8('0x30')](_0x3a6a67,_0x1cb8('0x28'));_0x2a79e0['query']=_[_0x1cb8('0x31')](_0x3a8b53[_0x1cb8('0x32')]);_0x2a79e0[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],_0x2a79e0[_0x1cb8('0x32')]);_0x4fda96[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],qs['fields'](_0x3a8b53['query'][_0x1cb8('0x36')]));_0x4fda96[_0x1cb8('0x35')]=_0x4fda96[_0x1cb8('0x35')]['length']?_0x4fda96['attributes']:_0x2a79e0[_0x1cb8('0x2f')];if(!_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x37')](_0x1cb8('0x38'))){_0x4fda96[_0x1cb8('0x1c')]=qs[_0x1cb8('0x1c')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1c')]);_0x4fda96['offset']=qs[_0x1cb8('0x1e')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1e')]);}_0x4fda96[_0x1cb8('0x39')]=qs[_0x1cb8('0x3a')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x3a')]);_0x4fda96[_0x1cb8('0x3b')]=qs[_0x1cb8('0x33')](_['pick'](_0x3a8b53[_0x1cb8('0x32')],_0x2a79e0[_0x1cb8('0x33')]),_0x3a6a67);if(_0x3a8b53['query'][_0x1cb8('0x3c')]){_0x4fda96[_0x1cb8('0x3b')]=_[_0x1cb8('0x3d')](_0x4fda96[_0x1cb8('0x3b')],{'$or':_[_0x1cb8('0x30')](_0x3a6a67,function(_0x5dc4c0){if(_0x5dc4c0[_0x1cb8('0x2d')]!==_0x1cb8('0x3e')){var _0x2989c6={};_0x2989c6[_0x5dc4c0['name']]={'$like':'%'+_0x3a8b53['query']['filter']+'%'};return _0x2989c6;}})});}_0x4fda96=_[_0x1cb8('0x3d')]({},_0x4fda96,_0x3a8b53[_0x1cb8('0x3f')]);var _0x328f7e={'where':_0x4fda96[_0x1cb8('0x3b')]};return db['Cdr']['count'](_0x328f7e)[_0x1cb8('0x24')](function(_0x25f0a3){_0x2ba8c8[_0x1cb8('0x1d')]=_0x25f0a3;if(_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x4fda96[_0x1cb8('0x41')]=[{'all':!![]}];}return db[_0x1cb8('0x2b')][_0x1cb8('0x42')](_0x4fda96);})['then'](function(_0x2044d1){_0x2ba8c8[_0x1cb8('0x43')]=_0x2044d1;return _0x2ba8c8;})[_0x1cb8('0x24')](respondWithFilteredResult(_0x21c17a,_0x4fda96))[_0x1cb8('0x44')](handleError(_0x21c17a,null));};exports['show']=function(_0x156298,_0x47c18a){var _0x2060a6={'raw':!![],'where':{'id':_0x156298['params']['id']}},_0x37230e={};_0x37230e[_0x1cb8('0x2f')]=_[_0x1cb8('0x31')](db[_0x1cb8('0x2b')]['rawAttributes']);_0x37230e['query']=_[_0x1cb8('0x31')](_0x156298['query']);_0x37230e[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],_0x37230e[_0x1cb8('0x32')]);_0x2060a6[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],qs['fields'](_0x156298[_0x1cb8('0x32')][_0x1cb8('0x36')]));_0x2060a6[_0x1cb8('0x35')]=_0x2060a6[_0x1cb8('0x35')]['length']?_0x2060a6[_0x1cb8('0x35')]:_0x37230e[_0x1cb8('0x2f')];if(_0x156298[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x2060a6[_0x1cb8('0x41')]=[{'all':!![]}];}_0x2060a6=_['merge']({},_0x2060a6,_0x156298[_0x1cb8('0x3f')]);return db[_0x1cb8('0x2b')][_0x1cb8('0x45')](_0x2060a6)[_0x1cb8('0x24')](handleEntityNotFound(_0x47c18a,null))[_0x1cb8('0x24')](respondWithResult(_0x47c18a,null))['catch'](handleError(_0x47c18a,null));};exports[_0x1cb8('0x46')]=function(_0x3a4ec4,_0x5598b1){return db[_0x1cb8('0x2b')][_0x1cb8('0x46')](_0x3a4ec4[_0x1cb8('0x47')],{})[_0x1cb8('0x24')](respondWithResult(_0x5598b1,0xc9))[_0x1cb8('0x44')](handleError(_0x5598b1,null));};exports[_0x1cb8('0x48')]=function(_0x3b063c,_0x219541){if(_0x3b063c[_0x1cb8('0x47')]['id']){delete _0x3b063c[_0x1cb8('0x47')]['id'];}return db[_0x1cb8('0x2b')][_0x1cb8('0x45')]({'where':{'id':_0x3b063c[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x219541,null))['then'](saveUpdates(_0x3b063c[_0x1cb8('0x47')],null))[_0x1cb8('0x24')](respondWithResult(_0x219541,null))[_0x1cb8('0x44')](handleError(_0x219541,null));};exports[_0x1cb8('0x25')]=function(_0x21aba7,_0x15f0ba){return db[_0x1cb8('0x2b')]['find']({'where':{'id':_0x21aba7[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x15f0ba,null))[_0x1cb8('0x24')](removeEntity(_0x15f0ba,null))['catch'](handleError(_0x15f0ba,null));};exports['describe']=function(_0x1c12aa,_0x42cc81){return db[_0x1cb8('0x2b')][_0x1cb8('0x4a')]()[_0x1cb8('0x24')](respondWithResult(_0x42cc81,null))['catch'](handleError(_0x42cc81,null));}; \ No newline at end of file +var _0x8958=['describe','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','Cdr','includeAll','include','findAll','merge','find','catch','create','body','params'];(function(_0x43f506,_0xdaf2ec){var _0x1f0230=function(_0x51cdf9){while(--_0x51cdf9){_0x43f506['push'](_0x43f506['shift']());}};_0x1f0230(++_0xdaf2ec);}(_0x8958,0x93));var _0x8895=function(_0x5c80b7,_0x5c6250){_0x5c80b7=_0x5c80b7-0x0;var _0x4a20a7=_0x8958[_0x5c80b7];return _0x4a20a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['Cdr']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['map'](_0x16b65b,_0x8895('0x26'));_0x37ac3a['query']=_[_0x8895('0x2e')](_0x5c03ea['query']);_0x37ac3a[_0x8895('0x2f')]=_[_0x8895('0x30')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a[_0x8895('0x31')]);_0x6e449d[_0x8895('0x32')]=_['intersection'](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x33')](_0x5c03ea[_0x8895('0x31')][_0x8895('0x33')]));_0x6e449d[_0x8895('0x32')]=_0x6e449d['attributes'][_0x8895('0x34')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea['query'][_0x8895('0x35')](_0x8895('0x36'))){_0x6e449d[_0x8895('0x1d')]=qs[_0x8895('0x1d')](_0x5c03ea[_0x8895('0x31')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs['offset'](_0x5c03ea[_0x8895('0x31')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x37')]=qs[_0x8895('0x38')](_0x5c03ea[_0x8895('0x31')][_0x8895('0x38')]);_0x6e449d['where']=qs[_0x8895('0x2f')](_[_0x8895('0x39')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x2f')]),_0x16b65b);if(_0x5c03ea['query'][_0x8895('0x3a')]){_0x6e449d[_0x8895('0x3b')]=_['merge'](_0x6e449d[_0x8895('0x3b')],{'$or':_[_0x8895('0x29')](_0x16b65b,function(_0x5b7204){if(_0x5b7204['type']!==_0x8895('0x3c')){var _0xf0b378={};_0xf0b378[_0x5b7204[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea[_0x8895('0x31')][_0x8895('0x3a')]+'%'};return _0xf0b378;}})});}_0x6e449d=_['merge']({},_0x6e449d,_0x5c03ea[_0x8895('0x3d')]);var _0x25c854={'where':_0x6e449d[_0x8895('0x3b')]};return db[_0x8895('0x3e')][_0x8895('0x1e')](_0x25c854)[_0x8895('0x24')](function(_0x4a7e22){_0x3fc4cc[_0x8895('0x1e')]=_0x4a7e22;if(_0x5c03ea['query'][_0x8895('0x3f')]){_0x6e449d[_0x8895('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x8895('0x41')](_0x6e449d);})['then'](function(_0x1e6395){_0x3fc4cc['rows']=_0x1e6395;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x4881d0,_0x47cf10){var _0x447ed6={'raw':!![],'where':{'id':_0x4881d0['params']['id']}},_0x206f57={};_0x206f57['model']=_[_0x8895('0x2e')](db[_0x8895('0x3e')]['rawAttributes']);_0x206f57[_0x8895('0x31')]=_[_0x8895('0x2e')](_0x4881d0[_0x8895('0x31')]);_0x206f57[_0x8895('0x2f')]=_[_0x8895('0x30')](_0x206f57['model'],_0x206f57['query']);_0x447ed6['attributes']=_[_0x8895('0x30')](_0x206f57['model'],qs[_0x8895('0x33')](_0x4881d0[_0x8895('0x31')][_0x8895('0x33')]));_0x447ed6[_0x8895('0x32')]=_0x447ed6['attributes'][_0x8895('0x34')]?_0x447ed6[_0x8895('0x32')]:_0x206f57[_0x8895('0x2d')];if(_0x4881d0[_0x8895('0x31')][_0x8895('0x3f')]){_0x447ed6[_0x8895('0x40')]=[{'all':!![]}];}_0x447ed6=_[_0x8895('0x42')]({},_0x447ed6,_0x4881d0[_0x8895('0x3d')]);return db['Cdr'][_0x8895('0x43')](_0x447ed6)[_0x8895('0x24')](handleEntityNotFound(_0x47cf10,null))['then'](respondWithResult(_0x47cf10,null))[_0x8895('0x44')](handleError(_0x47cf10,null));};exports['create']=function(_0x5829ec,_0x13546d){return db[_0x8895('0x3e')][_0x8895('0x45')](_0x5829ec['body'],{})[_0x8895('0x24')](respondWithResult(_0x13546d,0xc9))['catch'](handleError(_0x13546d,null));};exports[_0x8895('0x23')]=function(_0x152197,_0xb3ecd6){if(_0x152197[_0x8895('0x46')]['id']){delete _0x152197[_0x8895('0x46')]['id'];}return db[_0x8895('0x3e')][_0x8895('0x43')]({'where':{'id':_0x152197['params']['id']}})['then'](handleEntityNotFound(_0xb3ecd6,null))[_0x8895('0x24')](saveUpdates(_0x152197[_0x8895('0x46')],null))['then'](respondWithResult(_0xb3ecd6,null))[_0x8895('0x44')](handleError(_0xb3ecd6,null));};exports['destroy']=function(_0x4e8af3,_0x2daafe){return db['Cdr'][_0x8895('0x43')]({'where':{'id':_0x4e8af3[_0x8895('0x47')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2daafe,null))[_0x8895('0x24')](removeEntity(_0x2daafe,null))[_0x8895('0x44')](handleError(_0x2daafe,null));};exports[_0x8895('0x48')]=function(_0x306481,_0x38d6ae){return db['Cdr'][_0x8895('0x48')]()[_0x8895('0x24')](respondWithResult(_0x38d6ae,null))[_0x8895('0x44')](handleError(_0x38d6ae,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 021e9f3..cc0775a 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1cf525,_0x2285fe){var _0x185d92=function(_0x37be96){while(--_0x37be96){_0x1cf525['push'](_0x1cf525['shift']());}};_0x185d92(++_0x2285fe);}(_0x7a54,0x106));var _0x47a5=function(_0x5bb09b,_0x203a69){_0x5bb09b=_0x5bb09b-0x0;var _0x12c0bf=_0x7a54[_0x5bb09b];return _0x12c0bf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x58f50c,_0x321e21){var _0x34017f=function(_0x57b116){while(--_0x57b116){_0x58f50c['push'](_0x58f50c['shift']());}};_0x34017f(++_0x321e21);}(_0x7a54,0x106));var _0x47a5=function(_0x1e0137,_0x44343b){_0x1e0137=_0x1e0137-0x0;var _0x4dbbe9=_0x7a54[_0x1e0137];return _0x4dbbe9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 298f264..6f2c7ff 100644 --- a/server/api/cdr/cdr.rpc.js +++ b/server/api/cdr/cdr.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5bf=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment'];(function(_0x564c35,_0x2399e6){var _0x3040b5=function(_0x4d1bb0){while(--_0x4d1bb0){_0x564c35['push'](_0x564c35['shift']());}};_0x3040b5(++_0x2399e6);}(_0xc5bf,0x1e1));var _0xfc5b=function(_0x10708c,_0x1a12d1){_0x10708c=_0x10708c-0x0;var _0x2254c4=_0xc5bf[_0x10708c];return _0x2254c4;};'use strict';var _=require('lodash');var util=require(_0xfc5b('0x0'));var moment=require(_0xfc5b('0x1'));var BPromise=require(_0xfc5b('0x2'));var rs=require(_0xfc5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc5b('0x4'))['db'];var utils=require(_0xfc5b('0x5'));var logger=require(_0xfc5b('0x6'))(_0xfc5b('0x7'));var config=require(_0xfc5b('0x8'));var jayson=require(_0xfc5b('0x9'));var client=jayson['client'][_0xfc5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9f3e,_0x4add52,_0x1fb0e2){return new BPromise(function(_0x5259c6,_0x715a70){return client[_0xfc5b('0xb')](_0x2a9f3e,_0x1fb0e2)[_0xfc5b('0xc')](function(_0x1d25cb){logger[_0xfc5b('0xd')](_0xfc5b('0xe'),_0x4add52,_0xfc5b('0xf'));logger['debug'](_0xfc5b('0x10'),_0x4add52,_0xfc5b('0xf'),JSON['stringify'](_0x1d25cb));if(_0x1d25cb[_0xfc5b('0x11')]){if(_0x1d25cb['error']['code']===0x1f4){logger[_0xfc5b('0x11')]('Cdr,\x20%s,\x20%s',_0x4add52,_0x1d25cb[_0xfc5b('0x11')][_0xfc5b('0x12')]);return _0x715a70(_0x1d25cb[_0xfc5b('0x11')][_0xfc5b('0x12')]);}logger[_0xfc5b('0x11')](_0xfc5b('0xe'),_0x4add52,_0x1d25cb[_0xfc5b('0x11')][_0xfc5b('0x12')]);return _0x5259c6(_0x1d25cb[_0xfc5b('0x11')]['message']);}else{logger[_0xfc5b('0xd')](_0xfc5b('0xe'),_0x4add52,'request\x20sent');_0x5259c6(_0x1d25cb[_0xfc5b('0x13')]['message']);}})[_0xfc5b('0x14')](function(_0xabbf29){logger[_0xfc5b('0x11')](_0xfc5b('0xe'),_0x4add52,_0xabbf29);_0x715a70(_0xabbf29);});});} \ No newline at end of file +var _0xd1de=['Cdr,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x32ac58,_0x27d770){var _0x499c72=function(_0x1575e4){while(--_0x1575e4){_0x32ac58['push'](_0x32ac58['shift']());}};_0x499c72(++_0x27d770);}(_0xd1de,0x7a));var _0xed1d=function(_0x2a4249,_0xae8e83){_0x2a4249=_0x2a4249-0x0;var _0x4242b7=_0xd1de[_0x2a4249];return _0x4242b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed1d('0x0'));var BPromise=require('bluebird');var rs=require(_0xed1d('0x1'));var fs=require('fs');var Redis=require(_0xed1d('0x2'));var db=require(_0xed1d('0x3'))['db'];var utils=require(_0xed1d('0x4'));var logger=require(_0xed1d('0x5'))('rpc');var config=require(_0xed1d('0x6'));var jayson=require(_0xed1d('0x7'));var client=jayson[_0xed1d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dbe9,_0x161f54,_0x3579f4){return new BPromise(function(_0x1dda6a,_0x21aeb8){return client[_0xed1d('0x9')](_0x32dbe9,_0x3579f4)[_0xed1d('0xa')](function(_0x452630){logger['info'](_0xed1d('0xb'),_0x161f54,_0xed1d('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x161f54,_0xed1d('0xc'),JSON[_0xed1d('0xd')](_0x452630));if(_0x452630['error']){if(_0x452630[_0xed1d('0xe')]['code']===0x1f4){logger['error'](_0xed1d('0xb'),_0x161f54,_0x452630[_0xed1d('0xe')][_0xed1d('0xf')]);return _0x21aeb8(_0x452630['error'][_0xed1d('0xf')]);}logger[_0xed1d('0xe')]('Cdr,\x20%s,\x20%s',_0x161f54,_0x452630[_0xed1d('0xe')][_0xed1d('0xf')]);return _0x1dda6a(_0x452630[_0xed1d('0xe')][_0xed1d('0xf')]);}else{logger[_0xed1d('0x10')](_0xed1d('0xb'),_0x161f54,_0xed1d('0xc'));_0x1dda6a(_0x452630[_0xed1d('0x11')][_0xed1d('0xf')]);}})[_0xed1d('0x12')](function(_0x444b2a){logger['error'](_0xed1d('0xb'),_0x161f54,_0x444b2a);_0x21aeb8(_0x444b2a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index eedd9d4..0d7bd82 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x26fc3b,_0x2b1be3){var _0x380e31=function(_0x391a02){while(--_0x391a02){_0x26fc3b['push'](_0x26fc3b['shift']());}};_0x380e31(++_0x2b1be3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 1e2e59a..d2704c4 100644 --- a/server/api/chatApplication/chatApplication.attributes.js +++ b/server/api/chatApplication/chatApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc822=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x15f644,_0x1f0a82){var _0xd954a1=function(_0x4e0fd3){while(--_0x4e0fd3){_0x15f644['push'](_0x15f644['shift']());}};_0xd954a1(++_0x1f0a82);}(_0xc822,0xd7));var _0x2c82=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xc822[_0x5a26db];return _0x4619dd;};'use strict';var Sequelize=require(_0x2c82('0x0'));module[_0x2c82('0x1')]={'priority':{'type':Sequelize[_0x2c82('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2c82('0x3')],'allowNull':![],'defaultValue':_0x2c82('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2c82('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2c82('0x5')}}; \ No newline at end of file +var _0x99c1=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x99c1,0x16a));var _0x199c=function(_0x3383a9,_0x3dfafe){_0x3383a9=_0x3383a9-0x0;var _0x469d5b=_0x99c1[_0x3383a9];return _0x469d5b;};'use strict';var Sequelize=require(_0x199c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x199c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x199c('0x2')],'allowNull':![],'defaultValue':_0x199c('0x3')},'appdata':{'type':Sequelize[_0x199c('0x4')]()},'description':{'type':Sequelize[_0x199c('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x199c('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9aceb7f..99d68a6 100644 --- a/server/api/chatApplication/chatApplication.controller.js +++ b/server/api/chatApplication/chatApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b05=['ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','sendStatus','error','stack','name','send','show','params','model','rawAttributes','keys','intersection','attributes','fields','query','length','ChatApplication','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse'];(function(_0x40490a,_0x3b4813){var _0x5e4469=function(_0x366d3a){while(--_0x366d3a){_0x40490a['push'](_0x40490a['shift']());}};_0x5e4469(++_0x3b4813);}(_0x7b05,0x91));var _0x57b0=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0x7b05[_0x3a16d4];return _0x31ea9c;};'use strict';var emlformat=require(_0x57b0('0x0'));var rimraf=require(_0x57b0('0x1'));var zipdir=require(_0x57b0('0x2'));var jsonpatch=require(_0x57b0('0x3'));var rp=require('request-promise');var moment=require(_0x57b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57b0('0x5'));var util=require(_0x57b0('0x6'));var path=require(_0x57b0('0x7'));var sox=require(_0x57b0('0x8'));var csv=require(_0x57b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b0('0xa'));var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363096,_0x145eae){_0x145eae=_0x145eae||0xcc;return function(_0xee8335){if(_0xee8335){return _0x363096['sendStatus'](_0x145eae);}return _0x363096['status'](_0x145eae)[_0x57b0('0x15')]();};}function respondWithResult(_0x3f95e3,_0xc9044f){_0xc9044f=_0xc9044f||0xc8;return function(_0x3b48a3){if(_0x3b48a3){return _0x3f95e3['status'](_0xc9044f)[_0x57b0('0x16')](_0x3b48a3);}};}function respondWithFilteredResult(_0x5c46a5,_0x235d4a){return function(_0xa20423){if(_0xa20423){var _0x55fd9c=typeof _0x235d4a[_0x57b0('0x17')]===_0x57b0('0x18')&&typeof _0x235d4a[_0x57b0('0x19')]===_0x57b0('0x18');var _0x3eb198=_0xa20423['count'];var _0x37bd5d=_0x55fd9c?0x0:_0x235d4a['offset'];var _0x592b2d=_0x55fd9c?_0xa20423[_0x57b0('0x1a')]:_0x235d4a[_0x57b0('0x17')]+_0x235d4a[_0x57b0('0x19')];var _0x3e14f5;if(_0x592b2d>=_0x3eb198){_0x592b2d=_0x3eb198;_0x3e14f5=0xc8;}else{_0x3e14f5=0xce;}_0x5c46a5[_0x57b0('0x1b')](_0x3e14f5);return _0x5c46a5[_0x57b0('0x1c')]('Content-Range',_0x37bd5d+'-'+_0x592b2d+'/'+_0x3eb198)[_0x57b0('0x16')](_0xa20423);}return null;};}function patchUpdates(_0x1d81ff){return function(_0x35a457){try{jsonpatch['apply'](_0x35a457,_0x1d81ff,!![]);}catch(_0x12f2f6){return BPromise[_0x57b0('0x1d')](_0x12f2f6);}return _0x35a457[_0x57b0('0x1e')]();};}function saveUpdates(_0x149056,_0x2ffc0a){return function(_0x22b11e){if(_0x22b11e){return _0x22b11e[_0x57b0('0x1f')](_0x149056)[_0x57b0('0x20')](function(_0x3497e4){return _0x3497e4;});}return null;};}function removeEntity(_0x5c60b9,_0x55b870){return function(_0x40c279){if(_0x40c279){return _0x40c279['destroy']()[_0x57b0('0x20')](function(){_0x5c60b9[_0x57b0('0x1b')](0xcc)[_0x57b0('0x15')]();});}};}function handleEntityNotFound(_0x38e3a0,_0x3e75e8){return function(_0xbf54ac){if(!_0xbf54ac){_0x38e3a0[_0x57b0('0x21')](0x194);}return _0xbf54ac;};}function handleError(_0x1eb523,_0xacd07c){_0xacd07c=_0xacd07c||0x1f4;return function(_0x109678){logger[_0x57b0('0x22')](_0x109678[_0x57b0('0x23')]);if(_0x109678[_0x57b0('0x24')]){delete _0x109678['name'];}_0x1eb523[_0x57b0('0x1b')](_0xacd07c)[_0x57b0('0x25')](_0x109678);};}exports[_0x57b0('0x26')]=function(_0x228dfe,_0x5e046c){var _0x552f3e={'raw':!![],'where':{'id':_0x228dfe[_0x57b0('0x27')]['id']}},_0x325e39={};_0x325e39[_0x57b0('0x28')]=_['keys'](db['ChatApplication'][_0x57b0('0x29')]);_0x325e39['query']=_[_0x57b0('0x2a')](_0x228dfe['query']);_0x325e39['filters']=_[_0x57b0('0x2b')](_0x325e39[_0x57b0('0x28')],_0x325e39['query']);_0x552f3e[_0x57b0('0x2c')]=_[_0x57b0('0x2b')](_0x325e39['model'],qs[_0x57b0('0x2d')](_0x228dfe[_0x57b0('0x2e')][_0x57b0('0x2d')]));_0x552f3e['attributes']=_0x552f3e[_0x57b0('0x2c')][_0x57b0('0x2f')]?_0x552f3e[_0x57b0('0x2c')]:_0x325e39[_0x57b0('0x28')];if(_0x228dfe[_0x57b0('0x2e')]['includeAll']){_0x552f3e['include']=[{'all':!![]}];}_0x552f3e=_['merge']({},_0x552f3e,_0x228dfe['options']);return db[_0x57b0('0x30')][_0x57b0('0x31')](_0x552f3e)[_0x57b0('0x20')](handleEntityNotFound(_0x5e046c,null))[_0x57b0('0x20')](respondWithResult(_0x5e046c,null))[_0x57b0('0x32')](handleError(_0x5e046c,null));};exports['update']=function(_0x85fdfe,_0x879623){if(_0x85fdfe[_0x57b0('0x33')]['id']){delete _0x85fdfe[_0x57b0('0x33')]['id'];}return db['ChatApplication'][_0x57b0('0x31')]({'where':{'id':_0x85fdfe[_0x57b0('0x27')]['id']}})['then'](handleEntityNotFound(_0x879623,null))[_0x57b0('0x20')](saveUpdates(_0x85fdfe[_0x57b0('0x33')],null))['then'](respondWithResult(_0x879623,null))['catch'](handleError(_0x879623,null));};exports[_0x57b0('0x34')]=function(_0x1b1d95,_0x3acf43){return db[_0x57b0('0x30')][_0x57b0('0x31')]({'where':{'id':_0x1b1d95[_0x57b0('0x27')]['id']}})[_0x57b0('0x20')](handleEntityNotFound(_0x3acf43,null))[_0x57b0('0x20')](removeEntity(_0x3acf43,null))[_0x57b0('0x32')](handleError(_0x3acf43,null));}; \ No newline at end of file +var _0xc686=['../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','find','catch','body','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x2596c4,_0x388e98){var _0xb554c4=function(_0x40ae44){while(--_0x40ae44){_0x2596c4['push'](_0x2596c4['shift']());}};_0xb554c4(++_0x388e98);}(_0xc686,0x148));var _0x6c68=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xc686[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6c68('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c68('0x1'));var moment=require('moment');var BPromise=require(_0x6c68('0x2'));var Mustache=require(_0x6c68('0x3'));var util=require(_0x6c68('0x4'));var path=require(_0x6c68('0x5'));var sox=require(_0x6c68('0x6'));var csv=require(_0x6c68('0x7'));var ejs=require(_0x6c68('0x8'));var fs=require('fs');var fs_extra=require(_0x6c68('0x9'));var _=require(_0x6c68('0xa'));var squel=require(_0x6c68('0xb'));var crypto=require(_0x6c68('0xc'));var jsforce=require(_0x6c68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c68('0x7'));var querystring=require(_0x6c68('0xe'));var Papa=require('papaparse');var Redis=require(_0x6c68('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6c68('0x10'));var as=require(_0x6c68('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c68('0x12'))('api');var utils=require(_0x6c68('0x13'));var config=require(_0x6c68('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c68('0x15'))['db'];function respondWithStatusCode(_0x489c2f,_0x4f947a){_0x4f947a=_0x4f947a||0xcc;return function(_0x29e0a5){if(_0x29e0a5){return _0x489c2f['sendStatus'](_0x4f947a);}return _0x489c2f[_0x6c68('0x16')](_0x4f947a)[_0x6c68('0x17')]();};}function respondWithResult(_0x310431,_0x4c4f5d){_0x4c4f5d=_0x4c4f5d||0xc8;return function(_0x25a4dc){if(_0x25a4dc){return _0x310431[_0x6c68('0x16')](_0x4c4f5d)[_0x6c68('0x18')](_0x25a4dc);}};}function respondWithFilteredResult(_0x9393b,_0x2dc30b){return function(_0x494b6e){if(_0x494b6e){var _0x5a0a84=typeof _0x2dc30b['offset']===_0x6c68('0x19')&&typeof _0x2dc30b[_0x6c68('0x1a')]===_0x6c68('0x19');var _0x1422fa=_0x494b6e['count'];var _0x2cd5f6=_0x5a0a84?0x0:_0x2dc30b[_0x6c68('0x1b')];var _0x5045e3=_0x5a0a84?_0x494b6e['count']:_0x2dc30b[_0x6c68('0x1b')]+_0x2dc30b[_0x6c68('0x1a')];var _0x23d91d;if(_0x5045e3>=_0x1422fa){_0x5045e3=_0x1422fa;_0x23d91d=0xc8;}else{_0x23d91d=0xce;}_0x9393b['status'](_0x23d91d);return _0x9393b[_0x6c68('0x1c')](_0x6c68('0x1d'),_0x2cd5f6+'-'+_0x5045e3+'/'+_0x1422fa)[_0x6c68('0x18')](_0x494b6e);}return null;};}function patchUpdates(_0x29b74d){return function(_0x153edb){try{jsonpatch[_0x6c68('0x1e')](_0x153edb,_0x29b74d,!![]);}catch(_0x12dc3a){return BPromise[_0x6c68('0x1f')](_0x12dc3a);}return _0x153edb[_0x6c68('0x20')]();};}function saveUpdates(_0xb6635c,_0x5974e8){return function(_0x201d7d){if(_0x201d7d){return _0x201d7d[_0x6c68('0x21')](_0xb6635c)[_0x6c68('0x22')](function(_0x1d981c){return _0x1d981c;});}return null;};}function removeEntity(_0xb06428,_0x2a4aba){return function(_0x3e680a){if(_0x3e680a){return _0x3e680a[_0x6c68('0x23')]()[_0x6c68('0x22')](function(){_0xb06428[_0x6c68('0x16')](0xcc)[_0x6c68('0x17')]();});}};}function handleEntityNotFound(_0x2f4fd5,_0x1efc4e){return function(_0x3b105c){if(!_0x3b105c){_0x2f4fd5[_0x6c68('0x24')](0x194);}return _0x3b105c;};}function handleError(_0x223c7d,_0x69310b){_0x69310b=_0x69310b||0x1f4;return function(_0x5c9c19){logger[_0x6c68('0x25')](_0x5c9c19[_0x6c68('0x26')]);if(_0x5c9c19[_0x6c68('0x27')]){delete _0x5c9c19[_0x6c68('0x27')];}_0x223c7d[_0x6c68('0x16')](_0x69310b)[_0x6c68('0x28')](_0x5c9c19);};}exports[_0x6c68('0x29')]=function(_0x1d4566,_0x111723){var _0x4ec904={'raw':!![],'where':{'id':_0x1d4566[_0x6c68('0x2a')]['id']}},_0x1321d1={};_0x1321d1['model']=_[_0x6c68('0x2b')](db[_0x6c68('0x2c')][_0x6c68('0x2d')]);_0x1321d1['query']=_[_0x6c68('0x2b')](_0x1d4566[_0x6c68('0x2e')]);_0x1321d1[_0x6c68('0x2f')]=_['intersection'](_0x1321d1[_0x6c68('0x30')],_0x1321d1[_0x6c68('0x2e')]);_0x4ec904[_0x6c68('0x31')]=_[_0x6c68('0x32')](_0x1321d1[_0x6c68('0x30')],qs[_0x6c68('0x33')](_0x1d4566[_0x6c68('0x2e')][_0x6c68('0x33')]));_0x4ec904[_0x6c68('0x31')]=_0x4ec904[_0x6c68('0x31')][_0x6c68('0x34')]?_0x4ec904[_0x6c68('0x31')]:_0x1321d1[_0x6c68('0x30')];if(_0x1d4566[_0x6c68('0x2e')][_0x6c68('0x35')]){_0x4ec904[_0x6c68('0x36')]=[{'all':!![]}];}_0x4ec904=_['merge']({},_0x4ec904,_0x1d4566['options']);return db[_0x6c68('0x2c')][_0x6c68('0x37')](_0x4ec904)[_0x6c68('0x22')](handleEntityNotFound(_0x111723,null))[_0x6c68('0x22')](respondWithResult(_0x111723,null))[_0x6c68('0x38')](handleError(_0x111723,null));};exports['update']=function(_0x32bddd,_0x56d2c8){if(_0x32bddd[_0x6c68('0x39')]['id']){delete _0x32bddd[_0x6c68('0x39')]['id'];}return db[_0x6c68('0x2c')][_0x6c68('0x37')]({'where':{'id':_0x32bddd['params']['id']}})['then'](handleEntityNotFound(_0x56d2c8,null))[_0x6c68('0x22')](saveUpdates(_0x32bddd[_0x6c68('0x39')],null))['then'](respondWithResult(_0x56d2c8,null))['catch'](handleError(_0x56d2c8,null));};exports[_0x6c68('0x23')]=function(_0x4f782d,_0xa8ea89){return db[_0x6c68('0x2c')]['find']({'where':{'id':_0x4f782d[_0x6c68('0x2a')]['id']}})[_0x6c68('0x22')](handleEntityNotFound(_0xa8ea89,null))[_0x6c68('0x22')](removeEntity(_0xa8ea89,null))[_0x6c68('0x38')](handleError(_0xa8ea89,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 01a4147..82faf95 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadd2=['path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise'];(function(_0x41df41,_0x370874){var _0x3f4702=function(_0x5101cc){while(--_0x5101cc){_0x41df41['push'](_0x41df41['shift']());}};_0x3f4702(++_0x370874);}(_0xadd2,0xa5));var _0x2add=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xadd2[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2add('0x0'))('api');var moment=require(_0x2add('0x1'));var BPromise=require(_0x2add('0x2'));var rp=require(_0x2add('0x3'));var fs=require('fs');var path=require(_0x2add('0x4'));var rimraf=require(_0x2add('0x5'));var config=require(_0x2add('0x6'));var attributes=require(_0x2add('0x7'));module[_0x2add('0x8')]=function(_0x30d864,_0x53a89d){return _0x30d864['define'](_0x2add('0x9'),attributes,{'tableName':_0x2add('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2add('0xb'),'collate':_0x2add('0xc')});}; \ No newline at end of file +var _0x1fd2=['define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatApplication.attributes'];(function(_0x3aeee7,_0x168e86){var _0x49ee12=function(_0xb330b3){while(--_0xb330b3){_0x3aeee7['push'](_0x3aeee7['shift']());}};_0x49ee12(++_0x168e86);}(_0x1fd2,0x184));var _0x21fd=function(_0x191dbb,_0x4aab6b){_0x191dbb=_0x191dbb-0x0;var _0x2dd105=_0x1fd2[_0x191dbb];return _0x2dd105;};'use strict';var _=require('lodash');var util=require(_0x21fd('0x0'));var logger=require(_0x21fd('0x1'))('api');var moment=require(_0x21fd('0x2'));var BPromise=require(_0x21fd('0x3'));var rp=require(_0x21fd('0x4'));var fs=require('fs');var path=require(_0x21fd('0x5'));var rimraf=require('rimraf');var config=require(_0x21fd('0x6'));var attributes=require(_0x21fd('0x7'));module['exports']=function(_0x48c369,_0x421e1f){return _0x48c369[_0x21fd('0x8')](_0x21fd('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21fd('0xa'),'collate':_0x21fd('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f3a4f8d..7b8d8ec 100644 --- a/server/api/chatApplication/chatApplication.rpc.js +++ b/server/api/chatApplication/chatApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63c1=['rpc','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x63c1,0x1c1));var _0x163c=function(_0x10da7d,_0x437c3c){_0x10da7d=_0x10da7d-0x0;var _0x10b314=_0x63c1[_0x10da7d];return _0x10b314;};'use strict';var _=require(_0x163c('0x0'));var util=require(_0x163c('0x1'));var moment=require('moment');var BPromise=require(_0x163c('0x2'));var rs=require(_0x163c('0x3'));var fs=require('fs');var Redis=require(_0x163c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x163c('0x5'));var logger=require(_0x163c('0x6'))(_0x163c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x163c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x289ae7,_0xa0efb,_0x4f5113){return new BPromise(function(_0x4d737f,_0x568328){return client[_0x163c('0x9')](_0x289ae7,_0x4f5113)['then'](function(_0xbf13be){logger[_0x163c('0xa')](_0x163c('0xb'),_0xa0efb,_0x163c('0xc'));logger['debug'](_0x163c('0xd'),_0xa0efb,_0x163c('0xc'),JSON[_0x163c('0xe')](_0xbf13be));if(_0xbf13be['error']){if(_0xbf13be[_0x163c('0xf')][_0x163c('0x10')]===0x1f4){logger[_0x163c('0xf')]('ChatApplication,\x20%s,\x20%s',_0xa0efb,_0xbf13be['error'][_0x163c('0x11')]);return _0x568328(_0xbf13be[_0x163c('0xf')][_0x163c('0x11')]);}logger[_0x163c('0xf')](_0x163c('0xb'),_0xa0efb,_0xbf13be[_0x163c('0xf')][_0x163c('0x11')]);return _0x4d737f(_0xbf13be['error'][_0x163c('0x11')]);}else{logger[_0x163c('0xa')](_0x163c('0xb'),_0xa0efb,_0x163c('0xc'));_0x4d737f(_0xbf13be['result'][_0x163c('0x11')]);}})[_0x163c('0x12')](function(_0x2a3c77){logger['error'](_0x163c('0xb'),_0xa0efb,_0x2a3c77);_0x568328(_0x2a3c77);});});} \ No newline at end of file +var _0xc637=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x53258a,_0x4d5e50){var _0x426572=function(_0x501571){while(--_0x501571){_0x53258a['push'](_0x53258a['shift']());}};_0x426572(++_0x4d5e50);}(_0xc637,0x8b));var _0x7c63=function(_0xc6cadf,_0x300b3d){_0xc6cadf=_0xc6cadf-0x0;var _0x445fe1=_0xc637[_0xc6cadf];return _0x445fe1;};'use strict';var _=require('lodash');var util=require(_0x7c63('0x0'));var moment=require('moment');var BPromise=require(_0x7c63('0x1'));var rs=require(_0x7c63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c63('0x3'))['db'];var utils=require(_0x7c63('0x4'));var logger=require(_0x7c63('0x5'))(_0x7c63('0x6'));var config=require(_0x7c63('0x7'));var jayson=require(_0x7c63('0x8'));var client=jayson[_0x7c63('0x9')][_0x7c63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45d8a0,_0x2c5524,_0xbb97e3){return new BPromise(function(_0x59c510,_0x202f4f){return client[_0x7c63('0xb')](_0x45d8a0,_0xbb97e3)[_0x7c63('0xc')](function(_0x56335e){logger[_0x7c63('0xd')]('ChatApplication,\x20%s,\x20%s',_0x2c5524,_0x7c63('0xe'));logger[_0x7c63('0xf')](_0x7c63('0x10'),_0x2c5524,_0x7c63('0xe'),JSON[_0x7c63('0x11')](_0x56335e));if(_0x56335e[_0x7c63('0x12')]){if(_0x56335e['error'][_0x7c63('0x13')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x2c5524,_0x56335e[_0x7c63('0x12')][_0x7c63('0x14')]);return _0x202f4f(_0x56335e[_0x7c63('0x12')][_0x7c63('0x14')]);}logger[_0x7c63('0x12')](_0x7c63('0x15'),_0x2c5524,_0x56335e[_0x7c63('0x12')][_0x7c63('0x14')]);return _0x59c510(_0x56335e['error'][_0x7c63('0x14')]);}else{logger[_0x7c63('0xd')]('ChatApplication,\x20%s,\x20%s',_0x2c5524,_0x7c63('0xe'));_0x59c510(_0x56335e[_0x7c63('0x16')][_0x7c63('0x14')]);}})[_0x7c63('0x17')](function(_0xcf70fb){logger[_0x7c63('0x12')](_0x7c63('0x15'),_0x2c5524,_0xcf70fb);_0x202f4f(_0xcf70fb);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9b60555..6dc2371 100644 --- a/server/api/chatApplication/index.js +++ b/server/api/chatApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x522e=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','isAuthenticated','delete','destroy','exports'];(function(_0x1b794,_0x2ba0b1){var _0x5949cd=function(_0x257f39){while(--_0x257f39){_0x1b794['push'](_0x1b794['shift']());}};_0x5949cd(++_0x2ba0b1);}(_0x522e,0x120));var _0xe522=function(_0x5c6a8e,_0x51f16d){_0x5c6a8e=_0x5c6a8e-0x0;var _0x6d27de=_0x522e[_0x5c6a8e];return _0x6d27de;};'use strict';var multer=require(_0xe522('0x0'));var util=require(_0xe522('0x1'));var path=require(_0xe522('0x2'));var timeout=require('connect-timeout');var express=require(_0xe522('0x3'));var router=express['Router']();var fs_extra=require(_0xe522('0x4'));var auth=require(_0xe522('0x5'));var interaction=require(_0xe522('0x6'));var config=require(_0xe522('0x7'));var controller=require(_0xe522('0x8'));router[_0xe522('0x9')](_0xe522('0xa'),auth['isAuthenticated'](),controller[_0xe522('0xb')]);router['put'](_0xe522('0xa'),auth[_0xe522('0xc')](),controller['update']);router[_0xe522('0xd')](_0xe522('0xa'),auth['isAuthenticated'](),controller[_0xe522('0xe')]);module[_0xe522('0xf')]=router; \ No newline at end of file +var _0xfd68=['/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x1dd683,_0xc9b214){var _0xecc20d=function(_0x401877){while(--_0x401877){_0x1dd683['push'](_0x1dd683['shift']());}};_0xecc20d(++_0xc9b214);}(_0xfd68,0xa0));var _0x8fd6=function(_0x2a09ed,_0x4f8a4e){_0x2a09ed=_0x2a09ed-0x0;var _0x7d74b=_0xfd68[_0x2a09ed];return _0x7d74b;};'use strict';var multer=require(_0x8fd6('0x0'));var util=require(_0x8fd6('0x1'));var path=require('path');var timeout=require(_0x8fd6('0x2'));var express=require(_0x8fd6('0x3'));var router=express[_0x8fd6('0x4')]();var fs_extra=require(_0x8fd6('0x5'));var auth=require(_0x8fd6('0x6'));var interaction=require(_0x8fd6('0x7'));var config=require(_0x8fd6('0x8'));var controller=require(_0x8fd6('0x9'));router['get'](_0x8fd6('0xa'),auth[_0x8fd6('0xb')](),controller[_0x8fd6('0xc')]);router['put'](_0x8fd6('0xa'),auth[_0x8fd6('0xb')](),controller[_0x8fd6('0xd')]);router[_0x8fd6('0xe')](_0x8fd6('0xa'),auth[_0x8fd6('0xb')](),controller[_0x8fd6('0xf')]);module[_0x8fd6('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index fe65214..42346bd 100644 --- a/server/api/chatGroup/chatGroup.attributes.js +++ b/server/api/chatGroup/chatGroup.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc12c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2150b7,_0x1b7bbb){var _0x5bd131=function(_0x4be2de){while(--_0x4be2de){_0x2150b7['push'](_0x2150b7['shift']());}};_0x5bd131(++_0x1b7bbb);}(_0xc12c,0x1ae));var _0xcc12=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc12c[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xcc12('0x0'));module[_0xcc12('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcc12('0x2')]},'write':{'type':Sequelize[_0xcc12('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdf43=['sequelize','STRING','BOOLEAN'];(function(_0x3bdb0a,_0x147559){var _0x2766d1=function(_0x2a193b){while(--_0x2a193b){_0x3bdb0a['push'](_0x3bdb0a['shift']());}};_0x2766d1(++_0x147559);}(_0xdf43,0x6c));var _0x3df4=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xdf43[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0x3df4('0x0'));module['exports']={'name':{'type':Sequelize[_0x3df4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3df4('0x1')]},'write':{'type':Sequelize[_0x3df4('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 990a192..85c0ece 100644 --- a/server/api/chatGroup/chatGroup.controller.js +++ b/server/api/chatGroup/chatGroup.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6551=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','then','error','name','send','index','map','ChatGroup','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','destroy','describe','getUnread','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','pick','nolimit','removeMembers','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x37fb9e,_0x3ce746){var _0x38a526=function(_0x327a02){while(--_0x327a02){_0x37fb9e['push'](_0x37fb9e['shift']());}};_0x38a526(++_0x3ce746);}(_0x6551,0x1e1));var _0x1655=function(_0x12a961,_0x566902){_0x12a961=_0x12a961-0x0;var _0x596299=_0x6551[_0x12a961];return _0x596299;};'use strict';var emlformat=require(_0x1655('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1655('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1655('0x2'));var Mustache=require(_0x1655('0x3'));var util=require(_0x1655('0x4'));var path=require(_0x1655('0x5'));var sox=require(_0x1655('0x6'));var csv=require('to-csv');var ejs=require(_0x1655('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1655('0x8'));var squel=require(_0x1655('0x9'));var crypto=require(_0x1655('0xa'));var jsforce=require(_0x1655('0xb'));var deskjs=require(_0x1655('0xc'));var toCsv=require(_0x1655('0xd'));var querystring=require(_0x1655('0xe'));var Papa=require(_0x1655('0xf'));var Redis=require(_0x1655('0x10'));var authService=require(_0x1655('0x11'));var qs=require(_0x1655('0x12'));var as=require(_0x1655('0x13'));var hardwareService=require(_0x1655('0x14'));var logger=require(_0x1655('0x15'))(_0x1655('0x16'));var utils=require(_0x1655('0x17'));var config=require(_0x1655('0x18'));var licenseUtil=require(_0x1655('0x19'));var db=require(_0x1655('0x1a'))['db'];config[_0x1655('0x1b')]=_[_0x1655('0x1c')](config[_0x1655('0x1b')],{'host':_0x1655('0x1d'),'port':0x18eb});var socket=require(_0x1655('0x1e'))(new Redis(config[_0x1655('0x1b')]));require(_0x1655('0x1f'))[_0x1655('0x20')](socket);function respondWithStatusCode(_0x121ca9,_0x33b8bf){_0x33b8bf=_0x33b8bf||0xcc;return function(_0x322be8){if(_0x322be8){return _0x121ca9[_0x1655('0x21')](_0x33b8bf);}return _0x121ca9[_0x1655('0x22')](_0x33b8bf)[_0x1655('0x23')]();};}function respondWithResult(_0x1c4299,_0x29c4e6){_0x29c4e6=_0x29c4e6||0xc8;return function(_0x33b4eb){if(_0x33b4eb){return _0x1c4299[_0x1655('0x22')](_0x29c4e6)[_0x1655('0x24')](_0x33b4eb);}};}function respondWithFilteredResult(_0x14bec6,_0x1f8e41){return function(_0x33bfca){if(_0x33bfca){var _0x307dec=typeof _0x1f8e41[_0x1655('0x25')]===_0x1655('0x26')&&typeof _0x1f8e41[_0x1655('0x27')]===_0x1655('0x26');var _0x51db32=_0x33bfca['count'];var _0x56be3b=_0x307dec?0x0:_0x1f8e41[_0x1655('0x25')];var _0x23856b=_0x307dec?_0x33bfca['count']:_0x1f8e41['offset']+_0x1f8e41[_0x1655('0x27')];var _0x3d9ffc;if(_0x23856b>=_0x51db32){_0x23856b=_0x51db32;_0x3d9ffc=0xc8;}else{_0x3d9ffc=0xce;}_0x14bec6[_0x1655('0x22')](_0x3d9ffc);return _0x14bec6[_0x1655('0x28')]('Content-Range',_0x56be3b+'-'+_0x23856b+'/'+_0x51db32)['json'](_0x33bfca);}return null;};}function patchUpdates(_0x59bb09){return function(_0x140fb2){try{jsonpatch[_0x1655('0x29')](_0x140fb2,_0x59bb09,!![]);}catch(_0x17474e){return BPromise['reject'](_0x17474e);}return _0x140fb2[_0x1655('0x2a')]();};}function saveUpdates(_0x577e93,_0x1439a6){return function(_0x4abf54){if(_0x4abf54){return _0x4abf54[_0x1655('0x2b')](_0x577e93)[_0x1655('0x2c')](function(_0x5cb753){return _0x5cb753;});}return null;};}function removeEntity(_0x4280a7,_0x2bc51e){return function(_0x408e60){if(_0x408e60){return _0x408e60['destroy']()[_0x1655('0x2c')](function(){_0x4280a7[_0x1655('0x22')](0xcc)[_0x1655('0x23')]();});}};}function handleEntityNotFound(_0xe11a36,_0x43fe3f){return function(_0x201109){if(!_0x201109){_0xe11a36[_0x1655('0x21')](0x194);}return _0x201109;};}function handleError(_0x2cdcda,_0x1093bf){_0x1093bf=_0x1093bf||0x1f4;return function(_0xce9980){logger[_0x1655('0x2d')](_0xce9980['stack']);if(_0xce9980[_0x1655('0x2e')]){delete _0xce9980['name'];}_0x2cdcda['status'](_0x1093bf)[_0x1655('0x2f')](_0xce9980);};}exports[_0x1655('0x30')]=function(_0x3dd4dc,_0x5293d1){var _0x42364f={},_0x4edfbf={},_0x200abe={'count':0x0,'rows':[]};var _0x35f7f1=_[_0x1655('0x31')](db[_0x1655('0x32')]['rawAttributes'],function(_0x2bb85f){return{'name':_0x2bb85f['fieldName'],'type':_0x2bb85f['type'][_0x1655('0x33')]};});_0x4edfbf[_0x1655('0x34')]=_[_0x1655('0x31')](_0x35f7f1,_0x1655('0x2e'));_0x4edfbf[_0x1655('0x35')]=_['keys'](_0x3dd4dc[_0x1655('0x35')]);_0x4edfbf['filters']=_[_0x1655('0x36')](_0x4edfbf['model'],_0x4edfbf[_0x1655('0x35')]);_0x42364f[_0x1655('0x37')]=_['intersection'](_0x4edfbf[_0x1655('0x34')],qs[_0x1655('0x38')](_0x3dd4dc['query'][_0x1655('0x38')]));_0x42364f['attributes']=_0x42364f[_0x1655('0x37')][_0x1655('0x39')]?_0x42364f['attributes']:_0x4edfbf['model'];if(!_0x3dd4dc[_0x1655('0x35')][_0x1655('0x3a')]('nolimit')){_0x42364f[_0x1655('0x27')]=qs[_0x1655('0x27')](_0x3dd4dc[_0x1655('0x35')][_0x1655('0x27')]);_0x42364f[_0x1655('0x25')]=qs['offset'](_0x3dd4dc[_0x1655('0x35')][_0x1655('0x25')]);}_0x42364f[_0x1655('0x3b')]=qs[_0x1655('0x3c')](_0x3dd4dc[_0x1655('0x35')]['sort']);_0x42364f[_0x1655('0x3d')]=qs[_0x1655('0x3e')](_['pick'](_0x3dd4dc['query'],_0x4edfbf[_0x1655('0x3e')]),_0x35f7f1);if(_0x3dd4dc[_0x1655('0x35')]['filter']){_0x42364f[_0x1655('0x3d')]=_[_0x1655('0x3f')](_0x42364f[_0x1655('0x3d')],{'$or':_['map'](_0x35f7f1,function(_0x183e5c){if(_0x183e5c['type']!==_0x1655('0x40')){var _0x82a045={};_0x82a045[_0x183e5c[_0x1655('0x2e')]]={'$like':'%'+_0x3dd4dc[_0x1655('0x35')][_0x1655('0x41')]+'%'};return _0x82a045;}})});}_0x42364f=_[_0x1655('0x3f')]({},_0x42364f,_0x3dd4dc[_0x1655('0x42')]);var _0x3270dd={'where':_0x42364f[_0x1655('0x3d')]};return db[_0x1655('0x32')][_0x1655('0x43')](_0x3270dd)[_0x1655('0x2c')](function(_0x3f1de6){_0x200abe[_0x1655('0x43')]=_0x3f1de6;if(_0x3dd4dc[_0x1655('0x35')][_0x1655('0x44')]){_0x42364f[_0x1655('0x45')]=[{'all':!![]}];}return db[_0x1655('0x32')][_0x1655('0x46')](_0x42364f);})[_0x1655('0x2c')](function(_0x3a4b0e){_0x200abe['rows']=_0x3a4b0e;return _0x200abe;})['then'](respondWithFilteredResult(_0x5293d1,_0x42364f))[_0x1655('0x47')](handleError(_0x5293d1,null));};exports[_0x1655('0x48')]=function(_0x3a0e70,_0x387c3a){var _0xe3285e={'raw':!![],'where':{'id':_0x3a0e70[_0x1655('0x49')]['id']}},_0x4ce777={};_0x4ce777['model']=_['keys'](db[_0x1655('0x32')][_0x1655('0x4a')]);_0x4ce777[_0x1655('0x35')]=_[_0x1655('0x4b')](_0x3a0e70[_0x1655('0x35')]);_0x4ce777[_0x1655('0x3e')]=_[_0x1655('0x36')](_0x4ce777[_0x1655('0x34')],_0x4ce777[_0x1655('0x35')]);_0xe3285e[_0x1655('0x37')]=_[_0x1655('0x36')](_0x4ce777[_0x1655('0x34')],qs[_0x1655('0x38')](_0x3a0e70[_0x1655('0x35')][_0x1655('0x38')]));_0xe3285e[_0x1655('0x37')]=_0xe3285e['attributes']['length']?_0xe3285e[_0x1655('0x37')]:_0x4ce777[_0x1655('0x34')];if(_0x3a0e70[_0x1655('0x35')][_0x1655('0x44')]){_0xe3285e[_0x1655('0x45')]=[{'all':!![]}];}_0xe3285e=_[_0x1655('0x3f')]({},_0xe3285e,_0x3a0e70[_0x1655('0x42')]);return db[_0x1655('0x32')][_0x1655('0x4c')](_0xe3285e)[_0x1655('0x2c')](handleEntityNotFound(_0x387c3a,null))[_0x1655('0x2c')](respondWithResult(_0x387c3a,null))[_0x1655('0x47')](handleError(_0x387c3a,null));};exports[_0x1655('0x4d')]=function(_0x41c18c,_0x4dcdcb){return db[_0x1655('0x32')][_0x1655('0x4d')](_0x41c18c[_0x1655('0x4e')],{})['then'](respondWithResult(_0x4dcdcb,0xc9))[_0x1655('0x47')](handleError(_0x4dcdcb,null));};exports[_0x1655('0x2b')]=function(_0x35daec,_0x54bf73){if(_0x35daec[_0x1655('0x4e')]['id']){delete _0x35daec['body']['id'];}return db[_0x1655('0x32')][_0x1655('0x4c')]({'where':{'id':_0x35daec['params']['id']}})[_0x1655('0x2c')](handleEntityNotFound(_0x54bf73,null))[_0x1655('0x2c')](saveUpdates(_0x35daec[_0x1655('0x4e')],null))['then'](respondWithResult(_0x54bf73,null))[_0x1655('0x47')](handleError(_0x54bf73,null));};exports[_0x1655('0x4f')]=function(_0x272792,_0x131b66){return db[_0x1655('0x32')]['find']({'where':{'id':_0x272792['params']['id']}})[_0x1655('0x2c')](handleEntityNotFound(_0x131b66,null))['then'](removeEntity(_0x131b66,null))[_0x1655('0x47')](handleError(_0x131b66,null));};exports['describe']=function(_0x1485f6,_0x1b0e31){return db[_0x1655('0x32')][_0x1655('0x50')]()[_0x1655('0x2c')](respondWithResult(_0x1b0e31,null))[_0x1655('0x47')](handleError(_0x1b0e31,null));};exports[_0x1655('0x51')]=function(_0x331606,_0x3f28ee,_0x3635ea){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x331606[_0x1655('0x49')]['id'],'ToId':_0x331606[_0x1655('0x52')]['id'],'read':![]}})[_0x1655('0x2c')](function(_0x11178c){return{'id':_[_0x1655('0x53')](_0x331606[_0x1655('0x49')]['id']),'count':_0x11178c};})[_0x1655('0x2c')](respondWithResult(_0x3f28ee,null))[_0x1655('0x47')](handleError(_0x3f28ee,null));};exports['addMembers']=function(_0xe5b627,_0x5f1c10,_0x3ed3d6){return db[_0x1655('0x32')][_0x1655('0x4c')]({'where':{'id':_0xe5b627[_0x1655('0x49')]['id']}})[_0x1655('0x2c')](handleEntityNotFound(_0x5f1c10,null))[_0x1655('0x2c')](function(_0x4425e2){if(_0x4425e2){return _0x4425e2[_0x1655('0x54')](_0xe5b627[_0x1655('0x4e')]['ids'],_[_0x1655('0x55')](_0xe5b627[_0x1655('0x4e')],[_0x1655('0x56'),'id'])||{});}})[_0x1655('0x2c')](respondWithResult(_0x5f1c10,null))[_0x1655('0x47')](handleError(_0x5f1c10,null));};exports[_0x1655('0x57')]=function(_0xdf2242,_0x17b4df,_0x62b55c){var _0x278f37={};var _0x10c9aa={};var _0x199eef;var _0x600ace;return db[_0x1655('0x32')][_0x1655('0x58')]({'where':{'id':_0xdf2242[_0x1655('0x49')]['id']}})['then'](handleEntityNotFound(_0x17b4df,null))[_0x1655('0x2c')](function(_0x521912){if(_0x521912){_0x199eef=_0x521912;_0x10c9aa[_0x1655('0x34')]=_[_0x1655('0x4b')](db[_0x1655('0x59')][_0x1655('0x4a')]);_0x10c9aa['query']=_[_0x1655('0x4b')](_0xdf2242['query']);_0x10c9aa[_0x1655('0x3e')]=_[_0x1655('0x36')](_0x10c9aa[_0x1655('0x34')],_0x10c9aa[_0x1655('0x35')]);_0x278f37['attributes']=_[_0x1655('0x36')](_0x10c9aa['model'],qs[_0x1655('0x38')](_0xdf2242[_0x1655('0x35')][_0x1655('0x38')]));_0x278f37[_0x1655('0x37')]=_0x278f37[_0x1655('0x37')][_0x1655('0x39')]?_0x278f37[_0x1655('0x37')]:_0x10c9aa['model'];_0x278f37[_0x1655('0x3b')]=qs[_0x1655('0x3c')](_0xdf2242['query']['sort']);_0x278f37[_0x1655('0x3d')]=qs[_0x1655('0x3e')](_[_0x1655('0x5a')](_0xdf2242[_0x1655('0x35')],_0x10c9aa[_0x1655('0x3e')]));if(_0xdf2242[_0x1655('0x35')][_0x1655('0x41')]){_0x278f37['where']=_[_0x1655('0x3f')](_0x278f37[_0x1655('0x3d')],{'$or':_[_0x1655('0x31')](_0x278f37[_0x1655('0x37')],function(_0xe692d9){var _0x325a8e={};_0x325a8e[_0xe692d9]={'$like':'%'+_0xdf2242[_0x1655('0x35')][_0x1655('0x41')]+'%'};return _0x325a8e;})});}_0x278f37=_['merge']({},_0x278f37,_0xdf2242[_0x1655('0x42')]);return _0x199eef[_0x1655('0x57')](_0x278f37);}})[_0x1655('0x2c')](function(_0xc6978){if(_0xc6978){_0x600ace=_0xc6978[_0x1655('0x39')];if(!_0xdf2242['query']['hasOwnProperty'](_0x1655('0x5b'))){_0x278f37[_0x1655('0x27')]=qs['limit'](_0xdf2242[_0x1655('0x35')]['limit']);_0x278f37['offset']=qs['offset'](_0xdf2242[_0x1655('0x35')]['offset']);}return _0x199eef[_0x1655('0x57')](_0x278f37);}})['then'](function(_0x19df1f){if(_0x19df1f){return _0x19df1f?{'count':_0x600ace,'rows':_0x19df1f}:null;}})[_0x1655('0x2c')](respondWithResult(_0x17b4df,null))[_0x1655('0x47')](handleError(_0x17b4df,null));};exports[_0x1655('0x5c')]=function(_0x181eab,_0x777fad,_0x2ca49a){return db[_0x1655('0x32')][_0x1655('0x4c')]({'where':{'id':_0x181eab[_0x1655('0x49')]['id']}})['then'](handleEntityNotFound(_0x777fad,null))[_0x1655('0x2c')](function(_0x530ddb){if(_0x530ddb){return _0x530ddb[_0x1655('0x5c')](_0x181eab['query'][_0x1655('0x56')]);}})['then'](respondWithStatusCode(_0x777fad,null))[_0x1655('0x47')](handleError(_0x777fad,null));};exports['addMessage']=function(_0x2d6ad9,_0x5449e3,_0x3f960c){if(_0x2d6ad9[_0x1655('0x4e')]['id']){delete _0x2d6ad9[_0x1655('0x4e')]['id'];}return db[_0x1655('0x32')]['find']({'where':{'id':_0x2d6ad9[_0x1655('0x49')]['id']}})[_0x1655('0x2c')](handleEntityNotFound(_0x5449e3,null))[_0x1655('0x2c')](function(_0x1341d5){if(_0x1341d5){_0x2d6ad9[_0x1655('0x4e')][_0x1655('0x5d')]=_0x1341d5['id'];return db[_0x1655('0x5e')]['create'](_0x2d6ad9[_0x1655('0x4e')]);}})['then'](respondWithResult(_0x5449e3,null))[_0x1655('0x47')](handleError(_0x5449e3,null));};exports[_0x1655('0x5f')]=function(_0x5c4af6,_0x55b373,_0xf54a3d){var _0x220007={};var _0x35b0a9={};var _0x366288;var _0x2ff06a;return db[_0x1655('0x32')][_0x1655('0x58')]({'where':{'id':_0x5c4af6['params']['id']}})[_0x1655('0x2c')](handleEntityNotFound(_0x55b373,null))[_0x1655('0x2c')](function(_0x51422e){if(_0x51422e){_0x366288=_0x51422e;_0x35b0a9[_0x1655('0x34')]=_[_0x1655('0x4b')](db[_0x1655('0x5e')]['rawAttributes']);_0x35b0a9[_0x1655('0x35')]=_[_0x1655('0x4b')](_0x5c4af6[_0x1655('0x35')]);_0x35b0a9[_0x1655('0x3e')]=_[_0x1655('0x36')](_0x35b0a9[_0x1655('0x34')],_0x35b0a9[_0x1655('0x35')]);_0x220007[_0x1655('0x37')]=_[_0x1655('0x36')](_0x35b0a9[_0x1655('0x34')],qs['fields'](_0x5c4af6[_0x1655('0x35')][_0x1655('0x38')]));_0x220007['attributes']=_0x220007[_0x1655('0x37')][_0x1655('0x39')]?_0x220007[_0x1655('0x37')]:_0x35b0a9['model'];_0x220007[_0x1655('0x3b')]=qs['sort'](_0x5c4af6[_0x1655('0x35')][_0x1655('0x3c')]);_0x220007['where']=qs[_0x1655('0x3e')](_['pick'](_0x5c4af6['query'],_0x35b0a9[_0x1655('0x3e')]));if(_0x5c4af6[_0x1655('0x35')]['filter']){_0x220007['where']=_[_0x1655('0x3f')](_0x220007[_0x1655('0x3d')],{'$or':_[_0x1655('0x31')](_0x220007[_0x1655('0x37')],function(_0xa577f3){var _0x1ce8b3={};_0x1ce8b3[_0xa577f3]={'$like':'%'+_0x5c4af6['query']['filter']+'%'};return _0x1ce8b3;})});}if(_0x5c4af6[_0x1655('0x35')][_0x1655('0x60')]){var _0x2d8dd8=_0x5c4af6[_0x1655('0x35')]['$gte'][_0x1655('0x61')](',');var _0x1d5e6e={};_0x1d5e6e[_0x2d8dd8[0x0]]={'$gte':moment(_0x2d8dd8[0x1])[_0x1655('0x62')](_0x1655('0x63'))};_0x220007[_0x1655('0x3d')]=_['merge'](_0x220007[_0x1655('0x3d')],_0x1d5e6e);}_0x220007=_[_0x1655('0x3f')]({},_0x220007,_0x5c4af6[_0x1655('0x42')]);return _0x366288[_0x1655('0x5f')](_0x220007);}})[_0x1655('0x2c')](function(_0x583f65){if(_0x583f65){_0x2ff06a=_0x583f65[_0x1655('0x39')];if(!_0x5c4af6[_0x1655('0x35')][_0x1655('0x3a')](_0x1655('0x5b'))){_0x220007[_0x1655('0x27')]=qs[_0x1655('0x27')](_0x5c4af6[_0x1655('0x35')][_0x1655('0x27')]);_0x220007[_0x1655('0x25')]=qs['offset'](_0x5c4af6[_0x1655('0x35')][_0x1655('0x25')]);}return _0x366288[_0x1655('0x5f')](_0x220007);}})[_0x1655('0x2c')](function(_0x45aca6){if(_0x45aca6){return _0x45aca6?{'count':_0x2ff06a,'rows':_0x45aca6}:null;}})[_0x1655('0x2c')](respondWithResult(_0x55b373,null))[_0x1655('0x47')](handleError(_0x55b373,null));}; \ No newline at end of file +var _0x11ed=['error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','find','create','body','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then'];(function(_0x1ec55e,_0x14410a){var _0x3384a5=function(_0x23529c){while(--_0x23529c){_0x1ec55e['push'](_0x1ec55e['shift']());}};_0x3384a5(++_0x14410a);}(_0x11ed,0x1a2));var _0xd11e=function(_0x1a867e,_0x13c03d){_0x1a867e=_0x1a867e-0x0;var _0x782184=_0x11ed[_0x1a867e];return _0x782184;};'use strict';var emlformat=require(_0xd11e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd11e('0x1'));var jsonpatch=require(_0xd11e('0x2'));var rp=require(_0xd11e('0x3'));var moment=require(_0xd11e('0x4'));var BPromise=require(_0xd11e('0x5'));var Mustache=require(_0xd11e('0x6'));var util=require(_0xd11e('0x7'));var path=require('path');var sox=require(_0xd11e('0x8'));var csv=require(_0xd11e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd11e('0xa'));var _=require('lodash');var squel=require(_0xd11e('0xb'));var crypto=require(_0xd11e('0xc'));var jsforce=require(_0xd11e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd11e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd11e('0xe'))(_0xd11e('0xf'));var utils=require(_0xd11e('0x10'));var config=require(_0xd11e('0x11'));var licenseUtil=require(_0xd11e('0x12'));var db=require('../../mysqldb')['db'];config[_0xd11e('0x13')]=_[_0xd11e('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd11e('0x15'))(new Redis(config['redis']));require(_0xd11e('0x16'))[_0xd11e('0x17')](socket);function respondWithStatusCode(_0x552163,_0x17e393){_0x17e393=_0x17e393||0xcc;return function(_0x4699e8){if(_0x4699e8){return _0x552163[_0xd11e('0x18')](_0x17e393);}return _0x552163[_0xd11e('0x19')](_0x17e393)['end']();};}function respondWithResult(_0x42e15e,_0x1eb491){_0x1eb491=_0x1eb491||0xc8;return function(_0x5d59d2){if(_0x5d59d2){return _0x42e15e['status'](_0x1eb491)[_0xd11e('0x1a')](_0x5d59d2);}};}function respondWithFilteredResult(_0x2ac91a,_0x4623d1){return function(_0x3676f9){if(_0x3676f9){var _0x4cd758=typeof _0x4623d1[_0xd11e('0x1b')]===_0xd11e('0x1c')&&typeof _0x4623d1[_0xd11e('0x1d')]===_0xd11e('0x1c');var _0xce2cbd=_0x3676f9['count'];var _0x1cc8b9=_0x4cd758?0x0:_0x4623d1[_0xd11e('0x1b')];var _0x59c0e8=_0x4cd758?_0x3676f9[_0xd11e('0x1e')]:_0x4623d1[_0xd11e('0x1b')]+_0x4623d1['limit'];var _0x2c6923;if(_0x59c0e8>=_0xce2cbd){_0x59c0e8=_0xce2cbd;_0x2c6923=0xc8;}else{_0x2c6923=0xce;}_0x2ac91a['status'](_0x2c6923);return _0x2ac91a[_0xd11e('0x1f')](_0xd11e('0x20'),_0x1cc8b9+'-'+_0x59c0e8+'/'+_0xce2cbd)[_0xd11e('0x1a')](_0x3676f9);}return null;};}function patchUpdates(_0x55c603){return function(_0x3cf461){try{jsonpatch['apply'](_0x3cf461,_0x55c603,!![]);}catch(_0x5d14c0){return BPromise[_0xd11e('0x21')](_0x5d14c0);}return _0x3cf461[_0xd11e('0x22')]();};}function saveUpdates(_0x184162,_0x431a76){return function(_0x118604){if(_0x118604){return _0x118604[_0xd11e('0x23')](_0x184162)[_0xd11e('0x24')](function(_0x4d5127){return _0x4d5127;});}return null;};}function removeEntity(_0xfd9c50,_0x441b41){return function(_0x2acec7){if(_0x2acec7){return _0x2acec7['destroy']()[_0xd11e('0x24')](function(){_0xfd9c50[_0xd11e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c950c,_0x5e050e){return function(_0xb95220){if(!_0xb95220){_0x3c950c[_0xd11e('0x18')](0x194);}return _0xb95220;};}function handleError(_0x2abf69,_0x1ffe7d){_0x1ffe7d=_0x1ffe7d||0x1f4;return function(_0x479bb9){logger[_0xd11e('0x25')](_0x479bb9[_0xd11e('0x26')]);if(_0x479bb9[_0xd11e('0x27')]){delete _0x479bb9[_0xd11e('0x27')];}_0x2abf69[_0xd11e('0x19')](_0x1ffe7d)[_0xd11e('0x28')](_0x479bb9);};}exports[_0xd11e('0x29')]=function(_0x1e5506,_0x34f3bb){var _0x395a58={},_0x361c47={},_0x2413a5={'count':0x0,'rows':[]};var _0x24d299=_[_0xd11e('0x2a')](db[_0xd11e('0x2b')][_0xd11e('0x2c')],function(_0x31b513){return{'name':_0x31b513[_0xd11e('0x2d')],'type':_0x31b513['type'][_0xd11e('0x2e')]};});_0x361c47[_0xd11e('0x2f')]=_['map'](_0x24d299,_0xd11e('0x27'));_0x361c47[_0xd11e('0x30')]=_[_0xd11e('0x31')](_0x1e5506['query']);_0x361c47[_0xd11e('0x32')]=_[_0xd11e('0x33')](_0x361c47['model'],_0x361c47['query']);_0x395a58['attributes']=_[_0xd11e('0x33')](_0x361c47['model'],qs[_0xd11e('0x34')](_0x1e5506[_0xd11e('0x30')]['fields']));_0x395a58[_0xd11e('0x35')]=_0x395a58[_0xd11e('0x35')][_0xd11e('0x36')]?_0x395a58[_0xd11e('0x35')]:_0x361c47[_0xd11e('0x2f')];if(!_0x1e5506[_0xd11e('0x30')][_0xd11e('0x37')](_0xd11e('0x38'))){_0x395a58[_0xd11e('0x1d')]=qs[_0xd11e('0x1d')](_0x1e5506['query'][_0xd11e('0x1d')]);_0x395a58[_0xd11e('0x1b')]=qs[_0xd11e('0x1b')](_0x1e5506['query']['offset']);}_0x395a58[_0xd11e('0x39')]=qs[_0xd11e('0x3a')](_0x1e5506[_0xd11e('0x30')][_0xd11e('0x3a')]);_0x395a58[_0xd11e('0x3b')]=qs['filters'](_[_0xd11e('0x3c')](_0x1e5506[_0xd11e('0x30')],_0x361c47['filters']),_0x24d299);if(_0x1e5506['query']['filter']){_0x395a58[_0xd11e('0x3b')]=_[_0xd11e('0x3d')](_0x395a58['where'],{'$or':_[_0xd11e('0x2a')](_0x24d299,function(_0x54c5f0){if(_0x54c5f0['type']!==_0xd11e('0x3e')){var _0x251b00={};_0x251b00[_0x54c5f0['name']]={'$like':'%'+_0x1e5506[_0xd11e('0x30')][_0xd11e('0x3f')]+'%'};return _0x251b00;}})});}_0x395a58=_['merge']({},_0x395a58,_0x1e5506[_0xd11e('0x40')]);var _0x5b3762={'where':_0x395a58[_0xd11e('0x3b')]};return db['ChatGroup'][_0xd11e('0x1e')](_0x5b3762)['then'](function(_0x1712ee){_0x2413a5[_0xd11e('0x1e')]=_0x1712ee;if(_0x1e5506[_0xd11e('0x30')]['includeAll']){_0x395a58[_0xd11e('0x41')]=[{'all':!![]}];}return db[_0xd11e('0x2b')][_0xd11e('0x42')](_0x395a58);})[_0xd11e('0x24')](function(_0x37cf1a){_0x2413a5['rows']=_0x37cf1a;return _0x2413a5;})[_0xd11e('0x24')](respondWithFilteredResult(_0x34f3bb,_0x395a58))[_0xd11e('0x43')](handleError(_0x34f3bb,null));};exports[_0xd11e('0x44')]=function(_0x1e4412,_0x5eba69){var _0x4249fc={'raw':!![],'where':{'id':_0x1e4412[_0xd11e('0x45')]['id']}},_0x1208dd={};_0x1208dd[_0xd11e('0x2f')]=_[_0xd11e('0x31')](db[_0xd11e('0x2b')][_0xd11e('0x2c')]);_0x1208dd['query']=_[_0xd11e('0x31')](_0x1e4412['query']);_0x1208dd['filters']=_[_0xd11e('0x33')](_0x1208dd[_0xd11e('0x2f')],_0x1208dd[_0xd11e('0x30')]);_0x4249fc[_0xd11e('0x35')]=_[_0xd11e('0x33')](_0x1208dd[_0xd11e('0x2f')],qs[_0xd11e('0x34')](_0x1e4412['query'][_0xd11e('0x34')]));_0x4249fc[_0xd11e('0x35')]=_0x4249fc[_0xd11e('0x35')][_0xd11e('0x36')]?_0x4249fc['attributes']:_0x1208dd[_0xd11e('0x2f')];if(_0x1e4412[_0xd11e('0x30')]['includeAll']){_0x4249fc[_0xd11e('0x41')]=[{'all':!![]}];}_0x4249fc=_[_0xd11e('0x3d')]({},_0x4249fc,_0x1e4412[_0xd11e('0x40')]);return db[_0xd11e('0x2b')][_0xd11e('0x46')](_0x4249fc)[_0xd11e('0x24')](handleEntityNotFound(_0x5eba69,null))['then'](respondWithResult(_0x5eba69,null))[_0xd11e('0x43')](handleError(_0x5eba69,null));};exports[_0xd11e('0x47')]=function(_0xb55735,_0xd412f3){return db[_0xd11e('0x2b')][_0xd11e('0x47')](_0xb55735['body'],{})[_0xd11e('0x24')](respondWithResult(_0xd412f3,0xc9))[_0xd11e('0x43')](handleError(_0xd412f3,null));};exports['update']=function(_0x114d37,_0x14c34e){if(_0x114d37[_0xd11e('0x48')]['id']){delete _0x114d37[_0xd11e('0x48')]['id'];}return db[_0xd11e('0x2b')][_0xd11e('0x46')]({'where':{'id':_0x114d37[_0xd11e('0x45')]['id']}})[_0xd11e('0x24')](handleEntityNotFound(_0x14c34e,null))[_0xd11e('0x24')](saveUpdates(_0x114d37[_0xd11e('0x48')],null))[_0xd11e('0x24')](respondWithResult(_0x14c34e,null))['catch'](handleError(_0x14c34e,null));};exports[_0xd11e('0x49')]=function(_0x57b6b2,_0x24264d){return db[_0xd11e('0x2b')][_0xd11e('0x46')]({'where':{'id':_0x57b6b2[_0xd11e('0x45')]['id']}})['then'](handleEntityNotFound(_0x24264d,null))[_0xd11e('0x24')](removeEntity(_0x24264d,null))[_0xd11e('0x43')](handleError(_0x24264d,null));};exports[_0xd11e('0x4a')]=function(_0x202944,_0x4ad9bc){return db[_0xd11e('0x2b')][_0xd11e('0x4a')]()[_0xd11e('0x24')](respondWithResult(_0x4ad9bc,null))[_0xd11e('0x43')](handleError(_0x4ad9bc,null));};exports[_0xd11e('0x4b')]=function(_0x4304c7,_0x1a45b3,_0x5650d9){return db[_0xd11e('0x4c')]['count']({'where':{'ChatGroupId':_0x4304c7[_0xd11e('0x45')]['id'],'ToId':_0x4304c7['user']['id'],'read':![]}})[_0xd11e('0x24')](function(_0x1d2b2b){return{'id':_[_0xd11e('0x4d')](_0x4304c7[_0xd11e('0x45')]['id']),'count':_0x1d2b2b};})[_0xd11e('0x24')](respondWithResult(_0x1a45b3,null))[_0xd11e('0x43')](handleError(_0x1a45b3,null));};exports[_0xd11e('0x4e')]=function(_0x5518cc,_0x5bd791,_0x57e168){return db['ChatGroup'][_0xd11e('0x46')]({'where':{'id':_0x5518cc[_0xd11e('0x45')]['id']}})[_0xd11e('0x24')](handleEntityNotFound(_0x5bd791,null))['then'](function(_0x521d){if(_0x521d){return _0x521d[_0xd11e('0x4e')](_0x5518cc[_0xd11e('0x48')][_0xd11e('0x4f')],_[_0xd11e('0x50')](_0x5518cc[_0xd11e('0x48')],[_0xd11e('0x4f'),'id'])||{});}})[_0xd11e('0x24')](respondWithResult(_0x5bd791,null))[_0xd11e('0x43')](handleError(_0x5bd791,null));};exports['getMembers']=function(_0x1c767a,_0x4cca57,_0x186f6f){var _0x5a5193={};var _0x502e8c={};var _0x37b98f;var _0x8f96e7;return db[_0xd11e('0x2b')][_0xd11e('0x51')]({'where':{'id':_0x1c767a[_0xd11e('0x45')]['id']}})[_0xd11e('0x24')](handleEntityNotFound(_0x4cca57,null))[_0xd11e('0x24')](function(_0x5f4cef){if(_0x5f4cef){_0x37b98f=_0x5f4cef;_0x502e8c[_0xd11e('0x2f')]=_[_0xd11e('0x31')](db['User'][_0xd11e('0x2c')]);_0x502e8c[_0xd11e('0x30')]=_[_0xd11e('0x31')](_0x1c767a[_0xd11e('0x30')]);_0x502e8c[_0xd11e('0x32')]=_['intersection'](_0x502e8c[_0xd11e('0x2f')],_0x502e8c['query']);_0x5a5193['attributes']=_[_0xd11e('0x33')](_0x502e8c['model'],qs[_0xd11e('0x34')](_0x1c767a['query'][_0xd11e('0x34')]));_0x5a5193[_0xd11e('0x35')]=_0x5a5193[_0xd11e('0x35')][_0xd11e('0x36')]?_0x5a5193[_0xd11e('0x35')]:_0x502e8c[_0xd11e('0x2f')];_0x5a5193['order']=qs['sort'](_0x1c767a[_0xd11e('0x30')][_0xd11e('0x3a')]);_0x5a5193[_0xd11e('0x3b')]=qs['filters'](_['pick'](_0x1c767a[_0xd11e('0x30')],_0x502e8c['filters']));if(_0x1c767a[_0xd11e('0x30')]['filter']){_0x5a5193['where']=_[_0xd11e('0x3d')](_0x5a5193[_0xd11e('0x3b')],{'$or':_['map'](_0x5a5193[_0xd11e('0x35')],function(_0x3cad6b){var _0x1c680b={};_0x1c680b[_0x3cad6b]={'$like':'%'+_0x1c767a[_0xd11e('0x30')][_0xd11e('0x3f')]+'%'};return _0x1c680b;})});}_0x5a5193=_[_0xd11e('0x3d')]({},_0x5a5193,_0x1c767a[_0xd11e('0x40')]);return _0x37b98f[_0xd11e('0x52')](_0x5a5193);}})['then'](function(_0x41e8ec){if(_0x41e8ec){_0x8f96e7=_0x41e8ec[_0xd11e('0x36')];if(!_0x1c767a[_0xd11e('0x30')]['hasOwnProperty'](_0xd11e('0x38'))){_0x5a5193['limit']=qs['limit'](_0x1c767a['query']['limit']);_0x5a5193[_0xd11e('0x1b')]=qs[_0xd11e('0x1b')](_0x1c767a[_0xd11e('0x30')][_0xd11e('0x1b')]);}return _0x37b98f[_0xd11e('0x52')](_0x5a5193);}})[_0xd11e('0x24')](function(_0x1ae67c){if(_0x1ae67c){return _0x1ae67c?{'count':_0x8f96e7,'rows':_0x1ae67c}:null;}})['then'](respondWithResult(_0x4cca57,null))['catch'](handleError(_0x4cca57,null));};exports[_0xd11e('0x53')]=function(_0x1bd505,_0x6429e9,_0x5b3f33){return db[_0xd11e('0x2b')][_0xd11e('0x46')]({'where':{'id':_0x1bd505['params']['id']}})[_0xd11e('0x24')](handleEntityNotFound(_0x6429e9,null))[_0xd11e('0x24')](function(_0x34f52f){if(_0x34f52f){return _0x34f52f[_0xd11e('0x53')](_0x1bd505[_0xd11e('0x30')]['ids']);}})[_0xd11e('0x24')](respondWithStatusCode(_0x6429e9,null))[_0xd11e('0x43')](handleError(_0x6429e9,null));};exports[_0xd11e('0x54')]=function(_0x1962d1,_0x7cbaf2,_0x1b69bb){if(_0x1962d1[_0xd11e('0x48')]['id']){delete _0x1962d1[_0xd11e('0x48')]['id'];}return db[_0xd11e('0x2b')]['find']({'where':{'id':_0x1962d1[_0xd11e('0x45')]['id']}})[_0xd11e('0x24')](handleEntityNotFound(_0x7cbaf2,null))['then'](function(_0x3438d0){if(_0x3438d0){_0x1962d1['body'][_0xd11e('0x55')]=_0x3438d0['id'];return db[_0xd11e('0x4c')][_0xd11e('0x47')](_0x1962d1[_0xd11e('0x48')]);}})['then'](respondWithResult(_0x7cbaf2,null))[_0xd11e('0x43')](handleError(_0x7cbaf2,null));};exports[_0xd11e('0x56')]=function(_0x38122e,_0xabe47f,_0x312495){var _0x3197ab={};var _0x19321e={};var _0x3bde31;var _0x1cb8b5;return db[_0xd11e('0x2b')][_0xd11e('0x51')]({'where':{'id':_0x38122e[_0xd11e('0x45')]['id']}})['then'](handleEntityNotFound(_0xabe47f,null))[_0xd11e('0x24')](function(_0x2c1d50){if(_0x2c1d50){_0x3bde31=_0x2c1d50;_0x19321e[_0xd11e('0x2f')]=_[_0xd11e('0x31')](db[_0xd11e('0x4c')][_0xd11e('0x2c')]);_0x19321e['query']=_[_0xd11e('0x31')](_0x38122e[_0xd11e('0x30')]);_0x19321e[_0xd11e('0x32')]=_[_0xd11e('0x33')](_0x19321e[_0xd11e('0x2f')],_0x19321e[_0xd11e('0x30')]);_0x3197ab[_0xd11e('0x35')]=_[_0xd11e('0x33')](_0x19321e[_0xd11e('0x2f')],qs[_0xd11e('0x34')](_0x38122e[_0xd11e('0x30')][_0xd11e('0x34')]));_0x3197ab[_0xd11e('0x35')]=_0x3197ab[_0xd11e('0x35')][_0xd11e('0x36')]?_0x3197ab[_0xd11e('0x35')]:_0x19321e[_0xd11e('0x2f')];_0x3197ab[_0xd11e('0x39')]=qs[_0xd11e('0x3a')](_0x38122e[_0xd11e('0x30')][_0xd11e('0x3a')]);_0x3197ab[_0xd11e('0x3b')]=qs[_0xd11e('0x32')](_[_0xd11e('0x3c')](_0x38122e[_0xd11e('0x30')],_0x19321e[_0xd11e('0x32')]));if(_0x38122e['query'][_0xd11e('0x3f')]){_0x3197ab[_0xd11e('0x3b')]=_[_0xd11e('0x3d')](_0x3197ab[_0xd11e('0x3b')],{'$or':_[_0xd11e('0x2a')](_0x3197ab[_0xd11e('0x35')],function(_0xd41faf){var _0x417665={};_0x417665[_0xd41faf]={'$like':'%'+_0x38122e[_0xd11e('0x30')]['filter']+'%'};return _0x417665;})});}if(_0x38122e[_0xd11e('0x30')]['$gte']){var _0x116cd5=_0x38122e[_0xd11e('0x30')][_0xd11e('0x57')][_0xd11e('0x58')](',');var _0x5a239f={};_0x5a239f[_0x116cd5[0x0]]={'$gte':moment(_0x116cd5[0x1])[_0xd11e('0x59')](_0xd11e('0x5a'))};_0x3197ab[_0xd11e('0x3b')]=_[_0xd11e('0x3d')](_0x3197ab[_0xd11e('0x3b')],_0x5a239f);}_0x3197ab=_['merge']({},_0x3197ab,_0x38122e[_0xd11e('0x40')]);return _0x3bde31[_0xd11e('0x56')](_0x3197ab);}})[_0xd11e('0x24')](function(_0x2a687e){if(_0x2a687e){_0x1cb8b5=_0x2a687e[_0xd11e('0x36')];if(!_0x38122e[_0xd11e('0x30')]['hasOwnProperty']('nolimit')){_0x3197ab[_0xd11e('0x1d')]=qs[_0xd11e('0x1d')](_0x38122e[_0xd11e('0x30')]['limit']);_0x3197ab[_0xd11e('0x1b')]=qs[_0xd11e('0x1b')](_0x38122e[_0xd11e('0x30')][_0xd11e('0x1b')]);}return _0x3bde31[_0xd11e('0x56')](_0x3197ab);}})['then'](function(_0x11bc4d){if(_0x11bc4d){return _0x11bc4d?{'count':_0x1cb8b5,'rows':_0x11bc4d}:null;}})['then'](respondWithResult(_0xabe47f,null))[_0xd11e('0x43')](handleError(_0xabe47f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index cc8e231..b9ca5ec 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6239=['events','../../mysqldb','ChatGroup','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3263aa,_0xa9ae7b){var _0x2184a9=function(_0x4baca1){while(--_0x4baca1){_0x3263aa['push'](_0x3263aa['shift']());}};_0x2184a9(++_0xa9ae7b);}(_0x6239,0x144));var _0x9623=function(_0x230115,_0x522113){_0x230115=_0x230115-0x0;var _0x48de38=_0x6239[_0x230115];return _0x48de38;};'use strict';var EventEmitter=require(_0x9623('0x0'));var ChatGroup=require(_0x9623('0x1'))['db'][_0x9623('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9623('0x3'),'afterUpdate':_0x9623('0x4'),'afterDestroy':_0x9623('0x5')};function emitEvent(_0x1a6015){return function(_0x1688cf,_0x24d85b,_0xd052a2){ChatGroupEvents[_0x9623('0x6')](_0x1a6015+':'+_0x1688cf['id'],_0x1688cf);ChatGroupEvents[_0x9623('0x6')](_0x1a6015,_0x1688cf);_0xd052a2(null);};}for(var e in events){if(events[_0x9623('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x9623('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x4429=['../../mysqldb','ChatGroup','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x32b578,_0xb23d40){var _0x4e3ee0=function(_0x2d2694){while(--_0x2d2694){_0x32b578['push'](_0x32b578['shift']());}};_0x4e3ee0(++_0xb23d40);}(_0x4429,0x1ce));var _0x9442=function(_0x4709af,_0x46c90c){_0x4709af=_0x4709af-0x0;var _0x525764=_0x4429[_0x4709af];return _0x525764;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x9442('0x0'))['db'][_0x9442('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9442('0x2')](0x0);var events={'afterCreate':_0x9442('0x3'),'afterUpdate':'update','afterDestroy':_0x9442('0x4')};function emitEvent(_0x3e7395){return function(_0x1205a4,_0x24a9f9,_0x58fae1){ChatGroupEvents['emit'](_0x3e7395+':'+_0x1205a4['id'],_0x1205a4);ChatGroupEvents['emit'](_0x3e7395,_0x1205a4);_0x58fae1(null);};}for(var e in events){if(events[_0x9442('0x5')](e)){var event=events[e];ChatGroup[_0x9442('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index c59a8dd..ffcd7f3 100644 --- a/server/api/chatGroup/chatGroup.model.js +++ b/server/api/chatGroup/chatGroup.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bca=['moment','request-promise','path','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0xd9ae5,_0x54cc57){var _0x5ece93=function(_0x115bea){while(--_0x115bea){_0xd9ae5['push'](_0xd9ae5['shift']());}};_0x5ece93(++_0x54cc57);}(_0x3bca,0x75));var _0xa3bc=function(_0x3a3b99,_0x13326f){_0x3a3b99=_0x3a3b99-0x0;var _0x27a8df=_0x3bca[_0x3a3b99];return _0x27a8df;};'use strict';var _=require(_0xa3bc('0x0'));var util=require(_0xa3bc('0x1'));var logger=require(_0xa3bc('0x2'))('api');var moment=require(_0xa3bc('0x3'));var BPromise=require('bluebird');var rp=require(_0xa3bc('0x4'));var fs=require('fs');var path=require(_0xa3bc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3bc('0x6'));module[_0xa3bc('0x7')]=function(_0x5f469d,_0x10e21d){return _0x5f469d['define'](_0xa3bc('0x8'),attributes,{'tableName':_0xa3bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b4a=['path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x592736,_0x3bf7eb){var _0x23b40f=function(_0x5951f3){while(--_0x5951f3){_0x592736['push'](_0x592736['shift']());}};_0x23b40f(++_0x3bf7eb);}(_0x7b4a,0xc6));var _0xa7b4=function(_0x2a4c2b,_0x1ce4a3){_0x2a4c2b=_0x2a4c2b-0x0;var _0x5c5cd1=_0x7b4a[_0x2a4c2b];return _0x5c5cd1;};'use strict';var _=require(_0xa7b4('0x0'));var util=require(_0xa7b4('0x1'));var logger=require(_0xa7b4('0x2'))(_0xa7b4('0x3'));var moment=require(_0xa7b4('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7b4('0x5'));var fs=require('fs');var path=require(_0xa7b4('0x6'));var rimraf=require(_0xa7b4('0x7'));var config=require('../../config/environment');var attributes=require(_0xa7b4('0x8'));module[_0xa7b4('0x9')]=function(_0x14d54a,_0x4eb248){return _0x14d54a[_0xa7b4('0xa')](_0xa7b4('0xb'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 1bdf90e..360c03b 100644 --- a/server/api/chatGroup/chatGroup.rpc.js +++ b/server/api/chatGroup/chatGroup.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06cb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','debug','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x4f6069,_0x262b32){var _0x56d182=function(_0x19bc7e){while(--_0x19bc7e){_0x4f6069['push'](_0x4f6069['shift']());}};_0x56d182(++_0x262b32);}(_0x06cb,0x1c6));var _0xb06c=function(_0x26c935,_0x57a9a6){_0x26c935=_0x26c935-0x0;var _0x2d3ada=_0x06cb[_0x26c935];return _0x2d3ada;};'use strict';var _=require(_0xb06c('0x0'));var util=require(_0xb06c('0x1'));var moment=require(_0xb06c('0x2'));var BPromise=require(_0xb06c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb06c('0x4'))['db'];var utils=require(_0xb06c('0x5'));var logger=require(_0xb06c('0x6'))(_0xb06c('0x7'));var config=require(_0xb06c('0x8'));var jayson=require(_0xb06c('0x9'));var client=jayson['client'][_0xb06c('0xa')]({'port':0x232a});config[_0xb06c('0xb')]=_[_0xb06c('0xc')](config[_0xb06c('0xb')],{'host':_0xb06c('0xd'),'port':0x18eb});var socket=require(_0xb06c('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xb06c('0xf')](socket);function respondWithRpcPromise(_0x1ccaf3,_0x358273,_0x4e5779){return new BPromise(function(_0x48b995,_0xbb656b){return client[_0xb06c('0x10')](_0x1ccaf3,_0x4e5779)[_0xb06c('0x11')](function(_0xf8893d){logger['info']('ChatGroup,\x20%s,\x20%s',_0x358273,'request\x20sent');logger[_0xb06c('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x358273,_0xb06c('0x13'),JSON[_0xb06c('0x14')](_0xf8893d));if(_0xf8893d[_0xb06c('0x15')]){if(_0xf8893d['error'][_0xb06c('0x16')]===0x1f4){logger['error'](_0xb06c('0x17'),_0x358273,_0xf8893d[_0xb06c('0x15')][_0xb06c('0x18')]);return _0xbb656b(_0xf8893d['error'][_0xb06c('0x18')]);}logger[_0xb06c('0x15')]('ChatGroup,\x20%s,\x20%s',_0x358273,_0xf8893d[_0xb06c('0x15')]['message']);return _0x48b995(_0xf8893d[_0xb06c('0x15')][_0xb06c('0x18')]);}else{logger['info'](_0xb06c('0x17'),_0x358273,_0xb06c('0x13'));_0x48b995(_0xf8893d[_0xb06c('0x19')]['message']);}})[_0xb06c('0x1a')](function(_0x33fdc2){logger['error'](_0xb06c('0x17'),_0x358273,_0x33fdc2);_0xbb656b(_0x33fdc2);});});} \ No newline at end of file +var _0xfcda=['message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2c7fd0,_0x304226){var _0x217b3f=function(_0x5c9ec1){while(--_0x5c9ec1){_0x2c7fd0['push'](_0x2c7fd0['shift']());}};_0x217b3f(++_0x304226);}(_0xfcda,0x198));var _0xafcd=function(_0x176d6e,_0x5a2d05){_0x176d6e=_0x176d6e-0x0;var _0x650fe6=_0xfcda[_0x176d6e];return _0x650fe6;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var moment=require('moment');var BPromise=require(_0xafcd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafcd('0x3'));var logger=require(_0xafcd('0x4'))(_0xafcd('0x5'));var config=require(_0xafcd('0x6'));var jayson=require(_0xafcd('0x7'));var client=jayson[_0xafcd('0x8')][_0xafcd('0x9')]({'port':0x232a});config['redis']=_[_0xafcd('0xa')](config['redis'],{'host':_0xafcd('0xb'),'port':0x18eb});var socket=require(_0xafcd('0xc'))(new Redis(config[_0xafcd('0xd')]));require(_0xafcd('0xe'))[_0xafcd('0xf')](socket);function respondWithRpcPromise(_0x33b666,_0x4911d6,_0x8fe535){return new BPromise(function(_0x358964,_0x3a0d5e){return client[_0xafcd('0x10')](_0x33b666,_0x8fe535)[_0xafcd('0x11')](function(_0x212159){logger[_0xafcd('0x12')](_0xafcd('0x13'),_0x4911d6,_0xafcd('0x14'));logger['debug'](_0xafcd('0x15'),_0x4911d6,_0xafcd('0x14'),JSON['stringify'](_0x212159));if(_0x212159[_0xafcd('0x16')]){if(_0x212159[_0xafcd('0x16')][_0xafcd('0x17')]===0x1f4){logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x212159['error']['message']);return _0x3a0d5e(_0x212159['error'][_0xafcd('0x18')]);}logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x212159['error'][_0xafcd('0x18')]);return _0x358964(_0x212159[_0xafcd('0x16')][_0xafcd('0x18')]);}else{logger[_0xafcd('0x12')](_0xafcd('0x13'),_0x4911d6,'request\x20sent');_0x358964(_0x212159[_0xafcd('0x19')]['message']);}})[_0xafcd('0x1a')](function(_0x3e6449){logger[_0xafcd('0x16')](_0xafcd('0x13'),_0x4911d6,_0x3e6449);_0x3a0d5e(_0x3e6449);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 0eed7a4..422320f 100644 --- a/server/api/chatGroup/chatGroup.socket.js +++ b/server/api/chatGroup/chatGroup.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fcf=['register','chatGroup:','./chatGroup.events','save','update','removeListener'];(function(_0x286706,_0x25669b){var _0x38d9dc=function(_0x53ab76){while(--_0x53ab76){_0x286706['push'](_0x286706['shift']());}};_0x38d9dc(++_0x25669b);}(_0x1fcf,0x92));var _0xf1fc=function(_0x5436c0,_0x45beac){_0x5436c0=_0x5436c0-0x0;var _0x51a455=_0x1fcf[_0x5436c0];return _0x51a455;};'use strict';var ChatGroupEvents=require(_0xf1fc('0x0'));var events=[_0xf1fc('0x1'),'remove',_0xf1fc('0x2')];function createListener(_0x3fee50,_0x40c7cd){return function(_0x1ca9f0){_0x40c7cd['emit'](_0x3fee50,_0x1ca9f0);};}function removeListener(_0x54c724,_0x1cbc09){return function(){ChatGroupEvents[_0xf1fc('0x3')](_0x54c724,_0x1cbc09);};}exports[_0xf1fc('0x4')]=function(_0x50153c){for(var _0x16ad11=0x0,_0x181215=events['length'];_0x16ad11<_0x181215;_0x16ad11++){var _0x2d281b=events[_0x16ad11];var _0x5a6db2=createListener(_0xf1fc('0x5')+_0x2d281b,_0x50153c);ChatGroupEvents['on'](_0x2d281b,_0x5a6db2);}}; \ No newline at end of file +var _0x7938=['emit','removeListener','register','chatGroup:','./chatGroup.events','save','update'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x7938,0x185));var _0x8793=function(_0x53d1b1,_0x3f83c0){_0x53d1b1=_0x53d1b1-0x0;var _0x5b977b=_0x7938[_0x53d1b1];return _0x5b977b;};'use strict';var ChatGroupEvents=require(_0x8793('0x0'));var events=[_0x8793('0x1'),'remove',_0x8793('0x2')];function createListener(_0xe7fefe,_0x2cec3c){return function(_0x4a12c8){_0x2cec3c[_0x8793('0x3')](_0xe7fefe,_0x4a12c8);};}function removeListener(_0x518d4c,_0xe44fef){return function(){ChatGroupEvents[_0x8793('0x4')](_0x518d4c,_0xe44fef);};}exports[_0x8793('0x5')]=function(_0x5a37c5){for(var _0x3adf72=0x0,_0x513439=events['length'];_0x3adf72<_0x513439;_0x3adf72++){var _0x278a42=events[_0x3adf72];var _0x1a89d1=createListener(_0x8793('0x6')+_0x278a42,_0x5a37c5);ChatGroupEvents['on'](_0x278a42,_0x1a89d1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 074d140..82c227c 100644 --- a/server/api/chatGroup/index.js +++ b/server/api/chatGroup/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3d7=['isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMessage','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get'];(function(_0x4de452,_0x53a80f){var _0x2a80ee=function(_0x10080e){while(--_0x10080e){_0x4de452['push'](_0x4de452['shift']());}};_0x2a80ee(++_0x53a80f);}(_0xb3d7,0xc1));var _0x7b3d=function(_0x5daaae,_0x44f0e1){_0x5daaae=_0x5daaae-0x0;var _0x35b780=_0xb3d7[_0x5daaae];return _0x35b780;};'use strict';var multer=require(_0x7b3d('0x0'));var util=require('util');var path=require(_0x7b3d('0x1'));var timeout=require(_0x7b3d('0x2'));var express=require(_0x7b3d('0x3'));var router=express[_0x7b3d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7b3d('0x5'));var interaction=require(_0x7b3d('0x6'));var config=require(_0x7b3d('0x7'));var controller=require(_0x7b3d('0x8'));router[_0x7b3d('0x9')]('/',auth[_0x7b3d('0xa')](),controller[_0x7b3d('0xb')]);router[_0x7b3d('0x9')](_0x7b3d('0xc'),auth[_0x7b3d('0xa')](),controller[_0x7b3d('0xd')]);router[_0x7b3d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7b3d('0xe')]);router[_0x7b3d('0x9')](_0x7b3d('0xf'),auth['isAuthenticated'](),controller[_0x7b3d('0x10')]);router[_0x7b3d('0x9')](_0x7b3d('0x11'),auth[_0x7b3d('0xa')](),controller[_0x7b3d('0x12')]);router[_0x7b3d('0x9')](_0x7b3d('0x13'),auth['isAuthenticated'](),controller[_0x7b3d('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b3d('0x15')]);router['post']('/:id/members',auth[_0x7b3d('0xa')](),controller['addMembers']);router[_0x7b3d('0x16')](_0x7b3d('0x13'),auth[_0x7b3d('0xa')](),controller[_0x7b3d('0x17')]);router[_0x7b3d('0x18')](_0x7b3d('0x19'),auth[_0x7b3d('0xa')](),controller[_0x7b3d('0x1a')]);router['delete'](_0x7b3d('0x19'),auth[_0x7b3d('0xa')](),controller['destroy']);router[_0x7b3d('0x1b')](_0x7b3d('0x11'),auth[_0x7b3d('0xa')](),controller['removeMembers']);module[_0x7b3d('0x1c')]=router; \ No newline at end of file +var _0xf2fb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','destroy','removeMembers','exports','multer','connect-timeout','express','fs-extra'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0xf2fb,0x86));var _0xbf2f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf2fb[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xbf2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbf2f('0x1'));var express=require(_0xbf2f('0x2'));var router=express['Router']();var fs_extra=require(_0xbf2f('0x3'));var auth=require(_0xbf2f('0x4'));var interaction=require(_0xbf2f('0x5'));var config=require(_0xbf2f('0x6'));var controller=require(_0xbf2f('0x7'));router[_0xbf2f('0x8')]('/',auth[_0xbf2f('0x9')](),controller['index']);router[_0xbf2f('0x8')]('/describe',auth[_0xbf2f('0x9')](),controller['describe']);router['get'](_0xbf2f('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xbf2f('0xb'),auth['isAuthenticated'](),controller[_0xbf2f('0xc')]);router[_0xbf2f('0x8')](_0xbf2f('0xd'),auth['isAuthenticated'](),controller[_0xbf2f('0xe')]);router[_0xbf2f('0x8')](_0xbf2f('0xf'),auth[_0xbf2f('0x9')](),controller[_0xbf2f('0x10')]);router[_0xbf2f('0x11')]('/',auth[_0xbf2f('0x9')](),controller['create']);router['post']('/:id/members',auth[_0xbf2f('0x9')](),controller[_0xbf2f('0x12')]);router[_0xbf2f('0x11')](_0xbf2f('0xf'),auth[_0xbf2f('0x9')](),controller[_0xbf2f('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xbf2f('0xa'),auth['isAuthenticated'](),controller[_0xbf2f('0x14')]);router['delete']('/:id/members',auth[_0xbf2f('0x9')](),controller[_0xbf2f('0x15')]);module[_0xbf2f('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e3735a9..434715f 100644 --- a/server/api/chatInteraction/chatInteraction.attributes.js +++ b/server/api/chatInteraction/chatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfff0=['STRING','long','DATE','ENUM','out','exports','BOOLEAN','INTEGER','star','thumb','TEXT'];(function(_0xd390d9,_0x5c122d){var _0x132919=function(_0x17765c){while(--_0x17765c){_0xd390d9['push'](_0xd390d9['shift']());}};_0x132919(++_0x5c122d);}(_0xfff0,0x139));var _0x0fff=function(_0x454bc0,_0x580a46){_0x454bc0=_0x454bc0-0x0;var _0x415eeb=_0xfff0[_0x454bc0];return _0x415eeb;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'closed':{'type':Sequelize[_0x0fff('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0fff('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x0fff('0x3'),_0x0fff('0x4')),'defaultValue':_0x0fff('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x0fff('0x5')]},'mailTranscript':{'type':Sequelize[_0x0fff('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0fff('0x6')]},'secondDisposition':{'type':Sequelize[_0x0fff('0x6')]},'thirdDisposition':{'type':Sequelize[_0x0fff('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x0fff('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x0fff('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x0fff('0x6')]},'deviceVendor':{'type':Sequelize[_0x0fff('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x0fff('0x5')]},'customerIp':{'type':Sequelize[_0x0fff('0x6')]},'formData':{'type':Sequelize[_0x0fff('0x5')](_0x0fff('0x7'))},'read1stAt':{'type':Sequelize[_0x0fff('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0fff('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0fff('0x9')]('in',_0x0fff('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0fff('0x6')]},'customerPort':{'type':Sequelize[_0x0fff('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x0fff('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3306=['exports','BOOLEAN','INTEGER','star','thumb','TEXT','DATE','STRING','long','ENUM','out','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3306,0x107));var _0x6330=function(_0x3cfda0,_0x4e01ce){_0x3cfda0=_0x3cfda0-0x0;var _0x431c78=_0x3306[_0x3cfda0];return _0x431c78;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'closed':{'type':Sequelize[_0x6330('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6330('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x6330('0x4'),_0x6330('0x5')),'defaultValue':_0x6330('0x4')},'ratingMessage':{'type':Sequelize[_0x6330('0x6')]},'pathTranscript':{'type':Sequelize[_0x6330('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6330('0x7')]},'disposition':{'type':Sequelize[_0x6330('0x8')]},'secondDisposition':{'type':Sequelize[_0x6330('0x8')]},'thirdDisposition':{'type':Sequelize[_0x6330('0x8')]},'note':{'type':Sequelize[_0x6330('0x8')]},'browserName':{'type':Sequelize[_0x6330('0x8')]},'browserVersion':{'type':Sequelize[_0x6330('0x8')]},'osName':{'type':Sequelize[_0x6330('0x8')]},'osVersion':{'type':Sequelize[_0x6330('0x8')]},'deviceModel':{'type':Sequelize[_0x6330('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x6330('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x6330('0x8')]},'formData':{'type':Sequelize[_0x6330('0x6')](_0x6330('0x9'))},'read1stAt':{'type':Sequelize[_0x6330('0x7')]},'lastMsgAt':{'type':Sequelize[_0x6330('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x6330('0xa')]('in',_0x6330('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6330('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x6330('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5f8654e..cd3085d 100644 --- a/server/api/chatInteraction/chatInteraction.controller.js +++ b/server/api/chatInteraction/chatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1e9=['map','ChatInteraction','type','key','findAll','query','user','show','rawAttributes','keys','filters','model','attributes','fields','length','includeAll','options','find','create','update','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','Contact','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','ChatOfflineMessageId','join','root','offline-chat/','basename','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','CmContact','Messages','%s%d','System','customer','ContactId','agentIdentifier','website_alias','agentAlias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','getMessages','intersection','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','merge','$gte','split','include','rows','getMyMessages','pick','includeAgent','push','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','attachments','firstName','read','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','direction','lastName','value','renderFile','transcript-','err','unlinkSync','rimraf','request-promise','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','then','destroy','stack','name','send','body','contact','agent','interaction','account'];(function(_0x53eeac,_0x4f9fb8){var _0xba17bc=function(_0x4ea620){while(--_0x4ea620){_0x53eeac['push'](_0x53eeac['shift']());}};_0xba17bc(++_0x4f9fb8);}(_0xa1e9,0x161));var _0x9a1e=function(_0x5d7b04,_0x13dec9){_0x5d7b04=_0x5d7b04-0x0;var _0x24d8db=_0xa1e9[_0x5d7b04];return _0x24d8db;};'use strict';var rimraf=require(_0x9a1e('0x0'));var zipdir=require('zip-dir');var rp=require(_0x9a1e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a1e('0x2'));var util=require(_0x9a1e('0x3'));var path=require(_0x9a1e('0x4'));var ejs=require(_0x9a1e('0x5'));var fs=require('fs');var _=require(_0x9a1e('0x6'));var Redis=require('ioredis');var interaction=require(_0x9a1e('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x9a1e('0x8'));var logger=require(_0x9a1e('0x9'))(_0x9a1e('0xa'));var config=require('../../config/environment');var db=require(_0x9a1e('0xb'))['db'];config[_0x9a1e('0xc')]=_['defaults'](config['redis'],{'host':_0x9a1e('0xd'),'port':0x18eb});var socket=require(_0x9a1e('0xe'))(new Redis(config[_0x9a1e('0xc')]));require('./chatInteraction.socket')[_0x9a1e('0xf')](socket);var jayson=require(_0x9a1e('0x10'));var client=jayson[_0x9a1e('0x11')][_0x9a1e('0x12')]({'port':0x232b});var client9004=jayson[_0x9a1e('0x11')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5b7339,_0x25198c,_0x22e9cb,_0x579c00){return new BPromise(function(_0x5346c6,_0x4ba7fa){var _0x4a7c0f=_0x579c00||client;return _0x4a7c0f[_0x9a1e('0x13')](_0x5b7339,_0x22e9cb)['then'](function(_0x3956f9){logger[_0x9a1e('0x14')](_0x9a1e('0x15'),_0x25198c,_0x9a1e('0x16'));logger['debug'](_0x9a1e('0x17'),_0x25198c,_0x9a1e('0x16'),JSON[_0x9a1e('0x18')](_0x3956f9));if(_0x3956f9[_0x9a1e('0x19')]){if(_0x3956f9['error'][_0x9a1e('0x1a')]===0x1f4){logger['error'](_0x9a1e('0x15'),_0x25198c,_0x3956f9['error'][_0x9a1e('0x1b')]);return _0x4ba7fa(_0x3956f9[_0x9a1e('0x19')][_0x9a1e('0x1b')]);}logger[_0x9a1e('0x19')](_0x9a1e('0x15'),_0x25198c,_0x3956f9['error']['message']);return _0x5346c6(_0x3956f9[_0x9a1e('0x19')][_0x9a1e('0x1b')]);}else{logger[_0x9a1e('0x14')](_0x9a1e('0x15'),_0x25198c,'request\x20sent');_0x5346c6(_0x3956f9[_0x9a1e('0x1c')][_0x9a1e('0x1b')]);}})[_0x9a1e('0x1d')](function(_0x4f2af8){logger[_0x9a1e('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x25198c,_0x4f2af8);_0x4ba7fa(_0x4f2af8);});});}function respondWithStatusCode(_0x3ff7be,_0x18e132){_0x18e132=_0x18e132||0xcc;return function(_0x29a9a9){if(_0x29a9a9){return _0x3ff7be[_0x9a1e('0x1e')](_0x18e132);}return _0x3ff7be[_0x9a1e('0x1f')](_0x18e132)[_0x9a1e('0x20')]();};}function respondWithResult(_0x48cec5,_0x435e60){_0x435e60=_0x435e60||0xc8;return function(_0x1f1544){if(_0x1f1544){return _0x48cec5[_0x9a1e('0x1f')](_0x435e60)['json'](_0x1f1544);}};}function respondWithFilteredResult(_0x9eb837,_0x5e3c8b){return function(_0x4fe985){if(_0x4fe985){var _0x1b24c6=typeof _0x5e3c8b['offset']===_0x9a1e('0x21')&&typeof _0x5e3c8b[_0x9a1e('0x22')]===_0x9a1e('0x21');var _0x2333aa=_0x4fe985[_0x9a1e('0x23')];var _0x55cacf=_0x1b24c6?0x0:_0x5e3c8b['offset'];var _0x56ae89=_0x1b24c6?_0x4fe985[_0x9a1e('0x23')]:_0x5e3c8b[_0x9a1e('0x24')]+_0x5e3c8b[_0x9a1e('0x22')];var _0x1c099c;if(_0x56ae89>=_0x2333aa){_0x56ae89=_0x2333aa;_0x1c099c=0xc8;}else{_0x1c099c=0xce;}_0x9eb837[_0x9a1e('0x1f')](_0x1c099c);return _0x9eb837['set'](_0x9a1e('0x25'),_0x55cacf+'-'+_0x56ae89+'/'+_0x2333aa)[_0x9a1e('0x26')](_0x4fe985);}return null;};}function saveUpdates(_0x4c4664){return function(_0x5266c6){if(_0x5266c6){return _0x5266c6['update'](_0x4c4664)[_0x9a1e('0x27')](function(_0x17704b){return _0x17704b;});}return null;};}function removeEntity(_0x448e14){return function(_0x4d08ab){if(_0x4d08ab){return _0x4d08ab[_0x9a1e('0x28')]()[_0x9a1e('0x27')](function(){_0x448e14['status'](0xcc)[_0x9a1e('0x20')]();});}};}function handleEntityNotFound(_0x51bd7c){return function(_0x579573){if(!_0x579573){_0x51bd7c[_0x9a1e('0x1e')](0x194);}return _0x579573;};}function handleError(_0x189454,_0x474414){_0x474414=_0x474414||0x1f4;return function(_0x3e51f8){logger[_0x9a1e('0x19')](_0x3e51f8[_0x9a1e('0x29')]);if(_0x3e51f8[_0x9a1e('0x2a')]){delete _0x3e51f8[_0x9a1e('0x2a')];}_0x189454[_0x9a1e('0x1f')](_0x474414)[_0x9a1e('0x2b')](_0x3e51f8);};}function getMustacheRender(_0x5226e0,_0x58e51a){return Mustache['render'](_0x5226e0,_['merge'](_0x58e51a[_0x9a1e('0x2c')],{'contact':_0x58e51a[_0x9a1e('0x2d')],'message':_0x58e51a[_0x9a1e('0x1b')],'agent':_0x58e51a[_0x9a1e('0x2e')],'interaction':_0x58e51a[_0x9a1e('0x2f')],'account':_0x58e51a[_0x9a1e('0x30')]}))||'';}exports['index']=function(_0x3bea3a,_0x1b8be3){var _0x2fb8a7={};var _0x35b91d=_[_0x9a1e('0x31')](db[_0x9a1e('0x32')]['rawAttributes'],function(_0x1e93ae){return{'name':_0x1e93ae['fieldName'],'type':_0x1e93ae[_0x9a1e('0x33')][_0x9a1e('0x34')]};});_0x2fb8a7=qs['getOptions'](_0x35b91d,_0x3bea3a);return interaction[_0x9a1e('0x35')]('chat',_0x3bea3a[_0x9a1e('0x36')],_0x3bea3a[_0x9a1e('0x37')],_0x2fb8a7,_0x35b91d)[_0x9a1e('0x27')](respondWithFilteredResult(_0x1b8be3,_0x2fb8a7))['catch'](handleError(_0x1b8be3,null));};exports[_0x9a1e('0x38')]=function(_0x5db8b4,_0x56c015){var _0x5bceac={'raw':![],'where':{'id':_0x5db8b4['params']['id']}},_0x18a585={};_0x18a585['model']=_['keys'](db[_0x9a1e('0x32')][_0x9a1e('0x39')]);_0x18a585[_0x9a1e('0x36')]=_[_0x9a1e('0x3a')](_0x5db8b4[_0x9a1e('0x36')]);_0x18a585[_0x9a1e('0x3b')]=_['intersection'](_0x18a585[_0x9a1e('0x3c')],_0x18a585[_0x9a1e('0x36')]);_0x5bceac[_0x9a1e('0x3d')]=_['intersection'](_0x18a585['model'],qs[_0x9a1e('0x3e')](_0x5db8b4[_0x9a1e('0x36')]['fields']));_0x5bceac[_0x9a1e('0x3d')]=_0x5bceac[_0x9a1e('0x3d')][_0x9a1e('0x3f')]?_0x5bceac[_0x9a1e('0x3d')]:_0x18a585['model'];if(_0x5db8b4['query'][_0x9a1e('0x40')]){_0x5bceac['include']=[{'all':!![]}];}_0x5bceac=_['merge']({},_0x5bceac,_0x5db8b4[_0x9a1e('0x41')]);return db['ChatInteraction'][_0x9a1e('0x42')](_0x5bceac)[_0x9a1e('0x27')](handleEntityNotFound(_0x56c015,null))['then'](respondWithResult(_0x56c015,null))[_0x9a1e('0x1d')](handleError(_0x56c015,null));};exports[_0x9a1e('0x43')]=function(_0x2c472d,_0x36e6e9){return db[_0x9a1e('0x32')]['create'](_0x2c472d[_0x9a1e('0x2c')],{})[_0x9a1e('0x27')](respondWithResult(_0x36e6e9,0xc9))['catch'](handleError(_0x36e6e9,null));};exports[_0x9a1e('0x44')]=function(_0x3c82d6,_0x54ad9a){if(_0x3c82d6['body']['id']){delete _0x3c82d6['body']['id'];}return db[_0x9a1e('0x32')][_0x9a1e('0x42')]({'where':{'id':_0x3c82d6[_0x9a1e('0x45')]['id']}})[_0x9a1e('0x27')](handleEntityNotFound(_0x54ad9a,null))[_0x9a1e('0x27')](saveUpdates(_0x3c82d6[_0x9a1e('0x2c')],null))[_0x9a1e('0x27')](respondWithResult(_0x54ad9a,null))[_0x9a1e('0x1d')](handleError(_0x54ad9a,null));};exports[_0x9a1e('0x28')]=function(_0x3ca0aa,_0x42cb43){return db[_0x9a1e('0x32')][_0x9a1e('0x42')]({'where':{'id':_0x3ca0aa['params']['id']}})[_0x9a1e('0x27')](handleEntityNotFound(_0x42cb43,null))[_0x9a1e('0x27')](removeEntity(_0x42cb43,null))['catch'](handleError(_0x42cb43,null));};exports[_0x9a1e('0x46')]=function(_0x592e38,_0x5e53b8){return db[_0x9a1e('0x32')][_0x9a1e('0x46')]()['then'](respondWithResult(_0x5e53b8,null))['catch'](handleError(_0x5e53b8,null));};exports[_0x9a1e('0x47')]=function(_0x1f8fcf,_0x264c49){var _0x16dc95=_0x1f8fcf[_0x9a1e('0x45')]['id'];var _0x45b717;var _0x57272b;var _0x311c57;return db[_0x9a1e('0x32')][_0x9a1e('0x48')]({'where':{'id':_0x16dc95}})[_0x9a1e('0x27')](function(_0x2910f7){_0x45b717=_0x2910f7;return db[_0x9a1e('0x49')]['findOne']({'where':{'id':_0x2910f7[_0x9a1e('0x4a')]},'attributes':['id',_0x9a1e('0x4b'),'vidaooEscalation','vidaooTopic',_0x9a1e('0x4c'),_0x9a1e('0x4d')],'raw':!![]});})['then'](function(_0x1a560c){if(_0x1a560c&&_0x1a560c[_0x9a1e('0x4b')]&&_0x1a560c[_0x9a1e('0x4e')]){_0x57272b=_0x1a560c;var _0x190b9d={'interaction':{'id':_0x16dc95},'agent':{'id':_0x1f8fcf[_0x9a1e('0x37')]['id'],'name':_0x1f8fcf[_0x9a1e('0x37')][_0x9a1e('0x2a')],'fullname':_0x1f8fcf[_0x9a1e('0x37')][_0x9a1e('0x4f')],'email':_0x1f8fcf[_0x9a1e('0x37')][_0x9a1e('0x50')]},'contact':_0x1f8fcf[_0x9a1e('0x2c')][_0x9a1e('0x2d')],'account':_0x1f8fcf['body']['account']};var _0x427038={'rejectUnauthorized':![],'method':_0x9a1e('0x51'),'url':_0x9a1e('0x52'),'headers':{'X-APIKEY':_0x1a560c['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1f8fcf[_0x9a1e('0x37')][_0x9a1e('0x50')]],'buttons':null,'topic':_0x57272b[_0x9a1e('0x53')],'note':_[_0x9a1e('0x54')](_0x57272b['vidaooNote'])?null:getMustacheRender(_0x57272b[_0x9a1e('0x4c')],_0x190b9d),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x57272b[_0x9a1e('0x4d')])){var _0x4752a7=getMustacheRender(_0x57272b[_0x9a1e('0x4d')],_0x190b9d);var _0x48b674=JSON[_0x9a1e('0x55')](_0x4752a7);_0x427038['body'][_0x9a1e('0x56')]=_0x48b674;}}catch(_0x50c9f4){throw new db[(_0x9a1e('0x57'))][(_0x9a1e('0x58'))](_0x9a1e('0x59'));}return rp(_0x427038);}else{throw new db['Sequelize'][(_0x9a1e('0x58'))](_0x9a1e('0x5a'));}})[_0x9a1e('0x27')](function(_0x5bf716){_0x311c57=_0x5bf716;if(_0x311c57['id']){var _0x40cc86={'body':_0x311c57[_0x9a1e('0x5b')],'ChatWebsiteId':_0x57272b['id'],'ChatInteractionId':_0x45b717['id'],'direction':_0x9a1e('0x5c'),'UserId':_0x1f8fcf[_0x9a1e('0x37')]['id']};return db[_0x9a1e('0x5d')][_0x9a1e('0x43')](_0x40cc86,{});}else{throw new db['Sequelize'][(_0x9a1e('0x58'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x9a1e('0x27')](function(){return _0x45b717[_0x9a1e('0x5e')]({'vidaooSessionId':_0x311c57['id']});})[_0x9a1e('0x27')](respondWithResult(_0x264c49,null))['catch'](handleError(_0x264c49,null));};exports[_0x9a1e('0x5f')]=function(_0x585022,_0x216abf){if(_0x585022[_0x9a1e('0x2c')]['id']){delete _0x585022[_0x9a1e('0x2c')]['id'];}return db['ChatInteraction'][_0x9a1e('0x42')]({'where':{'id':_0x585022[_0x9a1e('0x45')]['id']},'include':[{'model':db['CmContact'],'as':_0x9a1e('0x60')}]})[_0x9a1e('0x27')](handleEntityNotFound(_0x216abf,null))[_0x9a1e('0x27')](saveUpdates(_0x585022[_0x9a1e('0x2c')],null))['then'](respondWithResult(_0x216abf,null))[_0x9a1e('0x1d')](handleError(_0x216abf,null));};exports[_0x9a1e('0x61')]=function(_0x33c269,_0x262e91){if(_0x33c269[_0x9a1e('0x2c')]['id']){delete _0x33c269[_0x9a1e('0x2c')]['id'];}return db[_0x9a1e('0x32')][_0x9a1e('0x42')]({'where':{'id':_0x33c269[_0x9a1e('0x45')]['id']}})['then'](function(_0x2df7e5){if(!_0x2df7e5){logger[_0x9a1e('0x19')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x9a1e('0x61'),0x194,_0x9a1e('0x62'));_0x262e91['sendStatus'](0x194);}else{if(_0x2df7e5[_0x9a1e('0x63')]){throw new db[(_0x9a1e('0x57'))][(_0x9a1e('0x58'))]('Interaction\x20already\x20assigned');}}return _0x2df7e5;})['then'](function(_0x13579f){if(_0x13579f){return _0x13579f[_0x9a1e('0x44')]({'closed':_0x33c269['body'][_0x9a1e('0x64')],'disposition':_0x33c269[_0x9a1e('0x2c')][_0x9a1e('0x65')]})[_0x9a1e('0x27')](function(_0x54448b){return _0x54448b;});}})[_0x9a1e('0x27')](function(){return respondWithRpcPromise(_0x9a1e('0x66'),'abandon',_0x33c269[_0x9a1e('0x2c')],client9004);})['then'](respondWithResult(_0x262e91,null))[_0x9a1e('0x1d')](handleError(_0x262e91,null));};exports[_0x9a1e('0x67')]=function(_0x3409d6,_0x432613){_0x3409d6[_0x9a1e('0x2c')][_0x9a1e('0x2a')]=_0x3409d6[_0x9a1e('0x68')][_0x9a1e('0x69')];_0x3409d6[_0x9a1e('0x2c')]['basename']=_0x3409d6['file'][_0x9a1e('0x6a')];_0x3409d6[_0x9a1e('0x2c')][_0x9a1e('0x33')]=_0x3409d6['file'][_0x9a1e('0x6b')];return db[_0x9a1e('0x6c')][_0x9a1e('0x43')](_0x3409d6[_0x9a1e('0x2c')])[_0x9a1e('0x27')](respondWithResult(_0x432613,0xc9))[_0x9a1e('0x1d')](handleError(_0x432613,null));};exports[_0x9a1e('0x6d')]=function(_0x6d93a1,_0x572a86){return db['ChatInteraction']['findOne']({'where':{'id':_0x6d93a1['params']['id']},'raw':!![]})[_0x9a1e('0x27')](handleEntityNotFound(_0x572a86,null))[_0x9a1e('0x27')](function(_0x5c23cc){if(_0x5c23cc){if(_0x5c23cc[_0x9a1e('0x64')]){return _0x572a86[_0x9a1e('0x1f')](0x193)[_0x9a1e('0x26')]({'status':0x193,'message':'Unauthorized'});}return db[_0x9a1e('0x6c')]['findOne']({'where':{'id':_0x6d93a1[_0x9a1e('0x36')]['attachId']},'raw':!![]})[_0x9a1e('0x27')](handleEntityNotFound(_0x572a86,null));}})[_0x9a1e('0x27')](function(_0x56c777){if(_0x56c777){var _0x3b3a41=_0x56c777[_0x9a1e('0x6e')]!==null;var _0x2773cf=path[_0x9a1e('0x6f')](config[_0x9a1e('0x70')],'server/files/attachments/');if(_0x3b3a41){_0x2773cf=path['join'](_0x2773cf,_0x9a1e('0x71'));}var _0x5b1cc6=path['join'](_0x2773cf,_0x56c777[_0x9a1e('0x72')]);return _0x572a86['download'](_0x5b1cc6);}})[_0x9a1e('0x1d')](handleError(_0x572a86,null));};exports[_0x9a1e('0x73')]=function(_0x556431,_0x294505){var _0x3a0ee5=null;var _0x41134a=null;var _0x130e6f=null;if(_0x556431['body']['id']){delete _0x556431[_0x9a1e('0x2c')]['id'];}if(_0x556431[_0x9a1e('0x2c')][_0x9a1e('0x74')]){_0x130e6f=path[_0x9a1e('0x6f')](config[_0x9a1e('0x70')],_0x9a1e('0x75'),util[_0x9a1e('0x76')](_0x9a1e('0x77'),Date[_0x9a1e('0x78')]()));_0x556431['body'][_0x9a1e('0x79')]=_0x130e6f;}return db['ChatInteraction'][_0x9a1e('0x42')]({'where':{'id':_0x556431[_0x9a1e('0x45')]['id']},'include':[{'model':db[_0x9a1e('0x5d')],'as':'Messages','include':[{'model':db[_0x9a1e('0x7a')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x294505,null))[_0x9a1e('0x27')](saveUpdates(_0x556431[_0x9a1e('0x2c')],null))[_0x9a1e('0x27')](function(_0x4e069d){if(_0x4e069d){_0x3a0ee5=_0x4e069d;return db[_0x9a1e('0x49')][_0x9a1e('0x42')]({'where':{'id':_0x3a0ee5[_0x9a1e('0x4a')]}});}})[_0x9a1e('0x27')](function(_0x3f64c0){if(_0x3f64c0){_0x41134a=_0x3f64c0;return db[_0x9a1e('0x7b')][_0x9a1e('0x42')]({'where':{'id':_0x3a0ee5['ContactId']}});}})[_0x9a1e('0x27')](function(_0x1334da){if(_0x1334da){if(_0x130e6f){var _0x117be4=null;for(var _0x20788e=0x1;_0x20788e<_0x3a0ee5[_0x9a1e('0x7c')][_0x9a1e('0x3f')];++_0x20788e){_0x117be4=_0x3a0ee5[_0x9a1e('0x7c')][_0x20788e];var _0xdd5b59=_0x117be4['UserId']?util[_0x9a1e('0x76')](_0x9a1e('0x7d'),_0x41134a['agentAlias'],_0x117be4[_0x9a1e('0x63')]):_0x9a1e('0x7e');var _0x4bd341=_0x556431[_0x9a1e('0x2c')][_0x9a1e('0x7f')]||util['format'](_0x9a1e('0x7d'),'Visitor',_0x117be4[_0x9a1e('0x80')]);switch(_0x41134a[_0x9a1e('0x81')]){case _0x9a1e('0x82'):_0xdd5b59=_0x117be4[_0x9a1e('0x63')]?util[_0x9a1e('0x76')](_0x9a1e('0x7d'),_0x41134a[_0x9a1e('0x83')],_0x117be4[_0x9a1e('0x63')]):'System';break;case'agent_alias':_0xdd5b59=_0x117be4[_0x9a1e('0x63')]?_0x117be4[_0x9a1e('0x7a')][_0x9a1e('0x84')]||_0x117be4[_0x9a1e('0x7a')]['fullname']:_0x9a1e('0x7e');break;case'agent_fullname':_0xdd5b59=_0x117be4[_0x9a1e('0x63')]?_0x117be4[_0x9a1e('0x7a')][_0x9a1e('0x4f')]:_0x9a1e('0x7e');break;default:_0xdd5b59=_0x117be4['UserId']?util['format'](_0x9a1e('0x7d'),_0x41134a[_0x9a1e('0x83')],_0x117be4['UserId']):_0x9a1e('0x7e');}var _0x42ff58=util[_0x9a1e('0x76')](_0x9a1e('0x85'),moment(_0x117be4[_0x9a1e('0x86')])['format'](_0x9a1e('0x87')),_0x117be4['direction']==='in'?_0x4bd341:_0xdd5b59,_0x117be4[_0x9a1e('0x2c')]);if(!_0x117be4[_0x9a1e('0x88')]){fs[_0x9a1e('0x89')](_0x130e6f,_0x42ff58);}}return db[_0x9a1e('0x8a')][_0x9a1e('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0x9a1e('0x8b')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x13cb74){if(!_0x13cb74||!_0x13cb74[_0x9a1e('0x8c')]||!_0x556431[_0x9a1e('0x2c')])return _0x3a0ee5;var _0x6ab296=_0x13cb74['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x6ab296,'message':{'from':util[_0x9a1e('0x76')](_0x9a1e('0x8d'),_0x13cb74[_0x9a1e('0x2a')],_0x13cb74[_0x9a1e('0x50')]||_0x13cb74[_0x9a1e('0x8c')]['user']),'to':_0x556431['body'][_0x9a1e('0x74')],'subject':_0x9a1e('0x8e'),'text':util[_0x9a1e('0x76')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x556431[_0x9a1e('0x2c')][_0x9a1e('0x74')]),'attachments':[{'path':_0x130e6f}]}})[_0x9a1e('0x27')](function(){return _0x3a0ee5;})['catch'](function(_0x3a8556){logger[_0x9a1e('0x19')](_0x3a8556);});})[_0x9a1e('0x27')](respondWithStatusCode(_0x294505,0xc8))[_0x9a1e('0x1d')](handleError(_0x294505,null));};exports[_0x9a1e('0x8f')]=function(_0x28a43a,_0x5e570b){return db[_0x9a1e('0x5d')][_0x9a1e('0x42')]({'where':{'id':_0x28a43a[_0x9a1e('0x45')]['id']}})[_0x9a1e('0x27')](handleEntityNotFound(_0x5e570b,null))[_0x9a1e('0x27')](function(_0x4d5bc0){if(_0x4d5bc0){return _0x4d5bc0['addMessage'](_0x28a43a['body'][_0x9a1e('0x90')],_['omit'](_0x28a43a['body'],[_0x9a1e('0x90'),'id'])||{});}})[_0x9a1e('0x27')](respondWithResult(_0x5e570b,null))[_0x9a1e('0x1d')](handleError(_0x5e570b,null));};exports[_0x9a1e('0x91')]=function(_0x2d367a,_0xd4b717){var _0x21e6ec={'raw':![],'where':{}};var _0x4a8fd8={};var _0x2f1253={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9a1e('0x48')]({'where':{'id':_0x2d367a[_0x9a1e('0x45')]['id']}})[_0x9a1e('0x27')](handleEntityNotFound(_0xd4b717,null))[_0x9a1e('0x27')](function(_0x5e76e0){if(_0x5e76e0){_0x4a8fd8[_0x9a1e('0x3c')]=_['keys'](db[_0x9a1e('0x5d')][_0x9a1e('0x39')]);_0x4a8fd8['query']=_[_0x9a1e('0x3a')](_0x2d367a[_0x9a1e('0x36')]);_0x4a8fd8[_0x9a1e('0x3b')]=_[_0x9a1e('0x92')](_0x4a8fd8[_0x9a1e('0x3c')],_0x4a8fd8[_0x9a1e('0x36')]);_0x21e6ec[_0x9a1e('0x3d')]=_[_0x9a1e('0x92')](_0x4a8fd8[_0x9a1e('0x3c')],qs[_0x9a1e('0x3e')](_0x2d367a['query'][_0x9a1e('0x3e')]));_0x21e6ec[_0x9a1e('0x3d')]=_0x21e6ec[_0x9a1e('0x3d')][_0x9a1e('0x3f')]?_0x21e6ec[_0x9a1e('0x3d')]:_0x4a8fd8[_0x9a1e('0x3c')];if(!_0x2d367a['query'][_0x9a1e('0x93')](_0x9a1e('0x94'))){_0x21e6ec['limit']=qs['limit'](_0x2d367a[_0x9a1e('0x36')][_0x9a1e('0x22')]);_0x21e6ec[_0x9a1e('0x24')]=qs[_0x9a1e('0x24')](_0x2d367a[_0x9a1e('0x36')][_0x9a1e('0x24')]);}_0x21e6ec[_0x9a1e('0x95')]=qs['sort'](_0x2d367a['query'][_0x9a1e('0x96')]);_0x21e6ec[_0x9a1e('0x97')]=qs[_0x9a1e('0x3b')](_['pick'](_0x2d367a[_0x9a1e('0x36')],_0x4a8fd8[_0x9a1e('0x3b')]));_0x21e6ec[_0x9a1e('0x97')][_0x9a1e('0x98')]=_0x5e76e0['id'];if(_0x2d367a[_0x9a1e('0x36')][_0x9a1e('0x99')]){_0x21e6ec[_0x9a1e('0x97')]=_[_0x9a1e('0x9a')](_0x21e6ec[_0x9a1e('0x97')],{'$or':_['map'](_0x21e6ec[_0x9a1e('0x3d')],function(_0x542ff8){var _0xb516e7={};_0xb516e7[_0x542ff8]={'$like':'%'+_0x2d367a[_0x9a1e('0x36')][_0x9a1e('0x99')]+'%'};return _0xb516e7;})});}if(_0x2d367a[_0x9a1e('0x36')][_0x9a1e('0x9b')]){var _0x257f76=_0x2d367a[_0x9a1e('0x36')][_0x9a1e('0x9b')][_0x9a1e('0x9c')](',');var _0x30e207={};_0x30e207[_0x257f76[0x0]]={'$gte':moment(_0x257f76[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x21e6ec[_0x9a1e('0x97')]=_[_0x9a1e('0x9a')](_0x21e6ec[_0x9a1e('0x97')],_0x30e207);}_0x21e6ec=_[_0x9a1e('0x9a')]({},_0x21e6ec,_0x2d367a['options']);return db[_0x9a1e('0x5d')][_0x9a1e('0x23')]({'where':_0x21e6ec[_0x9a1e('0x97')]})[_0x9a1e('0x27')](function(_0x3f0618){_0x2f1253[_0x9a1e('0x23')]=_0x3f0618;if(_0x2d367a['query'][_0x9a1e('0x40')]){_0x21e6ec[_0x9a1e('0x9d')]=[{'all':!![]}];}return db[_0x9a1e('0x5d')]['findAll'](_0x21e6ec);})[_0x9a1e('0x27')](function(_0x28e34d){_0x2f1253[_0x9a1e('0x9e')]=_0x28e34d;return _0x2f1253;});}})[_0x9a1e('0x27')](respondWithFilteredResult(_0xd4b717,_0x21e6ec))[_0x9a1e('0x1d')](handleError(_0xd4b717,null));};exports[_0x9a1e('0x9f')]=function(_0x3bb298,_0x1bd767){var _0x2918b5={'where':{}},_0x243493={},_0x17bfd9={'count':0x0,'rows':[]};return db[_0x9a1e('0x32')]['findOne']({'where':{'id':_0x3bb298[_0x9a1e('0x45')]['id']}})[_0x9a1e('0x27')](handleEntityNotFound(_0x1bd767,null))[_0x9a1e('0x27')](function(_0x18f857){if(_0x18f857){_0x243493[_0x9a1e('0x3c')]=_['keys'](db[_0x9a1e('0x5d')][_0x9a1e('0x39')]);_0x243493[_0x9a1e('0x36')]=_['keys'](_0x3bb298[_0x9a1e('0x36')]);_0x243493['filters']=_['intersection'](_0x243493[_0x9a1e('0x3c')],_0x243493[_0x9a1e('0x36')]);_0x2918b5[_0x9a1e('0x3d')]=_['intersection'](_0x243493[_0x9a1e('0x3c')],qs[_0x9a1e('0x3e')](_0x3bb298[_0x9a1e('0x36')][_0x9a1e('0x3e')]));_0x2918b5[_0x9a1e('0x3d')]=_0x2918b5[_0x9a1e('0x3d')][_0x9a1e('0x3f')]?_0x2918b5[_0x9a1e('0x3d')]:_0x243493[_0x9a1e('0x3c')];if(!_0x3bb298['query'][_0x9a1e('0x93')](_0x9a1e('0x94'))){_0x2918b5['limit']=qs[_0x9a1e('0x22')](_0x3bb298['query'][_0x9a1e('0x22')]);_0x2918b5[_0x9a1e('0x24')]=qs[_0x9a1e('0x24')](_0x3bb298[_0x9a1e('0x36')]['offset']);}_0x2918b5[_0x9a1e('0x95')]=qs[_0x9a1e('0x96')](_0x3bb298[_0x9a1e('0x36')][_0x9a1e('0x96')]);_0x2918b5['where']=qs[_0x9a1e('0x3b')](_[_0x9a1e('0xa0')](_0x3bb298[_0x9a1e('0x36')],_0x243493[_0x9a1e('0x3b')]));_0x2918b5['where'][_0x9a1e('0x98')]=_0x18f857['id'];if(_0x3bb298[_0x9a1e('0x36')][_0x9a1e('0x99')]){_0x2918b5[_0x9a1e('0x97')]=_['merge'](_0x2918b5[_0x9a1e('0x97')],{'$or':_['map'](_0x2918b5['attributes'],function(_0x5857ee){var _0x727fb5={};_0x727fb5[_0x5857ee]={'$like':'%'+_0x3bb298[_0x9a1e('0x36')]['filter']+'%'};return _0x727fb5;})});}_0x2918b5[_0x9a1e('0x97')]['secret']=![];if(_0x3bb298[_0x9a1e('0x36')]['id']){_0x2918b5[_0x9a1e('0x97')]['id']={'$gt':_0x3bb298[_0x9a1e('0x36')]['id']};}_0x2918b5=_[_0x9a1e('0x9a')]({},_0x2918b5,_0x3bb298[_0x9a1e('0x41')]);return db[_0x9a1e('0x5d')][_0x9a1e('0x23')]({'where':_0x2918b5[_0x9a1e('0x97')]})['then'](function(_0x2d5268){_0x17bfd9[_0x9a1e('0x23')]=_0x2d5268;_0x2918b5[_0x9a1e('0x9d')]=[];if(_0x3bb298['query'][_0x9a1e('0xa1')]){_0x2918b5[_0x9a1e('0x9d')][_0x9a1e('0xa2')]({'model':db['User'],'as':_0x9a1e('0x7a'),'attributes':['id','fullname',_0x9a1e('0x84')]});}if(_0x3bb298[_0x9a1e('0x36')][_0x9a1e('0x40')]){_0x2918b5[_0x9a1e('0x9d')]=[{'all':!![]}];}return db[_0x9a1e('0x5d')]['findAll'](_0x2918b5);})[_0x9a1e('0x27')](function(_0x3c890a){_0x17bfd9[_0x9a1e('0x9e')]=_0x3c890a;return _0x17bfd9;});}})[_0x9a1e('0x27')](respondWithFilteredResult(_0x1bd767,_0x2918b5))[_0x9a1e('0x1d')](handleError(_0x1bd767,null));};exports[_0x9a1e('0xa3')]=function(_0x512b4f,_0x4dc634){return db['ChatInteraction']['find']({'where':{'id':_0x512b4f[_0x9a1e('0x45')]['id']}})[_0x9a1e('0x27')](handleEntityNotFound(_0x4dc634,null))[_0x9a1e('0x27')](function(_0x3291cc){if(_0x3291cc){return _0x3291cc['setTags'](_0x512b4f[_0x9a1e('0x2c')]['ids'],_['omit'](_0x512b4f[_0x9a1e('0x2c')],['ids','id'])||{})[_0x9a1e('0xa4')](function(){return db[_0x9a1e('0xa5')]['findAll']({'attributes':['id','name',_0x9a1e('0xa6')],'where':{'id':_0x512b4f[_0x9a1e('0x2c')][_0x9a1e('0x90')]}});})[_0x9a1e('0x27')](function(_0x440c47){socket[_0x9a1e('0xa7')](_0x9a1e('0xa8'),{'id':Number(_0x512b4f[_0x9a1e('0x45')]['id']),'tags':_0x440c47||[]});return{'id':Number(_0x512b4f[_0x9a1e('0x45')]['id']),'tags':_0x440c47||[]};});}})[_0x9a1e('0x27')](respondWithResult(_0x4dc634,null))[_0x9a1e('0x1d')](handleError(_0x4dc634,null));};exports[_0x9a1e('0xa9')]=function(_0x24be31,_0x258e06){return db[_0x9a1e('0x32')][_0x9a1e('0x42')]({'where':{'id':_0x24be31['params']['id']}})[_0x9a1e('0x27')](handleEntityNotFound(_0x258e06,null))['then'](function(_0x470968){if(_0x470968){return _0x470968[_0x9a1e('0xa9')](_0x24be31[_0x9a1e('0x36')]['ids']);}})[_0x9a1e('0x27')](respondWithStatusCode(_0x258e06,null))[_0x9a1e('0x1d')](handleError(_0x258e06,null));};exports[_0x9a1e('0xaa')]=function(_0x2afad7,_0x5036b2){var _0x12268f=moment()[_0x9a1e('0xab')]()[_0x9a1e('0xac')]();var _0x60e9c2=path[_0x9a1e('0x6f')](config[_0x9a1e('0x70')],_0x9a1e('0xad'),_0x9a1e('0xae'),_0x9a1e('0xaf'));var _0x140635=path[_0x9a1e('0x6f')](config[_0x9a1e('0x70')],_0x9a1e('0xad'),'files',_0x9a1e('0xb0'));var _0x5dccbe=path[_0x9a1e('0x6f')](_0x60e9c2,_0x12268f);var _0x4ad083=util[_0x9a1e('0x76')]('transcript-%d-%s.zip',_0x2afad7[_0x9a1e('0x45')]['id'],_0x12268f);var _0x1b8771=path['join'](_0x60e9c2,_0x4ad083);var _0x152d65=[];_0x152d65['push']({'model':db['User'],'as':_0x9a1e('0x7a'),'attributes':['id',_0x9a1e('0x4f')],'raw':!![]});_0x152d65[_0x9a1e('0xa2')]({'model':db[_0x9a1e('0x7b')],'as':'Contact','attributes':['id',_0x9a1e('0xb1'),'lastName'],'raw':!![]});if(_0x2afad7['query']['attachments']){_0x152d65[_0x9a1e('0xa2')]({'model':db[_0x9a1e('0x6c')],'as':'Attachment','raw':!![]});}var _0x448847=[{'model':db['ChatMessage'],'as':_0x9a1e('0x7c'),'attributes':['id',_0x9a1e('0x2c'),_0x9a1e('0x86'),'direction',_0x9a1e('0x88'),_0x9a1e('0xb2')],'include':_0x152d65}];_0x448847[_0x9a1e('0xa2')]({'model':db[_0x9a1e('0x49')],'as':_0x9a1e('0xb3'),'attributes':['id',_0x9a1e('0x2a')]});_0x448847[_0x9a1e('0xa2')]({'model':db[_0x9a1e('0x7a')],'as':_0x9a1e('0xb4'),'attributes':['id',_0x9a1e('0x4f')]});return db[_0x9a1e('0x32')][_0x9a1e('0x42')]({'where':{'id':_0x2afad7[_0x9a1e('0x45')]['id']},'include':_0x448847})[_0x9a1e('0x27')](handleEntityNotFound(_0x5036b2,null))[_0x9a1e('0x27')](function(_0x57e8a8){if(_0x57e8a8){var _0x3d85c7=_0x57e8a8['get']({'plain':!![]});fs[_0x9a1e('0xb5')](_0x5dccbe);var _0x44bbe9={'channel':_0x9a1e('0xb6'),'account':_0x3d85c7[_0x9a1e('0xb3')][_0x9a1e('0x2a')],'agent':_0x3d85c7[_0x9a1e('0xb4')]?_0x3d85c7[_0x9a1e('0xb4')][_0x9a1e('0x4f')]:_0x9a1e('0xb7'),'createdAt':moment(_0x3d85c7[_0x9a1e('0x86')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9a1e('0xac')](),'closedAt':_0x3d85c7[_0x9a1e('0x64')]?moment(_0x3d85c7['closedAt'])[_0x9a1e('0x76')](_0x9a1e('0xb8'))[_0x9a1e('0xac')]():'','disposition':_0x3d85c7[_0x9a1e('0x65')],'chatInfo':{'browser':_0x3d85c7[_0x9a1e('0xb9')],'os':_0x3d85c7[_0x9a1e('0xba')],'referer':_0x3d85c7[_0x9a1e('0xbb')],'customerIp':_0x3d85c7['customerIp'],'customerPort':_0x3d85c7[_0x9a1e('0xbc')]?_0x3d85c7['customerPort']:_0x9a1e('0xb7')},'messages':_(_0x3d85c7['Messages'])[_0x9a1e('0xbd')]()[_0x9a1e('0x99')]({'secret':![]})[_0x9a1e('0x31')](function(_0x2b62ad){if(_0x2b62ad[_0x9a1e('0x6c')]){var _0x1ab696=path[_0x9a1e('0x6f')](_0x140635,_0x2b62ad['Attachment'][_0x9a1e('0x72')]);if(fs[_0x9a1e('0xbe')](_0x1ab696)){fs[_0x9a1e('0xbf')](_0x1ab696)[_0x9a1e('0xc0')](fs[_0x9a1e('0xc1')](path[_0x9a1e('0x6f')](_0x5dccbe,_0x2b62ad[_0x9a1e('0x6c')]['basename'])));}}return{'date':moment(_0x2b62ad[_0x9a1e('0x86')])['format'](_0x9a1e('0xb8'))[_0x9a1e('0xac')](),'sender':_0x2b62ad[_0x9a1e('0xc2')]===_0x9a1e('0x5c')?_0x2b62ad[_0x9a1e('0x7a')]?_0x2b62ad[_0x9a1e('0x7a')][_0x9a1e('0x4f')]:_0x9a1e('0x7e'):_0x2b62ad['Contact'][_0x9a1e('0xb1')]+(_0x2b62ad[_0x9a1e('0x60')]['lastName']?'\x20'+_0x2b62ad[_0x9a1e('0x60')][_0x9a1e('0xc3')]:''),'body':_0x2b62ad[_0x9a1e('0x6c')]?_0x2b62ad[_0x9a1e('0x6c')]['basename']:_0x2b62ad[_0x9a1e('0x2c')],'direction':_0x2b62ad[_0x9a1e('0xc2')]==='out'?'A':'C','secret':_0x2b62ad[_0x9a1e('0x88')],'read':_0x2b62ad['read'],'attachment':_0x2b62ad[_0x9a1e('0x6c')]};})[_0x9a1e('0xc4')]()};return ejs[_0x9a1e('0xc5')](path[_0x9a1e('0x6f')](config[_0x9a1e('0x70')],_0x9a1e('0xad'),'views','downloadInteraction.ejs'),{'interaction':_0x44bbe9})[_0x9a1e('0x27')](function(_0x456e04){var _0x250322=path['join'](_0x5dccbe,_0x9a1e('0xc6')+_0x3d85c7['id']+'-'+_0x12268f+'.pdf');var _0x21d1e2={'path':_0x250322,'channel':_0x9a1e('0xb6'),'interactionId':_0x3d85c7['id']};return pdf['createPdfFromHTML'](_0x456e04,_0x21d1e2);})[_0x9a1e('0x27')](function(){return new Promise(function(_0x183584,_0x11f3fe){zipdir(_0x5dccbe,{'saveTo':_0x1b8771},function(_0x923ce5,_0x2f0205){if(_0x923ce5)return _0x11f3fe(_0x923ce5);return _0x183584(_0x2f0205);});})[_0x9a1e('0x27')](function(){return new BPromise(function(_0x4a1aeb,_0x4b8b3a){rimraf(_0x5dccbe,function(_0x5789c0){if(_0x5789c0)_0x4b8b3a(_0x5789c0);return _0x4a1aeb();});});})[_0x9a1e('0x27')](function(){return _0x5036b2[_0x9a1e('0xaa')](_0x1b8771,_0x4ad083,function(_0x221752){if(_0x221752){logger[_0x9a1e('0x19')](_0x9a1e('0xc7'),_0x221752);}else{fs[_0x9a1e('0xc8')](_0x1b8771);}});});});}else{return _0x5036b2[_0x9a1e('0x1e')](0xc8);}})[_0x9a1e('0x1d')](handleError(_0x5036b2,null));}; \ No newline at end of file +var _0x5c7b=['Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','format','transcript-%s.txt','now','ChatMessage','Messages','User','CmContact','ContactId','UserId','%s%d','agentAlias','customer','agentIdentifier','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','include','rows','getMyMessages','ChatInteractionId','secret','includeAgent','push','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','Contact','firstName','lastName','attachments','createdAt','read','Owner','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','customerIp','customerPort','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','http','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','end','json','undefined','count','offset','limit','status','set','Content-Range','update','destroy','sendStatus','name','send','render','merge','contact','agent','index','map','rawAttributes','fieldName','type','getOptions','findAll','chat','query','then','show','params','model','keys','ChatInteraction','filters','attributes','intersection','fields','includeAll','options','create','body','find','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','user','fullname','email','account','POST','isNull','follow','vidaooMetadata','parse','metadata'];(function(_0x511ff0,_0x5f7232){var _0x5ddae4=function(_0x2bc913){while(--_0x2bc913){_0x511ff0['push'](_0x511ff0['shift']());}};_0x5ddae4(++_0x5f7232);}(_0x5c7b,0x6f));var _0xb5c7=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5c7b[_0x36eaaa];return _0x461349;};'use strict';var rimraf=require(_0xb5c7('0x0'));var zipdir=require(_0xb5c7('0x1'));var rp=require(_0xb5c7('0x2'));var moment=require(_0xb5c7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb5c7('0x4'));var util=require('util');var path=require(_0xb5c7('0x5'));var ejs=require(_0xb5c7('0x6'));var fs=require('fs');var _=require(_0xb5c7('0x7'));var Redis=require(_0xb5c7('0x8'));var interaction=require(_0xb5c7('0x9'));var qs=require(_0xb5c7('0xa'));var pdf=require(_0xb5c7('0xb'));var logger=require(_0xb5c7('0xc'))('api');var config=require(_0xb5c7('0xd'));var db=require(_0xb5c7('0xe'))['db'];config[_0xb5c7('0xf')]=_[_0xb5c7('0x10')](config[_0xb5c7('0xf')],{'host':_0xb5c7('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5c7('0xf')]));require(_0xb5c7('0x12'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb5c7('0x13')]({'port':0x232b});var client9004=jayson['client'][_0xb5c7('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x56aa52,_0xdd0b8f,_0x474837,_0x43290a){return new BPromise(function(_0x20f4f0,_0x3c7198){var _0x5466c5=_0x43290a||client;return _0x5466c5[_0xb5c7('0x14')](_0x56aa52,_0x474837)['then'](function(_0x12308a){logger[_0xb5c7('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xdd0b8f,_0xb5c7('0x16'));logger[_0xb5c7('0x17')](_0xb5c7('0x18'),_0xdd0b8f,_0xb5c7('0x16'),JSON[_0xb5c7('0x19')](_0x12308a));if(_0x12308a[_0xb5c7('0x1a')]){if(_0x12308a[_0xb5c7('0x1a')][_0xb5c7('0x1b')]===0x1f4){logger[_0xb5c7('0x1a')](_0xb5c7('0x1c'),_0xdd0b8f,_0x12308a[_0xb5c7('0x1a')][_0xb5c7('0x1d')]);return _0x3c7198(_0x12308a[_0xb5c7('0x1a')][_0xb5c7('0x1d')]);}logger[_0xb5c7('0x1a')](_0xb5c7('0x1c'),_0xdd0b8f,_0x12308a[_0xb5c7('0x1a')]['message']);return _0x20f4f0(_0x12308a['error'][_0xb5c7('0x1d')]);}else{logger[_0xb5c7('0x15')](_0xb5c7('0x1c'),_0xdd0b8f,_0xb5c7('0x16'));_0x20f4f0(_0x12308a[_0xb5c7('0x1e')][_0xb5c7('0x1d')]);}})[_0xb5c7('0x1f')](function(_0x445af0){logger['error'](_0xb5c7('0x1c'),_0xdd0b8f,_0x445af0);_0x3c7198(_0x445af0);});});}function respondWithStatusCode(_0x387156,_0x1e4848){_0x1e4848=_0x1e4848||0xcc;return function(_0x5d2d66){if(_0x5d2d66){return _0x387156['sendStatus'](_0x1e4848);}return _0x387156['status'](_0x1e4848)[_0xb5c7('0x20')]();};}function respondWithResult(_0x86f239,_0x1c3a42){_0x1c3a42=_0x1c3a42||0xc8;return function(_0x5a481b){if(_0x5a481b){return _0x86f239['status'](_0x1c3a42)[_0xb5c7('0x21')](_0x5a481b);}};}function respondWithFilteredResult(_0x17cd8e,_0x399bb2){return function(_0x5d26bf){if(_0x5d26bf){var _0x107e03=typeof _0x399bb2['offset']===_0xb5c7('0x22')&&typeof _0x399bb2['limit']===_0xb5c7('0x22');var _0x53be6b=_0x5d26bf[_0xb5c7('0x23')];var _0x1a873e=_0x107e03?0x0:_0x399bb2[_0xb5c7('0x24')];var _0x28271d=_0x107e03?_0x5d26bf[_0xb5c7('0x23')]:_0x399bb2['offset']+_0x399bb2[_0xb5c7('0x25')];var _0x14bc59;if(_0x28271d>=_0x53be6b){_0x28271d=_0x53be6b;_0x14bc59=0xc8;}else{_0x14bc59=0xce;}_0x17cd8e[_0xb5c7('0x26')](_0x14bc59);return _0x17cd8e[_0xb5c7('0x27')](_0xb5c7('0x28'),_0x1a873e+'-'+_0x28271d+'/'+_0x53be6b)[_0xb5c7('0x21')](_0x5d26bf);}return null;};}function saveUpdates(_0x1f20cf){return function(_0x315ee0){if(_0x315ee0){return _0x315ee0[_0xb5c7('0x29')](_0x1f20cf)['then'](function(_0x575120){return _0x575120;});}return null;};}function removeEntity(_0x5d8d79){return function(_0x5d7691){if(_0x5d7691){return _0x5d7691[_0xb5c7('0x2a')]()['then'](function(){_0x5d8d79[_0xb5c7('0x26')](0xcc)[_0xb5c7('0x20')]();});}};}function handleEntityNotFound(_0x5d06f7){return function(_0x251e70){if(!_0x251e70){_0x5d06f7[_0xb5c7('0x2b')](0x194);}return _0x251e70;};}function handleError(_0x106a9b,_0x4faca4){_0x4faca4=_0x4faca4||0x1f4;return function(_0x6f8f35){logger[_0xb5c7('0x1a')](_0x6f8f35['stack']);if(_0x6f8f35['name']){delete _0x6f8f35[_0xb5c7('0x2c')];}_0x106a9b[_0xb5c7('0x26')](_0x4faca4)[_0xb5c7('0x2d')](_0x6f8f35);};}function getMustacheRender(_0x52f0f5,_0x46f56f){return Mustache[_0xb5c7('0x2e')](_0x52f0f5,_[_0xb5c7('0x2f')](_0x46f56f['body'],{'contact':_0x46f56f[_0xb5c7('0x30')],'message':_0x46f56f[_0xb5c7('0x1d')],'agent':_0x46f56f[_0xb5c7('0x31')],'interaction':_0x46f56f['interaction'],'account':_0x46f56f['account']}))||'';}exports[_0xb5c7('0x32')]=function(_0x1d1cbe,_0x265a43){var _0xfeaa09={};var _0x1f622b=_[_0xb5c7('0x33')](db['ChatInteraction'][_0xb5c7('0x34')],function(_0x543c05){return{'name':_0x543c05[_0xb5c7('0x35')],'type':_0x543c05[_0xb5c7('0x36')]['key']};});_0xfeaa09=qs[_0xb5c7('0x37')](_0x1f622b,_0x1d1cbe);return interaction[_0xb5c7('0x38')](_0xb5c7('0x39'),_0x1d1cbe[_0xb5c7('0x3a')],_0x1d1cbe['user'],_0xfeaa09,_0x1f622b)[_0xb5c7('0x3b')](respondWithFilteredResult(_0x265a43,_0xfeaa09))[_0xb5c7('0x1f')](handleError(_0x265a43,null));};exports[_0xb5c7('0x3c')]=function(_0x18b656,_0x1e67be){var _0x2b14aa={'raw':![],'where':{'id':_0x18b656[_0xb5c7('0x3d')]['id']}},_0x1f32f6={};_0x1f32f6[_0xb5c7('0x3e')]=_[_0xb5c7('0x3f')](db[_0xb5c7('0x40')]['rawAttributes']);_0x1f32f6[_0xb5c7('0x3a')]=_[_0xb5c7('0x3f')](_0x18b656['query']);_0x1f32f6[_0xb5c7('0x41')]=_['intersection'](_0x1f32f6[_0xb5c7('0x3e')],_0x1f32f6['query']);_0x2b14aa[_0xb5c7('0x42')]=_[_0xb5c7('0x43')](_0x1f32f6['model'],qs[_0xb5c7('0x44')](_0x18b656[_0xb5c7('0x3a')][_0xb5c7('0x44')]));_0x2b14aa[_0xb5c7('0x42')]=_0x2b14aa[_0xb5c7('0x42')]['length']?_0x2b14aa[_0xb5c7('0x42')]:_0x1f32f6[_0xb5c7('0x3e')];if(_0x18b656[_0xb5c7('0x3a')][_0xb5c7('0x45')]){_0x2b14aa['include']=[{'all':!![]}];}_0x2b14aa=_[_0xb5c7('0x2f')]({},_0x2b14aa,_0x18b656[_0xb5c7('0x46')]);return db[_0xb5c7('0x40')]['find'](_0x2b14aa)[_0xb5c7('0x3b')](handleEntityNotFound(_0x1e67be,null))[_0xb5c7('0x3b')](respondWithResult(_0x1e67be,null))[_0xb5c7('0x1f')](handleError(_0x1e67be,null));};exports[_0xb5c7('0x47')]=function(_0x5f1161,_0xc22d8b){return db['ChatInteraction'][_0xb5c7('0x47')](_0x5f1161[_0xb5c7('0x48')],{})[_0xb5c7('0x3b')](respondWithResult(_0xc22d8b,0xc9))[_0xb5c7('0x1f')](handleError(_0xc22d8b,null));};exports[_0xb5c7('0x29')]=function(_0x528b36,_0x5a8eca){if(_0x528b36[_0xb5c7('0x48')]['id']){delete _0x528b36[_0xb5c7('0x48')]['id'];}return db[_0xb5c7('0x40')][_0xb5c7('0x49')]({'where':{'id':_0x528b36[_0xb5c7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5a8eca,null))['then'](saveUpdates(_0x528b36['body'],null))[_0xb5c7('0x3b')](respondWithResult(_0x5a8eca,null))[_0xb5c7('0x1f')](handleError(_0x5a8eca,null));};exports[_0xb5c7('0x2a')]=function(_0x205135,_0x5bbd49){return db[_0xb5c7('0x40')]['find']({'where':{'id':_0x205135['params']['id']}})['then'](handleEntityNotFound(_0x5bbd49,null))[_0xb5c7('0x3b')](removeEntity(_0x5bbd49,null))[_0xb5c7('0x1f')](handleError(_0x5bbd49,null));};exports[_0xb5c7('0x4a')]=function(_0x5d6a31,_0x5451cd){return db[_0xb5c7('0x40')][_0xb5c7('0x4a')]()[_0xb5c7('0x3b')](respondWithResult(_0x5451cd,null))[_0xb5c7('0x1f')](handleError(_0x5451cd,null));};exports['createVidaooSession']=function(_0x4e6c88,_0x2b761f){var _0xe4bb1=_0x4e6c88[_0xb5c7('0x3d')]['id'];var _0x116dcb;var _0x2472f4;var _0x2fdc26;return db['ChatInteraction'][_0xb5c7('0x4b')]({'where':{'id':_0xe4bb1}})[_0xb5c7('0x3b')](function(_0x7c99d1){_0x116dcb=_0x7c99d1;return db[_0xb5c7('0x4c')][_0xb5c7('0x4b')]({'where':{'id':_0x7c99d1[_0xb5c7('0x4d')]},'attributes':['id',_0xb5c7('0x4e'),_0xb5c7('0x4f'),_0xb5c7('0x50'),_0xb5c7('0x51'),'vidaooMetadata'],'raw':!![]});})[_0xb5c7('0x3b')](function(_0x14f75b){if(_0x14f75b&&_0x14f75b['vidaooApiKey']&&_0x14f75b[_0xb5c7('0x4f')]){_0x2472f4=_0x14f75b;var _0x45739f={'interaction':{'id':_0xe4bb1},'agent':{'id':_0x4e6c88[_0xb5c7('0x52')]['id'],'name':_0x4e6c88[_0xb5c7('0x52')]['name'],'fullname':_0x4e6c88[_0xb5c7('0x52')][_0xb5c7('0x53')],'email':_0x4e6c88[_0xb5c7('0x52')][_0xb5c7('0x54')]},'contact':_0x4e6c88['body'][_0xb5c7('0x30')],'account':_0x4e6c88[_0xb5c7('0x48')][_0xb5c7('0x55')]};var _0x1df48d={'rejectUnauthorized':![],'method':_0xb5c7('0x56'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x14f75b[_0xb5c7('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4e6c88[_0xb5c7('0x52')][_0xb5c7('0x54')]],'buttons':null,'topic':_0x2472f4['vidaooTopic'],'note':_[_0xb5c7('0x57')](_0x2472f4[_0xb5c7('0x51')])?null:getMustacheRender(_0x2472f4[_0xb5c7('0x51')],_0x45739f),'metadata':null},'redirect':_0xb5c7('0x58'),'json':!![]};try{if(!_[_0xb5c7('0x57')](_0x2472f4[_0xb5c7('0x59')])){var _0x23fc16=getMustacheRender(_0x2472f4['vidaooMetadata'],_0x45739f);var _0x2fb3a0=JSON[_0xb5c7('0x5a')](_0x23fc16);_0x1df48d['body'][_0xb5c7('0x5b')]=_0x2fb3a0;}}catch(_0x43f517){throw new db[(_0xb5c7('0x5c'))][(_0xb5c7('0x5d'))](_0xb5c7('0x5e'));}return rp(_0x1df48d);}else{throw new db[(_0xb5c7('0x5c'))][(_0xb5c7('0x5d'))](_0xb5c7('0x5f'));}})[_0xb5c7('0x3b')](function(_0x270cfc){_0x2fdc26=_0x270cfc;if(_0x2fdc26['id']){var _0xfc70be={'body':_0x2fdc26[_0xb5c7('0x60')],'ChatWebsiteId':_0x2472f4['id'],'ChatInteractionId':_0x116dcb['id'],'direction':_0xb5c7('0x61'),'UserId':_0x4e6c88[_0xb5c7('0x52')]['id']};return db['ChatMessage'][_0xb5c7('0x47')](_0xfc70be,{});}else{throw new db[(_0xb5c7('0x5c'))][(_0xb5c7('0x5d'))](_0xb5c7('0x62'));}})[_0xb5c7('0x3b')](function(){return _0x116dcb[_0xb5c7('0x63')]({'vidaooSessionId':_0x2fdc26['id']});})[_0xb5c7('0x3b')](respondWithResult(_0x2b761f,null))['catch'](handleError(_0x2b761f,null));};exports[_0xb5c7('0x64')]=function(_0x11a64d,_0x49fdac){if(_0x11a64d[_0xb5c7('0x48')]['id']){delete _0x11a64d[_0xb5c7('0x48')]['id'];}return db['ChatInteraction'][_0xb5c7('0x49')]({'where':{'id':_0x11a64d['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xb5c7('0x3b')](handleEntityNotFound(_0x49fdac,null))[_0xb5c7('0x3b')](saveUpdates(_0x11a64d[_0xb5c7('0x48')],null))['then'](respondWithResult(_0x49fdac,null))['catch'](handleError(_0x49fdac,null));};exports['abandon']=function(_0x3eac01,_0x36c0ae){if(_0x3eac01[_0xb5c7('0x48')]['id']){delete _0x3eac01['body']['id'];}return db[_0xb5c7('0x40')][_0xb5c7('0x49')]({'where':{'id':_0x3eac01[_0xb5c7('0x3d')]['id']}})[_0xb5c7('0x3b')](function(_0x3b8427){if(!_0x3b8427){logger[_0xb5c7('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xb5c7('0x65'),0x194,_0xb5c7('0x66'));_0x36c0ae[_0xb5c7('0x2b')](0x194);}else{if(_0x3b8427['UserId']){throw new db[(_0xb5c7('0x5c'))][(_0xb5c7('0x5d'))](_0xb5c7('0x67'));}}return _0x3b8427;})[_0xb5c7('0x3b')](function(_0x123f1f){if(_0x123f1f){return _0x123f1f['update']({'closed':_0x3eac01[_0xb5c7('0x48')][_0xb5c7('0x68')],'disposition':_0x3eac01[_0xb5c7('0x48')][_0xb5c7('0x69')]})[_0xb5c7('0x3b')](function(_0x57c7a7){return _0x57c7a7;});}})[_0xb5c7('0x3b')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3eac01[_0xb5c7('0x48')],client9004);})[_0xb5c7('0x3b')](respondWithResult(_0x36c0ae,null))['catch'](handleError(_0x36c0ae,null));};exports[_0xb5c7('0x6a')]=function(_0x305b9f,_0xa10ae9){_0x305b9f[_0xb5c7('0x48')][_0xb5c7('0x2c')]=_0x305b9f[_0xb5c7('0x6b')][_0xb5c7('0x6c')];_0x305b9f[_0xb5c7('0x48')][_0xb5c7('0x6d')]=_0x305b9f[_0xb5c7('0x6b')][_0xb5c7('0x6e')];_0x305b9f[_0xb5c7('0x48')][_0xb5c7('0x36')]=_0x305b9f['file'][_0xb5c7('0x6f')];return db[_0xb5c7('0x70')]['create'](_0x305b9f[_0xb5c7('0x48')])[_0xb5c7('0x3b')](respondWithResult(_0xa10ae9,0xc9))[_0xb5c7('0x1f')](handleError(_0xa10ae9,null));};exports['attachmentDownload']=function(_0x22c7fb,_0x522d74){return db[_0xb5c7('0x40')]['findOne']({'where':{'id':_0x22c7fb[_0xb5c7('0x3d')]['id']},'raw':!![]})[_0xb5c7('0x3b')](handleEntityNotFound(_0x522d74,null))[_0xb5c7('0x3b')](function(_0x2ac3e1){if(_0x2ac3e1){if(_0x2ac3e1['closed']){return _0x522d74[_0xb5c7('0x26')](0x193)[_0xb5c7('0x21')]({'status':0x193,'message':_0xb5c7('0x71')});}return db[_0xb5c7('0x70')][_0xb5c7('0x4b')]({'where':{'id':_0x22c7fb[_0xb5c7('0x3a')][_0xb5c7('0x72')]},'raw':!![]})[_0xb5c7('0x3b')](handleEntityNotFound(_0x522d74,null));}})[_0xb5c7('0x3b')](function(_0x3017fa){if(_0x3017fa){var _0x24e9bd=_0x3017fa[_0xb5c7('0x73')]!==null;var _0x12b67a=path[_0xb5c7('0x74')](config[_0xb5c7('0x75')],_0xb5c7('0x76'));if(_0x24e9bd){_0x12b67a=path['join'](_0x12b67a,'offline-chat/');}var _0x27d964=path['join'](_0x12b67a,_0x3017fa[_0xb5c7('0x6d')]);return _0x522d74['download'](_0x27d964);}})[_0xb5c7('0x1f')](handleError(_0x522d74,null));};exports['close']=function(_0x48e6f8,_0x50ac81){var _0x417f23=null;var _0x4ede1b=null;var _0x1d2c3d=null;if(_0x48e6f8['body']['id']){delete _0x48e6f8[_0xb5c7('0x48')]['id'];}if(_0x48e6f8['body']['mailTranscript']){_0x1d2c3d=path[_0xb5c7('0x74')](config[_0xb5c7('0x75')],'server/files/chat/upload/',util[_0xb5c7('0x77')](_0xb5c7('0x78'),Date[_0xb5c7('0x79')]()));_0x48e6f8[_0xb5c7('0x48')]['pathTranscript']=_0x1d2c3d;}return db[_0xb5c7('0x40')][_0xb5c7('0x49')]({'where':{'id':_0x48e6f8['params']['id']},'include':[{'model':db[_0xb5c7('0x7a')],'as':_0xb5c7('0x7b'),'include':[{'model':db[_0xb5c7('0x7c')],'as':'User'}]}]})[_0xb5c7('0x3b')](handleEntityNotFound(_0x50ac81,null))[_0xb5c7('0x3b')](saveUpdates(_0x48e6f8[_0xb5c7('0x48')],null))[_0xb5c7('0x3b')](function(_0x48a8f8){if(_0x48a8f8){_0x417f23=_0x48a8f8;return db[_0xb5c7('0x4c')][_0xb5c7('0x49')]({'where':{'id':_0x417f23['ChatWebsiteId']}});}})[_0xb5c7('0x3b')](function(_0xbb10d1){if(_0xbb10d1){_0x4ede1b=_0xbb10d1;return db[_0xb5c7('0x7d')][_0xb5c7('0x49')]({'where':{'id':_0x417f23[_0xb5c7('0x7e')]}});}})[_0xb5c7('0x3b')](function(_0x41b7d8){if(_0x41b7d8){if(_0x1d2c3d){var _0x1a774a=null;for(var _0x6a35c9=0x1;_0x6a35c9<_0x417f23[_0xb5c7('0x7b')]['length'];++_0x6a35c9){_0x1a774a=_0x417f23[_0xb5c7('0x7b')][_0x6a35c9];var _0x40fe95=_0x1a774a[_0xb5c7('0x7f')]?util[_0xb5c7('0x77')](_0xb5c7('0x80'),_0x4ede1b[_0xb5c7('0x81')],_0x1a774a['UserId']):'System';var _0x5d88c8=_0x48e6f8[_0xb5c7('0x48')][_0xb5c7('0x82')]||util[_0xb5c7('0x77')]('%s%d','Visitor',_0x1a774a['ContactId']);switch(_0x4ede1b[_0xb5c7('0x83')]){case _0xb5c7('0x84'):_0x40fe95=_0x1a774a[_0xb5c7('0x7f')]?util[_0xb5c7('0x77')](_0xb5c7('0x80'),_0x4ede1b[_0xb5c7('0x81')],_0x1a774a[_0xb5c7('0x7f')]):_0xb5c7('0x85');break;case _0xb5c7('0x86'):_0x40fe95=_0x1a774a['UserId']?_0x1a774a[_0xb5c7('0x7c')][_0xb5c7('0x87')]||_0x1a774a[_0xb5c7('0x7c')][_0xb5c7('0x53')]:'System';break;case'agent_fullname':_0x40fe95=_0x1a774a[_0xb5c7('0x7f')]?_0x1a774a['User'][_0xb5c7('0x53')]:'System';break;default:_0x40fe95=_0x1a774a[_0xb5c7('0x7f')]?util['format'](_0xb5c7('0x80'),_0x4ede1b['agentAlias'],_0x1a774a[_0xb5c7('0x7f')]):_0xb5c7('0x85');}var _0x32acfe=util[_0xb5c7('0x77')](_0xb5c7('0x88'),moment(_0x1a774a['createdAt'])['format'](_0xb5c7('0x89')),_0x1a774a[_0xb5c7('0x8a')]==='in'?_0x5d88c8:_0x40fe95,_0x1a774a['body']);if(!_0x1a774a['secret']){fs[_0xb5c7('0x8b')](_0x1d2c3d,_0x32acfe);}}return db[_0xb5c7('0x8c')][_0xb5c7('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0xb5c7('0x8d')],'as':_0xb5c7('0x8e'),'raw':!![],'include':[{'model':db[_0xb5c7('0x8f')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xb5c7('0x3b')](function(_0x504434){if(!_0x504434||!_0x504434[_0xb5c7('0x8e')]||!_0x48e6f8['body'])return _0x417f23;var _0x90b068=_0x504434[_0xb5c7('0x90')]();return respondWithRpcPromise(_0xb5c7('0x91'),_0xb5c7('0x92'),{'account':_0x90b068,'message':{'from':util[_0xb5c7('0x77')]('\x22%s\x22\x20<%s>',_0x504434[_0xb5c7('0x2c')],_0x504434[_0xb5c7('0x54')]||_0x504434['Smtp']['user']),'to':_0x48e6f8[_0xb5c7('0x48')][_0xb5c7('0x93')],'subject':_0xb5c7('0x94'),'text':util[_0xb5c7('0x77')](_0xb5c7('0x95'),_0x48e6f8[_0xb5c7('0x48')][_0xb5c7('0x93')]),'attachments':[{'path':_0x1d2c3d}]}})[_0xb5c7('0x3b')](function(){return _0x417f23;})['catch'](function(_0x24e8ed){logger[_0xb5c7('0x1a')](_0x24e8ed);});})[_0xb5c7('0x3b')](respondWithStatusCode(_0x50ac81,0xc8))['catch'](handleError(_0x50ac81,null));};exports[_0xb5c7('0x96')]=function(_0x33b31e,_0x5ae6c3){return db[_0xb5c7('0x7a')][_0xb5c7('0x49')]({'where':{'id':_0x33b31e[_0xb5c7('0x3d')]['id']}})[_0xb5c7('0x3b')](handleEntityNotFound(_0x5ae6c3,null))[_0xb5c7('0x3b')](function(_0x1cec37){if(_0x1cec37){return _0x1cec37['addMessage'](_0x33b31e['body']['ids'],_[_0xb5c7('0x97')](_0x33b31e[_0xb5c7('0x48')],[_0xb5c7('0x98'),'id'])||{});}})[_0xb5c7('0x3b')](respondWithResult(_0x5ae6c3,null))[_0xb5c7('0x1f')](handleError(_0x5ae6c3,null));};exports['getMessages']=function(_0x5d69e7,_0x4b57fc){var _0x1f6fd7={'raw':![],'where':{}};var _0x336743={};var _0x4c3357={'count':0x0,'rows':[]};return db[_0xb5c7('0x40')]['findOne']({'where':{'id':_0x5d69e7[_0xb5c7('0x3d')]['id']}})[_0xb5c7('0x3b')](handleEntityNotFound(_0x4b57fc,null))[_0xb5c7('0x3b')](function(_0xa42067){if(_0xa42067){_0x336743[_0xb5c7('0x3e')]=_[_0xb5c7('0x3f')](db['ChatMessage']['rawAttributes']);_0x336743['query']=_['keys'](_0x5d69e7[_0xb5c7('0x3a')]);_0x336743[_0xb5c7('0x41')]=_['intersection'](_0x336743['model'],_0x336743['query']);_0x1f6fd7['attributes']=_['intersection'](_0x336743['model'],qs[_0xb5c7('0x44')](_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0x44')]));_0x1f6fd7[_0xb5c7('0x42')]=_0x1f6fd7[_0xb5c7('0x42')]['length']?_0x1f6fd7[_0xb5c7('0x42')]:_0x336743['model'];if(!_0x5d69e7['query'][_0xb5c7('0x99')](_0xb5c7('0x9a'))){_0x1f6fd7[_0xb5c7('0x25')]=qs['limit'](_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0x25')]);_0x1f6fd7[_0xb5c7('0x24')]=qs[_0xb5c7('0x24')](_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0x24')]);}_0x1f6fd7[_0xb5c7('0x9b')]=qs[_0xb5c7('0x9c')](_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0x9c')]);_0x1f6fd7[_0xb5c7('0x9d')]=qs[_0xb5c7('0x41')](_[_0xb5c7('0x9e')](_0x5d69e7[_0xb5c7('0x3a')],_0x336743['filters']));_0x1f6fd7[_0xb5c7('0x9d')]['ChatInteractionId']=_0xa42067['id'];if(_0x5d69e7['query'][_0xb5c7('0x9f')]){_0x1f6fd7[_0xb5c7('0x9d')]=_[_0xb5c7('0x2f')](_0x1f6fd7[_0xb5c7('0x9d')],{'$or':_[_0xb5c7('0x33')](_0x1f6fd7['attributes'],function(_0x1bab13){var _0x19768c={};_0x19768c[_0x1bab13]={'$like':'%'+_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0x9f')]+'%'};return _0x19768c;})});}if(_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0xa0')]){var _0xcbeb26=_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0xa0')][_0xb5c7('0xa1')](',');var _0x4b5825={};_0x4b5825[_0xcbeb26[0x0]]={'$gte':moment(_0xcbeb26[0x1])[_0xb5c7('0x77')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f6fd7[_0xb5c7('0x9d')]=_[_0xb5c7('0x2f')](_0x1f6fd7[_0xb5c7('0x9d')],_0x4b5825);}_0x1f6fd7=_['merge']({},_0x1f6fd7,_0x5d69e7[_0xb5c7('0x46')]);return db[_0xb5c7('0x7a')][_0xb5c7('0x23')]({'where':_0x1f6fd7[_0xb5c7('0x9d')]})['then'](function(_0x1bcee9){_0x4c3357[_0xb5c7('0x23')]=_0x1bcee9;if(_0x5d69e7[_0xb5c7('0x3a')][_0xb5c7('0x45')]){_0x1f6fd7[_0xb5c7('0xa2')]=[{'all':!![]}];}return db[_0xb5c7('0x7a')][_0xb5c7('0x38')](_0x1f6fd7);})[_0xb5c7('0x3b')](function(_0x40c914){_0x4c3357[_0xb5c7('0xa3')]=_0x40c914;return _0x4c3357;});}})[_0xb5c7('0x3b')](respondWithFilteredResult(_0x4b57fc,_0x1f6fd7))[_0xb5c7('0x1f')](handleError(_0x4b57fc,null));};exports[_0xb5c7('0xa4')]=function(_0x4b6ced,_0x5c7f83){var _0x2e4809={'where':{}},_0x2922e1={},_0xfdf573={'count':0x0,'rows':[]};return db[_0xb5c7('0x40')]['findOne']({'where':{'id':_0x4b6ced[_0xb5c7('0x3d')]['id']}})[_0xb5c7('0x3b')](handleEntityNotFound(_0x5c7f83,null))[_0xb5c7('0x3b')](function(_0x60a846){if(_0x60a846){_0x2922e1[_0xb5c7('0x3e')]=_[_0xb5c7('0x3f')](db[_0xb5c7('0x7a')]['rawAttributes']);_0x2922e1[_0xb5c7('0x3a')]=_[_0xb5c7('0x3f')](_0x4b6ced['query']);_0x2922e1['filters']=_[_0xb5c7('0x43')](_0x2922e1[_0xb5c7('0x3e')],_0x2922e1[_0xb5c7('0x3a')]);_0x2e4809[_0xb5c7('0x42')]=_['intersection'](_0x2922e1[_0xb5c7('0x3e')],qs[_0xb5c7('0x44')](_0x4b6ced[_0xb5c7('0x3a')][_0xb5c7('0x44')]));_0x2e4809[_0xb5c7('0x42')]=_0x2e4809[_0xb5c7('0x42')]['length']?_0x2e4809[_0xb5c7('0x42')]:_0x2922e1['model'];if(!_0x4b6ced[_0xb5c7('0x3a')][_0xb5c7('0x99')](_0xb5c7('0x9a'))){_0x2e4809[_0xb5c7('0x25')]=qs['limit'](_0x4b6ced[_0xb5c7('0x3a')][_0xb5c7('0x25')]);_0x2e4809['offset']=qs['offset'](_0x4b6ced['query']['offset']);}_0x2e4809[_0xb5c7('0x9b')]=qs[_0xb5c7('0x9c')](_0x4b6ced[_0xb5c7('0x3a')][_0xb5c7('0x9c')]);_0x2e4809[_0xb5c7('0x9d')]=qs[_0xb5c7('0x41')](_[_0xb5c7('0x9e')](_0x4b6ced[_0xb5c7('0x3a')],_0x2922e1['filters']));_0x2e4809[_0xb5c7('0x9d')][_0xb5c7('0xa5')]=_0x60a846['id'];if(_0x4b6ced['query']['filter']){_0x2e4809[_0xb5c7('0x9d')]=_[_0xb5c7('0x2f')](_0x2e4809[_0xb5c7('0x9d')],{'$or':_[_0xb5c7('0x33')](_0x2e4809['attributes'],function(_0x179d3c){var _0x28c03a={};_0x28c03a[_0x179d3c]={'$like':'%'+_0x4b6ced[_0xb5c7('0x3a')]['filter']+'%'};return _0x28c03a;})});}_0x2e4809['where'][_0xb5c7('0xa6')]=![];if(_0x4b6ced[_0xb5c7('0x3a')]['id']){_0x2e4809[_0xb5c7('0x9d')]['id']={'$gt':_0x4b6ced[_0xb5c7('0x3a')]['id']};}_0x2e4809=_[_0xb5c7('0x2f')]({},_0x2e4809,_0x4b6ced[_0xb5c7('0x46')]);return db['ChatMessage'][_0xb5c7('0x23')]({'where':_0x2e4809['where']})[_0xb5c7('0x3b')](function(_0x26a308){_0xfdf573['count']=_0x26a308;_0x2e4809[_0xb5c7('0xa2')]=[];if(_0x4b6ced['query'][_0xb5c7('0xa7')]){_0x2e4809[_0xb5c7('0xa2')][_0xb5c7('0xa8')]({'model':db[_0xb5c7('0x7c')],'as':_0xb5c7('0x7c'),'attributes':['id',_0xb5c7('0x53'),_0xb5c7('0x87')]});}if(_0x4b6ced['query'][_0xb5c7('0x45')]){_0x2e4809[_0xb5c7('0xa2')]=[{'all':!![]}];}return db['ChatMessage'][_0xb5c7('0x38')](_0x2e4809);})[_0xb5c7('0x3b')](function(_0xf80818){_0xfdf573[_0xb5c7('0xa3')]=_0xf80818;return _0xfdf573;});}})[_0xb5c7('0x3b')](respondWithFilteredResult(_0x5c7f83,_0x2e4809))['catch'](handleError(_0x5c7f83,null));};exports[_0xb5c7('0xa9')]=function(_0x28a56e,_0x4db850){return db[_0xb5c7('0x40')][_0xb5c7('0x49')]({'where':{'id':_0x28a56e['params']['id']}})[_0xb5c7('0x3b')](handleEntityNotFound(_0x4db850,null))[_0xb5c7('0x3b')](function(_0xc051b2){if(_0xc051b2){return _0xc051b2[_0xb5c7('0xaa')](_0x28a56e['body'][_0xb5c7('0x98')],_[_0xb5c7('0x97')](_0x28a56e[_0xb5c7('0x48')],[_0xb5c7('0x98'),'id'])||{})[_0xb5c7('0xab')](function(){return db[_0xb5c7('0xac')][_0xb5c7('0x38')]({'attributes':['id',_0xb5c7('0x2c'),'color'],'where':{'id':_0x28a56e['body'][_0xb5c7('0x98')]}});})['then'](function(_0x36682e){socket[_0xb5c7('0xad')](_0xb5c7('0xae'),{'id':Number(_0x28a56e[_0xb5c7('0x3d')]['id']),'tags':_0x36682e||[]});return{'id':Number(_0x28a56e[_0xb5c7('0x3d')]['id']),'tags':_0x36682e||[]};});}})[_0xb5c7('0x3b')](respondWithResult(_0x4db850,null))[_0xb5c7('0x1f')](handleError(_0x4db850,null));};exports[_0xb5c7('0xaf')]=function(_0x2808ed,_0x245fa0){return db[_0xb5c7('0x40')]['find']({'where':{'id':_0x2808ed['params']['id']}})[_0xb5c7('0x3b')](handleEntityNotFound(_0x245fa0,null))[_0xb5c7('0x3b')](function(_0x521faf){if(_0x521faf){return _0x521faf[_0xb5c7('0xaf')](_0x2808ed[_0xb5c7('0x3a')][_0xb5c7('0x98')]);}})[_0xb5c7('0x3b')](respondWithStatusCode(_0x245fa0,null))[_0xb5c7('0x1f')](handleError(_0x245fa0,null));};exports[_0xb5c7('0xb0')]=function(_0x45c97e,_0x1cf709){var _0x37508e=moment()[_0xb5c7('0xb1')]()[_0xb5c7('0xb2')]();var _0x2908d4=path['join'](config[_0xb5c7('0x75')],_0xb5c7('0xb3'),'files','tmp');var _0x18bc56=path[_0xb5c7('0x74')](config[_0xb5c7('0x75')],_0xb5c7('0xb3'),'files','attachments');var _0x288478=path[_0xb5c7('0x74')](_0x2908d4,_0x37508e);var _0x42a613=util[_0xb5c7('0x77')]('transcript-%d-%s.zip',_0x45c97e[_0xb5c7('0x3d')]['id'],_0x37508e);var _0x1746e1=path['join'](_0x2908d4,_0x42a613);var _0x1a1c60=[];_0x1a1c60['push']({'model':db['User'],'as':_0xb5c7('0x7c'),'attributes':['id',_0xb5c7('0x53')],'raw':!![]});_0x1a1c60[_0xb5c7('0xa8')]({'model':db['CmContact'],'as':_0xb5c7('0xb4'),'attributes':['id',_0xb5c7('0xb5'),_0xb5c7('0xb6')],'raw':!![]});if(_0x45c97e[_0xb5c7('0x3a')][_0xb5c7('0xb7')]){_0x1a1c60[_0xb5c7('0xa8')]({'model':db['Attachment'],'as':_0xb5c7('0x70'),'raw':!![]});}var _0x2f5648=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id','body',_0xb5c7('0xb8'),_0xb5c7('0x8a'),'secret',_0xb5c7('0xb9')],'include':_0x1a1c60}];_0x2f5648[_0xb5c7('0xa8')]({'model':db[_0xb5c7('0x4c')],'as':'Account','attributes':['id','name']});_0x2f5648[_0xb5c7('0xa8')]({'model':db[_0xb5c7('0x7c')],'as':_0xb5c7('0xba'),'attributes':['id','fullname']});return db[_0xb5c7('0x40')][_0xb5c7('0x49')]({'where':{'id':_0x45c97e[_0xb5c7('0x3d')]['id']},'include':_0x2f5648})[_0xb5c7('0x3b')](handleEntityNotFound(_0x1cf709,null))['then'](function(_0x4e33cb){if(_0x4e33cb){var _0x1297a4=_0x4e33cb['get']({'plain':!![]});fs['mkdirSync'](_0x288478);var _0x34171c={'channel':'Chat','account':_0x1297a4[_0xb5c7('0xbb')][_0xb5c7('0x2c')],'agent':_0x1297a4[_0xb5c7('0xba')]?_0x1297a4[_0xb5c7('0xba')][_0xb5c7('0x53')]:_0xb5c7('0xbc'),'createdAt':moment(_0x1297a4[_0xb5c7('0xb8')])['format'](_0xb5c7('0xbd'))['toString'](),'closedAt':_0x1297a4[_0xb5c7('0x68')]?moment(_0x1297a4[_0xb5c7('0xbe')])[_0xb5c7('0x77')](_0xb5c7('0xbd'))['toString']():'','disposition':_0x1297a4[_0xb5c7('0x69')],'chatInfo':{'browser':_0x1297a4['browserName'],'os':_0x1297a4['osName'],'referer':_0x1297a4['referer'],'customerIp':_0x1297a4[_0xb5c7('0xbf')],'customerPort':_0x1297a4['customerPort']?_0x1297a4[_0xb5c7('0xc0')]:'N.A.'},'messages':_(_0x1297a4[_0xb5c7('0x7b')])['tail']()[_0xb5c7('0x9f')]({'secret':![]})[_0xb5c7('0x33')](function(_0x2fa8b1){if(_0x2fa8b1[_0xb5c7('0x70')]){var _0x3db17c=path[_0xb5c7('0x74')](_0x18bc56,_0x2fa8b1[_0xb5c7('0x70')][_0xb5c7('0x6d')]);if(fs[_0xb5c7('0xc1')](_0x3db17c)){fs[_0xb5c7('0xc2')](_0x3db17c)['pipe'](fs[_0xb5c7('0xc3')](path[_0xb5c7('0x74')](_0x288478,_0x2fa8b1[_0xb5c7('0x70')][_0xb5c7('0x6d')])));}}return{'date':moment(_0x2fa8b1[_0xb5c7('0xb8')])[_0xb5c7('0x77')](_0xb5c7('0xbd'))[_0xb5c7('0xb2')](),'sender':_0x2fa8b1[_0xb5c7('0x8a')]===_0xb5c7('0x61')?_0x2fa8b1[_0xb5c7('0x7c')]?_0x2fa8b1[_0xb5c7('0x7c')][_0xb5c7('0x53')]:'System':_0x2fa8b1[_0xb5c7('0xb4')]['firstName']+(_0x2fa8b1[_0xb5c7('0xb4')][_0xb5c7('0xb6')]?'\x20'+_0x2fa8b1[_0xb5c7('0xb4')][_0xb5c7('0xb6')]:''),'body':_0x2fa8b1[_0xb5c7('0x70')]?_0x2fa8b1[_0xb5c7('0x70')][_0xb5c7('0x6d')]:_0x2fa8b1[_0xb5c7('0x48')],'direction':_0x2fa8b1[_0xb5c7('0x8a')]===_0xb5c7('0x61')?'A':'C','secret':_0x2fa8b1[_0xb5c7('0xa6')],'read':_0x2fa8b1[_0xb5c7('0xb9')],'attachment':_0x2fa8b1[_0xb5c7('0x70')]};})['value']()};return ejs[_0xb5c7('0xc4')](path[_0xb5c7('0x74')](config[_0xb5c7('0x75')],'server','views',_0xb5c7('0xc5')),{'interaction':_0x34171c})[_0xb5c7('0x3b')](function(_0x107f02){var _0xa692e0=path[_0xb5c7('0x74')](_0x288478,_0xb5c7('0xc6')+_0x1297a4['id']+'-'+_0x37508e+'.pdf');var _0xf75de0={'path':_0xa692e0,'channel':_0xb5c7('0xc7'),'interactionId':_0x1297a4['id']};return pdf[_0xb5c7('0xc8')](_0x107f02,_0xf75de0);})['then'](function(){return new Promise(function(_0xb482ca,_0x1b04bd){zipdir(_0x288478,{'saveTo':_0x1746e1},function(_0xb60203,_0x5badee){if(_0xb60203)return _0x1b04bd(_0xb60203);return _0xb482ca(_0x5badee);});})[_0xb5c7('0x3b')](function(){return new BPromise(function(_0x510451,_0x34c8f1){rimraf(_0x288478,function(_0x57a4eb){if(_0x57a4eb)_0x34c8f1(_0x57a4eb);return _0x510451();});});})[_0xb5c7('0x3b')](function(){return _0x1cf709[_0xb5c7('0xb0')](_0x1746e1,_0x42a613,function(_0x5824eb){if(_0x5824eb){logger['error'](_0xb5c7('0xc9'),_0x5824eb);}else{fs[_0xb5c7('0xca')](_0x1746e1);}});});});}else{return _0x1cf709['sendStatus'](0xc8);}})[_0xb5c7('0x1f')](handleError(_0x1cf709,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 29d4f70..215ed23 100644 --- a/server/api/chatInteraction/chatInteraction.events.js +++ b/server/api/chatInteraction/chatInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d6f=['unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','map','findAll'];(function(_0x4f0dd8,_0x5f3912){var _0x121c01=function(_0x4e59f9){while(--_0x4e59f9){_0x4f0dd8['push'](_0x4f0dd8['shift']());}};_0x121c01(++_0x5f3912);}(_0x5d6f,0x1e1));var _0xf5d6=function(_0x606fe8,_0x10b084){_0x606fe8=_0x606fe8-0x0;var _0x28b517=_0x5d6f[_0x606fe8];return _0x28b517;};'use strict';var EventEmitter=require(_0xf5d6('0x0'));var ChatInteraction=require(_0xf5d6('0x1'))['db'][_0xf5d6('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xf5d6('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xf5d6('0x4')](0x0);var events={'afterCreate':_0xf5d6('0x5'),'afterUpdate':_0xf5d6('0x6'),'afterDestroy':_0xf5d6('0x7')};function emitEvent(_0x4f4043){return function(_0x224a69,_0x529c61,_0x451a7a){_0x224a69['getUsers']({'attributes':['id'],'raw':!![]})[_0xf5d6('0x8')](function(_0x1b8a99){_0x224a69[_0xf5d6('0x9')]('Users',_0x1b8a99[_0xf5d6('0xa')](function(_0x1da504){return{'id':_0x1da504['id']};}));return ChatMessage[_0xf5d6('0xb')]({'where':{'ChatInteractionId':_0x224a69['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf5d6('0x8')](function(_0x11b91e){_0x224a69[_0xf5d6('0x9')](_0xf5d6('0xc'),_0x11b91e[_0xf5d6('0xd')]);ChatInteractionEvents[_0xf5d6('0xe')](_0x4f4043+':'+_0x224a69['id'],_0x224a69);ChatInteractionEvents[_0xf5d6('0xe')](_0x4f4043,_0x224a69);_0x451a7a(null);})[_0xf5d6('0xf')](_0x451a7a(null));};}for(var e in events){if(events[_0xf5d6('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x37a1=['update','getUsers','setDataValue','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save'];(function(_0x56ddef,_0x595bac){var _0x13f1ab=function(_0x118caf){while(--_0x118caf){_0x56ddef['push'](_0x56ddef['shift']());}};_0x13f1ab(++_0x595bac);}(_0x37a1,0x12b));var _0x137a=function(_0x29cbb6,_0x3c0196){_0x29cbb6=_0x29cbb6-0x0;var _0x2674f4=_0x37a1[_0x29cbb6];return _0x2674f4;};'use strict';var EventEmitter=require(_0x137a('0x0'));var ChatInteraction=require(_0x137a('0x1'))['db'][_0x137a('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x137a('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x137a('0x4'),'afterUpdate':_0x137a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3555b2){return function(_0x1ff7e3,_0x5ed784,_0x2991a3){_0x1ff7e3[_0x137a('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4ca6a0){_0x1ff7e3[_0x137a('0x7')]('Users',_0x4ca6a0[_0x137a('0x8')](function(_0x109bb5){return{'id':_0x109bb5['id']};}));return ChatMessage[_0x137a('0x9')]({'where':{'ChatInteractionId':_0x1ff7e3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x37ffce){_0x1ff7e3['setDataValue'](_0x137a('0xa'),_0x37ffce[_0x137a('0xb')]);ChatInteractionEvents[_0x137a('0xc')](_0x3555b2+':'+_0x1ff7e3['id'],_0x1ff7e3);ChatInteractionEvents[_0x137a('0xc')](_0x3555b2,_0x1ff7e3);_0x2991a3(null);})['catch'](_0x2991a3(null));};}for(var e in events){if(events[_0x137a('0xd')](e)){var event=events[e];ChatInteraction[_0x137a('0xe')](e,emitEvent(event));}}module[_0x137a('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6e1cbc9..a8ff40d 100644 --- a/server/api/chatInteraction/chatInteraction.model.js +++ b/server/api/chatInteraction/chatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c6d=['request-promise','path','../../config/environment','exports','define','ChatInteraction','changed','closed','closedAt','format','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a34e0,_0x29ff2f){var _0xb5ce1d=function(_0x225c39){while(--_0x225c39){_0x4a34e0['push'](_0x4a34e0['shift']());}};_0xb5ce1d(++_0x29ff2f);}(_0x9c6d,0x1d6));var _0xd9c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9c6d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd9c6('0x0'));var util=require(_0xd9c6('0x1'));var logger=require(_0xd9c6('0x2'))(_0xd9c6('0x3'));var moment=require(_0xd9c6('0x4'));var BPromise=require(_0xd9c6('0x5'));var rp=require(_0xd9c6('0x6'));var fs=require('fs');var path=require(_0xd9c6('0x7'));var rimraf=require('rimraf');var config=require(_0xd9c6('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xd9c6('0x9')]=function(_0x353206,_0x18def6){return _0x353206[_0xd9c6('0xa')](_0xd9c6('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d95c6,_0x566046,_0x25ac30){if(_0x5d95c6[_0xd9c6('0xc')](_0xd9c6('0xd'))){_0x5d95c6[_0xd9c6('0xe')]=moment()[_0xd9c6('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x25ac30(null,_0x5d95c6);}},'charset':_0xd9c6('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x32f8=['../../config/logger','api','moment','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci'];(function(_0x3e5fde,_0x11c007){var _0x46b207=function(_0xb5ed62){while(--_0xb5ed62){_0x3e5fde['push'](_0x3e5fde['shift']());}};_0x46b207(++_0x11c007);}(_0x32f8,0x188));var _0x832f=function(_0x3c56b6,_0x453d68){_0x3c56b6=_0x3c56b6-0x0;var _0x101256=_0x32f8[_0x3c56b6];return _0x101256;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x832f('0x0'))(_0x832f('0x1'));var moment=require(_0x832f('0x2'));var BPromise=require('bluebird');var rp=require(_0x832f('0x3'));var fs=require('fs');var path=require(_0x832f('0x4'));var rimraf=require('rimraf');var config=require(_0x832f('0x5'));var attributes=require(_0x832f('0x6'));module[_0x832f('0x7')]=function(_0x1cdcde,_0x5056e2){return _0x1cdcde['define'](_0x832f('0x8'),attributes,{'tableName':_0x832f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x249b9a,_0x3b9761,_0x2bde7e){if(_0x249b9a[_0x832f('0xa')]('closed')){_0x249b9a['closedAt']=moment()[_0x832f('0xb')](_0x832f('0xc'));}_0x2bde7e(null,_0x249b9a);}},'charset':'utf8mb4','collate':_0x832f('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0611b68..67f432c 100644 --- a/server/api/chatInteraction/chatInteraction.rpc.js +++ b/server/api/chatInteraction/chatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0160=['info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','ChatInteraction,\x20%s,\x20%s','error','message','result','catch','ChatInteraction','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','ids','omit','AddTags','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then'];(function(_0x4e6d39,_0x47c75d){var _0x4597b4=function(_0x2d4d07){while(--_0x2d4d07){_0x4e6d39['push'](_0x4e6d39['shift']());}};_0x4597b4(++_0x47c75d);}(_0x0160,0x90));var _0x0016=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x0160[_0x10d34b];return _0x92b0bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0016('0x0'));var fs=require('fs');var Redis=require(_0x0016('0x1'));var db=require(_0x0016('0x2'))['db'];var utils=require(_0x0016('0x3'));var logger=require(_0x0016('0x4'))(_0x0016('0x5'));var config=require(_0x0016('0x6'));var jayson=require(_0x0016('0x7'));var client=jayson['client'][_0x0016('0x8')]({'port':0x232a});config[_0x0016('0x9')]=_[_0x0016('0xa')](config[_0x0016('0x9')],{'host':_0x0016('0xb'),'port':0x18eb});var socket=require(_0x0016('0xc'))(new Redis(config['redis']));require(_0x0016('0xd'))[_0x0016('0xe')](socket);function respondWithRpcPromise(_0x551097,_0x12bda1,_0x381ffd){return new BPromise(function(_0x4eb06f,_0x1bbd18){return client['request'](_0x551097,_0x381ffd)[_0x0016('0xf')](function(_0x334274){logger[_0x0016('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x12bda1,_0x0016('0x11'));logger[_0x0016('0x12')](_0x0016('0x13'),_0x12bda1,_0x0016('0x11'),JSON[_0x0016('0x14')](_0x334274));if(_0x334274['error']){if(_0x334274['error'][_0x0016('0x15')]===0x1f4){logger['error'](_0x0016('0x16'),_0x12bda1,_0x334274[_0x0016('0x17')]['message']);return _0x1bbd18(_0x334274[_0x0016('0x17')][_0x0016('0x18')]);}logger[_0x0016('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x12bda1,_0x334274[_0x0016('0x17')][_0x0016('0x18')]);return _0x4eb06f(_0x334274['error'][_0x0016('0x18')]);}else{logger[_0x0016('0x10')](_0x0016('0x16'),_0x12bda1,_0x0016('0x11'));_0x4eb06f(_0x334274[_0x0016('0x19')][_0x0016('0x18')]);}})[_0x0016('0x1a')](function(_0x48e1a1){logger[_0x0016('0x17')](_0x0016('0x16'),_0x12bda1,_0x48e1a1);_0x1bbd18(_0x48e1a1);});});}exports['UpdateChatInteraction']=function(_0x9cafc3){var _0x55e62e=this;return new Promise(function(_0x14e4ad,_0x429894){return db[_0x0016('0x1b')]['update'](_0x9cafc3[_0x0016('0x1c')],{'raw':_0x9cafc3[_0x0016('0x1d')]?_0x9cafc3['options'][_0x0016('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9cafc3['options']?_0x9cafc3['options'][_0x0016('0x1f')]||null:null,'attributes':_0x9cafc3['options']?_0x9cafc3[_0x0016('0x1d')][_0x0016('0x20')]||null:null,'limit':_0x9cafc3[_0x0016('0x1d')]?_0x9cafc3[_0x0016('0x1d')][_0x0016('0x21')]||null:null})[_0x0016('0xf')](function(_0x6c046a){logger[_0x0016('0x10')]('UpdateChatInteraction',_0x9cafc3);logger[_0x0016('0x12')](_0x0016('0x22'),_0x9cafc3,JSON[_0x0016('0x14')](_0x6c046a));_0x14e4ad(_0x6c046a);})['catch'](function(_0x5a99e0){logger[_0x0016('0x17')](_0x0016('0x22'),_0x5a99e0['message'],_0x9cafc3);_0x429894(_0x55e62e[_0x0016('0x17')](0x1f4,_0x5a99e0[_0x0016('0x18')]));});});};exports[_0x0016('0x23')]=function(_0xcad2c4){return new Promise(function(_0x3c845a,_0x23428b){return db['ChatInteraction'][_0x0016('0x24')]({'where':_0xcad2c4[_0x0016('0x1d')]?_0xcad2c4[_0x0016('0x1d')][_0x0016('0x1f')]||null:null})[_0x0016('0xf')](function(_0x2c039b){if(_0x2c039b){return _0x2c039b['addTags'](_0xcad2c4[_0x0016('0x1c')][_0x0016('0x25')],_[_0x0016('0x26')](_0xcad2c4['body'],[_0x0016('0x25'),'id'])||{});}})['spread'](function(_0x102376){logger[_0x0016('0x10')](_0x0016('0x27'),_0xcad2c4);logger[_0x0016('0x12')](_0x0016('0x27'),_0xcad2c4,JSON[_0x0016('0x14')](_0x102376));_0x3c845a(_0x102376);})[_0x0016('0x1a')](function(_0x4bcecf){logger[_0x0016('0x17')](_0x0016('0x27'),_0x4bcecf[_0x0016('0x18')],_0xcad2c4);_0x23428b(_this[_0x0016('0x17')](0x1f4,_0x4bcecf[_0x0016('0x18')]));});});}; \ No newline at end of file +var _0x4499=['ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToChatInteraction','find','where','ids','omit','AddTags','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0x4499,0xc0));var _0x9449=function(_0x4a01a3,_0xa47ef6){_0x4a01a3=_0x4a01a3-0x0;var _0xd20294=_0x4499[_0x4a01a3];return _0xd20294;};'use strict';var _=require('lodash');var util=require(_0x9449('0x0'));var moment=require(_0x9449('0x1'));var BPromise=require('bluebird');var rs=require(_0x9449('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9449('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9449('0x4'))(_0x9449('0x5'));var config=require(_0x9449('0x6'));var jayson=require(_0x9449('0x7'));var client=jayson[_0x9449('0x8')][_0x9449('0x9')]({'port':0x232a});config[_0x9449('0xa')]=_[_0x9449('0xb')](config[_0x9449('0xa')],{'host':_0x9449('0xc'),'port':0x18eb});var socket=require(_0x9449('0xd'))(new Redis(config[_0x9449('0xa')]));require(_0x9449('0xe'))['register'](socket);function respondWithRpcPromise(_0x2341a6,_0x163f19,_0x3f0f78){return new BPromise(function(_0x2716a1,_0x38d2e1){return client[_0x9449('0xf')](_0x2341a6,_0x3f0f78)[_0x9449('0x10')](function(_0x583665){logger[_0x9449('0x11')](_0x9449('0x12'),_0x163f19,_0x9449('0x13'));logger['debug'](_0x9449('0x14'),_0x163f19,_0x9449('0x13'),JSON[_0x9449('0x15')](_0x583665));if(_0x583665[_0x9449('0x16')]){if(_0x583665['error'][_0x9449('0x17')]===0x1f4){logger['error'](_0x9449('0x12'),_0x163f19,_0x583665[_0x9449('0x16')][_0x9449('0x18')]);return _0x38d2e1(_0x583665[_0x9449('0x16')][_0x9449('0x18')]);}logger[_0x9449('0x16')](_0x9449('0x12'),_0x163f19,_0x583665[_0x9449('0x16')][_0x9449('0x18')]);return _0x2716a1(_0x583665[_0x9449('0x16')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x163f19,_0x9449('0x13'));_0x2716a1(_0x583665[_0x9449('0x19')][_0x9449('0x18')]);}})[_0x9449('0x1a')](function(_0x4ff06b){logger[_0x9449('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x163f19,_0x4ff06b);_0x38d2e1(_0x4ff06b);});});}exports[_0x9449('0x1b')]=function(_0x257b7f){var _0x25e23c=this;return new Promise(function(_0x986ab9,_0x1f4615){return db[_0x9449('0x1c')][_0x9449('0x1d')](_0x257b7f[_0x9449('0x1e')],{'raw':_0x257b7f[_0x9449('0x1f')]?_0x257b7f['options'][_0x9449('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x257b7f[_0x9449('0x1f')]?_0x257b7f[_0x9449('0x1f')]['where']||null:null,'attributes':_0x257b7f['options']?_0x257b7f[_0x9449('0x1f')][_0x9449('0x21')]||null:null,'limit':_0x257b7f[_0x9449('0x1f')]?_0x257b7f['options'][_0x9449('0x22')]||null:null})[_0x9449('0x10')](function(_0x18d427){logger[_0x9449('0x11')](_0x9449('0x1b'),_0x257b7f);logger[_0x9449('0x23')](_0x9449('0x1b'),_0x257b7f,JSON['stringify'](_0x18d427));_0x986ab9(_0x18d427);})[_0x9449('0x1a')](function(_0x5b99b3){logger[_0x9449('0x16')](_0x9449('0x1b'),_0x5b99b3[_0x9449('0x18')],_0x257b7f);_0x1f4615(_0x25e23c[_0x9449('0x16')](0x1f4,_0x5b99b3[_0x9449('0x18')]));});});};exports[_0x9449('0x24')]=function(_0x52dcc3){return new Promise(function(_0xdbc0cd,_0x34ee45){return db[_0x9449('0x1c')][_0x9449('0x25')]({'where':_0x52dcc3[_0x9449('0x1f')]?_0x52dcc3[_0x9449('0x1f')][_0x9449('0x26')]||null:null})[_0x9449('0x10')](function(_0x294a4f){if(_0x294a4f){return _0x294a4f['addTags'](_0x52dcc3[_0x9449('0x1e')][_0x9449('0x27')],_[_0x9449('0x28')](_0x52dcc3[_0x9449('0x1e')],['ids','id'])||{});}})['spread'](function(_0x5cfba8){logger[_0x9449('0x11')](_0x9449('0x29'),_0x52dcc3);logger['debug'](_0x9449('0x29'),_0x52dcc3,JSON[_0x9449('0x15')](_0x5cfba8));_0xdbc0cd(_0x5cfba8);})['catch'](function(_0x4a8646){logger[_0x9449('0x16')](_0x9449('0x29'),_0x4a8646[_0x9449('0x18')],_0x52dcc3);_0x34ee45(_this['error'](0x1f4,_0x4a8646[_0x9449('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7b3421a..e082384 100644 --- a/server/api/chatInteraction/chatInteraction.socket.js +++ b/server/api/chatInteraction/chatInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdb1=['remove','update','emit','register','length','./chatInteraction.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfdb1,0x1cc));var _0x1fdb=function(_0x20d99f,_0x1c7a6a){_0x20d99f=_0x20d99f-0x0;var _0x585f44=_0xfdb1[_0x20d99f];return _0x585f44;};'use strict';var ChatInteractionEvents=require(_0x1fdb('0x0'));var events=[_0x1fdb('0x1'),_0x1fdb('0x2'),_0x1fdb('0x3')];function createListener(_0x4ac9df,_0x76749f){return function(_0x181b70){_0x76749f[_0x1fdb('0x4')](_0x4ac9df,_0x181b70);};}function removeListener(_0x5d78a7,_0x51f353){return function(){ChatInteractionEvents['removeListener'](_0x5d78a7,_0x51f353);};}exports[_0x1fdb('0x5')]=function(_0x402bdb){for(var _0x358db2=0x0,_0xeb8854=events[_0x1fdb('0x6')];_0x358db2<_0xeb8854;_0x358db2++){var _0x46554d=events[_0x358db2];var _0x2cb800=createListener('chatInteraction:'+_0x46554d,_0x402bdb);ChatInteractionEvents['on'](_0x46554d,_0x2cb800);}}; \ No newline at end of file +var _0xdfe8=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xdfe8,0x12c));var _0x8dfe=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0xdfe8[_0x5f1617];return _0x3af5da;};'use strict';var ChatInteractionEvents=require(_0x8dfe('0x0'));var events=[_0x8dfe('0x1'),_0x8dfe('0x2'),_0x8dfe('0x3')];function createListener(_0x4c065d,_0x117e0a){return function(_0x3d41c1){_0x117e0a['emit'](_0x4c065d,_0x3d41c1);};}function removeListener(_0x1840f9,_0x54610e){return function(){ChatInteractionEvents[_0x8dfe('0x4')](_0x1840f9,_0x54610e);};}exports[_0x8dfe('0x5')]=function(_0xb4e83e){for(var _0x5e12bb=0x0,_0x46d075=events[_0x8dfe('0x6')];_0x5e12bb<_0x46d075;_0x5e12bb++){var _0x3580cb=events[_0x5e12bb];var _0x17e2ef=createListener(_0x8dfe('0x7')+_0x3580cb,_0xb4e83e);ChatInteractionEvents['on'](_0x3580cb,_0x17e2ef);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2ce7c59..4d8fa4e 100644 --- a/server/api/chatInteraction/index.js +++ b/server/api/chatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x323a=['Router','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','close','delete','chatinteraction:destroy','/:id/tags','removeTags','connect-timeout'];(function(_0xa74c63,_0x267bd1){var _0x5f4b45=function(_0xc94017){while(--_0xc94017){_0xa74c63['push'](_0xa74c63['shift']());}};_0x5f4b45(++_0x267bd1);}(_0x323a,0x133));var _0xa323=function(_0x25c106,_0x5b97a5){_0x25c106=_0x25c106-0x0;var _0x4ff2ce=_0x323a[_0x25c106];return _0x4ff2ce;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa323('0x0'));var express=require('express');var router=express[_0xa323('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa323('0x2'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xa323('0x3')](),controller[_0xa323('0x4')]);router[_0xa323('0x5')](_0xa323('0x6'),auth[_0xa323('0x3')](),controller[_0xa323('0x7')]);router[_0xa323('0x5')](_0xa323('0x8'),auth[_0xa323('0x9')](),controller[_0xa323('0xa')]);router[_0xa323('0x5')]('/:id/attachment_download',auth[_0xa323('0x9')](),controller['attachmentDownload']);router['get'](_0xa323('0xb'),auth[_0xa323('0x3')](),controller['getMessages']);router['get']('/:id/my_messages',auth[_0xa323('0x9')](),controller['getMyMessages']);router['get'](_0xa323('0xc'),auth[_0xa323('0x3')](),controller[_0xa323('0xd')]);router[_0xa323('0xe')]('/',auth[_0xa323('0x3')](),controller[_0xa323('0xf')]);router[_0xa323('0xe')](_0xa323('0x10'),auth[_0xa323('0x3')](),controller[_0xa323('0x11')]);var upload=multer({'storage':multer[_0xa323('0x12')]({'destination':function(_0x574058,_0x45f6c2,_0x538790){_0x538790(null,path[_0xa323('0x13')](config[_0xa323('0x14')],_0xa323('0x15')));},'filename':function(_0x491425,_0x26f4d1,_0x26bada){_0x26bada(null,util[_0xa323('0x16')](_0xa323('0x17'),Date['now'](),_0x26f4d1[_0xa323('0x18')][_0xa323('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xa323('0x1a'),upload[_0xa323('0x1b')]('file'),controller[_0xa323('0x1c')]);router[_0xa323('0xe')](_0xa323('0xb'),auth['isChatInteractionAuthorized'](),controller[_0xa323('0x1d')]);router[_0xa323('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa323('0x1e')](_0xa323('0x1f'),_0xa323('0x20')),controller[_0xa323('0x21')]);router[_0xa323('0x22')](_0xa323('0x8'),auth['isAuthenticated'](),interaction[_0xa323('0x1e')]('chat',_0xa323('0x23')),controller['update']);router[_0xa323('0x22')](_0xa323('0x24'),controller[_0xa323('0x25')]);router[_0xa323('0x22')](_0xa323('0x26'),auth[_0xa323('0x9')](),controller['abandon']);router['put']('/:id/close',controller[_0xa323('0x27')]);router[_0xa323('0x28')](_0xa323('0x8'),auth[_0xa323('0x3')](),interaction['tracked']('chat',_0xa323('0x29')),controller['destroy']);router[_0xa323('0x28')](_0xa323('0x2a'),auth[_0xa323('0x3')](),controller[_0xa323('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xe709=['describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','getMyMessages','download','create','post','createVidaooSession','join','root','server/files/attachments/','format','now','originalname','/:id/attachment_upload','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','addTags','tracked','chatinteraction:update','put','/:id/custom_update','/:id/abandon','/:id/close','chatinteraction:destroy','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0xe709,0x1b6));var _0x9e70=function(_0x4d2d37,_0x11657f){_0x4d2d37=_0x4d2d37-0x0;var _0x588b6c=_0xe709[_0x4d2d37];return _0x588b6c;};'use strict';var multer=require(_0x9e70('0x0'));var util=require(_0x9e70('0x1'));var path=require(_0x9e70('0x2'));var timeout=require(_0x9e70('0x3'));var express=require(_0x9e70('0x4'));var router=express[_0x9e70('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9e70('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e70('0x7'));var controller=require('./chatInteraction.controller');router[_0x9e70('0x8')]('/',auth['isAuthenticated'](),controller[_0x9e70('0x9')]);router['get'](_0x9e70('0xa'),auth[_0x9e70('0xb')](),controller[_0x9e70('0xc')]);router[_0x9e70('0x8')](_0x9e70('0xd'),auth[_0x9e70('0xe')](),controller[_0x9e70('0xf')]);router[_0x9e70('0x8')](_0x9e70('0x10'),auth[_0x9e70('0xe')](),controller[_0x9e70('0x11')]);router[_0x9e70('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9e70('0x12')]);router[_0x9e70('0x8')]('/:id/my_messages',auth[_0x9e70('0xe')](),controller[_0x9e70('0x13')]);router[_0x9e70('0x8')]('/:id/download',auth[_0x9e70('0xb')](),controller[_0x9e70('0x14')]);router['post']('/',auth[_0x9e70('0xb')](),controller[_0x9e70('0x15')]);router[_0x9e70('0x16')]('/:id/vidaoo',auth[_0x9e70('0xb')](),controller[_0x9e70('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x59efa8,_0x2a4280,_0x490477){_0x490477(null,path[_0x9e70('0x18')](config[_0x9e70('0x19')],_0x9e70('0x1a')));},'filename':function(_0x210a89,_0x6dda4f,_0x3879dc){_0x3879dc(null,util[_0x9e70('0x1b')]('%s-%s',Date[_0x9e70('0x1c')](),_0x6dda4f[_0x9e70('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9e70('0x16')](_0x9e70('0x1e'),upload['single']('file'),controller[_0x9e70('0x1f')]);router['post'](_0x9e70('0x20'),auth[_0x9e70('0xe')](),controller[_0x9e70('0x21')]);router['post'](_0x9e70('0x22'),auth[_0x9e70('0xb')](),interaction['tracked'](_0x9e70('0x23'),'chatinteraction:addtags'),controller[_0x9e70('0x24')]);router['put'](_0x9e70('0xd'),auth[_0x9e70('0xb')](),interaction[_0x9e70('0x25')]('chat',_0x9e70('0x26')),controller['update']);router[_0x9e70('0x27')](_0x9e70('0x28'),controller['customUpdate']);router['put'](_0x9e70('0x29'),auth[_0x9e70('0xe')](),controller['abandon']);router[_0x9e70('0x27')](_0x9e70('0x2a'),controller['close']);router['delete'](_0x9e70('0xd'),auth[_0x9e70('0xb')](),interaction['tracked'](_0x9e70('0x23'),_0x9e70('0x2b')),controller['destroy']);router[_0x9e70('0x2c')](_0x9e70('0x22'),auth[_0x9e70('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 8509919..1fa8857 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd75=['BOOLEAN','sequelize','TEXT','medium'];(function(_0x3e0601,_0x236850){var _0x5555f8=function(_0x5be70e){while(--_0x5be70e){_0x3e0601['push'](_0x3e0601['shift']());}};_0x5555f8(++_0x236850);}(_0xdd75,0x169));var _0x5dd7=function(_0x13c2cf,_0x568ba5){_0x13c2cf=_0x13c2cf-0x0;var _0x237785=_0xdd75[_0x13c2cf];return _0x237785;};'use strict';var Sequelize=require(_0x5dd7('0x0'));module['exports']={'body':{'type':Sequelize[_0x5dd7('0x1')](_0x5dd7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5dd7('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd7ac=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x4496e1,_0x125154){var _0x36b160=function(_0x293e1f){while(--_0x293e1f){_0x4496e1['push'](_0x4496e1['shift']());}};_0x36b160(++_0x125154);}(_0xd7ac,0x91));var _0xcd7a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd7ac[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xcd7a('0x0'));module[_0xcd7a('0x1')]={'body':{'type':Sequelize[_0xcd7a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcd7a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fec9fb0..296a74c 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.controller.js +++ b/server/api/chatInternalMessage/chatInternalMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57c9=['VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','FromId','read','-createdAt','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','end','offset','undefined','limit','count','status','set','json','reject','save','update','then','destroy','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar'];(function(_0x26b063,_0x88df05){var _0x567dc2=function(_0x2e4d88){while(--_0x2e4d88){_0x26b063['push'](_0x26b063['shift']());}};_0x567dc2(++_0x88df05);}(_0x57c9,0x156));var _0x957c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x57c9[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x957c('0x0'));var rimraf=require(_0x957c('0x1'));var zipdir=require(_0x957c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x957c('0x3'));var moment=require(_0x957c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x957c('0x5'));var util=require(_0x957c('0x6'));var path=require(_0x957c('0x7'));var sox=require('sox');var csv=require(_0x957c('0x8'));var ejs=require(_0x957c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x957c('0xa'));var squel=require('squel');var crypto=require(_0x957c('0xb'));var jsforce=require(_0x957c('0xc'));var deskjs=require(_0x957c('0xd'));var toCsv=require(_0x957c('0x8'));var querystring=require(_0x957c('0xe'));var Papa=require(_0x957c('0xf'));var Redis=require(_0x957c('0x10'));var authService=require(_0x957c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x957c('0x12'));var hardwareService=require(_0x957c('0x13'));var logger=require(_0x957c('0x14'))(_0x957c('0x15'));var utils=require(_0x957c('0x16'));var config=require(_0x957c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x957c('0x18')](config['redis'],{'host':_0x957c('0x19'),'port':0x18eb});var socket=require(_0x957c('0x1a'))(new Redis(config[_0x957c('0x1b')]));require(_0x957c('0x1c'))[_0x957c('0x1d')](socket);function respondWithStatusCode(_0x1edb32,_0x495d0e){_0x495d0e=_0x495d0e||0xcc;return function(_0x247cf3){if(_0x247cf3){return _0x1edb32['sendStatus'](_0x495d0e);}return _0x1edb32['status'](_0x495d0e)[_0x957c('0x1e')]();};}function respondWithResult(_0x19366d,_0x31cbab){_0x31cbab=_0x31cbab||0xc8;return function(_0x481d24){if(_0x481d24){return _0x19366d['status'](_0x31cbab)['json'](_0x481d24);}};}function respondWithFilteredResult(_0x5b416e,_0x46f1fa){return function(_0x365399){if(_0x365399){var _0x2ea2cd=typeof _0x46f1fa[_0x957c('0x1f')]===_0x957c('0x20')&&typeof _0x46f1fa[_0x957c('0x21')]==='undefined';var _0x1a59d1=_0x365399[_0x957c('0x22')];var _0x2bfe9b=_0x2ea2cd?0x0:_0x46f1fa[_0x957c('0x1f')];var _0x3d3d68=_0x2ea2cd?_0x365399['count']:_0x46f1fa[_0x957c('0x1f')]+_0x46f1fa[_0x957c('0x21')];var _0x2ef411;if(_0x3d3d68>=_0x1a59d1){_0x3d3d68=_0x1a59d1;_0x2ef411=0xc8;}else{_0x2ef411=0xce;}_0x5b416e[_0x957c('0x23')](_0x2ef411);return _0x5b416e[_0x957c('0x24')]('Content-Range',_0x2bfe9b+'-'+_0x3d3d68+'/'+_0x1a59d1)[_0x957c('0x25')](_0x365399);}return null;};}function patchUpdates(_0x30facc){return function(_0x1add1e){try{jsonpatch['apply'](_0x1add1e,_0x30facc,!![]);}catch(_0x5c64c4){return BPromise[_0x957c('0x26')](_0x5c64c4);}return _0x1add1e[_0x957c('0x27')]();};}function saveUpdates(_0xb7a119,_0x16ca9d){return function(_0x2d4e9f){if(_0x2d4e9f){return _0x2d4e9f[_0x957c('0x28')](_0xb7a119)[_0x957c('0x29')](function(_0x414898){return _0x414898;});}return null;};}function removeEntity(_0x32d2aa,_0xa4a393){return function(_0x46c267){if(_0x46c267){return _0x46c267[_0x957c('0x2a')]()['then'](function(){_0x32d2aa[_0x957c('0x23')](0xcc)[_0x957c('0x1e')]();});}};}function handleEntityNotFound(_0x3df196,_0x576187){return function(_0x5afba9){if(!_0x5afba9){_0x3df196['sendStatus'](0x194);}return _0x5afba9;};}function handleError(_0x30b6fc,_0x5393ef){_0x5393ef=_0x5393ef||0x1f4;return function(_0x5d068d){logger[_0x957c('0x2b')](_0x5d068d['stack']);if(_0x5d068d[_0x957c('0x2c')]){delete _0x5d068d[_0x957c('0x2c')];}_0x30b6fc[_0x957c('0x23')](_0x5393ef)[_0x957c('0x2d')](_0x5d068d);};}exports[_0x957c('0x2e')]=function(_0x257c69,_0x2d6128){var _0x24fb19={},_0x4692d1={},_0x4849a3={'count':0x0,'rows':[]};var _0x1150df=_[_0x957c('0x2f')](db[_0x957c('0x30')][_0x957c('0x31')],function(_0x4967b8){return{'name':_0x4967b8[_0x957c('0x32')],'type':_0x4967b8[_0x957c('0x33')][_0x957c('0x34')]};});_0x4692d1[_0x957c('0x35')]=_[_0x957c('0x2f')](_0x1150df,'name');_0x4692d1[_0x957c('0x36')]=_[_0x957c('0x37')](_0x257c69[_0x957c('0x36')]);_0x4692d1[_0x957c('0x38')]=_[_0x957c('0x39')](_0x4692d1[_0x957c('0x35')],_0x4692d1['query']);_0x24fb19[_0x957c('0x3a')]=_[_0x957c('0x39')](_0x4692d1[_0x957c('0x35')],qs[_0x957c('0x3b')](_0x257c69[_0x957c('0x36')]['fields']));_0x24fb19[_0x957c('0x3a')]=_0x24fb19[_0x957c('0x3a')][_0x957c('0x3c')]?_0x24fb19[_0x957c('0x3a')]:_0x4692d1[_0x957c('0x35')];if(!_0x257c69['query'][_0x957c('0x3d')]('nolimit')){_0x24fb19[_0x957c('0x21')]=qs[_0x957c('0x21')](_0x257c69[_0x957c('0x36')]['limit']);_0x24fb19[_0x957c('0x1f')]=qs[_0x957c('0x1f')](_0x257c69['query'][_0x957c('0x1f')]);}_0x24fb19[_0x957c('0x3e')]=qs[_0x957c('0x3f')](_0x257c69['query']['sort']);_0x24fb19[_0x957c('0x40')]=qs[_0x957c('0x38')](_[_0x957c('0x41')](_0x257c69['query'],_0x4692d1['filters']),_0x1150df);if(_0x257c69[_0x957c('0x36')][_0x957c('0x42')]){_0x24fb19[_0x957c('0x40')]=_[_0x957c('0x43')](_0x24fb19[_0x957c('0x40')],{'$or':_['map'](_0x1150df,function(_0x46f0ce){if(_0x46f0ce[_0x957c('0x33')]!=='VIRTUAL'){var _0x94e1ad={};_0x94e1ad[_0x46f0ce[_0x957c('0x2c')]]={'$like':'%'+_0x257c69[_0x957c('0x36')]['filter']+'%'};return _0x94e1ad;}})});}_0x24fb19=_[_0x957c('0x43')]({},_0x24fb19,_0x257c69[_0x957c('0x44')]);var _0x146577={'where':_0x24fb19[_0x957c('0x40')]};return db[_0x957c('0x30')][_0x957c('0x22')](_0x146577)[_0x957c('0x29')](function(_0x2f9266){_0x4849a3[_0x957c('0x22')]=_0x2f9266;if(_0x257c69[_0x957c('0x36')]['includeAll']){_0x24fb19[_0x957c('0x45')]=[{'all':!![]}];}return db[_0x957c('0x30')][_0x957c('0x46')](_0x24fb19);})[_0x957c('0x29')](function(_0x2fa641){_0x4849a3[_0x957c('0x47')]=_0x2fa641;return _0x4849a3;})[_0x957c('0x29')](respondWithFilteredResult(_0x2d6128,_0x24fb19))[_0x957c('0x48')](handleError(_0x2d6128,null));};exports[_0x957c('0x49')]=function(_0x5c4721,_0x4e343c){var _0x230dad={'raw':!![],'where':{'id':_0x5c4721['params']['id']}},_0x124ef5={};_0x124ef5[_0x957c('0x35')]=_[_0x957c('0x37')](db[_0x957c('0x30')][_0x957c('0x31')]);_0x124ef5['query']=_[_0x957c('0x37')](_0x5c4721[_0x957c('0x36')]);_0x124ef5['filters']=_[_0x957c('0x39')](_0x124ef5[_0x957c('0x35')],_0x124ef5[_0x957c('0x36')]);_0x230dad[_0x957c('0x3a')]=_[_0x957c('0x39')](_0x124ef5[_0x957c('0x35')],qs[_0x957c('0x3b')](_0x5c4721[_0x957c('0x36')][_0x957c('0x3b')]));_0x230dad[_0x957c('0x3a')]=_0x230dad[_0x957c('0x3a')][_0x957c('0x3c')]?_0x230dad[_0x957c('0x3a')]:_0x124ef5['model'];if(_0x5c4721[_0x957c('0x36')][_0x957c('0x4a')]){_0x230dad[_0x957c('0x45')]=[{'all':!![]}];}_0x230dad=_['merge']({},_0x230dad,_0x5c4721[_0x957c('0x44')]);return db[_0x957c('0x30')][_0x957c('0x4b')](_0x230dad)[_0x957c('0x29')](handleEntityNotFound(_0x4e343c,null))['then'](respondWithResult(_0x4e343c,null))[_0x957c('0x48')](handleError(_0x4e343c,null));};exports[_0x957c('0x4c')]=function(_0x3e8499,_0x352e2c){return db[_0x957c('0x30')][_0x957c('0x4c')](_0x3e8499['body'],{})[_0x957c('0x29')](respondWithResult(_0x352e2c,0xc9))['catch'](handleError(_0x352e2c,null));};exports['update']=function(_0x36e07e,_0x5599cd){if(_0x36e07e[_0x957c('0x4d')]['id']){delete _0x36e07e[_0x957c('0x4d')]['id'];}return db[_0x957c('0x30')][_0x957c('0x4b')]({'where':{'id':_0x36e07e[_0x957c('0x4e')]['id']}})[_0x957c('0x29')](handleEntityNotFound(_0x5599cd,null))[_0x957c('0x29')](saveUpdates(_0x36e07e[_0x957c('0x4d')],null))[_0x957c('0x29')](respondWithResult(_0x5599cd,null))[_0x957c('0x48')](handleError(_0x5599cd,null));};exports['destroy']=function(_0x35fdfb,_0x2bfdea){return db[_0x957c('0x30')][_0x957c('0x4b')]({'where':{'id':_0x35fdfb['params']['id']}})[_0x957c('0x29')](handleEntityNotFound(_0x2bfdea,null))['then'](removeEntity(_0x2bfdea,null))[_0x957c('0x48')](handleError(_0x2bfdea,null));};exports[_0x957c('0x4f')]=function(_0x31e665,_0x28ed05){return db['ChatInternalMessage'][_0x957c('0x4f')]()[_0x957c('0x29')](respondWithResult(_0x28ed05,null))['catch'](handleError(_0x28ed05,null));};function wrapUser(_0x5ef1ad){return function(_0x3c079b){var _0xe75adb=_0x5ef1ad[_0x957c('0x50')]({'plain':!![]});_0xe75adb[_0x957c('0x51')]=[];if(_0x3c079b){_0xe75adb[_0x957c('0x52')]=_0x3c079b['createdAt'];_0xe75adb[_0x957c('0x53')]=_0x3c079b;}else{_0xe75adb[_0x957c('0x52')]=moment(0x0)['format'](_0x957c('0x54'));_0xe75adb['lastMessage']={};}return _0xe75adb;};}exports[_0x957c('0x55')]=function(_0x32af63,_0x239a3d,_0x28984a){var _0x3eb582=[];return db[_0x957c('0x56')][_0x957c('0x46')]({'where':{'role':[_0x957c('0x57'),_0x957c('0x58'),_0x957c('0x59')]},'attributes':['id',_0x957c('0x5a'),_0x957c('0x2c'),_0x957c('0x5b'),_0x957c('0x5c'),_0x957c('0x5d'),_0x957c('0x5e'),_0x957c('0x5f'),_0x957c('0x60'),_0x957c('0x61')],'order':qs[_0x957c('0x3f')]('-online'),'include':[{'model':db[_0x957c('0x62')],'as':_0x957c('0x63'),'attributes':['id',_0x957c('0x2c'),_0x957c('0x33')],'through':{'attributes':[]}}]})['then'](function(_0xb67093){if(_0xb67093){var _0x3c3f84=_0x32af63[_0x957c('0x59')][_0x957c('0x50')]({'plain':!![]});if(!_0x3c3f84)throw new Error(_0x957c('0x64'));if(_0x3c3f84[_0x957c('0x5b')]===_0x957c('0x59')){return db[_0x957c('0x65')][_0x957c('0x4b')]({'where':{'name':_0x957c('0x66'),'userProfileId':_0x3c3f84['userProfileId']},'raw':!![]})[_0x957c('0x29')](function(_0x2b5bce){if(_0x2b5bce){if(_0x2b5bce[_0x957c('0x67')]===0x0){return db['UserProfileResource'][_0x957c('0x46')]({'where':{'sectionId':_0x2b5bce['id']},'raw':!![]})[_0x957c('0x29')](function(_0x27f7c6){var _0x3b1b2f=[];if(_[_0x957c('0x68')](_0x27f7c6)){_0x3b1b2f=_[_0x957c('0x42')](_0xb67093,function(_0x13ed8b){if(_0x13ed8b[_0x957c('0x5b')]!==_0x957c('0x57')){return _0x13ed8b;}});return _0x3b1b2f;}else{for(var _0x11c0fe=0x0;_0x11c0fe<_0xb67093[_0x957c('0x3c')];_0x11c0fe++){var _0x52af90=_0xb67093[_0x11c0fe];if(_0x52af90[_0x957c('0x5b')]===_0x957c('0x57')){var _0x26eb54=_[_0x957c('0x4b')](_0x27f7c6,function(_0x376be4){return _0x376be4[_0x957c('0x69')]===_0x52af90['id'];});if(_0x26eb54)_0x3b1b2f[_0x957c('0x6a')](_0x52af90);}else{_0x3b1b2f[_0x957c('0x6a')](_0x52af90);}}return _0x3b1b2f;}});}else{return _0xb67093;}}else{var _0x183bd5=_[_0x957c('0x42')](_0xb67093,function(_0x1679ce){if(_0x1679ce[_0x957c('0x5b')]!=='agent'){return _0x1679ce;}});return _0x183bd5;}});}else{return _0xb67093;}}})[_0x957c('0x29')](function(_0x25a125){var _0x59fa19=[];if(_0x25a125){_0x3eb582=_0x25a125;for(var _0x116d51=0x0;_0x116d51<_0x25a125[_0x957c('0x3c')];_0x116d51+=0x1){_0x3eb582[_0x116d51][_0x957c('0x51')]=[];_0x59fa19['push'](db[_0x957c('0x30')][_0x957c('0x4b')]({'where':{'FromId':[_0x32af63[_0x957c('0x59')]['id'],_0x25a125[_0x116d51]['id']],'ToId':[_0x32af63[_0x957c('0x59')]['id'],_0x25a125[_0x116d51]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x957c('0x6b'),'ToId',_0x957c('0x6c'),_0x957c('0x4d')],'order':qs[_0x957c('0x3f')](_0x957c('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x25a125[_0x116d51])));}return BPromise['all'](_0x59fa19);}return[];})['then'](function(_0x1fef15){return{'rows':_0x1fef15,'count':_0x1fef15[_0x957c('0x3c')]};})[_0x957c('0x29')](respondWithResult(_0x239a3d,null))[_0x957c('0x48')](handleError(_0x239a3d,null));}; \ No newline at end of file +var _0xce31=['hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','get','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x394720,_0x4436e8){var _0x2761a4=function(_0x5ee134){while(--_0x5ee134){_0x394720['push'](_0x394720['shift']());}};_0x2761a4(++_0x4436e8);}(_0xce31,0x11b));var _0x1ce3=function(_0x400adb,_0x50120c){_0x400adb=_0x400adb-0x0;var _0x274bf2=_0xce31[_0x400adb];return _0x274bf2;};'use strict';var emlformat=require(_0x1ce3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ce3('0x1'));var jsonpatch=require(_0x1ce3('0x2'));var rp=require(_0x1ce3('0x3'));var moment=require(_0x1ce3('0x4'));var BPromise=require(_0x1ce3('0x5'));var Mustache=require(_0x1ce3('0x6'));var util=require(_0x1ce3('0x7'));var path=require(_0x1ce3('0x8'));var sox=require(_0x1ce3('0x9'));var csv=require('to-csv');var ejs=require(_0x1ce3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ce3('0xb'));var squel=require(_0x1ce3('0xc'));var crypto=require(_0x1ce3('0xd'));var jsforce=require(_0x1ce3('0xe'));var deskjs=require(_0x1ce3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1ce3('0x10'));var Redis=require(_0x1ce3('0x11'));var authService=require(_0x1ce3('0x12'));var qs=require(_0x1ce3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ce3('0x14'));var logger=require(_0x1ce3('0x15'))(_0x1ce3('0x16'));var utils=require('../../config/utils');var config=require(_0x1ce3('0x17'));var licenseUtil=require(_0x1ce3('0x18'));var db=require(_0x1ce3('0x19'))['db'];config['redis']=_['defaults'](config[_0x1ce3('0x1a')],{'host':_0x1ce3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1ce3('0x1c'))[_0x1ce3('0x1d')](socket);function respondWithStatusCode(_0x21f760,_0x1b23e4){_0x1b23e4=_0x1b23e4||0xcc;return function(_0x51ed46){if(_0x51ed46){return _0x21f760[_0x1ce3('0x1e')](_0x1b23e4);}return _0x21f760[_0x1ce3('0x1f')](_0x1b23e4)[_0x1ce3('0x20')]();};}function respondWithResult(_0x5793d4,_0x1137e4){_0x1137e4=_0x1137e4||0xc8;return function(_0x110476){if(_0x110476){return _0x5793d4[_0x1ce3('0x1f')](_0x1137e4)[_0x1ce3('0x21')](_0x110476);}};}function respondWithFilteredResult(_0x30da10,_0x3ea6b5){return function(_0x541495){if(_0x541495){var _0x2aa053=typeof _0x3ea6b5[_0x1ce3('0x22')]===_0x1ce3('0x23')&&typeof _0x3ea6b5[_0x1ce3('0x24')]===_0x1ce3('0x23');var _0x1c64c9=_0x541495[_0x1ce3('0x25')];var _0x4ec302=_0x2aa053?0x0:_0x3ea6b5[_0x1ce3('0x22')];var _0x43b5c2=_0x2aa053?_0x541495[_0x1ce3('0x25')]:_0x3ea6b5[_0x1ce3('0x22')]+_0x3ea6b5[_0x1ce3('0x24')];var _0x464441;if(_0x43b5c2>=_0x1c64c9){_0x43b5c2=_0x1c64c9;_0x464441=0xc8;}else{_0x464441=0xce;}_0x30da10[_0x1ce3('0x1f')](_0x464441);return _0x30da10[_0x1ce3('0x26')](_0x1ce3('0x27'),_0x4ec302+'-'+_0x43b5c2+'/'+_0x1c64c9)[_0x1ce3('0x21')](_0x541495);}return null;};}function patchUpdates(_0xeff8a4){return function(_0x1c0827){try{jsonpatch['apply'](_0x1c0827,_0xeff8a4,!![]);}catch(_0x50e1f2){return BPromise[_0x1ce3('0x28')](_0x50e1f2);}return _0x1c0827['save']();};}function saveUpdates(_0x495636,_0x346ef8){return function(_0x4e38f3){if(_0x4e38f3){return _0x4e38f3[_0x1ce3('0x29')](_0x495636)['then'](function(_0x32070b){return _0x32070b;});}return null;};}function removeEntity(_0x7b104b,_0x71a532){return function(_0x5567f2){if(_0x5567f2){return _0x5567f2['destroy']()[_0x1ce3('0x2a')](function(){_0x7b104b[_0x1ce3('0x1f')](0xcc)[_0x1ce3('0x20')]();});}};}function handleEntityNotFound(_0x46e01f,_0x3ddafa){return function(_0x33945f){if(!_0x33945f){_0x46e01f['sendStatus'](0x194);}return _0x33945f;};}function handleError(_0x1049b5,_0x157e49){_0x157e49=_0x157e49||0x1f4;return function(_0x2004ca){logger['error'](_0x2004ca['stack']);if(_0x2004ca['name']){delete _0x2004ca['name'];}_0x1049b5[_0x1ce3('0x1f')](_0x157e49)[_0x1ce3('0x2b')](_0x2004ca);};}exports[_0x1ce3('0x2c')]=function(_0x515eb5,_0x1bf898){var _0xddcfac={},_0x5f06d3={},_0x185656={'count':0x0,'rows':[]};var _0xa10ff4=_[_0x1ce3('0x2d')](db[_0x1ce3('0x2e')][_0x1ce3('0x2f')],function(_0x43bae6){return{'name':_0x43bae6[_0x1ce3('0x30')],'type':_0x43bae6['type'][_0x1ce3('0x31')]};});_0x5f06d3[_0x1ce3('0x32')]=_[_0x1ce3('0x2d')](_0xa10ff4,_0x1ce3('0x33'));_0x5f06d3[_0x1ce3('0x34')]=_[_0x1ce3('0x35')](_0x515eb5['query']);_0x5f06d3[_0x1ce3('0x36')]=_[_0x1ce3('0x37')](_0x5f06d3[_0x1ce3('0x32')],_0x5f06d3[_0x1ce3('0x34')]);_0xddcfac[_0x1ce3('0x38')]=_[_0x1ce3('0x37')](_0x5f06d3['model'],qs[_0x1ce3('0x39')](_0x515eb5[_0x1ce3('0x34')][_0x1ce3('0x39')]));_0xddcfac['attributes']=_0xddcfac['attributes'][_0x1ce3('0x3a')]?_0xddcfac['attributes']:_0x5f06d3[_0x1ce3('0x32')];if(!_0x515eb5[_0x1ce3('0x34')][_0x1ce3('0x3b')](_0x1ce3('0x3c'))){_0xddcfac['limit']=qs[_0x1ce3('0x24')](_0x515eb5['query']['limit']);_0xddcfac[_0x1ce3('0x22')]=qs['offset'](_0x515eb5[_0x1ce3('0x34')][_0x1ce3('0x22')]);}_0xddcfac[_0x1ce3('0x3d')]=qs[_0x1ce3('0x3e')](_0x515eb5[_0x1ce3('0x34')][_0x1ce3('0x3e')]);_0xddcfac[_0x1ce3('0x3f')]=qs[_0x1ce3('0x36')](_['pick'](_0x515eb5[_0x1ce3('0x34')],_0x5f06d3[_0x1ce3('0x36')]),_0xa10ff4);if(_0x515eb5['query'][_0x1ce3('0x40')]){_0xddcfac[_0x1ce3('0x3f')]=_['merge'](_0xddcfac['where'],{'$or':_[_0x1ce3('0x2d')](_0xa10ff4,function(_0x2332b3){if(_0x2332b3[_0x1ce3('0x41')]!==_0x1ce3('0x42')){var _0x3c1ccb={};_0x3c1ccb[_0x2332b3[_0x1ce3('0x33')]]={'$like':'%'+_0x515eb5[_0x1ce3('0x34')]['filter']+'%'};return _0x3c1ccb;}})});}_0xddcfac=_[_0x1ce3('0x43')]({},_0xddcfac,_0x515eb5[_0x1ce3('0x44')]);var _0x34d3b3={'where':_0xddcfac[_0x1ce3('0x3f')]};return db[_0x1ce3('0x2e')][_0x1ce3('0x25')](_0x34d3b3)['then'](function(_0x5f0c9f){_0x185656[_0x1ce3('0x25')]=_0x5f0c9f;if(_0x515eb5[_0x1ce3('0x34')]['includeAll']){_0xddcfac['include']=[{'all':!![]}];}return db[_0x1ce3('0x2e')][_0x1ce3('0x45')](_0xddcfac);})[_0x1ce3('0x2a')](function(_0x52f54c){_0x185656[_0x1ce3('0x46')]=_0x52f54c;return _0x185656;})['then'](respondWithFilteredResult(_0x1bf898,_0xddcfac))[_0x1ce3('0x47')](handleError(_0x1bf898,null));};exports[_0x1ce3('0x48')]=function(_0x3dff10,_0xaae211){var _0x1a47d8={'raw':!![],'where':{'id':_0x3dff10[_0x1ce3('0x49')]['id']}},_0x461413={};_0x461413[_0x1ce3('0x32')]=_[_0x1ce3('0x35')](db[_0x1ce3('0x2e')][_0x1ce3('0x2f')]);_0x461413['query']=_[_0x1ce3('0x35')](_0x3dff10[_0x1ce3('0x34')]);_0x461413[_0x1ce3('0x36')]=_[_0x1ce3('0x37')](_0x461413[_0x1ce3('0x32')],_0x461413[_0x1ce3('0x34')]);_0x1a47d8['attributes']=_['intersection'](_0x461413[_0x1ce3('0x32')],qs[_0x1ce3('0x39')](_0x3dff10[_0x1ce3('0x34')][_0x1ce3('0x39')]));_0x1a47d8['attributes']=_0x1a47d8['attributes']['length']?_0x1a47d8[_0x1ce3('0x38')]:_0x461413['model'];if(_0x3dff10[_0x1ce3('0x34')][_0x1ce3('0x4a')]){_0x1a47d8[_0x1ce3('0x4b')]=[{'all':!![]}];}_0x1a47d8=_[_0x1ce3('0x43')]({},_0x1a47d8,_0x3dff10[_0x1ce3('0x44')]);return db['ChatInternalMessage'][_0x1ce3('0x4c')](_0x1a47d8)[_0x1ce3('0x2a')](handleEntityNotFound(_0xaae211,null))[_0x1ce3('0x2a')](respondWithResult(_0xaae211,null))['catch'](handleError(_0xaae211,null));};exports[_0x1ce3('0x4d')]=function(_0x24c8ea,_0xac2c00){return db['ChatInternalMessage'][_0x1ce3('0x4d')](_0x24c8ea[_0x1ce3('0x4e')],{})[_0x1ce3('0x2a')](respondWithResult(_0xac2c00,0xc9))[_0x1ce3('0x47')](handleError(_0xac2c00,null));};exports[_0x1ce3('0x29')]=function(_0x201fa7,_0x471da6){if(_0x201fa7['body']['id']){delete _0x201fa7[_0x1ce3('0x4e')]['id'];}return db['ChatInternalMessage'][_0x1ce3('0x4c')]({'where':{'id':_0x201fa7['params']['id']}})[_0x1ce3('0x2a')](handleEntityNotFound(_0x471da6,null))['then'](saveUpdates(_0x201fa7[_0x1ce3('0x4e')],null))['then'](respondWithResult(_0x471da6,null))[_0x1ce3('0x47')](handleError(_0x471da6,null));};exports['destroy']=function(_0x1f401c,_0xd4366e){return db[_0x1ce3('0x2e')][_0x1ce3('0x4c')]({'where':{'id':_0x1f401c[_0x1ce3('0x49')]['id']}})[_0x1ce3('0x2a')](handleEntityNotFound(_0xd4366e,null))[_0x1ce3('0x2a')](removeEntity(_0xd4366e,null))[_0x1ce3('0x47')](handleError(_0xd4366e,null));};exports['describe']=function(_0x453ca3,_0x30981e){return db[_0x1ce3('0x2e')][_0x1ce3('0x4f')]()[_0x1ce3('0x2a')](respondWithResult(_0x30981e,null))[_0x1ce3('0x47')](handleError(_0x30981e,null));};function wrapUser(_0x2a41b6){return function(_0x48d83e){var _0x57a30a=_0x2a41b6[_0x1ce3('0x50')]({'plain':!![]});_0x57a30a[_0x1ce3('0x51')]=[];if(_0x48d83e){_0x57a30a['lastMessageAt']=_0x48d83e[_0x1ce3('0x52')];_0x57a30a['lastMessage']=_0x48d83e;}else{_0x57a30a[_0x1ce3('0x53')]=moment(0x0)[_0x1ce3('0x54')](_0x1ce3('0x55'));_0x57a30a[_0x1ce3('0x56')]={};}return _0x57a30a;};}exports['getUsers']=function(_0x4383f6,_0x36d5ab,_0x6413da){var _0x230d43=[];return db[_0x1ce3('0x57')][_0x1ce3('0x45')]({'where':{'role':[_0x1ce3('0x58'),_0x1ce3('0x59'),_0x1ce3('0x5a')]},'attributes':['id','fullname',_0x1ce3('0x33'),_0x1ce3('0x5b'),_0x1ce3('0x5c'),_0x1ce3('0x5d'),_0x1ce3('0x5e'),_0x1ce3('0x5f'),_0x1ce3('0x60'),_0x1ce3('0x61')],'order':qs['sort']('-online'),'include':[{'model':db[_0x1ce3('0x62')],'as':_0x1ce3('0x63'),'attributes':['id',_0x1ce3('0x33'),'type'],'through':{'attributes':[]}}]})[_0x1ce3('0x2a')](function(_0x13c096){if(_0x13c096){var _0x28af8e=_0x4383f6[_0x1ce3('0x5a')][_0x1ce3('0x50')]({'plain':!![]});if(!_0x28af8e)throw new Error(_0x1ce3('0x64'));if(_0x28af8e['role']===_0x1ce3('0x5a')){return db[_0x1ce3('0x65')][_0x1ce3('0x4c')]({'where':{'name':_0x1ce3('0x66'),'userProfileId':_0x28af8e[_0x1ce3('0x67')]},'raw':!![]})[_0x1ce3('0x2a')](function(_0x45b1fb){if(_0x45b1fb){if(_0x45b1fb[_0x1ce3('0x68')]===0x0){return db[_0x1ce3('0x69')]['findAll']({'where':{'sectionId':_0x45b1fb['id']},'raw':!![]})[_0x1ce3('0x2a')](function(_0x143540){var _0x37b790=[];if(_[_0x1ce3('0x6a')](_0x143540)){_0x37b790=_[_0x1ce3('0x40')](_0x13c096,function(_0x21c24d){if(_0x21c24d[_0x1ce3('0x5b')]!==_0x1ce3('0x58')){return _0x21c24d;}});return _0x37b790;}else{for(var _0x1e9b4d=0x0;_0x1e9b4d<_0x13c096[_0x1ce3('0x3a')];_0x1e9b4d++){var _0x3b09f9=_0x13c096[_0x1e9b4d];if(_0x3b09f9[_0x1ce3('0x5b')]===_0x1ce3('0x58')){var _0x38dc1b=_[_0x1ce3('0x4c')](_0x143540,function(_0x4cf383){return _0x4cf383[_0x1ce3('0x6b')]===_0x3b09f9['id'];});if(_0x38dc1b)_0x37b790[_0x1ce3('0x6c')](_0x3b09f9);}else{_0x37b790[_0x1ce3('0x6c')](_0x3b09f9);}}return _0x37b790;}});}else{return _0x13c096;}}else{var _0x57db1e=_[_0x1ce3('0x40')](_0x13c096,function(_0xd3e411){if(_0xd3e411[_0x1ce3('0x5b')]!==_0x1ce3('0x58')){return _0xd3e411;}});return _0x57db1e;}});}else{return _0x13c096;}}})[_0x1ce3('0x2a')](function(_0x133ec5){var _0x39a866=[];if(_0x133ec5){_0x230d43=_0x133ec5;for(var _0xc72041=0x0;_0xc72041<_0x133ec5[_0x1ce3('0x3a')];_0xc72041+=0x1){_0x230d43[_0xc72041]['messages']=[];_0x39a866['push'](db[_0x1ce3('0x2e')][_0x1ce3('0x4c')]({'where':{'FromId':[_0x4383f6['user']['id'],_0x133ec5[_0xc72041]['id']],'ToId':[_0x4383f6[_0x1ce3('0x5a')]['id'],_0x133ec5[_0xc72041]['id']],'ChatGroupId':null},'attributes':['id',_0x1ce3('0x52'),_0x1ce3('0x6d'),_0x1ce3('0x6e'),_0x1ce3('0x6f'),'body'],'order':qs['sort'](_0x1ce3('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1ce3('0x2a')](wrapUser(_0x133ec5[_0xc72041])));}return BPromise[_0x1ce3('0x71')](_0x39a866);}return[];})['then'](function(_0x4d231e){return{'rows':_0x4d231e,'count':_0x4d231e[_0x1ce3('0x3a')]};})['then'](respondWithResult(_0x36d5ab,null))[_0x1ce3('0x47')](handleError(_0x36d5ab,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 8c6e0fc..f10ba1d 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.events.js +++ b/server/api/chatInternalMessage/chatInternalMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48cb=['../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit','exports','events'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x48cb,0x16f));var _0xb48c=function(_0x7855ae,_0x28e4e3){_0x7855ae=_0x7855ae-0x0;var _0x17c7d9=_0x48cb[_0x7855ae];return _0x17c7d9;};'use strict';var EventEmitter=require(_0xb48c('0x0'));var ChatInternalMessage=require(_0xb48c('0x1'))['db'][_0xb48c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb48c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb48c('0x4'),'afterDestroy':_0xb48c('0x5')};function emitEvent(_0x1beb71){return function(_0x447481,_0x852166,_0x1ce256){ChatInternalMessageEvents[_0xb48c('0x6')](_0x1beb71+':'+_0x447481['id'],_0x447481);ChatInternalMessageEvents[_0xb48c('0x6')](_0x1beb71,_0x447481);_0x1ce256(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xb48c('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe5e9=['events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xebc9d,_0x3fa560){var _0x100e8d=function(_0x36957e){while(--_0x36957e){_0xebc9d['push'](_0xebc9d['shift']());}};_0x100e8d(++_0x3fa560);}(_0xe5e9,0x1e4));var _0x9e5e=function(_0x2782b1,_0x1f93f4){_0x2782b1=_0x2782b1-0x0;var _0x98e50a=_0xe5e9[_0x2782b1];return _0x98e50a;};'use strict';var EventEmitter=require(_0x9e5e('0x0'));var ChatInternalMessage=require(_0x9e5e('0x1'))['db'][_0x9e5e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9e5e('0x3')](0x0);var events={'afterCreate':_0x9e5e('0x4'),'afterUpdate':_0x9e5e('0x5'),'afterDestroy':_0x9e5e('0x6')};function emitEvent(_0x381582){return function(_0x1a7ae8,_0x19dfce,_0x375494){ChatInternalMessageEvents[_0x9e5e('0x7')](_0x381582+':'+_0x1a7ae8['id'],_0x1a7ae8);ChatInternalMessageEvents['emit'](_0x381582,_0x1a7ae8);_0x375494(null);};}for(var e in events){if(events[_0x9e5e('0x8')](e)){var event=events[e];ChatInternalMessage[_0x9e5e('0x9')](e,emitEvent(event));}}module[_0x9e5e('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 39c28d6..6dd534c 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x911b=['chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x212635,_0x473753){var _0x4f1f22=function(_0x4318b1){while(--_0x4318b1){_0x212635['push'](_0x212635['shift']());}};_0x4f1f22(++_0x473753);}(_0x911b,0x128));var _0xb911=function(_0x21381e,_0x2a491e){_0x21381e=_0x21381e-0x0;var _0x10bfe7=_0x911b[_0x21381e];return _0x10bfe7;};'use strict';var _=require(_0xb911('0x0'));var util=require(_0xb911('0x1'));var logger=require(_0xb911('0x2'))(_0xb911('0x3'));var moment=require('moment');var BPromise=require(_0xb911('0x4'));var rp=require(_0xb911('0x5'));var fs=require('fs');var path=require(_0xb911('0x6'));var rimraf=require(_0xb911('0x7'));var config=require(_0xb911('0x8'));var attributes=require(_0xb911('0x9'));module[_0xb911('0xa')]=function(_0xcecacd,_0x1127ef){return _0xcecacd[_0xb911('0xb')]('ChatInternalMessage',attributes,{'tableName':_0xb911('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb911('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x492a=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','rimraf','./chatInternalMessage.attributes','define','ChatInternalMessage'];(function(_0x1a21b3,_0x2938b3){var _0x1b2c69=function(_0x1883ba){while(--_0x1883ba){_0x1a21b3['push'](_0x1a21b3['shift']());}};_0x1b2c69(++_0x2938b3);}(_0x492a,0xea));var _0xa492=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x492a[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require(_0xa492('0x0'));var logger=require(_0xa492('0x1'))(_0xa492('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa492('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa492('0x4'));var config=require('../../config/environment');var attributes=require(_0xa492('0x5'));module['exports']=function(_0x1d7cd5,_0x26f357){return _0x1d7cd5[_0xa492('0x6')](_0xa492('0x7'),attributes,{'tableName':_0xa492('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa492('0x9'),'collate':_0xa492('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4696f54..35ee15f 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.rpc.js +++ b/server/api/chatInternalMessage/chatInternalMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45ae=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5c89e2,_0x416a81){var _0x2b9eea=function(_0x26cc1a){while(--_0x26cc1a){_0x5c89e2['push'](_0x5c89e2['shift']());}};_0x2b9eea(++_0x416a81);}(_0x45ae,0xc6));var _0xe45a=function(_0x2377e3,_0x2c0352){_0x2377e3=_0x2377e3-0x0;var _0x2a6d1b=_0x45ae[_0x2377e3];return _0x2a6d1b;};'use strict';var _=require(_0xe45a('0x0'));var util=require(_0xe45a('0x1'));var moment=require(_0xe45a('0x2'));var BPromise=require(_0xe45a('0x3'));var rs=require(_0xe45a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe45a('0x5'))['db'];var utils=require(_0xe45a('0x6'));var logger=require(_0xe45a('0x7'))(_0xe45a('0x8'));var config=require(_0xe45a('0x9'));var jayson=require(_0xe45a('0xa'));var client=jayson[_0xe45a('0xb')]['http']({'port':0x232a});config[_0xe45a('0xc')]=_[_0xe45a('0xd')](config['redis'],{'host':_0xe45a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe45a('0xc')]));require(_0xe45a('0xf'))[_0xe45a('0x10')](socket);function respondWithRpcPromise(_0x20c418,_0x4f5695,_0x328b2b){return new BPromise(function(_0x188b07,_0x1b8913){return client[_0xe45a('0x11')](_0x20c418,_0x328b2b)[_0xe45a('0x12')](function(_0x19d359){logger[_0xe45a('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x4f5695,'request\x20sent');logger[_0xe45a('0x14')](_0xe45a('0x15'),_0x4f5695,_0xe45a('0x16'),JSON['stringify'](_0x19d359));if(_0x19d359[_0xe45a('0x17')]){if(_0x19d359[_0xe45a('0x17')][_0xe45a('0x18')]===0x1f4){logger['error'](_0xe45a('0x19'),_0x4f5695,_0x19d359[_0xe45a('0x17')]['message']);return _0x1b8913(_0x19d359[_0xe45a('0x17')][_0xe45a('0x1a')]);}logger[_0xe45a('0x17')](_0xe45a('0x19'),_0x4f5695,_0x19d359[_0xe45a('0x17')][_0xe45a('0x1a')]);return _0x188b07(_0x19d359[_0xe45a('0x17')]['message']);}else{logger[_0xe45a('0x13')](_0xe45a('0x19'),_0x4f5695,'request\x20sent');_0x188b07(_0x19d359[_0xe45a('0x1b')][_0xe45a('0x1a')]);}})[_0xe45a('0x1c')](function(_0x211009){logger[_0xe45a('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x4f5695,_0x211009);_0x1b8913(_0x211009);});});} \ No newline at end of file +var _0x3c85=['register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x3f4574,_0x137071){var _0x152bd6=function(_0x5a32){while(--_0x5a32){_0x3f4574['push'](_0x3f4574['shift']());}};_0x152bd6(++_0x137071);}(_0x3c85,0x113));var _0x53c8=function(_0x2c5e00,_0x526398){_0x2c5e00=_0x2c5e00-0x0;var _0xe588f6=_0x3c85[_0x2c5e00];return _0xe588f6;};'use strict';var _=require(_0x53c8('0x0'));var util=require(_0x53c8('0x1'));var moment=require(_0x53c8('0x2'));var BPromise=require(_0x53c8('0x3'));var rs=require(_0x53c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53c8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53c8('0x6'))(_0x53c8('0x7'));var config=require(_0x53c8('0x8'));var jayson=require(_0x53c8('0x9'));var client=jayson[_0x53c8('0xa')]['http']({'port':0x232a});config[_0x53c8('0xb')]=_['defaults'](config[_0x53c8('0xb')],{'host':_0x53c8('0xc'),'port':0x18eb});var socket=require(_0x53c8('0xd'))(new Redis(config[_0x53c8('0xb')]));require(_0x53c8('0xe'))[_0x53c8('0xf')](socket);function respondWithRpcPromise(_0x4da929,_0x5091c1,_0x450e38){return new BPromise(function(_0x3170a9,_0x33155e){return client[_0x53c8('0x10')](_0x4da929,_0x450e38)[_0x53c8('0x11')](function(_0x3a68b5){logger[_0x53c8('0x12')](_0x53c8('0x13'),_0x5091c1,'request\x20sent');logger[_0x53c8('0x14')](_0x53c8('0x15'),_0x5091c1,_0x53c8('0x16'),JSON[_0x53c8('0x17')](_0x3a68b5));if(_0x3a68b5[_0x53c8('0x18')]){if(_0x3a68b5[_0x53c8('0x18')][_0x53c8('0x19')]===0x1f4){logger[_0x53c8('0x18')](_0x53c8('0x13'),_0x5091c1,_0x3a68b5['error'][_0x53c8('0x1a')]);return _0x33155e(_0x3a68b5['error'][_0x53c8('0x1a')]);}logger[_0x53c8('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x5091c1,_0x3a68b5[_0x53c8('0x18')][_0x53c8('0x1a')]);return _0x3170a9(_0x3a68b5[_0x53c8('0x18')][_0x53c8('0x1a')]);}else{logger[_0x53c8('0x12')](_0x53c8('0x13'),_0x5091c1,'request\x20sent');_0x3170a9(_0x3a68b5[_0x53c8('0x1b')][_0x53c8('0x1a')]);}})[_0x53c8('0x1c')](function(_0x5a10f5){logger[_0x53c8('0x18')](_0x53c8('0x13'),_0x5091c1,_0x5a10f5);_0x33155e(_0x5a10f5);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a840428..a2d08fd 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.socket.js +++ b/server/api/chatInternalMessage/chatInternalMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16a7=['save','remove','update','removeListener','register','length','chatInternalMessage:'];(function(_0x2f627d,_0x370a12){var _0x29c392=function(_0x3fe491){while(--_0x3fe491){_0x2f627d['push'](_0x2f627d['shift']());}};_0x29c392(++_0x370a12);}(_0x16a7,0xe7));var _0x716a=function(_0x359afb,_0x2670fe){_0x359afb=_0x359afb-0x0;var _0x2b68f3=_0x16a7[_0x359afb];return _0x2b68f3;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x716a('0x0'),_0x716a('0x1'),_0x716a('0x2')];function createListener(_0xb1aa3a,_0x189c94){return function(_0x3a3836){_0x189c94['emit'](_0xb1aa3a,_0x3a3836);};}function removeListener(_0x3f0299,_0x1fe7e9){return function(){ChatInternalMessageEvents[_0x716a('0x3')](_0x3f0299,_0x1fe7e9);};}exports[_0x716a('0x4')]=function(_0x252ca7){for(var _0x1d510b=0x0,_0x159a70=events[_0x716a('0x5')];_0x1d510b<_0x159a70;_0x1d510b++){var _0x95fc84=events[_0x1d510b];var _0x1ee27e=createListener(_0x716a('0x6')+_0x95fc84,_0x252ca7);ChatInternalMessageEvents['on'](_0x95fc84,_0x1ee27e);}}; \ No newline at end of file +var _0x7673=['length','save','remove','update','removeListener'];(function(_0x51e548,_0x596a53){var _0x554cfb=function(_0x1a9a21){while(--_0x1a9a21){_0x51e548['push'](_0x51e548['shift']());}};_0x554cfb(++_0x596a53);}(_0x7673,0x17d));var _0x3767=function(_0x17144e,_0x54b854){_0x17144e=_0x17144e-0x0;var _0x393e3e=_0x7673[_0x17144e];return _0x393e3e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x3767('0x0'),_0x3767('0x1'),_0x3767('0x2')];function createListener(_0x1bb905,_0x2d4cd4){return function(_0x2a91aa){_0x2d4cd4['emit'](_0x1bb905,_0x2a91aa);};}function removeListener(_0xddecbe,_0x200124){return function(){ChatInternalMessageEvents[_0x3767('0x3')](_0xddecbe,_0x200124);};}exports['register']=function(_0x2d46df){for(var _0x215034=0x0,_0x5ef870=events[_0x3767('0x4')];_0x215034<_0x5ef870;_0x215034++){var _0xe86f18=events[_0x215034];var _0x31fd71=createListener('chatInternalMessage:'+_0xe86f18,_0x2d46df);ChatInternalMessageEvents['on'](_0xe86f18,_0x31fd71);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e83e7b5..fdab1f9 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6880=['/describe','describe','/users','getUsers','/:id','show','post','create','put','update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x2958c9,_0x3948fa){var _0x7ec3dc=function(_0x229dbd){while(--_0x229dbd){_0x2958c9['push'](_0x2958c9['shift']());}};_0x7ec3dc(++_0x3948fa);}(_0x6880,0x164));var _0x0688=function(_0x48ba11,_0x5c196f){_0x48ba11=_0x48ba11-0x0;var _0x9fbf41=_0x6880[_0x48ba11];return _0x9fbf41;};'use strict';var multer=require(_0x0688('0x0'));var util=require(_0x0688('0x1'));var path=require(_0x0688('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0688('0x3')]();var fs_extra=require(_0x0688('0x4'));var auth=require(_0x0688('0x5'));var interaction=require(_0x0688('0x6'));var config=require(_0x0688('0x7'));var controller=require(_0x0688('0x8'));router[_0x0688('0x9')]('/',auth[_0x0688('0xa')](),controller[_0x0688('0xb')]);router[_0x0688('0x9')](_0x0688('0xc'),auth[_0x0688('0xa')](),controller[_0x0688('0xd')]);router['get'](_0x0688('0xe'),auth[_0x0688('0xa')](),controller[_0x0688('0xf')]);router[_0x0688('0x9')](_0x0688('0x10'),auth[_0x0688('0xa')](),controller[_0x0688('0x11')]);router[_0x0688('0x12')]('/',auth[_0x0688('0xa')](),controller[_0x0688('0x13')]);router[_0x0688('0x14')]('/:id',controller[_0x0688('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0688('0x16')]);module['exports']=router; \ No newline at end of file +var _0xacc8=['/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','index','isAuthenticated','getUsers'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0xacc8,0xc5));var _0x8acc=function(_0x2b85d5,_0x3115b7){_0x2b85d5=_0x2b85d5-0x0;var _0xe8c96f=_0xacc8[_0x2b85d5];return _0xe8c96f;};'use strict';var multer=require(_0x8acc('0x0'));var util=require('util');var path=require(_0x8acc('0x1'));var timeout=require(_0x8acc('0x2'));var express=require(_0x8acc('0x3'));var router=express[_0x8acc('0x4')]();var fs_extra=require(_0x8acc('0x5'));var auth=require(_0x8acc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8acc('0x7'));var controller=require(_0x8acc('0x8'));router[_0x8acc('0x9')]('/',auth['isAuthenticated'](),controller[_0x8acc('0xa')]);router['get']('/describe',auth[_0x8acc('0xb')](),controller['describe']);router[_0x8acc('0x9')]('/users',auth[_0x8acc('0xb')](),controller[_0x8acc('0xc')]);router['get'](_0x8acc('0xd'),auth[_0x8acc('0xb')](),controller[_0x8acc('0xe')]);router[_0x8acc('0xf')]('/',auth[_0x8acc('0xb')](),controller[_0x8acc('0x10')]);router[_0x8acc('0x11')](_0x8acc('0xd'),controller[_0x8acc('0x12')]);router[_0x8acc('0x13')](_0x8acc('0xd'),auth['isAuthenticated'](),controller[_0x8acc('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6509718..81ae2db 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x659c=['medium','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x659c,0x1aa));var _0xc659=function(_0x58910b,_0x540685){_0x58910b=_0x58910b-0x0;var _0xfe1259=_0x659c[_0x58910b];return _0xfe1259;};'use strict';var Sequelize=require(_0xc659('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xc659('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc659('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc659('0x3')]('in',_0xc659('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc659('0x5')]},'providerResponse':{'type':Sequelize[_0xc659('0x6')]}}; \ No newline at end of file +var _0x2c91=['medium','BOOLEAN','out','DATE','exports'];(function(_0x2e8b8e,_0x3c2d36){var _0x1fcc33=function(_0x78895f){while(--_0x78895f){_0x2e8b8e['push'](_0x2e8b8e['shift']());}};_0x1fcc33(++_0x3c2d36);}(_0x2c91,0xe0));var _0x12c9=function(_0x59ea19,_0x28e3b6){_0x59ea19=_0x59ea19-0x0;var _0x45f421=_0x2c91[_0x59ea19];return _0x45f421;};'use strict';var Sequelize=require('sequelize');module[_0x12c9('0x0')]={'body':{'type':Sequelize['TEXT'](_0x12c9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x12c9('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x12c9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x12c9('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x12c9('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 51bff8b..d5c07a4 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6419=['undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','length','include','find','create','body','params','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','UserId','ChatInteractionId','isNil','read1stAt','format','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','interface','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','internal','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','catch','sendStatus','status','json','offset','limit'];(function(_0x216345,_0xfd9b72){var _0x313486=function(_0x2a60f5){while(--_0x2a60f5){_0x216345['push'](_0x216345['shift']());}};_0x313486(++_0xfd9b72);}(_0x6419,0xe2));var _0x9641=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6419[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9641('0x0'));var zipdir=require(_0x9641('0x1'));var jsonpatch=require(_0x9641('0x2'));var rp=require(_0x9641('0x3'));var moment=require('moment');var BPromise=require(_0x9641('0x4'));var Mustache=require(_0x9641('0x5'));var util=require(_0x9641('0x6'));var path=require('path');var sox=require(_0x9641('0x7'));var csv=require(_0x9641('0x8'));var ejs=require(_0x9641('0x9'));var fs=require('fs');var fs_extra=require(_0x9641('0xa'));var _=require('lodash');var squel=require(_0x9641('0xb'));var crypto=require('crypto');var jsforce=require(_0x9641('0xc'));var deskjs=require(_0x9641('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9641('0xe'));var Redis=require(_0x9641('0xf'));var authService=require(_0x9641('0x10'));var qs=require(_0x9641('0x11'));var as=require(_0x9641('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9641('0x13'));var utils=require('../../config/utils');var config=require(_0x9641('0x14'));var licenseUtil=require(_0x9641('0x15'));var db=require(_0x9641('0x16'))['db'];config[_0x9641('0x17')]=_[_0x9641('0x18')](config[_0x9641('0x17')],{'host':_0x9641('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9641('0x17')]));require(_0x9641('0x1a'))[_0x9641('0x1b')](socket);var jayson=require(_0x9641('0x1c'));var client=jayson[_0x9641('0x1d')][_0x9641('0x1e')]({'port':0x232c});var client9002=jayson[_0x9641('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49f684,_0x4e5f74,_0x26425e,_0xf67f45){return new BPromise(function(_0x3457ae,_0x4e8564){var _0x2bcdec=_0xf67f45||client;return _0x2bcdec[_0x9641('0x1f')](_0x49f684,_0x26425e)['then'](function(_0x5c962e){logger[_0x9641('0x20')](_0x9641('0x21'),_0x4e5f74,'request\x20sent');logger[_0x9641('0x22')](_0x9641('0x23'),_0x4e5f74,'request\x20sent',JSON['stringify'](_0x5c962e));if(_0x5c962e['error']){if(_0x5c962e['error'][_0x9641('0x24')]===0x1f4){logger[_0x9641('0x25')](_0x9641('0x21'),_0x4e5f74,_0x5c962e[_0x9641('0x25')]['message']);return _0x4e8564(_0x5c962e['error'][_0x9641('0x26')]);}logger['error'](_0x9641('0x21'),_0x4e5f74,_0x5c962e[_0x9641('0x25')][_0x9641('0x26')]);return _0x3457ae(_0x5c962e[_0x9641('0x25')][_0x9641('0x26')]);}else{logger[_0x9641('0x20')](_0x9641('0x21'),_0x4e5f74,_0x9641('0x27'));_0x3457ae(_0x5c962e['result'][_0x9641('0x26')]);}})[_0x9641('0x28')](function(_0x58594f){logger[_0x9641('0x25')](_0x9641('0x21'),_0x4e5f74,_0x58594f);_0x4e8564(_0x58594f);});});}function respondWithStatusCode(_0x46096a,_0x36e45b){_0x36e45b=_0x36e45b||0xcc;return function(_0x5ca1cb){if(_0x5ca1cb){return _0x46096a[_0x9641('0x29')](_0x36e45b);}return _0x46096a[_0x9641('0x2a')](_0x36e45b)['end']();};}function respondWithResult(_0x3de43a,_0x4c2c12){_0x4c2c12=_0x4c2c12||0xc8;return function(_0xe289ad){if(_0xe289ad){return _0x3de43a['status'](_0x4c2c12)[_0x9641('0x2b')](_0xe289ad);}};}function respondWithFilteredResult(_0x4009f2,_0x53b1de){return function(_0x978698){if(_0x978698){var _0x92768e=typeof _0x53b1de[_0x9641('0x2c')]==='undefined'&&typeof _0x53b1de[_0x9641('0x2d')]===_0x9641('0x2e');var _0x87dd5a=_0x978698[_0x9641('0x2f')];var _0x489c1c=_0x92768e?0x0:_0x53b1de[_0x9641('0x2c')];var _0x30008d=_0x92768e?_0x978698[_0x9641('0x2f')]:_0x53b1de[_0x9641('0x2c')]+_0x53b1de['limit'];var _0x3697e9;if(_0x30008d>=_0x87dd5a){_0x30008d=_0x87dd5a;_0x3697e9=0xc8;}else{_0x3697e9=0xce;}_0x4009f2[_0x9641('0x2a')](_0x3697e9);return _0x4009f2[_0x9641('0x30')](_0x9641('0x31'),_0x489c1c+'-'+_0x30008d+'/'+_0x87dd5a)[_0x9641('0x2b')](_0x978698);}return null;};}function patchUpdates(_0x38455d){return function(_0x50e532){try{jsonpatch[_0x9641('0x32')](_0x50e532,_0x38455d,!![]);}catch(_0x10cd1f){return BPromise[_0x9641('0x33')](_0x10cd1f);}return _0x50e532[_0x9641('0x34')]();};}function saveUpdates(_0x3cd896,_0x15b608){return function(_0x882b1d){if(_0x882b1d){return _0x882b1d[_0x9641('0x35')](_0x3cd896)[_0x9641('0x36')](function(_0x3b347c){return _0x3b347c;});}return null;};}function removeEntity(_0x2f5126,_0x549503){return function(_0x44baf8){if(_0x44baf8){return _0x44baf8[_0x9641('0x37')]()[_0x9641('0x36')](function(){_0x2f5126[_0x9641('0x2a')](0xcc)[_0x9641('0x38')]();});}};}function handleEntityNotFound(_0x3cf467,_0x1bd45b){return function(_0x47cb01){if(!_0x47cb01){_0x3cf467[_0x9641('0x29')](0x194);}return _0x47cb01;};}function handleError(_0x1467a0,_0x218aa5){_0x218aa5=_0x218aa5||0x1f4;return function(_0x3f659a){logger[_0x9641('0x25')](_0x3f659a[_0x9641('0x39')]);if(_0x3f659a[_0x9641('0x3a')]){delete _0x3f659a[_0x9641('0x3a')];}_0x1467a0[_0x9641('0x2a')](_0x218aa5)[_0x9641('0x3b')](_0x3f659a);};}exports[_0x9641('0x3c')]=function(_0x469311,_0x48052b){var _0x286add={},_0x539593={},_0x3f42b1={'count':0x0,'rows':[]};var _0x4ff8ee=_[_0x9641('0x3d')](db[_0x9641('0x3e')][_0x9641('0x3f')],function(_0x17061c){return{'name':_0x17061c[_0x9641('0x40')],'type':_0x17061c['type'][_0x9641('0x41')]};});_0x539593[_0x9641('0x42')]=_[_0x9641('0x3d')](_0x4ff8ee,_0x9641('0x3a'));_0x539593[_0x9641('0x43')]=_[_0x9641('0x44')](_0x469311[_0x9641('0x43')]);_0x539593[_0x9641('0x45')]=_[_0x9641('0x46')](_0x539593[_0x9641('0x42')],_0x539593[_0x9641('0x43')]);_0x286add[_0x9641('0x47')]=_[_0x9641('0x46')](_0x539593['model'],qs[_0x9641('0x48')](_0x469311[_0x9641('0x43')][_0x9641('0x48')]));_0x286add[_0x9641('0x47')]=_0x286add[_0x9641('0x47')]['length']?_0x286add['attributes']:_0x539593[_0x9641('0x42')];if(!_0x469311[_0x9641('0x43')][_0x9641('0x49')](_0x9641('0x4a'))){_0x286add[_0x9641('0x2d')]=qs[_0x9641('0x2d')](_0x469311[_0x9641('0x43')][_0x9641('0x2d')]);_0x286add[_0x9641('0x2c')]=qs[_0x9641('0x2c')](_0x469311[_0x9641('0x43')]['offset']);}_0x286add[_0x9641('0x4b')]=qs[_0x9641('0x4c')](_0x469311[_0x9641('0x43')]['sort']);_0x286add[_0x9641('0x4d')]=qs[_0x9641('0x45')](_[_0x9641('0x4e')](_0x469311[_0x9641('0x43')],_0x539593[_0x9641('0x45')]),_0x4ff8ee);if(_0x469311[_0x9641('0x43')][_0x9641('0x4f')]){_0x286add['where']=_[_0x9641('0x50')](_0x286add[_0x9641('0x4d')],{'$or':_['map'](_0x4ff8ee,function(_0x4e2d54){if(_0x4e2d54[_0x9641('0x51')]!=='VIRTUAL'){var _0x1d7953={};_0x1d7953[_0x4e2d54[_0x9641('0x3a')]]={'$like':'%'+_0x469311['query']['filter']+'%'};return _0x1d7953;}})});}_0x286add=_[_0x9641('0x50')]({},_0x286add,_0x469311[_0x9641('0x52')]);var _0x1f5131={'where':_0x286add[_0x9641('0x4d')]};return db[_0x9641('0x3e')][_0x9641('0x2f')](_0x1f5131)['then'](function(_0x2cbd0b){_0x3f42b1['count']=_0x2cbd0b;if(_0x469311['query'][_0x9641('0x53')]){_0x286add['include']=[{'all':!![]}];}return db[_0x9641('0x3e')][_0x9641('0x54')](_0x286add);})['then'](function(_0x57e3ce){_0x3f42b1[_0x9641('0x55')]=_0x57e3ce;return _0x3f42b1;})[_0x9641('0x36')](respondWithFilteredResult(_0x48052b,_0x286add))[_0x9641('0x28')](handleError(_0x48052b,null));};exports['show']=function(_0x2b53ac,_0xddb736){var _0x564408={'raw':!![],'where':{'id':_0x2b53ac['params']['id']}},_0x3eb3c8={};_0x3eb3c8[_0x9641('0x42')]=_[_0x9641('0x44')](db[_0x9641('0x3e')][_0x9641('0x3f')]);_0x3eb3c8[_0x9641('0x43')]=_[_0x9641('0x44')](_0x2b53ac[_0x9641('0x43')]);_0x3eb3c8['filters']=_[_0x9641('0x46')](_0x3eb3c8[_0x9641('0x42')],_0x3eb3c8[_0x9641('0x43')]);_0x564408[_0x9641('0x47')]=_[_0x9641('0x46')](_0x3eb3c8[_0x9641('0x42')],qs['fields'](_0x2b53ac['query']['fields']));_0x564408[_0x9641('0x47')]=_0x564408['attributes'][_0x9641('0x56')]?_0x564408[_0x9641('0x47')]:_0x3eb3c8[_0x9641('0x42')];if(_0x2b53ac['query'][_0x9641('0x53')]){_0x564408[_0x9641('0x57')]=[{'all':!![]}];}_0x564408=_[_0x9641('0x50')]({},_0x564408,_0x2b53ac[_0x9641('0x52')]);return db[_0x9641('0x3e')][_0x9641('0x58')](_0x564408)[_0x9641('0x36')](handleEntityNotFound(_0xddb736,null))['then'](respondWithResult(_0xddb736,null))[_0x9641('0x28')](handleError(_0xddb736,null));};exports[_0x9641('0x59')]=function(_0x44cce0,_0x1285c8){return db[_0x9641('0x3e')]['create'](_0x44cce0[_0x9641('0x5a')],{})['then'](respondWithResult(_0x1285c8,0xc9))[_0x9641('0x28')](handleError(_0x1285c8,null));};exports[_0x9641('0x35')]=function(_0x13e915,_0x585353){if(_0x13e915['body']['id']){delete _0x13e915[_0x9641('0x5a')]['id'];}return db['ChatMessage'][_0x9641('0x58')]({'where':{'id':_0x13e915[_0x9641('0x5b')]['id']}})[_0x9641('0x36')](handleEntityNotFound(_0x585353,null))[_0x9641('0x36')](saveUpdates(_0x13e915[_0x9641('0x5a')],null))[_0x9641('0x36')](respondWithResult(_0x585353,null))[_0x9641('0x28')](handleError(_0x585353,null));};exports[_0x9641('0x37')]=function(_0x24f404,_0x53e8a1){return db['ChatMessage'][_0x9641('0x58')]({'where':{'id':_0x24f404['params']['id']}})[_0x9641('0x36')](handleEntityNotFound(_0x53e8a1,null))['then'](removeEntity(_0x53e8a1,null))[_0x9641('0x28')](handleError(_0x53e8a1,null));};exports[_0x9641('0x5c')]=function(_0x206fb1,_0x34a40a){return db[_0x9641('0x3e')][_0x9641('0x5c')]()[_0x9641('0x36')](respondWithResult(_0x34a40a,null))[_0x9641('0x28')](handleError(_0x34a40a,null));};var interaction_log=require(_0x9641('0x5d'))(_0x9641('0x5e'));exports[_0x9641('0x5f')]=function(_0x299726,_0x15065b,_0x276cb4){var _0x3b02e2={'agent':{},'channel':_0x9641('0x60')};if(_0x299726[_0x9641('0x5a')]['id']){delete _0x299726['body']['id'];}_0x299726[_0x9641('0x5a')][_0x9641('0x61')]=!![];_0x299726[_0x9641('0x5a')][_0x9641('0x62')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x299726[_0x9641('0x5a')][_0x9641('0x63')]=_0x299726[_0x9641('0x5a')][_0x9641('0x63')]||_0x299726['user']['id'];_0x3b02e2['agent']['id']=_0x299726[_0x9641('0x5a')][_0x9641('0x63')];return db[_0x9641('0x3e')][_0x9641('0x58')]({'where':{'id':_0x299726['params']['id'],'UserId':null}})[_0x9641('0x36')](handleEntityNotFound(_0x15065b,null))[_0x9641('0x36')](saveUpdates(_0x299726[_0x9641('0x5a')],null))[_0x9641('0x36')](function(_0x5b7014){if(_0x5b7014){_0x3b02e2[_0x9641('0x26')]=_0x5b7014['get']({'plain':!![]});return db['ChatInteraction'][_0x9641('0x58')]({'where':{'id':_0x5b7014[_0x9641('0x64')]}});}return null;})[_0x9641('0x36')](handleEntityNotFound(_0x15065b,null))[_0x9641('0x36')](function(_0x5d61a7){if(_0x5d61a7){return _0x5d61a7[_0x9641('0x35')]({'UserId':_0x299726['body'][_0x9641('0x63')],'read1stAt':_[_0x9641('0x65')](_0x5d61a7[_0x9641('0x66')])?moment()[_0x9641('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9641('0x36')](function(_0x42bea1){if(_0x42bea1){_0x3b02e2[_0x9641('0x68')]=_0x42bea1[_0x9641('0x69')]({'plain':!![]});interaction_log[_0x9641('0x20')](_0x9641('0x6a'),_0x299726[_0x9641('0x6b')]['id'],_0x299726['user'][_0x9641('0x3a')],_0x299726[_0x9641('0x6b')]['role'],_0x3b02e2[_0x9641('0x68')]['id'],_0x299726[_0x9641('0x5a')]?JSON[_0x9641('0x6c')](_0x299726[_0x9641('0x5a')]):_0x9641('0x6d'));return respondWithRpcPromise(_0x9641('0x6e'),_0x9641('0x6f'),_0x3b02e2);}return null;})[_0x9641('0x36')](function(_0x3541ea){var _0x5979ab=_0x9641('0x70')+_0x3541ea[_0x9641('0x26')][_0x9641('0x71')];return db[_0x9641('0x72')]['query'](_0x5979ab,{'type':db[_0x9641('0x73')]['QueryTypes'][_0x9641('0x74')],'raw':!![]})[_0x9641('0x36')](function(_0x1db984){return _0x1db984;});})[_0x9641('0x36')](function(_0x3fa8bf){if(_0x3fa8bf){_0x3b02e2[_0x9641('0x26')][_0x9641('0x75')]=_0x3fa8bf[0x0];if(!_0x299726[_0x9641('0x5a')]['UserId'])return;return db[_0x9641('0x76')][_0x9641('0x58')]({'where':{'id':_0x299726[_0x9641('0x5a')][_0x9641('0x63')],'role':_0x9641('0x77')},'attributes':['id','name',_0x9641('0x78'),'email','internal'],'raw':!![]});}return null;})[_0x9641('0x36')](function(_0x57d670){if(!_0x57d670)return null;_0x3b02e2[_0x9641('0x26')][_0x9641('0x77')]=_0x57d670;return _0x3b02e2;})['then'](function(_0x4451a4){if(_0x4451a4){if(_0x299726[_0x9641('0x5a')]['manual']){_0x3b02e2[_0x9641('0x26')][_0x9641('0x79')]=util[_0x9641('0x67')]('SIP/%s',_0x299726[_0x9641('0x6b')][_0x9641('0x3a')]);_0x3b02e2[_0x9641('0x26')][_0x9641('0x7a')]=_0x3b02e2[_0x9641('0x7a')];_0x3b02e2[_0x9641('0x26')][_0x9641('0x7b')]=_0x3b02e2[_0x9641('0x7a')];_0x3b02e2['message'][_0x9641('0x7c')]=_0x9641('0x5f');return respondWithRpcPromise('EventManager',_0x9641('0x7d'),{'event':_0x9641('0x7e'),'message':_[_0x9641('0x50')](_0x3b02e2[_0x9641('0x26')],JSON[_0x9641('0x7f')](_0x3b02e2[_0x9641('0x68')][_0x9641('0x80')]))},client9002)[_0x9641('0x36')](function(){return _0x3b02e2;});}return _0x3b02e2;}return null;})[_0x9641('0x36')](respondWithResult(_0x15065b,null))[_0x9641('0x28')](handleError(_0x15065b,null));};var interaction_log=require(_0x9641('0x5d'))(_0x9641('0x5e'));exports[_0x9641('0x33')]=function(_0x4eef47,_0x81d884,_0x4e29af){var _0x4499c7={'agent':{},'channel':'chat'};if(_0x4eef47[_0x9641('0x5a')]['id']){delete _0x4eef47[_0x9641('0x5a')]['id'];}_0x4eef47[_0x9641('0x5a')][_0x9641('0x63')]=_0x4eef47[_0x9641('0x5a')][_0x9641('0x63')]||_0x4eef47[_0x9641('0x6b')]['id'];_0x4499c7['agent']['id']=_0x4eef47['body'][_0x9641('0x63')];return db[_0x9641('0x3e')][_0x9641('0x58')]({'where':{'id':_0x4eef47[_0x9641('0x5b')]['id'],'UserId':null}})[_0x9641('0x36')](handleEntityNotFound(_0x81d884,null))[_0x9641('0x36')](function(_0x10f014){if(_0x10f014){_0x4499c7['message']=_0x10f014['get']({'plain':!![]});return db['ChatInteraction'][_0x9641('0x58')]({'where':{'id':_0x10f014[_0x9641('0x64')]}});}return null;})[_0x9641('0x36')](handleEntityNotFound(_0x81d884,null))['then'](function(_0x35884f){if(_0x35884f){_0x4499c7['interaction']=_0x35884f[_0x9641('0x69')]({'plain':!![]});interaction_log[_0x9641('0x20')](_0x9641('0x81'),_0x4eef47['user']['id'],_0x4eef47[_0x9641('0x6b')][_0x9641('0x3a')],_0x4eef47[_0x9641('0x6b')][_0x9641('0x82')],_0x4499c7[_0x9641('0x68')]['id'],_0x4eef47[_0x9641('0x5a')]?JSON[_0x9641('0x6c')](_0x4eef47[_0x9641('0x5a')]):'null');return respondWithRpcPromise(_0x9641('0x83'),_0x9641('0x84'),_0x4499c7);}return null;})[_0x9641('0x36')](function(_0x11e700){var _0x3ba20f=_0x9641('0x70')+_0x11e700[_0x9641('0x26')][_0x9641('0x71')];return db['sequelize']['query'](_0x3ba20f,{'type':db[_0x9641('0x73')][_0x9641('0x85')][_0x9641('0x74')],'raw':!![]})['then'](function(_0x52a290){return _0x52a290;});})[_0x9641('0x36')](function(_0x30271b){if(_0x30271b){_0x4499c7['message'][_0x9641('0x75')]=_0x30271b[0x0];if(!_0x4eef47[_0x9641('0x5a')][_0x9641('0x63')])return;return db['User']['find']({'where':{'id':_0x4eef47[_0x9641('0x5a')][_0x9641('0x63')],'role':_0x9641('0x77')},'attributes':['id',_0x9641('0x3a'),_0x9641('0x78'),'email',_0x9641('0x86')],'raw':!![]});}return null;})['then'](function(_0x24829f){if(!_0x24829f)return null;_0x4499c7[_0x9641('0x26')]['agent']=_0x24829f;return _0x4499c7;})[_0x9641('0x36')](function(_0x561a63){if(_0x561a63){_0x561a63['message'][_0x9641('0x79')]=util[_0x9641('0x67')]('SIP/%s',_0x4eef47[_0x9641('0x6b')]['name']);_0x561a63['message'][_0x9641('0x7a')]=_0x4499c7['channel'];_0x561a63[_0x9641('0x26')][_0x9641('0x7b')]=_0x4499c7[_0x9641('0x7a')];_0x561a63['message']['event']=_0x9641('0x33');respondWithRpcPromise(_0x9641('0x7d'),_0x9641('0x7d'),{'event':_0x9641('0x87'),'message':_[_0x9641('0x50')](_0x4499c7[_0x9641('0x26')],JSON['parse'](_0x4499c7[_0x9641('0x68')][_0x9641('0x80')]))},client9002);return _0x4499c7;}return null;})[_0x9641('0x36')](respondWithResult(_0x81d884,null))[_0x9641('0x28')](handleError(_0x81d884,null));}; \ No newline at end of file +var _0x19e3=['order','sort','pick','filter','where','merge','includeAll','findAll','rows','show','params','include','options','create','body','update','find','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','get','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','stack','name','index','ChatMessage','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit'];(function(_0x471aaa,_0x2610ea){var _0x473db5=function(_0x291234){while(--_0x291234){_0x471aaa['push'](_0x471aaa['shift']());}};_0x473db5(++_0x2610ea);}(_0x19e3,0x1d3));var _0x319e=function(_0x556ea1,_0x4a2822){_0x556ea1=_0x556ea1-0x0;var _0x24071e=_0x19e3[_0x556ea1];return _0x24071e;};'use strict';var emlformat=require(_0x319e('0x0'));var rimraf=require(_0x319e('0x1'));var zipdir=require(_0x319e('0x2'));var jsonpatch=require(_0x319e('0x3'));var rp=require(_0x319e('0x4'));var moment=require(_0x319e('0x5'));var BPromise=require(_0x319e('0x6'));var Mustache=require(_0x319e('0x7'));var util=require(_0x319e('0x8'));var path=require(_0x319e('0x9'));var sox=require(_0x319e('0xa'));var csv=require(_0x319e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x319e('0xc'));var _=require(_0x319e('0xd'));var squel=require(_0x319e('0xe'));var crypto=require(_0x319e('0xf'));var jsforce=require(_0x319e('0x10'));var deskjs=require(_0x319e('0x11'));var toCsv=require('to-csv');var querystring=require(_0x319e('0x12'));var Papa=require('papaparse');var Redis=require(_0x319e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x319e('0x14'));var as=require(_0x319e('0x15'));var hardwareService=require(_0x319e('0x16'));var logger=require(_0x319e('0x17'))(_0x319e('0x18'));var utils=require(_0x319e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x319e('0x1a'))['db'];config[_0x319e('0x1b')]=_[_0x319e('0x1c')](config['redis'],{'host':_0x319e('0x1d'),'port':0x18eb});var socket=require(_0x319e('0x1e'))(new Redis(config[_0x319e('0x1b')]));require(_0x319e('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x319e('0x20')]({'port':0x232c});var client9002=jayson[_0x319e('0x21')][_0x319e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x28f483,_0x51bf55,_0x126313,_0x1712ba){return new BPromise(function(_0x4f22b4,_0x5e8626){var _0x4a13c1=_0x1712ba||client;return _0x4a13c1[_0x319e('0x22')](_0x28f483,_0x126313)[_0x319e('0x23')](function(_0x10b86c){logger[_0x319e('0x24')](_0x319e('0x25'),_0x51bf55,_0x319e('0x26'));logger[_0x319e('0x27')](_0x319e('0x28'),_0x51bf55,_0x319e('0x26'),JSON[_0x319e('0x29')](_0x10b86c));if(_0x10b86c[_0x319e('0x2a')]){if(_0x10b86c['error']['code']===0x1f4){logger[_0x319e('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x51bf55,_0x10b86c[_0x319e('0x2a')]['message']);return _0x5e8626(_0x10b86c[_0x319e('0x2a')][_0x319e('0x2b')]);}logger[_0x319e('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x51bf55,_0x10b86c[_0x319e('0x2a')][_0x319e('0x2b')]);return _0x4f22b4(_0x10b86c[_0x319e('0x2a')][_0x319e('0x2b')]);}else{logger[_0x319e('0x24')](_0x319e('0x25'),_0x51bf55,'request\x20sent');_0x4f22b4(_0x10b86c[_0x319e('0x2c')][_0x319e('0x2b')]);}})[_0x319e('0x2d')](function(_0x338f5b){logger[_0x319e('0x2a')](_0x319e('0x25'),_0x51bf55,_0x338f5b);_0x5e8626(_0x338f5b);});});}function respondWithStatusCode(_0x53e148,_0x367715){_0x367715=_0x367715||0xcc;return function(_0x3b4a33){if(_0x3b4a33){return _0x53e148['sendStatus'](_0x367715);}return _0x53e148[_0x319e('0x2e')](_0x367715)[_0x319e('0x2f')]();};}function respondWithResult(_0x536b5b,_0x7608ec){_0x7608ec=_0x7608ec||0xc8;return function(_0x1af6a4){if(_0x1af6a4){return _0x536b5b[_0x319e('0x2e')](_0x7608ec)[_0x319e('0x30')](_0x1af6a4);}};}function respondWithFilteredResult(_0x2d1809,_0xdcadf0){return function(_0x29bfd5){if(_0x29bfd5){var _0xef5dfe=typeof _0xdcadf0[_0x319e('0x31')]===_0x319e('0x32')&&typeof _0xdcadf0[_0x319e('0x33')]===_0x319e('0x32');var _0x8fb55b=_0x29bfd5['count'];var _0x344c58=_0xef5dfe?0x0:_0xdcadf0['offset'];var _0x1971f8=_0xef5dfe?_0x29bfd5[_0x319e('0x34')]:_0xdcadf0[_0x319e('0x31')]+_0xdcadf0['limit'];var _0x556a26;if(_0x1971f8>=_0x8fb55b){_0x1971f8=_0x8fb55b;_0x556a26=0xc8;}else{_0x556a26=0xce;}_0x2d1809[_0x319e('0x2e')](_0x556a26);return _0x2d1809[_0x319e('0x35')](_0x319e('0x36'),_0x344c58+'-'+_0x1971f8+'/'+_0x8fb55b)['json'](_0x29bfd5);}return null;};}function patchUpdates(_0x4f4284){return function(_0x30bcd1){try{jsonpatch[_0x319e('0x37')](_0x30bcd1,_0x4f4284,!![]);}catch(_0x119032){return BPromise[_0x319e('0x38')](_0x119032);}return _0x30bcd1['save']();};}function saveUpdates(_0x31f597,_0x50391d){return function(_0x22529a){if(_0x22529a){return _0x22529a['update'](_0x31f597)['then'](function(_0x4413c7){return _0x4413c7;});}return null;};}function removeEntity(_0x3ccb42,_0x38e7db){return function(_0x409acb){if(_0x409acb){return _0x409acb[_0x319e('0x39')]()[_0x319e('0x23')](function(){_0x3ccb42[_0x319e('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ac20,_0x4c541c){return function(_0x7dc266){if(!_0x7dc266){_0x52ac20['sendStatus'](0x194);}return _0x7dc266;};}function handleError(_0x327bf8,_0x120f43){_0x120f43=_0x120f43||0x1f4;return function(_0x262cc1){logger['error'](_0x262cc1[_0x319e('0x3a')]);if(_0x262cc1['name']){delete _0x262cc1[_0x319e('0x3b')];}_0x327bf8[_0x319e('0x2e')](_0x120f43)['send'](_0x262cc1);};}exports[_0x319e('0x3c')]=function(_0x45b38e,_0x5ba84c){var _0x16c6b4={},_0x21c659={},_0x1a6c94={'count':0x0,'rows':[]};var _0x4c89a8=_['map'](db[_0x319e('0x3d')][_0x319e('0x3e')],function(_0xeebfb4){return{'name':_0xeebfb4[_0x319e('0x3f')],'type':_0xeebfb4[_0x319e('0x40')][_0x319e('0x41')]};});_0x21c659[_0x319e('0x42')]=_[_0x319e('0x43')](_0x4c89a8,'name');_0x21c659['query']=_[_0x319e('0x44')](_0x45b38e['query']);_0x21c659[_0x319e('0x45')]=_[_0x319e('0x46')](_0x21c659[_0x319e('0x42')],_0x21c659['query']);_0x16c6b4[_0x319e('0x47')]=_['intersection'](_0x21c659['model'],qs['fields'](_0x45b38e['query'][_0x319e('0x48')]));_0x16c6b4['attributes']=_0x16c6b4[_0x319e('0x47')][_0x319e('0x49')]?_0x16c6b4['attributes']:_0x21c659[_0x319e('0x42')];if(!_0x45b38e[_0x319e('0x4a')][_0x319e('0x4b')](_0x319e('0x4c'))){_0x16c6b4['limit']=qs[_0x319e('0x33')](_0x45b38e[_0x319e('0x4a')][_0x319e('0x33')]);_0x16c6b4[_0x319e('0x31')]=qs[_0x319e('0x31')](_0x45b38e[_0x319e('0x4a')][_0x319e('0x31')]);}_0x16c6b4[_0x319e('0x4d')]=qs[_0x319e('0x4e')](_0x45b38e['query'][_0x319e('0x4e')]);_0x16c6b4['where']=qs[_0x319e('0x45')](_[_0x319e('0x4f')](_0x45b38e[_0x319e('0x4a')],_0x21c659[_0x319e('0x45')]),_0x4c89a8);if(_0x45b38e['query'][_0x319e('0x50')]){_0x16c6b4[_0x319e('0x51')]=_[_0x319e('0x52')](_0x16c6b4[_0x319e('0x51')],{'$or':_[_0x319e('0x43')](_0x4c89a8,function(_0x4a5f56){if(_0x4a5f56[_0x319e('0x40')]!=='VIRTUAL'){var _0xe99787={};_0xe99787[_0x4a5f56[_0x319e('0x3b')]]={'$like':'%'+_0x45b38e['query'][_0x319e('0x50')]+'%'};return _0xe99787;}})});}_0x16c6b4=_[_0x319e('0x52')]({},_0x16c6b4,_0x45b38e['options']);var _0x737008={'where':_0x16c6b4['where']};return db['ChatMessage'][_0x319e('0x34')](_0x737008)[_0x319e('0x23')](function(_0x3deca1){_0x1a6c94[_0x319e('0x34')]=_0x3deca1;if(_0x45b38e[_0x319e('0x4a')][_0x319e('0x53')]){_0x16c6b4['include']=[{'all':!![]}];}return db[_0x319e('0x3d')][_0x319e('0x54')](_0x16c6b4);})[_0x319e('0x23')](function(_0x434374){_0x1a6c94[_0x319e('0x55')]=_0x434374;return _0x1a6c94;})['then'](respondWithFilteredResult(_0x5ba84c,_0x16c6b4))['catch'](handleError(_0x5ba84c,null));};exports[_0x319e('0x56')]=function(_0x109d6e,_0x56a07a){var _0x12b3ae={'raw':!![],'where':{'id':_0x109d6e[_0x319e('0x57')]['id']}},_0x7faea8={};_0x7faea8[_0x319e('0x42')]=_[_0x319e('0x44')](db[_0x319e('0x3d')][_0x319e('0x3e')]);_0x7faea8[_0x319e('0x4a')]=_[_0x319e('0x44')](_0x109d6e['query']);_0x7faea8['filters']=_['intersection'](_0x7faea8['model'],_0x7faea8[_0x319e('0x4a')]);_0x12b3ae[_0x319e('0x47')]=_[_0x319e('0x46')](_0x7faea8['model'],qs['fields'](_0x109d6e[_0x319e('0x4a')][_0x319e('0x48')]));_0x12b3ae[_0x319e('0x47')]=_0x12b3ae[_0x319e('0x47')][_0x319e('0x49')]?_0x12b3ae[_0x319e('0x47')]:_0x7faea8[_0x319e('0x42')];if(_0x109d6e[_0x319e('0x4a')][_0x319e('0x53')]){_0x12b3ae[_0x319e('0x58')]=[{'all':!![]}];}_0x12b3ae=_['merge']({},_0x12b3ae,_0x109d6e[_0x319e('0x59')]);return db[_0x319e('0x3d')]['find'](_0x12b3ae)['then'](handleEntityNotFound(_0x56a07a,null))[_0x319e('0x23')](respondWithResult(_0x56a07a,null))[_0x319e('0x2d')](handleError(_0x56a07a,null));};exports[_0x319e('0x5a')]=function(_0x13eb5e,_0xa6f63b){return db[_0x319e('0x3d')]['create'](_0x13eb5e[_0x319e('0x5b')],{})[_0x319e('0x23')](respondWithResult(_0xa6f63b,0xc9))[_0x319e('0x2d')](handleError(_0xa6f63b,null));};exports[_0x319e('0x5c')]=function(_0xa5494d,_0x526463){if(_0xa5494d[_0x319e('0x5b')]['id']){delete _0xa5494d[_0x319e('0x5b')]['id'];}return db[_0x319e('0x3d')][_0x319e('0x5d')]({'where':{'id':_0xa5494d[_0x319e('0x57')]['id']}})[_0x319e('0x23')](handleEntityNotFound(_0x526463,null))[_0x319e('0x23')](saveUpdates(_0xa5494d[_0x319e('0x5b')],null))[_0x319e('0x23')](respondWithResult(_0x526463,null))[_0x319e('0x2d')](handleError(_0x526463,null));};exports[_0x319e('0x39')]=function(_0x3e41a2,_0x43d641){return db['ChatMessage']['find']({'where':{'id':_0x3e41a2['params']['id']}})['then'](handleEntityNotFound(_0x43d641,null))[_0x319e('0x23')](removeEntity(_0x43d641,null))['catch'](handleError(_0x43d641,null));};exports[_0x319e('0x5e')]=function(_0x21b423,_0x4719ab){return db[_0x319e('0x3d')]['describe']()[_0x319e('0x23')](respondWithResult(_0x4719ab,null))[_0x319e('0x2d')](handleError(_0x4719ab,null));};var interaction_log=require(_0x319e('0x17'))(_0x319e('0x5f'));exports[_0x319e('0x60')]=function(_0x548be0,_0x47bc62,_0x35501f){var _0x15907a={'agent':{},'channel':_0x319e('0x61')};if(_0x548be0[_0x319e('0x5b')]['id']){delete _0x548be0['body']['id'];}_0x548be0[_0x319e('0x5b')]['read']=!![];_0x548be0['body'][_0x319e('0x62')]=moment()[_0x319e('0x63')](_0x319e('0x64'));_0x548be0[_0x319e('0x5b')][_0x319e('0x65')]=_0x548be0[_0x319e('0x5b')]['UserId']||_0x548be0[_0x319e('0x66')]['id'];_0x15907a[_0x319e('0x67')]['id']=_0x548be0[_0x319e('0x5b')][_0x319e('0x65')];return db['ChatMessage'][_0x319e('0x5d')]({'where':{'id':_0x548be0['params']['id'],'UserId':null}})[_0x319e('0x23')](handleEntityNotFound(_0x47bc62,null))[_0x319e('0x23')](saveUpdates(_0x548be0[_0x319e('0x5b')],null))[_0x319e('0x23')](function(_0x13a173){if(_0x13a173){_0x15907a[_0x319e('0x2b')]=_0x13a173['get']({'plain':!![]});return db[_0x319e('0x68')]['find']({'where':{'id':_0x13a173[_0x319e('0x69')]}});}return null;})[_0x319e('0x23')](handleEntityNotFound(_0x47bc62,null))[_0x319e('0x23')](function(_0x4946fe){if(_0x4946fe){return _0x4946fe[_0x319e('0x5c')]({'UserId':_0x548be0[_0x319e('0x5b')][_0x319e('0x65')],'read1stAt':_[_0x319e('0x6a')](_0x4946fe[_0x319e('0x6b')])?moment()[_0x319e('0x63')](_0x319e('0x64')):undefined});}return null;})[_0x319e('0x23')](function(_0x153156){if(_0x153156){_0x15907a['interaction']=_0x153156[_0x319e('0x6c')]({'plain':!![]});interaction_log[_0x319e('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x548be0[_0x319e('0x66')]['id'],_0x548be0[_0x319e('0x66')][_0x319e('0x3b')],_0x548be0[_0x319e('0x66')]['role'],_0x15907a['interaction']['id'],_0x548be0[_0x319e('0x5b')]?JSON['stringify'](_0x548be0[_0x319e('0x5b')]):_0x319e('0x6d'));return respondWithRpcPromise(_0x319e('0x6e'),_0x319e('0x6f'),_0x15907a);}return null;})['then'](function(_0x11500e){var _0xd22c9f=_0x319e('0x70')+_0x11500e[_0x319e('0x2b')][_0x319e('0x71')];return db['sequelize'][_0x319e('0x4a')](_0xd22c9f,{'type':db[_0x319e('0x72')][_0x319e('0x73')][_0x319e('0x74')],'raw':!![]})[_0x319e('0x23')](function(_0x1d2c5a){return _0x1d2c5a;});})[_0x319e('0x23')](function(_0x52f38d){if(_0x52f38d){_0x15907a[_0x319e('0x2b')]['contact']=_0x52f38d[0x0];if(!_0x548be0[_0x319e('0x5b')]['UserId'])return;return db[_0x319e('0x75')][_0x319e('0x5d')]({'where':{'id':_0x548be0[_0x319e('0x5b')][_0x319e('0x65')],'role':'agent'},'attributes':['id',_0x319e('0x3b'),_0x319e('0x76'),_0x319e('0x77'),_0x319e('0x78')],'raw':!![]});}return null;})[_0x319e('0x23')](function(_0x26346c){if(!_0x26346c)return null;_0x15907a[_0x319e('0x2b')][_0x319e('0x67')]=_0x26346c;return _0x15907a;})[_0x319e('0x23')](function(_0x4a6a85){if(_0x4a6a85){if(_0x548be0[_0x319e('0x5b')][_0x319e('0x79')]){_0x15907a[_0x319e('0x2b')][_0x319e('0x7a')]=util['format'](_0x319e('0x7b'),_0x548be0['user'][_0x319e('0x3b')]);_0x15907a[_0x319e('0x2b')][_0x319e('0x7c')]=_0x15907a[_0x319e('0x7c')];_0x15907a[_0x319e('0x2b')][_0x319e('0x7d')]=_0x15907a[_0x319e('0x7c')];_0x15907a['message']['event']='accept';return respondWithRpcPromise(_0x319e('0x7e'),_0x319e('0x7e'),{'event':_0x319e('0x7f'),'message':_[_0x319e('0x52')](_0x15907a[_0x319e('0x2b')],JSON[_0x319e('0x80')](_0x15907a['interaction'][_0x319e('0x81')]))},client9002)[_0x319e('0x23')](function(){return _0x15907a;});}return _0x15907a;}return null;})[_0x319e('0x23')](respondWithResult(_0x47bc62,null))[_0x319e('0x2d')](handleError(_0x47bc62,null));};var interaction_log=require(_0x319e('0x17'))(_0x319e('0x5f'));exports['reject']=function(_0x1b925b,_0x4f18da,_0x3118d5){var _0x709160={'agent':{},'channel':_0x319e('0x61')};if(_0x1b925b[_0x319e('0x5b')]['id']){delete _0x1b925b[_0x319e('0x5b')]['id'];}_0x1b925b['body'][_0x319e('0x65')]=_0x1b925b['body']['UserId']||_0x1b925b[_0x319e('0x66')]['id'];_0x709160['agent']['id']=_0x1b925b[_0x319e('0x5b')][_0x319e('0x65')];return db[_0x319e('0x3d')][_0x319e('0x5d')]({'where':{'id':_0x1b925b[_0x319e('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f18da,null))[_0x319e('0x23')](function(_0x38984a){if(_0x38984a){_0x709160[_0x319e('0x2b')]=_0x38984a[_0x319e('0x6c')]({'plain':!![]});return db[_0x319e('0x68')][_0x319e('0x5d')]({'where':{'id':_0x38984a[_0x319e('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x4f18da,null))['then'](function(_0x20d3eb){if(_0x20d3eb){_0x709160[_0x319e('0x82')]=_0x20d3eb[_0x319e('0x6c')]({'plain':!![]});interaction_log[_0x319e('0x24')](_0x319e('0x83'),_0x1b925b[_0x319e('0x66')]['id'],_0x1b925b[_0x319e('0x66')][_0x319e('0x3b')],_0x1b925b['user']['role'],_0x709160[_0x319e('0x82')]['id'],_0x1b925b[_0x319e('0x5b')]?JSON['stringify'](_0x1b925b[_0x319e('0x5b')]):_0x319e('0x6d'));return respondWithRpcPromise(_0x319e('0x84'),'rejectMessage',_0x709160);}return null;})[_0x319e('0x23')](function(_0x19488e){var _0x5b1755=_0x319e('0x70')+_0x19488e[_0x319e('0x2b')]['ContactId'];return db[_0x319e('0x85')][_0x319e('0x4a')](_0x5b1755,{'type':db['Sequelize'][_0x319e('0x73')][_0x319e('0x74')],'raw':!![]})[_0x319e('0x23')](function(_0x173c75){return _0x173c75;});})[_0x319e('0x23')](function(_0x1dcb01){if(_0x1dcb01){_0x709160[_0x319e('0x2b')]['contact']=_0x1dcb01[0x0];if(!_0x1b925b[_0x319e('0x5b')][_0x319e('0x65')])return;return db['User'][_0x319e('0x5d')]({'where':{'id':_0x1b925b[_0x319e('0x5b')][_0x319e('0x65')],'role':_0x319e('0x67')},'attributes':['id',_0x319e('0x3b'),_0x319e('0x76'),_0x319e('0x77'),_0x319e('0x78')],'raw':!![]});}return null;})[_0x319e('0x23')](function(_0x1075d3){if(!_0x1075d3)return null;_0x709160['message'][_0x319e('0x67')]=_0x1075d3;return _0x709160;})[_0x319e('0x23')](function(_0x3c8aad){if(_0x3c8aad){_0x3c8aad[_0x319e('0x2b')]['interface']=util[_0x319e('0x63')](_0x319e('0x7b'),_0x1b925b[_0x319e('0x66')][_0x319e('0x3b')]);_0x3c8aad[_0x319e('0x2b')][_0x319e('0x7c')]=_0x709160[_0x319e('0x7c')];_0x3c8aad[_0x319e('0x2b')][_0x319e('0x7d')]=_0x709160[_0x319e('0x7c')];_0x3c8aad[_0x319e('0x2b')][_0x319e('0x86')]=_0x319e('0x38');respondWithRpcPromise(_0x319e('0x7e'),_0x319e('0x7e'),{'event':_0x319e('0x87'),'message':_[_0x319e('0x52')](_0x709160['message'],JSON[_0x319e('0x80')](_0x709160[_0x319e('0x82')][_0x319e('0x81')]))},client9002);return _0x709160;}return null;})[_0x319e('0x23')](respondWithResult(_0x4f18da,null))[_0x319e('0x2d')](handleError(_0x4f18da,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b7da3dd..920825e 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x117f=['ChatMessage','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1241ba,_0x529e24){var _0x2f01df=function(_0x52463d){while(--_0x52463d){_0x1241ba['push'](_0x1241ba['shift']());}};_0x2f01df(++_0x529e24);}(_0x117f,0x1e4));var _0xf117=function(_0x135c72,_0x2fe069){_0x135c72=_0x135c72-0x0;var _0x52191b=_0x117f[_0x135c72];return _0x52191b;};'use strict';var EventEmitter=require(_0xf117('0x0'));var ChatMessage=require(_0xf117('0x1'))['db'][_0xf117('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf117('0x3'),'afterUpdate':_0xf117('0x4'),'afterDestroy':_0xf117('0x5')};function emitEvent(_0x3fe2f6){return function(_0x5767f9,_0x3d943e,_0x391031){ChatMessageEvents['emit'](_0x3fe2f6+':'+_0x5767f9['id'],_0x5767f9);ChatMessageEvents[_0xf117('0x6')](_0x3fe2f6,_0x5767f9);_0x391031(null);};}for(var e in events){if(events[_0xf117('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xf117('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x31bc=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save','update','remove'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x31bc,0xa4));var _0xc31b=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x31bc[_0x3b2369];return _0x5a1367;};'use strict';var EventEmitter=require(_0xc31b('0x0'));var ChatMessage=require(_0xc31b('0x1'))['db'][_0xc31b('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc31b('0x3'),'afterUpdate':_0xc31b('0x4'),'afterDestroy':_0xc31b('0x5')};function emitEvent(_0x2de83a){return function(_0x39af46,_0x2800f2,_0x2f02d7){ChatMessageEvents[_0xc31b('0x6')](_0x2de83a+':'+_0x39af46['id'],_0x39af46);ChatMessageEvents[_0xc31b('0x6')](_0x2de83a,_0x39af46);_0x2f02d7(null);};}for(var e in events){if(events[_0xc31b('0x7')](e)){var event=events[e];ChatMessage[_0xc31b('0x8')](e,emitEvent(event));}}module[_0xc31b('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 77df0a9..b5dac85 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2e7=['path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x167574,_0x288293){var _0x10e73f=function(_0x8ed259){while(--_0x8ed259){_0x167574['push'](_0x167574['shift']());}};_0x10e73f(++_0x288293);}(_0xa2e7,0x185));var _0x7a2e=function(_0x5d7dc8,_0x14a0fc){_0x5d7dc8=_0x5d7dc8-0x0;var _0x4b99bb=_0xa2e7[_0x5d7dc8];return _0x4b99bb;};'use strict';var _=require(_0x7a2e('0x0'));var util=require(_0x7a2e('0x1'));var logger=require(_0x7a2e('0x2'))(_0x7a2e('0x3'));var moment=require(_0x7a2e('0x4'));var BPromise=require(_0x7a2e('0x5'));var rp=require(_0x7a2e('0x6'));var fs=require('fs');var path=require(_0x7a2e('0x7'));var rimraf=require('rimraf');var config=require(_0x7a2e('0x8'));var attributes=require(_0x7a2e('0x9'));module[_0x7a2e('0xa')]=function(_0x4b942d,_0x253ae2){return _0x4b942d[_0x7a2e('0xb')](_0x7a2e('0xc'),attributes,{'tableName':_0x7a2e('0xd'),'paranoid':![],'indexes':[{'name':_0x7a2e('0xe'),'fields':[_0x7a2e('0xf')],'type':_0x7a2e('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10ef14,_0x45f210,_0x2643bb){var _0x2c9454=_0x4b942d[_0x7a2e('0x11')];var _0x283eae=_0x10ef14[_0x7a2e('0x12')]({'plain':!![]});if(_0x283eae['direction']['toLowerCase']()==='in'||_0x283eae[_0x7a2e('0x13')][_0x7a2e('0x14')]()===_0x7a2e('0x15')&&!_0x283eae[_0x7a2e('0x16')]&&!_[_0x7a2e('0x17')](_0x283eae[_0x7a2e('0x18')])){_0x2c9454['ChatInteraction'][_0x7a2e('0x19')]({'where':{'id':_0x283eae['ChatInteractionId']}})[_0x7a2e('0x1a')](function(_0xf28220){if(_0xf28220){_0xf28220[_0x7a2e('0x1b')]({'lastMsgAt':_0x283eae[_0x7a2e('0x1c')],'lastMsgDirection':_0x283eae[_0x7a2e('0x13')][_0x7a2e('0x14')]()});}})[_0x7a2e('0x1d')](function(_0x5f53ea){console[_0x7a2e('0x1e')](_0x5f53ea);});}_0x2643bb();}},'charset':_0x7a2e('0x1f'),'collate':_0x7a2e('0x20')});}; \ No newline at end of file +var _0xec96=['out','secret','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x2a28be,_0xbc384d){var _0x547fa3=function(_0x1710ad){while(--_0x1710ad){_0x2a28be['push'](_0x2a28be['shift']());}};_0x547fa3(++_0xbc384d);}(_0xec96,0x119));var _0x6ec9=function(_0x53fd80,_0x72b68f){_0x53fd80=_0x53fd80-0x0;var _0xb45d81=_0xec96[_0x53fd80];return _0xb45d81;};'use strict';var _=require(_0x6ec9('0x0'));var util=require(_0x6ec9('0x1'));var logger=require(_0x6ec9('0x2'))(_0x6ec9('0x3'));var moment=require(_0x6ec9('0x4'));var BPromise=require(_0x6ec9('0x5'));var rp=require(_0x6ec9('0x6'));var fs=require('fs');var path=require(_0x6ec9('0x7'));var rimraf=require('rimraf');var config=require(_0x6ec9('0x8'));var attributes=require(_0x6ec9('0x9'));module['exports']=function(_0x2a37b6,_0x3ccc23){return _0x2a37b6[_0x6ec9('0xa')](_0x6ec9('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x6ec9('0xc'),'fields':[_0x6ec9('0xd')],'type':_0x6ec9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x153d1e,_0x17e5c8,_0x534a95){var _0x583926=_0x2a37b6[_0x6ec9('0xf')];var _0x51af42=_0x153d1e[_0x6ec9('0x10')]({'plain':!![]});if(_0x51af42[_0x6ec9('0x11')]['toLowerCase']()==='in'||_0x51af42[_0x6ec9('0x11')][_0x6ec9('0x12')]()===_0x6ec9('0x13')&&!_0x51af42[_0x6ec9('0x14')]&&!_['isNil'](_0x51af42[_0x6ec9('0x15')])){_0x583926[_0x6ec9('0x16')]['findOne']({'where':{'id':_0x51af42[_0x6ec9('0x17')]}})[_0x6ec9('0x18')](function(_0x1acef4){if(_0x1acef4){_0x1acef4[_0x6ec9('0x19')]({'lastMsgAt':_0x51af42[_0x6ec9('0x1a')],'lastMsgDirection':_0x51af42[_0x6ec9('0x11')][_0x6ec9('0x12')]()});}})[_0x6ec9('0x1b')](function(_0x29120c){console[_0x6ec9('0x1c')](_0x29120c);});}_0x534a95();}},'charset':_0x6ec9('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 300e179..7a5b250 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31a2=['error','code','message','catch','CreateChatMessage','ChatMessage','body','options','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x42868d,_0x165917){var _0xd29bb1=function(_0x252969){while(--_0x252969){_0x42868d['push'](_0x42868d['shift']());}};_0xd29bb1(++_0x165917);}(_0x31a2,0x116));var _0x231a=function(_0x4b1875,_0x1fae56){_0x4b1875=_0x4b1875-0x0;var _0x2c688b=_0x31a2[_0x4b1875];return _0x2c688b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x231a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x231a('0x1'));var db=require(_0x231a('0x2'))['db'];var utils=require(_0x231a('0x3'));var logger=require(_0x231a('0x4'))(_0x231a('0x5'));var config=require(_0x231a('0x6'));var jayson=require(_0x231a('0x7'));var client=jayson['client'][_0x231a('0x8')]({'port':0x232a});config['redis']=_[_0x231a('0x9')](config[_0x231a('0xa')],{'host':_0x231a('0xb'),'port':0x18eb});var socket=require(_0x231a('0xc'))(new Redis(config[_0x231a('0xa')]));require(_0x231a('0xd'))[_0x231a('0xe')](socket);function respondWithRpcPromise(_0x2e754f,_0x16270b,_0x7f339){return new BPromise(function(_0xfb72e3,_0x4915ec){return client[_0x231a('0xf')](_0x2e754f,_0x7f339)[_0x231a('0x10')](function(_0x1e2bb7){logger[_0x231a('0x11')](_0x231a('0x12'),_0x16270b,_0x231a('0x13'));logger[_0x231a('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x16270b,_0x231a('0x13'),JSON[_0x231a('0x15')](_0x1e2bb7));if(_0x1e2bb7['error']){if(_0x1e2bb7[_0x231a('0x16')][_0x231a('0x17')]===0x1f4){logger[_0x231a('0x16')]('ChatMessage,\x20%s,\x20%s',_0x16270b,_0x1e2bb7['error']['message']);return _0x4915ec(_0x1e2bb7[_0x231a('0x16')][_0x231a('0x18')]);}logger[_0x231a('0x16')](_0x231a('0x12'),_0x16270b,_0x1e2bb7[_0x231a('0x16')][_0x231a('0x18')]);return _0xfb72e3(_0x1e2bb7[_0x231a('0x16')]['message']);}else{logger[_0x231a('0x11')]('ChatMessage,\x20%s,\x20%s',_0x16270b,_0x231a('0x13'));_0xfb72e3(_0x1e2bb7['result'][_0x231a('0x18')]);}})[_0x231a('0x19')](function(_0xe7eade){logger[_0x231a('0x16')](_0x231a('0x12'),_0x16270b,_0xe7eade);_0x4915ec(_0xe7eade);});});}exports[_0x231a('0x1a')]=function(_0x99c3c0){var _0x55529a=this;return new Promise(function(_0x2a4dcb,_0x84cde9){return db[_0x231a('0x1b')]['create'](_0x99c3c0[_0x231a('0x1c')],{'raw':_0x99c3c0['options']?_0x99c3c0[_0x231a('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x231a('0x10')](function(_0x485359){logger[_0x231a('0x11')](_0x231a('0x1a'),_0x99c3c0);logger[_0x231a('0x14')](_0x231a('0x1a'),_0x99c3c0,JSON[_0x231a('0x15')](_0x485359));_0x2a4dcb(_0x485359);})['catch'](function(_0x5bba16){logger[_0x231a('0x16')](_0x231a('0x1a'),_0x5bba16[_0x231a('0x18')],_0x99c3c0);_0x84cde9(_0x55529a[_0x231a('0x16')](0x1f4,_0x5bba16[_0x231a('0x18')]));});});}; \ No newline at end of file +var _0xa5e1=['request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','ChatMessage,\x20%s,\x20%s','message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','then','info'];(function(_0x442c92,_0x2d7ce5){var _0x62d31=function(_0x10d28c){while(--_0x10d28c){_0x442c92['push'](_0x442c92['shift']());}};_0x62d31(++_0x2d7ce5);}(_0xa5e1,0x1dd));var _0x1a5e=function(_0x1e62b8,_0x5eed4c){_0x1e62b8=_0x1e62b8-0x0;var _0x2ab271=_0xa5e1[_0x1e62b8];return _0x2ab271;};'use strict';var _=require('lodash');var util=require(_0x1a5e('0x0'));var moment=require(_0x1a5e('0x1'));var BPromise=require(_0x1a5e('0x2'));var rs=require(_0x1a5e('0x3'));var fs=require('fs');var Redis=require(_0x1a5e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a5e('0x5'));var logger=require(_0x1a5e('0x6'))(_0x1a5e('0x7'));var config=require(_0x1a5e('0x8'));var jayson=require(_0x1a5e('0x9'));var client=jayson[_0x1a5e('0xa')][_0x1a5e('0xb')]({'port':0x232a});config[_0x1a5e('0xc')]=_[_0x1a5e('0xd')](config[_0x1a5e('0xc')],{'host':_0x1a5e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a5e('0xc')]));require(_0x1a5e('0xf'))['register'](socket);function respondWithRpcPromise(_0x38dbc6,_0x67ced5,_0x3f098b){return new BPromise(function(_0x40c9fd,_0x4385da){return client['request'](_0x38dbc6,_0x3f098b)[_0x1a5e('0x10')](function(_0x37a49d){logger[_0x1a5e('0x11')]('ChatMessage,\x20%s,\x20%s',_0x67ced5,_0x1a5e('0x12'));logger[_0x1a5e('0x13')](_0x1a5e('0x14'),_0x67ced5,'request\x20sent',JSON['stringify'](_0x37a49d));if(_0x37a49d[_0x1a5e('0x15')]){if(_0x37a49d[_0x1a5e('0x15')]['code']===0x1f4){logger[_0x1a5e('0x15')](_0x1a5e('0x16'),_0x67ced5,_0x37a49d[_0x1a5e('0x15')][_0x1a5e('0x17')]);return _0x4385da(_0x37a49d[_0x1a5e('0x15')][_0x1a5e('0x17')]);}logger['error'](_0x1a5e('0x16'),_0x67ced5,_0x37a49d['error'][_0x1a5e('0x17')]);return _0x40c9fd(_0x37a49d['error'][_0x1a5e('0x17')]);}else{logger[_0x1a5e('0x11')](_0x1a5e('0x16'),_0x67ced5,_0x1a5e('0x12'));_0x40c9fd(_0x37a49d[_0x1a5e('0x18')][_0x1a5e('0x17')]);}})[_0x1a5e('0x19')](function(_0x71ccc7){logger[_0x1a5e('0x15')](_0x1a5e('0x16'),_0x67ced5,_0x71ccc7);_0x4385da(_0x71ccc7);});});}exports['CreateChatMessage']=function(_0x4ff6b7){var _0x1b74a9=this;return new Promise(function(_0x8abec8,_0x28181c){return db[_0x1a5e('0x1a')][_0x1a5e('0x1b')](_0x4ff6b7[_0x1a5e('0x1c')],{'raw':_0x4ff6b7[_0x1a5e('0x1d')]?_0x4ff6b7[_0x1a5e('0x1d')][_0x1a5e('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x14291f){logger[_0x1a5e('0x11')]('CreateChatMessage',_0x4ff6b7);logger[_0x1a5e('0x13')](_0x1a5e('0x1f'),_0x4ff6b7,JSON[_0x1a5e('0x20')](_0x14291f));_0x8abec8(_0x14291f);})['catch'](function(_0x575be8){logger[_0x1a5e('0x15')]('CreateChatMessage',_0x575be8[_0x1a5e('0x17')],_0x4ff6b7);_0x28181c(_0x1b74a9[_0x1a5e('0x15')](0x1f4,_0x575be8[_0x1a5e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7839992..d85f461 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78d3=['removeListener','register','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x16f869,_0x309f33){var _0x24906a=function(_0x49c2b3){while(--_0x49c2b3){_0x16f869['push'](_0x16f869['shift']());}};_0x24906a(++_0x309f33);}(_0x78d3,0x73));var _0x378d=function(_0x428e71,_0x192e72){_0x428e71=_0x428e71-0x0;var _0xa8fa25=_0x78d3[_0x428e71];return _0xa8fa25;};'use strict';var ChatMessageEvents=require(_0x378d('0x0'));var events=[_0x378d('0x1'),_0x378d('0x2'),_0x378d('0x3')];function createListener(_0x40323e,_0x1d87b8){return function(_0x367f93){_0x1d87b8[_0x378d('0x4')](_0x40323e,_0x367f93);};}function removeListener(_0x52f934,_0x32a62f){return function(){ChatMessageEvents[_0x378d('0x5')](_0x52f934,_0x32a62f);};}exports[_0x378d('0x6')]=function(_0xc18c0b){for(var _0x59117c=0x0,_0x47a99f=events['length'];_0x59117c<_0x47a99f;_0x59117c++){var _0x1c880e=events[_0x59117c];var _0x4b3ef5=createListener(_0x378d('0x7')+_0x1c880e,_0xc18c0b);ChatMessageEvents['on'](_0x1c880e,_0x4b3ef5);}}; \ No newline at end of file +var _0x04de=['save','remove','update','emit','removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x04de,0x107));var _0xe04d=function(_0x247f3b,_0x37f587){_0x247f3b=_0x247f3b-0x0;var _0x490430=_0x04de[_0x247f3b];return _0x490430;};'use strict';var ChatMessageEvents=require(_0xe04d('0x0'));var events=[_0xe04d('0x1'),_0xe04d('0x2'),_0xe04d('0x3')];function createListener(_0x1e650d,_0x28f63f){return function(_0x1113af){_0x28f63f[_0xe04d('0x4')](_0x1e650d,_0x1113af);};}function removeListener(_0x2593a4,_0x70ead0){return function(){ChatMessageEvents[_0xe04d('0x5')](_0x2593a4,_0x70ead0);};}exports['register']=function(_0x4bb925){for(var _0x4f7637=0x0,_0x531688=events[_0xe04d('0x6')];_0x4f7637<_0x531688;_0x4f7637++){var _0x210e93=events[_0x4f7637];var _0x72b1ce=createListener(_0xe04d('0x7')+_0x210e93,_0x4bb925);ChatMessageEvents['on'](_0x210e93,_0x72b1ce);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 676d400..c31113b 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6ee=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','index','isAuthenticated','describe','get','show','post','tracked','chatmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe6ee,0x99));var _0xee6e=function(_0x36a346,_0x230a63){_0x36a346=_0x36a346-0x0;var _0x6109cf=_0xe6ee[_0x36a346];return _0x6109cf;};'use strict';var multer=require(_0xee6e('0x0'));var util=require(_0xee6e('0x1'));var path=require(_0xee6e('0x2'));var timeout=require(_0xee6e('0x3'));var express=require(_0xee6e('0x4'));var router=express['Router']();var fs_extra=require(_0xee6e('0x5'));var auth=require(_0xee6e('0x6'));var interaction=require(_0xee6e('0x7'));var config=require('../../config/environment');var controller=require(_0xee6e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xee6e('0x9')]);router['get']('/describe',auth[_0xee6e('0xa')](),controller[_0xee6e('0xb')]);router[_0xee6e('0xc')]('/:id',auth[_0xee6e('0xa')](),controller[_0xee6e('0xd')]);router[_0xee6e('0xe')]('/',auth[_0xee6e('0xa')](),interaction[_0xee6e('0xf')]('chat',_0xee6e('0x10')),controller[_0xee6e('0x11')]);router[_0xee6e('0x12')](_0xee6e('0x13'),controller[_0xee6e('0x14')]);router[_0xee6e('0x12')](_0xee6e('0x15'),auth[_0xee6e('0xa')](),controller['accept']);router[_0xee6e('0x12')](_0xee6e('0x16'),auth[_0xee6e('0xa')](),controller[_0xee6e('0x17')]);router['delete']('/:id',auth[_0xee6e('0xa')](),controller[_0xee6e('0x18')]);module[_0xee6e('0x19')]=router; \ No newline at end of file +var _0x8e2b=['put','update','/:id/accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chatmessage:create','create'];(function(_0x523870,_0x40e1c0){var _0x3beae0=function(_0x4b12c5){while(--_0x4b12c5){_0x523870['push'](_0x523870['shift']());}};_0x3beae0(++_0x40e1c0);}(_0x8e2b,0x13f));var _0xb8e2=function(_0x556ae1,_0x3455e0){_0x556ae1=_0x556ae1-0x0;var _0x14ff19=_0x8e2b[_0x556ae1];return _0x14ff19;};'use strict';var multer=require(_0xb8e2('0x0'));var util=require(_0xb8e2('0x1'));var path=require(_0xb8e2('0x2'));var timeout=require(_0xb8e2('0x3'));var express=require(_0xb8e2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8e2('0x5'));var interaction=require(_0xb8e2('0x6'));var config=require(_0xb8e2('0x7'));var controller=require('./chatMessage.controller');router[_0xb8e2('0x8')]('/',auth[_0xb8e2('0x9')](),controller[_0xb8e2('0xa')]);router[_0xb8e2('0x8')](_0xb8e2('0xb'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0xc')]);router[_0xb8e2('0x8')](_0xb8e2('0xd'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0xe')]);router[_0xb8e2('0xf')]('/',auth[_0xb8e2('0x9')](),interaction[_0xb8e2('0x10')]('chat',_0xb8e2('0x11')),controller[_0xb8e2('0x12')]);router[_0xb8e2('0x13')]('/:id',controller[_0xb8e2('0x14')]);router[_0xb8e2('0x13')](_0xb8e2('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xb8e2('0x13')](_0xb8e2('0x16'),auth[_0xb8e2('0x9')](),controller[_0xb8e2('0x17')]);router[_0xb8e2('0x18')](_0xb8e2('0xd'),auth[_0xb8e2('0x9')](),controller['destroy']);module[_0xb8e2('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index deca1a8..5990ff0 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x44cdf9,_0x2fd3c3){var _0x3a2633=function(_0x338d5c){while(--_0x338d5c){_0x44cdf9['push'](_0x44cdf9['shift']());}};_0x3a2633(++_0x2fd3c3);}(_0xdb28,0x106));var _0x8db2=function(_0x3953f8,_0x40657d){_0x3953f8=_0x3953f8-0x0;var _0x3858e6=_0xdb28[_0x3953f8];return _0x3858e6;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x4d2776,_0x3b6dbf){var _0x345398=function(_0x5c7d82){while(--_0x5c7d82){_0x4d2776['push'](_0x4d2776['shift']());}};_0x345398(++_0x3b6dbf);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c5f32,_0x1ac260){_0x1c5f32=_0x1c5f32-0x0;var _0x3bd1e8=_0xb10b[_0x1c5f32];return _0x3bd1e8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index bd80773..ceaed07 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7a54,0x106));var _0x47a5=function(_0x24d917,_0x1cb597){_0x24d917=_0x24d917-0x0;var _0x20e3f4=_0x7a54[_0x24d917];return _0x20e3f4;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1918c0,_0x244dda){var _0x378462=function(_0x103e1b){while(--_0x103e1b){_0x1918c0['push'](_0x1918c0['shift']());}};_0x378462(++_0x244dda);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index a6831a0..b7417e6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c1a=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0x1d25df,_0x5ce190){var _0x3138f9=function(_0x227e34){while(--_0x227e34){_0x1d25df['push'](_0x1d25df['shift']());}};_0x3138f9(++_0x5ce190);}(_0x7c1a,0x159));var _0xa7c1=function(_0x238b61,_0xb94d00){_0x238b61=_0x238b61-0x0;var _0x519752=_0x7c1a[_0x238b61];return _0x519752;};'use strict';var EventEmitter=require(_0xa7c1('0x0'));var ChatOfflineMessage=require(_0xa7c1('0x1'))['db'][_0xa7c1('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa7c1('0x3')](0x0);var events={'afterCreate':_0xa7c1('0x4'),'afterUpdate':_0xa7c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd434f){return function(_0x132b08,_0x506858,_0x135ae7){ChatOfflineMessageEvents['emit'](_0xd434f+':'+_0x132b08['id'],_0x132b08);ChatOfflineMessageEvents[_0xa7c1('0x6')](_0xd434f,_0x132b08);_0x135ae7(null);};}for(var e in events){if(events[_0xa7c1('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xa7c1('0x8')](e,emitEvent(event));}}module[_0xa7c1('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x799b=['events','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x799b,0x8c));var _0xb799=function(_0x102213,_0x43c7ae){_0x102213=_0x102213-0x0;var _0x51e60a=_0x799b[_0x102213];return _0x51e60a;};'use strict';var EventEmitter=require(_0xb799('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb799('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb799('0x2'),'afterDestroy':_0xb799('0x3')};function emitEvent(_0x1808db){return function(_0x1dda29,_0x4fdc5b,_0x1c67fd){ChatOfflineMessageEvents['emit'](_0x1808db+':'+_0x1dda29['id'],_0x1dda29);ChatOfflineMessageEvents[_0xb799('0x4')](_0x1808db,_0x1dda29);_0x1c67fd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xb799('0x5')](e,emitEvent(event));}}module[_0xb799('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index dabd444..fa26b39 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba7b=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4'];(function(_0x922971,_0xf97ffa){var _0x22bdd7=function(_0x4a44f7){while(--_0x4a44f7){_0x922971['push'](_0x922971['shift']());}};_0x22bdd7(++_0xf97ffa);}(_0xba7b,0x103));var _0xbba7=function(_0x24864a,_0x16c627){_0x24864a=_0x24864a-0x0;var _0x3f61be=_0xba7b[_0x24864a];return _0x3f61be;};'use strict';var attributes=require(_0xbba7('0x0'));module[_0xbba7('0x1')]=function(_0x1d298c){return _0x1d298c[_0xbba7('0x2')](_0xbba7('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbba7('0x4'),'collate':_0xbba7('0x5')});}; \ No newline at end of file +var _0xcd1f=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd1f,0x134));var _0xfcd1=function(_0x203c92,_0xccc23e){_0x203c92=_0x203c92-0x0;var _0x9f567a=_0xcd1f[_0x203c92];return _0x9f567a;};'use strict';var attributes=require(_0xfcd1('0x0'));module[_0xfcd1('0x1')]=function(_0x56e859){return _0x56e859['define'](_0xfcd1('0x2'),attributes,{'tableName':_0xfcd1('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfcd1('0x4'),'collate':_0xfcd1('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8a47c62..4b2a727 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc8c=['stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x2335bb,_0x4145eb){var _0x217c2b=function(_0x29578){while(--_0x29578){_0x2335bb['push'](_0x2335bb['shift']());}};_0x217c2b(++_0x4145eb);}(_0xdc8c,0xd9));var _0xcdc8=function(_0x18870a,_0x295a40){_0x18870a=_0x18870a-0x0;var _0x4ca1c1=_0xdc8c[_0x18870a];return _0x4ca1c1;};'use strict';var _=require(_0xcdc8('0x0'));var util=require(_0xcdc8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcdc8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdc8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcdc8('0x4'))(_0xcdc8('0x5'));var config=require(_0xcdc8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcdc8('0x7')][_0xcdc8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2feede,_0x2e7bd0,_0x1f6292){return new BPromise(function(_0x1830d2,_0x4394dc){return client[_0xcdc8('0x9')](_0x2feede,_0x1f6292)[_0xcdc8('0xa')](function(_0x15748e){logger[_0xcdc8('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2e7bd0,_0xcdc8('0xc'));logger[_0xcdc8('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x2e7bd0,_0xcdc8('0xc'),JSON[_0xcdc8('0xe')](_0x15748e));if(_0x15748e[_0xcdc8('0xf')]){if(_0x15748e[_0xcdc8('0xf')][_0xcdc8('0x10')]===0x1f4){logger[_0xcdc8('0xf')](_0xcdc8('0x11'),_0x2e7bd0,_0x15748e[_0xcdc8('0xf')][_0xcdc8('0x12')]);return _0x4394dc(_0x15748e[_0xcdc8('0xf')][_0xcdc8('0x12')]);}logger[_0xcdc8('0xf')](_0xcdc8('0x11'),_0x2e7bd0,_0x15748e[_0xcdc8('0xf')]['message']);return _0x1830d2(_0x15748e[_0xcdc8('0xf')][_0xcdc8('0x12')]);}else{logger[_0xcdc8('0xb')](_0xcdc8('0x11'),_0x2e7bd0,_0xcdc8('0xc'));_0x1830d2(_0x15748e[_0xcdc8('0x13')][_0xcdc8('0x12')]);}})[_0xcdc8('0x14')](function(_0x7f0157){logger[_0xcdc8('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2e7bd0,_0x7f0157);_0x4394dc(_0x7f0157);});});} \ No newline at end of file +var _0x744b=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x744b,0xed));var _0xb744=function(_0x47039a,_0x61a331){_0x47039a=_0x47039a-0x0;var _0x3a1a48=_0x744b[_0x47039a];return _0x3a1a48;};'use strict';var _=require(_0xb744('0x0'));var util=require(_0xb744('0x1'));var moment=require(_0xb744('0x2'));var BPromise=require(_0xb744('0x3'));var rs=require(_0xb744('0x4'));var fs=require('fs');var Redis=require(_0xb744('0x5'));var db=require(_0xb744('0x6'))['db'];var utils=require(_0xb744('0x7'));var logger=require(_0xb744('0x8'))(_0xb744('0x9'));var config=require(_0xb744('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb744('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59ac18,_0x3f993c,_0x55533a){return new BPromise(function(_0x57abd3,_0x26c604){return client[_0xb744('0xc')](_0x59ac18,_0x55533a)[_0xb744('0xd')](function(_0x3d5e4f){logger[_0xb744('0xe')](_0xb744('0xf'),_0x3f993c,_0xb744('0x10'));logger[_0xb744('0x11')](_0xb744('0x12'),_0x3f993c,_0xb744('0x10'),JSON[_0xb744('0x13')](_0x3d5e4f));if(_0x3d5e4f[_0xb744('0x14')]){if(_0x3d5e4f[_0xb744('0x14')][_0xb744('0x15')]===0x1f4){logger[_0xb744('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3f993c,_0x3d5e4f[_0xb744('0x14')]['message']);return _0x26c604(_0x3d5e4f[_0xb744('0x14')][_0xb744('0x16')]);}logger[_0xb744('0x14')](_0xb744('0xf'),_0x3f993c,_0x3d5e4f[_0xb744('0x14')][_0xb744('0x16')]);return _0x57abd3(_0x3d5e4f[_0xb744('0x14')][_0xb744('0x16')]);}else{logger[_0xb744('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3f993c,_0xb744('0x10'));_0x57abd3(_0x3d5e4f[_0xb744('0x17')][_0xb744('0x16')]);}})[_0xb744('0x18')](function(_0x387e7e){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3f993c,_0x387e7e);_0x26c604(_0x387e7e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c141127..9c922e4 100644 --- a/server/api/chatOfflineMessage/index.js +++ b/server/api/chatOfflineMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a32=['post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','show'];(function(_0x5d0607,_0x50c068){var _0x4f955b=function(_0x4e9b95){while(--_0x4e9b95){_0x5d0607['push'](_0x5d0607['shift']());}};_0x4f955b(++_0x50c068);}(_0x7a32,0xf5));var _0x27a3=function(_0x217889,_0x451611){_0x217889=_0x217889-0x0;var _0x34550e=_0x7a32[_0x217889];return _0x34550e;};'use strict';var multer=require(_0x27a3('0x0'));var util=require(_0x27a3('0x1'));var path=require(_0x27a3('0x2'));var timeout=require(_0x27a3('0x3'));var express=require('express');var router=express[_0x27a3('0x4')]();var fs_extra=require(_0x27a3('0x5'));var auth=require(_0x27a3('0x6'));var interaction=require(_0x27a3('0x7'));var config=require(_0x27a3('0x8'));var controller=require(_0x27a3('0x9'));router[_0x27a3('0xa')]('/',auth[_0x27a3('0xb')](),controller[_0x27a3('0xc')]);router['get']('/describe',auth[_0x27a3('0xb')](),controller[_0x27a3('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x27a3('0xe')]);router[_0x27a3('0xf')]('/',auth['isAuthenticated'](),controller[_0x27a3('0x10')]);router['put']('/:id',auth[_0x27a3('0xb')](),controller[_0x27a3('0x11')]);router[_0x27a3('0x12')]('/:id',auth[_0x27a3('0xb')](),controller['destroy']);module[_0x27a3('0x13')]=router; \ No newline at end of file +var _0xa54e=['isAuthenticated','/:id','post','put','delete','destroy','exports','util','path','express','../../components/interaction/service','./chatOfflineMessage.controller','get','index','/describe'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa54e,0x1ab));var _0xea54=function(_0x580cf8,_0x26751e){_0x580cf8=_0x580cf8-0x0;var _0xcc9a9e=_0xa54e[_0x580cf8];return _0xcc9a9e;};'use strict';var multer=require('multer');var util=require(_0xea54('0x0'));var path=require(_0xea54('0x1'));var timeout=require('connect-timeout');var express=require(_0xea54('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xea54('0x3'));var config=require('../../config/environment');var controller=require(_0xea54('0x4'));router[_0xea54('0x5')]('/',auth['isAuthenticated'](),controller[_0xea54('0x6')]);router[_0xea54('0x5')](_0xea54('0x7'),auth[_0xea54('0x8')](),controller['describe']);router[_0xea54('0x5')](_0xea54('0x9'),auth[_0xea54('0x8')](),controller['show']);router[_0xea54('0xa')]('/',auth[_0xea54('0x8')](),controller['create']);router[_0xea54('0xb')](_0xea54('0x9'),auth[_0xea54('0x8')](),controller['update']);router[_0xea54('0xc')](_0xea54('0x9'),auth[_0xea54('0x8')](),controller[_0xea54('0xd')]);module[_0xea54('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 666befa..7627366 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js +++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e96=['STRING','ENUM','timeout','mouseOver'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x5e96,0x1dd));var _0x65e9=function(_0x223bc9,_0x23332e){_0x223bc9=_0x223bc9-0x0;var _0xcd700b=_0x5e96[_0x223bc9];return _0xcd700b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65e9('0x0')]('mouseOver',_0x65e9('0x1')),'defaultValue':_0x65e9('0x2')},'selector':{'type':Sequelize[_0x65e9('0x3')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0dbb=['STRING','timeout','mouseOver','INTEGER','sequelize','exports'];(function(_0x40a4b5,_0x4d2d02){var _0x476c41=function(_0x220631){while(--_0x220631){_0x40a4b5['push'](_0x40a4b5['shift']());}};_0x476c41(++_0x4d2d02);}(_0x0dbb,0xca));var _0xb0db=function(_0x21dc2c,_0x12e4b6){_0x21dc2c=_0x21dc2c-0x0;var _0x25b9d4=_0x0dbb[_0x21dc2c];return _0x25b9d4;};'use strict';var Sequelize=require(_0xb0db('0x0'));module[_0xb0db('0x1')]={'name':{'type':Sequelize[_0xb0db('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xb0db('0x3')),'defaultValue':_0xb0db('0x4')},'selector':{'type':Sequelize[_0xb0db('0x2')]},'timeout':{'type':Sequelize[_0xb0db('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index bf15468..ea861f8 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f5d=['then','destroy','sendStatus','stack','name','show','params','model','keys','ChatProactiveAction','filters','intersection','query','fields','attributes','length','includeAll','include','merge','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','save','update'];(function(_0x418bb2,_0x1d8b9e){var _0x58bfd5=function(_0x4dc3c2){while(--_0x4dc3c2){_0x418bb2['push'](_0x418bb2['shift']());}};_0x58bfd5(++_0x1d8b9e);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4f5d[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0xd4f5('0x0'));var rimraf=require(_0xd4f5('0x1'));var zipdir=require(_0xd4f5('0x2'));var jsonpatch=require(_0xd4f5('0x3'));var rp=require(_0xd4f5('0x4'));var moment=require(_0xd4f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4f5('0x6'));var util=require(_0xd4f5('0x7'));var path=require(_0xd4f5('0x8'));var sox=require(_0xd4f5('0x9'));var csv=require(_0xd4f5('0xa'));var ejs=require(_0xd4f5('0xb'));var fs=require('fs');var fs_extra=require(_0xd4f5('0xc'));var _=require(_0xd4f5('0xd'));var squel=require(_0xd4f5('0xe'));var crypto=require(_0xd4f5('0xf'));var jsforce=require(_0xd4f5('0x10'));var deskjs=require(_0xd4f5('0x11'));var toCsv=require(_0xd4f5('0xa'));var querystring=require('querystring');var Papa=require(_0xd4f5('0x12'));var Redis=require(_0xd4f5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd4f5('0x14'));var as=require(_0xd4f5('0x15'));var hardwareService=require(_0xd4f5('0x16'));var logger=require(_0xd4f5('0x17'))(_0xd4f5('0x18'));var utils=require(_0xd4f5('0x19'));var config=require(_0xd4f5('0x1a'));var licenseUtil=require(_0xd4f5('0x1b'));var db=require(_0xd4f5('0x1c'))['db'];function respondWithStatusCode(_0x5d5554,_0x445072){_0x445072=_0x445072||0xcc;return function(_0x21b2a2){if(_0x21b2a2){return _0x5d5554['sendStatus'](_0x445072);}return _0x5d5554[_0xd4f5('0x1d')](_0x445072)[_0xd4f5('0x1e')]();};}function respondWithResult(_0x28e1cf,_0x511fcf){_0x511fcf=_0x511fcf||0xc8;return function(_0x166d4d){if(_0x166d4d){return _0x28e1cf[_0xd4f5('0x1d')](_0x511fcf)[_0xd4f5('0x1f')](_0x166d4d);}};}function respondWithFilteredResult(_0x1a158f,_0x33f6dc){return function(_0x32f4b7){if(_0x32f4b7){var _0x23780a=typeof _0x33f6dc[_0xd4f5('0x20')]==='undefined'&&typeof _0x33f6dc[_0xd4f5('0x21')]==='undefined';var _0x45d043=_0x32f4b7['count'];var _0x220707=_0x23780a?0x0:_0x33f6dc[_0xd4f5('0x20')];var _0x271f53=_0x23780a?_0x32f4b7[_0xd4f5('0x22')]:_0x33f6dc[_0xd4f5('0x20')]+_0x33f6dc[_0xd4f5('0x21')];var _0x8c7e05;if(_0x271f53>=_0x45d043){_0x271f53=_0x45d043;_0x8c7e05=0xc8;}else{_0x8c7e05=0xce;}_0x1a158f[_0xd4f5('0x1d')](_0x8c7e05);return _0x1a158f['set'](_0xd4f5('0x23'),_0x220707+'-'+_0x271f53+'/'+_0x45d043)[_0xd4f5('0x1f')](_0x32f4b7);}return null;};}function patchUpdates(_0x57a16b){return function(_0x1aae04){try{jsonpatch[_0xd4f5('0x24')](_0x1aae04,_0x57a16b,!![]);}catch(_0x47f101){return BPromise['reject'](_0x47f101);}return _0x1aae04[_0xd4f5('0x25')]();};}function saveUpdates(_0x161443,_0x3cbe7b){return function(_0x3ae7af){if(_0x3ae7af){return _0x3ae7af[_0xd4f5('0x26')](_0x161443)[_0xd4f5('0x27')](function(_0x378af6){return _0x378af6;});}return null;};}function removeEntity(_0x527dd4,_0x578071){return function(_0x5ccc63){if(_0x5ccc63){return _0x5ccc63[_0xd4f5('0x28')]()[_0xd4f5('0x27')](function(){_0x527dd4[_0xd4f5('0x1d')](0xcc)[_0xd4f5('0x1e')]();});}};}function handleEntityNotFound(_0x5f3a5d,_0xb7ea1){return function(_0x49ad32){if(!_0x49ad32){_0x5f3a5d[_0xd4f5('0x29')](0x194);}return _0x49ad32;};}function handleError(_0x2fbee8,_0x5b519e){_0x5b519e=_0x5b519e||0x1f4;return function(_0x5ba979){logger['error'](_0x5ba979[_0xd4f5('0x2a')]);if(_0x5ba979[_0xd4f5('0x2b')]){delete _0x5ba979['name'];}_0x2fbee8[_0xd4f5('0x1d')](_0x5b519e)['send'](_0x5ba979);};}exports[_0xd4f5('0x2c')]=function(_0xb5dd60,_0x2134f2){var _0x2130e4={'raw':!![],'where':{'id':_0xb5dd60[_0xd4f5('0x2d')]['id']}},_0x32d067={};_0x32d067[_0xd4f5('0x2e')]=_[_0xd4f5('0x2f')](db[_0xd4f5('0x30')]['rawAttributes']);_0x32d067['query']=_['keys'](_0xb5dd60['query']);_0x32d067[_0xd4f5('0x31')]=_[_0xd4f5('0x32')](_0x32d067[_0xd4f5('0x2e')],_0x32d067[_0xd4f5('0x33')]);_0x2130e4['attributes']=_[_0xd4f5('0x32')](_0x32d067[_0xd4f5('0x2e')],qs[_0xd4f5('0x34')](_0xb5dd60[_0xd4f5('0x33')][_0xd4f5('0x34')]));_0x2130e4[_0xd4f5('0x35')]=_0x2130e4[_0xd4f5('0x35')][_0xd4f5('0x36')]?_0x2130e4[_0xd4f5('0x35')]:_0x32d067['model'];if(_0xb5dd60['query'][_0xd4f5('0x37')]){_0x2130e4[_0xd4f5('0x38')]=[{'all':!![]}];}_0x2130e4=_[_0xd4f5('0x39')]({},_0x2130e4,_0xb5dd60[_0xd4f5('0x3a')]);return db[_0xd4f5('0x30')]['find'](_0x2130e4)[_0xd4f5('0x27')](handleEntityNotFound(_0x2134f2,null))[_0xd4f5('0x27')](respondWithResult(_0x2134f2,null))[_0xd4f5('0x3b')](handleError(_0x2134f2,null));};exports['create']=function(_0x23b0af,_0x31b9e6){return db[_0xd4f5('0x30')][_0xd4f5('0x3c')](_0x23b0af[_0xd4f5('0x3d')],{})[_0xd4f5('0x27')](respondWithResult(_0x31b9e6,0xc9))['catch'](handleError(_0x31b9e6,null));};exports['update']=function(_0x5555b8,_0x29f348){if(_0x5555b8[_0xd4f5('0x3d')]['id']){delete _0x5555b8['body']['id'];}return db[_0xd4f5('0x30')][_0xd4f5('0x3e')]({'where':{'id':_0x5555b8['params']['id']}})[_0xd4f5('0x27')](handleEntityNotFound(_0x29f348,null))[_0xd4f5('0x27')](saveUpdates(_0x5555b8['body'],null))['then'](respondWithResult(_0x29f348,null))[_0xd4f5('0x3b')](handleError(_0x29f348,null));};exports['destroy']=function(_0x172294,_0x3070bb){return db[_0xd4f5('0x30')][_0xd4f5('0x3e')]({'where':{'id':_0x172294[_0xd4f5('0x2d')]['id']}})[_0xd4f5('0x27')](handleEntityNotFound(_0x3070bb,null))[_0xd4f5('0x27')](removeEntity(_0x3070bb,null))[_0xd4f5('0x3b')](handleError(_0x3070bb,null));}; \ No newline at end of file +var _0xe06f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','name','show','params','keys','ChatProactiveAction','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','options','catch','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x1e4ff5,_0x3944ed){var _0xf644b7=function(_0x46e6ff){while(--_0x46e6ff){_0x1e4ff5['push'](_0x1e4ff5['shift']());}};_0xf644b7(++_0x3944ed);}(_0xe06f,0x65));var _0xfe06=function(_0x3dae63,_0x370747){_0x3dae63=_0x3dae63-0x0;var _0x54a6df=_0xe06f[_0x3dae63];return _0x54a6df;};'use strict';var emlformat=require(_0xfe06('0x0'));var rimraf=require(_0xfe06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe06('0x2'));var rp=require('request-promise');var moment=require(_0xfe06('0x3'));var BPromise=require(_0xfe06('0x4'));var Mustache=require(_0xfe06('0x5'));var util=require(_0xfe06('0x6'));var path=require(_0xfe06('0x7'));var sox=require(_0xfe06('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe06('0x9'));var squel=require(_0xfe06('0xa'));var crypto=require(_0xfe06('0xb'));var jsforce=require(_0xfe06('0xc'));var deskjs=require(_0xfe06('0xd'));var toCsv=require(_0xfe06('0xe'));var querystring=require('querystring');var Papa=require(_0xfe06('0xf'));var Redis=require(_0xfe06('0x10'));var authService=require(_0xfe06('0x11'));var qs=require(_0xfe06('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe06('0x13'));var logger=require(_0xfe06('0x14'))(_0xfe06('0x15'));var utils=require(_0xfe06('0x16'));var config=require(_0xfe06('0x17'));var licenseUtil=require(_0xfe06('0x18'));var db=require(_0xfe06('0x19'))['db'];function respondWithStatusCode(_0x2b44be,_0x576efe){_0x576efe=_0x576efe||0xcc;return function(_0xbb32db){if(_0xbb32db){return _0x2b44be[_0xfe06('0x1a')](_0x576efe);}return _0x2b44be[_0xfe06('0x1b')](_0x576efe)[_0xfe06('0x1c')]();};}function respondWithResult(_0x5e0ff5,_0x5a91b5){_0x5a91b5=_0x5a91b5||0xc8;return function(_0x3e44dd){if(_0x3e44dd){return _0x5e0ff5['status'](_0x5a91b5)[_0xfe06('0x1d')](_0x3e44dd);}};}function respondWithFilteredResult(_0x3a41ab,_0x4dd976){return function(_0x54dd69){if(_0x54dd69){var _0x7b243f=typeof _0x4dd976[_0xfe06('0x1e')]===_0xfe06('0x1f')&&typeof _0x4dd976[_0xfe06('0x20')]===_0xfe06('0x1f');var _0x48dd0d=_0x54dd69[_0xfe06('0x21')];var _0x4f45b0=_0x7b243f?0x0:_0x4dd976[_0xfe06('0x1e')];var _0x346ed9=_0x7b243f?_0x54dd69[_0xfe06('0x21')]:_0x4dd976[_0xfe06('0x1e')]+_0x4dd976[_0xfe06('0x20')];var _0x548d73;if(_0x346ed9>=_0x48dd0d){_0x346ed9=_0x48dd0d;_0x548d73=0xc8;}else{_0x548d73=0xce;}_0x3a41ab['status'](_0x548d73);return _0x3a41ab['set'](_0xfe06('0x22'),_0x4f45b0+'-'+_0x346ed9+'/'+_0x48dd0d)[_0xfe06('0x1d')](_0x54dd69);}return null;};}function patchUpdates(_0x166a86){return function(_0x4775b5){try{jsonpatch[_0xfe06('0x23')](_0x4775b5,_0x166a86,!![]);}catch(_0x594ad8){return BPromise['reject'](_0x594ad8);}return _0x4775b5[_0xfe06('0x24')]();};}function saveUpdates(_0xc30ab5,_0x4dd52d){return function(_0x37974d){if(_0x37974d){return _0x37974d[_0xfe06('0x25')](_0xc30ab5)[_0xfe06('0x26')](function(_0x1de458){return _0x1de458;});}return null;};}function removeEntity(_0x288487,_0x5b58e5){return function(_0x39468e){if(_0x39468e){return _0x39468e['destroy']()['then'](function(){_0x288487[_0xfe06('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2755ab,_0x27a507){return function(_0x470530){if(!_0x470530){_0x2755ab[_0xfe06('0x1a')](0x194);}return _0x470530;};}function handleError(_0x5703e2,_0x10c227){_0x10c227=_0x10c227||0x1f4;return function(_0x2c2146){logger[_0xfe06('0x27')](_0x2c2146['stack']);if(_0x2c2146[_0xfe06('0x28')]){delete _0x2c2146['name'];}_0x5703e2[_0xfe06('0x1b')](_0x10c227)['send'](_0x2c2146);};}exports[_0xfe06('0x29')]=function(_0x3272b8,_0x3f8536){var _0x353b3c={'raw':!![],'where':{'id':_0x3272b8[_0xfe06('0x2a')]['id']}},_0x12d6a5={};_0x12d6a5['model']=_[_0xfe06('0x2b')](db[_0xfe06('0x2c')][_0xfe06('0x2d')]);_0x12d6a5[_0xfe06('0x2e')]=_[_0xfe06('0x2b')](_0x3272b8['query']);_0x12d6a5['filters']=_[_0xfe06('0x2f')](_0x12d6a5[_0xfe06('0x30')],_0x12d6a5['query']);_0x353b3c[_0xfe06('0x31')]=_[_0xfe06('0x2f')](_0x12d6a5[_0xfe06('0x30')],qs['fields'](_0x3272b8[_0xfe06('0x2e')][_0xfe06('0x32')]));_0x353b3c[_0xfe06('0x31')]=_0x353b3c['attributes'][_0xfe06('0x33')]?_0x353b3c[_0xfe06('0x31')]:_0x12d6a5[_0xfe06('0x30')];if(_0x3272b8[_0xfe06('0x2e')][_0xfe06('0x34')]){_0x353b3c[_0xfe06('0x35')]=[{'all':!![]}];}_0x353b3c=_['merge']({},_0x353b3c,_0x3272b8[_0xfe06('0x36')]);return db[_0xfe06('0x2c')]['find'](_0x353b3c)[_0xfe06('0x26')](handleEntityNotFound(_0x3f8536,null))[_0xfe06('0x26')](respondWithResult(_0x3f8536,null))[_0xfe06('0x37')](handleError(_0x3f8536,null));};exports[_0xfe06('0x38')]=function(_0x25950f,_0x332511){return db[_0xfe06('0x2c')][_0xfe06('0x38')](_0x25950f['body'],{})['then'](respondWithResult(_0x332511,0xc9))[_0xfe06('0x37')](handleError(_0x332511,null));};exports[_0xfe06('0x25')]=function(_0x4013e8,_0x507812){if(_0x4013e8[_0xfe06('0x39')]['id']){delete _0x4013e8[_0xfe06('0x39')]['id'];}return db[_0xfe06('0x2c')]['find']({'where':{'id':_0x4013e8[_0xfe06('0x2a')]['id']}})[_0xfe06('0x26')](handleEntityNotFound(_0x507812,null))['then'](saveUpdates(_0x4013e8[_0xfe06('0x39')],null))[_0xfe06('0x26')](respondWithResult(_0x507812,null))[_0xfe06('0x37')](handleError(_0x507812,null));};exports['destroy']=function(_0xc2be21,_0x227aa0){return db[_0xfe06('0x2c')][_0xfe06('0x3a')]({'where':{'id':_0xc2be21[_0xfe06('0x2a')]['id']}})[_0xfe06('0x26')](handleEntityNotFound(_0x227aa0,null))[_0xfe06('0x26')](removeEntity(_0x227aa0,null))['catch'](handleError(_0x227aa0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 63621aa..13c447f 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.model.js +++ b/server/api/chatProactiveAction/chatProactiveAction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x279b=['./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x209552,_0x15dcbb){var _0x4198ea=function(_0x2ea322){while(--_0x2ea322){_0x209552['push'](_0x209552['shift']());}};_0x4198ea(++_0x15dcbb);}(_0x279b,0x1e5));var _0xb279=function(_0x38bd6e,_0x9d3bd8){_0x38bd6e=_0x38bd6e-0x0;var _0x3378ef=_0x279b[_0x38bd6e];return _0x3378ef;};'use strict';var _=require('lodash');var util=require(_0xb279('0x0'));var logger=require(_0xb279('0x1'))(_0xb279('0x2'));var moment=require(_0xb279('0x3'));var BPromise=require(_0xb279('0x4'));var rp=require(_0xb279('0x5'));var fs=require('fs');var path=require(_0xb279('0x6'));var rimraf=require(_0xb279('0x7'));var config=require(_0xb279('0x8'));var attributes=require(_0xb279('0x9'));module['exports']=function(_0x3794da,_0x293f01){return _0x3794da[_0xb279('0xa')](_0xb279('0xb'),attributes,{'tableName':_0xb279('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x357f=['path','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa0acd9,_0x16a60b){var _0x220de0=function(_0xc9e977){while(--_0xc9e977){_0xa0acd9['push'](_0xa0acd9['shift']());}};_0x220de0(++_0x16a60b);}(_0x357f,0x14a));var _0xf357=function(_0x5951eb,_0x1f2c25){_0x5951eb=_0x5951eb-0x0;var _0x4a0d9d=_0x357f[_0x5951eb];return _0x4a0d9d;};'use strict';var _=require(_0xf357('0x0'));var util=require('util');var logger=require(_0xf357('0x1'))(_0xf357('0x2'));var moment=require(_0xf357('0x3'));var BPromise=require(_0xf357('0x4'));var rp=require(_0xf357('0x5'));var fs=require('fs');var path=require(_0xf357('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf357('0x7'));module[_0xf357('0x8')]=function(_0x5182ff,_0x5c3d1e){return _0x5182ff[_0xf357('0x9')](_0xf357('0xa'),attributes,{'tableName':_0xf357('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index ee1e806..a202da8 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.rpc.js +++ b/server/api/chatProactiveAction/chatProactiveAction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbbc=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x46f17a,_0x4d72c8){var _0x580d30=function(_0x5e7781){while(--_0x5e7781){_0x46f17a['push'](_0x46f17a['shift']());}};_0x580d30(++_0x4d72c8);}(_0xbbbc,0xbe));var _0xcbbb=function(_0x125ca8,_0x2b9dc7){_0x125ca8=_0x125ca8-0x0;var _0x8c6d50=_0xbbbc[_0x125ca8];return _0x8c6d50;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbbb('0x6'));var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')][_0xcbbb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a9c5c,_0x2db391,_0x387a7a){return new BPromise(function(_0x14f6f4,_0x445175){return client[_0xcbbb('0xd')](_0x1a9c5c,_0x387a7a)[_0xcbbb('0xe')](function(_0x45421){logger[_0xcbbb('0xf')](_0xcbbb('0x10'),_0x2db391,_0xcbbb('0x11'));logger[_0xcbbb('0x12')](_0xcbbb('0x13'),_0x2db391,_0xcbbb('0x11'),JSON[_0xcbbb('0x14')](_0x45421));if(_0x45421['error']){if(_0x45421[_0xcbbb('0x15')][_0xcbbb('0x16')]===0x1f4){logger[_0xcbbb('0x15')](_0xcbbb('0x10'),_0x2db391,_0x45421[_0xcbbb('0x15')][_0xcbbb('0x17')]);return _0x445175(_0x45421[_0xcbbb('0x15')]['message']);}logger[_0xcbbb('0x15')](_0xcbbb('0x10'),_0x2db391,_0x45421['error'][_0xcbbb('0x17')]);return _0x14f6f4(_0x45421[_0xcbbb('0x15')]['message']);}else{logger[_0xcbbb('0xf')](_0xcbbb('0x10'),_0x2db391,_0xcbbb('0x11'));_0x14f6f4(_0x45421[_0xcbbb('0x18')][_0xcbbb('0x17')]);}})[_0xcbbb('0x19')](function(_0x2230c3){logger[_0xcbbb('0x15')]('ChatProactiveAction,\x20%s,\x20%s',_0x2db391,_0x2230c3);_0x445175(_0x2230c3);});});} \ No newline at end of file +var _0x3b6b=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x3b6b,0x194));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb3b6('0x0'));var util=require(_0xb3b6('0x1'));var moment=require('moment');var BPromise=require(_0xb3b6('0x2'));var rs=require(_0xb3b6('0x3'));var fs=require('fs');var Redis=require(_0xb3b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3b6('0x5'));var logger=require(_0xb3b6('0x6'))('rpc');var config=require(_0xb3b6('0x7'));var jayson=require(_0xb3b6('0x8'));var client=jayson[_0xb3b6('0x9')][_0xb3b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25a47d,_0x2987cd,_0x1cb627){return new BPromise(function(_0x253e48,_0x54e95c){return client['request'](_0x25a47d,_0x1cb627)[_0xb3b6('0xb')](function(_0x4f5689){logger[_0xb3b6('0xc')](_0xb3b6('0xd'),_0x2987cd,_0xb3b6('0xe'));logger[_0xb3b6('0xf')](_0xb3b6('0x10'),_0x2987cd,_0xb3b6('0xe'),JSON[_0xb3b6('0x11')](_0x4f5689));if(_0x4f5689[_0xb3b6('0x12')]){if(_0x4f5689[_0xb3b6('0x12')][_0xb3b6('0x13')]===0x1f4){logger[_0xb3b6('0x12')](_0xb3b6('0xd'),_0x2987cd,_0x4f5689[_0xb3b6('0x12')][_0xb3b6('0x14')]);return _0x54e95c(_0x4f5689[_0xb3b6('0x12')][_0xb3b6('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2987cd,_0x4f5689['error']['message']);return _0x253e48(_0x4f5689[_0xb3b6('0x12')][_0xb3b6('0x14')]);}else{logger['info'](_0xb3b6('0xd'),_0x2987cd,'request\x20sent');_0x253e48(_0x4f5689['result'][_0xb3b6('0x14')]);}})['catch'](function(_0x1ca845){logger[_0xb3b6('0x12')](_0xb3b6('0xd'),_0x2987cd,_0x1ca845);_0x54e95c(_0x1ca845);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 18911c0..034302d 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x425d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x425d,0x1e0));var _0xd425=function(_0x2051dd,_0x149c46){_0x2051dd=_0x2051dd-0x0;var _0x25770c=_0x425d[_0x2051dd];return _0x25770c;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var fs_extra=require(_0xd425('0x5'));var auth=require(_0xd425('0x6'));var interaction=require(_0xd425('0x7'));var config=require('../../config/environment');var controller=require(_0xd425('0x8'));router[_0xd425('0x9')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0xc')]);router[_0xd425('0xd')]('/',auth['isAuthenticated'](),controller[_0xd425('0xe')]);router[_0xd425('0xf')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x10')]);router[_0xd425('0x11')](_0xd425('0xa'),auth[_0xd425('0xb')](),controller[_0xd425('0x12')]);module[_0xd425('0x13')]=router; \ No newline at end of file +var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0x27fd32,_0xe8bd4d){_0x27fd32=_0x27fd32-0x0;var _0x2dc73a=_0x038b[_0x27fd32];return _0x2dc73a;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index e350868..09518f5 100644 --- a/server/api/chatQueue/chatQueue.attributes.js +++ b/server/api/chatQueue/chatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c70=['INTEGER','roundrobin','sequelize','exports','STRING','name'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x6c70,0x1e2));var _0x06c7=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x6c70[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x06c7('0x0'));module[_0x06c7('0x1')]={'name':{'type':Sequelize[_0x06c7('0x2')],'unique':_0x06c7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x06c7('0x2')]},'timeout':{'type':Sequelize[_0x06c7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x06c7('0x5'))}}; \ No newline at end of file +var _0x859f=['ENUM','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x859f,0xc0));var _0xf859=function(_0x231d5c,_0x3029bc){_0x231d5c=_0x231d5c-0x0;var _0x52d257=_0x859f[_0x231d5c];return _0x52d257;};'use strict';var Sequelize=require('sequelize');module[_0xf859('0x0')]={'name':{'type':Sequelize[_0xf859('0x1')],'unique':_0xf859('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf859('0x1')]},'timeout':{'type':Sequelize[_0xf859('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf859('0x4')]('rrmemory',_0xf859('0x5'),_0xf859('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 948bbe7..a622b66 100644 --- a/server/api/chatQueue/chatQueue.controller.js +++ b/server/api/chatQueue/chatQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe366=['Content-Range','reject','then','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ChatQueue','findAll','show','params','fields','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x3b182d,_0x578149){var _0x5c647b=function(_0x1770a5){while(--_0x1770a5){_0x3b182d['push'](_0x3b182d['shift']());}};_0x5c647b(++_0x578149);}(_0xe366,0x68));var _0x6e36=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xe366[_0x387777];return _0x3f84c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e36('0x0'));var zipdir=require(_0x6e36('0x1'));var jsonpatch=require(_0x6e36('0x2'));var rp=require(_0x6e36('0x3'));var moment=require(_0x6e36('0x4'));var BPromise=require(_0x6e36('0x5'));var Mustache=require('mustache');var util=require(_0x6e36('0x6'));var path=require(_0x6e36('0x7'));var sox=require(_0x6e36('0x8'));var csv=require(_0x6e36('0x9'));var ejs=require(_0x6e36('0xa'));var fs=require('fs');var fs_extra=require(_0x6e36('0xb'));var _=require(_0x6e36('0xc'));var squel=require(_0x6e36('0xd'));var crypto=require(_0x6e36('0xe'));var jsforce=require(_0x6e36('0xf'));var deskjs=require(_0x6e36('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6e36('0x11'));var Redis=require('ioredis');var authService=require(_0x6e36('0x12'));var qs=require(_0x6e36('0x13'));var as=require(_0x6e36('0x14'));var hardwareService=require(_0x6e36('0x15'));var logger=require(_0x6e36('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e36('0x17'));var db=require(_0x6e36('0x18'))['db'];config[_0x6e36('0x19')]=_[_0x6e36('0x1a')](config[_0x6e36('0x19')],{'host':_0x6e36('0x1b'),'port':0x18eb});var socket=require(_0x6e36('0x1c'))(new Redis(config[_0x6e36('0x19')]));require(_0x6e36('0x1d'))[_0x6e36('0x1e')](socket);var jayson=require(_0x6e36('0x1f'));var client=jayson['client'][_0x6e36('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x400134,_0x2a0ba7,_0x2c9662,_0x3369f8){return new BPromise(function(_0x149a49,_0x3a280b){var _0xa02789=_0x3369f8||client;return _0xa02789[_0x6e36('0x21')](_0x400134,_0x2c9662)['then'](function(_0x254d33){logger[_0x6e36('0x22')](_0x6e36('0x23'),_0x2a0ba7,_0x6e36('0x24'));logger[_0x6e36('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2a0ba7,_0x6e36('0x24'),JSON['stringify'](_0x254d33));if(_0x254d33[_0x6e36('0x26')]){if(_0x254d33[_0x6e36('0x26')]['code']===0x1f4){logger['error'](_0x6e36('0x23'),_0x2a0ba7,_0x254d33['error'][_0x6e36('0x27')]);return _0x3a280b(_0x254d33[_0x6e36('0x26')]['message']);}logger[_0x6e36('0x26')](_0x6e36('0x23'),_0x2a0ba7,_0x254d33[_0x6e36('0x26')]['message']);return _0x149a49(_0x254d33['error']['message']);}else{logger[_0x6e36('0x22')]('ChatQueue,\x20%s,\x20%s',_0x2a0ba7,_0x6e36('0x24'));_0x149a49(_0x254d33[_0x6e36('0x28')][_0x6e36('0x27')]);}})[_0x6e36('0x29')](function(_0x388f00){logger['error'](_0x6e36('0x23'),_0x2a0ba7,_0x388f00);_0x3a280b(_0x388f00);});});}function respondWithStatusCode(_0x4b4c83,_0x3c77ba){_0x3c77ba=_0x3c77ba||0xcc;return function(_0x5b7359){if(_0x5b7359){return _0x4b4c83[_0x6e36('0x2a')](_0x3c77ba);}return _0x4b4c83[_0x6e36('0x2b')](_0x3c77ba)[_0x6e36('0x2c')]();};}function respondWithResult(_0x3ad5d9,_0x5c1c74){_0x5c1c74=_0x5c1c74||0xc8;return function(_0xbe376b){if(_0xbe376b){return _0x3ad5d9[_0x6e36('0x2b')](_0x5c1c74)[_0x6e36('0x2d')](_0xbe376b);}};}function respondWithFilteredResult(_0x380f45,_0x5b1cc7){return function(_0x318a53){if(_0x318a53){var _0x292bb5=typeof _0x5b1cc7[_0x6e36('0x2e')]==='undefined'&&typeof _0x5b1cc7[_0x6e36('0x2f')]==='undefined';var _0x318745=_0x318a53[_0x6e36('0x30')];var _0x39b41c=_0x292bb5?0x0:_0x5b1cc7[_0x6e36('0x2e')];var _0x586809=_0x292bb5?_0x318a53[_0x6e36('0x30')]:_0x5b1cc7[_0x6e36('0x2e')]+_0x5b1cc7['limit'];var _0x36683a;if(_0x586809>=_0x318745){_0x586809=_0x318745;_0x36683a=0xc8;}else{_0x36683a=0xce;}_0x380f45[_0x6e36('0x2b')](_0x36683a);return _0x380f45[_0x6e36('0x31')](_0x6e36('0x32'),_0x39b41c+'-'+_0x586809+'/'+_0x318745)[_0x6e36('0x2d')](_0x318a53);}return null;};}function patchUpdates(_0x1004f9){return function(_0xfb4747){try{jsonpatch['apply'](_0xfb4747,_0x1004f9,!![]);}catch(_0xa23bf7){return BPromise[_0x6e36('0x33')](_0xa23bf7);}return _0xfb4747['save']();};}function saveUpdates(_0x817bbd,_0x1c888c){return function(_0xc70a8e){if(_0xc70a8e){return _0xc70a8e['update'](_0x817bbd)[_0x6e36('0x34')](function(_0x1a01c2){return _0x1a01c2;});}return null;};}function removeEntity(_0x294490,_0x43645f){return function(_0x1053f5){if(_0x1053f5){return _0x1053f5[_0x6e36('0x35')]()[_0x6e36('0x34')](function(){var _0x599a4a=_0x1053f5[_0x6e36('0x36')]({'plain':!![]});var _0x2b83c1=_0x6e36('0x37');return db[_0x6e36('0x38')][_0x6e36('0x35')]({'where':{'type':_0x2b83c1,'resourceId':_0x599a4a['id']}})[_0x6e36('0x34')](function(){return _0x1053f5;});})[_0x6e36('0x34')](function(){_0x294490[_0x6e36('0x2b')](0xcc)[_0x6e36('0x2c')]();});}};}function handleEntityNotFound(_0x410f20,_0x1b13a9){return function(_0x41a8f7){if(!_0x41a8f7){_0x410f20['sendStatus'](0x194);}return _0x41a8f7;};}function handleError(_0x47e389,_0x4462ba){_0x4462ba=_0x4462ba||0x1f4;return function(_0x15f66c){logger[_0x6e36('0x26')](_0x15f66c[_0x6e36('0x39')]);if(_0x15f66c[_0x6e36('0x3a')]){delete _0x15f66c[_0x6e36('0x3a')];}_0x47e389[_0x6e36('0x2b')](_0x4462ba)['send'](_0x15f66c);};}exports[_0x6e36('0x3b')]=function(_0x1313e9,_0x3790ef){var _0x37e19d={},_0x209cf1={},_0x410189={'count':0x0,'rows':[]};var _0x3139b9=_[_0x6e36('0x3c')](db['ChatQueue'][_0x6e36('0x3d')],function(_0x295eb5){return{'name':_0x295eb5[_0x6e36('0x3e')],'type':_0x295eb5[_0x6e36('0x3f')][_0x6e36('0x40')]};});_0x209cf1['model']=_['map'](_0x3139b9,'name');_0x209cf1[_0x6e36('0x41')]=_[_0x6e36('0x42')](_0x1313e9[_0x6e36('0x41')]);_0x209cf1[_0x6e36('0x43')]=_[_0x6e36('0x44')](_0x209cf1[_0x6e36('0x45')],_0x209cf1['query']);_0x37e19d[_0x6e36('0x46')]=_[_0x6e36('0x44')](_0x209cf1['model'],qs['fields'](_0x1313e9['query']['fields']));_0x37e19d[_0x6e36('0x46')]=_0x37e19d[_0x6e36('0x46')][_0x6e36('0x47')]?_0x37e19d[_0x6e36('0x46')]:_0x209cf1[_0x6e36('0x45')];if(!_0x1313e9['query']['hasOwnProperty'](_0x6e36('0x48'))){_0x37e19d['limit']=qs['limit'](_0x1313e9['query'][_0x6e36('0x2f')]);_0x37e19d[_0x6e36('0x2e')]=qs['offset'](_0x1313e9['query'][_0x6e36('0x2e')]);}_0x37e19d[_0x6e36('0x49')]=qs['sort'](_0x1313e9['query'][_0x6e36('0x4a')]);_0x37e19d[_0x6e36('0x4b')]=qs[_0x6e36('0x43')](_[_0x6e36('0x4c')](_0x1313e9[_0x6e36('0x41')],_0x209cf1['filters']),_0x3139b9);if(_0x1313e9[_0x6e36('0x41')][_0x6e36('0x4d')]){_0x37e19d[_0x6e36('0x4b')]=_['merge'](_0x37e19d[_0x6e36('0x4b')],{'$or':_[_0x6e36('0x3c')](_0x3139b9,function(_0xdf06f6){if(_0xdf06f6[_0x6e36('0x3f')]!==_0x6e36('0x4e')){var _0xa2b292={};_0xa2b292[_0xdf06f6['name']]={'$like':'%'+_0x1313e9['query'][_0x6e36('0x4d')]+'%'};return _0xa2b292;}})});}_0x37e19d=_[_0x6e36('0x4f')]({},_0x37e19d,_0x1313e9[_0x6e36('0x50')]);var _0x154589={'where':_0x37e19d['where']};return db['ChatQueue']['count'](_0x154589)[_0x6e36('0x34')](function(_0x3554cb){_0x410189[_0x6e36('0x30')]=_0x3554cb;if(_0x1313e9[_0x6e36('0x41')]['includeAll']){_0x37e19d['include']=[{'all':!![]}];}return db[_0x6e36('0x51')][_0x6e36('0x52')](_0x37e19d);})[_0x6e36('0x34')](function(_0x291686){_0x410189['rows']=_0x291686;return _0x410189;})['then'](respondWithFilteredResult(_0x3790ef,_0x37e19d))[_0x6e36('0x29')](handleError(_0x3790ef,null));};exports[_0x6e36('0x53')]=function(_0x3faac6,_0x4bb8ef){var _0x4268ea={'raw':!![],'where':{'id':_0x3faac6[_0x6e36('0x54')]['id']}},_0x389914={};_0x389914['model']=_[_0x6e36('0x42')](db[_0x6e36('0x51')][_0x6e36('0x3d')]);_0x389914['query']=_[_0x6e36('0x42')](_0x3faac6['query']);_0x389914[_0x6e36('0x43')]=_[_0x6e36('0x44')](_0x389914['model'],_0x389914[_0x6e36('0x41')]);_0x4268ea[_0x6e36('0x46')]=_[_0x6e36('0x44')](_0x389914['model'],qs[_0x6e36('0x55')](_0x3faac6['query']['fields']));_0x4268ea[_0x6e36('0x46')]=_0x4268ea[_0x6e36('0x46')][_0x6e36('0x47')]?_0x4268ea[_0x6e36('0x46')]:_0x389914[_0x6e36('0x45')];if(_0x3faac6['query'][_0x6e36('0x56')]){_0x4268ea[_0x6e36('0x57')]=[{'all':!![]}];}_0x4268ea=_[_0x6e36('0x4f')]({},_0x4268ea,_0x3faac6[_0x6e36('0x50')]);return db[_0x6e36('0x51')][_0x6e36('0x58')](_0x4268ea)['then'](handleEntityNotFound(_0x4bb8ef,null))[_0x6e36('0x34')](respondWithResult(_0x4bb8ef,null))[_0x6e36('0x29')](handleError(_0x4bb8ef,null));};exports['create']=function(_0x3e1577,_0x10d541){return db[_0x6e36('0x51')][_0x6e36('0x59')](_0x3e1577[_0x6e36('0x5a')],{})[_0x6e36('0x34')](function(_0x5d9933){var _0x363aa0=_0x3e1577[_0x6e36('0x5b')][_0x6e36('0x36')]({'plain':!![]});if(!_0x363aa0)throw new Error(_0x6e36('0x5c'));if(_0x363aa0[_0x6e36('0x5d')]==='user'){var _0x2e91ae=_0x5d9933[_0x6e36('0x36')]({'plain':!![]});var _0x208f37='ChatQueues';return db[_0x6e36('0x5e')][_0x6e36('0x58')]({'where':{'name':_0x208f37,'userProfileId':_0x363aa0['userProfileId']},'raw':!![]})[_0x6e36('0x34')](function(_0x55197b){if(_0x55197b&&_0x55197b[_0x6e36('0x5f')]===0x0){return db[_0x6e36('0x38')][_0x6e36('0x59')]({'name':_0x2e91ae[_0x6e36('0x3a')],'resourceId':_0x2e91ae['id'],'type':_0x55197b[_0x6e36('0x3a')],'sectionId':_0x55197b['id']},{})[_0x6e36('0x34')](function(){return _0x5d9933;});}else{return _0x5d9933;}})[_0x6e36('0x29')](function(_0x391580){logger['error'](_0x6e36('0x60'),_0x391580);throw _0x391580;});}return _0x5d9933;})[_0x6e36('0x34')](respondWithResult(_0x10d541,0xc9))[_0x6e36('0x29')](handleError(_0x10d541,null));};exports['update']=function(_0xecb530,_0x58a94b){if(_0xecb530[_0x6e36('0x5a')]['id']){delete _0xecb530[_0x6e36('0x5a')]['id'];}return db[_0x6e36('0x51')][_0x6e36('0x58')]({'where':{'id':_0xecb530[_0x6e36('0x54')]['id']}})['then'](handleEntityNotFound(_0x58a94b,null))[_0x6e36('0x34')](saveUpdates(_0xecb530['body'],null))[_0x6e36('0x34')](respondWithResult(_0x58a94b,null))['catch'](handleError(_0x58a94b,null));};exports['destroy']=function(_0x235e4f,_0x43dc54){return db[_0x6e36('0x51')][_0x6e36('0x58')]({'where':{'id':_0x235e4f[_0x6e36('0x54')]['id']}})[_0x6e36('0x34')](handleEntityNotFound(_0x43dc54,null))[_0x6e36('0x34')](removeEntity(_0x43dc54,null))[_0x6e36('0x29')](handleError(_0x43dc54,null));};exports[_0x6e36('0x61')]=function(_0x2c791a,_0x1c1b15){return db[_0x6e36('0x51')][_0x6e36('0x61')]()[_0x6e36('0x34')](respondWithResult(_0x1c1b15,null))[_0x6e36('0x29')](handleError(_0x1c1b15,null));};exports[_0x6e36('0x62')]=function(_0x4201cf,_0x36b5b1,_0x5bca92){var _0x16ab30={'raw':!![],'where':{}},_0xcfbb3b={},_0x33481d;return db[_0x6e36('0x51')][_0x6e36('0x63')]({'where':{'id':_0x4201cf[_0x6e36('0x54')]['id']}})[_0x6e36('0x34')](handleEntityNotFound(_0x36b5b1,null))[_0x6e36('0x34')](function(_0x35827c){if(_0x35827c){_0x33481d=_0x35827c[_0x6e36('0x36')]({'plain':!![]});_0xcfbb3b[_0x6e36('0x45')]=_[_0x6e36('0x42')](db[_0x6e36('0x64')][_0x6e36('0x3d')]);_0xcfbb3b[_0x6e36('0x41')]=_[_0x6e36('0x42')](_0x4201cf['query']);_0xcfbb3b[_0x6e36('0x43')]=_[_0x6e36('0x44')](_0xcfbb3b[_0x6e36('0x45')],_0xcfbb3b['query']);_0x16ab30[_0x6e36('0x46')]=_[_0x6e36('0x44')](_0xcfbb3b['model'],qs[_0x6e36('0x55')](_0x4201cf[_0x6e36('0x41')][_0x6e36('0x55')]));_0x16ab30['attributes']=_0x16ab30[_0x6e36('0x46')][_0x6e36('0x47')]?_0x16ab30['attributes']:_0xcfbb3b['model'];if(!_0x4201cf[_0x6e36('0x41')]['hasOwnProperty']('nolimit')){_0x16ab30[_0x6e36('0x2f')]=qs[_0x6e36('0x2f')](_0x4201cf['query'][_0x6e36('0x2f')]);_0x16ab30['offset']=qs[_0x6e36('0x2e')](_0x4201cf[_0x6e36('0x41')][_0x6e36('0x2e')]);}_0x16ab30['order']=qs[_0x6e36('0x4a')](_0x4201cf[_0x6e36('0x41')][_0x6e36('0x4a')]);_0x16ab30[_0x6e36('0x4b')]=qs['filters'](_[_0x6e36('0x4c')](_0x4201cf['query'],_0xcfbb3b['filters']));_0x16ab30[_0x6e36('0x4b')][_0x6e36('0x65')]=_0x35827c['id'];if(_0x4201cf[_0x6e36('0x41')][_0x6e36('0x4d')]){_0x16ab30[_0x6e36('0x4b')]=_[_0x6e36('0x4f')](_0x16ab30[_0x6e36('0x4b')],{'$or':_[_0x6e36('0x3c')](_0x16ab30['attributes'],function(_0x36b88b){var _0x5cb1c3={};_0x5cb1c3[_0x36b88b]={'$like':'%'+_0x4201cf[_0x6e36('0x41')][_0x6e36('0x4d')]+'%'};return _0x5cb1c3;})});}_0x16ab30=_[_0x6e36('0x4f')]({},_0x16ab30,_0x4201cf[_0x6e36('0x50')]);return db[_0x6e36('0x64')][_0x6e36('0x52')](_0x16ab30);}})['then'](function(_0x3882d0){if(_0x3882d0){return db[_0x6e36('0x66')][_0x6e36('0x67')]({'where':{'id':_[_0x6e36('0x3c')](_0x3882d0,_0x6e36('0x68')),'role':_0x6e36('0x69')},'attributes':['id',_0x6e36('0x3a'),'chatPause',_0x6e36('0x6a'),_0x6e36('0x6b')]});}})[_0x6e36('0x34')](function(_0x5b395d){if(_0x5b395d){return{'count':_0x5b395d[_0x6e36('0x30')],'rows':_[_0x6e36('0x3c')](_0x5b395d['rows'],function(_0x14c6f5){return{'membername':_0x14c6f5[_0x6e36('0x3a')],'UserId':_0x14c6f5['id'],'queue_name':_0x33481d[_0x6e36('0x3a')],'ChatQueueId':_0x33481d['id'],'interface':util[_0x6e36('0x6c')](_0x6e36('0x6d'),_0x6e36('0x6e'),_0x14c6f5[_0x6e36('0x3a')]),'penalty':0x0,'paused':_0x14c6f5[_0x6e36('0x6f')],'createdAt':_0x14c6f5[_0x6e36('0x6b')],'updatedAt':_0x14c6f5[_0x6e36('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x36b5b1,_0x16ab30))[_0x6e36('0x29')](handleError(_0x36b5b1,null));};exports['getTeams']=function(_0x5d9f1a,_0x499102,_0x553508){var _0x3fd886={};var _0x2de2a0={};var _0x12334b;var _0x37c172;return db['ChatQueue']['findOne']({'where':{'id':_0x5d9f1a['params']['id']}})[_0x6e36('0x34')](handleEntityNotFound(_0x499102,null))['then'](function(_0x28add1){if(_0x28add1){_0x12334b=_0x28add1;_0x2de2a0[_0x6e36('0x45')]=_[_0x6e36('0x42')](db[_0x6e36('0x70')][_0x6e36('0x3d')]);_0x2de2a0[_0x6e36('0x41')]=_['keys'](_0x5d9f1a[_0x6e36('0x41')]);_0x2de2a0[_0x6e36('0x43')]=_[_0x6e36('0x44')](_0x2de2a0[_0x6e36('0x45')],_0x2de2a0[_0x6e36('0x41')]);_0x3fd886[_0x6e36('0x46')]=_['intersection'](_0x2de2a0[_0x6e36('0x45')],qs['fields'](_0x5d9f1a['query'][_0x6e36('0x55')]));_0x3fd886[_0x6e36('0x46')]=_0x3fd886[_0x6e36('0x46')][_0x6e36('0x47')]?_0x3fd886['attributes']:_0x2de2a0['model'];_0x3fd886['order']=qs[_0x6e36('0x4a')](_0x5d9f1a['query']['sort']);_0x3fd886['where']=qs[_0x6e36('0x43')](_[_0x6e36('0x4c')](_0x5d9f1a[_0x6e36('0x41')],_0x2de2a0[_0x6e36('0x43')]));if(_0x5d9f1a['query'][_0x6e36('0x4d')]){_0x3fd886[_0x6e36('0x4b')]=_[_0x6e36('0x4f')](_0x3fd886[_0x6e36('0x4b')],{'$or':_[_0x6e36('0x3c')](_0x3fd886[_0x6e36('0x46')],function(_0x36ca52){var _0x1cde4a={};_0x1cde4a[_0x36ca52]={'$like':'%'+_0x5d9f1a[_0x6e36('0x41')]['filter']+'%'};return _0x1cde4a;})});}_0x3fd886=_[_0x6e36('0x4f')]({},_0x3fd886,_0x5d9f1a[_0x6e36('0x50')]);return _0x12334b[_0x6e36('0x71')](_0x3fd886);}})['then'](function(_0x3dbc56){if(_0x3dbc56){_0x37c172=_0x3dbc56['length'];if(!_0x5d9f1a[_0x6e36('0x41')]['hasOwnProperty'](_0x6e36('0x48'))){_0x3fd886['limit']=qs[_0x6e36('0x2f')](_0x5d9f1a[_0x6e36('0x41')][_0x6e36('0x2f')]);_0x3fd886[_0x6e36('0x2e')]=qs[_0x6e36('0x2e')](_0x5d9f1a[_0x6e36('0x41')][_0x6e36('0x2e')]);}return _0x12334b[_0x6e36('0x71')](_0x3fd886);}})['then'](function(_0xec7d00){if(_0xec7d00){return _0xec7d00?{'count':_0x37c172,'rows':_0xec7d00}:null;}})[_0x6e36('0x34')](respondWithResult(_0x499102,null))[_0x6e36('0x29')](handleError(_0x499102,null));};exports[_0x6e36('0x72')]=function(_0x4b4e05,_0x2e7f49,_0x470550){var _0x2347d6=_0x4b4e05['body'][_0x6e36('0x73')];return db[_0x6e36('0x70')][_0x6e36('0x52')]({'where':{'id':_0x2347d6},'attributes':['id'],'include':[{'model':db[_0x6e36('0x66')],'as':_0x6e36('0x74'),'attributes':['id',_0x6e36('0x3a'),_0x6e36('0x75'),_0x6e36('0x76'),_0x6e36('0x77')],'raw':!![]}]})['then'](function(_0x2f7a83){if(_0x2f7a83){var _0x5a2ba6=_['flatMap'](_0x2f7a83,function(_0x1bf826){var _0x25efae=_0x1bf826[_0x6e36('0x36')]({'plain':!![]});return _0x25efae[_0x6e36('0x74')];});return db[_0x6e36('0x51')][_0x6e36('0x58')]({'where':{'id':_0x4b4e05['params']['id']}})[_0x6e36('0x34')](function(_0x1c613d){return db['sequelize'][_0x6e36('0x78')](function(_0x59468b){return _0x1c613d[_0x6e36('0x72')](_0x2347d6,{'transaction':_0x59468b})[_0x6e36('0x34')](function(){return BPromise[_0x6e36('0x79')](_0x5a2ba6,function(_0x1165c6){return db[_0x6e36('0x64')][_0x6e36('0x7a')]({'where':{'UserId':_0x1165c6['id'],'ChatQueueId':_0x4b4e05[_0x6e36('0x54')]['id']},'transaction':_0x59468b});});})[_0x6e36('0x34')](function(){_0x5a2ba6[_0x6e36('0x7b')](function(_0x23d1fc){socket[_0x6e36('0x7c')](_0x6e36('0x7d'),{'UserId':_0x23d1fc['id'],'ChatQueueId':_0x1c613d['id']});});});});});}})[_0x6e36('0x34')](respondWithStatusCode(_0x2e7f49,null))['catch'](handleError(_0x2e7f49,null));};exports[_0x6e36('0x7e')]=function(_0x2d81fc,_0x28357e,_0xaee47a){return db['Team'][_0x6e36('0x52')]({'where':{'id':_0x2d81fc[_0x6e36('0x41')][_0x6e36('0x73')]},'attributes':['id'],'include':[{'model':db[_0x6e36('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x28357e,null))[_0x6e36('0x34')](function(_0x3aa1d8){var _0x1a0a14=_[_0x6e36('0x3c')](_0x3aa1d8,'id');var _0x41f9a5=[];var _0x1b24e1=[];var _0x5d4287=squel[_0x6e36('0x7f')]();_0x5d4287[_0x6e36('0x80')](_0x6e36('0x81'))[_0x6e36('0x82')](_0x6e36('0x83'),'tq')[_0x6e36('0x84')](_0x6e36('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6e36('0x4b')](_0x6e36('0x86'),_0x2d81fc['params']['id']);for(var _0x103229=0x0;_0x103229<_0x3aa1d8[_0x6e36('0x47')];_0x103229+=0x1){let _0x2bcab4=_0x3aa1d8[_0x103229];for(var _0x55c68d=0x0;_0x55c68d<_0x2bcab4['Agents'][_0x6e36('0x47')];_0x55c68d+=0x1){let _0xc12364=_0x2bcab4[_0x6e36('0x74')][_0x55c68d];var _0x113f1e=_0x5d4287['clone']();_0x113f1e[_0x6e36('0x4b')](_0x6e36('0x87'),_0xc12364['id']);_0x1b24e1[_0x6e36('0x88')](db['sequelize'][_0x6e36('0x41')](_0x113f1e[_0x6e36('0x89')](),{'type':db[_0x6e36('0x8a')][_0x6e36('0x8b')][_0x6e36('0x8c')]})[_0x6e36('0x34')](function(_0x2e8274){if(_0x2e8274[_0x6e36('0x47')]===0x1){return _0xc12364['id'];}else{var _0x31c69a=_[_0x6e36('0x8d')](_[_0x6e36('0x3c')](_0x2e8274,_0x6e36('0x8e')),function(_0x3786fd){return _[_0x6e36('0x8f')](_0x1a0a14,_0x3786fd);});if(_0x31c69a){return _0xc12364['id'];}}}));}}return BPromise[_0x6e36('0x90')](_0x1b24e1)['then'](function(_0x418b60){_0x41f9a5=_(_0x41f9a5)[_0x6e36('0x91')](_0x418b60)['compact']()[_0x6e36('0x92')]();return db[_0x6e36('0x51')][_0x6e36('0x58')]({'where':{'id':_0x2d81fc['params']['id']}})[_0x6e36('0x34')](function(_0x160656){return db[_0x6e36('0x8a')]['transaction'](function(_0x2970bc){return _0x160656['removeTeams'](_0x2d81fc[_0x6e36('0x41')]['ids'],{'transaction':_0x2970bc})[_0x6e36('0x34')](function(){if(!_[_0x6e36('0x93')](_0x41f9a5)){return _0x160656[_0x6e36('0x94')](_0x41f9a5,{'transaction':_0x2970bc});}})[_0x6e36('0x34')](function(){_0x41f9a5[_0x6e36('0x7b')](function(_0x5c3160){socket[_0x6e36('0x7c')]('userChatQueue:remove',{'UserId':_0x5c3160,'ChatQueueId':_0x160656['id']});});});});});});})[_0x6e36('0x34')](respondWithStatusCode(_0x28357e,null))[_0x6e36('0x29')](handleError(_0x28357e,null));};exports[_0x6e36('0x95')]=function(_0x292903,_0x317983,_0x3ccbab){return db[_0x6e36('0x51')][_0x6e36('0x58')]({'where':{'id':_0x292903[_0x6e36('0x54')]['id']}})[_0x6e36('0x34')](handleEntityNotFound(_0x317983,null))[_0x6e36('0x34')](function(_0x39d371){if(_0x39d371){return _0x39d371['addAgents'](_0x292903['body'][_0x6e36('0x73')],_[_0x6e36('0x96')](_0x292903[_0x6e36('0x5a')],[_0x6e36('0x73'),'id'])||{})['spread'](function(_0x4e5a3f){for(var _0x579b9e=0x0;_0x579b9e<_0x292903[_0x6e36('0x5a')][_0x6e36('0x73')][_0x6e36('0x47')];_0x579b9e+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x292903[_0x6e36('0x5a')]['ids'][_0x579b9e]),'ChatQueueId':Number(_0x292903[_0x6e36('0x54')]['id'])});}return _0x4e5a3f;});}})[_0x6e36('0x34')](respondWithResult(_0x317983,null))['catch'](handleError(_0x317983,null));};exports[_0x6e36('0x94')]=function(_0x3eb4b2,_0x148883,_0x19cd03){return db[_0x6e36('0x51')][_0x6e36('0x58')]({'where':{'id':_0x3eb4b2[_0x6e36('0x54')]['id']}})[_0x6e36('0x34')](handleEntityNotFound(_0x148883,null))[_0x6e36('0x34')](function(_0x34928d){if(_0x34928d){return _0x34928d[_0x6e36('0x94')](_0x3eb4b2['query'][_0x6e36('0x73')])[_0x6e36('0x34')](function(){if(_[_0x6e36('0x97')](_0x3eb4b2['query'][_0x6e36('0x73')])){for(var _0x51bad1=0x0;_0x51bad1<_0x3eb4b2['query'][_0x6e36('0x73')]['length'];_0x51bad1+=0x1){socket[_0x6e36('0x7c')](_0x6e36('0x98'),{'UserId':Number(_0x3eb4b2['query'][_0x6e36('0x73')][_0x51bad1]),'ChatQueueId':Number(_0x3eb4b2[_0x6e36('0x54')]['id'])});}}else{socket[_0x6e36('0x7c')](_0x6e36('0x98'),{'UserId':Number(_0x3eb4b2['query'][_0x6e36('0x73')]),'ChatQueueId':Number(_0x3eb4b2[_0x6e36('0x54')]['id'])});}});}})[_0x6e36('0x34')](respondWithStatusCode(_0x148883,null))[_0x6e36('0x29')](handleError(_0x148883,null));};exports[_0x6e36('0x99')]=function(_0x1dcec7,_0x5bc739,_0x6cb769){var _0x58208f={};var _0xe1b8c0={};var _0x2e9256;var _0x4c0de6;return db[_0x6e36('0x51')][_0x6e36('0x63')]({'where':{'id':_0x1dcec7['params']['id']}})[_0x6e36('0x34')](handleEntityNotFound(_0x5bc739,null))[_0x6e36('0x34')](function(_0x3a3824){if(_0x3a3824){_0x2e9256=_0x3a3824;_0xe1b8c0[_0x6e36('0x45')]=_[_0x6e36('0x42')](db['User'][_0x6e36('0x3d')]);_0xe1b8c0['query']=_[_0x6e36('0x42')](_0x1dcec7[_0x6e36('0x41')]);_0xe1b8c0['filters']=_[_0x6e36('0x44')](_0xe1b8c0['model'],_0xe1b8c0[_0x6e36('0x41')]);_0x58208f[_0x6e36('0x46')]=_[_0x6e36('0x44')](_0xe1b8c0[_0x6e36('0x45')],qs[_0x6e36('0x55')](_0x1dcec7[_0x6e36('0x41')][_0x6e36('0x55')]));_0x58208f[_0x6e36('0x46')]=_0x58208f[_0x6e36('0x46')][_0x6e36('0x47')]?_0x58208f[_0x6e36('0x46')]:_0xe1b8c0[_0x6e36('0x45')];_0x58208f['order']=qs['sort'](_0x1dcec7[_0x6e36('0x41')][_0x6e36('0x4a')]);_0x58208f[_0x6e36('0x4b')]=qs[_0x6e36('0x43')](_[_0x6e36('0x4c')](_0x1dcec7['query'],_0xe1b8c0[_0x6e36('0x43')]));if(_0x1dcec7[_0x6e36('0x41')][_0x6e36('0x4d')]){_0x58208f[_0x6e36('0x4b')]=_[_0x6e36('0x4f')](_0x58208f[_0x6e36('0x4b')],{'$or':_[_0x6e36('0x3c')](_0x58208f['attributes'],function(_0x31e6a6){var _0x52cce0={};_0x52cce0[_0x31e6a6]={'$like':'%'+_0x1dcec7[_0x6e36('0x41')][_0x6e36('0x4d')]+'%'};return _0x52cce0;})});}_0x58208f=_[_0x6e36('0x4f')]({},_0x58208f,_0x1dcec7[_0x6e36('0x50')]);return _0x2e9256['getAgents'](_0x58208f);}})[_0x6e36('0x34')](function(_0x44f481){if(_0x44f481){_0x4c0de6=_0x44f481[_0x6e36('0x47')];if(!_0x1dcec7[_0x6e36('0x41')]['hasOwnProperty'](_0x6e36('0x48'))){_0x58208f[_0x6e36('0x2f')]=qs[_0x6e36('0x2f')](_0x1dcec7[_0x6e36('0x41')][_0x6e36('0x2f')]);_0x58208f['offset']=qs[_0x6e36('0x2e')](_0x1dcec7['query']['offset']);}return _0x2e9256[_0x6e36('0x99')](_0x58208f);}})[_0x6e36('0x34')](function(_0x4c7252){if(_0x4c7252){return _0x4c7252?{'count':_0x4c0de6,'rows':_0x4c7252}:null;}})['then'](respondWithResult(_0x5bc739,null))['catch'](handleError(_0x5bc739,null));}; \ No newline at end of file +var _0xc5cd=['fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','params','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','update','describe','findOne','ChatQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','online','voicePause','interface','sequelize','each','UserChatQueue','findOrCreate','forEach','emit','removeTeams','ids','User','Agents','select','field','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','offset','set','Content-Range','apply','reject','save','ChatQueues','UserProfileResource','destroy','end','stack','name','send','index','map','ChatQueue','rawAttributes'];(function(_0x21a0cb,_0x483abd){var _0x341412=function(_0x33e9cd){while(--_0x33e9cd){_0x21a0cb['push'](_0x21a0cb['shift']());}};_0x341412(++_0x483abd);}(_0xc5cd,0xf1));var _0xdc5c=function(_0x4bea50,_0x18ea16){_0x4bea50=_0x4bea50-0x0;var _0x500311=_0xc5cd[_0x4bea50];return _0x500311;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdc5c('0x0'));var jsonpatch=require(_0xdc5c('0x1'));var rp=require(_0xdc5c('0x2'));var moment=require(_0xdc5c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc5c('0x4'));var path=require(_0xdc5c('0x5'));var sox=require(_0xdc5c('0x6'));var csv=require(_0xdc5c('0x7'));var ejs=require(_0xdc5c('0x8'));var fs=require('fs');var fs_extra=require(_0xdc5c('0x9'));var _=require(_0xdc5c('0xa'));var squel=require(_0xdc5c('0xb'));var crypto=require(_0xdc5c('0xc'));var jsforce=require(_0xdc5c('0xd'));var deskjs=require(_0xdc5c('0xe'));var toCsv=require(_0xdc5c('0x7'));var querystring=require(_0xdc5c('0xf'));var Papa=require(_0xdc5c('0x10'));var Redis=require(_0xdc5c('0x11'));var authService=require(_0xdc5c('0x12'));var qs=require(_0xdc5c('0x13'));var as=require(_0xdc5c('0x14'));var hardwareService=require(_0xdc5c('0x15'));var logger=require(_0xdc5c('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xdc5c('0x17'));var licenseUtil=require(_0xdc5c('0x18'));var db=require(_0xdc5c('0x19'))['db'];config[_0xdc5c('0x1a')]=_['defaults'](config[_0xdc5c('0x1a')],{'host':_0xdc5c('0x1b'),'port':0x18eb});var socket=require(_0xdc5c('0x1c'))(new Redis(config[_0xdc5c('0x1a')]));require('./chatQueue.socket')[_0xdc5c('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdc5c('0x1e')][_0xdc5c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x32b576,_0x1c12ea,_0x574f4a,_0x1f8387){return new BPromise(function(_0x30974e,_0x4481b4){var _0x3a50c2=_0x1f8387||client;return _0x3a50c2[_0xdc5c('0x20')](_0x32b576,_0x574f4a)[_0xdc5c('0x21')](function(_0x5c9bfd){logger[_0xdc5c('0x22')](_0xdc5c('0x23'),_0x1c12ea,_0xdc5c('0x24'));logger[_0xdc5c('0x25')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1c12ea,'request\x20sent',JSON[_0xdc5c('0x26')](_0x5c9bfd));if(_0x5c9bfd[_0xdc5c('0x27')]){if(_0x5c9bfd[_0xdc5c('0x27')][_0xdc5c('0x28')]===0x1f4){logger[_0xdc5c('0x27')](_0xdc5c('0x23'),_0x1c12ea,_0x5c9bfd[_0xdc5c('0x27')][_0xdc5c('0x29')]);return _0x4481b4(_0x5c9bfd[_0xdc5c('0x27')][_0xdc5c('0x29')]);}logger[_0xdc5c('0x27')]('ChatQueue,\x20%s,\x20%s',_0x1c12ea,_0x5c9bfd[_0xdc5c('0x27')][_0xdc5c('0x29')]);return _0x30974e(_0x5c9bfd[_0xdc5c('0x27')][_0xdc5c('0x29')]);}else{logger['info'](_0xdc5c('0x23'),_0x1c12ea,'request\x20sent');_0x30974e(_0x5c9bfd[_0xdc5c('0x2a')][_0xdc5c('0x29')]);}})[_0xdc5c('0x2b')](function(_0x545084){logger[_0xdc5c('0x27')](_0xdc5c('0x23'),_0x1c12ea,_0x545084);_0x4481b4(_0x545084);});});}function respondWithStatusCode(_0x284c8f,_0x30a38d){_0x30a38d=_0x30a38d||0xcc;return function(_0x3125f4){if(_0x3125f4){return _0x284c8f[_0xdc5c('0x2c')](_0x30a38d);}return _0x284c8f['status'](_0x30a38d)['end']();};}function respondWithResult(_0x56c12f,_0x338b58){_0x338b58=_0x338b58||0xc8;return function(_0x2de7b0){if(_0x2de7b0){return _0x56c12f[_0xdc5c('0x2d')](_0x338b58)['json'](_0x2de7b0);}};}function respondWithFilteredResult(_0x5a1872,_0x5c1356){return function(_0x4c1858){if(_0x4c1858){var _0x49cd2a=typeof _0x5c1356['offset']===_0xdc5c('0x2e')&&typeof _0x5c1356[_0xdc5c('0x2f')]==='undefined';var _0xed4b67=_0x4c1858['count'];var _0x170c74=_0x49cd2a?0x0:_0x5c1356['offset'];var _0x5ae735=_0x49cd2a?_0x4c1858['count']:_0x5c1356[_0xdc5c('0x30')]+_0x5c1356[_0xdc5c('0x2f')];var _0x5a9e87;if(_0x5ae735>=_0xed4b67){_0x5ae735=_0xed4b67;_0x5a9e87=0xc8;}else{_0x5a9e87=0xce;}_0x5a1872['status'](_0x5a9e87);return _0x5a1872[_0xdc5c('0x31')](_0xdc5c('0x32'),_0x170c74+'-'+_0x5ae735+'/'+_0xed4b67)['json'](_0x4c1858);}return null;};}function patchUpdates(_0x24c1be){return function(_0x406d63){try{jsonpatch[_0xdc5c('0x33')](_0x406d63,_0x24c1be,!![]);}catch(_0x17df80){return BPromise[_0xdc5c('0x34')](_0x17df80);}return _0x406d63[_0xdc5c('0x35')]();};}function saveUpdates(_0x4319e0,_0x367c0a){return function(_0x527d21){if(_0x527d21){return _0x527d21['update'](_0x4319e0)[_0xdc5c('0x21')](function(_0x1301d9){return _0x1301d9;});}return null;};}function removeEntity(_0x533fbc,_0x42bb0f){return function(_0x176c98){if(_0x176c98){return _0x176c98['destroy']()['then'](function(){var _0x1c2c32=_0x176c98['get']({'plain':!![]});var _0x5dc413=_0xdc5c('0x36');return db[_0xdc5c('0x37')][_0xdc5c('0x38')]({'where':{'type':_0x5dc413,'resourceId':_0x1c2c32['id']}})[_0xdc5c('0x21')](function(){return _0x176c98;});})['then'](function(){_0x533fbc[_0xdc5c('0x2d')](0xcc)[_0xdc5c('0x39')]();});}};}function handleEntityNotFound(_0x12136d,_0x44bc0a){return function(_0x7a7f94){if(!_0x7a7f94){_0x12136d[_0xdc5c('0x2c')](0x194);}return _0x7a7f94;};}function handleError(_0x4ea2c9,_0xd4ac4a){_0xd4ac4a=_0xd4ac4a||0x1f4;return function(_0x2edb82){logger['error'](_0x2edb82[_0xdc5c('0x3a')]);if(_0x2edb82[_0xdc5c('0x3b')]){delete _0x2edb82[_0xdc5c('0x3b')];}_0x4ea2c9[_0xdc5c('0x2d')](_0xd4ac4a)[_0xdc5c('0x3c')](_0x2edb82);};}exports[_0xdc5c('0x3d')]=function(_0x5df54f,_0x10266c){var _0x309666={},_0x391a4b={},_0x4c8dc3={'count':0x0,'rows':[]};var _0x16113e=_[_0xdc5c('0x3e')](db[_0xdc5c('0x3f')][_0xdc5c('0x40')],function(_0x457375){return{'name':_0x457375[_0xdc5c('0x41')],'type':_0x457375[_0xdc5c('0x42')]['key']};});_0x391a4b[_0xdc5c('0x43')]=_[_0xdc5c('0x3e')](_0x16113e,'name');_0x391a4b[_0xdc5c('0x44')]=_[_0xdc5c('0x45')](_0x5df54f['query']);_0x391a4b[_0xdc5c('0x46')]=_['intersection'](_0x391a4b['model'],_0x391a4b[_0xdc5c('0x44')]);_0x309666[_0xdc5c('0x47')]=_[_0xdc5c('0x48')](_0x391a4b[_0xdc5c('0x43')],qs[_0xdc5c('0x49')](_0x5df54f['query'][_0xdc5c('0x49')]));_0x309666[_0xdc5c('0x47')]=_0x309666['attributes'][_0xdc5c('0x4a')]?_0x309666[_0xdc5c('0x47')]:_0x391a4b[_0xdc5c('0x43')];if(!_0x5df54f[_0xdc5c('0x44')][_0xdc5c('0x4b')](_0xdc5c('0x4c'))){_0x309666['limit']=qs[_0xdc5c('0x2f')](_0x5df54f[_0xdc5c('0x44')][_0xdc5c('0x2f')]);_0x309666[_0xdc5c('0x30')]=qs[_0xdc5c('0x30')](_0x5df54f[_0xdc5c('0x44')]['offset']);}_0x309666[_0xdc5c('0x4d')]=qs[_0xdc5c('0x4e')](_0x5df54f[_0xdc5c('0x44')][_0xdc5c('0x4e')]);_0x309666[_0xdc5c('0x4f')]=qs['filters'](_[_0xdc5c('0x50')](_0x5df54f['query'],_0x391a4b[_0xdc5c('0x46')]),_0x16113e);if(_0x5df54f['query'][_0xdc5c('0x51')]){_0x309666[_0xdc5c('0x4f')]=_[_0xdc5c('0x52')](_0x309666['where'],{'$or':_[_0xdc5c('0x3e')](_0x16113e,function(_0x3ee418){if(_0x3ee418[_0xdc5c('0x42')]!==_0xdc5c('0x53')){var _0x33db63={};_0x33db63[_0x3ee418[_0xdc5c('0x3b')]]={'$like':'%'+_0x5df54f[_0xdc5c('0x44')][_0xdc5c('0x51')]+'%'};return _0x33db63;}})});}_0x309666=_[_0xdc5c('0x52')]({},_0x309666,_0x5df54f['options']);var _0x2d1e2b={'where':_0x309666[_0xdc5c('0x4f')]};return db['ChatQueue'][_0xdc5c('0x54')](_0x2d1e2b)[_0xdc5c('0x21')](function(_0x2cab6b){_0x4c8dc3[_0xdc5c('0x54')]=_0x2cab6b;if(_0x5df54f[_0xdc5c('0x44')]['includeAll']){_0x309666['include']=[{'all':!![]}];}return db[_0xdc5c('0x3f')][_0xdc5c('0x55')](_0x309666);})[_0xdc5c('0x21')](function(_0x592e8b){_0x4c8dc3['rows']=_0x592e8b;return _0x4c8dc3;})[_0xdc5c('0x21')](respondWithFilteredResult(_0x10266c,_0x309666))[_0xdc5c('0x2b')](handleError(_0x10266c,null));};exports['show']=function(_0xa7e684,_0x54e887){var _0xba9c25={'raw':!![],'where':{'id':_0xa7e684[_0xdc5c('0x56')]['id']}},_0xe0ebeb={};_0xe0ebeb[_0xdc5c('0x43')]=_[_0xdc5c('0x45')](db[_0xdc5c('0x3f')][_0xdc5c('0x40')]);_0xe0ebeb[_0xdc5c('0x44')]=_['keys'](_0xa7e684['query']);_0xe0ebeb[_0xdc5c('0x46')]=_[_0xdc5c('0x48')](_0xe0ebeb['model'],_0xe0ebeb[_0xdc5c('0x44')]);_0xba9c25[_0xdc5c('0x47')]=_['intersection'](_0xe0ebeb[_0xdc5c('0x43')],qs[_0xdc5c('0x49')](_0xa7e684[_0xdc5c('0x44')][_0xdc5c('0x49')]));_0xba9c25[_0xdc5c('0x47')]=_0xba9c25[_0xdc5c('0x47')]['length']?_0xba9c25[_0xdc5c('0x47')]:_0xe0ebeb['model'];if(_0xa7e684[_0xdc5c('0x44')]['includeAll']){_0xba9c25[_0xdc5c('0x57')]=[{'all':!![]}];}_0xba9c25=_['merge']({},_0xba9c25,_0xa7e684[_0xdc5c('0x58')]);return db[_0xdc5c('0x3f')]['find'](_0xba9c25)[_0xdc5c('0x21')](handleEntityNotFound(_0x54e887,null))[_0xdc5c('0x21')](respondWithResult(_0x54e887,null))[_0xdc5c('0x2b')](handleError(_0x54e887,null));};exports[_0xdc5c('0x59')]=function(_0x1ea56d,_0x5ac9c9){return db[_0xdc5c('0x3f')]['create'](_0x1ea56d[_0xdc5c('0x5a')],{})[_0xdc5c('0x21')](function(_0x554d5d){var _0x22c1c4=_0x1ea56d[_0xdc5c('0x5b')][_0xdc5c('0x5c')]({'plain':!![]});if(!_0x22c1c4)throw new Error(_0xdc5c('0x5d'));if(_0x22c1c4['role']==='user'){var _0x117019=_0x554d5d[_0xdc5c('0x5c')]({'plain':!![]});var _0x30f926=_0xdc5c('0x36');return db[_0xdc5c('0x5e')][_0xdc5c('0x5f')]({'where':{'name':_0x30f926,'userProfileId':_0x22c1c4[_0xdc5c('0x60')]},'raw':!![]})[_0xdc5c('0x21')](function(_0x3b9e73){if(_0x3b9e73&&_0x3b9e73[_0xdc5c('0x61')]===0x0){return db[_0xdc5c('0x37')]['create']({'name':_0x117019['name'],'resourceId':_0x117019['id'],'type':_0x3b9e73[_0xdc5c('0x3b')],'sectionId':_0x3b9e73['id']},{})[_0xdc5c('0x21')](function(){return _0x554d5d;});}else{return _0x554d5d;}})[_0xdc5c('0x2b')](function(_0x4779b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4779b3);throw _0x4779b3;});}return _0x554d5d;})[_0xdc5c('0x21')](respondWithResult(_0x5ac9c9,0xc9))[_0xdc5c('0x2b')](handleError(_0x5ac9c9,null));};exports[_0xdc5c('0x62')]=function(_0x17c144,_0x23d36e){if(_0x17c144[_0xdc5c('0x5a')]['id']){delete _0x17c144[_0xdc5c('0x5a')]['id'];}return db[_0xdc5c('0x3f')][_0xdc5c('0x5f')]({'where':{'id':_0x17c144['params']['id']}})[_0xdc5c('0x21')](handleEntityNotFound(_0x23d36e,null))[_0xdc5c('0x21')](saveUpdates(_0x17c144[_0xdc5c('0x5a')],null))['then'](respondWithResult(_0x23d36e,null))['catch'](handleError(_0x23d36e,null));};exports[_0xdc5c('0x38')]=function(_0x310d83,_0x2d4a35){return db[_0xdc5c('0x3f')][_0xdc5c('0x5f')]({'where':{'id':_0x310d83[_0xdc5c('0x56')]['id']}})[_0xdc5c('0x21')](handleEntityNotFound(_0x2d4a35,null))['then'](removeEntity(_0x2d4a35,null))[_0xdc5c('0x2b')](handleError(_0x2d4a35,null));};exports[_0xdc5c('0x63')]=function(_0x5b7cb9,_0x3520cb){return db[_0xdc5c('0x3f')][_0xdc5c('0x63')]()[_0xdc5c('0x21')](respondWithResult(_0x3520cb,null))['catch'](handleError(_0x3520cb,null));};exports['getMembers']=function(_0x1151cc,_0x24e043,_0x38339c){var _0x4ad4ff={'raw':!![],'where':{}},_0x35cc4d={},_0x5581c3;return db[_0xdc5c('0x3f')][_0xdc5c('0x64')]({'where':{'id':_0x1151cc['params']['id']}})['then'](handleEntityNotFound(_0x24e043,null))[_0xdc5c('0x21')](function(_0x24bd05){if(_0x24bd05){_0x5581c3=_0x24bd05[_0xdc5c('0x5c')]({'plain':!![]});_0x35cc4d[_0xdc5c('0x43')]=_['keys'](db['UserChatQueue'][_0xdc5c('0x40')]);_0x35cc4d[_0xdc5c('0x44')]=_['keys'](_0x1151cc[_0xdc5c('0x44')]);_0x35cc4d[_0xdc5c('0x46')]=_[_0xdc5c('0x48')](_0x35cc4d[_0xdc5c('0x43')],_0x35cc4d[_0xdc5c('0x44')]);_0x4ad4ff[_0xdc5c('0x47')]=_['intersection'](_0x35cc4d[_0xdc5c('0x43')],qs[_0xdc5c('0x49')](_0x1151cc[_0xdc5c('0x44')][_0xdc5c('0x49')]));_0x4ad4ff[_0xdc5c('0x47')]=_0x4ad4ff[_0xdc5c('0x47')]['length']?_0x4ad4ff['attributes']:_0x35cc4d['model'];if(!_0x1151cc['query'][_0xdc5c('0x4b')]('nolimit')){_0x4ad4ff['limit']=qs[_0xdc5c('0x2f')](_0x1151cc[_0xdc5c('0x44')]['limit']);_0x4ad4ff[_0xdc5c('0x30')]=qs[_0xdc5c('0x30')](_0x1151cc[_0xdc5c('0x44')][_0xdc5c('0x30')]);}_0x4ad4ff['order']=qs[_0xdc5c('0x4e')](_0x1151cc[_0xdc5c('0x44')][_0xdc5c('0x4e')]);_0x4ad4ff[_0xdc5c('0x4f')]=qs[_0xdc5c('0x46')](_['pick'](_0x1151cc['query'],_0x35cc4d[_0xdc5c('0x46')]));_0x4ad4ff['where'][_0xdc5c('0x65')]=_0x24bd05['id'];if(_0x1151cc[_0xdc5c('0x44')][_0xdc5c('0x51')]){_0x4ad4ff[_0xdc5c('0x4f')]=_[_0xdc5c('0x52')](_0x4ad4ff['where'],{'$or':_['map'](_0x4ad4ff[_0xdc5c('0x47')],function(_0x273797){var _0x1f42ed={};_0x1f42ed[_0x273797]={'$like':'%'+_0x1151cc[_0xdc5c('0x44')][_0xdc5c('0x51')]+'%'};return _0x1f42ed;})});}_0x4ad4ff=_[_0xdc5c('0x52')]({},_0x4ad4ff,_0x1151cc['options']);return db['UserChatQueue'][_0xdc5c('0x55')](_0x4ad4ff);}})[_0xdc5c('0x21')](function(_0x30d09f){if(_0x30d09f){return db['User'][_0xdc5c('0x66')]({'where':{'id':_[_0xdc5c('0x3e')](_0x30d09f,_0xdc5c('0x67')),'role':_0xdc5c('0x68')},'attributes':['id','name','chatPause',_0xdc5c('0x69'),_0xdc5c('0x6a')]});}})[_0xdc5c('0x21')](function(_0x4205d7){if(_0x4205d7){return{'count':_0x4205d7['count'],'rows':_['map'](_0x4205d7[_0xdc5c('0x6b')],function(_0x13be53){return{'membername':_0x13be53[_0xdc5c('0x3b')],'UserId':_0x13be53['id'],'queue_name':_0x5581c3[_0xdc5c('0x3b')],'ChatQueueId':_0x5581c3['id'],'interface':util[_0xdc5c('0x6c')](_0xdc5c('0x6d'),'SIP',_0x13be53['name']),'penalty':0x0,'paused':_0x13be53['chatPause'],'createdAt':_0x13be53[_0xdc5c('0x6a')],'updatedAt':_0x13be53['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x24e043,_0x4ad4ff))['catch'](handleError(_0x24e043,null));};exports[_0xdc5c('0x6e')]=function(_0x4cc92a,_0x5f6c7d,_0xa95dd3){var _0xb2562b={};var _0x2da36d={};var _0x5b4f71;var _0x14506f;return db[_0xdc5c('0x3f')][_0xdc5c('0x64')]({'where':{'id':_0x4cc92a[_0xdc5c('0x56')]['id']}})[_0xdc5c('0x21')](handleEntityNotFound(_0x5f6c7d,null))[_0xdc5c('0x21')](function(_0x19e5db){if(_0x19e5db){_0x5b4f71=_0x19e5db;_0x2da36d[_0xdc5c('0x43')]=_[_0xdc5c('0x45')](db[_0xdc5c('0x6f')][_0xdc5c('0x40')]);_0x2da36d['query']=_[_0xdc5c('0x45')](_0x4cc92a['query']);_0x2da36d[_0xdc5c('0x46')]=_[_0xdc5c('0x48')](_0x2da36d[_0xdc5c('0x43')],_0x2da36d[_0xdc5c('0x44')]);_0xb2562b[_0xdc5c('0x47')]=_['intersection'](_0x2da36d[_0xdc5c('0x43')],qs[_0xdc5c('0x49')](_0x4cc92a[_0xdc5c('0x44')][_0xdc5c('0x49')]));_0xb2562b[_0xdc5c('0x47')]=_0xb2562b[_0xdc5c('0x47')][_0xdc5c('0x4a')]?_0xb2562b[_0xdc5c('0x47')]:_0x2da36d[_0xdc5c('0x43')];_0xb2562b[_0xdc5c('0x4d')]=qs['sort'](_0x4cc92a['query']['sort']);_0xb2562b['where']=qs[_0xdc5c('0x46')](_[_0xdc5c('0x50')](_0x4cc92a['query'],_0x2da36d[_0xdc5c('0x46')]));if(_0x4cc92a[_0xdc5c('0x44')]['filter']){_0xb2562b[_0xdc5c('0x4f')]=_[_0xdc5c('0x52')](_0xb2562b[_0xdc5c('0x4f')],{'$or':_['map'](_0xb2562b[_0xdc5c('0x47')],function(_0xfeb5cc){var _0x434aaf={};_0x434aaf[_0xfeb5cc]={'$like':'%'+_0x4cc92a[_0xdc5c('0x44')][_0xdc5c('0x51')]+'%'};return _0x434aaf;})});}_0xb2562b=_['merge']({},_0xb2562b,_0x4cc92a[_0xdc5c('0x58')]);return _0x5b4f71[_0xdc5c('0x6e')](_0xb2562b);}})['then'](function(_0xf0da19){if(_0xf0da19){_0x14506f=_0xf0da19[_0xdc5c('0x4a')];if(!_0x4cc92a[_0xdc5c('0x44')]['hasOwnProperty'](_0xdc5c('0x4c'))){_0xb2562b[_0xdc5c('0x2f')]=qs['limit'](_0x4cc92a['query']['limit']);_0xb2562b['offset']=qs[_0xdc5c('0x30')](_0x4cc92a[_0xdc5c('0x44')]['offset']);}return _0x5b4f71[_0xdc5c('0x6e')](_0xb2562b);}})[_0xdc5c('0x21')](function(_0x1e2d7c){if(_0x1e2d7c){return _0x1e2d7c?{'count':_0x14506f,'rows':_0x1e2d7c}:null;}})[_0xdc5c('0x21')](respondWithResult(_0x5f6c7d,null))[_0xdc5c('0x2b')](handleError(_0x5f6c7d,null));};exports[_0xdc5c('0x70')]=function(_0x4da10a,_0x874044,_0x35d41f){var _0x5a28cf=_0x4da10a[_0xdc5c('0x5a')]['ids'];return db[_0xdc5c('0x6f')][_0xdc5c('0x55')]({'where':{'id':_0x5a28cf},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xdc5c('0x3b'),_0xdc5c('0x71'),_0xdc5c('0x72'),_0xdc5c('0x73')],'raw':!![]}]})[_0xdc5c('0x21')](function(_0x3a72c1){if(_0x3a72c1){var _0x4ecaa1=_['flatMap'](_0x3a72c1,function(_0x9da69e){var _0x22a8b0=_0x9da69e[_0xdc5c('0x5c')]({'plain':!![]});return _0x22a8b0['Agents'];});return db[_0xdc5c('0x3f')][_0xdc5c('0x5f')]({'where':{'id':_0x4da10a['params']['id']}})[_0xdc5c('0x21')](function(_0x5cf2fb){return db[_0xdc5c('0x74')]['transaction'](function(_0x4afea4){return _0x5cf2fb[_0xdc5c('0x70')](_0x5a28cf,{'transaction':_0x4afea4})[_0xdc5c('0x21')](function(){return BPromise[_0xdc5c('0x75')](_0x4ecaa1,function(_0x28680b){return db[_0xdc5c('0x76')][_0xdc5c('0x77')]({'where':{'UserId':_0x28680b['id'],'ChatQueueId':_0x4da10a[_0xdc5c('0x56')]['id']},'transaction':_0x4afea4});});})[_0xdc5c('0x21')](function(){_0x4ecaa1[_0xdc5c('0x78')](function(_0x5f02fc){socket[_0xdc5c('0x79')]('userChatQueue:save',{'UserId':_0x5f02fc['id'],'ChatQueueId':_0x5cf2fb['id']});});});});});}})['then'](respondWithStatusCode(_0x874044,null))[_0xdc5c('0x2b')](handleError(_0x874044,null));};exports[_0xdc5c('0x7a')]=function(_0x26c5d1,_0x24b22b,_0x2fb62b){return db[_0xdc5c('0x6f')][_0xdc5c('0x55')]({'where':{'id':_0x26c5d1[_0xdc5c('0x44')][_0xdc5c('0x7b')]},'attributes':['id'],'include':[{'model':db[_0xdc5c('0x7c')],'as':_0xdc5c('0x7d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x24b22b,null))['then'](function(_0x2a21d4){var _0x5450ac=_[_0xdc5c('0x3e')](_0x2a21d4,'id');var _0x3fa753=[];var _0x5bbbfd=[];var _0x3cc8f6=squel[_0xdc5c('0x7e')]();_0x3cc8f6[_0xdc5c('0x7f')]('tq.TeamId')[_0xdc5c('0x80')](_0xdc5c('0x81'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdc5c('0x4f')](_0xdc5c('0x82'),_0x26c5d1['params']['id']);for(var _0x5380a6=0x0;_0x5380a6<_0x2a21d4['length'];_0x5380a6+=0x1){let _0x173981=_0x2a21d4[_0x5380a6];for(var _0x3f6e90=0x0;_0x3f6e90<_0x173981[_0xdc5c('0x7d')][_0xdc5c('0x4a')];_0x3f6e90+=0x1){let _0xb77d2d=_0x173981[_0xdc5c('0x7d')][_0x3f6e90];var _0x268c66=_0x3cc8f6[_0xdc5c('0x83')]();_0x268c66[_0xdc5c('0x4f')](_0xdc5c('0x84'),_0xb77d2d['id']);_0x5bbbfd[_0xdc5c('0x85')](db[_0xdc5c('0x74')][_0xdc5c('0x44')](_0x268c66[_0xdc5c('0x86')](),{'type':db[_0xdc5c('0x74')][_0xdc5c('0x87')][_0xdc5c('0x88')]})['then'](function(_0x1d2066){if(_0x1d2066['length']===0x1){return _0xb77d2d['id'];}else{var _0x42ea7e=_['every'](_['map'](_0x1d2066,_0xdc5c('0x89')),function(_0x26d360){return _[_0xdc5c('0x8a')](_0x5450ac,_0x26d360);});if(_0x42ea7e){return _0xb77d2d['id'];}}}));}}return BPromise[_0xdc5c('0x8b')](_0x5bbbfd)[_0xdc5c('0x21')](function(_0x4ac786){_0x3fa753=_(_0x3fa753)[_0xdc5c('0x8c')](_0x4ac786)[_0xdc5c('0x8d')]()[_0xdc5c('0x8e')]();return db[_0xdc5c('0x3f')][_0xdc5c('0x5f')]({'where':{'id':_0x26c5d1[_0xdc5c('0x56')]['id']}})[_0xdc5c('0x21')](function(_0x456906){return db[_0xdc5c('0x74')][_0xdc5c('0x8f')](function(_0x3096e8){return _0x456906['removeTeams'](_0x26c5d1['query'][_0xdc5c('0x7b')],{'transaction':_0x3096e8})[_0xdc5c('0x21')](function(){if(!_[_0xdc5c('0x90')](_0x3fa753)){return _0x456906[_0xdc5c('0x91')](_0x3fa753,{'transaction':_0x3096e8});}})[_0xdc5c('0x21')](function(){_0x3fa753['forEach'](function(_0x3461b5){socket['emit'](_0xdc5c('0x92'),{'UserId':_0x3461b5,'ChatQueueId':_0x456906['id']});});});});});});})[_0xdc5c('0x21')](respondWithStatusCode(_0x24b22b,null))[_0xdc5c('0x2b')](handleError(_0x24b22b,null));};exports['addAgents']=function(_0x574280,_0x41d498,_0x586181){return db['ChatQueue']['find']({'where':{'id':_0x574280[_0xdc5c('0x56')]['id']}})['then'](handleEntityNotFound(_0x41d498,null))[_0xdc5c('0x21')](function(_0xe4556e){if(_0xe4556e){return _0xe4556e[_0xdc5c('0x93')](_0x574280['body'][_0xdc5c('0x7b')],_[_0xdc5c('0x94')](_0x574280['body'],[_0xdc5c('0x7b'),'id'])||{})[_0xdc5c('0x95')](function(_0x3bcfad){for(var _0x22f562=0x0;_0x22f562<_0x574280[_0xdc5c('0x5a')][_0xdc5c('0x7b')][_0xdc5c('0x4a')];_0x22f562+=0x1){socket[_0xdc5c('0x79')](_0xdc5c('0x96'),{'UserId':Number(_0x574280[_0xdc5c('0x5a')][_0xdc5c('0x7b')][_0x22f562]),'ChatQueueId':Number(_0x574280['params']['id'])});}return _0x3bcfad;});}})[_0xdc5c('0x21')](respondWithResult(_0x41d498,null))[_0xdc5c('0x2b')](handleError(_0x41d498,null));};exports['removeAgents']=function(_0x428296,_0x148c25,_0x563cae){return db[_0xdc5c('0x3f')][_0xdc5c('0x5f')]({'where':{'id':_0x428296[_0xdc5c('0x56')]['id']}})[_0xdc5c('0x21')](handleEntityNotFound(_0x148c25,null))[_0xdc5c('0x21')](function(_0x55ee08){if(_0x55ee08){return _0x55ee08[_0xdc5c('0x91')](_0x428296[_0xdc5c('0x44')][_0xdc5c('0x7b')])[_0xdc5c('0x21')](function(){if(_[_0xdc5c('0x97')](_0x428296[_0xdc5c('0x44')][_0xdc5c('0x7b')])){for(var _0x5b3e97=0x0;_0x5b3e97<_0x428296[_0xdc5c('0x44')][_0xdc5c('0x7b')][_0xdc5c('0x4a')];_0x5b3e97+=0x1){socket[_0xdc5c('0x79')](_0xdc5c('0x92'),{'UserId':Number(_0x428296[_0xdc5c('0x44')][_0xdc5c('0x7b')][_0x5b3e97]),'ChatQueueId':Number(_0x428296[_0xdc5c('0x56')]['id'])});}}else{socket['emit'](_0xdc5c('0x92'),{'UserId':Number(_0x428296[_0xdc5c('0x44')][_0xdc5c('0x7b')]),'ChatQueueId':Number(_0x428296[_0xdc5c('0x56')]['id'])});}});}})[_0xdc5c('0x21')](respondWithStatusCode(_0x148c25,null))['catch'](handleError(_0x148c25,null));};exports[_0xdc5c('0x98')]=function(_0x209b63,_0x2421f3,_0x44ae01){var _0x275d6a={};var _0x1c8c8b={};var _0x10d611;var _0x2786d9;return db['ChatQueue']['findOne']({'where':{'id':_0x209b63[_0xdc5c('0x56')]['id']}})[_0xdc5c('0x21')](handleEntityNotFound(_0x2421f3,null))[_0xdc5c('0x21')](function(_0x98b1f){if(_0x98b1f){_0x10d611=_0x98b1f;_0x1c8c8b[_0xdc5c('0x43')]=_[_0xdc5c('0x45')](db[_0xdc5c('0x7c')][_0xdc5c('0x40')]);_0x1c8c8b[_0xdc5c('0x44')]=_[_0xdc5c('0x45')](_0x209b63['query']);_0x1c8c8b[_0xdc5c('0x46')]=_['intersection'](_0x1c8c8b['model'],_0x1c8c8b['query']);_0x275d6a[_0xdc5c('0x47')]=_[_0xdc5c('0x48')](_0x1c8c8b[_0xdc5c('0x43')],qs[_0xdc5c('0x49')](_0x209b63['query']['fields']));_0x275d6a[_0xdc5c('0x47')]=_0x275d6a['attributes'][_0xdc5c('0x4a')]?_0x275d6a[_0xdc5c('0x47')]:_0x1c8c8b[_0xdc5c('0x43')];_0x275d6a[_0xdc5c('0x4d')]=qs[_0xdc5c('0x4e')](_0x209b63[_0xdc5c('0x44')]['sort']);_0x275d6a[_0xdc5c('0x4f')]=qs[_0xdc5c('0x46')](_['pick'](_0x209b63[_0xdc5c('0x44')],_0x1c8c8b[_0xdc5c('0x46')]));if(_0x209b63[_0xdc5c('0x44')][_0xdc5c('0x51')]){_0x275d6a[_0xdc5c('0x4f')]=_[_0xdc5c('0x52')](_0x275d6a[_0xdc5c('0x4f')],{'$or':_[_0xdc5c('0x3e')](_0x275d6a['attributes'],function(_0x5060f6){var _0x3a3b4c={};_0x3a3b4c[_0x5060f6]={'$like':'%'+_0x209b63[_0xdc5c('0x44')][_0xdc5c('0x51')]+'%'};return _0x3a3b4c;})});}_0x275d6a=_['merge']({},_0x275d6a,_0x209b63[_0xdc5c('0x58')]);return _0x10d611['getAgents'](_0x275d6a);}})['then'](function(_0x333415){if(_0x333415){_0x2786d9=_0x333415['length'];if(!_0x209b63['query'][_0xdc5c('0x4b')](_0xdc5c('0x4c'))){_0x275d6a[_0xdc5c('0x2f')]=qs[_0xdc5c('0x2f')](_0x209b63[_0xdc5c('0x44')]['limit']);_0x275d6a['offset']=qs[_0xdc5c('0x30')](_0x209b63[_0xdc5c('0x44')][_0xdc5c('0x30')]);}return _0x10d611[_0xdc5c('0x98')](_0x275d6a);}})[_0xdc5c('0x21')](function(_0x3c0ece){if(_0x3c0ece){return _0x3c0ece?{'count':_0x2786d9,'rows':_0x3c0ece}:null;}})[_0xdc5c('0x21')](respondWithResult(_0x2421f3,null))[_0xdc5c('0x2b')](handleError(_0x2421f3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 287d33c..2c50d71 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1b3=['hasOwnProperty','exports','events','../../mysqldb','save','remove','emit'];(function(_0x4f4ab3,_0x4a8171){var _0x2852e0=function(_0x598141){while(--_0x598141){_0x4f4ab3['push'](_0x4f4ab3['shift']());}};_0x2852e0(++_0x4a8171);}(_0xd1b3,0x95));var _0x3d1b=function(_0x70f16e,_0xdb33ed){_0x70f16e=_0x70f16e-0x0;var _0x352cea=_0xd1b3[_0x70f16e];return _0x352cea;};'use strict';var EventEmitter=require(_0x3d1b('0x0'));var ChatQueue=require(_0x3d1b('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d1b('0x2'),'afterUpdate':'update','afterDestroy':_0x3d1b('0x3')};function emitEvent(_0x427299){return function(_0x5baecc,_0x3f2cd4,_0x409d4b){ChatQueueEvents[_0x3d1b('0x4')](_0x427299+':'+_0x5baecc['id'],_0x5baecc);ChatQueueEvents[_0x3d1b('0x4')](_0x427299,_0x5baecc);_0x409d4b(null);};}for(var e in events){if(events[_0x3d1b('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x3d1b('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x2229=['events','../../mysqldb','save','remove','emit'];(function(_0x334473,_0x22608a){var _0xda025d=function(_0x38881f){while(--_0x38881f){_0x334473['push'](_0x334473['shift']());}};_0xda025d(++_0x22608a);}(_0x2229,0x163));var _0x9222=function(_0x4bb32f,_0x2217e){_0x4bb32f=_0x4bb32f-0x0;var _0x2dd6e6=_0x2229[_0x4bb32f];return _0x2dd6e6;};'use strict';var EventEmitter=require(_0x9222('0x0'));var ChatQueue=require(_0x9222('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9222('0x2'),'afterUpdate':'update','afterDestroy':_0x9222('0x3')};function emitEvent(_0x20e18b){return function(_0x1c6b7c,_0x3a7953,_0x242651){ChatQueueEvents[_0x9222('0x4')](_0x20e18b+':'+_0x1c6b7c['id'],_0x1c6b7c);ChatQueueEvents[_0x9222('0x4')](_0x20e18b,_0x1c6b7c);_0x242651(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9d2a360..97cf35c 100644 --- a/server/api/chatQueue/chatQueue.model.js +++ b/server/api/chatQueue/chatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8258=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports','define'];(function(_0xc97e0,_0x5eb956){var _0x20ea86=function(_0x54e105){while(--_0x54e105){_0xc97e0['push'](_0xc97e0['shift']());}};_0x20ea86(++_0x5eb956);}(_0x8258,0x10c));var _0x8825=function(_0x41816b,_0x2ccd04){_0x41816b=_0x41816b-0x0;var _0x5537c2=_0x8258[_0x41816b];return _0x5537c2;};'use strict';var _=require(_0x8825('0x0'));var util=require(_0x8825('0x1'));var logger=require(_0x8825('0x2'))(_0x8825('0x3'));var moment=require(_0x8825('0x4'));var BPromise=require(_0x8825('0x5'));var rp=require(_0x8825('0x6'));var fs=require('fs');var path=require(_0x8825('0x7'));var rimraf=require(_0x8825('0x8'));var config=require('../../config/environment');var attributes=require(_0x8825('0x9'));module[_0x8825('0xa')]=function(_0xf8f6d3,_0x312d44){return _0xf8f6d3[_0x8825('0xb')](_0x8825('0xc'),attributes,{'tableName':_0x8825('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x916a=['ChatQueue','chat_queues','lodash','api','moment','request-promise','path','rimraf','./chatQueue.attributes','exports','define'];(function(_0xe8a22f,_0x254b5f){var _0x30e638=function(_0x55a446){while(--_0x55a446){_0xe8a22f['push'](_0xe8a22f['shift']());}};_0x30e638(++_0x254b5f);}(_0x916a,0x16d));var _0xa916=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x916a[_0x1dd532];return _0x3732aa;};'use strict';var _=require(_0xa916('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa916('0x1'));var moment=require(_0xa916('0x2'));var BPromise=require('bluebird');var rp=require(_0xa916('0x3'));var fs=require('fs');var path=require(_0xa916('0x4'));var rimraf=require(_0xa916('0x5'));var config=require('../../config/environment');var attributes=require(_0xa916('0x6'));module[_0xa916('0x7')]=function(_0x45d6a3,_0x374e78){return _0x45d6a3[_0xa916('0x8')](_0xa916('0x9'),attributes,{'tableName':_0xa916('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index e40fcc9..e45286d 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0ca=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueue','findAll','options','where','limit','include','model','attributes','map','GetChatQueue','ShowChatQueue','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xb0ca,0x1b2));var _0xab0c=function(_0xd0809d,_0x434817){_0xd0809d=_0xd0809d-0x0;var _0x2c8946=_0xb0ca[_0xd0809d];return _0x2c8946;};'use strict';var _=require('lodash');var util=require(_0xab0c('0x0'));var moment=require('moment');var BPromise=require(_0xab0c('0x1'));var rs=require(_0xab0c('0x2'));var fs=require('fs');var Redis=require(_0xab0c('0x3'));var db=require(_0xab0c('0x4'))['db'];var utils=require(_0xab0c('0x5'));var logger=require(_0xab0c('0x6'))(_0xab0c('0x7'));var config=require('../../config/environment');var jayson=require(_0xab0c('0x8'));var client=jayson[_0xab0c('0x9')][_0xab0c('0xa')]({'port':0x232a});config[_0xab0c('0xb')]=_[_0xab0c('0xc')](config[_0xab0c('0xb')],{'host':_0xab0c('0xd'),'port':0x18eb});var socket=require(_0xab0c('0xe'))(new Redis(config[_0xab0c('0xb')]));require('./chatQueue.socket')[_0xab0c('0xf')](socket);function respondWithRpcPromise(_0x15db71,_0x52df38,_0xb79b41){return new BPromise(function(_0x17bff7,_0x11a4ae){return client['request'](_0x15db71,_0xb79b41)[_0xab0c('0x10')](function(_0x53a944){logger[_0xab0c('0x11')](_0xab0c('0x12'),_0x52df38,_0xab0c('0x13'));logger[_0xab0c('0x14')](_0xab0c('0x15'),_0x52df38,_0xab0c('0x13'),JSON[_0xab0c('0x16')](_0x53a944));if(_0x53a944[_0xab0c('0x17')]){if(_0x53a944[_0xab0c('0x17')][_0xab0c('0x18')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x52df38,_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);return _0x11a4ae(_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);}logger[_0xab0c('0x17')](_0xab0c('0x12'),_0x52df38,_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);return _0x17bff7(_0x53a944[_0xab0c('0x17')][_0xab0c('0x19')]);}else{logger[_0xab0c('0x11')](_0xab0c('0x12'),_0x52df38,_0xab0c('0x13'));_0x17bff7(_0x53a944[_0xab0c('0x1a')][_0xab0c('0x19')]);}})[_0xab0c('0x1b')](function(_0x44c6f4){logger[_0xab0c('0x17')](_0xab0c('0x12'),_0x52df38,_0x44c6f4);_0x11a4ae(_0x44c6f4);});});}exports['GetChatQueue']=function(_0x29b873){var _0x4ad10e=this;return new Promise(function(_0x36794d,_0x870902){return db[_0xab0c('0x1c')][_0xab0c('0x1d')]({'raw':_0x29b873[_0xab0c('0x1e')]?_0x29b873[_0xab0c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x29b873[_0xab0c('0x1e')]?_0x29b873[_0xab0c('0x1e')][_0xab0c('0x1f')]||null:null,'attributes':_0x29b873['options']?_0x29b873[_0xab0c('0x1e')]['attributes']||null:null,'limit':_0x29b873[_0xab0c('0x1e')]?_0x29b873[_0xab0c('0x1e')][_0xab0c('0x20')]||null:null,'include':_0x29b873['options']?_0x29b873[_0xab0c('0x1e')][_0xab0c('0x21')]?_['map'](_0x29b873[_0xab0c('0x1e')][_0xab0c('0x21')],function(_0xfe7099){return{'model':db[_0xfe7099[_0xab0c('0x22')]],'as':_0xfe7099['as'],'attributes':_0xfe7099[_0xab0c('0x23')],'include':_0xfe7099[_0xab0c('0x21')]?_[_0xab0c('0x24')](_0xfe7099[_0xab0c('0x21')],function(_0x3ce281){return{'model':db[_0x3ce281[_0xab0c('0x22')]],'as':_0x3ce281['as'],'attributes':_0x3ce281[_0xab0c('0x23')],'include':_0x3ce281[_0xab0c('0x21')]?_[_0xab0c('0x24')](_0x3ce281['include'],function(_0x70f07f){return{'model':db[_0x70f07f[_0xab0c('0x22')]],'as':_0x70f07f['as'],'attributes':_0x70f07f[_0xab0c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xab0c('0x10')](function(_0x47a239){logger['info']('GetChatQueue',_0x29b873);logger['debug'](_0xab0c('0x25'),_0x29b873,JSON[_0xab0c('0x16')](_0x47a239));_0x36794d(_0x47a239);})[_0xab0c('0x1b')](function(_0x3e6b6e){logger[_0xab0c('0x17')]('GetChatQueue',_0x3e6b6e['message'],_0x29b873);_0x870902(_0x4ad10e[_0xab0c('0x17')](0x1f4,_0x3e6b6e[_0xab0c('0x19')]));});});};exports[_0xab0c('0x26')]=function(_0xe36cea){var _0x2bccdb=this;return new Promise(function(_0x577c31,_0x582536){return db['ChatQueue'][_0xab0c('0x27')]({'raw':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x28')]===undefined?!![]:![]:!![],'where':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x1f')]||null:null,'attributes':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x23')]||null:null,'include':_0xe36cea[_0xab0c('0x1e')]?_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x21')]?_['map'](_0xe36cea[_0xab0c('0x1e')][_0xab0c('0x21')],function(_0x366ade){return{'model':db[_0x366ade[_0xab0c('0x22')]],'as':_0x366ade['as'],'attributes':_0x366ade[_0xab0c('0x23')],'include':_0x366ade['include']?_['map'](_0x366ade['include'],function(_0x4c5f21){return{'model':db[_0x4c5f21[_0xab0c('0x22')]],'as':_0x4c5f21['as'],'attributes':_0x4c5f21['attributes'],'include':_0x4c5f21['include']?_[_0xab0c('0x24')](_0x4c5f21[_0xab0c('0x21')],function(_0xd1a5fb){return{'model':db[_0xd1a5fb[_0xab0c('0x22')]],'as':_0xd1a5fb['as'],'attributes':_0xd1a5fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xab0c('0x10')](function(_0x16048c){logger[_0xab0c('0x11')](_0xab0c('0x26'),_0xe36cea);logger['debug'](_0xab0c('0x26'),_0xe36cea,JSON[_0xab0c('0x16')](_0x16048c));_0x577c31(_0x16048c);})[_0xab0c('0x1b')](function(_0x2dbd55){logger[_0xab0c('0x17')](_0xab0c('0x26'),_0x2dbd55[_0xab0c('0x19')],_0xe36cea);_0x582536(_0x2bccdb['error'](0x1f4,_0x2dbd55[_0xab0c('0x19')]));});});}; \ No newline at end of file +var _0x9a43=['then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','ChatQueue','options','raw','where','limit','include','map','model','attributes','debug','catch','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register'];(function(_0x2af1e8,_0x54df0a){var _0x2a9cfa=function(_0x37fce5){while(--_0x37fce5){_0x2af1e8['push'](_0x2af1e8['shift']());}};_0x2a9cfa(++_0x54df0a);}(_0x9a43,0x15a));var _0x39a4=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0x9a43[_0xaf25ae];return _0x49732d;};'use strict';var _=require('lodash');var util=require(_0x39a4('0x0'));var moment=require(_0x39a4('0x1'));var BPromise=require(_0x39a4('0x2'));var rs=require(_0x39a4('0x3'));var fs=require('fs');var Redis=require(_0x39a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39a4('0x5'));var config=require(_0x39a4('0x6'));var jayson=require(_0x39a4('0x7'));var client=jayson['client'][_0x39a4('0x8')]({'port':0x232a});config[_0x39a4('0x9')]=_['defaults'](config[_0x39a4('0x9')],{'host':_0x39a4('0xa'),'port':0x18eb});var socket=require(_0x39a4('0xb'))(new Redis(config[_0x39a4('0x9')]));require(_0x39a4('0xc'))[_0x39a4('0xd')](socket);function respondWithRpcPromise(_0x3b3dfa,_0xb133de,_0x1cf357){return new BPromise(function(_0x507804,_0x37a2cb){return client['request'](_0x3b3dfa,_0x1cf357)[_0x39a4('0xe')](function(_0x597777){logger[_0x39a4('0xf')](_0x39a4('0x10'),_0xb133de,_0x39a4('0x11'));logger['debug'](_0x39a4('0x12'),_0xb133de,'request\x20sent',JSON[_0x39a4('0x13')](_0x597777));if(_0x597777[_0x39a4('0x14')]){if(_0x597777[_0x39a4('0x14')][_0x39a4('0x15')]===0x1f4){logger[_0x39a4('0x14')](_0x39a4('0x10'),_0xb133de,_0x597777[_0x39a4('0x14')]['message']);return _0x37a2cb(_0x597777[_0x39a4('0x14')]['message']);}logger[_0x39a4('0x14')](_0x39a4('0x10'),_0xb133de,_0x597777[_0x39a4('0x14')]['message']);return _0x507804(_0x597777[_0x39a4('0x14')][_0x39a4('0x16')]);}else{logger[_0x39a4('0xf')](_0x39a4('0x10'),_0xb133de,'request\x20sent');_0x507804(_0x597777['result'][_0x39a4('0x16')]);}})['catch'](function(_0x5d86db){logger[_0x39a4('0x14')](_0x39a4('0x10'),_0xb133de,_0x5d86db);_0x37a2cb(_0x5d86db);});});}exports[_0x39a4('0x17')]=function(_0x3c5b43){var _0x46ee2d=this;return new Promise(function(_0x160e9f,_0x285975){return db[_0x39a4('0x18')]['findAll']({'raw':_0x3c5b43[_0x39a4('0x19')]?_0x3c5b43[_0x39a4('0x19')][_0x39a4('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c5b43[_0x39a4('0x19')]?_0x3c5b43[_0x39a4('0x19')][_0x39a4('0x1b')]||null:null,'attributes':_0x3c5b43[_0x39a4('0x19')]?_0x3c5b43[_0x39a4('0x19')]['attributes']||null:null,'limit':_0x3c5b43['options']?_0x3c5b43[_0x39a4('0x19')][_0x39a4('0x1c')]||null:null,'include':_0x3c5b43['options']?_0x3c5b43['options'][_0x39a4('0x1d')]?_[_0x39a4('0x1e')](_0x3c5b43['options'][_0x39a4('0x1d')],function(_0xbe757c){return{'model':db[_0xbe757c[_0x39a4('0x1f')]],'as':_0xbe757c['as'],'attributes':_0xbe757c['attributes'],'include':_0xbe757c[_0x39a4('0x1d')]?_['map'](_0xbe757c[_0x39a4('0x1d')],function(_0x5785b4){return{'model':db[_0x5785b4[_0x39a4('0x1f')]],'as':_0x5785b4['as'],'attributes':_0x5785b4[_0x39a4('0x20')],'include':_0x5785b4[_0x39a4('0x1d')]?_['map'](_0x5785b4[_0x39a4('0x1d')],function(_0x142dac){return{'model':db[_0x142dac[_0x39a4('0x1f')]],'as':_0x142dac['as'],'attributes':_0x142dac[_0x39a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x39a4('0xe')](function(_0x5d1eba){logger[_0x39a4('0xf')](_0x39a4('0x17'),_0x3c5b43);logger[_0x39a4('0x21')](_0x39a4('0x17'),_0x3c5b43,JSON[_0x39a4('0x13')](_0x5d1eba));_0x160e9f(_0x5d1eba);})[_0x39a4('0x22')](function(_0x53d500){logger[_0x39a4('0x14')](_0x39a4('0x17'),_0x53d500[_0x39a4('0x16')],_0x3c5b43);_0x285975(_0x46ee2d['error'](0x1f4,_0x53d500[_0x39a4('0x16')]));});});};exports[_0x39a4('0x23')]=function(_0x218646){var _0x25c9e0=this;return new Promise(function(_0x2d32d5,_0x3a1831){return db[_0x39a4('0x18')]['find']({'raw':_0x218646[_0x39a4('0x19')]?_0x218646[_0x39a4('0x19')][_0x39a4('0x1a')]===undefined?!![]:![]:!![],'where':_0x218646[_0x39a4('0x19')]?_0x218646['options'][_0x39a4('0x1b')]||null:null,'attributes':_0x218646[_0x39a4('0x19')]?_0x218646['options']['attributes']||null:null,'include':_0x218646[_0x39a4('0x19')]?_0x218646[_0x39a4('0x19')][_0x39a4('0x1d')]?_[_0x39a4('0x1e')](_0x218646['options'][_0x39a4('0x1d')],function(_0x1af1a1){return{'model':db[_0x1af1a1[_0x39a4('0x1f')]],'as':_0x1af1a1['as'],'attributes':_0x1af1a1[_0x39a4('0x20')],'include':_0x1af1a1['include']?_[_0x39a4('0x1e')](_0x1af1a1[_0x39a4('0x1d')],function(_0x4486dc){return{'model':db[_0x4486dc['model']],'as':_0x4486dc['as'],'attributes':_0x4486dc[_0x39a4('0x20')],'include':_0x4486dc[_0x39a4('0x1d')]?_[_0x39a4('0x1e')](_0x4486dc[_0x39a4('0x1d')],function(_0x4cb60a){return{'model':db[_0x4cb60a[_0x39a4('0x1f')]],'as':_0x4cb60a['as'],'attributes':_0x4cb60a[_0x39a4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x39a4('0xe')](function(_0x85fae7){logger[_0x39a4('0xf')](_0x39a4('0x23'),_0x218646);logger[_0x39a4('0x21')](_0x39a4('0x23'),_0x218646,JSON[_0x39a4('0x13')](_0x85fae7));_0x2d32d5(_0x85fae7);})[_0x39a4('0x22')](function(_0x289240){logger['error'](_0x39a4('0x23'),_0x289240[_0x39a4('0x16')],_0x218646);_0x3a1831(_0x25c9e0['error'](0x1f4,_0x289240['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 678432a..94a797c 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['removeListener','register','./chatQueue.events','save'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x55ca,0x126));var _0xa55c=function(_0x3b4585,_0x16a9c2){_0x3b4585=_0x3b4585-0x0;var _0x551be9=_0x55ca[_0x3b4585];return _0x551be9;};'use strict';var ChatQueueEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x49875a,_0x1c6ec3){return function(_0x267ea0){_0x1c6ec3['emit'](_0x49875a,_0x267ea0);};}function removeListener(_0x3b478a,_0x2db02a){return function(){ChatQueueEvents[_0xa55c('0x2')](_0x3b478a,_0x2db02a);};}exports[_0xa55c('0x3')]=function(_0x3c97c8){for(var _0x279caa=0x0,_0x36b623=events['length'];_0x279caa<_0x36b623;_0x279caa++){var _0x2121fd=events[_0x279caa];var _0x2537f0=createListener('chatQueue:'+_0x2121fd,_0x3c97c8);ChatQueueEvents['on'](_0x2121fd,_0x2537f0);}}; \ No newline at end of file +var _0xb458=['length','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x1df83c,_0x4c0bc4){var _0x33f860=function(_0x270c6c){while(--_0x270c6c){_0x1df83c['push'](_0x1df83c['shift']());}};_0x33f860(++_0x4c0bc4);}(_0xb458,0x103));var _0x8b45=function(_0x1a3d50,_0x465249){_0x1a3d50=_0x1a3d50-0x0;var _0x135178=_0xb458[_0x1a3d50];return _0x135178;};'use strict';var ChatQueueEvents=require(_0x8b45('0x0'));var events=[_0x8b45('0x1'),_0x8b45('0x2'),'update'];function createListener(_0x58a508,_0xdf89d4){return function(_0x93d9cd){_0xdf89d4[_0x8b45('0x3')](_0x58a508,_0x93d9cd);};}function removeListener(_0x13a8c6,_0x5d51e4){return function(){ChatQueueEvents[_0x8b45('0x4')](_0x13a8c6,_0x5d51e4);};}exports['register']=function(_0x5cc2d5){for(var _0xe8d774=0x0,_0x12bd05=events[_0x8b45('0x5')];_0xe8d774<_0x12bd05;_0xe8d774++){var _0x3a8ccb=events[_0xe8d774];var _0x32342f=createListener('chatQueue:'+_0x3a8ccb,_0x5cc2d5);ChatQueueEvents['on'](_0x3a8ccb,_0x32342f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index f13ca1f..f394b4a 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x510dcb,_0x309067){var _0x4e135d=function(_0x5385f4){while(--_0x5385f4){_0x510dcb['push'](_0x510dcb['shift']());}};_0x4e135d(++_0x309067);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3b2a4f,_0xb2c811){var _0x439bd8=function(_0xea9a05){while(--_0xea9a05){_0x3b2a4f['push'](_0x3b2a4f['shift']());}};_0x439bd8(++_0xb2c811);}(_0x008c,0x188));var _0xc008=function(_0x191ff0,_0x50515a){_0x191ff0=_0x191ff0-0x0;var _0x1003ac=_0x008c[_0x191ff0];return _0x1003ac;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index fe3e999..a7216d2 100644 --- a/server/api/chatQueueReport/chatQueueReport.attributes.js +++ b/server/api/chatQueueReport/chatQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3de2=['DATE','moment','exports','STRING'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0x3de2,0x79));var _0x23de=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x3de2[_0x16b9ed];return _0x66b1f8;};'use strict';var moment=require(_0x23de('0x0'));var Sequelize=require('sequelize');module[_0x23de('0x1')]={'uniqueid':{'type':Sequelize[_0x23de('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x23de('0x2')]},'joinAt':{'type':Sequelize[_0x23de('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x23de('0x3')]},'reason':{'type':Sequelize[_0x23de('0x2')]}}; \ No newline at end of file +var _0xbdf3=['DATE','moment','sequelize','exports','STRING'];(function(_0x44f7c2,_0x205105){var _0x18aadf=function(_0x4812d8){while(--_0x4812d8){_0x44f7c2['push'](_0x44f7c2['shift']());}};_0x18aadf(++_0x205105);}(_0xbdf3,0x155));var _0x3bdf=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0xbdf3[_0x3c6b7d];return _0x1d3ed2;};'use strict';var moment=require(_0x3bdf('0x0'));var Sequelize=require(_0x3bdf('0x1'));module[_0x3bdf('0x2')]={'uniqueid':{'type':Sequelize[_0x3bdf('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3bdf('0x3')]},'joinAt':{'type':Sequelize[_0x3bdf('0x4')]},'leaveAt':{'type':Sequelize[_0x3bdf('0x4')]},'acceptAt':{'type':Sequelize[_0x3bdf('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3bdf('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 382c480..0a1018c 100644 --- a/server/api/chatQueueReport/chatQueueReport.controller.js +++ b/server/api/chatQueueReport/chatQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9120=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9120,0x1b3));var _0x0912=function(_0x1eae7f,_0xbae8fa){_0x1eae7f=_0x1eae7f-0x0;var _0x453d75=_0x9120[_0x1eae7f];return _0x453d75;};'use strict';var emlformat=require(_0x0912('0x0'));var rimraf=require(_0x0912('0x1'));var zipdir=require(_0x0912('0x2'));var jsonpatch=require(_0x0912('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0912('0x4'));var Mustache=require(_0x0912('0x5'));var util=require(_0x0912('0x6'));var path=require(_0x0912('0x7'));var sox=require(_0x0912('0x8'));var csv=require(_0x0912('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0912('0xa'));var _=require(_0x0912('0xb'));var squel=require(_0x0912('0xc'));var crypto=require('crypto');var jsforce=require(_0x0912('0xd'));var deskjs=require(_0x0912('0xe'));var toCsv=require(_0x0912('0x9'));var querystring=require(_0x0912('0xf'));var Papa=require(_0x0912('0x10'));var Redis=require('ioredis');var authService=require(_0x0912('0x11'));var qs=require(_0x0912('0x12'));var as=require(_0x0912('0x13'));var hardwareService=require(_0x0912('0x14'));var logger=require('../../config/logger')(_0x0912('0x15'));var utils=require('../../config/utils');var config=require(_0x0912('0x16'));var licenseUtil=require(_0x0912('0x17'));var db=require(_0x0912('0x18'))['db'];function respondWithStatusCode(_0xc7af62,_0x22752b){_0x22752b=_0x22752b||0xcc;return function(_0x10faac){if(_0x10faac){return _0xc7af62[_0x0912('0x19')](_0x22752b);}return _0xc7af62[_0x0912('0x1a')](_0x22752b)[_0x0912('0x1b')]();};}function respondWithResult(_0x102468,_0x17f22d){_0x17f22d=_0x17f22d||0xc8;return function(_0x350d6b){if(_0x350d6b){return _0x102468[_0x0912('0x1a')](_0x17f22d)[_0x0912('0x1c')](_0x350d6b);}};}function respondWithFilteredResult(_0x247612,_0x5eb1c9){return function(_0x4d00fd){if(_0x4d00fd){var _0x1ed3e8=typeof _0x5eb1c9['offset']===_0x0912('0x1d')&&typeof _0x5eb1c9['limit']===_0x0912('0x1d');var _0x49b581=_0x4d00fd[_0x0912('0x1e')];var _0x5eace1=_0x1ed3e8?0x0:_0x5eb1c9[_0x0912('0x1f')];var _0x5357db=_0x1ed3e8?_0x4d00fd[_0x0912('0x1e')]:_0x5eb1c9['offset']+_0x5eb1c9['limit'];var _0x3377af;if(_0x5357db>=_0x49b581){_0x5357db=_0x49b581;_0x3377af=0xc8;}else{_0x3377af=0xce;}_0x247612['status'](_0x3377af);return _0x247612[_0x0912('0x20')](_0x0912('0x21'),_0x5eace1+'-'+_0x5357db+'/'+_0x49b581)['json'](_0x4d00fd);}return null;};}function patchUpdates(_0x106008){return function(_0xb1af32){try{jsonpatch[_0x0912('0x22')](_0xb1af32,_0x106008,!![]);}catch(_0x5927d2){return BPromise['reject'](_0x5927d2);}return _0xb1af32[_0x0912('0x23')]();};}function saveUpdates(_0x626428,_0x1f04a1){return function(_0x30b7cc){if(_0x30b7cc){return _0x30b7cc[_0x0912('0x24')](_0x626428)[_0x0912('0x25')](function(_0x6c4902){return _0x6c4902;});}return null;};}function removeEntity(_0x2a3e70,_0xca7f8b){return function(_0x572d12){if(_0x572d12){return _0x572d12[_0x0912('0x26')]()[_0x0912('0x25')](function(){_0x2a3e70[_0x0912('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a938e,_0x21d65b){return function(_0x53d673){if(!_0x53d673){_0x4a938e['sendStatus'](0x194);}return _0x53d673;};}function handleError(_0x39462e,_0x39e96b){_0x39e96b=_0x39e96b||0x1f4;return function(_0x4d45d2){logger[_0x0912('0x27')](_0x4d45d2[_0x0912('0x28')]);if(_0x4d45d2[_0x0912('0x29')]){delete _0x4d45d2[_0x0912('0x29')];}_0x39462e[_0x0912('0x1a')](_0x39e96b)['send'](_0x4d45d2);};}exports[_0x0912('0x2a')]=function(_0x1d6c87,_0x4ac024){var _0x2b1653={},_0x3428a9={},_0x2ce714={'count':0x0,'rows':[]};var _0x5b3956=_[_0x0912('0x2b')](db[_0x0912('0x2c')][_0x0912('0x2d')],function(_0x176529){return{'name':_0x176529['fieldName'],'type':_0x176529[_0x0912('0x2e')][_0x0912('0x2f')]};});_0x3428a9[_0x0912('0x30')]=_[_0x0912('0x2b')](_0x5b3956,_0x0912('0x29'));_0x3428a9[_0x0912('0x31')]=_['keys'](_0x1d6c87['query']);_0x3428a9[_0x0912('0x32')]=_[_0x0912('0x33')](_0x3428a9['model'],_0x3428a9['query']);_0x2b1653[_0x0912('0x34')]=_[_0x0912('0x33')](_0x3428a9[_0x0912('0x30')],qs[_0x0912('0x35')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x35')]));_0x2b1653[_0x0912('0x34')]=_0x2b1653[_0x0912('0x34')]['length']?_0x2b1653['attributes']:_0x3428a9[_0x0912('0x30')];if(!_0x1d6c87[_0x0912('0x31')]['hasOwnProperty'](_0x0912('0x36'))){_0x2b1653[_0x0912('0x37')]=qs[_0x0912('0x37')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x37')]);_0x2b1653[_0x0912('0x1f')]=qs[_0x0912('0x1f')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x1f')]);}_0x2b1653['order']=qs[_0x0912('0x38')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x38')]);_0x2b1653[_0x0912('0x39')]=qs[_0x0912('0x32')](_[_0x0912('0x3a')](_0x1d6c87[_0x0912('0x31')],_0x3428a9['filters']),_0x5b3956);if(_0x1d6c87[_0x0912('0x31')]['filter']){_0x2b1653['where']=_['merge'](_0x2b1653[_0x0912('0x39')],{'$or':_[_0x0912('0x2b')](_0x5b3956,function(_0x5db5f9){if(_0x5db5f9[_0x0912('0x2e')]!==_0x0912('0x3b')){var _0xfdf81c={};_0xfdf81c[_0x5db5f9['name']]={'$like':'%'+_0x1d6c87[_0x0912('0x31')][_0x0912('0x3c')]+'%'};return _0xfdf81c;}})});}_0x2b1653=_['merge']({},_0x2b1653,_0x1d6c87[_0x0912('0x3d')]);var _0x40de57={'where':_0x2b1653[_0x0912('0x39')]};return db[_0x0912('0x2c')][_0x0912('0x1e')](_0x40de57)[_0x0912('0x25')](function(_0x4eb359){_0x2ce714[_0x0912('0x1e')]=_0x4eb359;if(_0x1d6c87[_0x0912('0x31')][_0x0912('0x3e')]){_0x2b1653[_0x0912('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0912('0x40')](_0x2b1653);})[_0x0912('0x25')](function(_0x10040b){_0x2ce714['rows']=_0x10040b;return _0x2ce714;})[_0x0912('0x25')](respondWithFilteredResult(_0x4ac024,_0x2b1653))[_0x0912('0x41')](handleError(_0x4ac024,null));};exports[_0x0912('0x42')]=function(_0x19839e,_0x1c5158){var _0x320f98={'raw':!![],'where':{'id':_0x19839e[_0x0912('0x43')]['id']}},_0x15e23b={};_0x15e23b['model']=_[_0x0912('0x44')](db['ChatQueueReport'][_0x0912('0x2d')]);_0x15e23b[_0x0912('0x31')]=_[_0x0912('0x44')](_0x19839e[_0x0912('0x31')]);_0x15e23b[_0x0912('0x32')]=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],_0x15e23b[_0x0912('0x31')]);_0x320f98['attributes']=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],qs[_0x0912('0x35')](_0x19839e['query'][_0x0912('0x35')]));_0x320f98[_0x0912('0x34')]=_0x320f98[_0x0912('0x34')][_0x0912('0x45')]?_0x320f98[_0x0912('0x34')]:_0x15e23b[_0x0912('0x30')];if(_0x19839e[_0x0912('0x31')][_0x0912('0x3e')]){_0x320f98[_0x0912('0x3f')]=[{'all':!![]}];}_0x320f98=_[_0x0912('0x46')]({},_0x320f98,_0x19839e[_0x0912('0x3d')]);return db[_0x0912('0x2c')][_0x0912('0x47')](_0x320f98)[_0x0912('0x25')](handleEntityNotFound(_0x1c5158,null))[_0x0912('0x25')](respondWithResult(_0x1c5158,null))[_0x0912('0x41')](handleError(_0x1c5158,null));};exports[_0x0912('0x48')]=function(_0x255ee5,_0x3b0548){return db[_0x0912('0x2c')][_0x0912('0x48')](_0x255ee5[_0x0912('0x49')],{})[_0x0912('0x25')](respondWithResult(_0x3b0548,0xc9))['catch'](handleError(_0x3b0548,null));};exports[_0x0912('0x24')]=function(_0x3b94cc,_0x591c83){if(_0x3b94cc[_0x0912('0x49')]['id']){delete _0x3b94cc[_0x0912('0x49')]['id'];}return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x3b94cc[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x591c83,null))['then'](saveUpdates(_0x3b94cc[_0x0912('0x49')],null))[_0x0912('0x25')](respondWithResult(_0x591c83,null))[_0x0912('0x41')](handleError(_0x591c83,null));};exports['destroy']=function(_0x11364e,_0x3ce4bf){return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x11364e[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x3ce4bf,null))[_0x0912('0x25')](removeEntity(_0x3ce4bf,null))[_0x0912('0x41')](handleError(_0x3ce4bf,null));};exports['describe']=function(_0x91bb1a,_0x360313){return db[_0x0912('0x2c')][_0x0912('0x4a')]()[_0x0912('0x25')](respondWithResult(_0x360313,null))['catch'](handleError(_0x360313,null));}; \ No newline at end of file +var _0x3f96=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','fields','includeAll','create','body','params','find','describe','eml-format'];(function(_0x2fef82,_0x19b8e8){var _0x52b8d5=function(_0x4ee388){while(--_0x4ee388){_0x2fef82['push'](_0x2fef82['shift']());}};_0x52b8d5(++_0x19b8e8);}(_0x3f96,0x1d3));var _0x63f9=function(_0x2b2c75,_0x49bdd1){_0x2b2c75=_0x2b2c75-0x0;var _0x15c1ea=_0x3f96[_0x2b2c75];return _0x15c1ea;};'use strict';var emlformat=require(_0x63f9('0x0'));var rimraf=require(_0x63f9('0x1'));var zipdir=require(_0x63f9('0x2'));var jsonpatch=require(_0x63f9('0x3'));var rp=require(_0x63f9('0x4'));var moment=require('moment');var BPromise=require(_0x63f9('0x5'));var Mustache=require(_0x63f9('0x6'));var util=require(_0x63f9('0x7'));var path=require(_0x63f9('0x8'));var sox=require(_0x63f9('0x9'));var csv=require('to-csv');var ejs=require(_0x63f9('0xa'));var fs=require('fs');var fs_extra=require(_0x63f9('0xb'));var _=require(_0x63f9('0xc'));var squel=require(_0x63f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x63f9('0xe'));var deskjs=require(_0x63f9('0xf'));var toCsv=require(_0x63f9('0x10'));var querystring=require(_0x63f9('0x11'));var Papa=require(_0x63f9('0x12'));var Redis=require(_0x63f9('0x13'));var authService=require(_0x63f9('0x14'));var qs=require(_0x63f9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f9('0x16'));var logger=require(_0x63f9('0x17'))('api');var utils=require(_0x63f9('0x18'));var config=require(_0x63f9('0x19'));var licenseUtil=require(_0x63f9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45881b,_0x376780){_0x376780=_0x376780||0xcc;return function(_0x7025cc){if(_0x7025cc){return _0x45881b[_0x63f9('0x1b')](_0x376780);}return _0x45881b[_0x63f9('0x1c')](_0x376780)[_0x63f9('0x1d')]();};}function respondWithResult(_0x31997c,_0x51ec79){_0x51ec79=_0x51ec79||0xc8;return function(_0x19b409){if(_0x19b409){return _0x31997c['status'](_0x51ec79)[_0x63f9('0x1e')](_0x19b409);}};}function respondWithFilteredResult(_0x52be5e,_0x47050b){return function(_0x1fa6dd){if(_0x1fa6dd){var _0x37fc43=typeof _0x47050b[_0x63f9('0x1f')]===_0x63f9('0x20')&&typeof _0x47050b[_0x63f9('0x21')]===_0x63f9('0x20');var _0x5e25ae=_0x1fa6dd[_0x63f9('0x22')];var _0x4475d9=_0x37fc43?0x0:_0x47050b[_0x63f9('0x1f')];var _0x41d3a3=_0x37fc43?_0x1fa6dd[_0x63f9('0x22')]:_0x47050b['offset']+_0x47050b[_0x63f9('0x21')];var _0x30aa4d;if(_0x41d3a3>=_0x5e25ae){_0x41d3a3=_0x5e25ae;_0x30aa4d=0xc8;}else{_0x30aa4d=0xce;}_0x52be5e[_0x63f9('0x1c')](_0x30aa4d);return _0x52be5e['set'](_0x63f9('0x23'),_0x4475d9+'-'+_0x41d3a3+'/'+_0x5e25ae)[_0x63f9('0x1e')](_0x1fa6dd);}return null;};}function patchUpdates(_0x170f4){return function(_0x262b43){try{jsonpatch[_0x63f9('0x24')](_0x262b43,_0x170f4,!![]);}catch(_0x537a11){return BPromise['reject'](_0x537a11);}return _0x262b43[_0x63f9('0x25')]();};}function saveUpdates(_0x3926a2,_0x3c0589){return function(_0x39c2d4){if(_0x39c2d4){return _0x39c2d4[_0x63f9('0x26')](_0x3926a2)[_0x63f9('0x27')](function(_0x3720c9){return _0x3720c9;});}return null;};}function removeEntity(_0x549454,_0x5994c1){return function(_0x33092b){if(_0x33092b){return _0x33092b[_0x63f9('0x28')]()[_0x63f9('0x27')](function(){_0x549454[_0x63f9('0x1c')](0xcc)[_0x63f9('0x1d')]();});}};}function handleEntityNotFound(_0x62c363,_0x3e3c14){return function(_0xbb9716){if(!_0xbb9716){_0x62c363['sendStatus'](0x194);}return _0xbb9716;};}function handleError(_0x4abbf2,_0x5cf43d){_0x5cf43d=_0x5cf43d||0x1f4;return function(_0x1fcb7c){logger[_0x63f9('0x29')](_0x1fcb7c[_0x63f9('0x2a')]);if(_0x1fcb7c['name']){delete _0x1fcb7c[_0x63f9('0x2b')];}_0x4abbf2['status'](_0x5cf43d)[_0x63f9('0x2c')](_0x1fcb7c);};}exports[_0x63f9('0x2d')]=function(_0x25f5f0,_0x51c84b){var _0x1b56bd={},_0x3e6728={},_0x271872={'count':0x0,'rows':[]};var _0x22a82a=_[_0x63f9('0x2e')](db[_0x63f9('0x2f')]['rawAttributes'],function(_0x32f2d5){return{'name':_0x32f2d5[_0x63f9('0x30')],'type':_0x32f2d5[_0x63f9('0x31')][_0x63f9('0x32')]};});_0x3e6728[_0x63f9('0x33')]=_[_0x63f9('0x2e')](_0x22a82a,_0x63f9('0x2b'));_0x3e6728[_0x63f9('0x34')]=_[_0x63f9('0x35')](_0x25f5f0['query']);_0x3e6728[_0x63f9('0x36')]=_['intersection'](_0x3e6728[_0x63f9('0x33')],_0x3e6728[_0x63f9('0x34')]);_0x1b56bd[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x3e6728[_0x63f9('0x33')],qs['fields'](_0x25f5f0[_0x63f9('0x34')]['fields']));_0x1b56bd['attributes']=_0x1b56bd[_0x63f9('0x37')][_0x63f9('0x39')]?_0x1b56bd[_0x63f9('0x37')]:_0x3e6728['model'];if(!_0x25f5f0[_0x63f9('0x34')]['hasOwnProperty'](_0x63f9('0x3a'))){_0x1b56bd[_0x63f9('0x21')]=qs[_0x63f9('0x21')](_0x25f5f0['query']['limit']);_0x1b56bd[_0x63f9('0x1f')]=qs[_0x63f9('0x1f')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x1f')]);}_0x1b56bd['order']=qs[_0x63f9('0x3b')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3b')]);_0x1b56bd[_0x63f9('0x3c')]=qs['filters'](_[_0x63f9('0x3d')](_0x25f5f0[_0x63f9('0x34')],_0x3e6728[_0x63f9('0x36')]),_0x22a82a);if(_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]){_0x1b56bd[_0x63f9('0x3c')]=_[_0x63f9('0x3f')](_0x1b56bd[_0x63f9('0x3c')],{'$or':_[_0x63f9('0x2e')](_0x22a82a,function(_0x54f4d0){if(_0x54f4d0[_0x63f9('0x31')]!==_0x63f9('0x40')){var _0x110aa1={};_0x110aa1[_0x54f4d0[_0x63f9('0x2b')]]={'$like':'%'+_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]+'%'};return _0x110aa1;}})});}_0x1b56bd=_['merge']({},_0x1b56bd,_0x25f5f0[_0x63f9('0x41')]);var _0x2f1202={'where':_0x1b56bd[_0x63f9('0x3c')]};return db[_0x63f9('0x2f')][_0x63f9('0x22')](_0x2f1202)[_0x63f9('0x27')](function(_0x1d733a){_0x271872[_0x63f9('0x22')]=_0x1d733a;if(_0x25f5f0['query']['includeAll']){_0x1b56bd['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0x63f9('0x42')](_0x1b56bd);})[_0x63f9('0x27')](function(_0x19a603){_0x271872[_0x63f9('0x43')]=_0x19a603;return _0x271872;})[_0x63f9('0x27')](respondWithFilteredResult(_0x51c84b,_0x1b56bd))[_0x63f9('0x44')](handleError(_0x51c84b,null));};exports[_0x63f9('0x45')]=function(_0x16a1f3,_0x388261){var _0x5f53ab={'raw':!![],'where':{'id':_0x16a1f3['params']['id']}},_0x23ee18={};_0x23ee18[_0x63f9('0x33')]=_['keys'](db[_0x63f9('0x2f')][_0x63f9('0x46')]);_0x23ee18[_0x63f9('0x34')]=_['keys'](_0x16a1f3[_0x63f9('0x34')]);_0x23ee18[_0x63f9('0x36')]=_[_0x63f9('0x38')](_0x23ee18['model'],_0x23ee18['query']);_0x5f53ab[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x23ee18[_0x63f9('0x33')],qs[_0x63f9('0x47')](_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x47')]));_0x5f53ab['attributes']=_0x5f53ab[_0x63f9('0x37')][_0x63f9('0x39')]?_0x5f53ab['attributes']:_0x23ee18[_0x63f9('0x33')];if(_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x48')]){_0x5f53ab['include']=[{'all':!![]}];}_0x5f53ab=_['merge']({},_0x5f53ab,_0x16a1f3[_0x63f9('0x41')]);return db[_0x63f9('0x2f')]['find'](_0x5f53ab)[_0x63f9('0x27')](handleEntityNotFound(_0x388261,null))[_0x63f9('0x27')](respondWithResult(_0x388261,null))[_0x63f9('0x44')](handleError(_0x388261,null));};exports[_0x63f9('0x49')]=function(_0x119b8e,_0x51d818){return db[_0x63f9('0x2f')][_0x63f9('0x49')](_0x119b8e[_0x63f9('0x4a')],{})['then'](respondWithResult(_0x51d818,0xc9))['catch'](handleError(_0x51d818,null));};exports['update']=function(_0x4e6466,_0x13803d){if(_0x4e6466[_0x63f9('0x4a')]['id']){delete _0x4e6466[_0x63f9('0x4a')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x4e6466[_0x63f9('0x4b')]['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x13803d,null))[_0x63f9('0x27')](saveUpdates(_0x4e6466[_0x63f9('0x4a')],null))[_0x63f9('0x27')](respondWithResult(_0x13803d,null))[_0x63f9('0x44')](handleError(_0x13803d,null));};exports[_0x63f9('0x28')]=function(_0x387aa5,_0x53f06f){return db[_0x63f9('0x2f')][_0x63f9('0x4c')]({'where':{'id':_0x387aa5['params']['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x53f06f,null))[_0x63f9('0x27')](removeEntity(_0x53f06f,null))['catch'](handleError(_0x53f06f,null));};exports[_0x63f9('0x4d')]=function(_0x4c1276,_0x19e137){return db[_0x63f9('0x2f')][_0x63f9('0x4d')]()[_0x63f9('0x27')](respondWithResult(_0x19e137,null))[_0x63f9('0x44')](handleError(_0x19e137,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ab2222c..e5cd761 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x492cdb,_0x37833d){var _0x26a4cb=function(_0x56a764){while(--_0x56a764){_0x492cdb['push'](_0x492cdb['shift']());}};_0x26a4cb(++_0x37833d);}(_0x757a,0xde));var _0xa757=function(_0x2866e2,_0x376809){_0x2866e2=_0x2866e2-0x0;var _0x2cd26e=_0x757a[_0x2866e2];return _0x2cd26e;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x5c0a14,_0xff95b1){var _0x1047bc=function(_0x113044){while(--_0x113044){_0x5c0a14['push'](_0x5c0a14['shift']());}};_0x1047bc(++_0xff95b1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b75e5af..2a7c036 100644 --- a/server/api/chatQueueReport/chatQueueReport.rpc.js +++ b/server/api/chatQueueReport/chatQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd30a=['UpdateChatQueueReport','update','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','debug'];(function(_0x5289c8,_0x5a4cb8){var _0x1904ce=function(_0x2d13d9){while(--_0x2d13d9){_0x5289c8['push'](_0x5289c8['shift']());}};_0x1904ce(++_0x5a4cb8);}(_0xd30a,0x19d));var _0xad30=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xd30a[_0x481bf7];return _0x461787;};'use strict';var _=require(_0xad30('0x0'));var util=require('util');var moment=require(_0xad30('0x1'));var BPromise=require(_0xad30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad30('0x3'));var db=require(_0xad30('0x4'))['db'];var utils=require(_0xad30('0x5'));var logger=require(_0xad30('0x6'))(_0xad30('0x7'));var config=require(_0xad30('0x8'));var jayson=require(_0xad30('0x9'));var client=jayson[_0xad30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc0,_0x2e99d4,_0x1493da){return new BPromise(function(_0x20ac8b,_0x53e6fe){return client[_0xad30('0xb')](_0x3dc0,_0x1493da)[_0xad30('0xc')](function(_0x384583){logger['info'](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));logger['debug'](_0xad30('0xf'),_0x2e99d4,_0xad30('0xe'),JSON[_0xad30('0x10')](_0x384583));if(_0x384583[_0xad30('0x11')]){if(_0x384583[_0xad30('0x11')][_0xad30('0x12')]===0x1f4){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x53e6fe(_0x384583['error'][_0xad30('0x13')]);}logger[_0xad30('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x20ac8b(_0x384583[_0xad30('0x11')]['message']);}else{logger[_0xad30('0x14')](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));_0x20ac8b(_0x384583[_0xad30('0x15')][_0xad30('0x13')]);}})[_0xad30('0x16')](function(_0x2a6d9c){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x2a6d9c);_0x53e6fe(_0x2a6d9c);});});}exports[_0xad30('0x17')]=function(_0x19a0cc){var _0x16cb53=this;return new Promise(function(_0x842841,_0x5068eb){return db[_0xad30('0x18')]['create'](_0x19a0cc[_0xad30('0x19')],{'raw':_0x19a0cc[_0xad30('0x1a')]?_0x19a0cc['options'][_0xad30('0x1b')]===undefined?!![]:![]:!![]})[_0xad30('0xc')](function(_0x312704){logger[_0xad30('0x14')]('CreateChatQueueReport',_0x19a0cc);logger[_0xad30('0x1c')](_0xad30('0x17'),_0x19a0cc,JSON[_0xad30('0x10')](_0x312704));_0x842841(_0x312704);})[_0xad30('0x16')](function(_0x12ec56){logger['error'](_0xad30('0x17'),_0x12ec56[_0xad30('0x13')],_0x19a0cc);_0x5068eb(_0x16cb53[_0xad30('0x11')](0x1f4,_0x12ec56[_0xad30('0x13')]));});});};exports[_0xad30('0x1d')]=function(_0x63c85d){var _0x4b395d=this;return new Promise(function(_0x4d11ae,_0x55207e){return db['ChatQueueReport'][_0xad30('0x1e')](_0x63c85d[_0xad30('0x19')],{'raw':_0x63c85d[_0xad30('0x1a')]?_0x63c85d[_0xad30('0x1a')][_0xad30('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63c85d['options']?_0x63c85d[_0xad30('0x1a')][_0xad30('0x1f')]||null:null,'attributes':_0x63c85d['options']?_0x63c85d[_0xad30('0x1a')][_0xad30('0x20')]||null:null,'limit':_0x63c85d[_0xad30('0x1a')]?_0x63c85d[_0xad30('0x1a')][_0xad30('0x21')]||null:null})[_0xad30('0xc')](function(_0x59ba1f){logger['info'](_0xad30('0x1d'),_0x63c85d);logger['debug'](_0xad30('0x1d'),_0x63c85d,JSON[_0xad30('0x10')](_0x59ba1f));_0x4d11ae(_0x59ba1f);})[_0xad30('0x16')](function(_0x2ca5fe){logger[_0xad30('0x11')]('UpdateChatQueueReport',_0x2ca5fe[_0xad30('0x13')],_0x63c85d);_0x55207e(_0x4b395d[_0xad30('0x11')](0x1f4,_0x2ca5fe[_0xad30('0x13')]));});});}; \ No newline at end of file +var _0xe238=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','options','raw','CreateChatQueueReport','update','where','attributes','UpdateChatQueueReport'];(function(_0x472e4f,_0x4cc294){var _0x29e574=function(_0x4546ac){while(--_0x4546ac){_0x472e4f['push'](_0x472e4f['shift']());}};_0x29e574(++_0x4cc294);}(_0xe238,0x18d));var _0x8e23=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe238[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x8e23('0x0'));var util=require(_0x8e23('0x1'));var moment=require(_0x8e23('0x2'));var BPromise=require(_0x8e23('0x3'));var rs=require(_0x8e23('0x4'));var fs=require('fs');var Redis=require(_0x8e23('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e23('0x6'));var logger=require(_0x8e23('0x7'))('rpc');var config=require(_0x8e23('0x8'));var jayson=require(_0x8e23('0x9'));var client=jayson[_0x8e23('0xa')][_0x8e23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x486415,_0x34d6c8,_0x5b11e8){return new BPromise(function(_0x51b0f5,_0x1de364){return client['request'](_0x486415,_0x5b11e8)[_0x8e23('0xc')](function(_0x43d795){logger[_0x8e23('0xd')](_0x8e23('0xe'),_0x34d6c8,_0x8e23('0xf'));logger['debug'](_0x8e23('0x10'),_0x34d6c8,_0x8e23('0xf'),JSON[_0x8e23('0x11')](_0x43d795));if(_0x43d795[_0x8e23('0x12')]){if(_0x43d795[_0x8e23('0x12')][_0x8e23('0x13')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x34d6c8,_0x43d795[_0x8e23('0x12')][_0x8e23('0x14')]);return _0x1de364(_0x43d795['error'][_0x8e23('0x14')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x34d6c8,_0x43d795[_0x8e23('0x12')][_0x8e23('0x14')]);return _0x51b0f5(_0x43d795[_0x8e23('0x12')][_0x8e23('0x14')]);}else{logger[_0x8e23('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x34d6c8,_0x8e23('0xf'));_0x51b0f5(_0x43d795[_0x8e23('0x15')]['message']);}})[_0x8e23('0x16')](function(_0x346ec6){logger['error'](_0x8e23('0xe'),_0x34d6c8,_0x346ec6);_0x1de364(_0x346ec6);});});}exports['CreateChatQueueReport']=function(_0x458ee6){var _0x3cfedd=this;return new Promise(function(_0x2ab78c,_0x4d2b12){return db[_0x8e23('0x17')][_0x8e23('0x18')](_0x458ee6['body'],{'raw':_0x458ee6['options']?_0x458ee6[_0x8e23('0x19')][_0x8e23('0x1a')]===undefined?!![]:![]:!![]})[_0x8e23('0xc')](function(_0x2402f7){logger[_0x8e23('0xd')](_0x8e23('0x1b'),_0x458ee6);logger['debug']('CreateChatQueueReport',_0x458ee6,JSON['stringify'](_0x2402f7));_0x2ab78c(_0x2402f7);})[_0x8e23('0x16')](function(_0x5c7fc3){logger[_0x8e23('0x12')](_0x8e23('0x1b'),_0x5c7fc3[_0x8e23('0x14')],_0x458ee6);_0x4d2b12(_0x3cfedd[_0x8e23('0x12')](0x1f4,_0x5c7fc3[_0x8e23('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x3150cf){var _0x24b46e=this;return new Promise(function(_0x568edf,_0x470ac3){return db['ChatQueueReport'][_0x8e23('0x1c')](_0x3150cf['body'],{'raw':_0x3150cf[_0x8e23('0x19')]?_0x3150cf[_0x8e23('0x19')][_0x8e23('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3150cf[_0x8e23('0x19')]?_0x3150cf[_0x8e23('0x19')][_0x8e23('0x1d')]||null:null,'attributes':_0x3150cf[_0x8e23('0x19')]?_0x3150cf[_0x8e23('0x19')][_0x8e23('0x1e')]||null:null,'limit':_0x3150cf[_0x8e23('0x19')]?_0x3150cf['options']['limit']||null:null})[_0x8e23('0xc')](function(_0x213fa9){logger[_0x8e23('0xd')](_0x8e23('0x1f'),_0x3150cf);logger[_0x8e23('0x20')](_0x8e23('0x1f'),_0x3150cf,JSON[_0x8e23('0x11')](_0x213fa9));_0x568edf(_0x213fa9);})[_0x8e23('0x16')](function(_0x49d4b4){logger['error'](_0x8e23('0x1f'),_0x49d4b4[_0x8e23('0x14')],_0x3150cf);_0x470ac3(_0x24b46e['error'](0x1f4,_0x49d4b4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 0cbaa07..49619d7 100644 --- a/server/api/chatQueueReport/index.js +++ b/server/api/chatQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60a2=['../../components/auth/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','/:id','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x5193e3,_0x4e62b9){var _0x505b84=function(_0x74f2c7){while(--_0x74f2c7){_0x5193e3['push'](_0x5193e3['shift']());}};_0x505b84(++_0x4e62b9);}(_0x60a2,0x160));var _0x260a=function(_0xdf5c13,_0x2b638c){_0xdf5c13=_0xdf5c13-0x0;var _0x4723b6=_0x60a2[_0xdf5c13];return _0x4723b6;};'use strict';var multer=require(_0x260a('0x0'));var util=require(_0x260a('0x1'));var path=require('path');var timeout=require(_0x260a('0x2'));var express=require(_0x260a('0x3'));var router=express[_0x260a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x260a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x260a('0x6'));var controller=require(_0x260a('0x7'));router['get']('/',auth[_0x260a('0x8')](),controller['index']);router[_0x260a('0x9')](_0x260a('0xa'),auth[_0x260a('0x8')](),controller['describe']);router[_0x260a('0x9')](_0x260a('0xb'),auth[_0x260a('0x8')](),controller['show']);router['post']('/',auth[_0x260a('0x8')](),controller[_0x260a('0xc')]);router[_0x260a('0xd')](_0x260a('0xb'),auth[_0x260a('0x8')](),controller[_0x260a('0xe')]);router['delete'](_0x260a('0xb'),auth[_0x260a('0x8')](),controller[_0x260a('0xf')]);module[_0x260a('0x10')]=router; \ No newline at end of file +var _0xf171=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','exports','multer'];(function(_0x5572c1,_0x4c6633){var _0x4bb9a3=function(_0x4e9dec){while(--_0x4e9dec){_0x5572c1['push'](_0x5572c1['shift']());}};_0x4bb9a3(++_0x4c6633);}(_0xf171,0x92));var _0x1f17=function(_0x5016c9,_0x57cdf0){_0x5016c9=_0x5016c9-0x0;var _0x5371ee=_0xf171[_0x5016c9];return _0x5371ee;};'use strict';var multer=require(_0x1f17('0x0'));var util=require(_0x1f17('0x1'));var path=require(_0x1f17('0x2'));var timeout=require(_0x1f17('0x3'));var express=require(_0x1f17('0x4'));var router=express['Router']();var fs_extra=require(_0x1f17('0x5'));var auth=require(_0x1f17('0x6'));var interaction=require(_0x1f17('0x7'));var config=require(_0x1f17('0x8'));var controller=require(_0x1f17('0x9'));router[_0x1f17('0xa')]('/',auth[_0x1f17('0xb')](),controller[_0x1f17('0xc')]);router[_0x1f17('0xa')](_0x1f17('0xd'),auth[_0x1f17('0xb')](),controller['describe']);router[_0x1f17('0xa')](_0x1f17('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x1f17('0xf')]('/',auth['isAuthenticated'](),controller[_0x1f17('0x10')]);router[_0x1f17('0x11')](_0x1f17('0xe'),auth[_0x1f17('0xb')](),controller[_0x1f17('0x12')]);router['delete'](_0x1f17('0xe'),auth[_0x1f17('0xb')](),controller[_0x1f17('0x13')]);module[_0x1f17('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 295e909..c75f331 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0xb43b,0x1b2));var _0xbb43=function(_0x46965b,_0x51a74b){_0x46965b=_0x46965b-0x0;var _0x5318e5=_0xb43b[_0x46965b];return _0x5318e5;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x32ec45,_0x3bb0cd){var _0x299a21=function(_0x1e9884){while(--_0x1e9884){_0x32ec45['push'](_0x32ec45['shift']());}};_0x299a21(++_0x3bb0cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 08cf750..799e56f 100644 --- a/server/api/chatTransferReport/chatTransferReport.controller.js +++ b/server/api/chatTransferReport/chatTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa042=['undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','ChatTransferReport','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa042,0x163));var _0x2a04=function(_0x365689,_0x354de6){_0x365689=_0x365689-0x0;var _0x229a70=_0xa042[_0x365689];return _0x229a70;};'use strict';var emlformat=require(_0x2a04('0x0'));var rimraf=require(_0x2a04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a04('0x2'));var rp=require(_0x2a04('0x3'));var moment=require(_0x2a04('0x4'));var BPromise=require(_0x2a04('0x5'));var Mustache=require(_0x2a04('0x6'));var util=require('util');var path=require(_0x2a04('0x7'));var sox=require(_0x2a04('0x8'));var csv=require(_0x2a04('0x9'));var ejs=require(_0x2a04('0xa'));var fs=require('fs');var fs_extra=require(_0x2a04('0xb'));var _=require(_0x2a04('0xc'));var squel=require(_0x2a04('0xd'));var crypto=require(_0x2a04('0xe'));var jsforce=require(_0x2a04('0xf'));var deskjs=require(_0x2a04('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a04('0x11'));var Redis=require(_0x2a04('0x12'));var authService=require(_0x2a04('0x13'));var qs=require(_0x2a04('0x14'));var as=require(_0x2a04('0x15'));var hardwareService=require(_0x2a04('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2a04('0x17'));var db=require(_0x2a04('0x18'))['db'];function respondWithStatusCode(_0x490e54,_0x34fb2f){_0x34fb2f=_0x34fb2f||0xcc;return function(_0xad19df){if(_0xad19df){return _0x490e54[_0x2a04('0x19')](_0x34fb2f);}return _0x490e54['status'](_0x34fb2f)[_0x2a04('0x1a')]();};}function respondWithResult(_0x201d17,_0x569655){_0x569655=_0x569655||0xc8;return function(_0x49d45f){if(_0x49d45f){return _0x201d17[_0x2a04('0x1b')](_0x569655)[_0x2a04('0x1c')](_0x49d45f);}};}function respondWithFilteredResult(_0x1819db,_0x43c7c7){return function(_0x182f49){if(_0x182f49){var _0x24baad=typeof _0x43c7c7[_0x2a04('0x1d')]===_0x2a04('0x1e')&&typeof _0x43c7c7[_0x2a04('0x1f')]===_0x2a04('0x1e');var _0x1bd88e=_0x182f49[_0x2a04('0x20')];var _0x17fb55=_0x24baad?0x0:_0x43c7c7[_0x2a04('0x1d')];var _0x5f1c4e=_0x24baad?_0x182f49[_0x2a04('0x20')]:_0x43c7c7[_0x2a04('0x1d')]+_0x43c7c7[_0x2a04('0x1f')];var _0x2f9f4d;if(_0x5f1c4e>=_0x1bd88e){_0x5f1c4e=_0x1bd88e;_0x2f9f4d=0xc8;}else{_0x2f9f4d=0xce;}_0x1819db['status'](_0x2f9f4d);return _0x1819db['set'](_0x2a04('0x21'),_0x17fb55+'-'+_0x5f1c4e+'/'+_0x1bd88e)[_0x2a04('0x1c')](_0x182f49);}return null;};}function patchUpdates(_0x1da682){return function(_0x169b4b){try{jsonpatch[_0x2a04('0x22')](_0x169b4b,_0x1da682,!![]);}catch(_0x407a00){return BPromise[_0x2a04('0x23')](_0x407a00);}return _0x169b4b[_0x2a04('0x24')]();};}function saveUpdates(_0x251c0d,_0x23045d){return function(_0x3ec99a){if(_0x3ec99a){return _0x3ec99a['update'](_0x251c0d)[_0x2a04('0x25')](function(_0xd6673){return _0xd6673;});}return null;};}function removeEntity(_0x3c0121,_0x11f914){return function(_0x4cdfd2){if(_0x4cdfd2){return _0x4cdfd2[_0x2a04('0x26')]()['then'](function(){_0x3c0121['status'](0xcc)[_0x2a04('0x1a')]();});}};}function handleEntityNotFound(_0x22a778,_0x482a85){return function(_0x22b98f){if(!_0x22b98f){_0x22a778[_0x2a04('0x19')](0x194);}return _0x22b98f;};}function handleError(_0x13d2a6,_0x29d0b1){_0x29d0b1=_0x29d0b1||0x1f4;return function(_0x1f96ef){logger[_0x2a04('0x27')](_0x1f96ef[_0x2a04('0x28')]);if(_0x1f96ef[_0x2a04('0x29')]){delete _0x1f96ef[_0x2a04('0x29')];}_0x13d2a6[_0x2a04('0x1b')](_0x29d0b1)['send'](_0x1f96ef);};}exports[_0x2a04('0x2a')]=function(_0x6801f6,_0x35a634){var _0x5d19bb={},_0xa6c482={},_0x2187a9={'count':0x0,'rows':[]};var _0x3393fc=_[_0x2a04('0x2b')](db[_0x2a04('0x2c')]['rawAttributes'],function(_0x49d565){return{'name':_0x49d565[_0x2a04('0x2d')],'type':_0x49d565[_0x2a04('0x2e')]['key']};});_0xa6c482[_0x2a04('0x2f')]=_['map'](_0x3393fc,_0x2a04('0x29'));_0xa6c482['query']=_[_0x2a04('0x30')](_0x6801f6[_0x2a04('0x31')]);_0xa6c482[_0x2a04('0x32')]=_[_0x2a04('0x33')](_0xa6c482['model'],_0xa6c482[_0x2a04('0x31')]);_0x5d19bb[_0x2a04('0x34')]=_[_0x2a04('0x33')](_0xa6c482[_0x2a04('0x2f')],qs[_0x2a04('0x35')](_0x6801f6[_0x2a04('0x31')][_0x2a04('0x35')]));_0x5d19bb[_0x2a04('0x34')]=_0x5d19bb['attributes'][_0x2a04('0x36')]?_0x5d19bb[_0x2a04('0x34')]:_0xa6c482[_0x2a04('0x2f')];if(!_0x6801f6[_0x2a04('0x31')][_0x2a04('0x37')](_0x2a04('0x38'))){_0x5d19bb['limit']=qs['limit'](_0x6801f6[_0x2a04('0x31')][_0x2a04('0x1f')]);_0x5d19bb[_0x2a04('0x1d')]=qs['offset'](_0x6801f6[_0x2a04('0x31')]['offset']);}_0x5d19bb[_0x2a04('0x39')]=qs[_0x2a04('0x3a')](_0x6801f6[_0x2a04('0x31')][_0x2a04('0x3a')]);_0x5d19bb[_0x2a04('0x3b')]=qs[_0x2a04('0x32')](_[_0x2a04('0x3c')](_0x6801f6['query'],_0xa6c482[_0x2a04('0x32')]),_0x3393fc);if(_0x6801f6['query']['filter']){_0x5d19bb[_0x2a04('0x3b')]=_[_0x2a04('0x3d')](_0x5d19bb['where'],{'$or':_[_0x2a04('0x2b')](_0x3393fc,function(_0x3e6934){if(_0x3e6934[_0x2a04('0x2e')]!=='VIRTUAL'){var _0x36f49b={};_0x36f49b[_0x3e6934['name']]={'$like':'%'+_0x6801f6[_0x2a04('0x31')][_0x2a04('0x3e')]+'%'};return _0x36f49b;}})});}_0x5d19bb=_['merge']({},_0x5d19bb,_0x6801f6['options']);var _0x5b6d31={'where':_0x5d19bb[_0x2a04('0x3b')]};return db[_0x2a04('0x2c')]['count'](_0x5b6d31)[_0x2a04('0x25')](function(_0x313c33){_0x2187a9['count']=_0x313c33;if(_0x6801f6['query'][_0x2a04('0x3f')]){_0x5d19bb[_0x2a04('0x40')]=[{'all':!![]}];}return db[_0x2a04('0x2c')][_0x2a04('0x41')](_0x5d19bb);})[_0x2a04('0x25')](function(_0x3a8352){_0x2187a9[_0x2a04('0x42')]=_0x3a8352;return _0x2187a9;})['then'](respondWithFilteredResult(_0x35a634,_0x5d19bb))[_0x2a04('0x43')](handleError(_0x35a634,null));};exports[_0x2a04('0x44')]=function(_0x4d8a77,_0x3d502d){var _0x51172d={'raw':!![],'where':{'id':_0x4d8a77['params']['id']}},_0x65e08b={};_0x65e08b['model']=_[_0x2a04('0x30')](db[_0x2a04('0x2c')][_0x2a04('0x45')]);_0x65e08b[_0x2a04('0x31')]=_[_0x2a04('0x30')](_0x4d8a77[_0x2a04('0x31')]);_0x65e08b[_0x2a04('0x32')]=_[_0x2a04('0x33')](_0x65e08b[_0x2a04('0x2f')],_0x65e08b[_0x2a04('0x31')]);_0x51172d[_0x2a04('0x34')]=_['intersection'](_0x65e08b[_0x2a04('0x2f')],qs['fields'](_0x4d8a77[_0x2a04('0x31')][_0x2a04('0x35')]));_0x51172d[_0x2a04('0x34')]=_0x51172d['attributes'][_0x2a04('0x36')]?_0x51172d[_0x2a04('0x34')]:_0x65e08b[_0x2a04('0x2f')];if(_0x4d8a77[_0x2a04('0x31')][_0x2a04('0x3f')]){_0x51172d[_0x2a04('0x40')]=[{'all':!![]}];}_0x51172d=_[_0x2a04('0x3d')]({},_0x51172d,_0x4d8a77[_0x2a04('0x46')]);return db[_0x2a04('0x2c')][_0x2a04('0x47')](_0x51172d)[_0x2a04('0x25')](handleEntityNotFound(_0x3d502d,null))[_0x2a04('0x25')](respondWithResult(_0x3d502d,null))[_0x2a04('0x43')](handleError(_0x3d502d,null));};exports[_0x2a04('0x48')]=function(_0x3a0464,_0x52258b){return db['ChatTransferReport'][_0x2a04('0x48')](_0x3a0464[_0x2a04('0x49')],{})[_0x2a04('0x25')](respondWithResult(_0x52258b,0xc9))[_0x2a04('0x43')](handleError(_0x52258b,null));};exports[_0x2a04('0x4a')]=function(_0x13a0ef,_0x597d7a){if(_0x13a0ef[_0x2a04('0x49')]['id']){delete _0x13a0ef[_0x2a04('0x49')]['id'];}return db[_0x2a04('0x2c')]['find']({'where':{'id':_0x13a0ef[_0x2a04('0x4b')]['id']}})[_0x2a04('0x25')](handleEntityNotFound(_0x597d7a,null))['then'](saveUpdates(_0x13a0ef[_0x2a04('0x49')],null))['then'](respondWithResult(_0x597d7a,null))['catch'](handleError(_0x597d7a,null));};exports[_0x2a04('0x26')]=function(_0x2cf70d,_0x2dd3a6){return db[_0x2a04('0x2c')][_0x2a04('0x47')]({'where':{'id':_0x2cf70d[_0x2a04('0x4b')]['id']}})[_0x2a04('0x25')](handleEntityNotFound(_0x2dd3a6,null))[_0x2a04('0x25')](removeEntity(_0x2dd3a6,null))[_0x2a04('0x43')](handleError(_0x2dd3a6,null));};exports['describe']=function(_0x44996c,_0xde46b5){return db[_0x2a04('0x2c')][_0x2a04('0x4c')]()[_0x2a04('0x25')](respondWithResult(_0xde46b5,null))[_0x2a04('0x43')](handleError(_0xde46b5,null));}; \ No newline at end of file +var _0x5d87=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','includeAll','include','findAll','catch','create','body','find','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1fa506,_0x25fc4e){var _0x39dee3=function(_0xecc93a){while(--_0xecc93a){_0x1fa506['push'](_0x1fa506['shift']());}};_0x39dee3(++_0x25fc4e);}(_0x5d87,0xcc));var _0x75d8=function(_0x1c0952,_0x146c95){_0x1c0952=_0x1c0952-0x0;var _0x2c19e3=_0x5d87[_0x1c0952];return _0x2c19e3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x75d8('0x0'));var jsonpatch=require(_0x75d8('0x1'));var rp=require(_0x75d8('0x2'));var moment=require(_0x75d8('0x3'));var BPromise=require(_0x75d8('0x4'));var Mustache=require(_0x75d8('0x5'));var util=require(_0x75d8('0x6'));var path=require('path');var sox=require(_0x75d8('0x7'));var csv=require(_0x75d8('0x8'));var ejs=require(_0x75d8('0x9'));var fs=require('fs');var fs_extra=require(_0x75d8('0xa'));var _=require(_0x75d8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x75d8('0xc'));var deskjs=require(_0x75d8('0xd'));var toCsv=require(_0x75d8('0x8'));var querystring=require(_0x75d8('0xe'));var Papa=require(_0x75d8('0xf'));var Redis=require('ioredis');var authService=require(_0x75d8('0x10'));var qs=require(_0x75d8('0x11'));var as=require(_0x75d8('0x12'));var hardwareService=require(_0x75d8('0x13'));var logger=require(_0x75d8('0x14'))(_0x75d8('0x15'));var utils=require(_0x75d8('0x16'));var config=require(_0x75d8('0x17'));var licenseUtil=require(_0x75d8('0x18'));var db=require(_0x75d8('0x19'))['db'];function respondWithStatusCode(_0x38c9c4,_0x3eb09a){_0x3eb09a=_0x3eb09a||0xcc;return function(_0x122bc5){if(_0x122bc5){return _0x38c9c4[_0x75d8('0x1a')](_0x3eb09a);}return _0x38c9c4[_0x75d8('0x1b')](_0x3eb09a)[_0x75d8('0x1c')]();};}function respondWithResult(_0x4aa9bc,_0x3b93bd){_0x3b93bd=_0x3b93bd||0xc8;return function(_0x38e5fe){if(_0x38e5fe){return _0x4aa9bc[_0x75d8('0x1b')](_0x3b93bd)[_0x75d8('0x1d')](_0x38e5fe);}};}function respondWithFilteredResult(_0x40dc2e,_0x535bf6){return function(_0x5ce20c){if(_0x5ce20c){var _0x4d3661=typeof _0x535bf6[_0x75d8('0x1e')]===_0x75d8('0x1f')&&typeof _0x535bf6[_0x75d8('0x20')]===_0x75d8('0x1f');var _0x2a7ca5=_0x5ce20c[_0x75d8('0x21')];var _0x2dfbde=_0x4d3661?0x0:_0x535bf6['offset'];var _0x4db53e=_0x4d3661?_0x5ce20c[_0x75d8('0x21')]:_0x535bf6[_0x75d8('0x1e')]+_0x535bf6['limit'];var _0x1f37f6;if(_0x4db53e>=_0x2a7ca5){_0x4db53e=_0x2a7ca5;_0x1f37f6=0xc8;}else{_0x1f37f6=0xce;}_0x40dc2e['status'](_0x1f37f6);return _0x40dc2e[_0x75d8('0x22')](_0x75d8('0x23'),_0x2dfbde+'-'+_0x4db53e+'/'+_0x2a7ca5)[_0x75d8('0x1d')](_0x5ce20c);}return null;};}function patchUpdates(_0x14262d){return function(_0x3c0fd9){try{jsonpatch[_0x75d8('0x24')](_0x3c0fd9,_0x14262d,!![]);}catch(_0xcac2a5){return BPromise[_0x75d8('0x25')](_0xcac2a5);}return _0x3c0fd9[_0x75d8('0x26')]();};}function saveUpdates(_0x1b1dc5,_0x2ff6d3){return function(_0x22d351){if(_0x22d351){return _0x22d351[_0x75d8('0x27')](_0x1b1dc5)[_0x75d8('0x28')](function(_0xc85162){return _0xc85162;});}return null;};}function removeEntity(_0x46b8ae,_0x362b33){return function(_0x2cf6c4){if(_0x2cf6c4){return _0x2cf6c4[_0x75d8('0x29')]()[_0x75d8('0x28')](function(){_0x46b8ae[_0x75d8('0x1b')](0xcc)[_0x75d8('0x1c')]();});}};}function handleEntityNotFound(_0x280c43,_0x3aa8fd){return function(_0x42359e){if(!_0x42359e){_0x280c43[_0x75d8('0x1a')](0x194);}return _0x42359e;};}function handleError(_0x55c802,_0x1a0022){_0x1a0022=_0x1a0022||0x1f4;return function(_0x59063d){logger[_0x75d8('0x2a')](_0x59063d[_0x75d8('0x2b')]);if(_0x59063d[_0x75d8('0x2c')]){delete _0x59063d[_0x75d8('0x2c')];}_0x55c802['status'](_0x1a0022)[_0x75d8('0x2d')](_0x59063d);};}exports[_0x75d8('0x2e')]=function(_0x24747d,_0x5092c8){var _0xf1d7fb={},_0x36590e={},_0x44c0fd={'count':0x0,'rows':[]};var _0x188ae1=_[_0x75d8('0x2f')](db[_0x75d8('0x30')][_0x75d8('0x31')],function(_0x4836cf){return{'name':_0x4836cf[_0x75d8('0x32')],'type':_0x4836cf['type'][_0x75d8('0x33')]};});_0x36590e[_0x75d8('0x34')]=_[_0x75d8('0x2f')](_0x188ae1,_0x75d8('0x2c'));_0x36590e[_0x75d8('0x35')]=_[_0x75d8('0x36')](_0x24747d[_0x75d8('0x35')]);_0x36590e[_0x75d8('0x37')]=_[_0x75d8('0x38')](_0x36590e['model'],_0x36590e[_0x75d8('0x35')]);_0xf1d7fb['attributes']=_[_0x75d8('0x38')](_0x36590e[_0x75d8('0x34')],qs[_0x75d8('0x39')](_0x24747d[_0x75d8('0x35')][_0x75d8('0x39')]));_0xf1d7fb['attributes']=_0xf1d7fb[_0x75d8('0x3a')][_0x75d8('0x3b')]?_0xf1d7fb[_0x75d8('0x3a')]:_0x36590e[_0x75d8('0x34')];if(!_0x24747d['query'][_0x75d8('0x3c')]('nolimit')){_0xf1d7fb[_0x75d8('0x20')]=qs[_0x75d8('0x20')](_0x24747d[_0x75d8('0x35')][_0x75d8('0x20')]);_0xf1d7fb[_0x75d8('0x1e')]=qs[_0x75d8('0x1e')](_0x24747d[_0x75d8('0x35')][_0x75d8('0x1e')]);}_0xf1d7fb[_0x75d8('0x3d')]=qs[_0x75d8('0x3e')](_0x24747d[_0x75d8('0x35')][_0x75d8('0x3e')]);_0xf1d7fb['where']=qs[_0x75d8('0x37')](_[_0x75d8('0x3f')](_0x24747d['query'],_0x36590e[_0x75d8('0x37')]),_0x188ae1);if(_0x24747d[_0x75d8('0x35')][_0x75d8('0x40')]){_0xf1d7fb[_0x75d8('0x41')]=_[_0x75d8('0x42')](_0xf1d7fb[_0x75d8('0x41')],{'$or':_[_0x75d8('0x2f')](_0x188ae1,function(_0x2fe949){if(_0x2fe949[_0x75d8('0x43')]!=='VIRTUAL'){var _0x256e27={};_0x256e27[_0x2fe949[_0x75d8('0x2c')]]={'$like':'%'+_0x24747d['query'][_0x75d8('0x40')]+'%'};return _0x256e27;}})});}_0xf1d7fb=_[_0x75d8('0x42')]({},_0xf1d7fb,_0x24747d['options']);var _0x4c7788={'where':_0xf1d7fb['where']};return db['ChatTransferReport'][_0x75d8('0x21')](_0x4c7788)[_0x75d8('0x28')](function(_0x19f35b){_0x44c0fd['count']=_0x19f35b;if(_0x24747d[_0x75d8('0x35')][_0x75d8('0x44')]){_0xf1d7fb[_0x75d8('0x45')]=[{'all':!![]}];}return db[_0x75d8('0x30')][_0x75d8('0x46')](_0xf1d7fb);})[_0x75d8('0x28')](function(_0x248b68){_0x44c0fd['rows']=_0x248b68;return _0x44c0fd;})[_0x75d8('0x28')](respondWithFilteredResult(_0x5092c8,_0xf1d7fb))[_0x75d8('0x47')](handleError(_0x5092c8,null));};exports['show']=function(_0x3cdc3d,_0x47fc37){var _0xd15396={'raw':!![],'where':{'id':_0x3cdc3d['params']['id']}},_0x49ef96={};_0x49ef96[_0x75d8('0x34')]=_[_0x75d8('0x36')](db[_0x75d8('0x30')]['rawAttributes']);_0x49ef96[_0x75d8('0x35')]=_[_0x75d8('0x36')](_0x3cdc3d[_0x75d8('0x35')]);_0x49ef96['filters']=_[_0x75d8('0x38')](_0x49ef96[_0x75d8('0x34')],_0x49ef96['query']);_0xd15396[_0x75d8('0x3a')]=_['intersection'](_0x49ef96[_0x75d8('0x34')],qs[_0x75d8('0x39')](_0x3cdc3d[_0x75d8('0x35')]['fields']));_0xd15396[_0x75d8('0x3a')]=_0xd15396['attributes'][_0x75d8('0x3b')]?_0xd15396[_0x75d8('0x3a')]:_0x49ef96[_0x75d8('0x34')];if(_0x3cdc3d[_0x75d8('0x35')][_0x75d8('0x44')]){_0xd15396[_0x75d8('0x45')]=[{'all':!![]}];}_0xd15396=_['merge']({},_0xd15396,_0x3cdc3d['options']);return db[_0x75d8('0x30')]['find'](_0xd15396)['then'](handleEntityNotFound(_0x47fc37,null))['then'](respondWithResult(_0x47fc37,null))[_0x75d8('0x47')](handleError(_0x47fc37,null));};exports[_0x75d8('0x48')]=function(_0x4e48fb,_0x42f00e){return db[_0x75d8('0x30')][_0x75d8('0x48')](_0x4e48fb[_0x75d8('0x49')],{})[_0x75d8('0x28')](respondWithResult(_0x42f00e,0xc9))[_0x75d8('0x47')](handleError(_0x42f00e,null));};exports[_0x75d8('0x27')]=function(_0x583b08,_0x9f3dde){if(_0x583b08['body']['id']){delete _0x583b08[_0x75d8('0x49')]['id'];}return db[_0x75d8('0x30')][_0x75d8('0x4a')]({'where':{'id':_0x583b08[_0x75d8('0x4b')]['id']}})[_0x75d8('0x28')](handleEntityNotFound(_0x9f3dde,null))[_0x75d8('0x28')](saveUpdates(_0x583b08['body'],null))[_0x75d8('0x28')](respondWithResult(_0x9f3dde,null))[_0x75d8('0x47')](handleError(_0x9f3dde,null));};exports['destroy']=function(_0x149979,_0x580432){return db[_0x75d8('0x30')][_0x75d8('0x4a')]({'where':{'id':_0x149979[_0x75d8('0x4b')]['id']}})[_0x75d8('0x28')](handleEntityNotFound(_0x580432,null))['then'](removeEntity(_0x580432,null))[_0x75d8('0x47')](handleError(_0x580432,null));};exports[_0x75d8('0x4c')]=function(_0x2e0a2b,_0x40fcfb){return db[_0x75d8('0x30')][_0x75d8('0x4c')]()[_0x75d8('0x28')](respondWithResult(_0x40fcfb,null))[_0x75d8('0x47')](handleError(_0x40fcfb,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 742c075..36dab45 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5fb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0xd5fb,0x6d));var _0xbd5f=function(_0x33a432,_0x1acced){_0x33a432=_0x33a432-0x0;var _0x45bd47=_0xd5fb[_0x33a432];return _0x45bd47;};'use strict';var _=require(_0xbd5f('0x0'));var util=require(_0xbd5f('0x1'));var logger=require(_0xbd5f('0x2'))('api');var moment=require(_0xbd5f('0x3'));var BPromise=require(_0xbd5f('0x4'));var rp=require(_0xbd5f('0x5'));var fs=require('fs');var path=require(_0xbd5f('0x6'));var rimraf=require(_0xbd5f('0x7'));var config=require(_0xbd5f('0x8'));var attributes=require(_0xbd5f('0x9'));module[_0xbd5f('0xa')]=function(_0x43c942,_0x5e592f){return _0x43c942['define'](_0xbd5f('0xb'),attributes,{'tableName':_0xbd5f('0xc'),'paranoid':![],'indexes':[{'name':_0xbd5f('0xd'),'fields':[_0xbd5f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee5=['./chatTransferReport.attributes','exports','define','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x4ee5,0x12d));var _0x54ee=function(_0x49dbe,_0x5906d7){_0x49dbe=_0x49dbe-0x0;var _0x3f541d=_0x4ee5[_0x49dbe];return _0x3f541d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x54ee('0x0'))(_0x54ee('0x1'));var moment=require(_0x54ee('0x2'));var BPromise=require('bluebird');var rp=require(_0x54ee('0x3'));var fs=require('fs');var path=require(_0x54ee('0x4'));var rimraf=require(_0x54ee('0x5'));var config=require(_0x54ee('0x6'));var attributes=require(_0x54ee('0x7'));module[_0x54ee('0x8')]=function(_0x10297b,_0x3bc2bf){return _0x10297b[_0x54ee('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x54ee('0xa'),'fields':[_0x54ee('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 618099a..0d0b698 100644 --- a/server/api/chatTransferReport/chatTransferReport.rpc.js +++ b/server/api/chatTransferReport/chatTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5172=['stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x10a160,_0x1d07ce){var _0x141ec9=function(_0x302d3a){while(--_0x302d3a){_0x10a160['push'](_0x10a160['shift']());}};_0x141ec9(++_0x1d07ce);}(_0x5172,0x16c));var _0x2517=function(_0x5586fe,_0x2edbe){_0x5586fe=_0x5586fe-0x0;var _0x114a56=_0x5172[_0x5586fe];return _0x114a56;};'use strict';var _=require('lodash');var util=require(_0x2517('0x0'));var moment=require(_0x2517('0x1'));var BPromise=require('bluebird');var rs=require(_0x2517('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2517('0x3'))['db'];var utils=require(_0x2517('0x4'));var logger=require('../../config/logger')(_0x2517('0x5'));var config=require('../../config/environment');var jayson=require(_0x2517('0x6'));var client=jayson[_0x2517('0x7')][_0x2517('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x465380,_0x261b39,_0x2a13f5){return new BPromise(function(_0x225346,_0x2e8ed4){return client[_0x2517('0x9')](_0x465380,_0x2a13f5)[_0x2517('0xa')](function(_0x38ac25){logger[_0x2517('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x261b39,_0x2517('0xc'));logger[_0x2517('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x261b39,'request\x20sent',JSON[_0x2517('0xe')](_0x38ac25));if(_0x38ac25[_0x2517('0xf')]){if(_0x38ac25['error'][_0x2517('0x10')]===0x1f4){logger['error'](_0x2517('0x11'),_0x261b39,_0x38ac25[_0x2517('0xf')][_0x2517('0x12')]);return _0x2e8ed4(_0x38ac25['error'][_0x2517('0x12')]);}logger[_0x2517('0xf')](_0x2517('0x11'),_0x261b39,_0x38ac25[_0x2517('0xf')]['message']);return _0x225346(_0x38ac25[_0x2517('0xf')]['message']);}else{logger[_0x2517('0xb')](_0x2517('0x11'),_0x261b39,_0x2517('0xc'));_0x225346(_0x38ac25[_0x2517('0x13')][_0x2517('0x12')]);}})[_0x2517('0x14')](function(_0x5b389b){logger[_0x2517('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x261b39,_0x5b389b);_0x2e8ed4(_0x5b389b);});});} \ No newline at end of file +var _0xd35d=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','lodash'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0xd35d,0x1a1));var _0xdd35=function(_0x4f08dd,_0x3784ec){_0x4f08dd=_0x4f08dd-0x0;var _0x3017ee=_0xd35d[_0x4f08dd];return _0x3017ee;};'use strict';var _=require(_0xdd35('0x0'));var util=require(_0xdd35('0x1'));var moment=require(_0xdd35('0x2'));var BPromise=require(_0xdd35('0x3'));var rs=require(_0xdd35('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd35('0x5'))['db'];var utils=require(_0xdd35('0x6'));var logger=require(_0xdd35('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd35('0x8'));var client=jayson[_0xdd35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x520d6c,_0xafbb59,_0x3d1c74){return new BPromise(function(_0x3aa33a,_0x44754c){return client[_0xdd35('0xa')](_0x520d6c,_0x3d1c74)[_0xdd35('0xb')](function(_0x590240){logger['info'](_0xdd35('0xc'),_0xafbb59,_0xdd35('0xd'));logger[_0xdd35('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xafbb59,'request\x20sent',JSON[_0xdd35('0xf')](_0x590240));if(_0x590240['error']){if(_0x590240['error'][_0xdd35('0x10')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0xafbb59,_0x590240[_0xdd35('0x11')][_0xdd35('0x12')]);return _0x44754c(_0x590240['error'][_0xdd35('0x12')]);}logger[_0xdd35('0x11')](_0xdd35('0xc'),_0xafbb59,_0x590240[_0xdd35('0x11')][_0xdd35('0x12')]);return _0x3aa33a(_0x590240[_0xdd35('0x11')][_0xdd35('0x12')]);}else{logger[_0xdd35('0x13')](_0xdd35('0xc'),_0xafbb59,_0xdd35('0xd'));_0x3aa33a(_0x590240[_0xdd35('0x14')][_0xdd35('0x12')]);}})[_0xdd35('0x15')](function(_0x4bafc8){logger['error'](_0xdd35('0xc'),_0xafbb59,_0x4bafc8);_0x44754c(_0x4bafc8);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 95b7546..66c92e9 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa359=['update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x380d16,_0xdf0d31){var _0x5d5253=function(_0x7a25bc){while(--_0x7a25bc){_0x380d16['push'](_0x380d16['shift']());}};_0x5d5253(++_0xdf0d31);}(_0xa359,0x16c));var _0x9a35=function(_0x37358d,_0x2a91e7){_0x37358d=_0x37358d-0x0;var _0x379c7e=_0xa359[_0x37358d];return _0x379c7e;};'use strict';var multer=require(_0x9a35('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9a35('0x1'));var express=require('express');var router=express[_0x9a35('0x2')]();var fs_extra=require(_0x9a35('0x3'));var auth=require(_0x9a35('0x4'));var interaction=require(_0x9a35('0x5'));var config=require(_0x9a35('0x6'));var controller=require(_0x9a35('0x7'));router[_0x9a35('0x8')]('/',auth[_0x9a35('0x9')](),controller[_0x9a35('0xa')]);router[_0x9a35('0x8')](_0x9a35('0xb'),auth[_0x9a35('0x9')](),controller[_0x9a35('0xc')]);router[_0x9a35('0x8')](_0x9a35('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9a35('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9a35('0xf')]('/:id',auth[_0x9a35('0x9')](),controller[_0x9a35('0x10')]);router['delete'](_0x9a35('0xd'),auth[_0x9a35('0x9')](),controller[_0x9a35('0x11')]);module[_0x9a35('0x12')]=router; \ No newline at end of file +var _0x4a70=['/describe','describe','/:id','create','exports','multer','path','connect-timeout','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x4a70,0x1f3));var _0x04a7=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x4a70[_0x104a84];return _0x4973ff;};'use strict';var multer=require(_0x04a7('0x0'));var util=require('util');var path=require(_0x04a7('0x1'));var timeout=require(_0x04a7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x04a7('0x3'));var config=require('../../config/environment');var controller=require(_0x04a7('0x4'));router[_0x04a7('0x5')]('/',auth[_0x04a7('0x6')](),controller[_0x04a7('0x7')]);router[_0x04a7('0x5')](_0x04a7('0x8'),auth[_0x04a7('0x6')](),controller[_0x04a7('0x9')]);router[_0x04a7('0x5')](_0x04a7('0xa'),auth[_0x04a7('0x6')](),controller['show']);router['post']('/',auth[_0x04a7('0x6')](),controller[_0x04a7('0xb')]);router['put'](_0x04a7('0xa'),auth[_0x04a7('0x6')](),controller['update']);router['delete'](_0x04a7('0xa'),auth[_0x04a7('0x6')](),controller['destroy']);module[_0x04a7('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 2c79891..fbeda16 100644 --- a/server/api/chatWebsite/chatWebsite.attributes.js +++ b/server/api/chatWebsite/chatWebsite.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41bb=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','name','text','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion'];(function(_0x3476ef,_0x32ea5a){var _0x3fd996=function(_0x21abd8){while(--_0x21abd8){_0x3476ef['push'](_0x3476ef['shift']());}};_0x3fd996(++_0x32ea5a);}(_0x41bb,0xc5));var _0xb41b=function(_0x17bc0b,_0x6a110c){_0x17bc0b=_0x17bc0b-0x0;var _0x3c82a2=_0x41bb[_0x17bc0b];return _0x3c82a2;};'use strict';var Sequelize=require(_0xb41b('0x0'));var rs=require(_0xb41b('0x1'));module['exports']={'name':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb41b('0x3')},'description':{'type':Sequelize[_0xb41b('0x2')]},'mapKey':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x4')},'key':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb41b('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':_0xb41b('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':_0xb41b('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb41b('0x2')]},'animation':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xb41b('0x9'),'squared'),'defaultValue':_0xb41b('0x9')},'header_online':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xa')},'start_chat_button':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0xc')},'header_offline':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xd')},'download_transcript':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb41b('0xe')]},'closingQuestion':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x11')},'noteTitle':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x12')},'placeholderMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x13')},'closingMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xb41b('0x16')](_0xb41b('0x17'),_0xb41b('0x18')),'defaultValue':_0xb41b('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xb41b('0x19'),'type':_0xb41b('0x1a'),'required':!![]},'props':{'title':_0xb41b('0x19'),'helpText':''}},{'type':'input','props':{'title':_0xb41b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb41b('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb41b('0x1b')](_0xb41b('0x1c'))?JSON['parse'](this[_0xb41b('0x1b')]('onlineForm')):{};},'set':function(_0x2d0f27){return this[_0xb41b('0x1d')]('onlineForm',JSON[_0xb41b('0x1e')](_0x2d0f27));}},'offlineForm':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xb41b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb41b('0x4'),'type':_0xb41b('0x4')},'variable':null},{'type':_0xb41b('0x1f'),'config':{'placeholder':_0xb41b('0x20')},'props':{'title':_0xb41b('0x20'),'helpText':_0xb41b('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xb41b('0x22'))?JSON[_0xb41b('0x23')](this['getDataValue'](_0xb41b('0x22'))):{};},'set':function(_0x482764){return this[_0xb41b('0x1d')](_0xb41b('0x22'),JSON['stringify'](_0x482764));}},'token':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb41b('0x2')]},'forwardOffline':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb41b('0x2')]},'waitingTitle':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x24')},'waitingMessage':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x26')},'offlineMessageBody':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x15')},'sendUnmanaged':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb41b('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb41b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':function(){return _0xb41b('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xb41b('0x2a')},'defaultTitle':{'type':Sequelize[_0xb41b('0x2')]},'customerAvatar':{'type':Sequelize[_0xb41b('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb41b('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb41b('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':_0xb41b('0x2c')},'systemAvatar':{'type':Sequelize[_0xb41b('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb41b('0x7')],'comment':_0xb41b('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x49e8c4){if(!_0x49e8c4)this['setDataValue'](_0xb41b('0x2e'),null);this['setDataValue']('mandatoryDisposition',_0x49e8c4);}},'vidaooEscalation':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xb41b('0x2')],'allowNull':![],'defaultValue':_0xb41b('0x2f')},'vidaooNote':{'type':Sequelize[_0xb41b('0x2')],'defaultValue':function(){return _0xb41b('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xb41b('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb41b('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb41b('0xe')]}}; \ No newline at end of file +var _0x3c81=['bottom_right','alternate','#fafafa','System','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','parse','getDataValue','setDataValue','onlineForm','textarea','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias'];(function(_0x2c1c48,_0x5f29b6){var _0x37e11f=function(_0xa60dfc){while(--_0xa60dfc){_0x2c1c48['push'](_0x2c1c48['shift']());}};_0x37e11f(++_0x5f29b6);}(_0x3c81,0x102));var _0x13c8=function(_0x404257,_0x416f1c){_0x404257=_0x404257-0x0;var _0x2b8640=_0x3c81[_0x404257];return _0x2b8640;};'use strict';var Sequelize=require(_0x13c8('0x0'));var rs=require(_0x13c8('0x1'));module['exports']={'name':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x3')},'key':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x4')},'customerAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x13c8('0x2')]},'animation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x13c8('0x8')](_0x13c8('0x9'),_0x13c8('0xa')),'defaultValue':_0x13c8('0x9')},'header_online':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xb')},'start_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'header_offline':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x13c8('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x11')},'placeholderMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x12')},'closingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x13')},'closingMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0xc')},'skipMessageButton':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x14')},'conditionAgreement':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x13c8('0x16'),_0x13c8('0x17')),'defaultValue':_0x13c8('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x13c8('0x19'),'type':_0x13c8('0x1a'),'required':!![]},'props':{'title':_0x13c8('0x19'),'helpText':''}},{'type':_0x13c8('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')]('onlineForm')):{};},'set':function(_0x5ad0dc){return this[_0x13c8('0x1e')](_0x13c8('0x1f'),JSON['stringify'](_0x5ad0dc));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x13c8('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x13c8('0x3'),'type':_0x13c8('0x3')},'variable':null},{'type':_0x13c8('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x13c8('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x13c8('0x1d')](_0x13c8('0x22'))?JSON[_0x13c8('0x1c')](this[_0x13c8('0x1d')](_0x13c8('0x22'))):{};},'set':function(_0x343080){return this['setDataValue'](_0x13c8('0x22'),JSON[_0x13c8('0x18')](_0x343080));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x13c8('0x2')]},'forwardOffline':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x23')},'waitingMessage':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x25')},'offlineMessageBody':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x27')},'skipUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x13c8('0x2')]},'notificationTemplate':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':function(){return _0x13c8('0x28');}},'notificationSound':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2a')},'verticalAlignment':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x13c8('0x2b')},'defaultTitle':{'type':Sequelize[_0x13c8('0x2')]},'customerAvatar':{'type':Sequelize[_0x13c8('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x13c8('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x13c8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':_0x13c8('0x2d')},'systemAvatar':{'type':Sequelize[_0x13c8('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13c8('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x343dba){if(!_0x343dba)this[_0x13c8('0x1e')](_0x13c8('0x2e'),null);this[_0x13c8('0x1e')](_0x13c8('0x2f'),_0x343dba);}},'vidaooEscalation':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x13c8('0x2')]},'vidaooTopic':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![],'defaultValue':_0x13c8('0x30')},'vidaooNote':{'type':Sequelize[_0x13c8('0x2')],'defaultValue':function(){return _0x13c8('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x13c8('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x13c8('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x13c8('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 596a0bf..ddab955 100644 --- a/server/api/chatWebsite/chatWebsite.controller.js +++ b/server/api/chatWebsite/chatWebsite.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68db=['systemAvatar','getLogo','join','root','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','ChatApplication','Applications','account','list','applications','orderBy','priority','asc','Contacts','defaults','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','browser','version','format','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','lastName','messageId','get','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','ids','omit','getInteractions','Contact','fullname','internal','Tags','color','tag','iftime\x20%s,%s','timezone','iftime\x20%s','interval','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','getSnippet','Interval','getProactiveActions','../../config/license/util','chatLicenseExceeded','Intervals','push','all','some','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','connection','remoteAddress','referer','virtual','replace','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','fs-extra','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','redis','localhost','./chatWebsite.socket','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','set','destroy','ChatWebsites','UserProfileResource','stack','send','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','name','keys','intersection','model','attributes','fields','query','nolimit','order','sort','where','pick','filters','merge','options','count','includeAll','include','catch','show','params','mandatoryDispositionPause','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','hasOwnProperty','filter','findAll','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','rows','removeAnswers','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','file','addSystemAvatar'];(function(_0x194ab1,_0x4f038c){var _0x34c079=function(_0x51e5bb){while(--_0x51e5bb){_0x194ab1['push'](_0x194ab1['shift']());}};_0x34c079(++_0x4f038c);}(_0x68db,0xc3));var _0xb68d=function(_0x215c2a,_0x52e74c){_0x215c2a=_0x215c2a-0x0;var _0x538f0d=_0x68db[_0x215c2a];return _0x538f0d;};'use strict';var BPromise=require(_0xb68d('0x0'));var Mustache=require(_0xb68d('0x1'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb68d('0x2'));var _=require('lodash');var querystring=require(_0xb68d('0x3'));var Redis=require(_0xb68d('0x4'));var qs=require(_0xb68d('0x5'));var logger=require('../../config/logger')(_0xb68d('0x6'));var config=require(_0xb68d('0x7'));var url=require(_0xb68d('0x8'));var db=require(_0xb68d('0x9'))['db'];config[_0xb68d('0xa')]=_['defaults'](config['redis'],{'host':_0xb68d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb68d('0xa')]));require(_0xb68d('0xc'))['register'](socket);var htmlToText=require(_0xb68d('0xd'));var jayson=require(_0xb68d('0xe'));var client=jayson[_0xb68d('0xf')]['http']({'port':0x232c});var client9002=jayson[_0xb68d('0xf')]['http']({'port':0x232a});var client9003=jayson[_0xb68d('0xf')][_0xb68d('0x10')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x534395,_0x135a55,_0x257272,_0x251ae8){return new BPromise(function(_0x15a9f0,_0x54c5b9){var _0x439048=_0x251ae8||client;return _0x439048['request'](_0x534395,_0x257272)[_0xb68d('0x11')](function(_0x4416e9){logger[_0xb68d('0x12')](_0xb68d('0x13'),_0x135a55,_0xb68d('0x14'));logger['debug'](_0xb68d('0x15'),_0x135a55,'request\x20sent',JSON[_0xb68d('0x16')](_0x4416e9));if(_0x4416e9[_0xb68d('0x17')]){if(_0x4416e9[_0xb68d('0x17')][_0xb68d('0x18')]===0x1f4){logger[_0xb68d('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x135a55,_0x4416e9[_0xb68d('0x17')]['message']);return _0x54c5b9(_0x4416e9['error'][_0xb68d('0x19')]);}logger[_0xb68d('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x135a55,_0x4416e9['error'][_0xb68d('0x19')]);return _0x15a9f0(_0x4416e9[_0xb68d('0x17')]['message']);}else{logger[_0xb68d('0x12')](_0xb68d('0x13'),_0x135a55,_0xb68d('0x14'));_0x15a9f0(_0x4416e9[_0xb68d('0x1a')][_0xb68d('0x19')]);}})['catch'](function(_0x44a318){logger[_0xb68d('0x17')](_0xb68d('0x13'),_0x135a55,_0x44a318);_0x54c5b9(_0x44a318);});});}function respondWithStatusCode(_0x3cf1ea,_0x2a9871){_0x2a9871=_0x2a9871||0xcc;return function(_0x3620f8){if(_0x3620f8){return _0x3cf1ea[_0xb68d('0x1b')](_0x2a9871);}return _0x3cf1ea[_0xb68d('0x1c')](_0x2a9871)[_0xb68d('0x1d')]();};}function respondWithResult(_0x31cd11,_0x39024e){_0x39024e=_0x39024e||0xc8;return function(_0x304131){if(_0x304131){return _0x31cd11[_0xb68d('0x1c')](_0x39024e)[_0xb68d('0x1e')](_0x304131);}};}function respondWithFilteredResult(_0x38f9d8,_0x32a933){return function(_0x4fb373){if(_0x4fb373){var _0x505750=typeof _0x32a933[_0xb68d('0x1f')]===_0xb68d('0x20')&&typeof _0x32a933[_0xb68d('0x21')]===_0xb68d('0x20');var _0x4af57b=_0x4fb373['count'];var _0x390a03=_0x505750?0x0:_0x32a933[_0xb68d('0x1f')];var _0x51e3ff=_0x505750?_0x4fb373['count']:_0x32a933[_0xb68d('0x1f')]+_0x32a933[_0xb68d('0x21')];var _0x430411;if(_0x51e3ff>=_0x4af57b){_0x51e3ff=_0x4af57b;_0x430411=0xc8;}else{_0x430411=0xce;}_0x38f9d8[_0xb68d('0x1c')](_0x430411);return _0x38f9d8[_0xb68d('0x22')]('Content-Range',_0x390a03+'-'+_0x51e3ff+'/'+_0x4af57b)['json'](_0x4fb373);}return null;};}function saveUpdates(_0x5e21a3){return function(_0x2b89e5){if(_0x2b89e5){return _0x2b89e5['update'](_0x5e21a3)['then'](function(_0x271d25){return _0x271d25;});}return null;};}function removeEntity(_0x139341){return function(_0x190400){if(_0x190400){return _0x190400[_0xb68d('0x23')]()['then'](function(){var _0x3934d5=_0x190400['get']({'plain':!![]});var _0x402665=_0xb68d('0x24');return db[_0xb68d('0x25')]['destroy']({'where':{'type':_0x402665,'resourceId':_0x3934d5['id']}})['then'](function(){return _0x190400;});})['then'](function(){_0x139341[_0xb68d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25c3dc){return function(_0x14e8ff){if(!_0x14e8ff){_0x25c3dc[_0xb68d('0x1b')](0x194);}return _0x14e8ff;};}function handleError(_0x39b675,_0x3a4f7c){_0x3a4f7c=_0x3a4f7c||0x1f4;return function(_0x12cd8d){logger['error'](_0x12cd8d[_0xb68d('0x26')]);if(_0x12cd8d['name']){delete _0x12cd8d['name'];}_0x39b675[_0xb68d('0x1c')](_0x3a4f7c)[_0xb68d('0x27')](_0x12cd8d);};}exports['index']=function(_0x2914f1,_0x5e417d){var _0x26baaa={'include':[{'model':db[_0xb68d('0x28')],'as':'mandatoryDispositionPause'}]},_0x38c561={},_0x4c1995={'count':0x0,'rows':[]};var _0x36b242=_[_0xb68d('0x29')](db[_0xb68d('0x2a')][_0xb68d('0x2b')],function(_0x4229c7){return{'name':_0x4229c7[_0xb68d('0x2c')],'type':_0x4229c7[_0xb68d('0x2d')][_0xb68d('0x2e')]};});_0x38c561['model']=_[_0xb68d('0x29')](_0x36b242,_0xb68d('0x2f'));_0x38c561['query']=_[_0xb68d('0x30')](_0x2914f1['query']);_0x38c561['filters']=_[_0xb68d('0x31')](_0x38c561[_0xb68d('0x32')],_0x38c561['query']);_0x26baaa[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x38c561['model'],qs[_0xb68d('0x34')](_0x2914f1[_0xb68d('0x35')][_0xb68d('0x34')]));_0x26baaa[_0xb68d('0x33')]=_0x26baaa[_0xb68d('0x33')]['length']?_0x26baaa[_0xb68d('0x33')]:_0x38c561[_0xb68d('0x32')];if(!_0x2914f1[_0xb68d('0x35')]['hasOwnProperty'](_0xb68d('0x36'))){_0x26baaa['limit']=qs[_0xb68d('0x21')](_0x2914f1[_0xb68d('0x35')][_0xb68d('0x21')]);_0x26baaa[_0xb68d('0x1f')]=qs['offset'](_0x2914f1['query']['offset']);}_0x26baaa[_0xb68d('0x37')]=qs[_0xb68d('0x38')](_0x2914f1[_0xb68d('0x35')][_0xb68d('0x38')]);_0x26baaa[_0xb68d('0x39')]=qs['filters'](_[_0xb68d('0x3a')](_0x2914f1[_0xb68d('0x35')],_0x38c561[_0xb68d('0x3b')]),_0x36b242);if(_0x2914f1[_0xb68d('0x35')]['filter']){_0x26baaa['where']=_[_0xb68d('0x3c')](_0x26baaa[_0xb68d('0x39')],{'$or':_['map'](_0x36b242,function(_0x25e71c){if(_0x25e71c['type']!=='VIRTUAL'){var _0x584d1f={};_0x584d1f[_0x25e71c[_0xb68d('0x2f')]]={'$like':'%'+_0x2914f1[_0xb68d('0x35')]['filter']+'%'};return _0x584d1f;}})});}_0x26baaa=_[_0xb68d('0x3c')]({},_0x26baaa,_0x2914f1[_0xb68d('0x3d')]);var _0x25e78e={'where':_0x26baaa[_0xb68d('0x39')]};return db[_0xb68d('0x2a')]['count'](_0x25e78e)['then'](function(_0x25146f){_0x4c1995[_0xb68d('0x3e')]=_0x25146f;if(_0x2914f1[_0xb68d('0x35')][_0xb68d('0x3f')]){_0x26baaa[_0xb68d('0x40')]=[{'all':!![]}];}return db[_0xb68d('0x2a')]['findAll'](_0x26baaa);})[_0xb68d('0x11')](function(_0x1c8daf){_0x4c1995['rows']=_0x1c8daf;return _0x4c1995;})[_0xb68d('0x11')](respondWithFilteredResult(_0x5e417d,_0x26baaa))[_0xb68d('0x41')](handleError(_0x5e417d,null));};exports[_0xb68d('0x42')]=function(_0x4377ff,_0x35bb77){var _0x18e645={'raw':![],'where':{'id':_0x4377ff[_0xb68d('0x43')]['id']},'include':[{'model':db['Pause'],'as':_0xb68d('0x44')}]},_0x5cb028={};_0x5cb028['model']=_[_0xb68d('0x30')](db['ChatWebsite'][_0xb68d('0x2b')]);_0x5cb028[_0xb68d('0x35')]=_[_0xb68d('0x30')](_0x4377ff[_0xb68d('0x35')]);_0x5cb028[_0xb68d('0x3b')]=_[_0xb68d('0x31')](_0x5cb028[_0xb68d('0x32')],_0x5cb028['query']);_0x18e645[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x5cb028['model'],qs[_0xb68d('0x34')](_0x4377ff['query']['fields']));_0x18e645[_0xb68d('0x33')]=_0x18e645['attributes'][_0xb68d('0x45')]?_0x18e645[_0xb68d('0x33')]:_0x5cb028['model'];if(_0x4377ff['query']['includeAll']){_0x18e645[_0xb68d('0x40')]=[{'all':!![]}];}_0x18e645=_[_0xb68d('0x3c')]({},_0x18e645,_0x4377ff[_0xb68d('0x3d')]);return db['ChatWebsite']['find'](_0x18e645)[_0xb68d('0x11')](handleEntityNotFound(_0x35bb77,null))[_0xb68d('0x11')](respondWithResult(_0x35bb77,null))[_0xb68d('0x41')](handleError(_0x35bb77,null));};exports['create']=function(_0x2e3f32,_0x4fde99){return db[_0xb68d('0x2a')][_0xb68d('0x46')](_0x2e3f32[_0xb68d('0x47')],{})[_0xb68d('0x11')](function(_0x316730){var _0x3c6509=_0x2e3f32[_0xb68d('0x48')]['get']({'plain':!![]});if(!_0x3c6509)throw new Error(_0xb68d('0x49'));if(_0x3c6509[_0xb68d('0x4a')]===_0xb68d('0x48')){var _0x552351=_0x316730['get']({'plain':!![]});var _0x58e0c7='ChatWebsites';return db[_0xb68d('0x4b')][_0xb68d('0x4c')]({'where':{'name':_0x58e0c7,'userProfileId':_0x3c6509[_0xb68d('0x4d')]},'raw':!![]})[_0xb68d('0x11')](function(_0x17d021){if(_0x17d021&&_0x17d021[_0xb68d('0x4e')]===0x0){return db[_0xb68d('0x25')][_0xb68d('0x46')]({'name':_0x552351[_0xb68d('0x2f')],'resourceId':_0x552351['id'],'type':_0x17d021['name'],'sectionId':_0x17d021['id']},{})['then'](function(){return _0x316730;});}else{return _0x316730;}})[_0xb68d('0x41')](function(_0x3769bd){logger[_0xb68d('0x17')](_0xb68d('0x4f'),_0x3769bd);throw _0x3769bd;});}return _0x316730;})[_0xb68d('0x11')](respondWithResult(_0x4fde99,0xc9))[_0xb68d('0x41')](handleError(_0x4fde99,null));};exports[_0xb68d('0x50')]=function(_0x5d47e4,_0x4877cf){if(_0x5d47e4[_0xb68d('0x47')]['id']){delete _0x5d47e4['body']['id'];}return db[_0xb68d('0x2a')]['find']({'where':{'id':_0x5d47e4['params']['id']},'include':[{'model':db[_0xb68d('0x28')],'as':'mandatoryDispositionPause'}]})[_0xb68d('0x11')](handleEntityNotFound(_0x4877cf,null))[_0xb68d('0x11')](saveUpdates(_0x5d47e4[_0xb68d('0x47')],null))[_0xb68d('0x11')](respondWithResult(_0x4877cf,null))['catch'](handleError(_0x4877cf,null));};exports[_0xb68d('0x23')]=function(_0x584a5d,_0x421203){return db[_0xb68d('0x2a')]['find']({'where':{'id':_0x584a5d['params']['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x421203,null))[_0xb68d('0x11')](removeEntity(_0x421203,null))[_0xb68d('0x41')](handleError(_0x421203,null));};exports[_0xb68d('0x51')]=function(_0x478356,_0x2ec16a){return db['ChatWebsite'][_0xb68d('0x51')]()[_0xb68d('0x11')](respondWithResult(_0x2ec16a,null))[_0xb68d('0x41')](handleError(_0x2ec16a,null));};exports[_0xb68d('0x52')]=function(_0x14d8b9,_0x38773b){if(_0x14d8b9['body']['id']){delete _0x14d8b9[_0xb68d('0x47')]['id'];}return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x14d8b9[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x38773b,null))[_0xb68d('0x11')](function(_0x2cadd6){if(_0x2cadd6){_0x14d8b9[_0xb68d('0x47')][_0xb68d('0x53')]=_0x2cadd6['id'];return db[_0xb68d('0x54')][_0xb68d('0x46')](_0x14d8b9[_0xb68d('0x47')]);}})[_0xb68d('0x11')](respondWithResult(_0x38773b,null))[_0xb68d('0x41')](handleError(_0x38773b,null));};exports['getDispositions']=function(_0x5cbcb5,_0x3ec8cc){var _0x27fd7c={'raw':![],'where':{}};var _0x24f739={};var _0x3e6cbc={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5cbcb5[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x3ec8cc,null))[_0xb68d('0x11')](function(_0x39ba9c){if(_0x39ba9c){_0x24f739[_0xb68d('0x32')]=_[_0xb68d('0x30')](db['Disposition']['rawAttributes']);_0x24f739['query']=_['keys'](_0x5cbcb5['query']);_0x24f739[_0xb68d('0x3b')]=_[_0xb68d('0x31')](_0x24f739[_0xb68d('0x32')],_0x24f739[_0xb68d('0x35')]);_0x27fd7c[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x24f739[_0xb68d('0x32')],qs[_0xb68d('0x34')](_0x5cbcb5['query']['fields']));_0x27fd7c[_0xb68d('0x33')]=_0x27fd7c['attributes'][_0xb68d('0x45')]?_0x27fd7c[_0xb68d('0x33')]:_0x24f739[_0xb68d('0x32')];if(!_0x5cbcb5[_0xb68d('0x35')][_0xb68d('0x55')](_0xb68d('0x36'))){_0x27fd7c[_0xb68d('0x21')]=qs['limit'](_0x5cbcb5['query'][_0xb68d('0x21')]);_0x27fd7c[_0xb68d('0x1f')]=qs['offset'](_0x5cbcb5[_0xb68d('0x35')][_0xb68d('0x1f')]);}_0x27fd7c[_0xb68d('0x37')]=qs[_0xb68d('0x38')](_0x5cbcb5[_0xb68d('0x35')][_0xb68d('0x38')]);_0x27fd7c['where']=qs[_0xb68d('0x3b')](_[_0xb68d('0x3a')](_0x5cbcb5['query'],_0x24f739[_0xb68d('0x3b')]));_0x27fd7c[_0xb68d('0x39')][_0xb68d('0x53')]=_0x39ba9c['id'];if(_0x5cbcb5[_0xb68d('0x35')][_0xb68d('0x56')]){_0x27fd7c['where']=_['merge'](_0x27fd7c[_0xb68d('0x39')],{'$or':_[_0xb68d('0x29')](_0x27fd7c[_0xb68d('0x33')],function(_0x4a7dc5){var _0x260dce={};_0x260dce[_0x4a7dc5]={'$like':'%'+_0x5cbcb5[_0xb68d('0x35')][_0xb68d('0x56')]+'%'};return _0x260dce;})});}_0x27fd7c=_['merge']({},_0x27fd7c,_0x5cbcb5[_0xb68d('0x3d')]);return db[_0xb68d('0x54')][_0xb68d('0x3e')]({'where':_0x27fd7c['where']})[_0xb68d('0x11')](function(_0x122d30){_0x3e6cbc['count']=_0x122d30;if(_0x5cbcb5['query']['includeAll']){_0x27fd7c[_0xb68d('0x40')]=[{'all':!![]}];}return db[_0xb68d('0x54')][_0xb68d('0x57')](_0x27fd7c);})[_0xb68d('0x11')](function(_0x29113a){_0x3e6cbc['rows']=_0x29113a;return _0x3e6cbc;});}})['then'](respondWithFilteredResult(_0x3ec8cc,_0x27fd7c))[_0xb68d('0x41')](handleError(_0x3ec8cc,null));};exports[_0xb68d('0x58')]=function(_0x51c995,_0x21d0e7){return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x51c995[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x21d0e7,null))[_0xb68d('0x11')](function(_0x4734c1){if(_0x4734c1){return _0x4734c1[_0xb68d('0x58')](_0x51c995['query']['ids']);}})['then'](respondWithStatusCode(_0x21d0e7,null))[_0xb68d('0x41')](handleError(_0x21d0e7,null));};exports[_0xb68d('0x59')]=function(_0x54a01d,_0x10d385){if(_0x54a01d['body']['id']){delete _0x54a01d[_0xb68d('0x47')]['id'];}return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x54a01d['params']['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x10d385,null))[_0xb68d('0x11')](function(_0x276a7d){if(_0x276a7d){_0x54a01d[_0xb68d('0x47')][_0xb68d('0x53')]=_0x276a7d['id'];return db['CannedAnswer'][_0xb68d('0x46')](_0x54a01d['body']);}})[_0xb68d('0x11')](respondWithResult(_0x10d385,null))[_0xb68d('0x41')](handleError(_0x10d385,null));};exports[_0xb68d('0x5a')]=function(_0x418a48,_0x21d895){var _0x39888e={'raw':![],'where':{}};var _0x466415={};var _0x276c08={'count':0x0,'rows':[]};return db[_0xb68d('0x2a')][_0xb68d('0x5b')]({'where':{'id':_0x418a48[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x21d895,null))[_0xb68d('0x11')](function(_0x177b16){if(_0x177b16){_0x466415[_0xb68d('0x32')]=_[_0xb68d('0x30')](db[_0xb68d('0x5c')]['rawAttributes']);_0x466415['query']=_[_0xb68d('0x30')](_0x418a48[_0xb68d('0x35')]);_0x466415[_0xb68d('0x3b')]=_['intersection'](_0x466415[_0xb68d('0x32')],_0x466415[_0xb68d('0x35')]);_0x39888e[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x466415['model'],qs[_0xb68d('0x34')](_0x418a48['query'][_0xb68d('0x34')]));_0x39888e[_0xb68d('0x33')]=_0x39888e['attributes'][_0xb68d('0x45')]?_0x39888e[_0xb68d('0x33')]:_0x466415[_0xb68d('0x32')];if(!_0x418a48[_0xb68d('0x35')][_0xb68d('0x55')](_0xb68d('0x36'))){_0x39888e['limit']=qs[_0xb68d('0x21')](_0x418a48[_0xb68d('0x35')]['limit']);_0x39888e[_0xb68d('0x1f')]=qs[_0xb68d('0x1f')](_0x418a48[_0xb68d('0x35')][_0xb68d('0x1f')]);}_0x39888e[_0xb68d('0x37')]=qs[_0xb68d('0x38')](_0x418a48[_0xb68d('0x35')][_0xb68d('0x38')]);_0x39888e[_0xb68d('0x39')]=qs[_0xb68d('0x3b')](_[_0xb68d('0x3a')](_0x418a48['query'],_0x466415['filters']));_0x39888e[_0xb68d('0x39')][_0xb68d('0x53')]=_0x177b16['id'];if(_0x418a48[_0xb68d('0x35')][_0xb68d('0x56')]){_0x39888e[_0xb68d('0x39')]=_[_0xb68d('0x3c')](_0x39888e[_0xb68d('0x39')],{'$or':_[_0xb68d('0x29')](_0x39888e[_0xb68d('0x33')],function(_0x4e08be){var _0x19ec1f={};_0x19ec1f[_0x4e08be]={'$like':'%'+_0x418a48[_0xb68d('0x35')][_0xb68d('0x56')]+'%'};return _0x19ec1f;})});}_0x39888e=_['merge']({},_0x39888e,_0x418a48['options']);return db[_0xb68d('0x5c')]['count']({'where':_0x39888e[_0xb68d('0x39')]})[_0xb68d('0x11')](function(_0x4494eb){_0x276c08['count']=_0x4494eb;if(_0x418a48['query'][_0xb68d('0x3f')]){_0x39888e[_0xb68d('0x40')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb68d('0x57')](_0x39888e);})[_0xb68d('0x11')](function(_0x44b455){_0x276c08[_0xb68d('0x5d')]=_0x44b455;return _0x276c08;});}})['then'](respondWithFilteredResult(_0x21d895,_0x39888e))[_0xb68d('0x41')](handleError(_0x21d895,null));};exports['removeAnswers']=function(_0x1afbfb,_0x2edffa){return db['ChatWebsite'][_0xb68d('0x4c')]({'where':{'id':_0x1afbfb[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x2edffa,null))['then'](function(_0x4217c5){if(_0x4217c5){return _0x4217c5[_0xb68d('0x5e')](_0x1afbfb[_0xb68d('0x35')]['ids']);}})[_0xb68d('0x11')](respondWithStatusCode(_0x2edffa,null))['catch'](handleError(_0x2edffa,null));};exports['addLogo']=function(_0x44a90d,_0xd73a71){_0x44a90d[_0xb68d('0x47')][_0xb68d('0x5f')]=_0x44a90d['file'][_0xb68d('0x60')];return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x44a90d[_0xb68d('0x43')]['id']}})['then'](handleEntityNotFound(_0xd73a71,null))[_0xb68d('0x11')](saveUpdates(_0x44a90d[_0xb68d('0x47')],null))[_0xb68d('0x11')](respondWithResult(_0xd73a71,null))[_0xb68d('0x41')](handleError(_0xd73a71,null));};exports[_0xb68d('0x61')]=function(_0x2f7553,_0x41edab){_0x2f7553['body'][_0xb68d('0x62')]=_0x2f7553['file']['filename'];return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x2f7553[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x41edab,null))['then'](saveUpdates(_0x2f7553[_0xb68d('0x47')],null))[_0xb68d('0x11')](respondWithResult(_0x41edab,null))[_0xb68d('0x41')](handleError(_0x41edab,null));};exports[_0xb68d('0x63')]=function(_0x32b322,_0x18d3ec){_0x32b322[_0xb68d('0x47')][_0xb68d('0x64')]=_0x32b322[_0xb68d('0x65')][_0xb68d('0x60')];return db[_0xb68d('0x2a')]['find']({'where':{'id':_0x32b322['params']['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x18d3ec,null))[_0xb68d('0x11')](saveUpdates(_0x32b322[_0xb68d('0x47')],null))[_0xb68d('0x11')](respondWithResult(_0x18d3ec,null))['catch'](handleError(_0x18d3ec,null));};exports[_0xb68d('0x66')]=function(_0x163d6f,_0xdf988e){_0x163d6f[_0xb68d('0x47')][_0xb68d('0x67')]=_0x163d6f[_0xb68d('0x65')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x163d6f['params']['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0xdf988e,null))[_0xb68d('0x11')](saveUpdates(_0x163d6f[_0xb68d('0x47')],null))['then'](respondWithResult(_0xdf988e,null))['catch'](handleError(_0xdf988e,null));};exports[_0xb68d('0x68')]=function(_0x344b15,_0xc765f3){var _0x27e6b1=path[_0xb68d('0x69')](config[_0xb68d('0x6a')],'server/files/images/logos/default_logo.svg');var _0x28e516={'where':{'id':_0x344b15['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x568c12=![];return require('../../config/license/util')[_0xb68d('0x6b')]()[_0xb68d('0x11')](function(_0x589675){if(_0x589675){_0x568c12=_0x589675[_0xb68d('0x6c')];}})[_0xb68d('0x11')](function(){return db[_0xb68d('0x2a')]['find'](_0x28e516);})['then'](handleEntityNotFound(_0xc765f3,null))[_0xb68d('0x11')](function(_0xe78575){if(_0xe78575){if(!_[_0xb68d('0x6d')](_0xe78575[_0xb68d('0x5f')])){if(fs[_0xb68d('0x6e')](path[_0xb68d('0x69')](config[_0xb68d('0x6a')],_0xb68d('0x6f'),_0xe78575[_0xb68d('0x5f')]))&&_0x568c12){_0x27e6b1=path[_0xb68d('0x69')](config['root'],_0xb68d('0x6f'),_0xe78575[_0xb68d('0x5f')]);}}return _0xc765f3[_0xb68d('0x70')](_0x27e6b1);}})[_0xb68d('0x41')](handleError(_0xc765f3,null));};exports[_0xb68d('0x71')]=function(_0x458790,_0x11b4a1){var _0x2570bf=path[_0xb68d('0x69')](config[_0xb68d('0x6a')],_0xb68d('0x72'));var _0x563077={'where':{'id':_0x458790[_0xb68d('0x43')]['id']},'attributes':['id',_0xb68d('0x62')],'raw':!![]};return db[_0xb68d('0x2a')][_0xb68d('0x4c')](_0x563077)[_0xb68d('0x11')](handleEntityNotFound(_0x11b4a1,null))['then'](function(_0xe4100d){if(_0xe4100d){if(!_[_0xb68d('0x6d')](_0xe4100d[_0xb68d('0x62')])){if(fs[_0xb68d('0x6e')](path[_0xb68d('0x69')](config['root'],_0xb68d('0x73'),_0xe4100d['agentAvatar']))){_0x2570bf=path[_0xb68d('0x69')](config[_0xb68d('0x6a')],'server/files/images/avatars/',_0xe4100d[_0xb68d('0x62')]);}}return _0x11b4a1[_0xb68d('0x70')](_0x2570bf);}})[_0xb68d('0x41')](handleError(_0x11b4a1,null));};exports[_0xb68d('0x74')]=function(_0x139069,_0x27c444){var _0x4244b5=path[_0xb68d('0x69')](config[_0xb68d('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x15777={'where':{'id':_0x139069[_0xb68d('0x43')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xb68d('0x2a')][_0xb68d('0x4c')](_0x15777)[_0xb68d('0x11')](handleEntityNotFound(_0x27c444,null))[_0xb68d('0x11')](function(_0x4316d8){if(_0x4316d8){if(!_[_0xb68d('0x6d')](_0x4316d8[_0xb68d('0x64')])){if(fs[_0xb68d('0x6e')](path[_0xb68d('0x69')](config[_0xb68d('0x6a')],_0xb68d('0x73'),_0x4316d8['customerAvatar']))&&_0x4316d8['showCustomerAvatar']){_0x4244b5=path[_0xb68d('0x69')](config['root'],_0xb68d('0x73'),_0x4316d8[_0xb68d('0x64')]);}}return _0x27c444[_0xb68d('0x70')](_0x4244b5);}})['catch'](handleError(_0x27c444,null));};exports[_0xb68d('0x75')]=function(_0x506540,_0x2c377e){var _0xc47be6=path[_0xb68d('0x69')](config['root'],_0xb68d('0x76'));var _0x42104b={'where':{'id':_0x506540['params']['id']},'attributes':['id',_0xb68d('0x67')],'raw':!![]};return db[_0xb68d('0x2a')][_0xb68d('0x4c')](_0x42104b)[_0xb68d('0x11')](handleEntityNotFound(_0x2c377e,null))[_0xb68d('0x11')](function(_0xd88fa1){if(_0xd88fa1){if(!_[_0xb68d('0x6d')](_0xd88fa1[_0xb68d('0x67')])){if(fs[_0xb68d('0x6e')](path['join'](config[_0xb68d('0x6a')],_0xb68d('0x73'),_0xd88fa1[_0xb68d('0x67')]))){_0xc47be6=path[_0xb68d('0x69')](config[_0xb68d('0x6a')],_0xb68d('0x73'),_0xd88fa1[_0xb68d('0x67')]);}}return _0x2c377e[_0xb68d('0x70')](_0xc47be6);}})['catch'](handleError(_0x2c377e,null));};exports[_0xb68d('0x77')]=function(_0x48c786,_0x365b2b){var _0x3ea0fd=require(_0xb68d('0x78'));var _0x419997=new _0x3ea0fd();var _0x4fcf86=_0x419997[_0xb68d('0x79')](_0x48c786[_0xb68d('0x7a')][_0xb68d('0x7b')])[_0xb68d('0x7c')]();var _0x277800={'body':_0x48c786[_0xb68d('0x47')],'channel':_0xb68d('0x7d')};var _0x45a9e6=[];var _0x364047=[];var _0x43ea3a={};var _0x21a8a3=![];return db[_0xb68d('0x7e')]['describe']()[_0xb68d('0x11')](function(_0x252c54){if(!_0x252c54){throw new db[(_0xb68d('0x7f'))][(_0xb68d('0x80'))](_0xb68d('0x81'));}_0x45a9e6=_[_0xb68d('0x82')](_[_0xb68d('0x30')](_0x252c54),['createdAt',_0xb68d('0x83')]);_0x364047=_['difference'](_[_0xb68d('0x30')](_0x252c54),[_0xb68d('0x84'),'updatedAt',_0xb68d('0x85'),_0xb68d('0x86')]);if(_0x48c786['body']['id']){delete _0x48c786[_0xb68d('0x47')]['id'];}if(_[_0xb68d('0x6d')](_0x48c786['body'][_0xb68d('0x87')])){throw new db[(_0xb68d('0x7f'))]['ValidationError'](_0xb68d('0x88'));}if(_[_0xb68d('0x6d')](_0x48c786[_0xb68d('0x47')][_0xb68d('0x47')])||_0x48c786[_0xb68d('0x47')]['body']===''){throw new db['Sequelize'][(_0xb68d('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x48c786[_0xb68d('0x47')]['mapKey'])){throw new db[(_0xb68d('0x7f'))][(_0xb68d('0x80'))](_0xb68d('0x89')+_0x364047);}if(!_['includes'](_0x364047,_0x48c786[_0xb68d('0x47')][_0xb68d('0x8a')])){throw new db[(_0xb68d('0x7f'))]['ValidationError'](_0xb68d('0x8b')+_0x364047);}_0x43ea3a[_0x48c786[_0xb68d('0x47')][_0xb68d('0x8a')]]=_0x48c786[_0xb68d('0x47')][_0xb68d('0x87')];})['then'](function(){return db['ChatWebsite'][_0xb68d('0x4c')]({'where':{'id':_0x48c786[_0xb68d('0x43')]['id']},'include':[{'model':db['CmList'],'as':_0xb68d('0x8c'),'include':[{'model':db[_0xb68d('0x7e')],'as':'Contacts','where':_0x43ea3a,'limit':0x1,'order':[[_0xb68d('0x83'),_0xb68d('0x8d')]]}]},{'model':db[_0xb68d('0x8e')],'as':_0xb68d('0x8f')}]});})[_0xb68d('0x11')](handleEntityNotFound(_0x365b2b,null))[_0xb68d('0x11')](function(_0x28c5b7){if(_0x28c5b7&&_0x28c5b7[_0xb68d('0x8c')]){_0x277800[_0xb68d('0x90')]=_0x28c5b7;_0x277800['applications']=_0x28c5b7[_0xb68d('0x8f')];_0x277800[_0xb68d('0x91')]=_0x28c5b7[_0xb68d('0x8c')];_0x277800[_0xb68d('0x92')]=_[_0xb68d('0x93')](_0x277800[_0xb68d('0x92')],[_0xb68d('0x94')],[_0xb68d('0x95')]);if(_0x277800[_0xb68d('0x90')]['Applications']){delete _0x277800[_0xb68d('0x90')][_0xb68d('0x8f')];}if(_0x277800[_0xb68d('0x90')][_0xb68d('0x8c')]&&_0x277800[_0xb68d('0x90')][_0xb68d('0x8c')][_0xb68d('0x96')][_0xb68d('0x45')]){return _0x277800['account'][_0xb68d('0x8c')][_0xb68d('0x96')][0x0];}var _0x272f1c=_[_0xb68d('0x97')](_0x48c786['body'],{'firstName':_0x48c786[_0xb68d('0x47')][_0xb68d('0x87')],'ListId':_0x28c5b7[_0xb68d('0x86')]});_0x272f1c[_0x48c786[_0xb68d('0x47')][_0xb68d('0x8a')]]=_0x48c786[_0xb68d('0x47')][_0xb68d('0x87')];return db['CmContact'][_0xb68d('0x46')](_0x272f1c,{'fields':_0x45a9e6,'raw':!![]});}})['then'](handleEntityNotFound(_0x365b2b,null))[_0xb68d('0x11')](function(_0x4b1d6b){_0x277800['contact']=_0x4b1d6b;var _0xc634a8=_0x48c786[_0xb68d('0x47')][_0xb68d('0x98')];if(_0x48c786[_0xb68d('0x7a')][_0xb68d('0x99')]){_0xc634a8=_0x48c786[_0xb68d('0x7a')][_0xb68d('0x99')];}else if(_0x48c786[_0xb68d('0x7a')]['x-forwarded-for']){_0xc634a8=_[_0xb68d('0x9a')](_0x48c786[_0xb68d('0x7a')][_0xb68d('0x9b')][_0xb68d('0x9c')](','));}if(_0x4b1d6b){var _0x471767={'ContactId':_0x4b1d6b['id'],'ChatWebsiteId':_0x48c786[_0xb68d('0x43')]['id'],'from':(_0x4b1d6b[_0xb68d('0x9d')]||'')+'\x20'+(_0x4b1d6b['lastName']||''),'customerIp':_0xc634a8,'customerPort':_0x48c786[_0xb68d('0x7a')]['x-real-port']?_0x48c786[_0xb68d('0x7a')]['x-real-port']:null,'referer':_0x48c786[_0xb68d('0x47')]['referer'],'browserName':_0x4fcf86[_0xb68d('0x9e')][_0xb68d('0x2f')]&&_0x4fcf86[_0xb68d('0x9e')][_0xb68d('0x9f')]?util[_0xb68d('0xa0')]('%s\x20%s',_0x4fcf86[_0xb68d('0x9e')][_0xb68d('0x2f')],_0x4fcf86[_0xb68d('0x9e')][_0xb68d('0x9f')]):_0xb68d('0xa1'),'browserVersion':_0x4fcf86[_0xb68d('0x9e')][_0xb68d('0x9f')]||_0xb68d('0xa1'),'osName':util[_0xb68d('0xa0')]('%s\x20%s',_0x4fcf86['os']['name'],_0x4fcf86['os']['version']),'osVersion':_0x4fcf86['os'][_0xb68d('0x9f')],'deviceModel':_0x4fcf86[_0xb68d('0xa2')][_0xb68d('0x32')]&&_0x4fcf86[_0xb68d('0xa2')][_0xb68d('0xa3')]?util['format'](_0xb68d('0xa4'),_0x4fcf86[_0xb68d('0xa2')][_0xb68d('0x32')],_0x4fcf86[_0xb68d('0xa2')]['vendor'],_0x4fcf86['device']['type']):null,'deviceVendor':_0x4fcf86['device'][_0xb68d('0xa3')],'deviceType':_0x4fcf86[_0xb68d('0xa2')][_0xb68d('0x2d')],'formData':JSON['stringify'](_0x48c786[_0xb68d('0x47')])};var _0x4bc7b3={'ChatWebsiteId':_0x48c786[_0xb68d('0x43')]['id'],'closed':![]};if(_0x48c786[_0xb68d('0x47')]['threadId']){_0x4bc7b3[_0xb68d('0xa5')]=_0x48c786['body'][_0xb68d('0xa5')];return db[_0xb68d('0xa6')][_0xb68d('0x4c')]({'where':_0x4bc7b3})[_0xb68d('0x11')](function(_0x1b203b){if(_0x1b203b){return[_0x1b203b,![]];}_0x471767[_0xb68d('0xa5')]=_0x48c786[_0xb68d('0x47')][_0xb68d('0xa5')];_0x471767[_0xb68d('0xa7')]=_0x48c786[_0xb68d('0x47')][_0xb68d('0xa7')];return db[_0xb68d('0xa6')]['create'](_0x471767)[_0xb68d('0x11')](function(_0x4b49ec){return[_0x4b49ec,!![]];});});}_0x4bc7b3[_0xb68d('0xa8')]=_0x4b1d6b['id'];if(_0x48c786[_0xb68d('0x47')][_0xb68d('0xa9')]&&_0x48c786[_0xb68d('0x47')]['interaction']['id']){_0x4bc7b3['id']=_0x48c786[_0xb68d('0x47')]['interaction']['id'];return db[_0xb68d('0xa6')][_0xb68d('0x4c')]({'where':_0x4bc7b3})[_0xb68d('0x11')](function(_0x52b5a4){if(_0x52b5a4){return[_0x52b5a4,![]];}return db[_0xb68d('0xa6')][_0xb68d('0x46')](_0x471767)[_0xb68d('0x11')](function(_0x410ab3){return[_0x410ab3,!![]];});});}return db[_0xb68d('0xa6')][_0xb68d('0x46')](_0x471767)[_0xb68d('0x11')](function(_0x4fe9ef){return[_0x4fe9ef,!![]];});}})[_0xb68d('0xaa')](function(_0x59b984,_0x1a8e85){if(_0x59b984){_0x21a8a3=_0x1a8e85;if(!_0x1a8e85){var _0x4d5409={'from':(_0x277800['contact'][_0xb68d('0x9d')]||'')+'\x20'+(_0x277800[_0xb68d('0xab')][_0xb68d('0xac')]||'')};if(_0x48c786['body'][_0xb68d('0xa5')]&&_0x48c786[_0xb68d('0x47')][_0xb68d('0xad')]&&_0x48c786[_0xb68d('0x47')][_0xb68d('0xa5')]!=_0x48c786[_0xb68d('0x47')][_0xb68d('0xad')]){_0x4d5409['threadId']=_0x48c786[_0xb68d('0x47')][_0xb68d('0xad')];}return _0x59b984['update'](_0x4d5409);}else{return _0x59b984;}}})[_0xb68d('0x11')](function(_0x5618d5){_0x277800[_0xb68d('0xa9')]=_0x5618d5[_0xb68d('0xae')]({'plain':!![]});_0x277800['interaction'][_0xb68d('0xaf')]=_0x21a8a3;if(_0x277800[_0xb68d('0xa9')]['created']){if(_0x277800[_0xb68d('0x90')][_0xb68d('0xb0')]){_0x277800['applications']['push']({'id':0x0,'priority':_0x277800[_0xb68d('0x92')][_0xb68d('0x45')]+0x1,'app':_0xb68d('0xb1'),'appdata':_0xb68d('0xb2'),'interval':_0xb68d('0xb3')});}}return db[_0xb68d('0xb4')][_0xb68d('0x46')]({'body':_0x48c786['body'][_0xb68d('0x47')],'ChatWebsiteId':_0x48c786['params']['id'],'ChatInteractionId':_0x5618d5['id'],'direction':'in','ContactId':_0x277800['contact']['id'],'AttachmentId':_0x48c786[_0xb68d('0x47')][_0xb68d('0xb5')]});})[_0xb68d('0x11')](function(_0x532f66){_0x277800['message']=_0x532f66;if(_0x277800['interaction'][_0xb68d('0xb6')]){return db[_0xb68d('0xb7')]['find']({'attributes':['id',_0xb68d('0x2f')],'where':{'id':_0x277800[_0xb68d('0xa9')]['UserId']}})[_0xb68d('0x11')](function(_0x5251ab){if(_0x5251ab){_0x277800['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5251ab[_0xb68d('0x2f')]+','+(_0x277800[_0xb68d('0x90')][_0xb68d('0xb8')]||0xa),'interval':'*,*,*,*'});_0x277800[_0xb68d('0xb9')]=!![];}return respondWithRpcPromise(_0xb68d('0xba'),'startRouting',_0x277800);});}return respondWithRpcPromise(_0xb68d('0xba'),'startRouting',_0x277800);})['then'](function(_0x322eaf){respondWithRpcPromise(_0xb68d('0xbb'),'EventManager',{'event':'notify','message':_0x322eaf},client9002);return _0x322eaf;})[_0xb68d('0x11')](respondWithResult(_0x365b2b,null))[_0xb68d('0x41')](handleError(_0x365b2b,null));};exports[_0xb68d('0xbc')]=function(_0x4cb164,_0x5ad478){var _0x5c3467,_0x2d2f6d,_0x5e8f21;var _0x5dd619=[];var _0x32e755={};var _0x75fe19=_0x4cb164[_0xb68d('0xbd')]||[];var _0x5c22af=[];var _0x5aced2;return db[_0xb68d('0x7e')][_0xb68d('0x51')]()[_0xb68d('0x11')](function(_0x3e5d77){if(!_0x3e5d77){throw new db[(_0xb68d('0x7f'))][(_0xb68d('0x80'))](_0xb68d('0x81'));}_0x5dd619=_['difference'](_[_0xb68d('0x30')](_0x3e5d77),[_0xb68d('0x84'),'updatedAt','CompanyId',_0xb68d('0x86')]);if(_0x4cb164[_0xb68d('0x47')]['id']){delete _0x4cb164['body']['id'];}if(_[_0xb68d('0x6d')](_0x4cb164['body']['from'])){throw _0x5ad478['status'](0x1f4)['send'](new db[(_0xb68d('0x7f'))]['ValidationError'](_0xb68d('0x88')));}if(_[_0xb68d('0x6d')](_0x4cb164[_0xb68d('0x47')][_0xb68d('0x47')])||_0x4cb164['body'][_0xb68d('0x47')]===''){throw _0x5ad478[_0xb68d('0x1c')](0x1f4)[_0xb68d('0x27')](new db[(_0xb68d('0x7f'))]['ValidationError'](_0xb68d('0xbe')));}if(_['isNil'](_0x4cb164[_0xb68d('0x47')][_0xb68d('0xbf')])){throw _0x5ad478[_0xb68d('0x1c')](0x1f4)['send'](new db[(_0xb68d('0x7f'))][(_0xb68d('0x80'))](_0xb68d('0xc0')+_0x5dd619));}if(!_[_0xb68d('0xc1')](_0x5dd619,_0x4cb164[_0xb68d('0x47')][_0xb68d('0xbf')])){throw _0x5ad478[_0xb68d('0x1c')](0x1f4)[_0xb68d('0x27')](new db[(_0xb68d('0x7f'))][(_0xb68d('0x80'))](_0xb68d('0xc2')+_0x5dd619));}_0x32e755[_0x4cb164[_0xb68d('0x47')][_0xb68d('0xbf')]]=_0x4cb164[_0xb68d('0x47')][_0xb68d('0x87')];})[_0xb68d('0x11')](function(){return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x4cb164[_0xb68d('0x43')]['id']},'include':[{'model':db[_0xb68d('0xc3')],'as':_0xb68d('0x8c')},{'model':db['MailAccount'],'as':_0xb68d('0xc4')}]});})['then'](handleEntityNotFound(_0x5ad478,null))['then'](function(_0x5b8ef2){if(_0x5b8ef2&&_0x5b8ef2[_0xb68d('0x8c')]){_0x2d2f6d=_0x5b8ef2;var _0x4fbc87=_[_0xb68d('0x97')](_0x4cb164[_0xb68d('0x47')],{'firstName':_0x4cb164['body'][_0xb68d('0x87')],'phone':_0x4cb164[_0xb68d('0x47')][_0xb68d('0x87')],'ListId':_0x5b8ef2[_0xb68d('0x86')]});_0x4fbc87[_0x4cb164[_0xb68d('0x47')]['mapKeyOffline']]=_0x4cb164[_0xb68d('0x47')][_0xb68d('0x87')];return db[_0xb68d('0x7e')][_0xb68d('0xc5')]({'where':_0x32e755,'defaults':_0x4fbc87});}})[_0xb68d('0xaa')](function(_0x51bcef){if(_0x51bcef){_0x5e8f21=_0x51bcef;var _0x5e23fd=fs['readFileSync'](path[_0xb68d('0x69')](config['root'],_0xb68d('0xc6')),_0xb68d('0xc7'));var _0x25eafb=ejs[_0xb68d('0xc8')](_0x5e23fd,{'body':_['toPairs'](_0x4cb164[_0xb68d('0x47')][_0xb68d('0x47')]),'bodyTitle':_0x2d2f6d[_0xb68d('0xc9')]});return db[_0xb68d('0xca')][_0xb68d('0x46')]({'body':_0x25eafb,'plainBody':htmlToText[_0xb68d('0xcb')](_0x25eafb),'ContactId':_0x51bcef['id'],'ChatWebsiteId':_0x2d2f6d['id']});}})['then'](function(_0x42f902){_0x5aced2=_0x42f902;if(_0x75fe19[_0xb68d('0x45')]){var _0x1b70f4=_0x75fe19[_0xb68d('0x29')](function(_0x5d4028){return{'name':_0x5d4028[_0xb68d('0xcc')],'basename':_0x5d4028[_0xb68d('0x60')],'type':_0x5d4028[_0xb68d('0xcd')],'ChatOfflineMessageId':_0x42f902['id']};});_0x5c22af=_0x1b70f4[_0xb68d('0x29')](_0x43288a=>{var _0x5bbd1a={'filename':_0x43288a[_0xb68d('0x2f')],'path':path['join'](config[_0xb68d('0x6a')],_0xb68d('0xce'),_0xb68d('0xbd'),_0xb68d('0xcf'),_0xb68d('0xd0'),_0x43288a['basename'])};return _0x5bbd1a;});if(!_0x2d2f6d[_0xb68d('0xd1')]){return db[_0xb68d('0xd2')][_0xb68d('0xd3')](function(_0x1a4106){return db[_0xb68d('0xd4')][_0xb68d('0xd5')](_0x1b70f4,{'transaction':_0x1a4106});});}}})[_0xb68d('0x11')](function(){if(_0x5aced2){_0x5c3467=_0x5aced2;return db['MailAccount'][_0xb68d('0x5b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb68d('0xd6')],'as':_0xb68d('0xd6'),'raw':!![]}]}]});}})['then'](function(_0x4cdfe0){if(_0x4cdfe0&&_0x4cdfe0[_0xb68d('0xd7')]&&_0x2d2f6d['forwardOffline']&&_0x2d2f6d['forwardOfflineAddress']){var _0x208eb8=_0x4cdfe0[_0xb68d('0xd8')]();return respondWithRpcPromise(_0xb68d('0xd9'),_0xb68d('0xda'),{'account':_0x208eb8,'message':{'from':util[_0xb68d('0xa0')](_0xb68d('0xdb'),_0x4cdfe0[_0xb68d('0x2f')],_0x4cdfe0[_0xb68d('0xdc')]||_0x4cdfe0['Smtp'][_0xb68d('0x48')]),'to':_0x2d2f6d['forwardOfflineAddress'],'subject':_0x2d2f6d[_0xb68d('0xdd')],'html':_0x5c3467[_0xb68d('0x47')],'attachments':_0x5c22af}},client9003)['then'](function(){return _0x5c3467;})[_0xb68d('0x41')](function(_0x4229a5){logger[_0xb68d('0x17')](_0x4229a5);});}})[_0xb68d('0x11')](function(){if(_0x2d2f6d&&_0x2d2f6d['openNewInteraction']&&_0x2d2f6d[_0xb68d('0xde')]){var _0x5784d4=[];if(_0x75fe19[_0xb68d('0x45')]){_0x5784d4=_0x75fe19[_0xb68d('0x29')](function(_0x48860c){return{'name':_0x48860c[_0xb68d('0xcc')],'basename':_0x48860c[_0xb68d('0x60')],'type':_0x48860c[_0xb68d('0xcd')],'ChatOfflineMessageId':_0x5aced2['id']};});}var _0x52147c;if(!_['isNil'](_0x2d2f6d[_0xb68d('0xdf')])){var _0x754c5b=_[_0xb68d('0x29')](_0x4cb164[_0xb68d('0x47')],function(_0x2ff05b){return _0x2ff05b;});var _0x27f7da=_[_0xb68d('0xe0')](_0x754c5b)[0x0];var _0x59c851=_['mapValues'](_0x27f7da,function(_0xcafd6d){return _0xcafd6d;});_0x52147c=_0x59c851[0x1][_0x2d2f6d[_0xb68d('0xdf')]];}var _0x56bbca={'from':_0x5e8f21[_0xb68d('0xdc')],'firstName':_0x5e8f21[_0xb68d('0x9d')],'lastName':_0x5e8f21[_0xb68d('0xac')],'mapKey':_0xb68d('0xdc'),'message':{'from':_0x5e8f21[_0xb68d('0xdc')],'to':_0x2d2f6d[_0xb68d('0xc4')][_0xb68d('0xdc')],'cc':'','subject':_['isNil'](_0x52147c)?_0x2d2f6d['offlineMessageSubject']:_0x52147c,'messageId':'','sentAt':new Date(),'attach':_0x5784d4[_0xb68d('0x45')],'attachments':_0x5784d4,'originChannel':_0xb68d('0xe1'),'ChatWebsiteId':_0x2d2f6d['id'],'ChatOfflineMessageId':_0x5c3467['id'],'originTo':_0x2d2f6d['MailAccount'][_0xb68d('0xdc')]},'body':_0x5c3467['body']};var _0x4bc9a3={'account':{'id':_0x2d2f6d[_0xb68d('0xde')]},'body':_0x56bbca,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xb68d('0xe2'),_0xb68d('0xe3'),_0x4bc9a3,client9001)[_0xb68d('0x11')](function(){return _0x5c3467;})[_0xb68d('0x41')](function(_0xede9d8){logger['error'](_0xede9d8);});}return;})[_0xb68d('0x11')](function(){if(_0x5c3467){return _0x5c3467;}})['then'](respondWithResult(_0x5ad478,null))[_0xb68d('0x41')](function(_0x378aec){logger[_0xb68d('0x17')](_0xb68d('0x41'),_0x378aec);for(var _0x4f41bc of _0x75fe19){var _0x463cf0=path[_0xb68d('0x69')](config[_0xb68d('0x6a')],_0xb68d('0xce'),_0xb68d('0xbd'),_0xb68d('0xcf'),_0xb68d('0xd0'),_0x4f41bc['filename']);fs_extra[_0xb68d('0xe4')](_0x463cf0)[_0xb68d('0x41')](function(_0x2423c2){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x463cf0,_0x2423c2);});}});};exports[_0xb68d('0xe5')]=function(_0xed9930,_0x4ff86a){return db[_0xb68d('0xa6')][_0xb68d('0x4c')]({'where':{'id':_0xed9930[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x4ff86a,null))['then'](function(_0x730bee){if(_0x730bee){return _0x730bee[_0xb68d('0xe5')](_0xed9930[_0xb68d('0x47')][_0xb68d('0xe6')],_[_0xb68d('0xe7')](_0xed9930[_0xb68d('0x47')],['ids','id'])||{});}})[_0xb68d('0x11')](respondWithResult(_0x4ff86a,null))['catch'](handleError(_0x4ff86a,null));};exports[_0xb68d('0xe8')]=function(_0x420cb9,_0x504532){var _0x59cb42={'raw':![],'where':{}};var _0x4ae4c7={};var _0x4effa9={'count':0x0,'rows':[]};return db[_0xb68d('0x2a')]['findOne']({'where':{'id':_0x420cb9[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x504532,null))['then'](function(_0x9ba0fe){if(_0x9ba0fe){_0x4ae4c7[_0xb68d('0x32')]=_['keys'](db[_0xb68d('0xa6')][_0xb68d('0x2b')]);_0x4ae4c7[_0xb68d('0x35')]=_[_0xb68d('0x30')](_0x420cb9['query']);_0x4ae4c7[_0xb68d('0x3b')]=_[_0xb68d('0x31')](_0x4ae4c7[_0xb68d('0x32')],_0x4ae4c7['query']);_0x59cb42[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x4ae4c7['model'],qs[_0xb68d('0x34')](_0x420cb9[_0xb68d('0x35')][_0xb68d('0x34')]));_0x59cb42[_0xb68d('0x33')]=_0x59cb42['attributes']['length']?_0x59cb42[_0xb68d('0x33')]:_0x4ae4c7[_0xb68d('0x32')];if(!_0x420cb9[_0xb68d('0x35')][_0xb68d('0x55')](_0xb68d('0x36'))){_0x59cb42[_0xb68d('0x21')]=qs[_0xb68d('0x21')](_0x420cb9[_0xb68d('0x35')]['limit']);_0x59cb42[_0xb68d('0x1f')]=qs['offset'](_0x420cb9[_0xb68d('0x35')][_0xb68d('0x1f')]);}_0x59cb42['order']=qs[_0xb68d('0x38')](_0x420cb9[_0xb68d('0x35')][_0xb68d('0x38')]);_0x59cb42[_0xb68d('0x39')]=qs[_0xb68d('0x3b')](_[_0xb68d('0x3a')](_0x420cb9[_0xb68d('0x35')],_0x4ae4c7[_0xb68d('0x3b')]));_0x59cb42['where']['ChatWebsiteId']=_0x9ba0fe['id'];if(_0x420cb9[_0xb68d('0x35')][_0xb68d('0x56')]){_0x59cb42[_0xb68d('0x39')]=_['merge'](_0x59cb42[_0xb68d('0x39')],{'$or':_[_0xb68d('0x29')](_0x59cb42[_0xb68d('0x33')],function(_0x2a17f7){var _0x22b92b={};_0x22b92b[_0x2a17f7]={'$like':'%'+_0x420cb9['query'][_0xb68d('0x56')]+'%'};return _0x22b92b;})});}_0x59cb42=_['merge']({},_0x59cb42,_0x420cb9[_0xb68d('0x3d')]);return db['ChatInteraction'][_0xb68d('0x3e')]({'where':_0x59cb42[_0xb68d('0x39')]})[_0xb68d('0x11')](function(_0x4c5fa2){_0x4effa9[_0xb68d('0x3e')]=_0x4c5fa2;if(_0x420cb9['query'][_0xb68d('0x3f')]){_0x59cb42[_0xb68d('0x40')]=[{'model':db[_0xb68d('0x7e')],'as':_0xb68d('0xe9'),'required':![]},{'model':db[_0xb68d('0xb7')],'as':'Owner','attributes':[_0xb68d('0x2f'),_0xb68d('0xea'),_0xb68d('0xeb')],'required':![]},{'model':db['Tag'],'as':_0xb68d('0xec'),'attributes':['id',_0xb68d('0x2f'),_0xb68d('0xed')],'where':_0x420cb9[_0xb68d('0x35')][_0xb68d('0xee')]?{'id':_0x420cb9['query'][_0xb68d('0xee')]}:undefined,'required':_0x420cb9[_0xb68d('0x35')][_0xb68d('0xee')]?!![]:![]}];}return db[_0xb68d('0xa6')][_0xb68d('0x57')](_0x59cb42);})[_0xb68d('0x11')](function(_0x50dd59){_0x4effa9[_0xb68d('0x5d')]=_0x50dd59;return _0x4effa9;});}})['then'](respondWithFilteredResult(_0x504532,_0x59cb42))['catch'](handleError(_0x504532,null));};function iftimePromise(_0x329766,_0x149063){return respondWithRpcPromise('Command','getSnippet',{'command':_0x149063['timezone']?util['format'](_0xb68d('0xef'),_0x329766['interval'],_0x149063[_0xb68d('0xf0')]):util[_0xb68d('0xa0')](_0xb68d('0xf1'),_0x329766[_0xb68d('0xf2')])},client9002)[_0xb68d('0x11')](function(_0x12e25b){var _0x67863c=_0x12e25b&&_0x12e25b['indexOf']('true')>=0x0?!![]:![];logger[_0xb68d('0x12')](_0xb68d('0xf3'),_0x149063['id'],_0x329766['id'],_0x329766[_0xb68d('0xf2')],_0x67863c?_0xb68d('0xf4'):_0xb68d('0xf5'),_0x149063[_0xb68d('0xf0')]?_0x149063['timezone']:_0xb68d('0xf6'));return _0x67863c;})[_0xb68d('0x41')](function(_0x4fb9bd){logger[_0xb68d('0x17')](_0xb68d('0xf3'),_0x149063['id'],_0x329766['id'],_0x329766['interval'],util['inspect'](_0x4fb9bd,{'showHidden':![],'depth':null}),_0x149063[_0xb68d('0xf0')]?_0x149063['timezone']:_0xb68d('0xf6'));return![];});}exports[_0xb68d('0xf7')]=function(_0x44a1f6,_0x508ffd){var _0x248270=0x0;var _0x73c731=0x0;var _0x559739=![];var _0x203214;var _0x5c9ee4;return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x44a1f6[_0xb68d('0x43')]['id']},'include':[{'model':db[_0xb68d('0xf8')],'as':_0xb68d('0xf8'),'include':[{'model':db[_0xb68d('0xf8')],'as':'Intervals','attributes':['id',_0xb68d('0xf2')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x508ffd,null))[_0xb68d('0x11')](function(_0x2dc280){if(_0x2dc280){_0x203214=_0x2dc280;return _0x2dc280[_0xb68d('0xf9')]({'raw':!![]});}})[_0xb68d('0x11')](function(_0x999f8){if(_0x203214){if(_0x999f8){_0x5c9ee4=_0x999f8;}}return require(_0xb68d('0xfa'))[_0xb68d('0x6b')]();})[_0xb68d('0x11')](function(_0x4dbaa){if(_0x4dbaa){_0x73c731=_0x4dbaa['virtual'];_0x559739=_0x4dbaa[_0xb68d('0x6c')];}})[_0xb68d('0x11')](function(){return db[_0xb68d('0xa6')][_0xb68d('0x3e')]({'where':{'closed':![]}});})[_0xb68d('0x11')](function(_0x4b271f){_0x248270=_0x4b271f;if(_0x73c731&&_0x4b271f>_0x73c731){return db['License'][_0xb68d('0x5b')]({'where':{'id':0x1}})[_0xb68d('0x11')](function(_0x51ae0c){if(_0x51ae0c){_0x51ae0c['increment'](_0xb68d('0xfb'));}});}})[_0xb68d('0x11')](function(){if(_0x203214[_0xb68d('0xf8')]&&_0x203214[_0xb68d('0xf8')][_0xb68d('0xfc')]){var _0x1e308a=[];for(var _0x3f2a84=0x0;_0x3f2a84<_0x203214[_0xb68d('0xf8')][_0xb68d('0xfc')]['length'];_0x3f2a84++){var _0x9683b2=_0x203214[_0xb68d('0xf8')]['Intervals'][_0x3f2a84][_0xb68d('0xae')]({'plain':!![]});_0x1e308a[_0xb68d('0xfd')](iftimePromise(_0x9683b2,_0x203214));}return BPromise[_0xb68d('0xfe')](_0x1e308a)[_0xb68d('0x11')](function(_0x50520d){return _[_0xb68d('0xff')](_0x50520d);});}else{return!![];}})[_0xb68d('0x11')](function(_0x506e0e){var _0x5e87eb=fs[_0xb68d('0x100')](path[_0xb68d('0x69')](config[_0xb68d('0x6a')],_0xb68d('0x101')),'utf8');var _0x4ae289=new url[(_0xb68d('0x102'))](_0x203214[_0xb68d('0x103')])[_0xb68d('0x104')];var _0xfdd95b=_0xb68d('0x105');var _0x2e95d6=![];var _0x4c0855={'chatVersion':_0xfdd95b,'chatWebsiteAddressOrigin':_0x4ae289,'remote':_0x203214[_0xb68d('0x106')],'query':querystring['stringify'](_[_0xb68d('0x3c')](_0x203214[_0xb68d('0xae')]({'plain':!![]}),{'customerIp':_0x44a1f6['headers'][_0xb68d('0x9b')]||_0x44a1f6[_0xb68d('0x7a')][_0xb68d('0x107')]||_0x44a1f6[_0xb68d('0x108')][_0xb68d('0x109')]||_0x44a1f6['ip'],'referer':_0x44a1f6['headers'][_0xb68d('0x10a')],'openedInteractions':_0x248270,'maxInteractions':_0x73c731,'virtual':_0x559739[_0xb68d('0x10b')],'online':_0x506e0e,'custom':_0x559739}))[_0xb68d('0x10c')](/'/g,'\x5c\x27')};_0x508ffd['send'](ejs[_0xb68d('0xc8')](Mustache[_0xb68d('0xc8')](_0x5e87eb,_0x4c0855),{'proactiveActions':_0x5c9ee4,'alignment':_0x203214[_0xb68d('0x10d')],'verticalAlignment':_0x203214[_0xb68d('0x10e')],'div_color':_0x203214[_0xb68d('0xed')],'labelText':_0x203214[_0xb68d('0x10f')],'text_color':_0x203214['textColor'],'text_button_color':_0x203214[_0xb68d('0x110')],'button_color':_0x203214[_0xb68d('0x111')],'background_color':_0x203214[_0xb68d('0x112')],'hideWhenOffline':_0x203214[_0xb68d('0x113')],'intervalId':_0x203214['IntervalId'],'isDevelopment':_0x2e95d6,'chatVersion':_0xfdd95b}));})[_0xb68d('0x41')](handleError(_0x508ffd,null));};exports['addApplications']=function(_0x27bbaa,_0x3bb59b){var _0x4b8664=_0x27bbaa[_0xb68d('0x43')]['id'];var _0x1be744=_0x27bbaa[_0xb68d('0x47')];var _0x32b110=0xc8;var _0xc5cf1a=null;return db[_0xb68d('0xd2')][_0xb68d('0xd3')]({'isolationLevel':db[_0xb68d('0xd2')]['Transaction'][_0xb68d('0x114')][_0xb68d('0x115')]},function(_0x592a72){return db[_0xb68d('0x2a')][_0xb68d('0x5b')]({'where':{'id':_0x4b8664},'transaction':_0x592a72})[_0xb68d('0x11')](function(_0x576b68){if(_0x576b68){return db['ChatApplication'][_0xb68d('0x23')]({'where':{'ChatWebsiteId':_0x4b8664},'transaction':_0x592a72})[_0xb68d('0x11')](function(){var _0x116242=_[_0xb68d('0x29')](_0x1be744,function(_0x363012){_0x363012[_0xb68d('0x53')]=_0x4b8664;return _0x363012;});return db[_0xb68d('0x8e')][_0xb68d('0xd5')](_0x116242,{'transaction':_0x592a72});});}else{_0x32b110=0x194;_0xc5cf1a=[];}});})['then'](function(){if(_0x32b110!==0x194){return db[_0xb68d('0x8e')][_0xb68d('0x116')]({'where':{'ChatWebsiteId':_0x4b8664},'order':_0xb68d('0x94')})[_0xb68d('0x11')](function(_0x5c3ef3){_0xc5cf1a=_0x5c3ef3;});}})[_0xb68d('0x41')](function(_0x19dbd6){_0x32b110=0x1f4;logger[_0xb68d('0x17')](_0x19dbd6[_0xb68d('0x26')]);if(_0x19dbd6[_0xb68d('0x2f')]){delete _0x19dbd6[_0xb68d('0x2f')];}_0xc5cf1a=_0x19dbd6;})[_0xb68d('0x117')](function(){if(_0xc5cf1a===null){_0x3bb59b[_0xb68d('0x1b')](_0x32b110);}else{if(_0x32b110===0x1f4){_0x3bb59b[_0xb68d('0x1c')](_0x32b110)[_0xb68d('0x27')](_0xc5cf1a);}else{_0x3bb59b['status'](_0x32b110)[_0xb68d('0x1e')](_0xc5cf1a);}}});};exports[_0xb68d('0x118')]=function(_0x147175,_0x38e5b0){var _0x5003cc={};var _0x3ef63e={};var _0x5680ea;var _0x347d14;return db[_0xb68d('0x2a')][_0xb68d('0x5b')]({'where':{'id':_0x147175[_0xb68d('0x43')]['id']}})['then'](handleEntityNotFound(_0x38e5b0,null))['then'](function(_0xbfa34a){if(_0xbfa34a){_0x5680ea=_0xbfa34a;_0x3ef63e[_0xb68d('0x32')]=_['keys'](db[_0xb68d('0x8e')][_0xb68d('0x2b')]);_0x3ef63e[_0xb68d('0x35')]=_['keys'](_0x147175['query']);_0x3ef63e[_0xb68d('0x3b')]=_[_0xb68d('0x31')](_0x3ef63e['model'],_0x3ef63e[_0xb68d('0x35')]);_0x5003cc[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x3ef63e['model'],qs['fields'](_0x147175['query']['fields']));_0x5003cc['attributes']=_0x5003cc['attributes']['length']?_0x5003cc[_0xb68d('0x33')]:_0x3ef63e[_0xb68d('0x32')];_0x5003cc[_0xb68d('0x37')]=qs[_0xb68d('0x38')](_0x147175['query'][_0xb68d('0x38')]);_0x5003cc[_0xb68d('0x39')]=qs[_0xb68d('0x3b')](_[_0xb68d('0x3a')](_0x147175[_0xb68d('0x35')],_0x3ef63e[_0xb68d('0x3b')]));if(_0x147175['query'][_0xb68d('0x56')]){_0x5003cc['where']=_['merge'](_0x5003cc[_0xb68d('0x39')],{'$or':_['map'](_0x5003cc['attributes'],function(_0x5d6225){var _0x4bfdf5={};_0x4bfdf5[_0x5d6225]={'$like':'%'+_0x147175['query'][_0xb68d('0x56')]+'%'};return _0x4bfdf5;})});}_0x5003cc=_['merge']({},_0x5003cc,_0x147175[_0xb68d('0x3d')]);return _0x5680ea[_0xb68d('0x118')](_0x5003cc);}})[_0xb68d('0x11')](function(_0x354e38){if(_0x354e38){_0x347d14=_0x354e38[_0xb68d('0x45')];if(!_0x147175[_0xb68d('0x35')][_0xb68d('0x55')](_0xb68d('0x36'))){_0x5003cc[_0xb68d('0x21')]=qs[_0xb68d('0x21')](_0x147175[_0xb68d('0x35')][_0xb68d('0x21')]);_0x5003cc[_0xb68d('0x1f')]=qs[_0xb68d('0x1f')](_0x147175[_0xb68d('0x35')][_0xb68d('0x1f')]);}return _0x5680ea[_0xb68d('0x118')](_0x5003cc);}})[_0xb68d('0x11')](function(_0x6b4b27){if(_0x6b4b27){return _0x6b4b27?{'count':_0x347d14,'rows':_0x6b4b27}:null;}})[_0xb68d('0x11')](respondWithResult(_0x38e5b0,null))['catch'](handleError(_0x38e5b0,null));};exports[_0xb68d('0x119')]=function(_0x4f1182,_0x4fdbe6){return db['chatProactiveAction'][_0xb68d('0x4c')]({'where':{'id':_0x4f1182['params']['id']}})['then'](handleEntityNotFound(_0x4fdbe6,null))[_0xb68d('0x11')](function(_0x88f24b){if(_0x88f24b){return _0x88f24b[_0xb68d('0x119')](_0x4f1182[_0xb68d('0x47')][_0xb68d('0xe6')],_[_0xb68d('0xe7')](_0x4f1182[_0xb68d('0x47')],[_0xb68d('0xe6'),'id'])||{});}})[_0xb68d('0x11')](respondWithResult(_0x4fdbe6,null))['catch'](handleError(_0x4fdbe6,null));};exports[_0xb68d('0xf9')]=function(_0xb317c1,_0x3f4a5e){var _0x52b2c1={};var _0x3d2755={};var _0x1b553a;var _0x5bbeb1;return db[_0xb68d('0x2a')][_0xb68d('0x5b')]({'where':{'id':_0xb317c1[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x3f4a5e,null))[_0xb68d('0x11')](function(_0x54f7ee){if(_0x54f7ee){_0x1b553a=_0x54f7ee;_0x3d2755[_0xb68d('0x32')]=_['keys'](db[_0xb68d('0x11a')][_0xb68d('0x2b')]);_0x3d2755[_0xb68d('0x35')]=_[_0xb68d('0x30')](_0xb317c1[_0xb68d('0x35')]);_0x3d2755['filters']=_[_0xb68d('0x31')](_0x3d2755[_0xb68d('0x32')],_0x3d2755['query']);_0x52b2c1[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x3d2755[_0xb68d('0x32')],qs[_0xb68d('0x34')](_0xb317c1['query'][_0xb68d('0x34')]));_0x52b2c1[_0xb68d('0x33')]=_0x52b2c1[_0xb68d('0x33')][_0xb68d('0x45')]?_0x52b2c1['attributes']:_0x3d2755[_0xb68d('0x32')];_0x52b2c1[_0xb68d('0x37')]=qs[_0xb68d('0x38')](_0xb317c1['query'][_0xb68d('0x38')]);_0x52b2c1[_0xb68d('0x39')]=qs['filters'](_[_0xb68d('0x3a')](_0xb317c1['query'],_0x3d2755[_0xb68d('0x3b')]));if(_0xb317c1[_0xb68d('0x35')]['filter']){_0x52b2c1[_0xb68d('0x39')]=_[_0xb68d('0x3c')](_0x52b2c1['where'],{'$or':_['map'](_0x52b2c1[_0xb68d('0x33')],function(_0x58c182){var _0x4c4da2={};_0x4c4da2[_0x58c182]={'$like':'%'+_0xb317c1[_0xb68d('0x35')][_0xb68d('0x56')]+'%'};return _0x4c4da2;})});}_0x52b2c1=_[_0xb68d('0x3c')]({},_0x52b2c1,_0xb317c1['options']);return _0x1b553a[_0xb68d('0xf9')](_0x52b2c1);}})[_0xb68d('0x11')](function(_0x3fccb1){if(_0x3fccb1){_0x5bbeb1=_0x3fccb1[_0xb68d('0x45')];if(!_0xb317c1['query'][_0xb68d('0x55')](_0xb68d('0x36'))){_0x52b2c1[_0xb68d('0x21')]=qs[_0xb68d('0x21')](_0xb317c1[_0xb68d('0x35')]['limit']);_0x52b2c1['offset']=qs[_0xb68d('0x1f')](_0xb317c1[_0xb68d('0x35')][_0xb68d('0x1f')]);}return _0x1b553a[_0xb68d('0xf9')](_0x52b2c1);}})['then'](function(_0x35ce2b){if(_0x35ce2b){return _0x35ce2b?{'count':_0x5bbeb1,'rows':_0x35ce2b}:null;}})[_0xb68d('0x11')](respondWithResult(_0x3f4a5e,null))[_0xb68d('0x41')](handleError(_0x3f4a5e,null));};exports[_0xb68d('0x11b')]=function(_0x392016,_0x577f0d){var _0x509b9c=_0x392016[_0xb68d('0x35')][_0xb68d('0x11c')]===_0xb68d('0x11d')?_0xb68d('0x11e'):'onlineForm';return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'attributes':['id',_0x509b9c],'where':{'id':_0x392016[_0xb68d('0x43')]['id']}})['then'](handleEntityNotFound(_0x577f0d,null))['then'](function(_0x148551){if(_0x148551){var _0xfd848=_0x148551[_0x509b9c];var _0x2d9499=_0xfd848&&_0xfd848[_0xb68d('0x11f')]?_0xfd848[_0xb68d('0x11f')]:[];_0x577f0d[_0xb68d('0x27')]({'fromKey':_[_0xb68d('0x6d')](_0xfd848[_0xb68d('0x120')])?undefined:_0xfd848[_0xb68d('0x120')],'count':_0x2d9499[_0xb68d('0x45')],'rows':_0x2d9499});}})['catch'](handleError(_0x577f0d,null));};exports[_0xb68d('0x121')]=function(_0x1cd25c,_0x479078){var _0x1c278a={'raw':![],'where':{}};var _0x8362f3={};var _0x54b116={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb68d('0x5b')]({'where':{'id':_0x1cd25c['params']['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x479078,null))[_0xb68d('0x11')](function(_0x56ae25){if(_0x56ae25){_0x8362f3['model']=_[_0xb68d('0x30')](db[_0xb68d('0xca')][_0xb68d('0x2b')]);_0x8362f3[_0xb68d('0x35')]=_[_0xb68d('0x30')](_0x1cd25c['query']);_0x8362f3['filters']=_[_0xb68d('0x31')](_0x8362f3['model'],_0x8362f3['query']);_0x1c278a[_0xb68d('0x33')]=_[_0xb68d('0x31')](_0x8362f3['model'],qs[_0xb68d('0x34')](_0x1cd25c[_0xb68d('0x35')][_0xb68d('0x34')]));_0x1c278a[_0xb68d('0x33')]=_0x1c278a[_0xb68d('0x33')][_0xb68d('0x45')]?_0x1c278a[_0xb68d('0x33')]:_0x8362f3[_0xb68d('0x32')];if(!_0x1cd25c[_0xb68d('0x35')][_0xb68d('0x55')]('nolimit')){_0x1c278a['limit']=qs['limit'](_0x1cd25c[_0xb68d('0x35')][_0xb68d('0x21')]);_0x1c278a[_0xb68d('0x1f')]=qs[_0xb68d('0x1f')](_0x1cd25c[_0xb68d('0x35')][_0xb68d('0x1f')]);}_0x1c278a[_0xb68d('0x37')]=qs[_0xb68d('0x38')](_0x1cd25c[_0xb68d('0x35')][_0xb68d('0x38')]);_0x1c278a[_0xb68d('0x39')]=qs['filters'](_['pick'](_0x1cd25c[_0xb68d('0x35')],_0x8362f3['filters']));_0x1c278a[_0xb68d('0x39')][_0xb68d('0x53')]=_0x56ae25['id'];if(_0x1cd25c['query']['filter']){_0x1c278a[_0xb68d('0x39')]=_[_0xb68d('0x3c')](_0x1c278a['where'],{'$or':_[_0xb68d('0x29')](_0x1c278a[_0xb68d('0x33')],function(_0x423172){var _0x26cc59={};_0x26cc59[_0x423172]={'$like':'%'+_0x1cd25c['query'][_0xb68d('0x56')]+'%'};return _0x26cc59;})});}_0x1c278a=_[_0xb68d('0x3c')]({},_0x1c278a,_0x1cd25c[_0xb68d('0x3d')]);return db[_0xb68d('0xca')][_0xb68d('0x3e')]({'where':_0x1c278a['where']})[_0xb68d('0x11')](function(_0x3d06ed){_0x54b116[_0xb68d('0x3e')]=_0x3d06ed;if(_0x1cd25c[_0xb68d('0x35')][_0xb68d('0x3f')]){_0x1c278a[_0xb68d('0x40')]=[{'all':!![]}];}else{_0x1c278a['include']=[{'model':db[_0xb68d('0x7e')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xb68d('0x122'),'required':![]}];}return db[_0xb68d('0xca')]['findAll'](_0x1c278a);})['then'](function(_0x1c3498){_0x54b116['rows']=_0x1c3498;return _0x54b116;});}})['then'](respondWithFilteredResult(_0x479078,_0x1c278a))[_0xb68d('0x41')](handleError(_0x479078,null));};exports[_0xb68d('0x123')]=function(_0x5f0670,_0x415af3){return db[_0xb68d('0x2a')][_0xb68d('0x4c')]({'where':{'id':_0x5f0670[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x415af3,null))[_0xb68d('0x11')](function(_0x3a2b16){if(_0x3a2b16){return _0x3a2b16[_0xb68d('0x123')](_0x5f0670[_0xb68d('0x47')]['ids'],_[_0xb68d('0xe7')](_0x5f0670[_0xb68d('0x47')],[_0xb68d('0xe6'),'id'])||{})[_0xb68d('0xaa')](function(_0x547038){for(var _0x4c6e16=0x0;_0x4c6e16<_0x5f0670[_0xb68d('0x47')]['ids']['length'];_0x4c6e16+=0x1){socket['emit'](_0xb68d('0x124'),{'UserId':Number(_0x5f0670[_0xb68d('0x47')][_0xb68d('0xe6')][_0x4c6e16]),'ChatWebsiteId':Number(_0x5f0670[_0xb68d('0x43')]['id'])});}return _0x547038;});}})[_0xb68d('0x11')](respondWithResult(_0x415af3,null))[_0xb68d('0x41')](handleError(_0x415af3,null));};exports[_0xb68d('0x125')]=function(_0x22de4a,_0x527865){return db['ChatWebsite'][_0xb68d('0x4c')]({'where':{'id':_0x22de4a[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x527865,null))[_0xb68d('0x11')](function(_0x5d255f){if(_0x5d255f){return _0x5d255f['removeAgents'](_0x22de4a[_0xb68d('0x35')][_0xb68d('0xe6')])['then'](function(){if(_[_0xb68d('0x126')](_0x22de4a['query']['ids'])){for(var _0x41612c=0x0;_0x41612c<_0x22de4a[_0xb68d('0x35')][_0xb68d('0xe6')][_0xb68d('0x45')];_0x41612c+=0x1){socket[_0xb68d('0x127')](_0xb68d('0x128'),{'UserId':Number(_0x22de4a[_0xb68d('0x35')][_0xb68d('0xe6')][_0x41612c]),'ChatWebsiteId':Number(_0x22de4a[_0xb68d('0x43')]['id'])});}}else{socket[_0xb68d('0x127')](_0xb68d('0x128'),{'UserId':Number(_0x22de4a[_0xb68d('0x35')][_0xb68d('0xe6')]),'ChatWebsiteId':Number(_0x22de4a[_0xb68d('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x527865,null))[_0xb68d('0x41')](handleError(_0x527865,null));};exports[_0xb68d('0x129')]=function(_0x203a8d,_0x52a83a){var _0x28c453={};var _0x17723d={};var _0xc85c0;var _0x7931eb;return db['ChatWebsite'][_0xb68d('0x5b')]({'where':{'id':_0x203a8d[_0xb68d('0x43')]['id']}})[_0xb68d('0x11')](handleEntityNotFound(_0x52a83a,null))['then'](function(_0x2287a5){if(_0x2287a5){_0xc85c0=_0x2287a5;_0x17723d['model']=_[_0xb68d('0x30')](db['User']['rawAttributes']);_0x17723d['query']=_['keys'](_0x203a8d[_0xb68d('0x35')]);_0x17723d[_0xb68d('0x3b')]=_[_0xb68d('0x31')](_0x17723d[_0xb68d('0x32')],_0x17723d[_0xb68d('0x35')]);_0x28c453['attributes']=_[_0xb68d('0x31')](_0x17723d[_0xb68d('0x32')],qs[_0xb68d('0x34')](_0x203a8d[_0xb68d('0x35')]['fields']));_0x28c453['attributes']=_0x28c453[_0xb68d('0x33')][_0xb68d('0x45')]?_0x28c453[_0xb68d('0x33')]:_0x17723d[_0xb68d('0x32')];_0x28c453[_0xb68d('0x37')]=qs[_0xb68d('0x38')](_0x203a8d[_0xb68d('0x35')][_0xb68d('0x38')]);_0x28c453[_0xb68d('0x39')]=qs['filters'](_[_0xb68d('0x3a')](_0x203a8d[_0xb68d('0x35')],_0x17723d[_0xb68d('0x3b')]));if(_0x203a8d['query'][_0xb68d('0x56')]){_0x28c453[_0xb68d('0x39')]=_['merge'](_0x28c453[_0xb68d('0x39')],{'$or':_[_0xb68d('0x29')](_0x28c453['attributes'],function(_0x136cc2){var _0x466454={};_0x466454[_0x136cc2]={'$like':'%'+_0x203a8d[_0xb68d('0x35')][_0xb68d('0x56')]+'%'};return _0x466454;})});}_0x28c453=_['merge']({},_0x28c453,_0x203a8d[_0xb68d('0x3d')]);return _0xc85c0['getAgents'](_0x28c453);}})[_0xb68d('0x11')](function(_0x4476da){if(_0x4476da){_0x7931eb=_0x4476da[_0xb68d('0x45')];if(!_0x203a8d[_0xb68d('0x35')]['hasOwnProperty'](_0xb68d('0x36'))){_0x28c453['limit']=qs['limit'](_0x203a8d[_0xb68d('0x35')][_0xb68d('0x21')]);_0x28c453[_0xb68d('0x1f')]=qs[_0xb68d('0x1f')](_0x203a8d[_0xb68d('0x35')]['offset']);}return _0xc85c0[_0xb68d('0x129')](_0x28c453);}})[_0xb68d('0x11')](function(_0x185892){if(_0x185892){return _0x185892?{'count':_0x7931eb,'rows':_0x185892}:null;}})['then'](respondWithResult(_0x52a83a,null))['catch'](handleError(_0x52a83a,null));}; \ No newline at end of file +var _0xe25d=['options','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addDisposition','Disposition','getDispositions','findOne','fields','length','ChatWebsiteId','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','describe','Sequelize','difference','updatedAt','createdAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ContactId','ChatInteraction','messageId','interaction','created','autoclose','push','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','send','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','originalname','mimetype','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','Smtp','forwardOffline','getSmtpOptions','SendMail','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','files','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','includeAll','Contact','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','iftime\x20%s','interval','ONLINE','OFFLINE','inspect','getSnippet','Interval','Intervals','License','increment','all','some','readFileSync','address','origin','3.1.0','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','READ_COMMITTED','findAndCountAll','stack','finally','json','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','online','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','redis','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','offset','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe25d,0xe3));var _0xde25=function(_0x2bd69a,_0x3af3e2){_0x2bd69a=_0x2bd69a-0x0;var _0x19b972=_0xe25d[_0x2bd69a];return _0x19b972;};'use strict';var BPromise=require(_0xde25('0x0'));var Mustache=require(_0xde25('0x1'));var util=require(_0xde25('0x2'));var path=require(_0xde25('0x3'));var ejs=require(_0xde25('0x4'));var fs=require('fs');var fs_extra=require(_0xde25('0x5'));var _=require(_0xde25('0x6'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0xde25('0x7'));var logger=require(_0xde25('0x8'))('api');var config=require(_0xde25('0x9'));var url=require('url');var db=require('../../mysqldb')['db'];config[_0xde25('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xde25('0xb'))(new Redis(config[_0xde25('0xa')]));require(_0xde25('0xc'))['register'](socket);var htmlToText=require(_0xde25('0xd'));var jayson=require(_0xde25('0xe'));var client=jayson[_0xde25('0xf')][_0xde25('0x10')]({'port':0x232c});var client9002=jayson[_0xde25('0xf')][_0xde25('0x10')]({'port':0x232a});var client9003=jayson[_0xde25('0xf')][_0xde25('0x10')]({'port':0x232b});var client9001=jayson[_0xde25('0xf')][_0xde25('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x17f234,_0x3653fe,_0x592b75,_0x2cba7f){return new BPromise(function(_0xc873e5,_0x14c7a6){var _0x43a998=_0x2cba7f||client;return _0x43a998[_0xde25('0x11')](_0x17f234,_0x592b75)[_0xde25('0x12')](function(_0x5bdde7){logger[_0xde25('0x13')](_0xde25('0x14'),_0x3653fe,_0xde25('0x15'));logger[_0xde25('0x16')](_0xde25('0x17'),_0x3653fe,'request\x20sent',JSON[_0xde25('0x18')](_0x5bdde7));if(_0x5bdde7[_0xde25('0x19')]){if(_0x5bdde7[_0xde25('0x19')][_0xde25('0x1a')]===0x1f4){logger[_0xde25('0x19')](_0xde25('0x14'),_0x3653fe,_0x5bdde7[_0xde25('0x19')][_0xde25('0x1b')]);return _0x14c7a6(_0x5bdde7[_0xde25('0x19')][_0xde25('0x1b')]);}logger[_0xde25('0x19')](_0xde25('0x14'),_0x3653fe,_0x5bdde7['error']['message']);return _0xc873e5(_0x5bdde7['error'][_0xde25('0x1b')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3653fe,_0xde25('0x15'));_0xc873e5(_0x5bdde7[_0xde25('0x1c')][_0xde25('0x1b')]);}})[_0xde25('0x1d')](function(_0x56a72c){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3653fe,_0x56a72c);_0x14c7a6(_0x56a72c);});});}function respondWithStatusCode(_0x1df506,_0x476bfa){_0x476bfa=_0x476bfa||0xcc;return function(_0x4346ce){if(_0x4346ce){return _0x1df506[_0xde25('0x1e')](_0x476bfa);}return _0x1df506['status'](_0x476bfa)[_0xde25('0x1f')]();};}function respondWithResult(_0x353f0b,_0x285fea){_0x285fea=_0x285fea||0xc8;return function(_0x40a58c){if(_0x40a58c){return _0x353f0b[_0xde25('0x20')](_0x285fea)['json'](_0x40a58c);}};}function respondWithFilteredResult(_0x38f262,_0x3a9a78){return function(_0x2d7da3){if(_0x2d7da3){var _0x5c65b3=typeof _0x3a9a78['offset']===_0xde25('0x21')&&typeof _0x3a9a78['limit']==='undefined';var _0x4df498=_0x2d7da3['count'];var _0x1e7711=_0x5c65b3?0x0:_0x3a9a78[_0xde25('0x22')];var _0x46c6a9=_0x5c65b3?_0x2d7da3[_0xde25('0x23')]:_0x3a9a78['offset']+_0x3a9a78['limit'];var _0x381a51;if(_0x46c6a9>=_0x4df498){_0x46c6a9=_0x4df498;_0x381a51=0xc8;}else{_0x381a51=0xce;}_0x38f262[_0xde25('0x20')](_0x381a51);return _0x38f262[_0xde25('0x24')](_0xde25('0x25'),_0x1e7711+'-'+_0x46c6a9+'/'+_0x4df498)['json'](_0x2d7da3);}return null;};}function saveUpdates(_0x481a9b){return function(_0x5b21bd){if(_0x5b21bd){return _0x5b21bd['update'](_0x481a9b)[_0xde25('0x12')](function(_0x3574cb){return _0x3574cb;});}return null;};}function removeEntity(_0x585624){return function(_0x5cb0e2){if(_0x5cb0e2){return _0x5cb0e2[_0xde25('0x26')]()[_0xde25('0x12')](function(){var _0xe8a0b9=_0x5cb0e2[_0xde25('0x27')]({'plain':!![]});var _0x355a8e=_0xde25('0x28');return db[_0xde25('0x29')][_0xde25('0x26')]({'where':{'type':_0x355a8e,'resourceId':_0xe8a0b9['id']}})[_0xde25('0x12')](function(){return _0x5cb0e2;});})[_0xde25('0x12')](function(){_0x585624[_0xde25('0x20')](0xcc)[_0xde25('0x1f')]();});}};}function handleEntityNotFound(_0xb0981){return function(_0x428def){if(!_0x428def){_0xb0981[_0xde25('0x1e')](0x194);}return _0x428def;};}function handleError(_0xad7886,_0x244632){_0x244632=_0x244632||0x1f4;return function(_0xaa84c8){logger[_0xde25('0x19')](_0xaa84c8['stack']);if(_0xaa84c8['name']){delete _0xaa84c8[_0xde25('0x2a')];}_0xad7886[_0xde25('0x20')](_0x244632)['send'](_0xaa84c8);};}exports[_0xde25('0x2b')]=function(_0x55ee5a,_0x5a7878){var _0x595528={'include':[{'model':db[_0xde25('0x2c')],'as':_0xde25('0x2d')}]},_0x2bb077={},_0x55b038={'count':0x0,'rows':[]};var _0x4e86f9=_[_0xde25('0x2e')](db[_0xde25('0x2f')][_0xde25('0x30')],function(_0x4f4068){return{'name':_0x4f4068[_0xde25('0x31')],'type':_0x4f4068[_0xde25('0x32')][_0xde25('0x33')]};});_0x2bb077['model']=_[_0xde25('0x2e')](_0x4e86f9,_0xde25('0x2a'));_0x2bb077[_0xde25('0x34')]=_[_0xde25('0x35')](_0x55ee5a[_0xde25('0x34')]);_0x2bb077['filters']=_['intersection'](_0x2bb077[_0xde25('0x36')],_0x2bb077[_0xde25('0x34')]);_0x595528[_0xde25('0x37')]=_[_0xde25('0x38')](_0x2bb077[_0xde25('0x36')],qs['fields'](_0x55ee5a['query']['fields']));_0x595528[_0xde25('0x37')]=_0x595528['attributes']['length']?_0x595528[_0xde25('0x37')]:_0x2bb077[_0xde25('0x36')];if(!_0x55ee5a[_0xde25('0x34')][_0xde25('0x39')](_0xde25('0x3a'))){_0x595528[_0xde25('0x3b')]=qs[_0xde25('0x3b')](_0x55ee5a[_0xde25('0x34')]['limit']);_0x595528[_0xde25('0x22')]=qs[_0xde25('0x22')](_0x55ee5a[_0xde25('0x34')][_0xde25('0x22')]);}_0x595528[_0xde25('0x3c')]=qs[_0xde25('0x3d')](_0x55ee5a['query'][_0xde25('0x3d')]);_0x595528[_0xde25('0x3e')]=qs[_0xde25('0x3f')](_[_0xde25('0x40')](_0x55ee5a['query'],_0x2bb077[_0xde25('0x3f')]),_0x4e86f9);if(_0x55ee5a[_0xde25('0x34')][_0xde25('0x41')]){_0x595528[_0xde25('0x3e')]=_[_0xde25('0x42')](_0x595528[_0xde25('0x3e')],{'$or':_[_0xde25('0x2e')](_0x4e86f9,function(_0x1c82e3){if(_0x1c82e3[_0xde25('0x32')]!=='VIRTUAL'){var _0x2d8716={};_0x2d8716[_0x1c82e3[_0xde25('0x2a')]]={'$like':'%'+_0x55ee5a[_0xde25('0x34')]['filter']+'%'};return _0x2d8716;}})});}_0x595528=_[_0xde25('0x42')]({},_0x595528,_0x55ee5a[_0xde25('0x43')]);var _0x11e32c={'where':_0x595528[_0xde25('0x3e')]};return db[_0xde25('0x2f')][_0xde25('0x23')](_0x11e32c)[_0xde25('0x12')](function(_0x17fd01){_0x55b038[_0xde25('0x23')]=_0x17fd01;if(_0x55ee5a['query']['includeAll']){_0x595528[_0xde25('0x44')]=[{'all':!![]}];}return db[_0xde25('0x2f')][_0xde25('0x45')](_0x595528);})[_0xde25('0x12')](function(_0x105880){_0x55b038[_0xde25('0x46')]=_0x105880;return _0x55b038;})[_0xde25('0x12')](respondWithFilteredResult(_0x5a7878,_0x595528))['catch'](handleError(_0x5a7878,null));};exports[_0xde25('0x47')]=function(_0x10addb,_0x4d8629){var _0x2086fa={'raw':![],'where':{'id':_0x10addb[_0xde25('0x48')]['id']},'include':[{'model':db[_0xde25('0x2c')],'as':_0xde25('0x2d')}]},_0x6cf8f5={};_0x6cf8f5[_0xde25('0x36')]=_[_0xde25('0x35')](db[_0xde25('0x2f')][_0xde25('0x30')]);_0x6cf8f5[_0xde25('0x34')]=_[_0xde25('0x35')](_0x10addb['query']);_0x6cf8f5[_0xde25('0x3f')]=_[_0xde25('0x38')](_0x6cf8f5['model'],_0x6cf8f5[_0xde25('0x34')]);_0x2086fa[_0xde25('0x37')]=_['intersection'](_0x6cf8f5['model'],qs['fields'](_0x10addb[_0xde25('0x34')]['fields']));_0x2086fa['attributes']=_0x2086fa['attributes']['length']?_0x2086fa['attributes']:_0x6cf8f5[_0xde25('0x36')];if(_0x10addb['query']['includeAll']){_0x2086fa[_0xde25('0x44')]=[{'all':!![]}];}_0x2086fa=_[_0xde25('0x42')]({},_0x2086fa,_0x10addb[_0xde25('0x43')]);return db[_0xde25('0x2f')][_0xde25('0x49')](_0x2086fa)[_0xde25('0x12')](handleEntityNotFound(_0x4d8629,null))[_0xde25('0x12')](respondWithResult(_0x4d8629,null))[_0xde25('0x1d')](handleError(_0x4d8629,null));};exports[_0xde25('0x4a')]=function(_0x6e8203,_0x2357b2){return db[_0xde25('0x2f')][_0xde25('0x4a')](_0x6e8203['body'],{})[_0xde25('0x12')](function(_0x849023){var _0x42f506=_0x6e8203[_0xde25('0x4b')][_0xde25('0x27')]({'plain':!![]});if(!_0x42f506)throw new Error(_0xde25('0x4c'));if(_0x42f506[_0xde25('0x4d')]===_0xde25('0x4b')){var _0x165460=_0x849023[_0xde25('0x27')]({'plain':!![]});var _0x2fff44=_0xde25('0x28');return db['UserProfileSection'][_0xde25('0x49')]({'where':{'name':_0x2fff44,'userProfileId':_0x42f506[_0xde25('0x4e')]},'raw':!![]})['then'](function(_0x398eb5){if(_0x398eb5&&_0x398eb5[_0xde25('0x4f')]===0x0){return db[_0xde25('0x29')][_0xde25('0x4a')]({'name':_0x165460[_0xde25('0x2a')],'resourceId':_0x165460['id'],'type':_0x398eb5[_0xde25('0x2a')],'sectionId':_0x398eb5['id']},{})[_0xde25('0x12')](function(){return _0x849023;});}else{return _0x849023;}})['catch'](function(_0x38af10){logger[_0xde25('0x19')](_0xde25('0x50'),_0x38af10);throw _0x38af10;});}return _0x849023;})[_0xde25('0x12')](respondWithResult(_0x2357b2,0xc9))[_0xde25('0x1d')](handleError(_0x2357b2,null));};exports[_0xde25('0x51')]=function(_0x20c14a,_0x14fe93){if(_0x20c14a['body']['id']){delete _0x20c14a[_0xde25('0x52')]['id'];}return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x20c14a[_0xde25('0x48')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x14fe93,null))[_0xde25('0x12')](saveUpdates(_0x20c14a['body'],null))[_0xde25('0x12')](respondWithResult(_0x14fe93,null))[_0xde25('0x1d')](handleError(_0x14fe93,null));};exports[_0xde25('0x26')]=function(_0x511690,_0x2f1ec8){return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x511690[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x2f1ec8,null))[_0xde25('0x12')](removeEntity(_0x2f1ec8,null))[_0xde25('0x1d')](handleError(_0x2f1ec8,null));};exports['describe']=function(_0x12e6f0,_0x5721a7){return db['ChatWebsite']['describe']()['then'](respondWithResult(_0x5721a7,null))[_0xde25('0x1d')](handleError(_0x5721a7,null));};exports[_0xde25('0x53')]=function(_0x52a9f3,_0x2a1d88){if(_0x52a9f3[_0xde25('0x52')]['id']){delete _0x52a9f3[_0xde25('0x52')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x52a9f3[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x2a1d88,null))[_0xde25('0x12')](function(_0x3a05e8){if(_0x3a05e8){_0x52a9f3[_0xde25('0x52')]['ChatWebsiteId']=_0x3a05e8['id'];return db[_0xde25('0x54')]['create'](_0x52a9f3['body']);}})[_0xde25('0x12')](respondWithResult(_0x2a1d88,null))[_0xde25('0x1d')](handleError(_0x2a1d88,null));};exports[_0xde25('0x55')]=function(_0x267102,_0x58515d){var _0x5b4175={'raw':![],'where':{}};var _0xf563e1={};var _0x240933={'count':0x0,'rows':[]};return db[_0xde25('0x2f')][_0xde25('0x56')]({'where':{'id':_0x267102[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x58515d,null))[_0xde25('0x12')](function(_0x1ed3e8){if(_0x1ed3e8){_0xf563e1['model']=_[_0xde25('0x35')](db[_0xde25('0x54')][_0xde25('0x30')]);_0xf563e1[_0xde25('0x34')]=_['keys'](_0x267102[_0xde25('0x34')]);_0xf563e1[_0xde25('0x3f')]=_[_0xde25('0x38')](_0xf563e1[_0xde25('0x36')],_0xf563e1['query']);_0x5b4175[_0xde25('0x37')]=_['intersection'](_0xf563e1[_0xde25('0x36')],qs[_0xde25('0x57')](_0x267102[_0xde25('0x34')][_0xde25('0x57')]));_0x5b4175['attributes']=_0x5b4175[_0xde25('0x37')][_0xde25('0x58')]?_0x5b4175[_0xde25('0x37')]:_0xf563e1[_0xde25('0x36')];if(!_0x267102[_0xde25('0x34')][_0xde25('0x39')]('nolimit')){_0x5b4175[_0xde25('0x3b')]=qs[_0xde25('0x3b')](_0x267102[_0xde25('0x34')][_0xde25('0x3b')]);_0x5b4175[_0xde25('0x22')]=qs[_0xde25('0x22')](_0x267102[_0xde25('0x34')][_0xde25('0x22')]);}_0x5b4175['order']=qs[_0xde25('0x3d')](_0x267102['query'][_0xde25('0x3d')]);_0x5b4175[_0xde25('0x3e')]=qs[_0xde25('0x3f')](_[_0xde25('0x40')](_0x267102[_0xde25('0x34')],_0xf563e1[_0xde25('0x3f')]));_0x5b4175[_0xde25('0x3e')][_0xde25('0x59')]=_0x1ed3e8['id'];if(_0x267102['query'][_0xde25('0x41')]){_0x5b4175[_0xde25('0x3e')]=_[_0xde25('0x42')](_0x5b4175[_0xde25('0x3e')],{'$or':_['map'](_0x5b4175[_0xde25('0x37')],function(_0x10ce56){var _0x2a1c95={};_0x2a1c95[_0x10ce56]={'$like':'%'+_0x267102[_0xde25('0x34')][_0xde25('0x41')]+'%'};return _0x2a1c95;})});}_0x5b4175=_['merge']({},_0x5b4175,_0x267102[_0xde25('0x43')]);return db['Disposition'][_0xde25('0x23')]({'where':_0x5b4175[_0xde25('0x3e')]})[_0xde25('0x12')](function(_0x205ce0){_0x240933['count']=_0x205ce0;if(_0x267102[_0xde25('0x34')]['includeAll']){_0x5b4175[_0xde25('0x44')]=[{'all':!![]}];}return db[_0xde25('0x54')][_0xde25('0x45')](_0x5b4175);})[_0xde25('0x12')](function(_0x3d2bfa){_0x240933[_0xde25('0x46')]=_0x3d2bfa;return _0x240933;});}})[_0xde25('0x12')](respondWithFilteredResult(_0x58515d,_0x5b4175))['catch'](handleError(_0x58515d,null));};exports['removeDispositions']=function(_0x4c9ec3,_0x33edf7){return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x4c9ec3['params']['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x33edf7,null))[_0xde25('0x12')](function(_0x3a9767){if(_0x3a9767){return _0x3a9767['removeDispositions'](_0x4c9ec3[_0xde25('0x34')][_0xde25('0x5a')]);}})[_0xde25('0x12')](respondWithStatusCode(_0x33edf7,null))[_0xde25('0x1d')](handleError(_0x33edf7,null));};exports[_0xde25('0x5b')]=function(_0x4ff59c,_0x577a5e){if(_0x4ff59c['body']['id']){delete _0x4ff59c[_0xde25('0x52')]['id'];}return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x4ff59c[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x577a5e,null))[_0xde25('0x12')](function(_0x540890){if(_0x540890){_0x4ff59c[_0xde25('0x52')][_0xde25('0x59')]=_0x540890['id'];return db[_0xde25('0x5c')]['create'](_0x4ff59c[_0xde25('0x52')]);}})['then'](respondWithResult(_0x577a5e,null))[_0xde25('0x1d')](handleError(_0x577a5e,null));};exports[_0xde25('0x5d')]=function(_0x188e93,_0x135541){var _0x4cf7ed={'raw':![],'where':{}};var _0x43e4ef={};var _0x1b74b5={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x188e93[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x135541,null))['then'](function(_0x1fc402){if(_0x1fc402){_0x43e4ef[_0xde25('0x36')]=_[_0xde25('0x35')](db['CannedAnswer'][_0xde25('0x30')]);_0x43e4ef[_0xde25('0x34')]=_[_0xde25('0x35')](_0x188e93[_0xde25('0x34')]);_0x43e4ef['filters']=_[_0xde25('0x38')](_0x43e4ef[_0xde25('0x36')],_0x43e4ef[_0xde25('0x34')]);_0x4cf7ed[_0xde25('0x37')]=_[_0xde25('0x38')](_0x43e4ef[_0xde25('0x36')],qs['fields'](_0x188e93['query'][_0xde25('0x57')]));_0x4cf7ed[_0xde25('0x37')]=_0x4cf7ed['attributes'][_0xde25('0x58')]?_0x4cf7ed['attributes']:_0x43e4ef['model'];if(!_0x188e93[_0xde25('0x34')][_0xde25('0x39')](_0xde25('0x3a'))){_0x4cf7ed[_0xde25('0x3b')]=qs[_0xde25('0x3b')](_0x188e93[_0xde25('0x34')][_0xde25('0x3b')]);_0x4cf7ed[_0xde25('0x22')]=qs[_0xde25('0x22')](_0x188e93[_0xde25('0x34')][_0xde25('0x22')]);}_0x4cf7ed[_0xde25('0x3c')]=qs[_0xde25('0x3d')](_0x188e93[_0xde25('0x34')][_0xde25('0x3d')]);_0x4cf7ed[_0xde25('0x3e')]=qs[_0xde25('0x3f')](_[_0xde25('0x40')](_0x188e93[_0xde25('0x34')],_0x43e4ef['filters']));_0x4cf7ed['where'][_0xde25('0x59')]=_0x1fc402['id'];if(_0x188e93[_0xde25('0x34')][_0xde25('0x41')]){_0x4cf7ed[_0xde25('0x3e')]=_[_0xde25('0x42')](_0x4cf7ed[_0xde25('0x3e')],{'$or':_[_0xde25('0x2e')](_0x4cf7ed[_0xde25('0x37')],function(_0x296624){var _0x4cf0f9={};_0x4cf0f9[_0x296624]={'$like':'%'+_0x188e93[_0xde25('0x34')]['filter']+'%'};return _0x4cf0f9;})});}_0x4cf7ed=_[_0xde25('0x42')]({},_0x4cf7ed,_0x188e93[_0xde25('0x43')]);return db['CannedAnswer'][_0xde25('0x23')]({'where':_0x4cf7ed[_0xde25('0x3e')]})[_0xde25('0x12')](function(_0x3020b4){_0x1b74b5[_0xde25('0x23')]=_0x3020b4;if(_0x188e93[_0xde25('0x34')]['includeAll']){_0x4cf7ed[_0xde25('0x44')]=[{'all':!![]}];}return db[_0xde25('0x5c')][_0xde25('0x45')](_0x4cf7ed);})[_0xde25('0x12')](function(_0x3a4cac){_0x1b74b5[_0xde25('0x46')]=_0x3a4cac;return _0x1b74b5;});}})['then'](respondWithFilteredResult(_0x135541,_0x4cf7ed))['catch'](handleError(_0x135541,null));};exports['removeAnswers']=function(_0x4cdf0c,_0x142132){return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x4cdf0c['params']['id']}})['then'](handleEntityNotFound(_0x142132,null))[_0xde25('0x12')](function(_0x1650e5){if(_0x1650e5){return _0x1650e5[_0xde25('0x5e')](_0x4cdf0c['query'][_0xde25('0x5a')]);}})[_0xde25('0x12')](respondWithStatusCode(_0x142132,null))['catch'](handleError(_0x142132,null));};exports[_0xde25('0x5f')]=function(_0x36cc35,_0x27f641){_0x36cc35[_0xde25('0x52')]['sitepic']=_0x36cc35[_0xde25('0x60')][_0xde25('0x61')];return db[_0xde25('0x2f')]['find']({'where':{'id':_0x36cc35['params']['id']}})['then'](handleEntityNotFound(_0x27f641,null))[_0xde25('0x12')](saveUpdates(_0x36cc35[_0xde25('0x52')],null))[_0xde25('0x12')](respondWithResult(_0x27f641,null))['catch'](handleError(_0x27f641,null));};exports[_0xde25('0x62')]=function(_0xa854c4,_0x173f62){_0xa854c4['body'][_0xde25('0x63')]=_0xa854c4[_0xde25('0x60')][_0xde25('0x61')];return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0xa854c4['params']['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x173f62,null))['then'](saveUpdates(_0xa854c4[_0xde25('0x52')],null))['then'](respondWithResult(_0x173f62,null))['catch'](handleError(_0x173f62,null));};exports[_0xde25('0x64')]=function(_0x5d99eb,_0x5d1ff0){_0x5d99eb[_0xde25('0x52')][_0xde25('0x65')]=_0x5d99eb[_0xde25('0x60')]['filename'];return db['ChatWebsite'][_0xde25('0x49')]({'where':{'id':_0x5d99eb[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x5d1ff0,null))[_0xde25('0x12')](saveUpdates(_0x5d99eb['body'],null))[_0xde25('0x12')](respondWithResult(_0x5d1ff0,null))['catch'](handleError(_0x5d1ff0,null));};exports[_0xde25('0x66')]=function(_0x1ea339,_0x29c1ef){_0x1ea339[_0xde25('0x52')][_0xde25('0x67')]=_0x1ea339[_0xde25('0x60')][_0xde25('0x61')];return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x1ea339['params']['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x29c1ef,null))[_0xde25('0x12')](saveUpdates(_0x1ea339[_0xde25('0x52')],null))[_0xde25('0x12')](respondWithResult(_0x29c1ef,null))[_0xde25('0x1d')](handleError(_0x29c1ef,null));};exports[_0xde25('0x68')]=function(_0x3a4beb,_0x1c1910){var _0x464586=path[_0xde25('0x69')](config[_0xde25('0x6a')],_0xde25('0x6b'));var _0x55313f={'where':{'id':_0x3a4beb['params']['id']},'attributes':['id',_0xde25('0x6c')],'raw':!![]};var _0x4487e3=![];return require('../../config/license/util')[_0xde25('0x6d')]()[_0xde25('0x12')](function(_0x5ab104){if(_0x5ab104){_0x4487e3=_0x5ab104[_0xde25('0x6e')];}})[_0xde25('0x12')](function(){return db['ChatWebsite'][_0xde25('0x49')](_0x55313f);})[_0xde25('0x12')](handleEntityNotFound(_0x1c1910,null))[_0xde25('0x12')](function(_0x21ba49){if(_0x21ba49){if(!_[_0xde25('0x6f')](_0x21ba49['sitepic'])){if(fs[_0xde25('0x70')](path[_0xde25('0x69')](config['root'],_0xde25('0x71'),_0x21ba49[_0xde25('0x6c')]))&&_0x4487e3){_0x464586=path['join'](config[_0xde25('0x6a')],_0xde25('0x71'),_0x21ba49[_0xde25('0x6c')]);}}return _0x1c1910[_0xde25('0x72')](_0x464586);}})[_0xde25('0x1d')](handleError(_0x1c1910,null));};exports[_0xde25('0x73')]=function(_0x24dec2,_0x23266e){var _0x267ca4=path['join'](config[_0xde25('0x6a')],'server/files/images/avatars/default_avatar.png');var _0x488069={'where':{'id':_0x24dec2[_0xde25('0x48')]['id']},'attributes':['id',_0xde25('0x63')],'raw':!![]};return db[_0xde25('0x2f')][_0xde25('0x49')](_0x488069)[_0xde25('0x12')](handleEntityNotFound(_0x23266e,null))['then'](function(_0x20487f){if(_0x20487f){if(!_[_0xde25('0x6f')](_0x20487f[_0xde25('0x63')])){if(fs['existsSync'](path[_0xde25('0x69')](config['root'],'server/files/images/avatars/',_0x20487f['agentAvatar']))){_0x267ca4=path[_0xde25('0x69')](config[_0xde25('0x6a')],'server/files/images/avatars/',_0x20487f[_0xde25('0x63')]);}}return _0x23266e[_0xde25('0x72')](_0x267ca4);}})[_0xde25('0x1d')](handleError(_0x23266e,null));};exports[_0xde25('0x74')]=function(_0x5c6d1a,_0x495e3e){var _0x41da2b=path[_0xde25('0x69')](config[_0xde25('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x48df44={'where':{'id':_0x5c6d1a[_0xde25('0x48')]['id']},'attributes':['id','customerAvatar',_0xde25('0x75')],'raw':!![]};return db[_0xde25('0x2f')][_0xde25('0x49')](_0x48df44)[_0xde25('0x12')](handleEntityNotFound(_0x495e3e,null))['then'](function(_0x46fd11){if(_0x46fd11){if(!_[_0xde25('0x6f')](_0x46fd11[_0xde25('0x65')])){if(fs[_0xde25('0x70')](path[_0xde25('0x69')](config[_0xde25('0x6a')],_0xde25('0x76'),_0x46fd11[_0xde25('0x65')]))&&_0x46fd11[_0xde25('0x75')]){_0x41da2b=path[_0xde25('0x69')](config[_0xde25('0x6a')],'server/files/images/avatars/',_0x46fd11['customerAvatar']);}}return _0x495e3e[_0xde25('0x72')](_0x41da2b);}})[_0xde25('0x1d')](handleError(_0x495e3e,null));};exports[_0xde25('0x77')]=function(_0x43e5f2,_0x52ae99){var _0x5acc64=path[_0xde25('0x69')](config['root'],_0xde25('0x78'));var _0x1de53d={'where':{'id':_0x43e5f2[_0xde25('0x48')]['id']},'attributes':['id',_0xde25('0x67')],'raw':!![]};return db[_0xde25('0x2f')][_0xde25('0x49')](_0x1de53d)[_0xde25('0x12')](handleEntityNotFound(_0x52ae99,null))[_0xde25('0x12')](function(_0x3a614c){if(_0x3a614c){if(!_[_0xde25('0x6f')](_0x3a614c[_0xde25('0x67')])){if(fs['existsSync'](path[_0xde25('0x69')](config[_0xde25('0x6a')],_0xde25('0x76'),_0x3a614c[_0xde25('0x67')]))){_0x5acc64=path[_0xde25('0x69')](config['root'],_0xde25('0x76'),_0x3a614c[_0xde25('0x67')]);}}return _0x52ae99['download'](_0x5acc64);}})[_0xde25('0x1d')](handleError(_0x52ae99,null));};exports[_0xde25('0x79')]=function(_0x1fcf60,_0x34b42a){var _0x25b12c=require(_0xde25('0x7a'));var _0xdcd61c=new _0x25b12c();var _0x2b9105=_0xdcd61c[_0xde25('0x7b')](_0x1fcf60[_0xde25('0x7c')][_0xde25('0x7d')])['getResult']();var _0x48c69c={'body':_0x1fcf60['body'],'channel':_0xde25('0x7e')};var _0x560d07=[];var _0x1e8b86=[];var _0x339763={};var _0x1d1d67=![];return db[_0xde25('0x7f')][_0xde25('0x80')]()[_0xde25('0x12')](function(_0x1e7a2f){if(!_0x1e7a2f){throw new db[(_0xde25('0x81'))]['ValidationError']('no\x20available\x20attributes');}_0x560d07=_[_0xde25('0x82')](_[_0xde25('0x35')](_0x1e7a2f),['createdAt',_0xde25('0x83')]);_0x1e8b86=_[_0xde25('0x82')](_[_0xde25('0x35')](_0x1e7a2f),[_0xde25('0x84'),_0xde25('0x83'),_0xde25('0x85'),_0xde25('0x86')]);if(_0x1fcf60[_0xde25('0x52')]['id']){delete _0x1fcf60[_0xde25('0x52')]['id'];}if(_[_0xde25('0x6f')](_0x1fcf60[_0xde25('0x52')][_0xde25('0x87')])){throw new db['Sequelize'][(_0xde25('0x88'))](_0xde25('0x89'));}if(_[_0xde25('0x6f')](_0x1fcf60['body'][_0xde25('0x52')])||_0x1fcf60[_0xde25('0x52')][_0xde25('0x52')]===''){throw new db['Sequelize'][(_0xde25('0x88'))](_0xde25('0x8a'));}if(_['isNil'](_0x1fcf60[_0xde25('0x52')]['mapKey'])){throw new db['Sequelize'][(_0xde25('0x88'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e8b86);}if(!_[_0xde25('0x8b')](_0x1e8b86,_0x1fcf60[_0xde25('0x52')]['mapKey'])){throw new db[(_0xde25('0x81'))][(_0xde25('0x88'))](_0xde25('0x8c')+_0x1e8b86);}_0x339763[_0x1fcf60[_0xde25('0x52')][_0xde25('0x8d')]]=_0x1fcf60['body']['from'];})['then'](function(){return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x1fcf60[_0xde25('0x48')]['id']},'include':[{'model':db[_0xde25('0x8e')],'as':_0xde25('0x8f'),'include':[{'model':db[_0xde25('0x7f')],'as':_0xde25('0x90'),'where':_0x339763,'limit':0x1,'order':[[_0xde25('0x83'),'DESC']]}]},{'model':db[_0xde25('0x91')],'as':_0xde25('0x92')}]});})['then'](handleEntityNotFound(_0x34b42a,null))[_0xde25('0x12')](function(_0x4c28bf){if(_0x4c28bf&&_0x4c28bf[_0xde25('0x8f')]){_0x48c69c[_0xde25('0x93')]=_0x4c28bf;_0x48c69c[_0xde25('0x94')]=_0x4c28bf['Applications'];_0x48c69c[_0xde25('0x95')]=_0x4c28bf['List'];_0x48c69c[_0xde25('0x94')]=_[_0xde25('0x96')](_0x48c69c[_0xde25('0x94')],[_0xde25('0x97')],[_0xde25('0x98')]);if(_0x48c69c[_0xde25('0x93')][_0xde25('0x92')]){delete _0x48c69c[_0xde25('0x93')][_0xde25('0x92')];}if(_0x48c69c['account'][_0xde25('0x8f')]&&_0x48c69c[_0xde25('0x93')][_0xde25('0x8f')][_0xde25('0x90')][_0xde25('0x58')]){return _0x48c69c[_0xde25('0x93')][_0xde25('0x8f')][_0xde25('0x90')][0x0];}var _0x32fb02=_[_0xde25('0x99')](_0x1fcf60[_0xde25('0x52')],{'firstName':_0x1fcf60['body'][_0xde25('0x87')],'ListId':_0x4c28bf[_0xde25('0x86')]});_0x32fb02[_0x1fcf60[_0xde25('0x52')][_0xde25('0x8d')]]=_0x1fcf60[_0xde25('0x52')][_0xde25('0x87')];return db[_0xde25('0x7f')]['create'](_0x32fb02,{'fields':_0x560d07,'raw':!![]});}})[_0xde25('0x12')](handleEntityNotFound(_0x34b42a,null))['then'](function(_0x3d7f10){_0x48c69c[_0xde25('0x9a')]=_0x3d7f10;var _0x525ed5=_0x1fcf60['body'][_0xde25('0x9b')];if(_0x1fcf60[_0xde25('0x7c')][_0xde25('0x9c')]){_0x525ed5=_0x1fcf60[_0xde25('0x7c')][_0xde25('0x9c')];}else if(_0x1fcf60[_0xde25('0x7c')]['x-forwarded-for']){_0x525ed5=_[_0xde25('0x9d')](_0x1fcf60[_0xde25('0x7c')][_0xde25('0x9e')][_0xde25('0x9f')](','));}if(_0x3d7f10){var _0x3290cc={'ContactId':_0x3d7f10['id'],'ChatWebsiteId':_0x1fcf60['params']['id'],'from':(_0x3d7f10[_0xde25('0xa0')]||'')+'\x20'+(_0x3d7f10[_0xde25('0xa1')]||''),'customerIp':_0x525ed5,'customerPort':_0x1fcf60[_0xde25('0x7c')][_0xde25('0xa2')]?_0x1fcf60[_0xde25('0x7c')]['x-real-port']:null,'referer':_0x1fcf60[_0xde25('0x52')][_0xde25('0xa3')],'browserName':_0x2b9105[_0xde25('0xa4')][_0xde25('0x2a')]&&_0x2b9105[_0xde25('0xa4')][_0xde25('0xa5')]?util[_0xde25('0xa6')](_0xde25('0xa7'),_0x2b9105[_0xde25('0xa4')]['name'],_0x2b9105[_0xde25('0xa4')][_0xde25('0xa5')]):_0xde25('0xa8'),'browserVersion':_0x2b9105[_0xde25('0xa4')][_0xde25('0xa5')]||_0xde25('0xa8'),'osName':util[_0xde25('0xa6')](_0xde25('0xa7'),_0x2b9105['os'][_0xde25('0x2a')],_0x2b9105['os'][_0xde25('0xa5')]),'osVersion':_0x2b9105['os'][_0xde25('0xa5')],'deviceModel':_0x2b9105[_0xde25('0xa9')][_0xde25('0x36')]&&_0x2b9105[_0xde25('0xa9')][_0xde25('0xaa')]?util[_0xde25('0xa6')](_0xde25('0xab'),_0x2b9105[_0xde25('0xa9')]['model'],_0x2b9105[_0xde25('0xa9')][_0xde25('0xaa')],_0x2b9105[_0xde25('0xa9')]['type']):null,'deviceVendor':_0x2b9105[_0xde25('0xa9')][_0xde25('0xaa')],'deviceType':_0x2b9105[_0xde25('0xa9')][_0xde25('0x32')],'formData':JSON[_0xde25('0x18')](_0x1fcf60[_0xde25('0x52')])};var _0x309dc8={'ChatWebsiteId':_0x1fcf60['params']['id'],'closed':![]};if(_0x1fcf60[_0xde25('0x52')][_0xde25('0xac')]){_0x309dc8['threadId']=_0x1fcf60['body'][_0xde25('0xac')];return db['ChatInteraction'][_0xde25('0x49')]({'where':_0x309dc8})['then'](function(_0x19edd4){if(_0x19edd4){return[_0x19edd4,![]];}_0x3290cc[_0xde25('0xac')]=_0x1fcf60[_0xde25('0x52')]['threadId'];_0x3290cc[_0xde25('0xad')]=_0x1fcf60[_0xde25('0x52')][_0xde25('0xad')];return db['ChatInteraction'][_0xde25('0x4a')](_0x3290cc)['then'](function(_0x259a19){return[_0x259a19,!![]];});});}_0x309dc8[_0xde25('0xae')]=_0x3d7f10['id'];if(_0x1fcf60[_0xde25('0x52')]['interaction']&&_0x1fcf60['body']['interaction']['id']){_0x309dc8['id']=_0x1fcf60['body']['interaction']['id'];return db[_0xde25('0xaf')]['find']({'where':_0x309dc8})['then'](function(_0x51b07d){if(_0x51b07d){return[_0x51b07d,![]];}return db['ChatInteraction']['create'](_0x3290cc)[_0xde25('0x12')](function(_0x10ed1e){return[_0x10ed1e,!![]];});});}return db[_0xde25('0xaf')]['create'](_0x3290cc)['then'](function(_0x3adbc3){return[_0x3adbc3,!![]];});}})['spread'](function(_0x1eca1a,_0x36a466){if(_0x1eca1a){_0x1d1d67=_0x36a466;if(!_0x36a466){var _0x504c49={'from':(_0x48c69c[_0xde25('0x9a')][_0xde25('0xa0')]||'')+'\x20'+(_0x48c69c[_0xde25('0x9a')]['lastName']||'')};if(_0x1fcf60[_0xde25('0x52')][_0xde25('0xac')]&&_0x1fcf60[_0xde25('0x52')][_0xde25('0xb0')]&&_0x1fcf60[_0xde25('0x52')]['threadId']!=_0x1fcf60[_0xde25('0x52')]['messageId']){_0x504c49[_0xde25('0xac')]=_0x1fcf60['body']['messageId'];}return _0x1eca1a[_0xde25('0x51')](_0x504c49);}else{return _0x1eca1a;}}})['then'](function(_0x5e804e){_0x48c69c[_0xde25('0xb1')]=_0x5e804e[_0xde25('0x27')]({'plain':!![]});_0x48c69c[_0xde25('0xb1')][_0xde25('0xb2')]=_0x1d1d67;if(_0x48c69c[_0xde25('0xb1')][_0xde25('0xb2')]){if(_0x48c69c[_0xde25('0x93')][_0xde25('0xb3')]){_0x48c69c[_0xde25('0x94')][_0xde25('0xb4')]({'id':0x0,'priority':_0x48c69c[_0xde25('0x94')][_0xde25('0x58')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xde25('0xb5')});}}return db[_0xde25('0xb6')][_0xde25('0x4a')]({'body':_0x1fcf60[_0xde25('0x52')][_0xde25('0x52')],'ChatWebsiteId':_0x1fcf60[_0xde25('0x48')]['id'],'ChatInteractionId':_0x5e804e['id'],'direction':'in','ContactId':_0x48c69c[_0xde25('0x9a')]['id'],'AttachmentId':_0x1fcf60[_0xde25('0x52')]['AttachmentId']});})[_0xde25('0x12')](function(_0x46f443){_0x48c69c[_0xde25('0x1b')]=_0x46f443;if(_0x48c69c[_0xde25('0xb1')][_0xde25('0xb7')]){return db[_0xde25('0xb8')][_0xde25('0x49')]({'attributes':['id',_0xde25('0x2a')],'where':{'id':_0x48c69c[_0xde25('0xb1')][_0xde25('0xb7')]}})[_0xde25('0x12')](function(_0x53676d){if(_0x53676d){_0x48c69c['applications'][_0xde25('0xb9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x53676d[_0xde25('0x2a')]+','+(_0x48c69c[_0xde25('0x93')][_0xde25('0xba')]||0xa),'interval':_0xde25('0xb5')});_0x48c69c[_0xde25('0xbb')]=!![];}return respondWithRpcPromise(_0xde25('0xbc'),'startRouting',_0x48c69c);});}return respondWithRpcPromise('Start','startRouting',_0x48c69c);})['then'](function(_0x22dc44){respondWithRpcPromise('EventManager',_0xde25('0xbd'),{'event':'notify','message':_0x22dc44},client9002);return _0x22dc44;})['then'](respondWithResult(_0x34b42a,null))[_0xde25('0x1d')](handleError(_0x34b42a,null));};exports['offline']=function(_0x52c0df,_0x1022ed){var _0x236665,_0x5db8f1,_0x2c0c1a;var _0x516433=[];var _0x2578f2={};var _0x58d39e=_0x52c0df['files']||[];var _0x1e0cd9=[];var _0x595ce5;return db[_0xde25('0x7f')][_0xde25('0x80')]()['then'](function(_0x24ac2f){if(!_0x24ac2f){throw new db['Sequelize'][(_0xde25('0x88'))](_0xde25('0xbe'));}_0x516433=_[_0xde25('0x82')](_[_0xde25('0x35')](_0x24ac2f),[_0xde25('0x84'),'updatedAt',_0xde25('0x85'),_0xde25('0x86')]);if(_0x52c0df[_0xde25('0x52')]['id']){delete _0x52c0df[_0xde25('0x52')]['id'];}if(_[_0xde25('0x6f')](_0x52c0df[_0xde25('0x52')][_0xde25('0x87')])){throw _0x1022ed[_0xde25('0x20')](0x1f4)['send'](new db[(_0xde25('0x81'))][(_0xde25('0x88'))](_0xde25('0x89')));}if(_[_0xde25('0x6f')](_0x52c0df['body']['body'])||_0x52c0df[_0xde25('0x52')]['body']===''){throw _0x1022ed['status'](0x1f4)['send'](new db[(_0xde25('0x81'))]['ValidationError'](_0xde25('0x8a')));}if(_[_0xde25('0x6f')](_0x52c0df[_0xde25('0x52')][_0xde25('0xbf')])){throw _0x1022ed['status'](0x1f4)['send'](new db[(_0xde25('0x81'))][(_0xde25('0x88'))](_0xde25('0xc0')+_0x516433));}if(!_[_0xde25('0x8b')](_0x516433,_0x52c0df[_0xde25('0x52')][_0xde25('0xbf')])){throw _0x1022ed['status'](0x1f4)[_0xde25('0xc1')](new db[(_0xde25('0x81'))][(_0xde25('0x88'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x516433));}_0x2578f2[_0x52c0df[_0xde25('0x52')][_0xde25('0xbf')]]=_0x52c0df[_0xde25('0x52')][_0xde25('0x87')];})[_0xde25('0x12')](function(){return db['ChatWebsite'][_0xde25('0x49')]({'where':{'id':_0x52c0df[_0xde25('0x48')]['id']},'include':[{'model':db[_0xde25('0x8e')],'as':_0xde25('0x8f')},{'model':db[_0xde25('0xc2')],'as':_0xde25('0xc2')}]});})[_0xde25('0x12')](handleEntityNotFound(_0x1022ed,null))['then'](function(_0x5a9ecd){if(_0x5a9ecd&&_0x5a9ecd[_0xde25('0x8f')]){_0x5db8f1=_0x5a9ecd;var _0x34b485=_[_0xde25('0x99')](_0x52c0df[_0xde25('0x52')],{'firstName':_0x52c0df[_0xde25('0x52')][_0xde25('0x87')],'phone':_0x52c0df['body']['from'],'ListId':_0x5a9ecd[_0xde25('0x86')]});_0x34b485[_0x52c0df[_0xde25('0x52')]['mapKeyOffline']]=_0x52c0df[_0xde25('0x52')]['from'];return db[_0xde25('0x7f')][_0xde25('0xc3')]({'where':_0x2578f2,'defaults':_0x34b485});}})[_0xde25('0xc4')](function(_0x5ab4c3){if(_0x5ab4c3){_0x2c0c1a=_0x5ab4c3;var _0x5dd056=fs['readFileSync'](path[_0xde25('0x69')](config[_0xde25('0x6a')],_0xde25('0xc5')),_0xde25('0xc6'));var _0x477f54=ejs[_0xde25('0xc7')](_0x5dd056,{'body':_['toPairs'](_0x52c0df['body'][_0xde25('0x52')]),'bodyTitle':_0x5db8f1[_0xde25('0xc8')]});return db['ChatOfflineMessage'][_0xde25('0x4a')]({'body':_0x477f54,'plainBody':htmlToText['fromString'](_0x477f54),'ContactId':_0x5ab4c3['id'],'ChatWebsiteId':_0x5db8f1['id']});}})[_0xde25('0x12')](function(_0x40fd2b){_0x595ce5=_0x40fd2b;if(_0x58d39e[_0xde25('0x58')]){var _0x23e7e3=_0x58d39e[_0xde25('0x2e')](function(_0x23661e){return{'name':_0x23661e[_0xde25('0xc9')],'basename':_0x23661e[_0xde25('0x61')],'type':_0x23661e[_0xde25('0xca')],'ChatOfflineMessageId':_0x40fd2b['id']};});_0x1e0cd9=_0x23e7e3[_0xde25('0x2e')](_0x26d479=>{var _0x2cf359={'filename':_0x26d479['name'],'path':path['join'](config[_0xde25('0x6a')],'server','files',_0xde25('0xcb'),'offline-chat',_0x26d479[_0xde25('0xcc')])};return _0x2cf359;});if(!_0x5db8f1[_0xde25('0xcd')]){return db['sequelize'][_0xde25('0xce')](function(_0x24aaa0){return db[_0xde25('0xcf')][_0xde25('0xd0')](_0x23e7e3,{'transaction':_0x24aaa0});});}}})['then'](function(){if(_0x595ce5){_0x236665=_0x595ce5;return db[_0xde25('0xc2')][_0xde25('0x56')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xde25('0xd1'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xde25('0x12')](function(_0x4c75b6){if(_0x4c75b6&&_0x4c75b6[_0xde25('0xd1')]&&_0x5db8f1[_0xde25('0xd2')]&&_0x5db8f1['forwardOfflineAddress']){var _0x2066ca=_0x4c75b6[_0xde25('0xd3')]();return respondWithRpcPromise(_0xde25('0xd4'),'sendMail',{'account':_0x2066ca,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x4c75b6['name'],_0x4c75b6[_0xde25('0xd5')]||_0x4c75b6[_0xde25('0xd1')]['user']),'to':_0x5db8f1[_0xde25('0xd6')],'subject':_0x5db8f1[_0xde25('0xd7')],'html':_0x236665[_0xde25('0x52')],'attachments':_0x1e0cd9}},client9003)[_0xde25('0x12')](function(){return _0x236665;})[_0xde25('0x1d')](function(_0x4a1983){logger[_0xde25('0x19')](_0x4a1983);});}})[_0xde25('0x12')](function(){if(_0x5db8f1&&_0x5db8f1['openNewInteraction']&&_0x5db8f1[_0xde25('0xd8')]){var _0x127f4b=[];if(_0x58d39e[_0xde25('0x58')]){_0x127f4b=_0x58d39e['map'](function(_0x54ffa6){return{'name':_0x54ffa6[_0xde25('0xc9')],'basename':_0x54ffa6[_0xde25('0x61')],'type':_0x54ffa6[_0xde25('0xca')],'ChatOfflineMessageId':_0x595ce5['id']};});}var _0x5f5c27;if(!_[_0xde25('0x6f')](_0x5db8f1[_0xde25('0xd9')])){var _0x3ae769=_[_0xde25('0x2e')](_0x52c0df[_0xde25('0x52')],function(_0x3f0d4e){return _0x3f0d4e;});var _0x91a8f4=_[_0xde25('0xda')](_0x3ae769)[0x0];var _0xa1017a=_[_0xde25('0xdb')](_0x91a8f4,function(_0x3eb9d1){return _0x3eb9d1;});_0x5f5c27=_0xa1017a[0x1][_0x5db8f1[_0xde25('0xd9')]];}var _0x17fcf6={'from':_0x2c0c1a[_0xde25('0xd5')],'firstName':_0x2c0c1a[_0xde25('0xa0')],'lastName':_0x2c0c1a[_0xde25('0xa1')],'mapKey':'email','message':{'from':_0x2c0c1a[_0xde25('0xd5')],'to':_0x5db8f1[_0xde25('0xc2')][_0xde25('0xd5')],'cc':'','subject':_[_0xde25('0x6f')](_0x5f5c27)?_0x5db8f1[_0xde25('0xd7')]:_0x5f5c27,'messageId':'','sentAt':new Date(),'attach':_0x127f4b['length'],'attachments':_0x127f4b,'originChannel':_0xde25('0xdc'),'ChatWebsiteId':_0x5db8f1['id'],'ChatOfflineMessageId':_0x236665['id'],'originTo':_0x5db8f1[_0xde25('0xc2')][_0xde25('0xd5')]},'body':_0x236665[_0xde25('0x52')]};var _0x1dd404={'account':{'id':_0x5db8f1['MailAccountId']},'body':_0x17fcf6,'log':_0xde25('0xdd')};return respondWithRpcPromise('NotifyMailAccount',_0xde25('0xde'),_0x1dd404,client9001)[_0xde25('0x12')](function(){return _0x236665;})[_0xde25('0x1d')](function(_0x457a3b){logger[_0xde25('0x19')](_0x457a3b);});}return;})[_0xde25('0x12')](function(){if(_0x236665){return _0x236665;}})[_0xde25('0x12')](respondWithResult(_0x1022ed,null))[_0xde25('0x1d')](function(_0xb05983){logger[_0xde25('0x19')]('catch',_0xb05983);for(var _0x27e80c of _0x58d39e){var _0x554365=path[_0xde25('0x69')](config[_0xde25('0x6a')],_0xde25('0xdf'),_0xde25('0xe0'),_0xde25('0xcb'),'offline-chat',_0x27e80c[_0xde25('0x61')]);fs_extra['remove'](_0x554365)[_0xde25('0x1d')](function(_0x51edc4){logger[_0xde25('0x19')](_0xde25('0xe1'),_0x554365,_0x51edc4);});}});};exports[_0xde25('0xe2')]=function(_0x35c164,_0x15015a){return db[_0xde25('0xaf')][_0xde25('0x49')]({'where':{'id':_0x35c164[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x15015a,null))[_0xde25('0x12')](function(_0x2d990a){if(_0x2d990a){return _0x2d990a['addInteraction'](_0x35c164[_0xde25('0x52')][_0xde25('0x5a')],_[_0xde25('0xe3')](_0x35c164[_0xde25('0x52')],[_0xde25('0x5a'),'id'])||{});}})[_0xde25('0x12')](respondWithResult(_0x15015a,null))[_0xde25('0x1d')](handleError(_0x15015a,null));};exports[_0xde25('0xe4')]=function(_0x5fd4d4,_0x252d42){var _0x307ef4={'raw':![],'where':{}};var _0x587b2e={};var _0x5f2806={'count':0x0,'rows':[]};return db[_0xde25('0x2f')][_0xde25('0x56')]({'where':{'id':_0x5fd4d4[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x252d42,null))[_0xde25('0x12')](function(_0x447a09){if(_0x447a09){_0x587b2e['model']=_[_0xde25('0x35')](db['ChatInteraction']['rawAttributes']);_0x587b2e[_0xde25('0x34')]=_[_0xde25('0x35')](_0x5fd4d4[_0xde25('0x34')]);_0x587b2e[_0xde25('0x3f')]=_[_0xde25('0x38')](_0x587b2e[_0xde25('0x36')],_0x587b2e[_0xde25('0x34')]);_0x307ef4[_0xde25('0x37')]=_[_0xde25('0x38')](_0x587b2e['model'],qs[_0xde25('0x57')](_0x5fd4d4[_0xde25('0x34')]['fields']));_0x307ef4[_0xde25('0x37')]=_0x307ef4[_0xde25('0x37')]['length']?_0x307ef4['attributes']:_0x587b2e[_0xde25('0x36')];if(!_0x5fd4d4[_0xde25('0x34')][_0xde25('0x39')]('nolimit')){_0x307ef4[_0xde25('0x3b')]=qs['limit'](_0x5fd4d4['query'][_0xde25('0x3b')]);_0x307ef4[_0xde25('0x22')]=qs[_0xde25('0x22')](_0x5fd4d4[_0xde25('0x34')][_0xde25('0x22')]);}_0x307ef4[_0xde25('0x3c')]=qs['sort'](_0x5fd4d4['query'][_0xde25('0x3d')]);_0x307ef4[_0xde25('0x3e')]=qs['filters'](_[_0xde25('0x40')](_0x5fd4d4[_0xde25('0x34')],_0x587b2e['filters']));_0x307ef4[_0xde25('0x3e')][_0xde25('0x59')]=_0x447a09['id'];if(_0x5fd4d4[_0xde25('0x34')][_0xde25('0x41')]){_0x307ef4['where']=_[_0xde25('0x42')](_0x307ef4[_0xde25('0x3e')],{'$or':_[_0xde25('0x2e')](_0x307ef4[_0xde25('0x37')],function(_0x3ba924){var _0x5d4643={};_0x5d4643[_0x3ba924]={'$like':'%'+_0x5fd4d4[_0xde25('0x34')][_0xde25('0x41')]+'%'};return _0x5d4643;})});}_0x307ef4=_[_0xde25('0x42')]({},_0x307ef4,_0x5fd4d4[_0xde25('0x43')]);return db['ChatInteraction'][_0xde25('0x23')]({'where':_0x307ef4[_0xde25('0x3e')]})[_0xde25('0x12')](function(_0x2bfe26){_0x5f2806[_0xde25('0x23')]=_0x2bfe26;if(_0x5fd4d4[_0xde25('0x34')][_0xde25('0xe5')]){_0x307ef4[_0xde25('0x44')]=[{'model':db[_0xde25('0x7f')],'as':_0xde25('0xe6'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0xde25('0xe7'),_0xde25('0xe8')],'required':![]},{'model':db[_0xde25('0xe9')],'as':_0xde25('0xea'),'attributes':['id','name',_0xde25('0xeb')],'where':_0x5fd4d4['query']['tag']?{'id':_0x5fd4d4[_0xde25('0x34')][_0xde25('0xec')]}:undefined,'required':_0x5fd4d4[_0xde25('0x34')][_0xde25('0xec')]?!![]:![]}];}return db['ChatInteraction'][_0xde25('0x45')](_0x307ef4);})[_0xde25('0x12')](function(_0x5132a4){_0x5f2806['rows']=_0x5132a4;return _0x5f2806;});}})['then'](respondWithFilteredResult(_0x252d42,_0x307ef4))[_0xde25('0x1d')](handleError(_0x252d42,null));};function iftimePromise(_0x5b0980,_0x528649){return respondWithRpcPromise(_0xde25('0xed'),'getSnippet',{'command':_0x528649[_0xde25('0xee')]?util[_0xde25('0xa6')](_0xde25('0xef'),_0x5b0980['interval'],_0x528649[_0xde25('0xee')]):util[_0xde25('0xa6')](_0xde25('0xf0'),_0x5b0980['interval'])},client9002)[_0xde25('0x12')](function(_0x49d04a){var _0xf41b1c=_0x49d04a&&_0x49d04a['indexOf']('true')>=0x0?!![]:![];logger[_0xde25('0x13')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x528649['id'],_0x5b0980['id'],_0x5b0980[_0xde25('0xf1')],_0xf41b1c?_0xde25('0xf2'):_0xde25('0xf3'),_0x528649[_0xde25('0xee')]?_0x528649[_0xde25('0xee')]:'No\x20timezone');return _0xf41b1c;})[_0xde25('0x1d')](function(_0x47ab58){logger[_0xde25('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x528649['id'],_0x5b0980['id'],_0x5b0980['interval'],util[_0xde25('0xf4')](_0x47ab58,{'showHidden':![],'depth':null}),_0x528649['timezone']?_0x528649['timezone']:'No\x20timezone');return![];});}exports[_0xde25('0xf5')]=function(_0x5e4b39,_0x3f6e18){var _0x47775a=0x0;var _0x150105=0x0;var _0x3aec5=![];var _0x102e8c;var _0x209b4b;return db[_0xde25('0x2f')]['find']({'where':{'id':_0x5e4b39[_0xde25('0x48')]['id']},'include':[{'model':db['Interval'],'as':_0xde25('0xf6'),'include':[{'model':db[_0xde25('0xf6')],'as':_0xde25('0xf7'),'attributes':['id',_0xde25('0xf1')],'raw':!![]}]}]})[_0xde25('0x12')](handleEntityNotFound(_0x3f6e18,null))[_0xde25('0x12')](function(_0x17b322){if(_0x17b322){_0x102e8c=_0x17b322;return _0x17b322['getProactiveActions']({'raw':!![]});}})[_0xde25('0x12')](function(_0x129edc){if(_0x102e8c){if(_0x129edc){_0x209b4b=_0x129edc;}}return require('../../config/license/util')[_0xde25('0x6d')]();})[_0xde25('0x12')](function(_0x4d479c){if(_0x4d479c){_0x150105=_0x4d479c['virtual'];_0x3aec5=_0x4d479c[_0xde25('0x6e')];}})['then'](function(){return db[_0xde25('0xaf')][_0xde25('0x23')]({'where':{'closed':![]}});})[_0xde25('0x12')](function(_0x44c3c1){_0x47775a=_0x44c3c1;if(_0x150105&&_0x44c3c1>_0x150105){return db[_0xde25('0xf8')]['findOne']({'where':{'id':0x1}})[_0xde25('0x12')](function(_0x559cc9){if(_0x559cc9){_0x559cc9[_0xde25('0xf9')]('chatLicenseExceeded');}});}})[_0xde25('0x12')](function(){if(_0x102e8c[_0xde25('0xf6')]&&_0x102e8c[_0xde25('0xf6')][_0xde25('0xf7')]){var _0x506edc=[];for(var _0x528cd9=0x0;_0x528cd9<_0x102e8c[_0xde25('0xf6')][_0xde25('0xf7')]['length'];_0x528cd9++){var _0x4bc60f=_0x102e8c[_0xde25('0xf6')]['Intervals'][_0x528cd9][_0xde25('0x27')]({'plain':!![]});_0x506edc[_0xde25('0xb4')](iftimePromise(_0x4bc60f,_0x102e8c));}return BPromise[_0xde25('0xfa')](_0x506edc)[_0xde25('0x12')](function(_0x1b6e62){return _[_0xde25('0xfb')](_0x1b6e62);});}else{return!![];}})['then'](function(_0x4e888e){var _0x3c4196=fs[_0xde25('0xfc')](path[_0xde25('0x69')](config[_0xde25('0x6a')],'server/files/chat/iframe.ejs'),_0xde25('0xc6'));var _0x1b00d9=new url['URL'](_0x102e8c[_0xde25('0xfd')])[_0xde25('0xfe')];var _0x3968ea=_0xde25('0xff');var _0x3ce487=![];var _0x72d3c8={'chatVersion':_0x3968ea,'chatWebsiteAddressOrigin':_0x1b00d9,'remote':_0x102e8c['remote'],'query':querystring[_0xde25('0x18')](_['merge'](_0x102e8c[_0xde25('0x27')]({'plain':!![]}),{'customerIp':_0x5e4b39['headers'][_0xde25('0x9e')]||_0x5e4b39['headers'][_0xde25('0x100')]||_0x5e4b39[_0xde25('0x101')][_0xde25('0x102')]||_0x5e4b39['ip'],'referer':_0x5e4b39[_0xde25('0x7c')][_0xde25('0xa3')],'openedInteractions':_0x47775a,'maxInteractions':_0x150105,'virtual':_0x3aec5[_0xde25('0x103')],'online':_0x4e888e,'custom':_0x3aec5}))[_0xde25('0x104')](/'/g,'\x5c\x27')};_0x3f6e18[_0xde25('0xc1')](ejs[_0xde25('0xc7')](Mustache[_0xde25('0xc7')](_0x3c4196,_0x72d3c8),{'proactiveActions':_0x209b4b,'alignment':_0x102e8c[_0xde25('0x105')],'verticalAlignment':_0x102e8c[_0xde25('0x106')],'div_color':_0x102e8c[_0xde25('0xeb')],'labelText':_0x102e8c[_0xde25('0x107')],'text_color':_0x102e8c[_0xde25('0x108')],'text_button_color':_0x102e8c[_0xde25('0x109')],'button_color':_0x102e8c[_0xde25('0x10a')],'background_color':_0x102e8c[_0xde25('0x10b')],'hideWhenOffline':_0x102e8c[_0xde25('0x10c')],'intervalId':_0x102e8c[_0xde25('0x10d')],'isDevelopment':_0x3ce487,'chatVersion':_0x3968ea}));})[_0xde25('0x1d')](handleError(_0x3f6e18,null));};exports[_0xde25('0x10e')]=function(_0x13df05,_0x79b544){var _0x50e7a5=_0x13df05[_0xde25('0x48')]['id'];var _0x5966fc=_0x13df05[_0xde25('0x52')];var _0x52a227=0xc8;var _0x21c0db=null;return db[_0xde25('0x10f')][_0xde25('0xce')]({'isolationLevel':db[_0xde25('0x10f')][_0xde25('0x110')]['ISOLATION_LEVELS'][_0xde25('0x111')]},function(_0x5abdb8){return db[_0xde25('0x2f')]['findOne']({'where':{'id':_0x50e7a5},'transaction':_0x5abdb8})['then'](function(_0x577d23){if(_0x577d23){return db[_0xde25('0x91')][_0xde25('0x26')]({'where':{'ChatWebsiteId':_0x50e7a5},'transaction':_0x5abdb8})[_0xde25('0x12')](function(){var _0x322165=_[_0xde25('0x2e')](_0x5966fc,function(_0x5c9646){_0x5c9646[_0xde25('0x59')]=_0x50e7a5;return _0x5c9646;});return db[_0xde25('0x91')]['bulkCreate'](_0x322165,{'transaction':_0x5abdb8});});}else{_0x52a227=0x194;_0x21c0db=[];}});})['then'](function(){if(_0x52a227!==0x194){return db[_0xde25('0x91')][_0xde25('0x112')]({'where':{'ChatWebsiteId':_0x50e7a5},'order':_0xde25('0x97')})[_0xde25('0x12')](function(_0x23b047){_0x21c0db=_0x23b047;});}})[_0xde25('0x1d')](function(_0x2710ac){_0x52a227=0x1f4;logger[_0xde25('0x19')](_0x2710ac[_0xde25('0x113')]);if(_0x2710ac[_0xde25('0x2a')]){delete _0x2710ac['name'];}_0x21c0db=_0x2710ac;})[_0xde25('0x114')](function(){if(_0x21c0db===null){_0x79b544[_0xde25('0x1e')](_0x52a227);}else{if(_0x52a227===0x1f4){_0x79b544[_0xde25('0x20')](_0x52a227)[_0xde25('0xc1')](_0x21c0db);}else{_0x79b544[_0xde25('0x20')](_0x52a227)[_0xde25('0x115')](_0x21c0db);}}});};exports[_0xde25('0x116')]=function(_0x26457c,_0x54f4ce){var _0x5b6bb2={};var _0x2161ec={};var _0x5300a4;var _0x2a3d9e;return db[_0xde25('0x2f')][_0xde25('0x56')]({'where':{'id':_0x26457c[_0xde25('0x48')]['id']}})['then'](handleEntityNotFound(_0x54f4ce,null))[_0xde25('0x12')](function(_0x427112){if(_0x427112){_0x5300a4=_0x427112;_0x2161ec[_0xde25('0x36')]=_[_0xde25('0x35')](db['ChatApplication'][_0xde25('0x30')]);_0x2161ec[_0xde25('0x34')]=_['keys'](_0x26457c[_0xde25('0x34')]);_0x2161ec[_0xde25('0x3f')]=_['intersection'](_0x2161ec[_0xde25('0x36')],_0x2161ec[_0xde25('0x34')]);_0x5b6bb2[_0xde25('0x37')]=_[_0xde25('0x38')](_0x2161ec[_0xde25('0x36')],qs['fields'](_0x26457c[_0xde25('0x34')]['fields']));_0x5b6bb2[_0xde25('0x37')]=_0x5b6bb2[_0xde25('0x37')][_0xde25('0x58')]?_0x5b6bb2[_0xde25('0x37')]:_0x2161ec['model'];_0x5b6bb2[_0xde25('0x3c')]=qs[_0xde25('0x3d')](_0x26457c['query'][_0xde25('0x3d')]);_0x5b6bb2[_0xde25('0x3e')]=qs[_0xde25('0x3f')](_[_0xde25('0x40')](_0x26457c['query'],_0x2161ec[_0xde25('0x3f')]));if(_0x26457c[_0xde25('0x34')][_0xde25('0x41')]){_0x5b6bb2[_0xde25('0x3e')]=_[_0xde25('0x42')](_0x5b6bb2['where'],{'$or':_[_0xde25('0x2e')](_0x5b6bb2[_0xde25('0x37')],function(_0x3ec60b){var _0x160112={};_0x160112[_0x3ec60b]={'$like':'%'+_0x26457c['query'][_0xde25('0x41')]+'%'};return _0x160112;})});}_0x5b6bb2=_['merge']({},_0x5b6bb2,_0x26457c[_0xde25('0x43')]);return _0x5300a4[_0xde25('0x116')](_0x5b6bb2);}})['then'](function(_0x26da61){if(_0x26da61){_0x2a3d9e=_0x26da61[_0xde25('0x58')];if(!_0x26457c[_0xde25('0x34')][_0xde25('0x39')](_0xde25('0x3a'))){_0x5b6bb2[_0xde25('0x3b')]=qs[_0xde25('0x3b')](_0x26457c[_0xde25('0x34')][_0xde25('0x3b')]);_0x5b6bb2[_0xde25('0x22')]=qs[_0xde25('0x22')](_0x26457c[_0xde25('0x34')][_0xde25('0x22')]);}return _0x5300a4[_0xde25('0x116')](_0x5b6bb2);}})[_0xde25('0x12')](function(_0x16c1f6){if(_0x16c1f6){return _0x16c1f6?{'count':_0x2a3d9e,'rows':_0x16c1f6}:null;}})[_0xde25('0x12')](respondWithResult(_0x54f4ce,null))[_0xde25('0x1d')](handleError(_0x54f4ce,null));};exports[_0xde25('0x117')]=function(_0x1dc0e4,_0x31cd3d){return db[_0xde25('0x118')][_0xde25('0x49')]({'where':{'id':_0x1dc0e4[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x31cd3d,null))[_0xde25('0x12')](function(_0x3824f5){if(_0x3824f5){return _0x3824f5['addProactiveActions'](_0x1dc0e4[_0xde25('0x52')][_0xde25('0x5a')],_['omit'](_0x1dc0e4[_0xde25('0x52')],['ids','id'])||{});}})[_0xde25('0x12')](respondWithResult(_0x31cd3d,null))[_0xde25('0x1d')](handleError(_0x31cd3d,null));};exports['getProactiveActions']=function(_0x574599,_0x1d5db0){var _0x494813={};var _0x4cfe07={};var _0x224633;var _0x4bab5c;return db[_0xde25('0x2f')][_0xde25('0x56')]({'where':{'id':_0x574599['params']['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x1d5db0,null))[_0xde25('0x12')](function(_0x56b93f){if(_0x56b93f){_0x224633=_0x56b93f;_0x4cfe07[_0xde25('0x36')]=_[_0xde25('0x35')](db['ChatProactiveAction']['rawAttributes']);_0x4cfe07[_0xde25('0x34')]=_[_0xde25('0x35')](_0x574599['query']);_0x4cfe07['filters']=_['intersection'](_0x4cfe07[_0xde25('0x36')],_0x4cfe07[_0xde25('0x34')]);_0x494813[_0xde25('0x37')]=_['intersection'](_0x4cfe07[_0xde25('0x36')],qs[_0xde25('0x57')](_0x574599[_0xde25('0x34')][_0xde25('0x57')]));_0x494813[_0xde25('0x37')]=_0x494813[_0xde25('0x37')][_0xde25('0x58')]?_0x494813[_0xde25('0x37')]:_0x4cfe07[_0xde25('0x36')];_0x494813[_0xde25('0x3c')]=qs['sort'](_0x574599[_0xde25('0x34')]['sort']);_0x494813['where']=qs[_0xde25('0x3f')](_[_0xde25('0x40')](_0x574599['query'],_0x4cfe07['filters']));if(_0x574599[_0xde25('0x34')]['filter']){_0x494813[_0xde25('0x3e')]=_[_0xde25('0x42')](_0x494813[_0xde25('0x3e')],{'$or':_['map'](_0x494813[_0xde25('0x37')],function(_0x21f05e){var _0x1904f6={};_0x1904f6[_0x21f05e]={'$like':'%'+_0x574599[_0xde25('0x34')][_0xde25('0x41')]+'%'};return _0x1904f6;})});}_0x494813=_[_0xde25('0x42')]({},_0x494813,_0x574599[_0xde25('0x43')]);return _0x224633[_0xde25('0x119')](_0x494813);}})[_0xde25('0x12')](function(_0x3a975b){if(_0x3a975b){_0x4bab5c=_0x3a975b[_0xde25('0x58')];if(!_0x574599[_0xde25('0x34')]['hasOwnProperty'](_0xde25('0x3a'))){_0x494813['limit']=qs[_0xde25('0x3b')](_0x574599[_0xde25('0x34')][_0xde25('0x3b')]);_0x494813[_0xde25('0x22')]=qs[_0xde25('0x22')](_0x574599[_0xde25('0x34')]['offset']);}return _0x224633[_0xde25('0x119')](_0x494813);}})[_0xde25('0x12')](function(_0x53eca7){if(_0x53eca7){return _0x53eca7?{'count':_0x4bab5c,'rows':_0x53eca7}:null;}})[_0xde25('0x12')](respondWithResult(_0x1d5db0,null))[_0xde25('0x1d')](handleError(_0x1d5db0,null));};exports['getFields']=function(_0x186d3e,_0xbce9db){var _0x462a51=_0x186d3e[_0xde25('0x34')][_0xde25('0x11a')]==='false'?_0xde25('0x11b'):_0xde25('0x11c');return db[_0xde25('0x2f')][_0xde25('0x49')]({'attributes':['id',_0x462a51],'where':{'id':_0x186d3e['params']['id']}})[_0xde25('0x12')](handleEntityNotFound(_0xbce9db,null))[_0xde25('0x12')](function(_0x1d42f8){if(_0x1d42f8){var _0x1594c0=_0x1d42f8[_0x462a51];var _0x371012=_0x1594c0&&_0x1594c0['items']?_0x1594c0[_0xde25('0x11d')]:[];_0xbce9db[_0xde25('0xc1')]({'fromKey':_[_0xde25('0x6f')](_0x1594c0[_0xde25('0x11e')])?undefined:_0x1594c0[_0xde25('0x11e')],'count':_0x371012[_0xde25('0x58')],'rows':_0x371012});}})[_0xde25('0x1d')](handleError(_0xbce9db,null));};exports['getOfflineMessages']=function(_0x2df79f,_0x307c95){var _0x2d0f3e={'raw':![],'where':{}};var _0x174cd5={};var _0x42d41a={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2df79f['params']['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x307c95,null))[_0xde25('0x12')](function(_0x1fdab5){if(_0x1fdab5){_0x174cd5['model']=_['keys'](db[_0xde25('0x11f')]['rawAttributes']);_0x174cd5[_0xde25('0x34')]=_[_0xde25('0x35')](_0x2df79f[_0xde25('0x34')]);_0x174cd5[_0xde25('0x3f')]=_[_0xde25('0x38')](_0x174cd5[_0xde25('0x36')],_0x174cd5[_0xde25('0x34')]);_0x2d0f3e[_0xde25('0x37')]=_['intersection'](_0x174cd5[_0xde25('0x36')],qs[_0xde25('0x57')](_0x2df79f[_0xde25('0x34')][_0xde25('0x57')]));_0x2d0f3e[_0xde25('0x37')]=_0x2d0f3e[_0xde25('0x37')][_0xde25('0x58')]?_0x2d0f3e[_0xde25('0x37')]:_0x174cd5[_0xde25('0x36')];if(!_0x2df79f[_0xde25('0x34')][_0xde25('0x39')](_0xde25('0x3a'))){_0x2d0f3e[_0xde25('0x3b')]=qs[_0xde25('0x3b')](_0x2df79f['query']['limit']);_0x2d0f3e['offset']=qs['offset'](_0x2df79f[_0xde25('0x34')]['offset']);}_0x2d0f3e['order']=qs[_0xde25('0x3d')](_0x2df79f[_0xde25('0x34')][_0xde25('0x3d')]);_0x2d0f3e[_0xde25('0x3e')]=qs['filters'](_[_0xde25('0x40')](_0x2df79f[_0xde25('0x34')],_0x174cd5['filters']));_0x2d0f3e[_0xde25('0x3e')][_0xde25('0x59')]=_0x1fdab5['id'];if(_0x2df79f[_0xde25('0x34')]['filter']){_0x2d0f3e['where']=_[_0xde25('0x42')](_0x2d0f3e[_0xde25('0x3e')],{'$or':_[_0xde25('0x2e')](_0x2d0f3e['attributes'],function(_0x307d97){var _0x39c242={};_0x39c242[_0x307d97]={'$like':'%'+_0x2df79f[_0xde25('0x34')]['filter']+'%'};return _0x39c242;})});}_0x2d0f3e=_[_0xde25('0x42')]({},_0x2d0f3e,_0x2df79f[_0xde25('0x43')]);return db['ChatOfflineMessage']['count']({'where':_0x2d0f3e[_0xde25('0x3e')]})['then'](function(_0x4d8295){_0x42d41a[_0xde25('0x23')]=_0x4d8295;if(_0x2df79f[_0xde25('0x34')][_0xde25('0xe5')]){_0x2d0f3e[_0xde25('0x44')]=[{'all':!![]}];}else{_0x2d0f3e[_0xde25('0x44')]=[{'model':db[_0xde25('0x7f')],'as':_0xde25('0xe6'),'required':![]},{'model':db[_0xde25('0xcf')],'as':_0xde25('0x120'),'required':![]}];}return db['ChatOfflineMessage'][_0xde25('0x45')](_0x2d0f3e);})[_0xde25('0x12')](function(_0x43dc91){_0x42d41a[_0xde25('0x46')]=_0x43dc91;return _0x42d41a;});}})['then'](respondWithFilteredResult(_0x307c95,_0x2d0f3e))[_0xde25('0x1d')](handleError(_0x307c95,null));};exports[_0xde25('0x121')]=function(_0x862996,_0x473749){return db['ChatWebsite']['find']({'where':{'id':_0x862996['params']['id']}})['then'](handleEntityNotFound(_0x473749,null))[_0xde25('0x12')](function(_0x1d9780){if(_0x1d9780){return _0x1d9780[_0xde25('0x121')](_0x862996['body'][_0xde25('0x5a')],_['omit'](_0x862996[_0xde25('0x52')],[_0xde25('0x5a'),'id'])||{})[_0xde25('0xc4')](function(_0xf6f369){for(var _0xcced0=0x0;_0xcced0<_0x862996[_0xde25('0x52')][_0xde25('0x5a')]['length'];_0xcced0+=0x1){socket[_0xde25('0x122')]('userChatWebsite:save',{'UserId':Number(_0x862996['body'][_0xde25('0x5a')][_0xcced0]),'ChatWebsiteId':Number(_0x862996[_0xde25('0x48')]['id'])});}return _0xf6f369;});}})[_0xde25('0x12')](respondWithResult(_0x473749,null))[_0xde25('0x1d')](handleError(_0x473749,null));};exports[_0xde25('0x123')]=function(_0x31e547,_0x357c21){return db[_0xde25('0x2f')][_0xde25('0x49')]({'where':{'id':_0x31e547['params']['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x357c21,null))[_0xde25('0x12')](function(_0x512756){if(_0x512756){return _0x512756[_0xde25('0x123')](_0x31e547['query'][_0xde25('0x5a')])[_0xde25('0x12')](function(){if(_['isArray'](_0x31e547[_0xde25('0x34')][_0xde25('0x5a')])){for(var _0x1fb58e=0x0;_0x1fb58e<_0x31e547[_0xde25('0x34')][_0xde25('0x5a')][_0xde25('0x58')];_0x1fb58e+=0x1){socket[_0xde25('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x31e547[_0xde25('0x34')]['ids'][_0x1fb58e]),'ChatWebsiteId':Number(_0x31e547['params']['id'])});}}else{socket[_0xde25('0x122')](_0xde25('0x124'),{'UserId':Number(_0x31e547[_0xde25('0x34')][_0xde25('0x5a')]),'ChatWebsiteId':Number(_0x31e547[_0xde25('0x48')]['id'])});}});}})[_0xde25('0x12')](respondWithStatusCode(_0x357c21,null))['catch'](handleError(_0x357c21,null));};exports['getAgents']=function(_0x3a50e3,_0x7d405d){var _0x57d325={};var _0x5b17b7={};var _0x21bfa7;var _0x133091;return db['ChatWebsite'][_0xde25('0x56')]({'where':{'id':_0x3a50e3[_0xde25('0x48')]['id']}})[_0xde25('0x12')](handleEntityNotFound(_0x7d405d,null))[_0xde25('0x12')](function(_0x581192){if(_0x581192){_0x21bfa7=_0x581192;_0x5b17b7[_0xde25('0x36')]=_[_0xde25('0x35')](db[_0xde25('0xb8')][_0xde25('0x30')]);_0x5b17b7[_0xde25('0x34')]=_[_0xde25('0x35')](_0x3a50e3['query']);_0x5b17b7[_0xde25('0x3f')]=_[_0xde25('0x38')](_0x5b17b7[_0xde25('0x36')],_0x5b17b7[_0xde25('0x34')]);_0x57d325[_0xde25('0x37')]=_[_0xde25('0x38')](_0x5b17b7[_0xde25('0x36')],qs[_0xde25('0x57')](_0x3a50e3['query'][_0xde25('0x57')]));_0x57d325[_0xde25('0x37')]=_0x57d325[_0xde25('0x37')]['length']?_0x57d325['attributes']:_0x5b17b7[_0xde25('0x36')];_0x57d325[_0xde25('0x3c')]=qs[_0xde25('0x3d')](_0x3a50e3[_0xde25('0x34')][_0xde25('0x3d')]);_0x57d325[_0xde25('0x3e')]=qs['filters'](_[_0xde25('0x40')](_0x3a50e3[_0xde25('0x34')],_0x5b17b7['filters']));if(_0x3a50e3[_0xde25('0x34')]['filter']){_0x57d325[_0xde25('0x3e')]=_[_0xde25('0x42')](_0x57d325[_0xde25('0x3e')],{'$or':_[_0xde25('0x2e')](_0x57d325[_0xde25('0x37')],function(_0x5cbb0b){var _0x182b7f={};_0x182b7f[_0x5cbb0b]={'$like':'%'+_0x3a50e3[_0xde25('0x34')][_0xde25('0x41')]+'%'};return _0x182b7f;})});}_0x57d325=_['merge']({},_0x57d325,_0x3a50e3['options']);return _0x21bfa7[_0xde25('0x125')](_0x57d325);}})[_0xde25('0x12')](function(_0x5bd211){if(_0x5bd211){_0x133091=_0x5bd211['length'];if(!_0x3a50e3[_0xde25('0x34')]['hasOwnProperty'](_0xde25('0x3a'))){_0x57d325[_0xde25('0x3b')]=qs['limit'](_0x3a50e3['query'][_0xde25('0x3b')]);_0x57d325[_0xde25('0x22')]=qs['offset'](_0x3a50e3['query'][_0xde25('0x22')]);}return _0x21bfa7['getAgents'](_0x57d325);}})[_0xde25('0x12')](function(_0x1564c3){if(_0x1564c3){return _0x1564c3?{'count':_0x133091,'rows':_0x1564c3}:null;}})[_0xde25('0x12')](respondWithResult(_0x7d405d,null))['catch'](handleError(_0x7d405d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a141631..869ca99 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54da=['hasOwnProperty','hook','events','ChatWebsite','update'];(function(_0x4595f1,_0x4e53d6){var _0x574302=function(_0x54144b){while(--_0x54144b){_0x4595f1['push'](_0x4595f1['shift']());}};_0x574302(++_0x4e53d6);}(_0x54da,0x9d));var _0xa54d=function(_0x5cd8c2,_0x4bc8ee){_0x5cd8c2=_0x5cd8c2-0x0;var _0x4d2440=_0x54da[_0x5cd8c2];return _0x4d2440;};'use strict';var EventEmitter=require(_0xa54d('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xa54d('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa54d('0x2'),'afterDestroy':'remove'};function emitEvent(_0x22184a){return function(_0x280f78,_0x936fe1,_0x34cb88){ChatWebsiteEvents['emit'](_0x22184a+':'+_0x280f78['id'],_0x280f78);ChatWebsiteEvents['emit'](_0x22184a,_0x280f78);_0x34cb88(null);};}for(var e in events){if(events[_0xa54d('0x3')](e)){var event=events[e];ChatWebsite[_0xa54d('0x4')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x4b19=['save','remove','emit','hasOwnProperty','hook','events','ChatWebsite','setMaxListeners'];(function(_0x3b4b5e,_0x2a232d){var _0x40a83a=function(_0x1ffe23){while(--_0x1ffe23){_0x3b4b5e['push'](_0x3b4b5e['shift']());}};_0x40a83a(++_0x2a232d);}(_0x4b19,0x195));var _0x94b1=function(_0x2e257e,_0x1fb49){_0x2e257e=_0x2e257e-0x0;var _0xc250cd=_0x4b19[_0x2e257e];return _0xc250cd;};'use strict';var EventEmitter=require(_0x94b1('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x94b1('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x94b1('0x2')](0x0);var events={'afterCreate':_0x94b1('0x3'),'afterUpdate':'update','afterDestroy':_0x94b1('0x4')};function emitEvent(_0x3648ad){return function(_0x2240b9,_0x4f607f,_0x1310cd){ChatWebsiteEvents[_0x94b1('0x5')](_0x3648ad+':'+_0x2240b9['id'],_0x2240b9);ChatWebsiteEvents['emit'](_0x3648ad,_0x2240b9);_0x1310cd(null);};}for(var e in events){if(events[_0x94b1('0x6')](e)){var event=events[e];ChatWebsite[_0x94b1('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 8b02da3..8ad4f7f 100644 --- a/server/api/chatWebsite/chatWebsite.model.js +++ b/server/api/chatWebsite/chatWebsite.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x291a=['lodash','api','bluebird','request-promise','path','rimraf','define','ChatWebsite','chat_websites'];(function(_0xfaf561,_0x31d66a){var _0x565997=function(_0x3999b5){while(--_0x3999b5){_0xfaf561['push'](_0xfaf561['shift']());}};_0x565997(++_0x31d66a);}(_0x291a,0xbd));var _0xa291=function(_0x2cd160,_0xce27af){_0x2cd160=_0x2cd160-0x0;var _0x20f054=_0x291a[_0x2cd160];return _0x20f054;};'use strict';var _=require(_0xa291('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa291('0x1'));var moment=require('moment');var BPromise=require(_0xa291('0x2'));var rp=require(_0xa291('0x3'));var fs=require('fs');var path=require(_0xa291('0x4'));var rimraf=require(_0xa291('0x5'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x10944f,_0x189738){return _0x10944f[_0xa291('0x6')](_0xa291('0x7'),attributes,{'tableName':_0xa291('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5662=['../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2b2504,_0x189fd1){var _0x2f08c7=function(_0x280cb3){while(--_0x280cb3){_0x2b2504['push'](_0x2b2504['shift']());}};_0x2f08c7(++_0x189fd1);}(_0x5662,0x18a));var _0x2566=function(_0x1f147a,_0x2dff14){_0x1f147a=_0x1f147a-0x0;var _0x59a9f2=_0x5662[_0x1f147a];return _0x59a9f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2566('0x0'))(_0x2566('0x1'));var moment=require(_0x2566('0x2'));var BPromise=require(_0x2566('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2566('0x4'));var rimraf=require(_0x2566('0x5'));var config=require(_0x2566('0x6'));var attributes=require(_0x2566('0x7'));module[_0x2566('0x8')]=function(_0x2c45f8,_0x2a32ab){return _0x2c45f8['define'](_0x2566('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index a1ad996..be6b5d2 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x513e=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./chatWebsite.socket','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x17a789,_0x88e56e){var _0x291f50=function(_0xc9686e){while(--_0xc9686e){_0x17a789['push'](_0x17a789['shift']());}};_0x291f50(++_0x88e56e);}(_0x513e,0xd5));var _0xe513=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x513e[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xe513('0x0'));var util=require('util');var moment=require(_0xe513('0x1'));var BPromise=require(_0xe513('0x2'));var rs=require(_0xe513('0x3'));var fs=require('fs');var Redis=require(_0xe513('0x4'));var db=require(_0xe513('0x5'))['db'];var utils=require(_0xe513('0x6'));var logger=require(_0xe513('0x7'))(_0xe513('0x8'));var config=require(_0xe513('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe513('0xa')]['http']({'port':0x232a});config[_0xe513('0xb')]=_[_0xe513('0xc')](config[_0xe513('0xb')],{'host':_0xe513('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe513('0xb')]));require(_0xe513('0xe'))['register'](socket);function respondWithRpcPromise(_0x57f902,_0xc510ae,_0x3680c2){return new BPromise(function(_0x483073,_0x4c4ddb){return client[_0xe513('0xf')](_0x57f902,_0x3680c2)[_0xe513('0x10')](function(_0x1d26c9){logger['info'](_0xe513('0x11'),_0xc510ae,_0xe513('0x12'));logger[_0xe513('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xc510ae,'request\x20sent',JSON[_0xe513('0x14')](_0x1d26c9));if(_0x1d26c9[_0xe513('0x15')]){if(_0x1d26c9[_0xe513('0x15')][_0xe513('0x16')]===0x1f4){logger['error'](_0xe513('0x11'),_0xc510ae,_0x1d26c9['error']['message']);return _0x4c4ddb(_0x1d26c9[_0xe513('0x15')]['message']);}logger[_0xe513('0x15')](_0xe513('0x11'),_0xc510ae,_0x1d26c9[_0xe513('0x15')]['message']);return _0x483073(_0x1d26c9[_0xe513('0x15')][_0xe513('0x17')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0xc510ae,_0xe513('0x12'));_0x483073(_0x1d26c9[_0xe513('0x18')][_0xe513('0x17')]);}})[_0xe513('0x19')](function(_0x33ffcf){logger['error'](_0xe513('0x11'),_0xc510ae,_0x33ffcf);_0x4c4ddb(_0x33ffcf);});});} \ No newline at end of file +var _0x27cb=['./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x21960a,_0x18561d){var _0x10d47a=function(_0x5d787d){while(--_0x5d787d){_0x21960a['push'](_0x21960a['shift']());}};_0x10d47a(++_0x18561d);}(_0x27cb,0x1cc));var _0xb27c=function(_0x273a4f,_0x53b1a2){_0x273a4f=_0x273a4f-0x0;var _0x5b6d1b=_0x27cb[_0x273a4f];return _0x5b6d1b;};'use strict';var _=require(_0xb27c('0x0'));var util=require(_0xb27c('0x1'));var moment=require(_0xb27c('0x2'));var BPromise=require(_0xb27c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb27c('0x4'));var logger=require(_0xb27c('0x5'))(_0xb27c('0x6'));var config=require(_0xb27c('0x7'));var jayson=require(_0xb27c('0x8'));var client=jayson[_0xb27c('0x9')][_0xb27c('0xa')]({'port':0x232a});config[_0xb27c('0xb')]=_[_0xb27c('0xc')](config[_0xb27c('0xb')],{'host':_0xb27c('0xd'),'port':0x18eb});var socket=require(_0xb27c('0xe'))(new Redis(config['redis']));require(_0xb27c('0xf'))['register'](socket);function respondWithRpcPromise(_0xe07d94,_0xc0acbb,_0x2f8eb7){return new BPromise(function(_0x1bed60,_0x52eb2d){return client[_0xb27c('0x10')](_0xe07d94,_0x2f8eb7)['then'](function(_0x4315b2){logger[_0xb27c('0x11')](_0xb27c('0x12'),_0xc0acbb,_0xb27c('0x13'));logger[_0xb27c('0x14')](_0xb27c('0x15'),_0xc0acbb,_0xb27c('0x13'),JSON['stringify'](_0x4315b2));if(_0x4315b2['error']){if(_0x4315b2['error']['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0xc0acbb,_0x4315b2[_0xb27c('0x16')][_0xb27c('0x17')]);return _0x52eb2d(_0x4315b2[_0xb27c('0x16')][_0xb27c('0x17')]);}logger[_0xb27c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xc0acbb,_0x4315b2['error'][_0xb27c('0x17')]);return _0x1bed60(_0x4315b2[_0xb27c('0x16')]['message']);}else{logger[_0xb27c('0x11')](_0xb27c('0x12'),_0xc0acbb,'request\x20sent');_0x1bed60(_0x4315b2['result'][_0xb27c('0x17')]);}})[_0xb27c('0x18')](function(_0x5dc7b5){logger[_0xb27c('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xc0acbb,_0x5dc7b5);_0x52eb2d(_0x5dc7b5);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7947a70..509a0d8 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38b7=['emit','removeListener','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x55a5e8,_0xc4b04f){var _0x31e1d9=function(_0x5d181b){while(--_0x5d181b){_0x55a5e8['push'](_0x55a5e8['shift']());}};_0x31e1d9(++_0xc4b04f);}(_0x38b7,0x11b));var _0x738b=function(_0x5284bb,_0x4303ee){_0x5284bb=_0x5284bb-0x0;var _0x3c6d49=_0x38b7[_0x5284bb];return _0x3c6d49;};'use strict';var ChatWebsiteEvents=require(_0x738b('0x0'));var events=[_0x738b('0x1'),_0x738b('0x2'),_0x738b('0x3')];function createListener(_0xa99fb8,_0x3e94ce){return function(_0x39d0c6){_0x3e94ce[_0x738b('0x4')](_0xa99fb8,_0x39d0c6);};}function removeListener(_0x550b58,_0x42d42e){return function(){ChatWebsiteEvents[_0x738b('0x5')](_0x550b58,_0x42d42e);};}exports['register']=function(_0x51ab60){for(var _0x24c8c5=0x0,_0x4adaec=events['length'];_0x24c8c5<_0x4adaec;_0x24c8c5++){var _0x3122e0=events[_0x24c8c5];var _0x500696=createListener(_0x738b('0x6')+_0x3122e0,_0x51ab60);ChatWebsiteEvents['on'](_0x3122e0,_0x500696);}}; \ No newline at end of file +var _0xd027=['remove','update','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x59ed75,_0x4c50f1){var _0x323719=function(_0x39ae6c){while(--_0x39ae6c){_0x59ed75['push'](_0x59ed75['shift']());}};_0x323719(++_0x4c50f1);}(_0xd027,0x13e));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var ChatWebsiteEvents=require(_0x7d02('0x0'));var events=[_0x7d02('0x1'),_0x7d02('0x2'),_0x7d02('0x3')];function createListener(_0x31a84f,_0x11699c){return function(_0xed14b2){_0x11699c['emit'](_0x31a84f,_0xed14b2);};}function removeListener(_0x19c391,_0x4aa8e7){return function(){ChatWebsiteEvents[_0x7d02('0x4')](_0x19c391,_0x4aa8e7);};}exports[_0x7d02('0x5')]=function(_0x114b81){for(var _0x4d69a8=0x0,_0x4c2e28=events[_0x7d02('0x6')];_0x4d69a8<_0x4c2e28;_0x4d69a8++){var _0x410237=events[_0x4d69a8];var _0xbfbf73=createListener(_0x7d02('0x7')+_0x410237,_0x114b81);ChatWebsiteEvents['on'](_0x410237,_0xbfbf73);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index bd22f2f..2463861 100644 --- a/server/api/chatWebsite/index.js +++ b/server/api/chatWebsite/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6106=['/:id/logo','single','file','addLogo','diskStorage','server/files/images/avatars/','addAvatar','originalname','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','put','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','addDisposition','join','root','server/files/images/logos/','format','now'];(function(_0x581e1d,_0x1ed7d4){var _0x39965b=function(_0x3cf384){while(--_0x3cf384){_0x581e1d['push'](_0x581e1d['shift']());}};_0x39965b(++_0x1ed7d4);}(_0x6106,0x1cf));var _0x6610=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6106[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x6610('0x0'));var util=require(_0x6610('0x1'));var path=require(_0x6610('0x2'));var timeout=require(_0x6610('0x3'));var express=require(_0x6610('0x4'));var router=express[_0x6610('0x5')]();var fs_extra=require(_0x6610('0x6'));var auth=require(_0x6610('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6610('0x8'));var controller=require(_0x6610('0x9'));router[_0x6610('0xa')]('/',auth[_0x6610('0xb')](),controller[_0x6610('0xc')]);router[_0x6610('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x6610('0xd')]);router[_0x6610('0xa')](_0x6610('0xe'),auth[_0x6610('0xb')](),controller['show']);router[_0x6610('0xa')](_0x6610('0xf'),auth[_0x6610('0xb')](),controller['getDispositions']);router['get'](_0x6610('0x10'),auth[_0x6610('0xb')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0x6610('0x11')]);router[_0x6610('0xa')](_0x6610('0x12'),controller[_0x6610('0x13')]);router[_0x6610('0xa')](_0x6610('0x14'),controller['getCustomerAvatar']);router[_0x6610('0xa')](_0x6610('0x15'),controller['getSystemAvatar']);router[_0x6610('0xa')](_0x6610('0x16'),auth[_0x6610('0xb')](),controller[_0x6610('0x17')]);router[_0x6610('0xa')]('/:id/snippet',controller['getSnippet']);router['get'](_0x6610('0x18'),auth[_0x6610('0xb')](),controller[_0x6610('0x19')]);router['get'](_0x6610('0x1a'),auth[_0x6610('0xb')](),controller[_0x6610('0x1b')]);router[_0x6610('0xa')](_0x6610('0x1c'),controller[_0x6610('0x1d')]);router[_0x6610('0xa')](_0x6610('0x1e'),auth[_0x6610('0xb')](),controller[_0x6610('0x1f')]);router[_0x6610('0xa')]('/:id/users',auth[_0x6610('0xb')](),controller[_0x6610('0x20')]);router['post']('/',auth[_0x6610('0xb')](),controller[_0x6610('0x21')]);router[_0x6610('0x22')](_0x6610('0xf'),auth['isAuthenticated'](),controller[_0x6610('0x23')]);router[_0x6610('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29248b,_0x1edb09,_0x331e1a){_0x331e1a(null,path[_0x6610('0x24')](config[_0x6610('0x25')],_0x6610('0x26')));},'filename':function(_0x56449f,_0x15d00a,_0x532642){_0x532642(null,util[_0x6610('0x27')]('%s-%s',Date[_0x6610('0x28')](),_0x15d00a['originalname']));}})});router[_0x6610('0x22')](_0x6610('0x29'),upload[_0x6610('0x2a')](_0x6610('0x2b')),controller[_0x6610('0x2c')]);var upload=multer({'storage':multer[_0x6610('0x2d')]({'destination':function(_0x127a3,_0x3a3d72,_0x40c09c){_0x40c09c(null,path[_0x6610('0x24')](config[_0x6610('0x25')],_0x6610('0x2e')));},'filename':function(_0x322d37,_0x2a0235,_0x811bd9){_0x811bd9(null,util[_0x6610('0x27')]('%s-%s',Date[_0x6610('0x28')](),_0x2a0235['originalname']));}})});router['post'](_0x6610('0x12'),upload[_0x6610('0x2a')](_0x6610('0x2b')),controller[_0x6610('0x2f')]);var upload=multer({'storage':multer[_0x6610('0x2d')]({'destination':function(_0x1c50b7,_0x9d9138,_0x47a46f){_0x47a46f(null,path[_0x6610('0x24')](config[_0x6610('0x25')],_0x6610('0x2e')));},'filename':function(_0x1c4fcb,_0x5e4699,_0x53f0f3){_0x53f0f3(null,util[_0x6610('0x27')]('%s-%s',Date[_0x6610('0x28')](),_0x5e4699[_0x6610('0x30')]));}})});router[_0x6610('0x22')](_0x6610('0x14'),upload[_0x6610('0x2a')](_0x6610('0x2b')),controller[_0x6610('0x31')]);var upload=multer({'storage':multer[_0x6610('0x2d')]({'destination':function(_0x496664,_0x2d6242,_0x5d7b99){_0x5d7b99(null,path[_0x6610('0x24')](config[_0x6610('0x25')],_0x6610('0x2e')));},'filename':function(_0x7e15f9,_0x3abdb3,_0x24133f){_0x24133f(null,util[_0x6610('0x27')]('%s-%s',Date[_0x6610('0x28')](),_0x3abdb3[_0x6610('0x30')]));}})});router['post'](_0x6610('0x15'),upload[_0x6610('0x2a')](_0x6610('0x2b')),controller[_0x6610('0x32')]);router[_0x6610('0x22')](_0x6610('0x33'),controller[_0x6610('0x34')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3cb609,_0x41f817,_0x307aeb){const _0x33f934=path[_0x6610('0x24')](config[_0x6610('0x25')],_0x6610('0x35'),'attachments',_0x6610('0x36'));fs_extra[_0x6610('0x37')](_0x33f934,function(){_0x307aeb(null,_0x33f934);});},'filename':function(_0x181c34,_0x5b3374,_0x24fe33){const _0x14f10f=_0x5b3374['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a2ec3=path[_0x6610('0x38')](_0x14f10f);const _0x269293=Date[_0x6610('0x28')]()+'-'+_0x14f10f['replace'](_0x2a2ec3,'')+_0x2a2ec3;_0x24fe33(null,_0x269293);}})});router[_0x6610('0x22')](_0x6610('0x39'),offlineUploadMulter[_0x6610('0x3a')](),controller[_0x6610('0x3b')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x6610('0x3c')]);router['post'](_0x6610('0x18'),auth[_0x6610('0xb')](),controller[_0x6610('0x3d')]);router[_0x6610('0x22')](_0x6610('0x1a'),auth['isAuthenticated'](),controller[_0x6610('0x3e')]);router[_0x6610('0x22')](_0x6610('0x3f'),auth[_0x6610('0xb')](),controller[_0x6610('0x40')]);router[_0x6610('0x41')](_0x6610('0xe'),auth[_0x6610('0xb')](),controller['update']);router['delete'](_0x6610('0xe'),auth[_0x6610('0xb')](),controller[_0x6610('0x42')]);router['delete']('/:id/dispositions',auth[_0x6610('0xb')](),controller[_0x6610('0x43')]);router[_0x6610('0x44')](_0x6610('0x10'),auth[_0x6610('0xb')](),controller[_0x6610('0x45')]);router['delete'](_0x6610('0x3f'),auth[_0x6610('0xb')](),controller[_0x6610('0x46')]);module[_0x6610('0x47')]=router; \ No newline at end of file +var _0xe195=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','/:id/logo','file','addLogo','single','addAvatar','server/files/images/avatars/','format','/:id/customer_avatar','addSystemAvatar','/:id/notify','attachments','ensureDir','replace','extname','offline','addInteraction','addApplications','addProactiveActions','update','delete','removeDispositions','removeAnswers','removeAgents','connect-timeout','express','Router','fs-extra','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xe195,0xb6));var _0x5e19=function(_0x294da6,_0x344235){_0x294da6=_0x294da6-0x0;var _0x4da15f=_0xe195[_0x294da6];return _0x4da15f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5e19('0x0'));var express=require(_0x5e19('0x1'));var router=express[_0x5e19('0x2')]();var fs_extra=require(_0x5e19('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x5e19('0x4')]('/',auth['isAuthenticated'](),controller[_0x5e19('0x5')]);router['get'](_0x5e19('0x6'),auth[_0x5e19('0x7')](),controller[_0x5e19('0x8')]);router[_0x5e19('0x4')](_0x5e19('0x9'),auth[_0x5e19('0x7')](),controller['show']);router[_0x5e19('0x4')](_0x5e19('0xa'),auth[_0x5e19('0x7')](),controller[_0x5e19('0xb')]);router[_0x5e19('0x4')](_0x5e19('0xc'),auth[_0x5e19('0x7')](),controller[_0x5e19('0xd')]);router[_0x5e19('0x4')]('/:id/logo',controller[_0x5e19('0xe')]);router['get'](_0x5e19('0xf'),controller[_0x5e19('0x10')]);router[_0x5e19('0x4')]('/:id/customer_avatar',controller[_0x5e19('0x11')]);router[_0x5e19('0x4')](_0x5e19('0x12'),controller['getSystemAvatar']);router[_0x5e19('0x4')](_0x5e19('0x13'),auth['isAuthenticated'](),controller[_0x5e19('0x14')]);router[_0x5e19('0x4')](_0x5e19('0x15'),controller[_0x5e19('0x16')]);router[_0x5e19('0x4')](_0x5e19('0x17'),auth[_0x5e19('0x7')](),controller['getApplications']);router[_0x5e19('0x4')](_0x5e19('0x18'),auth[_0x5e19('0x7')](),controller['getProactiveActions']);router[_0x5e19('0x4')](_0x5e19('0x19'),controller[_0x5e19('0x1a')]);router[_0x5e19('0x4')](_0x5e19('0x1b'),auth[_0x5e19('0x7')](),controller[_0x5e19('0x1c')]);router[_0x5e19('0x4')](_0x5e19('0x1d'),auth['isAuthenticated'](),controller[_0x5e19('0x1e')]);router[_0x5e19('0x1f')]('/',auth['isAuthenticated'](),controller[_0x5e19('0x20')]);router[_0x5e19('0x1f')](_0x5e19('0xa'),auth[_0x5e19('0x7')](),controller['addDisposition']);router[_0x5e19('0x1f')](_0x5e19('0xc'),auth[_0x5e19('0x7')](),controller[_0x5e19('0x21')]);var upload=multer({'storage':multer[_0x5e19('0x22')]({'destination':function(_0x576960,_0x4764f4,_0x5ab32e){_0x5ab32e(null,path[_0x5e19('0x23')](config[_0x5e19('0x24')],_0x5e19('0x25')));},'filename':function(_0x2fe685,_0x2ce3e8,_0x42c7b5){_0x42c7b5(null,util['format'](_0x5e19('0x26'),Date[_0x5e19('0x27')](),_0x2ce3e8[_0x5e19('0x28')]));}})});router[_0x5e19('0x1f')](_0x5e19('0x29'),upload['single'](_0x5e19('0x2a')),controller[_0x5e19('0x2b')]);var upload=multer({'storage':multer[_0x5e19('0x22')]({'destination':function(_0x1ccd1e,_0x39e8f3,_0x5d8c7c){_0x5d8c7c(null,path['join'](config[_0x5e19('0x24')],'server/files/images/avatars/'));},'filename':function(_0x4a5a6f,_0x214211,_0x166d90){_0x166d90(null,util['format'](_0x5e19('0x26'),Date[_0x5e19('0x27')](),_0x214211['originalname']));}})});router[_0x5e19('0x1f')](_0x5e19('0xf'),upload[_0x5e19('0x2c')](_0x5e19('0x2a')),controller[_0x5e19('0x2d')]);var upload=multer({'storage':multer[_0x5e19('0x22')]({'destination':function(_0x52082d,_0xcfc63,_0x34e758){_0x34e758(null,path[_0x5e19('0x23')](config[_0x5e19('0x24')],_0x5e19('0x2e')));},'filename':function(_0x52b07f,_0x37843a,_0x1a62ec){_0x1a62ec(null,util[_0x5e19('0x2f')](_0x5e19('0x26'),Date[_0x5e19('0x27')](),_0x37843a[_0x5e19('0x28')]));}})});router[_0x5e19('0x1f')](_0x5e19('0x30'),upload['single'](_0x5e19('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc384,_0x41a135,_0x38dd06){_0x38dd06(null,path[_0x5e19('0x23')](config[_0x5e19('0x24')],_0x5e19('0x2e')));},'filename':function(_0x1e3688,_0x134e1e,_0x305367){_0x305367(null,util[_0x5e19('0x2f')](_0x5e19('0x26'),Date[_0x5e19('0x27')](),_0x134e1e['originalname']));}})});router[_0x5e19('0x1f')](_0x5e19('0x12'),upload[_0x5e19('0x2c')](_0x5e19('0x2a')),controller[_0x5e19('0x31')]);router[_0x5e19('0x1f')](_0x5e19('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x5e19('0x22')]({'destination':function(_0x2dedeb,_0x169c55,_0x4f5b7b){const _0xe962ff=path['join'](config['root'],'server/files',_0x5e19('0x33'),'offline-chat');fs_extra[_0x5e19('0x34')](_0xe962ff,function(){_0x4f5b7b(null,_0xe962ff);});},'filename':function(_0x5f3929,_0x3ee29a,_0x5b57b7){const _0x13dda2=_0x3ee29a['originalname'][_0x5e19('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x412cbb=path[_0x5e19('0x36')](_0x13dda2);const _0x32ddde=Date['now']()+'-'+_0x13dda2[_0x5e19('0x35')](_0x412cbb,'')+_0x412cbb;_0x5b57b7(null,_0x32ddde);}})});router[_0x5e19('0x1f')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x5e19('0x37')]);router['post']('/:id/interactions',auth[_0x5e19('0x7')](),controller[_0x5e19('0x38')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x5e19('0x39')]);router[_0x5e19('0x1f')](_0x5e19('0x18'),auth[_0x5e19('0x7')](),controller[_0x5e19('0x3a')]);router[_0x5e19('0x1f')](_0x5e19('0x1d'),auth[_0x5e19('0x7')](),controller['addAgents']);router['put'](_0x5e19('0x9'),auth[_0x5e19('0x7')](),controller[_0x5e19('0x3b')]);router[_0x5e19('0x3c')](_0x5e19('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x5e19('0x3c')](_0x5e19('0xa'),auth['isAuthenticated'](),controller[_0x5e19('0x3d')]);router[_0x5e19('0x3c')]('/:id/canned_answers',auth[_0x5e19('0x7')](),controller[_0x5e19('0x3e')]);router[_0x5e19('0x3c')](_0x5e19('0x1d'),auth[_0x5e19('0x7')](),controller[_0x5e19('0x3f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index dad775b..73e4040 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf28=['beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','isAuthenticated'];(function(_0xb2e868,_0x3b2184){var _0x172f42=function(_0x593f9c){while(--_0x593f9c){_0xb2e868['push'](_0xb2e868['shift']());}};_0x172f42(++_0x3b2184);}(_0xaf28,0x1b8));var _0x8af2=function(_0x4aff38,_0x532d4f){_0x4aff38=_0x4aff38-0x0;var _0x300a0b=_0xaf28[_0x4aff38];return _0x300a0b;};var beaverLogger=require(_0x8af2('0x0'));var express=require(_0x8af2('0x1'));var auth=require(_0x8af2('0x2'));var config=require(_0x8af2('0x3'));var router=express[_0x8af2('0x4')]();var isProduction=config[_0x8af2('0x5')]==='production'||![];function clientSideLogs(_0x219eb2,_0x1f5542,_0x1736a3){var _0x2ca223=_0x219eb2[_0x8af2('0x6')]['get'](_0x8af2('0x7'));if(!_0x2ca223){throw new Error(_0x8af2('0x8'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x2ca223,'enableCors':!isProduction})(_0x219eb2,_0x1f5542,_0x1736a3);}router['use'](auth[_0x8af2('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xe0c1=['app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe0c1,0xa3));var _0x1e0c=function(_0x18b110,_0x27425c){_0x18b110=_0x18b110-0x0;var _0x150b6c=_0xe0c1[_0x18b110];return _0x150b6c;};var beaverLogger=require(_0x1e0c('0x0'));var express=require(_0x1e0c('0x1'));var auth=require(_0x1e0c('0x2'));var config=require('../config/environment');var router=express[_0x1e0c('0x3')]();var isProduction=config[_0x1e0c('0x4')]==='production'||![];function clientSideLogs(_0x5c1623,_0x1a0ccb,_0x357a97){var _0x264f9b=_0x5c1623[_0x1e0c('0x5')]['get'](_0x1e0c('0x6'));if(!_0x264f9b){throw new Error(_0x1e0c('0x7'));}return beaverLogger[_0x1e0c('0x8')]({'uri':_0x1e0c('0x9'),'logger':_0x264f9b,'enableCors':!isProduction})(_0x5c1623,_0x1a0ccb,_0x357a97);}router['use'](auth[_0x1e0c('0xa')](),clientSideLogs);module[_0x1e0c('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b34cf85..5704fbc 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea31=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xea31,0xd8));var _0x1ea3=function(_0x1a850e,_0x3f5312){_0x1a850e=_0x1a850e-0x0;var _0x285c5a=_0xea31[_0x1a850e];return _0x285c5a;};'use strict';var Sequelize=require(_0x1ea3('0x0'));module[_0x1ea3('0x1')]={'name':{'type':Sequelize[_0x1ea3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1ea3('0x3')](_0x1ea3('0x4'),_0x1ea3('0x5'),_0x1ea3('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x1ea3('0x3')](_0x1ea3('0x7'),_0x1ea3('0x8'))},'data1':{'type':Sequelize[_0x1ea3('0x2')],'comment':_0x1ea3('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0x1ea3('0xa')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x1ea3('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0x1ea3('0xc')},'data6':{'type':Sequelize[_0x1ea3('0xd')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0x1ea3('0xe')}}; \ No newline at end of file +var _0xce00=['STRING','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20tenant','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports'];(function(_0x5ea12c,_0x58685d){var _0x4e3711=function(_0x2aeb19){while(--_0x2aeb19){_0x5ea12c['push'](_0x5ea12c['shift']());}};_0x4e3711(++_0x58685d);}(_0xce00,0xfb));var _0x0ce0=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xce00[_0x5c2e5e];return _0x46a5da;};'use strict';var Sequelize=require(_0x0ce0('0x0'));module[_0x0ce0('0x1')]={'name':{'type':Sequelize[_0x0ce0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x0ce0('0x3'),_0x0ce0('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0ce0('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x0ce0('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x0ce0('0x6')},'data3':{'type':Sequelize[_0x0ce0('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x0ce0('0x7')],'comment':_0x0ce0('0x8')},'data6':{'type':Sequelize[_0x0ce0('0x7')],'comment':_0x0ce0('0x9')},'data7':{'type':Sequelize[_0x0ce0('0x7')],'comment':_0x0ce0('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 409faa8..9438fc2 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f38=['send','padEnd','index','CloudProvider','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','create','body','Name\x20parameter\x20not\x20specified','rawAttributes','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','error','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','json','undefined','limit','count','offset','status','Content-Range','update','then','end','stack','name'];(function(_0x207cf0,_0x450001){var _0x4e98a6=function(_0x25e7e1){while(--_0x25e7e1){_0x207cf0['push'](_0x207cf0['shift']());}};_0x4e98a6(++_0x450001);}(_0x7f38,0x102));var _0x87f3=function(_0x568bf2,_0x2258c4){_0x568bf2=_0x568bf2-0x0;var _0x294089=_0x7f38[_0x568bf2];return _0x294089;};'use strict';var _=require(_0x87f3('0x0'));var Redis=require(_0x87f3('0x1'));var qs=require(_0x87f3('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x87f3('0x3'))(_0x87f3('0x4'));var db=require(_0x87f3('0x5'))['db'];var oauth=require(_0x87f3('0x6'));config[_0x87f3('0x7')]=_[_0x87f3('0x8')](config[_0x87f3('0x7')],{'host':_0x87f3('0x9'),'port':0x18eb});var socket=require(_0x87f3('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x87f3('0x7')]);function respondWithStatusCode(_0x37eae3,_0x403718){_0x403718=_0x403718||0xcc;return function(_0x40eb7a){if(_0x40eb7a){return _0x37eae3[_0x87f3('0xb')](_0x403718);}return _0x37eae3['status'](_0x403718)['end']();};}function respondWithResult(_0x3c65d7,_0x108b08){_0x108b08=_0x108b08||0xc8;return function(_0x17ca7a){if(_0x17ca7a){return _0x3c65d7['status'](_0x108b08)[_0x87f3('0xc')](_0x17ca7a);}};}function respondWithFilteredResult(_0x31202a,_0x5769fa){return function(_0x4ad493){if(_0x4ad493){var _0x2b9505=typeof _0x5769fa['offset']===_0x87f3('0xd')&&typeof _0x5769fa[_0x87f3('0xe')]===_0x87f3('0xd');var _0x4d0e45=_0x4ad493[_0x87f3('0xf')];var _0x489add=_0x2b9505?0x0:_0x5769fa[_0x87f3('0x10')];var _0x260555=_0x2b9505?_0x4ad493[_0x87f3('0xf')]:_0x5769fa[_0x87f3('0x10')]+_0x5769fa[_0x87f3('0xe')];var _0x4f17fe;if(_0x260555>=_0x4d0e45){_0x260555=_0x4d0e45;_0x4f17fe=0xc8;}else{_0x4f17fe=0xce;}_0x31202a[_0x87f3('0x11')](_0x4f17fe);return _0x31202a['set'](_0x87f3('0x12'),_0x489add+'-'+_0x260555+'/'+_0x4d0e45)['json'](_0x4ad493);}return null;};}function saveUpdates(_0x2b4384){return function(_0x4a7866){if(_0x4a7866){return _0x4a7866[_0x87f3('0x13')](_0x2b4384)[_0x87f3('0x14')](function(_0x4b5a01){return _0x4b5a01;});}return null;};}function removeEntity(_0x116673){return function(_0x22a183){if(_0x22a183){return _0x22a183['destroy']()[_0x87f3('0x14')](function(){_0x116673[_0x87f3('0x11')](0xcc)[_0x87f3('0x15')]();});}};}function handleEntityNotFound(_0x623d07){return function(_0x509353){if(!_0x509353){_0x623d07[_0x87f3('0xb')](0x194);}return _0x509353;};}function handleError(_0x4a6ae9,_0x36221b){_0x36221b=_0x36221b||0x1f4;return function(_0x3370b0){logger['error'](_0x3370b0[_0x87f3('0x16')]);if(_0x3370b0[_0x87f3('0x17')]){delete _0x3370b0['name'];}_0x4a6ae9[_0x87f3('0x11')](_0x36221b)[_0x87f3('0x18')](_0x3370b0);};}function maskClientSecret(_0x36224f){return _[_0x87f3('0x19')](_0x36224f['slice'](0x0,0x3),0x14,'*');}exports[_0x87f3('0x1a')]=function(_0x17e105,_0x166495){var _0x542b83={},_0x2c43e7={},_0x1826ed={'count':0x0,'rows':[]};var _0x2c913e=_['map'](db[_0x87f3('0x1b')]['rawAttributes'],function(_0x3a4094){return{'name':_0x3a4094[_0x87f3('0x1c')],'type':_0x3a4094['type'][_0x87f3('0x1d')]};});_0x2c43e7['model']=_[_0x87f3('0x1e')](_0x2c913e,'name');_0x2c43e7[_0x87f3('0x1f')]=_[_0x87f3('0x20')](_0x17e105['query']);_0x2c43e7[_0x87f3('0x21')]=_[_0x87f3('0x22')](_0x2c43e7['model'],_0x2c43e7[_0x87f3('0x1f')]);_0x542b83['attributes']=_['intersection'](_0x2c43e7[_0x87f3('0x23')],qs[_0x87f3('0x24')](_0x17e105[_0x87f3('0x1f')]['fields']));_0x542b83['attributes']=_0x542b83[_0x87f3('0x25')][_0x87f3('0x26')]?_0x542b83[_0x87f3('0x25')]:_0x2c43e7[_0x87f3('0x23')];if(!_0x17e105[_0x87f3('0x1f')][_0x87f3('0x27')]('nolimit')){_0x542b83[_0x87f3('0xe')]=qs[_0x87f3('0xe')](_0x17e105[_0x87f3('0x1f')][_0x87f3('0xe')]);_0x542b83[_0x87f3('0x10')]=qs['offset'](_0x17e105[_0x87f3('0x1f')][_0x87f3('0x10')]);}_0x542b83[_0x87f3('0x28')]=qs[_0x87f3('0x29')](_0x17e105[_0x87f3('0x1f')][_0x87f3('0x29')]);_0x542b83[_0x87f3('0x2a')]=qs[_0x87f3('0x21')](_['pick'](_0x17e105[_0x87f3('0x1f')],_0x2c43e7[_0x87f3('0x21')]),_0x2c913e);if(_0x17e105[_0x87f3('0x1f')][_0x87f3('0x2b')]){_0x542b83[_0x87f3('0x2a')]=_[_0x87f3('0x2c')](_0x542b83[_0x87f3('0x2a')],{'$or':_[_0x87f3('0x1e')](_0x2c913e,function(_0x25eb94){if(_0x25eb94[_0x87f3('0x2d')]!==_0x87f3('0x2e')){var _0x43f405={};_0x43f405[_0x25eb94[_0x87f3('0x17')]]={'$like':'%'+_0x17e105[_0x87f3('0x1f')][_0x87f3('0x2b')]+'%'};return _0x43f405;}})});}_0x542b83=_['merge']({},_0x542b83,_0x17e105[_0x87f3('0x2f')]);var _0x52573c={'where':_0x542b83[_0x87f3('0x2a')]};return db['CloudProvider'][_0x87f3('0xf')](_0x52573c)[_0x87f3('0x14')](function(_0x3f293d){_0x1826ed[_0x87f3('0xf')]=_0x3f293d;if(_0x17e105[_0x87f3('0x1f')][_0x87f3('0x30')]){_0x542b83[_0x87f3('0x31')]=[{'all':!![]}];}return db[_0x87f3('0x1b')][_0x87f3('0x32')](_0x542b83);})[_0x87f3('0x14')](function(_0x534ff1){_0x1826ed[_0x87f3('0x33')]=_['map'](_0x534ff1,function(_0x5978cd){if(_0x5978cd[_0x87f3('0x34')]===_0x87f3('0x35')){var _0x4aa095=encryptor[_0x87f3('0x36')](_0x5978cd[_0x87f3('0x37')]);_0x5978cd[_0x87f3('0x37')]=maskClientSecret(_0x4aa095);}return _0x5978cd;});return _0x1826ed;})[_0x87f3('0x14')](respondWithFilteredResult(_0x166495,_0x542b83))[_0x87f3('0x38')](handleError(_0x166495,null));};exports['show']=function(_0x80e992,_0x231bba){var _0x413b65={'raw':!![],'where':{'id':_0x80e992[_0x87f3('0x39')]['id']}},_0x4ba6f8={};_0x4ba6f8[_0x87f3('0x23')]=_[_0x87f3('0x20')](db['CloudProvider']['rawAttributes']);_0x4ba6f8['query']=_[_0x87f3('0x20')](_0x80e992[_0x87f3('0x1f')]);_0x4ba6f8[_0x87f3('0x21')]=_['intersection'](_0x4ba6f8[_0x87f3('0x23')],_0x4ba6f8['query']);_0x413b65[_0x87f3('0x25')]=_[_0x87f3('0x22')](_0x4ba6f8[_0x87f3('0x23')],qs[_0x87f3('0x24')](_0x80e992[_0x87f3('0x1f')][_0x87f3('0x24')]));_0x413b65[_0x87f3('0x25')]=_0x413b65['attributes'][_0x87f3('0x26')]?_0x413b65[_0x87f3('0x25')]:_0x4ba6f8['model'];if(_0x80e992['query']['includeAll']){_0x413b65['include']=[{'all':!![]}];}_0x413b65=_['merge']({},_0x413b65,_0x80e992['options']);return db['CloudProvider']['find'](_0x413b65)['then'](handleEntityNotFound(_0x231bba,null))[_0x87f3('0x14')](function(_0x3266bc){if(_0x3266bc[_0x87f3('0x34')]===_0x87f3('0x35')){var _0x1fe05e=encryptor[_0x87f3('0x36')](_0x3266bc['data3']);_0x3266bc['data3']=maskClientSecret(_0x1fe05e);}return _0x3266bc;})[_0x87f3('0x14')](respondWithResult(_0x231bba,null))[_0x87f3('0x38')](handleError(_0x231bba,null));};exports[_0x87f3('0x3a')]=function(_0x3b6592,_0x34432b){if(!_0x3b6592[_0x87f3('0x3b')]['name'])throw new Error(_0x87f3('0x3c'));if(!_0x3b6592[_0x87f3('0x3b')][_0x87f3('0x34')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x464715=db[_0x87f3('0x1b')][_0x87f3('0x3d')]['service'][_0x87f3('0x3e')];if(!_0x464715[_0x87f3('0x3f')](_0x3b6592[_0x87f3('0x3b')][_0x87f3('0x34')]))throw new Error(_0x87f3('0x40')+_0x464715[_0x87f3('0x41')](',\x20'));if(_0x3b6592[_0x87f3('0x3b')][_0x87f3('0x34')]===_0x87f3('0x35')&&_0x3b6592[_0x87f3('0x3b')][_0x87f3('0x37')]){_0x3b6592[_0x87f3('0x3b')][_0x87f3('0x37')]=encryptor[_0x87f3('0x42')](_0x3b6592['body']['data3']);}return db['CloudProvider'][_0x87f3('0x3a')](_0x3b6592[_0x87f3('0x3b')],{})['then'](respondWithResult(_0x34432b,0xc9))[_0x87f3('0x38')](handleError(_0x34432b,null));};exports[_0x87f3('0x13')]=function(_0x3c21f1,_0x1bd35a){if(_0x3c21f1[_0x87f3('0x3b')]['id']){delete _0x3c21f1[_0x87f3('0x3b')]['id'];}return db['CloudProvider'][_0x87f3('0x43')]({'where':{'id':_0x3c21f1[_0x87f3('0x39')]['id']}})[_0x87f3('0x14')](handleEntityNotFound(_0x1bd35a,null))['then'](function(_0x8f0ebd){if(_0x8f0ebd[_0x87f3('0x34')]===_0x87f3('0x35')&&_0x3c21f1['body'][_0x87f3('0x37')]){_0x3c21f1[_0x87f3('0x3b')][_0x87f3('0x37')]=encryptor[_0x87f3('0x42')](_0x3c21f1[_0x87f3('0x3b')][_0x87f3('0x37')]);}return _0x8f0ebd;})['then'](saveUpdates(_0x3c21f1[_0x87f3('0x3b')],null))[_0x87f3('0x14')](respondWithResult(_0x1bd35a,null))[_0x87f3('0x38')](handleError(_0x1bd35a,null));};exports[_0x87f3('0x44')]=function(_0x51b170,_0x1fb23e){return db[_0x87f3('0x1b')]['find']({'where':{'id':_0x51b170['params']['id']}})[_0x87f3('0x14')](handleEntityNotFound(_0x1fb23e,null))[_0x87f3('0x14')](removeEntity(_0x1fb23e,null))[_0x87f3('0x38')](handleError(_0x1fb23e,null));};exports[_0x87f3('0x45')]=function(_0x55ec03,_0xfb81e4){return db[_0x87f3('0x1b')][_0x87f3('0x46')]({'where':{'id':_0x55ec03[_0x87f3('0x39')]['id']},'raw':!![]})[_0x87f3('0x14')](function(_0x21104c){if(!_0x21104c)return _0xfb81e4[_0x87f3('0xb')](0x194);return{'url':oauth[_0x87f3('0x47')](_0x21104c,_0x55ec03[_0x87f3('0x48')]['id'])};})['then'](respondWithResult(_0xfb81e4,null))['catch'](handleError(_0xfb81e4,null));};exports['oauth2MicrosoftCallback']=function(_0x5a786f,_0x20989a){var _0x3cf231=_0x5a786f[_0x87f3('0x3b')];var _0x5cccb0;var _0x1570f4;if(_0x3cf231[_0x87f3('0x49')])throw _0x3cf231;redis[_0x87f3('0x4a')](_0x3cf231[_0x87f3('0x4b')])[_0x87f3('0x14')](function(_0x11f5d1){if(!_0x11f5d1)throw new Error(_0x87f3('0x4c'));_0x5cccb0=JSON[_0x87f3('0x4d')](_0x11f5d1);var _0x22dbae=Buffer[_0x87f3('0x4e')](_0x3cf231['state'],'base64')[_0x87f3('0x4f')](_0x87f3('0x50'));_0x1570f4=JSON['parse'](_0x22dbae);if(!oauth['isValidIdToken'](_0x3cf231['id_token'],_0x5cccb0[_0x87f3('0x51')]))throw new Error(_0x87f3('0x52'));redis['del'](_0x3cf231['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x3cf231[_0x87f3('0x53')],_0x5cccb0);})[_0x87f3('0x14')](function(_0x37af1c){_0x5cccb0[_0x87f3('0x54')]=_0x37af1c[_0x87f3('0x55')];_0x5cccb0[_0x87f3('0x56')]=_0x37af1c['refresh_token'];return db[_0x87f3('0x1b')][_0x87f3('0x13')]({'data5':_0x5cccb0[_0x87f3('0x54')],'data6':_0x5cccb0[_0x87f3('0x56')]},{'where':{'id':_0x5cccb0['id']}});})[_0x87f3('0x14')](function(){oauth[_0x87f3('0x57')](_0x5cccb0);socket[_0x87f3('0x58')](_0x87f3('0x59'),{'id':_0x1570f4['id']});return;})[_0x87f3('0x14')](respondWithStatusCode(_0x20989a,null))[_0x87f3('0x38')](function(_0x2b1e14){if(_0x1570f4){socket[_0x87f3('0x58')](_0x87f3('0x5a'),{'id':_0x1570f4['id']});}if(!_0x5cccb0){logger[_0x87f3('0x49')](_0x87f3('0x5b'),_0x2b1e14);return _0x20989a[_0x87f3('0x11')](0x1f4)[_0x87f3('0x18')](_0x2b1e14[_0x87f3('0x5c')]);}logger['error'](_0x87f3('0x5d'),_0x5cccb0['id'],JSON['stringify'](_0x2b1e14));});}; \ No newline at end of file +var _0xe42a=['emit','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','error','name','send','slice','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','CloudProvider','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','fields','length','merge','create','body','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','find','encryptString','oauth2MicrosoftAuthorize','findOne','user','get','state','Invalid\x20state\x20parameter','from','base64','parse','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','startRefreshInterval'];(function(_0xbf241a,_0x3dbf65){var _0x10e1b1=function(_0x2fd9db){while(--_0x2fd9db){_0xbf241a['push'](_0xbf241a['shift']());}};_0x10e1b1(++_0x3dbf65);}(_0xe42a,0x116));var _0xae42=function(_0x361c12,_0x3d0085){_0x361c12=_0x361c12-0x0;var _0x4529c1=_0xe42a[_0x361c12];return _0x4529c1;};'use strict';var _=require(_0xae42('0x0'));var Redis=require(_0xae42('0x1'));var qs=require(_0xae42('0x2'));var encryptor=require(_0xae42('0x3'));var config=require(_0xae42('0x4'));var logger=require('../../config/logger')(_0xae42('0x5'));var db=require(_0xae42('0x6'))['db'];var oauth=require(_0xae42('0x7'));config[_0xae42('0x8')]=_['defaults'](config['redis'],{'host':_0xae42('0x9'),'port':0x18eb});var socket=require(_0xae42('0xa'))(new Redis(config[_0xae42('0x8')]));var redis=new Redis(config[_0xae42('0x8')]);function respondWithStatusCode(_0x103fd9,_0x414245){_0x414245=_0x414245||0xcc;return function(_0x27486d){if(_0x27486d){return _0x103fd9[_0xae42('0xb')](_0x414245);}return _0x103fd9[_0xae42('0xc')](_0x414245)['end']();};}function respondWithResult(_0xa5de7a,_0x45fb9f){_0x45fb9f=_0x45fb9f||0xc8;return function(_0x436ef6){if(_0x436ef6){return _0xa5de7a['status'](_0x45fb9f)[_0xae42('0xd')](_0x436ef6);}};}function respondWithFilteredResult(_0x5b9b68,_0x1361e4){return function(_0x5f1960){if(_0x5f1960){var _0x561cba=typeof _0x1361e4[_0xae42('0xe')]===_0xae42('0xf')&&typeof _0x1361e4['limit']===_0xae42('0xf');var _0x5c1b5d=_0x5f1960[_0xae42('0x10')];var _0x4dea42=_0x561cba?0x0:_0x1361e4[_0xae42('0xe')];var _0x5afe25=_0x561cba?_0x5f1960[_0xae42('0x10')]:_0x1361e4[_0xae42('0xe')]+_0x1361e4['limit'];var _0x24bd50;if(_0x5afe25>=_0x5c1b5d){_0x5afe25=_0x5c1b5d;_0x24bd50=0xc8;}else{_0x24bd50=0xce;}_0x5b9b68[_0xae42('0xc')](_0x24bd50);return _0x5b9b68[_0xae42('0x11')](_0xae42('0x12'),_0x4dea42+'-'+_0x5afe25+'/'+_0x5c1b5d)['json'](_0x5f1960);}return null;};}function saveUpdates(_0x3f1d21){return function(_0x3534be){if(_0x3534be){return _0x3534be[_0xae42('0x13')](_0x3f1d21)[_0xae42('0x14')](function(_0x2b025e){return _0x2b025e;});}return null;};}function removeEntity(_0x3c81bb){return function(_0x423607){if(_0x423607){return _0x423607[_0xae42('0x15')]()[_0xae42('0x14')](function(){_0x3c81bb[_0xae42('0xc')](0xcc)[_0xae42('0x16')]();});}};}function handleEntityNotFound(_0x38ccca){return function(_0x3cbc35){if(!_0x3cbc35){_0x38ccca[_0xae42('0xb')](0x194);}return _0x3cbc35;};}function handleError(_0x3d1a10,_0x45993a){_0x45993a=_0x45993a||0x1f4;return function(_0x48ed86){logger[_0xae42('0x17')](_0x48ed86['stack']);if(_0x48ed86[_0xae42('0x18')]){delete _0x48ed86['name'];}_0x3d1a10[_0xae42('0xc')](_0x45993a)[_0xae42('0x19')](_0x48ed86);};}function maskClientSecret(_0x200cac){return _['padEnd'](_0x200cac[_0xae42('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0xd3f05a,_0xbde4b1){var _0x272f4c={},_0x5380e2={},_0x2bf416={'count':0x0,'rows':[]};var _0xb5f5b9=_[_0xae42('0x1b')](db['CloudProvider'][_0xae42('0x1c')],function(_0x2f595f){return{'name':_0x2f595f['fieldName'],'type':_0x2f595f[_0xae42('0x1d')][_0xae42('0x1e')]};});_0x5380e2['model']=_[_0xae42('0x1b')](_0xb5f5b9,_0xae42('0x18'));_0x5380e2[_0xae42('0x1f')]=_[_0xae42('0x20')](_0xd3f05a[_0xae42('0x1f')]);_0x5380e2[_0xae42('0x21')]=_[_0xae42('0x22')](_0x5380e2[_0xae42('0x23')],_0x5380e2[_0xae42('0x1f')]);_0x272f4c[_0xae42('0x24')]=_[_0xae42('0x22')](_0x5380e2[_0xae42('0x23')],qs['fields'](_0xd3f05a[_0xae42('0x1f')]['fields']));_0x272f4c[_0xae42('0x24')]=_0x272f4c[_0xae42('0x24')]['length']?_0x272f4c['attributes']:_0x5380e2[_0xae42('0x23')];if(!_0xd3f05a[_0xae42('0x1f')][_0xae42('0x25')](_0xae42('0x26'))){_0x272f4c[_0xae42('0x27')]=qs[_0xae42('0x27')](_0xd3f05a[_0xae42('0x1f')][_0xae42('0x27')]);_0x272f4c[_0xae42('0xe')]=qs['offset'](_0xd3f05a['query'][_0xae42('0xe')]);}_0x272f4c[_0xae42('0x28')]=qs['sort'](_0xd3f05a['query'][_0xae42('0x29')]);_0x272f4c[_0xae42('0x2a')]=qs['filters'](_[_0xae42('0x2b')](_0xd3f05a['query'],_0x5380e2['filters']),_0xb5f5b9);if(_0xd3f05a[_0xae42('0x1f')][_0xae42('0x2c')]){_0x272f4c[_0xae42('0x2a')]=_['merge'](_0x272f4c[_0xae42('0x2a')],{'$or':_[_0xae42('0x1b')](_0xb5f5b9,function(_0x3fad54){if(_0x3fad54[_0xae42('0x1d')]!=='VIRTUAL'){var _0x5e3077={};_0x5e3077[_0x3fad54[_0xae42('0x18')]]={'$like':'%'+_0xd3f05a[_0xae42('0x1f')][_0xae42('0x2c')]+'%'};return _0x5e3077;}})});}_0x272f4c=_['merge']({},_0x272f4c,_0xd3f05a[_0xae42('0x2d')]);var _0xccc8a={'where':_0x272f4c[_0xae42('0x2a')]};return db[_0xae42('0x2e')]['count'](_0xccc8a)[_0xae42('0x14')](function(_0x204b3b){_0x2bf416[_0xae42('0x10')]=_0x204b3b;if(_0xd3f05a[_0xae42('0x1f')][_0xae42('0x2f')]){_0x272f4c[_0xae42('0x30')]=[{'all':!![]}];}return db[_0xae42('0x2e')][_0xae42('0x31')](_0x272f4c);})[_0xae42('0x14')](function(_0xe76683){_0x2bf416[_0xae42('0x32')]=_[_0xae42('0x1b')](_0xe76683,function(_0x595284){if(_0x595284[_0xae42('0x33')]===_0xae42('0x34')){var _0x21f5ad=encryptor[_0xae42('0x35')](_0x595284['data3']);_0x595284[_0xae42('0x36')]=maskClientSecret(_0x21f5ad);}return _0x595284;});return _0x2bf416;})[_0xae42('0x14')](respondWithFilteredResult(_0xbde4b1,_0x272f4c))[_0xae42('0x37')](handleError(_0xbde4b1,null));};exports[_0xae42('0x38')]=function(_0x441037,_0xea6164){var _0xce3fff={'raw':!![],'where':{'id':_0x441037[_0xae42('0x39')]['id']}},_0x267af9={};_0x267af9['model']=_[_0xae42('0x20')](db['CloudProvider']['rawAttributes']);_0x267af9[_0xae42('0x1f')]=_[_0xae42('0x20')](_0x441037[_0xae42('0x1f')]);_0x267af9[_0xae42('0x21')]=_[_0xae42('0x22')](_0x267af9['model'],_0x267af9[_0xae42('0x1f')]);_0xce3fff[_0xae42('0x24')]=_[_0xae42('0x22')](_0x267af9['model'],qs['fields'](_0x441037[_0xae42('0x1f')][_0xae42('0x3a')]));_0xce3fff[_0xae42('0x24')]=_0xce3fff['attributes'][_0xae42('0x3b')]?_0xce3fff[_0xae42('0x24')]:_0x267af9[_0xae42('0x23')];if(_0x441037['query'][_0xae42('0x2f')]){_0xce3fff[_0xae42('0x30')]=[{'all':!![]}];}_0xce3fff=_[_0xae42('0x3c')]({},_0xce3fff,_0x441037[_0xae42('0x2d')]);return db[_0xae42('0x2e')]['find'](_0xce3fff)[_0xae42('0x14')](handleEntityNotFound(_0xea6164,null))[_0xae42('0x14')](function(_0x7a5941){if(_0x7a5941[_0xae42('0x33')]===_0xae42('0x34')){var _0x7747d3=encryptor[_0xae42('0x35')](_0x7a5941['data3']);_0x7a5941['data3']=maskClientSecret(_0x7747d3);}return _0x7a5941;})[_0xae42('0x14')](respondWithResult(_0xea6164,null))['catch'](handleError(_0xea6164,null));};exports[_0xae42('0x3d')]=function(_0x3fa027,_0x1d0c06){if(!_0x3fa027[_0xae42('0x3e')][_0xae42('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3fa027['body'][_0xae42('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x18a221=db[_0xae42('0x2e')]['rawAttributes'][_0xae42('0x33')]['values'];if(!_0x18a221[_0xae42('0x3f')](_0x3fa027[_0xae42('0x3e')]['service']))throw new Error(_0xae42('0x40')+_0x18a221[_0xae42('0x41')](',\x20'));if(_0x3fa027['body']['service']===_0xae42('0x34')&&_0x3fa027[_0xae42('0x3e')]['data3']){_0x3fa027[_0xae42('0x3e')][_0xae42('0x36')]=encryptor['encryptString'](_0x3fa027['body']['data3']);}return db[_0xae42('0x2e')][_0xae42('0x3d')](_0x3fa027[_0xae42('0x3e')],{})[_0xae42('0x14')](respondWithResult(_0x1d0c06,0xc9))[_0xae42('0x37')](handleError(_0x1d0c06,null));};exports[_0xae42('0x13')]=function(_0x8773d4,_0x287c6c){if(_0x8773d4[_0xae42('0x3e')]['id']){delete _0x8773d4['body']['id'];}return db[_0xae42('0x2e')][_0xae42('0x42')]({'where':{'id':_0x8773d4[_0xae42('0x39')]['id']}})[_0xae42('0x14')](handleEntityNotFound(_0x287c6c,null))[_0xae42('0x14')](function(_0x2ed2ba){if(_0x2ed2ba[_0xae42('0x33')]===_0xae42('0x34')&&_0x8773d4['body'][_0xae42('0x36')]){_0x8773d4[_0xae42('0x3e')][_0xae42('0x36')]=encryptor[_0xae42('0x43')](_0x8773d4['body'][_0xae42('0x36')]);}return _0x2ed2ba;})['then'](saveUpdates(_0x8773d4[_0xae42('0x3e')],null))[_0xae42('0x14')](respondWithResult(_0x287c6c,null))[_0xae42('0x37')](handleError(_0x287c6c,null));};exports[_0xae42('0x15')]=function(_0x3ea2c4,_0x5480e1){return db[_0xae42('0x2e')][_0xae42('0x42')]({'where':{'id':_0x3ea2c4[_0xae42('0x39')]['id']}})[_0xae42('0x14')](handleEntityNotFound(_0x5480e1,null))[_0xae42('0x14')](removeEntity(_0x5480e1,null))[_0xae42('0x37')](handleError(_0x5480e1,null));};exports[_0xae42('0x44')]=function(_0x1afeca,_0x477bd1){return db[_0xae42('0x2e')][_0xae42('0x45')]({'where':{'id':_0x1afeca['params']['id']},'raw':!![]})['then'](function(_0x55411e){if(!_0x55411e)return _0x477bd1[_0xae42('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x55411e,_0x1afeca[_0xae42('0x46')]['id'])};})[_0xae42('0x14')](respondWithResult(_0x477bd1,null))[_0xae42('0x37')](handleError(_0x477bd1,null));};exports['oauth2MicrosoftCallback']=function(_0x4fee37,_0x444797){var _0x249adb=_0x4fee37[_0xae42('0x3e')];var _0x3ae68e;var _0x2dbfe0;if(_0x249adb[_0xae42('0x17')])throw _0x249adb;redis[_0xae42('0x47')](_0x249adb[_0xae42('0x48')])['then'](function(_0x27a056){if(!_0x27a056)throw new Error(_0xae42('0x49'));_0x3ae68e=JSON['parse'](_0x27a056);var _0xd60e3e=Buffer[_0xae42('0x4a')](_0x249adb['state'],_0xae42('0x4b'))['toString']('ascii');_0x2dbfe0=JSON[_0xae42('0x4c')](_0xd60e3e);if(!oauth[_0xae42('0x4d')](_0x249adb[_0xae42('0x4e')],_0x3ae68e['oauth2Claims']))throw new Error(_0xae42('0x4f'));redis[_0xae42('0x50')](_0x249adb[_0xae42('0x48')]);return oauth[_0xae42('0x51')](_0x249adb['code'],_0x3ae68e);})[_0xae42('0x14')](function(_0x51458c){_0x3ae68e[_0xae42('0x52')]=_0x51458c[_0xae42('0x53')];_0x3ae68e[_0xae42('0x54')]=_0x51458c['refresh_token'];return db[_0xae42('0x2e')][_0xae42('0x13')]({'data5':_0x3ae68e[_0xae42('0x52')],'data6':_0x3ae68e[_0xae42('0x54')]},{'where':{'id':_0x3ae68e['id']}});})[_0xae42('0x14')](function(){oauth[_0xae42('0x55')](_0x3ae68e);socket[_0xae42('0x56')]('microsoftAuthorization:success',{'id':_0x2dbfe0['id']});return;})['then'](respondWithStatusCode(_0x444797,null))[_0xae42('0x37')](function(_0x2973d6){if(_0x2dbfe0){socket[_0xae42('0x56')](_0xae42('0x57'),{'id':_0x2dbfe0['id']});}if(!_0x3ae68e){logger[_0xae42('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x2973d6);return _0x444797[_0xae42('0xc')](0x1f4)[_0xae42('0x19')](_0x2973d6[_0xae42('0x58')]);}logger[_0xae42('0x17')](_0xae42('0x59'),_0x3ae68e['id'],JSON[_0xae42('0x5a')](_0x2973d6));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 296b1ac..c21a924 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x158d=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3d7a7a,_0x5ad2eb){var _0x422fea=function(_0x5ccf20){while(--_0x5ccf20){_0x3d7a7a['push'](_0x3d7a7a['shift']());}};_0x422fea(++_0x5ad2eb);}(_0x158d,0x1b5));var _0xd158=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x158d[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0xd158('0x0'));var util=require(_0xd158('0x1'));var logger=require(_0xd158('0x2'))('api');var moment=require(_0xd158('0x3'));var BPromise=require(_0xd158('0x4'));var rp=require(_0xd158('0x5'));var fs=require('fs');var path=require(_0xd158('0x6'));var rimraf=require(_0xd158('0x7'));var config=require(_0xd158('0x8'));var attributes=require(_0xd158('0x9'));module[_0xd158('0xa')]=function(_0x5dc9bf,_0x62cce8){return _0x5dc9bf[_0xd158('0xb')]('CloudProvider',attributes,{'tableName':_0xd158('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa95e=['CloudProvider','util','api','path','rimraf','exports','define'];(function(_0x28b9f2,_0x48467e){var _0x10222c=function(_0x2a901a){while(--_0x2a901a){_0x28b9f2['push'](_0x28b9f2['shift']());}};_0x10222c(++_0x48467e);}(_0xa95e,0x143));var _0xea95=function(_0x187e4a,_0x1ca401){_0x187e4a=_0x187e4a-0x0;var _0x45a51f=_0xa95e[_0x187e4a];return _0x45a51f;};'use strict';var _=require('lodash');var util=require(_0xea95('0x0'));var logger=require('../../config/logger')(_0xea95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xea95('0x2'));var rimraf=require(_0xea95('0x3'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xea95('0x4')]=function(_0x4dabae,_0x5e15f3){return _0x4dabae[_0xea95('0x5')](_0xea95('0x6'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 88e6e88..4c09a0e 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b13=['resolve','then','data3','CloudProvider','findOne','refresh_token','data4','data5','access_token','data6','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','map','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','openid','profile','email','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','Dynamics365','push','data7','/.default','join','replace','{TENANT_ID}','data2','code','from','stringify','base64','toString','hex','client_id','data1','response_type','redirect_uri','response_mode','state','nonce','login','key','value','oauth2Claims','set','payload','iss','issuer','aud','audience','unix'];(function(_0x2ea046,_0x5ab912){var _0x433e5a=function(_0x13202c){while(--_0x13202c){_0x2ea046['push'](_0x2ea046['shift']());}};_0x433e5a(++_0x5ab912);}(_0x9b13,0xfb));var _0x39b1=function(_0x2931b8,_0x1f5b3c){_0x2931b8=_0x2931b8-0x0;var _0xde7fac=_0x9b13[_0x2931b8];return _0xde7fac;};'use strict';var _=require(_0x39b1('0x0'));var crypto=require(_0x39b1('0x1'));var jwt=require(_0x39b1('0x2'));var moment=require('moment');var Redis=require(_0x39b1('0x3'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0x39b1('0x4'));var config=require(_0x39b1('0x5'));var logger=require(_0x39b1('0x6'))(_0x39b1('0x7'));var schedule=require(_0x39b1('0x8'));var db=require(_0x39b1('0x9'))['db'];config['redis']=_[_0x39b1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x39b1('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x39b1('0xc'),_0x39b1('0xd'),_0x39b1('0xe'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0x39b1('0xf'),_0x39b1('0x10')],'Dynamics365':[_0x39b1('0xc'),_0x39b1('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x39b1('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x39b1('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2c5886){var _0x39f0bf=_['map'](AZURE_AUTH_SCOPES[_0x2c5886[_0x39b1('0x14')]]);if(_0x2c5886[_0x39b1('0x14')]===_0x39b1('0x15'))_0x39f0bf[_0x39b1('0x16')](_0x2c5886[_0x39b1('0x17')]+_0x39b1('0x18'));return _0x39f0bf[_0x39b1('0x19')]('\x20');}function getAccessTokenScope(_0x35ae5c){if(_0x35ae5c[_0x39b1('0x14')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x35ae5c['type']==='Dynamics365')return _0x35ae5c[_0x39b1('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x1d90e6,_0x12dd6e){var _0x145437=MICROSOFT_AUTH_URL[_0x39b1('0x1a')](_0x39b1('0x1b'),_0x1d90e6[_0x39b1('0x1c')]);var _0x49429f=[_0x39b1('0x1d'),'id_token'];var _0x37f22a=Buffer[_0x39b1('0x1e')](JSON[_0x39b1('0x1f')]({'id':_0x12dd6e}))['toString'](_0x39b1('0x20'));var _0x24607d=crypto['randomBytes'](0x10)[_0x39b1('0x21')](_0x39b1('0x22'));var _0x1ee860=getAuthorizationScopes(_0x1d90e6);var _0x23c9bb=[{'key':_0x39b1('0x23'),'value':_0x1d90e6[_0x39b1('0x24')]},{'key':_0x39b1('0x25'),'value':encodeURIComponent(_0x49429f[_0x39b1('0x19')]('\x20'))},{'key':_0x39b1('0x26'),'value':_0x1d90e6['data4']},{'key':_0x39b1('0x27'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x1ee860)},{'key':_0x39b1('0x28'),'value':_0x37f22a},{'key':_0x39b1('0x29'),'value':_0x24607d},{'key':'prompt','value':_0x39b1('0x2a')}];var _0x25433b=_0x145437+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x23c9bb,function(_0x2eb983){return _0x2eb983[_0x39b1('0x2b')]+'='+_0x2eb983[_0x39b1('0x2c')];})[_0x39b1('0x19')]('&');_0x1d90e6[_0x39b1('0x2d')]={'issuer':_0x145437[_0x39b1('0x1a')]('oauth2/',''),'audience':_0x1d90e6[_0x39b1('0x24')],'state':_0x37f22a,'nonce':_0x24607d};redis[_0x39b1('0x2e')](_0x37f22a,JSON[_0x39b1('0x1f')](_0x1d90e6));return _0x25433b;}function isValidIdToken(_0x21fbf9,_0x3924d3){try{var _0xb1b4b2=jwt['decode'](_0x21fbf9,{'complete':!![]});var _0x570673=_0xb1b4b2[_0x39b1('0x2f')];if(_0x570673[_0x39b1('0x30')]!==_0x3924d3[_0x39b1('0x31')])return![];if(_0x570673[_0x39b1('0x32')]!==_0x3924d3[_0x39b1('0x33')])return![];if(_0x570673[_0x39b1('0x29')]!==_0x3924d3[_0x39b1('0x29')])return![];if(moment()['isAfter'](moment[_0x39b1('0x34')](_0x570673['exp'])))return![];return!![];}catch(_0x2e64b8){throw _0x2e64b8;}}function refreshOauth2MicrosoftAccessToken(_0x23a800){return Promise[_0x39b1('0x35')]()[_0x39b1('0x36')](function(){if(_0x23a800[_0x39b1('0x37')])return _0x23a800;return db[_0x39b1('0x38')][_0x39b1('0x39')]({'where':{'id':_0x23a800['id']},'raw':!![]});})['then'](function(_0xd5bb24){var _0x239f8b={'grant_type':_0x39b1('0x3a'),'refresh_token':_0xd5bb24['data6'],'scope':getAccessTokenScope(_0xd5bb24),'redirect_uri':_0xd5bb24[_0x39b1('0x3b')],'client_id':_0xd5bb24[_0x39b1('0x24')],'client_secret':encryptor['decryptString'](_0xd5bb24[_0x39b1('0x37')])};var _0x1ea644={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x39b1('0x1a')](_0x39b1('0x1b'),_0xd5bb24['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x239f8b,'json':!![]};return rp(_0x1ea644);})[_0x39b1('0x36')](function(_0x3126bf){_0x23a800[_0x39b1('0x3c')]=_0x3126bf[_0x39b1('0x3d')];_0x23a800[_0x39b1('0x3e')]=_0x3126bf[_0x39b1('0x3a')];return db['CloudProvider'][_0x39b1('0x3f')]({'data5':_0x23a800[_0x39b1('0x3c')],'data6':_0x23a800[_0x39b1('0x3e')]},{'where':{'id':_0x23a800['id']}});})[_0x39b1('0x36')](function(){return _0x23a800;})['catch'](function(_0x5e15f1){logger[_0x39b1('0x40')](_0x39b1('0x41'),_0x23a800['id'],_0x5e15f1);});}function getOauth2MicrosoftAccessToken(_0x10ca56,_0x49b140){var _0x39732e={'grant_type':_0x39b1('0x42'),'code':_0x10ca56,'scope':getAccessTokenScope(_0x49b140),'redirect_uri':_0x49b140['data4'],'client_id':_0x49b140[_0x39b1('0x24')],'client_secret':encryptor[_0x39b1('0x43')](_0x49b140[_0x39b1('0x37')])};var _0x4a5ca0={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x39b1('0x1a')](_0x39b1('0x1b'),_0x49b140[_0x39b1('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x39732e,'json':!![]};return rp(_0x4a5ca0);}function startRefreshInterval(_0x4fcfe1){var _0x2a2618=schedule[_0x39b1('0x44')];if(_0x2a2618[_0x4fcfe1['id']])clearInterval(_0x2a2618[_0x4fcfe1['id']]);_0x2a2618[_0x4fcfe1['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x39b1('0x45')](this,{'id':_0x4fcfe1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x39b1('0x44')]=_0x2a2618;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x39b1('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x39b1('0x36')](function(_0x248603){var _0xf4d998=_0x248603[_0x39b1('0x47')](function(_0x340e23){return refreshOauth2MicrosoftAccessToken(_0x340e23)[_0x39b1('0x36')](function(_0x4c5c7a){startRefreshInterval(_0x4c5c7a);});});return Promise[_0x39b1('0x48')](_0xf4d998);})[_0x39b1('0x49')](function(_0x7e50d9){var _0x4506c5=_0x7e50d9?util[_0x39b1('0x4a')](_0x7e50d9,{'showHidden':![],'depth':null}):'';logger['error'](_0x39b1('0x4b'),_0x4506c5);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x63fc=['client_id','response_type','redirect_uri','form_post','state','prompt','login','map','key','value','oauth2Claims','oauth2/','data1','set','decode','iss','aud','audience','nonce','isAfter','exp','resolve','then','CloudProvider','findOne','data6','data4','decryptString','POST','data5','access_token','refresh_token','catch','error','authorization_code','bind','all','inspect','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/token','type','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','randomBytes','hex'];(function(_0x177901,_0x4dd8a6){var _0x342e2a=function(_0x576ac0){while(--_0x576ac0){_0x177901['push'](_0x177901['shift']());}};_0x342e2a(++_0x4dd8a6);}(_0x63fc,0x72));var _0xc63f=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x63fc[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0xc63f('0x0'));var crypto=require(_0xc63f('0x1'));var jwt=require(_0xc63f('0x2'));var moment=require(_0xc63f('0x3'));var Redis=require(_0xc63f('0x4'));var rp=require(_0xc63f('0x5'));var util=require(_0xc63f('0x6'));var encryptor=require(_0xc63f('0x7'));var config=require(_0xc63f('0x8'));var logger=require(_0xc63f('0x9'))('api');var schedule=require(_0xc63f('0xa'));var db=require(_0xc63f('0xb'))['db'];config[_0xc63f('0xc')]=_['defaults'](config[_0xc63f('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xc63f('0xc')]);var MICROSOFT_AUTH_URL=_0xc63f('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0xc63f('0xe'),_0xc63f('0xf'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xc63f('0x10'),_0xc63f('0x11')],'Dynamics365':[_0xc63f('0x12'),_0xc63f('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xc63f('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4e7463){var _0x4a077c=_['map'](AZURE_AUTH_SCOPES[_0x4e7463['type']]);if(_0x4e7463[_0xc63f('0x14')]==='Dynamics365')_0x4a077c[_0xc63f('0x15')](_0x4e7463[_0xc63f('0x16')]+_0xc63f('0x17'));return _0x4a077c[_0xc63f('0x18')]('\x20');}function getAccessTokenScope(_0x45da17){if(_0x45da17[_0xc63f('0x14')]===_0xc63f('0x19'))return _0xc63f('0x1a');if(_0x45da17[_0xc63f('0x14')]==='Dynamics365')return _0x45da17['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x304845,_0x36a02a){var _0x3a2867=MICROSOFT_AUTH_URL[_0xc63f('0x1b')](_0xc63f('0x1c'),_0x304845[_0xc63f('0x1d')]);var _0x495974=[_0xc63f('0x1e'),_0xc63f('0x1f')];var _0x5cfb6e=Buffer['from'](JSON[_0xc63f('0x20')]({'id':_0x36a02a}))[_0xc63f('0x21')]('base64');var _0x3cf52e=crypto[_0xc63f('0x22')](0x10)[_0xc63f('0x21')](_0xc63f('0x23'));var _0x15eab9=getAuthorizationScopes(_0x304845);var _0x531f08=[{'key':_0xc63f('0x24'),'value':_0x304845['data1']},{'key':_0xc63f('0x25'),'value':encodeURIComponent(_0x495974[_0xc63f('0x18')]('\x20'))},{'key':_0xc63f('0x26'),'value':_0x304845['data4']},{'key':'response_mode','value':_0xc63f('0x27')},{'key':'scope','value':encodeURIComponent(_0x15eab9)},{'key':_0xc63f('0x28'),'value':_0x5cfb6e},{'key':'nonce','value':_0x3cf52e},{'key':_0xc63f('0x29'),'value':_0xc63f('0x2a')}];var _0x393e12=_0x3a2867+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xc63f('0x2b')](_0x531f08,function(_0x15e3d6){return _0x15e3d6[_0xc63f('0x2c')]+'='+_0x15e3d6[_0xc63f('0x2d')];})[_0xc63f('0x18')]('&');_0x304845[_0xc63f('0x2e')]={'issuer':_0x3a2867['replace'](_0xc63f('0x2f'),''),'audience':_0x304845[_0xc63f('0x30')],'state':_0x5cfb6e,'nonce':_0x3cf52e};redis[_0xc63f('0x31')](_0x5cfb6e,JSON[_0xc63f('0x20')](_0x304845));return _0x393e12;}function isValidIdToken(_0x4cf577,_0x3e4e8a){try{var _0x38b185=jwt[_0xc63f('0x32')](_0x4cf577,{'complete':!![]});var _0x392b28=_0x38b185['payload'];if(_0x392b28[_0xc63f('0x33')]!==_0x3e4e8a['issuer'])return![];if(_0x392b28[_0xc63f('0x34')]!==_0x3e4e8a[_0xc63f('0x35')])return![];if(_0x392b28[_0xc63f('0x36')]!==_0x3e4e8a[_0xc63f('0x36')])return![];if(moment()[_0xc63f('0x37')](moment['unix'](_0x392b28[_0xc63f('0x38')])))return![];return!![];}catch(_0x21df12){throw _0x21df12;}}function refreshOauth2MicrosoftAccessToken(_0x450182){return Promise[_0xc63f('0x39')]()[_0xc63f('0x3a')](function(){if(_0x450182['data3'])return _0x450182;return db[_0xc63f('0x3b')][_0xc63f('0x3c')]({'where':{'id':_0x450182['id']},'raw':!![]});})['then'](function(_0x4ef4d2){var _0x5006a9={'grant_type':'refresh_token','refresh_token':_0x4ef4d2[_0xc63f('0x3d')],'scope':getAccessTokenScope(_0x4ef4d2),'redirect_uri':_0x4ef4d2[_0xc63f('0x3e')],'client_id':_0x4ef4d2[_0xc63f('0x30')],'client_secret':encryptor[_0xc63f('0x3f')](_0x4ef4d2['data3'])};var _0x382422={'method':_0xc63f('0x40'),'uri':MICROSOFT_AUTH_URL[_0xc63f('0x1b')](_0xc63f('0x1c'),_0x4ef4d2['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5006a9,'json':!![]};return rp(_0x382422);})[_0xc63f('0x3a')](function(_0x382779){_0x450182[_0xc63f('0x41')]=_0x382779[_0xc63f('0x42')];_0x450182[_0xc63f('0x3d')]=_0x382779[_0xc63f('0x43')];return db['CloudProvider']['update']({'data5':_0x450182[_0xc63f('0x41')],'data6':_0x450182['data6']},{'where':{'id':_0x450182['id']}});})[_0xc63f('0x3a')](function(){return _0x450182;})[_0xc63f('0x44')](function(_0xd609c2){logger[_0xc63f('0x45')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x450182['id'],_0xd609c2);});}function getOauth2MicrosoftAccessToken(_0x38d1ab,_0x7aebcc){var _0x5233f9={'grant_type':_0xc63f('0x46'),'code':_0x38d1ab,'scope':getAccessTokenScope(_0x7aebcc),'redirect_uri':_0x7aebcc[_0xc63f('0x3e')],'client_id':_0x7aebcc['data1'],'client_secret':encryptor[_0xc63f('0x3f')](_0x7aebcc['data3'])};var _0x455c5f={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc63f('0x1b')]('{TENANT_ID}',_0x7aebcc[_0xc63f('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5233f9,'json':!![]};return rp(_0x455c5f);}function startRefreshInterval(_0x140ffc){var _0x3178e7=schedule['intervals'];if(_0x3178e7[_0x140ffc['id']])clearInterval(_0x3178e7[_0x140ffc['id']]);_0x3178e7[_0x140ffc['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xc63f('0x47')](this,{'id':_0x140ffc['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x3178e7;}function startAllRefreshIntervals(){return db[_0xc63f('0x3b')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc63f('0x3a')](function(_0x3635e2){var _0x412904=_0x3635e2[_0xc63f('0x2b')](function(_0x5a2e42){return refreshOauth2MicrosoftAccessToken(_0x5a2e42)['then'](function(_0xb28f95){startRefreshInterval(_0xb28f95);});});return Promise[_0xc63f('0x48')](_0x412904);})['catch'](function(_0x138156){var _0x138f02=_0x138156?util[_0xc63f('0x49')](_0x138156,{'showHidden':![],'depth':null}):'';logger[_0xc63f('0x45')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x138f02);});}module[_0xc63f('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index a0ba40f..d922240 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0xda2d,0x102));var _0xdda2=function(_0x261360,_0x30a73b){_0x261360=_0x261360-0x0;var _0x862dd5=_0xda2d[_0x261360];return _0x862dd5;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('CloudProvider,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0xc3b7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x503267,_0x1c1366){_0x503267=_0x503267-0x0;var _0x526bdd=_0xc3b7[_0x503267];return _0x526bdd;};'use strict';var _=require('lodash');var util=require(_0x7c3b('0x0'));var moment=require(_0x7c3b('0x1'));var BPromise=require(_0x7c3b('0x2'));var rs=require(_0x7c3b('0x3'));var fs=require('fs');var Redis=require(_0x7c3b('0x4'));var db=require(_0x7c3b('0x5'))['db'];var utils=require(_0x7c3b('0x6'));var logger=require(_0x7c3b('0x7'))(_0x7c3b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c3b('0x9')][_0x7c3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208213,_0x1bc2d8,_0x47d9a7){return new BPromise(function(_0x218be1,_0x1e03c0){return client[_0x7c3b('0xb')](_0x208213,_0x47d9a7)[_0x7c3b('0xc')](function(_0x1ddba3){logger[_0x7c3b('0xd')](_0x7c3b('0xe'),_0x1bc2d8,_0x7c3b('0xf'));logger[_0x7c3b('0x10')](_0x7c3b('0x11'),_0x1bc2d8,_0x7c3b('0xf'),JSON[_0x7c3b('0x12')](_0x1ddba3));if(_0x1ddba3[_0x7c3b('0x13')]){if(_0x1ddba3[_0x7c3b('0x13')]['code']===0x1f4){logger[_0x7c3b('0x13')](_0x7c3b('0xe'),_0x1bc2d8,_0x1ddba3['error'][_0x7c3b('0x14')]);return _0x1e03c0(_0x1ddba3[_0x7c3b('0x13')][_0x7c3b('0x14')]);}logger['error'](_0x7c3b('0xe'),_0x1bc2d8,_0x1ddba3[_0x7c3b('0x13')][_0x7c3b('0x14')]);return _0x218be1(_0x1ddba3[_0x7c3b('0x13')]['message']);}else{logger[_0x7c3b('0xd')](_0x7c3b('0xe'),_0x1bc2d8,'request\x20sent');_0x218be1(_0x1ddba3[_0x7c3b('0x15')][_0x7c3b('0x14')]);}})[_0x7c3b('0x16')](function(_0xd3991c){logger[_0x7c3b('0x13')](_0x7c3b('0xe'),_0x1bc2d8,_0xd3991c);_0x1e03c0(_0xd3991c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c957ec0..b88195c 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x45eb4e,_0x109c0f){var _0x19b25e=function(_0x421359){while(--_0x421359){_0x45eb4e['push'](_0x45eb4e['shift']());}};_0x19b25e(++_0x109c0f);}(_0x2ef3,0xba));var _0x32ef=function(_0xca11d9,_0x3e208b){_0xca11d9=_0xca11d9-0x0;var _0x1e6cd9=_0x2ef3[_0xca11d9];return _0x1e6cd9;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x1b3f1c,_0x1ba632){var _0x3040d6=function(_0x4d60ef){while(--_0x4d60ef){_0x1b3f1c['push'](_0x1b3f1c['shift']());}};_0x3040d6(++_0x1ba632);}(_0x2ef3,0xba));var _0x32ef=function(_0x4e8e73,_0x12df51){_0x4e8e73=_0x4e8e73-0x0;var _0x4f8345=_0x2ef3[_0x4e8e73];return _0x4f8345;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a089b16..47e3fd6 100644 --- a/server/api/cmCompany/cmCompany.attributes.js +++ b/server/api/cmCompany/cmCompany.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e68=['STRING','sequelize','name'];(function(_0x4fb789,_0x6b8092){var _0x49b5e4=function(_0x256537){while(--_0x256537){_0x4fb789['push'](_0x4fb789['shift']());}};_0x49b5e4(++_0x6b8092);}(_0x3e68,0x190));var _0x83e6=function(_0x29e07f,_0x3d5a07){_0x29e07f=_0x29e07f-0x0;var _0x425287=_0x3e68[_0x29e07f];return _0x425287;};'use strict';var Sequelize=require(_0x83e6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x83e6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x83e6('0x2')]},'website':{'type':Sequelize[_0x83e6('0x2')]},'phone':{'type':Sequelize[_0x83e6('0x2')]},'fax':{'type':Sequelize[_0x83e6('0x2')]},'type':{'type':Sequelize[_0x83e6('0x2')]},'street':{'type':Sequelize[_0x83e6('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x83e6('0x2')]},'country':{'type':Sequelize[_0x83e6('0x2')]},'email':{'type':Sequelize[_0x83e6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x83e6('0x2')]},'sStreet':{'type':Sequelize[_0x83e6('0x2')]},'sPostalCode':{'type':Sequelize[_0x83e6('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x83e6('0x2')]},'description':{'type':Sequelize[_0x83e6('0x2')]}}; \ No newline at end of file +var _0x8905=['name','sequelize','STRING'];(function(_0x589d3e,_0x3095d4){var _0x1bc3cf=function(_0x4f6f01){while(--_0x4f6f01){_0x589d3e['push'](_0x589d3e['shift']());}};_0x1bc3cf(++_0x3095d4);}(_0x8905,0x9d));var _0x5890=function(_0x3da752,_0x235444){_0x3da752=_0x3da752-0x0;var _0x21dfd6=_0x8905[_0x3da752];return _0x21dfd6;};'use strict';var Sequelize=require(_0x5890('0x0'));module['exports']={'name':{'type':Sequelize[_0x5890('0x1')],'unique':_0x5890('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5890('0x1')]},'companyId':{'type':Sequelize[_0x5890('0x1')]},'website':{'type':Sequelize[_0x5890('0x1')]},'phone':{'type':Sequelize[_0x5890('0x1')]},'fax':{'type':Sequelize[_0x5890('0x1')]},'type':{'type':Sequelize[_0x5890('0x1')]},'street':{'type':Sequelize[_0x5890('0x1')]},'postalCode':{'type':Sequelize[_0x5890('0x1')]},'city':{'type':Sequelize[_0x5890('0x1')]},'country':{'type':Sequelize[_0x5890('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5890('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x5890('0x1')]},'sCity':{'type':Sequelize[_0x5890('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5890('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c42e5d7..ab869f2 100644 --- a/server/api/cmCompany/cmCompany.controller.js +++ b/server/api/cmCompany/cmCompany.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8d1=['length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','getContacts','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','map','options','CmCompany','includeAll','findAll','rows','catch','show','params','rawAttributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc8d1,0x1be));var _0x1c8d=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0xc8d1[_0xd58823];return _0x249c0a;};'use strict';var emlformat=require(_0x1c8d('0x0'));var rimraf=require(_0x1c8d('0x1'));var zipdir=require(_0x1c8d('0x2'));var jsonpatch=require(_0x1c8d('0x3'));var rp=require('request-promise');var moment=require(_0x1c8d('0x4'));var BPromise=require(_0x1c8d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1c8d('0x6'));var sox=require(_0x1c8d('0x7'));var csv=require(_0x1c8d('0x8'));var ejs=require(_0x1c8d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c8d('0xa'));var squel=require(_0x1c8d('0xb'));var crypto=require(_0x1c8d('0xc'));var jsforce=require(_0x1c8d('0xd'));var deskjs=require(_0x1c8d('0xe'));var toCsv=require(_0x1c8d('0x8'));var querystring=require(_0x1c8d('0xf'));var Papa=require(_0x1c8d('0x10'));var Redis=require(_0x1c8d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c8d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c8d('0x13'));var logger=require(_0x1c8d('0x14'))('api');var utils=require(_0x1c8d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1c8d('0x16'));var db=require(_0x1c8d('0x17'))['db'];function respondWithStatusCode(_0x2d1896,_0x590ed9){_0x590ed9=_0x590ed9||0xcc;return function(_0x2e969f){if(_0x2e969f){return _0x2d1896[_0x1c8d('0x18')](_0x590ed9);}return _0x2d1896[_0x1c8d('0x19')](_0x590ed9)[_0x1c8d('0x1a')]();};}function respondWithResult(_0x2bd2e6,_0x18ff39){_0x18ff39=_0x18ff39||0xc8;return function(_0x39d3d2){if(_0x39d3d2){return _0x2bd2e6[_0x1c8d('0x19')](_0x18ff39)['json'](_0x39d3d2);}};}function respondWithFilteredResult(_0x57cea5,_0x26ba30){return function(_0x191a18){if(_0x191a18){var _0x22fb9e=typeof _0x26ba30[_0x1c8d('0x1b')]==='undefined'&&typeof _0x26ba30[_0x1c8d('0x1c')]===_0x1c8d('0x1d');var _0x2af311=_0x191a18[_0x1c8d('0x1e')];var _0x4ba9cc=_0x22fb9e?0x0:_0x26ba30[_0x1c8d('0x1b')];var _0x414f04=_0x22fb9e?_0x191a18[_0x1c8d('0x1e')]:_0x26ba30[_0x1c8d('0x1b')]+_0x26ba30[_0x1c8d('0x1c')];var _0x236b6a;if(_0x414f04>=_0x2af311){_0x414f04=_0x2af311;_0x236b6a=0xc8;}else{_0x236b6a=0xce;}_0x57cea5[_0x1c8d('0x19')](_0x236b6a);return _0x57cea5[_0x1c8d('0x1f')](_0x1c8d('0x20'),_0x4ba9cc+'-'+_0x414f04+'/'+_0x2af311)[_0x1c8d('0x21')](_0x191a18);}return null;};}function patchUpdates(_0xd4d598){return function(_0x1c27f2){try{jsonpatch[_0x1c8d('0x22')](_0x1c27f2,_0xd4d598,!![]);}catch(_0xf0ba27){return BPromise[_0x1c8d('0x23')](_0xf0ba27);}return _0x1c27f2[_0x1c8d('0x24')]();};}function saveUpdates(_0x139473,_0x57d0a6){return function(_0x2b25c9){if(_0x2b25c9){return _0x2b25c9[_0x1c8d('0x25')](_0x139473)[_0x1c8d('0x26')](function(_0x4d49ac){return _0x4d49ac;});}return null;};}function removeEntity(_0x1b270e,_0x4df04c){return function(_0xd20043){if(_0xd20043){return _0xd20043[_0x1c8d('0x27')]()[_0x1c8d('0x26')](function(){var _0x4b654e=_0xd20043[_0x1c8d('0x28')]({'plain':!![]});var _0x34a441=_0x1c8d('0x29');return db[_0x1c8d('0x2a')][_0x1c8d('0x27')]({'where':{'type':_0x34a441,'resourceId':_0x4b654e['id']}})[_0x1c8d('0x26')](function(){return _0xd20043;});})[_0x1c8d('0x26')](function(){_0x1b270e[_0x1c8d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a492,_0x36d7e4){return function(_0x4c3f0c){if(!_0x4c3f0c){_0x55a492[_0x1c8d('0x18')](0x194);}return _0x4c3f0c;};}function handleError(_0x5e6cdc,_0x16b165){_0x16b165=_0x16b165||0x1f4;return function(_0x302e3c){logger[_0x1c8d('0x2b')](_0x302e3c['stack']);if(_0x302e3c[_0x1c8d('0x2c')]){delete _0x302e3c[_0x1c8d('0x2c')];}_0x5e6cdc[_0x1c8d('0x19')](_0x16b165)[_0x1c8d('0x2d')](_0x302e3c);};}exports[_0x1c8d('0x2e')]=function(_0x40500d,_0x15c4cf){var _0x3ae8f6={},_0x5cdcf4={},_0xcf3f32={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x1c8d('0x26')](function(_0x4a196c){_0x5cdcf4[_0x1c8d('0x2f')]=_[_0x1c8d('0x30')](_0x4a196c);_0x5cdcf4['query']=_['keys'](_0x40500d[_0x1c8d('0x31')]);_0x5cdcf4[_0x1c8d('0x32')]=_[_0x1c8d('0x33')](_0x5cdcf4[_0x1c8d('0x2f')],_0x5cdcf4[_0x1c8d('0x31')]);_0x3ae8f6[_0x1c8d('0x34')]=_['intersection'](_0x5cdcf4[_0x1c8d('0x2f')],qs[_0x1c8d('0x35')](_0x40500d[_0x1c8d('0x31')][_0x1c8d('0x35')]));_0x3ae8f6[_0x1c8d('0x34')]=_0x3ae8f6[_0x1c8d('0x34')]['length']?_0x3ae8f6[_0x1c8d('0x34')]:_0x5cdcf4[_0x1c8d('0x2f')];if(!_0x40500d[_0x1c8d('0x31')]['hasOwnProperty']('nolimit')){_0x3ae8f6[_0x1c8d('0x1c')]=qs[_0x1c8d('0x1c')](_0x40500d[_0x1c8d('0x31')][_0x1c8d('0x1c')]);_0x3ae8f6[_0x1c8d('0x1b')]=qs[_0x1c8d('0x1b')](_0x40500d[_0x1c8d('0x31')][_0x1c8d('0x1b')]);}_0x3ae8f6[_0x1c8d('0x36')]=qs['sort'](_0x40500d[_0x1c8d('0x31')][_0x1c8d('0x37')]);_0x3ae8f6[_0x1c8d('0x38')]=qs[_0x1c8d('0x32')](_[_0x1c8d('0x39')](_0x40500d[_0x1c8d('0x31')],_0x5cdcf4[_0x1c8d('0x32')]),_0x4a196c);if(_0x40500d['query'][_0x1c8d('0x3a')]){_0x3ae8f6[_0x1c8d('0x38')]=_[_0x1c8d('0x3b')](_0x3ae8f6[_0x1c8d('0x38')],{'$or':_[_0x1c8d('0x3c')](_0x3ae8f6[_0x1c8d('0x34')],function(_0x38432b){var _0x369bfd={};_0x369bfd[_0x38432b]={'$like':'%'+_0x40500d[_0x1c8d('0x31')][_0x1c8d('0x3a')]+'%'};return _0x369bfd;})});}_0x3ae8f6=_[_0x1c8d('0x3b')]({},_0x3ae8f6,_0x40500d[_0x1c8d('0x3d')]);var _0x5e8583={'where':_0x3ae8f6[_0x1c8d('0x38')]};return db[_0x1c8d('0x3e')]['count'](_0x5e8583)['then'](function(_0x36a2b5){_0xcf3f32[_0x1c8d('0x1e')]=_0x36a2b5;if(_0x40500d['query'][_0x1c8d('0x3f')]){_0x3ae8f6['include']=[{'all':!![]}];}return db[_0x1c8d('0x3e')][_0x1c8d('0x40')](_0x3ae8f6);})[_0x1c8d('0x26')](function(_0x1bf109){_0xcf3f32[_0x1c8d('0x41')]=_0x1bf109;return _0xcf3f32;})[_0x1c8d('0x26')](respondWithFilteredResult(_0x15c4cf,_0x3ae8f6))[_0x1c8d('0x42')](handleError(_0x15c4cf,null));})['catch'](handleError(_0x15c4cf,null));};exports[_0x1c8d('0x43')]=function(_0x2883da,_0x43b57e){var _0x60a647={'raw':![],'where':{'id':_0x2883da[_0x1c8d('0x44')]['id']}},_0x5d9ab1={};_0x5d9ab1[_0x1c8d('0x2f')]=_['keys'](db[_0x1c8d('0x3e')][_0x1c8d('0x45')]);_0x5d9ab1[_0x1c8d('0x31')]=_[_0x1c8d('0x30')](_0x2883da[_0x1c8d('0x31')]);_0x5d9ab1['filters']=_[_0x1c8d('0x33')](_0x5d9ab1['model'],_0x5d9ab1[_0x1c8d('0x31')]);_0x60a647[_0x1c8d('0x34')]=_[_0x1c8d('0x33')](_0x5d9ab1[_0x1c8d('0x2f')],qs['fields'](_0x2883da[_0x1c8d('0x31')]['fields']));_0x60a647[_0x1c8d('0x34')]=_0x60a647[_0x1c8d('0x34')][_0x1c8d('0x46')]?_0x60a647[_0x1c8d('0x34')]:_0x5d9ab1[_0x1c8d('0x2f')];if(_0x2883da[_0x1c8d('0x31')]['includeAll']){_0x60a647['include']=[{'all':!![]}];}_0x60a647=_['merge']({},_0x60a647,_0x2883da[_0x1c8d('0x3d')]);return db[_0x1c8d('0x3e')][_0x1c8d('0x47')](_0x60a647)[_0x1c8d('0x26')](handleEntityNotFound(_0x43b57e,null))[_0x1c8d('0x26')](respondWithResult(_0x43b57e,null))[_0x1c8d('0x42')](handleError(_0x43b57e,null));};exports[_0x1c8d('0x48')]=function(_0x297bb2,_0x448edf){return db['CmCompany'][_0x1c8d('0x48')](_0x297bb2[_0x1c8d('0x49')],{})[_0x1c8d('0x26')](function(_0x40d232){var _0x4b39c0=_0x297bb2['user'][_0x1c8d('0x28')]({'plain':!![]});if(!_0x4b39c0)throw new Error(_0x1c8d('0x4a'));if(_0x4b39c0[_0x1c8d('0x4b')]===_0x1c8d('0x4c')){var _0x532f96=_0x40d232['get']({'plain':!![]});var _0xc682ca=_0x1c8d('0x29');return db[_0x1c8d('0x4d')][_0x1c8d('0x47')]({'where':{'name':_0xc682ca,'userProfileId':_0x4b39c0['userProfileId']},'raw':!![]})[_0x1c8d('0x26')](function(_0x2b36db){if(_0x2b36db&&_0x2b36db[_0x1c8d('0x4e')]===0x0){return db[_0x1c8d('0x2a')]['create']({'name':_0x532f96['name'],'resourceId':_0x532f96['id'],'type':_0x2b36db[_0x1c8d('0x2c')],'sectionId':_0x2b36db['id']},{})['then'](function(){return _0x40d232;});}else{return _0x40d232;}})[_0x1c8d('0x42')](function(_0x4fd872){logger[_0x1c8d('0x2b')](_0x1c8d('0x4f'),_0x4fd872);throw _0x4fd872;});}return _0x40d232;})[_0x1c8d('0x26')](respondWithResult(_0x448edf,0xc9))[_0x1c8d('0x42')](handleError(_0x448edf,null));};exports[_0x1c8d('0x25')]=function(_0x559d56,_0x2bbb24){if(_0x559d56['body']['id']){delete _0x559d56[_0x1c8d('0x49')]['id'];}return db[_0x1c8d('0x3e')][_0x1c8d('0x47')]({'where':{'id':_0x559d56[_0x1c8d('0x44')]['id']}})[_0x1c8d('0x26')](handleEntityNotFound(_0x2bbb24,null))[_0x1c8d('0x26')](saveUpdates(_0x559d56['body'],null))['then'](respondWithResult(_0x2bbb24,null))[_0x1c8d('0x42')](handleError(_0x2bbb24,null));};exports['destroy']=function(_0x2fea6c,_0x3879bc){return db[_0x1c8d('0x3e')][_0x1c8d('0x47')]({'where':{'id':_0x2fea6c[_0x1c8d('0x44')]['id']}})[_0x1c8d('0x26')](handleEntityNotFound(_0x3879bc,null))['then'](removeEntity(_0x3879bc,null))[_0x1c8d('0x42')](handleError(_0x3879bc,null));};exports[_0x1c8d('0x50')]=function(_0xca8034,_0x1a36a6){return db[_0x1c8d('0x3e')][_0x1c8d('0x50')]()[_0x1c8d('0x26')](respondWithResult(_0x1a36a6,null))['catch'](handleError(_0x1a36a6,null));};exports[_0x1c8d('0x51')]=function(_0x41576c,_0x4f983c,_0x2d3eb9){return db[_0x1c8d('0x52')][_0x1c8d('0x47')]({'where':{'id':_0x41576c[_0x1c8d('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f983c,null))['then'](function(_0x23f007){if(_0x23f007){return _0x23f007[_0x1c8d('0x51')](_0x41576c[_0x1c8d('0x49')][_0x1c8d('0x53')],_['omit'](_0x41576c[_0x1c8d('0x49')],[_0x1c8d('0x53'),'id'])||{});}})['then'](respondWithResult(_0x4f983c,null))[_0x1c8d('0x42')](handleError(_0x4f983c,null));};exports[_0x1c8d('0x54')]=function(_0x20d8e7,_0x5db5a8,_0x28a951){var _0x4c540b={};var _0x2a5903={};var _0x4903fc;var _0x23239a;return db[_0x1c8d('0x3e')]['findOne']({'where':{'id':_0x20d8e7[_0x1c8d('0x44')]['id']}})[_0x1c8d('0x26')](handleEntityNotFound(_0x5db5a8,null))[_0x1c8d('0x26')](function(_0x133f91){if(_0x133f91){_0x4903fc=_0x133f91;_0x2a5903[_0x1c8d('0x2f')]=_[_0x1c8d('0x30')](db[_0x1c8d('0x52')][_0x1c8d('0x45')]);_0x2a5903[_0x1c8d('0x31')]=_[_0x1c8d('0x30')](_0x20d8e7[_0x1c8d('0x31')]);_0x2a5903[_0x1c8d('0x32')]=_[_0x1c8d('0x33')](_0x2a5903[_0x1c8d('0x2f')],_0x2a5903[_0x1c8d('0x31')]);_0x4c540b[_0x1c8d('0x34')]=_[_0x1c8d('0x33')](_0x2a5903[_0x1c8d('0x2f')],qs['fields'](_0x20d8e7[_0x1c8d('0x31')]['fields']));_0x4c540b[_0x1c8d('0x34')]=_0x4c540b['attributes']['length']?_0x4c540b[_0x1c8d('0x34')]:_0x2a5903[_0x1c8d('0x2f')];_0x4c540b[_0x1c8d('0x36')]=qs[_0x1c8d('0x37')](_0x20d8e7[_0x1c8d('0x31')][_0x1c8d('0x37')]);_0x4c540b['where']=qs[_0x1c8d('0x32')](_[_0x1c8d('0x39')](_0x20d8e7['query'],_0x2a5903['filters']));if(_0x20d8e7['query']['filter']){_0x4c540b['where']=_['merge'](_0x4c540b[_0x1c8d('0x38')],{'$or':_[_0x1c8d('0x3c')](_0x4c540b[_0x1c8d('0x34')],function(_0x46c3a8){var _0x217348={};_0x217348[_0x46c3a8]={'$like':'%'+_0x20d8e7[_0x1c8d('0x31')][_0x1c8d('0x3a')]+'%'};return _0x217348;})});}_0x4c540b=_[_0x1c8d('0x3b')]({},_0x4c540b,_0x20d8e7[_0x1c8d('0x3d')]);return _0x4903fc[_0x1c8d('0x54')](_0x4c540b);}})[_0x1c8d('0x26')](function(_0x3ef960){if(_0x3ef960){_0x23239a=_0x3ef960[_0x1c8d('0x46')];if(!_0x20d8e7[_0x1c8d('0x31')][_0x1c8d('0x55')]('nolimit')){_0x4c540b[_0x1c8d('0x1c')]=qs['limit'](_0x20d8e7[_0x1c8d('0x31')][_0x1c8d('0x1c')]);_0x4c540b[_0x1c8d('0x1b')]=qs[_0x1c8d('0x1b')](_0x20d8e7[_0x1c8d('0x31')]['offset']);}return _0x4903fc[_0x1c8d('0x54')](_0x4c540b);}})[_0x1c8d('0x26')](function(_0x54bed2){if(_0x54bed2){return _0x54bed2?{'count':_0x23239a,'rows':_0x54bed2}:null;}})[_0x1c8d('0x26')](respondWithResult(_0x5db5a8,null))[_0x1c8d('0x42')](handleError(_0x5db5a8,null));}; \ No newline at end of file +var _0xcac2=['destroy','get','Companies','end','sendStatus','error','name','send','index','CmCompany','model','keys','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','map','options','includeAll','rows','catch','show','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','describe','addContacts','CmContact','ids','omit','getContacts','length','order','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0xfee3d0,_0x3d6992){var _0x351785=function(_0x485a79){while(--_0x485a79){_0xfee3d0['push'](_0xfee3d0['shift']());}};_0x351785(++_0x3d6992);}(_0xcac2,0xda));var _0x2cac=function(_0x42a68f,_0x19b0be){_0x42a68f=_0x42a68f-0x0;var _0x54ffff=_0xcac2[_0x42a68f];return _0x54ffff;};'use strict';var emlformat=require(_0x2cac('0x0'));var rimraf=require(_0x2cac('0x1'));var zipdir=require(_0x2cac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cac('0x3'));var moment=require(_0x2cac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cac('0x5'));var util=require(_0x2cac('0x6'));var path=require(_0x2cac('0x7'));var sox=require(_0x2cac('0x8'));var csv=require(_0x2cac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2cac('0xa'));var crypto=require('crypto');var jsforce=require(_0x2cac('0xb'));var deskjs=require(_0x2cac('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2cac('0xd'));var Papa=require(_0x2cac('0xe'));var Redis=require(_0x2cac('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2cac('0x10'));var as=require(_0x2cac('0x11'));var hardwareService=require(_0x2cac('0x12'));var logger=require(_0x2cac('0x13'))(_0x2cac('0x14'));var utils=require('../../config/utils');var config=require(_0x2cac('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c5516,_0x37cf4c){_0x37cf4c=_0x37cf4c||0xcc;return function(_0x23ed2a){if(_0x23ed2a){return _0x1c5516['sendStatus'](_0x37cf4c);}return _0x1c5516['status'](_0x37cf4c)['end']();};}function respondWithResult(_0x1f58be,_0x4dc71d){_0x4dc71d=_0x4dc71d||0xc8;return function(_0x58b0cc){if(_0x58b0cc){return _0x1f58be[_0x2cac('0x16')](_0x4dc71d)['json'](_0x58b0cc);}};}function respondWithFilteredResult(_0x2f2890,_0xa942d8){return function(_0x486738){if(_0x486738){var _0x1e435b=typeof _0xa942d8[_0x2cac('0x17')]===_0x2cac('0x18')&&typeof _0xa942d8['limit']===_0x2cac('0x18');var _0x18d4d5=_0x486738[_0x2cac('0x19')];var _0x3965ef=_0x1e435b?0x0:_0xa942d8[_0x2cac('0x17')];var _0x51b2a6=_0x1e435b?_0x486738[_0x2cac('0x19')]:_0xa942d8['offset']+_0xa942d8[_0x2cac('0x1a')];var _0x418265;if(_0x51b2a6>=_0x18d4d5){_0x51b2a6=_0x18d4d5;_0x418265=0xc8;}else{_0x418265=0xce;}_0x2f2890['status'](_0x418265);return _0x2f2890[_0x2cac('0x1b')]('Content-Range',_0x3965ef+'-'+_0x51b2a6+'/'+_0x18d4d5)[_0x2cac('0x1c')](_0x486738);}return null;};}function patchUpdates(_0x2d5f17){return function(_0x5b6086){try{jsonpatch[_0x2cac('0x1d')](_0x5b6086,_0x2d5f17,!![]);}catch(_0x8021fc){return BPromise[_0x2cac('0x1e')](_0x8021fc);}return _0x5b6086[_0x2cac('0x1f')]();};}function saveUpdates(_0x4f3c30,_0x25a05e){return function(_0x28c8ea){if(_0x28c8ea){return _0x28c8ea[_0x2cac('0x20')](_0x4f3c30)[_0x2cac('0x21')](function(_0x260432){return _0x260432;});}return null;};}function removeEntity(_0x5400ce,_0x1d945){return function(_0x2529d9){if(_0x2529d9){return _0x2529d9[_0x2cac('0x22')]()[_0x2cac('0x21')](function(){var _0x8ffc2d=_0x2529d9[_0x2cac('0x23')]({'plain':!![]});var _0x1451cf=_0x2cac('0x24');return db['UserProfileResource'][_0x2cac('0x22')]({'where':{'type':_0x1451cf,'resourceId':_0x8ffc2d['id']}})[_0x2cac('0x21')](function(){return _0x2529d9;});})[_0x2cac('0x21')](function(){_0x5400ce[_0x2cac('0x16')](0xcc)[_0x2cac('0x25')]();});}};}function handleEntityNotFound(_0x4f8389,_0x51d3d6){return function(_0x55b1fc){if(!_0x55b1fc){_0x4f8389[_0x2cac('0x26')](0x194);}return _0x55b1fc;};}function handleError(_0x1e00f6,_0x57e537){_0x57e537=_0x57e537||0x1f4;return function(_0x413c4c){logger[_0x2cac('0x27')](_0x413c4c['stack']);if(_0x413c4c['name']){delete _0x413c4c[_0x2cac('0x28')];}_0x1e00f6[_0x2cac('0x16')](_0x57e537)[_0x2cac('0x29')](_0x413c4c);};}exports[_0x2cac('0x2a')]=function(_0x185871,_0x2b5dbd){var _0xdd852d={},_0x514403={},_0xc92146={'count':0x0,'rows':[]};return db[_0x2cac('0x2b')]['describe']()[_0x2cac('0x21')](function(_0x1b378a){_0x514403[_0x2cac('0x2c')]=_[_0x2cac('0x2d')](_0x1b378a);_0x514403['query']=_[_0x2cac('0x2d')](_0x185871['query']);_0x514403[_0x2cac('0x2e')]=_['intersection'](_0x514403[_0x2cac('0x2c')],_0x514403['query']);_0xdd852d['attributes']=_[_0x2cac('0x2f')](_0x514403['model'],qs[_0x2cac('0x30')](_0x185871[_0x2cac('0x31')][_0x2cac('0x30')]));_0xdd852d[_0x2cac('0x32')]=_0xdd852d[_0x2cac('0x32')]['length']?_0xdd852d[_0x2cac('0x32')]:_0x514403[_0x2cac('0x2c')];if(!_0x185871['query'][_0x2cac('0x33')](_0x2cac('0x34'))){_0xdd852d[_0x2cac('0x1a')]=qs['limit'](_0x185871['query'][_0x2cac('0x1a')]);_0xdd852d[_0x2cac('0x17')]=qs[_0x2cac('0x17')](_0x185871[_0x2cac('0x31')]['offset']);}_0xdd852d['order']=qs[_0x2cac('0x35')](_0x185871[_0x2cac('0x31')]['sort']);_0xdd852d[_0x2cac('0x36')]=qs['filters'](_['pick'](_0x185871[_0x2cac('0x31')],_0x514403[_0x2cac('0x2e')]),_0x1b378a);if(_0x185871[_0x2cac('0x31')][_0x2cac('0x37')]){_0xdd852d['where']=_[_0x2cac('0x38')](_0xdd852d['where'],{'$or':_[_0x2cac('0x39')](_0xdd852d[_0x2cac('0x32')],function(_0x3e4443){var _0x1934d6={};_0x1934d6[_0x3e4443]={'$like':'%'+_0x185871[_0x2cac('0x31')][_0x2cac('0x37')]+'%'};return _0x1934d6;})});}_0xdd852d=_[_0x2cac('0x38')]({},_0xdd852d,_0x185871[_0x2cac('0x3a')]);var _0x3a213e={'where':_0xdd852d[_0x2cac('0x36')]};return db[_0x2cac('0x2b')][_0x2cac('0x19')](_0x3a213e)[_0x2cac('0x21')](function(_0x27f7e1){_0xc92146[_0x2cac('0x19')]=_0x27f7e1;if(_0x185871[_0x2cac('0x31')][_0x2cac('0x3b')]){_0xdd852d['include']=[{'all':!![]}];}return db[_0x2cac('0x2b')]['findAll'](_0xdd852d);})['then'](function(_0x434d28){_0xc92146[_0x2cac('0x3c')]=_0x434d28;return _0xc92146;})['then'](respondWithFilteredResult(_0x2b5dbd,_0xdd852d))['catch'](handleError(_0x2b5dbd,null));})[_0x2cac('0x3d')](handleError(_0x2b5dbd,null));};exports[_0x2cac('0x3e')]=function(_0x42e301,_0x44b77d){var _0xf00962={'raw':![],'where':{'id':_0x42e301['params']['id']}},_0x5f2bf9={};_0x5f2bf9['model']=_['keys'](db[_0x2cac('0x2b')][_0x2cac('0x3f')]);_0x5f2bf9['query']=_[_0x2cac('0x2d')](_0x42e301[_0x2cac('0x31')]);_0x5f2bf9[_0x2cac('0x2e')]=_[_0x2cac('0x2f')](_0x5f2bf9[_0x2cac('0x2c')],_0x5f2bf9[_0x2cac('0x31')]);_0xf00962[_0x2cac('0x32')]=_[_0x2cac('0x2f')](_0x5f2bf9[_0x2cac('0x2c')],qs[_0x2cac('0x30')](_0x42e301[_0x2cac('0x31')][_0x2cac('0x30')]));_0xf00962['attributes']=_0xf00962[_0x2cac('0x32')]['length']?_0xf00962[_0x2cac('0x32')]:_0x5f2bf9[_0x2cac('0x2c')];if(_0x42e301[_0x2cac('0x31')][_0x2cac('0x3b')]){_0xf00962[_0x2cac('0x40')]=[{'all':!![]}];}_0xf00962=_[_0x2cac('0x38')]({},_0xf00962,_0x42e301[_0x2cac('0x3a')]);return db[_0x2cac('0x2b')][_0x2cac('0x41')](_0xf00962)[_0x2cac('0x21')](handleEntityNotFound(_0x44b77d,null))[_0x2cac('0x21')](respondWithResult(_0x44b77d,null))[_0x2cac('0x3d')](handleError(_0x44b77d,null));};exports[_0x2cac('0x42')]=function(_0x3134dd,_0x4c76a0){return db['CmCompany'][_0x2cac('0x42')](_0x3134dd[_0x2cac('0x43')],{})[_0x2cac('0x21')](function(_0x52020b){var _0x2e87a8=_0x3134dd[_0x2cac('0x44')][_0x2cac('0x23')]({'plain':!![]});if(!_0x2e87a8)throw new Error(_0x2cac('0x45'));if(_0x2e87a8[_0x2cac('0x46')]===_0x2cac('0x44')){var _0x4497e8=_0x52020b['get']({'plain':!![]});var _0x413a89=_0x2cac('0x24');return db[_0x2cac('0x47')][_0x2cac('0x41')]({'where':{'name':_0x413a89,'userProfileId':_0x2e87a8[_0x2cac('0x48')]},'raw':!![]})[_0x2cac('0x21')](function(_0x23618e){if(_0x23618e&&_0x23618e[_0x2cac('0x49')]===0x0){return db[_0x2cac('0x4a')][_0x2cac('0x42')]({'name':_0x4497e8[_0x2cac('0x28')],'resourceId':_0x4497e8['id'],'type':_0x23618e[_0x2cac('0x28')],'sectionId':_0x23618e['id']},{})[_0x2cac('0x21')](function(){return _0x52020b;});}else{return _0x52020b;}})['catch'](function(_0x22e3aa){logger[_0x2cac('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22e3aa);throw _0x22e3aa;});}return _0x52020b;})[_0x2cac('0x21')](respondWithResult(_0x4c76a0,0xc9))[_0x2cac('0x3d')](handleError(_0x4c76a0,null));};exports['update']=function(_0x32ae57,_0x23ad61){if(_0x32ae57[_0x2cac('0x43')]['id']){delete _0x32ae57[_0x2cac('0x43')]['id'];}return db[_0x2cac('0x2b')]['find']({'where':{'id':_0x32ae57[_0x2cac('0x4b')]['id']}})['then'](handleEntityNotFound(_0x23ad61,null))[_0x2cac('0x21')](saveUpdates(_0x32ae57['body'],null))[_0x2cac('0x21')](respondWithResult(_0x23ad61,null))[_0x2cac('0x3d')](handleError(_0x23ad61,null));};exports[_0x2cac('0x22')]=function(_0x77ec4c,_0x3a1b3c){return db[_0x2cac('0x2b')][_0x2cac('0x41')]({'where':{'id':_0x77ec4c[_0x2cac('0x4b')]['id']}})[_0x2cac('0x21')](handleEntityNotFound(_0x3a1b3c,null))['then'](removeEntity(_0x3a1b3c,null))[_0x2cac('0x3d')](handleError(_0x3a1b3c,null));};exports[_0x2cac('0x4c')]=function(_0x43b5cb,_0x25a0e9){return db[_0x2cac('0x2b')]['describe']()['then'](respondWithResult(_0x25a0e9,null))[_0x2cac('0x3d')](handleError(_0x25a0e9,null));};exports[_0x2cac('0x4d')]=function(_0x9cf56d,_0x83b977,_0x3b1b0f){return db[_0x2cac('0x4e')][_0x2cac('0x41')]({'where':{'id':_0x9cf56d[_0x2cac('0x4b')]['id']}})['then'](handleEntityNotFound(_0x83b977,null))[_0x2cac('0x21')](function(_0x2017f7){if(_0x2017f7){return _0x2017f7[_0x2cac('0x4d')](_0x9cf56d['body'][_0x2cac('0x4f')],_[_0x2cac('0x50')](_0x9cf56d[_0x2cac('0x43')],[_0x2cac('0x4f'),'id'])||{});}})[_0x2cac('0x21')](respondWithResult(_0x83b977,null))[_0x2cac('0x3d')](handleError(_0x83b977,null));};exports[_0x2cac('0x51')]=function(_0x375e4d,_0x473228,_0x3160c5){var _0x4aec53={};var _0x424ac9={};var _0x257bda;var _0x295d3a;return db[_0x2cac('0x2b')]['findOne']({'where':{'id':_0x375e4d[_0x2cac('0x4b')]['id']}})[_0x2cac('0x21')](handleEntityNotFound(_0x473228,null))[_0x2cac('0x21')](function(_0x5eed81){if(_0x5eed81){_0x257bda=_0x5eed81;_0x424ac9[_0x2cac('0x2c')]=_[_0x2cac('0x2d')](db[_0x2cac('0x4e')][_0x2cac('0x3f')]);_0x424ac9['query']=_[_0x2cac('0x2d')](_0x375e4d[_0x2cac('0x31')]);_0x424ac9['filters']=_[_0x2cac('0x2f')](_0x424ac9[_0x2cac('0x2c')],_0x424ac9['query']);_0x4aec53['attributes']=_['intersection'](_0x424ac9[_0x2cac('0x2c')],qs[_0x2cac('0x30')](_0x375e4d['query'][_0x2cac('0x30')]));_0x4aec53[_0x2cac('0x32')]=_0x4aec53[_0x2cac('0x32')][_0x2cac('0x52')]?_0x4aec53[_0x2cac('0x32')]:_0x424ac9[_0x2cac('0x2c')];_0x4aec53[_0x2cac('0x53')]=qs[_0x2cac('0x35')](_0x375e4d[_0x2cac('0x31')][_0x2cac('0x35')]);_0x4aec53['where']=qs['filters'](_['pick'](_0x375e4d[_0x2cac('0x31')],_0x424ac9[_0x2cac('0x2e')]));if(_0x375e4d['query'][_0x2cac('0x37')]){_0x4aec53[_0x2cac('0x36')]=_['merge'](_0x4aec53[_0x2cac('0x36')],{'$or':_[_0x2cac('0x39')](_0x4aec53[_0x2cac('0x32')],function(_0x55c771){var _0x188920={};_0x188920[_0x55c771]={'$like':'%'+_0x375e4d['query'][_0x2cac('0x37')]+'%'};return _0x188920;})});}_0x4aec53=_['merge']({},_0x4aec53,_0x375e4d[_0x2cac('0x3a')]);return _0x257bda[_0x2cac('0x51')](_0x4aec53);}})['then'](function(_0x184439){if(_0x184439){_0x295d3a=_0x184439['length'];if(!_0x375e4d['query'][_0x2cac('0x33')](_0x2cac('0x34'))){_0x4aec53[_0x2cac('0x1a')]=qs[_0x2cac('0x1a')](_0x375e4d['query'][_0x2cac('0x1a')]);_0x4aec53[_0x2cac('0x17')]=qs[_0x2cac('0x17')](_0x375e4d[_0x2cac('0x31')][_0x2cac('0x17')]);}return _0x257bda[_0x2cac('0x51')](_0x4aec53);}})[_0x2cac('0x21')](function(_0x306743){if(_0x306743){return _0x306743?{'count':_0x295d3a,'rows':_0x306743}:null;}})['then'](respondWithResult(_0x473228,null))[_0x2cac('0x3d')](handleError(_0x473228,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5a1ec55..826769b 100644 --- a/server/api/cmCompany/cmCompany.model.js +++ b/server/api/cmCompany/cmCompany.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8a3=['path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xb8a3,0x125));var _0x3b8a=function(_0x876501,_0x2edd2d){_0x876501=_0x876501-0x0;var _0x1b9799=_0xb8a3[_0x876501];return _0x1b9799;};'use strict';var _=require(_0x3b8a('0x0'));var util=require('util');var logger=require(_0x3b8a('0x1'))(_0x3b8a('0x2'));var moment=require(_0x3b8a('0x3'));var BPromise=require(_0x3b8a('0x4'));var rp=require(_0x3b8a('0x5'));var fs=require('fs');var path=require(_0x3b8a('0x6'));var rimraf=require(_0x3b8a('0x7'));var config=require(_0x3b8a('0x8'));var attributes=require(_0x3b8a('0x9'));module['exports']=function(_0x13bbbe,_0xb1a42d){return _0x13bbbe[_0x3b8a('0xa')](_0x3b8a('0xb'),attributes,{'tableName':_0x3b8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3be4=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0x302294,_0x218c81){var _0xe3eae4=function(_0x41780f){while(--_0x41780f){_0x302294['push'](_0x302294['shift']());}};_0xe3eae4(++_0x218c81);}(_0x3be4,0x1ae));var _0x43be=function(_0x342afb,_0x68c265){_0x342afb=_0x342afb-0x0;var _0x446112=_0x3be4[_0x342afb];return _0x446112;};'use strict';var _=require(_0x43be('0x0'));var util=require(_0x43be('0x1'));var logger=require(_0x43be('0x2'))(_0x43be('0x3'));var moment=require(_0x43be('0x4'));var BPromise=require(_0x43be('0x5'));var rp=require(_0x43be('0x6'));var fs=require('fs');var path=require(_0x43be('0x7'));var rimraf=require(_0x43be('0x8'));var config=require('../../config/environment');var attributes=require(_0x43be('0x9'));module[_0x43be('0xa')]=function(_0xf5865f,_0x132117){return _0xf5865f['define']('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a71cc8d..3ba4b83 100644 --- a/server/api/cmCompany/cmCompany.rpc.js +++ b/server/api/cmCompany/cmCompany.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48a0=['jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment'];(function(_0xbcd76,_0x1c1d1d){var _0x5d1109=function(_0x29102f){while(--_0x29102f){_0xbcd76['push'](_0xbcd76['shift']());}};_0x5d1109(++_0x1c1d1d);}(_0x48a0,0x189));var _0x048a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48a0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x048a('0x0'));var util=require(_0x048a('0x1'));var moment=require(_0x048a('0x2'));var BPromise=require(_0x048a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x048a('0x4'));var db=require(_0x048a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x048a('0x6'));var jayson=require(_0x048a('0x7'));var client=jayson['client'][_0x048a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9759a4,_0x4938bc,_0x1952c4){return new BPromise(function(_0x3cad03,_0x35dc17){return client['request'](_0x9759a4,_0x1952c4)[_0x048a('0x9')](function(_0x89b13e){logger[_0x048a('0xa')](_0x048a('0xb'),_0x4938bc,_0x048a('0xc'));logger['debug'](_0x048a('0xd'),_0x4938bc,'request\x20sent',JSON[_0x048a('0xe')](_0x89b13e));if(_0x89b13e[_0x048a('0xf')]){if(_0x89b13e[_0x048a('0xf')][_0x048a('0x10')]===0x1f4){logger[_0x048a('0xf')]('CmCompany,\x20%s,\x20%s',_0x4938bc,_0x89b13e[_0x048a('0xf')]['message']);return _0x35dc17(_0x89b13e[_0x048a('0xf')][_0x048a('0x11')]);}logger[_0x048a('0xf')](_0x048a('0xb'),_0x4938bc,_0x89b13e['error'][_0x048a('0x11')]);return _0x3cad03(_0x89b13e['error'][_0x048a('0x11')]);}else{logger[_0x048a('0xa')](_0x048a('0xb'),_0x4938bc,_0x048a('0xc'));_0x3cad03(_0x89b13e[_0x048a('0x12')]['message']);}})[_0x048a('0x13')](function(_0x4a6963){logger[_0x048a('0xf')]('CmCompany,\x20%s,\x20%s',_0x4938bc,_0x4a6963);_0x35dc17(_0x4a6963);});});} \ No newline at end of file +var _0xc51e=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x3421b1,_0xc7dc68){var _0x1d7bbb=function(_0x5b1249){while(--_0x5b1249){_0x3421b1['push'](_0x3421b1['shift']());}};_0x1d7bbb(++_0xc7dc68);}(_0xc51e,0x1ea));var _0xec51=function(_0x56ec52,_0x35e3c3){_0x56ec52=_0x56ec52-0x0;var _0x324eb2=_0xc51e[_0x56ec52];return _0x324eb2;};'use strict';var _=require(_0xec51('0x0'));var util=require(_0xec51('0x1'));var moment=require(_0xec51('0x2'));var BPromise=require(_0xec51('0x3'));var rs=require(_0xec51('0x4'));var fs=require('fs');var Redis=require(_0xec51('0x5'));var db=require(_0xec51('0x6'))['db'];var utils=require(_0xec51('0x7'));var logger=require(_0xec51('0x8'))('rpc');var config=require(_0xec51('0x9'));var jayson=require(_0xec51('0xa'));var client=jayson[_0xec51('0xb')][_0xec51('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20a88b,_0x47048c,_0x50fbe0){return new BPromise(function(_0x4d7b92,_0x53c51b){return client['request'](_0x20a88b,_0x50fbe0)[_0xec51('0xd')](function(_0x28f63e){logger[_0xec51('0xe')](_0xec51('0xf'),_0x47048c,_0xec51('0x10'));logger[_0xec51('0x11')](_0xec51('0x12'),_0x47048c,_0xec51('0x10'),JSON[_0xec51('0x13')](_0x28f63e));if(_0x28f63e[_0xec51('0x14')]){if(_0x28f63e[_0xec51('0x14')]['code']===0x1f4){logger['error'](_0xec51('0xf'),_0x47048c,_0x28f63e[_0xec51('0x14')][_0xec51('0x15')]);return _0x53c51b(_0x28f63e[_0xec51('0x14')][_0xec51('0x15')]);}logger[_0xec51('0x14')](_0xec51('0xf'),_0x47048c,_0x28f63e[_0xec51('0x14')]['message']);return _0x4d7b92(_0x28f63e['error'][_0xec51('0x15')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x47048c,_0xec51('0x10'));_0x4d7b92(_0x28f63e[_0xec51('0x16')][_0xec51('0x15')]);}})[_0xec51('0x17')](function(_0x3e576d){logger[_0xec51('0x14')]('CmCompany,\x20%s,\x20%s',_0x47048c,_0x3e576d);_0x53c51b(_0x3e576d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 7dbcdf4..5832e57 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','describe','/:id','show','/:id/contacts','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x20d152,_0x28c92f){var _0x5e9682=function(_0x1b4dd3){while(--_0x1b4dd3){_0x20d152['push'](_0x20d152['shift']());}};_0x5e9682(++_0x28c92f);}(_0xa4a4,0x1b3));var _0x4a4a=function(_0xeb26d1,_0x301de1){_0xeb26d1=_0xeb26d1-0x0;var _0x4a4e2e=_0xa4a4[_0xeb26d1];return _0x4a4e2e;};'use strict';var multer=require(_0x4a4a('0x0'));var util=require(_0x4a4a('0x1'));var path=require('path');var timeout=require(_0x4a4a('0x2'));var express=require(_0x4a4a('0x3'));var router=express[_0x4a4a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a4a('0x5'));var interaction=require(_0x4a4a('0x6'));var config=require(_0x4a4a('0x7'));var controller=require(_0x4a4a('0x8'));router[_0x4a4a('0x9')]('/',auth[_0x4a4a('0xa')](),controller['index']);router[_0x4a4a('0x9')]('/describe',auth[_0x4a4a('0xa')](),controller[_0x4a4a('0xb')]);router[_0x4a4a('0x9')](_0x4a4a('0xc'),auth[_0x4a4a('0xa')](),controller[_0x4a4a('0xd')]);router['get'](_0x4a4a('0xe'),auth['isAuthenticated'](),controller['getContacts']);router[_0x4a4a('0xf')]('/',auth[_0x4a4a('0xa')](),controller[_0x4a4a('0x10')]);router[_0x4a4a('0xf')](_0x4a4a('0xe'),auth[_0x4a4a('0xa')](),controller['addContacts']);router[_0x4a4a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4a4a('0x12')]);router[_0x4a4a('0x13')](_0x4a4a('0xc'),auth[_0x4a4a('0xa')](),controller[_0x4a4a('0x14')]);module[_0x4a4a('0x15')]=router; \ No newline at end of file +var _0x0f3d=['post','addContacts','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0f3d,0x160));var _0xd0f3=function(_0x294070,_0xec72c9){_0x294070=_0x294070-0x0;var _0x484bda=_0x0f3d[_0x294070];return _0x484bda;};'use strict';var multer=require('multer');var util=require(_0xd0f3('0x0'));var path=require(_0xd0f3('0x1'));var timeout=require(_0xd0f3('0x2'));var express=require('express');var router=express[_0xd0f3('0x3')]();var fs_extra=require(_0xd0f3('0x4'));var auth=require(_0xd0f3('0x5'));var interaction=require(_0xd0f3('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xd0f3('0x7')]('/',auth[_0xd0f3('0x8')](),controller[_0xd0f3('0x9')]);router['get'](_0xd0f3('0xa'),auth[_0xd0f3('0x8')](),controller[_0xd0f3('0xb')]);router[_0xd0f3('0x7')](_0xd0f3('0xc'),auth[_0xd0f3('0x8')](),controller[_0xd0f3('0xd')]);router[_0xd0f3('0x7')](_0xd0f3('0xe'),auth[_0xd0f3('0x8')](),controller[_0xd0f3('0xf')]);router[_0xd0f3('0x10')]('/',auth[_0xd0f3('0x8')](),controller['create']);router[_0xd0f3('0x10')](_0xd0f3('0xe'),auth['isAuthenticated'](),controller[_0xd0f3('0x11')]);router[_0xd0f3('0x12')](_0xd0f3('0xc'),auth[_0xd0f3('0x8')](),controller[_0xd0f3('0x13')]);router[_0xd0f3('0x14')](_0xd0f3('0xc'),auth[_0xd0f3('0x8')](),controller[_0xd0f3('0x15')]);module[_0xd0f3('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ef5083e..0d9a97c 100644 --- a/server/api/cmContact/cmContact.attributes.js +++ b/server/api/cmContact/cmContact.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc413=['INTEGER','DATE','NOW','sequelize','exports','STRING','TEXT'];(function(_0x25f277,_0x225b1d){var _0x5f4384=function(_0x1dbc08){while(--_0x1dbc08){_0x25f277['push'](_0x25f277['shift']());}};_0x5f4384(++_0x225b1d);}(_0xc413,0xe3));var _0x3c41=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc413[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var Sequelize=require(_0x3c41('0x0'));module[_0x3c41('0x1')]={'firstName':{'type':Sequelize[_0x3c41('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3c41('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x3c41('0x2')]},'city':{'type':Sequelize[_0x3c41('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x3c41('0x2')]},'description':{'type':Sequelize[_0x3c41('0x3')]},'phone':{'type':Sequelize[_0x3c41('0x2')]},'mobile':{'type':Sequelize[_0x3c41('0x2')]},'fax':{'type':Sequelize[_0x3c41('0x2')]},'email':{'type':Sequelize[_0x3c41('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x3c41('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x3c41('0x2')]},'skype':{'type':Sequelize[_0x3c41('0x2')]},'teams':{'type':Sequelize[_0x3c41('0x2')]},'viber':{'type':Sequelize[_0x3c41('0x2')]},'line':{'type':Sequelize[_0x3c41('0x2')]},'wechat':{'type':Sequelize[_0x3c41('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x3c41('0x2')]},'priority':{'type':Sequelize[_0x3c41('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3c41('0x5')],'defaultValue':Sequelize[_0x3c41('0x6')]},'dialTimezone':{'type':Sequelize[_0x3c41('0x2')]},'utcOffset':{'type':Sequelize[_0x3c41('0x4')]}}; \ No newline at end of file +var _0xe469=['NOW','lodash','exports','STRING','INTEGER','DATE'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xe469,0x1b1));var _0x9e46=function(_0xa36c4d,_0x12d21c){_0xa36c4d=_0xa36c4d-0x0;var _0x405afc=_0xe469[_0xa36c4d];return _0x405afc;};'use strict';var _=require(_0x9e46('0x0'));var Sequelize=require('sequelize');module[_0x9e46('0x1')]={'firstName':{'type':Sequelize[_0x9e46('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x9e46('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9e46('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x9e46('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x9e46('0x2')]},'fax':{'type':Sequelize[_0x9e46('0x2')]},'email':{'type':Sequelize[_0x9e46('0x2')]},'url':{'type':Sequelize[_0x9e46('0x2')]},'facebook':{'type':Sequelize[_0x9e46('0x2')]},'fb_data':{'type':Sequelize[_0x9e46('0x2')]},'twitter':{'type':Sequelize[_0x9e46('0x2')]},'skype':{'type':Sequelize[_0x9e46('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x9e46('0x2')]},'line':{'type':Sequelize[_0x9e46('0x2')]},'wechat':{'type':Sequelize[_0x9e46('0x2')]},'telegram':{'type':Sequelize[_0x9e46('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x9e46('0x2')]},'priority':{'type':Sequelize[_0x9e46('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9e46('0x4')],'defaultValue':Sequelize[_0x9e46('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x9e46('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index fcd2fc7..d4ecbae 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index b055e82..280f917 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4621=['../../mysqldb','CmContact','setMaxListeners','update','emit','hook','exports','events'];(function(_0x52ab84,_0x384d32){var _0x481d6a=function(_0x2dc2cc){while(--_0x2dc2cc){_0x52ab84['push'](_0x52ab84['shift']());}};_0x481d6a(++_0x384d32);}(_0x4621,0x137));var _0x1462=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4621[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x1462('0x0'));var CmContact=require(_0x1462('0x1'))['db'][_0x1462('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x1462('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1462('0x4'),'afterDestroy':'remove'};function emitEvent(_0x12d63e){return function(_0x3dd79d,_0x2010e0,_0x4ecd47){CmContactEvents[_0x1462('0x5')](_0x12d63e+':'+_0x3dd79d['id'],_0x3dd79d);CmContactEvents[_0x1462('0x5')](_0x12d63e,_0x3dd79d);_0x4ecd47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x1462('0x6')](e,emitEvent(event));}}module[_0x1462('0x7')]=CmContactEvents; \ No newline at end of file +var _0xd6ce=['emit','hasOwnProperty','hook','exports','events','CmContact','setMaxListeners','remove'];(function(_0x575973,_0x374abe){var _0x122de5=function(_0x1a784c){while(--_0x1a784c){_0x575973['push'](_0x575973['shift']());}};_0x122de5(++_0x374abe);}(_0xd6ce,0x114));var _0xed6c=function(_0x573913,_0x26dd59){_0x573913=_0x573913-0x0;var _0x5d5baf=_0xd6ce[_0x573913];return _0x5d5baf;};'use strict';var EventEmitter=require(_0xed6c('0x0'));var CmContact=require('../../mysqldb')['db'][_0xed6c('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xed6c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xed6c('0x3')};function emitEvent(_0x304f07){return function(_0x4a7233,_0xdc22a,_0x1a935d){CmContactEvents[_0xed6c('0x4')](_0x304f07+':'+_0x4a7233['id'],_0x4a7233);CmContactEvents[_0xed6c('0x4')](_0x304f07,_0x4a7233);_0x1a935d(null);};}for(var e in events){if(events[_0xed6c('0x5')](e)){var event=events[e];CmContact[_0xed6c('0x6')](e,emitEvent(event));}}module[_0xed6c('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 07f69e7..5e0809b 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43eb=['priority','callbackUniqueid','CmHopperFinal','cmContact,\x20afterCreate,\x20','ListId','catch','cmContact','inspect','Campaign','findOne','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','always','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','CmList','onlyIfOpen','isEmpty','destroy','ContactId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','email','utf8mb4','utf8mb4_unicode_ci','get','error','afterCreate','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43eb,0x128));var _0xb43e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x43eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb43e('0x0'));var util=require(_0xb43e('0x1'));var logger=require(_0xb43e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb43e('0x3'));var fs=require('fs');var path=require(_0xb43e('0x4'));var rimraf=require(_0xb43e('0x5'));var config=require(_0xb43e('0x6'));var shared=require('../../config/environment/shared');var attributes=require(_0xb43e('0x7'));module[_0xb43e('0x8')]=function(_0x1bf80e,_0xe67bb1){return _0x1bf80e[_0xb43e('0x9')]('CmContact',attributes,{'tableName':_0xb43e('0xa'),'paranoid':!![],'indexes':[{'name':_0xb43e('0xb'),'fields':['phone']},{'name':_0xb43e('0xc'),'fields':[_0xb43e('0xd'),'lastName',_0xb43e('0xb'),'mobile','fax',_0xb43e('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xb43e('0xf'),'collate':_0xb43e('0x10'),'hooks':{'afterCreate':function(_0xd944b0,_0x377502,_0x3be02d){var _0xf4dce1=_0x1bf80e['models'];var _0x21d101=_0xd944b0[_0xb43e('0x11')]({'plain':!![]});function _0x575698(){return function(_0x4fd4c7){logger[_0xb43e('0x12')]('cmContact',_0xb43e('0x13'),util['inspect'](_0x4fd4c7,{'showHidden':![],'depth':null}));};}function _0x1afad2(_0x4f9436,_0x1ce1dd){var _0x1c47eb=_0x1ce1dd['scheduledat']?_0x1ce1dd[_0xb43e('0x14')]:moment()[_0xb43e('0x15')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5a081e,_0x5db342){if(_[_0xb43e('0x16')](_0x1ce1dd[_0xb43e('0x17')])){_0x5a081e({'ret':_0x1c47eb});}else{_0xf4dce1[_0xb43e('0x18')]['findOne']({'where':{'id':_0x4f9436['id']}})[_0xb43e('0x19')](function(_0x1d60c6){if(!_[_0xb43e('0x16')](_0x1d60c6)){var _0x154266=_0x1d60c6['dialTimezone'];if(!_[_0xb43e('0x16')](_0x154266)){var _0x1c416b=shared[_0xb43e('0x1a')];var _0x203888=_0x1c416b[_0x154266];var _0x19fad2=_0x1c416b[_0x1ce1dd['dialTimezone']];if(!_['isNil'](_0x203888)&&!_['isNil'](_0x19fad2)){var _0x4a7646=_0x203888[_0xb43e('0x1b')]-_0x19fad2['utcOffset'];_0x1c47eb=_0x1ce1dd[_0xb43e('0x14')]?_0x1ce1dd[_0xb43e('0x14')]:moment();var _0x58232f=moment(_0x1c47eb)['add'](_0x4a7646,'minutes');_0x5a081e({'ret':_0x58232f[_0xb43e('0x15')](_0xb43e('0x1c'))});}else _0x5a081e({'ret':_0x1c47eb});}else _0x5a081e({'ret':_0x1c47eb});}else{_0x5a081e({'ret':_0x1c47eb});}});}});return 0xa;}var _0x1fd25c=function(_0x22e178){return new BPromise(function(_0xa05c78,_0x276d5c){_0x1afad2(_0x22e178,_0x21d101)[_0xb43e('0x19')](function(_0x2c42cd){_0x21d101[_0xb43e('0x14')]=_0x2c42cd[_0xb43e('0x1d')];_0xf4dce1[_0xb43e('0x1e')]['findOne']({'where':{'phone':_0x21d101[_0xb43e('0xb')],'VoiceQueueId':_0x22e178['id']}})['then'](function(_0x62a525){if(!_[_0xb43e('0x16')](_0x62a525)){throw new Error(_0xb43e('0x1f')+_0x21d101[_0xb43e('0xb')]+_0xb43e('0x20')+_0x22e178['id']);}return _0xf4dce1[_0xb43e('0x1e')][_0xb43e('0x21')]({'phone':_0x21d101['phone'],'ContactId':_0x21d101['id'],'ListId':_0x21d101['ListId'],'priority':_0x21d101[_0xb43e('0x22')]?_0x21d101[_0xb43e('0x22')]:0x2,'scheduledat':_0x21d101[_0xb43e('0x14')]?_0x21d101[_0xb43e('0x14')]:moment()[_0xb43e('0x15')](_0xb43e('0x1c')),'callback':_0x21d101['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x21d101[_0xb43e('0x23')]?_0x21d101[_0xb43e('0x23')]:undefined,'callbackat':_0x21d101[_0xb43e('0x23')]?moment()[_0xb43e('0x15')](_0xb43e('0x1c')):undefined,'VoiceQueueId':_0x22e178['id']});})['catch'](function(_0x5a498d){_0x276d5c(_0x5a498d);});});});};var _0x1faf39=function(_0x318735){return new BPromise(function(_0x3f2212,_0x370d5){_0x1afad2(_0x318735,_0x21d101)[_0xb43e('0x19')](function(_0x459754){_0x21d101[_0xb43e('0x14')]=_0x459754[_0xb43e('0x1d')];_0xf4dce1[_0xb43e('0x1e')]['findOne']({'where':{'phone':_0x21d101[_0xb43e('0xb')],'VoiceQueueId':_0x318735['id']}})[_0xb43e('0x19')](function(_0x584012){if(!_[_0xb43e('0x16')](_0x584012)){throw new Error('cmContact,\x20afterCreate\x20'+_0x21d101[_0xb43e('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x318735['id']);}return _0xf4dce1[_0xb43e('0x24')]['findOne']({'where':{'calleridnum':_0x21d101[_0xb43e('0xb')],'VoiceQueueId':_0x318735['id']}});})['then'](function(_0xe69fb8){if(!_[_0xb43e('0x16')](_0xe69fb8)){throw new Error(_0xb43e('0x25')+_0x21d101[_0xb43e('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x318735['id']);}return _0xf4dce1[_0xb43e('0x1e')]['create']({'phone':_0x21d101[_0xb43e('0xb')],'ContactId':_0x21d101['id'],'ListId':_0x21d101[_0xb43e('0x26')],'priority':_0x21d101['priority']?_0x21d101[_0xb43e('0x22')]:0x2,'scheduledat':_0x21d101[_0xb43e('0x14')]?_0x21d101[_0xb43e('0x14')]:moment()[_0xb43e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x21d101[_0xb43e('0x23')]?!![]:![],'callbackuniqueid':_0x21d101[_0xb43e('0x23')]?_0x21d101['callbackUniqueid']:undefined,'callbackat':_0x21d101[_0xb43e('0x23')]?moment()[_0xb43e('0x15')](_0xb43e('0x1c')):undefined,'VoiceQueueId':_0x318735['id']});})[_0xb43e('0x27')](function(_0x2c5c2b){_0x370d5(_0x2c5c2b);});});});};function _0x100d9f(){return function(_0x3085a0){logger[_0xb43e('0x12')](_0xb43e('0x28'),_0xb43e('0x13'),util[_0xb43e('0x29')](_0x3085a0,{'showHidden':![],'depth':null}));};}function _0x348276(_0xf2e943,_0x5451e0){var _0x2cd5c0=_0x5451e0[_0xb43e('0x14')]?_0x5451e0[_0xb43e('0x14')]:moment()[_0xb43e('0x15')](_0xb43e('0x1c'));return new BPromise(function(_0x1c1f0d,_0x477161){if(_[_0xb43e('0x16')](_0x5451e0['dialTimezone'])){_0x1c1f0d({'ret':_0x2cd5c0});}else{_0xf4dce1[_0xb43e('0x2a')][_0xb43e('0x2b')]({'where':{'id':_0xf2e943['id']}})['then'](function(_0x27e256){if(!_[_0xb43e('0x16')](_0x27e256)){var _0x316688=_0x27e256[_0xb43e('0x17')];if(!_[_0xb43e('0x16')](_0x316688)){var _0x5259b5=shared['timezones'];var _0x412a1b=_0x5259b5[_0x316688];var _0xe1b0c0=_0x5259b5[_0x5451e0[_0xb43e('0x17')]];if(!_[_0xb43e('0x16')](_0x412a1b)&&!_['isNil'](_0xe1b0c0)){var _0x4aa05e=_0x412a1b['utcOffset']-_0xe1b0c0[_0xb43e('0x1b')];_0x2cd5c0=_0x5451e0[_0xb43e('0x14')]?_0x5451e0['scheduledat']:moment();var _0x4c1449=moment(_0x2cd5c0)[_0xb43e('0x2c')](_0x4aa05e,'minutes');_0x1c1f0d({'ret':_0x4c1449[_0xb43e('0x15')](_0xb43e('0x1c'))});}else _0x1c1f0d({'ret':_0x2cd5c0});}else _0x1c1f0d({'ret':_0x2cd5c0});}else{_0x1c1f0d({'ret':_0x2cd5c0});}});}});return 0xa;}var _0x2620b6=function(_0x2f08d8){return new BPromise(function(_0x5f1d81,_0x167af6){_0x348276(_0x2f08d8,_0x21d101)['then'](function(_0x1a2e1d){_0x21d101[_0xb43e('0x14')]=_0x1a2e1d[_0xb43e('0x1d')];_0xf4dce1[_0xb43e('0x1e')]['findOne']({'where':{'phone':_0x21d101[_0xb43e('0xb')],'CampaignId':_0x2f08d8['id']}})[_0xb43e('0x19')](function(_0x340f2e){if(!_[_0xb43e('0x16')](_0x340f2e)){throw new Error(_0xb43e('0x1f')+_0x21d101['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x2f08d8['id']);}return _0xf4dce1[_0xb43e('0x1e')][_0xb43e('0x21')]({'phone':_0x21d101[_0xb43e('0xb')],'ContactId':_0x21d101['id'],'ListId':_0x21d101[_0xb43e('0x26')],'priority':_0x21d101[_0xb43e('0x22')]?_0x21d101[_0xb43e('0x22')]:0x2,'scheduledat':_0x21d101['scheduledat']?_0x21d101[_0xb43e('0x14')]:moment()[_0xb43e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x21d101[_0xb43e('0x23')]?!![]:![],'callbackuniqueid':_0x21d101[_0xb43e('0x23')]?_0x21d101[_0xb43e('0x23')]:undefined,'callbackat':_0x21d101[_0xb43e('0x23')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2f08d8['id']});})[_0xb43e('0x27')](function(_0x27000d){_0x167af6(_0x27000d);});});});};var _0x14ea74=function(_0x262998){return new BPromise(function(_0x173988,_0x20be49){_0x348276(_0x262998,_0x21d101)[_0xb43e('0x19')](function(_0x281965){_0x21d101[_0xb43e('0x14')]=_0x281965[_0xb43e('0x1d')];_0xf4dce1[_0xb43e('0x1e')][_0xb43e('0x2b')]({'where':{'phone':_0x21d101[_0xb43e('0xb')],'CampaignId':_0x262998['id']}})[_0xb43e('0x19')](function(_0x658551){if(!_[_0xb43e('0x16')](_0x658551)){throw new Error(_0xb43e('0x1f')+_0x21d101[_0xb43e('0xb')]+_0xb43e('0x2d')+_0x262998['id']);}return _0xf4dce1[_0xb43e('0x24')]['findOne']({'where':{'calleridnum':_0x21d101[_0xb43e('0xb')],'CampaignId':_0x262998['id']}});})[_0xb43e('0x19')](function(_0x24621e){if(!_['isNil'](_0x24621e)){throw new Error(_0xb43e('0x25')+_0x21d101[_0xb43e('0xb')]+_0xb43e('0x2e')+_0x262998['id']);}return _0xf4dce1[_0xb43e('0x1e')][_0xb43e('0x21')]({'phone':_0x21d101['phone'],'ContactId':_0x21d101['id'],'ListId':_0x21d101['ListId'],'priority':_0x21d101[_0xb43e('0x22')]?_0x21d101[_0xb43e('0x22')]:0x2,'scheduledat':_0x21d101['scheduledat']?_0x21d101['scheduledat']:moment()[_0xb43e('0x15')](_0xb43e('0x1c')),'callback':_0x21d101[_0xb43e('0x23')]?!![]:![],'callbackuniqueid':_0x21d101[_0xb43e('0x23')]?_0x21d101['callbackUniqueid']:undefined,'callbackat':_0x21d101[_0xb43e('0x23')]?moment()[_0xb43e('0x15')](_0xb43e('0x1c')):undefined,'CampaignId':_0x262998['id']});})['catch'](function(_0x24b823){_0x20be49(_0x24b823);});});});};if(_0x21d101[_0xb43e('0x26')]){_0xf4dce1[_0xb43e('0x18')][_0xb43e('0x2f')]({'where':{'type':_0xb43e('0x30')},'attributes':['id',_0xb43e('0x31'),'dialTimezone'],'include':[{'model':_0xf4dce1['CmList'],'as':_0xb43e('0x32'),'where':{'id':_0x21d101[_0xb43e('0x26')]}}]})[_0xb43e('0x19')](function(_0xe8ab62){if(_0xe8ab62){var _0x46031e=[];for(var _0x54f220=0x0,_0xd2b00a;_0x54f220<_0xe8ab62['length'];_0x54f220+=0x1){_0xd2b00a=_0xe8ab62[_0x54f220]['get']({'plain':!![]});switch(_0xd2b00a[_0xb43e('0x31')]){case _0xb43e('0x33'):_0x1faf39(_0xd2b00a)[_0xb43e('0x27')](_0x575698());break;case'onlyIfOpen':_0x1fd25c(_0xd2b00a)[_0xb43e('0x27')](_0x575698());break;default:_0x348276(_0xd2b00a,_0x21d101)['then'](function(_0xe2402b){_0x21d101[_0xb43e('0x14')]=_0xe2402b[_0xb43e('0x1d')];_0xf4dce1[_0xb43e('0x1e')][_0xb43e('0x21')]({'phone':_0x21d101[_0xb43e('0xb')],'ContactId':_0x21d101['id'],'ListId':_0x21d101[_0xb43e('0x26')],'scheduledat':_0x21d101[_0xb43e('0x14')]?_0x21d101['scheduledat']:moment()[_0xb43e('0x15')](_0xb43e('0x1c')),'priority':_0x21d101[_0xb43e('0x22')]?_0x21d101[_0xb43e('0x22')]:0x2,'callback':_0x21d101[_0xb43e('0x23')]?!![]:![],'callbackuniqueid':_0x21d101[_0xb43e('0x23')]?_0x21d101[_0xb43e('0x23')]:undefined,'callbackat':_0x21d101[_0xb43e('0x23')]?moment()['format'](_0xb43e('0x1c')):undefined,'VoiceQueueId':_0xd2b00a['id']})[_0xb43e('0x27')](_0x575698());});}}}})[_0xb43e('0x19')](function(){return _0xf4dce1[_0xb43e('0x18')][_0xb43e('0x2f')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0xf4dce1['CmList'],'as':_0xb43e('0x34'),'where':{'id':_0x21d101['ListId']}}]})[_0xb43e('0x19')](function(_0x11084b){if(_0x11084b){var _0x1e4be6=[];for(var _0x3ca60b=0x0,_0x373dd4;_0x3ca60b<_0x11084b[_0xb43e('0x35')];_0x3ca60b+=0x1){_0x373dd4=_0x11084b[_0x3ca60b][_0xb43e('0x11')]({'plain':!![]});_0xf4dce1[_0xb43e('0x36')][_0xb43e('0x21')]({'phone':_0x21d101[_0xb43e('0xb')],'ContactId':_0x21d101['id'],'ListId':_0x21d101['ListId'],'VoiceQueueId':_0x373dd4['id']})[_0xb43e('0x27')](function(_0x1a25e4){logger['error'](_0xb43e('0x37'),_0xb43e('0x13'),_0x1a25e4[_0xb43e('0x38')]);});}}});})['then'](function(){return _0xf4dce1['Campaign']['findAll']({'attributes':['id',_0xb43e('0x31'),_0xb43e('0x17')],'include':[{'model':_0xf4dce1[_0xb43e('0x39')],'as':'Lists','where':{'id':_0x21d101[_0xb43e('0x26')]}}]})[_0xb43e('0x19')](function(_0x10d5f3){if(_0x10d5f3){var _0x3ad7cc=[];for(var _0x1f78d1=0x0,_0x5e144d;_0x1f78d1<_0x10d5f3['length'];_0x1f78d1+=0x1){_0x5e144d=_0x10d5f3[_0x1f78d1][_0xb43e('0x11')]({'plain':!![]});switch(_0x5e144d[_0xb43e('0x31')]){case'always':_0x14ea74(_0x5e144d)['catch'](_0x100d9f());break;case _0xb43e('0x3a'):_0x2620b6(_0x5e144d)['catch'](_0x100d9f());break;default:_0xf4dce1['CmHopper'][_0xb43e('0x21')]({'phone':_0x21d101['phone'],'ContactId':_0x21d101['id'],'ListId':_0x21d101[_0xb43e('0x26')],'scheduledat':_0x21d101[_0xb43e('0x14')]?_0x21d101[_0xb43e('0x14')]:moment()[_0xb43e('0x15')](_0xb43e('0x1c')),'priority':_0x21d101[_0xb43e('0x22')]?_0x21d101[_0xb43e('0x22')]:0x2,'callback':_0x21d101[_0xb43e('0x23')]?!![]:![],'callbackuniqueid':_0x21d101['callbackUniqueid']?_0x21d101[_0xb43e('0x23')]:undefined,'callbackat':_0x21d101['callbackUniqueid']?moment()[_0xb43e('0x15')](_0xb43e('0x1c')):undefined,'CampaignId':_0x5e144d['id']})[_0xb43e('0x27')](_0x100d9f());}}}});})[_0xb43e('0x19')](function(){return _0xf4dce1[_0xb43e('0x2a')][_0xb43e('0x2f')]({'attributes':['id'],'include':[{'model':_0xf4dce1[_0xb43e('0x39')],'as':_0xb43e('0x34'),'where':{'id':_0x21d101[_0xb43e('0x26')]}}]})[_0xb43e('0x19')](function(_0x14ce80){if(_0x14ce80){var _0x33faba=[];for(var _0x514571=0x0,_0x25e19b;_0x514571<_0x14ce80['length'];_0x514571+=0x1){_0x25e19b=_0x14ce80[_0x514571]['get']({'plain':!![]});_0xf4dce1[_0xb43e('0x36')]['create']({'phone':_0x21d101[_0xb43e('0xb')],'ContactId':_0x21d101['id'],'ListId':_0x21d101[_0xb43e('0x26')],'CampaignId':_0x25e19b['id']})[_0xb43e('0x27')](function(_0x12f987){logger[_0xb43e('0x12')](_0xb43e('0x37'),'afterCreate',_0x12f987[_0xb43e('0x38')]);});}}});})[_0xb43e('0x19')](function(){_0x3be02d();})[_0xb43e('0x27')](function(_0x14439c){logger[_0xb43e('0x12')]('cmContact,\x20%s,\x20%s',_0xb43e('0x13'),_0x14439c[_0xb43e('0x38')]);_0x3be02d(_0x14439c);});}else{_0x3be02d(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x3360e4,_0x5335e0,_0x83dcfc){var _0x32e21a=_0x1bf80e['models'];var _0x26746a=_0x3360e4[_0xb43e('0x11')]({'plain':!![]});return _0x32e21a[_0xb43e('0x1e')][_0xb43e('0x2f')]({'raw':!![],'where':{'ListId':_0x26746a[_0xb43e('0x26')],'ContactId':_0x26746a['id']}})[_0xb43e('0x19')](function(_0x34bf1c){if(!_[_0xb43e('0x3b')](_0x34bf1c)){var _0x493277=[];for(var _0x39ef9d=0x0;_0x39ef9d<_0x34bf1c['length'];_0x39ef9d+=0x1){var _0x58b3f5=_0x32e21a['CmHopper'][_0xb43e('0x3c')]({'where':{'ListId':_0x34bf1c[_0x39ef9d]['ListId'],'ContactId':_0x34bf1c[_0x39ef9d][_0xb43e('0x3d')],'VoiceQueueId':_0x34bf1c[_0x39ef9d]['VoiceQueueId'],'CampaignId':_0x34bf1c[_0x39ef9d][_0xb43e('0x3e')]}});_0x493277['push'](_0x58b3f5);}return BPromise['all'](_0x493277);}})[_0xb43e('0x19')](function(_0xf72fc6){logger[_0xb43e('0x3f')](_0xb43e('0x40'),util[_0xb43e('0x29')](_0xf72fc6,{'showHidden':![],'depth':null}));_0x83dcfc();})[_0xb43e('0x27')](function(_0x5b8879){logger['error'](_0xb43e('0x41'),util['inspect'](_0x5b8879,{'showHidden':![],'depth':null}));_0x83dcfc(_0x5b8879);});}}});}; \ No newline at end of file +var _0x1048=['mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add','minutes','ret','findOne','cmContact,\x20afterCreate\x20','CmHopper','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','always','onlyIfOpen','CmList','BlackLists','cmContact,\x20%s,\x20%s','message','CmHopperBlack','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','exports','CmContact','cm_contacts','phone','firstName','lastName'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1048,0x1b3));var _0x8104=function(_0x1d3568,_0x4d1396){_0x1d3568=_0x1d3568-0x0;var _0x2eb514=_0x1048[_0x1d3568];return _0x2eb514;};'use strict';var _=require(_0x8104('0x0'));var util=require(_0x8104('0x1'));var logger=require(_0x8104('0x2'))(_0x8104('0x3'));var moment=require('moment');var BPromise=require(_0x8104('0x4'));var rp=require(_0x8104('0x5'));var fs=require('fs');var path=require(_0x8104('0x6'));var rimraf=require('rimraf');var config=require(_0x8104('0x7'));var shared=require(_0x8104('0x8'));var attributes=require('./cmContact.attributes');module[_0x8104('0x9')]=function(_0x566ac3,_0x251847){return _0x566ac3['define'](_0x8104('0xa'),attributes,{'tableName':_0x8104('0xb'),'paranoid':!![],'indexes':[{'name':_0x8104('0xc'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0x8104('0xd'),_0x8104('0xe'),_0x8104('0xc'),_0x8104('0xf'),_0x8104('0x10'),_0x8104('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x8104('0x12'),'collate':_0x8104('0x13'),'hooks':{'afterCreate':function(_0x4b137a,_0xc8c589,_0x2cb184){var _0x278fb8=_0x566ac3['models'];var _0x1a6ca7=_0x4b137a[_0x8104('0x14')]({'plain':!![]});function _0x555baf(){return function(_0xcad253){logger[_0x8104('0x15')](_0x8104('0x16'),_0x8104('0x17'),util[_0x8104('0x18')](_0xcad253,{'showHidden':![],'depth':null}));};}function _0x535b7(_0x444e43,_0x59b317){var _0x420ffb=_0x59b317['scheduledat']?_0x59b317[_0x8104('0x19')]:moment()[_0x8104('0x1a')](_0x8104('0x1b'));return new BPromise(function(_0x362cb3,_0x5d2936){if(_[_0x8104('0x1c')](_0x59b317[_0x8104('0x1d')])){_0x362cb3({'ret':_0x420ffb});}else{_0x278fb8[_0x8104('0x1e')]['findOne']({'where':{'id':_0x444e43['id']}})[_0x8104('0x1f')](function(_0x3764be){if(!_[_0x8104('0x1c')](_0x3764be)){var _0x10b85e=_0x3764be[_0x8104('0x1d')];if(!_[_0x8104('0x1c')](_0x10b85e)){var _0x2c10d7=shared[_0x8104('0x20')];var _0x2767f0=_0x2c10d7[_0x10b85e];var _0x57afc9=_0x2c10d7[_0x59b317[_0x8104('0x1d')]];if(!_[_0x8104('0x1c')](_0x2767f0)&&!_[_0x8104('0x1c')](_0x57afc9)){var _0x259f7f=_0x2767f0[_0x8104('0x21')]-_0x57afc9['utcOffset'];_0x420ffb=_0x59b317[_0x8104('0x19')]?_0x59b317[_0x8104('0x19')]:moment();var _0x428dbf=moment(_0x420ffb)[_0x8104('0x22')](_0x259f7f,_0x8104('0x23'));_0x362cb3({'ret':_0x428dbf[_0x8104('0x1a')](_0x8104('0x1b'))});}else _0x362cb3({'ret':_0x420ffb});}else _0x362cb3({'ret':_0x420ffb});}else{_0x362cb3({'ret':_0x420ffb});}});}});return 0xa;}var _0x35a692=function(_0x5c9179){return new BPromise(function(_0x163f99,_0x29af02){_0x535b7(_0x5c9179,_0x1a6ca7)[_0x8104('0x1f')](function(_0x1dddd0){_0x1a6ca7[_0x8104('0x19')]=_0x1dddd0[_0x8104('0x24')];_0x278fb8['CmHopper'][_0x8104('0x25')]({'where':{'phone':_0x1a6ca7['phone'],'VoiceQueueId':_0x5c9179['id']}})[_0x8104('0x1f')](function(_0x4ac75d){if(!_[_0x8104('0x1c')](_0x4ac75d)){throw new Error(_0x8104('0x26')+_0x1a6ca7[_0x8104('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5c9179['id']);}return _0x278fb8[_0x8104('0x27')][_0x8104('0x28')]({'phone':_0x1a6ca7[_0x8104('0xc')],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'priority':_0x1a6ca7[_0x8104('0x2a')]?_0x1a6ca7[_0x8104('0x2a')]:0x2,'scheduledat':_0x1a6ca7[_0x8104('0x19')]?_0x1a6ca7['scheduledat']:moment()[_0x8104('0x1a')](_0x8104('0x1b')),'callback':_0x1a6ca7[_0x8104('0x2b')]?!![]:![],'callbackuniqueid':_0x1a6ca7[_0x8104('0x2b')]?_0x1a6ca7[_0x8104('0x2b')]:undefined,'callbackat':_0x1a6ca7[_0x8104('0x2b')]?moment()[_0x8104('0x1a')](_0x8104('0x1b')):undefined,'VoiceQueueId':_0x5c9179['id']});})[_0x8104('0x2c')](function(_0x1dbd36){_0x29af02(_0x1dbd36);});});});};var _0x2004f1=function(_0x6fe5f0){return new BPromise(function(_0x2c39c3,_0x1d8301){_0x535b7(_0x6fe5f0,_0x1a6ca7)['then'](function(_0x27589f){_0x1a6ca7[_0x8104('0x19')]=_0x27589f[_0x8104('0x24')];_0x278fb8['CmHopper'][_0x8104('0x25')]({'where':{'phone':_0x1a6ca7[_0x8104('0xc')],'VoiceQueueId':_0x6fe5f0['id']}})[_0x8104('0x1f')](function(_0x3cc0e4){if(!_[_0x8104('0x1c')](_0x3cc0e4)){throw new Error(_0x8104('0x26')+_0x1a6ca7[_0x8104('0xc')]+_0x8104('0x2d')+_0x6fe5f0['id']);}return _0x278fb8['CmHopperFinal'][_0x8104('0x25')]({'where':{'calleridnum':_0x1a6ca7[_0x8104('0xc')],'VoiceQueueId':_0x6fe5f0['id']}});})['then'](function(_0x315d1d){if(!_[_0x8104('0x1c')](_0x315d1d)){throw new Error(_0x8104('0x2e')+_0x1a6ca7[_0x8104('0xc')]+_0x8104('0x2f')+_0x6fe5f0['id']);}return _0x278fb8[_0x8104('0x27')][_0x8104('0x28')]({'phone':_0x1a6ca7[_0x8104('0xc')],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'priority':_0x1a6ca7[_0x8104('0x2a')]?_0x1a6ca7[_0x8104('0x2a')]:0x2,'scheduledat':_0x1a6ca7['scheduledat']?_0x1a6ca7[_0x8104('0x19')]:moment()[_0x8104('0x1a')](_0x8104('0x1b')),'callback':_0x1a6ca7[_0x8104('0x2b')]?!![]:![],'callbackuniqueid':_0x1a6ca7['callbackUniqueid']?_0x1a6ca7['callbackUniqueid']:undefined,'callbackat':_0x1a6ca7['callbackUniqueid']?moment()[_0x8104('0x1a')](_0x8104('0x1b')):undefined,'VoiceQueueId':_0x6fe5f0['id']});})[_0x8104('0x2c')](function(_0x1920ed){_0x1d8301(_0x1920ed);});});});};function _0xd74cb(){return function(_0x30a5b0){logger[_0x8104('0x15')](_0x8104('0x16'),_0x8104('0x17'),util['inspect'](_0x30a5b0,{'showHidden':![],'depth':null}));};}function _0x10d850(_0x2f34a4,_0x59480a){var _0x1a136d=_0x59480a['scheduledat']?_0x59480a[_0x8104('0x19')]:moment()[_0x8104('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x35bdbb,_0x5670d9){if(_[_0x8104('0x1c')](_0x59480a[_0x8104('0x1d')])){_0x35bdbb({'ret':_0x1a136d});}else{_0x278fb8[_0x8104('0x30')][_0x8104('0x25')]({'where':{'id':_0x2f34a4['id']}})[_0x8104('0x1f')](function(_0x48f235){if(!_[_0x8104('0x1c')](_0x48f235)){var _0x5eb116=_0x48f235[_0x8104('0x1d')];if(!_['isNil'](_0x5eb116)){var _0x417bb7=shared[_0x8104('0x20')];var _0x1476e0=_0x417bb7[_0x5eb116];var _0x4fa379=_0x417bb7[_0x59480a['dialTimezone']];if(!_[_0x8104('0x1c')](_0x1476e0)&&!_[_0x8104('0x1c')](_0x4fa379)){var _0x473d8d=_0x1476e0[_0x8104('0x21')]-_0x4fa379['utcOffset'];_0x1a136d=_0x59480a['scheduledat']?_0x59480a[_0x8104('0x19')]:moment();var _0x3b9d42=moment(_0x1a136d)['add'](_0x473d8d,_0x8104('0x23'));_0x35bdbb({'ret':_0x3b9d42[_0x8104('0x1a')](_0x8104('0x1b'))});}else _0x35bdbb({'ret':_0x1a136d});}else _0x35bdbb({'ret':_0x1a136d});}else{_0x35bdbb({'ret':_0x1a136d});}});}});return 0xa;}var _0x3fcc98=function(_0x2cb275){return new BPromise(function(_0x46aed2,_0x5a9604){_0x10d850(_0x2cb275,_0x1a6ca7)[_0x8104('0x1f')](function(_0x13f1da){_0x1a6ca7['scheduledat']=_0x13f1da['ret'];_0x278fb8['CmHopper']['findOne']({'where':{'phone':_0x1a6ca7[_0x8104('0xc')],'CampaignId':_0x2cb275['id']}})['then'](function(_0x54c36e){if(!_[_0x8104('0x1c')](_0x54c36e)){throw new Error(_0x8104('0x26')+_0x1a6ca7[_0x8104('0xc')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x2cb275['id']);}return _0x278fb8['CmHopper'][_0x8104('0x28')]({'phone':_0x1a6ca7[_0x8104('0xc')],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'priority':_0x1a6ca7[_0x8104('0x2a')]?_0x1a6ca7[_0x8104('0x2a')]:0x2,'scheduledat':_0x1a6ca7[_0x8104('0x19')]?_0x1a6ca7[_0x8104('0x19')]:moment()[_0x8104('0x1a')](_0x8104('0x1b')),'callback':_0x1a6ca7[_0x8104('0x2b')]?!![]:![],'callbackuniqueid':_0x1a6ca7[_0x8104('0x2b')]?_0x1a6ca7[_0x8104('0x2b')]:undefined,'callbackat':_0x1a6ca7[_0x8104('0x2b')]?moment()[_0x8104('0x1a')](_0x8104('0x1b')):undefined,'CampaignId':_0x2cb275['id']});})[_0x8104('0x2c')](function(_0x4a23f0){_0x5a9604(_0x4a23f0);});});});};var _0x24ce46=function(_0x44f90c){return new BPromise(function(_0x15061f,_0x25e4b7){_0x10d850(_0x44f90c,_0x1a6ca7)[_0x8104('0x1f')](function(_0xc314bb){_0x1a6ca7[_0x8104('0x19')]=_0xc314bb[_0x8104('0x24')];_0x278fb8[_0x8104('0x27')]['findOne']({'where':{'phone':_0x1a6ca7[_0x8104('0xc')],'CampaignId':_0x44f90c['id']}})['then'](function(_0x5d14a7){if(!_[_0x8104('0x1c')](_0x5d14a7)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1a6ca7[_0x8104('0xc')]+_0x8104('0x31')+_0x44f90c['id']);}return _0x278fb8[_0x8104('0x32')][_0x8104('0x25')]({'where':{'calleridnum':_0x1a6ca7[_0x8104('0xc')],'CampaignId':_0x44f90c['id']}});})[_0x8104('0x1f')](function(_0x1e27bb){if(!_[_0x8104('0x1c')](_0x1e27bb)){throw new Error(_0x8104('0x2e')+_0x1a6ca7[_0x8104('0xc')]+_0x8104('0x33')+_0x44f90c['id']);}return _0x278fb8['CmHopper'][_0x8104('0x28')]({'phone':_0x1a6ca7[_0x8104('0xc')],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'priority':_0x1a6ca7[_0x8104('0x2a')]?_0x1a6ca7[_0x8104('0x2a')]:0x2,'scheduledat':_0x1a6ca7['scheduledat']?_0x1a6ca7[_0x8104('0x19')]:moment()['format'](_0x8104('0x1b')),'callback':_0x1a6ca7[_0x8104('0x2b')]?!![]:![],'callbackuniqueid':_0x1a6ca7[_0x8104('0x2b')]?_0x1a6ca7[_0x8104('0x2b')]:undefined,'callbackat':_0x1a6ca7[_0x8104('0x2b')]?moment()['format'](_0x8104('0x1b')):undefined,'CampaignId':_0x44f90c['id']});})[_0x8104('0x2c')](function(_0x43e795){_0x25e4b7(_0x43e795);});});});};if(_0x1a6ca7[_0x8104('0x29')]){_0x278fb8['VoiceQueue'][_0x8104('0x34')]({'where':{'type':_0x8104('0x35')},'attributes':['id',_0x8104('0x36'),'dialTimezone'],'include':[{'model':_0x278fb8['CmList'],'as':_0x8104('0x37'),'where':{'id':_0x1a6ca7[_0x8104('0x29')]}}]})[_0x8104('0x1f')](function(_0x46323e){if(_0x46323e){var _0x25cd57=[];for(var _0x4844d2=0x0,_0x4ef3d0;_0x4844d2<_0x46323e[_0x8104('0x38')];_0x4844d2+=0x1){_0x4ef3d0=_0x46323e[_0x4844d2][_0x8104('0x14')]({'plain':!![]});switch(_0x4ef3d0[_0x8104('0x36')]){case _0x8104('0x39'):_0x2004f1(_0x4ef3d0)['catch'](_0x555baf());break;case _0x8104('0x3a'):_0x35a692(_0x4ef3d0)[_0x8104('0x2c')](_0x555baf());break;default:_0x10d850(_0x4ef3d0,_0x1a6ca7)[_0x8104('0x1f')](function(_0x58a50e){_0x1a6ca7['scheduledat']=_0x58a50e[_0x8104('0x24')];_0x278fb8['CmHopper']['create']({'phone':_0x1a6ca7[_0x8104('0xc')],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'scheduledat':_0x1a6ca7['scheduledat']?_0x1a6ca7['scheduledat']:moment()[_0x8104('0x1a')](_0x8104('0x1b')),'priority':_0x1a6ca7[_0x8104('0x2a')]?_0x1a6ca7[_0x8104('0x2a')]:0x2,'callback':_0x1a6ca7['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1a6ca7['callbackUniqueid']?_0x1a6ca7[_0x8104('0x2b')]:undefined,'callbackat':_0x1a6ca7['callbackUniqueid']?moment()[_0x8104('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4ef3d0['id']})[_0x8104('0x2c')](_0x555baf());});}}}})[_0x8104('0x1f')](function(){return _0x278fb8[_0x8104('0x1e')][_0x8104('0x34')]({'where':{'type':_0x8104('0x35')},'attributes':['id'],'include':[{'model':_0x278fb8[_0x8104('0x3b')],'as':_0x8104('0x3c'),'where':{'id':_0x1a6ca7['ListId']}}]})[_0x8104('0x1f')](function(_0x559f77){if(_0x559f77){var _0x13c08d=[];for(var _0x2d5bab=0x0,_0x266f36;_0x2d5bab<_0x559f77[_0x8104('0x38')];_0x2d5bab+=0x1){_0x266f36=_0x559f77[_0x2d5bab][_0x8104('0x14')]({'plain':!![]});_0x278fb8['CmHopperBlack'][_0x8104('0x28')]({'phone':_0x1a6ca7['phone'],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'VoiceQueueId':_0x266f36['id']})[_0x8104('0x2c')](function(_0x44ad1d){logger['error'](_0x8104('0x3d'),'afterCreate',_0x44ad1d[_0x8104('0x3e')]);});}}});})[_0x8104('0x1f')](function(){return _0x278fb8[_0x8104('0x30')][_0x8104('0x34')]({'attributes':['id','dialCheckDuplicateType',_0x8104('0x1d')],'include':[{'model':_0x278fb8[_0x8104('0x3b')],'as':_0x8104('0x37'),'where':{'id':_0x1a6ca7[_0x8104('0x29')]}}]})[_0x8104('0x1f')](function(_0x94e8dd){if(_0x94e8dd){var _0x5dc520=[];for(var _0x1b6692=0x0,_0x52f457;_0x1b6692<_0x94e8dd[_0x8104('0x38')];_0x1b6692+=0x1){_0x52f457=_0x94e8dd[_0x1b6692]['get']({'plain':!![]});switch(_0x52f457['dialCheckDuplicateType']){case'always':_0x24ce46(_0x52f457)['catch'](_0xd74cb());break;case'onlyIfOpen':_0x3fcc98(_0x52f457)['catch'](_0xd74cb());break;default:_0x278fb8[_0x8104('0x27')][_0x8104('0x28')]({'phone':_0x1a6ca7[_0x8104('0xc')],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'scheduledat':_0x1a6ca7[_0x8104('0x19')]?_0x1a6ca7[_0x8104('0x19')]:moment()[_0x8104('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1a6ca7[_0x8104('0x2a')]?_0x1a6ca7[_0x8104('0x2a')]:0x2,'callback':_0x1a6ca7[_0x8104('0x2b')]?!![]:![],'callbackuniqueid':_0x1a6ca7[_0x8104('0x2b')]?_0x1a6ca7[_0x8104('0x2b')]:undefined,'callbackat':_0x1a6ca7[_0x8104('0x2b')]?moment()[_0x8104('0x1a')](_0x8104('0x1b')):undefined,'CampaignId':_0x52f457['id']})[_0x8104('0x2c')](_0xd74cb());}}}});})['then'](function(){return _0x278fb8[_0x8104('0x30')][_0x8104('0x34')]({'attributes':['id'],'include':[{'model':_0x278fb8[_0x8104('0x3b')],'as':_0x8104('0x3c'),'where':{'id':_0x1a6ca7[_0x8104('0x29')]}}]})['then'](function(_0x47b1f3){if(_0x47b1f3){var _0x52cde0=[];for(var _0x2bff65=0x0,_0x4d1fd8;_0x2bff65<_0x47b1f3[_0x8104('0x38')];_0x2bff65+=0x1){_0x4d1fd8=_0x47b1f3[_0x2bff65][_0x8104('0x14')]({'plain':!![]});_0x278fb8[_0x8104('0x3f')][_0x8104('0x28')]({'phone':_0x1a6ca7[_0x8104('0xc')],'ContactId':_0x1a6ca7['id'],'ListId':_0x1a6ca7[_0x8104('0x29')],'CampaignId':_0x4d1fd8['id']})[_0x8104('0x2c')](function(_0x3f7125){logger[_0x8104('0x15')](_0x8104('0x3d'),'afterCreate',_0x3f7125['message']);});}}});})[_0x8104('0x1f')](function(){_0x2cb184();})['catch'](function(_0x4eda1e){logger['error'](_0x8104('0x3d'),_0x8104('0x17'),_0x4eda1e['message']);_0x2cb184(_0x4eda1e);});}else{_0x2cb184(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0xc95ddf,_0x4faab0,_0x1d575d){var _0x4357b6=_0x566ac3[_0x8104('0x40')];var _0x5747ee=_0xc95ddf[_0x8104('0x14')]({'plain':!![]});return _0x4357b6['CmHopper'][_0x8104('0x34')]({'raw':!![],'where':{'ListId':_0x5747ee[_0x8104('0x29')],'ContactId':_0x5747ee['id']}})[_0x8104('0x1f')](function(_0x5e361b){if(!_[_0x8104('0x41')](_0x5e361b)){var _0x1ed7fe=[];for(var _0x44ee90=0x0;_0x44ee90<_0x5e361b[_0x8104('0x38')];_0x44ee90+=0x1){var _0x3f317f=_0x4357b6[_0x8104('0x27')][_0x8104('0x42')]({'where':{'ListId':_0x5e361b[_0x44ee90][_0x8104('0x29')],'ContactId':_0x5e361b[_0x44ee90][_0x8104('0x43')],'VoiceQueueId':_0x5e361b[_0x44ee90][_0x8104('0x44')],'CampaignId':_0x5e361b[_0x44ee90][_0x8104('0x45')]}});_0x1ed7fe[_0x8104('0x46')](_0x3f317f);}return BPromise[_0x8104('0x47')](_0x1ed7fe);}})[_0x8104('0x1f')](function(_0xa5744d){logger[_0x8104('0x48')](_0x8104('0x49'),util['inspect'](_0xa5744d,{'showHidden':![],'depth':null}));_0x1d575d();})[_0x8104('0x2c')](function(_0x8b4d9d){logger[_0x8104('0x15')](_0x8104('0x4a'),util['inspect'](_0x8b4d9d,{'showHidden':![],'depth':null}));_0x1d575d(_0x8b4d9d);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 81a521f..3ed908b 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x579022,_0x55f459){var _0x52cfb4=function(_0x30fa09){while(--_0x30fa09){_0x579022['push'](_0x579022['shift']());}};_0x52cfb4(++_0x55f459);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 0bd9c03..94e6246 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['STRING','sequelize','exports','INTEGER','PHONE'];(function(_0x521b5e,_0x28e147){var _0x2b9ded=function(_0x1ebb36){while(--_0x1ebb36){_0x521b5e['push'](_0x521b5e['shift']());}};_0x2b9ded(++_0x28e147);}(_0xf109,0xce));var _0x9f10=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf109[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'CmContactId':{'type':Sequelize[_0x9f10('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x9f10('0x3')},'OrderBy':{'type':Sequelize[_0x9f10('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x9f10('0x4')],'defaultValue':null}}; \ No newline at end of file +var _0xb0d9=['sequelize','exports','INTEGER','STRING'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x2ac9af,_0x2f6be0){_0x2ac9af=_0x2ac9af-0x0;var _0x4767c6=_0xb0d9[_0x2ac9af];return _0x4767c6;};'use strict';var Sequelize=require(_0x9b0d('0x0'));module[_0x9b0d('0x1')]={'CmContactId':{'type':Sequelize[_0x9b0d('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x9b0d('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9b0d('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9b0d('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x9b0d('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 0f35c6c..a7bccef 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4807=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x4807,0x6b));var _0x7480=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4807[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x7480('0x0'));var rimraf=require(_0x7480('0x1'));var zipdir=require(_0x7480('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7480('0x3'));var moment=require('moment');var BPromise=require(_0x7480('0x4'));var Mustache=require(_0x7480('0x5'));var util=require(_0x7480('0x6'));var path=require('path');var sox=require(_0x7480('0x7'));var csv=require(_0x7480('0x8'));var ejs=require(_0x7480('0x9'));var fs=require('fs');var fs_extra=require(_0x7480('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7480('0xb'));var deskjs=require(_0x7480('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7480('0xd'));var Papa=require(_0x7480('0xe'));var Redis=require(_0x7480('0xf'));var authService=require(_0x7480('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7480('0x11'));var hardwareService=require(_0x7480('0x12'));var logger=require(_0x7480('0x13'))(_0x7480('0x14'));var utils=require(_0x7480('0x15'));var config=require(_0x7480('0x16'));var licenseUtil=require(_0x7480('0x17'));var db=require(_0x7480('0x18'))['db'];function respondWithStatusCode(_0x367847,_0x57a85f){_0x57a85f=_0x57a85f||0xcc;return function(_0x3abf1a){if(_0x3abf1a){return _0x367847['sendStatus'](_0x57a85f);}return _0x367847[_0x7480('0x19')](_0x57a85f)[_0x7480('0x1a')]();};}function respondWithResult(_0x287a50,_0x37f68c){_0x37f68c=_0x37f68c||0xc8;return function(_0x4e2ce7){if(_0x4e2ce7){return _0x287a50[_0x7480('0x19')](_0x37f68c)[_0x7480('0x1b')](_0x4e2ce7);}};}function respondWithFilteredResult(_0x1267f2,_0x40ef33){return function(_0xacf1a2){if(_0xacf1a2){var _0x5b03dd=typeof _0x40ef33[_0x7480('0x1c')]===_0x7480('0x1d')&&typeof _0x40ef33['limit']===_0x7480('0x1d');var _0x3e0e6c=_0xacf1a2[_0x7480('0x1e')];var _0x41af66=_0x5b03dd?0x0:_0x40ef33[_0x7480('0x1c')];var _0xf9893=_0x5b03dd?_0xacf1a2[_0x7480('0x1e')]:_0x40ef33[_0x7480('0x1c')]+_0x40ef33['limit'];var _0x4c7325;if(_0xf9893>=_0x3e0e6c){_0xf9893=_0x3e0e6c;_0x4c7325=0xc8;}else{_0x4c7325=0xce;}_0x1267f2[_0x7480('0x19')](_0x4c7325);return _0x1267f2[_0x7480('0x1f')](_0x7480('0x20'),_0x41af66+'-'+_0xf9893+'/'+_0x3e0e6c)[_0x7480('0x1b')](_0xacf1a2);}return null;};}function patchUpdates(_0x5e82ae){return function(_0x14d0c7){try{jsonpatch[_0x7480('0x21')](_0x14d0c7,_0x5e82ae,!![]);}catch(_0x57a9f9){return BPromise[_0x7480('0x22')](_0x57a9f9);}return _0x14d0c7[_0x7480('0x23')]();};}function saveUpdates(_0x4ca7e3,_0x222f4e){return function(_0x5a64c5){if(_0x5a64c5){return _0x5a64c5[_0x7480('0x24')](_0x4ca7e3)[_0x7480('0x25')](function(_0x8ded12){return _0x8ded12;});}return null;};}function removeEntity(_0x1985d6,_0x49dc57){return function(_0x9e5923){if(_0x9e5923){return _0x9e5923['destroy']()['then'](function(){var _0x5a07d8=_0x9e5923['get']({'plain':!![]});var _0x56ed57='CmContactHasItems';return db['UserProfileResource'][_0x7480('0x26')]({'where':{'type':_0x56ed57,'resourceId':_0x5a07d8['id']}})['then'](function(){return _0x9e5923;});})[_0x7480('0x25')](function(){_0x1985d6[_0x7480('0x19')](0xcc)[_0x7480('0x1a')]();});}};}function handleEntityNotFound(_0x5ad888,_0x35eda1){return function(_0x497430){if(!_0x497430){_0x5ad888[_0x7480('0x27')](0x194);}return _0x497430;};}function handleError(_0x2f7915,_0x1d54f7){_0x1d54f7=_0x1d54f7||0x1f4;return function(_0x465547){logger[_0x7480('0x28')](_0x465547['stack']);if(_0x465547['name']){delete _0x465547[_0x7480('0x29')];}_0x2f7915[_0x7480('0x19')](_0x1d54f7)[_0x7480('0x2a')](_0x465547);};}exports[_0x7480('0x2b')]=function(_0x1ab8e1,_0x53a951){var _0x27b269={},_0x184674={},_0x4074bd={'count':0x0,'rows':[]};var _0xaa3ee8=_[_0x7480('0x2c')](db[_0x7480('0x2d')][_0x7480('0x2e')],function(_0x447460){return{'name':_0x447460[_0x7480('0x2f')],'type':_0x447460['type'][_0x7480('0x30')]};});_0x184674[_0x7480('0x31')]=_[_0x7480('0x2c')](_0xaa3ee8,_0x7480('0x29'));_0x184674[_0x7480('0x32')]=_['keys'](_0x1ab8e1[_0x7480('0x32')]);_0x184674[_0x7480('0x33')]=_[_0x7480('0x34')](_0x184674[_0x7480('0x31')],_0x184674[_0x7480('0x32')]);_0x27b269[_0x7480('0x35')]=_['intersection'](_0x184674[_0x7480('0x31')],qs['fields'](_0x1ab8e1[_0x7480('0x32')][_0x7480('0x36')]));_0x27b269[_0x7480('0x35')]=_0x27b269['attributes'][_0x7480('0x37')]?_0x27b269['attributes']:_0x184674[_0x7480('0x31')];if(!_0x1ab8e1['query'][_0x7480('0x38')](_0x7480('0x39'))){_0x27b269[_0x7480('0x3a')]=qs['limit'](_0x1ab8e1[_0x7480('0x32')][_0x7480('0x3a')]);_0x27b269[_0x7480('0x1c')]=qs[_0x7480('0x1c')](_0x1ab8e1[_0x7480('0x32')][_0x7480('0x1c')]);}_0x27b269[_0x7480('0x3b')]=qs['sort'](_0x1ab8e1['query']['sort']);_0x27b269[_0x7480('0x3c')]=qs[_0x7480('0x33')](_[_0x7480('0x3d')](_0x1ab8e1[_0x7480('0x32')],_0x184674[_0x7480('0x33')]),_0xaa3ee8);if(_0x1ab8e1['query'][_0x7480('0x3e')]){_0x27b269['where']=_[_0x7480('0x3f')](_0x27b269[_0x7480('0x3c')],{'$or':_[_0x7480('0x2c')](_0xaa3ee8,function(_0x184374){if(_0x184374[_0x7480('0x40')]!==_0x7480('0x41')){var _0x34146c={};_0x34146c[_0x184374[_0x7480('0x29')]]={'$like':'%'+_0x1ab8e1['query']['filter']+'%'};return _0x34146c;}})});}_0x27b269=_[_0x7480('0x3f')]({},_0x27b269,_0x1ab8e1[_0x7480('0x42')]);var _0x5047c5={'where':_0x27b269[_0x7480('0x3c')]};return db[_0x7480('0x2d')][_0x7480('0x1e')](_0x5047c5)[_0x7480('0x25')](function(_0x3fa08e){_0x4074bd['count']=_0x3fa08e;if(_0x1ab8e1['query'][_0x7480('0x43')]){_0x27b269[_0x7480('0x44')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x7480('0x45')](_0x27b269);})['then'](function(_0x3b7361){_0x4074bd[_0x7480('0x46')]=_0x3b7361;return _0x4074bd;})['then'](respondWithFilteredResult(_0x53a951,_0x27b269))[_0x7480('0x47')](handleError(_0x53a951,null));};exports['show']=function(_0x331ca2,_0x23b9a8){var _0x2543e4={'raw':!![],'where':{'id':_0x331ca2[_0x7480('0x48')]['id']}},_0x416574={};_0x416574[_0x7480('0x31')]=_[_0x7480('0x49')](db[_0x7480('0x2d')]['rawAttributes']);_0x416574['query']=_[_0x7480('0x49')](_0x331ca2[_0x7480('0x32')]);_0x416574[_0x7480('0x33')]=_[_0x7480('0x34')](_0x416574['model'],_0x416574['query']);_0x2543e4[_0x7480('0x35')]=_[_0x7480('0x34')](_0x416574['model'],qs[_0x7480('0x36')](_0x331ca2[_0x7480('0x32')][_0x7480('0x36')]));_0x2543e4[_0x7480('0x35')]=_0x2543e4[_0x7480('0x35')]['length']?_0x2543e4[_0x7480('0x35')]:_0x416574['model'];if(_0x331ca2[_0x7480('0x32')][_0x7480('0x43')]){_0x2543e4['include']=[{'all':!![]}];}_0x2543e4=_['merge']({},_0x2543e4,_0x331ca2['options']);return db['CmContactHasItem'][_0x7480('0x4a')](_0x2543e4)[_0x7480('0x25')](handleEntityNotFound(_0x23b9a8,null))[_0x7480('0x25')](respondWithResult(_0x23b9a8,null))[_0x7480('0x47')](handleError(_0x23b9a8,null));};exports[_0x7480('0x4b')]=function(_0x42fe5e,_0x346f36){return db['CmContactHasItem']['create'](_0x42fe5e[_0x7480('0x4c')],{})[_0x7480('0x25')](function(_0x58f851){var _0x1f6289=_0x42fe5e[_0x7480('0x4d')][_0x7480('0x4e')]({'plain':!![]});if(!_0x1f6289)throw new Error(_0x7480('0x4f'));if(_0x1f6289['role']===_0x7480('0x4d')){var _0x52ecd7=_0x58f851[_0x7480('0x4e')]({'plain':!![]});var _0x9b29f5=_0x7480('0x50');return db['UserProfileSection'][_0x7480('0x4a')]({'where':{'name':_0x9b29f5,'userProfileId':_0x1f6289[_0x7480('0x51')]},'raw':!![]})['then'](function(_0x5c4441){if(_0x5c4441&&_0x5c4441[_0x7480('0x52')]===0x0){return db['UserProfileResource'][_0x7480('0x4b')]({'name':_0x52ecd7[_0x7480('0x29')],'resourceId':_0x52ecd7['id'],'type':_0x5c4441[_0x7480('0x29')],'sectionId':_0x5c4441['id']},{})['then'](function(){return _0x58f851;});}else{return _0x58f851;}})[_0x7480('0x47')](function(_0x1df56a){logger[_0x7480('0x28')](_0x7480('0x53'),_0x1df56a);throw _0x1df56a;});}return _0x58f851;})['then'](respondWithResult(_0x346f36,0xc9))[_0x7480('0x47')](handleError(_0x346f36,null));};exports[_0x7480('0x24')]=function(_0x15348c,_0x2f6869){if(_0x15348c[_0x7480('0x4c')]['id']){delete _0x15348c[_0x7480('0x4c')]['id'];}return db[_0x7480('0x2d')]['find']({'where':{'id':_0x15348c[_0x7480('0x48')]['id']}})[_0x7480('0x25')](handleEntityNotFound(_0x2f6869,null))[_0x7480('0x25')](saveUpdates(_0x15348c[_0x7480('0x4c')],null))['then'](respondWithResult(_0x2f6869,null))[_0x7480('0x47')](handleError(_0x2f6869,null));};exports[_0x7480('0x26')]=function(_0x1d8645,_0x466537){return db['CmContactHasItem'][_0x7480('0x4a')]({'where':{'id':_0x1d8645[_0x7480('0x48')]['id']}})[_0x7480('0x25')](handleEntityNotFound(_0x466537,null))['then'](removeEntity(_0x466537,null))['catch'](handleError(_0x466537,null));}; \ No newline at end of file +var _0xfffa=['UserProfileResource','end','error','stack','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0xf077cb,_0x11cfa6){var _0x5549d9=function(_0x131d90){while(--_0x131d90){_0xf077cb['push'](_0xf077cb['shift']());}};_0x5549d9(++_0x11cfa6);}(_0xfffa,0x134));var _0xafff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfffa[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xafff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafff('0x2'));var moment=require(_0xafff('0x3'));var BPromise=require(_0xafff('0x4'));var Mustache=require(_0xafff('0x5'));var util=require(_0xafff('0x6'));var path=require(_0xafff('0x7'));var sox=require('sox');var csv=require(_0xafff('0x8'));var ejs=require(_0xafff('0x9'));var fs=require('fs');var fs_extra=require(_0xafff('0xa'));var _=require('lodash');var squel=require(_0xafff('0xb'));var crypto=require(_0xafff('0xc'));var jsforce=require(_0xafff('0xd'));var deskjs=require(_0xafff('0xe'));var toCsv=require(_0xafff('0x8'));var querystring=require(_0xafff('0xf'));var Papa=require('papaparse');var Redis=require(_0xafff('0x10'));var authService=require(_0xafff('0x11'));var qs=require(_0xafff('0x12'));var as=require(_0xafff('0x13'));var hardwareService=require(_0xafff('0x14'));var logger=require(_0xafff('0x15'))(_0xafff('0x16'));var utils=require(_0xafff('0x17'));var config=require(_0xafff('0x18'));var licenseUtil=require(_0xafff('0x19'));var db=require(_0xafff('0x1a'))['db'];function respondWithStatusCode(_0x6b0681,_0x448c38){_0x448c38=_0x448c38||0xcc;return function(_0x4befcd){if(_0x4befcd){return _0x6b0681[_0xafff('0x1b')](_0x448c38);}return _0x6b0681[_0xafff('0x1c')](_0x448c38)['end']();};}function respondWithResult(_0x45a593,_0x143d68){_0x143d68=_0x143d68||0xc8;return function(_0x1db4a7){if(_0x1db4a7){return _0x45a593[_0xafff('0x1c')](_0x143d68)[_0xafff('0x1d')](_0x1db4a7);}};}function respondWithFilteredResult(_0x5d5d75,_0x4b30f0){return function(_0x23ab68){if(_0x23ab68){var _0x4808d7=typeof _0x4b30f0[_0xafff('0x1e')]===_0xafff('0x1f')&&typeof _0x4b30f0[_0xafff('0x20')]===_0xafff('0x1f');var _0x1c666f=_0x23ab68[_0xafff('0x21')];var _0x2fccfb=_0x4808d7?0x0:_0x4b30f0[_0xafff('0x1e')];var _0x3e1b2e=_0x4808d7?_0x23ab68[_0xafff('0x21')]:_0x4b30f0[_0xafff('0x1e')]+_0x4b30f0['limit'];var _0x103d55;if(_0x3e1b2e>=_0x1c666f){_0x3e1b2e=_0x1c666f;_0x103d55=0xc8;}else{_0x103d55=0xce;}_0x5d5d75[_0xafff('0x1c')](_0x103d55);return _0x5d5d75['set'](_0xafff('0x22'),_0x2fccfb+'-'+_0x3e1b2e+'/'+_0x1c666f)[_0xafff('0x1d')](_0x23ab68);}return null;};}function patchUpdates(_0x46e1b6){return function(_0x206884){try{jsonpatch[_0xafff('0x23')](_0x206884,_0x46e1b6,!![]);}catch(_0x415d1e){return BPromise[_0xafff('0x24')](_0x415d1e);}return _0x206884[_0xafff('0x25')]();};}function saveUpdates(_0x138e43,_0x7b59a5){return function(_0x57683f){if(_0x57683f){return _0x57683f[_0xafff('0x26')](_0x138e43)[_0xafff('0x27')](function(_0x5d224c){return _0x5d224c;});}return null;};}function removeEntity(_0x102501,_0x19dfb5){return function(_0x5dddad){if(_0x5dddad){return _0x5dddad['destroy']()[_0xafff('0x27')](function(){var _0x5a95b4=_0x5dddad['get']({'plain':!![]});var _0x52247c='CmContactHasItems';return db[_0xafff('0x28')]['destroy']({'where':{'type':_0x52247c,'resourceId':_0x5a95b4['id']}})[_0xafff('0x27')](function(){return _0x5dddad;});})[_0xafff('0x27')](function(){_0x102501[_0xafff('0x1c')](0xcc)[_0xafff('0x29')]();});}};}function handleEntityNotFound(_0xbbdb28,_0xfe878b){return function(_0x742fb8){if(!_0x742fb8){_0xbbdb28['sendStatus'](0x194);}return _0x742fb8;};}function handleError(_0x68bf2b,_0x31c7c9){_0x31c7c9=_0x31c7c9||0x1f4;return function(_0x3231cd){logger[_0xafff('0x2a')](_0x3231cd[_0xafff('0x2b')]);if(_0x3231cd['name']){delete _0x3231cd['name'];}_0x68bf2b[_0xafff('0x1c')](_0x31c7c9)['send'](_0x3231cd);};}exports[_0xafff('0x2c')]=function(_0x309a43,_0x58d3db){var _0x3c7fc5={},_0x157cec={},_0x59d71c={'count':0x0,'rows':[]};var _0x28d27f=_[_0xafff('0x2d')](db[_0xafff('0x2e')][_0xafff('0x2f')],function(_0x2d0a65){return{'name':_0x2d0a65[_0xafff('0x30')],'type':_0x2d0a65[_0xafff('0x31')][_0xafff('0x32')]};});_0x157cec[_0xafff('0x33')]=_[_0xafff('0x2d')](_0x28d27f,_0xafff('0x34'));_0x157cec[_0xafff('0x35')]=_[_0xafff('0x36')](_0x309a43['query']);_0x157cec[_0xafff('0x37')]=_['intersection'](_0x157cec[_0xafff('0x33')],_0x157cec[_0xafff('0x35')]);_0x3c7fc5[_0xafff('0x38')]=_[_0xafff('0x39')](_0x157cec[_0xafff('0x33')],qs[_0xafff('0x3a')](_0x309a43[_0xafff('0x35')][_0xafff('0x3a')]));_0x3c7fc5[_0xafff('0x38')]=_0x3c7fc5[_0xafff('0x38')][_0xafff('0x3b')]?_0x3c7fc5['attributes']:_0x157cec[_0xafff('0x33')];if(!_0x309a43[_0xafff('0x35')][_0xafff('0x3c')]('nolimit')){_0x3c7fc5['limit']=qs[_0xafff('0x20')](_0x309a43[_0xafff('0x35')][_0xafff('0x20')]);_0x3c7fc5[_0xafff('0x1e')]=qs[_0xafff('0x1e')](_0x309a43[_0xafff('0x35')][_0xafff('0x1e')]);}_0x3c7fc5[_0xafff('0x3d')]=qs['sort'](_0x309a43[_0xafff('0x35')][_0xafff('0x3e')]);_0x3c7fc5['where']=qs['filters'](_[_0xafff('0x3f')](_0x309a43[_0xafff('0x35')],_0x157cec[_0xafff('0x37')]),_0x28d27f);if(_0x309a43[_0xafff('0x35')][_0xafff('0x40')]){_0x3c7fc5[_0xafff('0x41')]=_['merge'](_0x3c7fc5[_0xafff('0x41')],{'$or':_[_0xafff('0x2d')](_0x28d27f,function(_0x3c3914){if(_0x3c3914[_0xafff('0x31')]!==_0xafff('0x42')){var _0x31649e={};_0x31649e[_0x3c3914[_0xafff('0x34')]]={'$like':'%'+_0x309a43['query'][_0xafff('0x40')]+'%'};return _0x31649e;}})});}_0x3c7fc5=_[_0xafff('0x43')]({},_0x3c7fc5,_0x309a43[_0xafff('0x44')]);var _0x1cebac={'where':_0x3c7fc5[_0xafff('0x41')]};return db['CmContactHasItem'][_0xafff('0x21')](_0x1cebac)[_0xafff('0x27')](function(_0x47193c){_0x59d71c[_0xafff('0x21')]=_0x47193c;if(_0x309a43[_0xafff('0x35')][_0xafff('0x45')]){_0x3c7fc5[_0xafff('0x46')]=[{'all':!![]}];}return db[_0xafff('0x2e')][_0xafff('0x47')](_0x3c7fc5);})[_0xafff('0x27')](function(_0x4e6361){_0x59d71c[_0xafff('0x48')]=_0x4e6361;return _0x59d71c;})[_0xafff('0x27')](respondWithFilteredResult(_0x58d3db,_0x3c7fc5))[_0xafff('0x49')](handleError(_0x58d3db,null));};exports[_0xafff('0x4a')]=function(_0x5a9a68,_0x31d821){var _0x5ad72c={'raw':!![],'where':{'id':_0x5a9a68[_0xafff('0x4b')]['id']}},_0x3a3e32={};_0x3a3e32['model']=_['keys'](db[_0xafff('0x2e')][_0xafff('0x2f')]);_0x3a3e32[_0xafff('0x35')]=_[_0xafff('0x36')](_0x5a9a68[_0xafff('0x35')]);_0x3a3e32[_0xafff('0x37')]=_[_0xafff('0x39')](_0x3a3e32[_0xafff('0x33')],_0x3a3e32[_0xafff('0x35')]);_0x5ad72c[_0xafff('0x38')]=_[_0xafff('0x39')](_0x3a3e32[_0xafff('0x33')],qs[_0xafff('0x3a')](_0x5a9a68['query'][_0xafff('0x3a')]));_0x5ad72c['attributes']=_0x5ad72c['attributes'][_0xafff('0x3b')]?_0x5ad72c[_0xafff('0x38')]:_0x3a3e32[_0xafff('0x33')];if(_0x5a9a68['query'][_0xafff('0x45')]){_0x5ad72c[_0xafff('0x46')]=[{'all':!![]}];}_0x5ad72c=_[_0xafff('0x43')]({},_0x5ad72c,_0x5a9a68[_0xafff('0x44')]);return db[_0xafff('0x2e')]['find'](_0x5ad72c)[_0xafff('0x27')](handleEntityNotFound(_0x31d821,null))[_0xafff('0x27')](respondWithResult(_0x31d821,null))[_0xafff('0x49')](handleError(_0x31d821,null));};exports[_0xafff('0x4c')]=function(_0x33ac7c,_0x5df80f){return db[_0xafff('0x2e')][_0xafff('0x4c')](_0x33ac7c[_0xafff('0x4d')],{})['then'](function(_0x354408){var _0xea2c90=_0x33ac7c[_0xafff('0x4e')][_0xafff('0x4f')]({'plain':!![]});if(!_0xea2c90)throw new Error(_0xafff('0x50'));if(_0xea2c90[_0xafff('0x51')]===_0xafff('0x4e')){var _0x1e62e7=_0x354408[_0xafff('0x4f')]({'plain':!![]});var _0x11852a=_0xafff('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x11852a,'userProfileId':_0xea2c90['userProfileId']},'raw':!![]})[_0xafff('0x27')](function(_0x2c3f22){if(_0x2c3f22&&_0x2c3f22[_0xafff('0x53')]===0x0){return db[_0xafff('0x28')]['create']({'name':_0x1e62e7[_0xafff('0x34')],'resourceId':_0x1e62e7['id'],'type':_0x2c3f22[_0xafff('0x34')],'sectionId':_0x2c3f22['id']},{})[_0xafff('0x27')](function(){return _0x354408;});}else{return _0x354408;}})[_0xafff('0x49')](function(_0x1fa4dc){logger[_0xafff('0x2a')](_0xafff('0x54'),_0x1fa4dc);throw _0x1fa4dc;});}return _0x354408;})[_0xafff('0x27')](respondWithResult(_0x5df80f,0xc9))[_0xafff('0x49')](handleError(_0x5df80f,null));};exports['update']=function(_0x4d6916,_0x458c4c){if(_0x4d6916[_0xafff('0x4d')]['id']){delete _0x4d6916[_0xafff('0x4d')]['id'];}return db[_0xafff('0x2e')][_0xafff('0x55')]({'where':{'id':_0x4d6916[_0xafff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x458c4c,null))['then'](saveUpdates(_0x4d6916[_0xafff('0x4d')],null))[_0xafff('0x27')](respondWithResult(_0x458c4c,null))[_0xafff('0x49')](handleError(_0x458c4c,null));};exports[_0xafff('0x56')]=function(_0x31891f,_0x3e7291){return db[_0xafff('0x2e')]['find']({'where':{'id':_0x31891f[_0xafff('0x4b')]['id']}})[_0xafff('0x27')](handleEntityNotFound(_0x3e7291,null))[_0xafff('0x27')](removeEntity(_0x3e7291,null))['catch'](handleError(_0x3e7291,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 9863703..1685003 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ca=['exports','CmContactHasItem','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x203cf5,_0x8421e0){var _0x17a51d=function(_0x466b7a){while(--_0x466b7a){_0x203cf5['push'](_0x203cf5['shift']());}};_0x17a51d(++_0x8421e0);}(_0x82ca,0x1ee));var _0xa82c=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0x82ca[_0x545b71];return _0x26e587;};'use strict';var _=require(_0xa82c('0x0'));var util=require('util');var logger=require(_0xa82c('0x1'))(_0xa82c('0x2'));var moment=require(_0xa82c('0x3'));var BPromise=require(_0xa82c('0x4'));var rp=require(_0xa82c('0x5'));var fs=require('fs');var path=require(_0xa82c('0x6'));var rimraf=require(_0xa82c('0x7'));var config=require(_0xa82c('0x8'));var attributes=require(_0xa82c('0x9'));module[_0xa82c('0xa')]=function(_0xaf37ae,_0x3d2b37){return _0xaf37ae['define'](_0xa82c('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a66=['exports','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x37fd9d,_0x227b47){var _0x45d964=function(_0x463ce8){while(--_0x463ce8){_0x37fd9d['push'](_0x37fd9d['shift']());}};_0x45d964(++_0x227b47);}(_0x5a66,0x86));var _0x65a6=function(_0x8dcfd8,_0x3dbc70){_0x8dcfd8=_0x8dcfd8-0x0;var _0x5d8fdd=_0x5a66[_0x8dcfd8];return _0x5d8fdd;};'use strict';var _=require('lodash');var util=require(_0x65a6('0x0'));var logger=require(_0x65a6('0x1'))(_0x65a6('0x2'));var moment=require('moment');var BPromise=require(_0x65a6('0x3'));var rp=require(_0x65a6('0x4'));var fs=require('fs');var path=require(_0x65a6('0x5'));var rimraf=require(_0x65a6('0x6'));var config=require(_0x65a6('0x7'));var attributes=require(_0x65a6('0x8'));module[_0x65a6('0x9')]=function(_0x3fa68a,_0x170422){return _0x3fa68a[_0x65a6('0xa')](_0x65a6('0xb'),attributes,{'tableName':_0x65a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 775c749..b123d00 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaec=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x58e5e2,_0x42a862){var _0x4e6615=function(_0xb97d7){while(--_0xb97d7){_0x58e5e2['push'](_0x58e5e2['shift']());}};_0x4e6615(++_0x42a862);}(_0xfaec,0x163));var _0xcfae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfaec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var moment=require('moment');var BPromise=require(_0xcfae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfae('0x3'));var db=require(_0xcfae('0x4'))['db'];var utils=require(_0xcfae('0x5'));var logger=require(_0xcfae('0x6'))(_0xcfae('0x7'));var config=require(_0xcfae('0x8'));var jayson=require(_0xcfae('0x9'));var client=jayson['client'][_0xcfae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a3f9,_0x57d95b,_0xc44966){return new BPromise(function(_0x892cc9,_0x3b0453){return client[_0xcfae('0xb')](_0x28a3f9,_0xc44966)[_0xcfae('0xc')](function(_0x563448){logger[_0xcfae('0xd')](_0xcfae('0xe'),_0x57d95b,_0xcfae('0xf'));logger[_0xcfae('0x10')](_0xcfae('0x11'),_0x57d95b,'request\x20sent',JSON[_0xcfae('0x12')](_0x563448));if(_0x563448[_0xcfae('0x13')]){if(_0x563448['error']['code']===0x1f4){logger[_0xcfae('0x13')](_0xcfae('0xe'),_0x57d95b,_0x563448[_0xcfae('0x13')][_0xcfae('0x14')]);return _0x3b0453(_0x563448[_0xcfae('0x13')]['message']);}logger[_0xcfae('0x13')](_0xcfae('0xe'),_0x57d95b,_0x563448['error'][_0xcfae('0x14')]);return _0x892cc9(_0x563448[_0xcfae('0x13')][_0xcfae('0x14')]);}else{logger[_0xcfae('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x57d95b,'request\x20sent');_0x892cc9(_0x563448[_0xcfae('0x15')][_0xcfae('0x14')]);}})[_0xcfae('0x16')](function(_0x5ce250){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x57d95b,_0x5ce250);_0x3b0453(_0x5ce250);});});} \ No newline at end of file +var _0x16b5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash','bluebird'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x16b5,0x178));var _0x516b=function(_0x26412a,_0x174c3a){_0x26412a=_0x26412a-0x0;var _0x48fc2a=_0x16b5[_0x26412a];return _0x48fc2a;};'use strict';var _=require(_0x516b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x516b('0x1'));var rs=require(_0x516b('0x2'));var fs=require('fs');var Redis=require(_0x516b('0x3'));var db=require(_0x516b('0x4'))['db'];var utils=require(_0x516b('0x5'));var logger=require(_0x516b('0x6'))(_0x516b('0x7'));var config=require(_0x516b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x516b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x216ff6,_0x48ccc5,_0x515f14){return new BPromise(function(_0xd0d009,_0x42e392){return client['request'](_0x216ff6,_0x515f14)['then'](function(_0x202be4){logger[_0x516b('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x48ccc5,_0x516b('0xb'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x48ccc5,_0x516b('0xb'),JSON[_0x516b('0xc')](_0x202be4));if(_0x202be4['error']){if(_0x202be4[_0x516b('0xd')][_0x516b('0xe')]===0x1f4){logger[_0x516b('0xd')](_0x516b('0xf'),_0x48ccc5,_0x202be4[_0x516b('0xd')][_0x516b('0x10')]);return _0x42e392(_0x202be4[_0x516b('0xd')][_0x516b('0x10')]);}logger[_0x516b('0xd')](_0x516b('0xf'),_0x48ccc5,_0x202be4[_0x516b('0xd')][_0x516b('0x10')]);return _0xd0d009(_0x202be4[_0x516b('0xd')][_0x516b('0x10')]);}else{logger['info'](_0x516b('0xf'),_0x48ccc5,_0x516b('0xb'));_0xd0d009(_0x202be4['result'][_0x516b('0x10')]);}})[_0x516b('0x11')](function(_0x2d8d5b){logger[_0x516b('0xd')](_0x516b('0xf'),_0x48ccc5,_0x2d8d5b);_0x42e392(_0x2d8d5b);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d523937..8e31802 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d02=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x416ede,_0x72dc35){var _0x286a2c=function(_0x4d4615){while(--_0x4d4615){_0x416ede['push'](_0x416ede['shift']());}};_0x286a2c(++_0x72dc35);}(_0x4d02,0x10c));var _0x24d0=function(_0x48e4d7,_0x3a32ac){_0x48e4d7=_0x48e4d7-0x0;var _0x4e6d3e=_0x4d02[_0x48e4d7];return _0x4e6d3e;};'use strict';var multer=require(_0x24d0('0x0'));var util=require(_0x24d0('0x1'));var path=require(_0x24d0('0x2'));var timeout=require(_0x24d0('0x3'));var express=require(_0x24d0('0x4'));var router=express[_0x24d0('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x24d0('0x6'));var config=require(_0x24d0('0x7'));var controller=require(_0x24d0('0x8'));router[_0x24d0('0x9')]('/',auth[_0x24d0('0xa')](),controller[_0x24d0('0xb')]);router['get'](_0x24d0('0xc'),auth[_0x24d0('0xa')](),controller[_0x24d0('0xd')]);router[_0x24d0('0xe')]('/',auth[_0x24d0('0xa')](),controller[_0x24d0('0xf')]);router[_0x24d0('0x10')](_0x24d0('0xc'),auth[_0x24d0('0xa')](),controller[_0x24d0('0x11')]);router[_0x24d0('0x12')](_0x24d0('0xc'),auth[_0x24d0('0xa')](),controller['destroy']);module[_0x24d0('0x13')]=router; \ No newline at end of file +var _0x6736=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x6736,0x17d));var _0x6673=function(_0x487e2e,_0x3399d6){_0x487e2e=_0x487e2e-0x0;var _0x41b3e4=_0x6736[_0x487e2e];return _0x41b3e4;};'use strict';var multer=require(_0x6673('0x0'));var util=require(_0x6673('0x1'));var path=require(_0x6673('0x2'));var timeout=require(_0x6673('0x3'));var express=require(_0x6673('0x4'));var router=express[_0x6673('0x5')]();var fs_extra=require(_0x6673('0x6'));var auth=require(_0x6673('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6673('0x8'));var controller=require(_0x6673('0x9'));router[_0x6673('0xa')]('/',auth[_0x6673('0xb')](),controller[_0x6673('0xc')]);router[_0x6673('0xa')](_0x6673('0xd'),auth[_0x6673('0xb')](),controller[_0x6673('0xe')]);router[_0x6673('0xf')]('/',auth[_0x6673('0xb')](),controller[_0x6673('0x10')]);router[_0x6673('0x11')](_0x6673('0xd'),auth[_0x6673('0xb')](),controller[_0x6673('0x12')]);router[_0x6673('0x13')](_0x6673('0xd'),auth[_0x6673('0xb')](),controller[_0x6673('0x14')]);module[_0x6673('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4d7685a..db4b9bf 100644 --- a/server/api/cmCustomField/cmCustomField.attributes.js +++ b/server/api/cmCustomField/cmCustomField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa876=['long','select','parse','values','stringify','BOOLEAN','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name'];(function(_0x4f840d,_0x5d6218){var _0x315f81=function(_0x1a6e6a){while(--_0x1a6e6a){_0x4f840d['push'](_0x4f840d['shift']());}};_0x315f81(++_0x5d6218);}(_0xa876,0x1d8));var _0x6a87=function(_0x891633,_0x50ee6c){_0x891633=_0x891633-0x0;var _0xaaf822=_0xa876[_0x891633];return _0xaaf822;};'use strict';var Sequelize=require('sequelize');var _=require(_0x6a87('0x0'));module[_0x6a87('0x1')]={'name':{'type':Sequelize[_0x6a87('0x2')],'get':function(_0x4f4818){return this['getDataValue'](_0x6a87('0x3'));}},'alias':{'type':Sequelize[_0x6a87('0x4')],'allowNull':![],'set':function(_0x2c24d3){this[_0x6a87('0x5')](_0x6a87('0x3'),_0x2c24d3?_0x2c24d3:this[_0x6a87('0x6')](_0x6a87('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x6a87('0x8')),'get':function(){if(this['getDataValue']('type')===_0x6a87('0x9')){return JSON[_0x6a87('0xa')](this[_0x6a87('0x6')]('values'));}else{return this[_0x6a87('0x6')](_0x6a87('0xb'));}},'set':function(_0x1ad1a6){if(Array['isArray'](_0x1ad1a6)){this[_0x6a87('0x5')](_0x6a87('0xb'),JSON[_0x6a87('0xc')](_0x1ad1a6));}else{this[_0x6a87('0x5')](_0x6a87('0xb'),_0x1ad1a6);}}},'required':{'type':Sequelize[_0x6a87('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x6a87('0xe'))}}; \ No newline at end of file +var _0x8a7a=['lodash','exports','STRING','setDataValue','alias','getDataValue','TEXT','long','type','select','values','isArray','stringify','BOOLEAN','voice'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x8a7a,0x69));var _0xa8a7=function(_0x31b132,_0x2a8364){_0x31b132=_0x31b132-0x0;var _0xd88294=_0x8a7a[_0x31b132];return _0xd88294;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa8a7('0x0'));module[_0xa8a7('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2de45c){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xa8a7('0x2')],'allowNull':![],'set':function(_0x347987){this[_0xa8a7('0x3')](_0xa8a7('0x4'),_0x347987?_0x347987:this[_0xa8a7('0x5')]('name'));}},'type':{'type':Sequelize[_0xa8a7('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0xa8a7('0x6')](_0xa8a7('0x7')),'get':function(){if(this['getDataValue'](_0xa8a7('0x8'))===_0xa8a7('0x9')){return JSON['parse'](this[_0xa8a7('0x5')](_0xa8a7('0xa')));}else{return this[_0xa8a7('0x5')](_0xa8a7('0xa'));}},'set':function(_0xff3883){if(Array[_0xa8a7('0xb')](_0xff3883)){this[_0xa8a7('0x3')](_0xa8a7('0xa'),JSON[_0xa8a7('0xc')](_0xff3883));}else{this[_0xa8a7('0x3')](_0xa8a7('0xa'),_0xff3883);}}},'required':{'type':Sequelize[_0xa8a7('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa8a7('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xa8a7('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 028de01..b47d265 100644 --- a/server/api/cmCustomField/cmCustomField.controller.js +++ b/server/api/cmCustomField/cmCustomField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x312b=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','update','body','create','sequelize','transaction','Sequelize','TEXT','text','type','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','index','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','map','query','keys'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x312b,0xd6));var _0xb312=function(_0x2f52d1,_0x36e3b1){_0x2f52d1=_0x2f52d1-0x0;var _0x3f9871=_0x312b[_0x2f52d1];return _0x3f9871;};'use strict';var emlformat=require(_0xb312('0x0'));var rimraf=require(_0xb312('0x1'));var zipdir=require(_0xb312('0x2'));var jsonpatch=require(_0xb312('0x3'));var rp=require(_0xb312('0x4'));var moment=require(_0xb312('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb312('0x6'));var util=require(_0xb312('0x7'));var path=require(_0xb312('0x8'));var sox=require(_0xb312('0x9'));var csv=require(_0xb312('0xa'));var ejs=require(_0xb312('0xb'));var fs=require('fs');var fs_extra=require(_0xb312('0xc'));var _=require('lodash');var squel=require(_0xb312('0xd'));var crypto=require(_0xb312('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb312('0xf'));var toCsv=require(_0xb312('0xa'));var querystring=require(_0xb312('0x10'));var Papa=require('papaparse');var Redis=require(_0xb312('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb312('0x12'));var as=require(_0xb312('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb312('0x14'))(_0xb312('0x15'));var utils=require(_0xb312('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb312('0x17'));var db=require(_0xb312('0x18'))['db'];function respondWithStatusCode(_0x32efb9,_0x534de1){_0x534de1=_0x534de1||0xcc;return function(_0x57dd8a){if(_0x57dd8a){return _0x32efb9['sendStatus'](_0x534de1);}return _0x32efb9[_0xb312('0x19')](_0x534de1)[_0xb312('0x1a')]();};}function respondWithResult(_0x98d3fa,_0x3b3873){_0x3b3873=_0x3b3873||0xc8;return function(_0x38c8e7){if(_0x38c8e7){return _0x98d3fa[_0xb312('0x19')](_0x3b3873)[_0xb312('0x1b')](_0x38c8e7);}};}function respondWithFilteredResult(_0x9615b5,_0x4d7beb){return function(_0x3084ba){if(_0x3084ba){var _0x59a03c=typeof _0x4d7beb[_0xb312('0x1c')]===_0xb312('0x1d')&&typeof _0x4d7beb[_0xb312('0x1e')]==='undefined';var _0x135554=_0x3084ba[_0xb312('0x1f')];var _0x56f8d5=_0x59a03c?0x0:_0x4d7beb[_0xb312('0x1c')];var _0x33cea7=_0x59a03c?_0x3084ba[_0xb312('0x1f')]:_0x4d7beb[_0xb312('0x1c')]+_0x4d7beb[_0xb312('0x1e')];var _0x5403df;if(_0x33cea7>=_0x135554){_0x33cea7=_0x135554;_0x5403df=0xc8;}else{_0x5403df=0xce;}_0x9615b5[_0xb312('0x19')](_0x5403df);return _0x9615b5[_0xb312('0x20')](_0xb312('0x21'),_0x56f8d5+'-'+_0x33cea7+'/'+_0x135554)['json'](_0x3084ba);}return null;};}function patchUpdates(_0x35011a){return function(_0x144030){try{jsonpatch['apply'](_0x144030,_0x35011a,!![]);}catch(_0x437f5d){return BPromise[_0xb312('0x22')](_0x437f5d);}return _0x144030[_0xb312('0x23')]();};}function saveUpdates(_0x195359,_0xb0af0d){return function(_0x203dae){if(_0x203dae){return _0x203dae['update'](_0x195359)[_0xb312('0x24')](function(_0x1dd20c){return _0x1dd20c;});}return null;};}function removeEntity(_0x3f48be,_0x4fa01f){return function(_0x215f6e){if(_0x215f6e){return _0x215f6e[_0xb312('0x25')]()['then'](function(){_0x3f48be['status'](0xcc)[_0xb312('0x1a')]();});}};}function handleEntityNotFound(_0x4e3ff0,_0x7de5c4){return function(_0xab8ea5){if(!_0xab8ea5){_0x4e3ff0['sendStatus'](0x194);}return _0xab8ea5;};}function handleError(_0x53728c,_0x3315e1){_0x3315e1=_0x3315e1||0x1f4;return function(_0x7aa006){logger[_0xb312('0x26')](_0x7aa006['stack']);if(_0x7aa006[_0xb312('0x27')]){delete _0x7aa006['name'];}_0x53728c['status'](_0x3315e1)['send'](_0x7aa006);};}exports[_0xb312('0x28')]=function(_0x3fdbc0,_0x326730){var _0x39dddf={},_0x589b95={},_0x37979f={'count':0x0,'rows':[]};var _0x3e5bf4=_['map'](db[_0xb312('0x29')][_0xb312('0x2a')],function(_0x377154){return{'name':_0x377154[_0xb312('0x2b')],'type':_0x377154['type'][_0xb312('0x2c')]};});_0x589b95[_0xb312('0x2d')]=_[_0xb312('0x2e')](_[_0xb312('0x2f')](_0x3e5bf4,_0xb312('0x27')),['name']);_0x589b95[_0xb312('0x30')]=_[_0xb312('0x31')](_0x3fdbc0[_0xb312('0x30')]);_0x589b95[_0xb312('0x32')]=_[_0xb312('0x33')](_0x589b95[_0xb312('0x2d')],_0x589b95['query']);_0x39dddf[_0xb312('0x34')]=_[_0xb312('0x33')](_0x589b95[_0xb312('0x2d')],qs['fields'](_0x3fdbc0[_0xb312('0x30')][_0xb312('0x35')]));_0x39dddf[_0xb312('0x34')]=_0x39dddf[_0xb312('0x34')][_0xb312('0x36')]?_0x39dddf['attributes']:_0x589b95[_0xb312('0x2d')];if(!_0x3fdbc0[_0xb312('0x30')][_0xb312('0x37')]('nolimit')){_0x39dddf[_0xb312('0x1e')]=qs[_0xb312('0x1e')](_0x3fdbc0[_0xb312('0x30')]['limit']);_0x39dddf[_0xb312('0x1c')]=qs[_0xb312('0x1c')](_0x3fdbc0[_0xb312('0x30')][_0xb312('0x1c')]);}_0x39dddf[_0xb312('0x38')]=qs['sort'](_0x3fdbc0[_0xb312('0x30')][_0xb312('0x39')]);_0x39dddf[_0xb312('0x3a')]=qs[_0xb312('0x32')](_[_0xb312('0x3b')](_0x3fdbc0[_0xb312('0x30')],_0x589b95[_0xb312('0x32')]),_0x3e5bf4);if(_0x3fdbc0['query'][_0xb312('0x3c')]){_0x39dddf['where']=_[_0xb312('0x3d')](_0x39dddf[_0xb312('0x3a')],{'$or':_[_0xb312('0x2f')](_0x3e5bf4,function(_0x56ac77){if(_0x56ac77['type']!==_0xb312('0x3e')){var _0x1d0cca={};_0x1d0cca[_0x56ac77[_0xb312('0x27')]]={'$like':'%'+_0x3fdbc0[_0xb312('0x30')][_0xb312('0x3c')]+'%'};return _0x1d0cca;}})});}_0x39dddf=_['merge']({},_0x39dddf,_0x3fdbc0['options']);var _0x20a7f0={'where':_0x39dddf['where']};return db[_0xb312('0x29')][_0xb312('0x1f')](_0x20a7f0)[_0xb312('0x24')](function(_0x1e8c85){_0x37979f['count']=_0x1e8c85;if(_0x3fdbc0[_0xb312('0x30')][_0xb312('0x3f')]){_0x39dddf[_0xb312('0x40')]=[{'all':!![]}];}return db['CmCustomField'][_0xb312('0x41')](_0x39dddf);})[_0xb312('0x24')](function(_0x5d729d){_0x37979f[_0xb312('0x42')]=_0x5d729d;return _0x37979f;})[_0xb312('0x24')](respondWithFilteredResult(_0x326730,_0x39dddf))[_0xb312('0x43')](handleError(_0x326730,null));};exports['show']=function(_0x1db65c,_0x4a6535){var _0x5d8528={'raw':!![],'where':{'id':_0x1db65c[_0xb312('0x44')]['id']}},_0x500fec={};_0x500fec[_0xb312('0x2d')]=_[_0xb312('0x31')](db[_0xb312('0x29')][_0xb312('0x2a')]);_0x500fec[_0xb312('0x30')]=_[_0xb312('0x31')](_0x1db65c[_0xb312('0x30')]);_0x500fec[_0xb312('0x32')]=_[_0xb312('0x33')](_0x500fec[_0xb312('0x2d')],_0x500fec[_0xb312('0x30')]);_0x5d8528[_0xb312('0x34')]=_['intersection'](_0x500fec[_0xb312('0x2d')],qs[_0xb312('0x35')](_0x1db65c[_0xb312('0x30')]['fields']));_0x5d8528[_0xb312('0x34')]=_0x5d8528['attributes'][_0xb312('0x36')]?_0x5d8528[_0xb312('0x34')]:_0x500fec[_0xb312('0x2d')];if(_0x1db65c[_0xb312('0x30')]['includeAll']){_0x5d8528['include']=[{'all':!![]}];}_0x5d8528=_[_0xb312('0x3d')]({},_0x5d8528,_0x1db65c[_0xb312('0x45')]);return db[_0xb312('0x29')][_0xb312('0x46')](_0x5d8528)[_0xb312('0x24')](handleEntityNotFound(_0x4a6535,null))[_0xb312('0x24')](respondWithResult(_0x4a6535,null))['catch'](handleError(_0x4a6535,null));};exports[_0xb312('0x47')]=function(_0x1520b1,_0x44529f){if(_0x1520b1[_0xb312('0x48')]['id']){delete _0x1520b1[_0xb312('0x48')]['id'];}return db['CmCustomField'][_0xb312('0x46')]({'where':{'id':_0x1520b1[_0xb312('0x44')]['id']}})['then'](handleEntityNotFound(_0x44529f,null))['then'](saveUpdates(_0x1520b1['body'],null))[_0xb312('0x24')](respondWithResult(_0x44529f,null))[_0xb312('0x43')](handleError(_0x44529f,null));};exports[_0xb312('0x25')]=function(_0x2b73a4,_0x1f7c8e){return db[_0xb312('0x29')][_0xb312('0x46')]({'where':{'id':_0x2b73a4[_0xb312('0x44')]['id']}})[_0xb312('0x24')](handleEntityNotFound(_0x1f7c8e,null))[_0xb312('0x24')](removeEntity(_0x1f7c8e,null))['catch'](handleError(_0x1f7c8e,null));};exports[_0xb312('0x49')]=function(_0x46cd4d,_0x5b5c83){var _0x481d7c;return db[_0xb312('0x4a')][_0xb312('0x4b')](function(_0x274fa8){return db[_0xb312('0x29')]['create'](_0x46cd4d[_0xb312('0x48')],{'transaction':_0x274fa8})[_0xb312('0x24')](function(_0x526e1c){_0x481d7c=_0x526e1c;var _0xa223dc={'type':db[_0xb312('0x4c')][_0xb312('0x4d')],'transaction':_0x274fa8};switch(_0x46cd4d['body']['type']){case _0xb312('0x4e'):_0xa223dc[_0xb312('0x4f')]=db[_0xb312('0x4c')][_0xb312('0x4d')];break;case _0xb312('0x50'):_0xa223dc[_0xb312('0x4f')]=db[_0xb312('0x4c')]['INTEGER'];break;case _0xb312('0x51'):_0xa223dc[_0xb312('0x4f')]=db[_0xb312('0x4c')][_0xb312('0x52')];_0xa223dc[_0xb312('0x53')]=![];break;default:}return db['sequelize'][_0xb312('0x54')][_0xb312('0x55')](_0xb312('0x56'),util['format'](_0xb312('0x57'),_0x481d7c['id']),_0xa223dc);})[_0xb312('0x24')](function(){return _0x481d7c;});})[_0xb312('0x24')](respondWithResult(_0x5b5c83,0xc9))[_0xb312('0x43')](handleError(_0x5b5c83,null));}; \ No newline at end of file +var _0x860d=['destroy','error','stack','name','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x1d38e8,_0x342067){var _0x570342=function(_0x5154f1){while(--_0x5154f1){_0x1d38e8['push'](_0x1d38e8['shift']());}};_0x570342(++_0x342067);}(_0x860d,0x18e));var _0xd860=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0x860d[_0x1a014b];return _0x462258;};'use strict';var emlformat=require(_0xd860('0x0'));var rimraf=require(_0xd860('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd860('0x2'));var rp=require(_0xd860('0x3'));var moment=require(_0xd860('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd860('0x5'));var util=require(_0xd860('0x6'));var path=require(_0xd860('0x7'));var sox=require(_0xd860('0x8'));var csv=require('to-csv');var ejs=require(_0xd860('0x9'));var fs=require('fs');var fs_extra=require(_0xd860('0xa'));var _=require(_0xd860('0xb'));var squel=require(_0xd860('0xc'));var crypto=require('crypto');var jsforce=require(_0xd860('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd860('0xe'));var Papa=require(_0xd860('0xf'));var Redis=require(_0xd860('0x10'));var authService=require(_0xd860('0x11'));var qs=require(_0xd860('0x12'));var as=require(_0xd860('0x13'));var hardwareService=require(_0xd860('0x14'));var logger=require(_0xd860('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd860('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd860('0x17'))['db'];function respondWithStatusCode(_0x594fed,_0x18c405){_0x18c405=_0x18c405||0xcc;return function(_0x1bce33){if(_0x1bce33){return _0x594fed[_0xd860('0x18')](_0x18c405);}return _0x594fed[_0xd860('0x19')](_0x18c405)['end']();};}function respondWithResult(_0x5140fe,_0x1473d6){_0x1473d6=_0x1473d6||0xc8;return function(_0x48baed){if(_0x48baed){return _0x5140fe['status'](_0x1473d6)[_0xd860('0x1a')](_0x48baed);}};}function respondWithFilteredResult(_0x20e8a3,_0x14de70){return function(_0x45aba5){if(_0x45aba5){var _0x3397e2=typeof _0x14de70['offset']==='undefined'&&typeof _0x14de70[_0xd860('0x1b')]===_0xd860('0x1c');var _0xd76099=_0x45aba5[_0xd860('0x1d')];var _0x11b824=_0x3397e2?0x0:_0x14de70[_0xd860('0x1e')];var _0x2c22c0=_0x3397e2?_0x45aba5[_0xd860('0x1d')]:_0x14de70['offset']+_0x14de70[_0xd860('0x1b')];var _0x5cb9b7;if(_0x2c22c0>=_0xd76099){_0x2c22c0=_0xd76099;_0x5cb9b7=0xc8;}else{_0x5cb9b7=0xce;}_0x20e8a3[_0xd860('0x19')](_0x5cb9b7);return _0x20e8a3['set'](_0xd860('0x1f'),_0x11b824+'-'+_0x2c22c0+'/'+_0xd76099)[_0xd860('0x1a')](_0x45aba5);}return null;};}function patchUpdates(_0x21e08c){return function(_0xe32388){try{jsonpatch[_0xd860('0x20')](_0xe32388,_0x21e08c,!![]);}catch(_0x3e2982){return BPromise[_0xd860('0x21')](_0x3e2982);}return _0xe32388[_0xd860('0x22')]();};}function saveUpdates(_0x55c307,_0x2e0c99){return function(_0x486818){if(_0x486818){return _0x486818[_0xd860('0x23')](_0x55c307)[_0xd860('0x24')](function(_0xae78a6){return _0xae78a6;});}return null;};}function removeEntity(_0x16e652,_0x2e220f){return function(_0x4d57dc){if(_0x4d57dc){return _0x4d57dc[_0xd860('0x25')]()[_0xd860('0x24')](function(){_0x16e652['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x504f15,_0x2afbb5){return function(_0x8cf524){if(!_0x8cf524){_0x504f15[_0xd860('0x18')](0x194);}return _0x8cf524;};}function handleError(_0x20263d,_0x30f4ef){_0x30f4ef=_0x30f4ef||0x1f4;return function(_0x578faa){logger[_0xd860('0x26')](_0x578faa[_0xd860('0x27')]);if(_0x578faa[_0xd860('0x28')]){delete _0x578faa[_0xd860('0x28')];}_0x20263d[_0xd860('0x19')](_0x30f4ef)['send'](_0x578faa);};}exports['index']=function(_0x326a13,_0x13331f){var _0x1e6eed={},_0x89b1eb={},_0x2f3fcd={'count':0x0,'rows':[]};var _0x578fb4=_[_0xd860('0x29')](db[_0xd860('0x2a')][_0xd860('0x2b')],function(_0x2c4cd9){return{'name':_0x2c4cd9[_0xd860('0x2c')],'type':_0x2c4cd9[_0xd860('0x2d')][_0xd860('0x2e')]};});_0x89b1eb[_0xd860('0x2f')]=_[_0xd860('0x30')](_[_0xd860('0x29')](_0x578fb4,_0xd860('0x28')),[_0xd860('0x28')]);_0x89b1eb[_0xd860('0x31')]=_['keys'](_0x326a13[_0xd860('0x31')]);_0x89b1eb[_0xd860('0x32')]=_[_0xd860('0x33')](_0x89b1eb[_0xd860('0x2f')],_0x89b1eb[_0xd860('0x31')]);_0x1e6eed[_0xd860('0x34')]=_[_0xd860('0x33')](_0x89b1eb[_0xd860('0x2f')],qs[_0xd860('0x35')](_0x326a13[_0xd860('0x31')][_0xd860('0x35')]));_0x1e6eed[_0xd860('0x34')]=_0x1e6eed[_0xd860('0x34')][_0xd860('0x36')]?_0x1e6eed[_0xd860('0x34')]:_0x89b1eb[_0xd860('0x2f')];if(!_0x326a13['query'][_0xd860('0x37')](_0xd860('0x38'))){_0x1e6eed[_0xd860('0x1b')]=qs[_0xd860('0x1b')](_0x326a13['query'][_0xd860('0x1b')]);_0x1e6eed[_0xd860('0x1e')]=qs[_0xd860('0x1e')](_0x326a13[_0xd860('0x31')][_0xd860('0x1e')]);}_0x1e6eed[_0xd860('0x39')]=qs['sort'](_0x326a13[_0xd860('0x31')][_0xd860('0x3a')]);_0x1e6eed[_0xd860('0x3b')]=qs[_0xd860('0x32')](_[_0xd860('0x3c')](_0x326a13[_0xd860('0x31')],_0x89b1eb[_0xd860('0x32')]),_0x578fb4);if(_0x326a13[_0xd860('0x31')]['filter']){_0x1e6eed[_0xd860('0x3b')]=_[_0xd860('0x3d')](_0x1e6eed[_0xd860('0x3b')],{'$or':_['map'](_0x578fb4,function(_0xa2c9c9){if(_0xa2c9c9[_0xd860('0x2d')]!==_0xd860('0x3e')){var _0x1b7d88={};_0x1b7d88[_0xa2c9c9[_0xd860('0x28')]]={'$like':'%'+_0x326a13[_0xd860('0x31')]['filter']+'%'};return _0x1b7d88;}})});}_0x1e6eed=_['merge']({},_0x1e6eed,_0x326a13[_0xd860('0x3f')]);var _0x5bb054={'where':_0x1e6eed[_0xd860('0x3b')]};return db[_0xd860('0x2a')]['count'](_0x5bb054)[_0xd860('0x24')](function(_0x5a585c){_0x2f3fcd[_0xd860('0x1d')]=_0x5a585c;if(_0x326a13[_0xd860('0x31')]['includeAll']){_0x1e6eed[_0xd860('0x40')]=[{'all':!![]}];}return db[_0xd860('0x2a')][_0xd860('0x41')](_0x1e6eed);})[_0xd860('0x24')](function(_0x3ed756){_0x2f3fcd['rows']=_0x3ed756;return _0x2f3fcd;})[_0xd860('0x24')](respondWithFilteredResult(_0x13331f,_0x1e6eed))[_0xd860('0x42')](handleError(_0x13331f,null));};exports[_0xd860('0x43')]=function(_0x282458,_0x56e3db){var _0x133c24={'raw':!![],'where':{'id':_0x282458[_0xd860('0x44')]['id']}},_0x8d67d6={};_0x8d67d6[_0xd860('0x2f')]=_['keys'](db[_0xd860('0x2a')][_0xd860('0x2b')]);_0x8d67d6[_0xd860('0x31')]=_[_0xd860('0x45')](_0x282458[_0xd860('0x31')]);_0x8d67d6[_0xd860('0x32')]=_[_0xd860('0x33')](_0x8d67d6['model'],_0x8d67d6[_0xd860('0x31')]);_0x133c24[_0xd860('0x34')]=_['intersection'](_0x8d67d6[_0xd860('0x2f')],qs[_0xd860('0x35')](_0x282458[_0xd860('0x31')][_0xd860('0x35')]));_0x133c24['attributes']=_0x133c24[_0xd860('0x34')][_0xd860('0x36')]?_0x133c24[_0xd860('0x34')]:_0x8d67d6[_0xd860('0x2f')];if(_0x282458[_0xd860('0x31')][_0xd860('0x46')]){_0x133c24['include']=[{'all':!![]}];}_0x133c24=_[_0xd860('0x3d')]({},_0x133c24,_0x282458[_0xd860('0x3f')]);return db[_0xd860('0x2a')][_0xd860('0x47')](_0x133c24)[_0xd860('0x24')](handleEntityNotFound(_0x56e3db,null))[_0xd860('0x24')](respondWithResult(_0x56e3db,null))[_0xd860('0x42')](handleError(_0x56e3db,null));};exports['update']=function(_0x4b3196,_0x25e37e){if(_0x4b3196[_0xd860('0x48')]['id']){delete _0x4b3196['body']['id'];}return db['CmCustomField'][_0xd860('0x47')]({'where':{'id':_0x4b3196['params']['id']}})['then'](handleEntityNotFound(_0x25e37e,null))['then'](saveUpdates(_0x4b3196[_0xd860('0x48')],null))['then'](respondWithResult(_0x25e37e,null))[_0xd860('0x42')](handleError(_0x25e37e,null));};exports[_0xd860('0x25')]=function(_0x313097,_0x13c22e){return db[_0xd860('0x2a')][_0xd860('0x47')]({'where':{'id':_0x313097[_0xd860('0x44')]['id']}})[_0xd860('0x24')](handleEntityNotFound(_0x13c22e,null))[_0xd860('0x24')](removeEntity(_0x13c22e,null))[_0xd860('0x42')](handleError(_0x13c22e,null));};exports[_0xd860('0x49')]=function(_0x57b084,_0x230375){var _0x3d0105;return db['sequelize'][_0xd860('0x4a')](function(_0x1dccfa){return db['CmCustomField'][_0xd860('0x49')](_0x57b084[_0xd860('0x48')],{'transaction':_0x1dccfa})[_0xd860('0x24')](function(_0x29ee79){_0x3d0105=_0x29ee79;var _0xe1ec6={'type':db[_0xd860('0x4b')][_0xd860('0x4c')],'transaction':_0x1dccfa};switch(_0x57b084['body'][_0xd860('0x2d')]){case _0xd860('0x4d'):_0xe1ec6['type']=db[_0xd860('0x4b')][_0xd860('0x4c')];break;case _0xd860('0x4e'):_0xe1ec6[_0xd860('0x2d')]=db[_0xd860('0x4b')][_0xd860('0x4f')];break;case'switch':_0xe1ec6[_0xd860('0x2d')]=db[_0xd860('0x4b')]['BOOLEAN'];_0xe1ec6[_0xd860('0x50')]=![];break;default:}return db[_0xd860('0x51')][_0xd860('0x52')][_0xd860('0x53')](_0xd860('0x54'),util[_0xd860('0x55')](_0xd860('0x56'),_0x3d0105['id']),_0xe1ec6);})[_0xd860('0x24')](function(){return _0x3d0105;});})['then'](respondWithResult(_0x230375,0xc9))['catch'](handleError(_0x230375,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 43974d5..73df5ae 100644 --- a/server/api/cmCustomField/cmCustomField.model.js +++ b/server/api/cmCustomField/cmCustomField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf547=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','util','api','moment'];(function(_0x4cc2bb,_0x5739ed){var _0x3ae769=function(_0x5cbeb9){while(--_0x5cbeb9){_0x4cc2bb['push'](_0x4cc2bb['shift']());}};_0x3ae769(++_0x5739ed);}(_0xf547,0x197));var _0x7f54=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xf547[_0x25bea7];return _0x175952;};'use strict';var _=require('lodash');var util=require(_0x7f54('0x0'));var logger=require('../../config/logger')(_0x7f54('0x1'));var moment=require(_0x7f54('0x2'));var BPromise=require(_0x7f54('0x3'));var rp=require(_0x7f54('0x4'));var fs=require('fs');var path=require(_0x7f54('0x5'));var rimraf=require(_0x7f54('0x6'));var config=require(_0x7f54('0x7'));var attributes=require(_0x7f54('0x8'));module['exports']=function(_0x39339f,_0x5b84c4){return _0x39339f[_0x7f54('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeebd=['bluebird','request-promise','path','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment'];(function(_0x423572,_0x405d36){var _0x2f8495=function(_0xec0d1f){while(--_0xec0d1f){_0x423572['push'](_0x423572['shift']());}};_0x2f8495(++_0x405d36);}(_0xeebd,0x130));var _0xdeeb=function(_0x5639fc,_0x16453c){_0x5639fc=_0x5639fc-0x0;var _0x5dea99=_0xeebd[_0x5639fc];return _0x5dea99;};'use strict';var _=require(_0xdeeb('0x0'));var util=require('util');var logger=require(_0xdeeb('0x1'))(_0xdeeb('0x2'));var moment=require(_0xdeeb('0x3'));var BPromise=require(_0xdeeb('0x4'));var rp=require(_0xdeeb('0x5'));var fs=require('fs');var path=require(_0xdeeb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdeeb('0x7'));module[_0xdeeb('0x8')]=function(_0x305a15,_0x80545e){return _0x305a15['define'](_0xdeeb('0x9'),attributes,{'tableName':_0xdeeb('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index db7fb09..35a2ec1 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x498b=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x498b,0xe6));var _0xb498=function(_0x26d667,_0x18234c){_0x26d667=_0x26d667-0x0;var _0x260928=_0x498b[_0x26d667];return _0x260928;};'use strict';var _=require(_0xb498('0x0'));var util=require(_0xb498('0x1'));var moment=require(_0xb498('0x2'));var BPromise=require(_0xb498('0x3'));var rs=require(_0xb498('0x4'));var fs=require('fs');var Redis=require(_0xb498('0x5'));var db=require(_0xb498('0x6'))['db'];var utils=require(_0xb498('0x7'));var logger=require(_0xb498('0x8'))(_0xb498('0x9'));var config=require(_0xb498('0xa'));var jayson=require(_0xb498('0xb'));var client=jayson[_0xb498('0xc')][_0xb498('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4bc420,_0x4b3f7e,_0x73f88c){return new BPromise(function(_0x367825,_0x46997e){return client['request'](_0x4bc420,_0x73f88c)[_0xb498('0xe')](function(_0x36ba2b){logger[_0xb498('0xf')](_0xb498('0x10'),_0x4b3f7e,_0xb498('0x11'));logger[_0xb498('0x12')](_0xb498('0x13'),_0x4b3f7e,_0xb498('0x11'),JSON[_0xb498('0x14')](_0x36ba2b));if(_0x36ba2b[_0xb498('0x15')]){if(_0x36ba2b['error'][_0xb498('0x16')]===0x1f4){logger[_0xb498('0x15')](_0xb498('0x10'),_0x4b3f7e,_0x36ba2b[_0xb498('0x15')][_0xb498('0x17')]);return _0x46997e(_0x36ba2b['error']['message']);}logger[_0xb498('0x15')](_0xb498('0x10'),_0x4b3f7e,_0x36ba2b[_0xb498('0x15')][_0xb498('0x17')]);return _0x367825(_0x36ba2b[_0xb498('0x15')]['message']);}else{logger[_0xb498('0xf')](_0xb498('0x10'),_0x4b3f7e,_0xb498('0x11'));_0x367825(_0x36ba2b['result']['message']);}})[_0xb498('0x18')](function(_0x4a2656){logger[_0xb498('0x15')]('CmCustomField,\x20%s,\x20%s',_0x4b3f7e,_0x4a2656);_0x46997e(_0x4a2656);});});} \ No newline at end of file +var _0xcf23=['../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','message','result','catch','CmCustomField,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x577388,_0xa61b9f){var _0x3869e0=function(_0x53a6e8){while(--_0x53a6e8){_0x577388['push'](_0x577388['shift']());}};_0x3869e0(++_0xa61b9f);}(_0xcf23,0x1c8));var _0x3cf2=function(_0x52e567,_0x1482bc){_0x52e567=_0x52e567-0x0;var _0x5feedd=_0xcf23[_0x52e567];return _0x5feedd;};'use strict';var _=require(_0x3cf2('0x0'));var util=require(_0x3cf2('0x1'));var moment=require(_0x3cf2('0x2'));var BPromise=require(_0x3cf2('0x3'));var rs=require(_0x3cf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cf2('0x5'))['db'];var utils=require(_0x3cf2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3cf2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3cf2('0x8')][_0x3cf2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50c76f,_0x4d49a1,_0xf27455){return new BPromise(function(_0x32ae23,_0x3f5afa){return client[_0x3cf2('0xa')](_0x50c76f,_0xf27455)[_0x3cf2('0xb')](function(_0xb086c7){logger[_0x3cf2('0xc')]('CmCustomField,\x20%s,\x20%s',_0x4d49a1,_0x3cf2('0xd'));logger[_0x3cf2('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4d49a1,_0x3cf2('0xd'),JSON['stringify'](_0xb086c7));if(_0xb086c7[_0x3cf2('0xf')]){if(_0xb086c7[_0x3cf2('0xf')][_0x3cf2('0x10')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4d49a1,_0xb086c7[_0x3cf2('0xf')]['message']);return _0x3f5afa(_0xb086c7[_0x3cf2('0xf')]['message']);}logger[_0x3cf2('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4d49a1,_0xb086c7['error'][_0x3cf2('0x11')]);return _0x32ae23(_0xb086c7[_0x3cf2('0xf')][_0x3cf2('0x11')]);}else{logger[_0x3cf2('0xc')]('CmCustomField,\x20%s,\x20%s',_0x4d49a1,_0x3cf2('0xd'));_0x32ae23(_0xb086c7[_0x3cf2('0x12')][_0x3cf2('0x11')]);}})[_0x3cf2('0x13')](function(_0x32f069){logger['error'](_0x3cf2('0x14'),_0x4d49a1,_0x32f069);_0x3f5afa(_0x32f069);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 121188b..2f12328 100644 --- a/server/api/cmCustomField/index.js +++ b/server/api/cmCustomField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e8a=['update','delete','/:id','exports','util','path','express','Router','../../components/auth/service','isAuthenticated','index','get','show','post','put'];(function(_0x151720,_0x358424){var _0x34ff90=function(_0x1ab386){while(--_0x1ab386){_0x151720['push'](_0x151720['shift']());}};_0x34ff90(++_0x358424);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x4e37bc,_0x8174e7){_0x4e37bc=_0x4e37bc-0x0;var _0x48a8b7=_0x2e8a[_0x4e37bc];return _0x48a8b7;};'use strict';var multer=require('multer');var util=require(_0xa2e8('0x0'));var path=require(_0xa2e8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2e8('0x2'));var router=express[_0xa2e8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa2e8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x6')]);router[_0xa2e8('0x7')]('/:id',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0x8')]);router[_0xa2e8('0x9')]('/',auth[_0xa2e8('0x5')](),controller['create']);router[_0xa2e8('0xa')]('/:id',auth[_0xa2e8('0x5')](),controller[_0xa2e8('0xb')]);router[_0xa2e8('0xc')](_0xa2e8('0xd'),auth[_0xa2e8('0x5')](),controller['destroy']);module[_0xa2e8('0xe')]=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x8ef6,0xf2));var _0x68ef=function(_0x30a48a,_0x90d83e){_0x30a48a=_0x30a48a-0x0;var _0x55ee16=_0x8ef6[_0x30a48a];return _0x55ee16;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['show']);router[_0x68ef('0xd')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);module[_0x68ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5f43152..392e2ef 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d5e=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','moment','sequelize','BOOLEAN'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0x0d5e,0x65));var _0xe0d5=function(_0x31cc16,_0xb353f0){_0x31cc16=_0x31cc16-0x0;var _0x5cd851=_0x0d5e[_0x31cc16];return _0x5cd851;};'use strict';var moment=require(_0xe0d5('0x0'));var Sequelize=require(_0xe0d5('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xe0d5('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe0d5('0x3')],'defaultValue':moment()['format'](_0xe0d5('0x4'))},'countbusyretry':{'type':Sequelize[_0xe0d5('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe0d5('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe0d5('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe0d5('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xe0d5('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe0d5('0x5')],'unique':_0xe0d5('0x7')},'ListId':{'type':Sequelize[_0xe0d5('0x5')],'unique':_0xe0d5('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xe0d5('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe0d5('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe0d5('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe0d5('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe0d5('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe0d5('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xe0d5('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xe0d5('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x702e=['DATE','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','moment','sequelize','exports','STRING'];(function(_0xf57a8b,_0x368db7){var _0x5bb407=function(_0x1e53de){while(--_0x1e53de){_0xf57a8b['push'](_0xf57a8b['shift']());}};_0x5bb407(++_0x368db7);}(_0x702e,0x10a));var _0xe702=function(_0xfbfe73,_0x279341){_0xfbfe73=_0xfbfe73-0x0;var _0x2277d3=_0x702e[_0xfbfe73];return _0x2277d3;};'use strict';var moment=require(_0xe702('0x0'));var Sequelize=require(_0xe702('0x1'));module[_0xe702('0x2')]={'phone':{'type':Sequelize[_0xe702('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe702('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe702('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xe702('0x5')](0x2)[_0xe702('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe702('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xe702('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xe702('0x5')],'unique':_0xe702('0x8')},'CampaignId':{'type':Sequelize[_0xe702('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe702('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xe702('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe702('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 5ae4d03..1633637 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c7=['$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','catch','show','params','options','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','omit','dataValues','state','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','transaction','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','findOne','recallme','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3a871f,_0x360ca3){_0x3a871f=_0x3a871f-0x0;var _0x20a0b9=_0xb4c7[_0x3a871f];return _0x20a0b9;};'use strict';var moment=require(_0x7b4c('0x0'));var _=require(_0x7b4c('0x1'));var qs=require(_0x7b4c('0x2'));var logger=require(_0x7b4c('0x3'))(_0x7b4c('0x4'));var shared=require('../../config/environment');var db=require(_0x7b4c('0x5'))['db'];function respondWithResult(_0x149d55,_0x3ebc75){_0x3ebc75=_0x3ebc75||0xc8;return function(_0x17cea2){if(_0x17cea2){return _0x149d55[_0x7b4c('0x6')](_0x3ebc75)['json'](_0x17cea2);}};}function respondWithFilteredResult(_0x1b0f57,_0x10e197){return function(_0x2dd5c7){if(_0x2dd5c7){var _0x4bf85d=typeof _0x10e197[_0x7b4c('0x7')]===_0x7b4c('0x8')&&typeof _0x10e197['limit']===_0x7b4c('0x8');var _0x179b2d=_0x2dd5c7[_0x7b4c('0x9')];var _0x237e28=_0x4bf85d?0x0:_0x10e197[_0x7b4c('0x7')];var _0x93d013=_0x4bf85d?_0x2dd5c7[_0x7b4c('0x9')]:_0x10e197[_0x7b4c('0x7')]+_0x10e197[_0x7b4c('0xa')];var _0x2adb51;if(_0x93d013>=_0x179b2d){_0x93d013=_0x179b2d;_0x2adb51=0xc8;}else{_0x2adb51=0xce;}_0x1b0f57['status'](_0x2adb51);return _0x1b0f57['set'](_0x7b4c('0xb'),_0x237e28+'-'+_0x93d013+'/'+_0x179b2d)[_0x7b4c('0xc')](_0x2dd5c7);}return null;};}function saveUpdates(_0x38656b,_0x1722ad){return function(_0x3e1558){if(_0x3e1558){return _0x3e1558[_0x7b4c('0xd')](_0x38656b)[_0x7b4c('0xe')](function(_0x40c830){return _0x40c830;});}return null;};}function handleEntityNotFound(_0x25b90b,_0x387488){return function(_0x593a19){if(!_0x593a19){_0x25b90b[_0x7b4c('0xf')](0x194);}return _0x593a19;};}function handleError(_0x3d8362,_0xdc71cd){_0xdc71cd=_0xdc71cd||0x1f4;return function(_0x2a0e2f){logger[_0x7b4c('0x10')](_0x2a0e2f[_0x7b4c('0x11')]);if(_0x2a0e2f[_0x7b4c('0x12')]){delete _0x2a0e2f[_0x7b4c('0x12')];}_0x3d8362['status'](_0xdc71cd)[_0x7b4c('0x13')](_0x2a0e2f);};}exports[_0x7b4c('0x14')]=function(_0x15a5a9,_0x36c02a){var _0x59ae96={},_0x3ce10c={},_0x3d314d={'count':0x0,'rows':[]};var _0x32110e=_[_0x7b4c('0x15')](db[_0x7b4c('0x16')][_0x7b4c('0x17')],function(_0x237110){return{'name':_0x237110[_0x7b4c('0x18')],'type':_0x237110[_0x7b4c('0x19')]['key']};});_0x3ce10c[_0x7b4c('0x1a')]=_[_0x7b4c('0x15')](_0x32110e,_0x7b4c('0x12'));_0x3ce10c[_0x7b4c('0x1b')]=_[_0x7b4c('0x1c')](_0x15a5a9[_0x7b4c('0x1b')]);_0x3ce10c[_0x7b4c('0x1d')]=_[_0x7b4c('0x1e')](_0x3ce10c[_0x7b4c('0x1a')],_0x3ce10c[_0x7b4c('0x1b')]);_0x3ce10c['filters']=_[_0x7b4c('0x1f')](_0x3ce10c[_0x7b4c('0x1d')],[_0x7b4c('0x20'),_0x7b4c('0x21'),_0x7b4c('0x22'),_0x7b4c('0x23'),_0x7b4c('0x24'),_0x7b4c('0x25'),_0x7b4c('0x26'),_0x7b4c('0x27'),_0x7b4c('0x28'),_0x7b4c('0x29'),_0x7b4c('0x2a'),'$in',_0x7b4c('0x2b'),_0x7b4c('0x2c'),_0x7b4c('0x2d'),_0x7b4c('0x2e'),_0x7b4c('0x2f'),_0x7b4c('0x2c'),_0x7b4c('0x30'),_0x7b4c('0x31'),_0x7b4c('0x32'),_0x7b4c('0x33')]);_0x59ae96[_0x7b4c('0x34')]=_[_0x7b4c('0x1e')](_0x3ce10c[_0x7b4c('0x1a')],qs[_0x7b4c('0x35')](_0x15a5a9[_0x7b4c('0x1b')][_0x7b4c('0x35')]));_0x59ae96[_0x7b4c('0x34')]=_0x59ae96[_0x7b4c('0x34')][_0x7b4c('0x36')]?_0x59ae96['attributes']:_0x3ce10c['model'];if(!_0x15a5a9['query'][_0x7b4c('0x37')](_0x7b4c('0x38'))){_0x59ae96[_0x7b4c('0xa')]=qs[_0x7b4c('0xa')](_0x15a5a9['query'][_0x7b4c('0xa')]);_0x59ae96[_0x7b4c('0x7')]=qs['offset'](_0x15a5a9[_0x7b4c('0x1b')]['offset']);}_0x59ae96[_0x7b4c('0x39')]=qs[_0x7b4c('0x3a')](_0x15a5a9[_0x7b4c('0x1b')]['sort']);_0x59ae96[_0x7b4c('0x3b')]=qs[_0x7b4c('0x1d')](_['pick'](_0x15a5a9[_0x7b4c('0x1b')],_0x3ce10c[_0x7b4c('0x1d')]),_0x32110e);if(_0x15a5a9[_0x7b4c('0x1b')][_0x7b4c('0x3c')]){_0x59ae96['where']=_['merge'](_0x59ae96[_0x7b4c('0x3b')],{'$or':_[_0x7b4c('0x15')](_0x32110e,function(_0x4dda8b){if(_0x4dda8b[_0x7b4c('0x19')]!=='VIRTUAL'){var _0x543309={};_0x543309[_0x4dda8b[_0x7b4c('0x12')]]={'$like':'%'+_0x15a5a9[_0x7b4c('0x1b')][_0x7b4c('0x3c')]+'%'};return _0x543309;}})});}_0x59ae96=_[_0x7b4c('0x3d')]({},_0x59ae96,_0x15a5a9['options']);var _0x81ddf4={'where':_0x59ae96[_0x7b4c('0x3b')]};return db[_0x7b4c('0x16')][_0x7b4c('0x9')](_0x81ddf4)[_0x7b4c('0xe')](function(_0xddd16){_0x3d314d[_0x7b4c('0x9')]=_0xddd16;if(_0x15a5a9['query']['includeAll']){_0x59ae96[_0x7b4c('0x3e')]=[{'all':!![]}];}return db[_0x7b4c('0x16')][_0x7b4c('0x3f')](_0x59ae96);})[_0x7b4c('0xe')](function(_0xb8486d){_0x3d314d['rows']=_0xb8486d;return _0x3d314d;})[_0x7b4c('0xe')](respondWithFilteredResult(_0x36c02a,_0x59ae96))[_0x7b4c('0x40')](handleError(_0x36c02a,null));};exports[_0x7b4c('0x41')]=function(_0x26346a,_0x22f71b){var _0x25659d={'raw':!![],'where':{'id':_0x26346a[_0x7b4c('0x42')]['id']}},_0x41d399={};_0x41d399[_0x7b4c('0x1a')]=_['keys'](db[_0x7b4c('0x16')]['rawAttributes']);_0x41d399[_0x7b4c('0x1b')]=_['keys'](_0x26346a[_0x7b4c('0x1b')]);_0x41d399[_0x7b4c('0x1d')]=_['intersection'](_0x41d399['model'],_0x41d399[_0x7b4c('0x1b')]);_0x25659d[_0x7b4c('0x34')]=_[_0x7b4c('0x1e')](_0x41d399[_0x7b4c('0x1a')],qs['fields'](_0x26346a[_0x7b4c('0x1b')][_0x7b4c('0x35')]));_0x25659d[_0x7b4c('0x34')]=_0x25659d['attributes'][_0x7b4c('0x36')]?_0x25659d['attributes']:_0x41d399['model'];if(_0x26346a[_0x7b4c('0x1b')]['includeAll']){_0x25659d[_0x7b4c('0x3e')]=[{'all':!![]}];}_0x25659d=_[_0x7b4c('0x3d')]({},_0x25659d,_0x26346a[_0x7b4c('0x43')]);return db[_0x7b4c('0x16')][_0x7b4c('0x44')](_0x25659d)[_0x7b4c('0xe')](handleEntityNotFound(_0x22f71b,null))[_0x7b4c('0xe')](respondWithResult(_0x22f71b,null))[_0x7b4c('0x40')](handleError(_0x22f71b,null));};exports[_0x7b4c('0x45')]=function(_0x4c9fe3,_0x279b71){return db['CmHopper']['create'](_0x4c9fe3[_0x7b4c('0x46')],{})[_0x7b4c('0xe')](respondWithResult(_0x279b71,0xc9))['catch'](handleError(_0x279b71,null));};exports['update']=function(_0x255cca,_0x2ce694){if(_0x255cca[_0x7b4c('0x46')]['id']){delete _0x255cca[_0x7b4c('0x46')]['id'];}return db[_0x7b4c('0x16')][_0x7b4c('0x44')]({'where':{'id':_0x255cca[_0x7b4c('0x42')]['id']}})[_0x7b4c('0xe')](handleEntityNotFound(_0x2ce694,null))['then'](saveUpdates(_0x255cca[_0x7b4c('0x46')],null))[_0x7b4c('0xe')](respondWithResult(_0x2ce694,null))[_0x7b4c('0x40')](handleError(_0x2ce694,null));};exports[_0x7b4c('0x47')]=function(_0xc76435,_0x379f15){return db[_0x7b4c('0x16')][_0x7b4c('0x47')]()[_0x7b4c('0xe')](respondWithResult(_0x379f15,null))['catch'](handleError(_0x379f15,null));};exports['destroy']=function(_0x1884a4,_0x3f6aaa){var _0x97eadf;var _0x5d4192=_0x1884a4[_0x7b4c('0x42')]['id'];return db[_0x7b4c('0x16')]['find']({'where':{'id':_0x1884a4[_0x7b4c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f6aaa,null))[_0x7b4c('0xe')](function(_0x528472){if(_0x528472){return _0x528472[_0x7b4c('0x48')]()['then'](function(_0x15d7f1){return _0x15d7f1;});}})[_0x7b4c('0xe')](function(_0x51f9a8){_0x97eadf=_0x51f9a8;if(_0x51f9a8){if(_0x51f9a8['VoiceQueueId']||_0x51f9a8[_0x7b4c('0x49')]){return db[_0x51f9a8[_0x7b4c('0x4a')]?_0x7b4c('0x4b'):'Campaign']['find']({'where':{'id':_0x51f9a8[_0x7b4c('0x4a')]?_0x51f9a8[_0x7b4c('0x4a')]:_0x51f9a8['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x7b4c('0xe')](function(_0x2a1442){var _0x166fd1={};if(_0x2a1442){_['merge'](_0x166fd1,_[_0x7b4c('0x4c')](_0x97eadf[_0x7b4c('0x4d')],['createdAt','updatedAt','id']));_0x166fd1[_0x7b4c('0x4e')]=0x15;_0x166fd1['statedesc']='deleted';_0x166fd1[_0x7b4c('0x4f')]=_0x2a1442['name'];_0x166fd1['membername']=_0x1884a4[_0x7b4c('0x50')][_0x7b4c('0x12')];_0x166fd1[_0x7b4c('0x51')]=_0x1884a4[_0x7b4c('0x50')]['id'];_0x166fd1['deleted']=!![];_0x166fd1['deletedat']=moment()[_0x7b4c('0x52')](_0x7b4c('0x53'));_0x166fd1[_0x7b4c('0x54')]=_0x97eadf['phone'];_0x166fd1[_0x7b4c('0x55')]=_0x97eadf[_0x7b4c('0x4a')]?_0x7b4c('0x56'):'ivr';return db[_0x7b4c('0x57')][_0x7b4c('0x44')]({'where':{'id':_0x166fd1['ContactId']},'attributes':[_0x7b4c('0x58'),_0x7b4c('0x59')]})[_0x7b4c('0xe')](function(_0x1df67d){if(!_[_0x7b4c('0x5a')](_0x3f6aaa)&&!_[_0x7b4c('0x5a')](_0x1df67d[_0x7b4c('0x58')])){_0x166fd1['calleridname']=_0x1df67d[_0x7b4c('0x58')];if(!_[_0x7b4c('0x5a')](_0x1df67d['lastName'])){_0x166fd1[_0x7b4c('0x5b')]+='\x20'+_0x1df67d[_0x7b4c('0x59')];}}})[_0x7b4c('0x5c')](function(){return db[_0x7b4c('0x5d')]['create'](_0x166fd1);});}})[_0x7b4c('0xe')](function(_0x4e84a3){return db['CmHopperAdditionalPhone'][_0x7b4c('0x48')]({'where':{'CmHopperId':_0x5d4192}});})[_0x7b4c('0xe')](function(){return _0x3f6aaa[_0x7b4c('0x6')](0xcc)[_0x7b4c('0x5e')]();})[_0x7b4c('0x40')](handleError(_0x3f6aaa,null));};exports['getPreview']=function(_0x4fcc9d,_0x17de98){var _0x3c84af=[];return db[_0x7b4c('0x57')]['describe']()[_0x7b4c('0xe')](function(_0xc4dae0){_0x3c84af=_[_0x7b4c('0x1c')](_0xc4dae0);return _0x4fcc9d['user'][_0x7b4c('0x5f')]({'where':{'type':_0x7b4c('0x60'),'dialActive':!![],'dialMethod':_0x7b4c('0x61')},'attributes':['id','dialOrderByScheduledAt',_0x7b4c('0x62')],'raw':!![]});})[_0x7b4c('0xe')](function(_0x4ac03e){if(_0x4ac03e&&_0x4ac03e[_0x7b4c('0x36')]){return db['sequelize'][_0x7b4c('0x63')](function(_0x11ae6e){var _0x3a3713={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7b4c('0x15')](_0x4ac03e,'id')},'$or':[{'UserId':null},{'UserId':_0x4fcc9d[_0x7b4c('0x50')]['id']}]};var _0x1ea5a3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4ac03e)['filter']([_0x7b4c('0x62'),0x0])['map']('id')[_0x7b4c('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x4fcc9d[_0x7b4c('0x50')]['id']}]};var _0x1315bd={'$or':[_0x3a3713,_0x1ea5a3]};var _0x5f3ed5=[];if(_0x4fcc9d[_0x7b4c('0x46')]['direction']&&_0x4fcc9d[_0x7b4c('0x46')][_0x7b4c('0x65')]==='prev'){if(!_[_0x7b4c('0x66')](_0x4fcc9d[_0x7b4c('0x46')][_0x7b4c('0x67')])){_0x1315bd['id']={'$in':_0x4fcc9d[_0x7b4c('0x46')][_0x7b4c('0x67')]};}_0x5f3ed5=[[_0x7b4c('0x68'),_0x7b4c('0x69')],[_0x7b4c('0x6a'),_0x4ac03e[0x0]['dialOrderByScheduledAt']===_0x7b4c('0x69')?_0x7b4c('0x6b'):_0x7b4c('0x69')],db[_0x7b4c('0x6c')][_0x7b4c('0x6d')](_0x7b4c('0x6e')),['id',_0x7b4c('0x6b')]];}else{if(!_[_0x7b4c('0x66')](_0x4fcc9d[_0x7b4c('0x46')][_0x7b4c('0x67')])){_0x1315bd['id']={'$notIn':_0x4fcc9d[_0x7b4c('0x46')][_0x7b4c('0x67')]};}_0x5f3ed5=[[_0x7b4c('0x68'),_0x7b4c('0x6b')],[_0x7b4c('0x6a'),_0x4ac03e[0x0][_0x7b4c('0x6f')]],db[_0x7b4c('0x6c')][_0x7b4c('0x6d')](_0x7b4c('0x70')),['id',_0x7b4c('0x69')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x7b4c('0x71'),_0x7b4c('0x72'),'recallme'],'where':_0x1315bd,'order':_0x5f3ed5,'transaction':_0x11ae6e,'lock':_0x11ae6e[_0x7b4c('0x73')][_0x7b4c('0x74')],'include':[{'model':db[_0x7b4c('0x57')],'as':_0x7b4c('0x75'),'attributes':_0x3c84af,'include':[{'model':db[_0x7b4c('0x76')],'as':_0x7b4c('0x77'),'attributes':['id',_0x7b4c('0x12')]}]},{'model':db[_0x7b4c('0x78')],'as':_0x7b4c('0x79'),'attributes':['id','name']},{'model':db[_0x7b4c('0x4b')],'as':'Queue','attributes':['id',_0x7b4c('0x12'),'dialActive']}]})['then'](function(_0x3515d1){if(_0x3515d1){return _0x3515d1['update']({'UserId':_0x4fcc9d['user']['id']},{'transaction':_0x11ae6e});}});});}})[_0x7b4c('0xe')](handleEntityNotFound(_0x17de98,null))[_0x7b4c('0xe')](respondWithResult(_0x17de98,null))[_0x7b4c('0x40')](handleError(_0x17de98,null));};exports['getPreviewRecall']=function(_0x46fe2e,_0xf636b6,_0x10e789){var _0x29987e=[];var _0x1b4883=_0x46fe2e[_0x7b4c('0x42')]['id'];var _0x2f58bf=_0x46fe2e[_0x7b4c('0x50')]['id'];return db[_0x7b4c('0x57')][_0x7b4c('0x47')]()[_0x7b4c('0xe')](function(_0x45319d){_0x29987e=_[_0x7b4c('0x1c')](_0x45319d);return db[_0x7b4c('0x6c')]['transaction'](function(_0x1df6f1){const _0x2732a2={'id':_0x1b4883};return db[_0x7b4c('0x16')][_0x7b4c('0x7a')]({'attributes':['id','scheduledat',_0x7b4c('0x7b')],'where':_0x2732a2,'transaction':_0x1df6f1,'lock':_0x1df6f1[_0x7b4c('0x73')][_0x7b4c('0x74')],'include':[{'model':db[_0x7b4c('0x57')],'as':_0x7b4c('0x75'),'attributes':_0x29987e,'include':[{'model':db[_0x7b4c('0x76')],'as':_0x7b4c('0x77'),'attributes':['id','name']}]},{'model':db[_0x7b4c('0x78')],'as':_0x7b4c('0x79'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x7b4c('0x12'),_0x7b4c('0x7c')]}]})[_0x7b4c('0xe')](function(_0x19804d){if(_0x19804d){return _0x19804d[_0x7b4c('0xd')]({'UserId':_0x2f58bf},{'transaction':_0x1df6f1});}});});})[_0x7b4c('0xe')](handleEntityNotFound(_0xf636b6,null))[_0x7b4c('0xe')](respondWithResult(_0xf636b6,null))[_0x7b4c('0x40')](handleError(_0xf636b6,null));};exports[_0x7b4c('0x7d')]=function(_0x2bc889,_0x83e8bb){return _0x2bc889[_0x7b4c('0x50')][_0x7b4c('0x5f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7b4c('0x61')},'attributes':['id'],'raw':!![]})[_0x7b4c('0xe')](function(_0x2afaa0){if(_0x2afaa0&&_0x2afaa0['length']){return db[_0x7b4c('0x16')][_0x7b4c('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7b4c('0x52')](_0x7b4c('0x53'))},'VoiceQueueId':{'$in':_[_0x7b4c('0x15')](_0x2afaa0,'id')},'$or':[{'UserId':null},{'UserId':_0x2bc889['user']['id']}]}});}return 0x0;})[_0x7b4c('0xe')](function(_0x1cd19e){if(!_[_0x7b4c('0x5a')](_0x1cd19e)&&_[_0x7b4c('0x7e')](_0x1cd19e)){return _0x83e8bb['status'](0xc8)[_0x7b4c('0xc')]({'contacts':_0x1cd19e});}else{logger[_0x7b4c('0x10')](_0x7b4c('0x7f'),'getOpenContacts',0x194,_0x7b4c('0x80'));_0x83e8bb[_0x7b4c('0xf')](0x194);}})[_0x7b4c('0x40')](handleError(_0x83e8bb,null));};exports[_0x7b4c('0x81')]=function(_0x4f7770,_0x3d9c3c){var _0x4352d5=shared[_0x7b4c('0x82')];var _0x12c24c=[];_['map'](_0x4352d5,function(_0x288a82){_0x12c24c['push']({'id':_0x288a82[_0x7b4c('0x12')],'name':_0x288a82['name'],'utcOffset':_0x288a82[_0x7b4c('0x83')]});});return _0x3d9c3c[_0x7b4c('0x6')](0xc8)[_0x7b4c('0xc')]({'tz':_0x12c24c});};exports['getTimezone']=function(_0x42346a,_0x5ee499){var _0xb2d616=shared[_0x7b4c('0x82')];var _0x4b083d={};if(!_[_0x7b4c('0x5a')](_0xb2d616[_0x42346a[_0x7b4c('0x46')]['id']]))_0x4b083d=_0xb2d616[_0x42346a[_0x7b4c('0x46')]['id']];return _0x5ee499[_0x7b4c('0x6')](0xc8)['json'](_0x4b083d);}; \ No newline at end of file +var _0xb458=['update','then','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','filters','concat','$and','$or','$lt','$lte','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','statedesc','campaign','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','sequelize','dialPreviewAutoRecallMe','value','direction','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','transaction','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','status','offset','undefined','count','Content-Range','json'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb458,0x103));var _0x8b45=function(_0x336092,_0x22c0e1){_0x336092=_0x336092-0x0;var _0x57c708=_0xb458[_0x336092];return _0x57c708;};'use strict';var moment=require(_0x8b45('0x0'));var _=require(_0x8b45('0x1'));var qs=require(_0x8b45('0x2'));var logger=require('../../config/logger')('api');var shared=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];function respondWithResult(_0x141a44,_0x13a8c6){_0x13a8c6=_0x13a8c6||0xc8;return function(_0x5d51e4){if(_0x5d51e4){return _0x141a44[_0x8b45('0x5')](_0x13a8c6)['json'](_0x5d51e4);}};}function respondWithFilteredResult(_0x5cc2d5,_0xe8d774){return function(_0x12bd05){if(_0x12bd05){var _0x2daa9a=typeof _0xe8d774[_0x8b45('0x6')]===_0x8b45('0x7')&&typeof _0xe8d774['limit']===_0x8b45('0x7');var _0x12bea8=_0x12bd05[_0x8b45('0x8')];var _0x2bc809=_0x2daa9a?0x0:_0xe8d774[_0x8b45('0x6')];var _0x499899=_0x2daa9a?_0x12bd05[_0x8b45('0x8')]:_0xe8d774[_0x8b45('0x6')]+_0xe8d774['limit'];var _0x5316af;if(_0x499899>=_0x12bea8){_0x499899=_0x12bea8;_0x5316af=0xc8;}else{_0x5316af=0xce;}_0x5cc2d5['status'](_0x5316af);return _0x5cc2d5['set'](_0x8b45('0x9'),_0x2bc809+'-'+_0x499899+'/'+_0x12bea8)[_0x8b45('0xa')](_0x12bd05);}return null;};}function saveUpdates(_0x37c220,_0x52c4db){return function(_0x30d38c){if(_0x30d38c){return _0x30d38c[_0x8b45('0xb')](_0x37c220)[_0x8b45('0xc')](function(_0x2e5ec3){return _0x2e5ec3;});}return null;};}function handleEntityNotFound(_0x32babc,_0x2ad2ae){return function(_0x5f0b20){if(!_0x5f0b20){_0x32babc['sendStatus'](0x194);}return _0x5f0b20;};}function handleError(_0x45881c,_0x23f1dd){_0x23f1dd=_0x23f1dd||0x1f4;return function(_0x445170){logger[_0x8b45('0xd')](_0x445170[_0x8b45('0xe')]);if(_0x445170[_0x8b45('0xf')]){delete _0x445170[_0x8b45('0xf')];}_0x45881c[_0x8b45('0x5')](_0x23f1dd)[_0x8b45('0x10')](_0x445170);};}exports[_0x8b45('0x11')]=function(_0x287a3b,_0x21d5b2){var _0x1ed5ca={},_0x43ffb7={},_0x1623d8={'count':0x0,'rows':[]};var _0x31c6b4=_[_0x8b45('0x12')](db[_0x8b45('0x13')]['rawAttributes'],function(_0x25e8a1){return{'name':_0x25e8a1[_0x8b45('0x14')],'type':_0x25e8a1[_0x8b45('0x15')][_0x8b45('0x16')]};});_0x43ffb7[_0x8b45('0x17')]=_[_0x8b45('0x12')](_0x31c6b4,_0x8b45('0xf'));_0x43ffb7[_0x8b45('0x18')]=_['keys'](_0x287a3b['query']);_0x43ffb7[_0x8b45('0x19')]=_['intersection'](_0x43ffb7[_0x8b45('0x17')],_0x43ffb7[_0x8b45('0x18')]);_0x43ffb7[_0x8b45('0x19')]=_[_0x8b45('0x1a')](_0x43ffb7[_0x8b45('0x19')],[_0x8b45('0x1b'),_0x8b45('0x1c'),'$gt','$gte',_0x8b45('0x1d'),_0x8b45('0x1e'),'$ne','$eq',_0x8b45('0x1f'),_0x8b45('0x20'),_0x8b45('0x21'),_0x8b45('0x22'),'$notIn',_0x8b45('0x23'),_0x8b45('0x24'),_0x8b45('0x25'),_0x8b45('0x26'),_0x8b45('0x23'),_0x8b45('0x27'),_0x8b45('0x28'),_0x8b45('0x29'),_0x8b45('0x2a')]);_0x1ed5ca[_0x8b45('0x2b')]=_[_0x8b45('0x2c')](_0x43ffb7[_0x8b45('0x17')],qs[_0x8b45('0x2d')](_0x287a3b['query'][_0x8b45('0x2d')]));_0x1ed5ca[_0x8b45('0x2b')]=_0x1ed5ca[_0x8b45('0x2b')][_0x8b45('0x2e')]?_0x1ed5ca[_0x8b45('0x2b')]:_0x43ffb7[_0x8b45('0x17')];if(!_0x287a3b[_0x8b45('0x18')][_0x8b45('0x2f')]('nolimit')){_0x1ed5ca[_0x8b45('0x30')]=qs[_0x8b45('0x30')](_0x287a3b[_0x8b45('0x18')][_0x8b45('0x30')]);_0x1ed5ca[_0x8b45('0x6')]=qs['offset'](_0x287a3b[_0x8b45('0x18')]['offset']);}_0x1ed5ca['order']=qs[_0x8b45('0x31')](_0x287a3b[_0x8b45('0x18')][_0x8b45('0x31')]);_0x1ed5ca[_0x8b45('0x32')]=qs[_0x8b45('0x19')](_[_0x8b45('0x33')](_0x287a3b['query'],_0x43ffb7[_0x8b45('0x19')]),_0x31c6b4);if(_0x287a3b[_0x8b45('0x18')][_0x8b45('0x34')]){_0x1ed5ca[_0x8b45('0x32')]=_['merge'](_0x1ed5ca[_0x8b45('0x32')],{'$or':_[_0x8b45('0x12')](_0x31c6b4,function(_0x191db0){if(_0x191db0['type']!==_0x8b45('0x35')){var _0x475401={};_0x475401[_0x191db0[_0x8b45('0xf')]]={'$like':'%'+_0x287a3b['query'][_0x8b45('0x34')]+'%'};return _0x475401;}})});}_0x1ed5ca=_[_0x8b45('0x36')]({},_0x1ed5ca,_0x287a3b[_0x8b45('0x37')]);var _0x4016b7={'where':_0x1ed5ca['where']};return db[_0x8b45('0x13')][_0x8b45('0x8')](_0x4016b7)[_0x8b45('0xc')](function(_0x15df7c){_0x1623d8[_0x8b45('0x8')]=_0x15df7c;if(_0x287a3b[_0x8b45('0x18')]['includeAll']){_0x1ed5ca['include']=[{'all':!![]}];}return db[_0x8b45('0x13')][_0x8b45('0x38')](_0x1ed5ca);})[_0x8b45('0xc')](function(_0x12d4b2){_0x1623d8[_0x8b45('0x39')]=_0x12d4b2;return _0x1623d8;})['then'](respondWithFilteredResult(_0x21d5b2,_0x1ed5ca))[_0x8b45('0x3a')](handleError(_0x21d5b2,null));};exports['show']=function(_0x67c59a,_0x17e9a8){var _0x5fae26={'raw':!![],'where':{'id':_0x67c59a[_0x8b45('0x3b')]['id']}},_0x280bb0={};_0x280bb0[_0x8b45('0x17')]=_[_0x8b45('0x3c')](db[_0x8b45('0x13')][_0x8b45('0x3d')]);_0x280bb0[_0x8b45('0x18')]=_[_0x8b45('0x3c')](_0x67c59a['query']);_0x280bb0[_0x8b45('0x19')]=_['intersection'](_0x280bb0[_0x8b45('0x17')],_0x280bb0['query']);_0x5fae26[_0x8b45('0x2b')]=_[_0x8b45('0x2c')](_0x280bb0[_0x8b45('0x17')],qs[_0x8b45('0x2d')](_0x67c59a[_0x8b45('0x18')][_0x8b45('0x2d')]));_0x5fae26['attributes']=_0x5fae26[_0x8b45('0x2b')]['length']?_0x5fae26['attributes']:_0x280bb0[_0x8b45('0x17')];if(_0x67c59a[_0x8b45('0x18')][_0x8b45('0x3e')]){_0x5fae26['include']=[{'all':!![]}];}_0x5fae26=_[_0x8b45('0x36')]({},_0x5fae26,_0x67c59a['options']);return db[_0x8b45('0x13')][_0x8b45('0x3f')](_0x5fae26)[_0x8b45('0xc')](handleEntityNotFound(_0x17e9a8,null))[_0x8b45('0xc')](respondWithResult(_0x17e9a8,null))[_0x8b45('0x3a')](handleError(_0x17e9a8,null));};exports[_0x8b45('0x40')]=function(_0x526c90,_0x3cebd2){return db[_0x8b45('0x13')][_0x8b45('0x40')](_0x526c90[_0x8b45('0x41')],{})[_0x8b45('0xc')](respondWithResult(_0x3cebd2,0xc9))[_0x8b45('0x3a')](handleError(_0x3cebd2,null));};exports[_0x8b45('0xb')]=function(_0x3de3c2,_0x37b94a){if(_0x3de3c2[_0x8b45('0x41')]['id']){delete _0x3de3c2[_0x8b45('0x41')]['id'];}return db[_0x8b45('0x13')][_0x8b45('0x3f')]({'where':{'id':_0x3de3c2[_0x8b45('0x3b')]['id']}})[_0x8b45('0xc')](handleEntityNotFound(_0x37b94a,null))[_0x8b45('0xc')](saveUpdates(_0x3de3c2['body'],null))['then'](respondWithResult(_0x37b94a,null))['catch'](handleError(_0x37b94a,null));};exports[_0x8b45('0x42')]=function(_0x214e28,_0x3a1621){return db[_0x8b45('0x13')][_0x8b45('0x42')]()[_0x8b45('0xc')](respondWithResult(_0x3a1621,null))[_0x8b45('0x3a')](handleError(_0x3a1621,null));};exports[_0x8b45('0x43')]=function(_0x5e2a03,_0x102d01){var _0x5d5be2;var _0x23b5c6=_0x5e2a03[_0x8b45('0x3b')]['id'];return db[_0x8b45('0x13')][_0x8b45('0x3f')]({'where':{'id':_0x5e2a03['params']['id']}})[_0x8b45('0xc')](handleEntityNotFound(_0x102d01,null))[_0x8b45('0xc')](function(_0x5e42e6){if(_0x5e42e6){return _0x5e42e6[_0x8b45('0x43')]()[_0x8b45('0xc')](function(_0x52970c){return _0x52970c;});}})[_0x8b45('0xc')](function(_0x5758c){_0x5d5be2=_0x5758c;if(_0x5758c){if(_0x5758c[_0x8b45('0x44')]||_0x5758c[_0x8b45('0x45')]){return db[_0x5758c[_0x8b45('0x44')]?_0x8b45('0x46'):'Campaign']['find']({'where':{'id':_0x5758c[_0x8b45('0x44')]?_0x5758c[_0x8b45('0x44')]:_0x5758c[_0x8b45('0x45')]},'attributes':['id','name'],'raw':!![]});}}})[_0x8b45('0xc')](function(_0x11d1a5){var _0x20a68b={};if(_0x11d1a5){_[_0x8b45('0x36')](_0x20a68b,_[_0x8b45('0x47')](_0x5d5be2['dataValues'],[_0x8b45('0x48'),_0x8b45('0x49'),'id']));_0x20a68b['state']=0x15;_0x20a68b[_0x8b45('0x4a')]='deleted';_0x20a68b[_0x8b45('0x4b')]=_0x11d1a5[_0x8b45('0xf')];_0x20a68b[_0x8b45('0x4c')]=_0x5e2a03[_0x8b45('0x4d')]['name'];_0x20a68b[_0x8b45('0x4e')]=_0x5e2a03[_0x8b45('0x4d')]['id'];_0x20a68b[_0x8b45('0x4f')]=!![];_0x20a68b[_0x8b45('0x50')]=moment()[_0x8b45('0x51')](_0x8b45('0x52'));_0x20a68b[_0x8b45('0x53')]=_0x5d5be2[_0x8b45('0x54')];_0x20a68b[_0x8b45('0x55')]=_0x5d5be2[_0x8b45('0x44')]?_0x8b45('0x56'):_0x8b45('0x57');return db[_0x8b45('0x58')][_0x8b45('0x3f')]({'where':{'id':_0x20a68b[_0x8b45('0x59')]},'attributes':['firstName',_0x8b45('0x5a')]})[_0x8b45('0xc')](function(_0x15c9ae){if(!_['isNil'](_0x102d01)&&!_[_0x8b45('0x5b')](_0x15c9ae[_0x8b45('0x5c')])){_0x20a68b[_0x8b45('0x5d')]=_0x15c9ae[_0x8b45('0x5c')];if(!_['isNil'](_0x15c9ae[_0x8b45('0x5a')])){_0x20a68b[_0x8b45('0x5d')]+='\x20'+_0x15c9ae[_0x8b45('0x5a')];}}})[_0x8b45('0x5e')](function(){return db['CmHopperFinal'][_0x8b45('0x40')](_0x20a68b);});}})[_0x8b45('0xc')](function(_0x417778){return db[_0x8b45('0x5f')][_0x8b45('0x43')]({'where':{'CmHopperId':_0x23b5c6}});})['then'](function(){return _0x102d01[_0x8b45('0x5')](0xcc)['end']();})[_0x8b45('0x3a')](handleError(_0x102d01,null));};exports[_0x8b45('0x60')]=function(_0x19152b,_0x19c80e){var _0x6a77bd=[];return db[_0x8b45('0x58')]['describe']()['then'](function(_0x5ace1){_0x6a77bd=_[_0x8b45('0x3c')](_0x5ace1);return _0x19152b['user'][_0x8b45('0x61')]({'where':{'type':_0x8b45('0x62'),'dialActive':!![],'dialMethod':_0x8b45('0x63')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8b45('0xc')](function(_0x8e5a41){if(_0x8e5a41&&_0x8e5a41['length']){return db[_0x8b45('0x64')]['transaction'](function(_0xf1ab37){var _0x560c51={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8b45('0x52'))},'VoiceQueueId':{'$in':_[_0x8b45('0x12')](_0x8e5a41,'id')},'$or':[{'UserId':null},{'UserId':_0x19152b['user']['id']}]};var _0x324592={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x8e5a41)[_0x8b45('0x34')]([_0x8b45('0x65'),0x0])[_0x8b45('0x12')]('id')[_0x8b45('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x19152b['user']['id']}]};var _0x37f580={'$or':[_0x560c51,_0x324592]};var _0x3b3d21=[];if(_0x19152b[_0x8b45('0x41')]['direction']&&_0x19152b['body'][_0x8b45('0x67')]==='prev'){if(!_[_0x8b45('0x68')](_0x19152b['body']['hopperIds'])){_0x37f580['id']={'$in':_0x19152b['body'][_0x8b45('0x69')]};}_0x3b3d21=[['priority',_0x8b45('0x6a')],[_0x8b45('0x6b'),_0x8e5a41[0x0]['dialOrderByScheduledAt']===_0x8b45('0x6a')?_0x8b45('0x6c'):'ASC'],db[_0x8b45('0x64')][_0x8b45('0x6d')](_0x8b45('0x6e')),['id',_0x8b45('0x6c')]];}else{if(!_[_0x8b45('0x68')](_0x19152b[_0x8b45('0x41')][_0x8b45('0x69')])){_0x37f580['id']={'$notIn':_0x19152b[_0x8b45('0x41')][_0x8b45('0x69')]};}_0x3b3d21=[[_0x8b45('0x6f'),_0x8b45('0x6c')],[_0x8b45('0x6b'),_0x8e5a41[0x0]['dialOrderByScheduledAt']],db[_0x8b45('0x64')][_0x8b45('0x6d')](_0x8b45('0x70')),['id',_0x8b45('0x6a')]];}return db[_0x8b45('0x13')][_0x8b45('0x71')]({'attributes':['id',_0x8b45('0x72'),_0x8b45('0x54'),_0x8b45('0x73')],'where':_0x37f580,'order':_0x3b3d21,'transaction':_0xf1ab37,'lock':_0xf1ab37[_0x8b45('0x74')][_0x8b45('0x75')],'include':[{'model':db[_0x8b45('0x58')],'as':_0x8b45('0x76'),'attributes':_0x6a77bd,'include':[{'model':db[_0x8b45('0x77')],'as':_0x8b45('0x78'),'attributes':['id','name']}]},{'model':db[_0x8b45('0x79')],'as':_0x8b45('0x7a'),'attributes':['id',_0x8b45('0xf')]},{'model':db[_0x8b45('0x46')],'as':_0x8b45('0x7b'),'attributes':['id',_0x8b45('0xf'),_0x8b45('0x7c')]}]})[_0x8b45('0xc')](function(_0x47d8f7){if(_0x47d8f7){return _0x47d8f7[_0x8b45('0xb')]({'UserId':_0x19152b[_0x8b45('0x4d')]['id']},{'transaction':_0xf1ab37});}});});}})[_0x8b45('0xc')](handleEntityNotFound(_0x19c80e,null))[_0x8b45('0xc')](respondWithResult(_0x19c80e,null))[_0x8b45('0x3a')](handleError(_0x19c80e,null));};exports[_0x8b45('0x7d')]=function(_0xd5a325,_0x9b123d,_0x2a6fee){var _0xd19d7c=[];var _0x2d0045=_0xd5a325['params']['id'];var _0x4b5cd7=_0xd5a325[_0x8b45('0x4d')]['id'];return db[_0x8b45('0x58')][_0x8b45('0x42')]()[_0x8b45('0xc')](function(_0x6a235a){_0xd19d7c=_[_0x8b45('0x3c')](_0x6a235a);return db[_0x8b45('0x64')][_0x8b45('0x7e')](function(_0x63ab53){const _0x4b3fb3={'id':_0x2d0045};return db['CmHopper'][_0x8b45('0x71')]({'attributes':['id',_0x8b45('0x72'),_0x8b45('0x73')],'where':_0x4b3fb3,'transaction':_0x63ab53,'lock':_0x63ab53[_0x8b45('0x74')]['UPDATE'],'include':[{'model':db[_0x8b45('0x58')],'as':_0x8b45('0x76'),'attributes':_0xd19d7c,'include':[{'model':db[_0x8b45('0x77')],'as':_0x8b45('0x78'),'attributes':['id',_0x8b45('0xf')]}]},{'model':db[_0x8b45('0x79')],'as':'List','attributes':['id','name']},{'model':db[_0x8b45('0x46')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x8b45('0xc')](function(_0x170b95){if(_0x170b95){return _0x170b95[_0x8b45('0xb')]({'UserId':_0x4b5cd7},{'transaction':_0x63ab53});}});});})[_0x8b45('0xc')](handleEntityNotFound(_0x9b123d,null))[_0x8b45('0xc')](respondWithResult(_0x9b123d,null))[_0x8b45('0x3a')](handleError(_0x9b123d,null));};exports[_0x8b45('0x7f')]=function(_0xc9be77,_0xc89fc6){return _0xc9be77[_0x8b45('0x4d')][_0x8b45('0x61')]({'where':{'type':_0x8b45('0x62'),'dialActive':!![],'dialMethod':_0x8b45('0x63')},'attributes':['id'],'raw':!![]})[_0x8b45('0xc')](function(_0x42b192){if(_0x42b192&&_0x42b192['length']){return db[_0x8b45('0x13')][_0x8b45('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8b45('0x51')](_0x8b45('0x52'))},'VoiceQueueId':{'$in':_[_0x8b45('0x12')](_0x42b192,'id')},'$or':[{'UserId':null},{'UserId':_0xc9be77[_0x8b45('0x4d')]['id']}]}});}return 0x0;})[_0x8b45('0xc')](function(_0x251584){if(!_[_0x8b45('0x5b')](_0x251584)&&_[_0x8b45('0x80')](_0x251584)){return _0xc89fc6['status'](0xc8)[_0x8b45('0xa')]({'contacts':_0x251584});}else{logger[_0x8b45('0xd')](_0x8b45('0x81'),_0x8b45('0x7f'),0x194,'entity\x20not\x20found');_0xc89fc6[_0x8b45('0x82')](0x194);}})['catch'](handleError(_0xc89fc6,null));};exports[_0x8b45('0x83')]=function(_0x55acc4,_0x2d3b89){var _0x6966ea=shared[_0x8b45('0x84')];var _0x3e4437=[];_[_0x8b45('0x12')](_0x6966ea,function(_0x45beb9){_0x3e4437['push']({'id':_0x45beb9[_0x8b45('0xf')],'name':_0x45beb9[_0x8b45('0xf')],'utcOffset':_0x45beb9[_0x8b45('0x85')]});});return _0x2d3b89[_0x8b45('0x5')](0xc8)['json']({'tz':_0x3e4437});};exports[_0x8b45('0x86')]=function(_0x3bdd64,_0x4adb06){var _0x5c3dbd=shared[_0x8b45('0x84')];var _0x24a570={};if(!_[_0x8b45('0x5b')](_0x5c3dbd[_0x3bdd64['body']['id']]))_0x24a570=_0x5c3dbd[_0x3bdd64[_0x8b45('0x41')]['id']];return _0x4adb06['status'](0xc8)[_0x8b45('0xa')](_0x24a570);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c5e5e80..4d22e1a 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdbd=['path','rimraf','./cmHopper.attributes','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b5310,_0x23c2ff){var _0x5d6465=function(_0x40a9e1){while(--_0x40a9e1){_0x4b5310['push'](_0x4b5310['shift']());}};_0x5d6465(++_0x23c2ff);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3b6f58,_0x5870de){_0x3b6f58=_0x3b6f58-0x0;var _0x987c61=_0xfdbd[_0x3b6f58];return _0x987c61;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xa')]},{'name':'phone','fields':[_0xdfdb('0xb')]},{'name':_0xdfdb('0xc'),'fields':[_0xdfdb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise','path','./cmHopper.attributes','CmHopper','cm_hopper'];(function(_0x512435,_0x4ba1ec){var _0x54c67a=function(_0x2e5528){while(--_0x2e5528){_0x512435['push'](_0x512435['shift']());}};_0x54c67a(++_0x4ba1ec);}(_0x1623,0xab));var _0x3162=function(_0x3b93c1,_0x16049f){_0x3b93c1=_0x3b93c1-0x0;var _0x5395ce=_0x1623[_0x3b93c1];return _0x5395ce;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'paranoid':![],'indexes':[{'name':_0x3162('0x9'),'fields':[_0x3162('0x9')]},{'name':_0x3162('0xa'),'fields':[_0x3162('0xa')]},{'name':_0x3162('0xb'),'fields':[_0x3162('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 75ab9fe..0bcc897 100644 --- a/server/api/cmHopper/cmHopper.rpc.js +++ b/server/api/cmHopper/cmHopper.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd408=['limit','include','map','model','then','info','GetCmHopper','catch','error','message','ShowCmHopper','find','debug','stringify','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','sequelize','transaction','findAll','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','length','push','update','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','order','all','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','List','lodash','util','moment','bluebird','../../mysqldb','rpc','CmHopper','raw','options','where','attributes'];(function(_0x30b145,_0x5b1406){var _0x5acce4=function(_0x48ade5){while(--_0x48ade5){_0x30b145['push'](_0x30b145['shift']());}};_0x5acce4(++_0x5b1406);}(_0xd408,0x1e7));var _0x8d40=function(_0x391209,_0x13f235){_0x391209=_0x391209-0x0;var _0x5a0a6a=_0xd408[_0x391209];return _0x5a0a6a;};'use strict';var _=require(_0x8d40('0x0'));var util=require(_0x8d40('0x1'));var moment=require(_0x8d40('0x2'));var BPromise=require(_0x8d40('0x3'));var db=require(_0x8d40('0x4'))['db'];var logger=require('../../config/logger')(_0x8d40('0x5'));exports['GetCmHopper']=function(_0x190764){var _0x1989fd=this;return new Promise(function(_0x1ed42f,_0x3a4ad5){return db[_0x8d40('0x6')]['findAll']({'raw':_0x190764['options']?_0x190764['options'][_0x8d40('0x7')]===undefined?!![]:![]:!![],'where':_0x190764[_0x8d40('0x8')]?_0x190764[_0x8d40('0x8')][_0x8d40('0x9')]||null:null,'attributes':_0x190764[_0x8d40('0x8')]?_0x190764[_0x8d40('0x8')][_0x8d40('0xa')]||null:null,'limit':_0x190764['options']?_0x190764[_0x8d40('0x8')][_0x8d40('0xb')]||null:null,'include':_0x190764[_0x8d40('0x8')]?_0x190764[_0x8d40('0x8')][_0x8d40('0xc')]?_[_0x8d40('0xd')](_0x190764['options'][_0x8d40('0xc')],function(_0x49a245){return{'model':db[_0x49a245[_0x8d40('0xe')]],'as':_0x49a245['as'],'attributes':_0x49a245['attributes'],'include':_0x49a245[_0x8d40('0xc')]?_[_0x8d40('0xd')](_0x49a245[_0x8d40('0xc')],function(_0x3f1007){return{'model':db[_0x3f1007['model']],'as':_0x3f1007['as'],'attributes':_0x3f1007['attributes'],'include':_0x3f1007['include']?_['map'](_0x3f1007[_0x8d40('0xc')],function(_0x1e9cd9){return{'model':db[_0x1e9cd9[_0x8d40('0xe')]],'as':_0x1e9cd9['as'],'attributes':_0x1e9cd9[_0x8d40('0xa')]};}):[]};}):[]};}):[]:[]})[_0x8d40('0xf')](function(_0x4ab79d){logger[_0x8d40('0x10')](_0x8d40('0x11'),_0x190764);logger['debug'](_0x8d40('0x11'),_0x190764,JSON['stringify'](_0x4ab79d));_0x1ed42f(_0x4ab79d);})[_0x8d40('0x12')](function(_0x2fbcee){logger[_0x8d40('0x13')](_0x8d40('0x11'),_0x2fbcee[_0x8d40('0x14')],_0x190764);_0x3a4ad5(_0x1989fd['error'](0x1f4,_0x2fbcee[_0x8d40('0x14')]));});});};exports[_0x8d40('0x15')]=function(_0x5e7797){var _0x1814b1=this;return new Promise(function(_0x2d4f0e,_0x8d435f){return db[_0x8d40('0x6')][_0x8d40('0x16')]({'raw':_0x5e7797[_0x8d40('0x8')]?_0x5e7797[_0x8d40('0x8')][_0x8d40('0x7')]===undefined?!![]:![]:!![],'where':_0x5e7797[_0x8d40('0x8')]?_0x5e7797[_0x8d40('0x8')][_0x8d40('0x9')]||null:null,'attributes':_0x5e7797['options']?_0x5e7797[_0x8d40('0x8')][_0x8d40('0xa')]||null:null,'include':_0x5e7797['options']?_0x5e7797[_0x8d40('0x8')]['include']?_[_0x8d40('0xd')](_0x5e7797[_0x8d40('0x8')]['include'],function(_0x3b9da8){return{'model':db[_0x3b9da8[_0x8d40('0xe')]],'as':_0x3b9da8['as'],'attributes':_0x3b9da8[_0x8d40('0xa')],'include':_0x3b9da8[_0x8d40('0xc')]?_[_0x8d40('0xd')](_0x3b9da8[_0x8d40('0xc')],function(_0x2b93fd){return{'model':db[_0x2b93fd[_0x8d40('0xe')]],'as':_0x2b93fd['as'],'attributes':_0x2b93fd[_0x8d40('0xa')],'include':_0x2b93fd['include']?_[_0x8d40('0xd')](_0x2b93fd[_0x8d40('0xc')],function(_0xd71c98){return{'model':db[_0xd71c98[_0x8d40('0xe')]],'as':_0xd71c98['as'],'attributes':_0xd71c98[_0x8d40('0xa')]};}):[]};}):[]};}):[]:[]})[_0x8d40('0xf')](function(_0x295623){logger['info'](_0x8d40('0x15'),_0x5e7797);logger[_0x8d40('0x17')](_0x8d40('0x15'),_0x5e7797,JSON[_0x8d40('0x18')](_0x295623));_0x2d4f0e(_0x295623);})[_0x8d40('0x12')](function(_0x8d6aa7){logger[_0x8d40('0x13')](_0x8d40('0x15'),_0x8d6aa7[_0x8d40('0x14')],_0x5e7797);_0x8d435f(_0x1814b1[_0x8d40('0x13')](0x1f4,_0x8d6aa7[_0x8d40('0x14')]));});});};exports[_0x8d40('0x19')]=function(_0x5acf95){var _0x441d37=this;return new Promise(function(_0x3ab0bb,_0x2748c8){return db[_0x8d40('0x6')]['create'](_0x5acf95[_0x8d40('0x1a')],{'raw':_0x5acf95[_0x8d40('0x8')]?_0x5acf95['options'][_0x8d40('0x7')]===undefined?!![]:![]:!![]})[_0x8d40('0xf')](function(_0x23eff6){logger[_0x8d40('0x10')]('CreateCmHopper',_0x5acf95);logger[_0x8d40('0x17')](_0x8d40('0x19'),_0x5acf95,JSON[_0x8d40('0x18')](_0x23eff6));_0x3ab0bb(_0x23eff6);})[_0x8d40('0x12')](function(_0xe4f999){logger[_0x8d40('0x13')](_0x8d40('0x19'),_0xe4f999[_0x8d40('0x14')],_0x5acf95);_0x2748c8(_0x441d37[_0x8d40('0x13')](0x1f4,_0xe4f999[_0x8d40('0x14')]));});});};exports[_0x8d40('0x1b')]=function(_0x22b17b){var _0x577519=this;return new Promise(function(_0x560bab,_0x526313){return db[_0x8d40('0x6')]['update'](_0x22b17b[_0x8d40('0x1a')],{'raw':_0x22b17b[_0x8d40('0x8')]?_0x22b17b[_0x8d40('0x8')][_0x8d40('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22b17b[_0x8d40('0x8')]?_0x22b17b[_0x8d40('0x8')]['where']||null:null,'attributes':_0x22b17b[_0x8d40('0x8')]?_0x22b17b['options'][_0x8d40('0xa')]||null:null,'limit':_0x22b17b[_0x8d40('0x8')]?_0x22b17b[_0x8d40('0x8')][_0x8d40('0xb')]||null:null})[_0x8d40('0xf')](function(_0x4fa475){logger[_0x8d40('0x10')](_0x8d40('0x1b'),_0x22b17b);logger['info'](_0x8d40('0x1c'),JSON[_0x8d40('0x18')](_0x22b17b['options'][_0x8d40('0x9')]),_0x22b17b['body'][_0x8d40('0x1d')]);logger[_0x8d40('0x17')]('UpdateCmHopper',_0x22b17b,JSON[_0x8d40('0x18')](_0x4fa475));_0x560bab(_0x4fa475);})[_0x8d40('0x12')](function(_0x5b89fd){logger[_0x8d40('0x13')]('UpdateCmHopper',_0x5b89fd[_0x8d40('0x14')],_0x22b17b);_0x526313(_0x577519['error'](0x1f4,_0x5b89fd['message']));});});};exports[_0x8d40('0x1e')]=function(_0x1acc14){var _0x380274=this;return new Promise(function(_0x248872,_0x31bcb1){return db[_0x8d40('0x6')][_0x8d40('0x1f')]({'where':_0x1acc14[_0x8d40('0x8')]?_0x1acc14[_0x8d40('0x8')][_0x8d40('0x9')]||null:null})[_0x8d40('0xf')](function(_0x27cc5e){logger[_0x8d40('0x10')]('DestroyCmHopper',_0x1acc14);logger[_0x8d40('0x17')](_0x8d40('0x1e'),_0x1acc14,JSON[_0x8d40('0x18')](_0x27cc5e));_0x248872(_0x27cc5e);})[_0x8d40('0x12')](function(_0xb7412d){logger['error'](_0x8d40('0x1e'),_0xb7412d[_0x8d40('0x14')],_0x1acc14);_0x31bcb1(_0x380274[_0x8d40('0x13')](0x1f4,_0xb7412d[_0x8d40('0x14')]));});});};exports[_0x8d40('0x20')]=function(_0xbac3f4){var _0x506be8=this;return new Promise(function(_0x160a3c,_0x397d34){return db['CmContact']['describe']()[_0x8d40('0xf')](function(_0x15036c){return db[_0x8d40('0x21')][_0x8d40('0x22')](function(_0x4c36b9){return db[_0x8d40('0x6')][_0x8d40('0x23')]({'where':_0xbac3f4['options']?_0xbac3f4[_0x8d40('0x8')]['where']||null:null,'attributes':_0xbac3f4[_0x8d40('0x8')]?_0xbac3f4[_0x8d40('0x8')][_0x8d40('0xa')]||null:null,'limit':_0xbac3f4[_0x8d40('0x8')]?_0xbac3f4[_0x8d40('0x8')]['limit']||null:null,'order':_0xbac3f4[_0x8d40('0x8')]?_0xbac3f4[_0x8d40('0x8')]['order']||null:null,'transaction':_0x4c36b9,'lock':_0x4c36b9[_0x8d40('0x24')][_0x8d40('0x25')],'include':[{'model':db[_0x8d40('0x26')],'as':_0x8d40('0x27'),'attributes':_[_0x8d40('0x28')](_0x15036c)},{'model':db[_0x8d40('0x29')],'as':_0x8d40('0x2a'),'attributes':['id',_0x8d40('0x2b'),_0x8d40('0x2c')]}]})['then'](function(_0x3124d5){var _0xb49c14=[];var _0x621cb4=[];for(var _0x37b7f0=0x0;_0x37b7f0<_0x3124d5[_0x8d40('0x2d')];_0x37b7f0+=0x1){var _0x139a99=_0x3124d5[_0x37b7f0]['UserId'];if(_0x139a99===null){_0xb49c14[_0x8d40('0x2e')](_0x3124d5[_0x37b7f0][_0x8d40('0x2f')](_0xbac3f4[_0x8d40('0x1a')],{'transaction':_0x4c36b9}));}else if(!_0x621cb4[_0x8d40('0x30')](_0x139a99)){_0x621cb4[_0x8d40('0x2e')](_0x139a99);_0xb49c14[_0x8d40('0x2e')](_0x3124d5[_0x37b7f0][_0x8d40('0x2f')](_0xbac3f4[_0x8d40('0x1a')],{'transaction':_0x4c36b9}));}}return BPromise['all'](_0xb49c14);});})[_0x8d40('0xf')](function(_0x5e1103){logger[_0x8d40('0x10')](_0x8d40('0x20'),_0xbac3f4);if(_0x5e1103[_0x8d40('0x2d')]>0x0){logger[_0x8d40('0x10')](_0x8d40('0x31'),_0x5e1103[0x0]['dataValues']['id'],_0x5e1103[0x0][_0x8d40('0x32')][_0x8d40('0x33')],_0x5e1103[0x0][_0x8d40('0x32')][_0x8d40('0x1d')]);}logger[_0x8d40('0x17')](_0x8d40('0x20'),_0xbac3f4,JSON[_0x8d40('0x18')](_0x5e1103));_0x160a3c(_0x5e1103);})[_0x8d40('0x12')](function(_0x33d44){logger[_0x8d40('0x13')](_0x8d40('0x20'),_0x33d44[_0x8d40('0x14')],_0xbac3f4);_0x397d34(_0x506be8[_0x8d40('0x13')](0x1f4,_0x33d44[_0x8d40('0x14')]));});});});};exports[_0x8d40('0x34')]=function(_0x236e13){var _0x3eea0f=this;return new Promise(function(_0x2bf48d,_0x311d04){return db[_0x8d40('0x21')][_0x8d40('0x22')](function(_0x38217c){return db[_0x8d40('0x35')][_0x8d40('0x36')](_0x236e13[_0x8d40('0x1a')],{'raw':_0x236e13[_0x8d40('0x8')]?_0x236e13[_0x8d40('0x8')][_0x8d40('0x7')]===undefined?!![]:![]:!![],'transaction':_0x38217c})[_0x8d40('0xf')](function(){logger[_0x8d40('0x10')](_0x8d40('0x37'),JSON[_0x8d40('0x18')](_0x236e13['options'][_0x8d40('0x9')]),_0x236e13[_0x8d40('0x8')]['where'][_0x8d40('0x1d')]);return db[_0x8d40('0x6')]['destroy']({'where':_0x236e13[_0x8d40('0x8')]?_0x236e13[_0x8d40('0x8')][_0x8d40('0x9')]||null:null,'transaction':_0x38217c});});})['then'](function(_0x1b2e08){logger[_0x8d40('0x10')](_0x8d40('0x34'),_0x236e13);logger['debug'](_0x8d40('0x34'),_0x236e13,JSON[_0x8d40('0x18')](_0x1b2e08));_0x2bf48d(_0x1b2e08);})['catch'](function(_0xeea75){logger['error'](_0x8d40('0x34'),_0xeea75[_0x8d40('0x14')],_0x236e13);_0x311d04(_0x3eea0f[_0x8d40('0x13')](0x1f4,_0xeea75[_0x8d40('0x14')]));});});};exports[_0x8d40('0x38')]=function(_0x32d339){var _0xa4e48=this;return new Promise(function(_0x812290,_0x53fb20){return db[_0x8d40('0x6')][_0x8d40('0x23')]({'raw':_0x32d339['options']?_0x32d339['options'][_0x8d40('0x7')]===undefined?!![]:![]:!![],'where':_0x32d339[_0x8d40('0x8')]?_0x32d339[_0x8d40('0x8')][_0x8d40('0x9')]||null:null,'attributes':[[db['sequelize']['fn'](_0x8d40('0x39'),db[_0x8d40('0x21')]['fn']('IF',db[_0x8d40('0x21')][_0x8d40('0x3a')]('`scheduledat`\x20>=\x20'+util[_0x8d40('0x3b')](_0x8d40('0x3c'),moment()[_0x8d40('0x3b')](_0x8d40('0x3d')))+_0x8d40('0x3e')))),_0x8d40('0x3f')]]})[_0x8d40('0xf')](function(_0x56094c){logger[_0x8d40('0x10')]('CountReScheduled',_0x32d339);logger['debug'](_0x8d40('0x38'),_0x32d339,JSON[_0x8d40('0x18')](_0x56094c));_0x812290(_0x56094c);})[_0x8d40('0x12')](function(_0x33c469){logger['error'](_0x8d40('0x38'),_0x33c469[_0x8d40('0x14')],_0x32d339);_0x53fb20(_0xa4e48[_0x8d40('0x13')](0x1f4,_0x33c469[_0x8d40('0x14')]));});});};exports[_0x8d40('0x40')]=function(_0x3c77df){var _0x42c0ee=this;return new Promise(function(_0x3ed451,_0x37dbb5){return db[_0x8d40('0x26')][_0x8d40('0x41')]()[_0x8d40('0xf')](function(){return db[_0x8d40('0x21')][_0x8d40('0x22')](function(_0x356d0b){return db[_0x8d40('0x6')][_0x8d40('0x23')]({'where':_0x3c77df[_0x8d40('0x8')]?_0x3c77df[_0x8d40('0x8')][_0x8d40('0x9')]||null:null,'attributes':_0x3c77df[_0x8d40('0x8')]?_0x3c77df['options'][_0x8d40('0xa')]||null:null,'limit':0x1,'order':_0x3c77df[_0x8d40('0x8')]?_0x3c77df['options'][_0x8d40('0x42')]||null:null,'group':db[_0x8d40('0x6')]['UserId'],'transaction':_0x356d0b,'lock':_0x356d0b[_0x8d40('0x24')][_0x8d40('0x25')],'include':_0x3c77df['options']?_0x3c77df['options'][_0x8d40('0xc')]?_[_0x8d40('0xd')](_0x3c77df[_0x8d40('0x8')]['include'],function(_0x51d1d9){return{'model':db[_0x51d1d9['model']],'as':_0x51d1d9['as'],'attributes':_0x51d1d9['attributes'],'include':_0x51d1d9['include']?_[_0x8d40('0xd')](_0x51d1d9[_0x8d40('0xc')],function(_0x2a85e6){return{'model':db[_0x2a85e6[_0x8d40('0xe')]],'as':_0x2a85e6['as'],'attributes':_0x2a85e6[_0x8d40('0xa')],'include':_0x2a85e6[_0x8d40('0xc')]?_['map'](_0x2a85e6[_0x8d40('0xc')],function(_0x39041d){return{'model':db[_0x39041d[_0x8d40('0xe')]],'as':_0x39041d['as'],'attributes':_0x39041d[_0x8d40('0xa')]};}):[]};}):[]};}):[]:[]})[_0x8d40('0xf')](function(_0x587a24){var _0x5b3d2a=[];for(var _0x3211f8=0x0;_0x3211f8<_0x587a24['length'];_0x3211f8+=0x1){_0x5b3d2a[_0x8d40('0x2e')](_0x587a24[_0x3211f8][_0x8d40('0x2f')](_0x3c77df['body'],{'transaction':_0x356d0b}));}return BPromise[_0x8d40('0x43')](_0x5b3d2a);});})[_0x8d40('0xf')](function(_0x70a358){logger['info']('GetContactRecallMe',_0x3c77df);logger[_0x8d40('0x17')](_0x8d40('0x40'),_0x3c77df,JSON['stringify'](_0x70a358));_0x3ed451(_0x70a358);})[_0x8d40('0x12')](function(_0x261f8c){logger[_0x8d40('0x13')](_0x8d40('0x40'),_0x261f8c['message'],_0x3c77df);_0x37dbb5(_0x42c0ee[_0x8d40('0x13')](0x1f4,_0x261f8c[_0x8d40('0x14')]));});});});};exports[_0x8d40('0x44')]=function(_0x26560c){var _0x56bf04=this;return new Promise(function(_0x1f26b2,_0x503b69){db[_0x8d40('0x26')][_0x8d40('0x41')]()[_0x8d40('0xf')](function(_0x359e6e){return db[_0x8d40('0x6')][_0x8d40('0x23')]({'raw':_0x26560c[_0x8d40('0x8')]?_0x26560c[_0x8d40('0x8')][_0x8d40('0x7')]===undefined?!![]:![]:!![],'where':_0x26560c[_0x8d40('0x8')]?_0x26560c['options']['where']||null:null,'attributes':_0x26560c[_0x8d40('0x8')]?_0x26560c[_0x8d40('0x8')][_0x8d40('0xa')]||null:null,'limit':_0x26560c[_0x8d40('0x8')]?_0x26560c[_0x8d40('0x8')][_0x8d40('0xb')]||null:null,'include':_0x26560c['options']?_0x26560c[_0x8d40('0x8')][_0x8d40('0xc')]?_[_0x8d40('0xd')](_0x26560c[_0x8d40('0x8')][_0x8d40('0xc')],function(_0x3f7662){return{'model':db[_0x3f7662[_0x8d40('0xe')]],'as':_0x3f7662['as'],'attributes':_0x3f7662['as']===_0x8d40('0x27')?_['keys'](_0x359e6e):_0x3f7662['attributes'],'include':_0x3f7662[_0x8d40('0xc')]?_[_0x8d40('0xd')](_0x3f7662['include'],function(_0x30eee9){return{'model':db[_0x30eee9[_0x8d40('0xe')]],'as':_0x30eee9['as'],'attributes':_0x30eee9['attributes'],'include':_0x30eee9[_0x8d40('0xc')]?_[_0x8d40('0xd')](_0x30eee9[_0x8d40('0xc')],function(_0xe506fa){return{'model':db[_0xe506fa[_0x8d40('0xe')]],'as':_0xe506fa['as'],'attributes':_0xe506fa[_0x8d40('0xa')]};}):[]};}):[]};}):[]:[]})[_0x8d40('0xf')](function(_0xb4b068){logger[_0x8d40('0x10')](_0x8d40('0x11'),_0x26560c);logger['debug']('GetCmHopper',_0x26560c,JSON[_0x8d40('0x18')](_0xb4b068));_0x1f26b2(_0xb4b068);})[_0x8d40('0x12')](function(_0x63a7d4){logger['error'](_0x8d40('0x11'),_0x63a7d4[_0x8d40('0x14')],_0x26560c);_0x503b69(_0x56bf04[_0x8d40('0x13')](0x1f4,_0x63a7d4[_0x8d40('0x14')]));});});});};exports[_0x8d40('0x45')]=function(_0x1f8bc8){var _0x16529c=this;return new Promise(function(_0x33d2d8,_0x1e613d){return db[_0x8d40('0x26')]['findOne']({'raw':!![],'where':{'phone':_0x1f8bc8[_0x8d40('0x8')][_0x8d40('0x9')][_0x8d40('0x46')]},'attributes':['id',_0x8d40('0x47')],'order':[['id',_0x8d40('0x48')]]})[_0x8d40('0xf')](function(_0x339c83){logger[_0x8d40('0x10')](_0x8d40('0x49'),_0x1f8bc8);logger[_0x8d40('0x17')](_0x8d40('0x49'),_0x1f8bc8,JSON['stringify'](_0x339c83));_0x33d2d8(_0x339c83);})[_0x8d40('0x12')](function(_0x13463c){logger[_0x8d40('0x13')]('getContactByPhone',_0x13463c[_0x8d40('0x14')],_0x1f8bc8);_0x1e613d(_0x16529c[_0x8d40('0x13')](0x1f4,_0x13463c[_0x8d40('0x14')]));});});};exports[_0x8d40('0x4a')]=function(_0xda6ffb){var _0x393c48=this;return new Promise(function(_0x4b1c4f,_0x3a015b){return db[_0x8d40('0x21')][_0x8d40('0x22')](function(_0x1c1e7c){var _0xc4ce15=_0xda6ffb[_0x8d40('0x8')]&&_0xda6ffb[_0x8d40('0x8')][_0x8d40('0x9')]?_0xda6ffb['options'][_0x8d40('0x9')]:{};return db['CmHopper'][_0x8d40('0x2f')](_0xda6ffb['body'],{'where':_0xc4ce15,'transaction':_0x1c1e7c})['then'](function(_0xa307cf){logger[_0x8d40('0x10')](_0x8d40('0x4a'),_0xda6ffb);logger[_0x8d40('0x17')](_0x8d40('0x4a'),_0xda6ffb,JSON['stringify'](_0xa307cf));_0x4b1c4f(_0xa307cf);})[_0x8d40('0x12')](function(_0x2430e8){logger[_0x8d40('0x13')]('ResetActiveCalls',_0x2430e8[_0x8d40('0x14')],_0xda6ffb);_0x3a015b(_0x393c48[_0x8d40('0x13')](0x1f4,_0x2430e8['message']));});});});};exports[_0x8d40('0x4b')]=function(_0x562c56){var _0x5f4528=this;var _0x16abc5=_0x562c56[_0x8d40('0x1a')][_0x8d40('0x9')][_0x8d40('0x4c')];var _0x4d7fb5=_0x562c56['body'][_0x8d40('0x9')][_0x8d40('0x4d')];var _0x37033f=_0x562c56['body'][_0x8d40('0x9')][_0x8d40('0x4e')];return new Promise(function(_0x27df92,_0x4a7230){return db[_0x8d40('0x6')][_0x8d40('0x23')]({'where':{'voiceQueueId':{'$in':_0x16abc5},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x8d40('0x21')]['literal'](_0x8d40('0x4f')+_0x4d7fb5+_0x8d40('0x50')),'$gt':db['sequelize'][_0x8d40('0x3a')](_0x8d40('0x51'))}},'UserId':{'$in':_0x37033f}},'include':[{'model':db[_0x8d40('0x26')],'as':_0x8d40('0x27')},{'model':db[_0x8d40('0x29')],'as':_0x8d40('0x2a'),'attributes':['id',_0x8d40('0x2b'),'voicePause']},{'model':db['CmList'],'as':_0x8d40('0x52')}]})[_0x8d40('0xf')](function(_0x19be4c){if(_0x19be4c['length']>0x0){return db['sequelize'][_0x8d40('0x22')](function(_0xafd951){return db[_0x8d40('0x6')][_0x8d40('0x2f')]({'recallmeNotifiedDate':db[_0x8d40('0x21')][_0x8d40('0x3a')](_0x8d40('0x51'))},{'where':{'id':{'$in':_[_0x8d40('0xd')](_0x19be4c,'id')}},'transaction':_0xafd951})[_0x8d40('0xf')](function(){_0x27df92(_0x19be4c);})[_0x8d40('0x12')](function(_0x3c175c){logger[_0x8d40('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x3c175c[_0x8d40('0x14')],_0x562c56);_0x4a7230(_0x5f4528[_0x8d40('0x13')](0x1f4,_0x3c175c[_0x8d40('0x14')]));});})[_0x8d40('0x12')](function(_0x14c652){logger['error'](_0x8d40('0x4b'),_0x14c652['message'],_0x562c56);_0x4a7230(_0x5f4528[_0x8d40('0x13')](0x1f4,_0x14c652[_0x8d40('0x14')]));});}else{_0x27df92(_0x19be4c);}});});}; \ No newline at end of file +var _0x64c7=['Agent','CmList','List','lodash','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','options','raw','limit','include','map','model','attributes','then','debug','catch','error','message','find','where','info','ShowCmHopper','stringify','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','CmContact','describe','sequelize','transaction','findAll','Contact','keys','User','name','voicePause','UserId','push','includes','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','order','LOCK','UPDATE','all','GetContactByPhone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','NOW()'];(function(_0x1b0202,_0x2d0d3e){var _0x10085d=function(_0x12c971){while(--_0x12c971){_0x1b0202['push'](_0x1b0202['shift']());}};_0x10085d(++_0x2d0d3e);}(_0x64c7,0x17f));var _0x764c=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0x64c7[_0x34df4a];return _0x145c69;};'use strict';var _=require(_0x764c('0x0'));var util=require('util');var moment=require(_0x764c('0x1'));var BPromise=require(_0x764c('0x2'));var db=require(_0x764c('0x3'))['db'];var logger=require('../../config/logger')(_0x764c('0x4'));exports[_0x764c('0x5')]=function(_0x27edad){var _0x34e00d=this;return new Promise(function(_0xa8a3ab,_0x150ff6){return db[_0x764c('0x6')]['findAll']({'raw':_0x27edad[_0x764c('0x7')]?_0x27edad[_0x764c('0x7')][_0x764c('0x8')]===undefined?!![]:![]:!![],'where':_0x27edad['options']?_0x27edad[_0x764c('0x7')]['where']||null:null,'attributes':_0x27edad[_0x764c('0x7')]?_0x27edad[_0x764c('0x7')]['attributes']||null:null,'limit':_0x27edad[_0x764c('0x7')]?_0x27edad[_0x764c('0x7')][_0x764c('0x9')]||null:null,'include':_0x27edad[_0x764c('0x7')]?_0x27edad[_0x764c('0x7')][_0x764c('0xa')]?_[_0x764c('0xb')](_0x27edad[_0x764c('0x7')][_0x764c('0xa')],function(_0x4ce7d6){return{'model':db[_0x4ce7d6[_0x764c('0xc')]],'as':_0x4ce7d6['as'],'attributes':_0x4ce7d6[_0x764c('0xd')],'include':_0x4ce7d6[_0x764c('0xa')]?_[_0x764c('0xb')](_0x4ce7d6[_0x764c('0xa')],function(_0x3974a3){return{'model':db[_0x3974a3[_0x764c('0xc')]],'as':_0x3974a3['as'],'attributes':_0x3974a3[_0x764c('0xd')],'include':_0x3974a3[_0x764c('0xa')]?_[_0x764c('0xb')](_0x3974a3['include'],function(_0x52b4ed){return{'model':db[_0x52b4ed['model']],'as':_0x52b4ed['as'],'attributes':_0x52b4ed[_0x764c('0xd')]};}):[]};}):[]};}):[]:[]})[_0x764c('0xe')](function(_0x30eb32){logger['info']('GetCmHopper',_0x27edad);logger[_0x764c('0xf')](_0x764c('0x5'),_0x27edad,JSON['stringify'](_0x30eb32));_0xa8a3ab(_0x30eb32);})[_0x764c('0x10')](function(_0x3674ef){logger[_0x764c('0x11')](_0x764c('0x5'),_0x3674ef[_0x764c('0x12')],_0x27edad);_0x150ff6(_0x34e00d[_0x764c('0x11')](0x1f4,_0x3674ef[_0x764c('0x12')]));});});};exports['ShowCmHopper']=function(_0x5684db){var _0x4350b8=this;return new Promise(function(_0x3fc875,_0x471547){return db[_0x764c('0x6')][_0x764c('0x13')]({'raw':_0x5684db[_0x764c('0x7')]?_0x5684db[_0x764c('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x5684db[_0x764c('0x7')]?_0x5684db['options'][_0x764c('0x14')]||null:null,'attributes':_0x5684db['options']?_0x5684db[_0x764c('0x7')][_0x764c('0xd')]||null:null,'include':_0x5684db[_0x764c('0x7')]?_0x5684db[_0x764c('0x7')][_0x764c('0xa')]?_['map'](_0x5684db['options'][_0x764c('0xa')],function(_0xe7f13a){return{'model':db[_0xe7f13a[_0x764c('0xc')]],'as':_0xe7f13a['as'],'attributes':_0xe7f13a['attributes'],'include':_0xe7f13a[_0x764c('0xa')]?_[_0x764c('0xb')](_0xe7f13a['include'],function(_0x1d97f3){return{'model':db[_0x1d97f3[_0x764c('0xc')]],'as':_0x1d97f3['as'],'attributes':_0x1d97f3[_0x764c('0xd')],'include':_0x1d97f3[_0x764c('0xa')]?_[_0x764c('0xb')](_0x1d97f3[_0x764c('0xa')],function(_0x303d89){return{'model':db[_0x303d89[_0x764c('0xc')]],'as':_0x303d89['as'],'attributes':_0x303d89['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3befcb){logger[_0x764c('0x15')](_0x764c('0x16'),_0x5684db);logger[_0x764c('0xf')](_0x764c('0x16'),_0x5684db,JSON[_0x764c('0x17')](_0x3befcb));_0x3fc875(_0x3befcb);})[_0x764c('0x10')](function(_0x41bc6b){logger[_0x764c('0x11')]('ShowCmHopper',_0x41bc6b['message'],_0x5684db);_0x471547(_0x4350b8[_0x764c('0x11')](0x1f4,_0x41bc6b['message']));});});};exports[_0x764c('0x18')]=function(_0x14af5f){var _0x506ce3=this;return new Promise(function(_0xb6cd49,_0xc49b05){return db[_0x764c('0x6')][_0x764c('0x19')](_0x14af5f[_0x764c('0x1a')],{'raw':_0x14af5f[_0x764c('0x7')]?_0x14af5f['options'][_0x764c('0x8')]===undefined?!![]:![]:!![]})[_0x764c('0xe')](function(_0x57b0f7){logger[_0x764c('0x15')]('CreateCmHopper',_0x14af5f);logger[_0x764c('0xf')](_0x764c('0x18'),_0x14af5f,JSON[_0x764c('0x17')](_0x57b0f7));_0xb6cd49(_0x57b0f7);})[_0x764c('0x10')](function(_0x33301a){logger[_0x764c('0x11')](_0x764c('0x18'),_0x33301a[_0x764c('0x12')],_0x14af5f);_0xc49b05(_0x506ce3[_0x764c('0x11')](0x1f4,_0x33301a[_0x764c('0x12')]));});});};exports[_0x764c('0x1b')]=function(_0xfaefb9){var _0x513e0a=this;return new Promise(function(_0x537582,_0x289a57){return db['CmHopper'][_0x764c('0x1c')](_0xfaefb9['body'],{'raw':_0xfaefb9['options']?_0xfaefb9[_0x764c('0x7')][_0x764c('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfaefb9[_0x764c('0x7')]?_0xfaefb9['options'][_0x764c('0x14')]||null:null,'attributes':_0xfaefb9[_0x764c('0x7')]?_0xfaefb9['options'][_0x764c('0xd')]||null:null,'limit':_0xfaefb9[_0x764c('0x7')]?_0xfaefb9[_0x764c('0x7')][_0x764c('0x9')]||null:null})[_0x764c('0xe')](function(_0x38c243){logger['info'](_0x764c('0x1b'),_0xfaefb9);logger[_0x764c('0x15')](_0x764c('0x1d'),JSON[_0x764c('0x17')](_0xfaefb9[_0x764c('0x7')][_0x764c('0x14')]),_0xfaefb9[_0x764c('0x1a')][_0x764c('0x1e')]);logger[_0x764c('0xf')]('UpdateCmHopper',_0xfaefb9,JSON[_0x764c('0x17')](_0x38c243));_0x537582(_0x38c243);})[_0x764c('0x10')](function(_0x5c1238){logger[_0x764c('0x11')]('UpdateCmHopper',_0x5c1238[_0x764c('0x12')],_0xfaefb9);_0x289a57(_0x513e0a[_0x764c('0x11')](0x1f4,_0x5c1238['message']));});});};exports[_0x764c('0x1f')]=function(_0x1b8409){var _0x12bade=this;return new Promise(function(_0x140834,_0x191400){return db[_0x764c('0x6')]['destroy']({'where':_0x1b8409[_0x764c('0x7')]?_0x1b8409[_0x764c('0x7')][_0x764c('0x14')]||null:null})[_0x764c('0xe')](function(_0x28d723){logger[_0x764c('0x15')](_0x764c('0x1f'),_0x1b8409);logger['debug']('DestroyCmHopper',_0x1b8409,JSON[_0x764c('0x17')](_0x28d723));_0x140834(_0x28d723);})[_0x764c('0x10')](function(_0x3b21cb){logger[_0x764c('0x11')](_0x764c('0x1f'),_0x3b21cb[_0x764c('0x12')],_0x1b8409);_0x191400(_0x12bade[_0x764c('0x11')](0x1f4,_0x3b21cb[_0x764c('0x12')]));});});};exports['GetContactDialer']=function(_0x27b18c){var _0x44585e=this;return new Promise(function(_0x4a7243,_0x1852c2){return db[_0x764c('0x20')][_0x764c('0x21')]()['then'](function(_0x466707){return db[_0x764c('0x22')][_0x764c('0x23')](function(_0x19bd8c){return db['CmHopper'][_0x764c('0x24')]({'where':_0x27b18c[_0x764c('0x7')]?_0x27b18c[_0x764c('0x7')][_0x764c('0x14')]||null:null,'attributes':_0x27b18c['options']?_0x27b18c[_0x764c('0x7')][_0x764c('0xd')]||null:null,'limit':_0x27b18c['options']?_0x27b18c[_0x764c('0x7')][_0x764c('0x9')]||null:null,'order':_0x27b18c[_0x764c('0x7')]?_0x27b18c['options']['order']||null:null,'transaction':_0x19bd8c,'lock':_0x19bd8c['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x764c('0x25'),'attributes':_[_0x764c('0x26')](_0x466707)},{'model':db[_0x764c('0x27')],'as':'Agent','attributes':['id',_0x764c('0x28'),_0x764c('0x29')]}]})['then'](function(_0x12b5f9){var _0x19947=[];var _0x13c774=[];for(var _0xaf53df=0x0;_0xaf53df<_0x12b5f9['length'];_0xaf53df+=0x1){var _0x526287=_0x12b5f9[_0xaf53df][_0x764c('0x2a')];if(_0x526287===null){_0x19947[_0x764c('0x2b')](_0x12b5f9[_0xaf53df][_0x764c('0x1c')](_0x27b18c[_0x764c('0x1a')],{'transaction':_0x19bd8c}));}else if(!_0x13c774[_0x764c('0x2c')](_0x526287)){_0x13c774[_0x764c('0x2b')](_0x526287);_0x19947[_0x764c('0x2b')](_0x12b5f9[_0xaf53df]['update'](_0x27b18c[_0x764c('0x1a')],{'transaction':_0x19bd8c}));}}return BPromise['all'](_0x19947);});})['then'](function(_0x196e0f){logger[_0x764c('0x15')](_0x764c('0x2d'),_0x27b18c);if(_0x196e0f[_0x764c('0x2e')]>0x0){logger['info'](_0x764c('0x2f'),_0x196e0f[0x0][_0x764c('0x30')]['id'],_0x196e0f[0x0][_0x764c('0x30')]['ContactId'],_0x196e0f[0x0]['dataValues'][_0x764c('0x1e')]);}logger[_0x764c('0xf')]('GetContactDialer',_0x27b18c,JSON[_0x764c('0x17')](_0x196e0f));_0x4a7243(_0x196e0f);})['catch'](function(_0x2e2859){logger['error'](_0x764c('0x2d'),_0x2e2859[_0x764c('0x12')],_0x27b18c);_0x1852c2(_0x44585e['error'](0x1f4,_0x2e2859['message']));});});});};exports[_0x764c('0x31')]=function(_0x4a6967){var _0x40a071=this;return new Promise(function(_0x22380a,_0x3a64e8){return db[_0x764c('0x22')][_0x764c('0x23')](function(_0x1ad932){return db['CmHopperFinal'][_0x764c('0x19')](_0x4a6967[_0x764c('0x1a')],{'raw':_0x4a6967[_0x764c('0x7')]?_0x4a6967[_0x764c('0x7')][_0x764c('0x8')]===undefined?!![]:![]:!![],'transaction':_0x1ad932})[_0x764c('0xe')](function(){logger[_0x764c('0x15')](_0x764c('0x32'),JSON[_0x764c('0x17')](_0x4a6967[_0x764c('0x7')][_0x764c('0x14')]),_0x4a6967[_0x764c('0x7')][_0x764c('0x14')][_0x764c('0x1e')]);return db[_0x764c('0x6')]['destroy']({'where':_0x4a6967[_0x764c('0x7')]?_0x4a6967[_0x764c('0x7')][_0x764c('0x14')]||null:null,'transaction':_0x1ad932});});})['then'](function(_0x1f91f8){logger[_0x764c('0x15')](_0x764c('0x31'),_0x4a6967);logger['debug'](_0x764c('0x31'),_0x4a6967,JSON[_0x764c('0x17')](_0x1f91f8));_0x22380a(_0x1f91f8);})[_0x764c('0x10')](function(_0x194b3a){logger[_0x764c('0x11')](_0x764c('0x31'),_0x194b3a[_0x764c('0x12')],_0x4a6967);_0x3a64e8(_0x40a071[_0x764c('0x11')](0x1f4,_0x194b3a[_0x764c('0x12')]));});});};exports[_0x764c('0x33')]=function(_0x32f96f){var _0x1239ba=this;return new Promise(function(_0x3c19f8,_0x36f815){return db[_0x764c('0x6')][_0x764c('0x24')]({'raw':_0x32f96f['options']?_0x32f96f[_0x764c('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x32f96f[_0x764c('0x7')]?_0x32f96f[_0x764c('0x7')][_0x764c('0x14')]||null:null,'attributes':[[db[_0x764c('0x22')]['fn'](_0x764c('0x34'),db[_0x764c('0x22')]['fn']('IF',db[_0x764c('0x22')]['literal'](_0x764c('0x35')+util[_0x764c('0x36')](_0x764c('0x37'),moment()[_0x764c('0x36')](_0x764c('0x38')))+'\x20,\x201,\x20null'))),_0x764c('0x39')]]})[_0x764c('0xe')](function(_0x1af07f){logger['info'](_0x764c('0x33'),_0x32f96f);logger[_0x764c('0xf')]('CountReScheduled',_0x32f96f,JSON[_0x764c('0x17')](_0x1af07f));_0x3c19f8(_0x1af07f);})[_0x764c('0x10')](function(_0x44c423){logger[_0x764c('0x11')](_0x764c('0x33'),_0x44c423[_0x764c('0x12')],_0x32f96f);_0x36f815(_0x1239ba['error'](0x1f4,_0x44c423[_0x764c('0x12')]));});});};exports[_0x764c('0x3a')]=function(_0x5ee806){var _0x28af23=this;return new Promise(function(_0x356545,_0x49163a){return db[_0x764c('0x20')][_0x764c('0x21')]()[_0x764c('0xe')](function(){return db[_0x764c('0x22')]['transaction'](function(_0x3169a7){return db[_0x764c('0x6')][_0x764c('0x24')]({'where':_0x5ee806[_0x764c('0x7')]?_0x5ee806[_0x764c('0x7')][_0x764c('0x14')]||null:null,'attributes':_0x5ee806[_0x764c('0x7')]?_0x5ee806[_0x764c('0x7')][_0x764c('0xd')]||null:null,'limit':0x1,'order':_0x5ee806[_0x764c('0x7')]?_0x5ee806[_0x764c('0x7')][_0x764c('0x3b')]||null:null,'group':db[_0x764c('0x6')][_0x764c('0x2a')],'transaction':_0x3169a7,'lock':_0x3169a7[_0x764c('0x3c')][_0x764c('0x3d')],'include':_0x5ee806[_0x764c('0x7')]?_0x5ee806[_0x764c('0x7')][_0x764c('0xa')]?_[_0x764c('0xb')](_0x5ee806[_0x764c('0x7')][_0x764c('0xa')],function(_0x225811){return{'model':db[_0x225811['model']],'as':_0x225811['as'],'attributes':_0x225811[_0x764c('0xd')],'include':_0x225811['include']?_[_0x764c('0xb')](_0x225811[_0x764c('0xa')],function(_0x4cde7c){return{'model':db[_0x4cde7c[_0x764c('0xc')]],'as':_0x4cde7c['as'],'attributes':_0x4cde7c['attributes'],'include':_0x4cde7c[_0x764c('0xa')]?_['map'](_0x4cde7c[_0x764c('0xa')],function(_0x100a35){return{'model':db[_0x100a35[_0x764c('0xc')]],'as':_0x100a35['as'],'attributes':_0x100a35['attributes']};}):[]};}):[]};}):[]:[]})[_0x764c('0xe')](function(_0x147b8d){var _0x5d865e=[];for(var _0x5f104e=0x0;_0x5f104e<_0x147b8d['length'];_0x5f104e+=0x1){_0x5d865e[_0x764c('0x2b')](_0x147b8d[_0x5f104e][_0x764c('0x1c')](_0x5ee806[_0x764c('0x1a')],{'transaction':_0x3169a7}));}return BPromise[_0x764c('0x3e')](_0x5d865e);});})[_0x764c('0xe')](function(_0x13c5ba){logger[_0x764c('0x15')](_0x764c('0x3a'),_0x5ee806);logger[_0x764c('0xf')](_0x764c('0x3a'),_0x5ee806,JSON[_0x764c('0x17')](_0x13c5ba));_0x356545(_0x13c5ba);})[_0x764c('0x10')](function(_0x3829db){logger[_0x764c('0x11')](_0x764c('0x3a'),_0x3829db[_0x764c('0x12')],_0x5ee806);_0x49163a(_0x28af23[_0x764c('0x11')](0x1f4,_0x3829db[_0x764c('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x51a6da){var _0x568e23=this;return new Promise(function(_0x37ac80,_0x11a905){db[_0x764c('0x20')][_0x764c('0x21')]()['then'](function(_0x19e56b){return db[_0x764c('0x6')][_0x764c('0x24')]({'raw':_0x51a6da[_0x764c('0x7')]?_0x51a6da[_0x764c('0x7')][_0x764c('0x8')]===undefined?!![]:![]:!![],'where':_0x51a6da[_0x764c('0x7')]?_0x51a6da[_0x764c('0x7')][_0x764c('0x14')]||null:null,'attributes':_0x51a6da[_0x764c('0x7')]?_0x51a6da[_0x764c('0x7')][_0x764c('0xd')]||null:null,'limit':_0x51a6da[_0x764c('0x7')]?_0x51a6da[_0x764c('0x7')][_0x764c('0x9')]||null:null,'include':_0x51a6da['options']?_0x51a6da[_0x764c('0x7')][_0x764c('0xa')]?_[_0x764c('0xb')](_0x51a6da[_0x764c('0x7')]['include'],function(_0x5cc6a1){return{'model':db[_0x5cc6a1[_0x764c('0xc')]],'as':_0x5cc6a1['as'],'attributes':_0x5cc6a1['as']===_0x764c('0x25')?_[_0x764c('0x26')](_0x19e56b):_0x5cc6a1[_0x764c('0xd')],'include':_0x5cc6a1[_0x764c('0xa')]?_[_0x764c('0xb')](_0x5cc6a1[_0x764c('0xa')],function(_0x4feccb){return{'model':db[_0x4feccb[_0x764c('0xc')]],'as':_0x4feccb['as'],'attributes':_0x4feccb[_0x764c('0xd')],'include':_0x4feccb[_0x764c('0xa')]?_['map'](_0x4feccb[_0x764c('0xa')],function(_0x5a9a06){return{'model':db[_0x5a9a06[_0x764c('0xc')]],'as':_0x5a9a06['as'],'attributes':_0x5a9a06[_0x764c('0xd')]};}):[]};}):[]};}):[]:[]})[_0x764c('0xe')](function(_0x35db0b){logger[_0x764c('0x15')](_0x764c('0x5'),_0x51a6da);logger[_0x764c('0xf')](_0x764c('0x5'),_0x51a6da,JSON[_0x764c('0x17')](_0x35db0b));_0x37ac80(_0x35db0b);})[_0x764c('0x10')](function(_0x4cfe30){logger[_0x764c('0x11')](_0x764c('0x5'),_0x4cfe30[_0x764c('0x12')],_0x51a6da);_0x11a905(_0x568e23[_0x764c('0x11')](0x1f4,_0x4cfe30[_0x764c('0x12')]));});});});};exports[_0x764c('0x3f')]=function(_0x32642a){var _0x150686=this;return new Promise(function(_0x1180c8,_0xacd1bb){return db[_0x764c('0x20')]['findOne']({'raw':!![],'where':{'phone':_0x32642a[_0x764c('0x7')][_0x764c('0x14')]['phone']},'attributes':['id',_0x764c('0x40')],'order':[['id','DESC']]})[_0x764c('0xe')](function(_0x5be702){logger[_0x764c('0x15')](_0x764c('0x41'),_0x32642a);logger['debug']('getContactByPhone',_0x32642a,JSON['stringify'](_0x5be702));_0x1180c8(_0x5be702);})[_0x764c('0x10')](function(_0x4b8e0e){logger[_0x764c('0x11')]('getContactByPhone',_0x4b8e0e['message'],_0x32642a);_0xacd1bb(_0x150686['error'](0x1f4,_0x4b8e0e[_0x764c('0x12')]));});});};exports['ResetActiveCalls']=function(_0x48a5b2){var _0x15bc32=this;return new Promise(function(_0x2abe87,_0x1fd912){return db['sequelize']['transaction'](function(_0x98994b){var _0x289eb8=_0x48a5b2['options']&&_0x48a5b2[_0x764c('0x7')][_0x764c('0x14')]?_0x48a5b2[_0x764c('0x7')]['where']:{};return db[_0x764c('0x6')][_0x764c('0x1c')](_0x48a5b2[_0x764c('0x1a')],{'where':_0x289eb8,'transaction':_0x98994b})['then'](function(_0x40017b){logger['info'](_0x764c('0x42'),_0x48a5b2);logger[_0x764c('0xf')](_0x764c('0x42'),_0x48a5b2,JSON[_0x764c('0x17')](_0x40017b));_0x2abe87(_0x40017b);})['catch'](function(_0x135c4c){logger[_0x764c('0x11')](_0x764c('0x42'),_0x135c4c['message'],_0x48a5b2);_0x1fd912(_0x15bc32[_0x764c('0x11')](0x1f4,_0x135c4c[_0x764c('0x12')]));});});});};exports[_0x764c('0x43')]=function(_0x3a06c0){var _0x1ee95e=this;var _0x484e8d=_0x3a06c0[_0x764c('0x1a')][_0x764c('0x14')]['voiceQueueIds'];var _0x538ebb=_0x3a06c0[_0x764c('0x1a')]['where'][_0x764c('0x44')];var _0x411f48=_0x3a06c0['body'][_0x764c('0x14')][_0x764c('0x45')];return new Promise(function(_0x31d6aa,_0x25768e){return db[_0x764c('0x6')][_0x764c('0x24')]({'where':{'voiceQueueId':{'$in':_0x484e8d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x764c('0x46')](_0x764c('0x47')+_0x538ebb+'\x20MINUTE'),'$gt':db[_0x764c('0x22')]['literal'](_0x764c('0x48'))}},'UserId':{'$in':_0x411f48}},'include':[{'model':db[_0x764c('0x20')],'as':_0x764c('0x25')},{'model':db[_0x764c('0x27')],'as':_0x764c('0x49'),'attributes':['id',_0x764c('0x28'),_0x764c('0x29')]},{'model':db[_0x764c('0x4a')],'as':_0x764c('0x4b')}]})[_0x764c('0xe')](function(_0x51c4aa){if(_0x51c4aa[_0x764c('0x2e')]>0x0){return db[_0x764c('0x22')]['transaction'](function(_0x2350b3){return db[_0x764c('0x6')][_0x764c('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0x764c('0x46')](_0x764c('0x48'))},{'where':{'id':{'$in':_[_0x764c('0xb')](_0x51c4aa,'id')}},'transaction':_0x2350b3})[_0x764c('0xe')](function(){_0x31d6aa(_0x51c4aa);})[_0x764c('0x10')](function(_0x2253cf){logger[_0x764c('0x11')](_0x764c('0x43'),_0x2253cf[_0x764c('0x12')],_0x3a06c0);_0x25768e(_0x1ee95e['error'](0x1f4,_0x2253cf[_0x764c('0x12')]));});})[_0x764c('0x10')](function(_0x4169bb){logger[_0x764c('0x11')](_0x764c('0x43'),_0x4169bb['message'],_0x3a06c0);_0x25768e(_0x1ee95e[_0x764c('0x11')](0x1f4,_0x4169bb[_0x764c('0x12')]));});}else{_0x31d6aa(_0x51c4aa);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7829c2b..4e5c401 100644 --- a/server/api/cmHopper/index.js +++ b/server/api/cmHopper/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf2=['describe','/opencontacts','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update','delete','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe'];(function(_0x1dca5e,_0xb443aa){var _0x2bdf1a=function(_0xbe123c){while(--_0xbe123c){_0x1dca5e['push'](_0x1dca5e['shift']());}};_0x2bdf1a(++_0xb443aa);}(_0xacf2,0x7d));var _0x2acf=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0xacf2[_0x7c0074];return _0x13e95b;};'use strict';var express=require('express');var router=express[_0x2acf('0x0')]();var auth=require(_0x2acf('0x1'));var controller=require(_0x2acf('0x2'));router[_0x2acf('0x3')]('/',auth[_0x2acf('0x4')](),controller[_0x2acf('0x5')]);router[_0x2acf('0x3')](_0x2acf('0x6'),auth['isAuthenticated'](),controller[_0x2acf('0x7')]);router[_0x2acf('0x3')](_0x2acf('0x8'),auth[_0x2acf('0x4')](),controller['getOpenContacts']);router[_0x2acf('0x3')]('/timezones',auth[_0x2acf('0x4')](),controller['getTimezones']);router[_0x2acf('0x3')](_0x2acf('0x9'),auth[_0x2acf('0x4')](),controller['show']);router[_0x2acf('0x3')](_0x2acf('0xa'),auth[_0x2acf('0x4')](),controller[_0x2acf('0xb')]);router[_0x2acf('0xc')]('/',auth[_0x2acf('0x4')](),controller[_0x2acf('0xd')]);router[_0x2acf('0xc')](_0x2acf('0xe'),auth[_0x2acf('0x4')](),controller[_0x2acf('0xf')]);router[_0x2acf('0xc')](_0x2acf('0x10'),auth[_0x2acf('0x4')](),controller[_0x2acf('0x11')]);router[_0x2acf('0x12')](_0x2acf('0x9'),auth[_0x2acf('0x4')](),controller[_0x2acf('0x13')]);router[_0x2acf('0x14')](_0x2acf('0x9'),auth[_0x2acf('0x4')](),controller['destroy']);module[_0x2acf('0x15')]=router; \ No newline at end of file +var _0x84da=['delete','../../components/auth/service','isAuthenticated','/describe','describe','get','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','post','/preview','getPreview','/timezone','getTimezone','update'];(function(_0x4d0686,_0x101362){var _0x487848=function(_0x1dcfde){while(--_0x1dcfde){_0x4d0686['push'](_0x4d0686['shift']());}};_0x487848(++_0x101362);}(_0x84da,0x10b));var _0xa84d=function(_0x5a2162,_0x5a90a3){_0x5a2162=_0x5a2162-0x0;var _0x4561a7=_0x84da[_0x5a2162];return _0x4561a7;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa84d('0x0'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0xa84d('0x1')](),controller['index']);router['get'](_0xa84d('0x2'),auth[_0xa84d('0x1')](),controller[_0xa84d('0x3')]);router[_0xa84d('0x4')](_0xa84d('0x5'),auth['isAuthenticated'](),controller[_0xa84d('0x6')]);router[_0xa84d('0x4')](_0xa84d('0x7'),auth['isAuthenticated'](),controller[_0xa84d('0x8')]);router[_0xa84d('0x4')](_0xa84d('0x9'),auth[_0xa84d('0x1')](),controller[_0xa84d('0xa')]);router['get'](_0xa84d('0xb'),auth[_0xa84d('0x1')](),controller['getPreviewRecall']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa84d('0xc')](_0xa84d('0xd'),auth[_0xa84d('0x1')](),controller[_0xa84d('0xe')]);router[_0xa84d('0xc')](_0xa84d('0xf'),auth[_0xa84d('0x1')](),controller[_0xa84d('0x10')]);router['put'](_0xa84d('0x9'),auth[_0xa84d('0x1')](),controller[_0xa84d('0x11')]);router[_0xa84d('0x12')]('/:id',auth[_0xa84d('0x1')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 4c3ee32..febb2b9 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4810=['moment','sequelize','exports','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4810,0xf8));var _0x0481=function(_0x321ed0,_0x54bf5c){_0x321ed0=_0x321ed0-0x0;var _0x381d48=_0x4810[_0x321ed0];return _0x381d48;};'use strict';var moment=require(_0x0481('0x0'));var Sequelize=require(_0x0481('0x1'));module[_0x0481('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x0481('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0481('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0481('0x5')],'defaultValue':moment()[_0x0481('0x6')](_0x0481('0x7'))},'countbusyretry':{'type':Sequelize[_0x0481('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0481('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0481('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0481('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0481('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0481('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6879=['moment','sequelize','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x13bcff,_0x5d839f){var _0x13acd8=function(_0x199c45){while(--_0x199c45){_0x13bcff['push'](_0x13bcff['shift']());}};_0x13acd8(++_0x5d839f);}(_0x6879,0x69));var _0x9687=function(_0x57bf02,_0x2b75be){_0x57bf02=_0x57bf02-0x0;var _0x27fba8=_0x6879[_0x57bf02];return _0x27fba8;};'use strict';var moment=require(_0x9687('0x0'));var Sequelize=require(_0x9687('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x9687('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9687('0x3')],'defaultValue':moment()[_0x9687('0x4')](_0x9687('0x5'))},'countbusyretry':{'type':Sequelize[_0x9687('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9687('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9687('0x6')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9687('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9687('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9687('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9687('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index fc5d473..31d70cc 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb350=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xb350,0x1e0));var _0x0b35=function(_0x37006f,_0x42fe69){_0x37006f=_0x37006f-0x0;var _0x13653a=_0xb350[_0x37006f];return _0x13653a;};'use strict';var emlformat=require(_0x0b35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b35('0x1'));var jsonpatch=require(_0x0b35('0x2'));var rp=require(_0x0b35('0x3'));var moment=require(_0x0b35('0x4'));var BPromise=require(_0x0b35('0x5'));var Mustache=require('mustache');var util=require(_0x0b35('0x6'));var path=require(_0x0b35('0x7'));var sox=require(_0x0b35('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b35('0x9'));var _=require('lodash');var squel=require(_0x0b35('0xa'));var crypto=require('crypto');var jsforce=require(_0x0b35('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0b35('0xc'));var querystring=require(_0x0b35('0xd'));var Papa=require(_0x0b35('0xe'));var Redis=require(_0x0b35('0xf'));var authService=require(_0x0b35('0x10'));var qs=require(_0x0b35('0x11'));var as=require(_0x0b35('0x12'));var hardwareService=require(_0x0b35('0x13'));var logger=require(_0x0b35('0x14'))(_0x0b35('0x15'));var utils=require(_0x0b35('0x16'));var config=require(_0x0b35('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b35('0x18'))['db'];function respondWithStatusCode(_0x2aeddb,_0x3e5a31){_0x3e5a31=_0x3e5a31||0xcc;return function(_0x298d98){if(_0x298d98){return _0x2aeddb[_0x0b35('0x19')](_0x3e5a31);}return _0x2aeddb[_0x0b35('0x1a')](_0x3e5a31)[_0x0b35('0x1b')]();};}function respondWithResult(_0x3e907e,_0x5e559b){_0x5e559b=_0x5e559b||0xc8;return function(_0x57ffc5){if(_0x57ffc5){return _0x3e907e[_0x0b35('0x1a')](_0x5e559b)[_0x0b35('0x1c')](_0x57ffc5);}};}function respondWithFilteredResult(_0x46f46f,_0x37bc13){return function(_0x2051b3){if(_0x2051b3){var _0x3c2e5a=typeof _0x37bc13[_0x0b35('0x1d')]===_0x0b35('0x1e')&&typeof _0x37bc13[_0x0b35('0x1f')]===_0x0b35('0x1e');var _0x2fc77f=_0x2051b3[_0x0b35('0x20')];var _0x3af1b4=_0x3c2e5a?0x0:_0x37bc13[_0x0b35('0x1d')];var _0x438f15=_0x3c2e5a?_0x2051b3[_0x0b35('0x20')]:_0x37bc13['offset']+_0x37bc13[_0x0b35('0x1f')];var _0x1e4eb6;if(_0x438f15>=_0x2fc77f){_0x438f15=_0x2fc77f;_0x1e4eb6=0xc8;}else{_0x1e4eb6=0xce;}_0x46f46f['status'](_0x1e4eb6);return _0x46f46f[_0x0b35('0x21')](_0x0b35('0x22'),_0x3af1b4+'-'+_0x438f15+'/'+_0x2fc77f)[_0x0b35('0x1c')](_0x2051b3);}return null;};}function patchUpdates(_0x35dff1){return function(_0x58eaf1){try{jsonpatch['apply'](_0x58eaf1,_0x35dff1,!![]);}catch(_0x5bd9c6){return BPromise['reject'](_0x5bd9c6);}return _0x58eaf1[_0x0b35('0x23')]();};}function saveUpdates(_0x3c3f7f,_0x1cce09){return function(_0x21fa2d){if(_0x21fa2d){return _0x21fa2d[_0x0b35('0x24')](_0x3c3f7f)[_0x0b35('0x25')](function(_0x2894db){return _0x2894db;});}return null;};}function removeEntity(_0x4b4871,_0x29330d){return function(_0x2313b3){if(_0x2313b3){return _0x2313b3[_0x0b35('0x26')]()['then'](function(){var _0x3a69a0=_0x2313b3[_0x0b35('0x27')]({'plain':!![]});var _0x76fb25=_0x0b35('0x28');return db[_0x0b35('0x29')][_0x0b35('0x26')]({'where':{'type':_0x76fb25,'resourceId':_0x3a69a0['id']}})['then'](function(){return _0x2313b3;});})[_0x0b35('0x25')](function(){_0x4b4871[_0x0b35('0x1a')](0xcc)[_0x0b35('0x1b')]();});}};}function handleEntityNotFound(_0x54e3f2,_0x4641a0){return function(_0x23e455){if(!_0x23e455){_0x54e3f2[_0x0b35('0x19')](0x194);}return _0x23e455;};}function handleError(_0x29ded4,_0x5b4b41){_0x5b4b41=_0x5b4b41||0x1f4;return function(_0x4bbbd0){logger[_0x0b35('0x2a')](_0x4bbbd0['stack']);if(_0x4bbbd0[_0x0b35('0x2b')]){delete _0x4bbbd0[_0x0b35('0x2b')];}_0x29ded4[_0x0b35('0x1a')](_0x5b4b41)[_0x0b35('0x2c')](_0x4bbbd0);};}exports['index']=function(_0x28c79c,_0x1e40b5){var _0x5d6ba0={},_0x1255a5={},_0x579e7c={'count':0x0,'rows':[]};var _0x4922e5=_[_0x0b35('0x2d')](db[_0x0b35('0x2e')][_0x0b35('0x2f')],function(_0x4674b8){return{'name':_0x4674b8[_0x0b35('0x30')],'type':_0x4674b8[_0x0b35('0x31')][_0x0b35('0x32')]};});_0x1255a5[_0x0b35('0x33')]=_[_0x0b35('0x2d')](_0x4922e5,_0x0b35('0x2b'));_0x1255a5[_0x0b35('0x34')]=_[_0x0b35('0x35')](_0x28c79c[_0x0b35('0x34')]);_0x1255a5[_0x0b35('0x36')]=_[_0x0b35('0x37')](_0x1255a5[_0x0b35('0x33')],_0x1255a5[_0x0b35('0x34')]);_0x5d6ba0[_0x0b35('0x38')]=_[_0x0b35('0x37')](_0x1255a5[_0x0b35('0x33')],qs[_0x0b35('0x39')](_0x28c79c['query'][_0x0b35('0x39')]));_0x5d6ba0[_0x0b35('0x38')]=_0x5d6ba0[_0x0b35('0x38')][_0x0b35('0x3a')]?_0x5d6ba0[_0x0b35('0x38')]:_0x1255a5['model'];if(!_0x28c79c[_0x0b35('0x34')]['hasOwnProperty'](_0x0b35('0x3b'))){_0x5d6ba0['limit']=qs['limit'](_0x28c79c[_0x0b35('0x34')][_0x0b35('0x1f')]);_0x5d6ba0['offset']=qs[_0x0b35('0x1d')](_0x28c79c[_0x0b35('0x34')][_0x0b35('0x1d')]);}_0x5d6ba0[_0x0b35('0x3c')]=qs[_0x0b35('0x3d')](_0x28c79c[_0x0b35('0x34')][_0x0b35('0x3d')]);_0x5d6ba0[_0x0b35('0x3e')]=qs['filters'](_[_0x0b35('0x3f')](_0x28c79c[_0x0b35('0x34')],_0x1255a5[_0x0b35('0x36')]),_0x4922e5);if(_0x28c79c[_0x0b35('0x34')][_0x0b35('0x40')]){_0x5d6ba0[_0x0b35('0x3e')]=_[_0x0b35('0x41')](_0x5d6ba0[_0x0b35('0x3e')],{'$or':_['map'](_0x4922e5,function(_0x5b9797){if(_0x5b9797[_0x0b35('0x31')]!==_0x0b35('0x42')){var _0xbf4596={};_0xbf4596[_0x5b9797['name']]={'$like':'%'+_0x28c79c[_0x0b35('0x34')]['filter']+'%'};return _0xbf4596;}})});}_0x5d6ba0=_['merge']({},_0x5d6ba0,_0x28c79c[_0x0b35('0x43')]);var _0x2686d4={'where':_0x5d6ba0[_0x0b35('0x3e')]};return db[_0x0b35('0x2e')]['count'](_0x2686d4)[_0x0b35('0x25')](function(_0x24503b){_0x579e7c[_0x0b35('0x20')]=_0x24503b;if(_0x28c79c[_0x0b35('0x34')][_0x0b35('0x44')]){_0x5d6ba0['include']=[{'all':!![]}];}return db[_0x0b35('0x2e')]['findAll'](_0x5d6ba0);})['then'](function(_0x4f9aec){_0x579e7c[_0x0b35('0x45')]=_0x4f9aec;return _0x579e7c;})[_0x0b35('0x25')](respondWithFilteredResult(_0x1e40b5,_0x5d6ba0))[_0x0b35('0x46')](handleError(_0x1e40b5,null));};exports[_0x0b35('0x47')]=function(_0x5e18c3,_0x4fb8c2){var _0x4d9a91={'raw':!![],'where':{'id':_0x5e18c3['params']['id']}},_0x50563f={};_0x50563f[_0x0b35('0x33')]=_[_0x0b35('0x35')](db[_0x0b35('0x2e')][_0x0b35('0x2f')]);_0x50563f[_0x0b35('0x34')]=_[_0x0b35('0x35')](_0x5e18c3[_0x0b35('0x34')]);_0x50563f[_0x0b35('0x36')]=_[_0x0b35('0x37')](_0x50563f[_0x0b35('0x33')],_0x50563f[_0x0b35('0x34')]);_0x4d9a91[_0x0b35('0x38')]=_[_0x0b35('0x37')](_0x50563f[_0x0b35('0x33')],qs['fields'](_0x5e18c3[_0x0b35('0x34')][_0x0b35('0x39')]));_0x4d9a91[_0x0b35('0x38')]=_0x4d9a91[_0x0b35('0x38')]['length']?_0x4d9a91[_0x0b35('0x38')]:_0x50563f[_0x0b35('0x33')];if(_0x5e18c3[_0x0b35('0x34')][_0x0b35('0x44')]){_0x4d9a91[_0x0b35('0x48')]=[{'all':!![]}];}_0x4d9a91=_['merge']({},_0x4d9a91,_0x5e18c3[_0x0b35('0x43')]);return db[_0x0b35('0x2e')]['find'](_0x4d9a91)[_0x0b35('0x25')](handleEntityNotFound(_0x4fb8c2,null))[_0x0b35('0x25')](respondWithResult(_0x4fb8c2,null))[_0x0b35('0x46')](handleError(_0x4fb8c2,null));};exports[_0x0b35('0x49')]=function(_0x3e6a44,_0x4e9753){return db[_0x0b35('0x2e')][_0x0b35('0x49')](_0x3e6a44[_0x0b35('0x4a')],{})[_0x0b35('0x25')](function(_0x5eeaf9){var _0xcfcd9f=_0x3e6a44[_0x0b35('0x4b')]['get']({'plain':!![]});if(!_0xcfcd9f)throw new Error(_0x0b35('0x4c'));if(_0xcfcd9f[_0x0b35('0x4d')]===_0x0b35('0x4b')){var _0x2d6ab8=_0x5eeaf9[_0x0b35('0x27')]({'plain':!![]});var _0x1916f0=_0x0b35('0x28');return db[_0x0b35('0x4e')][_0x0b35('0x4f')]({'where':{'name':_0x1916f0,'userProfileId':_0xcfcd9f[_0x0b35('0x50')]},'raw':!![]})[_0x0b35('0x25')](function(_0x44583a){if(_0x44583a&&_0x44583a[_0x0b35('0x51')]===0x0){return db[_0x0b35('0x29')][_0x0b35('0x49')]({'name':_0x2d6ab8['name'],'resourceId':_0x2d6ab8['id'],'type':_0x44583a[_0x0b35('0x2b')],'sectionId':_0x44583a['id']},{})[_0x0b35('0x25')](function(){return _0x5eeaf9;});}else{return _0x5eeaf9;}})['catch'](function(_0xbbb07e){logger[_0x0b35('0x2a')](_0x0b35('0x52'),_0xbbb07e);throw _0xbbb07e;});}return _0x5eeaf9;})['then'](respondWithResult(_0x4e9753,0xc9))[_0x0b35('0x46')](handleError(_0x4e9753,null));};exports['update']=function(_0x523d2e,_0x4ea75d){if(_0x523d2e[_0x0b35('0x4a')]['id']){delete _0x523d2e[_0x0b35('0x4a')]['id'];}return db[_0x0b35('0x2e')][_0x0b35('0x4f')]({'where':{'id':_0x523d2e[_0x0b35('0x53')]['id']}})[_0x0b35('0x25')](handleEntityNotFound(_0x4ea75d,null))[_0x0b35('0x25')](saveUpdates(_0x523d2e[_0x0b35('0x4a')],null))['then'](respondWithResult(_0x4ea75d,null))[_0x0b35('0x46')](handleError(_0x4ea75d,null));};exports[_0x0b35('0x26')]=function(_0x254ff5,_0x506368){return db[_0x0b35('0x2e')][_0x0b35('0x4f')]({'where':{'id':_0x254ff5[_0x0b35('0x53')]['id']}})[_0x0b35('0x25')](handleEntityNotFound(_0x506368,null))[_0x0b35('0x25')](removeEntity(_0x506368,null))[_0x0b35('0x46')](handleError(_0x506368,null));}; \ No newline at end of file +var _0xe164=['fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','get','CmHopperAdditionalPhones','UserProfileResource','then','error','stack','name','send','map','CmHopperAdditionalPhone','fieldName','key','model','query','keys','filters','intersection'];(function(_0x539555,_0x59fbf5){var _0x3394dc=function(_0x4e76dc){while(--_0x4e76dc){_0x539555['push'](_0x539555['shift']());}};_0x3394dc(++_0x59fbf5);}(_0xe164,0x176));var _0x4e16=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xe164[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x4e16('0x0'));var rimraf=require(_0x4e16('0x1'));var zipdir=require(_0x4e16('0x2'));var jsonpatch=require(_0x4e16('0x3'));var rp=require(_0x4e16('0x4'));var moment=require(_0x4e16('0x5'));var BPromise=require(_0x4e16('0x6'));var Mustache=require('mustache');var util=require(_0x4e16('0x7'));var path=require(_0x4e16('0x8'));var sox=require(_0x4e16('0x9'));var csv=require(_0x4e16('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e16('0xb'));var _=require(_0x4e16('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e16('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4e16('0xa'));var querystring=require(_0x4e16('0xe'));var Papa=require(_0x4e16('0xf'));var Redis=require(_0x4e16('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4e16('0x11'));var as=require(_0x4e16('0x12'));var hardwareService=require(_0x4e16('0x13'));var logger=require(_0x4e16('0x14'))('api');var utils=require(_0x4e16('0x15'));var config=require(_0x4e16('0x16'));var licenseUtil=require(_0x4e16('0x17'));var db=require(_0x4e16('0x18'))['db'];function respondWithStatusCode(_0x1a057d,_0x255bf7){_0x255bf7=_0x255bf7||0xcc;return function(_0x497293){if(_0x497293){return _0x1a057d[_0x4e16('0x19')](_0x255bf7);}return _0x1a057d[_0x4e16('0x1a')](_0x255bf7)[_0x4e16('0x1b')]();};}function respondWithResult(_0x3f28e8,_0x2581c1){_0x2581c1=_0x2581c1||0xc8;return function(_0x5cd1cf){if(_0x5cd1cf){return _0x3f28e8[_0x4e16('0x1a')](_0x2581c1)['json'](_0x5cd1cf);}};}function respondWithFilteredResult(_0x589aeb,_0x163d57){return function(_0x550ae4){if(_0x550ae4){var _0x472a29=typeof _0x163d57[_0x4e16('0x1c')]===_0x4e16('0x1d')&&typeof _0x163d57[_0x4e16('0x1e')]===_0x4e16('0x1d');var _0x25d893=_0x550ae4['count'];var _0x16447a=_0x472a29?0x0:_0x163d57[_0x4e16('0x1c')];var _0x28e57c=_0x472a29?_0x550ae4[_0x4e16('0x1f')]:_0x163d57['offset']+_0x163d57[_0x4e16('0x1e')];var _0x32dc4e;if(_0x28e57c>=_0x25d893){_0x28e57c=_0x25d893;_0x32dc4e=0xc8;}else{_0x32dc4e=0xce;}_0x589aeb[_0x4e16('0x1a')](_0x32dc4e);return _0x589aeb[_0x4e16('0x20')](_0x4e16('0x21'),_0x16447a+'-'+_0x28e57c+'/'+_0x25d893)[_0x4e16('0x22')](_0x550ae4);}return null;};}function patchUpdates(_0x1c2dab){return function(_0x1bd971){try{jsonpatch[_0x4e16('0x23')](_0x1bd971,_0x1c2dab,!![]);}catch(_0x585461){return BPromise[_0x4e16('0x24')](_0x585461);}return _0x1bd971[_0x4e16('0x25')]();};}function saveUpdates(_0x2fe452,_0x60a6cf){return function(_0x41a5a2){if(_0x41a5a2){return _0x41a5a2['update'](_0x2fe452)['then'](function(_0x4c5817){return _0x4c5817;});}return null;};}function removeEntity(_0x174fe6,_0x19477e){return function(_0x4a68b6){if(_0x4a68b6){return _0x4a68b6[_0x4e16('0x26')]()['then'](function(){var _0xbac580=_0x4a68b6[_0x4e16('0x27')]({'plain':!![]});var _0x5b2b6c=_0x4e16('0x28');return db[_0x4e16('0x29')][_0x4e16('0x26')]({'where':{'type':_0x5b2b6c,'resourceId':_0xbac580['id']}})[_0x4e16('0x2a')](function(){return _0x4a68b6;});})[_0x4e16('0x2a')](function(){_0x174fe6[_0x4e16('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b084,_0x56e5b2){return function(_0x44d216){if(!_0x44d216){_0x49b084['sendStatus'](0x194);}return _0x44d216;};}function handleError(_0x4a3887,_0x53d6c4){_0x53d6c4=_0x53d6c4||0x1f4;return function(_0x371754){logger[_0x4e16('0x2b')](_0x371754[_0x4e16('0x2c')]);if(_0x371754[_0x4e16('0x2d')]){delete _0x371754['name'];}_0x4a3887[_0x4e16('0x1a')](_0x53d6c4)[_0x4e16('0x2e')](_0x371754);};}exports['index']=function(_0x29cc6d,_0x5bff18){var _0x44b652={},_0x423b32={},_0x22de7d={'count':0x0,'rows':[]};var _0x1ed60c=_[_0x4e16('0x2f')](db[_0x4e16('0x30')]['rawAttributes'],function(_0x365456){return{'name':_0x365456[_0x4e16('0x31')],'type':_0x365456['type'][_0x4e16('0x32')]};});_0x423b32[_0x4e16('0x33')]=_[_0x4e16('0x2f')](_0x1ed60c,_0x4e16('0x2d'));_0x423b32[_0x4e16('0x34')]=_[_0x4e16('0x35')](_0x29cc6d[_0x4e16('0x34')]);_0x423b32[_0x4e16('0x36')]=_[_0x4e16('0x37')](_0x423b32[_0x4e16('0x33')],_0x423b32['query']);_0x44b652['attributes']=_['intersection'](_0x423b32[_0x4e16('0x33')],qs[_0x4e16('0x38')](_0x29cc6d[_0x4e16('0x34')][_0x4e16('0x38')]));_0x44b652[_0x4e16('0x39')]=_0x44b652['attributes']['length']?_0x44b652[_0x4e16('0x39')]:_0x423b32['model'];if(!_0x29cc6d['query'][_0x4e16('0x3a')](_0x4e16('0x3b'))){_0x44b652[_0x4e16('0x1e')]=qs[_0x4e16('0x1e')](_0x29cc6d[_0x4e16('0x34')][_0x4e16('0x1e')]);_0x44b652[_0x4e16('0x1c')]=qs[_0x4e16('0x1c')](_0x29cc6d['query'][_0x4e16('0x1c')]);}_0x44b652['order']=qs[_0x4e16('0x3c')](_0x29cc6d[_0x4e16('0x34')][_0x4e16('0x3c')]);_0x44b652[_0x4e16('0x3d')]=qs[_0x4e16('0x36')](_[_0x4e16('0x3e')](_0x29cc6d[_0x4e16('0x34')],_0x423b32[_0x4e16('0x36')]),_0x1ed60c);if(_0x29cc6d[_0x4e16('0x34')][_0x4e16('0x3f')]){_0x44b652[_0x4e16('0x3d')]=_[_0x4e16('0x40')](_0x44b652[_0x4e16('0x3d')],{'$or':_[_0x4e16('0x2f')](_0x1ed60c,function(_0x3ac387){if(_0x3ac387['type']!==_0x4e16('0x41')){var _0x5ac2e1={};_0x5ac2e1[_0x3ac387[_0x4e16('0x2d')]]={'$like':'%'+_0x29cc6d['query']['filter']+'%'};return _0x5ac2e1;}})});}_0x44b652=_[_0x4e16('0x40')]({},_0x44b652,_0x29cc6d['options']);var _0x216ce0={'where':_0x44b652[_0x4e16('0x3d')]};return db[_0x4e16('0x30')][_0x4e16('0x1f')](_0x216ce0)['then'](function(_0x3fd787){_0x22de7d[_0x4e16('0x1f')]=_0x3fd787;if(_0x29cc6d['query'][_0x4e16('0x42')]){_0x44b652[_0x4e16('0x43')]=[{'all':!![]}];}return db[_0x4e16('0x30')][_0x4e16('0x44')](_0x44b652);})[_0x4e16('0x2a')](function(_0x325308){_0x22de7d[_0x4e16('0x45')]=_0x325308;return _0x22de7d;})['then'](respondWithFilteredResult(_0x5bff18,_0x44b652))['catch'](handleError(_0x5bff18,null));};exports['show']=function(_0x1975dc,_0xb3027c){var _0x39d4fc={'raw':!![],'where':{'id':_0x1975dc[_0x4e16('0x46')]['id']}},_0xab698={};_0xab698[_0x4e16('0x33')]=_[_0x4e16('0x35')](db[_0x4e16('0x30')][_0x4e16('0x47')]);_0xab698['query']=_[_0x4e16('0x35')](_0x1975dc[_0x4e16('0x34')]);_0xab698[_0x4e16('0x36')]=_[_0x4e16('0x37')](_0xab698[_0x4e16('0x33')],_0xab698[_0x4e16('0x34')]);_0x39d4fc[_0x4e16('0x39')]=_[_0x4e16('0x37')](_0xab698['model'],qs['fields'](_0x1975dc['query'][_0x4e16('0x38')]));_0x39d4fc['attributes']=_0x39d4fc['attributes'][_0x4e16('0x48')]?_0x39d4fc[_0x4e16('0x39')]:_0xab698[_0x4e16('0x33')];if(_0x1975dc[_0x4e16('0x34')]['includeAll']){_0x39d4fc[_0x4e16('0x43')]=[{'all':!![]}];}_0x39d4fc=_[_0x4e16('0x40')]({},_0x39d4fc,_0x1975dc[_0x4e16('0x49')]);return db[_0x4e16('0x30')][_0x4e16('0x4a')](_0x39d4fc)[_0x4e16('0x2a')](handleEntityNotFound(_0xb3027c,null))['then'](respondWithResult(_0xb3027c,null))[_0x4e16('0x4b')](handleError(_0xb3027c,null));};exports[_0x4e16('0x4c')]=function(_0x1efd04,_0x484d2b){return db[_0x4e16('0x30')][_0x4e16('0x4c')](_0x1efd04[_0x4e16('0x4d')],{})[_0x4e16('0x2a')](function(_0x5b30ce){var _0x1526d4=_0x1efd04[_0x4e16('0x4e')][_0x4e16('0x27')]({'plain':!![]});if(!_0x1526d4)throw new Error(_0x4e16('0x4f'));if(_0x1526d4[_0x4e16('0x50')]===_0x4e16('0x4e')){var _0x48d96b=_0x5b30ce[_0x4e16('0x27')]({'plain':!![]});var _0x39d521=_0x4e16('0x28');return db[_0x4e16('0x51')][_0x4e16('0x4a')]({'where':{'name':_0x39d521,'userProfileId':_0x1526d4[_0x4e16('0x52')]},'raw':!![]})[_0x4e16('0x2a')](function(_0x1d07d1){if(_0x1d07d1&&_0x1d07d1[_0x4e16('0x53')]===0x0){return db[_0x4e16('0x29')][_0x4e16('0x4c')]({'name':_0x48d96b[_0x4e16('0x2d')],'resourceId':_0x48d96b['id'],'type':_0x1d07d1[_0x4e16('0x2d')],'sectionId':_0x1d07d1['id']},{})['then'](function(){return _0x5b30ce;});}else{return _0x5b30ce;}})['catch'](function(_0x4db353){logger[_0x4e16('0x2b')](_0x4e16('0x54'),_0x4db353);throw _0x4db353;});}return _0x5b30ce;})['then'](respondWithResult(_0x484d2b,0xc9))['catch'](handleError(_0x484d2b,null));};exports[_0x4e16('0x55')]=function(_0x508f91,_0x274209){if(_0x508f91[_0x4e16('0x4d')]['id']){delete _0x508f91[_0x4e16('0x4d')]['id'];}return db[_0x4e16('0x30')]['find']({'where':{'id':_0x508f91[_0x4e16('0x46')]['id']}})['then'](handleEntityNotFound(_0x274209,null))[_0x4e16('0x2a')](saveUpdates(_0x508f91[_0x4e16('0x4d')],null))[_0x4e16('0x2a')](respondWithResult(_0x274209,null))[_0x4e16('0x4b')](handleError(_0x274209,null));};exports[_0x4e16('0x26')]=function(_0x274124,_0x216668){return db[_0x4e16('0x30')][_0x4e16('0x4a')]({'where':{'id':_0x274124[_0x4e16('0x46')]['id']}})[_0x4e16('0x2a')](handleEntityNotFound(_0x216668,null))[_0x4e16('0x2a')](removeEntity(_0x216668,null))[_0x4e16('0x4b')](handleError(_0x216668,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 670926b..d1dfe7a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3277=['cm_hopper_additional_phones','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x3277,0x16c));var _0x7327=function(_0x18a331,_0x3afb3a){_0x18a331=_0x18a331-0x0;var _0xcd24c8=_0x3277[_0x18a331];return _0xcd24c8;};'use strict';var _=require('lodash');var util=require(_0x7327('0x0'));var logger=require(_0x7327('0x1'))(_0x7327('0x2'));var moment=require(_0x7327('0x3'));var BPromise=require(_0x7327('0x4'));var rp=require(_0x7327('0x5'));var fs=require('fs');var path=require(_0x7327('0x6'));var rimraf=require('rimraf');var config=require(_0x7327('0x7'));var attributes=require(_0x7327('0x8'));module[_0x7327('0x9')]=function(_0x22f28a,_0x3f741f){return _0x22f28a['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0x7327('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x351d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x353560,_0x291ed8){var _0x56e1ce=function(_0x4e474d){while(--_0x4e474d){_0x353560['push'](_0x353560['shift']());}};_0x56e1ce(++_0x291ed8);}(_0x351d,0x137));var _0xd351=function(_0x162b8f,_0x511d5f){_0x162b8f=_0x162b8f-0x0;var _0x3d8305=_0x351d[_0x162b8f];return _0x3d8305;};'use strict';var _=require(_0xd351('0x0'));var util=require(_0xd351('0x1'));var logger=require(_0xd351('0x2'))(_0xd351('0x3'));var moment=require(_0xd351('0x4'));var BPromise=require(_0xd351('0x5'));var rp=require(_0xd351('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x7'));var config=require('../../config/environment');var attributes=require(_0xd351('0x8'));module['exports']=function(_0x3c9939,_0x5657e4){return _0x3c9939[_0xd351('0x9')](_0xd351('0xa'),attributes,{'tableName':_0xd351('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index ec90fd1..d19561e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61ee=['add','minutes','phone','countagentrejectretry','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countbusyretry','catch','SwapAdditionalPhones','ContactId','waitTime','duration','isNil','scheduledat'];(function(_0x2e33d3,_0x4375d2){var _0x5cd87d=function(_0x2ae53c){while(--_0x2ae53c){_0x2e33d3['push'](_0x2e33d3['shift']());}};_0x5cd87d(++_0x4375d2);}(_0x61ee,0xee));var _0xe61e=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x61ee[_0x51e79c];return _0x2467be;};'use strict';var _=require('lodash');var util=require(_0xe61e('0x0'));var moment=require(_0xe61e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe61e('0x2'));var db=require(_0xe61e('0x3'))['db'];var utils=require(_0xe61e('0x4'));var logger=require(_0xe61e('0x5'))('rpc');var config=require(_0xe61e('0x6'));var jayson=require(_0xe61e('0x7'));var client=jayson[_0xe61e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfdf6,_0x5019bf,_0x3aecd6){return new BPromise(function(_0x3a109a,_0x4ac5ea){return client[_0xe61e('0x9')](_0x5bfdf6,_0x3aecd6)[_0xe61e('0xa')](function(_0x1e241c){logger['info'](_0xe61e('0xb'),_0x5019bf,'request\x20sent');logger[_0xe61e('0xc')](_0xe61e('0xd'),_0x5019bf,_0xe61e('0xe'),JSON[_0xe61e('0xf')](_0x1e241c));if(_0x1e241c['error']){if(_0x1e241c[_0xe61e('0x10')][_0xe61e('0x11')]===0x1f4){logger[_0xe61e('0x10')](_0xe61e('0xb'),_0x5019bf,_0x1e241c[_0xe61e('0x10')][_0xe61e('0x12')]);return _0x4ac5ea(_0x1e241c['error']['message']);}logger[_0xe61e('0x10')](_0xe61e('0xb'),_0x5019bf,_0x1e241c['error'][_0xe61e('0x12')]);return _0x3a109a(_0x1e241c[_0xe61e('0x10')][_0xe61e('0x12')]);}else{logger[_0xe61e('0x13')](_0xe61e('0xb'),_0x5019bf,_0xe61e('0xe'));_0x3a109a(_0x1e241c[_0xe61e('0x14')]['message']);}})['catch'](function(_0x40692e){logger[_0xe61e('0x10')](_0xe61e('0xb'),_0x5019bf,_0x40692e);_0x4ac5ea(_0x40692e);});});}exports[_0xe61e('0x15')]=function(_0x235939){var _0x34d1d6=this;return new Promise(function(_0x159d67,_0x516ea4){return db[_0xe61e('0x16')][_0xe61e('0x17')]({'raw':!![],'where':{'ContactId':_0x235939['body']['ContactId'],'ListId':_0x235939[_0xe61e('0x18')][_0xe61e('0x19')],'VoiceQueueId':_0x235939[_0xe61e('0x18')][_0xe61e('0x1a')]===undefined?null:_0x235939[_0xe61e('0x18')][_0xe61e('0x1a')],'CampaignId':_0x235939[_0xe61e('0x18')][_0xe61e('0x1b')]===undefined?null:_0x235939['body'][_0xe61e('0x1b')]}})['then'](function(_0x233e19){if(_0x233e19!=null){return db[_0xe61e('0x1c')][_0xe61e('0x17')]({'raw':!![],'where':{'CmHopperId':_0x233e19['id'],'OrderBy':{'$gt':_0x233e19[_0xe61e('0x1d')]}},'order':[['OrderBy',_0xe61e('0x1e')]]})[_0xe61e('0xa')](function(_0x2b8ea8){var _0xe45112=0x0;if(_0x2b8ea8){if(_0x2b8ea8['countbusyretry']+_0x2b8ea8[_0xe61e('0x1f')]+_0x2b8ea8[_0xe61e('0x20')]+_0x2b8ea8[_0xe61e('0x21')]+_0x2b8ea8[_0xe61e('0x22')]+_0x2b8ea8[_0xe61e('0x23')]+_0x2b8ea8[_0xe61e('0x24')]+_0x2b8ea8['countagentrejectretry']<_0x235939[_0xe61e('0x25')][_0xe61e('0x26')])_0xe45112=0x1;_0x159d67({'additional':_0xe45112});}else{return db[_0xe61e('0x1c')][_0xe61e('0x17')]({'raw':!![],'where':{'CmHopperId':_0x233e19['id']},'order':[[_0xe61e('0x1d'),'ASC']]})[_0xe61e('0xa')](function(_0x261256){var _0x5e7570=0x0;if(_0x261256){if(_0x261256[_0xe61e('0x27')]+_0x261256[_0xe61e('0x1f')]+_0x261256[_0xe61e('0x20')]+_0x261256[_0xe61e('0x21')]+_0x261256[_0xe61e('0x22')]+_0x261256[_0xe61e('0x23')]+_0x261256[_0xe61e('0x24')]+_0x261256['countagentrejectretry']<_0x235939[_0xe61e('0x25')][_0xe61e('0x26')])_0x5e7570=0x1;_0x159d67({'additional':_0x5e7570});}else{_0x159d67({'additional':0x0});}})[_0xe61e('0x28')](function(_0x2abb33){logger['error'](_0xe61e('0x15'),_0x2abb33[_0xe61e('0x12')]);_0x516ea4(_0x34d1d6['error'](0x1f4,_0x2abb33['message']));});}})[_0xe61e('0x28')](function(_0xd460b2){logger['error'](_0xe61e('0x15'),_0xd460b2[_0xe61e('0x12')]);_0x516ea4(_0x34d1d6['error'](0x1f4,_0xd460b2[_0xe61e('0x12')]));});}else _0x159d67({'additional':0x0});});});};exports[_0xe61e('0x29')]=function(_0x106f38){var _0xc55e71=this;return new Promise(function(_0x384caf,_0x1576b1){return db[_0xe61e('0x16')][_0xe61e('0x17')]({'raw':!![],'where':{'ContactId':_0x106f38[_0xe61e('0x18')][_0xe61e('0x2a')],'ListId':_0x106f38['body']['ListId'],'VoiceQueueId':_0x106f38[_0xe61e('0x18')][_0xe61e('0x1a')]===undefined?null:_0x106f38[_0xe61e('0x18')][_0xe61e('0x1a')],'CampaignId':_0x106f38[_0xe61e('0x18')]['CampaignId']===undefined?null:_0x106f38['body'][_0xe61e('0x1b')]}})[_0xe61e('0xa')](function(_0x20ab66){if(_0x20ab66!=null){return db[_0xe61e('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x20ab66['id'],'OrderBy':{'$gte':_0x20ab66['OrderBy']}},'order':[['OrderBy',_0xe61e('0x1e')]]})['then'](function(_0x2bc1ed){if(_0x2bc1ed)return activateAdditionalPhone(_0x20ab66,_0x106f38[_0xe61e('0x18')],_0x2bc1ed,_0x106f38['duration'],_0x106f38[_0xe61e('0x2b')])[_0xe61e('0xa')](function(_0x47f294){_0x384caf(_0x47f294);});else{return db[_0xe61e('0x1c')][_0xe61e('0x17')]({'raw':!![],'where':{'CmHopperId':_0x20ab66['id']},'order':[['OrderBy',_0xe61e('0x1e')]]})[_0xe61e('0xa')](function(_0x484dbe){if(_0x484dbe)return activateAdditionalPhone(_0x20ab66,_0x106f38[_0xe61e('0x18')],_0x484dbe,_0x106f38[_0xe61e('0x2c')],_0x106f38[_0xe61e('0x2b')])[_0xe61e('0xa')](function(_0x58ea35){_0x384caf(_0x58ea35);});else{_0x384caf({'id':_0x20ab66['id'],'phone':''});}})[_0xe61e('0x28')](function(_0x2feeb6){logger['error'](_0xe61e('0x15'),_0x2feeb6[_0xe61e('0x12')]);_0x1576b1(_0xc55e71[_0xe61e('0x10')](0x1f4,_0x2feeb6[_0xe61e('0x12')]));});}})['catch'](function(_0x44d732){logger['error'](_0xe61e('0x15'),_0x44d732[_0xe61e('0x12')]);_0x1576b1(_0xc55e71[_0xe61e('0x10')](0x1f4,_0x44d732[_0xe61e('0x12')]));});}else _0x384caf(0x1);});});};function activateAdditionalPhone(_0x2d9622,_0xde3797,_0x550cea,_0x4aa476,_0x9f72f7){return new Promise(function(_0x231103,_0x5c1981){var _0x1d99c1;if(_[_0xe61e('0x2d')](_0x550cea['scheduledat'])){_0x550cea[_0xe61e('0x2e')]=moment();}if(moment()>moment(_0x550cea[_0xe61e('0x2e')])){_0x1d99c1=moment()[_0xe61e('0x2f')](_0x9f72f7||0x3,'minutes');}else{if(_0x550cea[_0xe61e('0x1d')]==0x0){_0x1d99c1=moment(_0x550cea[_0xe61e('0x2e')]);}else{_0x1d99c1=moment()[_0xe61e('0x2f')](_0x9f72f7||0x3,_0xe61e('0x30'));}}if(_['isNil'](_0x1d99c1)){_0x1d99c1=moment()['add'](_0x9f72f7||0x3,_0xe61e('0x30'));}var _0xfed09a={'phone':_0x2d9622[_0xe61e('0x31')],'active':0x0,'OrderBy':_[_0xe61e('0x2d')](_0x2d9622['OrderBy'])?0x0:_0x2d9622[_0xe61e('0x1d')],'scheduledat':moment()['add'](_0x4aa476||0x1,_0xe61e('0x30')),'countbusyretry':_0xde3797['countbusyretry'],'countcongestionretry':_0xde3797[_0xe61e('0x1f')],'countnoanswerretry':_0xde3797[_0xe61e('0x20')],'countnosuchnumberretry':_0xde3797[_0xe61e('0x21')],'countdropretry':_0xde3797[_0xe61e('0x22')],'countabandonedretry':_0xde3797[_0xe61e('0x23')],'countmachineretry':_0xde3797[_0xe61e('0x24')],'countagentrejectretry':_0xde3797[_0xe61e('0x32')],'createdAt':_0xde3797[_0xe61e('0x33')],'updatedAt':_0xde3797['updatedAt']};var _0x491b95={'CmHopperId':_0x2d9622['id'],'phone':_0x550cea[_0xe61e('0x31')],'active':0x0,'OrderBy':_[_0xe61e('0x2d')](_0x550cea['OrderBy'])?0x0:_0x550cea[_0xe61e('0x1d')],'scheduledat':_0x1d99c1,'countbusyretry':_0x550cea['countbusyretry'],'countcongestionretry':_0x550cea[_0xe61e('0x1f')],'countnoanswerretry':_0x550cea[_0xe61e('0x20')],'countnosuchnumberretry':_0x550cea[_0xe61e('0x21')],'countdropretry':_0x550cea[_0xe61e('0x22')],'countabandonedretry':_0x550cea[_0xe61e('0x23')],'countmachineretry':_0x550cea[_0xe61e('0x24')],'countagentrejectretry':_0x550cea[_0xe61e('0x32')],'createdAt':_0x550cea[_0xe61e('0x33')],'updatedAt':_0x550cea[_0xe61e('0x34')]};return db['sequelize']['transaction'](function(_0x2998bb){return db[_0xe61e('0x1c')][_0xe61e('0x35')](_0xfed09a,{'where':{'id':_0x550cea['id']}},{'transaction':_0x2998bb})['then'](function(){return db['CmHopper'][_0xe61e('0x35')](_0x491b95,{'where':{'id':_0x2d9622['id']}},{'transaction':_0x2998bb});});})['then'](function(_0x4a9387){_0x231103({'id':_0x2d9622['id'],'phone':_0x550cea[_0xe61e('0x31')]});})[_0xe61e('0x28')](function(_0x247423){logger[_0xe61e('0x10')](_0xe61e('0x36'),_0x247423['message']);_0x5c1981({'error':_0x247423[_0xe61e('0x12')]});});});}exports[_0xe61e('0x37')]=function(_0x4153f6){var _0x991a58=this;return new Promise(function(_0x59cc7e,_0x5c6406){return db[_0xe61e('0x16')][_0xe61e('0x35')](_0x4153f6['body'][_0xe61e('0x38')],{'where':{'id':_0x4153f6['body']['id']}})[_0xe61e('0xa')](function(_0xbb8223){_0x59cc7e(_0xbb8223);})['catch'](function(_0x11ca69){logger[_0xe61e('0x10')]('IncrementPreviewCounters',_0x11ca69[_0xe61e('0x12')]);_0x5c6406(_0x991a58['error'](0x1f4,_0x11ca69[_0xe61e('0x12')]));});});}; \ No newline at end of file +var _0xf8db=['ContactId','ListId','VoiceQueueId','CampaignId','findOne','ASC','countbusyretry','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','OrderBy','countnoanswerretry','countnosuchnumberretry','countdropretry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','minutes','add','createdAt','phone','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','VerifyAdditionalPhones','CmHopper','body'];(function(_0x13991e,_0x161c8b){var _0x3a0edd=function(_0x42fd78){while(--_0x42fd78){_0x13991e['push'](_0x13991e['shift']());}};_0x3a0edd(++_0x161c8b);}(_0xf8db,0x106));var _0xbf8d=function(_0x4381fb,_0x465ed9){_0x4381fb=_0x4381fb-0x0;var _0x2ccf63=_0xf8db[_0x4381fb];return _0x2ccf63;};'use strict';var _=require(_0xbf8d('0x0'));var util=require(_0xbf8d('0x1'));var moment=require('moment');var BPromise=require(_0xbf8d('0x2'));var rs=require(_0xbf8d('0x3'));var fs=require('fs');var Redis=require(_0xbf8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf8d('0x5'));var logger=require(_0xbf8d('0x6'))(_0xbf8d('0x7'));var config=require(_0xbf8d('0x8'));var jayson=require(_0xbf8d('0x9'));var client=jayson[_0xbf8d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe2b549,_0x337d4d,_0x3d2494){return new BPromise(function(_0x33685a,_0x1dc0d9){return client[_0xbf8d('0xb')](_0xe2b549,_0x3d2494)[_0xbf8d('0xc')](function(_0x2ee046){logger[_0xbf8d('0xd')](_0xbf8d('0xe'),_0x337d4d,_0xbf8d('0xf'));logger[_0xbf8d('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x337d4d,_0xbf8d('0xf'),JSON[_0xbf8d('0x11')](_0x2ee046));if(_0x2ee046[_0xbf8d('0x12')]){if(_0x2ee046[_0xbf8d('0x12')]['code']===0x1f4){logger['error'](_0xbf8d('0xe'),_0x337d4d,_0x2ee046[_0xbf8d('0x12')][_0xbf8d('0x13')]);return _0x1dc0d9(_0x2ee046[_0xbf8d('0x12')]['message']);}logger[_0xbf8d('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x337d4d,_0x2ee046[_0xbf8d('0x12')]['message']);return _0x33685a(_0x2ee046[_0xbf8d('0x12')]['message']);}else{logger[_0xbf8d('0xd')](_0xbf8d('0xe'),_0x337d4d,_0xbf8d('0xf'));_0x33685a(_0x2ee046['result']['message']);}})['catch'](function(_0x77f7a9){logger['error'](_0xbf8d('0xe'),_0x337d4d,_0x77f7a9);_0x1dc0d9(_0x77f7a9);});});}exports[_0xbf8d('0x14')]=function(_0x247a17){var _0x5ee255=this;return new Promise(function(_0x13704a,_0x2db052){return db[_0xbf8d('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x247a17[_0xbf8d('0x16')][_0xbf8d('0x17')],'ListId':_0x247a17[_0xbf8d('0x16')][_0xbf8d('0x18')],'VoiceQueueId':_0x247a17[_0xbf8d('0x16')][_0xbf8d('0x19')]===undefined?null:_0x247a17[_0xbf8d('0x16')]['VoiceQueueId'],'CampaignId':_0x247a17[_0xbf8d('0x16')][_0xbf8d('0x1a')]===undefined?null:_0x247a17[_0xbf8d('0x16')]['CampaignId']}})[_0xbf8d('0xc')](function(_0x3ad947){if(_0x3ad947!=null){return db['CmHopperAdditionalPhone'][_0xbf8d('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3ad947['id'],'OrderBy':{'$gt':_0x3ad947['OrderBy']}},'order':[['OrderBy',_0xbf8d('0x1c')]]})['then'](function(_0x2580b1){var _0x3d37b7=0x0;if(_0x2580b1){if(_0x2580b1[_0xbf8d('0x1d')]+_0x2580b1[_0xbf8d('0x1e')]+_0x2580b1['countnoanswerretry']+_0x2580b1['countnosuchnumberretry']+_0x2580b1['countdropretry']+_0x2580b1[_0xbf8d('0x1f')]+_0x2580b1[_0xbf8d('0x20')]+_0x2580b1[_0xbf8d('0x21')]<_0x247a17[_0xbf8d('0x22')][_0xbf8d('0x23')])_0x3d37b7=0x1;_0x13704a({'additional':_0x3d37b7});}else{return db[_0xbf8d('0x24')][_0xbf8d('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3ad947['id']},'order':[[_0xbf8d('0x25'),_0xbf8d('0x1c')]]})['then'](function(_0x2eccd5){var _0x56d625=0x0;if(_0x2eccd5){if(_0x2eccd5['countbusyretry']+_0x2eccd5[_0xbf8d('0x1e')]+_0x2eccd5[_0xbf8d('0x26')]+_0x2eccd5[_0xbf8d('0x27')]+_0x2eccd5[_0xbf8d('0x28')]+_0x2eccd5[_0xbf8d('0x1f')]+_0x2eccd5[_0xbf8d('0x20')]+_0x2eccd5[_0xbf8d('0x21')]<_0x247a17[_0xbf8d('0x22')]['dialGlobalMaxRetry'])_0x56d625=0x1;_0x13704a({'additional':_0x56d625});}else{_0x13704a({'additional':0x0});}})[_0xbf8d('0x29')](function(_0x1f4aff){logger[_0xbf8d('0x12')](_0xbf8d('0x14'),_0x1f4aff['message']);_0x2db052(_0x5ee255[_0xbf8d('0x12')](0x1f4,_0x1f4aff[_0xbf8d('0x13')]));});}})[_0xbf8d('0x29')](function(_0x44b01b){logger[_0xbf8d('0x12')](_0xbf8d('0x14'),_0x44b01b[_0xbf8d('0x13')]);_0x2db052(_0x5ee255[_0xbf8d('0x12')](0x1f4,_0x44b01b[_0xbf8d('0x13')]));});}else _0x13704a({'additional':0x0});});});};exports[_0xbf8d('0x2a')]=function(_0xe2489e){var _0x51ee9e=this;return new Promise(function(_0x4e4eae,_0x3d7945){return db[_0xbf8d('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0xe2489e[_0xbf8d('0x16')][_0xbf8d('0x17')],'ListId':_0xe2489e[_0xbf8d('0x16')][_0xbf8d('0x18')],'VoiceQueueId':_0xe2489e['body'][_0xbf8d('0x19')]===undefined?null:_0xe2489e['body'][_0xbf8d('0x19')],'CampaignId':_0xe2489e[_0xbf8d('0x16')][_0xbf8d('0x1a')]===undefined?null:_0xe2489e[_0xbf8d('0x16')]['CampaignId']}})[_0xbf8d('0xc')](function(_0x5df8aa){if(_0x5df8aa!=null){return db[_0xbf8d('0x24')][_0xbf8d('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x5df8aa['id'],'OrderBy':{'$gte':_0x5df8aa[_0xbf8d('0x25')]}},'order':[[_0xbf8d('0x25'),'ASC']]})[_0xbf8d('0xc')](function(_0x2bdb0c){if(_0x2bdb0c)return activateAdditionalPhone(_0x5df8aa,_0xe2489e[_0xbf8d('0x16')],_0x2bdb0c,_0xe2489e[_0xbf8d('0x2b')],_0xe2489e[_0xbf8d('0x2c')])[_0xbf8d('0xc')](function(_0xc9a704){_0x4e4eae(_0xc9a704);});else{return db[_0xbf8d('0x24')][_0xbf8d('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x5df8aa['id']},'order':[[_0xbf8d('0x25'),_0xbf8d('0x1c')]]})[_0xbf8d('0xc')](function(_0x376aa9){if(_0x376aa9)return activateAdditionalPhone(_0x5df8aa,_0xe2489e[_0xbf8d('0x16')],_0x376aa9,_0xe2489e[_0xbf8d('0x2b')],_0xe2489e[_0xbf8d('0x2c')])[_0xbf8d('0xc')](function(_0x11fdf5){_0x4e4eae(_0x11fdf5);});else{_0x4e4eae({'id':_0x5df8aa['id'],'phone':''});}})['catch'](function(_0x460ba3){logger[_0xbf8d('0x12')](_0xbf8d('0x14'),_0x460ba3[_0xbf8d('0x13')]);_0x3d7945(_0x51ee9e['error'](0x1f4,_0x460ba3[_0xbf8d('0x13')]));});}})[_0xbf8d('0x29')](function(_0x50b138){logger[_0xbf8d('0x12')]('VerifyAdditionalPhones',_0x50b138[_0xbf8d('0x13')]);_0x3d7945(_0x51ee9e[_0xbf8d('0x12')](0x1f4,_0x50b138[_0xbf8d('0x13')]));});}else _0x4e4eae(0x1);});});};function activateAdditionalPhone(_0x278e7e,_0x121fa8,_0x5d4614,_0x1fbab9,_0x22502a){return new Promise(function(_0x1a3726,_0x301d7b){var _0x304e38;if(_[_0xbf8d('0x2d')](_0x5d4614[_0xbf8d('0x2e')])){_0x5d4614[_0xbf8d('0x2e')]=moment();}if(moment()>moment(_0x5d4614[_0xbf8d('0x2e')])){_0x304e38=moment()['add'](_0x22502a||0x3,_0xbf8d('0x2f'));}else{if(_0x5d4614['OrderBy']==0x0){_0x304e38=moment(_0x5d4614[_0xbf8d('0x2e')]);}else{_0x304e38=moment()[_0xbf8d('0x30')](_0x22502a||0x3,_0xbf8d('0x2f'));}}if(_[_0xbf8d('0x2d')](_0x304e38)){_0x304e38=moment()[_0xbf8d('0x30')](_0x22502a||0x3,_0xbf8d('0x2f'));}var _0x38e0ae={'phone':_0x278e7e['phone'],'active':0x0,'OrderBy':_[_0xbf8d('0x2d')](_0x278e7e[_0xbf8d('0x25')])?0x0:_0x278e7e[_0xbf8d('0x25')],'scheduledat':moment()[_0xbf8d('0x30')](_0x1fbab9||0x1,_0xbf8d('0x2f')),'countbusyretry':_0x121fa8[_0xbf8d('0x1d')],'countcongestionretry':_0x121fa8[_0xbf8d('0x1e')],'countnoanswerretry':_0x121fa8['countnoanswerretry'],'countnosuchnumberretry':_0x121fa8['countnosuchnumberretry'],'countdropretry':_0x121fa8[_0xbf8d('0x28')],'countabandonedretry':_0x121fa8[_0xbf8d('0x1f')],'countmachineretry':_0x121fa8['countmachineretry'],'countagentrejectretry':_0x121fa8[_0xbf8d('0x21')],'createdAt':_0x121fa8[_0xbf8d('0x31')],'updatedAt':_0x121fa8['updatedAt']};var _0x1abdc0={'CmHopperId':_0x278e7e['id'],'phone':_0x5d4614[_0xbf8d('0x32')],'active':0x0,'OrderBy':_[_0xbf8d('0x2d')](_0x5d4614[_0xbf8d('0x25')])?0x0:_0x5d4614[_0xbf8d('0x25')],'scheduledat':_0x304e38,'countbusyretry':_0x5d4614[_0xbf8d('0x1d')],'countcongestionretry':_0x5d4614[_0xbf8d('0x1e')],'countnoanswerretry':_0x5d4614['countnoanswerretry'],'countnosuchnumberretry':_0x5d4614['countnosuchnumberretry'],'countdropretry':_0x5d4614[_0xbf8d('0x28')],'countabandonedretry':_0x5d4614[_0xbf8d('0x1f')],'countmachineretry':_0x5d4614[_0xbf8d('0x20')],'countagentrejectretry':_0x5d4614['countagentrejectretry'],'createdAt':_0x5d4614['createdAt'],'updatedAt':_0x5d4614[_0xbf8d('0x33')]};return db[_0xbf8d('0x34')][_0xbf8d('0x35')](function(_0x1692b3){return db[_0xbf8d('0x24')][_0xbf8d('0x36')](_0x38e0ae,{'where':{'id':_0x5d4614['id']}},{'transaction':_0x1692b3})[_0xbf8d('0xc')](function(){return db[_0xbf8d('0x15')][_0xbf8d('0x36')](_0x1abdc0,{'where':{'id':_0x278e7e['id']}},{'transaction':_0x1692b3});});})[_0xbf8d('0xc')](function(_0xd8e20a){_0x1a3726({'id':_0x278e7e['id'],'phone':_0x5d4614[_0xbf8d('0x32')]});})['catch'](function(_0x337559){logger[_0xbf8d('0x12')](_0xbf8d('0x37'),_0x337559[_0xbf8d('0x13')]);_0x301d7b({'error':_0x337559['message']});});});}exports['IncrementPreviewCounters']=function(_0x59acd8){var _0x434bdb=this;return new Promise(function(_0x2f6f8d,_0x1dab43){return db[_0xbf8d('0x15')][_0xbf8d('0x36')](_0x59acd8[_0xbf8d('0x16')][_0xbf8d('0x38')],{'where':{'id':_0x59acd8['body']['id']}})[_0xbf8d('0xc')](function(_0x1cb496){_0x2f6f8d(_0x1cb496);})['catch'](function(_0x225283){logger[_0xbf8d('0x12')]('IncrementPreviewCounters',_0x225283[_0xbf8d('0x13')]);_0x1dab43(_0x434bdb[_0xbf8d('0x12')](0x1f4,_0x225283[_0xbf8d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index cc416de..1878568 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d13=['../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2bdc08,_0xec6fd7){var _0x410af9=function(_0x3f99e0){while(--_0x3f99e0){_0x2bdc08['push'](_0x2bdc08['shift']());}};_0x410af9(++_0xec6fd7);}(_0x7d13,0x176));var _0x37d1=function(_0x1c86cf,_0xd758df){_0x1c86cf=_0x1c86cf-0x0;var _0x22c104=_0x7d13[_0x1c86cf];return _0x22c104;};'use strict';var multer=require(_0x37d1('0x0'));var util=require(_0x37d1('0x1'));var path=require('path');var timeout=require(_0x37d1('0x2'));var express=require('express');var router=express[_0x37d1('0x3')]();var fs_extra=require(_0x37d1('0x4'));var auth=require(_0x37d1('0x5'));var interaction=require(_0x37d1('0x6'));var config=require(_0x37d1('0x7'));var controller=require(_0x37d1('0x8'));router[_0x37d1('0x9')]('/',auth['isAuthenticated'](),controller[_0x37d1('0xa')]);router[_0x37d1('0x9')](_0x37d1('0xb'),auth[_0x37d1('0xc')](),controller[_0x37d1('0xd')]);router[_0x37d1('0xe')]('/',auth['isAuthenticated'](),controller[_0x37d1('0xf')]);router['put']('/:id',auth[_0x37d1('0xc')](),controller[_0x37d1('0x10')]);router[_0x37d1('0x11')](_0x37d1('0xb'),auth[_0x37d1('0xc')](),controller[_0x37d1('0x12')]);module[_0x37d1('0x13')]=router; \ No newline at end of file +var _0x10f8=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x10f8,0x119));var _0x810f=function(_0x4b90b7,_0x2b0ab0){_0x4b90b7=_0x4b90b7-0x0;var _0x36ac5f=_0x10f8[_0x4b90b7];return _0x36ac5f;};'use strict';var multer=require(_0x810f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x810f('0x1'));var express=require('express');var router=express[_0x810f('0x2')]();var fs_extra=require(_0x810f('0x3'));var auth=require(_0x810f('0x4'));var interaction=require(_0x810f('0x5'));var config=require(_0x810f('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x810f('0x7')]('/',auth[_0x810f('0x8')](),controller[_0x810f('0x9')]);router[_0x810f('0x7')](_0x810f('0xa'),auth[_0x810f('0x8')](),controller[_0x810f('0xb')]);router[_0x810f('0xc')]('/',auth[_0x810f('0x8')](),controller[_0x810f('0xd')]);router[_0x810f('0xe')](_0x810f('0xa'),auth[_0x810f('0x8')](),controller['update']);router[_0x810f('0xf')](_0x810f('0xa'),auth['isAuthenticated'](),controller[_0x810f('0x10')]);module[_0x810f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 06a5624..f739327 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.attributes.js +++ b/server/api/cmHopperBlack/cmHopperBlack.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30bc=['sequelize','exports','INTEGER','contactListQueue','moment'];(function(_0x36a997,_0x288f0b){var _0x561b1b=function(_0x8ed5bb){while(--_0x8ed5bb){_0x36a997['push'](_0x36a997['shift']());}};_0x561b1b(++_0x288f0b);}(_0x30bc,0x149));var _0xc30b=function(_0x3b76ae,_0x1f110e){_0x3b76ae=_0x3b76ae-0x0;var _0x11ab0f=_0x30bc[_0x3b76ae];return _0x11ab0f;};'use strict';var moment=require(_0xc30b('0x0'));var Sequelize=require(_0xc30b('0x1'));module[_0xc30b('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc30b('0x3')],'unique':_0xc30b('0x4')},'ListId':{'type':Sequelize[_0xc30b('0x3')],'unique':_0xc30b('0x4')},'VoiceQueueId':{'type':Sequelize[_0xc30b('0x3')],'unique':_0xc30b('0x4')}}; \ No newline at end of file +var _0x6d4f=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0xfddafc,_0x22bc7c){var _0x15d3bd=function(_0x5f0ea2){while(--_0x5f0ea2){_0xfddafc['push'](_0xfddafc['shift']());}};_0x15d3bd(++_0x22bc7c);}(_0x6d4f,0x121));var _0xf6d4=function(_0x8a2dae,_0x2a21a7){_0x8a2dae=_0x8a2dae-0x0;var _0x308f20=_0x6d4f[_0x8a2dae];return _0x308f20;};'use strict';var moment=require(_0xf6d4('0x0'));var Sequelize=require(_0xf6d4('0x1'));module[_0xf6d4('0x2')]={'phone':{'type':Sequelize[_0xf6d4('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf6d4('0x4')],'unique':_0xf6d4('0x5')},'ListId':{'type':Sequelize[_0xf6d4('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xf6d4('0x4')],'unique':_0xf6d4('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e8a9d8a..dcecd2a 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x594e=['destroy','sendStatus','error','stack','name','map','CmHopperBlack','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','then','catch','params','body','find','describe','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x594e,0x11e));var _0xe594=function(_0x234ad4,_0x593233){_0x234ad4=_0x234ad4-0x0;var _0x473794=_0x594e[_0x234ad4];return _0x473794;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe594('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe594('0x1'));var moment=require('moment');var BPromise=require(_0xe594('0x2'));var Mustache=require(_0xe594('0x3'));var util=require(_0xe594('0x4'));var path=require(_0xe594('0x5'));var sox=require('sox');var csv=require(_0xe594('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe594('0x7'));var squel=require(_0xe594('0x8'));var crypto=require('crypto');var jsforce=require(_0xe594('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe594('0x6'));var querystring=require('querystring');var Papa=require(_0xe594('0xa'));var Redis=require(_0xe594('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xe594('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe594('0xd'));var logger=require('../../config/logger')(_0xe594('0xe'));var utils=require(_0xe594('0xf'));var config=require(_0xe594('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xe594('0x11'))['db'];function respondWithStatusCode(_0x203735,_0x46d4ef){_0x46d4ef=_0x46d4ef||0xcc;return function(_0x180bb7){if(_0x180bb7){return _0x203735['sendStatus'](_0x46d4ef);}return _0x203735['status'](_0x46d4ef)[_0xe594('0x12')]();};}function respondWithResult(_0x4b0419,_0x554acf){_0x554acf=_0x554acf||0xc8;return function(_0x39dbd8){if(_0x39dbd8){return _0x4b0419[_0xe594('0x13')](_0x554acf)[_0xe594('0x14')](_0x39dbd8);}};}function respondWithFilteredResult(_0x14865e,_0x3f3976){return function(_0xd0063){if(_0xd0063){var _0x2d66b4=typeof _0x3f3976[_0xe594('0x15')]===_0xe594('0x16')&&typeof _0x3f3976['limit']===_0xe594('0x16');var _0x2d8f66=_0xd0063[_0xe594('0x17')];var _0x21fd14=_0x2d66b4?0x0:_0x3f3976[_0xe594('0x15')];var _0x324812=_0x2d66b4?_0xd0063[_0xe594('0x17')]:_0x3f3976[_0xe594('0x15')]+_0x3f3976['limit'];var _0x4be8a1;if(_0x324812>=_0x2d8f66){_0x324812=_0x2d8f66;_0x4be8a1=0xc8;}else{_0x4be8a1=0xce;}_0x14865e[_0xe594('0x13')](_0x4be8a1);return _0x14865e[_0xe594('0x18')](_0xe594('0x19'),_0x21fd14+'-'+_0x324812+'/'+_0x2d8f66)[_0xe594('0x14')](_0xd0063);}return null;};}function patchUpdates(_0x5a4d8e){return function(_0x57e521){try{jsonpatch[_0xe594('0x1a')](_0x57e521,_0x5a4d8e,!![]);}catch(_0x975349){return BPromise[_0xe594('0x1b')](_0x975349);}return _0x57e521['save']();};}function saveUpdates(_0x6f2790,_0x12888b){return function(_0x27f3e0){if(_0x27f3e0){return _0x27f3e0[_0xe594('0x1c')](_0x6f2790)['then'](function(_0x170b22){return _0x170b22;});}return null;};}function removeEntity(_0x495faa,_0x30f97c){return function(_0x3c5537){if(_0x3c5537){return _0x3c5537[_0xe594('0x1d')]()['then'](function(){_0x495faa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4bc6,_0x2ef1a7){return function(_0xfcf22d){if(!_0xfcf22d){_0x3b4bc6[_0xe594('0x1e')](0x194);}return _0xfcf22d;};}function handleError(_0x4d1ccc,_0x154590){_0x154590=_0x154590||0x1f4;return function(_0x518be5){logger[_0xe594('0x1f')](_0x518be5[_0xe594('0x20')]);if(_0x518be5[_0xe594('0x21')]){delete _0x518be5[_0xe594('0x21')];}_0x4d1ccc[_0xe594('0x13')](_0x154590)['send'](_0x518be5);};}exports['index']=function(_0x1ff6d9,_0x575871){var _0x862cbe={},_0x472b21={},_0x1452f4={'count':0x0,'rows':[]};var _0x2ef654=_[_0xe594('0x22')](db[_0xe594('0x23')][_0xe594('0x24')],function(_0x5b12b2){return{'name':_0x5b12b2['fieldName'],'type':_0x5b12b2['type']['key']};});_0x472b21[_0xe594('0x25')]=_[_0xe594('0x22')](_0x2ef654,_0xe594('0x21'));_0x472b21[_0xe594('0x26')]=_[_0xe594('0x27')](_0x1ff6d9['query']);_0x472b21[_0xe594('0x28')]=_[_0xe594('0x29')](_0x472b21[_0xe594('0x25')],_0x472b21[_0xe594('0x26')]);_0x862cbe[_0xe594('0x2a')]=_[_0xe594('0x29')](_0x472b21[_0xe594('0x25')],qs[_0xe594('0x2b')](_0x1ff6d9[_0xe594('0x26')]['fields']));_0x862cbe['attributes']=_0x862cbe[_0xe594('0x2a')][_0xe594('0x2c')]?_0x862cbe[_0xe594('0x2a')]:_0x472b21[_0xe594('0x25')];if(!_0x1ff6d9[_0xe594('0x26')]['hasOwnProperty'](_0xe594('0x2d'))){_0x862cbe[_0xe594('0x2e')]=qs['limit'](_0x1ff6d9[_0xe594('0x26')][_0xe594('0x2e')]);_0x862cbe['offset']=qs[_0xe594('0x15')](_0x1ff6d9['query'][_0xe594('0x15')]);}_0x862cbe[_0xe594('0x2f')]=qs[_0xe594('0x30')](_0x1ff6d9['query']['sort']);_0x862cbe[_0xe594('0x31')]=qs['filters'](_[_0xe594('0x32')](_0x1ff6d9[_0xe594('0x26')],_0x472b21[_0xe594('0x28')]),_0x2ef654);if(_0x1ff6d9[_0xe594('0x26')]['filter']){_0x862cbe['where']=_[_0xe594('0x33')](_0x862cbe['where'],{'$or':_[_0xe594('0x22')](_0x2ef654,function(_0x39d5e3){if(_0x39d5e3[_0xe594('0x34')]!==_0xe594('0x35')){var _0x144b19={};_0x144b19[_0x39d5e3[_0xe594('0x21')]]={'$like':'%'+_0x1ff6d9[_0xe594('0x26')][_0xe594('0x36')]+'%'};return _0x144b19;}})});}_0x862cbe=_[_0xe594('0x33')]({},_0x862cbe,_0x1ff6d9['options']);var _0x5b4619={'where':_0x862cbe[_0xe594('0x31')]};return db[_0xe594('0x23')]['count'](_0x5b4619)['then'](function(_0x32413b){_0x1452f4[_0xe594('0x17')]=_0x32413b;if(_0x1ff6d9['query'][_0xe594('0x37')]){_0x862cbe[_0xe594('0x38')]=[{'all':!![]}];}return db[_0xe594('0x23')]['findAll'](_0x862cbe);})[_0xe594('0x39')](function(_0x27b920){_0x1452f4['rows']=_0x27b920;return _0x1452f4;})['then'](respondWithFilteredResult(_0x575871,_0x862cbe))[_0xe594('0x3a')](handleError(_0x575871,null));};exports['show']=function(_0x2076fe,_0x12356f){var _0x31e1e8={'raw':!![],'where':{'id':_0x2076fe[_0xe594('0x3b')]['id']}},_0xd89499={};_0xd89499[_0xe594('0x25')]=_[_0xe594('0x27')](db['CmHopperBlack'][_0xe594('0x24')]);_0xd89499[_0xe594('0x26')]=_[_0xe594('0x27')](_0x2076fe[_0xe594('0x26')]);_0xd89499[_0xe594('0x28')]=_[_0xe594('0x29')](_0xd89499[_0xe594('0x25')],_0xd89499[_0xe594('0x26')]);_0x31e1e8[_0xe594('0x2a')]=_[_0xe594('0x29')](_0xd89499[_0xe594('0x25')],qs[_0xe594('0x2b')](_0x2076fe[_0xe594('0x26')][_0xe594('0x2b')]));_0x31e1e8[_0xe594('0x2a')]=_0x31e1e8['attributes']['length']?_0x31e1e8[_0xe594('0x2a')]:_0xd89499[_0xe594('0x25')];if(_0x2076fe[_0xe594('0x26')]['includeAll']){_0x31e1e8[_0xe594('0x38')]=[{'all':!![]}];}_0x31e1e8=_['merge']({},_0x31e1e8,_0x2076fe['options']);return db['CmHopperBlack']['find'](_0x31e1e8)['then'](handleEntityNotFound(_0x12356f,null))[_0xe594('0x39')](respondWithResult(_0x12356f,null))[_0xe594('0x3a')](handleError(_0x12356f,null));};exports['update']=function(_0x3c8a6e,_0x3974dc){if(_0x3c8a6e[_0xe594('0x3c')]['id']){delete _0x3c8a6e[_0xe594('0x3c')]['id'];}return db[_0xe594('0x23')][_0xe594('0x3d')]({'where':{'id':_0x3c8a6e['params']['id']}})['then'](handleEntityNotFound(_0x3974dc,null))[_0xe594('0x39')](saveUpdates(_0x3c8a6e[_0xe594('0x3c')],null))[_0xe594('0x39')](respondWithResult(_0x3974dc,null))[_0xe594('0x3a')](handleError(_0x3974dc,null));};exports[_0xe594('0x1d')]=function(_0x40dce2,_0x56606a){return db[_0xe594('0x23')]['find']({'where':{'id':_0x40dce2[_0xe594('0x3b')]['id']}})['then'](handleEntityNotFound(_0x56606a,null))[_0xe594('0x39')](removeEntity(_0x56606a,null))[_0xe594('0x3a')](handleError(_0x56606a,null));};exports[_0xe594('0x3e')]=function(_0x4e1178,_0x1b1044){return db[_0xe594('0x23')][_0xe594('0x3e')]()[_0xe594('0x39')](respondWithResult(_0x1b1044,null))[_0xe594('0x3a')](handleError(_0x1b1044,null));}; \ No newline at end of file +var _0x94a0=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','include','CmHopperBlack','findAll','show','params','keys','options','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','moment','util'];(function(_0x577d0d,_0x5b39af){var _0x5ddf64=function(_0x194290){while(--_0x194290){_0x577d0d['push'](_0x577d0d['shift']());}};_0x5ddf64(++_0x5b39af);}(_0x94a0,0x85));var _0x094a=function(_0x200003,_0x2e5867){_0x200003=_0x200003-0x0;var _0x2d2434=_0x94a0[_0x200003];return _0x2d2434;};'use strict';var emlformat=require(_0x094a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x094a('0x1'));var jsonpatch=require(_0x094a('0x2'));var rp=require('request-promise');var moment=require(_0x094a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x094a('0x4'));var path=require(_0x094a('0x5'));var sox=require(_0x094a('0x6'));var csv=require(_0x094a('0x7'));var ejs=require(_0x094a('0x8'));var fs=require('fs');var fs_extra=require(_0x094a('0x9'));var _=require(_0x094a('0xa'));var squel=require(_0x094a('0xb'));var crypto=require(_0x094a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x094a('0xd'));var toCsv=require(_0x094a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x094a('0xe'));var hardwareService=require(_0x094a('0xf'));var logger=require('../../config/logger')(_0x094a('0x10'));var utils=require(_0x094a('0x11'));var config=require(_0x094a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x094a('0x13'))['db'];function respondWithStatusCode(_0x10f2b9,_0x20337e){_0x20337e=_0x20337e||0xcc;return function(_0x6531bd){if(_0x6531bd){return _0x10f2b9[_0x094a('0x14')](_0x20337e);}return _0x10f2b9[_0x094a('0x15')](_0x20337e)['end']();};}function respondWithResult(_0xe534ae,_0x1828da){_0x1828da=_0x1828da||0xc8;return function(_0x1d536f){if(_0x1d536f){return _0xe534ae['status'](_0x1828da)[_0x094a('0x16')](_0x1d536f);}};}function respondWithFilteredResult(_0x143ad6,_0x2b058b){return function(_0x45c9f0){if(_0x45c9f0){var _0x4d1991=typeof _0x2b058b['offset']==='undefined'&&typeof _0x2b058b[_0x094a('0x17')]==='undefined';var _0x5185f3=_0x45c9f0[_0x094a('0x18')];var _0x4998aa=_0x4d1991?0x0:_0x2b058b['offset'];var _0x1a7304=_0x4d1991?_0x45c9f0[_0x094a('0x18')]:_0x2b058b[_0x094a('0x19')]+_0x2b058b[_0x094a('0x17')];var _0x313331;if(_0x1a7304>=_0x5185f3){_0x1a7304=_0x5185f3;_0x313331=0xc8;}else{_0x313331=0xce;}_0x143ad6[_0x094a('0x15')](_0x313331);return _0x143ad6[_0x094a('0x1a')](_0x094a('0x1b'),_0x4998aa+'-'+_0x1a7304+'/'+_0x5185f3)[_0x094a('0x16')](_0x45c9f0);}return null;};}function patchUpdates(_0x3b85df){return function(_0x57e234){try{jsonpatch[_0x094a('0x1c')](_0x57e234,_0x3b85df,!![]);}catch(_0x1ab644){return BPromise[_0x094a('0x1d')](_0x1ab644);}return _0x57e234[_0x094a('0x1e')]();};}function saveUpdates(_0x31a79b,_0x39b16f){return function(_0x319b9e){if(_0x319b9e){return _0x319b9e[_0x094a('0x1f')](_0x31a79b)[_0x094a('0x20')](function(_0x4d6ab8){return _0x4d6ab8;});}return null;};}function removeEntity(_0x48968c,_0x5efcc7){return function(_0x286b41){if(_0x286b41){return _0x286b41[_0x094a('0x21')]()['then'](function(){_0x48968c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27dd28,_0x283486){return function(_0x355941){if(!_0x355941){_0x27dd28[_0x094a('0x14')](0x194);}return _0x355941;};}function handleError(_0x19bdf1,_0x671500){_0x671500=_0x671500||0x1f4;return function(_0x4c17a9){logger[_0x094a('0x22')](_0x4c17a9[_0x094a('0x23')]);if(_0x4c17a9['name']){delete _0x4c17a9[_0x094a('0x24')];}_0x19bdf1[_0x094a('0x15')](_0x671500)[_0x094a('0x25')](_0x4c17a9);};}exports['index']=function(_0x5e6bb8,_0x26ccc5){var _0x27762d={},_0x592eb9={},_0x5b3bac={'count':0x0,'rows':[]};var _0xf2ba6a=_['map'](db['CmHopperBlack'][_0x094a('0x26')],function(_0x3becd3){return{'name':_0x3becd3[_0x094a('0x27')],'type':_0x3becd3['type']['key']};});_0x592eb9[_0x094a('0x28')]=_[_0x094a('0x29')](_0xf2ba6a,_0x094a('0x24'));_0x592eb9['query']=_['keys'](_0x5e6bb8[_0x094a('0x2a')]);_0x592eb9['filters']=_[_0x094a('0x2b')](_0x592eb9['model'],_0x592eb9[_0x094a('0x2a')]);_0x27762d[_0x094a('0x2c')]=_[_0x094a('0x2b')](_0x592eb9[_0x094a('0x28')],qs[_0x094a('0x2d')](_0x5e6bb8[_0x094a('0x2a')][_0x094a('0x2d')]));_0x27762d[_0x094a('0x2c')]=_0x27762d[_0x094a('0x2c')][_0x094a('0x2e')]?_0x27762d[_0x094a('0x2c')]:_0x592eb9[_0x094a('0x28')];if(!_0x5e6bb8[_0x094a('0x2a')][_0x094a('0x2f')](_0x094a('0x30'))){_0x27762d[_0x094a('0x17')]=qs[_0x094a('0x17')](_0x5e6bb8[_0x094a('0x2a')][_0x094a('0x17')]);_0x27762d[_0x094a('0x19')]=qs[_0x094a('0x19')](_0x5e6bb8[_0x094a('0x2a')][_0x094a('0x19')]);}_0x27762d[_0x094a('0x31')]=qs[_0x094a('0x32')](_0x5e6bb8['query'][_0x094a('0x32')]);_0x27762d[_0x094a('0x33')]=qs[_0x094a('0x34')](_[_0x094a('0x35')](_0x5e6bb8[_0x094a('0x2a')],_0x592eb9[_0x094a('0x34')]),_0xf2ba6a);if(_0x5e6bb8[_0x094a('0x2a')][_0x094a('0x36')]){_0x27762d[_0x094a('0x33')]=_[_0x094a('0x37')](_0x27762d[_0x094a('0x33')],{'$or':_['map'](_0xf2ba6a,function(_0x175bce){if(_0x175bce[_0x094a('0x38')]!=='VIRTUAL'){var _0x185aee={};_0x185aee[_0x175bce['name']]={'$like':'%'+_0x5e6bb8[_0x094a('0x2a')]['filter']+'%'};return _0x185aee;}})});}_0x27762d=_['merge']({},_0x27762d,_0x5e6bb8['options']);var _0x161ece={'where':_0x27762d[_0x094a('0x33')]};return db['CmHopperBlack']['count'](_0x161ece)[_0x094a('0x20')](function(_0x13c460){_0x5b3bac[_0x094a('0x18')]=_0x13c460;if(_0x5e6bb8[_0x094a('0x2a')][_0x094a('0x39')]){_0x27762d[_0x094a('0x3a')]=[{'all':!![]}];}return db[_0x094a('0x3b')][_0x094a('0x3c')](_0x27762d);})[_0x094a('0x20')](function(_0x12b501){_0x5b3bac['rows']=_0x12b501;return _0x5b3bac;})[_0x094a('0x20')](respondWithFilteredResult(_0x26ccc5,_0x27762d))['catch'](handleError(_0x26ccc5,null));};exports[_0x094a('0x3d')]=function(_0x9fd96e,_0x23f7da){var _0x558c27={'raw':!![],'where':{'id':_0x9fd96e[_0x094a('0x3e')]['id']}},_0xa3fbe0={};_0xa3fbe0['model']=_['keys'](db[_0x094a('0x3b')][_0x094a('0x26')]);_0xa3fbe0[_0x094a('0x2a')]=_[_0x094a('0x3f')](_0x9fd96e[_0x094a('0x2a')]);_0xa3fbe0['filters']=_[_0x094a('0x2b')](_0xa3fbe0[_0x094a('0x28')],_0xa3fbe0[_0x094a('0x2a')]);_0x558c27[_0x094a('0x2c')]=_['intersection'](_0xa3fbe0[_0x094a('0x28')],qs[_0x094a('0x2d')](_0x9fd96e[_0x094a('0x2a')][_0x094a('0x2d')]));_0x558c27[_0x094a('0x2c')]=_0x558c27['attributes'][_0x094a('0x2e')]?_0x558c27[_0x094a('0x2c')]:_0xa3fbe0[_0x094a('0x28')];if(_0x9fd96e[_0x094a('0x2a')][_0x094a('0x39')]){_0x558c27['include']=[{'all':!![]}];}_0x558c27=_[_0x094a('0x37')]({},_0x558c27,_0x9fd96e[_0x094a('0x40')]);return db[_0x094a('0x3b')][_0x094a('0x41')](_0x558c27)['then'](handleEntityNotFound(_0x23f7da,null))[_0x094a('0x20')](respondWithResult(_0x23f7da,null))[_0x094a('0x42')](handleError(_0x23f7da,null));};exports[_0x094a('0x1f')]=function(_0x4f4436,_0x480949){if(_0x4f4436[_0x094a('0x43')]['id']){delete _0x4f4436[_0x094a('0x43')]['id'];}return db['CmHopperBlack'][_0x094a('0x41')]({'where':{'id':_0x4f4436['params']['id']}})[_0x094a('0x20')](handleEntityNotFound(_0x480949,null))[_0x094a('0x20')](saveUpdates(_0x4f4436[_0x094a('0x43')],null))[_0x094a('0x20')](respondWithResult(_0x480949,null))[_0x094a('0x42')](handleError(_0x480949,null));};exports['destroy']=function(_0x47c2c1,_0x1a8f9f){return db[_0x094a('0x3b')][_0x094a('0x41')]({'where':{'id':_0x47c2c1[_0x094a('0x3e')]['id']}})[_0x094a('0x20')](handleEntityNotFound(_0x1a8f9f,null))['then'](removeEntity(_0x1a8f9f,null))[_0x094a('0x42')](handleError(_0x1a8f9f,null));};exports[_0x094a('0x44')]=function(_0x4449f6,_0x2a87a5){return db[_0x094a('0x3b')][_0x094a('0x44')]()[_0x094a('0x20')](respondWithResult(_0x2a87a5,null))['catch'](handleError(_0x2a87a5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 8b9ec64..446730a 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687a=['rimraf','../../config/environment','define','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x687a,0xb7));var _0xa687=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x687a[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xa687('0x0'));var util=require(_0xa687('0x1'));var logger=require('../../config/logger')(_0xa687('0x2'));var moment=require(_0xa687('0x3'));var BPromise=require(_0xa687('0x4'));var rp=require(_0xa687('0x5'));var fs=require('fs');var path=require(_0xa687('0x6'));var rimraf=require(_0xa687('0x7'));var config=require(_0xa687('0x8'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x228872,_0x4d7953){return _0x228872[_0xa687('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b86=['../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1dab0e,_0x323d98){var _0x2b3242=function(_0x4107e6){while(--_0x4107e6){_0x1dab0e['push'](_0x1dab0e['shift']());}};_0x2b3242(++_0x323d98);}(_0x4b86,0x94));var _0x64b8=function(_0x49536b,_0x2abe5d){_0x49536b=_0x49536b-0x0;var _0x30de59=_0x4b86[_0x49536b];return _0x30de59;};'use strict';var _=require(_0x64b8('0x0'));var util=require(_0x64b8('0x1'));var logger=require('../../config/logger')(_0x64b8('0x2'));var moment=require(_0x64b8('0x3'));var BPromise=require(_0x64b8('0x4'));var rp=require(_0x64b8('0x5'));var fs=require('fs');var path=require(_0x64b8('0x6'));var rimraf=require(_0x64b8('0x7'));var config=require(_0x64b8('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x64b8('0x9')]=function(_0x353713,_0x324441){return _0x353713['define'](_0x64b8('0xa'),attributes,{'tableName':_0x64b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 0b6c073..4a864cb 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.rpc.js +++ b/server/api/cmHopperBlack/cmHopperBlack.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff95=['debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','GetCmHopperBlack','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0x129216,_0x5c208d){var _0x2a0306=function(_0x319d86){while(--_0x319d86){_0x129216['push'](_0x129216['shift']());}};_0x2a0306(++_0x5c208d);}(_0xff95,0x128));var _0x5ff9=function(_0x346295,_0xd4b82e){_0x346295=_0x346295-0x0;var _0x295ca7=_0xff95[_0x346295];return _0x295ca7;};'use strict';var _=require(_0x5ff9('0x0'));var util=require(_0x5ff9('0x1'));var moment=require(_0x5ff9('0x2'));var BPromise=require(_0x5ff9('0x3'));var rs=require(_0x5ff9('0x4'));var fs=require('fs');var Redis=require(_0x5ff9('0x5'));var db=require(_0x5ff9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ff9('0x7'))(_0x5ff9('0x8'));var config=require('../../config/environment');var jayson=require(_0x5ff9('0x9'));var client=jayson[_0x5ff9('0xa')][_0x5ff9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16d4ce,_0x3c1c7f,_0x5d58ca){return new BPromise(function(_0x652cf4,_0x4a4188){return client['request'](_0x16d4ce,_0x5d58ca)[_0x5ff9('0xc')](function(_0x145dd5){logger[_0x5ff9('0xd')](_0x5ff9('0xe'),_0x3c1c7f,_0x5ff9('0xf'));logger[_0x5ff9('0x10')](_0x5ff9('0x11'),_0x3c1c7f,_0x5ff9('0xf'),JSON['stringify'](_0x145dd5));if(_0x145dd5[_0x5ff9('0x12')]){if(_0x145dd5[_0x5ff9('0x12')][_0x5ff9('0x13')]===0x1f4){logger[_0x5ff9('0x12')](_0x5ff9('0xe'),_0x3c1c7f,_0x145dd5['error']['message']);return _0x4a4188(_0x145dd5[_0x5ff9('0x12')][_0x5ff9('0x14')]);}logger[_0x5ff9('0x12')](_0x5ff9('0xe'),_0x3c1c7f,_0x145dd5[_0x5ff9('0x12')][_0x5ff9('0x14')]);return _0x652cf4(_0x145dd5['error'][_0x5ff9('0x14')]);}else{logger[_0x5ff9('0xd')](_0x5ff9('0xe'),_0x3c1c7f,'request\x20sent');_0x652cf4(_0x145dd5[_0x5ff9('0x15')][_0x5ff9('0x14')]);}})[_0x5ff9('0x16')](function(_0xad08b2){logger[_0x5ff9('0x12')](_0x5ff9('0xe'),_0x3c1c7f,_0xad08b2);_0x4a4188(_0xad08b2);});});}exports['GetCmHopperBlack']=function(_0x18afbd){var _0x14bc17=this;return new Promise(function(_0x281870,_0x5e4f99){return db[_0x5ff9('0x17')][_0x5ff9('0x18')]({'raw':_0x18afbd[_0x5ff9('0x19')]?_0x18afbd['options'][_0x5ff9('0x1a')]===undefined?!![]:![]:!![],'where':_0x18afbd[_0x5ff9('0x19')]?_0x18afbd['options'][_0x5ff9('0x1b')]||null:null,'attributes':_0x18afbd['options']?_0x18afbd[_0x5ff9('0x19')]['attributes']||null:null,'limit':_0x18afbd['options']?_0x18afbd[_0x5ff9('0x19')][_0x5ff9('0x1c')]||null:null,'include':_0x18afbd[_0x5ff9('0x19')]?_0x18afbd[_0x5ff9('0x19')][_0x5ff9('0x1d')]?_[_0x5ff9('0x1e')](_0x18afbd[_0x5ff9('0x19')]['include'],function(_0x5c5fa2){return{'model':db[_0x5c5fa2[_0x5ff9('0x1f')]],'as':_0x5c5fa2['as'],'attributes':_0x5c5fa2[_0x5ff9('0x20')],'include':_0x5c5fa2[_0x5ff9('0x1d')]?_[_0x5ff9('0x1e')](_0x5c5fa2[_0x5ff9('0x1d')],function(_0x38f33c){return{'model':db[_0x38f33c[_0x5ff9('0x1f')]],'as':_0x38f33c['as'],'attributes':_0x38f33c['attributes'],'include':_0x38f33c['include']?_[_0x5ff9('0x1e')](_0x38f33c['include'],function(_0x6e38c4){return{'model':db[_0x6e38c4[_0x5ff9('0x1f')]],'as':_0x6e38c4['as'],'attributes':_0x6e38c4[_0x5ff9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5ff9('0xc')](function(_0x53b4e2){logger['info'](_0x5ff9('0x21'),_0x18afbd);logger[_0x5ff9('0x10')](_0x5ff9('0x21'),_0x18afbd,JSON[_0x5ff9('0x22')](_0x53b4e2));_0x281870(_0x53b4e2);})[_0x5ff9('0x16')](function(_0x354058){logger[_0x5ff9('0x12')](_0x5ff9('0x21'),_0x354058[_0x5ff9('0x14')],_0x18afbd);_0x5e4f99(_0x14bc17[_0x5ff9('0x12')](0x1f4,_0x354058['message']));});});};exports[_0x5ff9('0x23')]=function(_0x2d852c){var _0x38963e=this;return new Promise(function(_0x145f59,_0x16a6ff){return db['CmHopperBlack'][_0x5ff9('0x24')](_0x2d852c['body'],{'raw':_0x2d852c[_0x5ff9('0x19')]?_0x2d852c[_0x5ff9('0x19')][_0x5ff9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d852c[_0x5ff9('0x19')]?_0x2d852c['options']['where']||null:null,'attributes':_0x2d852c[_0x5ff9('0x19')]?_0x2d852c[_0x5ff9('0x19')]['attributes']||null:null,'limit':_0x2d852c[_0x5ff9('0x19')]?_0x2d852c[_0x5ff9('0x19')][_0x5ff9('0x1c')]||null:null})[_0x5ff9('0xc')](function(_0x4b54b7){logger['info'](_0x5ff9('0x23'),_0x2d852c);logger['debug'](_0x5ff9('0x23'),_0x2d852c,JSON['stringify'](_0x4b54b7));_0x145f59(_0x4b54b7);})[_0x5ff9('0x16')](function(_0x150167){logger[_0x5ff9('0x12')](_0x5ff9('0x23'),_0x150167[_0x5ff9('0x14')],_0x2d852c);_0x16a6ff(_0x38963e['error'](0x1f4,_0x150167[_0x5ff9('0x14')]));});});};exports[_0x5ff9('0x25')]=function(_0x1cb08c){var _0x129cf4=this;return new Promise(function(_0x1e29d7,_0x4740f5){return db['CmHopperBlack'][_0x5ff9('0x26')]({'where':_0x1cb08c['options']?_0x1cb08c[_0x5ff9('0x19')][_0x5ff9('0x1b')]||null:null})['then'](function(_0x39d591){logger[_0x5ff9('0xd')](_0x5ff9('0x25'),_0x1cb08c);logger[_0x5ff9('0x10')](_0x5ff9('0x25'),_0x1cb08c,JSON[_0x5ff9('0x22')](_0x39d591));_0x1e29d7(_0x39d591);})[_0x5ff9('0x16')](function(_0x2a9a24){logger[_0x5ff9('0x12')](_0x5ff9('0x25'),_0x2a9a24['message'],_0x1cb08c);_0x4740f5(_0x129cf4['error'](0x1f4,_0x2a9a24[_0x5ff9('0x14')]));});});}; \ No newline at end of file +var _0x7881=['where','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','limit','debug','destroy','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','findAll','options','raw'];(function(_0x54f9b0,_0x3456d8){var _0x466f2b=function(_0x2819a6){while(--_0x2819a6){_0x54f9b0['push'](_0x54f9b0['shift']());}};_0x466f2b(++_0x3456d8);}(_0x7881,0xad));var _0x1788=function(_0x1dcdc3,_0x333fe9){_0x1dcdc3=_0x1dcdc3-0x0;var _0x2df8ae=_0x7881[_0x1dcdc3];return _0x2df8ae;};'use strict';var _=require(_0x1788('0x0'));var util=require(_0x1788('0x1'));var moment=require('moment');var BPromise=require(_0x1788('0x2'));var rs=require(_0x1788('0x3'));var fs=require('fs');var Redis=require(_0x1788('0x4'));var db=require(_0x1788('0x5'))['db'];var utils=require(_0x1788('0x6'));var logger=require(_0x1788('0x7'))(_0x1788('0x8'));var config=require(_0x1788('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1788('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a2d1e,_0x253394,_0x2df8fe){return new BPromise(function(_0x26f08a,_0xc2e523){return client[_0x1788('0xb')](_0x4a2d1e,_0x2df8fe)[_0x1788('0xc')](function(_0xc1e1c){logger[_0x1788('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x253394,_0x1788('0xe'));logger['debug'](_0x1788('0xf'),_0x253394,_0x1788('0xe'),JSON[_0x1788('0x10')](_0xc1e1c));if(_0xc1e1c[_0x1788('0x11')]){if(_0xc1e1c[_0x1788('0x11')][_0x1788('0x12')]===0x1f4){logger['error'](_0x1788('0x13'),_0x253394,_0xc1e1c[_0x1788('0x11')][_0x1788('0x14')]);return _0xc2e523(_0xc1e1c[_0x1788('0x11')]['message']);}logger[_0x1788('0x11')](_0x1788('0x13'),_0x253394,_0xc1e1c['error'][_0x1788('0x14')]);return _0x26f08a(_0xc1e1c[_0x1788('0x11')][_0x1788('0x14')]);}else{logger[_0x1788('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x253394,_0x1788('0xe'));_0x26f08a(_0xc1e1c[_0x1788('0x15')]['message']);}})[_0x1788('0x16')](function(_0x35f6af){logger[_0x1788('0x11')](_0x1788('0x13'),_0x253394,_0x35f6af);_0xc2e523(_0x35f6af);});});}exports['GetCmHopperBlack']=function(_0xce3ece){var _0x1c1ceb=this;return new Promise(function(_0x4cebf8,_0x4ef2f6){return db[_0x1788('0x17')][_0x1788('0x18')]({'raw':_0xce3ece[_0x1788('0x19')]?_0xce3ece[_0x1788('0x19')][_0x1788('0x1a')]===undefined?!![]:![]:!![],'where':_0xce3ece[_0x1788('0x19')]?_0xce3ece['options'][_0x1788('0x1b')]||null:null,'attributes':_0xce3ece['options']?_0xce3ece['options'][_0x1788('0x1c')]||null:null,'limit':_0xce3ece[_0x1788('0x19')]?_0xce3ece[_0x1788('0x19')]['limit']||null:null,'include':_0xce3ece['options']?_0xce3ece[_0x1788('0x19')][_0x1788('0x1d')]?_[_0x1788('0x1e')](_0xce3ece[_0x1788('0x19')][_0x1788('0x1d')],function(_0x216520){return{'model':db[_0x216520[_0x1788('0x1f')]],'as':_0x216520['as'],'attributes':_0x216520[_0x1788('0x1c')],'include':_0x216520['include']?_['map'](_0x216520[_0x1788('0x1d')],function(_0x26e9a9){return{'model':db[_0x26e9a9[_0x1788('0x1f')]],'as':_0x26e9a9['as'],'attributes':_0x26e9a9['attributes'],'include':_0x26e9a9[_0x1788('0x1d')]?_[_0x1788('0x1e')](_0x26e9a9['include'],function(_0x58817c){return{'model':db[_0x58817c['model']],'as':_0x58817c['as'],'attributes':_0x58817c[_0x1788('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8306c){logger['info'](_0x1788('0x20'),_0xce3ece);logger['debug']('GetCmHopperBlack',_0xce3ece,JSON[_0x1788('0x10')](_0x8306c));_0x4cebf8(_0x8306c);})['catch'](function(_0x4b9882){logger[_0x1788('0x11')](_0x1788('0x20'),_0x4b9882['message'],_0xce3ece);_0x4ef2f6(_0x1c1ceb[_0x1788('0x11')](0x1f4,_0x4b9882[_0x1788('0x14')]));});});};exports[_0x1788('0x21')]=function(_0x2c54a8){var _0x3ef92c=this;return new Promise(function(_0x421df8,_0x55c063){return db[_0x1788('0x17')][_0x1788('0x22')](_0x2c54a8[_0x1788('0x23')],{'raw':_0x2c54a8['options']?_0x2c54a8[_0x1788('0x19')][_0x1788('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c54a8[_0x1788('0x19')]?_0x2c54a8[_0x1788('0x19')][_0x1788('0x1b')]||null:null,'attributes':_0x2c54a8['options']?_0x2c54a8[_0x1788('0x19')][_0x1788('0x1c')]||null:null,'limit':_0x2c54a8[_0x1788('0x19')]?_0x2c54a8[_0x1788('0x19')][_0x1788('0x24')]||null:null})[_0x1788('0xc')](function(_0x3d8891){logger['info']('UpdateCmHopperBlack',_0x2c54a8);logger[_0x1788('0x25')](_0x1788('0x21'),_0x2c54a8,JSON[_0x1788('0x10')](_0x3d8891));_0x421df8(_0x3d8891);})['catch'](function(_0x12a656){logger[_0x1788('0x11')](_0x1788('0x21'),_0x12a656['message'],_0x2c54a8);_0x55c063(_0x3ef92c[_0x1788('0x11')](0x1f4,_0x12a656['message']));});});};exports['DestroyCmHopperBlack']=function(_0x2b77d3){var _0x4e1ded=this;return new Promise(function(_0x1ca9c3,_0x4195d5){return db['CmHopperBlack'][_0x1788('0x26')]({'where':_0x2b77d3[_0x1788('0x19')]?_0x2b77d3[_0x1788('0x19')]['where']||null:null})[_0x1788('0xc')](function(_0x56e454){logger[_0x1788('0xd')](_0x1788('0x27'),_0x2b77d3);logger[_0x1788('0x25')](_0x1788('0x27'),_0x2b77d3,JSON[_0x1788('0x10')](_0x56e454));_0x1ca9c3(_0x56e454);})[_0x1788('0x16')](function(_0x3de2e9){logger[_0x1788('0x11')](_0x1788('0x27'),_0x3de2e9[_0x1788('0x14')],_0x2b77d3);_0x4195d5(_0x4e1ded['error'](0x1f4,_0x3de2e9[_0x1788('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0c3bbd0..ca24eeb 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x3c083b,_0x549e68){var _0x1c4f50=function(_0x49f5aa){while(--_0x49f5aa){_0x3c083b['push'](_0x3c083b['shift']());}};_0x1c4f50(++_0x549e68);}(_0x687b,0x14a));var _0xb687=function(_0x27c248,_0x384dff){_0x27c248=_0x27c248-0x0;var _0x1b2fc2=_0x687b[_0x27c248];return _0x1b2fc2;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller['destroy']);module[_0xb687('0x13')]=router; \ No newline at end of file +var _0x1db9=['isAuthenticated','describe','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe'];(function(_0xd5fa88,_0x1a233d){var _0x3cdd3a=function(_0xc43d1e){while(--_0xc43d1e){_0xd5fa88['push'](_0xd5fa88['shift']());}};_0x3cdd3a(++_0x1a233d);}(_0x1db9,0x176));var _0x91db=function(_0x309403,_0x103920){_0x309403=_0x309403-0x0;var _0x34400e=_0x1db9[_0x309403];return _0x34400e;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91db('0x6'));var interaction=require(_0x91db('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x91db('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x91db('0x8')](_0x91db('0x9'),auth[_0x91db('0xa')](),controller[_0x91db('0xb')]);router[_0x91db('0x8')]('/:id',auth[_0x91db('0xa')](),controller['show']);router[_0x91db('0xc')](_0x91db('0xd'),auth[_0x91db('0xa')](),controller['update']);router[_0x91db('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x91db('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ea064a7..70e3a68 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.attributes.js +++ b/server/api/cmHopperFinal/cmHopperFinal.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59fb=['setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime'];(function(_0x657d85,_0x46b625){var _0x2429ee=function(_0x50e639){while(--_0x50e639){_0x657d85['push'](_0x657d85['shift']());}};_0x2429ee(++_0x46b625);}(_0x59fb,0x1e4));var _0xb59f=function(_0x2cce72,_0x432665){_0x2cce72=_0x2cce72-0x0;var _0xe78e46=_0x59fb[_0x2cce72];return _0xe78e46;};'use strict';var Sequelize=require(_0xb59f('0x0'));var moment=require(_0xb59f('0x1'));module[_0xb59f('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb59f('0x3')]},'scheduledat':{'type':Sequelize[_0xb59f('0x4')]},'countbusyretry':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb59f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb59f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb59f('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb59f('0x4')]},'responsetime':{'type':Sequelize[_0xb59f('0x4')]},'answertime':{'type':Sequelize[_0xb59f('0x4')]},'droptime':{'type':Sequelize[_0xb59f('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb59f('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb59f('0x3')]},'disposition':{'type':Sequelize[_0xb59f('0x3')]},'secondDisposition':{'type':Sequelize[_0xb59f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb59f('0x3')]},'dispositionat':{'type':Sequelize[_0xb59f('0x4')],'set':function(_0x24a88d){var _0x3272dd=this[_0xb59f('0x6')](_0xb59f('0x7'));if(_0x3272dd&&_0x24a88d){this[_0xb59f('0x8')](_0xb59f('0x9'),moment(_0x24a88d)[_0xb59f('0xa')](moment(_0x3272dd),'seconds'));}}},'amd':{'type':Sequelize[_0xb59f('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb59f('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb59f('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb59f('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xb59f('0x4')]},'callback':{'type':Sequelize[_0xb59f('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb59f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb59f('0x4')]},'deleted':{'type':Sequelize[_0xb59f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb59f('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb59f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb59f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7b71=['DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','exports','INTEGER','STRING'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x7b71,0x7f));var _0x17b7=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x7b71[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x17b7('0x0')]={'state':{'type':Sequelize[_0x17b7('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x17b7('0x2')]},'scheduledat':{'type':Sequelize[_0x17b7('0x3')]},'countbusyretry':{'type':Sequelize[_0x17b7('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x17b7('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x17b7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x17b7('0x2')]},'starttime':{'type':Sequelize[_0x17b7('0x3')]},'responsetime':{'type':Sequelize[_0x17b7('0x3')]},'answertime':{'type':Sequelize[_0x17b7('0x3')]},'droptime':{'type':Sequelize[_0x17b7('0x3')]},'endtime':{'type':Sequelize[_0x17b7('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x17b7('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x17b7('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x17b7('0x2')]},'campaigntype':{'type':Sequelize[_0x17b7('0x2')]},'membername':{'type':Sequelize[_0x17b7('0x2')]},'reason':{'type':Sequelize[_0x17b7('0x2')]},'disposition':{'type':Sequelize[_0x17b7('0x2')]},'secondDisposition':{'type':Sequelize[_0x17b7('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x17b7('0x3')],'set':function(_0x28d118){var _0x1b8f23=this[_0x17b7('0x4')](_0x17b7('0x5'));if(_0x1b8f23&&_0x28d118){this[_0x17b7('0x6')]('followuptime',moment(_0x28d118)[_0x17b7('0x7')](moment(_0x1b8f23),_0x17b7('0x8')));}}},'amd':{'type':Sequelize[_0x17b7('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x17b7('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x17b7('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x17b7('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x17b7('0x3')]},'callback':{'type':Sequelize[_0x17b7('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x17b7('0x3')]},'deleted':{'type':Sequelize[_0x17b7('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x17b7('0x3')]},'recallme':{'type':Sequelize[_0x17b7('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x17b7('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x17b7('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 38eed74..2a92828 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','CmHopperFinal','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','noAnswerContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','select'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4975,0x86));var _0x5497=function(_0x52756d,_0x41224e){_0x52756d=_0x52756d-0x0;var _0xb0b3cc=_0x4975[_0x52756d];return _0xb0b3cc;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['CmHopperFinal'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['describe']()[_0x5497('0x24')](respondWithResult(_0x466287,null))[_0x5497('0x40')](handleError(_0x466287,null));};exports[_0x5497('0x23')]=function(_0x52a189,_0x3e4da2){if(_0x52a189['body'][_0x5497('0x46')]){delete _0x52a189[_0x5497('0x47')][_0x5497('0x46')];}return db['CmHopperFinal'][_0x5497('0x44')]({'where':{'uniqueid':_0x52a189[_0x5497('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e4da2,null))[_0x5497('0x24')](saveUpdates(_0x52a189['body'],null))[_0x5497('0x24')](respondWithResult(_0x3e4da2,null))['catch'](handleError(_0x3e4da2,null));};exports[_0x5497('0x48')]=function(_0x400860,_0x26fd9f,_0xf07541){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x400860[_0x5497('0x42')]['id']},'attributes':[[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize'][_0x5497('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x50')))),_0x5497('0x51')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x52')))),_0x5497('0x53')],[db['sequelize']['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x56')))),_0x5497('0x57')]]})[_0x5497('0x24')](handleEntityNotFound(_0x26fd9f,null))[_0x5497('0x24')](respondWithResult(_0x26fd9f,null))[_0x5497('0x40')](handleError(_0x26fd9f,null));};exports[_0x5497('0x58')]=function(_0x573f93,_0x18b30c,_0x3b0350){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'CampaignId':_0x573f93['params']['id']},'attributes':[[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x5b')))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x51')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x53')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x56')))),_0x5497('0x57')]]})['then'](handleEntityNotFound(_0x18b30c,null))[_0x5497('0x24')](respondWithResult(_0x18b30c,null))[_0x5497('0x40')](handleError(_0x18b30c,null));};exports[_0x5497('0x5c')]=function(_0x4ef195,_0x5794ff,_0x589008){return db[_0x5497('0x5d')][_0x5497('0x44')]({'where':{'id':_0x4ef195['params']['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x5794ff,null))[_0x5497('0x24')](function(_0x21c715){var _0x286af8;if(_0x21c715){_0x286af8=squel['insert']()[_0x5497('0x5e')](_0x5497('0x5f'))[_0x5497('0x60')](['phone',_0x5497('0x61'),_0x5497('0x62'),'ListId',_0x5497('0x63'),_0x5497('0x64'),_0x5497('0x65')],squel['select']()['field'](_0x5497('0x66'),_0x5497('0x67'))[_0x5497('0x68')](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x6d'),_0x5497('0x63'))[_0x5497('0x68')]('NOW()',_0x5497('0x64'))[_0x5497('0x68')]('NOW()',_0x5497('0x65'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4ef195[_0x5497('0x47')][_0x5497('0x73')]['toString']())[_0x5497('0x37')](_0x5497('0x74'))[_0x5497('0x37')](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x67'))['from'](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195[_0x5497('0x42')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x5497('0x76'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id']['toString']())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x286af8);}return[];})[_0x5497('0x24')](respondWithResult(_0x5794ff,null))[_0x5497('0x40')](handleError(_0x5794ff,null));};exports[_0x5497('0x79')]=function(_0x4c41c4,_0x1515f1,_0x4118ec){return db[_0x5497('0x7a')][_0x5497('0x44')]({'where':{'id':_0x4c41c4[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x1515f1,null))['then'](function(_0x1ef7fc){var _0x5903b7;if(_0x1ef7fc){_0x5903b7=squel[_0x5497('0x7b')]()[_0x5497('0x5e')](_0x5497('0x5f'))['fromQuery'](['phone',_0x5497('0x61'),_0x5497('0x62'),_0x5497('0x6c'),_0x5497('0x7c'),_0x5497('0x64'),_0x5497('0x65')],squel[_0x5497('0x7d')]()[_0x5497('0x68')]('ANY_VALUE(calleridnum)','phone')['field'](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x7e'),_0x5497('0x7c'))[_0x5497('0x68')](_0x5497('0x69'),'createdAt')['field']('NOW()','updatedAt')['from'](_0x5497('0x6f'))['where'](_0x5497('0x7f'),_0x4c41c4['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4c41c4[_0x5497('0x47')][_0x5497('0x73')][_0x5497('0x71')]())['where'](_0x5497('0x74'))['where'](_0x5497('0x75'),squel[_0x5497('0x7d')]()[_0x5497('0x68')](_0x5497('0x67'))[_0x5497('0x6e')](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]()))['where'](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x76'))['from'](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x5903b7);}return[];})[_0x5497('0x24')](respondWithResult(_0x1515f1,null))[_0x5497('0x40')](handleError(_0x1515f1,null));};exports['checkContactHopper']=function(_0x37c17e,_0x163b5b,_0x3a31be){return db[_0x5497('0x80')][_0x5497('0x81')]({'where':{'VoiceQueueId':_0x37c17e['body'][_0x5497('0x63')],'CampaignId':_0x37c17e[_0x5497('0x47')]['CampaignId'],'ContactId':_0x37c17e['body'][_0x5497('0x62')]}})[_0x5497('0x24')](handleEntityNotFound(_0x163b5b,null))[_0x5497('0x24')](function(_0x14f693){if(_0x14f693){return _0x14f693;}return null;})[_0x5497('0x24')](respondWithResult(_0x163b5b,null))['catch'](handleError(_0x163b5b,null));}; \ No newline at end of file +var _0xeda8=['calleridnum','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','select'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xeda8,0x104));var _0x8eda=function(_0x88a8cf,_0x4b4a1f){_0x88a8cf=_0x88a8cf-0x0;var _0x31e3bd=_0xeda8[_0x88a8cf];return _0x31e3bd;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}exports[_0x8eda('0x28')]=function(_0x1dd12,_0x4cdd2e){var _0x1616ea={},_0x11a999={},_0x5dd315={'count':0x0,'rows':[]};var _0x27d2ce=_[_0x8eda('0x29')](db[_0x8eda('0x2a')][_0x8eda('0x2b')],function(_0x53274e){return{'name':_0x53274e['fieldName'],'type':_0x53274e['type'][_0x8eda('0x2c')]};});_0x11a999[_0x8eda('0x2d')]=_[_0x8eda('0x29')](_0x27d2ce,'name');_0x11a999['query']=_['keys'](_0x1dd12[_0x8eda('0x2e')]);_0x11a999[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x11a999['model'],_0x11a999['query']);_0x1616ea['attributes']=_[_0x8eda('0x30')](_0x11a999[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x31')]));_0x1616ea[_0x8eda('0x32')]=_0x1616ea[_0x8eda('0x32')][_0x8eda('0x33')]?_0x1616ea[_0x8eda('0x32')]:_0x11a999[_0x8eda('0x2d')];if(!_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x34')](_0x8eda('0x35'))){_0x1616ea[_0x8eda('0x1e')]=qs['limit'](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x1e')]);_0x1616ea[_0x8eda('0x1d')]=qs['offset'](_0x1dd12['query'][_0x8eda('0x1d')]);}_0x1616ea[_0x8eda('0x36')]=qs[_0x8eda('0x37')](_0x1dd12[_0x8eda('0x2e')]['sort']);_0x1616ea[_0x8eda('0x38')]=qs[_0x8eda('0x2f')](_[_0x8eda('0x39')](_0x1dd12[_0x8eda('0x2e')],_0x11a999[_0x8eda('0x2f')]),_0x27d2ce);if(_0x1dd12[_0x8eda('0x2e')]['filter']){_0x1616ea[_0x8eda('0x38')]=_[_0x8eda('0x3a')](_0x1616ea[_0x8eda('0x38')],{'$or':_[_0x8eda('0x29')](_0x27d2ce,function(_0x261e12){if(_0x261e12[_0x8eda('0x3b')]!=='VIRTUAL'){var _0x1067eb={};_0x1067eb[_0x261e12[_0x8eda('0x26')]]={'$like':'%'+_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3c')]+'%'};return _0x1067eb;}})});}_0x1616ea=_[_0x8eda('0x3a')]({},_0x1616ea,_0x1dd12['options']);var _0x17ee80={'where':_0x1616ea[_0x8eda('0x38')]};return db[_0x8eda('0x2a')]['count'](_0x17ee80)[_0x8eda('0x24')](function(_0x5d361e){_0x5dd315[_0x8eda('0x1c')]=_0x5d361e;if(_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3d')]){_0x1616ea[_0x8eda('0x3e')]=[{'all':!![]}];}return db[_0x8eda('0x2a')]['findAll'](_0x1616ea);})['then'](function(_0xbf14a1){_0x5dd315[_0x8eda('0x3f')]=_0xbf14a1;return _0x5dd315;})[_0x8eda('0x24')](respondWithFilteredResult(_0x4cdd2e,_0x1616ea))[_0x8eda('0x40')](handleError(_0x4cdd2e,null));};exports[_0x8eda('0x41')]=function(_0x13b3bc,_0x18b043){var _0xcb6164={'raw':!![],'where':{'id':_0x13b3bc[_0x8eda('0x42')]['id']}},_0x184590={};_0x184590[_0x8eda('0x2d')]=_[_0x8eda('0x43')](db[_0x8eda('0x2a')][_0x8eda('0x2b')]);_0x184590[_0x8eda('0x2e')]=_[_0x8eda('0x43')](_0x13b3bc[_0x8eda('0x2e')]);_0x184590[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x184590['model'],_0x184590[_0x8eda('0x2e')]);_0xcb6164[_0x8eda('0x32')]=_['intersection'](_0x184590[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x13b3bc['query'][_0x8eda('0x31')]));_0xcb6164[_0x8eda('0x32')]=_0xcb6164['attributes'][_0x8eda('0x33')]?_0xcb6164[_0x8eda('0x32')]:_0x184590[_0x8eda('0x2d')];if(_0x13b3bc['query'][_0x8eda('0x3d')]){_0xcb6164[_0x8eda('0x3e')]=[{'all':!![]}];}_0xcb6164=_[_0x8eda('0x3a')]({},_0xcb6164,_0x13b3bc[_0x8eda('0x44')]);return db[_0x8eda('0x2a')][_0x8eda('0x45')](_0xcb6164)[_0x8eda('0x24')](handleEntityNotFound(_0x18b043,null))['then'](respondWithResult(_0x18b043,null))[_0x8eda('0x40')](handleError(_0x18b043,null));};exports['describe']=function(_0xcde3e,_0x52b026){return db[_0x8eda('0x2a')]['describe']()[_0x8eda('0x24')](respondWithResult(_0x52b026,null))['catch'](handleError(_0x52b026,null));};exports[_0x8eda('0x23')]=function(_0x3aca19,_0xf445){if(_0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')]){delete _0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')];}return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'uniqueid':_0x3aca19[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0xf445,null))[_0x8eda('0x24')](saveUpdates(_0x3aca19['body'],null))[_0x8eda('0x24')](respondWithResult(_0xf445,null))[_0x8eda('0x40')](handleError(_0xf445,null));};exports[_0x8eda('0x48')]=function(_0x3259de,_0x33ba39,_0x389399){return db[_0x8eda('0x2a')][_0x8eda('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x3259de[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),'noAnswerContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x8eda('0x4f')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x50')))),'congestionContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x53')))),'abandonedContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x8eda('0x54')],[db['sequelize']['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x55')))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x33ba39,null))['then'](respondWithResult(_0x33ba39,null))[_0x8eda('0x40')](handleError(_0x33ba39,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xdd71ce,_0x4ba827,_0xfb98bf){return db['CmHopperFinal'][_0x8eda('0x49')]({'raw':![],'where':{'CampaignId':_0xdd71ce[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),_0x8eda('0x57')],[db['sequelize']['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x58')))),'busyContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eda('0x59')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')]['literal'](_0x8eda('0x53')))),_0x8eda('0x5a')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x8eda('0x5b')))),_0x8eda('0x54')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x4ba827,null))['then'](respondWithResult(_0x4ba827,null))[_0x8eda('0x40')](handleError(_0x4ba827,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x47f57c,_0x49d1a1,_0x5e66cd){return db[_0x8eda('0x5c')][_0x8eda('0x45')]({'where':{'id':_0x47f57c[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x49d1a1,null))[_0x8eda('0x24')](function(_0xe5d324){var _0x589c2f;if(_0xe5d324){_0x589c2f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')](['phone',_0x8eda('0x61'),_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),_0x8eda('0x65'),_0x8eda('0x66')],squel['select']()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),_0x8eda('0x61'))[_0x8eda('0x67')](_0x8eda('0x6b'),_0x8eda('0x62'))[_0x8eda('0x67')](_0x8eda('0x6c'),_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x6d'),'VoiceQueueId')['field'](_0x8eda('0x6a'),_0x8eda('0x65'))[_0x8eda('0x67')](_0x8eda('0x6a'),'updatedAt')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x70'),_0x47f57c['params']['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x47f57c['body'][_0x8eda('0x73')][_0x8eda('0x71')]())[_0x8eda('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')]('phone')['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c[_0x8eda('0x42')]['id']['toString']()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x76'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c['params']['id']['toString']())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x589c2f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x49d1a1,null))[_0x8eda('0x40')](handleError(_0x49d1a1,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1bbe8b,_0x437c6f,_0x1006b1){return db['Campaign'][_0x8eda('0x45')]({'where':{'id':_0x1bbe8b[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x437c6f,null))[_0x8eda('0x24')](function(_0x33350e){var _0x3e245f;if(_0x33350e){_0x3e245f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')]([_0x8eda('0x69'),'scheduledAt',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x79'),_0x8eda('0x65'),_0x8eda('0x66')],squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x8eda('0x62'))[_0x8eda('0x67')]('ANY_VALUE(ListId)',_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x7a'),'CampaignId')[_0x8eda('0x67')]('NOW()',_0x8eda('0x65'))['field'](_0x8eda('0x6a'),_0x8eda('0x66'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x1bbe8b[_0x8eda('0x46')][_0x8eda('0x73')][_0x8eda('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x69'))['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()['field']('calleridnum')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x3e245f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x437c6f,null))['catch'](handleError(_0x437c6f,null));};exports[_0x8eda('0x7c')]=function(_0x11f734,_0x4cb4e6,_0x5d8512){return db['CmHopper'][_0x8eda('0x7d')]({'where':{'VoiceQueueId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x64')],'CampaignId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x79')],'ContactId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x62')]}})[_0x8eda('0x24')](handleEntityNotFound(_0x4cb4e6,null))[_0x8eda('0x24')](function(_0x1a3993){if(_0x1a3993){return _0x1a3993;}return null;})[_0x8eda('0x24')](respondWithResult(_0x4cb4e6,null))[_0x8eda('0x40')](handleError(_0x4cb4e6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 46ca2ef..c8f18ab 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.model.js +++ b/server/api/cmHopperFinal/cmHopperFinal.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e65=['calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define','cm_hopper_final'];(function(_0x1734c4,_0xb12e9b){var _0x3fa785=function(_0x5a6c9f){while(--_0x5a6c9f){_0x1734c4['push'](_0x1734c4['shift']());}};_0x3fa785(++_0xb12e9b);}(_0x8e65,0x1d0));var _0x58e6=function(_0x25e1ef,_0x296052){_0x25e1ef=_0x25e1ef-0x0;var _0x2754d3=_0x8e65[_0x25e1ef];return _0x2754d3;};'use strict';var _=require(_0x58e6('0x0'));var util=require('util');var logger=require(_0x58e6('0x1'))(_0x58e6('0x2'));var moment=require('moment');var BPromise=require(_0x58e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58e6('0x4'));var rimraf=require('rimraf');var config=require(_0x58e6('0x5'));var attributes=require('./cmHopperFinal.attributes');module[_0x58e6('0x6')]=function(_0x51a255,_0x14362c){return _0x51a255[_0x58e6('0x7')]('CmHopperFinal',attributes,{'tableName':_0x58e6('0x8'),'paranoid':![],'indexes':[{'name':_0x58e6('0x9'),'fields':[_0x58e6('0x9')]},{'name':_0x58e6('0xa'),'fields':[_0x58e6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49b7=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x503aa9,_0x1a23a5){var _0x48981f=function(_0x34bf77){while(--_0x34bf77){_0x503aa9['push'](_0x503aa9['shift']());}};_0x48981f(++_0x1a23a5);}(_0x49b7,0x12d));var _0x749b=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x49b7[_0x2ba740];return _0x358bda;};'use strict';var _=require(_0x749b('0x0'));var util=require(_0x749b('0x1'));var logger=require(_0x749b('0x2'))(_0x749b('0x3'));var moment=require('moment');var BPromise=require(_0x749b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x749b('0x5'));var rimraf=require(_0x749b('0x6'));var config=require(_0x749b('0x7'));var attributes=require(_0x749b('0x8'));module[_0x749b('0x9')]=function(_0x55756f,_0x436da3){return _0x55756f[_0x749b('0xa')](_0x749b('0xb'),attributes,{'tableName':_0x749b('0xc'),'paranoid':![],'indexes':[{'name':_0x749b('0xd'),'fields':[_0x749b('0xd')]},{'name':_0x749b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ad4fed6..8998b37 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x125a9b,_0x3cbf90){var _0x28ed1d=function(_0x41b50a){while(--_0x41b50a){_0x125a9b['push'](_0x125a9b['shift']());}};_0x28ed1d(++_0x3cbf90);}(_0x7a54,0x106));var _0x47a5=function(_0x42dc37,_0x44c5f1){_0x42dc37=_0x42dc37-0x0;var _0x5c795b=_0x7a54[_0x42dc37];return _0x5c795b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x317813,_0x3dd79c){var _0x1d7f73=function(_0x40d24d){while(--_0x40d24d){_0x317813['push'](_0x317813['shift']());}};_0x1d7f73(++_0x3dd79c);}(_0x7a54,0x106));var _0x47a5=function(_0x5b2537,_0x14b036){_0x5b2537=_0x5b2537-0x0;var _0x119301=_0x7a54[_0x5b2537];return _0x119301;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 6919c54..045c720 100644 --- a/server/api/cmHopperFinal/index.js +++ b/server/api/cmHopperFinal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4ad=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','index','/describe','describe','get','/:id','isAuthenticated','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update'];(function(_0x26b55c,_0x1cb042){var _0x8f1b3b=function(_0x3ee3dc){while(--_0x3ee3dc){_0x26b55c['push'](_0x26b55c['shift']());}};_0x8f1b3b(++_0x1cb042);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x6baa84,_0x48ccd6){_0x6baa84=_0x6baa84-0x0;var _0x49c292=_0xd4ad[_0x6baa84];return _0x49c292;};'use strict';var multer=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var path=require(_0xdd4a('0x2'));var timeout=require(_0xdd4a('0x3'));var express=require(_0xdd4a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd4a('0x5'));var interaction=require(_0xdd4a('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdd4a('0x7')]);router['get'](_0xdd4a('0x8'),auth['isAuthenticated'](),controller[_0xdd4a('0x9')]);router[_0xdd4a('0xa')](_0xdd4a('0xb'),auth[_0xdd4a('0xc')](),controller[_0xdd4a('0xd')]);router[_0xdd4a('0xa')]('/voice/queue/countAttributes/:id',auth[_0xdd4a('0xc')](),controller[_0xdd4a('0xe')]);router[_0xdd4a('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xdd4a('0xf')]);router[_0xdd4a('0x10')]('/voice/queue/moveContacts/:id',auth[_0xdd4a('0xc')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xdd4a('0x10')](_0xdd4a('0x11'),auth[_0xdd4a('0xc')](),controller[_0xdd4a('0x12')]);router[_0xdd4a('0x10')](_0xdd4a('0x13'),auth[_0xdd4a('0xc')](),controller['checkContactHopper']);router[_0xdd4a('0x14')](_0xdd4a('0xb'),auth[_0xdd4a('0xc')](),controller[_0xdd4a('0x15')]);module[_0xdd4a('0x16')]=router; \ No newline at end of file +var _0xe540=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util'];(function(_0x1b546c,_0x312a35){var _0x5522f8=function(_0x44f53d){while(--_0x44f53d){_0x1b546c['push'](_0x1b546c['shift']());}};_0x5522f8(++_0x312a35);}(_0xe540,0xe6));var _0x0e54=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xe540[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0x0e54('0x0'));var util=require(_0x0e54('0x1'));var path=require('path');var timeout=require(_0x0e54('0x2'));var express=require(_0x0e54('0x3'));var router=express[_0x0e54('0x4')]();var fs_extra=require(_0x0e54('0x5'));var auth=require(_0x0e54('0x6'));var interaction=require(_0x0e54('0x7'));var config=require(_0x0e54('0x8'));var controller=require(_0x0e54('0x9'));router[_0x0e54('0xa')]('/',auth[_0x0e54('0xb')](),controller['index']);router[_0x0e54('0xa')](_0x0e54('0xc'),auth[_0x0e54('0xb')](),controller[_0x0e54('0xd')]);router['get'](_0x0e54('0xe'),auth[_0x0e54('0xb')](),controller[_0x0e54('0xf')]);router[_0x0e54('0xa')](_0x0e54('0x10'),auth[_0x0e54('0xb')](),controller[_0x0e54('0x11')]);router[_0x0e54('0xa')](_0x0e54('0x12'),auth[_0x0e54('0xb')](),controller[_0x0e54('0x13')]);router[_0x0e54('0x14')](_0x0e54('0x15'),auth[_0x0e54('0xb')](),controller[_0x0e54('0x16')]);router['post'](_0x0e54('0x17'),auth[_0x0e54('0xb')](),controller[_0x0e54('0x18')]);router[_0x0e54('0x14')](_0x0e54('0x19'),auth[_0x0e54('0xb')](),controller[_0x0e54('0x1a')]);router['put'](_0x0e54('0xe'),auth[_0x0e54('0xb')](),controller[_0x0e54('0x1b')]);module[_0x0e54('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 99ce3ba..9dbd7a1 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.attributes.js +++ b/server/api/cmHopperHistory/cmHopperHistory.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ad1=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x2ad1,0x17d));var _0x12ad=function(_0x30b8ca,_0x58e5aa){_0x30b8ca=_0x30b8ca-0x0;var _0x4ebc36=_0x2ad1[_0x30b8ca];return _0x4ebc36;};'use strict';var Sequelize=require(_0x12ad('0x0'));module[_0x12ad('0x1')]={'state':{'type':Sequelize[_0x12ad('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x12ad('0x3')]},'scheduledat':{'type':Sequelize[_0x12ad('0x4')]},'countbusyretry':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x12ad('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x12ad('0x3')]},'originatecalleridname':{'type':Sequelize[_0x12ad('0x3')]},'calleridnum':{'type':Sequelize[_0x12ad('0x3')]},'calleridname':{'type':Sequelize[_0x12ad('0x3')]},'starttime':{'type':Sequelize[_0x12ad('0x4')]},'responsetime':{'type':Sequelize[_0x12ad('0x4')]},'answertime':{'type':Sequelize[_0x12ad('0x4')]},'droptime':{'type':Sequelize[_0x12ad('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x12ad('0x3')]},'campaign':{'type':Sequelize[_0x12ad('0x3')]},'campaigntype':{'type':Sequelize[_0x12ad('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x12ad('0x3')]},'amd':{'type':Sequelize[_0x12ad('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x12ad('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x12ad('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x12ad('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x12ad('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x12ad('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x12ad('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x12ad('0x3')]}}; \ No newline at end of file +var _0x757b=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x56212b,_0x2bac02){var _0xb56e8a=function(_0xcf0f09){while(--_0xcf0f09){_0x56212b['push'](_0x56212b['shift']());}};_0xb56e8a(++_0x2bac02);}(_0x757b,0x7a));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb757('0x0'));module['exports']={'state':{'type':Sequelize[_0xb757('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb757('0x2')]},'scheduledat':{'type':Sequelize[_0xb757('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb757('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb757('0x2')]},'calleridnum':{'type':Sequelize[_0xb757('0x2')]},'calleridname':{'type':Sequelize[_0xb757('0x2')]},'starttime':{'type':Sequelize[_0xb757('0x3')]},'responsetime':{'type':Sequelize[_0xb757('0x3')]},'answertime':{'type':Sequelize[_0xb757('0x3')]},'droptime':{'type':Sequelize[_0xb757('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xb757('0x2')]},'campaigntype':{'type':Sequelize[_0xb757('0x2')]},'membername':{'type':Sequelize[_0xb757('0x2')]},'reason':{'type':Sequelize[_0xb757('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb757('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb757('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb757('0x3')]},'recallme':{'type':Sequelize[_0xb757('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb757('0x3')]},'edited':{'type':Sequelize[_0xb757('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb757('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb757('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 7f9b25f..c28ba19 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.controller.js +++ b/server/api/cmHopperHistory/cmHopperHistory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8ea=['map','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','CmHopperHistory','then','includeAll','rows','catch','show','params','find','create','body','describe','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','send','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf8ea,0x1dd));var _0xaf8e=function(_0xfe6b2,_0x1ae114){_0xfe6b2=_0xfe6b2-0x0;var _0x12e25e=_0xf8ea[_0xfe6b2];return _0x12e25e;};'use strict';var emlformat=require(_0xaf8e('0x0'));var rimraf=require(_0xaf8e('0x1'));var zipdir=require(_0xaf8e('0x2'));var jsonpatch=require(_0xaf8e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaf8e('0x4'));var Mustache=require('mustache');var util=require(_0xaf8e('0x5'));var path=require('path');var sox=require(_0xaf8e('0x6'));var csv=require(_0xaf8e('0x7'));var ejs=require(_0xaf8e('0x8'));var fs=require('fs');var fs_extra=require(_0xaf8e('0x9'));var _=require(_0xaf8e('0xa'));var squel=require('squel');var crypto=require(_0xaf8e('0xb'));var jsforce=require(_0xaf8e('0xc'));var deskjs=require(_0xaf8e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf8e('0xe'));var Redis=require(_0xaf8e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xaf8e('0x10'));var as=require(_0xaf8e('0x11'));var hardwareService=require(_0xaf8e('0x12'));var logger=require('../../config/logger')(_0xaf8e('0x13'));var utils=require(_0xaf8e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xaf8e('0x15'));var db=require(_0xaf8e('0x16'))['db'];function respondWithStatusCode(_0x10410a,_0x5e84f9){_0x5e84f9=_0x5e84f9||0xcc;return function(_0x5e42c4){if(_0x5e42c4){return _0x10410a['sendStatus'](_0x5e84f9);}return _0x10410a[_0xaf8e('0x17')](_0x5e84f9)['end']();};}function respondWithResult(_0x10be09,_0x2949ba){_0x2949ba=_0x2949ba||0xc8;return function(_0x42dc5a){if(_0x42dc5a){return _0x10be09[_0xaf8e('0x17')](_0x2949ba)[_0xaf8e('0x18')](_0x42dc5a);}};}function respondWithFilteredResult(_0x11b448,_0x5ea335){return function(_0x4357d9){if(_0x4357d9){var _0x33fded=typeof _0x5ea335[_0xaf8e('0x19')]===_0xaf8e('0x1a')&&typeof _0x5ea335[_0xaf8e('0x1b')]===_0xaf8e('0x1a');var _0x15c3b7=_0x4357d9[_0xaf8e('0x1c')];var _0x52ce4b=_0x33fded?0x0:_0x5ea335[_0xaf8e('0x19')];var _0x5b146d=_0x33fded?_0x4357d9[_0xaf8e('0x1c')]:_0x5ea335[_0xaf8e('0x19')]+_0x5ea335[_0xaf8e('0x1b')];var _0x18bcde;if(_0x5b146d>=_0x15c3b7){_0x5b146d=_0x15c3b7;_0x18bcde=0xc8;}else{_0x18bcde=0xce;}_0x11b448[_0xaf8e('0x17')](_0x18bcde);return _0x11b448[_0xaf8e('0x1d')](_0xaf8e('0x1e'),_0x52ce4b+'-'+_0x5b146d+'/'+_0x15c3b7)[_0xaf8e('0x18')](_0x4357d9);}return null;};}function patchUpdates(_0x450daa){return function(_0x2610c5){try{jsonpatch[_0xaf8e('0x1f')](_0x2610c5,_0x450daa,!![]);}catch(_0x431f3a){return BPromise[_0xaf8e('0x20')](_0x431f3a);}return _0x2610c5[_0xaf8e('0x21')]();};}function saveUpdates(_0x3a223d,_0x11f12b){return function(_0x14c0db){if(_0x14c0db){return _0x14c0db['update'](_0x3a223d)['then'](function(_0x33bb44){return _0x33bb44;});}return null;};}function removeEntity(_0x37a1e1,_0x3bdd1d){return function(_0x48d9f3){if(_0x48d9f3){return _0x48d9f3[_0xaf8e('0x22')]()['then'](function(){_0x37a1e1[_0xaf8e('0x17')](0xcc)[_0xaf8e('0x23')]();});}};}function handleEntityNotFound(_0x45c9b5,_0x299add){return function(_0x1a67e7){if(!_0x1a67e7){_0x45c9b5[_0xaf8e('0x24')](0x194);}return _0x1a67e7;};}function handleError(_0x14f331,_0x5354ae){_0x5354ae=_0x5354ae||0x1f4;return function(_0x1e0442){logger['error'](_0x1e0442[_0xaf8e('0x25')]);if(_0x1e0442[_0xaf8e('0x26')]){delete _0x1e0442[_0xaf8e('0x26')];}_0x14f331['status'](_0x5354ae)[_0xaf8e('0x27')](_0x1e0442);};}exports[_0xaf8e('0x28')]=function(_0x58958b,_0x2b195a){var _0x21550e={},_0x49d926={},_0x2971f0={'count':0x0,'rows':[]};var _0x4a133a=_[_0xaf8e('0x29')](db['CmHopperHistory'][_0xaf8e('0x2a')],function(_0x3896cb){return{'name':_0x3896cb[_0xaf8e('0x2b')],'type':_0x3896cb[_0xaf8e('0x2c')]['key']};});_0x49d926['model']=_[_0xaf8e('0x29')](_0x4a133a,_0xaf8e('0x26'));_0x49d926[_0xaf8e('0x2d')]=_[_0xaf8e('0x2e')](_0x58958b['query']);_0x49d926['filters']=_[_0xaf8e('0x2f')](_0x49d926[_0xaf8e('0x30')],_0x49d926['query']);_0x21550e['attributes']=_[_0xaf8e('0x2f')](_0x49d926[_0xaf8e('0x30')],qs[_0xaf8e('0x31')](_0x58958b['query']['fields']));_0x21550e[_0xaf8e('0x32')]=_0x21550e[_0xaf8e('0x32')][_0xaf8e('0x33')]?_0x21550e[_0xaf8e('0x32')]:_0x49d926[_0xaf8e('0x30')];if(!_0x58958b[_0xaf8e('0x2d')][_0xaf8e('0x34')](_0xaf8e('0x35'))){_0x21550e['limit']=qs[_0xaf8e('0x1b')](_0x58958b[_0xaf8e('0x2d')][_0xaf8e('0x1b')]);_0x21550e[_0xaf8e('0x19')]=qs['offset'](_0x58958b[_0xaf8e('0x2d')]['offset']);}_0x21550e['order']=qs[_0xaf8e('0x36')](_0x58958b[_0xaf8e('0x2d')]['sort']);_0x21550e[_0xaf8e('0x37')]=qs[_0xaf8e('0x38')](_[_0xaf8e('0x39')](_0x58958b[_0xaf8e('0x2d')],_0x49d926[_0xaf8e('0x38')]),_0x4a133a);if(_0x58958b[_0xaf8e('0x2d')][_0xaf8e('0x3a')]){_0x21550e[_0xaf8e('0x37')]=_['merge'](_0x21550e['where'],{'$or':_[_0xaf8e('0x29')](_0x4a133a,function(_0x3ddcc7){if(_0x3ddcc7[_0xaf8e('0x2c')]!==_0xaf8e('0x3b')){var _0x34312b={};_0x34312b[_0x3ddcc7[_0xaf8e('0x26')]]={'$like':'%'+_0x58958b['query']['filter']+'%'};return _0x34312b;}})});}_0x21550e=_[_0xaf8e('0x3c')]({},_0x21550e,_0x58958b[_0xaf8e('0x3d')]);var _0x1bc9fc={'where':_0x21550e[_0xaf8e('0x37')]};return db[_0xaf8e('0x3e')][_0xaf8e('0x1c')](_0x1bc9fc)[_0xaf8e('0x3f')](function(_0x4fbefb){_0x2971f0[_0xaf8e('0x1c')]=_0x4fbefb;if(_0x58958b['query'][_0xaf8e('0x40')]){_0x21550e['include']=[{'all':!![]}];}return db[_0xaf8e('0x3e')]['findAll'](_0x21550e);})[_0xaf8e('0x3f')](function(_0x11f4e0){_0x2971f0[_0xaf8e('0x41')]=_0x11f4e0;return _0x2971f0;})['then'](respondWithFilteredResult(_0x2b195a,_0x21550e))[_0xaf8e('0x42')](handleError(_0x2b195a,null));};exports[_0xaf8e('0x43')]=function(_0x4105d8,_0x1f709e){var _0x2aab15={'raw':!![],'where':{'id':_0x4105d8[_0xaf8e('0x44')]['id']}},_0x192e83={};_0x192e83[_0xaf8e('0x30')]=_[_0xaf8e('0x2e')](db[_0xaf8e('0x3e')]['rawAttributes']);_0x192e83['query']=_[_0xaf8e('0x2e')](_0x4105d8['query']);_0x192e83[_0xaf8e('0x38')]=_[_0xaf8e('0x2f')](_0x192e83['model'],_0x192e83[_0xaf8e('0x2d')]);_0x2aab15[_0xaf8e('0x32')]=_[_0xaf8e('0x2f')](_0x192e83[_0xaf8e('0x30')],qs[_0xaf8e('0x31')](_0x4105d8[_0xaf8e('0x2d')][_0xaf8e('0x31')]));_0x2aab15[_0xaf8e('0x32')]=_0x2aab15[_0xaf8e('0x32')][_0xaf8e('0x33')]?_0x2aab15['attributes']:_0x192e83['model'];if(_0x4105d8['query'][_0xaf8e('0x40')]){_0x2aab15['include']=[{'all':!![]}];}_0x2aab15=_[_0xaf8e('0x3c')]({},_0x2aab15,_0x4105d8[_0xaf8e('0x3d')]);return db[_0xaf8e('0x3e')][_0xaf8e('0x45')](_0x2aab15)['then'](handleEntityNotFound(_0x1f709e,null))[_0xaf8e('0x3f')](respondWithResult(_0x1f709e,null))[_0xaf8e('0x42')](handleError(_0x1f709e,null));};exports['create']=function(_0x23f02f,_0x486382){return db[_0xaf8e('0x3e')][_0xaf8e('0x46')](_0x23f02f[_0xaf8e('0x47')],{})[_0xaf8e('0x3f')](respondWithResult(_0x486382,0xc9))[_0xaf8e('0x42')](handleError(_0x486382,null));};exports[_0xaf8e('0x48')]=function(_0x253207,_0x2b8362){return db[_0xaf8e('0x3e')][_0xaf8e('0x48')]()[_0xaf8e('0x3f')](respondWithResult(_0x2b8362,null))[_0xaf8e('0x42')](handleError(_0x2b8362,null));};exports[_0xaf8e('0x49')]=function(_0x3e5a6c,_0x4f8833){if(_0x3e5a6c[_0xaf8e('0x47')]['uniqueid']){delete _0x3e5a6c[_0xaf8e('0x47')]['uniqueid'];}return db[_0xaf8e('0x3e')][_0xaf8e('0x45')]({'where':{'uniqueid':_0x3e5a6c[_0xaf8e('0x44')]['id']}})[_0xaf8e('0x3f')](handleEntityNotFound(_0x4f8833,null))[_0xaf8e('0x3f')](saveUpdates(_0x3e5a6c[_0xaf8e('0x47')],null))[_0xaf8e('0x3f')](respondWithResult(_0x4f8833,null))[_0xaf8e('0x42')](handleError(_0x4f8833,null));}; \ No newline at end of file +var _0x4e1c=['update','destroy','then','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','params','keys','catch','create','body','describe','uniqueid','find','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0xb07a26,_0x34a1d5){var _0x11ec61=function(_0x15a65d){while(--_0x15a65d){_0xb07a26['push'](_0xb07a26['shift']());}};_0x11ec61(++_0x34a1d5);}(_0x4e1c,0x10b));var _0xc4e1=function(_0x1f77d8,_0x4174a9){_0x1f77d8=_0x1f77d8-0x0;var _0x2e93c0=_0x4e1c[_0x1f77d8];return _0x2e93c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4e1('0x0'));var zipdir=require(_0xc4e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc4e1('0x2'));var BPromise=require(_0xc4e1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc4e1('0x4'));var sox=require(_0xc4e1('0x5'));var csv=require(_0xc4e1('0x6'));var ejs=require(_0xc4e1('0x7'));var fs=require('fs');var fs_extra=require(_0xc4e1('0x8'));var _=require(_0xc4e1('0x9'));var squel=require(_0xc4e1('0xa'));var crypto=require('crypto');var jsforce=require(_0xc4e1('0xb'));var deskjs=require(_0xc4e1('0xc'));var toCsv=require(_0xc4e1('0x6'));var querystring=require(_0xc4e1('0xd'));var Papa=require(_0xc4e1('0xe'));var Redis=require(_0xc4e1('0xf'));var authService=require(_0xc4e1('0x10'));var qs=require(_0xc4e1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4e1('0x12'));var logger=require(_0xc4e1('0x13'))('api');var utils=require(_0xc4e1('0x14'));var config=require(_0xc4e1('0x15'));var licenseUtil=require(_0xc4e1('0x16'));var db=require(_0xc4e1('0x17'))['db'];function respondWithStatusCode(_0x28c853,_0x4ab740){_0x4ab740=_0x4ab740||0xcc;return function(_0x115553){if(_0x115553){return _0x28c853[_0xc4e1('0x18')](_0x4ab740);}return _0x28c853['status'](_0x4ab740)[_0xc4e1('0x19')]();};}function respondWithResult(_0x3f438f,_0x4049ba){_0x4049ba=_0x4049ba||0xc8;return function(_0x34484b){if(_0x34484b){return _0x3f438f[_0xc4e1('0x1a')](_0x4049ba)['json'](_0x34484b);}};}function respondWithFilteredResult(_0x1eaae0,_0x4b9fcf){return function(_0xb41e34){if(_0xb41e34){var _0x43dd02=typeof _0x4b9fcf[_0xc4e1('0x1b')]===_0xc4e1('0x1c')&&typeof _0x4b9fcf[_0xc4e1('0x1d')]===_0xc4e1('0x1c');var _0x32119f=_0xb41e34[_0xc4e1('0x1e')];var _0x27fc75=_0x43dd02?0x0:_0x4b9fcf[_0xc4e1('0x1b')];var _0x292986=_0x43dd02?_0xb41e34[_0xc4e1('0x1e')]:_0x4b9fcf[_0xc4e1('0x1b')]+_0x4b9fcf[_0xc4e1('0x1d')];var _0x18f01e;if(_0x292986>=_0x32119f){_0x292986=_0x32119f;_0x18f01e=0xc8;}else{_0x18f01e=0xce;}_0x1eaae0['status'](_0x18f01e);return _0x1eaae0[_0xc4e1('0x1f')](_0xc4e1('0x20'),_0x27fc75+'-'+_0x292986+'/'+_0x32119f)[_0xc4e1('0x21')](_0xb41e34);}return null;};}function patchUpdates(_0x1dafa9){return function(_0x550c12){try{jsonpatch[_0xc4e1('0x22')](_0x550c12,_0x1dafa9,!![]);}catch(_0x3b541c){return BPromise[_0xc4e1('0x23')](_0x3b541c);}return _0x550c12[_0xc4e1('0x24')]();};}function saveUpdates(_0x799db6,_0x4c63e4){return function(_0x28e56e){if(_0x28e56e){return _0x28e56e[_0xc4e1('0x25')](_0x799db6)['then'](function(_0x535efa){return _0x535efa;});}return null;};}function removeEntity(_0x57344e,_0x2cb2a6){return function(_0xbe4c37){if(_0xbe4c37){return _0xbe4c37[_0xc4e1('0x26')]()[_0xc4e1('0x27')](function(){_0x57344e['status'](0xcc)[_0xc4e1('0x19')]();});}};}function handleEntityNotFound(_0xa558ee,_0x4d3959){return function(_0x26b60a){if(!_0x26b60a){_0xa558ee['sendStatus'](0x194);}return _0x26b60a;};}function handleError(_0x481b43,_0x40e99b){_0x40e99b=_0x40e99b||0x1f4;return function(_0x2c49e7){logger['error'](_0x2c49e7['stack']);if(_0x2c49e7[_0xc4e1('0x28')]){delete _0x2c49e7['name'];}_0x481b43[_0xc4e1('0x1a')](_0x40e99b)[_0xc4e1('0x29')](_0x2c49e7);};}exports[_0xc4e1('0x2a')]=function(_0x4138fe,_0x24daa2){var _0x5edec8={},_0x387c58={},_0x4e0d19={'count':0x0,'rows':[]};var _0x27fa6b=_[_0xc4e1('0x2b')](db[_0xc4e1('0x2c')][_0xc4e1('0x2d')],function(_0x5f16c1){return{'name':_0x5f16c1[_0xc4e1('0x2e')],'type':_0x5f16c1['type'][_0xc4e1('0x2f')]};});_0x387c58['model']=_[_0xc4e1('0x2b')](_0x27fa6b,_0xc4e1('0x28'));_0x387c58[_0xc4e1('0x30')]=_['keys'](_0x4138fe['query']);_0x387c58[_0xc4e1('0x31')]=_[_0xc4e1('0x32')](_0x387c58[_0xc4e1('0x33')],_0x387c58[_0xc4e1('0x30')]);_0x5edec8[_0xc4e1('0x34')]=_['intersection'](_0x387c58['model'],qs[_0xc4e1('0x35')](_0x4138fe[_0xc4e1('0x30')][_0xc4e1('0x35')]));_0x5edec8['attributes']=_0x5edec8[_0xc4e1('0x34')][_0xc4e1('0x36')]?_0x5edec8[_0xc4e1('0x34')]:_0x387c58[_0xc4e1('0x33')];if(!_0x4138fe[_0xc4e1('0x30')][_0xc4e1('0x37')](_0xc4e1('0x38'))){_0x5edec8[_0xc4e1('0x1d')]=qs[_0xc4e1('0x1d')](_0x4138fe['query'][_0xc4e1('0x1d')]);_0x5edec8[_0xc4e1('0x1b')]=qs[_0xc4e1('0x1b')](_0x4138fe['query']['offset']);}_0x5edec8['order']=qs[_0xc4e1('0x39')](_0x4138fe[_0xc4e1('0x30')][_0xc4e1('0x39')]);_0x5edec8['where']=qs[_0xc4e1('0x31')](_[_0xc4e1('0x3a')](_0x4138fe[_0xc4e1('0x30')],_0x387c58['filters']),_0x27fa6b);if(_0x4138fe[_0xc4e1('0x30')][_0xc4e1('0x3b')]){_0x5edec8[_0xc4e1('0x3c')]=_[_0xc4e1('0x3d')](_0x5edec8['where'],{'$or':_[_0xc4e1('0x2b')](_0x27fa6b,function(_0x3bab3a){if(_0x3bab3a[_0xc4e1('0x3e')]!=='VIRTUAL'){var _0x15374e={};_0x15374e[_0x3bab3a[_0xc4e1('0x28')]]={'$like':'%'+_0x4138fe[_0xc4e1('0x30')]['filter']+'%'};return _0x15374e;}})});}_0x5edec8=_[_0xc4e1('0x3d')]({},_0x5edec8,_0x4138fe[_0xc4e1('0x3f')]);var _0xa0d3ab={'where':_0x5edec8[_0xc4e1('0x3c')]};return db[_0xc4e1('0x2c')][_0xc4e1('0x1e')](_0xa0d3ab)[_0xc4e1('0x27')](function(_0x4575a9){_0x4e0d19[_0xc4e1('0x1e')]=_0x4575a9;if(_0x4138fe[_0xc4e1('0x30')][_0xc4e1('0x40')]){_0x5edec8[_0xc4e1('0x41')]=[{'all':!![]}];}return db[_0xc4e1('0x2c')][_0xc4e1('0x42')](_0x5edec8);})[_0xc4e1('0x27')](function(_0x3dbbf1){_0x4e0d19[_0xc4e1('0x43')]=_0x3dbbf1;return _0x4e0d19;})['then'](respondWithFilteredResult(_0x24daa2,_0x5edec8))['catch'](handleError(_0x24daa2,null));};exports['show']=function(_0x2ec306,_0x1faedf){var _0x524e00={'raw':!![],'where':{'id':_0x2ec306[_0xc4e1('0x44')]['id']}},_0x77f6ed={};_0x77f6ed[_0xc4e1('0x33')]=_['keys'](db[_0xc4e1('0x2c')]['rawAttributes']);_0x77f6ed[_0xc4e1('0x30')]=_[_0xc4e1('0x45')](_0x2ec306['query']);_0x77f6ed['filters']=_[_0xc4e1('0x32')](_0x77f6ed['model'],_0x77f6ed[_0xc4e1('0x30')]);_0x524e00[_0xc4e1('0x34')]=_[_0xc4e1('0x32')](_0x77f6ed[_0xc4e1('0x33')],qs['fields'](_0x2ec306['query'][_0xc4e1('0x35')]));_0x524e00[_0xc4e1('0x34')]=_0x524e00[_0xc4e1('0x34')][_0xc4e1('0x36')]?_0x524e00[_0xc4e1('0x34')]:_0x77f6ed['model'];if(_0x2ec306[_0xc4e1('0x30')][_0xc4e1('0x40')]){_0x524e00['include']=[{'all':!![]}];}_0x524e00=_[_0xc4e1('0x3d')]({},_0x524e00,_0x2ec306[_0xc4e1('0x3f')]);return db['CmHopperHistory']['find'](_0x524e00)[_0xc4e1('0x27')](handleEntityNotFound(_0x1faedf,null))[_0xc4e1('0x27')](respondWithResult(_0x1faedf,null))[_0xc4e1('0x46')](handleError(_0x1faedf,null));};exports[_0xc4e1('0x47')]=function(_0x7d89c2,_0x243d2c){return db[_0xc4e1('0x2c')]['create'](_0x7d89c2[_0xc4e1('0x48')],{})[_0xc4e1('0x27')](respondWithResult(_0x243d2c,0xc9))[_0xc4e1('0x46')](handleError(_0x243d2c,null));};exports['describe']=function(_0x19cd38,_0x474e41){return db[_0xc4e1('0x2c')][_0xc4e1('0x49')]()[_0xc4e1('0x27')](respondWithResult(_0x474e41,null))[_0xc4e1('0x46')](handleError(_0x474e41,null));};exports[_0xc4e1('0x25')]=function(_0x6949c,_0x274c9a){if(_0x6949c[_0xc4e1('0x48')][_0xc4e1('0x4a')]){delete _0x6949c[_0xc4e1('0x48')][_0xc4e1('0x4a')];}return db[_0xc4e1('0x2c')][_0xc4e1('0x4b')]({'where':{'uniqueid':_0x6949c[_0xc4e1('0x44')]['id']}})[_0xc4e1('0x27')](handleEntityNotFound(_0x274c9a,null))[_0xc4e1('0x27')](saveUpdates(_0x6949c[_0xc4e1('0x48')],null))[_0xc4e1('0x27')](respondWithResult(_0x274c9a,null))[_0xc4e1('0x46')](handleError(_0x274c9a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9074c1b..db76523 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.model.js +++ b/server/api/cmHopperHistory/cmHopperHistory.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x761c=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x289e07,_0x127345){var _0x2ebf01=function(_0x6d0023){while(--_0x6d0023){_0x289e07['push'](_0x289e07['shift']());}};_0x2ebf01(++_0x127345);}(_0x761c,0x18a));var _0xc761=function(_0x40c1c2,_0x3c2515){_0x40c1c2=_0x40c1c2-0x0;var _0x56c474=_0x761c[_0x40c1c2];return _0x56c474;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var logger=require(_0xc761('0x1'))(_0xc761('0x2'));var moment=require('moment');var BPromise=require(_0xc761('0x3'));var rp=require(_0xc761('0x4'));var fs=require('fs');var path=require(_0xc761('0x5'));var rimraf=require('rimraf');var config=require(_0xc761('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xc761('0x7')]=function(_0x468f51,_0x23ba0b){return _0x468f51[_0xc761('0x8')](_0xc761('0x9'),attributes,{'tableName':_0xc761('0xa'),'paranoid':![],'indexes':[{'name':_0xc761('0xb'),'fields':['endtime']},{'name':_0xc761('0xc'),'fields':[_0xc761('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fa9=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1fa9,0x136));var _0x91fa=function(_0x3f5870,_0x210953){_0x3f5870=_0x3f5870-0x0;var _0x4b731a=_0x1fa9[_0x3f5870];return _0x4b731a;};'use strict';var _=require(_0x91fa('0x0'));var util=require('util');var logger=require(_0x91fa('0x1'))('api');var moment=require(_0x91fa('0x2'));var BPromise=require(_0x91fa('0x3'));var rp=require(_0x91fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91fa('0x5'));var config=require(_0x91fa('0x6'));var attributes=require(_0x91fa('0x7'));module[_0x91fa('0x8')]=function(_0xd050dc,_0x50f800){return _0xd050dc[_0x91fa('0x9')](_0x91fa('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x91fa('0xb')]},{'name':_0x91fa('0xc'),'fields':[_0x91fa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 38cf399..2e06e7d 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19c3=['where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','stringify','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime'];(function(_0x3c90a5,_0x1bee71){var _0x557801=function(_0x4b7201){while(--_0x4b7201){_0x3c90a5['push'](_0x3c90a5['shift']());}};_0x557801(++_0x1bee71);}(_0x19c3,0xf9));var _0x319c=function(_0x4fc725,_0x423606){_0x4fc725=_0x4fc725-0x0;var _0xe65d33=_0x19c3[_0x4fc725];return _0xe65d33;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var moment=require(_0x319c('0x1'));var BPromise=require(_0x319c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x319c('0x3'));var db=require(_0x319c('0x4'))['db'];var utils=require(_0x319c('0x5'));var logger=require(_0x319c('0x6'))(_0x319c('0x7'));var config=require(_0x319c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x319c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e38c4,_0x2df1a9,_0x9a5cf8){return new BPromise(function(_0x306a4b,_0x3662ed){return client['request'](_0x2e38c4,_0x9a5cf8)[_0x319c('0xa')](function(_0x1b7ffd){logger[_0x319c('0xb')](_0x319c('0xc'),_0x2df1a9,_0x319c('0xd'));logger[_0x319c('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2df1a9,_0x319c('0xd'),JSON['stringify'](_0x1b7ffd));if(_0x1b7ffd[_0x319c('0xf')]){if(_0x1b7ffd[_0x319c('0xf')][_0x319c('0x10')]===0x1f4){logger[_0x319c('0xf')](_0x319c('0xc'),_0x2df1a9,_0x1b7ffd[_0x319c('0xf')][_0x319c('0x11')]);return _0x3662ed(_0x1b7ffd['error']['message']);}logger[_0x319c('0xf')](_0x319c('0xc'),_0x2df1a9,_0x1b7ffd['error'][_0x319c('0x11')]);return _0x306a4b(_0x1b7ffd[_0x319c('0xf')][_0x319c('0x11')]);}else{logger[_0x319c('0xb')](_0x319c('0xc'),_0x2df1a9,_0x319c('0xd'));_0x306a4b(_0x1b7ffd[_0x319c('0x12')]['message']);}})['catch'](function(_0x9415a5){logger[_0x319c('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x2df1a9,_0x9415a5);_0x3662ed(_0x9415a5);});});}exports[_0x319c('0x13')]=function(_0x49624c){var _0x2c2ec2=this;return new Promise(function(_0x45a822,_0x31dba7){return db[_0x319c('0x14')][_0x319c('0x15')](_0x49624c[_0x319c('0x16')],{'raw':_0x49624c[_0x319c('0x17')]?_0x49624c['options'][_0x319c('0x18')]===undefined?!![]:![]:!![]})[_0x319c('0xa')](function(_0x5bd273){logger['info'](_0x319c('0x13'),_0x49624c);logger[_0x319c('0xe')](_0x319c('0x13'),_0x49624c,JSON['stringify'](_0x5bd273));_0x45a822(_0x5bd273);})[_0x319c('0x19')](function(_0xe50337){logger[_0x319c('0xf')](_0x319c('0x13'),_0xe50337[_0x319c('0x11')],_0x49624c);_0x31dba7(_0x2c2ec2['error'](0x1f4,_0xe50337[_0x319c('0x11')]));});});};exports[_0x319c('0x1a')]=function(_0x4508a5){var _0x5b45bd=this;return new Promise(function(_0x360a9b,_0x4a8ee8){return db[_0x319c('0x14')]['findAll']({'raw':_0x4508a5[_0x319c('0x17')]?_0x4508a5[_0x319c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4508a5[_0x319c('0x17')]?_0x4508a5['options'][_0x319c('0x1b')]||null:null,'attributes':[[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')][_0x319c('0x1e')]('id')),_0x319c('0x1f')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x21')))),_0x319c('0x22')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')]['literal'](_0x319c('0x24')))),_0x319c('0x25')],[db[_0x319c('0x1c')]['fn']('AVG',db[_0x319c('0x1c')]['fn']('IF',db['sequelize'][_0x319c('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x319c('0x26')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x27'),db['sequelize']['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x319c('0x28')]]})[_0x319c('0xa')](function(_0x2ed8c1){logger[_0x319c('0xb')](_0x319c('0x1a'),_0x4508a5);logger['debug'](_0x319c('0x1a'),_0x4508a5,JSON[_0x319c('0x29')](_0x2ed8c1));_0x360a9b(_0x2ed8c1);})[_0x319c('0x19')](function(_0x19c5d8){logger[_0x319c('0xf')](_0x319c('0x1a'),_0x19c5d8[_0x319c('0x11')],_0x4508a5);_0x4a8ee8(_0x5b45bd[_0x319c('0xf')](0x1f4,_0x19c5d8[_0x319c('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x611cdf){var _0x46243a=this;return new Promise(function(_0x31bb73,_0x176d3f){return db['CmHopperHistory'][_0x319c('0x2a')]({'raw':_0x611cdf[_0x319c('0x17')]?_0x611cdf[_0x319c('0x17')][_0x319c('0x18')]===undefined?!![]:![]:!![],'where':_0x611cdf[_0x319c('0x17')]?_0x611cdf[_0x319c('0x17')]['where']||null:null,'attributes':[[_0x319c('0x2b'),_0x319c('0x2c')],[db[_0x319c('0x1c')]['fn']('COUNT',db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x2d')))),_0x319c('0x2e')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')]('`state`\x20=\x203,\x201,\x20null'))),_0x319c('0x2f')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db['sequelize'][_0x319c('0x20')](_0x319c('0x30')))),_0x319c('0x31')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0x319c('0x32')],[db[_0x319c('0x1c')]['fn']('COUNT',db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x33')))),_0x319c('0x34')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db['sequelize']['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x35')))),_0x319c('0x36')],[db['sequelize']['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')]['literal'](_0x319c('0x37')))),'outboundUnknownCallsDay'],[db[_0x319c('0x1c')]['fn']('COUNT',db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x38')))),_0x319c('0x39')],[db[_0x319c('0x1c')]['fn']('COUNT',db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x3a')))),_0x319c('0x3b')],[db[_0x319c('0x1c')]['fn']('COUNT',db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0x319c('0x3c')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x3d')))),_0x319c('0x3e')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db[_0x319c('0x1c')]['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),_0x319c('0x3c')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db['sequelize']['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x3f')))),_0x319c('0x40')]],'group':[_0x319c('0x2b')]})['then'](function(_0x112b2f){logger['info'](_0x319c('0x41'),_0x611cdf);logger[_0x319c('0xe')](_0x319c('0x41'),_0x611cdf,JSON[_0x319c('0x29')](_0x112b2f));_0x31bb73(_0x112b2f);})[_0x319c('0x19')](function(_0x3b0efa){logger['error'](_0x319c('0x41'),_0x3b0efa[_0x319c('0x11')],_0x611cdf);_0x176d3f(_0x46243a[_0x319c('0xf')](0x1f4,_0x3b0efa[_0x319c('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x344317){var _0xe063f9=this;return new Promise(function(_0x414032,_0x3b0cc7){return db[_0x319c('0x14')][_0x319c('0x2a')]({'raw':_0x344317['options']?_0x344317[_0x319c('0x17')][_0x319c('0x18')]===undefined?!![]:![]:!![],'where':_0x344317['options']?_0x344317[_0x319c('0x17')]['where']||null:null,'attributes':[['campaign',_0x319c('0x2c')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db['sequelize']['col']('id')),_0x319c('0x42')],[db[_0x319c('0x1c')]['fn'](_0x319c('0x1d'),db['sequelize']['fn']('IF',db[_0x319c('0x1c')][_0x319c('0x20')](_0x319c('0x21')))),_0x319c('0x43')]],'group':[_0x319c('0x2b')]})['then'](function(_0x5380a0){logger[_0x319c('0xb')](_0x319c('0x44'),_0x344317);logger['debug'](_0x319c('0x44'),_0x344317,JSON[_0x319c('0x29')](_0x5380a0));_0x414032(_0x5380a0);})[_0x319c('0x19')](function(_0x5dcec8){logger[_0x319c('0xf')](_0x319c('0x44'),_0x5dcec8[_0x319c('0x11')],_0x344317);_0x3b0cc7(_0xe063f9[_0x319c('0xf')](0x1f4,_0x5dcec8[_0x319c('0x11')]));});});}; \ No newline at end of file +var _0x44a3=['code','message','CmHopperHistory,\x20%s,\x20%s','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x338429,_0x4fd072){var _0x27212e=function(_0x12ddfb){while(--_0x12ddfb){_0x338429['push'](_0x338429['shift']());}};_0x27212e(++_0x4fd072);}(_0x44a3,0x1a9));var _0x344a=function(_0x4333c0,_0x1b8b7d){_0x4333c0=_0x4333c0-0x0;var _0x1ea60b=_0x44a3[_0x4333c0];return _0x1ea60b;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')](_0x277c06[_0x344a('0x1a')],{'raw':_0x277c06[_0x344a('0x1b')]?_0x277c06[_0x344a('0x1b')][_0x344a('0x1c')]===undefined?!![]:![]:!![]})[_0x344a('0xe')](function(_0x450922){logger['info'](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x1d')](_0x450922));_0x9fe854(_0x450922);})[_0x344a('0x16')](function(_0x80ae12){logger[_0x344a('0x12')](_0x344a('0x17'),_0x80ae12[_0x344a('0x14')],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x80ae12[_0x344a('0x14')]));});});};exports[_0x344a('0x1e')]=function(_0x5ce9da){var _0x266fce=this;return new Promise(function(_0x5d11f9,_0x6ccfba){return db['CmHopperHistory'][_0x344a('0x1f')]({'raw':_0x5ce9da['options']?_0x5ce9da[_0x344a('0x1b')][_0x344a('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ce9da[_0x344a('0x1b')]?_0x5ce9da[_0x344a('0x1b')][_0x344a('0x20')]||null:null,'attributes':[[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['col']('id')),_0x344a('0x23')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x344a('0x25')],[db['sequelize']['fn']('COUNT',db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')]['literal'](_0x344a('0x26')))),_0x344a('0x27')],[db[_0x344a('0x21')]['fn'](_0x344a('0x28'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x344a('0x29')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')](_0x344a('0x2a')))),_0x344a('0x2b')]]})[_0x344a('0xe')](function(_0xdf6a8f){logger['info'](_0x344a('0x1e'),_0x5ce9da);logger[_0x344a('0x11')](_0x344a('0x1e'),_0x5ce9da,JSON['stringify'](_0xdf6a8f));_0x5d11f9(_0xdf6a8f);})[_0x344a('0x16')](function(_0x183787){logger[_0x344a('0x12')](_0x344a('0x1e'),_0x183787[_0x344a('0x14')],_0x5ce9da);_0x6ccfba(_0x266fce['error'](0x1f4,_0x183787[_0x344a('0x14')]));});});};exports[_0x344a('0x2c')]=function(_0x150662){var _0xf9597b=this;return new Promise(function(_0x475a9f,_0x5a148c){return db[_0x344a('0x18')][_0x344a('0x1f')]({'raw':_0x150662[_0x344a('0x1b')]?_0x150662[_0x344a('0x1b')][_0x344a('0x1c')]===undefined?!![]:![]:!![],'where':_0x150662['options']?_0x150662[_0x344a('0x1b')][_0x344a('0x20')]||null:null,'attributes':[[_0x344a('0x2d'),_0x344a('0x2e')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')]['literal'](_0x344a('0x2f')))),_0x344a('0x30')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db['sequelize'][_0x344a('0x24')](_0x344a('0x31')))),_0x344a('0x32')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')](_0x344a('0x33')))),'outboundAnswerCallsDay'],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')]['literal'](_0x344a('0x34')))),_0x344a('0x35')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')](_0x344a('0x36')))),_0x344a('0x37')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db['sequelize']['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x344a('0x38')],[db[_0x344a('0x21')]['fn']('COUNT',db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')]['literal'](_0x344a('0x39')))),_0x344a('0x3a')],[db[_0x344a('0x21')]['fn']('COUNT',db[_0x344a('0x21')]['fn']('IF',db['sequelize'][_0x344a('0x24')](_0x344a('0x3b')))),_0x344a('0x3c')],[db[_0x344a('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')](_0x344a('0x3d')))),_0x344a('0x3e')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')](_0x344a('0x3f')))),'outboundOriginateFailureCallsDay'],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')]['literal'](_0x344a('0x40')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db['sequelize'][_0x344a('0x24')](_0x344a('0x41')))),_0x344a('0x42')],[db[_0x344a('0x21')]['fn']('COUNT',db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')](_0x344a('0x43')))),_0x344a('0x44')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')]['fn']('IF',db[_0x344a('0x21')][_0x344a('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x344a('0x45')]],'group':['campaign']})[_0x344a('0xe')](function(_0xb744c6){logger[_0x344a('0xf')]('GetVoiceQueueHopperHistory',_0x150662);logger[_0x344a('0x11')](_0x344a('0x2c'),_0x150662,JSON[_0x344a('0x1d')](_0xb744c6));_0x475a9f(_0xb744c6);})[_0x344a('0x16')](function(_0x346cf3){logger[_0x344a('0x12')](_0x344a('0x2c'),_0x346cf3[_0x344a('0x14')],_0x150662);_0x5a148c(_0xf9597b[_0x344a('0x12')](0x1f4,_0x346cf3['message']));});});};exports[_0x344a('0x46')]=function(_0x311a39){var _0x10d5d1=this;return new Promise(function(_0x16a85a,_0x2dcba3){return db['CmHopperHistory'][_0x344a('0x1f')]({'raw':_0x311a39[_0x344a('0x1b')]?_0x311a39[_0x344a('0x1b')][_0x344a('0x1c')]===undefined?!![]:![]:!![],'where':_0x311a39['options']?_0x311a39[_0x344a('0x1b')][_0x344a('0x20')]||null:null,'attributes':[['campaign',_0x344a('0x2e')],[db[_0x344a('0x21')]['fn'](_0x344a('0x22'),db[_0x344a('0x21')][_0x344a('0x47')]('id')),_0x344a('0x48')],[db[_0x344a('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x344a('0x24')](_0x344a('0x33')))),_0x344a('0x49')]],'group':[_0x344a('0x2d')]})['then'](function(_0x35a97b){logger['info']('GetCampaignHopperHistory',_0x311a39);logger['debug']('GetCampaignHopperHistory',_0x311a39,JSON[_0x344a('0x1d')](_0x35a97b));_0x16a85a(_0x35a97b);})[_0x344a('0x16')](function(_0x20665a){logger[_0x344a('0x12')]('GetCampaignHopperHistory',_0x20665a['message'],_0x311a39);_0x2dcba3(_0x10d5d1['error'](0x1f4,_0x20665a[_0x344a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9ce0c46..9fe309b 100644 --- a/server/api/cmHopperHistory/index.js +++ b/server/api/cmHopperHistory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2117=['../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x47e6ff,_0x4e9559){var _0x56006d=function(_0x3a9ff7){while(--_0x3a9ff7){_0x47e6ff['push'](_0x47e6ff['shift']());}};_0x56006d(++_0x4e9559);}(_0x2117,0x116));var _0x7211=function(_0x556ff1,_0x276b05){_0x556ff1=_0x556ff1-0x0;var _0x20c90a=_0x2117[_0x556ff1];return _0x20c90a;};'use strict';var multer=require(_0x7211('0x0'));var util=require(_0x7211('0x1'));var path=require('path');var timeout=require(_0x7211('0x2'));var express=require(_0x7211('0x3'));var router=express[_0x7211('0x4')]();var fs_extra=require(_0x7211('0x5'));var auth=require(_0x7211('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7211('0x7'));var controller=require(_0x7211('0x8'));router['get']('/',auth[_0x7211('0x9')](),controller[_0x7211('0xa')]);router[_0x7211('0xb')]('/describe',auth[_0x7211('0x9')](),controller[_0x7211('0xc')]);router['get'](_0x7211('0xd'),auth['isAuthenticated'](),controller[_0x7211('0xe')]);router[_0x7211('0xf')]('/',auth[_0x7211('0x9')](),controller['create']);router[_0x7211('0x10')](_0x7211('0xd'),auth[_0x7211('0x9')](),controller[_0x7211('0x11')]);module[_0x7211('0x12')]=router; \ No newline at end of file +var _0x58a9=['isAuthenticated','index','describe','/:id','show','post','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x58a9,0xda));var _0x958a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58a9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x958a('0x0'));var util=require(_0x958a('0x1'));var path=require('path');var timeout=require(_0x958a('0x2'));var express=require(_0x958a('0x3'));var router=express['Router']();var fs_extra=require(_0x958a('0x4'));var auth=require(_0x958a('0x5'));var interaction=require(_0x958a('0x6'));var config=require(_0x958a('0x7'));var controller=require(_0x958a('0x8'));router[_0x958a('0x9')]('/',auth[_0x958a('0xa')](),controller[_0x958a('0xb')]);router['get']('/describe',auth[_0x958a('0xa')](),controller[_0x958a('0xc')]);router[_0x958a('0x9')](_0x958a('0xd'),auth[_0x958a('0xa')](),controller[_0x958a('0xe')]);router[_0x958a('0xf')]('/',auth[_0x958a('0xa')](),controller['create']);router[_0x958a('0x10')](_0x958a('0xd'),auth[_0x958a('0xa')](),controller[_0x958a('0x11')]);module[_0x958a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index eda445b..c42c420 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c32=['STRING','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x26c3('0x0'));module['exports']={'name':{'type':Sequelize[_0x26c3('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x26c3('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa19=['name','sequelize','exports','STRING'];(function(_0x4de958,_0x5b760e){var _0x6c13ff=function(_0x4a744e){while(--_0x4a744e){_0x4de958['push'](_0x4de958['shift']());}};_0x6c13ff(++_0x5b760e);}(_0xaa19,0x79));var _0x9aa1=function(_0x567e96,_0x378b3b){_0x567e96=_0x567e96-0x0;var _0x20754a=_0xaa19[_0x567e96];return _0x20754a;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'name':{'type':Sequelize[_0x9aa1('0x2')],'unique':_0x9aa1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x9aa1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c33fd91..099bd1f 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d34=['from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','each','toString','isEmpty','format','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','Content-type','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','defaultValue','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','error','stack','name','index','CmList','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','rows','catch','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','hasOwnProperty','removeDispositions','addContacts','CmContact','tags','isArray','join','push','omit','ids','success','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','order','raw','getContactsCsv','ContactItemType','OrderBy','findAll','alias','select'];(function(_0x987fe6,_0x24ac32){var _0x4fb549=function(_0x14a3d0){while(--_0x14a3d0){_0x987fe6['push'](_0x987fe6['shift']());}};_0x4fb549(++_0x24ac32);}(_0x4d34,0x16d));var _0x44d3=function(_0x3c49eb,_0x4d4b4b){_0x3c49eb=_0x3c49eb-0x0;var _0x536fde=_0x4d34[_0x3c49eb];return _0x536fde;};'use strict';var emlformat=require(_0x44d3('0x0'));var rimraf=require(_0x44d3('0x1'));var zipdir=require(_0x44d3('0x2'));var jsonpatch=require(_0x44d3('0x3'));var rp=require(_0x44d3('0x4'));var moment=require(_0x44d3('0x5'));var BPromise=require(_0x44d3('0x6'));var Mustache=require(_0x44d3('0x7'));var util=require(_0x44d3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x44d3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44d3('0xa'));var _=require(_0x44d3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x44d3('0xc'));var toCsv=require(_0x44d3('0x9'));var querystring=require(_0x44d3('0xd'));var Papa=require('papaparse');var Redis=require(_0x44d3('0xe'));var authService=require(_0x44d3('0xf'));var qs=require(_0x44d3('0x10'));var as=require(_0x44d3('0x11'));var hardwareService=require(_0x44d3('0x12'));var logger=require(_0x44d3('0x13'))(_0x44d3('0x14'));var utils=require(_0x44d3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x44d3('0x16'))['db'];var csv_results;config[_0x44d3('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x44d3('0x18'))(new Redis(config['redis']));require(_0x44d3('0x19'))[_0x44d3('0x1a')](socket);function respondWithStatusCode(_0xfb749b,_0x30a230){_0x30a230=_0x30a230||0xcc;return function(_0x21ba73){if(_0x21ba73){return _0xfb749b[_0x44d3('0x1b')](_0x30a230);}return _0xfb749b[_0x44d3('0x1c')](_0x30a230)['end']();};}function respondWithResult(_0x5e9a83,_0x581d37){_0x581d37=_0x581d37||0xc8;return function(_0x1ec168){if(_0x1ec168){return _0x5e9a83['status'](_0x581d37)[_0x44d3('0x1d')](_0x1ec168);}};}function respondWithFilteredResult(_0x2fe57b,_0x2c862f){return function(_0x51a11f){if(_0x51a11f){var _0x492053=typeof _0x2c862f['offset']===_0x44d3('0x1e')&&typeof _0x2c862f[_0x44d3('0x1f')]===_0x44d3('0x1e');var _0x5843e3=_0x51a11f[_0x44d3('0x20')];var _0x3bd08b=_0x492053?0x0:_0x2c862f[_0x44d3('0x21')];var _0x150afc=_0x492053?_0x51a11f[_0x44d3('0x20')]:_0x2c862f[_0x44d3('0x21')]+_0x2c862f['limit'];var _0x25a295;if(_0x150afc>=_0x5843e3){_0x150afc=_0x5843e3;_0x25a295=0xc8;}else{_0x25a295=0xce;}_0x2fe57b[_0x44d3('0x1c')](_0x25a295);return _0x2fe57b['set'](_0x44d3('0x22'),_0x3bd08b+'-'+_0x150afc+'/'+_0x5843e3)['json'](_0x51a11f);}return null;};}function patchUpdates(_0x300372){return function(_0x4d8cc5){try{jsonpatch[_0x44d3('0x23')](_0x4d8cc5,_0x300372,!![]);}catch(_0x120562){return BPromise[_0x44d3('0x24')](_0x120562);}return _0x4d8cc5[_0x44d3('0x25')]();};}function saveUpdates(_0x2469b9,_0xd1bfda){return function(_0x832141){if(_0x832141){return _0x832141[_0x44d3('0x26')](_0x2469b9)[_0x44d3('0x27')](function(_0x4bb954){return _0x4bb954;});}return null;};}function removeEntity(_0x4bbf99,_0x16451e){return function(_0x7971aa){if(_0x7971aa){return _0x7971aa[_0x44d3('0x28')]()[_0x44d3('0x27')](function(){var _0x78603=_0x7971aa[_0x44d3('0x29')]({'plain':!![]});var _0x3576d0=_0x44d3('0x2a');return db[_0x44d3('0x2b')][_0x44d3('0x28')]({'where':{'type':_0x3576d0,'resourceId':_0x78603['id']}})[_0x44d3('0x27')](function(){return _0x7971aa;});})[_0x44d3('0x27')](function(){_0x4bbf99[_0x44d3('0x1c')](0xcc)[_0x44d3('0x2c')]();});}};}function handleEntityNotFound(_0x119ddf,_0x5d4f1e){return function(_0x4d4b8b){if(!_0x4d4b8b){_0x119ddf[_0x44d3('0x1b')](0x194);}return _0x4d4b8b;};}function handleError(_0x42e0ff,_0x547701){_0x547701=_0x547701||0x1f4;return function(_0xcc7386){logger[_0x44d3('0x2d')](_0xcc7386[_0x44d3('0x2e')]);if(_0xcc7386['name']){delete _0xcc7386[_0x44d3('0x2f')];}_0x42e0ff[_0x44d3('0x1c')](_0x547701)['send'](_0xcc7386);};}exports[_0x44d3('0x30')]=function(_0x3d6863,_0x6301f4){var _0x41eb70={},_0x5cca19={},_0x1ddf29={'count':0x0,'rows':[]};var _0x2d85cb=_['map'](db[_0x44d3('0x31')][_0x44d3('0x32')],function(_0x1674d4){return{'name':_0x1674d4[_0x44d3('0x33')],'type':_0x1674d4['type']['key']};});_0x5cca19[_0x44d3('0x34')]=_['map'](_0x2d85cb,_0x44d3('0x2f'));_0x5cca19[_0x44d3('0x35')]=_['keys'](_0x3d6863['query']);_0x5cca19[_0x44d3('0x36')]=_[_0x44d3('0x37')](_0x5cca19[_0x44d3('0x34')],_0x5cca19[_0x44d3('0x35')]);_0x41eb70['attributes']=_['intersection'](_0x5cca19[_0x44d3('0x34')],qs['fields'](_0x3d6863[_0x44d3('0x35')][_0x44d3('0x38')]));_0x41eb70[_0x44d3('0x39')]=_0x41eb70[_0x44d3('0x39')][_0x44d3('0x3a')]?_0x41eb70[_0x44d3('0x39')]:_0x5cca19[_0x44d3('0x34')];if(!_0x3d6863[_0x44d3('0x35')]['hasOwnProperty'](_0x44d3('0x3b'))){_0x41eb70[_0x44d3('0x1f')]=qs[_0x44d3('0x1f')](_0x3d6863[_0x44d3('0x35')][_0x44d3('0x1f')]);_0x41eb70['offset']=qs['offset'](_0x3d6863[_0x44d3('0x35')]['offset']);}_0x41eb70['order']=qs[_0x44d3('0x3c')](_0x3d6863[_0x44d3('0x35')][_0x44d3('0x3c')]);_0x41eb70[_0x44d3('0x3d')]=qs[_0x44d3('0x36')](_[_0x44d3('0x3e')](_0x3d6863[_0x44d3('0x35')],_0x5cca19[_0x44d3('0x36')]),_0x2d85cb);if(_0x3d6863[_0x44d3('0x35')][_0x44d3('0x3f')]){_0x41eb70[_0x44d3('0x3d')]=_[_0x44d3('0x40')](_0x41eb70['where'],{'$or':_[_0x44d3('0x41')](_0x2d85cb,function(_0x4c8c36){if(_0x4c8c36[_0x44d3('0x42')]!==_0x44d3('0x43')){var _0x39ff35={};_0x39ff35[_0x4c8c36[_0x44d3('0x2f')]]={'$like':'%'+_0x3d6863[_0x44d3('0x35')][_0x44d3('0x3f')]+'%'};return _0x39ff35;}})});}_0x41eb70=_['merge']({},_0x41eb70,_0x3d6863['options']);var _0x38e1ae={'where':_0x41eb70['where']};return db[_0x44d3('0x31')][_0x44d3('0x20')](_0x38e1ae)[_0x44d3('0x27')](function(_0x30e6a5){_0x1ddf29['count']=_0x30e6a5;if(_0x3d6863[_0x44d3('0x35')][_0x44d3('0x44')]){_0x41eb70['include']=[{'all':!![]}];}return db[_0x44d3('0x31')]['findAll'](_0x41eb70);})[_0x44d3('0x27')](function(_0x1c6313){_0x1ddf29[_0x44d3('0x45')]=_0x1c6313;return _0x1ddf29;})[_0x44d3('0x27')](respondWithFilteredResult(_0x6301f4,_0x41eb70))[_0x44d3('0x46')](handleError(_0x6301f4,null));};exports['show']=function(_0x2c53e2,_0x356f95){var _0x4ee602={'raw':![],'where':{'id':_0x2c53e2['params']['id']}},_0x1d1efa={};_0x1d1efa[_0x44d3('0x34')]=_['keys'](db[_0x44d3('0x31')][_0x44d3('0x32')]);_0x1d1efa[_0x44d3('0x35')]=_[_0x44d3('0x47')](_0x2c53e2[_0x44d3('0x35')]);_0x1d1efa[_0x44d3('0x36')]=_[_0x44d3('0x37')](_0x1d1efa[_0x44d3('0x34')],_0x1d1efa[_0x44d3('0x35')]);_0x4ee602[_0x44d3('0x39')]=_[_0x44d3('0x37')](_0x1d1efa['model'],qs['fields'](_0x2c53e2[_0x44d3('0x35')][_0x44d3('0x38')]));_0x4ee602[_0x44d3('0x39')]=_0x4ee602[_0x44d3('0x39')][_0x44d3('0x3a')]?_0x4ee602[_0x44d3('0x39')]:_0x1d1efa[_0x44d3('0x34')];if(_0x2c53e2[_0x44d3('0x35')]['includeAll']){_0x4ee602[_0x44d3('0x48')]=[{'all':!![]}];}_0x4ee602=_['merge']({},_0x4ee602,_0x2c53e2[_0x44d3('0x49')]);return db['CmList'][_0x44d3('0x4a')](_0x4ee602)[_0x44d3('0x27')](handleEntityNotFound(_0x356f95,null))[_0x44d3('0x27')](respondWithResult(_0x356f95,null))[_0x44d3('0x46')](handleError(_0x356f95,null));};exports[_0x44d3('0x4b')]=function(_0x501671,_0x2771ec){return db[_0x44d3('0x31')][_0x44d3('0x4b')](_0x501671[_0x44d3('0x4c')],{})[_0x44d3('0x27')](function(_0x3b150f){var _0x5423ef=_0x501671[_0x44d3('0x4d')][_0x44d3('0x29')]({'plain':!![]});if(!_0x5423ef)throw new Error(_0x44d3('0x4e'));if(_0x5423ef[_0x44d3('0x4f')]===_0x44d3('0x4d')){var _0x3eb6f2=_0x3b150f['get']({'plain':!![]});var _0x4aea14=_0x44d3('0x2a');return db['UserProfileSection'][_0x44d3('0x4a')]({'where':{'name':_0x4aea14,'userProfileId':_0x5423ef[_0x44d3('0x50')]},'raw':!![]})[_0x44d3('0x27')](function(_0x5ae00f){if(_0x5ae00f&&_0x5ae00f[_0x44d3('0x51')]===0x0){return db[_0x44d3('0x2b')][_0x44d3('0x4b')]({'name':_0x3eb6f2['name'],'resourceId':_0x3eb6f2['id'],'type':_0x5ae00f['name'],'sectionId':_0x5ae00f['id']},{})['then'](function(){return _0x3b150f;});}else{return _0x3b150f;}})[_0x44d3('0x46')](function(_0x5782c9){logger[_0x44d3('0x2d')](_0x44d3('0x52'),_0x5782c9);throw _0x5782c9;});}return _0x3b150f;})[_0x44d3('0x27')](respondWithResult(_0x2771ec,0xc9))[_0x44d3('0x46')](handleError(_0x2771ec,null));};exports['update']=function(_0x4943d2,_0x2974fc){if(_0x4943d2[_0x44d3('0x4c')]['id']){delete _0x4943d2[_0x44d3('0x4c')]['id'];}return db['CmList'][_0x44d3('0x4a')]({'where':{'id':_0x4943d2[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x2974fc,null))[_0x44d3('0x27')](saveUpdates(_0x4943d2[_0x44d3('0x4c')],null))[_0x44d3('0x27')](respondWithResult(_0x2974fc,null))[_0x44d3('0x46')](handleError(_0x2974fc,null));};exports['destroy']=function(_0x4ca724,_0x4f9634){return db[_0x44d3('0x31')][_0x44d3('0x4a')]({'where':{'id':_0x4ca724[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x4f9634,null))[_0x44d3('0x27')](removeEntity(_0x4f9634,null))['catch'](handleError(_0x4f9634,null));};exports[_0x44d3('0x54')]=function(_0x444346,_0x5da811){return db[_0x44d3('0x31')]['describe']()['then'](respondWithResult(_0x5da811,null))[_0x44d3('0x46')](handleError(_0x5da811,null));};exports[_0x44d3('0x55')]=function(_0x2a78e7,_0x1b46d7,_0x3a034b){if(_0x2a78e7['body']['id']){delete _0x2a78e7[_0x44d3('0x4c')]['id'];}return db[_0x44d3('0x31')][_0x44d3('0x4a')]({'where':{'id':_0x2a78e7['params']['id']}})['then'](handleEntityNotFound(_0x1b46d7,null))[_0x44d3('0x27')](function(_0x4f43d7){if(_0x4f43d7){_0x2a78e7[_0x44d3('0x4c')][_0x44d3('0x56')]=_0x4f43d7['id'];return db[_0x44d3('0x57')][_0x44d3('0x4b')](_0x2a78e7['body']);}})['then'](respondWithResult(_0x1b46d7,null))[_0x44d3('0x46')](handleError(_0x1b46d7,null));};exports[_0x44d3('0x58')]=function(_0x521855,_0x424c83,_0x589202){var _0x5c233c={'raw':![],'where':{}};var _0x32ebf2={};var _0x2a2316={'count':0x0,'rows':[]};return db[_0x44d3('0x31')]['findOne']({'where':{'id':_0x521855[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x424c83,null))[_0x44d3('0x27')](function(_0x584418){if(_0x584418){_0x32ebf2['model']=_[_0x44d3('0x47')](db['Disposition'][_0x44d3('0x32')]);_0x32ebf2[_0x44d3('0x35')]=_[_0x44d3('0x47')](_0x521855[_0x44d3('0x35')]);_0x32ebf2[_0x44d3('0x36')]=_['intersection'](_0x32ebf2[_0x44d3('0x34')],_0x32ebf2[_0x44d3('0x35')]);_0x5c233c[_0x44d3('0x39')]=_[_0x44d3('0x37')](_0x32ebf2['model'],qs['fields'](_0x521855[_0x44d3('0x35')][_0x44d3('0x38')]));_0x5c233c[_0x44d3('0x39')]=_0x5c233c[_0x44d3('0x39')][_0x44d3('0x3a')]?_0x5c233c[_0x44d3('0x39')]:_0x32ebf2[_0x44d3('0x34')];if(!_0x521855[_0x44d3('0x35')][_0x44d3('0x59')](_0x44d3('0x3b'))){_0x5c233c[_0x44d3('0x1f')]=qs['limit'](_0x521855[_0x44d3('0x35')][_0x44d3('0x1f')]);_0x5c233c[_0x44d3('0x21')]=qs['offset'](_0x521855[_0x44d3('0x35')][_0x44d3('0x21')]);}_0x5c233c['order']=qs[_0x44d3('0x3c')](_0x521855[_0x44d3('0x35')][_0x44d3('0x3c')]);_0x5c233c['where']=qs[_0x44d3('0x36')](_[_0x44d3('0x3e')](_0x521855[_0x44d3('0x35')],_0x32ebf2[_0x44d3('0x36')]));_0x5c233c['where'][_0x44d3('0x56')]=_0x584418['id'];if(_0x521855[_0x44d3('0x35')][_0x44d3('0x3f')]){_0x5c233c['where']=_[_0x44d3('0x40')](_0x5c233c[_0x44d3('0x3d')],{'$or':_[_0x44d3('0x41')](_0x5c233c[_0x44d3('0x39')],function(_0x151098){var _0x370067={};_0x370067[_0x151098]={'$like':'%'+_0x521855[_0x44d3('0x35')][_0x44d3('0x3f')]+'%'};return _0x370067;})});}_0x5c233c=_[_0x44d3('0x40')]({},_0x5c233c,_0x521855[_0x44d3('0x49')]);return db[_0x44d3('0x57')][_0x44d3('0x20')]({'where':_0x5c233c[_0x44d3('0x3d')]})[_0x44d3('0x27')](function(_0x370808){_0x2a2316['count']=_0x370808;if(_0x521855['query'][_0x44d3('0x44')]){_0x5c233c['include']=[{'all':!![]}];}return db[_0x44d3('0x57')]['findAll'](_0x5c233c);})[_0x44d3('0x27')](function(_0x1d9bad){_0x2a2316['rows']=_0x1d9bad;return _0x2a2316;});}})[_0x44d3('0x27')](respondWithFilteredResult(_0x424c83,_0x5c233c))[_0x44d3('0x46')](handleError(_0x424c83,null));};exports[_0x44d3('0x5a')]=function(_0xe4cf22,_0x17b401,_0x5030d9){return db['CmList']['find']({'where':{'id':_0xe4cf22[_0x44d3('0x53')]['id']}})['then'](handleEntityNotFound(_0x17b401,null))[_0x44d3('0x27')](function(_0x4c0142){if(_0x4c0142){return _0x4c0142[_0x44d3('0x5a')](_0xe4cf22['query']['ids']);}})[_0x44d3('0x27')](respondWithStatusCode(_0x17b401,null))['catch'](handleError(_0x17b401,null));};exports[_0x44d3('0x5b')]=function(_0xf4d4ff,_0x333b67,_0x176769){return db[_0x44d3('0x31')][_0x44d3('0x4a')]({'where':{'id':_0xf4d4ff['params']['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x333b67,null))[_0x44d3('0x27')](function(_0x38dcff){if(_0x38dcff){var _0x1044d9=[];var _0x335eaf={'success':[],'errors':[]};return db[_0x44d3('0x5c')][_0x44d3('0x54')]()['then'](function(_0xed8dbd){if(_0xf4d4ff['body'][_0x44d3('0x5d')]&&_[_0x44d3('0x5e')](_0xf4d4ff[_0x44d3('0x4c')][_0x44d3('0x5d')])){if(_0xf4d4ff[_0x44d3('0x4c')]['tags'][_0x44d3('0x3a')]){_0xf4d4ff[_0x44d3('0x4c')]['tags']=_0xf4d4ff[_0x44d3('0x4c')][_0x44d3('0x5d')][_0x44d3('0x5f')](';')+';';}else{_0xf4d4ff['body'][_0x44d3('0x5d')]=null;}}else{_0xf4d4ff[_0x44d3('0x4c')][_0x44d3('0x5d')]=null;}if(_0xf4d4ff[_0x44d3('0x4c')]&&_[_0x44d3('0x5e')](_0xf4d4ff[_0x44d3('0x4c')])){for(var _0x3880cb=0x0;_0x3880cb<_0xf4d4ff[_0x44d3('0x4c')]['length'];_0x3880cb+=0x1){_0xf4d4ff[_0x44d3('0x4c')][_0x3880cb][_0x44d3('0x56')]=_0xf4d4ff[_0x44d3('0x53')]['id'];_0x1044d9[_0x44d3('0x60')](_0xf4d4ff[_0x44d3('0x4c')][_0x3880cb]);}return BPromise['each'](_0x1044d9,function(_0x3146a9){return db['CmContact'][_0x44d3('0x4b')](_[_0x44d3('0x61')](_0x3146a9,[_0x44d3('0x62'),'id'])||{},{'fields':_[_0x44d3('0x47')](_0xed8dbd),'raw':!![]})[_0x44d3('0x27')](function(_0xce30f3){_0x335eaf[_0x44d3('0x63')]['push'](_0xce30f3['dataValues']);})[_0x44d3('0x46')](function(_0x101886){_0x335eaf['errors'][_0x44d3('0x60')]({'data':_0x3146a9,'error':_0x101886[_0x44d3('0x64')]});});})[_0x44d3('0x27')](function(_0x114a65){return _0x335eaf;})[_0x44d3('0x46')](function(_0x44b29d){return _0x44b29d;});}else{_0x333b67[_0x44d3('0x1c')](0x190)[_0x44d3('0x1d')]({'message':_0x44d3('0x65')});}});}})[_0x44d3('0x27')](respondWithResult(_0x333b67,null))[_0x44d3('0x46')](handleError(_0x333b67,null));};exports[_0x44d3('0x66')]=function(_0x4e7de0,_0x5f5053,_0x84a8b2){var _0x47dc1b;return db['CmList'][_0x44d3('0x4a')]({'where':{'id':_0x4e7de0[_0x44d3('0x53')]['id']},'include':[{'model':db[_0x44d3('0x67')],'as':_0x44d3('0x68')}]})[_0x44d3('0x27')](handleEntityNotFound(_0x5f5053,null))['then'](function(_0x581443){if(_0x581443){_0x47dc1b=_0x581443;return db[_0x44d3('0x5c')][_0x44d3('0x32')];}})[_0x44d3('0x27')](function(_0x437019){if(_0x437019){var _0x3c02e9={};var _0x1a1b69={};_0x1a1b69[_0x44d3('0x34')]=_[_0x44d3('0x69')](_[_0x44d3('0x47')](_0x437019),_[_0x44d3('0x41')](_0x47dc1b[_0x44d3('0x68')],function(_0x353bbe){return util['format'](_0x44d3('0x6a'),_0x353bbe['id']);}));_0x1a1b69['query']=_[_0x44d3('0x47')](_0x4e7de0['query']);_0x1a1b69[_0x44d3('0x36')]=_[_0x44d3('0x37')](_0x1a1b69[_0x44d3('0x34')],_0x1a1b69[_0x44d3('0x35')]);_0x3c02e9[_0x44d3('0x39')]=_[_0x44d3('0x37')](_0x1a1b69[_0x44d3('0x34')],qs[_0x44d3('0x38')](_0x4e7de0['query']['fields']));_0x3c02e9['attributes']=_0x3c02e9[_0x44d3('0x39')]['length']?_0x3c02e9[_0x44d3('0x39')]:_0x1a1b69[_0x44d3('0x34')];if(!_0x4e7de0[_0x44d3('0x35')][_0x44d3('0x59')](_0x44d3('0x3b'))){_0x3c02e9['limit']=qs['limit'](_0x4e7de0[_0x44d3('0x35')][_0x44d3('0x1f')]);_0x3c02e9[_0x44d3('0x21')]=qs[_0x44d3('0x21')](_0x4e7de0[_0x44d3('0x35')][_0x44d3('0x21')]);}_0x3c02e9[_0x44d3('0x6b')]=qs[_0x44d3('0x3c')](_0x4e7de0[_0x44d3('0x35')]['sort']);_0x3c02e9[_0x44d3('0x3d')]=qs['filters'](_[_0x44d3('0x3e')](_0x4e7de0[_0x44d3('0x35')],_0x1a1b69[_0x44d3('0x36')]));_0x3c02e9[_0x44d3('0x6c')]=!![];if(_0x4e7de0[_0x44d3('0x35')][_0x44d3('0x3f')]){_0x3c02e9[_0x44d3('0x3d')]=_['merge'](_0x3c02e9[_0x44d3('0x3d')],{'$or':_['map'](_0x3c02e9[_0x44d3('0x39')],function(_0x447dcc){var _0x380ebb={};_0x380ebb[_0x447dcc]={'$like':'%'+_0x4e7de0[_0x44d3('0x35')][_0x44d3('0x3f')]+'%'};return _0x380ebb;})});}_0x3c02e9=_[_0x44d3('0x40')]({},_0x3c02e9,_0x4e7de0[_0x44d3('0x49')]);return _0x47dc1b['getContacts'](_0x3c02e9);}})['then'](respondWithResult(_0x5f5053,null))[_0x44d3('0x46')](handleError(_0x5f5053,null));};exports[_0x44d3('0x6d')]=function(_0x2d78ee,_0xe51540,_0x9ee410){var _0x3e28c7;var _0x52e8e3;var _0x37db14;var _0x205c6f=_0x2d78ee[_0x44d3('0x53')]['id'];csv_results=[];return db[_0x44d3('0x6e')]['findAll']({'attributes':['id',_0x44d3('0x2f')],'raw':!![],'order':[_0x44d3('0x6f')]})[_0x44d3('0x27')](function(_0x1d92a1){_0x3e28c7=_0x1d92a1;var _0x10d0ff=_[_0x44d3('0x47')](db['CmContact']['rawAttributes']);return db['CmCustomField'][_0x44d3('0x70')]({'raw':!![],'attributes':['id',_0x44d3('0x71')]})[_0x44d3('0x27')](function(_0x11aff1){_0x52e8e3=_0x11aff1;var _0x1415e6=squel[_0x44d3('0x72')]()['fields'](_0x10d0ff)[_0x44d3('0x73')](_0x44d3('0x74'),'c')[_0x44d3('0x3d')](_0x44d3('0x75'),_0x205c6f)[_0x44d3('0x3d')]('c.deletedAt\x20is\x20null')[_0x44d3('0x76')]();for(var _0x58b33f=0x0;_0x58b33f<_0x52e8e3[_0x44d3('0x3a')];_0x58b33f++){_0x1415e6[_0x44d3('0x77')](_0x44d3('0x78')+_0x52e8e3[_0x58b33f]['id'],'customField_'+_0x52e8e3[_0x58b33f][_0x44d3('0x71')]);}for(var _0x58b33f=0x0;_0x58b33f<_0x3e28c7['length'];_0x58b33f++){_0x1415e6['field'](squel[_0x44d3('0x72')]()['field'](_0x44d3('0x79'))['from'](_0x44d3('0x7a'))[_0x44d3('0x3d')](_0x44d3('0x7b'),_0x3e28c7[_0x58b33f]['id'])[_0x44d3('0x3d')](_0x44d3('0x7c')),'additionalPhone_'+_0x3e28c7[_0x58b33f]['name']);_0x1415e6['field'](squel[_0x44d3('0x72')]()[_0x44d3('0x77')](_0x44d3('0x7d'))[_0x44d3('0x73')](_0x44d3('0x7a'))[_0x44d3('0x3d')](_0x44d3('0x7b'),_0x3e28c7[_0x58b33f]['id'])[_0x44d3('0x3d')](_0x44d3('0x7c')),_0x44d3('0x7e')+_0x3e28c7[_0x58b33f][_0x44d3('0x2f')]);}var _0x552686=[];_0x552686[_0x44d3('0x60')](_0x1415e6['toString']());BPromise[_0x44d3('0x7f')](_0x552686,handleQuery)[_0x44d3('0x27')](function(_0x3a1f38){handleQuery(_0x1415e6[_0x44d3('0x80')]());var _0xba5aa4=csv_results[0x0];if(!_[_0x44d3('0x81')](_0xba5aa4)){var _0x2b84b3=toCsv(_0xba5aa4);var _0x2222b5=Date['now']();fs['writeFileSync'](util[_0x44d3('0x82')](_0x44d3('0x83'),_0x205c6f,_0x2222b5),_0x2b84b3);_0xe51540['setHeader'](_0x44d3('0x84'),'attachment;\x20filename='+util['format'](_0x44d3('0x85'),_0x205c6f,_0x2222b5));_0xe51540['setHeader'](_0x44d3('0x86'),'text/csv');return _0xe51540[_0x44d3('0x87')](util[_0x44d3('0x82')]('/tmp/list_%d_%s.csv',_0x205c6f,_0x2222b5));}else{return _0xe51540[_0x44d3('0x1b')](0xcc);}});});});};exports[_0x44d3('0x88')]=function(_0x4872bc,_0x3b7f9d,_0x4d8947){var _0x5a9854;delete _0x4872bc[_0x44d3('0x4c')]['id'];return db[_0x44d3('0x31')][_0x44d3('0x89')]({'where':{'id':_0x4872bc[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x3b7f9d,null))[_0x44d3('0x27')](function(_0x47c5b7){if(_0x47c5b7){return db[_0x44d3('0x8a')][_0x44d3('0x8b')](function(_0x427b09){return db['CmCustomField'][_0x44d3('0x4b')](_0x4872bc[_0x44d3('0x4c')],{'transaction':_0x427b09})['then'](function(_0x28b4bd){_0x5a9854=_0x28b4bd;return _0x47c5b7[_0x44d3('0x8c')](_0x28b4bd,{'transaction':_0x427b09});})[_0x44d3('0x27')](function(){var _0x1f0616={'type':db[_0x44d3('0x8d')][_0x44d3('0x8e')],'transaction':_0x427b09};switch(_0x4872bc['body'][_0x44d3('0x42')]){case _0x44d3('0x8f'):_0x1f0616[_0x44d3('0x42')]=db[_0x44d3('0x8d')]['TEXT'];break;case _0x44d3('0x90'):_0x1f0616['type']=db[_0x44d3('0x8d')]['INTEGER'];break;case _0x44d3('0x91'):_0x1f0616[_0x44d3('0x42')]=db[_0x44d3('0x8d')]['BOOLEAN'];_0x1f0616[_0x44d3('0x92')]=![];break;default:}return db[_0x44d3('0x8a')]['queryInterface'][_0x44d3('0x93')](_0x44d3('0x74'),util[_0x44d3('0x82')](_0x44d3('0x94'),_0x5a9854['id']),_0x1f0616);})[_0x44d3('0x27')](function(){return _0x5a9854;});});}})[_0x44d3('0x27')](respondWithResult(_0x3b7f9d,null))[_0x44d3('0x46')](handleError(_0x3b7f9d,null));};exports['getCustomFields']=function(_0x517588,_0x495b72,_0x2716e2){var _0x3eca05={};var _0x211c39={};var _0x302bed;var _0x835714;return db[_0x44d3('0x31')][_0x44d3('0x89')]({'where':{'id':_0x517588[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x495b72,null))['then'](function(_0x1e8bd1){if(_0x1e8bd1){_0x302bed=_0x1e8bd1;_0x211c39[_0x44d3('0x34')]=_['keys'](db[_0x44d3('0x67')]['rawAttributes']);_0x211c39[_0x44d3('0x35')]=_[_0x44d3('0x47')](_0x517588[_0x44d3('0x35')]);_0x211c39[_0x44d3('0x36')]=_['intersection'](_0x211c39[_0x44d3('0x34')],_0x211c39[_0x44d3('0x35')]);_0x3eca05[_0x44d3('0x39')]=_['intersection'](_0x211c39[_0x44d3('0x34')],qs[_0x44d3('0x38')](_0x517588['query']['fields']));_0x3eca05[_0x44d3('0x39')]=_0x3eca05[_0x44d3('0x39')][_0x44d3('0x3a')]?_0x3eca05['attributes']:_0x211c39[_0x44d3('0x34')];_0x3eca05['order']=qs[_0x44d3('0x3c')](_0x517588[_0x44d3('0x35')][_0x44d3('0x3c')]);_0x3eca05[_0x44d3('0x3d')]=qs[_0x44d3('0x36')](_[_0x44d3('0x3e')](_0x517588[_0x44d3('0x35')],_0x211c39[_0x44d3('0x36')]));_0x3eca05[_0x44d3('0x3d')]=_[_0x44d3('0x40')](_0x3eca05['where'],{'$or':[{'ListId':_0x1e8bd1['id']},{'ListId':null}]});if(_0x517588[_0x44d3('0x35')]['filter']){_0x3eca05[_0x44d3('0x3d')]=_['merge'](_0x3eca05[_0x44d3('0x3d')],{'$or':_[_0x44d3('0x41')](_0x3eca05[_0x44d3('0x39')],function(_0x56d879){var _0x12ac7f={};_0x12ac7f[_0x56d879]={'$like':'%'+_0x517588['query'][_0x44d3('0x3f')]+'%'};return _0x12ac7f;})});}_0x3eca05=_[_0x44d3('0x40')]({},_0x3eca05,_0x517588['options']);return db[_0x44d3('0x67')][_0x44d3('0x95')](_0x3eca05);}})[_0x44d3('0x27')](respondWithResult(_0x495b72,null))['catch'](handleError(_0x495b72,null));};exports[_0x44d3('0x96')]=function(_0x4bcbfc,_0x6288c4){return db[_0x44d3('0x67')]['findAndCountAll']({'where':{'ListId':null}})[_0x44d3('0x27')](handleEntityNotFound(_0x6288c4,null))[_0x44d3('0x27')](function(_0x110dec){return _0x110dec;})[_0x44d3('0x27')](respondWithResult(_0x6288c4,null))['catch'](handleError(_0x6288c4,null));};exports[_0x44d3('0x97')]=function(_0x42dcca,_0x478dd7,_0x272877){return db[_0x44d3('0x31')][_0x44d3('0x4a')]({'where':{'id':_0x42dcca[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x478dd7,null))['then'](function(_0x527e31){if(_0x527e31){return _0x527e31['addAgents'](_0x42dcca['body'][_0x44d3('0x62')],_['omit'](_0x42dcca['body'],[_0x44d3('0x62'),'id'])||{})['spread'](function(_0x461072){for(var _0x2c4be0=0x0;_0x2c4be0<_0x42dcca[_0x44d3('0x4c')][_0x44d3('0x62')][_0x44d3('0x3a')];_0x2c4be0+=0x1){socket[_0x44d3('0x98')](_0x44d3('0x99'),{'UserId':Number(_0x42dcca[_0x44d3('0x4c')]['ids'][_0x2c4be0]),'CmListId':Number(_0x42dcca[_0x44d3('0x53')]['id'])});}return _0x461072;});}})[_0x44d3('0x27')](respondWithResult(_0x478dd7,null))['catch'](handleError(_0x478dd7,null));};exports[_0x44d3('0x9a')]=function(_0x2f371d,_0x548a30,_0x17458d){return db['CmList']['find']({'where':{'id':_0x2f371d[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x548a30,null))[_0x44d3('0x27')](function(_0x35704b){if(_0x35704b){return _0x35704b[_0x44d3('0x9a')](_0x2f371d['query'][_0x44d3('0x62')])[_0x44d3('0x27')](function(){if(_[_0x44d3('0x5e')](_0x2f371d[_0x44d3('0x35')][_0x44d3('0x62')])){for(var _0x43b1c2=0x0;_0x43b1c2<_0x2f371d['query'][_0x44d3('0x62')][_0x44d3('0x3a')];_0x43b1c2+=0x1){socket['emit'](_0x44d3('0x9b'),{'UserId':Number(_0x2f371d['query'][_0x44d3('0x62')][_0x43b1c2]),'CmListId':Number(_0x2f371d[_0x44d3('0x53')]['id'])});}}else{socket[_0x44d3('0x98')](_0x44d3('0x9b'),{'UserId':Number(_0x2f371d[_0x44d3('0x35')][_0x44d3('0x62')]),'CmListId':Number(_0x2f371d[_0x44d3('0x53')]['id'])});}});}})[_0x44d3('0x27')](respondWithStatusCode(_0x548a30,null))[_0x44d3('0x46')](handleError(_0x548a30,null));};exports[_0x44d3('0x9c')]=function(_0x20508d,_0x3ccf78,_0x2b76c3){var _0x849d8c={};var _0x23ee4b={};var _0xcc2532;var _0x5d582e;return db['CmList'][_0x44d3('0x89')]({'where':{'id':_0x20508d[_0x44d3('0x53')]['id']}})[_0x44d3('0x27')](handleEntityNotFound(_0x3ccf78,null))[_0x44d3('0x27')](function(_0x3915e5){if(_0x3915e5){_0xcc2532=_0x3915e5;_0x23ee4b[_0x44d3('0x34')]=_[_0x44d3('0x47')](db[_0x44d3('0x9d')][_0x44d3('0x32')]);_0x23ee4b[_0x44d3('0x35')]=_[_0x44d3('0x47')](_0x20508d[_0x44d3('0x35')]);_0x23ee4b[_0x44d3('0x36')]=_[_0x44d3('0x37')](_0x23ee4b['model'],_0x23ee4b[_0x44d3('0x35')]);_0x849d8c[_0x44d3('0x39')]=_[_0x44d3('0x37')](_0x23ee4b[_0x44d3('0x34')],qs[_0x44d3('0x38')](_0x20508d[_0x44d3('0x35')][_0x44d3('0x38')]));_0x849d8c[_0x44d3('0x39')]=_0x849d8c['attributes'][_0x44d3('0x3a')]?_0x849d8c['attributes']:_0x23ee4b[_0x44d3('0x34')];_0x849d8c['order']=qs[_0x44d3('0x3c')](_0x20508d['query'][_0x44d3('0x3c')]);_0x849d8c[_0x44d3('0x3d')]=qs[_0x44d3('0x36')](_[_0x44d3('0x3e')](_0x20508d[_0x44d3('0x35')],_0x23ee4b[_0x44d3('0x36')]));if(_0x20508d[_0x44d3('0x35')]['filter']){_0x849d8c[_0x44d3('0x3d')]=_[_0x44d3('0x40')](_0x849d8c[_0x44d3('0x3d')],{'$or':_[_0x44d3('0x41')](_0x849d8c[_0x44d3('0x39')],function(_0x293632){var _0x2ca869={};_0x2ca869[_0x293632]={'$like':'%'+_0x20508d[_0x44d3('0x35')][_0x44d3('0x3f')]+'%'};return _0x2ca869;})});}_0x849d8c=_[_0x44d3('0x40')]({},_0x849d8c,_0x20508d['options']);return _0xcc2532['getAgents'](_0x849d8c);}})['then'](function(_0x4b70b9){if(_0x4b70b9){_0x5d582e=_0x4b70b9[_0x44d3('0x3a')];if(!_0x20508d[_0x44d3('0x35')][_0x44d3('0x59')](_0x44d3('0x3b'))){_0x849d8c['limit']=qs[_0x44d3('0x1f')](_0x20508d[_0x44d3('0x35')]['limit']);_0x849d8c['offset']=qs[_0x44d3('0x21')](_0x20508d[_0x44d3('0x35')][_0x44d3('0x21')]);}return _0xcc2532[_0x44d3('0x9c')](_0x849d8c);}})[_0x44d3('0x27')](function(_0x34c13b){if(_0x34c13b){return _0x34c13b?{'count':_0x5d582e,'rows':_0x34c13b}:null;}})[_0x44d3('0x27')](respondWithResult(_0x3ccf78,null))[_0x44d3('0x46')](handleError(_0x3ccf78,null));};function handleQuery(_0x5503d0){logger[_0x44d3('0x9e')](_0x5503d0);return db[_0x44d3('0x8a')][_0x44d3('0x35')](_0x5503d0)[_0x44d3('0x9f')](function(_0x25288b){csv_results[_0x44d3('0x60')](_0x25288b);})[_0x44d3('0x46')](function(_0x20a5cc){logger['error'](_0x20a5cc[_0x44d3('0x64')]);});} \ No newline at end of file +var _0x8f5a=['fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Lists','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','CmList','catch','params','fields','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','rows','removeDispositions','ids','addContacts','CmContact','tags','join','push','omit','success','errors','message','Malformed\x20request\x20syntax','CustomFields','format','cf_%d','raw','getContacts','ContactItemType','findAll','OrderBy','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','additionalPhone_','select','cm_contact_has_items','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','each','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir'];(function(_0x3ddaad,_0x583cfd){var _0x57e91c=function(_0x54bdd3){while(--_0x54bdd3){_0x3ddaad['push'](_0x3ddaad['shift']());}};_0x57e91c(++_0x583cfd);}(_0x8f5a,0x1d7));var _0xa8f5=function(_0x287615,_0x257383){_0x287615=_0x287615-0x0;var _0x536830=_0x8f5a[_0x287615];return _0x536830;};'use strict';var emlformat=require(_0xa8f5('0x0'));var rimraf=require(_0xa8f5('0x1'));var zipdir=require(_0xa8f5('0x2'));var jsonpatch=require(_0xa8f5('0x3'));var rp=require('request-promise');var moment=require(_0xa8f5('0x4'));var BPromise=require(_0xa8f5('0x5'));var Mustache=require('mustache');var util=require(_0xa8f5('0x6'));var path=require(_0xa8f5('0x7'));var sox=require(_0xa8f5('0x8'));var csv=require(_0xa8f5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8f5('0xa'));var _=require('lodash');var squel=require(_0xa8f5('0xb'));var crypto=require(_0xa8f5('0xc'));var jsforce=require(_0xa8f5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa8f5('0x9'));var querystring=require('querystring');var Papa=require(_0xa8f5('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa8f5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa8f5('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa8f5('0x11'));var db=require(_0xa8f5('0x12'))['db'];var csv_results;config['redis']=_['defaults'](config[_0xa8f5('0x13')],{'host':_0xa8f5('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8f5('0x13')]));require(_0xa8f5('0x15'))[_0xa8f5('0x16')](socket);function respondWithStatusCode(_0x477af7,_0x21a353){_0x21a353=_0x21a353||0xcc;return function(_0x1e097d){if(_0x1e097d){return _0x477af7[_0xa8f5('0x17')](_0x21a353);}return _0x477af7[_0xa8f5('0x18')](_0x21a353)[_0xa8f5('0x19')]();};}function respondWithResult(_0x49f342,_0xf19991){_0xf19991=_0xf19991||0xc8;return function(_0x2ed853){if(_0x2ed853){return _0x49f342['status'](_0xf19991)['json'](_0x2ed853);}};}function respondWithFilteredResult(_0x221107,_0x478894){return function(_0x103cec){if(_0x103cec){var _0x23413d=typeof _0x478894[_0xa8f5('0x1a')]===_0xa8f5('0x1b')&&typeof _0x478894[_0xa8f5('0x1c')]===_0xa8f5('0x1b');var _0x361ca4=_0x103cec[_0xa8f5('0x1d')];var _0x4f73a6=_0x23413d?0x0:_0x478894[_0xa8f5('0x1a')];var _0x19c83e=_0x23413d?_0x103cec[_0xa8f5('0x1d')]:_0x478894['offset']+_0x478894['limit'];var _0x35b337;if(_0x19c83e>=_0x361ca4){_0x19c83e=_0x361ca4;_0x35b337=0xc8;}else{_0x35b337=0xce;}_0x221107[_0xa8f5('0x18')](_0x35b337);return _0x221107[_0xa8f5('0x1e')](_0xa8f5('0x1f'),_0x4f73a6+'-'+_0x19c83e+'/'+_0x361ca4)[_0xa8f5('0x20')](_0x103cec);}return null;};}function patchUpdates(_0x4824a7){return function(_0x4bbcf6){try{jsonpatch[_0xa8f5('0x21')](_0x4bbcf6,_0x4824a7,!![]);}catch(_0x7eaa22){return BPromise['reject'](_0x7eaa22);}return _0x4bbcf6[_0xa8f5('0x22')]();};}function saveUpdates(_0x2e4b58,_0x2ee0ac){return function(_0x1ec15a){if(_0x1ec15a){return _0x1ec15a[_0xa8f5('0x23')](_0x2e4b58)[_0xa8f5('0x24')](function(_0x177d1e){return _0x177d1e;});}return null;};}function removeEntity(_0x1e204e,_0x49641f){return function(_0x8b039c){if(_0x8b039c){return _0x8b039c[_0xa8f5('0x25')]()[_0xa8f5('0x24')](function(){var _0x38b91c=_0x8b039c[_0xa8f5('0x26')]({'plain':!![]});var _0x37031d=_0xa8f5('0x27');return db['UserProfileResource'][_0xa8f5('0x25')]({'where':{'type':_0x37031d,'resourceId':_0x38b91c['id']}})[_0xa8f5('0x24')](function(){return _0x8b039c;});})[_0xa8f5('0x24')](function(){_0x1e204e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56bf2f,_0x55a01f){return function(_0x187af8){if(!_0x187af8){_0x56bf2f['sendStatus'](0x194);}return _0x187af8;};}function handleError(_0x4a08df,_0x117b27){_0x117b27=_0x117b27||0x1f4;return function(_0x31ad42){logger[_0xa8f5('0x28')](_0x31ad42['stack']);if(_0x31ad42['name']){delete _0x31ad42[_0xa8f5('0x29')];}_0x4a08df[_0xa8f5('0x18')](_0x117b27)[_0xa8f5('0x2a')](_0x31ad42);};}exports[_0xa8f5('0x2b')]=function(_0x2d98fe,_0x478785){var _0x250bc4={},_0x59c81d={},_0xeafccc={'count':0x0,'rows':[]};var _0x199066=_[_0xa8f5('0x2c')](db['CmList'][_0xa8f5('0x2d')],function(_0x5e26ec){return{'name':_0x5e26ec[_0xa8f5('0x2e')],'type':_0x5e26ec[_0xa8f5('0x2f')][_0xa8f5('0x30')]};});_0x59c81d[_0xa8f5('0x31')]=_[_0xa8f5('0x2c')](_0x199066,_0xa8f5('0x29'));_0x59c81d[_0xa8f5('0x32')]=_[_0xa8f5('0x33')](_0x2d98fe['query']);_0x59c81d[_0xa8f5('0x34')]=_['intersection'](_0x59c81d[_0xa8f5('0x31')],_0x59c81d[_0xa8f5('0x32')]);_0x250bc4[_0xa8f5('0x35')]=_[_0xa8f5('0x36')](_0x59c81d[_0xa8f5('0x31')],qs['fields'](_0x2d98fe[_0xa8f5('0x32')]['fields']));_0x250bc4['attributes']=_0x250bc4[_0xa8f5('0x35')][_0xa8f5('0x37')]?_0x250bc4[_0xa8f5('0x35')]:_0x59c81d[_0xa8f5('0x31')];if(!_0x2d98fe[_0xa8f5('0x32')][_0xa8f5('0x38')](_0xa8f5('0x39'))){_0x250bc4['limit']=qs[_0xa8f5('0x1c')](_0x2d98fe[_0xa8f5('0x32')][_0xa8f5('0x1c')]);_0x250bc4[_0xa8f5('0x1a')]=qs[_0xa8f5('0x1a')](_0x2d98fe[_0xa8f5('0x32')][_0xa8f5('0x1a')]);}_0x250bc4[_0xa8f5('0x3a')]=qs[_0xa8f5('0x3b')](_0x2d98fe[_0xa8f5('0x32')][_0xa8f5('0x3b')]);_0x250bc4[_0xa8f5('0x3c')]=qs[_0xa8f5('0x34')](_[_0xa8f5('0x3d')](_0x2d98fe[_0xa8f5('0x32')],_0x59c81d[_0xa8f5('0x34')]),_0x199066);if(_0x2d98fe[_0xa8f5('0x32')]['filter']){_0x250bc4['where']=_[_0xa8f5('0x3e')](_0x250bc4['where'],{'$or':_[_0xa8f5('0x2c')](_0x199066,function(_0x1b0da7){if(_0x1b0da7[_0xa8f5('0x2f')]!==_0xa8f5('0x3f')){var _0x109c46={};_0x109c46[_0x1b0da7[_0xa8f5('0x29')]]={'$like':'%'+_0x2d98fe[_0xa8f5('0x32')][_0xa8f5('0x40')]+'%'};return _0x109c46;}})});}_0x250bc4=_[_0xa8f5('0x3e')]({},_0x250bc4,_0x2d98fe['options']);var _0x4ea8b9={'where':_0x250bc4[_0xa8f5('0x3c')]};return db[_0xa8f5('0x41')][_0xa8f5('0x1d')](_0x4ea8b9)[_0xa8f5('0x24')](function(_0x41379d){_0xeafccc['count']=_0x41379d;if(_0x2d98fe[_0xa8f5('0x32')]['includeAll']){_0x250bc4['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x250bc4);})['then'](function(_0xe6705b){_0xeafccc['rows']=_0xe6705b;return _0xeafccc;})[_0xa8f5('0x24')](respondWithFilteredResult(_0x478785,_0x250bc4))[_0xa8f5('0x42')](handleError(_0x478785,null));};exports['show']=function(_0x36cd06,_0x45600b){var _0x45f006={'raw':![],'where':{'id':_0x36cd06[_0xa8f5('0x43')]['id']}},_0x3a6d8e={};_0x3a6d8e[_0xa8f5('0x31')]=_[_0xa8f5('0x33')](db[_0xa8f5('0x41')][_0xa8f5('0x2d')]);_0x3a6d8e['query']=_[_0xa8f5('0x33')](_0x36cd06[_0xa8f5('0x32')]);_0x3a6d8e['filters']=_['intersection'](_0x3a6d8e[_0xa8f5('0x31')],_0x3a6d8e['query']);_0x45f006['attributes']=_[_0xa8f5('0x36')](_0x3a6d8e['model'],qs[_0xa8f5('0x44')](_0x36cd06[_0xa8f5('0x32')]['fields']));_0x45f006[_0xa8f5('0x35')]=_0x45f006[_0xa8f5('0x35')][_0xa8f5('0x37')]?_0x45f006[_0xa8f5('0x35')]:_0x3a6d8e[_0xa8f5('0x31')];if(_0x36cd06[_0xa8f5('0x32')][_0xa8f5('0x45')]){_0x45f006[_0xa8f5('0x46')]=[{'all':!![]}];}_0x45f006=_[_0xa8f5('0x3e')]({},_0x45f006,_0x36cd06[_0xa8f5('0x47')]);return db[_0xa8f5('0x41')][_0xa8f5('0x48')](_0x45f006)['then'](handleEntityNotFound(_0x45600b,null))[_0xa8f5('0x24')](respondWithResult(_0x45600b,null))[_0xa8f5('0x42')](handleError(_0x45600b,null));};exports['create']=function(_0x4d1843,_0x2ffffa){return db[_0xa8f5('0x41')][_0xa8f5('0x49')](_0x4d1843[_0xa8f5('0x4a')],{})[_0xa8f5('0x24')](function(_0x2daeaa){var _0x4b74ff=_0x4d1843[_0xa8f5('0x4b')]['get']({'plain':!![]});if(!_0x4b74ff)throw new Error(_0xa8f5('0x4c'));if(_0x4b74ff['role']===_0xa8f5('0x4b')){var _0x27106c=_0x2daeaa['get']({'plain':!![]});var _0x5a5ffb=_0xa8f5('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5a5ffb,'userProfileId':_0x4b74ff[_0xa8f5('0x4d')]},'raw':!![]})[_0xa8f5('0x24')](function(_0x585208){if(_0x585208&&_0x585208[_0xa8f5('0x4e')]===0x0){return db[_0xa8f5('0x4f')][_0xa8f5('0x49')]({'name':_0x27106c[_0xa8f5('0x29')],'resourceId':_0x27106c['id'],'type':_0x585208[_0xa8f5('0x29')],'sectionId':_0x585208['id']},{})[_0xa8f5('0x24')](function(){return _0x2daeaa;});}else{return _0x2daeaa;}})[_0xa8f5('0x42')](function(_0x15bde8){logger[_0xa8f5('0x28')](_0xa8f5('0x50'),_0x15bde8);throw _0x15bde8;});}return _0x2daeaa;})['then'](respondWithResult(_0x2ffffa,0xc9))['catch'](handleError(_0x2ffffa,null));};exports[_0xa8f5('0x23')]=function(_0x282aae,_0x3ecd71){if(_0x282aae[_0xa8f5('0x4a')]['id']){delete _0x282aae['body']['id'];}return db[_0xa8f5('0x41')][_0xa8f5('0x48')]({'where':{'id':_0x282aae['params']['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x3ecd71,null))[_0xa8f5('0x24')](saveUpdates(_0x282aae['body'],null))[_0xa8f5('0x24')](respondWithResult(_0x3ecd71,null))[_0xa8f5('0x42')](handleError(_0x3ecd71,null));};exports[_0xa8f5('0x25')]=function(_0x122389,_0x2a5de3){return db[_0xa8f5('0x41')][_0xa8f5('0x48')]({'where':{'id':_0x122389['params']['id']}})['then'](handleEntityNotFound(_0x2a5de3,null))[_0xa8f5('0x24')](removeEntity(_0x2a5de3,null))[_0xa8f5('0x42')](handleError(_0x2a5de3,null));};exports[_0xa8f5('0x51')]=function(_0x19fe70,_0x17a900){return db[_0xa8f5('0x41')][_0xa8f5('0x51')]()[_0xa8f5('0x24')](respondWithResult(_0x17a900,null))['catch'](handleError(_0x17a900,null));};exports[_0xa8f5('0x52')]=function(_0xad518e,_0x2c12c2,_0x472dca){if(_0xad518e[_0xa8f5('0x4a')]['id']){delete _0xad518e[_0xa8f5('0x4a')]['id'];}return db[_0xa8f5('0x41')][_0xa8f5('0x48')]({'where':{'id':_0xad518e[_0xa8f5('0x43')]['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x2c12c2,null))['then'](function(_0x47dfbb){if(_0x47dfbb){_0xad518e[_0xa8f5('0x4a')][_0xa8f5('0x53')]=_0x47dfbb['id'];return db[_0xa8f5('0x54')][_0xa8f5('0x49')](_0xad518e[_0xa8f5('0x4a')]);}})[_0xa8f5('0x24')](respondWithResult(_0x2c12c2,null))[_0xa8f5('0x42')](handleError(_0x2c12c2,null));};exports['getDispositions']=function(_0x42d17a,_0x32ae67,_0x42ee67){var _0x25f17e={'raw':![],'where':{}};var _0x30bbcf={};var _0x4d2773={'count':0x0,'rows':[]};return db['CmList'][_0xa8f5('0x55')]({'where':{'id':_0x42d17a[_0xa8f5('0x43')]['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x32ae67,null))['then'](function(_0x5a83c2){if(_0x5a83c2){_0x30bbcf[_0xa8f5('0x31')]=_['keys'](db['Disposition'][_0xa8f5('0x2d')]);_0x30bbcf[_0xa8f5('0x32')]=_[_0xa8f5('0x33')](_0x42d17a[_0xa8f5('0x32')]);_0x30bbcf['filters']=_[_0xa8f5('0x36')](_0x30bbcf[_0xa8f5('0x31')],_0x30bbcf[_0xa8f5('0x32')]);_0x25f17e[_0xa8f5('0x35')]=_[_0xa8f5('0x36')](_0x30bbcf[_0xa8f5('0x31')],qs[_0xa8f5('0x44')](_0x42d17a['query'][_0xa8f5('0x44')]));_0x25f17e[_0xa8f5('0x35')]=_0x25f17e[_0xa8f5('0x35')][_0xa8f5('0x37')]?_0x25f17e[_0xa8f5('0x35')]:_0x30bbcf[_0xa8f5('0x31')];if(!_0x42d17a[_0xa8f5('0x32')][_0xa8f5('0x38')](_0xa8f5('0x39'))){_0x25f17e[_0xa8f5('0x1c')]=qs[_0xa8f5('0x1c')](_0x42d17a[_0xa8f5('0x32')][_0xa8f5('0x1c')]);_0x25f17e['offset']=qs[_0xa8f5('0x1a')](_0x42d17a['query'][_0xa8f5('0x1a')]);}_0x25f17e[_0xa8f5('0x3a')]=qs[_0xa8f5('0x3b')](_0x42d17a[_0xa8f5('0x32')][_0xa8f5('0x3b')]);_0x25f17e['where']=qs[_0xa8f5('0x34')](_[_0xa8f5('0x3d')](_0x42d17a[_0xa8f5('0x32')],_0x30bbcf[_0xa8f5('0x34')]));_0x25f17e[_0xa8f5('0x3c')][_0xa8f5('0x53')]=_0x5a83c2['id'];if(_0x42d17a[_0xa8f5('0x32')]['filter']){_0x25f17e['where']=_[_0xa8f5('0x3e')](_0x25f17e[_0xa8f5('0x3c')],{'$or':_['map'](_0x25f17e['attributes'],function(_0xb0833f){var _0x252391={};_0x252391[_0xb0833f]={'$like':'%'+_0x42d17a[_0xa8f5('0x32')][_0xa8f5('0x40')]+'%'};return _0x252391;})});}_0x25f17e=_[_0xa8f5('0x3e')]({},_0x25f17e,_0x42d17a['options']);return db[_0xa8f5('0x54')][_0xa8f5('0x1d')]({'where':_0x25f17e[_0xa8f5('0x3c')]})[_0xa8f5('0x24')](function(_0x525e8e){_0x4d2773[_0xa8f5('0x1d')]=_0x525e8e;if(_0x42d17a[_0xa8f5('0x32')][_0xa8f5('0x45')]){_0x25f17e[_0xa8f5('0x46')]=[{'all':!![]}];}return db[_0xa8f5('0x54')]['findAll'](_0x25f17e);})[_0xa8f5('0x24')](function(_0x4a876f){_0x4d2773[_0xa8f5('0x56')]=_0x4a876f;return _0x4d2773;});}})[_0xa8f5('0x24')](respondWithFilteredResult(_0x32ae67,_0x25f17e))['catch'](handleError(_0x32ae67,null));};exports[_0xa8f5('0x57')]=function(_0x3bcb68,_0x2429f4,_0x57c506){return db[_0xa8f5('0x41')][_0xa8f5('0x48')]({'where':{'id':_0x3bcb68[_0xa8f5('0x43')]['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x2429f4,null))['then'](function(_0x1e24ef){if(_0x1e24ef){return _0x1e24ef['removeDispositions'](_0x3bcb68[_0xa8f5('0x32')][_0xa8f5('0x58')]);}})[_0xa8f5('0x24')](respondWithStatusCode(_0x2429f4,null))['catch'](handleError(_0x2429f4,null));};exports[_0xa8f5('0x59')]=function(_0x27d4b2,_0x97aec5,_0x164581){return db[_0xa8f5('0x41')][_0xa8f5('0x48')]({'where':{'id':_0x27d4b2['params']['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x97aec5,null))[_0xa8f5('0x24')](function(_0x2a9e91){if(_0x2a9e91){var _0x50b3ec=[];var _0x364bc0={'success':[],'errors':[]};return db[_0xa8f5('0x5a')][_0xa8f5('0x51')]()['then'](function(_0x4623d7){if(_0x27d4b2['body'][_0xa8f5('0x5b')]&&_['isArray'](_0x27d4b2[_0xa8f5('0x4a')][_0xa8f5('0x5b')])){if(_0x27d4b2[_0xa8f5('0x4a')][_0xa8f5('0x5b')]['length']){_0x27d4b2[_0xa8f5('0x4a')][_0xa8f5('0x5b')]=_0x27d4b2['body'][_0xa8f5('0x5b')][_0xa8f5('0x5c')](';')+';';}else{_0x27d4b2[_0xa8f5('0x4a')][_0xa8f5('0x5b')]=null;}}else{_0x27d4b2[_0xa8f5('0x4a')][_0xa8f5('0x5b')]=null;}if(_0x27d4b2['body']&&_['isArray'](_0x27d4b2['body'])){for(var _0x254af3=0x0;_0x254af3<_0x27d4b2[_0xa8f5('0x4a')][_0xa8f5('0x37')];_0x254af3+=0x1){_0x27d4b2[_0xa8f5('0x4a')][_0x254af3][_0xa8f5('0x53')]=_0x27d4b2[_0xa8f5('0x43')]['id'];_0x50b3ec[_0xa8f5('0x5d')](_0x27d4b2[_0xa8f5('0x4a')][_0x254af3]);}return BPromise['each'](_0x50b3ec,function(_0x4019f3){return db[_0xa8f5('0x5a')][_0xa8f5('0x49')](_[_0xa8f5('0x5e')](_0x4019f3,[_0xa8f5('0x58'),'id'])||{},{'fields':_[_0xa8f5('0x33')](_0x4623d7),'raw':!![]})[_0xa8f5('0x24')](function(_0x27c5c3){_0x364bc0[_0xa8f5('0x5f')]['push'](_0x27c5c3['dataValues']);})[_0xa8f5('0x42')](function(_0xcd6158){_0x364bc0[_0xa8f5('0x60')][_0xa8f5('0x5d')]({'data':_0x4019f3,'error':_0xcd6158[_0xa8f5('0x61')]});});})[_0xa8f5('0x24')](function(_0x5dce6c){return _0x364bc0;})[_0xa8f5('0x42')](function(_0x99c68e){return _0x99c68e;});}else{_0x97aec5['status'](0x190)[_0xa8f5('0x20')]({'message':_0xa8f5('0x62')});}});}})['then'](respondWithResult(_0x97aec5,null))[_0xa8f5('0x42')](handleError(_0x97aec5,null));};exports['getContacts']=function(_0x76c8c3,_0x36ecf4,_0x18289f){var _0x28e20e;return db[_0xa8f5('0x41')][_0xa8f5('0x48')]({'where':{'id':_0x76c8c3['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xa8f5('0x63')}]})[_0xa8f5('0x24')](handleEntityNotFound(_0x36ecf4,null))[_0xa8f5('0x24')](function(_0x779c9f){if(_0x779c9f){_0x28e20e=_0x779c9f;return db[_0xa8f5('0x5a')][_0xa8f5('0x2d')];}})[_0xa8f5('0x24')](function(_0xa3cca8){if(_0xa3cca8){var _0x51a3a6={};var _0x54c6e0={};_0x54c6e0['model']=_['concat'](_['keys'](_0xa3cca8),_[_0xa8f5('0x2c')](_0x28e20e[_0xa8f5('0x63')],function(_0xa8c2a){return util[_0xa8f5('0x64')](_0xa8f5('0x65'),_0xa8c2a['id']);}));_0x54c6e0[_0xa8f5('0x32')]=_[_0xa8f5('0x33')](_0x76c8c3[_0xa8f5('0x32')]);_0x54c6e0['filters']=_[_0xa8f5('0x36')](_0x54c6e0[_0xa8f5('0x31')],_0x54c6e0['query']);_0x51a3a6['attributes']=_[_0xa8f5('0x36')](_0x54c6e0[_0xa8f5('0x31')],qs[_0xa8f5('0x44')](_0x76c8c3[_0xa8f5('0x32')][_0xa8f5('0x44')]));_0x51a3a6[_0xa8f5('0x35')]=_0x51a3a6[_0xa8f5('0x35')][_0xa8f5('0x37')]?_0x51a3a6['attributes']:_0x54c6e0[_0xa8f5('0x31')];if(!_0x76c8c3[_0xa8f5('0x32')]['hasOwnProperty']('nolimit')){_0x51a3a6['limit']=qs[_0xa8f5('0x1c')](_0x76c8c3[_0xa8f5('0x32')][_0xa8f5('0x1c')]);_0x51a3a6[_0xa8f5('0x1a')]=qs[_0xa8f5('0x1a')](_0x76c8c3[_0xa8f5('0x32')][_0xa8f5('0x1a')]);}_0x51a3a6['order']=qs[_0xa8f5('0x3b')](_0x76c8c3['query']['sort']);_0x51a3a6[_0xa8f5('0x3c')]=qs[_0xa8f5('0x34')](_[_0xa8f5('0x3d')](_0x76c8c3[_0xa8f5('0x32')],_0x54c6e0[_0xa8f5('0x34')]));_0x51a3a6[_0xa8f5('0x66')]=!![];if(_0x76c8c3[_0xa8f5('0x32')][_0xa8f5('0x40')]){_0x51a3a6[_0xa8f5('0x3c')]=_[_0xa8f5('0x3e')](_0x51a3a6['where'],{'$or':_[_0xa8f5('0x2c')](_0x51a3a6['attributes'],function(_0x1f7ecc){var _0x4715f8={};_0x4715f8[_0x1f7ecc]={'$like':'%'+_0x76c8c3[_0xa8f5('0x32')][_0xa8f5('0x40')]+'%'};return _0x4715f8;})});}_0x51a3a6=_[_0xa8f5('0x3e')]({},_0x51a3a6,_0x76c8c3[_0xa8f5('0x47')]);return _0x28e20e[_0xa8f5('0x67')](_0x51a3a6);}})[_0xa8f5('0x24')](respondWithResult(_0x36ecf4,null))[_0xa8f5('0x42')](handleError(_0x36ecf4,null));};exports['getContactsCsv']=function(_0x24b97b,_0x36487f,_0x1e830c){var _0xd48c16;var _0x16c1e5;var _0x568336;var _0x26d334=_0x24b97b[_0xa8f5('0x43')]['id'];csv_results=[];return db[_0xa8f5('0x68')][_0xa8f5('0x69')]({'attributes':['id',_0xa8f5('0x29')],'raw':!![],'order':[_0xa8f5('0x6a')]})[_0xa8f5('0x24')](function(_0x49cbee){_0xd48c16=_0x49cbee;var _0x2bd7c9=_['keys'](db[_0xa8f5('0x5a')]['rawAttributes']);return db[_0xa8f5('0x6b')][_0xa8f5('0x69')]({'raw':!![],'attributes':['id',_0xa8f5('0x6c')]})['then'](function(_0x4b611b){_0x16c1e5=_0x4b611b;var _0xce6ae4=squel['select']()[_0xa8f5('0x44')](_0x2bd7c9)[_0xa8f5('0x6d')](_0xa8f5('0x6e'),'c')['where'](_0xa8f5('0x6f'),_0x26d334)[_0xa8f5('0x3c')](_0xa8f5('0x70'))['distinct']();for(var _0x13635d=0x0;_0x13635d<_0x16c1e5[_0xa8f5('0x37')];_0x13635d++){_0xce6ae4[_0xa8f5('0x71')](_0xa8f5('0x72')+_0x16c1e5[_0x13635d]['id'],_0xa8f5('0x73')+_0x16c1e5[_0x13635d]['alias']);}for(var _0x13635d=0x0;_0x13635d<_0xd48c16['length'];_0x13635d++){_0xce6ae4[_0xa8f5('0x71')](squel['select']()[_0xa8f5('0x71')](_0xa8f5('0x74'))[_0xa8f5('0x6d')]('cm_contact_has_items')[_0xa8f5('0x3c')](_0xa8f5('0x75'),_0xd48c16[_0x13635d]['id'])[_0xa8f5('0x3c')]('CmContactId\x20=\x20c.id'),_0xa8f5('0x76')+_0xd48c16[_0x13635d][_0xa8f5('0x29')]);_0xce6ae4[_0xa8f5('0x71')](squel[_0xa8f5('0x77')]()[_0xa8f5('0x71')]('description')[_0xa8f5('0x6d')](_0xa8f5('0x78'))[_0xa8f5('0x3c')](_0xa8f5('0x75'),_0xd48c16[_0x13635d]['id'])[_0xa8f5('0x3c')](_0xa8f5('0x79')),_0xa8f5('0x7a')+_0xd48c16[_0x13635d][_0xa8f5('0x29')]);}var _0x461e29=[];_0x461e29[_0xa8f5('0x5d')](_0xce6ae4[_0xa8f5('0x7b')]());BPromise[_0xa8f5('0x7c')](_0x461e29,handleQuery)[_0xa8f5('0x24')](function(_0x244d11){handleQuery(_0xce6ae4[_0xa8f5('0x7b')]());var _0x403ae5=csv_results[0x0];if(!_[_0xa8f5('0x7d')](_0x403ae5)){var _0x599e68=toCsv(_0x403ae5);var _0x142ba6=Date['now']();fs[_0xa8f5('0x7e')](util[_0xa8f5('0x64')]('/tmp/list_%d_%s.csv',_0x26d334,_0x142ba6),_0x599e68);_0x36487f[_0xa8f5('0x7f')](_0xa8f5('0x80'),_0xa8f5('0x81')+util['format'](_0xa8f5('0x82'),_0x26d334,_0x142ba6));_0x36487f['setHeader']('Content-type',_0xa8f5('0x83'));return _0x36487f[_0xa8f5('0x84')](util[_0xa8f5('0x64')](_0xa8f5('0x85'),_0x26d334,_0x142ba6));}else{return _0x36487f[_0xa8f5('0x17')](0xcc);}});});});};exports['addCustomField']=function(_0x25ca8f,_0x59b8b6,_0x4e390e){var _0x213bf1;delete _0x25ca8f[_0xa8f5('0x4a')]['id'];return db['CmList'][_0xa8f5('0x55')]({'where':{'id':_0x25ca8f[_0xa8f5('0x43')]['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x59b8b6,null))['then'](function(_0x55bc09){if(_0x55bc09){return db[_0xa8f5('0x86')][_0xa8f5('0x87')](function(_0x404fd9){return db[_0xa8f5('0x6b')]['create'](_0x25ca8f[_0xa8f5('0x4a')],{'transaction':_0x404fd9})[_0xa8f5('0x24')](function(_0x2bf217){_0x213bf1=_0x2bf217;return _0x55bc09[_0xa8f5('0x88')](_0x2bf217,{'transaction':_0x404fd9});})[_0xa8f5('0x24')](function(){var _0x1c5beb={'type':db[_0xa8f5('0x89')][_0xa8f5('0x8a')],'transaction':_0x404fd9};switch(_0x25ca8f[_0xa8f5('0x4a')][_0xa8f5('0x2f')]){case'text':_0x1c5beb[_0xa8f5('0x2f')]=db[_0xa8f5('0x89')][_0xa8f5('0x8a')];break;case _0xa8f5('0x8b'):_0x1c5beb[_0xa8f5('0x2f')]=db[_0xa8f5('0x89')][_0xa8f5('0x8c')];break;case'switch':_0x1c5beb[_0xa8f5('0x2f')]=db[_0xa8f5('0x89')][_0xa8f5('0x8d')];_0x1c5beb[_0xa8f5('0x8e')]=![];break;default:}return db[_0xa8f5('0x86')][_0xa8f5('0x8f')][_0xa8f5('0x90')](_0xa8f5('0x6e'),util[_0xa8f5('0x64')](_0xa8f5('0x91'),_0x213bf1['id']),_0x1c5beb);})[_0xa8f5('0x24')](function(){return _0x213bf1;});});}})[_0xa8f5('0x24')](respondWithResult(_0x59b8b6,null))[_0xa8f5('0x42')](handleError(_0x59b8b6,null));};exports[_0xa8f5('0x92')]=function(_0xc4bf75,_0x11e201,_0x5e565d){var _0x5ae322={};var _0x236fcf={};var _0x221616;var _0x2afbff;return db['CmList'][_0xa8f5('0x55')]({'where':{'id':_0xc4bf75['params']['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x11e201,null))[_0xa8f5('0x24')](function(_0xbe11ae){if(_0xbe11ae){_0x221616=_0xbe11ae;_0x236fcf[_0xa8f5('0x31')]=_[_0xa8f5('0x33')](db[_0xa8f5('0x6b')][_0xa8f5('0x2d')]);_0x236fcf['query']=_[_0xa8f5('0x33')](_0xc4bf75[_0xa8f5('0x32')]);_0x236fcf['filters']=_['intersection'](_0x236fcf[_0xa8f5('0x31')],_0x236fcf[_0xa8f5('0x32')]);_0x5ae322[_0xa8f5('0x35')]=_[_0xa8f5('0x36')](_0x236fcf['model'],qs[_0xa8f5('0x44')](_0xc4bf75[_0xa8f5('0x32')][_0xa8f5('0x44')]));_0x5ae322[_0xa8f5('0x35')]=_0x5ae322[_0xa8f5('0x35')][_0xa8f5('0x37')]?_0x5ae322['attributes']:_0x236fcf[_0xa8f5('0x31')];_0x5ae322[_0xa8f5('0x3a')]=qs[_0xa8f5('0x3b')](_0xc4bf75[_0xa8f5('0x32')]['sort']);_0x5ae322['where']=qs[_0xa8f5('0x34')](_['pick'](_0xc4bf75[_0xa8f5('0x32')],_0x236fcf['filters']));_0x5ae322[_0xa8f5('0x3c')]=_[_0xa8f5('0x3e')](_0x5ae322[_0xa8f5('0x3c')],{'$or':[{'ListId':_0xbe11ae['id']},{'ListId':null}]});if(_0xc4bf75[_0xa8f5('0x32')][_0xa8f5('0x40')]){_0x5ae322[_0xa8f5('0x3c')]=_[_0xa8f5('0x3e')](_0x5ae322[_0xa8f5('0x3c')],{'$or':_[_0xa8f5('0x2c')](_0x5ae322[_0xa8f5('0x35')],function(_0x4e0b9e){var _0x50b2c2={};_0x50b2c2[_0x4e0b9e]={'$like':'%'+_0xc4bf75[_0xa8f5('0x32')][_0xa8f5('0x40')]+'%'};return _0x50b2c2;})});}_0x5ae322=_[_0xa8f5('0x3e')]({},_0x5ae322,_0xc4bf75[_0xa8f5('0x47')]);return db[_0xa8f5('0x6b')][_0xa8f5('0x93')](_0x5ae322);}})[_0xa8f5('0x24')](respondWithResult(_0x11e201,null))[_0xa8f5('0x42')](handleError(_0x11e201,null));};exports['getGlobalCustomFields']=function(_0x4c0622,_0x1e01eb){return db[_0xa8f5('0x6b')][_0xa8f5('0x93')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1e01eb,null))[_0xa8f5('0x24')](function(_0x28e336){return _0x28e336;})[_0xa8f5('0x24')](respondWithResult(_0x1e01eb,null))[_0xa8f5('0x42')](handleError(_0x1e01eb,null));};exports[_0xa8f5('0x94')]=function(_0x210d50,_0x1887a2,_0x1f35a2){return db[_0xa8f5('0x41')]['find']({'where':{'id':_0x210d50[_0xa8f5('0x43')]['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x1887a2,null))[_0xa8f5('0x24')](function(_0x46bd8b){if(_0x46bd8b){return _0x46bd8b[_0xa8f5('0x94')](_0x210d50[_0xa8f5('0x4a')][_0xa8f5('0x58')],_[_0xa8f5('0x5e')](_0x210d50[_0xa8f5('0x4a')],['ids','id'])||{})[_0xa8f5('0x95')](function(_0x351bbb){for(var _0x3004b0=0x0;_0x3004b0<_0x210d50['body'][_0xa8f5('0x58')]['length'];_0x3004b0+=0x1){socket[_0xa8f5('0x96')](_0xa8f5('0x97'),{'UserId':Number(_0x210d50['body'][_0xa8f5('0x58')][_0x3004b0]),'CmListId':Number(_0x210d50[_0xa8f5('0x43')]['id'])});}return _0x351bbb;});}})[_0xa8f5('0x24')](respondWithResult(_0x1887a2,null))[_0xa8f5('0x42')](handleError(_0x1887a2,null));};exports[_0xa8f5('0x98')]=function(_0x403591,_0x24c455,_0x527218){return db[_0xa8f5('0x41')][_0xa8f5('0x48')]({'where':{'id':_0x403591[_0xa8f5('0x43')]['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x24c455,null))[_0xa8f5('0x24')](function(_0x57441e){if(_0x57441e){return _0x57441e[_0xa8f5('0x98')](_0x403591[_0xa8f5('0x32')]['ids'])[_0xa8f5('0x24')](function(){if(_[_0xa8f5('0x99')](_0x403591['query'][_0xa8f5('0x58')])){for(var _0x2a38de=0x0;_0x2a38de<_0x403591['query']['ids'][_0xa8f5('0x37')];_0x2a38de+=0x1){socket[_0xa8f5('0x96')](_0xa8f5('0x9a'),{'UserId':Number(_0x403591[_0xa8f5('0x32')][_0xa8f5('0x58')][_0x2a38de]),'CmListId':Number(_0x403591['params']['id'])});}}else{socket[_0xa8f5('0x96')](_0xa8f5('0x9a'),{'UserId':Number(_0x403591[_0xa8f5('0x32')][_0xa8f5('0x58')]),'CmListId':Number(_0x403591[_0xa8f5('0x43')]['id'])});}});}})[_0xa8f5('0x24')](respondWithStatusCode(_0x24c455,null))[_0xa8f5('0x42')](handleError(_0x24c455,null));};exports[_0xa8f5('0x9b')]=function(_0x19947b,_0x1ff4b3,_0x33f565){var _0x2e3100={};var _0x2e40c4={};var _0xbe35d7;var _0xcb6020;return db[_0xa8f5('0x41')][_0xa8f5('0x55')]({'where':{'id':_0x19947b[_0xa8f5('0x43')]['id']}})[_0xa8f5('0x24')](handleEntityNotFound(_0x1ff4b3,null))['then'](function(_0x4b2d83){if(_0x4b2d83){_0xbe35d7=_0x4b2d83;_0x2e40c4[_0xa8f5('0x31')]=_[_0xa8f5('0x33')](db[_0xa8f5('0x9c')][_0xa8f5('0x2d')]);_0x2e40c4['query']=_[_0xa8f5('0x33')](_0x19947b[_0xa8f5('0x32')]);_0x2e40c4[_0xa8f5('0x34')]=_[_0xa8f5('0x36')](_0x2e40c4[_0xa8f5('0x31')],_0x2e40c4[_0xa8f5('0x32')]);_0x2e3100[_0xa8f5('0x35')]=_['intersection'](_0x2e40c4[_0xa8f5('0x31')],qs[_0xa8f5('0x44')](_0x19947b[_0xa8f5('0x32')][_0xa8f5('0x44')]));_0x2e3100[_0xa8f5('0x35')]=_0x2e3100[_0xa8f5('0x35')][_0xa8f5('0x37')]?_0x2e3100['attributes']:_0x2e40c4[_0xa8f5('0x31')];_0x2e3100[_0xa8f5('0x3a')]=qs[_0xa8f5('0x3b')](_0x19947b[_0xa8f5('0x32')][_0xa8f5('0x3b')]);_0x2e3100['where']=qs['filters'](_[_0xa8f5('0x3d')](_0x19947b[_0xa8f5('0x32')],_0x2e40c4[_0xa8f5('0x34')]));if(_0x19947b['query'][_0xa8f5('0x40')]){_0x2e3100[_0xa8f5('0x3c')]=_[_0xa8f5('0x3e')](_0x2e3100[_0xa8f5('0x3c')],{'$or':_[_0xa8f5('0x2c')](_0x2e3100[_0xa8f5('0x35')],function(_0x3db464){var _0x441c7b={};_0x441c7b[_0x3db464]={'$like':'%'+_0x19947b[_0xa8f5('0x32')][_0xa8f5('0x40')]+'%'};return _0x441c7b;})});}_0x2e3100=_[_0xa8f5('0x3e')]({},_0x2e3100,_0x19947b[_0xa8f5('0x47')]);return _0xbe35d7[_0xa8f5('0x9b')](_0x2e3100);}})['then'](function(_0x2e8d9c){if(_0x2e8d9c){_0xcb6020=_0x2e8d9c[_0xa8f5('0x37')];if(!_0x19947b[_0xa8f5('0x32')]['hasOwnProperty'](_0xa8f5('0x39'))){_0x2e3100[_0xa8f5('0x1c')]=qs[_0xa8f5('0x1c')](_0x19947b['query'][_0xa8f5('0x1c')]);_0x2e3100['offset']=qs['offset'](_0x19947b['query']['offset']);}return _0xbe35d7['getAgents'](_0x2e3100);}})[_0xa8f5('0x24')](function(_0x1d79bc){if(_0x1d79bc){return _0x1d79bc?{'count':_0xcb6020,'rows':_0x1d79bc}:null;}})['then'](respondWithResult(_0x1ff4b3,null))['catch'](handleError(_0x1ff4b3,null));};function handleQuery(_0x2a63dc){logger[_0xa8f5('0x9d')](_0x2a63dc);return db['sequelize']['query'](_0x2a63dc)['spread'](function(_0x1a8f45){csv_results[_0xa8f5('0x5d')](_0x1a8f45);})[_0xa8f5('0x42')](function(_0x3d8eda){logger['error'](_0x3d8eda[_0xa8f5('0x61')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 998a37d..bff6555 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x3a2944,_0x1fdc7c){var _0x12d927=function(_0x1ffcda){while(--_0x1ffcda){_0x3a2944['push'](_0x3a2944['shift']());}};_0x12d927(++_0x1fdc7c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x27184e,_0x3d9a82){_0x27184e=_0x27184e-0x0;var _0x304c78=_0xe14b[_0x27184e];return _0x304c78;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 92334e1..5045279 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2ea=['cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0xd2ea,0x15f));var _0xad2e=function(_0x53f010,_0x4bda85){_0x53f010=_0x53f010-0x0;var _0x3092fd=_0xd2ea[_0x53f010];return _0x3092fd;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0x3967da,_0x37f2a7){var _0x1ec7fe=function(_0x587e76){while(--_0x587e76){_0x3967da['push'](_0x3967da['shift']());}};_0x1ec7fe(++_0x37f2a7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xcb91[_0x4409e7];return _0x24c751;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmList',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 36e73d9..d62462d 100644 --- a/server/api/cmList/cmList.rpc.js +++ b/server/api/cmList/cmList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aa3=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x3cb1f9,_0x12be1d){var _0xadfba7=function(_0x55c8fd){while(--_0x55c8fd){_0x3cb1f9['push'](_0x3cb1f9['shift']());}};_0xadfba7(++_0x12be1d);}(_0x2aa3,0x135));var _0x32aa=function(_0x3dd6be,_0x58ffde){_0x3dd6be=_0x3dd6be-0x0;var _0x453fff=_0x2aa3[_0x3dd6be];return _0x453fff;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require(_0x32aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32aa('0x5'));var logger=require('../../config/logger')(_0x32aa('0x6'));var config=require(_0x32aa('0x7'));var jayson=require(_0x32aa('0x8'));var client=jayson[_0x32aa('0x9')][_0x32aa('0xa')]({'port':0x232a});config[_0x32aa('0xb')]=_[_0x32aa('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32aa('0xb')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x2c9221,_0x385f45,_0x52e9f3){return new BPromise(function(_0x1cc251,_0x1c8a53){return client[_0x32aa('0xd')](_0x2c9221,_0x52e9f3)[_0x32aa('0xe')](function(_0x11a9d6){logger[_0x32aa('0xf')](_0x32aa('0x10'),_0x385f45,_0x32aa('0x11'));logger[_0x32aa('0x12')](_0x32aa('0x13'),_0x385f45,_0x32aa('0x11'),JSON[_0x32aa('0x14')](_0x11a9d6));if(_0x11a9d6['error']){if(_0x11a9d6[_0x32aa('0x15')]['code']===0x1f4){logger[_0x32aa('0x15')](_0x32aa('0x10'),_0x385f45,_0x11a9d6[_0x32aa('0x15')][_0x32aa('0x16')]);return _0x1c8a53(_0x11a9d6[_0x32aa('0x15')][_0x32aa('0x16')]);}logger[_0x32aa('0x15')](_0x32aa('0x10'),_0x385f45,_0x11a9d6['error'][_0x32aa('0x16')]);return _0x1cc251(_0x11a9d6['error']['message']);}else{logger[_0x32aa('0xf')]('CmList,\x20%s,\x20%s',_0x385f45,_0x32aa('0x11'));_0x1cc251(_0x11a9d6[_0x32aa('0x17')][_0x32aa('0x16')]);}})['catch'](function(_0x40c13f){logger[_0x32aa('0x15')](_0x32aa('0x10'),_0x385f45,_0x40c13f);_0x1c8a53(_0x40c13f);});});} \ No newline at end of file +var _0x1898=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x57f89e,_0x4c815e){var _0x209c78=function(_0x171e3b){while(--_0x171e3b){_0x57f89e['push'](_0x57f89e['shift']());}};_0x209c78(++_0x4c815e);}(_0x1898,0x98));var _0x8189=function(_0x493375,_0x24ff09){_0x493375=_0x493375-0x0;var _0x57e3cf=_0x1898[_0x493375];return _0x57e3cf;};'use strict';var _=require(_0x8189('0x0'));var util=require(_0x8189('0x1'));var moment=require('moment');var BPromise=require(_0x8189('0x2'));var rs=require(_0x8189('0x3'));var fs=require('fs');var Redis=require(_0x8189('0x4'));var db=require(_0x8189('0x5'))['db'];var utils=require(_0x8189('0x6'));var logger=require(_0x8189('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8189('0x8'));var client=jayson[_0x8189('0x9')][_0x8189('0xa')]({'port':0x232a});config[_0x8189('0xb')]=_[_0x8189('0xc')](config[_0x8189('0xb')],{'host':_0x8189('0xd'),'port':0x18eb});var socket=require(_0x8189('0xe'))(new Redis(config[_0x8189('0xb')]));require('./cmList.socket')[_0x8189('0xf')](socket);function respondWithRpcPromise(_0x567438,_0x5a192f,_0x58129a){return new BPromise(function(_0x4a0499,_0x466aaf){return client[_0x8189('0x10')](_0x567438,_0x58129a)[_0x8189('0x11')](function(_0x4585a9){logger[_0x8189('0x12')](_0x8189('0x13'),_0x5a192f,_0x8189('0x14'));logger[_0x8189('0x15')](_0x8189('0x16'),_0x5a192f,_0x8189('0x14'),JSON[_0x8189('0x17')](_0x4585a9));if(_0x4585a9[_0x8189('0x18')]){if(_0x4585a9[_0x8189('0x18')][_0x8189('0x19')]===0x1f4){logger[_0x8189('0x18')](_0x8189('0x13'),_0x5a192f,_0x4585a9['error'][_0x8189('0x1a')]);return _0x466aaf(_0x4585a9[_0x8189('0x18')][_0x8189('0x1a')]);}logger[_0x8189('0x18')](_0x8189('0x13'),_0x5a192f,_0x4585a9[_0x8189('0x18')][_0x8189('0x1a')]);return _0x4a0499(_0x4585a9[_0x8189('0x18')]['message']);}else{logger[_0x8189('0x12')]('CmList,\x20%s,\x20%s',_0x5a192f,_0x8189('0x14'));_0x4a0499(_0x4585a9[_0x8189('0x1b')][_0x8189('0x1a')]);}})['catch'](function(_0x2acc81){logger['error']('CmList,\x20%s,\x20%s',_0x5a192f,_0x2acc81);_0x466aaf(_0x2acc81);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 8a26f96..7ac9b6b 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['removeListener','length','cmList:','./cmList.events','remove','update','emit'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xcb91,0xea));var _0x1cb9=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0xcb91[_0x144b30];return _0x1bb7bc;};'use strict';var CmListEvents=require(_0x1cb9('0x0'));var events=['save',_0x1cb9('0x1'),_0x1cb9('0x2')];function createListener(_0x1e10c2,_0xf48d4d){return function(_0xc47284){_0xf48d4d[_0x1cb9('0x3')](_0x1e10c2,_0xc47284);};}function removeListener(_0x3d363a,_0xd401bc){return function(){CmListEvents[_0x1cb9('0x4')](_0x3d363a,_0xd401bc);};}exports['register']=function(_0x55ae37){for(var _0x222620=0x0,_0x113964=events[_0x1cb9('0x5')];_0x222620<_0x113964;_0x222620++){var _0x43ecaf=events[_0x222620];var _0x4178c9=createListener(_0x1cb9('0x6')+_0x43ecaf,_0x55ae37);CmListEvents['on'](_0x43ecaf,_0x4178c9);}}; \ No newline at end of file +var _0xd81b=['register','length','./cmList.events','save','remove','emit'];(function(_0xfaccbd,_0x1931d8){var _0x4cc90c=function(_0x1a0e6e){while(--_0x1a0e6e){_0xfaccbd['push'](_0xfaccbd['shift']());}};_0x4cc90c(++_0x1931d8);}(_0xd81b,0x152));var _0xbd81=function(_0x36ac17,_0x5bca12){_0x36ac17=_0x36ac17-0x0;var _0x288dd8=_0xd81b[_0x36ac17];return _0x288dd8;};'use strict';var CmListEvents=require(_0xbd81('0x0'));var events=[_0xbd81('0x1'),_0xbd81('0x2'),'update'];function createListener(_0x4bbb23,_0x16fd7f){return function(_0xc83298){_0x16fd7f[_0xbd81('0x3')](_0x4bbb23,_0xc83298);};}function removeListener(_0x127b13,_0x45b0a9){return function(){CmListEvents['removeListener'](_0x127b13,_0x45b0a9);};}exports[_0xbd81('0x4')]=function(_0x1eda37){for(var _0x37a130=0x0,_0x22393e=events[_0xbd81('0x5')];_0x37a130<_0x22393e;_0x37a130++){var _0x27e29e=events[_0x37a130];var _0x6d5d9d=createListener('cmList:'+_0x27e29e,_0x1eda37);CmListEvents['on'](_0x27e29e,_0x6d5d9d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 5af90eb..1425052 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4df1=['isAuthenticated','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get'];(function(_0x4defee,_0x1b914f){var _0x4eb5d9=function(_0xc2add7){while(--_0xc2add7){_0x4defee['push'](_0x4defee['shift']());}};_0x4eb5d9(++_0x1b914f);}(_0x4df1,0x85));var _0x14df=function(_0x2dbbf7,_0xeef0e2){_0x2dbbf7=_0x2dbbf7-0x0;var _0x50cfbb=_0x4df1[_0x2dbbf7];return _0x50cfbb;};'use strict';var multer=require(_0x14df('0x0'));var util=require(_0x14df('0x1'));var path=require(_0x14df('0x2'));var timeout=require(_0x14df('0x3'));var express=require(_0x14df('0x4'));var router=express[_0x14df('0x5')]();var fs_extra=require(_0x14df('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x14df('0x7'));var config=require(_0x14df('0x8'));var controller=require(_0x14df('0x9'));router[_0x14df('0xa')]('/',auth[_0x14df('0xb')](),controller['index']);router[_0x14df('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x14df('0xc')]);router[_0x14df('0xa')]('/global_fields',auth[_0x14df('0xb')](),controller['getGlobalCustomFields']);router['get'](_0x14df('0xd'),auth[_0x14df('0xb')](),controller[_0x14df('0xe')]);router[_0x14df('0xa')]('/:id/dispositions',auth[_0x14df('0xb')](),controller[_0x14df('0xf')]);router[_0x14df('0xa')](_0x14df('0x10'),auth['isAuthenticated'](),controller[_0x14df('0x11')]);router['get'](_0x14df('0x12'),auth[_0x14df('0xb')](),controller['getContactsCsv']);router['get'](_0x14df('0x13'),auth[_0x14df('0xb')](),controller[_0x14df('0x14')]);router['get'](_0x14df('0x15'),auth[_0x14df('0xb')](),controller[_0x14df('0x16')]);router[_0x14df('0x17')]('/',auth[_0x14df('0xb')](),controller[_0x14df('0x18')]);router['post'](_0x14df('0x19'),auth[_0x14df('0xb')](),controller[_0x14df('0x1a')]);router['post']('/:id/contacts',auth[_0x14df('0xb')](),controller[_0x14df('0x1b')]);router[_0x14df('0x17')](_0x14df('0x13'),auth[_0x14df('0xb')](),controller[_0x14df('0x1c')]);router[_0x14df('0x17')](_0x14df('0x15'),auth[_0x14df('0xb')](),controller[_0x14df('0x1d')]);router[_0x14df('0x1e')](_0x14df('0xd'),auth[_0x14df('0xb')](),controller[_0x14df('0x1f')]);router[_0x14df('0x20')]('/:id',auth[_0x14df('0xb')](),controller[_0x14df('0x21')]);router[_0x14df('0x20')](_0x14df('0x19'),auth[_0x14df('0xb')](),controller['removeDispositions']);router['delete'](_0x14df('0x15'),auth[_0x14df('0xb')](),controller[_0x14df('0x22')]);module[_0x14df('0x23')]=router; \ No newline at end of file +var _0xa88b=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','/:id/dispositions','addCustomField','addAgents','put','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','describe','isAuthenticated','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xa88b,0x157));var _0xba88=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa88b[_0x32f7d7];return _0x133d09;};'use strict';var multer=require(_0xba88('0x0'));var util=require(_0xba88('0x1'));var path=require(_0xba88('0x2'));var timeout=require(_0xba88('0x3'));var express=require(_0xba88('0x4'));var router=express[_0xba88('0x5')]();var fs_extra=require(_0xba88('0x6'));var auth=require(_0xba88('0x7'));var interaction=require(_0xba88('0x8'));var config=require(_0xba88('0x9'));var controller=require(_0xba88('0xa'));router[_0xba88('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xba88('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xba88('0xc')]);router['get']('/global_fields',auth[_0xba88('0xd')](),controller['getGlobalCustomFields']);router[_0xba88('0xb')](_0xba88('0xe'),auth[_0xba88('0xd')](),controller[_0xba88('0xf')]);router[_0xba88('0xb')]('/:id/dispositions',auth[_0xba88('0xd')](),controller[_0xba88('0x10')]);router[_0xba88('0xb')](_0xba88('0x11'),auth['isAuthenticated'](),controller[_0xba88('0x12')]);router[_0xba88('0xb')](_0xba88('0x13'),auth[_0xba88('0xd')](),controller[_0xba88('0x14')]);router[_0xba88('0xb')](_0xba88('0x15'),auth[_0xba88('0xd')](),controller[_0xba88('0x16')]);router['get'](_0xba88('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0xba88('0x18')]('/',auth[_0xba88('0xd')](),controller['create']);router[_0xba88('0x18')](_0xba88('0x19'),auth[_0xba88('0xd')](),controller['addDisposition']);router[_0xba88('0x18')](_0xba88('0x11'),auth[_0xba88('0xd')](),controller['addContacts']);router[_0xba88('0x18')](_0xba88('0x15'),auth[_0xba88('0xd')](),controller[_0xba88('0x1a')]);router[_0xba88('0x18')](_0xba88('0x17'),auth[_0xba88('0xd')](),controller[_0xba88('0x1b')]);router[_0xba88('0x1c')]('/:id',auth[_0xba88('0xd')](),controller['update']);router['delete'](_0xba88('0xe'),auth[_0xba88('0xd')](),controller['destroy']);router[_0xba88('0x1d')](_0xba88('0x19'),auth['isAuthenticated'](),controller[_0xba88('0x1e')]);router[_0xba88('0x1d')](_0xba88('0x17'),auth[_0xba88('0xd')](),controller[_0xba88('0x1f')]);module[_0xba88('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 13709a5..7e475e1 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaff=['STRING','exports','VIRTUAL','getDataValue','field'];(function(_0x1c9fb3,_0x21f8e3){var _0x5944cc=function(_0x37d7cb){while(--_0x37d7cb){_0x1c9fb3['push'](_0x1c9fb3['shift']());}};_0x5944cc(++_0x21f8e3);}(_0xbaff,0xc9));var _0xfbaf=function(_0xbd7618,_0x180b0c){_0xbd7618=_0xbd7618-0x0;var _0x55ad81=_0xbaff[_0xbd7618];return _0x55ad81;};'use strict';var Sequelize=require('sequelize');module[_0xfbaf('0x0')]={'name':{'type':Sequelize[_0xfbaf('0x1')],'get':function(_0x20f95c){return this[_0xfbaf('0x2')](_0xfbaf('0x3'));}},'field':{'type':Sequelize[_0xfbaf('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xfbaf('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xfbaf('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x421f=['STRING','exports','VIRTUAL','field'];(function(_0x543c97,_0x38b566){var _0x57d3e0=function(_0x2939ef){while(--_0x2939ef){_0x543c97['push'](_0x543c97['shift']());}};_0x57d3e0(++_0x38b566);}(_0x421f,0x1bd));var _0xf421=function(_0x913b85,_0x213182){_0x913b85=_0x913b85-0x0;var _0x1ce434=_0x421f[_0x913b85];return _0x1ce434;};'use strict';var Sequelize=require('sequelize');module[_0xf421('0x0')]={'name':{'type':Sequelize[_0xf421('0x1')],'get':function(_0xd56696){return this['getDataValue'](_0xf421('0x2'));}},'field':{'type':Sequelize[_0xf421('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xf421('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xf421('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 4d468bc..2bf7cd5 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x471701,_0x2214a1){var _0x52120b=function(_0x146d94){while(--_0x146d94){_0x471701['push'](_0x471701['shift']());}};_0x52120b(++_0x2214a1);}(_0x7a54,0x106));var _0x47a5=function(_0x1bd594,_0x3cfaa6){_0x1bd594=_0x1bd594-0x0;var _0x4ccc54=_0x7a54[_0x1bd594];return _0x4ccc54;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4e14f6,_0x15b0ac){var _0x38412b=function(_0x249f1d){while(--_0x249f1d){_0x4e14f6['push'](_0x4e14f6['shift']());}};_0x38412b(++_0x15b0ac);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c8e9758..410383f 100644 --- a/server/api/condition/condition.model.js +++ b/server/api/condition/condition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13c3=['exports','define','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13c3,0x1d6));var _0x313c=function(_0x4bddd5,_0x5f33f2){_0x4bddd5=_0x4bddd5-0x0;var _0x5658b9=_0x13c3[_0x4bddd5];return _0x5658b9;};'use strict';var _=require(_0x313c('0x0'));var util=require(_0x313c('0x1'));var logger=require(_0x313c('0x2'))(_0x313c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x313c('0x4'));var fs=require('fs');var path=require(_0x313c('0x5'));var rimraf=require(_0x313c('0x6'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0x313c('0x7')]=function(_0x6f9ac9,_0x36d70f){return _0x6f9ac9[_0x313c('0x8')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0893=['../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5f8862,_0x3838ee){var _0x4285b5=function(_0x25e9de){while(--_0x25e9de){_0x5f8862['push'](_0x5f8862['shift']());}};_0x4285b5(++_0x3838ee);}(_0x0893,0x19d));var _0x3089=function(_0xe13b27,_0x30825f){_0xe13b27=_0xe13b27-0x0;var _0xf94bc3=_0x0893[_0xe13b27];return _0xf94bc3;};'use strict';var _=require(_0x3089('0x0'));var util=require(_0x3089('0x1'));var logger=require(_0x3089('0x2'))('api');var moment=require(_0x3089('0x3'));var BPromise=require(_0x3089('0x4'));var rp=require(_0x3089('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3089('0x6'));var config=require(_0x3089('0x7'));var attributes=require(_0x3089('0x8'));module[_0x3089('0x9')]=function(_0xbcc7a1,_0x518101){return _0xbcc7a1[_0x3089('0xa')](_0x3089('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index c3c35a0..0f705b4 100644 --- a/server/api/condition/condition.rpc.js +++ b/server/api/condition/condition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61b0=['../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x65678f,_0x5983f5){var _0x19dc10=function(_0x80f9ec){while(--_0x80f9ec){_0x65678f['push'](_0x65678f['shift']());}};_0x19dc10(++_0x5983f5);}(_0x61b0,0xea));var _0x061b=function(_0x3d5a7a,_0x423f63){_0x3d5a7a=_0x3d5a7a-0x0;var _0x1680f0=_0x61b0[_0x3d5a7a];return _0x1680f0;};'use strict';var _=require(_0x061b('0x0'));var util=require(_0x061b('0x1'));var moment=require(_0x061b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x061b('0x3'));var db=require(_0x061b('0x4'))['db'];var utils=require(_0x061b('0x5'));var logger=require(_0x061b('0x6'))(_0x061b('0x7'));var config=require(_0x061b('0x8'));var jayson=require(_0x061b('0x9'));var client=jayson[_0x061b('0xa')][_0x061b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ef06d,_0x47e2eb,_0x267e4f){return new BPromise(function(_0x6d9859,_0x56d5a9){return client[_0x061b('0xc')](_0x4ef06d,_0x267e4f)[_0x061b('0xd')](function(_0x3e951c){logger[_0x061b('0xe')](_0x061b('0xf'),_0x47e2eb,_0x061b('0x10'));logger[_0x061b('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0x47e2eb,_0x061b('0x10'),JSON[_0x061b('0x12')](_0x3e951c));if(_0x3e951c[_0x061b('0x13')]){if(_0x3e951c[_0x061b('0x13')]['code']===0x1f4){logger[_0x061b('0x13')](_0x061b('0xf'),_0x47e2eb,_0x3e951c[_0x061b('0x13')]['message']);return _0x56d5a9(_0x3e951c[_0x061b('0x13')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x47e2eb,_0x3e951c[_0x061b('0x13')]['message']);return _0x6d9859(_0x3e951c[_0x061b('0x13')][_0x061b('0x14')]);}else{logger['info'](_0x061b('0xf'),_0x47e2eb,_0x061b('0x10'));_0x6d9859(_0x3e951c['result'][_0x061b('0x14')]);}})[_0x061b('0x15')](function(_0x869aeb){logger[_0x061b('0x13')](_0x061b('0xf'),_0x47e2eb,_0x869aeb);_0x56d5a9(_0x869aeb);});});} \ No newline at end of file +var _0xd492=['../../config/logger','rpc','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','ioredis','../../mysqldb'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xd492,0xa7));var _0x2d49=function(_0xcb064c,_0x240867){_0xcb064c=_0xcb064c-0x0;var _0x284222=_0xd492[_0xcb064c];return _0x284222;};'use strict';var _=require('lodash');var util=require(_0x2d49('0x0'));var moment=require('moment');var BPromise=require(_0x2d49('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d49('0x2'));var db=require(_0x2d49('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d49('0x4'))(_0x2d49('0x5'));var config=require('../../config/environment');var jayson=require(_0x2d49('0x6'));var client=jayson['client'][_0x2d49('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29e763,_0x2afe52,_0xaa65ad){return new BPromise(function(_0x1975b,_0x1aac39){return client[_0x2d49('0x8')](_0x29e763,_0xaa65ad)[_0x2d49('0x9')](function(_0x24f4de){logger[_0x2d49('0xa')](_0x2d49('0xb'),_0x2afe52,'request\x20sent');logger['debug'](_0x2d49('0xc'),_0x2afe52,_0x2d49('0xd'),JSON[_0x2d49('0xe')](_0x24f4de));if(_0x24f4de[_0x2d49('0xf')]){if(_0x24f4de[_0x2d49('0xf')]['code']===0x1f4){logger['error'](_0x2d49('0xb'),_0x2afe52,_0x24f4de['error']['message']);return _0x1aac39(_0x24f4de[_0x2d49('0xf')][_0x2d49('0x10')]);}logger[_0x2d49('0xf')](_0x2d49('0xb'),_0x2afe52,_0x24f4de[_0x2d49('0xf')][_0x2d49('0x10')]);return _0x1975b(_0x24f4de[_0x2d49('0xf')][_0x2d49('0x10')]);}else{logger['info'](_0x2d49('0xb'),_0x2afe52,_0x2d49('0xd'));_0x1975b(_0x24f4de[_0x2d49('0x11')][_0x2d49('0x10')]);}})[_0x2d49('0x12')](function(_0x25ff47){logger[_0x2d49('0xf')](_0x2d49('0xb'),_0x2afe52,_0x25ff47);_0x1aac39(_0x25ff47);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 85fe1b7..2ab509c 100644 --- a/server/api/condition/index.js +++ b/server/api/condition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93e2=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x127154,_0x85a17a){var _0x4f8ebf=function(_0x6f910d){while(--_0x6f910d){_0x127154['push'](_0x127154['shift']());}};_0x4f8ebf(++_0x85a17a);}(_0x93e2,0x12c));var _0x293e=function(_0x152a70,_0x179f8d){_0x152a70=_0x152a70-0x0;var _0x480c5f=_0x93e2[_0x152a70];return _0x480c5f;};'use strict';var multer=require(_0x293e('0x0'));var util=require(_0x293e('0x1'));var path=require(_0x293e('0x2'));var timeout=require(_0x293e('0x3'));var express=require(_0x293e('0x4'));var router=express[_0x293e('0x5')]();var fs_extra=require(_0x293e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x293e('0x7'));var config=require(_0x293e('0x8'));var controller=require(_0x293e('0x9'));router[_0x293e('0xa')](_0x293e('0xb'),auth[_0x293e('0xc')](),controller[_0x293e('0xd')]);router['delete'](_0x293e('0xb'),auth[_0x293e('0xc')](),controller[_0x293e('0xe')]);module[_0x293e('0xf')]=router; \ No newline at end of file +var _0x71ec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','delete','destroy','util','connect-timeout','express','Router','fs-extra'];(function(_0x3aa779,_0x4a18c5){var _0x2fd150=function(_0x239bb1){while(--_0x239bb1){_0x3aa779['push'](_0x3aa779['shift']());}};_0x2fd150(++_0x4a18c5);}(_0x71ec,0x15a));var _0xc71e=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x71ec[_0x4d8a8f];return _0xfc4adc;};'use strict';var multer=require('multer');var util=require(_0xc71e('0x0'));var path=require('path');var timeout=require(_0xc71e('0x1'));var express=require(_0xc71e('0x2'));var router=express[_0xc71e('0x3')]();var fs_extra=require(_0xc71e('0x4'));var auth=require(_0xc71e('0x5'));var interaction=require(_0xc71e('0x6'));var config=require(_0xc71e('0x7'));var controller=require(_0xc71e('0x8'));router['put'](_0xc71e('0x9'),auth[_0xc71e('0xa')](),controller['update']);router[_0xc71e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc71e('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index a50dbc1..ac274e4 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77fe=['INTEGER','sequelize','exports','STRING'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x77fe,0x115));var _0xe77f=function(_0x216816,_0x56e87a){_0x216816=_0x216816-0x0;var _0x4e1886=_0x77fe[_0x216816];return _0x4e1886;};'use strict';var Sequelize=require(_0xe77f('0x0'));module[_0xe77f('0x1')]={'name':{'type':Sequelize[_0xe77f('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xe77f('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe77f('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd4ce=['STRING','name','INTEGER','sequelize'];(function(_0x315aa8,_0x262f9c){var _0x20f758=function(_0x1765e7){while(--_0x1765e7){_0x315aa8['push'](_0x315aa8['shift']());}};_0x20f758(++_0x262f9c);}(_0xd4ce,0x1d3));var _0xed4c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd4ce[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0xed4c('0x0'));module['exports']={'name':{'type':Sequelize[_0xed4c('0x1')],'allowNull':![],'unique':_0xed4c('0x2')},'OrderBy':{'type':Sequelize[_0xed4c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xed4c('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 69a7803..cd4a574 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abf=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','model','keys','query','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','ContactItemType','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','destroy','CmContactHasItem','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x383259,_0x7b25a2){var _0x5484a2=function(_0x3e7294){while(--_0x3e7294){_0x383259['push'](_0x383259['shift']());}};_0x5484a2(++_0x7b25a2);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=typeof _0x3c5bfd[_0xf0ab('0x1b')]===_0xf0ab('0x1c')&&typeof _0x3c5bfd[_0xf0ab('0x1d')]==='undefined';var _0x457465=_0x20f453[_0xf0ab('0x1e')];var _0x1803f0=_0x221bac?0x0:_0x3c5bfd[_0xf0ab('0x1b')];var _0x776619=_0x221bac?_0x20f453[_0xf0ab('0x1e')]:_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1d')];var _0x1713d6;if(_0x776619>=_0x457465){_0x776619=_0x457465;_0x1713d6=0xc8;}else{_0x1713d6=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x1713d6);return _0x180d0b[_0xf0ab('0x1f')](_0xf0ab('0x20'),_0x1803f0+'-'+_0x776619+'/'+_0x457465)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x22a205){return function(_0x2cd961){try{jsonpatch[_0xf0ab('0x21')](_0x2cd961,_0x22a205,!![]);}catch(_0x537673){return BPromise[_0xf0ab('0x22')](_0x537673);}return _0x2cd961[_0xf0ab('0x23')]();};}function saveUpdates(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x24')](_0x1e1483)[_0xf0ab('0x25')](function(_0x20140b){return _0x20140b;});}return null;};}function removeEntity(_0x36ad01,_0x18bb37){return function(_0x43119f){if(_0x43119f){return _0x43119f['destroy']()['then'](function(){var _0x4eee21=_0x43119f[_0xf0ab('0x26')]({'plain':!![]});var _0x4f0caf=_0xf0ab('0x27');return db[_0xf0ab('0x28')]['destroy']({'where':{'type':_0x4f0caf,'resourceId':_0x4eee21['id']}})[_0xf0ab('0x25')](function(){return _0x43119f;});})[_0xf0ab('0x25')](function(){_0x36ad01[_0xf0ab('0x18')](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x7d4ff9,_0x502921){return function(_0x2d0da7){if(!_0x2d0da7){_0x7d4ff9['sendStatus'](0x194);}return _0x2d0da7;};}function handleError(_0x55d799,_0x1dcd2e){_0x1dcd2e=_0x1dcd2e||0x1f4;return function(_0x4306c6){logger[_0xf0ab('0x29')](_0x4306c6[_0xf0ab('0x2a')]);if(_0x4306c6[_0xf0ab('0x2b')]){delete _0x4306c6[_0xf0ab('0x2b')];}_0x55d799[_0xf0ab('0x18')](_0x1dcd2e)[_0xf0ab('0x2c')](_0x4306c6);};}exports[_0xf0ab('0x2d')]=function(_0x2f0fcd,_0x21e8ac){var _0x199753={},_0x58cbe1={},_0x1e1ffb={'count':0x0,'rows':[]};var _0x35973a=_['map'](db['ContactItemType'][_0xf0ab('0x2e')],function(_0x1dc84e){return{'name':_0x1dc84e[_0xf0ab('0x2f')],'type':_0x1dc84e['type']['key']};});_0x58cbe1[_0xf0ab('0x30')]=_['map'](_0x35973a,_0xf0ab('0x2b'));_0x58cbe1['query']=_[_0xf0ab('0x31')](_0x2f0fcd[_0xf0ab('0x32')]);_0x58cbe1['filters']=_['intersection'](_0x58cbe1[_0xf0ab('0x30')],_0x58cbe1[_0xf0ab('0x32')]);_0x199753[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x58cbe1[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x199753[_0xf0ab('0x33')]=_0x199753[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x199753[_0xf0ab('0x33')]:_0x58cbe1[_0xf0ab('0x30')];if(!_0x2f0fcd[_0xf0ab('0x32')]['hasOwnProperty'](_0xf0ab('0x37'))){_0x199753[_0xf0ab('0x1d')]=qs[_0xf0ab('0x1d')](_0x2f0fcd['query'][_0xf0ab('0x1d')]);_0x199753[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x2f0fcd['query'][_0xf0ab('0x1b')]);}_0x199753['order']=qs[_0xf0ab('0x38')](_0x2f0fcd['query'][_0xf0ab('0x38')]);_0x199753[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_[_0xf0ab('0x3b')](_0x2f0fcd[_0xf0ab('0x32')],_0x58cbe1[_0xf0ab('0x3a')]),_0x35973a);if(_0x2f0fcd['query'][_0xf0ab('0x3c')]){_0x199753[_0xf0ab('0x39')]=_['merge'](_0x199753[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x3d')](_0x35973a,function(_0x1d4eec){if(_0x1d4eec[_0xf0ab('0x3e')]!==_0xf0ab('0x3f')){var _0x11e3b7={};_0x11e3b7[_0x1d4eec[_0xf0ab('0x2b')]]={'$like':'%'+_0x2f0fcd['query'][_0xf0ab('0x3c')]+'%'};return _0x11e3b7;}})});}_0x199753=_[_0xf0ab('0x40')]({},_0x199753,_0x2f0fcd[_0xf0ab('0x41')]);var _0x4bd6d1={'where':_0x199753[_0xf0ab('0x39')]};return db[_0xf0ab('0x42')][_0xf0ab('0x1e')](_0x4bd6d1)[_0xf0ab('0x25')](function(_0x2b7ed5){_0x1e1ffb['count']=_0x2b7ed5;if(_0x2f0fcd[_0xf0ab('0x32')][_0xf0ab('0x43')]){_0x199753[_0xf0ab('0x44')]=[{'all':!![]}];}return db[_0xf0ab('0x42')][_0xf0ab('0x45')](_0x199753);})[_0xf0ab('0x25')](function(_0x45849c){_0x1e1ffb[_0xf0ab('0x46')]=_0x45849c;return _0x1e1ffb;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x21e8ac,_0x199753))[_0xf0ab('0x47')](handleError(_0x21e8ac,null));};exports[_0xf0ab('0x48')]=function(_0x32ec93,_0x22a265){var _0x5e6b6b={'raw':!![],'where':{'id':_0x32ec93[_0xf0ab('0x49')]['id']}},_0x4c4ab9={};_0x4c4ab9['model']=_[_0xf0ab('0x31')](db[_0xf0ab('0x42')]['rawAttributes']);_0x4c4ab9[_0xf0ab('0x32')]=_[_0xf0ab('0x31')](_0x32ec93['query']);_0x4c4ab9[_0xf0ab('0x3a')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],_0x4c4ab9[_0xf0ab('0x32')]);_0x5e6b6b[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x4c4ab9[_0xf0ab('0x30')],qs[_0xf0ab('0x35')](_0x32ec93[_0xf0ab('0x32')][_0xf0ab('0x35')]));_0x5e6b6b[_0xf0ab('0x33')]=_0x5e6b6b[_0xf0ab('0x33')][_0xf0ab('0x36')]?_0x5e6b6b[_0xf0ab('0x33')]:_0x4c4ab9['model'];if(_0x32ec93['query'][_0xf0ab('0x43')]){_0x5e6b6b['include']=[{'all':!![]}];}_0x5e6b6b=_['merge']({},_0x5e6b6b,_0x32ec93['options']);return db[_0xf0ab('0x42')][_0xf0ab('0x4a')](_0x5e6b6b)[_0xf0ab('0x25')](handleEntityNotFound(_0x22a265,null))[_0xf0ab('0x25')](respondWithResult(_0x22a265,null))[_0xf0ab('0x47')](handleError(_0x22a265,null));};exports[_0xf0ab('0x4b')]=function(_0x472c1b,_0x1a0f21){return db[_0xf0ab('0x42')][_0xf0ab('0x4b')](_0x472c1b[_0xf0ab('0x4c')],{})[_0xf0ab('0x25')](function(_0x4e6c9b){var _0x393c9a=_0x472c1b[_0xf0ab('0x4d')][_0xf0ab('0x26')]({'plain':!![]});if(!_0x393c9a)throw new Error(_0xf0ab('0x4e'));if(_0x393c9a[_0xf0ab('0x4f')]===_0xf0ab('0x4d')){var _0x430921=_0x4e6c9b[_0xf0ab('0x26')]({'plain':!![]});var _0x47f564='ContactItemTypes';return db['UserProfileSection'][_0xf0ab('0x4a')]({'where':{'name':_0x47f564,'userProfileId':_0x393c9a[_0xf0ab('0x50')]},'raw':!![]})['then'](function(_0xa1a416){if(_0xa1a416&&_0xa1a416[_0xf0ab('0x51')]===0x0){return db['UserProfileResource'][_0xf0ab('0x4b')]({'name':_0x430921[_0xf0ab('0x2b')],'resourceId':_0x430921['id'],'type':_0xa1a416[_0xf0ab('0x2b')],'sectionId':_0xa1a416['id']},{})[_0xf0ab('0x25')](function(){return _0x4e6c9b;});}else{return _0x4e6c9b;}})[_0xf0ab('0x47')](function(_0x33112b){logger[_0xf0ab('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33112b);throw _0x33112b;});}return _0x4e6c9b;})[_0xf0ab('0x25')](respondWithResult(_0x1a0f21,0xc9))['catch'](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x24')]=function(_0x4c9d2b,_0x1a402b){if(_0x4c9d2b['body']['id']){delete _0x4c9d2b['body']['id'];}return db[_0xf0ab('0x42')]['find']({'where':{'id':_0x4c9d2b[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a402b,null))[_0xf0ab('0x25')](saveUpdates(_0x4c9d2b['body'],null))[_0xf0ab('0x25')](respondWithResult(_0x1a402b,null))[_0xf0ab('0x47')](handleError(_0x1a402b,null));};exports[_0xf0ab('0x52')]=function(_0x57f9dd,_0x47f270){return db['ContactItemType'][_0xf0ab('0x4a')]({'where':{'id':_0x57f9dd[_0xf0ab('0x49')]['id']}})['then'](handleEntityNotFound(_0x47f270,null))['then'](db[_0xf0ab('0x53')][_0xf0ab('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x57f9dd[_0xf0ab('0x49')]['id']}}))[_0xf0ab('0x25')](removeEntity(_0x47f270,null))[_0xf0ab('0x47')](handleError(_0x47f270,null));}; \ No newline at end of file +var _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x22997d,_0x5339ab){var _0x5ed370=function(_0x340924){while(--_0x340924){_0x22997d['push'](_0x22997d['shift']());}};_0x5ed370(++_0x5339ab);}(_0x6a95,0x1db));var _0x56a9=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x6a95[_0xdc37a1];return _0x99b4fe;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=typeof _0x2a0714['offset']===_0x56a9('0x1c')&&typeof _0x2a0714['limit']==='undefined';var _0x4e292f=_0x42007b[_0x56a9('0x1d')];var _0x576bdf=_0x46f854?0x0:_0x2a0714[_0x56a9('0x1e')];var _0x105fe5=_0x46f854?_0x42007b[_0x56a9('0x1d')]:_0x2a0714[_0x56a9('0x1e')]+_0x2a0714[_0x56a9('0x1f')];var _0xbfeb1a;if(_0x105fe5>=_0x4e292f){_0x105fe5=_0x4e292f;_0xbfeb1a=0xc8;}else{_0xbfeb1a=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0xbfeb1a);return _0x2e0dfd[_0x56a9('0x20')](_0x56a9('0x21'),_0x576bdf+'-'+_0x105fe5+'/'+_0x4e292f)[_0x56a9('0x22')](_0x42007b);}return null;};}function patchUpdates(_0x5f145f){return function(_0x5bc03a){try{jsonpatch[_0x56a9('0x23')](_0x5bc03a,_0x5f145f,!![]);}catch(_0x16f9de){return BPromise[_0x56a9('0x24')](_0x16f9de);}return _0x5bc03a[_0x56a9('0x25')]();};}function saveUpdates(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')](_0x4a09e5)[_0x56a9('0x27')](function(_0x5a82e0){return _0x5a82e0;});}return null;};}function removeEntity(_0x44762e,_0x32839b){return function(_0x21ab38){if(_0x21ab38){return _0x21ab38[_0x56a9('0x28')]()[_0x56a9('0x27')](function(){var _0x52016c=_0x21ab38[_0x56a9('0x29')]({'plain':!![]});var _0x217bda=_0x56a9('0x2a');return db['UserProfileResource'][_0x56a9('0x28')]({'where':{'type':_0x217bda,'resourceId':_0x52016c['id']}})['then'](function(){return _0x21ab38;});})[_0x56a9('0x27')](function(){_0x44762e[_0x56a9('0x1a')](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x20432a,_0x45f38c){return function(_0x1afe8a){if(!_0x1afe8a){_0x20432a[_0x56a9('0x19')](0x194);}return _0x1afe8a;};}function handleError(_0xff5f55,_0x51fd64){_0x51fd64=_0x51fd64||0x1f4;return function(_0x437ccf){logger[_0x56a9('0x2b')](_0x437ccf['stack']);if(_0x437ccf[_0x56a9('0x2c')]){delete _0x437ccf['name'];}_0xff5f55['status'](_0x51fd64)[_0x56a9('0x2d')](_0x437ccf);};}exports['index']=function(_0x2f933a,_0x11002a){var _0x2fbd5d={},_0x2c1c3d={},_0x5879db={'count':0x0,'rows':[]};var _0x332707=_[_0x56a9('0x2e')](db[_0x56a9('0x2f')][_0x56a9('0x30')],function(_0xbbb47d){return{'name':_0xbbb47d[_0x56a9('0x31')],'type':_0xbbb47d[_0x56a9('0x32')][_0x56a9('0x33')]};});_0x2c1c3d[_0x56a9('0x34')]=_[_0x56a9('0x2e')](_0x332707,_0x56a9('0x2c'));_0x2c1c3d[_0x56a9('0x35')]=_['keys'](_0x2f933a[_0x56a9('0x35')]);_0x2c1c3d[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x2c1c3d['model'],_0x2c1c3d[_0x56a9('0x35')]);_0x2fbd5d['attributes']=_['intersection'](_0x2c1c3d['model'],qs[_0x56a9('0x38')](_0x2f933a[_0x56a9('0x35')]['fields']));_0x2fbd5d['attributes']=_0x2fbd5d[_0x56a9('0x39')][_0x56a9('0x3a')]?_0x2fbd5d[_0x56a9('0x39')]:_0x2c1c3d[_0x56a9('0x34')];if(!_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3b')](_0x56a9('0x3c'))){_0x2fbd5d[_0x56a9('0x1f')]=qs[_0x56a9('0x1f')](_0x2f933a[_0x56a9('0x35')]['limit']);_0x2fbd5d['offset']=qs['offset'](_0x2f933a['query'][_0x56a9('0x1e')]);}_0x2fbd5d[_0x56a9('0x3d')]=qs['sort'](_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3e')]);_0x2fbd5d[_0x56a9('0x3f')]=qs[_0x56a9('0x36')](_[_0x56a9('0x40')](_0x2f933a[_0x56a9('0x35')],_0x2c1c3d[_0x56a9('0x36')]),_0x332707);if(_0x2f933a['query'][_0x56a9('0x41')]){_0x2fbd5d[_0x56a9('0x3f')]=_['merge'](_0x2fbd5d['where'],{'$or':_[_0x56a9('0x2e')](_0x332707,function(_0x1180c6){if(_0x1180c6[_0x56a9('0x32')]!==_0x56a9('0x42')){var _0x158504={};_0x158504[_0x1180c6[_0x56a9('0x2c')]]={'$like':'%'+_0x2f933a[_0x56a9('0x35')][_0x56a9('0x41')]+'%'};return _0x158504;}})});}_0x2fbd5d=_[_0x56a9('0x43')]({},_0x2fbd5d,_0x2f933a[_0x56a9('0x44')]);var _0x9f24ea={'where':_0x2fbd5d[_0x56a9('0x3f')]};return db[_0x56a9('0x2f')][_0x56a9('0x1d')](_0x9f24ea)[_0x56a9('0x27')](function(_0xe57cfb){_0x5879db[_0x56a9('0x1d')]=_0xe57cfb;if(_0x2f933a[_0x56a9('0x35')]['includeAll']){_0x2fbd5d[_0x56a9('0x45')]=[{'all':!![]}];}return db[_0x56a9('0x2f')][_0x56a9('0x46')](_0x2fbd5d);})['then'](function(_0x1f8b30){_0x5879db['rows']=_0x1f8b30;return _0x5879db;})[_0x56a9('0x27')](respondWithFilteredResult(_0x11002a,_0x2fbd5d))['catch'](handleError(_0x11002a,null));};exports[_0x56a9('0x47')]=function(_0x39c445,_0x3998f1){var _0x49286b={'raw':!![],'where':{'id':_0x39c445['params']['id']}},_0x5192d8={};_0x5192d8['model']=_[_0x56a9('0x48')](db[_0x56a9('0x2f')][_0x56a9('0x30')]);_0x5192d8[_0x56a9('0x35')]=_[_0x56a9('0x48')](_0x39c445[_0x56a9('0x35')]);_0x5192d8[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],_0x5192d8[_0x56a9('0x35')]);_0x49286b[_0x56a9('0x39')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],qs[_0x56a9('0x38')](_0x39c445['query'][_0x56a9('0x38')]));_0x49286b[_0x56a9('0x39')]=_0x49286b[_0x56a9('0x39')]['length']?_0x49286b[_0x56a9('0x39')]:_0x5192d8[_0x56a9('0x34')];if(_0x39c445['query'][_0x56a9('0x49')]){_0x49286b[_0x56a9('0x45')]=[{'all':!![]}];}_0x49286b=_[_0x56a9('0x43')]({},_0x49286b,_0x39c445[_0x56a9('0x44')]);return db['ContactItemType'][_0x56a9('0x4a')](_0x49286b)[_0x56a9('0x27')](handleEntityNotFound(_0x3998f1,null))[_0x56a9('0x27')](respondWithResult(_0x3998f1,null))[_0x56a9('0x4b')](handleError(_0x3998f1,null));};exports[_0x56a9('0x4c')]=function(_0x3942d8,_0x31aaf5){return db[_0x56a9('0x2f')][_0x56a9('0x4c')](_0x3942d8[_0x56a9('0x4d')],{})[_0x56a9('0x27')](function(_0x500656){var _0x58d370=_0x3942d8[_0x56a9('0x4e')][_0x56a9('0x29')]({'plain':!![]});if(!_0x58d370)throw new Error(_0x56a9('0x4f'));if(_0x58d370[_0x56a9('0x50')]==='user'){var _0x1986f2=_0x500656[_0x56a9('0x29')]({'plain':!![]});var _0x26ad3e=_0x56a9('0x2a');return db['UserProfileSection'][_0x56a9('0x4a')]({'where':{'name':_0x26ad3e,'userProfileId':_0x58d370[_0x56a9('0x51')]},'raw':!![]})['then'](function(_0x1ff42f){if(_0x1ff42f&&_0x1ff42f[_0x56a9('0x52')]===0x0){return db['UserProfileResource'][_0x56a9('0x4c')]({'name':_0x1986f2[_0x56a9('0x2c')],'resourceId':_0x1986f2['id'],'type':_0x1ff42f[_0x56a9('0x2c')],'sectionId':_0x1ff42f['id']},{})[_0x56a9('0x27')](function(){return _0x500656;});}else{return _0x500656;}})['catch'](function(_0x4938d6){logger[_0x56a9('0x2b')](_0x56a9('0x53'),_0x4938d6);throw _0x4938d6;});}return _0x500656;})[_0x56a9('0x27')](respondWithResult(_0x31aaf5,0xc9))[_0x56a9('0x4b')](handleError(_0x31aaf5,null));};exports[_0x56a9('0x26')]=function(_0xce9dc0,_0x798b4e){if(_0xce9dc0[_0x56a9('0x4d')]['id']){delete _0xce9dc0[_0x56a9('0x4d')]['id'];}return db[_0x56a9('0x2f')]['find']({'where':{'id':_0xce9dc0[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x798b4e,null))[_0x56a9('0x27')](saveUpdates(_0xce9dc0[_0x56a9('0x4d')],null))[_0x56a9('0x27')](respondWithResult(_0x798b4e,null))[_0x56a9('0x4b')](handleError(_0x798b4e,null));};exports[_0x56a9('0x28')]=function(_0x488577,_0x870aa5){return db[_0x56a9('0x2f')][_0x56a9('0x4a')]({'where':{'id':_0x488577[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x870aa5,null))[_0x56a9('0x27')](db[_0x56a9('0x55')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x488577[_0x56a9('0x54')]['id']}}))['then'](removeEntity(_0x870aa5,null))['catch'](handleError(_0x870aa5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9ca4bf3..bad73bf 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb68=['../../config/logger','api','moment','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x391c43,_0x4392d1){var _0x262829=function(_0x453e9f){while(--_0x453e9f){_0x391c43['push'](_0x391c43['shift']());}};_0x262829(++_0x4392d1);}(_0xfb68,0x1d2));var _0x8fb6=function(_0x20a767,_0x404ca1){_0x20a767=_0x20a767-0x0;var _0x31df1b=_0xfb68[_0x20a767];return _0x31df1b;};'use strict';var _=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var logger=require(_0x8fb6('0x2'))(_0x8fb6('0x3'));var moment=require(_0x8fb6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fb6('0x5'));var rimraf=require(_0x8fb6('0x6'));var config=require(_0x8fb6('0x7'));var attributes=require(_0x8fb6('0x8'));module[_0x8fb6('0x9')]=function(_0x50a6af,_0x93a0c9){return _0x50a6af[_0x8fb6('0xa')](_0x8fb6('0xb'),attributes,{'tableName':_0x8fb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31ae=['path','rimraf','../../config/environment','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4ddda2,_0x52ffc8){var _0x2ff716=function(_0x30476c){while(--_0x30476c){_0x4ddda2['push'](_0x4ddda2['shift']());}};_0x2ff716(++_0x52ffc8);}(_0x31ae,0x162));var _0xe31a=function(_0x28db4a,_0x6d6d5a){_0x28db4a=_0x28db4a-0x0;var _0x3bf87e=_0x31ae[_0x28db4a];return _0x3bf87e;};'use strict';var _=require(_0xe31a('0x0'));var util=require(_0xe31a('0x1'));var logger=require(_0xe31a('0x2'))('api');var moment=require(_0xe31a('0x3'));var BPromise=require(_0xe31a('0x4'));var rp=require(_0xe31a('0x5'));var fs=require('fs');var path=require(_0xe31a('0x6'));var rimraf=require(_0xe31a('0x7'));var config=require(_0xe31a('0x8'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x2fc6df,_0x1e4da3){return _0x2fc6df[_0xe31a('0x9')](_0xe31a('0xa'),attributes,{'tableName':_0xe31a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index d4d0b49..4fc041c 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a53=['jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x137ec3,_0x229db8){var _0x5afd12=function(_0x35af94){while(--_0x35af94){_0x137ec3['push'](_0x137ec3['shift']());}};_0x5afd12(++_0x229db8);}(_0x6a53,0x1ef));var _0x36a5=function(_0x880aed,_0x16597b){_0x880aed=_0x880aed-0x0;var _0x40df37=_0x6a53[_0x880aed];return _0x40df37;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x36a5('0x0'));var BPromise=require(_0x36a5('0x1'));var rs=require(_0x36a5('0x2'));var fs=require('fs');var Redis=require(_0x36a5('0x3'));var db=require(_0x36a5('0x4'))['db'];var utils=require(_0x36a5('0x5'));var logger=require(_0x36a5('0x6'))(_0x36a5('0x7'));var config=require(_0x36a5('0x8'));var jayson=require(_0x36a5('0x9'));var client=jayson['client'][_0x36a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e06a4,_0x1ad3a8,_0x6c4299){return new BPromise(function(_0x31e56f,_0x3d894d){return client[_0x36a5('0xb')](_0x4e06a4,_0x6c4299)[_0x36a5('0xc')](function(_0x4adc7d){logger['info'](_0x36a5('0xd'),_0x1ad3a8,_0x36a5('0xe'));logger[_0x36a5('0xf')](_0x36a5('0x10'),_0x1ad3a8,_0x36a5('0xe'),JSON[_0x36a5('0x11')](_0x4adc7d));if(_0x4adc7d[_0x36a5('0x12')]){if(_0x4adc7d[_0x36a5('0x12')][_0x36a5('0x13')]===0x1f4){logger['error'](_0x36a5('0xd'),_0x1ad3a8,_0x4adc7d['error'][_0x36a5('0x14')]);return _0x3d894d(_0x4adc7d[_0x36a5('0x12')][_0x36a5('0x14')]);}logger[_0x36a5('0x12')](_0x36a5('0xd'),_0x1ad3a8,_0x4adc7d[_0x36a5('0x12')][_0x36a5('0x14')]);return _0x31e56f(_0x4adc7d[_0x36a5('0x12')]['message']);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x1ad3a8,_0x36a5('0xe'));_0x31e56f(_0x4adc7d['result'][_0x36a5('0x14')]);}})['catch'](function(_0x381800){logger[_0x36a5('0x12')](_0x36a5('0xd'),_0x1ad3a8,_0x381800);_0x3d894d(_0x381800);});});} \ No newline at end of file +var _0x32f0=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s'];(function(_0x3dd6c5,_0x4c97b1){var _0x3f9710=function(_0x2da707){while(--_0x2da707){_0x3dd6c5['push'](_0x3dd6c5['shift']());}};_0x3f9710(++_0x4c97b1);}(_0x32f0,0x1ab));var _0x032f=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x32f0[_0x5756f8];return _0x3bb749;};'use strict';var _=require(_0x032f('0x0'));var util=require(_0x032f('0x1'));var moment=require(_0x032f('0x2'));var BPromise=require('bluebird');var rs=require(_0x032f('0x3'));var fs=require('fs');var Redis=require(_0x032f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x032f('0x5'));var logger=require(_0x032f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x032f('0x7'));var client=jayson[_0x032f('0x8')][_0x032f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x342b33,_0x31d2d0,_0x58cf18){return new BPromise(function(_0x2603e8,_0x407cb9){return client[_0x032f('0xa')](_0x342b33,_0x58cf18)['then'](function(_0x542978){logger[_0x032f('0xb')](_0x032f('0xc'),_0x31d2d0,_0x032f('0xd'));logger[_0x032f('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x31d2d0,'request\x20sent',JSON[_0x032f('0xf')](_0x542978));if(_0x542978[_0x032f('0x10')]){if(_0x542978[_0x032f('0x10')]['code']===0x1f4){logger[_0x032f('0x10')](_0x032f('0xc'),_0x31d2d0,_0x542978[_0x032f('0x10')][_0x032f('0x11')]);return _0x407cb9(_0x542978[_0x032f('0x10')][_0x032f('0x11')]);}logger[_0x032f('0x10')](_0x032f('0xc'),_0x31d2d0,_0x542978[_0x032f('0x10')][_0x032f('0x11')]);return _0x2603e8(_0x542978['error'][_0x032f('0x11')]);}else{logger['info'](_0x032f('0xc'),_0x31d2d0,_0x032f('0xd'));_0x2603e8(_0x542978[_0x032f('0x12')][_0x032f('0x11')]);}})[_0x032f('0x13')](function(_0x245471){logger[_0x032f('0x10')]('ContactItemType,\x20%s,\x20%s',_0x31d2d0,_0x245471);_0x407cb9(_0x245471);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 446ee72..947129a 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e24=['Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy','exports','util','path'];(function(_0xf88ae9,_0xafadc0){var _0x8309dd=function(_0x330b50){while(--_0x330b50){_0xf88ae9['push'](_0xf88ae9['shift']());}};_0x8309dd(++_0xafadc0);}(_0x7e24,0xb9));var _0x47e2=function(_0x573654,_0x4b3f64){_0x573654=_0x573654-0x0;var _0x274d3b=_0x7e24[_0x573654];return _0x274d3b;};'use strict';var multer=require('multer');var util=require(_0x47e2('0x0'));var path=require(_0x47e2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x47e2('0x2')]();var fs_extra=require(_0x47e2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x47e2('0x4'));var config=require(_0x47e2('0x5'));var controller=require(_0x47e2('0x6'));router['get']('/',auth[_0x47e2('0x7')](),controller[_0x47e2('0x8')]);router[_0x47e2('0x9')](_0x47e2('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47e2('0x7')](),controller[_0x47e2('0xb')]);router[_0x47e2('0xc')](_0x47e2('0xa'),auth[_0x47e2('0x7')](),controller[_0x47e2('0xd')]);router[_0x47e2('0xe')](_0x47e2('0xa'),auth[_0x47e2('0x7')](),controller[_0x47e2('0xf')]);module[_0x47e2('0x10')]=router; \ No newline at end of file +var _0xa736=['put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x21dc70,_0x287214){var _0x47e638=function(_0x41445d){while(--_0x41445d){_0x21dc70['push'](_0x21dc70['shift']());}};_0x47e638(++_0x287214);}(_0xa736,0x1bf));var _0x6a73=function(_0x279a41,_0x1b0bef){_0x279a41=_0x279a41-0x0;var _0x55cffe=_0xa736[_0x279a41];return _0x55cffe;};'use strict';var multer=require(_0x6a73('0x0'));var util=require('util');var path=require(_0x6a73('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a73('0x2'));var router=express[_0x6a73('0x3')]();var fs_extra=require(_0x6a73('0x4'));var auth=require(_0x6a73('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6a73('0x6'));var controller=require('./contactItemType.controller');router[_0x6a73('0x7')]('/',auth[_0x6a73('0x8')](),controller['index']);router['get'](_0x6a73('0x9'),auth[_0x6a73('0x8')](),controller[_0x6a73('0xa')]);router[_0x6a73('0xb')]('/',auth[_0x6a73('0x8')](),controller['create']);router[_0x6a73('0xc')](_0x6a73('0x9'),auth['isAuthenticated'](),controller[_0x6a73('0xd')]);router[_0x6a73('0xe')](_0x6a73('0x9'),auth['isAuthenticated'](),controller[_0x6a73('0xf')]);module[_0x6a73('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 82e84a3..8edde67 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x461759,_0x285c8f){var _0x3d0bd7=function(_0x34a2da){while(--_0x34a2da){_0x461759['push'](_0x461759['shift']());}};_0x3d0bd7(++_0x285c8f);}(_0x2032,0xd9));var _0x2203=function(_0x405d01,_0x5cf4bd){_0x405d01=_0x405d01-0x0;var _0x25ad62=_0x2032[_0x405d01];return _0x25ad62;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xa3918c,_0x59c668){var _0x322ee2=function(_0x2e7014){while(--_0x2e7014){_0xa3918c['push'](_0xa3918c['shift']());}};_0x322ee2(++_0x59c668);}(_0x2032,0xd9));var _0x2203=function(_0x56b960,_0x4b2145){_0x56b960=_0x56b960-0x0;var _0x57599f=_0x2032[_0x56b960];return _0x57599f;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index c08e6d0..e4e1afa 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ad3=['defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','options','includeAll','include','rows','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','params','fields','merge','createdAt','updatedAt','omit','userProfileId','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','getItems','hasOwnProperty','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis'];(function(_0x370f36,_0x44ff82){var _0x4e1907=function(_0x57359e){while(--_0x57359e){_0x370f36['push'](_0x370f36['shift']());}};_0x4e1907(++_0x44ff82);}(_0x9ad3,0x1ee));var _0x39ad=function(_0x3d253c,_0x14128d){_0x3d253c=_0x3d253c-0x0;var _0x55982d=_0x9ad3[_0x3d253c];return _0x55982d;};'use strict';var emlformat=require(_0x39ad('0x0'));var rimraf=require(_0x39ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39ad('0x2'));var rp=require('request-promise');var moment=require(_0x39ad('0x3'));var BPromise=require(_0x39ad('0x4'));var Mustache=require(_0x39ad('0x5'));var util=require(_0x39ad('0x6'));var path=require(_0x39ad('0x7'));var sox=require(_0x39ad('0x8'));var csv=require(_0x39ad('0x9'));var ejs=require(_0x39ad('0xa'));var fs=require('fs');var fs_extra=require(_0x39ad('0xb'));var _=require(_0x39ad('0xc'));var squel=require(_0x39ad('0xd'));var crypto=require(_0x39ad('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x39ad('0xf'));var toCsv=require(_0x39ad('0x9'));var querystring=require('querystring');var Papa=require(_0x39ad('0x10'));var Redis=require(_0x39ad('0x11'));var authService=require(_0x39ad('0x12'));var qs=require(_0x39ad('0x13'));var as=require(_0x39ad('0x14'));var hardwareService=require(_0x39ad('0x15'));var logger=require('../../config/logger')(_0x39ad('0x16'));var utils=require(_0x39ad('0x17'));var config=require(_0x39ad('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x39ad('0x19')]=_[_0x39ad('0x1a')](config[_0x39ad('0x19')],{'host':_0x39ad('0x1b'),'port':0x18eb});var socket=require(_0x39ad('0x1c'))(new Redis(config[_0x39ad('0x19')]));require(_0x39ad('0x1d'))[_0x39ad('0x1e')](socket);function respondWithStatusCode(_0x5514a2,_0x55e2bf){_0x55e2bf=_0x55e2bf||0xcc;return function(_0xb21442){if(_0xb21442){return _0x5514a2[_0x39ad('0x1f')](_0x55e2bf);}return _0x5514a2[_0x39ad('0x20')](_0x55e2bf)[_0x39ad('0x21')]();};}function respondWithResult(_0x3ba0a6,_0x5ec317){_0x5ec317=_0x5ec317||0xc8;return function(_0x218a18){if(_0x218a18){return _0x3ba0a6[_0x39ad('0x20')](_0x5ec317)[_0x39ad('0x22')](_0x218a18);}};}function respondWithFilteredResult(_0xfc5810,_0x8b64c6){return function(_0x3086bc){if(_0x3086bc){var _0x29878a=typeof _0x8b64c6[_0x39ad('0x23')]===_0x39ad('0x24')&&typeof _0x8b64c6[_0x39ad('0x25')]===_0x39ad('0x24');var _0x3a4cad=_0x3086bc['count'];var _0x2ab0ed=_0x29878a?0x0:_0x8b64c6[_0x39ad('0x23')];var _0x2744ce=_0x29878a?_0x3086bc[_0x39ad('0x26')]:_0x8b64c6[_0x39ad('0x23')]+_0x8b64c6[_0x39ad('0x25')];var _0x2fa2c7;if(_0x2744ce>=_0x3a4cad){_0x2744ce=_0x3a4cad;_0x2fa2c7=0xc8;}else{_0x2fa2c7=0xce;}_0xfc5810['status'](_0x2fa2c7);return _0xfc5810['set'](_0x39ad('0x27'),_0x2ab0ed+'-'+_0x2744ce+'/'+_0x3a4cad)['json'](_0x3086bc);}return null;};}function patchUpdates(_0x3deec3){return function(_0x123091){try{jsonpatch['apply'](_0x123091,_0x3deec3,!![]);}catch(_0x12118e){return BPromise[_0x39ad('0x28')](_0x12118e);}return _0x123091[_0x39ad('0x29')]();};}function saveUpdates(_0x1f982b,_0x1f3803){return function(_0x1d8b78){if(_0x1d8b78){return _0x1d8b78[_0x39ad('0x2a')](_0x1f982b)[_0x39ad('0x2b')](function(_0x7accd3){return _0x7accd3;});}return null;};}function removeEntity(_0x50f629,_0xa5d93){return function(_0xb2a94){if(_0xb2a94){return _0xb2a94[_0x39ad('0x2c')]()[_0x39ad('0x2b')](function(){var _0x2aa4ce=_0xb2a94['get']({'plain':!![]});var _0x21aafa=_0x39ad('0x2d');return db[_0x39ad('0x2e')][_0x39ad('0x2c')]({'where':{'type':_0x21aafa,'resourceId':_0x2aa4ce['id']}})[_0x39ad('0x2b')](function(){return _0xb2a94;});})[_0x39ad('0x2b')](function(){_0x50f629[_0x39ad('0x20')](0xcc)[_0x39ad('0x21')]();});}};}function handleEntityNotFound(_0x2dc0f7,_0xb5fcf4){return function(_0x19918a){if(!_0x19918a){_0x2dc0f7[_0x39ad('0x1f')](0x194);}return _0x19918a;};}function handleError(_0x3acbf3,_0x16bd0d){_0x16bd0d=_0x16bd0d||0x1f4;return function(_0x3cce94){logger[_0x39ad('0x2f')](_0x3cce94['stack']);if(_0x3cce94[_0x39ad('0x30')]){delete _0x3cce94['name'];}_0x3acbf3[_0x39ad('0x20')](_0x16bd0d)[_0x39ad('0x31')](_0x3cce94);};}exports[_0x39ad('0x32')]=function(_0x2b99e5,_0x517fee){var _0x2c0241={},_0x6cc5e7={},_0x4e90c2={'count':0x0,'rows':[]};var _0x103c3e=_[_0x39ad('0x33')](db[_0x39ad('0x34')][_0x39ad('0x35')],function(_0x39e9e6){return{'name':_0x39e9e6[_0x39ad('0x36')],'type':_0x39e9e6[_0x39ad('0x37')][_0x39ad('0x38')]};});_0x6cc5e7[_0x39ad('0x39')]=_[_0x39ad('0x33')](_0x103c3e,'name');_0x6cc5e7['query']=_[_0x39ad('0x3a')](_0x2b99e5[_0x39ad('0x3b')]);_0x6cc5e7[_0x39ad('0x3c')]=_[_0x39ad('0x3d')](_0x6cc5e7[_0x39ad('0x39')],_0x6cc5e7[_0x39ad('0x3b')]);_0x2c0241['attributes']=_[_0x39ad('0x3d')](_0x6cc5e7['model'],qs['fields'](_0x2b99e5['query']['fields']));_0x2c0241[_0x39ad('0x3e')]=_0x2c0241[_0x39ad('0x3e')][_0x39ad('0x3f')]?_0x2c0241[_0x39ad('0x3e')]:_0x6cc5e7[_0x39ad('0x39')];if(!_0x2b99e5[_0x39ad('0x3b')]['hasOwnProperty'](_0x39ad('0x40'))){_0x2c0241[_0x39ad('0x25')]=qs[_0x39ad('0x25')](_0x2b99e5[_0x39ad('0x3b')][_0x39ad('0x25')]);_0x2c0241['offset']=qs['offset'](_0x2b99e5[_0x39ad('0x3b')][_0x39ad('0x23')]);}_0x2c0241[_0x39ad('0x41')]=qs['sort'](_0x2b99e5['query'][_0x39ad('0x42')]);_0x2c0241[_0x39ad('0x43')]=qs[_0x39ad('0x3c')](_['pick'](_0x2b99e5['query'],_0x6cc5e7[_0x39ad('0x3c')]),_0x103c3e);if(_0x2b99e5[_0x39ad('0x3b')][_0x39ad('0x44')]){_0x2c0241[_0x39ad('0x43')]=_['merge'](_0x2c0241[_0x39ad('0x43')],{'$or':_['map'](_0x103c3e,function(_0x1a2f62){if(_0x1a2f62['type']!=='VIRTUAL'){var _0xfa4755={};_0xfa4755[_0x1a2f62[_0x39ad('0x30')]]={'$like':'%'+_0x2b99e5[_0x39ad('0x3b')][_0x39ad('0x44')]+'%'};return _0xfa4755;}})});}_0x2c0241=_['merge']({},_0x2c0241,_0x2b99e5[_0x39ad('0x45')]);var _0x424ad4={'where':_0x2c0241[_0x39ad('0x43')]};return db[_0x39ad('0x34')][_0x39ad('0x26')](_0x424ad4)['then'](function(_0x224547){_0x4e90c2[_0x39ad('0x26')]=_0x224547;if(_0x2b99e5[_0x39ad('0x3b')][_0x39ad('0x46')]){_0x2c0241[_0x39ad('0x47')]=[{'all':!![]}];}return db[_0x39ad('0x34')]['findAll'](_0x2c0241);})[_0x39ad('0x2b')](function(_0x55da22){_0x4e90c2[_0x39ad('0x48')]=_0x55da22;return _0x4e90c2;})[_0x39ad('0x2b')](respondWithFilteredResult(_0x517fee,_0x2c0241))['catch'](handleError(_0x517fee,null));};exports[_0x39ad('0x49')]=function(_0x6ee328,_0x4612de){var _0x2fda08={'raw':![],'where':{'id':_0x6ee328['params']['id']}},_0x5a1052={};_0x5a1052['model']=_['keys'](db[_0x39ad('0x34')]['rawAttributes']);_0x5a1052[_0x39ad('0x3b')]=_['keys'](_0x6ee328['query']);_0x5a1052['filters']=_[_0x39ad('0x3d')](_0x5a1052[_0x39ad('0x39')],_0x5a1052['query']);_0x2fda08[_0x39ad('0x3e')]=_[_0x39ad('0x3d')](_0x5a1052[_0x39ad('0x39')],qs['fields'](_0x6ee328['query']['fields']));_0x2fda08['attributes']=_0x2fda08['attributes'][_0x39ad('0x3f')]?_0x2fda08[_0x39ad('0x3e')]:_0x5a1052['model'];if(_0x6ee328[_0x39ad('0x3b')][_0x39ad('0x46')]){_0x2fda08[_0x39ad('0x47')]=[{'all':!![]}];}_0x2fda08=_['merge']({},_0x2fda08,_0x6ee328[_0x39ad('0x45')]);return db[_0x39ad('0x34')][_0x39ad('0x4a')](_0x2fda08)[_0x39ad('0x2b')](handleEntityNotFound(_0x4612de,null))[_0x39ad('0x2b')](respondWithResult(_0x4612de,null))['catch'](handleError(_0x4612de,null));};exports[_0x39ad('0x4b')]=function(_0xfacf27,_0x5dfccb){return db[_0x39ad('0x34')][_0x39ad('0x4b')](_0xfacf27[_0x39ad('0x4c')],{})[_0x39ad('0x2b')](function(_0x5f0621){var _0x3677e8=_0xfacf27[_0x39ad('0x4d')][_0x39ad('0x4e')]({'plain':!![]});if(!_0x3677e8)throw new Error(_0x39ad('0x4f'));if(_0x3677e8[_0x39ad('0x50')]===_0x39ad('0x4d')){var _0x3d81d0=_0x5f0621[_0x39ad('0x4e')]({'plain':!![]});var _0x3b04ab='CustomDashboards';return db[_0x39ad('0x51')][_0x39ad('0x4a')]({'where':{'name':_0x3b04ab,'userProfileId':_0x3677e8['userProfileId']},'raw':!![]})[_0x39ad('0x2b')](function(_0x4f03f3){if(_0x4f03f3&&_0x4f03f3[_0x39ad('0x52')]===0x0){return db[_0x39ad('0x2e')]['create']({'name':_0x3d81d0[_0x39ad('0x30')],'resourceId':_0x3d81d0['id'],'type':_0x4f03f3[_0x39ad('0x30')],'sectionId':_0x4f03f3['id']},{})[_0x39ad('0x2b')](function(){return _0x5f0621;});}else{return _0x5f0621;}})['catch'](function(_0x11ae8d){logger[_0x39ad('0x2f')](_0x39ad('0x53'),_0x11ae8d);throw _0x11ae8d;});}return _0x5f0621;})[_0x39ad('0x2b')](respondWithResult(_0x5dfccb,0xc9))[_0x39ad('0x54')](handleError(_0x5dfccb,null));};exports[_0x39ad('0x55')]=function(_0x3d3016,_0x58f31d){var _0x3e569d={'where':{'id':_0x3d3016[_0x39ad('0x56')]['id']}},_0x1df699={};_0x1df699['model']=_[_0x39ad('0x3a')](db[_0x39ad('0x34')][_0x39ad('0x35')]);_0x3e569d[_0x39ad('0x3e')]=_[_0x39ad('0x3d')](_0x1df699[_0x39ad('0x39')],qs[_0x39ad('0x57')](_0x3d3016[_0x39ad('0x3b')][_0x39ad('0x57')]));_0x3e569d[_0x39ad('0x3e')]=_0x3e569d['attributes'][_0x39ad('0x3f')]?_0x3e569d[_0x39ad('0x3e')]:_0x1df699[_0x39ad('0x39')];if(_0x3d3016['query'][_0x39ad('0x46')]){_0x3e569d[_0x39ad('0x47')]=[{'all':!![]}];}_0x3e569d=_[_0x39ad('0x58')]({},_0x3e569d,_0x3d3016[_0x39ad('0x45')]);return db[_0x39ad('0x34')]['find'](_0x3e569d)['then'](handleEntityNotFound(_0x58f31d,null))[_0x39ad('0x2b')](function(_0x10ae88){if(_0x10ae88){var _0x187453=_0x10ae88[_0x39ad('0x4e')]({'plain':!![]});_0x187453=qs['omit'](_0x187453,['id',_0x39ad('0x59'),_0x39ad('0x5a')]);_0x3d3016[_0x39ad('0x4c')]=_[_0x39ad('0x5b')](_0x3d3016['body'],['id',_0x39ad('0x59'),_0x39ad('0x5a')]);return db[_0x39ad('0x34')]['create'](_[_0x39ad('0x58')](_0x187453,_0x3d3016['body']),{'include':_0x3d3016[_0x39ad('0x3b')][_0x39ad('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x1927ad){var _0x5c7c85=_0x3d3016[_0x39ad('0x4d')][_0x39ad('0x4e')]({'plain':!![]});if(!_0x5c7c85)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c7c85[_0x39ad('0x50')]===_0x39ad('0x4d')){var _0x478b06=_0x1927ad[_0x39ad('0x4e')]({'plain':!![]});var _0x142fb5='CustomDashboards';return db[_0x39ad('0x51')][_0x39ad('0x4a')]({'where':{'name':_0x142fb5,'userProfileId':_0x5c7c85[_0x39ad('0x5c')]},'raw':!![]})[_0x39ad('0x2b')](function(_0x3dab93){if(_0x3dab93&&_0x3dab93[_0x39ad('0x52')]===0x0){return db[_0x39ad('0x2e')][_0x39ad('0x4b')]({'name':_0x478b06[_0x39ad('0x30')],'resourceId':_0x478b06['id'],'type':_0x3dab93[_0x39ad('0x30')],'sectionId':_0x3dab93['id']},{})['then'](function(){return _0x1927ad;});}else{return _0x1927ad;}})[_0x39ad('0x54')](function(_0x375866){logger[_0x39ad('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x375866);throw _0x375866;});}return _0x1927ad;});}})[_0x39ad('0x2b')](respondWithResult(_0x58f31d,0xc9))[_0x39ad('0x54')](handleError(_0x58f31d,null));};exports[_0x39ad('0x2a')]=function(_0x1014f4,_0x2474d6){if(_0x1014f4[_0x39ad('0x4c')]['id']){delete _0x1014f4[_0x39ad('0x4c')]['id'];}return db[_0x39ad('0x34')]['find']({'where':{'id':_0x1014f4[_0x39ad('0x56')]['id']}})[_0x39ad('0x2b')](handleEntityNotFound(_0x2474d6,null))[_0x39ad('0x2b')](saveUpdates(_0x1014f4['body'],null))['then'](respondWithResult(_0x2474d6,null))['catch'](handleError(_0x2474d6,null));};exports[_0x39ad('0x2c')]=function(_0x35156a,_0x221219){return db[_0x39ad('0x34')][_0x39ad('0x4a')]({'where':{'id':_0x35156a['params']['id']}})['then'](handleEntityNotFound(_0x221219,null))[_0x39ad('0x2b')](removeEntity(_0x221219,null))[_0x39ad('0x54')](handleError(_0x221219,null));};function widgetAttributes(_0x5d57f1){try{switch(_0x5d57f1[_0x39ad('0x37')]){case _0x39ad('0x5d'):return[{'name':_0x39ad('0x5e'),'value':_0x5d57f1[_0x39ad('0x5e')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x0]?_0x5d57f1['attrs'][0x0][_0x39ad('0x60')]:undefined)||'https://'}];case _0x39ad('0x61'):return[{'name':_0x39ad('0x62'),'value':_0x5d57f1[_0x39ad('0x62')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x0]?_0x5d57f1['attrs'][0x0]['value']:undefined)||''}];case _0x39ad('0x63'):return[{'name':_0x39ad('0x64'),'value':_0x5d57f1[_0x39ad('0x64')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x0]?_0x5d57f1[_0x39ad('0x5f')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x5d57f1[_0x39ad('0x65')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x1]?_0x5d57f1[_0x39ad('0x5f')][0x1][_0x39ad('0x60')]:undefined)||_0x39ad('0x66')},{'name':_0x39ad('0x67'),'value':_0x5d57f1[_0x39ad('0x67')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x2]?_0x5d57f1[_0x39ad('0x5f')][0x2][_0x39ad('0x60')]:undefined)||0xc}];case _0x39ad('0x68'):return[{'name':'attrMetric','value':_0x5d57f1[_0x39ad('0x69')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x0]?_0x5d57f1['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x39ad('0x6a'),'value':_0x5d57f1[_0x39ad('0x6a')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0x1]?_0x5d57f1[_0x39ad('0x5f')][0x1][_0x39ad('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d57f1['attrFontSize']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x2]?_0x5d57f1[_0x39ad('0x5f')][0x2][_0x39ad('0x60')]:undefined)||0x14},{'name':_0x39ad('0x6b'),'value':_0x5d57f1[_0x39ad('0x6b')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x3]?_0x5d57f1[_0x39ad('0x5f')][0x3][_0x39ad('0x60')]:undefined)||_0x39ad('0x6c')},{'name':_0x39ad('0x6d'),'value':_0x5d57f1['attrEmailAccounts']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x4]?_0x5d57f1[_0x39ad('0x5f')][0x4][_0x39ad('0x60')]:undefined)||''},{'name':_0x39ad('0x6e'),'value':_0x5d57f1['attrFaxAccounts']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x5]?_0x5d57f1[_0x39ad('0x5f')][0x5][_0x39ad('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5d57f1['attrSmsAccounts']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0x6]?_0x5d57f1['attrs'][0x6][_0x39ad('0x60')]:undefined)||''},{'name':_0x39ad('0x6f'),'value':_0x5d57f1['attrOpenchannelAccounts']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x7]?_0x5d57f1['attrs'][0x7][_0x39ad('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d57f1[_0x39ad('0x70')]||(_0x5d57f1['attrs']&&_0x5d57f1[_0x39ad('0x5f')][0x8]?_0x5d57f1[_0x39ad('0x5f')][0x8][_0x39ad('0x60')]:undefined)||''},{'name':_0x39ad('0x71'),'value':_0x5d57f1[_0x39ad('0x71')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x9]?_0x5d57f1[_0x39ad('0x5f')][0x9][_0x39ad('0x60')]:undefined)||''}];case _0x39ad('0x72'):case _0x39ad('0x73'):return[{'name':_0x39ad('0x74'),'value':_0x5d57f1[_0x39ad('0x74')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x0]?_0x5d57f1[_0x39ad('0x5f')][0x0][_0x39ad('0x60')]:undefined)||'total'},{'name':_0x39ad('0x75'),'value':_0x5d57f1[_0x39ad('0x75')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0x1]?_0x5d57f1['attrs'][0x1][_0x39ad('0x60')]:undefined)||null},{'name':_0x39ad('0x76'),'value':_0x5d57f1['attrSerie3']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x2]?_0x5d57f1[_0x39ad('0x5f')][0x2][_0x39ad('0x60')]:undefined)||null},{'name':_0x39ad('0x6a'),'value':_0x5d57f1[_0x39ad('0x6a')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0x3]?_0x5d57f1[_0x39ad('0x5f')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x5d57f1[_0x39ad('0x6b')]||(_0x5d57f1['attrs']&&_0x5d57f1[_0x39ad('0x5f')][0x4]?_0x5d57f1[_0x39ad('0x5f')][0x4][_0x39ad('0x60')]:undefined)||_0x39ad('0x6c')},{'name':'attrEmailAccounts','value':_0x5d57f1['attrEmailAccounts']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0x5]?_0x5d57f1[_0x39ad('0x5f')][0x5][_0x39ad('0x60')]:undefined)||''},{'name':_0x39ad('0x6e'),'value':_0x5d57f1[_0x39ad('0x6e')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x6]?_0x5d57f1[_0x39ad('0x5f')][0x6][_0x39ad('0x60')]:undefined)||''},{'name':_0x39ad('0x77'),'value':_0x5d57f1[_0x39ad('0x77')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0x7]?_0x5d57f1['attrs'][0x7][_0x39ad('0x60')]:undefined)||''},{'name':_0x39ad('0x6f'),'value':_0x5d57f1[_0x39ad('0x6f')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x8]?_0x5d57f1[_0x39ad('0x5f')][0x8][_0x39ad('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d57f1[_0x39ad('0x70')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0x9]?_0x5d57f1[_0x39ad('0x5f')][0x9][_0x39ad('0x60')]:undefined)||''},{'name':_0x39ad('0x71'),'value':_0x5d57f1['attrChatWebsites']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1['attrs'][0xa]?_0x5d57f1['attrs'][0xa][_0x39ad('0x60')]:undefined)||''}];case _0x39ad('0x78'):return[{'name':_0x39ad('0x79'),'type':_0x5d57f1['reportType']||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x0]?_0x5d57f1[_0x39ad('0x5f')][0x0][_0x39ad('0x37')]:undefined)||null,'value':_0x5d57f1[_0x39ad('0x79')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x0]?_0x5d57f1[_0x39ad('0x5f')][0x0][_0x39ad('0x60')]:undefined)||null},{'name':_0x39ad('0x7a'),'value':_0x5d57f1[_0x39ad('0x7a')]||(_0x5d57f1[_0x39ad('0x5f')]&&_0x5d57f1[_0x39ad('0x5f')][0x1]?_0x5d57f1[_0x39ad('0x5f')][0x1][_0x39ad('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x5d79e4){logger[_0x39ad('0x2f')](_0x39ad('0x7b'),JSON[_0x39ad('0x7c')](_0x5d79e4));return[];}}exports[_0x39ad('0x7d')]=function(_0x274a8c,_0x2f74a0,_0x5b1dbd){if(_0x274a8c[_0x39ad('0x4c')]['id']){delete _0x274a8c[_0x39ad('0x4c')]['id'];}return db[_0x39ad('0x34')][_0x39ad('0x4a')]({'where':{'id':_0x274a8c[_0x39ad('0x56')]['id']}})[_0x39ad('0x2b')](handleEntityNotFound(_0x2f74a0,null))[_0x39ad('0x2b')](function(_0x55e5f9){if(_0x55e5f9){_0x274a8c[_0x39ad('0x4c')][_0x39ad('0x7e')]=_0x55e5f9['id'];_0x274a8c[_0x39ad('0x4c')][_0x39ad('0x5f')]=widgetAttributes(_0x274a8c['body']);return db['DashboardItem'][_0x39ad('0x4b')](_0x274a8c['body']);}})[_0x39ad('0x2b')](respondWithResult(_0x2f74a0,null))[_0x39ad('0x54')](handleError(_0x2f74a0,null));};exports['getItems']=function(_0x17e515,_0x353835,_0x4686df){var _0x383299={};var _0x196ae1={};var _0x54247f;var _0x41f08c;return db[_0x39ad('0x34')][_0x39ad('0x7f')]({'where':{'id':_0x17e515[_0x39ad('0x56')]['id']}})[_0x39ad('0x2b')](handleEntityNotFound(_0x353835,null))[_0x39ad('0x2b')](function(_0x1d64b0){if(_0x1d64b0){_0x54247f=_0x1d64b0;_0x196ae1[_0x39ad('0x39')]=_[_0x39ad('0x3a')](db['DashboardItem'][_0x39ad('0x35')]);_0x196ae1['query']=_['keys'](_0x17e515[_0x39ad('0x3b')]);_0x196ae1['filters']=_[_0x39ad('0x3d')](_0x196ae1['model'],_0x196ae1[_0x39ad('0x3b')]);_0x383299[_0x39ad('0x3e')]=_[_0x39ad('0x3d')](_0x196ae1[_0x39ad('0x39')],qs['fields'](_0x17e515[_0x39ad('0x3b')][_0x39ad('0x57')]));_0x383299['attributes']=_0x383299[_0x39ad('0x3e')][_0x39ad('0x3f')]?_0x383299[_0x39ad('0x3e')]:_0x196ae1[_0x39ad('0x39')];_0x383299['order']=qs['sort'](_0x17e515[_0x39ad('0x3b')][_0x39ad('0x42')]);_0x383299[_0x39ad('0x43')]=qs[_0x39ad('0x3c')](_['pick'](_0x17e515[_0x39ad('0x3b')],_0x196ae1[_0x39ad('0x3c')]));if(_0x17e515[_0x39ad('0x3b')][_0x39ad('0x44')]){_0x383299[_0x39ad('0x43')]=_[_0x39ad('0x58')](_0x383299['where'],{'$or':_['map'](_0x383299[_0x39ad('0x3e')],function(_0x1a75c5){var _0xd84f90={};_0xd84f90[_0x1a75c5]={'$like':'%'+_0x17e515[_0x39ad('0x3b')]['filter']+'%'};return _0xd84f90;})});}_0x383299=_[_0x39ad('0x58')]({},_0x383299,_0x17e515[_0x39ad('0x45')]);return _0x54247f[_0x39ad('0x80')](_0x383299);}})['then'](function(_0x2b9e61){if(_0x2b9e61){_0x41f08c=_0x2b9e61['length'];if(!_0x17e515[_0x39ad('0x3b')][_0x39ad('0x81')](_0x39ad('0x40'))){_0x383299[_0x39ad('0x25')]=qs[_0x39ad('0x25')](_0x17e515[_0x39ad('0x3b')][_0x39ad('0x25')]);_0x383299[_0x39ad('0x23')]=qs[_0x39ad('0x23')](_0x17e515[_0x39ad('0x3b')][_0x39ad('0x23')]);}return _0x54247f[_0x39ad('0x80')](_0x383299);}})[_0x39ad('0x2b')](function(_0x162e69){if(_0x162e69){return _0x162e69?{'count':_0x41f08c,'rows':_0x162e69}:null;}})[_0x39ad('0x2b')](respondWithResult(_0x353835,null))['catch'](handleError(_0x353835,null));}; \ No newline at end of file +var _0x90a1=['attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardItem','getItems','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','iframe'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x90a1,0x1b4));var _0x190a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x90a1[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x190a('0x0'));var zipdir=require(_0x190a('0x1'));var jsonpatch=require(_0x190a('0x2'));var rp=require(_0x190a('0x3'));var moment=require(_0x190a('0x4'));var BPromise=require(_0x190a('0x5'));var Mustache=require(_0x190a('0x6'));var util=require(_0x190a('0x7'));var path=require(_0x190a('0x8'));var sox=require('sox');var csv=require(_0x190a('0x9'));var ejs=require(_0x190a('0xa'));var fs=require('fs');var fs_extra=require(_0x190a('0xb'));var _=require(_0x190a('0xc'));var squel=require(_0x190a('0xd'));var crypto=require(_0x190a('0xe'));var jsforce=require(_0x190a('0xf'));var deskjs=require(_0x190a('0x10'));var toCsv=require(_0x190a('0x9'));var querystring=require(_0x190a('0x11'));var Papa=require(_0x190a('0x12'));var Redis=require(_0x190a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x190a('0x14'));var as=require(_0x190a('0x15'));var hardwareService=require(_0x190a('0x16'));var logger=require('../../config/logger')(_0x190a('0x17'));var utils=require(_0x190a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x190a('0x19'))['db'];config[_0x190a('0x1a')]=_[_0x190a('0x1b')](config[_0x190a('0x1a')],{'host':_0x190a('0x1c'),'port':0x18eb});var socket=require(_0x190a('0x1d'))(new Redis(config['redis']));require('./dashboard.socket')[_0x190a('0x1e')](socket);function respondWithStatusCode(_0x488d50,_0x54ef4a){_0x54ef4a=_0x54ef4a||0xcc;return function(_0x147c77){if(_0x147c77){return _0x488d50[_0x190a('0x1f')](_0x54ef4a);}return _0x488d50['status'](_0x54ef4a)[_0x190a('0x20')]();};}function respondWithResult(_0xcb42a6,_0x1269dd){_0x1269dd=_0x1269dd||0xc8;return function(_0x18597e){if(_0x18597e){return _0xcb42a6[_0x190a('0x21')](_0x1269dd)[_0x190a('0x22')](_0x18597e);}};}function respondWithFilteredResult(_0x24d995,_0x19bf9d){return function(_0x49989b){if(_0x49989b){var _0x3d7962=typeof _0x19bf9d[_0x190a('0x23')]===_0x190a('0x24')&&typeof _0x19bf9d[_0x190a('0x25')]===_0x190a('0x24');var _0x4ab5e7=_0x49989b['count'];var _0x55d055=_0x3d7962?0x0:_0x19bf9d['offset'];var _0x4b64dc=_0x3d7962?_0x49989b['count']:_0x19bf9d[_0x190a('0x23')]+_0x19bf9d[_0x190a('0x25')];var _0x1d5ca0;if(_0x4b64dc>=_0x4ab5e7){_0x4b64dc=_0x4ab5e7;_0x1d5ca0=0xc8;}else{_0x1d5ca0=0xce;}_0x24d995[_0x190a('0x21')](_0x1d5ca0);return _0x24d995[_0x190a('0x26')](_0x190a('0x27'),_0x55d055+'-'+_0x4b64dc+'/'+_0x4ab5e7)[_0x190a('0x22')](_0x49989b);}return null;};}function patchUpdates(_0x497712){return function(_0x16f156){try{jsonpatch[_0x190a('0x28')](_0x16f156,_0x497712,!![]);}catch(_0x3377d0){return BPromise[_0x190a('0x29')](_0x3377d0);}return _0x16f156['save']();};}function saveUpdates(_0x5f38d3,_0x4ea74d){return function(_0x2b5825){if(_0x2b5825){return _0x2b5825[_0x190a('0x2a')](_0x5f38d3)[_0x190a('0x2b')](function(_0x4a2077){return _0x4a2077;});}return null;};}function removeEntity(_0xcb9a7d,_0x4057b1){return function(_0x725864){if(_0x725864){return _0x725864[_0x190a('0x2c')]()[_0x190a('0x2b')](function(){var _0x33999a=_0x725864[_0x190a('0x2d')]({'plain':!![]});var _0x28d56b=_0x190a('0x2e');return db[_0x190a('0x2f')][_0x190a('0x2c')]({'where':{'type':_0x28d56b,'resourceId':_0x33999a['id']}})['then'](function(){return _0x725864;});})['then'](function(){_0xcb9a7d[_0x190a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20fe5d,_0x9e595){return function(_0xacae37){if(!_0xacae37){_0x20fe5d[_0x190a('0x1f')](0x194);}return _0xacae37;};}function handleError(_0x29aef6,_0x240bfc){_0x240bfc=_0x240bfc||0x1f4;return function(_0x2dbac0){logger[_0x190a('0x30')](_0x2dbac0[_0x190a('0x31')]);if(_0x2dbac0[_0x190a('0x32')]){delete _0x2dbac0[_0x190a('0x32')];}_0x29aef6[_0x190a('0x21')](_0x240bfc)[_0x190a('0x33')](_0x2dbac0);};}exports[_0x190a('0x34')]=function(_0x1c846e,_0x4df20f){var _0x3976f5={},_0x516d16={},_0x445499={'count':0x0,'rows':[]};var _0x669003=_[_0x190a('0x35')](db[_0x190a('0x36')][_0x190a('0x37')],function(_0x42c33b){return{'name':_0x42c33b[_0x190a('0x38')],'type':_0x42c33b[_0x190a('0x39')][_0x190a('0x3a')]};});_0x516d16[_0x190a('0x3b')]=_[_0x190a('0x35')](_0x669003,_0x190a('0x32'));_0x516d16[_0x190a('0x3c')]=_['keys'](_0x1c846e['query']);_0x516d16['filters']=_[_0x190a('0x3d')](_0x516d16[_0x190a('0x3b')],_0x516d16[_0x190a('0x3c')]);_0x3976f5[_0x190a('0x3e')]=_[_0x190a('0x3d')](_0x516d16['model'],qs[_0x190a('0x3f')](_0x1c846e[_0x190a('0x3c')][_0x190a('0x3f')]));_0x3976f5[_0x190a('0x3e')]=_0x3976f5[_0x190a('0x3e')][_0x190a('0x40')]?_0x3976f5[_0x190a('0x3e')]:_0x516d16[_0x190a('0x3b')];if(!_0x1c846e[_0x190a('0x3c')][_0x190a('0x41')](_0x190a('0x42'))){_0x3976f5[_0x190a('0x25')]=qs[_0x190a('0x25')](_0x1c846e[_0x190a('0x3c')][_0x190a('0x25')]);_0x3976f5['offset']=qs[_0x190a('0x23')](_0x1c846e[_0x190a('0x3c')]['offset']);}_0x3976f5[_0x190a('0x43')]=qs[_0x190a('0x44')](_0x1c846e[_0x190a('0x3c')][_0x190a('0x44')]);_0x3976f5['where']=qs['filters'](_[_0x190a('0x45')](_0x1c846e[_0x190a('0x3c')],_0x516d16[_0x190a('0x46')]),_0x669003);if(_0x1c846e[_0x190a('0x3c')][_0x190a('0x47')]){_0x3976f5[_0x190a('0x48')]=_['merge'](_0x3976f5['where'],{'$or':_[_0x190a('0x35')](_0x669003,function(_0x1f5a44){if(_0x1f5a44[_0x190a('0x39')]!==_0x190a('0x49')){var _0x1c1a5b={};_0x1c1a5b[_0x1f5a44['name']]={'$like':'%'+_0x1c846e['query'][_0x190a('0x47')]+'%'};return _0x1c1a5b;}})});}_0x3976f5=_['merge']({},_0x3976f5,_0x1c846e[_0x190a('0x4a')]);var _0x5a450a={'where':_0x3976f5['where']};return db[_0x190a('0x36')][_0x190a('0x4b')](_0x5a450a)[_0x190a('0x2b')](function(_0x1c7cf7){_0x445499[_0x190a('0x4b')]=_0x1c7cf7;if(_0x1c846e['query'][_0x190a('0x4c')]){_0x3976f5[_0x190a('0x4d')]=[{'all':!![]}];}return db[_0x190a('0x36')][_0x190a('0x4e')](_0x3976f5);})[_0x190a('0x2b')](function(_0xcab8e){_0x445499[_0x190a('0x4f')]=_0xcab8e;return _0x445499;})[_0x190a('0x2b')](respondWithFilteredResult(_0x4df20f,_0x3976f5))[_0x190a('0x50')](handleError(_0x4df20f,null));};exports[_0x190a('0x51')]=function(_0xea7cca,_0x525742){var _0x1d0fe8={'raw':![],'where':{'id':_0xea7cca['params']['id']}},_0x48ce1f={};_0x48ce1f[_0x190a('0x3b')]=_['keys'](db[_0x190a('0x36')][_0x190a('0x37')]);_0x48ce1f[_0x190a('0x3c')]=_[_0x190a('0x52')](_0xea7cca['query']);_0x48ce1f[_0x190a('0x46')]=_[_0x190a('0x3d')](_0x48ce1f['model'],_0x48ce1f[_0x190a('0x3c')]);_0x1d0fe8[_0x190a('0x3e')]=_['intersection'](_0x48ce1f[_0x190a('0x3b')],qs['fields'](_0xea7cca[_0x190a('0x3c')][_0x190a('0x3f')]));_0x1d0fe8[_0x190a('0x3e')]=_0x1d0fe8[_0x190a('0x3e')][_0x190a('0x40')]?_0x1d0fe8[_0x190a('0x3e')]:_0x48ce1f[_0x190a('0x3b')];if(_0xea7cca[_0x190a('0x3c')][_0x190a('0x4c')]){_0x1d0fe8['include']=[{'all':!![]}];}_0x1d0fe8=_[_0x190a('0x53')]({},_0x1d0fe8,_0xea7cca['options']);return db[_0x190a('0x36')][_0x190a('0x54')](_0x1d0fe8)[_0x190a('0x2b')](handleEntityNotFound(_0x525742,null))[_0x190a('0x2b')](respondWithResult(_0x525742,null))[_0x190a('0x50')](handleError(_0x525742,null));};exports[_0x190a('0x55')]=function(_0x48982f,_0xe6079){return db[_0x190a('0x36')][_0x190a('0x55')](_0x48982f[_0x190a('0x56')],{})[_0x190a('0x2b')](function(_0x436682){var _0x18e148=_0x48982f[_0x190a('0x57')][_0x190a('0x2d')]({'plain':!![]});if(!_0x18e148)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18e148[_0x190a('0x58')]==='user'){var _0x1f0467=_0x436682[_0x190a('0x2d')]({'plain':!![]});var _0x59e4b4=_0x190a('0x2e');return db['UserProfileSection'][_0x190a('0x54')]({'where':{'name':_0x59e4b4,'userProfileId':_0x18e148['userProfileId']},'raw':!![]})[_0x190a('0x2b')](function(_0x5a4e44){if(_0x5a4e44&&_0x5a4e44[_0x190a('0x59')]===0x0){return db[_0x190a('0x2f')][_0x190a('0x55')]({'name':_0x1f0467[_0x190a('0x32')],'resourceId':_0x1f0467['id'],'type':_0x5a4e44[_0x190a('0x32')],'sectionId':_0x5a4e44['id']},{})[_0x190a('0x2b')](function(){return _0x436682;});}else{return _0x436682;}})[_0x190a('0x50')](function(_0x5ce770){logger['error'](_0x190a('0x5a'),_0x5ce770);throw _0x5ce770;});}return _0x436682;})[_0x190a('0x2b')](respondWithResult(_0xe6079,0xc9))[_0x190a('0x50')](handleError(_0xe6079,null));};exports[_0x190a('0x5b')]=function(_0x15b615,_0x4fd3d2){var _0x32a259={'where':{'id':_0x15b615[_0x190a('0x5c')]['id']}},_0x519966={};_0x519966[_0x190a('0x3b')]=_[_0x190a('0x52')](db['Dashboard']['rawAttributes']);_0x32a259[_0x190a('0x3e')]=_[_0x190a('0x3d')](_0x519966[_0x190a('0x3b')],qs[_0x190a('0x3f')](_0x15b615[_0x190a('0x3c')][_0x190a('0x3f')]));_0x32a259[_0x190a('0x3e')]=_0x32a259['attributes'][_0x190a('0x40')]?_0x32a259[_0x190a('0x3e')]:_0x519966[_0x190a('0x3b')];if(_0x15b615[_0x190a('0x3c')][_0x190a('0x4c')]){_0x32a259[_0x190a('0x4d')]=[{'all':!![]}];}_0x32a259=_[_0x190a('0x53')]({},_0x32a259,_0x15b615[_0x190a('0x4a')]);return db[_0x190a('0x36')]['find'](_0x32a259)[_0x190a('0x2b')](handleEntityNotFound(_0x4fd3d2,null))[_0x190a('0x2b')](function(_0x5bad30){if(_0x5bad30){var _0x2babb6=_0x5bad30[_0x190a('0x2d')]({'plain':!![]});_0x2babb6=qs[_0x190a('0x5d')](_0x2babb6,['id',_0x190a('0x5e'),_0x190a('0x5f')]);_0x15b615[_0x190a('0x56')]=_['omit'](_0x15b615['body'],['id',_0x190a('0x5e'),_0x190a('0x5f')]);return db[_0x190a('0x36')][_0x190a('0x55')](_[_0x190a('0x53')](_0x2babb6,_0x15b615[_0x190a('0x56')]),{'include':_0x15b615['query'][_0x190a('0x4c')]?[{'all':!![]}]:undefined})[_0x190a('0x2b')](function(_0x1fee64){var _0x1c75e9=_0x15b615[_0x190a('0x57')][_0x190a('0x2d')]({'plain':!![]});if(!_0x1c75e9)throw new Error(_0x190a('0x60'));if(_0x1c75e9['role']===_0x190a('0x57')){var _0x3fe5fc=_0x1fee64['get']({'plain':!![]});var _0x252721='CustomDashboards';return db[_0x190a('0x61')][_0x190a('0x54')]({'where':{'name':_0x252721,'userProfileId':_0x1c75e9[_0x190a('0x62')]},'raw':!![]})[_0x190a('0x2b')](function(_0x23cc59){if(_0x23cc59&&_0x23cc59['autoAssociation']===0x0){return db['UserProfileResource'][_0x190a('0x55')]({'name':_0x3fe5fc[_0x190a('0x32')],'resourceId':_0x3fe5fc['id'],'type':_0x23cc59[_0x190a('0x32')],'sectionId':_0x23cc59['id']},{})[_0x190a('0x2b')](function(){return _0x1fee64;});}else{return _0x1fee64;}})[_0x190a('0x50')](function(_0x5bfbcc){logger[_0x190a('0x30')](_0x190a('0x5a'),_0x5bfbcc);throw _0x5bfbcc;});}return _0x1fee64;});}})[_0x190a('0x2b')](respondWithResult(_0x4fd3d2,0xc9))[_0x190a('0x50')](handleError(_0x4fd3d2,null));};exports[_0x190a('0x2a')]=function(_0x36817a,_0x25f6dc){if(_0x36817a[_0x190a('0x56')]['id']){delete _0x36817a[_0x190a('0x56')]['id'];}return db[_0x190a('0x36')][_0x190a('0x54')]({'where':{'id':_0x36817a['params']['id']}})[_0x190a('0x2b')](handleEntityNotFound(_0x25f6dc,null))[_0x190a('0x2b')](saveUpdates(_0x36817a[_0x190a('0x56')],null))[_0x190a('0x2b')](respondWithResult(_0x25f6dc,null))[_0x190a('0x50')](handleError(_0x25f6dc,null));};exports['destroy']=function(_0x26454c,_0x2e8830){return db[_0x190a('0x36')]['find']({'where':{'id':_0x26454c[_0x190a('0x5c')]['id']}})[_0x190a('0x2b')](handleEntityNotFound(_0x2e8830,null))[_0x190a('0x2b')](removeEntity(_0x2e8830,null))['catch'](handleError(_0x2e8830,null));};function widgetAttributes(_0x2dabef){try{switch(_0x2dabef[_0x190a('0x39')]){case _0x190a('0x63'):return[{'name':_0x190a('0x64'),'value':_0x2dabef['attrUrl']||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x0]?_0x2dabef[_0x190a('0x65')][0x0][_0x190a('0x66')]:undefined)||'https://'}];case _0x190a('0x67'):return[{'name':_0x190a('0x68'),'value':_0x2dabef['attrPath']||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x0]?_0x2dabef[_0x190a('0x65')][0x0][_0x190a('0x66')]:undefined)||''}];case _0x190a('0x69'):return[{'name':_0x190a('0x6a'),'value':_0x2dabef[_0x190a('0x6a')]||(_0x2dabef['attrs']&&_0x2dabef['attrs'][0x0]?_0x2dabef[_0x190a('0x65')][0x0][_0x190a('0x66')]:undefined)||_0x190a('0x6b')},{'name':_0x190a('0x6c'),'value':_0x2dabef[_0x190a('0x6c')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x1]?_0x2dabef[_0x190a('0x65')][0x1]['value']:undefined)||_0x190a('0x6d')},{'name':'attrFontSize','value':_0x2dabef['attrFontSize']||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x2]?_0x2dabef[_0x190a('0x65')][0x2][_0x190a('0x66')]:undefined)||0xc}];case _0x190a('0x6e'):return[{'name':'attrMetric','value':_0x2dabef[_0x190a('0x6f')]||(_0x2dabef['attrs']&&_0x2dabef[_0x190a('0x65')][0x0]?_0x2dabef['attrs'][0x0][_0x190a('0x66')]:undefined)||_0x190a('0x70')},{'name':_0x190a('0x71'),'value':_0x2dabef[_0x190a('0x71')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x1]?_0x2dabef[_0x190a('0x65')][0x1][_0x190a('0x66')]:undefined)||[]},{'name':_0x190a('0x72'),'value':_0x2dabef[_0x190a('0x72')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x2]?_0x2dabef['attrs'][0x2][_0x190a('0x66')]:undefined)||0x14},{'name':_0x190a('0x73'),'value':_0x2dabef['attrChannel']||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x3]?_0x2dabef[_0x190a('0x65')][0x3][_0x190a('0x66')]:undefined)||_0x190a('0x74')},{'name':'attrEmailAccounts','value':_0x2dabef[_0x190a('0x75')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x4]?_0x2dabef[_0x190a('0x65')][0x4][_0x190a('0x66')]:undefined)||''},{'name':_0x190a('0x76'),'value':_0x2dabef[_0x190a('0x76')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x5]?_0x2dabef[_0x190a('0x65')][0x5][_0x190a('0x66')]:undefined)||''},{'name':_0x190a('0x77'),'value':_0x2dabef['attrSmsAccounts']||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x6]?_0x2dabef[_0x190a('0x65')][0x6]['value']:undefined)||''},{'name':_0x190a('0x78'),'value':_0x2dabef['attrOpenchannelAccounts']||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x7]?_0x2dabef['attrs'][0x7][_0x190a('0x66')]:undefined)||''},{'name':_0x190a('0x79'),'value':_0x2dabef[_0x190a('0x79')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x8]?_0x2dabef[_0x190a('0x65')][0x8]['value']:undefined)||''},{'name':_0x190a('0x7a'),'value':_0x2dabef[_0x190a('0x7a')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x9]?_0x2dabef['attrs'][0x9][_0x190a('0x66')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x190a('0x7b'),'value':_0x2dabef[_0x190a('0x7b')]||(_0x2dabef['attrs']&&_0x2dabef[_0x190a('0x65')][0x0]?_0x2dabef['attrs'][0x0]['value']:undefined)||_0x190a('0x70')},{'name':_0x190a('0x7c'),'value':_0x2dabef[_0x190a('0x7c')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x1]?_0x2dabef[_0x190a('0x65')][0x1][_0x190a('0x66')]:undefined)||null},{'name':_0x190a('0x7d'),'value':_0x2dabef[_0x190a('0x7d')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x2]?_0x2dabef[_0x190a('0x65')][0x2][_0x190a('0x66')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2dabef[_0x190a('0x71')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x3]?_0x2dabef[_0x190a('0x65')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x2dabef['attrChannel']||(_0x2dabef['attrs']&&_0x2dabef[_0x190a('0x65')][0x4]?_0x2dabef[_0x190a('0x65')][0x4][_0x190a('0x66')]:undefined)||'voice'},{'name':_0x190a('0x75'),'value':_0x2dabef[_0x190a('0x75')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x5]?_0x2dabef['attrs'][0x5]['value']:undefined)||''},{'name':_0x190a('0x76'),'value':_0x2dabef[_0x190a('0x76')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x6]?_0x2dabef['attrs'][0x6]['value']:undefined)||''},{'name':_0x190a('0x77'),'value':_0x2dabef[_0x190a('0x77')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x7]?_0x2dabef[_0x190a('0x65')][0x7][_0x190a('0x66')]:undefined)||''},{'name':_0x190a('0x78'),'value':_0x2dabef[_0x190a('0x78')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x8]?_0x2dabef[_0x190a('0x65')][0x8]['value']:undefined)||''},{'name':_0x190a('0x79'),'value':_0x2dabef[_0x190a('0x79')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x9]?_0x2dabef[_0x190a('0x65')][0x9][_0x190a('0x66')]:undefined)||''},{'name':_0x190a('0x7a'),'value':_0x2dabef[_0x190a('0x7a')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0xa]?_0x2dabef['attrs'][0xa][_0x190a('0x66')]:undefined)||''}];case _0x190a('0x7e'):return[{'name':_0x190a('0x7f'),'type':_0x2dabef[_0x190a('0x80')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef['attrs'][0x0]?_0x2dabef[_0x190a('0x65')][0x0][_0x190a('0x39')]:undefined)||null,'value':_0x2dabef[_0x190a('0x7f')]||(_0x2dabef['attrs']&&_0x2dabef[_0x190a('0x65')][0x0]?_0x2dabef['attrs'][0x0][_0x190a('0x66')]:undefined)||null},{'name':_0x190a('0x81'),'value':_0x2dabef[_0x190a('0x81')]||(_0x2dabef[_0x190a('0x65')]&&_0x2dabef[_0x190a('0x65')][0x1]?_0x2dabef[_0x190a('0x65')][0x1][_0x190a('0x66')]:undefined)||0x0}];default:return[];}}catch(_0xf490bb){logger['error'](_0x190a('0x82'),JSON['stringify'](_0xf490bb));return[];}}exports['addItem']=function(_0x22b802,_0x55a38f,_0x3d23af){if(_0x22b802['body']['id']){delete _0x22b802[_0x190a('0x56')]['id'];}return db[_0x190a('0x36')]['find']({'where':{'id':_0x22b802[_0x190a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x55a38f,null))['then'](function(_0x18b260){if(_0x18b260){_0x22b802[_0x190a('0x56')]['DashboardId']=_0x18b260['id'];_0x22b802['body']['attrs']=widgetAttributes(_0x22b802['body']);return db[_0x190a('0x83')][_0x190a('0x55')](_0x22b802[_0x190a('0x56')]);}})[_0x190a('0x2b')](respondWithResult(_0x55a38f,null))[_0x190a('0x50')](handleError(_0x55a38f,null));};exports[_0x190a('0x84')]=function(_0x2bff0b,_0x1b145b,_0x1e81dd){var _0x478976={};var _0x1b9379={};var _0x5ebe8a;var _0x1b7fef;return db[_0x190a('0x36')][_0x190a('0x85')]({'where':{'id':_0x2bff0b['params']['id']}})['then'](handleEntityNotFound(_0x1b145b,null))['then'](function(_0x431318){if(_0x431318){_0x5ebe8a=_0x431318;_0x1b9379['model']=_[_0x190a('0x52')](db[_0x190a('0x83')][_0x190a('0x37')]);_0x1b9379[_0x190a('0x3c')]=_[_0x190a('0x52')](_0x2bff0b[_0x190a('0x3c')]);_0x1b9379[_0x190a('0x46')]=_['intersection'](_0x1b9379[_0x190a('0x3b')],_0x1b9379[_0x190a('0x3c')]);_0x478976[_0x190a('0x3e')]=_['intersection'](_0x1b9379[_0x190a('0x3b')],qs[_0x190a('0x3f')](_0x2bff0b[_0x190a('0x3c')][_0x190a('0x3f')]));_0x478976[_0x190a('0x3e')]=_0x478976[_0x190a('0x3e')][_0x190a('0x40')]?_0x478976[_0x190a('0x3e')]:_0x1b9379[_0x190a('0x3b')];_0x478976[_0x190a('0x43')]=qs[_0x190a('0x44')](_0x2bff0b['query'][_0x190a('0x44')]);_0x478976['where']=qs['filters'](_[_0x190a('0x45')](_0x2bff0b[_0x190a('0x3c')],_0x1b9379['filters']));if(_0x2bff0b[_0x190a('0x3c')][_0x190a('0x47')]){_0x478976[_0x190a('0x48')]=_[_0x190a('0x53')](_0x478976[_0x190a('0x48')],{'$or':_[_0x190a('0x35')](_0x478976[_0x190a('0x3e')],function(_0x2896f2){var _0x1e3889={};_0x1e3889[_0x2896f2]={'$like':'%'+_0x2bff0b['query'][_0x190a('0x47')]+'%'};return _0x1e3889;})});}_0x478976=_['merge']({},_0x478976,_0x2bff0b[_0x190a('0x4a')]);return _0x5ebe8a[_0x190a('0x84')](_0x478976);}})['then'](function(_0x246b03){if(_0x246b03){_0x1b7fef=_0x246b03['length'];if(!_0x2bff0b[_0x190a('0x3c')][_0x190a('0x41')](_0x190a('0x42'))){_0x478976[_0x190a('0x25')]=qs['limit'](_0x2bff0b['query'][_0x190a('0x25')]);_0x478976[_0x190a('0x23')]=qs['offset'](_0x2bff0b[_0x190a('0x3c')][_0x190a('0x23')]);}return _0x5ebe8a[_0x190a('0x84')](_0x478976);}})['then'](function(_0x12c02c){if(_0x12c02c){return _0x12c02c?{'count':_0x1b7fef,'rows':_0x12c02c}:null;}})[_0x190a('0x2b')](respondWithResult(_0x1b145b,null))['catch'](handleError(_0x1b145b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6b93834..2f70a27 100644 --- a/server/api/dashboard/dashboard.events.js +++ b/server/api/dashboard/dashboard.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe382=['remove','emit','hook','../../mysqldb','Dashboard'];(function(_0x1ed0ed,_0x410be4){var _0x452572=function(_0x8cd22c){while(--_0x8cd22c){_0x1ed0ed['push'](_0x1ed0ed['shift']());}};_0x452572(++_0x410be4);}(_0xe382,0x1b6));var _0x2e38=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xe382[_0x310504];return _0x5b36d0;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x2e38('0x0'))['db'][_0x2e38('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2e38('0x2')};function emitEvent(_0x597e9a){return function(_0x2a7110,_0xc068f0,_0x5e69dc){DashboardEvents[_0x2e38('0x3')](_0x597e9a+':'+_0x2a7110['id'],_0x2a7110);DashboardEvents['emit'](_0x597e9a,_0x2a7110);_0x5e69dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x2e38('0x4')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xdb87=['save','update','emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners'];(function(_0x4dfe60,_0x53b30c){var _0xa5ce26=function(_0x24299e){while(--_0x24299e){_0x4dfe60['push'](_0x4dfe60['shift']());}};_0xa5ce26(++_0x53b30c);}(_0xdb87,0x11d));var _0x7db8=function(_0x1542ac,_0x33eb5c){_0x1542ac=_0x1542ac-0x0;var _0x213afa=_0xdb87[_0x1542ac];return _0x213afa;};'use strict';var EventEmitter=require(_0x7db8('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x7db8('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7db8('0x2')](0x0);var events={'afterCreate':_0x7db8('0x3'),'afterUpdate':_0x7db8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1a0b85){return function(_0x36fff5,_0x117332,_0x14dd01){DashboardEvents[_0x7db8('0x5')](_0x1a0b85+':'+_0x36fff5['id'],_0x36fff5);DashboardEvents[_0x7db8('0x5')](_0x1a0b85,_0x36fff5);_0x14dd01(null);};}for(var e in events){if(events[_0x7db8('0x6')](e)){var event=events[e];Dashboard[_0x7db8('0x7')](e,emitEvent(event));}}module[_0x7db8('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7579362..ca289c8 100644 --- a/server/api/dashboard/dashboard.model.js +++ b/server/api/dashboard/dashboard.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae87=['moment','bluebird','path','./dashboard.attributes','exports','Dashboard','dashboards'];(function(_0x125c89,_0xabf3e4){var _0x409fc0=function(_0x345191){while(--_0x345191){_0x125c89['push'](_0x125c89['shift']());}};_0x409fc0(++_0xabf3e4);}(_0xae87,0x1ce));var _0x7ae8=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0xae87[_0x52f159];return _0x156799;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7ae8('0x0'));var BPromise=require(_0x7ae8('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ae8('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7ae8('0x3'));module[_0x7ae8('0x4')]=function(_0x141978,_0x3b6a2d){return _0x141978['define'](_0x7ae8('0x5'),attributes,{'tableName':_0x7ae8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce47=['dashboards','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./dashboard.attributes','exports','define'];(function(_0xb7732b,_0x322569){var _0x2560f5=function(_0x455784){while(--_0x455784){_0xb7732b['push'](_0xb7732b['shift']());}};_0x2560f5(++_0x322569);}(_0xce47,0x91));var _0x7ce4=function(_0x2b85c8,_0x4af32d){_0x2b85c8=_0x2b85c8-0x0;var _0x260a27=_0xce47[_0x2b85c8];return _0x260a27;};'use strict';var _=require(_0x7ce4('0x0'));var util=require(_0x7ce4('0x1'));var logger=require(_0x7ce4('0x2'))(_0x7ce4('0x3'));var moment=require(_0x7ce4('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ce4('0x5'));var fs=require('fs');var path=require(_0x7ce4('0x6'));var rimraf=require('rimraf');var config=require(_0x7ce4('0x7'));var attributes=require(_0x7ce4('0x8'));module[_0x7ce4('0x9')]=function(_0x31e4ab,_0x9f5ebb){return _0x31e4ab[_0x7ce4('0xa')]('Dashboard',attributes,{'tableName':_0x7ce4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e20c5d8..4140e9b 100644 --- a/server/api/dashboard/dashboard.rpc.js +++ b/server/api/dashboard/dashboard.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb23=['request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info'];(function(_0x7aadd3,_0x3580c9){var _0x26df98=function(_0x350978){while(--_0x350978){_0x7aadd3['push'](_0x7aadd3['shift']());}};_0x26df98(++_0x3580c9);}(_0xdb23,0xd5));var _0x3db2=function(_0x2f046b,_0x248723){_0x2f046b=_0x2f046b-0x0;var _0x15879b=_0xdb23[_0x2f046b];return _0x15879b;};'use strict';var _=require(_0x3db2('0x0'));var util=require(_0x3db2('0x1'));var moment=require('moment');var BPromise=require(_0x3db2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3db2('0x3'))['db'];var utils=require(_0x3db2('0x4'));var logger=require(_0x3db2('0x5'))(_0x3db2('0x6'));var config=require(_0x3db2('0x7'));var jayson=require(_0x3db2('0x8'));var client=jayson[_0x3db2('0x9')][_0x3db2('0xa')]({'port':0x232a});config[_0x3db2('0xb')]=_[_0x3db2('0xc')](config[_0x3db2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3db2('0xd'))(new Redis(config[_0x3db2('0xb')]));require(_0x3db2('0xe'))[_0x3db2('0xf')](socket);function respondWithRpcPromise(_0x120768,_0xb4623e,_0x42f0df){return new BPromise(function(_0x558c79,_0x2f8ccb){return client[_0x3db2('0x10')](_0x120768,_0x42f0df)[_0x3db2('0x11')](function(_0x2c0068){logger[_0x3db2('0x12')]('Dashboard,\x20%s,\x20%s',_0xb4623e,_0x3db2('0x13'));logger[_0x3db2('0x14')](_0x3db2('0x15'),_0xb4623e,_0x3db2('0x13'),JSON[_0x3db2('0x16')](_0x2c0068));if(_0x2c0068[_0x3db2('0x17')]){if(_0x2c0068[_0x3db2('0x17')][_0x3db2('0x18')]===0x1f4){logger['error'](_0x3db2('0x19'),_0xb4623e,_0x2c0068[_0x3db2('0x17')][_0x3db2('0x1a')]);return _0x2f8ccb(_0x2c0068['error']['message']);}logger['error'](_0x3db2('0x19'),_0xb4623e,_0x2c0068['error']['message']);return _0x558c79(_0x2c0068[_0x3db2('0x17')][_0x3db2('0x1a')]);}else{logger['info'](_0x3db2('0x19'),_0xb4623e,_0x3db2('0x13'));_0x558c79(_0x2c0068[_0x3db2('0x1b')]['message']);}})[_0x3db2('0x1c')](function(_0x1c15ca){logger[_0x3db2('0x17')](_0x3db2('0x19'),_0xb4623e,_0x1c15ca);_0x2f8ccb(_0x1c15ca);});});} \ No newline at end of file +var _0x7de4=['result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x42cb1e,_0x92fe14){var _0x4f1009=function(_0x156a67){while(--_0x156a67){_0x42cb1e['push'](_0x42cb1e['shift']());}};_0x4f1009(++_0x92fe14);}(_0x7de4,0x145));var _0x47de=function(_0x47a0f1,_0x2aaf0f){_0x47a0f1=_0x47a0f1-0x0;var _0x492486=_0x7de4[_0x47a0f1];return _0x492486;};'use strict';var _=require(_0x47de('0x0'));var util=require('util');var moment=require(_0x47de('0x1'));var BPromise=require(_0x47de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47de('0x3'));var db=require(_0x47de('0x4'))['db'];var utils=require(_0x47de('0x5'));var logger=require(_0x47de('0x6'))('rpc');var config=require(_0x47de('0x7'));var jayson=require(_0x47de('0x8'));var client=jayson[_0x47de('0x9')][_0x47de('0xa')]({'port':0x232a});config['redis']=_[_0x47de('0xb')](config['redis'],{'host':_0x47de('0xc'),'port':0x18eb});var socket=require(_0x47de('0xd'))(new Redis(config[_0x47de('0xe')]));require(_0x47de('0xf'))[_0x47de('0x10')](socket);function respondWithRpcPromise(_0xe76847,_0xc2bd78,_0x2c92cc){return new BPromise(function(_0x230bec,_0x427f41){return client['request'](_0xe76847,_0x2c92cc)[_0x47de('0x11')](function(_0x134ea1){logger[_0x47de('0x12')](_0x47de('0x13'),_0xc2bd78,_0x47de('0x14'));logger[_0x47de('0x15')](_0x47de('0x16'),_0xc2bd78,_0x47de('0x14'),JSON['stringify'](_0x134ea1));if(_0x134ea1[_0x47de('0x17')]){if(_0x134ea1[_0x47de('0x17')][_0x47de('0x18')]===0x1f4){logger[_0x47de('0x17')](_0x47de('0x13'),_0xc2bd78,_0x134ea1['error'][_0x47de('0x19')]);return _0x427f41(_0x134ea1[_0x47de('0x17')][_0x47de('0x19')]);}logger[_0x47de('0x17')]('Dashboard,\x20%s,\x20%s',_0xc2bd78,_0x134ea1[_0x47de('0x17')]['message']);return _0x230bec(_0x134ea1[_0x47de('0x17')][_0x47de('0x19')]);}else{logger[_0x47de('0x12')](_0x47de('0x13'),_0xc2bd78,_0x47de('0x14'));_0x230bec(_0x134ea1[_0x47de('0x1a')][_0x47de('0x19')]);}})['catch'](function(_0x225448){logger[_0x47de('0x17')]('Dashboard,\x20%s,\x20%s',_0xc2bd78,_0x225448);_0x427f41(_0x225448);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4a537f6..585e22b 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc394=['update','removeListener','./dashboard.events','save','remove'];(function(_0xd13ae8,_0x195d2c){var _0x7aff77=function(_0x39f974){while(--_0x39f974){_0xd13ae8['push'](_0xd13ae8['shift']());}};_0x7aff77(++_0x195d2c);}(_0xc394,0xc5));var _0x4c39=function(_0x14ab95,_0x48973f){_0x14ab95=_0x14ab95-0x0;var _0x3f96d2=_0xc394[_0x14ab95];return _0x3f96d2;};'use strict';var DashboardEvents=require(_0x4c39('0x0'));var events=[_0x4c39('0x1'),_0x4c39('0x2'),_0x4c39('0x3')];function createListener(_0x71b1e5,_0x1c70b6){return function(_0x242944){_0x1c70b6['emit'](_0x71b1e5,_0x242944);};}function removeListener(_0x21c809,_0x224a7f){return function(){DashboardEvents[_0x4c39('0x4')](_0x21c809,_0x224a7f);};}exports['register']=function(_0x1d7042){for(var _0x498857=0x0,_0x3cdc8c=events['length'];_0x498857<_0x3cdc8c;_0x498857++){var _0x17827f=events[_0x498857];var _0x29ccf4=createListener('dashboard:'+_0x17827f,_0x1d7042);DashboardEvents['on'](_0x17827f,_0x29ccf4);}}; \ No newline at end of file +var _0x5a13=['./dashboard.events','remove','update','emit','removeListener','dashboard:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a13,0xcc));var _0x35a1=function(_0x362994,_0x56891c){_0x362994=_0x362994-0x0;var _0x4a3b00=_0x5a13[_0x362994];return _0x4a3b00;};'use strict';var DashboardEvents=require(_0x35a1('0x0'));var events=['save',_0x35a1('0x1'),_0x35a1('0x2')];function createListener(_0x4afb06,_0x5b9a29){return function(_0x3be0f6){_0x5b9a29[_0x35a1('0x3')](_0x4afb06,_0x3be0f6);};}function removeListener(_0x17d873,_0x3819a5){return function(){DashboardEvents[_0x35a1('0x4')](_0x17d873,_0x3819a5);};}exports['register']=function(_0x338399){for(var _0x4c919d=0x0,_0x5ecadc=events['length'];_0x4c919d<_0x5ecadc;_0x4c919d++){var _0x5dd67c=events[_0x4c919d];var _0x777fb2=createListener(_0x35a1('0x5')+_0x5dd67c,_0x338399);DashboardEvents['on'](_0x5dd67c,_0x777fb2);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bf63194..3390b94 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa866=['getItems','post','create','/:id/clone','clone','addItem','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items'];(function(_0x4c125a,_0x218f1b){var _0x41847e=function(_0x1adc1f){while(--_0x1adc1f){_0x4c125a['push'](_0x4c125a['shift']());}};_0x41847e(++_0x218f1b);}(_0xa866,0x6a));var _0x6a86=function(_0x414f7f,_0x11f6bf){_0x414f7f=_0x414f7f-0x0;var _0xa3d79d=_0xa866[_0x414f7f];return _0xa3d79d;};'use strict';var multer=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var path=require(_0x6a86('0x2'));var timeout=require(_0x6a86('0x3'));var express=require(_0x6a86('0x4'));var router=express['Router']();var fs_extra=require(_0x6a86('0x5'));var auth=require(_0x6a86('0x6'));var interaction=require(_0x6a86('0x7'));var config=require('../../config/environment');var controller=require(_0x6a86('0x8'));router[_0x6a86('0x9')]('/',auth[_0x6a86('0xa')](),controller['index']);router[_0x6a86('0x9')](_0x6a86('0xb'),auth[_0x6a86('0xa')](),controller[_0x6a86('0xc')]);router[_0x6a86('0x9')](_0x6a86('0xd'),auth[_0x6a86('0xa')](),controller[_0x6a86('0xe')]);router[_0x6a86('0xf')]('/',auth['isAuthenticated'](),controller[_0x6a86('0x10')]);router[_0x6a86('0xf')](_0x6a86('0x11'),auth['isAuthenticated'](),controller[_0x6a86('0x12')]);router[_0x6a86('0xf')]('/:id/items',auth['isAuthenticated'](),controller[_0x6a86('0x13')]);router[_0x6a86('0x14')](_0x6a86('0xb'),auth[_0x6a86('0xa')](),controller[_0x6a86('0x15')]);router[_0x6a86('0x16')](_0x6a86('0xb'),auth[_0x6a86('0xa')](),controller['destroy']);module[_0x6a86('0x17')]=router; \ No newline at end of file +var _0xc2bb=['put','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','/:id/items','getItems','create','post'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0xc2bb,0x134));var _0xbc2b=function(_0x1b5ee6,_0xc4c347){_0x1b5ee6=_0x1b5ee6-0x0;var _0x533919=_0xc2bb[_0x1b5ee6];return _0x533919;};'use strict';var multer=require('multer');var util=require(_0xbc2b('0x0'));var path=require(_0xbc2b('0x1'));var timeout=require(_0xbc2b('0x2'));var express=require(_0xbc2b('0x3'));var router=express[_0xbc2b('0x4')]();var fs_extra=require(_0xbc2b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbc2b('0x6'));var config=require(_0xbc2b('0x7'));var controller=require(_0xbc2b('0x8'));router[_0xbc2b('0x9')]('/',auth[_0xbc2b('0xa')](),controller['index']);router[_0xbc2b('0x9')](_0xbc2b('0xb'),auth[_0xbc2b('0xa')](),controller['show']);router['get'](_0xbc2b('0xc'),auth[_0xbc2b('0xa')](),controller[_0xbc2b('0xd')]);router['post']('/',auth[_0xbc2b('0xa')](),controller[_0xbc2b('0xe')]);router[_0xbc2b('0xf')]('/:id/clone',auth[_0xbc2b('0xa')](),controller['clone']);router[_0xbc2b('0xf')]('/:id/items',auth[_0xbc2b('0xa')](),controller['addItem']);router[_0xbc2b('0x10')](_0xbc2b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbc2b('0x11')](_0xbc2b('0xb'),auth[_0xbc2b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 78d1be8..30bf2df 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x37dfba,_0x4f6c75){var _0x4408b2=function(_0x1d58e2){while(--_0x1d58e2){_0x37dfba['push'](_0x37dfba['shift']());}};_0x4408b2(++_0x4f6c75);}(_0x2ef3,0xba));var _0x32ef=function(_0x3d2b72,_0x4da4b3){_0x3d2b72=_0x3d2b72-0x0;var _0x16ac24=_0x2ef3[_0x3d2b72];return _0x16ac24;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1883=['stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x1883,0xab));var _0x3188=function(_0x4b444d,_0x3d3958){_0x4b444d=_0x4b444d-0x0;var _0x4baca4=_0x1883[_0x4b444d];return _0x4baca4;};'use strict';var Sequelize=require(_0x3188('0x0'));var squel=require(_0x3188('0x1'));var _=require(_0x3188('0x2'));module[_0x3188('0x3')]={'title':{'type':Sequelize[_0x3188('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x3188('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3188('0x5')](_0x3188('0x6')),'get':function(){try{return JSON[_0x3188('0x7')](this[_0x3188('0x8')](_0x3188('0x9')));}catch(_0x345612){return[];}},'set':function(_0x408ae0){try{this[_0x3188('0xa')](_0x3188('0x9'),JSON[_0x3188('0xb')](_0x408ae0));}catch(_0x3e3afb){this['setDataValue'](_0x3188('0x9'),JSON[_0x3188('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3188('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x3188('0xc')]},'background':{'type':Sequelize[_0x3188('0x4')],'allowNull':![],'defaultValue':_0x3188('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3188('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3188('0x4')]},'titleFontSize':{'type':Sequelize[_0x3188('0xc')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 6655142..feeb2f5 100644 --- a/server/api/dashboardItem/dashboardItem.controller.js +++ b/server/api/dashboardItem/dashboardItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['offset','undefined','set','Content-Range','json','apply','reject','update','then','destroy','error','name','show','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','include','merge','options','catch','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','counter','attrMetric','attrVoiceQueues','attrFontSize','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie3','attrChannel','web-report','type','attrReport','attrRefresh','widgetAttributes:\x20%s','body','create','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','end','status'];(function(_0x32df24,_0x3f6511){var _0x288601=function(_0x37cae4){while(--_0x37cae4){_0x32df24['push'](_0x32df24['shift']());}};_0x288601(++_0x3f6511);}(_0x1261,0x144));var _0x1126=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x1261[_0x41d432];return _0x1650f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];config[_0x1126('0x18')]=_[_0x1126('0x19')](config[_0x1126('0x18')],{'host':_0x1126('0x1a'),'port':0x18eb});var socket=require(_0x1126('0x1b'))(new Redis(config[_0x1126('0x18')]));require(_0x1126('0x1c'))['register'](socket);function respondWithStatusCode(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xcc;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1d')](_0x1af673);}return _0x5de9a7['status'](_0x1af673)[_0x1126('0x1e')]();};}function respondWithResult(_0x4794a7,_0x35fe9f){_0x35fe9f=_0x35fe9f||0xc8;return function(_0x42f379){if(_0x42f379){return _0x4794a7[_0x1126('0x1f')](_0x35fe9f)['json'](_0x42f379);}};}function respondWithFilteredResult(_0x245cd7,_0x1695f6){return function(_0x4a7b49){if(_0x4a7b49){var _0x4d2b38=typeof _0x1695f6[_0x1126('0x20')]===_0x1126('0x21')&&typeof _0x1695f6['limit']==='undefined';var _0x4564c0=_0x4a7b49['count'];var _0x22ed37=_0x4d2b38?0x0:_0x1695f6[_0x1126('0x20')];var _0x2f70ac=_0x4d2b38?_0x4a7b49['count']:_0x1695f6[_0x1126('0x20')]+_0x1695f6['limit'];var _0x56efeb;if(_0x2f70ac>=_0x4564c0){_0x2f70ac=_0x4564c0;_0x56efeb=0xc8;}else{_0x56efeb=0xce;}_0x245cd7[_0x1126('0x1f')](_0x56efeb);return _0x245cd7[_0x1126('0x22')](_0x1126('0x23'),_0x22ed37+'-'+_0x2f70ac+'/'+_0x4564c0)[_0x1126('0x24')](_0x4a7b49);}return null;};}function patchUpdates(_0x526ca1){return function(_0x29ab60){try{jsonpatch[_0x1126('0x25')](_0x29ab60,_0x526ca1,!![]);}catch(_0x48a08d){return BPromise[_0x1126('0x26')](_0x48a08d);}return _0x29ab60['save']();};}function saveUpdates(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x27')](_0x529dd9)[_0x1126('0x28')](function(_0x34bcf1){return _0x34bcf1;});}return null;};}function removeEntity(_0x566c09,_0x1b07a7){return function(_0xea0971){if(_0xea0971){return _0xea0971[_0x1126('0x29')]()['then'](function(){_0x566c09[_0x1126('0x1f')](0xcc)[_0x1126('0x1e')]();});}};}function handleEntityNotFound(_0xa293f4,_0x5ddf63){return function(_0x541bc9){if(!_0x541bc9){_0xa293f4[_0x1126('0x1d')](0x194);}return _0x541bc9;};}function handleError(_0x39bf0e,_0x55e195){_0x55e195=_0x55e195||0x1f4;return function(_0x2fb797){logger[_0x1126('0x2a')](_0x2fb797['stack']);if(_0x2fb797[_0x1126('0x2b')]){delete _0x2fb797['name'];}_0x39bf0e[_0x1126('0x1f')](_0x55e195)['send'](_0x2fb797);};}exports[_0x1126('0x2c')]=function(_0x583ce6,_0x378f4d){var _0x5f2611={'raw':![],'where':{'id':_0x583ce6['params']['id']}},_0x5252e0={};_0x5252e0[_0x1126('0x2d')]=_[_0x1126('0x2e')](db[_0x1126('0x2f')]['rawAttributes']);_0x5252e0[_0x1126('0x30')]=_[_0x1126('0x2e')](_0x583ce6['query']);_0x5252e0[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5252e0[_0x1126('0x2d')],_0x5252e0[_0x1126('0x30')]);_0x5f2611['attributes']=_['intersection'](_0x5252e0[_0x1126('0x2d')],qs[_0x1126('0x33')](_0x583ce6[_0x1126('0x30')][_0x1126('0x33')]));_0x5f2611['attributes']=_0x5f2611[_0x1126('0x34')][_0x1126('0x35')]?_0x5f2611[_0x1126('0x34')]:_0x5252e0[_0x1126('0x2d')];if(_0x583ce6[_0x1126('0x30')]['includeAll']){_0x5f2611[_0x1126('0x36')]=[{'all':!![]}];}_0x5f2611=_[_0x1126('0x37')]({},_0x5f2611,_0x583ce6[_0x1126('0x38')]);return db[_0x1126('0x2f')]['find'](_0x5f2611)['then'](handleEntityNotFound(_0x378f4d,null))[_0x1126('0x28')](respondWithResult(_0x378f4d,null))[_0x1126('0x39')](handleError(_0x378f4d,null));};exports['destroy']=function(_0xde37cf,_0xf3c21b){return db[_0x1126('0x2f')]['find']({'where':{'id':_0xde37cf['params']['id']}})[_0x1126('0x28')](handleEntityNotFound(_0xf3c21b,null))[_0x1126('0x28')](removeEntity(_0xf3c21b,null))[_0x1126('0x39')](handleError(_0xf3c21b,null));};function widgetAttributes(_0x156554){try{switch(_0x156554['type']){case _0x1126('0x3a'):return[{'name':'attrUrl','value':_0x156554[_0x1126('0x3b')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'https://'}];case _0x1126('0x3e'):return[{'name':_0x1126('0x3f'),'value':_0x156554[_0x1126('0x3f')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||''}];case'clock':return[{'name':_0x1126('0x40'),'value':_0x156554[_0x1126('0x40')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x1126('0x41'),'value':_0x156554[_0x1126('0x41')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1][_0x1126('0x3d')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x156554['attrFontSize']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x2]?_0x156554[_0x1126('0x3c')][0x2][_0x1126('0x3d')]:undefined)||0xc}];case _0x1126('0x42'):return[{'name':_0x1126('0x43'),'value':_0x156554['attrMetric']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'total'},{'name':_0x1126('0x44'),'value':_0x156554['attrVoiceQueues']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x1]?_0x156554[_0x1126('0x3c')][0x1][_0x1126('0x3d')]:undefined)||[]},{'name':_0x1126('0x45'),'value':_0x156554['attrFontSize']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x2]?_0x156554[_0x1126('0x3c')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x156554['attrChannel']||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x3]?_0x156554[_0x1126('0x3c')][0x3]['value']:undefined)||_0x1126('0x46')},{'name':_0x1126('0x47'),'value':_0x156554[_0x1126('0x47')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x4]?_0x156554['attrs'][0x4][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x48'),'value':_0x156554['attrFaxAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x5]?_0x156554['attrs'][0x5][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x49'),'value':_0x156554['attrSmsAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x6]?_0x156554[_0x1126('0x3c')][0x6]['value']:undefined)||''},{'name':_0x1126('0x4a'),'value':_0x156554[_0x1126('0x4a')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x7]?_0x156554[_0x1126('0x3c')][0x7][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4b'),'value':_0x156554[_0x1126('0x4b')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x8]?_0x156554['attrs'][0x8][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4c'),'value':_0x156554['attrChatWebsites']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x9]?_0x156554[_0x1126('0x3c')][0x9][_0x1126('0x3d')]:undefined)||''}];case'multibar-chart':case _0x1126('0x4d'):return[{'name':_0x1126('0x4e'),'value':_0x156554[_0x1126('0x4e')]||(_0x156554[_0x1126('0x3c')]&&_0x156554['attrs'][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x3d')]:undefined)||'total'},{'name':'attrSerie2','value':_0x156554['attrSerie2']||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1]['value']:undefined)||null},{'name':_0x1126('0x4f'),'value':_0x156554[_0x1126('0x4f')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x2]?_0x156554[_0x1126('0x3c')][0x2]['value']:undefined)||null},{'name':_0x1126('0x44'),'value':_0x156554[_0x1126('0x44')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x3]?_0x156554[_0x1126('0x3c')][0x3][_0x1126('0x3d')]:undefined)||[]},{'name':_0x1126('0x50'),'value':_0x156554[_0x1126('0x50')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x4]?_0x156554['attrs'][0x4][_0x1126('0x3d')]:undefined)||_0x1126('0x46')},{'name':_0x1126('0x47'),'value':_0x156554['attrEmailAccounts']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x5]?_0x156554['attrs'][0x5][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x48'),'value':_0x156554[_0x1126('0x48')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x6]?_0x156554[_0x1126('0x3c')][0x6][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x49'),'value':_0x156554[_0x1126('0x49')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x7]?_0x156554[_0x1126('0x3c')][0x7]['value']:undefined)||''},{'name':_0x1126('0x4a'),'value':_0x156554[_0x1126('0x4a')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x8]?_0x156554[_0x1126('0x3c')][0x8]['value']:undefined)||''},{'name':_0x1126('0x4b'),'value':_0x156554[_0x1126('0x4b')]||(_0x156554['attrs']&&_0x156554[_0x1126('0x3c')][0x9]?_0x156554['attrs'][0x9][_0x1126('0x3d')]:undefined)||''},{'name':_0x1126('0x4c'),'value':_0x156554['attrChatWebsites']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0xa]?_0x156554[_0x1126('0x3c')][0xa]['value']:undefined)||''}];case _0x1126('0x51'):return[{'name':'attrReport','type':_0x156554['reportType']||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554[_0x1126('0x3c')][0x0][_0x1126('0x52')]:undefined)||null,'value':_0x156554[_0x1126('0x53')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x0]?_0x156554['attrs'][0x0][_0x1126('0x3d')]:undefined)||null},{'name':_0x1126('0x54'),'value':_0x156554[_0x1126('0x54')]||(_0x156554[_0x1126('0x3c')]&&_0x156554[_0x1126('0x3c')][0x1]?_0x156554[_0x1126('0x3c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5b17d6){logger[_0x1126('0x2a')](_0x1126('0x55'),JSON['stringify'](_0x5b17d6));return[];}}exports['create']=function(_0x5e9260,_0x51a28d){if(_0x5e9260[_0x1126('0x56')]){_0x5e9260[_0x1126('0x56')][_0x1126('0x3c')]=widgetAttributes(_0x5e9260['body']);}return db[_0x1126('0x2f')][_0x1126('0x57')](_0x5e9260[_0x1126('0x56')],{})[_0x1126('0x28')](respondWithResult(_0x51a28d,0xc9))[_0x1126('0x39')](handleError(_0x51a28d,null));};exports[_0x1126('0x27')]=function(_0x131056,_0x49a0a3){if(_0x131056[_0x1126('0x56')]['id']){delete _0x131056[_0x1126('0x56')]['id'];}_0x131056[_0x1126('0x56')][_0x1126('0x3c')]=widgetAttributes(_0x131056[_0x1126('0x56')]);return db['DashboardItem']['find']({'where':{'id':_0x131056[_0x1126('0x58')]['id']}})[_0x1126('0x28')](handleEntityNotFound(_0x49a0a3,null))['then'](saveUpdates(_0x131056[_0x1126('0x56')],null))[_0x1126('0x28')](respondWithResult(_0x49a0a3,null))[_0x1126('0x39')](handleError(_0x49a0a3,null));}; \ No newline at end of file +var _0x1a61=['update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','stringify','create','body'];(function(_0x1a4b42,_0x198645){var _0x4e78a9=function(_0x36b49b){while(--_0x36b49b){_0x1a4b42['push'](_0x1a4b42['shift']());}};_0x4e78a9(++_0x198645);}(_0x1a61,0x1e6));var _0x11a6=function(_0x3bde6a,_0x38d3ed){_0x3bde6a=_0x3bde6a-0x0;var _0x2d35f0=_0x1a61[_0x3bde6a];return _0x2d35f0;};'use strict';var emlformat=require(_0x11a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11a6('0x2'));var moment=require(_0x11a6('0x3'));var BPromise=require(_0x11a6('0x4'));var Mustache=require(_0x11a6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x11a6('0x6'));var csv=require(_0x11a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11a6('0x8'));var _=require(_0x11a6('0x9'));var squel=require(_0x11a6('0xa'));var crypto=require(_0x11a6('0xb'));var jsforce=require(_0x11a6('0xc'));var deskjs=require(_0x11a6('0xd'));var toCsv=require(_0x11a6('0x7'));var querystring=require(_0x11a6('0xe'));var Papa=require(_0x11a6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x11a6('0x10'));var hardwareService=require(_0x11a6('0x11'));var logger=require('../../config/logger')(_0x11a6('0x12'));var utils=require(_0x11a6('0x13'));var config=require(_0x11a6('0x14'));var licenseUtil=require(_0x11a6('0x15'));var db=require(_0x11a6('0x16'))['db'];config[_0x11a6('0x17')]=_['defaults'](config['redis'],{'host':_0x11a6('0x18'),'port':0x18eb});var socket=require(_0x11a6('0x19'))(new Redis(config['redis']));require(_0x11a6('0x1a'))[_0x11a6('0x1b')](socket);function respondWithStatusCode(_0x5158ea,_0x252df2){_0x252df2=_0x252df2||0xcc;return function(_0x1ec457){if(_0x1ec457){return _0x5158ea['sendStatus'](_0x252df2);}return _0x5158ea[_0x11a6('0x1c')](_0x252df2)[_0x11a6('0x1d')]();};}function respondWithResult(_0x1fec24,_0x444ed0){_0x444ed0=_0x444ed0||0xc8;return function(_0x4bdbf3){if(_0x4bdbf3){return _0x1fec24[_0x11a6('0x1c')](_0x444ed0)[_0x11a6('0x1e')](_0x4bdbf3);}};}function respondWithFilteredResult(_0xe8ed8,_0x289fff){return function(_0x1a9d43){if(_0x1a9d43){var _0x1e3cdd=typeof _0x289fff[_0x11a6('0x1f')]===_0x11a6('0x20')&&typeof _0x289fff[_0x11a6('0x21')]===_0x11a6('0x20');var _0x2516a4=_0x1a9d43[_0x11a6('0x22')];var _0x25a4c5=_0x1e3cdd?0x0:_0x289fff[_0x11a6('0x1f')];var _0x595d3c=_0x1e3cdd?_0x1a9d43[_0x11a6('0x22')]:_0x289fff[_0x11a6('0x1f')]+_0x289fff[_0x11a6('0x21')];var _0x3d1efd;if(_0x595d3c>=_0x2516a4){_0x595d3c=_0x2516a4;_0x3d1efd=0xc8;}else{_0x3d1efd=0xce;}_0xe8ed8['status'](_0x3d1efd);return _0xe8ed8['set'](_0x11a6('0x23'),_0x25a4c5+'-'+_0x595d3c+'/'+_0x2516a4)['json'](_0x1a9d43);}return null;};}function patchUpdates(_0x707dd2){return function(_0x4c42ec){try{jsonpatch['apply'](_0x4c42ec,_0x707dd2,!![]);}catch(_0x51fe97){return BPromise['reject'](_0x51fe97);}return _0x4c42ec[_0x11a6('0x24')]();};}function saveUpdates(_0x55a043,_0x1830f6){return function(_0x364375){if(_0x364375){return _0x364375['update'](_0x55a043)['then'](function(_0x2ffd7f){return _0x2ffd7f;});}return null;};}function removeEntity(_0x144cc5,_0x34e230){return function(_0x2715d5){if(_0x2715d5){return _0x2715d5[_0x11a6('0x25')]()[_0x11a6('0x26')](function(){_0x144cc5[_0x11a6('0x1c')](0xcc)[_0x11a6('0x1d')]();});}};}function handleEntityNotFound(_0x111e74,_0x349915){return function(_0x1ceb50){if(!_0x1ceb50){_0x111e74[_0x11a6('0x27')](0x194);}return _0x1ceb50;};}function handleError(_0x3f87a3,_0x3ca310){_0x3ca310=_0x3ca310||0x1f4;return function(_0x304ad8){logger[_0x11a6('0x28')](_0x304ad8[_0x11a6('0x29')]);if(_0x304ad8[_0x11a6('0x2a')]){delete _0x304ad8[_0x11a6('0x2a')];}_0x3f87a3[_0x11a6('0x1c')](_0x3ca310)[_0x11a6('0x2b')](_0x304ad8);};}exports[_0x11a6('0x2c')]=function(_0x2d7ab7,_0x1ec7aa){var _0x3827e3={'raw':![],'where':{'id':_0x2d7ab7[_0x11a6('0x2d')]['id']}},_0x56f74d={};_0x56f74d['model']=_[_0x11a6('0x2e')](db[_0x11a6('0x2f')][_0x11a6('0x30')]);_0x56f74d[_0x11a6('0x31')]=_[_0x11a6('0x2e')](_0x2d7ab7['query']);_0x56f74d[_0x11a6('0x32')]=_[_0x11a6('0x33')](_0x56f74d['model'],_0x56f74d['query']);_0x3827e3['attributes']=_[_0x11a6('0x33')](_0x56f74d[_0x11a6('0x34')],qs['fields'](_0x2d7ab7[_0x11a6('0x31')][_0x11a6('0x35')]));_0x3827e3[_0x11a6('0x36')]=_0x3827e3[_0x11a6('0x36')][_0x11a6('0x37')]?_0x3827e3['attributes']:_0x56f74d[_0x11a6('0x34')];if(_0x2d7ab7[_0x11a6('0x31')][_0x11a6('0x38')]){_0x3827e3[_0x11a6('0x39')]=[{'all':!![]}];}_0x3827e3=_[_0x11a6('0x3a')]({},_0x3827e3,_0x2d7ab7[_0x11a6('0x3b')]);return db[_0x11a6('0x2f')][_0x11a6('0x3c')](_0x3827e3)[_0x11a6('0x26')](handleEntityNotFound(_0x1ec7aa,null))[_0x11a6('0x26')](respondWithResult(_0x1ec7aa,null))[_0x11a6('0x3d')](handleError(_0x1ec7aa,null));};exports[_0x11a6('0x25')]=function(_0x1f3062,_0x554164){return db[_0x11a6('0x2f')][_0x11a6('0x3c')]({'where':{'id':_0x1f3062[_0x11a6('0x2d')]['id']}})[_0x11a6('0x26')](handleEntityNotFound(_0x554164,null))[_0x11a6('0x26')](removeEntity(_0x554164,null))[_0x11a6('0x3d')](handleError(_0x554164,null));};function widgetAttributes(_0x3017d4){try{switch(_0x3017d4[_0x11a6('0x3e')]){case _0x11a6('0x3f'):return[{'name':'attrUrl','value':_0x3017d4[_0x11a6('0x40')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x42')]:undefined)||_0x11a6('0x43')}];case'custom':return[{'name':_0x11a6('0x44'),'value':_0x3017d4[_0x11a6('0x44')]||(_0x3017d4['attrs']&&_0x3017d4['attrs'][0x0]?_0x3017d4[_0x11a6('0x41')][0x0]['value']:undefined)||''}];case _0x11a6('0x45'):return[{'name':_0x11a6('0x46'),'value':_0x3017d4['attrHourFormat']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x11a6('0x47'),'value':_0x3017d4[_0x11a6('0x47')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4[_0x11a6('0x41')][0x1][_0x11a6('0x42')]:undefined)||_0x11a6('0x48')},{'name':'attrFontSize','value':_0x3017d4[_0x11a6('0x49')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x2]?_0x3017d4[_0x11a6('0x41')][0x2][_0x11a6('0x42')]:undefined)||0xc}];case'counter':return[{'name':_0x11a6('0x4a'),'value':_0x3017d4[_0x11a6('0x4a')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x0]?_0x3017d4['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x11a6('0x4b'),'value':_0x3017d4['attrVoiceQueues']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3017d4[_0x11a6('0x49')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x2]?_0x3017d4[_0x11a6('0x41')][0x2]['value']:undefined)||0x14},{'name':_0x11a6('0x4c'),'value':_0x3017d4['attrChannel']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x3]?_0x3017d4['attrs'][0x3][_0x11a6('0x42')]:undefined)||'voice'},{'name':_0x11a6('0x4d'),'value':_0x3017d4[_0x11a6('0x4d')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x4]?_0x3017d4['attrs'][0x4][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x4e'),'value':_0x3017d4[_0x11a6('0x4e')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x5]?_0x3017d4[_0x11a6('0x41')][0x5]['value']:undefined)||''},{'name':_0x11a6('0x4f'),'value':_0x3017d4[_0x11a6('0x4f')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x6]?_0x3017d4[_0x11a6('0x41')][0x6][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x50'),'value':_0x3017d4[_0x11a6('0x50')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x7]?_0x3017d4[_0x11a6('0x41')][0x7][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x51'),'value':_0x3017d4[_0x11a6('0x51')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x8]?_0x3017d4[_0x11a6('0x41')][0x8][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x52'),'value':_0x3017d4[_0x11a6('0x52')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x9]?_0x3017d4['attrs'][0x9][_0x11a6('0x42')]:undefined)||''}];case'multibar-chart':case _0x11a6('0x53'):return[{'name':'attrSerie1','value':_0x3017d4[_0x11a6('0x54')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x0]?_0x3017d4[_0x11a6('0x41')][0x0]['value']:undefined)||_0x11a6('0x55')},{'name':_0x11a6('0x56'),'value':_0x3017d4['attrSerie2']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4[_0x11a6('0x41')][0x1][_0x11a6('0x42')]:undefined)||null},{'name':_0x11a6('0x57'),'value':_0x3017d4['attrSerie3']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x2]?_0x3017d4[_0x11a6('0x41')][0x2][_0x11a6('0x42')]:undefined)||null},{'name':_0x11a6('0x4b'),'value':_0x3017d4['attrVoiceQueues']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x3]?_0x3017d4[_0x11a6('0x41')][0x3][_0x11a6('0x42')]:undefined)||[]},{'name':_0x11a6('0x4c'),'value':_0x3017d4[_0x11a6('0x4c')]||(_0x3017d4['attrs']&&_0x3017d4[_0x11a6('0x41')][0x4]?_0x3017d4[_0x11a6('0x41')][0x4][_0x11a6('0x42')]:undefined)||_0x11a6('0x58')},{'name':_0x11a6('0x4d'),'value':_0x3017d4[_0x11a6('0x4d')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x5]?_0x3017d4['attrs'][0x5][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x4e'),'value':_0x3017d4[_0x11a6('0x4e')]||(_0x3017d4['attrs']&&_0x3017d4[_0x11a6('0x41')][0x6]?_0x3017d4[_0x11a6('0x41')][0x6][_0x11a6('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3017d4[_0x11a6('0x4f')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x7]?_0x3017d4[_0x11a6('0x41')][0x7][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x50'),'value':_0x3017d4['attrOpenchannelAccounts']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x8]?_0x3017d4[_0x11a6('0x41')][0x8]['value']:undefined)||''},{'name':_0x11a6('0x51'),'value':_0x3017d4[_0x11a6('0x51')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x9]?_0x3017d4[_0x11a6('0x41')][0x9]['value']:undefined)||''},{'name':_0x11a6('0x52'),'value':_0x3017d4[_0x11a6('0x52')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0xa]?_0x3017d4[_0x11a6('0x41')][0xa][_0x11a6('0x42')]:undefined)||''}];case _0x11a6('0x59'):return[{'name':_0x11a6('0x5a'),'type':_0x3017d4[_0x11a6('0x5b')]||(_0x3017d4['attrs']&&_0x3017d4[_0x11a6('0x41')][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x3e')]:undefined)||null,'value':_0x3017d4[_0x11a6('0x5a')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x42')]:undefined)||null},{'name':_0x11a6('0x5c'),'value':_0x3017d4[_0x11a6('0x5c')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4['attrs'][0x1][_0x11a6('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x3d1bfc){logger[_0x11a6('0x28')]('widgetAttributes:\x20%s',JSON[_0x11a6('0x5d')](_0x3d1bfc));return[];}}exports[_0x11a6('0x5e')]=function(_0x569ea6,_0x479468){if(_0x569ea6['body']){_0x569ea6[_0x11a6('0x5f')][_0x11a6('0x41')]=widgetAttributes(_0x569ea6[_0x11a6('0x5f')]);}return db[_0x11a6('0x2f')][_0x11a6('0x5e')](_0x569ea6[_0x11a6('0x5f')],{})[_0x11a6('0x26')](respondWithResult(_0x479468,0xc9))[_0x11a6('0x3d')](handleError(_0x479468,null));};exports[_0x11a6('0x60')]=function(_0x28119b,_0x50c1f5){if(_0x28119b[_0x11a6('0x5f')]['id']){delete _0x28119b[_0x11a6('0x5f')]['id'];}_0x28119b[_0x11a6('0x5f')]['attrs']=widgetAttributes(_0x28119b[_0x11a6('0x5f')]);return db[_0x11a6('0x2f')][_0x11a6('0x3c')]({'where':{'id':_0x28119b[_0x11a6('0x2d')]['id']}})[_0x11a6('0x26')](handleEntityNotFound(_0x50c1f5,null))[_0x11a6('0x26')](saveUpdates(_0x28119b[_0x11a6('0x5f')],null))[_0x11a6('0x26')](respondWithResult(_0x50c1f5,null))[_0x11a6('0x3d')](handleError(_0x50c1f5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f08a53d..a8dcadf 100644 --- a/server/api/dashboardItem/dashboardItem.events.js +++ b/server/api/dashboardItem/dashboardItem.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe35d=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe35d,0xbe));var _0xde35=function(_0x45c3fe,_0x199c92){_0x45c3fe=_0x45c3fe-0x0;var _0x287dab=_0xe35d[_0x45c3fe];return _0x287dab;};'use strict';var EventEmitter=require(_0xde35('0x0'));var DashboardItem=require(_0xde35('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xde35('0x2')](0x0);var events={'afterCreate':_0xde35('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ae282){return function(_0xab808f,_0x1920f0,_0x452949){DashboardItemEvents[_0xde35('0x4')](_0x4ae282+':'+_0xab808f['id'],_0xab808f);DashboardItemEvents[_0xde35('0x4')](_0x4ae282,_0xab808f);_0x452949(null);};}for(var e in events){if(events[_0xde35('0x5')](e)){var event=events[e];DashboardItem[_0xde35('0x6')](e,emitEvent(event));}}module[_0xde35('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xaed9=['../../mysqldb','DashboardItem','setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0x3047a0,_0x2309b5){var _0x4956d8=function(_0x4fada1){while(--_0x4fada1){_0x3047a0['push'](_0x3047a0['shift']());}};_0x4956d8(++_0x2309b5);}(_0xaed9,0x147));var _0x9aed=function(_0x3aef2c,_0x4215f7){_0x3aef2c=_0x3aef2c-0x0;var _0x14ef7f=_0xaed9[_0x3aef2c];return _0x14ef7f;};'use strict';var EventEmitter=require(_0x9aed('0x0'));var DashboardItem=require(_0x9aed('0x1'))['db'][_0x9aed('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9aed('0x3')](0x0);var events={'afterCreate':_0x9aed('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x6905f5){return function(_0x55bfd1,_0xe03dc,_0x343575){DashboardItemEvents['emit'](_0x6905f5+':'+_0x55bfd1['id'],_0x55bfd1);DashboardItemEvents[_0x9aed('0x5')](_0x6905f5,_0x55bfd1);_0x343575(null);};}for(var e in events){if(events[_0x9aed('0x6')](e)){var event=events[e];DashboardItem[_0x9aed('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 77d509d..c944867 100644 --- a/server/api/dashboardItem/dashboardItem.model.js +++ b/server/api/dashboardItem/dashboardItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe526=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','util','api'];(function(_0xaede4a,_0x44f7d7){var _0x10e86d=function(_0x47ce67){while(--_0x47ce67){_0xaede4a['push'](_0xaede4a['shift']());}};_0x10e86d(++_0x44f7d7);}(_0xe526,0x6c));var _0x6e52=function(_0x36448f,_0xadd5fc){_0x36448f=_0x36448f-0x0;var _0x57e41d=_0xe526[_0x36448f];return _0x57e41d;};'use strict';var _=require('lodash');var util=require(_0x6e52('0x0'));var logger=require('../../config/logger')(_0x6e52('0x1'));var moment=require('moment');var BPromise=require(_0x6e52('0x2'));var rp=require(_0x6e52('0x3'));var fs=require('fs');var path=require(_0x6e52('0x4'));var rimraf=require(_0x6e52('0x5'));var config=require(_0x6e52('0x6'));var attributes=require(_0x6e52('0x7'));module['exports']=function(_0xf6cc3a,_0x652124){return _0xf6cc3a[_0x6e52('0x8')](_0x6e52('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6abe=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','lodash'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6abe,0x9b));var _0xe6ab=function(_0x15f8f1,_0x2deba4){_0x15f8f1=_0x15f8f1-0x0;var _0x37fd7d=_0x6abe[_0x15f8f1];return _0x37fd7d;};'use strict';var _=require(_0xe6ab('0x0'));var util=require(_0xe6ab('0x1'));var logger=require(_0xe6ab('0x2'))(_0xe6ab('0x3'));var moment=require(_0xe6ab('0x4'));var BPromise=require(_0xe6ab('0x5'));var rp=require(_0xe6ab('0x6'));var fs=require('fs');var path=require(_0xe6ab('0x7'));var rimraf=require(_0xe6ab('0x8'));var config=require(_0xe6ab('0x9'));var attributes=require(_0xe6ab('0xa'));module[_0xe6ab('0xb')]=function(_0x35f636,_0x34ce62){return _0x35f636[_0xe6ab('0xc')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 78383a8..a8939e8 100644 --- a/server/api/dashboardItem/dashboardItem.rpc.js +++ b/server/api/dashboardItem/dashboardItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd16=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xaf2363,_0x1b5305){var _0x2ef3f9=function(_0x11b2e8){while(--_0x11b2e8){_0xaf2363['push'](_0xaf2363['shift']());}};_0x2ef3f9(++_0x1b5305);}(_0xbd16,0x161));var _0x6bd1=function(_0x270bc9,_0x542ff0){_0x270bc9=_0x270bc9-0x0;var _0x4cef21=_0xbd16[_0x270bc9];return _0x4cef21;};'use strict';var _=require(_0x6bd1('0x0'));var util=require(_0x6bd1('0x1'));var moment=require(_0x6bd1('0x2'));var BPromise=require(_0x6bd1('0x3'));var rs=require(_0x6bd1('0x4'));var fs=require('fs');var Redis=require(_0x6bd1('0x5'));var db=require(_0x6bd1('0x6'))['db'];var utils=require(_0x6bd1('0x7'));var logger=require(_0x6bd1('0x8'))('rpc');var config=require(_0x6bd1('0x9'));var jayson=require(_0x6bd1('0xa'));var client=jayson[_0x6bd1('0xb')][_0x6bd1('0xc')]({'port':0x232a});config[_0x6bd1('0xd')]=_[_0x6bd1('0xe')](config[_0x6bd1('0xd')],{'host':_0x6bd1('0xf'),'port':0x18eb});var socket=require(_0x6bd1('0x10'))(new Redis(config[_0x6bd1('0xd')]));require(_0x6bd1('0x11'))[_0x6bd1('0x12')](socket);function respondWithRpcPromise(_0x3f15c8,_0x4e5120,_0x1054f6){return new BPromise(function(_0x4c93cc,_0x55de8f){return client['request'](_0x3f15c8,_0x1054f6)['then'](function(_0x49a8b9){logger[_0x6bd1('0x13')](_0x6bd1('0x14'),_0x4e5120,_0x6bd1('0x15'));logger['debug'](_0x6bd1('0x16'),_0x4e5120,_0x6bd1('0x15'),JSON[_0x6bd1('0x17')](_0x49a8b9));if(_0x49a8b9[_0x6bd1('0x18')]){if(_0x49a8b9[_0x6bd1('0x18')][_0x6bd1('0x19')]===0x1f4){logger[_0x6bd1('0x18')]('DashboardItem,\x20%s,\x20%s',_0x4e5120,_0x49a8b9['error'][_0x6bd1('0x1a')]);return _0x55de8f(_0x49a8b9['error'][_0x6bd1('0x1a')]);}logger[_0x6bd1('0x18')](_0x6bd1('0x14'),_0x4e5120,_0x49a8b9['error']['message']);return _0x4c93cc(_0x49a8b9['error']['message']);}else{logger['info'](_0x6bd1('0x14'),_0x4e5120,_0x6bd1('0x15'));_0x4c93cc(_0x49a8b9[_0x6bd1('0x1b')][_0x6bd1('0x1a')]);}})[_0x6bd1('0x1c')](function(_0x1da82d){logger[_0x6bd1('0x18')](_0x6bd1('0x14'),_0x4e5120,_0x1da82d);_0x55de8f(_0x1da82d);});});} \ No newline at end of file +var _0x88d2=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x51c3c0,_0x254aaa){var _0x364b24=function(_0x535fbc){while(--_0x535fbc){_0x51c3c0['push'](_0x51c3c0['shift']());}};_0x364b24(++_0x254aaa);}(_0x88d2,0xbb));var _0x288d=function(_0x1575bc,_0x161fd4){_0x1575bc=_0x1575bc-0x0;var _0x51773c=_0x88d2[_0x1575bc];return _0x51773c;};'use strict';var _=require(_0x288d('0x0'));var util=require(_0x288d('0x1'));var moment=require(_0x288d('0x2'));var BPromise=require(_0x288d('0x3'));var rs=require(_0x288d('0x4'));var fs=require('fs');var Redis=require(_0x288d('0x5'));var db=require(_0x288d('0x6'))['db'];var utils=require(_0x288d('0x7'));var logger=require('../../config/logger')(_0x288d('0x8'));var config=require(_0x288d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x288d('0xa')][_0x288d('0xb')]({'port':0x232a});config[_0x288d('0xc')]=_[_0x288d('0xd')](config[_0x288d('0xc')],{'host':_0x288d('0xe'),'port':0x18eb});var socket=require(_0x288d('0xf'))(new Redis(config[_0x288d('0xc')]));require(_0x288d('0x10'))[_0x288d('0x11')](socket);function respondWithRpcPromise(_0x31014e,_0x33ff46,_0x501d72){return new BPromise(function(_0x38c75c,_0x4ba3cb){return client[_0x288d('0x12')](_0x31014e,_0x501d72)['then'](function(_0x37d4b7){logger['info'](_0x288d('0x13'),_0x33ff46,_0x288d('0x14'));logger['debug'](_0x288d('0x15'),_0x33ff46,'request\x20sent',JSON[_0x288d('0x16')](_0x37d4b7));if(_0x37d4b7[_0x288d('0x17')]){if(_0x37d4b7['error']['code']===0x1f4){logger[_0x288d('0x17')](_0x288d('0x13'),_0x33ff46,_0x37d4b7[_0x288d('0x17')][_0x288d('0x18')]);return _0x4ba3cb(_0x37d4b7['error'][_0x288d('0x18')]);}logger[_0x288d('0x17')](_0x288d('0x13'),_0x33ff46,_0x37d4b7[_0x288d('0x17')][_0x288d('0x18')]);return _0x38c75c(_0x37d4b7['error'][_0x288d('0x18')]);}else{logger[_0x288d('0x19')](_0x288d('0x13'),_0x33ff46,_0x288d('0x14'));_0x38c75c(_0x37d4b7[_0x288d('0x1a')][_0x288d('0x18')]);}})[_0x288d('0x1b')](function(_0x243b03){logger[_0x288d('0x17')](_0x288d('0x13'),_0x33ff46,_0x243b03);_0x4ba3cb(_0x243b03);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6df478c..db54565 100644 --- a/server/api/dashboardItem/dashboardItem.socket.js +++ b/server/api/dashboardItem/dashboardItem.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xded5=['./dashboardItem.events','remove','emit','removeListener','register','length','dashboardItem:'];(function(_0x406d84,_0x117dfd){var _0x2878ea=function(_0x2b9265){while(--_0x2b9265){_0x406d84['push'](_0x406d84['shift']());}};_0x2878ea(++_0x117dfd);}(_0xded5,0x111));var _0x5ded=function(_0xbef038,_0x4ad60f){_0xbef038=_0xbef038-0x0;var _0x477555=_0xded5[_0xbef038];return _0x477555;};'use strict';var DashboardItemEvents=require(_0x5ded('0x0'));var events=['save',_0x5ded('0x1'),'update'];function createListener(_0x3c4ed6,_0x320612){return function(_0x1df3bf){_0x320612[_0x5ded('0x2')](_0x3c4ed6,_0x1df3bf);};}function removeListener(_0x4ac0b7,_0x5660bc){return function(){DashboardItemEvents[_0x5ded('0x3')](_0x4ac0b7,_0x5660bc);};}exports[_0x5ded('0x4')]=function(_0x1a89f5){for(var _0x2321fc=0x0,_0x59341e=events[_0x5ded('0x5')];_0x2321fc<_0x59341e;_0x2321fc++){var _0x3afea6=events[_0x2321fc];var _0xec4e92=createListener(_0x5ded('0x6')+_0x3afea6,_0x1a89f5);DashboardItemEvents['on'](_0x3afea6,_0xec4e92);}}; \ No newline at end of file +var _0xceb9=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x5706fb,_0xacfe3c){var _0x21799d=function(_0x9a813e){while(--_0x9a813e){_0x5706fb['push'](_0x5706fb['shift']());}};_0x21799d(++_0xacfe3c);}(_0xceb9,0x1de));var _0x9ceb=function(_0x2a2b63,_0x59bd37){_0x2a2b63=_0x2a2b63-0x0;var _0x1991ef=_0xceb9[_0x2a2b63];return _0x1991ef;};'use strict';var DashboardItemEvents=require(_0x9ceb('0x0'));var events=[_0x9ceb('0x1'),_0x9ceb('0x2'),_0x9ceb('0x3')];function createListener(_0x4a6cc8,_0xe72e9c){return function(_0x25938b){_0xe72e9c[_0x9ceb('0x4')](_0x4a6cc8,_0x25938b);};}function removeListener(_0x4340c8,_0x54cf52){return function(){DashboardItemEvents['removeListener'](_0x4340c8,_0x54cf52);};}exports['register']=function(_0xafa5ad){for(var _0x40b56f=0x0,_0xe94ebf=events[_0x9ceb('0x5')];_0x40b56f<_0xe94ebf;_0x40b56f++){var _0x4eda42=events[_0x40b56f];var _0x29b8ee=createListener(_0x9ceb('0x6')+_0x4eda42,_0xafa5ad);DashboardItemEvents['on'](_0x4eda42,_0x29b8ee);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ca585a5..2954b3b 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf923=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4e6845,_0x5001f6){var _0x3703e2=function(_0x2ccbd8){while(--_0x2ccbd8){_0x4e6845['push'](_0x4e6845['shift']());}};_0x3703e2(++_0x5001f6);}(_0xf923,0x1ca));var _0x3f92=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xf923[_0x12ca5f];return _0xfc3ae9;};'use strict';var multer=require(_0x3f92('0x0'));var util=require(_0x3f92('0x1'));var path=require('path');var timeout=require(_0x3f92('0x2'));var express=require('express');var router=express[_0x3f92('0x3')]();var fs_extra=require(_0x3f92('0x4'));var auth=require(_0x3f92('0x5'));var interaction=require(_0x3f92('0x6'));var config=require(_0x3f92('0x7'));var controller=require(_0x3f92('0x8'));router['get'](_0x3f92('0x9'),auth[_0x3f92('0xa')](),controller['show']);router[_0x3f92('0xb')]('/',auth[_0x3f92('0xa')](),controller[_0x3f92('0xc')]);router['put'](_0x3f92('0x9'),auth[_0x3f92('0xa')](),controller[_0x3f92('0xd')]);router[_0x3f92('0xe')](_0x3f92('0x9'),auth[_0x3f92('0xa')](),controller['destroy']);module[_0x3f92('0xf')]=router; \ No newline at end of file +var _0x8aec=['/:id','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','create','put'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x8aec,0x158));var _0xc8ae=function(_0x2112c4,_0xfbc1d2){_0x2112c4=_0x2112c4-0x0;var _0x25b856=_0x8aec[_0x2112c4];return _0x25b856;};'use strict';var multer=require(_0xc8ae('0x0'));var util=require(_0xc8ae('0x1'));var path=require(_0xc8ae('0x2'));var timeout=require(_0xc8ae('0x3'));var express=require(_0xc8ae('0x4'));var router=express[_0xc8ae('0x5')]();var fs_extra=require(_0xc8ae('0x6'));var auth=require(_0xc8ae('0x7'));var interaction=require(_0xc8ae('0x8'));var config=require(_0xc8ae('0x9'));var controller=require(_0xc8ae('0xa'));router[_0xc8ae('0xb')]('/:id',auth[_0xc8ae('0xc')](),controller[_0xc8ae('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc8ae('0xe')]);router[_0xc8ae('0xf')](_0xc8ae('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xc8ae('0x11')](_0xc8ae('0x10'),auth[_0xc8ae('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 870260a..929ed7a 100644 --- a/server/api/disposition/disposition.attributes.js +++ b/server/api/disposition/disposition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79da=['ENUM','first','second','third','sequelize','STRING'];(function(_0x2d48ad,_0x4371f6){var _0xbfc58e=function(_0x32ac52){while(--_0x32ac52){_0x2d48ad['push'](_0x2d48ad['shift']());}};_0xbfc58e(++_0x4371f6);}(_0x79da,0xca));var _0xa79d=function(_0x3ba4b5,_0x24d742){_0x3ba4b5=_0x3ba4b5-0x0;var _0x1cbb82=_0x79da[_0x3ba4b5];return _0x1cbb82;};'use strict';var Sequelize=require(_0xa79d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa79d('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xa79d('0x2')](_0xa79d('0x3'),_0xa79d('0x4'),_0xa79d('0x5')),'allowNull':![],'defaultValue':_0xa79d('0x3')},'description':{'type':Sequelize[_0xa79d('0x1')]}}; \ No newline at end of file +var _0xc5fd=['first','second','third','STRING','exports','ENUM'];(function(_0x1b489f,_0xbe7814){var _0x4cdc4e=function(_0x3d8aca){while(--_0x3d8aca){_0x1b489f['push'](_0x1b489f['shift']());}};_0x4cdc4e(++_0xbe7814);}(_0xc5fd,0x76));var _0xdc5f=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0xc5fd[_0x233716];return _0x302298;};'use strict';var Sequelize=require('sequelize');module[_0xdc5f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xdc5f('0x1')](_0xdc5f('0x2'),_0xdc5f('0x3'),_0xdc5f('0x4')),'allowNull':![],'defaultValue':_0xdc5f('0x2')},'description':{'type':Sequelize[_0xdc5f('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index bdc4f33..b0f3574 100644 --- a/server/api/disposition/disposition.controller.js +++ b/server/api/disposition/disposition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb51e=['then','destroy','get','Dispositions','UserProfileResource','error','stack','name','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xb51e,0x12f));var _0xeb51=function(_0x1f9f83,_0x2fc8f2){_0x1f9f83=_0x1f9f83-0x0;var _0x250314=_0xb51e[_0x1f9f83];return _0x250314;};'use strict';var emlformat=require(_0xeb51('0x0'));var rimraf=require(_0xeb51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb51('0x2'));var moment=require(_0xeb51('0x3'));var BPromise=require(_0xeb51('0x4'));var Mustache=require(_0xeb51('0x5'));var util=require(_0xeb51('0x6'));var path=require(_0xeb51('0x7'));var sox=require(_0xeb51('0x8'));var csv=require(_0xeb51('0x9'));var ejs=require(_0xeb51('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb51('0xb'));var squel=require('squel');var crypto=require(_0xeb51('0xc'));var jsforce=require(_0xeb51('0xd'));var deskjs=require(_0xeb51('0xe'));var toCsv=require(_0xeb51('0x9'));var querystring=require(_0xeb51('0xf'));var Papa=require('papaparse');var Redis=require(_0xeb51('0x10'));var authService=require(_0xeb51('0x11'));var qs=require(_0xeb51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb51('0x13'));var logger=require(_0xeb51('0x14'))(_0xeb51('0x15'));var utils=require(_0xeb51('0x16'));var config=require(_0xeb51('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a1f88,_0x9a2332){_0x9a2332=_0x9a2332||0xcc;return function(_0x1b0ae9){if(_0x1b0ae9){return _0x1a1f88[_0xeb51('0x18')](_0x9a2332);}return _0x1a1f88[_0xeb51('0x19')](_0x9a2332)[_0xeb51('0x1a')]();};}function respondWithResult(_0x4375c4,_0x1ca440){_0x1ca440=_0x1ca440||0xc8;return function(_0x292ef2){if(_0x292ef2){return _0x4375c4[_0xeb51('0x19')](_0x1ca440)['json'](_0x292ef2);}};}function respondWithFilteredResult(_0x171e81,_0x2b5aaf){return function(_0x2b0ee2){if(_0x2b0ee2){var _0x1c6748=typeof _0x2b5aaf[_0xeb51('0x1b')]===_0xeb51('0x1c')&&typeof _0x2b5aaf[_0xeb51('0x1d')]===_0xeb51('0x1c');var _0x412a9e=_0x2b0ee2['count'];var _0x335d3a=_0x1c6748?0x0:_0x2b5aaf[_0xeb51('0x1b')];var _0x12ca74=_0x1c6748?_0x2b0ee2[_0xeb51('0x1e')]:_0x2b5aaf[_0xeb51('0x1b')]+_0x2b5aaf['limit'];var _0x4aea0b;if(_0x12ca74>=_0x412a9e){_0x12ca74=_0x412a9e;_0x4aea0b=0xc8;}else{_0x4aea0b=0xce;}_0x171e81['status'](_0x4aea0b);return _0x171e81[_0xeb51('0x1f')](_0xeb51('0x20'),_0x335d3a+'-'+_0x12ca74+'/'+_0x412a9e)[_0xeb51('0x21')](_0x2b0ee2);}return null;};}function patchUpdates(_0x46fa6c){return function(_0x175fa2){try{jsonpatch['apply'](_0x175fa2,_0x46fa6c,!![]);}catch(_0x9981b8){return BPromise[_0xeb51('0x22')](_0x9981b8);}return _0x175fa2[_0xeb51('0x23')]();};}function saveUpdates(_0x159445,_0x268a30){return function(_0xc42047){if(_0xc42047){return _0xc42047[_0xeb51('0x24')](_0x159445)[_0xeb51('0x25')](function(_0x1a7082){return _0x1a7082;});}return null;};}function removeEntity(_0x632163,_0x21993a){return function(_0x534968){if(_0x534968){return _0x534968[_0xeb51('0x26')]()[_0xeb51('0x25')](function(){var _0x4f7451=_0x534968[_0xeb51('0x27')]({'plain':!![]});var _0x2afddd=_0xeb51('0x28');return db[_0xeb51('0x29')][_0xeb51('0x26')]({'where':{'type':_0x2afddd,'resourceId':_0x4f7451['id']}})[_0xeb51('0x25')](function(){return _0x534968;});})[_0xeb51('0x25')](function(){_0x632163[_0xeb51('0x19')](0xcc)[_0xeb51('0x1a')]();});}};}function handleEntityNotFound(_0x554e9d,_0x265d60){return function(_0x404b3c){if(!_0x404b3c){_0x554e9d[_0xeb51('0x18')](0x194);}return _0x404b3c;};}function handleError(_0x3033dd,_0x2555bc){_0x2555bc=_0x2555bc||0x1f4;return function(_0x1c48fc){logger[_0xeb51('0x2a')](_0x1c48fc[_0xeb51('0x2b')]);if(_0x1c48fc[_0xeb51('0x2c')]){delete _0x1c48fc[_0xeb51('0x2c')];}_0x3033dd[_0xeb51('0x19')](_0x2555bc)['send'](_0x1c48fc);};}exports[_0xeb51('0x2d')]=function(_0x3df529,_0x1870ec){var _0x2661f4={},_0x255f7e={},_0xd24f92={'count':0x0,'rows':[]};var _0x264f2e=_[_0xeb51('0x2e')](db[_0xeb51('0x2f')][_0xeb51('0x30')],function(_0xacfb0f){return{'name':_0xacfb0f[_0xeb51('0x31')],'type':_0xacfb0f['type'][_0xeb51('0x32')]};});_0x255f7e[_0xeb51('0x33')]=_[_0xeb51('0x2e')](_0x264f2e,'name');_0x255f7e[_0xeb51('0x34')]=_[_0xeb51('0x35')](_0x3df529[_0xeb51('0x34')]);_0x255f7e['filters']=_[_0xeb51('0x36')](_0x255f7e[_0xeb51('0x33')],_0x255f7e[_0xeb51('0x34')]);_0x2661f4[_0xeb51('0x37')]=_[_0xeb51('0x36')](_0x255f7e[_0xeb51('0x33')],qs[_0xeb51('0x38')](_0x3df529[_0xeb51('0x34')]['fields']));_0x2661f4[_0xeb51('0x37')]=_0x2661f4[_0xeb51('0x37')]['length']?_0x2661f4['attributes']:_0x255f7e[_0xeb51('0x33')];if(!_0x3df529['query'][_0xeb51('0x39')](_0xeb51('0x3a'))){_0x2661f4[_0xeb51('0x1d')]=qs[_0xeb51('0x1d')](_0x3df529[_0xeb51('0x34')][_0xeb51('0x1d')]);_0x2661f4['offset']=qs['offset'](_0x3df529[_0xeb51('0x34')][_0xeb51('0x1b')]);}_0x2661f4[_0xeb51('0x3b')]=qs['sort'](_0x3df529['query'][_0xeb51('0x3c')]);_0x2661f4[_0xeb51('0x3d')]=qs[_0xeb51('0x3e')](_[_0xeb51('0x3f')](_0x3df529[_0xeb51('0x34')],_0x255f7e[_0xeb51('0x3e')]),_0x264f2e);if(_0x3df529[_0xeb51('0x34')][_0xeb51('0x40')]){_0x2661f4[_0xeb51('0x3d')]=_[_0xeb51('0x41')](_0x2661f4['where'],{'$or':_[_0xeb51('0x2e')](_0x264f2e,function(_0x47f747){if(_0x47f747[_0xeb51('0x42')]!==_0xeb51('0x43')){var _0x1645b4={};_0x1645b4[_0x47f747[_0xeb51('0x2c')]]={'$like':'%'+_0x3df529[_0xeb51('0x34')][_0xeb51('0x40')]+'%'};return _0x1645b4;}})});}_0x2661f4=_['merge']({},_0x2661f4,_0x3df529[_0xeb51('0x44')]);var _0x48af37={'where':_0x2661f4[_0xeb51('0x3d')]};return db[_0xeb51('0x2f')][_0xeb51('0x1e')](_0x48af37)[_0xeb51('0x25')](function(_0x22e8a4){_0xd24f92[_0xeb51('0x1e')]=_0x22e8a4;if(_0x3df529['query'][_0xeb51('0x45')]){_0x2661f4[_0xeb51('0x46')]=[{'all':!![]}];}return db[_0xeb51('0x2f')][_0xeb51('0x47')](_0x2661f4);})[_0xeb51('0x25')](function(_0x5d9efb){_0xd24f92[_0xeb51('0x48')]=_0x5d9efb;return _0xd24f92;})[_0xeb51('0x25')](respondWithFilteredResult(_0x1870ec,_0x2661f4))[_0xeb51('0x49')](handleError(_0x1870ec,null));};exports['show']=function(_0x26469d,_0x2be2be){var _0x157648={'raw':!![],'where':{'id':_0x26469d[_0xeb51('0x4a')]['id']}},_0x5ac168={};_0x5ac168['model']=_[_0xeb51('0x35')](db['Disposition'][_0xeb51('0x30')]);_0x5ac168[_0xeb51('0x34')]=_[_0xeb51('0x35')](_0x26469d[_0xeb51('0x34')]);_0x5ac168[_0xeb51('0x3e')]=_[_0xeb51('0x36')](_0x5ac168[_0xeb51('0x33')],_0x5ac168[_0xeb51('0x34')]);_0x157648[_0xeb51('0x37')]=_[_0xeb51('0x36')](_0x5ac168['model'],qs[_0xeb51('0x38')](_0x26469d[_0xeb51('0x34')][_0xeb51('0x38')]));_0x157648[_0xeb51('0x37')]=_0x157648['attributes'][_0xeb51('0x4b')]?_0x157648[_0xeb51('0x37')]:_0x5ac168[_0xeb51('0x33')];if(_0x26469d[_0xeb51('0x34')][_0xeb51('0x45')]){_0x157648[_0xeb51('0x46')]=[{'all':!![]}];}_0x157648=_['merge']({},_0x157648,_0x26469d[_0xeb51('0x44')]);return db[_0xeb51('0x2f')][_0xeb51('0x4c')](_0x157648)[_0xeb51('0x25')](handleEntityNotFound(_0x2be2be,null))['then'](respondWithResult(_0x2be2be,null))[_0xeb51('0x49')](handleError(_0x2be2be,null));};exports[_0xeb51('0x4d')]=function(_0x108dd2,_0x4ef0fe){return db[_0xeb51('0x2f')][_0xeb51('0x4d')](_0x108dd2[_0xeb51('0x4e')],{})[_0xeb51('0x25')](function(_0x2fec06){var _0xd5d1d3=_0x108dd2[_0xeb51('0x4f')]['get']({'plain':!![]});if(!_0xd5d1d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd5d1d3[_0xeb51('0x50')]==='user'){var _0x5d596a=_0x2fec06[_0xeb51('0x27')]({'plain':!![]});var _0x48483b=_0xeb51('0x28');return db[_0xeb51('0x51')][_0xeb51('0x4c')]({'where':{'name':_0x48483b,'userProfileId':_0xd5d1d3[_0xeb51('0x52')]},'raw':!![]})['then'](function(_0x128872){if(_0x128872&&_0x128872[_0xeb51('0x53')]===0x0){return db[_0xeb51('0x29')][_0xeb51('0x4d')]({'name':_0x5d596a['name'],'resourceId':_0x5d596a['id'],'type':_0x128872[_0xeb51('0x2c')],'sectionId':_0x128872['id']},{})[_0xeb51('0x25')](function(){return _0x2fec06;});}else{return _0x2fec06;}})['catch'](function(_0x5a50d7){logger[_0xeb51('0x2a')](_0xeb51('0x54'),_0x5a50d7);throw _0x5a50d7;});}return _0x2fec06;})[_0xeb51('0x25')](respondWithResult(_0x4ef0fe,0xc9))[_0xeb51('0x49')](handleError(_0x4ef0fe,null));};exports['update']=function(_0xb7d1d9,_0x5f1501){if(_0xb7d1d9[_0xeb51('0x4e')]['id']){delete _0xb7d1d9[_0xeb51('0x4e')]['id'];}return db['Disposition'][_0xeb51('0x4c')]({'where':{'id':_0xb7d1d9[_0xeb51('0x4a')]['id']}})[_0xeb51('0x25')](handleEntityNotFound(_0x5f1501,null))[_0xeb51('0x25')](saveUpdates(_0xb7d1d9[_0xeb51('0x4e')],null))[_0xeb51('0x25')](respondWithResult(_0x5f1501,null))[_0xeb51('0x49')](handleError(_0x5f1501,null));};exports['destroy']=function(_0x5f0e0e,_0x3f8865){return db['Disposition'][_0xeb51('0x4c')]({'where':{'id':_0x5f0e0e[_0xeb51('0x4a')]['id']}})[_0xeb51('0x25')](handleEntityNotFound(_0x3f8865,null))[_0xeb51('0x25')](removeEntity(_0x3f8865,null))[_0xeb51('0x49')](handleError(_0x3f8865,null));}; \ No newline at end of file +var _0xf742=['../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','Disposition','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x443f79,_0x33e446){var _0x3847e4=function(_0x42fa01){while(--_0x42fa01){_0x443f79['push'](_0x443f79['shift']());}};_0x3847e4(++_0x33e446);}(_0xf742,0x8c));var _0x2f74=function(_0x2c8a17,_0x1841c4){_0x2c8a17=_0x2c8a17-0x0;var _0x126c37=_0xf742[_0x2c8a17];return _0x126c37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f74('0x0'));var zipdir=require(_0x2f74('0x1'));var jsonpatch=require(_0x2f74('0x2'));var rp=require(_0x2f74('0x3'));var moment=require(_0x2f74('0x4'));var BPromise=require(_0x2f74('0x5'));var Mustache=require(_0x2f74('0x6'));var util=require('util');var path=require(_0x2f74('0x7'));var sox=require(_0x2f74('0x8'));var csv=require(_0x2f74('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2f74('0xa'));var crypto=require(_0x2f74('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2f74('0xc'));var toCsv=require(_0x2f74('0x9'));var querystring=require(_0x2f74('0xd'));var Papa=require(_0x2f74('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2f74('0xf'));var as=require(_0x2f74('0x10'));var hardwareService=require(_0x2f74('0x11'));var logger=require(_0x2f74('0x12'))(_0x2f74('0x13'));var utils=require('../../config/utils');var config=require(_0x2f74('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f74('0x15'))['db'];function respondWithStatusCode(_0x539b52,_0x371015){_0x371015=_0x371015||0xcc;return function(_0x112f29){if(_0x112f29){return _0x539b52[_0x2f74('0x16')](_0x371015);}return _0x539b52[_0x2f74('0x17')](_0x371015)[_0x2f74('0x18')]();};}function respondWithResult(_0x480432,_0x500755){_0x500755=_0x500755||0xc8;return function(_0x23c29d){if(_0x23c29d){return _0x480432[_0x2f74('0x17')](_0x500755)[_0x2f74('0x19')](_0x23c29d);}};}function respondWithFilteredResult(_0x48e412,_0x388e18){return function(_0x4a312b){if(_0x4a312b){var _0x197558=typeof _0x388e18['offset']==='undefined'&&typeof _0x388e18[_0x2f74('0x1a')]===_0x2f74('0x1b');var _0x32caae=_0x4a312b[_0x2f74('0x1c')];var _0x57e137=_0x197558?0x0:_0x388e18[_0x2f74('0x1d')];var _0x1f433a=_0x197558?_0x4a312b['count']:_0x388e18[_0x2f74('0x1d')]+_0x388e18[_0x2f74('0x1a')];var _0x4b6cfd;if(_0x1f433a>=_0x32caae){_0x1f433a=_0x32caae;_0x4b6cfd=0xc8;}else{_0x4b6cfd=0xce;}_0x48e412['status'](_0x4b6cfd);return _0x48e412[_0x2f74('0x1e')](_0x2f74('0x1f'),_0x57e137+'-'+_0x1f433a+'/'+_0x32caae)[_0x2f74('0x19')](_0x4a312b);}return null;};}function patchUpdates(_0x78a653){return function(_0x52f440){try{jsonpatch[_0x2f74('0x20')](_0x52f440,_0x78a653,!![]);}catch(_0x184650){return BPromise[_0x2f74('0x21')](_0x184650);}return _0x52f440['save']();};}function saveUpdates(_0x262a9e,_0x7389fe){return function(_0x447d91){if(_0x447d91){return _0x447d91[_0x2f74('0x22')](_0x262a9e)['then'](function(_0x35489f){return _0x35489f;});}return null;};}function removeEntity(_0x8db489,_0x2b1ad4){return function(_0x112aea){if(_0x112aea){return _0x112aea[_0x2f74('0x23')]()['then'](function(){var _0xd0a5a5=_0x112aea[_0x2f74('0x24')]({'plain':!![]});var _0x4025e9='Dispositions';return db[_0x2f74('0x25')][_0x2f74('0x23')]({'where':{'type':_0x4025e9,'resourceId':_0xd0a5a5['id']}})[_0x2f74('0x26')](function(){return _0x112aea;});})[_0x2f74('0x26')](function(){_0x8db489['status'](0xcc)[_0x2f74('0x18')]();});}};}function handleEntityNotFound(_0x1a299d,_0x25f03b){return function(_0xa54a0c){if(!_0xa54a0c){_0x1a299d[_0x2f74('0x16')](0x194);}return _0xa54a0c;};}function handleError(_0x66c18c,_0x3c760a){_0x3c760a=_0x3c760a||0x1f4;return function(_0x69111){logger[_0x2f74('0x27')](_0x69111[_0x2f74('0x28')]);if(_0x69111[_0x2f74('0x29')]){delete _0x69111[_0x2f74('0x29')];}_0x66c18c[_0x2f74('0x17')](_0x3c760a)['send'](_0x69111);};}exports[_0x2f74('0x2a')]=function(_0x15b885,_0x453674){var _0x1a4e2a={},_0x550179={},_0x26c086={'count':0x0,'rows':[]};var _0x1ed70e=_[_0x2f74('0x2b')](db['Disposition'][_0x2f74('0x2c')],function(_0x5efb54){return{'name':_0x5efb54[_0x2f74('0x2d')],'type':_0x5efb54[_0x2f74('0x2e')][_0x2f74('0x2f')]};});_0x550179[_0x2f74('0x30')]=_[_0x2f74('0x2b')](_0x1ed70e,_0x2f74('0x29'));_0x550179[_0x2f74('0x31')]=_['keys'](_0x15b885[_0x2f74('0x31')]);_0x550179['filters']=_[_0x2f74('0x32')](_0x550179[_0x2f74('0x30')],_0x550179[_0x2f74('0x31')]);_0x1a4e2a[_0x2f74('0x33')]=_[_0x2f74('0x32')](_0x550179[_0x2f74('0x30')],qs[_0x2f74('0x34')](_0x15b885['query'][_0x2f74('0x34')]));_0x1a4e2a['attributes']=_0x1a4e2a[_0x2f74('0x33')][_0x2f74('0x35')]?_0x1a4e2a[_0x2f74('0x33')]:_0x550179[_0x2f74('0x30')];if(!_0x15b885[_0x2f74('0x31')][_0x2f74('0x36')]('nolimit')){_0x1a4e2a['limit']=qs[_0x2f74('0x1a')](_0x15b885['query']['limit']);_0x1a4e2a['offset']=qs[_0x2f74('0x1d')](_0x15b885[_0x2f74('0x31')][_0x2f74('0x1d')]);}_0x1a4e2a[_0x2f74('0x37')]=qs['sort'](_0x15b885[_0x2f74('0x31')][_0x2f74('0x38')]);_0x1a4e2a[_0x2f74('0x39')]=qs['filters'](_['pick'](_0x15b885[_0x2f74('0x31')],_0x550179[_0x2f74('0x3a')]),_0x1ed70e);if(_0x15b885[_0x2f74('0x31')][_0x2f74('0x3b')]){_0x1a4e2a['where']=_[_0x2f74('0x3c')](_0x1a4e2a[_0x2f74('0x39')],{'$or':_[_0x2f74('0x2b')](_0x1ed70e,function(_0x34346d){if(_0x34346d[_0x2f74('0x2e')]!=='VIRTUAL'){var _0x374e5d={};_0x374e5d[_0x34346d[_0x2f74('0x29')]]={'$like':'%'+_0x15b885['query'][_0x2f74('0x3b')]+'%'};return _0x374e5d;}})});}_0x1a4e2a=_[_0x2f74('0x3c')]({},_0x1a4e2a,_0x15b885[_0x2f74('0x3d')]);var _0x109e91={'where':_0x1a4e2a[_0x2f74('0x39')]};return db[_0x2f74('0x3e')][_0x2f74('0x1c')](_0x109e91)[_0x2f74('0x26')](function(_0x279d6f){_0x26c086[_0x2f74('0x1c')]=_0x279d6f;if(_0x15b885[_0x2f74('0x31')][_0x2f74('0x3f')]){_0x1a4e2a[_0x2f74('0x40')]=[{'all':!![]}];}return db[_0x2f74('0x3e')][_0x2f74('0x41')](_0x1a4e2a);})[_0x2f74('0x26')](function(_0x44a508){_0x26c086['rows']=_0x44a508;return _0x26c086;})[_0x2f74('0x26')](respondWithFilteredResult(_0x453674,_0x1a4e2a))[_0x2f74('0x42')](handleError(_0x453674,null));};exports['show']=function(_0x55ec24,_0x108b98){var _0x4a2b6c={'raw':!![],'where':{'id':_0x55ec24[_0x2f74('0x43')]['id']}},_0x54afce={};_0x54afce['model']=_[_0x2f74('0x44')](db[_0x2f74('0x3e')][_0x2f74('0x2c')]);_0x54afce[_0x2f74('0x31')]=_[_0x2f74('0x44')](_0x55ec24[_0x2f74('0x31')]);_0x54afce[_0x2f74('0x3a')]=_[_0x2f74('0x32')](_0x54afce['model'],_0x54afce['query']);_0x4a2b6c[_0x2f74('0x33')]=_[_0x2f74('0x32')](_0x54afce['model'],qs[_0x2f74('0x34')](_0x55ec24[_0x2f74('0x31')][_0x2f74('0x34')]));_0x4a2b6c[_0x2f74('0x33')]=_0x4a2b6c[_0x2f74('0x33')][_0x2f74('0x35')]?_0x4a2b6c[_0x2f74('0x33')]:_0x54afce[_0x2f74('0x30')];if(_0x55ec24[_0x2f74('0x31')][_0x2f74('0x3f')]){_0x4a2b6c[_0x2f74('0x40')]=[{'all':!![]}];}_0x4a2b6c=_['merge']({},_0x4a2b6c,_0x55ec24[_0x2f74('0x3d')]);return db[_0x2f74('0x3e')][_0x2f74('0x45')](_0x4a2b6c)[_0x2f74('0x26')](handleEntityNotFound(_0x108b98,null))['then'](respondWithResult(_0x108b98,null))[_0x2f74('0x42')](handleError(_0x108b98,null));};exports[_0x2f74('0x46')]=function(_0x161591,_0x263705){return db[_0x2f74('0x3e')]['create'](_0x161591[_0x2f74('0x47')],{})['then'](function(_0x3877b2){var _0x398cd8=_0x161591[_0x2f74('0x48')][_0x2f74('0x24')]({'plain':!![]});if(!_0x398cd8)throw new Error(_0x2f74('0x49'));if(_0x398cd8[_0x2f74('0x4a')]===_0x2f74('0x48')){var _0x25ca21=_0x3877b2['get']({'plain':!![]});var _0x45b6e0=_0x2f74('0x4b');return db[_0x2f74('0x4c')][_0x2f74('0x45')]({'where':{'name':_0x45b6e0,'userProfileId':_0x398cd8[_0x2f74('0x4d')]},'raw':!![]})[_0x2f74('0x26')](function(_0x436ef0){if(_0x436ef0&&_0x436ef0[_0x2f74('0x4e')]===0x0){return db[_0x2f74('0x25')]['create']({'name':_0x25ca21[_0x2f74('0x29')],'resourceId':_0x25ca21['id'],'type':_0x436ef0[_0x2f74('0x29')],'sectionId':_0x436ef0['id']},{})[_0x2f74('0x26')](function(){return _0x3877b2;});}else{return _0x3877b2;}})[_0x2f74('0x42')](function(_0x43c6ea){logger[_0x2f74('0x27')](_0x2f74('0x4f'),_0x43c6ea);throw _0x43c6ea;});}return _0x3877b2;})[_0x2f74('0x26')](respondWithResult(_0x263705,0xc9))['catch'](handleError(_0x263705,null));};exports['update']=function(_0x582aee,_0x4ebe58){if(_0x582aee[_0x2f74('0x47')]['id']){delete _0x582aee[_0x2f74('0x47')]['id'];}return db['Disposition'][_0x2f74('0x45')]({'where':{'id':_0x582aee['params']['id']}})['then'](handleEntityNotFound(_0x4ebe58,null))[_0x2f74('0x26')](saveUpdates(_0x582aee['body'],null))[_0x2f74('0x26')](respondWithResult(_0x4ebe58,null))['catch'](handleError(_0x4ebe58,null));};exports[_0x2f74('0x23')]=function(_0x3feaec,_0x3f12e3){return db[_0x2f74('0x3e')]['find']({'where':{'id':_0x3feaec[_0x2f74('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f12e3,null))[_0x2f74('0x26')](removeEntity(_0x3f12e3,null))[_0x2f74('0x42')](handleError(_0x3f12e3,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3055df3..4448a16 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9417=['name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','define','tools_dispositions'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x9417,0x1aa));var _0x7941=function(_0x1d5458,_0x3acf09){_0x1d5458=_0x1d5458-0x0;var _0x9bf6f=_0x9417[_0x1d5458];return _0x9bf6f;};'use strict';var _=require(_0x7941('0x0'));var util=require('util');var logger=require(_0x7941('0x1'))(_0x7941('0x2'));var moment=require(_0x7941('0x3'));var BPromise=require(_0x7941('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7941('0x5'));var rimraf=require(_0x7941('0x6'));var config=require(_0x7941('0x7'));var attributes=require(_0x7941('0x8'));module['exports']=function(_0x47323b,_0x9f45f3){return _0x47323b[_0x7941('0x9')]('Disposition',attributes,{'tableName':_0x7941('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7941('0xb'),'fields':[_0x7941('0xc'),_0x7941('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x7941('0xc'),_0x7941('0xe')]},{'unique':!![],'name':_0x7941('0xf'),'fields':[_0x7941('0xc'),_0x7941('0x10')]},{'unique':!![],'name':_0x7941('0x11'),'fields':[_0x7941('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x7941('0x12'),'fields':[_0x7941('0xc'),_0x7941('0x13')]},{'unique':!![],'name':_0x7941('0x14'),'fields':[_0x7941('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0x7941('0x15'),'fields':['name',_0x7941('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9f5=['name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9f5,0x9f));var _0x5d9f=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xd9f5[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require(_0x5d9f('0x0'));var util=require(_0x5d9f('0x1'));var logger=require(_0x5d9f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5d9f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d9f('0x4'));var rimraf=require(_0x5d9f('0x5'));var config=require(_0x5d9f('0x6'));var attributes=require('./disposition.attributes');module['exports']=function(_0x202369,_0x414a7e){return _0x202369['define']('Disposition',attributes,{'tableName':_0x5d9f('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5d9f('0x8'),'fields':[_0x5d9f('0x9'),_0x5d9f('0xa')]},{'unique':!![],'name':_0x5d9f('0xb'),'fields':[_0x5d9f('0x9'),_0x5d9f('0xc')]},{'unique':!![],'name':_0x5d9f('0xd'),'fields':[_0x5d9f('0x9'),_0x5d9f('0xe')]},{'unique':!![],'name':_0x5d9f('0xf'),'fields':['name',_0x5d9f('0x10')]},{'unique':!![],'name':_0x5d9f('0x11'),'fields':[_0x5d9f('0x9'),_0x5d9f('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x5d9f('0x9'),_0x5d9f('0x13')]},{'unique':!![],'name':_0x5d9f('0x14'),'fields':[_0x5d9f('0x9'),_0x5d9f('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 38e3c00..503b957 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xe52335,_0x3f89f4){var _0x4639fe=function(_0x500f1a){while(--_0x500f1a){_0xe52335['push'](_0xe52335['shift']());}};_0x4639fe(++_0x3f89f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b5a48,_0x59f6e7){var _0x5e6860=function(_0x191466){while(--_0x191466){_0x3b5a48['push'](_0x3b5a48['shift']());}};_0x5e6860(++_0x59f6e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index b3234da..6d39bce 100644 --- a/server/api/disposition/index.js +++ b/server/api/disposition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x384b=['../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xe93e55,_0x48928f){var _0x272452=function(_0x1e56e8){while(--_0x1e56e8){_0xe93e55['push'](_0xe93e55['shift']());}};_0x272452(++_0x48928f);}(_0x384b,0x1d9));var _0xb384=function(_0x145dcd,_0x3ffc02){_0x145dcd=_0x145dcd-0x0;var _0x3b2ad6=_0x384b[_0x145dcd];return _0x3b2ad6;};'use strict';var multer=require(_0xb384('0x0'));var util=require(_0xb384('0x1'));var path=require(_0xb384('0x2'));var timeout=require(_0xb384('0x3'));var express=require(_0xb384('0x4'));var router=express[_0xb384('0x5')]();var fs_extra=require(_0xb384('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb384('0x7'));var config=require(_0xb384('0x8'));var controller=require(_0xb384('0x9'));router[_0xb384('0xa')]('/',auth[_0xb384('0xb')](),controller[_0xb384('0xc')]);router[_0xb384('0xa')](_0xb384('0xd'),auth['isAuthenticated'](),controller[_0xb384('0xe')]);router[_0xb384('0xf')]('/',auth[_0xb384('0xb')](),controller[_0xb384('0x10')]);router['put']('/:id',auth[_0xb384('0xb')](),controller['update']);router[_0xb384('0x11')](_0xb384('0xd'),auth[_0xb384('0xb')](),controller[_0xb384('0x12')]);module[_0xb384('0x13')]=router; \ No newline at end of file +var _0xda24=['isAuthenticated','create','put','update','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','/:id','show','post'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xda24,0x1f4));var _0x4da2=function(_0x680b65,_0x5b2e9c){_0x680b65=_0x680b65-0x0;var _0x1c2053=_0xda24[_0x680b65];return _0x1c2053;};'use strict';var multer=require(_0x4da2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4da2('0x1'));var router=express['Router']();var fs_extra=require(_0x4da2('0x2'));var auth=require(_0x4da2('0x3'));var interaction=require(_0x4da2('0x4'));var config=require(_0x4da2('0x5'));var controller=require(_0x4da2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4da2('0x7'),auth['isAuthenticated'](),controller[_0x4da2('0x8')]);router[_0x4da2('0x9')]('/',auth[_0x4da2('0xa')](),controller[_0x4da2('0xb')]);router[_0x4da2('0xc')]('/:id',auth[_0x4da2('0xa')](),controller[_0x4da2('0xd')]);router[_0x4da2('0xe')](_0x4da2('0x7'),auth[_0x4da2('0xa')](),controller[_0x4da2('0xf')]);module[_0x4da2('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 1e943da..33acddb 100644 --- a/server/api/faxAccount/faxAccount.attributes.js +++ b/server/api/faxAccount/faxAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8014=['INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x8014,0x88));var _0x4801=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x8014[_0x2cfb48];return _0xc4594f;};'use strict';var Sequelize=require('sequelize');module[_0x4801('0x0')]={'name':{'type':Sequelize[_0x4801('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4801('0x1')]},'ecm':{'type':Sequelize[_0x4801('0x2')]('yes','no'),'defaultValue':_0x4801('0x3')},'headerinfo':{'type':Sequelize[_0x4801('0x1')],'defaultValue':_0x4801('0x4')},'localstationid':{'type':Sequelize[_0x4801('0x1')],'unique':_0x4801('0x5')},'minrate':{'type':Sequelize[_0x4801('0x2')](_0x4801('0x6'),_0x4801('0x7'),'7200',_0x4801('0x8'),_0x4801('0x9'),_0x4801('0xa')),'defaultValue':_0x4801('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x4801('0x6'),_0x4801('0x7'),'7200',_0x4801('0x8'),_0x4801('0x9'),_0x4801('0xa')),'defaultValue':_0x4801('0xa')},'modem':{'type':Sequelize[_0x4801('0x1')],'defaultValue':_0x4801('0xb')},'gateway':{'type':Sequelize[_0x4801('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4801('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4801('0x2')](_0x4801('0xc'),_0x4801('0xd'),_0x4801('0xe'),'KHOMP'),'defaultValue':_0x4801('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4801('0xf')],'defaultValue':function(){return _0x4801('0x10');}},'notificationSound':{'type':Sequelize[_0x4801('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4801('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4801('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4801('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4801('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4801('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2da81e){if(!_0x2da81e)this['setDataValue'](_0x4801('0x13'),null);this[_0x4801('0x14')](_0x4801('0x15'),_0x2da81e);}}}; \ No newline at end of file +var _0xeb78=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','7200','9600','12000','14400','4800','2400','v17,v27,v29','INTEGER','SIP','DADHI','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x47f23d,_0x567e66){var _0x4e08f9=function(_0x296189){while(--_0x296189){_0x47f23d['push'](_0x47f23d['shift']());}};_0x4e08f9(++_0x567e66);}(_0xeb78,0x112));var _0x8eb7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb78[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8eb7('0x0'));module[_0x8eb7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eb7('0x2')]},'ecm':{'type':Sequelize[_0x8eb7('0x3')](_0x8eb7('0x4'),'no'),'defaultValue':_0x8eb7('0x4')},'headerinfo':{'type':Sequelize[_0x8eb7('0x2')],'defaultValue':_0x8eb7('0x5')},'localstationid':{'type':Sequelize[_0x8eb7('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400','4800',_0x8eb7('0x6'),_0x8eb7('0x7'),_0x8eb7('0x8'),_0x8eb7('0x9')),'defaultValue':_0x8eb7('0xa')},'maxrate':{'type':Sequelize[_0x8eb7('0x3')](_0x8eb7('0xb'),'4800','7200',_0x8eb7('0x7'),'12000','14400'),'defaultValue':_0x8eb7('0x9')},'modem':{'type':Sequelize[_0x8eb7('0x2')],'defaultValue':_0x8eb7('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8eb7('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8eb7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8eb7('0x3')](_0x8eb7('0xe'),'IAX',_0x8eb7('0xf'),'KHOMP'),'defaultValue':_0x8eb7('0xe')},'key':{'type':Sequelize[_0x8eb7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8eb7('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8eb7('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8eb7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8eb7('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8eb7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8eb7('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8eb7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8eb7('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x8eb7('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8eb7('0x11')],'defaultValue':![],'comment':_0x8eb7('0x13'),'set':function(_0x1d92e7){if(!_0x1d92e7)this['setDataValue'](_0x8eb7('0x14'),null);this[_0x8eb7('0x15')](_0x8eb7('0x16'),_0x1d92e7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index fc5f4fd..91f26f9 100644 --- a/server/api/faxAccount/faxAccount.controller.js +++ b/server/api/faxAccount/faxAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d85=['t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','from','List\x20not\x20found','out','Contact\x20not\x20found','spread','filename','ContactId','dataValues','Messages','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','name','index','Pause','mandatoryDispositionPause','map','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','FaxAccount','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','getDispositions','findOne','length','pick','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','addInteraction','omit','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','FaxInteraction','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','stack','finally','send','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','maxrate','minrate'];(function(_0x475923,_0x25d9ec){var _0x374030=function(_0x3f256b){while(--_0x3f256b){_0x475923['push'](_0x475923['shift']());}};_0x374030(++_0x25d9ec);}(_0x2d85,0x1b7));var _0x52d8=function(_0x4271e5,_0x451a56){_0x4271e5=_0x4271e5-0x0;var _0x4e0a53=_0x2d85[_0x4271e5];return _0x4e0a53;};'use strict';var emlformat=require(_0x52d8('0x0'));var rimraf=require(_0x52d8('0x1'));var zipdir=require(_0x52d8('0x2'));var jsonpatch=require(_0x52d8('0x3'));var rp=require(_0x52d8('0x4'));var moment=require(_0x52d8('0x5'));var BPromise=require(_0x52d8('0x6'));var Mustache=require(_0x52d8('0x7'));var util=require(_0x52d8('0x8'));var path=require(_0x52d8('0x9'));var sox=require(_0x52d8('0xa'));var csv=require(_0x52d8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52d8('0xc'));var _=require('lodash');var squel=require(_0x52d8('0xd'));var crypto=require('crypto');var jsforce=require(_0x52d8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x52d8('0xf'));var Papa=require(_0x52d8('0x10'));var Redis=require(_0x52d8('0x11'));var authService=require(_0x52d8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x52d8('0x13'));var hardwareService=require(_0x52d8('0x14'));var logger=require(_0x52d8('0x15'))(_0x52d8('0x16'));var utils=require(_0x52d8('0x17'));var config=require(_0x52d8('0x18'));var licenseUtil=require(_0x52d8('0x19'));var db=require(_0x52d8('0x1a'))['db'];config[_0x52d8('0x1b')]=_['defaults'](config[_0x52d8('0x1b')],{'host':_0x52d8('0x1c'),'port':0x18eb});var socket=require(_0x52d8('0x1d'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x52d8('0x1e')](socket);var jayson=require(_0x52d8('0x1f'));var client=jayson[_0x52d8('0x20')][_0x52d8('0x21')]({'port':0x232c});var client9002=jayson[_0x52d8('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11bcca,_0x5858a9,_0x86622c,_0x6a4a9d){return new BPromise(function(_0x30997e,_0xb43153){var _0xc4cf65=_0x6a4a9d||client;return _0xc4cf65[_0x52d8('0x22')](_0x11bcca,_0x86622c)[_0x52d8('0x23')](function(_0x254650){logger[_0x52d8('0x24')](_0x52d8('0x25'),_0x5858a9,'request\x20sent');logger['debug'](_0x52d8('0x26'),_0x5858a9,_0x52d8('0x27'),JSON[_0x52d8('0x28')](_0x254650));if(_0x254650[_0x52d8('0x29')]){if(_0x254650[_0x52d8('0x29')][_0x52d8('0x2a')]===0x1f4){logger[_0x52d8('0x29')](_0x52d8('0x25'),_0x5858a9,_0x254650['error'][_0x52d8('0x2b')]);return _0xb43153(_0x254650[_0x52d8('0x29')]['message']);}logger[_0x52d8('0x29')]('FaxAccount,\x20%s,\x20%s',_0x5858a9,_0x254650[_0x52d8('0x29')][_0x52d8('0x2b')]);return _0x30997e(_0x254650[_0x52d8('0x29')][_0x52d8('0x2b')]);}else{logger['info'](_0x52d8('0x25'),_0x5858a9,_0x52d8('0x27'));_0x30997e(_0x254650['result'][_0x52d8('0x2b')]);}})['catch'](function(_0x2c7ef7){logger['error'](_0x52d8('0x25'),_0x5858a9,_0x2c7ef7);_0xb43153(_0x2c7ef7);});});}function respondWithStatusCode(_0x4ab086,_0x2f1b31){_0x2f1b31=_0x2f1b31||0xcc;return function(_0x1811fb){if(_0x1811fb){return _0x4ab086[_0x52d8('0x2c')](_0x2f1b31);}return _0x4ab086['status'](_0x2f1b31)[_0x52d8('0x2d')]();};}function respondWithResult(_0x2061aa,_0x15ee9f){_0x15ee9f=_0x15ee9f||0xc8;return function(_0x94d64d){if(_0x94d64d){return _0x2061aa[_0x52d8('0x2e')](_0x15ee9f)[_0x52d8('0x2f')](_0x94d64d);}};}function respondWithFilteredResult(_0x4cdfe6,_0xb0813d){return function(_0x6cb403){if(_0x6cb403){var _0x282571=typeof _0xb0813d[_0x52d8('0x30')]===_0x52d8('0x31')&&typeof _0xb0813d[_0x52d8('0x32')]==='undefined';var _0x503783=_0x6cb403['count'];var _0x5add3d=_0x282571?0x0:_0xb0813d[_0x52d8('0x30')];var _0x1b6a0a=_0x282571?_0x6cb403['count']:_0xb0813d['offset']+_0xb0813d[_0x52d8('0x32')];var _0x541738;if(_0x1b6a0a>=_0x503783){_0x1b6a0a=_0x503783;_0x541738=0xc8;}else{_0x541738=0xce;}_0x4cdfe6[_0x52d8('0x2e')](_0x541738);return _0x4cdfe6[_0x52d8('0x33')](_0x52d8('0x34'),_0x5add3d+'-'+_0x1b6a0a+'/'+_0x503783)[_0x52d8('0x2f')](_0x6cb403);}return null;};}function patchUpdates(_0x12bba7){return function(_0x2d918f){try{jsonpatch['apply'](_0x2d918f,_0x12bba7,!![]);}catch(_0x2fb55d){return BPromise[_0x52d8('0x35')](_0x2fb55d);}return _0x2d918f[_0x52d8('0x36')]();};}function saveUpdates(_0xdc4311,_0x1ee280){return function(_0x13508f){if(_0x13508f){return _0x13508f[_0x52d8('0x37')](_0xdc4311)['then'](function(_0x4c209d){return _0x4c209d;});}return null;};}function removeEntity(_0x201d2d,_0x13a98d){return function(_0x57e798){if(_0x57e798){return _0x57e798[_0x52d8('0x38')]()[_0x52d8('0x23')](function(){var _0x59ad84=_0x57e798[_0x52d8('0x39')]({'plain':!![]});var _0x5c49c2=_0x52d8('0x3a');return db['UserProfileResource'][_0x52d8('0x38')]({'where':{'type':_0x5c49c2,'resourceId':_0x59ad84['id']}})[_0x52d8('0x23')](function(){return _0x57e798;});})[_0x52d8('0x23')](function(){_0x201d2d[_0x52d8('0x2e')](0xcc)[_0x52d8('0x2d')]();});}};}function handleEntityNotFound(_0x1c0f99,_0x21d091){return function(_0x3b86f8){if(!_0x3b86f8){_0x1c0f99[_0x52d8('0x2c')](0x194);}return _0x3b86f8;};}function handleError(_0x2508d3,_0x1a2b6a){_0x1a2b6a=_0x1a2b6a||0x1f4;return function(_0x351a03){logger['error'](_0x351a03['stack']);if(_0x351a03[_0x52d8('0x3b')]){delete _0x351a03[_0x52d8('0x3b')];}_0x2508d3['status'](_0x1a2b6a)['send'](_0x351a03);};}exports[_0x52d8('0x3c')]=function(_0x50f173,_0x76a17){var _0x1d7383={'include':[{'model':db[_0x52d8('0x3d')],'as':_0x52d8('0x3e')}]},_0x465334={},_0x3737c1={'count':0x0,'rows':[]};var _0x45fa56=_[_0x52d8('0x3f')](db['FaxAccount']['rawAttributes'],function(_0x2d9468){return{'name':_0x2d9468['fieldName'],'type':_0x2d9468[_0x52d8('0x40')][_0x52d8('0x41')]};});_0x465334['model']=_[_0x52d8('0x3f')](_0x45fa56,'name');_0x465334['query']=_[_0x52d8('0x42')](_0x50f173[_0x52d8('0x43')]);_0x465334[_0x52d8('0x44')]=_[_0x52d8('0x45')](_0x465334[_0x52d8('0x46')],_0x465334['query']);_0x1d7383[_0x52d8('0x47')]=_[_0x52d8('0x45')](_0x465334['model'],qs['fields'](_0x50f173[_0x52d8('0x43')][_0x52d8('0x48')]));_0x1d7383[_0x52d8('0x47')]=_0x1d7383['attributes']['length']?_0x1d7383[_0x52d8('0x47')]:_0x465334['model'];if(!_0x50f173[_0x52d8('0x43')][_0x52d8('0x49')](_0x52d8('0x4a'))){_0x1d7383[_0x52d8('0x32')]=qs[_0x52d8('0x32')](_0x50f173[_0x52d8('0x43')][_0x52d8('0x32')]);_0x1d7383[_0x52d8('0x30')]=qs['offset'](_0x50f173['query'][_0x52d8('0x30')]);}_0x1d7383[_0x52d8('0x4b')]=qs[_0x52d8('0x4c')](_0x50f173[_0x52d8('0x43')][_0x52d8('0x4c')]);_0x1d7383[_0x52d8('0x4d')]=qs[_0x52d8('0x44')](_['pick'](_0x50f173[_0x52d8('0x43')],_0x465334[_0x52d8('0x44')]),_0x45fa56);if(_0x50f173[_0x52d8('0x43')][_0x52d8('0x4e')]){_0x1d7383[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x1d7383[_0x52d8('0x4d')],{'$or':_[_0x52d8('0x3f')](_0x45fa56,function(_0x1cd449){if(_0x1cd449[_0x52d8('0x40')]!=='VIRTUAL'){var _0x1b826c={};_0x1b826c[_0x1cd449['name']]={'$like':'%'+_0x50f173['query']['filter']+'%'};return _0x1b826c;}})});}_0x1d7383=_[_0x52d8('0x4f')]({},_0x1d7383,_0x50f173[_0x52d8('0x50')]);var _0x1087fd={'where':_0x1d7383[_0x52d8('0x4d')]};return db['FaxAccount'][_0x52d8('0x51')](_0x1087fd)[_0x52d8('0x23')](function(_0x4afbca){_0x3737c1['count']=_0x4afbca;if(_0x50f173[_0x52d8('0x43')][_0x52d8('0x52')]){_0x1d7383['include']=[{'all':!![]}];}return db[_0x52d8('0x53')]['findAll'](_0x1d7383);})['then'](function(_0x190949){_0x3737c1[_0x52d8('0x54')]=_0x190949;return _0x3737c1;})[_0x52d8('0x23')](respondWithFilteredResult(_0x76a17,_0x1d7383))[_0x52d8('0x55')](handleError(_0x76a17,null));};exports[_0x52d8('0x56')]=function(_0x464103,_0x5c52a9){var _0x3626b3={'raw':![],'where':{'id':_0x464103['params']['id']},'include':[{'model':db[_0x52d8('0x3d')],'as':_0x52d8('0x3e')}]},_0xbfea3e={};_0xbfea3e['model']=_[_0x52d8('0x42')](db[_0x52d8('0x53')][_0x52d8('0x57')]);_0xbfea3e[_0x52d8('0x43')]=_[_0x52d8('0x42')](_0x464103['query']);_0xbfea3e[_0x52d8('0x44')]=_['intersection'](_0xbfea3e[_0x52d8('0x46')],_0xbfea3e[_0x52d8('0x43')]);_0x3626b3['attributes']=_[_0x52d8('0x45')](_0xbfea3e['model'],qs[_0x52d8('0x48')](_0x464103[_0x52d8('0x43')][_0x52d8('0x48')]));_0x3626b3[_0x52d8('0x47')]=_0x3626b3[_0x52d8('0x47')]['length']?_0x3626b3[_0x52d8('0x47')]:_0xbfea3e[_0x52d8('0x46')];if(_0x464103[_0x52d8('0x43')][_0x52d8('0x52')]){_0x3626b3['include']=[{'all':!![]}];}_0x3626b3=_['merge']({},_0x3626b3,_0x464103[_0x52d8('0x50')]);return db['FaxAccount'][_0x52d8('0x58')](_0x3626b3)[_0x52d8('0x23')](handleEntityNotFound(_0x5c52a9,null))[_0x52d8('0x23')](respondWithResult(_0x5c52a9,null))['catch'](handleError(_0x5c52a9,null));};exports[_0x52d8('0x59')]=function(_0x44a260,_0x12e418){return db[_0x52d8('0x53')][_0x52d8('0x59')](_0x44a260[_0x52d8('0x5a')],{})[_0x52d8('0x23')](function(_0x4d41d1){var _0x502d6e=_0x44a260[_0x52d8('0x5b')][_0x52d8('0x39')]({'plain':!![]});if(!_0x502d6e)throw new Error(_0x52d8('0x5c'));if(_0x502d6e['role']===_0x52d8('0x5b')){var _0x4afdbf=_0x4d41d1[_0x52d8('0x39')]({'plain':!![]});var _0x5d39b8=_0x52d8('0x3a');return db[_0x52d8('0x5d')][_0x52d8('0x58')]({'where':{'name':_0x5d39b8,'userProfileId':_0x502d6e[_0x52d8('0x5e')]},'raw':!![]})[_0x52d8('0x23')](function(_0x4eee21){if(_0x4eee21&&_0x4eee21['autoAssociation']===0x0){return db[_0x52d8('0x5f')][_0x52d8('0x59')]({'name':_0x4afdbf[_0x52d8('0x3b')],'resourceId':_0x4afdbf['id'],'type':_0x4eee21[_0x52d8('0x3b')],'sectionId':_0x4eee21['id']},{})[_0x52d8('0x23')](function(){return _0x4d41d1;});}else{return _0x4d41d1;}})[_0x52d8('0x55')](function(_0x13115d){logger[_0x52d8('0x29')](_0x52d8('0x60'),_0x13115d);throw _0x13115d;});}return _0x4d41d1;})[_0x52d8('0x23')](respondWithResult(_0x12e418,0xc9))['catch'](handleError(_0x12e418,null));};exports[_0x52d8('0x37')]=function(_0x16923f,_0x40ba86){if(_0x16923f[_0x52d8('0x5a')]['id']){delete _0x16923f['body']['id'];}return db[_0x52d8('0x53')]['find']({'where':{'id':_0x16923f[_0x52d8('0x61')]['id']},'include':[{'model':db[_0x52d8('0x3d')],'as':_0x52d8('0x3e')}]})[_0x52d8('0x23')](handleEntityNotFound(_0x40ba86,null))[_0x52d8('0x23')](saveUpdates(_0x16923f[_0x52d8('0x5a')],null))[_0x52d8('0x23')](respondWithResult(_0x40ba86,null))['catch'](handleError(_0x40ba86,null));};exports[_0x52d8('0x38')]=function(_0xf271bd,_0x3411f8){return db[_0x52d8('0x53')][_0x52d8('0x58')]({'where':{'id':_0xf271bd[_0x52d8('0x61')]['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x3411f8,null))[_0x52d8('0x23')](removeEntity(_0x3411f8,null))[_0x52d8('0x55')](handleError(_0x3411f8,null));};exports[_0x52d8('0x62')]=function(_0x5ef0a5,_0x58b22a){return db['FaxAccount'][_0x52d8('0x62')]()[_0x52d8('0x23')](respondWithResult(_0x58b22a,null))[_0x52d8('0x55')](handleError(_0x58b22a,null));};exports[_0x52d8('0x63')]=function(_0x4cf166,_0x506599,_0x7e3312){if(_0x4cf166[_0x52d8('0x5a')]['id']){delete _0x4cf166[_0x52d8('0x5a')]['id'];}return db[_0x52d8('0x53')]['find']({'where':{'id':_0x4cf166['params']['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x506599,null))['then'](function(_0x2ee7c7){if(_0x2ee7c7){_0x4cf166[_0x52d8('0x5a')][_0x52d8('0x64')]=_0x2ee7c7['id'];return db['Disposition'][_0x52d8('0x59')](_0x4cf166[_0x52d8('0x5a')]);}})[_0x52d8('0x23')](respondWithResult(_0x506599,null))[_0x52d8('0x55')](handleError(_0x506599,null));};exports[_0x52d8('0x65')]=function(_0x2ed9e4,_0x53ca23,_0xef94ff){var _0x194108={'raw':![],'where':{}};var _0x1f6052={};var _0x3dfd92={'count':0x0,'rows':[]};return db[_0x52d8('0x53')][_0x52d8('0x66')]({'where':{'id':_0x2ed9e4[_0x52d8('0x61')]['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x53ca23,null))['then'](function(_0x2d7c95){if(_0x2d7c95){_0x1f6052[_0x52d8('0x46')]=_[_0x52d8('0x42')](db['Disposition'][_0x52d8('0x57')]);_0x1f6052['query']=_[_0x52d8('0x42')](_0x2ed9e4[_0x52d8('0x43')]);_0x1f6052['filters']=_[_0x52d8('0x45')](_0x1f6052['model'],_0x1f6052['query']);_0x194108['attributes']=_[_0x52d8('0x45')](_0x1f6052[_0x52d8('0x46')],qs[_0x52d8('0x48')](_0x2ed9e4[_0x52d8('0x43')][_0x52d8('0x48')]));_0x194108[_0x52d8('0x47')]=_0x194108[_0x52d8('0x47')][_0x52d8('0x67')]?_0x194108[_0x52d8('0x47')]:_0x1f6052[_0x52d8('0x46')];if(!_0x2ed9e4[_0x52d8('0x43')]['hasOwnProperty'](_0x52d8('0x4a'))){_0x194108[_0x52d8('0x32')]=qs['limit'](_0x2ed9e4[_0x52d8('0x43')]['limit']);_0x194108[_0x52d8('0x30')]=qs[_0x52d8('0x30')](_0x2ed9e4['query'][_0x52d8('0x30')]);}_0x194108[_0x52d8('0x4b')]=qs[_0x52d8('0x4c')](_0x2ed9e4[_0x52d8('0x43')]['sort']);_0x194108[_0x52d8('0x4d')]=qs[_0x52d8('0x44')](_[_0x52d8('0x68')](_0x2ed9e4[_0x52d8('0x43')],_0x1f6052[_0x52d8('0x44')]));_0x194108[_0x52d8('0x4d')][_0x52d8('0x64')]=_0x2d7c95['id'];if(_0x2ed9e4[_0x52d8('0x43')]['filter']){_0x194108[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x194108['where'],{'$or':_['map'](_0x194108['attributes'],function(_0x3bf4ca){var _0x14050e={};_0x14050e[_0x3bf4ca]={'$like':'%'+_0x2ed9e4[_0x52d8('0x43')][_0x52d8('0x4e')]+'%'};return _0x14050e;})});}_0x194108=_[_0x52d8('0x4f')]({},_0x194108,_0x2ed9e4[_0x52d8('0x50')]);return db[_0x52d8('0x69')][_0x52d8('0x51')]({'where':_0x194108[_0x52d8('0x4d')]})[_0x52d8('0x23')](function(_0x28649f){_0x3dfd92[_0x52d8('0x51')]=_0x28649f;if(_0x2ed9e4[_0x52d8('0x43')][_0x52d8('0x52')]){_0x194108['include']=[{'all':!![]}];}return db[_0x52d8('0x69')][_0x52d8('0x6a')](_0x194108);})[_0x52d8('0x23')](function(_0x53a5e7){_0x3dfd92[_0x52d8('0x54')]=_0x53a5e7;return _0x3dfd92;});}})[_0x52d8('0x23')](respondWithFilteredResult(_0x53ca23,_0x194108))['catch'](handleError(_0x53ca23,null));};exports[_0x52d8('0x6b')]=function(_0x53a723,_0xdc6a25,_0x339982){return db[_0x52d8('0x53')]['find']({'where':{'id':_0x53a723['params']['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0xdc6a25,null))[_0x52d8('0x23')](function(_0x7ca483){if(_0x7ca483){return _0x7ca483[_0x52d8('0x6b')](_0x53a723[_0x52d8('0x43')][_0x52d8('0x6c')]);}})['then'](respondWithStatusCode(_0xdc6a25,null))[_0x52d8('0x55')](handleError(_0xdc6a25,null));};exports[_0x52d8('0x6d')]=function(_0xea8bc7,_0x5dfcba,_0x5d560c){if(_0xea8bc7[_0x52d8('0x5a')]['id']){delete _0xea8bc7[_0x52d8('0x5a')]['id'];}return db[_0x52d8('0x53')][_0x52d8('0x58')]({'where':{'id':_0xea8bc7['params']['id']}})['then'](handleEntityNotFound(_0x5dfcba,null))[_0x52d8('0x23')](function(_0x2c861d){if(_0x2c861d){_0xea8bc7['body'][_0x52d8('0x64')]=_0x2c861d['id'];return db[_0x52d8('0x6e')]['create'](_0xea8bc7[_0x52d8('0x5a')]);}})[_0x52d8('0x23')](respondWithResult(_0x5dfcba,null))[_0x52d8('0x55')](handleError(_0x5dfcba,null));};exports[_0x52d8('0x6f')]=function(_0x1682fe,_0x1d1290,_0xde9db6){var _0x8b4580={'raw':![],'where':{}};var _0x10381f={};var _0x45cd77={'count':0x0,'rows':[]};return db[_0x52d8('0x53')][_0x52d8('0x66')]({'where':{'id':_0x1682fe[_0x52d8('0x61')]['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x1d1290,null))[_0x52d8('0x23')](function(_0x217b0e){if(_0x217b0e){_0x10381f[_0x52d8('0x46')]=_[_0x52d8('0x42')](db['CannedAnswer'][_0x52d8('0x57')]);_0x10381f[_0x52d8('0x43')]=_[_0x52d8('0x42')](_0x1682fe[_0x52d8('0x43')]);_0x10381f[_0x52d8('0x44')]=_['intersection'](_0x10381f[_0x52d8('0x46')],_0x10381f[_0x52d8('0x43')]);_0x8b4580[_0x52d8('0x47')]=_[_0x52d8('0x45')](_0x10381f['model'],qs[_0x52d8('0x48')](_0x1682fe[_0x52d8('0x43')][_0x52d8('0x48')]));_0x8b4580[_0x52d8('0x47')]=_0x8b4580[_0x52d8('0x47')][_0x52d8('0x67')]?_0x8b4580[_0x52d8('0x47')]:_0x10381f['model'];if(!_0x1682fe['query'][_0x52d8('0x49')](_0x52d8('0x4a'))){_0x8b4580[_0x52d8('0x32')]=qs[_0x52d8('0x32')](_0x1682fe[_0x52d8('0x43')][_0x52d8('0x32')]);_0x8b4580[_0x52d8('0x30')]=qs['offset'](_0x1682fe[_0x52d8('0x43')]['offset']);}_0x8b4580[_0x52d8('0x4b')]=qs['sort'](_0x1682fe[_0x52d8('0x43')][_0x52d8('0x4c')]);_0x8b4580[_0x52d8('0x4d')]=qs[_0x52d8('0x44')](_[_0x52d8('0x68')](_0x1682fe[_0x52d8('0x43')],_0x10381f[_0x52d8('0x44')]));_0x8b4580[_0x52d8('0x4d')][_0x52d8('0x64')]=_0x217b0e['id'];if(_0x1682fe[_0x52d8('0x43')][_0x52d8('0x4e')]){_0x8b4580[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x8b4580[_0x52d8('0x4d')],{'$or':_[_0x52d8('0x3f')](_0x8b4580[_0x52d8('0x47')],function(_0x59e228){var _0x391758={};_0x391758[_0x59e228]={'$like':'%'+_0x1682fe['query'][_0x52d8('0x4e')]+'%'};return _0x391758;})});}_0x8b4580=_[_0x52d8('0x4f')]({},_0x8b4580,_0x1682fe[_0x52d8('0x50')]);return db['CannedAnswer'][_0x52d8('0x51')]({'where':_0x8b4580[_0x52d8('0x4d')]})['then'](function(_0x3e0f80){_0x45cd77[_0x52d8('0x51')]=_0x3e0f80;if(_0x1682fe['query'][_0x52d8('0x52')]){_0x8b4580[_0x52d8('0x70')]=[{'all':!![]}];}return db[_0x52d8('0x6e')][_0x52d8('0x6a')](_0x8b4580);})[_0x52d8('0x23')](function(_0x3c3e9e){_0x45cd77['rows']=_0x3c3e9e;return _0x45cd77;});}})['then'](respondWithFilteredResult(_0x1d1290,_0x8b4580))[_0x52d8('0x55')](handleError(_0x1d1290,null));};exports[_0x52d8('0x71')]=function(_0x20adf2,_0x1adce0,_0x4f42af){return db[_0x52d8('0x53')]['find']({'where':{'id':_0x20adf2[_0x52d8('0x61')]['id']}})['then'](handleEntityNotFound(_0x1adce0,null))[_0x52d8('0x23')](function(_0x2fb5db){if(_0x2fb5db){return _0x2fb5db['removeAnswers'](_0x20adf2[_0x52d8('0x43')][_0x52d8('0x6c')]);}})[_0x52d8('0x23')](respondWithStatusCode(_0x1adce0,null))[_0x52d8('0x55')](handleError(_0x1adce0,null));};exports['addInteraction']=function(_0x1410a9,_0x199a5f,_0x40e3b6){return db['FaxInteraction']['find']({'where':{'id':_0x1410a9[_0x52d8('0x61')]['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x199a5f,null))['then'](function(_0x2aa10c){if(_0x2aa10c){return _0x2aa10c[_0x52d8('0x72')](_0x1410a9[_0x52d8('0x5a')]['ids'],_[_0x52d8('0x73')](_0x1410a9[_0x52d8('0x5a')],[_0x52d8('0x6c'),'id'])||{});}})[_0x52d8('0x23')](respondWithResult(_0x199a5f,null))[_0x52d8('0x55')](handleError(_0x199a5f,null));};exports['getInteractions']=function(_0xd693e7,_0x1df228,_0x309b98){var _0x5e3e2f={'raw':![],'where':{}};var _0x4646ee={};var _0x404e30={'count':0x0,'rows':[]};return db[_0x52d8('0x53')][_0x52d8('0x66')]({'where':{'id':_0xd693e7[_0x52d8('0x61')]['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x1df228,null))[_0x52d8('0x23')](function(_0x4c6b19){if(_0x4c6b19){_0x4646ee[_0x52d8('0x46')]=_['keys'](db['FaxInteraction'][_0x52d8('0x57')]);_0x4646ee[_0x52d8('0x43')]=_[_0x52d8('0x42')](_0xd693e7[_0x52d8('0x43')]);_0x4646ee[_0x52d8('0x44')]=_[_0x52d8('0x45')](_0x4646ee['model'],_0x4646ee[_0x52d8('0x43')]);_0x5e3e2f[_0x52d8('0x47')]=_[_0x52d8('0x45')](_0x4646ee[_0x52d8('0x46')],qs[_0x52d8('0x48')](_0xd693e7['query'][_0x52d8('0x48')]));_0x5e3e2f['attributes']=_0x5e3e2f[_0x52d8('0x47')][_0x52d8('0x67')]?_0x5e3e2f[_0x52d8('0x47')]:_0x4646ee[_0x52d8('0x46')];if(!_0xd693e7[_0x52d8('0x43')][_0x52d8('0x49')](_0x52d8('0x4a'))){_0x5e3e2f[_0x52d8('0x32')]=qs[_0x52d8('0x32')](_0xd693e7[_0x52d8('0x43')]['limit']);_0x5e3e2f['offset']=qs['offset'](_0xd693e7[_0x52d8('0x43')][_0x52d8('0x30')]);}_0x5e3e2f[_0x52d8('0x4b')]=qs[_0x52d8('0x4c')](_0xd693e7['query']['sort']);_0x5e3e2f[_0x52d8('0x4d')]=qs[_0x52d8('0x44')](_[_0x52d8('0x68')](_0xd693e7[_0x52d8('0x43')],_0x4646ee[_0x52d8('0x44')]));_0x5e3e2f[_0x52d8('0x4d')][_0x52d8('0x64')]=_0x4c6b19['id'];if(_0xd693e7[_0x52d8('0x43')][_0x52d8('0x4e')]){_0x5e3e2f[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x5e3e2f['where'],{'$or':_[_0x52d8('0x3f')](_0x5e3e2f[_0x52d8('0x47')],function(_0x5a224c){var _0x214960={};_0x214960[_0x5a224c]={'$like':'%'+_0xd693e7['query'][_0x52d8('0x4e')]+'%'};return _0x214960;})});}_0x5e3e2f=_[_0x52d8('0x4f')]({},_0x5e3e2f,_0xd693e7[_0x52d8('0x50')]);return db['FaxInteraction'][_0x52d8('0x51')]({'where':_0x5e3e2f[_0x52d8('0x4d')]})['then'](function(_0x2f01e8){_0x404e30[_0x52d8('0x51')]=_0x2f01e8;if(_0xd693e7[_0x52d8('0x43')][_0x52d8('0x52')]){_0x5e3e2f[_0x52d8('0x70')]=[{'model':db[_0x52d8('0x74')],'as':_0x52d8('0x75'),'required':![]},{'model':db['User'],'as':_0x52d8('0x76'),'attributes':['name',_0x52d8('0x77'),_0x52d8('0x78')],'required':![]},{'model':db[_0x52d8('0x79')],'as':_0x52d8('0x7a'),'attributes':['id','name','color'],'where':_0xd693e7[_0x52d8('0x43')]['tag']?{'id':_0xd693e7[_0x52d8('0x43')]['tag']}:undefined,'required':_0xd693e7['query'][_0x52d8('0x7b')]?!![]:![]}];}return db[_0x52d8('0x7c')]['findAll'](_0x5e3e2f);})[_0x52d8('0x23')](function(_0x406d2c){_0x404e30[_0x52d8('0x54')]=_0x406d2c;return _0x404e30;});}})['then'](respondWithFilteredResult(_0x1df228,_0x5e3e2f))[_0x52d8('0x55')](handleError(_0x1df228,null));};exports[_0x52d8('0x7d')]=function(_0x193a60,_0x1ce908){var _0x398820=_0x193a60[_0x52d8('0x61')]['id'];var _0x512384=_0x193a60[_0x52d8('0x5a')];var _0x39cd29=0xc8;var _0x4263fd=null;return db[_0x52d8('0x7e')][_0x52d8('0x7f')]({'isolationLevel':db['sequelize'][_0x52d8('0x80')][_0x52d8('0x81')][_0x52d8('0x82')]},function(_0x4dc108){return db[_0x52d8('0x53')][_0x52d8('0x66')]({'where':{'id':_0x398820},'transaction':_0x4dc108})[_0x52d8('0x23')](function(_0x72c4fc){if(_0x72c4fc){return db[_0x52d8('0x83')][_0x52d8('0x38')]({'where':{'FaxAccountId':_0x398820},'transaction':_0x4dc108})['then'](function(){var _0x19664d=_[_0x52d8('0x3f')](_0x512384,function(_0x2cb691){_0x2cb691[_0x52d8('0x64')]=_0x398820;return _0x2cb691;});return db['FaxApplication'][_0x52d8('0x84')](_0x19664d,{'transaction':_0x4dc108});});}else{_0x39cd29=0x194;_0x4263fd=[];}});})['then'](function(){if(_0x39cd29!==0x194){return db[_0x52d8('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x398820},'order':_0x52d8('0x85')})[_0x52d8('0x23')](function(_0x11a072){_0x4263fd=_0x11a072;});}})[_0x52d8('0x55')](function(_0x47a74c){_0x39cd29=0x1f4;logger[_0x52d8('0x29')](_0x47a74c[_0x52d8('0x86')]);if(_0x47a74c['name']){delete _0x47a74c['name'];}_0x4263fd=_0x47a74c;})[_0x52d8('0x87')](function(){if(_0x4263fd===null){_0x1ce908['sendStatus'](_0x39cd29);}else{if(_0x39cd29===0x1f4){_0x1ce908[_0x52d8('0x2e')](_0x39cd29)[_0x52d8('0x88')](_0x4263fd);}else{_0x1ce908[_0x52d8('0x2e')](_0x39cd29)[_0x52d8('0x2f')](_0x4263fd);}}});};exports[_0x52d8('0x89')]=function(_0x101e20,_0xfe00c5,_0x1d06f6){var _0x339c51={};var _0x16bce8={};var _0x4f866e;var _0x59ae87;return db[_0x52d8('0x53')][_0x52d8('0x66')]({'where':{'id':_0x101e20[_0x52d8('0x61')]['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0xfe00c5,null))[_0x52d8('0x23')](function(_0xeac7be){if(_0xeac7be){_0x4f866e=_0xeac7be;_0x16bce8['model']=_[_0x52d8('0x42')](db['FaxApplication'][_0x52d8('0x57')]);_0x16bce8['query']=_[_0x52d8('0x42')](_0x101e20[_0x52d8('0x43')]);_0x16bce8[_0x52d8('0x44')]=_['intersection'](_0x16bce8['model'],_0x16bce8[_0x52d8('0x43')]);_0x339c51[_0x52d8('0x47')]=_[_0x52d8('0x45')](_0x16bce8[_0x52d8('0x46')],qs[_0x52d8('0x48')](_0x101e20['query'][_0x52d8('0x48')]));_0x339c51[_0x52d8('0x47')]=_0x339c51[_0x52d8('0x47')][_0x52d8('0x67')]?_0x339c51[_0x52d8('0x47')]:_0x16bce8[_0x52d8('0x46')];_0x339c51['order']=qs[_0x52d8('0x4c')](_0x101e20[_0x52d8('0x43')][_0x52d8('0x4c')]);_0x339c51[_0x52d8('0x4d')]=qs[_0x52d8('0x44')](_['pick'](_0x101e20[_0x52d8('0x43')],_0x16bce8[_0x52d8('0x44')]));if(_0x101e20[_0x52d8('0x43')][_0x52d8('0x4e')]){_0x339c51[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x339c51['where'],{'$or':_[_0x52d8('0x3f')](_0x339c51[_0x52d8('0x47')],function(_0x23bb9b){var _0x57b3d7={};_0x57b3d7[_0x23bb9b]={'$like':'%'+_0x101e20[_0x52d8('0x43')][_0x52d8('0x4e')]+'%'};return _0x57b3d7;})});}_0x339c51=_[_0x52d8('0x4f')]({},_0x339c51,_0x101e20[_0x52d8('0x50')]);return _0x4f866e[_0x52d8('0x89')](_0x339c51);}})[_0x52d8('0x23')](function(_0x4efd28){if(_0x4efd28){_0x59ae87=_0x4efd28['length'];if(!_0x101e20[_0x52d8('0x43')][_0x52d8('0x49')](_0x52d8('0x4a'))){_0x339c51['limit']=qs[_0x52d8('0x32')](_0x101e20[_0x52d8('0x43')][_0x52d8('0x32')]);_0x339c51[_0x52d8('0x30')]=qs[_0x52d8('0x30')](_0x101e20['query']['offset']);}return _0x4f866e[_0x52d8('0x89')](_0x339c51);}})[_0x52d8('0x23')](function(_0x3cd914){if(_0x3cd914){return _0x3cd914?{'count':_0x59ae87,'rows':_0x3cd914}:null;}})[_0x52d8('0x23')](respondWithResult(_0xfe00c5,null))[_0x52d8('0x55')](handleError(_0xfe00c5,null));};function Extension(_0x23e110,_0x5f1c4f,_0x510295,_0x34bd6e){this[_0x52d8('0x8a')]=_0x52d8('0x8b');this[_0x52d8('0x8c')]=_0x23e110[_0x52d8('0x8d')];this['app']=_0x34bd6e;this[_0x52d8('0x40')]=_0x52d8('0x8e');this[_0x52d8('0x8f')]=_0x52d8('0x90');this[_0x52d8('0x64')]=_0x23e110['id'];this['priority']=_0x5f1c4f;this[_0x52d8('0x91')]=_0x510295;}function createExtensionsReciveFax(_0x4c4b5f){var _0x11a019=0x1;var _0x377c87=[];_0x377c87['push'](new Extension(_0x4c4b5f,_0x11a019,'',_0x52d8('0x92')));_0x11a019+=0x1;_0x377c87[_0x52d8('0x93')](new Extension(_0x4c4b5f,_0x11a019,_0x52d8('0x94'),_0x52d8('0x95')));_0x11a019+=0x1;for(var _0x85cde2 in _0x4c4b5f){if(_0x4c4b5f[_0x52d8('0x49')](_0x85cde2)&&(_0x85cde2===_0x52d8('0x96')||_0x85cde2==='localstationid'||_0x85cde2===_0x52d8('0x97')||_0x85cde2===_0x52d8('0x98')||_0x85cde2==='headerinfo'||_0x85cde2===_0x52d8('0x99')||_0x85cde2===_0x52d8('0x9a')||_0x85cde2==='modem'||_0x85cde2===_0x52d8('0x9b'))){_0x377c87[_0x52d8('0x93')](new Extension(_0x4c4b5f,_0x11a019,_0x52d8('0x9c')+_0x85cde2+')='+_0x4c4b5f[_0x85cde2],_0x52d8('0x95')));_0x11a019+=0x1;}}_0x377c87[_0x52d8('0x93')](new Extension(_0x4c4b5f,_0x11a019,'6',_0x52d8('0x9d')));_0x11a019+=0x1;_0x377c87['push'](new Extension(_0x4c4b5f,_0x11a019,_0x52d8('0x9e'),_0x52d8('0x9f')));_0x11a019=0x0;return _0x377c87;}exports[_0x52d8('0xa0')]=function(_0x448c6e,_0x1d2c93,_0x580e75){var _0x35c76d;return db[_0x52d8('0x7e')]['transaction'](function(_0x4bd333){return db['FaxAccount'][_0x52d8('0x59')](_0x448c6e[_0x52d8('0x5a')],{'transaction':_0x4bd333})['then'](function(_0x51c53c){_0x35c76d=_0x51c53c[_0x52d8('0x39')]({'plain':!![]});return db[_0x52d8('0xa1')][_0x52d8('0x84')](createExtensionsReciveFax(_0x35c76d),{'transaction':_0x4bd333});});})[_0x52d8('0x23')](function(){return _0x35c76d;})[_0x52d8('0x23')](respondWithResult(_0x1d2c93,null))['catch'](handleError(_0x1d2c93,null));};exports['updateAccountApplications']=function(_0xff0bc0,_0x496066,_0x30c3f9){var _0x59cbae;return db[_0x52d8('0x7e')][_0x52d8('0x7f')](function(_0x1ce0a8){return db[_0x52d8('0x53')]['update'](_0xff0bc0[_0x52d8('0x5a')],{'where':{'id':_0xff0bc0['body']['id']},'transaction':_0x1ce0a8})[_0x52d8('0x23')](function(_0x4979af){return db[_0x52d8('0xa1')]['destroy']({'where':{'FaxAccountId':_0xff0bc0['body']['id']},'transaction':_0x1ce0a8})[_0x52d8('0x23')](function(_0x479adb){return db['VoiceExtension'][_0x52d8('0x84')](createExtensionsReciveFax(_[_0x52d8('0x73')](_0xff0bc0['body'],[_0x52d8('0xa2'),_0x52d8('0x41'),_0x52d8('0xa3'),_0x52d8('0xa4'),'TrunkId',_0x52d8('0xa5')])),{'transaction':_0x1ce0a8});});});})[_0x52d8('0x23')](function(){return db[_0x52d8('0x53')][_0x52d8('0xa6')](_0xff0bc0[_0x52d8('0x5a')]['id']);})[_0x52d8('0x23')](respondWithResult(_0x496066,null))[_0x52d8('0x55')](handleError(_0x496066,null));};exports['getMessages']=function(_0x545d53,_0x384d20,_0x2c40d5){var _0x596a26={'raw':!![],'where':{}};var _0x2a490f={};var _0x32a85b={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x545d53[_0x52d8('0x61')]['id']}})['then'](handleEntityNotFound(_0x384d20,null))['then'](function(_0x4cdff5){if(_0x4cdff5){_0x2a490f[_0x52d8('0x46')]=_[_0x52d8('0x42')](db[_0x52d8('0xa7')][_0x52d8('0x57')]);_0x2a490f['query']=_[_0x52d8('0x42')](_0x545d53['query']);_0x2a490f[_0x52d8('0x44')]=_[_0x52d8('0x45')](_0x2a490f[_0x52d8('0x46')],_0x2a490f['query']);_0x596a26['attributes']=_['intersection'](_0x2a490f[_0x52d8('0x46')],qs['fields'](_0x545d53[_0x52d8('0x43')]['fields']));_0x596a26[_0x52d8('0x47')]=_0x596a26[_0x52d8('0x47')][_0x52d8('0x67')]?_0x596a26[_0x52d8('0x47')]:_0x2a490f[_0x52d8('0x46')];if(!_0x545d53[_0x52d8('0x43')][_0x52d8('0x49')](_0x52d8('0x4a'))){_0x596a26[_0x52d8('0x32')]=qs[_0x52d8('0x32')](_0x545d53[_0x52d8('0x43')][_0x52d8('0x32')]);_0x596a26[_0x52d8('0x30')]=qs['offset'](_0x545d53['query'][_0x52d8('0x30')]);}_0x596a26['order']=qs[_0x52d8('0x4c')](_0x545d53['query']['sort']);_0x596a26[_0x52d8('0x4d')]=qs['filters'](_['pick'](_0x545d53['query'],_0x2a490f[_0x52d8('0x44')]));_0x596a26[_0x52d8('0x4d')]['FaxAccountId']=_0x4cdff5['id'];if(_0x545d53[_0x52d8('0x43')][_0x52d8('0x4e')]){_0x596a26[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x596a26[_0x52d8('0x4d')],{'$or':_[_0x52d8('0x3f')](_0x596a26[_0x52d8('0x47')],function(_0x52ef2a){var _0x26248e={};_0x26248e[_0x52ef2a]={'$like':'%'+_0x545d53[_0x52d8('0x43')][_0x52d8('0x4e')]+'%'};return _0x26248e;})});}if(_0x545d53[_0x52d8('0x43')][_0x52d8('0xa8')]){var _0x24d530=_0x545d53['query'][_0x52d8('0xa8')][_0x52d8('0xa9')](',');var _0x1c5366={};_0x1c5366[_0x24d530[0x0]]={'$gte':moment(_0x24d530[0x1])[_0x52d8('0xaa')](_0x52d8('0xab'))};_0x596a26[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x596a26[_0x52d8('0x4d')],_0x1c5366);}_0x596a26=_['merge']({},_0x596a26,_0x545d53[_0x52d8('0x50')]);return db[_0x52d8('0xa7')][_0x52d8('0x51')]({'where':_0x596a26['where']})[_0x52d8('0x23')](function(_0x62306f){_0x32a85b[_0x52d8('0x51')]=_0x62306f;if(_0x545d53[_0x52d8('0x43')][_0x52d8('0x52')]){_0x596a26[_0x52d8('0x70')]=[{'all':!![]}];}return db[_0x52d8('0xa7')]['findAll'](_0x596a26);})[_0x52d8('0x23')](function(_0x3836cf){_0x32a85b['rows']=_0x3836cf;return _0x32a85b;});}})['then'](respondWithFilteredResult(_0x384d20,_0x596a26))['catch'](handleError(_0x384d20,null));};exports[_0x52d8('0x88')]=function(_0xfcecf9,_0x39c4b7,_0x57df36){var _0x164e89,_0x5dacc6={},_0x3533e3;if(_0xfcecf9[_0x52d8('0x5a')]['to']){_0x3533e3=_0xfcecf9['body']['to'][0x0];}return db[_0x52d8('0x53')][_0x52d8('0x58')]({'where':{'id':_0xfcecf9[_0x52d8('0x61')]['id']},'include':[{'model':db[_0x52d8('0xac')],'as':_0x52d8('0xad'),'include':[{'model':db[_0x52d8('0x74')],'as':_0x52d8('0xae'),'where':{'fax':_0x3533e3},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x52d8('0x23')](handleEntityNotFound(_0x39c4b7,null))[_0x52d8('0x23')](function(_0x1a6626){_0x164e89=_0x1a6626;if(_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')]&&_0xfcecf9['body'][_0x52d8('0xaf')][_0x52d8('0x67')]){for(var _0xdd5d41=0x0;_0xdd5d41<_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')]['length'];_0xdd5d41+=0x1){_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')][_0xdd5d41]={'filename':_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')][_0xdd5d41][_0x52d8('0x3b')],'id':_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')][_0xdd5d41]['id'],'path':path[_0x52d8('0xb0')](config[_0x52d8('0xb1')],'server/files/attachments',_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')][_0xdd5d41][_0x52d8('0xb2')])};}}return respondWithRpcPromise(_0x52d8('0xb3'),_0x52d8('0xb3'),{'FaxAccountId':_[_0x52d8('0xb4')](_0xfcecf9[_0x52d8('0x61')]['id'])?undefined:_0xfcecf9[_0x52d8('0x61')]['id'],'path':_[_0x52d8('0xb4')](_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')][0x0][_0x52d8('0x9')])?undefined:_0xfcecf9['body'][_0x52d8('0xaf')][0x0]['path'],'fax':_[_0x52d8('0xb4')](_0xfcecf9['body']['to'][0x0])?undefined:_0xfcecf9[_0x52d8('0x5a')]['to'][0x0]},client9002);})[_0x52d8('0x23')](function(){if(_0x164e89){if(_[_0x52d8('0xb4')](_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xb5')])){_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xb5')]=util['format']('\x22%s\x22\x20<%s>',_0x164e89[_0x52d8('0x3b')],_0x164e89['fax']);}if(_0x164e89[_0x52d8('0xad')]){if(_0x164e89['List'][_0x52d8('0xae')][_0x52d8('0x67')]){return _0x164e89[_0x52d8('0xad')][_0x52d8('0xae')][0x0];}else{return db[_0x52d8('0x74')]['create'](_['defaults'](_0xfcecf9[_0x52d8('0x5a')],{'firstName':_0xfcecf9[_0x52d8('0x5a')]['to'][0x0],'phone':_0xfcecf9['body']['to'][0x0],'fax':_0xfcecf9[_0x52d8('0x5a')]['to'][0x0],'ListId':_0x164e89[_0x52d8('0xa5')]}));}}else{throw new Error(_0x52d8('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x52d8('0x23')](function(_0x292379){if(_0x292379){return db[_0x52d8('0x7c')][_0x52d8('0x58')]({'where':{'ContactId':_0x292379['id'],'closed':![],'FaxAccountId':_0x164e89['id']}})[_0x52d8('0x23')](function(_0x4b762b){if(_0x4b762b){return[_0x4b762b,![]];}return db['FaxInteraction'][_0x52d8('0x59')]({'UserId':_0xfcecf9[_0x52d8('0x5b')]['id'],'ContactId':_0x292379['id'],'FaxAccountId':_0x164e89['id'],'fax':_0xfcecf9[_0x52d8('0x5a')]['to'][0x0],'firstMsgDirection':_0x52d8('0xb7'),'Messages':[_[_0x52d8('0x4f')](_0xfcecf9['body'],{'read':![],'body':_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')][0x0]['filename'],'FaxAccountId':_0x164e89['id'],'UserId':_0xfcecf9[_0x52d8('0x5b')]['id'],'ContactId':_0x292379['id'],'AttachmentId':_0xfcecf9[_0x52d8('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x52d8('0xa7')],'as':'Messages'}]})[_0x52d8('0x23')](function(_0x25cbdc){return[_0x25cbdc,!![]];});});}else{throw new Error(_0x52d8('0xb8'));}})[_0x52d8('0xb9')](function(_0x1f2099,_0x344dac){if(_0x344dac){return _0x1f2099;}return db[_0x52d8('0xa7')]['create']({'direction':_0x52d8('0xb7'),'read':![],'body':_0xfcecf9['body'][_0x52d8('0xaf')][0x0][_0x52d8('0xba')],'FaxAccountId':_0x164e89['id'],'FaxInteractionId':_0x1f2099['id'],'UserId':_0xfcecf9[_0x52d8('0x5b')]['id'],'ContactId':_0x1f2099[_0x52d8('0xbb')],'AttachmentId':_0xfcecf9['body'][_0x52d8('0xaf')][0x0]['id']})[_0x52d8('0x23')](function(_0xc511f7){_0x1f2099['dataValues']['Messages']=[];_0x1f2099[_0x52d8('0xbc')][_0x52d8('0xbd')][_0x52d8('0x93')](_0xc511f7[_0x52d8('0xbc')]);return _0x1f2099;});})[_0x52d8('0x23')](function(_0x324b95){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x52d8('0xb4')](_0xfcecf9[_0x52d8('0x61')]['id'])?undefined:_0xfcecf9[_0x52d8('0x61')]['id'],'path':_[_0x52d8('0xb4')](_0xfcecf9['body']['attachments'][0x0]['path'])?undefined:_0xfcecf9[_0x52d8('0x5a')][_0x52d8('0xaf')][0x0][_0x52d8('0x9')],'fax':_[_0x52d8('0xb4')](_0xfcecf9[_0x52d8('0x5a')]['to'][0x0])?undefined:_0xfcecf9[_0x52d8('0x5a')]['to'][0x0],'AttachmentId':_0xfcecf9[_0x52d8('0x5a')]['attachments'][0x0]['id']},client9002)[_0x52d8('0x23')](function(_0x51f3cf){logger['info']('SendFaxRpc,\x20%s',_0x51f3cf);})[_0x52d8('0x55')](function(_0xbecce9){logger[_0x52d8('0x24')](_0x52d8('0xbe'),_0xbecce9);});return _0x324b95;})['then'](respondWithResult(_0x39c4b7,null))['catch'](handleError(_0x39c4b7,null));};exports['addAgents']=function(_0x339f2a,_0x510074,_0x390987){return db['FaxAccount'][_0x52d8('0x58')]({'where':{'id':_0x339f2a[_0x52d8('0x61')]['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x510074,null))['then'](function(_0x40e149){if(_0x40e149){return _0x40e149[_0x52d8('0xbf')](_0x339f2a[_0x52d8('0x5a')]['ids'],_['omit'](_0x339f2a[_0x52d8('0x5a')],['ids','id'])||{})[_0x52d8('0xb9')](function(_0x2e7aed){for(var _0x4da6aa=0x0;_0x4da6aa<_0x339f2a[_0x52d8('0x5a')][_0x52d8('0x6c')][_0x52d8('0x67')];_0x4da6aa+=0x1){socket[_0x52d8('0xc0')]('userFaxAccount:save',{'UserId':Number(_0x339f2a[_0x52d8('0x5a')]['ids'][_0x4da6aa]),'FaxAccountId':Number(_0x339f2a[_0x52d8('0x61')]['id'])});}return _0x2e7aed;});}})[_0x52d8('0x23')](respondWithResult(_0x510074,null))['catch'](handleError(_0x510074,null));};exports[_0x52d8('0xc1')]=function(_0x483652,_0x3d3a64,_0x2c5896){return db[_0x52d8('0x53')][_0x52d8('0x58')]({'where':{'id':_0x483652['params']['id']}})[_0x52d8('0x23')](handleEntityNotFound(_0x3d3a64,null))[_0x52d8('0x23')](function(_0x2db52b){if(_0x2db52b){return _0x2db52b[_0x52d8('0xc1')](_0x483652[_0x52d8('0x43')][_0x52d8('0x6c')])['then'](function(){if(_[_0x52d8('0xc2')](_0x483652[_0x52d8('0x43')][_0x52d8('0x6c')])){for(var _0x9c5f67=0x0;_0x9c5f67<_0x483652[_0x52d8('0x43')][_0x52d8('0x6c')][_0x52d8('0x67')];_0x9c5f67+=0x1){socket[_0x52d8('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x483652[_0x52d8('0x43')][_0x52d8('0x6c')][_0x9c5f67]),'FaxAccountId':Number(_0x483652[_0x52d8('0x61')]['id'])});}}else{socket[_0x52d8('0xc0')](_0x52d8('0xc3'),{'UserId':Number(_0x483652[_0x52d8('0x43')][_0x52d8('0x6c')]),'FaxAccountId':Number(_0x483652[_0x52d8('0x61')]['id'])});}});}})[_0x52d8('0x23')](respondWithStatusCode(_0x3d3a64,null))[_0x52d8('0x55')](handleError(_0x3d3a64,null));};exports['getAgents']=function(_0x198048,_0x48d2a,_0x3ed23e){var _0x28ddd8={};var _0x2577f6={};var _0x3e1713;var _0x44d3d2;return db[_0x52d8('0x53')][_0x52d8('0x66')]({'where':{'id':_0x198048[_0x52d8('0x61')]['id']}})['then'](handleEntityNotFound(_0x48d2a,null))[_0x52d8('0x23')](function(_0x29ed71){if(_0x29ed71){_0x3e1713=_0x29ed71;_0x2577f6['model']=_['keys'](db[_0x52d8('0xc4')][_0x52d8('0x57')]);_0x2577f6[_0x52d8('0x43')]=_[_0x52d8('0x42')](_0x198048['query']);_0x2577f6['filters']=_[_0x52d8('0x45')](_0x2577f6[_0x52d8('0x46')],_0x2577f6['query']);_0x28ddd8[_0x52d8('0x47')]=_[_0x52d8('0x45')](_0x2577f6[_0x52d8('0x46')],qs['fields'](_0x198048[_0x52d8('0x43')][_0x52d8('0x48')]));_0x28ddd8[_0x52d8('0x47')]=_0x28ddd8[_0x52d8('0x47')][_0x52d8('0x67')]?_0x28ddd8[_0x52d8('0x47')]:_0x2577f6[_0x52d8('0x46')];_0x28ddd8[_0x52d8('0x4b')]=qs['sort'](_0x198048[_0x52d8('0x43')][_0x52d8('0x4c')]);_0x28ddd8[_0x52d8('0x4d')]=qs['filters'](_[_0x52d8('0x68')](_0x198048[_0x52d8('0x43')],_0x2577f6[_0x52d8('0x44')]));if(_0x198048[_0x52d8('0x43')][_0x52d8('0x4e')]){_0x28ddd8[_0x52d8('0x4d')]=_[_0x52d8('0x4f')](_0x28ddd8[_0x52d8('0x4d')],{'$or':_['map'](_0x28ddd8['attributes'],function(_0x35fe9b){var _0x2fb93b={};_0x2fb93b[_0x35fe9b]={'$like':'%'+_0x198048[_0x52d8('0x43')][_0x52d8('0x4e')]+'%'};return _0x2fb93b;})});}_0x28ddd8=_[_0x52d8('0x4f')]({},_0x28ddd8,_0x198048[_0x52d8('0x50')]);return _0x3e1713[_0x52d8('0xc5')](_0x28ddd8);}})[_0x52d8('0x23')](function(_0x46466f){if(_0x46466f){_0x44d3d2=_0x46466f[_0x52d8('0x67')];if(!_0x198048[_0x52d8('0x43')][_0x52d8('0x49')](_0x52d8('0x4a'))){_0x28ddd8[_0x52d8('0x32')]=qs[_0x52d8('0x32')](_0x198048[_0x52d8('0x43')][_0x52d8('0x32')]);_0x28ddd8[_0x52d8('0x30')]=qs['offset'](_0x198048[_0x52d8('0x43')][_0x52d8('0x30')]);}return _0x3e1713[_0x52d8('0xc5')](_0x28ddd8);}})[_0x52d8('0x23')](function(_0x56022b){if(_0x56022b){return _0x56022b?{'count':_0x44d3d2,'rows':_0x56022b}:null;}})['then'](respondWithResult(_0x48d2a,null))[_0x52d8('0x55')](handleError(_0x48d2a,null));}; \ No newline at end of file +var _0x9b01=['request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxAccount,\x20%s,\x20%s','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','rows','show','params','Pause','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','findAll','removeDispositions','addAnswer','CannedAnswer','findOne','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','priority','appdata','push','CDR(type)=inbound-fax','Set','ecm','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','sequelize','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','Messages','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./faxAccount.socket','jayson/promise','client','http'];(function(_0x321f56,_0x28880b){var _0x56f317=function(_0x5dbbab){while(--_0x5dbbab){_0x321f56['push'](_0x321f56['shift']());}};_0x56f317(++_0x28880b);}(_0x9b01,0x16f));var _0x19b0=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x9b01[_0x3740fe];return _0x55492b;};'use strict';var emlformat=require(_0x19b0('0x0'));var rimraf=require(_0x19b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19b0('0x2'));var moment=require('moment');var BPromise=require(_0x19b0('0x3'));var Mustache=require(_0x19b0('0x4'));var util=require(_0x19b0('0x5'));var path=require(_0x19b0('0x6'));var sox=require(_0x19b0('0x7'));var csv=require(_0x19b0('0x8'));var ejs=require(_0x19b0('0x9'));var fs=require('fs');var fs_extra=require(_0x19b0('0xa'));var _=require(_0x19b0('0xb'));var squel=require(_0x19b0('0xc'));var crypto=require(_0x19b0('0xd'));var jsforce=require(_0x19b0('0xe'));var deskjs=require(_0x19b0('0xf'));var toCsv=require(_0x19b0('0x8'));var querystring=require(_0x19b0('0x10'));var Papa=require(_0x19b0('0x11'));var Redis=require(_0x19b0('0x12'));var authService=require(_0x19b0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x19b0('0x14'));var hardwareService=require(_0x19b0('0x15'));var logger=require(_0x19b0('0x16'))('api');var utils=require(_0x19b0('0x17'));var config=require(_0x19b0('0x18'));var licenseUtil=require(_0x19b0('0x19'));var db=require(_0x19b0('0x1a'))['db'];config['redis']=_[_0x19b0('0x1b')](config[_0x19b0('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x19b0('0x1d'))['register'](socket);var jayson=require(_0x19b0('0x1e'));var client=jayson[_0x19b0('0x1f')][_0x19b0('0x20')]({'port':0x232c});var client9002=jayson[_0x19b0('0x1f')][_0x19b0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x10fce9,_0x566d6e,_0x41dafc,_0x3a3cf3){return new BPromise(function(_0x53f2a8,_0x390461){var _0x228b5c=_0x3a3cf3||client;return _0x228b5c[_0x19b0('0x21')](_0x10fce9,_0x41dafc)['then'](function(_0x12a93a){logger[_0x19b0('0x22')]('FaxAccount,\x20%s,\x20%s',_0x566d6e,_0x19b0('0x23'));logger[_0x19b0('0x24')](_0x19b0('0x25'),_0x566d6e,'request\x20sent',JSON[_0x19b0('0x26')](_0x12a93a));if(_0x12a93a[_0x19b0('0x27')]){if(_0x12a93a[_0x19b0('0x27')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x566d6e,_0x12a93a['error']['message']);return _0x390461(_0x12a93a[_0x19b0('0x27')][_0x19b0('0x28')]);}logger[_0x19b0('0x27')](_0x19b0('0x29'),_0x566d6e,_0x12a93a['error'][_0x19b0('0x28')]);return _0x53f2a8(_0x12a93a['error'][_0x19b0('0x28')]);}else{logger[_0x19b0('0x22')](_0x19b0('0x29'),_0x566d6e,_0x19b0('0x23'));_0x53f2a8(_0x12a93a['result'][_0x19b0('0x28')]);}})[_0x19b0('0x2a')](function(_0x300126){logger['error'](_0x19b0('0x29'),_0x566d6e,_0x300126);_0x390461(_0x300126);});});}function respondWithStatusCode(_0x392966,_0x1d4452){_0x1d4452=_0x1d4452||0xcc;return function(_0x546ab5){if(_0x546ab5){return _0x392966[_0x19b0('0x2b')](_0x1d4452);}return _0x392966[_0x19b0('0x2c')](_0x1d4452)['end']();};}function respondWithResult(_0x2ad6f0,_0x2ef707){_0x2ef707=_0x2ef707||0xc8;return function(_0x5b2c39){if(_0x5b2c39){return _0x2ad6f0[_0x19b0('0x2c')](_0x2ef707)[_0x19b0('0x2d')](_0x5b2c39);}};}function respondWithFilteredResult(_0x1e6617,_0x48b63d){return function(_0x2c3cac){if(_0x2c3cac){var _0x407abc=typeof _0x48b63d[_0x19b0('0x2e')]===_0x19b0('0x2f')&&typeof _0x48b63d[_0x19b0('0x30')]===_0x19b0('0x2f');var _0x3125c9=_0x2c3cac['count'];var _0x34457c=_0x407abc?0x0:_0x48b63d[_0x19b0('0x2e')];var _0x23d07c=_0x407abc?_0x2c3cac['count']:_0x48b63d[_0x19b0('0x2e')]+_0x48b63d[_0x19b0('0x30')];var _0x223ed8;if(_0x23d07c>=_0x3125c9){_0x23d07c=_0x3125c9;_0x223ed8=0xc8;}else{_0x223ed8=0xce;}_0x1e6617['status'](_0x223ed8);return _0x1e6617[_0x19b0('0x31')](_0x19b0('0x32'),_0x34457c+'-'+_0x23d07c+'/'+_0x3125c9)['json'](_0x2c3cac);}return null;};}function patchUpdates(_0x39279c){return function(_0x4a489b){try{jsonpatch[_0x19b0('0x33')](_0x4a489b,_0x39279c,!![]);}catch(_0x4237ce){return BPromise[_0x19b0('0x34')](_0x4237ce);}return _0x4a489b['save']();};}function saveUpdates(_0x21cfb1,_0x4790cd){return function(_0x50dbcf){if(_0x50dbcf){return _0x50dbcf[_0x19b0('0x35')](_0x21cfb1)['then'](function(_0x57bd1b){return _0x57bd1b;});}return null;};}function removeEntity(_0x598f05,_0x3dadf0){return function(_0x56cb2e){if(_0x56cb2e){return _0x56cb2e['destroy']()[_0x19b0('0x36')](function(){var _0x3169c0=_0x56cb2e['get']({'plain':!![]});var _0x11d996=_0x19b0('0x37');return db[_0x19b0('0x38')][_0x19b0('0x39')]({'where':{'type':_0x11d996,'resourceId':_0x3169c0['id']}})[_0x19b0('0x36')](function(){return _0x56cb2e;});})[_0x19b0('0x36')](function(){_0x598f05[_0x19b0('0x2c')](0xcc)[_0x19b0('0x3a')]();});}};}function handleEntityNotFound(_0x2d7cc9,_0x183e6a){return function(_0x3c5e98){if(!_0x3c5e98){_0x2d7cc9[_0x19b0('0x2b')](0x194);}return _0x3c5e98;};}function handleError(_0x4bd16a,_0x2156dd){_0x2156dd=_0x2156dd||0x1f4;return function(_0x2ceb59){logger[_0x19b0('0x27')](_0x2ceb59[_0x19b0('0x3b')]);if(_0x2ceb59['name']){delete _0x2ceb59[_0x19b0('0x3c')];}_0x4bd16a['status'](_0x2156dd)[_0x19b0('0x3d')](_0x2ceb59);};}exports[_0x19b0('0x3e')]=function(_0x2b6e77,_0x291073){var _0x1044d8={'include':[{'model':db['Pause'],'as':_0x19b0('0x3f')}]},_0x4ea857={},_0x436d98={'count':0x0,'rows':[]};var _0x58bdb1=_[_0x19b0('0x40')](db[_0x19b0('0x41')][_0x19b0('0x42')],function(_0x40c2f4){return{'name':_0x40c2f4['fieldName'],'type':_0x40c2f4[_0x19b0('0x43')][_0x19b0('0x44')]};});_0x4ea857[_0x19b0('0x45')]=_[_0x19b0('0x40')](_0x58bdb1,'name');_0x4ea857[_0x19b0('0x46')]=_[_0x19b0('0x47')](_0x2b6e77[_0x19b0('0x46')]);_0x4ea857[_0x19b0('0x48')]=_[_0x19b0('0x49')](_0x4ea857[_0x19b0('0x45')],_0x4ea857[_0x19b0('0x46')]);_0x1044d8[_0x19b0('0x4a')]=_['intersection'](_0x4ea857[_0x19b0('0x45')],qs[_0x19b0('0x4b')](_0x2b6e77[_0x19b0('0x46')][_0x19b0('0x4b')]));_0x1044d8[_0x19b0('0x4a')]=_0x1044d8['attributes'][_0x19b0('0x4c')]?_0x1044d8[_0x19b0('0x4a')]:_0x4ea857['model'];if(!_0x2b6e77[_0x19b0('0x46')]['hasOwnProperty']('nolimit')){_0x1044d8[_0x19b0('0x30')]=qs['limit'](_0x2b6e77[_0x19b0('0x46')][_0x19b0('0x30')]);_0x1044d8[_0x19b0('0x2e')]=qs[_0x19b0('0x2e')](_0x2b6e77[_0x19b0('0x46')]['offset']);}_0x1044d8[_0x19b0('0x4d')]=qs[_0x19b0('0x4e')](_0x2b6e77[_0x19b0('0x46')][_0x19b0('0x4e')]);_0x1044d8[_0x19b0('0x4f')]=qs['filters'](_[_0x19b0('0x50')](_0x2b6e77['query'],_0x4ea857[_0x19b0('0x48')]),_0x58bdb1);if(_0x2b6e77['query']['filter']){_0x1044d8[_0x19b0('0x4f')]=_[_0x19b0('0x51')](_0x1044d8[_0x19b0('0x4f')],{'$or':_[_0x19b0('0x40')](_0x58bdb1,function(_0x561f0b){if(_0x561f0b[_0x19b0('0x43')]!==_0x19b0('0x52')){var _0x4bf57e={};_0x4bf57e[_0x561f0b[_0x19b0('0x3c')]]={'$like':'%'+_0x2b6e77['query'][_0x19b0('0x53')]+'%'};return _0x4bf57e;}})});}_0x1044d8=_[_0x19b0('0x51')]({},_0x1044d8,_0x2b6e77[_0x19b0('0x54')]);var _0x196d15={'where':_0x1044d8[_0x19b0('0x4f')]};return db[_0x19b0('0x41')][_0x19b0('0x55')](_0x196d15)[_0x19b0('0x36')](function(_0x1caa7b){_0x436d98[_0x19b0('0x55')]=_0x1caa7b;if(_0x2b6e77['query'][_0x19b0('0x56')]){_0x1044d8['include']=[{'all':!![]}];}return db[_0x19b0('0x41')]['findAll'](_0x1044d8);})['then'](function(_0x45ddd4){_0x436d98[_0x19b0('0x57')]=_0x45ddd4;return _0x436d98;})[_0x19b0('0x36')](respondWithFilteredResult(_0x291073,_0x1044d8))[_0x19b0('0x2a')](handleError(_0x291073,null));};exports[_0x19b0('0x58')]=function(_0x5ab4c,_0x123537){var _0x2cd4c6={'raw':![],'where':{'id':_0x5ab4c[_0x19b0('0x59')]['id']},'include':[{'model':db[_0x19b0('0x5a')],'as':'mandatoryDispositionPause'}]},_0x2f102f={};_0x2f102f[_0x19b0('0x45')]=_['keys'](db[_0x19b0('0x41')][_0x19b0('0x42')]);_0x2f102f[_0x19b0('0x46')]=_[_0x19b0('0x47')](_0x5ab4c['query']);_0x2f102f['filters']=_[_0x19b0('0x49')](_0x2f102f[_0x19b0('0x45')],_0x2f102f['query']);_0x2cd4c6['attributes']=_['intersection'](_0x2f102f['model'],qs[_0x19b0('0x4b')](_0x5ab4c[_0x19b0('0x46')][_0x19b0('0x4b')]));_0x2cd4c6[_0x19b0('0x4a')]=_0x2cd4c6[_0x19b0('0x4a')]['length']?_0x2cd4c6['attributes']:_0x2f102f[_0x19b0('0x45')];if(_0x5ab4c[_0x19b0('0x46')][_0x19b0('0x56')]){_0x2cd4c6[_0x19b0('0x5b')]=[{'all':!![]}];}_0x2cd4c6=_['merge']({},_0x2cd4c6,_0x5ab4c['options']);return db[_0x19b0('0x41')][_0x19b0('0x5c')](_0x2cd4c6)[_0x19b0('0x36')](handleEntityNotFound(_0x123537,null))[_0x19b0('0x36')](respondWithResult(_0x123537,null))[_0x19b0('0x2a')](handleError(_0x123537,null));};exports[_0x19b0('0x5d')]=function(_0x281db2,_0x4d2378){return db[_0x19b0('0x41')]['create'](_0x281db2['body'],{})[_0x19b0('0x36')](function(_0x42e4be){var _0x3cc8dd=_0x281db2[_0x19b0('0x5e')][_0x19b0('0x5f')]({'plain':!![]});if(!_0x3cc8dd)throw new Error(_0x19b0('0x60'));if(_0x3cc8dd['role']===_0x19b0('0x5e')){var _0x3625b=_0x42e4be[_0x19b0('0x5f')]({'plain':!![]});var _0x41bc44=_0x19b0('0x37');return db[_0x19b0('0x61')]['find']({'where':{'name':_0x41bc44,'userProfileId':_0x3cc8dd[_0x19b0('0x62')]},'raw':!![]})[_0x19b0('0x36')](function(_0x494b66){if(_0x494b66&&_0x494b66[_0x19b0('0x63')]===0x0){return db[_0x19b0('0x38')][_0x19b0('0x5d')]({'name':_0x3625b[_0x19b0('0x3c')],'resourceId':_0x3625b['id'],'type':_0x494b66[_0x19b0('0x3c')],'sectionId':_0x494b66['id']},{})['then'](function(){return _0x42e4be;});}else{return _0x42e4be;}})['catch'](function(_0x38066b){logger[_0x19b0('0x27')](_0x19b0('0x64'),_0x38066b);throw _0x38066b;});}return _0x42e4be;})[_0x19b0('0x36')](respondWithResult(_0x4d2378,0xc9))[_0x19b0('0x2a')](handleError(_0x4d2378,null));};exports[_0x19b0('0x35')]=function(_0xd83d6b,_0x37de43){if(_0xd83d6b['body']['id']){delete _0xd83d6b[_0x19b0('0x65')]['id'];}return db[_0x19b0('0x41')][_0x19b0('0x5c')]({'where':{'id':_0xd83d6b['params']['id']},'include':[{'model':db[_0x19b0('0x5a')],'as':_0x19b0('0x3f')}]})['then'](handleEntityNotFound(_0x37de43,null))[_0x19b0('0x36')](saveUpdates(_0xd83d6b[_0x19b0('0x65')],null))['then'](respondWithResult(_0x37de43,null))['catch'](handleError(_0x37de43,null));};exports[_0x19b0('0x39')]=function(_0x5d1eae,_0x322c1c){return db[_0x19b0('0x41')][_0x19b0('0x5c')]({'where':{'id':_0x5d1eae[_0x19b0('0x59')]['id']}})['then'](handleEntityNotFound(_0x322c1c,null))[_0x19b0('0x36')](removeEntity(_0x322c1c,null))[_0x19b0('0x2a')](handleError(_0x322c1c,null));};exports['describe']=function(_0x402304,_0x1260d2){return db[_0x19b0('0x41')][_0x19b0('0x66')]()[_0x19b0('0x36')](respondWithResult(_0x1260d2,null))['catch'](handleError(_0x1260d2,null));};exports[_0x19b0('0x67')]=function(_0x1a418e,_0x1c3d98,_0x25357b){if(_0x1a418e['body']['id']){delete _0x1a418e[_0x19b0('0x65')]['id'];}return db[_0x19b0('0x41')][_0x19b0('0x5c')]({'where':{'id':_0x1a418e[_0x19b0('0x59')]['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x1c3d98,null))[_0x19b0('0x36')](function(_0x26fc56){if(_0x26fc56){_0x1a418e['body'][_0x19b0('0x68')]=_0x26fc56['id'];return db[_0x19b0('0x69')][_0x19b0('0x5d')](_0x1a418e[_0x19b0('0x65')]);}})[_0x19b0('0x36')](respondWithResult(_0x1c3d98,null))['catch'](handleError(_0x1c3d98,null));};exports[_0x19b0('0x6a')]=function(_0x1d3a69,_0x191b88,_0xe3cd28){var _0xfe7d2a={'raw':![],'where':{}};var _0x3048cf={};var _0x21ea0d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1d3a69[_0x19b0('0x59')]['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x191b88,null))['then'](function(_0x3045b4){if(_0x3045b4){_0x3048cf[_0x19b0('0x45')]=_[_0x19b0('0x47')](db[_0x19b0('0x69')]['rawAttributes']);_0x3048cf[_0x19b0('0x46')]=_[_0x19b0('0x47')](_0x1d3a69[_0x19b0('0x46')]);_0x3048cf[_0x19b0('0x48')]=_[_0x19b0('0x49')](_0x3048cf[_0x19b0('0x45')],_0x3048cf[_0x19b0('0x46')]);_0xfe7d2a[_0x19b0('0x4a')]=_['intersection'](_0x3048cf[_0x19b0('0x45')],qs[_0x19b0('0x4b')](_0x1d3a69[_0x19b0('0x46')][_0x19b0('0x4b')]));_0xfe7d2a[_0x19b0('0x4a')]=_0xfe7d2a['attributes'][_0x19b0('0x4c')]?_0xfe7d2a[_0x19b0('0x4a')]:_0x3048cf[_0x19b0('0x45')];if(!_0x1d3a69[_0x19b0('0x46')][_0x19b0('0x6b')](_0x19b0('0x6c'))){_0xfe7d2a[_0x19b0('0x30')]=qs[_0x19b0('0x30')](_0x1d3a69['query'][_0x19b0('0x30')]);_0xfe7d2a[_0x19b0('0x2e')]=qs[_0x19b0('0x2e')](_0x1d3a69[_0x19b0('0x46')][_0x19b0('0x2e')]);}_0xfe7d2a[_0x19b0('0x4d')]=qs[_0x19b0('0x4e')](_0x1d3a69[_0x19b0('0x46')][_0x19b0('0x4e')]);_0xfe7d2a[_0x19b0('0x4f')]=qs['filters'](_[_0x19b0('0x50')](_0x1d3a69[_0x19b0('0x46')],_0x3048cf['filters']));_0xfe7d2a[_0x19b0('0x4f')][_0x19b0('0x68')]=_0x3045b4['id'];if(_0x1d3a69['query'][_0x19b0('0x53')]){_0xfe7d2a[_0x19b0('0x4f')]=_[_0x19b0('0x51')](_0xfe7d2a['where'],{'$or':_[_0x19b0('0x40')](_0xfe7d2a[_0x19b0('0x4a')],function(_0x58c162){var _0x3d4692={};_0x3d4692[_0x58c162]={'$like':'%'+_0x1d3a69[_0x19b0('0x46')][_0x19b0('0x53')]+'%'};return _0x3d4692;})});}_0xfe7d2a=_[_0x19b0('0x51')]({},_0xfe7d2a,_0x1d3a69[_0x19b0('0x54')]);return db[_0x19b0('0x69')]['count']({'where':_0xfe7d2a[_0x19b0('0x4f')]})[_0x19b0('0x36')](function(_0x1058eb){_0x21ea0d[_0x19b0('0x55')]=_0x1058eb;if(_0x1d3a69[_0x19b0('0x46')][_0x19b0('0x56')]){_0xfe7d2a[_0x19b0('0x5b')]=[{'all':!![]}];}return db[_0x19b0('0x69')][_0x19b0('0x6d')](_0xfe7d2a);})[_0x19b0('0x36')](function(_0x118135){_0x21ea0d['rows']=_0x118135;return _0x21ea0d;});}})[_0x19b0('0x36')](respondWithFilteredResult(_0x191b88,_0xfe7d2a))[_0x19b0('0x2a')](handleError(_0x191b88,null));};exports['removeDispositions']=function(_0x5cdac3,_0x3173f5,_0x510a22){return db[_0x19b0('0x41')][_0x19b0('0x5c')]({'where':{'id':_0x5cdac3[_0x19b0('0x59')]['id']}})['then'](handleEntityNotFound(_0x3173f5,null))[_0x19b0('0x36')](function(_0x3ad268){if(_0x3ad268){return _0x3ad268[_0x19b0('0x6e')](_0x5cdac3[_0x19b0('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x3173f5,null))[_0x19b0('0x2a')](handleError(_0x3173f5,null));};exports[_0x19b0('0x6f')]=function(_0x495442,_0x49cf80,_0x111e3b){if(_0x495442[_0x19b0('0x65')]['id']){delete _0x495442['body']['id'];}return db['FaxAccount'][_0x19b0('0x5c')]({'where':{'id':_0x495442[_0x19b0('0x59')]['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x49cf80,null))[_0x19b0('0x36')](function(_0x47794d){if(_0x47794d){_0x495442[_0x19b0('0x65')]['FaxAccountId']=_0x47794d['id'];return db[_0x19b0('0x70')]['create'](_0x495442['body']);}})[_0x19b0('0x36')](respondWithResult(_0x49cf80,null))[_0x19b0('0x2a')](handleError(_0x49cf80,null));};exports['getAnswers']=function(_0x272bc0,_0x1fbacf,_0xb7444b){var _0x17d9de={'raw':![],'where':{}};var _0x346df6={};var _0x32a928={'count':0x0,'rows':[]};return db[_0x19b0('0x41')][_0x19b0('0x71')]({'where':{'id':_0x272bc0['params']['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x1fbacf,null))['then'](function(_0x48e766){if(_0x48e766){_0x346df6[_0x19b0('0x45')]=_[_0x19b0('0x47')](db[_0x19b0('0x70')]['rawAttributes']);_0x346df6[_0x19b0('0x46')]=_['keys'](_0x272bc0[_0x19b0('0x46')]);_0x346df6[_0x19b0('0x48')]=_[_0x19b0('0x49')](_0x346df6[_0x19b0('0x45')],_0x346df6[_0x19b0('0x46')]);_0x17d9de[_0x19b0('0x4a')]=_['intersection'](_0x346df6[_0x19b0('0x45')],qs[_0x19b0('0x4b')](_0x272bc0[_0x19b0('0x46')][_0x19b0('0x4b')]));_0x17d9de[_0x19b0('0x4a')]=_0x17d9de[_0x19b0('0x4a')]['length']?_0x17d9de[_0x19b0('0x4a')]:_0x346df6['model'];if(!_0x272bc0[_0x19b0('0x46')][_0x19b0('0x6b')](_0x19b0('0x6c'))){_0x17d9de[_0x19b0('0x30')]=qs[_0x19b0('0x30')](_0x272bc0['query'][_0x19b0('0x30')]);_0x17d9de[_0x19b0('0x2e')]=qs['offset'](_0x272bc0[_0x19b0('0x46')][_0x19b0('0x2e')]);}_0x17d9de[_0x19b0('0x4d')]=qs[_0x19b0('0x4e')](_0x272bc0[_0x19b0('0x46')][_0x19b0('0x4e')]);_0x17d9de['where']=qs['filters'](_[_0x19b0('0x50')](_0x272bc0['query'],_0x346df6[_0x19b0('0x48')]));_0x17d9de[_0x19b0('0x4f')][_0x19b0('0x68')]=_0x48e766['id'];if(_0x272bc0['query']['filter']){_0x17d9de[_0x19b0('0x4f')]=_[_0x19b0('0x51')](_0x17d9de[_0x19b0('0x4f')],{'$or':_[_0x19b0('0x40')](_0x17d9de[_0x19b0('0x4a')],function(_0x4df594){var _0x2008f4={};_0x2008f4[_0x4df594]={'$like':'%'+_0x272bc0[_0x19b0('0x46')][_0x19b0('0x53')]+'%'};return _0x2008f4;})});}_0x17d9de=_[_0x19b0('0x51')]({},_0x17d9de,_0x272bc0[_0x19b0('0x54')]);return db['CannedAnswer'][_0x19b0('0x55')]({'where':_0x17d9de[_0x19b0('0x4f')]})[_0x19b0('0x36')](function(_0x57337e){_0x32a928[_0x19b0('0x55')]=_0x57337e;if(_0x272bc0[_0x19b0('0x46')]['includeAll']){_0x17d9de[_0x19b0('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x19b0('0x6d')](_0x17d9de);})[_0x19b0('0x36')](function(_0x1a86fa){_0x32a928[_0x19b0('0x57')]=_0x1a86fa;return _0x32a928;});}})[_0x19b0('0x36')](respondWithFilteredResult(_0x1fbacf,_0x17d9de))['catch'](handleError(_0x1fbacf,null));};exports[_0x19b0('0x72')]=function(_0x3365dd,_0x55fb95,_0x432e37){return db[_0x19b0('0x41')]['find']({'where':{'id':_0x3365dd['params']['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x55fb95,null))[_0x19b0('0x36')](function(_0x2b8253){if(_0x2b8253){return _0x2b8253[_0x19b0('0x72')](_0x3365dd[_0x19b0('0x46')][_0x19b0('0x73')]);}})['then'](respondWithStatusCode(_0x55fb95,null))[_0x19b0('0x2a')](handleError(_0x55fb95,null));};exports[_0x19b0('0x74')]=function(_0x5955e7,_0x4a93a3,_0x467a8e){return db[_0x19b0('0x75')]['find']({'where':{'id':_0x5955e7[_0x19b0('0x59')]['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x4a93a3,null))['then'](function(_0x49bafc){if(_0x49bafc){return _0x49bafc[_0x19b0('0x74')](_0x5955e7['body'][_0x19b0('0x73')],_[_0x19b0('0x76')](_0x5955e7['body'],[_0x19b0('0x73'),'id'])||{});}})['then'](respondWithResult(_0x4a93a3,null))[_0x19b0('0x2a')](handleError(_0x4a93a3,null));};exports[_0x19b0('0x77')]=function(_0x480e26,_0x113db4,_0x3598bf){var _0xa3ce90={'raw':![],'where':{}};var _0x12ba24={};var _0x315937={'count':0x0,'rows':[]};return db[_0x19b0('0x41')]['findOne']({'where':{'id':_0x480e26['params']['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x113db4,null))[_0x19b0('0x36')](function(_0x3220bb){if(_0x3220bb){_0x12ba24[_0x19b0('0x45')]=_[_0x19b0('0x47')](db[_0x19b0('0x75')]['rawAttributes']);_0x12ba24[_0x19b0('0x46')]=_['keys'](_0x480e26[_0x19b0('0x46')]);_0x12ba24[_0x19b0('0x48')]=_[_0x19b0('0x49')](_0x12ba24[_0x19b0('0x45')],_0x12ba24[_0x19b0('0x46')]);_0xa3ce90[_0x19b0('0x4a')]=_['intersection'](_0x12ba24[_0x19b0('0x45')],qs[_0x19b0('0x4b')](_0x480e26['query'][_0x19b0('0x4b')]));_0xa3ce90[_0x19b0('0x4a')]=_0xa3ce90['attributes'][_0x19b0('0x4c')]?_0xa3ce90[_0x19b0('0x4a')]:_0x12ba24[_0x19b0('0x45')];if(!_0x480e26[_0x19b0('0x46')][_0x19b0('0x6b')](_0x19b0('0x6c'))){_0xa3ce90[_0x19b0('0x30')]=qs[_0x19b0('0x30')](_0x480e26[_0x19b0('0x46')][_0x19b0('0x30')]);_0xa3ce90['offset']=qs[_0x19b0('0x2e')](_0x480e26['query'][_0x19b0('0x2e')]);}_0xa3ce90[_0x19b0('0x4d')]=qs[_0x19b0('0x4e')](_0x480e26[_0x19b0('0x46')][_0x19b0('0x4e')]);_0xa3ce90[_0x19b0('0x4f')]=qs['filters'](_[_0x19b0('0x50')](_0x480e26[_0x19b0('0x46')],_0x12ba24[_0x19b0('0x48')]));_0xa3ce90[_0x19b0('0x4f')]['FaxAccountId']=_0x3220bb['id'];if(_0x480e26['query'][_0x19b0('0x53')]){_0xa3ce90[_0x19b0('0x4f')]=_[_0x19b0('0x51')](_0xa3ce90[_0x19b0('0x4f')],{'$or':_[_0x19b0('0x40')](_0xa3ce90[_0x19b0('0x4a')],function(_0x8235a7){var _0x80a9ae={};_0x80a9ae[_0x8235a7]={'$like':'%'+_0x480e26[_0x19b0('0x46')]['filter']+'%'};return _0x80a9ae;})});}_0xa3ce90=_[_0x19b0('0x51')]({},_0xa3ce90,_0x480e26[_0x19b0('0x54')]);return db[_0x19b0('0x75')][_0x19b0('0x55')]({'where':_0xa3ce90['where']})[_0x19b0('0x36')](function(_0x44c82c){_0x315937['count']=_0x44c82c;if(_0x480e26[_0x19b0('0x46')][_0x19b0('0x56')]){_0xa3ce90['include']=[{'model':db[_0x19b0('0x78')],'as':_0x19b0('0x79'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x19b0('0x7a'),_0x19b0('0x7b')],'required':![]},{'model':db[_0x19b0('0x7c')],'as':_0x19b0('0x7d'),'attributes':['id','name',_0x19b0('0x7e')],'where':_0x480e26['query']['tag']?{'id':_0x480e26['query'][_0x19b0('0x7f')]}:undefined,'required':_0x480e26[_0x19b0('0x46')][_0x19b0('0x7f')]?!![]:![]}];}return db[_0x19b0('0x75')][_0x19b0('0x6d')](_0xa3ce90);})[_0x19b0('0x36')](function(_0xfe596d){_0x315937[_0x19b0('0x57')]=_0xfe596d;return _0x315937;});}})[_0x19b0('0x36')](respondWithFilteredResult(_0x113db4,_0xa3ce90))[_0x19b0('0x2a')](handleError(_0x113db4,null));};exports[_0x19b0('0x80')]=function(_0x25398a,_0x219e0a){var _0x18a745=_0x25398a[_0x19b0('0x59')]['id'];var _0x1a013e=_0x25398a[_0x19b0('0x65')];var _0x510a06=0xc8;var _0x245f13=null;return db['sequelize'][_0x19b0('0x81')]({'isolationLevel':db['sequelize'][_0x19b0('0x82')][_0x19b0('0x83')][_0x19b0('0x84')]},function(_0x292d88){return db[_0x19b0('0x41')][_0x19b0('0x71')]({'where':{'id':_0x18a745},'transaction':_0x292d88})['then'](function(_0x3e7d71){if(_0x3e7d71){return db[_0x19b0('0x85')][_0x19b0('0x39')]({'where':{'FaxAccountId':_0x18a745},'transaction':_0x292d88})[_0x19b0('0x36')](function(){var _0x44f895=_['map'](_0x1a013e,function(_0xa44f3b){_0xa44f3b['FaxAccountId']=_0x18a745;return _0xa44f3b;});return db['FaxApplication'][_0x19b0('0x86')](_0x44f895,{'transaction':_0x292d88});});}else{_0x510a06=0x194;_0x245f13=[];}});})[_0x19b0('0x36')](function(){if(_0x510a06!==0x194){return db[_0x19b0('0x85')][_0x19b0('0x87')]({'where':{'FaxAccountId':_0x18a745},'order':'priority'})[_0x19b0('0x36')](function(_0xba11f0){_0x245f13=_0xba11f0;});}})[_0x19b0('0x2a')](function(_0x32041d){_0x510a06=0x1f4;logger[_0x19b0('0x27')](_0x32041d[_0x19b0('0x3b')]);if(_0x32041d[_0x19b0('0x3c')]){delete _0x32041d[_0x19b0('0x3c')];}_0x245f13=_0x32041d;})[_0x19b0('0x88')](function(){if(_0x245f13===null){_0x219e0a['sendStatus'](_0x510a06);}else{if(_0x510a06===0x1f4){_0x219e0a[_0x19b0('0x2c')](_0x510a06)['send'](_0x245f13);}else{_0x219e0a[_0x19b0('0x2c')](_0x510a06)[_0x19b0('0x2d')](_0x245f13);}}});};exports[_0x19b0('0x89')]=function(_0x5b61ee,_0x2a1cb4,_0x1cc5c2){var _0x429571={};var _0x4e08ed={};var _0x294f21;var _0x3a2a0a;return db[_0x19b0('0x41')][_0x19b0('0x71')]({'where':{'id':_0x5b61ee[_0x19b0('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a1cb4,null))[_0x19b0('0x36')](function(_0x4da0b4){if(_0x4da0b4){_0x294f21=_0x4da0b4;_0x4e08ed['model']=_[_0x19b0('0x47')](db['FaxApplication'][_0x19b0('0x42')]);_0x4e08ed[_0x19b0('0x46')]=_[_0x19b0('0x47')](_0x5b61ee[_0x19b0('0x46')]);_0x4e08ed[_0x19b0('0x48')]=_[_0x19b0('0x49')](_0x4e08ed[_0x19b0('0x45')],_0x4e08ed['query']);_0x429571[_0x19b0('0x4a')]=_[_0x19b0('0x49')](_0x4e08ed[_0x19b0('0x45')],qs['fields'](_0x5b61ee['query'][_0x19b0('0x4b')]));_0x429571[_0x19b0('0x4a')]=_0x429571['attributes'][_0x19b0('0x4c')]?_0x429571[_0x19b0('0x4a')]:_0x4e08ed[_0x19b0('0x45')];_0x429571[_0x19b0('0x4d')]=qs['sort'](_0x5b61ee[_0x19b0('0x46')][_0x19b0('0x4e')]);_0x429571['where']=qs[_0x19b0('0x48')](_['pick'](_0x5b61ee[_0x19b0('0x46')],_0x4e08ed[_0x19b0('0x48')]));if(_0x5b61ee['query']['filter']){_0x429571[_0x19b0('0x4f')]=_[_0x19b0('0x51')](_0x429571[_0x19b0('0x4f')],{'$or':_[_0x19b0('0x40')](_0x429571['attributes'],function(_0xcce3bf){var _0x121544={};_0x121544[_0xcce3bf]={'$like':'%'+_0x5b61ee[_0x19b0('0x46')][_0x19b0('0x53')]+'%'};return _0x121544;})});}_0x429571=_['merge']({},_0x429571,_0x5b61ee[_0x19b0('0x54')]);return _0x294f21[_0x19b0('0x89')](_0x429571);}})['then'](function(_0x2f94d7){if(_0x2f94d7){_0x3a2a0a=_0x2f94d7[_0x19b0('0x4c')];if(!_0x5b61ee[_0x19b0('0x46')][_0x19b0('0x6b')]('nolimit')){_0x429571[_0x19b0('0x30')]=qs[_0x19b0('0x30')](_0x5b61ee[_0x19b0('0x46')][_0x19b0('0x30')]);_0x429571[_0x19b0('0x2e')]=qs[_0x19b0('0x2e')](_0x5b61ee[_0x19b0('0x46')][_0x19b0('0x2e')]);}return _0x294f21[_0x19b0('0x89')](_0x429571);}})[_0x19b0('0x36')](function(_0x2c3ad2){if(_0x2c3ad2){return _0x2c3ad2?{'count':_0x3a2a0a,'rows':_0x2c3ad2}:null;}})[_0x19b0('0x36')](respondWithResult(_0x2a1cb4,null))[_0x19b0('0x2a')](handleError(_0x2a1cb4,null));};function Extension(_0x2aa30d,_0x1b3a0f,_0x5de39e,_0x3bd44b){this[_0x19b0('0x8a')]=_0x19b0('0x8b');this[_0x19b0('0x8c')]=_0x2aa30d[_0x19b0('0x8d')];this[_0x19b0('0x8e')]=_0x3bd44b;this[_0x19b0('0x43')]=_0x19b0('0x8f');this['description']='Fax\x20Extension';this[_0x19b0('0x68')]=_0x2aa30d['id'];this[_0x19b0('0x90')]=_0x1b3a0f;this[_0x19b0('0x91')]=_0x5de39e;}function createExtensionsReciveFax(_0x3eacc5){var _0x22ca13=0x1;var _0x11c6a0=[];_0x11c6a0[_0x19b0('0x92')](new Extension(_0x3eacc5,_0x22ca13,'','Answer'));_0x22ca13+=0x1;_0x11c6a0[_0x19b0('0x92')](new Extension(_0x3eacc5,_0x22ca13,_0x19b0('0x93'),_0x19b0('0x94')));_0x22ca13+=0x1;for(var _0x2eb2e1 in _0x3eacc5){if(_0x3eacc5[_0x19b0('0x6b')](_0x2eb2e1)&&(_0x2eb2e1===_0x19b0('0x95')||_0x2eb2e1===_0x19b0('0x8d')||_0x2eb2e1==='gateway'||_0x2eb2e1==='faxdetect'||_0x2eb2e1===_0x19b0('0x96')||_0x2eb2e1===_0x19b0('0x97')||_0x2eb2e1===_0x19b0('0x98')||_0x2eb2e1===_0x19b0('0x99')||_0x2eb2e1===_0x19b0('0x9a'))){_0x11c6a0[_0x19b0('0x92')](new Extension(_0x3eacc5,_0x22ca13,_0x19b0('0x9b')+_0x2eb2e1+')='+_0x3eacc5[_0x2eb2e1],_0x19b0('0x94')));_0x22ca13+=0x1;}}_0x11c6a0['push'](new Extension(_0x3eacc5,_0x22ca13,'6','Wait'));_0x22ca13+=0x1;_0x11c6a0[_0x19b0('0x92')](new Extension(_0x3eacc5,_0x22ca13,_0x19b0('0x9c'),_0x19b0('0x9d')));_0x22ca13=0x0;return _0x11c6a0;}exports['addAccountApplications']=function(_0x23f6c5,_0x289a82,_0x40ff98){var _0xe101a0;return db['sequelize'][_0x19b0('0x81')](function(_0x232d34){return db[_0x19b0('0x41')][_0x19b0('0x5d')](_0x23f6c5['body'],{'transaction':_0x232d34})[_0x19b0('0x36')](function(_0x15edb7){_0xe101a0=_0x15edb7[_0x19b0('0x5f')]({'plain':!![]});return db[_0x19b0('0x9e')][_0x19b0('0x86')](createExtensionsReciveFax(_0xe101a0),{'transaction':_0x232d34});});})[_0x19b0('0x36')](function(){return _0xe101a0;})['then'](respondWithResult(_0x289a82,null))[_0x19b0('0x2a')](handleError(_0x289a82,null));};exports['updateAccountApplications']=function(_0x1bac95,_0xa3aab3,_0x1dbf6a){var _0x118284;return db[_0x19b0('0x9f')][_0x19b0('0x81')](function(_0x15fd66){return db[_0x19b0('0x41')][_0x19b0('0x35')](_0x1bac95[_0x19b0('0x65')],{'where':{'id':_0x1bac95[_0x19b0('0x65')]['id']},'transaction':_0x15fd66})[_0x19b0('0x36')](function(_0x21985b){return db[_0x19b0('0x9e')][_0x19b0('0x39')]({'where':{'FaxAccountId':_0x1bac95['body']['id']},'transaction':_0x15fd66})[_0x19b0('0x36')](function(_0x33f5f4){return db[_0x19b0('0x9e')]['bulkCreate'](createExtensionsReciveFax(_[_0x19b0('0x76')](_0x1bac95[_0x19b0('0x65')],[_0x19b0('0xa0'),_0x19b0('0x44'),_0x19b0('0xa1'),_0x19b0('0xa2'),_0x19b0('0xa3'),'ListId'])),{'transaction':_0x15fd66});});});})['then'](function(){return db[_0x19b0('0x41')][_0x19b0('0xa4')](_0x1bac95[_0x19b0('0x65')]['id']);})[_0x19b0('0x36')](respondWithResult(_0xa3aab3,null))['catch'](handleError(_0xa3aab3,null));};exports[_0x19b0('0xa5')]=function(_0x104836,_0x5bf124,_0x5b819d){var _0x80c0d8={'raw':!![],'where':{}};var _0x2dce16={};var _0x2dbe5a={'count':0x0,'rows':[]};return db[_0x19b0('0x41')][_0x19b0('0x71')]({'where':{'id':_0x104836[_0x19b0('0x59')]['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x5bf124,null))[_0x19b0('0x36')](function(_0x1cfdb7){if(_0x1cfdb7){_0x2dce16[_0x19b0('0x45')]=_[_0x19b0('0x47')](db[_0x19b0('0xa6')][_0x19b0('0x42')]);_0x2dce16[_0x19b0('0x46')]=_[_0x19b0('0x47')](_0x104836[_0x19b0('0x46')]);_0x2dce16[_0x19b0('0x48')]=_[_0x19b0('0x49')](_0x2dce16[_0x19b0('0x45')],_0x2dce16[_0x19b0('0x46')]);_0x80c0d8[_0x19b0('0x4a')]=_['intersection'](_0x2dce16[_0x19b0('0x45')],qs[_0x19b0('0x4b')](_0x104836[_0x19b0('0x46')][_0x19b0('0x4b')]));_0x80c0d8[_0x19b0('0x4a')]=_0x80c0d8[_0x19b0('0x4a')][_0x19b0('0x4c')]?_0x80c0d8['attributes']:_0x2dce16['model'];if(!_0x104836[_0x19b0('0x46')]['hasOwnProperty'](_0x19b0('0x6c'))){_0x80c0d8['limit']=qs[_0x19b0('0x30')](_0x104836[_0x19b0('0x46')][_0x19b0('0x30')]);_0x80c0d8['offset']=qs[_0x19b0('0x2e')](_0x104836[_0x19b0('0x46')][_0x19b0('0x2e')]);}_0x80c0d8[_0x19b0('0x4d')]=qs[_0x19b0('0x4e')](_0x104836[_0x19b0('0x46')]['sort']);_0x80c0d8[_0x19b0('0x4f')]=qs[_0x19b0('0x48')](_[_0x19b0('0x50')](_0x104836[_0x19b0('0x46')],_0x2dce16[_0x19b0('0x48')]));_0x80c0d8[_0x19b0('0x4f')]['FaxAccountId']=_0x1cfdb7['id'];if(_0x104836[_0x19b0('0x46')][_0x19b0('0x53')]){_0x80c0d8[_0x19b0('0x4f')]=_[_0x19b0('0x51')](_0x80c0d8[_0x19b0('0x4f')],{'$or':_[_0x19b0('0x40')](_0x80c0d8[_0x19b0('0x4a')],function(_0x5d7aea){var _0x485178={};_0x485178[_0x5d7aea]={'$like':'%'+_0x104836['query'][_0x19b0('0x53')]+'%'};return _0x485178;})});}if(_0x104836['query'][_0x19b0('0xa7')]){var _0x1ea405=_0x104836[_0x19b0('0x46')][_0x19b0('0xa7')][_0x19b0('0xa8')](',');var _0x153168={};_0x153168[_0x1ea405[0x0]]={'$gte':moment(_0x1ea405[0x1])[_0x19b0('0xa9')](_0x19b0('0xaa'))};_0x80c0d8['where']=_[_0x19b0('0x51')](_0x80c0d8[_0x19b0('0x4f')],_0x153168);}_0x80c0d8=_[_0x19b0('0x51')]({},_0x80c0d8,_0x104836[_0x19b0('0x54')]);return db[_0x19b0('0xa6')][_0x19b0('0x55')]({'where':_0x80c0d8['where']})[_0x19b0('0x36')](function(_0x3d533b){_0x2dbe5a['count']=_0x3d533b;if(_0x104836[_0x19b0('0x46')]['includeAll']){_0x80c0d8['include']=[{'all':!![]}];}return db[_0x19b0('0xa6')][_0x19b0('0x6d')](_0x80c0d8);})['then'](function(_0x109495){_0x2dbe5a[_0x19b0('0x57')]=_0x109495;return _0x2dbe5a;});}})['then'](respondWithFilteredResult(_0x5bf124,_0x80c0d8))[_0x19b0('0x2a')](handleError(_0x5bf124,null));};exports[_0x19b0('0x3d')]=function(_0x8b4f06,_0x11ac8a,_0x1a8cfb){var _0x281974,_0x512288={},_0x2efbe1;if(_0x8b4f06[_0x19b0('0x65')]['to']){_0x2efbe1=_0x8b4f06[_0x19b0('0x65')]['to'][0x0];}return db[_0x19b0('0x41')][_0x19b0('0x5c')]({'where':{'id':_0x8b4f06[_0x19b0('0x59')]['id']},'include':[{'model':db[_0x19b0('0xab')],'as':_0x19b0('0xac'),'include':[{'model':db[_0x19b0('0x78')],'as':_0x19b0('0xad'),'where':{'fax':_0x2efbe1},'limit':0x1,'order':[[_0x19b0('0xa2'),_0x19b0('0xae')]]}]}]})[_0x19b0('0x36')](handleEntityNotFound(_0x11ac8a,null))[_0x19b0('0x36')](function(_0x53327d){_0x281974=_0x53327d;if(_0x8b4f06['body'][_0x19b0('0xaf')]&&_0x8b4f06[_0x19b0('0x65')]['attachments'][_0x19b0('0x4c')]){for(var _0x32152f=0x0;_0x32152f<_0x8b4f06[_0x19b0('0x65')][_0x19b0('0xaf')]['length'];_0x32152f+=0x1){_0x8b4f06[_0x19b0('0x65')]['attachments'][_0x32152f]={'filename':_0x8b4f06[_0x19b0('0x65')][_0x19b0('0xaf')][_0x32152f][_0x19b0('0x3c')],'id':_0x8b4f06[_0x19b0('0x65')][_0x19b0('0xaf')][_0x32152f]['id'],'path':path[_0x19b0('0xb0')](config['root'],_0x19b0('0xb1'),_0x8b4f06['body'][_0x19b0('0xaf')][_0x32152f][_0x19b0('0xb2')])};}}return respondWithRpcPromise(_0x19b0('0xb3'),_0x19b0('0xb3'),{'FaxAccountId':_['isNil'](_0x8b4f06['params']['id'])?undefined:_0x8b4f06[_0x19b0('0x59')]['id'],'path':_[_0x19b0('0xb4')](_0x8b4f06[_0x19b0('0x65')]['attachments'][0x0][_0x19b0('0x6')])?undefined:_0x8b4f06[_0x19b0('0x65')]['attachments'][0x0][_0x19b0('0x6')],'fax':_[_0x19b0('0xb4')](_0x8b4f06[_0x19b0('0x65')]['to'][0x0])?undefined:_0x8b4f06[_0x19b0('0x65')]['to'][0x0]},client9002);})[_0x19b0('0x36')](function(){if(_0x281974){if(_['isNil'](_0x8b4f06['body'][_0x19b0('0xb5')])){_0x8b4f06[_0x19b0('0x65')][_0x19b0('0xb5')]=util[_0x19b0('0xa9')]('\x22%s\x22\x20<%s>',_0x281974[_0x19b0('0x3c')],_0x281974[_0x19b0('0xb6')]);}if(_0x281974[_0x19b0('0xac')]){if(_0x281974['List'][_0x19b0('0xad')][_0x19b0('0x4c')]){return _0x281974[_0x19b0('0xac')]['Contacts'][0x0];}else{return db[_0x19b0('0x78')]['create'](_['defaults'](_0x8b4f06[_0x19b0('0x65')],{'firstName':_0x8b4f06[_0x19b0('0x65')]['to'][0x0],'phone':_0x8b4f06['body']['to'][0x0],'fax':_0x8b4f06['body']['to'][0x0],'ListId':_0x281974['ListId']}));}}else{throw new Error(_0x19b0('0xb7'));}}else{throw new Error(_0x19b0('0xb8'));}})['then'](function(_0x2aa009){if(_0x2aa009){return db[_0x19b0('0x75')][_0x19b0('0x5c')]({'where':{'ContactId':_0x2aa009['id'],'closed':![],'FaxAccountId':_0x281974['id']}})[_0x19b0('0x36')](function(_0x536c98){if(_0x536c98){return[_0x536c98,![]];}return db[_0x19b0('0x75')]['create']({'UserId':_0x8b4f06['user']['id'],'ContactId':_0x2aa009['id'],'FaxAccountId':_0x281974['id'],'fax':_0x8b4f06[_0x19b0('0x65')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x19b0('0x51')](_0x8b4f06['body'],{'read':![],'body':_0x8b4f06[_0x19b0('0x65')][_0x19b0('0xaf')][0x0]['filename'],'FaxAccountId':_0x281974['id'],'UserId':_0x8b4f06['user']['id'],'ContactId':_0x2aa009['id'],'AttachmentId':_0x8b4f06[_0x19b0('0x65')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x19b0('0xa6')],'as':_0x19b0('0xb9')}]})['then'](function(_0xf0b6ed){return[_0xf0b6ed,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x19b0('0xba')](function(_0x96289,_0x1ae5dd){if(_0x1ae5dd){return _0x96289;}return db['FaxMessage'][_0x19b0('0x5d')]({'direction':_0x19b0('0xbb'),'read':![],'body':_0x8b4f06['body'][_0x19b0('0xaf')][0x0][_0x19b0('0xbc')],'FaxAccountId':_0x281974['id'],'FaxInteractionId':_0x96289['id'],'UserId':_0x8b4f06[_0x19b0('0x5e')]['id'],'ContactId':_0x96289[_0x19b0('0xbd')],'AttachmentId':_0x8b4f06['body'][_0x19b0('0xaf')][0x0]['id']})[_0x19b0('0x36')](function(_0x1b011c){_0x96289[_0x19b0('0xbe')]['Messages']=[];_0x96289[_0x19b0('0xbe')]['Messages']['push'](_0x1b011c[_0x19b0('0xbe')]);return _0x96289;});})[_0x19b0('0x36')](function(_0x5f28ee){respondWithRpcPromise(_0x19b0('0xbf'),_0x19b0('0xbf'),{'FaxAccountId':_[_0x19b0('0xb4')](_0x8b4f06[_0x19b0('0x59')]['id'])?undefined:_0x8b4f06['params']['id'],'path':_[_0x19b0('0xb4')](_0x8b4f06[_0x19b0('0x65')][_0x19b0('0xaf')][0x0][_0x19b0('0x6')])?undefined:_0x8b4f06[_0x19b0('0x65')]['attachments'][0x0][_0x19b0('0x6')],'fax':_[_0x19b0('0xb4')](_0x8b4f06[_0x19b0('0x65')]['to'][0x0])?undefined:_0x8b4f06[_0x19b0('0x65')]['to'][0x0],'AttachmentId':_0x8b4f06[_0x19b0('0x65')][_0x19b0('0xaf')][0x0]['id']},client9002)[_0x19b0('0x36')](function(_0x371dc0){logger[_0x19b0('0x22')]('SendFaxRpc,\x20%s',_0x371dc0);})[_0x19b0('0x2a')](function(_0x2856a8){logger[_0x19b0('0x22')](_0x19b0('0xc0'),_0x2856a8);});return _0x5f28ee;})['then'](respondWithResult(_0x11ac8a,null))['catch'](handleError(_0x11ac8a,null));};exports['addAgents']=function(_0x21e3e8,_0x101460,_0xb8c1be){return db[_0x19b0('0x41')][_0x19b0('0x5c')]({'where':{'id':_0x21e3e8[_0x19b0('0x59')]['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x101460,null))['then'](function(_0x531b53){if(_0x531b53){return _0x531b53['addAgents'](_0x21e3e8[_0x19b0('0x65')][_0x19b0('0x73')],_[_0x19b0('0x76')](_0x21e3e8[_0x19b0('0x65')],[_0x19b0('0x73'),'id'])||{})[_0x19b0('0xba')](function(_0xbca267){for(var _0x33f6ed=0x0;_0x33f6ed<_0x21e3e8[_0x19b0('0x65')][_0x19b0('0x73')][_0x19b0('0x4c')];_0x33f6ed+=0x1){socket[_0x19b0('0xc1')](_0x19b0('0xc2'),{'UserId':Number(_0x21e3e8['body'][_0x19b0('0x73')][_0x33f6ed]),'FaxAccountId':Number(_0x21e3e8[_0x19b0('0x59')]['id'])});}return _0xbca267;});}})['then'](respondWithResult(_0x101460,null))[_0x19b0('0x2a')](handleError(_0x101460,null));};exports[_0x19b0('0xc3')]=function(_0x1824f1,_0x2ee218,_0x561460){return db['FaxAccount'][_0x19b0('0x5c')]({'where':{'id':_0x1824f1[_0x19b0('0x59')]['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x2ee218,null))['then'](function(_0x36aa20){if(_0x36aa20){return _0x36aa20[_0x19b0('0xc3')](_0x1824f1[_0x19b0('0x46')][_0x19b0('0x73')])['then'](function(){if(_[_0x19b0('0xc4')](_0x1824f1['query'][_0x19b0('0x73')])){for(var _0x4043c8=0x0;_0x4043c8<_0x1824f1['query']['ids'][_0x19b0('0x4c')];_0x4043c8+=0x1){socket[_0x19b0('0xc1')](_0x19b0('0xc5'),{'UserId':Number(_0x1824f1[_0x19b0('0x46')][_0x19b0('0x73')][_0x4043c8]),'FaxAccountId':Number(_0x1824f1[_0x19b0('0x59')]['id'])});}}else{socket[_0x19b0('0xc1')](_0x19b0('0xc5'),{'UserId':Number(_0x1824f1[_0x19b0('0x46')][_0x19b0('0x73')]),'FaxAccountId':Number(_0x1824f1[_0x19b0('0x59')]['id'])});}});}})[_0x19b0('0x36')](respondWithStatusCode(_0x2ee218,null))[_0x19b0('0x2a')](handleError(_0x2ee218,null));};exports[_0x19b0('0xc6')]=function(_0xb92a57,_0x17dff7,_0x390ada){var _0x23882d={};var _0x2b161e={};var _0x3f52c7;var _0x19e3c2;return db[_0x19b0('0x41')][_0x19b0('0x71')]({'where':{'id':_0xb92a57['params']['id']}})[_0x19b0('0x36')](handleEntityNotFound(_0x17dff7,null))[_0x19b0('0x36')](function(_0x275735){if(_0x275735){_0x3f52c7=_0x275735;_0x2b161e[_0x19b0('0x45')]=_[_0x19b0('0x47')](db[_0x19b0('0xc7')][_0x19b0('0x42')]);_0x2b161e[_0x19b0('0x46')]=_[_0x19b0('0x47')](_0xb92a57[_0x19b0('0x46')]);_0x2b161e['filters']=_[_0x19b0('0x49')](_0x2b161e[_0x19b0('0x45')],_0x2b161e[_0x19b0('0x46')]);_0x23882d[_0x19b0('0x4a')]=_[_0x19b0('0x49')](_0x2b161e['model'],qs[_0x19b0('0x4b')](_0xb92a57['query'][_0x19b0('0x4b')]));_0x23882d[_0x19b0('0x4a')]=_0x23882d[_0x19b0('0x4a')][_0x19b0('0x4c')]?_0x23882d[_0x19b0('0x4a')]:_0x2b161e[_0x19b0('0x45')];_0x23882d[_0x19b0('0x4d')]=qs[_0x19b0('0x4e')](_0xb92a57[_0x19b0('0x46')]['sort']);_0x23882d[_0x19b0('0x4f')]=qs[_0x19b0('0x48')](_['pick'](_0xb92a57['query'],_0x2b161e[_0x19b0('0x48')]));if(_0xb92a57[_0x19b0('0x46')]['filter']){_0x23882d[_0x19b0('0x4f')]=_['merge'](_0x23882d[_0x19b0('0x4f')],{'$or':_['map'](_0x23882d['attributes'],function(_0x569cae){var _0x4f7079={};_0x4f7079[_0x569cae]={'$like':'%'+_0xb92a57[_0x19b0('0x46')][_0x19b0('0x53')]+'%'};return _0x4f7079;})});}_0x23882d=_[_0x19b0('0x51')]({},_0x23882d,_0xb92a57[_0x19b0('0x54')]);return _0x3f52c7[_0x19b0('0xc6')](_0x23882d);}})[_0x19b0('0x36')](function(_0x20471c){if(_0x20471c){_0x19e3c2=_0x20471c[_0x19b0('0x4c')];if(!_0xb92a57[_0x19b0('0x46')][_0x19b0('0x6b')]('nolimit')){_0x23882d[_0x19b0('0x30')]=qs[_0x19b0('0x30')](_0xb92a57[_0x19b0('0x46')]['limit']);_0x23882d[_0x19b0('0x2e')]=qs[_0x19b0('0x2e')](_0xb92a57[_0x19b0('0x46')][_0x19b0('0x2e')]);}return _0x3f52c7['getAgents'](_0x23882d);}})[_0x19b0('0x36')](function(_0x36d6c7){if(_0x36d6c7){return _0x36d6c7?{'count':_0x19e3c2,'rows':_0x36d6c7}:null;}})[_0x19b0('0x36')](respondWithResult(_0x17dff7,null))['catch'](handleError(_0x17dff7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index fca38c3..9b8ecbf 100644 --- a/server/api/faxAccount/faxAccount.events.js +++ b/server/api/faxAccount/faxAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bca=['events','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x2bca,0x19a));var _0xa2bc=function(_0x37f674,_0x196b6e){_0x37f674=_0x37f674-0x0;var _0x4c19c8=_0x2bca[_0x37f674];return _0x4c19c8;};'use strict';var EventEmitter=require(_0xa2bc('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xa2bc('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa2bc('0x2')](0x0);var events={'afterCreate':_0xa2bc('0x3'),'afterUpdate':_0xa2bc('0x4'),'afterDestroy':_0xa2bc('0x5')};function emitEvent(_0x2f35b3){return function(_0x45a9bc,_0x981a32,_0x4f9294){FaxAccountEvents[_0xa2bc('0x6')](_0x2f35b3+':'+_0x45a9bc['id'],_0x45a9bc);FaxAccountEvents[_0xa2bc('0x6')](_0x2f35b3,_0x45a9bc);_0x4f9294(null);};}for(var e in events){if(events[_0xa2bc('0x7')](e)){var event=events[e];FaxAccount[_0xa2bc('0x8')](e,emitEvent(event));}}module[_0xa2bc('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xcb21=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x1371f5,_0x4284d7){var _0x34849d=function(_0x17fca9){while(--_0x17fca9){_0x1371f5['push'](_0x1371f5['shift']());}};_0x34849d(++_0x4284d7);}(_0xcb21,0x1b0));var _0x1cb2=function(_0x2efc07,_0x427db4){_0x2efc07=_0x2efc07-0x0;var _0xb625c8=_0xcb21[_0x2efc07];return _0xb625c8;};'use strict';var EventEmitter=require(_0x1cb2('0x0'));var FaxAccount=require(_0x1cb2('0x1'))['db'][_0x1cb2('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1cb2('0x3')](0x0);var events={'afterCreate':_0x1cb2('0x4'),'afterUpdate':_0x1cb2('0x5'),'afterDestroy':_0x1cb2('0x6')};function emitEvent(_0x3122bc){return function(_0xd134f5,_0x11a580,_0x382c42){FaxAccountEvents[_0x1cb2('0x7')](_0x3122bc+':'+_0xd134f5['id'],_0xd134f5);FaxAccountEvents[_0x1cb2('0x7')](_0x3122bc,_0xd134f5);_0x382c42(null);};}for(var e in events){if(events[_0x1cb2('0x8')](e)){var event=events[e];FaxAccount[_0x1cb2('0x9')](e,emitEvent(event));}}module[_0x1cb2('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 234ee73..ec4b622 100644 --- a/server/api/faxAccount/faxAccount.model.js +++ b/server/api/faxAccount/faxAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x889f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define','FaxAccount'];(function(_0x195fbb,_0x3e7933){var _0x6c5304=function(_0x124714){while(--_0x124714){_0x195fbb['push'](_0x195fbb['shift']());}};_0x6c5304(++_0x3e7933);}(_0x889f,0x190));var _0xf889=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x889f[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xf889('0x0'));var util=require(_0xf889('0x1'));var logger=require(_0xf889('0x2'))('api');var moment=require(_0xf889('0x3'));var BPromise=require(_0xf889('0x4'));var rp=require(_0xf889('0x5'));var fs=require('fs');var path=require(_0xf889('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xf889('0x7')]=function(_0x547606,_0x562a20){return _0x547606[_0xf889('0x8')](_0xf889('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x018a=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','fax_accounts'];(function(_0x38a3b8,_0xfcf481){var _0xbf92e2=function(_0x1de826){while(--_0x1de826){_0x38a3b8['push'](_0x38a3b8['shift']());}};_0xbf92e2(++_0xfcf481);}(_0x018a,0xe6));var _0xa018=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x018a[_0x3a4f18];return _0x4c20fc;};'use strict';var _=require(_0xa018('0x0'));var util=require(_0xa018('0x1'));var logger=require(_0xa018('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa018('0x3'));var rp=require(_0xa018('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa018('0x5'));var config=require(_0xa018('0x6'));var attributes=require('./faxAccount.attributes');module[_0xa018('0x7')]=function(_0x5c8c57,_0x403f91){return _0x5c8c57[_0xa018('0x8')]('FaxAccount',attributes,{'tableName':_0xa018('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 5a14d5e..735cc52 100644 --- a/server/api/faxAccount/faxAccount.rpc.js +++ b/server/api/faxAccount/faxAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4119=['createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','Applications','get','applications','list','orderBy','priority','defaults','ListId','create','FaxInteraction','autoclose','push','length','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','User','name','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetFaxAccount','FaxAccount','options','where','limit','include','model','attributes','map','then','stringify','catch','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4119,0xe1));var _0x9411=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x4119[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x9411('0x0'));var util=require(_0x9411('0x1'));var moment=require(_0x9411('0x2'));var BPromise=require(_0x9411('0x3'));var rs=require(_0x9411('0x4'));var fs=require('fs');var Redis=require(_0x9411('0x5'));var db=require(_0x9411('0x6'))['db'];var utils=require(_0x9411('0x7'));var logger=require(_0x9411('0x8'))(_0x9411('0x9'));var config=require(_0x9411('0xa'));var jayson=require(_0x9411('0xb'));var client=jayson[_0x9411('0xc')][_0x9411('0xd')]({'port':0x232c});config[_0x9411('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9411('0xf'))(new Redis(config[_0x9411('0xe')]));require(_0x9411('0x10'))[_0x9411('0x11')](socket);function respondWithRpcPromise(_0x5321e2,_0x58c947,_0x81a5b4){return new BPromise(function(_0x523215,_0xf0d700){return client[_0x9411('0x12')](_0x5321e2,_0x81a5b4)['then'](function(_0x369ebf){logger[_0x9411('0x13')](_0x9411('0x14'),_0x58c947,_0x9411('0x15'));logger[_0x9411('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x58c947,_0x9411('0x15'),JSON['stringify'](_0x369ebf));if(_0x369ebf[_0x9411('0x17')]){if(_0x369ebf[_0x9411('0x17')][_0x9411('0x18')]===0x1f4){logger[_0x9411('0x17')](_0x9411('0x14'),_0x58c947,_0x369ebf[_0x9411('0x17')][_0x9411('0x19')]);return _0xf0d700(_0x369ebf[_0x9411('0x17')]['message']);}logger[_0x9411('0x17')]('FaxAccount,\x20%s,\x20%s',_0x58c947,_0x369ebf['error'][_0x9411('0x19')]);return _0x523215(_0x369ebf[_0x9411('0x17')][_0x9411('0x19')]);}else{logger['info'](_0x9411('0x14'),_0x58c947,'request\x20sent');_0x523215(_0x369ebf[_0x9411('0x1a')][_0x9411('0x19')]);}})['catch'](function(_0xe5ecbb){logger[_0x9411('0x17')](_0x9411('0x14'),_0x58c947,_0xe5ecbb);_0xf0d700(_0xe5ecbb);});});}exports[_0x9411('0x1b')]=function(_0x14ffd1){var _0x5f5d31=this;return new Promise(function(_0x18b945,_0x54c219){return db[_0x9411('0x1c')]['findAll']({'raw':_0x14ffd1['options']?_0x14ffd1[_0x9411('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x14ffd1[_0x9411('0x1d')]?_0x14ffd1[_0x9411('0x1d')][_0x9411('0x1e')]||null:null,'attributes':_0x14ffd1[_0x9411('0x1d')]?_0x14ffd1[_0x9411('0x1d')]['attributes']||null:null,'limit':_0x14ffd1[_0x9411('0x1d')]?_0x14ffd1[_0x9411('0x1d')][_0x9411('0x1f')]||null:null,'include':_0x14ffd1[_0x9411('0x1d')]?_0x14ffd1['options']['include']?_['map'](_0x14ffd1[_0x9411('0x1d')][_0x9411('0x20')],function(_0x77e59){return{'model':db[_0x77e59[_0x9411('0x21')]],'as':_0x77e59['as'],'attributes':_0x77e59[_0x9411('0x22')],'include':_0x77e59[_0x9411('0x20')]?_[_0x9411('0x23')](_0x77e59['include'],function(_0x130113){return{'model':db[_0x130113[_0x9411('0x21')]],'as':_0x130113['as'],'attributes':_0x130113[_0x9411('0x22')],'include':_0x130113['include']?_[_0x9411('0x23')](_0x130113[_0x9411('0x20')],function(_0xf39dbf){return{'model':db[_0xf39dbf['model']],'as':_0xf39dbf['as'],'attributes':_0xf39dbf['attributes']};}):[]};}):[]};}):[]:[]})[_0x9411('0x24')](function(_0x51b6e2){logger[_0x9411('0x13')](_0x9411('0x1b'),_0x14ffd1);logger[_0x9411('0x16')](_0x9411('0x1b'),_0x14ffd1,JSON[_0x9411('0x25')](_0x51b6e2));_0x18b945(_0x51b6e2);})[_0x9411('0x26')](function(_0x3e365d){logger[_0x9411('0x17')](_0x9411('0x1b'),_0x3e365d[_0x9411('0x19')],_0x14ffd1);_0x54c219(_0x5f5d31['error'](0x1f4,_0x3e365d[_0x9411('0x19')]));});});};exports[_0x9411('0x27')]=function(_0x330941,_0x103e77,_0x565622){var _0x1a3667=this;return new Promise(function(_0x571d3c,_0x1b5f3d){var _0x31bc24={'body':_0x330941[_0x9411('0x28')],'channel':_0x9411('0x29')};var _0x40754a=[];var _0x5ab335=[];var _0x11fade={};return db['CmContact'][_0x9411('0x2a')]()['then'](function(_0x3e3e5f){if(!_0x3e3e5f){throw new db[(_0x9411('0x2b'))][(_0x9411('0x2c'))](_0x9411('0x2d'));}_0x40754a=_[_0x9411('0x2e')](_[_0x9411('0x2f')](_0x3e3e5f),[_0x9411('0x30'),_0x9411('0x31')]);_0x5ab335=_[_0x9411('0x2e')](_[_0x9411('0x2f')](_0x3e3e5f),[_0x9411('0x30'),_0x9411('0x31'),_0x9411('0x32'),'ListId']);if(_0x330941[_0x9411('0x28')]['id']){delete _0x330941['body']['id'];}if(_['isNil'](_0x330941[_0x9411('0x28')][_0x9411('0x33')])){throw new db[(_0x9411('0x2b'))]['ValidationError'](_0x9411('0x34'));}if(_['isNil'](_0x330941[_0x9411('0x28')][_0x9411('0x28')])||_0x330941[_0x9411('0x28')][_0x9411('0x28')]===''){throw new db[(_0x9411('0x2b'))]['ValidationError'](_0x9411('0x35'));}if(_[_0x9411('0x36')](_0x330941[_0x9411('0x28')][_0x9411('0x37')])){throw new db[(_0x9411('0x2b'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ab335);}if(!_[_0x9411('0x38')](_0x5ab335,_0x330941[_0x9411('0x28')]['mapKey'])){throw new db[(_0x9411('0x2b'))]['ValidationError'](_0x9411('0x39')+_0x5ab335);}_0x11fade[_0x330941[_0x9411('0x28')][_0x9411('0x37')]]=_0x330941[_0x9411('0x28')][_0x9411('0x33')];})[_0x9411('0x24')](function(){return db['FaxAccount'][_0x9411('0x3a')]({'where':{'id':_0x330941[_0x9411('0x3b')]['id']},'include':[{'model':db[_0x9411('0x3c')],'as':_0x9411('0x3d'),'include':[{'model':db[_0x9411('0x3e')],'as':_0x9411('0x3f'),'where':_0x11fade,'limit':0x1,'order':[[_0x9411('0x31'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x9411('0x40')}]});})[_0x9411('0x24')](function(_0x5dfdb1){if(_0x5dfdb1&&_0x5dfdb1[_0x9411('0x3d')]){var _0x43e736=_0x5dfdb1[_0x9411('0x41')]({'plain':!![]});_0x31bc24[_0x9411('0x3b')]=_0x43e736;_0x31bc24[_0x9411('0x42')]=_0x43e736[_0x9411('0x40')];_0x31bc24[_0x9411('0x43')]=_0x43e736[_0x9411('0x3d')];_0x31bc24[_0x9411('0x42')]=_[_0x9411('0x44')](_0x31bc24[_0x9411('0x42')],[_0x9411('0x45')],['asc']);if(_0x31bc24[_0x9411('0x3b')][_0x9411('0x40')]){delete _0x31bc24[_0x9411('0x3b')][_0x9411('0x40')];}if(_0x31bc24[_0x9411('0x3b')]['List']&&_0x31bc24['account'][_0x9411('0x3d')][_0x9411('0x3f')]['length']){return _0x31bc24[_0x9411('0x3b')]['List'][_0x9411('0x3f')][0x0];}var _0x199a42=_[_0x9411('0x46')](_0x330941[_0x9411('0x28')],{'firstName':_0x330941[_0x9411('0x28')]['from'],'ListId':_0x43e736[_0x9411('0x47')]});_0x199a42[_0x330941['body'][_0x9411('0x37')]]=_0x330941[_0x9411('0x28')][_0x9411('0x33')];return db[_0x9411('0x3e')][_0x9411('0x48')](_0x199a42,{'fields':_0x40754a,'raw':!![]});}})[_0x9411('0x24')](function(_0x18509c){_0x31bc24['contact']=_0x18509c;if(_0x18509c){var _0x1a8b21={'ContactId':_0x18509c['id'],'FaxAccountId':_0x330941[_0x9411('0x3b')]['id'],'fax':_0x18509c[_0x9411('0x29')]};return db['FaxInteraction'][_0x9411('0x3a')]({'where':{'ContactId':_0x18509c['id'],'closed':![],'FaxAccountId':_0x330941['account']['id']}})[_0x9411('0x24')](function(_0x4e6498){if(_0x4e6498){return[_0x4e6498,![]];}return db[_0x9411('0x49')][_0x9411('0x48')](_0x1a8b21)[_0x9411('0x24')](function(_0x49b3de){return[_0x49b3de,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2212b5,_0x4b80a2){var _0x35d624=_0x2212b5[_0x9411('0x41')]({'plain':!![]});if(_0x4b80a2){if(_0x31bc24['account'][_0x9411('0x4a')]){_0x31bc24[_0x9411('0x42')][_0x9411('0x4b')]({'id':0x0,'priority':_0x31bc24[_0x9411('0x42')][_0x9411('0x4c')]+0x1,'app':_0x9411('0x4d'),'appdata':_0x9411('0x4e'),'interval':_0x9411('0x4f')});}_0x35d624[_0x9411('0x50')]=!![];}else{_0x35d624[_0x9411('0x50')]=![];}_0x31bc24['interaction']=_0x35d624;return db[_0x9411('0x51')][_0x9411('0x48')]({'body':_0x330941[_0x9411('0x28')][_0x9411('0x28')],'FaxAccountId':_0x330941[_0x9411('0x3b')]['id'],'FaxInteractionId':_0x2212b5['id'],'direction':'in','ContactId':_0x2212b5['ContactId'],'AttachmentId':_0x330941[_0x9411('0x28')][_0x9411('0x52')]});})['then'](function(_0x196941){_0x31bc24[_0x9411('0x19')]=_0x196941;if(_0x31bc24[_0x9411('0x53')]['UserId']){return db[_0x9411('0x54')][_0x9411('0x3a')]({'attributes':['id',_0x9411('0x55')],'where':{'id':_0x31bc24[_0x9411('0x53')][_0x9411('0x56')]}})['then'](function(_0x34da06){if(_0x34da06){_0x31bc24['applications'][_0x9411('0x57')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x34da06[_0x9411('0x55')]+','+(_0x31bc24[_0x9411('0x3b')][_0x9411('0x58')]||0xa),'interval':_0x9411('0x4f')});}return respondWithRpcPromise('Start',_0x9411('0x59'),_0x31bc24);});}return respondWithRpcPromise(_0x9411('0x5a'),_0x9411('0x59'),_0x31bc24);})[_0x9411('0x24')](function(_0x32aa5f){_0x571d3c(_0x32aa5f);})['catch'](function(_0x3d8ee3){_0x1b5f3d(_0x1a3667[_0x9411('0x17')](0x1f4,_0x3d8ee3[_0x9411('0x19')]));});});}; \ No newline at end of file +var _0x13ba=['difference','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','account','applications','Applications','list','orderBy','priority','asc','length','create','contact','fax','FaxInteraction','spread','get','autoclose','push','close','*,*,*,*','created','FaxMessage','ContactId','interaction','name','UserId','agent','waitForTheAssignedAgent','startRouting','Start','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./faxAccount.socket','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','map','include','model','then','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError'];(function(_0x582205,_0x3d2838){var _0x262b92=function(_0x4a6b66){while(--_0x4a6b66){_0x582205['push'](_0x582205['shift']());}};_0x262b92(++_0x3d2838);}(_0x13ba,0xda));var _0xa13b=function(_0x2f2e0e,_0xbeb776){_0x2f2e0e=_0x2f2e0e-0x0;var _0x465367=_0x13ba[_0x2f2e0e];return _0x465367;};'use strict';var _=require('lodash');var util=require(_0xa13b('0x0'));var moment=require('moment');var BPromise=require(_0xa13b('0x1'));var rs=require(_0xa13b('0x2'));var fs=require('fs');var Redis=require(_0xa13b('0x3'));var db=require(_0xa13b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa13b('0x5'))(_0xa13b('0x6'));var config=require(_0xa13b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa13b('0x8')]['http']({'port':0x232c});config[_0xa13b('0x9')]=_[_0xa13b('0xa')](config[_0xa13b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa13b('0xb'))(new Redis(config[_0xa13b('0x9')]));require(_0xa13b('0xc'))['register'](socket);function respondWithRpcPromise(_0x4e689b,_0x5ed4df,_0x216373){return new BPromise(function(_0x5c84d5,_0x4cde5d){return client['request'](_0x4e689b,_0x216373)['then'](function(_0x2a9b83){logger[_0xa13b('0xd')](_0xa13b('0xe'),_0x5ed4df,_0xa13b('0xf'));logger[_0xa13b('0x10')](_0xa13b('0x11'),_0x5ed4df,_0xa13b('0xf'),JSON[_0xa13b('0x12')](_0x2a9b83));if(_0x2a9b83[_0xa13b('0x13')]){if(_0x2a9b83['error'][_0xa13b('0x14')]===0x1f4){logger[_0xa13b('0x13')]('FaxAccount,\x20%s,\x20%s',_0x5ed4df,_0x2a9b83['error'][_0xa13b('0x15')]);return _0x4cde5d(_0x2a9b83[_0xa13b('0x13')][_0xa13b('0x15')]);}logger[_0xa13b('0x13')](_0xa13b('0xe'),_0x5ed4df,_0x2a9b83[_0xa13b('0x13')][_0xa13b('0x15')]);return _0x5c84d5(_0x2a9b83['error'][_0xa13b('0x15')]);}else{logger[_0xa13b('0xd')](_0xa13b('0xe'),_0x5ed4df,_0xa13b('0xf'));_0x5c84d5(_0x2a9b83[_0xa13b('0x16')][_0xa13b('0x15')]);}})['catch'](function(_0x58143e){logger[_0xa13b('0x13')]('FaxAccount,\x20%s,\x20%s',_0x5ed4df,_0x58143e);_0x4cde5d(_0x58143e);});});}exports[_0xa13b('0x17')]=function(_0x2320d4){var _0x194c6c=this;return new Promise(function(_0x49097e,_0x15b374){return db[_0xa13b('0x18')]['findAll']({'raw':_0x2320d4['options']?_0x2320d4[_0xa13b('0x19')][_0xa13b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2320d4[_0xa13b('0x19')]?_0x2320d4[_0xa13b('0x19')][_0xa13b('0x1b')]||null:null,'attributes':_0x2320d4['options']?_0x2320d4[_0xa13b('0x19')][_0xa13b('0x1c')]||null:null,'limit':_0x2320d4[_0xa13b('0x19')]?_0x2320d4[_0xa13b('0x19')][_0xa13b('0x1d')]||null:null,'include':_0x2320d4[_0xa13b('0x19')]?_0x2320d4[_0xa13b('0x19')]['include']?_[_0xa13b('0x1e')](_0x2320d4['options'][_0xa13b('0x1f')],function(_0x430338){return{'model':db[_0x430338['model']],'as':_0x430338['as'],'attributes':_0x430338[_0xa13b('0x1c')],'include':_0x430338[_0xa13b('0x1f')]?_[_0xa13b('0x1e')](_0x430338['include'],function(_0xe4b619){return{'model':db[_0xe4b619['model']],'as':_0xe4b619['as'],'attributes':_0xe4b619['attributes'],'include':_0xe4b619['include']?_['map'](_0xe4b619[_0xa13b('0x1f')],function(_0x132009){return{'model':db[_0x132009[_0xa13b('0x20')]],'as':_0x132009['as'],'attributes':_0x132009[_0xa13b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa13b('0x21')](function(_0x4de9b4){logger[_0xa13b('0xd')](_0xa13b('0x17'),_0x2320d4);logger['debug']('GetFaxAccount',_0x2320d4,JSON[_0xa13b('0x12')](_0x4de9b4));_0x49097e(_0x4de9b4);})['catch'](function(_0x4cb901){logger['error'](_0xa13b('0x17'),_0x4cb901[_0xa13b('0x15')],_0x2320d4);_0x15b374(_0x194c6c[_0xa13b('0x13')](0x1f4,_0x4cb901[_0xa13b('0x15')]));});});};exports[_0xa13b('0x22')]=function(_0x9adb73,_0x2da242,_0x324f0b){var _0x558780=this;return new Promise(function(_0x3e7ba3,_0x4288af){var _0x349c5a={'body':_0x9adb73[_0xa13b('0x23')],'channel':'fax'};var _0x5d4ead=[];var _0x5aabee=[];var _0x7bf1db={};return db[_0xa13b('0x24')][_0xa13b('0x25')]()[_0xa13b('0x21')](function(_0xb13d5f){if(!_0xb13d5f){throw new db[(_0xa13b('0x26'))][(_0xa13b('0x27'))]('no\x20available\x20attributes');}_0x5d4ead=_[_0xa13b('0x28')](_['keys'](_0xb13d5f),['createdAt',_0xa13b('0x29')]);_0x5aabee=_['difference'](_[_0xa13b('0x2a')](_0xb13d5f),['createdAt',_0xa13b('0x29'),_0xa13b('0x2b'),_0xa13b('0x2c')]);if(_0x9adb73[_0xa13b('0x23')]['id']){delete _0x9adb73[_0xa13b('0x23')]['id'];}if(_[_0xa13b('0x2d')](_0x9adb73[_0xa13b('0x23')][_0xa13b('0x2e')])){throw new db[(_0xa13b('0x26'))]['ValidationError'](_0xa13b('0x2f'));}if(_['isNil'](_0x9adb73[_0xa13b('0x23')][_0xa13b('0x23')])||_0x9adb73[_0xa13b('0x23')]['body']===''){throw new db[(_0xa13b('0x26'))][(_0xa13b('0x27'))](_0xa13b('0x30'));}if(_[_0xa13b('0x2d')](_0x9adb73['body']['mapKey'])){throw new db[(_0xa13b('0x26'))][(_0xa13b('0x27'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5aabee);}if(!_[_0xa13b('0x31')](_0x5aabee,_0x9adb73[_0xa13b('0x23')]['mapKey'])){throw new db[(_0xa13b('0x26'))][(_0xa13b('0x27'))](_0xa13b('0x32')+_0x5aabee);}_0x7bf1db[_0x9adb73[_0xa13b('0x23')]['mapKey']]=_0x9adb73[_0xa13b('0x23')]['from'];})[_0xa13b('0x21')](function(){return db['FaxAccount'][_0xa13b('0x33')]({'where':{'id':_0x9adb73['account']['id']},'include':[{'model':db[_0xa13b('0x34')],'as':_0xa13b('0x35'),'include':[{'model':db[_0xa13b('0x24')],'as':_0xa13b('0x36'),'where':_0x7bf1db,'limit':0x1,'order':[[_0xa13b('0x29'),_0xa13b('0x37')]]}]},{'model':db[_0xa13b('0x38')],'as':'Applications'}]});})[_0xa13b('0x21')](function(_0x11b335){if(_0x11b335&&_0x11b335['List']){var _0x45ce74=_0x11b335['get']({'plain':!![]});_0x349c5a[_0xa13b('0x39')]=_0x45ce74;_0x349c5a[_0xa13b('0x3a')]=_0x45ce74[_0xa13b('0x3b')];_0x349c5a[_0xa13b('0x3c')]=_0x45ce74[_0xa13b('0x35')];_0x349c5a[_0xa13b('0x3a')]=_[_0xa13b('0x3d')](_0x349c5a[_0xa13b('0x3a')],[_0xa13b('0x3e')],[_0xa13b('0x3f')]);if(_0x349c5a[_0xa13b('0x39')][_0xa13b('0x3b')]){delete _0x349c5a[_0xa13b('0x39')][_0xa13b('0x3b')];}if(_0x349c5a[_0xa13b('0x39')]['List']&&_0x349c5a[_0xa13b('0x39')][_0xa13b('0x35')][_0xa13b('0x36')][_0xa13b('0x40')]){return _0x349c5a[_0xa13b('0x39')]['List'][_0xa13b('0x36')][0x0];}var _0x4cb213=_[_0xa13b('0xa')](_0x9adb73[_0xa13b('0x23')],{'firstName':_0x9adb73[_0xa13b('0x23')][_0xa13b('0x2e')],'ListId':_0x45ce74['ListId']});_0x4cb213[_0x9adb73[_0xa13b('0x23')]['mapKey']]=_0x9adb73[_0xa13b('0x23')][_0xa13b('0x2e')];return db[_0xa13b('0x24')][_0xa13b('0x41')](_0x4cb213,{'fields':_0x5d4ead,'raw':!![]});}})[_0xa13b('0x21')](function(_0x178f25){_0x349c5a[_0xa13b('0x42')]=_0x178f25;if(_0x178f25){var _0xb5adbe={'ContactId':_0x178f25['id'],'FaxAccountId':_0x9adb73[_0xa13b('0x39')]['id'],'fax':_0x178f25[_0xa13b('0x43')]};return db[_0xa13b('0x44')][_0xa13b('0x33')]({'where':{'ContactId':_0x178f25['id'],'closed':![],'FaxAccountId':_0x9adb73[_0xa13b('0x39')]['id']}})[_0xa13b('0x21')](function(_0x73c549){if(_0x73c549){return[_0x73c549,![]];}return db[_0xa13b('0x44')]['create'](_0xb5adbe)[_0xa13b('0x21')](function(_0x552bb1){return[_0x552bb1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa13b('0x45')](function(_0x1cb57f,_0x2b0eea){var _0x3a7673=_0x1cb57f[_0xa13b('0x46')]({'plain':!![]});if(_0x2b0eea){if(_0x349c5a[_0xa13b('0x39')][_0xa13b('0x47')]){_0x349c5a[_0xa13b('0x3a')][_0xa13b('0x48')]({'id':0x0,'priority':_0x349c5a[_0xa13b('0x3a')][_0xa13b('0x40')]+0x1,'app':_0xa13b('0x49'),'appdata':'unmanaged','interval':_0xa13b('0x4a')});}_0x3a7673[_0xa13b('0x4b')]=!![];}else{_0x3a7673[_0xa13b('0x4b')]=![];}_0x349c5a['interaction']=_0x3a7673;return db[_0xa13b('0x4c')][_0xa13b('0x41')]({'body':_0x9adb73[_0xa13b('0x23')][_0xa13b('0x23')],'FaxAccountId':_0x9adb73[_0xa13b('0x39')]['id'],'FaxInteractionId':_0x1cb57f['id'],'direction':'in','ContactId':_0x1cb57f[_0xa13b('0x4d')],'AttachmentId':_0x9adb73[_0xa13b('0x23')]['AttachmentId']});})[_0xa13b('0x21')](function(_0x1d8ba2){_0x349c5a[_0xa13b('0x15')]=_0x1d8ba2;if(_0x349c5a[_0xa13b('0x4e')]['UserId']){return db['User']['find']({'attributes':['id',_0xa13b('0x4f')],'where':{'id':_0x349c5a[_0xa13b('0x4e')][_0xa13b('0x50')]}})['then'](function(_0x34936b){if(_0x34936b){_0x349c5a[_0xa13b('0x3a')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa13b('0x51'),'appdata':_0x34936b[_0xa13b('0x4f')]+','+(_0x349c5a[_0xa13b('0x39')][_0xa13b('0x52')]||0xa),'interval':_0xa13b('0x4a')});}return respondWithRpcPromise('Start',_0xa13b('0x53'),_0x349c5a);});}return respondWithRpcPromise(_0xa13b('0x54'),_0xa13b('0x53'),_0x349c5a);})['then'](function(_0x57aa64){_0x3e7ba3(_0x57aa64);})[_0xa13b('0x55')](function(_0x15719b){_0x4288af(_0x558780[_0xa13b('0x13')](0x1f4,_0x15719b[_0xa13b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cedbb29..c881ca8 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x072b=['emit','removeListener','length','faxAccount:','remove'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x072b,0x12b));var _0xb072=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x072b[_0x4a53d];return _0x27410e;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xb072('0x0'),'update'];function createListener(_0x5a1ece,_0x51cd05){return function(_0x24b9d8){_0x51cd05[_0xb072('0x1')](_0x5a1ece,_0x24b9d8);};}function removeListener(_0x63408a,_0x1a9371){return function(){FaxAccountEvents[_0xb072('0x2')](_0x63408a,_0x1a9371);};}exports['register']=function(_0x35ed86){for(var _0x386663=0x0,_0x11bbd3=events[_0xb072('0x3')];_0x386663<_0x11bbd3;_0x386663++){var _0x2579b0=events[_0x386663];var _0x3fc194=createListener(_0xb072('0x4')+_0x2579b0,_0x35ed86);FaxAccountEvents['on'](_0x2579b0,_0x3fc194);}}; \ No newline at end of file +var _0x3f56=['register','faxAccount:','save','update'];(function(_0x4e6caf,_0xb7c0ab){var _0x451c5f=function(_0x8e2d49){while(--_0x8e2d49){_0x4e6caf['push'](_0x4e6caf['shift']());}};_0x451c5f(++_0xb7c0ab);}(_0x3f56,0x1f2));var _0x63f5=function(_0x1c7581,_0x3ee14d){_0x1c7581=_0x1c7581-0x0;var _0x4eb9c5=_0x3f56[_0x1c7581];return _0x4eb9c5;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x63f5('0x0'),'remove',_0x63f5('0x1')];function createListener(_0x5d8c72,_0x2fecfe){return function(_0x534559){_0x2fecfe['emit'](_0x5d8c72,_0x534559);};}function removeListener(_0x47246a,_0x5b3736){return function(){FaxAccountEvents['removeListener'](_0x47246a,_0x5b3736);};}exports[_0x63f5('0x2')]=function(_0x4a9eb9){for(var _0x344ccd=0x0,_0x1ba539=events['length'];_0x344ccd<_0x1ba539;_0x344ccd++){var _0x3fcfd8=events[_0x344ccd];var _0x30f8c1=createListener(_0x63f5('0x3')+_0x3fcfd8,_0x4a9eb9);FaxAccountEvents['on'](_0x3fcfd8,_0x30f8c1);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b1f3165..e43eb71 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x233fc1,_0x15461){var _0x12d22a=function(_0x1341bd){while(--_0x1341bd){_0x233fc1['push'](_0x233fc1['shift']());}};_0x12d22a(++_0x15461);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x50eb21,_0x5b1882){var _0x2e05e9=function(_0x47be21){while(--_0x47be21){_0x50eb21['push'](_0x50eb21['shift']());}};_0x2e05e9(++_0x5b1882);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 18f9794..a69c9e5 100644 --- a/server/api/faxApplication/faxApplication.attributes.js +++ b/server/api/faxApplication/faxApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb644=['exports','INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x40ba2b,_0x42772e){var _0x916a9c=function(_0x26d1f8){while(--_0x26d1f8){_0x40ba2b['push'](_0x40ba2b['shift']());}};_0x916a9c(++_0x42772e);}(_0xb644,0x191));var _0x4b64=function(_0x3a621f,_0x43fbd8){_0x3a621f=_0x3a621f-0x0;var _0x19c339=_0xb644[_0x3a621f];return _0x19c339;};'use strict';var Sequelize=require(_0x4b64('0x0'));module[_0x4b64('0x1')]={'priority':{'type':Sequelize[_0x4b64('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b64('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4b64('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4b64('0x5')}}; \ No newline at end of file +var _0xe88e=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x1b5d5f,_0x5ed766){var _0x3c9347=function(_0x21afdd){while(--_0x21afdd){_0x1b5d5f['push'](_0x1b5d5f['shift']());}};_0x3c9347(++_0x5ed766);}(_0xe88e,0x6e));var _0xee88=function(_0xc731bb,_0x5891d4){_0xc731bb=_0xc731bb-0x0;var _0xfe197d=_0xe88e[_0xc731bb];return _0xfe197d;};'use strict';var Sequelize=require('sequelize');module[_0xee88('0x0')]={'priority':{'type':Sequelize[_0xee88('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xee88('0x2')},'appdata':{'type':Sequelize[_0xee88('0x3')]()},'description':{'type':Sequelize[_0xee88('0x4')]},'interval':{'type':Sequelize[_0xee88('0x4')],'defaultValue':_0xee88('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d81a04e..fa2e4cc 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef1=['length','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4eb24f,_0x9d1734){var _0x2f5de3=function(_0x464b24){while(--_0x464b24){_0x4eb24f['push'](_0x4eb24f['shift']());}};_0x2f5de3(++_0x9d1734);}(_0x2ef1,0x13d));var _0x12ef=function(_0x3c48b4,_0x7b08e9){_0x3c48b4=_0x3c48b4-0x0;var _0x2ea1f8=_0x2ef1[_0x3c48b4];return _0x2ea1f8;};'use strict';var emlformat=require(_0x12ef('0x0'));var rimraf=require(_0x12ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12ef('0x2'));var rp=require(_0x12ef('0x3'));var moment=require(_0x12ef('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x12ef('0x5'));var path=require(_0x12ef('0x6'));var sox=require(_0x12ef('0x7'));var csv=require('to-csv');var ejs=require(_0x12ef('0x8'));var fs=require('fs');var fs_extra=require(_0x12ef('0x9'));var _=require(_0x12ef('0xa'));var squel=require(_0x12ef('0xb'));var crypto=require(_0x12ef('0xc'));var jsforce=require(_0x12ef('0xd'));var deskjs=require(_0x12ef('0xe'));var toCsv=require(_0x12ef('0xf'));var querystring=require('querystring');var Papa=require(_0x12ef('0x10'));var Redis=require(_0x12ef('0x11'));var authService=require(_0x12ef('0x12'));var qs=require(_0x12ef('0x13'));var as=require(_0x12ef('0x14'));var hardwareService=require(_0x12ef('0x15'));var logger=require('../../config/logger')(_0x12ef('0x16'));var utils=require(_0x12ef('0x17'));var config=require(_0x12ef('0x18'));var licenseUtil=require(_0x12ef('0x19'));var db=require(_0x12ef('0x1a'))['db'];function respondWithStatusCode(_0x5a00c8,_0x4dba7a){_0x4dba7a=_0x4dba7a||0xcc;return function(_0x19f4c5){if(_0x19f4c5){return _0x5a00c8[_0x12ef('0x1b')](_0x4dba7a);}return _0x5a00c8['status'](_0x4dba7a)[_0x12ef('0x1c')]();};}function respondWithResult(_0x503b44,_0xcf45be){_0xcf45be=_0xcf45be||0xc8;return function(_0x45de80){if(_0x45de80){return _0x503b44[_0x12ef('0x1d')](_0xcf45be)[_0x12ef('0x1e')](_0x45de80);}};}function respondWithFilteredResult(_0x2f765e,_0x18ec89){return function(_0xefb542){if(_0xefb542){var _0x11c5dc=typeof _0x18ec89['offset']===_0x12ef('0x1f')&&typeof _0x18ec89[_0x12ef('0x20')]===_0x12ef('0x1f');var _0x23d4ef=_0xefb542['count'];var _0x5045df=_0x11c5dc?0x0:_0x18ec89[_0x12ef('0x21')];var _0x53e5a6=_0x11c5dc?_0xefb542[_0x12ef('0x22')]:_0x18ec89[_0x12ef('0x21')]+_0x18ec89[_0x12ef('0x20')];var _0x31156c;if(_0x53e5a6>=_0x23d4ef){_0x53e5a6=_0x23d4ef;_0x31156c=0xc8;}else{_0x31156c=0xce;}_0x2f765e[_0x12ef('0x1d')](_0x31156c);return _0x2f765e['set'](_0x12ef('0x23'),_0x5045df+'-'+_0x53e5a6+'/'+_0x23d4ef)['json'](_0xefb542);}return null;};}function patchUpdates(_0x4cbf8d){return function(_0x4bad21){try{jsonpatch[_0x12ef('0x24')](_0x4bad21,_0x4cbf8d,!![]);}catch(_0x5bc7b2){return BPromise[_0x12ef('0x25')](_0x5bc7b2);}return _0x4bad21[_0x12ef('0x26')]();};}function saveUpdates(_0x273cf5,_0xe1eebe){return function(_0x181914){if(_0x181914){return _0x181914[_0x12ef('0x27')](_0x273cf5)['then'](function(_0x34cbc1){return _0x34cbc1;});}return null;};}function removeEntity(_0x1949b2,_0x51dc2a){return function(_0x449cde){if(_0x449cde){return _0x449cde[_0x12ef('0x28')]()[_0x12ef('0x29')](function(){_0x1949b2[_0x12ef('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7010,_0x996bec){return function(_0x59ca08){if(!_0x59ca08){_0x1f7010[_0x12ef('0x1b')](0x194);}return _0x59ca08;};}function handleError(_0x40cabb,_0x5a1401){_0x5a1401=_0x5a1401||0x1f4;return function(_0x4ec795){logger[_0x12ef('0x2a')](_0x4ec795[_0x12ef('0x2b')]);if(_0x4ec795['name']){delete _0x4ec795['name'];}_0x40cabb[_0x12ef('0x1d')](_0x5a1401)[_0x12ef('0x2c')](_0x4ec795);};}exports['index']=function(_0x603e04,_0x252178){var _0x4748c7={},_0x29fe03={},_0x25c3df={'count':0x0,'rows':[]};var _0x587f0b=_['map'](db[_0x12ef('0x2d')][_0x12ef('0x2e')],function(_0x457e44){return{'name':_0x457e44[_0x12ef('0x2f')],'type':_0x457e44[_0x12ef('0x30')][_0x12ef('0x31')]};});_0x29fe03[_0x12ef('0x32')]=_['map'](_0x587f0b,'name');_0x29fe03[_0x12ef('0x33')]=_[_0x12ef('0x34')](_0x603e04[_0x12ef('0x33')]);_0x29fe03[_0x12ef('0x35')]=_[_0x12ef('0x36')](_0x29fe03[_0x12ef('0x32')],_0x29fe03[_0x12ef('0x33')]);_0x4748c7['attributes']=_[_0x12ef('0x36')](_0x29fe03['model'],qs[_0x12ef('0x37')](_0x603e04[_0x12ef('0x33')][_0x12ef('0x37')]));_0x4748c7[_0x12ef('0x38')]=_0x4748c7[_0x12ef('0x38')]['length']?_0x4748c7['attributes']:_0x29fe03['model'];if(!_0x603e04[_0x12ef('0x33')][_0x12ef('0x39')](_0x12ef('0x3a'))){_0x4748c7[_0x12ef('0x20')]=qs[_0x12ef('0x20')](_0x603e04['query'][_0x12ef('0x20')]);_0x4748c7[_0x12ef('0x21')]=qs[_0x12ef('0x21')](_0x603e04[_0x12ef('0x33')][_0x12ef('0x21')]);}_0x4748c7['order']=qs['sort'](_0x603e04[_0x12ef('0x33')][_0x12ef('0x3b')]);_0x4748c7[_0x12ef('0x3c')]=qs[_0x12ef('0x35')](_[_0x12ef('0x3d')](_0x603e04[_0x12ef('0x33')],_0x29fe03[_0x12ef('0x35')]),_0x587f0b);if(_0x603e04['query']['filter']){_0x4748c7['where']=_[_0x12ef('0x3e')](_0x4748c7['where'],{'$or':_[_0x12ef('0x3f')](_0x587f0b,function(_0x432bf6){if(_0x432bf6['type']!==_0x12ef('0x40')){var _0x7d974c={};_0x7d974c[_0x432bf6[_0x12ef('0x41')]]={'$like':'%'+_0x603e04[_0x12ef('0x33')]['filter']+'%'};return _0x7d974c;}})});}_0x4748c7=_[_0x12ef('0x3e')]({},_0x4748c7,_0x603e04[_0x12ef('0x42')]);var _0x588d4c={'where':_0x4748c7[_0x12ef('0x3c')]};return db['FaxApplication']['count'](_0x588d4c)[_0x12ef('0x29')](function(_0x1d83b5){_0x25c3df['count']=_0x1d83b5;if(_0x603e04[_0x12ef('0x33')][_0x12ef('0x43')]){_0x4748c7[_0x12ef('0x44')]=[{'all':!![]}];}return db['FaxApplication'][_0x12ef('0x45')](_0x4748c7);})[_0x12ef('0x29')](function(_0x13df04){_0x25c3df[_0x12ef('0x46')]=_0x13df04;return _0x25c3df;})[_0x12ef('0x29')](respondWithFilteredResult(_0x252178,_0x4748c7))[_0x12ef('0x47')](handleError(_0x252178,null));};exports[_0x12ef('0x48')]=function(_0x58aac7,_0x2d7752){var _0x3a8243={'raw':!![],'where':{'id':_0x58aac7['params']['id']}},_0x393c70={};_0x393c70[_0x12ef('0x32')]=_[_0x12ef('0x34')](db[_0x12ef('0x2d')][_0x12ef('0x2e')]);_0x393c70[_0x12ef('0x33')]=_[_0x12ef('0x34')](_0x58aac7[_0x12ef('0x33')]);_0x393c70['filters']=_['intersection'](_0x393c70[_0x12ef('0x32')],_0x393c70['query']);_0x3a8243[_0x12ef('0x38')]=_[_0x12ef('0x36')](_0x393c70['model'],qs[_0x12ef('0x37')](_0x58aac7[_0x12ef('0x33')]['fields']));_0x3a8243['attributes']=_0x3a8243['attributes'][_0x12ef('0x49')]?_0x3a8243['attributes']:_0x393c70[_0x12ef('0x32')];if(_0x58aac7[_0x12ef('0x33')]['includeAll']){_0x3a8243[_0x12ef('0x44')]=[{'all':!![]}];}_0x3a8243=_[_0x12ef('0x3e')]({},_0x3a8243,_0x58aac7[_0x12ef('0x42')]);return db[_0x12ef('0x2d')]['find'](_0x3a8243)[_0x12ef('0x29')](handleEntityNotFound(_0x2d7752,null))[_0x12ef('0x29')](respondWithResult(_0x2d7752,null))['catch'](handleError(_0x2d7752,null));};exports[_0x12ef('0x4a')]=function(_0x2d1bfb,_0x5b9a79){return db[_0x12ef('0x2d')][_0x12ef('0x4a')](_0x2d1bfb[_0x12ef('0x4b')],{})['then'](respondWithResult(_0x5b9a79,0xc9))[_0x12ef('0x47')](handleError(_0x5b9a79,null));};exports['update']=function(_0x43a01e,_0xb79369){if(_0x43a01e[_0x12ef('0x4b')]['id']){delete _0x43a01e[_0x12ef('0x4b')]['id'];}return db[_0x12ef('0x2d')][_0x12ef('0x4c')]({'where':{'id':_0x43a01e[_0x12ef('0x4d')]['id']}})[_0x12ef('0x29')](handleEntityNotFound(_0xb79369,null))[_0x12ef('0x29')](saveUpdates(_0x43a01e[_0x12ef('0x4b')],null))[_0x12ef('0x29')](respondWithResult(_0xb79369,null))[_0x12ef('0x47')](handleError(_0xb79369,null));};exports[_0x12ef('0x28')]=function(_0x2f8d4b,_0x3eea37){return db['FaxApplication']['find']({'where':{'id':_0x2f8d4b[_0x12ef('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3eea37,null))[_0x12ef('0x29')](removeEntity(_0x3eea37,null))[_0x12ef('0x47')](handleError(_0x3eea37,null));}; \ No newline at end of file +var _0xe28c=['json','undefined','offset','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','rows','catch','show','length','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status'];(function(_0x2c315a,_0xaadaf7){var _0x561ac3=function(_0xccbe8){while(--_0xccbe8){_0x2c315a['push'](_0x2c315a['shift']());}};_0x561ac3(++_0xaadaf7);}(_0xe28c,0xb2));var _0xce28=function(_0x13ef4f,_0x268dae){_0x13ef4f=_0x13ef4f-0x0;var _0x568fa4=_0xe28c[_0x13ef4f];return _0x568fa4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce28('0x0'));var zipdir=require(_0xce28('0x1'));var jsonpatch=require(_0xce28('0x2'));var rp=require(_0xce28('0x3'));var moment=require(_0xce28('0x4'));var BPromise=require(_0xce28('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xce28('0x6'));var sox=require(_0xce28('0x7'));var csv=require(_0xce28('0x8'));var ejs=require(_0xce28('0x9'));var fs=require('fs');var fs_extra=require(_0xce28('0xa'));var _=require(_0xce28('0xb'));var squel=require(_0xce28('0xc'));var crypto=require('crypto');var jsforce=require(_0xce28('0xd'));var deskjs=require(_0xce28('0xe'));var toCsv=require(_0xce28('0x8'));var querystring=require(_0xce28('0xf'));var Papa=require('papaparse');var Redis=require(_0xce28('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xce28('0x11'));var as=require(_0xce28('0x12'));var hardwareService=require(_0xce28('0x13'));var logger=require(_0xce28('0x14'))(_0xce28('0x15'));var utils=require(_0xce28('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xce28('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x322789,_0x235ec7){_0x235ec7=_0x235ec7||0xcc;return function(_0x36f7ab){if(_0x36f7ab){return _0x322789['sendStatus'](_0x235ec7);}return _0x322789['status'](_0x235ec7)[_0xce28('0x18')]();};}function respondWithResult(_0x415fb3,_0x1f8f36){_0x1f8f36=_0x1f8f36||0xc8;return function(_0x19047f){if(_0x19047f){return _0x415fb3[_0xce28('0x19')](_0x1f8f36)[_0xce28('0x1a')](_0x19047f);}};}function respondWithFilteredResult(_0x49bd9a,_0x29c265){return function(_0x23c4f7){if(_0x23c4f7){var _0x54d43c=typeof _0x29c265['offset']===_0xce28('0x1b')&&typeof _0x29c265['limit']===_0xce28('0x1b');var _0x251290=_0x23c4f7['count'];var _0x158cbf=_0x54d43c?0x0:_0x29c265[_0xce28('0x1c')];var _0x26e8c0=_0x54d43c?_0x23c4f7[_0xce28('0x1d')]:_0x29c265['offset']+_0x29c265[_0xce28('0x1e')];var _0x231095;if(_0x26e8c0>=_0x251290){_0x26e8c0=_0x251290;_0x231095=0xc8;}else{_0x231095=0xce;}_0x49bd9a['status'](_0x231095);return _0x49bd9a[_0xce28('0x1f')](_0xce28('0x20'),_0x158cbf+'-'+_0x26e8c0+'/'+_0x251290)[_0xce28('0x1a')](_0x23c4f7);}return null;};}function patchUpdates(_0x1b1867){return function(_0x4fd3ec){try{jsonpatch['apply'](_0x4fd3ec,_0x1b1867,!![]);}catch(_0x1d2eba){return BPromise['reject'](_0x1d2eba);}return _0x4fd3ec[_0xce28('0x21')]();};}function saveUpdates(_0x40d1d3,_0x774a0f){return function(_0xfea67e){if(_0xfea67e){return _0xfea67e[_0xce28('0x22')](_0x40d1d3)[_0xce28('0x23')](function(_0x23fedf){return _0x23fedf;});}return null;};}function removeEntity(_0x4a3cd8,_0x7a7e58){return function(_0x477bb1){if(_0x477bb1){return _0x477bb1[_0xce28('0x24')]()[_0xce28('0x23')](function(){_0x4a3cd8[_0xce28('0x19')](0xcc)[_0xce28('0x18')]();});}};}function handleEntityNotFound(_0x4f8f33,_0x12754b){return function(_0x4c9e07){if(!_0x4c9e07){_0x4f8f33[_0xce28('0x25')](0x194);}return _0x4c9e07;};}function handleError(_0x6bf09d,_0x13c9df){_0x13c9df=_0x13c9df||0x1f4;return function(_0x128964){logger['error'](_0x128964[_0xce28('0x26')]);if(_0x128964[_0xce28('0x27')]){delete _0x128964[_0xce28('0x27')];}_0x6bf09d[_0xce28('0x19')](_0x13c9df)[_0xce28('0x28')](_0x128964);};}exports['index']=function(_0x54da32,_0x3cfb56){var _0x5d1564={},_0x3bacef={},_0x4e8179={'count':0x0,'rows':[]};var _0x7d7acb=_[_0xce28('0x29')](db[_0xce28('0x2a')][_0xce28('0x2b')],function(_0x10626a){return{'name':_0x10626a[_0xce28('0x2c')],'type':_0x10626a[_0xce28('0x2d')]['key']};});_0x3bacef[_0xce28('0x2e')]=_[_0xce28('0x29')](_0x7d7acb,'name');_0x3bacef[_0xce28('0x2f')]=_[_0xce28('0x30')](_0x54da32[_0xce28('0x2f')]);_0x3bacef[_0xce28('0x31')]=_[_0xce28('0x32')](_0x3bacef[_0xce28('0x2e')],_0x3bacef[_0xce28('0x2f')]);_0x5d1564[_0xce28('0x33')]=_['intersection'](_0x3bacef[_0xce28('0x2e')],qs[_0xce28('0x34')](_0x54da32[_0xce28('0x2f')][_0xce28('0x34')]));_0x5d1564[_0xce28('0x33')]=_0x5d1564[_0xce28('0x33')]['length']?_0x5d1564['attributes']:_0x3bacef[_0xce28('0x2e')];if(!_0x54da32[_0xce28('0x2f')][_0xce28('0x35')]('nolimit')){_0x5d1564[_0xce28('0x1e')]=qs[_0xce28('0x1e')](_0x54da32[_0xce28('0x2f')][_0xce28('0x1e')]);_0x5d1564['offset']=qs[_0xce28('0x1c')](_0x54da32[_0xce28('0x2f')][_0xce28('0x1c')]);}_0x5d1564[_0xce28('0x36')]=qs['sort'](_0x54da32[_0xce28('0x2f')][_0xce28('0x37')]);_0x5d1564['where']=qs[_0xce28('0x31')](_['pick'](_0x54da32[_0xce28('0x2f')],_0x3bacef[_0xce28('0x31')]),_0x7d7acb);if(_0x54da32[_0xce28('0x2f')][_0xce28('0x38')]){_0x5d1564[_0xce28('0x39')]=_[_0xce28('0x3a')](_0x5d1564[_0xce28('0x39')],{'$or':_[_0xce28('0x29')](_0x7d7acb,function(_0xf1555){if(_0xf1555[_0xce28('0x2d')]!=='VIRTUAL'){var _0x5e35aa={};_0x5e35aa[_0xf1555['name']]={'$like':'%'+_0x54da32[_0xce28('0x2f')][_0xce28('0x38')]+'%'};return _0x5e35aa;}})});}_0x5d1564=_[_0xce28('0x3a')]({},_0x5d1564,_0x54da32[_0xce28('0x3b')]);var _0x17e2c3={'where':_0x5d1564['where']};return db[_0xce28('0x2a')][_0xce28('0x1d')](_0x17e2c3)[_0xce28('0x23')](function(_0xf8024d){_0x4e8179['count']=_0xf8024d;if(_0x54da32['query'][_0xce28('0x3c')]){_0x5d1564['include']=[{'all':!![]}];}return db[_0xce28('0x2a')]['findAll'](_0x5d1564);})[_0xce28('0x23')](function(_0x99622c){_0x4e8179[_0xce28('0x3d')]=_0x99622c;return _0x4e8179;})[_0xce28('0x23')](respondWithFilteredResult(_0x3cfb56,_0x5d1564))[_0xce28('0x3e')](handleError(_0x3cfb56,null));};exports[_0xce28('0x3f')]=function(_0x4ba43b,_0x3c6dda){var _0x53dee0={'raw':!![],'where':{'id':_0x4ba43b['params']['id']}},_0x4c56ae={};_0x4c56ae['model']=_[_0xce28('0x30')](db['FaxApplication'][_0xce28('0x2b')]);_0x4c56ae[_0xce28('0x2f')]=_[_0xce28('0x30')](_0x4ba43b[_0xce28('0x2f')]);_0x4c56ae[_0xce28('0x31')]=_[_0xce28('0x32')](_0x4c56ae[_0xce28('0x2e')],_0x4c56ae['query']);_0x53dee0[_0xce28('0x33')]=_[_0xce28('0x32')](_0x4c56ae['model'],qs[_0xce28('0x34')](_0x4ba43b[_0xce28('0x2f')][_0xce28('0x34')]));_0x53dee0[_0xce28('0x33')]=_0x53dee0[_0xce28('0x33')][_0xce28('0x40')]?_0x53dee0['attributes']:_0x4c56ae['model'];if(_0x4ba43b['query'][_0xce28('0x3c')]){_0x53dee0['include']=[{'all':!![]}];}_0x53dee0=_['merge']({},_0x53dee0,_0x4ba43b[_0xce28('0x3b')]);return db[_0xce28('0x2a')]['find'](_0x53dee0)[_0xce28('0x23')](handleEntityNotFound(_0x3c6dda,null))['then'](respondWithResult(_0x3c6dda,null))[_0xce28('0x3e')](handleError(_0x3c6dda,null));};exports[_0xce28('0x41')]=function(_0x3dc757,_0x3531d8){return db['FaxApplication'][_0xce28('0x41')](_0x3dc757[_0xce28('0x42')],{})[_0xce28('0x23')](respondWithResult(_0x3531d8,0xc9))[_0xce28('0x3e')](handleError(_0x3531d8,null));};exports['update']=function(_0x34b9f6,_0x3cb50d){if(_0x34b9f6[_0xce28('0x42')]['id']){delete _0x34b9f6[_0xce28('0x42')]['id'];}return db[_0xce28('0x2a')]['find']({'where':{'id':_0x34b9f6['params']['id']}})[_0xce28('0x23')](handleEntityNotFound(_0x3cb50d,null))[_0xce28('0x23')](saveUpdates(_0x34b9f6[_0xce28('0x42')],null))[_0xce28('0x23')](respondWithResult(_0x3cb50d,null))[_0xce28('0x3e')](handleError(_0x3cb50d,null));};exports[_0xce28('0x24')]=function(_0x4a1daf,_0x138d7f){return db[_0xce28('0x2a')][_0xce28('0x43')]({'where':{'id':_0x4a1daf['params']['id']}})[_0xce28('0x23')](handleEntityNotFound(_0x138d7f,null))['then'](removeEntity(_0x138d7f,null))[_0xce28('0x3e')](handleError(_0x138d7f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 39dc519..d40f31e 100644 --- a/server/api/faxApplication/faxApplication.model.js +++ b/server/api/faxApplication/faxApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa777=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x439e06,_0xe6d21c){var _0xaa57c1=function(_0x55fb96){while(--_0x55fb96){_0x439e06['push'](_0x439e06['shift']());}};_0xaa57c1(++_0xe6d21c);}(_0xa777,0xa5));var _0x7a77=function(_0x40077c,_0x595185){_0x40077c=_0x40077c-0x0;var _0x4ef3d8=_0xa777[_0x40077c];return _0x4ef3d8;};'use strict';var _=require(_0x7a77('0x0'));var util=require(_0x7a77('0x1'));var logger=require(_0x7a77('0x2'))(_0x7a77('0x3'));var moment=require(_0x7a77('0x4'));var BPromise=require(_0x7a77('0x5'));var rp=require(_0x7a77('0x6'));var fs=require('fs');var path=require(_0x7a77('0x7'));var rimraf=require('rimraf');var config=require(_0x7a77('0x8'));var attributes=require(_0x7a77('0x9'));module[_0x7a77('0xa')]=function(_0x24ec38,_0x4391e0){return _0x24ec38[_0x7a77('0xb')](_0x7a77('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a77('0xd'),'collate':_0x7a77('0xe')});}; \ No newline at end of file +var _0x158f=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0xb08b8d,_0x24e0e3){var _0x37b1e8=function(_0x353764){while(--_0x353764){_0xb08b8d['push'](_0xb08b8d['shift']());}};_0x37b1e8(++_0x24e0e3);}(_0x158f,0xc8));var _0xf158=function(_0x518f4f,_0xc2f4c1){_0x518f4f=_0x518f4f-0x0;var _0x993397=_0x158f[_0x518f4f];return _0x993397;};'use strict';var _=require(_0xf158('0x0'));var util=require('util');var logger=require(_0xf158('0x1'))(_0xf158('0x2'));var moment=require(_0xf158('0x3'));var BPromise=require(_0xf158('0x4'));var rp=require(_0xf158('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf158('0x6'));var config=require(_0xf158('0x7'));var attributes=require(_0xf158('0x8'));module[_0xf158('0x9')]=function(_0x27e824,_0x5035fd){return _0x27e824[_0xf158('0xa')](_0xf158('0xb'),attributes,{'tableName':_0xf158('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf158('0xd'),'collate':_0xf158('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index ad89402..4807a87 100644 --- a/server/api/faxApplication/faxApplication.rpc.js +++ b/server/api/faxApplication/faxApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb0b=['FaxApplication','update','body','options','raw','where','attributes','UpdateFaxApplication','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','result'];(function(_0x2c22bf,_0x3407af){var _0x19b2e6=function(_0xb25cf2){while(--_0xb25cf2){_0x2c22bf['push'](_0x2c22bf['shift']());}};_0x19b2e6(++_0x3407af);}(_0xfb0b,0x1d8));var _0xbfb0=function(_0x4733e9,_0x20eddc){_0x4733e9=_0x4733e9-0x0;var _0x56cf67=_0xfb0b[_0x4733e9];return _0x56cf67;};'use strict';var _=require(_0xbfb0('0x0'));var util=require('util');var moment=require(_0xbfb0('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x2'));var fs=require('fs');var Redis=require(_0xbfb0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfb0('0x4'));var logger=require(_0xbfb0('0x5'))('rpc');var config=require(_0xbfb0('0x6'));var jayson=require(_0xbfb0('0x7'));var client=jayson[_0xbfb0('0x8')][_0xbfb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x224c2a,_0x527964,_0x3e15e5){return new BPromise(function(_0x573298,_0xdd2f1a){return client[_0xbfb0('0xa')](_0x224c2a,_0x3e15e5)[_0xbfb0('0xb')](function(_0x3d318d){logger[_0xbfb0('0xc')]('FaxApplication,\x20%s,\x20%s',_0x527964,_0xbfb0('0xd'));logger[_0xbfb0('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x527964,_0xbfb0('0xd'),JSON[_0xbfb0('0xf')](_0x3d318d));if(_0x3d318d[_0xbfb0('0x10')]){if(_0x3d318d[_0xbfb0('0x10')][_0xbfb0('0x11')]===0x1f4){logger[_0xbfb0('0x10')]('FaxApplication,\x20%s,\x20%s',_0x527964,_0x3d318d['error'][_0xbfb0('0x12')]);return _0xdd2f1a(_0x3d318d['error'][_0xbfb0('0x12')]);}logger[_0xbfb0('0x10')](_0xbfb0('0x13'),_0x527964,_0x3d318d['error'][_0xbfb0('0x12')]);return _0x573298(_0x3d318d[_0xbfb0('0x10')][_0xbfb0('0x12')]);}else{logger[_0xbfb0('0xc')]('FaxApplication,\x20%s,\x20%s',_0x527964,'request\x20sent');_0x573298(_0x3d318d[_0xbfb0('0x14')][_0xbfb0('0x12')]);}})['catch'](function(_0x214929){logger[_0xbfb0('0x10')](_0xbfb0('0x13'),_0x527964,_0x214929);_0xdd2f1a(_0x214929);});});}exports['UpdateFaxApplication']=function(_0x2ea46f){var _0x1ffc8a=this;return new Promise(function(_0x1ca868,_0x2f7fab){return db[_0xbfb0('0x15')][_0xbfb0('0x16')](_0x2ea46f[_0xbfb0('0x17')],{'raw':_0x2ea46f[_0xbfb0('0x18')]?_0x2ea46f[_0xbfb0('0x18')][_0xbfb0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ea46f['options']?_0x2ea46f['options'][_0xbfb0('0x1a')]||null:null,'attributes':_0x2ea46f['options']?_0x2ea46f['options'][_0xbfb0('0x1b')]||null:null,'limit':_0x2ea46f[_0xbfb0('0x18')]?_0x2ea46f[_0xbfb0('0x18')]['limit']||null:null})[_0xbfb0('0xb')](function(_0x2467ce){logger[_0xbfb0('0xc')](_0xbfb0('0x1c'),_0x2ea46f);logger[_0xbfb0('0xe')](_0xbfb0('0x1c'),_0x2ea46f,JSON[_0xbfb0('0xf')](_0x2467ce));_0x1ca868(_0x2467ce);})['catch'](function(_0x251980){logger[_0xbfb0('0x10')](_0xbfb0('0x1c'),_0x251980[_0xbfb0('0x12')],_0x2ea46f);_0x2f7fab(_0x1ffc8a[_0xbfb0('0x10')](0x1f4,_0x251980[_0xbfb0('0x12')]));});});}; \ No newline at end of file +var _0x6d24=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x138d50,_0xdd4ba2){var _0x449b15=function(_0x2c1b3a){while(--_0x2c1b3a){_0x138d50['push'](_0x138d50['shift']());}};_0x449b15(++_0xdd4ba2);}(_0x6d24,0x119));var _0x46d2=function(_0x3b1ebb,_0x8d89e6){_0x3b1ebb=_0x3b1ebb-0x0;var _0x33d4cb=_0x6d24[_0x3b1ebb];return _0x33d4cb;};'use strict';var _=require(_0x46d2('0x0'));var util=require(_0x46d2('0x1'));var moment=require(_0x46d2('0x2'));var BPromise=require(_0x46d2('0x3'));var rs=require(_0x46d2('0x4'));var fs=require('fs');var Redis=require(_0x46d2('0x5'));var db=require(_0x46d2('0x6'))['db'];var utils=require(_0x46d2('0x7'));var logger=require('../../config/logger')(_0x46d2('0x8'));var config=require(_0x46d2('0x9'));var jayson=require(_0x46d2('0xa'));var client=jayson['client'][_0x46d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x476218,_0x543ddb,_0x2363f9){return new BPromise(function(_0x43cf33,_0x46d0de){return client[_0x46d2('0xc')](_0x476218,_0x2363f9)[_0x46d2('0xd')](function(_0x3b6e7d){logger[_0x46d2('0xe')](_0x46d2('0xf'),_0x543ddb,_0x46d2('0x10'));logger[_0x46d2('0x11')](_0x46d2('0x12'),_0x543ddb,'request\x20sent',JSON[_0x46d2('0x13')](_0x3b6e7d));if(_0x3b6e7d[_0x46d2('0x14')]){if(_0x3b6e7d['error'][_0x46d2('0x15')]===0x1f4){logger['error'](_0x46d2('0xf'),_0x543ddb,_0x3b6e7d[_0x46d2('0x14')][_0x46d2('0x16')]);return _0x46d0de(_0x3b6e7d[_0x46d2('0x14')]['message']);}logger[_0x46d2('0x14')](_0x46d2('0xf'),_0x543ddb,_0x3b6e7d[_0x46d2('0x14')]['message']);return _0x43cf33(_0x3b6e7d[_0x46d2('0x14')][_0x46d2('0x16')]);}else{logger['info'](_0x46d2('0xf'),_0x543ddb,_0x46d2('0x10'));_0x43cf33(_0x3b6e7d['result'][_0x46d2('0x16')]);}})['catch'](function(_0x585287){logger[_0x46d2('0x14')]('FaxApplication,\x20%s,\x20%s',_0x543ddb,_0x585287);_0x46d0de(_0x585287);});});}exports[_0x46d2('0x17')]=function(_0x42c134){var _0x4996e3=this;return new Promise(function(_0x68a675,_0x4e4841){return db['FaxApplication'][_0x46d2('0x18')](_0x42c134[_0x46d2('0x19')],{'raw':_0x42c134[_0x46d2('0x1a')]?_0x42c134[_0x46d2('0x1a')][_0x46d2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42c134['options']?_0x42c134['options'][_0x46d2('0x1c')]||null:null,'attributes':_0x42c134[_0x46d2('0x1a')]?_0x42c134['options'][_0x46d2('0x1d')]||null:null,'limit':_0x42c134['options']?_0x42c134[_0x46d2('0x1a')][_0x46d2('0x1e')]||null:null})[_0x46d2('0xd')](function(_0x252f40){logger[_0x46d2('0xe')](_0x46d2('0x17'),_0x42c134);logger[_0x46d2('0x11')](_0x46d2('0x17'),_0x42c134,JSON[_0x46d2('0x13')](_0x252f40));_0x68a675(_0x252f40);})[_0x46d2('0x1f')](function(_0x1ea2a1){logger[_0x46d2('0x14')]('UpdateFaxApplication',_0x1ea2a1[_0x46d2('0x16')],_0x42c134);_0x4e4841(_0x4996e3[_0x46d2('0x14')](0x1f4,_0x1ea2a1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0e90bff..32eb122 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x358a6e,_0x3f6865){var _0x2d356e=function(_0x512b28){while(--_0x512b28){_0x358a6e['push'](_0x358a6e['shift']());}};_0x2d356e(++_0x3f6865);}(_0x4024,0x89));var _0x4402=function(_0x3b15a1,_0x3c2f2a){_0x3b15a1=_0x3b15a1-0x0;var _0x4c4839=_0x4024[_0x3b15a1];return _0x4c4839;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file +var _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4fac34,_0x545546){var _0x254ed1=function(_0x3a7f41){while(--_0x3a7f41){_0x4fac34['push'](_0x4fac34['shift']());}};_0x254ed1(++_0x545546);}(_0xe605,0x92));var _0x5e60=function(_0x508ada,_0x9a2918){_0x508ada=_0x508ada-0x0;var _0x356e06=_0xe605[_0x508ada];return _0x356e06;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c5de2cc..120863d 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c2=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xb4c2,0x1d5));var _0x2b4c=function(_0x231f61,_0x5a703d){_0x231f61=_0x231f61-0x0;var _0x455a27=_0xb4c2[_0x231f61];return _0x455a27;};'use strict';var Sequelize=require(_0x2b4c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2b4c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2b4c('0x2')]},'disposition':{'type':Sequelize[_0x2b4c('0x3')]},'secondDisposition':{'type':Sequelize[_0x2b4c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2b4c('0x3')]},'note':{'type':Sequelize[_0x2b4c('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x2b4c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2b4c('0x4')]('in',_0x2b4c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2b4c('0x4')]('in',_0x2b4c('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2fc7=['ENUM','DATE','out','sequelize','exports','STRING'];(function(_0x389f0e,_0x41f204){var _0x467036=function(_0x32a253){while(--_0x32a253){_0x389f0e['push'](_0x389f0e['shift']());}};_0x467036(++_0x41f204);}(_0x2fc7,0x1bf));var _0x72fc=function(_0x5e0b5f,_0x431544){_0x5e0b5f=_0x5e0b5f-0x0;var _0x5436c1=_0x2fc7[_0x5e0b5f];return _0x5436c1;};'use strict';var Sequelize=require(_0x72fc('0x0'));module[_0x72fc('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x72fc('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x72fc('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72fc('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x72fc('0x3')]('in',_0x72fc('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index aaaf4bd..836c9ab 100644 --- a/server/api/faxInteraction/faxInteraction.controller.js +++ b/server/api/faxInteraction/faxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d8d=['create','body','find','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','rawAttributes','filters','order','sort','pick','where','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','mkdirSync','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','bluebird','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','type','key','findAll','fax','catch','show','params','keys','FaxInteraction','query','intersection','model','fields','attributes','length','includeAll','include','merge','options'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x9d8d,0x1d3));var _0xd9d8=function(_0x1e85a4,_0x2a88ac){_0x1e85a4=_0x1e85a4-0x0;var _0x575444=_0x9d8d[_0x1e85a4];return _0x575444;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xd9d8('0x0'));var util=require(_0xd9d8('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xd9d8('0x2'));var Redis=require('ioredis');var interaction=require(_0xd9d8('0x3'));var qs=require(_0xd9d8('0x4'));var logger=require(_0xd9d8('0x5'))(_0xd9d8('0x6'));var config=require(_0xd9d8('0x7'));var db=require(_0xd9d8('0x8'))['db'];config[_0xd9d8('0x9')]=_[_0xd9d8('0xa')](config[_0xd9d8('0x9')],{'host':_0xd9d8('0xb'),'port':0x18eb});var socket=require(_0xd9d8('0xc'))(new Redis(config[_0xd9d8('0x9')]));require(_0xd9d8('0xd'))[_0xd9d8('0xe')](socket);function respondWithStatusCode(_0x1451f6,_0x173497){_0x173497=_0x173497||0xcc;return function(_0x1f15dc){if(_0x1f15dc){return _0x1451f6[_0xd9d8('0xf')](_0x173497);}return _0x1451f6['status'](_0x173497)[_0xd9d8('0x10')]();};}function respondWithResult(_0x4734b3,_0xcf91f9){_0xcf91f9=_0xcf91f9||0xc8;return function(_0x4a07f8){if(_0x4a07f8){return _0x4734b3[_0xd9d8('0x11')](_0xcf91f9)[_0xd9d8('0x12')](_0x4a07f8);}};}function respondWithFilteredResult(_0x5db991,_0x2faa07){return function(_0x38b64e){if(_0x38b64e){var _0x39d47c=typeof _0x2faa07['offset']==='undefined'&&typeof _0x2faa07[_0xd9d8('0x13')]===_0xd9d8('0x14');var _0x3ce97a=_0x38b64e[_0xd9d8('0x15')];var _0x3d615c=_0x39d47c?0x0:_0x2faa07['offset'];var _0x539f1c=_0x39d47c?_0x38b64e['count']:_0x2faa07[_0xd9d8('0x16')]+_0x2faa07[_0xd9d8('0x13')];var _0x2677ed;if(_0x539f1c>=_0x3ce97a){_0x539f1c=_0x3ce97a;_0x2677ed=0xc8;}else{_0x2677ed=0xce;}_0x5db991[_0xd9d8('0x11')](_0x2677ed);return _0x5db991[_0xd9d8('0x17')](_0xd9d8('0x18'),_0x3d615c+'-'+_0x539f1c+'/'+_0x3ce97a)['json'](_0x38b64e);}return null;};}function saveUpdates(_0x64427){return function(_0x1ae868){if(_0x1ae868){return _0x1ae868[_0xd9d8('0x19')](_0x64427)[_0xd9d8('0x1a')](function(_0xde7fea){return _0xde7fea;});}return null;};}function removeEntity(_0x195fa6){return function(_0x3719f4){if(_0x3719f4){return _0x3719f4[_0xd9d8('0x1b')]()[_0xd9d8('0x1a')](function(){_0x195fa6[_0xd9d8('0x11')](0xcc)[_0xd9d8('0x10')]();});}};}function handleEntityNotFound(_0x45f879){return function(_0x390700){if(!_0x390700){_0x45f879[_0xd9d8('0xf')](0x194);}return _0x390700;};}function handleError(_0x3244e0,_0xa41a29){_0xa41a29=_0xa41a29||0x1f4;return function(_0x13454e){logger[_0xd9d8('0x1c')](_0x13454e[_0xd9d8('0x1d')]);if(_0x13454e['name']){delete _0x13454e[_0xd9d8('0x1e')];}_0x3244e0[_0xd9d8('0x11')](_0xa41a29)[_0xd9d8('0x1f')](_0x13454e);};}exports[_0xd9d8('0x20')]=function(_0x21c717,_0x32b3aa){var _0x4781c2={};var _0x3f59eb=_[_0xd9d8('0x21')](db['FaxInteraction']['rawAttributes'],function(_0x30db28){return{'name':_0x30db28['fieldName'],'type':_0x30db28[_0xd9d8('0x22')][_0xd9d8('0x23')]};});_0x4781c2=qs['getOptions'](_0x3f59eb,_0x21c717);return interaction[_0xd9d8('0x24')](_0xd9d8('0x25'),_0x21c717['query'],_0x21c717['user'],_0x4781c2,_0x3f59eb)[_0xd9d8('0x1a')](respondWithFilteredResult(_0x32b3aa,_0x4781c2))[_0xd9d8('0x26')](handleError(_0x32b3aa,null));};exports[_0xd9d8('0x27')]=function(_0x4cc7c5,_0x3139cc){var _0x5247ae={'raw':![],'where':{'id':_0x4cc7c5[_0xd9d8('0x28')]['id']}},_0x22d488={};_0x22d488['model']=_[_0xd9d8('0x29')](db[_0xd9d8('0x2a')]['rawAttributes']);_0x22d488['query']=_[_0xd9d8('0x29')](_0x4cc7c5[_0xd9d8('0x2b')]);_0x22d488['filters']=_[_0xd9d8('0x2c')](_0x22d488['model'],_0x22d488['query']);_0x5247ae['attributes']=_[_0xd9d8('0x2c')](_0x22d488[_0xd9d8('0x2d')],qs[_0xd9d8('0x2e')](_0x4cc7c5[_0xd9d8('0x2b')][_0xd9d8('0x2e')]));_0x5247ae[_0xd9d8('0x2f')]=_0x5247ae['attributes'][_0xd9d8('0x30')]?_0x5247ae[_0xd9d8('0x2f')]:_0x22d488[_0xd9d8('0x2d')];if(_0x4cc7c5[_0xd9d8('0x2b')][_0xd9d8('0x31')]){_0x5247ae[_0xd9d8('0x32')]=[{'all':!![]}];}_0x5247ae=_[_0xd9d8('0x33')]({},_0x5247ae,_0x4cc7c5[_0xd9d8('0x34')]);return db[_0xd9d8('0x2a')]['find'](_0x5247ae)[_0xd9d8('0x1a')](handleEntityNotFound(_0x3139cc,null))[_0xd9d8('0x1a')](respondWithResult(_0x3139cc,null))[_0xd9d8('0x26')](handleError(_0x3139cc,null));};exports[_0xd9d8('0x35')]=function(_0x291c99,_0x252af4){return db[_0xd9d8('0x2a')][_0xd9d8('0x35')](_0x291c99['body'],{})['then'](respondWithResult(_0x252af4,0xc9))[_0xd9d8('0x26')](handleError(_0x252af4,null));};exports[_0xd9d8('0x19')]=function(_0x25c83e,_0x55f179){if(_0x25c83e['body']['id']){delete _0x25c83e[_0xd9d8('0x36')]['id'];}return db[_0xd9d8('0x2a')][_0xd9d8('0x37')]({'where':{'id':_0x25c83e[_0xd9d8('0x28')]['id']}})[_0xd9d8('0x1a')](handleEntityNotFound(_0x55f179,null))['then'](saveUpdates(_0x25c83e[_0xd9d8('0x36')],null))[_0xd9d8('0x1a')](respondWithResult(_0x55f179,null))[_0xd9d8('0x26')](handleError(_0x55f179,null));};exports[_0xd9d8('0x1b')]=function(_0x11438e,_0x2dcc47){return db[_0xd9d8('0x2a')][_0xd9d8('0x37')]({'where':{'id':_0x11438e[_0xd9d8('0x28')]['id']}})[_0xd9d8('0x1a')](handleEntityNotFound(_0x2dcc47,null))[_0xd9d8('0x1a')](removeEntity(_0x2dcc47,null))[_0xd9d8('0x26')](handleError(_0x2dcc47,null));};exports[_0xd9d8('0x38')]=function(_0x2e1d3a,_0x1ce1c6){return db[_0xd9d8('0x2a')][_0xd9d8('0x38')]()[_0xd9d8('0x1a')](respondWithResult(_0x1ce1c6,null))[_0xd9d8('0x26')](handleError(_0x1ce1c6,null));};exports['addMessage']=function(_0x25bf0a,_0x1161dd){return db[_0xd9d8('0x39')][_0xd9d8('0x37')]({'where':{'id':_0x25bf0a['params']['id']}})['then'](handleEntityNotFound(_0x1161dd,null))[_0xd9d8('0x1a')](function(_0x219a9d){if(_0x219a9d){return _0x219a9d[_0xd9d8('0x3a')](_0x25bf0a[_0xd9d8('0x36')][_0xd9d8('0x3b')],_[_0xd9d8('0x3c')](_0x25bf0a[_0xd9d8('0x36')],[_0xd9d8('0x3b'),'id'])||{});}})[_0xd9d8('0x1a')](respondWithResult(_0x1161dd,null))['catch'](handleError(_0x1161dd,null));};exports[_0xd9d8('0x3d')]=function(_0x12a249,_0x244cfe){var _0x356aba={'raw':![],'where':{}};var _0x82302e={};var _0x1dd65c={'count':0x0,'rows':[]};return db[_0xd9d8('0x2a')][_0xd9d8('0x3e')]({'where':{'id':_0x12a249[_0xd9d8('0x28')]['id']}})[_0xd9d8('0x1a')](handleEntityNotFound(_0x244cfe,null))['then'](function(_0x4802d9){if(_0x4802d9){_0x82302e['model']=_[_0xd9d8('0x29')](db[_0xd9d8('0x39')][_0xd9d8('0x3f')]);_0x82302e[_0xd9d8('0x2b')]=_[_0xd9d8('0x29')](_0x12a249[_0xd9d8('0x2b')]);_0x82302e[_0xd9d8('0x40')]=_['intersection'](_0x82302e[_0xd9d8('0x2d')],_0x82302e['query']);_0x356aba[_0xd9d8('0x2f')]=_[_0xd9d8('0x2c')](_0x82302e['model'],qs[_0xd9d8('0x2e')](_0x12a249[_0xd9d8('0x2b')]['fields']));_0x356aba['attributes']=_0x356aba[_0xd9d8('0x2f')][_0xd9d8('0x30')]?_0x356aba[_0xd9d8('0x2f')]:_0x82302e[_0xd9d8('0x2d')];if(!_0x12a249[_0xd9d8('0x2b')]['hasOwnProperty']('nolimit')){_0x356aba['limit']=qs[_0xd9d8('0x13')](_0x12a249[_0xd9d8('0x2b')][_0xd9d8('0x13')]);_0x356aba[_0xd9d8('0x16')]=qs[_0xd9d8('0x16')](_0x12a249['query']['offset']);}_0x356aba[_0xd9d8('0x41')]=qs[_0xd9d8('0x42')](_0x12a249[_0xd9d8('0x2b')][_0xd9d8('0x42')]);_0x356aba['where']=qs[_0xd9d8('0x40')](_[_0xd9d8('0x43')](_0x12a249[_0xd9d8('0x2b')],_0x82302e['filters']));_0x356aba[_0xd9d8('0x44')][_0xd9d8('0x45')]=_0x4802d9['id'];if(_0x12a249[_0xd9d8('0x2b')][_0xd9d8('0x46')]){_0x356aba[_0xd9d8('0x44')]=_[_0xd9d8('0x33')](_0x356aba[_0xd9d8('0x44')],{'$or':_['map'](_0x356aba[_0xd9d8('0x2f')],function(_0x329e7d){var _0x2fd94a={};_0x2fd94a[_0x329e7d]={'$like':'%'+_0x12a249[_0xd9d8('0x2b')][_0xd9d8('0x46')]+'%'};return _0x2fd94a;})});}if(_0x12a249[_0xd9d8('0x2b')][_0xd9d8('0x47')]){var _0x2570c2=_0x12a249[_0xd9d8('0x2b')]['$gte']['split'](',');var _0x1eaf1e={};_0x1eaf1e[_0x2570c2[0x0]]={'$gte':moment(_0x2570c2[0x1])[_0xd9d8('0x48')](_0xd9d8('0x49'))};_0x356aba[_0xd9d8('0x44')]=_['merge'](_0x356aba[_0xd9d8('0x44')],_0x1eaf1e);}_0x356aba=_['merge']({},_0x356aba,_0x12a249[_0xd9d8('0x34')]);return db[_0xd9d8('0x39')]['count']({'where':_0x356aba['where']})[_0xd9d8('0x1a')](function(_0x5f3090){_0x1dd65c[_0xd9d8('0x15')]=_0x5f3090;if(_0x12a249[_0xd9d8('0x2b')][_0xd9d8('0x31')]){_0x356aba[_0xd9d8('0x32')]=[{'all':!![]}];}return db[_0xd9d8('0x39')][_0xd9d8('0x24')](_0x356aba);})[_0xd9d8('0x1a')](function(_0x3c6921){_0x1dd65c['rows']=_0x3c6921;return _0x1dd65c;});}})[_0xd9d8('0x1a')](respondWithFilteredResult(_0x244cfe,_0x356aba))[_0xd9d8('0x26')](handleError(_0x244cfe,null));};exports['addTags']=function(_0x4930ef,_0xf9fae2){return db['FaxInteraction'][_0xd9d8('0x37')]({'where':{'id':_0x4930ef[_0xd9d8('0x28')]['id']}})[_0xd9d8('0x1a')](handleEntityNotFound(_0xf9fae2,null))[_0xd9d8('0x1a')](function(_0x40af94){if(_0x40af94){return _0x40af94[_0xd9d8('0x4a')](_0x4930ef['body'][_0xd9d8('0x3b')],_[_0xd9d8('0x3c')](_0x4930ef[_0xd9d8('0x36')],[_0xd9d8('0x3b'),'id'])||{})[_0xd9d8('0x4b')](function(){return db[_0xd9d8('0x4c')][_0xd9d8('0x24')]({'attributes':['id',_0xd9d8('0x1e'),_0xd9d8('0x4d')],'where':{'id':_0x4930ef[_0xd9d8('0x36')][_0xd9d8('0x3b')]}});})['then'](function(_0x573c1d){socket[_0xd9d8('0x4e')](_0xd9d8('0x4f'),{'id':Number(_0x4930ef[_0xd9d8('0x28')]['id']),'tags':_0x573c1d||[]});return{'id':Number(_0x4930ef[_0xd9d8('0x28')]['id']),'tags':_0x573c1d||[]};});}})[_0xd9d8('0x1a')](respondWithResult(_0xf9fae2,null))[_0xd9d8('0x26')](handleError(_0xf9fae2,null));};exports[_0xd9d8('0x50')]=function(_0x45b15d,_0x17cb6b){return db['FaxInteraction'][_0xd9d8('0x37')]({'where':{'id':_0x45b15d[_0xd9d8('0x28')]['id']}})[_0xd9d8('0x1a')](handleEntityNotFound(_0x17cb6b,null))[_0xd9d8('0x1a')](function(_0x25ebce){if(_0x25ebce){return _0x25ebce[_0xd9d8('0x50')](_0x45b15d[_0xd9d8('0x2b')][_0xd9d8('0x3b')]);}})[_0xd9d8('0x1a')](respondWithStatusCode(_0x17cb6b,null))['catch'](handleError(_0x17cb6b,null));};exports[_0xd9d8('0x51')]=function(_0x1f0e75,_0x48d6d0){var _0x261543=moment()[_0xd9d8('0x52')]()[_0xd9d8('0x53')]();var _0x43c859=path[_0xd9d8('0x54')](config[_0xd9d8('0x55')],_0xd9d8('0x56'),_0xd9d8('0x57'),'tmp');var _0x5a3b6c=path[_0xd9d8('0x54')](config[_0xd9d8('0x55')],'server',_0xd9d8('0x57'),_0xd9d8('0x58'));var _0x54e57e=path[_0xd9d8('0x54')](_0x43c859,_0x261543);var _0x1a6c6c=util[_0xd9d8('0x48')](_0xd9d8('0x59'),_0x1f0e75[_0xd9d8('0x28')]['id'],_0x261543);var _0x2b1be5=path['join'](_0x43c859,_0x1a6c6c);var _0x2bed90=[];_0x2bed90[_0xd9d8('0x5a')]({'model':db[_0xd9d8('0x5b')],'as':_0xd9d8('0x5b'),'raw':!![]});var _0x35e129=[{'model':db[_0xd9d8('0x39')],'as':'Messages','attributes':['id',_0xd9d8('0x36'),_0xd9d8('0x5c')],'include':_0x2bed90}];return db[_0xd9d8('0x2a')][_0xd9d8('0x37')]({'where':{'id':_0x1f0e75[_0xd9d8('0x28')]['id']},'include':_0x35e129})[_0xd9d8('0x1a')](handleEntityNotFound(_0x48d6d0,null))[_0xd9d8('0x1a')](function(_0x193996){if(_0x193996&&_0x193996['Messages']){var _0x507ea5=_0x193996['get']({'plain':!![]});fs[_0xd9d8('0x5d')](_0x54e57e);for(var _0x16f35f=0x0;_0x16f35f<_0x507ea5['Messages'][_0xd9d8('0x30')];_0x16f35f++){var _0x5880dc=_0x507ea5[_0xd9d8('0x5e')][_0x16f35f][_0xd9d8('0x5b')];if(_0x5880dc){var _0x3c2fc8=path[_0xd9d8('0x54')](_0x5a3b6c,_0x5880dc[_0xd9d8('0x5f')]);if(fs[_0xd9d8('0x60')](_0x3c2fc8)){fs[_0xd9d8('0x61')](_0x3c2fc8)[_0xd9d8('0x62')](fs[_0xd9d8('0x63')](path[_0xd9d8('0x54')](_0x54e57e,_0x5880dc['basename'])));}}}return BPromise[_0xd9d8('0x64')]()[_0xd9d8('0x1a')](function(){return new BPromise(function(_0x565a9d,_0x55a495){zipdir(_0x54e57e,{'saveTo':_0x2b1be5},function(_0x225362,_0x20e477){if(_0x225362)return _0x55a495(_0x225362);return _0x565a9d(_0x20e477);});})[_0xd9d8('0x1a')](function(){return new BPromise(function(_0xba9424,_0x50c8f1){rimraf(_0x54e57e,function(_0x2ca9d5){if(_0x2ca9d5)_0x50c8f1(_0x2ca9d5);return _0xba9424();});});})[_0xd9d8('0x1a')](function(){return _0x48d6d0['download'](_0x2b1be5,_0x1a6c6c,function(_0x5ebd9a){if(_0x5ebd9a){console[_0xd9d8('0x65')](_0xd9d8('0x66'),_0x5ebd9a);}else{fs[_0xd9d8('0x67')](_0x2b1be5);}});});});}else{return _0x48d6d0[_0xd9d8('0xf')](0xc8);}})[_0xd9d8('0x26')](handleError(_0x48d6d0,null));}; \ No newline at end of file +var _0x09fc=['tmp','attachments','push','Attachment','Messages','createdAt','mkdirSync','basename','pipe','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','describe','FaxMessage','addMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','faxInteractionTags:save','removeTags','download','toString','join','root','server','files'];(function(_0x3c8941,_0x2cc569){var _0x4da5dc=function(_0x584f6a){while(--_0x584f6a){_0x3c8941['push'](_0x3c8941['shift']());}};_0x4da5dc(++_0x2cc569);}(_0x09fc,0xdc));var _0xc09f=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x09fc[_0x209941];return _0x1e8729;};'use strict';var rimraf=require(_0xc09f('0x0'));var zipdir=require(_0xc09f('0x1'));var moment=require(_0xc09f('0x2'));var BPromise=require(_0xc09f('0x3'));var util=require(_0xc09f('0x4'));var path=require(_0xc09f('0x5'));var fs=require('fs');var _=require(_0xc09f('0x6'));var Redis=require(_0xc09f('0x7'));var interaction=require(_0xc09f('0x8'));var qs=require(_0xc09f('0x9'));var logger=require(_0xc09f('0xa'))('api');var config=require(_0xc09f('0xb'));var db=require(_0xc09f('0xc'))['db'];config[_0xc09f('0xd')]=_[_0xc09f('0xe')](config[_0xc09f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc09f('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xc09f('0x10')](socket);function respondWithStatusCode(_0x1a12e7,_0x5462b7){_0x5462b7=_0x5462b7||0xcc;return function(_0x586d81){if(_0x586d81){return _0x1a12e7[_0xc09f('0x11')](_0x5462b7);}return _0x1a12e7[_0xc09f('0x12')](_0x5462b7)[_0xc09f('0x13')]();};}function respondWithResult(_0x346923,_0x2c2f18){_0x2c2f18=_0x2c2f18||0xc8;return function(_0x45ac6e){if(_0x45ac6e){return _0x346923[_0xc09f('0x12')](_0x2c2f18)[_0xc09f('0x14')](_0x45ac6e);}};}function respondWithFilteredResult(_0x1b6602,_0x22c63c){return function(_0x1fc1ec){if(_0x1fc1ec){var _0x12ccfa=typeof _0x22c63c[_0xc09f('0x15')]===_0xc09f('0x16')&&typeof _0x22c63c[_0xc09f('0x17')]==='undefined';var _0x5bb9ec=_0x1fc1ec[_0xc09f('0x18')];var _0x4ac904=_0x12ccfa?0x0:_0x22c63c['offset'];var _0x5aaf2b=_0x12ccfa?_0x1fc1ec[_0xc09f('0x18')]:_0x22c63c[_0xc09f('0x15')]+_0x22c63c[_0xc09f('0x17')];var _0x2c297b;if(_0x5aaf2b>=_0x5bb9ec){_0x5aaf2b=_0x5bb9ec;_0x2c297b=0xc8;}else{_0x2c297b=0xce;}_0x1b6602['status'](_0x2c297b);return _0x1b6602[_0xc09f('0x19')](_0xc09f('0x1a'),_0x4ac904+'-'+_0x5aaf2b+'/'+_0x5bb9ec)[_0xc09f('0x14')](_0x1fc1ec);}return null;};}function saveUpdates(_0x149a69){return function(_0x5437a6){if(_0x5437a6){return _0x5437a6[_0xc09f('0x1b')](_0x149a69)[_0xc09f('0x1c')](function(_0x319a6e){return _0x319a6e;});}return null;};}function removeEntity(_0x919e7f){return function(_0x2290c7){if(_0x2290c7){return _0x2290c7['destroy']()[_0xc09f('0x1c')](function(){_0x919e7f['status'](0xcc)[_0xc09f('0x13')]();});}};}function handleEntityNotFound(_0x3f96f3){return function(_0x4fe983){if(!_0x4fe983){_0x3f96f3[_0xc09f('0x11')](0x194);}return _0x4fe983;};}function handleError(_0x2e66d0,_0x1b1632){_0x1b1632=_0x1b1632||0x1f4;return function(_0x7afdae){logger['error'](_0x7afdae['stack']);if(_0x7afdae[_0xc09f('0x1d')]){delete _0x7afdae[_0xc09f('0x1d')];}_0x2e66d0[_0xc09f('0x12')](_0x1b1632)[_0xc09f('0x1e')](_0x7afdae);};}exports[_0xc09f('0x1f')]=function(_0x456b92,_0x272e87){var _0x4f6f8d={};var _0x2f5568=_[_0xc09f('0x20')](db['FaxInteraction'][_0xc09f('0x21')],function(_0x39c06f){return{'name':_0x39c06f[_0xc09f('0x22')],'type':_0x39c06f['type'][_0xc09f('0x23')]};});_0x4f6f8d=qs[_0xc09f('0x24')](_0x2f5568,_0x456b92);return interaction[_0xc09f('0x25')](_0xc09f('0x26'),_0x456b92[_0xc09f('0x27')],_0x456b92[_0xc09f('0x28')],_0x4f6f8d,_0x2f5568)[_0xc09f('0x1c')](respondWithFilteredResult(_0x272e87,_0x4f6f8d))[_0xc09f('0x29')](handleError(_0x272e87,null));};exports[_0xc09f('0x2a')]=function(_0x41618e,_0x3bf699){var _0x494293={'raw':![],'where':{'id':_0x41618e[_0xc09f('0x2b')]['id']}},_0x17a86d={};_0x17a86d[_0xc09f('0x2c')]=_[_0xc09f('0x2d')](db[_0xc09f('0x2e')]['rawAttributes']);_0x17a86d[_0xc09f('0x27')]=_['keys'](_0x41618e[_0xc09f('0x27')]);_0x17a86d[_0xc09f('0x2f')]=_[_0xc09f('0x30')](_0x17a86d[_0xc09f('0x2c')],_0x17a86d['query']);_0x494293[_0xc09f('0x31')]=_[_0xc09f('0x30')](_0x17a86d[_0xc09f('0x2c')],qs[_0xc09f('0x32')](_0x41618e[_0xc09f('0x27')][_0xc09f('0x32')]));_0x494293[_0xc09f('0x31')]=_0x494293[_0xc09f('0x31')][_0xc09f('0x33')]?_0x494293['attributes']:_0x17a86d['model'];if(_0x41618e[_0xc09f('0x27')][_0xc09f('0x34')]){_0x494293[_0xc09f('0x35')]=[{'all':!![]}];}_0x494293=_[_0xc09f('0x36')]({},_0x494293,_0x41618e[_0xc09f('0x37')]);return db[_0xc09f('0x2e')][_0xc09f('0x38')](_0x494293)[_0xc09f('0x1c')](handleEntityNotFound(_0x3bf699,null))['then'](respondWithResult(_0x3bf699,null))[_0xc09f('0x29')](handleError(_0x3bf699,null));};exports[_0xc09f('0x39')]=function(_0x194e6a,_0x3f129d){return db['FaxInteraction'][_0xc09f('0x39')](_0x194e6a['body'],{})['then'](respondWithResult(_0x3f129d,0xc9))['catch'](handleError(_0x3f129d,null));};exports[_0xc09f('0x1b')]=function(_0x2751c4,_0x41dd7a){if(_0x2751c4[_0xc09f('0x3a')]['id']){delete _0x2751c4['body']['id'];}return db[_0xc09f('0x2e')]['find']({'where':{'id':_0x2751c4[_0xc09f('0x2b')]['id']}})[_0xc09f('0x1c')](handleEntityNotFound(_0x41dd7a,null))[_0xc09f('0x1c')](saveUpdates(_0x2751c4[_0xc09f('0x3a')],null))[_0xc09f('0x1c')](respondWithResult(_0x41dd7a,null))[_0xc09f('0x29')](handleError(_0x41dd7a,null));};exports[_0xc09f('0x3b')]=function(_0x45d2e7,_0x38e45e){return db['FaxInteraction'][_0xc09f('0x38')]({'where':{'id':_0x45d2e7[_0xc09f('0x2b')]['id']}})[_0xc09f('0x1c')](handleEntityNotFound(_0x38e45e,null))['then'](removeEntity(_0x38e45e,null))[_0xc09f('0x29')](handleError(_0x38e45e,null));};exports['describe']=function(_0x7738a1,_0x1746e2){return db[_0xc09f('0x2e')][_0xc09f('0x3c')]()[_0xc09f('0x1c')](respondWithResult(_0x1746e2,null))['catch'](handleError(_0x1746e2,null));};exports['addMessage']=function(_0x124fe6,_0x299076){return db[_0xc09f('0x3d')]['find']({'where':{'id':_0x124fe6[_0xc09f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x299076,null))[_0xc09f('0x1c')](function(_0x51a0c7){if(_0x51a0c7){return _0x51a0c7[_0xc09f('0x3e')](_0x124fe6['body'][_0xc09f('0x3f')],_['omit'](_0x124fe6[_0xc09f('0x3a')],[_0xc09f('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x299076,null))['catch'](handleError(_0x299076,null));};exports[_0xc09f('0x40')]=function(_0x37acc3,_0x10c74e){var _0x2ce7b4={'raw':![],'where':{}};var _0x3bda8c={};var _0x3f666f={'count':0x0,'rows':[]};return db[_0xc09f('0x2e')][_0xc09f('0x41')]({'where':{'id':_0x37acc3['params']['id']}})[_0xc09f('0x1c')](handleEntityNotFound(_0x10c74e,null))[_0xc09f('0x1c')](function(_0x16c5ed){if(_0x16c5ed){_0x3bda8c[_0xc09f('0x2c')]=_['keys'](db[_0xc09f('0x3d')]['rawAttributes']);_0x3bda8c[_0xc09f('0x27')]=_['keys'](_0x37acc3[_0xc09f('0x27')]);_0x3bda8c[_0xc09f('0x2f')]=_[_0xc09f('0x30')](_0x3bda8c[_0xc09f('0x2c')],_0x3bda8c[_0xc09f('0x27')]);_0x2ce7b4['attributes']=_[_0xc09f('0x30')](_0x3bda8c['model'],qs['fields'](_0x37acc3[_0xc09f('0x27')][_0xc09f('0x32')]));_0x2ce7b4[_0xc09f('0x31')]=_0x2ce7b4['attributes'][_0xc09f('0x33')]?_0x2ce7b4['attributes']:_0x3bda8c[_0xc09f('0x2c')];if(!_0x37acc3[_0xc09f('0x27')][_0xc09f('0x42')](_0xc09f('0x43'))){_0x2ce7b4[_0xc09f('0x17')]=qs[_0xc09f('0x17')](_0x37acc3['query'][_0xc09f('0x17')]);_0x2ce7b4['offset']=qs[_0xc09f('0x15')](_0x37acc3[_0xc09f('0x27')]['offset']);}_0x2ce7b4[_0xc09f('0x44')]=qs['sort'](_0x37acc3['query'][_0xc09f('0x45')]);_0x2ce7b4[_0xc09f('0x46')]=qs[_0xc09f('0x2f')](_[_0xc09f('0x47')](_0x37acc3[_0xc09f('0x27')],_0x3bda8c[_0xc09f('0x2f')]));_0x2ce7b4[_0xc09f('0x46')][_0xc09f('0x48')]=_0x16c5ed['id'];if(_0x37acc3['query'][_0xc09f('0x49')]){_0x2ce7b4[_0xc09f('0x46')]=_['merge'](_0x2ce7b4['where'],{'$or':_['map'](_0x2ce7b4['attributes'],function(_0x38252c){var _0x19e048={};_0x19e048[_0x38252c]={'$like':'%'+_0x37acc3[_0xc09f('0x27')][_0xc09f('0x49')]+'%'};return _0x19e048;})});}if(_0x37acc3['query'][_0xc09f('0x4a')]){var _0x402e73=_0x37acc3['query'][_0xc09f('0x4a')][_0xc09f('0x4b')](',');var _0x3b4916={};_0x3b4916[_0x402e73[0x0]]={'$gte':moment(_0x402e73[0x1])[_0xc09f('0x4c')](_0xc09f('0x4d'))};_0x2ce7b4[_0xc09f('0x46')]=_['merge'](_0x2ce7b4[_0xc09f('0x46')],_0x3b4916);}_0x2ce7b4=_[_0xc09f('0x36')]({},_0x2ce7b4,_0x37acc3[_0xc09f('0x37')]);return db[_0xc09f('0x3d')][_0xc09f('0x18')]({'where':_0x2ce7b4[_0xc09f('0x46')]})[_0xc09f('0x1c')](function(_0x108a3f){_0x3f666f[_0xc09f('0x18')]=_0x108a3f;if(_0x37acc3[_0xc09f('0x27')][_0xc09f('0x34')]){_0x2ce7b4['include']=[{'all':!![]}];}return db[_0xc09f('0x3d')]['findAll'](_0x2ce7b4);})[_0xc09f('0x1c')](function(_0x24dda8){_0x3f666f[_0xc09f('0x4e')]=_0x24dda8;return _0x3f666f;});}})[_0xc09f('0x1c')](respondWithFilteredResult(_0x10c74e,_0x2ce7b4))[_0xc09f('0x29')](handleError(_0x10c74e,null));};exports[_0xc09f('0x4f')]=function(_0x43c4d8,_0x4b2884){return db['FaxInteraction'][_0xc09f('0x38')]({'where':{'id':_0x43c4d8[_0xc09f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4b2884,null))['then'](function(_0x408568){if(_0x408568){return _0x408568[_0xc09f('0x50')](_0x43c4d8[_0xc09f('0x3a')][_0xc09f('0x3f')],_[_0xc09f('0x51')](_0x43c4d8[_0xc09f('0x3a')],[_0xc09f('0x3f'),'id'])||{})[_0xc09f('0x52')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xc09f('0x53')],'where':{'id':_0x43c4d8[_0xc09f('0x3a')][_0xc09f('0x3f')]}});})[_0xc09f('0x1c')](function(_0x3e8e36){socket['emit'](_0xc09f('0x54'),{'id':Number(_0x43c4d8[_0xc09f('0x2b')]['id']),'tags':_0x3e8e36||[]});return{'id':Number(_0x43c4d8[_0xc09f('0x2b')]['id']),'tags':_0x3e8e36||[]};});}})[_0xc09f('0x1c')](respondWithResult(_0x4b2884,null))[_0xc09f('0x29')](handleError(_0x4b2884,null));};exports[_0xc09f('0x55')]=function(_0x5cc716,_0x3d33d2){return db['FaxInteraction'][_0xc09f('0x38')]({'where':{'id':_0x5cc716[_0xc09f('0x2b')]['id']}})[_0xc09f('0x1c')](handleEntityNotFound(_0x3d33d2,null))[_0xc09f('0x1c')](function(_0x3e7d2e){if(_0x3e7d2e){return _0x3e7d2e[_0xc09f('0x55')](_0x5cc716[_0xc09f('0x27')]['ids']);}})[_0xc09f('0x1c')](respondWithStatusCode(_0x3d33d2,null))[_0xc09f('0x29')](handleError(_0x3d33d2,null));};exports[_0xc09f('0x56')]=function(_0x1ed82f,_0x5aac20){var _0x315974=moment()['unix']()[_0xc09f('0x57')]();var _0x530aef=path[_0xc09f('0x58')](config[_0xc09f('0x59')],_0xc09f('0x5a'),_0xc09f('0x5b'),_0xc09f('0x5c'));var _0x40e929=path[_0xc09f('0x58')](config[_0xc09f('0x59')],_0xc09f('0x5a'),_0xc09f('0x5b'),_0xc09f('0x5d'));var _0x122969=path[_0xc09f('0x58')](_0x530aef,_0x315974);var _0x4f23ce=util['format']('transcript-%d-%s.zip',_0x1ed82f[_0xc09f('0x2b')]['id'],_0x315974);var _0x1f7a31=path[_0xc09f('0x58')](_0x530aef,_0x4f23ce);var _0x1df604=[];_0x1df604[_0xc09f('0x5e')]({'model':db[_0xc09f('0x5f')],'as':'Attachment','raw':!![]});var _0x44f5f6=[{'model':db[_0xc09f('0x3d')],'as':_0xc09f('0x60'),'attributes':['id',_0xc09f('0x3a'),_0xc09f('0x61')],'include':_0x1df604}];return db[_0xc09f('0x2e')][_0xc09f('0x38')]({'where':{'id':_0x1ed82f[_0xc09f('0x2b')]['id']},'include':_0x44f5f6})[_0xc09f('0x1c')](handleEntityNotFound(_0x5aac20,null))[_0xc09f('0x1c')](function(_0x35c715){if(_0x35c715&&_0x35c715[_0xc09f('0x60')]){var _0xb8b4db=_0x35c715['get']({'plain':!![]});fs[_0xc09f('0x62')](_0x122969);for(var _0x2ab906=0x0;_0x2ab906<_0xb8b4db[_0xc09f('0x60')][_0xc09f('0x33')];_0x2ab906++){var _0x478691=_0xb8b4db[_0xc09f('0x60')][_0x2ab906][_0xc09f('0x5f')];if(_0x478691){var _0x3383fe=path[_0xc09f('0x58')](_0x40e929,_0x478691[_0xc09f('0x63')]);if(fs['existsSync'](_0x3383fe)){fs['createReadStream'](_0x3383fe)[_0xc09f('0x64')](fs['createWriteStream'](path[_0xc09f('0x58')](_0x122969,_0x478691[_0xc09f('0x63')])));}}}return BPromise[_0xc09f('0x65')]()['then'](function(){return new BPromise(function(_0x3e16d1,_0x629612){zipdir(_0x122969,{'saveTo':_0x1f7a31},function(_0x47f743,_0x441857){if(_0x47f743)return _0x629612(_0x47f743);return _0x3e16d1(_0x441857);});})[_0xc09f('0x1c')](function(){return new BPromise(function(_0x267d2f,_0x3f392f){rimraf(_0x122969,function(_0x33e0e9){if(_0x33e0e9)_0x3f392f(_0x33e0e9);return _0x267d2f();});});})[_0xc09f('0x1c')](function(){return _0x5aac20[_0xc09f('0x56')](_0x1f7a31,_0x4f23ce,function(_0x559630){if(_0x559630){console['log'](_0xc09f('0x66'),_0x559630);}else{fs[_0xc09f('0x67')](_0x1f7a31);}});});});}else{return _0x5aac20['sendStatus'](0xc8);}})[_0xc09f('0x29')](handleError(_0x5aac20,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 401e5ce..9f17b6d 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf521=['remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','FaxInteraction','../../mysqldb','FaxMessage','save','update'];(function(_0x5e9447,_0x138a04){var _0x4fe7b9=function(_0x25f797){while(--_0x25f797){_0x5e9447['push'](_0x5e9447['shift']());}};_0x4fe7b9(++_0x138a04);}(_0xf521,0x182));var _0x1f52=function(_0x13b8b1,_0x42882a){_0x13b8b1=_0x13b8b1-0x0;var _0x467f68=_0xf521[_0x13b8b1];return _0x467f68;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x1f52('0x0')];var FaxMessage=require(_0x1f52('0x1'))['db'][_0x1f52('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f52('0x3'),'afterUpdate':_0x1f52('0x4'),'afterDestroy':_0x1f52('0x5')};function emitEvent(_0xbc3103){return function(_0x2bc816,_0x2c3972,_0x299cc8){_0x2bc816[_0x1f52('0x6')]({'attributes':['id'],'raw':!![]})[_0x1f52('0x7')](function(_0x504ef4){_0x2bc816['setDataValue'](_0x1f52('0x8'),_0x504ef4[_0x1f52('0x9')](function(_0x40a5b2){return{'id':_0x40a5b2['id']};}));return FaxMessage[_0x1f52('0xa')]({'where':{'FaxInteractionId':_0x2bc816['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1f52('0x7')](function(_0x26aacf){_0x2bc816[_0x1f52('0xb')](_0x1f52('0xc'),_0x26aacf['length']);FaxInteractionEvents['emit'](_0xbc3103+':'+_0x2bc816['id'],_0x2bc816);FaxInteractionEvents[_0x1f52('0xd')](_0xbc3103,_0x2bc816);_0x299cc8(null);})[_0x1f52('0xe')](_0x299cc8(null));};}for(var e in events){if(events[_0x1f52('0xf')](e)){var event=events[e];FaxInteraction[_0x1f52('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xd4f2=['setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','then'];(function(_0x1b180e,_0x4c05c2){var _0x2850dd=function(_0x35d8c5){while(--_0x35d8c5){_0x1b180e['push'](_0x1b180e['shift']());}};_0x2850dd(++_0x4c05c2);}(_0xd4f2,0x107));var _0x2d4f=function(_0x5aa50e,_0x1cb555){_0x5aa50e=_0x5aa50e-0x0;var _0xa902c1=_0xd4f2[_0x5aa50e];return _0xa902c1;};'use strict';var EventEmitter=require(_0x2d4f('0x0'));var FaxInteraction=require(_0x2d4f('0x1'))['db'][_0x2d4f('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x2d4f('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2d4f('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d4f('0x5'),'afterDestroy':_0x2d4f('0x6')};function emitEvent(_0x3407c8){return function(_0x3b64a1,_0x576d94,_0xea21ed){_0x3b64a1[_0x2d4f('0x7')]({'attributes':['id'],'raw':!![]})[_0x2d4f('0x8')](function(_0x284dd4){_0x3b64a1[_0x2d4f('0x9')](_0x2d4f('0xa'),_0x284dd4['map'](function(_0x4a9d8f){return{'id':_0x4a9d8f['id']};}));return FaxMessage[_0x2d4f('0xb')]({'where':{'FaxInteractionId':_0x3b64a1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3b5858){_0x3b64a1[_0x2d4f('0x9')](_0x2d4f('0xc'),_0x3b5858[_0x2d4f('0xd')]);FaxInteractionEvents[_0x2d4f('0xe')](_0x3407c8+':'+_0x3b64a1['id'],_0x3b64a1);FaxInteractionEvents[_0x2d4f('0xe')](_0x3407c8,_0x3b64a1);_0xea21ed(null);})['catch'](_0xea21ed(null));};}for(var e in events){if(events[_0x2d4f('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 60dff4f..6359bb6 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb996=['rimraf','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x357ded,_0x53bfde){var _0x4ef865=function(_0x186b66){while(--_0x186b66){_0x357ded['push'](_0x357ded['shift']());}};_0x4ef865(++_0x53bfde);}(_0xb996,0x179));var _0x6b99=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb996[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x6b99('0x0'));var util=require(_0x6b99('0x1'));var logger=require(_0x6b99('0x2'))('api');var moment=require(_0x6b99('0x3'));var BPromise=require(_0x6b99('0x4'));var rp=require(_0x6b99('0x5'));var fs=require('fs');var path=require(_0x6b99('0x6'));var rimraf=require(_0x6b99('0x7'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x6b99('0x8')]=function(_0x5259fe,_0x2e79a0){return _0x5259fe[_0x6b99('0x9')](_0x6b99('0xa'),attributes,{'tableName':_0x6b99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51d3a7,_0x4d5e18,_0x38f1ec){if(_0x51d3a7[_0x6b99('0xc')]('closed')){_0x51d3a7[_0x6b99('0xd')]=moment()[_0x6b99('0xe')](_0x6b99('0xf'));}_0x38f1ec(null,_0x51d3a7);}}});}; \ No newline at end of file +var _0x1c3d=['exports','FaxInteraction','fax_interactions','changed','closed','closedAt','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x2cf2bc,_0x1e592e){_0x2cf2bc=_0x2cf2bc-0x0;var _0x2b49e6=_0x1c3d[_0x2cf2bc];return _0x2b49e6;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var logger=require(_0xd1c3('0x1'))(_0xd1c3('0x2'));var moment=require(_0xd1c3('0x3'));var BPromise=require(_0xd1c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd1c3('0x5'));var config=require(_0xd1c3('0x6'));var attributes=require(_0xd1c3('0x7'));module[_0xd1c3('0x8')]=function(_0x14093d,_0x391a41){return _0x14093d['define'](_0xd1c3('0x9'),attributes,{'tableName':_0xd1c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5db2f0,_0x1afc71,_0x2f3c1c){if(_0x5db2f0[_0xd1c3('0xb')](_0xd1c3('0xc'))){_0x5db2f0[_0xd1c3('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2f3c1c(null,_0x5db2f0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1edeeec..25faeb4 100644 --- a/server/api/faxInteraction/faxInteraction.rpc.js +++ b/server/api/faxInteraction/faxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4923=['../../config/environment','client','defaults','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','AddTagsToFaxInteraction','addTags','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x107a14,_0xe9edc2){var _0x4e239a=function(_0x4345bf){while(--_0x4345bf){_0x107a14['push'](_0x107a14['shift']());}};_0x4e239a(++_0xe9edc2);}(_0x4923,0x19a));var _0x3492=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4923[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3492('0x0'));var util=require(_0x3492('0x1'));var moment=require(_0x3492('0x2'));var BPromise=require(_0x3492('0x3'));var rs=require(_0x3492('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3492('0x5'));var logger=require(_0x3492('0x6'))(_0x3492('0x7'));var config=require(_0x3492('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3492('0x9')]['http']({'port':0x232a});config['redis']=_[_0x3492('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3492('0xb'))(new Redis(config[_0x3492('0xc')]));require('./faxInteraction.socket')[_0x3492('0xd')](socket);function respondWithRpcPromise(_0x8b6aa5,_0x3c3f23,_0x269a4b){return new BPromise(function(_0x5eb0e9,_0x5a2054){return client[_0x3492('0xe')](_0x8b6aa5,_0x269a4b)[_0x3492('0xf')](function(_0x21b6f7){logger[_0x3492('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x3c3f23,_0x3492('0x11'));logger[_0x3492('0x12')](_0x3492('0x13'),_0x3c3f23,_0x3492('0x11'),JSON[_0x3492('0x14')](_0x21b6f7));if(_0x21b6f7[_0x3492('0x15')]){if(_0x21b6f7[_0x3492('0x15')]['code']===0x1f4){logger['error'](_0x3492('0x16'),_0x3c3f23,_0x21b6f7[_0x3492('0x15')]['message']);return _0x5a2054(_0x21b6f7[_0x3492('0x15')][_0x3492('0x17')]);}logger[_0x3492('0x15')](_0x3492('0x16'),_0x3c3f23,_0x21b6f7[_0x3492('0x15')][_0x3492('0x17')]);return _0x5eb0e9(_0x21b6f7[_0x3492('0x15')][_0x3492('0x17')]);}else{logger[_0x3492('0x10')](_0x3492('0x16'),_0x3c3f23,'request\x20sent');_0x5eb0e9(_0x21b6f7['result'][_0x3492('0x17')]);}})['catch'](function(_0x72482b){logger['error'](_0x3492('0x16'),_0x3c3f23,_0x72482b);_0x5a2054(_0x72482b);});});}exports[_0x3492('0x18')]=function(_0x1c2fab){var _0x25f002=this;return new Promise(function(_0x534030,_0x3aab11){return db[_0x3492('0x19')][_0x3492('0x1a')](_0x1c2fab[_0x3492('0x1b')],{'raw':_0x1c2fab['options']?_0x1c2fab[_0x3492('0x1c')][_0x3492('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c2fab[_0x3492('0x1c')]?_0x1c2fab['options'][_0x3492('0x1e')]||null:null,'attributes':_0x1c2fab[_0x3492('0x1c')]?_0x1c2fab[_0x3492('0x1c')][_0x3492('0x1f')]||null:null,'limit':_0x1c2fab[_0x3492('0x1c')]?_0x1c2fab['options']['limit']||null:null})['then'](function(_0x5d4004){logger['info'](_0x3492('0x18'),_0x1c2fab);logger[_0x3492('0x12')](_0x3492('0x18'),_0x1c2fab,JSON[_0x3492('0x14')](_0x5d4004));_0x534030(_0x5d4004);})['catch'](function(_0x117c06){logger['error']('UpdateFaxInteraction',_0x117c06[_0x3492('0x17')],_0x1c2fab);_0x3aab11(_0x25f002['error'](0x1f4,_0x117c06['message']));});});};exports[_0x3492('0x20')]=function(_0x101f5c){return new Promise(function(_0x2214ce,_0x166a15){return db[_0x3492('0x19')]['find']({'where':_0x101f5c[_0x3492('0x1c')]?_0x101f5c[_0x3492('0x1c')][_0x3492('0x1e')]||null:null})[_0x3492('0xf')](function(_0xcab679){if(_0xcab679){return _0xcab679[_0x3492('0x21')](_0x101f5c['body'][_0x3492('0x22')],_['omit'](_0x101f5c['body'],[_0x3492('0x22'),'id'])||{});}})[_0x3492('0x23')](function(_0x5692d9){logger['info']('AddTags',_0x101f5c);logger['debug'](_0x3492('0x24'),_0x101f5c,JSON[_0x3492('0x14')](_0x5692d9));_0x2214ce(_0x5692d9);})[_0x3492('0x25')](function(_0x40f935){logger[_0x3492('0x15')](_0x3492('0x24'),_0x40f935[_0x3492('0x17')],_0x101f5c);_0x166a15(_this[_0x3492('0x15')](0x1f4,_0x40f935[_0x3492('0x17')]));});});}; \ No newline at end of file +var _0xb0e8=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxInteraction','update','body','options','where','attributes','limit','UpdateFaxInteraction','debug','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xb0e8,0x1ad));var _0x8b0e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb0e8[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x8b0e('0x0'));var util=require(_0x8b0e('0x1'));var moment=require(_0x8b0e('0x2'));var BPromise=require(_0x8b0e('0x3'));var rs=require(_0x8b0e('0x4'));var fs=require('fs');var Redis=require(_0x8b0e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b0e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8b0e('0x7'));var jayson=require(_0x8b0e('0x8'));var client=jayson[_0x8b0e('0x9')][_0x8b0e('0xa')]({'port':0x232a});config[_0x8b0e('0xb')]=_[_0x8b0e('0xc')](config[_0x8b0e('0xb')],{'host':_0x8b0e('0xd'),'port':0x18eb});var socket=require(_0x8b0e('0xe'))(new Redis(config[_0x8b0e('0xb')]));require(_0x8b0e('0xf'))[_0x8b0e('0x10')](socket);function respondWithRpcPromise(_0x56bf72,_0x5cf8f1,_0x5174e7){return new BPromise(function(_0x2ff767,_0x437d9e){return client['request'](_0x56bf72,_0x5174e7)[_0x8b0e('0x11')](function(_0x4ea53e){logger[_0x8b0e('0x12')](_0x8b0e('0x13'),_0x5cf8f1,_0x8b0e('0x14'));logger['debug'](_0x8b0e('0x15'),_0x5cf8f1,_0x8b0e('0x14'),JSON[_0x8b0e('0x16')](_0x4ea53e));if(_0x4ea53e[_0x8b0e('0x17')]){if(_0x4ea53e[_0x8b0e('0x17')][_0x8b0e('0x18')]===0x1f4){logger[_0x8b0e('0x17')](_0x8b0e('0x13'),_0x5cf8f1,_0x4ea53e['error']['message']);return _0x437d9e(_0x4ea53e[_0x8b0e('0x17')]['message']);}logger['error'](_0x8b0e('0x13'),_0x5cf8f1,_0x4ea53e[_0x8b0e('0x17')]['message']);return _0x2ff767(_0x4ea53e[_0x8b0e('0x17')][_0x8b0e('0x19')]);}else{logger[_0x8b0e('0x12')](_0x8b0e('0x13'),_0x5cf8f1,_0x8b0e('0x14'));_0x2ff767(_0x4ea53e[_0x8b0e('0x1a')][_0x8b0e('0x19')]);}})[_0x8b0e('0x1b')](function(_0x34e80f){logger[_0x8b0e('0x17')](_0x8b0e('0x13'),_0x5cf8f1,_0x34e80f);_0x437d9e(_0x34e80f);});});}exports['UpdateFaxInteraction']=function(_0x4a33ef){var _0x2028ed=this;return new Promise(function(_0x2d9b07,_0x171c97){return db[_0x8b0e('0x1c')][_0x8b0e('0x1d')](_0x4a33ef[_0x8b0e('0x1e')],{'raw':_0x4a33ef[_0x8b0e('0x1f')]?_0x4a33ef[_0x8b0e('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a33ef[_0x8b0e('0x1f')]?_0x4a33ef['options'][_0x8b0e('0x20')]||null:null,'attributes':_0x4a33ef[_0x8b0e('0x1f')]?_0x4a33ef[_0x8b0e('0x1f')][_0x8b0e('0x21')]||null:null,'limit':_0x4a33ef[_0x8b0e('0x1f')]?_0x4a33ef[_0x8b0e('0x1f')][_0x8b0e('0x22')]||null:null})[_0x8b0e('0x11')](function(_0x42e0db){logger['info'](_0x8b0e('0x23'),_0x4a33ef);logger[_0x8b0e('0x24')]('UpdateFaxInteraction',_0x4a33ef,JSON[_0x8b0e('0x16')](_0x42e0db));_0x2d9b07(_0x42e0db);})[_0x8b0e('0x1b')](function(_0x26a3e1){logger[_0x8b0e('0x17')](_0x8b0e('0x23'),_0x26a3e1[_0x8b0e('0x19')],_0x4a33ef);_0x171c97(_0x2028ed[_0x8b0e('0x17')](0x1f4,_0x26a3e1['message']));});});};exports[_0x8b0e('0x25')]=function(_0x1bf2a4){return new Promise(function(_0x770237,_0x405272){return db['FaxInteraction'][_0x8b0e('0x26')]({'where':_0x1bf2a4[_0x8b0e('0x1f')]?_0x1bf2a4[_0x8b0e('0x1f')][_0x8b0e('0x20')]||null:null})[_0x8b0e('0x11')](function(_0x2c4cb4){if(_0x2c4cb4){return _0x2c4cb4[_0x8b0e('0x27')](_0x1bf2a4[_0x8b0e('0x1e')][_0x8b0e('0x28')],_[_0x8b0e('0x29')](_0x1bf2a4[_0x8b0e('0x1e')],[_0x8b0e('0x28'),'id'])||{});}})['spread'](function(_0x277fcc){logger[_0x8b0e('0x12')](_0x8b0e('0x2a'),_0x1bf2a4);logger[_0x8b0e('0x24')]('AddTags',_0x1bf2a4,JSON[_0x8b0e('0x16')](_0x277fcc));_0x770237(_0x277fcc);})['catch'](function(_0x3aedb7){logger[_0x8b0e('0x17')](_0x8b0e('0x2a'),_0x3aedb7[_0x8b0e('0x19')],_0x1bf2a4);_0x405272(_this['error'](0x1f4,_0x3aedb7[_0x8b0e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 64d46be..c33f12f 100644 --- a/server/api/faxInteraction/faxInteraction.socket.js +++ b/server/api/faxInteraction/faxInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b92=['register','length','faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b92,0x13b));var _0x26b9=function(_0x38192c,_0x231e41){_0x38192c=_0x38192c-0x0;var _0x31d64e=_0x6b92[_0x38192c];return _0x31d64e;};'use strict';var FaxInteractionEvents=require(_0x26b9('0x0'));var events=['save',_0x26b9('0x1'),_0x26b9('0x2')];function createListener(_0x48bc4a,_0x36ce38){return function(_0x39d96b){_0x36ce38[_0x26b9('0x3')](_0x48bc4a,_0x39d96b);};}function removeListener(_0x52a1f1,_0xe3c3ff){return function(){FaxInteractionEvents[_0x26b9('0x4')](_0x52a1f1,_0xe3c3ff);};}exports[_0x26b9('0x5')]=function(_0x3118e3){for(var _0xce73ee=0x0,_0x22c7bb=events[_0x26b9('0x6')];_0xce73ee<_0x22c7bb;_0xce73ee++){var _0x3a00f7=events[_0xce73ee];var _0xbe79e3=createListener(_0x26b9('0x7')+_0x3a00f7,_0x3118e3);FaxInteractionEvents['on'](_0x3a00f7,_0xbe79e3);}}; \ No newline at end of file +var _0x5c6f=['save','emit','length','faxInteraction:','./faxInteraction.events'];(function(_0x108407,_0x329653){var _0xedcdf9=function(_0x1c8353){while(--_0x1c8353){_0x108407['push'](_0x108407['shift']());}};_0xedcdf9(++_0x329653);}(_0x5c6f,0x180));var _0xf5c6=function(_0x2356b9,_0x2c728f){_0x2356b9=_0x2356b9-0x0;var _0x23165a=_0x5c6f[_0x2356b9];return _0x23165a;};'use strict';var FaxInteractionEvents=require(_0xf5c6('0x0'));var events=[_0xf5c6('0x1'),'remove','update'];function createListener(_0x1adc8a,_0x5f4ba5){return function(_0x4c01d3){_0x5f4ba5[_0xf5c6('0x2')](_0x1adc8a,_0x4c01d3);};}function removeListener(_0x3bb665,_0x52dcd9){return function(){FaxInteractionEvents['removeListener'](_0x3bb665,_0x52dcd9);};}exports['register']=function(_0x5a3d4d){for(var _0x54ad6b=0x0,_0x1d8241=events[_0xf5c6('0x3')];_0x54ad6b<_0x1d8241;_0x54ad6b++){var _0x312bcf=events[_0x54ad6b];var _0x3d3ed9=createListener(_0xf5c6('0x4')+_0x312bcf,_0x5a3d4d);FaxInteractionEvents['on'](_0x312bcf,_0x3d3ed9);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 48647e1..a93b234 100644 --- a/server/api/faxInteraction/index.js +++ b/server/api/faxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaffe=['download','create','post','addMessage','/:id/tags','fax','faxinteraction:addtags','put','tracked','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download'];(function(_0x599b78,_0x5d906f){var _0x4872d9=function(_0x253a29){while(--_0x253a29){_0x599b78['push'](_0x599b78['shift']());}};_0x4872d9(++_0x5d906f);}(_0xaffe,0x163));var _0xeaff=function(_0x3c769c,_0x269a54){_0x3c769c=_0x3c769c-0x0;var _0x5d2e30=_0xaffe[_0x3c769c];return _0x5d2e30;};'use strict';var multer=require(_0xeaff('0x0'));var util=require(_0xeaff('0x1'));var path=require(_0xeaff('0x2'));var timeout=require(_0xeaff('0x3'));var express=require(_0xeaff('0x4'));var router=express[_0xeaff('0x5')]();var fs_extra=require(_0xeaff('0x6'));var auth=require(_0xeaff('0x7'));var interaction=require(_0xeaff('0x8'));var config=require(_0xeaff('0x9'));var controller=require(_0xeaff('0xa'));router[_0xeaff('0xb')]('/',auth[_0xeaff('0xc')](),controller[_0xeaff('0xd')]);router[_0xeaff('0xb')](_0xeaff('0xe'),auth[_0xeaff('0xc')](),controller['describe']);router[_0xeaff('0xb')](_0xeaff('0xf'),auth[_0xeaff('0xc')](),controller['show']);router[_0xeaff('0xb')](_0xeaff('0x10'),auth[_0xeaff('0xc')](),controller[_0xeaff('0x11')]);router[_0xeaff('0xb')](_0xeaff('0x12'),auth[_0xeaff('0xc')](),controller[_0xeaff('0x13')]);router['post']('/',auth[_0xeaff('0xc')](),controller[_0xeaff('0x14')]);router[_0xeaff('0x15')]('/:id/messages',auth[_0xeaff('0xc')](),controller[_0xeaff('0x16')]);router[_0xeaff('0x15')](_0xeaff('0x17'),auth['isAuthenticated'](),interaction['tracked'](_0xeaff('0x18'),_0xeaff('0x19')),controller['addTags']);router[_0xeaff('0x1a')](_0xeaff('0xf'),auth[_0xeaff('0xc')](),interaction[_0xeaff('0x1b')](_0xeaff('0x18'),_0xeaff('0x1c')),controller[_0xeaff('0x1d')]);router[_0xeaff('0x1e')]('/:id',auth[_0xeaff('0xc')](),interaction['tracked'](_0xeaff('0x18'),'faxinteraction:destroy'),controller[_0xeaff('0x1f')]);router[_0xeaff('0x1e')](_0xeaff('0x17'),auth[_0xeaff('0xc')](),controller[_0xeaff('0x20')]);module[_0xeaff('0x21')]=router; \ No newline at end of file +var _0x481b=['removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags'];(function(_0x4af5a6,_0x35b007){var _0x1fe0b1=function(_0x4c4171){while(--_0x4c4171){_0x4af5a6['push'](_0x4af5a6['shift']());}};_0x1fe0b1(++_0x35b007);}(_0x481b,0x86));var _0xb481=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x481b[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xb481('0x0'));var util=require(_0xb481('0x1'));var path=require('path');var timeout=require(_0xb481('0x2'));var express=require(_0xb481('0x3'));var router=express[_0xb481('0x4')]();var fs_extra=require(_0xb481('0x5'));var auth=require(_0xb481('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb481('0x7'));var controller=require(_0xb481('0x8'));router[_0xb481('0x9')]('/',auth[_0xb481('0xa')](),controller['index']);router[_0xb481('0x9')](_0xb481('0xb'),auth['isAuthenticated'](),controller[_0xb481('0xc')]);router[_0xb481('0x9')]('/:id',auth[_0xb481('0xa')](),controller[_0xb481('0xd')]);router[_0xb481('0x9')]('/:id/messages',auth[_0xb481('0xa')](),controller[_0xb481('0xe')]);router[_0xb481('0x9')](_0xb481('0xf'),auth[_0xb481('0xa')](),controller[_0xb481('0x10')]);router[_0xb481('0x11')]('/',auth[_0xb481('0xa')](),controller[_0xb481('0x12')]);router[_0xb481('0x11')](_0xb481('0x13'),auth[_0xb481('0xa')](),controller[_0xb481('0x14')]);router[_0xb481('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xb481('0x15')](_0xb481('0x16'),_0xb481('0x17')),controller[_0xb481('0x18')]);router[_0xb481('0x19')]('/:id',auth[_0xb481('0xa')](),interaction[_0xb481('0x15')](_0xb481('0x16'),'faxinteraction:update'),controller[_0xb481('0x1a')]);router[_0xb481('0x1b')]('/:id',auth[_0xb481('0xa')](),interaction[_0xb481('0x15')]('fax',_0xb481('0x1c')),controller[_0xb481('0x1d')]);router['delete'](_0xb481('0x1e'),auth[_0xb481('0xa')](),controller[_0xb481('0x1f')]);module[_0xb481('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8f7c08a..2f2467b 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3248=['exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x18b0ce,_0x5a4928){var _0x3333d5=function(_0x29b528){while(--_0x29b528){_0x18b0ce['push'](_0x18b0ce['shift']());}};_0x3333d5(++_0x5a4928);}(_0x3248,0x1bc));var _0x8324=function(_0x2c6d09,_0x4374fd){_0x2c6d09=_0x2c6d09-0x0;var _0x448fd8=_0x3248[_0x2c6d09];return _0x448fd8;};'use strict';var Sequelize=require('sequelize');module[_0x8324('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8324('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8324('0x2')]('in',_0x8324('0x3')),'defaultValue':_0x8324('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8324('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8324('0x5')]}}; \ No newline at end of file +var _0xfc1e=['out','DATE','medium','BOOLEAN','ENUM'];(function(_0x258108,_0x59d2da){var _0xd988a3=function(_0x28c1c6){while(--_0x28c1c6){_0x258108['push'](_0x258108['shift']());}};_0xd988a3(++_0x59d2da);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0xfc1e[_0x2dbce7];return _0x3a3ed0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xefc1('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xefc1('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xefc1('0x2')]('in',_0xefc1('0x3')),'defaultValue':_0xefc1('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xefc1('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 408ff06..3a5e249 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f7f=['where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','describe','fax-interactions','accept','read','readAt','format','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','findOne','SendFax','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','root','server','files','Attachment','basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','destroy','name','send','index','map','FaxMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x4f7f,0x1e9));var _0xf4f7=function(_0x94a464,_0x1d7e27){_0x94a464=_0x94a464-0x0;var _0x5f0dea=_0x4f7f[_0x94a464];return _0x5f0dea;};'use strict';var emlformat=require(_0xf4f7('0x0'));var rimraf=require(_0xf4f7('0x1'));var zipdir=require(_0xf4f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4f7('0x3'));var moment=require(_0xf4f7('0x4'));var BPromise=require(_0xf4f7('0x5'));var Mustache=require(_0xf4f7('0x6'));var util=require('util');var path=require(_0xf4f7('0x7'));var sox=require('sox');var csv=require(_0xf4f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4f7('0x9'));var _=require(_0xf4f7('0xa'));var squel=require(_0xf4f7('0xb'));var crypto=require(_0xf4f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf4f7('0xd'));var toCsv=require(_0xf4f7('0x8'));var querystring=require('querystring');var Papa=require(_0xf4f7('0xe'));var Redis=require(_0xf4f7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf4f7('0x10'));var as=require(_0xf4f7('0x11'));var hardwareService=require(_0xf4f7('0x12'));var logger=require(_0xf4f7('0x13'))(_0xf4f7('0x14'));var utils=require(_0xf4f7('0x15'));var config=require(_0xf4f7('0x16'));var licenseUtil=require(_0xf4f7('0x17'));var db=require(_0xf4f7('0x18'))['db'];config[_0xf4f7('0x19')]=_[_0xf4f7('0x1a')](config[_0xf4f7('0x19')],{'host':_0xf4f7('0x1b'),'port':0x18eb});var socket=require(_0xf4f7('0x1c'))(new Redis(config[_0xf4f7('0x19')]));require(_0xf4f7('0x1d'))[_0xf4f7('0x1e')](socket);var jayson=require(_0xf4f7('0x1f'));var client=jayson[_0xf4f7('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xf4f7('0x20')][_0xf4f7('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1a3620,_0x3ed280,_0x5160c1,_0x4871d8){return new BPromise(function(_0x2c7667,_0x46d817){var _0x49374d=_0x4871d8||client;return _0x49374d[_0xf4f7('0x22')](_0x1a3620,_0x5160c1)[_0xf4f7('0x23')](function(_0x8da750){logger[_0xf4f7('0x24')](_0xf4f7('0x25'),_0x3ed280,_0xf4f7('0x26'));logger['debug'](_0xf4f7('0x27'),_0x3ed280,_0xf4f7('0x26'),JSON[_0xf4f7('0x28')](_0x8da750));if(_0x8da750[_0xf4f7('0x29')]){if(_0x8da750[_0xf4f7('0x29')][_0xf4f7('0x2a')]===0x1f4){logger[_0xf4f7('0x29')](_0xf4f7('0x25'),_0x3ed280,_0x8da750[_0xf4f7('0x29')][_0xf4f7('0x2b')]);return _0x46d817(_0x8da750[_0xf4f7('0x29')][_0xf4f7('0x2b')]);}logger['error'](_0xf4f7('0x25'),_0x3ed280,_0x8da750['error'][_0xf4f7('0x2b')]);return _0x2c7667(_0x8da750[_0xf4f7('0x29')]['message']);}else{logger['info'](_0xf4f7('0x25'),_0x3ed280,_0xf4f7('0x26'));_0x2c7667(_0x8da750[_0xf4f7('0x2c')][_0xf4f7('0x2b')]);}})[_0xf4f7('0x2d')](function(_0x2c1240){logger[_0xf4f7('0x29')]('FaxMessage,\x20%s,\x20%s',_0x3ed280,_0x2c1240);_0x46d817(_0x2c1240);});});}function respondWithStatusCode(_0x5c0ee6,_0x2e3b51){_0x2e3b51=_0x2e3b51||0xcc;return function(_0x3e6790){if(_0x3e6790){return _0x5c0ee6[_0xf4f7('0x2e')](_0x2e3b51);}return _0x5c0ee6['status'](_0x2e3b51)[_0xf4f7('0x2f')]();};}function respondWithResult(_0x2fcc1c,_0x36870a){_0x36870a=_0x36870a||0xc8;return function(_0xd48528){if(_0xd48528){return _0x2fcc1c['status'](_0x36870a)[_0xf4f7('0x30')](_0xd48528);}};}function respondWithFilteredResult(_0x50947e,_0x5a77d5){return function(_0xc9274){if(_0xc9274){var _0x383dd7=typeof _0x5a77d5[_0xf4f7('0x31')]===_0xf4f7('0x32')&&typeof _0x5a77d5[_0xf4f7('0x33')]===_0xf4f7('0x32');var _0x57cf50=_0xc9274[_0xf4f7('0x34')];var _0x24524a=_0x383dd7?0x0:_0x5a77d5[_0xf4f7('0x31')];var _0x398078=_0x383dd7?_0xc9274[_0xf4f7('0x34')]:_0x5a77d5[_0xf4f7('0x31')]+_0x5a77d5[_0xf4f7('0x33')];var _0x15e2b2;if(_0x398078>=_0x57cf50){_0x398078=_0x57cf50;_0x15e2b2=0xc8;}else{_0x15e2b2=0xce;}_0x50947e[_0xf4f7('0x35')](_0x15e2b2);return _0x50947e[_0xf4f7('0x36')](_0xf4f7('0x37'),_0x24524a+'-'+_0x398078+'/'+_0x57cf50)['json'](_0xc9274);}return null;};}function patchUpdates(_0x5dd6a6){return function(_0x1da97d){try{jsonpatch['apply'](_0x1da97d,_0x5dd6a6,!![]);}catch(_0x431d10){return BPromise['reject'](_0x431d10);}return _0x1da97d[_0xf4f7('0x38')]();};}function saveUpdates(_0x552f1c,_0x41af34){return function(_0x30c37c){if(_0x30c37c){return _0x30c37c[_0xf4f7('0x39')](_0x552f1c)[_0xf4f7('0x23')](function(_0x11dfcd){return _0x11dfcd;});}return null;};}function removeEntity(_0x27e582,_0x545732){return function(_0x5b1f52){if(_0x5b1f52){return _0x5b1f52[_0xf4f7('0x3a')]()[_0xf4f7('0x23')](function(){_0x27e582[_0xf4f7('0x35')](0xcc)[_0xf4f7('0x2f')]();});}};}function handleEntityNotFound(_0x4b0a6f,_0x3ce343){return function(_0x37a76e){if(!_0x37a76e){_0x4b0a6f[_0xf4f7('0x2e')](0x194);}return _0x37a76e;};}function handleError(_0x299c74,_0x42bdd9){_0x42bdd9=_0x42bdd9||0x1f4;return function(_0x125660){logger['error'](_0x125660['stack']);if(_0x125660[_0xf4f7('0x3b')]){delete _0x125660['name'];}_0x299c74[_0xf4f7('0x35')](_0x42bdd9)[_0xf4f7('0x3c')](_0x125660);};}exports[_0xf4f7('0x3d')]=function(_0x4dae5b,_0x4bd940){var _0x393897={},_0xcc6bf4={},_0x1bc88a={'count':0x0,'rows':[]};var _0x7c16f3=_[_0xf4f7('0x3e')](db[_0xf4f7('0x3f')][_0xf4f7('0x40')],function(_0x393557){return{'name':_0x393557[_0xf4f7('0x41')],'type':_0x393557['type']['key']};});_0xcc6bf4[_0xf4f7('0x42')]=_['map'](_0x7c16f3,_0xf4f7('0x3b'));_0xcc6bf4['query']=_[_0xf4f7('0x43')](_0x4dae5b[_0xf4f7('0x44')]);_0xcc6bf4[_0xf4f7('0x45')]=_[_0xf4f7('0x46')](_0xcc6bf4[_0xf4f7('0x42')],_0xcc6bf4[_0xf4f7('0x44')]);_0x393897[_0xf4f7('0x47')]=_[_0xf4f7('0x46')](_0xcc6bf4[_0xf4f7('0x42')],qs[_0xf4f7('0x48')](_0x4dae5b['query']['fields']));_0x393897[_0xf4f7('0x47')]=_0x393897[_0xf4f7('0x47')][_0xf4f7('0x49')]?_0x393897['attributes']:_0xcc6bf4['model'];if(!_0x4dae5b[_0xf4f7('0x44')][_0xf4f7('0x4a')]('nolimit')){_0x393897['limit']=qs[_0xf4f7('0x33')](_0x4dae5b[_0xf4f7('0x44')][_0xf4f7('0x33')]);_0x393897['offset']=qs[_0xf4f7('0x31')](_0x4dae5b['query']['offset']);}_0x393897[_0xf4f7('0x4b')]=qs[_0xf4f7('0x4c')](_0x4dae5b[_0xf4f7('0x44')][_0xf4f7('0x4c')]);_0x393897['where']=qs[_0xf4f7('0x45')](_['pick'](_0x4dae5b['query'],_0xcc6bf4[_0xf4f7('0x45')]),_0x7c16f3);if(_0x4dae5b[_0xf4f7('0x44')][_0xf4f7('0x4d')]){_0x393897['where']=_[_0xf4f7('0x4e')](_0x393897[_0xf4f7('0x4f')],{'$or':_[_0xf4f7('0x3e')](_0x7c16f3,function(_0x15a1c8){if(_0x15a1c8['type']!==_0xf4f7('0x50')){var _0x343c0d={};_0x343c0d[_0x15a1c8[_0xf4f7('0x3b')]]={'$like':'%'+_0x4dae5b[_0xf4f7('0x44')][_0xf4f7('0x4d')]+'%'};return _0x343c0d;}})});}_0x393897=_[_0xf4f7('0x4e')]({},_0x393897,_0x4dae5b[_0xf4f7('0x51')]);var _0x2d53be={'where':_0x393897['where']};return db[_0xf4f7('0x3f')]['count'](_0x2d53be)['then'](function(_0xf2a0e5){_0x1bc88a[_0xf4f7('0x34')]=_0xf2a0e5;if(_0x4dae5b[_0xf4f7('0x44')][_0xf4f7('0x52')]){_0x393897[_0xf4f7('0x53')]=[{'all':!![]}];}return db[_0xf4f7('0x3f')][_0xf4f7('0x54')](_0x393897);})[_0xf4f7('0x23')](function(_0xcfb9e9){_0x1bc88a[_0xf4f7('0x55')]=_0xcfb9e9;return _0x1bc88a;})[_0xf4f7('0x23')](respondWithFilteredResult(_0x4bd940,_0x393897))[_0xf4f7('0x2d')](handleError(_0x4bd940,null));};exports[_0xf4f7('0x56')]=function(_0x49d343,_0x248870){var _0x41d245={'raw':!![],'where':{'id':_0x49d343[_0xf4f7('0x57')]['id']}},_0x45951e={};_0x45951e[_0xf4f7('0x42')]=_[_0xf4f7('0x43')](db[_0xf4f7('0x3f')][_0xf4f7('0x40')]);_0x45951e['query']=_[_0xf4f7('0x43')](_0x49d343[_0xf4f7('0x44')]);_0x45951e['filters']=_[_0xf4f7('0x46')](_0x45951e[_0xf4f7('0x42')],_0x45951e['query']);_0x41d245['attributes']=_[_0xf4f7('0x46')](_0x45951e['model'],qs['fields'](_0x49d343[_0xf4f7('0x44')][_0xf4f7('0x48')]));_0x41d245[_0xf4f7('0x47')]=_0x41d245[_0xf4f7('0x47')][_0xf4f7('0x49')]?_0x41d245[_0xf4f7('0x47')]:_0x45951e[_0xf4f7('0x42')];if(_0x49d343[_0xf4f7('0x44')][_0xf4f7('0x52')]){_0x41d245[_0xf4f7('0x53')]=[{'all':!![]}];}_0x41d245=_[_0xf4f7('0x4e')]({},_0x41d245,_0x49d343[_0xf4f7('0x51')]);return db[_0xf4f7('0x3f')][_0xf4f7('0x58')](_0x41d245)['then'](handleEntityNotFound(_0x248870,null))[_0xf4f7('0x23')](respondWithResult(_0x248870,null))[_0xf4f7('0x2d')](handleError(_0x248870,null));};exports[_0xf4f7('0x39')]=function(_0x423780,_0x4245cd){if(_0x423780[_0xf4f7('0x59')]['id']){delete _0x423780['body']['id'];}return db[_0xf4f7('0x3f')][_0xf4f7('0x58')]({'where':{'id':_0x423780[_0xf4f7('0x57')]['id']}})['then'](handleEntityNotFound(_0x4245cd,null))[_0xf4f7('0x23')](saveUpdates(_0x423780[_0xf4f7('0x59')],null))['then'](respondWithResult(_0x4245cd,null))[_0xf4f7('0x2d')](handleError(_0x4245cd,null));};exports[_0xf4f7('0x3a')]=function(_0x31e061,_0x14f160){return db[_0xf4f7('0x3f')]['find']({'where':{'id':_0x31e061[_0xf4f7('0x57')]['id']}})['then'](handleEntityNotFound(_0x14f160,null))[_0xf4f7('0x23')](removeEntity(_0x14f160,null))[_0xf4f7('0x2d')](handleError(_0x14f160,null));};exports[_0xf4f7('0x5a')]=function(_0x1b4ded,_0x2518fb){return db[_0xf4f7('0x3f')][_0xf4f7('0x5a')]()[_0xf4f7('0x23')](respondWithResult(_0x2518fb,null))[_0xf4f7('0x2d')](handleError(_0x2518fb,null));};var interaction_log=require(_0xf4f7('0x13'))(_0xf4f7('0x5b'));exports[_0xf4f7('0x5c')]=function(_0xa96b46,_0x418a2e,_0x5db873){var _0x266461={'agent':{},'channel':'fax'};if(_0xa96b46[_0xf4f7('0x59')]['id']){delete _0xa96b46['body']['id'];}_0xa96b46['body'][_0xf4f7('0x5d')]=!![];_0xa96b46['body'][_0xf4f7('0x5e')]=moment()[_0xf4f7('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0xa96b46[_0xf4f7('0x59')][_0xf4f7('0x60')]=_0xa96b46['body'][_0xf4f7('0x60')]||_0xa96b46['user']['id'];_0x266461['agent']['id']=_0xa96b46['body'][_0xf4f7('0x60')];return db[_0xf4f7('0x3f')][_0xf4f7('0x58')]({'where':{'id':_0xa96b46['params']['id'],'UserId':null}})[_0xf4f7('0x23')](handleEntityNotFound(_0x418a2e,null))[_0xf4f7('0x23')](saveUpdates(_0xa96b46[_0xf4f7('0x59')],null))[_0xf4f7('0x23')](function(_0x1934d3){if(_0x1934d3){_0x266461[_0xf4f7('0x2b')]=_0x1934d3[_0xf4f7('0x61')]({'plain':!![]});return db[_0xf4f7('0x62')]['find']({'where':{'id':_0x1934d3[_0xf4f7('0x63')]}});}return null;})[_0xf4f7('0x23')](handleEntityNotFound(_0x418a2e,null))[_0xf4f7('0x23')](function(_0x5e8798){if(_0x5e8798){return _0x5e8798[_0xf4f7('0x39')]({'UserId':_0xa96b46[_0xf4f7('0x59')][_0xf4f7('0x60')],'read1stAt':_[_0xf4f7('0x64')](_0x5e8798[_0xf4f7('0x65')])?moment()[_0xf4f7('0x5f')](_0xf4f7('0x66')):undefined});}return null;})[_0xf4f7('0x23')](function(_0x3e1501){if(_0x3e1501){_0x266461[_0xf4f7('0x67')]=_0x3e1501[_0xf4f7('0x61')]({'plain':!![]});interaction_log[_0xf4f7('0x24')](_0xf4f7('0x68'),_0xa96b46[_0xf4f7('0x69')]['id'],_0xa96b46[_0xf4f7('0x69')]['name'],_0xa96b46[_0xf4f7('0x69')][_0xf4f7('0x6a')],_0x266461[_0xf4f7('0x67')]['id'],_0xa96b46['body']?JSON[_0xf4f7('0x28')](_0xa96b46['body']):'null');return respondWithRpcPromise(_0xf4f7('0x6b'),_0xf4f7('0x6c'),_0x266461);}return null;})[_0xf4f7('0x23')](function(_0x3d1bf4){var _0x17f37e=_0xf4f7('0x6d')+_0x3d1bf4['message'][_0xf4f7('0x6e')];return db[_0xf4f7('0x6f')][_0xf4f7('0x44')](_0x17f37e,{'type':db[_0xf4f7('0x70')][_0xf4f7('0x71')][_0xf4f7('0x72')],'raw':!![]})[_0xf4f7('0x23')](function(_0x603bf5){return _0x603bf5;});})['then'](function(_0x405d48){if(_0x405d48){_0x266461['message']['contact']=_0x405d48[0x0];if(!_0xa96b46['body']['UserId'])return;return db[_0xf4f7('0x73')][_0xf4f7('0x58')]({'where':{'id':_0xa96b46[_0xf4f7('0x59')][_0xf4f7('0x60')],'role':_0xf4f7('0x74')},'attributes':['id',_0xf4f7('0x3b'),_0xf4f7('0x75'),_0xf4f7('0x76'),_0xf4f7('0x77')],'raw':!![]});}return null;})['then'](function(_0x508898){if(!_0x508898)return null;_0x266461['message']['agent']=_0x508898;return _0x266461;})[_0xf4f7('0x23')](function(_0x2ce12d){if(_0x2ce12d){if(_0xa96b46[_0xf4f7('0x59')][_0xf4f7('0x78')]){_0x266461[_0xf4f7('0x2b')][_0xf4f7('0x79')]=util[_0xf4f7('0x5f')](_0xf4f7('0x7a'),_0xa96b46[_0xf4f7('0x69')][_0xf4f7('0x3b')]);_0x266461[_0xf4f7('0x2b')][_0xf4f7('0x7b')]=_0x266461['channel'];_0x266461['message']['motionChannel']=_0x266461['channel'];_0x266461[_0xf4f7('0x2b')]['event']=_0xf4f7('0x5c');return respondWithRpcPromise(_0xf4f7('0x7c'),_0xf4f7('0x7c'),{'event':_0xf4f7('0x7d'),'message':_0x266461[_0xf4f7('0x2b')]},client9002)[_0xf4f7('0x23')](function(){return _0x266461;});}return _0x266461;}return null;})['then'](respondWithResult(_0x418a2e,null))[_0xf4f7('0x2d')](handleError(_0x418a2e,null));};var interaction_log=require(_0xf4f7('0x13'))(_0xf4f7('0x5b'));exports[_0xf4f7('0x7e')]=function(_0x8e4794,_0x4454f1,_0x182cc0){var _0x23fff8={'agent':{},'channel':_0xf4f7('0x7f')};if(_0x8e4794[_0xf4f7('0x59')]['id']){delete _0x8e4794['body']['id'];}_0x8e4794[_0xf4f7('0x59')]['UserId']=_0x8e4794[_0xf4f7('0x59')]['UserId']||_0x8e4794[_0xf4f7('0x69')]['id'];_0x23fff8[_0xf4f7('0x74')]['id']=_0x8e4794[_0xf4f7('0x59')][_0xf4f7('0x60')];return db[_0xf4f7('0x3f')][_0xf4f7('0x58')]({'where':{'id':_0x8e4794['params']['id'],'UserId':null}})[_0xf4f7('0x23')](handleEntityNotFound(_0x4454f1,null))[_0xf4f7('0x23')](function(_0x36bcee){if(_0x36bcee){_0x23fff8[_0xf4f7('0x2b')]=_0x36bcee['get']({'plain':!![]});return db[_0xf4f7('0x62')][_0xf4f7('0x58')]({'where':{'id':_0x36bcee['FaxInteractionId']}});}return null;})[_0xf4f7('0x23')](handleEntityNotFound(_0x4454f1,null))[_0xf4f7('0x23')](function(_0x5dd00b){if(_0x5dd00b){_0x23fff8['interaction']=_0x5dd00b[_0xf4f7('0x61')]({'plain':!![]});interaction_log[_0xf4f7('0x24')](_0xf4f7('0x80'),_0x8e4794[_0xf4f7('0x69')]['id'],_0x8e4794[_0xf4f7('0x69')]['name'],_0x8e4794['user'][_0xf4f7('0x6a')],_0x23fff8['interaction']['id'],_0x8e4794['body']?JSON[_0xf4f7('0x28')](_0x8e4794[_0xf4f7('0x59')]):'null');return respondWithRpcPromise(_0xf4f7('0x81'),_0xf4f7('0x82'),_0x23fff8);}return null;})['then'](function(_0x5395a1){var _0x1b2138=_0xf4f7('0x6d')+_0x5395a1['message'][_0xf4f7('0x6e')];return db[_0xf4f7('0x6f')]['query'](_0x1b2138,{'type':db['Sequelize'][_0xf4f7('0x71')]['SELECT'],'raw':!![]})[_0xf4f7('0x23')](function(_0x15c03c){return _0x15c03c;});})[_0xf4f7('0x23')](function(_0x34cc79){if(_0x34cc79){_0x23fff8['message']['contact']=_0x34cc79[0x0];if(!_0x8e4794[_0xf4f7('0x59')][_0xf4f7('0x60')])return;return db[_0xf4f7('0x73')][_0xf4f7('0x58')]({'where':{'id':_0x8e4794[_0xf4f7('0x59')]['UserId'],'role':'agent'},'attributes':['id',_0xf4f7('0x3b'),_0xf4f7('0x75'),_0xf4f7('0x76'),_0xf4f7('0x77')],'raw':!![]});}return null;})[_0xf4f7('0x23')](function(_0x2f07bd){if(!_0x2f07bd)return null;_0x23fff8[_0xf4f7('0x2b')][_0xf4f7('0x74')]=_0x2f07bd;return _0x23fff8;})[_0xf4f7('0x23')](function(_0x481b88){if(_0x481b88){_0x481b88['message'][_0xf4f7('0x79')]=util[_0xf4f7('0x5f')](_0xf4f7('0x7a'),_0x8e4794['user'][_0xf4f7('0x3b')]);_0x481b88[_0xf4f7('0x2b')][_0xf4f7('0x7b')]=_0x23fff8[_0xf4f7('0x7b')];_0x481b88[_0xf4f7('0x2b')]['motionChannel']=_0x23fff8[_0xf4f7('0x7b')];_0x481b88[_0xf4f7('0x2b')]['event']=_0xf4f7('0x7e');respondWithRpcPromise('EventManager',_0xf4f7('0x7c'),{'event':'rejectmessage','message':_0x481b88[_0xf4f7('0x2b')]},client9002);return _0x23fff8;}return null;})[_0xf4f7('0x23')](respondWithResult(_0x4454f1,null))['catch'](handleError(_0x4454f1,null));};exports['create']=function(_0x53b7f7,_0x35c0ae){var _0x2f692d;return db['FaxMessage']['create'](_0x53b7f7[_0xf4f7('0x59')],{})[_0xf4f7('0x23')](function(_0x29cafd){_0x2f692d=_0x29cafd;return db['CmContact'][_0xf4f7('0x83')]({'where':{'id':_0x2f692d[_0xf4f7('0x6e')]}});})[_0xf4f7('0x23')](function(_0x46d772){if(_[_0xf4f7('0x64')](_0x46d772)){return;}else{_0x2f692d[_0xf4f7('0x7f')]=_0x46d772['fax'];return db['Attachment'][_0xf4f7('0x83')]({'where':{'id':_0x2f692d['AttachmentId']}});}})[_0xf4f7('0x23')](function(_0x3a7703){return respondWithRpcPromise('SendFax',_0xf4f7('0x84'),{'FaxAccountId':_[_0xf4f7('0x64')](_0x53b7f7['body'])?undefined:_0x53b7f7[_0xf4f7('0x59')]['FaxAccountId'],'path':_[_0xf4f7('0x64')](_0x3a7703)?undefined:util[_0xf4f7('0x5f')](_0xf4f7('0x85'),_0x3a7703['basename']),'fax':_[_0xf4f7('0x64')](_0x2f692d[_0xf4f7('0x7f')])?undefined:_0x2f692d[_0xf4f7('0x7f')],'AttachmentId':_0x2f692d[_0xf4f7('0x86')]},client9002);})['then'](respondWithResult(_0x35c0ae,0xc9))[_0xf4f7('0x2d')](handleError(_0x35c0ae,null));};exports[_0xf4f7('0x87')]=function(_0x405b71,_0x333c0c){var _0x4973e3=path[_0xf4f7('0x88')](config[_0xf4f7('0x89')],_0xf4f7('0x8a'),_0xf4f7('0x8b'),'attachments');return db[_0xf4f7('0x3f')]['find']({'where':{'id':_0x405b71[_0xf4f7('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0xf4f7('0x8c')}]})['then'](handleEntityNotFound(_0x333c0c,null))[_0xf4f7('0x23')](function(_0x46d93f){if(_0x46d93f){return _0x333c0c[_0xf4f7('0x87')](path[_0xf4f7('0x88')](_0x4973e3,_0x46d93f[_0xf4f7('0x8c')][_0xf4f7('0x8d')]));}})[_0xf4f7('0x2d')](handleError(_0x333c0c,null));}; \ No newline at end of file +var _0x6a6d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','register','client','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','stack','name','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','filter','merge','options','include','rows','intersection','length','includeAll','find','update','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','stringify','null','AcceptMessage','acceptMessage','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','email','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','basename','root','server','files','Attachment','download','join','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x4a1931,_0x4290f7){var _0x3588f7=function(_0x395da2){while(--_0x395da2){_0x4a1931['push'](_0x4a1931['shift']());}};_0x3588f7(++_0x4290f7);}(_0x6a6d,0x19d));var _0xd6a6=function(_0x4a4933,_0x37d47c){_0x4a4933=_0x4a4933-0x0;var _0x31aab3=_0x6a6d[_0x4a4933];return _0x31aab3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6a6('0x0'));var zipdir=require(_0xd6a6('0x1'));var jsonpatch=require(_0xd6a6('0x2'));var rp=require(_0xd6a6('0x3'));var moment=require(_0xd6a6('0x4'));var BPromise=require(_0xd6a6('0x5'));var Mustache=require(_0xd6a6('0x6'));var util=require(_0xd6a6('0x7'));var path=require(_0xd6a6('0x8'));var sox=require('sox');var csv=require(_0xd6a6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6a6('0xa'));var _=require(_0xd6a6('0xb'));var squel=require(_0xd6a6('0xc'));var crypto=require(_0xd6a6('0xd'));var jsforce=require(_0xd6a6('0xe'));var deskjs=require(_0xd6a6('0xf'));var toCsv=require(_0xd6a6('0x9'));var querystring=require(_0xd6a6('0x10'));var Papa=require(_0xd6a6('0x11'));var Redis=require(_0xd6a6('0x12'));var authService=require(_0xd6a6('0x13'));var qs=require(_0xd6a6('0x14'));var as=require(_0xd6a6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6a6('0x16'));var utils=require(_0xd6a6('0x17'));var config=require(_0xd6a6('0x18'));var licenseUtil=require(_0xd6a6('0x19'));var db=require(_0xd6a6('0x1a'))['db'];config['redis']=_[_0xd6a6('0x1b')](config[_0xd6a6('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6a6('0x1c')]));require('./faxMessage.socket')[_0xd6a6('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd6a6('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349b6c,_0x57c5b1,_0x5a44d1,_0x24d247){return new BPromise(function(_0x441133,_0x31a649){var _0x38faf5=_0x24d247||client;return _0x38faf5[_0xd6a6('0x1f')](_0x349b6c,_0x5a44d1)['then'](function(_0xe6c5e9){logger['info'](_0xd6a6('0x20'),_0x57c5b1,_0xd6a6('0x21'));logger[_0xd6a6('0x22')](_0xd6a6('0x23'),_0x57c5b1,_0xd6a6('0x21'),JSON['stringify'](_0xe6c5e9));if(_0xe6c5e9[_0xd6a6('0x24')]){if(_0xe6c5e9[_0xd6a6('0x24')][_0xd6a6('0x25')]===0x1f4){logger[_0xd6a6('0x24')](_0xd6a6('0x20'),_0x57c5b1,_0xe6c5e9['error'][_0xd6a6('0x26')]);return _0x31a649(_0xe6c5e9[_0xd6a6('0x24')][_0xd6a6('0x26')]);}logger[_0xd6a6('0x24')](_0xd6a6('0x20'),_0x57c5b1,_0xe6c5e9['error'][_0xd6a6('0x26')]);return _0x441133(_0xe6c5e9[_0xd6a6('0x24')]['message']);}else{logger[_0xd6a6('0x27')](_0xd6a6('0x20'),_0x57c5b1,_0xd6a6('0x21'));_0x441133(_0xe6c5e9['result'][_0xd6a6('0x26')]);}})[_0xd6a6('0x28')](function(_0x42d56c){logger[_0xd6a6('0x24')](_0xd6a6('0x20'),_0x57c5b1,_0x42d56c);_0x31a649(_0x42d56c);});});}function respondWithStatusCode(_0x5ad99a,_0x30aaea){_0x30aaea=_0x30aaea||0xcc;return function(_0x3dea9a){if(_0x3dea9a){return _0x5ad99a['sendStatus'](_0x30aaea);}return _0x5ad99a[_0xd6a6('0x29')](_0x30aaea)[_0xd6a6('0x2a')]();};}function respondWithResult(_0x100acb,_0x23579d){_0x23579d=_0x23579d||0xc8;return function(_0x57aaeb){if(_0x57aaeb){return _0x100acb[_0xd6a6('0x29')](_0x23579d)[_0xd6a6('0x2b')](_0x57aaeb);}};}function respondWithFilteredResult(_0xc36976,_0x3c4438){return function(_0x38e4c1){if(_0x38e4c1){var _0x276d21=typeof _0x3c4438[_0xd6a6('0x2c')]===_0xd6a6('0x2d')&&typeof _0x3c4438[_0xd6a6('0x2e')]===_0xd6a6('0x2d');var _0x53388d=_0x38e4c1[_0xd6a6('0x2f')];var _0x3de7d3=_0x276d21?0x0:_0x3c4438[_0xd6a6('0x2c')];var _0x576c04=_0x276d21?_0x38e4c1[_0xd6a6('0x2f')]:_0x3c4438[_0xd6a6('0x2c')]+_0x3c4438[_0xd6a6('0x2e')];var _0x977d46;if(_0x576c04>=_0x53388d){_0x576c04=_0x53388d;_0x977d46=0xc8;}else{_0x977d46=0xce;}_0xc36976[_0xd6a6('0x29')](_0x977d46);return _0xc36976[_0xd6a6('0x30')](_0xd6a6('0x31'),_0x3de7d3+'-'+_0x576c04+'/'+_0x53388d)[_0xd6a6('0x2b')](_0x38e4c1);}return null;};}function patchUpdates(_0x48bf7a){return function(_0x31709e){try{jsonpatch[_0xd6a6('0x32')](_0x31709e,_0x48bf7a,!![]);}catch(_0x108d8d){return BPromise[_0xd6a6('0x33')](_0x108d8d);}return _0x31709e['save']();};}function saveUpdates(_0x138cf8,_0x1facf3){return function(_0x3812f1){if(_0x3812f1){return _0x3812f1['update'](_0x138cf8)['then'](function(_0x417e42){return _0x417e42;});}return null;};}function removeEntity(_0x3cc02e,_0x16d04c){return function(_0x4b5165){if(_0x4b5165){return _0x4b5165[_0xd6a6('0x34')]()[_0xd6a6('0x35')](function(){_0x3cc02e[_0xd6a6('0x29')](0xcc)[_0xd6a6('0x2a')]();});}};}function handleEntityNotFound(_0x47321d,_0x52c9cf){return function(_0x14885c){if(!_0x14885c){_0x47321d['sendStatus'](0x194);}return _0x14885c;};}function handleError(_0x26d9dc,_0xf5c3d3){_0xf5c3d3=_0xf5c3d3||0x1f4;return function(_0x2fcdfb){logger[_0xd6a6('0x24')](_0x2fcdfb[_0xd6a6('0x36')]);if(_0x2fcdfb[_0xd6a6('0x37')]){delete _0x2fcdfb[_0xd6a6('0x37')];}_0x26d9dc[_0xd6a6('0x29')](_0xf5c3d3)['send'](_0x2fcdfb);};}exports['index']=function(_0x40cf3b,_0x1d6da5){var _0x4130b4={},_0x18a20c={},_0x186854={'count':0x0,'rows':[]};var _0x40c2d4=_[_0xd6a6('0x38')](db[_0xd6a6('0x39')][_0xd6a6('0x3a')],function(_0x3a4daf){return{'name':_0x3a4daf[_0xd6a6('0x3b')],'type':_0x3a4daf[_0xd6a6('0x3c')][_0xd6a6('0x3d')]};});_0x18a20c[_0xd6a6('0x3e')]=_[_0xd6a6('0x38')](_0x40c2d4,_0xd6a6('0x37'));_0x18a20c[_0xd6a6('0x3f')]=_[_0xd6a6('0x40')](_0x40cf3b['query']);_0x18a20c[_0xd6a6('0x41')]=_['intersection'](_0x18a20c[_0xd6a6('0x3e')],_0x18a20c['query']);_0x4130b4[_0xd6a6('0x42')]=_['intersection'](_0x18a20c[_0xd6a6('0x3e')],qs['fields'](_0x40cf3b['query'][_0xd6a6('0x43')]));_0x4130b4['attributes']=_0x4130b4['attributes']['length']?_0x4130b4[_0xd6a6('0x42')]:_0x18a20c['model'];if(!_0x40cf3b[_0xd6a6('0x3f')]['hasOwnProperty'](_0xd6a6('0x44'))){_0x4130b4[_0xd6a6('0x2e')]=qs[_0xd6a6('0x2e')](_0x40cf3b[_0xd6a6('0x3f')][_0xd6a6('0x2e')]);_0x4130b4[_0xd6a6('0x2c')]=qs['offset'](_0x40cf3b[_0xd6a6('0x3f')][_0xd6a6('0x2c')]);}_0x4130b4[_0xd6a6('0x45')]=qs[_0xd6a6('0x46')](_0x40cf3b[_0xd6a6('0x3f')][_0xd6a6('0x46')]);_0x4130b4[_0xd6a6('0x47')]=qs[_0xd6a6('0x41')](_['pick'](_0x40cf3b[_0xd6a6('0x3f')],_0x18a20c[_0xd6a6('0x41')]),_0x40c2d4);if(_0x40cf3b[_0xd6a6('0x3f')]['filter']){_0x4130b4['where']=_['merge'](_0x4130b4[_0xd6a6('0x47')],{'$or':_[_0xd6a6('0x38')](_0x40c2d4,function(_0x2578a4){if(_0x2578a4[_0xd6a6('0x3c')]!=='VIRTUAL'){var _0x7f3a39={};_0x7f3a39[_0x2578a4[_0xd6a6('0x37')]]={'$like':'%'+_0x40cf3b[_0xd6a6('0x3f')][_0xd6a6('0x48')]+'%'};return _0x7f3a39;}})});}_0x4130b4=_[_0xd6a6('0x49')]({},_0x4130b4,_0x40cf3b[_0xd6a6('0x4a')]);var _0x2c8b27={'where':_0x4130b4[_0xd6a6('0x47')]};return db[_0xd6a6('0x39')][_0xd6a6('0x2f')](_0x2c8b27)['then'](function(_0x2df16a){_0x186854[_0xd6a6('0x2f')]=_0x2df16a;if(_0x40cf3b[_0xd6a6('0x3f')]['includeAll']){_0x4130b4[_0xd6a6('0x4b')]=[{'all':!![]}];}return db[_0xd6a6('0x39')]['findAll'](_0x4130b4);})[_0xd6a6('0x35')](function(_0x23835f){_0x186854[_0xd6a6('0x4c')]=_0x23835f;return _0x186854;})['then'](respondWithFilteredResult(_0x1d6da5,_0x4130b4))[_0xd6a6('0x28')](handleError(_0x1d6da5,null));};exports['show']=function(_0x4a9766,_0x40b27f){var _0x2ebae0={'raw':!![],'where':{'id':_0x4a9766['params']['id']}},_0x261f87={};_0x261f87[_0xd6a6('0x3e')]=_['keys'](db[_0xd6a6('0x39')]['rawAttributes']);_0x261f87[_0xd6a6('0x3f')]=_['keys'](_0x4a9766['query']);_0x261f87[_0xd6a6('0x41')]=_[_0xd6a6('0x4d')](_0x261f87[_0xd6a6('0x3e')],_0x261f87[_0xd6a6('0x3f')]);_0x2ebae0[_0xd6a6('0x42')]=_[_0xd6a6('0x4d')](_0x261f87[_0xd6a6('0x3e')],qs['fields'](_0x4a9766[_0xd6a6('0x3f')][_0xd6a6('0x43')]));_0x2ebae0[_0xd6a6('0x42')]=_0x2ebae0[_0xd6a6('0x42')][_0xd6a6('0x4e')]?_0x2ebae0['attributes']:_0x261f87[_0xd6a6('0x3e')];if(_0x4a9766[_0xd6a6('0x3f')][_0xd6a6('0x4f')]){_0x2ebae0[_0xd6a6('0x4b')]=[{'all':!![]}];}_0x2ebae0=_['merge']({},_0x2ebae0,_0x4a9766['options']);return db[_0xd6a6('0x39')][_0xd6a6('0x50')](_0x2ebae0)[_0xd6a6('0x35')](handleEntityNotFound(_0x40b27f,null))['then'](respondWithResult(_0x40b27f,null))[_0xd6a6('0x28')](handleError(_0x40b27f,null));};exports[_0xd6a6('0x51')]=function(_0x160651,_0x4dc794){if(_0x160651['body']['id']){delete _0x160651[_0xd6a6('0x52')]['id'];}return db[_0xd6a6('0x39')][_0xd6a6('0x50')]({'where':{'id':_0x160651[_0xd6a6('0x53')]['id']}})['then'](handleEntityNotFound(_0x4dc794,null))[_0xd6a6('0x35')](saveUpdates(_0x160651['body'],null))[_0xd6a6('0x35')](respondWithResult(_0x4dc794,null))[_0xd6a6('0x28')](handleError(_0x4dc794,null));};exports[_0xd6a6('0x34')]=function(_0x935f57,_0x58cfac){return db['FaxMessage']['find']({'where':{'id':_0x935f57[_0xd6a6('0x53')]['id']}})['then'](handleEntityNotFound(_0x58cfac,null))[_0xd6a6('0x35')](removeEntity(_0x58cfac,null))[_0xd6a6('0x28')](handleError(_0x58cfac,null));};exports[_0xd6a6('0x54')]=function(_0x3f6067,_0x4e514a){return db[_0xd6a6('0x39')]['describe']()['then'](respondWithResult(_0x4e514a,null))[_0xd6a6('0x28')](handleError(_0x4e514a,null));};var interaction_log=require(_0xd6a6('0x55'))(_0xd6a6('0x56'));exports[_0xd6a6('0x57')]=function(_0x2300c9,_0x3ebf7a,_0x9d5aca){var _0x1119d5={'agent':{},'channel':_0xd6a6('0x58')};if(_0x2300c9['body']['id']){delete _0x2300c9['body']['id'];}_0x2300c9[_0xd6a6('0x52')][_0xd6a6('0x59')]=!![];_0x2300c9[_0xd6a6('0x52')][_0xd6a6('0x5a')]=moment()[_0xd6a6('0x5b')](_0xd6a6('0x5c'));_0x2300c9[_0xd6a6('0x52')]['UserId']=_0x2300c9[_0xd6a6('0x52')]['UserId']||_0x2300c9[_0xd6a6('0x5d')]['id'];_0x1119d5['agent']['id']=_0x2300c9[_0xd6a6('0x52')][_0xd6a6('0x5e')];return db[_0xd6a6('0x39')][_0xd6a6('0x50')]({'where':{'id':_0x2300c9[_0xd6a6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ebf7a,null))['then'](saveUpdates(_0x2300c9['body'],null))[_0xd6a6('0x35')](function(_0x1c8f70){if(_0x1c8f70){_0x1119d5[_0xd6a6('0x26')]=_0x1c8f70[_0xd6a6('0x5f')]({'plain':!![]});return db[_0xd6a6('0x60')][_0xd6a6('0x50')]({'where':{'id':_0x1c8f70[_0xd6a6('0x61')]}});}return null;})[_0xd6a6('0x35')](handleEntityNotFound(_0x3ebf7a,null))[_0xd6a6('0x35')](function(_0x1407da){if(_0x1407da){return _0x1407da[_0xd6a6('0x51')]({'UserId':_0x2300c9[_0xd6a6('0x52')][_0xd6a6('0x5e')],'read1stAt':_[_0xd6a6('0x62')](_0x1407da[_0xd6a6('0x63')])?moment()[_0xd6a6('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd6a6('0x35')](function(_0x264bfb){if(_0x264bfb){_0x1119d5[_0xd6a6('0x64')]=_0x264bfb[_0xd6a6('0x5f')]({'plain':!![]});interaction_log[_0xd6a6('0x27')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2300c9[_0xd6a6('0x5d')]['id'],_0x2300c9['user'][_0xd6a6('0x37')],_0x2300c9[_0xd6a6('0x5d')][_0xd6a6('0x65')],_0x1119d5[_0xd6a6('0x64')]['id'],_0x2300c9[_0xd6a6('0x52')]?JSON[_0xd6a6('0x66')](_0x2300c9[_0xd6a6('0x52')]):_0xd6a6('0x67'));return respondWithRpcPromise(_0xd6a6('0x68'),_0xd6a6('0x69'),_0x1119d5);}return null;})[_0xd6a6('0x35')](function(_0x3ccc6b){var _0x2c0f93='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ccc6b['message']['ContactId'];return db['sequelize'][_0xd6a6('0x3f')](_0x2c0f93,{'type':db[_0xd6a6('0x6a')][_0xd6a6('0x6b')][_0xd6a6('0x6c')],'raw':!![]})[_0xd6a6('0x35')](function(_0x7b204a){return _0x7b204a;});})[_0xd6a6('0x35')](function(_0x5429dc){if(_0x5429dc){_0x1119d5[_0xd6a6('0x26')][_0xd6a6('0x6d')]=_0x5429dc[0x0];if(!_0x2300c9[_0xd6a6('0x52')][_0xd6a6('0x5e')])return;return db[_0xd6a6('0x6e')][_0xd6a6('0x50')]({'where':{'id':_0x2300c9[_0xd6a6('0x52')][_0xd6a6('0x5e')],'role':_0xd6a6('0x6f')},'attributes':['id',_0xd6a6('0x37'),_0xd6a6('0x70'),'email',_0xd6a6('0x71')],'raw':!![]});}return null;})[_0xd6a6('0x35')](function(_0x2ac691){if(!_0x2ac691)return null;_0x1119d5[_0xd6a6('0x26')]['agent']=_0x2ac691;return _0x1119d5;})['then'](function(_0xaa345e){if(_0xaa345e){if(_0x2300c9[_0xd6a6('0x52')]['manual']){_0x1119d5['message'][_0xd6a6('0x72')]=util[_0xd6a6('0x5b')](_0xd6a6('0x73'),_0x2300c9[_0xd6a6('0x5d')]['name']);_0x1119d5[_0xd6a6('0x26')][_0xd6a6('0x74')]=_0x1119d5[_0xd6a6('0x74')];_0x1119d5[_0xd6a6('0x26')][_0xd6a6('0x75')]=_0x1119d5[_0xd6a6('0x74')];_0x1119d5[_0xd6a6('0x26')][_0xd6a6('0x76')]=_0xd6a6('0x57');return respondWithRpcPromise(_0xd6a6('0x77'),_0xd6a6('0x77'),{'event':_0xd6a6('0x78'),'message':_0x1119d5[_0xd6a6('0x26')]},client9002)[_0xd6a6('0x35')](function(){return _0x1119d5;});}return _0x1119d5;}return null;})[_0xd6a6('0x35')](respondWithResult(_0x3ebf7a,null))[_0xd6a6('0x28')](handleError(_0x3ebf7a,null));};var interaction_log=require(_0xd6a6('0x55'))(_0xd6a6('0x56'));exports[_0xd6a6('0x33')]=function(_0x507708,_0x3e6055,_0x12ae69){var _0x9a7514={'agent':{},'channel':'fax'};if(_0x507708[_0xd6a6('0x52')]['id']){delete _0x507708[_0xd6a6('0x52')]['id'];}_0x507708['body'][_0xd6a6('0x5e')]=_0x507708[_0xd6a6('0x52')][_0xd6a6('0x5e')]||_0x507708[_0xd6a6('0x5d')]['id'];_0x9a7514[_0xd6a6('0x6f')]['id']=_0x507708['body'][_0xd6a6('0x5e')];return db[_0xd6a6('0x39')]['find']({'where':{'id':_0x507708[_0xd6a6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e6055,null))[_0xd6a6('0x35')](function(_0x41e11b){if(_0x41e11b){_0x9a7514[_0xd6a6('0x26')]=_0x41e11b['get']({'plain':!![]});return db[_0xd6a6('0x60')][_0xd6a6('0x50')]({'where':{'id':_0x41e11b[_0xd6a6('0x61')]}});}return null;})[_0xd6a6('0x35')](handleEntityNotFound(_0x3e6055,null))['then'](function(_0x4bd9c7){if(_0x4bd9c7){_0x9a7514[_0xd6a6('0x64')]=_0x4bd9c7[_0xd6a6('0x5f')]({'plain':!![]});interaction_log['info'](_0xd6a6('0x79'),_0x507708[_0xd6a6('0x5d')]['id'],_0x507708[_0xd6a6('0x5d')][_0xd6a6('0x37')],_0x507708[_0xd6a6('0x5d')][_0xd6a6('0x65')],_0x9a7514[_0xd6a6('0x64')]['id'],_0x507708[_0xd6a6('0x52')]?JSON[_0xd6a6('0x66')](_0x507708[_0xd6a6('0x52')]):_0xd6a6('0x67'));return respondWithRpcPromise(_0xd6a6('0x7a'),_0xd6a6('0x7b'),_0x9a7514);}return null;})[_0xd6a6('0x35')](function(_0x5a8553){var _0x17d813=_0xd6a6('0x7c')+_0x5a8553[_0xd6a6('0x26')][_0xd6a6('0x7d')];return db[_0xd6a6('0x7e')]['query'](_0x17d813,{'type':db[_0xd6a6('0x6a')][_0xd6a6('0x6b')][_0xd6a6('0x6c')],'raw':!![]})['then'](function(_0x320f2f){return _0x320f2f;});})['then'](function(_0x3ee9dc){if(_0x3ee9dc){_0x9a7514[_0xd6a6('0x26')][_0xd6a6('0x6d')]=_0x3ee9dc[0x0];if(!_0x507708[_0xd6a6('0x52')][_0xd6a6('0x5e')])return;return db[_0xd6a6('0x6e')][_0xd6a6('0x50')]({'where':{'id':_0x507708[_0xd6a6('0x52')][_0xd6a6('0x5e')],'role':_0xd6a6('0x6f')},'attributes':['id',_0xd6a6('0x37'),_0xd6a6('0x70'),_0xd6a6('0x7f'),_0xd6a6('0x71')],'raw':!![]});}return null;})[_0xd6a6('0x35')](function(_0x5aadad){if(!_0x5aadad)return null;_0x9a7514[_0xd6a6('0x26')][_0xd6a6('0x6f')]=_0x5aadad;return _0x9a7514;})[_0xd6a6('0x35')](function(_0x3e446d){if(_0x3e446d){_0x3e446d['message'][_0xd6a6('0x72')]=util[_0xd6a6('0x5b')]('SIP/%s',_0x507708['user'][_0xd6a6('0x37')]);_0x3e446d[_0xd6a6('0x26')][_0xd6a6('0x74')]=_0x9a7514[_0xd6a6('0x74')];_0x3e446d[_0xd6a6('0x26')]['motionChannel']=_0x9a7514[_0xd6a6('0x74')];_0x3e446d['message'][_0xd6a6('0x76')]=_0xd6a6('0x33');respondWithRpcPromise('EventManager',_0xd6a6('0x77'),{'event':_0xd6a6('0x80'),'message':_0x3e446d[_0xd6a6('0x26')]},client9002);return _0x9a7514;}return null;})[_0xd6a6('0x35')](respondWithResult(_0x3e6055,null))[_0xd6a6('0x28')](handleError(_0x3e6055,null));};exports[_0xd6a6('0x81')]=function(_0x563683,_0x12e817){var _0x131224;return db[_0xd6a6('0x39')][_0xd6a6('0x81')](_0x563683[_0xd6a6('0x52')],{})[_0xd6a6('0x35')](function(_0x46f761){_0x131224=_0x46f761;return db[_0xd6a6('0x82')][_0xd6a6('0x83')]({'where':{'id':_0x131224[_0xd6a6('0x7d')]}});})[_0xd6a6('0x35')](function(_0xfa4c36){if(_[_0xd6a6('0x62')](_0xfa4c36)){return;}else{_0x131224[_0xd6a6('0x58')]=_0xfa4c36['fax'];return db['Attachment'][_0xd6a6('0x83')]({'where':{'id':_0x131224[_0xd6a6('0x84')]}});}})['then'](function(_0x14e9cc){return respondWithRpcPromise(_0xd6a6('0x85'),'SendFax',{'FaxAccountId':_[_0xd6a6('0x62')](_0x563683['body'])?undefined:_0x563683[_0xd6a6('0x52')]['FaxAccountId'],'path':_[_0xd6a6('0x62')](_0x14e9cc)?undefined:util[_0xd6a6('0x5b')]('/var/opt/motion2/server/files/attachments/%s',_0x14e9cc[_0xd6a6('0x86')]),'fax':_[_0xd6a6('0x62')](_0x131224[_0xd6a6('0x58')])?undefined:_0x131224['fax'],'AttachmentId':_0x131224[_0xd6a6('0x84')]},client9002);})[_0xd6a6('0x35')](respondWithResult(_0x12e817,0xc9))['catch'](handleError(_0x12e817,null));};exports['download']=function(_0x3aab47,_0x3fe32d){var _0x24221b=path['join'](config[_0xd6a6('0x87')],_0xd6a6('0x88'),_0xd6a6('0x89'),'attachments');return db[_0xd6a6('0x39')][_0xd6a6('0x50')]({'where':{'id':_0x3aab47['params']['id']},'include':[{'model':db[_0xd6a6('0x8a')],'as':_0xd6a6('0x8a')}]})['then'](handleEntityNotFound(_0x3fe32d,null))['then'](function(_0x231596){if(_0x231596){return _0x3fe32d[_0xd6a6('0x8b')](path[_0xd6a6('0x8c')](_0x24221b,_0x231596[_0xd6a6('0x8a')][_0xd6a6('0x86')]));}})[_0xd6a6('0x28')](handleError(_0x3fe32d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9ae10ca..e7bfd40 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7880=['exports','events','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7880,0x10f));var _0x0788=function(_0x4ca160,_0x14886c){_0x4ca160=_0x4ca160-0x0;var _0x303ae9=_0x7880[_0x4ca160];return _0x303ae9;};'use strict';var EventEmitter=require(_0x0788('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x0788('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0788('0x2')](0x0);var events={'afterCreate':_0x0788('0x3'),'afterUpdate':_0x0788('0x4'),'afterDestroy':_0x0788('0x5')};function emitEvent(_0x509799){return function(_0x563529,_0x10143c,_0x487b5b){FaxMessageEvents[_0x0788('0x6')](_0x509799+':'+_0x563529['id'],_0x563529);FaxMessageEvents[_0x0788('0x6')](_0x509799,_0x563529);_0x487b5b(null);};}for(var e in events){if(events[_0x0788('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x0788('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x9e2e=['save','emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage'];(function(_0x453965,_0x26102b){var _0x14d385=function(_0x35ce41){while(--_0x35ce41){_0x453965['push'](_0x453965['shift']());}};_0x14d385(++_0x26102b);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x94220c,_0x29f3fd){_0x94220c=_0x94220c-0x0;var _0x119684=_0x9e2e[_0x94220c];return _0x119684;};'use strict';var EventEmitter=require(_0xe9e2('0x0'));var FaxMessage=require(_0xe9e2('0x1'))['db'][_0xe9e2('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe9e2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d34ef){return function(_0x11a0e5,_0x3bfa90,_0x212d98){FaxMessageEvents[_0xe9e2('0x4')](_0x2d34ef+':'+_0x11a0e5['id'],_0x11a0e5);FaxMessageEvents[_0xe9e2('0x4')](_0x2d34ef,_0x11a0e5);_0x212d98(null);};}for(var e in events){if(events[_0xe9e2('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xe9e2('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 3b3456e..4a88220 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20a5=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x20a5,0x193));var _0x520a=function(_0xeb3ae2,_0x1e9af0){_0xeb3ae2=_0xeb3ae2-0x0;var _0x1f2726=_0x20a5[_0xeb3ae2];return _0x1f2726;};'use strict';var _=require(_0x520a('0x0'));var util=require(_0x520a('0x1'));var logger=require(_0x520a('0x2'))(_0x520a('0x3'));var moment=require(_0x520a('0x4'));var BPromise=require(_0x520a('0x5'));var rp=require(_0x520a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x520a('0x7'));var config=require(_0x520a('0x8'));var attributes=require(_0x520a('0x9'));module[_0x520a('0xa')]=function(_0x344234,_0x1585ab){return _0x344234[_0x520a('0xb')](_0x520a('0xc'),attributes,{'tableName':_0x520a('0xd'),'paranoid':![],'indexes':[{'name':_0x520a('0xe'),'fields':[_0x520a('0xf')],'type':_0x520a('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bce59,_0x1505df,_0x10cd97){var _0x47832a=_0x344234[_0x520a('0x11')];var _0x576710=_0x3bce59[_0x520a('0x12')]({'plain':!![]});if(_0x576710['direction']['toLowerCase']()==='in'||_0x576710[_0x520a('0x13')][_0x520a('0x14')]()==='out'&&!_0x576710['secret']&&!_[_0x520a('0x15')](_0x576710[_0x520a('0x16')])){_0x47832a[_0x520a('0x17')][_0x520a('0x18')]({'where':{'id':_0x576710[_0x520a('0x19')]}})[_0x520a('0x1a')](function(_0x521c9b){if(_0x521c9b){_0x521c9b[_0x520a('0x1b')]({'lastMsgAt':_0x576710[_0x520a('0x1c')],'lastMsgDirection':_0x576710[_0x520a('0x13')][_0x520a('0x14')]()});}})[_0x520a('0x1d')](function(_0x55785c){console[_0x520a('0x1e')](_0x55785c);});}_0x10cd97();}},'charset':_0x520a('0x1f'),'collate':_0x520a('0x20')});}; \ No newline at end of file +var _0x8305=['util','moment','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','models','get','direction','secret','isNil','UserId','FaxInteraction','findOne','update','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5648a9,_0x1bfab5){var _0x4d804c=function(_0x53911c){while(--_0x53911c){_0x5648a9['push'](_0x5648a9['shift']());}};_0x4d804c(++_0x1bfab5);}(_0x8305,0xf2));var _0x5830=function(_0x6afe44,_0x43922e){_0x6afe44=_0x6afe44-0x0;var _0x1d48c8=_0x8305[_0x6afe44];return _0x1d48c8;};'use strict';var _=require('lodash');var util=require(_0x5830('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5830('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5830('0x2'));var rimraf=require(_0x5830('0x3'));var config=require(_0x5830('0x4'));var attributes=require(_0x5830('0x5'));module['exports']=function(_0x11f5b9,_0x44add7){return _0x11f5b9[_0x5830('0x6')](_0x5830('0x7'),attributes,{'tableName':_0x5830('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ee23b,_0x1c7e0d,_0x2befd0){var _0x3f8d02=_0x11f5b9[_0x5830('0x9')];var _0x4bb3c0=_0x2ee23b[_0x5830('0xa')]({'plain':!![]});if(_0x4bb3c0[_0x5830('0xb')]['toLowerCase']()==='in'||_0x4bb3c0['direction']['toLowerCase']()==='out'&&!_0x4bb3c0[_0x5830('0xc')]&&!_[_0x5830('0xd')](_0x4bb3c0[_0x5830('0xe')])){_0x3f8d02[_0x5830('0xf')][_0x5830('0x10')]({'where':{'id':_0x4bb3c0['FaxInteractionId']}})['then'](function(_0x1a3be3){if(_0x1a3be3){_0x1a3be3[_0x5830('0x11')]({'lastMsgAt':_0x4bb3c0['createdAt'],'lastMsgDirection':_0x4bb3c0[_0x5830('0xb')]['toLowerCase']()});}})[_0x5830('0x12')](function(_0x4815f5){console[_0x5830('0x13')](_0x4815f5);});}_0x2befd0();}},'charset':_0x5830('0x14'),'collate':_0x5830('0x15')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2dec998..1018eaf 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x381fb2,_0x4e2972){var _0x54287d=function(_0x5c7ae5){while(--_0x5c7ae5){_0x381fb2['push'](_0x381fb2['shift']());}};_0x54287d(++_0x4e2972);}(_0xac9d,0x14d));var _0xdac9=function(_0x44c37d,_0x19119f){_0x44c37d=_0x44c37d-0x0;var _0x29e087=_0xac9d[_0x44c37d];return _0x29e087;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file +var _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x191bfe,_0x4678fa){var _0x322ded=function(_0x2a08c7){while(--_0x2a08c7){_0x191bfe['push'](_0x191bfe['shift']());}};_0x322ded(++_0x4678fa);}(_0xac31,0xca));var _0x1ac3=function(_0x3b3683,_0x37da3e){_0x3b3683=_0x3b3683-0x0;var _0x2ed3f3=_0xac31[_0x3b3683];return _0x2ed3f3;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d13d6d9..ae9dfca 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fc5=['update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','remove'];(function(_0x291ec3,_0x2f19a7){var _0x423b99=function(_0x345ddd){while(--_0x345ddd){_0x291ec3['push'](_0x291ec3['shift']());}};_0x423b99(++_0x2f19a7);}(_0x2fc5,0x136));var _0x52fc=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0x2fc5[_0x1e9d62];return _0x56c490;};'use strict';var FaxMessageEvents=require(_0x52fc('0x0'));var events=['save',_0x52fc('0x1'),_0x52fc('0x2')];function createListener(_0xa68a62,_0x28f5b3){return function(_0x16fe35){_0x28f5b3[_0x52fc('0x3')](_0xa68a62,_0x16fe35);};}function removeListener(_0x469470,_0x4a4d2f){return function(){FaxMessageEvents[_0x52fc('0x4')](_0x469470,_0x4a4d2f);};}exports[_0x52fc('0x5')]=function(_0xcf7d21){for(var _0x5c84f0=0x0,_0x24b1c5=events[_0x52fc('0x6')];_0x5c84f0<_0x24b1c5;_0x5c84f0++){var _0x583283=events[_0x5c84f0];var _0xe77681=createListener(_0x52fc('0x7')+_0x583283,_0xcf7d21);FaxMessageEvents['on'](_0x583283,_0xe77681);}}; \ No newline at end of file +var _0xd5e2=['emit','length','faxMessage:','./faxMessage.events','remove'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xd5e2,0x184));var _0x2d5e=function(_0x4d29eb,_0x5ba766){_0x4d29eb=_0x4d29eb-0x0;var _0x53cadb=_0xd5e2[_0x4d29eb];return _0x53cadb;};'use strict';var FaxMessageEvents=require(_0x2d5e('0x0'));var events=['save',_0x2d5e('0x1'),'update'];function createListener(_0x2785dd,_0x6ec7cd){return function(_0x4b1957){_0x6ec7cd[_0x2d5e('0x2')](_0x2785dd,_0x4b1957);};}function removeListener(_0x119b80,_0x543a91){return function(){FaxMessageEvents['removeListener'](_0x119b80,_0x543a91);};}exports['register']=function(_0x29d6be){for(var _0x285b49=0x0,_0x483d64=events[_0x2d5e('0x3')];_0x285b49<_0x483d64;_0x285b49++){var _0x5cfe11=events[_0x285b49];var _0x101aa1=createListener(_0x2d5e('0x4')+_0x5cfe11,_0x29d6be);FaxMessageEvents['on'](_0x5cfe11,_0x101aa1);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 46c4e92..16c2a0e 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x593e,0xcb));var _0xe593=function(_0x52e942,_0x5cbcbb){_0x52e942=_0x52e942-0x0;var _0x24003d=_0x593e[_0x52e942];return _0x24003d;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file +var _0xb49a=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','tracked','fax','create'];(function(_0x4ab084,_0xc9543e){var _0x5c39ef=function(_0x539c93){while(--_0x539c93){_0x4ab084['push'](_0x4ab084['shift']());}};_0x5c39ef(++_0xc9543e);}(_0xb49a,0xfb));var _0xab49=function(_0x515d8d,_0x5a7b53){_0x515d8d=_0x515d8d-0x0;var _0x296990=_0xb49a[_0x515d8d];return _0x296990;};'use strict';var multer=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var path=require(_0xab49('0x2'));var timeout=require(_0xab49('0x3'));var express=require(_0xab49('0x4'));var router=express['Router']();var fs_extra=require(_0xab49('0x5'));var auth=require(_0xab49('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xab49('0x7'));router[_0xab49('0x8')]('/',auth[_0xab49('0x9')](),controller[_0xab49('0xa')]);router[_0xab49('0x8')](_0xab49('0xb'),auth[_0xab49('0x9')](),controller['describe']);router[_0xab49('0x8')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0xd')]);router[_0xab49('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xab49('0xe')]);router[_0xab49('0xf')]('/',auth[_0xab49('0x9')](),interaction[_0xab49('0x10')](_0xab49('0x11'),'faxmessage:create'),controller[_0xab49('0x12')]);router[_0xab49('0x13')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0x14')]);router[_0xab49('0x13')](_0xab49('0x15'),auth[_0xab49('0x9')](),controller[_0xab49('0x16')]);router[_0xab49('0x13')](_0xab49('0x17'),auth['isAuthenticated'](),controller[_0xab49('0x18')]);router[_0xab49('0x19')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index fc78959..e074d7f 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf50=['roundrobin','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x38c6d2,_0xecfe6f){var _0x50746f=function(_0x1f02db){while(--_0x1f02db){_0x38c6d2['push'](_0x38c6d2['shift']());}};_0x50746f(++_0xecfe6f);}(_0xcf50,0xe5));var _0x0cf5=function(_0x49541e,_0x298418){_0x49541e=_0x49541e-0x0;var _0x4007b0=_0xcf50[_0x49541e];return _0x4007b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0cf5('0x0')],'unique':_0x0cf5('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0cf5('0x0')]},'timeout':{'type':Sequelize[_0x0cf5('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0cf5('0x3'),_0x0cf5('0x4'),_0x0cf5('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0cf5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7dc5=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x4ec055,_0x42329c){var _0x3f3832=function(_0x257dd2){while(--_0x257dd2){_0x4ec055['push'](_0x4ec055['shift']());}};_0x3f3832(++_0x42329c);}(_0x7dc5,0x11c));var _0x57dc=function(_0x2f5fcb,_0x4df21e){_0x2f5fcb=_0x2f5fcb-0x0;var _0x2fc15e=_0x7dc5[_0x2f5fcb];return _0x2fc15e;};'use strict';var Sequelize=require(_0x57dc('0x0'));module[_0x57dc('0x1')]={'name':{'type':Sequelize[_0x57dc('0x2')],'unique':_0x57dc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x57dc('0x2')]},'timeout':{'type':Sequelize[_0x57dc('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x57dc('0x5')](_0x57dc('0x6'),_0x57dc('0x7'),_0x57dc('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x57dc('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 092473c..b4a3551 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc42f=['toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','stack','name','send','map','FaxQueue','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','rawAttributes','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push'];(function(_0x465a74,_0x48aaa1){var _0x40ae58=function(_0x1b2bc2){while(--_0x1b2bc2){_0x465a74['push'](_0x465a74['shift']());}};_0x40ae58(++_0x48aaa1);}(_0xc42f,0x126));var _0xfc42=function(_0x2be39b,_0x51af6c){_0x2be39b=_0x2be39b-0x0;var _0x682d9d=_0xc42f[_0x2be39b];return _0x682d9d;};'use strict';var emlformat=require(_0xfc42('0x0'));var rimraf=require(_0xfc42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc42('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc42('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfc42('0x4'));var sox=require('sox');var csv=require(_0xfc42('0x5'));var ejs=require(_0xfc42('0x6'));var fs=require('fs');var fs_extra=require(_0xfc42('0x7'));var _=require(_0xfc42('0x8'));var squel=require(_0xfc42('0x9'));var crypto=require('crypto');var jsforce=require(_0xfc42('0xa'));var deskjs=require(_0xfc42('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfc42('0xc'));var Papa=require(_0xfc42('0xd'));var Redis=require('ioredis');var authService=require(_0xfc42('0xe'));var qs=require(_0xfc42('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc42('0x10'));var logger=require('../../config/logger')(_0xfc42('0x11'));var utils=require(_0xfc42('0x12'));var config=require(_0xfc42('0x13'));var licenseUtil=require(_0xfc42('0x14'));var db=require(_0xfc42('0x15'))['db'];config[_0xfc42('0x16')]=_['defaults'](config[_0xfc42('0x16')],{'host':_0xfc42('0x17'),'port':0x18eb});var socket=require(_0xfc42('0x18'))(new Redis(config[_0xfc42('0x16')]));require(_0xfc42('0x19'))['register'](socket);function respondWithStatusCode(_0xfaf31f,_0x3868a6){_0x3868a6=_0x3868a6||0xcc;return function(_0x458a00){if(_0x458a00){return _0xfaf31f['sendStatus'](_0x3868a6);}return _0xfaf31f[_0xfc42('0x1a')](_0x3868a6)[_0xfc42('0x1b')]();};}function respondWithResult(_0x52ec10,_0xf7ac30){_0xf7ac30=_0xf7ac30||0xc8;return function(_0x3d1fbe){if(_0x3d1fbe){return _0x52ec10[_0xfc42('0x1a')](_0xf7ac30)['json'](_0x3d1fbe);}};}function respondWithFilteredResult(_0xe88c69,_0x3219d6){return function(_0x39b292){if(_0x39b292){var _0x350ae1=typeof _0x3219d6[_0xfc42('0x1c')]==='undefined'&&typeof _0x3219d6[_0xfc42('0x1d')]===_0xfc42('0x1e');var _0x202690=_0x39b292[_0xfc42('0x1f')];var _0x2e43da=_0x350ae1?0x0:_0x3219d6[_0xfc42('0x1c')];var _0x372ec7=_0x350ae1?_0x39b292['count']:_0x3219d6[_0xfc42('0x1c')]+_0x3219d6[_0xfc42('0x1d')];var _0x15ffdc;if(_0x372ec7>=_0x202690){_0x372ec7=_0x202690;_0x15ffdc=0xc8;}else{_0x15ffdc=0xce;}_0xe88c69['status'](_0x15ffdc);return _0xe88c69[_0xfc42('0x20')](_0xfc42('0x21'),_0x2e43da+'-'+_0x372ec7+'/'+_0x202690)[_0xfc42('0x22')](_0x39b292);}return null;};}function patchUpdates(_0x26f0c7){return function(_0x24d2c9){try{jsonpatch[_0xfc42('0x23')](_0x24d2c9,_0x26f0c7,!![]);}catch(_0x1b757a){return BPromise[_0xfc42('0x24')](_0x1b757a);}return _0x24d2c9[_0xfc42('0x25')]();};}function saveUpdates(_0x3f7056,_0x4a9928){return function(_0x56a0b2){if(_0x56a0b2){return _0x56a0b2[_0xfc42('0x26')](_0x3f7056)[_0xfc42('0x27')](function(_0x1abfd2){return _0x1abfd2;});}return null;};}function removeEntity(_0x44cb43,_0x1c45e5){return function(_0x30746c){if(_0x30746c){return _0x30746c[_0xfc42('0x28')]()[_0xfc42('0x27')](function(){var _0x190a92=_0x30746c[_0xfc42('0x29')]({'plain':!![]});var _0x2ab6ee=_0xfc42('0x2a');return db[_0xfc42('0x2b')][_0xfc42('0x28')]({'where':{'type':_0x2ab6ee,'resourceId':_0x190a92['id']}})[_0xfc42('0x27')](function(){return _0x30746c;});})[_0xfc42('0x27')](function(){_0x44cb43[_0xfc42('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ad12,_0x5784ba){return function(_0x5cc266){if(!_0x5cc266){_0x47ad12[_0xfc42('0x2c')](0x194);}return _0x5cc266;};}function handleError(_0x2ae4ca,_0x4100fe){_0x4100fe=_0x4100fe||0x1f4;return function(_0x54bb76){logger['error'](_0x54bb76[_0xfc42('0x2d')]);if(_0x54bb76[_0xfc42('0x2e')]){delete _0x54bb76[_0xfc42('0x2e')];}_0x2ae4ca[_0xfc42('0x1a')](_0x4100fe)[_0xfc42('0x2f')](_0x54bb76);};}exports['index']=function(_0x358739,_0x49777b){var _0x31f23a={},_0x3b6506={},_0x4ffff1={'count':0x0,'rows':[]};var _0x51792b=_[_0xfc42('0x30')](db[_0xfc42('0x31')]['rawAttributes'],function(_0x5773e9){return{'name':_0x5773e9[_0xfc42('0x32')],'type':_0x5773e9[_0xfc42('0x33')][_0xfc42('0x34')]};});_0x3b6506['model']=_[_0xfc42('0x30')](_0x51792b,_0xfc42('0x2e'));_0x3b6506[_0xfc42('0x35')]=_['keys'](_0x358739[_0xfc42('0x35')]);_0x3b6506[_0xfc42('0x36')]=_[_0xfc42('0x37')](_0x3b6506[_0xfc42('0x38')],_0x3b6506[_0xfc42('0x35')]);_0x31f23a[_0xfc42('0x39')]=_[_0xfc42('0x37')](_0x3b6506[_0xfc42('0x38')],qs[_0xfc42('0x3a')](_0x358739[_0xfc42('0x35')]['fields']));_0x31f23a[_0xfc42('0x39')]=_0x31f23a[_0xfc42('0x39')][_0xfc42('0x3b')]?_0x31f23a[_0xfc42('0x39')]:_0x3b6506[_0xfc42('0x38')];if(!_0x358739[_0xfc42('0x35')][_0xfc42('0x3c')](_0xfc42('0x3d'))){_0x31f23a[_0xfc42('0x1d')]=qs[_0xfc42('0x1d')](_0x358739[_0xfc42('0x35')][_0xfc42('0x1d')]);_0x31f23a[_0xfc42('0x1c')]=qs[_0xfc42('0x1c')](_0x358739[_0xfc42('0x35')][_0xfc42('0x1c')]);}_0x31f23a['order']=qs['sort'](_0x358739['query'][_0xfc42('0x3e')]);_0x31f23a[_0xfc42('0x3f')]=qs['filters'](_[_0xfc42('0x40')](_0x358739[_0xfc42('0x35')],_0x3b6506[_0xfc42('0x36')]),_0x51792b);if(_0x358739[_0xfc42('0x35')][_0xfc42('0x41')]){_0x31f23a[_0xfc42('0x3f')]=_[_0xfc42('0x42')](_0x31f23a[_0xfc42('0x3f')],{'$or':_['map'](_0x51792b,function(_0x2f0e45){if(_0x2f0e45[_0xfc42('0x33')]!==_0xfc42('0x43')){var _0x10e7ea={};_0x10e7ea[_0x2f0e45[_0xfc42('0x2e')]]={'$like':'%'+_0x358739[_0xfc42('0x35')][_0xfc42('0x41')]+'%'};return _0x10e7ea;}})});}_0x31f23a=_[_0xfc42('0x42')]({},_0x31f23a,_0x358739[_0xfc42('0x44')]);var _0x5afb8c={'where':_0x31f23a[_0xfc42('0x3f')]};return db[_0xfc42('0x31')][_0xfc42('0x1f')](_0x5afb8c)[_0xfc42('0x27')](function(_0xe41246){_0x4ffff1[_0xfc42('0x1f')]=_0xe41246;if(_0x358739['query'][_0xfc42('0x45')]){_0x31f23a['include']=[{'all':!![]}];}return db[_0xfc42('0x31')]['findAll'](_0x31f23a);})[_0xfc42('0x27')](function(_0x42af4f){_0x4ffff1[_0xfc42('0x46')]=_0x42af4f;return _0x4ffff1;})[_0xfc42('0x27')](respondWithFilteredResult(_0x49777b,_0x31f23a))['catch'](handleError(_0x49777b,null));};exports['show']=function(_0xff4cd2,_0x4f2f74){var _0x238fc9={'raw':!![],'where':{'id':_0xff4cd2[_0xfc42('0x47')]['id']}},_0x4da7b7={};_0x4da7b7[_0xfc42('0x38')]=_['keys'](db[_0xfc42('0x31')][_0xfc42('0x48')]);_0x4da7b7[_0xfc42('0x35')]=_[_0xfc42('0x49')](_0xff4cd2[_0xfc42('0x35')]);_0x4da7b7['filters']=_['intersection'](_0x4da7b7[_0xfc42('0x38')],_0x4da7b7[_0xfc42('0x35')]);_0x238fc9['attributes']=_['intersection'](_0x4da7b7[_0xfc42('0x38')],qs[_0xfc42('0x3a')](_0xff4cd2[_0xfc42('0x35')][_0xfc42('0x3a')]));_0x238fc9[_0xfc42('0x39')]=_0x238fc9[_0xfc42('0x39')][_0xfc42('0x3b')]?_0x238fc9[_0xfc42('0x39')]:_0x4da7b7['model'];if(_0xff4cd2[_0xfc42('0x35')][_0xfc42('0x45')]){_0x238fc9['include']=[{'all':!![]}];}_0x238fc9=_[_0xfc42('0x42')]({},_0x238fc9,_0xff4cd2[_0xfc42('0x44')]);return db[_0xfc42('0x31')][_0xfc42('0x4a')](_0x238fc9)[_0xfc42('0x27')](handleEntityNotFound(_0x4f2f74,null))[_0xfc42('0x27')](respondWithResult(_0x4f2f74,null))[_0xfc42('0x4b')](handleError(_0x4f2f74,null));};exports[_0xfc42('0x4c')]=function(_0x19c44a,_0x160dff){return db[_0xfc42('0x31')][_0xfc42('0x4c')](_0x19c44a[_0xfc42('0x4d')],{})['then'](function(_0x4d26f7){var _0x2c88ef=_0x19c44a[_0xfc42('0x4e')][_0xfc42('0x29')]({'plain':!![]});if(!_0x2c88ef)throw new Error(_0xfc42('0x4f'));if(_0x2c88ef['role']===_0xfc42('0x4e')){var _0x1ae5fe=_0x4d26f7[_0xfc42('0x29')]({'plain':!![]});var _0x175048=_0xfc42('0x2a');return db['UserProfileSection'][_0xfc42('0x4a')]({'where':{'name':_0x175048,'userProfileId':_0x2c88ef[_0xfc42('0x50')]},'raw':!![]})['then'](function(_0x32d25a){if(_0x32d25a&&_0x32d25a['autoAssociation']===0x0){return db[_0xfc42('0x2b')][_0xfc42('0x4c')]({'name':_0x1ae5fe[_0xfc42('0x2e')],'resourceId':_0x1ae5fe['id'],'type':_0x32d25a[_0xfc42('0x2e')],'sectionId':_0x32d25a['id']},{})[_0xfc42('0x27')](function(){return _0x4d26f7;});}else{return _0x4d26f7;}})['catch'](function(_0x3dd0af){logger[_0xfc42('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dd0af);throw _0x3dd0af;});}return _0x4d26f7;})['then'](respondWithResult(_0x160dff,0xc9))['catch'](handleError(_0x160dff,null));};exports[_0xfc42('0x26')]=function(_0x50eeef,_0x32e235){if(_0x50eeef[_0xfc42('0x4d')]['id']){delete _0x50eeef[_0xfc42('0x4d')]['id'];}return db['FaxQueue'][_0xfc42('0x4a')]({'where':{'id':_0x50eeef[_0xfc42('0x47')]['id']}})[_0xfc42('0x27')](handleEntityNotFound(_0x32e235,null))[_0xfc42('0x27')](saveUpdates(_0x50eeef[_0xfc42('0x4d')],null))[_0xfc42('0x27')](respondWithResult(_0x32e235,null))['catch'](handleError(_0x32e235,null));};exports[_0xfc42('0x28')]=function(_0x100fe3,_0x5df932){return db[_0xfc42('0x31')][_0xfc42('0x4a')]({'where':{'id':_0x100fe3[_0xfc42('0x47')]['id']}})[_0xfc42('0x27')](handleEntityNotFound(_0x5df932,null))[_0xfc42('0x27')](removeEntity(_0x5df932,null))[_0xfc42('0x4b')](handleError(_0x5df932,null));};exports[_0xfc42('0x52')]=function(_0x6749a5,_0x3fa7e1){return db[_0xfc42('0x31')]['describe']()[_0xfc42('0x27')](respondWithResult(_0x3fa7e1,null))['catch'](handleError(_0x3fa7e1,null));};exports[_0xfc42('0x53')]=function(_0xde7bf5,_0x4fdd81,_0x520cd6){var _0x49f534={'raw':!![],'where':{}},_0x4e5815={},_0x247c3d;return db[_0xfc42('0x31')][_0xfc42('0x54')]({'where':{'id':_0xde7bf5[_0xfc42('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fdd81,null))[_0xfc42('0x27')](function(_0x4b04bc){if(_0x4b04bc){_0x247c3d=_0x4b04bc[_0xfc42('0x29')]({'plain':!![]});_0x4e5815['model']=_['keys'](db[_0xfc42('0x55')]['rawAttributes']);_0x4e5815[_0xfc42('0x35')]=_[_0xfc42('0x49')](_0xde7bf5[_0xfc42('0x35')]);_0x4e5815['filters']=_['intersection'](_0x4e5815['model'],_0x4e5815[_0xfc42('0x35')]);_0x49f534[_0xfc42('0x39')]=_['intersection'](_0x4e5815[_0xfc42('0x38')],qs[_0xfc42('0x3a')](_0xde7bf5[_0xfc42('0x35')][_0xfc42('0x3a')]));_0x49f534[_0xfc42('0x39')]=_0x49f534[_0xfc42('0x39')][_0xfc42('0x3b')]?_0x49f534[_0xfc42('0x39')]:_0x4e5815[_0xfc42('0x38')];if(!_0xde7bf5[_0xfc42('0x35')][_0xfc42('0x3c')](_0xfc42('0x3d'))){_0x49f534['limit']=qs[_0xfc42('0x1d')](_0xde7bf5[_0xfc42('0x35')][_0xfc42('0x1d')]);_0x49f534[_0xfc42('0x1c')]=qs[_0xfc42('0x1c')](_0xde7bf5[_0xfc42('0x35')][_0xfc42('0x1c')]);}_0x49f534[_0xfc42('0x56')]=qs[_0xfc42('0x3e')](_0xde7bf5[_0xfc42('0x35')]['sort']);_0x49f534[_0xfc42('0x3f')]=qs[_0xfc42('0x36')](_[_0xfc42('0x40')](_0xde7bf5[_0xfc42('0x35')],_0x4e5815['filters']));_0x49f534['where'][_0xfc42('0x57')]=_0x4b04bc['id'];if(_0xde7bf5[_0xfc42('0x35')][_0xfc42('0x41')]){_0x49f534[_0xfc42('0x3f')]=_[_0xfc42('0x42')](_0x49f534['where'],{'$or':_[_0xfc42('0x30')](_0x49f534[_0xfc42('0x39')],function(_0x370f48){var _0x411514={};_0x411514[_0x370f48]={'$like':'%'+_0xde7bf5[_0xfc42('0x35')][_0xfc42('0x41')]+'%'};return _0x411514;})});}_0x49f534=_[_0xfc42('0x42')]({},_0x49f534,_0xde7bf5[_0xfc42('0x44')]);return db[_0xfc42('0x55')][_0xfc42('0x58')](_0x49f534);}})[_0xfc42('0x27')](function(_0x47b38b){if(_0x47b38b){return db[_0xfc42('0x59')][_0xfc42('0x5a')]({'where':{'id':_[_0xfc42('0x30')](_0x47b38b,_0xfc42('0x5b')),'role':_0xfc42('0x5c')},'attributes':['id',_0xfc42('0x2e'),'faxPause',_0xfc42('0x5d'),_0xfc42('0x5e')]});}})[_0xfc42('0x27')](function(_0x5f1c82){if(_0x5f1c82){return{'count':_0x5f1c82[_0xfc42('0x1f')],'rows':_['map'](_0x5f1c82[_0xfc42('0x46')],function(_0xf83f22){return{'membername':_0xf83f22[_0xfc42('0x2e')],'UserId':_0xf83f22['id'],'queue_name':_0x247c3d['name'],'FaxQueueId':_0x247c3d['id'],'interface':util[_0xfc42('0x5f')]('%s/%s',_0xfc42('0x60'),_0xf83f22[_0xfc42('0x2e')]),'penalty':0x0,'paused':_0xf83f22['faxPause'],'createdAt':_0xf83f22[_0xfc42('0x5e')],'updatedAt':_0xf83f22['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfc42('0x27')](respondWithFilteredResult(_0x4fdd81,_0x49f534))['catch'](handleError(_0x4fdd81,null));};exports['getTeams']=function(_0x28c842,_0x20e1ce,_0x557085){var _0x4de956={};var _0x2db3cd={};var _0x2c1731;var _0x5abf7f;return db['FaxQueue'][_0xfc42('0x54')]({'where':{'id':_0x28c842['params']['id']}})[_0xfc42('0x27')](handleEntityNotFound(_0x20e1ce,null))['then'](function(_0x297a3b){if(_0x297a3b){_0x2c1731=_0x297a3b;_0x2db3cd['model']=_['keys'](db[_0xfc42('0x61')][_0xfc42('0x48')]);_0x2db3cd['query']=_['keys'](_0x28c842['query']);_0x2db3cd[_0xfc42('0x36')]=_[_0xfc42('0x37')](_0x2db3cd['model'],_0x2db3cd[_0xfc42('0x35')]);_0x4de956[_0xfc42('0x39')]=_['intersection'](_0x2db3cd[_0xfc42('0x38')],qs[_0xfc42('0x3a')](_0x28c842[_0xfc42('0x35')]['fields']));_0x4de956[_0xfc42('0x39')]=_0x4de956[_0xfc42('0x39')]['length']?_0x4de956[_0xfc42('0x39')]:_0x2db3cd[_0xfc42('0x38')];_0x4de956[_0xfc42('0x56')]=qs[_0xfc42('0x3e')](_0x28c842[_0xfc42('0x35')][_0xfc42('0x3e')]);_0x4de956[_0xfc42('0x3f')]=qs[_0xfc42('0x36')](_[_0xfc42('0x40')](_0x28c842[_0xfc42('0x35')],_0x2db3cd['filters']));if(_0x28c842[_0xfc42('0x35')][_0xfc42('0x41')]){_0x4de956[_0xfc42('0x3f')]=_[_0xfc42('0x42')](_0x4de956[_0xfc42('0x3f')],{'$or':_[_0xfc42('0x30')](_0x4de956['attributes'],function(_0xc7bfdb){var _0x15b296={};_0x15b296[_0xc7bfdb]={'$like':'%'+_0x28c842['query'][_0xfc42('0x41')]+'%'};return _0x15b296;})});}_0x4de956=_['merge']({},_0x4de956,_0x28c842[_0xfc42('0x44')]);return _0x2c1731['getTeams'](_0x4de956);}})['then'](function(_0x461f01){if(_0x461f01){_0x5abf7f=_0x461f01[_0xfc42('0x3b')];if(!_0x28c842['query'][_0xfc42('0x3c')](_0xfc42('0x3d'))){_0x4de956[_0xfc42('0x1d')]=qs['limit'](_0x28c842[_0xfc42('0x35')][_0xfc42('0x1d')]);_0x4de956['offset']=qs[_0xfc42('0x1c')](_0x28c842[_0xfc42('0x35')][_0xfc42('0x1c')]);}return _0x2c1731[_0xfc42('0x62')](_0x4de956);}})[_0xfc42('0x27')](function(_0x39fb81){if(_0x39fb81){return _0x39fb81?{'count':_0x5abf7f,'rows':_0x39fb81}:null;}})[_0xfc42('0x27')](respondWithResult(_0x20e1ce,null))[_0xfc42('0x4b')](handleError(_0x20e1ce,null));};exports[_0xfc42('0x63')]=function(_0x10bbff,_0x2a2bbc,_0x5315a1){var _0x290493=_0x10bbff[_0xfc42('0x4d')][_0xfc42('0x64')];return db[_0xfc42('0x61')][_0xfc42('0x58')]({'where':{'id':_0x290493},'attributes':['id'],'include':[{'model':db[_0xfc42('0x59')],'as':_0xfc42('0x65'),'attributes':['id','name',_0xfc42('0x66'),_0xfc42('0x67'),_0xfc42('0x68')],'raw':!![]}]})[_0xfc42('0x27')](function(_0x12f9c1){if(_0x12f9c1){var _0x24b091=_[_0xfc42('0x69')](_0x12f9c1,function(_0x1459e6){var _0x292744=_0x1459e6['get']({'plain':!![]});return _0x292744[_0xfc42('0x65')];});return db[_0xfc42('0x31')]['find']({'where':{'id':_0x10bbff[_0xfc42('0x47')]['id']}})[_0xfc42('0x27')](function(_0x3dd796){return db[_0xfc42('0x6a')]['transaction'](function(_0x7551a7){return _0x3dd796[_0xfc42('0x63')](_0x290493,{'transaction':_0x7551a7})['then'](function(){return BPromise['each'](_0x24b091,function(_0x25b2b1){return db['UserFaxQueue'][_0xfc42('0x6b')]({'where':{'UserId':_0x25b2b1['id'],'FaxQueueId':_0x10bbff[_0xfc42('0x47')]['id']},'transaction':_0x7551a7});});})['then'](function(){_0x24b091[_0xfc42('0x6c')](function(_0x331fb6){socket[_0xfc42('0x6d')]('userFaxQueue:save',{'UserId':_0x331fb6['id'],'FaxQueueId':_0x3dd796['id']});});});});});}})[_0xfc42('0x27')](respondWithStatusCode(_0x2a2bbc,null))[_0xfc42('0x4b')](handleError(_0x2a2bbc,null));};exports[_0xfc42('0x6e')]=function(_0x1b4939,_0x3abf43,_0xb50644){return db[_0xfc42('0x61')][_0xfc42('0x58')]({'where':{'id':_0x1b4939[_0xfc42('0x35')][_0xfc42('0x64')]},'attributes':['id'],'include':[{'model':db[_0xfc42('0x59')],'as':_0xfc42('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3abf43,null))[_0xfc42('0x27')](function(_0x3e652d){var _0x49ca34=_[_0xfc42('0x30')](_0x3e652d,'id');var _0x791447=[];var _0x366e12=[];var _0x2f207b=squel[_0xfc42('0x6f')]();_0x2f207b[_0xfc42('0x70')](_0xfc42('0x71'))[_0xfc42('0x72')](_0xfc42('0x73'),'tq')[_0xfc42('0x74')]('user_has_teams','ut',_0xfc42('0x75'))[_0xfc42('0x3f')]('FaxQueueId\x20=\x20?',_0x1b4939[_0xfc42('0x47')]['id']);for(var _0x4c3441=0x0;_0x4c3441<_0x3e652d[_0xfc42('0x3b')];_0x4c3441+=0x1){let _0x355324=_0x3e652d[_0x4c3441];for(var _0x286a1f=0x0;_0x286a1f<_0x355324[_0xfc42('0x65')][_0xfc42('0x3b')];_0x286a1f+=0x1){let _0x59e1fd=_0x355324[_0xfc42('0x65')][_0x286a1f];var _0xec070f=_0x2f207b[_0xfc42('0x76')]();_0xec070f[_0xfc42('0x3f')]('ut.UserId\x20=\x20?',_0x59e1fd['id']);_0x366e12[_0xfc42('0x77')](db[_0xfc42('0x6a')][_0xfc42('0x35')](_0xec070f[_0xfc42('0x78')](),{'type':db[_0xfc42('0x6a')]['QueryTypes'][_0xfc42('0x79')]})[_0xfc42('0x27')](function(_0x2b6801){if(_0x2b6801[_0xfc42('0x3b')]===0x1){return _0x59e1fd['id'];}else{var _0x57e8e1=_[_0xfc42('0x7a')](_[_0xfc42('0x30')](_0x2b6801,_0xfc42('0x7b')),function(_0x1fae17){return _[_0xfc42('0x7c')](_0x49ca34,_0x1fae17);});if(_0x57e8e1){return _0x59e1fd['id'];}}}));}}return BPromise[_0xfc42('0x7d')](_0x366e12)[_0xfc42('0x27')](function(_0x1b9f0a){_0x791447=_(_0x791447)[_0xfc42('0x7e')](_0x1b9f0a)[_0xfc42('0x7f')]()[_0xfc42('0x80')]();return db['FaxQueue']['find']({'where':{'id':_0x1b4939['params']['id']}})[_0xfc42('0x27')](function(_0x4f0e25){return db[_0xfc42('0x6a')][_0xfc42('0x81')](function(_0x1e360c){return _0x4f0e25[_0xfc42('0x6e')](_0x1b4939[_0xfc42('0x35')]['ids'],{'transaction':_0x1e360c})[_0xfc42('0x27')](function(){if(!_[_0xfc42('0x82')](_0x791447)){return _0x4f0e25[_0xfc42('0x83')](_0x791447,{'transaction':_0x1e360c});}})[_0xfc42('0x27')](function(){_0x791447['forEach'](function(_0x18276d){socket['emit']('userFaxQueue:remove',{'UserId':_0x18276d,'FaxQueueId':_0x4f0e25['id']});});});});});});})['then'](respondWithStatusCode(_0x3abf43,null))[_0xfc42('0x4b')](handleError(_0x3abf43,null));};exports[_0xfc42('0x84')]=function(_0x3eb667,_0x2cb19b,_0x1637b1){return db[_0xfc42('0x31')]['find']({'where':{'id':_0x3eb667[_0xfc42('0x47')]['id']}})[_0xfc42('0x27')](handleEntityNotFound(_0x2cb19b,null))[_0xfc42('0x27')](function(_0x3b5453){if(_0x3b5453){return _0x3b5453['addAgents'](_0x3eb667['body'][_0xfc42('0x64')],_['omit'](_0x3eb667['body'],['ids','id'])||{})[_0xfc42('0x85')](function(_0x171593){for(var _0x259e56=0x0;_0x259e56<_0x3eb667['body'][_0xfc42('0x64')][_0xfc42('0x3b')];_0x259e56+=0x1){socket['emit'](_0xfc42('0x86'),{'UserId':Number(_0x3eb667['body'][_0xfc42('0x64')][_0x259e56]),'FaxQueueId':Number(_0x3eb667[_0xfc42('0x47')]['id'])});}return _0x171593;});}})['then'](respondWithResult(_0x2cb19b,null))[_0xfc42('0x4b')](handleError(_0x2cb19b,null));};exports[_0xfc42('0x83')]=function(_0x17973a,_0xec8e72,_0x1c685){return db['FaxQueue'][_0xfc42('0x4a')]({'where':{'id':_0x17973a[_0xfc42('0x47')]['id']}})['then'](handleEntityNotFound(_0xec8e72,null))[_0xfc42('0x27')](function(_0x4b3f67){if(_0x4b3f67){return _0x4b3f67[_0xfc42('0x83')](_0x17973a[_0xfc42('0x35')][_0xfc42('0x64')])[_0xfc42('0x27')](function(){if(_[_0xfc42('0x87')](_0x17973a[_0xfc42('0x35')]['ids'])){for(var _0x23db34=0x0;_0x23db34<_0x17973a[_0xfc42('0x35')]['ids']['length'];_0x23db34+=0x1){socket[_0xfc42('0x6d')](_0xfc42('0x88'),{'UserId':Number(_0x17973a[_0xfc42('0x35')][_0xfc42('0x64')][_0x23db34]),'FaxQueueId':Number(_0x17973a['params']['id'])});}}else{socket[_0xfc42('0x6d')](_0xfc42('0x88'),{'UserId':Number(_0x17973a[_0xfc42('0x35')]['ids']),'FaxQueueId':Number(_0x17973a[_0xfc42('0x47')]['id'])});}});}})[_0xfc42('0x27')](respondWithStatusCode(_0xec8e72,null))[_0xfc42('0x4b')](handleError(_0xec8e72,null));};exports[_0xfc42('0x89')]=function(_0xf9b7ac,_0x4970dd,_0x4e66c1){var _0x189bf4={};var _0xa43c2c={};var _0x5384c3;var _0x594e1b;return db[_0xfc42('0x31')][_0xfc42('0x54')]({'where':{'id':_0xf9b7ac[_0xfc42('0x47')]['id']}})['then'](handleEntityNotFound(_0x4970dd,null))[_0xfc42('0x27')](function(_0x3caf56){if(_0x3caf56){_0x5384c3=_0x3caf56;_0xa43c2c[_0xfc42('0x38')]=_[_0xfc42('0x49')](db[_0xfc42('0x59')][_0xfc42('0x48')]);_0xa43c2c['query']=_[_0xfc42('0x49')](_0xf9b7ac['query']);_0xa43c2c['filters']=_[_0xfc42('0x37')](_0xa43c2c[_0xfc42('0x38')],_0xa43c2c['query']);_0x189bf4[_0xfc42('0x39')]=_[_0xfc42('0x37')](_0xa43c2c[_0xfc42('0x38')],qs[_0xfc42('0x3a')](_0xf9b7ac[_0xfc42('0x35')]['fields']));_0x189bf4['attributes']=_0x189bf4['attributes'][_0xfc42('0x3b')]?_0x189bf4['attributes']:_0xa43c2c['model'];_0x189bf4[_0xfc42('0x56')]=qs['sort'](_0xf9b7ac['query'][_0xfc42('0x3e')]);_0x189bf4['where']=qs[_0xfc42('0x36')](_[_0xfc42('0x40')](_0xf9b7ac[_0xfc42('0x35')],_0xa43c2c['filters']));if(_0xf9b7ac[_0xfc42('0x35')][_0xfc42('0x41')]){_0x189bf4[_0xfc42('0x3f')]=_[_0xfc42('0x42')](_0x189bf4[_0xfc42('0x3f')],{'$or':_[_0xfc42('0x30')](_0x189bf4[_0xfc42('0x39')],function(_0x11750d){var _0x453643={};_0x453643[_0x11750d]={'$like':'%'+_0xf9b7ac['query'][_0xfc42('0x41')]+'%'};return _0x453643;})});}_0x189bf4=_[_0xfc42('0x42')]({},_0x189bf4,_0xf9b7ac[_0xfc42('0x44')]);return _0x5384c3['getAgents'](_0x189bf4);}})[_0xfc42('0x27')](function(_0x58e3a8){if(_0x58e3a8){_0x594e1b=_0x58e3a8['length'];if(!_0xf9b7ac['query'][_0xfc42('0x3c')](_0xfc42('0x3d'))){_0x189bf4['limit']=qs[_0xfc42('0x1d')](_0xf9b7ac[_0xfc42('0x35')]['limit']);_0x189bf4['offset']=qs[_0xfc42('0x1c')](_0xf9b7ac[_0xfc42('0x35')]['offset']);}return _0x5384c3[_0xfc42('0x89')](_0x189bf4);}})[_0xfc42('0x27')](function(_0x2142b7){if(_0x2142b7){return _0x2142b7?{'count':_0x594e1b,'rows':_0x2142b7}:null;}})[_0xfc42('0x27')](respondWithResult(_0x4970dd,null))[_0xfc42('0x4b')](handleError(_0x4970dd,null));}; \ No newline at end of file +var _0x61d6=['fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','undefined','count','set','save','update','destroy','FaxQueues','UserProfileResource','then','error','stack','name','send','index','FaxQueue','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','get','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents','interface','sequelize','transaction','addTeams','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','team_has_fax_queues','join','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x26641c,_0x1ba2a5){var _0x42c01a=function(_0x15c7da){while(--_0x15c7da){_0x26641c['push'](_0x26641c['shift']());}};_0x42c01a(++_0x1ba2a5);}(_0x61d6,0x18a));var _0x661d=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x61d6[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0x661d('0x0'));var rimraf=require(_0x661d('0x1'));var zipdir=require(_0x661d('0x2'));var jsonpatch=require(_0x661d('0x3'));var rp=require(_0x661d('0x4'));var moment=require(_0x661d('0x5'));var BPromise=require(_0x661d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x661d('0x7'));var sox=require(_0x661d('0x8'));var csv=require(_0x661d('0x9'));var ejs=require(_0x661d('0xa'));var fs=require('fs');var fs_extra=require(_0x661d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x661d('0xc'));var jsforce=require(_0x661d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x661d('0x9'));var querystring=require(_0x661d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x661d('0xf'));var qs=require(_0x661d('0x10'));var as=require(_0x661d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x661d('0x12'));var utils=require(_0x661d('0x13'));var config=require(_0x661d('0x14'));var licenseUtil=require(_0x661d('0x15'));var db=require(_0x661d('0x16'))['db'];config[_0x661d('0x17')]=_[_0x661d('0x18')](config['redis'],{'host':_0x661d('0x19'),'port':0x18eb});var socket=require(_0x661d('0x1a'))(new Redis(config[_0x661d('0x17')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x32d3df,_0x5c68d8){_0x5c68d8=_0x5c68d8||0xcc;return function(_0xca8f94){if(_0xca8f94){return _0x32d3df[_0x661d('0x1b')](_0x5c68d8);}return _0x32d3df['status'](_0x5c68d8)[_0x661d('0x1c')]();};}function respondWithResult(_0x54ba03,_0x234431){_0x234431=_0x234431||0xc8;return function(_0x464939){if(_0x464939){return _0x54ba03[_0x661d('0x1d')](_0x234431)[_0x661d('0x1e')](_0x464939);}};}function respondWithFilteredResult(_0x1453d2,_0x2099ec){return function(_0x461b05){if(_0x461b05){var _0x3173b5=typeof _0x2099ec[_0x661d('0x1f')]==='undefined'&&typeof _0x2099ec[_0x661d('0x20')]===_0x661d('0x21');var _0x7761b9=_0x461b05[_0x661d('0x22')];var _0x28d183=_0x3173b5?0x0:_0x2099ec[_0x661d('0x1f')];var _0x6486e9=_0x3173b5?_0x461b05[_0x661d('0x22')]:_0x2099ec[_0x661d('0x1f')]+_0x2099ec[_0x661d('0x20')];var _0x2e5f1d;if(_0x6486e9>=_0x7761b9){_0x6486e9=_0x7761b9;_0x2e5f1d=0xc8;}else{_0x2e5f1d=0xce;}_0x1453d2['status'](_0x2e5f1d);return _0x1453d2[_0x661d('0x23')]('Content-Range',_0x28d183+'-'+_0x6486e9+'/'+_0x7761b9)[_0x661d('0x1e')](_0x461b05);}return null;};}function patchUpdates(_0x581872){return function(_0x44fef1){try{jsonpatch['apply'](_0x44fef1,_0x581872,!![]);}catch(_0x638cd){return BPromise['reject'](_0x638cd);}return _0x44fef1[_0x661d('0x24')]();};}function saveUpdates(_0xf13963,_0x5a83bf){return function(_0x4476c9){if(_0x4476c9){return _0x4476c9[_0x661d('0x25')](_0xf13963)['then'](function(_0x31a8ac){return _0x31a8ac;});}return null;};}function removeEntity(_0x20ad5c,_0x597e36){return function(_0x1acf83){if(_0x1acf83){return _0x1acf83[_0x661d('0x26')]()['then'](function(){var _0x3b9631=_0x1acf83['get']({'plain':!![]});var _0x4c9d00=_0x661d('0x27');return db[_0x661d('0x28')][_0x661d('0x26')]({'where':{'type':_0x4c9d00,'resourceId':_0x3b9631['id']}})[_0x661d('0x29')](function(){return _0x1acf83;});})[_0x661d('0x29')](function(){_0x20ad5c['status'](0xcc)[_0x661d('0x1c')]();});}};}function handleEntityNotFound(_0x653fcd,_0x333248){return function(_0x13d815){if(!_0x13d815){_0x653fcd[_0x661d('0x1b')](0x194);}return _0x13d815;};}function handleError(_0x3b5483,_0x22ceaf){_0x22ceaf=_0x22ceaf||0x1f4;return function(_0x41f5f6){logger[_0x661d('0x2a')](_0x41f5f6[_0x661d('0x2b')]);if(_0x41f5f6[_0x661d('0x2c')]){delete _0x41f5f6[_0x661d('0x2c')];}_0x3b5483[_0x661d('0x1d')](_0x22ceaf)[_0x661d('0x2d')](_0x41f5f6);};}exports[_0x661d('0x2e')]=function(_0x25ca12,_0x3e3060){var _0x58bca2={},_0x1452ed={},_0x5e27b1={'count':0x0,'rows':[]};var _0x4084ae=_['map'](db[_0x661d('0x2f')]['rawAttributes'],function(_0x2c7f94){return{'name':_0x2c7f94[_0x661d('0x30')],'type':_0x2c7f94['type'][_0x661d('0x31')]};});_0x1452ed[_0x661d('0x32')]=_[_0x661d('0x33')](_0x4084ae,'name');_0x1452ed[_0x661d('0x34')]=_['keys'](_0x25ca12[_0x661d('0x34')]);_0x1452ed[_0x661d('0x35')]=_[_0x661d('0x36')](_0x1452ed[_0x661d('0x32')],_0x1452ed[_0x661d('0x34')]);_0x58bca2[_0x661d('0x37')]=_[_0x661d('0x36')](_0x1452ed['model'],qs[_0x661d('0x38')](_0x25ca12[_0x661d('0x34')][_0x661d('0x38')]));_0x58bca2[_0x661d('0x37')]=_0x58bca2[_0x661d('0x37')]['length']?_0x58bca2[_0x661d('0x37')]:_0x1452ed[_0x661d('0x32')];if(!_0x25ca12[_0x661d('0x34')][_0x661d('0x39')]('nolimit')){_0x58bca2[_0x661d('0x20')]=qs[_0x661d('0x20')](_0x25ca12[_0x661d('0x34')][_0x661d('0x20')]);_0x58bca2[_0x661d('0x1f')]=qs[_0x661d('0x1f')](_0x25ca12['query'][_0x661d('0x1f')]);}_0x58bca2[_0x661d('0x3a')]=qs[_0x661d('0x3b')](_0x25ca12['query'][_0x661d('0x3b')]);_0x58bca2[_0x661d('0x3c')]=qs[_0x661d('0x35')](_[_0x661d('0x3d')](_0x25ca12[_0x661d('0x34')],_0x1452ed[_0x661d('0x35')]),_0x4084ae);if(_0x25ca12[_0x661d('0x34')][_0x661d('0x3e')]){_0x58bca2[_0x661d('0x3c')]=_[_0x661d('0x3f')](_0x58bca2[_0x661d('0x3c')],{'$or':_[_0x661d('0x33')](_0x4084ae,function(_0x5b50f3){if(_0x5b50f3[_0x661d('0x40')]!=='VIRTUAL'){var _0x483575={};_0x483575[_0x5b50f3['name']]={'$like':'%'+_0x25ca12[_0x661d('0x34')][_0x661d('0x3e')]+'%'};return _0x483575;}})});}_0x58bca2=_[_0x661d('0x3f')]({},_0x58bca2,_0x25ca12['options']);var _0x3ec441={'where':_0x58bca2[_0x661d('0x3c')]};return db[_0x661d('0x2f')]['count'](_0x3ec441)[_0x661d('0x29')](function(_0xd1dc59){_0x5e27b1[_0x661d('0x22')]=_0xd1dc59;if(_0x25ca12[_0x661d('0x34')][_0x661d('0x41')]){_0x58bca2[_0x661d('0x42')]=[{'all':!![]}];}return db[_0x661d('0x2f')][_0x661d('0x43')](_0x58bca2);})[_0x661d('0x29')](function(_0x2d931b){_0x5e27b1[_0x661d('0x44')]=_0x2d931b;return _0x5e27b1;})[_0x661d('0x29')](respondWithFilteredResult(_0x3e3060,_0x58bca2))[_0x661d('0x45')](handleError(_0x3e3060,null));};exports[_0x661d('0x46')]=function(_0x1c0af0,_0x874877){var _0x24036a={'raw':!![],'where':{'id':_0x1c0af0[_0x661d('0x47')]['id']}},_0x397218={};_0x397218[_0x661d('0x32')]=_[_0x661d('0x48')](db[_0x661d('0x2f')][_0x661d('0x49')]);_0x397218['query']=_[_0x661d('0x48')](_0x1c0af0['query']);_0x397218[_0x661d('0x35')]=_['intersection'](_0x397218['model'],_0x397218['query']);_0x24036a['attributes']=_[_0x661d('0x36')](_0x397218['model'],qs[_0x661d('0x38')](_0x1c0af0[_0x661d('0x34')][_0x661d('0x38')]));_0x24036a[_0x661d('0x37')]=_0x24036a[_0x661d('0x37')][_0x661d('0x4a')]?_0x24036a['attributes']:_0x397218[_0x661d('0x32')];if(_0x1c0af0[_0x661d('0x34')]['includeAll']){_0x24036a[_0x661d('0x42')]=[{'all':!![]}];}_0x24036a=_[_0x661d('0x3f')]({},_0x24036a,_0x1c0af0[_0x661d('0x4b')]);return db['FaxQueue'][_0x661d('0x4c')](_0x24036a)['then'](handleEntityNotFound(_0x874877,null))[_0x661d('0x29')](respondWithResult(_0x874877,null))[_0x661d('0x45')](handleError(_0x874877,null));};exports['create']=function(_0x7ce17a,_0x14cdd0){return db[_0x661d('0x2f')][_0x661d('0x4d')](_0x7ce17a[_0x661d('0x4e')],{})[_0x661d('0x29')](function(_0x3247d8){var _0x2d75f4=_0x7ce17a['user']['get']({'plain':!![]});if(!_0x2d75f4)throw new Error(_0x661d('0x4f'));if(_0x2d75f4[_0x661d('0x50')]===_0x661d('0x51')){var _0x213be7=_0x3247d8['get']({'plain':!![]});var _0x2251f9=_0x661d('0x27');return db[_0x661d('0x52')][_0x661d('0x4c')]({'where':{'name':_0x2251f9,'userProfileId':_0x2d75f4[_0x661d('0x53')]},'raw':!![]})[_0x661d('0x29')](function(_0x35f187){if(_0x35f187&&_0x35f187[_0x661d('0x54')]===0x0){return db[_0x661d('0x28')][_0x661d('0x4d')]({'name':_0x213be7['name'],'resourceId':_0x213be7['id'],'type':_0x35f187[_0x661d('0x2c')],'sectionId':_0x35f187['id']},{})[_0x661d('0x29')](function(){return _0x3247d8;});}else{return _0x3247d8;}})[_0x661d('0x45')](function(_0x439cf6){logger[_0x661d('0x2a')](_0x661d('0x55'),_0x439cf6);throw _0x439cf6;});}return _0x3247d8;})[_0x661d('0x29')](respondWithResult(_0x14cdd0,0xc9))[_0x661d('0x45')](handleError(_0x14cdd0,null));};exports['update']=function(_0x990a2a,_0x5b8c3e){if(_0x990a2a[_0x661d('0x4e')]['id']){delete _0x990a2a[_0x661d('0x4e')]['id'];}return db[_0x661d('0x2f')]['find']({'where':{'id':_0x990a2a['params']['id']}})[_0x661d('0x29')](handleEntityNotFound(_0x5b8c3e,null))[_0x661d('0x29')](saveUpdates(_0x990a2a[_0x661d('0x4e')],null))[_0x661d('0x29')](respondWithResult(_0x5b8c3e,null))[_0x661d('0x45')](handleError(_0x5b8c3e,null));};exports[_0x661d('0x26')]=function(_0x2f4b60,_0x118f35){return db[_0x661d('0x2f')]['find']({'where':{'id':_0x2f4b60[_0x661d('0x47')]['id']}})[_0x661d('0x29')](handleEntityNotFound(_0x118f35,null))[_0x661d('0x29')](removeEntity(_0x118f35,null))['catch'](handleError(_0x118f35,null));};exports['describe']=function(_0x4f4859,_0x23e35f){return db[_0x661d('0x2f')]['describe']()['then'](respondWithResult(_0x23e35f,null))[_0x661d('0x45')](handleError(_0x23e35f,null));};exports[_0x661d('0x56')]=function(_0x5b7dab,_0x179e83,_0x1b39af){var _0x2023bb={'raw':!![],'where':{}},_0x1e8f5b={},_0x3b1da0;return db['FaxQueue'][_0x661d('0x57')]({'where':{'id':_0x5b7dab[_0x661d('0x47')]['id']}})['then'](handleEntityNotFound(_0x179e83,null))[_0x661d('0x29')](function(_0x2a8fed){if(_0x2a8fed){_0x3b1da0=_0x2a8fed[_0x661d('0x58')]({'plain':!![]});_0x1e8f5b[_0x661d('0x32')]=_[_0x661d('0x48')](db[_0x661d('0x59')][_0x661d('0x49')]);_0x1e8f5b['query']=_['keys'](_0x5b7dab['query']);_0x1e8f5b[_0x661d('0x35')]=_['intersection'](_0x1e8f5b[_0x661d('0x32')],_0x1e8f5b[_0x661d('0x34')]);_0x2023bb[_0x661d('0x37')]=_[_0x661d('0x36')](_0x1e8f5b[_0x661d('0x32')],qs[_0x661d('0x38')](_0x5b7dab['query']['fields']));_0x2023bb[_0x661d('0x37')]=_0x2023bb[_0x661d('0x37')]['length']?_0x2023bb[_0x661d('0x37')]:_0x1e8f5b[_0x661d('0x32')];if(!_0x5b7dab[_0x661d('0x34')][_0x661d('0x39')](_0x661d('0x5a'))){_0x2023bb['limit']=qs[_0x661d('0x20')](_0x5b7dab[_0x661d('0x34')]['limit']);_0x2023bb[_0x661d('0x1f')]=qs[_0x661d('0x1f')](_0x5b7dab['query']['offset']);}_0x2023bb['order']=qs[_0x661d('0x3b')](_0x5b7dab[_0x661d('0x34')][_0x661d('0x3b')]);_0x2023bb[_0x661d('0x3c')]=qs[_0x661d('0x35')](_[_0x661d('0x3d')](_0x5b7dab['query'],_0x1e8f5b[_0x661d('0x35')]));_0x2023bb[_0x661d('0x3c')][_0x661d('0x5b')]=_0x2a8fed['id'];if(_0x5b7dab[_0x661d('0x34')][_0x661d('0x3e')]){_0x2023bb[_0x661d('0x3c')]=_[_0x661d('0x3f')](_0x2023bb[_0x661d('0x3c')],{'$or':_[_0x661d('0x33')](_0x2023bb[_0x661d('0x37')],function(_0x5e88bf){var _0x372e05={};_0x372e05[_0x5e88bf]={'$like':'%'+_0x5b7dab[_0x661d('0x34')]['filter']+'%'};return _0x372e05;})});}_0x2023bb=_['merge']({},_0x2023bb,_0x5b7dab['options']);return db[_0x661d('0x59')]['findAll'](_0x2023bb);}})[_0x661d('0x29')](function(_0x57c033){if(_0x57c033){return db[_0x661d('0x5c')][_0x661d('0x5d')]({'where':{'id':_[_0x661d('0x33')](_0x57c033,_0x661d('0x5e')),'role':_0x661d('0x5f')},'attributes':['id',_0x661d('0x2c'),_0x661d('0x60'),'updatedAt',_0x661d('0x61')]});}})[_0x661d('0x29')](function(_0x520f68){if(_0x520f68){return{'count':_0x520f68[_0x661d('0x22')],'rows':_[_0x661d('0x33')](_0x520f68[_0x661d('0x44')],function(_0x40d65f){return{'membername':_0x40d65f['name'],'UserId':_0x40d65f['id'],'queue_name':_0x3b1da0[_0x661d('0x2c')],'FaxQueueId':_0x3b1da0['id'],'interface':util['format'](_0x661d('0x62'),_0x661d('0x63'),_0x40d65f['name']),'penalty':0x0,'paused':_0x40d65f[_0x661d('0x60')],'createdAt':_0x40d65f[_0x661d('0x61')],'updatedAt':_0x40d65f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x661d('0x29')](respondWithFilteredResult(_0x179e83,_0x2023bb))['catch'](handleError(_0x179e83,null));};exports[_0x661d('0x64')]=function(_0x3fc5a7,_0xed62c5,_0xa92483){var _0x22824a={};var _0x3e0671={};var _0x1b4403;var _0x5ad4e7;return db[_0x661d('0x2f')]['findOne']({'where':{'id':_0x3fc5a7[_0x661d('0x47')]['id']}})['then'](handleEntityNotFound(_0xed62c5,null))['then'](function(_0x265693){if(_0x265693){_0x1b4403=_0x265693;_0x3e0671[_0x661d('0x32')]=_[_0x661d('0x48')](db[_0x661d('0x65')]['rawAttributes']);_0x3e0671[_0x661d('0x34')]=_['keys'](_0x3fc5a7[_0x661d('0x34')]);_0x3e0671[_0x661d('0x35')]=_['intersection'](_0x3e0671[_0x661d('0x32')],_0x3e0671['query']);_0x22824a[_0x661d('0x37')]=_[_0x661d('0x36')](_0x3e0671[_0x661d('0x32')],qs[_0x661d('0x38')](_0x3fc5a7[_0x661d('0x34')][_0x661d('0x38')]));_0x22824a['attributes']=_0x22824a[_0x661d('0x37')]['length']?_0x22824a[_0x661d('0x37')]:_0x3e0671[_0x661d('0x32')];_0x22824a['order']=qs['sort'](_0x3fc5a7['query'][_0x661d('0x3b')]);_0x22824a[_0x661d('0x3c')]=qs['filters'](_['pick'](_0x3fc5a7[_0x661d('0x34')],_0x3e0671[_0x661d('0x35')]));if(_0x3fc5a7[_0x661d('0x34')][_0x661d('0x3e')]){_0x22824a[_0x661d('0x3c')]=_['merge'](_0x22824a[_0x661d('0x3c')],{'$or':_[_0x661d('0x33')](_0x22824a[_0x661d('0x37')],function(_0x58d965){var _0x9773fa={};_0x9773fa[_0x58d965]={'$like':'%'+_0x3fc5a7[_0x661d('0x34')][_0x661d('0x3e')]+'%'};return _0x9773fa;})});}_0x22824a=_[_0x661d('0x3f')]({},_0x22824a,_0x3fc5a7[_0x661d('0x4b')]);return _0x1b4403[_0x661d('0x64')](_0x22824a);}})['then'](function(_0x13aa6a){if(_0x13aa6a){_0x5ad4e7=_0x13aa6a[_0x661d('0x4a')];if(!_0x3fc5a7[_0x661d('0x34')][_0x661d('0x39')](_0x661d('0x5a'))){_0x22824a[_0x661d('0x20')]=qs['limit'](_0x3fc5a7[_0x661d('0x34')]['limit']);_0x22824a[_0x661d('0x1f')]=qs[_0x661d('0x1f')](_0x3fc5a7[_0x661d('0x34')][_0x661d('0x1f')]);}return _0x1b4403['getTeams'](_0x22824a);}})[_0x661d('0x29')](function(_0x1f0a5e){if(_0x1f0a5e){return _0x1f0a5e?{'count':_0x5ad4e7,'rows':_0x1f0a5e}:null;}})[_0x661d('0x29')](respondWithResult(_0xed62c5,null))[_0x661d('0x45')](handleError(_0xed62c5,null));};exports['addTeams']=function(_0x49e7e9,_0x49d6a7,_0x33bfcc){var _0x107aca=_0x49e7e9['body'][_0x661d('0x66')];return db[_0x661d('0x65')][_0x661d('0x43')]({'where':{'id':_0x107aca},'attributes':['id'],'include':[{'model':db[_0x661d('0x5c')],'as':_0x661d('0x67'),'attributes':['id',_0x661d('0x2c'),'online','voicePause',_0x661d('0x68')],'raw':!![]}]})[_0x661d('0x29')](function(_0x287085){if(_0x287085){var _0x543bea=_['flatMap'](_0x287085,function(_0x485a97){var _0x106d8b=_0x485a97[_0x661d('0x58')]({'plain':!![]});return _0x106d8b[_0x661d('0x67')];});return db[_0x661d('0x2f')][_0x661d('0x4c')]({'where':{'id':_0x49e7e9[_0x661d('0x47')]['id']}})[_0x661d('0x29')](function(_0x21461c){return db[_0x661d('0x69')][_0x661d('0x6a')](function(_0x457244){return _0x21461c[_0x661d('0x6b')](_0x107aca,{'transaction':_0x457244})[_0x661d('0x29')](function(){return BPromise['each'](_0x543bea,function(_0x2eae77){return db[_0x661d('0x59')]['findOrCreate']({'where':{'UserId':_0x2eae77['id'],'FaxQueueId':_0x49e7e9['params']['id']},'transaction':_0x457244});});})['then'](function(){_0x543bea[_0x661d('0x6c')](function(_0x5413b8){socket[_0x661d('0x6d')](_0x661d('0x6e'),{'UserId':_0x5413b8['id'],'FaxQueueId':_0x21461c['id']});});});});});}})[_0x661d('0x29')](respondWithStatusCode(_0x49d6a7,null))[_0x661d('0x45')](handleError(_0x49d6a7,null));};exports[_0x661d('0x6f')]=function(_0x5d6a88,_0x45c1e6,_0x8c3e30){return db['Team'][_0x661d('0x43')]({'where':{'id':_0x5d6a88[_0x661d('0x34')][_0x661d('0x66')]},'attributes':['id'],'include':[{'model':db[_0x661d('0x5c')],'as':_0x661d('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x45c1e6,null))[_0x661d('0x29')](function(_0x34867a){var _0x1aba72=_[_0x661d('0x33')](_0x34867a,'id');var _0x2d3301=[];var _0x33fa23=[];var _0x17f8f0=squel['select']();_0x17f8f0[_0x661d('0x70')](_0x661d('0x71'))['from'](_0x661d('0x72'),'tq')[_0x661d('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x661d('0x3c')]('FaxQueueId\x20=\x20?',_0x5d6a88[_0x661d('0x47')]['id']);for(var _0x4c9707=0x0;_0x4c9707<_0x34867a[_0x661d('0x4a')];_0x4c9707+=0x1){let _0x42c23d=_0x34867a[_0x4c9707];for(var _0x488806=0x0;_0x488806<_0x42c23d[_0x661d('0x67')][_0x661d('0x4a')];_0x488806+=0x1){let _0x149851=_0x42c23d[_0x661d('0x67')][_0x488806];var _0x1dd01f=_0x17f8f0[_0x661d('0x74')]();_0x1dd01f[_0x661d('0x3c')]('ut.UserId\x20=\x20?',_0x149851['id']);_0x33fa23[_0x661d('0x75')](db[_0x661d('0x69')][_0x661d('0x34')](_0x1dd01f[_0x661d('0x76')](),{'type':db[_0x661d('0x69')][_0x661d('0x77')][_0x661d('0x78')]})[_0x661d('0x29')](function(_0x2a557d){if(_0x2a557d[_0x661d('0x4a')]===0x1){return _0x149851['id'];}else{var _0x43b0ad=_[_0x661d('0x79')](_[_0x661d('0x33')](_0x2a557d,_0x661d('0x7a')),function(_0x1dedcd){return _[_0x661d('0x7b')](_0x1aba72,_0x1dedcd);});if(_0x43b0ad){return _0x149851['id'];}}}));}}return BPromise[_0x661d('0x7c')](_0x33fa23)[_0x661d('0x29')](function(_0x336f36){_0x2d3301=_(_0x2d3301)[_0x661d('0x7d')](_0x336f36)['compact']()[_0x661d('0x7e')]();return db['FaxQueue'][_0x661d('0x4c')]({'where':{'id':_0x5d6a88[_0x661d('0x47')]['id']}})[_0x661d('0x29')](function(_0x2ca12f){return db[_0x661d('0x69')]['transaction'](function(_0x4eece6){return _0x2ca12f[_0x661d('0x6f')](_0x5d6a88['query'][_0x661d('0x66')],{'transaction':_0x4eece6})[_0x661d('0x29')](function(){if(!_[_0x661d('0x7f')](_0x2d3301)){return _0x2ca12f[_0x661d('0x80')](_0x2d3301,{'transaction':_0x4eece6});}})[_0x661d('0x29')](function(){_0x2d3301[_0x661d('0x6c')](function(_0x1609ad){socket['emit'](_0x661d('0x81'),{'UserId':_0x1609ad,'FaxQueueId':_0x2ca12f['id']});});});});});});})[_0x661d('0x29')](respondWithStatusCode(_0x45c1e6,null))[_0x661d('0x45')](handleError(_0x45c1e6,null));};exports[_0x661d('0x82')]=function(_0x3c1a0d,_0x3b3237,_0x50bdd1){return db['FaxQueue'][_0x661d('0x4c')]({'where':{'id':_0x3c1a0d['params']['id']}})[_0x661d('0x29')](handleEntityNotFound(_0x3b3237,null))['then'](function(_0x3deae8){if(_0x3deae8){return _0x3deae8['addAgents'](_0x3c1a0d[_0x661d('0x4e')][_0x661d('0x66')],_[_0x661d('0x83')](_0x3c1a0d[_0x661d('0x4e')],[_0x661d('0x66'),'id'])||{})[_0x661d('0x84')](function(_0xc2d117){for(var _0x3f5bb8=0x0;_0x3f5bb8<_0x3c1a0d['body'][_0x661d('0x66')]['length'];_0x3f5bb8+=0x1){socket[_0x661d('0x6d')](_0x661d('0x6e'),{'UserId':Number(_0x3c1a0d[_0x661d('0x4e')]['ids'][_0x3f5bb8]),'FaxQueueId':Number(_0x3c1a0d['params']['id'])});}return _0xc2d117;});}})['then'](respondWithResult(_0x3b3237,null))['catch'](handleError(_0x3b3237,null));};exports['removeAgents']=function(_0x4f88c4,_0x4f1c42,_0x346ee4){return db[_0x661d('0x2f')][_0x661d('0x4c')]({'where':{'id':_0x4f88c4[_0x661d('0x47')]['id']}})[_0x661d('0x29')](handleEntityNotFound(_0x4f1c42,null))[_0x661d('0x29')](function(_0xdbcbc2){if(_0xdbcbc2){return _0xdbcbc2[_0x661d('0x80')](_0x4f88c4[_0x661d('0x34')]['ids'])[_0x661d('0x29')](function(){if(_[_0x661d('0x85')](_0x4f88c4[_0x661d('0x34')][_0x661d('0x66')])){for(var _0x44bdfa=0x0;_0x44bdfa<_0x4f88c4[_0x661d('0x34')]['ids'][_0x661d('0x4a')];_0x44bdfa+=0x1){socket[_0x661d('0x6d')](_0x661d('0x81'),{'UserId':Number(_0x4f88c4[_0x661d('0x34')][_0x661d('0x66')][_0x44bdfa]),'FaxQueueId':Number(_0x4f88c4[_0x661d('0x47')]['id'])});}}else{socket[_0x661d('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x4f88c4['query'][_0x661d('0x66')]),'FaxQueueId':Number(_0x4f88c4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4f1c42,null))[_0x661d('0x45')](handleError(_0x4f1c42,null));};exports['getAgents']=function(_0x56c71a,_0x7926c6,_0x2d92ce){var _0x4e2cd7={};var _0x3000da={};var _0x3723be;var _0x3977dc;return db['FaxQueue'][_0x661d('0x57')]({'where':{'id':_0x56c71a[_0x661d('0x47')]['id']}})[_0x661d('0x29')](handleEntityNotFound(_0x7926c6,null))['then'](function(_0x536d8d){if(_0x536d8d){_0x3723be=_0x536d8d;_0x3000da['model']=_[_0x661d('0x48')](db['User'][_0x661d('0x49')]);_0x3000da[_0x661d('0x34')]=_[_0x661d('0x48')](_0x56c71a[_0x661d('0x34')]);_0x3000da[_0x661d('0x35')]=_[_0x661d('0x36')](_0x3000da[_0x661d('0x32')],_0x3000da[_0x661d('0x34')]);_0x4e2cd7[_0x661d('0x37')]=_['intersection'](_0x3000da[_0x661d('0x32')],qs['fields'](_0x56c71a[_0x661d('0x34')][_0x661d('0x38')]));_0x4e2cd7[_0x661d('0x37')]=_0x4e2cd7[_0x661d('0x37')]['length']?_0x4e2cd7[_0x661d('0x37')]:_0x3000da['model'];_0x4e2cd7['order']=qs[_0x661d('0x3b')](_0x56c71a[_0x661d('0x34')]['sort']);_0x4e2cd7[_0x661d('0x3c')]=qs[_0x661d('0x35')](_[_0x661d('0x3d')](_0x56c71a['query'],_0x3000da[_0x661d('0x35')]));if(_0x56c71a[_0x661d('0x34')][_0x661d('0x3e')]){_0x4e2cd7[_0x661d('0x3c')]=_[_0x661d('0x3f')](_0x4e2cd7[_0x661d('0x3c')],{'$or':_[_0x661d('0x33')](_0x4e2cd7['attributes'],function(_0x3b336b){var _0x2395a2={};_0x2395a2[_0x3b336b]={'$like':'%'+_0x56c71a['query'][_0x661d('0x3e')]+'%'};return _0x2395a2;})});}_0x4e2cd7=_[_0x661d('0x3f')]({},_0x4e2cd7,_0x56c71a[_0x661d('0x4b')]);return _0x3723be[_0x661d('0x86')](_0x4e2cd7);}})['then'](function(_0x23df72){if(_0x23df72){_0x3977dc=_0x23df72[_0x661d('0x4a')];if(!_0x56c71a[_0x661d('0x34')][_0x661d('0x39')]('nolimit')){_0x4e2cd7[_0x661d('0x20')]=qs[_0x661d('0x20')](_0x56c71a[_0x661d('0x34')][_0x661d('0x20')]);_0x4e2cd7[_0x661d('0x1f')]=qs[_0x661d('0x1f')](_0x56c71a[_0x661d('0x34')]['offset']);}return _0x3723be['getAgents'](_0x4e2cd7);}})[_0x661d('0x29')](function(_0x3306fe){if(_0x3306fe){return _0x3306fe?{'count':_0x3977dc,'rows':_0x3306fe}:null;}})[_0x661d('0x29')](respondWithResult(_0x7926c6,null))[_0x661d('0x45')](handleError(_0x7926c6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index cd313ea..01810d3 100644 --- a/server/api/faxQueue/faxQueue.events.js +++ b/server/api/faxQueue/faxQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x286f=['../../mysqldb','FaxQueue','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x286f,0x178));var _0xf286=function(_0x5cd8ef,_0x5ca1ff){_0x5cd8ef=_0x5cd8ef-0x0;var _0x3b3e1f=_0x286f[_0x5cd8ef];return _0x3b3e1f;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xf286('0x0'))['db'][_0xf286('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf286('0x2'),'afterUpdate':'update','afterDestroy':_0xf286('0x3')};function emitEvent(_0x41f60a){return function(_0x289775,_0x1d8130,_0x205c0c){FaxQueueEvents[_0xf286('0x4')](_0x41f60a+':'+_0x289775['id'],_0x289775);FaxQueueEvents[_0xf286('0x4')](_0x41f60a,_0x289775);_0x205c0c(null);};}for(var e in events){if(events[_0xf286('0x5')](e)){var event=events[e];FaxQueue[_0xf286('0x6')](e,emitEvent(event));}}module[_0xf286('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x2ad3=['save','remove','emit','hook','exports','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x26ac0b,_0x54f8bb){var _0x523cf6=function(_0x1e04ef){while(--_0x1e04ef){_0x26ac0b['push'](_0x26ac0b['shift']());}};_0x523cf6(++_0x54f8bb);}(_0x2ad3,0x155));var _0x32ad=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x2ad3[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x32ad('0x0'))['db'][_0x32ad('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x32ad('0x2')](0x0);var events={'afterCreate':_0x32ad('0x3'),'afterUpdate':'update','afterDestroy':_0x32ad('0x4')};function emitEvent(_0x131062){return function(_0x249419,_0x12f630,_0xb019c5){FaxQueueEvents['emit'](_0x131062+':'+_0x249419['id'],_0x249419);FaxQueueEvents[_0x32ad('0x5')](_0x131062,_0x249419);_0xb019c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x32ad('0x6')](e,emitEvent(event));}}module[_0x32ad('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 788ed24..182bb6c 100644 --- a/server/api/faxQueue/faxQueue.model.js +++ b/server/api/faxQueue/faxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb271=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0xb271,0xad));var _0x1b27=function(_0xa24be5,_0x4b7998){_0xa24be5=_0xa24be5-0x0;var _0x5d9ff8=_0xb271[_0xa24be5];return _0x5d9ff8;};'use strict';var _=require(_0x1b27('0x0'));var util=require(_0x1b27('0x1'));var logger=require('../../config/logger')(_0x1b27('0x2'));var moment=require(_0x1b27('0x3'));var BPromise=require(_0x1b27('0x4'));var rp=require(_0x1b27('0x5'));var fs=require('fs');var path=require(_0x1b27('0x6'));var rimraf=require(_0x1b27('0x7'));var config=require(_0x1b27('0x8'));var attributes=require(_0x1b27('0x9'));module[_0x1b27('0xa')]=function(_0x1cad95,_0x1a93f1){return _0x1cad95[_0x1b27('0xb')](_0x1b27('0xc'),attributes,{'tableName':_0x1b27('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc87d=['moment','bluebird','path','./faxQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x221b2f,_0x40f60a){var _0x224917=function(_0x8d3c8e){while(--_0x8d3c8e){_0x221b2f['push'](_0x221b2f['shift']());}};_0x224917(++_0x40f60a);}(_0xc87d,0x126));var _0xdc87=function(_0xd4004a,_0x463da1){_0xd4004a=_0xd4004a-0x0;var _0x45bf33=_0xc87d[_0xd4004a];return _0x45bf33;};'use strict';var _=require(_0xdc87('0x0'));var util=require(_0xdc87('0x1'));var logger=require(_0xdc87('0x2'))('api');var moment=require(_0xdc87('0x3'));var BPromise=require(_0xdc87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc87('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc87('0x6'));module[_0xdc87('0x7')]=function(_0x225ee2,_0x541c4b){return _0x225ee2[_0xdc87('0x8')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 9ff280d..7a84332 100644 --- a/server/api/faxQueue/faxQueue.rpc.js +++ b/server/api/faxQueue/faxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d80=['raw','where','limit','include','map','attributes','model','then','catch','ShowFaxQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFaxQueue','FaxQueue','findAll','options'];(function(_0x1f5c57,_0x21da05){var _0x47ca96=function(_0x459335){while(--_0x459335){_0x1f5c57['push'](_0x1f5c57['shift']());}};_0x47ca96(++_0x21da05);}(_0x2d80,0xa2));var _0x02d8=function(_0x5358cd,_0x293fd6){_0x5358cd=_0x5358cd-0x0;var _0xc144e2=_0x2d80[_0x5358cd];return _0xc144e2;};'use strict';var _=require('lodash');var util=require(_0x02d8('0x0'));var moment=require(_0x02d8('0x1'));var BPromise=require(_0x02d8('0x2'));var rs=require(_0x02d8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02d8('0x4'))['db'];var utils=require(_0x02d8('0x5'));var logger=require(_0x02d8('0x6'))(_0x02d8('0x7'));var config=require(_0x02d8('0x8'));var jayson=require(_0x02d8('0x9'));var client=jayson['client'][_0x02d8('0xa')]({'port':0x232a});config[_0x02d8('0xb')]=_[_0x02d8('0xc')](config[_0x02d8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x02d8('0xd'))(new Redis(config[_0x02d8('0xb')]));require(_0x02d8('0xe'))['register'](socket);function respondWithRpcPromise(_0x388997,_0x2b3edb,_0x49c7f4){return new BPromise(function(_0x271096,_0x48a236){return client[_0x02d8('0xf')](_0x388997,_0x49c7f4)['then'](function(_0x469108){logger[_0x02d8('0x10')](_0x02d8('0x11'),_0x2b3edb,'request\x20sent');logger[_0x02d8('0x12')](_0x02d8('0x13'),_0x2b3edb,'request\x20sent',JSON[_0x02d8('0x14')](_0x469108));if(_0x469108[_0x02d8('0x15')]){if(_0x469108['error'][_0x02d8('0x16')]===0x1f4){logger['error'](_0x02d8('0x11'),_0x2b3edb,_0x469108[_0x02d8('0x15')][_0x02d8('0x17')]);return _0x48a236(_0x469108[_0x02d8('0x15')]['message']);}logger[_0x02d8('0x15')](_0x02d8('0x11'),_0x2b3edb,_0x469108[_0x02d8('0x15')]['message']);return _0x271096(_0x469108['error'][_0x02d8('0x17')]);}else{logger[_0x02d8('0x10')](_0x02d8('0x11'),_0x2b3edb,'request\x20sent');_0x271096(_0x469108['result']['message']);}})['catch'](function(_0x4aff08){logger[_0x02d8('0x15')]('FaxQueue,\x20%s,\x20%s',_0x2b3edb,_0x4aff08);_0x48a236(_0x4aff08);});});}exports[_0x02d8('0x18')]=function(_0x45ad34){var _0xec4960=this;return new Promise(function(_0x34cc31,_0x562b87){return db[_0x02d8('0x19')][_0x02d8('0x1a')]({'raw':_0x45ad34[_0x02d8('0x1b')]?_0x45ad34[_0x02d8('0x1b')][_0x02d8('0x1c')]===undefined?!![]:![]:!![],'where':_0x45ad34[_0x02d8('0x1b')]?_0x45ad34['options'][_0x02d8('0x1d')]||null:null,'attributes':_0x45ad34[_0x02d8('0x1b')]?_0x45ad34[_0x02d8('0x1b')]['attributes']||null:null,'limit':_0x45ad34['options']?_0x45ad34['options'][_0x02d8('0x1e')]||null:null,'include':_0x45ad34[_0x02d8('0x1b')]?_0x45ad34[_0x02d8('0x1b')][_0x02d8('0x1f')]?_[_0x02d8('0x20')](_0x45ad34[_0x02d8('0x1b')]['include'],function(_0x5ea8d1){return{'model':db[_0x5ea8d1['model']],'as':_0x5ea8d1['as'],'attributes':_0x5ea8d1[_0x02d8('0x21')],'include':_0x5ea8d1[_0x02d8('0x1f')]?_[_0x02d8('0x20')](_0x5ea8d1[_0x02d8('0x1f')],function(_0x37071d){return{'model':db[_0x37071d[_0x02d8('0x22')]],'as':_0x37071d['as'],'attributes':_0x37071d[_0x02d8('0x21')],'include':_0x37071d[_0x02d8('0x1f')]?_['map'](_0x37071d[_0x02d8('0x1f')],function(_0xf4cc27){return{'model':db[_0xf4cc27[_0x02d8('0x22')]],'as':_0xf4cc27['as'],'attributes':_0xf4cc27[_0x02d8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x02d8('0x23')](function(_0x5df960){logger[_0x02d8('0x10')](_0x02d8('0x18'),_0x45ad34);logger[_0x02d8('0x12')]('GetFaxQueue',_0x45ad34,JSON['stringify'](_0x5df960));_0x34cc31(_0x5df960);})[_0x02d8('0x24')](function(_0x166dbe){logger[_0x02d8('0x15')]('GetFaxQueue',_0x166dbe['message'],_0x45ad34);_0x562b87(_0xec4960[_0x02d8('0x15')](0x1f4,_0x166dbe['message']));});});};exports[_0x02d8('0x25')]=function(_0x5c6504){var _0x10ff6e=this;return new Promise(function(_0x559b90,_0x2087a3){return db[_0x02d8('0x19')]['find']({'raw':_0x5c6504[_0x02d8('0x1b')]?_0x5c6504[_0x02d8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5c6504[_0x02d8('0x1b')]?_0x5c6504['options'][_0x02d8('0x1d')]||null:null,'attributes':_0x5c6504[_0x02d8('0x1b')]?_0x5c6504[_0x02d8('0x1b')][_0x02d8('0x21')]||null:null,'include':_0x5c6504[_0x02d8('0x1b')]?_0x5c6504[_0x02d8('0x1b')][_0x02d8('0x1f')]?_[_0x02d8('0x20')](_0x5c6504[_0x02d8('0x1b')][_0x02d8('0x1f')],function(_0x10696e){return{'model':db[_0x10696e[_0x02d8('0x22')]],'as':_0x10696e['as'],'attributes':_0x10696e[_0x02d8('0x21')],'include':_0x10696e[_0x02d8('0x1f')]?_[_0x02d8('0x20')](_0x10696e['include'],function(_0x4c729d){return{'model':db[_0x4c729d['model']],'as':_0x4c729d['as'],'attributes':_0x4c729d[_0x02d8('0x21')],'include':_0x4c729d['include']?_[_0x02d8('0x20')](_0x4c729d['include'],function(_0x45c78d){return{'model':db[_0x45c78d[_0x02d8('0x22')]],'as':_0x45c78d['as'],'attributes':_0x45c78d['attributes']};}):[]};}):[]};}):[]:[]})[_0x02d8('0x23')](function(_0x86902c){logger['info'](_0x02d8('0x25'),_0x5c6504);logger[_0x02d8('0x12')](_0x02d8('0x25'),_0x5c6504,JSON[_0x02d8('0x14')](_0x86902c));_0x559b90(_0x86902c);})['catch'](function(_0x336310){logger[_0x02d8('0x15')](_0x02d8('0x25'),_0x336310[_0x02d8('0x17')],_0x5c6504);_0x2087a3(_0x10ff6e['error'](0x1f4,_0x336310[_0x02d8('0x17')]));});});}; \ No newline at end of file +var _0x4a48=['ShowFaxQueue','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','model','attributes','then'];(function(_0x536bf1,_0xcef6ea){var _0x2ef863=function(_0x406540){while(--_0x406540){_0x536bf1['push'](_0x536bf1['shift']());}};_0x2ef863(++_0xcef6ea);}(_0x4a48,0x169));var _0x84a4=function(_0x132536,_0x34a475){_0x132536=_0x132536-0x0;var _0x4b97fe=_0x4a48[_0x132536];return _0x4b97fe;};'use strict';var _=require(_0x84a4('0x0'));var util=require('util');var moment=require(_0x84a4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84a4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x84a4('0x3'));var logger=require(_0x84a4('0x4'))(_0x84a4('0x5'));var config=require('../../config/environment');var jayson=require(_0x84a4('0x6'));var client=jayson[_0x84a4('0x7')]['http']({'port':0x232a});config[_0x84a4('0x8')]=_[_0x84a4('0x9')](config[_0x84a4('0x8')],{'host':_0x84a4('0xa'),'port':0x18eb});var socket=require(_0x84a4('0xb'))(new Redis(config['redis']));require(_0x84a4('0xc'))[_0x84a4('0xd')](socket);function respondWithRpcPromise(_0x100f1b,_0x34b201,_0x5620f8){return new BPromise(function(_0xac12a8,_0x229b0f){return client['request'](_0x100f1b,_0x5620f8)['then'](function(_0x4a60a5){logger['info'](_0x84a4('0xe'),_0x34b201,_0x84a4('0xf'));logger[_0x84a4('0x10')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x34b201,_0x84a4('0xf'),JSON['stringify'](_0x4a60a5));if(_0x4a60a5[_0x84a4('0x11')]){if(_0x4a60a5['error'][_0x84a4('0x12')]===0x1f4){logger[_0x84a4('0x11')]('FaxQueue,\x20%s,\x20%s',_0x34b201,_0x4a60a5[_0x84a4('0x11')][_0x84a4('0x13')]);return _0x229b0f(_0x4a60a5[_0x84a4('0x11')][_0x84a4('0x13')]);}logger['error'](_0x84a4('0xe'),_0x34b201,_0x4a60a5[_0x84a4('0x11')]['message']);return _0xac12a8(_0x4a60a5[_0x84a4('0x11')]['message']);}else{logger[_0x84a4('0x14')]('FaxQueue,\x20%s,\x20%s',_0x34b201,_0x84a4('0xf'));_0xac12a8(_0x4a60a5[_0x84a4('0x15')][_0x84a4('0x13')]);}})[_0x84a4('0x16')](function(_0x3d02c6){logger[_0x84a4('0x11')](_0x84a4('0xe'),_0x34b201,_0x3d02c6);_0x229b0f(_0x3d02c6);});});}exports[_0x84a4('0x17')]=function(_0x24c574){var _0x952fe9=this;return new Promise(function(_0x4e69db,_0x34afda){return db[_0x84a4('0x18')][_0x84a4('0x19')]({'raw':_0x24c574[_0x84a4('0x1a')]?_0x24c574[_0x84a4('0x1a')][_0x84a4('0x1b')]===undefined?!![]:![]:!![],'where':_0x24c574[_0x84a4('0x1a')]?_0x24c574[_0x84a4('0x1a')][_0x84a4('0x1c')]||null:null,'attributes':_0x24c574['options']?_0x24c574[_0x84a4('0x1a')]['attributes']||null:null,'limit':_0x24c574[_0x84a4('0x1a')]?_0x24c574['options'][_0x84a4('0x1d')]||null:null,'include':_0x24c574[_0x84a4('0x1a')]?_0x24c574[_0x84a4('0x1a')][_0x84a4('0x1e')]?_[_0x84a4('0x1f')](_0x24c574['options'][_0x84a4('0x1e')],function(_0x2358d8){return{'model':db[_0x2358d8[_0x84a4('0x20')]],'as':_0x2358d8['as'],'attributes':_0x2358d8[_0x84a4('0x21')],'include':_0x2358d8[_0x84a4('0x1e')]?_[_0x84a4('0x1f')](_0x2358d8[_0x84a4('0x1e')],function(_0x32969f){return{'model':db[_0x32969f['model']],'as':_0x32969f['as'],'attributes':_0x32969f[_0x84a4('0x21')],'include':_0x32969f[_0x84a4('0x1e')]?_[_0x84a4('0x1f')](_0x32969f[_0x84a4('0x1e')],function(_0x49201c){return{'model':db[_0x49201c[_0x84a4('0x20')]],'as':_0x49201c['as'],'attributes':_0x49201c[_0x84a4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x84a4('0x22')](function(_0x16da28){logger['info'](_0x84a4('0x17'),_0x24c574);logger['debug']('GetFaxQueue',_0x24c574,JSON['stringify'](_0x16da28));_0x4e69db(_0x16da28);})[_0x84a4('0x16')](function(_0x5a0078){logger[_0x84a4('0x11')]('GetFaxQueue',_0x5a0078[_0x84a4('0x13')],_0x24c574);_0x34afda(_0x952fe9[_0x84a4('0x11')](0x1f4,_0x5a0078['message']));});});};exports[_0x84a4('0x23')]=function(_0x4af904){var _0x13d941=this;return new Promise(function(_0x225605,_0x3c0a2c){return db[_0x84a4('0x18')]['find']({'raw':_0x4af904[_0x84a4('0x1a')]?_0x4af904[_0x84a4('0x1a')][_0x84a4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4af904['options']?_0x4af904[_0x84a4('0x1a')][_0x84a4('0x1c')]||null:null,'attributes':_0x4af904['options']?_0x4af904['options'][_0x84a4('0x21')]||null:null,'include':_0x4af904['options']?_0x4af904['options'][_0x84a4('0x1e')]?_[_0x84a4('0x1f')](_0x4af904[_0x84a4('0x1a')][_0x84a4('0x1e')],function(_0x4cc610){return{'model':db[_0x4cc610[_0x84a4('0x20')]],'as':_0x4cc610['as'],'attributes':_0x4cc610[_0x84a4('0x21')],'include':_0x4cc610[_0x84a4('0x1e')]?_[_0x84a4('0x1f')](_0x4cc610[_0x84a4('0x1e')],function(_0x4cfb97){return{'model':db[_0x4cfb97[_0x84a4('0x20')]],'as':_0x4cfb97['as'],'attributes':_0x4cfb97[_0x84a4('0x21')],'include':_0x4cfb97[_0x84a4('0x1e')]?_['map'](_0x4cfb97[_0x84a4('0x1e')],function(_0x5b57a0){return{'model':db[_0x5b57a0[_0x84a4('0x20')]],'as':_0x5b57a0['as'],'attributes':_0x5b57a0[_0x84a4('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f62f9){logger[_0x84a4('0x14')](_0x84a4('0x23'),_0x4af904);logger[_0x84a4('0x10')]('ShowFaxQueue',_0x4af904,JSON['stringify'](_0x3f62f9));_0x225605(_0x3f62f9);})[_0x84a4('0x16')](function(_0xcbb62){logger[_0x84a4('0x11')](_0x84a4('0x23'),_0xcbb62[_0x84a4('0x13')],_0x4af904);_0x3c0a2c(_0x13d941[_0x84a4('0x11')](0x1f4,_0xcbb62['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 03b78cc..fba11cb 100644 --- a/server/api/faxQueue/faxQueue.socket.js +++ b/server/api/faxQueue/faxQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf97=['update','emit','removeListener','length','faxQueue:','save','remove'];(function(_0x5047af,_0x9c0833){var _0x3b01c3=function(_0x211c8b){while(--_0x211c8b){_0x5047af['push'](_0x5047af['shift']());}};_0x3b01c3(++_0x9c0833);}(_0xdf97,0x11d));var _0x7df9=function(_0x4f187e,_0x55f880){_0x4f187e=_0x4f187e-0x0;var _0x19ce4a=_0xdf97[_0x4f187e];return _0x19ce4a;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x7df9('0x0'),_0x7df9('0x1'),_0x7df9('0x2')];function createListener(_0x3c211f,_0x438e79){return function(_0x5d0b0e){_0x438e79[_0x7df9('0x3')](_0x3c211f,_0x5d0b0e);};}function removeListener(_0x577059,_0x5d2eb8){return function(){FaxQueueEvents[_0x7df9('0x4')](_0x577059,_0x5d2eb8);};}exports['register']=function(_0x1840e0){for(var _0x1db556=0x0,_0x59c4fa=events[_0x7df9('0x5')];_0x1db556<_0x59c4fa;_0x1db556++){var _0x3fc5b4=events[_0x1db556];var _0xcba2a7=createListener(_0x7df9('0x6')+_0x3fc5b4,_0x1840e0);FaxQueueEvents['on'](_0x3fc5b4,_0xcba2a7);}}; \ No newline at end of file +var _0x8812=['length','./faxQueue.events','save','remove','update','removeListener','register'];(function(_0x1b7be7,_0xdd84a1){var _0x47929d=function(_0x37cdd6){while(--_0x37cdd6){_0x1b7be7['push'](_0x1b7be7['shift']());}};_0x47929d(++_0xdd84a1);}(_0x8812,0x1cf));var _0x2881=function(_0x53a914,_0x578397){_0x53a914=_0x53a914-0x0;var _0x33b64f=_0x8812[_0x53a914];return _0x33b64f;};'use strict';var FaxQueueEvents=require(_0x2881('0x0'));var events=[_0x2881('0x1'),_0x2881('0x2'),_0x2881('0x3')];function createListener(_0x4f621a,_0x24048e){return function(_0x18f13a){_0x24048e['emit'](_0x4f621a,_0x18f13a);};}function removeListener(_0x5f0e06,_0x474632){return function(){FaxQueueEvents[_0x2881('0x4')](_0x5f0e06,_0x474632);};}exports[_0x2881('0x5')]=function(_0xfe21c4){for(var _0x1b2d9f=0x0,_0x251683=events[_0x2881('0x6')];_0x1b2d9f<_0x251683;_0x1b2d9f++){var _0x3a1d93=events[_0x1b2d9f];var _0x3d3b3c=createListener('faxQueue:'+_0x3a1d93,_0xfe21c4);FaxQueueEvents['on'](_0x3a1d93,_0x3d3b3c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 856aabc..2f91a5a 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb934=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb934,0x92));var _0x4b93=function(_0xbca57c,_0x209a94){_0xbca57c=_0xbca57c-0x0;var _0x4709de=_0xb934[_0xbca57c];return _0x4709de;};'use strict';var multer=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var path=require(_0x4b93('0x2'));var timeout=require('connect-timeout');var express=require(_0x4b93('0x3'));var router=express[_0x4b93('0x4')]();var fs_extra=require(_0x4b93('0x5'));var auth=require(_0x4b93('0x6'));var interaction=require(_0x4b93('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x4b93('0x8')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0xa')]);router[_0x4b93('0x8')]('/describe',auth[_0x4b93('0x9')](),controller[_0x4b93('0xb')]);router[_0x4b93('0x8')](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0xd')]);router[_0x4b93('0x8')](_0x4b93('0xe'),auth[_0x4b93('0x9')](),controller['getMembers']);router[_0x4b93('0x8')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x10')]);router[_0x4b93('0x8')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x12')]);router[_0x4b93('0x13')]('/',auth[_0x4b93('0x9')](),controller[_0x4b93('0x14')]);router[_0x4b93('0x13')](_0x4b93('0xf'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x15')]);router['post'](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x16')]);router['put'](_0x4b93('0xc'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x17')]);router[_0x4b93('0x18')](_0x4b93('0xc'),auth['isAuthenticated'](),controller[_0x4b93('0x19')]);router[_0x4b93('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4b93('0x1a')]);router[_0x4b93('0x18')](_0x4b93('0x11'),auth[_0x4b93('0x9')](),controller[_0x4b93('0x1b')]);module[_0x4b93('0x1c')]=router; \ No newline at end of file +var _0x1751=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x30ebff,_0x434cc4){var _0x421101=function(_0x3f3361){while(--_0x3f3361){_0x30ebff['push'](_0x30ebff['shift']());}};_0x421101(++_0x434cc4);}(_0x1751,0x76));var _0x1175=function(_0xf92c00,_0x1b7aa3){_0xf92c00=_0xf92c00-0x0;var _0x1aa081=_0x1751[_0xf92c00];return _0x1aa081;};'use strict';var multer=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var path=require(_0x1175('0x2'));var timeout=require(_0x1175('0x3'));var express=require('express');var router=express[_0x1175('0x4')]();var fs_extra=require(_0x1175('0x5'));var auth=require(_0x1175('0x6'));var interaction=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var controller=require(_0x1175('0x9'));router[_0x1175('0xa')]('/',auth[_0x1175('0xb')](),controller[_0x1175('0xc')]);router[_0x1175('0xa')](_0x1175('0xd'),auth[_0x1175('0xb')](),controller[_0x1175('0xe')]);router[_0x1175('0xa')](_0x1175('0xf'),auth[_0x1175('0xb')](),controller[_0x1175('0x10')]);router[_0x1175('0xa')](_0x1175('0x11'),auth[_0x1175('0xb')](),controller[_0x1175('0x12')]);router[_0x1175('0xa')](_0x1175('0x13'),auth[_0x1175('0xb')](),controller[_0x1175('0x14')]);router[_0x1175('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x1175('0x15')]);router[_0x1175('0x16')]('/',auth['isAuthenticated'](),controller[_0x1175('0x17')]);router[_0x1175('0x16')](_0x1175('0x13'),auth['isAuthenticated'](),controller[_0x1175('0x18')]);router[_0x1175('0x16')](_0x1175('0x19'),auth['isAuthenticated'](),controller[_0x1175('0x1a')]);router['put'](_0x1175('0xf'),auth[_0x1175('0xb')](),controller[_0x1175('0x1b')]);router[_0x1175('0x1c')]('/:id',auth[_0x1175('0xb')](),controller[_0x1175('0x1d')]);router['delete']('/:id/teams',auth[_0x1175('0xb')](),controller[_0x1175('0x1e')]);router[_0x1175('0x1c')](_0x1175('0x19'),auth[_0x1175('0xb')](),controller['removeAgents']);module[_0x1175('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 35c4580..f6c315b 100644 --- a/server/api/faxQueueReport/faxQueueReport.attributes.js +++ b/server/api/faxQueueReport/faxQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2598=['STRING','DATE','sequelize'];(function(_0x56e384,_0x4eb78a){var _0x468f64=function(_0x36eb7f){while(--_0x36eb7f){_0x56e384['push'](_0x56e384['shift']());}};_0x468f64(++_0x4eb78a);}(_0x2598,0x101));var _0x8259=function(_0x267f04,_0x18005d){_0x267f04=_0x267f04-0x0;var _0x324621=_0x2598[_0x267f04];return _0x324621;};'use strict';var moment=require('moment');var Sequelize=require(_0x8259('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8259('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x8259('0x1')]},'joinAt':{'type':Sequelize[_0x8259('0x2')]},'leaveAt':{'type':Sequelize[_0x8259('0x2')]},'acceptAt':{'type':Sequelize[_0x8259('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8259('0x1')]}}; \ No newline at end of file +var _0xa2e1=['STRING','DATE','moment','sequelize'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xa2e1,0x136));var _0x1a2e=function(_0x4bf92d,_0x4b80ca){_0x4bf92d=_0x4bf92d-0x0;var _0x34b649=_0xa2e1[_0x4bf92d];return _0x34b649;};'use strict';var moment=require(_0x1a2e('0x0'));var Sequelize=require(_0x1a2e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1a2e('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1a2e('0x3')]},'leaveAt':{'type':Sequelize[_0x1a2e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1a2e('0x3')]},'reason':{'type':Sequelize[_0x1a2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 564234b..89c9388 100644 --- a/server/api/faxQueueReport/faxQueueReport.controller.js +++ b/server/api/faxQueueReport/faxQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e16=['intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','params','length','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters'];(function(_0x3a7f92,_0x3b6693){var _0x56e5cd=function(_0x39eefe){while(--_0x39eefe){_0x3a7f92['push'](_0x3a7f92['shift']());}};_0x56e5cd(++_0x3b6693);}(_0x7e16,0x16f));var _0x67e1=function(_0x5659d8,_0x1811f8){_0x5659d8=_0x5659d8-0x0;var _0x11625f=_0x7e16[_0x5659d8];return _0x11625f;};'use strict';var emlformat=require(_0x67e1('0x0'));var rimraf=require(_0x67e1('0x1'));var zipdir=require(_0x67e1('0x2'));var jsonpatch=require(_0x67e1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x67e1('0x4'));var Mustache=require('mustache');var util=require(_0x67e1('0x5'));var path=require(_0x67e1('0x6'));var sox=require('sox');var csv=require(_0x67e1('0x7'));var ejs=require(_0x67e1('0x8'));var fs=require('fs');var fs_extra=require(_0x67e1('0x9'));var _=require(_0x67e1('0xa'));var squel=require(_0x67e1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x67e1('0x7'));var querystring=require(_0x67e1('0xc'));var Papa=require(_0x67e1('0xd'));var Redis=require(_0x67e1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x67e1('0xf'));var as=require(_0x67e1('0x10'));var hardwareService=require(_0x67e1('0x11'));var logger=require(_0x67e1('0x12'))('api');var utils=require(_0x67e1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x67e1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56ea6d,_0x300461){_0x300461=_0x300461||0xcc;return function(_0x2dbc4e){if(_0x2dbc4e){return _0x56ea6d[_0x67e1('0x15')](_0x300461);}return _0x56ea6d[_0x67e1('0x16')](_0x300461)['end']();};}function respondWithResult(_0xba481e,_0x13a763){_0x13a763=_0x13a763||0xc8;return function(_0x13564c){if(_0x13564c){return _0xba481e['status'](_0x13a763)[_0x67e1('0x17')](_0x13564c);}};}function respondWithFilteredResult(_0x2cb7c1,_0x351c6d){return function(_0x1fd37c){if(_0x1fd37c){var _0x25d1ef=typeof _0x351c6d[_0x67e1('0x18')]===_0x67e1('0x19')&&typeof _0x351c6d[_0x67e1('0x1a')]===_0x67e1('0x19');var _0x12e7ff=_0x1fd37c['count'];var _0x14ab29=_0x25d1ef?0x0:_0x351c6d[_0x67e1('0x18')];var _0x2c36b8=_0x25d1ef?_0x1fd37c['count']:_0x351c6d['offset']+_0x351c6d['limit'];var _0x3ee9e3;if(_0x2c36b8>=_0x12e7ff){_0x2c36b8=_0x12e7ff;_0x3ee9e3=0xc8;}else{_0x3ee9e3=0xce;}_0x2cb7c1[_0x67e1('0x16')](_0x3ee9e3);return _0x2cb7c1[_0x67e1('0x1b')](_0x67e1('0x1c'),_0x14ab29+'-'+_0x2c36b8+'/'+_0x12e7ff)['json'](_0x1fd37c);}return null;};}function patchUpdates(_0x39807c){return function(_0x3278e7){try{jsonpatch[_0x67e1('0x1d')](_0x3278e7,_0x39807c,!![]);}catch(_0x2c1dda){return BPromise['reject'](_0x2c1dda);}return _0x3278e7[_0x67e1('0x1e')]();};}function saveUpdates(_0x1d5df0,_0x467f45){return function(_0x66ad21){if(_0x66ad21){return _0x66ad21[_0x67e1('0x1f')](_0x1d5df0)[_0x67e1('0x20')](function(_0x27419e){return _0x27419e;});}return null;};}function removeEntity(_0x571930,_0x158566){return function(_0xeb0e69){if(_0xeb0e69){return _0xeb0e69[_0x67e1('0x21')]()[_0x67e1('0x20')](function(){_0x571930[_0x67e1('0x16')](0xcc)[_0x67e1('0x22')]();});}};}function handleEntityNotFound(_0x16fcd0,_0x274b69){return function(_0x25e094){if(!_0x25e094){_0x16fcd0[_0x67e1('0x15')](0x194);}return _0x25e094;};}function handleError(_0x59ae5e,_0x37160f){_0x37160f=_0x37160f||0x1f4;return function(_0x37beab){logger[_0x67e1('0x23')](_0x37beab['stack']);if(_0x37beab[_0x67e1('0x24')]){delete _0x37beab['name'];}_0x59ae5e[_0x67e1('0x16')](_0x37160f)[_0x67e1('0x25')](_0x37beab);};}exports[_0x67e1('0x26')]=function(_0x544371,_0x710c50){var _0x5a670d={},_0x4f6806={},_0x475145={'count':0x0,'rows':[]};var _0x53145d=_[_0x67e1('0x27')](db[_0x67e1('0x28')][_0x67e1('0x29')],function(_0x1fd992){return{'name':_0x1fd992[_0x67e1('0x2a')],'type':_0x1fd992[_0x67e1('0x2b')]['key']};});_0x4f6806['model']=_['map'](_0x53145d,'name');_0x4f6806[_0x67e1('0x2c')]=_[_0x67e1('0x2d')](_0x544371['query']);_0x4f6806[_0x67e1('0x2e')]=_[_0x67e1('0x2f')](_0x4f6806[_0x67e1('0x30')],_0x4f6806[_0x67e1('0x2c')]);_0x5a670d[_0x67e1('0x31')]=_[_0x67e1('0x2f')](_0x4f6806[_0x67e1('0x30')],qs[_0x67e1('0x32')](_0x544371['query'][_0x67e1('0x32')]));_0x5a670d['attributes']=_0x5a670d[_0x67e1('0x31')]['length']?_0x5a670d[_0x67e1('0x31')]:_0x4f6806['model'];if(!_0x544371[_0x67e1('0x2c')][_0x67e1('0x33')]('nolimit')){_0x5a670d['limit']=qs['limit'](_0x544371[_0x67e1('0x2c')]['limit']);_0x5a670d[_0x67e1('0x18')]=qs['offset'](_0x544371[_0x67e1('0x2c')]['offset']);}_0x5a670d['order']=qs[_0x67e1('0x34')](_0x544371[_0x67e1('0x2c')]['sort']);_0x5a670d[_0x67e1('0x35')]=qs[_0x67e1('0x2e')](_[_0x67e1('0x36')](_0x544371[_0x67e1('0x2c')],_0x4f6806[_0x67e1('0x2e')]),_0x53145d);if(_0x544371[_0x67e1('0x2c')][_0x67e1('0x37')]){_0x5a670d['where']=_[_0x67e1('0x38')](_0x5a670d[_0x67e1('0x35')],{'$or':_['map'](_0x53145d,function(_0x23a395){if(_0x23a395[_0x67e1('0x2b')]!==_0x67e1('0x39')){var _0x2a2963={};_0x2a2963[_0x23a395[_0x67e1('0x24')]]={'$like':'%'+_0x544371[_0x67e1('0x2c')][_0x67e1('0x37')]+'%'};return _0x2a2963;}})});}_0x5a670d=_[_0x67e1('0x38')]({},_0x5a670d,_0x544371[_0x67e1('0x3a')]);var _0x321973={'where':_0x5a670d[_0x67e1('0x35')]};return db[_0x67e1('0x28')][_0x67e1('0x3b')](_0x321973)[_0x67e1('0x20')](function(_0x2dfbc3){_0x475145[_0x67e1('0x3b')]=_0x2dfbc3;if(_0x544371[_0x67e1('0x2c')][_0x67e1('0x3c')]){_0x5a670d[_0x67e1('0x3d')]=[{'all':!![]}];}return db[_0x67e1('0x28')][_0x67e1('0x3e')](_0x5a670d);})[_0x67e1('0x20')](function(_0x1cf344){_0x475145['rows']=_0x1cf344;return _0x475145;})[_0x67e1('0x20')](respondWithFilteredResult(_0x710c50,_0x5a670d))['catch'](handleError(_0x710c50,null));};exports['show']=function(_0x611a7e,_0x4158c8){var _0x39655d={'raw':!![],'where':{'id':_0x611a7e[_0x67e1('0x3f')]['id']}},_0x18812d={};_0x18812d[_0x67e1('0x30')]=_[_0x67e1('0x2d')](db['FaxQueueReport'][_0x67e1('0x29')]);_0x18812d[_0x67e1('0x2c')]=_[_0x67e1('0x2d')](_0x611a7e[_0x67e1('0x2c')]);_0x18812d['filters']=_['intersection'](_0x18812d['model'],_0x18812d[_0x67e1('0x2c')]);_0x39655d[_0x67e1('0x31')]=_[_0x67e1('0x2f')](_0x18812d[_0x67e1('0x30')],qs['fields'](_0x611a7e['query'][_0x67e1('0x32')]));_0x39655d[_0x67e1('0x31')]=_0x39655d[_0x67e1('0x31')][_0x67e1('0x40')]?_0x39655d[_0x67e1('0x31')]:_0x18812d['model'];if(_0x611a7e['query'][_0x67e1('0x3c')]){_0x39655d[_0x67e1('0x3d')]=[{'all':!![]}];}_0x39655d=_[_0x67e1('0x38')]({},_0x39655d,_0x611a7e[_0x67e1('0x3a')]);return db[_0x67e1('0x28')][_0x67e1('0x41')](_0x39655d)['then'](handleEntityNotFound(_0x4158c8,null))[_0x67e1('0x20')](respondWithResult(_0x4158c8,null))[_0x67e1('0x42')](handleError(_0x4158c8,null));};exports['create']=function(_0x214b73,_0x22dbaf){return db['FaxQueueReport']['create'](_0x214b73[_0x67e1('0x43')],{})[_0x67e1('0x20')](respondWithResult(_0x22dbaf,0xc9))[_0x67e1('0x42')](handleError(_0x22dbaf,null));};exports[_0x67e1('0x1f')]=function(_0x41227b,_0x25370a){if(_0x41227b[_0x67e1('0x43')]['id']){delete _0x41227b[_0x67e1('0x43')]['id'];}return db[_0x67e1('0x28')][_0x67e1('0x41')]({'where':{'id':_0x41227b['params']['id']}})[_0x67e1('0x20')](handleEntityNotFound(_0x25370a,null))['then'](saveUpdates(_0x41227b[_0x67e1('0x43')],null))['then'](respondWithResult(_0x25370a,null))[_0x67e1('0x42')](handleError(_0x25370a,null));};exports['destroy']=function(_0x3886ef,_0x4b7c72){return db[_0x67e1('0x28')]['find']({'where':{'id':_0x3886ef[_0x67e1('0x3f')]['id']}})[_0x67e1('0x20')](handleEntityNotFound(_0x4b7c72,null))[_0x67e1('0x20')](removeEntity(_0x4b7c72,null))[_0x67e1('0x42')](handleError(_0x4b7c72,null));};exports[_0x67e1('0x44')]=function(_0x37e809,_0x33d9cd){return db[_0x67e1('0x28')]['describe']()[_0x67e1('0x20')](respondWithResult(_0x33d9cd,null))[_0x67e1('0x42')](handleError(_0x33d9cd,null));}; \ No newline at end of file +var _0x54ef=['undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','FaxQueueReport','findAll','rows','catch','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x54ef,0x112));var _0xf54e=function(_0x304637,_0x4380b2){_0x304637=_0x304637-0x0;var _0x4573f5=_0x54ef[_0x304637];return _0x4573f5;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={},_0x25b643={},_0x3993e4={'count':0x0,'rows':[]};var _0x36f985=_['map'](db['FaxQueueReport'][_0xf54e('0x2b')],function(_0x258d29){return{'name':_0x258d29[_0xf54e('0x2c')],'type':_0x258d29[_0xf54e('0x2d')][_0xf54e('0x2e')]};});_0x25b643[_0xf54e('0x2f')]=_[_0xf54e('0x30')](_0x36f985,_0xf54e('0x29'));_0x25b643[_0xf54e('0x31')]=_[_0xf54e('0x32')](_0x269f47['query']);_0x25b643['filters']=_[_0xf54e('0x33')](_0x25b643[_0xf54e('0x2f')],_0x25b643['query']);_0xa13cd0[_0xf54e('0x34')]=_[_0xf54e('0x33')](_0x25b643[_0xf54e('0x2f')],qs[_0xf54e('0x35')](_0x269f47['query']['fields']));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x34')][_0xf54e('0x36')]?_0xa13cd0[_0xf54e('0x34')]:_0x25b643[_0xf54e('0x2f')];if(!_0x269f47[_0xf54e('0x31')][_0xf54e('0x37')]('nolimit')){_0xa13cd0['limit']=qs['limit'](_0x269f47[_0xf54e('0x31')][_0xf54e('0x1d')]);_0xa13cd0['offset']=qs['offset'](_0x269f47[_0xf54e('0x31')][_0xf54e('0x20')]);}_0xa13cd0[_0xf54e('0x38')]=qs['sort'](_0x269f47[_0xf54e('0x31')][_0xf54e('0x39')]);_0xa13cd0['where']=qs[_0xf54e('0x3a')](_[_0xf54e('0x3b')](_0x269f47[_0xf54e('0x31')],_0x25b643[_0xf54e('0x3a')]),_0x36f985);if(_0x269f47[_0xf54e('0x31')][_0xf54e('0x3c')]){_0xa13cd0['where']=_['merge'](_0xa13cd0[_0xf54e('0x3d')],{'$or':_[_0xf54e('0x30')](_0x36f985,function(_0x46c51a){if(_0x46c51a['type']!==_0xf54e('0x3e')){var _0x22fa6f={};_0x22fa6f[_0x46c51a[_0xf54e('0x29')]]={'$like':'%'+_0x269f47[_0xf54e('0x31')][_0xf54e('0x3c')]+'%'};return _0x22fa6f;}})});}_0xa13cd0=_[_0xf54e('0x3f')]({},_0xa13cd0,_0x269f47[_0xf54e('0x40')]);var _0x1345b0={'where':_0xa13cd0[_0xf54e('0x3d')]};return db[_0xf54e('0x41')][_0xf54e('0x1f')](_0x1345b0)[_0xf54e('0x26')](function(_0x3dfd4e){_0x3993e4[_0xf54e('0x1f')]=_0x3dfd4e;if(_0x269f47[_0xf54e('0x31')]['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xf54e('0x42')](_0xa13cd0);})[_0xf54e('0x26')](function(_0x5398b2){_0x3993e4[_0xf54e('0x43')]=_0x5398b2;return _0x3993e4;})[_0xf54e('0x26')](respondWithFilteredResult(_0x21ba00,_0xa13cd0))[_0xf54e('0x44')](handleError(_0x21ba00,null));};exports['show']=function(_0x40675f,_0x13d145){var _0x1e016e={'raw':!![],'where':{'id':_0x40675f[_0xf54e('0x45')]['id']}},_0x794be7={};_0x794be7[_0xf54e('0x2f')]=_[_0xf54e('0x32')](db[_0xf54e('0x41')][_0xf54e('0x2b')]);_0x794be7['query']=_[_0xf54e('0x32')](_0x40675f[_0xf54e('0x31')]);_0x794be7[_0xf54e('0x3a')]=_[_0xf54e('0x33')](_0x794be7[_0xf54e('0x2f')],_0x794be7[_0xf54e('0x31')]);_0x1e016e['attributes']=_[_0xf54e('0x33')](_0x794be7['model'],qs[_0xf54e('0x35')](_0x40675f['query'][_0xf54e('0x35')]));_0x1e016e[_0xf54e('0x34')]=_0x1e016e[_0xf54e('0x34')]['length']?_0x1e016e[_0xf54e('0x34')]:_0x794be7[_0xf54e('0x2f')];if(_0x40675f[_0xf54e('0x31')][_0xf54e('0x46')]){_0x1e016e[_0xf54e('0x47')]=[{'all':!![]}];}_0x1e016e=_['merge']({},_0x1e016e,_0x40675f[_0xf54e('0x40')]);return db[_0xf54e('0x41')][_0xf54e('0x48')](_0x1e016e)[_0xf54e('0x26')](handleEntityNotFound(_0x13d145,null))['then'](respondWithResult(_0x13d145,null))[_0xf54e('0x44')](handleError(_0x13d145,null));};exports[_0xf54e('0x49')]=function(_0x554c1f,_0x22c842){return db[_0xf54e('0x41')][_0xf54e('0x49')](_0x554c1f[_0xf54e('0x4a')],{})['then'](respondWithResult(_0x22c842,0xc9))[_0xf54e('0x44')](handleError(_0x22c842,null));};exports[_0xf54e('0x25')]=function(_0x2527f6,_0xb4654f){if(_0x2527f6[_0xf54e('0x4a')]['id']){delete _0x2527f6[_0xf54e('0x4a')]['id'];}return db[_0xf54e('0x41')][_0xf54e('0x48')]({'where':{'id':_0x2527f6[_0xf54e('0x45')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xb4654f,null))[_0xf54e('0x26')](saveUpdates(_0x2527f6[_0xf54e('0x4a')],null))[_0xf54e('0x26')](respondWithResult(_0xb4654f,null))[_0xf54e('0x44')](handleError(_0xb4654f,null));};exports[_0xf54e('0x27')]=function(_0xa6c305,_0x40d8ab){return db[_0xf54e('0x41')][_0xf54e('0x48')]({'where':{'id':_0xa6c305[_0xf54e('0x45')]['id']}})['then'](handleEntityNotFound(_0x40d8ab,null))['then'](removeEntity(_0x40d8ab,null))[_0xf54e('0x44')](handleError(_0x40d8ab,null));};exports[_0xf54e('0x4b')]=function(_0x45861b,_0x40557d){return db[_0xf54e('0x41')][_0xf54e('0x4b')]()[_0xf54e('0x26')](respondWithResult(_0x40557d,null))[_0xf54e('0x44')](handleError(_0x40557d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 77dd6a1..b986ded 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x2d95d8,_0xb8dec){var _0x336b06=function(_0x258dae){while(--_0x258dae){_0x2d95d8['push'](_0x2d95d8['shift']());}};_0x336b06(++_0xb8dec);}(_0xf494,0x1c6));var _0x4f49=function(_0x457488,_0x142c1b){_0x457488=_0x457488-0x0;var _0x566ec7=_0xf494[_0x457488];return _0x566ec7;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x42599c,_0x26e53c){var _0x51f36d=function(_0x28f395){while(--_0x28f395){_0x42599c['push'](_0x42599c['shift']());}};_0x51f36d(++_0x26e53c);}(_0x7a54,0x106));var _0x47a5=function(_0x4c825b,_0x392927){_0x4c825b=_0x4c825b-0x0;var _0x1fe0aa=_0x7a54[_0x4c825b];return _0x1fe0aa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 2b2f1a6..d21e99e 100644 --- a/server/api/faxQueueReport/faxQueueReport.rpc.js +++ b/server/api/faxQueueReport/faxQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42e1=['../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','stringify','UpdateFaxQueueReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x43aea8,_0x47f82d){var _0x4a9cc2=function(_0x32d213){while(--_0x32d213){_0x43aea8['push'](_0x43aea8['shift']());}};_0x4a9cc2(++_0x47f82d);}(_0x42e1,0x1e2));var _0x142e=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x42e1[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x142e('0x0'));var util=require(_0x142e('0x1'));var moment=require(_0x142e('0x2'));var BPromise=require('bluebird');var rs=require(_0x142e('0x3'));var fs=require('fs');var Redis=require(_0x142e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x142e('0x5'));var logger=require(_0x142e('0x6'))(_0x142e('0x7'));var config=require(_0x142e('0x8'));var jayson=require(_0x142e('0x9'));var client=jayson[_0x142e('0xa')][_0x142e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x453566,_0x7266b6,_0x2d3432){return new BPromise(function(_0x4d0967,_0x5cc711){return client[_0x142e('0xc')](_0x453566,_0x2d3432)[_0x142e('0xd')](function(_0x56e533){logger[_0x142e('0xe')](_0x142e('0xf'),_0x7266b6,_0x142e('0x10'));logger[_0x142e('0x11')](_0x142e('0x12'),_0x7266b6,'request\x20sent',JSON['stringify'](_0x56e533));if(_0x56e533['error']){if(_0x56e533['error'][_0x142e('0x13')]===0x1f4){logger[_0x142e('0x14')](_0x142e('0xf'),_0x7266b6,_0x56e533['error'][_0x142e('0x15')]);return _0x5cc711(_0x56e533[_0x142e('0x14')][_0x142e('0x15')]);}logger[_0x142e('0x14')](_0x142e('0xf'),_0x7266b6,_0x56e533[_0x142e('0x14')]['message']);return _0x4d0967(_0x56e533[_0x142e('0x14')][_0x142e('0x15')]);}else{logger[_0x142e('0xe')](_0x142e('0xf'),_0x7266b6,_0x142e('0x10'));_0x4d0967(_0x56e533['result'][_0x142e('0x15')]);}})[_0x142e('0x16')](function(_0x2df146){logger[_0x142e('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x7266b6,_0x2df146);_0x5cc711(_0x2df146);});});}exports['CreateFaxQueueReport']=function(_0x2a1e22){var _0x980555=this;return new Promise(function(_0x2b5091,_0x53e46e){return db[_0x142e('0x17')][_0x142e('0x18')](_0x2a1e22['body'],{'raw':_0x2a1e22[_0x142e('0x19')]?_0x2a1e22[_0x142e('0x19')][_0x142e('0x1a')]===undefined?!![]:![]:!![]})[_0x142e('0xd')](function(_0x5f5824){logger['info'](_0x142e('0x1b'),_0x2a1e22);logger[_0x142e('0x11')](_0x142e('0x1b'),_0x2a1e22,JSON[_0x142e('0x1c')](_0x5f5824));_0x2b5091(_0x5f5824);})[_0x142e('0x16')](function(_0x155c4c){logger[_0x142e('0x14')]('CreateFaxQueueReport',_0x155c4c[_0x142e('0x15')],_0x2a1e22);_0x53e46e(_0x980555[_0x142e('0x14')](0x1f4,_0x155c4c[_0x142e('0x15')]));});});};exports[_0x142e('0x1d')]=function(_0xeb3583){var _0x47b17f=this;return new Promise(function(_0x519ca1,_0x2fe846){return db['FaxQueueReport'][_0x142e('0x1e')](_0xeb3583[_0x142e('0x1f')],{'raw':_0xeb3583[_0x142e('0x19')]?_0xeb3583[_0x142e('0x19')][_0x142e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeb3583[_0x142e('0x19')]?_0xeb3583[_0x142e('0x19')][_0x142e('0x20')]||null:null,'attributes':_0xeb3583[_0x142e('0x19')]?_0xeb3583[_0x142e('0x19')][_0x142e('0x21')]||null:null,'limit':_0xeb3583[_0x142e('0x19')]?_0xeb3583['options'][_0x142e('0x22')]||null:null})[_0x142e('0xd')](function(_0x519f46){logger[_0x142e('0xe')](_0x142e('0x1d'),_0xeb3583);logger['debug'](_0x142e('0x1d'),_0xeb3583,JSON[_0x142e('0x1c')](_0x519f46));_0x519ca1(_0x519f46);})['catch'](function(_0x3da744){logger[_0x142e('0x14')]('UpdateFaxQueueReport',_0x3da744[_0x142e('0x15')],_0xeb3583);_0x2fe846(_0x47b17f['error'](0x1f4,_0x3da744[_0x142e('0x15')]));});});}; \ No newline at end of file +var _0x6656=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','FaxQueueReport','create','body','raw','CreateFaxQueueReport','catch','UpdateFaxQueueReport','update','options','limit','stringify','lodash','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6656,0x7e));var _0x6665=function(_0x393868,_0x491e3c){_0x393868=_0x393868-0x0;var _0x42bc61=_0x6656[_0x393868];return _0x42bc61;};'use strict';var _=require(_0x6665('0x0'));var util=require(_0x6665('0x1'));var moment=require(_0x6665('0x2'));var BPromise=require(_0x6665('0x3'));var rs=require(_0x6665('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6665('0x5'))['db'];var utils=require(_0x6665('0x6'));var logger=require('../../config/logger')(_0x6665('0x7'));var config=require(_0x6665('0x8'));var jayson=require(_0x6665('0x9'));var client=jayson[_0x6665('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44cc5e,_0x301c64,_0x36d52c){return new BPromise(function(_0x55f042,_0x32b3cf){return client[_0x6665('0xb')](_0x44cc5e,_0x36d52c)[_0x6665('0xc')](function(_0x200d19){logger[_0x6665('0xd')](_0x6665('0xe'),_0x301c64,'request\x20sent');logger[_0x6665('0xf')](_0x6665('0x10'),_0x301c64,'request\x20sent',JSON['stringify'](_0x200d19));if(_0x200d19['error']){if(_0x200d19[_0x6665('0x11')][_0x6665('0x12')]===0x1f4){logger[_0x6665('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x301c64,_0x200d19[_0x6665('0x11')][_0x6665('0x13')]);return _0x32b3cf(_0x200d19[_0x6665('0x11')][_0x6665('0x13')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x301c64,_0x200d19[_0x6665('0x11')]['message']);return _0x55f042(_0x200d19[_0x6665('0x11')][_0x6665('0x13')]);}else{logger[_0x6665('0xd')](_0x6665('0xe'),_0x301c64,'request\x20sent');_0x55f042(_0x200d19[_0x6665('0x14')]['message']);}})['catch'](function(_0x2b4a4b){logger[_0x6665('0x11')](_0x6665('0xe'),_0x301c64,_0x2b4a4b);_0x32b3cf(_0x2b4a4b);});});}exports['CreateFaxQueueReport']=function(_0x3b88f4){var _0x3b745d=this;return new Promise(function(_0x13b035,_0x291904){return db[_0x6665('0x15')][_0x6665('0x16')](_0x3b88f4[_0x6665('0x17')],{'raw':_0x3b88f4['options']?_0x3b88f4['options'][_0x6665('0x18')]===undefined?!![]:![]:!![]})[_0x6665('0xc')](function(_0x1c6d0e){logger[_0x6665('0xd')](_0x6665('0x19'),_0x3b88f4);logger[_0x6665('0xf')](_0x6665('0x19'),_0x3b88f4,JSON['stringify'](_0x1c6d0e));_0x13b035(_0x1c6d0e);})[_0x6665('0x1a')](function(_0x2bf8a3){logger[_0x6665('0x11')]('CreateFaxQueueReport',_0x2bf8a3['message'],_0x3b88f4);_0x291904(_0x3b745d[_0x6665('0x11')](0x1f4,_0x2bf8a3[_0x6665('0x13')]));});});};exports[_0x6665('0x1b')]=function(_0x350e69){var _0x1d1bfe=this;return new Promise(function(_0x2ed7a0,_0x5a33b0){return db[_0x6665('0x15')][_0x6665('0x1c')](_0x350e69[_0x6665('0x17')],{'raw':_0x350e69[_0x6665('0x1d')]?_0x350e69[_0x6665('0x1d')][_0x6665('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x350e69['options']?_0x350e69[_0x6665('0x1d')]['where']||null:null,'attributes':_0x350e69[_0x6665('0x1d')]?_0x350e69['options']['attributes']||null:null,'limit':_0x350e69[_0x6665('0x1d')]?_0x350e69[_0x6665('0x1d')][_0x6665('0x1e')]||null:null})[_0x6665('0xc')](function(_0x1fa167){logger[_0x6665('0xd')](_0x6665('0x1b'),_0x350e69);logger['debug'](_0x6665('0x1b'),_0x350e69,JSON[_0x6665('0x1f')](_0x1fa167));_0x2ed7a0(_0x1fa167);})[_0x6665('0x1a')](function(_0x267eb3){logger[_0x6665('0x11')]('UpdateFaxQueueReport',_0x267eb3[_0x6665('0x13')],_0x350e69);_0x5a33b0(_0x1d1bfe[_0x6665('0x11')](0x1f4,_0x267eb3[_0x6665('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 32853ae..12c6cbe 100644 --- a/server/api/faxQueueReport/index.js +++ b/server/api/faxQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcd8=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','update','exports'];(function(_0x2cb766,_0x1096f1){var _0x3edc14=function(_0x309e2f){while(--_0x309e2f){_0x2cb766['push'](_0x2cb766['shift']());}};_0x3edc14(++_0x1096f1);}(_0xfcd8,0x154));var _0x8fcd=function(_0xc002b0,_0x854a8f){_0xc002b0=_0xc002b0-0x0;var _0x27052b=_0xfcd8[_0xc002b0];return _0x27052b;};'use strict';var multer=require('multer');var util=require(_0x8fcd('0x0'));var path=require(_0x8fcd('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fcd('0x2'));var router=express[_0x8fcd('0x3')]();var fs_extra=require(_0x8fcd('0x4'));var auth=require(_0x8fcd('0x5'));var interaction=require(_0x8fcd('0x6'));var config=require('../../config/environment');var controller=require(_0x8fcd('0x7'));router['get']('/',auth[_0x8fcd('0x8')](),controller[_0x8fcd('0x9')]);router['get'](_0x8fcd('0xa'),auth[_0x8fcd('0x8')](),controller[_0x8fcd('0xb')]);router[_0x8fcd('0xc')](_0x8fcd('0xd'),auth[_0x8fcd('0x8')](),controller[_0x8fcd('0xe')]);router['post']('/',auth[_0x8fcd('0x8')](),controller['create']);router['put'](_0x8fcd('0xd'),auth[_0x8fcd('0x8')](),controller[_0x8fcd('0xf')]);router['delete'](_0x8fcd('0xd'),auth[_0x8fcd('0x8')](),controller['destroy']);module[_0x8fcd('0x10')]=router; \ No newline at end of file +var _0x91bc=['isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x293821,_0x19f893){var _0x54c0d8=function(_0x40f28d){while(--_0x40f28d){_0x293821['push'](_0x293821['shift']());}};_0x54c0d8(++_0x19f893);}(_0x91bc,0x1de));var _0xc91b=function(_0x1403af,_0x26b5e2){_0x1403af=_0x1403af-0x0;var _0x1bbe93=_0x91bc[_0x1403af];return _0x1bbe93;};'use strict';var multer=require(_0xc91b('0x0'));var util=require(_0xc91b('0x1'));var path=require(_0xc91b('0x2'));var timeout=require(_0xc91b('0x3'));var express=require('express');var router=express[_0xc91b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc91b('0x5'));var config=require(_0xc91b('0x6'));var controller=require('./faxQueueReport.controller');router[_0xc91b('0x7')]('/',auth[_0xc91b('0x8')](),controller[_0xc91b('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc91b('0xa')]);router[_0xc91b('0x7')]('/:id',auth[_0xc91b('0x8')](),controller[_0xc91b('0xb')]);router['post']('/',auth[_0xc91b('0x8')](),controller[_0xc91b('0xc')]);router[_0xc91b('0xd')](_0xc91b('0xe'),auth[_0xc91b('0x8')](),controller[_0xc91b('0xf')]);router[_0xc91b('0x10')](_0xc91b('0xe'),auth[_0xc91b('0x8')](),controller['destroy']);module[_0xc91b('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 5eda48f..3e28c61 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3cef2a,_0x48bc9d){var _0x4a303b=function(_0x4a270e){while(--_0x4a270e){_0x3cef2a['push'](_0x3cef2a['shift']());}};_0x4a303b(++_0x48bc9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x413457,_0x19922c){var _0x46cb45=function(_0x300373){while(--_0x300373){_0x413457['push'](_0x413457['shift']());}};_0x46cb45(++_0x19922c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3fc8d4,_0x5388ff){_0x3fc8d4=_0x3fc8d4-0x0;var _0x2a16ce=_0xf4eb[_0x3fc8d4];return _0x2a16ce;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 0d9c72e..fff750c 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc871=['merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xc871,0x138));var _0x1c87=function(_0x4fb211,_0x75df29){_0x4fb211=_0x4fb211-0x0;var _0x4a0b97=_0xc871[_0x4fb211];return _0x4a0b97;};'use strict';var emlformat=require(_0x1c87('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c87('0x1'));var rp=require('request-promise');var moment=require(_0x1c87('0x2'));var BPromise=require(_0x1c87('0x3'));var Mustache=require(_0x1c87('0x4'));var util=require(_0x1c87('0x5'));var path=require(_0x1c87('0x6'));var sox=require(_0x1c87('0x7'));var csv=require('to-csv');var ejs=require(_0x1c87('0x8'));var fs=require('fs');var fs_extra=require(_0x1c87('0x9'));var _=require(_0x1c87('0xa'));var squel=require('squel');var crypto=require(_0x1c87('0xb'));var jsforce=require(_0x1c87('0xc'));var deskjs=require(_0x1c87('0xd'));var toCsv=require(_0x1c87('0xe'));var querystring=require('querystring');var Papa=require(_0x1c87('0xf'));var Redis=require(_0x1c87('0x10'));var authService=require(_0x1c87('0x11'));var qs=require(_0x1c87('0x12'));var as=require(_0x1c87('0x13'));var hardwareService=require(_0x1c87('0x14'));var logger=require(_0x1c87('0x15'))(_0x1c87('0x16'));var utils=require(_0x1c87('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1c87('0x18'));var db=require(_0x1c87('0x19'))['db'];function respondWithStatusCode(_0x1e2529,_0x9cd8be){_0x9cd8be=_0x9cd8be||0xcc;return function(_0x28babe){if(_0x28babe){return _0x1e2529[_0x1c87('0x1a')](_0x9cd8be);}return _0x1e2529['status'](_0x9cd8be)[_0x1c87('0x1b')]();};}function respondWithResult(_0x26288e,_0x5097fa){_0x5097fa=_0x5097fa||0xc8;return function(_0x3576f3){if(_0x3576f3){return _0x26288e[_0x1c87('0x1c')](_0x5097fa)[_0x1c87('0x1d')](_0x3576f3);}};}function respondWithFilteredResult(_0x51af8b,_0x2826dd){return function(_0x64ab91){if(_0x64ab91){var _0x19272c=typeof _0x2826dd[_0x1c87('0x1e')]===_0x1c87('0x1f')&&typeof _0x2826dd[_0x1c87('0x20')]==='undefined';var _0x5f4d31=_0x64ab91[_0x1c87('0x21')];var _0x4bde23=_0x19272c?0x0:_0x2826dd[_0x1c87('0x1e')];var _0x20e0a2=_0x19272c?_0x64ab91[_0x1c87('0x21')]:_0x2826dd[_0x1c87('0x1e')]+_0x2826dd[_0x1c87('0x20')];var _0xcf53fa;if(_0x20e0a2>=_0x5f4d31){_0x20e0a2=_0x5f4d31;_0xcf53fa=0xc8;}else{_0xcf53fa=0xce;}_0x51af8b[_0x1c87('0x1c')](_0xcf53fa);return _0x51af8b['set'](_0x1c87('0x22'),_0x4bde23+'-'+_0x20e0a2+'/'+_0x5f4d31)['json'](_0x64ab91);}return null;};}function patchUpdates(_0x458114){return function(_0x38ac69){try{jsonpatch['apply'](_0x38ac69,_0x458114,!![]);}catch(_0x2144eb){return BPromise[_0x1c87('0x23')](_0x2144eb);}return _0x38ac69[_0x1c87('0x24')]();};}function saveUpdates(_0x1ea2a0,_0x51af4b){return function(_0x52a501){if(_0x52a501){return _0x52a501[_0x1c87('0x25')](_0x1ea2a0)[_0x1c87('0x26')](function(_0x3a8e82){return _0x3a8e82;});}return null;};}function removeEntity(_0x40feb9,_0x50b94e){return function(_0x23eb05){if(_0x23eb05){return _0x23eb05[_0x1c87('0x27')]()[_0x1c87('0x26')](function(){_0x40feb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e9bfc,_0x2dd346){return function(_0x430247){if(!_0x430247){_0x4e9bfc[_0x1c87('0x1a')](0x194);}return _0x430247;};}function handleError(_0x1b4062,_0x41988a){_0x41988a=_0x41988a||0x1f4;return function(_0x5ac4b0){logger['error'](_0x5ac4b0[_0x1c87('0x28')]);if(_0x5ac4b0[_0x1c87('0x29')]){delete _0x5ac4b0[_0x1c87('0x29')];}_0x1b4062[_0x1c87('0x1c')](_0x41988a)[_0x1c87('0x2a')](_0x5ac4b0);};}exports[_0x1c87('0x2b')]=function(_0x4259a7,_0x363b16){var _0x16ec07={},_0x724c26={},_0x5149a7={'count':0x0,'rows':[]};var _0x248bc3=_['map'](db[_0x1c87('0x2c')][_0x1c87('0x2d')],function(_0xe2c5cc){return{'name':_0xe2c5cc[_0x1c87('0x2e')],'type':_0xe2c5cc['type'][_0x1c87('0x2f')]};});_0x724c26['model']=_[_0x1c87('0x30')](_0x248bc3,_0x1c87('0x29'));_0x724c26[_0x1c87('0x31')]=_[_0x1c87('0x32')](_0x4259a7[_0x1c87('0x31')]);_0x724c26['filters']=_[_0x1c87('0x33')](_0x724c26[_0x1c87('0x34')],_0x724c26[_0x1c87('0x31')]);_0x16ec07[_0x1c87('0x35')]=_[_0x1c87('0x33')](_0x724c26[_0x1c87('0x34')],qs[_0x1c87('0x36')](_0x4259a7[_0x1c87('0x31')][_0x1c87('0x36')]));_0x16ec07[_0x1c87('0x35')]=_0x16ec07[_0x1c87('0x35')][_0x1c87('0x37')]?_0x16ec07['attributes']:_0x724c26[_0x1c87('0x34')];if(!_0x4259a7[_0x1c87('0x31')][_0x1c87('0x38')]('nolimit')){_0x16ec07['limit']=qs['limit'](_0x4259a7[_0x1c87('0x31')][_0x1c87('0x20')]);_0x16ec07[_0x1c87('0x1e')]=qs['offset'](_0x4259a7[_0x1c87('0x31')][_0x1c87('0x1e')]);}_0x16ec07[_0x1c87('0x39')]=qs[_0x1c87('0x3a')](_0x4259a7[_0x1c87('0x31')]['sort']);_0x16ec07[_0x1c87('0x3b')]=qs[_0x1c87('0x3c')](_[_0x1c87('0x3d')](_0x4259a7['query'],_0x724c26[_0x1c87('0x3c')]),_0x248bc3);if(_0x4259a7['query'][_0x1c87('0x3e')]){_0x16ec07[_0x1c87('0x3b')]=_[_0x1c87('0x3f')](_0x16ec07['where'],{'$or':_[_0x1c87('0x30')](_0x248bc3,function(_0x1f48fb){if(_0x1f48fb['type']!=='VIRTUAL'){var _0x4a20c9={};_0x4a20c9[_0x1f48fb['name']]={'$like':'%'+_0x4259a7['query'][_0x1c87('0x3e')]+'%'};return _0x4a20c9;}})});}_0x16ec07=_['merge']({},_0x16ec07,_0x4259a7[_0x1c87('0x40')]);var _0x3962d7={'where':_0x16ec07[_0x1c87('0x3b')]};return db[_0x1c87('0x2c')]['count'](_0x3962d7)[_0x1c87('0x26')](function(_0x2cfb90){_0x5149a7[_0x1c87('0x21')]=_0x2cfb90;if(_0x4259a7[_0x1c87('0x31')][_0x1c87('0x41')]){_0x16ec07[_0x1c87('0x42')]=[{'all':!![]}];}return db[_0x1c87('0x2c')][_0x1c87('0x43')](_0x16ec07);})['then'](function(_0x48d1b1){_0x5149a7[_0x1c87('0x44')]=_0x48d1b1;return _0x5149a7;})[_0x1c87('0x26')](respondWithFilteredResult(_0x363b16,_0x16ec07))[_0x1c87('0x45')](handleError(_0x363b16,null));};exports['show']=function(_0x529203,_0x14a682){var _0x49b9c3={'raw':!![],'where':{'id':_0x529203[_0x1c87('0x46')]['id']}},_0x3fd30d={};_0x3fd30d['model']=_[_0x1c87('0x32')](db[_0x1c87('0x2c')][_0x1c87('0x2d')]);_0x3fd30d[_0x1c87('0x31')]=_[_0x1c87('0x32')](_0x529203['query']);_0x3fd30d[_0x1c87('0x3c')]=_[_0x1c87('0x33')](_0x3fd30d[_0x1c87('0x34')],_0x3fd30d[_0x1c87('0x31')]);_0x49b9c3['attributes']=_['intersection'](_0x3fd30d[_0x1c87('0x34')],qs[_0x1c87('0x36')](_0x529203[_0x1c87('0x31')][_0x1c87('0x36')]));_0x49b9c3[_0x1c87('0x35')]=_0x49b9c3[_0x1c87('0x35')]['length']?_0x49b9c3[_0x1c87('0x35')]:_0x3fd30d['model'];if(_0x529203[_0x1c87('0x31')][_0x1c87('0x41')]){_0x49b9c3[_0x1c87('0x42')]=[{'all':!![]}];}_0x49b9c3=_[_0x1c87('0x3f')]({},_0x49b9c3,_0x529203[_0x1c87('0x40')]);return db[_0x1c87('0x2c')][_0x1c87('0x47')](_0x49b9c3)[_0x1c87('0x26')](handleEntityNotFound(_0x14a682,null))[_0x1c87('0x26')](respondWithResult(_0x14a682,null))[_0x1c87('0x45')](handleError(_0x14a682,null));};exports[_0x1c87('0x48')]=function(_0x50887e,_0x497cad){return db[_0x1c87('0x2c')][_0x1c87('0x48')](_0x50887e['body'],{})[_0x1c87('0x26')](respondWithResult(_0x497cad,0xc9))[_0x1c87('0x45')](handleError(_0x497cad,null));};exports[_0x1c87('0x25')]=function(_0x328857,_0x1ecf6b){if(_0x328857[_0x1c87('0x49')]['id']){delete _0x328857[_0x1c87('0x49')]['id'];}return db['FaxTransferReport'][_0x1c87('0x47')]({'where':{'id':_0x328857['params']['id']}})[_0x1c87('0x26')](handleEntityNotFound(_0x1ecf6b,null))[_0x1c87('0x26')](saveUpdates(_0x328857[_0x1c87('0x49')],null))[_0x1c87('0x26')](respondWithResult(_0x1ecf6b,null))[_0x1c87('0x45')](handleError(_0x1ecf6b,null));};exports[_0x1c87('0x27')]=function(_0x47da34,_0x239fc5){return db[_0x1c87('0x2c')][_0x1c87('0x47')]({'where':{'id':_0x47da34[_0x1c87('0x46')]['id']}})[_0x1c87('0x26')](handleEntityNotFound(_0x239fc5,null))['then'](removeEntity(_0x239fc5,null))['catch'](handleError(_0x239fc5,null));};exports[_0x1c87('0x4a')]=function(_0x32667f,_0xa011ee){return db[_0x1c87('0x2c')][_0x1c87('0x4a')]()[_0x1c87('0x26')](respondWithResult(_0xa011ee,null))[_0x1c87('0x45')](handleError(_0xa011ee,null));}; \ No newline at end of file +var _0x086a=['name','send','FaxTransferReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','filters','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack'];(function(_0xba76b1,_0xc62a5b){var _0x22e40d=function(_0xbdf2f6){while(--_0xbdf2f6){_0xba76b1['push'](_0xba76b1['shift']());}};_0x22e40d(++_0xc62a5b);}(_0x086a,0xf9));var _0xa086=function(_0x2e7521,_0x1ed471){_0x2e7521=_0x2e7521-0x0;var _0x5233c=_0x086a[_0x2e7521];return _0x5233c;};'use strict';var emlformat=require(_0xa086('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa086('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa086('0x2'));var moment=require(_0xa086('0x3'));var BPromise=require(_0xa086('0x4'));var Mustache=require(_0xa086('0x5'));var util=require('util');var path=require(_0xa086('0x6'));var sox=require(_0xa086('0x7'));var csv=require(_0xa086('0x8'));var ejs=require(_0xa086('0x9'));var fs=require('fs');var fs_extra=require(_0xa086('0xa'));var _=require(_0xa086('0xb'));var squel=require(_0xa086('0xc'));var crypto=require(_0xa086('0xd'));var jsforce=require(_0xa086('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa086('0x8'));var querystring=require(_0xa086('0xf'));var Papa=require('papaparse');var Redis=require(_0xa086('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa086('0x11'));var hardwareService=require(_0xa086('0x12'));var logger=require('../../config/logger')(_0xa086('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa086('0x14'));var db=require(_0xa086('0x15'))['db'];function respondWithStatusCode(_0x2dee33,_0x1e1ae3){_0x1e1ae3=_0x1e1ae3||0xcc;return function(_0xa7f4a3){if(_0xa7f4a3){return _0x2dee33['sendStatus'](_0x1e1ae3);}return _0x2dee33[_0xa086('0x16')](_0x1e1ae3)['end']();};}function respondWithResult(_0x1f0743,_0x20d325){_0x20d325=_0x20d325||0xc8;return function(_0x2dda4c){if(_0x2dda4c){return _0x1f0743[_0xa086('0x16')](_0x20d325)[_0xa086('0x17')](_0x2dda4c);}};}function respondWithFilteredResult(_0x506416,_0x54f413){return function(_0x1f59c9){if(_0x1f59c9){var _0x2932a1=typeof _0x54f413[_0xa086('0x18')]==='undefined'&&typeof _0x54f413[_0xa086('0x19')]===_0xa086('0x1a');var _0x1b9d4d=_0x1f59c9[_0xa086('0x1b')];var _0x2050ec=_0x2932a1?0x0:_0x54f413[_0xa086('0x18')];var _0x43ed86=_0x2932a1?_0x1f59c9['count']:_0x54f413[_0xa086('0x18')]+_0x54f413[_0xa086('0x19')];var _0x3fa121;if(_0x43ed86>=_0x1b9d4d){_0x43ed86=_0x1b9d4d;_0x3fa121=0xc8;}else{_0x3fa121=0xce;}_0x506416[_0xa086('0x16')](_0x3fa121);return _0x506416[_0xa086('0x1c')](_0xa086('0x1d'),_0x2050ec+'-'+_0x43ed86+'/'+_0x1b9d4d)[_0xa086('0x17')](_0x1f59c9);}return null;};}function patchUpdates(_0x349f8e){return function(_0x3be728){try{jsonpatch[_0xa086('0x1e')](_0x3be728,_0x349f8e,!![]);}catch(_0x3a2b01){return BPromise[_0xa086('0x1f')](_0x3a2b01);}return _0x3be728[_0xa086('0x20')]();};}function saveUpdates(_0x7ca900,_0x564bf7){return function(_0x5b8fd0){if(_0x5b8fd0){return _0x5b8fd0['update'](_0x7ca900)[_0xa086('0x21')](function(_0x23e05b){return _0x23e05b;});}return null;};}function removeEntity(_0x4d1431,_0x397a60){return function(_0x5be74e){if(_0x5be74e){return _0x5be74e[_0xa086('0x22')]()[_0xa086('0x21')](function(){_0x4d1431[_0xa086('0x16')](0xcc)[_0xa086('0x23')]();});}};}function handleEntityNotFound(_0x5eabca,_0x440670){return function(_0x523224){if(!_0x523224){_0x5eabca[_0xa086('0x24')](0x194);}return _0x523224;};}function handleError(_0x514980,_0x4826f5){_0x4826f5=_0x4826f5||0x1f4;return function(_0x336afd){logger[_0xa086('0x25')](_0x336afd[_0xa086('0x26')]);if(_0x336afd['name']){delete _0x336afd[_0xa086('0x27')];}_0x514980[_0xa086('0x16')](_0x4826f5)[_0xa086('0x28')](_0x336afd);};}exports['index']=function(_0xd2626b,_0x3d10f9){var _0xdee9a4={},_0x17bf58={},_0x2a335c={'count':0x0,'rows':[]};var _0x527880=_['map'](db[_0xa086('0x29')][_0xa086('0x2a')],function(_0x4f4301){return{'name':_0x4f4301[_0xa086('0x2b')],'type':_0x4f4301[_0xa086('0x2c')][_0xa086('0x2d')]};});_0x17bf58['model']=_[_0xa086('0x2e')](_0x527880,'name');_0x17bf58[_0xa086('0x2f')]=_[_0xa086('0x30')](_0xd2626b['query']);_0x17bf58['filters']=_[_0xa086('0x31')](_0x17bf58[_0xa086('0x32')],_0x17bf58['query']);_0xdee9a4[_0xa086('0x33')]=_[_0xa086('0x31')](_0x17bf58[_0xa086('0x32')],qs['fields'](_0xd2626b[_0xa086('0x2f')][_0xa086('0x34')]));_0xdee9a4['attributes']=_0xdee9a4[_0xa086('0x33')][_0xa086('0x35')]?_0xdee9a4[_0xa086('0x33')]:_0x17bf58[_0xa086('0x32')];if(!_0xd2626b[_0xa086('0x2f')][_0xa086('0x36')](_0xa086('0x37'))){_0xdee9a4['limit']=qs[_0xa086('0x19')](_0xd2626b['query'][_0xa086('0x19')]);_0xdee9a4[_0xa086('0x18')]=qs[_0xa086('0x18')](_0xd2626b[_0xa086('0x2f')][_0xa086('0x18')]);}_0xdee9a4['order']=qs['sort'](_0xd2626b[_0xa086('0x2f')]['sort']);_0xdee9a4['where']=qs['filters'](_['pick'](_0xd2626b[_0xa086('0x2f')],_0x17bf58['filters']),_0x527880);if(_0xd2626b[_0xa086('0x2f')][_0xa086('0x38')]){_0xdee9a4[_0xa086('0x39')]=_['merge'](_0xdee9a4[_0xa086('0x39')],{'$or':_[_0xa086('0x2e')](_0x527880,function(_0x5c3588){if(_0x5c3588[_0xa086('0x2c')]!==_0xa086('0x3a')){var _0x283074={};_0x283074[_0x5c3588[_0xa086('0x27')]]={'$like':'%'+_0xd2626b[_0xa086('0x2f')][_0xa086('0x38')]+'%'};return _0x283074;}})});}_0xdee9a4=_[_0xa086('0x3b')]({},_0xdee9a4,_0xd2626b[_0xa086('0x3c')]);var _0x24decb={'where':_0xdee9a4['where']};return db['FaxTransferReport']['count'](_0x24decb)[_0xa086('0x21')](function(_0x3bcd5b){_0x2a335c[_0xa086('0x1b')]=_0x3bcd5b;if(_0xd2626b[_0xa086('0x2f')][_0xa086('0x3d')]){_0xdee9a4[_0xa086('0x3e')]=[{'all':!![]}];}return db[_0xa086('0x29')][_0xa086('0x3f')](_0xdee9a4);})[_0xa086('0x21')](function(_0x5b15e0){_0x2a335c[_0xa086('0x40')]=_0x5b15e0;return _0x2a335c;})[_0xa086('0x21')](respondWithFilteredResult(_0x3d10f9,_0xdee9a4))[_0xa086('0x41')](handleError(_0x3d10f9,null));};exports['show']=function(_0x37573e,_0x1a7f41){var _0x4e5fbe={'raw':!![],'where':{'id':_0x37573e['params']['id']}},_0x33b65d={};_0x33b65d['model']=_[_0xa086('0x30')](db[_0xa086('0x29')][_0xa086('0x2a')]);_0x33b65d['query']=_[_0xa086('0x30')](_0x37573e[_0xa086('0x2f')]);_0x33b65d[_0xa086('0x42')]=_['intersection'](_0x33b65d[_0xa086('0x32')],_0x33b65d[_0xa086('0x2f')]);_0x4e5fbe[_0xa086('0x33')]=_[_0xa086('0x31')](_0x33b65d[_0xa086('0x32')],qs[_0xa086('0x34')](_0x37573e[_0xa086('0x2f')]['fields']));_0x4e5fbe['attributes']=_0x4e5fbe[_0xa086('0x33')][_0xa086('0x35')]?_0x4e5fbe[_0xa086('0x33')]:_0x33b65d[_0xa086('0x32')];if(_0x37573e[_0xa086('0x2f')]['includeAll']){_0x4e5fbe['include']=[{'all':!![]}];}_0x4e5fbe=_[_0xa086('0x3b')]({},_0x4e5fbe,_0x37573e['options']);return db[_0xa086('0x29')][_0xa086('0x43')](_0x4e5fbe)['then'](handleEntityNotFound(_0x1a7f41,null))['then'](respondWithResult(_0x1a7f41,null))[_0xa086('0x41')](handleError(_0x1a7f41,null));};exports['create']=function(_0x6803b2,_0x45935e){return db[_0xa086('0x29')][_0xa086('0x44')](_0x6803b2[_0xa086('0x45')],{})[_0xa086('0x21')](respondWithResult(_0x45935e,0xc9))[_0xa086('0x41')](handleError(_0x45935e,null));};exports['update']=function(_0x30d41f,_0x36c19c){if(_0x30d41f[_0xa086('0x45')]['id']){delete _0x30d41f[_0xa086('0x45')]['id'];}return db[_0xa086('0x29')]['find']({'where':{'id':_0x30d41f['params']['id']}})['then'](handleEntityNotFound(_0x36c19c,null))[_0xa086('0x21')](saveUpdates(_0x30d41f[_0xa086('0x45')],null))[_0xa086('0x21')](respondWithResult(_0x36c19c,null))[_0xa086('0x41')](handleError(_0x36c19c,null));};exports[_0xa086('0x22')]=function(_0x5b7a0d,_0x5068a1){return db[_0xa086('0x29')][_0xa086('0x43')]({'where':{'id':_0x5b7a0d[_0xa086('0x46')]['id']}})['then'](handleEntityNotFound(_0x5068a1,null))['then'](removeEntity(_0x5068a1,null))[_0xa086('0x41')](handleError(_0x5068a1,null));};exports[_0xa086('0x47')]=function(_0x541a85,_0x17bb64){return db[_0xa086('0x29')][_0xa086('0x47')]()[_0xa086('0x21')](respondWithResult(_0x17bb64,null))['catch'](handleError(_0x17bb64,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c14c519..a513198 100644 --- a/server/api/faxTransferReport/faxTransferReport.model.js +++ b/server/api/faxTransferReport/faxTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffdd=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1440d9,_0x4a2c7e){var _0x4a0cfb=function(_0x9dc96c){while(--_0x9dc96c){_0x1440d9['push'](_0x1440d9['shift']());}};_0x4a0cfb(++_0x4a2c7e);}(_0xffdd,0x193));var _0xdffd=function(_0x207ea8,_0x1770f9){_0x207ea8=_0x207ea8-0x0;var _0x159410=_0xffdd[_0x207ea8];return _0x159410;};'use strict';var _=require(_0xdffd('0x0'));var util=require(_0xdffd('0x1'));var logger=require(_0xdffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdffd('0x3'));var rp=require(_0xdffd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdffd('0x5'));var config=require(_0xdffd('0x6'));var attributes=require(_0xdffd('0x7'));module[_0xdffd('0x8')]=function(_0x54aaf8,_0x581162){return _0x54aaf8['define'](_0xdffd('0x9'),attributes,{'tableName':_0xdffd('0xa'),'paranoid':![],'indexes':[{'name':_0xdffd('0xb'),'fields':[_0xdffd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd3=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport'];(function(_0x232ca5,_0x5690aa){var _0x1e512c=function(_0x317734){while(--_0x317734){_0x232ca5['push'](_0x232ca5['shift']());}};_0x1e512c(++_0x5690aa);}(_0x3dd3,0x1d2));var _0x33dd=function(_0x363123,_0x250988){_0x363123=_0x363123-0x0;var _0x38eb6a=_0x3dd3[_0x363123];return _0x38eb6a;};'use strict';var _=require(_0x33dd('0x0'));var util=require(_0x33dd('0x1'));var logger=require(_0x33dd('0x2'))(_0x33dd('0x3'));var moment=require(_0x33dd('0x4'));var BPromise=require(_0x33dd('0x5'));var rp=require(_0x33dd('0x6'));var fs=require('fs');var path=require(_0x33dd('0x7'));var rimraf=require(_0x33dd('0x8'));var config=require(_0x33dd('0x9'));var attributes=require(_0x33dd('0xa'));module[_0x33dd('0xb')]=function(_0x396990,_0x5d7276){return _0x396990[_0x33dd('0xc')](_0x33dd('0xd'),attributes,{'tableName':_0x33dd('0xe'),'paranoid':![],'indexes':[{'name':_0x33dd('0xf'),'fields':[_0x33dd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2a02410..94fc5f4 100644 --- a/server/api/faxTransferReport/faxTransferReport.rpc.js +++ b/server/api/faxTransferReport/faxTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf726=['then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x135892,_0x203263){var _0x1351d4=function(_0x40bfd8){while(--_0x40bfd8){_0x135892['push'](_0x135892['shift']());}};_0x1351d4(++_0x203263);}(_0xf726,0xff));var _0x6f72=function(_0x38b0f8,_0x409eb5){_0x38b0f8=_0x38b0f8-0x0;var _0x2a471d=_0xf726[_0x38b0f8];return _0x2a471d;};'use strict';var _=require('lodash');var util=require(_0x6f72('0x0'));var moment=require(_0x6f72('0x1'));var BPromise=require(_0x6f72('0x2'));var rs=require(_0x6f72('0x3'));var fs=require('fs');var Redis=require(_0x6f72('0x4'));var db=require(_0x6f72('0x5'))['db'];var utils=require(_0x6f72('0x6'));var logger=require(_0x6f72('0x7'))(_0x6f72('0x8'));var config=require(_0x6f72('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46ad54,_0x570fcc,_0x1c5469){return new BPromise(function(_0x42d1d9,_0x3af747){return client[_0x6f72('0xa')](_0x46ad54,_0x1c5469)[_0x6f72('0xb')](function(_0x193ca4){logger[_0x6f72('0xc')](_0x6f72('0xd'),_0x570fcc,_0x6f72('0xe'));logger[_0x6f72('0xf')](_0x6f72('0x10'),_0x570fcc,'request\x20sent',JSON['stringify'](_0x193ca4));if(_0x193ca4['error']){if(_0x193ca4['error']['code']===0x1f4){logger[_0x6f72('0x11')](_0x6f72('0xd'),_0x570fcc,_0x193ca4['error']['message']);return _0x3af747(_0x193ca4[_0x6f72('0x11')][_0x6f72('0x12')]);}logger[_0x6f72('0x11')](_0x6f72('0xd'),_0x570fcc,_0x193ca4[_0x6f72('0x11')][_0x6f72('0x12')]);return _0x42d1d9(_0x193ca4[_0x6f72('0x11')][_0x6f72('0x12')]);}else{logger[_0x6f72('0xc')](_0x6f72('0xd'),_0x570fcc,_0x6f72('0xe'));_0x42d1d9(_0x193ca4['result'][_0x6f72('0x12')]);}})['catch'](function(_0x1e6594){logger[_0x6f72('0x11')](_0x6f72('0xd'),_0x570fcc,_0x1e6594);_0x3af747(_0x1e6594);});});} \ No newline at end of file +var _0xf0bc=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x19e804,_0x3ecf23){var _0x5524f7=function(_0x51790b){while(--_0x51790b){_0x19e804['push'](_0x19e804['shift']());}};_0x5524f7(++_0x3ecf23);}(_0xf0bc,0xe4));var _0xcf0b=function(_0xf48a5,_0x2f029e){_0xf48a5=_0xf48a5-0x0;var _0x3d959e=_0xf0bc[_0xf48a5];return _0x3d959e;};'use strict';var _=require('lodash');var util=require(_0xcf0b('0x0'));var moment=require('moment');var BPromise=require(_0xcf0b('0x1'));var rs=require(_0xcf0b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcf0b('0x3'));var logger=require(_0xcf0b('0x4'))(_0xcf0b('0x5'));var config=require('../../config/environment');var jayson=require(_0xcf0b('0x6'));var client=jayson[_0xcf0b('0x7')][_0xcf0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x135e63,_0x210a7c,_0x2317ae){return new BPromise(function(_0x23dc41,_0x42c1dc){return client[_0xcf0b('0x9')](_0x135e63,_0x2317ae)[_0xcf0b('0xa')](function(_0x128bf3){logger[_0xcf0b('0xb')](_0xcf0b('0xc'),_0x210a7c,_0xcf0b('0xd'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x210a7c,_0xcf0b('0xd'),JSON[_0xcf0b('0xe')](_0x128bf3));if(_0x128bf3[_0xcf0b('0xf')]){if(_0x128bf3[_0xcf0b('0xf')][_0xcf0b('0x10')]===0x1f4){logger['error'](_0xcf0b('0xc'),_0x210a7c,_0x128bf3[_0xcf0b('0xf')][_0xcf0b('0x11')]);return _0x42c1dc(_0x128bf3[_0xcf0b('0xf')]['message']);}logger[_0xcf0b('0xf')](_0xcf0b('0xc'),_0x210a7c,_0x128bf3[_0xcf0b('0xf')][_0xcf0b('0x11')]);return _0x23dc41(_0x128bf3['error']['message']);}else{logger['info'](_0xcf0b('0xc'),_0x210a7c,'request\x20sent');_0x23dc41(_0x128bf3['result']['message']);}})[_0xcf0b('0x12')](function(_0x28b61b){logger[_0xcf0b('0xf')](_0xcf0b('0xc'),_0x210a7c,_0x28b61b);_0x42c1dc(_0x28b61b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index aad0385..e562d08 100644 --- a/server/api/faxTransferReport/index.js +++ b/server/api/faxTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a87=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','multer','path'];(function(_0xb93e37,_0x3643bf){var _0x275cad=function(_0xb50af4){while(--_0xb50af4){_0xb93e37['push'](_0xb93e37['shift']());}};_0x275cad(++_0x3643bf);}(_0x9a87,0x9e));var _0x79a8=function(_0x1fe7c3,_0x2f7c6e){_0x1fe7c3=_0x1fe7c3-0x0;var _0x490542=_0x9a87[_0x1fe7c3];return _0x490542;};'use strict';var multer=require(_0x79a8('0x0'));var util=require('util');var path=require(_0x79a8('0x1'));var timeout=require(_0x79a8('0x2'));var express=require(_0x79a8('0x3'));var router=express[_0x79a8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x79a8('0x5'));var config=require(_0x79a8('0x6'));var controller=require(_0x79a8('0x7'));router[_0x79a8('0x8')]('/',auth[_0x79a8('0x9')](),controller[_0x79a8('0xa')]);router[_0x79a8('0x8')](_0x79a8('0xb'),auth[_0x79a8('0x9')](),controller[_0x79a8('0xc')]);router[_0x79a8('0x8')]('/:id',auth[_0x79a8('0x9')](),controller[_0x79a8('0xd')]);router[_0x79a8('0xe')]('/',auth[_0x79a8('0x9')](),controller[_0x79a8('0xf')]);router[_0x79a8('0x10')](_0x79a8('0x11'),auth[_0x79a8('0x9')](),controller[_0x79a8('0x12')]);router[_0x79a8('0x13')](_0x79a8('0x11'),auth[_0x79a8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x045d=['path','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util'];(function(_0x433c11,_0x509a13){var _0x1bbb06=function(_0x54697b){while(--_0x54697b){_0x433c11['push'](_0x433c11['shift']());}};_0x1bbb06(++_0x509a13);}(_0x045d,0xe2));var _0xd045=function(_0x5e21b2,_0x32e139){_0x5e21b2=_0x5e21b2-0x0;var _0x1af8e7=_0x045d[_0x5e21b2];return _0x1af8e7;};'use strict';var multer=require(_0xd045('0x0'));var util=require(_0xd045('0x1'));var path=require(_0xd045('0x2'));var timeout=require('connect-timeout');var express=require(_0xd045('0x3'));var router=express[_0xd045('0x4')]();var fs_extra=require(_0xd045('0x5'));var auth=require(_0xd045('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xd045('0x7')](),controller[_0xd045('0x8')]);router[_0xd045('0x9')](_0xd045('0xa'),auth['isAuthenticated'](),controller[_0xd045('0xb')]);router[_0xd045('0x9')](_0xd045('0xc'),auth['isAuthenticated'](),controller[_0xd045('0xd')]);router['post']('/',auth[_0xd045('0x7')](),controller['create']);router[_0xd045('0xe')](_0xd045('0xc'),auth[_0xd045('0x7')](),controller[_0xd045('0xf')]);router[_0xd045('0x10')]('/:id',auth[_0xd045('0x7')](),controller[_0xd045('0x11')]);module[_0xd045('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 148364e..4fec20a 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88de=['/:id/configurations','isAuthenticated','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','show'];(function(_0x254c94,_0x426d62){var _0x55dc4b=function(_0x367305){while(--_0x367305){_0x254c94['push'](_0x254c94['shift']());}};_0x55dc4b(++_0x426d62);}(_0x88de,0xb4));var _0xe88d=function(_0x565a22,_0x2bcd9b){_0x565a22=_0x565a22-0x0;var _0x1fd8ad=_0x88de[_0x565a22];return _0x1fd8ad;};'use strict';var multer=require(_0xe88d('0x0'));var util=require(_0xe88d('0x1'));var path=require('path');var timeout=require(_0xe88d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe88d('0x3'));var interaction=require(_0xe88d('0x4'));var config=require(_0xe88d('0x5'));var controller=require(_0xe88d('0x6'));router[_0xe88d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe88d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe88d('0x8')]);router[_0xe88d('0x7')](_0xe88d('0x9'),auth[_0xe88d('0xa')](),controller['getConfigurations']);router[_0xe88d('0x7')](_0xe88d('0xb'),auth[_0xe88d('0xa')](),controller[_0xe88d('0xc')]);router[_0xe88d('0xd')]('/',auth[_0xe88d('0xa')](),controller['create']);router['post'](_0xe88d('0x9'),auth[_0xe88d('0xa')](),controller[_0xe88d('0xe')]);router[_0xe88d('0xf')](_0xe88d('0x10'),auth[_0xe88d('0xa')](),controller[_0xe88d('0x11')]);router[_0xe88d('0x12')]('/:id',auth[_0xe88d('0xa')](),controller[_0xe88d('0x13')]);module[_0xe88d('0x14')]=router; \ No newline at end of file +var _0x1105=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1105,0x15f));var _0x5110=function(_0x2a17f8,_0x16ccc5){_0x2a17f8=_0x2a17f8-0x0;var _0x1adc15=_0x1105[_0x2a17f8];return _0x1adc15;};'use strict';var multer=require('multer');var util=require(_0x5110('0x0'));var path=require(_0x5110('0x1'));var timeout=require(_0x5110('0x2'));var express=require(_0x5110('0x3'));var router=express[_0x5110('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5110('0x5'));var interaction=require(_0x5110('0x6'));var config=require(_0x5110('0x7'));var controller=require(_0x5110('0x8'));router[_0x5110('0x9')]('/',auth[_0x5110('0xa')](),controller[_0x5110('0xb')]);router[_0x5110('0x9')](_0x5110('0xc'),auth[_0x5110('0xa')](),controller['show']);router[_0x5110('0x9')](_0x5110('0xd'),auth['isAuthenticated'](),controller[_0x5110('0xe')]);router[_0x5110('0x9')](_0x5110('0xf'),auth[_0x5110('0xa')](),controller[_0x5110('0x10')]);router[_0x5110('0x11')]('/',auth[_0x5110('0xa')](),controller[_0x5110('0x12')]);router['post'](_0x5110('0xd'),auth[_0x5110('0xa')](),controller['addConfiguration']);router[_0x5110('0x13')]('/:id',auth[_0x5110('0xa')](),controller[_0x5110('0x14')]);router[_0x5110('0x15')](_0x5110('0xc'),auth['isAuthenticated'](),controller[_0x5110('0x16')]);module[_0x5110('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index df5ae9c..1a73033 100644 --- a/server/api/intDeskAccount/intDeskAccount.attributes.js +++ b/server/api/intDeskAccount/intDeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27fb=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x2f0b82,_0xa07e26){var _0x5d6fb1=function(_0x178f3f){while(--_0x178f3f){_0x2f0b82['push'](_0x2f0b82['shift']());}};_0x5d6fb1(++_0xa07e26);}(_0x27fb,0xe1));var _0xb27f=function(_0xa7e16e,_0x3dffb0){_0xa7e16e=_0xa7e16e-0x0;var _0xd9b0a8=_0x27fb[_0xa7e16e];return _0xd9b0a8;};'use strict';var Sequelize=require(_0xb27f('0x0'));module[_0xb27f('0x1')]={'name':{'type':Sequelize[_0xb27f('0x2')]},'description':{'type':Sequelize[_0xb27f('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb27f('0x2')]},'authType':{'type':Sequelize[_0xb27f('0x3')](_0xb27f('0x4')),'defaultValue':_0xb27f('0x4')},'password':{'type':Sequelize[_0xb27f('0x2')]},'consumerKey':{'type':Sequelize[_0xb27f('0x2')]},'consumerSecret':{'type':Sequelize[_0xb27f('0x2')]},'token':{'type':Sequelize[_0xb27f('0x2')]},'tokenSecret':{'type':Sequelize[_0xb27f('0x2')]},'serverUrl':{'type':Sequelize[_0xb27f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb27f('0x5'),_0xb27f('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xeddf=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xeddf,0x105));var _0xfedd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeddf[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfedd('0x0'));module[_0xfedd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfedd('0x2')]},'username':{'type':Sequelize[_0xfedd('0x2')]},'remoteUri':{'type':Sequelize[_0xfedd('0x2')]},'authType':{'type':Sequelize[_0xfedd('0x3')](_0xfedd('0x4')),'defaultValue':_0xfedd('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xfedd('0x2')]},'consumerSecret':{'type':Sequelize[_0xfedd('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xfedd('0x2')]},'serverUrl':{'type':Sequelize[_0xfedd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfedd('0x3')](_0xfedd('0x5'),_0xfedd('0x6')),'defaultValue':_0xfedd('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1c1023b..147dc86 100644 --- a/server/api/intDeskAccount/intDeskAccount.controller.js +++ b/server/api/intDeskAccount/intDeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b7b=['sort','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','%s/custom_fields','application/json','basic','format','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','mustache','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','DeskAccount','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','rawAttributes','find','create','body','findOne','DeskConfiguration','intersection'];(function(_0x1f89a4,_0x4b8907){var _0x33d4a3=function(_0x399704){while(--_0x399704){_0x1f89a4['push'](_0x1f89a4['shift']());}};_0x33d4a3(++_0x4b8907);}(_0x7b7b,0x91));var _0xb7b7=function(_0x335d2d,_0x26e065){_0x335d2d=_0x335d2d-0x0;var _0x379073=_0x7b7b[_0x335d2d];return _0x379073;};'use strict';var emlformat=require(_0xb7b7('0x0'));var rimraf=require(_0xb7b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7b7('0x2'));var rp=require('request-promise');var moment=require(_0xb7b7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb7b7('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb7b7('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7b7('0x6'));var _=require(_0xb7b7('0x7'));var squel=require(_0xb7b7('0x8'));var crypto=require('crypto');var jsforce=require(_0xb7b7('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb7b7('0xa'));var Papa=require(_0xb7b7('0xb'));var Redis=require('ioredis');var authService=require(_0xb7b7('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb7b7('0xd'));var hardwareService=require(_0xb7b7('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb7b7('0xf'));var db=require(_0xb7b7('0x10'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x48d9ee,_0x52d4a9){_0x52d4a9=_0x52d4a9||0xcc;return function(_0x32afbd){if(_0x32afbd){return _0x48d9ee[_0xb7b7('0x11')](_0x52d4a9);}return _0x48d9ee['status'](_0x52d4a9)[_0xb7b7('0x12')]();};}function respondWithResult(_0x281122,_0xdcb137){_0xdcb137=_0xdcb137||0xc8;return function(_0x226a0b){if(_0x226a0b){return _0x281122[_0xb7b7('0x13')](_0xdcb137)[_0xb7b7('0x14')](_0x226a0b);}};}function respondWithFilteredResult(_0x400c29,_0x3aaa46){return function(_0x53fff0){if(_0x53fff0){var _0x195bb3=typeof _0x3aaa46[_0xb7b7('0x15')]===_0xb7b7('0x16')&&typeof _0x3aaa46[_0xb7b7('0x17')]==='undefined';var _0x5a44fe=_0x53fff0['count'];var _0x44d3d1=_0x195bb3?0x0:_0x3aaa46[_0xb7b7('0x15')];var _0x294b21=_0x195bb3?_0x53fff0['count']:_0x3aaa46[_0xb7b7('0x15')]+_0x3aaa46[_0xb7b7('0x17')];var _0x41f655;if(_0x294b21>=_0x5a44fe){_0x294b21=_0x5a44fe;_0x41f655=0xc8;}else{_0x41f655=0xce;}_0x400c29['status'](_0x41f655);return _0x400c29['set'](_0xb7b7('0x18'),_0x44d3d1+'-'+_0x294b21+'/'+_0x5a44fe)[_0xb7b7('0x14')](_0x53fff0);}return null;};}function patchUpdates(_0x2715df){return function(_0x3f3cab){try{jsonpatch[_0xb7b7('0x19')](_0x3f3cab,_0x2715df,!![]);}catch(_0x2e505b){return BPromise[_0xb7b7('0x1a')](_0x2e505b);}return _0x3f3cab[_0xb7b7('0x1b')]();};}function saveUpdates(_0x4dcc6d,_0x5705aa){return function(_0x41a96d){if(_0x41a96d){return _0x41a96d[_0xb7b7('0x1c')](_0x4dcc6d)[_0xb7b7('0x1d')](function(_0x4ef86c){return _0x4ef86c;});}return null;};}function removeEntity(_0x3ff2b7,_0x1507bc){return function(_0x337b1a){if(_0x337b1a){return _0x337b1a[_0xb7b7('0x1e')]()['then'](function(){_0x3ff2b7[_0xb7b7('0x13')](0xcc)[_0xb7b7('0x12')]();});}};}function handleEntityNotFound(_0x2ed680,_0x286864){return function(_0x580d29){if(!_0x580d29){_0x2ed680[_0xb7b7('0x11')](0x194);}return _0x580d29;};}function handleError(_0x12bb8d,_0x3a6153){_0x3a6153=_0x3a6153||0x1f4;return function(_0x814e12){logger[_0xb7b7('0x1f')](_0x814e12['stack']);if(_0x814e12[_0xb7b7('0x20')]){delete _0x814e12[_0xb7b7('0x20')];}_0x12bb8d['status'](_0x3a6153)['send'](_0x814e12);};}exports[_0xb7b7('0x21')]=function(_0x3a0526,_0x4ea1d1){var _0x25a6d0={},_0x379437={},_0x3a37ed={'count':0x0,'rows':[]};var _0x406217=_[_0xb7b7('0x22')](db[_0xb7b7('0x23')]['rawAttributes'],function(_0xbbfd9d){return{'name':_0xbbfd9d[_0xb7b7('0x24')],'type':_0xbbfd9d[_0xb7b7('0x25')][_0xb7b7('0x26')]};});_0x379437[_0xb7b7('0x27')]=_[_0xb7b7('0x22')](_0x406217,_0xb7b7('0x20'));_0x379437[_0xb7b7('0x28')]=_['keys'](_0x3a0526[_0xb7b7('0x28')]);_0x379437['filters']=_['intersection'](_0x379437['model'],_0x379437['query']);_0x25a6d0[_0xb7b7('0x29')]=_['intersection'](_0x379437['model'],qs['fields'](_0x3a0526[_0xb7b7('0x28')][_0xb7b7('0x2a')]));_0x25a6d0[_0xb7b7('0x29')]=_0x25a6d0[_0xb7b7('0x29')][_0xb7b7('0x2b')]?_0x25a6d0['attributes']:_0x379437['model'];if(!_0x3a0526[_0xb7b7('0x28')][_0xb7b7('0x2c')](_0xb7b7('0x2d'))){_0x25a6d0[_0xb7b7('0x17')]=qs[_0xb7b7('0x17')](_0x3a0526[_0xb7b7('0x28')][_0xb7b7('0x17')]);_0x25a6d0['offset']=qs['offset'](_0x3a0526[_0xb7b7('0x28')][_0xb7b7('0x15')]);}_0x25a6d0[_0xb7b7('0x2e')]=qs['sort'](_0x3a0526[_0xb7b7('0x28')]['sort']);_0x25a6d0[_0xb7b7('0x2f')]=qs['filters'](_['pick'](_0x3a0526['query'],_0x379437[_0xb7b7('0x30')]),_0x406217);if(_0x3a0526[_0xb7b7('0x28')][_0xb7b7('0x31')]){_0x25a6d0[_0xb7b7('0x2f')]=_[_0xb7b7('0x32')](_0x25a6d0[_0xb7b7('0x2f')],{'$or':_[_0xb7b7('0x22')](_0x406217,function(_0x168055){if(_0x168055[_0xb7b7('0x25')]!==_0xb7b7('0x33')){var _0x5c6481={};_0x5c6481[_0x168055[_0xb7b7('0x20')]]={'$like':'%'+_0x3a0526[_0xb7b7('0x28')][_0xb7b7('0x31')]+'%'};return _0x5c6481;}})});}_0x25a6d0=_['merge']({},_0x25a6d0,_0x3a0526[_0xb7b7('0x34')]);var _0x4c7531={'where':_0x25a6d0[_0xb7b7('0x2f')]};return db[_0xb7b7('0x23')]['count'](_0x4c7531)[_0xb7b7('0x1d')](function(_0x31cd40){_0x3a37ed[_0xb7b7('0x35')]=_0x31cd40;if(_0x3a0526[_0xb7b7('0x28')][_0xb7b7('0x36')]){_0x25a6d0['include']=[{'all':!![]}];}return db[_0xb7b7('0x23')]['findAll'](_0x25a6d0);})[_0xb7b7('0x1d')](function(_0x12a648){_0x3a37ed[_0xb7b7('0x37')]=_0x12a648;return _0x3a37ed;})[_0xb7b7('0x1d')](respondWithFilteredResult(_0x4ea1d1,_0x25a6d0))[_0xb7b7('0x38')](handleError(_0x4ea1d1,null));};exports[_0xb7b7('0x39')]=function(_0x134516,_0x8615fa){var _0x3c8103={'raw':![],'where':{'id':_0x134516[_0xb7b7('0x3a')]['id']}},_0x46e21d={};_0x46e21d[_0xb7b7('0x27')]=_[_0xb7b7('0x3b')](db[_0xb7b7('0x23')][_0xb7b7('0x3c')]);_0x46e21d['query']=_[_0xb7b7('0x3b')](_0x134516[_0xb7b7('0x28')]);_0x46e21d[_0xb7b7('0x30')]=_['intersection'](_0x46e21d[_0xb7b7('0x27')],_0x46e21d[_0xb7b7('0x28')]);_0x3c8103[_0xb7b7('0x29')]=_['intersection'](_0x46e21d[_0xb7b7('0x27')],qs[_0xb7b7('0x2a')](_0x134516['query'][_0xb7b7('0x2a')]));_0x3c8103['attributes']=_0x3c8103['attributes']['length']?_0x3c8103[_0xb7b7('0x29')]:_0x46e21d['model'];if(_0x134516['query']['includeAll']){_0x3c8103['include']=[{'all':!![]}];}_0x3c8103=_[_0xb7b7('0x32')]({},_0x3c8103,_0x134516[_0xb7b7('0x34')]);return db[_0xb7b7('0x23')][_0xb7b7('0x3d')](_0x3c8103)['then'](handleEntityNotFound(_0x8615fa,null))[_0xb7b7('0x1d')](respondWithResult(_0x8615fa,null))[_0xb7b7('0x38')](handleError(_0x8615fa,null));};exports['create']=function(_0x56bb88,_0x26b6bd){return db[_0xb7b7('0x23')][_0xb7b7('0x3e')](_0x56bb88['body'],{})[_0xb7b7('0x1d')](respondWithResult(_0x26b6bd,0xc9))[_0xb7b7('0x38')](handleError(_0x26b6bd,null));};exports[_0xb7b7('0x1c')]=function(_0x4c36ce,_0x3cc6e2){if(_0x4c36ce[_0xb7b7('0x3f')]['id']){delete _0x4c36ce['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x4c36ce[_0xb7b7('0x3a')]['id']}})[_0xb7b7('0x1d')](handleEntityNotFound(_0x3cc6e2,null))[_0xb7b7('0x1d')](saveUpdates(_0x4c36ce[_0xb7b7('0x3f')],null))[_0xb7b7('0x1d')](respondWithResult(_0x3cc6e2,null))[_0xb7b7('0x38')](handleError(_0x3cc6e2,null));};exports[_0xb7b7('0x1e')]=function(_0x3b3bac,_0x6358f){return db['DeskAccount'][_0xb7b7('0x3d')]({'where':{'id':_0x3b3bac['params']['id']}})[_0xb7b7('0x1d')](handleEntityNotFound(_0x6358f,null))[_0xb7b7('0x1d')](removeEntity(_0x6358f,null))[_0xb7b7('0x38')](handleError(_0x6358f,null));};exports['getConfigurations']=function(_0xca35b2,_0xd8c4e3,_0x318c9f){var _0x157f0b={};var _0xd2df17={};var _0x48e9a2;var _0x28a531;return db[_0xb7b7('0x23')][_0xb7b7('0x40')]({'where':{'id':_0xca35b2[_0xb7b7('0x3a')]['id']}})[_0xb7b7('0x1d')](handleEntityNotFound(_0xd8c4e3,null))['then'](function(_0x20cdcc){if(_0x20cdcc){_0x48e9a2=_0x20cdcc;_0xd2df17[_0xb7b7('0x27')]=_[_0xb7b7('0x3b')](db[_0xb7b7('0x41')][_0xb7b7('0x3c')]);_0xd2df17[_0xb7b7('0x28')]=_[_0xb7b7('0x3b')](_0xca35b2[_0xb7b7('0x28')]);_0xd2df17[_0xb7b7('0x30')]=_[_0xb7b7('0x42')](_0xd2df17[_0xb7b7('0x27')],_0xd2df17[_0xb7b7('0x28')]);_0x157f0b[_0xb7b7('0x29')]=_[_0xb7b7('0x42')](_0xd2df17[_0xb7b7('0x27')],qs[_0xb7b7('0x2a')](_0xca35b2[_0xb7b7('0x28')][_0xb7b7('0x2a')]));_0x157f0b[_0xb7b7('0x29')]=_0x157f0b['attributes'][_0xb7b7('0x2b')]?_0x157f0b[_0xb7b7('0x29')]:_0xd2df17['model'];_0x157f0b['order']=qs['sort'](_0xca35b2[_0xb7b7('0x28')][_0xb7b7('0x43')]);_0x157f0b[_0xb7b7('0x2f')]=qs['filters'](_['pick'](_0xca35b2[_0xb7b7('0x28')],_0xd2df17[_0xb7b7('0x30')]));if(_0xca35b2['query'][_0xb7b7('0x31')]){_0x157f0b[_0xb7b7('0x2f')]=_[_0xb7b7('0x32')](_0x157f0b['where'],{'$or':_[_0xb7b7('0x22')](_0x157f0b[_0xb7b7('0x29')],function(_0xb116e){var _0x4c80a3={};_0x4c80a3[_0xb116e]={'$like':'%'+_0xca35b2['query']['filter']+'%'};return _0x4c80a3;})});}_0x157f0b=_[_0xb7b7('0x32')]({},_0x157f0b,_0xca35b2[_0xb7b7('0x34')]);return _0x48e9a2[_0xb7b7('0x44')](_0x157f0b);}})[_0xb7b7('0x1d')](function(_0x3f0658){if(_0x3f0658){_0x28a531=_0x3f0658[_0xb7b7('0x2b')];if(!_0xca35b2[_0xb7b7('0x28')]['hasOwnProperty'](_0xb7b7('0x2d'))){_0x157f0b[_0xb7b7('0x17')]=qs[_0xb7b7('0x17')](_0xca35b2['query'][_0xb7b7('0x17')]);_0x157f0b[_0xb7b7('0x15')]=qs[_0xb7b7('0x15')](_0xca35b2['query'][_0xb7b7('0x15')]);}return _0x48e9a2[_0xb7b7('0x44')](_0x157f0b);}})[_0xb7b7('0x1d')](function(_0x511963){if(_0x511963){return _0x511963?{'count':_0x28a531,'rows':_0x511963}:null;}})[_0xb7b7('0x1d')](respondWithResult(_0xd8c4e3,null))[_0xb7b7('0x38')](handleError(_0xd8c4e3,null));};exports[_0xb7b7('0x45')]=function(_0x256183,_0x293f2b,_0x117651){if(_0x256183['body']['id']){delete _0x256183[_0xb7b7('0x3f')]['id'];}return db[_0xb7b7('0x23')][_0xb7b7('0x40')]({'where':{'id':_0x256183['params']['id']}})[_0xb7b7('0x1d')](handleEntityNotFound(_0x293f2b,null))[_0xb7b7('0x1d')](function(_0x37ad38){if(_0x37ad38){_0x256183[_0xb7b7('0x3f')]['AccountId']=_0x37ad38['id'];_0x256183['body'][_0xb7b7('0x46')]=integrations[_0xb7b7('0x47')](_0x256183[_0xb7b7('0x3f')][_0xb7b7('0x48')],_0x256183[_0xb7b7('0x3f')]['type']);_0x256183[_0xb7b7('0x3f')][_0xb7b7('0x49')]=integrations[_0xb7b7('0x4a')](_0x256183[_0xb7b7('0x3f')]['channel'],_0x256183[_0xb7b7('0x3f')][_0xb7b7('0x25')]);return db[_0xb7b7('0x41')][_0xb7b7('0x3e')](_0x256183['body'],{'include':[{'model':db[_0xb7b7('0x4b')],'as':'Subjects'},{'model':db['DeskField'],'as':_0xb7b7('0x49')}]});}return null;})[_0xb7b7('0x1d')](respondWithResult(_0x293f2b,null))[_0xb7b7('0x38')](handleError(_0x293f2b,null));};exports[_0xb7b7('0x4c')]=function(_0x526479,_0x4cf3ea,_0x11ee08){var _0x2b486f=[{'name':_0xb7b7('0x4d'),'label':_0xb7b7('0x4d'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x33f60a='';return db[_0xb7b7('0x23')][_0xb7b7('0x40')]({'where':{'id':_0x526479[_0xb7b7('0x3a')]['id']},'attributes':['id',_0xb7b7('0x4e'),_0xb7b7('0x4f'),_0xb7b7('0x50'),_0xb7b7('0x51'),_0xb7b7('0x52'),'consumerSecret',_0xb7b7('0x53'),_0xb7b7('0x54')]})[_0xb7b7('0x1d')](handleEntityNotFound(_0x4cf3ea,null))[_0xb7b7('0x1d')](function(_0x2e40b4){if(_0x2e40b4){_0x33f60a=_0x2e40b4['remoteUri'];var _0x5865d6=_0x33f60a[_0xb7b7('0x55')](-0x1);if(_0x5865d6==='/'){_0x33f60a=_0x33f60a[_0xb7b7('0x56')](0x0,_0x33f60a[_0xb7b7('0x57')](_0x5865d6));}var _0x39dde4={'method':'GET','uri':util['format'](_0xb7b7('0x58'),_0x33f60a),'headers':{'Content-Type':_0xb7b7('0x59'),'Accept':_0xb7b7('0x59')},'json':!![]};if(_0x2e40b4['authType']===_0xb7b7('0x5a')){_0x39dde4['headers']['Authorization']=util[_0xb7b7('0x5b')](_0xb7b7('0x5c'),new Buffer(util[_0xb7b7('0x5b')](_0xb7b7('0x5d'),_0x2e40b4[_0xb7b7('0x50')],_0x2e40b4[_0xb7b7('0x51')]))[_0xb7b7('0x5e')](_0xb7b7('0x5f')));}return rp(_0x39dde4)['then'](function(_0x45a3fa){return _0x2b486f['concat'](_[_0xb7b7('0x22')](_0x45a3fa[_0xb7b7('0x60')][_0xb7b7('0x61')],function(_0x14d609){return{'id':_0x14d609[_0xb7b7('0x20')],'name':_0x14d609[_0xb7b7('0x20')],'type':_0x14d609[_0xb7b7('0x25')],'active':_0x14d609[_0xb7b7('0x62')],'label':_0x14d609[_0xb7b7('0x63')],'custom':!![]};}));});}})[_0xb7b7('0x1d')](function(_0x20572e){return{'count':_0x20572e[_0xb7b7('0x2b')],'rows':_0x20572e};})[_0xb7b7('0x1d')](respondWithResult(_0x4cf3ea,null))['catch'](function(_0x23a5ed){var _0x4d0164=_0x526479[_0xb7b7('0x28')][_0xb7b7('0x64')]?0x1f4:_0x23a5ed[_0xb7b7('0x65')]||0x1f4;logger['error'](_0xb7b7('0x66'),'getFields',_0x4d0164,JSON[_0xb7b7('0x67')](_0x23a5ed));delete _0x23a5ed[_0xb7b7('0x20')];if(_0x4d0164===0x191){_0x4d0164=0x190;}_0x4cf3ea[_0xb7b7('0x13')](_0x4d0164)[_0xb7b7('0x68')](_0x526479[_0xb7b7('0x28')][_0xb7b7('0x64')]?{'message':_0xb7b7('0x69'),'statusCode':_0x23a5ed[_0xb7b7('0x65')]}:_0x23a5ed);});}; \ No newline at end of file +var _0x5be8=['slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','%s:%s','username','toString','base64','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','rawAttributes','find','create','catch','body','params','findOne','DeskConfiguration','length','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','password','consumerKey','token','tokenSecret'];(function(_0x5f35ed,_0x5a3b58){var _0x3cb587=function(_0xb052a5){while(--_0xb052a5){_0x5f35ed['push'](_0x5f35ed['shift']());}};_0x3cb587(++_0x5a3b58);}(_0x5be8,0x1d0));var _0x85be=function(_0x317f63,_0x34e1eb){_0x317f63=_0x317f63-0x0;var _0x372084=_0x5be8[_0x317f63];return _0x372084;};'use strict';var emlformat=require(_0x85be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x85be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85be('0x2'));var moment=require(_0x85be('0x3'));var BPromise=require(_0x85be('0x4'));var Mustache=require(_0x85be('0x5'));var util=require('util');var path=require(_0x85be('0x6'));var sox=require('sox');var csv=require(_0x85be('0x7'));var ejs=require(_0x85be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85be('0x9'));var squel=require(_0x85be('0xa'));var crypto=require(_0x85be('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x85be('0xc'));var toCsv=require(_0x85be('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x85be('0xd'));var authService=require(_0x85be('0xe'));var qs=require(_0x85be('0xf'));var as=require(_0x85be('0x10'));var hardwareService=require(_0x85be('0x11'));var logger=require(_0x85be('0x12'))(_0x85be('0x13'));var utils=require('../../config/utils');var config=require(_0x85be('0x14'));var licenseUtil=require(_0x85be('0x15'));var db=require(_0x85be('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x20bcb7,_0x345774){_0x345774=_0x345774||0xcc;return function(_0x15765f){if(_0x15765f){return _0x20bcb7['sendStatus'](_0x345774);}return _0x20bcb7[_0x85be('0x17')](_0x345774)[_0x85be('0x18')]();};}function respondWithResult(_0xab7e85,_0xcfd8e6){_0xcfd8e6=_0xcfd8e6||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0xab7e85[_0x85be('0x17')](_0xcfd8e6)[_0x85be('0x19')](_0x47ed1d);}};}function respondWithFilteredResult(_0x34836c,_0x3949eb){return function(_0x3b089c){if(_0x3b089c){var _0x4f9e1e=typeof _0x3949eb[_0x85be('0x1a')]===_0x85be('0x1b')&&typeof _0x3949eb['limit']==='undefined';var _0x46c304=_0x3b089c[_0x85be('0x1c')];var _0x52eeee=_0x4f9e1e?0x0:_0x3949eb['offset'];var _0x3a6065=_0x4f9e1e?_0x3b089c[_0x85be('0x1c')]:_0x3949eb[_0x85be('0x1a')]+_0x3949eb['limit'];var _0x55fd61;if(_0x3a6065>=_0x46c304){_0x3a6065=_0x46c304;_0x55fd61=0xc8;}else{_0x55fd61=0xce;}_0x34836c[_0x85be('0x17')](_0x55fd61);return _0x34836c[_0x85be('0x1d')](_0x85be('0x1e'),_0x52eeee+'-'+_0x3a6065+'/'+_0x46c304)[_0x85be('0x19')](_0x3b089c);}return null;};}function patchUpdates(_0x2f0b26){return function(_0x5b68ca){try{jsonpatch['apply'](_0x5b68ca,_0x2f0b26,!![]);}catch(_0x318516){return BPromise[_0x85be('0x1f')](_0x318516);}return _0x5b68ca['save']();};}function saveUpdates(_0x1db706,_0x49f451){return function(_0xdeec3b){if(_0xdeec3b){return _0xdeec3b[_0x85be('0x20')](_0x1db706)[_0x85be('0x21')](function(_0x4bd383){return _0x4bd383;});}return null;};}function removeEntity(_0x2d094a,_0x501c1c){return function(_0x4f6f52){if(_0x4f6f52){return _0x4f6f52[_0x85be('0x22')]()[_0x85be('0x21')](function(){_0x2d094a['status'](0xcc)[_0x85be('0x18')]();});}};}function handleEntityNotFound(_0x262074,_0x460e22){return function(_0x3b7261){if(!_0x3b7261){_0x262074[_0x85be('0x23')](0x194);}return _0x3b7261;};}function handleError(_0x5de23a,_0x20e3ff){_0x20e3ff=_0x20e3ff||0x1f4;return function(_0x21686a){logger[_0x85be('0x24')](_0x21686a[_0x85be('0x25')]);if(_0x21686a[_0x85be('0x26')]){delete _0x21686a[_0x85be('0x26')];}_0x5de23a[_0x85be('0x17')](_0x20e3ff)[_0x85be('0x27')](_0x21686a);};}exports[_0x85be('0x28')]=function(_0x1b01a1,_0x5b3c64){var _0x2bc057={},_0x1aaa63={},_0x204b12={'count':0x0,'rows':[]};var _0x190025=_[_0x85be('0x29')](db[_0x85be('0x2a')]['rawAttributes'],function(_0x16ffb4){return{'name':_0x16ffb4[_0x85be('0x2b')],'type':_0x16ffb4[_0x85be('0x2c')][_0x85be('0x2d')]};});_0x1aaa63[_0x85be('0x2e')]=_[_0x85be('0x29')](_0x190025,_0x85be('0x26'));_0x1aaa63[_0x85be('0x2f')]=_[_0x85be('0x30')](_0x1b01a1[_0x85be('0x2f')]);_0x1aaa63[_0x85be('0x31')]=_[_0x85be('0x32')](_0x1aaa63[_0x85be('0x2e')],_0x1aaa63['query']);_0x2bc057[_0x85be('0x33')]=_['intersection'](_0x1aaa63['model'],qs[_0x85be('0x34')](_0x1b01a1['query'][_0x85be('0x34')]));_0x2bc057[_0x85be('0x33')]=_0x2bc057[_0x85be('0x33')]['length']?_0x2bc057[_0x85be('0x33')]:_0x1aaa63[_0x85be('0x2e')];if(!_0x1b01a1['query']['hasOwnProperty'](_0x85be('0x35'))){_0x2bc057['limit']=qs[_0x85be('0x36')](_0x1b01a1['query'][_0x85be('0x36')]);_0x2bc057[_0x85be('0x1a')]=qs[_0x85be('0x1a')](_0x1b01a1[_0x85be('0x2f')][_0x85be('0x1a')]);}_0x2bc057[_0x85be('0x37')]=qs[_0x85be('0x38')](_0x1b01a1['query'][_0x85be('0x38')]);_0x2bc057[_0x85be('0x39')]=qs[_0x85be('0x31')](_[_0x85be('0x3a')](_0x1b01a1['query'],_0x1aaa63[_0x85be('0x31')]),_0x190025);if(_0x1b01a1[_0x85be('0x2f')][_0x85be('0x3b')]){_0x2bc057[_0x85be('0x39')]=_[_0x85be('0x3c')](_0x2bc057[_0x85be('0x39')],{'$or':_[_0x85be('0x29')](_0x190025,function(_0x5cf1e0){if(_0x5cf1e0[_0x85be('0x2c')]!=='VIRTUAL'){var _0xe1ab0a={};_0xe1ab0a[_0x5cf1e0[_0x85be('0x26')]]={'$like':'%'+_0x1b01a1[_0x85be('0x2f')][_0x85be('0x3b')]+'%'};return _0xe1ab0a;}})});}_0x2bc057=_[_0x85be('0x3c')]({},_0x2bc057,_0x1b01a1[_0x85be('0x3d')]);var _0x5bee5c={'where':_0x2bc057[_0x85be('0x39')]};return db[_0x85be('0x2a')][_0x85be('0x1c')](_0x5bee5c)[_0x85be('0x21')](function(_0x3c97ca){_0x204b12[_0x85be('0x1c')]=_0x3c97ca;if(_0x1b01a1[_0x85be('0x2f')][_0x85be('0x3e')]){_0x2bc057[_0x85be('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0x85be('0x40')](_0x2bc057);})[_0x85be('0x21')](function(_0x1f0f63){_0x204b12['rows']=_0x1f0f63;return _0x204b12;})[_0x85be('0x21')](respondWithFilteredResult(_0x5b3c64,_0x2bc057))['catch'](handleError(_0x5b3c64,null));};exports[_0x85be('0x41')]=function(_0x322872,_0xf1865d){var _0x3e0a16={'raw':![],'where':{'id':_0x322872['params']['id']}},_0xaebee9={};_0xaebee9[_0x85be('0x2e')]=_[_0x85be('0x30')](db[_0x85be('0x2a')][_0x85be('0x42')]);_0xaebee9['query']=_[_0x85be('0x30')](_0x322872['query']);_0xaebee9['filters']=_[_0x85be('0x32')](_0xaebee9[_0x85be('0x2e')],_0xaebee9['query']);_0x3e0a16[_0x85be('0x33')]=_[_0x85be('0x32')](_0xaebee9[_0x85be('0x2e')],qs[_0x85be('0x34')](_0x322872[_0x85be('0x2f')][_0x85be('0x34')]));_0x3e0a16[_0x85be('0x33')]=_0x3e0a16['attributes']['length']?_0x3e0a16[_0x85be('0x33')]:_0xaebee9[_0x85be('0x2e')];if(_0x322872[_0x85be('0x2f')][_0x85be('0x3e')]){_0x3e0a16[_0x85be('0x3f')]=[{'all':!![]}];}_0x3e0a16=_[_0x85be('0x3c')]({},_0x3e0a16,_0x322872[_0x85be('0x3d')]);return db[_0x85be('0x2a')][_0x85be('0x43')](_0x3e0a16)['then'](handleEntityNotFound(_0xf1865d,null))[_0x85be('0x21')](respondWithResult(_0xf1865d,null))['catch'](handleError(_0xf1865d,null));};exports['create']=function(_0x1571a7,_0x34fece){return db[_0x85be('0x2a')][_0x85be('0x44')](_0x1571a7['body'],{})[_0x85be('0x21')](respondWithResult(_0x34fece,0xc9))[_0x85be('0x45')](handleError(_0x34fece,null));};exports[_0x85be('0x20')]=function(_0x214c74,_0x40e6b0){if(_0x214c74[_0x85be('0x46')]['id']){delete _0x214c74['body']['id'];}return db[_0x85be('0x2a')][_0x85be('0x43')]({'where':{'id':_0x214c74[_0x85be('0x47')]['id']}})[_0x85be('0x21')](handleEntityNotFound(_0x40e6b0,null))[_0x85be('0x21')](saveUpdates(_0x214c74[_0x85be('0x46')],null))['then'](respondWithResult(_0x40e6b0,null))[_0x85be('0x45')](handleError(_0x40e6b0,null));};exports[_0x85be('0x22')]=function(_0x2ab208,_0x183a60){return db[_0x85be('0x2a')]['find']({'where':{'id':_0x2ab208['params']['id']}})[_0x85be('0x21')](handleEntityNotFound(_0x183a60,null))['then'](removeEntity(_0x183a60,null))[_0x85be('0x45')](handleError(_0x183a60,null));};exports['getConfigurations']=function(_0x7e1e6c,_0x592e14,_0x475138){var _0x1e0634={};var _0x413238={};var _0x21deea;var _0x161231;return db[_0x85be('0x2a')][_0x85be('0x48')]({'where':{'id':_0x7e1e6c[_0x85be('0x47')]['id']}})[_0x85be('0x21')](handleEntityNotFound(_0x592e14,null))[_0x85be('0x21')](function(_0x3bca81){if(_0x3bca81){_0x21deea=_0x3bca81;_0x413238[_0x85be('0x2e')]=_[_0x85be('0x30')](db[_0x85be('0x49')][_0x85be('0x42')]);_0x413238[_0x85be('0x2f')]=_[_0x85be('0x30')](_0x7e1e6c[_0x85be('0x2f')]);_0x413238[_0x85be('0x31')]=_[_0x85be('0x32')](_0x413238[_0x85be('0x2e')],_0x413238[_0x85be('0x2f')]);_0x1e0634[_0x85be('0x33')]=_[_0x85be('0x32')](_0x413238[_0x85be('0x2e')],qs[_0x85be('0x34')](_0x7e1e6c[_0x85be('0x2f')][_0x85be('0x34')]));_0x1e0634[_0x85be('0x33')]=_0x1e0634[_0x85be('0x33')][_0x85be('0x4a')]?_0x1e0634[_0x85be('0x33')]:_0x413238[_0x85be('0x2e')];_0x1e0634[_0x85be('0x37')]=qs[_0x85be('0x38')](_0x7e1e6c[_0x85be('0x2f')][_0x85be('0x38')]);_0x1e0634[_0x85be('0x39')]=qs[_0x85be('0x31')](_[_0x85be('0x3a')](_0x7e1e6c['query'],_0x413238[_0x85be('0x31')]));if(_0x7e1e6c[_0x85be('0x2f')][_0x85be('0x3b')]){_0x1e0634[_0x85be('0x39')]=_[_0x85be('0x3c')](_0x1e0634['where'],{'$or':_['map'](_0x1e0634[_0x85be('0x33')],function(_0x10e591){var _0x2a0a62={};_0x2a0a62[_0x10e591]={'$like':'%'+_0x7e1e6c[_0x85be('0x2f')]['filter']+'%'};return _0x2a0a62;})});}_0x1e0634=_['merge']({},_0x1e0634,_0x7e1e6c[_0x85be('0x3d')]);return _0x21deea[_0x85be('0x4b')](_0x1e0634);}})['then'](function(_0x409f25){if(_0x409f25){_0x161231=_0x409f25['length'];if(!_0x7e1e6c[_0x85be('0x2f')][_0x85be('0x4c')]('nolimit')){_0x1e0634[_0x85be('0x36')]=qs[_0x85be('0x36')](_0x7e1e6c[_0x85be('0x2f')]['limit']);_0x1e0634['offset']=qs[_0x85be('0x1a')](_0x7e1e6c[_0x85be('0x2f')][_0x85be('0x1a')]);}return _0x21deea['getConfigurations'](_0x1e0634);}})['then'](function(_0x461aca){if(_0x461aca){return _0x461aca?{'count':_0x161231,'rows':_0x461aca}:null;}})[_0x85be('0x21')](respondWithResult(_0x592e14,null))['catch'](handleError(_0x592e14,null));};exports[_0x85be('0x4d')]=function(_0x4a859f,_0x5dac50,_0x1dc278){if(_0x4a859f[_0x85be('0x46')]['id']){delete _0x4a859f[_0x85be('0x46')]['id'];}return db[_0x85be('0x2a')][_0x85be('0x48')]({'where':{'id':_0x4a859f['params']['id']}})[_0x85be('0x21')](handleEntityNotFound(_0x5dac50,null))[_0x85be('0x21')](function(_0x34a3e3){if(_0x34a3e3){_0x4a859f[_0x85be('0x46')]['AccountId']=_0x34a3e3['id'];_0x4a859f[_0x85be('0x46')][_0x85be('0x4e')]=integrations[_0x85be('0x4f')](_0x4a859f[_0x85be('0x46')][_0x85be('0x50')],_0x4a859f[_0x85be('0x46')][_0x85be('0x2c')]);_0x4a859f[_0x85be('0x46')]['Descriptions']=integrations['getDescriptions'](_0x4a859f[_0x85be('0x46')]['channel'],_0x4a859f[_0x85be('0x46')]['type']);return db[_0x85be('0x49')]['create'](_0x4a859f[_0x85be('0x46')],{'include':[{'model':db[_0x85be('0x51')],'as':'Subjects'},{'model':db[_0x85be('0x51')],'as':_0x85be('0x52')}]});}return null;})[_0x85be('0x21')](respondWithResult(_0x5dac50,null))[_0x85be('0x45')](handleError(_0x5dac50,null));};exports[_0x85be('0x53')]=function(_0x336dbe,_0x646b7,_0x40feba){var _0xb74e3b=[{'name':'priority','label':_0x85be('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2e9dd1='';return db['DeskAccount'][_0x85be('0x48')]({'where':{'id':_0x336dbe['params']['id']},'attributes':['id',_0x85be('0x55'),_0x85be('0x56'),'username',_0x85be('0x57'),_0x85be('0x58'),'consumerSecret',_0x85be('0x59'),_0x85be('0x5a')]})[_0x85be('0x21')](handleEntityNotFound(_0x646b7,null))[_0x85be('0x21')](function(_0x3d3eaa){if(_0x3d3eaa){_0x2e9dd1=_0x3d3eaa[_0x85be('0x55')];var _0x3ffb68=_0x2e9dd1[_0x85be('0x5b')](-0x1);if(_0x3ffb68==='/'){_0x2e9dd1=_0x2e9dd1[_0x85be('0x5c')](0x0,_0x2e9dd1[_0x85be('0x5d')](_0x3ffb68));}var _0x346ac5={'method':_0x85be('0x5e'),'uri':util[_0x85be('0x5f')](_0x85be('0x60'),_0x2e9dd1),'headers':{'Content-Type':_0x85be('0x61'),'Accept':_0x85be('0x61')},'json':!![]};if(_0x3d3eaa['authType']===_0x85be('0x62')){_0x346ac5['headers'][_0x85be('0x63')]=util[_0x85be('0x5f')]('Basic\x20%s',new Buffer(util[_0x85be('0x5f')](_0x85be('0x64'),_0x3d3eaa[_0x85be('0x65')],_0x3d3eaa[_0x85be('0x57')]))[_0x85be('0x66')](_0x85be('0x67')));}return rp(_0x346ac5)[_0x85be('0x21')](function(_0x2a4d0c){return _0xb74e3b['concat'](_[_0x85be('0x29')](_0x2a4d0c['_embedded'][_0x85be('0x68')],function(_0x346281){return{'id':_0x346281[_0x85be('0x26')],'name':_0x346281['name'],'type':_0x346281[_0x85be('0x2c')],'active':_0x346281[_0x85be('0x69')],'label':_0x346281[_0x85be('0x6a')],'custom':!![]};}));});}})[_0x85be('0x21')](function(_0x5120e4){return{'count':_0x5120e4[_0x85be('0x4a')],'rows':_0x5120e4};})['then'](respondWithResult(_0x646b7,null))[_0x85be('0x45')](function(_0x4f8295){var _0x34b9d6=_0x336dbe[_0x85be('0x2f')]['test']?0x1f4:_0x4f8295[_0x85be('0x6b')]||0x1f4;logger[_0x85be('0x24')](_0x85be('0x6c'),'getFields',_0x34b9d6,JSON[_0x85be('0x6d')](_0x4f8295));delete _0x4f8295[_0x85be('0x26')];if(_0x34b9d6===0x191){_0x34b9d6=0x190;}_0x646b7[_0x85be('0x17')](_0x34b9d6)[_0x85be('0x27')](_0x336dbe[_0x85be('0x2f')][_0x85be('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x4f8295[_0x85be('0x6b')]}:_0x4f8295);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index af71faa..bce7887 100644 --- a/server/api/intDeskAccount/intDeskAccount.model.js +++ b/server/api/intDeskAccount/intDeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21fa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x21fa,0x19d));var _0xa21f=function(_0x3ae1f5,_0x569fcc){_0x3ae1f5=_0x3ae1f5-0x0;var _0x445f06=_0x21fa[_0x3ae1f5];return _0x445f06;};'use strict';var _=require(_0xa21f('0x0'));var util=require(_0xa21f('0x1'));var logger=require(_0xa21f('0x2'))('api');var moment=require(_0xa21f('0x3'));var BPromise=require(_0xa21f('0x4'));var rp=require(_0xa21f('0x5'));var fs=require('fs');var path=require(_0xa21f('0x6'));var rimraf=require(_0xa21f('0x7'));var config=require(_0xa21f('0x8'));var attributes=require(_0xa21f('0x9'));var integrations=require(_0xa21f('0xa'));module['exports']=function(_0x3cae47,_0xd50e38){return _0x3cae47[_0xa21f('0xb')]('DeskAccount',attributes,{'tableName':_0xa21f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc780=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','../../config/logger','api','moment','bluebird'];(function(_0x5b5869,_0x9f5fc2){var _0x56cbcd=function(_0xd584c6){while(--_0xd584c6){_0x5b5869['push'](_0x5b5869['shift']());}};_0x56cbcd(++_0x9f5fc2);}(_0xc780,0x127));var _0x0c78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc780[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c78('0x0'))(_0x0c78('0x1'));var moment=require(_0x0c78('0x2'));var BPromise=require(_0x0c78('0x3'));var rp=require(_0x0c78('0x4'));var fs=require('fs');var path=require(_0x0c78('0x5'));var rimraf=require(_0x0c78('0x6'));var config=require(_0x0c78('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x0c78('0x8'));module[_0x0c78('0x9')]=function(_0x493cc0,_0x5c85e3){return _0x493cc0[_0x0c78('0xa')](_0x0c78('0xb'),attributes,{'tableName':_0x0c78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 90ad4ee..b6e00d7 100644 --- a/server/api/intDeskAccount/intDeskAccount.rpc.js +++ b/server/api/intDeskAccount/intDeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35e0=['then','DeskAccount,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowDeskAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x4ccd63,_0x16efa0){var _0x19e206=function(_0x30f418){while(--_0x30f418){_0x4ccd63['push'](_0x4ccd63['shift']());}};_0x19e206(++_0x16efa0);}(_0x35e0,0x7c));var _0x035e=function(_0x4c7e3f,_0x13a8cb){_0x4c7e3f=_0x4c7e3f-0x0;var _0x3ea783=_0x35e0[_0x4c7e3f];return _0x3ea783;};'use strict';var _=require(_0x035e('0x0'));var util=require(_0x035e('0x1'));var moment=require(_0x035e('0x2'));var BPromise=require(_0x035e('0x3'));var rs=require(_0x035e('0x4'));var fs=require('fs');var Redis=require(_0x035e('0x5'));var db=require(_0x035e('0x6'))['db'];var utils=require(_0x035e('0x7'));var logger=require(_0x035e('0x8'))('rpc');var config=require(_0x035e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x035e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34a491,_0x1c5871,_0x128637){return new BPromise(function(_0x1246bf,_0x3aa90c){return client[_0x035e('0xb')](_0x34a491,_0x128637)[_0x035e('0xc')](function(_0x96238d){logger['info'](_0x035e('0xd'),_0x1c5871,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1c5871,'request\x20sent',JSON[_0x035e('0xe')](_0x96238d));if(_0x96238d['error']){if(_0x96238d[_0x035e('0xf')]['code']===0x1f4){logger[_0x035e('0xf')](_0x035e('0xd'),_0x1c5871,_0x96238d[_0x035e('0xf')][_0x035e('0x10')]);return _0x3aa90c(_0x96238d[_0x035e('0xf')]['message']);}logger[_0x035e('0xf')](_0x035e('0xd'),_0x1c5871,_0x96238d['error'][_0x035e('0x10')]);return _0x1246bf(_0x96238d[_0x035e('0xf')][_0x035e('0x10')]);}else{logger[_0x035e('0x11')](_0x035e('0xd'),_0x1c5871,_0x035e('0x12'));_0x1246bf(_0x96238d[_0x035e('0x13')][_0x035e('0x10')]);}})[_0x035e('0x14')](function(_0x143cce){logger['error']('DeskAccount,\x20%s,\x20%s',_0x1c5871,_0x143cce);_0x3aa90c(_0x143cce);});});}exports[_0x035e('0x15')]=function(_0x34e3f6){var _0x26bbc6=this;return new Promise(function(_0x553472,_0x228733){return db[_0x035e('0x16')][_0x035e('0x17')]({'raw':_0x34e3f6[_0x035e('0x18')]?_0x34e3f6['options'][_0x035e('0x19')]===undefined?!![]:![]:!![],'where':_0x34e3f6[_0x035e('0x18')]?_0x34e3f6[_0x035e('0x18')][_0x035e('0x1a')]||null:null,'attributes':_0x34e3f6[_0x035e('0x18')]?_0x34e3f6['options'][_0x035e('0x1b')]||null:null,'limit':_0x34e3f6['options']?_0x34e3f6[_0x035e('0x18')]['limit']||null:null,'include':_0x34e3f6['options']?_0x34e3f6[_0x035e('0x18')][_0x035e('0x1c')]?_['map'](_0x34e3f6[_0x035e('0x18')]['include'],function(_0x5b082c){return{'model':db[_0x5b082c['model']],'as':_0x5b082c['as'],'attributes':_0x5b082c['attributes'],'include':_0x5b082c[_0x035e('0x1c')]?_[_0x035e('0x1d')](_0x5b082c[_0x035e('0x1c')],function(_0x5c1572){return{'model':db[_0x5c1572[_0x035e('0x1e')]],'as':_0x5c1572['as'],'attributes':_0x5c1572[_0x035e('0x1b')],'include':_0x5c1572[_0x035e('0x1c')]?_['map'](_0x5c1572[_0x035e('0x1c')],function(_0x1d30aa){return{'model':db[_0x1d30aa['model']],'as':_0x1d30aa['as'],'attributes':_0x1d30aa['attributes']};}):[]};}):[]};}):[]:[]})[_0x035e('0xc')](function(_0x394117){logger[_0x035e('0x11')](_0x035e('0x15'),_0x34e3f6);logger['debug'](_0x035e('0x15'),_0x34e3f6,JSON['stringify'](_0x394117));_0x553472(_0x394117);})['catch'](function(_0x1de844){logger[_0x035e('0xf')](_0x035e('0x15'),_0x1de844[_0x035e('0x10')],_0x34e3f6);_0x228733(_0x26bbc6[_0x035e('0xf')](0x1f4,_0x1de844[_0x035e('0x10')]));});});};exports[_0x035e('0x1f')]=function(_0x1505ef){var _0x37eaa0=this;return new Promise(function(_0x50ed02,_0x5b0bf6){return db[_0x035e('0x16')][_0x035e('0x20')]({'raw':_0x1505ef['options']?_0x1505ef['options'][_0x035e('0x19')]===undefined?!![]:![]:!![],'where':_0x1505ef[_0x035e('0x18')]?_0x1505ef[_0x035e('0x18')][_0x035e('0x1a')]||null:null,'attributes':_0x1505ef['options']?_0x1505ef[_0x035e('0x18')][_0x035e('0x1b')]||null:null,'include':_0x1505ef[_0x035e('0x18')]?_0x1505ef[_0x035e('0x18')][_0x035e('0x1c')]?_['map'](_0x1505ef['options']['include'],function(_0x2ada09){return{'model':db[_0x2ada09[_0x035e('0x1e')]],'as':_0x2ada09['as'],'attributes':_0x2ada09['attributes'],'include':_0x2ada09[_0x035e('0x1c')]?_[_0x035e('0x1d')](_0x2ada09[_0x035e('0x1c')],function(_0x337c7e){return{'model':db[_0x337c7e['model']],'as':_0x337c7e['as'],'attributes':_0x337c7e[_0x035e('0x1b')],'include':_0x337c7e[_0x035e('0x1c')]?_[_0x035e('0x1d')](_0x337c7e[_0x035e('0x1c')],function(_0x3abe05){return{'model':db[_0x3abe05[_0x035e('0x1e')]],'as':_0x3abe05['as'],'attributes':_0x3abe05['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x598718){logger[_0x035e('0x11')]('ShowDeskAccount',_0x1505ef);logger[_0x035e('0x21')](_0x035e('0x1f'),_0x1505ef,JSON[_0x035e('0xe')](_0x598718));_0x50ed02(_0x598718);})[_0x035e('0x14')](function(_0x21ac72){logger[_0x035e('0xf')](_0x035e('0x1f'),_0x21ac72['message'],_0x1505ef);_0x5b0bf6(_0x37eaa0[_0x035e('0xf')](0x1f4,_0x21ac72['message']));});});}; \ No newline at end of file +var _0x2402=['result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowDeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x666cc6,_0x53441b){var _0x4e6d1d=function(_0x1b26bb){while(--_0x1b26bb){_0x666cc6['push'](_0x666cc6['shift']());}};_0x4e6d1d(++_0x53441b);}(_0x2402,0x1ca));var _0x2240=function(_0x26c266,_0x325fd8){_0x26c266=_0x26c266-0x0;var _0x5b7ca0=_0x2402[_0x26c266];return _0x5b7ca0;};'use strict';var _=require(_0x2240('0x0'));var util=require('util');var moment=require(_0x2240('0x1'));var BPromise=require(_0x2240('0x2'));var rs=require(_0x2240('0x3'));var fs=require('fs');var Redis=require(_0x2240('0x4'));var db=require(_0x2240('0x5'))['db'];var utils=require(_0x2240('0x6'));var logger=require(_0x2240('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2240('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ce363,_0xb7dd54,_0x4a67a7){return new BPromise(function(_0x315458,_0x5509f0){return client[_0x2240('0x9')](_0x5ce363,_0x4a67a7)['then'](function(_0x3f64bc){logger[_0x2240('0xa')](_0x2240('0xb'),_0xb7dd54,_0x2240('0xc'));logger[_0x2240('0xd')](_0x2240('0xe'),_0xb7dd54,_0x2240('0xc'),JSON[_0x2240('0xf')](_0x3f64bc));if(_0x3f64bc[_0x2240('0x10')]){if(_0x3f64bc[_0x2240('0x10')]['code']===0x1f4){logger[_0x2240('0x10')](_0x2240('0xb'),_0xb7dd54,_0x3f64bc[_0x2240('0x10')][_0x2240('0x11')]);return _0x5509f0(_0x3f64bc[_0x2240('0x10')][_0x2240('0x11')]);}logger[_0x2240('0x10')]('DeskAccount,\x20%s,\x20%s',_0xb7dd54,_0x3f64bc[_0x2240('0x10')]['message']);return _0x315458(_0x3f64bc['error'][_0x2240('0x11')]);}else{logger[_0x2240('0xa')](_0x2240('0xb'),_0xb7dd54,_0x2240('0xc'));_0x315458(_0x3f64bc[_0x2240('0x12')][_0x2240('0x11')]);}})[_0x2240('0x13')](function(_0x42d49d){logger[_0x2240('0x10')]('DeskAccount,\x20%s,\x20%s',_0xb7dd54,_0x42d49d);_0x5509f0(_0x42d49d);});});}exports[_0x2240('0x14')]=function(_0x521a49){var _0x485ab=this;return new Promise(function(_0x52e135,_0x4eacfb){return db[_0x2240('0x15')][_0x2240('0x16')]({'raw':_0x521a49[_0x2240('0x17')]?_0x521a49[_0x2240('0x17')][_0x2240('0x18')]===undefined?!![]:![]:!![],'where':_0x521a49[_0x2240('0x17')]?_0x521a49[_0x2240('0x17')][_0x2240('0x19')]||null:null,'attributes':_0x521a49[_0x2240('0x17')]?_0x521a49[_0x2240('0x17')][_0x2240('0x1a')]||null:null,'limit':_0x521a49['options']?_0x521a49['options'][_0x2240('0x1b')]||null:null,'include':_0x521a49['options']?_0x521a49[_0x2240('0x17')]['include']?_[_0x2240('0x1c')](_0x521a49['options']['include'],function(_0x2c16b3){return{'model':db[_0x2c16b3['model']],'as':_0x2c16b3['as'],'attributes':_0x2c16b3[_0x2240('0x1a')],'include':_0x2c16b3[_0x2240('0x1d')]?_['map'](_0x2c16b3[_0x2240('0x1d')],function(_0x34c97b){return{'model':db[_0x34c97b['model']],'as':_0x34c97b['as'],'attributes':_0x34c97b[_0x2240('0x1a')],'include':_0x34c97b['include']?_[_0x2240('0x1c')](_0x34c97b[_0x2240('0x1d')],function(_0x5eace9){return{'model':db[_0x5eace9[_0x2240('0x1e')]],'as':_0x5eace9['as'],'attributes':_0x5eace9[_0x2240('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2240('0x1f')](function(_0x20b905){logger[_0x2240('0xa')](_0x2240('0x14'),_0x521a49);logger['debug'](_0x2240('0x14'),_0x521a49,JSON[_0x2240('0xf')](_0x20b905));_0x52e135(_0x20b905);})[_0x2240('0x13')](function(_0x55a2f0){logger['error'](_0x2240('0x14'),_0x55a2f0[_0x2240('0x11')],_0x521a49);_0x4eacfb(_0x485ab['error'](0x1f4,_0x55a2f0['message']));});});};exports[_0x2240('0x20')]=function(_0x364cd1){var _0x4270ad=this;return new Promise(function(_0x36618f,_0x185dc3){return db[_0x2240('0x15')][_0x2240('0x21')]({'raw':_0x364cd1[_0x2240('0x17')]?_0x364cd1[_0x2240('0x17')][_0x2240('0x18')]===undefined?!![]:![]:!![],'where':_0x364cd1[_0x2240('0x17')]?_0x364cd1[_0x2240('0x17')][_0x2240('0x19')]||null:null,'attributes':_0x364cd1[_0x2240('0x17')]?_0x364cd1[_0x2240('0x17')][_0x2240('0x1a')]||null:null,'include':_0x364cd1[_0x2240('0x17')]?_0x364cd1[_0x2240('0x17')][_0x2240('0x1d')]?_[_0x2240('0x1c')](_0x364cd1[_0x2240('0x17')][_0x2240('0x1d')],function(_0x3f6141){return{'model':db[_0x3f6141['model']],'as':_0x3f6141['as'],'attributes':_0x3f6141['attributes'],'include':_0x3f6141[_0x2240('0x1d')]?_[_0x2240('0x1c')](_0x3f6141[_0x2240('0x1d')],function(_0x37c16d){return{'model':db[_0x37c16d[_0x2240('0x1e')]],'as':_0x37c16d['as'],'attributes':_0x37c16d[_0x2240('0x1a')],'include':_0x37c16d[_0x2240('0x1d')]?_[_0x2240('0x1c')](_0x37c16d['include'],function(_0x25e172){return{'model':db[_0x25e172[_0x2240('0x1e')]],'as':_0x25e172['as'],'attributes':_0x25e172[_0x2240('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2240('0x1f')](function(_0x8a7f0a){logger['info'](_0x2240('0x20'),_0x364cd1);logger[_0x2240('0xd')](_0x2240('0x20'),_0x364cd1,JSON[_0x2240('0xf')](_0x8a7f0a));_0x36618f(_0x8a7f0a);})['catch'](function(_0x4295b8){logger[_0x2240('0x10')]('ShowDeskAccount',_0x4295b8[_0x2240('0x11')],_0x364cd1);_0x185dc3(_0x4270ad[_0x2240('0x10')](0x1f4,_0x4295b8['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 42bec84..45df959 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x55ca,0x126));var _0xa55c=function(_0x2f8805,_0x2f1d21){_0x2f8805=_0x2f8805-0x0;var _0xa16375=_0x55ca[_0x2f8805];return _0xa16375;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x242cdb,_0xfe5636){var _0x35708b=function(_0x29e287){while(--_0x29e287){_0x242cdb['push'](_0x242cdb['shift']());}};_0x35708b(++_0xfe5636);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 5ac3b1d..0de3ea8 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x300e=['sequelize','STRING'];(function(_0x3167a8,_0x4d5006){var _0x20073f=function(_0x5b7216){while(--_0x5b7216){_0x3167a8['push'](_0x3167a8['shift']());}};_0x20073f(++_0x4d5006);}(_0x300e,0x102));var _0xe300=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x300e[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0xe300('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe300('0x1')]}}; \ No newline at end of file +var _0xc5e8=['STRING','sequelize','exports'];(function(_0x2a2124,_0xd3f9b9){var _0x31d53c=function(_0x45db7e){while(--_0x45db7e){_0x2a2124['push'](_0x2a2124['shift']());}};_0x31d53c(++_0xd3f9b9);}(_0xc5e8,0x18d));var _0x8c5e=function(_0x4fcca7,_0x2f7f74){_0x4fcca7=_0x4fcca7-0x0;var _0x28ef84=_0xc5e8[_0x4fcca7];return _0x28ef84;};'use strict';var Sequelize=require(_0x8c5e('0x0'));module[_0x8c5e('0x1')]={'name':{'type':Sequelize[_0x8c5e('0x2')]},'description':{'type':Sequelize[_0x8c5e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index be1229f..c5defcd 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7101=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','show','rawAttributes','include','find','create','catch','update','body','params','getFields','findOne','DeskField','order','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','name','send','map','DeskConfiguration'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7101,0xca));var _0x1710=function(_0x1b68ba,_0x23687a){_0x1b68ba=_0x1b68ba-0x0;var _0xf49b11=_0x7101[_0x1b68ba];return _0xf49b11;};'use strict';var emlformat=require(_0x1710('0x0'));var rimraf=require(_0x1710('0x1'));var zipdir=require(_0x1710('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1710('0x3'));var moment=require(_0x1710('0x4'));var BPromise=require(_0x1710('0x5'));var Mustache=require(_0x1710('0x6'));var util=require(_0x1710('0x7'));var path=require(_0x1710('0x8'));var sox=require(_0x1710('0x9'));var csv=require(_0x1710('0xa'));var ejs=require(_0x1710('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1710('0xc'));var squel=require(_0x1710('0xd'));var crypto=require(_0x1710('0xe'));var jsforce=require(_0x1710('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1710('0xa'));var querystring=require(_0x1710('0x10'));var Papa=require(_0x1710('0x11'));var Redis=require(_0x1710('0x12'));var authService=require(_0x1710('0x13'));var qs=require(_0x1710('0x14'));var as=require(_0x1710('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1710('0x16'))(_0x1710('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1710('0x18'))['db'];function respondWithStatusCode(_0x439f01,_0x6e4c2e){_0x6e4c2e=_0x6e4c2e||0xcc;return function(_0x241ad8){if(_0x241ad8){return _0x439f01[_0x1710('0x19')](_0x6e4c2e);}return _0x439f01[_0x1710('0x1a')](_0x6e4c2e)[_0x1710('0x1b')]();};}function respondWithResult(_0x3e8a4e,_0x112aec){_0x112aec=_0x112aec||0xc8;return function(_0x5e86c8){if(_0x5e86c8){return _0x3e8a4e[_0x1710('0x1a')](_0x112aec)[_0x1710('0x1c')](_0x5e86c8);}};}function respondWithFilteredResult(_0xf3f52e,_0x368cf0){return function(_0x234d63){if(_0x234d63){var _0x28640b=typeof _0x368cf0['offset']===_0x1710('0x1d')&&typeof _0x368cf0[_0x1710('0x1e')]===_0x1710('0x1d');var _0x1a8b1d=_0x234d63[_0x1710('0x1f')];var _0x3cd825=_0x28640b?0x0:_0x368cf0[_0x1710('0x20')];var _0x36e43b=_0x28640b?_0x234d63['count']:_0x368cf0[_0x1710('0x20')]+_0x368cf0[_0x1710('0x1e')];var _0x4cfc2b;if(_0x36e43b>=_0x1a8b1d){_0x36e43b=_0x1a8b1d;_0x4cfc2b=0xc8;}else{_0x4cfc2b=0xce;}_0xf3f52e['status'](_0x4cfc2b);return _0xf3f52e[_0x1710('0x21')](_0x1710('0x22'),_0x3cd825+'-'+_0x36e43b+'/'+_0x1a8b1d)['json'](_0x234d63);}return null;};}function patchUpdates(_0x40e6e0){return function(_0x497621){try{jsonpatch[_0x1710('0x23')](_0x497621,_0x40e6e0,!![]);}catch(_0x1b7c8a){return BPromise[_0x1710('0x24')](_0x1b7c8a);}return _0x497621[_0x1710('0x25')]();};}function saveUpdates(_0x4d49ac,_0x317403){return function(_0x442fbe){if(_0x442fbe){return _0x442fbe['update'](_0x4d49ac)[_0x1710('0x26')](function(_0x54bf88){return _0x54bf88;});}return null;};}function removeEntity(_0x3d05c2,_0x5a537c){return function(_0x496fe7){if(_0x496fe7){return _0x496fe7[_0x1710('0x27')]()[_0x1710('0x26')](function(){_0x3d05c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x236bb5,_0x4915a5){return function(_0x38f330){if(!_0x38f330){_0x236bb5[_0x1710('0x19')](0x194);}return _0x38f330;};}function handleError(_0x2a0874,_0x3a6bdb){_0x3a6bdb=_0x3a6bdb||0x1f4;return function(_0x4b4429){logger['error'](_0x4b4429['stack']);if(_0x4b4429[_0x1710('0x28')]){delete _0x4b4429[_0x1710('0x28')];}_0x2a0874[_0x1710('0x1a')](_0x3a6bdb)[_0x1710('0x29')](_0x4b4429);};}exports['index']=function(_0x474889,_0x553595){var _0x542951={},_0x50d877={},_0x26a89b={'count':0x0,'rows':[]};var _0x1f6751=_[_0x1710('0x2a')](db[_0x1710('0x2b')]['rawAttributes'],function(_0x1e6a0d){return{'name':_0x1e6a0d[_0x1710('0x2c')],'type':_0x1e6a0d[_0x1710('0x2d')]['key']};});_0x50d877[_0x1710('0x2e')]=_[_0x1710('0x2a')](_0x1f6751,'name');_0x50d877[_0x1710('0x2f')]=_[_0x1710('0x30')](_0x474889[_0x1710('0x2f')]);_0x50d877[_0x1710('0x31')]=_[_0x1710('0x32')](_0x50d877[_0x1710('0x2e')],_0x50d877[_0x1710('0x2f')]);_0x542951[_0x1710('0x33')]=_[_0x1710('0x32')](_0x50d877[_0x1710('0x2e')],qs[_0x1710('0x34')](_0x474889['query'][_0x1710('0x34')]));_0x542951[_0x1710('0x33')]=_0x542951[_0x1710('0x33')][_0x1710('0x35')]?_0x542951[_0x1710('0x33')]:_0x50d877['model'];if(!_0x474889[_0x1710('0x2f')][_0x1710('0x36')](_0x1710('0x37'))){_0x542951[_0x1710('0x1e')]=qs[_0x1710('0x1e')](_0x474889[_0x1710('0x2f')][_0x1710('0x1e')]);_0x542951[_0x1710('0x20')]=qs[_0x1710('0x20')](_0x474889['query'][_0x1710('0x20')]);}_0x542951['order']=qs[_0x1710('0x38')](_0x474889[_0x1710('0x2f')]['sort']);_0x542951[_0x1710('0x39')]=qs[_0x1710('0x31')](_[_0x1710('0x3a')](_0x474889['query'],_0x50d877['filters']),_0x1f6751);if(_0x474889[_0x1710('0x2f')][_0x1710('0x3b')]){_0x542951[_0x1710('0x39')]=_['merge'](_0x542951[_0x1710('0x39')],{'$or':_['map'](_0x1f6751,function(_0x110902){if(_0x110902['type']!=='VIRTUAL'){var _0x1e663b={};_0x1e663b[_0x110902[_0x1710('0x28')]]={'$like':'%'+_0x474889[_0x1710('0x2f')][_0x1710('0x3b')]+'%'};return _0x1e663b;}})});}_0x542951=_[_0x1710('0x3c')]({},_0x542951,_0x474889[_0x1710('0x3d')]);var _0x13cb07={'where':_0x542951[_0x1710('0x39')]};return db[_0x1710('0x2b')]['count'](_0x13cb07)[_0x1710('0x26')](function(_0xc8f6af){_0x26a89b['count']=_0xc8f6af;if(_0x474889['query'][_0x1710('0x3e')]){_0x542951['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x542951);})[_0x1710('0x26')](function(_0x4798b3){_0x26a89b[_0x1710('0x3f')]=_0x4798b3;return _0x26a89b;})[_0x1710('0x26')](respondWithFilteredResult(_0x553595,_0x542951))['catch'](handleError(_0x553595,null));};exports[_0x1710('0x40')]=function(_0x5aa492,_0x58298b){var _0x481bd1={'raw':![],'where':{'id':_0x5aa492['params']['id']}},_0x19b518={};_0x19b518[_0x1710('0x2e')]=_[_0x1710('0x30')](db[_0x1710('0x2b')][_0x1710('0x41')]);_0x19b518[_0x1710('0x2f')]=_[_0x1710('0x30')](_0x5aa492['query']);_0x19b518[_0x1710('0x31')]=_['intersection'](_0x19b518[_0x1710('0x2e')],_0x19b518[_0x1710('0x2f')]);_0x481bd1[_0x1710('0x33')]=_[_0x1710('0x32')](_0x19b518[_0x1710('0x2e')],qs[_0x1710('0x34')](_0x5aa492[_0x1710('0x2f')][_0x1710('0x34')]));_0x481bd1[_0x1710('0x33')]=_0x481bd1[_0x1710('0x33')][_0x1710('0x35')]?_0x481bd1[_0x1710('0x33')]:_0x19b518[_0x1710('0x2e')];if(_0x5aa492[_0x1710('0x2f')][_0x1710('0x3e')]){_0x481bd1[_0x1710('0x42')]=[{'all':!![]}];}_0x481bd1=_[_0x1710('0x3c')]({},_0x481bd1,_0x5aa492['options']);return db[_0x1710('0x2b')][_0x1710('0x43')](_0x481bd1)['then'](handleEntityNotFound(_0x58298b,null))['then'](respondWithResult(_0x58298b,null))['catch'](handleError(_0x58298b,null));};exports[_0x1710('0x44')]=function(_0x2ef986,_0x560162){return db[_0x1710('0x2b')][_0x1710('0x44')](_0x2ef986['body'],{})[_0x1710('0x26')](respondWithResult(_0x560162,0xc9))[_0x1710('0x45')](handleError(_0x560162,null));};exports[_0x1710('0x46')]=function(_0x5f0691,_0x12af96){if(_0x5f0691[_0x1710('0x47')]['id']){delete _0x5f0691[_0x1710('0x47')]['id'];}return db['DeskConfiguration'][_0x1710('0x43')]({'where':{'id':_0x5f0691[_0x1710('0x48')]['id']}})['then'](handleEntityNotFound(_0x12af96,null))[_0x1710('0x26')](saveUpdates(_0x5f0691['body'],null))[_0x1710('0x26')](respondWithResult(_0x12af96,null))[_0x1710('0x45')](handleError(_0x12af96,null));};exports[_0x1710('0x27')]=function(_0x49952e,_0x54523d){return db[_0x1710('0x2b')]['find']({'where':{'id':_0x49952e[_0x1710('0x48')]['id']}})['then'](handleEntityNotFound(_0x54523d,null))[_0x1710('0x26')](removeEntity(_0x54523d,null))['catch'](handleError(_0x54523d,null));};exports[_0x1710('0x49')]=function(_0x4bd22f,_0x2d219c,_0x575ffc){var _0x1d5248={};var _0x43fddc={};var _0x6bc23f;var _0x48d806;return db[_0x1710('0x2b')][_0x1710('0x4a')]({'where':{'id':_0x4bd22f[_0x1710('0x48')]['id']}})[_0x1710('0x26')](handleEntityNotFound(_0x2d219c,null))[_0x1710('0x26')](function(_0x49ec88){if(_0x49ec88){_0x6bc23f=_0x49ec88;_0x43fddc[_0x1710('0x2e')]=_['keys'](db[_0x1710('0x4b')][_0x1710('0x41')]);_0x43fddc[_0x1710('0x2f')]=_['keys'](_0x4bd22f[_0x1710('0x2f')]);_0x43fddc[_0x1710('0x31')]=_[_0x1710('0x32')](_0x43fddc[_0x1710('0x2e')],_0x43fddc[_0x1710('0x2f')]);_0x1d5248[_0x1710('0x33')]=_[_0x1710('0x32')](_0x43fddc[_0x1710('0x2e')],qs[_0x1710('0x34')](_0x4bd22f[_0x1710('0x2f')][_0x1710('0x34')]));_0x1d5248[_0x1710('0x33')]=_0x1d5248[_0x1710('0x33')][_0x1710('0x35')]?_0x1d5248['attributes']:_0x43fddc[_0x1710('0x2e')];_0x1d5248[_0x1710('0x4c')]=qs[_0x1710('0x38')](_0x4bd22f[_0x1710('0x2f')][_0x1710('0x38')]);_0x1d5248[_0x1710('0x39')]=qs[_0x1710('0x31')](_[_0x1710('0x3a')](_0x4bd22f[_0x1710('0x2f')],_0x43fddc[_0x1710('0x31')]));if(_0x4bd22f[_0x1710('0x2f')][_0x1710('0x3b')]){_0x1d5248[_0x1710('0x39')]=_[_0x1710('0x3c')](_0x1d5248[_0x1710('0x39')],{'$or':_[_0x1710('0x2a')](_0x1d5248['attributes'],function(_0xbd9a2d){var _0x1c98f8={};_0x1c98f8[_0xbd9a2d]={'$like':'%'+_0x4bd22f[_0x1710('0x2f')][_0x1710('0x3b')]+'%'};return _0x1c98f8;})});}_0x1d5248=_[_0x1710('0x3c')]({},_0x1d5248,_0x4bd22f['options']);return _0x6bc23f[_0x1710('0x49')](_0x1d5248);}})['then'](function(_0x5f513a){if(_0x5f513a){_0x48d806=_0x5f513a[_0x1710('0x35')];if(!_0x4bd22f[_0x1710('0x2f')][_0x1710('0x36')]('nolimit')){_0x1d5248['limit']=qs[_0x1710('0x1e')](_0x4bd22f['query'][_0x1710('0x1e')]);_0x1d5248[_0x1710('0x20')]=qs[_0x1710('0x20')](_0x4bd22f[_0x1710('0x2f')][_0x1710('0x20')]);}return _0x6bc23f[_0x1710('0x49')](_0x1d5248);}})['then'](function(_0x90574e){if(_0x90574e){return _0x90574e?{'count':_0x48d806,'rows':_0x90574e}:null;}})['then'](respondWithResult(_0x2d219c,null))[_0x1710('0x45')](handleError(_0x2d219c,null));};exports[_0x1710('0x4d')]=function(_0x166728,_0x1884bc,_0x50ca80){var _0x1ddbc2={};var _0x26fd72={};var _0x516121;var _0x4267f7;return db[_0x1710('0x2b')][_0x1710('0x4a')]({'where':{'id':_0x166728[_0x1710('0x48')]['id']}})[_0x1710('0x26')](handleEntityNotFound(_0x1884bc,null))[_0x1710('0x26')](function(_0x4e9c32){if(_0x4e9c32){_0x516121=_0x4e9c32;_0x26fd72[_0x1710('0x2e')]=_[_0x1710('0x30')](db[_0x1710('0x4b')][_0x1710('0x41')]);_0x26fd72[_0x1710('0x2f')]=_[_0x1710('0x30')](_0x166728['query']);_0x26fd72['filters']=_[_0x1710('0x32')](_0x26fd72[_0x1710('0x2e')],_0x26fd72[_0x1710('0x2f')]);_0x1ddbc2['attributes']=_[_0x1710('0x32')](_0x26fd72[_0x1710('0x2e')],qs[_0x1710('0x34')](_0x166728['query'][_0x1710('0x34')]));_0x1ddbc2[_0x1710('0x33')]=_0x1ddbc2['attributes']['length']?_0x1ddbc2[_0x1710('0x33')]:_0x26fd72['model'];_0x1ddbc2[_0x1710('0x4c')]=qs['sort'](_0x166728[_0x1710('0x2f')][_0x1710('0x38')]);_0x1ddbc2[_0x1710('0x39')]=qs[_0x1710('0x31')](_[_0x1710('0x3a')](_0x166728[_0x1710('0x2f')],_0x26fd72['filters']));if(_0x166728[_0x1710('0x2f')][_0x1710('0x3b')]){_0x1ddbc2[_0x1710('0x39')]=_[_0x1710('0x3c')](_0x1ddbc2['where'],{'$or':_[_0x1710('0x2a')](_0x1ddbc2[_0x1710('0x33')],function(_0x30ad7c){var _0x2acbdc={};_0x2acbdc[_0x30ad7c]={'$like':'%'+_0x166728[_0x1710('0x2f')][_0x1710('0x3b')]+'%'};return _0x2acbdc;})});}_0x1ddbc2=_[_0x1710('0x3c')]({},_0x1ddbc2,_0x166728[_0x1710('0x3d')]);return _0x516121[_0x1710('0x4d')](_0x1ddbc2);}})[_0x1710('0x26')](function(_0x320cbc){if(_0x320cbc){_0x4267f7=_0x320cbc['length'];if(!_0x166728[_0x1710('0x2f')][_0x1710('0x36')](_0x1710('0x37'))){_0x1ddbc2['limit']=qs[_0x1710('0x1e')](_0x166728[_0x1710('0x2f')][_0x1710('0x1e')]);_0x1ddbc2[_0x1710('0x20')]=qs[_0x1710('0x20')](_0x166728[_0x1710('0x2f')][_0x1710('0x20')]);}return _0x516121['getSubjects'](_0x1ddbc2);}})[_0x1710('0x26')](function(_0x41080a){if(_0x41080a){return _0x41080a?{'count':_0x4267f7,'rows':_0x41080a}:null;}})[_0x1710('0x26')](respondWithResult(_0x1884bc,null))[_0x1710('0x45')](handleError(_0x1884bc,null));};exports['getDescriptions']=function(_0x20106c,_0x19bc75,_0x3b560a){var _0x379fca={};var _0x125251={};var _0x4e1f74;var _0x5305a0;return db[_0x1710('0x2b')]['findOne']({'where':{'id':_0x20106c['params']['id']}})[_0x1710('0x26')](handleEntityNotFound(_0x19bc75,null))[_0x1710('0x26')](function(_0x3bb353){if(_0x3bb353){_0x4e1f74=_0x3bb353;_0x125251[_0x1710('0x2e')]=_[_0x1710('0x30')](db[_0x1710('0x4b')][_0x1710('0x41')]);_0x125251[_0x1710('0x2f')]=_[_0x1710('0x30')](_0x20106c[_0x1710('0x2f')]);_0x125251[_0x1710('0x31')]=_[_0x1710('0x32')](_0x125251[_0x1710('0x2e')],_0x125251[_0x1710('0x2f')]);_0x379fca[_0x1710('0x33')]=_[_0x1710('0x32')](_0x125251[_0x1710('0x2e')],qs['fields'](_0x20106c[_0x1710('0x2f')]['fields']));_0x379fca[_0x1710('0x33')]=_0x379fca[_0x1710('0x33')][_0x1710('0x35')]?_0x379fca['attributes']:_0x125251[_0x1710('0x2e')];_0x379fca['order']=qs[_0x1710('0x38')](_0x20106c[_0x1710('0x2f')][_0x1710('0x38')]);_0x379fca[_0x1710('0x39')]=qs[_0x1710('0x31')](_[_0x1710('0x3a')](_0x20106c[_0x1710('0x2f')],_0x125251[_0x1710('0x31')]));if(_0x20106c[_0x1710('0x2f')][_0x1710('0x3b')]){_0x379fca['where']=_[_0x1710('0x3c')](_0x379fca[_0x1710('0x39')],{'$or':_[_0x1710('0x2a')](_0x379fca[_0x1710('0x33')],function(_0x341b8d){var _0x3f40aa={};_0x3f40aa[_0x341b8d]={'$like':'%'+_0x20106c[_0x1710('0x2f')][_0x1710('0x3b')]+'%'};return _0x3f40aa;})});}_0x379fca=_['merge']({},_0x379fca,_0x20106c[_0x1710('0x3d')]);return _0x4e1f74[_0x1710('0x4e')](_0x379fca);}})[_0x1710('0x26')](function(_0x410384){if(_0x410384){_0x5305a0=_0x410384['length'];if(!_0x20106c[_0x1710('0x2f')][_0x1710('0x36')]('nolimit')){_0x379fca[_0x1710('0x1e')]=qs[_0x1710('0x1e')](_0x20106c[_0x1710('0x2f')][_0x1710('0x1e')]);_0x379fca['offset']=qs[_0x1710('0x20')](_0x20106c[_0x1710('0x2f')][_0x1710('0x20')]);}return _0x4e1f74['getDescriptions'](_0x379fca);}})[_0x1710('0x26')](function(_0x58d5cd){if(_0x58d5cd){return _0x58d5cd?{'count':_0x5305a0,'rows':_0x58d5cd}:null;}})['then'](respondWithResult(_0x19bc75,null))[_0x1710('0x45')](handleError(_0x19bc75,null));};exports['getTags']=function(_0x214648,_0x362e9b,_0x1060d8){var _0x1f836c={};var _0x2820b7={};var _0x3d34e9;var _0x278ca0;return db['DeskConfiguration'][_0x1710('0x4a')]({'where':{'id':_0x214648[_0x1710('0x48')]['id']}})[_0x1710('0x26')](handleEntityNotFound(_0x362e9b,null))[_0x1710('0x26')](function(_0x54f8a2){if(_0x54f8a2){_0x3d34e9=_0x54f8a2;_0x2820b7['model']=_[_0x1710('0x30')](db[_0x1710('0x4f')][_0x1710('0x41')]);_0x2820b7['query']=_[_0x1710('0x30')](_0x214648[_0x1710('0x2f')]);_0x2820b7[_0x1710('0x31')]=_[_0x1710('0x32')](_0x2820b7['model'],_0x2820b7[_0x1710('0x2f')]);_0x1f836c[_0x1710('0x33')]=_['intersection'](_0x2820b7['model'],qs[_0x1710('0x34')](_0x214648['query'][_0x1710('0x34')]));_0x1f836c['attributes']=_0x1f836c[_0x1710('0x33')][_0x1710('0x35')]?_0x1f836c[_0x1710('0x33')]:_0x2820b7[_0x1710('0x2e')];_0x1f836c[_0x1710('0x4c')]=qs[_0x1710('0x38')](_0x214648['query'][_0x1710('0x38')]);_0x1f836c[_0x1710('0x39')]=qs[_0x1710('0x31')](_[_0x1710('0x3a')](_0x214648['query'],_0x2820b7[_0x1710('0x31')]));if(_0x214648[_0x1710('0x2f')][_0x1710('0x3b')]){_0x1f836c[_0x1710('0x39')]=_[_0x1710('0x3c')](_0x1f836c[_0x1710('0x39')],{'$or':_[_0x1710('0x2a')](_0x1f836c['attributes'],function(_0x28ea13){var _0x37f588={};_0x37f588[_0x28ea13]={'$like':'%'+_0x214648[_0x1710('0x2f')]['filter']+'%'};return _0x37f588;})});}_0x1f836c=_[_0x1710('0x3c')]({},_0x1f836c,_0x214648[_0x1710('0x3d')]);return _0x3d34e9[_0x1710('0x50')](_0x1f836c);}})[_0x1710('0x26')](function(_0x315469){if(_0x315469){_0x278ca0=_0x315469[_0x1710('0x35')];if(!_0x214648[_0x1710('0x2f')][_0x1710('0x36')](_0x1710('0x37'))){_0x1f836c[_0x1710('0x1e')]=qs[_0x1710('0x1e')](_0x214648[_0x1710('0x2f')][_0x1710('0x1e')]);_0x1f836c[_0x1710('0x20')]=qs[_0x1710('0x20')](_0x214648[_0x1710('0x2f')][_0x1710('0x20')]);}return _0x3d34e9[_0x1710('0x50')](_0x1f836c);}})[_0x1710('0x26')](function(_0x18afc5){if(_0x18afc5){return _0x18afc5?{'count':_0x278ca0,'rows':_0x18afc5}:null;}})[_0x1710('0x26')](respondWithResult(_0x362e9b,null))[_0x1710('0x45')](handleError(_0x362e9b,null));};exports[_0x1710('0x51')]=function(_0x3bc9d3,_0x5e33a2,_0x470887){if(_0x3bc9d3[_0x1710('0x47')]['id']){delete _0x3bc9d3[_0x1710('0x47')]['id'];}return db[_0x1710('0x2b')][_0x1710('0x4a')]({'where':{'id':_0x3bc9d3['params']['id']}})['then'](handleEntityNotFound(_0x5e33a2,null))['then'](function(_0x29fa4a){if(_0x29fa4a){return _0x29fa4a['setTags'](_0x3bc9d3['body']['ids']||[]);}return null;})[_0x1710('0x26')](respondWithResult(_0x5e33a2,null))[_0x1710('0x45')](handleError(_0x5e33a2,null));}; \ No newline at end of file +var _0xc761=['../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','destroy','then','error','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','create','body','update','find','params','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5c1394,_0x2e73b7){var _0x4e2c2d=function(_0xb02d40){while(--_0xb02d40){_0x5c1394['push'](_0x5c1394['shift']());}};_0x4e2c2d(++_0x2e73b7);}(_0xc761,0xe2));var _0x1c76=function(_0x9861ff,_0x41fb17){_0x9861ff=_0x9861ff-0x0;var _0x48852b=_0xc761[_0x9861ff];return _0x48852b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c76('0x0'));var zipdir=require(_0x1c76('0x1'));var jsonpatch=require(_0x1c76('0x2'));var rp=require(_0x1c76('0x3'));var moment=require(_0x1c76('0x4'));var BPromise=require(_0x1c76('0x5'));var Mustache=require(_0x1c76('0x6'));var util=require(_0x1c76('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1c76('0x8'));var fs=require('fs');var fs_extra=require(_0x1c76('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c76('0xa'));var jsforce=require(_0x1c76('0xb'));var deskjs=require(_0x1c76('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1c76('0xd'));var Papa=require(_0x1c76('0xe'));var Redis=require(_0x1c76('0xf'));var authService=require(_0x1c76('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1c76('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c76('0x12'))(_0x1c76('0x13'));var utils=require(_0x1c76('0x14'));var config=require(_0x1c76('0x15'));var licenseUtil=require(_0x1c76('0x16'));var db=require(_0x1c76('0x17'))['db'];function respondWithStatusCode(_0x1baae0,_0x23f0c3){_0x23f0c3=_0x23f0c3||0xcc;return function(_0x50dd26){if(_0x50dd26){return _0x1baae0[_0x1c76('0x18')](_0x23f0c3);}return _0x1baae0[_0x1c76('0x19')](_0x23f0c3)[_0x1c76('0x1a')]();};}function respondWithResult(_0x4fb16a,_0x1e0967){_0x1e0967=_0x1e0967||0xc8;return function(_0x1b5561){if(_0x1b5561){return _0x4fb16a[_0x1c76('0x19')](_0x1e0967)[_0x1c76('0x1b')](_0x1b5561);}};}function respondWithFilteredResult(_0xa3c4e5,_0x333420){return function(_0x398f16){if(_0x398f16){var _0x5d4a3c=typeof _0x333420[_0x1c76('0x1c')]==='undefined'&&typeof _0x333420[_0x1c76('0x1d')]==='undefined';var _0x3459b0=_0x398f16[_0x1c76('0x1e')];var _0x44a774=_0x5d4a3c?0x0:_0x333420[_0x1c76('0x1c')];var _0x363424=_0x5d4a3c?_0x398f16[_0x1c76('0x1e')]:_0x333420['offset']+_0x333420[_0x1c76('0x1d')];var _0x53fba0;if(_0x363424>=_0x3459b0){_0x363424=_0x3459b0;_0x53fba0=0xc8;}else{_0x53fba0=0xce;}_0xa3c4e5[_0x1c76('0x19')](_0x53fba0);return _0xa3c4e5[_0x1c76('0x1f')](_0x1c76('0x20'),_0x44a774+'-'+_0x363424+'/'+_0x3459b0)[_0x1c76('0x1b')](_0x398f16);}return null;};}function patchUpdates(_0x5715fb){return function(_0x58fbe6){try{jsonpatch['apply'](_0x58fbe6,_0x5715fb,!![]);}catch(_0x128e25){return BPromise['reject'](_0x128e25);}return _0x58fbe6[_0x1c76('0x21')]();};}function saveUpdates(_0x266ecf,_0x574b29){return function(_0x563cb7){if(_0x563cb7){return _0x563cb7['update'](_0x266ecf)['then'](function(_0x5e4bb0){return _0x5e4bb0;});}return null;};}function removeEntity(_0x2498bf,_0x5e26fa){return function(_0x3071a6){if(_0x3071a6){return _0x3071a6[_0x1c76('0x22')]()[_0x1c76('0x23')](function(){_0x2498bf[_0x1c76('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1730b1,_0xf54bbc){return function(_0x31c7bc){if(!_0x31c7bc){_0x1730b1[_0x1c76('0x18')](0x194);}return _0x31c7bc;};}function handleError(_0x3c8127,_0xf5911b){_0xf5911b=_0xf5911b||0x1f4;return function(_0x248fe1){logger[_0x1c76('0x24')](_0x248fe1['stack']);if(_0x248fe1['name']){delete _0x248fe1['name'];}_0x3c8127[_0x1c76('0x19')](_0xf5911b)[_0x1c76('0x25')](_0x248fe1);};}exports[_0x1c76('0x26')]=function(_0x1f958d,_0x40e5dd){var _0x57acf9={},_0x4c0026={},_0x23491b={'count':0x0,'rows':[]};var _0x236c42=_['map'](db[_0x1c76('0x27')][_0x1c76('0x28')],function(_0x394fd6){return{'name':_0x394fd6[_0x1c76('0x29')],'type':_0x394fd6[_0x1c76('0x2a')][_0x1c76('0x2b')]};});_0x4c0026[_0x1c76('0x2c')]=_[_0x1c76('0x2d')](_0x236c42,_0x1c76('0x2e'));_0x4c0026[_0x1c76('0x2f')]=_[_0x1c76('0x30')](_0x1f958d[_0x1c76('0x2f')]);_0x4c0026[_0x1c76('0x31')]=_[_0x1c76('0x32')](_0x4c0026[_0x1c76('0x2c')],_0x4c0026[_0x1c76('0x2f')]);_0x57acf9[_0x1c76('0x33')]=_['intersection'](_0x4c0026[_0x1c76('0x2c')],qs[_0x1c76('0x34')](_0x1f958d[_0x1c76('0x2f')]['fields']));_0x57acf9[_0x1c76('0x33')]=_0x57acf9[_0x1c76('0x33')][_0x1c76('0x35')]?_0x57acf9[_0x1c76('0x33')]:_0x4c0026[_0x1c76('0x2c')];if(!_0x1f958d[_0x1c76('0x2f')][_0x1c76('0x36')](_0x1c76('0x37'))){_0x57acf9[_0x1c76('0x1d')]=qs[_0x1c76('0x1d')](_0x1f958d['query'][_0x1c76('0x1d')]);_0x57acf9[_0x1c76('0x1c')]=qs['offset'](_0x1f958d[_0x1c76('0x2f')][_0x1c76('0x1c')]);}_0x57acf9[_0x1c76('0x38')]=qs['sort'](_0x1f958d[_0x1c76('0x2f')][_0x1c76('0x39')]);_0x57acf9['where']=qs[_0x1c76('0x31')](_['pick'](_0x1f958d[_0x1c76('0x2f')],_0x4c0026[_0x1c76('0x31')]),_0x236c42);if(_0x1f958d[_0x1c76('0x2f')][_0x1c76('0x3a')]){_0x57acf9['where']=_[_0x1c76('0x3b')](_0x57acf9[_0x1c76('0x3c')],{'$or':_['map'](_0x236c42,function(_0x599f43){if(_0x599f43[_0x1c76('0x2a')]!==_0x1c76('0x3d')){var _0x115d7c={};_0x115d7c[_0x599f43[_0x1c76('0x2e')]]={'$like':'%'+_0x1f958d[_0x1c76('0x2f')]['filter']+'%'};return _0x115d7c;}})});}_0x57acf9=_[_0x1c76('0x3b')]({},_0x57acf9,_0x1f958d[_0x1c76('0x3e')]);var _0x429fde={'where':_0x57acf9[_0x1c76('0x3c')]};return db['DeskConfiguration'][_0x1c76('0x1e')](_0x429fde)[_0x1c76('0x23')](function(_0x888e91){_0x23491b[_0x1c76('0x1e')]=_0x888e91;if(_0x1f958d[_0x1c76('0x2f')]['includeAll']){_0x57acf9[_0x1c76('0x3f')]=[{'all':!![]}];}return db[_0x1c76('0x27')][_0x1c76('0x40')](_0x57acf9);})['then'](function(_0x25bca1){_0x23491b[_0x1c76('0x41')]=_0x25bca1;return _0x23491b;})['then'](respondWithFilteredResult(_0x40e5dd,_0x57acf9))[_0x1c76('0x42')](handleError(_0x40e5dd,null));};exports[_0x1c76('0x43')]=function(_0x54efc5,_0x76da8d){var _0x5855f5={'raw':![],'where':{'id':_0x54efc5['params']['id']}},_0xec7ad4={};_0xec7ad4['model']=_[_0x1c76('0x30')](db[_0x1c76('0x27')]['rawAttributes']);_0xec7ad4['query']=_[_0x1c76('0x30')](_0x54efc5['query']);_0xec7ad4['filters']=_[_0x1c76('0x32')](_0xec7ad4[_0x1c76('0x2c')],_0xec7ad4[_0x1c76('0x2f')]);_0x5855f5['attributes']=_[_0x1c76('0x32')](_0xec7ad4[_0x1c76('0x2c')],qs['fields'](_0x54efc5[_0x1c76('0x2f')][_0x1c76('0x34')]));_0x5855f5[_0x1c76('0x33')]=_0x5855f5['attributes'][_0x1c76('0x35')]?_0x5855f5['attributes']:_0xec7ad4[_0x1c76('0x2c')];if(_0x54efc5[_0x1c76('0x2f')]['includeAll']){_0x5855f5['include']=[{'all':!![]}];}_0x5855f5=_[_0x1c76('0x3b')]({},_0x5855f5,_0x54efc5[_0x1c76('0x3e')]);return db[_0x1c76('0x27')]['find'](_0x5855f5)[_0x1c76('0x23')](handleEntityNotFound(_0x76da8d,null))[_0x1c76('0x23')](respondWithResult(_0x76da8d,null))[_0x1c76('0x42')](handleError(_0x76da8d,null));};exports[_0x1c76('0x44')]=function(_0x173c86,_0xde931b){return db['DeskConfiguration'][_0x1c76('0x44')](_0x173c86[_0x1c76('0x45')],{})[_0x1c76('0x23')](respondWithResult(_0xde931b,0xc9))[_0x1c76('0x42')](handleError(_0xde931b,null));};exports[_0x1c76('0x46')]=function(_0x5c572a,_0x146d37){if(_0x5c572a[_0x1c76('0x45')]['id']){delete _0x5c572a[_0x1c76('0x45')]['id'];}return db['DeskConfiguration'][_0x1c76('0x47')]({'where':{'id':_0x5c572a[_0x1c76('0x48')]['id']}})['then'](handleEntityNotFound(_0x146d37,null))[_0x1c76('0x23')](saveUpdates(_0x5c572a[_0x1c76('0x45')],null))[_0x1c76('0x23')](respondWithResult(_0x146d37,null))[_0x1c76('0x42')](handleError(_0x146d37,null));};exports[_0x1c76('0x22')]=function(_0x30f2ab,_0x35dc09){return db[_0x1c76('0x27')][_0x1c76('0x47')]({'where':{'id':_0x30f2ab[_0x1c76('0x48')]['id']}})[_0x1c76('0x23')](handleEntityNotFound(_0x35dc09,null))[_0x1c76('0x23')](removeEntity(_0x35dc09,null))[_0x1c76('0x42')](handleError(_0x35dc09,null));};exports[_0x1c76('0x49')]=function(_0x35ee4c,_0x412751,_0x2b024c){var _0x2c8303={};var _0x157d42={};var _0x547f53;var _0x5093de;return db[_0x1c76('0x27')][_0x1c76('0x4a')]({'where':{'id':_0x35ee4c[_0x1c76('0x48')]['id']}})[_0x1c76('0x23')](handleEntityNotFound(_0x412751,null))[_0x1c76('0x23')](function(_0x2b4c77){if(_0x2b4c77){_0x547f53=_0x2b4c77;_0x157d42['model']=_[_0x1c76('0x30')](db[_0x1c76('0x4b')][_0x1c76('0x28')]);_0x157d42[_0x1c76('0x2f')]=_[_0x1c76('0x30')](_0x35ee4c[_0x1c76('0x2f')]);_0x157d42[_0x1c76('0x31')]=_['intersection'](_0x157d42[_0x1c76('0x2c')],_0x157d42['query']);_0x2c8303[_0x1c76('0x33')]=_[_0x1c76('0x32')](_0x157d42[_0x1c76('0x2c')],qs['fields'](_0x35ee4c[_0x1c76('0x2f')]['fields']));_0x2c8303[_0x1c76('0x33')]=_0x2c8303[_0x1c76('0x33')][_0x1c76('0x35')]?_0x2c8303[_0x1c76('0x33')]:_0x157d42[_0x1c76('0x2c')];_0x2c8303[_0x1c76('0x38')]=qs['sort'](_0x35ee4c[_0x1c76('0x2f')][_0x1c76('0x39')]);_0x2c8303[_0x1c76('0x3c')]=qs[_0x1c76('0x31')](_[_0x1c76('0x4c')](_0x35ee4c[_0x1c76('0x2f')],_0x157d42['filters']));if(_0x35ee4c['query'][_0x1c76('0x3a')]){_0x2c8303[_0x1c76('0x3c')]=_['merge'](_0x2c8303[_0x1c76('0x3c')],{'$or':_[_0x1c76('0x2d')](_0x2c8303[_0x1c76('0x33')],function(_0x5502f5){var _0x270ac9={};_0x270ac9[_0x5502f5]={'$like':'%'+_0x35ee4c[_0x1c76('0x2f')]['filter']+'%'};return _0x270ac9;})});}_0x2c8303=_[_0x1c76('0x3b')]({},_0x2c8303,_0x35ee4c[_0x1c76('0x3e')]);return _0x547f53[_0x1c76('0x49')](_0x2c8303);}})[_0x1c76('0x23')](function(_0x257e38){if(_0x257e38){_0x5093de=_0x257e38['length'];if(!_0x35ee4c[_0x1c76('0x2f')][_0x1c76('0x36')]('nolimit')){_0x2c8303[_0x1c76('0x1d')]=qs[_0x1c76('0x1d')](_0x35ee4c[_0x1c76('0x2f')]['limit']);_0x2c8303[_0x1c76('0x1c')]=qs[_0x1c76('0x1c')](_0x35ee4c[_0x1c76('0x2f')][_0x1c76('0x1c')]);}return _0x547f53[_0x1c76('0x49')](_0x2c8303);}})[_0x1c76('0x23')](function(_0x1e5911){if(_0x1e5911){return _0x1e5911?{'count':_0x5093de,'rows':_0x1e5911}:null;}})['then'](respondWithResult(_0x412751,null))[_0x1c76('0x42')](handleError(_0x412751,null));};exports[_0x1c76('0x4d')]=function(_0x4c141d,_0x4009fc,_0x41b705){var _0x1f826f={};var _0x5785c6={};var _0xda733b;var _0xa40e3c;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4c141d['params']['id']}})['then'](handleEntityNotFound(_0x4009fc,null))[_0x1c76('0x23')](function(_0x15be5c){if(_0x15be5c){_0xda733b=_0x15be5c;_0x5785c6[_0x1c76('0x2c')]=_[_0x1c76('0x30')](db[_0x1c76('0x4b')][_0x1c76('0x28')]);_0x5785c6[_0x1c76('0x2f')]=_['keys'](_0x4c141d['query']);_0x5785c6[_0x1c76('0x31')]=_[_0x1c76('0x32')](_0x5785c6[_0x1c76('0x2c')],_0x5785c6[_0x1c76('0x2f')]);_0x1f826f['attributes']=_[_0x1c76('0x32')](_0x5785c6[_0x1c76('0x2c')],qs[_0x1c76('0x34')](_0x4c141d[_0x1c76('0x2f')][_0x1c76('0x34')]));_0x1f826f['attributes']=_0x1f826f[_0x1c76('0x33')][_0x1c76('0x35')]?_0x1f826f['attributes']:_0x5785c6[_0x1c76('0x2c')];_0x1f826f[_0x1c76('0x38')]=qs[_0x1c76('0x39')](_0x4c141d['query'][_0x1c76('0x39')]);_0x1f826f[_0x1c76('0x3c')]=qs['filters'](_[_0x1c76('0x4c')](_0x4c141d[_0x1c76('0x2f')],_0x5785c6['filters']));if(_0x4c141d[_0x1c76('0x2f')][_0x1c76('0x3a')]){_0x1f826f['where']=_['merge'](_0x1f826f['where'],{'$or':_[_0x1c76('0x2d')](_0x1f826f[_0x1c76('0x33')],function(_0xc3f967){var _0x262a26={};_0x262a26[_0xc3f967]={'$like':'%'+_0x4c141d[_0x1c76('0x2f')][_0x1c76('0x3a')]+'%'};return _0x262a26;})});}_0x1f826f=_['merge']({},_0x1f826f,_0x4c141d[_0x1c76('0x3e')]);return _0xda733b[_0x1c76('0x4d')](_0x1f826f);}})[_0x1c76('0x23')](function(_0x59dad0){if(_0x59dad0){_0xa40e3c=_0x59dad0[_0x1c76('0x35')];if(!_0x4c141d[_0x1c76('0x2f')]['hasOwnProperty']('nolimit')){_0x1f826f[_0x1c76('0x1d')]=qs[_0x1c76('0x1d')](_0x4c141d[_0x1c76('0x2f')]['limit']);_0x1f826f['offset']=qs[_0x1c76('0x1c')](_0x4c141d[_0x1c76('0x2f')][_0x1c76('0x1c')]);}return _0xda733b[_0x1c76('0x4d')](_0x1f826f);}})[_0x1c76('0x23')](function(_0x2cf0eb){if(_0x2cf0eb){return _0x2cf0eb?{'count':_0xa40e3c,'rows':_0x2cf0eb}:null;}})['then'](respondWithResult(_0x4009fc,null))['catch'](handleError(_0x4009fc,null));};exports[_0x1c76('0x4e')]=function(_0x34f18f,_0x3ba3a3,_0x2c0986){var _0x5476d9={};var _0x4a44a1={};var _0x50e1f8;var _0x3a69bd;return db[_0x1c76('0x27')]['findOne']({'where':{'id':_0x34f18f[_0x1c76('0x48')]['id']}})[_0x1c76('0x23')](handleEntityNotFound(_0x3ba3a3,null))[_0x1c76('0x23')](function(_0xf4bc3c){if(_0xf4bc3c){_0x50e1f8=_0xf4bc3c;_0x4a44a1[_0x1c76('0x2c')]=_[_0x1c76('0x30')](db['DeskField'][_0x1c76('0x28')]);_0x4a44a1['query']=_[_0x1c76('0x30')](_0x34f18f[_0x1c76('0x2f')]);_0x4a44a1[_0x1c76('0x31')]=_[_0x1c76('0x32')](_0x4a44a1[_0x1c76('0x2c')],_0x4a44a1[_0x1c76('0x2f')]);_0x5476d9[_0x1c76('0x33')]=_[_0x1c76('0x32')](_0x4a44a1[_0x1c76('0x2c')],qs[_0x1c76('0x34')](_0x34f18f[_0x1c76('0x2f')][_0x1c76('0x34')]));_0x5476d9[_0x1c76('0x33')]=_0x5476d9['attributes'][_0x1c76('0x35')]?_0x5476d9[_0x1c76('0x33')]:_0x4a44a1[_0x1c76('0x2c')];_0x5476d9[_0x1c76('0x38')]=qs[_0x1c76('0x39')](_0x34f18f[_0x1c76('0x2f')]['sort']);_0x5476d9[_0x1c76('0x3c')]=qs[_0x1c76('0x31')](_[_0x1c76('0x4c')](_0x34f18f[_0x1c76('0x2f')],_0x4a44a1[_0x1c76('0x31')]));if(_0x34f18f[_0x1c76('0x2f')][_0x1c76('0x3a')]){_0x5476d9[_0x1c76('0x3c')]=_[_0x1c76('0x3b')](_0x5476d9['where'],{'$or':_['map'](_0x5476d9['attributes'],function(_0x37c61b){var _0x3bfb2a={};_0x3bfb2a[_0x37c61b]={'$like':'%'+_0x34f18f[_0x1c76('0x2f')]['filter']+'%'};return _0x3bfb2a;})});}_0x5476d9=_[_0x1c76('0x3b')]({},_0x5476d9,_0x34f18f[_0x1c76('0x3e')]);return _0x50e1f8[_0x1c76('0x4e')](_0x5476d9);}})[_0x1c76('0x23')](function(_0xf197d0){if(_0xf197d0){_0x3a69bd=_0xf197d0[_0x1c76('0x35')];if(!_0x34f18f['query']['hasOwnProperty'](_0x1c76('0x37'))){_0x5476d9[_0x1c76('0x1d')]=qs[_0x1c76('0x1d')](_0x34f18f[_0x1c76('0x2f')][_0x1c76('0x1d')]);_0x5476d9['offset']=qs['offset'](_0x34f18f['query'][_0x1c76('0x1c')]);}return _0x50e1f8[_0x1c76('0x4e')](_0x5476d9);}})[_0x1c76('0x23')](function(_0xc486){if(_0xc486){return _0xc486?{'count':_0x3a69bd,'rows':_0xc486}:null;}})[_0x1c76('0x23')](respondWithResult(_0x3ba3a3,null))['catch'](handleError(_0x3ba3a3,null));};exports[_0x1c76('0x4f')]=function(_0x9e9b68,_0x11f75b,_0x1b95a4){var _0xdf3aea={};var _0x16fc58={};var _0x2a6a2b;var _0x127dba;return db['DeskConfiguration'][_0x1c76('0x4a')]({'where':{'id':_0x9e9b68[_0x1c76('0x48')]['id']}})[_0x1c76('0x23')](handleEntityNotFound(_0x11f75b,null))[_0x1c76('0x23')](function(_0x2310c3){if(_0x2310c3){_0x2a6a2b=_0x2310c3;_0x16fc58[_0x1c76('0x2c')]=_[_0x1c76('0x30')](db[_0x1c76('0x50')]['rawAttributes']);_0x16fc58['query']=_['keys'](_0x9e9b68[_0x1c76('0x2f')]);_0x16fc58[_0x1c76('0x31')]=_[_0x1c76('0x32')](_0x16fc58[_0x1c76('0x2c')],_0x16fc58[_0x1c76('0x2f')]);_0xdf3aea[_0x1c76('0x33')]=_['intersection'](_0x16fc58['model'],qs[_0x1c76('0x34')](_0x9e9b68[_0x1c76('0x2f')][_0x1c76('0x34')]));_0xdf3aea['attributes']=_0xdf3aea[_0x1c76('0x33')][_0x1c76('0x35')]?_0xdf3aea[_0x1c76('0x33')]:_0x16fc58['model'];_0xdf3aea[_0x1c76('0x38')]=qs[_0x1c76('0x39')](_0x9e9b68[_0x1c76('0x2f')]['sort']);_0xdf3aea[_0x1c76('0x3c')]=qs[_0x1c76('0x31')](_[_0x1c76('0x4c')](_0x9e9b68[_0x1c76('0x2f')],_0x16fc58[_0x1c76('0x31')]));if(_0x9e9b68['query'][_0x1c76('0x3a')]){_0xdf3aea['where']=_[_0x1c76('0x3b')](_0xdf3aea[_0x1c76('0x3c')],{'$or':_[_0x1c76('0x2d')](_0xdf3aea[_0x1c76('0x33')],function(_0x137625){var _0x4e32e1={};_0x4e32e1[_0x137625]={'$like':'%'+_0x9e9b68[_0x1c76('0x2f')][_0x1c76('0x3a')]+'%'};return _0x4e32e1;})});}_0xdf3aea=_['merge']({},_0xdf3aea,_0x9e9b68[_0x1c76('0x3e')]);return _0x2a6a2b[_0x1c76('0x4f')](_0xdf3aea);}})[_0x1c76('0x23')](function(_0x26822b){if(_0x26822b){_0x127dba=_0x26822b[_0x1c76('0x35')];if(!_0x9e9b68['query'][_0x1c76('0x36')](_0x1c76('0x37'))){_0xdf3aea[_0x1c76('0x1d')]=qs[_0x1c76('0x1d')](_0x9e9b68[_0x1c76('0x2f')]['limit']);_0xdf3aea[_0x1c76('0x1c')]=qs['offset'](_0x9e9b68[_0x1c76('0x2f')]['offset']);}return _0x2a6a2b['getTags'](_0xdf3aea);}})[_0x1c76('0x23')](function(_0x5a2175){if(_0x5a2175){return _0x5a2175?{'count':_0x127dba,'rows':_0x5a2175}:null;}})[_0x1c76('0x23')](respondWithResult(_0x11f75b,null))['catch'](handleError(_0x11f75b,null));};exports[_0x1c76('0x51')]=function(_0x396e64,_0x39fe7a,_0x11dbb8){if(_0x396e64[_0x1c76('0x45')]['id']){delete _0x396e64['body']['id'];}return db[_0x1c76('0x27')]['findOne']({'where':{'id':_0x396e64[_0x1c76('0x48')]['id']}})['then'](handleEntityNotFound(_0x39fe7a,null))[_0x1c76('0x23')](function(_0x4ec633){if(_0x4ec633){return _0x4ec633[_0x1c76('0x51')](_0x396e64['body'][_0x1c76('0x52')]||[]);}return null;})[_0x1c76('0x23')](respondWithResult(_0x39fe7a,null))[_0x1c76('0x42')](handleError(_0x39fe7a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e43ccbf..28c8d4b 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.model.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b15=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x0b15,0x16f));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x50b1('0x0'));var util=require(_0x50b1('0x1'));var logger=require(_0x50b1('0x2'))(_0x50b1('0x3'));var moment=require('moment');var BPromise=require(_0x50b1('0x4'));var rp=require(_0x50b1('0x5'));var fs=require('fs');var path=require(_0x50b1('0x6'));var rimraf=require(_0x50b1('0x7'));var config=require(_0x50b1('0x8'));var attributes=require(_0x50b1('0x9'));module[_0x50b1('0xa')]=function(_0x433d9a,_0x2d1ef7){return _0x433d9a[_0x50b1('0xb')](_0x50b1('0xc'),attributes,{'tableName':_0x50b1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf01b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf01b,0x167));var _0xbf01=function(_0x5da11b,_0x2ab0b6){_0x5da11b=_0x5da11b-0x0;var _0x190c95=_0xf01b[_0x5da11b];return _0x190c95;};'use strict';var _=require('lodash');var util=require(_0xbf01('0x0'));var logger=require(_0xbf01('0x1'))(_0xbf01('0x2'));var moment=require(_0xbf01('0x3'));var BPromise=require(_0xbf01('0x4'));var rp=require(_0xbf01('0x5'));var fs=require('fs');var path=require(_0xbf01('0x6'));var rimraf=require(_0xbf01('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf01('0x8'));module[_0xbf01('0x9')]=function(_0x56f752,_0x190e91){return _0x56f752['define'](_0xbf01('0xa'),attributes,{'tableName':_0xbf01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 481f631..1956f40 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf277=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','debug','request\x20sent','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xf277,0x1e1));var _0x7f27=function(_0x3fb538,_0x47a2d3){_0x3fb538=_0x3fb538-0x0;var _0x2d45d5=_0xf277[_0x3fb538];return _0x2d45d5;};'use strict';var _=require(_0x7f27('0x0'));var util=require(_0x7f27('0x1'));var moment=require('moment');var BPromise=require(_0x7f27('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f27('0x3'));var db=require(_0x7f27('0x4'))['db'];var utils=require(_0x7f27('0x5'));var logger=require(_0x7f27('0x6'))(_0x7f27('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f27('0x8'));var client=jayson['client'][_0x7f27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39dcee,_0x480cd6,_0x23dbcc){return new BPromise(function(_0x25c4dc,_0x5c0dbb){return client[_0x7f27('0xa')](_0x39dcee,_0x23dbcc)[_0x7f27('0xb')](function(_0x8ecc84){logger[_0x7f27('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x480cd6,'request\x20sent');logger[_0x7f27('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x480cd6,_0x7f27('0xe'),JSON[_0x7f27('0xf')](_0x8ecc84));if(_0x8ecc84[_0x7f27('0x10')]){if(_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x11')]===0x1f4){logger[_0x7f27('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x480cd6,_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x12')]);return _0x5c0dbb(_0x8ecc84['error'][_0x7f27('0x12')]);}logger[_0x7f27('0x10')](_0x7f27('0x13'),_0x480cd6,_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x12')]);return _0x25c4dc(_0x8ecc84[_0x7f27('0x10')][_0x7f27('0x12')]);}else{logger[_0x7f27('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x480cd6,_0x7f27('0xe'));_0x25c4dc(_0x8ecc84[_0x7f27('0x14')]['message']);}})[_0x7f27('0x15')](function(_0x402610){logger['error'](_0x7f27('0x13'),_0x480cd6,_0x402610);_0x5c0dbb(_0x402610);});});} \ No newline at end of file +var _0x6dc0=['rpc','../../config/environment','client','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa3d7b,_0x4cc9e9){var _0x46a6e0=function(_0x3e6262){while(--_0x3e6262){_0xa3d7b['push'](_0xa3d7b['shift']());}};_0x46a6e0(++_0x4cc9e9);}(_0x6dc0,0xb6));var _0x06dc=function(_0x3a237e,_0x1a40ee){_0x3a237e=_0x3a237e-0x0;var _0x2af3fc=_0x6dc0[_0x3a237e];return _0x2af3fc;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require(_0x06dc('0x6'));var logger=require('../../config/logger')(_0x06dc('0x7'));var config=require(_0x06dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419534,_0x3212ca,_0x14c15b){return new BPromise(function(_0x10e23b,_0x140eef){return client['request'](_0x419534,_0x14c15b)['then'](function(_0x480f30){logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,'request\x20sent');logger[_0x06dc('0xc')](_0x06dc('0xd'),_0x3212ca,_0x06dc('0xe'),JSON[_0x06dc('0xf')](_0x480f30));if(_0x480f30['error']){if(_0x480f30[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3212ca,_0x480f30['error']['message']);return _0x140eef(_0x480f30[_0x06dc('0x10')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3212ca,_0x480f30[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x10e23b(_0x480f30[_0x06dc('0x10')]['message']);}else{logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,_0x06dc('0xe'));_0x10e23b(_0x480f30[_0x06dc('0x13')]['message']);}})[_0x06dc('0x14')](function(_0x30c1c5){logger[_0x06dc('0x10')](_0x06dc('0xb'),_0x3212ca,_0x30c1c5);_0x140eef(_0x30c1c5);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2d2067e..2da3f51 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c99=['Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x9ed33,_0x55c13d){var _0x564e30=function(_0x4cf308){while(--_0x4cf308){_0x9ed33['push'](_0x9ed33['shift']());}};_0x564e30(++_0x55c13d);}(_0x3c99,0x118));var _0x93c9=function(_0x30ee69,_0x364778){_0x30ee69=_0x30ee69-0x0;var _0x299333=_0x3c99[_0x30ee69];return _0x299333;};'use strict';var multer=require(_0x93c9('0x0'));var util=require(_0x93c9('0x1'));var path=require(_0x93c9('0x2'));var timeout=require(_0x93c9('0x3'));var express=require(_0x93c9('0x4'));var router=express[_0x93c9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x93c9('0x6'));var interaction=require(_0x93c9('0x7'));var config=require('../../config/environment');var controller=require(_0x93c9('0x8'));router[_0x93c9('0x9')]('/',auth['isAuthenticated'](),controller[_0x93c9('0xa')]);router['get'](_0x93c9('0xb'),auth[_0x93c9('0xc')](),controller[_0x93c9('0xd')]);router[_0x93c9('0xe')]('/',auth[_0x93c9('0xc')](),controller[_0x93c9('0xf')]);router[_0x93c9('0x10')](_0x93c9('0xb'),auth[_0x93c9('0xc')](),controller['update']);router[_0x93c9('0x11')](_0x93c9('0xb'),auth[_0x93c9('0xc')](),controller[_0x93c9('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb675=['isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./intDeskField.controller','get'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xb675,0xe6));var _0x5b67=function(_0x2093f0,_0x1f903c){_0x2093f0=_0x2093f0-0x0;var _0x37829f=_0xb675[_0x2093f0];return _0x37829f;};'use strict';var multer=require(_0x5b67('0x0'));var util=require('util');var path=require(_0x5b67('0x1'));var timeout=require(_0x5b67('0x2'));var express=require(_0x5b67('0x3'));var router=express['Router']();var fs_extra=require(_0x5b67('0x4'));var auth=require(_0x5b67('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b67('0x6'));router[_0x5b67('0x7')]('/',auth[_0x5b67('0x8')](),controller[_0x5b67('0x9')]);router[_0x5b67('0x7')]('/:id',auth[_0x5b67('0x8')](),controller[_0x5b67('0xa')]);router[_0x5b67('0xb')]('/',auth[_0x5b67('0x8')](),controller['create']);router[_0x5b67('0xc')](_0x5b67('0xd'),auth[_0x5b67('0x8')](),controller[_0x5b67('0xe')]);router[_0x5b67('0xf')]('/:id',auth[_0x5b67('0x8')](),controller['destroy']);module[_0x5b67('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 7061f7d..0ebb13e 100644 --- a/server/api/intDeskField/intDeskField.attributes.js +++ b/server/api/intDeskField/intDeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0735=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0735,0x142));var _0x5073=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x0735[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x5073('0x0'));module[_0x5073('0x1')]={'type':{'type':Sequelize[_0x5073('0x2')](_0x5073('0x3'),_0x5073('0x4'),_0x5073('0x5'),'keyValue',_0x5073('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5073('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5073('0x2')](_0x5073('0x3'),'variable',_0x5073('0x5'))},'keyContent':{'type':Sequelize[_0x5073('0x7')]},'idField':{'type':Sequelize[_0x5073('0x7')]},'nameField':{'type':Sequelize[_0x5073('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5073('0x7')]}}; \ No newline at end of file +var _0x90a0=['string','variable','customVariable','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x2286ca,_0x59fe4d){var _0x25d019=function(_0x455398){while(--_0x455398){_0x2286ca['push'](_0x2286ca['shift']());}};_0x25d019(++_0x59fe4d);}(_0x90a0,0x147));var _0x090a=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x90a0[_0x49c057];return _0xd8f0e6;};'use strict';var Sequelize=require(_0x090a('0x0'));module['exports']={'type':{'type':Sequelize[_0x090a('0x1')](_0x090a('0x2'),_0x090a('0x3'),_0x090a('0x4'),'keyValue','picklist'),'defaultValue':_0x090a('0x2')},'content':{'type':Sequelize[_0x090a('0x5')]},'key':{'type':Sequelize[_0x090a('0x5')]},'keyType':{'type':Sequelize[_0x090a('0x1')]('string',_0x090a('0x3'),_0x090a('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x090a('0x5')]},'customField':{'type':Sequelize[_0x090a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x090a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5ab3235..8761674 100644 --- a/server/api/intDeskField/intDeskField.controller.js +++ b/server/api/intDeskField/intDeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c75=['send','index','map','DeskField','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','update','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','end','error','stack','name'];(function(_0x59f468,_0x67a096){var _0x296f40=function(_0x3660a7){while(--_0x3660a7){_0x59f468['push'](_0x59f468['shift']());}};_0x296f40(++_0x67a096);}(_0x0c75,0x6a));var _0x50c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0c75[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50c7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50c7('0x1'));var rp=require(_0x50c7('0x2'));var moment=require(_0x50c7('0x3'));var BPromise=require(_0x50c7('0x4'));var Mustache=require(_0x50c7('0x5'));var util=require(_0x50c7('0x6'));var path=require(_0x50c7('0x7'));var sox=require('sox');var csv=require(_0x50c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50c7('0x9'));var _=require('lodash');var squel=require(_0x50c7('0xa'));var crypto=require(_0x50c7('0xb'));var jsforce=require(_0x50c7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50c7('0xd'));var Papa=require(_0x50c7('0xe'));var Redis=require(_0x50c7('0xf'));var authService=require(_0x50c7('0x10'));var qs=require(_0x50c7('0x11'));var as=require(_0x50c7('0x12'));var hardwareService=require(_0x50c7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x50c7('0x14'));var config=require(_0x50c7('0x15'));var licenseUtil=require(_0x50c7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a6ef2,_0x18fb52){_0x18fb52=_0x18fb52||0xcc;return function(_0x1d98cc){if(_0x1d98cc){return _0x2a6ef2[_0x50c7('0x17')](_0x18fb52);}return _0x2a6ef2[_0x50c7('0x18')](_0x18fb52)['end']();};}function respondWithResult(_0x5a3652,_0x2d27dc){_0x2d27dc=_0x2d27dc||0xc8;return function(_0x303a64){if(_0x303a64){return _0x5a3652['status'](_0x2d27dc)[_0x50c7('0x19')](_0x303a64);}};}function respondWithFilteredResult(_0x1f1db1,_0x19ce5e){return function(_0x4f092a){if(_0x4f092a){var _0x552ffe=typeof _0x19ce5e[_0x50c7('0x1a')]===_0x50c7('0x1b')&&typeof _0x19ce5e[_0x50c7('0x1c')]==='undefined';var _0x473375=_0x4f092a[_0x50c7('0x1d')];var _0x42a89b=_0x552ffe?0x0:_0x19ce5e['offset'];var _0xd5b365=_0x552ffe?_0x4f092a['count']:_0x19ce5e[_0x50c7('0x1a')]+_0x19ce5e[_0x50c7('0x1c')];var _0x3187ab;if(_0xd5b365>=_0x473375){_0xd5b365=_0x473375;_0x3187ab=0xc8;}else{_0x3187ab=0xce;}_0x1f1db1[_0x50c7('0x18')](_0x3187ab);return _0x1f1db1['set'](_0x50c7('0x1e'),_0x42a89b+'-'+_0xd5b365+'/'+_0x473375)[_0x50c7('0x19')](_0x4f092a);}return null;};}function patchUpdates(_0x3cc394){return function(_0xdea1fd){try{jsonpatch[_0x50c7('0x1f')](_0xdea1fd,_0x3cc394,!![]);}catch(_0x118a42){return BPromise['reject'](_0x118a42);}return _0xdea1fd[_0x50c7('0x20')]();};}function saveUpdates(_0x3b4416,_0x407610){return function(_0xf1d836){if(_0xf1d836){return _0xf1d836['update'](_0x3b4416)[_0x50c7('0x21')](function(_0x54b79b){return _0x54b79b;});}return null;};}function removeEntity(_0x34d1bd,_0x27f949){return function(_0x3bfad2){if(_0x3bfad2){return _0x3bfad2['destroy']()['then'](function(){_0x34d1bd[_0x50c7('0x18')](0xcc)[_0x50c7('0x22')]();});}};}function handleEntityNotFound(_0x57da40,_0x1dab62){return function(_0x324874){if(!_0x324874){_0x57da40['sendStatus'](0x194);}return _0x324874;};}function handleError(_0x38663e,_0x2820bc){_0x2820bc=_0x2820bc||0x1f4;return function(_0x5349a0){logger[_0x50c7('0x23')](_0x5349a0[_0x50c7('0x24')]);if(_0x5349a0[_0x50c7('0x25')]){delete _0x5349a0[_0x50c7('0x25')];}_0x38663e['status'](_0x2820bc)[_0x50c7('0x26')](_0x5349a0);};}exports[_0x50c7('0x27')]=function(_0x255087,_0x2d4417){var _0x1e339d={},_0x255418={},_0xa5c834={'count':0x0,'rows':[]};var _0x59045e=_[_0x50c7('0x28')](db[_0x50c7('0x29')][_0x50c7('0x2a')],function(_0x23d2ee){return{'name':_0x23d2ee[_0x50c7('0x2b')],'type':_0x23d2ee[_0x50c7('0x2c')]['key']};});_0x255418[_0x50c7('0x2d')]=_['map'](_0x59045e,'name');_0x255418['query']=_[_0x50c7('0x2e')](_0x255087[_0x50c7('0x2f')]);_0x255418[_0x50c7('0x30')]=_['intersection'](_0x255418[_0x50c7('0x2d')],_0x255418[_0x50c7('0x2f')]);_0x1e339d[_0x50c7('0x31')]=_[_0x50c7('0x32')](_0x255418['model'],qs['fields'](_0x255087[_0x50c7('0x2f')][_0x50c7('0x33')]));_0x1e339d[_0x50c7('0x31')]=_0x1e339d[_0x50c7('0x31')][_0x50c7('0x34')]?_0x1e339d[_0x50c7('0x31')]:_0x255418[_0x50c7('0x2d')];if(!_0x255087[_0x50c7('0x2f')][_0x50c7('0x35')]('nolimit')){_0x1e339d['limit']=qs[_0x50c7('0x1c')](_0x255087[_0x50c7('0x2f')][_0x50c7('0x1c')]);_0x1e339d[_0x50c7('0x1a')]=qs['offset'](_0x255087['query'][_0x50c7('0x1a')]);}_0x1e339d[_0x50c7('0x36')]=qs['sort'](_0x255087[_0x50c7('0x2f')][_0x50c7('0x37')]);_0x1e339d[_0x50c7('0x38')]=qs[_0x50c7('0x30')](_[_0x50c7('0x39')](_0x255087[_0x50c7('0x2f')],_0x255418['filters']),_0x59045e);if(_0x255087[_0x50c7('0x2f')][_0x50c7('0x3a')]){_0x1e339d[_0x50c7('0x38')]=_[_0x50c7('0x3b')](_0x1e339d['where'],{'$or':_[_0x50c7('0x28')](_0x59045e,function(_0x50f91a){if(_0x50f91a[_0x50c7('0x2c')]!=='VIRTUAL'){var _0x1237d9={};_0x1237d9[_0x50f91a[_0x50c7('0x25')]]={'$like':'%'+_0x255087['query'][_0x50c7('0x3a')]+'%'};return _0x1237d9;}})});}_0x1e339d=_[_0x50c7('0x3b')]({},_0x1e339d,_0x255087[_0x50c7('0x3c')]);var _0x36fe9a={'where':_0x1e339d[_0x50c7('0x38')]};return db['DeskField']['count'](_0x36fe9a)[_0x50c7('0x21')](function(_0x218742){_0xa5c834[_0x50c7('0x1d')]=_0x218742;if(_0x255087['query'][_0x50c7('0x3d')]){_0x1e339d[_0x50c7('0x3e')]=[{'all':!![]}];}return db[_0x50c7('0x29')]['findAll'](_0x1e339d);})[_0x50c7('0x21')](function(_0xc4c6fd){_0xa5c834[_0x50c7('0x3f')]=_0xc4c6fd;return _0xa5c834;})[_0x50c7('0x21')](respondWithFilteredResult(_0x2d4417,_0x1e339d))[_0x50c7('0x40')](handleError(_0x2d4417,null));};exports[_0x50c7('0x41')]=function(_0x5e52bd,_0x256314){var _0x324dc5={'raw':!![],'where':{'id':_0x5e52bd[_0x50c7('0x42')]['id']}},_0x245a21={};_0x245a21['model']=_[_0x50c7('0x2e')](db[_0x50c7('0x29')][_0x50c7('0x2a')]);_0x245a21['query']=_[_0x50c7('0x2e')](_0x5e52bd[_0x50c7('0x2f')]);_0x245a21['filters']=_[_0x50c7('0x32')](_0x245a21[_0x50c7('0x2d')],_0x245a21[_0x50c7('0x2f')]);_0x324dc5[_0x50c7('0x31')]=_['intersection'](_0x245a21[_0x50c7('0x2d')],qs[_0x50c7('0x33')](_0x5e52bd[_0x50c7('0x2f')][_0x50c7('0x33')]));_0x324dc5[_0x50c7('0x31')]=_0x324dc5[_0x50c7('0x31')][_0x50c7('0x34')]?_0x324dc5[_0x50c7('0x31')]:_0x245a21[_0x50c7('0x2d')];if(_0x5e52bd[_0x50c7('0x2f')][_0x50c7('0x3d')]){_0x324dc5['include']=[{'all':!![]}];}_0x324dc5=_['merge']({},_0x324dc5,_0x5e52bd[_0x50c7('0x3c')]);return db[_0x50c7('0x29')][_0x50c7('0x43')](_0x324dc5)[_0x50c7('0x21')](handleEntityNotFound(_0x256314,null))[_0x50c7('0x21')](respondWithResult(_0x256314,null))[_0x50c7('0x40')](handleError(_0x256314,null));};exports[_0x50c7('0x44')]=function(_0x6af317,_0x549d3b){return db[_0x50c7('0x29')][_0x50c7('0x44')](_0x6af317['body'],{})['then'](respondWithResult(_0x549d3b,0xc9))[_0x50c7('0x40')](handleError(_0x549d3b,null));};exports[_0x50c7('0x45')]=function(_0x559e44,_0x41e7d2){if(_0x559e44['body']['id']){delete _0x559e44['body']['id'];}return db[_0x50c7('0x29')]['find']({'where':{'id':_0x559e44[_0x50c7('0x42')]['id']}})[_0x50c7('0x21')](handleEntityNotFound(_0x41e7d2,null))['then'](saveUpdates(_0x559e44[_0x50c7('0x46')],null))[_0x50c7('0x21')](respondWithResult(_0x41e7d2,null))[_0x50c7('0x40')](handleError(_0x41e7d2,null));};exports[_0x50c7('0x47')]=function(_0xce8a9d,_0x521d05){return db[_0x50c7('0x29')][_0x50c7('0x43')]({'where':{'id':_0xce8a9d[_0x50c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x521d05,null))[_0x50c7('0x21')](removeEntity(_0x521d05,null))[_0x50c7('0x40')](handleError(_0x521d05,null));}; \ No newline at end of file +var _0x44ff=['filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','rimraf','zip-dir','fast-json-patch','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick'];(function(_0x4894a7,_0x1baec8){var _0x14e86c=function(_0x3b0b02){while(--_0x3b0b02){_0x4894a7['push'](_0x4894a7['shift']());}};_0x14e86c(++_0x1baec8);}(_0x44ff,0x1c3));var _0xf44f=function(_0x41e33d,_0x5a1a6e){_0x41e33d=_0x41e33d-0x0;var _0x50ac34=_0x44ff[_0x41e33d];return _0x50ac34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf44f('0x0'));var zipdir=require(_0xf44f('0x1'));var jsonpatch=require(_0xf44f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf44f('0x3'));var path=require(_0xf44f('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf44f('0x5'));var fs=require('fs');var fs_extra=require(_0xf44f('0x6'));var _=require(_0xf44f('0x7'));var squel=require('squel');var crypto=require(_0xf44f('0x8'));var jsforce=require(_0xf44f('0x9'));var deskjs=require(_0xf44f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf44f('0xb'));var Papa=require(_0xf44f('0xc'));var Redis=require(_0xf44f('0xd'));var authService=require(_0xf44f('0xe'));var qs=require(_0xf44f('0xf'));var as=require(_0xf44f('0x10'));var hardwareService=require(_0xf44f('0x11'));var logger=require(_0xf44f('0x12'))(_0xf44f('0x13'));var utils=require(_0xf44f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf44f('0x15'));var db=require(_0xf44f('0x16'))['db'];function respondWithStatusCode(_0x23b73a,_0x34d3da){_0x34d3da=_0x34d3da||0xcc;return function(_0x10176f){if(_0x10176f){return _0x23b73a[_0xf44f('0x17')](_0x34d3da);}return _0x23b73a[_0xf44f('0x18')](_0x34d3da)['end']();};}function respondWithResult(_0x5d2b86,_0x17e828){_0x17e828=_0x17e828||0xc8;return function(_0x5f20aa){if(_0x5f20aa){return _0x5d2b86['status'](_0x17e828)['json'](_0x5f20aa);}};}function respondWithFilteredResult(_0x3aa2b8,_0x1d2d77){return function(_0x409907){if(_0x409907){var _0x1a5ce4=typeof _0x1d2d77['offset']===_0xf44f('0x19')&&typeof _0x1d2d77['limit']===_0xf44f('0x19');var _0x40e414=_0x409907[_0xf44f('0x1a')];var _0x15e5b6=_0x1a5ce4?0x0:_0x1d2d77['offset'];var _0x4f0338=_0x1a5ce4?_0x409907['count']:_0x1d2d77['offset']+_0x1d2d77[_0xf44f('0x1b')];var _0x4f0292;if(_0x4f0338>=_0x40e414){_0x4f0338=_0x40e414;_0x4f0292=0xc8;}else{_0x4f0292=0xce;}_0x3aa2b8['status'](_0x4f0292);return _0x3aa2b8[_0xf44f('0x1c')](_0xf44f('0x1d'),_0x15e5b6+'-'+_0x4f0338+'/'+_0x40e414)[_0xf44f('0x1e')](_0x409907);}return null;};}function patchUpdates(_0x515ea6){return function(_0x1c317e){try{jsonpatch[_0xf44f('0x1f')](_0x1c317e,_0x515ea6,!![]);}catch(_0x5eb768){return BPromise[_0xf44f('0x20')](_0x5eb768);}return _0x1c317e['save']();};}function saveUpdates(_0x1cc24e,_0x166acd){return function(_0x3e0b9c){if(_0x3e0b9c){return _0x3e0b9c['update'](_0x1cc24e)[_0xf44f('0x21')](function(_0x1b9dc9){return _0x1b9dc9;});}return null;};}function removeEntity(_0x329ed3,_0x58d4af){return function(_0x1ba9c0){if(_0x1ba9c0){return _0x1ba9c0[_0xf44f('0x22')]()[_0xf44f('0x21')](function(){_0x329ed3[_0xf44f('0x18')](0xcc)[_0xf44f('0x23')]();});}};}function handleEntityNotFound(_0x5313f5,_0x3c04fe){return function(_0x2a17e0){if(!_0x2a17e0){_0x5313f5[_0xf44f('0x17')](0x194);}return _0x2a17e0;};}function handleError(_0x2fe533,_0x5b9c45){_0x5b9c45=_0x5b9c45||0x1f4;return function(_0x1af2a2){logger[_0xf44f('0x24')](_0x1af2a2[_0xf44f('0x25')]);if(_0x1af2a2[_0xf44f('0x26')]){delete _0x1af2a2[_0xf44f('0x26')];}_0x2fe533[_0xf44f('0x18')](_0x5b9c45)['send'](_0x1af2a2);};}exports[_0xf44f('0x27')]=function(_0x5255eb,_0x2f5075){var _0x14e6cf={},_0x5a5a83={},_0x544f32={'count':0x0,'rows':[]};var _0x11d199=_[_0xf44f('0x28')](db[_0xf44f('0x29')][_0xf44f('0x2a')],function(_0x549fdd){return{'name':_0x549fdd[_0xf44f('0x2b')],'type':_0x549fdd[_0xf44f('0x2c')]['key']};});_0x5a5a83[_0xf44f('0x2d')]=_[_0xf44f('0x28')](_0x11d199,_0xf44f('0x26'));_0x5a5a83[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x5255eb[_0xf44f('0x2e')]);_0x5a5a83[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],_0x5a5a83[_0xf44f('0x2e')]);_0x14e6cf['attributes']=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],qs['fields'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x32')]));_0x14e6cf[_0xf44f('0x33')]=_0x14e6cf[_0xf44f('0x33')][_0xf44f('0x34')]?_0x14e6cf['attributes']:_0x5a5a83[_0xf44f('0x2d')];if(!_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x35')](_0xf44f('0x36'))){_0x14e6cf[_0xf44f('0x1b')]=qs[_0xf44f('0x1b')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x1b')]);_0x14e6cf[_0xf44f('0x37')]=qs['offset'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x37')]);}_0x14e6cf[_0xf44f('0x38')]=qs[_0xf44f('0x39')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x39')]);_0x14e6cf[_0xf44f('0x3a')]=qs[_0xf44f('0x30')](_[_0xf44f('0x3b')](_0x5255eb[_0xf44f('0x2e')],_0x5a5a83[_0xf44f('0x30')]),_0x11d199);if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x3c')]){_0x14e6cf[_0xf44f('0x3a')]=_[_0xf44f('0x3d')](_0x14e6cf[_0xf44f('0x3a')],{'$or':_[_0xf44f('0x28')](_0x11d199,function(_0x37f274){if(_0x37f274[_0xf44f('0x2c')]!==_0xf44f('0x3e')){var _0x460308={};_0x460308[_0x37f274[_0xf44f('0x26')]]={'$like':'%'+_0x5255eb[_0xf44f('0x2e')]['filter']+'%'};return _0x460308;}})});}_0x14e6cf=_[_0xf44f('0x3d')]({},_0x14e6cf,_0x5255eb[_0xf44f('0x3f')]);var _0x1df436={'where':_0x14e6cf[_0xf44f('0x3a')]};return db['DeskField'][_0xf44f('0x1a')](_0x1df436)['then'](function(_0x54fd2f){_0x544f32[_0xf44f('0x1a')]=_0x54fd2f;if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x40')]){_0x14e6cf[_0xf44f('0x41')]=[{'all':!![]}];}return db[_0xf44f('0x29')]['findAll'](_0x14e6cf);})[_0xf44f('0x21')](function(_0x32e8e0){_0x544f32['rows']=_0x32e8e0;return _0x544f32;})[_0xf44f('0x21')](respondWithFilteredResult(_0x2f5075,_0x14e6cf))[_0xf44f('0x42')](handleError(_0x2f5075,null));};exports[_0xf44f('0x43')]=function(_0x524d57,_0x11c508){var _0x502a21={'raw':!![],'where':{'id':_0x524d57[_0xf44f('0x44')]['id']}},_0x28717a={};_0x28717a['model']=_[_0xf44f('0x2f')](db[_0xf44f('0x29')][_0xf44f('0x2a')]);_0x28717a[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x524d57[_0xf44f('0x2e')]);_0x28717a[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x28717a['model'],_0x28717a[_0xf44f('0x2e')]);_0x502a21[_0xf44f('0x33')]=_[_0xf44f('0x31')](_0x28717a[_0xf44f('0x2d')],qs[_0xf44f('0x32')](_0x524d57[_0xf44f('0x2e')]['fields']));_0x502a21[_0xf44f('0x33')]=_0x502a21[_0xf44f('0x33')][_0xf44f('0x34')]?_0x502a21['attributes']:_0x28717a[_0xf44f('0x2d')];if(_0x524d57['query'][_0xf44f('0x40')]){_0x502a21[_0xf44f('0x41')]=[{'all':!![]}];}_0x502a21=_[_0xf44f('0x3d')]({},_0x502a21,_0x524d57['options']);return db[_0xf44f('0x29')][_0xf44f('0x45')](_0x502a21)[_0xf44f('0x21')](handleEntityNotFound(_0x11c508,null))['then'](respondWithResult(_0x11c508,null))['catch'](handleError(_0x11c508,null));};exports[_0xf44f('0x46')]=function(_0x2cb20c,_0x193dbd){return db[_0xf44f('0x29')][_0xf44f('0x46')](_0x2cb20c[_0xf44f('0x47')],{})[_0xf44f('0x21')](respondWithResult(_0x193dbd,0xc9))['catch'](handleError(_0x193dbd,null));};exports[_0xf44f('0x48')]=function(_0x30e382,_0x5a80fc){if(_0x30e382['body']['id']){delete _0x30e382['body']['id'];}return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x30e382[_0xf44f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a80fc,null))['then'](saveUpdates(_0x30e382[_0xf44f('0x47')],null))[_0xf44f('0x21')](respondWithResult(_0x5a80fc,null))[_0xf44f('0x42')](handleError(_0x5a80fc,null));};exports[_0xf44f('0x22')]=function(_0x1ecff0,_0x55a038){return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x1ecff0['params']['id']}})[_0xf44f('0x21')](handleEntityNotFound(_0x55a038,null))['then'](removeEntity(_0x55a038,null))[_0xf44f('0x42')](handleError(_0x55a038,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4261bf9..a8fc154 100644 --- a/server/api/intDeskField/intDeskField.model.js +++ b/server/api/intDeskField/intDeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6868=['./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xaeff8a,_0x506724){var _0x8a6ce3=function(_0x237855){while(--_0x237855){_0xaeff8a['push'](_0xaeff8a['shift']());}};_0x8a6ce3(++_0x506724);}(_0x6868,0x1ca));var _0x8686=function(_0x2250bf,_0x401be6){_0x2250bf=_0x2250bf-0x0;var _0x5746bc=_0x6868[_0x2250bf];return _0x5746bc;};'use strict';var _=require(_0x8686('0x0'));var util=require(_0x8686('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8686('0x2'));var BPromise=require(_0x8686('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8686('0x4'));var rimraf=require(_0x8686('0x5'));var config=require(_0x8686('0x6'));var attributes=require(_0x8686('0x7'));module[_0x8686('0x8')]=function(_0xf6a011,_0x5a613f){return _0xf6a011[_0x8686('0x9')](_0x8686('0xa'),attributes,{'tableName':_0x8686('0xb'),'paranoid':![],'indexes':[{'name':_0x8686('0xc'),'fields':[_0x8686('0xd'),_0x8686('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcca2=['request-promise','rimraf','../../config/environment','define','DeskField','int_desk_fields','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x215ac9,_0x10b184){var _0x5c8450=function(_0x217493){while(--_0x217493){_0x215ac9['push'](_0x215ac9['shift']());}};_0x5c8450(++_0x10b184);}(_0xcca2,0x157));var _0x2cca=function(_0x489c9c,_0x45b198){_0x489c9c=_0x489c9c-0x0;var _0x7a1da5=_0xcca2[_0x489c9c];return _0x7a1da5;};'use strict';var _=require(_0x2cca('0x0'));var util=require('util');var logger=require(_0x2cca('0x1'))(_0x2cca('0x2'));var moment=require(_0x2cca('0x3'));var BPromise=require(_0x2cca('0x4'));var rp=require(_0x2cca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cca('0x6'));var config=require(_0x2cca('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x589160,_0x2da373){return _0x589160[_0x2cca('0x8')](_0x2cca('0x9'),attributes,{'tableName':_0x2cca('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x2cca('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index f2e4107..de6f15f 100644 --- a/server/api/intDeskField/intDeskField.rpc.js +++ b/server/api/intDeskField/intDeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb04=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x536ca6,_0x2a9a1d){var _0x4afae3=function(_0x3f6cc7){while(--_0x3f6cc7){_0x536ca6['push'](_0x536ca6['shift']());}};_0x4afae3(++_0x2a9a1d);}(_0xbb04,0xe5));var _0x4bb0=function(_0x12b859,_0x40804e){_0x12b859=_0x12b859-0x0;var _0x867976=_0xbb04[_0x12b859];return _0x867976;};'use strict';var _=require(_0x4bb0('0x0'));var util=require(_0x4bb0('0x1'));var moment=require(_0x4bb0('0x2'));var BPromise=require(_0x4bb0('0x3'));var rs=require(_0x4bb0('0x4'));var fs=require('fs');var Redis=require(_0x4bb0('0x5'));var db=require(_0x4bb0('0x6'))['db'];var utils=require(_0x4bb0('0x7'));var logger=require(_0x4bb0('0x8'))(_0x4bb0('0x9'));var config=require(_0x4bb0('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4bb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4252cc,_0x49594a,_0x246124){return new BPromise(function(_0x8dfa74,_0x5e2c73){return client['request'](_0x4252cc,_0x246124)[_0x4bb0('0xc')](function(_0x266b71){logger[_0x4bb0('0xd')](_0x4bb0('0xe'),_0x49594a,_0x4bb0('0xf'));logger[_0x4bb0('0x10')](_0x4bb0('0x11'),_0x49594a,_0x4bb0('0xf'),JSON[_0x4bb0('0x12')](_0x266b71));if(_0x266b71[_0x4bb0('0x13')]){if(_0x266b71['error'][_0x4bb0('0x14')]===0x1f4){logger[_0x4bb0('0x13')](_0x4bb0('0xe'),_0x49594a,_0x266b71['error'][_0x4bb0('0x15')]);return _0x5e2c73(_0x266b71[_0x4bb0('0x13')]['message']);}logger['error'](_0x4bb0('0xe'),_0x49594a,_0x266b71[_0x4bb0('0x13')][_0x4bb0('0x15')]);return _0x8dfa74(_0x266b71['error']['message']);}else{logger[_0x4bb0('0xd')]('DeskField,\x20%s,\x20%s',_0x49594a,_0x4bb0('0xf'));_0x8dfa74(_0x266b71[_0x4bb0('0x16')][_0x4bb0('0x15')]);}})['catch'](function(_0x2ffbd0){logger[_0x4bb0('0x13')]('DeskField,\x20%s,\x20%s',_0x49594a,_0x2ffbd0);_0x5e2c73(_0x2ffbd0);});});} \ No newline at end of file +var _0x9d5b=['jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x9d5b,0x129));var _0xb9d5=function(_0x3ecac5,_0x204271){_0x3ecac5=_0x3ecac5-0x0;var _0x53174a=_0x9d5b[_0x3ecac5];return _0x53174a;};'use strict';var _=require(_0xb9d5('0x0'));var util=require(_0xb9d5('0x1'));var moment=require(_0xb9d5('0x2'));var BPromise=require('bluebird');var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require(_0xb9d5('0x5'))['db'];var utils=require(_0xb9d5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb9d5('0x7'));var client=jayson[_0xb9d5('0x8')][_0xb9d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a59ac,_0x138fea,_0x5a34e6){return new BPromise(function(_0x2b5ae5,_0x540a47){return client['request'](_0x5a59ac,_0x5a34e6)[_0xb9d5('0xa')](function(_0x36ca1e){logger[_0xb9d5('0xb')](_0xb9d5('0xc'),_0x138fea,'request\x20sent');logger['debug'](_0xb9d5('0xd'),_0x138fea,'request\x20sent',JSON[_0xb9d5('0xe')](_0x36ca1e));if(_0x36ca1e['error']){if(_0x36ca1e[_0xb9d5('0xf')][_0xb9d5('0x10')]===0x1f4){logger[_0xb9d5('0xf')](_0xb9d5('0xc'),_0x138fea,_0x36ca1e[_0xb9d5('0xf')][_0xb9d5('0x11')]);return _0x540a47(_0x36ca1e[_0xb9d5('0xf')]['message']);}logger[_0xb9d5('0xf')](_0xb9d5('0xc'),_0x138fea,_0x36ca1e['error'][_0xb9d5('0x11')]);return _0x2b5ae5(_0x36ca1e[_0xb9d5('0xf')][_0xb9d5('0x11')]);}else{logger[_0xb9d5('0xb')](_0xb9d5('0xc'),_0x138fea,'request\x20sent');_0x2b5ae5(_0x36ca1e['result'][_0xb9d5('0x11')]);}})[_0xb9d5('0x12')](function(_0x48fee0){logger[_0xb9d5('0xf')]('DeskField,\x20%s,\x20%s',_0x138fea,_0x48fee0);_0x540a47(_0x48fee0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index fb9a1fa..ee2a03f 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3159=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x3159,0x153));var _0x9315=function(_0x479f47,_0x3d619a){_0x479f47=_0x479f47-0x0;var _0xc3fac2=_0x3159[_0x479f47];return _0xc3fac2;};'use strict';var multer=require(_0x9315('0x0'));var util=require(_0x9315('0x1'));var path=require(_0x9315('0x2'));var timeout=require(_0x9315('0x3'));var express=require(_0x9315('0x4'));var router=express[_0x9315('0x5')]();var fs_extra=require(_0x9315('0x6'));var auth=require(_0x9315('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9315('0x8'));var controller=require(_0x9315('0x9'));router[_0x9315('0xa')]('/',auth[_0x9315('0xb')](),controller['index']);router[_0x9315('0xa')](_0x9315('0xc'),auth[_0x9315('0xb')](),controller[_0x9315('0xd')]);router[_0x9315('0xa')](_0x9315('0xe'),auth[_0x9315('0xb')](),controller[_0x9315('0xf')]);router[_0x9315('0xa')](_0x9315('0x10'),auth[_0x9315('0xb')](),controller['getFields']);router[_0x9315('0x11')]('/',auth[_0x9315('0xb')](),controller[_0x9315('0x12')]);router[_0x9315('0x11')](_0x9315('0xe'),auth[_0x9315('0xb')](),controller[_0x9315('0x13')]);router[_0x9315('0x14')](_0x9315('0xc'),auth[_0x9315('0xb')](),controller['update']);router[_0x9315('0x15')](_0x9315('0xc'),auth[_0x9315('0xb')](),controller[_0x9315('0x16')]);module[_0x9315('0x17')]=router; \ No newline at end of file +var _0x6bc1=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports'];(function(_0x4e1352,_0x253d91){var _0x5b4792=function(_0x5c573b){while(--_0x5c573b){_0x4e1352['push'](_0x4e1352['shift']());}};_0x5b4792(++_0x253d91);}(_0x6bc1,0x1e6));var _0x16bc=function(_0x1d8377,_0x4a504d){_0x1d8377=_0x1d8377-0x0;var _0xc2420e=_0x6bc1[_0x1d8377];return _0xc2420e;};'use strict';var multer=require(_0x16bc('0x0'));var util=require(_0x16bc('0x1'));var path=require('path');var timeout=require(_0x16bc('0x2'));var express=require(_0x16bc('0x3'));var router=express[_0x16bc('0x4')]();var fs_extra=require(_0x16bc('0x5'));var auth=require(_0x16bc('0x6'));var interaction=require(_0x16bc('0x7'));var config=require(_0x16bc('0x8'));var controller=require(_0x16bc('0x9'));router[_0x16bc('0xa')]('/',auth[_0x16bc('0xb')](),controller[_0x16bc('0xc')]);router[_0x16bc('0xa')](_0x16bc('0xd'),auth['isAuthenticated'](),controller[_0x16bc('0xe')]);router[_0x16bc('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x16bc('0xf')]);router['get'](_0x16bc('0x10'),auth['isAuthenticated'](),controller[_0x16bc('0x11')]);router[_0x16bc('0x12')]('/',auth[_0x16bc('0xb')](),controller[_0x16bc('0x13')]);router['post'](_0x16bc('0x14'),auth[_0x16bc('0xb')](),controller[_0x16bc('0x15')]);router[_0x16bc('0x16')]('/:id',auth[_0x16bc('0xb')](),controller[_0x16bc('0x17')]);router[_0x16bc('0x18')](_0x16bc('0xd'),auth[_0x16bc('0xb')](),controller[_0x16bc('0x19')]);module[_0x16bc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index cc012ac..b139da4 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf07=['exports','STRING','sequelize'];(function(_0x3166f3,_0x288e32){var _0x21f2f2=function(_0x2d8830){while(--_0x2d8830){_0x3166f3['push'](_0x3166f3['shift']());}};_0x21f2f2(++_0x288e32);}(_0xbf07,0x77));var _0x7bf0=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xbf07[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0x7bf0('0x0'));module[_0x7bf0('0x1')]={'name':{'type':Sequelize[_0x7bf0('0x2')]},'username':{'type':Sequelize[_0x7bf0('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7bf0('0x2')]},'tenantId':{'type':Sequelize[_0x7bf0('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7bf0('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5301=['STRING','exports'];(function(_0x38a5c2,_0x258a39){var _0x360ef2=function(_0xe42636){while(--_0xe42636){_0x38a5c2['push'](_0x38a5c2['shift']());}};_0x360ef2(++_0x258a39);}(_0x5301,0x157));var _0x1530=function(_0x4f9e71,_0x5d1cde){_0x4f9e71=_0x4f9e71-0x0;var _0x3fda11=_0x5301[_0x4f9e71];return _0x3fda11;};'use strict';var Sequelize=require('sequelize');module[_0x1530('0x0')]={'name':{'type':Sequelize[_0x1530('0x1')]},'username':{'type':Sequelize[_0x1530('0x1')]},'password':{'type':Sequelize[_0x1530('0x1')]},'remoteUri':{'type':Sequelize[_0x1530('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1530('0x1')]},'clientSecret':{'type':Sequelize[_0x1530('0x1')]},'serverUrl':{'type':Sequelize[_0x1530('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1530('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 57e68c5..2a5ecae 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x082b=[')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','false','DisplayName',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','contactidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','send','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value',')/Attributes('];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x082b,0xc1));var _0xb082=function(_0x9e2651,_0x13adf6){_0x9e2651=_0x9e2651-0x0;var _0x41d7b6=_0x082b[_0x9e2651];return _0x41d7b6;};'use strict';var rp=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var _=require(_0xb082('0x2'));var qs=require(_0xb082('0x3'));var logger=require(_0xb082('0x4'))(_0xb082('0x5'));var db=require(_0xb082('0x6'))['db'];var integrations=require(_0xb082('0x7'));function respondWithResult(_0x2b83ae,_0x882836){_0x882836=_0x882836||0xc8;return function(_0x66631c){if(_0x66631c){return _0x2b83ae[_0xb082('0x8')](_0x882836)[_0xb082('0x9')](_0x66631c);}};}function respondWithFilteredResult(_0x16ea68,_0x482b39){return function(_0x521499){if(_0x521499){var _0x1f703a=typeof _0x482b39[_0xb082('0xa')]===_0xb082('0xb')&&typeof _0x482b39['limit']===_0xb082('0xb');var _0x3f136d=_0x521499[_0xb082('0xc')];var _0x4fd615=_0x1f703a?0x0:_0x482b39['offset'];var _0x4a1910=_0x1f703a?_0x521499[_0xb082('0xc')]:_0x482b39[_0xb082('0xa')]+_0x482b39[_0xb082('0xd')];var _0x51254f;if(_0x4a1910>=_0x3f136d){_0x4a1910=_0x3f136d;_0x51254f=0xc8;}else{_0x51254f=0xce;}_0x16ea68[_0xb082('0x8')](_0x51254f);return _0x16ea68[_0xb082('0xe')](_0xb082('0xf'),_0x4fd615+'-'+_0x4a1910+'/'+_0x3f136d)['json'](_0x521499);}return null;};}function saveUpdates(_0xcc5f09){return function(_0x481b5a){if(_0x481b5a){return _0x481b5a[_0xb082('0x10')](_0xcc5f09)[_0xb082('0x11')](function(_0x2f6cbc){return _0x2f6cbc;});}return null;};}function removeEntity(_0x892902){return function(_0x3c6d8c){if(_0x3c6d8c){return _0x3c6d8c[_0xb082('0x12')]()[_0xb082('0x11')](function(){_0x892902[_0xb082('0x8')](0xcc)[_0xb082('0x13')]();});}};}function handleEntityNotFound(_0x136577){return function(_0x536b9c){if(!_0x536b9c){_0x136577[_0xb082('0x14')](0x194);}return _0x536b9c;};}function handleError(_0x2bea16,_0x31f31e){_0x31f31e=_0x31f31e||0x1f4;return function(_0xe44b8c){logger[_0xb082('0x15')](_0xe44b8c[_0xb082('0x16')]);if(_0xe44b8c['name']){delete _0xe44b8c[_0xb082('0x17')];}_0x2bea16[_0xb082('0x8')](_0x31f31e)['send'](_0xe44b8c);};}exports[_0xb082('0x18')]=function(_0x4dcd02,_0x55e7e8){var _0x341fe6={},_0x1dffe2={},_0x150acb={'count':0x0,'rows':[]};var _0x2dcf6f=_[_0xb082('0x19')](db[_0xb082('0x1a')][_0xb082('0x1b')],function(_0x33f00e){return{'name':_0x33f00e[_0xb082('0x1c')],'type':_0x33f00e['type'][_0xb082('0x1d')]};});_0x1dffe2['model']=_[_0xb082('0x19')](_0x2dcf6f,_0xb082('0x17'));_0x1dffe2[_0xb082('0x1e')]=_['keys'](_0x4dcd02[_0xb082('0x1e')]);_0x1dffe2['filters']=_[_0xb082('0x1f')](_0x1dffe2[_0xb082('0x20')],_0x1dffe2['query']);_0x341fe6[_0xb082('0x21')]=_['intersection'](_0x1dffe2[_0xb082('0x20')],qs[_0xb082('0x22')](_0x4dcd02[_0xb082('0x1e')][_0xb082('0x22')]));_0x341fe6[_0xb082('0x21')]=_0x341fe6['attributes'][_0xb082('0x23')]?_0x341fe6[_0xb082('0x21')]:_0x1dffe2[_0xb082('0x20')];if(!_0x4dcd02[_0xb082('0x1e')][_0xb082('0x24')](_0xb082('0x25'))){_0x341fe6[_0xb082('0xd')]=qs['limit'](_0x4dcd02[_0xb082('0x1e')][_0xb082('0xd')]);_0x341fe6[_0xb082('0xa')]=qs[_0xb082('0xa')](_0x4dcd02[_0xb082('0x1e')][_0xb082('0xa')]);}_0x341fe6[_0xb082('0x26')]=qs['sort'](_0x4dcd02[_0xb082('0x1e')][_0xb082('0x27')]);_0x341fe6[_0xb082('0x28')]=qs[_0xb082('0x29')](_[_0xb082('0x2a')](_0x4dcd02[_0xb082('0x1e')],_0x1dffe2['filters']),_0x2dcf6f);if(_0x4dcd02[_0xb082('0x1e')]['filter']){_0x341fe6[_0xb082('0x28')]=_[_0xb082('0x2b')](_0x341fe6['where'],{'$or':_[_0xb082('0x19')](_0x2dcf6f,function(_0x349356){if(_0x349356[_0xb082('0x2c')]!=='VIRTUAL'){var _0x506c9c={};_0x506c9c[_0x349356['name']]={'$like':'%'+_0x4dcd02[_0xb082('0x1e')][_0xb082('0x2d')]+'%'};return _0x506c9c;}})});}_0x341fe6=_['merge']({},_0x341fe6,_0x4dcd02[_0xb082('0x2e')]);var _0x1446df={'where':_0x341fe6[_0xb082('0x28')]};return db['Dynamics365Account'][_0xb082('0xc')](_0x1446df)[_0xb082('0x11')](function(_0x2b2313){_0x150acb['count']=_0x2b2313;if(_0x4dcd02[_0xb082('0x1e')]['includeAll']){_0x341fe6['include']=[{'all':!![]}];}return db[_0xb082('0x1a')][_0xb082('0x2f')](_0x341fe6);})['then'](function(_0xf8f9c2){_0x150acb[_0xb082('0x30')]=_0xf8f9c2;return _0x150acb;})[_0xb082('0x11')](respondWithFilteredResult(_0x55e7e8,_0x341fe6))[_0xb082('0x31')](handleError(_0x55e7e8,null));};exports[_0xb082('0x32')]=function(_0x4b190,_0x58c7f3){var _0x4cd4af={'raw':![],'where':{'id':_0x4b190[_0xb082('0x33')]['id']}},_0x4e3a0={};_0x4e3a0[_0xb082('0x20')]=_[_0xb082('0x34')](db[_0xb082('0x1a')]['rawAttributes']);_0x4e3a0[_0xb082('0x1e')]=_[_0xb082('0x34')](_0x4b190['query']);_0x4e3a0[_0xb082('0x29')]=_[_0xb082('0x1f')](_0x4e3a0[_0xb082('0x20')],_0x4e3a0[_0xb082('0x1e')]);_0x4cd4af[_0xb082('0x21')]=_[_0xb082('0x1f')](_0x4e3a0['model'],qs[_0xb082('0x22')](_0x4b190[_0xb082('0x1e')][_0xb082('0x22')]));_0x4cd4af[_0xb082('0x21')]=_0x4cd4af['attributes']['length']?_0x4cd4af[_0xb082('0x21')]:_0x4e3a0[_0xb082('0x20')];if(_0x4b190[_0xb082('0x1e')][_0xb082('0x35')]){_0x4cd4af[_0xb082('0x36')]=[{'all':!![]}];}_0x4cd4af=_[_0xb082('0x2b')]({},_0x4cd4af,_0x4b190[_0xb082('0x2e')]);return db[_0xb082('0x1a')][_0xb082('0x37')](_0x4cd4af)[_0xb082('0x11')](handleEntityNotFound(_0x58c7f3,null))[_0xb082('0x11')](respondWithResult(_0x58c7f3,null))[_0xb082('0x31')](handleError(_0x58c7f3,null));};exports[_0xb082('0x38')]=function(_0xc18932,_0x5bf1c0){return db['Dynamics365Account'][_0xb082('0x38')](_0xc18932[_0xb082('0x39')],{})[_0xb082('0x11')](respondWithResult(_0x5bf1c0,0xc9))[_0xb082('0x31')](handleError(_0x5bf1c0,null));};exports[_0xb082('0x10')]=function(_0x59a4e9,_0x3efeda){if(_0x59a4e9['body']['id']){delete _0x59a4e9[_0xb082('0x39')]['id'];}return db[_0xb082('0x1a')][_0xb082('0x37')]({'where':{'id':_0x59a4e9[_0xb082('0x33')]['id']}})[_0xb082('0x11')](handleEntityNotFound(_0x3efeda,null))[_0xb082('0x11')](saveUpdates(_0x59a4e9['body'],null))[_0xb082('0x11')](respondWithResult(_0x3efeda,null))[_0xb082('0x31')](handleError(_0x3efeda,null));};exports['destroy']=function(_0x503a8e,_0x266bfa){return db[_0xb082('0x1a')][_0xb082('0x37')]({'where':{'id':_0x503a8e['params']['id']}})[_0xb082('0x11')](handleEntityNotFound(_0x266bfa,null))[_0xb082('0x11')](removeEntity(_0x266bfa,null))[_0xb082('0x31')](handleError(_0x266bfa,null));};exports['getConfigurations']=function(_0x1e6443,_0x5e6004){var _0x45fe12={};var _0x18cdfb={};var _0x13ee40;var _0x5b56e;return db[_0xb082('0x1a')]['findOne']({'where':{'id':_0x1e6443[_0xb082('0x33')]['id']}})[_0xb082('0x11')](handleEntityNotFound(_0x5e6004,null))[_0xb082('0x11')](function(_0x375226){if(_0x375226){_0x13ee40=_0x375226;_0x18cdfb[_0xb082('0x20')]=_[_0xb082('0x34')](db['Dynamics365Configuration'][_0xb082('0x1b')]);_0x18cdfb['query']=_[_0xb082('0x34')](_0x1e6443['query']);_0x18cdfb['filters']=_['intersection'](_0x18cdfb['model'],_0x18cdfb['query']);_0x45fe12['attributes']=_['intersection'](_0x18cdfb[_0xb082('0x20')],qs[_0xb082('0x22')](_0x1e6443[_0xb082('0x1e')][_0xb082('0x22')]));_0x45fe12[_0xb082('0x21')]=_0x45fe12[_0xb082('0x21')][_0xb082('0x23')]?_0x45fe12[_0xb082('0x21')]:_0x18cdfb[_0xb082('0x20')];_0x45fe12[_0xb082('0x26')]=qs[_0xb082('0x27')](_0x1e6443[_0xb082('0x1e')]['sort']);_0x45fe12[_0xb082('0x28')]=qs[_0xb082('0x29')](_[_0xb082('0x2a')](_0x1e6443['query'],_0x18cdfb['filters']));if(_0x1e6443[_0xb082('0x1e')][_0xb082('0x2d')]){_0x45fe12[_0xb082('0x28')]=_[_0xb082('0x2b')](_0x45fe12[_0xb082('0x28')],{'$or':_[_0xb082('0x19')](_0x45fe12[_0xb082('0x21')],function(_0x15b2ed){var _0x43a9ff={};_0x43a9ff[_0x15b2ed]={'$like':'%'+_0x1e6443[_0xb082('0x1e')][_0xb082('0x2d')]+'%'};return _0x43a9ff;})});}_0x45fe12=_[_0xb082('0x2b')]({},_0x45fe12,_0x1e6443[_0xb082('0x2e')]);return _0x13ee40['getConfigurations'](_0x45fe12);}})[_0xb082('0x11')](function(_0x386ab6){if(_0x386ab6){_0x5b56e=_0x386ab6[_0xb082('0x23')];if(!_0x1e6443[_0xb082('0x1e')][_0xb082('0x24')](_0xb082('0x25'))){_0x45fe12['limit']=qs['limit'](_0x1e6443[_0xb082('0x1e')][_0xb082('0xd')]);_0x45fe12[_0xb082('0xa')]=qs['offset'](_0x1e6443[_0xb082('0x1e')][_0xb082('0xa')]);}return _0x13ee40['getConfigurations'](_0x45fe12);}})[_0xb082('0x11')](function(_0x2e95d7){if(_0x2e95d7){return _0x2e95d7?{'count':_0x5b56e,'rows':_0x2e95d7}:null;}})[_0xb082('0x11')](respondWithResult(_0x5e6004,null))[_0xb082('0x31')](handleError(_0x5e6004,null));};exports[_0xb082('0x3a')]=function(_0xfba235,_0x6025c7){if(_0xfba235[_0xb082('0x39')]['id']){delete _0xfba235[_0xb082('0x39')]['id'];}return db[_0xb082('0x1a')][_0xb082('0x3b')]({'where':{'id':_0xfba235[_0xb082('0x33')]['id']}})['then'](handleEntityNotFound(_0x6025c7,null))['then'](function(_0x5162c0){if(_0x5162c0){_0xfba235[_0xb082('0x39')][_0xb082('0x3c')]=_0x5162c0['id'];_0xfba235[_0xb082('0x39')][_0xb082('0x3d')]=integrations[_0xb082('0x3e')](_0xfba235[_0xb082('0x39')][_0xb082('0x3f')],_0xfba235[_0xb082('0x39')][_0xb082('0x2c')]);_0xfba235[_0xb082('0x39')][_0xb082('0x40')]=integrations[_0xb082('0x41')](_0xfba235['body'][_0xb082('0x3f')],_0xfba235[_0xb082('0x39')][_0xb082('0x2c')]);return db[_0xb082('0x42')][_0xb082('0x38')](_0xfba235[_0xb082('0x39')],{'include':[{'model':db[_0xb082('0x43')],'as':_0xb082('0x3d')},{'model':db[_0xb082('0x43')],'as':_0xb082('0x40')}]});}return null;})['then'](respondWithResult(_0x6025c7,null))['catch'](handleError(_0x6025c7,null));};function sanitizeRemoteUri(_0xeb1122){var _0x530605=_0xeb1122[_0xb082('0x44')](-0x1);if(_0x530605==='/')return _0xeb1122[_0xb082('0x45')](0x0,_0xeb1122[_0xb082('0x46')](_0x530605));return _0xeb1122;}function getWebApiUrl(_0x9d7d58){return util[_0xb082('0x47')](_0xb082('0x48'),_0x9d7d58);}exports[_0xb082('0x49')]=function(_0x11929c,_0xc64095){var _0x1970bf=_0x11929c[_0xb082('0x1e')]['ticketType'];var _0x47f661=_0x1970bf==='incident'?_0xb082('0x4a'):_0xb082('0x4b');var _0x558bd6='';var _0x42dc24='';var _0x5a8ce5='';var _0xb06438='';var _0x5ea832='';var _0x3657ac='';var _0x543f43='';var _0x18a543='';var _0x3d1c85=[_0xb082('0x4c'),_0xb082('0x4d'),_0xb082('0x4e'),_0xb082('0x4f'),'caseorigincode',_0xb082('0x50'),_0xb082('0x51'),_0xb082('0x52'),_0xb082('0x53'),_0xb082('0x54')];var _0x4fc308=['accountidname',_0xb082('0x55'),'actualserviceunits','billedserviceunits',_0xb082('0x56'),'contactidyominame','contractdetailidname','contractidname',_0xb082('0x57'),_0xb082('0x58'),_0xb082('0x59'),'createdbyyominame','createdon','createdonbehalfbyname',_0xb082('0x5a'),_0xb082('0x5b'),_0xb082('0x5c'),_0xb082('0x5d'),_0xb082('0x5e'),_0xb082('0x5f'),_0xb082('0x60'),'entityimage_url',_0xb082('0x61'),_0xb082('0x62'),_0xb082('0x63'),_0xb082('0x64'),_0xb082('0x65'),_0xb082('0x66'),'kbarticleidname',_0xb082('0x67'),_0xb082('0x68'),'modifiedbyexternalpartyname',_0xb082('0x69'),'modifiedbyname',_0xb082('0x6a'),_0xb082('0x6b'),_0xb082('0x6c'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xb082('0x6d'),'numberofchildincidents',_0xb082('0x6e'),_0xb082('0x6f'),_0xb082('0x70'),_0xb082('0x71'),_0xb082('0x72'),_0xb082('0x73'),_0xb082('0x74'),_0xb082('0x75'),_0xb082('0x76'),_0xb082('0x77'),_0xb082('0x78'),'resolveby',_0xb082('0x79'),'responseby','responsiblecontactidname',_0xb082('0x7a'),_0xb082('0x7b'),'slainvokedidname','slaname',_0xb082('0x7c'),_0xb082('0x7d'),_0xb082('0x7e'),_0xb082('0x7f'),_0xb082('0x80'),_0xb082('0x81'),_0xb082('0x82'),'traversedpath',_0xb082('0x83'),_0xb082('0x84')];var _0x56047a=_0x3d1c85[_0xb082('0x85')](_0x4fc308);return db[_0xb082('0x1a')][_0xb082('0x3b')]({'where':{'id':_0x11929c[_0xb082('0x33')]['id']},'attributes':['id','username',_0xb082('0x86'),_0xb082('0x87'),_0xb082('0x88'),'clientId',_0xb082('0x89'),_0xb082('0x8a')],'include':[{'model':db[_0xb082('0x8b')],'as':'CloudProvider','attributes':['id',_0xb082('0x8c'),_0xb082('0x8d')]}]})[_0xb082('0x11')](handleEntityNotFound(_0xc64095,null))['then'](function(_0x20a076){if(_0x20a076){if(_0x20a076[_0xb082('0x8a')]){_0x20a076['access_token']=_0x20a076[_0xb082('0x8b')][_0xb082('0x8c')];_0x18a543=sanitizeRemoteUri(_0x20a076['CloudProvider']['data7']);_0x543f43=getWebApiUrl(_0x18a543);return _0x20a076;}_0x18a543=sanitizeRemoteUri(_0x20a076[_0xb082('0x87')]);_0x543f43=getWebApiUrl(_0x18a543);var _0x5c5e60={'method':_0xb082('0x8e'),'uri':_0xb082('0x8f')+_0x20a076[_0xb082('0x88')]+_0xb082('0x90'),'form':{'client_id':_0x20a076['clientId'],'resource':_0x18a543,'username':_0x20a076['username'],'password':_0x20a076[_0xb082('0x86')],'grant_type':_0xb082('0x86'),'client_secret':_0x20a076[_0xb082('0x89')]},'json':!![]};return rp(_0x5c5e60);}})[_0xb082('0x11')](function(_0x575748){_0x3657ac=_0x575748['access_token'];var _0x25da80={'method':_0xb082('0x91'),'uri':encodeURI(_0x543f43+_0xb082('0x92')+_0x47f661+'\x27'),'headers':{'Authorization':_0xb082('0x93')+_0x3657ac,'If-None-Match':null,'OData-Version':_0xb082('0x94')},'json':!![]};return rp(_0x25da80);})[_0xb082('0x11')](function(_0x10c12b){var _0xce7c30=_0x10c12b[_0xb082('0x95')][0x0];var _0x2d2d9d=_0xce7c30[_0xb082('0x96')];var _0x59c985={'method':'GET','uri':_0x543f43+_0xb082('0x97')+_0x2d2d9d+_0xb082('0x98'),'headers':{'Authorization':_0xb082('0x93')+_0x3657ac,'If-None-Match':null,'OData-Version':_0xb082('0x94')},'json':!![]};return rp(_0x59c985);})[_0xb082('0x11')](function(_0x38b754){_0x558bd6=_0x38b754;_0x42dc24=_0x558bd6['Attributes'];_0x42dc24=_[_0xb082('0x99')](_0x42dc24,function(_0x42807b){return!_0x56047a[_0xb082('0x9a')](_0x42807b[_0xb082('0x9b')]);});var _0xbebee7=[];var _0x1d3483=[];_0x42dc24[_0xb082('0x9c')](function(_0x5bd875){if(_0x5bd875[_0xb082('0x9d')]){var _0x9916e0=_0x5bd875['@odata.type'][_0xb082('0x45')](_0x5bd875[_0xb082('0x9d')][_0xb082('0x46')]('.')+0x1);if(_0x9916e0==='PicklistAttributeMetadata'){_0xbebee7[_0xb082('0x9e')](getSelectList(_0x543f43,_0x1970bf,_0x1d3483,_0x558bd6['MetadataId'],_0x5bd875[_0xb082('0x96')],_0x3657ac));}}});return Promise['all'](_0xbebee7);})[_0xb082('0x11')](function(_0x1a7ff2){_0x5a8ce5=_0x1a7ff2[0x0];var _0x111d74=[];var _0x3ab131=[];_0x42dc24[_0xb082('0x9c')](function(_0x3f1e61){if(!_[_0xb082('0x9f')](_0x3f1e61['@odata.type'])){var _0x5bab9b=_0x3f1e61['@odata.type'][_0xb082('0x45')](_0x3f1e61[_0xb082('0x9d')][_0xb082('0x46')]('.')+0x1);if(_0x5bab9b==='BooleanAttributeMetadata'){_0x111d74[_0xb082('0x9e')](getBooleanList(_0x543f43,_0x1970bf,_0x3ab131,_0x558bd6[_0xb082('0x96')],_0x3f1e61[_0xb082('0x96')],_0x3657ac));}}});return Promise[_0xb082('0xa0')](_0x111d74);})[_0xb082('0x11')](function(_0x19d84a){_0xb06438=_0x19d84a[0x0];var _0x36b430=[];var _0x45be8e=[];_0x42dc24[_0xb082('0x9c')](function(_0x23d714){if(_0x23d714['@odata.type']){var _0x10fcef=_0x23d714[_0xb082('0x9d')][_0xb082('0x45')](_0x23d714[_0xb082('0x9d')][_0xb082('0x46')]('.')+0x1);if(_0x10fcef===_0xb082('0xa1')||_0x10fcef===_0xb082('0xa2')||_0x10fcef===_0xb082('0xa3')||_0x10fcef==='IntegerAttributeMetadata'||_0x10fcef===_0xb082('0xa4')||_0x10fcef===_0xb082('0xa5')||_0x10fcef==='StatusAttributeMetadata'||_0x10fcef===_0xb082('0xa6')||_0x10fcef===_0xb082('0xa7')||_0x10fcef===_0xb082('0xa8')){_0x36b430[_0xb082('0x9e')](getInputList(_0x543f43,_0x1970bf,_0x10fcef,_0x45be8e,_0x558bd6['MetadataId'],_0x23d714[_0xb082('0x96')],_0x3657ac));}}});return Promise[_0xb082('0xa0')](_0x36b430);})[_0xb082('0x11')](function(_0x128725){_0x5ea832=_0x128725[0x0];var _0x402297=_0x5a8ce5['concat'](_0xb06438)[_0xb082('0x85')](_0x5ea832);var _0x4c72d8={'count':_0x402297[_0xb082('0x23')],'rows':_0x402297};return _0x4c72d8;})[_0xb082('0x11')](respondWithResult(_0xc64095,null))['catch'](function(_0x43db6d){var _0x48f43a=_0x11929c['query'][_0xb082('0xa9')]?0x1f4:_0x43db6d['statusCode']||0x1f4;logger[_0xb082('0x15')](_0x43db6d['stack']);delete _0x43db6d[_0xb082('0x17')];if(_0x48f43a===0x191){_0x48f43a=0x190;}_0xc64095['status'](_0x48f43a)[_0xb082('0xaa')](_0x11929c[_0xb082('0x1e')][_0xb082('0xa9')]?{'message':_0xb082('0xab'),'statusCode':_0x43db6d['statusCode']}:_0x43db6d);});};function getSelectList(_0x484a09,_0x587f03,_0x1bd924,_0xff3308,_0x4c24da,_0x2dcefc){var _0x460845={'method':_0xb082('0x91'),'uri':_0x484a09+_0xb082('0x97')+_0xff3308+')/Attributes('+_0x4c24da+_0xb082('0xac')+_0xb082('0xad'),'headers':{'Authorization':_0xb082('0x93')+_0x2dcefc,'If-None-Match':null,'OData-Version':_0xb082('0x94')},'json':!![]};return rp(_0x460845)[_0xb082('0x11')](function(_0x26dddf){var _0x4a2089=[];var _0x26bc36=_0x26dddf['OptionSet'][_0xb082('0xae')];_0x26bc36[_0xb082('0x9c')](function(_0x4c0a25){_0x4a2089[_0xb082('0x9e')]({'name':_0x4c0a25[_0xb082('0xaf')][_0xb082('0xb0')][_0xb082('0xaf')],'value':String(_0x4c0a25[_0xb082('0xb1')])});});var _0x305de1={'id':_0x587f03+'_'+_0x26dddf[_0xb082('0x9b')],'name':_0x26dddf['DisplayName'][_0xb082('0xb0')][_0xb082('0xaf')],'custom':![],'options':_0x4a2089};_0x1bd924[_0xb082('0x9e')](_0x305de1);return _0x1bd924;});}function getBooleanList(_0x3eae7a,_0x2b3301,_0x52b76e,_0xc5b3ba,_0x5f5602,_0x48c8bb){var _0x4c2bd7={'method':_0xb082('0x91'),'uri':_0x3eae7a+_0xb082('0x97')+_0xc5b3ba+_0xb082('0xb2')+_0x5f5602+_0xb082('0xb3'),'headers':{'Authorization':'Bearer\x20'+_0x48c8bb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c2bd7)[_0xb082('0x11')](function(_0xe45ada){var _0x12d409=[];_0x12d409[_0xb082('0x9e')]({'name':_0xe45ada[_0xb082('0xb4')][_0xb082('0xb5')][_0xb082('0xaf')][_0xb082('0xb0')]['Label'],'value':_0xb082('0xb6')},{'name':_0xe45ada[_0xb082('0xb4')]['FalseOption']['Label'][_0xb082('0xb0')]['Label'],'value':_0xb082('0xb7')});var _0x10d2fb={'id':_0x2b3301+'_'+_0xe45ada[_0xb082('0x9b')],'name':_0xe45ada[_0xb082('0xb8')]['UserLocalizedLabel'][_0xb082('0xaf')],'custom':![],'options':_0x12d409};_0x52b76e[_0xb082('0x9e')](_0x10d2fb);return _0x52b76e;});}function getInputList(_0x489443,_0x5cae0e,_0x391922,_0x1c9e0f,_0x5a825a,_0x468d42,_0x5ae1e){var _0x15120d={'method':_0xb082('0x91'),'uri':_0x489443+_0xb082('0x97')+_0x5a825a+_0xb082('0xb2')+_0x468d42+_0xb082('0xb9')+_0x391922+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xb082('0x93')+_0x5ae1e,'If-None-Match':null,'OData-Version':_0xb082('0x94')},'json':!![]};return rp(_0x15120d)[_0xb082('0x11')](function(_0x1a1233){var _0x12d096={'id':_0x5cae0e+'_'+_0x1a1233[_0xb082('0x9b')],'name':_0x1a1233[_0xb082('0xb8')]['UserLocalizedLabel']?_0x1a1233[_0xb082('0xb8')][_0xb082('0xb0')][_0xb082('0xaf')]:_0x1a1233[_0xb082('0x9b')],'custom':![],'options':[]};_0x1c9e0f[_0xb082('0x9e')](_0x12d096);return _0x1c9e0f;});} \ No newline at end of file +var _0xc29b=['exchangerate','followupby','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','find','catch','create','body','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_url','escalatedon'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xc29b,0x12d));var _0xbc29=function(_0x3c6b13,_0x3be986){_0x3c6b13=_0x3c6b13-0x0;var _0x3a5eb0=_0xc29b[_0x3c6b13];return _0x3a5eb0;};'use strict';var rp=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var _=require(_0xbc29('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xbc29('0x3'))(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbc29('0x5'));function respondWithResult(_0x294a45,_0x217922){_0x217922=_0x217922||0xc8;return function(_0xa365e8){if(_0xa365e8){return _0x294a45[_0xbc29('0x6')](_0x217922)[_0xbc29('0x7')](_0xa365e8);}};}function respondWithFilteredResult(_0x3ac58d,_0x40f0c9){return function(_0x463e2b){if(_0x463e2b){var _0x37d9dd=typeof _0x40f0c9[_0xbc29('0x8')]===_0xbc29('0x9')&&typeof _0x40f0c9[_0xbc29('0xa')]===_0xbc29('0x9');var _0x320cb4=_0x463e2b[_0xbc29('0xb')];var _0x13a581=_0x37d9dd?0x0:_0x40f0c9[_0xbc29('0x8')];var _0x35ece9=_0x37d9dd?_0x463e2b[_0xbc29('0xb')]:_0x40f0c9['offset']+_0x40f0c9[_0xbc29('0xa')];var _0x888953;if(_0x35ece9>=_0x320cb4){_0x35ece9=_0x320cb4;_0x888953=0xc8;}else{_0x888953=0xce;}_0x3ac58d[_0xbc29('0x6')](_0x888953);return _0x3ac58d[_0xbc29('0xc')](_0xbc29('0xd'),_0x13a581+'-'+_0x35ece9+'/'+_0x320cb4)[_0xbc29('0x7')](_0x463e2b);}return null;};}function saveUpdates(_0x352c9e){return function(_0x5e581f){if(_0x5e581f){return _0x5e581f[_0xbc29('0xe')](_0x352c9e)[_0xbc29('0xf')](function(_0x1c39a3){return _0x1c39a3;});}return null;};}function removeEntity(_0x515ea8){return function(_0x483fbe){if(_0x483fbe){return _0x483fbe[_0xbc29('0x10')]()['then'](function(){_0x515ea8[_0xbc29('0x6')](0xcc)[_0xbc29('0x11')]();});}};}function handleEntityNotFound(_0x46eb03){return function(_0x490030){if(!_0x490030){_0x46eb03[_0xbc29('0x12')](0x194);}return _0x490030;};}function handleError(_0x570a2f,_0x1556b6){_0x1556b6=_0x1556b6||0x1f4;return function(_0x3b5bae){logger[_0xbc29('0x13')](_0x3b5bae[_0xbc29('0x14')]);if(_0x3b5bae[_0xbc29('0x15')]){delete _0x3b5bae[_0xbc29('0x15')];}_0x570a2f['status'](_0x1556b6)[_0xbc29('0x16')](_0x3b5bae);};}exports[_0xbc29('0x17')]=function(_0x4eadbe,_0x5a3cb0){var _0x30c251={},_0x4a2b1e={},_0x5b5bed={'count':0x0,'rows':[]};var _0x39336e=_[_0xbc29('0x18')](db[_0xbc29('0x19')][_0xbc29('0x1a')],function(_0x110d45){return{'name':_0x110d45[_0xbc29('0x1b')],'type':_0x110d45[_0xbc29('0x1c')][_0xbc29('0x1d')]};});_0x4a2b1e['model']=_[_0xbc29('0x18')](_0x39336e,_0xbc29('0x15'));_0x4a2b1e[_0xbc29('0x1e')]=_[_0xbc29('0x1f')](_0x4eadbe[_0xbc29('0x1e')]);_0x4a2b1e['filters']=_[_0xbc29('0x20')](_0x4a2b1e[_0xbc29('0x21')],_0x4a2b1e[_0xbc29('0x1e')]);_0x30c251[_0xbc29('0x22')]=_['intersection'](_0x4a2b1e[_0xbc29('0x21')],qs[_0xbc29('0x23')](_0x4eadbe['query'][_0xbc29('0x23')]));_0x30c251[_0xbc29('0x22')]=_0x30c251['attributes']['length']?_0x30c251[_0xbc29('0x22')]:_0x4a2b1e['model'];if(!_0x4eadbe['query'][_0xbc29('0x24')](_0xbc29('0x25'))){_0x30c251[_0xbc29('0xa')]=qs['limit'](_0x4eadbe[_0xbc29('0x1e')][_0xbc29('0xa')]);_0x30c251[_0xbc29('0x8')]=qs[_0xbc29('0x8')](_0x4eadbe[_0xbc29('0x1e')]['offset']);}_0x30c251['order']=qs[_0xbc29('0x26')](_0x4eadbe[_0xbc29('0x1e')]['sort']);_0x30c251[_0xbc29('0x27')]=qs[_0xbc29('0x28')](_[_0xbc29('0x29')](_0x4eadbe[_0xbc29('0x1e')],_0x4a2b1e[_0xbc29('0x28')]),_0x39336e);if(_0x4eadbe[_0xbc29('0x1e')]['filter']){_0x30c251[_0xbc29('0x27')]=_[_0xbc29('0x2a')](_0x30c251[_0xbc29('0x27')],{'$or':_[_0xbc29('0x18')](_0x39336e,function(_0x50549c){if(_0x50549c[_0xbc29('0x1c')]!==_0xbc29('0x2b')){var _0x20a814={};_0x20a814[_0x50549c['name']]={'$like':'%'+_0x4eadbe['query'][_0xbc29('0x2c')]+'%'};return _0x20a814;}})});}_0x30c251=_[_0xbc29('0x2a')]({},_0x30c251,_0x4eadbe[_0xbc29('0x2d')]);var _0x59aad8={'where':_0x30c251[_0xbc29('0x27')]};return db[_0xbc29('0x19')][_0xbc29('0xb')](_0x59aad8)[_0xbc29('0xf')](function(_0x47b998){_0x5b5bed['count']=_0x47b998;if(_0x4eadbe['query'][_0xbc29('0x2e')]){_0x30c251[_0xbc29('0x2f')]=[{'all':!![]}];}return db[_0xbc29('0x19')]['findAll'](_0x30c251);})['then'](function(_0x26073c){_0x5b5bed[_0xbc29('0x30')]=_0x26073c;return _0x5b5bed;})['then'](respondWithFilteredResult(_0x5a3cb0,_0x30c251))['catch'](handleError(_0x5a3cb0,null));};exports[_0xbc29('0x31')]=function(_0x1e17cb,_0x4084ad){var _0x212dec={'raw':![],'where':{'id':_0x1e17cb[_0xbc29('0x32')]['id']}},_0x289bc6={};_0x289bc6['model']=_['keys'](db[_0xbc29('0x19')]['rawAttributes']);_0x289bc6[_0xbc29('0x1e')]=_['keys'](_0x1e17cb[_0xbc29('0x1e')]);_0x289bc6[_0xbc29('0x28')]=_[_0xbc29('0x20')](_0x289bc6[_0xbc29('0x21')],_0x289bc6[_0xbc29('0x1e')]);_0x212dec[_0xbc29('0x22')]=_[_0xbc29('0x20')](_0x289bc6[_0xbc29('0x21')],qs[_0xbc29('0x23')](_0x1e17cb['query'][_0xbc29('0x23')]));_0x212dec[_0xbc29('0x22')]=_0x212dec[_0xbc29('0x22')][_0xbc29('0x33')]?_0x212dec[_0xbc29('0x22')]:_0x289bc6['model'];if(_0x1e17cb[_0xbc29('0x1e')][_0xbc29('0x2e')]){_0x212dec[_0xbc29('0x2f')]=[{'all':!![]}];}_0x212dec=_['merge']({},_0x212dec,_0x1e17cb['options']);return db[_0xbc29('0x19')][_0xbc29('0x34')](_0x212dec)[_0xbc29('0xf')](handleEntityNotFound(_0x4084ad,null))[_0xbc29('0xf')](respondWithResult(_0x4084ad,null))[_0xbc29('0x35')](handleError(_0x4084ad,null));};exports[_0xbc29('0x36')]=function(_0x250b0c,_0x203af6){return db[_0xbc29('0x19')][_0xbc29('0x36')](_0x250b0c[_0xbc29('0x37')],{})[_0xbc29('0xf')](respondWithResult(_0x203af6,0xc9))[_0xbc29('0x35')](handleError(_0x203af6,null));};exports['update']=function(_0x37e79a,_0x4fe2c1){if(_0x37e79a[_0xbc29('0x37')]['id']){delete _0x37e79a[_0xbc29('0x37')]['id'];}return db[_0xbc29('0x19')][_0xbc29('0x34')]({'where':{'id':_0x37e79a['params']['id']}})[_0xbc29('0xf')](handleEntityNotFound(_0x4fe2c1,null))[_0xbc29('0xf')](saveUpdates(_0x37e79a[_0xbc29('0x37')],null))[_0xbc29('0xf')](respondWithResult(_0x4fe2c1,null))[_0xbc29('0x35')](handleError(_0x4fe2c1,null));};exports['destroy']=function(_0x209d7e,_0x17e79e){return db[_0xbc29('0x19')][_0xbc29('0x34')]({'where':{'id':_0x209d7e[_0xbc29('0x32')]['id']}})['then'](handleEntityNotFound(_0x17e79e,null))['then'](removeEntity(_0x17e79e,null))[_0xbc29('0x35')](handleError(_0x17e79e,null));};exports[_0xbc29('0x38')]=function(_0x2e07b0,_0x42b250){var _0x5dbece={};var _0x2b336b={};var _0x2a1fc6;var _0x55a1eb;return db[_0xbc29('0x19')]['findOne']({'where':{'id':_0x2e07b0[_0xbc29('0x32')]['id']}})['then'](handleEntityNotFound(_0x42b250,null))[_0xbc29('0xf')](function(_0x2866b2){if(_0x2866b2){_0x2a1fc6=_0x2866b2;_0x2b336b[_0xbc29('0x21')]=_[_0xbc29('0x1f')](db[_0xbc29('0x39')]['rawAttributes']);_0x2b336b[_0xbc29('0x1e')]=_['keys'](_0x2e07b0['query']);_0x2b336b[_0xbc29('0x28')]=_[_0xbc29('0x20')](_0x2b336b[_0xbc29('0x21')],_0x2b336b[_0xbc29('0x1e')]);_0x5dbece[_0xbc29('0x22')]=_[_0xbc29('0x20')](_0x2b336b[_0xbc29('0x21')],qs[_0xbc29('0x23')](_0x2e07b0['query'][_0xbc29('0x23')]));_0x5dbece[_0xbc29('0x22')]=_0x5dbece[_0xbc29('0x22')]['length']?_0x5dbece[_0xbc29('0x22')]:_0x2b336b[_0xbc29('0x21')];_0x5dbece['order']=qs[_0xbc29('0x26')](_0x2e07b0[_0xbc29('0x1e')][_0xbc29('0x26')]);_0x5dbece[_0xbc29('0x27')]=qs['filters'](_[_0xbc29('0x29')](_0x2e07b0[_0xbc29('0x1e')],_0x2b336b[_0xbc29('0x28')]));if(_0x2e07b0[_0xbc29('0x1e')]['filter']){_0x5dbece[_0xbc29('0x27')]=_['merge'](_0x5dbece[_0xbc29('0x27')],{'$or':_[_0xbc29('0x18')](_0x5dbece['attributes'],function(_0x30c0df){var _0x2d9307={};_0x2d9307[_0x30c0df]={'$like':'%'+_0x2e07b0['query'][_0xbc29('0x2c')]+'%'};return _0x2d9307;})});}_0x5dbece=_[_0xbc29('0x2a')]({},_0x5dbece,_0x2e07b0[_0xbc29('0x2d')]);return _0x2a1fc6['getConfigurations'](_0x5dbece);}})[_0xbc29('0xf')](function(_0x3e4d80){if(_0x3e4d80){_0x55a1eb=_0x3e4d80[_0xbc29('0x33')];if(!_0x2e07b0['query'][_0xbc29('0x24')](_0xbc29('0x25'))){_0x5dbece[_0xbc29('0xa')]=qs[_0xbc29('0xa')](_0x2e07b0[_0xbc29('0x1e')][_0xbc29('0xa')]);_0x5dbece[_0xbc29('0x8')]=qs[_0xbc29('0x8')](_0x2e07b0[_0xbc29('0x1e')]['offset']);}return _0x2a1fc6[_0xbc29('0x38')](_0x5dbece);}})[_0xbc29('0xf')](function(_0x2a716a){if(_0x2a716a){return _0x2a716a?{'count':_0x55a1eb,'rows':_0x2a716a}:null;}})[_0xbc29('0xf')](respondWithResult(_0x42b250,null))['catch'](handleError(_0x42b250,null));};exports[_0xbc29('0x3a')]=function(_0x3d4fec,_0x5916b2){if(_0x3d4fec[_0xbc29('0x37')]['id']){delete _0x3d4fec['body']['id'];}return db[_0xbc29('0x19')][_0xbc29('0x3b')]({'where':{'id':_0x3d4fec['params']['id']}})[_0xbc29('0xf')](handleEntityNotFound(_0x5916b2,null))[_0xbc29('0xf')](function(_0x44f211){if(_0x44f211){_0x3d4fec[_0xbc29('0x37')][_0xbc29('0x3c')]=_0x44f211['id'];_0x3d4fec[_0xbc29('0x37')][_0xbc29('0x3d')]=integrations[_0xbc29('0x3e')](_0x3d4fec['body'][_0xbc29('0x3f')],_0x3d4fec[_0xbc29('0x37')][_0xbc29('0x1c')]);_0x3d4fec[_0xbc29('0x37')][_0xbc29('0x40')]=integrations[_0xbc29('0x41')](_0x3d4fec[_0xbc29('0x37')]['channel'],_0x3d4fec['body'][_0xbc29('0x1c')]);return db[_0xbc29('0x39')][_0xbc29('0x36')](_0x3d4fec[_0xbc29('0x37')],{'include':[{'model':db[_0xbc29('0x42')],'as':_0xbc29('0x3d')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5916b2,null))[_0xbc29('0x35')](handleError(_0x5916b2,null));};function sanitizeRemoteUri(_0x2a0ce4){var _0x51fc28=_0x2a0ce4[_0xbc29('0x43')](-0x1);if(_0x51fc28==='/')return _0x2a0ce4[_0xbc29('0x44')](0x0,_0x2a0ce4[_0xbc29('0x45')](_0x51fc28));return _0x2a0ce4;}function getWebApiUrl(_0x337c7a){return util[_0xbc29('0x46')](_0xbc29('0x47'),_0x337c7a);}exports[_0xbc29('0x48')]=function(_0x5cbc3c,_0x5e599b){var _0x10bb26=_0x5cbc3c[_0xbc29('0x1e')][_0xbc29('0x49')];var _0x5c87c1=_0x10bb26===_0xbc29('0x4a')?_0xbc29('0x4b'):_0xbc29('0x4c');var _0x51c48b='';var _0x4e6194='';var _0xf7a5c5='';var _0x1e6a20='';var _0x2bfcc8='';var _0xcb59f='';var _0x462c2d='';var _0x6e627d='';var _0xd0b91f=['title',_0xbc29('0x4d'),'customerid',_0xbc29('0x4e'),_0xbc29('0x4f'),_0xbc29('0x50'),_0xbc29('0x51'),_0xbc29('0x52'),_0xbc29('0x53'),_0xbc29('0x54')];var _0x457925=[_0xbc29('0x55'),_0xbc29('0x56'),_0xbc29('0x57'),_0xbc29('0x58'),_0xbc29('0x59'),_0xbc29('0x5a'),_0xbc29('0x5b'),_0xbc29('0x5c'),_0xbc29('0x5d'),_0xbc29('0x5e'),_0xbc29('0x5f'),_0xbc29('0x60'),_0xbc29('0x61'),_0xbc29('0x62'),_0xbc29('0x63'),_0xbc29('0x64'),'customeridtype',_0xbc29('0x65'),_0xbc29('0x66'),'entitlementidname','entityimage_timestamp',_0xbc29('0x67'),_0xbc29('0x68'),_0xbc29('0x69'),'firstresponsebykpiidname',_0xbc29('0x6a'),'importsequencenumber',_0xbc29('0x6b'),'kbarticleidname',_0xbc29('0x6c'),'masteridname',_0xbc29('0x6d'),_0xbc29('0x6e'),_0xbc29('0x6f'),_0xbc29('0x70'),_0xbc29('0x71'),_0xbc29('0x72'),_0xbc29('0x73'),_0xbc29('0x74'),_0xbc29('0x75'),_0xbc29('0x76'),_0xbc29('0x77'),_0xbc29('0x78'),_0xbc29('0x79'),_0xbc29('0x7a'),_0xbc29('0x7b'),_0xbc29('0x7c'),_0xbc29('0x7d'),_0xbc29('0x7e'),_0xbc29('0x7f'),_0xbc29('0x80'),_0xbc29('0x81'),_0xbc29('0x82'),'resolvebykpiidname',_0xbc29('0x83'),'responsiblecontactidname',_0xbc29('0x84'),_0xbc29('0x85'),_0xbc29('0x86'),_0xbc29('0x87'),_0xbc29('0x88'),_0xbc29('0x89'),_0xbc29('0x8a'),_0xbc29('0x8b'),_0xbc29('0x8c'),_0xbc29('0x8d'),_0xbc29('0x8e'),_0xbc29('0x8f'),_0xbc29('0x90'),_0xbc29('0x91')];var _0x55e3a4=_0xd0b91f['concat'](_0x457925);return db[_0xbc29('0x19')][_0xbc29('0x3b')]({'where':{'id':_0x5cbc3c[_0xbc29('0x32')]['id']},'attributes':['id','username',_0xbc29('0x92'),_0xbc29('0x93'),_0xbc29('0x94'),_0xbc29('0x95'),_0xbc29('0x96'),_0xbc29('0x97')],'include':[{'model':db['CloudProvider'],'as':_0xbc29('0x98'),'attributes':['id',_0xbc29('0x99'),_0xbc29('0x9a')]}]})[_0xbc29('0xf')](handleEntityNotFound(_0x5e599b,null))[_0xbc29('0xf')](function(_0x59bc3a){if(_0x59bc3a){if(_0x59bc3a['modernAuthentication']){_0x59bc3a[_0xbc29('0x9b')]=_0x59bc3a[_0xbc29('0x98')]['data5'];_0x6e627d=sanitizeRemoteUri(_0x59bc3a['CloudProvider'][_0xbc29('0x9a')]);_0x462c2d=getWebApiUrl(_0x6e627d);return _0x59bc3a;}_0x6e627d=sanitizeRemoteUri(_0x59bc3a['remoteUri']);_0x462c2d=getWebApiUrl(_0x6e627d);var _0x3bbeb1={'method':_0xbc29('0x9c'),'uri':_0xbc29('0x9d')+_0x59bc3a['tenantId']+_0xbc29('0x9e'),'form':{'client_id':_0x59bc3a[_0xbc29('0x95')],'resource':_0x6e627d,'username':_0x59bc3a['username'],'password':_0x59bc3a[_0xbc29('0x92')],'grant_type':_0xbc29('0x92'),'client_secret':_0x59bc3a[_0xbc29('0x96')]},'json':!![]};return rp(_0x3bbeb1);}})['then'](function(_0xcad133){_0xcb59f=_0xcad133[_0xbc29('0x9b')];var _0x9b1647={'method':'GET','uri':encodeURI(_0x462c2d+_0xbc29('0x9f')+_0x5c87c1+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xcb59f,'If-None-Match':null,'OData-Version':_0xbc29('0xa0')},'json':!![]};return rp(_0x9b1647);})['then'](function(_0x1ac261){var _0x2ce4c9=_0x1ac261[_0xbc29('0xa1')][0x0];var _0x3e3ea9=_0x2ce4c9[_0xbc29('0xa2')];var _0x2aa518={'method':_0xbc29('0xa3'),'uri':_0x462c2d+'EntityDefinitions('+_0x3e3ea9+_0xbc29('0xa4'),'headers':{'Authorization':_0xbc29('0xa5')+_0xcb59f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2aa518);})[_0xbc29('0xf')](function(_0x13c143){_0x51c48b=_0x13c143;_0x4e6194=_0x51c48b[_0xbc29('0xa6')];_0x4e6194=_['remove'](_0x4e6194,function(_0xf54293){return!_0x55e3a4[_0xbc29('0xa7')](_0xf54293[_0xbc29('0xa8')]);});var _0x14021d=[];var _0x1a6d5d=[];_0x4e6194[_0xbc29('0xa9')](function(_0x18f476){if(_0x18f476[_0xbc29('0xaa')]){var _0x280208=_0x18f476[_0xbc29('0xaa')][_0xbc29('0x44')](_0x18f476[_0xbc29('0xaa')][_0xbc29('0x45')]('.')+0x1);if(_0x280208===_0xbc29('0xab')){_0x14021d[_0xbc29('0xac')](getSelectList(_0x462c2d,_0x10bb26,_0x1a6d5d,_0x51c48b[_0xbc29('0xa2')],_0x18f476['MetadataId'],_0xcb59f));}}});return Promise[_0xbc29('0xad')](_0x14021d);})['then'](function(_0x59d1b6){_0xf7a5c5=_0x59d1b6[0x0];var _0x440a91=[];var _0x36d682=[];_0x4e6194['forEach'](function(_0x2e7684){if(!_['isNil'](_0x2e7684[_0xbc29('0xaa')])){var _0x492bfc=_0x2e7684['@odata.type'][_0xbc29('0x44')](_0x2e7684[_0xbc29('0xaa')][_0xbc29('0x45')]('.')+0x1);if(_0x492bfc===_0xbc29('0xae')){_0x440a91['push'](getBooleanList(_0x462c2d,_0x10bb26,_0x36d682,_0x51c48b['MetadataId'],_0x2e7684[_0xbc29('0xa2')],_0xcb59f));}}});return Promise[_0xbc29('0xad')](_0x440a91);})['then'](function(_0x57fb7a){_0x1e6a20=_0x57fb7a[0x0];var _0x191a01=[];var _0x199668=[];_0x4e6194['forEach'](function(_0x56484b){if(_0x56484b[_0xbc29('0xaa')]){var _0x3182f8=_0x56484b[_0xbc29('0xaa')][_0xbc29('0x44')](_0x56484b[_0xbc29('0xaa')][_0xbc29('0x45')]('.')+0x1);if(_0x3182f8===_0xbc29('0xaf')||_0x3182f8==='DoubleAttributeMetadata'||_0x3182f8===_0xbc29('0xb0')||_0x3182f8==='IntegerAttributeMetadata'||_0x3182f8===_0xbc29('0xb1')||_0x3182f8===_0xbc29('0xb2')||_0x3182f8===_0xbc29('0xb3')||_0x3182f8===_0xbc29('0xb4')||_0x3182f8===_0xbc29('0xb5')||_0x3182f8===_0xbc29('0xb6')){_0x191a01[_0xbc29('0xac')](getInputList(_0x462c2d,_0x10bb26,_0x3182f8,_0x199668,_0x51c48b[_0xbc29('0xa2')],_0x56484b['MetadataId'],_0xcb59f));}}});return Promise[_0xbc29('0xad')](_0x191a01);})['then'](function(_0x18cb60){_0x2bfcc8=_0x18cb60[0x0];var _0x253ba4=_0xf7a5c5[_0xbc29('0xb7')](_0x1e6a20)[_0xbc29('0xb7')](_0x2bfcc8);var _0xe5ce2c={'count':_0x253ba4[_0xbc29('0x33')],'rows':_0x253ba4};return _0xe5ce2c;})[_0xbc29('0xf')](respondWithResult(_0x5e599b,null))['catch'](function(_0x116dc9){var _0x381c59=_0x5cbc3c[_0xbc29('0x1e')][_0xbc29('0xb8')]?0x1f4:_0x116dc9[_0xbc29('0xb9')]||0x1f4;logger['error'](_0x116dc9[_0xbc29('0x14')]);delete _0x116dc9[_0xbc29('0x15')];if(_0x381c59===0x191){_0x381c59=0x190;}_0x5e599b[_0xbc29('0x6')](_0x381c59)[_0xbc29('0x16')](_0x5cbc3c[_0xbc29('0x1e')][_0xbc29('0xb8')]?{'message':_0xbc29('0xba'),'statusCode':_0x116dc9[_0xbc29('0xb9')]}:_0x116dc9);});};function getSelectList(_0x2d83aa,_0x2de157,_0x33eb7b,_0x29f5a0,_0x9017c5,_0x5b9631){var _0x5cc2c5={'method':'GET','uri':_0x2d83aa+'EntityDefinitions('+_0x29f5a0+_0xbc29('0xbb')+_0x9017c5+_0xbc29('0xbc')+_0xbc29('0xbd'),'headers':{'Authorization':_0xbc29('0xa5')+_0x5b9631,'If-None-Match':null,'OData-Version':_0xbc29('0xa0')},'json':!![]};return rp(_0x5cc2c5)['then'](function(_0x3e8dbb){var _0x1fb337=[];var _0x3763f7=_0x3e8dbb['OptionSet'][_0xbc29('0xbe')];_0x3763f7[_0xbc29('0xa9')](function(_0x110a52){_0x1fb337[_0xbc29('0xac')]({'name':_0x110a52[_0xbc29('0xbf')][_0xbc29('0xc0')]['Label'],'value':String(_0x110a52[_0xbc29('0xc1')])});});var _0x43dd1c={'id':_0x2de157+'_'+_0x3e8dbb['LogicalName'],'name':_0x3e8dbb[_0xbc29('0xc2')]['UserLocalizedLabel'][_0xbc29('0xbf')],'custom':![],'options':_0x1fb337};_0x33eb7b['push'](_0x43dd1c);return _0x33eb7b;});}function getBooleanList(_0x346b3b,_0x409647,_0x1b28c4,_0x383be8,_0x11b5e7,_0x3ad4e0){var _0x31532f={'method':'GET','uri':_0x346b3b+_0xbc29('0xc3')+_0x383be8+_0xbc29('0xbb')+_0x11b5e7+_0xbc29('0xc4'),'headers':{'Authorization':_0xbc29('0xa5')+_0x3ad4e0,'If-None-Match':null,'OData-Version':_0xbc29('0xa0')},'json':!![]};return rp(_0x31532f)[_0xbc29('0xf')](function(_0x3716f1){var _0x2e8b55=[];_0x2e8b55['push']({'name':_0x3716f1[_0xbc29('0xc5')]['TrueOption'][_0xbc29('0xbf')][_0xbc29('0xc0')][_0xbc29('0xbf')],'value':_0xbc29('0xc6')},{'name':_0x3716f1['OptionSet'][_0xbc29('0xc7')][_0xbc29('0xbf')][_0xbc29('0xc0')]['Label'],'value':_0xbc29('0xc8')});var _0x51bc94={'id':_0x409647+'_'+_0x3716f1['LogicalName'],'name':_0x3716f1[_0xbc29('0xc2')]['UserLocalizedLabel'][_0xbc29('0xbf')],'custom':![],'options':_0x2e8b55};_0x1b28c4[_0xbc29('0xac')](_0x51bc94);return _0x1b28c4;});}function getInputList(_0x3ad826,_0x6694dd,_0x2ee29b,_0x197bd6,_0x2626c7,_0xc19140,_0x5cabc1){var _0x23eaf7={'method':_0xbc29('0xa3'),'uri':_0x3ad826+_0xbc29('0xc3')+_0x2626c7+')/Attributes('+_0xc19140+_0xbc29('0xc9')+_0x2ee29b+_0xbc29('0xca'),'headers':{'Authorization':_0xbc29('0xa5')+_0x5cabc1,'If-None-Match':null,'OData-Version':_0xbc29('0xa0')},'json':!![]};return rp(_0x23eaf7)[_0xbc29('0xf')](function(_0x1fd937){var _0x45986a={'id':_0x6694dd+'_'+_0x1fd937[_0xbc29('0xa8')],'name':_0x1fd937[_0xbc29('0xc2')]['UserLocalizedLabel']?_0x1fd937[_0xbc29('0xc2')][_0xbc29('0xc0')][_0xbc29('0xbf')]:_0x1fd937[_0xbc29('0xa8')],'custom':![],'options':[]};_0x197bd6['push'](_0x45986a);return _0x197bd6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 85fff58..988e2ae 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x757a,0xde));var _0xa757=function(_0x31c984,_0x1a8479){_0x31c984=_0x31c984-0x0;var _0x5df23d=_0x757a[_0x31c984];return _0x5df23d;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x41205b,_0x5cd793){var _0x3ab73a=function(_0x1f017e){while(--_0x1f017e){_0x41205b['push'](_0x41205b['shift']());}};_0x3ab73a(++_0x5cd793);}(_0xe706,0xa3));var _0x6e70=function(_0x102287,_0x1c82dc){_0x102287=_0x102287-0x0;var _0x43d29e=_0xe706[_0x102287];return _0x43d29e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b1af887..0bf7b49 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf2e=['rpc','../../config/environment','jayson/promise','client','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','model','attributes','stringify','catch','ShowDynamics365Account','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf2e,0x14d));var _0xecf2=function(_0x1704d5,_0x1f1740){_0x1704d5=_0x1704d5-0x0;var _0x58b71d=_0xcf2e[_0x1704d5];return _0x58b71d;};'use strict';var _=require(_0xecf2('0x0'));var util=require(_0xecf2('0x1'));var moment=require(_0xecf2('0x2'));var BPromise=require(_0xecf2('0x3'));var rs=require(_0xecf2('0x4'));var fs=require('fs');var Redis=require(_0xecf2('0x5'));var db=require(_0xecf2('0x6'))['db'];var utils=require(_0xecf2('0x7'));var logger=require(_0xecf2('0x8'))(_0xecf2('0x9'));var config=require(_0xecf2('0xa'));var jayson=require(_0xecf2('0xb'));var client=jayson[_0xecf2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aa1b4,_0x1d7111,_0x399282){return new BPromise(function(_0x2dded4,_0x54a3d3){return client['request'](_0x1aa1b4,_0x399282)[_0xecf2('0xd')](function(_0x1ab9d1){logger['info'](_0xecf2('0xe'),_0x1d7111,_0xecf2('0xf'));logger[_0xecf2('0x10')](_0xecf2('0x11'),_0x1d7111,_0xecf2('0xf'),JSON['stringify'](_0x1ab9d1));if(_0x1ab9d1[_0xecf2('0x12')]){if(_0x1ab9d1['error'][_0xecf2('0x13')]===0x1f4){logger[_0xecf2('0x12')](_0xecf2('0xe'),_0x1d7111,_0x1ab9d1[_0xecf2('0x12')][_0xecf2('0x14')]);return _0x54a3d3(_0x1ab9d1[_0xecf2('0x12')]['message']);}logger['error'](_0xecf2('0xe'),_0x1d7111,_0x1ab9d1[_0xecf2('0x12')][_0xecf2('0x14')]);return _0x2dded4(_0x1ab9d1[_0xecf2('0x12')][_0xecf2('0x14')]);}else{logger[_0xecf2('0x15')]('Dynamics365Account,\x20%s,\x20%s',_0x1d7111,_0xecf2('0xf'));_0x2dded4(_0x1ab9d1[_0xecf2('0x16')][_0xecf2('0x14')]);}})['catch'](function(_0x1049ad){logger[_0xecf2('0x12')](_0xecf2('0xe'),_0x1d7111,_0x1049ad);_0x54a3d3(_0x1049ad);});});}exports[_0xecf2('0x17')]=function(_0x4fc84e){var _0x5af321=this;return new Promise(function(_0x4c29f6,_0x307890){return db[_0xecf2('0x18')][_0xecf2('0x19')]({'raw':_0x4fc84e[_0xecf2('0x1a')]?_0x4fc84e['options'][_0xecf2('0x1b')]===undefined?!![]:![]:!![],'where':_0x4fc84e['options']?_0x4fc84e[_0xecf2('0x1a')][_0xecf2('0x1c')]||null:null,'attributes':_0x4fc84e[_0xecf2('0x1a')]?_0x4fc84e['options']['attributes']||null:null,'limit':_0x4fc84e[_0xecf2('0x1a')]?_0x4fc84e[_0xecf2('0x1a')][_0xecf2('0x1d')]||null:null,'include':_0x4fc84e[_0xecf2('0x1a')]?_0x4fc84e[_0xecf2('0x1a')][_0xecf2('0x1e')]?_['map'](_0x4fc84e[_0xecf2('0x1a')][_0xecf2('0x1e')],function(_0x42210d){return{'model':db[_0x42210d[_0xecf2('0x1f')]],'as':_0x42210d['as'],'attributes':_0x42210d[_0xecf2('0x20')],'include':_0x42210d['include']?_['map'](_0x42210d['include'],function(_0x11325b){return{'model':db[_0x11325b[_0xecf2('0x1f')]],'as':_0x11325b['as'],'attributes':_0x11325b[_0xecf2('0x20')],'include':_0x11325b['include']?_['map'](_0x11325b[_0xecf2('0x1e')],function(_0x5d3f80){return{'model':db[_0x5d3f80[_0xecf2('0x1f')]],'as':_0x5d3f80['as'],'attributes':_0x5d3f80[_0xecf2('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x922e90){logger[_0xecf2('0x15')](_0xecf2('0x17'),_0x4fc84e);logger[_0xecf2('0x10')](_0xecf2('0x17'),_0x4fc84e,JSON[_0xecf2('0x21')](_0x922e90));_0x4c29f6(_0x922e90);})[_0xecf2('0x22')](function(_0xdb7070){logger[_0xecf2('0x12')](_0xecf2('0x17'),_0xdb7070[_0xecf2('0x14')],_0x4fc84e);_0x307890(_0x5af321['error'](0x1f4,_0xdb7070['message']));});});};exports[_0xecf2('0x23')]=function(_0x4c498c){var _0x258223=this;return new Promise(function(_0x4d0e68,_0xa349aa){return db[_0xecf2('0x18')][_0xecf2('0x24')]({'raw':_0x4c498c['options']?_0x4c498c['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c498c[_0xecf2('0x1a')]?_0x4c498c['options'][_0xecf2('0x1c')]||null:null,'attributes':_0x4c498c[_0xecf2('0x1a')]?_0x4c498c[_0xecf2('0x1a')][_0xecf2('0x20')]||null:null,'include':_0x4c498c[_0xecf2('0x1a')]?_0x4c498c[_0xecf2('0x1a')][_0xecf2('0x1e')]?_['map'](_0x4c498c['options'][_0xecf2('0x1e')],function(_0x4f2671){return{'model':db[_0x4f2671[_0xecf2('0x1f')]],'as':_0x4f2671['as'],'attributes':_0x4f2671[_0xecf2('0x20')],'include':_0x4f2671[_0xecf2('0x1e')]?_[_0xecf2('0x25')](_0x4f2671['include'],function(_0x544bd9){return{'model':db[_0x544bd9[_0xecf2('0x1f')]],'as':_0x544bd9['as'],'attributes':_0x544bd9[_0xecf2('0x20')],'include':_0x544bd9[_0xecf2('0x1e')]?_[_0xecf2('0x25')](_0x544bd9[_0xecf2('0x1e')],function(_0x17c1f3){return{'model':db[_0x17c1f3[_0xecf2('0x1f')]],'as':_0x17c1f3['as'],'attributes':_0x17c1f3[_0xecf2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xecf2('0xd')](function(_0x5c52b6){logger[_0xecf2('0x15')](_0xecf2('0x23'),_0x4c498c);logger[_0xecf2('0x10')](_0xecf2('0x23'),_0x4c498c,JSON[_0xecf2('0x21')](_0x5c52b6));_0x4d0e68(_0x5c52b6);})[_0xecf2('0x22')](function(_0xd3b6ec){logger['error'](_0xecf2('0x23'),_0xd3b6ec[_0xecf2('0x14')],_0x4c498c);_0xa349aa(_0x258223[_0xecf2('0x12')](0x1f4,_0xd3b6ec[_0xecf2('0x14')]));});});}; \ No newline at end of file +var _0xa600=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','map','model','attributes','find','ShowDynamics365Account','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xa600,0x166));var _0x0a60=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xa600[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require(_0x0a60('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0a60('0x1'));var rs=require(_0x0a60('0x2'));var fs=require('fs');var Redis=require(_0x0a60('0x3'));var db=require(_0x0a60('0x4'))['db'];var utils=require(_0x0a60('0x5'));var logger=require(_0x0a60('0x6'))('rpc');var config=require(_0x0a60('0x7'));var jayson=require(_0x0a60('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2afe49,_0x41f58d,_0x1367d6){return new BPromise(function(_0x3b0caf,_0x326065){return client[_0x0a60('0x9')](_0x2afe49,_0x1367d6)[_0x0a60('0xa')](function(_0x292e73){logger[_0x0a60('0xb')](_0x0a60('0xc'),_0x41f58d,_0x0a60('0xd'));logger[_0x0a60('0xe')](_0x0a60('0xf'),_0x41f58d,'request\x20sent',JSON[_0x0a60('0x10')](_0x292e73));if(_0x292e73[_0x0a60('0x11')]){if(_0x292e73[_0x0a60('0x11')]['code']===0x1f4){logger['error'](_0x0a60('0xc'),_0x41f58d,_0x292e73[_0x0a60('0x11')]['message']);return _0x326065(_0x292e73[_0x0a60('0x11')][_0x0a60('0x12')]);}logger[_0x0a60('0x11')](_0x0a60('0xc'),_0x41f58d,_0x292e73['error'][_0x0a60('0x12')]);return _0x3b0caf(_0x292e73[_0x0a60('0x11')][_0x0a60('0x12')]);}else{logger['info'](_0x0a60('0xc'),_0x41f58d,_0x0a60('0xd'));_0x3b0caf(_0x292e73[_0x0a60('0x13')][_0x0a60('0x12')]);}})[_0x0a60('0x14')](function(_0x420091){logger[_0x0a60('0x11')](_0x0a60('0xc'),_0x41f58d,_0x420091);_0x326065(_0x420091);});});}exports[_0x0a60('0x15')]=function(_0xb726aa){var _0xcd4eb8=this;return new Promise(function(_0x3b0000,_0x14925f){return db[_0x0a60('0x16')][_0x0a60('0x17')]({'raw':_0xb726aa[_0x0a60('0x18')]?_0xb726aa[_0x0a60('0x18')][_0x0a60('0x19')]===undefined?!![]:![]:!![],'where':_0xb726aa[_0x0a60('0x18')]?_0xb726aa[_0x0a60('0x18')][_0x0a60('0x1a')]||null:null,'attributes':_0xb726aa[_0x0a60('0x18')]?_0xb726aa[_0x0a60('0x18')]['attributes']||null:null,'limit':_0xb726aa[_0x0a60('0x18')]?_0xb726aa[_0x0a60('0x18')]['limit']||null:null,'include':_0xb726aa['options']?_0xb726aa[_0x0a60('0x18')][_0x0a60('0x1b')]?_[_0x0a60('0x1c')](_0xb726aa['options']['include'],function(_0x38f4fa){return{'model':db[_0x38f4fa[_0x0a60('0x1d')]],'as':_0x38f4fa['as'],'attributes':_0x38f4fa[_0x0a60('0x1e')],'include':_0x38f4fa['include']?_[_0x0a60('0x1c')](_0x38f4fa[_0x0a60('0x1b')],function(_0x162069){return{'model':db[_0x162069[_0x0a60('0x1d')]],'as':_0x162069['as'],'attributes':_0x162069['attributes'],'include':_0x162069[_0x0a60('0x1b')]?_[_0x0a60('0x1c')](_0x162069[_0x0a60('0x1b')],function(_0x35374e){return{'model':db[_0x35374e[_0x0a60('0x1d')]],'as':_0x35374e['as'],'attributes':_0x35374e[_0x0a60('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a60('0xa')](function(_0x467783){logger[_0x0a60('0xb')]('GetDynamics365Account',_0xb726aa);logger[_0x0a60('0xe')](_0x0a60('0x15'),_0xb726aa,JSON['stringify'](_0x467783));_0x3b0000(_0x467783);})[_0x0a60('0x14')](function(_0x44d718){logger['error']('GetDynamics365Account',_0x44d718[_0x0a60('0x12')],_0xb726aa);_0x14925f(_0xcd4eb8[_0x0a60('0x11')](0x1f4,_0x44d718[_0x0a60('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x4e64e6){var _0x20d3d7=this;return new Promise(function(_0xe7b9eb,_0x2ccb82){return db[_0x0a60('0x16')][_0x0a60('0x1f')]({'raw':_0x4e64e6['options']?_0x4e64e6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e64e6[_0x0a60('0x18')]?_0x4e64e6[_0x0a60('0x18')][_0x0a60('0x1a')]||null:null,'attributes':_0x4e64e6[_0x0a60('0x18')]?_0x4e64e6[_0x0a60('0x18')][_0x0a60('0x1e')]||null:null,'include':_0x4e64e6[_0x0a60('0x18')]?_0x4e64e6[_0x0a60('0x18')][_0x0a60('0x1b')]?_[_0x0a60('0x1c')](_0x4e64e6[_0x0a60('0x18')][_0x0a60('0x1b')],function(_0x5ae267){return{'model':db[_0x5ae267['model']],'as':_0x5ae267['as'],'attributes':_0x5ae267['attributes'],'include':_0x5ae267['include']?_[_0x0a60('0x1c')](_0x5ae267[_0x0a60('0x1b')],function(_0xfc38a){return{'model':db[_0xfc38a[_0x0a60('0x1d')]],'as':_0xfc38a['as'],'attributes':_0xfc38a['attributes'],'include':_0xfc38a['include']?_[_0x0a60('0x1c')](_0xfc38a[_0x0a60('0x1b')],function(_0x53cdd9){return{'model':db[_0x53cdd9[_0x0a60('0x1d')]],'as':_0x53cdd9['as'],'attributes':_0x53cdd9[_0x0a60('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0a60('0xa')](function(_0x1a5fa1){logger[_0x0a60('0xb')](_0x0a60('0x20'),_0x4e64e6);logger[_0x0a60('0xe')](_0x0a60('0x20'),_0x4e64e6,JSON[_0x0a60('0x10')](_0x1a5fa1));_0xe7b9eb(_0x1a5fa1);})[_0x0a60('0x14')](function(_0x554935){logger[_0x0a60('0x11')](_0x0a60('0x20'),_0x554935['message'],_0x4e64e6);_0x2ccb82(_0x20d3d7[_0x0a60('0x11')](0x1f4,_0x554935[_0x0a60('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 040a960..5bcd781 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b2f=['index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xcb935,_0x7490c2){var _0x6e13f=function(_0x2a2232){while(--_0x2a2232){_0xcb935['push'](_0xcb935['shift']());}};_0x6e13f(++_0x7490c2);}(_0x0b2f,0x1f2));var _0xf0b2=function(_0x126c58,_0x79f2d9){_0x126c58=_0x126c58-0x0;var _0x79e4e3=_0x0b2f[_0x126c58];return _0x79e4e3;};'use strict';var multer=require(_0xf0b2('0x0'));var util=require('util');var path=require(_0xf0b2('0x1'));var timeout=require(_0xf0b2('0x2'));var express=require(_0xf0b2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0b2('0x4'));var config=require(_0xf0b2('0x5'));var controller=require('./intDynamics365Configuration.controller');router[_0xf0b2('0x6')]('/',auth[_0xf0b2('0x7')](),controller[_0xf0b2('0x8')]);router[_0xf0b2('0x6')](_0xf0b2('0x9'),auth['isAuthenticated'](),controller[_0xf0b2('0xa')]);router[_0xf0b2('0x6')](_0xf0b2('0xb'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xf0b2('0xc'),auth['isAuthenticated'](),controller[_0xf0b2('0xd')]);router[_0xf0b2('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf0b2('0xe')]);router[_0xf0b2('0xf')]('/',auth[_0xf0b2('0x7')](),controller[_0xf0b2('0x10')]);router[_0xf0b2('0x11')](_0xf0b2('0x9'),auth[_0xf0b2('0x7')](),controller[_0xf0b2('0x12')]);router[_0xf0b2('0x13')](_0xf0b2('0x9'),auth[_0xf0b2('0x7')](),controller[_0xf0b2('0x14')]);module[_0xf0b2('0x15')]=router; \ No newline at end of file +var _0xa8e2=['index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x142157,_0xefec6f){var _0x49f5da=function(_0xd3c147){while(--_0xd3c147){_0x142157['push'](_0x142157['shift']());}};_0x49f5da(++_0xefec6f);}(_0xa8e2,0xa6));var _0x2a8e=function(_0x19d3f3,_0x2dba82){_0x19d3f3=_0x19d3f3-0x0;var _0x187202=_0xa8e2[_0x19d3f3];return _0x187202;};'use strict';var multer=require('multer');var util=require(_0x2a8e('0x0'));var path=require(_0x2a8e('0x1'));var timeout=require(_0x2a8e('0x2'));var express=require(_0x2a8e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2a8e('0x4'));var interaction=require(_0x2a8e('0x5'));var config=require(_0x2a8e('0x6'));var controller=require(_0x2a8e('0x7'));router[_0x2a8e('0x8')]('/',auth[_0x2a8e('0x9')](),controller[_0x2a8e('0xa')]);router[_0x2a8e('0x8')](_0x2a8e('0xb'),auth[_0x2a8e('0x9')](),controller['show']);router['get'](_0x2a8e('0xc'),auth[_0x2a8e('0x9')](),controller[_0x2a8e('0xd')]);router[_0x2a8e('0x8')]('/:id/subjects',auth[_0x2a8e('0x9')](),controller[_0x2a8e('0xe')]);router['get'](_0x2a8e('0xf'),auth[_0x2a8e('0x9')](),controller[_0x2a8e('0x10')]);router[_0x2a8e('0x11')]('/',auth[_0x2a8e('0x9')](),controller[_0x2a8e('0x12')]);router['put'](_0x2a8e('0xb'),auth['isAuthenticated'](),controller[_0x2a8e('0x13')]);router['delete'](_0x2a8e('0xb'),auth[_0x2a8e('0x9')](),controller[_0x2a8e('0x14')]);module[_0x2a8e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 073ae6b..f6bc4b9 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c1f=['ENUM','contact','BOOLEAN','exports','STRING','incident','phonecall'];(function(_0x48bbd8,_0x1514d8){var _0x372eae=function(_0x1f144c){while(--_0x1f144c){_0x48bbd8['push'](_0x48bbd8['shift']());}};_0x372eae(++_0x1514d8);}(_0x0c1f,0x1b5));var _0xf0c1=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0x0c1f[_0x54ea7a];return _0x65a10d;};'use strict';var Sequelize=require('sequelize');module[_0xf0c1('0x0')]={'name':{'type':Sequelize[_0xf0c1('0x1')]},'description':{'type':Sequelize[_0xf0c1('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xf0c1('0x2'),_0xf0c1('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xf0c1('0x4')]('contact','nothing'),'defaultValue':_0xf0c1('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xf0c1('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xf0c1('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x55b6=['ENUM','incident','BOOLEAN','sequelize','exports','STRING'];(function(_0x22feaa,_0x1fb940){var _0x28b604=function(_0x519ca1){while(--_0x519ca1){_0x22feaa['push'](_0x22feaa['shift']());}};_0x28b604(++_0x1fb940);}(_0x55b6,0x1e3));var _0x655b=function(_0x1cd9f0,_0x302001){_0x1cd9f0=_0x1cd9f0-0x0;var _0x5b55fc=_0x55b6[_0x1cd9f0];return _0x5b55fc;};'use strict';var Sequelize=require(_0x655b('0x0'));module[_0x655b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x655b('0x2')]},'ticketType':{'type':Sequelize[_0x655b('0x3')](_0x655b('0x4'),'phonecall'),'defaultValue':_0x655b('0x4')},'moduleCreate':{'type':Sequelize[_0x655b('0x3')]('contact','nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x655b('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8b2dc98..2f20288 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b68=['name','send','map','Dynamics365Configuration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','destroy','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','error'];(function(_0x4f19ff,_0x2560b1){var _0x3c6d05=function(_0xcaa95f){while(--_0xcaa95f){_0x4f19ff['push'](_0x4f19ff['shift']());}};_0x3c6d05(++_0x2560b1);}(_0x7b68,0x116));var _0x87b6=function(_0x391900,_0x38dc73){_0x391900=_0x391900-0x0;var _0xcf8e7b=_0x7b68[_0x391900];return _0xcf8e7b;};'use strict';var emlformat=require(_0x87b6('0x0'));var rimraf=require(_0x87b6('0x1'));var zipdir=require(_0x87b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87b6('0x3'));var moment=require(_0x87b6('0x4'));var BPromise=require(_0x87b6('0x5'));var Mustache=require(_0x87b6('0x6'));var util=require(_0x87b6('0x7'));var path=require(_0x87b6('0x8'));var sox=require(_0x87b6('0x9'));var csv=require(_0x87b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87b6('0xb'));var _=require(_0x87b6('0xc'));var squel=require(_0x87b6('0xd'));var crypto=require(_0x87b6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x87b6('0xa'));var querystring=require(_0x87b6('0xf'));var Papa=require('papaparse');var Redis=require(_0x87b6('0x10'));var authService=require(_0x87b6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x87b6('0x12'));var hardwareService=require(_0x87b6('0x13'));var logger=require(_0x87b6('0x14'))(_0x87b6('0x15'));var utils=require(_0x87b6('0x16'));var config=require(_0x87b6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x87b6('0x18'))['db'];function respondWithStatusCode(_0x442cb6,_0x57fb93){_0x57fb93=_0x57fb93||0xcc;return function(_0x566e31){if(_0x566e31){return _0x442cb6[_0x87b6('0x19')](_0x57fb93);}return _0x442cb6['status'](_0x57fb93)[_0x87b6('0x1a')]();};}function respondWithResult(_0x25c74b,_0x3a452f){_0x3a452f=_0x3a452f||0xc8;return function(_0x21a9b4){if(_0x21a9b4){return _0x25c74b[_0x87b6('0x1b')](_0x3a452f)[_0x87b6('0x1c')](_0x21a9b4);}};}function respondWithFilteredResult(_0x3ee951,_0x2a0a01){return function(_0x817715){if(_0x817715){var _0x2647c8=typeof _0x2a0a01[_0x87b6('0x1d')]===_0x87b6('0x1e')&&typeof _0x2a0a01[_0x87b6('0x1f')]===_0x87b6('0x1e');var _0x252fa9=_0x817715[_0x87b6('0x20')];var _0x275a09=_0x2647c8?0x0:_0x2a0a01['offset'];var _0x5f45cc=_0x2647c8?_0x817715[_0x87b6('0x20')]:_0x2a0a01[_0x87b6('0x1d')]+_0x2a0a01[_0x87b6('0x1f')];var _0x571512;if(_0x5f45cc>=_0x252fa9){_0x5f45cc=_0x252fa9;_0x571512=0xc8;}else{_0x571512=0xce;}_0x3ee951[_0x87b6('0x1b')](_0x571512);return _0x3ee951['set'](_0x87b6('0x21'),_0x275a09+'-'+_0x5f45cc+'/'+_0x252fa9)[_0x87b6('0x1c')](_0x817715);}return null;};}function patchUpdates(_0x2c3594){return function(_0x2a6b87){try{jsonpatch[_0x87b6('0x22')](_0x2a6b87,_0x2c3594,!![]);}catch(_0x46a953){return BPromise['reject'](_0x46a953);}return _0x2a6b87[_0x87b6('0x23')]();};}function saveUpdates(_0x4d805c,_0x544717){return function(_0x1f6000){if(_0x1f6000){return _0x1f6000['update'](_0x4d805c)[_0x87b6('0x24')](function(_0x434eda){return _0x434eda;});}return null;};}function removeEntity(_0x5790e9,_0x123dd8){return function(_0x5e0be2){if(_0x5e0be2){return _0x5e0be2['destroy']()[_0x87b6('0x24')](function(){_0x5790e9['status'](0xcc)[_0x87b6('0x1a')]();});}};}function handleEntityNotFound(_0x54f4b3,_0x1010cc){return function(_0x5e0168){if(!_0x5e0168){_0x54f4b3['sendStatus'](0x194);}return _0x5e0168;};}function handleError(_0x1c59a0,_0x3d0e1e){_0x3d0e1e=_0x3d0e1e||0x1f4;return function(_0x1f72f9){logger[_0x87b6('0x25')](_0x1f72f9['stack']);if(_0x1f72f9[_0x87b6('0x26')]){delete _0x1f72f9[_0x87b6('0x26')];}_0x1c59a0['status'](_0x3d0e1e)[_0x87b6('0x27')](_0x1f72f9);};}exports['index']=function(_0x2add8f,_0x543ea6){var _0x30bcf5={},_0x2ec0b7={},_0x148618={'count':0x0,'rows':[]};var _0x3fad15=_[_0x87b6('0x28')](db[_0x87b6('0x29')][_0x87b6('0x2a')],function(_0x12bd17){return{'name':_0x12bd17['fieldName'],'type':_0x12bd17[_0x87b6('0x2b')][_0x87b6('0x2c')]};});_0x2ec0b7['model']=_[_0x87b6('0x28')](_0x3fad15,_0x87b6('0x26'));_0x2ec0b7[_0x87b6('0x2d')]=_[_0x87b6('0x2e')](_0x2add8f['query']);_0x2ec0b7[_0x87b6('0x2f')]=_[_0x87b6('0x30')](_0x2ec0b7[_0x87b6('0x31')],_0x2ec0b7['query']);_0x30bcf5[_0x87b6('0x32')]=_[_0x87b6('0x30')](_0x2ec0b7[_0x87b6('0x31')],qs[_0x87b6('0x33')](_0x2add8f[_0x87b6('0x2d')][_0x87b6('0x33')]));_0x30bcf5[_0x87b6('0x32')]=_0x30bcf5[_0x87b6('0x32')][_0x87b6('0x34')]?_0x30bcf5['attributes']:_0x2ec0b7['model'];if(!_0x2add8f[_0x87b6('0x2d')][_0x87b6('0x35')](_0x87b6('0x36'))){_0x30bcf5[_0x87b6('0x1f')]=qs[_0x87b6('0x1f')](_0x2add8f[_0x87b6('0x2d')]['limit']);_0x30bcf5['offset']=qs[_0x87b6('0x1d')](_0x2add8f[_0x87b6('0x2d')]['offset']);}_0x30bcf5[_0x87b6('0x37')]=qs[_0x87b6('0x38')](_0x2add8f[_0x87b6('0x2d')][_0x87b6('0x38')]);_0x30bcf5[_0x87b6('0x39')]=qs[_0x87b6('0x2f')](_[_0x87b6('0x3a')](_0x2add8f[_0x87b6('0x2d')],_0x2ec0b7[_0x87b6('0x2f')]),_0x3fad15);if(_0x2add8f[_0x87b6('0x2d')]['filter']){_0x30bcf5[_0x87b6('0x39')]=_[_0x87b6('0x3b')](_0x30bcf5[_0x87b6('0x39')],{'$or':_[_0x87b6('0x28')](_0x3fad15,function(_0x5cee3f){if(_0x5cee3f[_0x87b6('0x2b')]!==_0x87b6('0x3c')){var _0x24dad8={};_0x24dad8[_0x5cee3f[_0x87b6('0x26')]]={'$like':'%'+_0x2add8f[_0x87b6('0x2d')][_0x87b6('0x3d')]+'%'};return _0x24dad8;}})});}_0x30bcf5=_[_0x87b6('0x3b')]({},_0x30bcf5,_0x2add8f['options']);var _0x32660c={'where':_0x30bcf5[_0x87b6('0x39')]};return db['Dynamics365Configuration']['count'](_0x32660c)['then'](function(_0x2b0a55){_0x148618[_0x87b6('0x20')]=_0x2b0a55;if(_0x2add8f[_0x87b6('0x2d')][_0x87b6('0x3e')]){_0x30bcf5[_0x87b6('0x3f')]=[{'all':!![]}];}return db[_0x87b6('0x29')][_0x87b6('0x40')](_0x30bcf5);})[_0x87b6('0x24')](function(_0x5c53fe){_0x148618[_0x87b6('0x41')]=_0x5c53fe;return _0x148618;})[_0x87b6('0x24')](respondWithFilteredResult(_0x543ea6,_0x30bcf5))['catch'](handleError(_0x543ea6,null));};exports[_0x87b6('0x42')]=function(_0x4076a8,_0x45b581){var _0x246f89={'raw':![],'where':{'id':_0x4076a8[_0x87b6('0x43')]['id']}},_0x13abf5={};_0x13abf5[_0x87b6('0x31')]=_[_0x87b6('0x2e')](db['Dynamics365Configuration']['rawAttributes']);_0x13abf5['query']=_[_0x87b6('0x2e')](_0x4076a8[_0x87b6('0x2d')]);_0x13abf5['filters']=_[_0x87b6('0x30')](_0x13abf5['model'],_0x13abf5['query']);_0x246f89['attributes']=_[_0x87b6('0x30')](_0x13abf5[_0x87b6('0x31')],qs[_0x87b6('0x33')](_0x4076a8[_0x87b6('0x2d')][_0x87b6('0x33')]));_0x246f89[_0x87b6('0x32')]=_0x246f89['attributes'][_0x87b6('0x34')]?_0x246f89[_0x87b6('0x32')]:_0x13abf5[_0x87b6('0x31')];if(_0x4076a8['query']['includeAll']){_0x246f89[_0x87b6('0x3f')]=[{'all':!![]}];}_0x246f89=_[_0x87b6('0x3b')]({},_0x246f89,_0x4076a8[_0x87b6('0x44')]);return db['Dynamics365Configuration']['find'](_0x246f89)[_0x87b6('0x24')](handleEntityNotFound(_0x45b581,null))['then'](respondWithResult(_0x45b581,null))[_0x87b6('0x45')](handleError(_0x45b581,null));};exports['create']=function(_0x1f2f82,_0x55fa6){return db[_0x87b6('0x29')][_0x87b6('0x46')](_0x1f2f82['body'],{})[_0x87b6('0x24')](respondWithResult(_0x55fa6,0xc9))['catch'](handleError(_0x55fa6,null));};exports['update']=function(_0x4bfad0,_0x3829e0){if(_0x4bfad0[_0x87b6('0x47')]['id']){delete _0x4bfad0[_0x87b6('0x47')]['id'];}return db[_0x87b6('0x29')][_0x87b6('0x48')]({'where':{'id':_0x4bfad0[_0x87b6('0x43')]['id']}})['then'](handleEntityNotFound(_0x3829e0,null))[_0x87b6('0x24')](saveUpdates(_0x4bfad0[_0x87b6('0x47')],null))[_0x87b6('0x24')](respondWithResult(_0x3829e0,null))[_0x87b6('0x45')](handleError(_0x3829e0,null));};exports[_0x87b6('0x49')]=function(_0x590a77,_0x1366ce){return db['Dynamics365Configuration']['find']({'where':{'id':_0x590a77[_0x87b6('0x43')]['id']}})[_0x87b6('0x24')](handleEntityNotFound(_0x1366ce,null))[_0x87b6('0x24')](removeEntity(_0x1366ce,null))['catch'](handleError(_0x1366ce,null));};exports[_0x87b6('0x4a')]=function(_0x4edb30,_0x19c585,_0x3e44a8){var _0x3f1421={};var _0x5ccaa7={};var _0x2788c8;var _0x32e3e8;return db['Dynamics365Configuration'][_0x87b6('0x4b')]({'where':{'id':_0x4edb30['params']['id']}})[_0x87b6('0x24')](handleEntityNotFound(_0x19c585,null))[_0x87b6('0x24')](function(_0x126cde){if(_0x126cde){_0x2788c8=_0x126cde;_0x5ccaa7[_0x87b6('0x31')]=_[_0x87b6('0x2e')](db['Dynamics365Field'][_0x87b6('0x2a')]);_0x5ccaa7[_0x87b6('0x2d')]=_[_0x87b6('0x2e')](_0x4edb30[_0x87b6('0x2d')]);_0x5ccaa7[_0x87b6('0x2f')]=_['intersection'](_0x5ccaa7[_0x87b6('0x31')],_0x5ccaa7[_0x87b6('0x2d')]);_0x3f1421[_0x87b6('0x32')]=_['intersection'](_0x5ccaa7[_0x87b6('0x31')],qs['fields'](_0x4edb30['query'][_0x87b6('0x33')]));_0x3f1421['attributes']=_0x3f1421[_0x87b6('0x32')]['length']?_0x3f1421[_0x87b6('0x32')]:_0x5ccaa7['model'];_0x3f1421[_0x87b6('0x37')]=qs[_0x87b6('0x38')](_0x4edb30['query']['sort']);_0x3f1421[_0x87b6('0x39')]=qs[_0x87b6('0x2f')](_[_0x87b6('0x3a')](_0x4edb30[_0x87b6('0x2d')],_0x5ccaa7[_0x87b6('0x2f')]));if(_0x4edb30['query'][_0x87b6('0x3d')]){_0x3f1421[_0x87b6('0x39')]=_['merge'](_0x3f1421['where'],{'$or':_[_0x87b6('0x28')](_0x3f1421[_0x87b6('0x32')],function(_0x5077b9){var _0x44ea70={};_0x44ea70[_0x5077b9]={'$like':'%'+_0x4edb30[_0x87b6('0x2d')][_0x87b6('0x3d')]+'%'};return _0x44ea70;})});}_0x3f1421=_[_0x87b6('0x3b')]({},_0x3f1421,_0x4edb30[_0x87b6('0x44')]);return _0x2788c8['getFields'](_0x3f1421);}})[_0x87b6('0x24')](function(_0xe4f30b){if(_0xe4f30b){_0x32e3e8=_0xe4f30b[_0x87b6('0x34')];if(!_0x4edb30[_0x87b6('0x2d')][_0x87b6('0x35')]('nolimit')){_0x3f1421['limit']=qs['limit'](_0x4edb30[_0x87b6('0x2d')]['limit']);_0x3f1421[_0x87b6('0x1d')]=qs['offset'](_0x4edb30['query'][_0x87b6('0x1d')]);}return _0x2788c8[_0x87b6('0x4a')](_0x3f1421);}})['then'](function(_0x4521f9){if(_0x4521f9){return _0x4521f9?{'count':_0x32e3e8,'rows':_0x4521f9}:null;}})[_0x87b6('0x24')](respondWithResult(_0x19c585,null))['catch'](handleError(_0x19c585,null));};exports[_0x87b6('0x4c')]=function(_0x47f953,_0x13fc0e,_0xec48b0){var _0x1efe82={};var _0x10e813={};var _0x296faf;var _0x3081ba;return db[_0x87b6('0x29')][_0x87b6('0x4b')]({'where':{'id':_0x47f953['params']['id']}})[_0x87b6('0x24')](handleEntityNotFound(_0x13fc0e,null))[_0x87b6('0x24')](function(_0x2748f9){if(_0x2748f9){_0x296faf=_0x2748f9;_0x10e813['model']=_[_0x87b6('0x2e')](db[_0x87b6('0x4d')][_0x87b6('0x2a')]);_0x10e813[_0x87b6('0x2d')]=_[_0x87b6('0x2e')](_0x47f953[_0x87b6('0x2d')]);_0x10e813['filters']=_[_0x87b6('0x30')](_0x10e813[_0x87b6('0x31')],_0x10e813[_0x87b6('0x2d')]);_0x1efe82[_0x87b6('0x32')]=_['intersection'](_0x10e813[_0x87b6('0x31')],qs[_0x87b6('0x33')](_0x47f953['query'][_0x87b6('0x33')]));_0x1efe82[_0x87b6('0x32')]=_0x1efe82['attributes']['length']?_0x1efe82[_0x87b6('0x32')]:_0x10e813[_0x87b6('0x31')];_0x1efe82[_0x87b6('0x37')]=qs[_0x87b6('0x38')](_0x47f953[_0x87b6('0x2d')][_0x87b6('0x38')]);_0x1efe82[_0x87b6('0x39')]=qs[_0x87b6('0x2f')](_[_0x87b6('0x3a')](_0x47f953[_0x87b6('0x2d')],_0x10e813[_0x87b6('0x2f')]));if(_0x47f953[_0x87b6('0x2d')]['filter']){_0x1efe82[_0x87b6('0x39')]=_['merge'](_0x1efe82[_0x87b6('0x39')],{'$or':_[_0x87b6('0x28')](_0x1efe82[_0x87b6('0x32')],function(_0x36a00){var _0x3af3d5={};_0x3af3d5[_0x36a00]={'$like':'%'+_0x47f953[_0x87b6('0x2d')][_0x87b6('0x3d')]+'%'};return _0x3af3d5;})});}_0x1efe82=_[_0x87b6('0x3b')]({},_0x1efe82,_0x47f953['options']);return _0x296faf[_0x87b6('0x4c')](_0x1efe82);}})[_0x87b6('0x24')](function(_0x2d555){if(_0x2d555){_0x3081ba=_0x2d555['length'];if(!_0x47f953[_0x87b6('0x2d')][_0x87b6('0x35')](_0x87b6('0x36'))){_0x1efe82[_0x87b6('0x1f')]=qs[_0x87b6('0x1f')](_0x47f953[_0x87b6('0x2d')][_0x87b6('0x1f')]);_0x1efe82[_0x87b6('0x1d')]=qs[_0x87b6('0x1d')](_0x47f953[_0x87b6('0x2d')][_0x87b6('0x1d')]);}return _0x296faf['getSubjects'](_0x1efe82);}})[_0x87b6('0x24')](function(_0x2d32f3){if(_0x2d32f3){return _0x2d32f3?{'count':_0x3081ba,'rows':_0x2d32f3}:null;}})[_0x87b6('0x24')](respondWithResult(_0x13fc0e,null))[_0x87b6('0x45')](handleError(_0x13fc0e,null));};exports['getDescriptions']=function(_0x3016d7,_0x21c76c,_0xa10690){var _0x593c45={};var _0x366497={};var _0x38607b;var _0x4f6eba;return db[_0x87b6('0x29')]['findOne']({'where':{'id':_0x3016d7[_0x87b6('0x43')]['id']}})[_0x87b6('0x24')](handleEntityNotFound(_0x21c76c,null))[_0x87b6('0x24')](function(_0x1899ac){if(_0x1899ac){_0x38607b=_0x1899ac;_0x366497['model']=_[_0x87b6('0x2e')](db['Dynamics365Field'][_0x87b6('0x2a')]);_0x366497[_0x87b6('0x2d')]=_['keys'](_0x3016d7[_0x87b6('0x2d')]);_0x366497[_0x87b6('0x2f')]=_[_0x87b6('0x30')](_0x366497[_0x87b6('0x31')],_0x366497[_0x87b6('0x2d')]);_0x593c45[_0x87b6('0x32')]=_['intersection'](_0x366497[_0x87b6('0x31')],qs[_0x87b6('0x33')](_0x3016d7['query']['fields']));_0x593c45[_0x87b6('0x32')]=_0x593c45[_0x87b6('0x32')][_0x87b6('0x34')]?_0x593c45[_0x87b6('0x32')]:_0x366497['model'];_0x593c45[_0x87b6('0x37')]=qs[_0x87b6('0x38')](_0x3016d7[_0x87b6('0x2d')][_0x87b6('0x38')]);_0x593c45[_0x87b6('0x39')]=qs['filters'](_['pick'](_0x3016d7[_0x87b6('0x2d')],_0x366497['filters']));if(_0x3016d7[_0x87b6('0x2d')]['filter']){_0x593c45[_0x87b6('0x39')]=_[_0x87b6('0x3b')](_0x593c45['where'],{'$or':_[_0x87b6('0x28')](_0x593c45['attributes'],function(_0x2b34ec){var _0x351826={};_0x351826[_0x2b34ec]={'$like':'%'+_0x3016d7[_0x87b6('0x2d')][_0x87b6('0x3d')]+'%'};return _0x351826;})});}_0x593c45=_[_0x87b6('0x3b')]({},_0x593c45,_0x3016d7[_0x87b6('0x44')]);return _0x38607b[_0x87b6('0x4e')](_0x593c45);}})[_0x87b6('0x24')](function(_0x3fe31c){if(_0x3fe31c){_0x4f6eba=_0x3fe31c[_0x87b6('0x34')];if(!_0x3016d7[_0x87b6('0x2d')][_0x87b6('0x35')](_0x87b6('0x36'))){_0x593c45[_0x87b6('0x1f')]=qs[_0x87b6('0x1f')](_0x3016d7[_0x87b6('0x2d')][_0x87b6('0x1f')]);_0x593c45['offset']=qs[_0x87b6('0x1d')](_0x3016d7[_0x87b6('0x2d')]['offset']);}return _0x38607b[_0x87b6('0x4e')](_0x593c45);}})['then'](function(_0x2bf70a){if(_0x2bf70a){return _0x2bf70a?{'count':_0x4f6eba,'rows':_0x2bf70a}:null;}})[_0x87b6('0x24')](respondWithResult(_0x21c76c,null))[_0x87b6('0x45')](handleError(_0x21c76c,null));}; \ No newline at end of file +var _0x50a3=['nolimit','findOne','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','name','send','Dynamics365Configuration','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','hasOwnProperty'];(function(_0x49309b,_0x4b048d){var _0x2e6d7e=function(_0x897b09){while(--_0x897b09){_0x49309b['push'](_0x49309b['shift']());}};_0x2e6d7e(++_0x4b048d);}(_0x50a3,0xa1));var _0x350a=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x50a3[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require(_0x350a('0x0'));var rimraf=require(_0x350a('0x1'));var zipdir=require(_0x350a('0x2'));var jsonpatch=require(_0x350a('0x3'));var rp=require(_0x350a('0x4'));var moment=require(_0x350a('0x5'));var BPromise=require(_0x350a('0x6'));var Mustache=require(_0x350a('0x7'));var util=require(_0x350a('0x8'));var path=require(_0x350a('0x9'));var sox=require(_0x350a('0xa'));var csv=require(_0x350a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x350a('0xc'));var crypto=require(_0x350a('0xd'));var jsforce=require(_0x350a('0xe'));var deskjs=require(_0x350a('0xf'));var toCsv=require(_0x350a('0xb'));var querystring=require(_0x350a('0x10'));var Papa=require(_0x350a('0x11'));var Redis=require('ioredis');var authService=require(_0x350a('0x12'));var qs=require(_0x350a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x350a('0x14'));var utils=require(_0x350a('0x15'));var config=require(_0x350a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x350a('0x17'))['db'];function respondWithStatusCode(_0x5a85dd,_0x5ab113){_0x5ab113=_0x5ab113||0xcc;return function(_0x854d76){if(_0x854d76){return _0x5a85dd[_0x350a('0x18')](_0x5ab113);}return _0x5a85dd[_0x350a('0x19')](_0x5ab113)[_0x350a('0x1a')]();};}function respondWithResult(_0x1902db,_0x21a064){_0x21a064=_0x21a064||0xc8;return function(_0x216fad){if(_0x216fad){return _0x1902db[_0x350a('0x19')](_0x21a064)['json'](_0x216fad);}};}function respondWithFilteredResult(_0x58e1ac,_0x4e8e16){return function(_0x3da187){if(_0x3da187){var _0x4e75cc=typeof _0x4e8e16[_0x350a('0x1b')]===_0x350a('0x1c')&&typeof _0x4e8e16[_0x350a('0x1d')]==='undefined';var _0x341e46=_0x3da187[_0x350a('0x1e')];var _0x225742=_0x4e75cc?0x0:_0x4e8e16[_0x350a('0x1b')];var _0x192f1a=_0x4e75cc?_0x3da187['count']:_0x4e8e16[_0x350a('0x1b')]+_0x4e8e16[_0x350a('0x1d')];var _0x78779c;if(_0x192f1a>=_0x341e46){_0x192f1a=_0x341e46;_0x78779c=0xc8;}else{_0x78779c=0xce;}_0x58e1ac[_0x350a('0x19')](_0x78779c);return _0x58e1ac[_0x350a('0x1f')](_0x350a('0x20'),_0x225742+'-'+_0x192f1a+'/'+_0x341e46)['json'](_0x3da187);}return null;};}function patchUpdates(_0x4f85d1){return function(_0x1bd17a){try{jsonpatch[_0x350a('0x21')](_0x1bd17a,_0x4f85d1,!![]);}catch(_0x291089){return BPromise['reject'](_0x291089);}return _0x1bd17a[_0x350a('0x22')]();};}function saveUpdates(_0x352792,_0x1e5dcf){return function(_0x345376){if(_0x345376){return _0x345376[_0x350a('0x23')](_0x352792)[_0x350a('0x24')](function(_0x2506d7){return _0x2506d7;});}return null;};}function removeEntity(_0x5330f4,_0x2da4e2){return function(_0x39e0f4){if(_0x39e0f4){return _0x39e0f4['destroy']()[_0x350a('0x24')](function(){_0x5330f4[_0x350a('0x19')](0xcc)[_0x350a('0x1a')]();});}};}function handleEntityNotFound(_0x5b0bdd,_0x29160d){return function(_0x436513){if(!_0x436513){_0x5b0bdd[_0x350a('0x18')](0x194);}return _0x436513;};}function handleError(_0x4b2ed6,_0x13aa8f){_0x13aa8f=_0x13aa8f||0x1f4;return function(_0x2b0d58){logger[_0x350a('0x25')](_0x2b0d58['stack']);if(_0x2b0d58[_0x350a('0x26')]){delete _0x2b0d58['name'];}_0x4b2ed6['status'](_0x13aa8f)[_0x350a('0x27')](_0x2b0d58);};}exports['index']=function(_0x231a47,_0x3fb136){var _0x38da17={},_0x1714f8={},_0x4df55c={'count':0x0,'rows':[]};var _0x370f73=_['map'](db[_0x350a('0x28')][_0x350a('0x29')],function(_0x3d16ce){return{'name':_0x3d16ce['fieldName'],'type':_0x3d16ce['type'][_0x350a('0x2a')]};});_0x1714f8[_0x350a('0x2b')]=_[_0x350a('0x2c')](_0x370f73,'name');_0x1714f8[_0x350a('0x2d')]=_[_0x350a('0x2e')](_0x231a47[_0x350a('0x2d')]);_0x1714f8['filters']=_[_0x350a('0x2f')](_0x1714f8[_0x350a('0x2b')],_0x1714f8[_0x350a('0x2d')]);_0x38da17['attributes']=_[_0x350a('0x2f')](_0x1714f8[_0x350a('0x2b')],qs[_0x350a('0x30')](_0x231a47['query'][_0x350a('0x30')]));_0x38da17['attributes']=_0x38da17[_0x350a('0x31')][_0x350a('0x32')]?_0x38da17[_0x350a('0x31')]:_0x1714f8[_0x350a('0x2b')];if(!_0x231a47[_0x350a('0x2d')]['hasOwnProperty']('nolimit')){_0x38da17[_0x350a('0x1d')]=qs[_0x350a('0x1d')](_0x231a47[_0x350a('0x2d')]['limit']);_0x38da17[_0x350a('0x1b')]=qs[_0x350a('0x1b')](_0x231a47[_0x350a('0x2d')][_0x350a('0x1b')]);}_0x38da17[_0x350a('0x33')]=qs[_0x350a('0x34')](_0x231a47[_0x350a('0x2d')][_0x350a('0x34')]);_0x38da17[_0x350a('0x35')]=qs['filters'](_[_0x350a('0x36')](_0x231a47['query'],_0x1714f8[_0x350a('0x37')]),_0x370f73);if(_0x231a47[_0x350a('0x2d')][_0x350a('0x38')]){_0x38da17[_0x350a('0x35')]=_[_0x350a('0x39')](_0x38da17[_0x350a('0x35')],{'$or':_[_0x350a('0x2c')](_0x370f73,function(_0x462f44){if(_0x462f44[_0x350a('0x3a')]!=='VIRTUAL'){var _0x3bd77b={};_0x3bd77b[_0x462f44['name']]={'$like':'%'+_0x231a47['query'][_0x350a('0x38')]+'%'};return _0x3bd77b;}})});}_0x38da17=_['merge']({},_0x38da17,_0x231a47[_0x350a('0x3b')]);var _0xa3a698={'where':_0x38da17[_0x350a('0x35')]};return db['Dynamics365Configuration']['count'](_0xa3a698)['then'](function(_0x5ede77){_0x4df55c[_0x350a('0x1e')]=_0x5ede77;if(_0x231a47[_0x350a('0x2d')][_0x350a('0x3c')]){_0x38da17[_0x350a('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x350a('0x3e')](_0x38da17);})[_0x350a('0x24')](function(_0x5e1ce2){_0x4df55c[_0x350a('0x3f')]=_0x5e1ce2;return _0x4df55c;})['then'](respondWithFilteredResult(_0x3fb136,_0x38da17))[_0x350a('0x40')](handleError(_0x3fb136,null));};exports[_0x350a('0x41')]=function(_0x2f21bf,_0x3d5bfb){var _0x21d21b={'raw':![],'where':{'id':_0x2f21bf[_0x350a('0x42')]['id']}},_0x30f090={};_0x30f090['model']=_[_0x350a('0x2e')](db[_0x350a('0x28')]['rawAttributes']);_0x30f090[_0x350a('0x2d')]=_[_0x350a('0x2e')](_0x2f21bf[_0x350a('0x2d')]);_0x30f090[_0x350a('0x37')]=_[_0x350a('0x2f')](_0x30f090[_0x350a('0x2b')],_0x30f090['query']);_0x21d21b['attributes']=_[_0x350a('0x2f')](_0x30f090[_0x350a('0x2b')],qs[_0x350a('0x30')](_0x2f21bf[_0x350a('0x2d')][_0x350a('0x30')]));_0x21d21b[_0x350a('0x31')]=_0x21d21b[_0x350a('0x31')][_0x350a('0x32')]?_0x21d21b[_0x350a('0x31')]:_0x30f090[_0x350a('0x2b')];if(_0x2f21bf['query'][_0x350a('0x3c')]){_0x21d21b[_0x350a('0x3d')]=[{'all':!![]}];}_0x21d21b=_[_0x350a('0x39')]({},_0x21d21b,_0x2f21bf['options']);return db['Dynamics365Configuration'][_0x350a('0x43')](_0x21d21b)['then'](handleEntityNotFound(_0x3d5bfb,null))[_0x350a('0x24')](respondWithResult(_0x3d5bfb,null))[_0x350a('0x40')](handleError(_0x3d5bfb,null));};exports[_0x350a('0x44')]=function(_0x42050b,_0x2de6aa){return db['Dynamics365Configuration']['create'](_0x42050b[_0x350a('0x45')],{})[_0x350a('0x24')](respondWithResult(_0x2de6aa,0xc9))['catch'](handleError(_0x2de6aa,null));};exports[_0x350a('0x23')]=function(_0x389627,_0x4cb0ef){if(_0x389627[_0x350a('0x45')]['id']){delete _0x389627[_0x350a('0x45')]['id'];}return db[_0x350a('0x28')][_0x350a('0x43')]({'where':{'id':_0x389627['params']['id']}})[_0x350a('0x24')](handleEntityNotFound(_0x4cb0ef,null))['then'](saveUpdates(_0x389627[_0x350a('0x45')],null))['then'](respondWithResult(_0x4cb0ef,null))['catch'](handleError(_0x4cb0ef,null));};exports[_0x350a('0x46')]=function(_0x3c8f42,_0x4e03ea){return db['Dynamics365Configuration'][_0x350a('0x43')]({'where':{'id':_0x3c8f42[_0x350a('0x42')]['id']}})[_0x350a('0x24')](handleEntityNotFound(_0x4e03ea,null))[_0x350a('0x24')](removeEntity(_0x4e03ea,null))[_0x350a('0x40')](handleError(_0x4e03ea,null));};exports[_0x350a('0x47')]=function(_0x3c44e0,_0x1c755a,_0x1a2f6c){var _0x2cf01d={};var _0xa83705={};var _0x2ce9e7;var _0x1cf58c;return db[_0x350a('0x28')]['findOne']({'where':{'id':_0x3c44e0[_0x350a('0x42')]['id']}})[_0x350a('0x24')](handleEntityNotFound(_0x1c755a,null))['then'](function(_0x15b5ba){if(_0x15b5ba){_0x2ce9e7=_0x15b5ba;_0xa83705['model']=_[_0x350a('0x2e')](db['Dynamics365Field'][_0x350a('0x29')]);_0xa83705[_0x350a('0x2d')]=_[_0x350a('0x2e')](_0x3c44e0['query']);_0xa83705['filters']=_[_0x350a('0x2f')](_0xa83705[_0x350a('0x2b')],_0xa83705[_0x350a('0x2d')]);_0x2cf01d[_0x350a('0x31')]=_[_0x350a('0x2f')](_0xa83705[_0x350a('0x2b')],qs[_0x350a('0x30')](_0x3c44e0[_0x350a('0x2d')][_0x350a('0x30')]));_0x2cf01d[_0x350a('0x31')]=_0x2cf01d[_0x350a('0x31')][_0x350a('0x32')]?_0x2cf01d[_0x350a('0x31')]:_0xa83705[_0x350a('0x2b')];_0x2cf01d[_0x350a('0x33')]=qs[_0x350a('0x34')](_0x3c44e0[_0x350a('0x2d')][_0x350a('0x34')]);_0x2cf01d[_0x350a('0x35')]=qs['filters'](_[_0x350a('0x36')](_0x3c44e0['query'],_0xa83705[_0x350a('0x37')]));if(_0x3c44e0[_0x350a('0x2d')][_0x350a('0x38')]){_0x2cf01d[_0x350a('0x35')]=_[_0x350a('0x39')](_0x2cf01d['where'],{'$or':_[_0x350a('0x2c')](_0x2cf01d['attributes'],function(_0x11bda9){var _0x538f7d={};_0x538f7d[_0x11bda9]={'$like':'%'+_0x3c44e0[_0x350a('0x2d')][_0x350a('0x38')]+'%'};return _0x538f7d;})});}_0x2cf01d=_[_0x350a('0x39')]({},_0x2cf01d,_0x3c44e0[_0x350a('0x3b')]);return _0x2ce9e7[_0x350a('0x47')](_0x2cf01d);}})[_0x350a('0x24')](function(_0x2ab3d5){if(_0x2ab3d5){_0x1cf58c=_0x2ab3d5[_0x350a('0x32')];if(!_0x3c44e0[_0x350a('0x2d')][_0x350a('0x48')](_0x350a('0x49'))){_0x2cf01d[_0x350a('0x1d')]=qs[_0x350a('0x1d')](_0x3c44e0[_0x350a('0x2d')][_0x350a('0x1d')]);_0x2cf01d[_0x350a('0x1b')]=qs[_0x350a('0x1b')](_0x3c44e0[_0x350a('0x2d')][_0x350a('0x1b')]);}return _0x2ce9e7[_0x350a('0x47')](_0x2cf01d);}})['then'](function(_0x1e563c){if(_0x1e563c){return _0x1e563c?{'count':_0x1cf58c,'rows':_0x1e563c}:null;}})['then'](respondWithResult(_0x1c755a,null))[_0x350a('0x40')](handleError(_0x1c755a,null));};exports['getSubjects']=function(_0x3ca66e,_0x309dfc,_0x2fec9d){var _0x50617c={};var _0x3ae8d3={};var _0x3fc3b9;var _0x43aa21;return db[_0x350a('0x28')][_0x350a('0x4a')]({'where':{'id':_0x3ca66e[_0x350a('0x42')]['id']}})[_0x350a('0x24')](handleEntityNotFound(_0x309dfc,null))[_0x350a('0x24')](function(_0x207c2d){if(_0x207c2d){_0x3fc3b9=_0x207c2d;_0x3ae8d3[_0x350a('0x2b')]=_[_0x350a('0x2e')](db['Dynamics365Field'][_0x350a('0x29')]);_0x3ae8d3[_0x350a('0x2d')]=_['keys'](_0x3ca66e['query']);_0x3ae8d3[_0x350a('0x37')]=_[_0x350a('0x2f')](_0x3ae8d3[_0x350a('0x2b')],_0x3ae8d3[_0x350a('0x2d')]);_0x50617c[_0x350a('0x31')]=_[_0x350a('0x2f')](_0x3ae8d3[_0x350a('0x2b')],qs[_0x350a('0x30')](_0x3ca66e[_0x350a('0x2d')][_0x350a('0x30')]));_0x50617c[_0x350a('0x31')]=_0x50617c[_0x350a('0x31')][_0x350a('0x32')]?_0x50617c[_0x350a('0x31')]:_0x3ae8d3[_0x350a('0x2b')];_0x50617c[_0x350a('0x33')]=qs[_0x350a('0x34')](_0x3ca66e['query']['sort']);_0x50617c[_0x350a('0x35')]=qs[_0x350a('0x37')](_['pick'](_0x3ca66e[_0x350a('0x2d')],_0x3ae8d3['filters']));if(_0x3ca66e[_0x350a('0x2d')]['filter']){_0x50617c[_0x350a('0x35')]=_[_0x350a('0x39')](_0x50617c[_0x350a('0x35')],{'$or':_[_0x350a('0x2c')](_0x50617c['attributes'],function(_0x230796){var _0x18e2ac={};_0x18e2ac[_0x230796]={'$like':'%'+_0x3ca66e[_0x350a('0x2d')][_0x350a('0x38')]+'%'};return _0x18e2ac;})});}_0x50617c=_[_0x350a('0x39')]({},_0x50617c,_0x3ca66e['options']);return _0x3fc3b9[_0x350a('0x4b')](_0x50617c);}})[_0x350a('0x24')](function(_0x311f29){if(_0x311f29){_0x43aa21=_0x311f29[_0x350a('0x32')];if(!_0x3ca66e[_0x350a('0x2d')]['hasOwnProperty'](_0x350a('0x49'))){_0x50617c[_0x350a('0x1d')]=qs[_0x350a('0x1d')](_0x3ca66e[_0x350a('0x2d')]['limit']);_0x50617c['offset']=qs[_0x350a('0x1b')](_0x3ca66e[_0x350a('0x2d')]['offset']);}return _0x3fc3b9[_0x350a('0x4b')](_0x50617c);}})[_0x350a('0x24')](function(_0x475d26){if(_0x475d26){return _0x475d26?{'count':_0x43aa21,'rows':_0x475d26}:null;}})[_0x350a('0x24')](respondWithResult(_0x309dfc,null))['catch'](handleError(_0x309dfc,null));};exports[_0x350a('0x4c')]=function(_0x3014dd,_0x4888f2,_0x185d98){var _0x53eeac={};var _0x39e6df={};var _0x3286a5;var _0x41813f;return db[_0x350a('0x28')][_0x350a('0x4a')]({'where':{'id':_0x3014dd[_0x350a('0x42')]['id']}})[_0x350a('0x24')](handleEntityNotFound(_0x4888f2,null))['then'](function(_0x12eb7f){if(_0x12eb7f){_0x3286a5=_0x12eb7f;_0x39e6df['model']=_['keys'](db[_0x350a('0x4d')][_0x350a('0x29')]);_0x39e6df[_0x350a('0x2d')]=_['keys'](_0x3014dd['query']);_0x39e6df[_0x350a('0x37')]=_[_0x350a('0x2f')](_0x39e6df[_0x350a('0x2b')],_0x39e6df[_0x350a('0x2d')]);_0x53eeac[_0x350a('0x31')]=_[_0x350a('0x2f')](_0x39e6df['model'],qs[_0x350a('0x30')](_0x3014dd['query']['fields']));_0x53eeac[_0x350a('0x31')]=_0x53eeac[_0x350a('0x31')]['length']?_0x53eeac[_0x350a('0x31')]:_0x39e6df[_0x350a('0x2b')];_0x53eeac[_0x350a('0x33')]=qs[_0x350a('0x34')](_0x3014dd[_0x350a('0x2d')][_0x350a('0x34')]);_0x53eeac[_0x350a('0x35')]=qs['filters'](_[_0x350a('0x36')](_0x3014dd['query'],_0x39e6df[_0x350a('0x37')]));if(_0x3014dd[_0x350a('0x2d')][_0x350a('0x38')]){_0x53eeac[_0x350a('0x35')]=_['merge'](_0x53eeac['where'],{'$or':_[_0x350a('0x2c')](_0x53eeac[_0x350a('0x31')],function(_0x287210){var _0x220f83={};_0x220f83[_0x287210]={'$like':'%'+_0x3014dd[_0x350a('0x2d')][_0x350a('0x38')]+'%'};return _0x220f83;})});}_0x53eeac=_[_0x350a('0x39')]({},_0x53eeac,_0x3014dd[_0x350a('0x3b')]);return _0x3286a5[_0x350a('0x4c')](_0x53eeac);}})['then'](function(_0x487f9b){if(_0x487f9b){_0x41813f=_0x487f9b[_0x350a('0x32')];if(!_0x3014dd[_0x350a('0x2d')]['hasOwnProperty'](_0x350a('0x49'))){_0x53eeac['limit']=qs[_0x350a('0x1d')](_0x3014dd[_0x350a('0x2d')]['limit']);_0x53eeac[_0x350a('0x1b')]=qs[_0x350a('0x1b')](_0x3014dd[_0x350a('0x2d')][_0x350a('0x1b')]);}return _0x3286a5[_0x350a('0x4c')](_0x53eeac);}})[_0x350a('0x24')](function(_0x2a7a9f){if(_0x2a7a9f){return _0x2a7a9f?{'count':_0x41813f,'rows':_0x2a7a9f}:null;}})[_0x350a('0x24')](respondWithResult(_0x4888f2,null))[_0x350a('0x40')](handleError(_0x4888f2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 59742a4..d7e427b 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x217023,_0x377363){var _0x40cfb2=function(_0x4846d5){while(--_0x4846d5){_0x217023['push'](_0x217023['shift']());}};_0x40cfb2(++_0x377363);}(_0xb821,0xa7));var _0x1b82=function(_0x637ada,_0x59426c){_0x637ada=_0x637ada-0x0;var _0x1399b3=_0xb821[_0x637ada];return _0x1399b3;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x1ffff7,_0x2f9ff6){var _0x49d017=function(_0x1d2483){while(--_0x1d2483){_0x1ffff7['push'](_0x1ffff7['shift']());}};_0x49d017(++_0x2f9ff6);}(_0x3e74,0x175));var _0x43e7=function(_0x2d32f1,_0x23005d){_0x2d32f1=_0x2d32f1-0x0;var _0x35c79a=_0x3e74[_0x2d32f1];return _0x35c79a;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 61e437a..f5ea8fd 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe52f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x5c19ee,_0x2c8dec){var _0x51080a=function(_0x541e35){while(--_0x541e35){_0x5c19ee['push'](_0x5c19ee['shift']());}};_0x51080a(++_0x2c8dec);}(_0xe52f,0x1b4));var _0xfe52=function(_0xc5b794,_0x34bad3){_0xc5b794=_0xc5b794-0x0;var _0x1ad038=_0xe52f[_0xc5b794];return _0x1ad038;};'use strict';var _=require(_0xfe52('0x0'));var util=require(_0xfe52('0x1'));var moment=require('moment');var BPromise=require(_0xfe52('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe52('0x3'));var db=require(_0xfe52('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe52('0x5'))(_0xfe52('0x6'));var config=require(_0xfe52('0x7'));var jayson=require(_0xfe52('0x8'));var client=jayson[_0xfe52('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1329cc,_0x21f7e9,_0x28f192){return new BPromise(function(_0x5ce489,_0x3fe64d){return client[_0xfe52('0xa')](_0x1329cc,_0x28f192)[_0xfe52('0xb')](function(_0x112820){logger[_0xfe52('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x21f7e9,_0xfe52('0xd'));logger['debug'](_0xfe52('0xe'),_0x21f7e9,_0xfe52('0xd'),JSON['stringify'](_0x112820));if(_0x112820[_0xfe52('0xf')]){if(_0x112820[_0xfe52('0xf')][_0xfe52('0x10')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x21f7e9,_0x112820[_0xfe52('0xf')][_0xfe52('0x11')]);return _0x3fe64d(_0x112820[_0xfe52('0xf')][_0xfe52('0x11')]);}logger[_0xfe52('0xf')](_0xfe52('0x12'),_0x21f7e9,_0x112820['error'][_0xfe52('0x11')]);return _0x5ce489(_0x112820[_0xfe52('0xf')][_0xfe52('0x11')]);}else{logger['info'](_0xfe52('0x12'),_0x21f7e9,_0xfe52('0xd'));_0x5ce489(_0x112820[_0xfe52('0x13')][_0xfe52('0x11')]);}})[_0xfe52('0x14')](function(_0x2628de){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x21f7e9,_0x2628de);_0x3fe64d(_0x2628de);});});} \ No newline at end of file +var _0x41bc=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x325866,_0x2bfab5){var _0x335f8a=function(_0x5d4073){while(--_0x5d4073){_0x325866['push'](_0x325866['shift']());}};_0x335f8a(++_0x2bfab5);}(_0x41bc,0xde));var _0xc41b=function(_0x5127f7,_0x344e37){_0x5127f7=_0x5127f7-0x0;var _0x5ab503=_0x41bc[_0x5127f7];return _0x5ab503;};'use strict';var _=require('lodash');var util=require(_0xc41b('0x0'));var moment=require('moment');var BPromise=require(_0xc41b('0x1'));var rs=require(_0xc41b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc41b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc41b('0x4'))(_0xc41b('0x5'));var config=require(_0xc41b('0x6'));var jayson=require(_0xc41b('0x7'));var client=jayson[_0xc41b('0x8')][_0xc41b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a8acf,_0x3ffc7b,_0x37a76f){return new BPromise(function(_0x3ea36a,_0x170560){return client[_0xc41b('0xa')](_0x4a8acf,_0x37a76f)[_0xc41b('0xb')](function(_0x545c82){logger[_0xc41b('0xc')](_0xc41b('0xd'),_0x3ffc7b,_0xc41b('0xe'));logger[_0xc41b('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3ffc7b,_0xc41b('0xe'),JSON['stringify'](_0x545c82));if(_0x545c82[_0xc41b('0x10')]){if(_0x545c82[_0xc41b('0x10')][_0xc41b('0x11')]===0x1f4){logger[_0xc41b('0x10')](_0xc41b('0xd'),_0x3ffc7b,_0x545c82[_0xc41b('0x10')][_0xc41b('0x12')]);return _0x170560(_0x545c82['error']['message']);}logger['error'](_0xc41b('0xd'),_0x3ffc7b,_0x545c82[_0xc41b('0x10')][_0xc41b('0x12')]);return _0x3ea36a(_0x545c82[_0xc41b('0x10')][_0xc41b('0x12')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3ffc7b,_0xc41b('0xe'));_0x3ea36a(_0x545c82[_0xc41b('0x13')][_0xc41b('0x12')]);}})[_0xc41b('0x14')](function(_0x3a1394){logger[_0xc41b('0x10')](_0xc41b('0xd'),_0x3ffc7b,_0x3a1394);_0x170560(_0x3a1394);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0dd05db..87bf42b 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5f1=['./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x502ffb,_0x39df5c){var _0x5e80d3=function(_0xc6c5e9){while(--_0xc6c5e9){_0x502ffb['push'](_0x502ffb['shift']());}};_0x5e80d3(++_0x39df5c);}(_0xa5f1,0x1c0));var _0x1a5f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa5f1[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x1a5f('0x0'));var util=require(_0x1a5f('0x1'));var path=require('path');var timeout=require(_0x1a5f('0x2'));var express=require('express');var router=express[_0x1a5f('0x3')]();var fs_extra=require(_0x1a5f('0x4'));var auth=require(_0x1a5f('0x5'));var interaction=require(_0x1a5f('0x6'));var config=require(_0x1a5f('0x7'));var controller=require(_0x1a5f('0x8'));router[_0x1a5f('0x9')]('/',auth[_0x1a5f('0xa')](),controller[_0x1a5f('0xb')]);router[_0x1a5f('0x9')](_0x1a5f('0xc'),auth[_0x1a5f('0xa')](),controller['show']);router[_0x1a5f('0xd')]('/',auth[_0x1a5f('0xa')](),controller['create']);router[_0x1a5f('0xe')](_0x1a5f('0xc'),auth[_0x1a5f('0xa')](),controller[_0x1a5f('0xf')]);router[_0x1a5f('0x10')](_0x1a5f('0xc'),auth[_0x1a5f('0xa')](),controller[_0x1a5f('0x11')]);module[_0x1a5f('0x12')]=router; \ No newline at end of file +var _0x81ad=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x81ad,0x1bc));var _0xd81a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x81ad[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xd81a('0x0'));var util=require(_0xd81a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd81a('0x2'));var router=express[_0xd81a('0x3')]();var fs_extra=require(_0xd81a('0x4'));var auth=require(_0xd81a('0x5'));var interaction=require(_0xd81a('0x6'));var config=require(_0xd81a('0x7'));var controller=require(_0xd81a('0x8'));router[_0xd81a('0x9')]('/',auth[_0xd81a('0xa')](),controller[_0xd81a('0xb')]);router[_0xd81a('0x9')]('/:id',auth[_0xd81a('0xa')](),controller[_0xd81a('0xc')]);router['post']('/',auth[_0xd81a('0xa')](),controller[_0xd81a('0xd')]);router[_0xd81a('0xe')](_0xd81a('0xf'),auth[_0xd81a('0xa')](),controller[_0xd81a('0x10')]);router[_0xd81a('0x11')](_0xd81a('0xf'),auth[_0xd81a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index c760e86..d12065a 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x658a=['customVariable','string','variable','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x658a,0x1be));var _0xa658=function(_0x3d1bdc,_0x5f0da5){_0x3d1bdc=_0x3d1bdc-0x0;var _0x36050f=_0x658a[_0x3d1bdc];return _0x36050f;};'use strict';var Sequelize=require(_0xa658('0x0'));module['exports']={'type':{'type':Sequelize[_0xa658('0x1')]('string','variable',_0xa658('0x2'),'keyValue','picklist'),'defaultValue':_0xa658('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa658('0x3'),_0xa658('0x4'),_0xa658('0x2'))},'keyContent':{'type':Sequelize[_0xa658('0x5')]},'idField':{'type':Sequelize[_0xa658('0x5')]},'nameField':{'type':Sequelize[_0xa658('0x5')]},'customField':{'type':Sequelize[_0xa658('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa658('0x5')]}}; \ No newline at end of file +var _0xf4fa=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x4c2b9d,_0x5f3375){var _0x1059a2=function(_0x1ea731){while(--_0x1ea731){_0x4c2b9d['push'](_0x4c2b9d['shift']());}};_0x1059a2(++_0x5f3375);}(_0xf4fa,0x8e));var _0xaf4f=function(_0x337688,_0x69444b){_0x337688=_0x337688-0x0;var _0x3424c5=_0xf4fa[_0x337688];return _0x3424c5;};'use strict';var Sequelize=require(_0xaf4f('0x0'));module[_0xaf4f('0x1')]={'type':{'type':Sequelize[_0xaf4f('0x2')](_0xaf4f('0x3'),'variable',_0xaf4f('0x4'),_0xaf4f('0x5'),'picklist'),'defaultValue':_0xaf4f('0x3')},'content':{'type':Sequelize[_0xaf4f('0x6')]},'key':{'type':Sequelize[_0xaf4f('0x6')]},'keyType':{'type':Sequelize[_0xaf4f('0x2')](_0xaf4f('0x3'),_0xaf4f('0x7'),_0xaf4f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaf4f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaf4f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaf4f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 454d91c..4077a99 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c85=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','rows','show','params','intersection','length','include','find','create','catch','body','eml-format','zip-dir','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','attributes'];(function(_0x3b3dab,_0x2fdb96){var _0x47226b=function(_0x23477e){while(--_0x23477e){_0x3b3dab['push'](_0x3b3dab['shift']());}};_0x47226b(++_0x2fdb96);}(_0x3c85,0xa2));var _0x53c8=function(_0x1cd3aa,_0x1cf120){_0x1cd3aa=_0x1cd3aa-0x0;var _0x293a0c=_0x3c85[_0x1cd3aa];return _0x293a0c;};'use strict';var emlformat=require(_0x53c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x53c8('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x53c8('0x3'));var sox=require(_0x53c8('0x4'));var csv=require('to-csv');var ejs=require(_0x53c8('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53c8('0x6'));var squel=require(_0x53c8('0x7'));var crypto=require(_0x53c8('0x8'));var jsforce=require(_0x53c8('0x9'));var deskjs=require(_0x53c8('0xa'));var toCsv=require(_0x53c8('0xb'));var querystring=require('querystring');var Papa=require(_0x53c8('0xc'));var Redis=require('ioredis');var authService=require(_0x53c8('0xd'));var qs=require(_0x53c8('0xe'));var as=require(_0x53c8('0xf'));var hardwareService=require(_0x53c8('0x10'));var logger=require(_0x53c8('0x11'))('api');var utils=require(_0x53c8('0x12'));var config=require(_0x53c8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x53c8('0x14'))['db'];function respondWithStatusCode(_0x561f1a,_0x461dad){_0x461dad=_0x461dad||0xcc;return function(_0xc71df1){if(_0xc71df1){return _0x561f1a['sendStatus'](_0x461dad);}return _0x561f1a[_0x53c8('0x15')](_0x461dad)['end']();};}function respondWithResult(_0x3ff50c,_0x3c9608){_0x3c9608=_0x3c9608||0xc8;return function(_0x2edd3e){if(_0x2edd3e){return _0x3ff50c[_0x53c8('0x15')](_0x3c9608)['json'](_0x2edd3e);}};}function respondWithFilteredResult(_0x3bec9b,_0x5b4ee2){return function(_0x2ddc59){if(_0x2ddc59){var _0x4dbee3=typeof _0x5b4ee2[_0x53c8('0x16')]==='undefined'&&typeof _0x5b4ee2[_0x53c8('0x17')]===_0x53c8('0x18');var _0x42e117=_0x2ddc59[_0x53c8('0x19')];var _0x171e84=_0x4dbee3?0x0:_0x5b4ee2[_0x53c8('0x16')];var _0x304a7c=_0x4dbee3?_0x2ddc59[_0x53c8('0x19')]:_0x5b4ee2[_0x53c8('0x16')]+_0x5b4ee2[_0x53c8('0x17')];var _0x458ee4;if(_0x304a7c>=_0x42e117){_0x304a7c=_0x42e117;_0x458ee4=0xc8;}else{_0x458ee4=0xce;}_0x3bec9b[_0x53c8('0x15')](_0x458ee4);return _0x3bec9b['set'](_0x53c8('0x1a'),_0x171e84+'-'+_0x304a7c+'/'+_0x42e117)[_0x53c8('0x1b')](_0x2ddc59);}return null;};}function patchUpdates(_0x4d71b4){return function(_0x3f9a95){try{jsonpatch[_0x53c8('0x1c')](_0x3f9a95,_0x4d71b4,!![]);}catch(_0x38bb85){return BPromise[_0x53c8('0x1d')](_0x38bb85);}return _0x3f9a95[_0x53c8('0x1e')]();};}function saveUpdates(_0x2c0722,_0x2e5d19){return function(_0x39440e){if(_0x39440e){return _0x39440e[_0x53c8('0x1f')](_0x2c0722)[_0x53c8('0x20')](function(_0x4878d9){return _0x4878d9;});}return null;};}function removeEntity(_0x3b88d0,_0x4a06fe){return function(_0x12cc87){if(_0x12cc87){return _0x12cc87[_0x53c8('0x21')]()[_0x53c8('0x20')](function(){_0x3b88d0[_0x53c8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4617c3,_0x2282f2){return function(_0x4065d5){if(!_0x4065d5){_0x4617c3[_0x53c8('0x22')](0x194);}return _0x4065d5;};}function handleError(_0x578d6a,_0x3aaf9c){_0x3aaf9c=_0x3aaf9c||0x1f4;return function(_0x478f18){logger[_0x53c8('0x23')](_0x478f18[_0x53c8('0x24')]);if(_0x478f18[_0x53c8('0x25')]){delete _0x478f18['name'];}_0x578d6a[_0x53c8('0x15')](_0x3aaf9c)['send'](_0x478f18);};}exports[_0x53c8('0x26')]=function(_0x53077e,_0x59beef){var _0x2e50fa={},_0x4edb32={},_0x333305={'count':0x0,'rows':[]};var _0x391bf1=_[_0x53c8('0x27')](db[_0x53c8('0x28')][_0x53c8('0x29')],function(_0xcf6334){return{'name':_0xcf6334['fieldName'],'type':_0xcf6334[_0x53c8('0x2a')][_0x53c8('0x2b')]};});_0x4edb32[_0x53c8('0x2c')]=_[_0x53c8('0x27')](_0x391bf1,_0x53c8('0x25'));_0x4edb32[_0x53c8('0x2d')]=_[_0x53c8('0x2e')](_0x53077e[_0x53c8('0x2d')]);_0x4edb32['filters']=_['intersection'](_0x4edb32[_0x53c8('0x2c')],_0x4edb32[_0x53c8('0x2d')]);_0x2e50fa[_0x53c8('0x2f')]=_['intersection'](_0x4edb32[_0x53c8('0x2c')],qs['fields'](_0x53077e['query'][_0x53c8('0x30')]));_0x2e50fa[_0x53c8('0x2f')]=_0x2e50fa[_0x53c8('0x2f')]['length']?_0x2e50fa[_0x53c8('0x2f')]:_0x4edb32[_0x53c8('0x2c')];if(!_0x53077e['query'][_0x53c8('0x31')](_0x53c8('0x32'))){_0x2e50fa['limit']=qs[_0x53c8('0x17')](_0x53077e[_0x53c8('0x2d')][_0x53c8('0x17')]);_0x2e50fa['offset']=qs[_0x53c8('0x16')](_0x53077e[_0x53c8('0x2d')][_0x53c8('0x16')]);}_0x2e50fa[_0x53c8('0x33')]=qs[_0x53c8('0x34')](_0x53077e[_0x53c8('0x2d')]['sort']);_0x2e50fa[_0x53c8('0x35')]=qs['filters'](_[_0x53c8('0x36')](_0x53077e['query'],_0x4edb32[_0x53c8('0x37')]),_0x391bf1);if(_0x53077e[_0x53c8('0x2d')][_0x53c8('0x38')]){_0x2e50fa[_0x53c8('0x35')]=_[_0x53c8('0x39')](_0x2e50fa[_0x53c8('0x35')],{'$or':_[_0x53c8('0x27')](_0x391bf1,function(_0x421864){if(_0x421864['type']!=='VIRTUAL'){var _0x5567d5={};_0x5567d5[_0x421864[_0x53c8('0x25')]]={'$like':'%'+_0x53077e[_0x53c8('0x2d')][_0x53c8('0x38')]+'%'};return _0x5567d5;}})});}_0x2e50fa=_[_0x53c8('0x39')]({},_0x2e50fa,_0x53077e[_0x53c8('0x3a')]);var _0x49b8b9={'where':_0x2e50fa[_0x53c8('0x35')]};return db[_0x53c8('0x28')][_0x53c8('0x19')](_0x49b8b9)['then'](function(_0x3a59f9){_0x333305['count']=_0x3a59f9;if(_0x53077e[_0x53c8('0x2d')][_0x53c8('0x3b')]){_0x2e50fa['include']=[{'all':!![]}];}return db[_0x53c8('0x28')]['findAll'](_0x2e50fa);})[_0x53c8('0x20')](function(_0x48eab2){_0x333305[_0x53c8('0x3c')]=_0x48eab2;return _0x333305;})['then'](respondWithFilteredResult(_0x59beef,_0x2e50fa))['catch'](handleError(_0x59beef,null));};exports[_0x53c8('0x3d')]=function(_0x5189e3,_0x51659a){var _0x2d2664={'raw':!![],'where':{'id':_0x5189e3[_0x53c8('0x3e')]['id']}},_0x4e6ae6={};_0x4e6ae6[_0x53c8('0x2c')]=_[_0x53c8('0x2e')](db[_0x53c8('0x28')][_0x53c8('0x29')]);_0x4e6ae6[_0x53c8('0x2d')]=_['keys'](_0x5189e3[_0x53c8('0x2d')]);_0x4e6ae6['filters']=_[_0x53c8('0x3f')](_0x4e6ae6['model'],_0x4e6ae6[_0x53c8('0x2d')]);_0x2d2664[_0x53c8('0x2f')]=_['intersection'](_0x4e6ae6[_0x53c8('0x2c')],qs[_0x53c8('0x30')](_0x5189e3[_0x53c8('0x2d')][_0x53c8('0x30')]));_0x2d2664[_0x53c8('0x2f')]=_0x2d2664['attributes'][_0x53c8('0x40')]?_0x2d2664[_0x53c8('0x2f')]:_0x4e6ae6[_0x53c8('0x2c')];if(_0x5189e3[_0x53c8('0x2d')][_0x53c8('0x3b')]){_0x2d2664[_0x53c8('0x41')]=[{'all':!![]}];}_0x2d2664=_[_0x53c8('0x39')]({},_0x2d2664,_0x5189e3['options']);return db[_0x53c8('0x28')][_0x53c8('0x42')](_0x2d2664)[_0x53c8('0x20')](handleEntityNotFound(_0x51659a,null))[_0x53c8('0x20')](respondWithResult(_0x51659a,null))['catch'](handleError(_0x51659a,null));};exports[_0x53c8('0x43')]=function(_0x3d4b7b,_0x5b170e){return db[_0x53c8('0x28')][_0x53c8('0x43')](_0x3d4b7b['body'],{})[_0x53c8('0x20')](respondWithResult(_0x5b170e,0xc9))[_0x53c8('0x44')](handleError(_0x5b170e,null));};exports[_0x53c8('0x1f')]=function(_0x1b060f,_0x4f94e7){if(_0x1b060f[_0x53c8('0x45')]['id']){delete _0x1b060f[_0x53c8('0x45')]['id'];}return db[_0x53c8('0x28')][_0x53c8('0x42')]({'where':{'id':_0x1b060f['params']['id']}})['then'](handleEntityNotFound(_0x4f94e7,null))['then'](saveUpdates(_0x1b060f['body'],null))[_0x53c8('0x20')](respondWithResult(_0x4f94e7,null))['catch'](handleError(_0x4f94e7,null));};exports['destroy']=function(_0x2a327d,_0x331df5){return db['Dynamics365Field'][_0x53c8('0x42')]({'where':{'id':_0x2a327d[_0x53c8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x331df5,null))[_0x53c8('0x20')](removeEntity(_0x331df5,null))[_0x53c8('0x44')](handleError(_0x331df5,null));}; \ No newline at end of file +var _0x73cd=['destroy','error','stack','name','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then'];(function(_0x1f42bc,_0x208463){var _0x23f159=function(_0x3933bb){while(--_0x3933bb){_0x1f42bc['push'](_0x1f42bc['shift']());}};_0x23f159(++_0x208463);}(_0x73cd,0x144));var _0xd73c=function(_0x5da01c,_0x53bf77){_0x5da01c=_0x5da01c-0x0;var _0x1216c2=_0x73cd[_0x5da01c];return _0x1216c2;};'use strict';var emlformat=require(_0xd73c('0x0'));var rimraf=require(_0xd73c('0x1'));var zipdir=require(_0xd73c('0x2'));var jsonpatch=require(_0xd73c('0x3'));var rp=require('request-promise');var moment=require(_0xd73c('0x4'));var BPromise=require(_0xd73c('0x5'));var Mustache=require(_0xd73c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd73c('0x7'));var csv=require('to-csv');var ejs=require(_0xd73c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd73c('0x9'));var squel=require(_0xd73c('0xa'));var crypto=require(_0xd73c('0xb'));var jsforce=require(_0xd73c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd73c('0xd'));var querystring=require(_0xd73c('0xe'));var Papa=require(_0xd73c('0xf'));var Redis=require(_0xd73c('0x10'));var authService=require(_0xd73c('0x11'));var qs=require(_0xd73c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd73c('0x13'))(_0xd73c('0x14'));var utils=require(_0xd73c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd73c('0x16'))['db'];function respondWithStatusCode(_0x4e074e,_0x4b248d){_0x4b248d=_0x4b248d||0xcc;return function(_0xce20ab){if(_0xce20ab){return _0x4e074e['sendStatus'](_0x4b248d);}return _0x4e074e[_0xd73c('0x17')](_0x4b248d)[_0xd73c('0x18')]();};}function respondWithResult(_0x1f4e2b,_0x463903){_0x463903=_0x463903||0xc8;return function(_0x25848e){if(_0x25848e){return _0x1f4e2b[_0xd73c('0x17')](_0x463903)[_0xd73c('0x19')](_0x25848e);}};}function respondWithFilteredResult(_0x3a4a3e,_0x57c4cd){return function(_0x441199){if(_0x441199){var _0x42047=typeof _0x57c4cd[_0xd73c('0x1a')]===_0xd73c('0x1b')&&typeof _0x57c4cd['limit']===_0xd73c('0x1b');var _0x25a178=_0x441199[_0xd73c('0x1c')];var _0x27b9d0=_0x42047?0x0:_0x57c4cd['offset'];var _0x3707bd=_0x42047?_0x441199['count']:_0x57c4cd['offset']+_0x57c4cd[_0xd73c('0x1d')];var _0x44b46c;if(_0x3707bd>=_0x25a178){_0x3707bd=_0x25a178;_0x44b46c=0xc8;}else{_0x44b46c=0xce;}_0x3a4a3e[_0xd73c('0x17')](_0x44b46c);return _0x3a4a3e[_0xd73c('0x1e')](_0xd73c('0x1f'),_0x27b9d0+'-'+_0x3707bd+'/'+_0x25a178)[_0xd73c('0x19')](_0x441199);}return null;};}function patchUpdates(_0x468b57){return function(_0x50d007){try{jsonpatch['apply'](_0x50d007,_0x468b57,!![]);}catch(_0x3b626d){return BPromise[_0xd73c('0x20')](_0x3b626d);}return _0x50d007[_0xd73c('0x21')]();};}function saveUpdates(_0x11e7fc,_0x250cc9){return function(_0x754ce3){if(_0x754ce3){return _0x754ce3[_0xd73c('0x22')](_0x11e7fc)[_0xd73c('0x23')](function(_0x465b6e){return _0x465b6e;});}return null;};}function removeEntity(_0x53a4d4,_0x3cfceb){return function(_0x417892){if(_0x417892){return _0x417892[_0xd73c('0x24')]()[_0xd73c('0x23')](function(){_0x53a4d4[_0xd73c('0x17')](0xcc)[_0xd73c('0x18')]();});}};}function handleEntityNotFound(_0x43de9a,_0x336551){return function(_0x302c19){if(!_0x302c19){_0x43de9a['sendStatus'](0x194);}return _0x302c19;};}function handleError(_0x1aa392,_0x22b140){_0x22b140=_0x22b140||0x1f4;return function(_0x390b30){logger[_0xd73c('0x25')](_0x390b30[_0xd73c('0x26')]);if(_0x390b30[_0xd73c('0x27')]){delete _0x390b30[_0xd73c('0x27')];}_0x1aa392[_0xd73c('0x17')](_0x22b140)['send'](_0x390b30);};}exports[_0xd73c('0x28')]=function(_0x5ebe64,_0x6f7f23){var _0x3138d8={},_0x2cb715={},_0x4f5c2f={'count':0x0,'rows':[]};var _0x37913c=_['map'](db[_0xd73c('0x29')][_0xd73c('0x2a')],function(_0x5f590e){return{'name':_0x5f590e[_0xd73c('0x2b')],'type':_0x5f590e[_0xd73c('0x2c')]['key']};});_0x2cb715[_0xd73c('0x2d')]=_[_0xd73c('0x2e')](_0x37913c,_0xd73c('0x27'));_0x2cb715[_0xd73c('0x2f')]=_[_0xd73c('0x30')](_0x5ebe64[_0xd73c('0x2f')]);_0x2cb715['filters']=_['intersection'](_0x2cb715['model'],_0x2cb715[_0xd73c('0x2f')]);_0x3138d8[_0xd73c('0x31')]=_[_0xd73c('0x32')](_0x2cb715[_0xd73c('0x2d')],qs[_0xd73c('0x33')](_0x5ebe64[_0xd73c('0x2f')]['fields']));_0x3138d8['attributes']=_0x3138d8[_0xd73c('0x31')]['length']?_0x3138d8[_0xd73c('0x31')]:_0x2cb715[_0xd73c('0x2d')];if(!_0x5ebe64[_0xd73c('0x2f')][_0xd73c('0x34')]('nolimit')){_0x3138d8[_0xd73c('0x1d')]=qs[_0xd73c('0x1d')](_0x5ebe64[_0xd73c('0x2f')][_0xd73c('0x1d')]);_0x3138d8[_0xd73c('0x1a')]=qs['offset'](_0x5ebe64[_0xd73c('0x2f')][_0xd73c('0x1a')]);}_0x3138d8['order']=qs[_0xd73c('0x35')](_0x5ebe64[_0xd73c('0x2f')][_0xd73c('0x35')]);_0x3138d8[_0xd73c('0x36')]=qs[_0xd73c('0x37')](_[_0xd73c('0x38')](_0x5ebe64[_0xd73c('0x2f')],_0x2cb715[_0xd73c('0x37')]),_0x37913c);if(_0x5ebe64[_0xd73c('0x2f')]['filter']){_0x3138d8['where']=_[_0xd73c('0x39')](_0x3138d8[_0xd73c('0x36')],{'$or':_['map'](_0x37913c,function(_0x247645){if(_0x247645['type']!==_0xd73c('0x3a')){var _0x45ce7f={};_0x45ce7f[_0x247645[_0xd73c('0x27')]]={'$like':'%'+_0x5ebe64[_0xd73c('0x2f')][_0xd73c('0x3b')]+'%'};return _0x45ce7f;}})});}_0x3138d8=_[_0xd73c('0x39')]({},_0x3138d8,_0x5ebe64[_0xd73c('0x3c')]);var _0x1ac271={'where':_0x3138d8[_0xd73c('0x36')]};return db['Dynamics365Field'][_0xd73c('0x1c')](_0x1ac271)[_0xd73c('0x23')](function(_0x5a405c){_0x4f5c2f[_0xd73c('0x1c')]=_0x5a405c;if(_0x5ebe64[_0xd73c('0x2f')][_0xd73c('0x3d')]){_0x3138d8['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xd73c('0x3e')](_0x3138d8);})['then'](function(_0x24ee76){_0x4f5c2f[_0xd73c('0x3f')]=_0x24ee76;return _0x4f5c2f;})[_0xd73c('0x23')](respondWithFilteredResult(_0x6f7f23,_0x3138d8))[_0xd73c('0x40')](handleError(_0x6f7f23,null));};exports[_0xd73c('0x41')]=function(_0x1da630,_0x29a005){var _0x5ec812={'raw':!![],'where':{'id':_0x1da630[_0xd73c('0x42')]['id']}},_0x52e798={};_0x52e798[_0xd73c('0x2d')]=_[_0xd73c('0x30')](db[_0xd73c('0x29')][_0xd73c('0x2a')]);_0x52e798['query']=_[_0xd73c('0x30')](_0x1da630['query']);_0x52e798['filters']=_[_0xd73c('0x32')](_0x52e798['model'],_0x52e798[_0xd73c('0x2f')]);_0x5ec812[_0xd73c('0x31')]=_['intersection'](_0x52e798['model'],qs[_0xd73c('0x33')](_0x1da630[_0xd73c('0x2f')]['fields']));_0x5ec812[_0xd73c('0x31')]=_0x5ec812[_0xd73c('0x31')][_0xd73c('0x43')]?_0x5ec812[_0xd73c('0x31')]:_0x52e798[_0xd73c('0x2d')];if(_0x1da630[_0xd73c('0x2f')][_0xd73c('0x3d')]){_0x5ec812[_0xd73c('0x44')]=[{'all':!![]}];}_0x5ec812=_[_0xd73c('0x39')]({},_0x5ec812,_0x1da630['options']);return db[_0xd73c('0x29')][_0xd73c('0x45')](_0x5ec812)['then'](handleEntityNotFound(_0x29a005,null))['then'](respondWithResult(_0x29a005,null))[_0xd73c('0x40')](handleError(_0x29a005,null));};exports[_0xd73c('0x46')]=function(_0x351a5e,_0x5900c2){return db[_0xd73c('0x29')]['create'](_0x351a5e[_0xd73c('0x47')],{})['then'](respondWithResult(_0x5900c2,0xc9))[_0xd73c('0x40')](handleError(_0x5900c2,null));};exports[_0xd73c('0x22')]=function(_0x135731,_0x41c8b1){if(_0x135731['body']['id']){delete _0x135731[_0xd73c('0x47')]['id'];}return db['Dynamics365Field'][_0xd73c('0x45')]({'where':{'id':_0x135731['params']['id']}})['then'](handleEntityNotFound(_0x41c8b1,null))[_0xd73c('0x23')](saveUpdates(_0x135731['body'],null))['then'](respondWithResult(_0x41c8b1,null))[_0xd73c('0x40')](handleError(_0x41c8b1,null));};exports[_0xd73c('0x24')]=function(_0x4934c2,_0x334601){return db[_0xd73c('0x29')]['find']({'where':{'id':_0x4934c2[_0xd73c('0x42')]['id']}})[_0xd73c('0x23')](handleEntityNotFound(_0x334601,null))[_0xd73c('0x23')](removeEntity(_0x334601,null))[_0xd73c('0x40')](handleError(_0x334601,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 35b8938..8e8dedd 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2af6=['bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','util','api','moment'];(function(_0x290781,_0x53d542){var _0x1ef41f=function(_0x2940a5){while(--_0x2940a5){_0x290781['push'](_0x290781['shift']());}};_0x1ef41f(++_0x53d542);}(_0x2af6,0x13f));var _0x62af=function(_0x254f8e,_0x258b59){_0x254f8e=_0x254f8e-0x0;var _0xf65210=_0x2af6[_0x254f8e];return _0xf65210;};'use strict';var _=require('lodash');var util=require(_0x62af('0x0'));var logger=require('../../config/logger')(_0x62af('0x1'));var moment=require(_0x62af('0x2'));var BPromise=require(_0x62af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62af('0x4'));var rimraf=require(_0x62af('0x5'));var config=require(_0x62af('0x6'));var attributes=require(_0x62af('0x7'));module[_0x62af('0x8')]=function(_0x31caa5,_0x48c2a3){return _0x31caa5[_0x62af('0x9')](_0x62af('0xa'),attributes,{'tableName':_0x62af('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x62af('0xc'),_0x62af('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3bab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field','idField','lodash','../../config/logger'];(function(_0x1a3121,_0x3dbecc){var _0x4b2cda=function(_0x5c5f69){while(--_0x5c5f69){_0x1a3121['push'](_0x1a3121['shift']());}};_0x4b2cda(++_0x3dbecc);}(_0x3bab,0x143));var _0xb3ba=function(_0x428b29,_0x1728a5){_0x428b29=_0x428b29-0x0;var _0x1bc350=_0x3bab[_0x428b29];return _0x1bc350;};'use strict';var _=require(_0xb3ba('0x0'));var util=require('util');var logger=require(_0xb3ba('0x1'))(_0xb3ba('0x2'));var moment=require(_0xb3ba('0x3'));var BPromise=require(_0xb3ba('0x4'));var rp=require(_0xb3ba('0x5'));var fs=require('fs');var path=require(_0xb3ba('0x6'));var rimraf=require(_0xb3ba('0x7'));var config=require(_0xb3ba('0x8'));var attributes=require('./intDynamics365Field.attributes');module[_0xb3ba('0x9')]=function(_0x451e62,_0x5176f2){return _0x451e62[_0xb3ba('0xa')](_0xb3ba('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xb3ba('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 093be5c..5897122 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e26=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x33ec8f,_0x3dc6d4){var _0x44c908=function(_0x2a466c){while(--_0x2a466c){_0x33ec8f['push'](_0x33ec8f['shift']());}};_0x44c908(++_0x3dc6d4);}(_0x8e26,0x106));var _0x68e2=function(_0x4cf819,_0x3e1de8){_0x4cf819=_0x4cf819-0x0;var _0x93c400=_0x8e26[_0x4cf819];return _0x93c400;};'use strict';var _=require(_0x68e2('0x0'));var util=require(_0x68e2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x68e2('0x2'));var fs=require('fs');var Redis=require(_0x68e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x68e2('0x4'))(_0x68e2('0x5'));var config=require(_0x68e2('0x6'));var jayson=require(_0x68e2('0x7'));var client=jayson[_0x68e2('0x8')][_0x68e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x595cc0,_0x3694b3,_0x31e20a){return new BPromise(function(_0x1bd39c,_0x1851d7){return client[_0x68e2('0xa')](_0x595cc0,_0x31e20a)[_0x68e2('0xb')](function(_0x2382c2){logger[_0x68e2('0xc')](_0x68e2('0xd'),_0x3694b3,_0x68e2('0xe'));logger[_0x68e2('0xf')](_0x68e2('0x10'),_0x3694b3,_0x68e2('0xe'),JSON[_0x68e2('0x11')](_0x2382c2));if(_0x2382c2[_0x68e2('0x12')]){if(_0x2382c2[_0x68e2('0x12')]['code']===0x1f4){logger[_0x68e2('0x12')](_0x68e2('0xd'),_0x3694b3,_0x2382c2['error'][_0x68e2('0x13')]);return _0x1851d7(_0x2382c2[_0x68e2('0x12')][_0x68e2('0x13')]);}logger[_0x68e2('0x12')](_0x68e2('0xd'),_0x3694b3,_0x2382c2[_0x68e2('0x12')][_0x68e2('0x13')]);return _0x1bd39c(_0x2382c2[_0x68e2('0x12')][_0x68e2('0x13')]);}else{logger[_0x68e2('0xc')](_0x68e2('0xd'),_0x3694b3,_0x68e2('0xe'));_0x1bd39c(_0x2382c2['result'][_0x68e2('0x13')]);}})[_0x68e2('0x14')](function(_0x1f4a48){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3694b3,_0x1f4a48);_0x1851d7(_0x1f4a48);});});} \ No newline at end of file +var _0x382d=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error'];(function(_0x21c80a,_0x275d41){var _0x4a7719=function(_0xffe07b){while(--_0xffe07b){_0x21c80a['push'](_0x21c80a['shift']());}};_0x4a7719(++_0x275d41);}(_0x382d,0x193));var _0xd382=function(_0x46a776,_0x331ca2){_0x46a776=_0x46a776-0x0;var _0x18fa8c=_0x382d[_0x46a776];return _0x18fa8c;};'use strict';var _=require(_0xd382('0x0'));var util=require(_0xd382('0x1'));var moment=require(_0xd382('0x2'));var BPromise=require(_0xd382('0x3'));var rs=require(_0xd382('0x4'));var fs=require('fs');var Redis=require(_0xd382('0x5'));var db=require(_0xd382('0x6'))['db'];var utils=require(_0xd382('0x7'));var logger=require(_0xd382('0x8'))('rpc');var config=require(_0xd382('0x9'));var jayson=require(_0xd382('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4314c0,_0x2beb46,_0x2c041a){return new BPromise(function(_0x544b37,_0x2e9637){return client[_0xd382('0xb')](_0x4314c0,_0x2c041a)['then'](function(_0x1ebb6a){logger[_0xd382('0xc')](_0xd382('0xd'),_0x2beb46,'request\x20sent');logger[_0xd382('0xe')](_0xd382('0xf'),_0x2beb46,'request\x20sent',JSON['stringify'](_0x1ebb6a));if(_0x1ebb6a['error']){if(_0x1ebb6a[_0xd382('0x10')][_0xd382('0x11')]===0x1f4){logger[_0xd382('0x10')](_0xd382('0xd'),_0x2beb46,_0x1ebb6a[_0xd382('0x10')]['message']);return _0x2e9637(_0x1ebb6a[_0xd382('0x10')][_0xd382('0x12')]);}logger[_0xd382('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x2beb46,_0x1ebb6a['error'][_0xd382('0x12')]);return _0x544b37(_0x1ebb6a[_0xd382('0x10')]['message']);}else{logger[_0xd382('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x2beb46,'request\x20sent');_0x544b37(_0x1ebb6a[_0xd382('0x13')]['message']);}})['catch'](function(_0x390b60){logger['error'](_0xd382('0xd'),_0x2beb46,_0x390b60);_0x2e9637(_0x390b60);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f7c9a28..985bc6f 100644 --- a/server/api/intFreshdeskAccount/index.js +++ b/server/api/intFreshdeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62a3=['../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x217de9,_0x528a88){var _0x4aa5e7=function(_0x3e2e88){while(--_0x3e2e88){_0x217de9['push'](_0x217de9['shift']());}};_0x4aa5e7(++_0x528a88);}(_0x62a3,0xf7));var _0x362a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x62a3[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x362a('0x0'));var timeout=require('connect-timeout');var express=require(_0x362a('0x1'));var router=express[_0x362a('0x2')]();var fs_extra=require(_0x362a('0x3'));var auth=require(_0x362a('0x4'));var interaction=require(_0x362a('0x5'));var config=require(_0x362a('0x6'));var controller=require(_0x362a('0x7'));router[_0x362a('0x8')]('/',auth[_0x362a('0x9')](),controller[_0x362a('0xa')]);router['get'](_0x362a('0xb'),auth[_0x362a('0x9')](),controller[_0x362a('0xc')]);router[_0x362a('0x8')]('/:id/configurations',auth[_0x362a('0x9')](),controller[_0x362a('0xd')]);router[_0x362a('0x8')](_0x362a('0xe'),auth[_0x362a('0x9')](),controller['getFields']);router[_0x362a('0xf')]('/',auth[_0x362a('0x9')](),controller[_0x362a('0x10')]);router[_0x362a('0xf')](_0x362a('0x11'),auth[_0x362a('0x9')](),controller[_0x362a('0x12')]);router['put'](_0x362a('0xb'),auth[_0x362a('0x9')](),controller[_0x362a('0x13')]);router[_0x362a('0x14')](_0x362a('0xb'),auth[_0x362a('0x9')](),controller[_0x362a('0x15')]);module[_0x362a('0x16')]=router; \ No newline at end of file +var _0x8f83=['/:id','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0xa519bf,_0x7c83bf){var _0x230113=function(_0x25acc1){while(--_0x25acc1){_0xa519bf['push'](_0xa519bf['shift']());}};_0x230113(++_0x7c83bf);}(_0x8f83,0x85));var _0x38f8=function(_0x5d299f,_0xd26bfe){_0x5d299f=_0x5d299f-0x0;var _0x1d663e=_0x8f83[_0x5d299f];return _0x1d663e;};'use strict';var multer=require(_0x38f8('0x0'));var util=require(_0x38f8('0x1'));var path=require(_0x38f8('0x2'));var timeout=require(_0x38f8('0x3'));var express=require('express');var router=express[_0x38f8('0x4')]();var fs_extra=require(_0x38f8('0x5'));var auth=require(_0x38f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x38f8('0x7'));var controller=require(_0x38f8('0x8'));router[_0x38f8('0x9')]('/',auth['isAuthenticated'](),controller[_0x38f8('0xa')]);router[_0x38f8('0x9')]('/:id',auth[_0x38f8('0xb')](),controller['show']);router[_0x38f8('0x9')](_0x38f8('0xc'),auth[_0x38f8('0xb')](),controller[_0x38f8('0xd')]);router[_0x38f8('0x9')](_0x38f8('0xe'),auth[_0x38f8('0xb')](),controller[_0x38f8('0xf')]);router[_0x38f8('0x10')]('/',auth['isAuthenticated'](),controller[_0x38f8('0x11')]);router[_0x38f8('0x10')](_0x38f8('0xc'),auth[_0x38f8('0xb')](),controller[_0x38f8('0x12')]);router[_0x38f8('0x13')]('/:id',auth[_0x38f8('0xb')](),controller[_0x38f8('0x14')]);router['delete'](_0x38f8('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 5183789..01f9ce3 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x1399,0x16c));var _0x9139=function(_0x231473,_0x33b93e){_0x231473=_0x231473-0x0;var _0x16d666=_0x1399[_0x231473];return _0x16d666;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe820=['sequelize','STRING','username'];(function(_0x148707,_0xdce5){var _0x256991=function(_0x2ed1f4){while(--_0x2ed1f4){_0x148707['push'](_0x148707['shift']());}};_0x256991(++_0xdce5);}(_0xe820,0xd2));var _0x0e82=function(_0x302ff8,_0xb568ef){_0x302ff8=_0x302ff8-0x0;var _0x1c6054=_0xe820[_0x302ff8];return _0x1c6054;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0e82('0x2')},'apiKey':{'type':Sequelize[_0x0e82('0x1')]},'remoteUri':{'type':Sequelize[_0x0e82('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index fa866e5..b82c843 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7980=['include','findAll','rows','catch','show','params','find','create','body','findOne','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll'];(function(_0x5ebb15,_0x5807dd){var _0x2b3160=function(_0x531a15){while(--_0x531a15){_0x5ebb15['push'](_0x5ebb15['shift']());}};_0x2b3160(++_0x5807dd);}(_0x7980,0xab));var _0x0798=function(_0x264dbd,_0x2cf091){_0x264dbd=_0x264dbd-0x0;var _0x4c343d=_0x7980[_0x264dbd];return _0x4c343d;};'use strict';var emlformat=require(_0x0798('0x0'));var rimraf=require(_0x0798('0x1'));var zipdir=require(_0x0798('0x2'));var jsonpatch=require(_0x0798('0x3'));var rp=require(_0x0798('0x4'));var moment=require('moment');var BPromise=require(_0x0798('0x5'));var Mustache=require(_0x0798('0x6'));var util=require(_0x0798('0x7'));var path=require(_0x0798('0x8'));var sox=require(_0x0798('0x9'));var csv=require('to-csv');var ejs=require(_0x0798('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0798('0xb'));var squel=require(_0x0798('0xc'));var crypto=require(_0x0798('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0798('0xe'));var querystring=require(_0x0798('0xf'));var Papa=require(_0x0798('0x10'));var Redis=require(_0x0798('0x11'));var authService=require(_0x0798('0x12'));var qs=require(_0x0798('0x13'));var as=require(_0x0798('0x14'));var hardwareService=require(_0x0798('0x15'));var logger=require(_0x0798('0x16'))(_0x0798('0x17'));var utils=require('../../config/utils');var config=require(_0x0798('0x18'));var licenseUtil=require(_0x0798('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x588f9d,_0x376a60){_0x376a60=_0x376a60||0xcc;return function(_0x27a0d5){if(_0x27a0d5){return _0x588f9d[_0x0798('0x1a')](_0x376a60);}return _0x588f9d[_0x0798('0x1b')](_0x376a60)[_0x0798('0x1c')]();};}function respondWithResult(_0xfd88af,_0x5f1640){_0x5f1640=_0x5f1640||0xc8;return function(_0x486bcf){if(_0x486bcf){return _0xfd88af[_0x0798('0x1b')](_0x5f1640)[_0x0798('0x1d')](_0x486bcf);}};}function respondWithFilteredResult(_0x47be56,_0x555c45){return function(_0x21c30b){if(_0x21c30b){var _0x45cae6=typeof _0x555c45[_0x0798('0x1e')]==='undefined'&&typeof _0x555c45['limit']===_0x0798('0x1f');var _0x502635=_0x21c30b[_0x0798('0x20')];var _0x46e74c=_0x45cae6?0x0:_0x555c45[_0x0798('0x1e')];var _0x145197=_0x45cae6?_0x21c30b['count']:_0x555c45[_0x0798('0x1e')]+_0x555c45[_0x0798('0x21')];var _0x4f3f01;if(_0x145197>=_0x502635){_0x145197=_0x502635;_0x4f3f01=0xc8;}else{_0x4f3f01=0xce;}_0x47be56[_0x0798('0x1b')](_0x4f3f01);return _0x47be56[_0x0798('0x22')](_0x0798('0x23'),_0x46e74c+'-'+_0x145197+'/'+_0x502635)[_0x0798('0x1d')](_0x21c30b);}return null;};}function patchUpdates(_0xfbb4a5){return function(_0x273ba8){try{jsonpatch[_0x0798('0x24')](_0x273ba8,_0xfbb4a5,!![]);}catch(_0x212ad5){return BPromise[_0x0798('0x25')](_0x212ad5);}return _0x273ba8['save']();};}function saveUpdates(_0x2aaabf,_0x35c141){return function(_0x3bca45){if(_0x3bca45){return _0x3bca45[_0x0798('0x26')](_0x2aaabf)[_0x0798('0x27')](function(_0x23f283){return _0x23f283;});}return null;};}function removeEntity(_0x52037c,_0x3f66e2){return function(_0x3e80d7){if(_0x3e80d7){return _0x3e80d7[_0x0798('0x28')]()[_0x0798('0x27')](function(){_0x52037c[_0x0798('0x1b')](0xcc)[_0x0798('0x1c')]();});}};}function handleEntityNotFound(_0x4f648a,_0x43d99f){return function(_0x14f828){if(!_0x14f828){_0x4f648a[_0x0798('0x1a')](0x194);}return _0x14f828;};}function handleError(_0x4d4e0a,_0x4bc3f3){_0x4bc3f3=_0x4bc3f3||0x1f4;return function(_0x5e7246){logger['error'](_0x5e7246[_0x0798('0x29')]);if(_0x5e7246[_0x0798('0x2a')]){delete _0x5e7246[_0x0798('0x2a')];}_0x4d4e0a[_0x0798('0x1b')](_0x4bc3f3)[_0x0798('0x2b')](_0x5e7246);};}exports[_0x0798('0x2c')]=function(_0x30bec,_0x23e770){var _0x5bbe3d={},_0x167960={},_0x4f5d1d={'count':0x0,'rows':[]};var _0x5f1780=_[_0x0798('0x2d')](db['FreshdeskAccount'][_0x0798('0x2e')],function(_0x4a5fb1){return{'name':_0x4a5fb1[_0x0798('0x2f')],'type':_0x4a5fb1[_0x0798('0x30')][_0x0798('0x31')]};});_0x167960[_0x0798('0x32')]=_[_0x0798('0x2d')](_0x5f1780,_0x0798('0x2a'));_0x167960[_0x0798('0x33')]=_[_0x0798('0x34')](_0x30bec[_0x0798('0x33')]);_0x167960[_0x0798('0x35')]=_[_0x0798('0x36')](_0x167960[_0x0798('0x32')],_0x167960['query']);_0x5bbe3d[_0x0798('0x37')]=_['intersection'](_0x167960['model'],qs[_0x0798('0x38')](_0x30bec[_0x0798('0x33')]['fields']));_0x5bbe3d['attributes']=_0x5bbe3d[_0x0798('0x37')][_0x0798('0x39')]?_0x5bbe3d[_0x0798('0x37')]:_0x167960[_0x0798('0x32')];if(!_0x30bec[_0x0798('0x33')][_0x0798('0x3a')]('nolimit')){_0x5bbe3d['limit']=qs[_0x0798('0x21')](_0x30bec[_0x0798('0x33')][_0x0798('0x21')]);_0x5bbe3d['offset']=qs['offset'](_0x30bec['query'][_0x0798('0x1e')]);}_0x5bbe3d[_0x0798('0x3b')]=qs[_0x0798('0x3c')](_0x30bec[_0x0798('0x33')][_0x0798('0x3c')]);_0x5bbe3d[_0x0798('0x3d')]=qs[_0x0798('0x35')](_[_0x0798('0x3e')](_0x30bec['query'],_0x167960[_0x0798('0x35')]),_0x5f1780);if(_0x30bec['query'][_0x0798('0x3f')]){_0x5bbe3d[_0x0798('0x3d')]=_[_0x0798('0x40')](_0x5bbe3d['where'],{'$or':_[_0x0798('0x2d')](_0x5f1780,function(_0x591862){if(_0x591862[_0x0798('0x30')]!==_0x0798('0x41')){var _0x223751={};_0x223751[_0x591862['name']]={'$like':'%'+_0x30bec[_0x0798('0x33')][_0x0798('0x3f')]+'%'};return _0x223751;}})});}_0x5bbe3d=_['merge']({},_0x5bbe3d,_0x30bec[_0x0798('0x42')]);var _0x5cb953={'where':_0x5bbe3d['where']};return db[_0x0798('0x43')][_0x0798('0x20')](_0x5cb953)['then'](function(_0x4ddbca){_0x4f5d1d[_0x0798('0x20')]=_0x4ddbca;if(_0x30bec[_0x0798('0x33')][_0x0798('0x44')]){_0x5bbe3d[_0x0798('0x45')]=[{'all':!![]}];}return db[_0x0798('0x43')][_0x0798('0x46')](_0x5bbe3d);})[_0x0798('0x27')](function(_0x521829){_0x4f5d1d[_0x0798('0x47')]=_0x521829;return _0x4f5d1d;})[_0x0798('0x27')](respondWithFilteredResult(_0x23e770,_0x5bbe3d))[_0x0798('0x48')](handleError(_0x23e770,null));};exports[_0x0798('0x49')]=function(_0x3a8a14,_0x26e9cb){var _0x4c2d8a={'raw':![],'where':{'id':_0x3a8a14[_0x0798('0x4a')]['id']}},_0x192e15={};_0x192e15[_0x0798('0x32')]=_[_0x0798('0x34')](db[_0x0798('0x43')][_0x0798('0x2e')]);_0x192e15[_0x0798('0x33')]=_[_0x0798('0x34')](_0x3a8a14[_0x0798('0x33')]);_0x192e15[_0x0798('0x35')]=_[_0x0798('0x36')](_0x192e15[_0x0798('0x32')],_0x192e15['query']);_0x4c2d8a[_0x0798('0x37')]=_[_0x0798('0x36')](_0x192e15[_0x0798('0x32')],qs[_0x0798('0x38')](_0x3a8a14['query']['fields']));_0x4c2d8a[_0x0798('0x37')]=_0x4c2d8a[_0x0798('0x37')][_0x0798('0x39')]?_0x4c2d8a[_0x0798('0x37')]:_0x192e15['model'];if(_0x3a8a14[_0x0798('0x33')]['includeAll']){_0x4c2d8a['include']=[{'all':!![]}];}_0x4c2d8a=_[_0x0798('0x40')]({},_0x4c2d8a,_0x3a8a14[_0x0798('0x42')]);return db[_0x0798('0x43')][_0x0798('0x4b')](_0x4c2d8a)[_0x0798('0x27')](handleEntityNotFound(_0x26e9cb,null))[_0x0798('0x27')](respondWithResult(_0x26e9cb,null))[_0x0798('0x48')](handleError(_0x26e9cb,null));};exports[_0x0798('0x4c')]=function(_0x182e3b,_0x580bcd){return db[_0x0798('0x43')]['create'](_0x182e3b[_0x0798('0x4d')],{})[_0x0798('0x27')](respondWithResult(_0x580bcd,0xc9))[_0x0798('0x48')](handleError(_0x580bcd,null));};exports['update']=function(_0x9dea1f,_0x275e6e){if(_0x9dea1f[_0x0798('0x4d')]['id']){delete _0x9dea1f[_0x0798('0x4d')]['id'];}return db['FreshdeskAccount'][_0x0798('0x4b')]({'where':{'id':_0x9dea1f[_0x0798('0x4a')]['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x275e6e,null))[_0x0798('0x27')](saveUpdates(_0x9dea1f[_0x0798('0x4d')],null))['then'](respondWithResult(_0x275e6e,null))[_0x0798('0x48')](handleError(_0x275e6e,null));};exports[_0x0798('0x28')]=function(_0x2679b1,_0x10173d){return db[_0x0798('0x43')][_0x0798('0x4b')]({'where':{'id':_0x2679b1[_0x0798('0x4a')]['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x10173d,null))[_0x0798('0x27')](removeEntity(_0x10173d,null))['catch'](handleError(_0x10173d,null));};exports['getConfigurations']=function(_0x450fb2,_0x499073,_0x375f11){var _0x17967e={};var _0x40b3d6={};var _0x2cc9a5;var _0x3fa571;return db['FreshdeskAccount'][_0x0798('0x4e')]({'where':{'id':_0x450fb2['params']['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x499073,null))[_0x0798('0x27')](function(_0x3a3cc7){if(_0x3a3cc7){_0x2cc9a5=_0x3a3cc7;_0x40b3d6['model']=_['keys'](db['FreshdeskConfiguration'][_0x0798('0x2e')]);_0x40b3d6['query']=_['keys'](_0x450fb2[_0x0798('0x33')]);_0x40b3d6[_0x0798('0x35')]=_[_0x0798('0x36')](_0x40b3d6['model'],_0x40b3d6[_0x0798('0x33')]);_0x17967e[_0x0798('0x37')]=_[_0x0798('0x36')](_0x40b3d6[_0x0798('0x32')],qs['fields'](_0x450fb2['query'][_0x0798('0x38')]));_0x17967e[_0x0798('0x37')]=_0x17967e[_0x0798('0x37')]['length']?_0x17967e['attributes']:_0x40b3d6[_0x0798('0x32')];_0x17967e[_0x0798('0x3b')]=qs[_0x0798('0x3c')](_0x450fb2[_0x0798('0x33')][_0x0798('0x3c')]);_0x17967e[_0x0798('0x3d')]=qs[_0x0798('0x35')](_[_0x0798('0x3e')](_0x450fb2['query'],_0x40b3d6[_0x0798('0x35')]));if(_0x450fb2[_0x0798('0x33')]['filter']){_0x17967e[_0x0798('0x3d')]=_[_0x0798('0x40')](_0x17967e['where'],{'$or':_[_0x0798('0x2d')](_0x17967e[_0x0798('0x37')],function(_0x445872){var _0x257c8d={};_0x257c8d[_0x445872]={'$like':'%'+_0x450fb2[_0x0798('0x33')]['filter']+'%'};return _0x257c8d;})});}_0x17967e=_[_0x0798('0x40')]({},_0x17967e,_0x450fb2[_0x0798('0x42')]);return _0x2cc9a5[_0x0798('0x4f')](_0x17967e);}})['then'](function(_0x1135d5){if(_0x1135d5){_0x3fa571=_0x1135d5['length'];if(!_0x450fb2[_0x0798('0x33')][_0x0798('0x3a')](_0x0798('0x50'))){_0x17967e[_0x0798('0x21')]=qs[_0x0798('0x21')](_0x450fb2[_0x0798('0x33')]['limit']);_0x17967e[_0x0798('0x1e')]=qs[_0x0798('0x1e')](_0x450fb2[_0x0798('0x33')][_0x0798('0x1e')]);}return _0x2cc9a5['getConfigurations'](_0x17967e);}})[_0x0798('0x27')](function(_0x105f88){if(_0x105f88){return _0x105f88?{'count':_0x3fa571,'rows':_0x105f88}:null;}})[_0x0798('0x27')](respondWithResult(_0x499073,null))[_0x0798('0x48')](handleError(_0x499073,null));};exports[_0x0798('0x51')]=function(_0x523a2b,_0x3ad6d9,_0x3d933a){if(_0x523a2b['body']['id']){delete _0x523a2b[_0x0798('0x4d')]['id'];}return db[_0x0798('0x43')][_0x0798('0x4e')]({'where':{'id':_0x523a2b['params']['id']}})[_0x0798('0x27')](handleEntityNotFound(_0x3ad6d9,null))[_0x0798('0x27')](function(_0x3c218b){if(_0x3c218b){_0x523a2b[_0x0798('0x4d')][_0x0798('0x52')]=_0x3c218b['id'];_0x523a2b[_0x0798('0x4d')][_0x0798('0x53')]=integrations[_0x0798('0x54')](_0x523a2b['body'][_0x0798('0x55')],_0x523a2b[_0x0798('0x4d')][_0x0798('0x30')]);_0x523a2b[_0x0798('0x4d')]['Descriptions']=integrations[_0x0798('0x56')](_0x523a2b[_0x0798('0x4d')][_0x0798('0x55')],_0x523a2b[_0x0798('0x4d')][_0x0798('0x30')]);return db[_0x0798('0x57')][_0x0798('0x4c')](_0x523a2b[_0x0798('0x4d')],{'include':[{'model':db['FreshdeskField'],'as':_0x0798('0x53')},{'model':db['FreshdeskField'],'as':_0x0798('0x58')}]});}return null;})[_0x0798('0x27')](respondWithResult(_0x3ad6d9,null))[_0x0798('0x48')](handleError(_0x3ad6d9,null));};exports['getFields']=function(_0x1fad8c,_0x15eb2b,_0x540703){var _0x11dcc6='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x1fad8c[_0x0798('0x4a')]['id']},'attributes':['id',_0x0798('0x59'),_0x0798('0x5a')]})[_0x0798('0x27')](handleEntityNotFound(_0x15eb2b,null))['then'](function(_0x3ebb8e){if(_0x3ebb8e){_0x11dcc6=_0x3ebb8e[_0x0798('0x59')];var _0x4750f8=_0x11dcc6[_0x0798('0x5b')](-0x1);if(_0x4750f8==='/'){_0x11dcc6=_0x11dcc6[_0x0798('0x5c')](0x0,_0x11dcc6[_0x0798('0x5d')](_0x4750f8));}return rp({'method':_0x0798('0x5e'),'uri':util['format']('%s/%s',_0x11dcc6,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x0798('0x5f')](_0x0798('0x60'),new Buffer(util[_0x0798('0x5f')](_0x0798('0x61'),_0x3ebb8e['apiKey']))[_0x0798('0x62')](_0x0798('0x63')))},'json':!![]});}})['then'](function(_0x12393b){if(_0x12393b){var _0x5c46aa=[_0x0798('0x64'),'subject',_0x0798('0x65'),_0x0798('0x66'),_0x0798('0x1b'),_0x0798('0x67'),_0x0798('0x68'),_0x0798('0x69'),_0x0798('0x6a'),_0x0798('0x68'),'company'];_[_0x0798('0x6b')](_0x12393b,function(_0x47e5bd){return _0x5c46aa[_0x0798('0x6c')](_0x47e5bd[_0x0798('0x2a')])||!_0x47e5bd['default']&&_0x47e5bd[_0x0798('0x30')]!==_0x0798('0x6d')&&_0x47e5bd['type']!==_0x0798('0x6e');});return{'count':_0x12393b['length'],'rows':_[_0x0798('0x2d')](_0x12393b,function(_0x447d3c){return{'id':_0x447d3c[_0x0798('0x2a')],'name':_0x447d3c['label'],'custom':!_0x447d3c[_0x0798('0x6f')],'options':_0x447d3c[_0x0798('0x70')]?_[_0x0798('0x2d')](_0x447d3c[_0x0798('0x70')],function(_0x530e1f){return{'name':_[_0x0798('0x71')](_0x530e1f),'value':_0x530e1f};}):[]};})};}})[_0x0798('0x27')](respondWithResult(_0x15eb2b,null))[_0x0798('0x48')](function(_0x1c9a79){var _0x389452=_0x1fad8c[_0x0798('0x33')]['test']?0x1f4:_0x1c9a79['statusCode']||0x1f4;logger[_0x0798('0x72')](_0x0798('0x73'),_0x0798('0x74'),_0x389452,JSON[_0x0798('0x75')](_0x1c9a79));delete _0x1c9a79[_0x0798('0x2a')];if(_0x389452===0x191){_0x389452=0x190;}_0x15eb2b[_0x0798('0x1b')](_0x389452)['send'](_0x1fad8c['query'][_0x0798('0x76')]?{'message':_0x0798('0x77'),'statusCode':_0x1c9a79['statusCode']}:_0x1c9a79);});}; \ No newline at end of file +var _0x4cdf=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','FreshdeskAccount','count','includeAll','include','params','options','find','catch','create','body','destroy','getConfigurations','findOne','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','remoteUri','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','group','ticket_type','company','custom_text','label','default','capitalize','test','statusCode','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','update','then','sendStatus','error','name','send','map','rawAttributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4cdf,0x180));var _0xf4cd=function(_0x2fad72,_0x309ecb){_0x2fad72=_0x2fad72-0x0;var _0xd051f7=_0x4cdf[_0x2fad72];return _0xd051f7;};'use strict';var emlformat=require(_0xf4cd('0x0'));var rimraf=require(_0xf4cd('0x1'));var zipdir=require(_0xf4cd('0x2'));var jsonpatch=require(_0xf4cd('0x3'));var rp=require(_0xf4cd('0x4'));var moment=require(_0xf4cd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4cd('0x6'));var util=require(_0xf4cd('0x7'));var path=require('path');var sox=require(_0xf4cd('0x8'));var csv=require(_0xf4cd('0x9'));var ejs=require(_0xf4cd('0xa'));var fs=require('fs');var fs_extra=require(_0xf4cd('0xb'));var _=require(_0xf4cd('0xc'));var squel=require('squel');var crypto=require(_0xf4cd('0xd'));var jsforce=require(_0xf4cd('0xe'));var deskjs=require(_0xf4cd('0xf'));var toCsv=require(_0xf4cd('0x9'));var querystring=require('querystring');var Papa=require(_0xf4cd('0x10'));var Redis=require(_0xf4cd('0x11'));var authService=require(_0xf4cd('0x12'));var qs=require(_0xf4cd('0x13'));var as=require(_0xf4cd('0x14'));var hardwareService=require(_0xf4cd('0x15'));var logger=require(_0xf4cd('0x16'))('api');var utils=require(_0xf4cd('0x17'));var config=require(_0xf4cd('0x18'));var licenseUtil=require(_0xf4cd('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x240614,_0x16c4a1){_0x16c4a1=_0x16c4a1||0xcc;return function(_0x2b1f5f){if(_0x2b1f5f){return _0x240614['sendStatus'](_0x16c4a1);}return _0x240614[_0xf4cd('0x1a')](_0x16c4a1)[_0xf4cd('0x1b')]();};}function respondWithResult(_0x216b55,_0xf12547){_0xf12547=_0xf12547||0xc8;return function(_0x35855b){if(_0x35855b){return _0x216b55[_0xf4cd('0x1a')](_0xf12547)['json'](_0x35855b);}};}function respondWithFilteredResult(_0x1cfb21,_0xa1ee6){return function(_0x1488c0){if(_0x1488c0){var _0xf2ecd3=typeof _0xa1ee6['offset']===_0xf4cd('0x1c')&&typeof _0xa1ee6[_0xf4cd('0x1d')]===_0xf4cd('0x1c');var _0x34581e=_0x1488c0['count'];var _0x5eca10=_0xf2ecd3?0x0:_0xa1ee6[_0xf4cd('0x1e')];var _0x27bd35=_0xf2ecd3?_0x1488c0['count']:_0xa1ee6[_0xf4cd('0x1e')]+_0xa1ee6['limit'];var _0x11d8fc;if(_0x27bd35>=_0x34581e){_0x27bd35=_0x34581e;_0x11d8fc=0xc8;}else{_0x11d8fc=0xce;}_0x1cfb21[_0xf4cd('0x1a')](_0x11d8fc);return _0x1cfb21[_0xf4cd('0x1f')](_0xf4cd('0x20'),_0x5eca10+'-'+_0x27bd35+'/'+_0x34581e)[_0xf4cd('0x21')](_0x1488c0);}return null;};}function patchUpdates(_0x7e607){return function(_0x402ca5){try{jsonpatch[_0xf4cd('0x22')](_0x402ca5,_0x7e607,!![]);}catch(_0x30f6af){return BPromise[_0xf4cd('0x23')](_0x30f6af);}return _0x402ca5['save']();};}function saveUpdates(_0xfdfbd9,_0x5b634b){return function(_0x59cb95){if(_0x59cb95){return _0x59cb95[_0xf4cd('0x24')](_0xfdfbd9)[_0xf4cd('0x25')](function(_0x2a6938){return _0x2a6938;});}return null;};}function removeEntity(_0x18000c,_0x4e81cc){return function(_0x56e9f6){if(_0x56e9f6){return _0x56e9f6['destroy']()[_0xf4cd('0x25')](function(){_0x18000c[_0xf4cd('0x1a')](0xcc)[_0xf4cd('0x1b')]();});}};}function handleEntityNotFound(_0x3ce52c,_0x5617ce){return function(_0x47b580){if(!_0x47b580){_0x3ce52c[_0xf4cd('0x26')](0x194);}return _0x47b580;};}function handleError(_0x140d07,_0xe83f03){_0xe83f03=_0xe83f03||0x1f4;return function(_0x38cc57){logger[_0xf4cd('0x27')](_0x38cc57['stack']);if(_0x38cc57[_0xf4cd('0x28')]){delete _0x38cc57[_0xf4cd('0x28')];}_0x140d07[_0xf4cd('0x1a')](_0xe83f03)[_0xf4cd('0x29')](_0x38cc57);};}exports['index']=function(_0x46f266,_0xd4e453){var _0xcafa84={},_0x2c2390={},_0x12b919={'count':0x0,'rows':[]};var _0x4d8d1b=_[_0xf4cd('0x2a')](db['FreshdeskAccount'][_0xf4cd('0x2b')],function(_0x3def8e){return{'name':_0x3def8e[_0xf4cd('0x2c')],'type':_0x3def8e[_0xf4cd('0x2d')]['key']};});_0x2c2390['model']=_['map'](_0x4d8d1b,_0xf4cd('0x28'));_0x2c2390[_0xf4cd('0x2e')]=_[_0xf4cd('0x2f')](_0x46f266[_0xf4cd('0x2e')]);_0x2c2390[_0xf4cd('0x30')]=_[_0xf4cd('0x31')](_0x2c2390[_0xf4cd('0x32')],_0x2c2390[_0xf4cd('0x2e')]);_0xcafa84[_0xf4cd('0x33')]=_['intersection'](_0x2c2390['model'],qs[_0xf4cd('0x34')](_0x46f266[_0xf4cd('0x2e')][_0xf4cd('0x34')]));_0xcafa84[_0xf4cd('0x33')]=_0xcafa84['attributes'][_0xf4cd('0x35')]?_0xcafa84[_0xf4cd('0x33')]:_0x2c2390[_0xf4cd('0x32')];if(!_0x46f266[_0xf4cd('0x2e')][_0xf4cd('0x36')](_0xf4cd('0x37'))){_0xcafa84[_0xf4cd('0x1d')]=qs[_0xf4cd('0x1d')](_0x46f266[_0xf4cd('0x2e')][_0xf4cd('0x1d')]);_0xcafa84[_0xf4cd('0x1e')]=qs[_0xf4cd('0x1e')](_0x46f266[_0xf4cd('0x2e')]['offset']);}_0xcafa84[_0xf4cd('0x38')]=qs['sort'](_0x46f266['query']['sort']);_0xcafa84[_0xf4cd('0x39')]=qs[_0xf4cd('0x30')](_[_0xf4cd('0x3a')](_0x46f266[_0xf4cd('0x2e')],_0x2c2390['filters']),_0x4d8d1b);if(_0x46f266['query'][_0xf4cd('0x3b')]){_0xcafa84[_0xf4cd('0x39')]=_['merge'](_0xcafa84[_0xf4cd('0x39')],{'$or':_[_0xf4cd('0x2a')](_0x4d8d1b,function(_0x34746d){if(_0x34746d[_0xf4cd('0x2d')]!=='VIRTUAL'){var _0x549593={};_0x549593[_0x34746d[_0xf4cd('0x28')]]={'$like':'%'+_0x46f266[_0xf4cd('0x2e')][_0xf4cd('0x3b')]+'%'};return _0x549593;}})});}_0xcafa84=_[_0xf4cd('0x3c')]({},_0xcafa84,_0x46f266['options']);var _0x2b5a3f={'where':_0xcafa84[_0xf4cd('0x39')]};return db[_0xf4cd('0x3d')][_0xf4cd('0x3e')](_0x2b5a3f)['then'](function(_0x4eb40d){_0x12b919['count']=_0x4eb40d;if(_0x46f266[_0xf4cd('0x2e')][_0xf4cd('0x3f')]){_0xcafa84[_0xf4cd('0x40')]=[{'all':!![]}];}return db[_0xf4cd('0x3d')]['findAll'](_0xcafa84);})[_0xf4cd('0x25')](function(_0x1c5461){_0x12b919['rows']=_0x1c5461;return _0x12b919;})['then'](respondWithFilteredResult(_0xd4e453,_0xcafa84))['catch'](handleError(_0xd4e453,null));};exports['show']=function(_0xf98306,_0x32b86c){var _0xaec9ac={'raw':![],'where':{'id':_0xf98306[_0xf4cd('0x41')]['id']}},_0x2381c0={};_0x2381c0['model']=_[_0xf4cd('0x2f')](db[_0xf4cd('0x3d')][_0xf4cd('0x2b')]);_0x2381c0[_0xf4cd('0x2e')]=_[_0xf4cd('0x2f')](_0xf98306[_0xf4cd('0x2e')]);_0x2381c0[_0xf4cd('0x30')]=_[_0xf4cd('0x31')](_0x2381c0['model'],_0x2381c0[_0xf4cd('0x2e')]);_0xaec9ac['attributes']=_['intersection'](_0x2381c0[_0xf4cd('0x32')],qs[_0xf4cd('0x34')](_0xf98306[_0xf4cd('0x2e')]['fields']));_0xaec9ac[_0xf4cd('0x33')]=_0xaec9ac['attributes']['length']?_0xaec9ac[_0xf4cd('0x33')]:_0x2381c0[_0xf4cd('0x32')];if(_0xf98306['query'][_0xf4cd('0x3f')]){_0xaec9ac[_0xf4cd('0x40')]=[{'all':!![]}];}_0xaec9ac=_[_0xf4cd('0x3c')]({},_0xaec9ac,_0xf98306[_0xf4cd('0x42')]);return db[_0xf4cd('0x3d')][_0xf4cd('0x43')](_0xaec9ac)[_0xf4cd('0x25')](handleEntityNotFound(_0x32b86c,null))[_0xf4cd('0x25')](respondWithResult(_0x32b86c,null))[_0xf4cd('0x44')](handleError(_0x32b86c,null));};exports[_0xf4cd('0x45')]=function(_0x474306,_0x2e794c){return db[_0xf4cd('0x3d')][_0xf4cd('0x45')](_0x474306['body'],{})['then'](respondWithResult(_0x2e794c,0xc9))[_0xf4cd('0x44')](handleError(_0x2e794c,null));};exports[_0xf4cd('0x24')]=function(_0x8d3408,_0x4b5dc2){if(_0x8d3408[_0xf4cd('0x46')]['id']){delete _0x8d3408[_0xf4cd('0x46')]['id'];}return db[_0xf4cd('0x3d')]['find']({'where':{'id':_0x8d3408[_0xf4cd('0x41')]['id']}})[_0xf4cd('0x25')](handleEntityNotFound(_0x4b5dc2,null))[_0xf4cd('0x25')](saveUpdates(_0x8d3408[_0xf4cd('0x46')],null))[_0xf4cd('0x25')](respondWithResult(_0x4b5dc2,null))[_0xf4cd('0x44')](handleError(_0x4b5dc2,null));};exports[_0xf4cd('0x47')]=function(_0x50220b,_0x13216a){return db[_0xf4cd('0x3d')][_0xf4cd('0x43')]({'where':{'id':_0x50220b[_0xf4cd('0x41')]['id']}})[_0xf4cd('0x25')](handleEntityNotFound(_0x13216a,null))[_0xf4cd('0x25')](removeEntity(_0x13216a,null))['catch'](handleError(_0x13216a,null));};exports[_0xf4cd('0x48')]=function(_0x363d5d,_0x3b3e5f,_0x214547){var _0x4890d2={};var _0x3d23c8={};var _0x5a44ab;var _0x8538e0;return db[_0xf4cd('0x3d')][_0xf4cd('0x49')]({'where':{'id':_0x363d5d[_0xf4cd('0x41')]['id']}})[_0xf4cd('0x25')](handleEntityNotFound(_0x3b3e5f,null))['then'](function(_0xb78392){if(_0xb78392){_0x5a44ab=_0xb78392;_0x3d23c8[_0xf4cd('0x32')]=_['keys'](db['FreshdeskConfiguration'][_0xf4cd('0x2b')]);_0x3d23c8[_0xf4cd('0x2e')]=_[_0xf4cd('0x2f')](_0x363d5d[_0xf4cd('0x2e')]);_0x3d23c8['filters']=_[_0xf4cd('0x31')](_0x3d23c8[_0xf4cd('0x32')],_0x3d23c8[_0xf4cd('0x2e')]);_0x4890d2[_0xf4cd('0x33')]=_[_0xf4cd('0x31')](_0x3d23c8[_0xf4cd('0x32')],qs[_0xf4cd('0x34')](_0x363d5d[_0xf4cd('0x2e')][_0xf4cd('0x34')]));_0x4890d2[_0xf4cd('0x33')]=_0x4890d2[_0xf4cd('0x33')][_0xf4cd('0x35')]?_0x4890d2['attributes']:_0x3d23c8[_0xf4cd('0x32')];_0x4890d2[_0xf4cd('0x38')]=qs[_0xf4cd('0x4a')](_0x363d5d[_0xf4cd('0x2e')][_0xf4cd('0x4a')]);_0x4890d2[_0xf4cd('0x39')]=qs[_0xf4cd('0x30')](_[_0xf4cd('0x3a')](_0x363d5d[_0xf4cd('0x2e')],_0x3d23c8[_0xf4cd('0x30')]));if(_0x363d5d[_0xf4cd('0x2e')]['filter']){_0x4890d2[_0xf4cd('0x39')]=_[_0xf4cd('0x3c')](_0x4890d2[_0xf4cd('0x39')],{'$or':_[_0xf4cd('0x2a')](_0x4890d2['attributes'],function(_0x5d08bc){var _0x4a4ae7={};_0x4a4ae7[_0x5d08bc]={'$like':'%'+_0x363d5d[_0xf4cd('0x2e')][_0xf4cd('0x3b')]+'%'};return _0x4a4ae7;})});}_0x4890d2=_[_0xf4cd('0x3c')]({},_0x4890d2,_0x363d5d[_0xf4cd('0x42')]);return _0x5a44ab['getConfigurations'](_0x4890d2);}})[_0xf4cd('0x25')](function(_0x3dee04){if(_0x3dee04){_0x8538e0=_0x3dee04[_0xf4cd('0x35')];if(!_0x363d5d[_0xf4cd('0x2e')][_0xf4cd('0x36')]('nolimit')){_0x4890d2[_0xf4cd('0x1d')]=qs[_0xf4cd('0x1d')](_0x363d5d[_0xf4cd('0x2e')][_0xf4cd('0x1d')]);_0x4890d2['offset']=qs[_0xf4cd('0x1e')](_0x363d5d[_0xf4cd('0x2e')][_0xf4cd('0x1e')]);}return _0x5a44ab[_0xf4cd('0x48')](_0x4890d2);}})['then'](function(_0x1af3dd){if(_0x1af3dd){return _0x1af3dd?{'count':_0x8538e0,'rows':_0x1af3dd}:null;}})[_0xf4cd('0x25')](respondWithResult(_0x3b3e5f,null))['catch'](handleError(_0x3b3e5f,null));};exports[_0xf4cd('0x4b')]=function(_0x9f13be,_0x457192,_0x2799d7){if(_0x9f13be[_0xf4cd('0x46')]['id']){delete _0x9f13be[_0xf4cd('0x46')]['id'];}return db[_0xf4cd('0x3d')]['findOne']({'where':{'id':_0x9f13be[_0xf4cd('0x41')]['id']}})['then'](handleEntityNotFound(_0x457192,null))[_0xf4cd('0x25')](function(_0x221d5d){if(_0x221d5d){_0x9f13be[_0xf4cd('0x46')][_0xf4cd('0x4c')]=_0x221d5d['id'];_0x9f13be[_0xf4cd('0x46')][_0xf4cd('0x4d')]=integrations[_0xf4cd('0x4e')](_0x9f13be[_0xf4cd('0x46')][_0xf4cd('0x4f')],_0x9f13be[_0xf4cd('0x46')][_0xf4cd('0x2d')]);_0x9f13be[_0xf4cd('0x46')][_0xf4cd('0x50')]=integrations['getDescriptions'](_0x9f13be['body'][_0xf4cd('0x4f')],_0x9f13be['body'][_0xf4cd('0x2d')]);return db[_0xf4cd('0x51')]['create'](_0x9f13be['body'],{'include':[{'model':db[_0xf4cd('0x52')],'as':'Subjects'},{'model':db[_0xf4cd('0x52')],'as':_0xf4cd('0x50')}]});}return null;})[_0xf4cd('0x25')](respondWithResult(_0x457192,null))[_0xf4cd('0x44')](handleError(_0x457192,null));};exports['getFields']=function(_0xcdd031,_0xc8a2d1,_0x3ded58){var _0x1332f9='';return db['FreshdeskAccount'][_0xf4cd('0x49')]({'where':{'id':_0xcdd031[_0xf4cd('0x41')]['id']},'attributes':['id',_0xf4cd('0x53'),'apiKey']})[_0xf4cd('0x25')](handleEntityNotFound(_0xc8a2d1,null))[_0xf4cd('0x25')](function(_0x5852d7){if(_0x5852d7){_0x1332f9=_0x5852d7[_0xf4cd('0x53')];var _0x375b9c=_0x1332f9[_0xf4cd('0x54')](-0x1);if(_0x375b9c==='/'){_0x1332f9=_0x1332f9[_0xf4cd('0x55')](0x0,_0x1332f9['lastIndexOf'](_0x375b9c));}return rp({'method':_0xf4cd('0x56'),'uri':util[_0xf4cd('0x57')](_0xf4cd('0x58'),_0x1332f9,_0xf4cd('0x59')),'headers':{'Authorization':util[_0xf4cd('0x57')](_0xf4cd('0x5a'),new Buffer(util[_0xf4cd('0x57')](_0xf4cd('0x5b'),_0x5852d7[_0xf4cd('0x5c')]))[_0xf4cd('0x5d')](_0xf4cd('0x5e')))},'json':!![]});}})[_0xf4cd('0x25')](function(_0x5c9cf7){if(_0x5c9cf7){var _0x47db96=[_0xf4cd('0x5f'),'subject',_0xf4cd('0x60'),'description',_0xf4cd('0x1a'),'priority',_0xf4cd('0x61'),'source',_0xf4cd('0x62'),_0xf4cd('0x61'),_0xf4cd('0x63')];_['remove'](_0x5c9cf7,function(_0x331c98){return _0x47db96['includes'](_0x331c98['name'])||!_0x331c98['default']&&_0x331c98[_0xf4cd('0x2d')]!==_0xf4cd('0x64')&&_0x331c98['type']!=='custom_dropdown';});return{'count':_0x5c9cf7[_0xf4cd('0x35')],'rows':_[_0xf4cd('0x2a')](_0x5c9cf7,function(_0x1353f7){return{'id':_0x1353f7['name'],'name':_0x1353f7[_0xf4cd('0x65')],'custom':!_0x1353f7[_0xf4cd('0x66')],'options':_0x1353f7['choices']?_[_0xf4cd('0x2a')](_0x1353f7['choices'],function(_0x2b5751){return{'name':_[_0xf4cd('0x67')](_0x2b5751),'value':_0x2b5751};}):[]};})};}})[_0xf4cd('0x25')](respondWithResult(_0xc8a2d1,null))[_0xf4cd('0x44')](function(_0x455cd5){var _0x584c60=_0xcdd031[_0xf4cd('0x2e')][_0xf4cd('0x68')]?0x1f4:_0x455cd5[_0xf4cd('0x69')]||0x1f4;logger[_0xf4cd('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xf4cd('0x6a'),_0x584c60,JSON['stringify'](_0x455cd5));delete _0x455cd5[_0xf4cd('0x28')];if(_0x584c60===0x191){_0x584c60=0x190;}_0xc8a2d1[_0xf4cd('0x1a')](_0x584c60)[_0xf4cd('0x29')](_0xcdd031[_0xf4cd('0x2e')][_0xf4cd('0x68')]?{'message':'Wrong\x20credentials','statusCode':_0x455cd5[_0xf4cd('0x69')]}:_0x455cd5);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 44c4ad4..4f7b633 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5730=['lodash','../../config/logger','api','moment','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x210a3a,_0x1f5265){var _0x328725=function(_0x21de5f){while(--_0x21de5f){_0x210a3a['push'](_0x210a3a['shift']());}};_0x328725(++_0x1f5265);}(_0x5730,0x82));var _0x0573=function(_0x2c8129,_0x2200fd){_0x2c8129=_0x2c8129-0x0;var _0x1871f7=_0x5730[_0x2c8129];return _0x1871f7;};'use strict';var _=require(_0x0573('0x0'));var util=require('util');var logger=require(_0x0573('0x1'))(_0x0573('0x2'));var moment=require(_0x0573('0x3'));var BPromise=require('bluebird');var rp=require(_0x0573('0x4'));var fs=require('fs');var path=require(_0x0573('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0573('0x6'));var integrations=require(_0x0573('0x7'));module[_0x0573('0x8')]=function(_0x5224ff,_0x4a724a){return _0x5224ff[_0x0573('0x9')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2062=['exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x13573c,_0x585238){var _0x37bc6e=function(_0x3e5a4f){while(--_0x3e5a4f){_0x13573c['push'](_0x13573c['shift']());}};_0x37bc6e(++_0x585238);}(_0x2062,0x137));var _0x2206=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x2062[_0x21353c];return _0xa99120;};'use strict';var _=require(_0x2206('0x0'));var util=require(_0x2206('0x1'));var logger=require(_0x2206('0x2'))(_0x2206('0x3'));var moment=require(_0x2206('0x4'));var BPromise=require(_0x2206('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2206('0x6'));var rimraf=require(_0x2206('0x7'));var config=require(_0x2206('0x8'));var attributes=require(_0x2206('0x9'));var integrations=require(_0x2206('0xa'));module[_0x2206('0xb')]=function(_0x517f6f,_0x4e74e5){return _0x517f6f[_0x2206('0xc')]('FreshdeskAccount',attributes,{'tableName':_0x2206('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 0c82c8a..99f2642 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb81=['options','raw','where','limit','map','include','model','attributes','ShowFreshdeskAccount','find','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll'];(function(_0x5d99be,_0x13ac4c){var _0x22a468=function(_0x12a3db){while(--_0x12a3db){_0x5d99be['push'](_0x5d99be['shift']());}};_0x22a468(++_0x13ac4c);}(_0xcb81,0x154));var _0x1cb8=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0xcb81[_0x21bfab];return _0x4db318;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var moment=require('moment');var BPromise=require(_0x1cb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1cb8('0x3'));var logger=require(_0x1cb8('0x4'))(_0x1cb8('0x5'));var config=require(_0x1cb8('0x6'));var jayson=require(_0x1cb8('0x7'));var client=jayson['client'][_0x1cb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac2d6,_0x584b16,_0x2408c2){return new BPromise(function(_0x39b4ad,_0x282fd8){return client['request'](_0x2ac2d6,_0x2408c2)[_0x1cb8('0x9')](function(_0x51dc9e){logger['info'](_0x1cb8('0xa'),_0x584b16,_0x1cb8('0xb'));logger[_0x1cb8('0xc')](_0x1cb8('0xd'),_0x584b16,_0x1cb8('0xb'),JSON[_0x1cb8('0xe')](_0x51dc9e));if(_0x51dc9e[_0x1cb8('0xf')]){if(_0x51dc9e[_0x1cb8('0xf')]['code']===0x1f4){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x282fd8(_0x51dc9e[_0x1cb8('0xf')]['message']);}logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x39b4ad(_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);}else{logger[_0x1cb8('0x11')](_0x1cb8('0xa'),_0x584b16,'request\x20sent');_0x39b4ad(_0x51dc9e[_0x1cb8('0x12')]['message']);}})[_0x1cb8('0x13')](function(_0x28b8ff){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x28b8ff);_0x282fd8(_0x28b8ff);});});}exports[_0x1cb8('0x14')]=function(_0x308088){var _0x3bfbcf=this;return new Promise(function(_0x9f0adb,_0x2631db){return db[_0x1cb8('0x15')][_0x1cb8('0x16')]({'raw':_0x308088[_0x1cb8('0x17')]?_0x308088['options'][_0x1cb8('0x18')]===undefined?!![]:![]:!![],'where':_0x308088[_0x1cb8('0x17')]?_0x308088[_0x1cb8('0x17')][_0x1cb8('0x19')]||null:null,'attributes':_0x308088['options']?_0x308088[_0x1cb8('0x17')]['attributes']||null:null,'limit':_0x308088[_0x1cb8('0x17')]?_0x308088[_0x1cb8('0x17')][_0x1cb8('0x1a')]||null:null,'include':_0x308088[_0x1cb8('0x17')]?_0x308088['options']['include']?_[_0x1cb8('0x1b')](_0x308088[_0x1cb8('0x17')][_0x1cb8('0x1c')],function(_0x44a00d){return{'model':db[_0x44a00d[_0x1cb8('0x1d')]],'as':_0x44a00d['as'],'attributes':_0x44a00d[_0x1cb8('0x1e')],'include':_0x44a00d[_0x1cb8('0x1c')]?_['map'](_0x44a00d[_0x1cb8('0x1c')],function(_0x4554d5){return{'model':db[_0x4554d5[_0x1cb8('0x1d')]],'as':_0x4554d5['as'],'attributes':_0x4554d5[_0x1cb8('0x1e')],'include':_0x4554d5[_0x1cb8('0x1c')]?_[_0x1cb8('0x1b')](_0x4554d5['include'],function(_0x1ec995){return{'model':db[_0x1ec995[_0x1cb8('0x1d')]],'as':_0x1ec995['as'],'attributes':_0x1ec995[_0x1cb8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1cb8('0x9')](function(_0x272a15){logger['info'](_0x1cb8('0x14'),_0x308088);logger[_0x1cb8('0xc')](_0x1cb8('0x14'),_0x308088,JSON[_0x1cb8('0xe')](_0x272a15));_0x9f0adb(_0x272a15);})['catch'](function(_0x2a79e0){logger[_0x1cb8('0xf')](_0x1cb8('0x14'),_0x2a79e0['message'],_0x308088);_0x2631db(_0x3bfbcf[_0x1cb8('0xf')](0x1f4,_0x2a79e0[_0x1cb8('0x10')]));});});};exports[_0x1cb8('0x1f')]=function(_0x5558fe){var _0x73be67=this;return new Promise(function(_0x3e2af4,_0x239c62){return db[_0x1cb8('0x15')][_0x1cb8('0x20')]({'raw':_0x5558fe['options']?_0x5558fe[_0x1cb8('0x17')][_0x1cb8('0x18')]===undefined?!![]:![]:!![],'where':_0x5558fe[_0x1cb8('0x17')]?_0x5558fe[_0x1cb8('0x17')][_0x1cb8('0x19')]||null:null,'attributes':_0x5558fe[_0x1cb8('0x17')]?_0x5558fe[_0x1cb8('0x17')][_0x1cb8('0x1e')]||null:null,'include':_0x5558fe[_0x1cb8('0x17')]?_0x5558fe['options']['include']?_[_0x1cb8('0x1b')](_0x5558fe[_0x1cb8('0x17')][_0x1cb8('0x1c')],function(_0x5be4b7){return{'model':db[_0x5be4b7['model']],'as':_0x5be4b7['as'],'attributes':_0x5be4b7[_0x1cb8('0x1e')],'include':_0x5be4b7[_0x1cb8('0x1c')]?_[_0x1cb8('0x1b')](_0x5be4b7[_0x1cb8('0x1c')],function(_0x198848){return{'model':db[_0x198848[_0x1cb8('0x1d')]],'as':_0x198848['as'],'attributes':_0x198848[_0x1cb8('0x1e')],'include':_0x198848[_0x1cb8('0x1c')]?_['map'](_0x198848[_0x1cb8('0x1c')],function(_0x1a6518){return{'model':db[_0x1a6518[_0x1cb8('0x1d')]],'as':_0x1a6518['as'],'attributes':_0x1a6518[_0x1cb8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1cb8('0x9')](function(_0x421ce7){logger[_0x1cb8('0x11')](_0x1cb8('0x1f'),_0x5558fe);logger[_0x1cb8('0xc')]('ShowFreshdeskAccount',_0x5558fe,JSON[_0x1cb8('0xe')](_0x421ce7));_0x3e2af4(_0x421ce7);})[_0x1cb8('0x13')](function(_0x5e9f5f){logger[_0x1cb8('0xf')](_0x1cb8('0x1f'),_0x5e9f5f[_0x1cb8('0x10')],_0x5558fe);_0x239c62(_0x73be67[_0x1cb8('0xf')](0x1f4,_0x5e9f5f[_0x1cb8('0x10')]));});});}; \ No newline at end of file +var _0xa979=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','FreshdeskAccount','findAll','options','raw','where','limit','include','map','attributes','model','GetFreshdeskAccount','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4203e6,_0x589940){var _0x3cd98d=function(_0x40498e){while(--_0x40498e){_0x4203e6['push'](_0x4203e6['shift']());}};_0x3cd98d(++_0x589940);}(_0xa979,0x17a));var _0x9a97=function(_0x3912b5,_0x1a04b1){_0x3912b5=_0x3912b5-0x0;var _0x30697f=_0xa979[_0x3912b5];return _0x30697f;};'use strict';var _=require(_0x9a97('0x0'));var util=require(_0x9a97('0x1'));var moment=require(_0x9a97('0x2'));var BPromise=require(_0x9a97('0x3'));var rs=require(_0x9a97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a97('0x5'))['db'];var utils=require(_0x9a97('0x6'));var logger=require(_0x9a97('0x7'))(_0x9a97('0x8'));var config=require(_0x9a97('0x9'));var jayson=require(_0x9a97('0xa'));var client=jayson[_0x9a97('0xb')][_0x9a97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xef4d2a,_0x52ddd8,_0x1870e0){return new BPromise(function(_0x174fe2,_0x49573e){return client['request'](_0xef4d2a,_0x1870e0)[_0x9a97('0xd')](function(_0x374d37){logger['info'](_0x9a97('0xe'),_0x52ddd8,'request\x20sent');logger[_0x9a97('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x52ddd8,_0x9a97('0x10'),JSON[_0x9a97('0x11')](_0x374d37));if(_0x374d37[_0x9a97('0x12')]){if(_0x374d37[_0x9a97('0x12')][_0x9a97('0x13')]===0x1f4){logger[_0x9a97('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x52ddd8,_0x374d37[_0x9a97('0x12')][_0x9a97('0x14')]);return _0x49573e(_0x374d37[_0x9a97('0x12')]['message']);}logger[_0x9a97('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x52ddd8,_0x374d37[_0x9a97('0x12')][_0x9a97('0x14')]);return _0x174fe2(_0x374d37[_0x9a97('0x12')][_0x9a97('0x14')]);}else{logger[_0x9a97('0x15')](_0x9a97('0xe'),_0x52ddd8,'request\x20sent');_0x174fe2(_0x374d37['result']['message']);}})[_0x9a97('0x16')](function(_0x67e4c){logger[_0x9a97('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x52ddd8,_0x67e4c);_0x49573e(_0x67e4c);});});}exports['GetFreshdeskAccount']=function(_0x155776){var _0x333636=this;return new Promise(function(_0x2b332f,_0x51de0f){return db[_0x9a97('0x17')][_0x9a97('0x18')]({'raw':_0x155776[_0x9a97('0x19')]?_0x155776[_0x9a97('0x19')][_0x9a97('0x1a')]===undefined?!![]:![]:!![],'where':_0x155776['options']?_0x155776[_0x9a97('0x19')][_0x9a97('0x1b')]||null:null,'attributes':_0x155776[_0x9a97('0x19')]?_0x155776[_0x9a97('0x19')]['attributes']||null:null,'limit':_0x155776[_0x9a97('0x19')]?_0x155776['options'][_0x9a97('0x1c')]||null:null,'include':_0x155776[_0x9a97('0x19')]?_0x155776[_0x9a97('0x19')][_0x9a97('0x1d')]?_[_0x9a97('0x1e')](_0x155776[_0x9a97('0x19')][_0x9a97('0x1d')],function(_0xac5c42){return{'model':db[_0xac5c42['model']],'as':_0xac5c42['as'],'attributes':_0xac5c42[_0x9a97('0x1f')],'include':_0xac5c42['include']?_['map'](_0xac5c42[_0x9a97('0x1d')],function(_0x545b73){return{'model':db[_0x545b73[_0x9a97('0x20')]],'as':_0x545b73['as'],'attributes':_0x545b73['attributes'],'include':_0x545b73[_0x9a97('0x1d')]?_[_0x9a97('0x1e')](_0x545b73[_0x9a97('0x1d')],function(_0x49d58f){return{'model':db[_0x49d58f[_0x9a97('0x20')]],'as':_0x49d58f['as'],'attributes':_0x49d58f[_0x9a97('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9a97('0xd')](function(_0x53d976){logger[_0x9a97('0x15')](_0x9a97('0x21'),_0x155776);logger[_0x9a97('0xf')](_0x9a97('0x21'),_0x155776,JSON['stringify'](_0x53d976));_0x2b332f(_0x53d976);})['catch'](function(_0x4d72b4){logger[_0x9a97('0x12')]('GetFreshdeskAccount',_0x4d72b4[_0x9a97('0x14')],_0x155776);_0x51de0f(_0x333636[_0x9a97('0x12')](0x1f4,_0x4d72b4[_0x9a97('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x3275a4){var _0x499802=this;return new Promise(function(_0x547162,_0x5986d2){return db['FreshdeskAccount']['find']({'raw':_0x3275a4['options']?_0x3275a4[_0x9a97('0x19')][_0x9a97('0x1a')]===undefined?!![]:![]:!![],'where':_0x3275a4['options']?_0x3275a4['options'][_0x9a97('0x1b')]||null:null,'attributes':_0x3275a4[_0x9a97('0x19')]?_0x3275a4[_0x9a97('0x19')][_0x9a97('0x1f')]||null:null,'include':_0x3275a4['options']?_0x3275a4[_0x9a97('0x19')]['include']?_[_0x9a97('0x1e')](_0x3275a4[_0x9a97('0x19')][_0x9a97('0x1d')],function(_0x27bdda){return{'model':db[_0x27bdda['model']],'as':_0x27bdda['as'],'attributes':_0x27bdda[_0x9a97('0x1f')],'include':_0x27bdda[_0x9a97('0x1d')]?_[_0x9a97('0x1e')](_0x27bdda[_0x9a97('0x1d')],function(_0x5c4e7c){return{'model':db[_0x5c4e7c[_0x9a97('0x20')]],'as':_0x5c4e7c['as'],'attributes':_0x5c4e7c[_0x9a97('0x1f')],'include':_0x5c4e7c[_0x9a97('0x1d')]?_[_0x9a97('0x1e')](_0x5c4e7c['include'],function(_0x542bb8){return{'model':db[_0x542bb8['model']],'as':_0x542bb8['as'],'attributes':_0x542bb8[_0x9a97('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9a97('0xd')](function(_0x1018d1){logger[_0x9a97('0x15')](_0x9a97('0x22'),_0x3275a4);logger['debug'](_0x9a97('0x22'),_0x3275a4,JSON[_0x9a97('0x11')](_0x1018d1));_0x547162(_0x1018d1);})['catch'](function(_0x3d5dcd){logger['error'](_0x9a97('0x22'),_0x3d5dcd['message'],_0x3275a4);_0x5986d2(_0x499802[_0x9a97('0x12')](0x1f4,_0x3d5dcd['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6704912..d9cf8c8 100644 --- a/server/api/intFreshdeskConfiguration/index.js +++ b/server/api/intFreshdeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc62=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x10868c,_0x233186){var _0x52c181=function(_0x5c15f1){while(--_0x5c15f1){_0x10868c['push'](_0x10868c['shift']());}};_0x52c181(++_0x233186);}(_0xcc62,0x182));var _0x2cc6=function(_0x4b3bb5,_0x564489){_0x4b3bb5=_0x4b3bb5-0x0;var _0x57f246=_0xcc62[_0x4b3bb5];return _0x57f246;};'use strict';var multer=require(_0x2cc6('0x0'));var util=require(_0x2cc6('0x1'));var path=require(_0x2cc6('0x2'));var timeout=require(_0x2cc6('0x3'));var express=require(_0x2cc6('0x4'));var router=express[_0x2cc6('0x5')]();var fs_extra=require(_0x2cc6('0x6'));var auth=require(_0x2cc6('0x7'));var interaction=require(_0x2cc6('0x8'));var config=require(_0x2cc6('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x2cc6('0xa')]('/',auth[_0x2cc6('0xb')](),controller[_0x2cc6('0xc')]);router[_0x2cc6('0xa')](_0x2cc6('0xd'),auth[_0x2cc6('0xb')](),controller[_0x2cc6('0xe')]);router[_0x2cc6('0xa')](_0x2cc6('0xf'),auth[_0x2cc6('0xb')](),controller['getFields']);router['get'](_0x2cc6('0x10'),auth[_0x2cc6('0xb')](),controller[_0x2cc6('0x11')]);router[_0x2cc6('0xa')](_0x2cc6('0x12'),auth[_0x2cc6('0xb')](),controller[_0x2cc6('0x13')]);router['get'](_0x2cc6('0x14'),auth[_0x2cc6('0xb')](),controller['getTags']);router['post']('/',auth[_0x2cc6('0xb')](),controller['create']);router[_0x2cc6('0x15')](_0x2cc6('0x14'),auth[_0x2cc6('0xb')](),controller[_0x2cc6('0x16')]);router[_0x2cc6('0x17')](_0x2cc6('0xd'),auth['isAuthenticated'](),controller[_0x2cc6('0x18')]);router[_0x2cc6('0x19')](_0x2cc6('0xd'),auth[_0x2cc6('0xb')](),controller[_0x2cc6('0x1a')]);module[_0x2cc6('0x1b')]=router; \ No newline at end of file +var _0x5775=['create','setTags','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x5112ce,_0x23a09f){var _0x5bcefa=function(_0xb8af76){while(--_0xb8af76){_0x5112ce['push'](_0x5112ce['shift']());}};_0x5bcefa(++_0x23a09f);}(_0x5775,0x1ca));var _0x5577=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x5775[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0x5577('0x0'));var util=require('util');var path=require(_0x5577('0x1'));var timeout=require(_0x5577('0x2'));var express=require(_0x5577('0x3'));var router=express[_0x5577('0x4')]();var fs_extra=require(_0x5577('0x5'));var auth=require(_0x5577('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5577('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x5577('0x8')](),controller['index']);router[_0x5577('0x9')]('/:id',auth[_0x5577('0x8')](),controller[_0x5577('0xa')]);router['get']('/:id/fields',auth[_0x5577('0x8')](),controller[_0x5577('0xb')]);router[_0x5577('0x9')](_0x5577('0xc'),auth['isAuthenticated'](),controller[_0x5577('0xd')]);router[_0x5577('0x9')](_0x5577('0xe'),auth[_0x5577('0x8')](),controller[_0x5577('0xf')]);router[_0x5577('0x9')](_0x5577('0x10'),auth[_0x5577('0x8')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x5577('0x11')]);router['post'](_0x5577('0x10'),auth[_0x5577('0x8')](),controller[_0x5577('0x12')]);router[_0x5577('0x13')](_0x5577('0x14'),auth[_0x5577('0x8')](),controller[_0x5577('0x15')]);router[_0x5577('0x16')](_0x5577('0x14'),auth['isAuthenticated'](),controller[_0x5577('0x17')]);module[_0x5577('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 5c4b901..c9f512f 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1714=['exports','STRING','sequelize'];(function(_0x6b2d0a,_0x47dbc4){var _0x353fe9=function(_0x1183b2){while(--_0x1183b2){_0x6b2d0a['push'](_0x6b2d0a['shift']());}};_0x353fe9(++_0x47dbc4);}(_0x1714,0x13d));var _0x4171=function(_0x1016b0,_0x1178f7){_0x1016b0=_0x1016b0-0x0;var _0x22ba62=_0x1714[_0x1016b0];return _0x22ba62;};'use strict';var Sequelize=require(_0x4171('0x0'));module[_0x4171('0x1')]={'name':{'type':Sequelize[_0x4171('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7fe5=['sequelize','exports','STRING'];(function(_0x2ef034,_0x56e882){var _0x2e461e=function(_0x1f4233){while(--_0x1f4233){_0x2ef034['push'](_0x2ef034['shift']());}};_0x2e461e(++_0x56e882);}(_0x7fe5,0x8d));var _0x57fe=function(_0x3ca349,_0x203ed0){_0x3ca349=_0x3ca349-0x0;var _0xeac360=_0x7fe5[_0x3ca349];return _0xeac360;};'use strict';var Sequelize=require(_0x57fe('0x0'));module[_0x57fe('0x1')]={'name':{'type':Sequelize[_0x57fe('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f8539a2..cdc338e 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x416d=['setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','VIRTUAL','merge','options','where','include','findAll','rows','catch','keys','intersection','includeAll','find','create','body','params','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag'];(function(_0x2993e4,_0x2af2db){var _0x4167b5=function(_0x2150a5){while(--_0x2150a5){_0x2993e4['push'](_0x2993e4['shift']());}};_0x4167b5(++_0x2af2db);}(_0x416d,0x1ba));var _0xd416=function(_0x2074b3,_0x54589c){_0x2074b3=_0x2074b3-0x0;var _0x3529e7=_0x416d[_0x2074b3];return _0x3529e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd416('0x0'));var zipdir=require(_0xd416('0x1'));var jsonpatch=require(_0xd416('0x2'));var rp=require(_0xd416('0x3'));var moment=require(_0xd416('0x4'));var BPromise=require(_0xd416('0x5'));var Mustache=require(_0xd416('0x6'));var util=require(_0xd416('0x7'));var path=require(_0xd416('0x8'));var sox=require(_0xd416('0x9'));var csv=require(_0xd416('0xa'));var ejs=require(_0xd416('0xb'));var fs=require('fs');var fs_extra=require(_0xd416('0xc'));var _=require(_0xd416('0xd'));var squel=require(_0xd416('0xe'));var crypto=require(_0xd416('0xf'));var jsforce=require(_0xd416('0x10'));var deskjs=require(_0xd416('0x11'));var toCsv=require(_0xd416('0xa'));var querystring=require(_0xd416('0x12'));var Papa=require(_0xd416('0x13'));var Redis=require(_0xd416('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd416('0x15'));var as=require(_0xd416('0x16'));var hardwareService=require(_0xd416('0x17'));var logger=require(_0xd416('0x18'))(_0xd416('0x19'));var utils=require(_0xd416('0x1a'));var config=require(_0xd416('0x1b'));var licenseUtil=require(_0xd416('0x1c'));var db=require(_0xd416('0x1d'))['db'];function respondWithStatusCode(_0x49ad6e,_0x25c317){_0x25c317=_0x25c317||0xcc;return function(_0x1ee783){if(_0x1ee783){return _0x49ad6e['sendStatus'](_0x25c317);}return _0x49ad6e[_0xd416('0x1e')](_0x25c317)[_0xd416('0x1f')]();};}function respondWithResult(_0x6e2c16,_0x54f51b){_0x54f51b=_0x54f51b||0xc8;return function(_0x167ee0){if(_0x167ee0){return _0x6e2c16['status'](_0x54f51b)[_0xd416('0x20')](_0x167ee0);}};}function respondWithFilteredResult(_0x270841,_0x41fe93){return function(_0x2c1d1f){if(_0x2c1d1f){var _0x18ca75=typeof _0x41fe93[_0xd416('0x21')]===_0xd416('0x22')&&typeof _0x41fe93[_0xd416('0x23')]===_0xd416('0x22');var _0x34b8d1=_0x2c1d1f[_0xd416('0x24')];var _0x207f3d=_0x18ca75?0x0:_0x41fe93[_0xd416('0x21')];var _0x1639f2=_0x18ca75?_0x2c1d1f[_0xd416('0x24')]:_0x41fe93[_0xd416('0x21')]+_0x41fe93[_0xd416('0x23')];var _0x42c487;if(_0x1639f2>=_0x34b8d1){_0x1639f2=_0x34b8d1;_0x42c487=0xc8;}else{_0x42c487=0xce;}_0x270841['status'](_0x42c487);return _0x270841[_0xd416('0x25')](_0xd416('0x26'),_0x207f3d+'-'+_0x1639f2+'/'+_0x34b8d1)['json'](_0x2c1d1f);}return null;};}function patchUpdates(_0x367ce9){return function(_0x38eb5d){try{jsonpatch['apply'](_0x38eb5d,_0x367ce9,!![]);}catch(_0x29120f){return BPromise[_0xd416('0x27')](_0x29120f);}return _0x38eb5d['save']();};}function saveUpdates(_0x277246,_0x3c15a2){return function(_0x96f13){if(_0x96f13){return _0x96f13[_0xd416('0x28')](_0x277246)[_0xd416('0x29')](function(_0x3d640b){return _0x3d640b;});}return null;};}function removeEntity(_0x92950,_0x2290ff){return function(_0x27d6ca){if(_0x27d6ca){return _0x27d6ca['destroy']()['then'](function(){_0x92950[_0xd416('0x1e')](0xcc)[_0xd416('0x1f')]();});}};}function handleEntityNotFound(_0x3cc3e1,_0x31f6a7){return function(_0x59167a){if(!_0x59167a){_0x3cc3e1[_0xd416('0x2a')](0x194);}return _0x59167a;};}function handleError(_0x8f276a,_0x461916){_0x461916=_0x461916||0x1f4;return function(_0xb6d17){logger[_0xd416('0x2b')](_0xb6d17[_0xd416('0x2c')]);if(_0xb6d17['name']){delete _0xb6d17[_0xd416('0x2d')];}_0x8f276a['status'](_0x461916)[_0xd416('0x2e')](_0xb6d17);};}exports['index']=function(_0x51371b,_0x570dee){var _0x1e9d07={},_0x2ce155={},_0x4e536f={'count':0x0,'rows':[]};var _0x2405c3=_[_0xd416('0x2f')](db[_0xd416('0x30')][_0xd416('0x31')],function(_0x2ea502){return{'name':_0x2ea502[_0xd416('0x32')],'type':_0x2ea502['type']['key']};});_0x2ce155[_0xd416('0x33')]=_[_0xd416('0x2f')](_0x2405c3,_0xd416('0x2d'));_0x2ce155[_0xd416('0x34')]=_['keys'](_0x51371b['query']);_0x2ce155['filters']=_['intersection'](_0x2ce155[_0xd416('0x33')],_0x2ce155[_0xd416('0x34')]);_0x1e9d07[_0xd416('0x35')]=_['intersection'](_0x2ce155[_0xd416('0x33')],qs['fields'](_0x51371b['query'][_0xd416('0x36')]));_0x1e9d07['attributes']=_0x1e9d07[_0xd416('0x35')][_0xd416('0x37')]?_0x1e9d07[_0xd416('0x35')]:_0x2ce155[_0xd416('0x33')];if(!_0x51371b[_0xd416('0x34')][_0xd416('0x38')](_0xd416('0x39'))){_0x1e9d07[_0xd416('0x23')]=qs['limit'](_0x51371b[_0xd416('0x34')][_0xd416('0x23')]);_0x1e9d07[_0xd416('0x21')]=qs[_0xd416('0x21')](_0x51371b[_0xd416('0x34')]['offset']);}_0x1e9d07[_0xd416('0x3a')]=qs[_0xd416('0x3b')](_0x51371b[_0xd416('0x34')]['sort']);_0x1e9d07['where']=qs['filters'](_[_0xd416('0x3c')](_0x51371b[_0xd416('0x34')],_0x2ce155[_0xd416('0x3d')]),_0x2405c3);if(_0x51371b['query'][_0xd416('0x3e')]){_0x1e9d07['where']=_['merge'](_0x1e9d07['where'],{'$or':_[_0xd416('0x2f')](_0x2405c3,function(_0x4a4431){if(_0x4a4431['type']!==_0xd416('0x3f')){var _0x2940bf={};_0x2940bf[_0x4a4431[_0xd416('0x2d')]]={'$like':'%'+_0x51371b[_0xd416('0x34')][_0xd416('0x3e')]+'%'};return _0x2940bf;}})});}_0x1e9d07=_[_0xd416('0x40')]({},_0x1e9d07,_0x51371b[_0xd416('0x41')]);var _0x21d95c={'where':_0x1e9d07[_0xd416('0x42')]};return db[_0xd416('0x30')]['count'](_0x21d95c)[_0xd416('0x29')](function(_0x28cd9f){_0x4e536f[_0xd416('0x24')]=_0x28cd9f;if(_0x51371b[_0xd416('0x34')]['includeAll']){_0x1e9d07[_0xd416('0x43')]=[{'all':!![]}];}return db[_0xd416('0x30')][_0xd416('0x44')](_0x1e9d07);})[_0xd416('0x29')](function(_0x528cba){_0x4e536f[_0xd416('0x45')]=_0x528cba;return _0x4e536f;})[_0xd416('0x29')](respondWithFilteredResult(_0x570dee,_0x1e9d07))[_0xd416('0x46')](handleError(_0x570dee,null));};exports['show']=function(_0x12c106,_0x1be202){var _0x4ffe37={'raw':![],'where':{'id':_0x12c106['params']['id']}},_0x5bd889={};_0x5bd889['model']=_['keys'](db[_0xd416('0x30')]['rawAttributes']);_0x5bd889[_0xd416('0x34')]=_[_0xd416('0x47')](_0x12c106[_0xd416('0x34')]);_0x5bd889[_0xd416('0x3d')]=_[_0xd416('0x48')](_0x5bd889['model'],_0x5bd889[_0xd416('0x34')]);_0x4ffe37['attributes']=_[_0xd416('0x48')](_0x5bd889[_0xd416('0x33')],qs['fields'](_0x12c106[_0xd416('0x34')][_0xd416('0x36')]));_0x4ffe37[_0xd416('0x35')]=_0x4ffe37['attributes']['length']?_0x4ffe37[_0xd416('0x35')]:_0x5bd889['model'];if(_0x12c106['query'][_0xd416('0x49')]){_0x4ffe37[_0xd416('0x43')]=[{'all':!![]}];}_0x4ffe37=_[_0xd416('0x40')]({},_0x4ffe37,_0x12c106['options']);return db[_0xd416('0x30')][_0xd416('0x4a')](_0x4ffe37)[_0xd416('0x29')](handleEntityNotFound(_0x1be202,null))[_0xd416('0x29')](respondWithResult(_0x1be202,null))[_0xd416('0x46')](handleError(_0x1be202,null));};exports['create']=function(_0x94835b,_0x22fa75){return db['FreshdeskConfiguration'][_0xd416('0x4b')](_0x94835b[_0xd416('0x4c')],{})[_0xd416('0x29')](respondWithResult(_0x22fa75,0xc9))[_0xd416('0x46')](handleError(_0x22fa75,null));};exports['update']=function(_0x5a293f,_0x1865c9){if(_0x5a293f['body']['id']){delete _0x5a293f['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x5a293f[_0xd416('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1865c9,null))[_0xd416('0x29')](saveUpdates(_0x5a293f[_0xd416('0x4c')],null))[_0xd416('0x29')](respondWithResult(_0x1865c9,null))[_0xd416('0x46')](handleError(_0x1865c9,null));};exports[_0xd416('0x4e')]=function(_0x519d43,_0x498fb6){return db[_0xd416('0x30')][_0xd416('0x4a')]({'where':{'id':_0x519d43[_0xd416('0x4d')]['id']}})[_0xd416('0x29')](handleEntityNotFound(_0x498fb6,null))[_0xd416('0x29')](removeEntity(_0x498fb6,null))[_0xd416('0x46')](handleError(_0x498fb6,null));};exports[_0xd416('0x4f')]=function(_0x35557b,_0xb17a23,_0x5c5e21){var _0x40b722={};var _0x32ee9f={};var _0x515050;var _0x592a5e;return db['FreshdeskConfiguration'][_0xd416('0x50')]({'where':{'id':_0x35557b[_0xd416('0x4d')]['id']}})[_0xd416('0x29')](handleEntityNotFound(_0xb17a23,null))[_0xd416('0x29')](function(_0x158e86){if(_0x158e86){_0x515050=_0x158e86;_0x32ee9f['model']=_['keys'](db[_0xd416('0x51')][_0xd416('0x31')]);_0x32ee9f[_0xd416('0x34')]=_[_0xd416('0x47')](_0x35557b['query']);_0x32ee9f[_0xd416('0x3d')]=_[_0xd416('0x48')](_0x32ee9f[_0xd416('0x33')],_0x32ee9f[_0xd416('0x34')]);_0x40b722[_0xd416('0x35')]=_[_0xd416('0x48')](_0x32ee9f[_0xd416('0x33')],qs[_0xd416('0x36')](_0x35557b[_0xd416('0x34')][_0xd416('0x36')]));_0x40b722[_0xd416('0x35')]=_0x40b722[_0xd416('0x35')][_0xd416('0x37')]?_0x40b722[_0xd416('0x35')]:_0x32ee9f[_0xd416('0x33')];_0x40b722[_0xd416('0x3a')]=qs['sort'](_0x35557b[_0xd416('0x34')]['sort']);_0x40b722['where']=qs[_0xd416('0x3d')](_['pick'](_0x35557b['query'],_0x32ee9f[_0xd416('0x3d')]));if(_0x35557b[_0xd416('0x34')][_0xd416('0x3e')]){_0x40b722[_0xd416('0x42')]=_[_0xd416('0x40')](_0x40b722[_0xd416('0x42')],{'$or':_[_0xd416('0x2f')](_0x40b722[_0xd416('0x35')],function(_0xaa1846){var _0xfe5e7a={};_0xfe5e7a[_0xaa1846]={'$like':'%'+_0x35557b[_0xd416('0x34')]['filter']+'%'};return _0xfe5e7a;})});}_0x40b722=_[_0xd416('0x40')]({},_0x40b722,_0x35557b[_0xd416('0x41')]);return _0x515050[_0xd416('0x4f')](_0x40b722);}})[_0xd416('0x29')](function(_0x4bc17c){if(_0x4bc17c){_0x592a5e=_0x4bc17c[_0xd416('0x37')];if(!_0x35557b[_0xd416('0x34')][_0xd416('0x38')](_0xd416('0x39'))){_0x40b722['limit']=qs[_0xd416('0x23')](_0x35557b[_0xd416('0x34')]['limit']);_0x40b722[_0xd416('0x21')]=qs['offset'](_0x35557b['query']['offset']);}return _0x515050[_0xd416('0x4f')](_0x40b722);}})['then'](function(_0x4007fc){if(_0x4007fc){return _0x4007fc?{'count':_0x592a5e,'rows':_0x4007fc}:null;}})[_0xd416('0x29')](respondWithResult(_0xb17a23,null))[_0xd416('0x46')](handleError(_0xb17a23,null));};exports[_0xd416('0x52')]=function(_0x15013b,_0x5815ae,_0x2a8ae9){var _0x335792={};var _0x40e010={};var _0x23a1ff;var _0x42d961;return db[_0xd416('0x30')][_0xd416('0x50')]({'where':{'id':_0x15013b[_0xd416('0x4d')]['id']}})[_0xd416('0x29')](handleEntityNotFound(_0x5815ae,null))[_0xd416('0x29')](function(_0x1ada4e){if(_0x1ada4e){_0x23a1ff=_0x1ada4e;_0x40e010['model']=_[_0xd416('0x47')](db['FreshdeskField'][_0xd416('0x31')]);_0x40e010[_0xd416('0x34')]=_[_0xd416('0x47')](_0x15013b['query']);_0x40e010['filters']=_['intersection'](_0x40e010[_0xd416('0x33')],_0x40e010[_0xd416('0x34')]);_0x335792[_0xd416('0x35')]=_[_0xd416('0x48')](_0x40e010[_0xd416('0x33')],qs[_0xd416('0x36')](_0x15013b[_0xd416('0x34')][_0xd416('0x36')]));_0x335792['attributes']=_0x335792[_0xd416('0x35')][_0xd416('0x37')]?_0x335792['attributes']:_0x40e010[_0xd416('0x33')];_0x335792[_0xd416('0x3a')]=qs[_0xd416('0x3b')](_0x15013b[_0xd416('0x34')][_0xd416('0x3b')]);_0x335792[_0xd416('0x42')]=qs[_0xd416('0x3d')](_['pick'](_0x15013b[_0xd416('0x34')],_0x40e010[_0xd416('0x3d')]));if(_0x15013b[_0xd416('0x34')][_0xd416('0x3e')]){_0x335792['where']=_['merge'](_0x335792[_0xd416('0x42')],{'$or':_[_0xd416('0x2f')](_0x335792['attributes'],function(_0x563fdd){var _0x3bf10b={};_0x3bf10b[_0x563fdd]={'$like':'%'+_0x15013b[_0xd416('0x34')][_0xd416('0x3e')]+'%'};return _0x3bf10b;})});}_0x335792=_[_0xd416('0x40')]({},_0x335792,_0x15013b['options']);return _0x23a1ff[_0xd416('0x52')](_0x335792);}})[_0xd416('0x29')](function(_0x1144b3){if(_0x1144b3){_0x42d961=_0x1144b3[_0xd416('0x37')];if(!_0x15013b[_0xd416('0x34')][_0xd416('0x38')]('nolimit')){_0x335792[_0xd416('0x23')]=qs[_0xd416('0x23')](_0x15013b['query'][_0xd416('0x23')]);_0x335792[_0xd416('0x21')]=qs[_0xd416('0x21')](_0x15013b['query'][_0xd416('0x21')]);}return _0x23a1ff['getSubjects'](_0x335792);}})[_0xd416('0x29')](function(_0x44a9ab){if(_0x44a9ab){return _0x44a9ab?{'count':_0x42d961,'rows':_0x44a9ab}:null;}})[_0xd416('0x29')](respondWithResult(_0x5815ae,null))[_0xd416('0x46')](handleError(_0x5815ae,null));};exports['getDescriptions']=function(_0x497531,_0x38ab55,_0x554718){var _0x25b78f={};var _0x272dc5={};var _0x5a9fa5;var _0x454a37;return db[_0xd416('0x30')]['findOne']({'where':{'id':_0x497531[_0xd416('0x4d')]['id']}})[_0xd416('0x29')](handleEntityNotFound(_0x38ab55,null))['then'](function(_0x4c2bbc){if(_0x4c2bbc){_0x5a9fa5=_0x4c2bbc;_0x272dc5['model']=_[_0xd416('0x47')](db[_0xd416('0x51')][_0xd416('0x31')]);_0x272dc5[_0xd416('0x34')]=_[_0xd416('0x47')](_0x497531[_0xd416('0x34')]);_0x272dc5[_0xd416('0x3d')]=_[_0xd416('0x48')](_0x272dc5[_0xd416('0x33')],_0x272dc5[_0xd416('0x34')]);_0x25b78f[_0xd416('0x35')]=_[_0xd416('0x48')](_0x272dc5['model'],qs[_0xd416('0x36')](_0x497531[_0xd416('0x34')]['fields']));_0x25b78f['attributes']=_0x25b78f['attributes'][_0xd416('0x37')]?_0x25b78f['attributes']:_0x272dc5[_0xd416('0x33')];_0x25b78f[_0xd416('0x3a')]=qs['sort'](_0x497531[_0xd416('0x34')][_0xd416('0x3b')]);_0x25b78f['where']=qs[_0xd416('0x3d')](_['pick'](_0x497531[_0xd416('0x34')],_0x272dc5[_0xd416('0x3d')]));if(_0x497531[_0xd416('0x34')]['filter']){_0x25b78f[_0xd416('0x42')]=_[_0xd416('0x40')](_0x25b78f[_0xd416('0x42')],{'$or':_['map'](_0x25b78f[_0xd416('0x35')],function(_0x265063){var _0xf2b757={};_0xf2b757[_0x265063]={'$like':'%'+_0x497531[_0xd416('0x34')]['filter']+'%'};return _0xf2b757;})});}_0x25b78f=_['merge']({},_0x25b78f,_0x497531['options']);return _0x5a9fa5[_0xd416('0x53')](_0x25b78f);}})['then'](function(_0x1af83f){if(_0x1af83f){_0x454a37=_0x1af83f[_0xd416('0x37')];if(!_0x497531[_0xd416('0x34')][_0xd416('0x38')](_0xd416('0x39'))){_0x25b78f[_0xd416('0x23')]=qs[_0xd416('0x23')](_0x497531[_0xd416('0x34')][_0xd416('0x23')]);_0x25b78f[_0xd416('0x21')]=qs[_0xd416('0x21')](_0x497531['query']['offset']);}return _0x5a9fa5[_0xd416('0x53')](_0x25b78f);}})[_0xd416('0x29')](function(_0x344f14){if(_0x344f14){return _0x344f14?{'count':_0x454a37,'rows':_0x344f14}:null;}})[_0xd416('0x29')](respondWithResult(_0x38ab55,null))[_0xd416('0x46')](handleError(_0x38ab55,null));};exports[_0xd416('0x54')]=function(_0x1772f9,_0x43e240,_0x14f6f9){var _0x192c7f={};var _0x1394cb={};var _0x31e2dd;var _0x4dff3d;return db[_0xd416('0x30')][_0xd416('0x50')]({'where':{'id':_0x1772f9[_0xd416('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43e240,null))[_0xd416('0x29')](function(_0x4d84da){if(_0x4d84da){_0x31e2dd=_0x4d84da;_0x1394cb[_0xd416('0x33')]=_['keys'](db[_0xd416('0x55')][_0xd416('0x31')]);_0x1394cb[_0xd416('0x34')]=_['keys'](_0x1772f9[_0xd416('0x34')]);_0x1394cb[_0xd416('0x3d')]=_['intersection'](_0x1394cb['model'],_0x1394cb[_0xd416('0x34')]);_0x192c7f['attributes']=_['intersection'](_0x1394cb['model'],qs[_0xd416('0x36')](_0x1772f9['query']['fields']));_0x192c7f[_0xd416('0x35')]=_0x192c7f[_0xd416('0x35')][_0xd416('0x37')]?_0x192c7f['attributes']:_0x1394cb[_0xd416('0x33')];_0x192c7f[_0xd416('0x3a')]=qs[_0xd416('0x3b')](_0x1772f9[_0xd416('0x34')][_0xd416('0x3b')]);_0x192c7f[_0xd416('0x42')]=qs[_0xd416('0x3d')](_[_0xd416('0x3c')](_0x1772f9[_0xd416('0x34')],_0x1394cb[_0xd416('0x3d')]));if(_0x1772f9[_0xd416('0x34')][_0xd416('0x3e')]){_0x192c7f[_0xd416('0x42')]=_['merge'](_0x192c7f['where'],{'$or':_[_0xd416('0x2f')](_0x192c7f[_0xd416('0x35')],function(_0xed2ccb){var _0x4c6dae={};_0x4c6dae[_0xed2ccb]={'$like':'%'+_0x1772f9['query'][_0xd416('0x3e')]+'%'};return _0x4c6dae;})});}_0x192c7f=_['merge']({},_0x192c7f,_0x1772f9[_0xd416('0x41')]);return _0x31e2dd[_0xd416('0x54')](_0x192c7f);}})['then'](function(_0x510cce){if(_0x510cce){_0x4dff3d=_0x510cce[_0xd416('0x37')];if(!_0x1772f9['query'][_0xd416('0x38')](_0xd416('0x39'))){_0x192c7f[_0xd416('0x23')]=qs[_0xd416('0x23')](_0x1772f9['query'][_0xd416('0x23')]);_0x192c7f[_0xd416('0x21')]=qs['offset'](_0x1772f9['query'][_0xd416('0x21')]);}return _0x31e2dd['getTags'](_0x192c7f);}})[_0xd416('0x29')](function(_0x4af162){if(_0x4af162){return _0x4af162?{'count':_0x4dff3d,'rows':_0x4af162}:null;}})[_0xd416('0x29')](respondWithResult(_0x43e240,null))[_0xd416('0x46')](handleError(_0x43e240,null));};exports[_0xd416('0x56')]=function(_0x13711f,_0x1ff61d,_0xa3ed5){if(_0x13711f[_0xd416('0x4c')]['id']){delete _0x13711f['body']['id'];}return db[_0xd416('0x30')][_0xd416('0x50')]({'where':{'id':_0x13711f[_0xd416('0x4d')]['id']}})[_0xd416('0x29')](handleEntityNotFound(_0x1ff61d,null))[_0xd416('0x29')](function(_0x125a1a){if(_0x125a1a){return _0x125a1a[_0xd416('0x56')](_0x13711f['body'][_0xd416('0x57')]||[]);}return null;})[_0xd416('0x29')](respondWithResult(_0x1ff61d,null))['catch'](handleError(_0x1ff61d,null));}; \ No newline at end of file +var _0x4fd7=['query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','include','findAll','rows','params','intersection','length','merge','create','body','catch','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','keys'];(function(_0x447c3d,_0x584b8f){var _0x4664f0=function(_0xd2628b){while(--_0xd2628b){_0x447c3d['push'](_0x447c3d['shift']());}};_0x4664f0(++_0x584b8f);}(_0x4fd7,0x159));var _0x74fd=function(_0x403e1a,_0x3d0c05){_0x403e1a=_0x403e1a-0x0;var _0x3695df=_0x4fd7[_0x403e1a];return _0x3695df;};'use strict';var emlformat=require(_0x74fd('0x0'));var rimraf=require(_0x74fd('0x1'));var zipdir=require(_0x74fd('0x2'));var jsonpatch=require(_0x74fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x74fd('0x4'));var util=require(_0x74fd('0x5'));var path=require('path');var sox=require(_0x74fd('0x6'));var csv=require(_0x74fd('0x7'));var ejs=require(_0x74fd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x74fd('0x9'));var jsforce=require(_0x74fd('0xa'));var deskjs=require(_0x74fd('0xb'));var toCsv=require(_0x74fd('0x7'));var querystring=require(_0x74fd('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x74fd('0xd'));var hardwareService=require(_0x74fd('0xe'));var logger=require(_0x74fd('0xf'))(_0x74fd('0x10'));var utils=require(_0x74fd('0x11'));var config=require(_0x74fd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x74fd('0x13'))['db'];function respondWithStatusCode(_0x34f2cd,_0x12254a){_0x12254a=_0x12254a||0xcc;return function(_0x3ef638){if(_0x3ef638){return _0x34f2cd[_0x74fd('0x14')](_0x12254a);}return _0x34f2cd[_0x74fd('0x15')](_0x12254a)[_0x74fd('0x16')]();};}function respondWithResult(_0x2079ac,_0x3a5f7e){_0x3a5f7e=_0x3a5f7e||0xc8;return function(_0x1e78c2){if(_0x1e78c2){return _0x2079ac[_0x74fd('0x15')](_0x3a5f7e)['json'](_0x1e78c2);}};}function respondWithFilteredResult(_0x52bd69,_0x387de1){return function(_0x193ae2){if(_0x193ae2){var _0x2b1dee=typeof _0x387de1[_0x74fd('0x17')]===_0x74fd('0x18')&&typeof _0x387de1[_0x74fd('0x19')]===_0x74fd('0x18');var _0x3e8f1a=_0x193ae2[_0x74fd('0x1a')];var _0x162b89=_0x2b1dee?0x0:_0x387de1[_0x74fd('0x17')];var _0x1dd452=_0x2b1dee?_0x193ae2[_0x74fd('0x1a')]:_0x387de1[_0x74fd('0x17')]+_0x387de1[_0x74fd('0x19')];var _0x21d43d;if(_0x1dd452>=_0x3e8f1a){_0x1dd452=_0x3e8f1a;_0x21d43d=0xc8;}else{_0x21d43d=0xce;}_0x52bd69[_0x74fd('0x15')](_0x21d43d);return _0x52bd69[_0x74fd('0x1b')]('Content-Range',_0x162b89+'-'+_0x1dd452+'/'+_0x3e8f1a)[_0x74fd('0x1c')](_0x193ae2);}return null;};}function patchUpdates(_0x31684f){return function(_0x3c2633){try{jsonpatch[_0x74fd('0x1d')](_0x3c2633,_0x31684f,!![]);}catch(_0x75fea6){return BPromise[_0x74fd('0x1e')](_0x75fea6);}return _0x3c2633['save']();};}function saveUpdates(_0x310fb4,_0x48792a){return function(_0x5579f8){if(_0x5579f8){return _0x5579f8['update'](_0x310fb4)[_0x74fd('0x1f')](function(_0x353db0){return _0x353db0;});}return null;};}function removeEntity(_0x1c2236,_0x37f905){return function(_0x2fb419){if(_0x2fb419){return _0x2fb419[_0x74fd('0x20')]()[_0x74fd('0x1f')](function(){_0x1c2236[_0x74fd('0x15')](0xcc)[_0x74fd('0x16')]();});}};}function handleEntityNotFound(_0x22458c,_0x26456f){return function(_0x4bd308){if(!_0x4bd308){_0x22458c['sendStatus'](0x194);}return _0x4bd308;};}function handleError(_0x154cbe,_0x4107af){_0x4107af=_0x4107af||0x1f4;return function(_0x5126d7){logger[_0x74fd('0x21')](_0x5126d7[_0x74fd('0x22')]);if(_0x5126d7[_0x74fd('0x23')]){delete _0x5126d7['name'];}_0x154cbe['status'](_0x4107af)[_0x74fd('0x24')](_0x5126d7);};}exports[_0x74fd('0x25')]=function(_0x3809a6,_0x2bc60f){var _0x29e55e={},_0x29200a={},_0x327adc={'count':0x0,'rows':[]};var _0x2d1769=_[_0x74fd('0x26')](db[_0x74fd('0x27')][_0x74fd('0x28')],function(_0x146741){return{'name':_0x146741['fieldName'],'type':_0x146741[_0x74fd('0x29')][_0x74fd('0x2a')]};});_0x29200a[_0x74fd('0x2b')]=_[_0x74fd('0x26')](_0x2d1769,_0x74fd('0x23'));_0x29200a['query']=_[_0x74fd('0x2c')](_0x3809a6[_0x74fd('0x2d')]);_0x29200a[_0x74fd('0x2e')]=_['intersection'](_0x29200a[_0x74fd('0x2b')],_0x29200a['query']);_0x29e55e[_0x74fd('0x2f')]=_['intersection'](_0x29200a[_0x74fd('0x2b')],qs[_0x74fd('0x30')](_0x3809a6['query']['fields']));_0x29e55e[_0x74fd('0x2f')]=_0x29e55e[_0x74fd('0x2f')]['length']?_0x29e55e[_0x74fd('0x2f')]:_0x29200a['model'];if(!_0x3809a6[_0x74fd('0x2d')][_0x74fd('0x31')](_0x74fd('0x32'))){_0x29e55e[_0x74fd('0x19')]=qs['limit'](_0x3809a6['query'][_0x74fd('0x19')]);_0x29e55e['offset']=qs[_0x74fd('0x17')](_0x3809a6[_0x74fd('0x2d')][_0x74fd('0x17')]);}_0x29e55e[_0x74fd('0x33')]=qs['sort'](_0x3809a6[_0x74fd('0x2d')][_0x74fd('0x34')]);_0x29e55e['where']=qs[_0x74fd('0x2e')](_[_0x74fd('0x35')](_0x3809a6[_0x74fd('0x2d')],_0x29200a[_0x74fd('0x2e')]),_0x2d1769);if(_0x3809a6[_0x74fd('0x2d')]['filter']){_0x29e55e[_0x74fd('0x36')]=_['merge'](_0x29e55e[_0x74fd('0x36')],{'$or':_[_0x74fd('0x26')](_0x2d1769,function(_0x145dab){if(_0x145dab[_0x74fd('0x29')]!=='VIRTUAL'){var _0x47547c={};_0x47547c[_0x145dab['name']]={'$like':'%'+_0x3809a6['query'][_0x74fd('0x37')]+'%'};return _0x47547c;}})});}_0x29e55e=_['merge']({},_0x29e55e,_0x3809a6[_0x74fd('0x38')]);var _0x388146={'where':_0x29e55e[_0x74fd('0x36')]};return db['FreshdeskConfiguration'][_0x74fd('0x1a')](_0x388146)[_0x74fd('0x1f')](function(_0x3117f0){_0x327adc[_0x74fd('0x1a')]=_0x3117f0;if(_0x3809a6[_0x74fd('0x2d')][_0x74fd('0x39')]){_0x29e55e[_0x74fd('0x3a')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x74fd('0x3b')](_0x29e55e);})[_0x74fd('0x1f')](function(_0x394a17){_0x327adc[_0x74fd('0x3c')]=_0x394a17;return _0x327adc;})[_0x74fd('0x1f')](respondWithFilteredResult(_0x2bc60f,_0x29e55e))['catch'](handleError(_0x2bc60f,null));};exports['show']=function(_0x410ee9,_0x1a0e1e){var _0x4ebdec={'raw':![],'where':{'id':_0x410ee9[_0x74fd('0x3d')]['id']}},_0x1a395d={};_0x1a395d['model']=_[_0x74fd('0x2c')](db[_0x74fd('0x27')]['rawAttributes']);_0x1a395d[_0x74fd('0x2d')]=_[_0x74fd('0x2c')](_0x410ee9[_0x74fd('0x2d')]);_0x1a395d[_0x74fd('0x2e')]=_[_0x74fd('0x3e')](_0x1a395d['model'],_0x1a395d[_0x74fd('0x2d')]);_0x4ebdec[_0x74fd('0x2f')]=_[_0x74fd('0x3e')](_0x1a395d[_0x74fd('0x2b')],qs[_0x74fd('0x30')](_0x410ee9[_0x74fd('0x2d')][_0x74fd('0x30')]));_0x4ebdec[_0x74fd('0x2f')]=_0x4ebdec[_0x74fd('0x2f')][_0x74fd('0x3f')]?_0x4ebdec[_0x74fd('0x2f')]:_0x1a395d['model'];if(_0x410ee9[_0x74fd('0x2d')][_0x74fd('0x39')]){_0x4ebdec['include']=[{'all':!![]}];}_0x4ebdec=_[_0x74fd('0x40')]({},_0x4ebdec,_0x410ee9[_0x74fd('0x38')]);return db['FreshdeskConfiguration']['find'](_0x4ebdec)[_0x74fd('0x1f')](handleEntityNotFound(_0x1a0e1e,null))[_0x74fd('0x1f')](respondWithResult(_0x1a0e1e,null))['catch'](handleError(_0x1a0e1e,null));};exports[_0x74fd('0x41')]=function(_0x50e355,_0x2da7dd){return db[_0x74fd('0x27')][_0x74fd('0x41')](_0x50e355[_0x74fd('0x42')],{})[_0x74fd('0x1f')](respondWithResult(_0x2da7dd,0xc9))[_0x74fd('0x43')](handleError(_0x2da7dd,null));};exports['update']=function(_0x57cdfa,_0xe69086){if(_0x57cdfa['body']['id']){delete _0x57cdfa[_0x74fd('0x42')]['id'];}return db[_0x74fd('0x27')][_0x74fd('0x44')]({'where':{'id':_0x57cdfa[_0x74fd('0x3d')]['id']}})['then'](handleEntityNotFound(_0xe69086,null))[_0x74fd('0x1f')](saveUpdates(_0x57cdfa['body'],null))['then'](respondWithResult(_0xe69086,null))[_0x74fd('0x43')](handleError(_0xe69086,null));};exports[_0x74fd('0x20')]=function(_0x5bdd8e,_0x2ff3d0){return db[_0x74fd('0x27')]['find']({'where':{'id':_0x5bdd8e[_0x74fd('0x3d')]['id']}})[_0x74fd('0x1f')](handleEntityNotFound(_0x2ff3d0,null))['then'](removeEntity(_0x2ff3d0,null))[_0x74fd('0x43')](handleError(_0x2ff3d0,null));};exports[_0x74fd('0x45')]=function(_0x1c0643,_0x53356a,_0x584be9){var _0x7647d8={};var _0x446bb7={};var _0x13b113;var _0x208054;return db[_0x74fd('0x27')][_0x74fd('0x46')]({'where':{'id':_0x1c0643[_0x74fd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x53356a,null))['then'](function(_0x1bcc90){if(_0x1bcc90){_0x13b113=_0x1bcc90;_0x446bb7[_0x74fd('0x2b')]=_[_0x74fd('0x2c')](db['FreshdeskField'][_0x74fd('0x28')]);_0x446bb7[_0x74fd('0x2d')]=_[_0x74fd('0x2c')](_0x1c0643[_0x74fd('0x2d')]);_0x446bb7[_0x74fd('0x2e')]=_[_0x74fd('0x3e')](_0x446bb7[_0x74fd('0x2b')],_0x446bb7[_0x74fd('0x2d')]);_0x7647d8['attributes']=_[_0x74fd('0x3e')](_0x446bb7[_0x74fd('0x2b')],qs['fields'](_0x1c0643['query'][_0x74fd('0x30')]));_0x7647d8[_0x74fd('0x2f')]=_0x7647d8[_0x74fd('0x2f')][_0x74fd('0x3f')]?_0x7647d8[_0x74fd('0x2f')]:_0x446bb7[_0x74fd('0x2b')];_0x7647d8[_0x74fd('0x33')]=qs[_0x74fd('0x34')](_0x1c0643[_0x74fd('0x2d')][_0x74fd('0x34')]);_0x7647d8[_0x74fd('0x36')]=qs[_0x74fd('0x2e')](_[_0x74fd('0x35')](_0x1c0643[_0x74fd('0x2d')],_0x446bb7[_0x74fd('0x2e')]));if(_0x1c0643['query'][_0x74fd('0x37')]){_0x7647d8[_0x74fd('0x36')]=_[_0x74fd('0x40')](_0x7647d8[_0x74fd('0x36')],{'$or':_[_0x74fd('0x26')](_0x7647d8[_0x74fd('0x2f')],function(_0x54e82a){var _0x2ef32c={};_0x2ef32c[_0x54e82a]={'$like':'%'+_0x1c0643[_0x74fd('0x2d')][_0x74fd('0x37')]+'%'};return _0x2ef32c;})});}_0x7647d8=_[_0x74fd('0x40')]({},_0x7647d8,_0x1c0643[_0x74fd('0x38')]);return _0x13b113[_0x74fd('0x45')](_0x7647d8);}})[_0x74fd('0x1f')](function(_0x475034){if(_0x475034){_0x208054=_0x475034[_0x74fd('0x3f')];if(!_0x1c0643[_0x74fd('0x2d')][_0x74fd('0x31')]('nolimit')){_0x7647d8[_0x74fd('0x19')]=qs[_0x74fd('0x19')](_0x1c0643[_0x74fd('0x2d')][_0x74fd('0x19')]);_0x7647d8[_0x74fd('0x17')]=qs[_0x74fd('0x17')](_0x1c0643[_0x74fd('0x2d')][_0x74fd('0x17')]);}return _0x13b113['getFields'](_0x7647d8);}})['then'](function(_0x3d6155){if(_0x3d6155){return _0x3d6155?{'count':_0x208054,'rows':_0x3d6155}:null;}})[_0x74fd('0x1f')](respondWithResult(_0x53356a,null))[_0x74fd('0x43')](handleError(_0x53356a,null));};exports['getSubjects']=function(_0x2c1caf,_0x30a8dd,_0xd8a149){var _0x40e132={};var _0x75d82f={};var _0x118d1b;var _0x502c41;return db['FreshdeskConfiguration'][_0x74fd('0x46')]({'where':{'id':_0x2c1caf[_0x74fd('0x3d')]['id']}})[_0x74fd('0x1f')](handleEntityNotFound(_0x30a8dd,null))[_0x74fd('0x1f')](function(_0x4ea0fd){if(_0x4ea0fd){_0x118d1b=_0x4ea0fd;_0x75d82f['model']=_[_0x74fd('0x2c')](db[_0x74fd('0x47')]['rawAttributes']);_0x75d82f[_0x74fd('0x2d')]=_[_0x74fd('0x2c')](_0x2c1caf[_0x74fd('0x2d')]);_0x75d82f[_0x74fd('0x2e')]=_['intersection'](_0x75d82f[_0x74fd('0x2b')],_0x75d82f['query']);_0x40e132[_0x74fd('0x2f')]=_[_0x74fd('0x3e')](_0x75d82f[_0x74fd('0x2b')],qs['fields'](_0x2c1caf[_0x74fd('0x2d')]['fields']));_0x40e132[_0x74fd('0x2f')]=_0x40e132[_0x74fd('0x2f')][_0x74fd('0x3f')]?_0x40e132['attributes']:_0x75d82f[_0x74fd('0x2b')];_0x40e132[_0x74fd('0x33')]=qs[_0x74fd('0x34')](_0x2c1caf[_0x74fd('0x2d')]['sort']);_0x40e132['where']=qs[_0x74fd('0x2e')](_[_0x74fd('0x35')](_0x2c1caf[_0x74fd('0x2d')],_0x75d82f['filters']));if(_0x2c1caf[_0x74fd('0x2d')]['filter']){_0x40e132[_0x74fd('0x36')]=_[_0x74fd('0x40')](_0x40e132[_0x74fd('0x36')],{'$or':_['map'](_0x40e132[_0x74fd('0x2f')],function(_0x298c01){var _0x9cec1e={};_0x9cec1e[_0x298c01]={'$like':'%'+_0x2c1caf[_0x74fd('0x2d')][_0x74fd('0x37')]+'%'};return _0x9cec1e;})});}_0x40e132=_['merge']({},_0x40e132,_0x2c1caf[_0x74fd('0x38')]);return _0x118d1b['getSubjects'](_0x40e132);}})[_0x74fd('0x1f')](function(_0x441b33){if(_0x441b33){_0x502c41=_0x441b33['length'];if(!_0x2c1caf[_0x74fd('0x2d')][_0x74fd('0x31')](_0x74fd('0x32'))){_0x40e132[_0x74fd('0x19')]=qs['limit'](_0x2c1caf[_0x74fd('0x2d')][_0x74fd('0x19')]);_0x40e132[_0x74fd('0x17')]=qs[_0x74fd('0x17')](_0x2c1caf[_0x74fd('0x2d')]['offset']);}return _0x118d1b[_0x74fd('0x48')](_0x40e132);}})[_0x74fd('0x1f')](function(_0x34fb8a){if(_0x34fb8a){return _0x34fb8a?{'count':_0x502c41,'rows':_0x34fb8a}:null;}})['then'](respondWithResult(_0x30a8dd,null))[_0x74fd('0x43')](handleError(_0x30a8dd,null));};exports[_0x74fd('0x49')]=function(_0x5c2b4f,_0x1f19c4,_0x4bd9f6){var _0x3319b5={};var _0x1a146f={};var _0x336d0b;var _0x27d85b;return db[_0x74fd('0x27')][_0x74fd('0x46')]({'where':{'id':_0x5c2b4f[_0x74fd('0x3d')]['id']}})[_0x74fd('0x1f')](handleEntityNotFound(_0x1f19c4,null))[_0x74fd('0x1f')](function(_0x14186){if(_0x14186){_0x336d0b=_0x14186;_0x1a146f['model']=_['keys'](db[_0x74fd('0x47')][_0x74fd('0x28')]);_0x1a146f[_0x74fd('0x2d')]=_['keys'](_0x5c2b4f[_0x74fd('0x2d')]);_0x1a146f['filters']=_[_0x74fd('0x3e')](_0x1a146f['model'],_0x1a146f[_0x74fd('0x2d')]);_0x3319b5['attributes']=_[_0x74fd('0x3e')](_0x1a146f[_0x74fd('0x2b')],qs[_0x74fd('0x30')](_0x5c2b4f[_0x74fd('0x2d')][_0x74fd('0x30')]));_0x3319b5[_0x74fd('0x2f')]=_0x3319b5[_0x74fd('0x2f')][_0x74fd('0x3f')]?_0x3319b5[_0x74fd('0x2f')]:_0x1a146f[_0x74fd('0x2b')];_0x3319b5[_0x74fd('0x33')]=qs[_0x74fd('0x34')](_0x5c2b4f[_0x74fd('0x2d')][_0x74fd('0x34')]);_0x3319b5[_0x74fd('0x36')]=qs[_0x74fd('0x2e')](_[_0x74fd('0x35')](_0x5c2b4f[_0x74fd('0x2d')],_0x1a146f[_0x74fd('0x2e')]));if(_0x5c2b4f[_0x74fd('0x2d')][_0x74fd('0x37')]){_0x3319b5[_0x74fd('0x36')]=_[_0x74fd('0x40')](_0x3319b5[_0x74fd('0x36')],{'$or':_[_0x74fd('0x26')](_0x3319b5[_0x74fd('0x2f')],function(_0x454c20){var _0x605c0d={};_0x605c0d[_0x454c20]={'$like':'%'+_0x5c2b4f['query'][_0x74fd('0x37')]+'%'};return _0x605c0d;})});}_0x3319b5=_[_0x74fd('0x40')]({},_0x3319b5,_0x5c2b4f['options']);return _0x336d0b[_0x74fd('0x49')](_0x3319b5);}})['then'](function(_0x43d3d2){if(_0x43d3d2){_0x27d85b=_0x43d3d2[_0x74fd('0x3f')];if(!_0x5c2b4f['query'][_0x74fd('0x31')](_0x74fd('0x32'))){_0x3319b5[_0x74fd('0x19')]=qs[_0x74fd('0x19')](_0x5c2b4f[_0x74fd('0x2d')][_0x74fd('0x19')]);_0x3319b5['offset']=qs['offset'](_0x5c2b4f[_0x74fd('0x2d')][_0x74fd('0x17')]);}return _0x336d0b['getDescriptions'](_0x3319b5);}})[_0x74fd('0x1f')](function(_0x95e92b){if(_0x95e92b){return _0x95e92b?{'count':_0x27d85b,'rows':_0x95e92b}:null;}})[_0x74fd('0x1f')](respondWithResult(_0x1f19c4,null))[_0x74fd('0x43')](handleError(_0x1f19c4,null));};exports['getTags']=function(_0x425a39,_0x66a88b,_0x48bb3a){var _0x7ac411={};var _0x3e81c6={};var _0x4977f8;var _0x10ca5f;return db[_0x74fd('0x27')][_0x74fd('0x46')]({'where':{'id':_0x425a39[_0x74fd('0x3d')]['id']}})[_0x74fd('0x1f')](handleEntityNotFound(_0x66a88b,null))[_0x74fd('0x1f')](function(_0x7cf8fa){if(_0x7cf8fa){_0x4977f8=_0x7cf8fa;_0x3e81c6[_0x74fd('0x2b')]=_[_0x74fd('0x2c')](db[_0x74fd('0x4a')][_0x74fd('0x28')]);_0x3e81c6[_0x74fd('0x2d')]=_[_0x74fd('0x2c')](_0x425a39['query']);_0x3e81c6[_0x74fd('0x2e')]=_[_0x74fd('0x3e')](_0x3e81c6[_0x74fd('0x2b')],_0x3e81c6[_0x74fd('0x2d')]);_0x7ac411['attributes']=_['intersection'](_0x3e81c6[_0x74fd('0x2b')],qs[_0x74fd('0x30')](_0x425a39[_0x74fd('0x2d')][_0x74fd('0x30')]));_0x7ac411['attributes']=_0x7ac411[_0x74fd('0x2f')]['length']?_0x7ac411[_0x74fd('0x2f')]:_0x3e81c6[_0x74fd('0x2b')];_0x7ac411[_0x74fd('0x33')]=qs[_0x74fd('0x34')](_0x425a39['query'][_0x74fd('0x34')]);_0x7ac411[_0x74fd('0x36')]=qs[_0x74fd('0x2e')](_[_0x74fd('0x35')](_0x425a39[_0x74fd('0x2d')],_0x3e81c6[_0x74fd('0x2e')]));if(_0x425a39[_0x74fd('0x2d')][_0x74fd('0x37')]){_0x7ac411[_0x74fd('0x36')]=_[_0x74fd('0x40')](_0x7ac411[_0x74fd('0x36')],{'$or':_['map'](_0x7ac411['attributes'],function(_0x20d3aa){var _0x3e0c9f={};_0x3e0c9f[_0x20d3aa]={'$like':'%'+_0x425a39[_0x74fd('0x2d')]['filter']+'%'};return _0x3e0c9f;})});}_0x7ac411=_['merge']({},_0x7ac411,_0x425a39['options']);return _0x4977f8[_0x74fd('0x4b')](_0x7ac411);}})[_0x74fd('0x1f')](function(_0x22ed51){if(_0x22ed51){_0x10ca5f=_0x22ed51[_0x74fd('0x3f')];if(!_0x425a39[_0x74fd('0x2d')][_0x74fd('0x31')](_0x74fd('0x32'))){_0x7ac411[_0x74fd('0x19')]=qs['limit'](_0x425a39[_0x74fd('0x2d')]['limit']);_0x7ac411[_0x74fd('0x17')]=qs[_0x74fd('0x17')](_0x425a39[_0x74fd('0x2d')][_0x74fd('0x17')]);}return _0x4977f8[_0x74fd('0x4b')](_0x7ac411);}})[_0x74fd('0x1f')](function(_0x27849e){if(_0x27849e){return _0x27849e?{'count':_0x10ca5f,'rows':_0x27849e}:null;}})[_0x74fd('0x1f')](respondWithResult(_0x66a88b,null))['catch'](handleError(_0x66a88b,null));};exports['setTags']=function(_0x2fd4d6,_0x271f47,_0x4e89f1){if(_0x2fd4d6['body']['id']){delete _0x2fd4d6[_0x74fd('0x42')]['id'];}return db['FreshdeskConfiguration'][_0x74fd('0x46')]({'where':{'id':_0x2fd4d6[_0x74fd('0x3d')]['id']}})[_0x74fd('0x1f')](handleEntityNotFound(_0x271f47,null))['then'](function(_0x209178){if(_0x209178){return _0x209178[_0x74fd('0x4c')](_0x2fd4d6[_0x74fd('0x42')][_0x74fd('0x4d')]||[]);}return null;})[_0x74fd('0x1f')](respondWithResult(_0x271f47,null))[_0x74fd('0x43')](handleError(_0x271f47,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index fc3412c..13c7f4c 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20cb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x530155,_0x376720){var _0xdcbff9=function(_0x58c2a4){while(--_0x58c2a4){_0x530155['push'](_0x530155['shift']());}};_0xdcbff9(++_0x376720);}(_0x20cb,0x103));var _0xb20c=function(_0x3c0fcc,_0x160469){_0x3c0fcc=_0x3c0fcc-0x0;var _0x1dba4b=_0x20cb[_0x3c0fcc];return _0x1dba4b;};'use strict';var _=require(_0xb20c('0x0'));var util=require('util');var logger=require(_0xb20c('0x1'))(_0xb20c('0x2'));var moment=require('moment');var BPromise=require(_0xb20c('0x3'));var rp=require(_0xb20c('0x4'));var fs=require('fs');var path=require(_0xb20c('0x5'));var rimraf=require(_0xb20c('0x6'));var config=require(_0xb20c('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xb20c('0x8')]=function(_0x3d4c3d,_0xf32bb2){return _0x3d4c3d[_0xb20c('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d9=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x347040,_0x1178d5){var _0x3da885=function(_0x13fb60){while(--_0x13fb60){_0x347040['push'](_0x347040['shift']());}};_0x3da885(++_0x1178d5);}(_0x10d9,0x1a6));var _0x910d=function(_0x373d2b,_0x39b34b){_0x373d2b=_0x373d2b-0x0;var _0x554d9a=_0x10d9[_0x373d2b];return _0x554d9a;};'use strict';var _=require(_0x910d('0x0'));var util=require(_0x910d('0x1'));var logger=require(_0x910d('0x2'))(_0x910d('0x3'));var moment=require('moment');var BPromise=require(_0x910d('0x4'));var rp=require(_0x910d('0x5'));var fs=require('fs');var path=require(_0x910d('0x6'));var rimraf=require(_0x910d('0x7'));var config=require(_0x910d('0x8'));var attributes=require(_0x910d('0x9'));module[_0x910d('0xa')]=function(_0x4e2043,_0x346a89){return _0x4e2043[_0x910d('0xb')](_0x910d('0xc'),attributes,{'tableName':_0x910d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 53472d9..7768765 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9428=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3626e0,_0x5b2ae8){var _0x103cc5=function(_0x29d47b){while(--_0x29d47b){_0x3626e0['push'](_0x3626e0['shift']());}};_0x103cc5(++_0x5b2ae8);}(_0x9428,0xc9));var _0x8942=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x9428[_0x26e727];return _0x563800;};'use strict';var _=require(_0x8942('0x0'));var util=require(_0x8942('0x1'));var moment=require('moment');var BPromise=require(_0x8942('0x2'));var rs=require(_0x8942('0x3'));var fs=require('fs');var Redis=require(_0x8942('0x4'));var db=require(_0x8942('0x5'))['db'];var utils=require(_0x8942('0x6'));var logger=require(_0x8942('0x7'))(_0x8942('0x8'));var config=require(_0x8942('0x9'));var jayson=require(_0x8942('0xa'));var client=jayson[_0x8942('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266f5a,_0x485da8,_0x29a3a1){return new BPromise(function(_0x2f63f6,_0x88a0d6){return client[_0x8942('0xc')](_0x266f5a,_0x29a3a1)['then'](function(_0x4d9762){logger[_0x8942('0xd')](_0x8942('0xe'),_0x485da8,_0x8942('0xf'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x485da8,_0x8942('0xf'),JSON[_0x8942('0x10')](_0x4d9762));if(_0x4d9762[_0x8942('0x11')]){if(_0x4d9762[_0x8942('0x11')][_0x8942('0x12')]===0x1f4){logger[_0x8942('0x11')](_0x8942('0xe'),_0x485da8,_0x4d9762['error'][_0x8942('0x13')]);return _0x88a0d6(_0x4d9762[_0x8942('0x11')]['message']);}logger['error'](_0x8942('0xe'),_0x485da8,_0x4d9762[_0x8942('0x11')][_0x8942('0x13')]);return _0x2f63f6(_0x4d9762[_0x8942('0x11')][_0x8942('0x13')]);}else{logger[_0x8942('0xd')](_0x8942('0xe'),_0x485da8,_0x8942('0xf'));_0x2f63f6(_0x4d9762[_0x8942('0x14')]['message']);}})[_0x8942('0x15')](function(_0x9cae36){logger[_0x8942('0x11')](_0x8942('0xe'),_0x485da8,_0x9cae36);_0x88a0d6(_0x9cae36);});});} \ No newline at end of file +var _0x6d46=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','then'];(function(_0x103a07,_0x35acb4){var _0x404596=function(_0x5b6cf8){while(--_0x5b6cf8){_0x103a07['push'](_0x103a07['shift']());}};_0x404596(++_0x35acb4);}(_0x6d46,0x171));var _0x66d4=function(_0x38dbb5,_0x427be1){_0x38dbb5=_0x38dbb5-0x0;var _0x34bd46=_0x6d46[_0x38dbb5];return _0x34bd46;};'use strict';var _=require(_0x66d4('0x0'));var util=require(_0x66d4('0x1'));var moment=require(_0x66d4('0x2'));var BPromise=require(_0x66d4('0x3'));var rs=require(_0x66d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66d4('0x5'))['db'];var utils=require(_0x66d4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x66d4('0x7'));var client=jayson[_0x66d4('0x8')][_0x66d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x585f90,_0x44d498,_0xd01ba1){return new BPromise(function(_0x55d94d,_0x476c1d){return client['request'](_0x585f90,_0xd01ba1)[_0x66d4('0xa')](function(_0x31b280){logger[_0x66d4('0xb')](_0x66d4('0xc'),_0x44d498,_0x66d4('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x44d498,_0x66d4('0xd'),JSON[_0x66d4('0xe')](_0x31b280));if(_0x31b280[_0x66d4('0xf')]){if(_0x31b280[_0x66d4('0xf')][_0x66d4('0x10')]===0x1f4){logger[_0x66d4('0xf')](_0x66d4('0xc'),_0x44d498,_0x31b280[_0x66d4('0xf')][_0x66d4('0x11')]);return _0x476c1d(_0x31b280['error'][_0x66d4('0x11')]);}logger[_0x66d4('0xf')](_0x66d4('0xc'),_0x44d498,_0x31b280[_0x66d4('0xf')][_0x66d4('0x11')]);return _0x55d94d(_0x31b280[_0x66d4('0xf')][_0x66d4('0x11')]);}else{logger[_0x66d4('0xb')](_0x66d4('0xc'),_0x44d498,'request\x20sent');_0x55d94d(_0x31b280['result'][_0x66d4('0x11')]);}})[_0x66d4('0x12')](function(_0x56c5f0){logger[_0x66d4('0xf')](_0x66d4('0xc'),_0x44d498,_0x56c5f0);_0x476c1d(_0x56c5f0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8c82331..8bbc8dc 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x803a=['../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x803a,0x91));var _0xa803=function(_0x65ab8b,_0x53c1d6){_0x65ab8b=_0x65ab8b-0x0;var _0x3c1d82=_0x803a[_0x65ab8b];return _0x3c1d82;};'use strict';var multer=require('multer');var util=require(_0xa803('0x0'));var path=require(_0xa803('0x1'));var timeout=require('connect-timeout');var express=require(_0xa803('0x2'));var router=express[_0xa803('0x3')]();var fs_extra=require(_0xa803('0x4'));var auth=require(_0xa803('0x5'));var interaction=require(_0xa803('0x6'));var config=require(_0xa803('0x7'));var controller=require(_0xa803('0x8'));router[_0xa803('0x9')]('/',auth[_0xa803('0xa')](),controller['index']);router[_0xa803('0x9')](_0xa803('0xb'),auth[_0xa803('0xa')](),controller['show']);router[_0xa803('0xc')]('/',auth['isAuthenticated'](),controller[_0xa803('0xd')]);router[_0xa803('0xe')]('/:id',auth[_0xa803('0xa')](),controller[_0xa803('0xf')]);router[_0xa803('0x10')](_0xa803('0xb'),auth[_0xa803('0xa')](),controller[_0xa803('0x11')]);module[_0xa803('0x12')]=router; \ No newline at end of file +var _0x0c04=['post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2dbbdc,_0x223989){var _0x53a40b=function(_0x4f0894){while(--_0x4f0894){_0x2dbbdc['push'](_0x2dbbdc['shift']());}};_0x53a40b(++_0x223989);}(_0x0c04,0x1f3));var _0x40c0=function(_0x3206b9,_0x2d6052){_0x3206b9=_0x3206b9-0x0;var _0x2b4527=_0x0c04[_0x3206b9];return _0x2b4527;};'use strict';var multer=require(_0x40c0('0x0'));var util=require(_0x40c0('0x1'));var path=require(_0x40c0('0x2'));var timeout=require(_0x40c0('0x3'));var express=require('express');var router=express[_0x40c0('0x4')]();var fs_extra=require(_0x40c0('0x5'));var auth=require(_0x40c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x40c0('0x7'));var controller=require(_0x40c0('0x8'));router[_0x40c0('0x9')]('/',auth['isAuthenticated'](),controller[_0x40c0('0xa')]);router['get'](_0x40c0('0xb'),auth[_0x40c0('0xc')](),controller[_0x40c0('0xd')]);router[_0x40c0('0xe')]('/',auth[_0x40c0('0xc')](),controller['create']);router[_0x40c0('0xf')](_0x40c0('0xb'),auth[_0x40c0('0xc')](),controller[_0x40c0('0x10')]);router[_0x40c0('0x11')](_0x40c0('0xb'),auth[_0x40c0('0xc')](),controller['destroy']);module[_0x40c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 2e0b4d7..681fdeb 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1af=['keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x2f9325,_0x2fb0d0){var _0x4e53e7=function(_0x433111){while(--_0x433111){_0x2f9325['push'](_0x2f9325['shift']());}};_0x4e53e7(++_0x2fb0d0);}(_0xd1af,0xb0));var _0xfd1a=function(_0x2a171,_0xc09dd9){_0x2a171=_0x2a171-0x0;var _0x135fd0=_0xd1af[_0x2a171];return _0x135fd0;};'use strict';var Sequelize=require('sequelize');module[_0xfd1a('0x0')]={'type':{'type':Sequelize['ENUM'](_0xfd1a('0x1'),_0xfd1a('0x2'),_0xfd1a('0x3'),_0xfd1a('0x4'),_0xfd1a('0x5')),'defaultValue':_0xfd1a('0x1')},'content':{'type':Sequelize[_0xfd1a('0x6')]},'key':{'type':Sequelize[_0xfd1a('0x6')]},'keyType':{'type':Sequelize[_0xfd1a('0x7')](_0xfd1a('0x1'),'variable',_0xfd1a('0x3'))},'keyContent':{'type':Sequelize[_0xfd1a('0x6')]},'idField':{'type':Sequelize[_0xfd1a('0x6')]},'nameField':{'type':Sequelize[_0xfd1a('0x6')]},'customField':{'type':Sequelize[_0xfd1a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfd1a('0x6')]}}; \ No newline at end of file +var _0x229e=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x3a4350,_0x4fb966){var _0x3e649f=function(_0x3dee15){while(--_0x3dee15){_0x3a4350['push'](_0x3a4350['shift']());}};_0x3e649f(++_0x4fb966);}(_0x229e,0x1dd));var _0xe229=function(_0x5261a2,_0x538fb5){_0x5261a2=_0x5261a2-0x0;var _0xfde445=_0x229e[_0x5261a2];return _0xfde445;};'use strict';var Sequelize=require(_0xe229('0x0'));module['exports']={'type':{'type':Sequelize[_0xe229('0x1')](_0xe229('0x2'),_0xe229('0x3'),_0xe229('0x4'),_0xe229('0x5'),_0xe229('0x6')),'defaultValue':_0xe229('0x2')},'content':{'type':Sequelize[_0xe229('0x7')]},'key':{'type':Sequelize[_0xe229('0x7')]},'keyType':{'type':Sequelize[_0xe229('0x1')](_0xe229('0x2'),_0xe229('0x3'),_0xe229('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe229('0x7')]},'nameField':{'type':Sequelize[_0xe229('0x7')]},'customField':{'type':Sequelize[_0xe229('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe229('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index cac80eb..881c3d7 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x049e=['moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','error','stack','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','eml-format','rimraf','fast-json-patch'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x049e,0x16a));var _0xe049=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x049e[_0x52666e];return _0x515330;};'use strict';var emlformat=require(_0xe049('0x0'));var rimraf=require(_0xe049('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe049('0x2'));var rp=require('request-promise');var moment=require(_0xe049('0x3'));var BPromise=require(_0xe049('0x4'));var Mustache=require(_0xe049('0x5'));var util=require(_0xe049('0x6'));var path=require(_0xe049('0x7'));var sox=require('sox');var csv=require(_0xe049('0x8'));var ejs=require(_0xe049('0x9'));var fs=require('fs');var fs_extra=require(_0xe049('0xa'));var _=require(_0xe049('0xb'));var squel=require(_0xe049('0xc'));var crypto=require(_0xe049('0xd'));var jsforce=require(_0xe049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe049('0x8'));var querystring=require(_0xe049('0xf'));var Papa=require(_0xe049('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe049('0x11'));var as=require(_0xe049('0x12'));var hardwareService=require(_0xe049('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe049('0x14'));var licenseUtil=require(_0xe049('0x15'));var db=require(_0xe049('0x16'))['db'];function respondWithStatusCode(_0x359931,_0x301c7e){_0x301c7e=_0x301c7e||0xcc;return function(_0x1021e7){if(_0x1021e7){return _0x359931[_0xe049('0x17')](_0x301c7e);}return _0x359931[_0xe049('0x18')](_0x301c7e)['end']();};}function respondWithResult(_0x20c286,_0x3f4a57){_0x3f4a57=_0x3f4a57||0xc8;return function(_0x3924a4){if(_0x3924a4){return _0x20c286[_0xe049('0x18')](_0x3f4a57)['json'](_0x3924a4);}};}function respondWithFilteredResult(_0x3a539b,_0xcc35b6){return function(_0x5c90fd){if(_0x5c90fd){var _0x388be0=typeof _0xcc35b6[_0xe049('0x19')]==='undefined'&&typeof _0xcc35b6[_0xe049('0x1a')]===_0xe049('0x1b');var _0x5d435b=_0x5c90fd[_0xe049('0x1c')];var _0x54c303=_0x388be0?0x0:_0xcc35b6['offset'];var _0x3cbbeb=_0x388be0?_0x5c90fd['count']:_0xcc35b6['offset']+_0xcc35b6[_0xe049('0x1a')];var _0x1092ec;if(_0x3cbbeb>=_0x5d435b){_0x3cbbeb=_0x5d435b;_0x1092ec=0xc8;}else{_0x1092ec=0xce;}_0x3a539b['status'](_0x1092ec);return _0x3a539b['set'](_0xe049('0x1d'),_0x54c303+'-'+_0x3cbbeb+'/'+_0x5d435b)[_0xe049('0x1e')](_0x5c90fd);}return null;};}function patchUpdates(_0x1d2f5b){return function(_0x430421){try{jsonpatch['apply'](_0x430421,_0x1d2f5b,!![]);}catch(_0x572f29){return BPromise[_0xe049('0x1f')](_0x572f29);}return _0x430421[_0xe049('0x20')]();};}function saveUpdates(_0x572a80,_0x36a03b){return function(_0x3f14eb){if(_0x3f14eb){return _0x3f14eb[_0xe049('0x21')](_0x572a80)['then'](function(_0x197358){return _0x197358;});}return null;};}function removeEntity(_0x3b0f54,_0x4c7492){return function(_0x4848c9){if(_0x4848c9){return _0x4848c9['destroy']()[_0xe049('0x22')](function(){_0x3b0f54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aafd1,_0x1efbbe){return function(_0x53620b){if(!_0x53620b){_0x1aafd1[_0xe049('0x17')](0x194);}return _0x53620b;};}function handleError(_0x181432,_0x3e5c7f){_0x3e5c7f=_0x3e5c7f||0x1f4;return function(_0x423ba4){logger[_0xe049('0x23')](_0x423ba4[_0xe049('0x24')]);if(_0x423ba4['name']){delete _0x423ba4['name'];}_0x181432[_0xe049('0x18')](_0x3e5c7f)['send'](_0x423ba4);};}exports[_0xe049('0x25')]=function(_0x495d33,_0x3c50c3){var _0x2b79dc={},_0x5adcd6={},_0x432a6e={'count':0x0,'rows':[]};var _0x364630=_[_0xe049('0x26')](db[_0xe049('0x27')][_0xe049('0x28')],function(_0x4055fc){return{'name':_0x4055fc[_0xe049('0x29')],'type':_0x4055fc[_0xe049('0x2a')][_0xe049('0x2b')]};});_0x5adcd6[_0xe049('0x2c')]=_[_0xe049('0x26')](_0x364630,'name');_0x5adcd6[_0xe049('0x2d')]=_[_0xe049('0x2e')](_0x495d33['query']);_0x5adcd6['filters']=_['intersection'](_0x5adcd6['model'],_0x5adcd6[_0xe049('0x2d')]);_0x2b79dc[_0xe049('0x2f')]=_[_0xe049('0x30')](_0x5adcd6[_0xe049('0x2c')],qs[_0xe049('0x31')](_0x495d33['query'][_0xe049('0x31')]));_0x2b79dc[_0xe049('0x2f')]=_0x2b79dc[_0xe049('0x2f')][_0xe049('0x32')]?_0x2b79dc[_0xe049('0x2f')]:_0x5adcd6['model'];if(!_0x495d33[_0xe049('0x2d')]['hasOwnProperty'](_0xe049('0x33'))){_0x2b79dc['limit']=qs[_0xe049('0x1a')](_0x495d33[_0xe049('0x2d')][_0xe049('0x1a')]);_0x2b79dc[_0xe049('0x19')]=qs[_0xe049('0x19')](_0x495d33[_0xe049('0x2d')][_0xe049('0x19')]);}_0x2b79dc[_0xe049('0x34')]=qs[_0xe049('0x35')](_0x495d33[_0xe049('0x2d')][_0xe049('0x35')]);_0x2b79dc['where']=qs[_0xe049('0x36')](_[_0xe049('0x37')](_0x495d33[_0xe049('0x2d')],_0x5adcd6[_0xe049('0x36')]),_0x364630);if(_0x495d33[_0xe049('0x2d')][_0xe049('0x38')]){_0x2b79dc[_0xe049('0x39')]=_[_0xe049('0x3a')](_0x2b79dc['where'],{'$or':_[_0xe049('0x26')](_0x364630,function(_0x14bea3){if(_0x14bea3[_0xe049('0x2a')]!==_0xe049('0x3b')){var _0x5e9613={};_0x5e9613[_0x14bea3[_0xe049('0x3c')]]={'$like':'%'+_0x495d33[_0xe049('0x2d')][_0xe049('0x38')]+'%'};return _0x5e9613;}})});}_0x2b79dc=_[_0xe049('0x3a')]({},_0x2b79dc,_0x495d33[_0xe049('0x3d')]);var _0x54d5dd={'where':_0x2b79dc[_0xe049('0x39')]};return db[_0xe049('0x27')][_0xe049('0x1c')](_0x54d5dd)['then'](function(_0x28ae88){_0x432a6e['count']=_0x28ae88;if(_0x495d33['query'][_0xe049('0x3e')]){_0x2b79dc['include']=[{'all':!![]}];}return db[_0xe049('0x27')][_0xe049('0x3f')](_0x2b79dc);})[_0xe049('0x22')](function(_0xe4f184){_0x432a6e[_0xe049('0x40')]=_0xe4f184;return _0x432a6e;})['then'](respondWithFilteredResult(_0x3c50c3,_0x2b79dc))[_0xe049('0x41')](handleError(_0x3c50c3,null));};exports[_0xe049('0x42')]=function(_0x5e2374,_0x546137){var _0x29915f={'raw':!![],'where':{'id':_0x5e2374[_0xe049('0x43')]['id']}},_0x20d264={};_0x20d264[_0xe049('0x2c')]=_[_0xe049('0x2e')](db[_0xe049('0x27')]['rawAttributes']);_0x20d264[_0xe049('0x2d')]=_[_0xe049('0x2e')](_0x5e2374['query']);_0x20d264[_0xe049('0x36')]=_[_0xe049('0x30')](_0x20d264[_0xe049('0x2c')],_0x20d264[_0xe049('0x2d')]);_0x29915f[_0xe049('0x2f')]=_['intersection'](_0x20d264['model'],qs[_0xe049('0x31')](_0x5e2374[_0xe049('0x2d')][_0xe049('0x31')]));_0x29915f[_0xe049('0x2f')]=_0x29915f[_0xe049('0x2f')][_0xe049('0x32')]?_0x29915f['attributes']:_0x20d264[_0xe049('0x2c')];if(_0x5e2374[_0xe049('0x2d')]['includeAll']){_0x29915f[_0xe049('0x44')]=[{'all':!![]}];}_0x29915f=_['merge']({},_0x29915f,_0x5e2374[_0xe049('0x3d')]);return db['FreshdeskField'][_0xe049('0x45')](_0x29915f)['then'](handleEntityNotFound(_0x546137,null))[_0xe049('0x22')](respondWithResult(_0x546137,null))[_0xe049('0x41')](handleError(_0x546137,null));};exports[_0xe049('0x46')]=function(_0x1e3daf,_0x22eeb1){return db['FreshdeskField'][_0xe049('0x46')](_0x1e3daf[_0xe049('0x47')],{})[_0xe049('0x22')](respondWithResult(_0x22eeb1,0xc9))[_0xe049('0x41')](handleError(_0x22eeb1,null));};exports[_0xe049('0x21')]=function(_0x3c15a2,_0x12f9b8){if(_0x3c15a2[_0xe049('0x47')]['id']){delete _0x3c15a2[_0xe049('0x47')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x3c15a2[_0xe049('0x43')]['id']}})[_0xe049('0x22')](handleEntityNotFound(_0x12f9b8,null))[_0xe049('0x22')](saveUpdates(_0x3c15a2[_0xe049('0x47')],null))[_0xe049('0x22')](respondWithResult(_0x12f9b8,null))[_0xe049('0x41')](handleError(_0x12f9b8,null));};exports[_0xe049('0x48')]=function(_0x2e4dce,_0x23692f){return db[_0xe049('0x27')][_0xe049('0x45')]({'where':{'id':_0x2e4dce['params']['id']}})[_0xe049('0x22')](handleEntityNotFound(_0x23692f,null))[_0xe049('0x22')](removeEntity(_0x23692f,null))[_0xe049('0x41')](handleError(_0x23692f,null));}; \ No newline at end of file +var _0x3495=['status','end','json','undefined','count','offset','limit','Content-Range','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','sort','where','pick','filter','merge','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x3495,0x1de));var _0x5349=function(_0x365f76,_0x5de0f3){_0x365f76=_0x365f76-0x0;var _0x3ca839=_0x3495[_0x365f76];return _0x3ca839;};'use strict';var emlformat=require(_0x5349('0x0'));var rimraf=require(_0x5349('0x1'));var zipdir=require(_0x5349('0x2'));var jsonpatch=require(_0x5349('0x3'));var rp=require(_0x5349('0x4'));var moment=require(_0x5349('0x5'));var BPromise=require(_0x5349('0x6'));var Mustache=require(_0x5349('0x7'));var util=require(_0x5349('0x8'));var path=require('path');var sox=require(_0x5349('0x9'));var csv=require(_0x5349('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5349('0xb'));var _=require('lodash');var squel=require(_0x5349('0xc'));var crypto=require('crypto');var jsforce=require(_0x5349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5349('0xa'));var querystring=require(_0x5349('0xe'));var Papa=require(_0x5349('0xf'));var Redis=require(_0x5349('0x10'));var authService=require(_0x5349('0x11'));var qs=require(_0x5349('0x12'));var as=require(_0x5349('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5349('0x14'))('api');var utils=require(_0x5349('0x15'));var config=require(_0x5349('0x16'));var licenseUtil=require(_0x5349('0x17'));var db=require(_0x5349('0x18'))['db'];function respondWithStatusCode(_0x2f5172,_0x3c592a){_0x3c592a=_0x3c592a||0xcc;return function(_0x642966){if(_0x642966){return _0x2f5172[_0x5349('0x19')](_0x3c592a);}return _0x2f5172[_0x5349('0x1a')](_0x3c592a)[_0x5349('0x1b')]();};}function respondWithResult(_0x534e31,_0x2fde66){_0x2fde66=_0x2fde66||0xc8;return function(_0x367c25){if(_0x367c25){return _0x534e31['status'](_0x2fde66)[_0x5349('0x1c')](_0x367c25);}};}function respondWithFilteredResult(_0x269f7f,_0x2fe611){return function(_0x49bbec){if(_0x49bbec){var _0x5bcb3a=typeof _0x2fe611['offset']===_0x5349('0x1d')&&typeof _0x2fe611['limit']===_0x5349('0x1d');var _0x5f3cfb=_0x49bbec[_0x5349('0x1e')];var _0x2c1f1=_0x5bcb3a?0x0:_0x2fe611[_0x5349('0x1f')];var _0x132639=_0x5bcb3a?_0x49bbec['count']:_0x2fe611[_0x5349('0x1f')]+_0x2fe611[_0x5349('0x20')];var _0x8abbe3;if(_0x132639>=_0x5f3cfb){_0x132639=_0x5f3cfb;_0x8abbe3=0xc8;}else{_0x8abbe3=0xce;}_0x269f7f[_0x5349('0x1a')](_0x8abbe3);return _0x269f7f['set'](_0x5349('0x21'),_0x2c1f1+'-'+_0x132639+'/'+_0x5f3cfb)[_0x5349('0x1c')](_0x49bbec);}return null;};}function patchUpdates(_0x4f2cb6){return function(_0x4c96dc){try{jsonpatch['apply'](_0x4c96dc,_0x4f2cb6,!![]);}catch(_0x423581){return BPromise['reject'](_0x423581);}return _0x4c96dc[_0x5349('0x22')]();};}function saveUpdates(_0x1ff911,_0x164978){return function(_0x6c80cd){if(_0x6c80cd){return _0x6c80cd[_0x5349('0x23')](_0x1ff911)[_0x5349('0x24')](function(_0x303250){return _0x303250;});}return null;};}function removeEntity(_0x43a0c2,_0x2a3258){return function(_0x34353f){if(_0x34353f){return _0x34353f[_0x5349('0x25')]()[_0x5349('0x24')](function(){_0x43a0c2['status'](0xcc)[_0x5349('0x1b')]();});}};}function handleEntityNotFound(_0x187b39,_0x41d67e){return function(_0x49435a){if(!_0x49435a){_0x187b39[_0x5349('0x19')](0x194);}return _0x49435a;};}function handleError(_0x5068fa,_0x1afba7){_0x1afba7=_0x1afba7||0x1f4;return function(_0x203896){logger[_0x5349('0x26')](_0x203896['stack']);if(_0x203896[_0x5349('0x27')]){delete _0x203896[_0x5349('0x27')];}_0x5068fa[_0x5349('0x1a')](_0x1afba7)[_0x5349('0x28')](_0x203896);};}exports[_0x5349('0x29')]=function(_0x16edcb,_0x3b6faa){var _0x463a42={},_0x39b3a9={},_0x5b5d6c={'count':0x0,'rows':[]};var _0x3b3e79=_[_0x5349('0x2a')](db['FreshdeskField'][_0x5349('0x2b')],function(_0x573ee1){return{'name':_0x573ee1[_0x5349('0x2c')],'type':_0x573ee1[_0x5349('0x2d')][_0x5349('0x2e')]};});_0x39b3a9[_0x5349('0x2f')]=_[_0x5349('0x2a')](_0x3b3e79,_0x5349('0x27'));_0x39b3a9['query']=_[_0x5349('0x30')](_0x16edcb[_0x5349('0x31')]);_0x39b3a9[_0x5349('0x32')]=_[_0x5349('0x33')](_0x39b3a9['model'],_0x39b3a9['query']);_0x463a42[_0x5349('0x34')]=_[_0x5349('0x33')](_0x39b3a9[_0x5349('0x2f')],qs['fields'](_0x16edcb[_0x5349('0x31')]['fields']));_0x463a42[_0x5349('0x34')]=_0x463a42[_0x5349('0x34')][_0x5349('0x35')]?_0x463a42[_0x5349('0x34')]:_0x39b3a9[_0x5349('0x2f')];if(!_0x16edcb[_0x5349('0x31')]['hasOwnProperty']('nolimit')){_0x463a42[_0x5349('0x20')]=qs[_0x5349('0x20')](_0x16edcb[_0x5349('0x31')][_0x5349('0x20')]);_0x463a42[_0x5349('0x1f')]=qs[_0x5349('0x1f')](_0x16edcb[_0x5349('0x31')]['offset']);}_0x463a42['order']=qs[_0x5349('0x36')](_0x16edcb['query']['sort']);_0x463a42[_0x5349('0x37')]=qs['filters'](_[_0x5349('0x38')](_0x16edcb[_0x5349('0x31')],_0x39b3a9[_0x5349('0x32')]),_0x3b3e79);if(_0x16edcb['query'][_0x5349('0x39')]){_0x463a42['where']=_[_0x5349('0x3a')](_0x463a42[_0x5349('0x37')],{'$or':_[_0x5349('0x2a')](_0x3b3e79,function(_0x4d6f15){if(_0x4d6f15['type']!=='VIRTUAL'){var _0x84592b={};_0x84592b[_0x4d6f15[_0x5349('0x27')]]={'$like':'%'+_0x16edcb[_0x5349('0x31')][_0x5349('0x39')]+'%'};return _0x84592b;}})});}_0x463a42=_[_0x5349('0x3a')]({},_0x463a42,_0x16edcb[_0x5349('0x3b')]);var _0x50c506={'where':_0x463a42['where']};return db[_0x5349('0x3c')][_0x5349('0x1e')](_0x50c506)[_0x5349('0x24')](function(_0x53f062){_0x5b5d6c[_0x5349('0x1e')]=_0x53f062;if(_0x16edcb[_0x5349('0x31')][_0x5349('0x3d')]){_0x463a42[_0x5349('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0x5349('0x3f')](_0x463a42);})['then'](function(_0x39a154){_0x5b5d6c[_0x5349('0x40')]=_0x39a154;return _0x5b5d6c;})['then'](respondWithFilteredResult(_0x3b6faa,_0x463a42))[_0x5349('0x41')](handleError(_0x3b6faa,null));};exports[_0x5349('0x42')]=function(_0x1a3836,_0x370849){var _0x173904={'raw':!![],'where':{'id':_0x1a3836[_0x5349('0x43')]['id']}},_0xd29178={};_0xd29178['model']=_['keys'](db[_0x5349('0x3c')][_0x5349('0x2b')]);_0xd29178[_0x5349('0x31')]=_[_0x5349('0x30')](_0x1a3836['query']);_0xd29178[_0x5349('0x32')]=_['intersection'](_0xd29178['model'],_0xd29178[_0x5349('0x31')]);_0x173904[_0x5349('0x34')]=_[_0x5349('0x33')](_0xd29178[_0x5349('0x2f')],qs['fields'](_0x1a3836[_0x5349('0x31')][_0x5349('0x44')]));_0x173904[_0x5349('0x34')]=_0x173904[_0x5349('0x34')][_0x5349('0x35')]?_0x173904[_0x5349('0x34')]:_0xd29178[_0x5349('0x2f')];if(_0x1a3836[_0x5349('0x31')][_0x5349('0x3d')]){_0x173904[_0x5349('0x3e')]=[{'all':!![]}];}_0x173904=_[_0x5349('0x3a')]({},_0x173904,_0x1a3836[_0x5349('0x3b')]);return db[_0x5349('0x3c')][_0x5349('0x45')](_0x173904)['then'](handleEntityNotFound(_0x370849,null))['then'](respondWithResult(_0x370849,null))[_0x5349('0x41')](handleError(_0x370849,null));};exports[_0x5349('0x46')]=function(_0x37b370,_0x366634){return db[_0x5349('0x3c')][_0x5349('0x46')](_0x37b370['body'],{})[_0x5349('0x24')](respondWithResult(_0x366634,0xc9))[_0x5349('0x41')](handleError(_0x366634,null));};exports[_0x5349('0x23')]=function(_0x3652dc,_0x26d06a){if(_0x3652dc[_0x5349('0x47')]['id']){delete _0x3652dc['body']['id'];}return db[_0x5349('0x3c')]['find']({'where':{'id':_0x3652dc[_0x5349('0x43')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x26d06a,null))[_0x5349('0x24')](saveUpdates(_0x3652dc[_0x5349('0x47')],null))[_0x5349('0x24')](respondWithResult(_0x26d06a,null))['catch'](handleError(_0x26d06a,null));};exports[_0x5349('0x25')]=function(_0x3fca72,_0x3891af){return db[_0x5349('0x3c')]['find']({'where':{'id':_0x3fca72[_0x5349('0x43')]['id']}})[_0x5349('0x24')](handleEntityNotFound(_0x3891af,null))[_0x5349('0x24')](removeEntity(_0x3891af,null))[_0x5349('0x41')](handleError(_0x3891af,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 266f367..799b961 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.model.js +++ b/server/api/intFreshdeskField/intFreshdeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5455=['define','FreshdeskField','freshdesk_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes','exports'];(function(_0x2f7aa6,_0x2072e5){var _0x18d006=function(_0x21f07b){while(--_0x21f07b){_0x2f7aa6['push'](_0x2f7aa6['shift']());}};_0x18d006(++_0x2072e5);}(_0x5455,0x197));var _0x5545=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5455[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x5545('0xb'),'fields':[_0x5545('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f45=['idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index'];(function(_0xe15c76,_0x41a9cc){var _0x51c507=function(_0x3aa039){while(--_0x3aa039){_0xe15c76['push'](_0xe15c76['shift']());}};_0x51c507(++_0x41a9cc);}(_0x2f45,0x18a));var _0x52f4=function(_0x569ea2,_0x4857f1){_0x569ea2=_0x569ea2-0x0;var _0xda711=_0x2f45[_0x569ea2];return _0xda711;};'use strict';var _=require(_0x52f4('0x0'));var util=require(_0x52f4('0x1'));var logger=require(_0x52f4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52f4('0x3'));var fs=require('fs');var path=require(_0x52f4('0x4'));var rimraf=require(_0x52f4('0x5'));var config=require(_0x52f4('0x6'));var attributes=require(_0x52f4('0x7'));module[_0x52f4('0x8')]=function(_0x389fde,_0x3b708e){return _0x389fde[_0x52f4('0x9')](_0x52f4('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x52f4('0xb'),'fields':[_0x52f4('0xc'),_0x52f4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 8512b70..6db512b 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5042=['message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0xcd8a24,_0x25c80b){var _0x7200ec=function(_0x4f3a34){while(--_0x4f3a34){_0xcd8a24['push'](_0xcd8a24['shift']());}};_0x7200ec(++_0x25c80b);}(_0x5042,0xa4));var _0x2504=function(_0x2b400c,_0x3eb1b0){_0x2b400c=_0x2b400c-0x0;var _0x3ec13b=_0x5042[_0x2b400c];return _0x3ec13b;};'use strict';var _=require('lodash');var util=require(_0x2504('0x0'));var moment=require(_0x2504('0x1'));var BPromise=require(_0x2504('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2504('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2504('0x4'));var logger=require(_0x2504('0x5'))(_0x2504('0x6'));var config=require('../../config/environment');var jayson=require(_0x2504('0x7'));var client=jayson[_0x2504('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39cccf,_0x55819a,_0x20b2c1){return new BPromise(function(_0x57d57f,_0x3e9ac0){return client['request'](_0x39cccf,_0x20b2c1)[_0x2504('0x9')](function(_0x291015){logger[_0x2504('0xa')](_0x2504('0xb'),_0x55819a,_0x2504('0xc'));logger[_0x2504('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x55819a,_0x2504('0xc'),JSON['stringify'](_0x291015));if(_0x291015[_0x2504('0xe')]){if(_0x291015['error'][_0x2504('0xf')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x55819a,_0x291015[_0x2504('0xe')]['message']);return _0x3e9ac0(_0x291015['error'][_0x2504('0x10')]);}logger[_0x2504('0xe')](_0x2504('0xb'),_0x55819a,_0x291015['error'][_0x2504('0x10')]);return _0x57d57f(_0x291015[_0x2504('0xe')][_0x2504('0x10')]);}else{logger['info'](_0x2504('0xb'),_0x55819a,_0x2504('0xc'));_0x57d57f(_0x291015['result'][_0x2504('0x10')]);}})[_0x2504('0x11')](function(_0x514ea6){logger[_0x2504('0xe')](_0x2504('0xb'),_0x55819a,_0x514ea6);_0x3e9ac0(_0x514ea6);});});} \ No newline at end of file +var _0x153e=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5489bc,_0x9fb1ce){var _0x1f64b3=function(_0x53679b){while(--_0x53679b){_0x5489bc['push'](_0x5489bc['shift']());}};_0x1f64b3(++_0x9fb1ce);}(_0x153e,0x6c));var _0xe153=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x153e[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0xe153('0x0'));var util=require(_0xe153('0x1'));var moment=require('moment');var BPromise=require(_0xe153('0x2'));var rs=require(_0xe153('0x3'));var fs=require('fs');var Redis=require(_0xe153('0x4'));var db=require(_0xe153('0x5'))['db'];var utils=require(_0xe153('0x6'));var logger=require(_0xe153('0x7'))(_0xe153('0x8'));var config=require('../../config/environment');var jayson=require(_0xe153('0x9'));var client=jayson[_0xe153('0xa')][_0xe153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d184e,_0x4873b6,_0x5976ee){return new BPromise(function(_0x12dd00,_0x2be20e){return client[_0xe153('0xc')](_0x5d184e,_0x5976ee)[_0xe153('0xd')](function(_0x2efdf6){logger[_0xe153('0xe')](_0xe153('0xf'),_0x4873b6,_0xe153('0x10'));logger[_0xe153('0x11')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4873b6,_0xe153('0x10'),JSON[_0xe153('0x12')](_0x2efdf6));if(_0x2efdf6[_0xe153('0x13')]){if(_0x2efdf6[_0xe153('0x13')][_0xe153('0x14')]===0x1f4){logger['error'](_0xe153('0xf'),_0x4873b6,_0x2efdf6[_0xe153('0x13')][_0xe153('0x15')]);return _0x2be20e(_0x2efdf6['error']['message']);}logger[_0xe153('0x13')](_0xe153('0xf'),_0x4873b6,_0x2efdf6['error'][_0xe153('0x15')]);return _0x12dd00(_0x2efdf6[_0xe153('0x13')]['message']);}else{logger[_0xe153('0xe')](_0xe153('0xf'),_0x4873b6,_0xe153('0x10'));_0x12dd00(_0x2efdf6[_0xe153('0x16')]['message']);}})['catch'](function(_0x41b967){logger[_0xe153('0x13')](_0xe153('0xf'),_0x4873b6,_0x41b967);_0x2be20e(_0x41b967);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index bf760c6..950ef90 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe205=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xe205,0xa7));var _0x5e20=function(_0x2b792e,_0x2b5915){_0x2b792e=_0x2b792e-0x0;var _0xc9707d=_0xe205[_0x2b792e];return _0xc9707d;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/:id',auth[_0x5e20('0xb')](),controller['show']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['getConfigurations']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0x10')]);router[_0x5e20('0x11')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x12')]);router['put'](_0x5e20('0x13'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x14')]);router['delete'](_0x5e20('0x13'),auth['isAuthenticated'](),controller[_0x5e20('0x15')]);module['exports']=router; \ No newline at end of file +var _0x087b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4a148f,_0x583c0d){var _0x47eaec=function(_0xd0603b){while(--_0xd0603b){_0x4a148f['push'](_0x4a148f['shift']());}};_0x47eaec(++_0x583c0d);}(_0x087b,0x11a));var _0xb087=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x087b[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/fields',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x10')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x10')](_0xb087('0xd'),auth['isAuthenticated'](),controller[_0xb087('0x12')]);router[_0xb087('0x13')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x15')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);module[_0xb087('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 73e3a6d..66b887a 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5af=['exports','STRING','username','remoteUri'];(function(_0x42b4f4,_0x40eb51){var _0x1c0dfc=function(_0x58fee5){while(--_0x58fee5){_0x42b4f4['push'](_0x42b4f4['shift']());}};_0x1c0dfc(++_0x40eb51);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2ed118,_0x3e10dc){_0x2ed118=_0x2ed118-0x0;var _0x4ef91d=_0xe5af[_0x2ed118];return _0x4ef91d;};'use strict';var Sequelize=require('sequelize');module[_0xfe5a('0x0')]={'name':{'type':Sequelize[_0xfe5a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfe5a('0x1')],'unique':_0xfe5a('0x2')},'apiKey':{'type':Sequelize[_0xfe5a('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfe5a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x50f653,_0x7ecdee){var _0x3388ea=function(_0x1058a4){while(--_0x1058a4){_0x50f653['push'](_0x50f653['shift']());}};_0x3388ea(++_0x7ecdee);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x16b2e6,_0x1bcfae){_0x16b2e6=_0x16b2e6-0x0;var _0x344ae1=_0x4e2e[_0x16b2e6];return _0x344ae1;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f83344a..16b4bc3 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17e5=['count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','AccountId','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','GET','format','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','request-promise','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','limit','offset'];(function(_0x2cdf81,_0x2a56c7){var _0x254ded=function(_0x9a94cf){while(--_0x9a94cf){_0x2cdf81['push'](_0x2cdf81['shift']());}};_0x254ded(++_0x2a56c7);}(_0x17e5,0x173));var _0x517e=function(_0x3cb83f,_0x8ccc18){_0x3cb83f=_0x3cb83f-0x0;var _0x95880b=_0x17e5[_0x3cb83f];return _0x95880b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x517e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x517e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x517e('0x2'));var sox=require(_0x517e('0x3'));var csv=require('to-csv');var ejs=require(_0x517e('0x4'));var fs=require('fs');var fs_extra=require(_0x517e('0x5'));var _=require(_0x517e('0x6'));var squel=require('squel');var crypto=require(_0x517e('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x517e('0x8'));var toCsv=require(_0x517e('0x9'));var querystring=require(_0x517e('0xa'));var Papa=require('papaparse');var Redis=require(_0x517e('0xb'));var authService=require(_0x517e('0xc'));var qs=require(_0x517e('0xd'));var as=require(_0x517e('0xe'));var hardwareService=require(_0x517e('0xf'));var logger=require('../../config/logger')(_0x517e('0x10'));var utils=require(_0x517e('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x517e('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0x517e('0x13'));function respondWithStatusCode(_0x3ce368,_0x4018dd){_0x4018dd=_0x4018dd||0xcc;return function(_0x30030d){if(_0x30030d){return _0x3ce368[_0x517e('0x14')](_0x4018dd);}return _0x3ce368[_0x517e('0x15')](_0x4018dd)['end']();};}function respondWithResult(_0x374c26,_0x1d7039){_0x1d7039=_0x1d7039||0xc8;return function(_0x521a53){if(_0x521a53){return _0x374c26[_0x517e('0x15')](_0x1d7039)[_0x517e('0x16')](_0x521a53);}};}function respondWithFilteredResult(_0x4b1747,_0x38c7e9){return function(_0x113e42){if(_0x113e42){var _0x61657f=typeof _0x38c7e9['offset']==='undefined'&&typeof _0x38c7e9[_0x517e('0x17')]==='undefined';var _0x1977e2=_0x113e42['count'];var _0x5eb6b4=_0x61657f?0x0:_0x38c7e9[_0x517e('0x18')];var _0x345628=_0x61657f?_0x113e42[_0x517e('0x19')]:_0x38c7e9[_0x517e('0x18')]+_0x38c7e9[_0x517e('0x17')];var _0x3b0f52;if(_0x345628>=_0x1977e2){_0x345628=_0x1977e2;_0x3b0f52=0xc8;}else{_0x3b0f52=0xce;}_0x4b1747[_0x517e('0x15')](_0x3b0f52);return _0x4b1747[_0x517e('0x1a')](_0x517e('0x1b'),_0x5eb6b4+'-'+_0x345628+'/'+_0x1977e2)[_0x517e('0x16')](_0x113e42);}return null;};}function patchUpdates(_0x314e41){return function(_0x24cee3){try{jsonpatch[_0x517e('0x1c')](_0x24cee3,_0x314e41,!![]);}catch(_0x179a70){return BPromise[_0x517e('0x1d')](_0x179a70);}return _0x24cee3[_0x517e('0x1e')]();};}function saveUpdates(_0x41e978,_0x38b820){return function(_0x25e58e){if(_0x25e58e){return _0x25e58e[_0x517e('0x1f')](_0x41e978)[_0x517e('0x20')](function(_0x344c97){return _0x344c97;});}return null;};}function removeEntity(_0xc92515,_0x1c8df1){return function(_0x563e45){if(_0x563e45){return _0x563e45[_0x517e('0x21')]()['then'](function(){_0xc92515[_0x517e('0x15')](0xcc)[_0x517e('0x22')]();});}};}function handleEntityNotFound(_0x293238,_0x432489){return function(_0x443d7b){if(!_0x443d7b){_0x293238[_0x517e('0x14')](0x194);}return _0x443d7b;};}function handleError(_0x5599f5,_0xb5fe8a){_0xb5fe8a=_0xb5fe8a||0x1f4;return function(_0x9668d){logger[_0x517e('0x23')](_0x9668d[_0x517e('0x24')]);if(_0x9668d[_0x517e('0x25')]){delete _0x9668d[_0x517e('0x25')];}_0x5599f5[_0x517e('0x15')](_0xb5fe8a)[_0x517e('0x26')](_0x9668d);};}exports[_0x517e('0x27')]=function(_0xda40f5,_0x8cc935){var _0x52c623={},_0x32011b={},_0x50b6dc={'count':0x0,'rows':[]};var _0xa97bc4=_['map'](db[_0x517e('0x28')][_0x517e('0x29')],function(_0x3c4e31){return{'name':_0x3c4e31[_0x517e('0x2a')],'type':_0x3c4e31[_0x517e('0x2b')][_0x517e('0x2c')]};});_0x32011b[_0x517e('0x2d')]=_[_0x517e('0x2e')](_0xa97bc4,_0x517e('0x25'));_0x32011b['query']=_[_0x517e('0x2f')](_0xda40f5[_0x517e('0x30')]);_0x32011b[_0x517e('0x31')]=_['intersection'](_0x32011b[_0x517e('0x2d')],_0x32011b[_0x517e('0x30')]);_0x52c623[_0x517e('0x32')]=_[_0x517e('0x33')](_0x32011b['model'],qs[_0x517e('0x34')](_0xda40f5[_0x517e('0x30')][_0x517e('0x34')]));_0x52c623[_0x517e('0x32')]=_0x52c623['attributes'][_0x517e('0x35')]?_0x52c623[_0x517e('0x32')]:_0x32011b[_0x517e('0x2d')];if(!_0xda40f5['query'][_0x517e('0x36')](_0x517e('0x37'))){_0x52c623[_0x517e('0x17')]=qs['limit'](_0xda40f5[_0x517e('0x30')]['limit']);_0x52c623[_0x517e('0x18')]=qs[_0x517e('0x18')](_0xda40f5[_0x517e('0x30')]['offset']);}_0x52c623[_0x517e('0x38')]=qs['sort'](_0xda40f5['query']['sort']);_0x52c623[_0x517e('0x39')]=qs[_0x517e('0x31')](_[_0x517e('0x3a')](_0xda40f5['query'],_0x32011b[_0x517e('0x31')]),_0xa97bc4);if(_0xda40f5[_0x517e('0x30')][_0x517e('0x3b')]){_0x52c623[_0x517e('0x39')]=_[_0x517e('0x3c')](_0x52c623[_0x517e('0x39')],{'$or':_[_0x517e('0x2e')](_0xa97bc4,function(_0x2d0f89){if(_0x2d0f89[_0x517e('0x2b')]!==_0x517e('0x3d')){var _0xa60122={};_0xa60122[_0x2d0f89['name']]={'$like':'%'+_0xda40f5[_0x517e('0x30')][_0x517e('0x3b')]+'%'};return _0xa60122;}})});}_0x52c623=_[_0x517e('0x3c')]({},_0x52c623,_0xda40f5['options']);var _0x275568={'where':_0x52c623[_0x517e('0x39')]};return db[_0x517e('0x28')][_0x517e('0x19')](_0x275568)[_0x517e('0x20')](function(_0x1c401d){_0x50b6dc[_0x517e('0x19')]=_0x1c401d;if(_0xda40f5[_0x517e('0x30')][_0x517e('0x3e')]){_0x52c623[_0x517e('0x3f')]=[{'all':!![]}];}return db[_0x517e('0x28')][_0x517e('0x40')](_0x52c623);})['then'](function(_0x42789a){_0x50b6dc[_0x517e('0x41')]=_0x42789a;return _0x50b6dc;})[_0x517e('0x20')](respondWithFilteredResult(_0x8cc935,_0x52c623))[_0x517e('0x42')](handleError(_0x8cc935,null));};exports[_0x517e('0x43')]=function(_0x4744fb,_0x53fc36){var _0x5bcd58={'raw':![],'where':{'id':_0x4744fb[_0x517e('0x44')]['id']}},_0x2324e7={};_0x2324e7['model']=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x2324e7['query']=_[_0x517e('0x2f')](_0x4744fb[_0x517e('0x30')]);_0x2324e7[_0x517e('0x31')]=_[_0x517e('0x33')](_0x2324e7[_0x517e('0x2d')],_0x2324e7[_0x517e('0x30')]);_0x5bcd58[_0x517e('0x32')]=_['intersection'](_0x2324e7[_0x517e('0x2d')],qs[_0x517e('0x34')](_0x4744fb['query']['fields']));_0x5bcd58['attributes']=_0x5bcd58['attributes'][_0x517e('0x35')]?_0x5bcd58['attributes']:_0x2324e7[_0x517e('0x2d')];if(_0x4744fb['query'][_0x517e('0x3e')]){_0x5bcd58[_0x517e('0x3f')]=[{'all':!![]}];}_0x5bcd58=_[_0x517e('0x3c')]({},_0x5bcd58,_0x4744fb[_0x517e('0x45')]);return db[_0x517e('0x28')][_0x517e('0x46')](_0x5bcd58)[_0x517e('0x20')](handleEntityNotFound(_0x53fc36,null))[_0x517e('0x20')](respondWithResult(_0x53fc36,null))['catch'](handleError(_0x53fc36,null));};exports[_0x517e('0x47')]=function(_0x14d03c,_0x24c0d8){return db[_0x517e('0x28')]['create'](_0x14d03c['body'],{})[_0x517e('0x20')](respondWithResult(_0x24c0d8,0xc9))[_0x517e('0x42')](handleError(_0x24c0d8,null));};exports[_0x517e('0x1f')]=function(_0x4f6a8d,_0x51f67a){if(_0x4f6a8d['body']['id']){delete _0x4f6a8d[_0x517e('0x48')]['id'];}return db[_0x517e('0x28')][_0x517e('0x46')]({'where':{'id':_0x4f6a8d[_0x517e('0x44')]['id']}})[_0x517e('0x20')](handleEntityNotFound(_0x51f67a,null))['then'](saveUpdates(_0x4f6a8d[_0x517e('0x48')],null))[_0x517e('0x20')](respondWithResult(_0x51f67a,null))[_0x517e('0x42')](handleError(_0x51f67a,null));};exports['destroy']=function(_0x90f6f1,_0x17f78c){return db[_0x517e('0x28')][_0x517e('0x46')]({'where':{'id':_0x90f6f1['params']['id']}})[_0x517e('0x20')](handleEntityNotFound(_0x17f78c,null))[_0x517e('0x20')](removeEntity(_0x17f78c,null))[_0x517e('0x42')](handleError(_0x17f78c,null));};exports[_0x517e('0x49')]=function(_0x122146,_0x558398,_0x429266){var _0x727a96={};var _0xf268c3={};var _0x1448e1;var _0xdef0d;return db[_0x517e('0x28')][_0x517e('0x4a')]({'where':{'id':_0x122146['params']['id']}})[_0x517e('0x20')](handleEntityNotFound(_0x558398,null))[_0x517e('0x20')](function(_0x4768e8){if(_0x4768e8){_0x1448e1=_0x4768e8;_0xf268c3[_0x517e('0x2d')]=_['keys'](db[_0x517e('0x4b')]['rawAttributes']);_0xf268c3['query']=_[_0x517e('0x2f')](_0x122146[_0x517e('0x30')]);_0xf268c3[_0x517e('0x31')]=_[_0x517e('0x33')](_0xf268c3[_0x517e('0x2d')],_0xf268c3['query']);_0x727a96[_0x517e('0x32')]=_[_0x517e('0x33')](_0xf268c3[_0x517e('0x2d')],qs[_0x517e('0x34')](_0x122146[_0x517e('0x30')][_0x517e('0x34')]));_0x727a96[_0x517e('0x32')]=_0x727a96[_0x517e('0x32')][_0x517e('0x35')]?_0x727a96['attributes']:_0xf268c3[_0x517e('0x2d')];_0x727a96[_0x517e('0x38')]=qs[_0x517e('0x4c')](_0x122146[_0x517e('0x30')][_0x517e('0x4c')]);_0x727a96[_0x517e('0x39')]=qs['filters'](_[_0x517e('0x3a')](_0x122146['query'],_0xf268c3[_0x517e('0x31')]));if(_0x122146['query'][_0x517e('0x3b')]){_0x727a96['where']=_[_0x517e('0x3c')](_0x727a96[_0x517e('0x39')],{'$or':_[_0x517e('0x2e')](_0x727a96[_0x517e('0x32')],function(_0x48d1a7){var _0x86c745={};_0x86c745[_0x48d1a7]={'$like':'%'+_0x122146[_0x517e('0x30')]['filter']+'%'};return _0x86c745;})});}_0x727a96=_['merge']({},_0x727a96,_0x122146[_0x517e('0x45')]);return _0x1448e1[_0x517e('0x49')](_0x727a96);}})[_0x517e('0x20')](function(_0x20fdf2){if(_0x20fdf2){_0xdef0d=_0x20fdf2[_0x517e('0x35')];if(!_0x122146[_0x517e('0x30')][_0x517e('0x36')](_0x517e('0x37'))){_0x727a96[_0x517e('0x17')]=qs['limit'](_0x122146[_0x517e('0x30')][_0x517e('0x17')]);_0x727a96['offset']=qs[_0x517e('0x18')](_0x122146['query'][_0x517e('0x18')]);}return _0x1448e1['getConfigurations'](_0x727a96);}})[_0x517e('0x20')](function(_0x52f512){if(_0x52f512){return _0x52f512?{'count':_0xdef0d,'rows':_0x52f512}:null;}})[_0x517e('0x20')](respondWithResult(_0x558398,null))['catch'](handleError(_0x558398,null));};exports['addConfiguration']=function(_0x1441f3,_0x2c1c11,_0x25dea4){if(_0x1441f3[_0x517e('0x48')]['id']){delete _0x1441f3[_0x517e('0x48')]['id'];}return db['FreshsalesAccount'][_0x517e('0x4a')]({'where':{'id':_0x1441f3[_0x517e('0x44')]['id']}})[_0x517e('0x20')](handleEntityNotFound(_0x2c1c11,null))[_0x517e('0x20')](function(_0x47e2a){if(_0x47e2a){_0x1441f3[_0x517e('0x48')][_0x517e('0x4d')]=_0x47e2a['id'];_0x1441f3[_0x517e('0x48')]['Subjects']=integrations[_0x517e('0x4e')](_0x1441f3[_0x517e('0x48')][_0x517e('0x4f')],_0x1441f3['body']['type']);_0x1441f3['body'][_0x517e('0x50')]=integrations['getDescriptions'](_0x1441f3[_0x517e('0x48')]['channel'],_0x1441f3[_0x517e('0x48')][_0x517e('0x2b')]);return db[_0x517e('0x4b')][_0x517e('0x47')](_0x1441f3[_0x517e('0x48')],{'include':[{'model':db[_0x517e('0x51')],'as':'Subjects'},{'model':db[_0x517e('0x51')],'as':_0x517e('0x50')}]});}return null;})[_0x517e('0x20')](respondWithResult(_0x2c1c11,null))['catch'](handleError(_0x2c1c11,null));};exports[_0x517e('0x52')]=function(_0x58824e,_0x5d933a,_0x22169a){var _0x20fcae='';var _0x338e34='';return db[_0x517e('0x28')][_0x517e('0x4a')]({'where':{'id':_0x58824e[_0x517e('0x44')]['id']},'attributes':['id',_0x517e('0x53'),'remoteUri','apiKey']})[_0x517e('0x20')](handleEntityNotFound(_0x5d933a,null))[_0x517e('0x20')](function(_0x1781c4){if(_0x1781c4){_0x338e34=_0x1781c4['username'];_0x20fcae=_0x1781c4[_0x517e('0x54')];var _0x10a5e5=_0x1781c4[_0x517e('0x54')][_0x517e('0x55')](-0x1);if(_0x10a5e5==='/'){_0x20fcae=_0x20fcae[_0x517e('0x56')](0x0,_0x20fcae['lastIndexOf'](_0x10a5e5));}return rp({'method':_0x517e('0x57'),'uri':util[_0x517e('0x58')]('%s%s',_0x20fcae,_0x517e('0x59')),'headers':{'Authorization':_0x517e('0x5a')+_0x1781c4[_0x517e('0x5b')]},'json':!![]});}})[_0x517e('0x20')](function(_0x25e440){if(_0x25e440){var _0x335120=_0x25e440[_0x517e('0x5c')];var _0x43b538=![];var _0x5db1bc=null;for(_0x5db1bc=0x0;_0x5db1bc<_0x335120[_0x517e('0x35')];_0x5db1bc++){if(_0x335120[_0x5db1bc][_0x517e('0x5d')]===_0x338e34){_0x43b538=!![];}}if(_0x43b538){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x517e('0x5e')});}}})[_0x517e('0x20')](respondWithResult(_0x5d933a,null))[_0x517e('0x42')](function(_0x53ca77){var _0x14eba4=_0x58824e[_0x517e('0x30')][_0x517e('0x5f')]?0x1f4:_0x53ca77[_0x517e('0x60')]||0x1f4;logger['error'](_0x517e('0x61'),_0x517e('0x52'),_0x14eba4,JSON['stringify'](_0x53ca77));delete _0x53ca77[_0x517e('0x25')];if(_0x14eba4===0x191){_0x14eba4=0x190;}_0x5d933a['status'](_0x14eba4)[_0x517e('0x26')](_0x58824e[_0x517e('0x30')][_0x517e('0x5f')]?{'message':_0x517e('0x62'),'statusCode':_0x53ca77[_0x517e('0x60')]}:_0x53ca77);});}; \ No newline at end of file +var _0x8da0=['sort','where','pick','filter','map','merge','options','includeAll','include','rows','show','params','find','catch','create','body','getConfigurations','FreshsalesConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','findOne','username','remoteUri','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x95ca74,_0x40677e){var _0x3c67c9=function(_0x49f5ff){while(--_0x49f5ff){_0x95ca74['push'](_0x95ca74['shift']());}};_0x3c67c9(++_0x40677e);}(_0x8da0,0x1be));var _0x08da=function(_0x3e3369,_0x4a9e78){_0x3e3369=_0x3e3369-0x0;var _0x5d9ad2=_0x8da0[_0x3e3369];return _0x5d9ad2;};'use strict';var emlformat=require(_0x08da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08da('0x1'));var jsonpatch=require(_0x08da('0x2'));var rp=require(_0x08da('0x3'));var moment=require(_0x08da('0x4'));var BPromise=require(_0x08da('0x5'));var Mustache=require(_0x08da('0x6'));var util=require(_0x08da('0x7'));var path=require(_0x08da('0x8'));var sox=require('sox');var csv=require(_0x08da('0x9'));var ejs=require(_0x08da('0xa'));var fs=require('fs');var fs_extra=require(_0x08da('0xb'));var _=require(_0x08da('0xc'));var squel=require(_0x08da('0xd'));var crypto=require(_0x08da('0xe'));var jsforce=require(_0x08da('0xf'));var deskjs=require(_0x08da('0x10'));var toCsv=require(_0x08da('0x9'));var querystring=require(_0x08da('0x11'));var Papa=require(_0x08da('0x12'));var Redis=require(_0x08da('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x08da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08da('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x08da('0x16'));var db=require(_0x08da('0x17'))['db'];var integrations=require(_0x08da('0x18'));function respondWithStatusCode(_0x3dbb2e,_0x18a69a){_0x18a69a=_0x18a69a||0xcc;return function(_0x4a6b64){if(_0x4a6b64){return _0x3dbb2e[_0x08da('0x19')](_0x18a69a);}return _0x3dbb2e['status'](_0x18a69a)[_0x08da('0x1a')]();};}function respondWithResult(_0x323c3e,_0x26e82c){_0x26e82c=_0x26e82c||0xc8;return function(_0x20ee7c){if(_0x20ee7c){return _0x323c3e[_0x08da('0x1b')](_0x26e82c)[_0x08da('0x1c')](_0x20ee7c);}};}function respondWithFilteredResult(_0x548e33,_0x3f44a7){return function(_0x46e4d8){if(_0x46e4d8){var _0x544cac=typeof _0x3f44a7[_0x08da('0x1d')]===_0x08da('0x1e')&&typeof _0x3f44a7[_0x08da('0x1f')]===_0x08da('0x1e');var _0xb34f36=_0x46e4d8[_0x08da('0x20')];var _0x57a23a=_0x544cac?0x0:_0x3f44a7['offset'];var _0x384d1e=_0x544cac?_0x46e4d8[_0x08da('0x20')]:_0x3f44a7[_0x08da('0x1d')]+_0x3f44a7['limit'];var _0xd66c09;if(_0x384d1e>=_0xb34f36){_0x384d1e=_0xb34f36;_0xd66c09=0xc8;}else{_0xd66c09=0xce;}_0x548e33[_0x08da('0x1b')](_0xd66c09);return _0x548e33[_0x08da('0x21')](_0x08da('0x22'),_0x57a23a+'-'+_0x384d1e+'/'+_0xb34f36)['json'](_0x46e4d8);}return null;};}function patchUpdates(_0x37eca5){return function(_0x3d035b){try{jsonpatch[_0x08da('0x23')](_0x3d035b,_0x37eca5,!![]);}catch(_0x2b04ad){return BPromise['reject'](_0x2b04ad);}return _0x3d035b[_0x08da('0x24')]();};}function saveUpdates(_0x5c659f,_0x1e9a8b){return function(_0x59d6d6){if(_0x59d6d6){return _0x59d6d6[_0x08da('0x25')](_0x5c659f)[_0x08da('0x26')](function(_0x4178b2){return _0x4178b2;});}return null;};}function removeEntity(_0x3b59ba,_0x163b9b){return function(_0x1da60f){if(_0x1da60f){return _0x1da60f[_0x08da('0x27')]()[_0x08da('0x26')](function(){_0x3b59ba[_0x08da('0x1b')](0xcc)[_0x08da('0x1a')]();});}};}function handleEntityNotFound(_0x3515c8,_0x1c98e4){return function(_0x4124de){if(!_0x4124de){_0x3515c8['sendStatus'](0x194);}return _0x4124de;};}function handleError(_0x3d08af,_0x34dbab){_0x34dbab=_0x34dbab||0x1f4;return function(_0x216aa3){logger[_0x08da('0x28')](_0x216aa3[_0x08da('0x29')]);if(_0x216aa3[_0x08da('0x2a')]){delete _0x216aa3[_0x08da('0x2a')];}_0x3d08af[_0x08da('0x1b')](_0x34dbab)[_0x08da('0x2b')](_0x216aa3);};}exports['index']=function(_0x18adc0,_0x5b7beb){var _0x3b9e1a={},_0x465033={},_0x23fa21={'count':0x0,'rows':[]};var _0x10f014=_['map'](db[_0x08da('0x2c')][_0x08da('0x2d')],function(_0x28e79c){return{'name':_0x28e79c[_0x08da('0x2e')],'type':_0x28e79c[_0x08da('0x2f')]['key']};});_0x465033[_0x08da('0x30')]=_['map'](_0x10f014,'name');_0x465033[_0x08da('0x31')]=_[_0x08da('0x32')](_0x18adc0['query']);_0x465033[_0x08da('0x33')]=_[_0x08da('0x34')](_0x465033[_0x08da('0x30')],_0x465033['query']);_0x3b9e1a['attributes']=_[_0x08da('0x34')](_0x465033[_0x08da('0x30')],qs[_0x08da('0x35')](_0x18adc0[_0x08da('0x31')][_0x08da('0x35')]));_0x3b9e1a[_0x08da('0x36')]=_0x3b9e1a['attributes'][_0x08da('0x37')]?_0x3b9e1a[_0x08da('0x36')]:_0x465033[_0x08da('0x30')];if(!_0x18adc0['query'][_0x08da('0x38')](_0x08da('0x39'))){_0x3b9e1a[_0x08da('0x1f')]=qs[_0x08da('0x1f')](_0x18adc0[_0x08da('0x31')]['limit']);_0x3b9e1a[_0x08da('0x1d')]=qs[_0x08da('0x1d')](_0x18adc0[_0x08da('0x31')][_0x08da('0x1d')]);}_0x3b9e1a[_0x08da('0x3a')]=qs[_0x08da('0x3b')](_0x18adc0[_0x08da('0x31')][_0x08da('0x3b')]);_0x3b9e1a[_0x08da('0x3c')]=qs[_0x08da('0x33')](_[_0x08da('0x3d')](_0x18adc0[_0x08da('0x31')],_0x465033[_0x08da('0x33')]),_0x10f014);if(_0x18adc0[_0x08da('0x31')][_0x08da('0x3e')]){_0x3b9e1a[_0x08da('0x3c')]=_['merge'](_0x3b9e1a[_0x08da('0x3c')],{'$or':_[_0x08da('0x3f')](_0x10f014,function(_0x1db51b){if(_0x1db51b['type']!=='VIRTUAL'){var _0x6db9a4={};_0x6db9a4[_0x1db51b['name']]={'$like':'%'+_0x18adc0[_0x08da('0x31')][_0x08da('0x3e')]+'%'};return _0x6db9a4;}})});}_0x3b9e1a=_[_0x08da('0x40')]({},_0x3b9e1a,_0x18adc0[_0x08da('0x41')]);var _0x244744={'where':_0x3b9e1a[_0x08da('0x3c')]};return db['FreshsalesAccount'][_0x08da('0x20')](_0x244744)['then'](function(_0x271b58){_0x23fa21[_0x08da('0x20')]=_0x271b58;if(_0x18adc0[_0x08da('0x31')][_0x08da('0x42')]){_0x3b9e1a[_0x08da('0x43')]=[{'all':!![]}];}return db[_0x08da('0x2c')]['findAll'](_0x3b9e1a);})[_0x08da('0x26')](function(_0xd498fc){_0x23fa21[_0x08da('0x44')]=_0xd498fc;return _0x23fa21;})[_0x08da('0x26')](respondWithFilteredResult(_0x5b7beb,_0x3b9e1a))['catch'](handleError(_0x5b7beb,null));};exports[_0x08da('0x45')]=function(_0x30f754,_0x31a8b4){var _0x2307ce={'raw':![],'where':{'id':_0x30f754[_0x08da('0x46')]['id']}},_0x1d4e5b={};_0x1d4e5b[_0x08da('0x30')]=_[_0x08da('0x32')](db[_0x08da('0x2c')][_0x08da('0x2d')]);_0x1d4e5b[_0x08da('0x31')]=_[_0x08da('0x32')](_0x30f754[_0x08da('0x31')]);_0x1d4e5b[_0x08da('0x33')]=_[_0x08da('0x34')](_0x1d4e5b['model'],_0x1d4e5b[_0x08da('0x31')]);_0x2307ce[_0x08da('0x36')]=_[_0x08da('0x34')](_0x1d4e5b[_0x08da('0x30')],qs[_0x08da('0x35')](_0x30f754[_0x08da('0x31')][_0x08da('0x35')]));_0x2307ce[_0x08da('0x36')]=_0x2307ce['attributes'][_0x08da('0x37')]?_0x2307ce[_0x08da('0x36')]:_0x1d4e5b[_0x08da('0x30')];if(_0x30f754[_0x08da('0x31')][_0x08da('0x42')]){_0x2307ce[_0x08da('0x43')]=[{'all':!![]}];}_0x2307ce=_[_0x08da('0x40')]({},_0x2307ce,_0x30f754['options']);return db[_0x08da('0x2c')][_0x08da('0x47')](_0x2307ce)['then'](handleEntityNotFound(_0x31a8b4,null))[_0x08da('0x26')](respondWithResult(_0x31a8b4,null))[_0x08da('0x48')](handleError(_0x31a8b4,null));};exports[_0x08da('0x49')]=function(_0x262e67,_0x54f268){return db[_0x08da('0x2c')][_0x08da('0x49')](_0x262e67[_0x08da('0x4a')],{})[_0x08da('0x26')](respondWithResult(_0x54f268,0xc9))[_0x08da('0x48')](handleError(_0x54f268,null));};exports[_0x08da('0x25')]=function(_0x33ceb7,_0x2b3a3e){if(_0x33ceb7['body']['id']){delete _0x33ceb7['body']['id'];}return db['FreshsalesAccount'][_0x08da('0x47')]({'where':{'id':_0x33ceb7[_0x08da('0x46')]['id']}})[_0x08da('0x26')](handleEntityNotFound(_0x2b3a3e,null))[_0x08da('0x26')](saveUpdates(_0x33ceb7[_0x08da('0x4a')],null))[_0x08da('0x26')](respondWithResult(_0x2b3a3e,null))[_0x08da('0x48')](handleError(_0x2b3a3e,null));};exports[_0x08da('0x27')]=function(_0x1b134e,_0x1b397f){return db[_0x08da('0x2c')]['find']({'where':{'id':_0x1b134e[_0x08da('0x46')]['id']}})[_0x08da('0x26')](handleEntityNotFound(_0x1b397f,null))[_0x08da('0x26')](removeEntity(_0x1b397f,null))[_0x08da('0x48')](handleError(_0x1b397f,null));};exports[_0x08da('0x4b')]=function(_0x4f5b39,_0x479f11,_0x3bc4fa){var _0x915d3e={};var _0x3332e2={};var _0x3c60ae;var _0x175fd2;return db[_0x08da('0x2c')]['findOne']({'where':{'id':_0x4f5b39['params']['id']}})['then'](handleEntityNotFound(_0x479f11,null))[_0x08da('0x26')](function(_0x58a633){if(_0x58a633){_0x3c60ae=_0x58a633;_0x3332e2[_0x08da('0x30')]=_[_0x08da('0x32')](db[_0x08da('0x4c')][_0x08da('0x2d')]);_0x3332e2['query']=_[_0x08da('0x32')](_0x4f5b39[_0x08da('0x31')]);_0x3332e2[_0x08da('0x33')]=_[_0x08da('0x34')](_0x3332e2[_0x08da('0x30')],_0x3332e2['query']);_0x915d3e[_0x08da('0x36')]=_['intersection'](_0x3332e2[_0x08da('0x30')],qs['fields'](_0x4f5b39[_0x08da('0x31')][_0x08da('0x35')]));_0x915d3e[_0x08da('0x36')]=_0x915d3e[_0x08da('0x36')][_0x08da('0x37')]?_0x915d3e['attributes']:_0x3332e2[_0x08da('0x30')];_0x915d3e[_0x08da('0x3a')]=qs[_0x08da('0x3b')](_0x4f5b39[_0x08da('0x31')][_0x08da('0x3b')]);_0x915d3e[_0x08da('0x3c')]=qs[_0x08da('0x33')](_[_0x08da('0x3d')](_0x4f5b39[_0x08da('0x31')],_0x3332e2[_0x08da('0x33')]));if(_0x4f5b39[_0x08da('0x31')][_0x08da('0x3e')]){_0x915d3e[_0x08da('0x3c')]=_[_0x08da('0x40')](_0x915d3e[_0x08da('0x3c')],{'$or':_[_0x08da('0x3f')](_0x915d3e[_0x08da('0x36')],function(_0x15829b){var _0x2ef732={};_0x2ef732[_0x15829b]={'$like':'%'+_0x4f5b39[_0x08da('0x31')][_0x08da('0x3e')]+'%'};return _0x2ef732;})});}_0x915d3e=_['merge']({},_0x915d3e,_0x4f5b39[_0x08da('0x41')]);return _0x3c60ae[_0x08da('0x4b')](_0x915d3e);}})[_0x08da('0x26')](function(_0x754fb){if(_0x754fb){_0x175fd2=_0x754fb[_0x08da('0x37')];if(!_0x4f5b39[_0x08da('0x31')]['hasOwnProperty']('nolimit')){_0x915d3e[_0x08da('0x1f')]=qs[_0x08da('0x1f')](_0x4f5b39[_0x08da('0x31')][_0x08da('0x1f')]);_0x915d3e[_0x08da('0x1d')]=qs[_0x08da('0x1d')](_0x4f5b39[_0x08da('0x31')][_0x08da('0x1d')]);}return _0x3c60ae[_0x08da('0x4b')](_0x915d3e);}})['then'](function(_0x13fa18){if(_0x13fa18){return _0x13fa18?{'count':_0x175fd2,'rows':_0x13fa18}:null;}})[_0x08da('0x26')](respondWithResult(_0x479f11,null))['catch'](handleError(_0x479f11,null));};exports['addConfiguration']=function(_0x26b1cc,_0x28c7f9,_0x185e77){if(_0x26b1cc[_0x08da('0x4a')]['id']){delete _0x26b1cc[_0x08da('0x4a')]['id'];}return db[_0x08da('0x2c')]['findOne']({'where':{'id':_0x26b1cc[_0x08da('0x46')]['id']}})[_0x08da('0x26')](handleEntityNotFound(_0x28c7f9,null))[_0x08da('0x26')](function(_0x562a35){if(_0x562a35){_0x26b1cc[_0x08da('0x4a')][_0x08da('0x4d')]=_0x562a35['id'];_0x26b1cc[_0x08da('0x4a')][_0x08da('0x4e')]=integrations[_0x08da('0x4f')](_0x26b1cc[_0x08da('0x4a')]['channel'],_0x26b1cc['body'][_0x08da('0x2f')]);_0x26b1cc['body'][_0x08da('0x50')]=integrations[_0x08da('0x51')](_0x26b1cc[_0x08da('0x4a')][_0x08da('0x52')],_0x26b1cc[_0x08da('0x4a')][_0x08da('0x2f')]);return db[_0x08da('0x4c')][_0x08da('0x49')](_0x26b1cc[_0x08da('0x4a')],{'include':[{'model':db[_0x08da('0x53')],'as':_0x08da('0x4e')},{'model':db['FreshsalesField'],'as':_0x08da('0x50')}]});}return null;})['then'](respondWithResult(_0x28c7f9,null))[_0x08da('0x48')](handleError(_0x28c7f9,null));};exports['getFields']=function(_0x5ee0ac,_0x26be3e,_0x2e69c4){var _0x57aadf='';var _0x1ac40b='';return db[_0x08da('0x2c')][_0x08da('0x54')]({'where':{'id':_0x5ee0ac['params']['id']},'attributes':['id',_0x08da('0x55'),_0x08da('0x56'),'apiKey']})[_0x08da('0x26')](handleEntityNotFound(_0x26be3e,null))['then'](function(_0x1afc8b){if(_0x1afc8b){_0x1ac40b=_0x1afc8b[_0x08da('0x55')];_0x57aadf=_0x1afc8b[_0x08da('0x56')];var _0x5260af=_0x1afc8b[_0x08da('0x56')]['slice'](-0x1);if(_0x5260af==='/'){_0x57aadf=_0x57aadf['substring'](0x0,_0x57aadf[_0x08da('0x57')](_0x5260af));}return rp({'method':_0x08da('0x58'),'uri':util[_0x08da('0x59')](_0x08da('0x5a'),_0x57aadf,_0x08da('0x5b')),'headers':{'Authorization':_0x08da('0x5c')+_0x1afc8b['apiKey']},'json':!![]});}})[_0x08da('0x26')](function(_0x47d557){if(_0x47d557){var _0x3a2b09=_0x47d557[_0x08da('0x5d')];var _0x1a9467=![];var _0x72abaa=null;for(_0x72abaa=0x0;_0x72abaa<_0x3a2b09['length'];_0x72abaa++){if(_0x3a2b09[_0x72abaa]['email']===_0x1ac40b){_0x1a9467=!![];}}if(_0x1a9467){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x08da('0x5e')});}}})[_0x08da('0x26')](respondWithResult(_0x26be3e,null))[_0x08da('0x48')](function(_0x281a7e){var _0x362bad=_0x5ee0ac[_0x08da('0x31')]['test']?0x1f4:_0x281a7e[_0x08da('0x5f')]||0x1f4;logger[_0x08da('0x28')](_0x08da('0x60'),_0x08da('0x61'),_0x362bad,JSON[_0x08da('0x62')](_0x281a7e));delete _0x281a7e[_0x08da('0x2a')];if(_0x362bad===0x191){_0x362bad=0x190;}_0x26be3e['status'](_0x362bad)[_0x08da('0x2b')](_0x5ee0ac['query'][_0x08da('0x63')]?{'message':_0x08da('0x64'),'statusCode':_0x281a7e[_0x08da('0x5f')]}:_0x281a7e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 50a9e19..6772442 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d11=['../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','moment','request-promise','path','./intFreshsalesAccount.attributes'];(function(_0x394f6c,_0x23cee7){var _0x2fb51e=function(_0xdc1bb0){while(--_0xdc1bb0){_0x394f6c['push'](_0x394f6c['shift']());}};_0x2fb51e(++_0x23cee7);}(_0x6d11,0xbf));var _0x16d1=function(_0x1be941,_0x4db4ab){_0x1be941=_0x1be941-0x0;var _0x2762b8=_0x6d11[_0x1be941];return _0x2762b8;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));var integrations=require(_0x16d1('0x7'));module[_0x16d1('0x8')]=function(_0x38626d,_0x1009dc){return _0x38626d[_0x16d1('0x9')](_0x16d1('0xa'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9582=['bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment'];(function(_0x2c13b1,_0x33bb87){var _0x35bd0d=function(_0x122b08){while(--_0x122b08){_0x2c13b1['push'](_0x2c13b1['shift']());}};_0x35bd0d(++_0x33bb87);}(_0x9582,0x95));var _0x2958=function(_0x4f6afe,_0x2d3c8f){_0x4f6afe=_0x4f6afe-0x0;var _0x5212c7=_0x9582[_0x4f6afe];return _0x5212c7;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));var integrations=require(_0x2958('0xa'));module[_0x2958('0xb')]=function(_0x88ffaa,_0x309525){return _0x88ffaa[_0x2958('0xc')](_0x2958('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 8bb0e81..d5911c9 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5464=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowFreshsalesAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug'];(function(_0x2cf2b2,_0xf75b5){var _0x1cfd68=function(_0x1ec4ab){while(--_0x1ec4ab){_0x2cf2b2['push'](_0x2cf2b2['shift']());}};_0x1cfd68(++_0xf75b5);}(_0x5464,0x15d));var _0x4546=function(_0x373f62,_0x2bbe33){_0x373f62=_0x373f62-0x0;var _0x51b16b=_0x5464[_0x373f62];return _0x51b16b;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});}exports[_0x4546('0x14')]=function(_0x57d8de){var _0x4ffd6b=this;return new Promise(function(_0x5780a7,_0x330235){return db[_0x4546('0x15')][_0x4546('0x16')]({'raw':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x18')]===undefined?!![]:![]:!![],'where':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x19')]||null:null,'attributes':_0x57d8de[_0x4546('0x17')]?_0x57d8de['options'][_0x4546('0x1a')]||null:null,'limit':_0x57d8de[_0x4546('0x17')]?_0x57d8de['options'][_0x4546('0x1b')]||null:null,'include':_0x57d8de[_0x4546('0x17')]?_0x57d8de[_0x4546('0x17')][_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x57d8de[_0x4546('0x17')]['include'],function(_0x3dab5c){return{'model':db[_0x3dab5c[_0x4546('0x1e')]],'as':_0x3dab5c['as'],'attributes':_0x3dab5c['attributes'],'include':_0x3dab5c[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x3dab5c[_0x4546('0x1c')],function(_0x4467ee){return{'model':db[_0x4467ee[_0x4546('0x1e')]],'as':_0x4467ee['as'],'attributes':_0x4467ee['attributes'],'include':_0x4467ee[_0x4546('0x1c')]?_[_0x4546('0x1d')](_0x4467ee[_0x4546('0x1c')],function(_0x48fc36){return{'model':db[_0x48fc36['model']],'as':_0x48fc36['as'],'attributes':_0x48fc36[_0x4546('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4546('0xa')](function(_0x15611c){logger[_0x4546('0xb')](_0x4546('0x14'),_0x57d8de);logger[_0x4546('0xd')](_0x4546('0x14'),_0x57d8de,JSON['stringify'](_0x15611c));_0x5780a7(_0x15611c);})[_0x4546('0x13')](function(_0x52c546){logger[_0x4546('0x10')](_0x4546('0x14'),_0x52c546['message'],_0x57d8de);_0x330235(_0x4ffd6b['error'](0x1f4,_0x52c546[_0x4546('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x3c7c7d){var _0x58b69=this;return new Promise(function(_0x480d8e,_0x5f0226){return db[_0x4546('0x15')][_0x4546('0x1f')]({'raw':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d['options'][_0x4546('0x18')]===undefined?!![]:![]:!![],'where':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d['options'][_0x4546('0x19')]||null:null,'attributes':_0x3c7c7d['options']?_0x3c7c7d[_0x4546('0x17')][_0x4546('0x1a')]||null:null,'include':_0x3c7c7d[_0x4546('0x17')]?_0x3c7c7d[_0x4546('0x17')]['include']?_[_0x4546('0x1d')](_0x3c7c7d[_0x4546('0x17')][_0x4546('0x1c')],function(_0x298bef){return{'model':db[_0x298bef[_0x4546('0x1e')]],'as':_0x298bef['as'],'attributes':_0x298bef[_0x4546('0x1a')],'include':_0x298bef['include']?_[_0x4546('0x1d')](_0x298bef[_0x4546('0x1c')],function(_0x549f48){return{'model':db[_0x549f48['model']],'as':_0x549f48['as'],'attributes':_0x549f48[_0x4546('0x1a')],'include':_0x549f48[_0x4546('0x1c')]?_['map'](_0x549f48[_0x4546('0x1c')],function(_0x25066c){return{'model':db[_0x25066c['model']],'as':_0x25066c['as'],'attributes':_0x25066c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4546('0xa')](function(_0x141fe8){logger[_0x4546('0xb')](_0x4546('0x20'),_0x3c7c7d);logger[_0x4546('0xd')](_0x4546('0x20'),_0x3c7c7d,JSON['stringify'](_0x141fe8));_0x480d8e(_0x141fe8);})[_0x4546('0x13')](function(_0x33307f){logger['error'](_0x4546('0x20'),_0x33307f['message'],_0x3c7c7d);_0x5f0226(_0x58b69[_0x4546('0x10')](0x1f4,_0x33307f[_0x4546('0x12')]));});});}; \ No newline at end of file +var _0xc6ac=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowFreshsalesAccount','find','lodash','util','moment','bluebird'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3df762,_0x28f157){_0x3df762=_0x3df762-0x0;var _0x568906=_0xc6ac[_0x3df762];return _0x568906;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')]({'raw':_0x33079c[_0xcc6a('0x1b')]?_0x33079c['options'][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'limit':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1f')]||null:null,'include':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')]['include']?_[_0xcc6a('0x20')](_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x21')],function(_0x581aae){return{'model':db[_0x581aae[_0xcc6a('0x22')]],'as':_0x581aae['as'],'attributes':_0x581aae[_0xcc6a('0x1e')],'include':_0x581aae[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x581aae[_0xcc6a('0x21')],function(_0x5fc697){return{'model':db[_0x5fc697['model']],'as':_0x5fc697['as'],'attributes':_0x5fc697[_0xcc6a('0x1e')],'include':_0x5fc697[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x5fc697['include'],function(_0x3afb3a){return{'model':db[_0x3afb3a[_0xcc6a('0x22')]],'as':_0x3afb3a['as'],'attributes':_0x3afb3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x8b1b2b){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger['debug'](_0xcc6a('0x18'),_0x33079c,JSON[_0xcc6a('0x23')](_0x8b1b2b));_0x2d9585(_0x8b1b2b);})[_0xcc6a('0x24')](function(_0x4f176b){logger[_0xcc6a('0x15')]('GetFreshsalesAccount',_0x4f176b['message'],_0x33079c);_0x412bc7(_0x12ef33[_0xcc6a('0x15')](0x1f4,_0x4f176b[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x25')]=function(_0x11b481){var _0x2b575d=this;return new Promise(function(_0x131138,_0x4e2de4){return db[_0xcc6a('0x19')][_0xcc6a('0x26')]({'raw':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x11b481['options']?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'include':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x11b481[_0xcc6a('0x1b')]['include'],function(_0x5d2287){return{'model':db[_0x5d2287['model']],'as':_0x5d2287['as'],'attributes':_0x5d2287['attributes'],'include':_0x5d2287['include']?_[_0xcc6a('0x20')](_0x5d2287[_0xcc6a('0x21')],function(_0x1101ec){return{'model':db[_0x1101ec[_0xcc6a('0x22')]],'as':_0x1101ec['as'],'attributes':_0x1101ec[_0xcc6a('0x1e')],'include':_0x1101ec['include']?_['map'](_0x1101ec[_0xcc6a('0x21')],function(_0x11173a){return{'model':db[_0x11173a[_0xcc6a('0x22')]],'as':_0x11173a['as'],'attributes':_0x11173a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x2207df){logger[_0xcc6a('0x10')](_0xcc6a('0x25'),_0x11b481);logger[_0xcc6a('0x12')](_0xcc6a('0x25'),_0x11b481,JSON[_0xcc6a('0x23')](_0x2207df));_0x131138(_0x2207df);})[_0xcc6a('0x24')](function(_0x2a1cd2){logger[_0xcc6a('0x15')](_0xcc6a('0x25'),_0x2a1cd2[_0xcc6a('0x17')],_0x11b481);_0x4e2de4(_0x2b575d[_0xcc6a('0x15')](0x1f4,_0x2a1cd2[_0xcc6a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 907ab3a..9bc7c2f 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb81b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','put','/:id','update','destroy','util','path'];(function(_0x1fe5f5,_0x171ac6){var _0x4b6d9d=function(_0x247f88){while(--_0x247f88){_0x1fe5f5['push'](_0x1fe5f5['shift']());}};_0x4b6d9d(++_0x171ac6);}(_0xb81b,0x166));var _0xbb81=function(_0x2967ee,_0xc761a1){_0x2967ee=_0x2967ee-0x0;var _0x5ca489=_0xb81b[_0x2967ee];return _0x5ca489;};'use strict';var multer=require('multer');var util=require(_0xbb81('0x0'));var path=require(_0xbb81('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb81('0x2'));var router=express[_0xbb81('0x3')]();var fs_extra=require(_0xbb81('0x4'));var auth=require(_0xbb81('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbb81('0x6'));var controller=require(_0xbb81('0x7'));router[_0xbb81('0x8')]('/',auth[_0xbb81('0x9')](),controller[_0xbb81('0xa')]);router[_0xbb81('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xbb81('0xb'),auth[_0xbb81('0x9')](),controller[_0xbb81('0xc')]);router[_0xbb81('0x8')](_0xbb81('0xd'),auth[_0xbb81('0x9')](),controller['getDescriptions']);router[_0xbb81('0x8')](_0xbb81('0xe'),auth[_0xbb81('0x9')](),controller['getFields']);router[_0xbb81('0xf')]('/',auth[_0xbb81('0x9')](),controller['create']);router[_0xbb81('0x10')](_0xbb81('0x11'),auth[_0xbb81('0x9')](),controller[_0xbb81('0x12')]);router['delete'](_0xbb81('0x11'),auth[_0xbb81('0x9')](),controller[_0xbb81('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9037=['../../components/auth/service','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show','getSubjects','/:id/fields','getFields','put','update','/:id','destroy','multer','util','connect-timeout','express'];(function(_0x2a76fa,_0x1cee7d){var _0x2d2442=function(_0x2f5e81){while(--_0x2f5e81){_0x2a76fa['push'](_0x2a76fa['shift']());}};_0x2d2442(++_0x1cee7d);}(_0x9037,0xfb));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7903('0x0'));var util=require(_0x7903('0x1'));var path=require('path');var timeout=require(_0x7903('0x2'));var express=require(_0x7903('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7903('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7903('0x5'));router[_0x7903('0x6')]('/',auth['isAuthenticated'](),controller[_0x7903('0x7')]);router[_0x7903('0x6')]('/:id',auth[_0x7903('0x8')](),controller[_0x7903('0x9')]);router[_0x7903('0x6')]('/:id/subjects',auth[_0x7903('0x8')](),controller[_0x7903('0xa')]);router[_0x7903('0x6')]('/:id/descriptions',auth[_0x7903('0x8')](),controller['getDescriptions']);router['get'](_0x7903('0xb'),auth[_0x7903('0x8')](),controller[_0x7903('0xc')]);router['post']('/',auth[_0x7903('0x8')](),controller['create']);router[_0x7903('0xd')]('/:id',auth[_0x7903('0x8')](),controller[_0x7903('0xe')]);router['delete'](_0x7903('0xf'),auth[_0x7903('0x8')](),controller[_0x7903('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1733910..e25650c 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb86d=['sequelize','exports','STRING'];(function(_0x5130d3,_0x2d6ef6){var _0x1ca9df=function(_0xd37bec){while(--_0xd37bec){_0x5130d3['push'](_0x5130d3['shift']());}};_0x1ca9df(++_0x2d6ef6);}(_0xb86d,0x18c));var _0xdb86=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb86d[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xdb86('0x0'));module[_0xdb86('0x1')]={'name':{'type':Sequelize[_0xdb86('0x2')]},'description':{'type':Sequelize[_0xdb86('0x2')]}}; \ No newline at end of file +var _0xe2f6=['STRING','sequelize'];(function(_0x5455a9,_0x5681b5){var _0xc14b0=function(_0x3a5e8e){while(--_0x3a5e8e){_0x5455a9['push'](_0x5455a9['shift']());}};_0xc14b0(++_0x5681b5);}(_0xe2f6,0x167));var _0x6e2f=function(_0x526c2f,_0x1f12e3){_0x526c2f=_0x526c2f-0x0;var _0x24f3a1=_0xe2f6[_0x526c2f];return _0x24f3a1;};'use strict';var Sequelize=require(_0x6e2f('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e2f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 3850327..0cbfbc6 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6af=['hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','create','catch','body','getSubjects','FreshsalesField','rawAttributes','order','nolimit','getDescriptions','findOne','pick','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','save','update','then','error','stack','name','map','FreshsalesConfiguration','fieldName','key','model','query','filters','attributes','intersection','fields','length'];(function(_0x522429,_0x28f03){var _0x3ef649=function(_0x1c6d22){while(--_0x1c6d22){_0x522429['push'](_0x522429['shift']());}};_0x3ef649(++_0x28f03);}(_0xe6af,0x10f));var _0xfe6a=function(_0x2ce1b7,_0x3834e2){_0x2ce1b7=_0x2ce1b7-0x0;var _0x390af1=_0xe6af[_0x2ce1b7];return _0x390af1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe6a('0x0'));var zipdir=require(_0xfe6a('0x1'));var jsonpatch=require(_0xfe6a('0x2'));var rp=require(_0xfe6a('0x3'));var moment=require(_0xfe6a('0x4'));var BPromise=require(_0xfe6a('0x5'));var Mustache=require(_0xfe6a('0x6'));var util=require(_0xfe6a('0x7'));var path=require(_0xfe6a('0x8'));var sox=require(_0xfe6a('0x9'));var csv=require(_0xfe6a('0xa'));var ejs=require(_0xfe6a('0xb'));var fs=require('fs');var fs_extra=require(_0xfe6a('0xc'));var _=require('lodash');var squel=require(_0xfe6a('0xd'));var crypto=require(_0xfe6a('0xe'));var jsforce=require(_0xfe6a('0xf'));var deskjs=require(_0xfe6a('0x10'));var toCsv=require(_0xfe6a('0xa'));var querystring=require(_0xfe6a('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe6a('0x12'));var qs=require(_0xfe6a('0x13'));var as=require(_0xfe6a('0x14'));var hardwareService=require(_0xfe6a('0x15'));var logger=require(_0xfe6a('0x16'))(_0xfe6a('0x17'));var utils=require(_0xfe6a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xfe6a('0x19'));var db=require(_0xfe6a('0x1a'))['db'];function respondWithStatusCode(_0x48b44e,_0x29540f){_0x29540f=_0x29540f||0xcc;return function(_0x3fcefb){if(_0x3fcefb){return _0x48b44e[_0xfe6a('0x1b')](_0x29540f);}return _0x48b44e['status'](_0x29540f)[_0xfe6a('0x1c')]();};}function respondWithResult(_0x42ecbf,_0x412ee8){_0x412ee8=_0x412ee8||0xc8;return function(_0x28c5b5){if(_0x28c5b5){return _0x42ecbf[_0xfe6a('0x1d')](_0x412ee8)[_0xfe6a('0x1e')](_0x28c5b5);}};}function respondWithFilteredResult(_0x128184,_0x59ed0c){return function(_0x275f51){if(_0x275f51){var _0x5c4679=typeof _0x59ed0c[_0xfe6a('0x1f')]===_0xfe6a('0x20')&&typeof _0x59ed0c['limit']===_0xfe6a('0x20');var _0x2154cf=_0x275f51[_0xfe6a('0x21')];var _0x485303=_0x5c4679?0x0:_0x59ed0c['offset'];var _0x3ceca5=_0x5c4679?_0x275f51[_0xfe6a('0x21')]:_0x59ed0c['offset']+_0x59ed0c[_0xfe6a('0x22')];var _0x28aafe;if(_0x3ceca5>=_0x2154cf){_0x3ceca5=_0x2154cf;_0x28aafe=0xc8;}else{_0x28aafe=0xce;}_0x128184[_0xfe6a('0x1d')](_0x28aafe);return _0x128184['set'](_0xfe6a('0x23'),_0x485303+'-'+_0x3ceca5+'/'+_0x2154cf)[_0xfe6a('0x1e')](_0x275f51);}return null;};}function patchUpdates(_0x4ecd23){return function(_0xf18a4d){try{jsonpatch['apply'](_0xf18a4d,_0x4ecd23,!![]);}catch(_0x3b25c7){return BPromise['reject'](_0x3b25c7);}return _0xf18a4d[_0xfe6a('0x24')]();};}function saveUpdates(_0x523259,_0xb96caf){return function(_0x277045){if(_0x277045){return _0x277045[_0xfe6a('0x25')](_0x523259)['then'](function(_0x1dc7cc){return _0x1dc7cc;});}return null;};}function removeEntity(_0x2d78fb,_0x3e9718){return function(_0x2abce2){if(_0x2abce2){return _0x2abce2['destroy']()[_0xfe6a('0x26')](function(){_0x2d78fb[_0xfe6a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8493a6,_0xd28abe){return function(_0x393d02){if(!_0x393d02){_0x8493a6[_0xfe6a('0x1b')](0x194);}return _0x393d02;};}function handleError(_0x360b30,_0x18ae3a){_0x18ae3a=_0x18ae3a||0x1f4;return function(_0x2430fe){logger[_0xfe6a('0x27')](_0x2430fe[_0xfe6a('0x28')]);if(_0x2430fe[_0xfe6a('0x29')]){delete _0x2430fe[_0xfe6a('0x29')];}_0x360b30[_0xfe6a('0x1d')](_0x18ae3a)['send'](_0x2430fe);};}exports['index']=function(_0x3c6a9b,_0x36eb09){var _0x3e189e={},_0x4f710c={},_0x26b7b9={'count':0x0,'rows':[]};var _0x24c0e3=_[_0xfe6a('0x2a')](db[_0xfe6a('0x2b')]['rawAttributes'],function(_0x355772){return{'name':_0x355772[_0xfe6a('0x2c')],'type':_0x355772['type'][_0xfe6a('0x2d')]};});_0x4f710c[_0xfe6a('0x2e')]=_[_0xfe6a('0x2a')](_0x24c0e3,_0xfe6a('0x29'));_0x4f710c[_0xfe6a('0x2f')]=_['keys'](_0x3c6a9b[_0xfe6a('0x2f')]);_0x4f710c[_0xfe6a('0x30')]=_['intersection'](_0x4f710c[_0xfe6a('0x2e')],_0x4f710c[_0xfe6a('0x2f')]);_0x3e189e[_0xfe6a('0x31')]=_[_0xfe6a('0x32')](_0x4f710c[_0xfe6a('0x2e')],qs['fields'](_0x3c6a9b[_0xfe6a('0x2f')][_0xfe6a('0x33')]));_0x3e189e[_0xfe6a('0x31')]=_0x3e189e[_0xfe6a('0x31')][_0xfe6a('0x34')]?_0x3e189e[_0xfe6a('0x31')]:_0x4f710c[_0xfe6a('0x2e')];if(!_0x3c6a9b[_0xfe6a('0x2f')][_0xfe6a('0x35')]('nolimit')){_0x3e189e['limit']=qs['limit'](_0x3c6a9b['query'][_0xfe6a('0x22')]);_0x3e189e[_0xfe6a('0x1f')]=qs[_0xfe6a('0x1f')](_0x3c6a9b[_0xfe6a('0x2f')][_0xfe6a('0x1f')]);}_0x3e189e['order']=qs[_0xfe6a('0x36')](_0x3c6a9b[_0xfe6a('0x2f')][_0xfe6a('0x36')]);_0x3e189e[_0xfe6a('0x37')]=qs[_0xfe6a('0x30')](_['pick'](_0x3c6a9b['query'],_0x4f710c[_0xfe6a('0x30')]),_0x24c0e3);if(_0x3c6a9b['query'][_0xfe6a('0x38')]){_0x3e189e[_0xfe6a('0x37')]=_[_0xfe6a('0x39')](_0x3e189e[_0xfe6a('0x37')],{'$or':_['map'](_0x24c0e3,function(_0x329ac8){if(_0x329ac8[_0xfe6a('0x3a')]!==_0xfe6a('0x3b')){var _0x428aa1={};_0x428aa1[_0x329ac8[_0xfe6a('0x29')]]={'$like':'%'+_0x3c6a9b[_0xfe6a('0x2f')][_0xfe6a('0x38')]+'%'};return _0x428aa1;}})});}_0x3e189e=_[_0xfe6a('0x39')]({},_0x3e189e,_0x3c6a9b['options']);var _0x87923={'where':_0x3e189e[_0xfe6a('0x37')]};return db[_0xfe6a('0x2b')][_0xfe6a('0x21')](_0x87923)[_0xfe6a('0x26')](function(_0x277729){_0x26b7b9[_0xfe6a('0x21')]=_0x277729;if(_0x3c6a9b[_0xfe6a('0x2f')][_0xfe6a('0x3c')]){_0x3e189e[_0xfe6a('0x3d')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xfe6a('0x3e')](_0x3e189e);})[_0xfe6a('0x26')](function(_0x9766a1){_0x26b7b9[_0xfe6a('0x3f')]=_0x9766a1;return _0x26b7b9;})[_0xfe6a('0x26')](respondWithFilteredResult(_0x36eb09,_0x3e189e))['catch'](handleError(_0x36eb09,null));};exports[_0xfe6a('0x40')]=function(_0x276473,_0x1432a7){var _0x3d5052={'raw':![],'where':{'id':_0x276473[_0xfe6a('0x41')]['id']}},_0x22a765={};_0x22a765['model']=_[_0xfe6a('0x42')](db['FreshsalesConfiguration']['rawAttributes']);_0x22a765[_0xfe6a('0x2f')]=_['keys'](_0x276473[_0xfe6a('0x2f')]);_0x22a765[_0xfe6a('0x30')]=_[_0xfe6a('0x32')](_0x22a765['model'],_0x22a765[_0xfe6a('0x2f')]);_0x3d5052[_0xfe6a('0x31')]=_[_0xfe6a('0x32')](_0x22a765[_0xfe6a('0x2e')],qs[_0xfe6a('0x33')](_0x276473['query']['fields']));_0x3d5052[_0xfe6a('0x31')]=_0x3d5052[_0xfe6a('0x31')]['length']?_0x3d5052['attributes']:_0x22a765['model'];if(_0x276473['query']['includeAll']){_0x3d5052[_0xfe6a('0x3d')]=[{'all':!![]}];}_0x3d5052=_[_0xfe6a('0x39')]({},_0x3d5052,_0x276473[_0xfe6a('0x43')]);return db['FreshsalesConfiguration'][_0xfe6a('0x44')](_0x3d5052)[_0xfe6a('0x26')](handleEntityNotFound(_0x1432a7,null))[_0xfe6a('0x26')](respondWithResult(_0x1432a7,null))['catch'](handleError(_0x1432a7,null));};exports[_0xfe6a('0x45')]=function(_0x41d832,_0x21b69b){return db[_0xfe6a('0x2b')][_0xfe6a('0x45')](_0x41d832['body'],{})[_0xfe6a('0x26')](respondWithResult(_0x21b69b,0xc9))[_0xfe6a('0x46')](handleError(_0x21b69b,null));};exports[_0xfe6a('0x25')]=function(_0x5b8581,_0x5a4288){if(_0x5b8581['body']['id']){delete _0x5b8581['body']['id'];}return db[_0xfe6a('0x2b')]['find']({'where':{'id':_0x5b8581['params']['id']}})[_0xfe6a('0x26')](handleEntityNotFound(_0x5a4288,null))[_0xfe6a('0x26')](saveUpdates(_0x5b8581[_0xfe6a('0x47')],null))[_0xfe6a('0x26')](respondWithResult(_0x5a4288,null))[_0xfe6a('0x46')](handleError(_0x5a4288,null));};exports['destroy']=function(_0x14a87c,_0x23a898){return db['FreshsalesConfiguration'][_0xfe6a('0x44')]({'where':{'id':_0x14a87c[_0xfe6a('0x41')]['id']}})['then'](handleEntityNotFound(_0x23a898,null))[_0xfe6a('0x26')](removeEntity(_0x23a898,null))['catch'](handleError(_0x23a898,null));};exports[_0xfe6a('0x48')]=function(_0x41e48f,_0x3f1dfd,_0xbe4501){var _0x28b617={};var _0x43003b={};var _0x5762d0;var _0xda7caa;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x41e48f['params']['id']}})[_0xfe6a('0x26')](handleEntityNotFound(_0x3f1dfd,null))[_0xfe6a('0x26')](function(_0x346171){if(_0x346171){_0x5762d0=_0x346171;_0x43003b['model']=_[_0xfe6a('0x42')](db[_0xfe6a('0x49')][_0xfe6a('0x4a')]);_0x43003b[_0xfe6a('0x2f')]=_[_0xfe6a('0x42')](_0x41e48f[_0xfe6a('0x2f')]);_0x43003b[_0xfe6a('0x30')]=_[_0xfe6a('0x32')](_0x43003b[_0xfe6a('0x2e')],_0x43003b[_0xfe6a('0x2f')]);_0x28b617[_0xfe6a('0x31')]=_[_0xfe6a('0x32')](_0x43003b['model'],qs[_0xfe6a('0x33')](_0x41e48f[_0xfe6a('0x2f')][_0xfe6a('0x33')]));_0x28b617['attributes']=_0x28b617[_0xfe6a('0x31')]['length']?_0x28b617[_0xfe6a('0x31')]:_0x43003b[_0xfe6a('0x2e')];_0x28b617[_0xfe6a('0x4b')]=qs['sort'](_0x41e48f[_0xfe6a('0x2f')][_0xfe6a('0x36')]);_0x28b617[_0xfe6a('0x37')]=qs['filters'](_['pick'](_0x41e48f[_0xfe6a('0x2f')],_0x43003b[_0xfe6a('0x30')]));if(_0x41e48f[_0xfe6a('0x2f')]['filter']){_0x28b617[_0xfe6a('0x37')]=_[_0xfe6a('0x39')](_0x28b617['where'],{'$or':_[_0xfe6a('0x2a')](_0x28b617[_0xfe6a('0x31')],function(_0x361f9c){var _0x17ba8d={};_0x17ba8d[_0x361f9c]={'$like':'%'+_0x41e48f[_0xfe6a('0x2f')]['filter']+'%'};return _0x17ba8d;})});}_0x28b617=_[_0xfe6a('0x39')]({},_0x28b617,_0x41e48f['options']);return _0x5762d0['getSubjects'](_0x28b617);}})['then'](function(_0x53a3f8){if(_0x53a3f8){_0xda7caa=_0x53a3f8['length'];if(!_0x41e48f[_0xfe6a('0x2f')][_0xfe6a('0x35')](_0xfe6a('0x4c'))){_0x28b617[_0xfe6a('0x22')]=qs[_0xfe6a('0x22')](_0x41e48f[_0xfe6a('0x2f')][_0xfe6a('0x22')]);_0x28b617['offset']=qs[_0xfe6a('0x1f')](_0x41e48f['query'][_0xfe6a('0x1f')]);}return _0x5762d0[_0xfe6a('0x48')](_0x28b617);}})[_0xfe6a('0x26')](function(_0x471b28){if(_0x471b28){return _0x471b28?{'count':_0xda7caa,'rows':_0x471b28}:null;}})[_0xfe6a('0x26')](respondWithResult(_0x3f1dfd,null))[_0xfe6a('0x46')](handleError(_0x3f1dfd,null));};exports[_0xfe6a('0x4d')]=function(_0x1bb7c2,_0x55887b,_0x9728e6){var _0x2b1a08={};var _0x4ed1f4={};var _0x38376f;var _0x1736aa;return db[_0xfe6a('0x2b')][_0xfe6a('0x4e')]({'where':{'id':_0x1bb7c2['params']['id']}})[_0xfe6a('0x26')](handleEntityNotFound(_0x55887b,null))[_0xfe6a('0x26')](function(_0x3324f7){if(_0x3324f7){_0x38376f=_0x3324f7;_0x4ed1f4[_0xfe6a('0x2e')]=_[_0xfe6a('0x42')](db[_0xfe6a('0x49')]['rawAttributes']);_0x4ed1f4[_0xfe6a('0x2f')]=_[_0xfe6a('0x42')](_0x1bb7c2[_0xfe6a('0x2f')]);_0x4ed1f4[_0xfe6a('0x30')]=_[_0xfe6a('0x32')](_0x4ed1f4[_0xfe6a('0x2e')],_0x4ed1f4[_0xfe6a('0x2f')]);_0x2b1a08['attributes']=_[_0xfe6a('0x32')](_0x4ed1f4['model'],qs[_0xfe6a('0x33')](_0x1bb7c2[_0xfe6a('0x2f')]['fields']));_0x2b1a08['attributes']=_0x2b1a08[_0xfe6a('0x31')]['length']?_0x2b1a08[_0xfe6a('0x31')]:_0x4ed1f4[_0xfe6a('0x2e')];_0x2b1a08[_0xfe6a('0x4b')]=qs[_0xfe6a('0x36')](_0x1bb7c2[_0xfe6a('0x2f')]['sort']);_0x2b1a08['where']=qs['filters'](_[_0xfe6a('0x4f')](_0x1bb7c2[_0xfe6a('0x2f')],_0x4ed1f4[_0xfe6a('0x30')]));if(_0x1bb7c2['query'][_0xfe6a('0x38')]){_0x2b1a08[_0xfe6a('0x37')]=_[_0xfe6a('0x39')](_0x2b1a08[_0xfe6a('0x37')],{'$or':_[_0xfe6a('0x2a')](_0x2b1a08[_0xfe6a('0x31')],function(_0x3a4890){var _0x3abb12={};_0x3abb12[_0x3a4890]={'$like':'%'+_0x1bb7c2[_0xfe6a('0x2f')][_0xfe6a('0x38')]+'%'};return _0x3abb12;})});}_0x2b1a08=_[_0xfe6a('0x39')]({},_0x2b1a08,_0x1bb7c2[_0xfe6a('0x43')]);return _0x38376f[_0xfe6a('0x4d')](_0x2b1a08);}})[_0xfe6a('0x26')](function(_0x4a0a2c){if(_0x4a0a2c){_0x1736aa=_0x4a0a2c[_0xfe6a('0x34')];if(!_0x1bb7c2[_0xfe6a('0x2f')]['hasOwnProperty'](_0xfe6a('0x4c'))){_0x2b1a08[_0xfe6a('0x22')]=qs['limit'](_0x1bb7c2[_0xfe6a('0x2f')][_0xfe6a('0x22')]);_0x2b1a08['offset']=qs[_0xfe6a('0x1f')](_0x1bb7c2[_0xfe6a('0x2f')]['offset']);}return _0x38376f[_0xfe6a('0x4d')](_0x2b1a08);}})[_0xfe6a('0x26')](function(_0x336cf4){if(_0x336cf4){return _0x336cf4?{'count':_0x1736aa,'rows':_0x336cf4}:null;}})['then'](respondWithResult(_0x55887b,null))['catch'](handleError(_0x55887b,null));};exports[_0xfe6a('0x50')]=function(_0x346f35,_0x53e6d5,_0x570437){var _0x397331={};var _0x7e15de={};var _0x247b36;var _0x471f50;return db[_0xfe6a('0x2b')][_0xfe6a('0x4e')]({'where':{'id':_0x346f35[_0xfe6a('0x41')]['id']}})[_0xfe6a('0x26')](handleEntityNotFound(_0x53e6d5,null))['then'](function(_0x3bb2dd){if(_0x3bb2dd){_0x247b36=_0x3bb2dd;_0x7e15de[_0xfe6a('0x2e')]=_[_0xfe6a('0x42')](db[_0xfe6a('0x49')][_0xfe6a('0x4a')]);_0x7e15de[_0xfe6a('0x2f')]=_[_0xfe6a('0x42')](_0x346f35['query']);_0x7e15de['filters']=_[_0xfe6a('0x32')](_0x7e15de['model'],_0x7e15de[_0xfe6a('0x2f')]);_0x397331['attributes']=_[_0xfe6a('0x32')](_0x7e15de['model'],qs[_0xfe6a('0x33')](_0x346f35[_0xfe6a('0x2f')]['fields']));_0x397331[_0xfe6a('0x31')]=_0x397331[_0xfe6a('0x31')]['length']?_0x397331[_0xfe6a('0x31')]:_0x7e15de['model'];_0x397331['order']=qs[_0xfe6a('0x36')](_0x346f35[_0xfe6a('0x2f')][_0xfe6a('0x36')]);_0x397331['where']=qs[_0xfe6a('0x30')](_[_0xfe6a('0x4f')](_0x346f35['query'],_0x7e15de['filters']));if(_0x346f35['query']['filter']){_0x397331['where']=_[_0xfe6a('0x39')](_0x397331[_0xfe6a('0x37')],{'$or':_[_0xfe6a('0x2a')](_0x397331[_0xfe6a('0x31')],function(_0x2210e6){var _0x3855ea={};_0x3855ea[_0x2210e6]={'$like':'%'+_0x346f35[_0xfe6a('0x2f')][_0xfe6a('0x38')]+'%'};return _0x3855ea;})});}_0x397331=_['merge']({},_0x397331,_0x346f35[_0xfe6a('0x43')]);return _0x247b36[_0xfe6a('0x50')](_0x397331);}})[_0xfe6a('0x26')](function(_0x447615){if(_0x447615){_0x471f50=_0x447615[_0xfe6a('0x34')];if(!_0x346f35['query'][_0xfe6a('0x35')]('nolimit')){_0x397331[_0xfe6a('0x22')]=qs['limit'](_0x346f35[_0xfe6a('0x2f')][_0xfe6a('0x22')]);_0x397331[_0xfe6a('0x1f')]=qs[_0xfe6a('0x1f')](_0x346f35['query'][_0xfe6a('0x1f')]);}return _0x247b36[_0xfe6a('0x50')](_0x397331);}})[_0xfe6a('0x26')](function(_0xfd9f20){if(_0xfd9f20){return _0xfd9f20?{'count':_0x471f50,'rows':_0xfd9f20}:null;}})[_0xfe6a('0x26')](respondWithResult(_0x53e6d5,null))[_0xfe6a('0x46')](handleError(_0x53e6d5,null));}; \ No newline at end of file +var _0xd37f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','then','includeAll','rows','params','include','find','catch','create','body','findOne','getSubjects','FreshsalesField','getDescriptions','hasOwnProperty','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x460155,_0x1605e2){var _0x1f4d39=function(_0x26cfaa){while(--_0x26cfaa){_0x460155['push'](_0x460155['shift']());}};_0x1f4d39(++_0x1605e2);}(_0xd37f,0x89));var _0xfd37=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd37f[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xfd37('0x0'));var rimraf=require(_0xfd37('0x1'));var zipdir=require(_0xfd37('0x2'));var jsonpatch=require(_0xfd37('0x3'));var rp=require(_0xfd37('0x4'));var moment=require(_0xfd37('0x5'));var BPromise=require(_0xfd37('0x6'));var Mustache=require(_0xfd37('0x7'));var util=require(_0xfd37('0x8'));var path=require(_0xfd37('0x9'));var sox=require(_0xfd37('0xa'));var csv=require(_0xfd37('0xb'));var ejs=require(_0xfd37('0xc'));var fs=require('fs');var fs_extra=require(_0xfd37('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd37('0xe'));var jsforce=require(_0xfd37('0xf'));var deskjs=require(_0xfd37('0x10'));var toCsv=require(_0xfd37('0xb'));var querystring=require(_0xfd37('0x11'));var Papa=require(_0xfd37('0x12'));var Redis=require('ioredis');var authService=require(_0xfd37('0x13'));var qs=require(_0xfd37('0x14'));var as=require(_0xfd37('0x15'));var hardwareService=require(_0xfd37('0x16'));var logger=require(_0xfd37('0x17'))(_0xfd37('0x18'));var utils=require('../../config/utils');var config=require(_0xfd37('0x19'));var licenseUtil=require(_0xfd37('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3750ae,_0x10b2c4){_0x10b2c4=_0x10b2c4||0xcc;return function(_0x3e9b94){if(_0x3e9b94){return _0x3750ae[_0xfd37('0x1b')](_0x10b2c4);}return _0x3750ae[_0xfd37('0x1c')](_0x10b2c4)[_0xfd37('0x1d')]();};}function respondWithResult(_0x3881aa,_0x282af2){_0x282af2=_0x282af2||0xc8;return function(_0x202415){if(_0x202415){return _0x3881aa[_0xfd37('0x1c')](_0x282af2)[_0xfd37('0x1e')](_0x202415);}};}function respondWithFilteredResult(_0x390da3,_0x4aab7d){return function(_0x2b14fd){if(_0x2b14fd){var _0x357344=typeof _0x4aab7d[_0xfd37('0x1f')]===_0xfd37('0x20')&&typeof _0x4aab7d[_0xfd37('0x21')]==='undefined';var _0x3a9d3a=_0x2b14fd[_0xfd37('0x22')];var _0xb4a2d0=_0x357344?0x0:_0x4aab7d['offset'];var _0x2013fa=_0x357344?_0x2b14fd[_0xfd37('0x22')]:_0x4aab7d[_0xfd37('0x1f')]+_0x4aab7d[_0xfd37('0x21')];var _0x1cd7b7;if(_0x2013fa>=_0x3a9d3a){_0x2013fa=_0x3a9d3a;_0x1cd7b7=0xc8;}else{_0x1cd7b7=0xce;}_0x390da3[_0xfd37('0x1c')](_0x1cd7b7);return _0x390da3[_0xfd37('0x23')](_0xfd37('0x24'),_0xb4a2d0+'-'+_0x2013fa+'/'+_0x3a9d3a)[_0xfd37('0x1e')](_0x2b14fd);}return null;};}function patchUpdates(_0x3906fb){return function(_0x15ffcd){try{jsonpatch[_0xfd37('0x25')](_0x15ffcd,_0x3906fb,!![]);}catch(_0x5486cf){return BPromise[_0xfd37('0x26')](_0x5486cf);}return _0x15ffcd[_0xfd37('0x27')]();};}function saveUpdates(_0x546c2f,_0x17e84f){return function(_0x15b781){if(_0x15b781){return _0x15b781[_0xfd37('0x28')](_0x546c2f)['then'](function(_0x374fb6){return _0x374fb6;});}return null;};}function removeEntity(_0x320d02,_0x3ad2c6){return function(_0x4c1df6){if(_0x4c1df6){return _0x4c1df6[_0xfd37('0x29')]()['then'](function(){_0x320d02[_0xfd37('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b52bb,_0x5de9ee){return function(_0x205651){if(!_0x205651){_0x2b52bb[_0xfd37('0x1b')](0x194);}return _0x205651;};}function handleError(_0x60c702,_0x181736){_0x181736=_0x181736||0x1f4;return function(_0x2db9e6){logger[_0xfd37('0x2a')](_0x2db9e6[_0xfd37('0x2b')]);if(_0x2db9e6['name']){delete _0x2db9e6[_0xfd37('0x2c')];}_0x60c702[_0xfd37('0x1c')](_0x181736)[_0xfd37('0x2d')](_0x2db9e6);};}exports[_0xfd37('0x2e')]=function(_0x179fbe,_0x48a380){var _0x32687c={},_0x325945={},_0x58701d={'count':0x0,'rows':[]};var _0x2b11d8=_['map'](db['FreshsalesConfiguration'][_0xfd37('0x2f')],function(_0x4874b7){return{'name':_0x4874b7['fieldName'],'type':_0x4874b7[_0xfd37('0x30')][_0xfd37('0x31')]};});_0x325945[_0xfd37('0x32')]=_[_0xfd37('0x33')](_0x2b11d8,'name');_0x325945['query']=_[_0xfd37('0x34')](_0x179fbe[_0xfd37('0x35')]);_0x325945['filters']=_[_0xfd37('0x36')](_0x325945[_0xfd37('0x32')],_0x325945['query']);_0x32687c[_0xfd37('0x37')]=_['intersection'](_0x325945[_0xfd37('0x32')],qs[_0xfd37('0x38')](_0x179fbe['query'][_0xfd37('0x38')]));_0x32687c[_0xfd37('0x37')]=_0x32687c[_0xfd37('0x37')][_0xfd37('0x39')]?_0x32687c['attributes']:_0x325945[_0xfd37('0x32')];if(!_0x179fbe[_0xfd37('0x35')]['hasOwnProperty'](_0xfd37('0x3a'))){_0x32687c['limit']=qs[_0xfd37('0x21')](_0x179fbe[_0xfd37('0x35')][_0xfd37('0x21')]);_0x32687c[_0xfd37('0x1f')]=qs[_0xfd37('0x1f')](_0x179fbe[_0xfd37('0x35')][_0xfd37('0x1f')]);}_0x32687c[_0xfd37('0x3b')]=qs[_0xfd37('0x3c')](_0x179fbe[_0xfd37('0x35')][_0xfd37('0x3c')]);_0x32687c[_0xfd37('0x3d')]=qs[_0xfd37('0x3e')](_[_0xfd37('0x3f')](_0x179fbe['query'],_0x325945[_0xfd37('0x3e')]),_0x2b11d8);if(_0x179fbe[_0xfd37('0x35')][_0xfd37('0x40')]){_0x32687c[_0xfd37('0x3d')]=_[_0xfd37('0x41')](_0x32687c[_0xfd37('0x3d')],{'$or':_[_0xfd37('0x33')](_0x2b11d8,function(_0x5db182){if(_0x5db182['type']!==_0xfd37('0x42')){var _0x5ee06c={};_0x5ee06c[_0x5db182[_0xfd37('0x2c')]]={'$like':'%'+_0x179fbe[_0xfd37('0x35')]['filter']+'%'};return _0x5ee06c;}})});}_0x32687c=_[_0xfd37('0x41')]({},_0x32687c,_0x179fbe[_0xfd37('0x43')]);var _0xf647f7={'where':_0x32687c['where']};return db[_0xfd37('0x44')][_0xfd37('0x22')](_0xf647f7)[_0xfd37('0x45')](function(_0x53498e){_0x58701d[_0xfd37('0x22')]=_0x53498e;if(_0x179fbe[_0xfd37('0x35')][_0xfd37('0x46')]){_0x32687c['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x32687c);})[_0xfd37('0x45')](function(_0x4e2c95){_0x58701d[_0xfd37('0x47')]=_0x4e2c95;return _0x58701d;})[_0xfd37('0x45')](respondWithFilteredResult(_0x48a380,_0x32687c))['catch'](handleError(_0x48a380,null));};exports['show']=function(_0x4f61b9,_0x26c78c){var _0x36def1={'raw':![],'where':{'id':_0x4f61b9[_0xfd37('0x48')]['id']}},_0x49d988={};_0x49d988[_0xfd37('0x32')]=_[_0xfd37('0x34')](db[_0xfd37('0x44')]['rawAttributes']);_0x49d988[_0xfd37('0x35')]=_['keys'](_0x4f61b9[_0xfd37('0x35')]);_0x49d988[_0xfd37('0x3e')]=_[_0xfd37('0x36')](_0x49d988[_0xfd37('0x32')],_0x49d988[_0xfd37('0x35')]);_0x36def1[_0xfd37('0x37')]=_[_0xfd37('0x36')](_0x49d988['model'],qs[_0xfd37('0x38')](_0x4f61b9['query']['fields']));_0x36def1[_0xfd37('0x37')]=_0x36def1[_0xfd37('0x37')][_0xfd37('0x39')]?_0x36def1[_0xfd37('0x37')]:_0x49d988[_0xfd37('0x32')];if(_0x4f61b9[_0xfd37('0x35')]['includeAll']){_0x36def1[_0xfd37('0x49')]=[{'all':!![]}];}_0x36def1=_['merge']({},_0x36def1,_0x4f61b9['options']);return db[_0xfd37('0x44')][_0xfd37('0x4a')](_0x36def1)[_0xfd37('0x45')](handleEntityNotFound(_0x26c78c,null))[_0xfd37('0x45')](respondWithResult(_0x26c78c,null))[_0xfd37('0x4b')](handleError(_0x26c78c,null));};exports[_0xfd37('0x4c')]=function(_0x49a2b4,_0x274a5d){return db[_0xfd37('0x44')][_0xfd37('0x4c')](_0x49a2b4['body'],{})[_0xfd37('0x45')](respondWithResult(_0x274a5d,0xc9))[_0xfd37('0x4b')](handleError(_0x274a5d,null));};exports['update']=function(_0x5bb43e,_0x35174a){if(_0x5bb43e[_0xfd37('0x4d')]['id']){delete _0x5bb43e[_0xfd37('0x4d')]['id'];}return db[_0xfd37('0x44')][_0xfd37('0x4a')]({'where':{'id':_0x5bb43e[_0xfd37('0x48')]['id']}})[_0xfd37('0x45')](handleEntityNotFound(_0x35174a,null))['then'](saveUpdates(_0x5bb43e['body'],null))['then'](respondWithResult(_0x35174a,null))[_0xfd37('0x4b')](handleError(_0x35174a,null));};exports['destroy']=function(_0x50978a,_0x58dbd2){return db[_0xfd37('0x44')][_0xfd37('0x4a')]({'where':{'id':_0x50978a[_0xfd37('0x48')]['id']}})[_0xfd37('0x45')](handleEntityNotFound(_0x58dbd2,null))[_0xfd37('0x45')](removeEntity(_0x58dbd2,null))[_0xfd37('0x4b')](handleError(_0x58dbd2,null));};exports['getSubjects']=function(_0x1d016f,_0x26ca46,_0x495a68){var _0x1ac87c={};var _0x51fa85={};var _0x546c71;var _0x1fd432;return db[_0xfd37('0x44')][_0xfd37('0x4e')]({'where':{'id':_0x1d016f[_0xfd37('0x48')]['id']}})['then'](handleEntityNotFound(_0x26ca46,null))[_0xfd37('0x45')](function(_0x1db6a0){if(_0x1db6a0){_0x546c71=_0x1db6a0;_0x51fa85[_0xfd37('0x32')]=_[_0xfd37('0x34')](db['FreshsalesField'][_0xfd37('0x2f')]);_0x51fa85['query']=_[_0xfd37('0x34')](_0x1d016f[_0xfd37('0x35')]);_0x51fa85[_0xfd37('0x3e')]=_[_0xfd37('0x36')](_0x51fa85[_0xfd37('0x32')],_0x51fa85['query']);_0x1ac87c['attributes']=_[_0xfd37('0x36')](_0x51fa85[_0xfd37('0x32')],qs[_0xfd37('0x38')](_0x1d016f[_0xfd37('0x35')][_0xfd37('0x38')]));_0x1ac87c[_0xfd37('0x37')]=_0x1ac87c[_0xfd37('0x37')]['length']?_0x1ac87c[_0xfd37('0x37')]:_0x51fa85[_0xfd37('0x32')];_0x1ac87c[_0xfd37('0x3b')]=qs['sort'](_0x1d016f[_0xfd37('0x35')][_0xfd37('0x3c')]);_0x1ac87c[_0xfd37('0x3d')]=qs[_0xfd37('0x3e')](_[_0xfd37('0x3f')](_0x1d016f[_0xfd37('0x35')],_0x51fa85[_0xfd37('0x3e')]));if(_0x1d016f['query'][_0xfd37('0x40')]){_0x1ac87c['where']=_[_0xfd37('0x41')](_0x1ac87c[_0xfd37('0x3d')],{'$or':_['map'](_0x1ac87c[_0xfd37('0x37')],function(_0xe4782f){var _0x4faee5={};_0x4faee5[_0xe4782f]={'$like':'%'+_0x1d016f[_0xfd37('0x35')]['filter']+'%'};return _0x4faee5;})});}_0x1ac87c=_[_0xfd37('0x41')]({},_0x1ac87c,_0x1d016f['options']);return _0x546c71[_0xfd37('0x4f')](_0x1ac87c);}})[_0xfd37('0x45')](function(_0x9c89ad){if(_0x9c89ad){_0x1fd432=_0x9c89ad[_0xfd37('0x39')];if(!_0x1d016f[_0xfd37('0x35')]['hasOwnProperty'](_0xfd37('0x3a'))){_0x1ac87c[_0xfd37('0x21')]=qs[_0xfd37('0x21')](_0x1d016f[_0xfd37('0x35')]['limit']);_0x1ac87c[_0xfd37('0x1f')]=qs[_0xfd37('0x1f')](_0x1d016f['query'][_0xfd37('0x1f')]);}return _0x546c71[_0xfd37('0x4f')](_0x1ac87c);}})[_0xfd37('0x45')](function(_0x21a548){if(_0x21a548){return _0x21a548?{'count':_0x1fd432,'rows':_0x21a548}:null;}})['then'](respondWithResult(_0x26ca46,null))[_0xfd37('0x4b')](handleError(_0x26ca46,null));};exports['getDescriptions']=function(_0x381085,_0x142b13,_0x3eab36){var _0x5a7436={};var _0x528597={};var _0x18e918;var _0x220fb8;return db[_0xfd37('0x44')][_0xfd37('0x4e')]({'where':{'id':_0x381085[_0xfd37('0x48')]['id']}})[_0xfd37('0x45')](handleEntityNotFound(_0x142b13,null))[_0xfd37('0x45')](function(_0x29cea7){if(_0x29cea7){_0x18e918=_0x29cea7;_0x528597['model']=_[_0xfd37('0x34')](db[_0xfd37('0x50')][_0xfd37('0x2f')]);_0x528597[_0xfd37('0x35')]=_[_0xfd37('0x34')](_0x381085[_0xfd37('0x35')]);_0x528597[_0xfd37('0x3e')]=_['intersection'](_0x528597['model'],_0x528597[_0xfd37('0x35')]);_0x5a7436['attributes']=_['intersection'](_0x528597[_0xfd37('0x32')],qs['fields'](_0x381085[_0xfd37('0x35')]['fields']));_0x5a7436[_0xfd37('0x37')]=_0x5a7436[_0xfd37('0x37')]['length']?_0x5a7436[_0xfd37('0x37')]:_0x528597[_0xfd37('0x32')];_0x5a7436[_0xfd37('0x3b')]=qs[_0xfd37('0x3c')](_0x381085['query']['sort']);_0x5a7436[_0xfd37('0x3d')]=qs[_0xfd37('0x3e')](_['pick'](_0x381085[_0xfd37('0x35')],_0x528597[_0xfd37('0x3e')]));if(_0x381085[_0xfd37('0x35')][_0xfd37('0x40')]){_0x5a7436[_0xfd37('0x3d')]=_[_0xfd37('0x41')](_0x5a7436['where'],{'$or':_['map'](_0x5a7436['attributes'],function(_0x2c444c){var _0xb0af4c={};_0xb0af4c[_0x2c444c]={'$like':'%'+_0x381085[_0xfd37('0x35')]['filter']+'%'};return _0xb0af4c;})});}_0x5a7436=_[_0xfd37('0x41')]({},_0x5a7436,_0x381085[_0xfd37('0x43')]);return _0x18e918[_0xfd37('0x51')](_0x5a7436);}})[_0xfd37('0x45')](function(_0x4c5298){if(_0x4c5298){_0x220fb8=_0x4c5298[_0xfd37('0x39')];if(!_0x381085['query'][_0xfd37('0x52')](_0xfd37('0x3a'))){_0x5a7436[_0xfd37('0x21')]=qs[_0xfd37('0x21')](_0x381085[_0xfd37('0x35')][_0xfd37('0x21')]);_0x5a7436[_0xfd37('0x1f')]=qs[_0xfd37('0x1f')](_0x381085['query']['offset']);}return _0x18e918['getDescriptions'](_0x5a7436);}})['then'](function(_0x5cc7e8){if(_0x5cc7e8){return _0x5cc7e8?{'count':_0x220fb8,'rows':_0x5cc7e8}:null;}})[_0xfd37('0x45')](respondWithResult(_0x142b13,null))[_0xfd37('0x4b')](handleError(_0x142b13,null));};exports['getFields']=function(_0x3fc472,_0x4c02d2,_0x476d98){var _0x18f210={};var _0x832b27={};var _0x3d54ec;var _0x1a82a4;return db['FreshsalesConfiguration'][_0xfd37('0x4e')]({'where':{'id':_0x3fc472[_0xfd37('0x48')]['id']}})[_0xfd37('0x45')](handleEntityNotFound(_0x4c02d2,null))[_0xfd37('0x45')](function(_0x5df6af){if(_0x5df6af){_0x3d54ec=_0x5df6af;_0x832b27[_0xfd37('0x32')]=_[_0xfd37('0x34')](db['FreshsalesField'][_0xfd37('0x2f')]);_0x832b27['query']=_[_0xfd37('0x34')](_0x3fc472[_0xfd37('0x35')]);_0x832b27[_0xfd37('0x3e')]=_['intersection'](_0x832b27[_0xfd37('0x32')],_0x832b27[_0xfd37('0x35')]);_0x18f210[_0xfd37('0x37')]=_['intersection'](_0x832b27[_0xfd37('0x32')],qs[_0xfd37('0x38')](_0x3fc472[_0xfd37('0x35')][_0xfd37('0x38')]));_0x18f210[_0xfd37('0x37')]=_0x18f210[_0xfd37('0x37')][_0xfd37('0x39')]?_0x18f210[_0xfd37('0x37')]:_0x832b27[_0xfd37('0x32')];_0x18f210['order']=qs['sort'](_0x3fc472[_0xfd37('0x35')][_0xfd37('0x3c')]);_0x18f210[_0xfd37('0x3d')]=qs[_0xfd37('0x3e')](_['pick'](_0x3fc472['query'],_0x832b27['filters']));if(_0x3fc472['query'][_0xfd37('0x40')]){_0x18f210['where']=_[_0xfd37('0x41')](_0x18f210['where'],{'$or':_['map'](_0x18f210[_0xfd37('0x37')],function(_0x36bcad){var _0x30d4cc={};_0x30d4cc[_0x36bcad]={'$like':'%'+_0x3fc472[_0xfd37('0x35')][_0xfd37('0x40')]+'%'};return _0x30d4cc;})});}_0x18f210=_[_0xfd37('0x41')]({},_0x18f210,_0x3fc472[_0xfd37('0x43')]);return _0x3d54ec['getFields'](_0x18f210);}})['then'](function(_0x59616e){if(_0x59616e){_0x1a82a4=_0x59616e[_0xfd37('0x39')];if(!_0x3fc472['query']['hasOwnProperty'](_0xfd37('0x3a'))){_0x18f210[_0xfd37('0x21')]=qs[_0xfd37('0x21')](_0x3fc472[_0xfd37('0x35')]['limit']);_0x18f210[_0xfd37('0x1f')]=qs[_0xfd37('0x1f')](_0x3fc472[_0xfd37('0x35')][_0xfd37('0x1f')]);}return _0x3d54ec[_0xfd37('0x53')](_0x18f210);}})[_0xfd37('0x45')](function(_0x261d13){if(_0x261d13){return _0x261d13?{'count':_0x1a82a4,'rows':_0x261d13}:null;}})['then'](respondWithResult(_0x4c02d2,null))[_0xfd37('0x4b')](handleError(_0x4c02d2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0003ba8..19b7ca6 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43f2=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43f2,0x132));var _0x243f=function(_0x175e31,_0x2e7e70){_0x175e31=_0x175e31-0x0;var _0x8a4d5a=_0x43f2[_0x175e31];return _0x8a4d5a;};'use strict';var _=require(_0x243f('0x0'));var util=require(_0x243f('0x1'));var logger=require(_0x243f('0x2'))(_0x243f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x243f('0x4'));var fs=require('fs');var path=require(_0x243f('0x5'));var rimraf=require('rimraf');var config=require(_0x243f('0x6'));var attributes=require(_0x243f('0x7'));module[_0x243f('0x8')]=function(_0x3d918a,_0x3c4e03){return _0x3d918a[_0x243f('0x9')](_0x243f('0xa'),attributes,{'tableName':_0x243f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf441=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','moment','bluebird','request-promise','path'];(function(_0x55f981,_0x1df71d){var _0x42370e=function(_0x42876d){while(--_0x42876d){_0x55f981['push'](_0x55f981['shift']());}};_0x42370e(++_0x1df71d);}(_0xf441,0xd2));var _0x1f44=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0xf441[_0x17ebae];return _0x8cbe7d;};'use strict';var _=require(_0x1f44('0x0'));var util=require(_0x1f44('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1f44('0x2'));var BPromise=require(_0x1f44('0x3'));var rp=require(_0x1f44('0x4'));var fs=require('fs');var path=require(_0x1f44('0x5'));var rimraf=require(_0x1f44('0x6'));var config=require(_0x1f44('0x7'));var attributes=require(_0x1f44('0x8'));module['exports']=function(_0x2a9e21,_0x3df70f){return _0x2a9e21[_0x1f44('0x9')](_0x1f44('0xa'),attributes,{'tableName':_0x1f44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 8acc927..7d17505 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdf0=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x69866,_0x21fe85){var _0xc8f491=function(_0x23c38d){while(--_0x23c38d){_0x69866['push'](_0x69866['shift']());}};_0xc8f491(++_0x21fe85);}(_0xfdf0,0x1ba));var _0x0fdf=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0xfdf0[_0x50fda9];return _0x36b92b;};'use strict';var _=require(_0x0fdf('0x0'));var util=require(_0x0fdf('0x1'));var moment=require(_0x0fdf('0x2'));var BPromise=require(_0x0fdf('0x3'));var rs=require(_0x0fdf('0x4'));var fs=require('fs');var Redis=require(_0x0fdf('0x5'));var db=require(_0x0fdf('0x6'))['db'];var utils=require(_0x0fdf('0x7'));var logger=require(_0x0fdf('0x8'))(_0x0fdf('0x9'));var config=require('../../config/environment');var jayson=require(_0x0fdf('0xa'));var client=jayson[_0x0fdf('0xb')][_0x0fdf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ec9a9,_0x10ab3b,_0x1d1eba){return new BPromise(function(_0x136c77,_0x45532c){return client[_0x0fdf('0xd')](_0x2ec9a9,_0x1d1eba)[_0x0fdf('0xe')](function(_0x209eaf){logger[_0x0fdf('0xf')](_0x0fdf('0x10'),_0x10ab3b,'request\x20sent');logger[_0x0fdf('0x11')](_0x0fdf('0x12'),_0x10ab3b,'request\x20sent',JSON[_0x0fdf('0x13')](_0x209eaf));if(_0x209eaf[_0x0fdf('0x14')]){if(_0x209eaf['error'][_0x0fdf('0x15')]===0x1f4){logger['error'](_0x0fdf('0x10'),_0x10ab3b,_0x209eaf[_0x0fdf('0x14')]['message']);return _0x45532c(_0x209eaf[_0x0fdf('0x14')]['message']);}logger[_0x0fdf('0x14')](_0x0fdf('0x10'),_0x10ab3b,_0x209eaf[_0x0fdf('0x14')][_0x0fdf('0x16')]);return _0x136c77(_0x209eaf[_0x0fdf('0x14')]['message']);}else{logger['info'](_0x0fdf('0x10'),_0x10ab3b,_0x0fdf('0x17'));_0x136c77(_0x209eaf[_0x0fdf('0x18')][_0x0fdf('0x16')]);}})[_0x0fdf('0x19')](function(_0x18cd2d){logger[_0x0fdf('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x10ab3b,_0x18cd2d);_0x45532c(_0x18cd2d);});});} \ No newline at end of file +var _0xc62b=['message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xa9259b,_0x110f05){var _0x39f9c8=function(_0x281ec9){while(--_0x281ec9){_0xa9259b['push'](_0xa9259b['shift']());}};_0x39f9c8(++_0x110f05);}(_0xc62b,0xe5));var _0xbc62=function(_0x299447,_0x59fb18){_0x299447=_0x299447-0x0;var _0x14b30a=_0xc62b[_0x299447];return _0x14b30a;};'use strict';var _=require(_0xbc62('0x0'));var util=require(_0xbc62('0x1'));var moment=require(_0xbc62('0x2'));var BPromise=require(_0xbc62('0x3'));var rs=require(_0xbc62('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbc62('0x5'));var logger=require(_0xbc62('0x6'))('rpc');var config=require(_0xbc62('0x7'));var jayson=require(_0xbc62('0x8'));var client=jayson[_0xbc62('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36239e,_0x4f8f2c,_0x81a519){return new BPromise(function(_0x1fc106,_0x28d1a0){return client['request'](_0x36239e,_0x81a519)[_0xbc62('0xa')](function(_0x2967c2){logger[_0xbc62('0xb')](_0xbc62('0xc'),_0x4f8f2c,_0xbc62('0xd'));logger[_0xbc62('0xe')](_0xbc62('0xf'),_0x4f8f2c,'request\x20sent',JSON['stringify'](_0x2967c2));if(_0x2967c2[_0xbc62('0x10')]){if(_0x2967c2['error'][_0xbc62('0x11')]===0x1f4){logger[_0xbc62('0x10')](_0xbc62('0xc'),_0x4f8f2c,_0x2967c2[_0xbc62('0x10')][_0xbc62('0x12')]);return _0x28d1a0(_0x2967c2[_0xbc62('0x10')][_0xbc62('0x12')]);}logger[_0xbc62('0x10')](_0xbc62('0xc'),_0x4f8f2c,_0x2967c2[_0xbc62('0x10')]['message']);return _0x1fc106(_0x2967c2[_0xbc62('0x10')][_0xbc62('0x12')]);}else{logger['info'](_0xbc62('0xc'),_0x4f8f2c,_0xbc62('0xd'));_0x1fc106(_0x2967c2['result'][_0xbc62('0x12')]);}})['catch'](function(_0x53bd6a){logger[_0xbc62('0x10')](_0xbc62('0xc'),_0x4f8f2c,_0x53bd6a);_0x28d1a0(_0x53bd6a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 954914c..8595159 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc112=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','express'];(function(_0x2569d5,_0x1ad379){var _0x2921e9=function(_0x1dd309){while(--_0x1dd309){_0x2569d5['push'](_0x2569d5['shift']());}};_0x2921e9(++_0x1ad379);}(_0xc112,0xec));var _0x2c11=function(_0x54a2d9,_0xb64c72){_0x54a2d9=_0x54a2d9-0x0;var _0x498688=_0xc112[_0x54a2d9];return _0x498688;};'use strict';var multer=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var path=require(_0x2c11('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c11('0x3'));var router=express[_0x2c11('0x4')]();var fs_extra=require(_0x2c11('0x5'));var auth=require(_0x2c11('0x6'));var interaction=require(_0x2c11('0x7'));var config=require(_0x2c11('0x8'));var controller=require(_0x2c11('0x9'));router[_0x2c11('0xa')]('/',auth[_0x2c11('0xb')](),controller['index']);router['get'](_0x2c11('0xc'),auth[_0x2c11('0xb')](),controller[_0x2c11('0xd')]);router[_0x2c11('0xe')]('/',auth['isAuthenticated'](),controller[_0x2c11('0xf')]);router[_0x2c11('0x10')]('/:id',auth[_0x2c11('0xb')](),controller[_0x2c11('0x11')]);router[_0x2c11('0x12')](_0x2c11('0xc'),auth[_0x2c11('0xb')](),controller['destroy']);module[_0x2c11('0x13')]=router; \ No newline at end of file +var _0x5712=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x1b5fe5,_0x4e5d9d){var _0x5cbdab=function(_0x38fdf3){while(--_0x38fdf3){_0x1b5fe5['push'](_0x1b5fe5['shift']());}};_0x5cbdab(++_0x4e5d9d);}(_0x5712,0x140));var _0x2571=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5712[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var path=require(_0x2571('0x2'));var timeout=require(_0x2571('0x3'));var express=require(_0x2571('0x4'));var router=express[_0x2571('0x5')]();var fs_extra=require(_0x2571('0x6'));var auth=require(_0x2571('0x7'));var interaction=require(_0x2571('0x8'));var config=require(_0x2571('0x9'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x2571('0xa')](),controller['index']);router[_0x2571('0xb')](_0x2571('0xc'),auth[_0x2571('0xa')](),controller[_0x2571('0xd')]);router[_0x2571('0xe')]('/',auth[_0x2571('0xa')](),controller['create']);router[_0x2571('0xf')]('/:id',auth[_0x2571('0xa')](),controller[_0x2571('0x10')]);router[_0x2571('0x11')](_0x2571('0xc'),auth[_0x2571('0xa')](),controller[_0x2571('0x12')]);module[_0x2571('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2e5343e..2377228 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3772=['variable','customVariable','STRING','string','sequelize','exports','ENUM'];(function(_0x2f01ef,_0x150eb3){var _0x2b0b45=function(_0x3dd32a){while(--_0x3dd32a){_0x2f01ef['push'](_0x2f01ef['shift']());}};_0x2b0b45(++_0x150eb3);}(_0x3772,0x1cb));var _0x2377=function(_0x3245f7,_0x26bfad){_0x3245f7=_0x3245f7-0x0;var _0x472f77=_0x3772[_0x3245f7];return _0x472f77;};'use strict';var Sequelize=require(_0x2377('0x0'));module[_0x2377('0x1')]={'type':{'type':Sequelize[_0x2377('0x2')]('string',_0x2377('0x3'),_0x2377('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2377('0x5')]},'key':{'type':Sequelize[_0x2377('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x2377('0x6'),_0x2377('0x3'),_0x2377('0x4'))},'keyContent':{'type':Sequelize[_0x2377('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2377('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2377('0x5')]}}; \ No newline at end of file +var _0xcb1b=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0xcb1b,0x12b));var _0xbcb1=function(_0x112ac9,_0x50fc3c){_0x112ac9=_0x112ac9-0x0;var _0x613d28=_0xcb1b[_0x112ac9];return _0x613d28;};'use strict';var Sequelize=require('sequelize');module[_0xbcb1('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbcb1('0x1'),_0xbcb1('0x2'),_0xbcb1('0x3'),_0xbcb1('0x4'),_0xbcb1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbcb1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbcb1('0x7')](_0xbcb1('0x1'),_0xbcb1('0x2'),_0xbcb1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbcb1('0x6')]},'nameField':{'type':Sequelize[_0xbcb1('0x6')]},'customField':{'type':Sequelize[_0xbcb1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbcb1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 79509c9..39674e2 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc4b=['params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfc4b,0x129));var _0xbfc4=function(_0x2d3e15,_0x11815e){_0x2d3e15=_0x2d3e15-0x0;var _0x2f43e3=_0xfc4b[_0x2d3e15];return _0x2f43e3;};'use strict';var emlformat=require(_0xbfc4('0x0'));var rimraf=require(_0xbfc4('0x1'));var zipdir=require(_0xbfc4('0x2'));var jsonpatch=require(_0xbfc4('0x3'));var rp=require(_0xbfc4('0x4'));var moment=require(_0xbfc4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfc4('0x6'));var util=require(_0xbfc4('0x7'));var path=require('path');var sox=require(_0xbfc4('0x8'));var csv=require(_0xbfc4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfc4('0xa'));var _=require(_0xbfc4('0xb'));var squel=require(_0xbfc4('0xc'));var crypto=require(_0xbfc4('0xd'));var jsforce=require(_0xbfc4('0xe'));var deskjs=require(_0xbfc4('0xf'));var toCsv=require(_0xbfc4('0x9'));var querystring=require(_0xbfc4('0x10'));var Papa=require(_0xbfc4('0x11'));var Redis=require(_0xbfc4('0x12'));var authService=require(_0xbfc4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbfc4('0x14'));var hardwareService=require(_0xbfc4('0x15'));var logger=require('../../config/logger')(_0xbfc4('0x16'));var utils=require('../../config/utils');var config=require(_0xbfc4('0x17'));var licenseUtil=require(_0xbfc4('0x18'));var db=require(_0xbfc4('0x19'))['db'];function respondWithStatusCode(_0xdebb41,_0x327754){_0x327754=_0x327754||0xcc;return function(_0xc946e5){if(_0xc946e5){return _0xdebb41['sendStatus'](_0x327754);}return _0xdebb41[_0xbfc4('0x1a')](_0x327754)['end']();};}function respondWithResult(_0x5d3746,_0x114b81){_0x114b81=_0x114b81||0xc8;return function(_0x25a6a6){if(_0x25a6a6){return _0x5d3746[_0xbfc4('0x1a')](_0x114b81)[_0xbfc4('0x1b')](_0x25a6a6);}};}function respondWithFilteredResult(_0x459ab3,_0x125550){return function(_0x4da880){if(_0x4da880){var _0x1ddde5=typeof _0x125550[_0xbfc4('0x1c')]==='undefined'&&typeof _0x125550[_0xbfc4('0x1d')]==='undefined';var _0x49b5c6=_0x4da880[_0xbfc4('0x1e')];var _0x2c1890=_0x1ddde5?0x0:_0x125550['offset'];var _0x202794=_0x1ddde5?_0x4da880[_0xbfc4('0x1e')]:_0x125550[_0xbfc4('0x1c')]+_0x125550['limit'];var _0x2671cb;if(_0x202794>=_0x49b5c6){_0x202794=_0x49b5c6;_0x2671cb=0xc8;}else{_0x2671cb=0xce;}_0x459ab3[_0xbfc4('0x1a')](_0x2671cb);return _0x459ab3['set']('Content-Range',_0x2c1890+'-'+_0x202794+'/'+_0x49b5c6)[_0xbfc4('0x1b')](_0x4da880);}return null;};}function patchUpdates(_0x4fad89){return function(_0x5db741){try{jsonpatch['apply'](_0x5db741,_0x4fad89,!![]);}catch(_0x460716){return BPromise[_0xbfc4('0x1f')](_0x460716);}return _0x5db741['save']();};}function saveUpdates(_0x533447,_0x2886ca){return function(_0x23d0c8){if(_0x23d0c8){return _0x23d0c8[_0xbfc4('0x20')](_0x533447)[_0xbfc4('0x21')](function(_0x2e68a3){return _0x2e68a3;});}return null;};}function removeEntity(_0x105399,_0x19413e){return function(_0x595175){if(_0x595175){return _0x595175['destroy']()[_0xbfc4('0x21')](function(){_0x105399[_0xbfc4('0x1a')](0xcc)[_0xbfc4('0x22')]();});}};}function handleEntityNotFound(_0x4a2eb4,_0x30b899){return function(_0x446b7f){if(!_0x446b7f){_0x4a2eb4[_0xbfc4('0x23')](0x194);}return _0x446b7f;};}function handleError(_0x370f7e,_0x2d829d){_0x2d829d=_0x2d829d||0x1f4;return function(_0x32ff07){logger[_0xbfc4('0x24')](_0x32ff07[_0xbfc4('0x25')]);if(_0x32ff07['name']){delete _0x32ff07[_0xbfc4('0x26')];}_0x370f7e[_0xbfc4('0x1a')](_0x2d829d)[_0xbfc4('0x27')](_0x32ff07);};}exports[_0xbfc4('0x28')]=function(_0x265214,_0x29aaee){var _0x234425={},_0x33cfed={},_0x1f17f4={'count':0x0,'rows':[]};var _0x4f4e57=_[_0xbfc4('0x29')](db[_0xbfc4('0x2a')][_0xbfc4('0x2b')],function(_0x493081){return{'name':_0x493081[_0xbfc4('0x2c')],'type':_0x493081[_0xbfc4('0x2d')]['key']};});_0x33cfed['model']=_[_0xbfc4('0x29')](_0x4f4e57,_0xbfc4('0x26'));_0x33cfed[_0xbfc4('0x2e')]=_[_0xbfc4('0x2f')](_0x265214[_0xbfc4('0x2e')]);_0x33cfed[_0xbfc4('0x30')]=_['intersection'](_0x33cfed['model'],_0x33cfed['query']);_0x234425[_0xbfc4('0x31')]=_[_0xbfc4('0x32')](_0x33cfed[_0xbfc4('0x33')],qs[_0xbfc4('0x34')](_0x265214[_0xbfc4('0x2e')][_0xbfc4('0x34')]));_0x234425[_0xbfc4('0x31')]=_0x234425[_0xbfc4('0x31')][_0xbfc4('0x35')]?_0x234425[_0xbfc4('0x31')]:_0x33cfed[_0xbfc4('0x33')];if(!_0x265214[_0xbfc4('0x2e')][_0xbfc4('0x36')]('nolimit')){_0x234425['limit']=qs[_0xbfc4('0x1d')](_0x265214[_0xbfc4('0x2e')][_0xbfc4('0x1d')]);_0x234425[_0xbfc4('0x1c')]=qs['offset'](_0x265214[_0xbfc4('0x2e')][_0xbfc4('0x1c')]);}_0x234425[_0xbfc4('0x37')]=qs[_0xbfc4('0x38')](_0x265214['query']['sort']);_0x234425['where']=qs[_0xbfc4('0x30')](_[_0xbfc4('0x39')](_0x265214['query'],_0x33cfed['filters']),_0x4f4e57);if(_0x265214['query'][_0xbfc4('0x3a')]){_0x234425[_0xbfc4('0x3b')]=_[_0xbfc4('0x3c')](_0x234425[_0xbfc4('0x3b')],{'$or':_[_0xbfc4('0x29')](_0x4f4e57,function(_0x5f55d6){if(_0x5f55d6['type']!=='VIRTUAL'){var _0x59c9f5={};_0x59c9f5[_0x5f55d6[_0xbfc4('0x26')]]={'$like':'%'+_0x265214[_0xbfc4('0x2e')][_0xbfc4('0x3a')]+'%'};return _0x59c9f5;}})});}_0x234425=_[_0xbfc4('0x3c')]({},_0x234425,_0x265214[_0xbfc4('0x3d')]);var _0x4bd332={'where':_0x234425[_0xbfc4('0x3b')]};return db[_0xbfc4('0x2a')]['count'](_0x4bd332)[_0xbfc4('0x21')](function(_0x4e2487){_0x1f17f4[_0xbfc4('0x1e')]=_0x4e2487;if(_0x265214[_0xbfc4('0x2e')][_0xbfc4('0x3e')]){_0x234425[_0xbfc4('0x3f')]=[{'all':!![]}];}return db[_0xbfc4('0x2a')][_0xbfc4('0x40')](_0x234425);})[_0xbfc4('0x21')](function(_0x32d63b){_0x1f17f4[_0xbfc4('0x41')]=_0x32d63b;return _0x1f17f4;})[_0xbfc4('0x21')](respondWithFilteredResult(_0x29aaee,_0x234425))[_0xbfc4('0x42')](handleError(_0x29aaee,null));};exports[_0xbfc4('0x43')]=function(_0x2232ed,_0x342ced){var _0x5ce72b={'raw':!![],'where':{'id':_0x2232ed[_0xbfc4('0x44')]['id']}},_0x298249={};_0x298249[_0xbfc4('0x33')]=_[_0xbfc4('0x2f')](db[_0xbfc4('0x2a')][_0xbfc4('0x2b')]);_0x298249[_0xbfc4('0x2e')]=_[_0xbfc4('0x2f')](_0x2232ed['query']);_0x298249[_0xbfc4('0x30')]=_[_0xbfc4('0x32')](_0x298249[_0xbfc4('0x33')],_0x298249[_0xbfc4('0x2e')]);_0x5ce72b[_0xbfc4('0x31')]=_[_0xbfc4('0x32')](_0x298249['model'],qs[_0xbfc4('0x34')](_0x2232ed[_0xbfc4('0x2e')][_0xbfc4('0x34')]));_0x5ce72b[_0xbfc4('0x31')]=_0x5ce72b['attributes'][_0xbfc4('0x35')]?_0x5ce72b['attributes']:_0x298249[_0xbfc4('0x33')];if(_0x2232ed['query'][_0xbfc4('0x3e')]){_0x5ce72b['include']=[{'all':!![]}];}_0x5ce72b=_['merge']({},_0x5ce72b,_0x2232ed[_0xbfc4('0x3d')]);return db[_0xbfc4('0x2a')][_0xbfc4('0x45')](_0x5ce72b)['then'](handleEntityNotFound(_0x342ced,null))[_0xbfc4('0x21')](respondWithResult(_0x342ced,null))['catch'](handleError(_0x342ced,null));};exports[_0xbfc4('0x46')]=function(_0x589acd,_0x46cf64){return db['FreshsalesField']['create'](_0x589acd['body'],{})[_0xbfc4('0x21')](respondWithResult(_0x46cf64,0xc9))[_0xbfc4('0x42')](handleError(_0x46cf64,null));};exports[_0xbfc4('0x20')]=function(_0x548960,_0x2c53c5){if(_0x548960[_0xbfc4('0x47')]['id']){delete _0x548960[_0xbfc4('0x47')]['id'];}return db[_0xbfc4('0x2a')][_0xbfc4('0x45')]({'where':{'id':_0x548960[_0xbfc4('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c53c5,null))['then'](saveUpdates(_0x548960[_0xbfc4('0x47')],null))[_0xbfc4('0x21')](respondWithResult(_0x2c53c5,null))[_0xbfc4('0x42')](handleError(_0x2c53c5,null));};exports[_0xbfc4('0x48')]=function(_0x505ebe,_0x17cef1){return db[_0xbfc4('0x2a')][_0xbfc4('0x45')]({'where':{'id':_0x505ebe[_0xbfc4('0x44')]['id']}})['then'](handleEntityNotFound(_0x17cef1,null))['then'](removeEntity(_0x17cef1,null))[_0xbfc4('0x42')](handleError(_0x17cef1,null));}; \ No newline at end of file +var _0xeae1=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','map','FreshsalesField','rawAttributes','fieldName','name','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','length','include','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeae1,0xd7));var _0x1eae=function(_0x5f746f,_0x5b05ab){_0x5f746f=_0x5f746f-0x0;var _0x198d15=_0xeae1[_0x5f746f];return _0x198d15;};'use strict';var emlformat=require(_0x1eae('0x0'));var rimraf=require(_0x1eae('0x1'));var zipdir=require(_0x1eae('0x2'));var jsonpatch=require(_0x1eae('0x3'));var rp=require('request-promise');var moment=require(_0x1eae('0x4'));var BPromise=require(_0x1eae('0x5'));var Mustache=require(_0x1eae('0x6'));var util=require('util');var path=require(_0x1eae('0x7'));var sox=require(_0x1eae('0x8'));var csv=require(_0x1eae('0x9'));var ejs=require(_0x1eae('0xa'));var fs=require('fs');var fs_extra=require(_0x1eae('0xb'));var _=require(_0x1eae('0xc'));var squel=require(_0x1eae('0xd'));var crypto=require('crypto');var jsforce=require(_0x1eae('0xe'));var deskjs=require(_0x1eae('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1eae('0x10'));var Papa=require(_0x1eae('0x11'));var Redis=require(_0x1eae('0x12'));var authService=require(_0x1eae('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1eae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1eae('0x15'));var utils=require(_0x1eae('0x16'));var config=require(_0x1eae('0x17'));var licenseUtil=require(_0x1eae('0x18'));var db=require(_0x1eae('0x19'))['db'];function respondWithStatusCode(_0x14e91d,_0x4a5064){_0x4a5064=_0x4a5064||0xcc;return function(_0x23c1c7){if(_0x23c1c7){return _0x14e91d['sendStatus'](_0x4a5064);}return _0x14e91d[_0x1eae('0x1a')](_0x4a5064)['end']();};}function respondWithResult(_0x36fb15,_0x54feaf){_0x54feaf=_0x54feaf||0xc8;return function(_0x5514d4){if(_0x5514d4){return _0x36fb15['status'](_0x54feaf)[_0x1eae('0x1b')](_0x5514d4);}};}function respondWithFilteredResult(_0x38a908,_0x2902a7){return function(_0x243073){if(_0x243073){var _0x2a683c=typeof _0x2902a7['offset']===_0x1eae('0x1c')&&typeof _0x2902a7['limit']===_0x1eae('0x1c');var _0x332784=_0x243073[_0x1eae('0x1d')];var _0x3c8e9c=_0x2a683c?0x0:_0x2902a7[_0x1eae('0x1e')];var _0x5a4225=_0x2a683c?_0x243073['count']:_0x2902a7[_0x1eae('0x1e')]+_0x2902a7[_0x1eae('0x1f')];var _0x5e2816;if(_0x5a4225>=_0x332784){_0x5a4225=_0x332784;_0x5e2816=0xc8;}else{_0x5e2816=0xce;}_0x38a908[_0x1eae('0x1a')](_0x5e2816);return _0x38a908[_0x1eae('0x20')](_0x1eae('0x21'),_0x3c8e9c+'-'+_0x5a4225+'/'+_0x332784)[_0x1eae('0x1b')](_0x243073);}return null;};}function patchUpdates(_0x587f0c){return function(_0xe3f4d0){try{jsonpatch['apply'](_0xe3f4d0,_0x587f0c,!![]);}catch(_0x388e85){return BPromise[_0x1eae('0x22')](_0x388e85);}return _0xe3f4d0[_0x1eae('0x23')]();};}function saveUpdates(_0x2b4eb6,_0xb36811){return function(_0x2c18d2){if(_0x2c18d2){return _0x2c18d2['update'](_0x2b4eb6)[_0x1eae('0x24')](function(_0x33de8b){return _0x33de8b;});}return null;};}function removeEntity(_0x10bf23,_0x24f92b){return function(_0x18dead){if(_0x18dead){return _0x18dead[_0x1eae('0x25')]()[_0x1eae('0x24')](function(){_0x10bf23[_0x1eae('0x1a')](0xcc)[_0x1eae('0x26')]();});}};}function handleEntityNotFound(_0x5b35e5,_0x396da5){return function(_0x2b8557){if(!_0x2b8557){_0x5b35e5[_0x1eae('0x27')](0x194);}return _0x2b8557;};}function handleError(_0x15ec90,_0x1aa1ed){_0x1aa1ed=_0x1aa1ed||0x1f4;return function(_0x2a7b30){logger[_0x1eae('0x28')](_0x2a7b30[_0x1eae('0x29')]);if(_0x2a7b30['name']){delete _0x2a7b30['name'];}_0x15ec90[_0x1eae('0x1a')](_0x1aa1ed)['send'](_0x2a7b30);};}exports['index']=function(_0x2a0f37,_0x23c686){var _0x33ac17={},_0x2b76ac={},_0x5a792d={'count':0x0,'rows':[]};var _0x2555fb=_[_0x1eae('0x2a')](db[_0x1eae('0x2b')][_0x1eae('0x2c')],function(_0xd3c6e0){return{'name':_0xd3c6e0[_0x1eae('0x2d')],'type':_0xd3c6e0['type']['key']};});_0x2b76ac['model']=_[_0x1eae('0x2a')](_0x2555fb,_0x1eae('0x2e'));_0x2b76ac[_0x1eae('0x2f')]=_[_0x1eae('0x30')](_0x2a0f37[_0x1eae('0x2f')]);_0x2b76ac['filters']=_[_0x1eae('0x31')](_0x2b76ac['model'],_0x2b76ac['query']);_0x33ac17[_0x1eae('0x32')]=_[_0x1eae('0x31')](_0x2b76ac[_0x1eae('0x33')],qs['fields'](_0x2a0f37['query'][_0x1eae('0x34')]));_0x33ac17[_0x1eae('0x32')]=_0x33ac17[_0x1eae('0x32')]['length']?_0x33ac17[_0x1eae('0x32')]:_0x2b76ac['model'];if(!_0x2a0f37[_0x1eae('0x2f')][_0x1eae('0x35')](_0x1eae('0x36'))){_0x33ac17['limit']=qs['limit'](_0x2a0f37[_0x1eae('0x2f')][_0x1eae('0x1f')]);_0x33ac17[_0x1eae('0x1e')]=qs[_0x1eae('0x1e')](_0x2a0f37[_0x1eae('0x2f')][_0x1eae('0x1e')]);}_0x33ac17[_0x1eae('0x37')]=qs[_0x1eae('0x38')](_0x2a0f37[_0x1eae('0x2f')]['sort']);_0x33ac17['where']=qs[_0x1eae('0x39')](_['pick'](_0x2a0f37['query'],_0x2b76ac[_0x1eae('0x39')]),_0x2555fb);if(_0x2a0f37[_0x1eae('0x2f')][_0x1eae('0x3a')]){_0x33ac17[_0x1eae('0x3b')]=_[_0x1eae('0x3c')](_0x33ac17[_0x1eae('0x3b')],{'$or':_[_0x1eae('0x2a')](_0x2555fb,function(_0x4cb547){if(_0x4cb547[_0x1eae('0x3d')]!==_0x1eae('0x3e')){var _0x66d8ac={};_0x66d8ac[_0x4cb547[_0x1eae('0x2e')]]={'$like':'%'+_0x2a0f37[_0x1eae('0x2f')][_0x1eae('0x3a')]+'%'};return _0x66d8ac;}})});}_0x33ac17=_[_0x1eae('0x3c')]({},_0x33ac17,_0x2a0f37['options']);var _0x17f793={'where':_0x33ac17[_0x1eae('0x3b')]};return db['FreshsalesField']['count'](_0x17f793)[_0x1eae('0x24')](function(_0x3beac8){_0x5a792d[_0x1eae('0x1d')]=_0x3beac8;if(_0x2a0f37[_0x1eae('0x2f')][_0x1eae('0x3f')]){_0x33ac17['include']=[{'all':!![]}];}return db[_0x1eae('0x2b')][_0x1eae('0x40')](_0x33ac17);})['then'](function(_0x25ad4f){_0x5a792d[_0x1eae('0x41')]=_0x25ad4f;return _0x5a792d;})['then'](respondWithFilteredResult(_0x23c686,_0x33ac17))['catch'](handleError(_0x23c686,null));};exports['show']=function(_0x4d98b1,_0x213f21){var _0x22948f={'raw':!![],'where':{'id':_0x4d98b1['params']['id']}},_0x58a7f7={};_0x58a7f7['model']=_[_0x1eae('0x30')](db[_0x1eae('0x2b')][_0x1eae('0x2c')]);_0x58a7f7[_0x1eae('0x2f')]=_[_0x1eae('0x30')](_0x4d98b1[_0x1eae('0x2f')]);_0x58a7f7[_0x1eae('0x39')]=_[_0x1eae('0x31')](_0x58a7f7[_0x1eae('0x33')],_0x58a7f7['query']);_0x22948f[_0x1eae('0x32')]=_[_0x1eae('0x31')](_0x58a7f7[_0x1eae('0x33')],qs[_0x1eae('0x34')](_0x4d98b1[_0x1eae('0x2f')][_0x1eae('0x34')]));_0x22948f[_0x1eae('0x32')]=_0x22948f['attributes'][_0x1eae('0x42')]?_0x22948f['attributes']:_0x58a7f7[_0x1eae('0x33')];if(_0x4d98b1[_0x1eae('0x2f')][_0x1eae('0x3f')]){_0x22948f[_0x1eae('0x43')]=[{'all':!![]}];}_0x22948f=_[_0x1eae('0x3c')]({},_0x22948f,_0x4d98b1[_0x1eae('0x44')]);return db[_0x1eae('0x2b')][_0x1eae('0x45')](_0x22948f)[_0x1eae('0x24')](handleEntityNotFound(_0x213f21,null))[_0x1eae('0x24')](respondWithResult(_0x213f21,null))[_0x1eae('0x46')](handleError(_0x213f21,null));};exports[_0x1eae('0x47')]=function(_0x5e2ea6,_0x44a035){return db['FreshsalesField'][_0x1eae('0x47')](_0x5e2ea6[_0x1eae('0x48')],{})[_0x1eae('0x24')](respondWithResult(_0x44a035,0xc9))['catch'](handleError(_0x44a035,null));};exports[_0x1eae('0x49')]=function(_0x271a23,_0x44b612){if(_0x271a23[_0x1eae('0x48')]['id']){delete _0x271a23[_0x1eae('0x48')]['id'];}return db[_0x1eae('0x2b')][_0x1eae('0x45')]({'where':{'id':_0x271a23[_0x1eae('0x4a')]['id']}})[_0x1eae('0x24')](handleEntityNotFound(_0x44b612,null))[_0x1eae('0x24')](saveUpdates(_0x271a23[_0x1eae('0x48')],null))[_0x1eae('0x24')](respondWithResult(_0x44b612,null))[_0x1eae('0x46')](handleError(_0x44b612,null));};exports[_0x1eae('0x25')]=function(_0x2abfed,_0x50fd20){return db[_0x1eae('0x2b')][_0x1eae('0x45')]({'where':{'id':_0x2abfed[_0x1eae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50fd20,null))['then'](removeEntity(_0x50fd20,null))[_0x1eae('0x46')](handleError(_0x50fd20,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1585fe2..3db7730 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47d6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xde314e,_0x25c712){var _0x9b4635=function(_0x281ce9){while(--_0x281ce9){_0xde314e['push'](_0xde314e['shift']());}};_0x9b4635(++_0x25c712);}(_0x47d6,0x13f));var _0x647d=function(_0x326473,_0x539145){_0x326473=_0x326473-0x0;var _0x199f57=_0x47d6[_0x326473];return _0x199f57;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var logger=require(_0x647d('0x2'))(_0x647d('0x3'));var moment=require(_0x647d('0x4'));var BPromise=require(_0x647d('0x5'));var rp=require(_0x647d('0x6'));var fs=require('fs');var path=require(_0x647d('0x7'));var rimraf=require(_0x647d('0x8'));var config=require(_0x647d('0x9'));var attributes=require(_0x647d('0xa'));module[_0x647d('0xb')]=function(_0x8a0753,_0x8ffe2b){return _0x8a0753[_0x647d('0xc')](_0x647d('0xd'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x647d('0xe'),'fields':[_0x647d('0xf'),_0x647d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe51=['idField','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xbe51,0x1e2));var _0x1be5=function(_0x2fefd2,_0x5556a2){_0x2fefd2=_0x2fefd2-0x0;var _0x37d740=_0xbe51[_0x2fefd2];return _0x37d740;};'use strict';var _=require(_0x1be5('0x0'));var util=require(_0x1be5('0x1'));var logger=require('../../config/logger')(_0x1be5('0x2'));var moment=require('moment');var BPromise=require(_0x1be5('0x3'));var rp=require(_0x1be5('0x4'));var fs=require('fs');var path=require(_0x1be5('0x5'));var rimraf=require(_0x1be5('0x6'));var config=require(_0x1be5('0x7'));var attributes=require(_0x1be5('0x8'));module[_0x1be5('0x9')]=function(_0x372836,_0x288927){return _0x372836[_0x1be5('0xa')](_0x1be5('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x1be5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 19893d3..600bb2e 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x3fe487,_0x13705b){var _0x4d8cee=function(_0x155471){while(--_0x155471){_0x3fe487['push'](_0x3fe487['shift']());}};_0x4d8cee(++_0x13705b);}(_0x187d,0x93));var _0xd187=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x187d[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0xeda8=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent'];(function(_0xbd851d,_0x41bbee){var _0x54e729=function(_0x260c7c){while(--_0x260c7c){_0xbd851d['push'](_0xbd851d['shift']());}};_0x54e729(++_0x41bbee);}(_0xeda8,0x104));var _0x8eda=function(_0x4615a1,_0xdd31da){_0x4615a1=_0x4615a1-0x0;var _0x54cb84=_0xeda8[_0x4615a1];return _0x54cb84;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0933bd6..b03047c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5b65f3,_0x5bd9de){var _0xdd3a96=function(_0x577db2){while(--_0x577db2){_0x5b65f3['push'](_0x5b65f3['shift']());}};_0xdd3a96(++_0x5bd9de);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x41e14c,_0x558cca){var _0x48c08f=function(_0x596f25){while(--_0x596f25){_0x41e14c['push'](_0x41e14c['shift']());}};_0x48c08f(++_0x558cca);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b2539c6..53fa744 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1241=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x1241,0xb4));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1124('0x0'));module['exports']={'name':{'type':Sequelize[_0x1124('0x1')]},'description':{'type':Sequelize[_0x1124('0x1')]},'username':{'type':Sequelize[_0x1124('0x1')],'unique':_0x1124('0x2')},'remoteUri':{'type':Sequelize[_0x1124('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1124('0x1')]},'clientSecret':{'type':Sequelize[_0x1124('0x1')]},'securityToken':{'type':Sequelize[_0x1124('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1124('0x3')](_0x1124('0x4'),_0x1124('0x5')),'defaultValue':_0x1124('0x4')}}; \ No newline at end of file +var _0x9672=['STRING','username','integrationTab','newTab','sequelize','exports'];(function(_0x57845e,_0x398992){var _0x300c7c=function(_0xe82ba2){while(--_0xe82ba2){_0x57845e['push'](_0x57845e['shift']());}};_0x300c7c(++_0x398992);}(_0x9672,0xee));var _0x2967=function(_0x35e759,_0x42bbc4){_0x35e759=_0x35e759-0x0;var _0x10c4c1=_0x9672[_0x35e759];return _0x10c4c1;};'use strict';var Sequelize=require(_0x2967('0x0'));module[_0x2967('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2967('0x2')]},'username':{'type':Sequelize[_0x2967('0x2')],'unique':_0x2967('0x3')},'remoteUri':{'type':Sequelize[_0x2967('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2967('0x2')]},'clientSecret':{'type':Sequelize[_0x2967('0x2')]},'securityToken':{'type':Sequelize[_0x2967('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2967('0x4'),_0x2967('0x5')),'defaultValue':_0x2967('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 10689a9..fb7c74b 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe844=['query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','filter','options','SalesforceAccount','includeAll','include','findAll','show','params','catch','create','body','find','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','int','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model'];(function(_0x2de3fb,_0xf26443){var _0x29ab6b=function(_0x17d7fc){while(--_0x17d7fc){_0x2de3fb['push'](_0x2de3fb['shift']());}};_0x29ab6b(++_0xf26443);}(_0xe844,0xc4));var _0x4e84=function(_0x42bb20,_0x1a6227){_0x42bb20=_0x42bb20-0x0;var _0x612403=_0xe844[_0x42bb20];return _0x612403;};'use strict';var emlformat=require(_0x4e84('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e84('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e84('0x2'));var BPromise=require(_0x4e84('0x3'));var Mustache=require('mustache');var util=require(_0x4e84('0x4'));var path=require(_0x4e84('0x5'));var sox=require(_0x4e84('0x6'));var csv=require(_0x4e84('0x7'));var ejs=require(_0x4e84('0x8'));var fs=require('fs');var fs_extra=require(_0x4e84('0x9'));var _=require('lodash');var squel=require(_0x4e84('0xa'));var crypto=require(_0x4e84('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4e84('0x7'));var querystring=require(_0x4e84('0xc'));var Papa=require(_0x4e84('0xd'));var Redis=require(_0x4e84('0xe'));var authService=require(_0x4e84('0xf'));var qs=require(_0x4e84('0x10'));var as=require(_0x4e84('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4e84('0x12'));var utils=require('../../config/utils');var config=require(_0x4e84('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e84('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x15bfc3,_0x180965){_0x180965=_0x180965||0xcc;return function(_0x1909ed){if(_0x1909ed){return _0x15bfc3[_0x4e84('0x15')](_0x180965);}return _0x15bfc3[_0x4e84('0x16')](_0x180965)[_0x4e84('0x17')]();};}function respondWithResult(_0xfa64e1,_0x1d818e){_0x1d818e=_0x1d818e||0xc8;return function(_0x552020){if(_0x552020){return _0xfa64e1[_0x4e84('0x16')](_0x1d818e)[_0x4e84('0x18')](_0x552020);}};}function respondWithFilteredResult(_0x50e432,_0x128f53){return function(_0x2019de){if(_0x2019de){var _0x129ab5=typeof _0x128f53[_0x4e84('0x19')]===_0x4e84('0x1a')&&typeof _0x128f53['limit']==='undefined';var _0x1f3f54=_0x2019de[_0x4e84('0x1b')];var _0x4b59f8=_0x129ab5?0x0:_0x128f53[_0x4e84('0x19')];var _0x2b9c2b=_0x129ab5?_0x2019de[_0x4e84('0x1b')]:_0x128f53[_0x4e84('0x19')]+_0x128f53[_0x4e84('0x1c')];var _0x5d5bd6;if(_0x2b9c2b>=_0x1f3f54){_0x2b9c2b=_0x1f3f54;_0x5d5bd6=0xc8;}else{_0x5d5bd6=0xce;}_0x50e432[_0x4e84('0x16')](_0x5d5bd6);return _0x50e432[_0x4e84('0x1d')](_0x4e84('0x1e'),_0x4b59f8+'-'+_0x2b9c2b+'/'+_0x1f3f54)[_0x4e84('0x18')](_0x2019de);}return null;};}function patchUpdates(_0x4537d5){return function(_0x1be6c1){try{jsonpatch[_0x4e84('0x1f')](_0x1be6c1,_0x4537d5,!![]);}catch(_0x3c47b5){return BPromise['reject'](_0x3c47b5);}return _0x1be6c1[_0x4e84('0x20')]();};}function saveUpdates(_0x2acff5,_0x43beb2){return function(_0x5903fc){if(_0x5903fc){return _0x5903fc[_0x4e84('0x21')](_0x2acff5)[_0x4e84('0x22')](function(_0xf9ac39){return _0xf9ac39;});}return null;};}function removeEntity(_0x2457b9,_0x1460d9){return function(_0x5e87c9){if(_0x5e87c9){return _0x5e87c9['destroy']()[_0x4e84('0x22')](function(){_0x2457b9[_0x4e84('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d410f,_0x1c43ce){return function(_0x51570c){if(!_0x51570c){_0x3d410f[_0x4e84('0x15')](0x194);}return _0x51570c;};}function handleError(_0x1e4097,_0xd018ea){_0xd018ea=_0xd018ea||0x1f4;return function(_0x409ed4){logger['error'](_0x409ed4[_0x4e84('0x23')]);if(_0x409ed4[_0x4e84('0x24')]){delete _0x409ed4[_0x4e84('0x24')];}_0x1e4097['status'](_0xd018ea)[_0x4e84('0x25')](_0x409ed4);};}exports[_0x4e84('0x26')]=function(_0x3faa7e,_0x5074ae){var _0x291e4f={},_0x7d16ea={},_0x239182={'count':0x0,'rows':[]};var _0x69a632=_[_0x4e84('0x27')](db['SalesforceAccount'][_0x4e84('0x28')],function(_0x49febb){return{'name':_0x49febb['fieldName'],'type':_0x49febb[_0x4e84('0x29')][_0x4e84('0x2a')]};});_0x7d16ea[_0x4e84('0x2b')]=_['map'](_0x69a632,'name');_0x7d16ea[_0x4e84('0x2c')]=_[_0x4e84('0x2d')](_0x3faa7e['query']);_0x7d16ea[_0x4e84('0x2e')]=_['intersection'](_0x7d16ea['model'],_0x7d16ea[_0x4e84('0x2c')]);_0x291e4f[_0x4e84('0x2f')]=_[_0x4e84('0x30')](_0x7d16ea[_0x4e84('0x2b')],qs[_0x4e84('0x31')](_0x3faa7e[_0x4e84('0x2c')][_0x4e84('0x31')]));_0x291e4f['attributes']=_0x291e4f[_0x4e84('0x2f')][_0x4e84('0x32')]?_0x291e4f[_0x4e84('0x2f')]:_0x7d16ea['model'];if(!_0x3faa7e['query']['hasOwnProperty'](_0x4e84('0x33'))){_0x291e4f[_0x4e84('0x1c')]=qs[_0x4e84('0x1c')](_0x3faa7e[_0x4e84('0x2c')]['limit']);_0x291e4f[_0x4e84('0x19')]=qs[_0x4e84('0x19')](_0x3faa7e['query'][_0x4e84('0x19')]);}_0x291e4f[_0x4e84('0x34')]=qs[_0x4e84('0x35')](_0x3faa7e['query'][_0x4e84('0x35')]);_0x291e4f[_0x4e84('0x36')]=qs[_0x4e84('0x2e')](_['pick'](_0x3faa7e[_0x4e84('0x2c')],_0x7d16ea[_0x4e84('0x2e')]),_0x69a632);if(_0x3faa7e[_0x4e84('0x2c')]['filter']){_0x291e4f[_0x4e84('0x36')]=_[_0x4e84('0x37')](_0x291e4f[_0x4e84('0x36')],{'$or':_[_0x4e84('0x27')](_0x69a632,function(_0x108c05){if(_0x108c05[_0x4e84('0x29')]!=='VIRTUAL'){var _0x4de9fb={};_0x4de9fb[_0x108c05[_0x4e84('0x24')]]={'$like':'%'+_0x3faa7e[_0x4e84('0x2c')][_0x4e84('0x38')]+'%'};return _0x4de9fb;}})});}_0x291e4f=_[_0x4e84('0x37')]({},_0x291e4f,_0x3faa7e[_0x4e84('0x39')]);var _0x595173={'where':_0x291e4f['where']};return db[_0x4e84('0x3a')][_0x4e84('0x1b')](_0x595173)[_0x4e84('0x22')](function(_0xadfdba){_0x239182[_0x4e84('0x1b')]=_0xadfdba;if(_0x3faa7e['query'][_0x4e84('0x3b')]){_0x291e4f[_0x4e84('0x3c')]=[{'all':!![]}];}return db[_0x4e84('0x3a')][_0x4e84('0x3d')](_0x291e4f);})[_0x4e84('0x22')](function(_0x959b38){_0x239182['rows']=_0x959b38;return _0x239182;})['then'](respondWithFilteredResult(_0x5074ae,_0x291e4f))['catch'](handleError(_0x5074ae,null));};exports[_0x4e84('0x3e')]=function(_0x19326e,_0x414293){var _0x12ff0c={'raw':![],'where':{'id':_0x19326e[_0x4e84('0x3f')]['id']}},_0x474e8e={};_0x474e8e[_0x4e84('0x2b')]=_[_0x4e84('0x2d')](db['SalesforceAccount'][_0x4e84('0x28')]);_0x474e8e[_0x4e84('0x2c')]=_[_0x4e84('0x2d')](_0x19326e[_0x4e84('0x2c')]);_0x474e8e['filters']=_[_0x4e84('0x30')](_0x474e8e['model'],_0x474e8e[_0x4e84('0x2c')]);_0x12ff0c['attributes']=_[_0x4e84('0x30')](_0x474e8e[_0x4e84('0x2b')],qs[_0x4e84('0x31')](_0x19326e[_0x4e84('0x2c')]['fields']));_0x12ff0c[_0x4e84('0x2f')]=_0x12ff0c[_0x4e84('0x2f')][_0x4e84('0x32')]?_0x12ff0c[_0x4e84('0x2f')]:_0x474e8e[_0x4e84('0x2b')];if(_0x19326e[_0x4e84('0x2c')][_0x4e84('0x3b')]){_0x12ff0c['include']=[{'all':!![]}];}_0x12ff0c=_[_0x4e84('0x37')]({},_0x12ff0c,_0x19326e['options']);return db[_0x4e84('0x3a')]['find'](_0x12ff0c)['then'](handleEntityNotFound(_0x414293,null))[_0x4e84('0x22')](respondWithResult(_0x414293,null))[_0x4e84('0x40')](handleError(_0x414293,null));};exports[_0x4e84('0x41')]=function(_0x306574,_0x10fd80){return db[_0x4e84('0x3a')][_0x4e84('0x41')](_0x306574[_0x4e84('0x42')],{})[_0x4e84('0x22')](respondWithResult(_0x10fd80,0xc9))['catch'](handleError(_0x10fd80,null));};exports[_0x4e84('0x21')]=function(_0x1469b1,_0x1c1ad1){if(_0x1469b1[_0x4e84('0x42')]['id']){delete _0x1469b1[_0x4e84('0x42')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x1469b1['params']['id']}})['then'](handleEntityNotFound(_0x1c1ad1,null))[_0x4e84('0x22')](saveUpdates(_0x1469b1[_0x4e84('0x42')],null))[_0x4e84('0x22')](respondWithResult(_0x1c1ad1,null))['catch'](handleError(_0x1c1ad1,null));};exports['destroy']=function(_0x566114,_0x25d572){return db[_0x4e84('0x3a')][_0x4e84('0x43')]({'where':{'id':_0x566114[_0x4e84('0x3f')]['id']}})[_0x4e84('0x22')](handleEntityNotFound(_0x25d572,null))[_0x4e84('0x22')](removeEntity(_0x25d572,null))[_0x4e84('0x40')](handleError(_0x25d572,null));};exports[_0x4e84('0x44')]=function(_0x18c702,_0x35218f,_0x35bb95){var _0x4de87d={};var _0x282b16={};var _0x9d3072;var _0x133eb1;return db[_0x4e84('0x3a')]['findOne']({'where':{'id':_0x18c702['params']['id']}})['then'](handleEntityNotFound(_0x35218f,null))[_0x4e84('0x22')](function(_0x2ca8a9){if(_0x2ca8a9){_0x9d3072=_0x2ca8a9;_0x282b16[_0x4e84('0x2b')]=_[_0x4e84('0x2d')](db['SalesforceConfiguration'][_0x4e84('0x28')]);_0x282b16['query']=_[_0x4e84('0x2d')](_0x18c702[_0x4e84('0x2c')]);_0x282b16[_0x4e84('0x2e')]=_[_0x4e84('0x30')](_0x282b16[_0x4e84('0x2b')],_0x282b16[_0x4e84('0x2c')]);_0x4de87d[_0x4e84('0x2f')]=_[_0x4e84('0x30')](_0x282b16['model'],qs[_0x4e84('0x31')](_0x18c702[_0x4e84('0x2c')][_0x4e84('0x31')]));_0x4de87d['attributes']=_0x4de87d[_0x4e84('0x2f')][_0x4e84('0x32')]?_0x4de87d[_0x4e84('0x2f')]:_0x282b16[_0x4e84('0x2b')];_0x4de87d['order']=qs[_0x4e84('0x35')](_0x18c702[_0x4e84('0x2c')][_0x4e84('0x35')]);_0x4de87d[_0x4e84('0x36')]=qs[_0x4e84('0x2e')](_['pick'](_0x18c702[_0x4e84('0x2c')],_0x282b16[_0x4e84('0x2e')]));if(_0x18c702[_0x4e84('0x2c')]['filter']){_0x4de87d[_0x4e84('0x36')]=_[_0x4e84('0x37')](_0x4de87d[_0x4e84('0x36')],{'$or':_[_0x4e84('0x27')](_0x4de87d[_0x4e84('0x2f')],function(_0x27b46b){var _0x5416c7={};_0x5416c7[_0x27b46b]={'$like':'%'+_0x18c702[_0x4e84('0x2c')][_0x4e84('0x38')]+'%'};return _0x5416c7;})});}_0x4de87d=_[_0x4e84('0x37')]({},_0x4de87d,_0x18c702[_0x4e84('0x39')]);return _0x9d3072['getConfigurations'](_0x4de87d);}})[_0x4e84('0x22')](function(_0x2f1a14){if(_0x2f1a14){_0x133eb1=_0x2f1a14[_0x4e84('0x32')];if(!_0x18c702[_0x4e84('0x2c')]['hasOwnProperty'](_0x4e84('0x33'))){_0x4de87d['limit']=qs[_0x4e84('0x1c')](_0x18c702[_0x4e84('0x2c')]['limit']);_0x4de87d[_0x4e84('0x19')]=qs['offset'](_0x18c702[_0x4e84('0x2c')][_0x4e84('0x19')]);}return _0x9d3072[_0x4e84('0x44')](_0x4de87d);}})['then'](function(_0x33c44d){if(_0x33c44d){return _0x33c44d?{'count':_0x133eb1,'rows':_0x33c44d}:null;}})['then'](respondWithResult(_0x35218f,null))[_0x4e84('0x40')](handleError(_0x35218f,null));};exports[_0x4e84('0x45')]=function(_0x453148,_0x32a49e,_0x23c134){if(_0x453148[_0x4e84('0x42')]['id']){delete _0x453148[_0x4e84('0x42')]['id'];}return db[_0x4e84('0x3a')][_0x4e84('0x46')]({'where':{'id':_0x453148[_0x4e84('0x3f')]['id']}})[_0x4e84('0x22')](handleEntityNotFound(_0x32a49e,null))[_0x4e84('0x22')](function(_0x2708e5){if(_0x2708e5){_0x453148[_0x4e84('0x42')][_0x4e84('0x47')]=_0x2708e5['id'];_0x453148['body'][_0x4e84('0x48')]=integrations[_0x4e84('0x49')](_0x453148['body'][_0x4e84('0x4a')],_0x453148[_0x4e84('0x42')][_0x4e84('0x29')]);_0x453148[_0x4e84('0x42')][_0x4e84('0x4b')]=integrations['getDescriptions'](_0x453148[_0x4e84('0x42')][_0x4e84('0x4a')],_0x453148[_0x4e84('0x42')][_0x4e84('0x29')]);return db[_0x4e84('0x4c')][_0x4e84('0x41')](_0x453148[_0x4e84('0x42')],{'include':[{'model':db[_0x4e84('0x4d')],'as':'Subjects'},{'model':db[_0x4e84('0x4d')],'as':_0x4e84('0x4b')}]});}return null;})[_0x4e84('0x22')](respondWithResult(_0x32a49e,null))[_0x4e84('0x40')](handleError(_0x32a49e,null));};exports['getFields']=function(_0x7765ea,_0x1a7bf,_0x12525){var _0x5e7748;var _0x1e7829='';var _0x1e87ab='Task';return db[_0x4e84('0x3a')]['findOne']({'where':{'id':_0x7765ea['params']['id']},'attributes':['id',_0x4e84('0x4e'),_0x4e84('0x4f'),_0x4e84('0x50'),_0x4e84('0x51'),_0x4e84('0x52'),_0x4e84('0x53')]})['then'](handleEntityNotFound(_0x1a7bf,null))[_0x4e84('0x22')](function(_0x3418cc){if(_0x3418cc){_0x1e7829=_0x3418cc[_0x4e84('0x4e')];var _0x416746=_0x1e7829[_0x4e84('0x54')](-0x1);if(_0x416746==='/'){_0x1e7829=_0x1e7829[_0x4e84('0x55')](0x0,_0x1e7829[_0x4e84('0x56')](_0x416746));}_0x5e7748=new jsforce[(_0x4e84('0x57'))]({'oauth2':{'loginUrl':_0x1e7829,'clientId':_0x3418cc[_0x4e84('0x4f')],'clientSecret':_0x3418cc[_0x4e84('0x50')]}});return _0x5e7748[_0x4e84('0x58')](_0x3418cc[_0x4e84('0x51')],_0x3418cc[_0x4e84('0x52')][_0x4e84('0x59')](_0x3418cc[_0x4e84('0x53')]));}})[_0x4e84('0x22')](function(_0x4fbddb){if(_0x4fbddb){if(!_[_0x4e84('0x5a')](_0x7765ea[_0x4e84('0x2c')][_0x4e84('0x5b')])){_0x1e87ab=_0x7765ea[_0x4e84('0x2c')][_0x4e84('0x5b')];}return _0x5e7748[_0x4e84('0x5c')](_0x1e87ab)[_0x4e84('0x5d')]();}})[_0x4e84('0x22')](function(_0x33cdc7){var _0x117a9d=[_0x4e84('0x5e'),_0x4e84('0x5f'),_0x4e84('0x60'),_0x4e84('0x61'),'Subject',_0x4e84('0x62')];var _0x1fabd4=['string',_0x4e84('0x63'),'picklist',_0x4e84('0x64'),_0x4e84('0x65'),_0x4e84('0x66'),'phone'];if(_0x33cdc7){_[_0x4e84('0x67')](_0x33cdc7[_0x4e84('0x31')],function(_0x218a7b){return _0x117a9d[_0x4e84('0x68')](_0x218a7b[_0x4e84('0x24')])||!_0x1fabd4[_0x4e84('0x68')](_0x218a7b[_0x4e84('0x29')]);});return{'count':_0x33cdc7['fields']['length'],'rows':_[_0x4e84('0x27')](_0x33cdc7['fields'],function(_0x1b37e2){return{'id':_0x1b37e2[_0x4e84('0x24')],'name':_0x1b37e2[_0x4e84('0x69')],'custom':_0x1b37e2[_0x4e84('0x6a')],'options':_0x1b37e2[_0x4e84('0x6b')][_0x4e84('0x32')]>0x0?_[_0x4e84('0x27')](_0x1b37e2['picklistValues'],function(_0x28f99a){return{'name':_0x28f99a[_0x4e84('0x69')],'value':_0x28f99a[_0x4e84('0x6c')]};}):_0x1b37e2[_0x4e84('0x29')]==_0x4e84('0x64')?[{'name':_0x4e84('0x6d'),'value':_0x4e84('0x6e')},{'name':_0x4e84('0x6f'),'value':_0x4e84('0x70')}]:[]};})};}})[_0x4e84('0x22')](respondWithResult(_0x1a7bf,null))[_0x4e84('0x40')](function(_0xef3b88){var _0x36e5b5=_0x7765ea[_0x4e84('0x2c')]['test']?0x1f4:_0xef3b88[_0x4e84('0x71')]||0x1f4;logger[_0x4e84('0x72')](_0x4e84('0x73'),_0x4e84('0x74'),_0x36e5b5,JSON[_0x4e84('0x75')](_0xef3b88));delete _0xef3b88[_0x4e84('0x24')];if(_0x36e5b5===0x191){_0x36e5b5=0x190;}_0x1a7bf[_0x4e84('0x16')](_0x36e5b5)[_0x4e84('0x25')](_0x7765ea[_0x4e84('0x2c')][_0x4e84('0x76')]?{'message':_0x4e84('0x77'),'statusCode':_0xef3b88[_0x4e84('0x71')]}:_0xef3b88);});}; \ No newline at end of file +var _0x8174=['custom','picklistValues','label','value','true','False','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','SalesforceAccount','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','length','offset','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','AccountId','getSubjects','channel','getDescriptions','Subjects','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','Connection','login','concat','isNil','ticketType','describe','OwnerId','IsReminderSet','IsRecurrence','string','int','boolean','email','remove','includes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8174,0x175));var _0x4817=function(_0x614dc5,_0x3dd98e){_0x614dc5=_0x614dc5-0x0;var _0x571e07=_0x8174[_0x614dc5];return _0x571e07;};'use strict';var emlformat=require(_0x4817('0x0'));var rimraf=require(_0x4817('0x1'));var zipdir=require(_0x4817('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4817('0x3'));var moment=require(_0x4817('0x4'));var BPromise=require(_0x4817('0x5'));var Mustache=require(_0x4817('0x6'));var util=require(_0x4817('0x7'));var path=require('path');var sox=require(_0x4817('0x8'));var csv=require('to-csv');var ejs=require(_0x4817('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4817('0xa'));var squel=require(_0x4817('0xb'));var crypto=require('crypto');var jsforce=require(_0x4817('0xc'));var deskjs=require(_0x4817('0xd'));var toCsv=require(_0x4817('0xe'));var querystring=require(_0x4817('0xf'));var Papa=require('papaparse');var Redis=require(_0x4817('0x10'));var authService=require(_0x4817('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4817('0x12'));var hardwareService=require(_0x4817('0x13'));var logger=require(_0x4817('0x14'))('api');var utils=require(_0x4817('0x15'));var config=require(_0x4817('0x16'));var licenseUtil=require(_0x4817('0x17'));var db=require(_0x4817('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x181aa3,_0x1b4d9f){_0x1b4d9f=_0x1b4d9f||0xcc;return function(_0x1e24ff){if(_0x1e24ff){return _0x181aa3[_0x4817('0x19')](_0x1b4d9f);}return _0x181aa3[_0x4817('0x1a')](_0x1b4d9f)[_0x4817('0x1b')]();};}function respondWithResult(_0x58e528,_0x5da58c){_0x5da58c=_0x5da58c||0xc8;return function(_0x4d8a6b){if(_0x4d8a6b){return _0x58e528[_0x4817('0x1a')](_0x5da58c)[_0x4817('0x1c')](_0x4d8a6b);}};}function respondWithFilteredResult(_0x21da99,_0xfe9b37){return function(_0x4e4847){if(_0x4e4847){var _0x2d2b2f=typeof _0xfe9b37['offset']===_0x4817('0x1d')&&typeof _0xfe9b37[_0x4817('0x1e')]===_0x4817('0x1d');var _0x4f5a05=_0x4e4847[_0x4817('0x1f')];var _0x2666db=_0x2d2b2f?0x0:_0xfe9b37['offset'];var _0x44af97=_0x2d2b2f?_0x4e4847['count']:_0xfe9b37['offset']+_0xfe9b37[_0x4817('0x1e')];var _0x3f7f61;if(_0x44af97>=_0x4f5a05){_0x44af97=_0x4f5a05;_0x3f7f61=0xc8;}else{_0x3f7f61=0xce;}_0x21da99[_0x4817('0x1a')](_0x3f7f61);return _0x21da99[_0x4817('0x20')](_0x4817('0x21'),_0x2666db+'-'+_0x44af97+'/'+_0x4f5a05)[_0x4817('0x1c')](_0x4e4847);}return null;};}function patchUpdates(_0x3cc9c2){return function(_0x1c773e){try{jsonpatch[_0x4817('0x22')](_0x1c773e,_0x3cc9c2,!![]);}catch(_0x357412){return BPromise[_0x4817('0x23')](_0x357412);}return _0x1c773e[_0x4817('0x24')]();};}function saveUpdates(_0x434495,_0x1786e7){return function(_0x5951fa){if(_0x5951fa){return _0x5951fa[_0x4817('0x25')](_0x434495)[_0x4817('0x26')](function(_0x48c10a){return _0x48c10a;});}return null;};}function removeEntity(_0x309b94,_0x25e7e6){return function(_0x2e293b){if(_0x2e293b){return _0x2e293b[_0x4817('0x27')]()[_0x4817('0x26')](function(){_0x309b94[_0x4817('0x1a')](0xcc)[_0x4817('0x1b')]();});}};}function handleEntityNotFound(_0x3f2bef,_0x251c62){return function(_0x40e32a){if(!_0x40e32a){_0x3f2bef[_0x4817('0x19')](0x194);}return _0x40e32a;};}function handleError(_0x317dc5,_0x4d8b85){_0x4d8b85=_0x4d8b85||0x1f4;return function(_0x35a363){logger['error'](_0x35a363[_0x4817('0x28')]);if(_0x35a363[_0x4817('0x29')]){delete _0x35a363[_0x4817('0x29')];}_0x317dc5[_0x4817('0x1a')](_0x4d8b85)['send'](_0x35a363);};}exports[_0x4817('0x2a')]=function(_0x377212,_0x12ffea){var _0x253b25={},_0x2b5156={},_0x49b1d9={'count':0x0,'rows':[]};var _0x2d2cf7=_['map'](db[_0x4817('0x2b')]['rawAttributes'],function(_0x13739d){return{'name':_0x13739d[_0x4817('0x2c')],'type':_0x13739d[_0x4817('0x2d')][_0x4817('0x2e')]};});_0x2b5156['model']=_[_0x4817('0x2f')](_0x2d2cf7,_0x4817('0x29'));_0x2b5156['query']=_[_0x4817('0x30')](_0x377212[_0x4817('0x31')]);_0x2b5156['filters']=_[_0x4817('0x32')](_0x2b5156[_0x4817('0x33')],_0x2b5156[_0x4817('0x31')]);_0x253b25[_0x4817('0x34')]=_[_0x4817('0x32')](_0x2b5156['model'],qs[_0x4817('0x35')](_0x377212[_0x4817('0x31')][_0x4817('0x35')]));_0x253b25[_0x4817('0x34')]=_0x253b25[_0x4817('0x34')][_0x4817('0x36')]?_0x253b25['attributes']:_0x2b5156['model'];if(!_0x377212['query']['hasOwnProperty']('nolimit')){_0x253b25['limit']=qs[_0x4817('0x1e')](_0x377212[_0x4817('0x31')][_0x4817('0x1e')]);_0x253b25[_0x4817('0x37')]=qs[_0x4817('0x37')](_0x377212['query'][_0x4817('0x37')]);}_0x253b25['order']=qs[_0x4817('0x38')](_0x377212[_0x4817('0x31')]['sort']);_0x253b25['where']=qs[_0x4817('0x39')](_['pick'](_0x377212['query'],_0x2b5156[_0x4817('0x39')]),_0x2d2cf7);if(_0x377212[_0x4817('0x31')][_0x4817('0x3a')]){_0x253b25[_0x4817('0x3b')]=_[_0x4817('0x3c')](_0x253b25[_0x4817('0x3b')],{'$or':_[_0x4817('0x2f')](_0x2d2cf7,function(_0x166547){if(_0x166547[_0x4817('0x2d')]!==_0x4817('0x3d')){var _0x4eff8d={};_0x4eff8d[_0x166547[_0x4817('0x29')]]={'$like':'%'+_0x377212[_0x4817('0x31')][_0x4817('0x3a')]+'%'};return _0x4eff8d;}})});}_0x253b25=_[_0x4817('0x3c')]({},_0x253b25,_0x377212[_0x4817('0x3e')]);var _0x5294ef={'where':_0x253b25[_0x4817('0x3b')]};return db[_0x4817('0x2b')]['count'](_0x5294ef)[_0x4817('0x26')](function(_0x1bc8f3){_0x49b1d9[_0x4817('0x1f')]=_0x1bc8f3;if(_0x377212[_0x4817('0x31')][_0x4817('0x3f')]){_0x253b25[_0x4817('0x40')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x253b25);})[_0x4817('0x26')](function(_0x5d1ac4){_0x49b1d9[_0x4817('0x41')]=_0x5d1ac4;return _0x49b1d9;})[_0x4817('0x26')](respondWithFilteredResult(_0x12ffea,_0x253b25))[_0x4817('0x42')](handleError(_0x12ffea,null));};exports[_0x4817('0x43')]=function(_0x3bdf1b,_0x5b4143){var _0x3cb650={'raw':![],'where':{'id':_0x3bdf1b[_0x4817('0x44')]['id']}},_0x1a224e={};_0x1a224e[_0x4817('0x33')]=_[_0x4817('0x30')](db[_0x4817('0x2b')][_0x4817('0x45')]);_0x1a224e['query']=_['keys'](_0x3bdf1b[_0x4817('0x31')]);_0x1a224e['filters']=_[_0x4817('0x32')](_0x1a224e[_0x4817('0x33')],_0x1a224e[_0x4817('0x31')]);_0x3cb650[_0x4817('0x34')]=_['intersection'](_0x1a224e[_0x4817('0x33')],qs['fields'](_0x3bdf1b['query'][_0x4817('0x35')]));_0x3cb650[_0x4817('0x34')]=_0x3cb650[_0x4817('0x34')][_0x4817('0x36')]?_0x3cb650[_0x4817('0x34')]:_0x1a224e[_0x4817('0x33')];if(_0x3bdf1b[_0x4817('0x31')][_0x4817('0x3f')]){_0x3cb650[_0x4817('0x40')]=[{'all':!![]}];}_0x3cb650=_[_0x4817('0x3c')]({},_0x3cb650,_0x3bdf1b['options']);return db[_0x4817('0x2b')][_0x4817('0x46')](_0x3cb650)[_0x4817('0x26')](handleEntityNotFound(_0x5b4143,null))[_0x4817('0x26')](respondWithResult(_0x5b4143,null))[_0x4817('0x42')](handleError(_0x5b4143,null));};exports[_0x4817('0x47')]=function(_0x35f175,_0x1590ab){return db[_0x4817('0x2b')][_0x4817('0x47')](_0x35f175[_0x4817('0x48')],{})[_0x4817('0x26')](respondWithResult(_0x1590ab,0xc9))[_0x4817('0x42')](handleError(_0x1590ab,null));};exports[_0x4817('0x25')]=function(_0x5d23a2,_0x53d11c){if(_0x5d23a2[_0x4817('0x48')]['id']){delete _0x5d23a2['body']['id'];}return db[_0x4817('0x2b')][_0x4817('0x46')]({'where':{'id':_0x5d23a2['params']['id']}})[_0x4817('0x26')](handleEntityNotFound(_0x53d11c,null))[_0x4817('0x26')](saveUpdates(_0x5d23a2[_0x4817('0x48')],null))[_0x4817('0x26')](respondWithResult(_0x53d11c,null))[_0x4817('0x42')](handleError(_0x53d11c,null));};exports[_0x4817('0x27')]=function(_0x10dc29,_0x2398fc){return db[_0x4817('0x2b')][_0x4817('0x46')]({'where':{'id':_0x10dc29[_0x4817('0x44')]['id']}})[_0x4817('0x26')](handleEntityNotFound(_0x2398fc,null))[_0x4817('0x26')](removeEntity(_0x2398fc,null))[_0x4817('0x42')](handleError(_0x2398fc,null));};exports[_0x4817('0x49')]=function(_0x2f75c9,_0x189ad7,_0x2e2a90){var _0x17d969={};var _0x411fb0={};var _0xd21696;var _0x216ac9;return db[_0x4817('0x2b')][_0x4817('0x4a')]({'where':{'id':_0x2f75c9['params']['id']}})[_0x4817('0x26')](handleEntityNotFound(_0x189ad7,null))[_0x4817('0x26')](function(_0x209410){if(_0x209410){_0xd21696=_0x209410;_0x411fb0['model']=_[_0x4817('0x30')](db[_0x4817('0x4b')][_0x4817('0x45')]);_0x411fb0[_0x4817('0x31')]=_[_0x4817('0x30')](_0x2f75c9[_0x4817('0x31')]);_0x411fb0[_0x4817('0x39')]=_['intersection'](_0x411fb0[_0x4817('0x33')],_0x411fb0[_0x4817('0x31')]);_0x17d969[_0x4817('0x34')]=_['intersection'](_0x411fb0[_0x4817('0x33')],qs[_0x4817('0x35')](_0x2f75c9['query']['fields']));_0x17d969[_0x4817('0x34')]=_0x17d969[_0x4817('0x34')][_0x4817('0x36')]?_0x17d969['attributes']:_0x411fb0['model'];_0x17d969['order']=qs['sort'](_0x2f75c9['query'][_0x4817('0x38')]);_0x17d969[_0x4817('0x3b')]=qs[_0x4817('0x39')](_['pick'](_0x2f75c9[_0x4817('0x31')],_0x411fb0['filters']));if(_0x2f75c9[_0x4817('0x31')]['filter']){_0x17d969[_0x4817('0x3b')]=_[_0x4817('0x3c')](_0x17d969[_0x4817('0x3b')],{'$or':_[_0x4817('0x2f')](_0x17d969[_0x4817('0x34')],function(_0x406c61){var _0x205c3f={};_0x205c3f[_0x406c61]={'$like':'%'+_0x2f75c9['query'][_0x4817('0x3a')]+'%'};return _0x205c3f;})});}_0x17d969=_[_0x4817('0x3c')]({},_0x17d969,_0x2f75c9[_0x4817('0x3e')]);return _0xd21696[_0x4817('0x49')](_0x17d969);}})['then'](function(_0x330708){if(_0x330708){_0x216ac9=_0x330708['length'];if(!_0x2f75c9['query']['hasOwnProperty'](_0x4817('0x4c'))){_0x17d969['limit']=qs[_0x4817('0x1e')](_0x2f75c9[_0x4817('0x31')][_0x4817('0x1e')]);_0x17d969['offset']=qs[_0x4817('0x37')](_0x2f75c9[_0x4817('0x31')]['offset']);}return _0xd21696[_0x4817('0x49')](_0x17d969);}})['then'](function(_0x3f3953){if(_0x3f3953){return _0x3f3953?{'count':_0x216ac9,'rows':_0x3f3953}:null;}})[_0x4817('0x26')](respondWithResult(_0x189ad7,null))[_0x4817('0x42')](handleError(_0x189ad7,null));};exports['addConfiguration']=function(_0x360cd2,_0x5a0567,_0x600cd6){if(_0x360cd2[_0x4817('0x48')]['id']){delete _0x360cd2[_0x4817('0x48')]['id'];}return db['SalesforceAccount'][_0x4817('0x4a')]({'where':{'id':_0x360cd2[_0x4817('0x44')]['id']}})[_0x4817('0x26')](handleEntityNotFound(_0x5a0567,null))[_0x4817('0x26')](function(_0x2eb72f){if(_0x2eb72f){_0x360cd2['body'][_0x4817('0x4d')]=_0x2eb72f['id'];_0x360cd2['body']['Subjects']=integrations[_0x4817('0x4e')](_0x360cd2[_0x4817('0x48')][_0x4817('0x4f')],_0x360cd2[_0x4817('0x48')][_0x4817('0x2d')]);_0x360cd2[_0x4817('0x48')]['Descriptions']=integrations[_0x4817('0x50')](_0x360cd2[_0x4817('0x48')]['channel'],_0x360cd2[_0x4817('0x48')][_0x4817('0x2d')]);return db[_0x4817('0x4b')]['create'](_0x360cd2[_0x4817('0x48')],{'include':[{'model':db['SalesforceField'],'as':_0x4817('0x51')},{'model':db['SalesforceField'],'as':_0x4817('0x52')}]});}return null;})[_0x4817('0x26')](respondWithResult(_0x5a0567,null))['catch'](handleError(_0x5a0567,null));};exports[_0x4817('0x53')]=function(_0x501fac,_0x50df21,_0xee4ea5){var _0x1602e2;var _0x48acc7='';var _0x2f2552=_0x4817('0x54');return db[_0x4817('0x2b')][_0x4817('0x4a')]({'where':{'id':_0x501fac[_0x4817('0x44')]['id']},'attributes':['id',_0x4817('0x55'),_0x4817('0x56'),_0x4817('0x57'),_0x4817('0x58'),_0x4817('0x59'),_0x4817('0x5a')]})[_0x4817('0x26')](handleEntityNotFound(_0x50df21,null))[_0x4817('0x26')](function(_0x47e6f7){if(_0x47e6f7){_0x48acc7=_0x47e6f7[_0x4817('0x55')];var _0x1f3b3b=_0x48acc7['slice'](-0x1);if(_0x1f3b3b==='/'){_0x48acc7=_0x48acc7[_0x4817('0x5b')](0x0,_0x48acc7['lastIndexOf'](_0x1f3b3b));}_0x1602e2=new jsforce[(_0x4817('0x5c'))]({'oauth2':{'loginUrl':_0x48acc7,'clientId':_0x47e6f7[_0x4817('0x56')],'clientSecret':_0x47e6f7[_0x4817('0x57')]}});return _0x1602e2[_0x4817('0x5d')](_0x47e6f7[_0x4817('0x58')],_0x47e6f7[_0x4817('0x59')][_0x4817('0x5e')](_0x47e6f7[_0x4817('0x5a')]));}})['then'](function(_0x48b6e0){if(_0x48b6e0){if(!_[_0x4817('0x5f')](_0x501fac['query'][_0x4817('0x60')])){_0x2f2552=_0x501fac[_0x4817('0x31')][_0x4817('0x60')];}return _0x1602e2['sobject'](_0x2f2552)[_0x4817('0x61')]();}})[_0x4817('0x26')](function(_0x161137){var _0x548243=[_0x4817('0x62'),'ActivityDate',_0x4817('0x63'),_0x4817('0x64'),'Subject','Description'];var _0x204241=[_0x4817('0x65'),_0x4817('0x66'),'picklist',_0x4817('0x67'),_0x4817('0x68'),'textarea','phone'];if(_0x161137){_[_0x4817('0x69')](_0x161137[_0x4817('0x35')],function(_0x5300cc){return _0x548243[_0x4817('0x6a')](_0x5300cc[_0x4817('0x29')])||!_0x204241[_0x4817('0x6a')](_0x5300cc[_0x4817('0x2d')]);});return{'count':_0x161137[_0x4817('0x35')][_0x4817('0x36')],'rows':_[_0x4817('0x2f')](_0x161137['fields'],function(_0x5ed28d){return{'id':_0x5ed28d[_0x4817('0x29')],'name':_0x5ed28d['label'],'custom':_0x5ed28d[_0x4817('0x6b')],'options':_0x5ed28d[_0x4817('0x6c')][_0x4817('0x36')]>0x0?_[_0x4817('0x2f')](_0x5ed28d['picklistValues'],function(_0x12acc8){return{'name':_0x12acc8[_0x4817('0x6d')],'value':_0x12acc8[_0x4817('0x6e')]};}):_0x5ed28d[_0x4817('0x2d')]==_0x4817('0x67')?[{'name':'True','value':_0x4817('0x6f')},{'name':_0x4817('0x70'),'value':'false'}]:[]};})};}})[_0x4817('0x26')](respondWithResult(_0x50df21,null))[_0x4817('0x42')](function(_0x475777){var _0x28db97=_0x501fac[_0x4817('0x31')]['test']?0x1f4:_0x475777[_0x4817('0x71')]||0x1f4;logger[_0x4817('0x72')](_0x4817('0x73'),_0x4817('0x53'),_0x28db97,JSON[_0x4817('0x74')](_0x475777));delete _0x475777[_0x4817('0x29')];if(_0x28db97===0x191){_0x28db97=0x190;}_0x50df21['status'](_0x28db97)[_0x4817('0x75')](_0x501fac[_0x4817('0x31')][_0x4817('0x76')]?{'message':_0x4817('0x77'),'statusCode':_0x475777['statusCode']}:_0x475777);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b35452c..180c9b0 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.model.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd858=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes'];(function(_0x4b2d2b,_0xb01756){var _0x97dd02=function(_0x30e624){while(--_0x30e624){_0x4b2d2b['push'](_0x4b2d2b['shift']());}};_0x97dd02(++_0xb01756);}(_0xd858,0x156));var _0x8d85=function(_0x2695fd,_0x1cd49e){_0x2695fd=_0x2695fd-0x0;var _0x3a3b3b=_0xd858[_0x2695fd];return _0x3a3b3b;};'use strict';var _=require(_0x8d85('0x0'));var util=require(_0x8d85('0x1'));var logger=require(_0x8d85('0x2'))(_0x8d85('0x3'));var moment=require(_0x8d85('0x4'));var BPromise=require(_0x8d85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d85('0x6'));var rimraf=require(_0x8d85('0x7'));var config=require('../../config/environment');var attributes=require(_0x8d85('0x8'));var integrations=require(_0x8d85('0x9'));module[_0x8d85('0xa')]=function(_0x492687,_0xb95a7c){return _0x492687[_0x8d85('0xb')](_0x8d85('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86dd=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts'];(function(_0x5a1740,_0x5eed40){var _0x381935=function(_0x21c0e6){while(--_0x21c0e6){_0x5a1740['push'](_0x5a1740['shift']());}};_0x381935(++_0x5eed40);}(_0x86dd,0x1ee));var _0xd86d=function(_0x1727f8,_0x22426a){_0x1727f8=_0x1727f8-0x0;var _0x5cc742=_0x86dd[_0x1727f8];return _0x5cc742;};'use strict';var _=require('lodash');var util=require(_0xd86d('0x0'));var logger=require('../../config/logger')(_0xd86d('0x1'));var moment=require(_0xd86d('0x2'));var BPromise=require(_0xd86d('0x3'));var rp=require(_0xd86d('0x4'));var fs=require('fs');var path=require(_0xd86d('0x5'));var rimraf=require(_0xd86d('0x6'));var config=require(_0xd86d('0x7'));var attributes=require(_0xd86d('0x8'));var integrations=require(_0xd86d('0x9'));module[_0xd86d('0xa')]=function(_0x3b13f9,_0x4274f8){return _0x3b13f9['define'](_0xd86d('0xb'),attributes,{'tableName':_0xd86d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 4f9bf55..a185a84 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb138=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','limit','map','include','model','attributes','ShowSalesforceAccount','find','raw','lodash','util'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xb138,0x1da));var _0x8b13=function(_0x31d1ae,_0x3061dc){_0x31d1ae=_0x31d1ae-0x0;var _0x1f9bda=_0xb138[_0x31d1ae];return _0x1f9bda;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b13('0x5'))['db'];var utils=require(_0x8b13('0x6'));var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require(_0x8b13('0xa'));var client=jayson['client'][_0x8b13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d6dcd,_0x3d3a7e,_0x485c92){return new BPromise(function(_0x55cf7d,_0x48e56b){return client['request'](_0x3d6dcd,_0x485c92)[_0x8b13('0xc')](function(_0x576353){logger[_0x8b13('0xd')](_0x8b13('0xe'),_0x3d3a7e,_0x8b13('0xf'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3d3a7e,_0x8b13('0xf'),JSON['stringify'](_0x576353));if(_0x576353[_0x8b13('0x10')]){if(_0x576353[_0x8b13('0x10')][_0x8b13('0x11')]===0x1f4){logger[_0x8b13('0x10')](_0x8b13('0xe'),_0x3d3a7e,_0x576353[_0x8b13('0x10')][_0x8b13('0x12')]);return _0x48e56b(_0x576353[_0x8b13('0x10')][_0x8b13('0x12')]);}logger[_0x8b13('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x3d3a7e,_0x576353['error'][_0x8b13('0x12')]);return _0x55cf7d(_0x576353[_0x8b13('0x10')][_0x8b13('0x12')]);}else{logger[_0x8b13('0xd')](_0x8b13('0xe'),_0x3d3a7e,_0x8b13('0xf'));_0x55cf7d(_0x576353[_0x8b13('0x13')]['message']);}})[_0x8b13('0x14')](function(_0x7e80c2){logger[_0x8b13('0x10')](_0x8b13('0xe'),_0x3d3a7e,_0x7e80c2);_0x48e56b(_0x7e80c2);});});}exports[_0x8b13('0x15')]=function(_0xca6d65){var _0x21539b=this;return new Promise(function(_0x17757b,_0x5edea6){return db[_0x8b13('0x16')][_0x8b13('0x17')]({'raw':_0xca6d65['options']?_0xca6d65[_0x8b13('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xca6d65[_0x8b13('0x18')]?_0xca6d65[_0x8b13('0x18')][_0x8b13('0x19')]||null:null,'attributes':_0xca6d65[_0x8b13('0x18')]?_0xca6d65['options']['attributes']||null:null,'limit':_0xca6d65[_0x8b13('0x18')]?_0xca6d65[_0x8b13('0x18')][_0x8b13('0x1a')]||null:null,'include':_0xca6d65[_0x8b13('0x18')]?_0xca6d65[_0x8b13('0x18')]['include']?_[_0x8b13('0x1b')](_0xca6d65['options'][_0x8b13('0x1c')],function(_0x2f2ec7){return{'model':db[_0x2f2ec7[_0x8b13('0x1d')]],'as':_0x2f2ec7['as'],'attributes':_0x2f2ec7[_0x8b13('0x1e')],'include':_0x2f2ec7['include']?_[_0x8b13('0x1b')](_0x2f2ec7[_0x8b13('0x1c')],function(_0x3a3c1a){return{'model':db[_0x3a3c1a['model']],'as':_0x3a3c1a['as'],'attributes':_0x3a3c1a['attributes'],'include':_0x3a3c1a[_0x8b13('0x1c')]?_['map'](_0x3a3c1a[_0x8b13('0x1c')],function(_0x16d683){return{'model':db[_0x16d683['model']],'as':_0x16d683['as'],'attributes':_0x16d683['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf6de24){logger[_0x8b13('0xd')](_0x8b13('0x15'),_0xca6d65);logger['debug'](_0x8b13('0x15'),_0xca6d65,JSON['stringify'](_0xf6de24));_0x17757b(_0xf6de24);})['catch'](function(_0x2aa18c){logger['error']('GetSalesforceAccount',_0x2aa18c[_0x8b13('0x12')],_0xca6d65);_0x5edea6(_0x21539b[_0x8b13('0x10')](0x1f4,_0x2aa18c['message']));});});};exports[_0x8b13('0x1f')]=function(_0x20db66){var _0x48cc75=this;return new Promise(function(_0x6c094f,_0x37cba2){return db[_0x8b13('0x16')][_0x8b13('0x20')]({'raw':_0x20db66[_0x8b13('0x18')]?_0x20db66[_0x8b13('0x18')][_0x8b13('0x21')]===undefined?!![]:![]:!![],'where':_0x20db66[_0x8b13('0x18')]?_0x20db66[_0x8b13('0x18')][_0x8b13('0x19')]||null:null,'attributes':_0x20db66[_0x8b13('0x18')]?_0x20db66[_0x8b13('0x18')][_0x8b13('0x1e')]||null:null,'include':_0x20db66[_0x8b13('0x18')]?_0x20db66[_0x8b13('0x18')]['include']?_['map'](_0x20db66['options'][_0x8b13('0x1c')],function(_0x2d0f59){return{'model':db[_0x2d0f59[_0x8b13('0x1d')]],'as':_0x2d0f59['as'],'attributes':_0x2d0f59[_0x8b13('0x1e')],'include':_0x2d0f59[_0x8b13('0x1c')]?_['map'](_0x2d0f59[_0x8b13('0x1c')],function(_0x4e6e0a){return{'model':db[_0x4e6e0a[_0x8b13('0x1d')]],'as':_0x4e6e0a['as'],'attributes':_0x4e6e0a[_0x8b13('0x1e')],'include':_0x4e6e0a[_0x8b13('0x1c')]?_['map'](_0x4e6e0a[_0x8b13('0x1c')],function(_0x5ed955){return{'model':db[_0x5ed955[_0x8b13('0x1d')]],'as':_0x5ed955['as'],'attributes':_0x5ed955[_0x8b13('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8b13('0xc')](function(_0x4a8dfb){logger[_0x8b13('0xd')](_0x8b13('0x1f'),_0x20db66);logger['debug'](_0x8b13('0x1f'),_0x20db66,JSON['stringify'](_0x4a8dfb));_0x6c094f(_0x4a8dfb);})['catch'](function(_0x5c41d4){logger[_0x8b13('0x10')](_0x8b13('0x1f'),_0x5c41d4[_0x8b13('0x12')],_0x20db66);_0x37cba2(_0x48cc75['error'](0x1f4,_0x5c41d4['message']));});});}; \ No newline at end of file +var _0x1d11=['map','model','attributes','then','debug','ShowSalesforceAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include'];(function(_0x217f72,_0x16ad74){var _0x43ffd1=function(_0x2f0a59){while(--_0x2f0a59){_0x217f72['push'](_0x217f72['shift']());}};_0x43ffd1(++_0x16ad74);}(_0x1d11,0xb6));var _0x11d1=function(_0x506774,_0x18525b){_0x506774=_0x506774-0x0;var _0x1aabdf=_0x1d11[_0x506774];return _0x1aabdf;};'use strict';var _=require(_0x11d1('0x0'));var util=require(_0x11d1('0x1'));var moment=require(_0x11d1('0x2'));var BPromise=require(_0x11d1('0x3'));var rs=require(_0x11d1('0x4'));var fs=require('fs');var Redis=require(_0x11d1('0x5'));var db=require(_0x11d1('0x6'))['db'];var utils=require(_0x11d1('0x7'));var logger=require(_0x11d1('0x8'))(_0x11d1('0x9'));var config=require(_0x11d1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x11d1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x92f75a,_0x46c298,_0x5b546b){return new BPromise(function(_0x4a7375,_0x3b5f97){return client[_0x11d1('0xc')](_0x92f75a,_0x5b546b)['then'](function(_0x4dbc69){logger[_0x11d1('0xd')](_0x11d1('0xe'),_0x46c298,_0x11d1('0xf'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x46c298,_0x11d1('0xf'),JSON[_0x11d1('0x10')](_0x4dbc69));if(_0x4dbc69['error']){if(_0x4dbc69['error'][_0x11d1('0x11')]===0x1f4){logger[_0x11d1('0x12')](_0x11d1('0xe'),_0x46c298,_0x4dbc69[_0x11d1('0x12')]['message']);return _0x3b5f97(_0x4dbc69[_0x11d1('0x12')][_0x11d1('0x13')]);}logger[_0x11d1('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x46c298,_0x4dbc69[_0x11d1('0x12')][_0x11d1('0x13')]);return _0x4a7375(_0x4dbc69[_0x11d1('0x12')][_0x11d1('0x13')]);}else{logger[_0x11d1('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x46c298,_0x11d1('0xf'));_0x4a7375(_0x4dbc69['result'][_0x11d1('0x13')]);}})[_0x11d1('0x14')](function(_0x2ce6b6){logger[_0x11d1('0x12')](_0x11d1('0xe'),_0x46c298,_0x2ce6b6);_0x3b5f97(_0x2ce6b6);});});}exports[_0x11d1('0x15')]=function(_0x59442c){var _0x3a93ec=this;return new Promise(function(_0x1cb958,_0x2b72ed){return db[_0x11d1('0x16')][_0x11d1('0x17')]({'raw':_0x59442c[_0x11d1('0x18')]?_0x59442c[_0x11d1('0x18')][_0x11d1('0x19')]===undefined?!![]:![]:!![],'where':_0x59442c[_0x11d1('0x18')]?_0x59442c['options']['where']||null:null,'attributes':_0x59442c[_0x11d1('0x18')]?_0x59442c[_0x11d1('0x18')]['attributes']||null:null,'limit':_0x59442c[_0x11d1('0x18')]?_0x59442c[_0x11d1('0x18')][_0x11d1('0x1a')]||null:null,'include':_0x59442c['options']?_0x59442c['options'][_0x11d1('0x1b')]?_[_0x11d1('0x1c')](_0x59442c['options'][_0x11d1('0x1b')],function(_0x229231){return{'model':db[_0x229231[_0x11d1('0x1d')]],'as':_0x229231['as'],'attributes':_0x229231[_0x11d1('0x1e')],'include':_0x229231[_0x11d1('0x1b')]?_[_0x11d1('0x1c')](_0x229231[_0x11d1('0x1b')],function(_0xbd0b24){return{'model':db[_0xbd0b24[_0x11d1('0x1d')]],'as':_0xbd0b24['as'],'attributes':_0xbd0b24['attributes'],'include':_0xbd0b24[_0x11d1('0x1b')]?_[_0x11d1('0x1c')](_0xbd0b24[_0x11d1('0x1b')],function(_0x39c7be){return{'model':db[_0x39c7be[_0x11d1('0x1d')]],'as':_0x39c7be['as'],'attributes':_0x39c7be['attributes']};}):[]};}):[]};}):[]:[]})[_0x11d1('0x1f')](function(_0x3d32c4){logger['info'](_0x11d1('0x15'),_0x59442c);logger[_0x11d1('0x20')](_0x11d1('0x15'),_0x59442c,JSON[_0x11d1('0x10')](_0x3d32c4));_0x1cb958(_0x3d32c4);})[_0x11d1('0x14')](function(_0x7bb1f5){logger[_0x11d1('0x12')](_0x11d1('0x15'),_0x7bb1f5[_0x11d1('0x13')],_0x59442c);_0x2b72ed(_0x3a93ec[_0x11d1('0x12')](0x1f4,_0x7bb1f5['message']));});});};exports[_0x11d1('0x21')]=function(_0x38bb84){var _0x41a671=this;return new Promise(function(_0x1af540,_0x5d4d11){return db[_0x11d1('0x16')]['find']({'raw':_0x38bb84[_0x11d1('0x18')]?_0x38bb84['options']['raw']===undefined?!![]:![]:!![],'where':_0x38bb84['options']?_0x38bb84['options'][_0x11d1('0x22')]||null:null,'attributes':_0x38bb84[_0x11d1('0x18')]?_0x38bb84[_0x11d1('0x18')]['attributes']||null:null,'include':_0x38bb84[_0x11d1('0x18')]?_0x38bb84['options'][_0x11d1('0x1b')]?_[_0x11d1('0x1c')](_0x38bb84[_0x11d1('0x18')][_0x11d1('0x1b')],function(_0x28c87f){return{'model':db[_0x28c87f[_0x11d1('0x1d')]],'as':_0x28c87f['as'],'attributes':_0x28c87f['attributes'],'include':_0x28c87f[_0x11d1('0x1b')]?_[_0x11d1('0x1c')](_0x28c87f[_0x11d1('0x1b')],function(_0x1152df){return{'model':db[_0x1152df[_0x11d1('0x1d')]],'as':_0x1152df['as'],'attributes':_0x1152df[_0x11d1('0x1e')],'include':_0x1152df[_0x11d1('0x1b')]?_['map'](_0x1152df[_0x11d1('0x1b')],function(_0x555f09){return{'model':db[_0x555f09[_0x11d1('0x1d')]],'as':_0x555f09['as'],'attributes':_0x555f09[_0x11d1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x515a40){logger[_0x11d1('0xd')](_0x11d1('0x21'),_0x38bb84);logger[_0x11d1('0x20')]('ShowSalesforceAccount',_0x38bb84,JSON[_0x11d1('0x10')](_0x515a40));_0x1af540(_0x515a40);})[_0x11d1('0x14')](function(_0x2cc174){logger[_0x11d1('0x12')](_0x11d1('0x21'),_0x2cc174[_0x11d1('0x13')],_0x38bb84);_0x5d4d11(_0x41a671[_0x11d1('0x12')](0x1f4,_0x2cc174[_0x11d1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d749974..3b2460d 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x0b0e[_0x27d8bc];return _0x4b04cb;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x107423,_0x46f375){var _0x10dcc4=function(_0x1e91f9){while(--_0x1e91f9){_0x107423['push'](_0x107423['shift']());}};_0x10dcc4(++_0x46f375);}(_0x2ef3,0xba));var _0x32ef=function(_0x2adf1c,_0x52c3b3){_0x2adf1c=_0x2adf1c-0x0;var _0x21cb70=_0x2ef3[_0x2adf1c];return _0x21cb70;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 5431894..e23212e 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4979=['nothing','contact','sequelize','exports','STRING','ENUM','Case','lead','account_contact_lead','account'];(function(_0x20de85,_0x4911de){var _0x4a7c97=function(_0x28ef93){while(--_0x28ef93){_0x20de85['push'](_0x20de85['shift']());}};_0x4a7c97(++_0x4911de);}(_0x4979,0x142));var _0x9497=function(_0x225a75,_0x43c1de){_0x225a75=_0x225a75-0x0;var _0xee995d=_0x4979[_0x225a75];return _0xee995d;};'use strict';var Sequelize=require(_0x9497('0x0'));module[_0x9497('0x1')]={'name':{'type':Sequelize[_0x9497('0x2')]},'description':{'type':Sequelize[_0x9497('0x2')]},'ticketType':{'type':Sequelize[_0x9497('0x3')]('Task',_0x9497('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x9497('0x3')]('contact_lead','contact',_0x9497('0x5'),_0x9497('0x6'),_0x9497('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9497('0x3')](_0x9497('0x8'),_0x9497('0x9'),_0x9497('0x5'),_0x9497('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x9497('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x9497('0x2')]}}; \ No newline at end of file +var _0x13c9=['STRING','ENUM','Task','Case','contact_lead','contact','account','nothing','lead','exports'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x13c9,0x1c1));var _0x913c=function(_0x22076e,_0x2d1cad){_0x22076e=_0x22076e-0x0;var _0x159efc=_0x13c9[_0x22076e];return _0x159efc;};'use strict';var Sequelize=require('sequelize');module[_0x913c('0x0')]={'name':{'type':Sequelize[_0x913c('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x913c('0x2')](_0x913c('0x3'),_0x913c('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x913c('0x2')](_0x913c('0x5'),_0x913c('0x6'),'lead','account_contact_lead',_0x913c('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x913c('0x2')](_0x913c('0x8'),_0x913c('0x6'),_0x913c('0x9'),_0x913c('0x7')),'defaultValue':_0x913c('0x9')},'leadId':{'type':Sequelize[_0x913c('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x913c('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x913c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 173a3cb..82d6204 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa9c=['getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','pick','filter','merge','map','options','where','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','SalesforceField','order','sort'];(function(_0x45d6fd,_0x1be30d){var _0x53ff40=function(_0x4c1529){while(--_0x4c1529){_0x45d6fd['push'](_0x45d6fd['shift']());}};_0x53ff40(++_0x1be30d);}(_0xaa9c,0x1f4));var _0xcaa9=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xaa9c[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0xcaa9('0x0'));var rimraf=require(_0xcaa9('0x1'));var zipdir=require(_0xcaa9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaa9('0x3'));var moment=require(_0xcaa9('0x4'));var BPromise=require(_0xcaa9('0x5'));var Mustache=require(_0xcaa9('0x6'));var util=require('util');var path=require(_0xcaa9('0x7'));var sox=require('sox');var csv=require(_0xcaa9('0x8'));var ejs=require(_0xcaa9('0x9'));var fs=require('fs');var fs_extra=require(_0xcaa9('0xa'));var _=require(_0xcaa9('0xb'));var squel=require(_0xcaa9('0xc'));var crypto=require(_0xcaa9('0xd'));var jsforce=require(_0xcaa9('0xe'));var deskjs=require(_0xcaa9('0xf'));var toCsv=require(_0xcaa9('0x8'));var querystring=require('querystring');var Papa=require(_0xcaa9('0x10'));var Redis=require(_0xcaa9('0x11'));var authService=require(_0xcaa9('0x12'));var qs=require(_0xcaa9('0x13'));var as=require(_0xcaa9('0x14'));var hardwareService=require(_0xcaa9('0x15'));var logger=require('../../config/logger')(_0xcaa9('0x16'));var utils=require(_0xcaa9('0x17'));var config=require(_0xcaa9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaa9('0x19'))['db'];function respondWithStatusCode(_0x2b9e68,_0x44db56){_0x44db56=_0x44db56||0xcc;return function(_0x55b319){if(_0x55b319){return _0x2b9e68[_0xcaa9('0x1a')](_0x44db56);}return _0x2b9e68['status'](_0x44db56)[_0xcaa9('0x1b')]();};}function respondWithResult(_0x90da8b,_0x1fd6bd){_0x1fd6bd=_0x1fd6bd||0xc8;return function(_0x333bdf){if(_0x333bdf){return _0x90da8b[_0xcaa9('0x1c')](_0x1fd6bd)[_0xcaa9('0x1d')](_0x333bdf);}};}function respondWithFilteredResult(_0x4af208,_0x1d30d6){return function(_0x4e497e){if(_0x4e497e){var _0x52ed35=typeof _0x1d30d6['offset']===_0xcaa9('0x1e')&&typeof _0x1d30d6[_0xcaa9('0x1f')]===_0xcaa9('0x1e');var _0x34854a=_0x4e497e[_0xcaa9('0x20')];var _0x4fa02e=_0x52ed35?0x0:_0x1d30d6[_0xcaa9('0x21')];var _0x3d9849=_0x52ed35?_0x4e497e[_0xcaa9('0x20')]:_0x1d30d6[_0xcaa9('0x21')]+_0x1d30d6[_0xcaa9('0x1f')];var _0xafcb98;if(_0x3d9849>=_0x34854a){_0x3d9849=_0x34854a;_0xafcb98=0xc8;}else{_0xafcb98=0xce;}_0x4af208[_0xcaa9('0x1c')](_0xafcb98);return _0x4af208[_0xcaa9('0x22')]('Content-Range',_0x4fa02e+'-'+_0x3d9849+'/'+_0x34854a)[_0xcaa9('0x1d')](_0x4e497e);}return null;};}function patchUpdates(_0x2db731){return function(_0x8c6732){try{jsonpatch[_0xcaa9('0x23')](_0x8c6732,_0x2db731,!![]);}catch(_0x4b74c8){return BPromise['reject'](_0x4b74c8);}return _0x8c6732[_0xcaa9('0x24')]();};}function saveUpdates(_0x440b2b,_0x13b4d9){return function(_0x59de94){if(_0x59de94){return _0x59de94[_0xcaa9('0x25')](_0x440b2b)[_0xcaa9('0x26')](function(_0x18747f){return _0x18747f;});}return null;};}function removeEntity(_0x445c10,_0x1bc750){return function(_0x51cdac){if(_0x51cdac){return _0x51cdac[_0xcaa9('0x27')]()[_0xcaa9('0x26')](function(){_0x445c10[_0xcaa9('0x1c')](0xcc)[_0xcaa9('0x1b')]();});}};}function handleEntityNotFound(_0xdb79a5,_0x521e22){return function(_0x5bc4f4){if(!_0x5bc4f4){_0xdb79a5[_0xcaa9('0x1a')](0x194);}return _0x5bc4f4;};}function handleError(_0x474be9,_0x5426a5){_0x5426a5=_0x5426a5||0x1f4;return function(_0x53091e){logger[_0xcaa9('0x28')](_0x53091e[_0xcaa9('0x29')]);if(_0x53091e[_0xcaa9('0x2a')]){delete _0x53091e['name'];}_0x474be9[_0xcaa9('0x1c')](_0x5426a5)[_0xcaa9('0x2b')](_0x53091e);};}exports[_0xcaa9('0x2c')]=function(_0x2d4e94,_0x1adedb){var _0x10230e={},_0x2d69c3={},_0x59b256={'count':0x0,'rows':[]};var _0x226c6b=_['map'](db[_0xcaa9('0x2d')][_0xcaa9('0x2e')],function(_0x15b255){return{'name':_0x15b255[_0xcaa9('0x2f')],'type':_0x15b255[_0xcaa9('0x30')][_0xcaa9('0x31')]};});_0x2d69c3[_0xcaa9('0x32')]=_['map'](_0x226c6b,'name');_0x2d69c3['query']=_[_0xcaa9('0x33')](_0x2d4e94['query']);_0x2d69c3[_0xcaa9('0x34')]=_[_0xcaa9('0x35')](_0x2d69c3['model'],_0x2d69c3[_0xcaa9('0x36')]);_0x10230e[_0xcaa9('0x37')]=_[_0xcaa9('0x35')](_0x2d69c3[_0xcaa9('0x32')],qs[_0xcaa9('0x38')](_0x2d4e94[_0xcaa9('0x36')][_0xcaa9('0x38')]));_0x10230e['attributes']=_0x10230e[_0xcaa9('0x37')]['length']?_0x10230e[_0xcaa9('0x37')]:_0x2d69c3[_0xcaa9('0x32')];if(!_0x2d4e94[_0xcaa9('0x36')][_0xcaa9('0x39')](_0xcaa9('0x3a'))){_0x10230e['limit']=qs[_0xcaa9('0x1f')](_0x2d4e94[_0xcaa9('0x36')][_0xcaa9('0x1f')]);_0x10230e[_0xcaa9('0x21')]=qs[_0xcaa9('0x21')](_0x2d4e94[_0xcaa9('0x36')]['offset']);}_0x10230e['order']=qs['sort'](_0x2d4e94[_0xcaa9('0x36')]['sort']);_0x10230e['where']=qs[_0xcaa9('0x34')](_[_0xcaa9('0x3b')](_0x2d4e94[_0xcaa9('0x36')],_0x2d69c3[_0xcaa9('0x34')]),_0x226c6b);if(_0x2d4e94[_0xcaa9('0x36')][_0xcaa9('0x3c')]){_0x10230e['where']=_[_0xcaa9('0x3d')](_0x10230e['where'],{'$or':_[_0xcaa9('0x3e')](_0x226c6b,function(_0x154cee){if(_0x154cee[_0xcaa9('0x30')]!=='VIRTUAL'){var _0x4793d0={};_0x4793d0[_0x154cee[_0xcaa9('0x2a')]]={'$like':'%'+_0x2d4e94[_0xcaa9('0x36')][_0xcaa9('0x3c')]+'%'};return _0x4793d0;}})});}_0x10230e=_[_0xcaa9('0x3d')]({},_0x10230e,_0x2d4e94[_0xcaa9('0x3f')]);var _0x851e36={'where':_0x10230e[_0xcaa9('0x40')]};return db[_0xcaa9('0x2d')][_0xcaa9('0x20')](_0x851e36)[_0xcaa9('0x26')](function(_0x1b8b57){_0x59b256[_0xcaa9('0x20')]=_0x1b8b57;if(_0x2d4e94[_0xcaa9('0x36')][_0xcaa9('0x41')]){_0x10230e[_0xcaa9('0x42')]=[{'all':!![]}];}return db[_0xcaa9('0x2d')][_0xcaa9('0x43')](_0x10230e);})[_0xcaa9('0x26')](function(_0xe8a7b7){_0x59b256[_0xcaa9('0x44')]=_0xe8a7b7;return _0x59b256;})[_0xcaa9('0x26')](respondWithFilteredResult(_0x1adedb,_0x10230e))[_0xcaa9('0x45')](handleError(_0x1adedb,null));};exports[_0xcaa9('0x46')]=function(_0x59bf63,_0x5f1490){var _0x30c522={'raw':![],'where':{'id':_0x59bf63[_0xcaa9('0x47')]['id']}},_0x35ce2d={};_0x35ce2d['model']=_[_0xcaa9('0x33')](db[_0xcaa9('0x2d')][_0xcaa9('0x2e')]);_0x35ce2d['query']=_[_0xcaa9('0x33')](_0x59bf63[_0xcaa9('0x36')]);_0x35ce2d[_0xcaa9('0x34')]=_[_0xcaa9('0x35')](_0x35ce2d[_0xcaa9('0x32')],_0x35ce2d['query']);_0x30c522[_0xcaa9('0x37')]=_[_0xcaa9('0x35')](_0x35ce2d[_0xcaa9('0x32')],qs['fields'](_0x59bf63[_0xcaa9('0x36')][_0xcaa9('0x38')]));_0x30c522['attributes']=_0x30c522[_0xcaa9('0x37')][_0xcaa9('0x48')]?_0x30c522[_0xcaa9('0x37')]:_0x35ce2d['model'];if(_0x59bf63[_0xcaa9('0x36')][_0xcaa9('0x41')]){_0x30c522[_0xcaa9('0x42')]=[{'all':!![]}];}_0x30c522=_[_0xcaa9('0x3d')]({},_0x30c522,_0x59bf63['options']);return db[_0xcaa9('0x2d')][_0xcaa9('0x49')](_0x30c522)[_0xcaa9('0x26')](handleEntityNotFound(_0x5f1490,null))['then'](respondWithResult(_0x5f1490,null))[_0xcaa9('0x45')](handleError(_0x5f1490,null));};exports['create']=function(_0x51ecc5,_0x4c6794){return db[_0xcaa9('0x2d')][_0xcaa9('0x4a')](_0x51ecc5[_0xcaa9('0x4b')],{})['then'](respondWithResult(_0x4c6794,0xc9))[_0xcaa9('0x45')](handleError(_0x4c6794,null));};exports[_0xcaa9('0x25')]=function(_0x45ad2e,_0x49027a){if(_0x45ad2e['body']['id']){delete _0x45ad2e[_0xcaa9('0x4b')]['id'];}return db[_0xcaa9('0x2d')][_0xcaa9('0x49')]({'where':{'id':_0x45ad2e['params']['id']}})[_0xcaa9('0x26')](handleEntityNotFound(_0x49027a,null))[_0xcaa9('0x26')](saveUpdates(_0x45ad2e[_0xcaa9('0x4b')],null))[_0xcaa9('0x26')](respondWithResult(_0x49027a,null))[_0xcaa9('0x45')](handleError(_0x49027a,null));};exports[_0xcaa9('0x27')]=function(_0x4405d1,_0x39a134){return db[_0xcaa9('0x2d')]['find']({'where':{'id':_0x4405d1[_0xcaa9('0x47')]['id']}})[_0xcaa9('0x26')](handleEntityNotFound(_0x39a134,null))[_0xcaa9('0x26')](removeEntity(_0x39a134,null))[_0xcaa9('0x45')](handleError(_0x39a134,null));};exports[_0xcaa9('0x4c')]=function(_0x27b0a0,_0x5cf081,_0x580908){var _0xc69c3b={};var _0x284582={};var _0x535e73;var _0x8ac0aa;return db[_0xcaa9('0x2d')][_0xcaa9('0x4d')]({'where':{'id':_0x27b0a0[_0xcaa9('0x47')]['id']}})[_0xcaa9('0x26')](handleEntityNotFound(_0x5cf081,null))['then'](function(_0xb671fb){if(_0xb671fb){_0x535e73=_0xb671fb;_0x284582['model']=_['keys'](db[_0xcaa9('0x4e')][_0xcaa9('0x2e')]);_0x284582[_0xcaa9('0x36')]=_[_0xcaa9('0x33')](_0x27b0a0[_0xcaa9('0x36')]);_0x284582[_0xcaa9('0x34')]=_[_0xcaa9('0x35')](_0x284582[_0xcaa9('0x32')],_0x284582[_0xcaa9('0x36')]);_0xc69c3b[_0xcaa9('0x37')]=_['intersection'](_0x284582['model'],qs[_0xcaa9('0x38')](_0x27b0a0['query'][_0xcaa9('0x38')]));_0xc69c3b[_0xcaa9('0x37')]=_0xc69c3b['attributes'][_0xcaa9('0x48')]?_0xc69c3b['attributes']:_0x284582[_0xcaa9('0x32')];_0xc69c3b[_0xcaa9('0x4f')]=qs[_0xcaa9('0x50')](_0x27b0a0[_0xcaa9('0x36')][_0xcaa9('0x50')]);_0xc69c3b[_0xcaa9('0x40')]=qs[_0xcaa9('0x34')](_['pick'](_0x27b0a0[_0xcaa9('0x36')],_0x284582[_0xcaa9('0x34')]));if(_0x27b0a0[_0xcaa9('0x36')][_0xcaa9('0x3c')]){_0xc69c3b['where']=_[_0xcaa9('0x3d')](_0xc69c3b['where'],{'$or':_['map'](_0xc69c3b['attributes'],function(_0x341c0d){var _0x497556={};_0x497556[_0x341c0d]={'$like':'%'+_0x27b0a0[_0xcaa9('0x36')][_0xcaa9('0x3c')]+'%'};return _0x497556;})});}_0xc69c3b=_[_0xcaa9('0x3d')]({},_0xc69c3b,_0x27b0a0[_0xcaa9('0x3f')]);return _0x535e73['getFields'](_0xc69c3b);}})[_0xcaa9('0x26')](function(_0x298fa4){if(_0x298fa4){_0x8ac0aa=_0x298fa4[_0xcaa9('0x48')];if(!_0x27b0a0[_0xcaa9('0x36')][_0xcaa9('0x39')](_0xcaa9('0x3a'))){_0xc69c3b['limit']=qs[_0xcaa9('0x1f')](_0x27b0a0['query'][_0xcaa9('0x1f')]);_0xc69c3b[_0xcaa9('0x21')]=qs[_0xcaa9('0x21')](_0x27b0a0[_0xcaa9('0x36')][_0xcaa9('0x21')]);}return _0x535e73[_0xcaa9('0x4c')](_0xc69c3b);}})[_0xcaa9('0x26')](function(_0x3ed6d2){if(_0x3ed6d2){return _0x3ed6d2?{'count':_0x8ac0aa,'rows':_0x3ed6d2}:null;}})[_0xcaa9('0x26')](respondWithResult(_0x5cf081,null))['catch'](handleError(_0x5cf081,null));};exports[_0xcaa9('0x51')]=function(_0x5c106a,_0x3edaf0,_0xed9082){var _0x33b5eb={};var _0x4b01ea={};var _0x2e0397;var _0x52be27;return db[_0xcaa9('0x2d')][_0xcaa9('0x4d')]({'where':{'id':_0x5c106a[_0xcaa9('0x47')]['id']}})[_0xcaa9('0x26')](handleEntityNotFound(_0x3edaf0,null))[_0xcaa9('0x26')](function(_0x5a5053){if(_0x5a5053){_0x2e0397=_0x5a5053;_0x4b01ea[_0xcaa9('0x32')]=_[_0xcaa9('0x33')](db[_0xcaa9('0x4e')][_0xcaa9('0x2e')]);_0x4b01ea[_0xcaa9('0x36')]=_[_0xcaa9('0x33')](_0x5c106a[_0xcaa9('0x36')]);_0x4b01ea[_0xcaa9('0x34')]=_[_0xcaa9('0x35')](_0x4b01ea[_0xcaa9('0x32')],_0x4b01ea[_0xcaa9('0x36')]);_0x33b5eb[_0xcaa9('0x37')]=_[_0xcaa9('0x35')](_0x4b01ea[_0xcaa9('0x32')],qs[_0xcaa9('0x38')](_0x5c106a[_0xcaa9('0x36')][_0xcaa9('0x38')]));_0x33b5eb['attributes']=_0x33b5eb[_0xcaa9('0x37')]['length']?_0x33b5eb[_0xcaa9('0x37')]:_0x4b01ea[_0xcaa9('0x32')];_0x33b5eb['order']=qs[_0xcaa9('0x50')](_0x5c106a[_0xcaa9('0x36')]['sort']);_0x33b5eb['where']=qs['filters'](_[_0xcaa9('0x3b')](_0x5c106a['query'],_0x4b01ea[_0xcaa9('0x34')]));if(_0x5c106a[_0xcaa9('0x36')][_0xcaa9('0x3c')]){_0x33b5eb[_0xcaa9('0x40')]=_[_0xcaa9('0x3d')](_0x33b5eb['where'],{'$or':_[_0xcaa9('0x3e')](_0x33b5eb['attributes'],function(_0x434339){var _0x1c0dce={};_0x1c0dce[_0x434339]={'$like':'%'+_0x5c106a[_0xcaa9('0x36')][_0xcaa9('0x3c')]+'%'};return _0x1c0dce;})});}_0x33b5eb=_[_0xcaa9('0x3d')]({},_0x33b5eb,_0x5c106a[_0xcaa9('0x3f')]);return _0x2e0397[_0xcaa9('0x51')](_0x33b5eb);}})[_0xcaa9('0x26')](function(_0x2547aa){if(_0x2547aa){_0x52be27=_0x2547aa['length'];if(!_0x5c106a[_0xcaa9('0x36')]['hasOwnProperty'](_0xcaa9('0x3a'))){_0x33b5eb[_0xcaa9('0x1f')]=qs[_0xcaa9('0x1f')](_0x5c106a[_0xcaa9('0x36')][_0xcaa9('0x1f')]);_0x33b5eb[_0xcaa9('0x21')]=qs[_0xcaa9('0x21')](_0x5c106a[_0xcaa9('0x36')]['offset']);}return _0x2e0397[_0xcaa9('0x51')](_0x33b5eb);}})[_0xcaa9('0x26')](function(_0x4edebc){if(_0x4edebc){return _0x4edebc?{'count':_0x52be27,'rows':_0x4edebc}:null;}})[_0xcaa9('0x26')](respondWithResult(_0x3edaf0,null))[_0xcaa9('0x45')](handleError(_0x3edaf0,null));};exports['getDescriptions']=function(_0x18e0a8,_0x4ac342,_0x1c5b10){var _0x3add53={};var _0xd499d7={};var _0x22a6e3;var _0x16e2a5;return db['SalesforceConfiguration'][_0xcaa9('0x4d')]({'where':{'id':_0x18e0a8[_0xcaa9('0x47')]['id']}})[_0xcaa9('0x26')](handleEntityNotFound(_0x4ac342,null))['then'](function(_0x55932b){if(_0x55932b){_0x22a6e3=_0x55932b;_0xd499d7[_0xcaa9('0x32')]=_['keys'](db[_0xcaa9('0x4e')]['rawAttributes']);_0xd499d7[_0xcaa9('0x36')]=_['keys'](_0x18e0a8[_0xcaa9('0x36')]);_0xd499d7[_0xcaa9('0x34')]=_['intersection'](_0xd499d7['model'],_0xd499d7[_0xcaa9('0x36')]);_0x3add53[_0xcaa9('0x37')]=_[_0xcaa9('0x35')](_0xd499d7[_0xcaa9('0x32')],qs[_0xcaa9('0x38')](_0x18e0a8[_0xcaa9('0x36')][_0xcaa9('0x38')]));_0x3add53[_0xcaa9('0x37')]=_0x3add53[_0xcaa9('0x37')][_0xcaa9('0x48')]?_0x3add53[_0xcaa9('0x37')]:_0xd499d7[_0xcaa9('0x32')];_0x3add53[_0xcaa9('0x4f')]=qs[_0xcaa9('0x50')](_0x18e0a8[_0xcaa9('0x36')][_0xcaa9('0x50')]);_0x3add53[_0xcaa9('0x40')]=qs[_0xcaa9('0x34')](_['pick'](_0x18e0a8[_0xcaa9('0x36')],_0xd499d7[_0xcaa9('0x34')]));if(_0x18e0a8['query'][_0xcaa9('0x3c')]){_0x3add53[_0xcaa9('0x40')]=_[_0xcaa9('0x3d')](_0x3add53['where'],{'$or':_['map'](_0x3add53[_0xcaa9('0x37')],function(_0x515152){var _0x3c3d84={};_0x3c3d84[_0x515152]={'$like':'%'+_0x18e0a8['query'][_0xcaa9('0x3c')]+'%'};return _0x3c3d84;})});}_0x3add53=_[_0xcaa9('0x3d')]({},_0x3add53,_0x18e0a8[_0xcaa9('0x3f')]);return _0x22a6e3[_0xcaa9('0x52')](_0x3add53);}})[_0xcaa9('0x26')](function(_0x26b845){if(_0x26b845){_0x16e2a5=_0x26b845['length'];if(!_0x18e0a8['query'][_0xcaa9('0x39')](_0xcaa9('0x3a'))){_0x3add53[_0xcaa9('0x1f')]=qs[_0xcaa9('0x1f')](_0x18e0a8[_0xcaa9('0x36')][_0xcaa9('0x1f')]);_0x3add53['offset']=qs[_0xcaa9('0x21')](_0x18e0a8['query'][_0xcaa9('0x21')]);}return _0x22a6e3[_0xcaa9('0x52')](_0x3add53);}})[_0xcaa9('0x26')](function(_0xd3b939){if(_0xd3b939){return _0xd3b939?{'count':_0x16e2a5,'rows':_0xd3b939}:null;}})['then'](respondWithResult(_0x4ac342,null))['catch'](handleError(_0x4ac342,null));}; \ No newline at end of file +var _0x1996=['sort','where','pick','filter','VIRTUAL','options','SalesforceConfiguration','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','merge','nolimit','getSubjects','SalesforceField','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1996,0x1e5));var _0x6199=function(_0x45adc4,_0x15558c){_0x45adc4=_0x45adc4-0x0;var _0x128f51=_0x1996[_0x45adc4];return _0x128f51;};'use strict';var emlformat=require(_0x6199('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6199('0x1'));var jsonpatch=require(_0x6199('0x2'));var rp=require(_0x6199('0x3'));var moment=require(_0x6199('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6199('0x5'));var path=require('path');var sox=require(_0x6199('0x6'));var csv=require(_0x6199('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6199('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6199('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x6199('0x7'));var querystring=require('querystring');var Papa=require(_0x6199('0xa'));var Redis=require('ioredis');var authService=require(_0x6199('0xb'));var qs=require(_0x6199('0xc'));var as=require(_0x6199('0xd'));var hardwareService=require(_0x6199('0xe'));var logger=require(_0x6199('0xf'))(_0x6199('0x10'));var utils=require(_0x6199('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6199('0x12'));var db=require(_0x6199('0x13'))['db'];function respondWithStatusCode(_0x3b4b85,_0x77f79a){_0x77f79a=_0x77f79a||0xcc;return function(_0x1df68c){if(_0x1df68c){return _0x3b4b85[_0x6199('0x14')](_0x77f79a);}return _0x3b4b85[_0x6199('0x15')](_0x77f79a)[_0x6199('0x16')]();};}function respondWithResult(_0x1784ad,_0xb5e520){_0xb5e520=_0xb5e520||0xc8;return function(_0x40c034){if(_0x40c034){return _0x1784ad['status'](_0xb5e520)[_0x6199('0x17')](_0x40c034);}};}function respondWithFilteredResult(_0x3d72d5,_0xe82557){return function(_0x3d7dd9){if(_0x3d7dd9){var _0x4e64fa=typeof _0xe82557[_0x6199('0x18')]===_0x6199('0x19')&&typeof _0xe82557['limit']===_0x6199('0x19');var _0x725a85=_0x3d7dd9[_0x6199('0x1a')];var _0x38dc47=_0x4e64fa?0x0:_0xe82557[_0x6199('0x18')];var _0x52ae50=_0x4e64fa?_0x3d7dd9[_0x6199('0x1a')]:_0xe82557[_0x6199('0x18')]+_0xe82557[_0x6199('0x1b')];var _0x1516c8;if(_0x52ae50>=_0x725a85){_0x52ae50=_0x725a85;_0x1516c8=0xc8;}else{_0x1516c8=0xce;}_0x3d72d5['status'](_0x1516c8);return _0x3d72d5[_0x6199('0x1c')](_0x6199('0x1d'),_0x38dc47+'-'+_0x52ae50+'/'+_0x725a85)[_0x6199('0x17')](_0x3d7dd9);}return null;};}function patchUpdates(_0x374374){return function(_0x53bfe6){try{jsonpatch[_0x6199('0x1e')](_0x53bfe6,_0x374374,!![]);}catch(_0x56f885){return BPromise[_0x6199('0x1f')](_0x56f885);}return _0x53bfe6['save']();};}function saveUpdates(_0x2fd56e,_0x1c9784){return function(_0x5ecd9b){if(_0x5ecd9b){return _0x5ecd9b[_0x6199('0x20')](_0x2fd56e)[_0x6199('0x21')](function(_0x1b4b93){return _0x1b4b93;});}return null;};}function removeEntity(_0x5fd49c,_0x4afb35){return function(_0x5d0581){if(_0x5d0581){return _0x5d0581[_0x6199('0x22')]()['then'](function(){_0x5fd49c[_0x6199('0x15')](0xcc)[_0x6199('0x16')]();});}};}function handleEntityNotFound(_0x5308b0,_0x228dba){return function(_0x26fa4c){if(!_0x26fa4c){_0x5308b0['sendStatus'](0x194);}return _0x26fa4c;};}function handleError(_0x1ba647,_0x2d1238){_0x2d1238=_0x2d1238||0x1f4;return function(_0xe41b16){logger[_0x6199('0x23')](_0xe41b16[_0x6199('0x24')]);if(_0xe41b16[_0x6199('0x25')]){delete _0xe41b16[_0x6199('0x25')];}_0x1ba647[_0x6199('0x15')](_0x2d1238)[_0x6199('0x26')](_0xe41b16);};}exports[_0x6199('0x27')]=function(_0x55e98e,_0x2cdc68){var _0x65edba={},_0x37ecab={},_0x3a3618={'count':0x0,'rows':[]};var _0x22723a=_['map'](db['SalesforceConfiguration'][_0x6199('0x28')],function(_0x1e2cf2){return{'name':_0x1e2cf2[_0x6199('0x29')],'type':_0x1e2cf2[_0x6199('0x2a')][_0x6199('0x2b')]};});_0x37ecab[_0x6199('0x2c')]=_[_0x6199('0x2d')](_0x22723a,_0x6199('0x25'));_0x37ecab['query']=_['keys'](_0x55e98e[_0x6199('0x2e')]);_0x37ecab[_0x6199('0x2f')]=_[_0x6199('0x30')](_0x37ecab[_0x6199('0x2c')],_0x37ecab[_0x6199('0x2e')]);_0x65edba['attributes']=_['intersection'](_0x37ecab[_0x6199('0x2c')],qs[_0x6199('0x31')](_0x55e98e['query'][_0x6199('0x31')]));_0x65edba[_0x6199('0x32')]=_0x65edba[_0x6199('0x32')][_0x6199('0x33')]?_0x65edba[_0x6199('0x32')]:_0x37ecab['model'];if(!_0x55e98e[_0x6199('0x2e')][_0x6199('0x34')]('nolimit')){_0x65edba['limit']=qs[_0x6199('0x1b')](_0x55e98e[_0x6199('0x2e')]['limit']);_0x65edba[_0x6199('0x18')]=qs[_0x6199('0x18')](_0x55e98e['query'][_0x6199('0x18')]);}_0x65edba[_0x6199('0x35')]=qs['sort'](_0x55e98e[_0x6199('0x2e')][_0x6199('0x36')]);_0x65edba[_0x6199('0x37')]=qs[_0x6199('0x2f')](_[_0x6199('0x38')](_0x55e98e[_0x6199('0x2e')],_0x37ecab[_0x6199('0x2f')]),_0x22723a);if(_0x55e98e['query'][_0x6199('0x39')]){_0x65edba[_0x6199('0x37')]=_['merge'](_0x65edba[_0x6199('0x37')],{'$or':_[_0x6199('0x2d')](_0x22723a,function(_0x2cff4d){if(_0x2cff4d[_0x6199('0x2a')]!==_0x6199('0x3a')){var _0x2f76f1={};_0x2f76f1[_0x2cff4d['name']]={'$like':'%'+_0x55e98e[_0x6199('0x2e')][_0x6199('0x39')]+'%'};return _0x2f76f1;}})});}_0x65edba=_['merge']({},_0x65edba,_0x55e98e[_0x6199('0x3b')]);var _0x22882d={'where':_0x65edba['where']};return db[_0x6199('0x3c')][_0x6199('0x1a')](_0x22882d)[_0x6199('0x21')](function(_0x3d67bf){_0x3a3618[_0x6199('0x1a')]=_0x3d67bf;if(_0x55e98e['query'][_0x6199('0x3d')]){_0x65edba[_0x6199('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x6199('0x3f')](_0x65edba);})[_0x6199('0x21')](function(_0x4be243){_0x3a3618['rows']=_0x4be243;return _0x3a3618;})[_0x6199('0x21')](respondWithFilteredResult(_0x2cdc68,_0x65edba))[_0x6199('0x40')](handleError(_0x2cdc68,null));};exports[_0x6199('0x41')]=function(_0x1ae5c7,_0x3b6fae){var _0x153023={'raw':![],'where':{'id':_0x1ae5c7[_0x6199('0x42')]['id']}},_0x394b68={};_0x394b68[_0x6199('0x2c')]=_[_0x6199('0x43')](db[_0x6199('0x3c')][_0x6199('0x28')]);_0x394b68['query']=_[_0x6199('0x43')](_0x1ae5c7['query']);_0x394b68['filters']=_['intersection'](_0x394b68[_0x6199('0x2c')],_0x394b68[_0x6199('0x2e')]);_0x153023['attributes']=_[_0x6199('0x30')](_0x394b68[_0x6199('0x2c')],qs[_0x6199('0x31')](_0x1ae5c7[_0x6199('0x2e')]['fields']));_0x153023[_0x6199('0x32')]=_0x153023[_0x6199('0x32')][_0x6199('0x33')]?_0x153023[_0x6199('0x32')]:_0x394b68['model'];if(_0x1ae5c7['query'][_0x6199('0x3d')]){_0x153023['include']=[{'all':!![]}];}_0x153023=_['merge']({},_0x153023,_0x1ae5c7[_0x6199('0x3b')]);return db[_0x6199('0x3c')][_0x6199('0x44')](_0x153023)['then'](handleEntityNotFound(_0x3b6fae,null))[_0x6199('0x21')](respondWithResult(_0x3b6fae,null))[_0x6199('0x40')](handleError(_0x3b6fae,null));};exports[_0x6199('0x45')]=function(_0xd26f1a,_0x135e7b){return db[_0x6199('0x3c')][_0x6199('0x45')](_0xd26f1a['body'],{})[_0x6199('0x21')](respondWithResult(_0x135e7b,0xc9))[_0x6199('0x40')](handleError(_0x135e7b,null));};exports[_0x6199('0x20')]=function(_0x31ea40,_0xf55c2c){if(_0x31ea40[_0x6199('0x46')]['id']){delete _0x31ea40[_0x6199('0x46')]['id'];}return db[_0x6199('0x3c')][_0x6199('0x44')]({'where':{'id':_0x31ea40[_0x6199('0x42')]['id']}})[_0x6199('0x21')](handleEntityNotFound(_0xf55c2c,null))['then'](saveUpdates(_0x31ea40[_0x6199('0x46')],null))['then'](respondWithResult(_0xf55c2c,null))[_0x6199('0x40')](handleError(_0xf55c2c,null));};exports[_0x6199('0x22')]=function(_0x4f077a,_0x5b9a90){return db[_0x6199('0x3c')][_0x6199('0x44')]({'where':{'id':_0x4f077a[_0x6199('0x42')]['id']}})[_0x6199('0x21')](handleEntityNotFound(_0x5b9a90,null))[_0x6199('0x21')](removeEntity(_0x5b9a90,null))[_0x6199('0x40')](handleError(_0x5b9a90,null));};exports[_0x6199('0x47')]=function(_0x2d39e2,_0x228a5c,_0x3b29e2){var _0x1239ae={};var _0x50c447={};var _0x27425f;var _0x20b285;return db[_0x6199('0x3c')][_0x6199('0x48')]({'where':{'id':_0x2d39e2['params']['id']}})[_0x6199('0x21')](handleEntityNotFound(_0x228a5c,null))[_0x6199('0x21')](function(_0x14e247){if(_0x14e247){_0x27425f=_0x14e247;_0x50c447[_0x6199('0x2c')]=_[_0x6199('0x43')](db['SalesforceField']['rawAttributes']);_0x50c447['query']=_[_0x6199('0x43')](_0x2d39e2[_0x6199('0x2e')]);_0x50c447[_0x6199('0x2f')]=_[_0x6199('0x30')](_0x50c447[_0x6199('0x2c')],_0x50c447[_0x6199('0x2e')]);_0x1239ae[_0x6199('0x32')]=_[_0x6199('0x30')](_0x50c447[_0x6199('0x2c')],qs['fields'](_0x2d39e2[_0x6199('0x2e')][_0x6199('0x31')]));_0x1239ae['attributes']=_0x1239ae[_0x6199('0x32')][_0x6199('0x33')]?_0x1239ae[_0x6199('0x32')]:_0x50c447[_0x6199('0x2c')];_0x1239ae[_0x6199('0x35')]=qs[_0x6199('0x36')](_0x2d39e2[_0x6199('0x2e')][_0x6199('0x36')]);_0x1239ae[_0x6199('0x37')]=qs[_0x6199('0x2f')](_[_0x6199('0x38')](_0x2d39e2[_0x6199('0x2e')],_0x50c447['filters']));if(_0x2d39e2[_0x6199('0x2e')][_0x6199('0x39')]){_0x1239ae[_0x6199('0x37')]=_[_0x6199('0x49')](_0x1239ae[_0x6199('0x37')],{'$or':_[_0x6199('0x2d')](_0x1239ae['attributes'],function(_0x17091c){var _0x4c6ba8={};_0x4c6ba8[_0x17091c]={'$like':'%'+_0x2d39e2['query'][_0x6199('0x39')]+'%'};return _0x4c6ba8;})});}_0x1239ae=_[_0x6199('0x49')]({},_0x1239ae,_0x2d39e2[_0x6199('0x3b')]);return _0x27425f['getFields'](_0x1239ae);}})[_0x6199('0x21')](function(_0x26f2c6){if(_0x26f2c6){_0x20b285=_0x26f2c6[_0x6199('0x33')];if(!_0x2d39e2[_0x6199('0x2e')][_0x6199('0x34')](_0x6199('0x4a'))){_0x1239ae[_0x6199('0x1b')]=qs[_0x6199('0x1b')](_0x2d39e2[_0x6199('0x2e')][_0x6199('0x1b')]);_0x1239ae[_0x6199('0x18')]=qs[_0x6199('0x18')](_0x2d39e2['query']['offset']);}return _0x27425f[_0x6199('0x47')](_0x1239ae);}})['then'](function(_0x501d92){if(_0x501d92){return _0x501d92?{'count':_0x20b285,'rows':_0x501d92}:null;}})[_0x6199('0x21')](respondWithResult(_0x228a5c,null))[_0x6199('0x40')](handleError(_0x228a5c,null));};exports[_0x6199('0x4b')]=function(_0x2a6938,_0x2dd814,_0x36975f){var _0x4033b1={};var _0xf23b6d={};var _0x1d6077;var _0x55ae09;return db[_0x6199('0x3c')][_0x6199('0x48')]({'where':{'id':_0x2a6938[_0x6199('0x42')]['id']}})[_0x6199('0x21')](handleEntityNotFound(_0x2dd814,null))['then'](function(_0xf63511){if(_0xf63511){_0x1d6077=_0xf63511;_0xf23b6d[_0x6199('0x2c')]=_[_0x6199('0x43')](db[_0x6199('0x4c')][_0x6199('0x28')]);_0xf23b6d[_0x6199('0x2e')]=_[_0x6199('0x43')](_0x2a6938[_0x6199('0x2e')]);_0xf23b6d[_0x6199('0x2f')]=_[_0x6199('0x30')](_0xf23b6d[_0x6199('0x2c')],_0xf23b6d[_0x6199('0x2e')]);_0x4033b1[_0x6199('0x32')]=_['intersection'](_0xf23b6d[_0x6199('0x2c')],qs[_0x6199('0x31')](_0x2a6938[_0x6199('0x2e')][_0x6199('0x31')]));_0x4033b1['attributes']=_0x4033b1[_0x6199('0x32')][_0x6199('0x33')]?_0x4033b1[_0x6199('0x32')]:_0xf23b6d['model'];_0x4033b1[_0x6199('0x35')]=qs[_0x6199('0x36')](_0x2a6938[_0x6199('0x2e')][_0x6199('0x36')]);_0x4033b1[_0x6199('0x37')]=qs[_0x6199('0x2f')](_['pick'](_0x2a6938['query'],_0xf23b6d[_0x6199('0x2f')]));if(_0x2a6938[_0x6199('0x2e')][_0x6199('0x39')]){_0x4033b1['where']=_[_0x6199('0x49')](_0x4033b1[_0x6199('0x37')],{'$or':_[_0x6199('0x2d')](_0x4033b1['attributes'],function(_0x3c0fe1){var _0x47277a={};_0x47277a[_0x3c0fe1]={'$like':'%'+_0x2a6938[_0x6199('0x2e')][_0x6199('0x39')]+'%'};return _0x47277a;})});}_0x4033b1=_['merge']({},_0x4033b1,_0x2a6938[_0x6199('0x3b')]);return _0x1d6077[_0x6199('0x4b')](_0x4033b1);}})[_0x6199('0x21')](function(_0x2c4928){if(_0x2c4928){_0x55ae09=_0x2c4928[_0x6199('0x33')];if(!_0x2a6938['query']['hasOwnProperty'](_0x6199('0x4a'))){_0x4033b1[_0x6199('0x1b')]=qs[_0x6199('0x1b')](_0x2a6938[_0x6199('0x2e')]['limit']);_0x4033b1[_0x6199('0x18')]=qs[_0x6199('0x18')](_0x2a6938[_0x6199('0x2e')][_0x6199('0x18')]);}return _0x1d6077[_0x6199('0x4b')](_0x4033b1);}})[_0x6199('0x21')](function(_0x28032f){if(_0x28032f){return _0x28032f?{'count':_0x55ae09,'rows':_0x28032f}:null;}})['then'](respondWithResult(_0x2dd814,null))['catch'](handleError(_0x2dd814,null));};exports['getDescriptions']=function(_0x51ae41,_0x5ebcc1,_0x222391){var _0x4090b9={};var _0x556726={};var _0x2e5d8e;var _0x44783a;return db['SalesforceConfiguration'][_0x6199('0x48')]({'where':{'id':_0x51ae41[_0x6199('0x42')]['id']}})[_0x6199('0x21')](handleEntityNotFound(_0x5ebcc1,null))[_0x6199('0x21')](function(_0x2bee7c){if(_0x2bee7c){_0x2e5d8e=_0x2bee7c;_0x556726[_0x6199('0x2c')]=_[_0x6199('0x43')](db[_0x6199('0x4c')][_0x6199('0x28')]);_0x556726['query']=_[_0x6199('0x43')](_0x51ae41['query']);_0x556726[_0x6199('0x2f')]=_[_0x6199('0x30')](_0x556726[_0x6199('0x2c')],_0x556726[_0x6199('0x2e')]);_0x4090b9['attributes']=_['intersection'](_0x556726['model'],qs[_0x6199('0x31')](_0x51ae41[_0x6199('0x2e')][_0x6199('0x31')]));_0x4090b9[_0x6199('0x32')]=_0x4090b9[_0x6199('0x32')]['length']?_0x4090b9['attributes']:_0x556726['model'];_0x4090b9[_0x6199('0x35')]=qs[_0x6199('0x36')](_0x51ae41[_0x6199('0x2e')][_0x6199('0x36')]);_0x4090b9[_0x6199('0x37')]=qs[_0x6199('0x2f')](_[_0x6199('0x38')](_0x51ae41[_0x6199('0x2e')],_0x556726[_0x6199('0x2f')]));if(_0x51ae41[_0x6199('0x2e')]['filter']){_0x4090b9['where']=_[_0x6199('0x49')](_0x4090b9[_0x6199('0x37')],{'$or':_['map'](_0x4090b9[_0x6199('0x32')],function(_0x53fd64){var _0x539c39={};_0x539c39[_0x53fd64]={'$like':'%'+_0x51ae41['query'][_0x6199('0x39')]+'%'};return _0x539c39;})});}_0x4090b9=_[_0x6199('0x49')]({},_0x4090b9,_0x51ae41['options']);return _0x2e5d8e['getDescriptions'](_0x4090b9);}})['then'](function(_0x3bcae1){if(_0x3bcae1){_0x44783a=_0x3bcae1[_0x6199('0x33')];if(!_0x51ae41[_0x6199('0x2e')]['hasOwnProperty'](_0x6199('0x4a'))){_0x4090b9[_0x6199('0x1b')]=qs[_0x6199('0x1b')](_0x51ae41[_0x6199('0x2e')][_0x6199('0x1b')]);_0x4090b9[_0x6199('0x18')]=qs[_0x6199('0x18')](_0x51ae41[_0x6199('0x2e')][_0x6199('0x18')]);}return _0x2e5d8e['getDescriptions'](_0x4090b9);}})[_0x6199('0x21')](function(_0x1cb595){if(_0x1cb595){return _0x1cb595?{'count':_0x44783a,'rows':_0x1cb595}:null;}})[_0x6199('0x21')](respondWithResult(_0x5ebcc1,null))[_0x6199('0x40')](handleError(_0x5ebcc1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ddff9c2..4e0035a 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10d1=['api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x4b53b4,_0x3b682a){var _0x34947a=function(_0x5d5649){while(--_0x5d5649){_0x4b53b4['push'](_0x4b53b4['shift']());}};_0x34947a(++_0x3b682a);}(_0x10d1,0x1c4));var _0x110d=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x10d1[_0x3337b6];return _0x568270;};'use strict';var _=require(_0x110d('0x0'));var util=require(_0x110d('0x1'));var logger=require(_0x110d('0x2'))(_0x110d('0x3'));var moment=require(_0x110d('0x4'));var BPromise=require(_0x110d('0x5'));var rp=require(_0x110d('0x6'));var fs=require('fs');var path=require(_0x110d('0x7'));var rimraf=require(_0x110d('0x8'));var config=require('../../config/environment');var attributes=require(_0x110d('0x9'));module[_0x110d('0xa')]=function(_0x2ed7be,_0x141211){return _0x2ed7be[_0x110d('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0x110d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafa6=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3c598e,_0x1875b3){var _0x2643dd=function(_0x263b1f){while(--_0x263b1f){_0x3c598e['push'](_0x3c598e['shift']());}};_0x2643dd(++_0x1875b3);}(_0xafa6,0x9a));var _0x6afa=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xafa6[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x6afa('0x0'));var util=require(_0x6afa('0x1'));var logger=require(_0x6afa('0x2'))(_0x6afa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6afa('0x4'));var fs=require('fs');var path=require(_0x6afa('0x5'));var rimraf=require(_0x6afa('0x6'));var config=require(_0x6afa('0x7'));var attributes=require(_0x6afa('0x8'));module['exports']=function(_0xd835e9,_0xa422cc){return _0xd835e9[_0x6afa('0x9')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index ff28d4f..c13a778 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x211b=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x211b,0x8d));var _0xb211=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x211b[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xb211('0x0'));var util=require(_0xb211('0x1'));var moment=require(_0xb211('0x2'));var BPromise=require('bluebird');var rs=require(_0xb211('0x3'));var fs=require('fs');var Redis=require(_0xb211('0x4'));var db=require(_0xb211('0x5'))['db'];var utils=require(_0xb211('0x6'));var logger=require(_0xb211('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb211('0x8')][_0xb211('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25bd45,_0x2f53d9,_0x262aff){return new BPromise(function(_0x55d692,_0x5644e4){return client[_0xb211('0xa')](_0x25bd45,_0x262aff)['then'](function(_0x122cce){logger['info'](_0xb211('0xb'),_0x2f53d9,_0xb211('0xc'));logger['debug'](_0xb211('0xd'),_0x2f53d9,_0xb211('0xc'),JSON[_0xb211('0xe')](_0x122cce));if(_0x122cce[_0xb211('0xf')]){if(_0x122cce[_0xb211('0xf')]['code']===0x1f4){logger[_0xb211('0xf')](_0xb211('0xb'),_0x2f53d9,_0x122cce[_0xb211('0xf')][_0xb211('0x10')]);return _0x5644e4(_0x122cce[_0xb211('0xf')][_0xb211('0x10')]);}logger['error'](_0xb211('0xb'),_0x2f53d9,_0x122cce['error']['message']);return _0x55d692(_0x122cce[_0xb211('0xf')]['message']);}else{logger[_0xb211('0x11')](_0xb211('0xb'),_0x2f53d9,_0xb211('0xc'));_0x55d692(_0x122cce['result']['message']);}})[_0xb211('0x12')](function(_0x2ab837){logger[_0xb211('0xf')](_0xb211('0xb'),_0x2f53d9,_0x2ab837);_0x5644e4(_0x2ab837);});});} \ No newline at end of file +var _0x86c2=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x1ecf98,_0x1456a3){var _0x146985=function(_0x2d89c6){while(--_0x2d89c6){_0x1ecf98['push'](_0x1ecf98['shift']());}};_0x146985(++_0x1456a3);}(_0x86c2,0x1e2));var _0x286c=function(_0x563b70,_0x3d7039){_0x563b70=_0x563b70-0x0;var _0x1cde2a=_0x86c2[_0x563b70];return _0x1cde2a;};'use strict';var _=require(_0x286c('0x0'));var util=require(_0x286c('0x1'));var moment=require('moment');var BPromise=require(_0x286c('0x2'));var rs=require(_0x286c('0x3'));var fs=require('fs');var Redis=require(_0x286c('0x4'));var db=require(_0x286c('0x5'))['db'];var utils=require(_0x286c('0x6'));var logger=require(_0x286c('0x7'))(_0x286c('0x8'));var config=require(_0x286c('0x9'));var jayson=require(_0x286c('0xa'));var client=jayson['client'][_0x286c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x349479,_0x1f9d39,_0x437b45){return new BPromise(function(_0x21b62a,_0x350894){return client[_0x286c('0xc')](_0x349479,_0x437b45)[_0x286c('0xd')](function(_0x515b45){logger[_0x286c('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f9d39,_0x286c('0xf'));logger[_0x286c('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1f9d39,'request\x20sent',JSON[_0x286c('0x11')](_0x515b45));if(_0x515b45[_0x286c('0x12')]){if(_0x515b45[_0x286c('0x12')][_0x286c('0x13')]===0x1f4){logger[_0x286c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f9d39,_0x515b45['error'][_0x286c('0x14')]);return _0x350894(_0x515b45[_0x286c('0x12')][_0x286c('0x14')]);}logger[_0x286c('0x12')](_0x286c('0x15'),_0x1f9d39,_0x515b45[_0x286c('0x12')][_0x286c('0x14')]);return _0x21b62a(_0x515b45[_0x286c('0x12')][_0x286c('0x14')]);}else{logger['info'](_0x286c('0x15'),_0x1f9d39,'request\x20sent');_0x21b62a(_0x515b45[_0x286c('0x16')][_0x286c('0x14')]);}})[_0x286c('0x17')](function(_0x190dee){logger[_0x286c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1f9d39,_0x190dee);_0x350894(_0x190dee);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6eb8ac5..1ef90d2 100644 --- a/server/api/intSalesforceField/index.js +++ b/server/api/intSalesforceField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef33=['put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xef33,0x16d));var _0x3ef3=function(_0x3ef93b,_0x140b62){_0x3ef93b=_0x3ef93b-0x0;var _0x1750e2=_0xef33[_0x3ef93b];return _0x1750e2;};'use strict';var multer=require('multer');var util=require(_0x3ef3('0x0'));var path=require(_0x3ef3('0x1'));var timeout=require(_0x3ef3('0x2'));var express=require(_0x3ef3('0x3'));var router=express[_0x3ef3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3ef3('0x5'));var config=require(_0x3ef3('0x6'));var controller=require(_0x3ef3('0x7'));router['get']('/',auth[_0x3ef3('0x8')](),controller[_0x3ef3('0x9')]);router[_0x3ef3('0xa')](_0x3ef3('0xb'),auth['isAuthenticated'](),controller[_0x3ef3('0xc')]);router[_0x3ef3('0xd')]('/',auth[_0x3ef3('0x8')](),controller[_0x3ef3('0xe')]);router[_0x3ef3('0xf')]('/:id',auth[_0x3ef3('0x8')](),controller[_0x3ef3('0x10')]);router[_0x3ef3('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3ef3('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf135=['post','isAuthenticated','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','index','/:id'];(function(_0x544838,_0x1fcfba){var _0x188c29=function(_0x41de85){while(--_0x41de85){_0x544838['push'](_0x544838['shift']());}};_0x188c29(++_0x1fcfba);}(_0xf135,0x1f4));var _0x5f13=function(_0x16469d,_0x40d16d){_0x16469d=_0x16469d-0x0;var _0x619691=_0xf135[_0x16469d];return _0x619691;};'use strict';var multer=require('multer');var util=require(_0x5f13('0x0'));var path=require('path');var timeout=require(_0x5f13('0x1'));var express=require(_0x5f13('0x2'));var router=express[_0x5f13('0x3')]();var fs_extra=require(_0x5f13('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5f13('0x5'));var controller=require(_0x5f13('0x6'));router[_0x5f13('0x7')]('/',auth['isAuthenticated'](),controller[_0x5f13('0x8')]);router[_0x5f13('0x7')](_0x5f13('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x5f13('0xa')]('/',auth[_0x5f13('0xb')](),controller[_0x5f13('0xc')]);router[_0x5f13('0xd')](_0x5f13('0x9'),auth[_0x5f13('0xb')](),controller['update']);router[_0x5f13('0xe')](_0x5f13('0x9'),auth['isAuthenticated'](),controller[_0x5f13('0xf')]);module[_0x5f13('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0fc18f1..85a6464 100644 --- a/server/api/intSalesforceField/intSalesforceField.attributes.js +++ b/server/api/intSalesforceField/intSalesforceField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bf6=['sequelize','exports','ENUM','string','variable','picklist','STRING'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x8bf6,0x1d5));var _0x68bf=function(_0x40ec16,_0x107d08){_0x40ec16=_0x40ec16-0x0;var _0x436936=_0x8bf6[_0x40ec16];return _0x436936;};'use strict';var Sequelize=require(_0x68bf('0x0'));module[_0x68bf('0x1')]={'type':{'type':Sequelize[_0x68bf('0x2')](_0x68bf('0x3'),_0x68bf('0x4'),'customVariable','keyValue',_0x68bf('0x5')),'defaultValue':_0x68bf('0x3')},'content':{'type':Sequelize[_0x68bf('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x68bf('0x3'),_0x68bf('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x68bf('0x6')]},'variableName':{'type':Sequelize[_0x68bf('0x6')]}}; \ No newline at end of file +var _0x1189=['STRING','customVariable','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x3225d8,_0x2550ef){var _0x575dd8=function(_0x4361a8){while(--_0x4361a8){_0x3225d8['push'](_0x3225d8['shift']());}};_0x575dd8(++_0x2550ef);}(_0x1189,0x1b2));var _0x9118=function(_0x1fe809,_0x315d3e){_0x1fe809=_0x1fe809-0x0;var _0x45ae6a=_0x1189[_0x1fe809];return _0x45ae6a;};'use strict';var Sequelize=require(_0x9118('0x0'));module[_0x9118('0x1')]={'type':{'type':Sequelize[_0x9118('0x2')](_0x9118('0x3'),_0x9118('0x4'),'customVariable',_0x9118('0x5'),_0x9118('0x6')),'defaultValue':_0x9118('0x3')},'content':{'type':Sequelize[_0x9118('0x7')]},'key':{'type':Sequelize[_0x9118('0x7')]},'keyType':{'type':Sequelize[_0x9118('0x2')]('string',_0x9118('0x4'),_0x9118('0x8'))},'keyContent':{'type':Sequelize[_0x9118('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x9118('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 66a3da7..4ee6c1d 100644 --- a/server/api/intSalesforceField/intSalesforceField.controller.js +++ b/server/api/intSalesforceField/intSalesforceField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa867=['status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','error','stack','index','SalesforceField','rawAttributes','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xa867,0x18a));var _0x7a86=function(_0x5d02ba,_0x4f4f87){_0x5d02ba=_0x5d02ba-0x0;var _0x595b7e=_0xa867[_0x5d02ba];return _0x595b7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a86('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a86('0x1'));var rp=require(_0x7a86('0x2'));var moment=require(_0x7a86('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7a86('0x4'));var util=require(_0x7a86('0x5'));var path=require(_0x7a86('0x6'));var sox=require('sox');var csv=require(_0x7a86('0x7'));var ejs=require(_0x7a86('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a86('0x9'));var squel=require(_0x7a86('0xa'));var crypto=require(_0x7a86('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a86('0x7'));var querystring=require(_0x7a86('0xc'));var Papa=require(_0x7a86('0xd'));var Redis=require('ioredis');var authService=require(_0x7a86('0xe'));var qs=require(_0x7a86('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7a86('0x10'));var config=require(_0x7a86('0x11'));var licenseUtil=require(_0x7a86('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15488d,_0xba8f1e){_0xba8f1e=_0xba8f1e||0xcc;return function(_0x57698e){if(_0x57698e){return _0x15488d[_0x7a86('0x13')](_0xba8f1e);}return _0x15488d[_0x7a86('0x14')](_0xba8f1e)[_0x7a86('0x15')]();};}function respondWithResult(_0x3e9a82,_0x346c0f){_0x346c0f=_0x346c0f||0xc8;return function(_0x3cb0f1){if(_0x3cb0f1){return _0x3e9a82[_0x7a86('0x14')](_0x346c0f)['json'](_0x3cb0f1);}};}function respondWithFilteredResult(_0x4635d0,_0x5a3698){return function(_0x278cd9){if(_0x278cd9){var _0x1825b6=typeof _0x5a3698[_0x7a86('0x16')]==='undefined'&&typeof _0x5a3698[_0x7a86('0x17')]===_0x7a86('0x18');var _0x23c3ce=_0x278cd9[_0x7a86('0x19')];var _0x574573=_0x1825b6?0x0:_0x5a3698[_0x7a86('0x16')];var _0x2a3297=_0x1825b6?_0x278cd9[_0x7a86('0x19')]:_0x5a3698[_0x7a86('0x16')]+_0x5a3698['limit'];var _0x5bc2ad;if(_0x2a3297>=_0x23c3ce){_0x2a3297=_0x23c3ce;_0x5bc2ad=0xc8;}else{_0x5bc2ad=0xce;}_0x4635d0['status'](_0x5bc2ad);return _0x4635d0[_0x7a86('0x1a')](_0x7a86('0x1b'),_0x574573+'-'+_0x2a3297+'/'+_0x23c3ce)[_0x7a86('0x1c')](_0x278cd9);}return null;};}function patchUpdates(_0x3f710a){return function(_0x3bed92){try{jsonpatch['apply'](_0x3bed92,_0x3f710a,!![]);}catch(_0x420455){return BPromise[_0x7a86('0x1d')](_0x420455);}return _0x3bed92[_0x7a86('0x1e')]();};}function saveUpdates(_0x664376,_0x2a5123){return function(_0x2a6f3f){if(_0x2a6f3f){return _0x2a6f3f[_0x7a86('0x1f')](_0x664376)[_0x7a86('0x20')](function(_0x31ab8c){return _0x31ab8c;});}return null;};}function removeEntity(_0x5bcd2b,_0xe5a872){return function(_0x3c48c5){if(_0x3c48c5){return _0x3c48c5['destroy']()[_0x7a86('0x20')](function(){_0x5bcd2b[_0x7a86('0x14')](0xcc)[_0x7a86('0x15')]();});}};}function handleEntityNotFound(_0x543b2b,_0x408374){return function(_0x24ed1d){if(!_0x24ed1d){_0x543b2b['sendStatus'](0x194);}return _0x24ed1d;};}function handleError(_0x117ff8,_0x3d4fa5){_0x3d4fa5=_0x3d4fa5||0x1f4;return function(_0x44eb4f){logger[_0x7a86('0x21')](_0x44eb4f[_0x7a86('0x22')]);if(_0x44eb4f['name']){delete _0x44eb4f['name'];}_0x117ff8[_0x7a86('0x14')](_0x3d4fa5)['send'](_0x44eb4f);};}exports[_0x7a86('0x23')]=function(_0x4e6ec8,_0x5413dc){var _0x32d1e7={},_0x8fa5a9={},_0x5d1c9c={'count':0x0,'rows':[]};var _0x341573=_['map'](db[_0x7a86('0x24')][_0x7a86('0x25')],function(_0x24c0b2){return{'name':_0x24c0b2['fieldName'],'type':_0x24c0b2[_0x7a86('0x26')][_0x7a86('0x27')]};});_0x8fa5a9[_0x7a86('0x28')]=_[_0x7a86('0x29')](_0x341573,_0x7a86('0x2a'));_0x8fa5a9[_0x7a86('0x2b')]=_[_0x7a86('0x2c')](_0x4e6ec8[_0x7a86('0x2b')]);_0x8fa5a9[_0x7a86('0x2d')]=_['intersection'](_0x8fa5a9[_0x7a86('0x28')],_0x8fa5a9[_0x7a86('0x2b')]);_0x32d1e7[_0x7a86('0x2e')]=_[_0x7a86('0x2f')](_0x8fa5a9[_0x7a86('0x28')],qs[_0x7a86('0x30')](_0x4e6ec8['query']['fields']));_0x32d1e7[_0x7a86('0x2e')]=_0x32d1e7[_0x7a86('0x2e')][_0x7a86('0x31')]?_0x32d1e7['attributes']:_0x8fa5a9[_0x7a86('0x28')];if(!_0x4e6ec8[_0x7a86('0x2b')][_0x7a86('0x32')]('nolimit')){_0x32d1e7[_0x7a86('0x17')]=qs[_0x7a86('0x17')](_0x4e6ec8[_0x7a86('0x2b')][_0x7a86('0x17')]);_0x32d1e7[_0x7a86('0x16')]=qs[_0x7a86('0x16')](_0x4e6ec8[_0x7a86('0x2b')][_0x7a86('0x16')]);}_0x32d1e7[_0x7a86('0x33')]=qs[_0x7a86('0x34')](_0x4e6ec8[_0x7a86('0x2b')]['sort']);_0x32d1e7['where']=qs[_0x7a86('0x2d')](_['pick'](_0x4e6ec8['query'],_0x8fa5a9[_0x7a86('0x2d')]),_0x341573);if(_0x4e6ec8[_0x7a86('0x2b')]['filter']){_0x32d1e7[_0x7a86('0x35')]=_[_0x7a86('0x36')](_0x32d1e7['where'],{'$or':_[_0x7a86('0x29')](_0x341573,function(_0x3046a7){if(_0x3046a7['type']!==_0x7a86('0x37')){var _0x9940d8={};_0x9940d8[_0x3046a7['name']]={'$like':'%'+_0x4e6ec8[_0x7a86('0x2b')][_0x7a86('0x38')]+'%'};return _0x9940d8;}})});}_0x32d1e7=_[_0x7a86('0x36')]({},_0x32d1e7,_0x4e6ec8['options']);var _0x5959ce={'where':_0x32d1e7[_0x7a86('0x35')]};return db[_0x7a86('0x24')][_0x7a86('0x19')](_0x5959ce)[_0x7a86('0x20')](function(_0xea239b){_0x5d1c9c['count']=_0xea239b;if(_0x4e6ec8['query'][_0x7a86('0x39')]){_0x32d1e7[_0x7a86('0x3a')]=[{'all':!![]}];}return db['SalesforceField'][_0x7a86('0x3b')](_0x32d1e7);})[_0x7a86('0x20')](function(_0x34bb53){_0x5d1c9c[_0x7a86('0x3c')]=_0x34bb53;return _0x5d1c9c;})[_0x7a86('0x20')](respondWithFilteredResult(_0x5413dc,_0x32d1e7))[_0x7a86('0x3d')](handleError(_0x5413dc,null));};exports[_0x7a86('0x3e')]=function(_0x5223a6,_0x4c4139){var _0x2ff30a={'raw':!![],'where':{'id':_0x5223a6[_0x7a86('0x3f')]['id']}},_0x575899={};_0x575899[_0x7a86('0x28')]=_['keys'](db[_0x7a86('0x24')][_0x7a86('0x25')]);_0x575899[_0x7a86('0x2b')]=_[_0x7a86('0x2c')](_0x5223a6[_0x7a86('0x2b')]);_0x575899['filters']=_[_0x7a86('0x2f')](_0x575899[_0x7a86('0x28')],_0x575899[_0x7a86('0x2b')]);_0x2ff30a[_0x7a86('0x2e')]=_[_0x7a86('0x2f')](_0x575899[_0x7a86('0x28')],qs[_0x7a86('0x30')](_0x5223a6[_0x7a86('0x2b')]['fields']));_0x2ff30a[_0x7a86('0x2e')]=_0x2ff30a[_0x7a86('0x2e')][_0x7a86('0x31')]?_0x2ff30a[_0x7a86('0x2e')]:_0x575899[_0x7a86('0x28')];if(_0x5223a6[_0x7a86('0x2b')][_0x7a86('0x39')]){_0x2ff30a[_0x7a86('0x3a')]=[{'all':!![]}];}_0x2ff30a=_[_0x7a86('0x36')]({},_0x2ff30a,_0x5223a6[_0x7a86('0x40')]);return db[_0x7a86('0x24')][_0x7a86('0x41')](_0x2ff30a)[_0x7a86('0x20')](handleEntityNotFound(_0x4c4139,null))[_0x7a86('0x20')](respondWithResult(_0x4c4139,null))[_0x7a86('0x3d')](handleError(_0x4c4139,null));};exports[_0x7a86('0x42')]=function(_0x2826e2,_0x39767a){return db['SalesforceField'][_0x7a86('0x42')](_0x2826e2['body'],{})[_0x7a86('0x20')](respondWithResult(_0x39767a,0xc9))[_0x7a86('0x3d')](handleError(_0x39767a,null));};exports[_0x7a86('0x1f')]=function(_0x4c9072,_0x5e7ff6){if(_0x4c9072['body']['id']){delete _0x4c9072[_0x7a86('0x43')]['id'];}return db[_0x7a86('0x24')][_0x7a86('0x41')]({'where':{'id':_0x4c9072[_0x7a86('0x3f')]['id']}})[_0x7a86('0x20')](handleEntityNotFound(_0x5e7ff6,null))[_0x7a86('0x20')](saveUpdates(_0x4c9072[_0x7a86('0x43')],null))[_0x7a86('0x20')](respondWithResult(_0x5e7ff6,null))[_0x7a86('0x3d')](handleError(_0x5e7ff6,null));};exports[_0x7a86('0x44')]=function(_0x5799a9,_0x1de767){return db[_0x7a86('0x24')]['find']({'where':{'id':_0x5799a9[_0x7a86('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1de767,null))[_0x7a86('0x20')](removeEntity(_0x1de767,null))[_0x7a86('0x3d')](handleError(_0x1de767,null));}; \ No newline at end of file +var _0x41b0=['filters','merge','VIRTUAL','filter','options','SalesforceField','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','undefined','limit','offset','count','set','json','apply','reject','save','then','status','end','error','stack','name','send','index','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4caf98,_0x51a0ac){var _0x310b17=function(_0x4475fd){while(--_0x4475fd){_0x4caf98['push'](_0x4caf98['shift']());}};_0x310b17(++_0x51a0ac);}(_0x41b0,0x19a));var _0x041b=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x41b0[_0x3fd3a3];return _0xa3e4d5;};'use strict';var emlformat=require(_0x041b('0x0'));var rimraf=require(_0x041b('0x1'));var zipdir=require(_0x041b('0x2'));var jsonpatch=require(_0x041b('0x3'));var rp=require(_0x041b('0x4'));var moment=require('moment');var BPromise=require(_0x041b('0x5'));var Mustache=require(_0x041b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x041b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x041b('0x8'));var _=require(_0x041b('0x9'));var squel=require(_0x041b('0xa'));var crypto=require(_0x041b('0xb'));var jsforce=require(_0x041b('0xc'));var deskjs=require(_0x041b('0xd'));var toCsv=require(_0x041b('0xe'));var querystring=require(_0x041b('0xf'));var Papa=require(_0x041b('0x10'));var Redis=require(_0x041b('0x11'));var authService=require(_0x041b('0x12'));var qs=require(_0x041b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x041b('0x14'));var logger=require(_0x041b('0x15'))(_0x041b('0x16'));var utils=require('../../config/utils');var config=require(_0x041b('0x17'));var licenseUtil=require(_0x041b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcbdd4,_0x2b8b24){_0x2b8b24=_0x2b8b24||0xcc;return function(_0x3fbcbe){if(_0x3fbcbe){return _0xcbdd4[_0x041b('0x19')](_0x2b8b24);}return _0xcbdd4['status'](_0x2b8b24)['end']();};}function respondWithResult(_0x280739,_0x56a1c5){_0x56a1c5=_0x56a1c5||0xc8;return function(_0x53616b){if(_0x53616b){return _0x280739['status'](_0x56a1c5)['json'](_0x53616b);}};}function respondWithFilteredResult(_0x46db94,_0x36b5ae){return function(_0x472fb3){if(_0x472fb3){var _0x45c460=typeof _0x36b5ae['offset']===_0x041b('0x1a')&&typeof _0x36b5ae[_0x041b('0x1b')]==='undefined';var _0xbb7be5=_0x472fb3['count'];var _0x3db1df=_0x45c460?0x0:_0x36b5ae[_0x041b('0x1c')];var _0x9a6139=_0x45c460?_0x472fb3[_0x041b('0x1d')]:_0x36b5ae[_0x041b('0x1c')]+_0x36b5ae[_0x041b('0x1b')];var _0xdc2e4a;if(_0x9a6139>=_0xbb7be5){_0x9a6139=_0xbb7be5;_0xdc2e4a=0xc8;}else{_0xdc2e4a=0xce;}_0x46db94['status'](_0xdc2e4a);return _0x46db94[_0x041b('0x1e')]('Content-Range',_0x3db1df+'-'+_0x9a6139+'/'+_0xbb7be5)[_0x041b('0x1f')](_0x472fb3);}return null;};}function patchUpdates(_0x463b5c){return function(_0x2914f1){try{jsonpatch[_0x041b('0x20')](_0x2914f1,_0x463b5c,!![]);}catch(_0xcbca74){return BPromise[_0x041b('0x21')](_0xcbca74);}return _0x2914f1[_0x041b('0x22')]();};}function saveUpdates(_0x14bfb0,_0x59e6bc){return function(_0x456588){if(_0x456588){return _0x456588['update'](_0x14bfb0)['then'](function(_0x19bfb3){return _0x19bfb3;});}return null;};}function removeEntity(_0x551b99,_0xe40549){return function(_0x2e1ec4){if(_0x2e1ec4){return _0x2e1ec4['destroy']()[_0x041b('0x23')](function(){_0x551b99[_0x041b('0x24')](0xcc)[_0x041b('0x25')]();});}};}function handleEntityNotFound(_0x43a08a,_0xe6b0af){return function(_0x4f547e){if(!_0x4f547e){_0x43a08a[_0x041b('0x19')](0x194);}return _0x4f547e;};}function handleError(_0x48de7b,_0x52756d){_0x52756d=_0x52756d||0x1f4;return function(_0x30a0b6){logger[_0x041b('0x26')](_0x30a0b6[_0x041b('0x27')]);if(_0x30a0b6['name']){delete _0x30a0b6[_0x041b('0x28')];}_0x48de7b[_0x041b('0x24')](_0x52756d)[_0x041b('0x29')](_0x30a0b6);};}exports[_0x041b('0x2a')]=function(_0x58e2f8,_0x19f01a){var _0x392a98={},_0x2f6ccd={},_0x38dccf={'count':0x0,'rows':[]};var _0x5630a6=_['map'](db['SalesforceField']['rawAttributes'],function(_0x491d11){return{'name':_0x491d11[_0x041b('0x2b')],'type':_0x491d11[_0x041b('0x2c')][_0x041b('0x2d')]};});_0x2f6ccd[_0x041b('0x2e')]=_[_0x041b('0x2f')](_0x5630a6,_0x041b('0x28'));_0x2f6ccd[_0x041b('0x30')]=_['keys'](_0x58e2f8[_0x041b('0x30')]);_0x2f6ccd['filters']=_['intersection'](_0x2f6ccd[_0x041b('0x2e')],_0x2f6ccd[_0x041b('0x30')]);_0x392a98[_0x041b('0x31')]=_[_0x041b('0x32')](_0x2f6ccd[_0x041b('0x2e')],qs[_0x041b('0x33')](_0x58e2f8[_0x041b('0x30')][_0x041b('0x33')]));_0x392a98['attributes']=_0x392a98[_0x041b('0x31')][_0x041b('0x34')]?_0x392a98[_0x041b('0x31')]:_0x2f6ccd[_0x041b('0x2e')];if(!_0x58e2f8[_0x041b('0x30')][_0x041b('0x35')](_0x041b('0x36'))){_0x392a98[_0x041b('0x1b')]=qs[_0x041b('0x1b')](_0x58e2f8['query'][_0x041b('0x1b')]);_0x392a98[_0x041b('0x1c')]=qs['offset'](_0x58e2f8[_0x041b('0x30')][_0x041b('0x1c')]);}_0x392a98[_0x041b('0x37')]=qs[_0x041b('0x38')](_0x58e2f8['query'][_0x041b('0x38')]);_0x392a98[_0x041b('0x39')]=qs[_0x041b('0x3a')](_['pick'](_0x58e2f8[_0x041b('0x30')],_0x2f6ccd['filters']),_0x5630a6);if(_0x58e2f8['query']['filter']){_0x392a98[_0x041b('0x39')]=_[_0x041b('0x3b')](_0x392a98[_0x041b('0x39')],{'$or':_[_0x041b('0x2f')](_0x5630a6,function(_0x106d00){if(_0x106d00[_0x041b('0x2c')]!==_0x041b('0x3c')){var _0x536d2c={};_0x536d2c[_0x106d00[_0x041b('0x28')]]={'$like':'%'+_0x58e2f8[_0x041b('0x30')][_0x041b('0x3d')]+'%'};return _0x536d2c;}})});}_0x392a98=_[_0x041b('0x3b')]({},_0x392a98,_0x58e2f8[_0x041b('0x3e')]);var _0x445bfe={'where':_0x392a98[_0x041b('0x39')]};return db[_0x041b('0x3f')]['count'](_0x445bfe)['then'](function(_0x45d5dd){_0x38dccf['count']=_0x45d5dd;if(_0x58e2f8[_0x041b('0x30')]['includeAll']){_0x392a98[_0x041b('0x40')]=[{'all':!![]}];}return db[_0x041b('0x3f')][_0x041b('0x41')](_0x392a98);})[_0x041b('0x23')](function(_0x24680f){_0x38dccf[_0x041b('0x42')]=_0x24680f;return _0x38dccf;})[_0x041b('0x23')](respondWithFilteredResult(_0x19f01a,_0x392a98))[_0x041b('0x43')](handleError(_0x19f01a,null));};exports[_0x041b('0x44')]=function(_0x2fa5f7,_0x5ee374){var _0x1f58e7={'raw':!![],'where':{'id':_0x2fa5f7[_0x041b('0x45')]['id']}},_0x47160b={};_0x47160b[_0x041b('0x2e')]=_[_0x041b('0x46')](db[_0x041b('0x3f')][_0x041b('0x47')]);_0x47160b[_0x041b('0x30')]=_[_0x041b('0x46')](_0x2fa5f7[_0x041b('0x30')]);_0x47160b[_0x041b('0x3a')]=_['intersection'](_0x47160b[_0x041b('0x2e')],_0x47160b['query']);_0x1f58e7[_0x041b('0x31')]=_[_0x041b('0x32')](_0x47160b['model'],qs['fields'](_0x2fa5f7[_0x041b('0x30')][_0x041b('0x33')]));_0x1f58e7['attributes']=_0x1f58e7[_0x041b('0x31')][_0x041b('0x34')]?_0x1f58e7['attributes']:_0x47160b[_0x041b('0x2e')];if(_0x2fa5f7[_0x041b('0x30')][_0x041b('0x48')]){_0x1f58e7[_0x041b('0x40')]=[{'all':!![]}];}_0x1f58e7=_[_0x041b('0x3b')]({},_0x1f58e7,_0x2fa5f7[_0x041b('0x3e')]);return db['SalesforceField'][_0x041b('0x49')](_0x1f58e7)[_0x041b('0x23')](handleEntityNotFound(_0x5ee374,null))['then'](respondWithResult(_0x5ee374,null))[_0x041b('0x43')](handleError(_0x5ee374,null));};exports['create']=function(_0x308c45,_0x1cdae3){return db[_0x041b('0x3f')][_0x041b('0x4a')](_0x308c45[_0x041b('0x4b')],{})[_0x041b('0x23')](respondWithResult(_0x1cdae3,0xc9))[_0x041b('0x43')](handleError(_0x1cdae3,null));};exports[_0x041b('0x4c')]=function(_0x58c1c2,_0x15f3b9){if(_0x58c1c2['body']['id']){delete _0x58c1c2[_0x041b('0x4b')]['id'];}return db[_0x041b('0x3f')][_0x041b('0x49')]({'where':{'id':_0x58c1c2['params']['id']}})[_0x041b('0x23')](handleEntityNotFound(_0x15f3b9,null))['then'](saveUpdates(_0x58c1c2[_0x041b('0x4b')],null))[_0x041b('0x23')](respondWithResult(_0x15f3b9,null))[_0x041b('0x43')](handleError(_0x15f3b9,null));};exports[_0x041b('0x4d')]=function(_0xd3d882,_0x28a6d2){return db[_0x041b('0x3f')][_0x041b('0x49')]({'where':{'id':_0xd3d882[_0x041b('0x45')]['id']}})[_0x041b('0x23')](handleEntityNotFound(_0x28a6d2,null))[_0x041b('0x23')](removeEntity(_0x28a6d2,null))[_0x041b('0x43')](handleError(_0x28a6d2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 34704de..13515e7 100644 --- a/server/api/intSalesforceField/intSalesforceField.model.js +++ b/server/api/intSalesforceField/intSalesforceField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a0a=['exports','define','SalesforceField','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x1a0a,0x155));var _0xa1a0=function(_0x59ed12,_0xf96ab6){_0x59ed12=_0x59ed12-0x0;var _0x3b6f60=_0x1a0a[_0x59ed12];return _0x3b6f60;};'use strict';var _=require(_0xa1a0('0x0'));var util=require(_0xa1a0('0x1'));var logger=require(_0xa1a0('0x2'))(_0xa1a0('0x3'));var moment=require(_0xa1a0('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa1a0('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0xa1a0('0x7')]=function(_0xedb03b,_0x7d8bdc){return _0xedb03b[_0xa1a0('0x8')](_0xa1a0('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xa1a0('0xa'),'fields':['idField',_0xa1a0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96ef=['exports','SalesforceField','int_salesforce_fields','idField','FieldId','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x96ef,0x12e));var _0xf96e=function(_0x1d439a,_0x566d96){_0x1d439a=_0x1d439a-0x0;var _0x141d41=_0x96ef[_0x1d439a];return _0x141d41;};'use strict';var _=require('lodash');var util=require(_0xf96e('0x0'));var logger=require('../../config/logger')(_0xf96e('0x1'));var moment=require(_0xf96e('0x2'));var BPromise=require(_0xf96e('0x3'));var rp=require(_0xf96e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf96e('0x5'));var attributes=require('./intSalesforceField.attributes');module[_0xf96e('0x6')]=function(_0xed444e,_0x16f46b){return _0xed444e['define'](_0xf96e('0x7'),attributes,{'tableName':_0xf96e('0x8'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xf96e('0x9'),_0xf96e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b993891..35baddf 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31b4=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x174d8a,_0x145776){var _0x47b103=function(_0x2438b3){while(--_0x2438b3){_0x174d8a['push'](_0x174d8a['shift']());}};_0x47b103(++_0x145776);}(_0x31b4,0xda));var _0x431b=function(_0x15c6ad,_0x3ef5a){_0x15c6ad=_0x15c6ad-0x0;var _0x404191=_0x31b4[_0x15c6ad];return _0x404191;};'use strict';var _=require(_0x431b('0x0'));var util=require(_0x431b('0x1'));var moment=require(_0x431b('0x2'));var BPromise=require(_0x431b('0x3'));var rs=require(_0x431b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x431b('0x5'));var logger=require('../../config/logger')(_0x431b('0x6'));var config=require(_0x431b('0x7'));var jayson=require(_0x431b('0x8'));var client=jayson['client'][_0x431b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38c925,_0x2978e9,_0x1f4269){return new BPromise(function(_0x5a13ec,_0x3f0777){return client[_0x431b('0xa')](_0x38c925,_0x1f4269)[_0x431b('0xb')](function(_0x3ffa8f){logger[_0x431b('0xc')](_0x431b('0xd'),_0x2978e9,_0x431b('0xe'));logger[_0x431b('0xf')](_0x431b('0x10'),_0x2978e9,_0x431b('0xe'),JSON[_0x431b('0x11')](_0x3ffa8f));if(_0x3ffa8f[_0x431b('0x12')]){if(_0x3ffa8f['error'][_0x431b('0x13')]===0x1f4){logger[_0x431b('0x12')](_0x431b('0xd'),_0x2978e9,_0x3ffa8f[_0x431b('0x12')][_0x431b('0x14')]);return _0x3f0777(_0x3ffa8f[_0x431b('0x12')][_0x431b('0x14')]);}logger[_0x431b('0x12')](_0x431b('0xd'),_0x2978e9,_0x3ffa8f[_0x431b('0x12')][_0x431b('0x14')]);return _0x5a13ec(_0x3ffa8f[_0x431b('0x12')]['message']);}else{logger[_0x431b('0xc')]('SalesforceField,\x20%s,\x20%s',_0x2978e9,'request\x20sent');_0x5a13ec(_0x3ffa8f['result'][_0x431b('0x14')]);}})[_0x431b('0x15')](function(_0x2894f5){logger[_0x431b('0x12')](_0x431b('0xd'),_0x2978e9,_0x2894f5);_0x3f0777(_0x2894f5);});});} \ No newline at end of file +var _0x1969=['message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x407323,_0x28f985){var _0x23aaf6=function(_0x464fd0){while(--_0x464fd0){_0x407323['push'](_0x407323['shift']());}};_0x23aaf6(++_0x28f985);}(_0x1969,0x122));var _0x9196=function(_0x29a72c,_0x2c0a5e){_0x29a72c=_0x29a72c-0x0;var _0x48bcab=_0x1969[_0x29a72c];return _0x48bcab;};'use strict';var _=require(_0x9196('0x0'));var util=require('util');var moment=require(_0x9196('0x1'));var BPromise=require(_0x9196('0x2'));var rs=require(_0x9196('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9196('0x4'))['db'];var utils=require(_0x9196('0x5'));var logger=require(_0x9196('0x6'))('rpc');var config=require(_0x9196('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9196('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568900,_0x2c93db,_0x7de381){return new BPromise(function(_0x790250,_0x15af31){return client['request'](_0x568900,_0x7de381)[_0x9196('0x9')](function(_0x3a8114){logger[_0x9196('0xa')](_0x9196('0xb'),_0x2c93db,_0x9196('0xc'));logger[_0x9196('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2c93db,_0x9196('0xc'),JSON['stringify'](_0x3a8114));if(_0x3a8114['error']){if(_0x3a8114[_0x9196('0xe')][_0x9196('0xf')]===0x1f4){logger[_0x9196('0xe')]('SalesforceField,\x20%s,\x20%s',_0x2c93db,_0x3a8114[_0x9196('0xe')][_0x9196('0x10')]);return _0x15af31(_0x3a8114[_0x9196('0xe')][_0x9196('0x10')]);}logger[_0x9196('0xe')](_0x9196('0xb'),_0x2c93db,_0x3a8114[_0x9196('0xe')][_0x9196('0x10')]);return _0x790250(_0x3a8114[_0x9196('0xe')][_0x9196('0x10')]);}else{logger[_0x9196('0xa')](_0x9196('0xb'),_0x2c93db,_0x9196('0xc'));_0x790250(_0x3a8114['result'][_0x9196('0x10')]);}})[_0x9196('0x11')](function(_0x1418c5){logger[_0x9196('0xe')]('SalesforceField,\x20%s,\x20%s',_0x2c93db,_0x1418c5);_0x15af31(_0x1418c5);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e72d134..9d6da6d 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddee=['addConfiguration','put','update','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x5b8bbc,_0x4e3baa){var _0x1922c5=function(_0x4dcb4c){while(--_0x4dcb4c){_0x5b8bbc['push'](_0x5b8bbc['shift']());}};_0x1922c5(++_0x4e3baa);}(_0xddee,0x1d2));var _0xedde=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xddee[_0x7791d5];return _0x5ce288;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xedde('0x0'));var timeout=require(_0xedde('0x1'));var express=require(_0xedde('0x2'));var router=express['Router']();var fs_extra=require(_0xedde('0x3'));var auth=require(_0xedde('0x4'));var interaction=require(_0xedde('0x5'));var config=require(_0xedde('0x6'));var controller=require(_0xedde('0x7'));router[_0xedde('0x8')]('/',auth[_0xedde('0x9')](),controller[_0xedde('0xa')]);router[_0xedde('0x8')](_0xedde('0xb'),auth['isAuthenticated'](),controller[_0xedde('0xc')]);router[_0xedde('0x8')](_0xedde('0xd'),auth[_0xedde('0x9')](),controller[_0xedde('0xe')]);router[_0xedde('0x8')](_0xedde('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xedde('0x10')]('/',auth[_0xedde('0x9')](),controller[_0xedde('0x11')]);router[_0xedde('0x10')]('/:id/configurations',auth[_0xedde('0x9')](),controller[_0xedde('0x12')]);router[_0xedde('0x13')](_0xedde('0xb'),auth[_0xedde('0x9')](),controller[_0xedde('0x14')]);router['delete']('/:id',auth[_0xedde('0x9')](),controller['destroy']);module[_0xedde('0x15')]=router; \ No newline at end of file +var _0x9fa9=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x9fa9,0x1c7));var _0x99fa=function(_0x110424,_0x215da4){_0x110424=_0x110424-0x0;var _0x5ebe51=_0x9fa9[_0x110424];return _0x5ebe51;};'use strict';var multer=require(_0x99fa('0x0'));var util=require(_0x99fa('0x1'));var path=require(_0x99fa('0x2'));var timeout=require(_0x99fa('0x3'));var express=require(_0x99fa('0x4'));var router=express[_0x99fa('0x5')]();var fs_extra=require(_0x99fa('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x99fa('0x7'));var controller=require(_0x99fa('0x8'));router[_0x99fa('0x9')]('/',auth[_0x99fa('0xa')](),controller['index']);router['get']('/:id',auth[_0x99fa('0xa')](),controller[_0x99fa('0xb')]);router['get'](_0x99fa('0xc'),auth['isAuthenticated'](),controller[_0x99fa('0xd')]);router[_0x99fa('0x9')]('/:id/fields',auth[_0x99fa('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x99fa('0xe')]);router[_0x99fa('0xf')](_0x99fa('0xc'),auth[_0x99fa('0xa')](),controller[_0x99fa('0x10')]);router[_0x99fa('0x11')](_0x99fa('0x12'),auth['isAuthenticated'](),controller[_0x99fa('0x13')]);router[_0x99fa('0x14')](_0x99fa('0x12'),auth[_0x99fa('0xa')](),controller['destroy']);module[_0x99fa('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 426b383..76df3f6 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57d4=['username','remoteUri','exports','STRING'];(function(_0x4c4284,_0x581403){var _0x18e0fb=function(_0x24abe8){while(--_0x24abe8){_0x4c4284['push'](_0x4c4284['shift']());}};_0x18e0fb(++_0x581403);}(_0x57d4,0xea));var _0x457d=function(_0x8a99c7,_0x7b1574){_0x8a99c7=_0x8a99c7-0x0;var _0x4a8d0=_0x57d4[_0x8a99c7];return _0x4a8d0;};'use strict';var Sequelize=require('sequelize');module[_0x457d('0x0')]={'name':{'type':Sequelize[_0x457d('0x1')]},'description':{'type':Sequelize[_0x457d('0x1')]},'username':{'type':Sequelize[_0x457d('0x1')],'unique':_0x457d('0x2')},'password':{'type':Sequelize[_0x457d('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x457d('0x3')},'serverUrl':{'type':Sequelize[_0x457d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xca9d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x143a03,_0xfaa65a){var _0x4f9b66=function(_0x127064){while(--_0x127064){_0x143a03['push'](_0x143a03['shift']());}};_0x4f9b66(++_0xfaa65a);}(_0xca9d,0x8c));var _0xdca9=function(_0x628a67,_0x3f89ed){_0x628a67=_0x628a67-0x0;var _0x124e73=_0xca9d[_0x628a67];return _0x124e73;};'use strict';var Sequelize=require(_0xdca9('0x0'));module[_0xdca9('0x1')]={'name':{'type':Sequelize[_0xdca9('0x2')]},'description':{'type':Sequelize[_0xdca9('0x2')]},'username':{'type':Sequelize[_0xdca9('0x2')],'unique':_0xdca9('0x3')},'password':{'type':Sequelize[_0xdca9('0x2')]},'email':{'type':Sequelize[_0xdca9('0x2')]},'remoteUri':{'type':Sequelize[_0xdca9('0x2')],'unique':_0xdca9('0x4')},'serverUrl':{'type':Sequelize[_0xdca9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index fcef5c3..8577492 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ed=['cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','subcategory','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','false','GET','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ServicenowAccount','findAll','catch','show','params','keys','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_by','calendar_stc','closed_at'];(function(_0x4146d8,_0x869d79){var _0x48c0d2=function(_0x5b6301){while(--_0x5b6301){_0x4146d8['push'](_0x4146d8['shift']());}};_0x48c0d2(++_0x869d79);}(_0x55ed,0x1d1));var _0xd55e=function(_0x26948f,_0x5b9bfe){_0x26948f=_0x26948f-0x0;var _0x567347=_0x55ed[_0x26948f];return _0x567347;};'use strict';var emlformat=require(_0xd55e('0x0'));var rimraf=require(_0xd55e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd55e('0x2'));var rp=require(_0xd55e('0x3'));var moment=require(_0xd55e('0x4'));var BPromise=require(_0xd55e('0x5'));var Mustache=require(_0xd55e('0x6'));var util=require(_0xd55e('0x7'));var path=require('path');var sox=require(_0xd55e('0x8'));var csv=require(_0xd55e('0x9'));var ejs=require(_0xd55e('0xa'));var fs=require('fs');var fs_extra=require(_0xd55e('0xb'));var _=require(_0xd55e('0xc'));var squel=require(_0xd55e('0xd'));var crypto=require(_0xd55e('0xe'));var jsforce=require(_0xd55e('0xf'));var deskjs=require(_0xd55e('0x10'));var toCsv=require(_0xd55e('0x9'));var querystring=require(_0xd55e('0x11'));var Papa=require('papaparse');var Redis=require(_0xd55e('0x12'));var authService=require(_0xd55e('0x13'));var qs=require(_0xd55e('0x14'));var as=require(_0xd55e('0x15'));var hardwareService=require(_0xd55e('0x16'));var logger=require(_0xd55e('0x17'))(_0xd55e('0x18'));var utils=require(_0xd55e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd55e('0x1a'));var db=require(_0xd55e('0x1b'))['db'];var integrations=require(_0xd55e('0x1c'));function respondWithStatusCode(_0x3157b4,_0x4b543f){_0x4b543f=_0x4b543f||0xcc;return function(_0x3a9746){if(_0x3a9746){return _0x3157b4[_0xd55e('0x1d')](_0x4b543f);}return _0x3157b4[_0xd55e('0x1e')](_0x4b543f)['end']();};}function respondWithResult(_0x22f431,_0x5ed07a){_0x5ed07a=_0x5ed07a||0xc8;return function(_0x8e45de){if(_0x8e45de){return _0x22f431[_0xd55e('0x1e')](_0x5ed07a)[_0xd55e('0x1f')](_0x8e45de);}};}function respondWithFilteredResult(_0x1a651c,_0x4e2cff){return function(_0x42384e){if(_0x42384e){var _0x17d670=typeof _0x4e2cff[_0xd55e('0x20')]===_0xd55e('0x21')&&typeof _0x4e2cff['limit']==='undefined';var _0x3a8697=_0x42384e[_0xd55e('0x22')];var _0x551ca3=_0x17d670?0x0:_0x4e2cff[_0xd55e('0x20')];var _0x537e71=_0x17d670?_0x42384e[_0xd55e('0x22')]:_0x4e2cff[_0xd55e('0x20')]+_0x4e2cff[_0xd55e('0x23')];var _0x498b9d;if(_0x537e71>=_0x3a8697){_0x537e71=_0x3a8697;_0x498b9d=0xc8;}else{_0x498b9d=0xce;}_0x1a651c['status'](_0x498b9d);return _0x1a651c[_0xd55e('0x24')](_0xd55e('0x25'),_0x551ca3+'-'+_0x537e71+'/'+_0x3a8697)[_0xd55e('0x1f')](_0x42384e);}return null;};}function patchUpdates(_0x4ddeb6){return function(_0x2ef2bd){try{jsonpatch[_0xd55e('0x26')](_0x2ef2bd,_0x4ddeb6,!![]);}catch(_0xf432ea){return BPromise[_0xd55e('0x27')](_0xf432ea);}return _0x2ef2bd[_0xd55e('0x28')]();};}function saveUpdates(_0x5aa3a6,_0x4a77ef){return function(_0x3e8e6f){if(_0x3e8e6f){return _0x3e8e6f[_0xd55e('0x29')](_0x5aa3a6)[_0xd55e('0x2a')](function(_0x2b9359){return _0x2b9359;});}return null;};}function removeEntity(_0xab995e,_0x21484b){return function(_0x1c9a1a){if(_0x1c9a1a){return _0x1c9a1a[_0xd55e('0x2b')]()['then'](function(){_0xab995e[_0xd55e('0x1e')](0xcc)[_0xd55e('0x2c')]();});}};}function handleEntityNotFound(_0x38fc5c,_0x152747){return function(_0x54119d){if(!_0x54119d){_0x38fc5c[_0xd55e('0x1d')](0x194);}return _0x54119d;};}function handleError(_0x239b67,_0xedd936){_0xedd936=_0xedd936||0x1f4;return function(_0x54de38){logger[_0xd55e('0x2d')](_0x54de38[_0xd55e('0x2e')]);if(_0x54de38[_0xd55e('0x2f')]){delete _0x54de38[_0xd55e('0x2f')];}_0x239b67[_0xd55e('0x1e')](_0xedd936)[_0xd55e('0x30')](_0x54de38);};}exports['index']=function(_0x3cc4cd,_0x3038b5){var _0x1f901e={},_0x4dd1d6={},_0x285086={'count':0x0,'rows':[]};var _0x2bb7dc=_[_0xd55e('0x31')](db['ServicenowAccount'][_0xd55e('0x32')],function(_0x2c2238){return{'name':_0x2c2238[_0xd55e('0x33')],'type':_0x2c2238['type'][_0xd55e('0x34')]};});_0x4dd1d6['model']=_[_0xd55e('0x31')](_0x2bb7dc,_0xd55e('0x2f'));_0x4dd1d6[_0xd55e('0x35')]=_['keys'](_0x3cc4cd[_0xd55e('0x35')]);_0x4dd1d6[_0xd55e('0x36')]=_[_0xd55e('0x37')](_0x4dd1d6[_0xd55e('0x38')],_0x4dd1d6['query']);_0x1f901e[_0xd55e('0x39')]=_[_0xd55e('0x37')](_0x4dd1d6['model'],qs[_0xd55e('0x3a')](_0x3cc4cd[_0xd55e('0x35')][_0xd55e('0x3a')]));_0x1f901e[_0xd55e('0x39')]=_0x1f901e[_0xd55e('0x39')][_0xd55e('0x3b')]?_0x1f901e[_0xd55e('0x39')]:_0x4dd1d6['model'];if(!_0x3cc4cd[_0xd55e('0x35')][_0xd55e('0x3c')](_0xd55e('0x3d'))){_0x1f901e[_0xd55e('0x23')]=qs['limit'](_0x3cc4cd[_0xd55e('0x35')][_0xd55e('0x23')]);_0x1f901e[_0xd55e('0x20')]=qs[_0xd55e('0x20')](_0x3cc4cd[_0xd55e('0x35')][_0xd55e('0x20')]);}_0x1f901e[_0xd55e('0x3e')]=qs[_0xd55e('0x3f')](_0x3cc4cd[_0xd55e('0x35')][_0xd55e('0x3f')]);_0x1f901e[_0xd55e('0x40')]=qs[_0xd55e('0x36')](_[_0xd55e('0x41')](_0x3cc4cd[_0xd55e('0x35')],_0x4dd1d6[_0xd55e('0x36')]),_0x2bb7dc);if(_0x3cc4cd['query'][_0xd55e('0x42')]){_0x1f901e[_0xd55e('0x40')]=_[_0xd55e('0x43')](_0x1f901e[_0xd55e('0x40')],{'$or':_[_0xd55e('0x31')](_0x2bb7dc,function(_0x25e011){if(_0x25e011[_0xd55e('0x44')]!==_0xd55e('0x45')){var _0x31e6d8={};_0x31e6d8[_0x25e011['name']]={'$like':'%'+_0x3cc4cd['query'][_0xd55e('0x42')]+'%'};return _0x31e6d8;}})});}_0x1f901e=_['merge']({},_0x1f901e,_0x3cc4cd[_0xd55e('0x46')]);var _0x284853={'where':_0x1f901e[_0xd55e('0x40')]};return db['ServicenowAccount']['count'](_0x284853)[_0xd55e('0x2a')](function(_0x4abc7f){_0x285086['count']=_0x4abc7f;if(_0x3cc4cd[_0xd55e('0x35')][_0xd55e('0x47')]){_0x1f901e[_0xd55e('0x48')]=[{'all':!![]}];}return db[_0xd55e('0x49')][_0xd55e('0x4a')](_0x1f901e);})[_0xd55e('0x2a')](function(_0x48f6c6){_0x285086['rows']=_0x48f6c6;return _0x285086;})['then'](respondWithFilteredResult(_0x3038b5,_0x1f901e))[_0xd55e('0x4b')](handleError(_0x3038b5,null));};exports[_0xd55e('0x4c')]=function(_0x5d72d4,_0x772263){var _0x54e28c={'raw':![],'where':{'id':_0x5d72d4[_0xd55e('0x4d')]['id']}},_0x3bd573={};_0x3bd573['model']=_[_0xd55e('0x4e')](db[_0xd55e('0x49')][_0xd55e('0x32')]);_0x3bd573['query']=_['keys'](_0x5d72d4[_0xd55e('0x35')]);_0x3bd573[_0xd55e('0x36')]=_[_0xd55e('0x37')](_0x3bd573['model'],_0x3bd573[_0xd55e('0x35')]);_0x54e28c[_0xd55e('0x39')]=_[_0xd55e('0x37')](_0x3bd573[_0xd55e('0x38')],qs[_0xd55e('0x3a')](_0x5d72d4[_0xd55e('0x35')][_0xd55e('0x3a')]));_0x54e28c[_0xd55e('0x39')]=_0x54e28c['attributes'][_0xd55e('0x3b')]?_0x54e28c[_0xd55e('0x39')]:_0x3bd573[_0xd55e('0x38')];if(_0x5d72d4[_0xd55e('0x35')][_0xd55e('0x47')]){_0x54e28c[_0xd55e('0x48')]=[{'all':!![]}];}_0x54e28c=_['merge']({},_0x54e28c,_0x5d72d4[_0xd55e('0x46')]);return db[_0xd55e('0x49')][_0xd55e('0x4f')](_0x54e28c)[_0xd55e('0x2a')](handleEntityNotFound(_0x772263,null))[_0xd55e('0x2a')](respondWithResult(_0x772263,null))[_0xd55e('0x4b')](handleError(_0x772263,null));};exports[_0xd55e('0x50')]=function(_0x187f67,_0x47f5af){return db['ServicenowAccount'][_0xd55e('0x50')](_0x187f67['body'],{})['then'](respondWithResult(_0x47f5af,0xc9))['catch'](handleError(_0x47f5af,null));};exports[_0xd55e('0x29')]=function(_0xb0ea11,_0x31dee4){if(_0xb0ea11[_0xd55e('0x51')]['id']){delete _0xb0ea11['body']['id'];}return db[_0xd55e('0x49')][_0xd55e('0x4f')]({'where':{'id':_0xb0ea11[_0xd55e('0x4d')]['id']}})[_0xd55e('0x2a')](handleEntityNotFound(_0x31dee4,null))['then'](saveUpdates(_0xb0ea11[_0xd55e('0x51')],null))[_0xd55e('0x2a')](respondWithResult(_0x31dee4,null))[_0xd55e('0x4b')](handleError(_0x31dee4,null));};exports[_0xd55e('0x2b')]=function(_0x701941,_0x1f25e6){return db['ServicenowAccount']['find']({'where':{'id':_0x701941[_0xd55e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f25e6,null))[_0xd55e('0x2a')](removeEntity(_0x1f25e6,null))[_0xd55e('0x4b')](handleError(_0x1f25e6,null));};exports[_0xd55e('0x52')]=function(_0x29e567,_0x4dd6ce,_0x873385){var _0x4bf59e={};var _0x46388b={};var _0x229ccf;var _0x1ff045;return db[_0xd55e('0x49')][_0xd55e('0x53')]({'where':{'id':_0x29e567[_0xd55e('0x4d')]['id']}})[_0xd55e('0x2a')](handleEntityNotFound(_0x4dd6ce,null))[_0xd55e('0x2a')](function(_0x2e48d3){if(_0x2e48d3){_0x229ccf=_0x2e48d3;_0x46388b[_0xd55e('0x38')]=_[_0xd55e('0x4e')](db['ServicenowConfiguration'][_0xd55e('0x32')]);_0x46388b[_0xd55e('0x35')]=_[_0xd55e('0x4e')](_0x29e567[_0xd55e('0x35')]);_0x46388b[_0xd55e('0x36')]=_[_0xd55e('0x37')](_0x46388b[_0xd55e('0x38')],_0x46388b[_0xd55e('0x35')]);_0x4bf59e[_0xd55e('0x39')]=_[_0xd55e('0x37')](_0x46388b[_0xd55e('0x38')],qs['fields'](_0x29e567[_0xd55e('0x35')]['fields']));_0x4bf59e['attributes']=_0x4bf59e[_0xd55e('0x39')][_0xd55e('0x3b')]?_0x4bf59e['attributes']:_0x46388b[_0xd55e('0x38')];_0x4bf59e[_0xd55e('0x3e')]=qs[_0xd55e('0x3f')](_0x29e567[_0xd55e('0x35')]['sort']);_0x4bf59e['where']=qs[_0xd55e('0x36')](_[_0xd55e('0x41')](_0x29e567[_0xd55e('0x35')],_0x46388b[_0xd55e('0x36')]));if(_0x29e567[_0xd55e('0x35')][_0xd55e('0x42')]){_0x4bf59e[_0xd55e('0x40')]=_['merge'](_0x4bf59e[_0xd55e('0x40')],{'$or':_[_0xd55e('0x31')](_0x4bf59e[_0xd55e('0x39')],function(_0x3d9d82){var _0x41209d={};_0x41209d[_0x3d9d82]={'$like':'%'+_0x29e567[_0xd55e('0x35')][_0xd55e('0x42')]+'%'};return _0x41209d;})});}_0x4bf59e=_[_0xd55e('0x43')]({},_0x4bf59e,_0x29e567[_0xd55e('0x46')]);return _0x229ccf[_0xd55e('0x52')](_0x4bf59e);}})['then'](function(_0x1286ab){if(_0x1286ab){_0x1ff045=_0x1286ab[_0xd55e('0x3b')];if(!_0x29e567[_0xd55e('0x35')][_0xd55e('0x3c')](_0xd55e('0x3d'))){_0x4bf59e['limit']=qs[_0xd55e('0x23')](_0x29e567['query'][_0xd55e('0x23')]);_0x4bf59e[_0xd55e('0x20')]=qs[_0xd55e('0x20')](_0x29e567['query'][_0xd55e('0x20')]);}return _0x229ccf[_0xd55e('0x52')](_0x4bf59e);}})['then'](function(_0x393ca5){if(_0x393ca5){return _0x393ca5?{'count':_0x1ff045,'rows':_0x393ca5}:null;}})[_0xd55e('0x2a')](respondWithResult(_0x4dd6ce,null))['catch'](handleError(_0x4dd6ce,null));};exports[_0xd55e('0x54')]=function(_0x13f76f,_0x14d978,_0x28b561){if(_0x13f76f[_0xd55e('0x51')]['id']){delete _0x13f76f['body']['id'];}return db[_0xd55e('0x49')][_0xd55e('0x53')]({'where':{'id':_0x13f76f[_0xd55e('0x4d')]['id']}})[_0xd55e('0x2a')](handleEntityNotFound(_0x14d978,null))[_0xd55e('0x2a')](function(_0x540990){if(_0x540990){_0x13f76f[_0xd55e('0x51')][_0xd55e('0x55')]=_0x540990['id'];_0x13f76f[_0xd55e('0x51')][_0xd55e('0x56')]=integrations[_0xd55e('0x57')](_0x13f76f[_0xd55e('0x51')][_0xd55e('0x58')],_0x13f76f['body'][_0xd55e('0x44')]);_0x13f76f[_0xd55e('0x51')][_0xd55e('0x59')]=integrations[_0xd55e('0x5a')](_0x13f76f[_0xd55e('0x51')]['channel'],_0x13f76f[_0xd55e('0x51')][_0xd55e('0x44')]);return db['ServicenowConfiguration'][_0xd55e('0x50')](_0x13f76f[_0xd55e('0x51')],{'include':[{'model':db[_0xd55e('0x5b')],'as':_0xd55e('0x56')},{'model':db[_0xd55e('0x5b')],'as':_0xd55e('0x59')}]});}return null;})['then'](respondWithResult(_0x14d978,null))[_0xd55e('0x4b')](handleError(_0x14d978,null));};exports[_0xd55e('0x5c')]=function(_0x99bb2,_0x4dc0cf,_0x1c8926){var _0x4cece8=[_0xd55e('0x5d'),_0xd55e('0x5e'),_0xd55e('0x5f'),'subcategory',_0xd55e('0x60'),'notify',_0xd55e('0x61'),_0xd55e('0x62'),_0xd55e('0x63')];var _0x1d9596=[_0xd55e('0x64'),_0xd55e('0x5d'),_0xd55e('0x65'),_0xd55e('0x66'),_0xd55e('0x67'),_0xd55e('0x68'),_0xd55e('0x69'),_0xd55e('0x5e'),_0xd55e('0x6a'),_0xd55e('0x6b'),'resolved_by',_0xd55e('0x6c'),_0xd55e('0x6d'),_0xd55e('0x6e'),'sys_created_on','sys_domain','state',_0xd55e('0x6f'),_0xd55e('0x5f'),_0xd55e('0x3e'),_0xd55e('0x70'),_0xd55e('0x71'),_0xd55e('0x72'),_0xd55e('0x73'),'impact',_0xd55e('0x74'),_0xd55e('0x75'),_0xd55e('0x76'),_0xd55e('0x77'),_0xd55e('0x78'),_0xd55e('0x79'),_0xd55e('0x7a'),'expected_start',_0xd55e('0x7b'),_0xd55e('0x7c'),_0xd55e('0x7d'),_0xd55e('0x7e'),_0xd55e('0x7f'),_0xd55e('0x80'),'caller_id','approval_set',_0xd55e('0x81'),'work_notes',_0xd55e('0x82'),_0xd55e('0x60'),_0xd55e('0x83'),_0xd55e('0x84'),_0xd55e('0x85'),_0xd55e('0x86'),_0xd55e('0x87'),_0xd55e('0x88'),_0xd55e('0x89'),_0xd55e('0x8a'),_0xd55e('0x8b'),_0xd55e('0x8c'),_0xd55e('0x8d'),_0xd55e('0x8e'),'follow_up','parent_incident','sys_id',_0xd55e('0x8f'),_0xd55e('0x90'),_0xd55e('0x61'),_0xd55e('0x91'),_0xd55e('0x92'),_0xd55e('0x93'),_0xd55e('0x94'),_0xd55e('0x95'),_0xd55e('0x96'),'severity',_0xd55e('0x97'),'sla_due',_0xd55e('0x98'),_0xd55e('0x99'),'due_date',_0xd55e('0x9a'),_0xd55e('0x9b'),_0xd55e('0x9c'),_0xd55e('0x9d'),_0xd55e('0x9e'),'correlation_id',_0xd55e('0x9f'),_0xd55e('0x63')];var _0x2caba1='';var _0x4457dc='';var _0x3dcc28=[];var _0x292cb6='';var _0xe66b8b='';var _0x54a152=[];var _0x23fee2='';var _0x2e38c9='';var _0x721954={};var _0x1904a7='';return db[_0xd55e('0x49')][_0xd55e('0x53')]({'where':{'id':_0x99bb2[_0xd55e('0x4d')]['id']},'attributes':['id',_0xd55e('0xa0'),_0xd55e('0xa1'),_0xd55e('0xa2'),_0xd55e('0xa3'),_0xd55e('0xa4')]})[_0xd55e('0x2a')](handleEntityNotFound(_0x4dc0cf,null))['then'](function(_0x51dc37){if(_0x51dc37){_0x1904a7=_0x51dc37[_0xd55e('0xa3')];var _0x57db30=_0x1904a7[_0xd55e('0xa5')](-0x1);if(_0x57db30==='/'){_0x1904a7=_0x1904a7['substring'](0x0,_0x1904a7[_0xd55e('0xa6')](_0x57db30));}_0x2e38c9=util[_0xd55e('0xa7')]('%s/api/now/doc/table/schema/',_0x1904a7);_0x23fee2=util[_0xd55e('0xa7')](_0xd55e('0xa8'),_0x1904a7);_0x721954={'user':_0x51dc37['username'],'pass':_0x51dc37[_0xd55e('0xa1')]};var _0x58d9e9={'method':'GET','uri':_0x2e38c9+_0xd55e('0xa9'),'auth':_0x721954,'json':!![]};return rp(_0x58d9e9);}})[_0xd55e('0x2a')](function(_0xbc44b){if(_0xbc44b['result']['length']>0x0){_0x2caba1=_0xbc44b[_0xd55e('0xaa')];}console[_0xd55e('0xab')](_0xd55e('0xac'),_0x2caba1);_0x54a152=[];_0x4457dc=Object['assign']([],_0x2caba1);_[_0xd55e('0xad')](_0x4457dc,function(_0x3fce2d){return!_0x4cece8[_0xd55e('0xae')](_0x3fce2d['name']);});_0x4457dc[_0xd55e('0xaf')](function(_0x1da15e){var _0x1517c1=createFieldObject(_0x23fee2,_0x721954,_0x1da15e[_0xd55e('0xb0')],_0x1da15e['name'],_0x1da15e[_0xd55e('0xb1')],![]);_0x54a152[_0xd55e('0xb2')](_0x1517c1);});return Promise[_0xd55e('0xb3')](_0x54a152);})[_0xd55e('0x2a')](function(_0x1686d1){_0x3dcc28=_0x1686d1;_0x292cb6=Object[_0xd55e('0xb4')]([],_0x2caba1);console[_0xd55e('0xab')](_0xd55e('0xb5'),_0x2caba1);_[_0xd55e('0xad')](_0x292cb6,function(_0x9360f1){return _0x1d9596[_0xd55e('0xae')](_0x9360f1[_0xd55e('0x2f')]);});console[_0xd55e('0xab')](_0xd55e('0xb6'),_0x292cb6);_0x54a152=[];_0x292cb6['forEach'](function(_0x115ae7){var _0x14fea1=createFieldObject(_0x23fee2,_0x721954,_0x115ae7[_0xd55e('0xb0')],_0x115ae7[_0xd55e('0x2f')],_0x115ae7[_0xd55e('0xb1')],!![]);_0x54a152[_0xd55e('0xb2')](_0x14fea1);});return Promise[_0xd55e('0xb3')](_0x54a152);})[_0xd55e('0x2a')](function(_0x163843){_0xe66b8b=_0x163843;var _0x549bf2=_0x3dcc28[_0xd55e('0xb7')](_0xe66b8b);return{'count':_0x549bf2['length'],'rows':_0x549bf2};})['then'](respondWithResult(_0x4dc0cf,null))[_0xd55e('0x4b')](function(_0x2f366f){console[_0xd55e('0xab')](_0xd55e('0xb8')+_0x2f366f);var _0x4150a4=_0x99bb2[_0xd55e('0x35')][_0xd55e('0xb9')]?0x1f4:_0x2f366f[_0xd55e('0xba')]||0x1f4;logger[_0xd55e('0x2d')](_0x2f366f[_0xd55e('0x2e')]);delete _0x2f366f['name'];if(_0x4150a4===0x191){_0x4150a4=0x190;}_0x4dc0cf[_0xd55e('0x1e')](_0x4150a4)[_0xd55e('0x30')](_0x99bb2[_0xd55e('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2f366f['statusCode']}:_0x2f366f);});};function createFieldObject(_0x3848c0,_0x593927,_0x1dae2c,_0x479e72,_0x54d3f3,_0x1ff3ea){return new Promise(function(_0x54c6c6,_0x455c40){var _0xb2389e={'id':_0x479e72,'name':_0x54d3f3,'custom':_0x1ff3ea};if(_0x1dae2c===_0xd55e('0xbb')){_0xb2389e['options']=[{'name':'True','value':_0xd55e('0xbc')},{'name':'False','value':_0xd55e('0xbd')}];_0x54c6c6(_0xb2389e);}else{var _0x11af03={'method':_0xd55e('0xbe'),'uri':_0x3848c0+'sys_choice?sysparm_query=name=incident^element='+_0x479e72,'auth':_0x593927,'json':!![]};return rp(_0x11af03)[_0xd55e('0x2a')](function(_0x1575e2){var _0x11cd1d=[];if(_0x1575e2[_0xd55e('0xaa')][_0xd55e('0x3b')]>0x0){_0x1575e2[_0xd55e('0xaa')]['forEach'](function(_0x12e0ac){if(_0x12e0ac[_0xd55e('0xbf')]==='false'){var _0x4943f8={'name':_0x12e0ac['label'],'value':_0x12e0ac[_0xd55e('0xc0')]};_0x11cd1d['push'](_0x4943f8);}});}_0xb2389e['options']=_0x11cd1d;if(_0xb2389e[_0xd55e('0x46')]['length']>0x0){_0x54c6c6(_0xb2389e);}else{if(_0x1ff3ea==![]){_0x54c6c6();}else{_0x54c6c6(_0xb2389e);}}});}});} \ No newline at end of file +var _0x79b2=['notify','incident_state','parent','caused_by','sys_updated_on','child_incidents','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','delivery_task','assignment_group','description','calendar_duration','sys_class_name','close_notes','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','approval','due_date','reopen_count','escalation','correlation_id','category','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','push','all','concat','ServiceNow\x20error:\x20','statusCode','stack','test','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','label','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','reject','save','destroy','then','error','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','params','includeAll','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','length','addConfiguration','AccountId','Subjects','Descriptions','getFields','made_sla','subcategory','close_code'];(function(_0xd1ad0,_0x4eb87a){var _0x35a193=function(_0x13dfde){while(--_0x13dfde){_0xd1ad0['push'](_0xd1ad0['shift']());}};_0x35a193(++_0x4eb87a);}(_0x79b2,0x1b3));var _0x279b=function(_0x48f5fd,_0x1ebd4a){_0x48f5fd=_0x48f5fd-0x0;var _0x3335bb=_0x79b2[_0x48f5fd];return _0x3335bb;};'use strict';var emlformat=require(_0x279b('0x0'));var rimraf=require(_0x279b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x279b('0x2'));var rp=require(_0x279b('0x3'));var moment=require('moment');var BPromise=require(_0x279b('0x4'));var Mustache=require(_0x279b('0x5'));var util=require(_0x279b('0x6'));var path=require(_0x279b('0x7'));var sox=require(_0x279b('0x8'));var csv=require(_0x279b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x279b('0xa'));var _=require(_0x279b('0xb'));var squel=require(_0x279b('0xc'));var crypto=require(_0x279b('0xd'));var jsforce=require(_0x279b('0xe'));var deskjs=require(_0x279b('0xf'));var toCsv=require(_0x279b('0x9'));var querystring=require('querystring');var Papa=require(_0x279b('0x10'));var Redis=require(_0x279b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x279b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x279b('0x13'));var logger=require(_0x279b('0x14'))(_0x279b('0x15'));var utils=require(_0x279b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x279b('0x17'));var db=require(_0x279b('0x18'))['db'];var integrations=require(_0x279b('0x19'));function respondWithStatusCode(_0x4330fe,_0x5727f7){_0x5727f7=_0x5727f7||0xcc;return function(_0x55d566){if(_0x55d566){return _0x4330fe[_0x279b('0x1a')](_0x5727f7);}return _0x4330fe['status'](_0x5727f7)[_0x279b('0x1b')]();};}function respondWithResult(_0xf4ff54,_0x854665){_0x854665=_0x854665||0xc8;return function(_0x3a7ae2){if(_0x3a7ae2){return _0xf4ff54['status'](_0x854665)[_0x279b('0x1c')](_0x3a7ae2);}};}function respondWithFilteredResult(_0x141ab3,_0x44f90d){return function(_0xbaacde){if(_0xbaacde){var _0x343209=typeof _0x44f90d[_0x279b('0x1d')]===_0x279b('0x1e')&&typeof _0x44f90d[_0x279b('0x1f')]==='undefined';var _0x132b4d=_0xbaacde[_0x279b('0x20')];var _0x48b938=_0x343209?0x0:_0x44f90d['offset'];var _0x471113=_0x343209?_0xbaacde[_0x279b('0x20')]:_0x44f90d['offset']+_0x44f90d[_0x279b('0x1f')];var _0x347020;if(_0x471113>=_0x132b4d){_0x471113=_0x132b4d;_0x347020=0xc8;}else{_0x347020=0xce;}_0x141ab3[_0x279b('0x21')](_0x347020);return _0x141ab3['set']('Content-Range',_0x48b938+'-'+_0x471113+'/'+_0x132b4d)[_0x279b('0x1c')](_0xbaacde);}return null;};}function patchUpdates(_0x1b505b){return function(_0x5acd78){try{jsonpatch['apply'](_0x5acd78,_0x1b505b,!![]);}catch(_0x1000a5){return BPromise[_0x279b('0x22')](_0x1000a5);}return _0x5acd78[_0x279b('0x23')]();};}function saveUpdates(_0x5a5196,_0x4b63ab){return function(_0x137b2e){if(_0x137b2e){return _0x137b2e['update'](_0x5a5196)['then'](function(_0x5aa544){return _0x5aa544;});}return null;};}function removeEntity(_0x133358,_0x45b8dc){return function(_0x1e3d58){if(_0x1e3d58){return _0x1e3d58[_0x279b('0x24')]()[_0x279b('0x25')](function(){_0x133358[_0x279b('0x21')](0xcc)[_0x279b('0x1b')]();});}};}function handleEntityNotFound(_0x13fc88,_0x45e52a){return function(_0x4c0b92){if(!_0x4c0b92){_0x13fc88[_0x279b('0x1a')](0x194);}return _0x4c0b92;};}function handleError(_0x1e9971,_0x39929c){_0x39929c=_0x39929c||0x1f4;return function(_0x463b86){logger[_0x279b('0x26')](_0x463b86['stack']);if(_0x463b86[_0x279b('0x27')]){delete _0x463b86[_0x279b('0x27')];}_0x1e9971[_0x279b('0x21')](_0x39929c)[_0x279b('0x28')](_0x463b86);};}exports[_0x279b('0x29')]=function(_0x3d15ea,_0x3d559f){var _0x46b6e7={},_0x4cc467={},_0x4ea56d={'count':0x0,'rows':[]};var _0x873ae9=_[_0x279b('0x2a')](db[_0x279b('0x2b')][_0x279b('0x2c')],function(_0x55f166){return{'name':_0x55f166[_0x279b('0x2d')],'type':_0x55f166[_0x279b('0x2e')]['key']};});_0x4cc467['model']=_[_0x279b('0x2a')](_0x873ae9,_0x279b('0x27'));_0x4cc467[_0x279b('0x2f')]=_[_0x279b('0x30')](_0x3d15ea['query']);_0x4cc467['filters']=_[_0x279b('0x31')](_0x4cc467['model'],_0x4cc467[_0x279b('0x2f')]);_0x46b6e7['attributes']=_['intersection'](_0x4cc467[_0x279b('0x32')],qs[_0x279b('0x33')](_0x3d15ea[_0x279b('0x2f')][_0x279b('0x33')]));_0x46b6e7[_0x279b('0x34')]=_0x46b6e7['attributes']['length']?_0x46b6e7[_0x279b('0x34')]:_0x4cc467[_0x279b('0x32')];if(!_0x3d15ea[_0x279b('0x2f')][_0x279b('0x35')](_0x279b('0x36'))){_0x46b6e7[_0x279b('0x1f')]=qs[_0x279b('0x1f')](_0x3d15ea['query'][_0x279b('0x1f')]);_0x46b6e7[_0x279b('0x1d')]=qs['offset'](_0x3d15ea[_0x279b('0x2f')][_0x279b('0x1d')]);}_0x46b6e7[_0x279b('0x37')]=qs[_0x279b('0x38')](_0x3d15ea[_0x279b('0x2f')][_0x279b('0x38')]);_0x46b6e7[_0x279b('0x39')]=qs[_0x279b('0x3a')](_[_0x279b('0x3b')](_0x3d15ea[_0x279b('0x2f')],_0x4cc467[_0x279b('0x3a')]),_0x873ae9);if(_0x3d15ea['query'][_0x279b('0x3c')]){_0x46b6e7[_0x279b('0x39')]=_['merge'](_0x46b6e7['where'],{'$or':_[_0x279b('0x2a')](_0x873ae9,function(_0x1db920){if(_0x1db920['type']!==_0x279b('0x3d')){var _0x3f8b1e={};_0x3f8b1e[_0x1db920[_0x279b('0x27')]]={'$like':'%'+_0x3d15ea['query'][_0x279b('0x3c')]+'%'};return _0x3f8b1e;}})});}_0x46b6e7=_[_0x279b('0x3e')]({},_0x46b6e7,_0x3d15ea[_0x279b('0x3f')]);var _0x29371f={'where':_0x46b6e7[_0x279b('0x39')]};return db['ServicenowAccount']['count'](_0x29371f)['then'](function(_0x58c2d3){_0x4ea56d[_0x279b('0x20')]=_0x58c2d3;if(_0x3d15ea['query']['includeAll']){_0x46b6e7[_0x279b('0x40')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x46b6e7);})[_0x279b('0x25')](function(_0x226c4f){_0x4ea56d[_0x279b('0x41')]=_0x226c4f;return _0x4ea56d;})[_0x279b('0x25')](respondWithFilteredResult(_0x3d559f,_0x46b6e7))['catch'](handleError(_0x3d559f,null));};exports['show']=function(_0x5e0c3f,_0x280fab){var _0xbd11b5={'raw':![],'where':{'id':_0x5e0c3f[_0x279b('0x42')]['id']}},_0x109461={};_0x109461[_0x279b('0x32')]=_['keys'](db[_0x279b('0x2b')][_0x279b('0x2c')]);_0x109461[_0x279b('0x2f')]=_['keys'](_0x5e0c3f[_0x279b('0x2f')]);_0x109461[_0x279b('0x3a')]=_[_0x279b('0x31')](_0x109461[_0x279b('0x32')],_0x109461['query']);_0xbd11b5[_0x279b('0x34')]=_['intersection'](_0x109461['model'],qs['fields'](_0x5e0c3f[_0x279b('0x2f')][_0x279b('0x33')]));_0xbd11b5['attributes']=_0xbd11b5[_0x279b('0x34')]['length']?_0xbd11b5['attributes']:_0x109461['model'];if(_0x5e0c3f[_0x279b('0x2f')][_0x279b('0x43')]){_0xbd11b5[_0x279b('0x40')]=[{'all':!![]}];}_0xbd11b5=_['merge']({},_0xbd11b5,_0x5e0c3f[_0x279b('0x3f')]);return db['ServicenowAccount'][_0x279b('0x44')](_0xbd11b5)[_0x279b('0x25')](handleEntityNotFound(_0x280fab,null))[_0x279b('0x25')](respondWithResult(_0x280fab,null))[_0x279b('0x45')](handleError(_0x280fab,null));};exports['create']=function(_0x32e926,_0x2a2bbe){return db[_0x279b('0x2b')][_0x279b('0x46')](_0x32e926['body'],{})[_0x279b('0x25')](respondWithResult(_0x2a2bbe,0xc9))[_0x279b('0x45')](handleError(_0x2a2bbe,null));};exports['update']=function(_0x4e2881,_0x4e4efb){if(_0x4e2881[_0x279b('0x47')]['id']){delete _0x4e2881['body']['id'];}return db[_0x279b('0x2b')][_0x279b('0x44')]({'where':{'id':_0x4e2881[_0x279b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e4efb,null))[_0x279b('0x25')](saveUpdates(_0x4e2881[_0x279b('0x47')],null))[_0x279b('0x25')](respondWithResult(_0x4e4efb,null))[_0x279b('0x45')](handleError(_0x4e4efb,null));};exports[_0x279b('0x24')]=function(_0x3f4bc7,_0x308519){return db[_0x279b('0x2b')][_0x279b('0x44')]({'where':{'id':_0x3f4bc7[_0x279b('0x42')]['id']}})[_0x279b('0x25')](handleEntityNotFound(_0x308519,null))[_0x279b('0x25')](removeEntity(_0x308519,null))['catch'](handleError(_0x308519,null));};exports[_0x279b('0x48')]=function(_0x411ddd,_0x1be695,_0x5a773e){var _0x557db9={};var _0x5406fc={};var _0x5ae7cc;var _0x5a87a1;return db['ServicenowAccount'][_0x279b('0x49')]({'where':{'id':_0x411ddd[_0x279b('0x42')]['id']}})[_0x279b('0x25')](handleEntityNotFound(_0x1be695,null))[_0x279b('0x25')](function(_0x234b61){if(_0x234b61){_0x5ae7cc=_0x234b61;_0x5406fc['model']=_[_0x279b('0x30')](db[_0x279b('0x4a')][_0x279b('0x2c')]);_0x5406fc['query']=_[_0x279b('0x30')](_0x411ddd['query']);_0x5406fc['filters']=_['intersection'](_0x5406fc[_0x279b('0x32')],_0x5406fc[_0x279b('0x2f')]);_0x557db9[_0x279b('0x34')]=_[_0x279b('0x31')](_0x5406fc[_0x279b('0x32')],qs[_0x279b('0x33')](_0x411ddd[_0x279b('0x2f')]['fields']));_0x557db9[_0x279b('0x34')]=_0x557db9[_0x279b('0x34')][_0x279b('0x4b')]?_0x557db9[_0x279b('0x34')]:_0x5406fc[_0x279b('0x32')];_0x557db9[_0x279b('0x37')]=qs[_0x279b('0x38')](_0x411ddd[_0x279b('0x2f')]['sort']);_0x557db9['where']=qs[_0x279b('0x3a')](_['pick'](_0x411ddd[_0x279b('0x2f')],_0x5406fc[_0x279b('0x3a')]));if(_0x411ddd[_0x279b('0x2f')][_0x279b('0x3c')]){_0x557db9[_0x279b('0x39')]=_[_0x279b('0x3e')](_0x557db9[_0x279b('0x39')],{'$or':_[_0x279b('0x2a')](_0x557db9[_0x279b('0x34')],function(_0x5a4e9f){var _0x4807ef={};_0x4807ef[_0x5a4e9f]={'$like':'%'+_0x411ddd['query'][_0x279b('0x3c')]+'%'};return _0x4807ef;})});}_0x557db9=_[_0x279b('0x3e')]({},_0x557db9,_0x411ddd['options']);return _0x5ae7cc[_0x279b('0x48')](_0x557db9);}})[_0x279b('0x25')](function(_0xcc6727){if(_0xcc6727){_0x5a87a1=_0xcc6727['length'];if(!_0x411ddd[_0x279b('0x2f')][_0x279b('0x35')]('nolimit')){_0x557db9[_0x279b('0x1f')]=qs[_0x279b('0x1f')](_0x411ddd['query']['limit']);_0x557db9[_0x279b('0x1d')]=qs['offset'](_0x411ddd[_0x279b('0x2f')][_0x279b('0x1d')]);}return _0x5ae7cc[_0x279b('0x48')](_0x557db9);}})[_0x279b('0x25')](function(_0x1a1d6d){if(_0x1a1d6d){return _0x1a1d6d?{'count':_0x5a87a1,'rows':_0x1a1d6d}:null;}})[_0x279b('0x25')](respondWithResult(_0x1be695,null))['catch'](handleError(_0x1be695,null));};exports[_0x279b('0x4c')]=function(_0x1d432b,_0x4a7fb9,_0x441990){if(_0x1d432b['body']['id']){delete _0x1d432b[_0x279b('0x47')]['id'];}return db['ServicenowAccount'][_0x279b('0x49')]({'where':{'id':_0x1d432b[_0x279b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4a7fb9,null))['then'](function(_0x29c393){if(_0x29c393){_0x1d432b['body'][_0x279b('0x4d')]=_0x29c393['id'];_0x1d432b[_0x279b('0x47')][_0x279b('0x4e')]=integrations['getSubjects'](_0x1d432b[_0x279b('0x47')]['channel'],_0x1d432b['body'][_0x279b('0x2e')]);_0x1d432b['body'][_0x279b('0x4f')]=integrations['getDescriptions'](_0x1d432b[_0x279b('0x47')]['channel'],_0x1d432b[_0x279b('0x47')][_0x279b('0x2e')]);return db[_0x279b('0x4a')][_0x279b('0x46')](_0x1d432b[_0x279b('0x47')],{'include':[{'model':db['ServicenowField'],'as':_0x279b('0x4e')},{'model':db['ServicenowField'],'as':_0x279b('0x4f')}]});}return null;})[_0x279b('0x25')](respondWithResult(_0x4a7fb9,null))[_0x279b('0x45')](handleError(_0x4a7fb9,null));};exports[_0x279b('0x50')]=function(_0x226792,_0x3e5305,_0x3b0a6f){var _0x4588d8=[_0x279b('0x51'),'hold_reason','knowledge',_0x279b('0x52'),_0x279b('0x53'),_0x279b('0x54'),_0x279b('0x55'),'severity','category'];var _0xe33996=[_0x279b('0x56'),'made_sla',_0x279b('0x57'),'watch_list','upon_reject',_0x279b('0x58'),_0x279b('0x59'),'hold_reason','approval_history','number',_0x279b('0x5a'),_0x279b('0x5b'),'opened_by',_0x279b('0x5c'),_0x279b('0x5d'),_0x279b('0x5e'),_0x279b('0x5f'),_0x279b('0x60'),_0x279b('0x61'),_0x279b('0x37'),_0x279b('0x62'),_0x279b('0x63'),_0x279b('0x64'),'delivery_plan',_0x279b('0x65'),_0x279b('0x66'),_0x279b('0x67'),_0x279b('0x68'),_0x279b('0x69'),_0x279b('0x6a'),_0x279b('0x6b'),_0x279b('0x6c'),_0x279b('0x6d'),'opened_at',_0x279b('0x6e'),_0x279b('0x6f'),_0x279b('0x70'),_0x279b('0x71'),_0x279b('0x72'),_0x279b('0x73'),'approval_set',_0x279b('0x52'),_0x279b('0x74'),_0x279b('0x75'),_0x279b('0x53'),'correlation_display',_0x279b('0x76'),'work_start',_0x279b('0x77'),'business_stc','additional_assignee_list',_0x279b('0x78'),_0x279b('0x79'),_0x279b('0x54'),_0x279b('0x7a'),_0x279b('0x7b'),'closed_by',_0x279b('0x7c'),'parent_incident',_0x279b('0x7d'),_0x279b('0x7e'),_0x279b('0x7f'),_0x279b('0x55'),_0x279b('0x80'),_0x279b('0x81'),_0x279b('0x82'),_0x279b('0x83'),_0x279b('0x84'),_0x279b('0x85'),_0x279b('0x86'),_0x279b('0x87'),'sla_due',_0x279b('0x88'),'comments_and_work_notes',_0x279b('0x89'),'sys_mod_count',_0x279b('0x8a'),'sys_tags',_0x279b('0x8b'),'upon_approval',_0x279b('0x8c'),'location',_0x279b('0x8d')];var _0x23288c='';var _0x431cab='';var _0x527f22=[];var _0x3e9fd4='';var _0x2f78e8='';var _0x2f3a04=[];var _0x564a19='';var _0x4dc63d='';var _0x48b216={};var _0x4c0599='';return db[_0x279b('0x2b')]['findOne']({'where':{'id':_0x226792['params']['id']},'attributes':['id','username','password','email',_0x279b('0x8e'),_0x279b('0x8f')]})[_0x279b('0x25')](handleEntityNotFound(_0x3e5305,null))[_0x279b('0x25')](function(_0x2ace5e){if(_0x2ace5e){_0x4c0599=_0x2ace5e['remoteUri'];var _0x2365e2=_0x4c0599[_0x279b('0x90')](-0x1);if(_0x2365e2==='/'){_0x4c0599=_0x4c0599[_0x279b('0x91')](0x0,_0x4c0599['lastIndexOf'](_0x2365e2));}_0x4dc63d=util['format'](_0x279b('0x92'),_0x4c0599);_0x564a19=util['format'](_0x279b('0x93'),_0x4c0599);_0x48b216={'user':_0x2ace5e[_0x279b('0x94')],'pass':_0x2ace5e[_0x279b('0x95')]};var _0x3b56f3={'method':_0x279b('0x96'),'uri':_0x4dc63d+_0x279b('0x97'),'auth':_0x48b216,'json':!![]};return rp(_0x3b56f3);}})[_0x279b('0x25')](function(_0x958596){if(_0x958596['result']['length']>0x0){_0x23288c=_0x958596[_0x279b('0x98')];}console[_0x279b('0x99')]('incident\x20table\x20objects',_0x23288c);_0x2f3a04=[];_0x431cab=Object[_0x279b('0x9a')]([],_0x23288c);_[_0x279b('0x9b')](_0x431cab,function(_0xa52389){return!_0x4588d8[_0x279b('0x9c')](_0xa52389['name']);});_0x431cab[_0x279b('0x9d')](function(_0x2def4f){var _0x403e38=createFieldObject(_0x564a19,_0x48b216,_0x2def4f[_0x279b('0x9e')],_0x2def4f['name'],_0x2def4f['label'],![]);_0x2f3a04[_0x279b('0x9f')](_0x403e38);});return Promise[_0x279b('0xa0')](_0x2f3a04);})[_0x279b('0x25')](function(_0x515835){_0x527f22=_0x515835;_0x3e9fd4=Object[_0x279b('0x9a')]([],_0x23288c);console[_0x279b('0x99')]('TCL:\x20_object',_0x23288c);_[_0x279b('0x9b')](_0x3e9fd4,function(_0x1b3194){return _0xe33996[_0x279b('0x9c')](_0x1b3194['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3e9fd4);_0x2f3a04=[];_0x3e9fd4[_0x279b('0x9d')](function(_0x5edf81){var _0x30932c=createFieldObject(_0x564a19,_0x48b216,_0x5edf81['internalType'],_0x5edf81[_0x279b('0x27')],_0x5edf81['label'],!![]);_0x2f3a04['push'](_0x30932c);});return Promise[_0x279b('0xa0')](_0x2f3a04);})['then'](function(_0x5a17a7){_0x2f78e8=_0x5a17a7;var _0x5b596b=_0x527f22[_0x279b('0xa1')](_0x2f78e8);return{'count':_0x5b596b[_0x279b('0x4b')],'rows':_0x5b596b};})[_0x279b('0x25')](respondWithResult(_0x3e5305,null))[_0x279b('0x45')](function(_0x456f1f){console[_0x279b('0x99')](_0x279b('0xa2')+_0x456f1f);var _0x15d895=_0x226792[_0x279b('0x2f')]['test']?0x1f4:_0x456f1f[_0x279b('0xa3')]||0x1f4;logger[_0x279b('0x26')](_0x456f1f[_0x279b('0xa4')]);delete _0x456f1f[_0x279b('0x27')];if(_0x15d895===0x191){_0x15d895=0x190;}_0x3e5305['status'](_0x15d895)[_0x279b('0x28')](_0x226792[_0x279b('0x2f')][_0x279b('0xa5')]?{'message':_0x279b('0xa6'),'statusCode':_0x456f1f[_0x279b('0xa3')]}:_0x456f1f);});};function createFieldObject(_0x48068d,_0x545446,_0x3fc448,_0x25dd7c,_0xbb7c82,_0x1329a8){return new Promise(function(_0x28e577,_0x4cf17c){var _0x3e28bc={'id':_0x25dd7c,'name':_0xbb7c82,'custom':_0x1329a8};if(_0x3fc448===_0x279b('0xa7')){_0x3e28bc[_0x279b('0x3f')]=[{'name':_0x279b('0xa8'),'value':'true'},{'name':_0x279b('0xa9'),'value':_0x279b('0xaa')}];_0x28e577(_0x3e28bc);}else{var _0x22bc0f={'method':'GET','uri':_0x48068d+_0x279b('0xab')+_0x25dd7c,'auth':_0x545446,'json':!![]};return rp(_0x22bc0f)['then'](function(_0x4cfe60){var _0x92dccb=[];if(_0x4cfe60[_0x279b('0x98')]['length']>0x0){_0x4cfe60['result']['forEach'](function(_0x4c6594){if(_0x4c6594['inactive']===_0x279b('0xaa')){var _0xf7fb88={'name':_0x4c6594[_0x279b('0xac')],'value':_0x4c6594['value']};_0x92dccb[_0x279b('0x9f')](_0xf7fb88);}});}_0x3e28bc[_0x279b('0x3f')]=_0x92dccb;if(_0x3e28bc[_0x279b('0x3f')][_0x279b('0x4b')]>0x0){_0x28e577(_0x3e28bc);}else{if(_0x1329a8==![]){_0x28e577();}else{_0x28e577(_0x3e28bc);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f85e12e..2cc2986 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['api','moment','bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x1cb9,0x14e));var _0x91cb=function(_0x586d3a,_0x517a94){_0x586d3a=_0x586d3a-0x0;var _0x8b912=_0x1cb9[_0x586d3a];return _0x8b912;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));var integrations=require(_0x91cb('0x8'));module[_0x91cb('0x9')]=function(_0x28543e,_0x3b9d98){return _0x28543e[_0x91cb('0xa')]('ServicenowAccount',attributes,{'tableName':_0x91cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x436c0f,_0xdb44a9){var _0x4bf1da=function(_0x30b973){while(--_0x30b973){_0x436c0f['push'](_0x436c0f['shift']());}};_0x4bf1da(++_0xdb44a9);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x10a8d8,_0x28f292){_0x10a8d8=_0x10a8d8-0x0;var _0x3b2b79=_0xfdbd[_0x10a8d8];return _0x3b2b79;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 0db8d88..2991b6f 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f19=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowServicenowAccount','find'];(function(_0x102b3a,_0x1fcc1d){var _0x2b27ec=function(_0x52557f){while(--_0x52557f){_0x102b3a['push'](_0x102b3a['shift']());}};_0x2b27ec(++_0x1fcc1d);}(_0x0f19,0x120));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90f1('0x0'));var BPromise=require(_0x90f1('0x1'));var rs=require(_0x90f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90f1('0x3'))['db'];var utils=require(_0x90f1('0x4'));var logger=require(_0x90f1('0x5'))(_0x90f1('0x6'));var config=require('../../config/environment');var jayson=require(_0x90f1('0x7'));var client=jayson[_0x90f1('0x8')][_0x90f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x107eca,_0x3221f2,_0x3b5396){return new BPromise(function(_0x71e5df,_0x59a30d){return client[_0x90f1('0xa')](_0x107eca,_0x3b5396)['then'](function(_0x59a8ff){logger['info'](_0x90f1('0xb'),_0x3221f2,_0x90f1('0xc'));logger[_0x90f1('0xd')](_0x90f1('0xe'),_0x3221f2,_0x90f1('0xc'),JSON[_0x90f1('0xf')](_0x59a8ff));if(_0x59a8ff[_0x90f1('0x10')]){if(_0x59a8ff[_0x90f1('0x10')][_0x90f1('0x11')]===0x1f4){logger[_0x90f1('0x10')](_0x90f1('0xb'),_0x3221f2,_0x59a8ff[_0x90f1('0x10')]['message']);return _0x59a30d(_0x59a8ff[_0x90f1('0x10')]['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3221f2,_0x59a8ff['error'][_0x90f1('0x12')]);return _0x71e5df(_0x59a8ff['error'][_0x90f1('0x12')]);}else{logger[_0x90f1('0x13')](_0x90f1('0xb'),_0x3221f2,'request\x20sent');_0x71e5df(_0x59a8ff[_0x90f1('0x14')][_0x90f1('0x12')]);}})[_0x90f1('0x15')](function(_0x443fb2){logger['error'](_0x90f1('0xb'),_0x3221f2,_0x443fb2);_0x59a30d(_0x443fb2);});});}exports[_0x90f1('0x16')]=function(_0x436302){var _0x33ffb7=this;return new Promise(function(_0x34df39,_0x4e524b){return db[_0x90f1('0x17')][_0x90f1('0x18')]({'raw':_0x436302[_0x90f1('0x19')]?_0x436302[_0x90f1('0x19')][_0x90f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x436302['options']?_0x436302[_0x90f1('0x19')][_0x90f1('0x1b')]||null:null,'attributes':_0x436302[_0x90f1('0x19')]?_0x436302[_0x90f1('0x19')]['attributes']||null:null,'limit':_0x436302['options']?_0x436302['options'][_0x90f1('0x1c')]||null:null,'include':_0x436302[_0x90f1('0x19')]?_0x436302[_0x90f1('0x19')][_0x90f1('0x1d')]?_[_0x90f1('0x1e')](_0x436302[_0x90f1('0x19')][_0x90f1('0x1d')],function(_0xbd3a40){return{'model':db[_0xbd3a40['model']],'as':_0xbd3a40['as'],'attributes':_0xbd3a40['attributes'],'include':_0xbd3a40[_0x90f1('0x1d')]?_['map'](_0xbd3a40[_0x90f1('0x1d')],function(_0x40b5fa){return{'model':db[_0x40b5fa[_0x90f1('0x1f')]],'as':_0x40b5fa['as'],'attributes':_0x40b5fa['attributes'],'include':_0x40b5fa['include']?_[_0x90f1('0x1e')](_0x40b5fa[_0x90f1('0x1d')],function(_0x56635a){return{'model':db[_0x56635a[_0x90f1('0x1f')]],'as':_0x56635a['as'],'attributes':_0x56635a[_0x90f1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x90f1('0x21')](function(_0x235589){logger[_0x90f1('0x13')](_0x90f1('0x16'),_0x436302);logger[_0x90f1('0xd')](_0x90f1('0x16'),_0x436302,JSON[_0x90f1('0xf')](_0x235589));_0x34df39(_0x235589);})[_0x90f1('0x15')](function(_0x5dcedc){logger['error']('GetServicenowAccount',_0x5dcedc['message'],_0x436302);_0x4e524b(_0x33ffb7['error'](0x1f4,_0x5dcedc[_0x90f1('0x12')]));});});};exports[_0x90f1('0x22')]=function(_0xf2e16){var _0x5b0f7b=this;return new Promise(function(_0x565b9d,_0x10996b){return db['ServicenowAccount'][_0x90f1('0x23')]({'raw':_0xf2e16['options']?_0xf2e16[_0x90f1('0x19')][_0x90f1('0x1a')]===undefined?!![]:![]:!![],'where':_0xf2e16[_0x90f1('0x19')]?_0xf2e16['options'][_0x90f1('0x1b')]||null:null,'attributes':_0xf2e16[_0x90f1('0x19')]?_0xf2e16[_0x90f1('0x19')][_0x90f1('0x20')]||null:null,'include':_0xf2e16[_0x90f1('0x19')]?_0xf2e16[_0x90f1('0x19')][_0x90f1('0x1d')]?_[_0x90f1('0x1e')](_0xf2e16['options'][_0x90f1('0x1d')],function(_0x38f485){return{'model':db[_0x38f485[_0x90f1('0x1f')]],'as':_0x38f485['as'],'attributes':_0x38f485[_0x90f1('0x20')],'include':_0x38f485[_0x90f1('0x1d')]?_[_0x90f1('0x1e')](_0x38f485[_0x90f1('0x1d')],function(_0x537f13){return{'model':db[_0x537f13[_0x90f1('0x1f')]],'as':_0x537f13['as'],'attributes':_0x537f13[_0x90f1('0x20')],'include':_0x537f13[_0x90f1('0x1d')]?_[_0x90f1('0x1e')](_0x537f13['include'],function(_0x27b7d4){return{'model':db[_0x27b7d4['model']],'as':_0x27b7d4['as'],'attributes':_0x27b7d4[_0x90f1('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b15e8){logger[_0x90f1('0x13')](_0x90f1('0x22'),_0xf2e16);logger[_0x90f1('0xd')](_0x90f1('0x22'),_0xf2e16,JSON[_0x90f1('0xf')](_0x1b15e8));_0x565b9d(_0x1b15e8);})['catch'](function(_0x4245ba){logger['error'](_0x90f1('0x22'),_0x4245ba[_0x90f1('0x12')],_0xf2e16);_0x10996b(_0x5b0f7b[_0x90f1('0x10')](0x1f4,_0x4245ba['message']));});});}; \ No newline at end of file +var _0xc831=['message','info','catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes','include','map','model','ShowServicenowAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4dfd8a,_0x476a02){var _0x5aeac9=function(_0x3aa276){while(--_0x3aa276){_0x4dfd8a['push'](_0x4dfd8a['shift']());}};_0x5aeac9(++_0x476a02);}(_0xc831,0x69));var _0x1c83=function(_0x4d8432,_0x1993f9){_0x4d8432=_0x4d8432-0x0;var _0x373991=_0xc831[_0x4d8432];return _0x373991;};'use strict';var _=require(_0x1c83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1c83('0x1'));var rs=require(_0x1c83('0x2'));var fs=require('fs');var Redis=require(_0x1c83('0x3'));var db=require(_0x1c83('0x4'))['db'];var utils=require(_0x1c83('0x5'));var logger=require(_0x1c83('0x6'))(_0x1c83('0x7'));var config=require('../../config/environment');var jayson=require(_0x1c83('0x8'));var client=jayson[_0x1c83('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3485c8,_0x94f986,_0x3ece6f){return new BPromise(function(_0x32ef33,_0x27720a){return client[_0x1c83('0xa')](_0x3485c8,_0x3ece6f)[_0x1c83('0xb')](function(_0x26b580){logger['info'](_0x1c83('0xc'),_0x94f986,_0x1c83('0xd'));logger[_0x1c83('0xe')](_0x1c83('0xf'),_0x94f986,_0x1c83('0xd'),JSON[_0x1c83('0x10')](_0x26b580));if(_0x26b580['error']){if(_0x26b580[_0x1c83('0x11')][_0x1c83('0x12')]===0x1f4){logger[_0x1c83('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x94f986,_0x26b580[_0x1c83('0x11')][_0x1c83('0x13')]);return _0x27720a(_0x26b580[_0x1c83('0x11')][_0x1c83('0x13')]);}logger[_0x1c83('0x11')](_0x1c83('0xc'),_0x94f986,_0x26b580['error'][_0x1c83('0x13')]);return _0x32ef33(_0x26b580['error']['message']);}else{logger[_0x1c83('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x94f986,_0x1c83('0xd'));_0x32ef33(_0x26b580['result'][_0x1c83('0x13')]);}})[_0x1c83('0x15')](function(_0x43030e){logger[_0x1c83('0x11')](_0x1c83('0xc'),_0x94f986,_0x43030e);_0x27720a(_0x43030e);});});}exports[_0x1c83('0x16')]=function(_0x15c769){var _0x296f42=this;return new Promise(function(_0x1276c6,_0x152de3){return db[_0x1c83('0x17')]['findAll']({'raw':_0x15c769['options']?_0x15c769[_0x1c83('0x18')][_0x1c83('0x19')]===undefined?!![]:![]:!![],'where':_0x15c769[_0x1c83('0x18')]?_0x15c769[_0x1c83('0x18')]['where']||null:null,'attributes':_0x15c769[_0x1c83('0x18')]?_0x15c769[_0x1c83('0x18')][_0x1c83('0x1a')]||null:null,'limit':_0x15c769[_0x1c83('0x18')]?_0x15c769[_0x1c83('0x18')]['limit']||null:null,'include':_0x15c769[_0x1c83('0x18')]?_0x15c769[_0x1c83('0x18')][_0x1c83('0x1b')]?_[_0x1c83('0x1c')](_0x15c769[_0x1c83('0x18')]['include'],function(_0x4ee822){return{'model':db[_0x4ee822[_0x1c83('0x1d')]],'as':_0x4ee822['as'],'attributes':_0x4ee822[_0x1c83('0x1a')],'include':_0x4ee822[_0x1c83('0x1b')]?_[_0x1c83('0x1c')](_0x4ee822[_0x1c83('0x1b')],function(_0x42fbd9){return{'model':db[_0x42fbd9[_0x1c83('0x1d')]],'as':_0x42fbd9['as'],'attributes':_0x42fbd9[_0x1c83('0x1a')],'include':_0x42fbd9[_0x1c83('0x1b')]?_[_0x1c83('0x1c')](_0x42fbd9[_0x1c83('0x1b')],function(_0x558a08){return{'model':db[_0x558a08['model']],'as':_0x558a08['as'],'attributes':_0x558a08[_0x1c83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1c83('0xb')](function(_0x5d8647){logger[_0x1c83('0x14')](_0x1c83('0x16'),_0x15c769);logger['debug'](_0x1c83('0x16'),_0x15c769,JSON[_0x1c83('0x10')](_0x5d8647));_0x1276c6(_0x5d8647);})[_0x1c83('0x15')](function(_0x594167){logger[_0x1c83('0x11')]('GetServicenowAccount',_0x594167['message'],_0x15c769);_0x152de3(_0x296f42['error'](0x1f4,_0x594167[_0x1c83('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x2d8c47){var _0x12c28a=this;return new Promise(function(_0x8ed482,_0x56d9f1){return db['ServicenowAccount']['find']({'raw':_0x2d8c47[_0x1c83('0x18')]?_0x2d8c47[_0x1c83('0x18')][_0x1c83('0x19')]===undefined?!![]:![]:!![],'where':_0x2d8c47['options']?_0x2d8c47[_0x1c83('0x18')]['where']||null:null,'attributes':_0x2d8c47[_0x1c83('0x18')]?_0x2d8c47[_0x1c83('0x18')][_0x1c83('0x1a')]||null:null,'include':_0x2d8c47[_0x1c83('0x18')]?_0x2d8c47['options'][_0x1c83('0x1b')]?_['map'](_0x2d8c47[_0x1c83('0x18')][_0x1c83('0x1b')],function(_0x43102a){return{'model':db[_0x43102a['model']],'as':_0x43102a['as'],'attributes':_0x43102a[_0x1c83('0x1a')],'include':_0x43102a['include']?_['map'](_0x43102a[_0x1c83('0x1b')],function(_0x1614f0){return{'model':db[_0x1614f0[_0x1c83('0x1d')]],'as':_0x1614f0['as'],'attributes':_0x1614f0[_0x1c83('0x1a')],'include':_0x1614f0[_0x1c83('0x1b')]?_[_0x1c83('0x1c')](_0x1614f0[_0x1c83('0x1b')],function(_0x11e71e){return{'model':db[_0x11e71e[_0x1c83('0x1d')]],'as':_0x11e71e['as'],'attributes':_0x11e71e[_0x1c83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1c83('0xb')](function(_0x142f44){logger['info']('ShowServicenowAccount',_0x2d8c47);logger[_0x1c83('0xe')](_0x1c83('0x1e'),_0x2d8c47,JSON['stringify'](_0x142f44));_0x8ed482(_0x142f44);})[_0x1c83('0x15')](function(_0x2f80b2){logger[_0x1c83('0x11')](_0x1c83('0x1e'),_0x2f80b2[_0x1c83('0x13')],_0x2d8c47);_0x56d9f1(_0x12c28a[_0x1c83('0x11')](0x1f4,_0x2f80b2[_0x1c83('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ec64dc5..a8e9bcb 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dbf=['update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x50ec12,_0x65c69a){var _0xba337d=function(_0x15435b){while(--_0x15435b){_0x50ec12['push'](_0x50ec12['shift']());}};_0xba337d(++_0x65c69a);}(_0x6dbf,0x100));var _0xf6db=function(_0x5dd451,_0xeae007){_0x5dd451=_0x5dd451-0x0;var _0xca1f8a=_0x6dbf[_0x5dd451];return _0xca1f8a;};'use strict';var multer=require('multer');var util=require(_0xf6db('0x0'));var path=require(_0xf6db('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6db('0x2'));var router=express[_0xf6db('0x3')]();var fs_extra=require(_0xf6db('0x4'));var auth=require(_0xf6db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf6db('0x6'));var controller=require(_0xf6db('0x7'));router['get']('/',auth[_0xf6db('0x8')](),controller[_0xf6db('0x9')]);router[_0xf6db('0xa')]('/:id',auth[_0xf6db('0x8')](),controller[_0xf6db('0xb')]);router[_0xf6db('0xa')]('/:id/fields',auth[_0xf6db('0x8')](),controller['getFields']);router[_0xf6db('0xa')](_0xf6db('0xc'),auth['isAuthenticated'](),controller[_0xf6db('0xd')]);router[_0xf6db('0xa')](_0xf6db('0xe'),auth[_0xf6db('0x8')](),controller[_0xf6db('0xf')]);router[_0xf6db('0x10')]('/',auth[_0xf6db('0x8')](),controller[_0xf6db('0x11')]);router[_0xf6db('0x12')](_0xf6db('0x13'),auth[_0xf6db('0x8')](),controller[_0xf6db('0x14')]);router[_0xf6db('0x15')](_0xf6db('0x13'),auth[_0xf6db('0x8')](),controller[_0xf6db('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb71c=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','show'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xb71c,0xf0));var _0xcb71=function(_0x4c758b,_0x5c5d87){_0x4c758b=_0x4c758b-0x0;var _0x3ca9fd=_0xb71c[_0x4c758b];return _0x3ca9fd;};'use strict';var multer=require(_0xcb71('0x0'));var util=require(_0xcb71('0x1'));var path=require(_0xcb71('0x2'));var timeout=require(_0xcb71('0x3'));var express=require('express');var router=express[_0xcb71('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb71('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcb71('0x6'));var controller=require(_0xcb71('0x7'));router['get']('/',auth[_0xcb71('0x8')](),controller['index']);router[_0xcb71('0x9')](_0xcb71('0xa'),auth[_0xcb71('0x8')](),controller[_0xcb71('0xb')]);router[_0xcb71('0x9')](_0xcb71('0xc'),auth['isAuthenticated'](),controller[_0xcb71('0xd')]);router[_0xcb71('0x9')]('/:id/subjects',auth[_0xcb71('0x8')](),controller[_0xcb71('0xe')]);router[_0xcb71('0x9')](_0xcb71('0xf'),auth[_0xcb71('0x8')](),controller[_0xcb71('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcb71('0x11')]('/:id',auth[_0xcb71('0x8')](),controller[_0xcb71('0x12')]);router[_0xcb71('0x13')](_0xcb71('0xa'),auth[_0xcb71('0x8')](),controller[_0xcb71('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5464e53..353dec8 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x311f=['sequelize','exports','STRING'];(function(_0x5a7a07,_0x4baa01){var _0x41bee8=function(_0x2ce2d5){while(--_0x2ce2d5){_0x5a7a07['push'](_0x5a7a07['shift']());}};_0x41bee8(++_0x4baa01);}(_0x311f,0xe7));var _0xf311=function(_0x27efcf,_0x320952){_0x27efcf=_0x27efcf-0x0;var _0xdb0237=_0x311f[_0x27efcf];return _0xdb0237;};'use strict';var Sequelize=require(_0xf311('0x0'));module[_0xf311('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf311('0x2')]}}; \ No newline at end of file +var _0x432e=['exports','STRING'];(function(_0x1198a3,_0x53b74e){var _0x496217=function(_0x1e17d7){while(--_0x1e17d7){_0x1198a3['push'](_0x1198a3['shift']());}};_0x496217(++_0x53b74e);}(_0x432e,0x1de));var _0xe432=function(_0x2065d1,_0x46dbae){_0x2065d1=_0x2065d1-0x0;var _0x2fb8d1=_0x432e[_0x2065d1];return _0x2fb8d1;};'use strict';var Sequelize=require('sequelize');module[_0xe432('0x0')]={'name':{'type':Sequelize[_0xe432('0x1')]},'description':{'type':Sequelize[_0xe432('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 22c3bdb..f8e15bb 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10b3=['end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','update','find','findOne','getFields','getSubjects','ServicenowField','options','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1603f8,_0x8985ee){var _0x4bafb3=function(_0x1c278f){while(--_0x1c278f){_0x1603f8['push'](_0x1603f8['shift']());}};_0x4bafb3(++_0x8985ee);}(_0x10b3,0xdb));var _0x310b=function(_0x56b4d7,_0x43ebdb){_0x56b4d7=_0x56b4d7-0x0;var _0x3e0d3d=_0x10b3[_0x56b4d7];return _0x3e0d3d;};'use strict';var emlformat=require(_0x310b('0x0'));var rimraf=require(_0x310b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x310b('0x2'));var rp=require(_0x310b('0x3'));var moment=require('moment');var BPromise=require(_0x310b('0x4'));var Mustache=require(_0x310b('0x5'));var util=require(_0x310b('0x6'));var path=require(_0x310b('0x7'));var sox=require('sox');var csv=require(_0x310b('0x8'));var ejs=require(_0x310b('0x9'));var fs=require('fs');var fs_extra=require(_0x310b('0xa'));var _=require(_0x310b('0xb'));var squel=require(_0x310b('0xc'));var crypto=require('crypto');var jsforce=require(_0x310b('0xd'));var deskjs=require(_0x310b('0xe'));var toCsv=require(_0x310b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x310b('0xf'));var authService=require(_0x310b('0x10'));var qs=require(_0x310b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x310b('0x12'));var logger=require(_0x310b('0x13'))(_0x310b('0x14'));var utils=require(_0x310b('0x15'));var config=require(_0x310b('0x16'));var licenseUtil=require(_0x310b('0x17'));var db=require(_0x310b('0x18'))['db'];function respondWithStatusCode(_0x46b77d,_0x391f21){_0x391f21=_0x391f21||0xcc;return function(_0xc71eaf){if(_0xc71eaf){return _0x46b77d[_0x310b('0x19')](_0x391f21);}return _0x46b77d[_0x310b('0x1a')](_0x391f21)[_0x310b('0x1b')]();};}function respondWithResult(_0x4fa1ac,_0x1563a9){_0x1563a9=_0x1563a9||0xc8;return function(_0x30040a){if(_0x30040a){return _0x4fa1ac['status'](_0x1563a9)[_0x310b('0x1c')](_0x30040a);}};}function respondWithFilteredResult(_0x5aff8a,_0x34e1f3){return function(_0x40b297){if(_0x40b297){var _0xfa6151=typeof _0x34e1f3['offset']==='undefined'&&typeof _0x34e1f3[_0x310b('0x1d')]===_0x310b('0x1e');var _0x19a527=_0x40b297['count'];var _0x34ac08=_0xfa6151?0x0:_0x34e1f3['offset'];var _0x4adffa=_0xfa6151?_0x40b297[_0x310b('0x1f')]:_0x34e1f3[_0x310b('0x20')]+_0x34e1f3[_0x310b('0x1d')];var _0x547807;if(_0x4adffa>=_0x19a527){_0x4adffa=_0x19a527;_0x547807=0xc8;}else{_0x547807=0xce;}_0x5aff8a[_0x310b('0x1a')](_0x547807);return _0x5aff8a[_0x310b('0x21')](_0x310b('0x22'),_0x34ac08+'-'+_0x4adffa+'/'+_0x19a527)['json'](_0x40b297);}return null;};}function patchUpdates(_0x2d222c){return function(_0xfabe2f){try{jsonpatch[_0x310b('0x23')](_0xfabe2f,_0x2d222c,!![]);}catch(_0x245911){return BPromise[_0x310b('0x24')](_0x245911);}return _0xfabe2f['save']();};}function saveUpdates(_0x1afc70,_0x408b18){return function(_0x387ee3){if(_0x387ee3){return _0x387ee3['update'](_0x1afc70)[_0x310b('0x25')](function(_0x126541){return _0x126541;});}return null;};}function removeEntity(_0x590f6a,_0x24acb1){return function(_0x4e0bc1){if(_0x4e0bc1){return _0x4e0bc1[_0x310b('0x26')]()[_0x310b('0x25')](function(){_0x590f6a[_0x310b('0x1a')](0xcc)[_0x310b('0x1b')]();});}};}function handleEntityNotFound(_0x4b5321,_0x2f1cdf){return function(_0x1391bc){if(!_0x1391bc){_0x4b5321[_0x310b('0x19')](0x194);}return _0x1391bc;};}function handleError(_0x176f97,_0x535e06){_0x535e06=_0x535e06||0x1f4;return function(_0xd9d09c){logger['error'](_0xd9d09c[_0x310b('0x27')]);if(_0xd9d09c[_0x310b('0x28')]){delete _0xd9d09c['name'];}_0x176f97[_0x310b('0x1a')](_0x535e06)[_0x310b('0x29')](_0xd9d09c);};}exports[_0x310b('0x2a')]=function(_0x19c23b,_0x277526){var _0x4c6426={},_0x1fe586={},_0x45e8a9={'count':0x0,'rows':[]};var _0x224827=_[_0x310b('0x2b')](db['ServicenowConfiguration'][_0x310b('0x2c')],function(_0x3cbc9b){return{'name':_0x3cbc9b['fieldName'],'type':_0x3cbc9b[_0x310b('0x2d')][_0x310b('0x2e')]};});_0x1fe586[_0x310b('0x2f')]=_['map'](_0x224827,_0x310b('0x28'));_0x1fe586[_0x310b('0x30')]=_[_0x310b('0x31')](_0x19c23b[_0x310b('0x30')]);_0x1fe586[_0x310b('0x32')]=_['intersection'](_0x1fe586['model'],_0x1fe586['query']);_0x4c6426['attributes']=_['intersection'](_0x1fe586[_0x310b('0x2f')],qs[_0x310b('0x33')](_0x19c23b[_0x310b('0x30')]['fields']));_0x4c6426[_0x310b('0x34')]=_0x4c6426[_0x310b('0x34')][_0x310b('0x35')]?_0x4c6426[_0x310b('0x34')]:_0x1fe586[_0x310b('0x2f')];if(!_0x19c23b[_0x310b('0x30')][_0x310b('0x36')](_0x310b('0x37'))){_0x4c6426[_0x310b('0x1d')]=qs[_0x310b('0x1d')](_0x19c23b[_0x310b('0x30')][_0x310b('0x1d')]);_0x4c6426[_0x310b('0x20')]=qs[_0x310b('0x20')](_0x19c23b[_0x310b('0x30')][_0x310b('0x20')]);}_0x4c6426[_0x310b('0x38')]=qs[_0x310b('0x39')](_0x19c23b[_0x310b('0x30')]['sort']);_0x4c6426[_0x310b('0x3a')]=qs[_0x310b('0x32')](_[_0x310b('0x3b')](_0x19c23b[_0x310b('0x30')],_0x1fe586['filters']),_0x224827);if(_0x19c23b[_0x310b('0x30')][_0x310b('0x3c')]){_0x4c6426[_0x310b('0x3a')]=_['merge'](_0x4c6426[_0x310b('0x3a')],{'$or':_['map'](_0x224827,function(_0xb25b5d){if(_0xb25b5d[_0x310b('0x2d')]!==_0x310b('0x3d')){var _0x5a4251={};_0x5a4251[_0xb25b5d['name']]={'$like':'%'+_0x19c23b[_0x310b('0x30')][_0x310b('0x3c')]+'%'};return _0x5a4251;}})});}_0x4c6426=_[_0x310b('0x3e')]({},_0x4c6426,_0x19c23b['options']);var _0x39c789={'where':_0x4c6426[_0x310b('0x3a')]};return db[_0x310b('0x3f')][_0x310b('0x1f')](_0x39c789)[_0x310b('0x25')](function(_0x5d9d8e){_0x45e8a9['count']=_0x5d9d8e;if(_0x19c23b[_0x310b('0x30')][_0x310b('0x40')]){_0x4c6426[_0x310b('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x310b('0x42')](_0x4c6426);})[_0x310b('0x25')](function(_0x52c20b){_0x45e8a9[_0x310b('0x43')]=_0x52c20b;return _0x45e8a9;})[_0x310b('0x25')](respondWithFilteredResult(_0x277526,_0x4c6426))[_0x310b('0x44')](handleError(_0x277526,null));};exports[_0x310b('0x45')]=function(_0x54dbf5,_0x327a98){var _0x1c78d2={'raw':![],'where':{'id':_0x54dbf5[_0x310b('0x46')]['id']}},_0x23e881={};_0x23e881[_0x310b('0x2f')]=_[_0x310b('0x31')](db[_0x310b('0x3f')][_0x310b('0x2c')]);_0x23e881[_0x310b('0x30')]=_[_0x310b('0x31')](_0x54dbf5[_0x310b('0x30')]);_0x23e881[_0x310b('0x32')]=_['intersection'](_0x23e881[_0x310b('0x2f')],_0x23e881[_0x310b('0x30')]);_0x1c78d2[_0x310b('0x34')]=_[_0x310b('0x47')](_0x23e881[_0x310b('0x2f')],qs['fields'](_0x54dbf5[_0x310b('0x30')][_0x310b('0x33')]));_0x1c78d2[_0x310b('0x34')]=_0x1c78d2['attributes'][_0x310b('0x35')]?_0x1c78d2[_0x310b('0x34')]:_0x23e881['model'];if(_0x54dbf5[_0x310b('0x30')][_0x310b('0x40')]){_0x1c78d2[_0x310b('0x41')]=[{'all':!![]}];}_0x1c78d2=_[_0x310b('0x3e')]({},_0x1c78d2,_0x54dbf5['options']);return db['ServicenowConfiguration']['find'](_0x1c78d2)[_0x310b('0x25')](handleEntityNotFound(_0x327a98,null))[_0x310b('0x25')](respondWithResult(_0x327a98,null))[_0x310b('0x44')](handleError(_0x327a98,null));};exports[_0x310b('0x48')]=function(_0x433ad7,_0x543e3c){return db[_0x310b('0x3f')][_0x310b('0x48')](_0x433ad7[_0x310b('0x49')],{})[_0x310b('0x25')](respondWithResult(_0x543e3c,0xc9))[_0x310b('0x44')](handleError(_0x543e3c,null));};exports[_0x310b('0x4a')]=function(_0x31a2c3,_0x83f47e){if(_0x31a2c3[_0x310b('0x49')]['id']){delete _0x31a2c3[_0x310b('0x49')]['id'];}return db[_0x310b('0x3f')][_0x310b('0x4b')]({'where':{'id':_0x31a2c3[_0x310b('0x46')]['id']}})[_0x310b('0x25')](handleEntityNotFound(_0x83f47e,null))[_0x310b('0x25')](saveUpdates(_0x31a2c3[_0x310b('0x49')],null))['then'](respondWithResult(_0x83f47e,null))[_0x310b('0x44')](handleError(_0x83f47e,null));};exports[_0x310b('0x26')]=function(_0x435c2e,_0x2897a3){return db[_0x310b('0x3f')][_0x310b('0x4b')]({'where':{'id':_0x435c2e[_0x310b('0x46')]['id']}})[_0x310b('0x25')](handleEntityNotFound(_0x2897a3,null))[_0x310b('0x25')](removeEntity(_0x2897a3,null))[_0x310b('0x44')](handleError(_0x2897a3,null));};exports['getFields']=function(_0x57c05c,_0x5e1c98,_0xf2da81){var _0x7ef425={};var _0xb6cd4e={};var _0xb1b64b;var _0x444558;return db['ServicenowConfiguration'][_0x310b('0x4c')]({'where':{'id':_0x57c05c['params']['id']}})[_0x310b('0x25')](handleEntityNotFound(_0x5e1c98,null))[_0x310b('0x25')](function(_0x5274f7){if(_0x5274f7){_0xb1b64b=_0x5274f7;_0xb6cd4e[_0x310b('0x2f')]=_[_0x310b('0x31')](db['ServicenowField']['rawAttributes']);_0xb6cd4e[_0x310b('0x30')]=_[_0x310b('0x31')](_0x57c05c[_0x310b('0x30')]);_0xb6cd4e[_0x310b('0x32')]=_[_0x310b('0x47')](_0xb6cd4e['model'],_0xb6cd4e[_0x310b('0x30')]);_0x7ef425[_0x310b('0x34')]=_[_0x310b('0x47')](_0xb6cd4e[_0x310b('0x2f')],qs[_0x310b('0x33')](_0x57c05c[_0x310b('0x30')][_0x310b('0x33')]));_0x7ef425['attributes']=_0x7ef425[_0x310b('0x34')]['length']?_0x7ef425['attributes']:_0xb6cd4e[_0x310b('0x2f')];_0x7ef425[_0x310b('0x38')]=qs[_0x310b('0x39')](_0x57c05c[_0x310b('0x30')]['sort']);_0x7ef425[_0x310b('0x3a')]=qs[_0x310b('0x32')](_[_0x310b('0x3b')](_0x57c05c['query'],_0xb6cd4e['filters']));if(_0x57c05c['query'][_0x310b('0x3c')]){_0x7ef425[_0x310b('0x3a')]=_[_0x310b('0x3e')](_0x7ef425[_0x310b('0x3a')],{'$or':_[_0x310b('0x2b')](_0x7ef425[_0x310b('0x34')],function(_0xfd052b){var _0x4201de={};_0x4201de[_0xfd052b]={'$like':'%'+_0x57c05c[_0x310b('0x30')][_0x310b('0x3c')]+'%'};return _0x4201de;})});}_0x7ef425=_['merge']({},_0x7ef425,_0x57c05c['options']);return _0xb1b64b[_0x310b('0x4d')](_0x7ef425);}})[_0x310b('0x25')](function(_0x24793e){if(_0x24793e){_0x444558=_0x24793e[_0x310b('0x35')];if(!_0x57c05c['query'][_0x310b('0x36')]('nolimit')){_0x7ef425[_0x310b('0x1d')]=qs[_0x310b('0x1d')](_0x57c05c[_0x310b('0x30')][_0x310b('0x1d')]);_0x7ef425[_0x310b('0x20')]=qs[_0x310b('0x20')](_0x57c05c[_0x310b('0x30')]['offset']);}return _0xb1b64b[_0x310b('0x4d')](_0x7ef425);}})['then'](function(_0x26f787){if(_0x26f787){return _0x26f787?{'count':_0x444558,'rows':_0x26f787}:null;}})['then'](respondWithResult(_0x5e1c98,null))[_0x310b('0x44')](handleError(_0x5e1c98,null));};exports[_0x310b('0x4e')]=function(_0x44e37c,_0x59c15a,_0x586b0b){var _0x22de8c={};var _0xd0b521={};var _0x1d18ad;var _0x2cbcab;return db[_0x310b('0x3f')][_0x310b('0x4c')]({'where':{'id':_0x44e37c[_0x310b('0x46')]['id']}})[_0x310b('0x25')](handleEntityNotFound(_0x59c15a,null))[_0x310b('0x25')](function(_0xe3fcb4){if(_0xe3fcb4){_0x1d18ad=_0xe3fcb4;_0xd0b521[_0x310b('0x2f')]=_[_0x310b('0x31')](db[_0x310b('0x4f')]['rawAttributes']);_0xd0b521['query']=_[_0x310b('0x31')](_0x44e37c[_0x310b('0x30')]);_0xd0b521[_0x310b('0x32')]=_[_0x310b('0x47')](_0xd0b521[_0x310b('0x2f')],_0xd0b521[_0x310b('0x30')]);_0x22de8c['attributes']=_['intersection'](_0xd0b521[_0x310b('0x2f')],qs[_0x310b('0x33')](_0x44e37c[_0x310b('0x30')]['fields']));_0x22de8c[_0x310b('0x34')]=_0x22de8c[_0x310b('0x34')][_0x310b('0x35')]?_0x22de8c['attributes']:_0xd0b521['model'];_0x22de8c['order']=qs[_0x310b('0x39')](_0x44e37c[_0x310b('0x30')][_0x310b('0x39')]);_0x22de8c[_0x310b('0x3a')]=qs[_0x310b('0x32')](_['pick'](_0x44e37c[_0x310b('0x30')],_0xd0b521[_0x310b('0x32')]));if(_0x44e37c[_0x310b('0x30')]['filter']){_0x22de8c['where']=_[_0x310b('0x3e')](_0x22de8c[_0x310b('0x3a')],{'$or':_[_0x310b('0x2b')](_0x22de8c[_0x310b('0x34')],function(_0x2cd3bf){var _0x478f9b={};_0x478f9b[_0x2cd3bf]={'$like':'%'+_0x44e37c[_0x310b('0x30')][_0x310b('0x3c')]+'%'};return _0x478f9b;})});}_0x22de8c=_['merge']({},_0x22de8c,_0x44e37c[_0x310b('0x50')]);return _0x1d18ad['getSubjects'](_0x22de8c);}})[_0x310b('0x25')](function(_0x1da2de){if(_0x1da2de){_0x2cbcab=_0x1da2de[_0x310b('0x35')];if(!_0x44e37c[_0x310b('0x30')][_0x310b('0x36')](_0x310b('0x37'))){_0x22de8c['limit']=qs['limit'](_0x44e37c[_0x310b('0x30')]['limit']);_0x22de8c[_0x310b('0x20')]=qs[_0x310b('0x20')](_0x44e37c[_0x310b('0x30')]['offset']);}return _0x1d18ad['getSubjects'](_0x22de8c);}})[_0x310b('0x25')](function(_0x5bb08e){if(_0x5bb08e){return _0x5bb08e?{'count':_0x2cbcab,'rows':_0x5bb08e}:null;}})['then'](respondWithResult(_0x59c15a,null))[_0x310b('0x44')](handleError(_0x59c15a,null));};exports[_0x310b('0x51')]=function(_0x5838b9,_0x2d6bae,_0xa50393){var _0x70f8b={};var _0x1c7ae3={};var _0x4fe904;var _0x31deb3;return db[_0x310b('0x3f')][_0x310b('0x4c')]({'where':{'id':_0x5838b9[_0x310b('0x46')]['id']}})[_0x310b('0x25')](handleEntityNotFound(_0x2d6bae,null))['then'](function(_0x3d18b8){if(_0x3d18b8){_0x4fe904=_0x3d18b8;_0x1c7ae3[_0x310b('0x2f')]=_[_0x310b('0x31')](db[_0x310b('0x4f')]['rawAttributes']);_0x1c7ae3[_0x310b('0x30')]=_[_0x310b('0x31')](_0x5838b9['query']);_0x1c7ae3[_0x310b('0x32')]=_[_0x310b('0x47')](_0x1c7ae3[_0x310b('0x2f')],_0x1c7ae3[_0x310b('0x30')]);_0x70f8b['attributes']=_[_0x310b('0x47')](_0x1c7ae3['model'],qs[_0x310b('0x33')](_0x5838b9[_0x310b('0x30')][_0x310b('0x33')]));_0x70f8b['attributes']=_0x70f8b[_0x310b('0x34')][_0x310b('0x35')]?_0x70f8b[_0x310b('0x34')]:_0x1c7ae3[_0x310b('0x2f')];_0x70f8b[_0x310b('0x38')]=qs[_0x310b('0x39')](_0x5838b9[_0x310b('0x30')][_0x310b('0x39')]);_0x70f8b[_0x310b('0x3a')]=qs['filters'](_[_0x310b('0x3b')](_0x5838b9[_0x310b('0x30')],_0x1c7ae3[_0x310b('0x32')]));if(_0x5838b9[_0x310b('0x30')]['filter']){_0x70f8b['where']=_['merge'](_0x70f8b[_0x310b('0x3a')],{'$or':_[_0x310b('0x2b')](_0x70f8b['attributes'],function(_0x2a2ab7){var _0x12e533={};_0x12e533[_0x2a2ab7]={'$like':'%'+_0x5838b9['query'][_0x310b('0x3c')]+'%'};return _0x12e533;})});}_0x70f8b=_[_0x310b('0x3e')]({},_0x70f8b,_0x5838b9[_0x310b('0x50')]);return _0x4fe904[_0x310b('0x51')](_0x70f8b);}})[_0x310b('0x25')](function(_0x16f509){if(_0x16f509){_0x31deb3=_0x16f509[_0x310b('0x35')];if(!_0x5838b9[_0x310b('0x30')][_0x310b('0x36')]('nolimit')){_0x70f8b['limit']=qs['limit'](_0x5838b9[_0x310b('0x30')][_0x310b('0x1d')]);_0x70f8b[_0x310b('0x20')]=qs[_0x310b('0x20')](_0x5838b9['query']['offset']);}return _0x4fe904[_0x310b('0x51')](_0x70f8b);}})[_0x310b('0x25')](function(_0x274b3a){if(_0x274b3a){return _0x274b3a?{'count':_0x31deb3,'rows':_0x274b3a}:null;}})[_0x310b('0x25')](respondWithResult(_0x2d6bae,null))['catch'](handleError(_0x2d6bae,null));}; \ No newline at end of file +var _0x29ff=['name','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','find','body','params','getFields','findOne','ServicenowField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','error'];(function(_0x3a1123,_0x27276b){var _0x4e5f33=function(_0x1685d4){while(--_0x1685d4){_0x3a1123['push'](_0x3a1123['shift']());}};_0x4e5f33(++_0x27276b);}(_0x29ff,0x15c));var _0xf29f=function(_0x182475,_0x59cc18){_0x182475=_0x182475-0x0;var _0x1a2ef6=_0x29ff[_0x182475];return _0x1a2ef6;};'use strict';var emlformat=require(_0xf29f('0x0'));var rimraf=require(_0xf29f('0x1'));var zipdir=require(_0xf29f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf29f('0x3'));var BPromise=require(_0xf29f('0x4'));var Mustache=require(_0xf29f('0x5'));var util=require('util');var path=require(_0xf29f('0x6'));var sox=require(_0xf29f('0x7'));var csv=require(_0xf29f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf29f('0x9'));var _=require(_0xf29f('0xa'));var squel=require(_0xf29f('0xb'));var crypto=require(_0xf29f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf29f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf29f('0xe'));var Papa=require(_0xf29f('0xf'));var Redis=require(_0xf29f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf29f('0x11'));var as=require(_0xf29f('0x12'));var hardwareService=require(_0xf29f('0x13'));var logger=require(_0xf29f('0x14'))(_0xf29f('0x15'));var utils=require(_0xf29f('0x16'));var config=require(_0xf29f('0x17'));var licenseUtil=require(_0xf29f('0x18'));var db=require(_0xf29f('0x19'))['db'];function respondWithStatusCode(_0x12cbb2,_0x630e83){_0x630e83=_0x630e83||0xcc;return function(_0x13a2ce){if(_0x13a2ce){return _0x12cbb2[_0xf29f('0x1a')](_0x630e83);}return _0x12cbb2[_0xf29f('0x1b')](_0x630e83)['end']();};}function respondWithResult(_0x22ac3c,_0x5d7316){_0x5d7316=_0x5d7316||0xc8;return function(_0x41018c){if(_0x41018c){return _0x22ac3c[_0xf29f('0x1b')](_0x5d7316)[_0xf29f('0x1c')](_0x41018c);}};}function respondWithFilteredResult(_0x506ea0,_0xee9053){return function(_0x62cf7f){if(_0x62cf7f){var _0x18e263=typeof _0xee9053[_0xf29f('0x1d')]==='undefined'&&typeof _0xee9053[_0xf29f('0x1e')]===_0xf29f('0x1f');var _0x564ad3=_0x62cf7f[_0xf29f('0x20')];var _0x8e6388=_0x18e263?0x0:_0xee9053['offset'];var _0x5bb69b=_0x18e263?_0x62cf7f[_0xf29f('0x20')]:_0xee9053[_0xf29f('0x1d')]+_0xee9053['limit'];var _0x1c82d9;if(_0x5bb69b>=_0x564ad3){_0x5bb69b=_0x564ad3;_0x1c82d9=0xc8;}else{_0x1c82d9=0xce;}_0x506ea0[_0xf29f('0x1b')](_0x1c82d9);return _0x506ea0[_0xf29f('0x21')]('Content-Range',_0x8e6388+'-'+_0x5bb69b+'/'+_0x564ad3)[_0xf29f('0x1c')](_0x62cf7f);}return null;};}function patchUpdates(_0x51e643){return function(_0x89c5bb){try{jsonpatch[_0xf29f('0x22')](_0x89c5bb,_0x51e643,!![]);}catch(_0x272985){return BPromise[_0xf29f('0x23')](_0x272985);}return _0x89c5bb[_0xf29f('0x24')]();};}function saveUpdates(_0x369345,_0x7366b0){return function(_0x5a2187){if(_0x5a2187){return _0x5a2187[_0xf29f('0x25')](_0x369345)[_0xf29f('0x26')](function(_0x1aa3a1){return _0x1aa3a1;});}return null;};}function removeEntity(_0x3a684d,_0x4a4861){return function(_0x290ce7){if(_0x290ce7){return _0x290ce7[_0xf29f('0x27')]()['then'](function(){_0x3a684d['status'](0xcc)[_0xf29f('0x28')]();});}};}function handleEntityNotFound(_0x311c6d,_0x3e4ee7){return function(_0x2d22f9){if(!_0x2d22f9){_0x311c6d[_0xf29f('0x1a')](0x194);}return _0x2d22f9;};}function handleError(_0x27e099,_0x1aa191){_0x1aa191=_0x1aa191||0x1f4;return function(_0x4cd896){logger[_0xf29f('0x29')](_0x4cd896['stack']);if(_0x4cd896[_0xf29f('0x2a')]){delete _0x4cd896['name'];}_0x27e099['status'](_0x1aa191)['send'](_0x4cd896);};}exports['index']=function(_0x22c65a,_0x167961){var _0xd8a04d={},_0x30aa3c={},_0x36b0a0={'count':0x0,'rows':[]};var _0x521646=_[_0xf29f('0x2b')](db[_0xf29f('0x2c')][_0xf29f('0x2d')],function(_0x1c3a2b){return{'name':_0x1c3a2b[_0xf29f('0x2e')],'type':_0x1c3a2b[_0xf29f('0x2f')]['key']};});_0x30aa3c[_0xf29f('0x30')]=_[_0xf29f('0x2b')](_0x521646,_0xf29f('0x2a'));_0x30aa3c[_0xf29f('0x31')]=_[_0xf29f('0x32')](_0x22c65a[_0xf29f('0x31')]);_0x30aa3c[_0xf29f('0x33')]=_[_0xf29f('0x34')](_0x30aa3c[_0xf29f('0x30')],_0x30aa3c[_0xf29f('0x31')]);_0xd8a04d[_0xf29f('0x35')]=_[_0xf29f('0x34')](_0x30aa3c[_0xf29f('0x30')],qs[_0xf29f('0x36')](_0x22c65a[_0xf29f('0x31')][_0xf29f('0x36')]));_0xd8a04d[_0xf29f('0x35')]=_0xd8a04d[_0xf29f('0x35')][_0xf29f('0x37')]?_0xd8a04d[_0xf29f('0x35')]:_0x30aa3c[_0xf29f('0x30')];if(!_0x22c65a[_0xf29f('0x31')]['hasOwnProperty'](_0xf29f('0x38'))){_0xd8a04d[_0xf29f('0x1e')]=qs['limit'](_0x22c65a[_0xf29f('0x31')]['limit']);_0xd8a04d[_0xf29f('0x1d')]=qs['offset'](_0x22c65a[_0xf29f('0x31')]['offset']);}_0xd8a04d[_0xf29f('0x39')]=qs[_0xf29f('0x3a')](_0x22c65a[_0xf29f('0x31')][_0xf29f('0x3a')]);_0xd8a04d[_0xf29f('0x3b')]=qs[_0xf29f('0x33')](_[_0xf29f('0x3c')](_0x22c65a[_0xf29f('0x31')],_0x30aa3c[_0xf29f('0x33')]),_0x521646);if(_0x22c65a[_0xf29f('0x31')][_0xf29f('0x3d')]){_0xd8a04d['where']=_['merge'](_0xd8a04d[_0xf29f('0x3b')],{'$or':_[_0xf29f('0x2b')](_0x521646,function(_0x5345f3){if(_0x5345f3[_0xf29f('0x2f')]!==_0xf29f('0x3e')){var _0x3119cc={};_0x3119cc[_0x5345f3[_0xf29f('0x2a')]]={'$like':'%'+_0x22c65a[_0xf29f('0x31')][_0xf29f('0x3d')]+'%'};return _0x3119cc;}})});}_0xd8a04d=_[_0xf29f('0x3f')]({},_0xd8a04d,_0x22c65a[_0xf29f('0x40')]);var _0x1284d0={'where':_0xd8a04d[_0xf29f('0x3b')]};return db[_0xf29f('0x2c')][_0xf29f('0x20')](_0x1284d0)[_0xf29f('0x26')](function(_0x525b3c){_0x36b0a0[_0xf29f('0x20')]=_0x525b3c;if(_0x22c65a[_0xf29f('0x31')][_0xf29f('0x41')]){_0xd8a04d[_0xf29f('0x42')]=[{'all':!![]}];}return db[_0xf29f('0x2c')]['findAll'](_0xd8a04d);})['then'](function(_0x377ffa){_0x36b0a0[_0xf29f('0x43')]=_0x377ffa;return _0x36b0a0;})[_0xf29f('0x26')](respondWithFilteredResult(_0x167961,_0xd8a04d))[_0xf29f('0x44')](handleError(_0x167961,null));};exports['show']=function(_0x485981,_0x1c5614){var _0x1393ce={'raw':![],'where':{'id':_0x485981['params']['id']}},_0x2c63ed={};_0x2c63ed[_0xf29f('0x30')]=_[_0xf29f('0x32')](db[_0xf29f('0x2c')][_0xf29f('0x2d')]);_0x2c63ed[_0xf29f('0x31')]=_[_0xf29f('0x32')](_0x485981[_0xf29f('0x31')]);_0x2c63ed[_0xf29f('0x33')]=_['intersection'](_0x2c63ed[_0xf29f('0x30')],_0x2c63ed[_0xf29f('0x31')]);_0x1393ce['attributes']=_[_0xf29f('0x34')](_0x2c63ed[_0xf29f('0x30')],qs[_0xf29f('0x36')](_0x485981[_0xf29f('0x31')][_0xf29f('0x36')]));_0x1393ce[_0xf29f('0x35')]=_0x1393ce[_0xf29f('0x35')][_0xf29f('0x37')]?_0x1393ce[_0xf29f('0x35')]:_0x2c63ed[_0xf29f('0x30')];if(_0x485981[_0xf29f('0x31')][_0xf29f('0x41')]){_0x1393ce[_0xf29f('0x42')]=[{'all':!![]}];}_0x1393ce=_['merge']({},_0x1393ce,_0x485981[_0xf29f('0x40')]);return db['ServicenowConfiguration'][_0xf29f('0x45')](_0x1393ce)['then'](handleEntityNotFound(_0x1c5614,null))[_0xf29f('0x26')](respondWithResult(_0x1c5614,null))[_0xf29f('0x44')](handleError(_0x1c5614,null));};exports['create']=function(_0x4b6c4c,_0x37b26b){return db[_0xf29f('0x2c')]['create'](_0x4b6c4c[_0xf29f('0x46')],{})[_0xf29f('0x26')](respondWithResult(_0x37b26b,0xc9))[_0xf29f('0x44')](handleError(_0x37b26b,null));};exports[_0xf29f('0x25')]=function(_0x4d78a7,_0x3805c9){if(_0x4d78a7['body']['id']){delete _0x4d78a7[_0xf29f('0x46')]['id'];}return db[_0xf29f('0x2c')][_0xf29f('0x45')]({'where':{'id':_0x4d78a7[_0xf29f('0x47')]['id']}})[_0xf29f('0x26')](handleEntityNotFound(_0x3805c9,null))[_0xf29f('0x26')](saveUpdates(_0x4d78a7['body'],null))[_0xf29f('0x26')](respondWithResult(_0x3805c9,null))['catch'](handleError(_0x3805c9,null));};exports['destroy']=function(_0x52bb37,_0x397a1e){return db[_0xf29f('0x2c')][_0xf29f('0x45')]({'where':{'id':_0x52bb37[_0xf29f('0x47')]['id']}})[_0xf29f('0x26')](handleEntityNotFound(_0x397a1e,null))[_0xf29f('0x26')](removeEntity(_0x397a1e,null))[_0xf29f('0x44')](handleError(_0x397a1e,null));};exports[_0xf29f('0x48')]=function(_0x586c90,_0x2073e2,_0x5e2ee2){var _0x106bd1={};var _0xbd0df4={};var _0x2149aa;var _0x3e4eaa;return db[_0xf29f('0x2c')][_0xf29f('0x49')]({'where':{'id':_0x586c90[_0xf29f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2073e2,null))[_0xf29f('0x26')](function(_0x3be5d0){if(_0x3be5d0){_0x2149aa=_0x3be5d0;_0xbd0df4[_0xf29f('0x30')]=_[_0xf29f('0x32')](db[_0xf29f('0x4a')][_0xf29f('0x2d')]);_0xbd0df4['query']=_[_0xf29f('0x32')](_0x586c90[_0xf29f('0x31')]);_0xbd0df4['filters']=_[_0xf29f('0x34')](_0xbd0df4[_0xf29f('0x30')],_0xbd0df4[_0xf29f('0x31')]);_0x106bd1[_0xf29f('0x35')]=_[_0xf29f('0x34')](_0xbd0df4[_0xf29f('0x30')],qs['fields'](_0x586c90['query'][_0xf29f('0x36')]));_0x106bd1[_0xf29f('0x35')]=_0x106bd1[_0xf29f('0x35')]['length']?_0x106bd1[_0xf29f('0x35')]:_0xbd0df4[_0xf29f('0x30')];_0x106bd1[_0xf29f('0x39')]=qs[_0xf29f('0x3a')](_0x586c90[_0xf29f('0x31')][_0xf29f('0x3a')]);_0x106bd1[_0xf29f('0x3b')]=qs[_0xf29f('0x33')](_[_0xf29f('0x3c')](_0x586c90[_0xf29f('0x31')],_0xbd0df4[_0xf29f('0x33')]));if(_0x586c90['query'][_0xf29f('0x3d')]){_0x106bd1[_0xf29f('0x3b')]=_[_0xf29f('0x3f')](_0x106bd1[_0xf29f('0x3b')],{'$or':_['map'](_0x106bd1['attributes'],function(_0x14a248){var _0x3f7367={};_0x3f7367[_0x14a248]={'$like':'%'+_0x586c90[_0xf29f('0x31')][_0xf29f('0x3d')]+'%'};return _0x3f7367;})});}_0x106bd1=_[_0xf29f('0x3f')]({},_0x106bd1,_0x586c90[_0xf29f('0x40')]);return _0x2149aa[_0xf29f('0x48')](_0x106bd1);}})[_0xf29f('0x26')](function(_0x1e647a){if(_0x1e647a){_0x3e4eaa=_0x1e647a[_0xf29f('0x37')];if(!_0x586c90[_0xf29f('0x31')]['hasOwnProperty']('nolimit')){_0x106bd1['limit']=qs[_0xf29f('0x1e')](_0x586c90['query']['limit']);_0x106bd1[_0xf29f('0x1d')]=qs['offset'](_0x586c90[_0xf29f('0x31')]['offset']);}return _0x2149aa['getFields'](_0x106bd1);}})[_0xf29f('0x26')](function(_0x2abf95){if(_0x2abf95){return _0x2abf95?{'count':_0x3e4eaa,'rows':_0x2abf95}:null;}})[_0xf29f('0x26')](respondWithResult(_0x2073e2,null))['catch'](handleError(_0x2073e2,null));};exports[_0xf29f('0x4b')]=function(_0x401e4f,_0x2be679,_0x31082c){var _0x45094c={};var _0x16166c={};var _0x53dde;var _0x26d70c;return db[_0xf29f('0x2c')][_0xf29f('0x49')]({'where':{'id':_0x401e4f[_0xf29f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2be679,null))[_0xf29f('0x26')](function(_0x40d3cb){if(_0x40d3cb){_0x53dde=_0x40d3cb;_0x16166c['model']=_[_0xf29f('0x32')](db[_0xf29f('0x4a')][_0xf29f('0x2d')]);_0x16166c[_0xf29f('0x31')]=_[_0xf29f('0x32')](_0x401e4f[_0xf29f('0x31')]);_0x16166c['filters']=_[_0xf29f('0x34')](_0x16166c[_0xf29f('0x30')],_0x16166c[_0xf29f('0x31')]);_0x45094c[_0xf29f('0x35')]=_[_0xf29f('0x34')](_0x16166c[_0xf29f('0x30')],qs[_0xf29f('0x36')](_0x401e4f[_0xf29f('0x31')][_0xf29f('0x36')]));_0x45094c[_0xf29f('0x35')]=_0x45094c['attributes']['length']?_0x45094c[_0xf29f('0x35')]:_0x16166c[_0xf29f('0x30')];_0x45094c[_0xf29f('0x39')]=qs[_0xf29f('0x3a')](_0x401e4f[_0xf29f('0x31')][_0xf29f('0x3a')]);_0x45094c['where']=qs['filters'](_[_0xf29f('0x3c')](_0x401e4f['query'],_0x16166c[_0xf29f('0x33')]));if(_0x401e4f[_0xf29f('0x31')][_0xf29f('0x3d')]){_0x45094c[_0xf29f('0x3b')]=_[_0xf29f('0x3f')](_0x45094c[_0xf29f('0x3b')],{'$or':_[_0xf29f('0x2b')](_0x45094c[_0xf29f('0x35')],function(_0x1247fe){var _0xb221f3={};_0xb221f3[_0x1247fe]={'$like':'%'+_0x401e4f[_0xf29f('0x31')][_0xf29f('0x3d')]+'%'};return _0xb221f3;})});}_0x45094c=_[_0xf29f('0x3f')]({},_0x45094c,_0x401e4f[_0xf29f('0x40')]);return _0x53dde['getSubjects'](_0x45094c);}})['then'](function(_0x445411){if(_0x445411){_0x26d70c=_0x445411[_0xf29f('0x37')];if(!_0x401e4f[_0xf29f('0x31')][_0xf29f('0x4c')](_0xf29f('0x38'))){_0x45094c[_0xf29f('0x1e')]=qs[_0xf29f('0x1e')](_0x401e4f[_0xf29f('0x31')][_0xf29f('0x1e')]);_0x45094c[_0xf29f('0x1d')]=qs['offset'](_0x401e4f[_0xf29f('0x31')][_0xf29f('0x1d')]);}return _0x53dde['getSubjects'](_0x45094c);}})[_0xf29f('0x26')](function(_0xde5071){if(_0xde5071){return _0xde5071?{'count':_0x26d70c,'rows':_0xde5071}:null;}})[_0xf29f('0x26')](respondWithResult(_0x2be679,null))[_0xf29f('0x44')](handleError(_0x2be679,null));};exports['getDescriptions']=function(_0x1aa824,_0x3fcfcd,_0xeec4f){var _0x15a767={};var _0x455b3a={};var _0x482210;var _0xd5d26;return db[_0xf29f('0x2c')]['findOne']({'where':{'id':_0x1aa824[_0xf29f('0x47')]['id']}})[_0xf29f('0x26')](handleEntityNotFound(_0x3fcfcd,null))[_0xf29f('0x26')](function(_0x2aa3f6){if(_0x2aa3f6){_0x482210=_0x2aa3f6;_0x455b3a[_0xf29f('0x30')]=_[_0xf29f('0x32')](db[_0xf29f('0x4a')]['rawAttributes']);_0x455b3a[_0xf29f('0x31')]=_['keys'](_0x1aa824[_0xf29f('0x31')]);_0x455b3a['filters']=_[_0xf29f('0x34')](_0x455b3a[_0xf29f('0x30')],_0x455b3a[_0xf29f('0x31')]);_0x15a767['attributes']=_[_0xf29f('0x34')](_0x455b3a[_0xf29f('0x30')],qs[_0xf29f('0x36')](_0x1aa824['query']['fields']));_0x15a767[_0xf29f('0x35')]=_0x15a767[_0xf29f('0x35')][_0xf29f('0x37')]?_0x15a767[_0xf29f('0x35')]:_0x455b3a[_0xf29f('0x30')];_0x15a767[_0xf29f('0x39')]=qs[_0xf29f('0x3a')](_0x1aa824['query'][_0xf29f('0x3a')]);_0x15a767[_0xf29f('0x3b')]=qs[_0xf29f('0x33')](_[_0xf29f('0x3c')](_0x1aa824['query'],_0x455b3a['filters']));if(_0x1aa824[_0xf29f('0x31')][_0xf29f('0x3d')]){_0x15a767[_0xf29f('0x3b')]=_[_0xf29f('0x3f')](_0x15a767[_0xf29f('0x3b')],{'$or':_[_0xf29f('0x2b')](_0x15a767['attributes'],function(_0x2ab476){var _0x1b2e1c={};_0x1b2e1c[_0x2ab476]={'$like':'%'+_0x1aa824[_0xf29f('0x31')]['filter']+'%'};return _0x1b2e1c;})});}_0x15a767=_['merge']({},_0x15a767,_0x1aa824[_0xf29f('0x40')]);return _0x482210[_0xf29f('0x4d')](_0x15a767);}})[_0xf29f('0x26')](function(_0x687802){if(_0x687802){_0xd5d26=_0x687802[_0xf29f('0x37')];if(!_0x1aa824[_0xf29f('0x31')]['hasOwnProperty'](_0xf29f('0x38'))){_0x15a767[_0xf29f('0x1e')]=qs['limit'](_0x1aa824['query']['limit']);_0x15a767[_0xf29f('0x1d')]=qs[_0xf29f('0x1d')](_0x1aa824[_0xf29f('0x31')]['offset']);}return _0x482210[_0xf29f('0x4d')](_0x15a767);}})[_0xf29f('0x26')](function(_0x201354){if(_0x201354){return _0x201354?{'count':_0xd5d26,'rows':_0x201354}:null;}})[_0xf29f('0x26')](respondWithResult(_0x3fcfcd,null))['catch'](handleError(_0x3fcfcd,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7f47d63..cf6f892 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x657b=['api','moment','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x3261b1,_0x1613df){var _0x5c5e48=function(_0xdacc8d){while(--_0xdacc8d){_0x3261b1['push'](_0x3261b1['shift']());}};_0x5c5e48(++_0x1613df);}(_0x657b,0x131));var _0xb657=function(_0x333a70,_0x538be6){_0x333a70=_0x333a70-0x0;var _0x237396=_0x657b[_0x333a70];return _0x237396;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var logger=require(_0xb657('0x2'))(_0xb657('0x3'));var moment=require(_0xb657('0x4'));var BPromise=require('bluebird');var rp=require(_0xb657('0x5'));var fs=require('fs');var path=require(_0xb657('0x6'));var rimraf=require('rimraf');var config=require(_0xb657('0x7'));var attributes=require(_0xb657('0x8'));module[_0xb657('0x9')]=function(_0x25738d,_0x446b17){return _0x25738d['define'](_0xb657('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee7=['ServicenowConfiguration','int_servicenow_configurations','util','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x2c765a,_0x129729){var _0x3570c1=function(_0x3ad11e){while(--_0x3ad11e){_0x2c765a['push'](_0x2c765a['shift']());}};_0x3570c1(++_0x129729);}(_0x3ee7,0x98));var _0x73ee=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x3ee7[_0x19babd];return _0x314eaf;};'use strict';var _=require('lodash');var util=require(_0x73ee('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x73ee('0x1'));var BPromise=require('bluebird');var rp=require(_0x73ee('0x2'));var fs=require('fs');var path=require(_0x73ee('0x3'));var rimraf=require(_0x73ee('0x4'));var config=require(_0x73ee('0x5'));var attributes=require(_0x73ee('0x6'));module[_0x73ee('0x7')]=function(_0x2bc2c1,_0x447c6f){return _0x2bc2c1['define'](_0x73ee('0x8'),attributes,{'tableName':_0x73ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index c04b086..5d1d576 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bce=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis'];(function(_0x236fbb,_0xa721d9){var _0x4d9c67=function(_0x2b2a79){while(--_0x2b2a79){_0x236fbb['push'](_0x236fbb['shift']());}};_0x4d9c67(++_0xa721d9);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var moment=require('moment');var BPromise=require(_0xe1bc('0x2'));var rs=require(_0xe1bc('0x3'));var fs=require('fs');var Redis=require(_0xe1bc('0x4'));var db=require(_0xe1bc('0x5'))['db'];var utils=require(_0xe1bc('0x6'));var logger=require(_0xe1bc('0x7'))(_0xe1bc('0x8'));var config=require(_0xe1bc('0x9'));var jayson=require(_0xe1bc('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x324c27,_0x4199ff,_0x24b695){return new BPromise(function(_0x1c6720,_0x1a861f){return client[_0xe1bc('0xb')](_0x324c27,_0x24b695)['then'](function(_0x46a0ed){logger['info'](_0xe1bc('0xc'),_0x4199ff,_0xe1bc('0xd'));logger[_0xe1bc('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4199ff,_0xe1bc('0xd'),JSON[_0xe1bc('0xf')](_0x46a0ed));if(_0x46a0ed['error']){if(_0x46a0ed[_0xe1bc('0x10')][_0xe1bc('0x11')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4199ff,_0x46a0ed[_0xe1bc('0x10')][_0xe1bc('0x12')]);return _0x1a861f(_0x46a0ed[_0xe1bc('0x10')]['message']);}logger['error'](_0xe1bc('0xc'),_0x4199ff,_0x46a0ed[_0xe1bc('0x10')][_0xe1bc('0x12')]);return _0x1c6720(_0x46a0ed['error'][_0xe1bc('0x12')]);}else{logger[_0xe1bc('0x13')](_0xe1bc('0xc'),_0x4199ff,_0xe1bc('0xd'));_0x1c6720(_0x46a0ed['result'][_0xe1bc('0x12')]);}})['catch'](function(_0x306165){logger[_0xe1bc('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4199ff,_0x306165);_0x1a861f(_0x306165);});});} \ No newline at end of file +var _0xca96=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug'];(function(_0x4ddc5d,_0x33e649){var _0x231056=function(_0x3c1fd6){while(--_0x3c1fd6){_0x4ddc5d['push'](_0x4ddc5d['shift']());}};_0x231056(++_0x33e649);}(_0xca96,0x10f));var _0x6ca9=function(_0x175f33,_0x58b838){_0x175f33=_0x175f33-0x0;var _0x250a92=_0xca96[_0x175f33];return _0x250a92;};'use strict';var _=require('lodash');var util=require(_0x6ca9('0x0'));var moment=require('moment');var BPromise=require(_0x6ca9('0x1'));var rs=require(_0x6ca9('0x2'));var fs=require('fs');var Redis=require(_0x6ca9('0x3'));var db=require(_0x6ca9('0x4'))['db'];var utils=require(_0x6ca9('0x5'));var logger=require('../../config/logger')(_0x6ca9('0x6'));var config=require(_0x6ca9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6ca9('0x8')][_0x6ca9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x83baf3,_0x1b595e,_0x79d698){return new BPromise(function(_0x3b8ab2,_0x588307){return client[_0x6ca9('0xa')](_0x83baf3,_0x79d698)[_0x6ca9('0xb')](function(_0x5a2d48){logger[_0x6ca9('0xc')](_0x6ca9('0xd'),_0x1b595e,'request\x20sent');logger[_0x6ca9('0xe')](_0x6ca9('0xf'),_0x1b595e,_0x6ca9('0x10'),JSON[_0x6ca9('0x11')](_0x5a2d48));if(_0x5a2d48[_0x6ca9('0x12')]){if(_0x5a2d48[_0x6ca9('0x12')][_0x6ca9('0x13')]===0x1f4){logger[_0x6ca9('0x12')](_0x6ca9('0xd'),_0x1b595e,_0x5a2d48[_0x6ca9('0x12')]['message']);return _0x588307(_0x5a2d48[_0x6ca9('0x12')][_0x6ca9('0x14')]);}logger[_0x6ca9('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1b595e,_0x5a2d48[_0x6ca9('0x12')]['message']);return _0x3b8ab2(_0x5a2d48[_0x6ca9('0x12')][_0x6ca9('0x14')]);}else{logger['info'](_0x6ca9('0xd'),_0x1b595e,_0x6ca9('0x10'));_0x3b8ab2(_0x5a2d48['result'][_0x6ca9('0x14')]);}})[_0x6ca9('0x15')](function(_0x57fde9){logger[_0x6ca9('0x12')](_0x6ca9('0xd'),_0x1b595e,_0x57fde9);_0x588307(_0x57fde9);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9a7a1d8..f8cd907 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03c5=['/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','get'];(function(_0x37743f,_0x1a3e21){var _0xaedfa2=function(_0x266101){while(--_0x266101){_0x37743f['push'](_0x37743f['shift']());}};_0xaedfa2(++_0x1a3e21);}(_0x03c5,0x138));var _0x503c=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x03c5[_0x4fb1b8];return _0x146c71;};'use strict';var multer=require(_0x503c('0x0'));var util=require(_0x503c('0x1'));var path=require('path');var timeout=require(_0x503c('0x2'));var express=require('express');var router=express[_0x503c('0x3')]();var fs_extra=require(_0x503c('0x4'));var auth=require(_0x503c('0x5'));var interaction=require(_0x503c('0x6'));var config=require(_0x503c('0x7'));var controller=require(_0x503c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x503c('0x9')]);router[_0x503c('0xa')](_0x503c('0xb'),auth[_0x503c('0xc')](),controller[_0x503c('0xd')]);router[_0x503c('0xe')]('/',auth[_0x503c('0xc')](),controller[_0x503c('0xf')]);router[_0x503c('0x10')](_0x503c('0xb'),auth[_0x503c('0xc')](),controller[_0x503c('0x11')]);router['delete'](_0x503c('0xb'),auth[_0x503c('0xc')](),controller[_0x503c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x44fb=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports'];(function(_0x11a238,_0x1c48fa){var _0x517b53=function(_0x29b07d){while(--_0x29b07d){_0x11a238['push'](_0x11a238['shift']());}};_0x517b53(++_0x1c48fa);}(_0x44fb,0x10e));var _0xb44f=function(_0x1c3aca,_0x5b343e){_0x1c3aca=_0x1c3aca-0x0;var _0x36ba7a=_0x44fb[_0x1c3aca];return _0x36ba7a;};'use strict';var multer=require('multer');var util=require(_0xb44f('0x0'));var path=require('path');var timeout=require(_0xb44f('0x1'));var express=require(_0xb44f('0x2'));var router=express[_0xb44f('0x3')]();var fs_extra=require(_0xb44f('0x4'));var auth=require(_0xb44f('0x5'));var interaction=require(_0xb44f('0x6'));var config=require(_0xb44f('0x7'));var controller=require(_0xb44f('0x8'));router[_0xb44f('0x9')]('/',auth[_0xb44f('0xa')](),controller[_0xb44f('0xb')]);router[_0xb44f('0x9')](_0xb44f('0xc'),auth[_0xb44f('0xa')](),controller[_0xb44f('0xd')]);router[_0xb44f('0xe')]('/',auth[_0xb44f('0xa')](),controller['create']);router[_0xb44f('0xf')](_0xb44f('0xc'),auth['isAuthenticated'](),controller[_0xb44f('0x10')]);router['delete'](_0xb44f('0xc'),auth[_0xb44f('0xa')](),controller['destroy']);module[_0xb44f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 22423cd..0411eb1 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93dc=['BOOLEAN','exports','string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x463ba8,_0x307a13){var _0x5c528e=function(_0x2096ab){while(--_0x2096ab){_0x463ba8['push'](_0x463ba8['shift']());}};_0x5c528e(++_0x307a13);}(_0x93dc,0xc9));var _0xc93d=function(_0x3e3b5d,_0x373926){_0x3e3b5d=_0x3e3b5d-0x0;var _0x194e10=_0x93dc[_0x3e3b5d];return _0x194e10;};'use strict';var Sequelize=require('sequelize');module[_0xc93d('0x0')]={'type':{'type':Sequelize['ENUM'](_0xc93d('0x1'),_0xc93d('0x2'),_0xc93d('0x3'),'keyValue',_0xc93d('0x4')),'defaultValue':_0xc93d('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc93d('0x5')]},'keyType':{'type':Sequelize[_0xc93d('0x6')](_0xc93d('0x1'),_0xc93d('0x2'),_0xc93d('0x3'))},'keyContent':{'type':Sequelize[_0xc93d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc93d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3302=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3302,0xf5));var _0x2330=function(_0x5ea509,_0x553326){_0x5ea509=_0x5ea509-0x0;var _0x24c198=_0x3302[_0x5ea509];return _0x24c198;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2330('0x0')](_0x2330('0x1'),_0x2330('0x2'),'customVariable',_0x2330('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2330('0x4')]},'key':{'type':Sequelize[_0x2330('0x4')]},'keyType':{'type':Sequelize[_0x2330('0x0')](_0x2330('0x1'),_0x2330('0x2'),_0x2330('0x5'))},'keyContent':{'type':Sequelize[_0x2330('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2330('0x4')]},'customField':{'type':Sequelize[_0x2330('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 63f605c..f1a9f40 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9351=['hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','then','catch','show','params','rawAttributes','length','include','find','create','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','update','error','stack','name','send','map','ServicenowField','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0x9351,0x180));var _0x1935=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9351[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x1935('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1935('0x2'));var moment=require(_0x1935('0x3'));var BPromise=require(_0x1935('0x4'));var Mustache=require(_0x1935('0x5'));var util=require(_0x1935('0x6'));var path=require(_0x1935('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1935('0x8'));var fs=require('fs');var fs_extra=require(_0x1935('0x9'));var _=require(_0x1935('0xa'));var squel=require(_0x1935('0xb'));var crypto=require(_0x1935('0xc'));var jsforce=require(_0x1935('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1935('0xe'));var Papa=require('papaparse');var Redis=require(_0x1935('0xf'));var authService=require(_0x1935('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1935('0x11'));var hardwareService=require(_0x1935('0x12'));var logger=require(_0x1935('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1935('0x14'));var licenseUtil=require(_0x1935('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5489d1,_0x2f7b5b){_0x2f7b5b=_0x2f7b5b||0xcc;return function(_0x5232c9){if(_0x5232c9){return _0x5489d1[_0x1935('0x16')](_0x2f7b5b);}return _0x5489d1[_0x1935('0x17')](_0x2f7b5b)[_0x1935('0x18')]();};}function respondWithResult(_0x4fbc20,_0x4cf698){_0x4cf698=_0x4cf698||0xc8;return function(_0x58da73){if(_0x58da73){return _0x4fbc20[_0x1935('0x17')](_0x4cf698)[_0x1935('0x19')](_0x58da73);}};}function respondWithFilteredResult(_0xd7df1e,_0xe01204){return function(_0x1b83e3){if(_0x1b83e3){var _0x578693=typeof _0xe01204[_0x1935('0x1a')]==='undefined'&&typeof _0xe01204['limit']===_0x1935('0x1b');var _0x54a889=_0x1b83e3[_0x1935('0x1c')];var _0x196010=_0x578693?0x0:_0xe01204[_0x1935('0x1a')];var _0x18a093=_0x578693?_0x1b83e3[_0x1935('0x1c')]:_0xe01204[_0x1935('0x1a')]+_0xe01204['limit'];var _0x3e58d1;if(_0x18a093>=_0x54a889){_0x18a093=_0x54a889;_0x3e58d1=0xc8;}else{_0x3e58d1=0xce;}_0xd7df1e[_0x1935('0x17')](_0x3e58d1);return _0xd7df1e['set'](_0x1935('0x1d'),_0x196010+'-'+_0x18a093+'/'+_0x54a889)[_0x1935('0x19')](_0x1b83e3);}return null;};}function patchUpdates(_0x5e2f40){return function(_0x5dc698){try{jsonpatch['apply'](_0x5dc698,_0x5e2f40,!![]);}catch(_0x5093ae){return BPromise[_0x1935('0x1e')](_0x5093ae);}return _0x5dc698[_0x1935('0x1f')]();};}function saveUpdates(_0x1a4207,_0x3cd1aa){return function(_0x3d52a7){if(_0x3d52a7){return _0x3d52a7[_0x1935('0x20')](_0x1a4207)['then'](function(_0x5ac68f){return _0x5ac68f;});}return null;};}function removeEntity(_0x59bf33,_0x425040){return function(_0x4bade4){if(_0x4bade4){return _0x4bade4['destroy']()['then'](function(){_0x59bf33[_0x1935('0x17')](0xcc)[_0x1935('0x18')]();});}};}function handleEntityNotFound(_0x7c2807,_0x461823){return function(_0x2e88a5){if(!_0x2e88a5){_0x7c2807[_0x1935('0x16')](0x194);}return _0x2e88a5;};}function handleError(_0x4888dc,_0x4244ac){_0x4244ac=_0x4244ac||0x1f4;return function(_0x2485a5){logger[_0x1935('0x21')](_0x2485a5[_0x1935('0x22')]);if(_0x2485a5[_0x1935('0x23')]){delete _0x2485a5[_0x1935('0x23')];}_0x4888dc[_0x1935('0x17')](_0x4244ac)[_0x1935('0x24')](_0x2485a5);};}exports['index']=function(_0x421254,_0x356da2){var _0x5cce36={},_0x4b693c={},_0x3eddab={'count':0x0,'rows':[]};var _0x4cea32=_[_0x1935('0x25')](db[_0x1935('0x26')]['rawAttributes'],function(_0x1b261d){return{'name':_0x1b261d[_0x1935('0x27')],'type':_0x1b261d[_0x1935('0x28')][_0x1935('0x29')]};});_0x4b693c[_0x1935('0x2a')]=_['map'](_0x4cea32,_0x1935('0x23'));_0x4b693c[_0x1935('0x2b')]=_[_0x1935('0x2c')](_0x421254[_0x1935('0x2b')]);_0x4b693c['filters']=_[_0x1935('0x2d')](_0x4b693c[_0x1935('0x2a')],_0x4b693c['query']);_0x5cce36[_0x1935('0x2e')]=_['intersection'](_0x4b693c[_0x1935('0x2a')],qs['fields'](_0x421254['query'][_0x1935('0x2f')]));_0x5cce36[_0x1935('0x2e')]=_0x5cce36[_0x1935('0x2e')]['length']?_0x5cce36[_0x1935('0x2e')]:_0x4b693c[_0x1935('0x2a')];if(!_0x421254['query'][_0x1935('0x30')](_0x1935('0x31'))){_0x5cce36[_0x1935('0x32')]=qs[_0x1935('0x32')](_0x421254['query'][_0x1935('0x32')]);_0x5cce36['offset']=qs['offset'](_0x421254[_0x1935('0x2b')][_0x1935('0x1a')]);}_0x5cce36['order']=qs['sort'](_0x421254[_0x1935('0x2b')][_0x1935('0x33')]);_0x5cce36['where']=qs[_0x1935('0x34')](_[_0x1935('0x35')](_0x421254[_0x1935('0x2b')],_0x4b693c[_0x1935('0x34')]),_0x4cea32);if(_0x421254[_0x1935('0x2b')][_0x1935('0x36')]){_0x5cce36[_0x1935('0x37')]=_['merge'](_0x5cce36[_0x1935('0x37')],{'$or':_['map'](_0x4cea32,function(_0x4b576a){if(_0x4b576a[_0x1935('0x28')]!=='VIRTUAL'){var _0x4ff3cc={};_0x4ff3cc[_0x4b576a[_0x1935('0x23')]]={'$like':'%'+_0x421254[_0x1935('0x2b')][_0x1935('0x36')]+'%'};return _0x4ff3cc;}})});}_0x5cce36=_[_0x1935('0x38')]({},_0x5cce36,_0x421254[_0x1935('0x39')]);var _0x5171d7={'where':_0x5cce36[_0x1935('0x37')]};return db[_0x1935('0x26')][_0x1935('0x1c')](_0x5171d7)['then'](function(_0x28751f){_0x3eddab[_0x1935('0x1c')]=_0x28751f;if(_0x421254[_0x1935('0x2b')][_0x1935('0x3a')]){_0x5cce36['include']=[{'all':!![]}];}return db['ServicenowField'][_0x1935('0x3b')](_0x5cce36);})['then'](function(_0x1b9da9){_0x3eddab[_0x1935('0x3c')]=_0x1b9da9;return _0x3eddab;})[_0x1935('0x3d')](respondWithFilteredResult(_0x356da2,_0x5cce36))[_0x1935('0x3e')](handleError(_0x356da2,null));};exports[_0x1935('0x3f')]=function(_0x59f266,_0x3f63df){var _0x55d733={'raw':!![],'where':{'id':_0x59f266[_0x1935('0x40')]['id']}},_0x252da4={};_0x252da4[_0x1935('0x2a')]=_[_0x1935('0x2c')](db[_0x1935('0x26')][_0x1935('0x41')]);_0x252da4['query']=_[_0x1935('0x2c')](_0x59f266[_0x1935('0x2b')]);_0x252da4[_0x1935('0x34')]=_[_0x1935('0x2d')](_0x252da4[_0x1935('0x2a')],_0x252da4[_0x1935('0x2b')]);_0x55d733[_0x1935('0x2e')]=_['intersection'](_0x252da4[_0x1935('0x2a')],qs[_0x1935('0x2f')](_0x59f266[_0x1935('0x2b')][_0x1935('0x2f')]));_0x55d733['attributes']=_0x55d733['attributes'][_0x1935('0x42')]?_0x55d733[_0x1935('0x2e')]:_0x252da4['model'];if(_0x59f266[_0x1935('0x2b')]['includeAll']){_0x55d733[_0x1935('0x43')]=[{'all':!![]}];}_0x55d733=_[_0x1935('0x38')]({},_0x55d733,_0x59f266['options']);return db[_0x1935('0x26')][_0x1935('0x44')](_0x55d733)[_0x1935('0x3d')](handleEntityNotFound(_0x3f63df,null))['then'](respondWithResult(_0x3f63df,null))[_0x1935('0x3e')](handleError(_0x3f63df,null));};exports[_0x1935('0x45')]=function(_0x2863f8,_0x2f22f8){return db[_0x1935('0x26')][_0x1935('0x45')](_0x2863f8['body'],{})[_0x1935('0x3d')](respondWithResult(_0x2f22f8,0xc9))['catch'](handleError(_0x2f22f8,null));};exports[_0x1935('0x20')]=function(_0x13c1bd,_0x55130e){if(_0x13c1bd['body']['id']){delete _0x13c1bd[_0x1935('0x46')]['id'];}return db[_0x1935('0x26')]['find']({'where':{'id':_0x13c1bd[_0x1935('0x40')]['id']}})['then'](handleEntityNotFound(_0x55130e,null))[_0x1935('0x3d')](saveUpdates(_0x13c1bd[_0x1935('0x46')],null))[_0x1935('0x3d')](respondWithResult(_0x55130e,null))['catch'](handleError(_0x55130e,null));};exports[_0x1935('0x47')]=function(_0x5b1844,_0x36d31d){return db[_0x1935('0x26')]['find']({'where':{'id':_0x5b1844[_0x1935('0x40')]['id']}})[_0x1935('0x3d')](handleEntityNotFound(_0x36d31d,null))[_0x1935('0x3d')](removeEntity(_0x36d31d,null))[_0x1935('0x3e')](handleError(_0x36d31d,null));}; \ No newline at end of file +var _0x2371=['error','stack','name','send','index','map','ServicenowField','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','destroy','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2371,0x1db));var _0x1237=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x2371[_0x1aa3fe];return _0x163cee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1237('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1237('0x1'));var moment=require(_0x1237('0x2'));var BPromise=require(_0x1237('0x3'));var Mustache=require('mustache');var util=require(_0x1237('0x4'));var path=require(_0x1237('0x5'));var sox=require(_0x1237('0x6'));var csv=require(_0x1237('0x7'));var ejs=require(_0x1237('0x8'));var fs=require('fs');var fs_extra=require(_0x1237('0x9'));var _=require(_0x1237('0xa'));var squel=require('squel');var crypto=require(_0x1237('0xb'));var jsforce=require(_0x1237('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1237('0x7'));var querystring=require(_0x1237('0xd'));var Papa=require('papaparse');var Redis=require(_0x1237('0xe'));var authService=require(_0x1237('0xf'));var qs=require(_0x1237('0x10'));var as=require(_0x1237('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1237('0x12'));var config=require(_0x1237('0x13'));var licenseUtil=require(_0x1237('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43d669,_0x57989d){_0x57989d=_0x57989d||0xcc;return function(_0x3447ab){if(_0x3447ab){return _0x43d669[_0x1237('0x15')](_0x57989d);}return _0x43d669[_0x1237('0x16')](_0x57989d)[_0x1237('0x17')]();};}function respondWithResult(_0x14c0f7,_0x5f5699){_0x5f5699=_0x5f5699||0xc8;return function(_0x182514){if(_0x182514){return _0x14c0f7[_0x1237('0x16')](_0x5f5699)[_0x1237('0x18')](_0x182514);}};}function respondWithFilteredResult(_0xfa8f0a,_0x3f1b46){return function(_0x58ab42){if(_0x58ab42){var _0x5ce87e=typeof _0x3f1b46['offset']==='undefined'&&typeof _0x3f1b46[_0x1237('0x19')]===_0x1237('0x1a');var _0x5dafc8=_0x58ab42[_0x1237('0x1b')];var _0x3a54b9=_0x5ce87e?0x0:_0x3f1b46[_0x1237('0x1c')];var _0x52d5dd=_0x5ce87e?_0x58ab42[_0x1237('0x1b')]:_0x3f1b46[_0x1237('0x1c')]+_0x3f1b46[_0x1237('0x19')];var _0x38f477;if(_0x52d5dd>=_0x5dafc8){_0x52d5dd=_0x5dafc8;_0x38f477=0xc8;}else{_0x38f477=0xce;}_0xfa8f0a[_0x1237('0x16')](_0x38f477);return _0xfa8f0a[_0x1237('0x1d')](_0x1237('0x1e'),_0x3a54b9+'-'+_0x52d5dd+'/'+_0x5dafc8)[_0x1237('0x18')](_0x58ab42);}return null;};}function patchUpdates(_0x48346e){return function(_0x3ebf4b){try{jsonpatch[_0x1237('0x1f')](_0x3ebf4b,_0x48346e,!![]);}catch(_0x1beba7){return BPromise[_0x1237('0x20')](_0x1beba7);}return _0x3ebf4b[_0x1237('0x21')]();};}function saveUpdates(_0x120553,_0xacc93){return function(_0x12f7d7){if(_0x12f7d7){return _0x12f7d7[_0x1237('0x22')](_0x120553)[_0x1237('0x23')](function(_0x10baf5){return _0x10baf5;});}return null;};}function removeEntity(_0x5a1df6,_0x34b63f){return function(_0x19cc12){if(_0x19cc12){return _0x19cc12['destroy']()[_0x1237('0x23')](function(){_0x5a1df6[_0x1237('0x16')](0xcc)[_0x1237('0x17')]();});}};}function handleEntityNotFound(_0x27bddc,_0x3b2322){return function(_0x146a41){if(!_0x146a41){_0x27bddc[_0x1237('0x15')](0x194);}return _0x146a41;};}function handleError(_0x473a2a,_0x291e77){_0x291e77=_0x291e77||0x1f4;return function(_0x876aff){logger[_0x1237('0x24')](_0x876aff[_0x1237('0x25')]);if(_0x876aff[_0x1237('0x26')]){delete _0x876aff[_0x1237('0x26')];}_0x473a2a['status'](_0x291e77)[_0x1237('0x27')](_0x876aff);};}exports[_0x1237('0x28')]=function(_0x344b29,_0x18d124){var _0xfc77c8={},_0x117216={},_0x418fca={'count':0x0,'rows':[]};var _0x5b11b2=_[_0x1237('0x29')](db[_0x1237('0x2a')]['rawAttributes'],function(_0x4398cb){return{'name':_0x4398cb['fieldName'],'type':_0x4398cb[_0x1237('0x2b')][_0x1237('0x2c')]};});_0x117216[_0x1237('0x2d')]=_[_0x1237('0x29')](_0x5b11b2,'name');_0x117216['query']=_['keys'](_0x344b29[_0x1237('0x2e')]);_0x117216[_0x1237('0x2f')]=_[_0x1237('0x30')](_0x117216[_0x1237('0x2d')],_0x117216['query']);_0xfc77c8[_0x1237('0x31')]=_[_0x1237('0x30')](_0x117216[_0x1237('0x2d')],qs[_0x1237('0x32')](_0x344b29['query'][_0x1237('0x32')]));_0xfc77c8[_0x1237('0x31')]=_0xfc77c8['attributes'][_0x1237('0x33')]?_0xfc77c8['attributes']:_0x117216[_0x1237('0x2d')];if(!_0x344b29[_0x1237('0x2e')][_0x1237('0x34')]('nolimit')){_0xfc77c8['limit']=qs[_0x1237('0x19')](_0x344b29[_0x1237('0x2e')]['limit']);_0xfc77c8['offset']=qs[_0x1237('0x1c')](_0x344b29['query']['offset']);}_0xfc77c8[_0x1237('0x35')]=qs['sort'](_0x344b29[_0x1237('0x2e')][_0x1237('0x36')]);_0xfc77c8[_0x1237('0x37')]=qs['filters'](_[_0x1237('0x38')](_0x344b29['query'],_0x117216[_0x1237('0x2f')]),_0x5b11b2);if(_0x344b29[_0x1237('0x2e')]['filter']){_0xfc77c8[_0x1237('0x37')]=_[_0x1237('0x39')](_0xfc77c8[_0x1237('0x37')],{'$or':_['map'](_0x5b11b2,function(_0x45bbce){if(_0x45bbce[_0x1237('0x2b')]!==_0x1237('0x3a')){var _0x446d9f={};_0x446d9f[_0x45bbce['name']]={'$like':'%'+_0x344b29[_0x1237('0x2e')][_0x1237('0x3b')]+'%'};return _0x446d9f;}})});}_0xfc77c8=_['merge']({},_0xfc77c8,_0x344b29[_0x1237('0x3c')]);var _0x4b9d02={'where':_0xfc77c8[_0x1237('0x37')]};return db[_0x1237('0x2a')][_0x1237('0x1b')](_0x4b9d02)[_0x1237('0x23')](function(_0x1db3ce){_0x418fca['count']=_0x1db3ce;if(_0x344b29[_0x1237('0x2e')][_0x1237('0x3d')]){_0xfc77c8[_0x1237('0x3e')]=[{'all':!![]}];}return db[_0x1237('0x2a')][_0x1237('0x3f')](_0xfc77c8);})[_0x1237('0x23')](function(_0x572127){_0x418fca[_0x1237('0x40')]=_0x572127;return _0x418fca;})[_0x1237('0x23')](respondWithFilteredResult(_0x18d124,_0xfc77c8))[_0x1237('0x41')](handleError(_0x18d124,null));};exports[_0x1237('0x42')]=function(_0x4c20ee,_0x326c68){var _0x2824e6={'raw':!![],'where':{'id':_0x4c20ee['params']['id']}},_0x172f0d={};_0x172f0d['model']=_[_0x1237('0x43')](db[_0x1237('0x2a')][_0x1237('0x44')]);_0x172f0d[_0x1237('0x2e')]=_[_0x1237('0x43')](_0x4c20ee[_0x1237('0x2e')]);_0x172f0d[_0x1237('0x2f')]=_['intersection'](_0x172f0d[_0x1237('0x2d')],_0x172f0d[_0x1237('0x2e')]);_0x2824e6[_0x1237('0x31')]=_[_0x1237('0x30')](_0x172f0d[_0x1237('0x2d')],qs['fields'](_0x4c20ee[_0x1237('0x2e')]['fields']));_0x2824e6[_0x1237('0x31')]=_0x2824e6[_0x1237('0x31')][_0x1237('0x33')]?_0x2824e6[_0x1237('0x31')]:_0x172f0d[_0x1237('0x2d')];if(_0x4c20ee[_0x1237('0x2e')]['includeAll']){_0x2824e6[_0x1237('0x3e')]=[{'all':!![]}];}_0x2824e6=_[_0x1237('0x39')]({},_0x2824e6,_0x4c20ee['options']);return db['ServicenowField'][_0x1237('0x45')](_0x2824e6)['then'](handleEntityNotFound(_0x326c68,null))[_0x1237('0x23')](respondWithResult(_0x326c68,null))['catch'](handleError(_0x326c68,null));};exports[_0x1237('0x46')]=function(_0x4a958a,_0x2372d8){return db[_0x1237('0x2a')]['create'](_0x4a958a['body'],{})['then'](respondWithResult(_0x2372d8,0xc9))['catch'](handleError(_0x2372d8,null));};exports['update']=function(_0xd5d6f3,_0x1ee350){if(_0xd5d6f3[_0x1237('0x47')]['id']){delete _0xd5d6f3[_0x1237('0x47')]['id'];}return db[_0x1237('0x2a')][_0x1237('0x45')]({'where':{'id':_0xd5d6f3['params']['id']}})[_0x1237('0x23')](handleEntityNotFound(_0x1ee350,null))[_0x1237('0x23')](saveUpdates(_0xd5d6f3[_0x1237('0x47')],null))['then'](respondWithResult(_0x1ee350,null))['catch'](handleError(_0x1ee350,null));};exports[_0x1237('0x48')]=function(_0x45b47d,_0x1f86ad){return db['ServicenowField'][_0x1237('0x45')]({'where':{'id':_0x45b47d['params']['id']}})[_0x1237('0x23')](handleEntityNotFound(_0x1f86ad,null))['then'](removeEntity(_0x1f86ad,null))['catch'](handleError(_0x1f86ad,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 3422b6d..a6b4be2 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc0f=['./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x433661,_0x19bafd){var _0x3bed5e=function(_0x3334da){while(--_0x3334da){_0x433661['push'](_0x433661['shift']());}};_0x3bed5e(++_0x19bafd);}(_0xbc0f,0x12d));var _0xfbc0=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xbc0f[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0xfbc0('0x0'));var util=require(_0xfbc0('0x1'));var logger=require('../../config/logger')(_0xfbc0('0x2'));var moment=require(_0xfbc0('0x3'));var BPromise=require(_0xfbc0('0x4'));var rp=require(_0xfbc0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfbc0('0x6'));var attributes=require(_0xfbc0('0x7'));module[_0xfbc0('0x8')]=function(_0x329476,_0x3a5963){return _0x329476[_0xfbc0('0x9')]('ServicenowField',attributes,{'tableName':_0xfbc0('0xa'),'paranoid':![],'indexes':[{'name':_0xfbc0('0xb'),'fields':[_0xfbc0('0xc'),_0xfbc0('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda1d=['exports','define','int_servicenow_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0xda1d,0xc8));var _0xdda1=function(_0x5828d0,_0x2c3e93){_0x5828d0=_0x5828d0-0x0;var _0x239b02=_0xda1d[_0x5828d0];return _0x239b02;};'use strict';var _=require('lodash');var util=require(_0xdda1('0x0'));var logger=require(_0xdda1('0x1'))(_0xdda1('0x2'));var moment=require(_0xdda1('0x3'));var BPromise=require(_0xdda1('0x4'));var rp=require(_0xdda1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdda1('0x6'));var config=require('../../config/environment');var attributes=require(_0xdda1('0x7'));module[_0xdda1('0x8')]=function(_0x3727a5,_0x3f1636){return _0x3727a5[_0xdda1('0x9')]('ServicenowField',attributes,{'tableName':_0xdda1('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xdda1('0xb'),_0xdda1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 316218b..7eb9b30 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3cb27d,_0x1ab55c){var _0x351326=function(_0x2f43c6){while(--_0x2f43c6){_0x3cb27d['push'](_0x3cb27d['shift']());}};_0x351326(++_0x1ab55c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x167eba,_0x5b7884){_0x167eba=_0x167eba-0x0;var _0x2959f0=_0xf4eb[_0x167eba];return _0x2959f0;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x152cf7,_0x175f98){var _0x201234=function(_0x2dbc27){while(--_0x2dbc27){_0x152cf7['push'](_0x152cf7['shift']());}};_0x201234(++_0x175f98);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 42dd427..ba9870a 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x16c40d,_0x54332b){var _0xaab681=function(_0x578d0a){while(--_0x578d0a){_0x16c40d['push'](_0x16c40d['shift']());}};_0xaab681(++_0x54332b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x493ecd,_0x5d0083){var _0x2a90d8=function(_0x33d9c3){while(--_0x33d9c3){_0x493ecd['push'](_0x493ecd['shift']());}};_0x2a90d8(++_0x5d0083);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index adc62a3..f86e79f 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5ba9eb,_0x5d658f){var _0x4f1670=function(_0x5993ef){while(--_0x5993ef){_0x5ba9eb['push'](_0x5ba9eb['shift']());}};_0x4f1670(++_0x5d658f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x218cbe,_0xd2412){var _0x2dec3c=function(_0x5bec82){while(--_0x5bec82){_0x218cbe['push'](_0x218cbe['shift']());}};_0x2dec3c(++_0xd2412);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index ec7b6be..91a499d 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2608=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','includes','label','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3a3993,_0x4dc4a8){var _0x2b20b4=function(_0x4c9253){while(--_0x4c9253){_0x3a3993['push'](_0x3a3993['shift']());}};_0x2b20b4(++_0x4dc4a8);}(_0x2608,0x1c8));var _0x8260=function(_0x282cbf,_0x543111){_0x282cbf=_0x282cbf-0x0;var _0x556fe1=_0x2608[_0x282cbf];return _0x556fe1;};'use strict';var emlformat=require(_0x8260('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8260('0x1'));var jsonpatch=require(_0x8260('0x2'));var rp=require(_0x8260('0x3'));var moment=require('moment');var BPromise=require(_0x8260('0x4'));var Mustache=require('mustache');var util=require(_0x8260('0x5'));var path=require(_0x8260('0x6'));var sox=require('sox');var csv=require(_0x8260('0x7'));var ejs=require(_0x8260('0x8'));var fs=require('fs');var fs_extra=require(_0x8260('0x9'));var _=require(_0x8260('0xa'));var squel=require(_0x8260('0xb'));var crypto=require(_0x8260('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8260('0xd'));var Papa=require('papaparse');var Redis=require(_0x8260('0xe'));var authService=require(_0x8260('0xf'));var qs=require(_0x8260('0x10'));var as=require(_0x8260('0x11'));var hardwareService=require(_0x8260('0x12'));var logger=require(_0x8260('0x13'))(_0x8260('0x14'));var utils=require(_0x8260('0x15'));var config=require(_0x8260('0x16'));var licenseUtil=require(_0x8260('0x17'));var db=require(_0x8260('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53b46f,_0x37edbd){_0x37edbd=_0x37edbd||0xcc;return function(_0x1c6af5){if(_0x1c6af5){return _0x53b46f[_0x8260('0x19')](_0x37edbd);}return _0x53b46f[_0x8260('0x1a')](_0x37edbd)[_0x8260('0x1b')]();};}function respondWithResult(_0x22b966,_0x1730a0){_0x1730a0=_0x1730a0||0xc8;return function(_0x5b8b8c){if(_0x5b8b8c){return _0x22b966['status'](_0x1730a0)[_0x8260('0x1c')](_0x5b8b8c);}};}function respondWithFilteredResult(_0x5e95b5,_0x59c2da){return function(_0x3253b2){if(_0x3253b2){var _0x2e4098=typeof _0x59c2da[_0x8260('0x1d')]===_0x8260('0x1e')&&typeof _0x59c2da[_0x8260('0x1f')]===_0x8260('0x1e');var _0x11dd6e=_0x3253b2[_0x8260('0x20')];var _0x501d72=_0x2e4098?0x0:_0x59c2da['offset'];var _0x50ec48=_0x2e4098?_0x3253b2['count']:_0x59c2da[_0x8260('0x1d')]+_0x59c2da[_0x8260('0x1f')];var _0x50cfce;if(_0x50ec48>=_0x11dd6e){_0x50ec48=_0x11dd6e;_0x50cfce=0xc8;}else{_0x50cfce=0xce;}_0x5e95b5[_0x8260('0x1a')](_0x50cfce);return _0x5e95b5[_0x8260('0x21')](_0x8260('0x22'),_0x501d72+'-'+_0x50ec48+'/'+_0x11dd6e)['json'](_0x3253b2);}return null;};}function patchUpdates(_0x3a516f){return function(_0xfb90fc){try{jsonpatch[_0x8260('0x23')](_0xfb90fc,_0x3a516f,!![]);}catch(_0x362ebe){return BPromise[_0x8260('0x24')](_0x362ebe);}return _0xfb90fc[_0x8260('0x25')]();};}function saveUpdates(_0x2fd872,_0x1717e2){return function(_0x108596){if(_0x108596){return _0x108596[_0x8260('0x26')](_0x2fd872)[_0x8260('0x27')](function(_0x4c078e){return _0x4c078e;});}return null;};}function removeEntity(_0x496152,_0x166aa0){return function(_0x4f3736){if(_0x4f3736){return _0x4f3736[_0x8260('0x28')]()[_0x8260('0x27')](function(){_0x496152[_0x8260('0x1a')](0xcc)[_0x8260('0x1b')]();});}};}function handleEntityNotFound(_0x279220,_0x303773){return function(_0x2e74a3){if(!_0x2e74a3){_0x279220['sendStatus'](0x194);}return _0x2e74a3;};}function handleError(_0x297aef,_0x32f40e){_0x32f40e=_0x32f40e||0x1f4;return function(_0x43def2){logger[_0x8260('0x29')](_0x43def2[_0x8260('0x2a')]);if(_0x43def2['name']){delete _0x43def2['name'];}_0x297aef['status'](_0x32f40e)[_0x8260('0x2b')](_0x43def2);};}exports['index']=function(_0x2e1cc3,_0x385889){var _0x3c3694={},_0x5e69f3={},_0x1bdf1c={'count':0x0,'rows':[]};var _0x319e32=_[_0x8260('0x2c')](db[_0x8260('0x2d')][_0x8260('0x2e')],function(_0x4c0f99){return{'name':_0x4c0f99[_0x8260('0x2f')],'type':_0x4c0f99[_0x8260('0x30')][_0x8260('0x31')]};});_0x5e69f3[_0x8260('0x32')]=_[_0x8260('0x2c')](_0x319e32,_0x8260('0x33'));_0x5e69f3[_0x8260('0x34')]=_[_0x8260('0x35')](_0x2e1cc3['query']);_0x5e69f3[_0x8260('0x36')]=_[_0x8260('0x37')](_0x5e69f3['model'],_0x5e69f3[_0x8260('0x34')]);_0x3c3694[_0x8260('0x38')]=_[_0x8260('0x37')](_0x5e69f3[_0x8260('0x32')],qs[_0x8260('0x39')](_0x2e1cc3[_0x8260('0x34')][_0x8260('0x39')]));_0x3c3694[_0x8260('0x38')]=_0x3c3694['attributes'][_0x8260('0x3a')]?_0x3c3694[_0x8260('0x38')]:_0x5e69f3['model'];if(!_0x2e1cc3[_0x8260('0x34')][_0x8260('0x3b')]('nolimit')){_0x3c3694[_0x8260('0x1f')]=qs[_0x8260('0x1f')](_0x2e1cc3[_0x8260('0x34')]['limit']);_0x3c3694[_0x8260('0x1d')]=qs[_0x8260('0x1d')](_0x2e1cc3['query'][_0x8260('0x1d')]);}_0x3c3694[_0x8260('0x3c')]=qs[_0x8260('0x3d')](_0x2e1cc3[_0x8260('0x34')]['sort']);_0x3c3694[_0x8260('0x3e')]=qs[_0x8260('0x36')](_[_0x8260('0x3f')](_0x2e1cc3[_0x8260('0x34')],_0x5e69f3[_0x8260('0x36')]),_0x319e32);if(_0x2e1cc3[_0x8260('0x34')][_0x8260('0x40')]){_0x3c3694[_0x8260('0x3e')]=_[_0x8260('0x41')](_0x3c3694[_0x8260('0x3e')],{'$or':_['map'](_0x319e32,function(_0xb94b4e){if(_0xb94b4e[_0x8260('0x30')]!==_0x8260('0x42')){var _0x2d9c09={};_0x2d9c09[_0xb94b4e[_0x8260('0x33')]]={'$like':'%'+_0x2e1cc3['query'][_0x8260('0x40')]+'%'};return _0x2d9c09;}})});}_0x3c3694=_[_0x8260('0x41')]({},_0x3c3694,_0x2e1cc3[_0x8260('0x43')]);var _0x20fbdf={'where':_0x3c3694[_0x8260('0x3e')]};return db[_0x8260('0x2d')][_0x8260('0x20')](_0x20fbdf)[_0x8260('0x27')](function(_0x639def){_0x1bdf1c[_0x8260('0x20')]=_0x639def;if(_0x2e1cc3[_0x8260('0x34')][_0x8260('0x44')]){_0x3c3694[_0x8260('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x3c3694);})[_0x8260('0x27')](function(_0x4ca9c4){_0x1bdf1c['rows']=_0x4ca9c4;return _0x1bdf1c;})[_0x8260('0x27')](respondWithFilteredResult(_0x385889,_0x3c3694))[_0x8260('0x46')](handleError(_0x385889,null));};exports[_0x8260('0x47')]=function(_0x5709ce,_0x5df650){var _0x4bd9af={'raw':![],'where':{'id':_0x5709ce['params']['id']}},_0x2479d6={};_0x2479d6[_0x8260('0x32')]=_[_0x8260('0x35')](db[_0x8260('0x2d')][_0x8260('0x2e')]);_0x2479d6['query']=_[_0x8260('0x35')](_0x5709ce[_0x8260('0x34')]);_0x2479d6[_0x8260('0x36')]=_[_0x8260('0x37')](_0x2479d6[_0x8260('0x32')],_0x2479d6[_0x8260('0x34')]);_0x4bd9af[_0x8260('0x38')]=_[_0x8260('0x37')](_0x2479d6['model'],qs[_0x8260('0x39')](_0x5709ce[_0x8260('0x34')][_0x8260('0x39')]));_0x4bd9af[_0x8260('0x38')]=_0x4bd9af[_0x8260('0x38')]['length']?_0x4bd9af[_0x8260('0x38')]:_0x2479d6[_0x8260('0x32')];if(_0x5709ce[_0x8260('0x34')][_0x8260('0x44')]){_0x4bd9af[_0x8260('0x45')]=[{'all':!![]}];}_0x4bd9af=_[_0x8260('0x41')]({},_0x4bd9af,_0x5709ce[_0x8260('0x43')]);return db[_0x8260('0x2d')][_0x8260('0x48')](_0x4bd9af)[_0x8260('0x27')](handleEntityNotFound(_0x5df650,null))[_0x8260('0x27')](respondWithResult(_0x5df650,null))[_0x8260('0x46')](handleError(_0x5df650,null));};exports[_0x8260('0x49')]=function(_0x177710,_0xe74626){return db[_0x8260('0x2d')]['create'](_0x177710['body'],{})[_0x8260('0x27')](respondWithResult(_0xe74626,0xc9))['catch'](handleError(_0xe74626,null));};exports['update']=function(_0x3f5927,_0x3f4d09){if(_0x3f5927[_0x8260('0x4a')]['id']){delete _0x3f5927[_0x8260('0x4a')]['id'];}return db[_0x8260('0x2d')][_0x8260('0x48')]({'where':{'id':_0x3f5927['params']['id']}})['then'](handleEntityNotFound(_0x3f4d09,null))[_0x8260('0x27')](saveUpdates(_0x3f5927['body'],null))['then'](respondWithResult(_0x3f4d09,null))[_0x8260('0x46')](handleError(_0x3f4d09,null));};exports[_0x8260('0x28')]=function(_0x1415fb,_0xb665af){return db[_0x8260('0x2d')][_0x8260('0x48')]({'where':{'id':_0x1415fb['params']['id']}})['then'](handleEntityNotFound(_0xb665af,null))[_0x8260('0x27')](removeEntity(_0xb665af,null))[_0x8260('0x46')](handleError(_0xb665af,null));};exports[_0x8260('0x4b')]=function(_0x2336d4,_0x54d16f,_0x334816){var _0x14dab0={};var _0x1dfeba={};var _0x3513a2;var _0xe6555a;return db[_0x8260('0x2d')][_0x8260('0x4c')]({'where':{'id':_0x2336d4['params']['id']}})[_0x8260('0x27')](handleEntityNotFound(_0x54d16f,null))[_0x8260('0x27')](function(_0x23a6cb){if(_0x23a6cb){_0x3513a2=_0x23a6cb;_0x1dfeba['model']=_[_0x8260('0x35')](db[_0x8260('0x4d')][_0x8260('0x2e')]);_0x1dfeba[_0x8260('0x34')]=_[_0x8260('0x35')](_0x2336d4[_0x8260('0x34')]);_0x1dfeba[_0x8260('0x36')]=_['intersection'](_0x1dfeba[_0x8260('0x32')],_0x1dfeba[_0x8260('0x34')]);_0x14dab0[_0x8260('0x38')]=_[_0x8260('0x37')](_0x1dfeba[_0x8260('0x32')],qs[_0x8260('0x39')](_0x2336d4[_0x8260('0x34')][_0x8260('0x39')]));_0x14dab0[_0x8260('0x38')]=_0x14dab0['attributes'][_0x8260('0x3a')]?_0x14dab0['attributes']:_0x1dfeba[_0x8260('0x32')];_0x14dab0[_0x8260('0x3c')]=qs[_0x8260('0x3d')](_0x2336d4[_0x8260('0x34')]['sort']);_0x14dab0['where']=qs[_0x8260('0x36')](_[_0x8260('0x3f')](_0x2336d4[_0x8260('0x34')],_0x1dfeba[_0x8260('0x36')]));if(_0x2336d4[_0x8260('0x34')][_0x8260('0x40')]){_0x14dab0[_0x8260('0x3e')]=_[_0x8260('0x41')](_0x14dab0['where'],{'$or':_[_0x8260('0x2c')](_0x14dab0['attributes'],function(_0x452bf9){var _0x304b64={};_0x304b64[_0x452bf9]={'$like':'%'+_0x2336d4[_0x8260('0x34')][_0x8260('0x40')]+'%'};return _0x304b64;})});}_0x14dab0=_['merge']({},_0x14dab0,_0x2336d4[_0x8260('0x43')]);return _0x3513a2[_0x8260('0x4b')](_0x14dab0);}})['then'](function(_0x3c46e8){if(_0x3c46e8){_0xe6555a=_0x3c46e8[_0x8260('0x3a')];if(!_0x2336d4[_0x8260('0x34')][_0x8260('0x3b')]('nolimit')){_0x14dab0['limit']=qs['limit'](_0x2336d4['query']['limit']);_0x14dab0[_0x8260('0x1d')]=qs['offset'](_0x2336d4['query'][_0x8260('0x1d')]);}return _0x3513a2['getConfigurations'](_0x14dab0);}})[_0x8260('0x27')](function(_0x1d4a8b){if(_0x1d4a8b){return _0x1d4a8b?{'count':_0xe6555a,'rows':_0x1d4a8b}:null;}})[_0x8260('0x27')](respondWithResult(_0x54d16f,null))[_0x8260('0x46')](handleError(_0x54d16f,null));};exports[_0x8260('0x4e')]=function(_0x4e7c2e,_0x2e0f5d,_0x25fb99){if(_0x4e7c2e[_0x8260('0x4a')]['id']){delete _0x4e7c2e[_0x8260('0x4a')]['id'];}return db[_0x8260('0x2d')][_0x8260('0x4c')]({'where':{'id':_0x4e7c2e['params']['id']}})[_0x8260('0x27')](handleEntityNotFound(_0x2e0f5d,null))['then'](function(_0x47a38a){if(_0x47a38a){_0x4e7c2e[_0x8260('0x4a')]['AccountId']=_0x47a38a['id'];_0x4e7c2e['body'][_0x8260('0x4f')]=integrations[_0x8260('0x50')](_0x4e7c2e[_0x8260('0x4a')][_0x8260('0x51')],_0x4e7c2e[_0x8260('0x4a')][_0x8260('0x30')]);_0x4e7c2e[_0x8260('0x4a')]['Descriptions']=integrations[_0x8260('0x52')](_0x4e7c2e[_0x8260('0x4a')][_0x8260('0x51')],_0x4e7c2e[_0x8260('0x4a')][_0x8260('0x30')]);return db[_0x8260('0x4d')]['create'](_0x4e7c2e[_0x8260('0x4a')],{'include':[{'model':db[_0x8260('0x53')],'as':_0x8260('0x4f')},{'model':db[_0x8260('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2e0f5d,null))[_0x8260('0x46')](handleError(_0x2e0f5d,null));};exports['getFields']=function(_0x53ff9f,_0x124c82,_0x2dc603){var _0x26f023='';var _0x1f4ef6=['id',_0x8260('0x33'),'assigned_user_id',_0x8260('0x54'),_0x8260('0x55'),_0x8260('0x56'),_0x8260('0x57'),'duration_minutes',_0x8260('0x58'),_0x8260('0x59'),_0x8260('0x5a'),_0x8260('0x5b')];return db[_0x8260('0x2d')][_0x8260('0x4c')]({'where':{'id':_0x53ff9f['params']['id']},'attributes':['id',_0x8260('0x5c'),_0x8260('0x5d'),_0x8260('0x5e')]})[_0x8260('0x27')](handleEntityNotFound(_0x124c82,null))['then'](function(_0x244c29){if(_0x244c29){_0x26f023=_0x244c29[_0x8260('0x5e')];var _0x209da9=_0x26f023[_0x8260('0x5f')](-0x1);if(_0x209da9==='/'){_0x26f023=_0x26f023[_0x8260('0x60')](0x0,_0x26f023[_0x8260('0x61')](_0x209da9));}return rp({'method':_0x8260('0x62'),'uri':util[_0x8260('0x63')](_0x8260('0x64'),_0x26f023,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8260('0x65'),'input_type':_0x8260('0x66'),'response_type':_0x8260('0x66'),'rest_data':JSON[_0x8260('0x67')]({'user_auth':{'user_name':_0x244c29[_0x8260('0x5c')],'password':_0x244c29[_0x8260('0x5d')],'encryption':_0x8260('0x68')},'application':_0x8260('0x69')})}});}})[_0x8260('0x27')](function(_0x22c405){if(_0x22c405&&_0x22c405['name']!==_0x8260('0x6a')&&_0x22c405[_0x8260('0x33')]!==_0x8260('0x6b')){return rp({'method':_0x8260('0x62'),'uri':util[_0x8260('0x63')](_0x8260('0x64'),_0x26f023,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8260('0x6c'),'input_type':_0x8260('0x66'),'response_type':_0x8260('0x66'),'rest_data':JSON[_0x8260('0x67')]({'session':_0x22c405['id'],'module_name':_0x8260('0x6d')})}})[_0x8260('0x27')](function(_0x43a1b0){if(_0x43a1b0){var _0x4e6ce4=_['values'](_0x43a1b0['module_fields']);_['remove'](_0x4e6ce4,function(_0x563bd1){return _0x1f4ef6[_0x8260('0x6e')](_0x563bd1['name']);});return{'count':_0x4e6ce4['length'],'rows':_[_0x8260('0x2c')](_0x4e6ce4,function(_0x20a63c){return{'id':_0x20a63c[_0x8260('0x33')],'name':_0x20a63c[_0x8260('0x6f')],'custom':_['endsWith'](_0x20a63c['name'],'_c')?!![]:![],'options':_0x20a63c[_0x8260('0x43')]?_[_0x8260('0x2c')](_[_0x8260('0x70')](_0x20a63c['options']),function(_0x4c6989){return{'name':_0x4c6989[_0x8260('0x71')],'value':_0x4c6989[_0x8260('0x33')]};}):[]};})};}})[_0x8260('0x27')](respondWithResult(_0x124c82,null))['catch'](function(_0x25fc1d){var _0x60be28=_0x53ff9f[_0x8260('0x34')][_0x8260('0x72')]?0x1f4:_0x25fc1d[_0x8260('0x73')]||0x1f4;logger[_0x8260('0x29')](_0x8260('0x74'),_0x8260('0x75'),_0x60be28,JSON[_0x8260('0x67')](_0x25fc1d));delete _0x25fc1d['name'];if(_0x60be28===0x191){_0x60be28=0x190;}_0x124c82['status'](_0x60be28)['send'](_0x53ff9f[_0x8260('0x34')][_0x8260('0x72')]?{'message':_0x8260('0x76'),'statusCode':_0x25fc1d[_0x8260('0x73')]}:_0x25fc1d);});}else{var _0x35e860=0x1f4;_0x124c82[_0x8260('0x1a')](_0x35e860)[_0x8260('0x2b')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x3f2f=['rows','catch','show','params','include','options','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','values','module_fields','remove','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll'];(function(_0x4bc110,_0x338663){var _0x2aa7c5=function(_0x346763){while(--_0x346763){_0x4bc110['push'](_0x4bc110['shift']());}};_0x2aa7c5(++_0x338663);}(_0x3f2f,0xb7));var _0xf3f2=function(_0x126a46,_0x2fcfcd){_0x126a46=_0x126a46-0x0;var _0xbe5786=_0x3f2f[_0x126a46];return _0xbe5786;};'use strict';var emlformat=require(_0xf3f2('0x0'));var rimraf=require(_0xf3f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3f2('0x2'));var moment=require(_0xf3f2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf3f2('0x4'));var util=require(_0xf3f2('0x5'));var path=require('path');var sox=require(_0xf3f2('0x6'));var csv=require(_0xf3f2('0x7'));var ejs=require(_0xf3f2('0x8'));var fs=require('fs');var fs_extra=require(_0xf3f2('0x9'));var _=require(_0xf3f2('0xa'));var squel=require(_0xf3f2('0xb'));var crypto=require(_0xf3f2('0xc'));var jsforce=require(_0xf3f2('0xd'));var deskjs=require(_0xf3f2('0xe'));var toCsv=require(_0xf3f2('0x7'));var querystring=require('querystring');var Papa=require(_0xf3f2('0xf'));var Redis=require(_0xf3f2('0x10'));var authService=require(_0xf3f2('0x11'));var qs=require(_0xf3f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3f2('0x13'));var logger=require(_0xf3f2('0x14'))(_0xf3f2('0x15'));var utils=require(_0xf3f2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf3f2('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x186bc7,_0x26cf40){_0x26cf40=_0x26cf40||0xcc;return function(_0x51a386){if(_0x51a386){return _0x186bc7[_0xf3f2('0x18')](_0x26cf40);}return _0x186bc7['status'](_0x26cf40)[_0xf3f2('0x19')]();};}function respondWithResult(_0x21ac1f,_0x35c3e6){_0x35c3e6=_0x35c3e6||0xc8;return function(_0x48abb6){if(_0x48abb6){return _0x21ac1f[_0xf3f2('0x1a')](_0x35c3e6)[_0xf3f2('0x1b')](_0x48abb6);}};}function respondWithFilteredResult(_0x26f5c1,_0x196ab1){return function(_0x16c140){if(_0x16c140){var _0x56ca8f=typeof _0x196ab1[_0xf3f2('0x1c')]===_0xf3f2('0x1d')&&typeof _0x196ab1['limit']==='undefined';var _0x1e113d=_0x16c140[_0xf3f2('0x1e')];var _0xb1afe7=_0x56ca8f?0x0:_0x196ab1[_0xf3f2('0x1c')];var _0x551403=_0x56ca8f?_0x16c140['count']:_0x196ab1[_0xf3f2('0x1c')]+_0x196ab1[_0xf3f2('0x1f')];var _0x546a42;if(_0x551403>=_0x1e113d){_0x551403=_0x1e113d;_0x546a42=0xc8;}else{_0x546a42=0xce;}_0x26f5c1[_0xf3f2('0x1a')](_0x546a42);return _0x26f5c1[_0xf3f2('0x20')](_0xf3f2('0x21'),_0xb1afe7+'-'+_0x551403+'/'+_0x1e113d)['json'](_0x16c140);}return null;};}function patchUpdates(_0x4ec7f5){return function(_0x10061f){try{jsonpatch[_0xf3f2('0x22')](_0x10061f,_0x4ec7f5,!![]);}catch(_0xd76c17){return BPromise['reject'](_0xd76c17);}return _0x10061f[_0xf3f2('0x23')]();};}function saveUpdates(_0x57fff0,_0x493943){return function(_0x34c278){if(_0x34c278){return _0x34c278[_0xf3f2('0x24')](_0x57fff0)[_0xf3f2('0x25')](function(_0x3914a4){return _0x3914a4;});}return null;};}function removeEntity(_0x4ab3cc,_0x394fae){return function(_0x572427){if(_0x572427){return _0x572427[_0xf3f2('0x26')]()[_0xf3f2('0x25')](function(){_0x4ab3cc['status'](0xcc)[_0xf3f2('0x19')]();});}};}function handleEntityNotFound(_0xca7727,_0x5104c0){return function(_0x273295){if(!_0x273295){_0xca7727['sendStatus'](0x194);}return _0x273295;};}function handleError(_0x3a04dd,_0x5cdc7c){_0x5cdc7c=_0x5cdc7c||0x1f4;return function(_0x193899){logger[_0xf3f2('0x27')](_0x193899[_0xf3f2('0x28')]);if(_0x193899[_0xf3f2('0x29')]){delete _0x193899[_0xf3f2('0x29')];}_0x3a04dd['status'](_0x5cdc7c)[_0xf3f2('0x2a')](_0x193899);};}exports[_0xf3f2('0x2b')]=function(_0x4f6182,_0x565991){var _0x45d646={},_0x550b97={},_0x4b2053={'count':0x0,'rows':[]};var _0x2cd581=_['map'](db[_0xf3f2('0x2c')][_0xf3f2('0x2d')],function(_0x3561d0){return{'name':_0x3561d0['fieldName'],'type':_0x3561d0[_0xf3f2('0x2e')][_0xf3f2('0x2f')]};});_0x550b97['model']=_[_0xf3f2('0x30')](_0x2cd581,'name');_0x550b97[_0xf3f2('0x31')]=_[_0xf3f2('0x32')](_0x4f6182[_0xf3f2('0x31')]);_0x550b97[_0xf3f2('0x33')]=_[_0xf3f2('0x34')](_0x550b97[_0xf3f2('0x35')],_0x550b97[_0xf3f2('0x31')]);_0x45d646[_0xf3f2('0x36')]=_['intersection'](_0x550b97[_0xf3f2('0x35')],qs[_0xf3f2('0x37')](_0x4f6182[_0xf3f2('0x31')]['fields']));_0x45d646[_0xf3f2('0x36')]=_0x45d646[_0xf3f2('0x36')]['length']?_0x45d646[_0xf3f2('0x36')]:_0x550b97[_0xf3f2('0x35')];if(!_0x4f6182[_0xf3f2('0x31')][_0xf3f2('0x38')](_0xf3f2('0x39'))){_0x45d646[_0xf3f2('0x1f')]=qs['limit'](_0x4f6182[_0xf3f2('0x31')][_0xf3f2('0x1f')]);_0x45d646[_0xf3f2('0x1c')]=qs[_0xf3f2('0x1c')](_0x4f6182[_0xf3f2('0x31')]['offset']);}_0x45d646[_0xf3f2('0x3a')]=qs[_0xf3f2('0x3b')](_0x4f6182[_0xf3f2('0x31')]['sort']);_0x45d646[_0xf3f2('0x3c')]=qs['filters'](_[_0xf3f2('0x3d')](_0x4f6182[_0xf3f2('0x31')],_0x550b97['filters']),_0x2cd581);if(_0x4f6182[_0xf3f2('0x31')]['filter']){_0x45d646[_0xf3f2('0x3c')]=_[_0xf3f2('0x3e')](_0x45d646['where'],{'$or':_[_0xf3f2('0x30')](_0x2cd581,function(_0x3a262d){if(_0x3a262d['type']!==_0xf3f2('0x3f')){var _0xbc199b={};_0xbc199b[_0x3a262d[_0xf3f2('0x29')]]={'$like':'%'+_0x4f6182[_0xf3f2('0x31')][_0xf3f2('0x40')]+'%'};return _0xbc199b;}})});}_0x45d646=_[_0xf3f2('0x3e')]({},_0x45d646,_0x4f6182['options']);var _0x183297={'where':_0x45d646['where']};return db[_0xf3f2('0x2c')]['count'](_0x183297)[_0xf3f2('0x25')](function(_0x2706d1){_0x4b2053['count']=_0x2706d1;if(_0x4f6182[_0xf3f2('0x31')][_0xf3f2('0x41')]){_0x45d646['include']=[{'all':!![]}];}return db[_0xf3f2('0x2c')][_0xf3f2('0x42')](_0x45d646);})[_0xf3f2('0x25')](function(_0x4b30b2){_0x4b2053[_0xf3f2('0x43')]=_0x4b30b2;return _0x4b2053;})['then'](respondWithFilteredResult(_0x565991,_0x45d646))[_0xf3f2('0x44')](handleError(_0x565991,null));};exports[_0xf3f2('0x45')]=function(_0x5c258a,_0x22e668){var _0x5ba50f={'raw':![],'where':{'id':_0x5c258a[_0xf3f2('0x46')]['id']}},_0x5a1b87={};_0x5a1b87[_0xf3f2('0x35')]=_[_0xf3f2('0x32')](db[_0xf3f2('0x2c')][_0xf3f2('0x2d')]);_0x5a1b87[_0xf3f2('0x31')]=_[_0xf3f2('0x32')](_0x5c258a[_0xf3f2('0x31')]);_0x5a1b87[_0xf3f2('0x33')]=_['intersection'](_0x5a1b87[_0xf3f2('0x35')],_0x5a1b87[_0xf3f2('0x31')]);_0x5ba50f['attributes']=_['intersection'](_0x5a1b87[_0xf3f2('0x35')],qs[_0xf3f2('0x37')](_0x5c258a['query'][_0xf3f2('0x37')]));_0x5ba50f['attributes']=_0x5ba50f[_0xf3f2('0x36')]['length']?_0x5ba50f[_0xf3f2('0x36')]:_0x5a1b87[_0xf3f2('0x35')];if(_0x5c258a[_0xf3f2('0x31')][_0xf3f2('0x41')]){_0x5ba50f[_0xf3f2('0x47')]=[{'all':!![]}];}_0x5ba50f=_['merge']({},_0x5ba50f,_0x5c258a[_0xf3f2('0x48')]);return db[_0xf3f2('0x2c')][_0xf3f2('0x49')](_0x5ba50f)['then'](handleEntityNotFound(_0x22e668,null))['then'](respondWithResult(_0x22e668,null))['catch'](handleError(_0x22e668,null));};exports['create']=function(_0x30e017,_0x3be5fb){return db[_0xf3f2('0x2c')][_0xf3f2('0x4a')](_0x30e017[_0xf3f2('0x4b')],{})[_0xf3f2('0x25')](respondWithResult(_0x3be5fb,0xc9))[_0xf3f2('0x44')](handleError(_0x3be5fb,null));};exports[_0xf3f2('0x24')]=function(_0x14a40e,_0x2d511e){if(_0x14a40e[_0xf3f2('0x4b')]['id']){delete _0x14a40e[_0xf3f2('0x4b')]['id'];}return db[_0xf3f2('0x2c')][_0xf3f2('0x49')]({'where':{'id':_0x14a40e[_0xf3f2('0x46')]['id']}})[_0xf3f2('0x25')](handleEntityNotFound(_0x2d511e,null))[_0xf3f2('0x25')](saveUpdates(_0x14a40e[_0xf3f2('0x4b')],null))[_0xf3f2('0x25')](respondWithResult(_0x2d511e,null))[_0xf3f2('0x44')](handleError(_0x2d511e,null));};exports[_0xf3f2('0x26')]=function(_0x70ed18,_0x19c8b4){return db[_0xf3f2('0x2c')]['find']({'where':{'id':_0x70ed18['params']['id']}})[_0xf3f2('0x25')](handleEntityNotFound(_0x19c8b4,null))['then'](removeEntity(_0x19c8b4,null))[_0xf3f2('0x44')](handleError(_0x19c8b4,null));};exports[_0xf3f2('0x4c')]=function(_0x41408b,_0x4c5c66,_0x22c797){var _0x41d9ce={};var _0x30a1a2={};var _0x1bf6f7;var _0x4637c5;return db[_0xf3f2('0x2c')][_0xf3f2('0x4d')]({'where':{'id':_0x41408b[_0xf3f2('0x46')]['id']}})[_0xf3f2('0x25')](handleEntityNotFound(_0x4c5c66,null))[_0xf3f2('0x25')](function(_0x49798f){if(_0x49798f){_0x1bf6f7=_0x49798f;_0x30a1a2[_0xf3f2('0x35')]=_[_0xf3f2('0x32')](db[_0xf3f2('0x4e')][_0xf3f2('0x2d')]);_0x30a1a2[_0xf3f2('0x31')]=_[_0xf3f2('0x32')](_0x41408b[_0xf3f2('0x31')]);_0x30a1a2['filters']=_[_0xf3f2('0x34')](_0x30a1a2[_0xf3f2('0x35')],_0x30a1a2['query']);_0x41d9ce['attributes']=_[_0xf3f2('0x34')](_0x30a1a2[_0xf3f2('0x35')],qs[_0xf3f2('0x37')](_0x41408b[_0xf3f2('0x31')][_0xf3f2('0x37')]));_0x41d9ce[_0xf3f2('0x36')]=_0x41d9ce['attributes'][_0xf3f2('0x4f')]?_0x41d9ce[_0xf3f2('0x36')]:_0x30a1a2[_0xf3f2('0x35')];_0x41d9ce['order']=qs[_0xf3f2('0x3b')](_0x41408b[_0xf3f2('0x31')][_0xf3f2('0x3b')]);_0x41d9ce[_0xf3f2('0x3c')]=qs[_0xf3f2('0x33')](_[_0xf3f2('0x3d')](_0x41408b[_0xf3f2('0x31')],_0x30a1a2[_0xf3f2('0x33')]));if(_0x41408b[_0xf3f2('0x31')][_0xf3f2('0x40')]){_0x41d9ce[_0xf3f2('0x3c')]=_[_0xf3f2('0x3e')](_0x41d9ce[_0xf3f2('0x3c')],{'$or':_['map'](_0x41d9ce[_0xf3f2('0x36')],function(_0x27364d){var _0x3b302e={};_0x3b302e[_0x27364d]={'$like':'%'+_0x41408b['query']['filter']+'%'};return _0x3b302e;})});}_0x41d9ce=_[_0xf3f2('0x3e')]({},_0x41d9ce,_0x41408b[_0xf3f2('0x48')]);return _0x1bf6f7[_0xf3f2('0x4c')](_0x41d9ce);}})[_0xf3f2('0x25')](function(_0x312e7b){if(_0x312e7b){_0x4637c5=_0x312e7b[_0xf3f2('0x4f')];if(!_0x41408b[_0xf3f2('0x31')][_0xf3f2('0x38')]('nolimit')){_0x41d9ce[_0xf3f2('0x1f')]=qs['limit'](_0x41408b[_0xf3f2('0x31')][_0xf3f2('0x1f')]);_0x41d9ce[_0xf3f2('0x1c')]=qs[_0xf3f2('0x1c')](_0x41408b[_0xf3f2('0x31')][_0xf3f2('0x1c')]);}return _0x1bf6f7['getConfigurations'](_0x41d9ce);}})[_0xf3f2('0x25')](function(_0x3eb696){if(_0x3eb696){return _0x3eb696?{'count':_0x4637c5,'rows':_0x3eb696}:null;}})[_0xf3f2('0x25')](respondWithResult(_0x4c5c66,null))['catch'](handleError(_0x4c5c66,null));};exports[_0xf3f2('0x50')]=function(_0x1bc5ef,_0x5b33fc,_0x4b67ca){if(_0x1bc5ef[_0xf3f2('0x4b')]['id']){delete _0x1bc5ef[_0xf3f2('0x4b')]['id'];}return db[_0xf3f2('0x2c')][_0xf3f2('0x4d')]({'where':{'id':_0x1bc5ef['params']['id']}})[_0xf3f2('0x25')](handleEntityNotFound(_0x5b33fc,null))['then'](function(_0xa12ffb){if(_0xa12ffb){_0x1bc5ef['body'][_0xf3f2('0x51')]=_0xa12ffb['id'];_0x1bc5ef[_0xf3f2('0x4b')][_0xf3f2('0x52')]=integrations[_0xf3f2('0x53')](_0x1bc5ef['body'][_0xf3f2('0x54')],_0x1bc5ef[_0xf3f2('0x4b')][_0xf3f2('0x2e')]);_0x1bc5ef[_0xf3f2('0x4b')][_0xf3f2('0x55')]=integrations[_0xf3f2('0x56')](_0x1bc5ef[_0xf3f2('0x4b')][_0xf3f2('0x54')],_0x1bc5ef[_0xf3f2('0x4b')][_0xf3f2('0x2e')]);return db['SugarcrmConfiguration']['create'](_0x1bc5ef['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xf3f2('0x52')},{'model':db[_0xf3f2('0x57')],'as':_0xf3f2('0x55')}]});}return null;})[_0xf3f2('0x25')](respondWithResult(_0x5b33fc,null))[_0xf3f2('0x44')](handleError(_0x5b33fc,null));};exports[_0xf3f2('0x58')]=function(_0x15793e,_0x3d726f,_0x390d45){var _0x570d51='';var _0xd786e3=['id',_0xf3f2('0x29'),'assigned_user_id',_0xf3f2('0x59'),_0xf3f2('0x5a'),_0xf3f2('0x5b'),_0xf3f2('0x5c'),_0xf3f2('0x5d'),_0xf3f2('0x5e'),_0xf3f2('0x5f'),_0xf3f2('0x60'),_0xf3f2('0x61')];return db[_0xf3f2('0x2c')]['findOne']({'where':{'id':_0x15793e[_0xf3f2('0x46')]['id']},'attributes':['id',_0xf3f2('0x62'),_0xf3f2('0x63'),'remoteUri']})[_0xf3f2('0x25')](handleEntityNotFound(_0x3d726f,null))['then'](function(_0x567948){if(_0x567948){_0x570d51=_0x567948[_0xf3f2('0x64')];var _0x31d313=_0x570d51[_0xf3f2('0x65')](-0x1);if(_0x31d313==='/'){_0x570d51=_0x570d51[_0xf3f2('0x66')](0x0,_0x570d51[_0xf3f2('0x67')](_0x31d313));}return rp({'method':_0xf3f2('0x68'),'uri':util[_0xf3f2('0x69')]('%s%s',_0x570d51,_0xf3f2('0x6a')),'json':!![],'form':{'method':_0xf3f2('0x6b'),'input_type':_0xf3f2('0x6c'),'response_type':_0xf3f2('0x6c'),'rest_data':JSON[_0xf3f2('0x6d')]({'user_auth':{'user_name':_0x567948[_0xf3f2('0x62')],'password':_0x567948[_0xf3f2('0x63')],'encryption':_0xf3f2('0x6e')},'application':_0xf3f2('0x6f')})}});}})[_0xf3f2('0x25')](function(_0x2e6870){if(_0x2e6870&&_0x2e6870[_0xf3f2('0x29')]!==_0xf3f2('0x70')&&_0x2e6870[_0xf3f2('0x29')]!==_0xf3f2('0x71')){return rp({'method':'POST','uri':util[_0xf3f2('0x69')](_0xf3f2('0x72'),_0x570d51,_0xf3f2('0x6a')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xf3f2('0x6c'),'response_type':'JSON','rest_data':JSON[_0xf3f2('0x6d')]({'session':_0x2e6870['id'],'module_name':'Calls'})}})['then'](function(_0x1498ac){if(_0x1498ac){var _0xaf366f=_[_0xf3f2('0x73')](_0x1498ac[_0xf3f2('0x74')]);_[_0xf3f2('0x75')](_0xaf366f,function(_0x44b64d){return _0xd786e3[_0xf3f2('0x76')](_0x44b64d['name']);});return{'count':_0xaf366f['length'],'rows':_[_0xf3f2('0x30')](_0xaf366f,function(_0x794579){return{'id':_0x794579[_0xf3f2('0x29')],'name':_0x794579[_0xf3f2('0x77')],'custom':_['endsWith'](_0x794579['name'],'_c')?!![]:![],'options':_0x794579[_0xf3f2('0x48')]?_[_0xf3f2('0x30')](_['values'](_0x794579['options']),function(_0x2edc61){return{'name':_0x2edc61[_0xf3f2('0x78')],'value':_0x2edc61[_0xf3f2('0x29')]};}):[]};})};}})[_0xf3f2('0x25')](respondWithResult(_0x3d726f,null))[_0xf3f2('0x44')](function(_0x2e13d8){var _0x4c6af3=_0x15793e[_0xf3f2('0x31')][_0xf3f2('0x79')]?0x1f4:_0x2e13d8[_0xf3f2('0x7a')]||0x1f4;logger['error'](_0xf3f2('0x7b'),_0xf3f2('0x58'),_0x4c6af3,JSON[_0xf3f2('0x6d')](_0x2e13d8));delete _0x2e13d8[_0xf3f2('0x29')];if(_0x4c6af3===0x191){_0x4c6af3=0x190;}_0x3d726f[_0xf3f2('0x1a')](_0x4c6af3)[_0xf3f2('0x2a')](_0x15793e[_0xf3f2('0x31')]['test']?{'message':_0xf3f2('0x7c'),'statusCode':_0x2e13d8[_0xf3f2('0x7a')]}:_0x2e13d8);});}else{var _0x2179b1=0x1f4;_0x3d726f['status'](_0x2179b1)[_0xf3f2('0x2a')]({'message':_0xf3f2('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 80a27ed..f04e1ff 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x420d=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0x420d,0xb3));var _0xd420=function(_0x1290ec,_0x54e63f){_0x1290ec=_0x1290ec-0x0;var _0x321aed=_0x420d[_0x1290ec];return _0x321aed;};'use strict';var _=require(_0xd420('0x0'));var util=require(_0xd420('0x1'));var logger=require(_0xd420('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd420('0x3'));var rp=require(_0xd420('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd420('0x5'));var config=require(_0xd420('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xd420('0x7'));module[_0xd420('0x8')]=function(_0x4e7ac5,_0x170d65){return _0x4e7ac5[_0xd420('0x9')](_0xd420('0xa'),attributes,{'tableName':_0xd420('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9769=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','api','moment','bluebird'];(function(_0x21cdbb,_0xed5c39){var _0x4cd127=function(_0x1cfcf8){while(--_0x1cfcf8){_0x21cdbb['push'](_0x21cdbb['shift']());}};_0x4cd127(++_0xed5c39);}(_0x9769,0x74));var _0x9976=function(_0x4a642a,_0x1b9207){_0x4a642a=_0x4a642a-0x0;var _0x3388bf=_0x9769[_0x4a642a];return _0x3388bf;};'use strict';var _=require('lodash');var util=require(_0x9976('0x0'));var logger=require('../../config/logger')(_0x9976('0x1'));var moment=require(_0x9976('0x2'));var BPromise=require(_0x9976('0x3'));var rp=require(_0x9976('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9976('0x5'));var config=require(_0x9976('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x9976('0x7'));module[_0x9976('0x8')]=function(_0x3a9c2b,_0xc74767){return _0x3a9c2b[_0x9976('0x9')](_0x9976('0xa'),attributes,{'tableName':_0x9976('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 54858fc..77801ff 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x309d=['catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowSugarcrmAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x212579,_0xdb4d5a){var _0x55d50e=function(_0x38fa1d){while(--_0x38fa1d){_0x212579['push'](_0x212579['shift']());}};_0x55d50e(++_0xdb4d5a);}(_0x309d,0x1d7));var _0xd309=function(_0x1095b4,_0x5718a8){_0x1095b4=_0x1095b4-0x0;var _0xc51516=_0x309d[_0x1095b4];return _0xc51516;};'use strict';var _=require(_0xd309('0x0'));var util=require(_0xd309('0x1'));var moment=require('moment');var BPromise=require(_0xd309('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd309('0x3'));var db=require(_0xd309('0x4'))['db'];var utils=require(_0xd309('0x5'));var logger=require(_0xd309('0x6'))(_0xd309('0x7'));var config=require(_0xd309('0x8'));var jayson=require(_0xd309('0x9'));var client=jayson[_0xd309('0xa')][_0xd309('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x170a6e,_0x2a9b52,_0x4d61bf){return new BPromise(function(_0x261d8e,_0x572590){return client[_0xd309('0xc')](_0x170a6e,_0x4d61bf)['then'](function(_0x45b06b){logger[_0xd309('0xd')](_0xd309('0xe'),_0x2a9b52,'request\x20sent');logger[_0xd309('0xf')](_0xd309('0x10'),_0x2a9b52,_0xd309('0x11'),JSON[_0xd309('0x12')](_0x45b06b));if(_0x45b06b[_0xd309('0x13')]){if(_0x45b06b[_0xd309('0x13')][_0xd309('0x14')]===0x1f4){logger[_0xd309('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a9b52,_0x45b06b[_0xd309('0x13')][_0xd309('0x15')]);return _0x572590(_0x45b06b[_0xd309('0x13')][_0xd309('0x15')]);}logger[_0xd309('0x13')](_0xd309('0xe'),_0x2a9b52,_0x45b06b[_0xd309('0x13')][_0xd309('0x15')]);return _0x261d8e(_0x45b06b[_0xd309('0x13')]['message']);}else{logger[_0xd309('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x2a9b52,'request\x20sent');_0x261d8e(_0x45b06b[_0xd309('0x16')]['message']);}})[_0xd309('0x17')](function(_0x5242bb){logger[_0xd309('0x13')](_0xd309('0xe'),_0x2a9b52,_0x5242bb);_0x572590(_0x5242bb);});});}exports[_0xd309('0x18')]=function(_0x266384){var _0x6627a7=this;return new Promise(function(_0x3a4a16,_0x5cfb69){return db[_0xd309('0x19')][_0xd309('0x1a')]({'raw':_0x266384['options']?_0x266384[_0xd309('0x1b')][_0xd309('0x1c')]===undefined?!![]:![]:!![],'where':_0x266384[_0xd309('0x1b')]?_0x266384[_0xd309('0x1b')][_0xd309('0x1d')]||null:null,'attributes':_0x266384['options']?_0x266384[_0xd309('0x1b')][_0xd309('0x1e')]||null:null,'limit':_0x266384[_0xd309('0x1b')]?_0x266384[_0xd309('0x1b')][_0xd309('0x1f')]||null:null,'include':_0x266384[_0xd309('0x1b')]?_0x266384[_0xd309('0x1b')][_0xd309('0x20')]?_['map'](_0x266384[_0xd309('0x1b')][_0xd309('0x20')],function(_0x442ad0){return{'model':db[_0x442ad0[_0xd309('0x21')]],'as':_0x442ad0['as'],'attributes':_0x442ad0[_0xd309('0x1e')],'include':_0x442ad0[_0xd309('0x20')]?_[_0xd309('0x22')](_0x442ad0[_0xd309('0x20')],function(_0x2b8211){return{'model':db[_0x2b8211[_0xd309('0x21')]],'as':_0x2b8211['as'],'attributes':_0x2b8211[_0xd309('0x1e')],'include':_0x2b8211[_0xd309('0x20')]?_[_0xd309('0x22')](_0x2b8211[_0xd309('0x20')],function(_0x83ff14){return{'model':db[_0x83ff14[_0xd309('0x21')]],'as':_0x83ff14['as'],'attributes':_0x83ff14[_0xd309('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd309('0x23')](function(_0x47ce31){logger[_0xd309('0xd')]('GetSugarcrmAccount',_0x266384);logger[_0xd309('0xf')](_0xd309('0x18'),_0x266384,JSON[_0xd309('0x12')](_0x47ce31));_0x3a4a16(_0x47ce31);})['catch'](function(_0xe82ba3){logger['error'](_0xd309('0x18'),_0xe82ba3['message'],_0x266384);_0x5cfb69(_0x6627a7['error'](0x1f4,_0xe82ba3['message']));});});};exports[_0xd309('0x24')]=function(_0x5f0b32){var _0x3c95bb=this;return new Promise(function(_0x54317e,_0x4324ae){return db[_0xd309('0x19')][_0xd309('0x25')]({'raw':_0x5f0b32[_0xd309('0x1b')]?_0x5f0b32[_0xd309('0x1b')][_0xd309('0x1c')]===undefined?!![]:![]:!![],'where':_0x5f0b32[_0xd309('0x1b')]?_0x5f0b32[_0xd309('0x1b')]['where']||null:null,'attributes':_0x5f0b32[_0xd309('0x1b')]?_0x5f0b32['options'][_0xd309('0x1e')]||null:null,'include':_0x5f0b32[_0xd309('0x1b')]?_0x5f0b32[_0xd309('0x1b')][_0xd309('0x20')]?_[_0xd309('0x22')](_0x5f0b32['options'][_0xd309('0x20')],function(_0x5e322d){return{'model':db[_0x5e322d['model']],'as':_0x5e322d['as'],'attributes':_0x5e322d[_0xd309('0x1e')],'include':_0x5e322d[_0xd309('0x20')]?_[_0xd309('0x22')](_0x5e322d[_0xd309('0x20')],function(_0x1d77d4){return{'model':db[_0x1d77d4[_0xd309('0x21')]],'as':_0x1d77d4['as'],'attributes':_0x1d77d4[_0xd309('0x1e')],'include':_0x1d77d4['include']?_['map'](_0x1d77d4['include'],function(_0x2ae15f){return{'model':db[_0x2ae15f[_0xd309('0x21')]],'as':_0x2ae15f['as'],'attributes':_0x2ae15f[_0xd309('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd309('0x23')](function(_0xf12e1d){logger[_0xd309('0xd')](_0xd309('0x24'),_0x5f0b32);logger[_0xd309('0xf')](_0xd309('0x24'),_0x5f0b32,JSON[_0xd309('0x12')](_0xf12e1d));_0x54317e(_0xf12e1d);})[_0xd309('0x17')](function(_0x12ab0c){logger[_0xd309('0x13')](_0xd309('0x24'),_0x12ab0c['message'],_0x5f0b32);_0x4324ae(_0x3c95bb[_0xd309('0x13')](0x1f4,_0x12ab0c[_0xd309('0x15')]));});});}; \ No newline at end of file +var _0x29d6=['stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','limit','include','model','attributes','map','ShowSugarcrmAccount','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x29d6,0x1ee));var _0x629d=function(_0x1d6880,_0x5e0d05){_0x1d6880=_0x1d6880-0x0;var _0x24f427=_0x29d6[_0x1d6880];return _0x24f427;};'use strict';var _=require(_0x629d('0x0'));var util=require('util');var moment=require(_0x629d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x629d('0x2'))['db'];var utils=require(_0x629d('0x3'));var logger=require(_0x629d('0x4'))(_0x629d('0x5'));var config=require(_0x629d('0x6'));var jayson=require(_0x629d('0x7'));var client=jayson['client'][_0x629d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11a4a0,_0x23786f,_0x58eca1){return new BPromise(function(_0xdb1e2f,_0x45418a){return client[_0x629d('0x9')](_0x11a4a0,_0x58eca1)[_0x629d('0xa')](function(_0x5bb255){logger[_0x629d('0xb')](_0x629d('0xc'),_0x23786f,'request\x20sent');logger[_0x629d('0xd')](_0x629d('0xe'),_0x23786f,_0x629d('0xf'),JSON[_0x629d('0x10')](_0x5bb255));if(_0x5bb255[_0x629d('0x11')]){if(_0x5bb255[_0x629d('0x11')][_0x629d('0x12')]===0x1f4){logger[_0x629d('0x11')](_0x629d('0xc'),_0x23786f,_0x5bb255[_0x629d('0x11')][_0x629d('0x13')]);return _0x45418a(_0x5bb255['error'][_0x629d('0x13')]);}logger[_0x629d('0x11')](_0x629d('0xc'),_0x23786f,_0x5bb255['error'][_0x629d('0x13')]);return _0xdb1e2f(_0x5bb255[_0x629d('0x11')][_0x629d('0x13')]);}else{logger[_0x629d('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x23786f,'request\x20sent');_0xdb1e2f(_0x5bb255[_0x629d('0x14')][_0x629d('0x13')]);}})[_0x629d('0x15')](function(_0x482576){logger[_0x629d('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x23786f,_0x482576);_0x45418a(_0x482576);});});}exports[_0x629d('0x16')]=function(_0x4a016e){var _0x1a1c24=this;return new Promise(function(_0x18193f,_0x58673b){return db[_0x629d('0x17')]['findAll']({'raw':_0x4a016e[_0x629d('0x18')]?_0x4a016e[_0x629d('0x18')][_0x629d('0x19')]===undefined?!![]:![]:!![],'where':_0x4a016e['options']?_0x4a016e[_0x629d('0x18')][_0x629d('0x1a')]||null:null,'attributes':_0x4a016e['options']?_0x4a016e[_0x629d('0x18')]['attributes']||null:null,'limit':_0x4a016e[_0x629d('0x18')]?_0x4a016e['options'][_0x629d('0x1b')]||null:null,'include':_0x4a016e[_0x629d('0x18')]?_0x4a016e[_0x629d('0x18')][_0x629d('0x1c')]?_['map'](_0x4a016e[_0x629d('0x18')]['include'],function(_0x2287b8){return{'model':db[_0x2287b8[_0x629d('0x1d')]],'as':_0x2287b8['as'],'attributes':_0x2287b8[_0x629d('0x1e')],'include':_0x2287b8[_0x629d('0x1c')]?_[_0x629d('0x1f')](_0x2287b8[_0x629d('0x1c')],function(_0x4d0d45){return{'model':db[_0x4d0d45['model']],'as':_0x4d0d45['as'],'attributes':_0x4d0d45[_0x629d('0x1e')],'include':_0x4d0d45[_0x629d('0x1c')]?_[_0x629d('0x1f')](_0x4d0d45[_0x629d('0x1c')],function(_0x86f58f){return{'model':db[_0x86f58f['model']],'as':_0x86f58f['as'],'attributes':_0x86f58f[_0x629d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x629d('0xa')](function(_0x13c510){logger[_0x629d('0xb')](_0x629d('0x16'),_0x4a016e);logger['debug']('GetSugarcrmAccount',_0x4a016e,JSON[_0x629d('0x10')](_0x13c510));_0x18193f(_0x13c510);})['catch'](function(_0x4841eb){logger[_0x629d('0x11')](_0x629d('0x16'),_0x4841eb['message'],_0x4a016e);_0x58673b(_0x1a1c24[_0x629d('0x11')](0x1f4,_0x4841eb['message']));});});};exports[_0x629d('0x20')]=function(_0x3c3ed6){var _0xa78418=this;return new Promise(function(_0x51c860,_0x30d0c6){return db['SugarcrmAccount'][_0x629d('0x21')]({'raw':_0x3c3ed6[_0x629d('0x18')]?_0x3c3ed6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c3ed6[_0x629d('0x18')]?_0x3c3ed6[_0x629d('0x18')][_0x629d('0x1a')]||null:null,'attributes':_0x3c3ed6[_0x629d('0x18')]?_0x3c3ed6[_0x629d('0x18')][_0x629d('0x1e')]||null:null,'include':_0x3c3ed6[_0x629d('0x18')]?_0x3c3ed6[_0x629d('0x18')][_0x629d('0x1c')]?_[_0x629d('0x1f')](_0x3c3ed6[_0x629d('0x18')][_0x629d('0x1c')],function(_0x57d05b){return{'model':db[_0x57d05b[_0x629d('0x1d')]],'as':_0x57d05b['as'],'attributes':_0x57d05b[_0x629d('0x1e')],'include':_0x57d05b[_0x629d('0x1c')]?_[_0x629d('0x1f')](_0x57d05b[_0x629d('0x1c')],function(_0x133f10){return{'model':db[_0x133f10[_0x629d('0x1d')]],'as':_0x133f10['as'],'attributes':_0x133f10['attributes'],'include':_0x133f10[_0x629d('0x1c')]?_['map'](_0x133f10[_0x629d('0x1c')],function(_0x3bd144){return{'model':db[_0x3bd144[_0x629d('0x1d')]],'as':_0x3bd144['as'],'attributes':_0x3bd144[_0x629d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x629d('0xa')](function(_0x4565d1){logger[_0x629d('0xb')](_0x629d('0x20'),_0x3c3ed6);logger[_0x629d('0xd')](_0x629d('0x20'),_0x3c3ed6,JSON['stringify'](_0x4565d1));_0x51c860(_0x4565d1);})[_0x629d('0x15')](function(_0x1f1c24){logger[_0x629d('0x11')](_0x629d('0x20'),_0x1f1c24['message'],_0x3c3ed6);_0x30d0c6(_0xa78418['error'](0x1f4,_0x1f1c24[_0x629d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0c171cc..aa7696b 100644 --- a/server/api/intSugarcrmConfiguration/index.js +++ b/server/api/intSugarcrmConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe746=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xe746,0xb9));var _0x6e74=function(_0x368154,_0x22c719){_0x368154=_0x368154-0x0;var _0x32fc18=_0xe746[_0x368154];return _0x32fc18;};'use strict';var multer=require(_0x6e74('0x0'));var util=require('util');var path=require(_0x6e74('0x1'));var timeout=require(_0x6e74('0x2'));var express=require(_0x6e74('0x3'));var router=express[_0x6e74('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6e74('0x5'));var interaction=require(_0x6e74('0x6'));var config=require(_0x6e74('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x6e74('0x8')]('/',auth[_0x6e74('0x9')](),controller[_0x6e74('0xa')]);router[_0x6e74('0x8')](_0x6e74('0xb'),auth[_0x6e74('0x9')](),controller['show']);router[_0x6e74('0x8')]('/:id/fields',auth[_0x6e74('0x9')](),controller['getFields']);router[_0x6e74('0x8')](_0x6e74('0xc'),auth[_0x6e74('0x9')](),controller[_0x6e74('0xd')]);router[_0x6e74('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6e74('0xe')]);router[_0x6e74('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e74('0x10')]('/:id',auth[_0x6e74('0x9')](),controller[_0x6e74('0x11')]);router[_0x6e74('0x12')](_0x6e74('0xb'),auth[_0x6e74('0x9')](),controller[_0x6e74('0x13')]);module[_0x6e74('0x14')]=router; \ No newline at end of file +var _0x5ba5=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','show','getFields','getSubjects','getDescriptions','create','put'];(function(_0x3183d8,_0x4f9ba4){var _0x5e7e39=function(_0x53fd1a){while(--_0x53fd1a){_0x3183d8['push'](_0x3183d8['shift']());}};_0x5e7e39(++_0x4f9ba4);}(_0x5ba5,0x1cd));var _0x55ba=function(_0x48b3fb,_0x4b07bf){_0x48b3fb=_0x48b3fb-0x0;var _0x458604=_0x5ba5[_0x48b3fb];return _0x458604;};'use strict';var multer=require(_0x55ba('0x0'));var util=require(_0x55ba('0x1'));var path=require(_0x55ba('0x2'));var timeout=require(_0x55ba('0x3'));var express=require(_0x55ba('0x4'));var router=express[_0x55ba('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x55ba('0x6'));var interaction=require(_0x55ba('0x7'));var config=require(_0x55ba('0x8'));var controller=require(_0x55ba('0x9'));router['get']('/',auth[_0x55ba('0xa')](),controller[_0x55ba('0xb')]);router[_0x55ba('0xc')]('/:id',auth[_0x55ba('0xa')](),controller[_0x55ba('0xd')]);router[_0x55ba('0xc')]('/:id/fields',auth[_0x55ba('0xa')](),controller[_0x55ba('0xe')]);router[_0x55ba('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x55ba('0xf')]);router[_0x55ba('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x55ba('0x10')]);router['post']('/',auth[_0x55ba('0xa')](),controller[_0x55ba('0x11')]);router[_0x55ba('0x12')](_0x55ba('0x13'),auth[_0x55ba('0xa')](),controller[_0x55ba('0x14')]);router[_0x55ba('0x15')]('/:id',auth[_0x55ba('0xa')](),controller[_0x55ba('0x16')]);module[_0x55ba('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index eb6f5ef..517a866 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe90=['exports','STRING','sequelize'];(function(_0x14484d,_0x12f694){var _0x11489c=function(_0x54ab26){while(--_0x54ab26){_0x14484d['push'](_0x14484d['shift']());}};_0x11489c(++_0x12f694);}(_0xfe90,0x18b));var _0x0fe9=function(_0x250f26,_0x494e47){_0x250f26=_0x250f26-0x0;var _0x50e159=_0xfe90[_0x250f26];return _0x50e159;};'use strict';var Sequelize=require(_0x0fe9('0x0'));module[_0x0fe9('0x1')]={'name':{'type':Sequelize[_0x0fe9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1514=['STRING','sequelize','exports'];(function(_0x4d2f43,_0x1cdd82){var _0x38e6a3=function(_0x3d5929){while(--_0x3d5929){_0x4d2f43['push'](_0x4d2f43['shift']());}};_0x38e6a3(++_0x1cdd82);}(_0x1514,0x13f));var _0x4151=function(_0x27264a,_0x533630){_0x27264a=_0x27264a-0x0;var _0x22c1a4=_0x1514[_0x27264a];return _0x22c1a4;};'use strict';var Sequelize=require(_0x4151('0x0'));module[_0x4151('0x1')]={'name':{'type':Sequelize[_0x4151('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 955533e..e96a8e8 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb04d=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','include','findAll','params','length','includeAll','find','catch','create','body','findOne','SugarcrmField','sort','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x10694d,_0x14943c){var _0x2840b8=function(_0xa55925){while(--_0xa55925){_0x10694d['push'](_0x10694d['shift']());}};_0x2840b8(++_0x14943c);}(_0xb04d,0x160));var _0xdb04=function(_0x5f4dcc,_0x488fce){_0x5f4dcc=_0x5f4dcc-0x0;var _0x2ec6e3=_0xb04d[_0x5f4dcc];return _0x2ec6e3;};'use strict';var emlformat=require(_0xdb04('0x0'));var rimraf=require(_0xdb04('0x1'));var zipdir=require(_0xdb04('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb04('0x3'));var moment=require(_0xdb04('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdb04('0x5'));var sox=require(_0xdb04('0x6'));var csv=require(_0xdb04('0x7'));var ejs=require(_0xdb04('0x8'));var fs=require('fs');var fs_extra=require(_0xdb04('0x9'));var _=require(_0xdb04('0xa'));var squel=require(_0xdb04('0xb'));var crypto=require(_0xdb04('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb04('0xd'));var toCsv=require(_0xdb04('0x7'));var querystring=require(_0xdb04('0xe'));var Papa=require('papaparse');var Redis=require(_0xdb04('0xf'));var authService=require(_0xdb04('0x10'));var qs=require(_0xdb04('0x11'));var as=require(_0xdb04('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb04('0x13'))(_0xdb04('0x14'));var utils=require(_0xdb04('0x15'));var config=require(_0xdb04('0x16'));var licenseUtil=require(_0xdb04('0x17'));var db=require(_0xdb04('0x18'))['db'];function respondWithStatusCode(_0x4b5c7a,_0x3efdb0){_0x3efdb0=_0x3efdb0||0xcc;return function(_0x591a06){if(_0x591a06){return _0x4b5c7a[_0xdb04('0x19')](_0x3efdb0);}return _0x4b5c7a[_0xdb04('0x1a')](_0x3efdb0)[_0xdb04('0x1b')]();};}function respondWithResult(_0x179dcb,_0x40943a){_0x40943a=_0x40943a||0xc8;return function(_0x362c76){if(_0x362c76){return _0x179dcb['status'](_0x40943a)[_0xdb04('0x1c')](_0x362c76);}};}function respondWithFilteredResult(_0x5439c5,_0x499273){return function(_0x3505bf){if(_0x3505bf){var _0x188ea4=typeof _0x499273[_0xdb04('0x1d')]==='undefined'&&typeof _0x499273['limit']===_0xdb04('0x1e');var _0x4fa255=_0x3505bf['count'];var _0x1a8778=_0x188ea4?0x0:_0x499273[_0xdb04('0x1d')];var _0x193afc=_0x188ea4?_0x3505bf[_0xdb04('0x1f')]:_0x499273[_0xdb04('0x1d')]+_0x499273[_0xdb04('0x20')];var _0x362163;if(_0x193afc>=_0x4fa255){_0x193afc=_0x4fa255;_0x362163=0xc8;}else{_0x362163=0xce;}_0x5439c5[_0xdb04('0x1a')](_0x362163);return _0x5439c5[_0xdb04('0x21')](_0xdb04('0x22'),_0x1a8778+'-'+_0x193afc+'/'+_0x4fa255)['json'](_0x3505bf);}return null;};}function patchUpdates(_0xbb5790){return function(_0x388216){try{jsonpatch[_0xdb04('0x23')](_0x388216,_0xbb5790,!![]);}catch(_0x49f06f){return BPromise[_0xdb04('0x24')](_0x49f06f);}return _0x388216[_0xdb04('0x25')]();};}function saveUpdates(_0x57ab96,_0x514b60){return function(_0x83ed8c){if(_0x83ed8c){return _0x83ed8c[_0xdb04('0x26')](_0x57ab96)[_0xdb04('0x27')](function(_0x2dbc86){return _0x2dbc86;});}return null;};}function removeEntity(_0x2eb5b6,_0x3d8cfd){return function(_0x2d0ea0){if(_0x2d0ea0){return _0x2d0ea0[_0xdb04('0x28')]()[_0xdb04('0x27')](function(){_0x2eb5b6[_0xdb04('0x1a')](0xcc)[_0xdb04('0x1b')]();});}};}function handleEntityNotFound(_0x1d335b,_0x2d55c1){return function(_0x328d84){if(!_0x328d84){_0x1d335b[_0xdb04('0x19')](0x194);}return _0x328d84;};}function handleError(_0x4f5a2e,_0x4852c1){_0x4852c1=_0x4852c1||0x1f4;return function(_0x308f3d){logger['error'](_0x308f3d[_0xdb04('0x29')]);if(_0x308f3d[_0xdb04('0x2a')]){delete _0x308f3d[_0xdb04('0x2a')];}_0x4f5a2e[_0xdb04('0x1a')](_0x4852c1)[_0xdb04('0x2b')](_0x308f3d);};}exports['index']=function(_0x4fdb85,_0x215bc){var _0x1333c4={},_0x5c3ab4={},_0x453980={'count':0x0,'rows':[]};var _0x4c912b=_[_0xdb04('0x2c')](db[_0xdb04('0x2d')][_0xdb04('0x2e')],function(_0x35ab83){return{'name':_0x35ab83[_0xdb04('0x2f')],'type':_0x35ab83[_0xdb04('0x30')][_0xdb04('0x31')]};});_0x5c3ab4[_0xdb04('0x32')]=_['map'](_0x4c912b,_0xdb04('0x2a'));_0x5c3ab4[_0xdb04('0x33')]=_[_0xdb04('0x34')](_0x4fdb85[_0xdb04('0x33')]);_0x5c3ab4[_0xdb04('0x35')]=_[_0xdb04('0x36')](_0x5c3ab4['model'],_0x5c3ab4['query']);_0x1333c4[_0xdb04('0x37')]=_['intersection'](_0x5c3ab4[_0xdb04('0x32')],qs[_0xdb04('0x38')](_0x4fdb85[_0xdb04('0x33')][_0xdb04('0x38')]));_0x1333c4[_0xdb04('0x37')]=_0x1333c4['attributes']['length']?_0x1333c4[_0xdb04('0x37')]:_0x5c3ab4[_0xdb04('0x32')];if(!_0x4fdb85[_0xdb04('0x33')][_0xdb04('0x39')](_0xdb04('0x3a'))){_0x1333c4[_0xdb04('0x20')]=qs['limit'](_0x4fdb85[_0xdb04('0x33')][_0xdb04('0x20')]);_0x1333c4[_0xdb04('0x1d')]=qs[_0xdb04('0x1d')](_0x4fdb85['query'][_0xdb04('0x1d')]);}_0x1333c4[_0xdb04('0x3b')]=qs['sort'](_0x4fdb85[_0xdb04('0x33')]['sort']);_0x1333c4[_0xdb04('0x3c')]=qs[_0xdb04('0x35')](_['pick'](_0x4fdb85[_0xdb04('0x33')],_0x5c3ab4[_0xdb04('0x35')]),_0x4c912b);if(_0x4fdb85[_0xdb04('0x33')][_0xdb04('0x3d')]){_0x1333c4[_0xdb04('0x3c')]=_['merge'](_0x1333c4[_0xdb04('0x3c')],{'$or':_[_0xdb04('0x2c')](_0x4c912b,function(_0x515f60){if(_0x515f60[_0xdb04('0x30')]!==_0xdb04('0x3e')){var _0x19404c={};_0x19404c[_0x515f60['name']]={'$like':'%'+_0x4fdb85['query']['filter']+'%'};return _0x19404c;}})});}_0x1333c4=_[_0xdb04('0x3f')]({},_0x1333c4,_0x4fdb85[_0xdb04('0x40')]);var _0x296750={'where':_0x1333c4[_0xdb04('0x3c')]};return db[_0xdb04('0x2d')]['count'](_0x296750)['then'](function(_0xa4abc5){_0x453980[_0xdb04('0x1f')]=_0xa4abc5;if(_0x4fdb85[_0xdb04('0x33')]['includeAll']){_0x1333c4[_0xdb04('0x41')]=[{'all':!![]}];}return db[_0xdb04('0x2d')][_0xdb04('0x42')](_0x1333c4);})['then'](function(_0x508a0e){_0x453980['rows']=_0x508a0e;return _0x453980;})['then'](respondWithFilteredResult(_0x215bc,_0x1333c4))['catch'](handleError(_0x215bc,null));};exports['show']=function(_0x225756,_0x4163f1){var _0x28a3be={'raw':![],'where':{'id':_0x225756[_0xdb04('0x43')]['id']}},_0x4ebbe3={};_0x4ebbe3[_0xdb04('0x32')]=_[_0xdb04('0x34')](db[_0xdb04('0x2d')][_0xdb04('0x2e')]);_0x4ebbe3['query']=_[_0xdb04('0x34')](_0x225756[_0xdb04('0x33')]);_0x4ebbe3[_0xdb04('0x35')]=_[_0xdb04('0x36')](_0x4ebbe3['model'],_0x4ebbe3['query']);_0x28a3be[_0xdb04('0x37')]=_['intersection'](_0x4ebbe3[_0xdb04('0x32')],qs['fields'](_0x225756[_0xdb04('0x33')][_0xdb04('0x38')]));_0x28a3be['attributes']=_0x28a3be[_0xdb04('0x37')][_0xdb04('0x44')]?_0x28a3be[_0xdb04('0x37')]:_0x4ebbe3[_0xdb04('0x32')];if(_0x225756[_0xdb04('0x33')][_0xdb04('0x45')]){_0x28a3be[_0xdb04('0x41')]=[{'all':!![]}];}_0x28a3be=_[_0xdb04('0x3f')]({},_0x28a3be,_0x225756[_0xdb04('0x40')]);return db[_0xdb04('0x2d')][_0xdb04('0x46')](_0x28a3be)[_0xdb04('0x27')](handleEntityNotFound(_0x4163f1,null))['then'](respondWithResult(_0x4163f1,null))[_0xdb04('0x47')](handleError(_0x4163f1,null));};exports[_0xdb04('0x48')]=function(_0x57ce92,_0x38e52e){return db[_0xdb04('0x2d')]['create'](_0x57ce92['body'],{})[_0xdb04('0x27')](respondWithResult(_0x38e52e,0xc9))['catch'](handleError(_0x38e52e,null));};exports[_0xdb04('0x26')]=function(_0x32755b,_0x27fb32){if(_0x32755b[_0xdb04('0x49')]['id']){delete _0x32755b[_0xdb04('0x49')]['id'];}return db[_0xdb04('0x2d')][_0xdb04('0x46')]({'where':{'id':_0x32755b['params']['id']}})['then'](handleEntityNotFound(_0x27fb32,null))[_0xdb04('0x27')](saveUpdates(_0x32755b['body'],null))[_0xdb04('0x27')](respondWithResult(_0x27fb32,null))[_0xdb04('0x47')](handleError(_0x27fb32,null));};exports['destroy']=function(_0x525bbb,_0x1e4a31){return db[_0xdb04('0x2d')][_0xdb04('0x46')]({'where':{'id':_0x525bbb[_0xdb04('0x43')]['id']}})[_0xdb04('0x27')](handleEntityNotFound(_0x1e4a31,null))[_0xdb04('0x27')](removeEntity(_0x1e4a31,null))[_0xdb04('0x47')](handleError(_0x1e4a31,null));};exports['getFields']=function(_0x34b0ef,_0x35ded7,_0x4395e7){var _0x396473={};var _0xcada1c={};var _0x839f5;var _0x3d9dd9;return db[_0xdb04('0x2d')][_0xdb04('0x4a')]({'where':{'id':_0x34b0ef[_0xdb04('0x43')]['id']}})['then'](handleEntityNotFound(_0x35ded7,null))[_0xdb04('0x27')](function(_0x895389){if(_0x895389){_0x839f5=_0x895389;_0xcada1c[_0xdb04('0x32')]=_['keys'](db[_0xdb04('0x4b')][_0xdb04('0x2e')]);_0xcada1c[_0xdb04('0x33')]=_['keys'](_0x34b0ef['query']);_0xcada1c[_0xdb04('0x35')]=_[_0xdb04('0x36')](_0xcada1c['model'],_0xcada1c[_0xdb04('0x33')]);_0x396473['attributes']=_[_0xdb04('0x36')](_0xcada1c['model'],qs[_0xdb04('0x38')](_0x34b0ef['query']['fields']));_0x396473[_0xdb04('0x37')]=_0x396473[_0xdb04('0x37')]['length']?_0x396473[_0xdb04('0x37')]:_0xcada1c[_0xdb04('0x32')];_0x396473[_0xdb04('0x3b')]=qs[_0xdb04('0x4c')](_0x34b0ef[_0xdb04('0x33')][_0xdb04('0x4c')]);_0x396473['where']=qs[_0xdb04('0x35')](_[_0xdb04('0x4d')](_0x34b0ef[_0xdb04('0x33')],_0xcada1c[_0xdb04('0x35')]));if(_0x34b0ef[_0xdb04('0x33')][_0xdb04('0x3d')]){_0x396473['where']=_['merge'](_0x396473['where'],{'$or':_['map'](_0x396473[_0xdb04('0x37')],function(_0xa771f0){var _0x46c103={};_0x46c103[_0xa771f0]={'$like':'%'+_0x34b0ef[_0xdb04('0x33')][_0xdb04('0x3d')]+'%'};return _0x46c103;})});}_0x396473=_[_0xdb04('0x3f')]({},_0x396473,_0x34b0ef[_0xdb04('0x40')]);return _0x839f5[_0xdb04('0x4e')](_0x396473);}})[_0xdb04('0x27')](function(_0x18f238){if(_0x18f238){_0x3d9dd9=_0x18f238[_0xdb04('0x44')];if(!_0x34b0ef[_0xdb04('0x33')][_0xdb04('0x39')](_0xdb04('0x3a'))){_0x396473[_0xdb04('0x20')]=qs[_0xdb04('0x20')](_0x34b0ef[_0xdb04('0x33')]['limit']);_0x396473['offset']=qs['offset'](_0x34b0ef['query'][_0xdb04('0x1d')]);}return _0x839f5[_0xdb04('0x4e')](_0x396473);}})[_0xdb04('0x27')](function(_0x8b45e5){if(_0x8b45e5){return _0x8b45e5?{'count':_0x3d9dd9,'rows':_0x8b45e5}:null;}})[_0xdb04('0x27')](respondWithResult(_0x35ded7,null))[_0xdb04('0x47')](handleError(_0x35ded7,null));};exports['getSubjects']=function(_0x2e66ad,_0xe90e60,_0x1522f7){var _0x12c0e2={};var _0x3ed6bb={};var _0x502b04;var _0x2483ad;return db['SugarcrmConfiguration'][_0xdb04('0x4a')]({'where':{'id':_0x2e66ad[_0xdb04('0x43')]['id']}})[_0xdb04('0x27')](handleEntityNotFound(_0xe90e60,null))[_0xdb04('0x27')](function(_0x4c2188){if(_0x4c2188){_0x502b04=_0x4c2188;_0x3ed6bb[_0xdb04('0x32')]=_[_0xdb04('0x34')](db[_0xdb04('0x4b')][_0xdb04('0x2e')]);_0x3ed6bb['query']=_[_0xdb04('0x34')](_0x2e66ad['query']);_0x3ed6bb[_0xdb04('0x35')]=_[_0xdb04('0x36')](_0x3ed6bb[_0xdb04('0x32')],_0x3ed6bb[_0xdb04('0x33')]);_0x12c0e2[_0xdb04('0x37')]=_[_0xdb04('0x36')](_0x3ed6bb[_0xdb04('0x32')],qs['fields'](_0x2e66ad['query']['fields']));_0x12c0e2[_0xdb04('0x37')]=_0x12c0e2[_0xdb04('0x37')][_0xdb04('0x44')]?_0x12c0e2[_0xdb04('0x37')]:_0x3ed6bb[_0xdb04('0x32')];_0x12c0e2[_0xdb04('0x3b')]=qs[_0xdb04('0x4c')](_0x2e66ad[_0xdb04('0x33')][_0xdb04('0x4c')]);_0x12c0e2[_0xdb04('0x3c')]=qs[_0xdb04('0x35')](_[_0xdb04('0x4d')](_0x2e66ad[_0xdb04('0x33')],_0x3ed6bb['filters']));if(_0x2e66ad[_0xdb04('0x33')][_0xdb04('0x3d')]){_0x12c0e2[_0xdb04('0x3c')]=_[_0xdb04('0x3f')](_0x12c0e2[_0xdb04('0x3c')],{'$or':_[_0xdb04('0x2c')](_0x12c0e2['attributes'],function(_0x41e2a1){var _0x57383d={};_0x57383d[_0x41e2a1]={'$like':'%'+_0x2e66ad[_0xdb04('0x33')]['filter']+'%'};return _0x57383d;})});}_0x12c0e2=_[_0xdb04('0x3f')]({},_0x12c0e2,_0x2e66ad[_0xdb04('0x40')]);return _0x502b04[_0xdb04('0x4f')](_0x12c0e2);}})[_0xdb04('0x27')](function(_0x2610bb){if(_0x2610bb){_0x2483ad=_0x2610bb[_0xdb04('0x44')];if(!_0x2e66ad[_0xdb04('0x33')][_0xdb04('0x39')](_0xdb04('0x3a'))){_0x12c0e2['limit']=qs[_0xdb04('0x20')](_0x2e66ad[_0xdb04('0x33')][_0xdb04('0x20')]);_0x12c0e2[_0xdb04('0x1d')]=qs[_0xdb04('0x1d')](_0x2e66ad[_0xdb04('0x33')][_0xdb04('0x1d')]);}return _0x502b04['getSubjects'](_0x12c0e2);}})[_0xdb04('0x27')](function(_0x4e2cec){if(_0x4e2cec){return _0x4e2cec?{'count':_0x2483ad,'rows':_0x4e2cec}:null;}})[_0xdb04('0x27')](respondWithResult(_0xe90e60,null))[_0xdb04('0x47')](handleError(_0xe90e60,null));};exports['getDescriptions']=function(_0x1b7744,_0x577265,_0x49e7ed){var _0x1905fb={};var _0x5d6099={};var _0x4c49ca;var _0x543fbe;return db[_0xdb04('0x2d')]['findOne']({'where':{'id':_0x1b7744[_0xdb04('0x43')]['id']}})[_0xdb04('0x27')](handleEntityNotFound(_0x577265,null))[_0xdb04('0x27')](function(_0x25bc65){if(_0x25bc65){_0x4c49ca=_0x25bc65;_0x5d6099[_0xdb04('0x32')]=_[_0xdb04('0x34')](db[_0xdb04('0x4b')][_0xdb04('0x2e')]);_0x5d6099['query']=_[_0xdb04('0x34')](_0x1b7744[_0xdb04('0x33')]);_0x5d6099[_0xdb04('0x35')]=_['intersection'](_0x5d6099['model'],_0x5d6099[_0xdb04('0x33')]);_0x1905fb[_0xdb04('0x37')]=_[_0xdb04('0x36')](_0x5d6099[_0xdb04('0x32')],qs['fields'](_0x1b7744[_0xdb04('0x33')][_0xdb04('0x38')]));_0x1905fb[_0xdb04('0x37')]=_0x1905fb[_0xdb04('0x37')][_0xdb04('0x44')]?_0x1905fb[_0xdb04('0x37')]:_0x5d6099[_0xdb04('0x32')];_0x1905fb[_0xdb04('0x3b')]=qs[_0xdb04('0x4c')](_0x1b7744[_0xdb04('0x33')][_0xdb04('0x4c')]);_0x1905fb[_0xdb04('0x3c')]=qs[_0xdb04('0x35')](_[_0xdb04('0x4d')](_0x1b7744[_0xdb04('0x33')],_0x5d6099[_0xdb04('0x35')]));if(_0x1b7744[_0xdb04('0x33')]['filter']){_0x1905fb[_0xdb04('0x3c')]=_['merge'](_0x1905fb[_0xdb04('0x3c')],{'$or':_[_0xdb04('0x2c')](_0x1905fb[_0xdb04('0x37')],function(_0x430e5d){var _0x5a2665={};_0x5a2665[_0x430e5d]={'$like':'%'+_0x1b7744['query'][_0xdb04('0x3d')]+'%'};return _0x5a2665;})});}_0x1905fb=_[_0xdb04('0x3f')]({},_0x1905fb,_0x1b7744['options']);return _0x4c49ca[_0xdb04('0x50')](_0x1905fb);}})[_0xdb04('0x27')](function(_0x3529e7){if(_0x3529e7){_0x543fbe=_0x3529e7[_0xdb04('0x44')];if(!_0x1b7744[_0xdb04('0x33')][_0xdb04('0x39')]('nolimit')){_0x1905fb[_0xdb04('0x20')]=qs[_0xdb04('0x20')](_0x1b7744['query'][_0xdb04('0x20')]);_0x1905fb[_0xdb04('0x1d')]=qs['offset'](_0x1b7744[_0xdb04('0x33')][_0xdb04('0x1d')]);}return _0x4c49ca[_0xdb04('0x50')](_0x1905fb);}})[_0xdb04('0x27')](function(_0x591d69){if(_0x591d69){return _0x591d69?{'count':_0x543fbe,'rows':_0x591d69}:null;}})[_0xdb04('0x27')](respondWithResult(_0x577265,null))[_0xdb04('0x47')](handleError(_0x577265,null));}; \ No newline at end of file +var _0x29e8=['catch','create','body','find','params','getFields','SugarcrmField','getSubjects','findOne','order','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','index','SugarcrmConfiguration','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','fields','length'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0x29e8,0xef));var _0x829e=function(_0x162d63,_0x3125ae){_0x162d63=_0x162d63-0x0;var _0x29a1ee=_0x29e8[_0x162d63];return _0x29a1ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x829e('0x0'));var zipdir=require(_0x829e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x829e('0x2'));var moment=require(_0x829e('0x3'));var BPromise=require(_0x829e('0x4'));var Mustache=require(_0x829e('0x5'));var util=require(_0x829e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x829e('0x7'));var ejs=require(_0x829e('0x8'));var fs=require('fs');var fs_extra=require(_0x829e('0x9'));var _=require('lodash');var squel=require(_0x829e('0xa'));var crypto=require(_0x829e('0xb'));var jsforce=require(_0x829e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x829e('0xd'));var Redis=require('ioredis');var authService=require(_0x829e('0xe'));var qs=require(_0x829e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x829e('0x10'));var logger=require('../../config/logger')(_0x829e('0x11'));var utils=require(_0x829e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x829e('0x13'));var db=require(_0x829e('0x14'))['db'];function respondWithStatusCode(_0x2994bc,_0x5e0897){_0x5e0897=_0x5e0897||0xcc;return function(_0x260273){if(_0x260273){return _0x2994bc[_0x829e('0x15')](_0x5e0897);}return _0x2994bc[_0x829e('0x16')](_0x5e0897)['end']();};}function respondWithResult(_0x3a50cb,_0x504fba){_0x504fba=_0x504fba||0xc8;return function(_0x206c7a){if(_0x206c7a){return _0x3a50cb['status'](_0x504fba)[_0x829e('0x17')](_0x206c7a);}};}function respondWithFilteredResult(_0x3070bf,_0x270547){return function(_0x5916c1){if(_0x5916c1){var _0x41456d=typeof _0x270547[_0x829e('0x18')]===_0x829e('0x19')&&typeof _0x270547['limit']===_0x829e('0x19');var _0x2676dd=_0x5916c1[_0x829e('0x1a')];var _0x4ad0b2=_0x41456d?0x0:_0x270547[_0x829e('0x18')];var _0x505a32=_0x41456d?_0x5916c1['count']:_0x270547['offset']+_0x270547[_0x829e('0x1b')];var _0x4a1fe4;if(_0x505a32>=_0x2676dd){_0x505a32=_0x2676dd;_0x4a1fe4=0xc8;}else{_0x4a1fe4=0xce;}_0x3070bf[_0x829e('0x16')](_0x4a1fe4);return _0x3070bf[_0x829e('0x1c')](_0x829e('0x1d'),_0x4ad0b2+'-'+_0x505a32+'/'+_0x2676dd)[_0x829e('0x17')](_0x5916c1);}return null;};}function patchUpdates(_0x562077){return function(_0x11fc7d){try{jsonpatch['apply'](_0x11fc7d,_0x562077,!![]);}catch(_0x3d366b){return BPromise[_0x829e('0x1e')](_0x3d366b);}return _0x11fc7d[_0x829e('0x1f')]();};}function saveUpdates(_0xdd31a1,_0x31dfe9){return function(_0x3b9fa2){if(_0x3b9fa2){return _0x3b9fa2[_0x829e('0x20')](_0xdd31a1)[_0x829e('0x21')](function(_0x558e77){return _0x558e77;});}return null;};}function removeEntity(_0x3e5ecc,_0x566236){return function(_0x46b103){if(_0x46b103){return _0x46b103[_0x829e('0x22')]()['then'](function(){_0x3e5ecc[_0x829e('0x16')](0xcc)[_0x829e('0x23')]();});}};}function handleEntityNotFound(_0x231b2c,_0x3b27f2){return function(_0x3400f0){if(!_0x3400f0){_0x231b2c[_0x829e('0x15')](0x194);}return _0x3400f0;};}function handleError(_0x4f9cfd,_0x143382){_0x143382=_0x143382||0x1f4;return function(_0x4618ca){logger[_0x829e('0x24')](_0x4618ca['stack']);if(_0x4618ca[_0x829e('0x25')]){delete _0x4618ca[_0x829e('0x25')];}_0x4f9cfd[_0x829e('0x16')](_0x143382)['send'](_0x4618ca);};}exports[_0x829e('0x26')]=function(_0x452c50,_0x1c5a88){var _0x1f47c1={},_0x179c76={},_0x3f0589={'count':0x0,'rows':[]};var _0x2f59c9=_['map'](db[_0x829e('0x27')]['rawAttributes'],function(_0xf63f68){return{'name':_0xf63f68['fieldName'],'type':_0xf63f68[_0x829e('0x28')][_0x829e('0x29')]};});_0x179c76[_0x829e('0x2a')]=_['map'](_0x2f59c9,_0x829e('0x25'));_0x179c76[_0x829e('0x2b')]=_[_0x829e('0x2c')](_0x452c50['query']);_0x179c76['filters']=_[_0x829e('0x2d')](_0x179c76[_0x829e('0x2a')],_0x179c76['query']);_0x1f47c1[_0x829e('0x2e')]=_['intersection'](_0x179c76[_0x829e('0x2a')],qs['fields'](_0x452c50[_0x829e('0x2b')]['fields']));_0x1f47c1[_0x829e('0x2e')]=_0x1f47c1[_0x829e('0x2e')]['length']?_0x1f47c1['attributes']:_0x179c76[_0x829e('0x2a')];if(!_0x452c50[_0x829e('0x2b')][_0x829e('0x2f')](_0x829e('0x30'))){_0x1f47c1['limit']=qs['limit'](_0x452c50['query'][_0x829e('0x1b')]);_0x1f47c1[_0x829e('0x18')]=qs[_0x829e('0x18')](_0x452c50[_0x829e('0x2b')][_0x829e('0x18')]);}_0x1f47c1['order']=qs['sort'](_0x452c50['query'][_0x829e('0x31')]);_0x1f47c1[_0x829e('0x32')]=qs['filters'](_[_0x829e('0x33')](_0x452c50[_0x829e('0x2b')],_0x179c76[_0x829e('0x34')]),_0x2f59c9);if(_0x452c50[_0x829e('0x2b')][_0x829e('0x35')]){_0x1f47c1['where']=_[_0x829e('0x36')](_0x1f47c1[_0x829e('0x32')],{'$or':_[_0x829e('0x37')](_0x2f59c9,function(_0x46dfbd){if(_0x46dfbd[_0x829e('0x28')]!==_0x829e('0x38')){var _0x34dbcc={};_0x34dbcc[_0x46dfbd[_0x829e('0x25')]]={'$like':'%'+_0x452c50[_0x829e('0x2b')]['filter']+'%'};return _0x34dbcc;}})});}_0x1f47c1=_[_0x829e('0x36')]({},_0x1f47c1,_0x452c50[_0x829e('0x39')]);var _0x33a493={'where':_0x1f47c1[_0x829e('0x32')]};return db['SugarcrmConfiguration']['count'](_0x33a493)[_0x829e('0x21')](function(_0x151358){_0x3f0589[_0x829e('0x1a')]=_0x151358;if(_0x452c50['query'][_0x829e('0x3a')]){_0x1f47c1[_0x829e('0x3b')]=[{'all':!![]}];}return db[_0x829e('0x27')][_0x829e('0x3c')](_0x1f47c1);})[_0x829e('0x21')](function(_0x1863aa){_0x3f0589['rows']=_0x1863aa;return _0x3f0589;})[_0x829e('0x21')](respondWithFilteredResult(_0x1c5a88,_0x1f47c1))['catch'](handleError(_0x1c5a88,null));};exports[_0x829e('0x3d')]=function(_0x42edf0,_0x3f40b5){var _0x5b23a0={'raw':![],'where':{'id':_0x42edf0['params']['id']}},_0x2b5468={};_0x2b5468[_0x829e('0x2a')]=_[_0x829e('0x2c')](db[_0x829e('0x27')][_0x829e('0x3e')]);_0x2b5468[_0x829e('0x2b')]=_[_0x829e('0x2c')](_0x42edf0['query']);_0x2b5468['filters']=_[_0x829e('0x2d')](_0x2b5468['model'],_0x2b5468['query']);_0x5b23a0['attributes']=_[_0x829e('0x2d')](_0x2b5468[_0x829e('0x2a')],qs[_0x829e('0x3f')](_0x42edf0[_0x829e('0x2b')][_0x829e('0x3f')]));_0x5b23a0[_0x829e('0x2e')]=_0x5b23a0['attributes'][_0x829e('0x40')]?_0x5b23a0[_0x829e('0x2e')]:_0x2b5468[_0x829e('0x2a')];if(_0x42edf0['query']['includeAll']){_0x5b23a0[_0x829e('0x3b')]=[{'all':!![]}];}_0x5b23a0=_[_0x829e('0x36')]({},_0x5b23a0,_0x42edf0[_0x829e('0x39')]);return db[_0x829e('0x27')]['find'](_0x5b23a0)[_0x829e('0x21')](handleEntityNotFound(_0x3f40b5,null))[_0x829e('0x21')](respondWithResult(_0x3f40b5,null))[_0x829e('0x41')](handleError(_0x3f40b5,null));};exports[_0x829e('0x42')]=function(_0x16aac9,_0xb138c){return db[_0x829e('0x27')]['create'](_0x16aac9[_0x829e('0x43')],{})[_0x829e('0x21')](respondWithResult(_0xb138c,0xc9))[_0x829e('0x41')](handleError(_0xb138c,null));};exports['update']=function(_0x2ac014,_0x518274){if(_0x2ac014['body']['id']){delete _0x2ac014[_0x829e('0x43')]['id'];}return db[_0x829e('0x27')][_0x829e('0x44')]({'where':{'id':_0x2ac014['params']['id']}})[_0x829e('0x21')](handleEntityNotFound(_0x518274,null))[_0x829e('0x21')](saveUpdates(_0x2ac014[_0x829e('0x43')],null))[_0x829e('0x21')](respondWithResult(_0x518274,null))[_0x829e('0x41')](handleError(_0x518274,null));};exports[_0x829e('0x22')]=function(_0x4b1116,_0x4b7579){return db['SugarcrmConfiguration'][_0x829e('0x44')]({'where':{'id':_0x4b1116[_0x829e('0x45')]['id']}})[_0x829e('0x21')](handleEntityNotFound(_0x4b7579,null))[_0x829e('0x21')](removeEntity(_0x4b7579,null))[_0x829e('0x41')](handleError(_0x4b7579,null));};exports[_0x829e('0x46')]=function(_0x19f94e,_0x590203,_0x4fdd85){var _0x17a33f={};var _0x12a2c8={};var _0x575b47;var _0x284444;return db[_0x829e('0x27')]['findOne']({'where':{'id':_0x19f94e[_0x829e('0x45')]['id']}})[_0x829e('0x21')](handleEntityNotFound(_0x590203,null))[_0x829e('0x21')](function(_0x3b4011){if(_0x3b4011){_0x575b47=_0x3b4011;_0x12a2c8['model']=_[_0x829e('0x2c')](db[_0x829e('0x47')][_0x829e('0x3e')]);_0x12a2c8['query']=_[_0x829e('0x2c')](_0x19f94e['query']);_0x12a2c8['filters']=_[_0x829e('0x2d')](_0x12a2c8[_0x829e('0x2a')],_0x12a2c8['query']);_0x17a33f[_0x829e('0x2e')]=_[_0x829e('0x2d')](_0x12a2c8[_0x829e('0x2a')],qs[_0x829e('0x3f')](_0x19f94e[_0x829e('0x2b')]['fields']));_0x17a33f[_0x829e('0x2e')]=_0x17a33f[_0x829e('0x2e')][_0x829e('0x40')]?_0x17a33f['attributes']:_0x12a2c8['model'];_0x17a33f['order']=qs[_0x829e('0x31')](_0x19f94e[_0x829e('0x2b')][_0x829e('0x31')]);_0x17a33f[_0x829e('0x32')]=qs['filters'](_[_0x829e('0x33')](_0x19f94e['query'],_0x12a2c8[_0x829e('0x34')]));if(_0x19f94e[_0x829e('0x2b')][_0x829e('0x35')]){_0x17a33f[_0x829e('0x32')]=_[_0x829e('0x36')](_0x17a33f[_0x829e('0x32')],{'$or':_[_0x829e('0x37')](_0x17a33f[_0x829e('0x2e')],function(_0x439cd6){var _0x4518ba={};_0x4518ba[_0x439cd6]={'$like':'%'+_0x19f94e['query'][_0x829e('0x35')]+'%'};return _0x4518ba;})});}_0x17a33f=_['merge']({},_0x17a33f,_0x19f94e[_0x829e('0x39')]);return _0x575b47[_0x829e('0x46')](_0x17a33f);}})[_0x829e('0x21')](function(_0x4f24a6){if(_0x4f24a6){_0x284444=_0x4f24a6[_0x829e('0x40')];if(!_0x19f94e[_0x829e('0x2b')][_0x829e('0x2f')](_0x829e('0x30'))){_0x17a33f[_0x829e('0x1b')]=qs[_0x829e('0x1b')](_0x19f94e[_0x829e('0x2b')]['limit']);_0x17a33f['offset']=qs[_0x829e('0x18')](_0x19f94e[_0x829e('0x2b')]['offset']);}return _0x575b47[_0x829e('0x46')](_0x17a33f);}})[_0x829e('0x21')](function(_0x53fc47){if(_0x53fc47){return _0x53fc47?{'count':_0x284444,'rows':_0x53fc47}:null;}})[_0x829e('0x21')](respondWithResult(_0x590203,null))[_0x829e('0x41')](handleError(_0x590203,null));};exports[_0x829e('0x48')]=function(_0xd7a2fc,_0x2a3163,_0x1e29f5){var _0x404e06={};var _0x21cd05={};var _0x4056c9;var _0x111f9c;return db[_0x829e('0x27')][_0x829e('0x49')]({'where':{'id':_0xd7a2fc[_0x829e('0x45')]['id']}})[_0x829e('0x21')](handleEntityNotFound(_0x2a3163,null))[_0x829e('0x21')](function(_0xdc88cd){if(_0xdc88cd){_0x4056c9=_0xdc88cd;_0x21cd05[_0x829e('0x2a')]=_['keys'](db['SugarcrmField'][_0x829e('0x3e')]);_0x21cd05[_0x829e('0x2b')]=_[_0x829e('0x2c')](_0xd7a2fc[_0x829e('0x2b')]);_0x21cd05['filters']=_['intersection'](_0x21cd05[_0x829e('0x2a')],_0x21cd05['query']);_0x404e06[_0x829e('0x2e')]=_[_0x829e('0x2d')](_0x21cd05[_0x829e('0x2a')],qs[_0x829e('0x3f')](_0xd7a2fc['query']['fields']));_0x404e06['attributes']=_0x404e06['attributes'][_0x829e('0x40')]?_0x404e06[_0x829e('0x2e')]:_0x21cd05['model'];_0x404e06[_0x829e('0x4a')]=qs[_0x829e('0x31')](_0xd7a2fc[_0x829e('0x2b')][_0x829e('0x31')]);_0x404e06['where']=qs[_0x829e('0x34')](_[_0x829e('0x33')](_0xd7a2fc[_0x829e('0x2b')],_0x21cd05['filters']));if(_0xd7a2fc[_0x829e('0x2b')]['filter']){_0x404e06[_0x829e('0x32')]=_['merge'](_0x404e06[_0x829e('0x32')],{'$or':_['map'](_0x404e06[_0x829e('0x2e')],function(_0x4c3b23){var _0x3c4d8c={};_0x3c4d8c[_0x4c3b23]={'$like':'%'+_0xd7a2fc[_0x829e('0x2b')][_0x829e('0x35')]+'%'};return _0x3c4d8c;})});}_0x404e06=_['merge']({},_0x404e06,_0xd7a2fc['options']);return _0x4056c9[_0x829e('0x48')](_0x404e06);}})['then'](function(_0x4b8975){if(_0x4b8975){_0x111f9c=_0x4b8975[_0x829e('0x40')];if(!_0xd7a2fc[_0x829e('0x2b')][_0x829e('0x2f')](_0x829e('0x30'))){_0x404e06[_0x829e('0x1b')]=qs[_0x829e('0x1b')](_0xd7a2fc['query'][_0x829e('0x1b')]);_0x404e06[_0x829e('0x18')]=qs[_0x829e('0x18')](_0xd7a2fc['query']['offset']);}return _0x4056c9['getSubjects'](_0x404e06);}})[_0x829e('0x21')](function(_0x38b58d){if(_0x38b58d){return _0x38b58d?{'count':_0x111f9c,'rows':_0x38b58d}:null;}})['then'](respondWithResult(_0x2a3163,null))[_0x829e('0x41')](handleError(_0x2a3163,null));};exports[_0x829e('0x4b')]=function(_0x125b90,_0x592f0c,_0x298cb5){var _0x41deaa={};var _0x1ae337={};var _0x3e3436;var _0x2d38ab;return db[_0x829e('0x27')][_0x829e('0x49')]({'where':{'id':_0x125b90[_0x829e('0x45')]['id']}})[_0x829e('0x21')](handleEntityNotFound(_0x592f0c,null))[_0x829e('0x21')](function(_0x44d755){if(_0x44d755){_0x3e3436=_0x44d755;_0x1ae337[_0x829e('0x2a')]=_[_0x829e('0x2c')](db['SugarcrmField'][_0x829e('0x3e')]);_0x1ae337[_0x829e('0x2b')]=_[_0x829e('0x2c')](_0x125b90[_0x829e('0x2b')]);_0x1ae337[_0x829e('0x34')]=_['intersection'](_0x1ae337['model'],_0x1ae337[_0x829e('0x2b')]);_0x41deaa[_0x829e('0x2e')]=_[_0x829e('0x2d')](_0x1ae337[_0x829e('0x2a')],qs[_0x829e('0x3f')](_0x125b90[_0x829e('0x2b')][_0x829e('0x3f')]));_0x41deaa[_0x829e('0x2e')]=_0x41deaa[_0x829e('0x2e')]['length']?_0x41deaa['attributes']:_0x1ae337[_0x829e('0x2a')];_0x41deaa[_0x829e('0x4a')]=qs[_0x829e('0x31')](_0x125b90[_0x829e('0x2b')][_0x829e('0x31')]);_0x41deaa['where']=qs['filters'](_['pick'](_0x125b90[_0x829e('0x2b')],_0x1ae337[_0x829e('0x34')]));if(_0x125b90[_0x829e('0x2b')][_0x829e('0x35')]){_0x41deaa[_0x829e('0x32')]=_[_0x829e('0x36')](_0x41deaa['where'],{'$or':_[_0x829e('0x37')](_0x41deaa['attributes'],function(_0x2f1889){var _0x25c0f4={};_0x25c0f4[_0x2f1889]={'$like':'%'+_0x125b90[_0x829e('0x2b')][_0x829e('0x35')]+'%'};return _0x25c0f4;})});}_0x41deaa=_['merge']({},_0x41deaa,_0x125b90[_0x829e('0x39')]);return _0x3e3436['getDescriptions'](_0x41deaa);}})[_0x829e('0x21')](function(_0x33c518){if(_0x33c518){_0x2d38ab=_0x33c518[_0x829e('0x40')];if(!_0x125b90[_0x829e('0x2b')][_0x829e('0x2f')](_0x829e('0x30'))){_0x41deaa['limit']=qs['limit'](_0x125b90['query']['limit']);_0x41deaa['offset']=qs[_0x829e('0x18')](_0x125b90[_0x829e('0x2b')][_0x829e('0x18')]);}return _0x3e3436[_0x829e('0x4b')](_0x41deaa);}})[_0x829e('0x21')](function(_0x2e0547){if(_0x2e0547){return _0x2e0547?{'count':_0x2d38ab,'rows':_0x2e0547}:null;}})[_0x829e('0x21')](respondWithResult(_0x592f0c,null))['catch'](handleError(_0x592f0c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6f24822..fbdf7e0 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4199=['SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x4199,0x79));var _0x9419=function(_0x5f049b,_0x5c0a2b){_0x5f049b=_0x5f049b-0x0;var _0x1067a1=_0x4199[_0x5f049b];return _0x1067a1;};'use strict';var _=require(_0x9419('0x0'));var util=require(_0x9419('0x1'));var logger=require(_0x9419('0x2'))(_0x9419('0x3'));var moment=require(_0x9419('0x4'));var BPromise=require(_0x9419('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9419('0x6'));var rimraf=require('rimraf');var config=require(_0x9419('0x7'));var attributes=require(_0x9419('0x8'));module[_0x9419('0x9')]=function(_0x1b35a9,_0x137f18){return _0x1b35a9[_0x9419('0xa')](_0x9419('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffe2=['define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x1bd379,_0x184514){var _0x5009=function(_0x1dea01){while(--_0x1dea01){_0x1bd379['push'](_0x1bd379['shift']());}};_0x5009(++_0x184514);}(_0xffe2,0x142));var _0x2ffe=function(_0x4d73dc,_0x28d725){_0x4d73dc=_0x4d73dc-0x0;var _0xff681=_0xffe2[_0x4d73dc];return _0xff681;};'use strict';var _=require(_0x2ffe('0x0'));var util=require(_0x2ffe('0x1'));var logger=require('../../config/logger')(_0x2ffe('0x2'));var moment=require(_0x2ffe('0x3'));var BPromise=require(_0x2ffe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ffe('0x5'));var rimraf=require('rimraf');var config=require(_0x2ffe('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x2ffe('0x7')]=function(_0x371d0a,_0x3934f3){return _0x371d0a[_0x2ffe('0x8')](_0x2ffe('0x9'),attributes,{'tableName':_0x2ffe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 4c6aec2..2969fdc 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0ea=['http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','jayson/promise','client'];(function(_0x27062d,_0x24b179){var _0x4f1478=function(_0x3b4489){while(--_0x3b4489){_0x27062d['push'](_0x27062d['shift']());}};_0x4f1478(++_0x24b179);}(_0xa0ea,0x1d4));var _0xaa0e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa0ea[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xaa0e('0x0'));var util=require(_0xaa0e('0x1'));var moment=require(_0xaa0e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa0e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xaa0e('0x5'));var client=jayson[_0xaa0e('0x6')][_0xaa0e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ff9b2,_0xa7a717,_0x154292){return new BPromise(function(_0x27d390,_0x463d5b){return client[_0xaa0e('0x8')](_0x1ff9b2,_0x154292)[_0xaa0e('0x9')](function(_0xcb2968){logger[_0xaa0e('0xa')](_0xaa0e('0xb'),_0xa7a717,_0xaa0e('0xc'));logger[_0xaa0e('0xd')](_0xaa0e('0xe'),_0xa7a717,_0xaa0e('0xc'),JSON['stringify'](_0xcb2968));if(_0xcb2968[_0xaa0e('0xf')]){if(_0xcb2968[_0xaa0e('0xf')][_0xaa0e('0x10')]===0x1f4){logger[_0xaa0e('0xf')](_0xaa0e('0xb'),_0xa7a717,_0xcb2968[_0xaa0e('0xf')][_0xaa0e('0x11')]);return _0x463d5b(_0xcb2968[_0xaa0e('0xf')][_0xaa0e('0x11')]);}logger[_0xaa0e('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa7a717,_0xcb2968['error'][_0xaa0e('0x11')]);return _0x27d390(_0xcb2968['error'][_0xaa0e('0x11')]);}else{logger[_0xaa0e('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa7a717,_0xaa0e('0xc'));_0x27d390(_0xcb2968[_0xaa0e('0x12')][_0xaa0e('0x11')]);}})['catch'](function(_0x29968a){logger[_0xaa0e('0xf')](_0xaa0e('0xb'),_0xa7a717,_0x29968a);_0x463d5b(_0x29968a);});});} \ No newline at end of file +var _0x8dfa=['error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x148f10,_0x4047d2){var _0x5a8bfb=function(_0x116f10){while(--_0x116f10){_0x148f10['push'](_0x148f10['shift']());}};_0x5a8bfb(++_0x4047d2);}(_0x8dfa,0x10d));var _0xa8df=function(_0x1220dc,_0x448145){_0x1220dc=_0x1220dc-0x0;var _0x264ada=_0x8dfa[_0x1220dc];return _0x264ada;};'use strict';var _=require(_0xa8df('0x0'));var util=require(_0xa8df('0x1'));var moment=require('moment');var BPromise=require(_0xa8df('0x2'));var rs=require(_0xa8df('0x3'));var fs=require('fs');var Redis=require(_0xa8df('0x4'));var db=require(_0xa8df('0x5'))['db'];var utils=require(_0xa8df('0x6'));var logger=require(_0xa8df('0x7'))('rpc');var config=require(_0xa8df('0x8'));var jayson=require(_0xa8df('0x9'));var client=jayson[_0xa8df('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfa4630,_0xa37a1c,_0x4944cc){return new BPromise(function(_0x3568cf,_0x18bbd7){return client[_0xa8df('0xb')](_0xfa4630,_0x4944cc)[_0xa8df('0xc')](function(_0x454e04){logger[_0xa8df('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa37a1c,_0xa8df('0xe'));logger[_0xa8df('0xf')](_0xa8df('0x10'),_0xa37a1c,_0xa8df('0xe'),JSON[_0xa8df('0x11')](_0x454e04));if(_0x454e04['error']){if(_0x454e04['error'][_0xa8df('0x12')]===0x1f4){logger[_0xa8df('0x13')](_0xa8df('0x14'),_0xa37a1c,_0x454e04[_0xa8df('0x13')]['message']);return _0x18bbd7(_0x454e04[_0xa8df('0x13')][_0xa8df('0x15')]);}logger[_0xa8df('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa37a1c,_0x454e04[_0xa8df('0x13')][_0xa8df('0x15')]);return _0x3568cf(_0x454e04[_0xa8df('0x13')]['message']);}else{logger[_0xa8df('0xd')](_0xa8df('0x14'),_0xa37a1c,_0xa8df('0xe'));_0x3568cf(_0x454e04[_0xa8df('0x16')][_0xa8df('0x15')]);}})[_0xa8df('0x17')](function(_0x1725e7){logger[_0xa8df('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa37a1c,_0x1725e7);_0x18bbd7(_0x1725e7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c5f1812..f25be91 100644 --- a/server/api/intSugarcrmField/index.js +++ b/server/api/intSugarcrmField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750b=['get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment'];(function(_0x126ab2,_0x79e0ad){var _0x34c325=function(_0x1b3192){while(--_0x1b3192){_0x126ab2['push'](_0x126ab2['shift']());}};_0x34c325(++_0x79e0ad);}(_0x750b,0xca));var _0xb750=function(_0x4da0f9,_0x5338ab){_0x4da0f9=_0x4da0f9-0x0;var _0x2d8aab=_0x750b[_0x4da0f9];return _0x2d8aab;};'use strict';var multer=require(_0xb750('0x0'));var util=require(_0xb750('0x1'));var path=require(_0xb750('0x2'));var timeout=require('connect-timeout');var express=require(_0xb750('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb750('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb750('0x5'));var controller=require('./intSugarcrmField.controller');router[_0xb750('0x6')]('/',auth[_0xb750('0x7')](),controller['index']);router[_0xb750('0x6')]('/:id',auth[_0xb750('0x7')](),controller['show']);router[_0xb750('0x8')]('/',auth[_0xb750('0x7')](),controller[_0xb750('0x9')]);router[_0xb750('0xa')](_0xb750('0xb'),auth[_0xb750('0x7')](),controller[_0xb750('0xc')]);router[_0xb750('0xd')](_0xb750('0xb'),auth['isAuthenticated'](),controller[_0xb750('0xe')]);module[_0xb750('0xf')]=router; \ No newline at end of file +var _0x32a5=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x32a5,0xc6));var _0x532a=function(_0x5a2d7a,_0x2fccc1){_0x5a2d7a=_0x5a2d7a-0x0;var _0x6b7e60=_0x32a5[_0x5a2d7a];return _0x6b7e60;};'use strict';var multer=require(_0x532a('0x0'));var util=require(_0x532a('0x1'));var path=require(_0x532a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x532a('0x3')]();var fs_extra=require(_0x532a('0x4'));var auth=require(_0x532a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x532a('0x6'));var controller=require(_0x532a('0x7'));router[_0x532a('0x8')]('/',auth['isAuthenticated'](),controller[_0x532a('0x9')]);router[_0x532a('0x8')](_0x532a('0xa'),auth[_0x532a('0xb')](),controller[_0x532a('0xc')]);router[_0x532a('0xd')]('/',auth['isAuthenticated'](),controller[_0x532a('0xe')]);router[_0x532a('0xf')](_0x532a('0xa'),auth[_0x532a('0xb')](),controller[_0x532a('0x10')]);router[_0x532a('0x11')](_0x532a('0xa'),auth[_0x532a('0xb')](),controller[_0x532a('0x12')]);module[_0x532a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d00d411..000ed67 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.attributes.js +++ b/server/api/intSugarcrmField/intSugarcrmField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36cd=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x48679d,_0x19cc7c){var _0x49ac57=function(_0x869546){while(--_0x869546){_0x48679d['push'](_0x48679d['shift']());}};_0x49ac57(++_0x19cc7c);}(_0x36cd,0x8d));var _0xd36c=function(_0x7835a,_0x7ef740){_0x7835a=_0x7835a-0x0;var _0xd46e11=_0x36cd[_0x7835a];return _0xd46e11;};'use strict';var Sequelize=require(_0xd36c('0x0'));module[_0xd36c('0x1')]={'type':{'type':Sequelize[_0xd36c('0x2')](_0xd36c('0x3'),_0xd36c('0x4'),_0xd36c('0x5'),_0xd36c('0x6'),_0xd36c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd36c('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd36c('0x2')](_0xd36c('0x3'),_0xd36c('0x4'),_0xd36c('0x5'))},'keyContent':{'type':Sequelize[_0xd36c('0x8')]},'idField':{'type':Sequelize[_0xd36c('0x8')]},'nameField':{'type':Sequelize[_0xd36c('0x8')]},'customField':{'type':Sequelize[_0xd36c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd36c('0x8')]}}; \ No newline at end of file +var _0x89cf=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x89cf,0x66));var _0xf89c=function(_0xca0fee,_0x46efa2){_0xca0fee=_0xca0fee-0x0;var _0x10b24f=_0x89cf[_0xca0fee];return _0x10b24f;};'use strict';var Sequelize=require(_0xf89c('0x0'));module[_0xf89c('0x1')]={'type':{'type':Sequelize[_0xf89c('0x2')]('string',_0xf89c('0x3'),_0xf89c('0x4'),_0xf89c('0x5'),_0xf89c('0x6')),'defaultValue':_0xf89c('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf89c('0x8')]},'keyType':{'type':Sequelize[_0xf89c('0x2')](_0xf89c('0x7'),'variable',_0xf89c('0x4'))},'keyContent':{'type':Sequelize[_0xf89c('0x8')]},'idField':{'type':Sequelize[_0xf89c('0x8')]},'nameField':{'type':Sequelize[_0xf89c('0x8')]},'customField':{'type':Sequelize[_0xf89c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 9e773b3..ebca339 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.controller.js +++ b/server/api/intSugarcrmField/intSugarcrmField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ba9=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','error','stack','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','find','catch','create','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2e6229,_0x123ed3){var _0x12d3da=function(_0x3d0fe9){while(--_0x3d0fe9){_0x2e6229['push'](_0x2e6229['shift']());}};_0x12d3da(++_0x123ed3);}(_0x5ba9,0x1ed));var _0x95ba=function(_0xd0e1be,_0x30960f){_0xd0e1be=_0xd0e1be-0x0;var _0xae97f7=_0x5ba9[_0xd0e1be];return _0xae97f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95ba('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ba('0x1'));var rp=require(_0x95ba('0x2'));var moment=require(_0x95ba('0x3'));var BPromise=require(_0x95ba('0x4'));var Mustache=require(_0x95ba('0x5'));var util=require(_0x95ba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x95ba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95ba('0x8'));var squel=require(_0x95ba('0x9'));var crypto=require(_0x95ba('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x95ba('0xb'));var toCsv=require('to-csv');var querystring=require(_0x95ba('0xc'));var Papa=require('papaparse');var Redis=require(_0x95ba('0xd'));var authService=require(_0x95ba('0xe'));var qs=require(_0x95ba('0xf'));var as=require(_0x95ba('0x10'));var hardwareService=require(_0x95ba('0x11'));var logger=require(_0x95ba('0x12'))(_0x95ba('0x13'));var utils=require(_0x95ba('0x14'));var config=require(_0x95ba('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x95ba('0x16'))['db'];function respondWithStatusCode(_0x59c2de,_0x4dad0e){_0x4dad0e=_0x4dad0e||0xcc;return function(_0x556af0){if(_0x556af0){return _0x59c2de[_0x95ba('0x17')](_0x4dad0e);}return _0x59c2de[_0x95ba('0x18')](_0x4dad0e)[_0x95ba('0x19')]();};}function respondWithResult(_0x31f81c,_0x536a3a){_0x536a3a=_0x536a3a||0xc8;return function(_0x1e4065){if(_0x1e4065){return _0x31f81c['status'](_0x536a3a)['json'](_0x1e4065);}};}function respondWithFilteredResult(_0x3ca47c,_0x5e24a9){return function(_0x5f1aa8){if(_0x5f1aa8){var _0x1c32bd=typeof _0x5e24a9['offset']===_0x95ba('0x1a')&&typeof _0x5e24a9[_0x95ba('0x1b')]===_0x95ba('0x1a');var _0x15c522=_0x5f1aa8[_0x95ba('0x1c')];var _0x5f1ad2=_0x1c32bd?0x0:_0x5e24a9[_0x95ba('0x1d')];var _0x113d4d=_0x1c32bd?_0x5f1aa8['count']:_0x5e24a9['offset']+_0x5e24a9[_0x95ba('0x1b')];var _0x4ecc2f;if(_0x113d4d>=_0x15c522){_0x113d4d=_0x15c522;_0x4ecc2f=0xc8;}else{_0x4ecc2f=0xce;}_0x3ca47c[_0x95ba('0x18')](_0x4ecc2f);return _0x3ca47c[_0x95ba('0x1e')]('Content-Range',_0x5f1ad2+'-'+_0x113d4d+'/'+_0x15c522)[_0x95ba('0x1f')](_0x5f1aa8);}return null;};}function patchUpdates(_0x311d40){return function(_0x34ba40){try{jsonpatch['apply'](_0x34ba40,_0x311d40,!![]);}catch(_0x2ce743){return BPromise[_0x95ba('0x20')](_0x2ce743);}return _0x34ba40[_0x95ba('0x21')]();};}function saveUpdates(_0x40de8f,_0x2218bf){return function(_0x145f53){if(_0x145f53){return _0x145f53[_0x95ba('0x22')](_0x40de8f)[_0x95ba('0x23')](function(_0x5cd4bc){return _0x5cd4bc;});}return null;};}function removeEntity(_0x263e41,_0x2371e7){return function(_0x288342){if(_0x288342){return _0x288342[_0x95ba('0x24')]()[_0x95ba('0x23')](function(){_0x263e41['status'](0xcc)[_0x95ba('0x19')]();});}};}function handleEntityNotFound(_0x1eacfa,_0x20ed46){return function(_0x28a6e4){if(!_0x28a6e4){_0x1eacfa['sendStatus'](0x194);}return _0x28a6e4;};}function handleError(_0x362487,_0x545d03){_0x545d03=_0x545d03||0x1f4;return function(_0x472bac){logger[_0x95ba('0x25')](_0x472bac[_0x95ba('0x26')]);if(_0x472bac['name']){delete _0x472bac['name'];}_0x362487[_0x95ba('0x18')](_0x545d03)[_0x95ba('0x27')](_0x472bac);};}exports[_0x95ba('0x28')]=function(_0x30a45f,_0x297e4a){var _0x32066d={},_0x28a630={},_0x5cba74={'count':0x0,'rows':[]};var _0x14eeb9=_[_0x95ba('0x29')](db[_0x95ba('0x2a')][_0x95ba('0x2b')],function(_0x3ffc34){return{'name':_0x3ffc34[_0x95ba('0x2c')],'type':_0x3ffc34[_0x95ba('0x2d')][_0x95ba('0x2e')]};});_0x28a630[_0x95ba('0x2f')]=_[_0x95ba('0x29')](_0x14eeb9,_0x95ba('0x30'));_0x28a630[_0x95ba('0x31')]=_[_0x95ba('0x32')](_0x30a45f[_0x95ba('0x31')]);_0x28a630[_0x95ba('0x33')]=_[_0x95ba('0x34')](_0x28a630[_0x95ba('0x2f')],_0x28a630[_0x95ba('0x31')]);_0x32066d[_0x95ba('0x35')]=_[_0x95ba('0x34')](_0x28a630[_0x95ba('0x2f')],qs[_0x95ba('0x36')](_0x30a45f[_0x95ba('0x31')][_0x95ba('0x36')]));_0x32066d[_0x95ba('0x35')]=_0x32066d['attributes'][_0x95ba('0x37')]?_0x32066d[_0x95ba('0x35')]:_0x28a630[_0x95ba('0x2f')];if(!_0x30a45f[_0x95ba('0x31')][_0x95ba('0x38')](_0x95ba('0x39'))){_0x32066d[_0x95ba('0x1b')]=qs[_0x95ba('0x1b')](_0x30a45f[_0x95ba('0x31')]['limit']);_0x32066d[_0x95ba('0x1d')]=qs[_0x95ba('0x1d')](_0x30a45f[_0x95ba('0x31')]['offset']);}_0x32066d['order']=qs['sort'](_0x30a45f['query'][_0x95ba('0x3a')]);_0x32066d[_0x95ba('0x3b')]=qs['filters'](_[_0x95ba('0x3c')](_0x30a45f['query'],_0x28a630['filters']),_0x14eeb9);if(_0x30a45f[_0x95ba('0x31')][_0x95ba('0x3d')]){_0x32066d[_0x95ba('0x3b')]=_[_0x95ba('0x3e')](_0x32066d[_0x95ba('0x3b')],{'$or':_[_0x95ba('0x29')](_0x14eeb9,function(_0x2758f8){if(_0x2758f8[_0x95ba('0x2d')]!==_0x95ba('0x3f')){var _0x1086c4={};_0x1086c4[_0x2758f8[_0x95ba('0x30')]]={'$like':'%'+_0x30a45f['query']['filter']+'%'};return _0x1086c4;}})});}_0x32066d=_[_0x95ba('0x3e')]({},_0x32066d,_0x30a45f[_0x95ba('0x40')]);var _0x16a500={'where':_0x32066d[_0x95ba('0x3b')]};return db[_0x95ba('0x2a')]['count'](_0x16a500)[_0x95ba('0x23')](function(_0x3efa5c){_0x5cba74[_0x95ba('0x1c')]=_0x3efa5c;if(_0x30a45f[_0x95ba('0x31')][_0x95ba('0x41')]){_0x32066d['include']=[{'all':!![]}];}return db[_0x95ba('0x2a')][_0x95ba('0x42')](_0x32066d);})[_0x95ba('0x23')](function(_0x1cd030){_0x5cba74[_0x95ba('0x43')]=_0x1cd030;return _0x5cba74;})[_0x95ba('0x23')](respondWithFilteredResult(_0x297e4a,_0x32066d))['catch'](handleError(_0x297e4a,null));};exports['show']=function(_0xcdec6b,_0x1d3304){var _0x11d342={'raw':!![],'where':{'id':_0xcdec6b['params']['id']}},_0x10395f={};_0x10395f[_0x95ba('0x2f')]=_[_0x95ba('0x32')](db[_0x95ba('0x2a')][_0x95ba('0x2b')]);_0x10395f[_0x95ba('0x31')]=_[_0x95ba('0x32')](_0xcdec6b[_0x95ba('0x31')]);_0x10395f[_0x95ba('0x33')]=_[_0x95ba('0x34')](_0x10395f[_0x95ba('0x2f')],_0x10395f[_0x95ba('0x31')]);_0x11d342[_0x95ba('0x35')]=_[_0x95ba('0x34')](_0x10395f['model'],qs[_0x95ba('0x36')](_0xcdec6b[_0x95ba('0x31')][_0x95ba('0x36')]));_0x11d342[_0x95ba('0x35')]=_0x11d342[_0x95ba('0x35')][_0x95ba('0x37')]?_0x11d342[_0x95ba('0x35')]:_0x10395f['model'];if(_0xcdec6b['query']['includeAll']){_0x11d342['include']=[{'all':!![]}];}_0x11d342=_[_0x95ba('0x3e')]({},_0x11d342,_0xcdec6b[_0x95ba('0x40')]);return db[_0x95ba('0x2a')][_0x95ba('0x44')](_0x11d342)[_0x95ba('0x23')](handleEntityNotFound(_0x1d3304,null))[_0x95ba('0x23')](respondWithResult(_0x1d3304,null))[_0x95ba('0x45')](handleError(_0x1d3304,null));};exports[_0x95ba('0x46')]=function(_0x249c71,_0x332acb){return db[_0x95ba('0x2a')][_0x95ba('0x46')](_0x249c71['body'],{})[_0x95ba('0x23')](respondWithResult(_0x332acb,0xc9))[_0x95ba('0x45')](handleError(_0x332acb,null));};exports[_0x95ba('0x22')]=function(_0x32fc04,_0x4cedfe){if(_0x32fc04[_0x95ba('0x47')]['id']){delete _0x32fc04[_0x95ba('0x47')]['id'];}return db[_0x95ba('0x2a')][_0x95ba('0x44')]({'where':{'id':_0x32fc04[_0x95ba('0x48')]['id']}})[_0x95ba('0x23')](handleEntityNotFound(_0x4cedfe,null))[_0x95ba('0x23')](saveUpdates(_0x32fc04[_0x95ba('0x47')],null))[_0x95ba('0x23')](respondWithResult(_0x4cedfe,null))[_0x95ba('0x45')](handleError(_0x4cedfe,null));};exports[_0x95ba('0x24')]=function(_0x9c0268,_0x153c53){return db[_0x95ba('0x2a')][_0x95ba('0x44')]({'where':{'id':_0x9c0268[_0x95ba('0x48')]['id']}})['then'](handleEntityNotFound(_0x153c53,null))[_0x95ba('0x23')](removeEntity(_0x153c53,null))[_0x95ba('0x45')](handleError(_0x153c53,null));}; \ No newline at end of file +var _0x7f67=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SugarcrmField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','zip-dir','mustache','util','path','sox'];(function(_0x208918,_0xff3172){var _0x12361d=function(_0x4304dd){while(--_0x4304dd){_0x208918['push'](_0x208918['shift']());}};_0x12361d(++_0xff3172);}(_0x7f67,0x19f));var _0x77f6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7f67[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x77f6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77f6('0x1'));var util=require(_0x77f6('0x2'));var path=require(_0x77f6('0x3'));var sox=require(_0x77f6('0x4'));var csv=require(_0x77f6('0x5'));var ejs=require(_0x77f6('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77f6('0x7'));var squel=require(_0x77f6('0x8'));var crypto=require(_0x77f6('0x9'));var jsforce=require(_0x77f6('0xa'));var deskjs=require(_0x77f6('0xb'));var toCsv=require(_0x77f6('0x5'));var querystring=require(_0x77f6('0xc'));var Papa=require(_0x77f6('0xd'));var Redis=require(_0x77f6('0xe'));var authService=require(_0x77f6('0xf'));var qs=require(_0x77f6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77f6('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x77f6('0x12'));var config=require(_0x77f6('0x13'));var licenseUtil=require(_0x77f6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xda2370,_0xa80c11){_0xa80c11=_0xa80c11||0xcc;return function(_0xd160b5){if(_0xd160b5){return _0xda2370[_0x77f6('0x15')](_0xa80c11);}return _0xda2370[_0x77f6('0x16')](_0xa80c11)[_0x77f6('0x17')]();};}function respondWithResult(_0x3ca262,_0x569747){_0x569747=_0x569747||0xc8;return function(_0x3558e8){if(_0x3558e8){return _0x3ca262['status'](_0x569747)['json'](_0x3558e8);}};}function respondWithFilteredResult(_0x26494c,_0x213e14){return function(_0x48bee1){if(_0x48bee1){var _0x472ec1=typeof _0x213e14[_0x77f6('0x18')]===_0x77f6('0x19')&&typeof _0x213e14[_0x77f6('0x1a')]==='undefined';var _0x2a5f51=_0x48bee1[_0x77f6('0x1b')];var _0x4221da=_0x472ec1?0x0:_0x213e14[_0x77f6('0x18')];var _0xdb3cf8=_0x472ec1?_0x48bee1[_0x77f6('0x1b')]:_0x213e14[_0x77f6('0x18')]+_0x213e14[_0x77f6('0x1a')];var _0x2b03b2;if(_0xdb3cf8>=_0x2a5f51){_0xdb3cf8=_0x2a5f51;_0x2b03b2=0xc8;}else{_0x2b03b2=0xce;}_0x26494c[_0x77f6('0x16')](_0x2b03b2);return _0x26494c[_0x77f6('0x1c')](_0x77f6('0x1d'),_0x4221da+'-'+_0xdb3cf8+'/'+_0x2a5f51)['json'](_0x48bee1);}return null;};}function patchUpdates(_0x46b286){return function(_0x972b8f){try{jsonpatch[_0x77f6('0x1e')](_0x972b8f,_0x46b286,!![]);}catch(_0x2dd54f){return BPromise[_0x77f6('0x1f')](_0x2dd54f);}return _0x972b8f['save']();};}function saveUpdates(_0x235e74,_0x2dba17){return function(_0x79b2a){if(_0x79b2a){return _0x79b2a[_0x77f6('0x20')](_0x235e74)[_0x77f6('0x21')](function(_0x3879d9){return _0x3879d9;});}return null;};}function removeEntity(_0x5e9dbb,_0x5caa57){return function(_0x3ec535){if(_0x3ec535){return _0x3ec535[_0x77f6('0x22')]()['then'](function(){_0x5e9dbb[_0x77f6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4536ca,_0x4788c8){return function(_0x3eae06){if(!_0x3eae06){_0x4536ca[_0x77f6('0x15')](0x194);}return _0x3eae06;};}function handleError(_0x2160d6,_0x559c6c){_0x559c6c=_0x559c6c||0x1f4;return function(_0x489686){logger['error'](_0x489686[_0x77f6('0x23')]);if(_0x489686[_0x77f6('0x24')]){delete _0x489686[_0x77f6('0x24')];}_0x2160d6[_0x77f6('0x16')](_0x559c6c)[_0x77f6('0x25')](_0x489686);};}exports[_0x77f6('0x26')]=function(_0x27efe2,_0x39354c){var _0x2df114={},_0x3df81b={},_0x3f3d5a={'count':0x0,'rows':[]};var _0x4f3c7b=_[_0x77f6('0x27')](db[_0x77f6('0x28')][_0x77f6('0x29')],function(_0x19576c){return{'name':_0x19576c['fieldName'],'type':_0x19576c[_0x77f6('0x2a')][_0x77f6('0x2b')]};});_0x3df81b[_0x77f6('0x2c')]=_['map'](_0x4f3c7b,_0x77f6('0x24'));_0x3df81b[_0x77f6('0x2d')]=_[_0x77f6('0x2e')](_0x27efe2[_0x77f6('0x2d')]);_0x3df81b[_0x77f6('0x2f')]=_[_0x77f6('0x30')](_0x3df81b[_0x77f6('0x2c')],_0x3df81b[_0x77f6('0x2d')]);_0x2df114[_0x77f6('0x31')]=_['intersection'](_0x3df81b[_0x77f6('0x2c')],qs[_0x77f6('0x32')](_0x27efe2[_0x77f6('0x2d')]['fields']));_0x2df114[_0x77f6('0x31')]=_0x2df114[_0x77f6('0x31')]['length']?_0x2df114[_0x77f6('0x31')]:_0x3df81b[_0x77f6('0x2c')];if(!_0x27efe2[_0x77f6('0x2d')][_0x77f6('0x33')](_0x77f6('0x34'))){_0x2df114[_0x77f6('0x1a')]=qs[_0x77f6('0x1a')](_0x27efe2[_0x77f6('0x2d')]['limit']);_0x2df114[_0x77f6('0x18')]=qs[_0x77f6('0x18')](_0x27efe2[_0x77f6('0x2d')][_0x77f6('0x18')]);}_0x2df114[_0x77f6('0x35')]=qs[_0x77f6('0x36')](_0x27efe2['query']['sort']);_0x2df114[_0x77f6('0x37')]=qs['filters'](_[_0x77f6('0x38')](_0x27efe2['query'],_0x3df81b[_0x77f6('0x2f')]),_0x4f3c7b);if(_0x27efe2[_0x77f6('0x2d')][_0x77f6('0x39')]){_0x2df114[_0x77f6('0x37')]=_[_0x77f6('0x3a')](_0x2df114[_0x77f6('0x37')],{'$or':_[_0x77f6('0x27')](_0x4f3c7b,function(_0x5223c3){if(_0x5223c3[_0x77f6('0x2a')]!=='VIRTUAL'){var _0x238eee={};_0x238eee[_0x5223c3[_0x77f6('0x24')]]={'$like':'%'+_0x27efe2[_0x77f6('0x2d')][_0x77f6('0x39')]+'%'};return _0x238eee;}})});}_0x2df114=_[_0x77f6('0x3a')]({},_0x2df114,_0x27efe2[_0x77f6('0x3b')]);var _0x1af76f={'where':_0x2df114['where']};return db['SugarcrmField'][_0x77f6('0x1b')](_0x1af76f)['then'](function(_0x3b7343){_0x3f3d5a[_0x77f6('0x1b')]=_0x3b7343;if(_0x27efe2[_0x77f6('0x2d')][_0x77f6('0x3c')]){_0x2df114[_0x77f6('0x3d')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x2df114);})[_0x77f6('0x21')](function(_0x382e1a){_0x3f3d5a[_0x77f6('0x3e')]=_0x382e1a;return _0x3f3d5a;})[_0x77f6('0x21')](respondWithFilteredResult(_0x39354c,_0x2df114))[_0x77f6('0x3f')](handleError(_0x39354c,null));};exports[_0x77f6('0x40')]=function(_0x44390e,_0x28b0a3){var _0x1c2ec0={'raw':!![],'where':{'id':_0x44390e[_0x77f6('0x41')]['id']}},_0x5f1189={};_0x5f1189['model']=_['keys'](db['SugarcrmField'][_0x77f6('0x29')]);_0x5f1189[_0x77f6('0x2d')]=_['keys'](_0x44390e[_0x77f6('0x2d')]);_0x5f1189[_0x77f6('0x2f')]=_[_0x77f6('0x30')](_0x5f1189[_0x77f6('0x2c')],_0x5f1189['query']);_0x1c2ec0['attributes']=_[_0x77f6('0x30')](_0x5f1189[_0x77f6('0x2c')],qs[_0x77f6('0x32')](_0x44390e[_0x77f6('0x2d')][_0x77f6('0x32')]));_0x1c2ec0[_0x77f6('0x31')]=_0x1c2ec0[_0x77f6('0x31')][_0x77f6('0x42')]?_0x1c2ec0[_0x77f6('0x31')]:_0x5f1189[_0x77f6('0x2c')];if(_0x44390e['query']['includeAll']){_0x1c2ec0[_0x77f6('0x3d')]=[{'all':!![]}];}_0x1c2ec0=_[_0x77f6('0x3a')]({},_0x1c2ec0,_0x44390e['options']);return db['SugarcrmField'][_0x77f6('0x43')](_0x1c2ec0)['then'](handleEntityNotFound(_0x28b0a3,null))[_0x77f6('0x21')](respondWithResult(_0x28b0a3,null))[_0x77f6('0x3f')](handleError(_0x28b0a3,null));};exports[_0x77f6('0x44')]=function(_0x4eaad8,_0x475efb){return db['SugarcrmField']['create'](_0x4eaad8['body'],{})[_0x77f6('0x21')](respondWithResult(_0x475efb,0xc9))[_0x77f6('0x3f')](handleError(_0x475efb,null));};exports[_0x77f6('0x20')]=function(_0x440fdd,_0x1c18bc){if(_0x440fdd['body']['id']){delete _0x440fdd[_0x77f6('0x45')]['id'];}return db[_0x77f6('0x28')][_0x77f6('0x43')]({'where':{'id':_0x440fdd[_0x77f6('0x41')]['id']}})[_0x77f6('0x21')](handleEntityNotFound(_0x1c18bc,null))['then'](saveUpdates(_0x440fdd[_0x77f6('0x45')],null))[_0x77f6('0x21')](respondWithResult(_0x1c18bc,null))[_0x77f6('0x3f')](handleError(_0x1c18bc,null));};exports[_0x77f6('0x22')]=function(_0xe7daa4,_0x2cfa51){return db['SugarcrmField'][_0x77f6('0x43')]({'where':{'id':_0xe7daa4[_0x77f6('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cfa51,null))[_0x77f6('0x21')](removeEntity(_0x2cfa51,null))['catch'](handleError(_0x2cfa51,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4da1a02..0743cfc 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.model.js +++ b/server/api/intSugarcrmField/intSugarcrmField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8431=['api','request-promise','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8431,0x8d));var _0x1843=function(_0x4a12aa,_0x16771b){_0x4a12aa=_0x4a12aa-0x0;var _0x5cbc5d=_0x8431[_0x4a12aa];return _0x5cbc5d;};'use strict';var _=require(_0x1843('0x0'));var util=require(_0x1843('0x1'));var logger=require(_0x1843('0x2'))(_0x1843('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1843('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1843('0x5'));module[_0x1843('0x6')]=function(_0x450629,_0x503cb3){return _0x450629[_0x1843('0x7')](_0x1843('0x8'),attributes,{'tableName':_0x1843('0x9'),'paranoid':![],'indexes':[{'name':_0x1843('0xa'),'fields':['idField',_0x1843('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x784c=['idField','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x784c,0xb6));var _0xc784=function(_0x4f3ecd,_0x4106c2){_0x4f3ecd=_0x4f3ecd-0x0;var _0x39958d=_0x784c[_0x4f3ecd];return _0x39958d;};'use strict';var _=require(_0xc784('0x0'));var util=require(_0xc784('0x1'));var logger=require('../../config/logger')(_0xc784('0x2'));var moment=require(_0xc784('0x3'));var BPromise=require(_0xc784('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc784('0x5'));var rimraf=require(_0xc784('0x6'));var config=require(_0xc784('0x7'));var attributes=require(_0xc784('0x8'));module[_0xc784('0x9')]=function(_0x10f584,_0xcb515d){return _0x10f584[_0xc784('0xa')](_0xc784('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xc784('0xc'),'fields':[_0xc784('0xd'),_0xc784('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index e1f4e92..f25ebb7 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a80=['then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1a80,0xc2));var _0x01a8=function(_0x30c925,_0x31fae9){_0x30c925=_0x30c925-0x0;var _0x33ae1d=_0x1a80[_0x30c925];return _0x33ae1d;};'use strict';var _=require(_0x01a8('0x0'));var util=require(_0x01a8('0x1'));var moment=require(_0x01a8('0x2'));var BPromise=require(_0x01a8('0x3'));var rs=require(_0x01a8('0x4'));var fs=require('fs');var Redis=require(_0x01a8('0x5'));var db=require(_0x01a8('0x6'))['db'];var utils=require(_0x01a8('0x7'));var logger=require('../../config/logger')(_0x01a8('0x8'));var config=require(_0x01a8('0x9'));var jayson=require(_0x01a8('0xa'));var client=jayson[_0x01a8('0xb')][_0x01a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ec80d,_0x13cc28,_0x36d7b6){return new BPromise(function(_0x3efe43,_0x4c2258){return client['request'](_0x2ec80d,_0x36d7b6)[_0x01a8('0xd')](function(_0x1cdcec){logger[_0x01a8('0xe')](_0x01a8('0xf'),_0x13cc28,'request\x20sent');logger['debug'](_0x01a8('0x10'),_0x13cc28,_0x01a8('0x11'),JSON[_0x01a8('0x12')](_0x1cdcec));if(_0x1cdcec[_0x01a8('0x13')]){if(_0x1cdcec[_0x01a8('0x13')][_0x01a8('0x14')]===0x1f4){logger[_0x01a8('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x13cc28,_0x1cdcec[_0x01a8('0x13')][_0x01a8('0x15')]);return _0x4c2258(_0x1cdcec[_0x01a8('0x13')][_0x01a8('0x15')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x13cc28,_0x1cdcec[_0x01a8('0x13')][_0x01a8('0x15')]);return _0x3efe43(_0x1cdcec[_0x01a8('0x13')][_0x01a8('0x15')]);}else{logger[_0x01a8('0xe')](_0x01a8('0xf'),_0x13cc28,_0x01a8('0x11'));_0x3efe43(_0x1cdcec['result']['message']);}})[_0x01a8('0x16')](function(_0x20fdf9){logger['error'](_0x01a8('0xf'),_0x13cc28,_0x20fdf9);_0x4c2258(_0x20fdf9);});});} \ No newline at end of file +var _0xdd11=['catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x18fc36,_0x3eafc1){var _0x291419=function(_0x5673d4){while(--_0x5673d4){_0x18fc36['push'](_0x18fc36['shift']());}};_0x291419(++_0x3eafc1);}(_0xdd11,0x169));var _0x1dd1=function(_0x2ca63a,_0x2d4b8f){_0x2ca63a=_0x2ca63a-0x0;var _0x18da3c=_0xdd11[_0x2ca63a];return _0x18da3c;};'use strict';var _=require('lodash');var util=require(_0x1dd1('0x0'));var moment=require(_0x1dd1('0x1'));var BPromise=require(_0x1dd1('0x2'));var rs=require(_0x1dd1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1dd1('0x4'));var logger=require(_0x1dd1('0x5'))(_0x1dd1('0x6'));var config=require('../../config/environment');var jayson=require(_0x1dd1('0x7'));var client=jayson[_0x1dd1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x135a40,_0x327bfc,_0x229287){return new BPromise(function(_0x7b578a,_0x3cf208){return client[_0x1dd1('0x9')](_0x135a40,_0x229287)[_0x1dd1('0xa')](function(_0x34aee0){logger[_0x1dd1('0xb')](_0x1dd1('0xc'),_0x327bfc,_0x1dd1('0xd'));logger[_0x1dd1('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x327bfc,_0x1dd1('0xd'),JSON['stringify'](_0x34aee0));if(_0x34aee0[_0x1dd1('0xf')]){if(_0x34aee0[_0x1dd1('0xf')][_0x1dd1('0x10')]===0x1f4){logger[_0x1dd1('0xf')](_0x1dd1('0xc'),_0x327bfc,_0x34aee0['error']['message']);return _0x3cf208(_0x34aee0[_0x1dd1('0xf')]['message']);}logger['error'](_0x1dd1('0xc'),_0x327bfc,_0x34aee0[_0x1dd1('0xf')][_0x1dd1('0x11')]);return _0x7b578a(_0x34aee0[_0x1dd1('0xf')]['message']);}else{logger[_0x1dd1('0xb')](_0x1dd1('0xc'),_0x327bfc,_0x1dd1('0xd'));_0x7b578a(_0x34aee0[_0x1dd1('0x12')][_0x1dd1('0x11')]);}})[_0x1dd1('0x13')](function(_0x550641){logger[_0x1dd1('0xf')](_0x1dd1('0xc'),_0x327bfc,_0x550641);_0x3cf208(_0x550641);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 5f7ef41..5d97a14 100644 --- a/server/api/intVtigerAccount/index.js +++ b/server/api/intVtigerAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f49=['connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','util','path'];(function(_0x1147d1,_0x173f70){var _0xeea469=function(_0x105e56){while(--_0x105e56){_0x1147d1['push'](_0x1147d1['shift']());}};_0xeea469(++_0x173f70);}(_0x6f49,0xa6));var _0x96f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f49[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x96f4('0x0'));var path=require(_0x96f4('0x1'));var timeout=require(_0x96f4('0x2'));var express=require(_0x96f4('0x3'));var router=express[_0x96f4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96f4('0x5'));var controller=require('./intVtigerAccount.controller');router[_0x96f4('0x6')]('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x8')]);router['get'](_0x96f4('0x9'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xa')]);router[_0x96f4('0x6')](_0x96f4('0xb'),auth[_0x96f4('0x7')](),controller[_0x96f4('0xc')]);router[_0x96f4('0x6')](_0x96f4('0xd'),auth['isAuthenticated'](),controller[_0x96f4('0xe')]);router[_0x96f4('0xf')]('/',auth[_0x96f4('0x7')](),controller[_0x96f4('0x10')]);router[_0x96f4('0xf')]('/:id/configurations',auth[_0x96f4('0x7')](),controller[_0x96f4('0x11')]);router[_0x96f4('0x12')]('/:id',auth[_0x96f4('0x7')](),controller[_0x96f4('0x13')]);router[_0x96f4('0x14')](_0x96f4('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98d5=['/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','get','show','getConfigurations'];(function(_0x45ded2,_0x395fbc){var _0x42875b=function(_0x3becd3){while(--_0x3becd3){_0x45ded2['push'](_0x45ded2['shift']());}};_0x42875b(++_0x395fbc);}(_0x98d5,0xfb));var _0x598d=function(_0x79753a,_0x83e789){_0x79753a=_0x79753a-0x0;var _0x3e72be=_0x98d5[_0x79753a];return _0x3e72be;};'use strict';var multer=require(_0x598d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x598d('0x1'));var express=require(_0x598d('0x2'));var router=express[_0x598d('0x3')]();var fs_extra=require(_0x598d('0x4'));var auth=require(_0x598d('0x5'));var interaction=require(_0x598d('0x6'));var config=require(_0x598d('0x7'));var controller=require(_0x598d('0x8'));router['get']('/',auth[_0x598d('0x9')](),controller['index']);router[_0x598d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x598d('0xb')]);router[_0x598d('0xa')]('/:id/configurations',auth[_0x598d('0x9')](),controller[_0x598d('0xc')]);router[_0x598d('0xa')](_0x598d('0xd'),auth[_0x598d('0x9')](),controller[_0x598d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x598d('0xf')]);router[_0x598d('0x10')](_0x598d('0x11'),auth[_0x598d('0x9')](),controller[_0x598d('0x12')]);router[_0x598d('0x13')](_0x598d('0x14'),auth[_0x598d('0x9')](),controller[_0x598d('0x15')]);router[_0x598d('0x16')](_0x598d('0x14'),auth[_0x598d('0x9')](),controller['destroy']);module[_0x598d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index f4e752c..5108b12 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.attributes.js +++ b/server/api/intVtigerAccount/intVtigerAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37b3=['STRING','exports'];(function(_0x508b75,_0x160bad){var _0x52e510=function(_0x478b40){while(--_0x478b40){_0x508b75['push'](_0x508b75['shift']());}};_0x52e510(++_0x160bad);}(_0x37b3,0x85));var _0x337b=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x37b3[_0x3eff21];return _0x1945bb;};'use strict';var Sequelize=require('sequelize');module[_0x337b('0x0')]={'name':{'type':Sequelize[_0x337b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x337b('0x1')]},'username':{'type':Sequelize[_0x337b('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x337b('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x337b('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x337b('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x337b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf955=['STRING'];(function(_0x976e1f,_0x352c93){var _0x581a74=function(_0x255ec5){while(--_0x255ec5){_0x976e1f['push'](_0x976e1f['shift']());}};_0x581a74(++_0x352c93);}(_0xf955,0x197));var _0x5f95=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xf955[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5f95('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5f95('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5f95('0x0')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x5f95('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5f95('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 43d35dc..36277ee 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.controller.js +++ b/server/api/intVtigerAccount/intVtigerAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8180=['../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','status','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','md5','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','result','token','success','sessionName','autogenerated','reference','owner','remove','includes','editable','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x188dec,_0x1c79d9){var _0x3458a2=function(_0x5428e3){while(--_0x5428e3){_0x188dec['push'](_0x188dec['shift']());}};_0x3458a2(++_0x1c79d9);}(_0x8180,0x65));var _0x0818=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x8180[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0x0818('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0818('0x1'));var rp=require(_0x0818('0x2'));var moment=require(_0x0818('0x3'));var BPromise=require(_0x0818('0x4'));var Mustache=require(_0x0818('0x5'));var util=require(_0x0818('0x6'));var path=require(_0x0818('0x7'));var sox=require(_0x0818('0x8'));var csv=require(_0x0818('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0818('0xa'));var _=require(_0x0818('0xb'));var squel=require(_0x0818('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0818('0xd'));var toCsv=require(_0x0818('0x9'));var querystring=require(_0x0818('0xe'));var Papa=require(_0x0818('0xf'));var Redis=require(_0x0818('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0818('0x11'));var hardwareService=require(_0x0818('0x12'));var logger=require(_0x0818('0x13'))(_0x0818('0x14'));var utils=require(_0x0818('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0818('0x16'));var db=require(_0x0818('0x17'))['db'];var integrations=require(_0x0818('0x18'));function respondWithStatusCode(_0x9011e2,_0x3bc4ae){_0x3bc4ae=_0x3bc4ae||0xcc;return function(_0x4a0b32){if(_0x4a0b32){return _0x9011e2[_0x0818('0x19')](_0x3bc4ae);}return _0x9011e2['status'](_0x3bc4ae)[_0x0818('0x1a')]();};}function respondWithResult(_0x35e78a,_0x3a84c3){_0x3a84c3=_0x3a84c3||0xc8;return function(_0x12b475){if(_0x12b475){return _0x35e78a['status'](_0x3a84c3)['json'](_0x12b475);}};}function respondWithFilteredResult(_0x506556,_0xb2087a){return function(_0x1fa0f7){if(_0x1fa0f7){var _0x3d6c44=typeof _0xb2087a[_0x0818('0x1b')]===_0x0818('0x1c')&&typeof _0xb2087a[_0x0818('0x1d')]==='undefined';var _0x8d6514=_0x1fa0f7[_0x0818('0x1e')];var _0xdf8929=_0x3d6c44?0x0:_0xb2087a[_0x0818('0x1b')];var _0x847221=_0x3d6c44?_0x1fa0f7[_0x0818('0x1e')]:_0xb2087a[_0x0818('0x1b')]+_0xb2087a[_0x0818('0x1d')];var _0x50e2a2;if(_0x847221>=_0x8d6514){_0x847221=_0x8d6514;_0x50e2a2=0xc8;}else{_0x50e2a2=0xce;}_0x506556['status'](_0x50e2a2);return _0x506556[_0x0818('0x1f')](_0x0818('0x20'),_0xdf8929+'-'+_0x847221+'/'+_0x8d6514)[_0x0818('0x21')](_0x1fa0f7);}return null;};}function patchUpdates(_0x49fb49){return function(_0x3ed8bf){try{jsonpatch['apply'](_0x3ed8bf,_0x49fb49,!![]);}catch(_0x218da1){return BPromise[_0x0818('0x22')](_0x218da1);}return _0x3ed8bf['save']();};}function saveUpdates(_0x4b7c83,_0x279047){return function(_0x498ef6){if(_0x498ef6){return _0x498ef6[_0x0818('0x23')](_0x4b7c83)[_0x0818('0x24')](function(_0x2a80b0){return _0x2a80b0;});}return null;};}function removeEntity(_0x59f7f1,_0x1fe5ed){return function(_0x462c92){if(_0x462c92){return _0x462c92['destroy']()[_0x0818('0x24')](function(){_0x59f7f1[_0x0818('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422750,_0x4d243f){return function(_0x5cda9f){if(!_0x5cda9f){_0x422750[_0x0818('0x19')](0x194);}return _0x5cda9f;};}function handleError(_0x1bd371,_0x2598c8){_0x2598c8=_0x2598c8||0x1f4;return function(_0x53639e){logger[_0x0818('0x26')](_0x53639e[_0x0818('0x27')]);if(_0x53639e[_0x0818('0x28')]){delete _0x53639e[_0x0818('0x28')];}_0x1bd371[_0x0818('0x25')](_0x2598c8)[_0x0818('0x29')](_0x53639e);};}exports[_0x0818('0x2a')]=function(_0x37e57c,_0x5327b8){var _0x3c2115={},_0x486cc3={},_0x4e915b={'count':0x0,'rows':[]};var _0x280602=_[_0x0818('0x2b')](db[_0x0818('0x2c')][_0x0818('0x2d')],function(_0x460245){return{'name':_0x460245[_0x0818('0x2e')],'type':_0x460245['type'][_0x0818('0x2f')]};});_0x486cc3['model']=_[_0x0818('0x2b')](_0x280602,_0x0818('0x28'));_0x486cc3[_0x0818('0x30')]=_[_0x0818('0x31')](_0x37e57c[_0x0818('0x30')]);_0x486cc3[_0x0818('0x32')]=_['intersection'](_0x486cc3[_0x0818('0x33')],_0x486cc3[_0x0818('0x30')]);_0x3c2115[_0x0818('0x34')]=_[_0x0818('0x35')](_0x486cc3[_0x0818('0x33')],qs[_0x0818('0x36')](_0x37e57c[_0x0818('0x30')]['fields']));_0x3c2115[_0x0818('0x34')]=_0x3c2115[_0x0818('0x34')][_0x0818('0x37')]?_0x3c2115['attributes']:_0x486cc3[_0x0818('0x33')];if(!_0x37e57c[_0x0818('0x30')][_0x0818('0x38')](_0x0818('0x39'))){_0x3c2115['limit']=qs[_0x0818('0x1d')](_0x37e57c[_0x0818('0x30')][_0x0818('0x1d')]);_0x3c2115[_0x0818('0x1b')]=qs[_0x0818('0x1b')](_0x37e57c[_0x0818('0x30')]['offset']);}_0x3c2115[_0x0818('0x3a')]=qs[_0x0818('0x3b')](_0x37e57c[_0x0818('0x30')]['sort']);_0x3c2115[_0x0818('0x3c')]=qs[_0x0818('0x32')](_[_0x0818('0x3d')](_0x37e57c[_0x0818('0x30')],_0x486cc3['filters']),_0x280602);if(_0x37e57c['query'][_0x0818('0x3e')]){_0x3c2115[_0x0818('0x3c')]=_['merge'](_0x3c2115['where'],{'$or':_[_0x0818('0x2b')](_0x280602,function(_0x251ec4){if(_0x251ec4[_0x0818('0x3f')]!==_0x0818('0x40')){var _0x20f37a={};_0x20f37a[_0x251ec4['name']]={'$like':'%'+_0x37e57c['query'][_0x0818('0x3e')]+'%'};return _0x20f37a;}})});}_0x3c2115=_[_0x0818('0x41')]({},_0x3c2115,_0x37e57c[_0x0818('0x42')]);var _0x362a3f={'where':_0x3c2115['where']};return db['VtigerAccount'][_0x0818('0x1e')](_0x362a3f)['then'](function(_0x4f3f37){_0x4e915b[_0x0818('0x1e')]=_0x4f3f37;if(_0x37e57c[_0x0818('0x30')][_0x0818('0x43')]){_0x3c2115[_0x0818('0x44')]=[{'all':!![]}];}return db[_0x0818('0x2c')]['findAll'](_0x3c2115);})[_0x0818('0x24')](function(_0x377ab4){_0x4e915b[_0x0818('0x45')]=_0x377ab4;return _0x4e915b;})[_0x0818('0x24')](respondWithFilteredResult(_0x5327b8,_0x3c2115))[_0x0818('0x46')](handleError(_0x5327b8,null));};exports[_0x0818('0x47')]=function(_0x41d827,_0x152ca9){var _0x57b83f={'raw':![],'where':{'id':_0x41d827['params']['id']}},_0x449ca4={};_0x449ca4[_0x0818('0x33')]=_[_0x0818('0x31')](db[_0x0818('0x2c')][_0x0818('0x2d')]);_0x449ca4['query']=_[_0x0818('0x31')](_0x41d827[_0x0818('0x30')]);_0x449ca4[_0x0818('0x32')]=_['intersection'](_0x449ca4[_0x0818('0x33')],_0x449ca4[_0x0818('0x30')]);_0x57b83f[_0x0818('0x34')]=_[_0x0818('0x35')](_0x449ca4[_0x0818('0x33')],qs[_0x0818('0x36')](_0x41d827[_0x0818('0x30')][_0x0818('0x36')]));_0x57b83f[_0x0818('0x34')]=_0x57b83f[_0x0818('0x34')][_0x0818('0x37')]?_0x57b83f['attributes']:_0x449ca4['model'];if(_0x41d827[_0x0818('0x30')]['includeAll']){_0x57b83f[_0x0818('0x44')]=[{'all':!![]}];}_0x57b83f=_['merge']({},_0x57b83f,_0x41d827['options']);return db[_0x0818('0x2c')][_0x0818('0x48')](_0x57b83f)[_0x0818('0x24')](handleEntityNotFound(_0x152ca9,null))[_0x0818('0x24')](respondWithResult(_0x152ca9,null))['catch'](handleError(_0x152ca9,null));};exports['create']=function(_0x35e76a,_0x332153){return db['VtigerAccount'][_0x0818('0x49')](_0x35e76a[_0x0818('0x4a')],{})[_0x0818('0x24')](respondWithResult(_0x332153,0xc9))[_0x0818('0x46')](handleError(_0x332153,null));};exports[_0x0818('0x23')]=function(_0x1f02cf,_0x3beb33){if(_0x1f02cf[_0x0818('0x4a')]['id']){delete _0x1f02cf['body']['id'];}return db[_0x0818('0x2c')][_0x0818('0x48')]({'where':{'id':_0x1f02cf[_0x0818('0x4b')]['id']}})[_0x0818('0x24')](handleEntityNotFound(_0x3beb33,null))['then'](saveUpdates(_0x1f02cf[_0x0818('0x4a')],null))[_0x0818('0x24')](respondWithResult(_0x3beb33,null))[_0x0818('0x46')](handleError(_0x3beb33,null));};exports[_0x0818('0x4c')]=function(_0x322b05,_0x3d38f1){return db['VtigerAccount']['find']({'where':{'id':_0x322b05[_0x0818('0x4b')]['id']}})[_0x0818('0x24')](handleEntityNotFound(_0x3d38f1,null))[_0x0818('0x24')](removeEntity(_0x3d38f1,null))[_0x0818('0x46')](handleError(_0x3d38f1,null));};exports['getConfigurations']=function(_0x3331f9,_0x421c93,_0x30fddb){var _0x137631={};var _0x229e86={};var _0xd9577c;var _0x395aea;return db[_0x0818('0x2c')][_0x0818('0x4d')]({'where':{'id':_0x3331f9[_0x0818('0x4b')]['id']}})['then'](handleEntityNotFound(_0x421c93,null))[_0x0818('0x24')](function(_0x363bcc){if(_0x363bcc){_0xd9577c=_0x363bcc;_0x229e86[_0x0818('0x33')]=_[_0x0818('0x31')](db[_0x0818('0x4e')][_0x0818('0x2d')]);_0x229e86[_0x0818('0x30')]=_[_0x0818('0x31')](_0x3331f9[_0x0818('0x30')]);_0x229e86[_0x0818('0x32')]=_['intersection'](_0x229e86[_0x0818('0x33')],_0x229e86[_0x0818('0x30')]);_0x137631[_0x0818('0x34')]=_['intersection'](_0x229e86[_0x0818('0x33')],qs['fields'](_0x3331f9['query'][_0x0818('0x36')]));_0x137631[_0x0818('0x34')]=_0x137631[_0x0818('0x34')][_0x0818('0x37')]?_0x137631[_0x0818('0x34')]:_0x229e86['model'];_0x137631['order']=qs[_0x0818('0x3b')](_0x3331f9['query'][_0x0818('0x3b')]);_0x137631['where']=qs[_0x0818('0x32')](_['pick'](_0x3331f9[_0x0818('0x30')],_0x229e86['filters']));if(_0x3331f9['query'][_0x0818('0x3e')]){_0x137631[_0x0818('0x3c')]=_['merge'](_0x137631['where'],{'$or':_[_0x0818('0x2b')](_0x137631[_0x0818('0x34')],function(_0x577bf0){var _0x496e98={};_0x496e98[_0x577bf0]={'$like':'%'+_0x3331f9[_0x0818('0x30')][_0x0818('0x3e')]+'%'};return _0x496e98;})});}_0x137631=_[_0x0818('0x41')]({},_0x137631,_0x3331f9[_0x0818('0x42')]);return _0xd9577c[_0x0818('0x4f')](_0x137631);}})[_0x0818('0x24')](function(_0x1b1434){if(_0x1b1434){_0x395aea=_0x1b1434[_0x0818('0x37')];if(!_0x3331f9['query'][_0x0818('0x38')]('nolimit')){_0x137631['limit']=qs[_0x0818('0x1d')](_0x3331f9['query'][_0x0818('0x1d')]);_0x137631[_0x0818('0x1b')]=qs['offset'](_0x3331f9[_0x0818('0x30')]['offset']);}return _0xd9577c[_0x0818('0x4f')](_0x137631);}})[_0x0818('0x24')](function(_0x22afc4){if(_0x22afc4){return _0x22afc4?{'count':_0x395aea,'rows':_0x22afc4}:null;}})[_0x0818('0x24')](respondWithResult(_0x421c93,null))[_0x0818('0x46')](handleError(_0x421c93,null));};exports[_0x0818('0x50')]=function(_0x318f38,_0x1004f6,_0x5363f7){if(_0x318f38[_0x0818('0x4a')]['id']){delete _0x318f38[_0x0818('0x4a')]['id'];}return db[_0x0818('0x2c')]['findOne']({'where':{'id':_0x318f38[_0x0818('0x4b')]['id']}})[_0x0818('0x24')](handleEntityNotFound(_0x1004f6,null))[_0x0818('0x24')](function(_0x1256f8){if(_0x1256f8){_0x318f38[_0x0818('0x4a')][_0x0818('0x51')]=_0x1256f8['id'];_0x318f38[_0x0818('0x4a')][_0x0818('0x52')]=integrations['getSubjects'](_0x318f38[_0x0818('0x4a')][_0x0818('0x53')],_0x318f38['body'][_0x0818('0x3f')]);_0x318f38[_0x0818('0x4a')][_0x0818('0x54')]=integrations[_0x0818('0x55')](_0x318f38[_0x0818('0x4a')][_0x0818('0x53')],_0x318f38[_0x0818('0x4a')][_0x0818('0x3f')]);return db[_0x0818('0x4e')][_0x0818('0x49')](_0x318f38[_0x0818('0x4a')],{'include':[{'model':db['VtigerField'],'as':_0x0818('0x52')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x0818('0x24')](respondWithResult(_0x1004f6,null))[_0x0818('0x46')](handleError(_0x1004f6,null));};var md5=require(_0x0818('0x56'));exports['getFields']=function(_0x1a4cb3,_0x30fe98,_0x1cc614){var _0x44eac3=null;var _0x2eff39=null;var _0x6984b3=null;var _0x4cc67=null;var _0x3a55bb='';return db[_0x0818('0x2c')]['findOne']({'where':{'id':_0x1a4cb3['params']['id']},'attributes':['id',_0x0818('0x28'),_0x0818('0x57'),_0x0818('0x58'),'moduleName',_0x0818('0x59'),_0x0818('0x5a'),_0x0818('0x5b')]})[_0x0818('0x24')](handleEntityNotFound(_0x30fe98,null))[_0x0818('0x24')](function(_0x359b78){if(_0x359b78){_0x44eac3=_0x359b78[_0x0818('0x57')];_0x2eff39=_0x359b78['accessKey'];_0x6984b3=_0x359b78[_0x0818('0x5c')];_0x3a55bb=_0x359b78['remoteUri'];var _0x30b9c8=_0x3a55bb['slice'](-0x1);if(_0x30b9c8==='/'){_0x3a55bb=_0x3a55bb[_0x0818('0x5d')](0x0,_0x3a55bb[_0x0818('0x5e')](_0x30b9c8));}_0x4cc67=util[_0x0818('0x5f')](_0x0818('0x60'),_0x3a55bb);var _0x74d414={'method':_0x0818('0x61'),'uri':_0x4cc67,'qs':{'operation':_0x0818('0x62'),'username':_0x359b78[_0x0818('0x57')]},'json':!![]};return rp(_0x74d414);}})[_0x0818('0x24')](function(_0x2886a5){if(_0x2886a5['success']){var _0x314041={'method':_0x0818('0x63'),'uri':_0x4cc67,'form':{'operation':'login','username':_0x44eac3,'accessKey':md5(_0x2886a5[_0x0818('0x64')][_0x0818('0x65')]+_0x2eff39)},'json':!![]};return rp(_0x314041);}})[_0x0818('0x24')](function(_0x474bb2){if(_0x474bb2[_0x0818('0x66')]){var _0x37a499={'method':'GET','uri':_0x4cc67,'qs':{'operation':'describe','username':_0x44eac3,'sessionName':_0x474bb2['result'][_0x0818('0x67')],'elementType':_0x6984b3},'json':!![]};return rp(_0x37a499);}})[_0x0818('0x24')](function(_0x28c4ee){if(_0x28c4ee[_0x0818('0x66')]){var _0x3f7077=[_0x0818('0x68'),_0x0818('0x69'),_0x0818('0x6a')];_[_0x0818('0x6b')](_0x28c4ee[_0x0818('0x64')]['fields'],function(_0x5a1918){return _0x3f7077[_0x0818('0x6c')](_0x5a1918[_0x0818('0x3f')]['name']);});_[_0x0818('0x6b')](_0x28c4ee['result']['fields'],function(_0x3a57de){return _0x3a57de[_0x0818('0x6d')]==='false';});return{'count':_0x28c4ee[_0x0818('0x64')]['fields'][_0x0818('0x37')],'rows':_[_0x0818('0x2b')](_0x28c4ee['result'][_0x0818('0x36')],function(_0x4d0257){return{'id':_0x4d0257[_0x0818('0x28')],'name':_0x4d0257['label'],'custom':_['startsWith'](_0x4d0257[_0x0818('0x28')],_0x0818('0x6e'))?!![]:![],'options':_0x4d0257['type']['name']===_0x0818('0x6f')&&_0x4d0257[_0x0818('0x3f')][_0x0818('0x70')][_0x0818('0x37')]>0x0?_[_0x0818('0x2b')](_0x4d0257[_0x0818('0x3f')][_0x0818('0x70')],function(_0x5d0f5f){return{'name':_0x5d0f5f[_0x0818('0x71')],'value':_0x5d0f5f[_0x0818('0x72')]};}):[]};})};}})['then'](respondWithResult(_0x30fe98,null))[_0x0818('0x46')](function(_0x3e5a4d){console[_0x0818('0x73')](_0x0818('0x74')+_0x3e5a4d);var _0x154fcd=_0x1a4cb3['query'][_0x0818('0x75')]?0x1f4:_0x3e5a4d[_0x0818('0x76')]||0x1f4;logger[_0x0818('0x26')](_0x0818('0x77'),'getFields',_0x154fcd,JSON[_0x0818('0x78')](_0x3e5a4d));delete _0x3e5a4d[_0x0818('0x28')];if(_0x154fcd===0x191){_0x154fcd=0x190;}_0x30fe98[_0x0818('0x25')](_0x154fcd)['send'](_0x1a4cb3['query']['test']?{'message':_0x0818('0x79'),'statusCode':_0x3e5a4d[_0x0818('0x76')]}:_0x3e5a4d);});}; \ No newline at end of file +var _0xdea7=['catch','create','body','getConfigurations','findOne','VtigerConfiguration','pick','AccountId','Subjects','getSubjects','getDescriptions','VtigerField','Descriptions','md5','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','format','%s/webservice.php','GET','success','POST','result','token','sessionName','autogenerated','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','keys','include','find'];(function(_0x1b478c,_0x250686){var _0x107989=function(_0x42840e){while(--_0x42840e){_0x1b478c['push'](_0x1b478c['shift']());}};_0x107989(++_0x250686);}(_0xdea7,0xa3));var _0x7dea=function(_0x538a12,_0x5ca1d5){_0x538a12=_0x538a12-0x0;var _0xc20852=_0xdea7[_0x538a12];return _0xc20852;};'use strict';var emlformat=require(_0x7dea('0x0'));var rimraf=require(_0x7dea('0x1'));var zipdir=require(_0x7dea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dea('0x3'));var moment=require(_0x7dea('0x4'));var BPromise=require(_0x7dea('0x5'));var Mustache=require(_0x7dea('0x6'));var util=require(_0x7dea('0x7'));var path=require(_0x7dea('0x8'));var sox=require(_0x7dea('0x9'));var csv=require(_0x7dea('0xa'));var ejs=require(_0x7dea('0xb'));var fs=require('fs');var fs_extra=require(_0x7dea('0xc'));var _=require(_0x7dea('0xd'));var squel=require(_0x7dea('0xe'));var crypto=require(_0x7dea('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7dea('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7dea('0x11'));var Papa=require(_0x7dea('0x12'));var Redis=require('ioredis');var authService=require(_0x7dea('0x13'));var qs=require(_0x7dea('0x14'));var as=require(_0x7dea('0x15'));var hardwareService=require(_0x7dea('0x16'));var logger=require(_0x7dea('0x17'))(_0x7dea('0x18'));var utils=require(_0x7dea('0x19'));var config=require(_0x7dea('0x1a'));var licenseUtil=require(_0x7dea('0x1b'));var db=require(_0x7dea('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b32cd,_0x486275){_0x486275=_0x486275||0xcc;return function(_0x47a7a5){if(_0x47a7a5){return _0x1b32cd[_0x7dea('0x1d')](_0x486275);}return _0x1b32cd[_0x7dea('0x1e')](_0x486275)['end']();};}function respondWithResult(_0x239032,_0x50adba){_0x50adba=_0x50adba||0xc8;return function(_0x2364f9){if(_0x2364f9){return _0x239032[_0x7dea('0x1e')](_0x50adba)[_0x7dea('0x1f')](_0x2364f9);}};}function respondWithFilteredResult(_0x5754c3,_0x53fc5f){return function(_0x2392b8){if(_0x2392b8){var _0x13ab45=typeof _0x53fc5f[_0x7dea('0x20')]==='undefined'&&typeof _0x53fc5f['limit']===_0x7dea('0x21');var _0x386f3e=_0x2392b8[_0x7dea('0x22')];var _0x5a346f=_0x13ab45?0x0:_0x53fc5f[_0x7dea('0x20')];var _0x58c412=_0x13ab45?_0x2392b8['count']:_0x53fc5f[_0x7dea('0x20')]+_0x53fc5f['limit'];var _0x5ac9a2;if(_0x58c412>=_0x386f3e){_0x58c412=_0x386f3e;_0x5ac9a2=0xc8;}else{_0x5ac9a2=0xce;}_0x5754c3[_0x7dea('0x1e')](_0x5ac9a2);return _0x5754c3[_0x7dea('0x23')](_0x7dea('0x24'),_0x5a346f+'-'+_0x58c412+'/'+_0x386f3e)[_0x7dea('0x1f')](_0x2392b8);}return null;};}function patchUpdates(_0x5140a8){return function(_0x3c4f7f){try{jsonpatch[_0x7dea('0x25')](_0x3c4f7f,_0x5140a8,!![]);}catch(_0x372067){return BPromise['reject'](_0x372067);}return _0x3c4f7f['save']();};}function saveUpdates(_0x42e631,_0x4df00f){return function(_0x3a3768){if(_0x3a3768){return _0x3a3768[_0x7dea('0x26')](_0x42e631)[_0x7dea('0x27')](function(_0x1471c9){return _0x1471c9;});}return null;};}function removeEntity(_0x4e5ea4,_0x5723aa){return function(_0x4bdd2c){if(_0x4bdd2c){return _0x4bdd2c[_0x7dea('0x28')]()[_0x7dea('0x27')](function(){_0x4e5ea4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x339012,_0x13d0de){return function(_0x590fed){if(!_0x590fed){_0x339012['sendStatus'](0x194);}return _0x590fed;};}function handleError(_0x1bebe9,_0x3b8749){_0x3b8749=_0x3b8749||0x1f4;return function(_0x29dcb0){logger[_0x7dea('0x29')](_0x29dcb0[_0x7dea('0x2a')]);if(_0x29dcb0['name']){delete _0x29dcb0[_0x7dea('0x2b')];}_0x1bebe9['status'](_0x3b8749)[_0x7dea('0x2c')](_0x29dcb0);};}exports['index']=function(_0x43e3e4,_0x591d38){var _0x1b958f={},_0x45fe93={},_0x5a7688={'count':0x0,'rows':[]};var _0x456262=_[_0x7dea('0x2d')](db[_0x7dea('0x2e')][_0x7dea('0x2f')],function(_0x517d74){return{'name':_0x517d74[_0x7dea('0x30')],'type':_0x517d74[_0x7dea('0x31')]['key']};});_0x45fe93[_0x7dea('0x32')]=_['map'](_0x456262,_0x7dea('0x2b'));_0x45fe93['query']=_['keys'](_0x43e3e4['query']);_0x45fe93[_0x7dea('0x33')]=_['intersection'](_0x45fe93[_0x7dea('0x32')],_0x45fe93[_0x7dea('0x34')]);_0x1b958f[_0x7dea('0x35')]=_[_0x7dea('0x36')](_0x45fe93[_0x7dea('0x32')],qs['fields'](_0x43e3e4[_0x7dea('0x34')][_0x7dea('0x37')]));_0x1b958f['attributes']=_0x1b958f[_0x7dea('0x35')][_0x7dea('0x38')]?_0x1b958f[_0x7dea('0x35')]:_0x45fe93[_0x7dea('0x32')];if(!_0x43e3e4['query'][_0x7dea('0x39')]('nolimit')){_0x1b958f[_0x7dea('0x3a')]=qs[_0x7dea('0x3a')](_0x43e3e4[_0x7dea('0x34')][_0x7dea('0x3a')]);_0x1b958f['offset']=qs[_0x7dea('0x20')](_0x43e3e4['query'][_0x7dea('0x20')]);}_0x1b958f[_0x7dea('0x3b')]=qs[_0x7dea('0x3c')](_0x43e3e4[_0x7dea('0x34')][_0x7dea('0x3c')]);_0x1b958f['where']=qs[_0x7dea('0x33')](_['pick'](_0x43e3e4[_0x7dea('0x34')],_0x45fe93['filters']),_0x456262);if(_0x43e3e4[_0x7dea('0x34')][_0x7dea('0x3d')]){_0x1b958f['where']=_[_0x7dea('0x3e')](_0x1b958f[_0x7dea('0x3f')],{'$or':_[_0x7dea('0x2d')](_0x456262,function(_0x5d2a81){if(_0x5d2a81[_0x7dea('0x31')]!==_0x7dea('0x40')){var _0x2cee25={};_0x2cee25[_0x5d2a81[_0x7dea('0x2b')]]={'$like':'%'+_0x43e3e4['query'][_0x7dea('0x3d')]+'%'};return _0x2cee25;}})});}_0x1b958f=_['merge']({},_0x1b958f,_0x43e3e4[_0x7dea('0x41')]);var _0x26a3e7={'where':_0x1b958f[_0x7dea('0x3f')]};return db['VtigerAccount']['count'](_0x26a3e7)[_0x7dea('0x27')](function(_0x36c4fc){_0x5a7688['count']=_0x36c4fc;if(_0x43e3e4[_0x7dea('0x34')][_0x7dea('0x42')]){_0x1b958f['include']=[{'all':!![]}];}return db[_0x7dea('0x2e')][_0x7dea('0x43')](_0x1b958f);})[_0x7dea('0x27')](function(_0x23436d){_0x5a7688['rows']=_0x23436d;return _0x5a7688;})[_0x7dea('0x27')](respondWithFilteredResult(_0x591d38,_0x1b958f))['catch'](handleError(_0x591d38,null));};exports[_0x7dea('0x44')]=function(_0x5bd705,_0x6fa176){var _0x1d81ef={'raw':![],'where':{'id':_0x5bd705[_0x7dea('0x45')]['id']}},_0x24ee5e={};_0x24ee5e['model']=_[_0x7dea('0x46')](db['VtigerAccount'][_0x7dea('0x2f')]);_0x24ee5e[_0x7dea('0x34')]=_[_0x7dea('0x46')](_0x5bd705[_0x7dea('0x34')]);_0x24ee5e['filters']=_[_0x7dea('0x36')](_0x24ee5e[_0x7dea('0x32')],_0x24ee5e[_0x7dea('0x34')]);_0x1d81ef['attributes']=_[_0x7dea('0x36')](_0x24ee5e['model'],qs[_0x7dea('0x37')](_0x5bd705[_0x7dea('0x34')]['fields']));_0x1d81ef[_0x7dea('0x35')]=_0x1d81ef['attributes'][_0x7dea('0x38')]?_0x1d81ef[_0x7dea('0x35')]:_0x24ee5e['model'];if(_0x5bd705[_0x7dea('0x34')][_0x7dea('0x42')]){_0x1d81ef[_0x7dea('0x47')]=[{'all':!![]}];}_0x1d81ef=_[_0x7dea('0x3e')]({},_0x1d81ef,_0x5bd705[_0x7dea('0x41')]);return db[_0x7dea('0x2e')][_0x7dea('0x48')](_0x1d81ef)[_0x7dea('0x27')](handleEntityNotFound(_0x6fa176,null))['then'](respondWithResult(_0x6fa176,null))[_0x7dea('0x49')](handleError(_0x6fa176,null));};exports[_0x7dea('0x4a')]=function(_0x5b23b1,_0x483013){return db[_0x7dea('0x2e')]['create'](_0x5b23b1['body'],{})[_0x7dea('0x27')](respondWithResult(_0x483013,0xc9))['catch'](handleError(_0x483013,null));};exports[_0x7dea('0x26')]=function(_0x4479c4,_0x3cb756){if(_0x4479c4['body']['id']){delete _0x4479c4[_0x7dea('0x4b')]['id'];}return db[_0x7dea('0x2e')][_0x7dea('0x48')]({'where':{'id':_0x4479c4[_0x7dea('0x45')]['id']}})[_0x7dea('0x27')](handleEntityNotFound(_0x3cb756,null))[_0x7dea('0x27')](saveUpdates(_0x4479c4[_0x7dea('0x4b')],null))[_0x7dea('0x27')](respondWithResult(_0x3cb756,null))[_0x7dea('0x49')](handleError(_0x3cb756,null));};exports[_0x7dea('0x28')]=function(_0x30e439,_0x2a0f4d){return db['VtigerAccount'][_0x7dea('0x48')]({'where':{'id':_0x30e439['params']['id']}})[_0x7dea('0x27')](handleEntityNotFound(_0x2a0f4d,null))[_0x7dea('0x27')](removeEntity(_0x2a0f4d,null))[_0x7dea('0x49')](handleError(_0x2a0f4d,null));};exports[_0x7dea('0x4c')]=function(_0x207e1a,_0x240e4b,_0xb2b23d){var _0x214c1f={};var _0x1a44e8={};var _0x17e60a;var _0xf38b94;return db[_0x7dea('0x2e')][_0x7dea('0x4d')]({'where':{'id':_0x207e1a['params']['id']}})['then'](handleEntityNotFound(_0x240e4b,null))[_0x7dea('0x27')](function(_0x42adc6){if(_0x42adc6){_0x17e60a=_0x42adc6;_0x1a44e8[_0x7dea('0x32')]=_[_0x7dea('0x46')](db[_0x7dea('0x4e')][_0x7dea('0x2f')]);_0x1a44e8['query']=_[_0x7dea('0x46')](_0x207e1a[_0x7dea('0x34')]);_0x1a44e8['filters']=_[_0x7dea('0x36')](_0x1a44e8[_0x7dea('0x32')],_0x1a44e8[_0x7dea('0x34')]);_0x214c1f[_0x7dea('0x35')]=_['intersection'](_0x1a44e8[_0x7dea('0x32')],qs[_0x7dea('0x37')](_0x207e1a['query'][_0x7dea('0x37')]));_0x214c1f[_0x7dea('0x35')]=_0x214c1f['attributes']['length']?_0x214c1f['attributes']:_0x1a44e8[_0x7dea('0x32')];_0x214c1f[_0x7dea('0x3b')]=qs[_0x7dea('0x3c')](_0x207e1a[_0x7dea('0x34')]['sort']);_0x214c1f[_0x7dea('0x3f')]=qs['filters'](_[_0x7dea('0x4f')](_0x207e1a[_0x7dea('0x34')],_0x1a44e8[_0x7dea('0x33')]));if(_0x207e1a[_0x7dea('0x34')][_0x7dea('0x3d')]){_0x214c1f[_0x7dea('0x3f')]=_[_0x7dea('0x3e')](_0x214c1f[_0x7dea('0x3f')],{'$or':_[_0x7dea('0x2d')](_0x214c1f[_0x7dea('0x35')],function(_0x528b3f){var _0x14211d={};_0x14211d[_0x528b3f]={'$like':'%'+_0x207e1a[_0x7dea('0x34')][_0x7dea('0x3d')]+'%'};return _0x14211d;})});}_0x214c1f=_[_0x7dea('0x3e')]({},_0x214c1f,_0x207e1a[_0x7dea('0x41')]);return _0x17e60a[_0x7dea('0x4c')](_0x214c1f);}})['then'](function(_0xe98f6b){if(_0xe98f6b){_0xf38b94=_0xe98f6b['length'];if(!_0x207e1a[_0x7dea('0x34')][_0x7dea('0x39')]('nolimit')){_0x214c1f[_0x7dea('0x3a')]=qs[_0x7dea('0x3a')](_0x207e1a[_0x7dea('0x34')][_0x7dea('0x3a')]);_0x214c1f[_0x7dea('0x20')]=qs['offset'](_0x207e1a['query'][_0x7dea('0x20')]);}return _0x17e60a['getConfigurations'](_0x214c1f);}})['then'](function(_0x456ffe){if(_0x456ffe){return _0x456ffe?{'count':_0xf38b94,'rows':_0x456ffe}:null;}})[_0x7dea('0x27')](respondWithResult(_0x240e4b,null))['catch'](handleError(_0x240e4b,null));};exports['addConfiguration']=function(_0x1094f0,_0x43f71d,_0x3efb5b){if(_0x1094f0[_0x7dea('0x4b')]['id']){delete _0x1094f0[_0x7dea('0x4b')]['id'];}return db['VtigerAccount'][_0x7dea('0x4d')]({'where':{'id':_0x1094f0['params']['id']}})[_0x7dea('0x27')](handleEntityNotFound(_0x43f71d,null))[_0x7dea('0x27')](function(_0x2e74c6){if(_0x2e74c6){_0x1094f0['body'][_0x7dea('0x50')]=_0x2e74c6['id'];_0x1094f0[_0x7dea('0x4b')][_0x7dea('0x51')]=integrations[_0x7dea('0x52')](_0x1094f0[_0x7dea('0x4b')]['channel'],_0x1094f0[_0x7dea('0x4b')]['type']);_0x1094f0[_0x7dea('0x4b')]['Descriptions']=integrations[_0x7dea('0x53')](_0x1094f0[_0x7dea('0x4b')]['channel'],_0x1094f0[_0x7dea('0x4b')][_0x7dea('0x31')]);return db['VtigerConfiguration'][_0x7dea('0x4a')](_0x1094f0[_0x7dea('0x4b')],{'include':[{'model':db[_0x7dea('0x54')],'as':_0x7dea('0x51')},{'model':db[_0x7dea('0x54')],'as':_0x7dea('0x55')}]});}return null;})['then'](respondWithResult(_0x43f71d,null))[_0x7dea('0x49')](handleError(_0x43f71d,null));};var md5=require(_0x7dea('0x56'));exports['getFields']=function(_0x442053,_0x593d24,_0x37ae69){var _0x40e0e8=null;var _0x88535d=null;var _0x2caf97=null;var _0x5d50b0=null;var _0x232148='';return db['VtigerAccount'][_0x7dea('0x4d')]({'where':{'id':_0x442053[_0x7dea('0x45')]['id']},'attributes':['id',_0x7dea('0x2b'),'username',_0x7dea('0x57'),_0x7dea('0x58'),_0x7dea('0x59'),_0x7dea('0x5a'),_0x7dea('0x5b')]})[_0x7dea('0x27')](handleEntityNotFound(_0x593d24,null))['then'](function(_0x29b370){if(_0x29b370){_0x40e0e8=_0x29b370[_0x7dea('0x5c')];_0x88535d=_0x29b370['accessKey'];_0x2caf97=_0x29b370[_0x7dea('0x58')];_0x232148=_0x29b370[_0x7dea('0x59')];var _0x132c11=_0x232148[_0x7dea('0x5d')](-0x1);if(_0x132c11==='/'){_0x232148=_0x232148[_0x7dea('0x5e')](0x0,_0x232148['lastIndexOf'](_0x132c11));}_0x5d50b0=util[_0x7dea('0x5f')](_0x7dea('0x60'),_0x232148);var _0x4329d0={'method':_0x7dea('0x61'),'uri':_0x5d50b0,'qs':{'operation':'getchallenge','username':_0x29b370[_0x7dea('0x5c')]},'json':!![]};return rp(_0x4329d0);}})[_0x7dea('0x27')](function(_0x375bf7){if(_0x375bf7[_0x7dea('0x62')]){var _0x202f54={'method':_0x7dea('0x63'),'uri':_0x5d50b0,'form':{'operation':'login','username':_0x40e0e8,'accessKey':md5(_0x375bf7[_0x7dea('0x64')][_0x7dea('0x65')]+_0x88535d)},'json':!![]};return rp(_0x202f54);}})[_0x7dea('0x27')](function(_0x2c3fce){if(_0x2c3fce[_0x7dea('0x62')]){var _0x3e116d={'method':_0x7dea('0x61'),'uri':_0x5d50b0,'qs':{'operation':'describe','username':_0x40e0e8,'sessionName':_0x2c3fce[_0x7dea('0x64')][_0x7dea('0x66')],'elementType':_0x2caf97},'json':!![]};return rp(_0x3e116d);}})[_0x7dea('0x27')](function(_0x3f0b4c){if(_0x3f0b4c[_0x7dea('0x62')]){var _0x200c0c=[_0x7dea('0x67'),'reference',_0x7dea('0x68')];_['remove'](_0x3f0b4c['result'][_0x7dea('0x37')],function(_0x39f1cf){return _0x200c0c[_0x7dea('0x69')](_0x39f1cf[_0x7dea('0x31')][_0x7dea('0x2b')]);});_[_0x7dea('0x6a')](_0x3f0b4c[_0x7dea('0x64')][_0x7dea('0x37')],function(_0x2b367b){return _0x2b367b[_0x7dea('0x6b')]===_0x7dea('0x6c');});return{'count':_0x3f0b4c['result'][_0x7dea('0x37')]['length'],'rows':_[_0x7dea('0x2d')](_0x3f0b4c['result'][_0x7dea('0x37')],function(_0x1c0788){return{'id':_0x1c0788['name'],'name':_0x1c0788[_0x7dea('0x6d')],'custom':_[_0x7dea('0x6e')](_0x1c0788[_0x7dea('0x2b')],_0x7dea('0x6f'))?!![]:![],'options':_0x1c0788['type'][_0x7dea('0x2b')]===_0x7dea('0x70')&&_0x1c0788[_0x7dea('0x31')][_0x7dea('0x71')][_0x7dea('0x38')]>0x0?_[_0x7dea('0x2d')](_0x1c0788[_0x7dea('0x31')][_0x7dea('0x71')],function(_0xdb5ee9){return{'name':_0xdb5ee9['label'],'value':_0xdb5ee9['value']};}):[]};})};}})[_0x7dea('0x27')](respondWithResult(_0x593d24,null))[_0x7dea('0x49')](function(_0x28aa24){console[_0x7dea('0x72')]('vTiger\x20error:\x20'+_0x28aa24);var _0x243d69=_0x442053['query']['test']?0x1f4:_0x28aa24[_0x7dea('0x73')]||0x1f4;logger[_0x7dea('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x243d69,JSON[_0x7dea('0x74')](_0x28aa24));delete _0x28aa24[_0x7dea('0x2b')];if(_0x243d69===0x191){_0x243d69=0x190;}_0x593d24[_0x7dea('0x1e')](_0x243d69)['send'](_0x442053[_0x7dea('0x34')]['test']?{'message':_0x7dea('0x75'),'statusCode':_0x28aa24[_0x7dea('0x73')]}:_0x28aa24);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 25721b4..8878f0d 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.model.js +++ b/server/api/intVtigerAccount/intVtigerAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9067=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','lodash'];(function(_0x25b770,_0x181965){var _0x11db88=function(_0x4b6790){while(--_0x4b6790){_0x25b770['push'](_0x25b770['shift']());}};_0x11db88(++_0x181965);}(_0x9067,0x149));var _0x7906=function(_0x2824e9,_0x15fc3c){_0x2824e9=_0x2824e9-0x0;var _0xe4e2ee=_0x9067[_0x2824e9];return _0xe4e2ee;};'use strict';var _=require(_0x7906('0x0'));var util=require(_0x7906('0x1'));var logger=require('../../config/logger')(_0x7906('0x2'));var moment=require(_0x7906('0x3'));var BPromise=require(_0x7906('0x4'));var rp=require(_0x7906('0x5'));var fs=require('fs');var path=require(_0x7906('0x6'));var rimraf=require(_0x7906('0x7'));var config=require(_0x7906('0x8'));var attributes=require(_0x7906('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7906('0xa')]=function(_0x40967f,_0x312480){return _0x40967f['define']('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0bc=['../../config/logger','api','moment','bluebird','path','rimraf','./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x2719b4,_0x3bb25b){var _0x18b233=function(_0x2162c3){while(--_0x2162c3){_0x2719b4['push'](_0x2719b4['shift']());}};_0x18b233(++_0x3bb25b);}(_0xe0bc,0x6a));var _0xce0b=function(_0x388637,_0x12f199){_0x388637=_0x388637-0x0;var _0x977317=_0xe0bc[_0x388637];return _0x977317;};'use strict';var _=require(_0xce0b('0x0'));var util=require(_0xce0b('0x1'));var logger=require(_0xce0b('0x2'))(_0xce0b('0x3'));var moment=require(_0xce0b('0x4'));var BPromise=require(_0xce0b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce0b('0x6'));var rimraf=require(_0xce0b('0x7'));var config=require('../../config/environment');var attributes=require(_0xce0b('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xce0b('0x9')]=function(_0xf745de,_0x556f34){return _0xf745de['define'](_0xce0b('0xa'),attributes,{'tableName':_0xce0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index dd113ce..02381dc 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9348=['http','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','catch','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3606dc,_0x3b2afe){var _0x35969b=function(_0x12698b){while(--_0x12698b){_0x3606dc['push'](_0x3606dc['shift']());}};_0x35969b(++_0x3b2afe);}(_0x9348,0x10d));var _0x8934=function(_0x45aed7,_0xf65911){_0x45aed7=_0x45aed7-0x0;var _0x32041a=_0x9348[_0x45aed7];return _0x32041a;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});}exports['GetVtigerAccount']=function(_0x47f25e){var _0x597eed=this;return new Promise(function(_0x2ff9ce,_0x51f9ed){return db[_0x8934('0x16')][_0x8934('0x17')]({'raw':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x19')]===undefined?!![]:![]:!![],'where':_0x47f25e['options']?_0x47f25e[_0x8934('0x18')]['where']||null:null,'attributes':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x1a')]||null:null,'limit':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x1b')]||null:null,'include':_0x47f25e[_0x8934('0x18')]?_0x47f25e['options'][_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x47f25e[_0x8934('0x18')][_0x8934('0x1c')],function(_0x43b89a){return{'model':db[_0x43b89a['model']],'as':_0x43b89a['as'],'attributes':_0x43b89a[_0x8934('0x1a')],'include':_0x43b89a[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x43b89a['include'],function(_0x16cfc2){return{'model':db[_0x16cfc2['model']],'as':_0x16cfc2['as'],'attributes':_0x16cfc2[_0x8934('0x1a')],'include':_0x16cfc2[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x16cfc2['include'],function(_0x1fd5eb){return{'model':db[_0x1fd5eb[_0x8934('0x1e')]],'as':_0x1fd5eb['as'],'attributes':_0x1fd5eb[_0x8934('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8934('0x1f')](function(_0x4b5780){logger[_0x8934('0x14')](_0x8934('0x20'),_0x47f25e);logger[_0x8934('0xd')](_0x8934('0x20'),_0x47f25e,JSON[_0x8934('0x10')](_0x4b5780));_0x2ff9ce(_0x4b5780);})[_0x8934('0x21')](function(_0x3f328a){logger[_0x8934('0x11')](_0x8934('0x20'),_0x3f328a[_0x8934('0x13')],_0x47f25e);_0x51f9ed(_0x597eed['error'](0x1f4,_0x3f328a[_0x8934('0x13')]));});});};exports[_0x8934('0x22')]=function(_0x54d28d){var _0x2aa18e=this;return new Promise(function(_0x3d60f9,_0x1a17b5){return db[_0x8934('0x16')]['find']({'raw':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')][_0x8934('0x19')]===undefined?!![]:![]:!![],'where':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')]['where']||null:null,'attributes':_0x54d28d[_0x8934('0x18')]?_0x54d28d['options']['attributes']||null:null,'include':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')][_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x54d28d['options'][_0x8934('0x1c')],function(_0x22aebe){return{'model':db[_0x22aebe[_0x8934('0x1e')]],'as':_0x22aebe['as'],'attributes':_0x22aebe[_0x8934('0x1a')],'include':_0x22aebe[_0x8934('0x1c')]?_['map'](_0x22aebe[_0x8934('0x1c')],function(_0x1ea0cd){return{'model':db[_0x1ea0cd['model']],'as':_0x1ea0cd['as'],'attributes':_0x1ea0cd['attributes'],'include':_0x1ea0cd[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x1ea0cd['include'],function(_0x519273){return{'model':db[_0x519273[_0x8934('0x1e')]],'as':_0x519273['as'],'attributes':_0x519273[_0x8934('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8934('0x1f')](function(_0x207ad4){logger[_0x8934('0x14')](_0x8934('0x22'),_0x54d28d);logger[_0x8934('0xd')](_0x8934('0x22'),_0x54d28d,JSON[_0x8934('0x10')](_0x207ad4));_0x3d60f9(_0x207ad4);})[_0x8934('0x21')](function(_0x46611c){logger['error'](_0x8934('0x22'),_0x46611c[_0x8934('0x13')],_0x54d28d);_0x1a17b5(_0x2aa18e['error'](0x1f4,_0x46611c[_0x8934('0x13')]));});});}; \ No newline at end of file +var _0x2547=['../../config/logger','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x27d074,_0x47cb30){var _0x1de0f5=function(_0xa6ef1){while(--_0xa6ef1){_0x27d074['push'](_0x27d074['shift']());}};_0x1de0f5(++_0x47cb30);}(_0x2547,0x1cd));var _0x7254=function(_0x451de9,_0x4a40bf){_0x451de9=_0x451de9-0x0;var _0x1fa7a7=_0x2547[_0x451de9];return _0x1fa7a7;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});}exports[_0x7254('0x16')]=function(_0x2737e0){var _0x5dd23b=this;return new Promise(function(_0x1f48f6,_0x2283b7){return db[_0x7254('0x17')][_0x7254('0x18')]({'raw':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1c')]||null:null,'limit':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1d')]||null:null,'include':_0x2737e0[_0x7254('0x19')]?_0x2737e0[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x2737e0[_0x7254('0x19')]['include'],function(_0x493bfd){return{'model':db[_0x493bfd[_0x7254('0x20')]],'as':_0x493bfd['as'],'attributes':_0x493bfd[_0x7254('0x1c')],'include':_0x493bfd[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x493bfd[_0x7254('0x1e')],function(_0x36b5d5){return{'model':db[_0x36b5d5[_0x7254('0x20')]],'as':_0x36b5d5['as'],'attributes':_0x36b5d5['attributes'],'include':_0x36b5d5[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x36b5d5[_0x7254('0x1e')],function(_0x494cdb){return{'model':db[_0x494cdb[_0x7254('0x20')]],'as':_0x494cdb['as'],'attributes':_0x494cdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x7254('0x21')](function(_0x134a9e){logger['info'](_0x7254('0x16'),_0x2737e0);logger[_0x7254('0xf')]('GetVtigerAccount',_0x2737e0,JSON[_0x7254('0x11')](_0x134a9e));_0x1f48f6(_0x134a9e);})[_0x7254('0x15')](function(_0x37cb5c){logger[_0x7254('0x12')](_0x7254('0x16'),_0x37cb5c[_0x7254('0x13')],_0x2737e0);_0x2283b7(_0x5dd23b['error'](0x1f4,_0x37cb5c[_0x7254('0x13')]));});});};exports[_0x7254('0x22')]=function(_0x5569be){var _0x2f75ea=this;return new Promise(function(_0x1279cd,_0x2be5fc){return db['VtigerAccount'][_0x7254('0x23')]({'raw':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1a')]===undefined?!![]:![]:!![],'where':_0x5569be[_0x7254('0x19')]?_0x5569be[_0x7254('0x19')][_0x7254('0x1b')]||null:null,'attributes':_0x5569be['options']?_0x5569be[_0x7254('0x19')]['attributes']||null:null,'include':_0x5569be['options']?_0x5569be[_0x7254('0x19')][_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x5569be[_0x7254('0x19')][_0x7254('0x1e')],function(_0x430420){return{'model':db[_0x430420[_0x7254('0x20')]],'as':_0x430420['as'],'attributes':_0x430420[_0x7254('0x1c')],'include':_0x430420[_0x7254('0x1e')]?_[_0x7254('0x1f')](_0x430420[_0x7254('0x1e')],function(_0x3b0abd){return{'model':db[_0x3b0abd[_0x7254('0x20')]],'as':_0x3b0abd['as'],'attributes':_0x3b0abd[_0x7254('0x1c')],'include':_0x3b0abd['include']?_[_0x7254('0x1f')](_0x3b0abd[_0x7254('0x1e')],function(_0x2ea976){return{'model':db[_0x2ea976[_0x7254('0x20')]],'as':_0x2ea976['as'],'attributes':_0x2ea976[_0x7254('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x140bb2){logger['info'](_0x7254('0x22'),_0x5569be);logger[_0x7254('0xf')](_0x7254('0x22'),_0x5569be,JSON[_0x7254('0x11')](_0x140bb2));_0x1279cd(_0x140bb2);})[_0x7254('0x15')](function(_0x4e6213){logger[_0x7254('0x12')]('ShowVtigerAccount',_0x4e6213[_0x7254('0x13')],_0x5569be);_0x2be5fc(_0x2f75ea[_0x7254('0x12')](0x1f4,_0x4e6213['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7606ddf..d06d115 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bf3=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5bf3,0xf5));var _0x35bf=function(_0x294edf,_0xded89a){_0x294edf=_0x294edf-0x0;var _0x27d9b3=_0x5bf3[_0x294edf];return _0x27d9b3;};'use strict';var multer=require(_0x35bf('0x0'));var util=require(_0x35bf('0x1'));var path=require(_0x35bf('0x2'));var timeout=require(_0x35bf('0x3'));var express=require('express');var router=express[_0x35bf('0x4')]();var fs_extra=require(_0x35bf('0x5'));var auth=require(_0x35bf('0x6'));var interaction=require(_0x35bf('0x7'));var config=require(_0x35bf('0x8'));var controller=require(_0x35bf('0x9'));router[_0x35bf('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x35bf('0xb'),auth[_0x35bf('0xc')](),controller[_0x35bf('0xd')]);router[_0x35bf('0xa')](_0x35bf('0xe'),auth[_0x35bf('0xc')](),controller['getFields']);router[_0x35bf('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x35bf('0xf')]);router[_0x35bf('0xa')](_0x35bf('0x10'),auth[_0x35bf('0xc')](),controller[_0x35bf('0x11')]);router[_0x35bf('0x12')]('/',auth[_0x35bf('0xc')](),controller[_0x35bf('0x13')]);router['put'](_0x35bf('0xb'),auth[_0x35bf('0xc')](),controller[_0x35bf('0x14')]);router[_0x35bf('0x15')](_0x35bf('0xb'),auth[_0x35bf('0xc')](),controller[_0x35bf('0x16')]);module[_0x35bf('0x17')]=router; \ No newline at end of file +var _0x005e=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','getFields','get','/:id/descriptions','getDescriptions','create','put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3869b5,_0x5a0619){var _0x21819a=function(_0x4870c4){while(--_0x4870c4){_0x3869b5['push'](_0x3869b5['shift']());}};_0x21819a(++_0x5a0619);}(_0x005e,0x19c));var _0xe005=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x005e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe005('0x0'));var util=require(_0xe005('0x1'));var path=require(_0xe005('0x2'));var timeout=require(_0xe005('0x3'));var express=require('express');var router=express[_0xe005('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe005('0x5'));var interaction=require(_0xe005('0x6'));var config=require(_0xe005('0x7'));var controller=require(_0xe005('0x8'));router['get']('/',auth[_0xe005('0x9')](),controller[_0xe005('0xa')]);router['get'](_0xe005('0xb'),auth[_0xe005('0x9')](),controller[_0xe005('0xc')]);router['get'](_0xe005('0xd'),auth[_0xe005('0x9')](),controller[_0xe005('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xe005('0xf')](_0xe005('0x10'),auth['isAuthenticated'](),controller[_0xe005('0x11')]);router['post']('/',auth[_0xe005('0x9')](),controller[_0xe005('0x12')]);router[_0xe005('0x13')](_0xe005('0xb'),auth[_0xe005('0x9')](),controller[_0xe005('0x14')]);router[_0xe005('0x15')](_0xe005('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 696e16b..313e890 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x941f=['STRING','sequelize'];(function(_0x2ff3e5,_0x476a3f){var _0x66f350=function(_0x15d445){while(--_0x15d445){_0x2ff3e5['push'](_0x2ff3e5['shift']());}};_0x66f350(++_0x476a3f);}(_0x941f,0x67));var _0xf941=function(_0x155211,_0x5aa234){_0x155211=_0x155211-0x0;var _0x287ee9=_0x941f[_0x155211];return _0x287ee9;};'use strict';var Sequelize=require(_0xf941('0x0'));module['exports']={'name':{'type':Sequelize[_0xf941('0x1')]},'description':{'type':Sequelize[_0xf941('0x1')]}}; \ No newline at end of file +var _0xee84=['sequelize','exports','STRING'];(function(_0x4babaf,_0x149b12){var _0x2342dc=function(_0x1cbaa8){while(--_0x1cbaa8){_0x4babaf['push'](_0x4babaf['shift']());}};_0x2342dc(++_0x149b12);}(_0xee84,0xb1));var _0x4ee8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xee84[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4ee8('0x0'));module[_0x4ee8('0x1')]={'name':{'type':Sequelize[_0x4ee8('0x2')]},'description':{'type':Sequelize[_0x4ee8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 579f0f4..8f8329b 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x696b=['sort','where','filter','merge','VIRTUAL','VtigerConfiguration','include','catch','show','params','includeAll','options','find','create','body','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0x696b,0xb7));var _0xb696=function(_0x548536,_0x3c3ae5){_0x548536=_0x548536-0x0;var _0x3e33a2=_0x696b[_0x548536];return _0x3e33a2;};'use strict';var emlformat=require(_0xb696('0x0'));var rimraf=require(_0xb696('0x1'));var zipdir=require(_0xb696('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb696('0x3'));var BPromise=require(_0xb696('0x4'));var Mustache=require(_0xb696('0x5'));var util=require(_0xb696('0x6'));var path=require(_0xb696('0x7'));var sox=require(_0xb696('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb696('0x9'));var _=require(_0xb696('0xa'));var squel=require(_0xb696('0xb'));var crypto=require('crypto');var jsforce=require(_0xb696('0xc'));var deskjs=require(_0xb696('0xd'));var toCsv=require(_0xb696('0xe'));var querystring=require(_0xb696('0xf'));var Papa=require(_0xb696('0x10'));var Redis=require(_0xb696('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb696('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb696('0x13'));var logger=require(_0xb696('0x14'))(_0xb696('0x15'));var utils=require(_0xb696('0x16'));var config=require(_0xb696('0x17'));var licenseUtil=require(_0xb696('0x18'));var db=require(_0xb696('0x19'))['db'];function respondWithStatusCode(_0x5cd855,_0xb70f55){_0xb70f55=_0xb70f55||0xcc;return function(_0xd5a15f){if(_0xd5a15f){return _0x5cd855[_0xb696('0x1a')](_0xb70f55);}return _0x5cd855[_0xb696('0x1b')](_0xb70f55)[_0xb696('0x1c')]();};}function respondWithResult(_0x1a5230,_0x37c53a){_0x37c53a=_0x37c53a||0xc8;return function(_0x5227f5){if(_0x5227f5){return _0x1a5230[_0xb696('0x1b')](_0x37c53a)[_0xb696('0x1d')](_0x5227f5);}};}function respondWithFilteredResult(_0x41f319,_0x251453){return function(_0xbe53dd){if(_0xbe53dd){var _0x5d1b23=typeof _0x251453[_0xb696('0x1e')]===_0xb696('0x1f')&&typeof _0x251453[_0xb696('0x20')]===_0xb696('0x1f');var _0x1b1e23=_0xbe53dd[_0xb696('0x21')];var _0x529db3=_0x5d1b23?0x0:_0x251453[_0xb696('0x1e')];var _0x1028d1=_0x5d1b23?_0xbe53dd['count']:_0x251453[_0xb696('0x1e')]+_0x251453[_0xb696('0x20')];var _0x2df8b1;if(_0x1028d1>=_0x1b1e23){_0x1028d1=_0x1b1e23;_0x2df8b1=0xc8;}else{_0x2df8b1=0xce;}_0x41f319[_0xb696('0x1b')](_0x2df8b1);return _0x41f319[_0xb696('0x22')](_0xb696('0x23'),_0x529db3+'-'+_0x1028d1+'/'+_0x1b1e23)[_0xb696('0x1d')](_0xbe53dd);}return null;};}function patchUpdates(_0x3a9072){return function(_0x1e52d7){try{jsonpatch[_0xb696('0x24')](_0x1e52d7,_0x3a9072,!![]);}catch(_0x2e6957){return BPromise['reject'](_0x2e6957);}return _0x1e52d7['save']();};}function saveUpdates(_0x3a161e,_0x2f3634){return function(_0x468a5b){if(_0x468a5b){return _0x468a5b[_0xb696('0x25')](_0x3a161e)[_0xb696('0x26')](function(_0x51f219){return _0x51f219;});}return null;};}function removeEntity(_0x3ad24b,_0x42d9b9){return function(_0x23e3ae){if(_0x23e3ae){return _0x23e3ae[_0xb696('0x27')]()[_0xb696('0x26')](function(){_0x3ad24b['status'](0xcc)[_0xb696('0x1c')]();});}};}function handleEntityNotFound(_0x34ada6,_0x2e1603){return function(_0x5418f9){if(!_0x5418f9){_0x34ada6[_0xb696('0x1a')](0x194);}return _0x5418f9;};}function handleError(_0x2aa1d2,_0x18d02e){_0x18d02e=_0x18d02e||0x1f4;return function(_0x4a69a3){logger[_0xb696('0x28')](_0x4a69a3[_0xb696('0x29')]);if(_0x4a69a3[_0xb696('0x2a')]){delete _0x4a69a3['name'];}_0x2aa1d2[_0xb696('0x1b')](_0x18d02e)[_0xb696('0x2b')](_0x4a69a3);};}exports[_0xb696('0x2c')]=function(_0x17bc2f,_0x309a28){var _0x1550f4={},_0x589511={},_0x3687dd={'count':0x0,'rows':[]};var _0x308208=_[_0xb696('0x2d')](db['VtigerConfiguration'][_0xb696('0x2e')],function(_0x159c2c){return{'name':_0x159c2c['fieldName'],'type':_0x159c2c[_0xb696('0x2f')][_0xb696('0x30')]};});_0x589511['model']=_[_0xb696('0x2d')](_0x308208,_0xb696('0x2a'));_0x589511[_0xb696('0x31')]=_[_0xb696('0x32')](_0x17bc2f['query']);_0x589511[_0xb696('0x33')]=_[_0xb696('0x34')](_0x589511[_0xb696('0x35')],_0x589511[_0xb696('0x31')]);_0x1550f4[_0xb696('0x36')]=_[_0xb696('0x34')](_0x589511[_0xb696('0x35')],qs[_0xb696('0x37')](_0x17bc2f['query'][_0xb696('0x37')]));_0x1550f4['attributes']=_0x1550f4[_0xb696('0x36')][_0xb696('0x38')]?_0x1550f4[_0xb696('0x36')]:_0x589511[_0xb696('0x35')];if(!_0x17bc2f[_0xb696('0x31')][_0xb696('0x39')](_0xb696('0x3a'))){_0x1550f4[_0xb696('0x20')]=qs[_0xb696('0x20')](_0x17bc2f[_0xb696('0x31')][_0xb696('0x20')]);_0x1550f4[_0xb696('0x1e')]=qs[_0xb696('0x1e')](_0x17bc2f[_0xb696('0x31')][_0xb696('0x1e')]);}_0x1550f4[_0xb696('0x3b')]=qs[_0xb696('0x3c')](_0x17bc2f['query'][_0xb696('0x3c')]);_0x1550f4[_0xb696('0x3d')]=qs[_0xb696('0x33')](_['pick'](_0x17bc2f['query'],_0x589511[_0xb696('0x33')]),_0x308208);if(_0x17bc2f[_0xb696('0x31')][_0xb696('0x3e')]){_0x1550f4['where']=_[_0xb696('0x3f')](_0x1550f4[_0xb696('0x3d')],{'$or':_[_0xb696('0x2d')](_0x308208,function(_0x46da1b){if(_0x46da1b[_0xb696('0x2f')]!==_0xb696('0x40')){var _0xcc5986={};_0xcc5986[_0x46da1b[_0xb696('0x2a')]]={'$like':'%'+_0x17bc2f['query']['filter']+'%'};return _0xcc5986;}})});}_0x1550f4=_[_0xb696('0x3f')]({},_0x1550f4,_0x17bc2f['options']);var _0x14f4be={'where':_0x1550f4[_0xb696('0x3d')]};return db[_0xb696('0x41')][_0xb696('0x21')](_0x14f4be)[_0xb696('0x26')](function(_0x43d76d){_0x3687dd[_0xb696('0x21')]=_0x43d76d;if(_0x17bc2f[_0xb696('0x31')]['includeAll']){_0x1550f4[_0xb696('0x42')]=[{'all':!![]}];}return db[_0xb696('0x41')]['findAll'](_0x1550f4);})['then'](function(_0x36a112){_0x3687dd['rows']=_0x36a112;return _0x3687dd;})[_0xb696('0x26')](respondWithFilteredResult(_0x309a28,_0x1550f4))[_0xb696('0x43')](handleError(_0x309a28,null));};exports[_0xb696('0x44')]=function(_0x227e3e,_0x1747f1){var _0x38b8c0={'raw':![],'where':{'id':_0x227e3e[_0xb696('0x45')]['id']}},_0x3bc43c={};_0x3bc43c[_0xb696('0x35')]=_[_0xb696('0x32')](db[_0xb696('0x41')][_0xb696('0x2e')]);_0x3bc43c['query']=_[_0xb696('0x32')](_0x227e3e[_0xb696('0x31')]);_0x3bc43c[_0xb696('0x33')]=_[_0xb696('0x34')](_0x3bc43c['model'],_0x3bc43c['query']);_0x38b8c0[_0xb696('0x36')]=_[_0xb696('0x34')](_0x3bc43c['model'],qs['fields'](_0x227e3e[_0xb696('0x31')][_0xb696('0x37')]));_0x38b8c0['attributes']=_0x38b8c0[_0xb696('0x36')][_0xb696('0x38')]?_0x38b8c0['attributes']:_0x3bc43c[_0xb696('0x35')];if(_0x227e3e['query'][_0xb696('0x46')]){_0x38b8c0[_0xb696('0x42')]=[{'all':!![]}];}_0x38b8c0=_[_0xb696('0x3f')]({},_0x38b8c0,_0x227e3e[_0xb696('0x47')]);return db['VtigerConfiguration'][_0xb696('0x48')](_0x38b8c0)['then'](handleEntityNotFound(_0x1747f1,null))[_0xb696('0x26')](respondWithResult(_0x1747f1,null))[_0xb696('0x43')](handleError(_0x1747f1,null));};exports[_0xb696('0x49')]=function(_0x2135ba,_0x2b7fff){return db[_0xb696('0x41')]['create'](_0x2135ba[_0xb696('0x4a')],{})[_0xb696('0x26')](respondWithResult(_0x2b7fff,0xc9))[_0xb696('0x43')](handleError(_0x2b7fff,null));};exports[_0xb696('0x25')]=function(_0x502ff5,_0xdc61d8){if(_0x502ff5['body']['id']){delete _0x502ff5[_0xb696('0x4a')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x502ff5[_0xb696('0x45')]['id']}})[_0xb696('0x26')](handleEntityNotFound(_0xdc61d8,null))[_0xb696('0x26')](saveUpdates(_0x502ff5[_0xb696('0x4a')],null))[_0xb696('0x26')](respondWithResult(_0xdc61d8,null))[_0xb696('0x43')](handleError(_0xdc61d8,null));};exports[_0xb696('0x27')]=function(_0x2c1c3d,_0x142fac){return db[_0xb696('0x41')][_0xb696('0x48')]({'where':{'id':_0x2c1c3d[_0xb696('0x45')]['id']}})[_0xb696('0x26')](handleEntityNotFound(_0x142fac,null))['then'](removeEntity(_0x142fac,null))[_0xb696('0x43')](handleError(_0x142fac,null));};exports[_0xb696('0x4b')]=function(_0x4db713,_0x5b3df2,_0x3f5d1d){var _0x1b53e6={};var _0x5997a7={};var _0x343163;var _0x35c50d;return db[_0xb696('0x41')][_0xb696('0x4c')]({'where':{'id':_0x4db713[_0xb696('0x45')]['id']}})[_0xb696('0x26')](handleEntityNotFound(_0x5b3df2,null))[_0xb696('0x26')](function(_0x37bad5){if(_0x37bad5){_0x343163=_0x37bad5;_0x5997a7[_0xb696('0x35')]=_[_0xb696('0x32')](db[_0xb696('0x4d')][_0xb696('0x2e')]);_0x5997a7['query']=_[_0xb696('0x32')](_0x4db713['query']);_0x5997a7['filters']=_[_0xb696('0x34')](_0x5997a7['model'],_0x5997a7[_0xb696('0x31')]);_0x1b53e6[_0xb696('0x36')]=_[_0xb696('0x34')](_0x5997a7[_0xb696('0x35')],qs[_0xb696('0x37')](_0x4db713[_0xb696('0x31')][_0xb696('0x37')]));_0x1b53e6[_0xb696('0x36')]=_0x1b53e6[_0xb696('0x36')][_0xb696('0x38')]?_0x1b53e6[_0xb696('0x36')]:_0x5997a7[_0xb696('0x35')];_0x1b53e6[_0xb696('0x3b')]=qs['sort'](_0x4db713[_0xb696('0x31')][_0xb696('0x3c')]);_0x1b53e6[_0xb696('0x3d')]=qs[_0xb696('0x33')](_[_0xb696('0x4e')](_0x4db713['query'],_0x5997a7[_0xb696('0x33')]));if(_0x4db713['query'][_0xb696('0x3e')]){_0x1b53e6[_0xb696('0x3d')]=_[_0xb696('0x3f')](_0x1b53e6['where'],{'$or':_[_0xb696('0x2d')](_0x1b53e6[_0xb696('0x36')],function(_0xb73b75){var _0x9e7066={};_0x9e7066[_0xb73b75]={'$like':'%'+_0x4db713[_0xb696('0x31')][_0xb696('0x3e')]+'%'};return _0x9e7066;})});}_0x1b53e6=_[_0xb696('0x3f')]({},_0x1b53e6,_0x4db713['options']);return _0x343163[_0xb696('0x4b')](_0x1b53e6);}})['then'](function(_0x48f1ea){if(_0x48f1ea){_0x35c50d=_0x48f1ea['length'];if(!_0x4db713['query'][_0xb696('0x39')]('nolimit')){_0x1b53e6[_0xb696('0x20')]=qs[_0xb696('0x20')](_0x4db713[_0xb696('0x31')][_0xb696('0x20')]);_0x1b53e6[_0xb696('0x1e')]=qs[_0xb696('0x1e')](_0x4db713['query']['offset']);}return _0x343163[_0xb696('0x4b')](_0x1b53e6);}})['then'](function(_0x586ab9){if(_0x586ab9){return _0x586ab9?{'count':_0x35c50d,'rows':_0x586ab9}:null;}})[_0xb696('0x26')](respondWithResult(_0x5b3df2,null))[_0xb696('0x43')](handleError(_0x5b3df2,null));};exports[_0xb696('0x4f')]=function(_0x1e6952,_0x9e848a,_0xce4cc9){var _0xa6fc4f={};var _0x3e0396={};var _0x76735;var _0x243150;return db['VtigerConfiguration'][_0xb696('0x4c')]({'where':{'id':_0x1e6952['params']['id']}})[_0xb696('0x26')](handleEntityNotFound(_0x9e848a,null))[_0xb696('0x26')](function(_0x3492b5){if(_0x3492b5){_0x76735=_0x3492b5;_0x3e0396[_0xb696('0x35')]=_[_0xb696('0x32')](db[_0xb696('0x4d')]['rawAttributes']);_0x3e0396['query']=_[_0xb696('0x32')](_0x1e6952[_0xb696('0x31')]);_0x3e0396[_0xb696('0x33')]=_[_0xb696('0x34')](_0x3e0396['model'],_0x3e0396[_0xb696('0x31')]);_0xa6fc4f[_0xb696('0x36')]=_[_0xb696('0x34')](_0x3e0396['model'],qs[_0xb696('0x37')](_0x1e6952[_0xb696('0x31')]['fields']));_0xa6fc4f[_0xb696('0x36')]=_0xa6fc4f['attributes']['length']?_0xa6fc4f['attributes']:_0x3e0396[_0xb696('0x35')];_0xa6fc4f[_0xb696('0x3b')]=qs[_0xb696('0x3c')](_0x1e6952[_0xb696('0x31')][_0xb696('0x3c')]);_0xa6fc4f[_0xb696('0x3d')]=qs[_0xb696('0x33')](_[_0xb696('0x4e')](_0x1e6952[_0xb696('0x31')],_0x3e0396['filters']));if(_0x1e6952['query']['filter']){_0xa6fc4f[_0xb696('0x3d')]=_[_0xb696('0x3f')](_0xa6fc4f[_0xb696('0x3d')],{'$or':_['map'](_0xa6fc4f[_0xb696('0x36')],function(_0x4d55cf){var _0x47f0c8={};_0x47f0c8[_0x4d55cf]={'$like':'%'+_0x1e6952[_0xb696('0x31')]['filter']+'%'};return _0x47f0c8;})});}_0xa6fc4f=_[_0xb696('0x3f')]({},_0xa6fc4f,_0x1e6952[_0xb696('0x47')]);return _0x76735[_0xb696('0x4f')](_0xa6fc4f);}})[_0xb696('0x26')](function(_0x18c5c4){if(_0x18c5c4){_0x243150=_0x18c5c4[_0xb696('0x38')];if(!_0x1e6952[_0xb696('0x31')][_0xb696('0x39')](_0xb696('0x3a'))){_0xa6fc4f[_0xb696('0x20')]=qs[_0xb696('0x20')](_0x1e6952[_0xb696('0x31')][_0xb696('0x20')]);_0xa6fc4f[_0xb696('0x1e')]=qs['offset'](_0x1e6952[_0xb696('0x31')]['offset']);}return _0x76735[_0xb696('0x4f')](_0xa6fc4f);}})[_0xb696('0x26')](function(_0x288ffe){if(_0x288ffe){return _0x288ffe?{'count':_0x243150,'rows':_0x288ffe}:null;}})[_0xb696('0x26')](respondWithResult(_0x9e848a,null))[_0xb696('0x43')](handleError(_0x9e848a,null));};exports[_0xb696('0x50')]=function(_0x21c959,_0x5948cf,_0x1e85e2){var _0x25e7ae={};var _0xbfba0={};var _0x11b781;var _0x36aeae;return db['VtigerConfiguration'][_0xb696('0x4c')]({'where':{'id':_0x21c959[_0xb696('0x45')]['id']}})[_0xb696('0x26')](handleEntityNotFound(_0x5948cf,null))[_0xb696('0x26')](function(_0x9fe750){if(_0x9fe750){_0x11b781=_0x9fe750;_0xbfba0['model']=_[_0xb696('0x32')](db['VtigerField'][_0xb696('0x2e')]);_0xbfba0['query']=_[_0xb696('0x32')](_0x21c959[_0xb696('0x31')]);_0xbfba0[_0xb696('0x33')]=_[_0xb696('0x34')](_0xbfba0[_0xb696('0x35')],_0xbfba0[_0xb696('0x31')]);_0x25e7ae['attributes']=_[_0xb696('0x34')](_0xbfba0[_0xb696('0x35')],qs[_0xb696('0x37')](_0x21c959[_0xb696('0x31')][_0xb696('0x37')]));_0x25e7ae[_0xb696('0x36')]=_0x25e7ae[_0xb696('0x36')][_0xb696('0x38')]?_0x25e7ae[_0xb696('0x36')]:_0xbfba0[_0xb696('0x35')];_0x25e7ae[_0xb696('0x3b')]=qs[_0xb696('0x3c')](_0x21c959['query'][_0xb696('0x3c')]);_0x25e7ae[_0xb696('0x3d')]=qs[_0xb696('0x33')](_['pick'](_0x21c959['query'],_0xbfba0['filters']));if(_0x21c959[_0xb696('0x31')]['filter']){_0x25e7ae['where']=_['merge'](_0x25e7ae[_0xb696('0x3d')],{'$or':_['map'](_0x25e7ae[_0xb696('0x36')],function(_0x20f4c4){var _0x28ccbb={};_0x28ccbb[_0x20f4c4]={'$like':'%'+_0x21c959[_0xb696('0x31')][_0xb696('0x3e')]+'%'};return _0x28ccbb;})});}_0x25e7ae=_[_0xb696('0x3f')]({},_0x25e7ae,_0x21c959[_0xb696('0x47')]);return _0x11b781[_0xb696('0x50')](_0x25e7ae);}})[_0xb696('0x26')](function(_0x264747){if(_0x264747){_0x36aeae=_0x264747[_0xb696('0x38')];if(!_0x21c959[_0xb696('0x31')]['hasOwnProperty']('nolimit')){_0x25e7ae['limit']=qs[_0xb696('0x20')](_0x21c959[_0xb696('0x31')][_0xb696('0x20')]);_0x25e7ae[_0xb696('0x1e')]=qs['offset'](_0x21c959[_0xb696('0x31')][_0xb696('0x1e')]);}return _0x11b781[_0xb696('0x50')](_0x25e7ae);}})['then'](function(_0x30e24d){if(_0x30e24d){return _0x30e24d?{'count':_0x36aeae,'rows':_0x30e24d}:null;}})['then'](respondWithResult(_0x5948cf,null))[_0xb696('0x43')](handleError(_0x5948cf,null));}; \ No newline at end of file +var _0xcae6=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','findOne','VtigerField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','mustache','util','path'];(function(_0x29e449,_0x3dd20f){var _0x31f29b=function(_0x4fb188){while(--_0x4fb188){_0x29e449['push'](_0x29e449['shift']());}};_0x31f29b(++_0x3dd20f);}(_0xcae6,0x146));var _0x6cae=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0xcae6[_0x204ad4];return _0x50675f;};'use strict';var emlformat=require(_0x6cae('0x0'));var rimraf=require(_0x6cae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cae('0x3'));var util=require(_0x6cae('0x4'));var path=require(_0x6cae('0x5'));var sox=require(_0x6cae('0x6'));var csv=require(_0x6cae('0x7'));var ejs=require(_0x6cae('0x8'));var fs=require('fs');var fs_extra=require(_0x6cae('0x9'));var _=require(_0x6cae('0xa'));var squel=require(_0x6cae('0xb'));var crypto=require(_0x6cae('0xc'));var jsforce=require(_0x6cae('0xd'));var deskjs=require(_0x6cae('0xe'));var toCsv=require(_0x6cae('0x7'));var querystring=require(_0x6cae('0xf'));var Papa=require(_0x6cae('0x10'));var Redis=require(_0x6cae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6cae('0x12'));var as=require(_0x6cae('0x13'));var hardwareService=require(_0x6cae('0x14'));var logger=require(_0x6cae('0x15'))(_0x6cae('0x16'));var utils=require(_0x6cae('0x17'));var config=require(_0x6cae('0x18'));var licenseUtil=require(_0x6cae('0x19'));var db=require(_0x6cae('0x1a'))['db'];function respondWithStatusCode(_0x572304,_0x34e94c){_0x34e94c=_0x34e94c||0xcc;return function(_0x16b2e0){if(_0x16b2e0){return _0x572304[_0x6cae('0x1b')](_0x34e94c);}return _0x572304[_0x6cae('0x1c')](_0x34e94c)[_0x6cae('0x1d')]();};}function respondWithResult(_0x190a80,_0x3a7f98){_0x3a7f98=_0x3a7f98||0xc8;return function(_0x514f6d){if(_0x514f6d){return _0x190a80['status'](_0x3a7f98)[_0x6cae('0x1e')](_0x514f6d);}};}function respondWithFilteredResult(_0x4f41da,_0x1e96e8){return function(_0x596ce4){if(_0x596ce4){var _0x33a562=typeof _0x1e96e8[_0x6cae('0x1f')]==='undefined'&&typeof _0x1e96e8['limit']===_0x6cae('0x20');var _0x4ffed3=_0x596ce4[_0x6cae('0x21')];var _0x29f9ef=_0x33a562?0x0:_0x1e96e8[_0x6cae('0x1f')];var _0x40b45d=_0x33a562?_0x596ce4[_0x6cae('0x21')]:_0x1e96e8[_0x6cae('0x1f')]+_0x1e96e8[_0x6cae('0x22')];var _0x5d29c2;if(_0x40b45d>=_0x4ffed3){_0x40b45d=_0x4ffed3;_0x5d29c2=0xc8;}else{_0x5d29c2=0xce;}_0x4f41da['status'](_0x5d29c2);return _0x4f41da['set']('Content-Range',_0x29f9ef+'-'+_0x40b45d+'/'+_0x4ffed3)[_0x6cae('0x1e')](_0x596ce4);}return null;};}function patchUpdates(_0x3a776c){return function(_0x147af5){try{jsonpatch[_0x6cae('0x23')](_0x147af5,_0x3a776c,!![]);}catch(_0x396e75){return BPromise[_0x6cae('0x24')](_0x396e75);}return _0x147af5[_0x6cae('0x25')]();};}function saveUpdates(_0x156777,_0x3810f5){return function(_0x35c163){if(_0x35c163){return _0x35c163[_0x6cae('0x26')](_0x156777)[_0x6cae('0x27')](function(_0x547e9a){return _0x547e9a;});}return null;};}function removeEntity(_0x359d03,_0x5edf87){return function(_0x531ef4){if(_0x531ef4){return _0x531ef4['destroy']()[_0x6cae('0x27')](function(){_0x359d03[_0x6cae('0x1c')](0xcc)[_0x6cae('0x1d')]();});}};}function handleEntityNotFound(_0x5a3410,_0x3f4dfb){return function(_0x32a810){if(!_0x32a810){_0x5a3410[_0x6cae('0x1b')](0x194);}return _0x32a810;};}function handleError(_0x24fb48,_0x345e7d){_0x345e7d=_0x345e7d||0x1f4;return function(_0x47f2e0){logger[_0x6cae('0x28')](_0x47f2e0['stack']);if(_0x47f2e0[_0x6cae('0x29')]){delete _0x47f2e0[_0x6cae('0x29')];}_0x24fb48['status'](_0x345e7d)[_0x6cae('0x2a')](_0x47f2e0);};}exports[_0x6cae('0x2b')]=function(_0x5363aa,_0x314ed2){var _0x24bd5c={},_0x17ac49={},_0x2797a6={'count':0x0,'rows':[]};var _0x4bb869=_[_0x6cae('0x2c')](db[_0x6cae('0x2d')][_0x6cae('0x2e')],function(_0x21a8e1){return{'name':_0x21a8e1[_0x6cae('0x2f')],'type':_0x21a8e1['type'][_0x6cae('0x30')]};});_0x17ac49['model']=_[_0x6cae('0x2c')](_0x4bb869,_0x6cae('0x29'));_0x17ac49[_0x6cae('0x31')]=_['keys'](_0x5363aa[_0x6cae('0x31')]);_0x17ac49[_0x6cae('0x32')]=_[_0x6cae('0x33')](_0x17ac49['model'],_0x17ac49[_0x6cae('0x31')]);_0x24bd5c[_0x6cae('0x34')]=_[_0x6cae('0x33')](_0x17ac49[_0x6cae('0x35')],qs[_0x6cae('0x36')](_0x5363aa[_0x6cae('0x31')]['fields']));_0x24bd5c[_0x6cae('0x34')]=_0x24bd5c[_0x6cae('0x34')][_0x6cae('0x37')]?_0x24bd5c[_0x6cae('0x34')]:_0x17ac49[_0x6cae('0x35')];if(!_0x5363aa['query']['hasOwnProperty']('nolimit')){_0x24bd5c[_0x6cae('0x22')]=qs['limit'](_0x5363aa[_0x6cae('0x31')][_0x6cae('0x22')]);_0x24bd5c[_0x6cae('0x1f')]=qs[_0x6cae('0x1f')](_0x5363aa['query'][_0x6cae('0x1f')]);}_0x24bd5c[_0x6cae('0x38')]=qs[_0x6cae('0x39')](_0x5363aa['query'][_0x6cae('0x39')]);_0x24bd5c[_0x6cae('0x3a')]=qs[_0x6cae('0x32')](_[_0x6cae('0x3b')](_0x5363aa['query'],_0x17ac49['filters']),_0x4bb869);if(_0x5363aa[_0x6cae('0x31')][_0x6cae('0x3c')]){_0x24bd5c['where']=_[_0x6cae('0x3d')](_0x24bd5c[_0x6cae('0x3a')],{'$or':_[_0x6cae('0x2c')](_0x4bb869,function(_0x1f5c1f){if(_0x1f5c1f[_0x6cae('0x3e')]!==_0x6cae('0x3f')){var _0x12b858={};_0x12b858[_0x1f5c1f[_0x6cae('0x29')]]={'$like':'%'+_0x5363aa[_0x6cae('0x31')][_0x6cae('0x3c')]+'%'};return _0x12b858;}})});}_0x24bd5c=_['merge']({},_0x24bd5c,_0x5363aa[_0x6cae('0x40')]);var _0x547726={'where':_0x24bd5c[_0x6cae('0x3a')]};return db[_0x6cae('0x2d')][_0x6cae('0x21')](_0x547726)['then'](function(_0x3da582){_0x2797a6[_0x6cae('0x21')]=_0x3da582;if(_0x5363aa[_0x6cae('0x31')]['includeAll']){_0x24bd5c[_0x6cae('0x41')]=[{'all':!![]}];}return db[_0x6cae('0x2d')][_0x6cae('0x42')](_0x24bd5c);})[_0x6cae('0x27')](function(_0x51fa30){_0x2797a6[_0x6cae('0x43')]=_0x51fa30;return _0x2797a6;})[_0x6cae('0x27')](respondWithFilteredResult(_0x314ed2,_0x24bd5c))[_0x6cae('0x44')](handleError(_0x314ed2,null));};exports[_0x6cae('0x45')]=function(_0x3b8d83,_0x44dec1){var _0x35b186={'raw':![],'where':{'id':_0x3b8d83[_0x6cae('0x46')]['id']}},_0x3ff987={};_0x3ff987[_0x6cae('0x35')]=_['keys'](db[_0x6cae('0x2d')]['rawAttributes']);_0x3ff987[_0x6cae('0x31')]=_[_0x6cae('0x47')](_0x3b8d83[_0x6cae('0x31')]);_0x3ff987[_0x6cae('0x32')]=_[_0x6cae('0x33')](_0x3ff987['model'],_0x3ff987[_0x6cae('0x31')]);_0x35b186[_0x6cae('0x34')]=_[_0x6cae('0x33')](_0x3ff987['model'],qs[_0x6cae('0x36')](_0x3b8d83[_0x6cae('0x31')][_0x6cae('0x36')]));_0x35b186[_0x6cae('0x34')]=_0x35b186[_0x6cae('0x34')]['length']?_0x35b186['attributes']:_0x3ff987['model'];if(_0x3b8d83['query'][_0x6cae('0x48')]){_0x35b186[_0x6cae('0x41')]=[{'all':!![]}];}_0x35b186=_[_0x6cae('0x3d')]({},_0x35b186,_0x3b8d83[_0x6cae('0x40')]);return db[_0x6cae('0x2d')][_0x6cae('0x49')](_0x35b186)['then'](handleEntityNotFound(_0x44dec1,null))[_0x6cae('0x27')](respondWithResult(_0x44dec1,null))['catch'](handleError(_0x44dec1,null));};exports[_0x6cae('0x4a')]=function(_0x391ba7,_0xe83cc5){return db[_0x6cae('0x2d')][_0x6cae('0x4a')](_0x391ba7[_0x6cae('0x4b')],{})[_0x6cae('0x27')](respondWithResult(_0xe83cc5,0xc9))[_0x6cae('0x44')](handleError(_0xe83cc5,null));};exports['update']=function(_0x1948a4,_0x16409e){if(_0x1948a4[_0x6cae('0x4b')]['id']){delete _0x1948a4['body']['id'];}return db['VtigerConfiguration'][_0x6cae('0x49')]({'where':{'id':_0x1948a4[_0x6cae('0x46')]['id']}})[_0x6cae('0x27')](handleEntityNotFound(_0x16409e,null))['then'](saveUpdates(_0x1948a4[_0x6cae('0x4b')],null))[_0x6cae('0x27')](respondWithResult(_0x16409e,null))[_0x6cae('0x44')](handleError(_0x16409e,null));};exports[_0x6cae('0x4c')]=function(_0x64a143,_0x5a16ef){return db[_0x6cae('0x2d')][_0x6cae('0x49')]({'where':{'id':_0x64a143[_0x6cae('0x46')]['id']}})[_0x6cae('0x27')](handleEntityNotFound(_0x5a16ef,null))['then'](removeEntity(_0x5a16ef,null))[_0x6cae('0x44')](handleError(_0x5a16ef,null));};exports['getFields']=function(_0x56c9ae,_0x35f57c,_0x76c7a9){var _0x48c1c0={};var _0x17566c={};var _0x3c9d80;var _0x274f3b;return db[_0x6cae('0x2d')][_0x6cae('0x4d')]({'where':{'id':_0x56c9ae['params']['id']}})[_0x6cae('0x27')](handleEntityNotFound(_0x35f57c,null))['then'](function(_0x550a47){if(_0x550a47){_0x3c9d80=_0x550a47;_0x17566c['model']=_[_0x6cae('0x47')](db[_0x6cae('0x4e')]['rawAttributes']);_0x17566c[_0x6cae('0x31')]=_['keys'](_0x56c9ae[_0x6cae('0x31')]);_0x17566c[_0x6cae('0x32')]=_[_0x6cae('0x33')](_0x17566c[_0x6cae('0x35')],_0x17566c[_0x6cae('0x31')]);_0x48c1c0[_0x6cae('0x34')]=_[_0x6cae('0x33')](_0x17566c[_0x6cae('0x35')],qs[_0x6cae('0x36')](_0x56c9ae['query'][_0x6cae('0x36')]));_0x48c1c0[_0x6cae('0x34')]=_0x48c1c0[_0x6cae('0x34')][_0x6cae('0x37')]?_0x48c1c0[_0x6cae('0x34')]:_0x17566c[_0x6cae('0x35')];_0x48c1c0[_0x6cae('0x38')]=qs[_0x6cae('0x39')](_0x56c9ae[_0x6cae('0x31')][_0x6cae('0x39')]);_0x48c1c0[_0x6cae('0x3a')]=qs[_0x6cae('0x32')](_[_0x6cae('0x3b')](_0x56c9ae[_0x6cae('0x31')],_0x17566c[_0x6cae('0x32')]));if(_0x56c9ae[_0x6cae('0x31')][_0x6cae('0x3c')]){_0x48c1c0['where']=_[_0x6cae('0x3d')](_0x48c1c0[_0x6cae('0x3a')],{'$or':_[_0x6cae('0x2c')](_0x48c1c0['attributes'],function(_0x4ea0a3){var _0x3bd744={};_0x3bd744[_0x4ea0a3]={'$like':'%'+_0x56c9ae[_0x6cae('0x31')][_0x6cae('0x3c')]+'%'};return _0x3bd744;})});}_0x48c1c0=_[_0x6cae('0x3d')]({},_0x48c1c0,_0x56c9ae[_0x6cae('0x40')]);return _0x3c9d80['getFields'](_0x48c1c0);}})[_0x6cae('0x27')](function(_0x28aa71){if(_0x28aa71){_0x274f3b=_0x28aa71[_0x6cae('0x37')];if(!_0x56c9ae[_0x6cae('0x31')][_0x6cae('0x4f')](_0x6cae('0x50'))){_0x48c1c0[_0x6cae('0x22')]=qs[_0x6cae('0x22')](_0x56c9ae['query'][_0x6cae('0x22')]);_0x48c1c0['offset']=qs[_0x6cae('0x1f')](_0x56c9ae[_0x6cae('0x31')]['offset']);}return _0x3c9d80['getFields'](_0x48c1c0);}})[_0x6cae('0x27')](function(_0x2855de){if(_0x2855de){return _0x2855de?{'count':_0x274f3b,'rows':_0x2855de}:null;}})[_0x6cae('0x27')](respondWithResult(_0x35f57c,null))[_0x6cae('0x44')](handleError(_0x35f57c,null));};exports[_0x6cae('0x51')]=function(_0x585275,_0xee6ed8,_0xa1e627){var _0x3a5330={};var _0x31425e={};var _0x4c34f8;var _0x85178d;return db[_0x6cae('0x2d')][_0x6cae('0x4d')]({'where':{'id':_0x585275['params']['id']}})[_0x6cae('0x27')](handleEntityNotFound(_0xee6ed8,null))[_0x6cae('0x27')](function(_0x4f71e6){if(_0x4f71e6){_0x4c34f8=_0x4f71e6;_0x31425e[_0x6cae('0x35')]=_['keys'](db[_0x6cae('0x4e')]['rawAttributes']);_0x31425e[_0x6cae('0x31')]=_[_0x6cae('0x47')](_0x585275['query']);_0x31425e[_0x6cae('0x32')]=_[_0x6cae('0x33')](_0x31425e[_0x6cae('0x35')],_0x31425e[_0x6cae('0x31')]);_0x3a5330[_0x6cae('0x34')]=_[_0x6cae('0x33')](_0x31425e[_0x6cae('0x35')],qs[_0x6cae('0x36')](_0x585275[_0x6cae('0x31')]['fields']));_0x3a5330[_0x6cae('0x34')]=_0x3a5330[_0x6cae('0x34')][_0x6cae('0x37')]?_0x3a5330['attributes']:_0x31425e[_0x6cae('0x35')];_0x3a5330[_0x6cae('0x38')]=qs['sort'](_0x585275['query'][_0x6cae('0x39')]);_0x3a5330['where']=qs[_0x6cae('0x32')](_[_0x6cae('0x3b')](_0x585275[_0x6cae('0x31')],_0x31425e[_0x6cae('0x32')]));if(_0x585275[_0x6cae('0x31')][_0x6cae('0x3c')]){_0x3a5330['where']=_['merge'](_0x3a5330[_0x6cae('0x3a')],{'$or':_[_0x6cae('0x2c')](_0x3a5330['attributes'],function(_0x53501d){var _0x1464fb={};_0x1464fb[_0x53501d]={'$like':'%'+_0x585275[_0x6cae('0x31')][_0x6cae('0x3c')]+'%'};return _0x1464fb;})});}_0x3a5330=_[_0x6cae('0x3d')]({},_0x3a5330,_0x585275[_0x6cae('0x40')]);return _0x4c34f8[_0x6cae('0x51')](_0x3a5330);}})['then'](function(_0xa9080a){if(_0xa9080a){_0x85178d=_0xa9080a[_0x6cae('0x37')];if(!_0x585275[_0x6cae('0x31')]['hasOwnProperty'](_0x6cae('0x50'))){_0x3a5330[_0x6cae('0x22')]=qs[_0x6cae('0x22')](_0x585275[_0x6cae('0x31')][_0x6cae('0x22')]);_0x3a5330[_0x6cae('0x1f')]=qs[_0x6cae('0x1f')](_0x585275[_0x6cae('0x31')][_0x6cae('0x1f')]);}return _0x4c34f8[_0x6cae('0x51')](_0x3a5330);}})[_0x6cae('0x27')](function(_0x278be9){if(_0x278be9){return _0x278be9?{'count':_0x85178d,'rows':_0x278be9}:null;}})[_0x6cae('0x27')](respondWithResult(_0xee6ed8,null))[_0x6cae('0x44')](handleError(_0xee6ed8,null));};exports['getDescriptions']=function(_0x3279b4,_0x18a362,_0x2a842c){var _0x47e647={};var _0x33d55b={};var _0xfb4f98;var _0x5cbdc8;return db[_0x6cae('0x2d')][_0x6cae('0x4d')]({'where':{'id':_0x3279b4['params']['id']}})[_0x6cae('0x27')](handleEntityNotFound(_0x18a362,null))['then'](function(_0x4760e9){if(_0x4760e9){_0xfb4f98=_0x4760e9;_0x33d55b[_0x6cae('0x35')]=_[_0x6cae('0x47')](db['VtigerField'][_0x6cae('0x2e')]);_0x33d55b[_0x6cae('0x31')]=_[_0x6cae('0x47')](_0x3279b4[_0x6cae('0x31')]);_0x33d55b[_0x6cae('0x32')]=_['intersection'](_0x33d55b[_0x6cae('0x35')],_0x33d55b['query']);_0x47e647[_0x6cae('0x34')]=_[_0x6cae('0x33')](_0x33d55b[_0x6cae('0x35')],qs['fields'](_0x3279b4['query']['fields']));_0x47e647[_0x6cae('0x34')]=_0x47e647[_0x6cae('0x34')][_0x6cae('0x37')]?_0x47e647[_0x6cae('0x34')]:_0x33d55b[_0x6cae('0x35')];_0x47e647[_0x6cae('0x38')]=qs[_0x6cae('0x39')](_0x3279b4[_0x6cae('0x31')]['sort']);_0x47e647[_0x6cae('0x3a')]=qs[_0x6cae('0x32')](_[_0x6cae('0x3b')](_0x3279b4[_0x6cae('0x31')],_0x33d55b[_0x6cae('0x32')]));if(_0x3279b4[_0x6cae('0x31')]['filter']){_0x47e647[_0x6cae('0x3a')]=_[_0x6cae('0x3d')](_0x47e647[_0x6cae('0x3a')],{'$or':_['map'](_0x47e647[_0x6cae('0x34')],function(_0x4142bc){var _0x11e5e3={};_0x11e5e3[_0x4142bc]={'$like':'%'+_0x3279b4[_0x6cae('0x31')]['filter']+'%'};return _0x11e5e3;})});}_0x47e647=_['merge']({},_0x47e647,_0x3279b4[_0x6cae('0x40')]);return _0xfb4f98[_0x6cae('0x52')](_0x47e647);}})[_0x6cae('0x27')](function(_0x3dae08){if(_0x3dae08){_0x5cbdc8=_0x3dae08[_0x6cae('0x37')];if(!_0x3279b4[_0x6cae('0x31')][_0x6cae('0x4f')](_0x6cae('0x50'))){_0x47e647['limit']=qs[_0x6cae('0x22')](_0x3279b4[_0x6cae('0x31')][_0x6cae('0x22')]);_0x47e647['offset']=qs[_0x6cae('0x1f')](_0x3279b4[_0x6cae('0x31')][_0x6cae('0x1f')]);}return _0xfb4f98[_0x6cae('0x52')](_0x47e647);}})['then'](function(_0xbb83b7){if(_0xbb83b7){return _0xbb83b7?{'count':_0x5cbdc8,'rows':_0xbb83b7}:null;}})['then'](respondWithResult(_0x18a362,null))[_0x6cae('0x44')](handleError(_0x18a362,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b0c0571..7fe17af 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49c9=['bluebird','rimraf','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash','util','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x49c9,0x164));var _0x949c=function(_0x21549c,_0x418eb0){_0x21549c=_0x21549c-0x0;var _0x7b4fe4=_0x49c9[_0x21549c];return _0x7b4fe4;};'use strict';var _=require(_0x949c('0x0'));var util=require(_0x949c('0x1'));var logger=require('../../config/logger')(_0x949c('0x2'));var moment=require(_0x949c('0x3'));var BPromise=require(_0x949c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x949c('0x5'));var config=require('../../config/environment');var attributes=require(_0x949c('0x6'));module['exports']=function(_0x477a38,_0x4a5e52){return _0x477a38[_0x949c('0x7')]('VtigerConfiguration',attributes,{'tableName':_0x949c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6af=['define','int_vtiger_configurations','lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x9a9f7c,_0x157280){var _0x2da398=function(_0x953290){while(--_0x953290){_0x9a9f7c['push'](_0x9a9f7c['shift']());}};_0x2da398(++_0x157280);}(_0xc6af,0x192));var _0xfc6a=function(_0x1699fc,_0x4d9ac4){_0x1699fc=_0x1699fc-0x0;var _0x5ccee0=_0xc6af[_0x1699fc];return _0x5ccee0;};'use strict';var _=require(_0xfc6a('0x0'));var util=require(_0xfc6a('0x1'));var logger=require('../../config/logger')(_0xfc6a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc6a('0x3'));var fs=require('fs');var path=require(_0xfc6a('0x4'));var rimraf=require(_0xfc6a('0x5'));var config=require(_0xfc6a('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xfc6a('0x7')]=function(_0x5bde27,_0x48372f){return _0x5bde27[_0xfc6a('0x8')]('VtigerConfiguration',attributes,{'tableName':_0xfc6a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index c686473..5d3e3f3 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f29=['../../config/environment','jayson/promise','client','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x204172,_0x5c1aeb){var _0x315a8d=function(_0xa408d4){while(--_0xa408d4){_0x204172['push'](_0x204172['shift']());}};_0x315a8d(++_0x5c1aeb);}(_0x4f29,0xc8));var _0x94f2=function(_0x3fedc1,_0x3d46f7){_0x3fedc1=_0x3fedc1-0x0;var _0x2a62d9=_0x4f29[_0x3fedc1];return _0x2a62d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x94f2('0x0'));var rs=require(_0x94f2('0x1'));var fs=require('fs');var Redis=require(_0x94f2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x94f2('0x3'))('rpc');var config=require(_0x94f2('0x4'));var jayson=require(_0x94f2('0x5'));var client=jayson[_0x94f2('0x6')][_0x94f2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55a6c4,_0x25a677,_0x331b63){return new BPromise(function(_0x3c26e8,_0xe68e2a){return client[_0x94f2('0x8')](_0x55a6c4,_0x331b63)['then'](function(_0xe8bdec){logger['info'](_0x94f2('0x9'),_0x25a677,_0x94f2('0xa'));logger[_0x94f2('0xb')](_0x94f2('0xc'),_0x25a677,'request\x20sent',JSON['stringify'](_0xe8bdec));if(_0xe8bdec[_0x94f2('0xd')]){if(_0xe8bdec[_0x94f2('0xd')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x25a677,_0xe8bdec[_0x94f2('0xd')]['message']);return _0xe68e2a(_0xe8bdec[_0x94f2('0xd')]['message']);}logger[_0x94f2('0xd')](_0x94f2('0x9'),_0x25a677,_0xe8bdec[_0x94f2('0xd')][_0x94f2('0xe')]);return _0x3c26e8(_0xe8bdec[_0x94f2('0xd')]['message']);}else{logger[_0x94f2('0xf')](_0x94f2('0x9'),_0x25a677,_0x94f2('0xa'));_0x3c26e8(_0xe8bdec[_0x94f2('0x10')][_0x94f2('0xe')]);}})['catch'](function(_0x468bb0){logger[_0x94f2('0xd')](_0x94f2('0x9'),_0x25a677,_0x468bb0);_0xe68e2a(_0x468bb0);});});} \ No newline at end of file +var _0x5b15=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4df719,_0x4ae2c4){var _0x3faeec=function(_0x2a0f68){while(--_0x2a0f68){_0x4df719['push'](_0x4df719['shift']());}};_0x3faeec(++_0x4ae2c4);}(_0x5b15,0x13e));var _0x55b1=function(_0x132a14,_0x5a972f){_0x132a14=_0x132a14-0x0;var _0x3e992d=_0x5b15[_0x132a14];return _0x3e992d;};'use strict';var _=require(_0x55b1('0x0'));var util=require(_0x55b1('0x1'));var moment=require(_0x55b1('0x2'));var BPromise=require(_0x55b1('0x3'));var rs=require(_0x55b1('0x4'));var fs=require('fs');var Redis=require(_0x55b1('0x5'));var db=require(_0x55b1('0x6'))['db'];var utils=require(_0x55b1('0x7'));var logger=require(_0x55b1('0x8'))(_0x55b1('0x9'));var config=require(_0x55b1('0xa'));var jayson=require(_0x55b1('0xb'));var client=jayson['client'][_0x55b1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xef1902,_0xea54a4,_0x4a042e){return new BPromise(function(_0x133d0a,_0x5d3bf3){return client['request'](_0xef1902,_0x4a042e)[_0x55b1('0xd')](function(_0x5b75b1){logger['info'](_0x55b1('0xe'),_0xea54a4,'request\x20sent');logger[_0x55b1('0xf')](_0x55b1('0x10'),_0xea54a4,'request\x20sent',JSON[_0x55b1('0x11')](_0x5b75b1));if(_0x5b75b1[_0x55b1('0x12')]){if(_0x5b75b1[_0x55b1('0x12')][_0x55b1('0x13')]===0x1f4){logger[_0x55b1('0x12')](_0x55b1('0xe'),_0xea54a4,_0x5b75b1[_0x55b1('0x12')][_0x55b1('0x14')]);return _0x5d3bf3(_0x5b75b1[_0x55b1('0x12')][_0x55b1('0x14')]);}logger[_0x55b1('0x12')](_0x55b1('0xe'),_0xea54a4,_0x5b75b1[_0x55b1('0x12')][_0x55b1('0x14')]);return _0x133d0a(_0x5b75b1[_0x55b1('0x12')][_0x55b1('0x14')]);}else{logger[_0x55b1('0x15')](_0x55b1('0xe'),_0xea54a4,'request\x20sent');_0x133d0a(_0x5b75b1[_0x55b1('0x16')][_0x55b1('0x14')]);}})[_0x55b1('0x17')](function(_0xc7af4f){logger['error'](_0x55b1('0xe'),_0xea54a4,_0xc7af4f);_0x5d3bf3(_0xc7af4f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c46380d..a88c1df 100644 --- a/server/api/intVtigerField/index.js +++ b/server/api/intVtigerField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x45725b,_0x6f132e){var _0x2f65a0=function(_0x33ae87){while(--_0x33ae87){_0x45725b['push'](_0x45725b['shift']());}};_0x2f65a0(++_0x6f132e);}(_0x7f2f,0x1d7));var _0xf7f2=function(_0x352c13,_0x1a91cb){_0x352c13=_0x352c13-0x0;var _0x5b48e8=_0x7f2f[_0x352c13];return _0x5b48e8;};'use strict';var multer=require(_0xf7f2('0x0'));var util=require(_0xf7f2('0x1'));var path=require(_0xf7f2('0x2'));var timeout=require(_0xf7f2('0x3'));var express=require(_0xf7f2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf7f2('0x5'));var interaction=require(_0xf7f2('0x6'));var config=require(_0xf7f2('0x7'));var controller=require(_0xf7f2('0x8'));router[_0xf7f2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf7f2('0xa'),auth[_0xf7f2('0xb')](),controller[_0xf7f2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf7f2('0xd')](_0xf7f2('0xa'),auth[_0xf7f2('0xb')](),controller[_0xf7f2('0xe')]);router[_0xf7f2('0xf')](_0xf7f2('0xa'),auth[_0xf7f2('0xb')](),controller[_0xf7f2('0x10')]);module['exports']=router; \ No newline at end of file +var _0x760a=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','create','update'];(function(_0x44ee27,_0x2f8ebd){var _0x10df04=function(_0x52afb5){while(--_0x52afb5){_0x44ee27['push'](_0x44ee27['shift']());}};_0x10df04(++_0x2f8ebd);}(_0x760a,0xa4));var _0xa760=function(_0x1e89e2,_0x71e2a8){_0x1e89e2=_0x1e89e2-0x0;var _0x2e2a5e=_0x760a[_0x1e89e2];return _0x2e2a5e;};'use strict';var multer=require(_0xa760('0x0'));var util=require(_0xa760('0x1'));var path=require(_0xa760('0x2'));var timeout=require(_0xa760('0x3'));var express=require(_0xa760('0x4'));var router=express[_0xa760('0x5')]();var fs_extra=require(_0xa760('0x6'));var auth=require(_0xa760('0x7'));var interaction=require(_0xa760('0x8'));var config=require('../../config/environment');var controller=require(_0xa760('0x9'));router[_0xa760('0xa')]('/',auth[_0xa760('0xb')](),controller['index']);router[_0xa760('0xa')](_0xa760('0xc'),auth['isAuthenticated'](),controller[_0xa760('0xd')]);router['post']('/',auth[_0xa760('0xb')](),controller[_0xa760('0xe')]);router['put']('/:id',auth[_0xa760('0xb')](),controller[_0xa760('0xf')]);router[_0xa760('0x10')](_0xa760('0xc'),auth[_0xa760('0xb')](),controller[_0xa760('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f3a6c0d..6460591 100644 --- a/server/api/intVtigerField/intVtigerField.attributes.js +++ b/server/api/intVtigerField/intVtigerField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5ea=['sequelize','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb5ea,0x1a4));var _0xab5e=function(_0x5472c9,_0x153e33){_0x5472c9=_0x5472c9-0x0;var _0x33f203=_0xb5ea[_0x5472c9];return _0x33f203;};'use strict';var Sequelize=require(_0xab5e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xab5e('0x1'),_0xab5e('0x2'),'customVariable',_0xab5e('0x3'),_0xab5e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xab5e('0x5')]},'key':{'type':Sequelize[_0xab5e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xab5e('0x1'),_0xab5e('0x2'),_0xab5e('0x6'))},'keyContent':{'type':Sequelize[_0xab5e('0x5')]},'idField':{'type':Sequelize[_0xab5e('0x5')]},'nameField':{'type':Sequelize[_0xab5e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab5e('0x5')]}}; \ No newline at end of file +var _0xc33a=['picklist','string','STRING','customVariable','BOOLEAN','exports','ENUM','variable','keyValue'];(function(_0x232c05,_0x118c50){var _0x172b97=function(_0x347fda){while(--_0x347fda){_0x232c05['push'](_0x232c05['shift']());}};_0x172b97(++_0x118c50);}(_0xc33a,0x11c));var _0xac33=function(_0xeb80e,_0x337608){_0xeb80e=_0xeb80e-0x0;var _0x68e9d7=_0xc33a[_0xeb80e];return _0x68e9d7;};'use strict';var Sequelize=require('sequelize');module[_0xac33('0x0')]={'type':{'type':Sequelize[_0xac33('0x1')]('string',_0xac33('0x2'),'customVariable',_0xac33('0x3'),_0xac33('0x4')),'defaultValue':_0xac33('0x5')},'content':{'type':Sequelize[_0xac33('0x6')]},'key':{'type':Sequelize[_0xac33('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xac33('0x5'),_0xac33('0x2'),_0xac33('0x7'))},'keyContent':{'type':Sequelize[_0xac33('0x6')]},'idField':{'type':Sequelize[_0xac33('0x6')]},'nameField':{'type':Sequelize[_0xac33('0x6')]},'customField':{'type':Sequelize[_0xac33('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xac33('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5fb964a..a659556 100644 --- a/server/api/intVtigerField/intVtigerField.controller.js +++ b/server/api/intVtigerField/intVtigerField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf211=['name','send','index','map','VtigerField','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','stack'];(function(_0x23f3eb,_0x3c875f){var _0x5b66ff=function(_0x11cbda){while(--_0x11cbda){_0x23f3eb['push'](_0x23f3eb['shift']());}};_0x5b66ff(++_0x3c875f);}(_0xf211,0x13e));var _0x1f21=function(_0x2b72ef,_0x574981){_0x2b72ef=_0x2b72ef-0x0;var _0x56a161=_0xf211[_0x2b72ef];return _0x56a161;};'use strict';var emlformat=require(_0x1f21('0x0'));var rimraf=require(_0x1f21('0x1'));var zipdir=require(_0x1f21('0x2'));var jsonpatch=require(_0x1f21('0x3'));var rp=require(_0x1f21('0x4'));var moment=require(_0x1f21('0x5'));var BPromise=require(_0x1f21('0x6'));var Mustache=require(_0x1f21('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1f21('0x8'));var csv=require('to-csv');var ejs=require(_0x1f21('0x9'));var fs=require('fs');var fs_extra=require(_0x1f21('0xa'));var _=require(_0x1f21('0xb'));var squel=require(_0x1f21('0xc'));var crypto=require('crypto');var jsforce=require(_0x1f21('0xd'));var deskjs=require(_0x1f21('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f21('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f21('0x10'));var as=require(_0x1f21('0x11'));var hardwareService=require(_0x1f21('0x12'));var logger=require(_0x1f21('0x13'))('api');var utils=require(_0x1f21('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff6e5,_0x8ec390){_0x8ec390=_0x8ec390||0xcc;return function(_0x5ae32b){if(_0x5ae32b){return _0x3ff6e5[_0x1f21('0x15')](_0x8ec390);}return _0x3ff6e5[_0x1f21('0x16')](_0x8ec390)[_0x1f21('0x17')]();};}function respondWithResult(_0x1c7256,_0x54090a){_0x54090a=_0x54090a||0xc8;return function(_0x6f30f1){if(_0x6f30f1){return _0x1c7256[_0x1f21('0x16')](_0x54090a)[_0x1f21('0x18')](_0x6f30f1);}};}function respondWithFilteredResult(_0x23505c,_0x4cf4c1){return function(_0x410280){if(_0x410280){var _0x5610a2=typeof _0x4cf4c1['offset']==='undefined'&&typeof _0x4cf4c1['limit']===_0x1f21('0x19');var _0x200a47=_0x410280[_0x1f21('0x1a')];var _0x63b3ab=_0x5610a2?0x0:_0x4cf4c1[_0x1f21('0x1b')];var _0x6ca6c9=_0x5610a2?_0x410280['count']:_0x4cf4c1[_0x1f21('0x1b')]+_0x4cf4c1[_0x1f21('0x1c')];var _0x428161;if(_0x6ca6c9>=_0x200a47){_0x6ca6c9=_0x200a47;_0x428161=0xc8;}else{_0x428161=0xce;}_0x23505c[_0x1f21('0x16')](_0x428161);return _0x23505c[_0x1f21('0x1d')]('Content-Range',_0x63b3ab+'-'+_0x6ca6c9+'/'+_0x200a47)[_0x1f21('0x18')](_0x410280);}return null;};}function patchUpdates(_0x5bac53){return function(_0x483814){try{jsonpatch[_0x1f21('0x1e')](_0x483814,_0x5bac53,!![]);}catch(_0x1b98cb){return BPromise[_0x1f21('0x1f')](_0x1b98cb);}return _0x483814[_0x1f21('0x20')]();};}function saveUpdates(_0x66332,_0x1e005c){return function(_0x2f0c56){if(_0x2f0c56){return _0x2f0c56['update'](_0x66332)[_0x1f21('0x21')](function(_0x593cc9){return _0x593cc9;});}return null;};}function removeEntity(_0x40bb43,_0x4568fa){return function(_0x4458e1){if(_0x4458e1){return _0x4458e1[_0x1f21('0x22')]()['then'](function(){_0x40bb43['status'](0xcc)[_0x1f21('0x17')]();});}};}function handleEntityNotFound(_0x1af54a,_0x1eec9a){return function(_0x929383){if(!_0x929383){_0x1af54a[_0x1f21('0x15')](0x194);}return _0x929383;};}function handleError(_0x21bd00,_0x1ea25e){_0x1ea25e=_0x1ea25e||0x1f4;return function(_0x4eca9d){logger[_0x1f21('0x23')](_0x4eca9d[_0x1f21('0x24')]);if(_0x4eca9d[_0x1f21('0x25')]){delete _0x4eca9d[_0x1f21('0x25')];}_0x21bd00[_0x1f21('0x16')](_0x1ea25e)[_0x1f21('0x26')](_0x4eca9d);};}exports[_0x1f21('0x27')]=function(_0x280369,_0x595d6d){var _0x190adf={},_0x3f98f2={},_0x1cf897={'count':0x0,'rows':[]};var _0x5579b3=_[_0x1f21('0x28')](db[_0x1f21('0x29')][_0x1f21('0x2a')],function(_0x57986c){return{'name':_0x57986c['fieldName'],'type':_0x57986c[_0x1f21('0x2b')][_0x1f21('0x2c')]};});_0x3f98f2['model']=_['map'](_0x5579b3,_0x1f21('0x25'));_0x3f98f2[_0x1f21('0x2d')]=_[_0x1f21('0x2e')](_0x280369[_0x1f21('0x2d')]);_0x3f98f2[_0x1f21('0x2f')]=_[_0x1f21('0x30')](_0x3f98f2['model'],_0x3f98f2['query']);_0x190adf[_0x1f21('0x31')]=_[_0x1f21('0x30')](_0x3f98f2[_0x1f21('0x32')],qs['fields'](_0x280369[_0x1f21('0x2d')][_0x1f21('0x33')]));_0x190adf[_0x1f21('0x31')]=_0x190adf[_0x1f21('0x31')][_0x1f21('0x34')]?_0x190adf[_0x1f21('0x31')]:_0x3f98f2[_0x1f21('0x32')];if(!_0x280369['query']['hasOwnProperty'](_0x1f21('0x35'))){_0x190adf[_0x1f21('0x1c')]=qs['limit'](_0x280369[_0x1f21('0x2d')][_0x1f21('0x1c')]);_0x190adf[_0x1f21('0x1b')]=qs[_0x1f21('0x1b')](_0x280369[_0x1f21('0x2d')]['offset']);}_0x190adf[_0x1f21('0x36')]=qs['sort'](_0x280369[_0x1f21('0x2d')][_0x1f21('0x37')]);_0x190adf[_0x1f21('0x38')]=qs[_0x1f21('0x2f')](_[_0x1f21('0x39')](_0x280369[_0x1f21('0x2d')],_0x3f98f2[_0x1f21('0x2f')]),_0x5579b3);if(_0x280369[_0x1f21('0x2d')][_0x1f21('0x3a')]){_0x190adf[_0x1f21('0x38')]=_[_0x1f21('0x3b')](_0x190adf[_0x1f21('0x38')],{'$or':_[_0x1f21('0x28')](_0x5579b3,function(_0x39767a){if(_0x39767a[_0x1f21('0x2b')]!==_0x1f21('0x3c')){var _0x5b9dfa={};_0x5b9dfa[_0x39767a[_0x1f21('0x25')]]={'$like':'%'+_0x280369[_0x1f21('0x2d')][_0x1f21('0x3a')]+'%'};return _0x5b9dfa;}})});}_0x190adf=_[_0x1f21('0x3b')]({},_0x190adf,_0x280369[_0x1f21('0x3d')]);var _0x5ce73d={'where':_0x190adf[_0x1f21('0x38')]};return db['VtigerField'][_0x1f21('0x1a')](_0x5ce73d)[_0x1f21('0x21')](function(_0x1b1b3f){_0x1cf897[_0x1f21('0x1a')]=_0x1b1b3f;if(_0x280369[_0x1f21('0x2d')][_0x1f21('0x3e')]){_0x190adf[_0x1f21('0x3f')]=[{'all':!![]}];}return db[_0x1f21('0x29')][_0x1f21('0x40')](_0x190adf);})[_0x1f21('0x21')](function(_0x462454){_0x1cf897[_0x1f21('0x41')]=_0x462454;return _0x1cf897;})[_0x1f21('0x21')](respondWithFilteredResult(_0x595d6d,_0x190adf))['catch'](handleError(_0x595d6d,null));};exports[_0x1f21('0x42')]=function(_0x54a0a3,_0x308de4){var _0x845f9={'raw':!![],'where':{'id':_0x54a0a3['params']['id']}},_0x3057a8={};_0x3057a8[_0x1f21('0x32')]=_[_0x1f21('0x2e')](db[_0x1f21('0x29')][_0x1f21('0x2a')]);_0x3057a8['query']=_[_0x1f21('0x2e')](_0x54a0a3[_0x1f21('0x2d')]);_0x3057a8[_0x1f21('0x2f')]=_[_0x1f21('0x30')](_0x3057a8[_0x1f21('0x32')],_0x3057a8[_0x1f21('0x2d')]);_0x845f9[_0x1f21('0x31')]=_[_0x1f21('0x30')](_0x3057a8['model'],qs[_0x1f21('0x33')](_0x54a0a3['query'][_0x1f21('0x33')]));_0x845f9['attributes']=_0x845f9[_0x1f21('0x31')][_0x1f21('0x34')]?_0x845f9[_0x1f21('0x31')]:_0x3057a8['model'];if(_0x54a0a3['query']['includeAll']){_0x845f9[_0x1f21('0x3f')]=[{'all':!![]}];}_0x845f9=_[_0x1f21('0x3b')]({},_0x845f9,_0x54a0a3['options']);return db[_0x1f21('0x29')][_0x1f21('0x43')](_0x845f9)['then'](handleEntityNotFound(_0x308de4,null))['then'](respondWithResult(_0x308de4,null))[_0x1f21('0x44')](handleError(_0x308de4,null));};exports[_0x1f21('0x45')]=function(_0x570f60,_0x4f1804){return db[_0x1f21('0x29')][_0x1f21('0x45')](_0x570f60['body'],{})['then'](respondWithResult(_0x4f1804,0xc9))[_0x1f21('0x44')](handleError(_0x4f1804,null));};exports['update']=function(_0x525494,_0xac6734){if(_0x525494['body']['id']){delete _0x525494['body']['id'];}return db[_0x1f21('0x29')][_0x1f21('0x43')]({'where':{'id':_0x525494[_0x1f21('0x46')]['id']}})[_0x1f21('0x21')](handleEntityNotFound(_0xac6734,null))[_0x1f21('0x21')](saveUpdates(_0x525494['body'],null))[_0x1f21('0x21')](respondWithResult(_0xac6734,null))[_0x1f21('0x44')](handleError(_0xac6734,null));};exports[_0x1f21('0x22')]=function(_0x2c6213,_0x32af2e){return db[_0x1f21('0x29')]['find']({'where':{'id':_0x2c6213[_0x1f21('0x46')]['id']}})[_0x1f21('0x21')](handleEntityNotFound(_0x32af2e,null))[_0x1f21('0x21')](removeEntity(_0x32af2e,null))[_0x1f21('0x44')](handleError(_0x32af2e,null));}; \ No newline at end of file +var _0x7800=['bluebird','util','path','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map','VtigerField','type','key','query','keys','filters','intersection','fields','length','attributes','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x7800,0x1ee));var _0x0780=function(_0x11a1bc,_0x17ec9d){_0x11a1bc=_0x11a1bc-0x0;var _0x2446a1=_0x7800[_0x11a1bc];return _0x2446a1;};'use strict';var emlformat=require(_0x0780('0x0'));var rimraf=require(_0x0780('0x1'));var zipdir=require(_0x0780('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0780('0x3'));var Mustache=require('mustache');var util=require(_0x0780('0x4'));var path=require(_0x0780('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0780('0x6'));var _=require(_0x0780('0x7'));var squel=require(_0x0780('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0780('0x9'));var toCsv=require(_0x0780('0xa'));var querystring=require(_0x0780('0xb'));var Papa=require(_0x0780('0xc'));var Redis=require(_0x0780('0xd'));var authService=require(_0x0780('0xe'));var qs=require(_0x0780('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0780('0x10'));var logger=require(_0x0780('0x11'))('api');var utils=require(_0x0780('0x12'));var config=require(_0x0780('0x13'));var licenseUtil=require(_0x0780('0x14'));var db=require(_0x0780('0x15'))['db'];function respondWithStatusCode(_0x40c282,_0x294388){_0x294388=_0x294388||0xcc;return function(_0x48f05c){if(_0x48f05c){return _0x40c282[_0x0780('0x16')](_0x294388);}return _0x40c282[_0x0780('0x17')](_0x294388)[_0x0780('0x18')]();};}function respondWithResult(_0x1980e5,_0x4dc30c){_0x4dc30c=_0x4dc30c||0xc8;return function(_0x5b7bc9){if(_0x5b7bc9){return _0x1980e5[_0x0780('0x17')](_0x4dc30c)[_0x0780('0x19')](_0x5b7bc9);}};}function respondWithFilteredResult(_0x4b7985,_0x26fc52){return function(_0x4c3853){if(_0x4c3853){var _0x3cefe2=typeof _0x26fc52[_0x0780('0x1a')]===_0x0780('0x1b')&&typeof _0x26fc52[_0x0780('0x1c')]==='undefined';var _0x15336b=_0x4c3853[_0x0780('0x1d')];var _0x4875eb=_0x3cefe2?0x0:_0x26fc52[_0x0780('0x1a')];var _0x16d55a=_0x3cefe2?_0x4c3853[_0x0780('0x1d')]:_0x26fc52['offset']+_0x26fc52[_0x0780('0x1c')];var _0x448f9c;if(_0x16d55a>=_0x15336b){_0x16d55a=_0x15336b;_0x448f9c=0xc8;}else{_0x448f9c=0xce;}_0x4b7985[_0x0780('0x17')](_0x448f9c);return _0x4b7985[_0x0780('0x1e')]('Content-Range',_0x4875eb+'-'+_0x16d55a+'/'+_0x15336b)[_0x0780('0x19')](_0x4c3853);}return null;};}function patchUpdates(_0x5dd949){return function(_0x13daee){try{jsonpatch[_0x0780('0x1f')](_0x13daee,_0x5dd949,!![]);}catch(_0x425cbe){return BPromise[_0x0780('0x20')](_0x425cbe);}return _0x13daee['save']();};}function saveUpdates(_0x2edd83,_0x11f641){return function(_0x113ec2){if(_0x113ec2){return _0x113ec2['update'](_0x2edd83)[_0x0780('0x21')](function(_0xf486f7){return _0xf486f7;});}return null;};}function removeEntity(_0x35f5ba,_0x106289){return function(_0x33627e){if(_0x33627e){return _0x33627e[_0x0780('0x22')]()[_0x0780('0x21')](function(){_0x35f5ba['status'](0xcc)[_0x0780('0x18')]();});}};}function handleEntityNotFound(_0x112b57,_0x16a012){return function(_0x590ced){if(!_0x590ced){_0x112b57[_0x0780('0x16')](0x194);}return _0x590ced;};}function handleError(_0x5da0f6,_0x2c1d9d){_0x2c1d9d=_0x2c1d9d||0x1f4;return function(_0x553f49){logger[_0x0780('0x23')](_0x553f49[_0x0780('0x24')]);if(_0x553f49['name']){delete _0x553f49[_0x0780('0x25')];}_0x5da0f6['status'](_0x2c1d9d)[_0x0780('0x26')](_0x553f49);};}exports[_0x0780('0x27')]=function(_0x29007d,_0x20ff37){var _0x29f705={},_0x5dd2a1={},_0x11401a={'count':0x0,'rows':[]};var _0x432b58=_[_0x0780('0x28')](db[_0x0780('0x29')]['rawAttributes'],function(_0x2fd0f3){return{'name':_0x2fd0f3['fieldName'],'type':_0x2fd0f3[_0x0780('0x2a')][_0x0780('0x2b')]};});_0x5dd2a1['model']=_['map'](_0x432b58,_0x0780('0x25'));_0x5dd2a1[_0x0780('0x2c')]=_[_0x0780('0x2d')](_0x29007d[_0x0780('0x2c')]);_0x5dd2a1[_0x0780('0x2e')]=_[_0x0780('0x2f')](_0x5dd2a1['model'],_0x5dd2a1['query']);_0x29f705['attributes']=_[_0x0780('0x2f')](_0x5dd2a1['model'],qs[_0x0780('0x30')](_0x29007d[_0x0780('0x2c')][_0x0780('0x30')]));_0x29f705['attributes']=_0x29f705['attributes'][_0x0780('0x31')]?_0x29f705[_0x0780('0x32')]:_0x5dd2a1[_0x0780('0x33')];if(!_0x29007d[_0x0780('0x2c')][_0x0780('0x34')](_0x0780('0x35'))){_0x29f705[_0x0780('0x1c')]=qs[_0x0780('0x1c')](_0x29007d[_0x0780('0x2c')][_0x0780('0x1c')]);_0x29f705['offset']=qs[_0x0780('0x1a')](_0x29007d[_0x0780('0x2c')][_0x0780('0x1a')]);}_0x29f705[_0x0780('0x36')]=qs[_0x0780('0x37')](_0x29007d[_0x0780('0x2c')][_0x0780('0x37')]);_0x29f705[_0x0780('0x38')]=qs[_0x0780('0x2e')](_['pick'](_0x29007d[_0x0780('0x2c')],_0x5dd2a1['filters']),_0x432b58);if(_0x29007d[_0x0780('0x2c')][_0x0780('0x39')]){_0x29f705[_0x0780('0x38')]=_[_0x0780('0x3a')](_0x29f705['where'],{'$or':_[_0x0780('0x28')](_0x432b58,function(_0x49a356){if(_0x49a356[_0x0780('0x2a')]!==_0x0780('0x3b')){var _0xa30b7a={};_0xa30b7a[_0x49a356[_0x0780('0x25')]]={'$like':'%'+_0x29007d[_0x0780('0x2c')][_0x0780('0x39')]+'%'};return _0xa30b7a;}})});}_0x29f705=_[_0x0780('0x3a')]({},_0x29f705,_0x29007d[_0x0780('0x3c')]);var _0x5dd6d1={'where':_0x29f705[_0x0780('0x38')]};return db[_0x0780('0x29')][_0x0780('0x1d')](_0x5dd6d1)[_0x0780('0x21')](function(_0x34880d){_0x11401a[_0x0780('0x1d')]=_0x34880d;if(_0x29007d['query'][_0x0780('0x3d')]){_0x29f705[_0x0780('0x3e')]=[{'all':!![]}];}return db[_0x0780('0x29')][_0x0780('0x3f')](_0x29f705);})[_0x0780('0x21')](function(_0x31dab9){_0x11401a['rows']=_0x31dab9;return _0x11401a;})[_0x0780('0x21')](respondWithFilteredResult(_0x20ff37,_0x29f705))[_0x0780('0x40')](handleError(_0x20ff37,null));};exports[_0x0780('0x41')]=function(_0x3d76f5,_0x5ea023){var _0x3b02c0={'raw':!![],'where':{'id':_0x3d76f5[_0x0780('0x42')]['id']}},_0x1a4d3b={};_0x1a4d3b[_0x0780('0x33')]=_[_0x0780('0x2d')](db[_0x0780('0x29')][_0x0780('0x43')]);_0x1a4d3b[_0x0780('0x2c')]=_[_0x0780('0x2d')](_0x3d76f5['query']);_0x1a4d3b[_0x0780('0x2e')]=_[_0x0780('0x2f')](_0x1a4d3b[_0x0780('0x33')],_0x1a4d3b['query']);_0x3b02c0['attributes']=_[_0x0780('0x2f')](_0x1a4d3b[_0x0780('0x33')],qs[_0x0780('0x30')](_0x3d76f5['query'][_0x0780('0x30')]));_0x3b02c0[_0x0780('0x32')]=_0x3b02c0[_0x0780('0x32')][_0x0780('0x31')]?_0x3b02c0[_0x0780('0x32')]:_0x1a4d3b[_0x0780('0x33')];if(_0x3d76f5[_0x0780('0x2c')][_0x0780('0x3d')]){_0x3b02c0[_0x0780('0x3e')]=[{'all':!![]}];}_0x3b02c0=_[_0x0780('0x3a')]({},_0x3b02c0,_0x3d76f5[_0x0780('0x3c')]);return db[_0x0780('0x29')][_0x0780('0x44')](_0x3b02c0)['then'](handleEntityNotFound(_0x5ea023,null))['then'](respondWithResult(_0x5ea023,null))[_0x0780('0x40')](handleError(_0x5ea023,null));};exports[_0x0780('0x45')]=function(_0x2ab194,_0x3696b6){return db['VtigerField']['create'](_0x2ab194['body'],{})['then'](respondWithResult(_0x3696b6,0xc9))[_0x0780('0x40')](handleError(_0x3696b6,null));};exports['update']=function(_0x1b2544,_0x47c642){if(_0x1b2544[_0x0780('0x46')]['id']){delete _0x1b2544[_0x0780('0x46')]['id'];}return db[_0x0780('0x29')]['find']({'where':{'id':_0x1b2544[_0x0780('0x42')]['id']}})[_0x0780('0x21')](handleEntityNotFound(_0x47c642,null))['then'](saveUpdates(_0x1b2544[_0x0780('0x46')],null))['then'](respondWithResult(_0x47c642,null))[_0x0780('0x40')](handleError(_0x47c642,null));};exports[_0x0780('0x22')]=function(_0x2df037,_0x5c6cd8){return db[_0x0780('0x29')][_0x0780('0x44')]({'where':{'id':_0x2df037[_0x0780('0x42')]['id']}})[_0x0780('0x21')](handleEntityNotFound(_0x5c6cd8,null))[_0x0780('0x21')](removeEntity(_0x5c6cd8,null))['catch'](handleError(_0x5c6cd8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b681171..44b6b2f 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7c2=['vtiger_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','path','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xe7c2,0x1bc));var _0x2e7c=function(_0x1561ba,_0x4dc620){_0x1561ba=_0x1561ba-0x0;var _0x156f28=_0xe7c2[_0x1561ba];return _0x156f28;};'use strict';var _=require(_0x2e7c('0x0'));var util=require('util');var logger=require(_0x2e7c('0x1'))(_0x2e7c('0x2'));var moment=require(_0x2e7c('0x3'));var BPromise=require(_0x2e7c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e7c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e7c('0x6'));module[_0x2e7c('0x7')]=function(_0x1bdef8,_0x4f9e27){return _0x1bdef8[_0x2e7c('0x8')](_0x2e7c('0x9'),attributes,{'tableName':_0x2e7c('0xa'),'paranoid':![],'indexes':[{'name':_0x2e7c('0xb'),'fields':['idField',_0x2e7c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5eca=['request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x47fb17,_0x159777){var _0x32a740=function(_0x18100a){while(--_0x18100a){_0x47fb17['push'](_0x47fb17['shift']());}};_0x32a740(++_0x159777);}(_0x5eca,0x12b));var _0xa5ec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5eca[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xa5ec('0x0'));var util=require('util');var logger=require(_0xa5ec('0x1'))(_0xa5ec('0x2'));var moment=require(_0xa5ec('0x3'));var BPromise=require(_0xa5ec('0x4'));var rp=require(_0xa5ec('0x5'));var fs=require('fs');var path=require(_0xa5ec('0x6'));var rimraf=require(_0xa5ec('0x7'));var config=require(_0xa5ec('0x8'));var attributes=require(_0xa5ec('0x9'));module[_0xa5ec('0xa')]=function(_0x5bff91,_0x16e419){return _0x5bff91[_0xa5ec('0xb')](_0xa5ec('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xa5ec('0xd'),'fields':[_0xa5ec('0xe'),_0xa5ec('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index a5f9231..0c49622 100644 --- a/server/api/intVtigerField/intVtigerField.rpc.js +++ b/server/api/intVtigerField/intVtigerField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeeb9=['jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xeeb9,0x150));var _0x9eeb=function(_0x29b5b3,_0x5d4495){_0x29b5b3=_0x29b5b3-0x0;var _0x5998bb=_0xeeb9[_0x29b5b3];return _0x5998bb;};'use strict';var _=require('lodash');var util=require(_0x9eeb('0x0'));var moment=require(_0x9eeb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9eeb('0x2'));var db=require(_0x9eeb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9eeb('0x4'))(_0x9eeb('0x5'));var config=require('../../config/environment');var jayson=require(_0x9eeb('0x6'));var client=jayson[_0x9eeb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x589911,_0xa6ec8a,_0x2a112c){return new BPromise(function(_0x1b2dc8,_0x399ecf){return client[_0x9eeb('0x8')](_0x589911,_0x2a112c)[_0x9eeb('0x9')](function(_0x2d38ae){logger[_0x9eeb('0xa')](_0x9eeb('0xb'),_0xa6ec8a,_0x9eeb('0xc'));logger[_0x9eeb('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0xa6ec8a,_0x9eeb('0xc'),JSON[_0x9eeb('0xe')](_0x2d38ae));if(_0x2d38ae['error']){if(_0x2d38ae[_0x9eeb('0xf')][_0x9eeb('0x10')]===0x1f4){logger[_0x9eeb('0xf')](_0x9eeb('0xb'),_0xa6ec8a,_0x2d38ae[_0x9eeb('0xf')][_0x9eeb('0x11')]);return _0x399ecf(_0x2d38ae['error'][_0x9eeb('0x11')]);}logger[_0x9eeb('0xf')](_0x9eeb('0xb'),_0xa6ec8a,_0x2d38ae[_0x9eeb('0xf')][_0x9eeb('0x11')]);return _0x1b2dc8(_0x2d38ae[_0x9eeb('0xf')][_0x9eeb('0x11')]);}else{logger['info'](_0x9eeb('0xb'),_0xa6ec8a,'request\x20sent');_0x1b2dc8(_0x2d38ae['result'][_0x9eeb('0x11')]);}})['catch'](function(_0x5636bf){logger[_0x9eeb('0xf')](_0x9eeb('0xb'),_0xa6ec8a,_0x5636bf);_0x399ecf(_0x5636bf);});});} \ No newline at end of file +var _0x44fa=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x2fbe73,_0x306b0a){var _0x88787=function(_0x50340b){while(--_0x50340b){_0x2fbe73['push'](_0x2fbe73['shift']());}};_0x88787(++_0x306b0a);}(_0x44fa,0xd6));var _0xa44f=function(_0x4aa0bf,_0x656d69){_0x4aa0bf=_0x4aa0bf-0x0;var _0x14d624=_0x44fa[_0x4aa0bf];return _0x14d624;};'use strict';var _=require(_0xa44f('0x0'));var util=require(_0xa44f('0x1'));var moment=require(_0xa44f('0x2'));var BPromise=require(_0xa44f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa44f('0x4'));var db=require(_0xa44f('0x5'))['db'];var utils=require(_0xa44f('0x6'));var logger=require(_0xa44f('0x7'))(_0xa44f('0x8'));var config=require('../../config/environment');var jayson=require(_0xa44f('0x9'));var client=jayson[_0xa44f('0xa')][_0xa44f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x113cd5,_0x4a591b,_0x1a6af5){return new BPromise(function(_0x559cf1,_0x4fc494){return client['request'](_0x113cd5,_0x1a6af5)[_0xa44f('0xc')](function(_0x451dad){logger[_0xa44f('0xd')](_0xa44f('0xe'),_0x4a591b,_0xa44f('0xf'));logger[_0xa44f('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4a591b,_0xa44f('0xf'),JSON[_0xa44f('0x11')](_0x451dad));if(_0x451dad[_0xa44f('0x12')]){if(_0x451dad[_0xa44f('0x12')][_0xa44f('0x13')]===0x1f4){logger[_0xa44f('0x12')](_0xa44f('0xe'),_0x4a591b,_0x451dad[_0xa44f('0x12')][_0xa44f('0x14')]);return _0x4fc494(_0x451dad[_0xa44f('0x12')][_0xa44f('0x14')]);}logger[_0xa44f('0x12')](_0xa44f('0xe'),_0x4a591b,_0x451dad[_0xa44f('0x12')]['message']);return _0x559cf1(_0x451dad['error']['message']);}else{logger[_0xa44f('0xd')](_0xa44f('0xe'),_0x4a591b,_0xa44f('0xf'));_0x559cf1(_0x451dad[_0xa44f('0x15')][_0xa44f('0x14')]);}})[_0xa44f('0x16')](function(_0xab427d){logger['error'](_0xa44f('0xe'),_0x4a591b,_0xab427d);_0x4fc494(_0xab427d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 863a442..833a32a 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d14=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7d14,0x6d));var _0x47d1=function(_0x20576e,_0x187aa6){_0x20576e=_0x20576e-0x0;var _0x3ee578=_0x7d14[_0x20576e];return _0x3ee578;};'use strict';var multer=require(_0x47d1('0x0'));var util=require(_0x47d1('0x1'));var path=require('path');var timeout=require(_0x47d1('0x2'));var express=require(_0x47d1('0x3'));var router=express[_0x47d1('0x4')]();var fs_extra=require(_0x47d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x47d1('0x6'));var config=require(_0x47d1('0x7'));var controller=require(_0x47d1('0x8'));router[_0x47d1('0x9')]('/',auth[_0x47d1('0xa')](),controller['index']);router['get']('/:id',auth[_0x47d1('0xa')](),controller['show']);router[_0x47d1('0x9')](_0x47d1('0xb'),auth[_0x47d1('0xa')](),controller[_0x47d1('0xc')]);router[_0x47d1('0x9')](_0x47d1('0xd'),auth[_0x47d1('0xa')](),controller[_0x47d1('0xe')]);router[_0x47d1('0xf')]('/',auth[_0x47d1('0xa')](),controller[_0x47d1('0x10')]);router[_0x47d1('0xf')](_0x47d1('0xb'),auth['isAuthenticated'](),controller[_0x47d1('0x11')]);router[_0x47d1('0x12')](_0x47d1('0x13'),auth[_0x47d1('0xa')](),controller[_0x47d1('0x14')]);router[_0x47d1('0x15')](_0x47d1('0x13'),auth[_0x47d1('0xa')](),controller[_0x47d1('0x16')]);module[_0x47d1('0x17')]=router; \ No newline at end of file +var _0x0ae1=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get'];(function(_0x37ff86,_0x54ae25){var _0x30b5f3=function(_0x3ffd03){while(--_0x3ffd03){_0x37ff86['push'](_0x37ff86['shift']());}};_0x30b5f3(++_0x54ae25);}(_0x0ae1,0xac));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x10ae('0x0'));var util=require(_0x10ae('0x1'));var path=require(_0x10ae('0x2'));var timeout=require(_0x10ae('0x3'));var express=require(_0x10ae('0x4'));var router=express['Router']();var fs_extra=require(_0x10ae('0x5'));var auth=require(_0x10ae('0x6'));var interaction=require(_0x10ae('0x7'));var config=require('../../config/environment');var controller=require(_0x10ae('0x8'));router[_0x10ae('0x9')]('/',auth[_0x10ae('0xa')](),controller[_0x10ae('0xb')]);router[_0x10ae('0x9')](_0x10ae('0xc'),auth[_0x10ae('0xa')](),controller[_0x10ae('0xd')]);router[_0x10ae('0x9')](_0x10ae('0xe'),auth[_0x10ae('0xa')](),controller[_0x10ae('0xf')]);router[_0x10ae('0x9')](_0x10ae('0x10'),auth[_0x10ae('0xa')](),controller[_0x10ae('0x11')]);router[_0x10ae('0x12')]('/',auth[_0x10ae('0xa')](),controller[_0x10ae('0x13')]);router['post'](_0x10ae('0xe'),auth[_0x10ae('0xa')](),controller[_0x10ae('0x14')]);router[_0x10ae('0x15')](_0x10ae('0xc'),auth[_0x10ae('0xa')](),controller[_0x10ae('0x16')]);router[_0x10ae('0x17')](_0x10ae('0xc'),auth[_0x10ae('0xa')](),controller[_0x10ae('0x18')]);module[_0x10ae('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d0e8587..c43b5d0 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.attributes.js +++ b/server/api/intZendeskAccount/intZendeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d72=['username','remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x2d72,0xa8));var _0x22d7=function(_0x4a7944,_0x4aae67){_0x4a7944=_0x4a7944-0x0;var _0x279c1e=_0x2d72[_0x4a7944];return _0x279c1e;};'use strict';var Sequelize=require(_0x22d7('0x0'));module[_0x22d7('0x1')]={'name':{'type':Sequelize[_0x22d7('0x2')]},'description':{'type':Sequelize[_0x22d7('0x2')]},'username':{'type':Sequelize[_0x22d7('0x2')],'unique':_0x22d7('0x3')},'password':{'type':Sequelize[_0x22d7('0x2')]},'token':{'type':Sequelize[_0x22d7('0x2')]},'remoteUri':{'type':Sequelize[_0x22d7('0x2')],'unique':_0x22d7('0x4')},'authType':{'type':Sequelize[_0x22d7('0x5')](_0x22d7('0x6'),_0x22d7('0x7')),'defaultValue':_0x22d7('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x22d7('0x5')](_0x22d7('0x8'),'newTab'),'defaultValue':_0x22d7('0x8')}}; \ No newline at end of file +var _0x3e24=['exports','STRING','remoteUri','ENUM','password','token','newTab','integrationTab','sequelize'];(function(_0x546305,_0x3db8cf){var _0x2d8ee4=function(_0xc1622c){while(--_0xc1622c){_0x546305['push'](_0x546305['shift']());}};_0x2d8ee4(++_0x3db8cf);}(_0x3e24,0x167));var _0x43e2=function(_0x2b7ba3,_0x3eb26a){_0x2b7ba3=_0x2b7ba3-0x0;var _0x2d189f=_0x3e24[_0x2b7ba3];return _0x2d189f;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')]},'description':{'type':Sequelize[_0x43e2('0x2')]},'username':{'type':Sequelize[_0x43e2('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x43e2('0x2')]},'token':{'type':Sequelize[_0x43e2('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x43e2('0x3')},'authType':{'type':Sequelize[_0x43e2('0x4')](_0x43e2('0x5'),_0x43e2('0x6')),'defaultValue':_0x43e2('0x5')},'serverUrl':{'type':Sequelize[_0x43e2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x43e2('0x4')]('integrationTab',_0x43e2('0x7')),'defaultValue':_0x43e2('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 941f0b4..f367459 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3c=['ZendeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','getConfigurations','ZendeskConfiguration','order','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','position','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','name','send','index','map'];(function(_0x4a5a74,_0x799c9c){var _0x403213=function(_0x22ad14){while(--_0x22ad14){_0x4a5a74['push'](_0x4a5a74['shift']());}};_0x403213(++_0x799c9c);}(_0xed3c,0x1a6));var _0xced3=function(_0x16c1a5,_0x17dfb0){_0x16c1a5=_0x16c1a5-0x0;var _0x421b5e=_0xed3c[_0x16c1a5];return _0x421b5e;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];var integrations=require(_0xced3('0x16'));function respondWithStatusCode(_0x3b2ac4,_0x457caf){_0x457caf=_0x457caf||0xcc;return function(_0x45d9fc){if(_0x45d9fc){return _0x3b2ac4[_0xced3('0x17')](_0x457caf);}return _0x3b2ac4['status'](_0x457caf)[_0xced3('0x18')]();};}function respondWithResult(_0x5e186e,_0xf2db6f){_0xf2db6f=_0xf2db6f||0xc8;return function(_0x435616){if(_0x435616){return _0x5e186e[_0xced3('0x19')](_0xf2db6f)[_0xced3('0x1a')](_0x435616);}};}function respondWithFilteredResult(_0x4dd4c3,_0x146a21){return function(_0x322c2d){if(_0x322c2d){var _0x4acae6=typeof _0x146a21[_0xced3('0x1b')]===_0xced3('0x1c')&&typeof _0x146a21[_0xced3('0x1d')]===_0xced3('0x1c');var _0x55dbd5=_0x322c2d[_0xced3('0x1e')];var _0x4a3afe=_0x4acae6?0x0:_0x146a21[_0xced3('0x1b')];var _0x4480a6=_0x4acae6?_0x322c2d[_0xced3('0x1e')]:_0x146a21[_0xced3('0x1b')]+_0x146a21[_0xced3('0x1d')];var _0x688c97;if(_0x4480a6>=_0x55dbd5){_0x4480a6=_0x55dbd5;_0x688c97=0xc8;}else{_0x688c97=0xce;}_0x4dd4c3[_0xced3('0x19')](_0x688c97);return _0x4dd4c3[_0xced3('0x1f')](_0xced3('0x20'),_0x4a3afe+'-'+_0x4480a6+'/'+_0x55dbd5)[_0xced3('0x1a')](_0x322c2d);}return null;};}function patchUpdates(_0x2008f2){return function(_0x59dc83){try{jsonpatch['apply'](_0x59dc83,_0x2008f2,!![]);}catch(_0x5e8c44){return BPromise[_0xced3('0x21')](_0x5e8c44);}return _0x59dc83[_0xced3('0x22')]();};}function saveUpdates(_0x21e074,_0x4bf915){return function(_0x19d15c){if(_0x19d15c){return _0x19d15c[_0xced3('0x23')](_0x21e074)['then'](function(_0x559fa2){return _0x559fa2;});}return null;};}function removeEntity(_0x3adf14,_0x101708){return function(_0x219fa8){if(_0x219fa8){return _0x219fa8[_0xced3('0x24')]()['then'](function(){_0x3adf14[_0xced3('0x19')](0xcc)[_0xced3('0x18')]();});}};}function handleEntityNotFound(_0x4fc285,_0x3fb4f9){return function(_0x4da7ce){if(!_0x4da7ce){_0x4fc285[_0xced3('0x17')](0x194);}return _0x4da7ce;};}function handleError(_0x4123ba,_0x3b728d){_0x3b728d=_0x3b728d||0x1f4;return function(_0x23a570){logger[_0xced3('0x25')](_0x23a570['stack']);if(_0x23a570['name']){delete _0x23a570[_0xced3('0x26')];}_0x4123ba['status'](_0x3b728d)[_0xced3('0x27')](_0x23a570);};}exports[_0xced3('0x28')]=function(_0x4a8e85,_0x3db664){var _0x4024fa={},_0x196956={},_0x1032d6={'count':0x0,'rows':[]};var _0x4389f8=_[_0xced3('0x29')](db[_0xced3('0x2a')][_0xced3('0x2b')],function(_0x116cc7){return{'name':_0x116cc7['fieldName'],'type':_0x116cc7[_0xced3('0x2c')][_0xced3('0x2d')]};});_0x196956[_0xced3('0x2e')]=_[_0xced3('0x29')](_0x4389f8,_0xced3('0x26'));_0x196956[_0xced3('0x2f')]=_[_0xced3('0x30')](_0x4a8e85[_0xced3('0x2f')]);_0x196956[_0xced3('0x31')]=_[_0xced3('0x32')](_0x196956[_0xced3('0x2e')],_0x196956[_0xced3('0x2f')]);_0x4024fa[_0xced3('0x33')]=_[_0xced3('0x32')](_0x196956[_0xced3('0x2e')],qs[_0xced3('0x34')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x34')]));_0x4024fa[_0xced3('0x33')]=_0x4024fa[_0xced3('0x33')][_0xced3('0x35')]?_0x4024fa['attributes']:_0x196956[_0xced3('0x2e')];if(!_0x4a8e85['query'][_0xced3('0x36')](_0xced3('0x37'))){_0x4024fa[_0xced3('0x1d')]=qs[_0xced3('0x1d')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x1d')]);_0x4024fa[_0xced3('0x1b')]=qs[_0xced3('0x1b')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x1b')]);}_0x4024fa['order']=qs[_0xced3('0x38')](_0x4a8e85[_0xced3('0x2f')]['sort']);_0x4024fa[_0xced3('0x39')]=qs[_0xced3('0x31')](_[_0xced3('0x3a')](_0x4a8e85['query'],_0x196956['filters']),_0x4389f8);if(_0x4a8e85[_0xced3('0x2f')]['filter']){_0x4024fa[_0xced3('0x39')]=_[_0xced3('0x3b')](_0x4024fa['where'],{'$or':_[_0xced3('0x29')](_0x4389f8,function(_0x15ca03){if(_0x15ca03[_0xced3('0x2c')]!=='VIRTUAL'){var _0x21c0fa={};_0x21c0fa[_0x15ca03['name']]={'$like':'%'+_0x4a8e85['query'][_0xced3('0x3c')]+'%'};return _0x21c0fa;}})});}_0x4024fa=_[_0xced3('0x3b')]({},_0x4024fa,_0x4a8e85[_0xced3('0x3d')]);var _0x4e6926={'where':_0x4024fa[_0xced3('0x39')]};return db[_0xced3('0x2a')][_0xced3('0x1e')](_0x4e6926)[_0xced3('0x3e')](function(_0x28506e){_0x1032d6[_0xced3('0x1e')]=_0x28506e;if(_0x4a8e85[_0xced3('0x2f')][_0xced3('0x3f')]){_0x4024fa[_0xced3('0x40')]=[{'all':!![]}];}return db[_0xced3('0x2a')][_0xced3('0x41')](_0x4024fa);})[_0xced3('0x3e')](function(_0x16b2c7){_0x1032d6[_0xced3('0x42')]=_0x16b2c7;return _0x1032d6;})[_0xced3('0x3e')](respondWithFilteredResult(_0x3db664,_0x4024fa))['catch'](handleError(_0x3db664,null));};exports[_0xced3('0x43')]=function(_0x2ec0ad,_0x44ff72){var _0x1a6c1f={'raw':![],'where':{'id':_0x2ec0ad[_0xced3('0x44')]['id']}},_0x1de086={};_0x1de086[_0xced3('0x2e')]=_[_0xced3('0x30')](db[_0xced3('0x2a')]['rawAttributes']);_0x1de086[_0xced3('0x2f')]=_['keys'](_0x2ec0ad[_0xced3('0x2f')]);_0x1de086[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1de086['model'],_0x1de086[_0xced3('0x2f')]);_0x1a6c1f[_0xced3('0x33')]=_[_0xced3('0x32')](_0x1de086[_0xced3('0x2e')],qs['fields'](_0x2ec0ad[_0xced3('0x2f')][_0xced3('0x34')]));_0x1a6c1f[_0xced3('0x33')]=_0x1a6c1f[_0xced3('0x33')][_0xced3('0x35')]?_0x1a6c1f['attributes']:_0x1de086[_0xced3('0x2e')];if(_0x2ec0ad[_0xced3('0x2f')][_0xced3('0x3f')]){_0x1a6c1f[_0xced3('0x40')]=[{'all':!![]}];}_0x1a6c1f=_[_0xced3('0x3b')]({},_0x1a6c1f,_0x2ec0ad[_0xced3('0x3d')]);return db[_0xced3('0x2a')]['find'](_0x1a6c1f)[_0xced3('0x3e')](handleEntityNotFound(_0x44ff72,null))[_0xced3('0x3e')](respondWithResult(_0x44ff72,null))['catch'](handleError(_0x44ff72,null));};exports['create']=function(_0x140df2,_0x59b586){return db[_0xced3('0x2a')][_0xced3('0x45')](_0x140df2[_0xced3('0x46')],{})[_0xced3('0x3e')](respondWithResult(_0x59b586,0xc9))[_0xced3('0x47')](handleError(_0x59b586,null));};exports[_0xced3('0x23')]=function(_0x3700ed,_0x10cc6c){if(_0x3700ed[_0xced3('0x46')]['id']){delete _0x3700ed['body']['id'];}return db[_0xced3('0x2a')][_0xced3('0x48')]({'where':{'id':_0x3700ed[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x10cc6c,null))[_0xced3('0x3e')](saveUpdates(_0x3700ed[_0xced3('0x46')],null))['then'](respondWithResult(_0x10cc6c,null))[_0xced3('0x47')](handleError(_0x10cc6c,null));};exports[_0xced3('0x24')]=function(_0x74f70,_0x409da0){return db[_0xced3('0x2a')][_0xced3('0x48')]({'where':{'id':_0x74f70[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x409da0,null))[_0xced3('0x3e')](removeEntity(_0x409da0,null))[_0xced3('0x47')](handleError(_0x409da0,null));};exports[_0xced3('0x49')]=function(_0x3e2a19,_0x4a9111,_0x1c69df){var _0x4bd3cb={};var _0x466ffb={};var _0x27ce0b;var _0xc93e05;return db['ZendeskAccount']['findOne']({'where':{'id':_0x3e2a19[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x4a9111,null))['then'](function(_0x3f41cc){if(_0x3f41cc){_0x27ce0b=_0x3f41cc;_0x466ffb['model']=_[_0xced3('0x30')](db[_0xced3('0x4a')]['rawAttributes']);_0x466ffb[_0xced3('0x2f')]=_[_0xced3('0x30')](_0x3e2a19[_0xced3('0x2f')]);_0x466ffb['filters']=_[_0xced3('0x32')](_0x466ffb['model'],_0x466ffb[_0xced3('0x2f')]);_0x4bd3cb[_0xced3('0x33')]=_[_0xced3('0x32')](_0x466ffb[_0xced3('0x2e')],qs[_0xced3('0x34')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x34')]));_0x4bd3cb[_0xced3('0x33')]=_0x4bd3cb[_0xced3('0x33')][_0xced3('0x35')]?_0x4bd3cb[_0xced3('0x33')]:_0x466ffb['model'];_0x4bd3cb[_0xced3('0x4b')]=qs[_0xced3('0x38')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x38')]);_0x4bd3cb[_0xced3('0x39')]=qs[_0xced3('0x31')](_['pick'](_0x3e2a19[_0xced3('0x2f')],_0x466ffb[_0xced3('0x31')]));if(_0x3e2a19[_0xced3('0x2f')][_0xced3('0x3c')]){_0x4bd3cb[_0xced3('0x39')]=_[_0xced3('0x3b')](_0x4bd3cb['where'],{'$or':_[_0xced3('0x29')](_0x4bd3cb['attributes'],function(_0xc0cd87){var _0x5d9813={};_0x5d9813[_0xc0cd87]={'$like':'%'+_0x3e2a19[_0xced3('0x2f')][_0xced3('0x3c')]+'%'};return _0x5d9813;})});}_0x4bd3cb=_['merge']({},_0x4bd3cb,_0x3e2a19[_0xced3('0x3d')]);return _0x27ce0b[_0xced3('0x49')](_0x4bd3cb);}})[_0xced3('0x3e')](function(_0x3bb7d5){if(_0x3bb7d5){_0xc93e05=_0x3bb7d5[_0xced3('0x35')];if(!_0x3e2a19[_0xced3('0x2f')][_0xced3('0x36')](_0xced3('0x37'))){_0x4bd3cb[_0xced3('0x1d')]=qs[_0xced3('0x1d')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x1d')]);_0x4bd3cb[_0xced3('0x1b')]=qs['offset'](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x1b')]);}return _0x27ce0b[_0xced3('0x49')](_0x4bd3cb);}})[_0xced3('0x3e')](function(_0x4f8a3f){if(_0x4f8a3f){return _0x4f8a3f?{'count':_0xc93e05,'rows':_0x4f8a3f}:null;}})[_0xced3('0x3e')](respondWithResult(_0x4a9111,null))[_0xced3('0x47')](handleError(_0x4a9111,null));};exports[_0xced3('0x4c')]=function(_0x373f31,_0x2a62f5,_0x13643c){if(_0x373f31[_0xced3('0x46')]['id']){delete _0x373f31['body']['id'];}return db[_0xced3('0x2a')][_0xced3('0x4d')]({'where':{'id':_0x373f31['params']['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x2a62f5,null))[_0xced3('0x3e')](function(_0x3a9dac){if(_0x3a9dac){_0x373f31[_0xced3('0x46')]['AccountId']=_0x3a9dac['id'];_0x373f31[_0xced3('0x46')][_0xced3('0x4e')]=integrations[_0xced3('0x4f')](_0x373f31[_0xced3('0x46')][_0xced3('0x50')],_0x373f31[_0xced3('0x46')][_0xced3('0x2c')]);_0x373f31[_0xced3('0x46')][_0xced3('0x51')]=integrations[_0xced3('0x52')](_0x373f31['body'][_0xced3('0x50')],_0x373f31[_0xced3('0x46')]['type']);return db['ZendeskConfiguration'][_0xced3('0x45')](_0x373f31['body'],{'include':[{'model':db[_0xced3('0x53')],'as':_0xced3('0x4e')},{'model':db['ZendeskField'],'as':_0xced3('0x51')}]});}return null;})[_0xced3('0x3e')](respondWithResult(_0x2a62f5,null))['catch'](handleError(_0x2a62f5,null));};exports[_0xced3('0x54')]=function(_0x52ab35,_0x39eead,_0x58b66b){var _0xf8ccc6='';return db[_0xced3('0x2a')][_0xced3('0x4d')]({'where':{'id':_0x52ab35['params']['id']},'attributes':['id',_0xced3('0x55'),_0xced3('0x56'),_0xced3('0x57'),'authType',_0xced3('0x58')]})[_0xced3('0x3e')](handleEntityNotFound(_0x39eead,null))[_0xced3('0x3e')](function(_0x227ec5){if(_0x227ec5){_0xf8ccc6=_0x227ec5['remoteUri'];var _0x4a1624=_0xf8ccc6[_0xced3('0x59')](-0x1);if(_0x4a1624==='/'){_0xf8ccc6=_0xf8ccc6[_0xced3('0x5a')](0x0,_0xf8ccc6[_0xced3('0x5b')](_0x4a1624));}var _0xcddb37={'method':_0xced3('0x5c'),'uri':util[_0xced3('0x5d')]('%s/%s',_0xf8ccc6,_0xced3('0x5e')),'json':!![]};switch(_0x227ec5['authType']){case _0xced3('0x56'):_0xcddb37[_0xced3('0x5f')]={'Authorization':util[_0xced3('0x5d')](_0xced3('0x60'),new Buffer(util['format'](_0xced3('0x61'),_0x227ec5[_0xced3('0x55')],_0x227ec5['password']))['toString'](_0xced3('0x62')))};break;case _0xced3('0x57'):_0xcddb37[_0xced3('0x5f')]={'Authorization':util[_0xced3('0x5d')](_0xced3('0x60'),new Buffer(util['format'](_0xced3('0x63'),_0x227ec5[_0xced3('0x55')],_0x227ec5[_0xced3('0x57')]))[_0xced3('0x64')]('base64'))};break;default:throw new db[(_0xced3('0x65'))][(_0xced3('0x66'))](_0xced3('0x67'));}return rp(_0xcddb37);}})[_0xced3('0x3e')](function(_0x9183af){if(_0x9183af){var _0x275c7e=[_0xced3('0x68'),_0xced3('0x69'),_0xced3('0x6a'),_0xced3('0x6b')];_['remove'](_0x9183af[_0xced3('0x5e')],function(_0x1e7ff1){return _0x275c7e['includes'](_0x1e7ff1[_0xced3('0x2c')]);});return{'count':_0x9183af[_0xced3('0x5e')][_0xced3('0x35')],'rows':_[_0xced3('0x29')](_0x9183af[_0xced3('0x5e')],function(_0x5c2302){return{'id':_0x5c2302['id'],'name':_0x5c2302[_0xced3('0x6c')]>0x7?_0x5c2302[_0xced3('0x6d')]:_0x5c2302['type'],'custom':_0x5c2302[_0xced3('0x6c')]>0x7?!![]:![],'options':_0x5c2302[_0xced3('0x6e')]?_0x5c2302[_0xced3('0x6e')]:_0x5c2302[_0xced3('0x6f')]?_0x5c2302[_0xced3('0x6f')]:[]};})};}})[_0xced3('0x3e')](respondWithResult(_0x39eead,null))['catch'](function(_0x2d9a57){var _0x3d2547=_0x52ab35[_0xced3('0x2f')][_0xced3('0x70')]?0x1f4:_0x2d9a57[_0xced3('0x71')]||0x1f4;logger[_0xced3('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3d2547,JSON[_0xced3('0x72')](_0x2d9a57));delete _0x2d9a57[_0xced3('0x26')];if(_0x3d2547===0x191){_0x3d2547=0x190;}_0x39eead[_0xced3('0x19')](_0x3d2547)[_0xced3('0x27')](_0x52ab35[_0xced3('0x2f')][_0xced3('0x70')]?{'message':_0xced3('0x73'),'statusCode':_0x2d9a57['statusCode']}:_0x2d9a57);});}; \ No newline at end of file +var _0xf45e=['merge','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','GET','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','send','index','ZendeskAccount','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','fields','find','create','body','update','params','getConfigurations','findOne','ZendeskConfiguration','pick'];(function(_0x3961b2,_0x4c0da4){var _0x1f9ea0=function(_0x3bb691){while(--_0x3bb691){_0x3961b2['push'](_0x3961b2['shift']());}};_0x1f9ea0(++_0x4c0da4);}(_0xf45e,0x115));var _0xef45=function(_0x5393a6,_0x3c972d){_0x5393a6=_0x5393a6-0x0;var _0x477463=_0xf45e[_0x5393a6];return _0x477463;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];var integrations=require(_0xef45('0x1c'));function respondWithStatusCode(_0x433be9,_0x476739){_0x476739=_0x476739||0xcc;return function(_0x4a6e5c){if(_0x4a6e5c){return _0x433be9['sendStatus'](_0x476739);}return _0x433be9[_0xef45('0x1d')](_0x476739)['end']();};}function respondWithResult(_0x2ae89a,_0xb0fc43){_0xb0fc43=_0xb0fc43||0xc8;return function(_0x37c207){if(_0x37c207){return _0x2ae89a['status'](_0xb0fc43)['json'](_0x37c207);}};}function respondWithFilteredResult(_0x29c0c4,_0x5530e6){return function(_0x11cd3a){if(_0x11cd3a){var _0x2a342e=typeof _0x5530e6[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x5530e6['limit']==='undefined';var _0x45ee70=_0x11cd3a[_0xef45('0x20')];var _0x3ba1f4=_0x2a342e?0x0:_0x5530e6[_0xef45('0x1e')];var _0x4ca902=_0x2a342e?_0x11cd3a['count']:_0x5530e6[_0xef45('0x1e')]+_0x5530e6[_0xef45('0x21')];var _0xba941b;if(_0x4ca902>=_0x45ee70){_0x4ca902=_0x45ee70;_0xba941b=0xc8;}else{_0xba941b=0xce;}_0x29c0c4[_0xef45('0x1d')](_0xba941b);return _0x29c0c4[_0xef45('0x22')](_0xef45('0x23'),_0x3ba1f4+'-'+_0x4ca902+'/'+_0x45ee70)[_0xef45('0x24')](_0x11cd3a);}return null;};}function patchUpdates(_0x4a6217){return function(_0x11f1b0){try{jsonpatch[_0xef45('0x25')](_0x11f1b0,_0x4a6217,!![]);}catch(_0x449004){return BPromise[_0xef45('0x26')](_0x449004);}return _0x11f1b0[_0xef45('0x27')]();};}function saveUpdates(_0x5205bf,_0x40abc8){return function(_0x54a75d){if(_0x54a75d){return _0x54a75d['update'](_0x5205bf)[_0xef45('0x28')](function(_0x2b41d8){return _0x2b41d8;});}return null;};}function removeEntity(_0xbb859b,_0x7817d0){return function(_0x839eff){if(_0x839eff){return _0x839eff[_0xef45('0x29')]()[_0xef45('0x28')](function(){_0xbb859b['status'](0xcc)[_0xef45('0x2a')]();});}};}function handleEntityNotFound(_0x5f0593,_0x38b470){return function(_0xdbb42d){if(!_0xdbb42d){_0x5f0593['sendStatus'](0x194);}return _0xdbb42d;};}function handleError(_0x46e423,_0x2c356d){_0x2c356d=_0x2c356d||0x1f4;return function(_0x479e3c){logger[_0xef45('0x2b')](_0x479e3c['stack']);if(_0x479e3c['name']){delete _0x479e3c['name'];}_0x46e423['status'](_0x2c356d)[_0xef45('0x2c')](_0x479e3c);};}exports[_0xef45('0x2d')]=function(_0x217e8d,_0x15ad38){var _0x5782d0={},_0x18f304={},_0x4f028c={'count':0x0,'rows':[]};var _0x2525da=_['map'](db[_0xef45('0x2e')]['rawAttributes'],function(_0x575734){return{'name':_0x575734[_0xef45('0x2f')],'type':_0x575734[_0xef45('0x30')][_0xef45('0x31')]};});_0x18f304[_0xef45('0x32')]=_[_0xef45('0x33')](_0x2525da,'name');_0x18f304['query']=_['keys'](_0x217e8d[_0xef45('0x34')]);_0x18f304[_0xef45('0x35')]=_[_0xef45('0x36')](_0x18f304[_0xef45('0x32')],_0x18f304[_0xef45('0x34')]);_0x5782d0[_0xef45('0x37')]=_[_0xef45('0x36')](_0x18f304['model'],qs['fields'](_0x217e8d[_0xef45('0x34')]['fields']));_0x5782d0[_0xef45('0x37')]=_0x5782d0['attributes'][_0xef45('0x38')]?_0x5782d0[_0xef45('0x37')]:_0x18f304[_0xef45('0x32')];if(!_0x217e8d[_0xef45('0x34')][_0xef45('0x39')]('nolimit')){_0x5782d0[_0xef45('0x21')]=qs[_0xef45('0x21')](_0x217e8d[_0xef45('0x34')]['limit']);_0x5782d0['offset']=qs[_0xef45('0x1e')](_0x217e8d[_0xef45('0x34')]['offset']);}_0x5782d0[_0xef45('0x3a')]=qs['sort'](_0x217e8d['query'][_0xef45('0x3b')]);_0x5782d0[_0xef45('0x3c')]=qs[_0xef45('0x35')](_['pick'](_0x217e8d[_0xef45('0x34')],_0x18f304[_0xef45('0x35')]),_0x2525da);if(_0x217e8d[_0xef45('0x34')][_0xef45('0x3d')]){_0x5782d0['where']=_['merge'](_0x5782d0[_0xef45('0x3c')],{'$or':_[_0xef45('0x33')](_0x2525da,function(_0x11fd0b){if(_0x11fd0b[_0xef45('0x30')]!==_0xef45('0x3e')){var _0x309ba2={};_0x309ba2[_0x11fd0b[_0xef45('0x3f')]]={'$like':'%'+_0x217e8d[_0xef45('0x34')]['filter']+'%'};return _0x309ba2;}})});}_0x5782d0=_['merge']({},_0x5782d0,_0x217e8d[_0xef45('0x40')]);var _0x35d014={'where':_0x5782d0[_0xef45('0x3c')]};return db[_0xef45('0x2e')][_0xef45('0x20')](_0x35d014)[_0xef45('0x28')](function(_0x17c156){_0x4f028c[_0xef45('0x20')]=_0x17c156;if(_0x217e8d[_0xef45('0x34')][_0xef45('0x41')]){_0x5782d0[_0xef45('0x42')]=[{'all':!![]}];}return db[_0xef45('0x2e')][_0xef45('0x43')](_0x5782d0);})[_0xef45('0x28')](function(_0x311497){_0x4f028c[_0xef45('0x44')]=_0x311497;return _0x4f028c;})['then'](respondWithFilteredResult(_0x15ad38,_0x5782d0))[_0xef45('0x45')](handleError(_0x15ad38,null));};exports[_0xef45('0x46')]=function(_0x1b9d45,_0x82c123){var _0x54ccb8={'raw':![],'where':{'id':_0x1b9d45['params']['id']}},_0x4659c8={};_0x4659c8[_0xef45('0x32')]=_['keys'](db[_0xef45('0x2e')][_0xef45('0x47')]);_0x4659c8[_0xef45('0x34')]=_[_0xef45('0x48')](_0x1b9d45[_0xef45('0x34')]);_0x4659c8[_0xef45('0x35')]=_[_0xef45('0x36')](_0x4659c8['model'],_0x4659c8[_0xef45('0x34')]);_0x54ccb8[_0xef45('0x37')]=_[_0xef45('0x36')](_0x4659c8[_0xef45('0x32')],qs[_0xef45('0x49')](_0x1b9d45[_0xef45('0x34')][_0xef45('0x49')]));_0x54ccb8[_0xef45('0x37')]=_0x54ccb8[_0xef45('0x37')][_0xef45('0x38')]?_0x54ccb8[_0xef45('0x37')]:_0x4659c8[_0xef45('0x32')];if(_0x1b9d45[_0xef45('0x34')][_0xef45('0x41')]){_0x54ccb8[_0xef45('0x42')]=[{'all':!![]}];}_0x54ccb8=_['merge']({},_0x54ccb8,_0x1b9d45[_0xef45('0x40')]);return db[_0xef45('0x2e')][_0xef45('0x4a')](_0x54ccb8)['then'](handleEntityNotFound(_0x82c123,null))['then'](respondWithResult(_0x82c123,null))['catch'](handleError(_0x82c123,null));};exports[_0xef45('0x4b')]=function(_0x18143c,_0x12c74c){return db[_0xef45('0x2e')][_0xef45('0x4b')](_0x18143c[_0xef45('0x4c')],{})['then'](respondWithResult(_0x12c74c,0xc9))[_0xef45('0x45')](handleError(_0x12c74c,null));};exports[_0xef45('0x4d')]=function(_0x2b2419,_0x577d0c){if(_0x2b2419['body']['id']){delete _0x2b2419[_0xef45('0x4c')]['id'];}return db[_0xef45('0x2e')]['find']({'where':{'id':_0x2b2419[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x577d0c,null))[_0xef45('0x28')](saveUpdates(_0x2b2419[_0xef45('0x4c')],null))[_0xef45('0x28')](respondWithResult(_0x577d0c,null))[_0xef45('0x45')](handleError(_0x577d0c,null));};exports[_0xef45('0x29')]=function(_0xfa5fdd,_0x1961b4){return db[_0xef45('0x2e')][_0xef45('0x4a')]({'where':{'id':_0xfa5fdd[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x1961b4,null))[_0xef45('0x28')](removeEntity(_0x1961b4,null))['catch'](handleError(_0x1961b4,null));};exports[_0xef45('0x4f')]=function(_0x24aceb,_0x1910d3,_0x509626){var _0x416236={};var _0x3f9b9a={};var _0x464bda;var _0x1531ea;return db['ZendeskAccount'][_0xef45('0x50')]({'where':{'id':_0x24aceb[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x1910d3,null))[_0xef45('0x28')](function(_0x67d57b){if(_0x67d57b){_0x464bda=_0x67d57b;_0x3f9b9a[_0xef45('0x32')]=_[_0xef45('0x48')](db[_0xef45('0x51')][_0xef45('0x47')]);_0x3f9b9a[_0xef45('0x34')]=_[_0xef45('0x48')](_0x24aceb[_0xef45('0x34')]);_0x3f9b9a['filters']=_[_0xef45('0x36')](_0x3f9b9a[_0xef45('0x32')],_0x3f9b9a[_0xef45('0x34')]);_0x416236[_0xef45('0x37')]=_[_0xef45('0x36')](_0x3f9b9a[_0xef45('0x32')],qs['fields'](_0x24aceb['query'][_0xef45('0x49')]));_0x416236['attributes']=_0x416236[_0xef45('0x37')][_0xef45('0x38')]?_0x416236[_0xef45('0x37')]:_0x3f9b9a['model'];_0x416236[_0xef45('0x3a')]=qs[_0xef45('0x3b')](_0x24aceb['query'][_0xef45('0x3b')]);_0x416236['where']=qs['filters'](_[_0xef45('0x52')](_0x24aceb[_0xef45('0x34')],_0x3f9b9a[_0xef45('0x35')]));if(_0x24aceb[_0xef45('0x34')][_0xef45('0x3d')]){_0x416236['where']=_[_0xef45('0x53')](_0x416236[_0xef45('0x3c')],{'$or':_['map'](_0x416236[_0xef45('0x37')],function(_0x107cf3){var _0x3aa8ec={};_0x3aa8ec[_0x107cf3]={'$like':'%'+_0x24aceb[_0xef45('0x34')][_0xef45('0x3d')]+'%'};return _0x3aa8ec;})});}_0x416236=_[_0xef45('0x53')]({},_0x416236,_0x24aceb[_0xef45('0x40')]);return _0x464bda[_0xef45('0x4f')](_0x416236);}})['then'](function(_0x3be1b4){if(_0x3be1b4){_0x1531ea=_0x3be1b4['length'];if(!_0x24aceb['query'][_0xef45('0x39')]('nolimit')){_0x416236[_0xef45('0x21')]=qs[_0xef45('0x21')](_0x24aceb['query'][_0xef45('0x21')]);_0x416236[_0xef45('0x1e')]=qs[_0xef45('0x1e')](_0x24aceb[_0xef45('0x34')][_0xef45('0x1e')]);}return _0x464bda[_0xef45('0x4f')](_0x416236);}})['then'](function(_0x3a7cf2){if(_0x3a7cf2){return _0x3a7cf2?{'count':_0x1531ea,'rows':_0x3a7cf2}:null;}})[_0xef45('0x28')](respondWithResult(_0x1910d3,null))[_0xef45('0x45')](handleError(_0x1910d3,null));};exports[_0xef45('0x54')]=function(_0x1d8c97,_0x51f841,_0x2a7857){if(_0x1d8c97['body']['id']){delete _0x1d8c97[_0xef45('0x4c')]['id'];}return db[_0xef45('0x2e')]['findOne']({'where':{'id':_0x1d8c97[_0xef45('0x4e')]['id']}})[_0xef45('0x28')](handleEntityNotFound(_0x51f841,null))[_0xef45('0x28')](function(_0x49a4ef){if(_0x49a4ef){_0x1d8c97['body'][_0xef45('0x55')]=_0x49a4ef['id'];_0x1d8c97[_0xef45('0x4c')][_0xef45('0x56')]=integrations['getSubjects'](_0x1d8c97[_0xef45('0x4c')][_0xef45('0x57')],_0x1d8c97['body'][_0xef45('0x30')]);_0x1d8c97['body'][_0xef45('0x58')]=integrations[_0xef45('0x59')](_0x1d8c97[_0xef45('0x4c')][_0xef45('0x57')],_0x1d8c97[_0xef45('0x4c')][_0xef45('0x30')]);return db[_0xef45('0x51')][_0xef45('0x4b')](_0x1d8c97['body'],{'include':[{'model':db[_0xef45('0x5a')],'as':_0xef45('0x56')},{'model':db[_0xef45('0x5a')],'as':_0xef45('0x58')}]});}return null;})[_0xef45('0x28')](respondWithResult(_0x51f841,null))[_0xef45('0x45')](handleError(_0x51f841,null));};exports[_0xef45('0x5b')]=function(_0x14ae27,_0x444d39,_0x41952f){var _0xbf9898='';return db['ZendeskAccount'][_0xef45('0x50')]({'where':{'id':_0x14ae27[_0xef45('0x4e')]['id']},'attributes':['id',_0xef45('0x5c'),_0xef45('0x5d'),_0xef45('0x5e'),'authType',_0xef45('0x5f')]})[_0xef45('0x28')](handleEntityNotFound(_0x444d39,null))['then'](function(_0x4ad1b8){if(_0x4ad1b8){_0xbf9898=_0x4ad1b8[_0xef45('0x5f')];var _0x37cd3f=_0xbf9898['slice'](-0x1);if(_0x37cd3f==='/'){_0xbf9898=_0xbf9898['substring'](0x0,_0xbf9898['lastIndexOf'](_0x37cd3f));}var _0x6b7e57={'method':_0xef45('0x60'),'uri':util['format']('%s/%s',_0xbf9898,_0xef45('0x61')),'json':!![]};switch(_0x4ad1b8['authType']){case _0xef45('0x5d'):_0x6b7e57[_0xef45('0x62')]={'Authorization':util[_0xef45('0x63')](_0xef45('0x64'),new Buffer(util[_0xef45('0x63')](_0xef45('0x65'),_0x4ad1b8[_0xef45('0x5c')],_0x4ad1b8['password']))[_0xef45('0x66')](_0xef45('0x67')))};break;case _0xef45('0x5e'):_0x6b7e57[_0xef45('0x62')]={'Authorization':util[_0xef45('0x63')](_0xef45('0x64'),new Buffer(util['format']('%s/token:%s',_0x4ad1b8[_0xef45('0x5c')],_0x4ad1b8[_0xef45('0x5e')]))[_0xef45('0x66')](_0xef45('0x67')))};break;default:throw new db[(_0xef45('0x68'))][(_0xef45('0x69'))](_0xef45('0x6a'));}return rp(_0x6b7e57);}})[_0xef45('0x28')](function(_0x53b36e){if(_0x53b36e){var _0x31b0a3=[_0xef45('0x6b'),_0xef45('0x6c'),_0xef45('0x6d'),_0xef45('0x6e')];_[_0xef45('0x6f')](_0x53b36e[_0xef45('0x61')],function(_0x5ece80){return _0x31b0a3[_0xef45('0x70')](_0x5ece80['type']);});return{'count':_0x53b36e[_0xef45('0x61')][_0xef45('0x38')],'rows':_['map'](_0x53b36e[_0xef45('0x61')],function(_0x1bc3c1){return{'id':_0x1bc3c1['id'],'name':_0x1bc3c1[_0xef45('0x71')]>0x7?_0x1bc3c1['title']:_0x1bc3c1[_0xef45('0x30')],'custom':_0x1bc3c1['position']>0x7?!![]:![],'options':_0x1bc3c1[_0xef45('0x72')]?_0x1bc3c1[_0xef45('0x72')]:_0x1bc3c1[_0xef45('0x73')]?_0x1bc3c1[_0xef45('0x73')]:[]};})};}})['then'](respondWithResult(_0x444d39,null))[_0xef45('0x45')](function(_0x32034a){var _0xcdcc33=_0x14ae27['query'][_0xef45('0x74')]?0x1f4:_0x32034a[_0xef45('0x75')]||0x1f4;logger[_0xef45('0x2b')](_0xef45('0x76'),_0xef45('0x5b'),_0xcdcc33,JSON['stringify'](_0x32034a));delete _0x32034a[_0xef45('0x3f')];if(_0xcdcc33===0x191){_0xcdcc33=0x190;}_0x444d39[_0xef45('0x1d')](_0xcdcc33)[_0xef45('0x2c')](_0x14ae27[_0xef45('0x34')][_0xef45('0x74')]?{'message':_0xef45('0x77'),'statusCode':_0x32034a[_0xef45('0x75')]}:_0x32034a);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5f4756a..259b4a9 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.model.js +++ b/server/api/intZendeskAccount/intZendeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef82=['request-promise','path','rimraf','./intZendeskAccount.attributes','define','int_zendesk_accounts','api','bluebird'];(function(_0x58f401,_0x1136c9){var _0x146e3d=function(_0x249501){while(--_0x249501){_0x58f401['push'](_0x58f401['shift']());}};_0x146e3d(++_0x1136c9);}(_0xef82,0x19e));var _0x2ef8=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xef82[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2ef8('0x0'));var moment=require('moment');var BPromise=require(_0x2ef8('0x1'));var rp=require(_0x2ef8('0x2'));var fs=require('fs');var path=require(_0x2ef8('0x3'));var rimraf=require(_0x2ef8('0x4'));var config=require('../../config/environment');var attributes=require(_0x2ef8('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd71bf2,_0x41e5c6){return _0xd71bf2[_0x2ef8('0x6')]('ZendeskAccount',attributes,{'tableName':_0x2ef8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x171f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x171f,0x9b));var _0xf171=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x171f[_0x1627ae];return _0x34b38f;};'use strict';var _=require(_0xf171('0x0'));var util=require(_0xf171('0x1'));var logger=require('../../config/logger')(_0xf171('0x2'));var moment=require(_0xf171('0x3'));var BPromise=require(_0xf171('0x4'));var rp=require(_0xf171('0x5'));var fs=require('fs');var path=require(_0xf171('0x6'));var rimraf=require(_0xf171('0x7'));var config=require(_0xf171('0x8'));var attributes=require(_0xf171('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x34aae9,_0x4f6151){return _0x34aae9[_0xf171('0xa')](_0xf171('0xb'),attributes,{'tableName':_0xf171('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index d16aad2..b24601f 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e89=['raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowZendeskAccount','find'];(function(_0x3249c3,_0x195796){var _0x43ba51=function(_0x4fb7e8){while(--_0x4fb7e8){_0x3249c3['push'](_0x3249c3['shift']());}};_0x43ba51(++_0x195796);}(_0x1e89,0x119));var _0x91e8=function(_0x584ed9,_0x4a71c8){_0x584ed9=_0x584ed9-0x0;var _0x4965fb=_0x1e89[_0x584ed9];return _0x4965fb;};'use strict';var _=require(_0x91e8('0x0'));var util=require(_0x91e8('0x1'));var moment=require('moment');var BPromise=require(_0x91e8('0x2'));var rs=require(_0x91e8('0x3'));var fs=require('fs');var Redis=require(_0x91e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91e8('0x5'));var logger=require('../../config/logger')(_0x91e8('0x6'));var config=require(_0x91e8('0x7'));var jayson=require(_0x91e8('0x8'));var client=jayson['client'][_0x91e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebbb,_0xad751f,_0x4d843f){return new BPromise(function(_0x32ebc8,_0x705c14){return client[_0x91e8('0xa')](_0x3ebbb,_0x4d843f)['then'](function(_0x4b74cf){logger['info'](_0x91e8('0xb'),_0xad751f,_0x91e8('0xc'));logger[_0x91e8('0xd')](_0x91e8('0xe'),_0xad751f,'request\x20sent',JSON[_0x91e8('0xf')](_0x4b74cf));if(_0x4b74cf[_0x91e8('0x10')]){if(_0x4b74cf[_0x91e8('0x10')]['code']===0x1f4){logger[_0x91e8('0x10')](_0x91e8('0xb'),_0xad751f,_0x4b74cf[_0x91e8('0x10')][_0x91e8('0x11')]);return _0x705c14(_0x4b74cf[_0x91e8('0x10')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0xad751f,_0x4b74cf['error'][_0x91e8('0x11')]);return _0x32ebc8(_0x4b74cf['error'][_0x91e8('0x11')]);}else{logger[_0x91e8('0x12')](_0x91e8('0xb'),_0xad751f,_0x91e8('0xc'));_0x32ebc8(_0x4b74cf[_0x91e8('0x13')][_0x91e8('0x11')]);}})[_0x91e8('0x14')](function(_0x30ab75){logger[_0x91e8('0x10')](_0x91e8('0xb'),_0xad751f,_0x30ab75);_0x705c14(_0x30ab75);});});}exports[_0x91e8('0x15')]=function(_0x5c6730){var _0x4064c1=this;return new Promise(function(_0x5b17cc,_0x53adcb){return db[_0x91e8('0x16')][_0x91e8('0x17')]({'raw':_0x5c6730[_0x91e8('0x18')]?_0x5c6730[_0x91e8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5c6730[_0x91e8('0x18')]?_0x5c6730[_0x91e8('0x18')][_0x91e8('0x19')]||null:null,'attributes':_0x5c6730[_0x91e8('0x18')]?_0x5c6730[_0x91e8('0x18')][_0x91e8('0x1a')]||null:null,'limit':_0x5c6730[_0x91e8('0x18')]?_0x5c6730[_0x91e8('0x18')][_0x91e8('0x1b')]||null:null,'include':_0x5c6730[_0x91e8('0x18')]?_0x5c6730[_0x91e8('0x18')][_0x91e8('0x1c')]?_[_0x91e8('0x1d')](_0x5c6730[_0x91e8('0x18')][_0x91e8('0x1c')],function(_0x1e7a61){return{'model':db[_0x1e7a61[_0x91e8('0x1e')]],'as':_0x1e7a61['as'],'attributes':_0x1e7a61[_0x91e8('0x1a')],'include':_0x1e7a61[_0x91e8('0x1c')]?_[_0x91e8('0x1d')](_0x1e7a61[_0x91e8('0x1c')],function(_0x4751b8){return{'model':db[_0x4751b8[_0x91e8('0x1e')]],'as':_0x4751b8['as'],'attributes':_0x4751b8['attributes'],'include':_0x4751b8[_0x91e8('0x1c')]?_[_0x91e8('0x1d')](_0x4751b8['include'],function(_0x13325d){return{'model':db[_0x13325d['model']],'as':_0x13325d['as'],'attributes':_0x13325d[_0x91e8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x91e8('0x1f')](function(_0x1ecdcc){logger[_0x91e8('0x12')](_0x91e8('0x15'),_0x5c6730);logger['debug'](_0x91e8('0x15'),_0x5c6730,JSON['stringify'](_0x1ecdcc));_0x5b17cc(_0x1ecdcc);})[_0x91e8('0x14')](function(_0x3ad962){logger['error'](_0x91e8('0x15'),_0x3ad962[_0x91e8('0x11')],_0x5c6730);_0x53adcb(_0x4064c1[_0x91e8('0x10')](0x1f4,_0x3ad962['message']));});});};exports[_0x91e8('0x20')]=function(_0x315d03){var _0x11220f=this;return new Promise(function(_0x2aa294,_0x13f530){return db['ZendeskAccount'][_0x91e8('0x21')]({'raw':_0x315d03[_0x91e8('0x18')]?_0x315d03[_0x91e8('0x18')][_0x91e8('0x22')]===undefined?!![]:![]:!![],'where':_0x315d03[_0x91e8('0x18')]?_0x315d03[_0x91e8('0x18')]['where']||null:null,'attributes':_0x315d03[_0x91e8('0x18')]?_0x315d03[_0x91e8('0x18')][_0x91e8('0x1a')]||null:null,'include':_0x315d03[_0x91e8('0x18')]?_0x315d03['options'][_0x91e8('0x1c')]?_[_0x91e8('0x1d')](_0x315d03[_0x91e8('0x18')][_0x91e8('0x1c')],function(_0x28b8ca){return{'model':db[_0x28b8ca[_0x91e8('0x1e')]],'as':_0x28b8ca['as'],'attributes':_0x28b8ca['attributes'],'include':_0x28b8ca[_0x91e8('0x1c')]?_['map'](_0x28b8ca[_0x91e8('0x1c')],function(_0x5337bc){return{'model':db[_0x5337bc[_0x91e8('0x1e')]],'as':_0x5337bc['as'],'attributes':_0x5337bc[_0x91e8('0x1a')],'include':_0x5337bc[_0x91e8('0x1c')]?_[_0x91e8('0x1d')](_0x5337bc[_0x91e8('0x1c')],function(_0x37861d){return{'model':db[_0x37861d[_0x91e8('0x1e')]],'as':_0x37861d['as'],'attributes':_0x37861d[_0x91e8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x91e8('0x1f')](function(_0x8702d1){logger[_0x91e8('0x12')](_0x91e8('0x20'),_0x315d03);logger[_0x91e8('0xd')](_0x91e8('0x20'),_0x315d03,JSON[_0x91e8('0xf')](_0x8702d1));_0x2aa294(_0x8702d1);})[_0x91e8('0x14')](function(_0x58e989){logger[_0x91e8('0x10')]('ShowZendeskAccount',_0x58e989['message'],_0x315d03);_0x13f530(_0x11220f[_0x91e8('0x10')](0x1f4,_0x58e989[_0x91e8('0x11')]));});});}; \ No newline at end of file +var _0x9341=['request','then','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowZendeskAccount','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x9ab603,_0xd3f670){var _0x32e441=function(_0x7220af){while(--_0x7220af){_0x9ab603['push'](_0x9ab603['shift']());}};_0x32e441(++_0xd3f670);}(_0x9341,0xc8));var _0x1934=function(_0x2959ca,_0x23e198){_0x2959ca=_0x2959ca-0x0;var _0x5d5d56=_0x9341[_0x2959ca];return _0x5d5d56;};'use strict';var _=require(_0x1934('0x0'));var util=require(_0x1934('0x1'));var moment=require(_0x1934('0x2'));var BPromise=require(_0x1934('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1934('0x4'));var db=require(_0x1934('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1934('0x6'))(_0x1934('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1934('0x8')][_0x1934('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x363099,_0x429398,_0x950aca){return new BPromise(function(_0x17e3bd,_0x11021f){return client[_0x1934('0xa')](_0x363099,_0x950aca)[_0x1934('0xb')](function(_0x26cee1){logger[_0x1934('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x429398,_0x1934('0xd'));logger['debug'](_0x1934('0xe'),_0x429398,_0x1934('0xd'),JSON[_0x1934('0xf')](_0x26cee1));if(_0x26cee1[_0x1934('0x10')]){if(_0x26cee1['error'][_0x1934('0x11')]===0x1f4){logger[_0x1934('0x10')](_0x1934('0x12'),_0x429398,_0x26cee1[_0x1934('0x10')][_0x1934('0x13')]);return _0x11021f(_0x26cee1['error'][_0x1934('0x13')]);}logger[_0x1934('0x10')](_0x1934('0x12'),_0x429398,_0x26cee1[_0x1934('0x10')]['message']);return _0x17e3bd(_0x26cee1['error'][_0x1934('0x13')]);}else{logger['info'](_0x1934('0x12'),_0x429398,_0x1934('0xd'));_0x17e3bd(_0x26cee1[_0x1934('0x14')][_0x1934('0x13')]);}})[_0x1934('0x15')](function(_0x397325){logger['error'](_0x1934('0x12'),_0x429398,_0x397325);_0x11021f(_0x397325);});});}exports[_0x1934('0x16')]=function(_0x5a93b6){var _0xbde33e=this;return new Promise(function(_0x568a07,_0x1f5726){return db[_0x1934('0x17')][_0x1934('0x18')]({'raw':_0x5a93b6[_0x1934('0x19')]?_0x5a93b6[_0x1934('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5a93b6[_0x1934('0x19')]?_0x5a93b6[_0x1934('0x19')][_0x1934('0x1a')]||null:null,'attributes':_0x5a93b6[_0x1934('0x19')]?_0x5a93b6[_0x1934('0x19')][_0x1934('0x1b')]||null:null,'limit':_0x5a93b6[_0x1934('0x19')]?_0x5a93b6[_0x1934('0x19')][_0x1934('0x1c')]||null:null,'include':_0x5a93b6[_0x1934('0x19')]?_0x5a93b6[_0x1934('0x19')][_0x1934('0x1d')]?_[_0x1934('0x1e')](_0x5a93b6[_0x1934('0x19')][_0x1934('0x1d')],function(_0x5ed556){return{'model':db[_0x5ed556[_0x1934('0x1f')]],'as':_0x5ed556['as'],'attributes':_0x5ed556[_0x1934('0x1b')],'include':_0x5ed556[_0x1934('0x1d')]?_[_0x1934('0x1e')](_0x5ed556[_0x1934('0x1d')],function(_0xd11e1f){return{'model':db[_0xd11e1f[_0x1934('0x1f')]],'as':_0xd11e1f['as'],'attributes':_0xd11e1f['attributes'],'include':_0xd11e1f[_0x1934('0x1d')]?_[_0x1934('0x1e')](_0xd11e1f['include'],function(_0x82a8da){return{'model':db[_0x82a8da[_0x1934('0x1f')]],'as':_0x82a8da['as'],'attributes':_0x82a8da[_0x1934('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5751b7){logger[_0x1934('0xc')](_0x1934('0x16'),_0x5a93b6);logger[_0x1934('0x20')]('GetZendeskAccount',_0x5a93b6,JSON['stringify'](_0x5751b7));_0x568a07(_0x5751b7);})[_0x1934('0x15')](function(_0x32bbf6){logger[_0x1934('0x10')](_0x1934('0x16'),_0x32bbf6[_0x1934('0x13')],_0x5a93b6);_0x1f5726(_0xbde33e[_0x1934('0x10')](0x1f4,_0x32bbf6[_0x1934('0x13')]));});});};exports[_0x1934('0x21')]=function(_0x38da21){var _0x4f977b=this;return new Promise(function(_0x5d4b8c,_0x40c254){return db[_0x1934('0x17')]['find']({'raw':_0x38da21[_0x1934('0x19')]?_0x38da21[_0x1934('0x19')][_0x1934('0x22')]===undefined?!![]:![]:!![],'where':_0x38da21['options']?_0x38da21['options']['where']||null:null,'attributes':_0x38da21[_0x1934('0x19')]?_0x38da21['options'][_0x1934('0x1b')]||null:null,'include':_0x38da21[_0x1934('0x19')]?_0x38da21['options'][_0x1934('0x1d')]?_[_0x1934('0x1e')](_0x38da21[_0x1934('0x19')][_0x1934('0x1d')],function(_0x22cab2){return{'model':db[_0x22cab2[_0x1934('0x1f')]],'as':_0x22cab2['as'],'attributes':_0x22cab2[_0x1934('0x1b')],'include':_0x22cab2[_0x1934('0x1d')]?_[_0x1934('0x1e')](_0x22cab2[_0x1934('0x1d')],function(_0x392b2f){return{'model':db[_0x392b2f['model']],'as':_0x392b2f['as'],'attributes':_0x392b2f['attributes'],'include':_0x392b2f[_0x1934('0x1d')]?_[_0x1934('0x1e')](_0x392b2f[_0x1934('0x1d')],function(_0x13057c){return{'model':db[_0x13057c[_0x1934('0x1f')]],'as':_0x13057c['as'],'attributes':_0x13057c[_0x1934('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1934('0xb')](function(_0x3e208c){logger['info'](_0x1934('0x21'),_0x38da21);logger[_0x1934('0x20')](_0x1934('0x21'),_0x38da21,JSON['stringify'](_0x3e208c));_0x5d4b8c(_0x3e208c);})[_0x1934('0x15')](function(_0xb671d4){logger['error'](_0x1934('0x21'),_0xb671d4[_0x1934('0x13')],_0x38da21);_0x40c254(_0x4f977b[_0x1934('0x10')](0x1f4,_0xb671d4[_0x1934('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index e620449..2039811 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x17d891,_0x447c2c){var _0x1b840e=function(_0x4332cd){while(--_0x4332cd){_0x17d891['push'](_0x17d891['shift']());}};_0x1b840e(++_0x447c2c);}(_0x750a,0x140));var _0xa750=function(_0x131556,_0x10cd42){_0x131556=_0x131556-0x0;var _0x2dd4ce=_0x750a[_0x131556];return _0x2dd4ce;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x67db1b,_0x2819c1){var _0x14d5a7=function(_0x163118){while(--_0x163118){_0x67db1b['push'](_0x67db1b['shift']());}};_0x14d5a7(++_0x2819c1);}(_0xac4a,0x13f));var _0xaac4=function(_0x7f7af2,_0xbd08f7){_0x7f7af2=_0x7f7af2-0x0;var _0x4ea15e=_0xac4a[_0x7f7af2];return _0x4ea15e;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index ebf8058..7e5bc41 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3be8=['exports','STRING','sequelize'];(function(_0x43f90d,_0xf2fec1){var _0x395fc0=function(_0x5ef9ee){while(--_0x5ef9ee){_0x43f90d['push'](_0x43f90d['shift']());}};_0x395fc0(++_0xf2fec1);}(_0x3be8,0x83));var _0x83be=function(_0x4d12bf,_0x3d32a3){_0x4d12bf=_0x4d12bf-0x0;var _0x28e482=_0x3be8[_0x4d12bf];return _0x28e482;};'use strict';var Sequelize=require(_0x83be('0x0'));module[_0x83be('0x1')]={'name':{'type':Sequelize[_0x83be('0x2')]},'description':{'type':Sequelize[_0x83be('0x2')]}}; \ No newline at end of file +var _0xb8cd=['STRING','sequelize'];(function(_0x53dc82,_0x424116){var _0x448547=function(_0x1f9fb8){while(--_0x1f9fb8){_0x53dc82['push'](_0x53dc82['shift']());}};_0x448547(++_0x424116);}(_0xb8cd,0x129));var _0xdb8c=function(_0x59c874,_0x4a487e){_0x59c874=_0x59c874-0x0;var _0x407a5c=_0xb8cd[_0x59c874];return _0x407a5c;};'use strict';var Sequelize=require(_0xdb8c('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb8c('0x1')]},'description':{'type':Sequelize[_0xdb8c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d2b4f10..319ae82 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd70f=['attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','rows','catch','show','find','create','body','params','getFields','ZendeskField','findOne','hasOwnProperty','map','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','reject','save','update','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x27685e,_0x845417){var _0x224a6f=function(_0x24bd2b){while(--_0x24bd2b){_0x27685e['push'](_0x27685e['shift']());}};_0x224a6f(++_0x845417);}(_0xd70f,0x117));var _0xfd70=function(_0x1cb5ae,_0x4eb9e3){_0x1cb5ae=_0x1cb5ae-0x0;var _0x371eb2=_0xd70f[_0x1cb5ae];return _0x371eb2;};'use strict';var emlformat=require(_0xfd70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd70('0x1'));var jsonpatch=require(_0xfd70('0x2'));var rp=require(_0xfd70('0x3'));var moment=require(_0xfd70('0x4'));var BPromise=require(_0xfd70('0x5'));var Mustache=require(_0xfd70('0x6'));var util=require(_0xfd70('0x7'));var path=require(_0xfd70('0x8'));var sox=require(_0xfd70('0x9'));var csv=require(_0xfd70('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfd70('0xb'));var crypto=require(_0xfd70('0xc'));var jsforce=require(_0xfd70('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfd70('0xa'));var querystring=require(_0xfd70('0xe'));var Papa=require(_0xfd70('0xf'));var Redis=require(_0xfd70('0x10'));var authService=require(_0xfd70('0x11'));var qs=require(_0xfd70('0x12'));var as=require(_0xfd70('0x13'));var hardwareService=require(_0xfd70('0x14'));var logger=require('../../config/logger')(_0xfd70('0x15'));var utils=require(_0xfd70('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfd70('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1360bf,_0x27ebd4){_0x27ebd4=_0x27ebd4||0xcc;return function(_0xbf6412){if(_0xbf6412){return _0x1360bf[_0xfd70('0x18')](_0x27ebd4);}return _0x1360bf[_0xfd70('0x19')](_0x27ebd4)[_0xfd70('0x1a')]();};}function respondWithResult(_0x194941,_0x45121e){_0x45121e=_0x45121e||0xc8;return function(_0x82b2a5){if(_0x82b2a5){return _0x194941[_0xfd70('0x19')](_0x45121e)[_0xfd70('0x1b')](_0x82b2a5);}};}function respondWithFilteredResult(_0x5b66af,_0x2c42ac){return function(_0xbba31c){if(_0xbba31c){var _0x424b26=typeof _0x2c42ac['offset']===_0xfd70('0x1c')&&typeof _0x2c42ac[_0xfd70('0x1d')]===_0xfd70('0x1c');var _0x34d0b4=_0xbba31c['count'];var _0x1051ff=_0x424b26?0x0:_0x2c42ac[_0xfd70('0x1e')];var _0x5c5592=_0x424b26?_0xbba31c[_0xfd70('0x1f')]:_0x2c42ac['offset']+_0x2c42ac[_0xfd70('0x1d')];var _0x308142;if(_0x5c5592>=_0x34d0b4){_0x5c5592=_0x34d0b4;_0x308142=0xc8;}else{_0x308142=0xce;}_0x5b66af[_0xfd70('0x19')](_0x308142);return _0x5b66af['set']('Content-Range',_0x1051ff+'-'+_0x5c5592+'/'+_0x34d0b4)[_0xfd70('0x1b')](_0xbba31c);}return null;};}function patchUpdates(_0x37fa19){return function(_0x5ec9a0){try{jsonpatch['apply'](_0x5ec9a0,_0x37fa19,!![]);}catch(_0x1482bd){return BPromise[_0xfd70('0x20')](_0x1482bd);}return _0x5ec9a0[_0xfd70('0x21')]();};}function saveUpdates(_0x16c83d,_0xab1fd2){return function(_0xf777c2){if(_0xf777c2){return _0xf777c2[_0xfd70('0x22')](_0x16c83d)['then'](function(_0x5519ea){return _0x5519ea;});}return null;};}function removeEntity(_0x4a7600,_0x63d380){return function(_0x145216){if(_0x145216){return _0x145216[_0xfd70('0x23')]()['then'](function(){_0x4a7600[_0xfd70('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155635,_0x265653){return function(_0x36ab0f){if(!_0x36ab0f){_0x155635[_0xfd70('0x18')](0x194);}return _0x36ab0f;};}function handleError(_0x53b597,_0x55bec9){_0x55bec9=_0x55bec9||0x1f4;return function(_0x46ee0e){logger[_0xfd70('0x24')](_0x46ee0e[_0xfd70('0x25')]);if(_0x46ee0e[_0xfd70('0x26')]){delete _0x46ee0e['name'];}_0x53b597[_0xfd70('0x19')](_0x55bec9)[_0xfd70('0x27')](_0x46ee0e);};}exports[_0xfd70('0x28')]=function(_0x57bbec,_0x204ec3){var _0x1e9aa7={},_0x446206={},_0x6e55c5={'count':0x0,'rows':[]};var _0x11f8ad=_['map'](db[_0xfd70('0x29')][_0xfd70('0x2a')],function(_0x4ed84d){return{'name':_0x4ed84d[_0xfd70('0x2b')],'type':_0x4ed84d['type'][_0xfd70('0x2c')]};});_0x446206[_0xfd70('0x2d')]=_['map'](_0x11f8ad,_0xfd70('0x26'));_0x446206[_0xfd70('0x2e')]=_[_0xfd70('0x2f')](_0x57bbec[_0xfd70('0x2e')]);_0x446206[_0xfd70('0x30')]=_['intersection'](_0x446206[_0xfd70('0x2d')],_0x446206[_0xfd70('0x2e')]);_0x1e9aa7[_0xfd70('0x31')]=_[_0xfd70('0x32')](_0x446206[_0xfd70('0x2d')],qs[_0xfd70('0x33')](_0x57bbec['query'][_0xfd70('0x33')]));_0x1e9aa7['attributes']=_0x1e9aa7['attributes'][_0xfd70('0x34')]?_0x1e9aa7[_0xfd70('0x31')]:_0x446206[_0xfd70('0x2d')];if(!_0x57bbec[_0xfd70('0x2e')]['hasOwnProperty'](_0xfd70('0x35'))){_0x1e9aa7[_0xfd70('0x1d')]=qs['limit'](_0x57bbec[_0xfd70('0x2e')]['limit']);_0x1e9aa7['offset']=qs[_0xfd70('0x1e')](_0x57bbec[_0xfd70('0x2e')][_0xfd70('0x1e')]);}_0x1e9aa7[_0xfd70('0x36')]=qs['sort'](_0x57bbec[_0xfd70('0x2e')][_0xfd70('0x37')]);_0x1e9aa7[_0xfd70('0x38')]=qs['filters'](_[_0xfd70('0x39')](_0x57bbec[_0xfd70('0x2e')],_0x446206[_0xfd70('0x30')]),_0x11f8ad);if(_0x57bbec[_0xfd70('0x2e')][_0xfd70('0x3a')]){_0x1e9aa7[_0xfd70('0x38')]=_['merge'](_0x1e9aa7['where'],{'$or':_['map'](_0x11f8ad,function(_0x55db30){if(_0x55db30['type']!==_0xfd70('0x3b')){var _0x14e35a={};_0x14e35a[_0x55db30[_0xfd70('0x26')]]={'$like':'%'+_0x57bbec[_0xfd70('0x2e')][_0xfd70('0x3a')]+'%'};return _0x14e35a;}})});}_0x1e9aa7=_[_0xfd70('0x3c')]({},_0x1e9aa7,_0x57bbec[_0xfd70('0x3d')]);var _0x4d7cea={'where':_0x1e9aa7[_0xfd70('0x38')]};return db[_0xfd70('0x29')][_0xfd70('0x1f')](_0x4d7cea)[_0xfd70('0x3e')](function(_0x46c08b){_0x6e55c5['count']=_0x46c08b;if(_0x57bbec[_0xfd70('0x2e')][_0xfd70('0x3f')]){_0x1e9aa7[_0xfd70('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x1e9aa7);})[_0xfd70('0x3e')](function(_0x59dcb0){_0x6e55c5[_0xfd70('0x41')]=_0x59dcb0;return _0x6e55c5;})[_0xfd70('0x3e')](respondWithFilteredResult(_0x204ec3,_0x1e9aa7))[_0xfd70('0x42')](handleError(_0x204ec3,null));};exports[_0xfd70('0x43')]=function(_0x15197e,_0x46f8f4){var _0x148c5f={'raw':![],'where':{'id':_0x15197e['params']['id']}},_0x5722b9={};_0x5722b9[_0xfd70('0x2d')]=_['keys'](db['ZendeskConfiguration'][_0xfd70('0x2a')]);_0x5722b9['query']=_[_0xfd70('0x2f')](_0x15197e[_0xfd70('0x2e')]);_0x5722b9[_0xfd70('0x30')]=_[_0xfd70('0x32')](_0x5722b9[_0xfd70('0x2d')],_0x5722b9[_0xfd70('0x2e')]);_0x148c5f[_0xfd70('0x31')]=_[_0xfd70('0x32')](_0x5722b9[_0xfd70('0x2d')],qs[_0xfd70('0x33')](_0x15197e['query']['fields']));_0x148c5f['attributes']=_0x148c5f['attributes'][_0xfd70('0x34')]?_0x148c5f[_0xfd70('0x31')]:_0x5722b9[_0xfd70('0x2d')];if(_0x15197e[_0xfd70('0x2e')][_0xfd70('0x3f')]){_0x148c5f[_0xfd70('0x40')]=[{'all':!![]}];}_0x148c5f=_[_0xfd70('0x3c')]({},_0x148c5f,_0x15197e[_0xfd70('0x3d')]);return db[_0xfd70('0x29')][_0xfd70('0x44')](_0x148c5f)['then'](handleEntityNotFound(_0x46f8f4,null))['then'](respondWithResult(_0x46f8f4,null))['catch'](handleError(_0x46f8f4,null));};exports[_0xfd70('0x45')]=function(_0x4b0b60,_0x53c418){return db[_0xfd70('0x29')][_0xfd70('0x45')](_0x4b0b60[_0xfd70('0x46')],{})[_0xfd70('0x3e')](respondWithResult(_0x53c418,0xc9))[_0xfd70('0x42')](handleError(_0x53c418,null));};exports[_0xfd70('0x22')]=function(_0x4dca11,_0x5380ad){if(_0x4dca11['body']['id']){delete _0x4dca11[_0xfd70('0x46')]['id'];}return db[_0xfd70('0x29')][_0xfd70('0x44')]({'where':{'id':_0x4dca11[_0xfd70('0x47')]['id']}})[_0xfd70('0x3e')](handleEntityNotFound(_0x5380ad,null))['then'](saveUpdates(_0x4dca11[_0xfd70('0x46')],null))[_0xfd70('0x3e')](respondWithResult(_0x5380ad,null))[_0xfd70('0x42')](handleError(_0x5380ad,null));};exports['destroy']=function(_0x4787e,_0x3363e3){return db['ZendeskConfiguration'][_0xfd70('0x44')]({'where':{'id':_0x4787e[_0xfd70('0x47')]['id']}})[_0xfd70('0x3e')](handleEntityNotFound(_0x3363e3,null))[_0xfd70('0x3e')](removeEntity(_0x3363e3,null))[_0xfd70('0x42')](handleError(_0x3363e3,null));};exports[_0xfd70('0x48')]=function(_0x299ac3,_0x3747c5,_0xfe5fe){var _0x1ea1b0={};var _0x28efd8={};var _0xbef141;var _0x509be4;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x299ac3[_0xfd70('0x47')]['id']}})[_0xfd70('0x3e')](handleEntityNotFound(_0x3747c5,null))['then'](function(_0x5b7804){if(_0x5b7804){_0xbef141=_0x5b7804;_0x28efd8[_0xfd70('0x2d')]=_[_0xfd70('0x2f')](db[_0xfd70('0x49')][_0xfd70('0x2a')]);_0x28efd8[_0xfd70('0x2e')]=_['keys'](_0x299ac3[_0xfd70('0x2e')]);_0x28efd8['filters']=_[_0xfd70('0x32')](_0x28efd8[_0xfd70('0x2d')],_0x28efd8[_0xfd70('0x2e')]);_0x1ea1b0[_0xfd70('0x31')]=_[_0xfd70('0x32')](_0x28efd8[_0xfd70('0x2d')],qs[_0xfd70('0x33')](_0x299ac3[_0xfd70('0x2e')][_0xfd70('0x33')]));_0x1ea1b0[_0xfd70('0x31')]=_0x1ea1b0[_0xfd70('0x31')][_0xfd70('0x34')]?_0x1ea1b0[_0xfd70('0x31')]:_0x28efd8[_0xfd70('0x2d')];_0x1ea1b0[_0xfd70('0x36')]=qs[_0xfd70('0x37')](_0x299ac3[_0xfd70('0x2e')]['sort']);_0x1ea1b0[_0xfd70('0x38')]=qs['filters'](_['pick'](_0x299ac3['query'],_0x28efd8[_0xfd70('0x30')]));if(_0x299ac3[_0xfd70('0x2e')]['filter']){_0x1ea1b0[_0xfd70('0x38')]=_[_0xfd70('0x3c')](_0x1ea1b0[_0xfd70('0x38')],{'$or':_['map'](_0x1ea1b0[_0xfd70('0x31')],function(_0xf0f4){var _0x479e42={};_0x479e42[_0xf0f4]={'$like':'%'+_0x299ac3[_0xfd70('0x2e')]['filter']+'%'};return _0x479e42;})});}_0x1ea1b0=_[_0xfd70('0x3c')]({},_0x1ea1b0,_0x299ac3['options']);return _0xbef141[_0xfd70('0x48')](_0x1ea1b0);}})['then'](function(_0x5f3141){if(_0x5f3141){_0x509be4=_0x5f3141[_0xfd70('0x34')];if(!_0x299ac3[_0xfd70('0x2e')]['hasOwnProperty'](_0xfd70('0x35'))){_0x1ea1b0[_0xfd70('0x1d')]=qs['limit'](_0x299ac3[_0xfd70('0x2e')][_0xfd70('0x1d')]);_0x1ea1b0[_0xfd70('0x1e')]=qs[_0xfd70('0x1e')](_0x299ac3[_0xfd70('0x2e')][_0xfd70('0x1e')]);}return _0xbef141['getFields'](_0x1ea1b0);}})['then'](function(_0x5ae67e){if(_0x5ae67e){return _0x5ae67e?{'count':_0x509be4,'rows':_0x5ae67e}:null;}})['then'](respondWithResult(_0x3747c5,null))[_0xfd70('0x42')](handleError(_0x3747c5,null));};exports['getSubjects']=function(_0x33b3e8,_0x25886b,_0x5b7d38){var _0x53fe58={};var _0x550f48={};var _0x24b1ae;var _0x1419de;return db[_0xfd70('0x29')][_0xfd70('0x4a')]({'where':{'id':_0x33b3e8[_0xfd70('0x47')]['id']}})[_0xfd70('0x3e')](handleEntityNotFound(_0x25886b,null))[_0xfd70('0x3e')](function(_0x542815){if(_0x542815){_0x24b1ae=_0x542815;_0x550f48[_0xfd70('0x2d')]=_[_0xfd70('0x2f')](db['ZendeskField'][_0xfd70('0x2a')]);_0x550f48['query']=_[_0xfd70('0x2f')](_0x33b3e8[_0xfd70('0x2e')]);_0x550f48[_0xfd70('0x30')]=_[_0xfd70('0x32')](_0x550f48['model'],_0x550f48['query']);_0x53fe58[_0xfd70('0x31')]=_['intersection'](_0x550f48['model'],qs['fields'](_0x33b3e8[_0xfd70('0x2e')]['fields']));_0x53fe58[_0xfd70('0x31')]=_0x53fe58[_0xfd70('0x31')][_0xfd70('0x34')]?_0x53fe58[_0xfd70('0x31')]:_0x550f48[_0xfd70('0x2d')];_0x53fe58[_0xfd70('0x36')]=qs[_0xfd70('0x37')](_0x33b3e8[_0xfd70('0x2e')]['sort']);_0x53fe58['where']=qs[_0xfd70('0x30')](_['pick'](_0x33b3e8['query'],_0x550f48[_0xfd70('0x30')]));if(_0x33b3e8[_0xfd70('0x2e')]['filter']){_0x53fe58[_0xfd70('0x38')]=_[_0xfd70('0x3c')](_0x53fe58[_0xfd70('0x38')],{'$or':_['map'](_0x53fe58[_0xfd70('0x31')],function(_0x576945){var _0x4984a9={};_0x4984a9[_0x576945]={'$like':'%'+_0x33b3e8['query'][_0xfd70('0x3a')]+'%'};return _0x4984a9;})});}_0x53fe58=_[_0xfd70('0x3c')]({},_0x53fe58,_0x33b3e8['options']);return _0x24b1ae['getSubjects'](_0x53fe58);}})[_0xfd70('0x3e')](function(_0x137df8){if(_0x137df8){_0x1419de=_0x137df8[_0xfd70('0x34')];if(!_0x33b3e8[_0xfd70('0x2e')][_0xfd70('0x4b')](_0xfd70('0x35'))){_0x53fe58[_0xfd70('0x1d')]=qs[_0xfd70('0x1d')](_0x33b3e8['query'][_0xfd70('0x1d')]);_0x53fe58[_0xfd70('0x1e')]=qs[_0xfd70('0x1e')](_0x33b3e8[_0xfd70('0x2e')][_0xfd70('0x1e')]);}return _0x24b1ae['getSubjects'](_0x53fe58);}})[_0xfd70('0x3e')](function(_0x442629){if(_0x442629){return _0x442629?{'count':_0x1419de,'rows':_0x442629}:null;}})[_0xfd70('0x3e')](respondWithResult(_0x25886b,null))[_0xfd70('0x42')](handleError(_0x25886b,null));};exports['getDescriptions']=function(_0x2731f4,_0x1b5520,_0xb722ee){var _0x2f8997={};var _0x29b560={};var _0x1aa981;var _0x52a6d9;return db[_0xfd70('0x29')][_0xfd70('0x4a')]({'where':{'id':_0x2731f4['params']['id']}})['then'](handleEntityNotFound(_0x1b5520,null))[_0xfd70('0x3e')](function(_0x4e711b){if(_0x4e711b){_0x1aa981=_0x4e711b;_0x29b560['model']=_[_0xfd70('0x2f')](db[_0xfd70('0x49')][_0xfd70('0x2a')]);_0x29b560[_0xfd70('0x2e')]=_[_0xfd70('0x2f')](_0x2731f4[_0xfd70('0x2e')]);_0x29b560['filters']=_[_0xfd70('0x32')](_0x29b560[_0xfd70('0x2d')],_0x29b560[_0xfd70('0x2e')]);_0x2f8997['attributes']=_[_0xfd70('0x32')](_0x29b560['model'],qs[_0xfd70('0x33')](_0x2731f4['query'][_0xfd70('0x33')]));_0x2f8997['attributes']=_0x2f8997[_0xfd70('0x31')][_0xfd70('0x34')]?_0x2f8997[_0xfd70('0x31')]:_0x29b560['model'];_0x2f8997[_0xfd70('0x36')]=qs[_0xfd70('0x37')](_0x2731f4['query'][_0xfd70('0x37')]);_0x2f8997[_0xfd70('0x38')]=qs[_0xfd70('0x30')](_['pick'](_0x2731f4[_0xfd70('0x2e')],_0x29b560[_0xfd70('0x30')]));if(_0x2731f4['query'][_0xfd70('0x3a')]){_0x2f8997[_0xfd70('0x38')]=_[_0xfd70('0x3c')](_0x2f8997[_0xfd70('0x38')],{'$or':_[_0xfd70('0x4c')](_0x2f8997[_0xfd70('0x31')],function(_0x34bdb6){var _0x413b88={};_0x413b88[_0x34bdb6]={'$like':'%'+_0x2731f4[_0xfd70('0x2e')][_0xfd70('0x3a')]+'%'};return _0x413b88;})});}_0x2f8997=_[_0xfd70('0x3c')]({},_0x2f8997,_0x2731f4[_0xfd70('0x3d')]);return _0x1aa981['getDescriptions'](_0x2f8997);}})[_0xfd70('0x3e')](function(_0x3a98c3){if(_0x3a98c3){_0x52a6d9=_0x3a98c3[_0xfd70('0x34')];if(!_0x2731f4['query'][_0xfd70('0x4b')](_0xfd70('0x35'))){_0x2f8997['limit']=qs['limit'](_0x2731f4['query'][_0xfd70('0x1d')]);_0x2f8997[_0xfd70('0x1e')]=qs[_0xfd70('0x1e')](_0x2731f4['query'][_0xfd70('0x1e')]);}return _0x1aa981[_0xfd70('0x4d')](_0x2f8997);}})[_0xfd70('0x3e')](function(_0x1e9877){if(_0x1e9877){return _0x1e9877?{'count':_0x52a6d9,'rows':_0x1e9877}:null;}})[_0xfd70('0x3e')](respondWithResult(_0x1b5520,null))[_0xfd70('0x42')](handleError(_0x1b5520,null));};exports[_0xfd70('0x4e')]=function(_0x22f3d4,_0x2aba4d,_0x2d887b){var _0x39706d={};var _0x4a2807={};var _0x4c44dc;var _0x431ae6;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x22f3d4[_0xfd70('0x47')]['id']}})['then'](handleEntityNotFound(_0x2aba4d,null))[_0xfd70('0x3e')](function(_0x4583e9){if(_0x4583e9){_0x4c44dc=_0x4583e9;_0x4a2807[_0xfd70('0x2d')]=_[_0xfd70('0x2f')](db[_0xfd70('0x4f')]['rawAttributes']);_0x4a2807[_0xfd70('0x2e')]=_[_0xfd70('0x2f')](_0x22f3d4[_0xfd70('0x2e')]);_0x4a2807['filters']=_[_0xfd70('0x32')](_0x4a2807[_0xfd70('0x2d')],_0x4a2807['query']);_0x39706d[_0xfd70('0x31')]=_[_0xfd70('0x32')](_0x4a2807['model'],qs[_0xfd70('0x33')](_0x22f3d4[_0xfd70('0x2e')]['fields']));_0x39706d[_0xfd70('0x31')]=_0x39706d[_0xfd70('0x31')]['length']?_0x39706d[_0xfd70('0x31')]:_0x4a2807[_0xfd70('0x2d')];_0x39706d[_0xfd70('0x36')]=qs[_0xfd70('0x37')](_0x22f3d4[_0xfd70('0x2e')][_0xfd70('0x37')]);_0x39706d[_0xfd70('0x38')]=qs[_0xfd70('0x30')](_[_0xfd70('0x39')](_0x22f3d4['query'],_0x4a2807[_0xfd70('0x30')]));if(_0x22f3d4[_0xfd70('0x2e')]['filter']){_0x39706d[_0xfd70('0x38')]=_[_0xfd70('0x3c')](_0x39706d[_0xfd70('0x38')],{'$or':_[_0xfd70('0x4c')](_0x39706d[_0xfd70('0x31')],function(_0x4eefe1){var _0x73432a={};_0x73432a[_0x4eefe1]={'$like':'%'+_0x22f3d4[_0xfd70('0x2e')][_0xfd70('0x3a')]+'%'};return _0x73432a;})});}_0x39706d=_[_0xfd70('0x3c')]({},_0x39706d,_0x22f3d4[_0xfd70('0x3d')]);return _0x4c44dc[_0xfd70('0x4e')](_0x39706d);}})[_0xfd70('0x3e')](function(_0xdaa8b4){if(_0xdaa8b4){_0x431ae6=_0xdaa8b4[_0xfd70('0x34')];if(!_0x22f3d4['query']['hasOwnProperty'](_0xfd70('0x35'))){_0x39706d[_0xfd70('0x1d')]=qs[_0xfd70('0x1d')](_0x22f3d4[_0xfd70('0x2e')][_0xfd70('0x1d')]);_0x39706d['offset']=qs['offset'](_0x22f3d4['query'][_0xfd70('0x1e')]);}return _0x4c44dc[_0xfd70('0x4e')](_0x39706d);}})[_0xfd70('0x3e')](function(_0x48ad2d){if(_0x48ad2d){return _0x48ad2d?{'count':_0x431ae6,'rows':_0x48ad2d}:null;}})[_0xfd70('0x3e')](respondWithResult(_0x2aba4d,null))[_0xfd70('0x42')](handleError(_0x2aba4d,null));};exports[_0xfd70('0x50')]=function(_0x1d9b5c,_0x213f02,_0x3273fd){if(_0x1d9b5c['body']['id']){delete _0x1d9b5c['body']['id'];}return db['ZendeskConfiguration'][_0xfd70('0x4a')]({'where':{'id':_0x1d9b5c[_0xfd70('0x47')]['id']}})[_0xfd70('0x3e')](handleEntityNotFound(_0x213f02,null))['then'](function(_0x476b15){if(_0x476b15){return _0x476b15[_0xfd70('0x50')](_0x1d9b5c['body'][_0xfd70('0x51')]||[]);}return null;})[_0xfd70('0x3e')](respondWithResult(_0x213f02,null))['catch'](handleError(_0x213f02,null));}; \ No newline at end of file +var _0xa480=['VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','getFields','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','send','index','ZendeskConfiguration','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x442402,_0xf93270){var _0x11e9c1=function(_0x1578c7){while(--_0x1578c7){_0x442402['push'](_0x442402['shift']());}};_0x11e9c1(++_0xf93270);}(_0xa480,0x6d));var _0x0a48=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa480[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0x0a48('0x0'));var rimraf=require(_0x0a48('0x1'));var zipdir=require(_0x0a48('0x2'));var jsonpatch=require(_0x0a48('0x3'));var rp=require('request-promise');var moment=require(_0x0a48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a48('0x5'));var util=require(_0x0a48('0x6'));var path=require(_0x0a48('0x7'));var sox=require(_0x0a48('0x8'));var csv=require(_0x0a48('0x9'));var ejs=require(_0x0a48('0xa'));var fs=require('fs');var fs_extra=require(_0x0a48('0xb'));var _=require(_0x0a48('0xc'));var squel=require(_0x0a48('0xd'));var crypto=require(_0x0a48('0xe'));var jsforce=require(_0x0a48('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0a48('0x9'));var querystring=require('querystring');var Papa=require(_0x0a48('0x10'));var Redis=require(_0x0a48('0x11'));var authService=require(_0x0a48('0x12'));var qs=require(_0x0a48('0x13'));var as=require(_0x0a48('0x14'));var hardwareService=require(_0x0a48('0x15'));var logger=require(_0x0a48('0x16'))(_0x0a48('0x17'));var utils=require('../../config/utils');var config=require(_0x0a48('0x18'));var licenseUtil=require(_0x0a48('0x19'));var db=require(_0x0a48('0x1a'))['db'];function respondWithStatusCode(_0x5b607c,_0x58cdd0){_0x58cdd0=_0x58cdd0||0xcc;return function(_0x2e1e12){if(_0x2e1e12){return _0x5b607c[_0x0a48('0x1b')](_0x58cdd0);}return _0x5b607c['status'](_0x58cdd0)['end']();};}function respondWithResult(_0x193507,_0x5c9c84){_0x5c9c84=_0x5c9c84||0xc8;return function(_0x30f6d4){if(_0x30f6d4){return _0x193507[_0x0a48('0x1c')](_0x5c9c84)[_0x0a48('0x1d')](_0x30f6d4);}};}function respondWithFilteredResult(_0x5eeced,_0x44120e){return function(_0x1ad741){if(_0x1ad741){var _0x583f92=typeof _0x44120e[_0x0a48('0x1e')]===_0x0a48('0x1f')&&typeof _0x44120e[_0x0a48('0x20')]==='undefined';var _0x19d97c=_0x1ad741['count'];var _0x4b6f5d=_0x583f92?0x0:_0x44120e[_0x0a48('0x1e')];var _0x386100=_0x583f92?_0x1ad741[_0x0a48('0x21')]:_0x44120e[_0x0a48('0x1e')]+_0x44120e[_0x0a48('0x20')];var _0x478661;if(_0x386100>=_0x19d97c){_0x386100=_0x19d97c;_0x478661=0xc8;}else{_0x478661=0xce;}_0x5eeced[_0x0a48('0x1c')](_0x478661);return _0x5eeced[_0x0a48('0x22')](_0x0a48('0x23'),_0x4b6f5d+'-'+_0x386100+'/'+_0x19d97c)[_0x0a48('0x1d')](_0x1ad741);}return null;};}function patchUpdates(_0x36aaf9){return function(_0x2d9783){try{jsonpatch['apply'](_0x2d9783,_0x36aaf9,!![]);}catch(_0x14a978){return BPromise[_0x0a48('0x24')](_0x14a978);}return _0x2d9783[_0x0a48('0x25')]();};}function saveUpdates(_0x4e45a8,_0x246e6f){return function(_0x37bff7){if(_0x37bff7){return _0x37bff7[_0x0a48('0x26')](_0x4e45a8)[_0x0a48('0x27')](function(_0x531d93){return _0x531d93;});}return null;};}function removeEntity(_0x3ad04b,_0x4daead){return function(_0x5f11c5){if(_0x5f11c5){return _0x5f11c5[_0x0a48('0x28')]()[_0x0a48('0x27')](function(){_0x3ad04b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3768f7,_0x44c923){return function(_0x276875){if(!_0x276875){_0x3768f7[_0x0a48('0x1b')](0x194);}return _0x276875;};}function handleError(_0x1bfc3a,_0x4310ef){_0x4310ef=_0x4310ef||0x1f4;return function(_0x1004ef){logger['error'](_0x1004ef[_0x0a48('0x29')]);if(_0x1004ef['name']){delete _0x1004ef['name'];}_0x1bfc3a[_0x0a48('0x1c')](_0x4310ef)[_0x0a48('0x2a')](_0x1004ef);};}exports[_0x0a48('0x2b')]=function(_0x5028f0,_0x8bbc82){var _0x566b9c={},_0x232540={},_0x2f5375={'count':0x0,'rows':[]};var _0x5e202f=_['map'](db[_0x0a48('0x2c')]['rawAttributes'],function(_0x3b1b04){return{'name':_0x3b1b04[_0x0a48('0x2d')],'type':_0x3b1b04[_0x0a48('0x2e')][_0x0a48('0x2f')]};});_0x232540[_0x0a48('0x30')]=_[_0x0a48('0x31')](_0x5e202f,_0x0a48('0x32'));_0x232540[_0x0a48('0x33')]=_[_0x0a48('0x34')](_0x5028f0[_0x0a48('0x33')]);_0x232540[_0x0a48('0x35')]=_['intersection'](_0x232540[_0x0a48('0x30')],_0x232540[_0x0a48('0x33')]);_0x566b9c[_0x0a48('0x36')]=_[_0x0a48('0x37')](_0x232540[_0x0a48('0x30')],qs[_0x0a48('0x38')](_0x5028f0[_0x0a48('0x33')]['fields']));_0x566b9c[_0x0a48('0x36')]=_0x566b9c[_0x0a48('0x36')][_0x0a48('0x39')]?_0x566b9c[_0x0a48('0x36')]:_0x232540[_0x0a48('0x30')];if(!_0x5028f0[_0x0a48('0x33')]['hasOwnProperty'](_0x0a48('0x3a'))){_0x566b9c[_0x0a48('0x20')]=qs['limit'](_0x5028f0[_0x0a48('0x33')]['limit']);_0x566b9c[_0x0a48('0x1e')]=qs[_0x0a48('0x1e')](_0x5028f0[_0x0a48('0x33')]['offset']);}_0x566b9c[_0x0a48('0x3b')]=qs[_0x0a48('0x3c')](_0x5028f0['query'][_0x0a48('0x3c')]);_0x566b9c[_0x0a48('0x3d')]=qs[_0x0a48('0x35')](_[_0x0a48('0x3e')](_0x5028f0['query'],_0x232540[_0x0a48('0x35')]),_0x5e202f);if(_0x5028f0[_0x0a48('0x33')][_0x0a48('0x3f')]){_0x566b9c[_0x0a48('0x3d')]=_[_0x0a48('0x40')](_0x566b9c[_0x0a48('0x3d')],{'$or':_[_0x0a48('0x31')](_0x5e202f,function(_0x2415d6){if(_0x2415d6['type']!==_0x0a48('0x41')){var _0x3e981e={};_0x3e981e[_0x2415d6[_0x0a48('0x32')]]={'$like':'%'+_0x5028f0[_0x0a48('0x33')][_0x0a48('0x3f')]+'%'};return _0x3e981e;}})});}_0x566b9c=_[_0x0a48('0x40')]({},_0x566b9c,_0x5028f0[_0x0a48('0x42')]);var _0xa49ae2={'where':_0x566b9c[_0x0a48('0x3d')]};return db['ZendeskConfiguration'][_0x0a48('0x21')](_0xa49ae2)[_0x0a48('0x27')](function(_0x1dda05){_0x2f5375[_0x0a48('0x21')]=_0x1dda05;if(_0x5028f0[_0x0a48('0x33')][_0x0a48('0x43')]){_0x566b9c['include']=[{'all':!![]}];}return db[_0x0a48('0x2c')][_0x0a48('0x44')](_0x566b9c);})[_0x0a48('0x27')](function(_0x340589){_0x2f5375[_0x0a48('0x45')]=_0x340589;return _0x2f5375;})[_0x0a48('0x27')](respondWithFilteredResult(_0x8bbc82,_0x566b9c))[_0x0a48('0x46')](handleError(_0x8bbc82,null));};exports['show']=function(_0x2c79bc,_0x36f3b7){var _0x3c2608={'raw':![],'where':{'id':_0x2c79bc[_0x0a48('0x47')]['id']}},_0xb85318={};_0xb85318[_0x0a48('0x30')]=_[_0x0a48('0x34')](db[_0x0a48('0x2c')][_0x0a48('0x48')]);_0xb85318[_0x0a48('0x33')]=_[_0x0a48('0x34')](_0x2c79bc[_0x0a48('0x33')]);_0xb85318[_0x0a48('0x35')]=_[_0x0a48('0x37')](_0xb85318[_0x0a48('0x30')],_0xb85318['query']);_0x3c2608[_0x0a48('0x36')]=_[_0x0a48('0x37')](_0xb85318[_0x0a48('0x30')],qs[_0x0a48('0x38')](_0x2c79bc[_0x0a48('0x33')][_0x0a48('0x38')]));_0x3c2608[_0x0a48('0x36')]=_0x3c2608[_0x0a48('0x36')][_0x0a48('0x39')]?_0x3c2608['attributes']:_0xb85318[_0x0a48('0x30')];if(_0x2c79bc[_0x0a48('0x33')][_0x0a48('0x43')]){_0x3c2608[_0x0a48('0x49')]=[{'all':!![]}];}_0x3c2608=_['merge']({},_0x3c2608,_0x2c79bc[_0x0a48('0x42')]);return db[_0x0a48('0x2c')][_0x0a48('0x4a')](_0x3c2608)[_0x0a48('0x27')](handleEntityNotFound(_0x36f3b7,null))['then'](respondWithResult(_0x36f3b7,null))[_0x0a48('0x46')](handleError(_0x36f3b7,null));};exports['create']=function(_0x4e485c,_0x3f9827){return db[_0x0a48('0x2c')][_0x0a48('0x4b')](_0x4e485c[_0x0a48('0x4c')],{})[_0x0a48('0x27')](respondWithResult(_0x3f9827,0xc9))[_0x0a48('0x46')](handleError(_0x3f9827,null));};exports[_0x0a48('0x26')]=function(_0x252b74,_0x1a2d91){if(_0x252b74[_0x0a48('0x4c')]['id']){delete _0x252b74[_0x0a48('0x4c')]['id'];}return db[_0x0a48('0x2c')][_0x0a48('0x4a')]({'where':{'id':_0x252b74[_0x0a48('0x47')]['id']}})[_0x0a48('0x27')](handleEntityNotFound(_0x1a2d91,null))[_0x0a48('0x27')](saveUpdates(_0x252b74[_0x0a48('0x4c')],null))[_0x0a48('0x27')](respondWithResult(_0x1a2d91,null))[_0x0a48('0x46')](handleError(_0x1a2d91,null));};exports[_0x0a48('0x28')]=function(_0x39bef0,_0x633bf9){return db['ZendeskConfiguration'][_0x0a48('0x4a')]({'where':{'id':_0x39bef0[_0x0a48('0x47')]['id']}})[_0x0a48('0x27')](handleEntityNotFound(_0x633bf9,null))[_0x0a48('0x27')](removeEntity(_0x633bf9,null))[_0x0a48('0x46')](handleError(_0x633bf9,null));};exports[_0x0a48('0x4d')]=function(_0x397ee9,_0x117fb2,_0x23e0b7){var _0x5cbe57={};var _0xd2a9d7={};var _0x287d6e;var _0x1e9a4c;return db[_0x0a48('0x2c')]['findOne']({'where':{'id':_0x397ee9['params']['id']}})['then'](handleEntityNotFound(_0x117fb2,null))['then'](function(_0xa62d41){if(_0xa62d41){_0x287d6e=_0xa62d41;_0xd2a9d7[_0x0a48('0x30')]=_[_0x0a48('0x34')](db[_0x0a48('0x4e')][_0x0a48('0x48')]);_0xd2a9d7[_0x0a48('0x33')]=_[_0x0a48('0x34')](_0x397ee9[_0x0a48('0x33')]);_0xd2a9d7['filters']=_[_0x0a48('0x37')](_0xd2a9d7['model'],_0xd2a9d7[_0x0a48('0x33')]);_0x5cbe57[_0x0a48('0x36')]=_[_0x0a48('0x37')](_0xd2a9d7['model'],qs[_0x0a48('0x38')](_0x397ee9[_0x0a48('0x33')][_0x0a48('0x38')]));_0x5cbe57[_0x0a48('0x36')]=_0x5cbe57[_0x0a48('0x36')]['length']?_0x5cbe57[_0x0a48('0x36')]:_0xd2a9d7['model'];_0x5cbe57[_0x0a48('0x3b')]=qs[_0x0a48('0x3c')](_0x397ee9[_0x0a48('0x33')][_0x0a48('0x3c')]);_0x5cbe57[_0x0a48('0x3d')]=qs[_0x0a48('0x35')](_['pick'](_0x397ee9[_0x0a48('0x33')],_0xd2a9d7[_0x0a48('0x35')]));if(_0x397ee9['query'][_0x0a48('0x3f')]){_0x5cbe57[_0x0a48('0x3d')]=_[_0x0a48('0x40')](_0x5cbe57[_0x0a48('0x3d')],{'$or':_[_0x0a48('0x31')](_0x5cbe57[_0x0a48('0x36')],function(_0x1a33ba){var _0x4dbe83={};_0x4dbe83[_0x1a33ba]={'$like':'%'+_0x397ee9[_0x0a48('0x33')][_0x0a48('0x3f')]+'%'};return _0x4dbe83;})});}_0x5cbe57=_[_0x0a48('0x40')]({},_0x5cbe57,_0x397ee9[_0x0a48('0x42')]);return _0x287d6e['getFields'](_0x5cbe57);}})[_0x0a48('0x27')](function(_0xb34edd){if(_0xb34edd){_0x1e9a4c=_0xb34edd['length'];if(!_0x397ee9[_0x0a48('0x33')][_0x0a48('0x4f')](_0x0a48('0x3a'))){_0x5cbe57[_0x0a48('0x20')]=qs[_0x0a48('0x20')](_0x397ee9[_0x0a48('0x33')][_0x0a48('0x20')]);_0x5cbe57['offset']=qs[_0x0a48('0x1e')](_0x397ee9[_0x0a48('0x33')][_0x0a48('0x1e')]);}return _0x287d6e[_0x0a48('0x4d')](_0x5cbe57);}})[_0x0a48('0x27')](function(_0x197043){if(_0x197043){return _0x197043?{'count':_0x1e9a4c,'rows':_0x197043}:null;}})[_0x0a48('0x27')](respondWithResult(_0x117fb2,null))[_0x0a48('0x46')](handleError(_0x117fb2,null));};exports[_0x0a48('0x50')]=function(_0x501bf3,_0x5830a3,_0x55d20b){var _0x39de76={};var _0x3ff4b8={};var _0x57f72a;var _0x1856a9;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x501bf3['params']['id']}})['then'](handleEntityNotFound(_0x5830a3,null))[_0x0a48('0x27')](function(_0x4d5eca){if(_0x4d5eca){_0x57f72a=_0x4d5eca;_0x3ff4b8[_0x0a48('0x30')]=_[_0x0a48('0x34')](db[_0x0a48('0x4e')]['rawAttributes']);_0x3ff4b8[_0x0a48('0x33')]=_['keys'](_0x501bf3['query']);_0x3ff4b8[_0x0a48('0x35')]=_[_0x0a48('0x37')](_0x3ff4b8[_0x0a48('0x30')],_0x3ff4b8['query']);_0x39de76[_0x0a48('0x36')]=_['intersection'](_0x3ff4b8[_0x0a48('0x30')],qs[_0x0a48('0x38')](_0x501bf3[_0x0a48('0x33')][_0x0a48('0x38')]));_0x39de76[_0x0a48('0x36')]=_0x39de76['attributes']['length']?_0x39de76[_0x0a48('0x36')]:_0x3ff4b8[_0x0a48('0x30')];_0x39de76[_0x0a48('0x3b')]=qs[_0x0a48('0x3c')](_0x501bf3[_0x0a48('0x33')]['sort']);_0x39de76[_0x0a48('0x3d')]=qs[_0x0a48('0x35')](_['pick'](_0x501bf3[_0x0a48('0x33')],_0x3ff4b8[_0x0a48('0x35')]));if(_0x501bf3[_0x0a48('0x33')][_0x0a48('0x3f')]){_0x39de76[_0x0a48('0x3d')]=_[_0x0a48('0x40')](_0x39de76[_0x0a48('0x3d')],{'$or':_[_0x0a48('0x31')](_0x39de76[_0x0a48('0x36')],function(_0x2b4ae7){var _0x50525f={};_0x50525f[_0x2b4ae7]={'$like':'%'+_0x501bf3[_0x0a48('0x33')]['filter']+'%'};return _0x50525f;})});}_0x39de76=_[_0x0a48('0x40')]({},_0x39de76,_0x501bf3['options']);return _0x57f72a['getSubjects'](_0x39de76);}})[_0x0a48('0x27')](function(_0x4dedb9){if(_0x4dedb9){_0x1856a9=_0x4dedb9[_0x0a48('0x39')];if(!_0x501bf3[_0x0a48('0x33')][_0x0a48('0x4f')](_0x0a48('0x3a'))){_0x39de76[_0x0a48('0x20')]=qs[_0x0a48('0x20')](_0x501bf3[_0x0a48('0x33')]['limit']);_0x39de76[_0x0a48('0x1e')]=qs[_0x0a48('0x1e')](_0x501bf3[_0x0a48('0x33')][_0x0a48('0x1e')]);}return _0x57f72a[_0x0a48('0x50')](_0x39de76);}})['then'](function(_0x2d40a7){if(_0x2d40a7){return _0x2d40a7?{'count':_0x1856a9,'rows':_0x2d40a7}:null;}})[_0x0a48('0x27')](respondWithResult(_0x5830a3,null))[_0x0a48('0x46')](handleError(_0x5830a3,null));};exports[_0x0a48('0x51')]=function(_0x478b7a,_0x19c651,_0x1f3a6a){var _0x362b1b={};var _0x245ed6={};var _0x5adec6;var _0x46c958;return db[_0x0a48('0x2c')][_0x0a48('0x52')]({'where':{'id':_0x478b7a[_0x0a48('0x47')]['id']}})[_0x0a48('0x27')](handleEntityNotFound(_0x19c651,null))[_0x0a48('0x27')](function(_0x518c37){if(_0x518c37){_0x5adec6=_0x518c37;_0x245ed6[_0x0a48('0x30')]=_[_0x0a48('0x34')](db[_0x0a48('0x4e')]['rawAttributes']);_0x245ed6['query']=_[_0x0a48('0x34')](_0x478b7a['query']);_0x245ed6[_0x0a48('0x35')]=_[_0x0a48('0x37')](_0x245ed6['model'],_0x245ed6[_0x0a48('0x33')]);_0x362b1b[_0x0a48('0x36')]=_[_0x0a48('0x37')](_0x245ed6[_0x0a48('0x30')],qs[_0x0a48('0x38')](_0x478b7a['query'][_0x0a48('0x38')]));_0x362b1b[_0x0a48('0x36')]=_0x362b1b[_0x0a48('0x36')]['length']?_0x362b1b[_0x0a48('0x36')]:_0x245ed6[_0x0a48('0x30')];_0x362b1b[_0x0a48('0x3b')]=qs['sort'](_0x478b7a[_0x0a48('0x33')][_0x0a48('0x3c')]);_0x362b1b['where']=qs[_0x0a48('0x35')](_[_0x0a48('0x3e')](_0x478b7a[_0x0a48('0x33')],_0x245ed6['filters']));if(_0x478b7a[_0x0a48('0x33')]['filter']){_0x362b1b[_0x0a48('0x3d')]=_['merge'](_0x362b1b[_0x0a48('0x3d')],{'$or':_[_0x0a48('0x31')](_0x362b1b[_0x0a48('0x36')],function(_0x216cd0){var _0x5cff74={};_0x5cff74[_0x216cd0]={'$like':'%'+_0x478b7a[_0x0a48('0x33')][_0x0a48('0x3f')]+'%'};return _0x5cff74;})});}_0x362b1b=_[_0x0a48('0x40')]({},_0x362b1b,_0x478b7a[_0x0a48('0x42')]);return _0x5adec6[_0x0a48('0x51')](_0x362b1b);}})[_0x0a48('0x27')](function(_0x332258){if(_0x332258){_0x46c958=_0x332258[_0x0a48('0x39')];if(!_0x478b7a[_0x0a48('0x33')][_0x0a48('0x4f')](_0x0a48('0x3a'))){_0x362b1b[_0x0a48('0x20')]=qs[_0x0a48('0x20')](_0x478b7a['query'][_0x0a48('0x20')]);_0x362b1b[_0x0a48('0x1e')]=qs[_0x0a48('0x1e')](_0x478b7a[_0x0a48('0x33')]['offset']);}return _0x5adec6[_0x0a48('0x51')](_0x362b1b);}})[_0x0a48('0x27')](function(_0x33ea1d){if(_0x33ea1d){return _0x33ea1d?{'count':_0x46c958,'rows':_0x33ea1d}:null;}})[_0x0a48('0x27')](respondWithResult(_0x19c651,null))[_0x0a48('0x46')](handleError(_0x19c651,null));};exports[_0x0a48('0x53')]=function(_0x39f845,_0x5cafbf,_0x12c8db){var _0x38d541={};var _0x274aab={};var _0x38e8da;var _0x42c8e5;return db[_0x0a48('0x2c')][_0x0a48('0x52')]({'where':{'id':_0x39f845['params']['id']}})[_0x0a48('0x27')](handleEntityNotFound(_0x5cafbf,null))[_0x0a48('0x27')](function(_0x5321d1){if(_0x5321d1){_0x38e8da=_0x5321d1;_0x274aab['model']=_[_0x0a48('0x34')](db[_0x0a48('0x54')][_0x0a48('0x48')]);_0x274aab[_0x0a48('0x33')]=_[_0x0a48('0x34')](_0x39f845['query']);_0x274aab[_0x0a48('0x35')]=_['intersection'](_0x274aab['model'],_0x274aab[_0x0a48('0x33')]);_0x38d541[_0x0a48('0x36')]=_[_0x0a48('0x37')](_0x274aab['model'],qs[_0x0a48('0x38')](_0x39f845[_0x0a48('0x33')][_0x0a48('0x38')]));_0x38d541[_0x0a48('0x36')]=_0x38d541['attributes'][_0x0a48('0x39')]?_0x38d541[_0x0a48('0x36')]:_0x274aab['model'];_0x38d541[_0x0a48('0x3b')]=qs[_0x0a48('0x3c')](_0x39f845[_0x0a48('0x33')][_0x0a48('0x3c')]);_0x38d541['where']=qs[_0x0a48('0x35')](_[_0x0a48('0x3e')](_0x39f845[_0x0a48('0x33')],_0x274aab['filters']));if(_0x39f845[_0x0a48('0x33')][_0x0a48('0x3f')]){_0x38d541[_0x0a48('0x3d')]=_['merge'](_0x38d541[_0x0a48('0x3d')],{'$or':_[_0x0a48('0x31')](_0x38d541[_0x0a48('0x36')],function(_0xbbee93){var _0x4b67ca={};_0x4b67ca[_0xbbee93]={'$like':'%'+_0x39f845[_0x0a48('0x33')][_0x0a48('0x3f')]+'%'};return _0x4b67ca;})});}_0x38d541=_[_0x0a48('0x40')]({},_0x38d541,_0x39f845[_0x0a48('0x42')]);return _0x38e8da['getTags'](_0x38d541);}})[_0x0a48('0x27')](function(_0x10f552){if(_0x10f552){_0x42c8e5=_0x10f552[_0x0a48('0x39')];if(!_0x39f845[_0x0a48('0x33')][_0x0a48('0x4f')](_0x0a48('0x3a'))){_0x38d541['limit']=qs[_0x0a48('0x20')](_0x39f845[_0x0a48('0x33')][_0x0a48('0x20')]);_0x38d541['offset']=qs[_0x0a48('0x1e')](_0x39f845[_0x0a48('0x33')][_0x0a48('0x1e')]);}return _0x38e8da[_0x0a48('0x53')](_0x38d541);}})[_0x0a48('0x27')](function(_0x1e798f){if(_0x1e798f){return _0x1e798f?{'count':_0x42c8e5,'rows':_0x1e798f}:null;}})[_0x0a48('0x27')](respondWithResult(_0x5cafbf,null))['catch'](handleError(_0x5cafbf,null));};exports[_0x0a48('0x55')]=function(_0x1bbac3,_0x2ee84d,_0xd1649b){if(_0x1bbac3['body']['id']){delete _0x1bbac3[_0x0a48('0x4c')]['id'];}return db[_0x0a48('0x2c')][_0x0a48('0x52')]({'where':{'id':_0x1bbac3['params']['id']}})[_0x0a48('0x27')](handleEntityNotFound(_0x2ee84d,null))['then'](function(_0x123759){if(_0x123759){return _0x123759[_0x0a48('0x55')](_0x1bbac3[_0x0a48('0x4c')][_0x0a48('0x56')]||[]);}return null;})[_0x0a48('0x27')](respondWithResult(_0x2ee84d,null))['catch'](handleError(_0x2ee84d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 3456e59..b84d88b 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x59e8e9,_0x590188){var _0x2cc119=function(_0x377589){while(--_0x377589){_0x59e8e9['push'](_0x59e8e9['shift']());}};_0x2cc119(++_0x590188);}(_0x5423,0xe3));var _0x3542=function(_0x5616f5,_0x2ee858){_0x5616f5=_0x5616f5-0x0;var _0x3b0328=_0x5423[_0x5616f5];return _0x3b0328;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x065e=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x20ad55,_0x6235e){var _0x480b26=function(_0x2e97ce){while(--_0x2e97ce){_0x20ad55['push'](_0x20ad55['shift']());}};_0x480b26(++_0x6235e);}(_0x065e,0x1a7));var _0xe065=function(_0x5ae183,_0x30b294){_0x5ae183=_0x5ae183-0x0;var _0x32517a=_0x065e[_0x5ae183];return _0x32517a;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('ZendeskConfiguration',attributes,{'tableName':_0xe065('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 9367005..5fa37e4 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf74=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3d52e3,_0x16e53f){var _0x3d2f1e=function(_0x389bf6){while(--_0x389bf6){_0x3d52e3['push'](_0x3d52e3['shift']());}};_0x3d2f1e(++_0x16e53f);}(_0xaf74,0x8d));var _0x4af7=function(_0x1f745e,_0x1f87af){_0x1f745e=_0x1f745e-0x0;var _0x1b4cc9=_0xaf74[_0x1f745e];return _0x1b4cc9;};'use strict';var _=require(_0x4af7('0x0'));var util=require(_0x4af7('0x1'));var moment=require(_0x4af7('0x2'));var BPromise=require(_0x4af7('0x3'));var rs=require(_0x4af7('0x4'));var fs=require('fs');var Redis=require(_0x4af7('0x5'));var db=require(_0x4af7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4af7('0x7'))(_0x4af7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4af7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6608,_0x2b053c,_0x4b2e2a){return new BPromise(function(_0x3e57fb,_0x24f781){return client['request'](_0x4a6608,_0x4b2e2a)[_0x4af7('0xa')](function(_0x436d5e){logger[_0x4af7('0xb')](_0x4af7('0xc'),_0x2b053c,'request\x20sent');logger['debug'](_0x4af7('0xd'),_0x2b053c,_0x4af7('0xe'),JSON[_0x4af7('0xf')](_0x436d5e));if(_0x436d5e[_0x4af7('0x10')]){if(_0x436d5e[_0x4af7('0x10')][_0x4af7('0x11')]===0x1f4){logger[_0x4af7('0x10')](_0x4af7('0xc'),_0x2b053c,_0x436d5e[_0x4af7('0x10')][_0x4af7('0x12')]);return _0x24f781(_0x436d5e[_0x4af7('0x10')][_0x4af7('0x12')]);}logger[_0x4af7('0x10')](_0x4af7('0xc'),_0x2b053c,_0x436d5e[_0x4af7('0x10')]['message']);return _0x3e57fb(_0x436d5e[_0x4af7('0x10')][_0x4af7('0x12')]);}else{logger['info'](_0x4af7('0xc'),_0x2b053c,_0x4af7('0xe'));_0x3e57fb(_0x436d5e[_0x4af7('0x13')][_0x4af7('0x12')]);}})['catch'](function(_0x2cc533){logger[_0x4af7('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2b053c,_0x2cc533);_0x24f781(_0x2cc533);});});} \ No newline at end of file +var _0x5bd4=['client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x515ff8,_0x2f4b6e){var _0x4f8851=function(_0x1363d7){while(--_0x1363d7){_0x515ff8['push'](_0x515ff8['shift']());}};_0x4f8851(++_0x2f4b6e);}(_0x5bd4,0x19a));var _0x45bd=function(_0x3e37f3,_0x2b554b){_0x3e37f3=_0x3e37f3-0x0;var _0x47d0eb=_0x5bd4[_0x3e37f3];return _0x47d0eb;};'use strict';var _=require(_0x45bd('0x0'));var util=require(_0x45bd('0x1'));var moment=require(_0x45bd('0x2'));var BPromise=require(_0x45bd('0x3'));var rs=require(_0x45bd('0x4'));var fs=require('fs');var Redis=require(_0x45bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x45bd('0x6'));var logger=require('../../config/logger')(_0x45bd('0x7'));var config=require(_0x45bd('0x8'));var jayson=require(_0x45bd('0x9'));var client=jayson[_0x45bd('0xa')][_0x45bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10a061,_0x54e5e3,_0x198846){return new BPromise(function(_0x1d833b,_0x58f343){return client[_0x45bd('0xc')](_0x10a061,_0x198846)['then'](function(_0x4ca114){logger[_0x45bd('0xd')](_0x45bd('0xe'),_0x54e5e3,_0x45bd('0xf'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x54e5e3,_0x45bd('0xf'),JSON['stringify'](_0x4ca114));if(_0x4ca114[_0x45bd('0x10')]){if(_0x4ca114['error'][_0x45bd('0x11')]===0x1f4){logger['error'](_0x45bd('0xe'),_0x54e5e3,_0x4ca114['error'][_0x45bd('0x12')]);return _0x58f343(_0x4ca114['error']['message']);}logger['error'](_0x45bd('0xe'),_0x54e5e3,_0x4ca114[_0x45bd('0x10')]['message']);return _0x1d833b(_0x4ca114[_0x45bd('0x10')][_0x45bd('0x12')]);}else{logger[_0x45bd('0xd')](_0x45bd('0xe'),_0x54e5e3,'request\x20sent');_0x1d833b(_0x4ca114[_0x45bd('0x13')][_0x45bd('0x12')]);}})[_0x45bd('0x14')](function(_0x1957ae){logger[_0x45bd('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x54e5e3,_0x1957ae);_0x58f343(_0x1957ae);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 90c8f1e..8deab51 100644 --- a/server/api/intZendeskField/index.js +++ b/server/api/intZendeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ead=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x34162d,_0x3fe4bc){var _0x4f5238=function(_0x3a9298){while(--_0x3a9298){_0x34162d['push'](_0x34162d['shift']());}};_0x4f5238(++_0x3fe4bc);}(_0x2ead,0xbb));var _0xd2ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ead[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd2ea('0x0'));var path=require(_0xd2ea('0x1'));var timeout=require(_0xd2ea('0x2'));var express=require(_0xd2ea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd2ea('0x4'));var interaction=require(_0xd2ea('0x5'));var config=require(_0xd2ea('0x6'));var controller=require(_0xd2ea('0x7'));router['get']('/',auth[_0xd2ea('0x8')](),controller[_0xd2ea('0x9')]);router[_0xd2ea('0xa')](_0xd2ea('0xb'),auth[_0xd2ea('0x8')](),controller[_0xd2ea('0xc')]);router[_0xd2ea('0xd')]('/',auth['isAuthenticated'](),controller[_0xd2ea('0xe')]);router[_0xd2ea('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd2ea('0x10')]);router['delete'](_0xd2ea('0xb'),auth[_0xd2ea('0x8')](),controller[_0xd2ea('0x11')]);module[_0xd2ea('0x12')]=router; \ No newline at end of file +var _0x584d=['create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','show','post'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0x584d,0x14a));var _0xd584=function(_0x29124a,_0x304543){_0x29124a=_0x29124a-0x0;var _0x3fc6f7=_0x584d[_0x29124a];return _0x3fc6f7;};'use strict';var multer=require(_0xd584('0x0'));var util=require('util');var path=require(_0xd584('0x1'));var timeout=require(_0xd584('0x2'));var express=require(_0xd584('0x3'));var router=express[_0xd584('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd584('0x5'));var interaction=require(_0xd584('0x6'));var config=require('../../config/environment');var controller=require(_0xd584('0x7'));router[_0xd584('0x8')]('/',auth[_0xd584('0x9')](),controller['index']);router[_0xd584('0x8')]('/:id',auth[_0xd584('0x9')](),controller[_0xd584('0xa')]);router[_0xd584('0xb')]('/',auth[_0xd584('0x9')](),controller[_0xd584('0xc')]);router[_0xd584('0xd')](_0xd584('0xe'),auth[_0xd584('0x9')](),controller[_0xd584('0xf')]);router[_0xd584('0x10')](_0xd584('0xe'),auth[_0xd584('0x9')](),controller[_0xd584('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index f3766dc..2c5e109 100644 --- a/server/api/intZendeskField/intZendeskField.attributes.js +++ b/server/api/intZendeskField/intZendeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0e6=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x44655d,_0x5350d0){var _0x3e479c=function(_0x2e70c9){while(--_0x2e70c9){_0x44655d['push'](_0x44655d['shift']());}};_0x3e479c(++_0x5350d0);}(_0xf0e6,0x12d));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6f0e('0x0'));module[_0x6f0e('0x1')]={'type':{'type':Sequelize[_0x6f0e('0x2')](_0x6f0e('0x3'),_0x6f0e('0x4'),'customVariable',_0x6f0e('0x5'),_0x6f0e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6f0e('0x7')]},'key':{'type':Sequelize[_0x6f0e('0x7')]},'keyType':{'type':Sequelize[_0x6f0e('0x2')](_0x6f0e('0x3'),_0x6f0e('0x4'),_0x6f0e('0x8'))},'keyContent':{'type':Sequelize[_0x6f0e('0x7')]},'idField':{'type':Sequelize[_0x6f0e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6f0e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f0e('0x7')]}}; \ No newline at end of file +var _0xa64c=['STRING','customVariable','sequelize','ENUM','string','variable','picklist'];(function(_0x12b830,_0xd66540){var _0x261dc4=function(_0x57037a){while(--_0x57037a){_0x12b830['push'](_0x12b830['shift']());}};_0x261dc4(++_0xd66540);}(_0xa64c,0x14b));var _0xca64=function(_0x4af3d2,_0x3a93f8){_0x4af3d2=_0x4af3d2-0x0;var _0x4acf0e=_0xa64c[_0x4af3d2];return _0x4acf0e;};'use strict';var Sequelize=require(_0xca64('0x0'));module['exports']={'type':{'type':Sequelize[_0xca64('0x1')](_0xca64('0x2'),_0xca64('0x3'),'customVariable','keyValue',_0xca64('0x4')),'defaultValue':_0xca64('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xca64('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xca64('0x2'),_0xca64('0x3'),_0xca64('0x6'))},'keyContent':{'type':Sequelize[_0xca64('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xca64('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2d79c41..aed8406 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4241=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','error','name','map','ZendeskField','rawAttributes','fieldName','model','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','find','create','body','catch','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x4241,0x17d));var _0x1424=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x4241[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1424('0x0'));var jsonpatch=require(_0x1424('0x1'));var rp=require(_0x1424('0x2'));var moment=require(_0x1424('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1424('0x4'));var util=require(_0x1424('0x5'));var path=require(_0x1424('0x6'));var sox=require(_0x1424('0x7'));var csv=require(_0x1424('0x8'));var ejs=require(_0x1424('0x9'));var fs=require('fs');var fs_extra=require(_0x1424('0xa'));var _=require(_0x1424('0xb'));var squel=require(_0x1424('0xc'));var crypto=require(_0x1424('0xd'));var jsforce=require(_0x1424('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1424('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1424('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1424('0x10'));var as=require(_0x1424('0x11'));var hardwareService=require(_0x1424('0x12'));var logger=require(_0x1424('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1424('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1424('0x15'))['db'];function respondWithStatusCode(_0x85d9a0,_0x4bcd30){_0x4bcd30=_0x4bcd30||0xcc;return function(_0x1004c9){if(_0x1004c9){return _0x85d9a0['sendStatus'](_0x4bcd30);}return _0x85d9a0['status'](_0x4bcd30)[_0x1424('0x16')]();};}function respondWithResult(_0x23ff10,_0x46fc98){_0x46fc98=_0x46fc98||0xc8;return function(_0x37f44e){if(_0x37f44e){return _0x23ff10['status'](_0x46fc98)['json'](_0x37f44e);}};}function respondWithFilteredResult(_0x1249c7,_0x3c53dd){return function(_0xb7414d){if(_0xb7414d){var _0x151917=typeof _0x3c53dd[_0x1424('0x17')]===_0x1424('0x18')&&typeof _0x3c53dd['limit']===_0x1424('0x18');var _0x522b9b=_0xb7414d[_0x1424('0x19')];var _0x49ab35=_0x151917?0x0:_0x3c53dd[_0x1424('0x17')];var _0x281b38=_0x151917?_0xb7414d[_0x1424('0x19')]:_0x3c53dd[_0x1424('0x17')]+_0x3c53dd[_0x1424('0x1a')];var _0x1a7d0c;if(_0x281b38>=_0x522b9b){_0x281b38=_0x522b9b;_0x1a7d0c=0xc8;}else{_0x1a7d0c=0xce;}_0x1249c7[_0x1424('0x1b')](_0x1a7d0c);return _0x1249c7[_0x1424('0x1c')](_0x1424('0x1d'),_0x49ab35+'-'+_0x281b38+'/'+_0x522b9b)[_0x1424('0x1e')](_0xb7414d);}return null;};}function patchUpdates(_0x18d7f8){return function(_0x3e1c02){try{jsonpatch[_0x1424('0x1f')](_0x3e1c02,_0x18d7f8,!![]);}catch(_0x11d3f8){return BPromise[_0x1424('0x20')](_0x11d3f8);}return _0x3e1c02[_0x1424('0x21')]();};}function saveUpdates(_0x372416,_0x16d0a0){return function(_0x3f1a3c){if(_0x3f1a3c){return _0x3f1a3c['update'](_0x372416)[_0x1424('0x22')](function(_0x48bf03){return _0x48bf03;});}return null;};}function removeEntity(_0x12fe98,_0x4635fd){return function(_0x4f1901){if(_0x4f1901){return _0x4f1901[_0x1424('0x23')]()[_0x1424('0x22')](function(){_0x12fe98['status'](0xcc)[_0x1424('0x16')]();});}};}function handleEntityNotFound(_0x2f700e,_0x26a97f){return function(_0xc8eba5){if(!_0xc8eba5){_0x2f700e['sendStatus'](0x194);}return _0xc8eba5;};}function handleError(_0x2ffbfa,_0x584a29){_0x584a29=_0x584a29||0x1f4;return function(_0xaf721d){logger[_0x1424('0x24')](_0xaf721d['stack']);if(_0xaf721d['name']){delete _0xaf721d[_0x1424('0x25')];}_0x2ffbfa[_0x1424('0x1b')](_0x584a29)['send'](_0xaf721d);};}exports['index']=function(_0x298c8c,_0x3a27d2){var _0x1e6e99={},_0x13e938={},_0x5e9e2a={'count':0x0,'rows':[]};var _0x459aa=_[_0x1424('0x26')](db[_0x1424('0x27')][_0x1424('0x28')],function(_0x35bc8a){return{'name':_0x35bc8a[_0x1424('0x29')],'type':_0x35bc8a['type']['key']};});_0x13e938[_0x1424('0x2a')]=_[_0x1424('0x26')](_0x459aa,_0x1424('0x25'));_0x13e938[_0x1424('0x2b')]=_['keys'](_0x298c8c[_0x1424('0x2b')]);_0x13e938['filters']=_['intersection'](_0x13e938[_0x1424('0x2a')],_0x13e938['query']);_0x1e6e99[_0x1424('0x2c')]=_[_0x1424('0x2d')](_0x13e938[_0x1424('0x2a')],qs[_0x1424('0x2e')](_0x298c8c[_0x1424('0x2b')][_0x1424('0x2e')]));_0x1e6e99[_0x1424('0x2c')]=_0x1e6e99['attributes'][_0x1424('0x2f')]?_0x1e6e99['attributes']:_0x13e938[_0x1424('0x2a')];if(!_0x298c8c[_0x1424('0x2b')]['hasOwnProperty']('nolimit')){_0x1e6e99[_0x1424('0x1a')]=qs[_0x1424('0x1a')](_0x298c8c[_0x1424('0x2b')][_0x1424('0x1a')]);_0x1e6e99[_0x1424('0x17')]=qs[_0x1424('0x17')](_0x298c8c[_0x1424('0x2b')]['offset']);}_0x1e6e99[_0x1424('0x30')]=qs[_0x1424('0x31')](_0x298c8c[_0x1424('0x2b')][_0x1424('0x31')]);_0x1e6e99[_0x1424('0x32')]=qs[_0x1424('0x33')](_[_0x1424('0x34')](_0x298c8c[_0x1424('0x2b')],_0x13e938[_0x1424('0x33')]),_0x459aa);if(_0x298c8c['query'][_0x1424('0x35')]){_0x1e6e99['where']=_[_0x1424('0x36')](_0x1e6e99[_0x1424('0x32')],{'$or':_[_0x1424('0x26')](_0x459aa,function(_0x2c672e){if(_0x2c672e['type']!=='VIRTUAL'){var _0xbfe4a7={};_0xbfe4a7[_0x2c672e['name']]={'$like':'%'+_0x298c8c[_0x1424('0x2b')][_0x1424('0x35')]+'%'};return _0xbfe4a7;}})});}_0x1e6e99=_[_0x1424('0x36')]({},_0x1e6e99,_0x298c8c[_0x1424('0x37')]);var _0x7b2c3f={'where':_0x1e6e99[_0x1424('0x32')]};return db[_0x1424('0x27')][_0x1424('0x19')](_0x7b2c3f)[_0x1424('0x22')](function(_0x76c10b){_0x5e9e2a[_0x1424('0x19')]=_0x76c10b;if(_0x298c8c[_0x1424('0x2b')][_0x1424('0x38')]){_0x1e6e99[_0x1424('0x39')]=[{'all':!![]}];}return db[_0x1424('0x27')][_0x1424('0x3a')](_0x1e6e99);})[_0x1424('0x22')](function(_0x266e84){_0x5e9e2a['rows']=_0x266e84;return _0x5e9e2a;})[_0x1424('0x22')](respondWithFilteredResult(_0x3a27d2,_0x1e6e99))['catch'](handleError(_0x3a27d2,null));};exports[_0x1424('0x3b')]=function(_0x24c0c6,_0x246981){var _0xcef39f={'raw':!![],'where':{'id':_0x24c0c6[_0x1424('0x3c')]['id']}},_0x51bb4e={};_0x51bb4e[_0x1424('0x2a')]=_[_0x1424('0x3d')](db[_0x1424('0x27')]['rawAttributes']);_0x51bb4e[_0x1424('0x2b')]=_[_0x1424('0x3d')](_0x24c0c6[_0x1424('0x2b')]);_0x51bb4e['filters']=_[_0x1424('0x2d')](_0x51bb4e[_0x1424('0x2a')],_0x51bb4e[_0x1424('0x2b')]);_0xcef39f[_0x1424('0x2c')]=_[_0x1424('0x2d')](_0x51bb4e[_0x1424('0x2a')],qs[_0x1424('0x2e')](_0x24c0c6['query'][_0x1424('0x2e')]));_0xcef39f['attributes']=_0xcef39f[_0x1424('0x2c')][_0x1424('0x2f')]?_0xcef39f[_0x1424('0x2c')]:_0x51bb4e[_0x1424('0x2a')];if(_0x24c0c6['query'][_0x1424('0x38')]){_0xcef39f[_0x1424('0x39')]=[{'all':!![]}];}_0xcef39f=_[_0x1424('0x36')]({},_0xcef39f,_0x24c0c6[_0x1424('0x37')]);return db[_0x1424('0x27')][_0x1424('0x3e')](_0xcef39f)[_0x1424('0x22')](handleEntityNotFound(_0x246981,null))[_0x1424('0x22')](respondWithResult(_0x246981,null))['catch'](handleError(_0x246981,null));};exports['create']=function(_0x56f424,_0x83110d){return db[_0x1424('0x27')][_0x1424('0x3f')](_0x56f424[_0x1424('0x40')],{})[_0x1424('0x22')](respondWithResult(_0x83110d,0xc9))[_0x1424('0x41')](handleError(_0x83110d,null));};exports['update']=function(_0x54673d,_0x4849f0){if(_0x54673d[_0x1424('0x40')]['id']){delete _0x54673d[_0x1424('0x40')]['id'];}return db[_0x1424('0x27')][_0x1424('0x3e')]({'where':{'id':_0x54673d[_0x1424('0x3c')]['id']}})[_0x1424('0x22')](handleEntityNotFound(_0x4849f0,null))[_0x1424('0x22')](saveUpdates(_0x54673d['body'],null))['then'](respondWithResult(_0x4849f0,null))[_0x1424('0x41')](handleError(_0x4849f0,null));};exports[_0x1424('0x23')]=function(_0x4252f6,_0x2869f6){return db['ZendeskField'][_0x1424('0x3e')]({'where':{'id':_0x4252f6['params']['id']}})[_0x1424('0x22')](handleEntityNotFound(_0x2869f6,null))[_0x1424('0x22')](removeEntity(_0x2869f6,null))[_0x1424('0x41')](handleError(_0x2869f6,null));}; \ No newline at end of file +var _0x74a1=['length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','find','create','update','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes'];(function(_0x41fdcc,_0xef343d){var _0x11db4a=function(_0x514907){while(--_0x514907){_0x41fdcc['push'](_0x41fdcc['shift']());}};_0x11db4a(++_0xef343d);}(_0x74a1,0xff));var _0x174a=function(_0x18b9a8,_0x1770b6){_0x18b9a8=_0x18b9a8-0x0;var _0x4a0a8f=_0x74a1[_0x18b9a8];return _0x4a0a8f;};'use strict';var emlformat=require(_0x174a('0x0'));var rimraf=require(_0x174a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x174a('0x2'));var rp=require('request-promise');var moment=require(_0x174a('0x3'));var BPromise=require(_0x174a('0x4'));var Mustache=require(_0x174a('0x5'));var util=require(_0x174a('0x6'));var path=require(_0x174a('0x7'));var sox=require(_0x174a('0x8'));var csv=require(_0x174a('0x9'));var ejs=require(_0x174a('0xa'));var fs=require('fs');var fs_extra=require(_0x174a('0xb'));var _=require(_0x174a('0xc'));var squel=require(_0x174a('0xd'));var crypto=require(_0x174a('0xe'));var jsforce=require(_0x174a('0xf'));var deskjs=require(_0x174a('0x10'));var toCsv=require(_0x174a('0x9'));var querystring=require(_0x174a('0x11'));var Papa=require(_0x174a('0x12'));var Redis=require(_0x174a('0x13'));var authService=require(_0x174a('0x14'));var qs=require(_0x174a('0x15'));var as=require(_0x174a('0x16'));var hardwareService=require(_0x174a('0x17'));var logger=require(_0x174a('0x18'))(_0x174a('0x19'));var utils=require(_0x174a('0x1a'));var config=require(_0x174a('0x1b'));var licenseUtil=require(_0x174a('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ef97c,_0x30e2ba){_0x30e2ba=_0x30e2ba||0xcc;return function(_0x58f512){if(_0x58f512){return _0x3ef97c[_0x174a('0x1d')](_0x30e2ba);}return _0x3ef97c[_0x174a('0x1e')](_0x30e2ba)[_0x174a('0x1f')]();};}function respondWithResult(_0x519fbb,_0x272391){_0x272391=_0x272391||0xc8;return function(_0x503a51){if(_0x503a51){return _0x519fbb['status'](_0x272391)['json'](_0x503a51);}};}function respondWithFilteredResult(_0x4f8ecb,_0x1e649e){return function(_0x2324be){if(_0x2324be){var _0x38c463=typeof _0x1e649e[_0x174a('0x20')]===_0x174a('0x21')&&typeof _0x1e649e[_0x174a('0x22')]===_0x174a('0x21');var _0x3ad5d9=_0x2324be['count'];var _0x53da20=_0x38c463?0x0:_0x1e649e[_0x174a('0x20')];var _0x416b4f=_0x38c463?_0x2324be['count']:_0x1e649e[_0x174a('0x20')]+_0x1e649e['limit'];var _0x3b8f4d;if(_0x416b4f>=_0x3ad5d9){_0x416b4f=_0x3ad5d9;_0x3b8f4d=0xc8;}else{_0x3b8f4d=0xce;}_0x4f8ecb[_0x174a('0x1e')](_0x3b8f4d);return _0x4f8ecb[_0x174a('0x23')](_0x174a('0x24'),_0x53da20+'-'+_0x416b4f+'/'+_0x3ad5d9)[_0x174a('0x25')](_0x2324be);}return null;};}function patchUpdates(_0x24d080){return function(_0x5232d1){try{jsonpatch[_0x174a('0x26')](_0x5232d1,_0x24d080,!![]);}catch(_0x313b38){return BPromise[_0x174a('0x27')](_0x313b38);}return _0x5232d1[_0x174a('0x28')]();};}function saveUpdates(_0x223615,_0x4fcc28){return function(_0x26e737){if(_0x26e737){return _0x26e737['update'](_0x223615)[_0x174a('0x29')](function(_0x415a2f){return _0x415a2f;});}return null;};}function removeEntity(_0x532445,_0x49616c){return function(_0x58da55){if(_0x58da55){return _0x58da55['destroy']()[_0x174a('0x29')](function(){_0x532445['status'](0xcc)[_0x174a('0x1f')]();});}};}function handleEntityNotFound(_0x1d270e,_0x1369cd){return function(_0x4c6862){if(!_0x4c6862){_0x1d270e[_0x174a('0x1d')](0x194);}return _0x4c6862;};}function handleError(_0x50ac66,_0x2894bb){_0x2894bb=_0x2894bb||0x1f4;return function(_0x5cb88d){logger[_0x174a('0x2a')](_0x5cb88d['stack']);if(_0x5cb88d['name']){delete _0x5cb88d[_0x174a('0x2b')];}_0x50ac66[_0x174a('0x1e')](_0x2894bb)[_0x174a('0x2c')](_0x5cb88d);};}exports[_0x174a('0x2d')]=function(_0x1c5c69,_0x81c4c0){var _0x5a12c8={},_0x39abef={},_0x51763f={'count':0x0,'rows':[]};var _0x398b92=_[_0x174a('0x2e')](db[_0x174a('0x2f')][_0x174a('0x30')],function(_0x4f3895){return{'name':_0x4f3895[_0x174a('0x31')],'type':_0x4f3895['type'][_0x174a('0x32')]};});_0x39abef[_0x174a('0x33')]=_[_0x174a('0x2e')](_0x398b92,'name');_0x39abef[_0x174a('0x34')]=_[_0x174a('0x35')](_0x1c5c69[_0x174a('0x34')]);_0x39abef['filters']=_[_0x174a('0x36')](_0x39abef['model'],_0x39abef['query']);_0x5a12c8['attributes']=_[_0x174a('0x36')](_0x39abef['model'],qs[_0x174a('0x37')](_0x1c5c69[_0x174a('0x34')][_0x174a('0x37')]));_0x5a12c8[_0x174a('0x38')]=_0x5a12c8[_0x174a('0x38')][_0x174a('0x39')]?_0x5a12c8['attributes']:_0x39abef[_0x174a('0x33')];if(!_0x1c5c69[_0x174a('0x34')][_0x174a('0x3a')]('nolimit')){_0x5a12c8[_0x174a('0x22')]=qs[_0x174a('0x22')](_0x1c5c69['query'][_0x174a('0x22')]);_0x5a12c8[_0x174a('0x20')]=qs['offset'](_0x1c5c69[_0x174a('0x34')][_0x174a('0x20')]);}_0x5a12c8[_0x174a('0x3b')]=qs[_0x174a('0x3c')](_0x1c5c69[_0x174a('0x34')][_0x174a('0x3c')]);_0x5a12c8['where']=qs[_0x174a('0x3d')](_['pick'](_0x1c5c69[_0x174a('0x34')],_0x39abef[_0x174a('0x3d')]),_0x398b92);if(_0x1c5c69[_0x174a('0x34')][_0x174a('0x3e')]){_0x5a12c8[_0x174a('0x3f')]=_[_0x174a('0x40')](_0x5a12c8[_0x174a('0x3f')],{'$or':_[_0x174a('0x2e')](_0x398b92,function(_0x4f92d2){if(_0x4f92d2['type']!==_0x174a('0x41')){var _0xe3db41={};_0xe3db41[_0x4f92d2[_0x174a('0x2b')]]={'$like':'%'+_0x1c5c69[_0x174a('0x34')][_0x174a('0x3e')]+'%'};return _0xe3db41;}})});}_0x5a12c8=_[_0x174a('0x40')]({},_0x5a12c8,_0x1c5c69[_0x174a('0x42')]);var _0x4e9784={'where':_0x5a12c8['where']};return db['ZendeskField'][_0x174a('0x43')](_0x4e9784)[_0x174a('0x29')](function(_0x29491c){_0x51763f['count']=_0x29491c;if(_0x1c5c69[_0x174a('0x34')][_0x174a('0x44')]){_0x5a12c8[_0x174a('0x45')]=[{'all':!![]}];}return db[_0x174a('0x2f')]['findAll'](_0x5a12c8);})['then'](function(_0x4ccbdf){_0x51763f[_0x174a('0x46')]=_0x4ccbdf;return _0x51763f;})[_0x174a('0x29')](respondWithFilteredResult(_0x81c4c0,_0x5a12c8))[_0x174a('0x47')](handleError(_0x81c4c0,null));};exports[_0x174a('0x48')]=function(_0x501911,_0x518fdb){var _0x4bed5c={'raw':!![],'where':{'id':_0x501911['params']['id']}},_0x8e1fb0={};_0x8e1fb0[_0x174a('0x33')]=_['keys'](db['ZendeskField'][_0x174a('0x30')]);_0x8e1fb0[_0x174a('0x34')]=_[_0x174a('0x35')](_0x501911[_0x174a('0x34')]);_0x8e1fb0[_0x174a('0x3d')]=_[_0x174a('0x36')](_0x8e1fb0['model'],_0x8e1fb0[_0x174a('0x34')]);_0x4bed5c[_0x174a('0x38')]=_[_0x174a('0x36')](_0x8e1fb0['model'],qs['fields'](_0x501911[_0x174a('0x34')]['fields']));_0x4bed5c[_0x174a('0x38')]=_0x4bed5c[_0x174a('0x38')][_0x174a('0x39')]?_0x4bed5c[_0x174a('0x38')]:_0x8e1fb0[_0x174a('0x33')];if(_0x501911[_0x174a('0x34')][_0x174a('0x44')]){_0x4bed5c[_0x174a('0x45')]=[{'all':!![]}];}_0x4bed5c=_[_0x174a('0x40')]({},_0x4bed5c,_0x501911[_0x174a('0x42')]);return db[_0x174a('0x2f')][_0x174a('0x49')](_0x4bed5c)['then'](handleEntityNotFound(_0x518fdb,null))[_0x174a('0x29')](respondWithResult(_0x518fdb,null))[_0x174a('0x47')](handleError(_0x518fdb,null));};exports[_0x174a('0x4a')]=function(_0x5f10da,_0x2f7fa2){return db['ZendeskField'][_0x174a('0x4a')](_0x5f10da['body'],{})[_0x174a('0x29')](respondWithResult(_0x2f7fa2,0xc9))[_0x174a('0x47')](handleError(_0x2f7fa2,null));};exports[_0x174a('0x4b')]=function(_0x31a9aa,_0x5b552e){if(_0x31a9aa[_0x174a('0x4c')]['id']){delete _0x31a9aa[_0x174a('0x4c')]['id'];}return db[_0x174a('0x2f')][_0x174a('0x49')]({'where':{'id':_0x31a9aa[_0x174a('0x4d')]['id']}})[_0x174a('0x29')](handleEntityNotFound(_0x5b552e,null))['then'](saveUpdates(_0x31a9aa[_0x174a('0x4c')],null))[_0x174a('0x29')](respondWithResult(_0x5b552e,null))[_0x174a('0x47')](handleError(_0x5b552e,null));};exports['destroy']=function(_0x494cb8,_0xfc6a91){return db[_0x174a('0x2f')][_0x174a('0x49')]({'where':{'id':_0x494cb8['params']['id']}})[_0x174a('0x29')](handleEntityNotFound(_0xfc6a91,null))['then'](removeEntity(_0xfc6a91,null))[_0x174a('0x47')](handleError(_0xfc6a91,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 001a174..00ff172 100644 --- a/server/api/intZendeskField/intZendeskField.model.js +++ b/server/api/intZendeskField/intZendeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cfe=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1cfe,0xed));var _0xe1cf=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x1cfe[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xe1cf('0x0'));var util=require(_0xe1cf('0x1'));var logger=require(_0xe1cf('0x2'))(_0xe1cf('0x3'));var moment=require(_0xe1cf('0x4'));var BPromise=require(_0xe1cf('0x5'));var rp=require(_0xe1cf('0x6'));var fs=require('fs');var path=require(_0xe1cf('0x7'));var rimraf=require(_0xe1cf('0x8'));var config=require(_0xe1cf('0x9'));var attributes=require(_0xe1cf('0xa'));module[_0xe1cf('0xb')]=function(_0x2b3529,_0x5dde57){return _0x2b3529[_0xe1cf('0xc')]('ZendeskField',attributes,{'tableName':_0xe1cf('0xd'),'paranoid':![],'indexes':[{'name':_0xe1cf('0xe'),'fields':[_0xe1cf('0xf'),_0xe1cf('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3b3=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField'];(function(_0x5e1e96,_0x3bda1a){var _0x5dafb7=function(_0x5503e0){while(--_0x5503e0){_0x5e1e96['push'](_0x5e1e96['shift']());}};_0x5dafb7(++_0x3bda1a);}(_0xa3b3,0x199));var _0x3a3b=function(_0x913b35,_0x57d8eb){_0x913b35=_0x913b35-0x0;var _0x5c26ee=_0xa3b3[_0x913b35];return _0x5c26ee;};'use strict';var _=require(_0x3a3b('0x0'));var util=require(_0x3a3b('0x1'));var logger=require('../../config/logger')(_0x3a3b('0x2'));var moment=require(_0x3a3b('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a3b('0x4'));var fs=require('fs');var path=require(_0x3a3b('0x5'));var rimraf=require('rimraf');var config=require(_0x3a3b('0x6'));var attributes=require(_0x3a3b('0x7'));module[_0x3a3b('0x8')]=function(_0x40bb3e,_0x395171){return _0x40bb3e[_0x3a3b('0x9')](_0x3a3b('0xa'),attributes,{'tableName':_0x3a3b('0xb'),'paranoid':![],'indexes':[{'name':_0x3a3b('0xc'),'fields':[_0x3a3b('0xd'),_0x3a3b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 81beecb..f661bb3 100644 --- a/server/api/intZendeskField/intZendeskField.rpc.js +++ b/server/api/intZendeskField/intZendeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd16=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZendeskField,\x20%s,\x20%s','result','catch'];(function(_0x788a54,_0x12450b){var _0x8b73a4=function(_0x3b6271){while(--_0x3b6271){_0x788a54['push'](_0x788a54['shift']());}};_0x8b73a4(++_0x12450b);}(_0xbd16,0xc0));var _0x6bd1=function(_0x3b6d0c,_0x59669f){_0x3b6d0c=_0x3b6d0c-0x0;var _0x8be5b0=_0xbd16[_0x3b6d0c];return _0x8be5b0;};'use strict';var _=require(_0x6bd1('0x0'));var util=require('util');var moment=require(_0x6bd1('0x1'));var BPromise=require(_0x6bd1('0x2'));var rs=require(_0x6bd1('0x3'));var fs=require('fs');var Redis=require(_0x6bd1('0x4'));var db=require(_0x6bd1('0x5'))['db'];var utils=require(_0x6bd1('0x6'));var logger=require(_0x6bd1('0x7'))('rpc');var config=require(_0x6bd1('0x8'));var jayson=require(_0x6bd1('0x9'));var client=jayson[_0x6bd1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28b7aa,_0x4313d2,_0x4d138b){return new BPromise(function(_0x1cff6f,_0x34407b){return client[_0x6bd1('0xb')](_0x28b7aa,_0x4d138b)[_0x6bd1('0xc')](function(_0x5356a2){logger[_0x6bd1('0xd')]('ZendeskField,\x20%s,\x20%s',_0x4313d2,'request\x20sent');logger[_0x6bd1('0xe')](_0x6bd1('0xf'),_0x4313d2,_0x6bd1('0x10'),JSON[_0x6bd1('0x11')](_0x5356a2));if(_0x5356a2[_0x6bd1('0x12')]){if(_0x5356a2[_0x6bd1('0x12')][_0x6bd1('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4313d2,_0x5356a2[_0x6bd1('0x12')][_0x6bd1('0x14')]);return _0x34407b(_0x5356a2[_0x6bd1('0x12')][_0x6bd1('0x14')]);}logger[_0x6bd1('0x12')](_0x6bd1('0x15'),_0x4313d2,_0x5356a2[_0x6bd1('0x12')][_0x6bd1('0x14')]);return _0x1cff6f(_0x5356a2[_0x6bd1('0x12')][_0x6bd1('0x14')]);}else{logger[_0x6bd1('0xd')](_0x6bd1('0x15'),_0x4313d2,_0x6bd1('0x10'));_0x1cff6f(_0x5356a2[_0x6bd1('0x16')][_0x6bd1('0x14')]);}})[_0x6bd1('0x17')](function(_0x1bec5c){logger[_0x6bd1('0x12')](_0x6bd1('0x15'),_0x4313d2,_0x1bec5c);_0x34407b(_0x1bec5c);});});} \ No newline at end of file +var _0xe5e9=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3c34d5,_0xb38996){var _0x370391=function(_0x3e9672){while(--_0x3e9672){_0x3c34d5['push'](_0x3c34d5['shift']());}};_0x370391(++_0xb38996);}(_0xe5e9,0xd7));var _0x9e5e=function(_0x321728,_0x1fbc48){_0x321728=_0x321728-0x0;var _0x211876=_0xe5e9[_0x321728];return _0x211876;};'use strict';var _=require(_0x9e5e('0x0'));var util=require(_0x9e5e('0x1'));var moment=require(_0x9e5e('0x2'));var BPromise=require(_0x9e5e('0x3'));var rs=require(_0x9e5e('0x4'));var fs=require('fs');var Redis=require(_0x9e5e('0x5'));var db=require(_0x9e5e('0x6'))['db'];var utils=require(_0x9e5e('0x7'));var logger=require('../../config/logger')(_0x9e5e('0x8'));var config=require('../../config/environment');var jayson=require(_0x9e5e('0x9'));var client=jayson[_0x9e5e('0xa')][_0x9e5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30d348,_0x570217,_0xda18a7){return new BPromise(function(_0x54e2b0,_0x50941f){return client['request'](_0x30d348,_0xda18a7)[_0x9e5e('0xc')](function(_0x1932f0){logger[_0x9e5e('0xd')](_0x9e5e('0xe'),_0x570217,_0x9e5e('0xf'));logger[_0x9e5e('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x570217,_0x9e5e('0xf'),JSON[_0x9e5e('0x11')](_0x1932f0));if(_0x1932f0[_0x9e5e('0x12')]){if(_0x1932f0[_0x9e5e('0x12')][_0x9e5e('0x13')]===0x1f4){logger[_0x9e5e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x570217,_0x1932f0['error'][_0x9e5e('0x14')]);return _0x50941f(_0x1932f0[_0x9e5e('0x12')][_0x9e5e('0x14')]);}logger[_0x9e5e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x570217,_0x1932f0[_0x9e5e('0x12')][_0x9e5e('0x14')]);return _0x54e2b0(_0x1932f0['error'][_0x9e5e('0x14')]);}else{logger[_0x9e5e('0xd')](_0x9e5e('0xe'),_0x570217,_0x9e5e('0xf'));_0x54e2b0(_0x1932f0[_0x9e5e('0x15')][_0x9e5e('0x14')]);}})['catch'](function(_0x105ab9){logger[_0x9e5e('0x12')](_0x9e5e('0xe'),_0x570217,_0x105ab9);_0x50941f(_0x105ab9);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 788cc3f..e0dad58 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc918=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','getConfigurations','get','getFields','post','addConfiguration','put','/:id','update','destroy','multer','util'];(function(_0x11c985,_0x22095d){var _0x459984=function(_0x49d910){while(--_0x49d910){_0x11c985['push'](_0x11c985['shift']());}};_0x459984(++_0x22095d);}(_0xc918,0xb9));var _0x8c91=function(_0x3d0293,_0x6e70c2){_0x3d0293=_0x3d0293-0x0;var _0x254944=_0xc918[_0x3d0293];return _0x254944;};'use strict';var multer=require(_0x8c91('0x0'));var util=require(_0x8c91('0x1'));var path=require('path');var timeout=require(_0x8c91('0x2'));var express=require('express');var router=express[_0x8c91('0x3')]();var fs_extra=require(_0x8c91('0x4'));var auth=require(_0x8c91('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c91('0x6'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x8c91('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x8c91('0x7')](),controller[_0x8c91('0x8')]);router[_0x8c91('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8c91('0xa')]);router[_0x8c91('0xb')]('/',auth[_0x8c91('0x7')](),controller['create']);router['post']('/:id/configurations',auth[_0x8c91('0x7')](),controller[_0x8c91('0xc')]);router[_0x8c91('0xd')](_0x8c91('0xe'),auth[_0x8c91('0x7')](),controller[_0x8c91('0xf')]);router['delete'](_0x8c91('0xe'),auth[_0x8c91('0x7')](),controller[_0x8c91('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2d13=['show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','multer','path','connect-timeout','express','../../components/interaction/service','get','index','/:id','isAuthenticated'];(function(_0x2bd211,_0x522300){var _0x5b963e=function(_0x553314){while(--_0x553314){_0x2bd211['push'](_0x2bd211['shift']());}};_0x5b963e(++_0x522300);}(_0x2d13,0x147));var _0x32d1=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x2d13[_0x462999];return _0x4b1366;};'use strict';var multer=require(_0x32d1('0x0'));var util=require('util');var path=require(_0x32d1('0x1'));var timeout=require(_0x32d1('0x2'));var express=require(_0x32d1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x32d1('0x4'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x32d1('0x5')]('/',auth['isAuthenticated'](),controller[_0x32d1('0x6')]);router[_0x32d1('0x5')](_0x32d1('0x7'),auth[_0x32d1('0x8')](),controller[_0x32d1('0x9')]);router[_0x32d1('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x32d1('0xa')]);router['get'](_0x32d1('0xb'),auth[_0x32d1('0x8')](),controller[_0x32d1('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x32d1('0xd')](_0x32d1('0xe'),auth[_0x32d1('0x8')](),controller['addConfiguration']);router[_0x32d1('0xf')](_0x32d1('0x7'),auth[_0x32d1('0x8')](),controller['update']);router['delete'](_0x32d1('0x7'),auth[_0x32d1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a202bdf..0830110 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['exports','STRING','sequelize'];(function(_0x445c73,_0x14503b){var _0x59219e=function(_0x14c2a7){while(--_0x14c2a7){_0x445c73['push'](_0x445c73['shift']());}};_0x59219e(++_0x14503b);}(_0xe14d,0x1ee));var _0xde14=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe14d[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'description':{'type':Sequelize[_0xde14('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde14('0x2')]},'clientId':{'type':Sequelize[_0xde14('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xde14('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xde14('0x2')]},'refreshToken':{'type':Sequelize[_0xde14('0x2')]}}; \ No newline at end of file +var _0xec56=['STRING','sequelize'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xec56,0x1bd));var _0x6ec5=function(_0x44933b,_0x2b62c7){_0x44933b=_0x44933b-0x0;var _0x3709d7=_0xec56[_0x44933b];return _0x3709d7;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ec5('0x1')]},'host':{'type':Sequelize[_0x6ec5('0x1')]},'zone':{'type':Sequelize[_0x6ec5('0x1')]},'clientId':{'type':Sequelize[_0x6ec5('0x1')]},'clientSecret':{'type':Sequelize[_0x6ec5('0x1')]},'serverUrl':{'type':Sequelize[_0x6ec5('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x6ec5('0x1')]},'refreshToken':{'type':Sequelize[_0x6ec5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 79ed467..15548fb 100644 --- a/server/api/intZohoAccount/intZohoAccount.controller.js +++ b/server/api/intZohoAccount/intZohoAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa447=['squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','show','params','keys','find','catch','create','update','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash'];(function(_0x35c894,_0x3d29c8){var _0xc452ba=function(_0x483bcc){while(--_0x483bcc){_0x35c894['push'](_0x35c894['shift']());}};_0xc452ba(++_0x3d29c8);}(_0xa447,0x191));var _0x7a44=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xa447[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x7a44('0x0'));var rimraf=require(_0x7a44('0x1'));var zipdir=require(_0x7a44('0x2'));var jsonpatch=require(_0x7a44('0x3'));var rp=require(_0x7a44('0x4'));var moment=require(_0x7a44('0x5'));var BPromise=require(_0x7a44('0x6'));var Mustache=require(_0x7a44('0x7'));var util=require('util');var path=require(_0x7a44('0x8'));var sox=require(_0x7a44('0x9'));var csv=require('to-csv');var ejs=require(_0x7a44('0xa'));var fs=require('fs');var fs_extra=require(_0x7a44('0xb'));var _=require(_0x7a44('0xc'));var squel=require(_0x7a44('0xd'));var crypto=require('crypto');var jsforce=require(_0x7a44('0xe'));var deskjs=require(_0x7a44('0xf'));var toCsv=require(_0x7a44('0x10'));var querystring=require('querystring');var Papa=require(_0x7a44('0x11'));var Redis=require(_0x7a44('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a44('0x13'));var hardwareService=require(_0x7a44('0x14'));var logger=require(_0x7a44('0x15'))(_0x7a44('0x16'));var utils=require(_0x7a44('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7a44('0x18'));var db=require(_0x7a44('0x19'))['db'];var integrations=require(_0x7a44('0x1a'));function respondWithStatusCode(_0x4a2f5e,_0x44bf17){_0x44bf17=_0x44bf17||0xcc;return function(_0x401031){if(_0x401031){return _0x4a2f5e[_0x7a44('0x1b')](_0x44bf17);}return _0x4a2f5e[_0x7a44('0x1c')](_0x44bf17)[_0x7a44('0x1d')]();};}function respondWithResult(_0x4542ba,_0x2ac0f8){_0x2ac0f8=_0x2ac0f8||0xc8;return function(_0x1e2ade){if(_0x1e2ade){return _0x4542ba[_0x7a44('0x1c')](_0x2ac0f8)['json'](_0x1e2ade);}};}function respondWithFilteredResult(_0x3c1495,_0x1cc68c){return function(_0xd3ed9){if(_0xd3ed9){var _0x2cbeb1=typeof _0x1cc68c[_0x7a44('0x1e')]===_0x7a44('0x1f')&&typeof _0x1cc68c[_0x7a44('0x20')]===_0x7a44('0x1f');var _0x2d9df5=_0xd3ed9[_0x7a44('0x21')];var _0x527ee3=_0x2cbeb1?0x0:_0x1cc68c[_0x7a44('0x1e')];var _0x45d444=_0x2cbeb1?_0xd3ed9[_0x7a44('0x21')]:_0x1cc68c[_0x7a44('0x1e')]+_0x1cc68c[_0x7a44('0x20')];var _0x33b7e9;if(_0x45d444>=_0x2d9df5){_0x45d444=_0x2d9df5;_0x33b7e9=0xc8;}else{_0x33b7e9=0xce;}_0x3c1495[_0x7a44('0x1c')](_0x33b7e9);return _0x3c1495[_0x7a44('0x22')](_0x7a44('0x23'),_0x527ee3+'-'+_0x45d444+'/'+_0x2d9df5)[_0x7a44('0x24')](_0xd3ed9);}return null;};}function patchUpdates(_0x263b60){return function(_0x466339){try{jsonpatch[_0x7a44('0x25')](_0x466339,_0x263b60,!![]);}catch(_0x548b53){return BPromise[_0x7a44('0x26')](_0x548b53);}return _0x466339[_0x7a44('0x27')]();};}function saveUpdates(_0x45772f,_0xbb9903){return function(_0x44c48b){if(_0x44c48b){return _0x44c48b['update'](_0x45772f)[_0x7a44('0x28')](function(_0xb6be78){return _0xb6be78;});}return null;};}function removeEntity(_0x2b4fa7,_0x10a993){return function(_0x38fa65){if(_0x38fa65){return _0x38fa65[_0x7a44('0x29')]()[_0x7a44('0x28')](function(){_0x2b4fa7[_0x7a44('0x1c')](0xcc)[_0x7a44('0x1d')]();});}};}function handleEntityNotFound(_0x58b332,_0xbf2e57){return function(_0x26a9a2){if(!_0x26a9a2){_0x58b332[_0x7a44('0x1b')](0x194);}return _0x26a9a2;};}function handleError(_0x57cc30,_0x1d4fe6){_0x1d4fe6=_0x1d4fe6||0x1f4;return function(_0x40f512){logger[_0x7a44('0x2a')](_0x40f512[_0x7a44('0x2b')]);if(_0x40f512['name']){delete _0x40f512['name'];}_0x57cc30['status'](_0x1d4fe6)[_0x7a44('0x2c')](_0x40f512);};}exports[_0x7a44('0x2d')]=function(_0x282bd5,_0x108766){var _0x25ae4f={},_0x167dff={},_0x4231b9={'count':0x0,'rows':[]};var _0x15505a=_['map'](db['ZohoAccount'][_0x7a44('0x2e')],function(_0x5c7305){return{'name':_0x5c7305[_0x7a44('0x2f')],'type':_0x5c7305[_0x7a44('0x30')]['key']};});_0x167dff[_0x7a44('0x31')]=_[_0x7a44('0x32')](_0x15505a,_0x7a44('0x33'));_0x167dff[_0x7a44('0x34')]=_['keys'](_0x282bd5[_0x7a44('0x34')]);_0x167dff[_0x7a44('0x35')]=_[_0x7a44('0x36')](_0x167dff[_0x7a44('0x31')],_0x167dff[_0x7a44('0x34')]);_0x25ae4f[_0x7a44('0x37')]=_[_0x7a44('0x36')](_0x167dff[_0x7a44('0x31')],qs[_0x7a44('0x38')](_0x282bd5[_0x7a44('0x34')][_0x7a44('0x38')]));_0x25ae4f[_0x7a44('0x37')]=_0x25ae4f['attributes'][_0x7a44('0x39')]?_0x25ae4f['attributes']:_0x167dff[_0x7a44('0x31')];if(!_0x282bd5[_0x7a44('0x34')][_0x7a44('0x3a')](_0x7a44('0x3b'))){_0x25ae4f[_0x7a44('0x20')]=qs[_0x7a44('0x20')](_0x282bd5['query'][_0x7a44('0x20')]);_0x25ae4f[_0x7a44('0x1e')]=qs[_0x7a44('0x1e')](_0x282bd5[_0x7a44('0x34')][_0x7a44('0x1e')]);}_0x25ae4f[_0x7a44('0x3c')]=qs[_0x7a44('0x3d')](_0x282bd5['query'][_0x7a44('0x3d')]);_0x25ae4f[_0x7a44('0x3e')]=qs[_0x7a44('0x35')](_[_0x7a44('0x3f')](_0x282bd5[_0x7a44('0x34')],_0x167dff[_0x7a44('0x35')]),_0x15505a);if(_0x282bd5[_0x7a44('0x34')][_0x7a44('0x40')]){_0x25ae4f[_0x7a44('0x3e')]=_[_0x7a44('0x41')](_0x25ae4f[_0x7a44('0x3e')],{'$or':_['map'](_0x15505a,function(_0x1a4d06){if(_0x1a4d06[_0x7a44('0x30')]!==_0x7a44('0x42')){var _0x290123={};_0x290123[_0x1a4d06['name']]={'$like':'%'+_0x282bd5[_0x7a44('0x34')]['filter']+'%'};return _0x290123;}})});}_0x25ae4f=_[_0x7a44('0x41')]({},_0x25ae4f,_0x282bd5[_0x7a44('0x43')]);var _0x40f437={'where':_0x25ae4f[_0x7a44('0x3e')]};return db[_0x7a44('0x44')][_0x7a44('0x21')](_0x40f437)[_0x7a44('0x28')](function(_0x41afd2){_0x4231b9[_0x7a44('0x21')]=_0x41afd2;if(_0x282bd5[_0x7a44('0x34')][_0x7a44('0x45')]){_0x25ae4f[_0x7a44('0x46')]=[{'all':!![]}];}return db[_0x7a44('0x44')][_0x7a44('0x47')](_0x25ae4f);})[_0x7a44('0x28')](function(_0x4bd8b){_0x4231b9[_0x7a44('0x48')]=_0x4bd8b;return _0x4231b9;})['then'](respondWithFilteredResult(_0x108766,_0x25ae4f))['catch'](handleError(_0x108766,null));};exports[_0x7a44('0x49')]=function(_0x96cc06,_0x17d659){var _0xbf9528={'raw':![],'where':{'id':_0x96cc06[_0x7a44('0x4a')]['id']}},_0x2e21fc={};_0x2e21fc[_0x7a44('0x31')]=_[_0x7a44('0x4b')](db[_0x7a44('0x44')][_0x7a44('0x2e')]);_0x2e21fc[_0x7a44('0x34')]=_[_0x7a44('0x4b')](_0x96cc06[_0x7a44('0x34')]);_0x2e21fc[_0x7a44('0x35')]=_[_0x7a44('0x36')](_0x2e21fc['model'],_0x2e21fc[_0x7a44('0x34')]);_0xbf9528['attributes']=_[_0x7a44('0x36')](_0x2e21fc[_0x7a44('0x31')],qs['fields'](_0x96cc06[_0x7a44('0x34')][_0x7a44('0x38')]));_0xbf9528['attributes']=_0xbf9528['attributes'][_0x7a44('0x39')]?_0xbf9528['attributes']:_0x2e21fc[_0x7a44('0x31')];if(_0x96cc06['query'][_0x7a44('0x45')]){_0xbf9528[_0x7a44('0x46')]=[{'all':!![]}];}_0xbf9528=_[_0x7a44('0x41')]({},_0xbf9528,_0x96cc06[_0x7a44('0x43')]);return db[_0x7a44('0x44')][_0x7a44('0x4c')](_0xbf9528)[_0x7a44('0x28')](handleEntityNotFound(_0x17d659,null))['then'](respondWithResult(_0x17d659,null))[_0x7a44('0x4d')](handleError(_0x17d659,null));};exports['create']=function(_0x90ae7c,_0x2e87fa){return db[_0x7a44('0x44')][_0x7a44('0x4e')](_0x90ae7c['body'],{})[_0x7a44('0x28')](respondWithResult(_0x2e87fa,0xc9))[_0x7a44('0x4d')](handleError(_0x2e87fa,null));};exports[_0x7a44('0x4f')]=function(_0x646e1d,_0x3c1b26){if(_0x646e1d[_0x7a44('0x50')]['id']){delete _0x646e1d['body']['id'];}return db['ZohoAccount'][_0x7a44('0x4c')]({'where':{'id':_0x646e1d[_0x7a44('0x4a')]['id']}})[_0x7a44('0x28')](handleEntityNotFound(_0x3c1b26,null))[_0x7a44('0x28')](saveUpdates(_0x646e1d['body'],null))[_0x7a44('0x28')](respondWithResult(_0x3c1b26,null))[_0x7a44('0x4d')](handleError(_0x3c1b26,null));};exports[_0x7a44('0x29')]=function(_0x12ee27,_0x4ce9d4){return db[_0x7a44('0x44')][_0x7a44('0x4c')]({'where':{'id':_0x12ee27['params']['id']}})[_0x7a44('0x28')](handleEntityNotFound(_0x4ce9d4,null))['then'](removeEntity(_0x4ce9d4,null))[_0x7a44('0x4d')](handleError(_0x4ce9d4,null));};exports[_0x7a44('0x51')]=function(_0x59e4f6,_0x45ba47,_0x36fe9c){var _0x5f12df={};var _0x28daf4={};var _0x33c1c1;var _0x2510e9;return db['ZohoAccount']['findOne']({'where':{'id':_0x59e4f6[_0x7a44('0x4a')]['id']}})[_0x7a44('0x28')](handleEntityNotFound(_0x45ba47,null))[_0x7a44('0x28')](function(_0x1cec46){if(_0x1cec46){_0x33c1c1=_0x1cec46;_0x28daf4['model']=_[_0x7a44('0x4b')](db[_0x7a44('0x52')][_0x7a44('0x2e')]);_0x28daf4['query']=_[_0x7a44('0x4b')](_0x59e4f6['query']);_0x28daf4[_0x7a44('0x35')]=_[_0x7a44('0x36')](_0x28daf4[_0x7a44('0x31')],_0x28daf4['query']);_0x5f12df[_0x7a44('0x37')]=_[_0x7a44('0x36')](_0x28daf4[_0x7a44('0x31')],qs[_0x7a44('0x38')](_0x59e4f6[_0x7a44('0x34')][_0x7a44('0x38')]));_0x5f12df[_0x7a44('0x37')]=_0x5f12df[_0x7a44('0x37')][_0x7a44('0x39')]?_0x5f12df[_0x7a44('0x37')]:_0x28daf4[_0x7a44('0x31')];_0x5f12df['order']=qs[_0x7a44('0x3d')](_0x59e4f6[_0x7a44('0x34')][_0x7a44('0x3d')]);_0x5f12df[_0x7a44('0x3e')]=qs[_0x7a44('0x35')](_[_0x7a44('0x3f')](_0x59e4f6[_0x7a44('0x34')],_0x28daf4[_0x7a44('0x35')]));if(_0x59e4f6['query'][_0x7a44('0x40')]){_0x5f12df[_0x7a44('0x3e')]=_[_0x7a44('0x41')](_0x5f12df[_0x7a44('0x3e')],{'$or':_[_0x7a44('0x32')](_0x5f12df['attributes'],function(_0x269d34){var _0x231000={};_0x231000[_0x269d34]={'$like':'%'+_0x59e4f6['query'][_0x7a44('0x40')]+'%'};return _0x231000;})});}_0x5f12df=_[_0x7a44('0x41')]({},_0x5f12df,_0x59e4f6[_0x7a44('0x43')]);return _0x33c1c1[_0x7a44('0x51')](_0x5f12df);}})[_0x7a44('0x28')](function(_0x41241a){if(_0x41241a){_0x2510e9=_0x41241a[_0x7a44('0x39')];if(!_0x59e4f6['query']['hasOwnProperty'](_0x7a44('0x3b'))){_0x5f12df['limit']=qs['limit'](_0x59e4f6['query'][_0x7a44('0x20')]);_0x5f12df[_0x7a44('0x1e')]=qs[_0x7a44('0x1e')](_0x59e4f6[_0x7a44('0x34')][_0x7a44('0x1e')]);}return _0x33c1c1[_0x7a44('0x51')](_0x5f12df);}})[_0x7a44('0x28')](function(_0xe82d91){if(_0xe82d91){return _0xe82d91?{'count':_0x2510e9,'rows':_0xe82d91}:null;}})[_0x7a44('0x28')](respondWithResult(_0x45ba47,null))[_0x7a44('0x4d')](handleError(_0x45ba47,null));};exports[_0x7a44('0x53')]=function(_0x24cfaa,_0x72863e,_0x50d652){if(_0x24cfaa[_0x7a44('0x50')]['id']){delete _0x24cfaa[_0x7a44('0x50')]['id'];}return db[_0x7a44('0x44')][_0x7a44('0x54')]({'where':{'id':_0x24cfaa[_0x7a44('0x4a')]['id']}})['then'](handleEntityNotFound(_0x72863e,null))[_0x7a44('0x28')](function(_0xe11bb1){if(_0xe11bb1){_0x24cfaa['body'][_0x7a44('0x55')]=_0xe11bb1['id'];_0x24cfaa[_0x7a44('0x50')]['Subjects']=integrations[_0x7a44('0x56')](_0x24cfaa['body']['channel'],_0x24cfaa[_0x7a44('0x50')][_0x7a44('0x30')]);_0x24cfaa[_0x7a44('0x50')][_0x7a44('0x57')]=integrations[_0x7a44('0x58')](_0x24cfaa['body'][_0x7a44('0x59')],_0x24cfaa[_0x7a44('0x50')][_0x7a44('0x30')]);return db[_0x7a44('0x52')][_0x7a44('0x4e')](_0x24cfaa['body'],{'include':[{'model':db['ZohoField'],'as':_0x7a44('0x5a')},{'model':db['ZohoField'],'as':_0x7a44('0x57')}]});}return null;})[_0x7a44('0x28')](respondWithResult(_0x72863e,null))[_0x7a44('0x4d')](handleError(_0x72863e,null));};function getAccessToken(_0x572815){return new Promise(function(_0x476195,_0x5841db){var _0x134c8c;switch(_0x572815[_0x7a44('0x5b')]){case'US':_0x134c8c=_0x7a44('0x5c');break;case'AU':_0x134c8c=_0x7a44('0x5d');break;case'EU':_0x134c8c=_0x7a44('0x5e');break;case'IN':_0x134c8c=_0x7a44('0x5f');break;case'CN':_0x134c8c='https://accounts.zoho.com.cn';break;default:_0x134c8c=_0x7a44('0x5e');break;}var _0x24460a={'method':'POST','uri':_0x134c8c+_0x7a44('0x60'),'qs':{'refresh_token':_0x572815[_0x7a44('0x61')],'client_id':_0x572815['clientId'],'client_secret':_0x572815[_0x7a44('0x62')],'grant_type':_0x7a44('0x63')},'json':!![]};return rp(_0x24460a)[_0x7a44('0x28')](function(_0xf496e6){if(_0xf496e6['access_token']){_0x476195(_0xf496e6[_0x7a44('0x64')]);}else{_0x5841db(_0x7a44('0x65'));}})['catch'](function(_0x4b4574){_0x5841db(_0x4b4574);});});}exports['getFields']=function(_0x17b0a5,_0x347e30,_0x1ae255){var _0x5df238,_0x21ab80,_0x3f2410,_0x4c39cb,_0x434606;return db[_0x7a44('0x44')][_0x7a44('0x54')]({'where':{'id':_0x17b0a5[_0x7a44('0x4a')]['id']},'attributes':['id',_0x7a44('0x66'),'zone',_0x7a44('0x67'),_0x7a44('0x62'),_0x7a44('0x68'),_0x7a44('0x69'),'refreshToken']})[_0x7a44('0x28')](handleEntityNotFound(_0x347e30,null))[_0x7a44('0x28')](function(_0x49c090){_0x434606=_0x49c090;_0x5df238=_0x434606[_0x7a44('0x66')];_0x21ab80=_0x5df238===_0x7a44('0x6a')?'eu':'com';_0x3f2410=_0x434606[_0x7a44('0x68')];var _0x58aaef=_0x3f2410[_0x7a44('0x6b')](-0x1);if(_0x58aaef==='/'||_0x58aaef==='\x5c'||_0x58aaef===':'){_0x3f2410=_0x3f2410[_0x7a44('0x6c')](0x0,_0x3f2410[_0x7a44('0x6d')](_0x58aaef));}if(!_0x434606['refreshToken']){throw new Error(_0x7a44('0x6e'));}return getAccessToken(_0x434606);})[_0x7a44('0x28')](function(_0x3b826d){if(_0x3b826d){return rp({'method':_0x7a44('0x6f'),'uri':util['format'](_0x7a44('0x70'),_0x21ab80),'qs':{'module':_0x7a44('0x71')},'headers':{'Authorization':_0x7a44('0x72')+_0x3b826d},'json':!![]});}})[_0x7a44('0x28')](function(_0xe518bc){if(_0xe518bc){if(_0xe518bc[_0x7a44('0x73')]&&_0xe518bc[_0x7a44('0x73')]['error']){throw new Error(_0xe518bc['response'][_0x7a44('0x2a')][_0x7a44('0x74')]);}var _0x349ee1=[];var _0x291e43=[];var _0x16b7ea=[_0x7a44('0x75'),_0x7a44('0x76'),_0x7a44('0x77'),'WhoId',_0x7a44('0x78'),_0x7a44('0x79'),_0x7a44('0x7a'),_0x7a44('0x7b')];_0x291e43=_['remove'](_0xe518bc[_0x7a44('0x38')],function(_0x4b45e2){return _0x16b7ea[_0x7a44('0x7c')](_0x4b45e2[_0x7a44('0x7d')]);});for(var _0x16fbd0=0x0;_0x16fbd0<_0x291e43[_0x7a44('0x39')];_0x16fbd0++){if(_0x291e43[_0x16fbd0][_0x7a44('0x7e')]===![]){_0x349ee1[_0x7a44('0x7f')]({'id':_0x291e43[_0x16fbd0]['id'],'name':_0x291e43[_0x16fbd0][_0x7a44('0x80')],'custom':_0x291e43[_0x16fbd0][_0x7a44('0x81')],'options':_0x291e43[_0x16fbd0][_0x7a44('0x82')]===_0x7a44('0x83')&&_0x291e43[_0x16fbd0][_0x7a44('0x84')]['length']>-0x1?_[_0x7a44('0x32')](_0x291e43[_0x16fbd0][_0x7a44('0x84')],function(_0x968b0c){return{'name':_0x968b0c,'value':_0x968b0c};}):[]});}}return{'count':_0x349ee1[_0x7a44('0x39')],'rows':_0x349ee1};}else{return{'count':0x0,'rows':[]};}})[_0x7a44('0x28')](respondWithResult(_0x347e30,null))[_0x7a44('0x4d')](function(_0x49720c){var _0x154a2c=_0x17b0a5[_0x7a44('0x34')]['test']?0x1f4:_0x49720c[_0x7a44('0x85')]||0x1f4;logger[_0x7a44('0x2a')](_0x7a44('0x86'),'getFields',_0x154a2c,JSON[_0x7a44('0x87')](_0x49720c));delete _0x49720c[_0x7a44('0x33')];if(_0x154a2c===0x191){_0x154a2c=0x190;}_0x347e30[_0x7a44('0x1c')](_0x154a2c)[_0x7a44('0x2c')](_0x17b0a5[_0x7a44('0x34')][_0x7a44('0x88')]?{'message':_0x7a44('0x89'),'statusCode':_0x49720c['statusCode']}:_0x49720c);});}; \ No newline at end of file +var _0xede4=['limit','undefined','count','Content-Range','apply','reject','save','destroy','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','ZohoAccount','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xede4,0xe5));var _0x4ede=function(_0x2bc30e,_0xa1650f){_0x2bc30e=_0x2bc30e-0x0;var _0x43d8cb=_0xede4[_0x2bc30e];return _0x43d8cb;};'use strict';var emlformat=require(_0x4ede('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4ede('0x1'));var rp=require(_0x4ede('0x2'));var moment=require('moment');var BPromise=require(_0x4ede('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ede('0x4'));var sox=require(_0x4ede('0x5'));var csv=require('to-csv');var ejs=require(_0x4ede('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ede('0x7'));var squel=require(_0x4ede('0x8'));var crypto=require(_0x4ede('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4ede('0xa'));var toCsv=require(_0x4ede('0xb'));var querystring=require(_0x4ede('0xc'));var Papa=require(_0x4ede('0xd'));var Redis=require('ioredis');var authService=require(_0x4ede('0xe'));var qs=require(_0x4ede('0xf'));var as=require(_0x4ede('0x10'));var hardwareService=require(_0x4ede('0x11'));var logger=require(_0x4ede('0x12'))(_0x4ede('0x13'));var utils=require('../../config/utils');var config=require(_0x4ede('0x14'));var licenseUtil=require(_0x4ede('0x15'));var db=require(_0x4ede('0x16'))['db'];var integrations=require(_0x4ede('0x17'));function respondWithStatusCode(_0x2a9b37,_0xf985df){_0xf985df=_0xf985df||0xcc;return function(_0x77c554){if(_0x77c554){return _0x2a9b37[_0x4ede('0x18')](_0xf985df);}return _0x2a9b37[_0x4ede('0x19')](_0xf985df)[_0x4ede('0x1a')]();};}function respondWithResult(_0x68b561,_0x29162c){_0x29162c=_0x29162c||0xc8;return function(_0x442bc2){if(_0x442bc2){return _0x68b561['status'](_0x29162c)[_0x4ede('0x1b')](_0x442bc2);}};}function respondWithFilteredResult(_0x4048dc,_0x1dd6dc){return function(_0x219bc0){if(_0x219bc0){var _0x75e890=typeof _0x1dd6dc[_0x4ede('0x1c')]==='undefined'&&typeof _0x1dd6dc[_0x4ede('0x1d')]===_0x4ede('0x1e');var _0x527d20=_0x219bc0['count'];var _0x3121ca=_0x75e890?0x0:_0x1dd6dc[_0x4ede('0x1c')];var _0x1980af=_0x75e890?_0x219bc0[_0x4ede('0x1f')]:_0x1dd6dc[_0x4ede('0x1c')]+_0x1dd6dc[_0x4ede('0x1d')];var _0x589311;if(_0x1980af>=_0x527d20){_0x1980af=_0x527d20;_0x589311=0xc8;}else{_0x589311=0xce;}_0x4048dc[_0x4ede('0x19')](_0x589311);return _0x4048dc['set'](_0x4ede('0x20'),_0x3121ca+'-'+_0x1980af+'/'+_0x527d20)['json'](_0x219bc0);}return null;};}function patchUpdates(_0x1470d8){return function(_0x15e55a){try{jsonpatch[_0x4ede('0x21')](_0x15e55a,_0x1470d8,!![]);}catch(_0x107867){return BPromise[_0x4ede('0x22')](_0x107867);}return _0x15e55a[_0x4ede('0x23')]();};}function saveUpdates(_0x294bcd,_0x13574f){return function(_0x5cfef6){if(_0x5cfef6){return _0x5cfef6['update'](_0x294bcd)['then'](function(_0x211f67){return _0x211f67;});}return null;};}function removeEntity(_0x14e9a9,_0x5893b6){return function(_0x1be781){if(_0x1be781){return _0x1be781[_0x4ede('0x24')]()[_0x4ede('0x25')](function(){_0x14e9a9['status'](0xcc)[_0x4ede('0x1a')]();});}};}function handleEntityNotFound(_0x2d4015,_0x555199){return function(_0x6f4c7a){if(!_0x6f4c7a){_0x2d4015['sendStatus'](0x194);}return _0x6f4c7a;};}function handleError(_0x13a0a4,_0x53fa84){_0x53fa84=_0x53fa84||0x1f4;return function(_0x313428){logger[_0x4ede('0x26')](_0x313428['stack']);if(_0x313428[_0x4ede('0x27')]){delete _0x313428[_0x4ede('0x27')];}_0x13a0a4[_0x4ede('0x19')](_0x53fa84)[_0x4ede('0x28')](_0x313428);};}exports['index']=function(_0x15357e,_0x313911){var _0x34b5ec={},_0x2cfc8f={},_0xb07aa8={'count':0x0,'rows':[]};var _0x28c9f0=_[_0x4ede('0x29')](db['ZohoAccount'][_0x4ede('0x2a')],function(_0x8cc73b){return{'name':_0x8cc73b[_0x4ede('0x2b')],'type':_0x8cc73b[_0x4ede('0x2c')][_0x4ede('0x2d')]};});_0x2cfc8f[_0x4ede('0x2e')]=_[_0x4ede('0x29')](_0x28c9f0,_0x4ede('0x27'));_0x2cfc8f['query']=_['keys'](_0x15357e[_0x4ede('0x2f')]);_0x2cfc8f[_0x4ede('0x30')]=_[_0x4ede('0x31')](_0x2cfc8f[_0x4ede('0x2e')],_0x2cfc8f[_0x4ede('0x2f')]);_0x34b5ec[_0x4ede('0x32')]=_[_0x4ede('0x31')](_0x2cfc8f['model'],qs[_0x4ede('0x33')](_0x15357e[_0x4ede('0x2f')]['fields']));_0x34b5ec[_0x4ede('0x32')]=_0x34b5ec[_0x4ede('0x32')][_0x4ede('0x34')]?_0x34b5ec[_0x4ede('0x32')]:_0x2cfc8f[_0x4ede('0x2e')];if(!_0x15357e[_0x4ede('0x2f')][_0x4ede('0x35')](_0x4ede('0x36'))){_0x34b5ec[_0x4ede('0x1d')]=qs[_0x4ede('0x1d')](_0x15357e[_0x4ede('0x2f')][_0x4ede('0x1d')]);_0x34b5ec[_0x4ede('0x1c')]=qs[_0x4ede('0x1c')](_0x15357e[_0x4ede('0x2f')][_0x4ede('0x1c')]);}_0x34b5ec['order']=qs['sort'](_0x15357e[_0x4ede('0x2f')][_0x4ede('0x37')]);_0x34b5ec[_0x4ede('0x38')]=qs['filters'](_[_0x4ede('0x39')](_0x15357e[_0x4ede('0x2f')],_0x2cfc8f['filters']),_0x28c9f0);if(_0x15357e[_0x4ede('0x2f')][_0x4ede('0x3a')]){_0x34b5ec[_0x4ede('0x38')]=_['merge'](_0x34b5ec[_0x4ede('0x38')],{'$or':_[_0x4ede('0x29')](_0x28c9f0,function(_0x163905){if(_0x163905[_0x4ede('0x2c')]!==_0x4ede('0x3b')){var _0x7343f3={};_0x7343f3[_0x163905[_0x4ede('0x27')]]={'$like':'%'+_0x15357e[_0x4ede('0x2f')]['filter']+'%'};return _0x7343f3;}})});}_0x34b5ec=_[_0x4ede('0x3c')]({},_0x34b5ec,_0x15357e[_0x4ede('0x3d')]);var _0x1462e9={'where':_0x34b5ec[_0x4ede('0x38')]};return db['ZohoAccount']['count'](_0x1462e9)[_0x4ede('0x25')](function(_0x491965){_0xb07aa8[_0x4ede('0x1f')]=_0x491965;if(_0x15357e[_0x4ede('0x2f')][_0x4ede('0x3e')]){_0x34b5ec[_0x4ede('0x3f')]=[{'all':!![]}];}return db[_0x4ede('0x40')][_0x4ede('0x41')](_0x34b5ec);})[_0x4ede('0x25')](function(_0x28f396){_0xb07aa8[_0x4ede('0x42')]=_0x28f396;return _0xb07aa8;})[_0x4ede('0x25')](respondWithFilteredResult(_0x313911,_0x34b5ec))[_0x4ede('0x43')](handleError(_0x313911,null));};exports[_0x4ede('0x44')]=function(_0xcbf4bf,_0x27e475){var _0x102aa1={'raw':![],'where':{'id':_0xcbf4bf['params']['id']}},_0x3a2984={};_0x3a2984[_0x4ede('0x2e')]=_[_0x4ede('0x45')](db[_0x4ede('0x40')]['rawAttributes']);_0x3a2984[_0x4ede('0x2f')]=_[_0x4ede('0x45')](_0xcbf4bf[_0x4ede('0x2f')]);_0x3a2984[_0x4ede('0x30')]=_[_0x4ede('0x31')](_0x3a2984[_0x4ede('0x2e')],_0x3a2984[_0x4ede('0x2f')]);_0x102aa1[_0x4ede('0x32')]=_['intersection'](_0x3a2984[_0x4ede('0x2e')],qs['fields'](_0xcbf4bf[_0x4ede('0x2f')][_0x4ede('0x33')]));_0x102aa1[_0x4ede('0x32')]=_0x102aa1[_0x4ede('0x32')][_0x4ede('0x34')]?_0x102aa1[_0x4ede('0x32')]:_0x3a2984[_0x4ede('0x2e')];if(_0xcbf4bf['query'][_0x4ede('0x3e')]){_0x102aa1[_0x4ede('0x3f')]=[{'all':!![]}];}_0x102aa1=_[_0x4ede('0x3c')]({},_0x102aa1,_0xcbf4bf[_0x4ede('0x3d')]);return db['ZohoAccount'][_0x4ede('0x46')](_0x102aa1)['then'](handleEntityNotFound(_0x27e475,null))[_0x4ede('0x25')](respondWithResult(_0x27e475,null))[_0x4ede('0x43')](handleError(_0x27e475,null));};exports['create']=function(_0x5e44b9,_0x58238b){return db['ZohoAccount'][_0x4ede('0x47')](_0x5e44b9[_0x4ede('0x48')],{})[_0x4ede('0x25')](respondWithResult(_0x58238b,0xc9))[_0x4ede('0x43')](handleError(_0x58238b,null));};exports['update']=function(_0x63a59d,_0x12c8c1){if(_0x63a59d['body']['id']){delete _0x63a59d[_0x4ede('0x48')]['id'];}return db[_0x4ede('0x40')]['find']({'where':{'id':_0x63a59d[_0x4ede('0x49')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x12c8c1,null))[_0x4ede('0x25')](saveUpdates(_0x63a59d[_0x4ede('0x48')],null))[_0x4ede('0x25')](respondWithResult(_0x12c8c1,null))['catch'](handleError(_0x12c8c1,null));};exports[_0x4ede('0x24')]=function(_0x1f3ec6,_0x3b19a9){return db[_0x4ede('0x40')][_0x4ede('0x46')]({'where':{'id':_0x1f3ec6[_0x4ede('0x49')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x3b19a9,null))[_0x4ede('0x25')](removeEntity(_0x3b19a9,null))[_0x4ede('0x43')](handleError(_0x3b19a9,null));};exports[_0x4ede('0x4a')]=function(_0x312f71,_0x54cebf,_0x2a6a95){var _0x55a73a={};var _0x3b3d92={};var _0x2766c6;var _0x4592bd;return db[_0x4ede('0x40')][_0x4ede('0x4b')]({'where':{'id':_0x312f71[_0x4ede('0x49')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x54cebf,null))[_0x4ede('0x25')](function(_0x57c767){if(_0x57c767){_0x2766c6=_0x57c767;_0x3b3d92[_0x4ede('0x2e')]=_['keys'](db['ZohoConfiguration'][_0x4ede('0x2a')]);_0x3b3d92[_0x4ede('0x2f')]=_[_0x4ede('0x45')](_0x312f71[_0x4ede('0x2f')]);_0x3b3d92[_0x4ede('0x30')]=_[_0x4ede('0x31')](_0x3b3d92[_0x4ede('0x2e')],_0x3b3d92[_0x4ede('0x2f')]);_0x55a73a['attributes']=_[_0x4ede('0x31')](_0x3b3d92[_0x4ede('0x2e')],qs[_0x4ede('0x33')](_0x312f71[_0x4ede('0x2f')][_0x4ede('0x33')]));_0x55a73a['attributes']=_0x55a73a[_0x4ede('0x32')]['length']?_0x55a73a[_0x4ede('0x32')]:_0x3b3d92[_0x4ede('0x2e')];_0x55a73a['order']=qs[_0x4ede('0x37')](_0x312f71['query']['sort']);_0x55a73a[_0x4ede('0x38')]=qs[_0x4ede('0x30')](_[_0x4ede('0x39')](_0x312f71[_0x4ede('0x2f')],_0x3b3d92['filters']));if(_0x312f71['query'][_0x4ede('0x3a')]){_0x55a73a[_0x4ede('0x38')]=_[_0x4ede('0x3c')](_0x55a73a[_0x4ede('0x38')],{'$or':_['map'](_0x55a73a['attributes'],function(_0x838eed){var _0x2382b6={};_0x2382b6[_0x838eed]={'$like':'%'+_0x312f71['query'][_0x4ede('0x3a')]+'%'};return _0x2382b6;})});}_0x55a73a=_[_0x4ede('0x3c')]({},_0x55a73a,_0x312f71[_0x4ede('0x3d')]);return _0x2766c6[_0x4ede('0x4a')](_0x55a73a);}})[_0x4ede('0x25')](function(_0x217df2){if(_0x217df2){_0x4592bd=_0x217df2[_0x4ede('0x34')];if(!_0x312f71[_0x4ede('0x2f')][_0x4ede('0x35')](_0x4ede('0x36'))){_0x55a73a[_0x4ede('0x1d')]=qs[_0x4ede('0x1d')](_0x312f71['query']['limit']);_0x55a73a[_0x4ede('0x1c')]=qs['offset'](_0x312f71[_0x4ede('0x2f')][_0x4ede('0x1c')]);}return _0x2766c6[_0x4ede('0x4a')](_0x55a73a);}})[_0x4ede('0x25')](function(_0x151b77){if(_0x151b77){return _0x151b77?{'count':_0x4592bd,'rows':_0x151b77}:null;}})[_0x4ede('0x25')](respondWithResult(_0x54cebf,null))[_0x4ede('0x43')](handleError(_0x54cebf,null));};exports[_0x4ede('0x4c')]=function(_0x583023,_0x5d788a,_0x19a552){if(_0x583023['body']['id']){delete _0x583023[_0x4ede('0x48')]['id'];}return db[_0x4ede('0x40')][_0x4ede('0x4b')]({'where':{'id':_0x583023[_0x4ede('0x49')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x5d788a,null))[_0x4ede('0x25')](function(_0x4f2c90){if(_0x4f2c90){_0x583023[_0x4ede('0x48')]['AccountId']=_0x4f2c90['id'];_0x583023[_0x4ede('0x48')][_0x4ede('0x4d')]=integrations[_0x4ede('0x4e')](_0x583023[_0x4ede('0x48')][_0x4ede('0x4f')],_0x583023[_0x4ede('0x48')][_0x4ede('0x2c')]);_0x583023[_0x4ede('0x48')]['Descriptions']=integrations[_0x4ede('0x50')](_0x583023[_0x4ede('0x48')][_0x4ede('0x4f')],_0x583023[_0x4ede('0x48')][_0x4ede('0x2c')]);return db['ZohoConfiguration'][_0x4ede('0x47')](_0x583023['body'],{'include':[{'model':db[_0x4ede('0x51')],'as':_0x4ede('0x4d')},{'model':db[_0x4ede('0x51')],'as':_0x4ede('0x52')}]});}return null;})[_0x4ede('0x25')](respondWithResult(_0x5d788a,null))['catch'](handleError(_0x5d788a,null));};function getAccessToken(_0x85d573){return new Promise(function(_0x4773fa,_0x230afc){var _0x5daca5;switch(_0x85d573[_0x4ede('0x53')]){case'US':_0x5daca5=_0x4ede('0x54');break;case'AU':_0x5daca5=_0x4ede('0x55');break;case'EU':_0x5daca5=_0x4ede('0x56');break;case'IN':_0x5daca5='https://accounts.zoho.in';break;case'CN':_0x5daca5=_0x4ede('0x57');break;default:_0x5daca5='https://accounts.zoho.eu';break;}var _0x5c0460={'method':_0x4ede('0x58'),'uri':_0x5daca5+_0x4ede('0x59'),'qs':{'refresh_token':_0x85d573['refreshToken'],'client_id':_0x85d573['clientId'],'client_secret':_0x85d573[_0x4ede('0x5a')],'grant_type':_0x4ede('0x5b')},'json':!![]};return rp(_0x5c0460)['then'](function(_0x842014){if(_0x842014[_0x4ede('0x5c')]){_0x4773fa(_0x842014[_0x4ede('0x5c')]);}else{_0x230afc(_0x4ede('0x5d'));}})[_0x4ede('0x43')](function(_0x145a26){_0x230afc(_0x145a26);});});}exports[_0x4ede('0x5e')]=function(_0x472f39,_0xc2f46b,_0x44c109){var _0x2f3c9e,_0x30e5c5,_0x2acf34,_0x28daba,_0x2290d5;return db[_0x4ede('0x40')][_0x4ede('0x4b')]({'where':{'id':_0x472f39[_0x4ede('0x49')]['id']},'attributes':['id',_0x4ede('0x5f'),_0x4ede('0x53'),_0x4ede('0x60'),_0x4ede('0x5a'),'serverUrl','code',_0x4ede('0x61')]})[_0x4ede('0x25')](handleEntityNotFound(_0xc2f46b,null))[_0x4ede('0x25')](function(_0x45d076){_0x2290d5=_0x45d076;_0x2f3c9e=_0x2290d5[_0x4ede('0x5f')];_0x30e5c5=_0x2f3c9e===_0x4ede('0x62')?'eu':_0x4ede('0x63');_0x2acf34=_0x2290d5[_0x4ede('0x64')];var _0x2d5576=_0x2acf34[_0x4ede('0x65')](-0x1);if(_0x2d5576==='/'||_0x2d5576==='\x5c'||_0x2d5576===':'){_0x2acf34=_0x2acf34[_0x4ede('0x66')](0x0,_0x2acf34[_0x4ede('0x67')](_0x2d5576));}if(!_0x2290d5['refreshToken']){throw new Error(_0x4ede('0x68'));}return getAccessToken(_0x2290d5);})['then'](function(_0x927edf){if(_0x927edf){return rp({'method':_0x4ede('0x69'),'uri':util[_0x4ede('0x6a')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x30e5c5),'qs':{'module':'Calls'},'headers':{'Authorization':_0x4ede('0x6b')+_0x927edf},'json':!![]});}})['then'](function(_0x18c989){if(_0x18c989){if(_0x18c989[_0x4ede('0x6c')]&&_0x18c989['response'][_0x4ede('0x26')]){throw new Error(_0x18c989['response'][_0x4ede('0x26')][_0x4ede('0x6d')]);}var _0x5e4dae=[];var _0x5d3677=[];var _0x1033dd=['Owner',_0x4ede('0x6e'),_0x4ede('0x6f'),_0x4ede('0x70'),_0x4ede('0x71'),_0x4ede('0x72'),'Call_Start_Time',_0x4ede('0x73')];_0x5d3677=_[_0x4ede('0x74')](_0x18c989['fields'],function(_0x596c8b){return _0x1033dd['includes'](_0x596c8b[_0x4ede('0x75')]);});for(var _0x57af0c=0x0;_0x57af0c<_0x5d3677[_0x4ede('0x34')];_0x57af0c++){if(_0x5d3677[_0x57af0c][_0x4ede('0x76')]===![]){_0x5e4dae[_0x4ede('0x77')]({'id':_0x5d3677[_0x57af0c]['id'],'name':_0x5d3677[_0x57af0c][_0x4ede('0x78')],'custom':_0x5d3677[_0x57af0c][_0x4ede('0x79')],'options':_0x5d3677[_0x57af0c][_0x4ede('0x7a')]==='picklist'&&_0x5d3677[_0x57af0c][_0x4ede('0x7b')][_0x4ede('0x34')]>-0x1?_['map'](_0x5d3677[_0x57af0c][_0x4ede('0x7b')],function(_0x3957d2){return{'name':_0x3957d2,'value':_0x3957d2};}):[]});}}return{'count':_0x5e4dae[_0x4ede('0x34')],'rows':_0x5e4dae};}else{return{'count':0x0,'rows':[]};}})[_0x4ede('0x25')](respondWithResult(_0xc2f46b,null))['catch'](function(_0x330e33){var _0x3ec582=_0x472f39[_0x4ede('0x2f')][_0x4ede('0x7c')]?0x1f4:_0x330e33['statusCode']||0x1f4;logger[_0x4ede('0x26')](_0x4ede('0x7d'),_0x4ede('0x5e'),_0x3ec582,JSON[_0x4ede('0x7e')](_0x330e33));delete _0x330e33[_0x4ede('0x27')];if(_0x3ec582===0x191){_0x3ec582=0x190;}_0xc2f46b[_0x4ede('0x19')](_0x3ec582)[_0x4ede('0x28')](_0x472f39[_0x4ede('0x2f')][_0x4ede('0x7c')]?{'message':_0x4ede('0x7f'),'statusCode':_0x330e33[_0x4ede('0x80')]}:_0x330e33);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ea68ac1..fb3695b 100644 --- a/server/api/intZohoAccount/intZohoAccount.model.js +++ b/server/api/intZohoAccount/intZohoAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb75=['code','substring','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','clientSecret'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0xfb75,0x110));var _0x5fb7=function(_0x158a66,_0x34d2de){_0x158a66=_0x158a66-0x0;var _0xacf14e=_0xfb75[_0x158a66];return _0xacf14e;};'use strict';var _=require(_0x5fb7('0x0'));var util=require(_0x5fb7('0x1'));var logger=require('../../config/logger')(_0x5fb7('0x2'));var moment=require(_0x5fb7('0x3'));var BPromise=require('bluebird');var rp=require(_0x5fb7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fb7('0x5'));var config=require(_0x5fb7('0x6'));var attributes=require(_0x5fb7('0x7'));var integrations=require(_0x5fb7('0x8'));module[_0x5fb7('0x9')]=function(_0x190410,_0x5386f4){return _0x190410[_0x5fb7('0xa')](_0x5fb7('0xb'),attributes,{'tableName':_0x5fb7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x579196,_0x15895d,_0x3e6b5e){if(_0x579196[_0x5fb7('0xd')](_0x5fb7('0xe'))||_0x579196[_0x5fb7('0xd')](_0x5fb7('0xf'))||_0x579196['changed'](_0x5fb7('0x10'))||_0x579196[_0x5fb7('0xd')]('clientSecret')||_0x579196[_0x5fb7('0xd')]('code')||_0x579196[_0x5fb7('0xd')](_0x5fb7('0x11'))){var _0x32be7b,_0x507eca;_0x32be7b=_0x579196[_0x5fb7('0xf')];var _0x48c40e=_0x32be7b[_0x5fb7('0x12')](-0x1);if(_0x48c40e==='/'||_0x48c40e==='\x5c'||_0x48c40e===':'){_0x32be7b=_0x32be7b['substring'](0x0,_0x32be7b[_0x5fb7('0x13')](_0x48c40e));}switch(_0x579196['zone']){case'US':_0x507eca=_0x5fb7('0x14');break;case'AU':_0x507eca='https://accounts.zoho.com.au';break;case'IN':_0x507eca=_0x5fb7('0x15');break;case'CN':_0x507eca='https://accounts.zoho.com.cn';break;default:_0x507eca='https://accounts.zoho.eu';break;}var _0x1f3dbe={'method':_0x5fb7('0x16'),'uri':_0x507eca+_0x5fb7('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x579196[_0x5fb7('0x10')],'client_secret':_0x579196['clientSecret'],'redirect_uri':_0x579196[_0x5fb7('0xf')],'code':_0x579196['code']},'headers':{'Content-Type':_0x5fb7('0x18')}};return rp(_0x1f3dbe)[_0x5fb7('0x19')](function(_0xe60dfd){var _0x4de27e=JSON[_0x5fb7('0x1a')](_0xe60dfd);if(_0x4de27e[_0x5fb7('0x1b')]){_0x579196[_0x5fb7('0x1c')]=_0x4de27e[_0x5fb7('0x1b')];logger[_0x5fb7('0x1d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x579196[_0x5fb7('0x1e')],_0x579196['id']));}else{logger[_0x5fb7('0x1f')](util[_0x5fb7('0x20')](_0x5fb7('0x21'),_0x579196[_0x5fb7('0x1e')],_0x579196['id']),util['inspect'](_0x4de27e,{'showHidden':![],'depth':null}));}return _0x3e6b5e(null,_0x15895d);})[_0x5fb7('0x22')](function(_0x573713){logger['error'](util[_0x5fb7('0x20')](_0x5fb7('0x21'),_0x579196[_0x5fb7('0x1e')],_0x579196['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3e6b5e(_0x573713);});}else{return _0x3e6b5e(null,_0x15895d);}},'beforeUpdate':function(_0x10223d,_0x368a8a,_0x2a0e8c){if(_0x10223d[_0x5fb7('0xd')](_0x5fb7('0xe'))||_0x10223d[_0x5fb7('0xd')](_0x5fb7('0xf'))||_0x10223d['changed'](_0x5fb7('0x10'))||_0x10223d[_0x5fb7('0xd')](_0x5fb7('0x23'))||_0x10223d[_0x5fb7('0xd')](_0x5fb7('0x24'))||_0x10223d[_0x5fb7('0xd')](_0x5fb7('0x11'))){var _0x7c9f3c,_0x4df1d0;_0x7c9f3c=_0x10223d['serverUrl'];var _0x570d76=_0x7c9f3c[_0x5fb7('0x12')](-0x1);if(_0x570d76==='/'||_0x570d76==='\x5c'||_0x570d76===':'){_0x7c9f3c=_0x7c9f3c[_0x5fb7('0x25')](0x0,_0x7c9f3c[_0x5fb7('0x13')](_0x570d76));}switch(_0x10223d[_0x5fb7('0xe')]){case'US':_0x4df1d0=_0x5fb7('0x14');break;case'AU':_0x4df1d0=_0x5fb7('0x26');break;case'IN':_0x4df1d0='https://accounts.zoho.in';break;case'CN':_0x4df1d0=_0x5fb7('0x27');break;default:_0x4df1d0=_0x5fb7('0x28');break;}var _0x341b30={'method':'POST','uri':_0x4df1d0+'/oauth/v2/token','form':{'grant_type':_0x5fb7('0x29'),'client_id':_0x10223d[_0x5fb7('0x10')],'client_secret':_0x10223d[_0x5fb7('0x23')],'redirect_uri':_0x10223d[_0x5fb7('0xf')],'code':_0x10223d[_0x5fb7('0x24')]},'headers':{'Content-Type':_0x5fb7('0x18')}};return rp(_0x341b30)[_0x5fb7('0x19')](function(_0x504d30){var _0x2b5bfc=JSON['parse'](_0x504d30);if(_0x2b5bfc[_0x5fb7('0x1b')]){_0x10223d[_0x5fb7('0x1c')]=_0x2b5bfc['refresh_token'];logger['info'](util[_0x5fb7('0x20')](_0x5fb7('0x2a'),_0x10223d['name'],_0x10223d['id']));}else{logger[_0x5fb7('0x1f')](util[_0x5fb7('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x10223d[_0x5fb7('0x1e')],_0x10223d['id']),util[_0x5fb7('0x2b')](_0x2b5bfc,{'showHidden':![],'depth':null}));}return _0x2a0e8c(null,_0x368a8a);})['catch'](function(_0x256a00){logger[_0x5fb7('0x1f')](util[_0x5fb7('0x20')](_0x5fb7('0x21'),_0x10223d[_0x5fb7('0x1e')],_0x10223d['id']),util[_0x5fb7('0x2b')](parsedResult,{'showHidden':![],'depth':null}));return _0x2a0e8c(_0x256a00);});}else{return _0x2a0e8c(null,_0x368a8a);}}}});}; \ No newline at end of file +var _0x68cc=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','serverUrl','changed','clientId','clientSecret','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','name','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','zone','host','lastIndexOf','https://accounts.zoho.com.cn','POST','/oauth/v2/token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger'];(function(_0x57e00e,_0x36e79a){var _0x415e60=function(_0x5cd7fa){while(--_0x5cd7fa){_0x57e00e['push'](_0x57e00e['shift']());}};_0x415e60(++_0x36e79a);}(_0x68cc,0xb2));var _0xc68c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x68cc[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0xc68c('0x0'));var logger=require(_0xc68c('0x1'))(_0xc68c('0x2'));var moment=require(_0xc68c('0x3'));var BPromise=require('bluebird');var rp=require(_0xc68c('0x4'));var fs=require('fs');var path=require(_0xc68c('0x5'));var rimraf=require(_0xc68c('0x6'));var config=require(_0xc68c('0x7'));var attributes=require(_0xc68c('0x8'));var integrations=require(_0xc68c('0x9'));module[_0xc68c('0xa')]=function(_0x5ea2fb,_0x14931b){return _0x5ea2fb[_0xc68c('0xb')](_0xc68c('0xc'),attributes,{'tableName':_0xc68c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1c3ce2,_0x420ab1,_0x85919d){if(_0x1c3ce2['changed']('zone')||_0x1c3ce2['changed'](_0xc68c('0xe'))||_0x1c3ce2[_0xc68c('0xf')](_0xc68c('0x10'))||_0x1c3ce2['changed'](_0xc68c('0x11'))||_0x1c3ce2['changed']('code')||_0x1c3ce2[_0xc68c('0xf')]('host')){var _0x24e9d8,_0x304298;_0x24e9d8=_0x1c3ce2[_0xc68c('0xe')];var _0x23545f=_0x24e9d8[_0xc68c('0x12')](-0x1);if(_0x23545f==='/'||_0x23545f==='\x5c'||_0x23545f===':'){_0x24e9d8=_0x24e9d8[_0xc68c('0x13')](0x0,_0x24e9d8['lastIndexOf'](_0x23545f));}switch(_0x1c3ce2['zone']){case'US':_0x304298=_0xc68c('0x14');break;case'AU':_0x304298=_0xc68c('0x15');break;case'IN':_0x304298=_0xc68c('0x16');break;case'CN':_0x304298='https://accounts.zoho.com.cn';break;default:_0x304298=_0xc68c('0x17');break;}var _0x498456={'method':'POST','uri':_0x304298+'/oauth/v2/token','form':{'grant_type':_0xc68c('0x18'),'client_id':_0x1c3ce2['clientId'],'client_secret':_0x1c3ce2[_0xc68c('0x11')],'redirect_uri':_0x1c3ce2[_0xc68c('0xe')],'code':_0x1c3ce2[_0xc68c('0x19')]},'headers':{'Content-Type':_0xc68c('0x1a')}};return rp(_0x498456)[_0xc68c('0x1b')](function(_0x76db38){var _0x1973dd=JSON[_0xc68c('0x1c')](_0x76db38);if(_0x1973dd[_0xc68c('0x1d')]){_0x1c3ce2[_0xc68c('0x1e')]=_0x1973dd[_0xc68c('0x1d')];logger['info'](util[_0xc68c('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1c3ce2[_0xc68c('0x20')],_0x1c3ce2['id']));}else{logger[_0xc68c('0x21')](util[_0xc68c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1c3ce2['name'],_0x1c3ce2['id']),util['inspect'](_0x1973dd,{'showHidden':![],'depth':null}));}return _0x85919d(null,_0x420ab1);})[_0xc68c('0x22')](function(_0x5c9a9e){logger[_0xc68c('0x21')](util['format'](_0xc68c('0x23'),_0x1c3ce2[_0xc68c('0x20')],_0x1c3ce2['id']),util[_0xc68c('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x85919d(_0x5c9a9e);});}else{return _0x85919d(null,_0x420ab1);}},'beforeUpdate':function(_0x4b15cf,_0x257ff9,_0x169c62){if(_0x4b15cf['changed'](_0xc68c('0x25'))||_0x4b15cf[_0xc68c('0xf')](_0xc68c('0xe'))||_0x4b15cf['changed']('clientId')||_0x4b15cf[_0xc68c('0xf')](_0xc68c('0x11'))||_0x4b15cf[_0xc68c('0xf')](_0xc68c('0x19'))||_0x4b15cf[_0xc68c('0xf')](_0xc68c('0x26'))){var _0x47723d,_0xb8f8f0;_0x47723d=_0x4b15cf[_0xc68c('0xe')];var _0x3372c1=_0x47723d[_0xc68c('0x12')](-0x1);if(_0x3372c1==='/'||_0x3372c1==='\x5c'||_0x3372c1===':'){_0x47723d=_0x47723d[_0xc68c('0x13')](0x0,_0x47723d[_0xc68c('0x27')](_0x3372c1));}switch(_0x4b15cf['zone']){case'US':_0xb8f8f0=_0xc68c('0x14');break;case'AU':_0xb8f8f0=_0xc68c('0x15');break;case'IN':_0xb8f8f0=_0xc68c('0x16');break;case'CN':_0xb8f8f0=_0xc68c('0x28');break;default:_0xb8f8f0=_0xc68c('0x17');break;}var _0x5cd14c={'method':_0xc68c('0x29'),'uri':_0xb8f8f0+_0xc68c('0x2a'),'form':{'grant_type':_0xc68c('0x18'),'client_id':_0x4b15cf[_0xc68c('0x10')],'client_secret':_0x4b15cf[_0xc68c('0x11')],'redirect_uri':_0x4b15cf['serverUrl'],'code':_0x4b15cf[_0xc68c('0x19')]},'headers':{'Content-Type':_0xc68c('0x1a')}};return rp(_0x5cd14c)['then'](function(_0x402cfa){var _0x5dee19=JSON[_0xc68c('0x1c')](_0x402cfa);if(_0x5dee19['refresh_token']){_0x4b15cf[_0xc68c('0x1e')]=_0x5dee19[_0xc68c('0x1d')];logger[_0xc68c('0x2b')](util[_0xc68c('0x1f')](_0xc68c('0x2c'),_0x4b15cf['name'],_0x4b15cf['id']));}else{logger[_0xc68c('0x21')](util[_0xc68c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b15cf['name'],_0x4b15cf['id']),util['inspect'](_0x5dee19,{'showHidden':![],'depth':null}));}return _0x169c62(null,_0x257ff9);})['catch'](function(_0x3fc8b5){logger['error'](util['format'](_0xc68c('0x23'),_0x4b15cf['name'],_0x4b15cf['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x169c62(_0x3fc8b5);});}else{return _0x169c62(null,_0x257ff9);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 228bff4..cc7b4f5 100644 --- a/server/api/intZohoAccount/intZohoAccount.rpc.js +++ b/server/api/intZohoAccount/intZohoAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23db=['result','catch','findAll','options','raw','where','include','map','model','attributes','GetZohoAccount','stringify','find','then','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x1f722d,_0xe08ad0){var _0x3bdf12=function(_0x5d3914){while(--_0x5d3914){_0x1f722d['push'](_0x1f722d['shift']());}};_0x3bdf12(++_0xe08ad0);}(_0x23db,0x141));var _0xb23d=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x23db[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var moment=require(_0xb23d('0x2'));var BPromise=require(_0xb23d('0x3'));var rs=require(_0xb23d('0x4'));var fs=require('fs');var Redis=require(_0xb23d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb23d('0x6'))(_0xb23d('0x7'));var config=require('../../config/environment');var jayson=require(_0xb23d('0x8'));var client=jayson[_0xb23d('0x9')][_0xb23d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2056b6,_0x39799c,_0x38bed9){return new BPromise(function(_0x460fa0,_0x466785){return client[_0xb23d('0xb')](_0x2056b6,_0x38bed9)['then'](function(_0x2f91f0){logger[_0xb23d('0xc')](_0xb23d('0xd'),_0x39799c,_0xb23d('0xe'));logger[_0xb23d('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x39799c,'request\x20sent',JSON['stringify'](_0x2f91f0));if(_0x2f91f0[_0xb23d('0x10')]){if(_0x2f91f0['error'][_0xb23d('0x11')]===0x1f4){logger[_0xb23d('0x10')](_0xb23d('0xd'),_0x39799c,_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);return _0x466785(_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);}logger['error'](_0xb23d('0xd'),_0x39799c,_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);return _0x460fa0(_0x2f91f0[_0xb23d('0x10')][_0xb23d('0x12')]);}else{logger[_0xb23d('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x39799c,'request\x20sent');_0x460fa0(_0x2f91f0[_0xb23d('0x13')][_0xb23d('0x12')]);}})[_0xb23d('0x14')](function(_0x9e5eb3){logger[_0xb23d('0x10')](_0xb23d('0xd'),_0x39799c,_0x9e5eb3);_0x466785(_0x9e5eb3);});});}exports['GetZohoAccount']=function(_0x37bfe2){var _0x3f2c6b=this;return new Promise(function(_0x2b47e0,_0x2673d3){return db['ZohoAccount'][_0xb23d('0x15')]({'raw':_0x37bfe2['options']?_0x37bfe2[_0xb23d('0x16')][_0xb23d('0x17')]===undefined?!![]:![]:!![],'where':_0x37bfe2[_0xb23d('0x16')]?_0x37bfe2[_0xb23d('0x16')][_0xb23d('0x18')]||null:null,'attributes':_0x37bfe2[_0xb23d('0x16')]?_0x37bfe2[_0xb23d('0x16')]['attributes']||null:null,'limit':_0x37bfe2[_0xb23d('0x16')]?_0x37bfe2['options']['limit']||null:null,'include':_0x37bfe2[_0xb23d('0x16')]?_0x37bfe2[_0xb23d('0x16')][_0xb23d('0x19')]?_[_0xb23d('0x1a')](_0x37bfe2[_0xb23d('0x16')][_0xb23d('0x19')],function(_0x921fc){return{'model':db[_0x921fc[_0xb23d('0x1b')]],'as':_0x921fc['as'],'attributes':_0x921fc[_0xb23d('0x1c')],'include':_0x921fc[_0xb23d('0x19')]?_[_0xb23d('0x1a')](_0x921fc['include'],function(_0x1f0731){return{'model':db[_0x1f0731[_0xb23d('0x1b')]],'as':_0x1f0731['as'],'attributes':_0x1f0731[_0xb23d('0x1c')],'include':_0x1f0731['include']?_['map'](_0x1f0731[_0xb23d('0x19')],function(_0x2e758e){return{'model':db[_0x2e758e[_0xb23d('0x1b')]],'as':_0x2e758e['as'],'attributes':_0x2e758e[_0xb23d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2785f5){logger[_0xb23d('0xc')](_0xb23d('0x1d'),_0x37bfe2);logger[_0xb23d('0xf')](_0xb23d('0x1d'),_0x37bfe2,JSON[_0xb23d('0x1e')](_0x2785f5));_0x2b47e0(_0x2785f5);})[_0xb23d('0x14')](function(_0x867d69){logger[_0xb23d('0x10')](_0xb23d('0x1d'),_0x867d69[_0xb23d('0x12')],_0x37bfe2);_0x2673d3(_0x3f2c6b[_0xb23d('0x10')](0x1f4,_0x867d69[_0xb23d('0x12')]));});});};exports['ShowZohoAccount']=function(_0x56f62a){var _0x536be6=this;return new Promise(function(_0x4722c1,_0x53c6ed){return db['ZohoAccount'][_0xb23d('0x1f')]({'raw':_0x56f62a['options']?_0x56f62a[_0xb23d('0x16')][_0xb23d('0x17')]===undefined?!![]:![]:!![],'where':_0x56f62a[_0xb23d('0x16')]?_0x56f62a[_0xb23d('0x16')][_0xb23d('0x18')]||null:null,'attributes':_0x56f62a[_0xb23d('0x16')]?_0x56f62a[_0xb23d('0x16')][_0xb23d('0x1c')]||null:null,'include':_0x56f62a[_0xb23d('0x16')]?_0x56f62a[_0xb23d('0x16')][_0xb23d('0x19')]?_[_0xb23d('0x1a')](_0x56f62a[_0xb23d('0x16')][_0xb23d('0x19')],function(_0x220543){return{'model':db[_0x220543[_0xb23d('0x1b')]],'as':_0x220543['as'],'attributes':_0x220543['attributes'],'include':_0x220543[_0xb23d('0x19')]?_[_0xb23d('0x1a')](_0x220543[_0xb23d('0x19')],function(_0x208b2a){return{'model':db[_0x208b2a[_0xb23d('0x1b')]],'as':_0x208b2a['as'],'attributes':_0x208b2a[_0xb23d('0x1c')],'include':_0x208b2a[_0xb23d('0x19')]?_[_0xb23d('0x1a')](_0x208b2a['include'],function(_0x1131d3){return{'model':db[_0x1131d3[_0xb23d('0x1b')]],'as':_0x1131d3['as'],'attributes':_0x1131d3[_0xb23d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb23d('0x20')](function(_0x3ca4af){logger[_0xb23d('0xc')](_0xb23d('0x21'),_0x56f62a);logger[_0xb23d('0xf')](_0xb23d('0x21'),_0x56f62a,JSON[_0xb23d('0x1e')](_0x3ca4af));_0x4722c1(_0x3ca4af);})[_0xb23d('0x14')](function(_0x22683a){logger['error'](_0xb23d('0x21'),_0x22683a[_0xb23d('0x12')],_0x56f62a);_0x53c6ed(_0x536be6[_0xb23d('0x10')](0x1f4,_0x22683a['message']));});});}; \ No newline at end of file +var _0xa93a=['findAll','options','raw','where','include','map','model','attributes','ShowZohoAccount','find','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','message','ZohoAccount,\x20%s,\x20%s','info','catch','GetZohoAccount','ZohoAccount'];(function(_0x520a63,_0x155eed){var _0xdafa4b=function(_0x267a22){while(--_0x267a22){_0x520a63['push'](_0x520a63['shift']());}};_0xdafa4b(++_0x155eed);}(_0xa93a,0xb8));var _0xaa93=function(_0x3e1c8c,_0x4ea1c6){_0x3e1c8c=_0x3e1c8c-0x0;var _0x2eb112=_0xa93a[_0x3e1c8c];return _0x2eb112;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaa93('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa93('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa93('0x2'));var logger=require('../../config/logger')(_0xaa93('0x3'));var config=require(_0xaa93('0x4'));var jayson=require(_0xaa93('0x5'));var client=jayson[_0xaa93('0x6')][_0xaa93('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f3572,_0x353544,_0x28e972){return new BPromise(function(_0x5aa7f5,_0x2bb7a8){return client['request'](_0x4f3572,_0x28e972)[_0xaa93('0x8')](function(_0x53897){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x353544,'request\x20sent');logger[_0xaa93('0x9')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x353544,_0xaa93('0xa'),JSON[_0xaa93('0xb')](_0x53897));if(_0x53897[_0xaa93('0xc')]){if(_0x53897['error']['code']===0x1f4){logger[_0xaa93('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x353544,_0x53897[_0xaa93('0xc')]['message']);return _0x2bb7a8(_0x53897[_0xaa93('0xc')][_0xaa93('0xd')]);}logger[_0xaa93('0xc')](_0xaa93('0xe'),_0x353544,_0x53897[_0xaa93('0xc')]['message']);return _0x5aa7f5(_0x53897[_0xaa93('0xc')]['message']);}else{logger[_0xaa93('0xf')](_0xaa93('0xe'),_0x353544,'request\x20sent');_0x5aa7f5(_0x53897['result'][_0xaa93('0xd')]);}})[_0xaa93('0x10')](function(_0x1cc0bc){logger[_0xaa93('0xc')](_0xaa93('0xe'),_0x353544,_0x1cc0bc);_0x2bb7a8(_0x1cc0bc);});});}exports[_0xaa93('0x11')]=function(_0x29f90a){var _0x28b89d=this;return new Promise(function(_0x542a56,_0x49d6fe){return db[_0xaa93('0x12')][_0xaa93('0x13')]({'raw':_0x29f90a[_0xaa93('0x14')]?_0x29f90a['options'][_0xaa93('0x15')]===undefined?!![]:![]:!![],'where':_0x29f90a[_0xaa93('0x14')]?_0x29f90a['options'][_0xaa93('0x16')]||null:null,'attributes':_0x29f90a['options']?_0x29f90a[_0xaa93('0x14')]['attributes']||null:null,'limit':_0x29f90a[_0xaa93('0x14')]?_0x29f90a[_0xaa93('0x14')]['limit']||null:null,'include':_0x29f90a[_0xaa93('0x14')]?_0x29f90a['options'][_0xaa93('0x17')]?_[_0xaa93('0x18')](_0x29f90a['options']['include'],function(_0x2a1683){return{'model':db[_0x2a1683[_0xaa93('0x19')]],'as':_0x2a1683['as'],'attributes':_0x2a1683[_0xaa93('0x1a')],'include':_0x2a1683['include']?_['map'](_0x2a1683[_0xaa93('0x17')],function(_0x51a0de){return{'model':db[_0x51a0de[_0xaa93('0x19')]],'as':_0x51a0de['as'],'attributes':_0x51a0de[_0xaa93('0x1a')],'include':_0x51a0de[_0xaa93('0x17')]?_['map'](_0x51a0de[_0xaa93('0x17')],function(_0x17e2e6){return{'model':db[_0x17e2e6[_0xaa93('0x19')]],'as':_0x17e2e6['as'],'attributes':_0x17e2e6[_0xaa93('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e225f){logger['info']('GetZohoAccount',_0x29f90a);logger['debug']('GetZohoAccount',_0x29f90a,JSON[_0xaa93('0xb')](_0x3e225f));_0x542a56(_0x3e225f);})[_0xaa93('0x10')](function(_0x46c3ae){logger[_0xaa93('0xc')]('GetZohoAccount',_0x46c3ae[_0xaa93('0xd')],_0x29f90a);_0x49d6fe(_0x28b89d[_0xaa93('0xc')](0x1f4,_0x46c3ae[_0xaa93('0xd')]));});});};exports[_0xaa93('0x1b')]=function(_0x1317e8){var _0x128839=this;return new Promise(function(_0x455227,_0x328149){return db[_0xaa93('0x12')][_0xaa93('0x1c')]({'raw':_0x1317e8['options']?_0x1317e8['options']['raw']===undefined?!![]:![]:!![],'where':_0x1317e8[_0xaa93('0x14')]?_0x1317e8[_0xaa93('0x14')][_0xaa93('0x16')]||null:null,'attributes':_0x1317e8['options']?_0x1317e8['options'][_0xaa93('0x1a')]||null:null,'include':_0x1317e8['options']?_0x1317e8[_0xaa93('0x14')][_0xaa93('0x17')]?_[_0xaa93('0x18')](_0x1317e8[_0xaa93('0x14')]['include'],function(_0x2e5156){return{'model':db[_0x2e5156[_0xaa93('0x19')]],'as':_0x2e5156['as'],'attributes':_0x2e5156[_0xaa93('0x1a')],'include':_0x2e5156[_0xaa93('0x17')]?_[_0xaa93('0x18')](_0x2e5156['include'],function(_0x1b29d9){return{'model':db[_0x1b29d9['model']],'as':_0x1b29d9['as'],'attributes':_0x1b29d9[_0xaa93('0x1a')],'include':_0x1b29d9[_0xaa93('0x17')]?_[_0xaa93('0x18')](_0x1b29d9[_0xaa93('0x17')],function(_0x529c82){return{'model':db[_0x529c82[_0xaa93('0x19')]],'as':_0x529c82['as'],'attributes':_0x529c82['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4852ac){logger[_0xaa93('0xf')]('ShowZohoAccount',_0x1317e8);logger[_0xaa93('0x9')](_0xaa93('0x1b'),_0x1317e8,JSON['stringify'](_0x4852ac));_0x455227(_0x4852ac);})[_0xaa93('0x10')](function(_0x44fc71){logger[_0xaa93('0xc')](_0xaa93('0x1b'),_0x44fc71[_0xaa93('0xd')],_0x1317e8);_0x328149(_0x128839[_0xaa93('0xc')](0x1f4,_0x44fc71[_0xaa93('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index cffcf3f..9dda2f5 100644 --- a/server/api/intZohoConfiguration/index.js +++ b/server/api/intZohoConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72fe=['/:id/fields','getFields','getSubjects','/:id/descriptions','post','put','delete','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3527c0,_0x59f1ce){var _0x1c8285=function(_0x360ffd){while(--_0x360ffd){_0x3527c0['push'](_0x3527c0['shift']());}};_0x1c8285(++_0x59f1ce);}(_0x72fe,0x79));var _0xe72f=function(_0xdabb05,_0x427545){_0xdabb05=_0xdabb05-0x0;var _0x43f1f8=_0x72fe[_0xdabb05];return _0x43f1f8;};'use strict';var multer=require(_0xe72f('0x0'));var util=require(_0xe72f('0x1'));var path=require('path');var timeout=require(_0xe72f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe72f('0x3'));var auth=require(_0xe72f('0x4'));var interaction=require(_0xe72f('0x5'));var config=require(_0xe72f('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xe72f('0x7')]('/',auth[_0xe72f('0x8')](),controller[_0xe72f('0x9')]);router[_0xe72f('0x7')](_0xe72f('0xa'),auth['isAuthenticated'](),controller[_0xe72f('0xb')]);router[_0xe72f('0x7')](_0xe72f('0xc'),auth[_0xe72f('0x8')](),controller[_0xe72f('0xd')]);router[_0xe72f('0x7')]('/:id/subjects',auth[_0xe72f('0x8')](),controller[_0xe72f('0xe')]);router[_0xe72f('0x7')](_0xe72f('0xf'),auth[_0xe72f('0x8')](),controller['getDescriptions']);router[_0xe72f('0x10')]('/',auth[_0xe72f('0x8')](),controller['create']);router[_0xe72f('0x11')](_0xe72f('0xa'),auth[_0xe72f('0x8')](),controller['update']);router[_0xe72f('0x12')](_0xe72f('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x132a=['express','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','exports','multer','util','path'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x132a,0x177));var _0xa132=function(_0x7306f6,_0x35b823){_0x7306f6=_0x7306f6-0x0;var _0x4dcc71=_0x132a[_0x7306f6];return _0x4dcc71;};'use strict';var multer=require(_0xa132('0x0'));var util=require(_0xa132('0x1'));var path=require(_0xa132('0x2'));var timeout=require('connect-timeout');var express=require(_0xa132('0x3'));var router=express['Router']();var fs_extra=require(_0xa132('0x4'));var auth=require(_0xa132('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa132('0x6'));var controller=require(_0xa132('0x7'));router['get']('/',auth[_0xa132('0x8')](),controller[_0xa132('0x9')]);router[_0xa132('0xa')](_0xa132('0xb'),auth[_0xa132('0x8')](),controller[_0xa132('0xc')]);router['get'](_0xa132('0xd'),auth[_0xa132('0x8')](),controller[_0xa132('0xe')]);router[_0xa132('0xa')](_0xa132('0xf'),auth[_0xa132('0x8')](),controller[_0xa132('0x10')]);router[_0xa132('0xa')](_0xa132('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xa132('0x8')](),controller[_0xa132('0x12')]);router[_0xa132('0x13')](_0xa132('0xb'),auth[_0xa132('0x8')](),controller['update']);router['delete'](_0xa132('0xb'),auth[_0xa132('0x8')](),controller['destroy']);module[_0xa132('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2e9ea5a..1fa7cb5 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5533=['lead','contact','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x55f76a,_0x9a7375){var _0x2691ba=function(_0x6b2dbe){while(--_0x6b2dbe){_0x55f76a['push'](_0x55f76a['shift']());}};_0x2691ba(++_0x9a7375);}(_0x5533,0x184));var _0x3553=function(_0x242463,_0xbf4cfc){_0x242463=_0x242463-0x0;var _0x198728=_0x5533[_0x242463];return _0x198728;};'use strict';var Sequelize=require(_0x3553('0x0'));module[_0x3553('0x1')]={'name':{'type':Sequelize[_0x3553('0x2')]},'moduleCreate':{'type':Sequelize[_0x3553('0x3')](_0x3553('0x4'),_0x3553('0x5'),'nothing'),'defaultValue':_0x3553('0x4')},'moduleSearch':{'type':Sequelize[_0x3553('0x3')](_0x3553('0x6'),_0x3553('0x5'),'lead'),'defaultValue':_0x3553('0x6')},'description':{'type':Sequelize[_0x3553('0x2')]}}; \ No newline at end of file +var _0x3a25=['nothing','contact_lead','contact','sequelize','exports','STRING','ENUM','lead'];(function(_0x3d6bf9,_0x2da822){var _0x269576=function(_0x2b3e0b){while(--_0x2b3e0b){_0x3d6bf9['push'](_0x3d6bf9['shift']());}};_0x269576(++_0x2da822);}(_0x3a25,0x1f3));var _0x53a2=function(_0x41aeb8,_0x173e2f){_0x41aeb8=_0x41aeb8-0x0;var _0x588f2d=_0x3a25[_0x41aeb8];return _0x588f2d;};'use strict';var Sequelize=require(_0x53a2('0x0'));module[_0x53a2('0x1')]={'name':{'type':Sequelize[_0x53a2('0x2')]},'moduleCreate':{'type':Sequelize[_0x53a2('0x3')](_0x53a2('0x4'),'contact',_0x53a2('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x53a2('0x3')](_0x53a2('0x6'),_0x53a2('0x7'),_0x53a2('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dcdcda6..857ace6 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x128d=['sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','index','ZohoConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','options','include','findAll','rows','catch','params','create','body','update','find','ZohoField','filter','getFields','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x508b99,_0x26c8c2){var _0x35448e=function(_0x1badea){while(--_0x1badea){_0x508b99['push'](_0x508b99['shift']());}};_0x35448e(++_0x26c8c2);}(_0x128d,0x85));var _0xd128=function(_0x37a4f8,_0x284814){_0x37a4f8=_0x37a4f8-0x0;var _0x595c41=_0x128d[_0x37a4f8];return _0x595c41;};'use strict';var emlformat=require(_0xd128('0x0'));var rimraf=require(_0xd128('0x1'));var zipdir=require(_0xd128('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd128('0x3'));var moment=require(_0xd128('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd128('0x5'));var path=require(_0xd128('0x6'));var sox=require(_0xd128('0x7'));var csv=require(_0xd128('0x8'));var ejs=require(_0xd128('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd128('0xa'));var squel=require('squel');var crypto=require(_0xd128('0xb'));var jsforce=require(_0xd128('0xc'));var deskjs=require(_0xd128('0xd'));var toCsv=require(_0xd128('0x8'));var querystring=require('querystring');var Papa=require(_0xd128('0xe'));var Redis=require(_0xd128('0xf'));var authService=require(_0xd128('0x10'));var qs=require(_0xd128('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd128('0x12'));var logger=require(_0xd128('0x13'))(_0xd128('0x14'));var utils=require(_0xd128('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd128('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47bdce,_0x4e81ac){_0x4e81ac=_0x4e81ac||0xcc;return function(_0x3f95f5){if(_0x3f95f5){return _0x47bdce[_0xd128('0x17')](_0x4e81ac);}return _0x47bdce[_0xd128('0x18')](_0x4e81ac)[_0xd128('0x19')]();};}function respondWithResult(_0x21663e,_0x464d0c){_0x464d0c=_0x464d0c||0xc8;return function(_0x47b45d){if(_0x47b45d){return _0x21663e[_0xd128('0x18')](_0x464d0c)[_0xd128('0x1a')](_0x47b45d);}};}function respondWithFilteredResult(_0x6f235c,_0x232085){return function(_0x9fd86a){if(_0x9fd86a){var _0x32a507=typeof _0x232085[_0xd128('0x1b')]==='undefined'&&typeof _0x232085['limit']===_0xd128('0x1c');var _0x4c4abd=_0x9fd86a[_0xd128('0x1d')];var _0x242b82=_0x32a507?0x0:_0x232085['offset'];var _0x185e7b=_0x32a507?_0x9fd86a[_0xd128('0x1d')]:_0x232085[_0xd128('0x1b')]+_0x232085['limit'];var _0x2f8f74;if(_0x185e7b>=_0x4c4abd){_0x185e7b=_0x4c4abd;_0x2f8f74=0xc8;}else{_0x2f8f74=0xce;}_0x6f235c[_0xd128('0x18')](_0x2f8f74);return _0x6f235c[_0xd128('0x1e')]('Content-Range',_0x242b82+'-'+_0x185e7b+'/'+_0x4c4abd)[_0xd128('0x1a')](_0x9fd86a);}return null;};}function patchUpdates(_0x4775a7){return function(_0x2092fa){try{jsonpatch[_0xd128('0x1f')](_0x2092fa,_0x4775a7,!![]);}catch(_0x1b3bfe){return BPromise[_0xd128('0x20')](_0x1b3bfe);}return _0x2092fa[_0xd128('0x21')]();};}function saveUpdates(_0x2f9b26,_0x261fe0){return function(_0x1a8754){if(_0x1a8754){return _0x1a8754['update'](_0x2f9b26)[_0xd128('0x22')](function(_0xc90e3c){return _0xc90e3c;});}return null;};}function removeEntity(_0xafb451,_0x3d3449){return function(_0x327d56){if(_0x327d56){return _0x327d56[_0xd128('0x23')]()[_0xd128('0x22')](function(){_0xafb451[_0xd128('0x18')](0xcc)[_0xd128('0x19')]();});}};}function handleEntityNotFound(_0x11873d,_0x47c5e0){return function(_0xef73bb){if(!_0xef73bb){_0x11873d[_0xd128('0x17')](0x194);}return _0xef73bb;};}function handleError(_0x3d0bbd,_0x27cd87){_0x27cd87=_0x27cd87||0x1f4;return function(_0x2dcf1d){logger[_0xd128('0x24')](_0x2dcf1d[_0xd128('0x25')]);if(_0x2dcf1d[_0xd128('0x26')]){delete _0x2dcf1d[_0xd128('0x26')];}_0x3d0bbd[_0xd128('0x18')](_0x27cd87)['send'](_0x2dcf1d);};}exports[_0xd128('0x27')]=function(_0xf0321,_0x3148f0){var _0x59f6a4={},_0x5dbda6={},_0x8b7c4d={'count':0x0,'rows':[]};var _0x3a169b=_['map'](db[_0xd128('0x28')][_0xd128('0x29')],function(_0x1ad934){return{'name':_0x1ad934['fieldName'],'type':_0x1ad934[_0xd128('0x2a')][_0xd128('0x2b')]};});_0x5dbda6['model']=_['map'](_0x3a169b,'name');_0x5dbda6[_0xd128('0x2c')]=_[_0xd128('0x2d')](_0xf0321[_0xd128('0x2c')]);_0x5dbda6[_0xd128('0x2e')]=_[_0xd128('0x2f')](_0x5dbda6[_0xd128('0x30')],_0x5dbda6[_0xd128('0x2c')]);_0x59f6a4['attributes']=_[_0xd128('0x2f')](_0x5dbda6[_0xd128('0x30')],qs[_0xd128('0x31')](_0xf0321[_0xd128('0x2c')][_0xd128('0x31')]));_0x59f6a4['attributes']=_0x59f6a4['attributes'][_0xd128('0x32')]?_0x59f6a4[_0xd128('0x33')]:_0x5dbda6[_0xd128('0x30')];if(!_0xf0321[_0xd128('0x2c')]['hasOwnProperty'](_0xd128('0x34'))){_0x59f6a4[_0xd128('0x35')]=qs[_0xd128('0x35')](_0xf0321[_0xd128('0x2c')][_0xd128('0x35')]);_0x59f6a4['offset']=qs[_0xd128('0x1b')](_0xf0321[_0xd128('0x2c')]['offset']);}_0x59f6a4[_0xd128('0x36')]=qs[_0xd128('0x37')](_0xf0321[_0xd128('0x2c')][_0xd128('0x37')]);_0x59f6a4[_0xd128('0x38')]=qs['filters'](_[_0xd128('0x39')](_0xf0321[_0xd128('0x2c')],_0x5dbda6['filters']),_0x3a169b);if(_0xf0321[_0xd128('0x2c')]['filter']){_0x59f6a4[_0xd128('0x38')]=_[_0xd128('0x3a')](_0x59f6a4['where'],{'$or':_[_0xd128('0x3b')](_0x3a169b,function(_0x7a92ac){if(_0x7a92ac[_0xd128('0x2a')]!==_0xd128('0x3c')){var _0x247266={};_0x247266[_0x7a92ac[_0xd128('0x26')]]={'$like':'%'+_0xf0321['query']['filter']+'%'};return _0x247266;}})});}_0x59f6a4=_['merge']({},_0x59f6a4,_0xf0321[_0xd128('0x3d')]);var _0x206122={'where':_0x59f6a4[_0xd128('0x38')]};return db['ZohoConfiguration'][_0xd128('0x1d')](_0x206122)['then'](function(_0x2082d2){_0x8b7c4d[_0xd128('0x1d')]=_0x2082d2;if(_0xf0321[_0xd128('0x2c')]['includeAll']){_0x59f6a4[_0xd128('0x3e')]=[{'all':!![]}];}return db[_0xd128('0x28')][_0xd128('0x3f')](_0x59f6a4);})[_0xd128('0x22')](function(_0x11370b){_0x8b7c4d[_0xd128('0x40')]=_0x11370b;return _0x8b7c4d;})[_0xd128('0x22')](respondWithFilteredResult(_0x3148f0,_0x59f6a4))[_0xd128('0x41')](handleError(_0x3148f0,null));};exports['show']=function(_0xfb13ce,_0x561077){var _0x22bec6={'raw':![],'where':{'id':_0xfb13ce[_0xd128('0x42')]['id']}},_0x3fb137={};_0x3fb137[_0xd128('0x30')]=_[_0xd128('0x2d')](db[_0xd128('0x28')]['rawAttributes']);_0x3fb137[_0xd128('0x2c')]=_[_0xd128('0x2d')](_0xfb13ce[_0xd128('0x2c')]);_0x3fb137[_0xd128('0x2e')]=_[_0xd128('0x2f')](_0x3fb137[_0xd128('0x30')],_0x3fb137[_0xd128('0x2c')]);_0x22bec6['attributes']=_[_0xd128('0x2f')](_0x3fb137[_0xd128('0x30')],qs['fields'](_0xfb13ce[_0xd128('0x2c')][_0xd128('0x31')]));_0x22bec6['attributes']=_0x22bec6[_0xd128('0x33')][_0xd128('0x32')]?_0x22bec6['attributes']:_0x3fb137[_0xd128('0x30')];if(_0xfb13ce['query']['includeAll']){_0x22bec6[_0xd128('0x3e')]=[{'all':!![]}];}_0x22bec6=_['merge']({},_0x22bec6,_0xfb13ce[_0xd128('0x3d')]);return db['ZohoConfiguration']['find'](_0x22bec6)[_0xd128('0x22')](handleEntityNotFound(_0x561077,null))[_0xd128('0x22')](respondWithResult(_0x561077,null))[_0xd128('0x41')](handleError(_0x561077,null));};exports[_0xd128('0x43')]=function(_0x2c72dd,_0x47d273){return db['ZohoConfiguration'][_0xd128('0x43')](_0x2c72dd[_0xd128('0x44')],{})[_0xd128('0x22')](respondWithResult(_0x47d273,0xc9))[_0xd128('0x41')](handleError(_0x47d273,null));};exports[_0xd128('0x45')]=function(_0x1376b4,_0x5f33d4){if(_0x1376b4[_0xd128('0x44')]['id']){delete _0x1376b4[_0xd128('0x44')]['id'];}return db[_0xd128('0x28')][_0xd128('0x46')]({'where':{'id':_0x1376b4[_0xd128('0x42')]['id']}})[_0xd128('0x22')](handleEntityNotFound(_0x5f33d4,null))[_0xd128('0x22')](saveUpdates(_0x1376b4[_0xd128('0x44')],null))['then'](respondWithResult(_0x5f33d4,null))[_0xd128('0x41')](handleError(_0x5f33d4,null));};exports[_0xd128('0x23')]=function(_0x282b4b,_0x450d10){return db[_0xd128('0x28')]['find']({'where':{'id':_0x282b4b['params']['id']}})['then'](handleEntityNotFound(_0x450d10,null))[_0xd128('0x22')](removeEntity(_0x450d10,null))['catch'](handleError(_0x450d10,null));};exports['getFields']=function(_0x514b1d,_0x3405e3,_0x130083){var _0x55e86c={};var _0x39975e={};var _0xdd432b;var _0x2d6ad3;return db[_0xd128('0x28')]['findOne']({'where':{'id':_0x514b1d['params']['id']}})[_0xd128('0x22')](handleEntityNotFound(_0x3405e3,null))[_0xd128('0x22')](function(_0x5a1d98){if(_0x5a1d98){_0xdd432b=_0x5a1d98;_0x39975e['model']=_['keys'](db[_0xd128('0x47')][_0xd128('0x29')]);_0x39975e[_0xd128('0x2c')]=_[_0xd128('0x2d')](_0x514b1d['query']);_0x39975e[_0xd128('0x2e')]=_[_0xd128('0x2f')](_0x39975e[_0xd128('0x30')],_0x39975e['query']);_0x55e86c[_0xd128('0x33')]=_[_0xd128('0x2f')](_0x39975e[_0xd128('0x30')],qs[_0xd128('0x31')](_0x514b1d[_0xd128('0x2c')][_0xd128('0x31')]));_0x55e86c[_0xd128('0x33')]=_0x55e86c['attributes'][_0xd128('0x32')]?_0x55e86c[_0xd128('0x33')]:_0x39975e['model'];_0x55e86c['order']=qs[_0xd128('0x37')](_0x514b1d[_0xd128('0x2c')][_0xd128('0x37')]);_0x55e86c[_0xd128('0x38')]=qs[_0xd128('0x2e')](_[_0xd128('0x39')](_0x514b1d[_0xd128('0x2c')],_0x39975e['filters']));if(_0x514b1d['query'][_0xd128('0x48')]){_0x55e86c[_0xd128('0x38')]=_[_0xd128('0x3a')](_0x55e86c[_0xd128('0x38')],{'$or':_['map'](_0x55e86c[_0xd128('0x33')],function(_0x4c1465){var _0x1509aa={};_0x1509aa[_0x4c1465]={'$like':'%'+_0x514b1d[_0xd128('0x2c')][_0xd128('0x48')]+'%'};return _0x1509aa;})});}_0x55e86c=_[_0xd128('0x3a')]({},_0x55e86c,_0x514b1d[_0xd128('0x3d')]);return _0xdd432b[_0xd128('0x49')](_0x55e86c);}})[_0xd128('0x22')](function(_0xc33ffc){if(_0xc33ffc){_0x2d6ad3=_0xc33ffc['length'];if(!_0x514b1d[_0xd128('0x2c')][_0xd128('0x4a')](_0xd128('0x34'))){_0x55e86c['limit']=qs[_0xd128('0x35')](_0x514b1d[_0xd128('0x2c')][_0xd128('0x35')]);_0x55e86c[_0xd128('0x1b')]=qs[_0xd128('0x1b')](_0x514b1d[_0xd128('0x2c')][_0xd128('0x1b')]);}return _0xdd432b[_0xd128('0x49')](_0x55e86c);}})['then'](function(_0x526af1){if(_0x526af1){return _0x526af1?{'count':_0x2d6ad3,'rows':_0x526af1}:null;}})['then'](respondWithResult(_0x3405e3,null))[_0xd128('0x41')](handleError(_0x3405e3,null));};exports['getSubjects']=function(_0x2d5ba2,_0x384267,_0x58166b){var _0x283b1a={};var _0x46fa79={};var _0x4c7567;var _0xb73361;return db[_0xd128('0x28')][_0xd128('0x4b')]({'where':{'id':_0x2d5ba2[_0xd128('0x42')]['id']}})[_0xd128('0x22')](handleEntityNotFound(_0x384267,null))[_0xd128('0x22')](function(_0x16af0e){if(_0x16af0e){_0x4c7567=_0x16af0e;_0x46fa79[_0xd128('0x30')]=_[_0xd128('0x2d')](db[_0xd128('0x47')][_0xd128('0x29')]);_0x46fa79[_0xd128('0x2c')]=_[_0xd128('0x2d')](_0x2d5ba2[_0xd128('0x2c')]);_0x46fa79[_0xd128('0x2e')]=_[_0xd128('0x2f')](_0x46fa79['model'],_0x46fa79['query']);_0x283b1a['attributes']=_[_0xd128('0x2f')](_0x46fa79[_0xd128('0x30')],qs['fields'](_0x2d5ba2[_0xd128('0x2c')][_0xd128('0x31')]));_0x283b1a[_0xd128('0x33')]=_0x283b1a[_0xd128('0x33')][_0xd128('0x32')]?_0x283b1a[_0xd128('0x33')]:_0x46fa79[_0xd128('0x30')];_0x283b1a[_0xd128('0x36')]=qs[_0xd128('0x37')](_0x2d5ba2[_0xd128('0x2c')][_0xd128('0x37')]);_0x283b1a['where']=qs[_0xd128('0x2e')](_['pick'](_0x2d5ba2[_0xd128('0x2c')],_0x46fa79['filters']));if(_0x2d5ba2[_0xd128('0x2c')][_0xd128('0x48')]){_0x283b1a[_0xd128('0x38')]=_[_0xd128('0x3a')](_0x283b1a['where'],{'$or':_['map'](_0x283b1a[_0xd128('0x33')],function(_0x1f5fa3){var _0x59ba08={};_0x59ba08[_0x1f5fa3]={'$like':'%'+_0x2d5ba2[_0xd128('0x2c')][_0xd128('0x48')]+'%'};return _0x59ba08;})});}_0x283b1a=_[_0xd128('0x3a')]({},_0x283b1a,_0x2d5ba2[_0xd128('0x3d')]);return _0x4c7567[_0xd128('0x4c')](_0x283b1a);}})[_0xd128('0x22')](function(_0x2f38e4){if(_0x2f38e4){_0xb73361=_0x2f38e4['length'];if(!_0x2d5ba2[_0xd128('0x2c')][_0xd128('0x4a')](_0xd128('0x34'))){_0x283b1a['limit']=qs[_0xd128('0x35')](_0x2d5ba2[_0xd128('0x2c')][_0xd128('0x35')]);_0x283b1a['offset']=qs[_0xd128('0x1b')](_0x2d5ba2[_0xd128('0x2c')][_0xd128('0x1b')]);}return _0x4c7567[_0xd128('0x4c')](_0x283b1a);}})[_0xd128('0x22')](function(_0x5c9c3d){if(_0x5c9c3d){return _0x5c9c3d?{'count':_0xb73361,'rows':_0x5c9c3d}:null;}})[_0xd128('0x22')](respondWithResult(_0x384267,null))['catch'](handleError(_0x384267,null));};exports[_0xd128('0x4d')]=function(_0x37f3d3,_0x1bdeab,_0x3b478d){var _0x3b6162={};var _0x4ac592={};var _0x3e1a2b;var _0x22f403;return db[_0xd128('0x28')][_0xd128('0x4b')]({'where':{'id':_0x37f3d3['params']['id']}})[_0xd128('0x22')](handleEntityNotFound(_0x1bdeab,null))[_0xd128('0x22')](function(_0x4b7a41){if(_0x4b7a41){_0x3e1a2b=_0x4b7a41;_0x4ac592['model']=_[_0xd128('0x2d')](db[_0xd128('0x47')][_0xd128('0x29')]);_0x4ac592[_0xd128('0x2c')]=_[_0xd128('0x2d')](_0x37f3d3[_0xd128('0x2c')]);_0x4ac592[_0xd128('0x2e')]=_[_0xd128('0x2f')](_0x4ac592[_0xd128('0x30')],_0x4ac592[_0xd128('0x2c')]);_0x3b6162[_0xd128('0x33')]=_[_0xd128('0x2f')](_0x4ac592[_0xd128('0x30')],qs['fields'](_0x37f3d3[_0xd128('0x2c')]['fields']));_0x3b6162[_0xd128('0x33')]=_0x3b6162[_0xd128('0x33')]['length']?_0x3b6162[_0xd128('0x33')]:_0x4ac592[_0xd128('0x30')];_0x3b6162[_0xd128('0x36')]=qs[_0xd128('0x37')](_0x37f3d3[_0xd128('0x2c')][_0xd128('0x37')]);_0x3b6162['where']=qs[_0xd128('0x2e')](_['pick'](_0x37f3d3[_0xd128('0x2c')],_0x4ac592[_0xd128('0x2e')]));if(_0x37f3d3['query'][_0xd128('0x48')]){_0x3b6162[_0xd128('0x38')]=_[_0xd128('0x3a')](_0x3b6162[_0xd128('0x38')],{'$or':_[_0xd128('0x3b')](_0x3b6162[_0xd128('0x33')],function(_0x21adef){var _0x2ba92f={};_0x2ba92f[_0x21adef]={'$like':'%'+_0x37f3d3[_0xd128('0x2c')][_0xd128('0x48')]+'%'};return _0x2ba92f;})});}_0x3b6162=_[_0xd128('0x3a')]({},_0x3b6162,_0x37f3d3[_0xd128('0x3d')]);return _0x3e1a2b[_0xd128('0x4d')](_0x3b6162);}})[_0xd128('0x22')](function(_0x4bc7f8){if(_0x4bc7f8){_0x22f403=_0x4bc7f8[_0xd128('0x32')];if(!_0x37f3d3[_0xd128('0x2c')][_0xd128('0x4a')](_0xd128('0x34'))){_0x3b6162[_0xd128('0x35')]=qs[_0xd128('0x35')](_0x37f3d3[_0xd128('0x2c')]['limit']);_0x3b6162[_0xd128('0x1b')]=qs['offset'](_0x37f3d3[_0xd128('0x2c')][_0xd128('0x1b')]);}return _0x3e1a2b[_0xd128('0x4d')](_0x3b6162);}})[_0xd128('0x22')](function(_0x3f4fc5){if(_0x3f4fc5){return _0x3f4fc5?{'count':_0x22f403,'rows':_0x3f4fc5}:null;}})[_0xd128('0x22')](respondWithResult(_0x1bdeab,null))[_0xd128('0x41')](handleError(_0x1bdeab,null));}; \ No newline at end of file +var _0xaad0=['fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','ZohoField','getFields','nolimit','findOne','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','set','json','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaad0,0x1cc));var _0x0aad=function(_0xb62d3,_0x5a007a){_0xb62d3=_0xb62d3-0x0;var _0x1c5d67=_0xaad0[_0xb62d3];return _0x1c5d67;};'use strict';var emlformat=require(_0x0aad('0x0'));var rimraf=require(_0x0aad('0x1'));var zipdir=require(_0x0aad('0x2'));var jsonpatch=require(_0x0aad('0x3'));var rp=require(_0x0aad('0x4'));var moment=require(_0x0aad('0x5'));var BPromise=require(_0x0aad('0x6'));var Mustache=require(_0x0aad('0x7'));var util=require(_0x0aad('0x8'));var path=require(_0x0aad('0x9'));var sox=require(_0x0aad('0xa'));var csv=require(_0x0aad('0xb'));var ejs=require(_0x0aad('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0aad('0xd'));var squel=require(_0x0aad('0xe'));var crypto=require(_0x0aad('0xf'));var jsforce=require(_0x0aad('0x10'));var deskjs=require(_0x0aad('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0aad('0x12'));var Redis=require(_0x0aad('0x13'));var authService=require(_0x0aad('0x14'));var qs=require(_0x0aad('0x15'));var as=require(_0x0aad('0x16'));var hardwareService=require(_0x0aad('0x17'));var logger=require(_0x0aad('0x18'))(_0x0aad('0x19'));var utils=require('../../config/utils');var config=require(_0x0aad('0x1a'));var licenseUtil=require(_0x0aad('0x1b'));var db=require(_0x0aad('0x1c'))['db'];function respondWithStatusCode(_0x286d32,_0x572fc8){_0x572fc8=_0x572fc8||0xcc;return function(_0x89d22c){if(_0x89d22c){return _0x286d32[_0x0aad('0x1d')](_0x572fc8);}return _0x286d32[_0x0aad('0x1e')](_0x572fc8)[_0x0aad('0x1f')]();};}function respondWithResult(_0xfbce20,_0x3cd119){_0x3cd119=_0x3cd119||0xc8;return function(_0x159bb6){if(_0x159bb6){return _0xfbce20['status'](_0x3cd119)['json'](_0x159bb6);}};}function respondWithFilteredResult(_0x3ddfdd,_0x414e4e){return function(_0xf41681){if(_0xf41681){var _0x1b4a01=typeof _0x414e4e[_0x0aad('0x20')]===_0x0aad('0x21')&&typeof _0x414e4e['limit']===_0x0aad('0x21');var _0x2ce5e7=_0xf41681['count'];var _0xe322de=_0x1b4a01?0x0:_0x414e4e[_0x0aad('0x20')];var _0x1ad7d8=_0x1b4a01?_0xf41681['count']:_0x414e4e[_0x0aad('0x20')]+_0x414e4e['limit'];var _0x1d02da;if(_0x1ad7d8>=_0x2ce5e7){_0x1ad7d8=_0x2ce5e7;_0x1d02da=0xc8;}else{_0x1d02da=0xce;}_0x3ddfdd[_0x0aad('0x1e')](_0x1d02da);return _0x3ddfdd[_0x0aad('0x22')]('Content-Range',_0xe322de+'-'+_0x1ad7d8+'/'+_0x2ce5e7)[_0x0aad('0x23')](_0xf41681);}return null;};}function patchUpdates(_0x4d45ea){return function(_0x2c28ed){try{jsonpatch[_0x0aad('0x24')](_0x2c28ed,_0x4d45ea,!![]);}catch(_0x266927){return BPromise[_0x0aad('0x25')](_0x266927);}return _0x2c28ed['save']();};}function saveUpdates(_0x100205,_0x1e5916){return function(_0x5d95d1){if(_0x5d95d1){return _0x5d95d1[_0x0aad('0x26')](_0x100205)['then'](function(_0x3c71b3){return _0x3c71b3;});}return null;};}function removeEntity(_0x5de992,_0x17e8c1){return function(_0x59c4af){if(_0x59c4af){return _0x59c4af['destroy']()[_0x0aad('0x27')](function(){_0x5de992[_0x0aad('0x1e')](0xcc)[_0x0aad('0x1f')]();});}};}function handleEntityNotFound(_0x4c1fc2,_0x559a4a){return function(_0x4a67e7){if(!_0x4a67e7){_0x4c1fc2[_0x0aad('0x1d')](0x194);}return _0x4a67e7;};}function handleError(_0x56d64f,_0x15a721){_0x15a721=_0x15a721||0x1f4;return function(_0x25cbbe){logger[_0x0aad('0x28')](_0x25cbbe[_0x0aad('0x29')]);if(_0x25cbbe['name']){delete _0x25cbbe[_0x0aad('0x2a')];}_0x56d64f[_0x0aad('0x1e')](_0x15a721)[_0x0aad('0x2b')](_0x25cbbe);};}exports[_0x0aad('0x2c')]=function(_0x106f7a,_0x23c73c){var _0x58a822={},_0x5980d9={},_0x48ef9a={'count':0x0,'rows':[]};var _0x5bf7c1=_['map'](db['ZohoConfiguration'][_0x0aad('0x2d')],function(_0x109d77){return{'name':_0x109d77[_0x0aad('0x2e')],'type':_0x109d77[_0x0aad('0x2f')][_0x0aad('0x30')]};});_0x5980d9[_0x0aad('0x31')]=_[_0x0aad('0x32')](_0x5bf7c1,_0x0aad('0x2a'));_0x5980d9[_0x0aad('0x33')]=_[_0x0aad('0x34')](_0x106f7a[_0x0aad('0x33')]);_0x5980d9[_0x0aad('0x35')]=_[_0x0aad('0x36')](_0x5980d9[_0x0aad('0x31')],_0x5980d9[_0x0aad('0x33')]);_0x58a822[_0x0aad('0x37')]=_[_0x0aad('0x36')](_0x5980d9[_0x0aad('0x31')],qs[_0x0aad('0x38')](_0x106f7a[_0x0aad('0x33')][_0x0aad('0x38')]));_0x58a822[_0x0aad('0x37')]=_0x58a822['attributes'][_0x0aad('0x39')]?_0x58a822[_0x0aad('0x37')]:_0x5980d9[_0x0aad('0x31')];if(!_0x106f7a[_0x0aad('0x33')][_0x0aad('0x3a')]('nolimit')){_0x58a822[_0x0aad('0x3b')]=qs[_0x0aad('0x3b')](_0x106f7a[_0x0aad('0x33')][_0x0aad('0x3b')]);_0x58a822[_0x0aad('0x20')]=qs['offset'](_0x106f7a[_0x0aad('0x33')][_0x0aad('0x20')]);}_0x58a822['order']=qs[_0x0aad('0x3c')](_0x106f7a['query'][_0x0aad('0x3c')]);_0x58a822[_0x0aad('0x3d')]=qs['filters'](_[_0x0aad('0x3e')](_0x106f7a['query'],_0x5980d9[_0x0aad('0x35')]),_0x5bf7c1);if(_0x106f7a[_0x0aad('0x33')][_0x0aad('0x3f')]){_0x58a822[_0x0aad('0x3d')]=_[_0x0aad('0x40')](_0x58a822[_0x0aad('0x3d')],{'$or':_['map'](_0x5bf7c1,function(_0x4a98c5){if(_0x4a98c5[_0x0aad('0x2f')]!==_0x0aad('0x41')){var _0x1ca777={};_0x1ca777[_0x4a98c5['name']]={'$like':'%'+_0x106f7a[_0x0aad('0x33')]['filter']+'%'};return _0x1ca777;}})});}_0x58a822=_[_0x0aad('0x40')]({},_0x58a822,_0x106f7a[_0x0aad('0x42')]);var _0x34a175={'where':_0x58a822[_0x0aad('0x3d')]};return db[_0x0aad('0x43')][_0x0aad('0x44')](_0x34a175)[_0x0aad('0x27')](function(_0x29e028){_0x48ef9a[_0x0aad('0x44')]=_0x29e028;if(_0x106f7a[_0x0aad('0x33')][_0x0aad('0x45')]){_0x58a822[_0x0aad('0x46')]=[{'all':!![]}];}return db[_0x0aad('0x43')][_0x0aad('0x47')](_0x58a822);})['then'](function(_0x4cd1c1){_0x48ef9a[_0x0aad('0x48')]=_0x4cd1c1;return _0x48ef9a;})[_0x0aad('0x27')](respondWithFilteredResult(_0x23c73c,_0x58a822))[_0x0aad('0x49')](handleError(_0x23c73c,null));};exports['show']=function(_0x3ca109,_0x2a11eb){var _0x32b4f6={'raw':![],'where':{'id':_0x3ca109[_0x0aad('0x4a')]['id']}},_0x19fb53={};_0x19fb53[_0x0aad('0x31')]=_[_0x0aad('0x34')](db[_0x0aad('0x43')][_0x0aad('0x2d')]);_0x19fb53['query']=_[_0x0aad('0x34')](_0x3ca109[_0x0aad('0x33')]);_0x19fb53['filters']=_['intersection'](_0x19fb53[_0x0aad('0x31')],_0x19fb53[_0x0aad('0x33')]);_0x32b4f6[_0x0aad('0x37')]=_[_0x0aad('0x36')](_0x19fb53[_0x0aad('0x31')],qs[_0x0aad('0x38')](_0x3ca109[_0x0aad('0x33')]['fields']));_0x32b4f6[_0x0aad('0x37')]=_0x32b4f6['attributes'][_0x0aad('0x39')]?_0x32b4f6['attributes']:_0x19fb53[_0x0aad('0x31')];if(_0x3ca109[_0x0aad('0x33')][_0x0aad('0x45')]){_0x32b4f6['include']=[{'all':!![]}];}_0x32b4f6=_[_0x0aad('0x40')]({},_0x32b4f6,_0x3ca109[_0x0aad('0x42')]);return db[_0x0aad('0x43')][_0x0aad('0x4b')](_0x32b4f6)[_0x0aad('0x27')](handleEntityNotFound(_0x2a11eb,null))[_0x0aad('0x27')](respondWithResult(_0x2a11eb,null))[_0x0aad('0x49')](handleError(_0x2a11eb,null));};exports[_0x0aad('0x4c')]=function(_0x4e04d0,_0x154cab){return db['ZohoConfiguration']['create'](_0x4e04d0[_0x0aad('0x4d')],{})[_0x0aad('0x27')](respondWithResult(_0x154cab,0xc9))[_0x0aad('0x49')](handleError(_0x154cab,null));};exports[_0x0aad('0x26')]=function(_0x4b7aae,_0x2bb11e){if(_0x4b7aae['body']['id']){delete _0x4b7aae[_0x0aad('0x4d')]['id'];}return db[_0x0aad('0x43')][_0x0aad('0x4b')]({'where':{'id':_0x4b7aae['params']['id']}})[_0x0aad('0x27')](handleEntityNotFound(_0x2bb11e,null))[_0x0aad('0x27')](saveUpdates(_0x4b7aae['body'],null))['then'](respondWithResult(_0x2bb11e,null))[_0x0aad('0x49')](handleError(_0x2bb11e,null));};exports[_0x0aad('0x4e')]=function(_0x25e0f0,_0x56ea09){return db[_0x0aad('0x43')]['find']({'where':{'id':_0x25e0f0['params']['id']}})['then'](handleEntityNotFound(_0x56ea09,null))[_0x0aad('0x27')](removeEntity(_0x56ea09,null))['catch'](handleError(_0x56ea09,null));};exports['getFields']=function(_0x4d7ad8,_0x6c0722,_0x5c97d6){var _0x5261a6={};var _0x105a05={};var _0x443179;var _0x404e69;return db[_0x0aad('0x43')]['findOne']({'where':{'id':_0x4d7ad8[_0x0aad('0x4a')]['id']}})[_0x0aad('0x27')](handleEntityNotFound(_0x6c0722,null))[_0x0aad('0x27')](function(_0xa0a515){if(_0xa0a515){_0x443179=_0xa0a515;_0x105a05[_0x0aad('0x31')]=_['keys'](db[_0x0aad('0x4f')][_0x0aad('0x2d')]);_0x105a05[_0x0aad('0x33')]=_[_0x0aad('0x34')](_0x4d7ad8[_0x0aad('0x33')]);_0x105a05[_0x0aad('0x35')]=_[_0x0aad('0x36')](_0x105a05[_0x0aad('0x31')],_0x105a05['query']);_0x5261a6[_0x0aad('0x37')]=_[_0x0aad('0x36')](_0x105a05[_0x0aad('0x31')],qs[_0x0aad('0x38')](_0x4d7ad8[_0x0aad('0x33')][_0x0aad('0x38')]));_0x5261a6[_0x0aad('0x37')]=_0x5261a6[_0x0aad('0x37')][_0x0aad('0x39')]?_0x5261a6[_0x0aad('0x37')]:_0x105a05[_0x0aad('0x31')];_0x5261a6['order']=qs[_0x0aad('0x3c')](_0x4d7ad8[_0x0aad('0x33')]['sort']);_0x5261a6['where']=qs['filters'](_['pick'](_0x4d7ad8['query'],_0x105a05[_0x0aad('0x35')]));if(_0x4d7ad8['query'][_0x0aad('0x3f')]){_0x5261a6[_0x0aad('0x3d')]=_[_0x0aad('0x40')](_0x5261a6['where'],{'$or':_[_0x0aad('0x32')](_0x5261a6[_0x0aad('0x37')],function(_0x2eaec4){var _0xa0dba1={};_0xa0dba1[_0x2eaec4]={'$like':'%'+_0x4d7ad8['query'][_0x0aad('0x3f')]+'%'};return _0xa0dba1;})});}_0x5261a6=_[_0x0aad('0x40')]({},_0x5261a6,_0x4d7ad8[_0x0aad('0x42')]);return _0x443179[_0x0aad('0x50')](_0x5261a6);}})['then'](function(_0x1827a5){if(_0x1827a5){_0x404e69=_0x1827a5['length'];if(!_0x4d7ad8[_0x0aad('0x33')]['hasOwnProperty'](_0x0aad('0x51'))){_0x5261a6['limit']=qs[_0x0aad('0x3b')](_0x4d7ad8[_0x0aad('0x33')]['limit']);_0x5261a6[_0x0aad('0x20')]=qs[_0x0aad('0x20')](_0x4d7ad8[_0x0aad('0x33')][_0x0aad('0x20')]);}return _0x443179[_0x0aad('0x50')](_0x5261a6);}})[_0x0aad('0x27')](function(_0x5b6028){if(_0x5b6028){return _0x5b6028?{'count':_0x404e69,'rows':_0x5b6028}:null;}})[_0x0aad('0x27')](respondWithResult(_0x6c0722,null))[_0x0aad('0x49')](handleError(_0x6c0722,null));};exports['getSubjects']=function(_0x6878df,_0x533c2b,_0x2d7701){var _0xf47c4b={};var _0x2fd5a4={};var _0x3fd9b6;var _0x580a11;return db[_0x0aad('0x43')][_0x0aad('0x52')]({'where':{'id':_0x6878df[_0x0aad('0x4a')]['id']}})[_0x0aad('0x27')](handleEntityNotFound(_0x533c2b,null))['then'](function(_0x17e586){if(_0x17e586){_0x3fd9b6=_0x17e586;_0x2fd5a4[_0x0aad('0x31')]=_[_0x0aad('0x34')](db[_0x0aad('0x4f')][_0x0aad('0x2d')]);_0x2fd5a4[_0x0aad('0x33')]=_['keys'](_0x6878df['query']);_0x2fd5a4[_0x0aad('0x35')]=_[_0x0aad('0x36')](_0x2fd5a4['model'],_0x2fd5a4['query']);_0xf47c4b[_0x0aad('0x37')]=_[_0x0aad('0x36')](_0x2fd5a4['model'],qs['fields'](_0x6878df[_0x0aad('0x33')][_0x0aad('0x38')]));_0xf47c4b[_0x0aad('0x37')]=_0xf47c4b[_0x0aad('0x37')][_0x0aad('0x39')]?_0xf47c4b[_0x0aad('0x37')]:_0x2fd5a4[_0x0aad('0x31')];_0xf47c4b[_0x0aad('0x53')]=qs[_0x0aad('0x3c')](_0x6878df[_0x0aad('0x33')][_0x0aad('0x3c')]);_0xf47c4b[_0x0aad('0x3d')]=qs['filters'](_[_0x0aad('0x3e')](_0x6878df[_0x0aad('0x33')],_0x2fd5a4[_0x0aad('0x35')]));if(_0x6878df[_0x0aad('0x33')][_0x0aad('0x3f')]){_0xf47c4b[_0x0aad('0x3d')]=_[_0x0aad('0x40')](_0xf47c4b[_0x0aad('0x3d')],{'$or':_['map'](_0xf47c4b[_0x0aad('0x37')],function(_0x6115ee){var _0x52885d={};_0x52885d[_0x6115ee]={'$like':'%'+_0x6878df[_0x0aad('0x33')][_0x0aad('0x3f')]+'%'};return _0x52885d;})});}_0xf47c4b=_[_0x0aad('0x40')]({},_0xf47c4b,_0x6878df[_0x0aad('0x42')]);return _0x3fd9b6[_0x0aad('0x54')](_0xf47c4b);}})[_0x0aad('0x27')](function(_0x9e5183){if(_0x9e5183){_0x580a11=_0x9e5183['length'];if(!_0x6878df[_0x0aad('0x33')][_0x0aad('0x3a')](_0x0aad('0x51'))){_0xf47c4b[_0x0aad('0x3b')]=qs[_0x0aad('0x3b')](_0x6878df[_0x0aad('0x33')]['limit']);_0xf47c4b['offset']=qs[_0x0aad('0x20')](_0x6878df[_0x0aad('0x33')][_0x0aad('0x20')]);}return _0x3fd9b6['getSubjects'](_0xf47c4b);}})['then'](function(_0x37ae5b){if(_0x37ae5b){return _0x37ae5b?{'count':_0x580a11,'rows':_0x37ae5b}:null;}})['then'](respondWithResult(_0x533c2b,null))[_0x0aad('0x49')](handleError(_0x533c2b,null));};exports[_0x0aad('0x55')]=function(_0x316895,_0x3bcdf9,_0x57cb09){var _0x511799={};var _0x7f336e={};var _0x40ea5e;var _0x5601d6;return db['ZohoConfiguration'][_0x0aad('0x52')]({'where':{'id':_0x316895[_0x0aad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3bcdf9,null))[_0x0aad('0x27')](function(_0x2a0c85){if(_0x2a0c85){_0x40ea5e=_0x2a0c85;_0x7f336e[_0x0aad('0x31')]=_[_0x0aad('0x34')](db['ZohoField'][_0x0aad('0x2d')]);_0x7f336e[_0x0aad('0x33')]=_[_0x0aad('0x34')](_0x316895[_0x0aad('0x33')]);_0x7f336e[_0x0aad('0x35')]=_[_0x0aad('0x36')](_0x7f336e[_0x0aad('0x31')],_0x7f336e[_0x0aad('0x33')]);_0x511799[_0x0aad('0x37')]=_['intersection'](_0x7f336e['model'],qs[_0x0aad('0x38')](_0x316895[_0x0aad('0x33')][_0x0aad('0x38')]));_0x511799[_0x0aad('0x37')]=_0x511799[_0x0aad('0x37')][_0x0aad('0x39')]?_0x511799[_0x0aad('0x37')]:_0x7f336e[_0x0aad('0x31')];_0x511799[_0x0aad('0x53')]=qs[_0x0aad('0x3c')](_0x316895[_0x0aad('0x33')]['sort']);_0x511799['where']=qs[_0x0aad('0x35')](_[_0x0aad('0x3e')](_0x316895['query'],_0x7f336e['filters']));if(_0x316895[_0x0aad('0x33')]['filter']){_0x511799[_0x0aad('0x3d')]=_[_0x0aad('0x40')](_0x511799[_0x0aad('0x3d')],{'$or':_[_0x0aad('0x32')](_0x511799[_0x0aad('0x37')],function(_0x39b38b){var _0x5dd1a5={};_0x5dd1a5[_0x39b38b]={'$like':'%'+_0x316895[_0x0aad('0x33')][_0x0aad('0x3f')]+'%'};return _0x5dd1a5;})});}_0x511799=_['merge']({},_0x511799,_0x316895[_0x0aad('0x42')]);return _0x40ea5e[_0x0aad('0x55')](_0x511799);}})[_0x0aad('0x27')](function(_0xa7233c){if(_0xa7233c){_0x5601d6=_0xa7233c[_0x0aad('0x39')];if(!_0x316895[_0x0aad('0x33')][_0x0aad('0x3a')](_0x0aad('0x51'))){_0x511799[_0x0aad('0x3b')]=qs['limit'](_0x316895[_0x0aad('0x33')]['limit']);_0x511799[_0x0aad('0x20')]=qs['offset'](_0x316895['query'][_0x0aad('0x20')]);}return _0x40ea5e[_0x0aad('0x55')](_0x511799);}})['then'](function(_0x106072){if(_0x106072){return _0x106072?{'count':_0x5601d6,'rows':_0x106072}:null;}})[_0x0aad('0x27')](respondWithResult(_0x3bcdf9,null))[_0x0aad('0x49')](handleError(_0x3bcdf9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6d3c369..e581d38 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.model.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8dd7=['bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','lodash','util','api','moment'];(function(_0x589d99,_0x30ceec){var _0x24ceef=function(_0x48d646){while(--_0x48d646){_0x589d99['push'](_0x589d99['shift']());}};_0x24ceef(++_0x30ceec);}(_0x8dd7,0x178));var _0x78dd=function(_0x585f39,_0x2cd7de){_0x585f39=_0x585f39-0x0;var _0x46d6de=_0x8dd7[_0x585f39];return _0x46d6de;};'use strict';var _=require(_0x78dd('0x0'));var util=require(_0x78dd('0x1'));var logger=require('../../config/logger')(_0x78dd('0x2'));var moment=require(_0x78dd('0x3'));var BPromise=require(_0x78dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78dd('0x5'));var rimraf=require(_0x78dd('0x6'));var config=require(_0x78dd('0x7'));var attributes=require(_0x78dd('0x8'));module['exports']=function(_0x18cb98,_0x2766fb){return _0x18cb98['define'](_0x78dd('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42d4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x5c6f7f,_0x7df185){var _0x454080=function(_0x2d38d1){while(--_0x2d38d1){_0x5c6f7f['push'](_0x5c6f7f['shift']());}};_0x454080(++_0x7df185);}(_0x42d4,0x155));var _0x442d=function(_0x3679f7,_0x502867){_0x3679f7=_0x3679f7-0x0;var _0xb6d135=_0x42d4[_0x3679f7];return _0xb6d135;};'use strict';var _=require('lodash');var util=require(_0x442d('0x0'));var logger=require(_0x442d('0x1'))('api');var moment=require(_0x442d('0x2'));var BPromise=require(_0x442d('0x3'));var rp=require(_0x442d('0x4'));var fs=require('fs');var path=require(_0x442d('0x5'));var rimraf=require(_0x442d('0x6'));var config=require(_0x442d('0x7'));var attributes=require(_0x442d('0x8'));module[_0x442d('0x9')]=function(_0x2e65c3,_0x278b8d){return _0x2e65c3[_0x442d('0xa')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 142be19..320c961 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9aa7=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug'];(function(_0x4f3f69,_0x43a907){var _0x311375=function(_0x5bd242){while(--_0x5bd242){_0x4f3f69['push'](_0x4f3f69['shift']());}};_0x311375(++_0x43a907);}(_0x9aa7,0x64));var _0x79aa=function(_0x5f3f8b,_0x3c68ea){_0x5f3f8b=_0x5f3f8b-0x0;var _0x3cbc01=_0x9aa7[_0x5f3f8b];return _0x3cbc01;};'use strict';var _=require(_0x79aa('0x0'));var util=require(_0x79aa('0x1'));var moment=require('moment');var BPromise=require(_0x79aa('0x2'));var rs=require(_0x79aa('0x3'));var fs=require('fs');var Redis=require(_0x79aa('0x4'));var db=require(_0x79aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x79aa('0x6'))(_0x79aa('0x7'));var config=require(_0x79aa('0x8'));var jayson=require(_0x79aa('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x374382,_0x4d9796,_0x584282){return new BPromise(function(_0x6bfc34,_0x1e5ea4){return client[_0x79aa('0xa')](_0x374382,_0x584282)[_0x79aa('0xb')](function(_0x55d067){logger[_0x79aa('0xc')](_0x79aa('0xd'),_0x4d9796,'request\x20sent');logger[_0x79aa('0xe')](_0x79aa('0xf'),_0x4d9796,'request\x20sent',JSON[_0x79aa('0x10')](_0x55d067));if(_0x55d067['error']){if(_0x55d067['error'][_0x79aa('0x11')]===0x1f4){logger['error'](_0x79aa('0xd'),_0x4d9796,_0x55d067[_0x79aa('0x12')][_0x79aa('0x13')]);return _0x1e5ea4(_0x55d067[_0x79aa('0x12')][_0x79aa('0x13')]);}logger[_0x79aa('0x12')](_0x79aa('0xd'),_0x4d9796,_0x55d067['error'][_0x79aa('0x13')]);return _0x6bfc34(_0x55d067['error'][_0x79aa('0x13')]);}else{logger[_0x79aa('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x4d9796,_0x79aa('0x14'));_0x6bfc34(_0x55d067[_0x79aa('0x15')][_0x79aa('0x13')]);}})[_0x79aa('0x16')](function(_0x18ce0f){logger[_0x79aa('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4d9796,_0x18ce0f);_0x1e5ea4(_0x18ce0f);});});} \ No newline at end of file +var _0xc32d=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1602fb,_0x20b6b3){var _0x461831=function(_0x4a19f1){while(--_0x4a19f1){_0x1602fb['push'](_0x1602fb['shift']());}};_0x461831(++_0x20b6b3);}(_0xc32d,0x10a));var _0xdc32=function(_0x49615a,_0x40e9b0){_0x49615a=_0x49615a-0x0;var _0x1a7b41=_0xc32d[_0x49615a];return _0x1a7b41;};'use strict';var _=require(_0xdc32('0x0'));var util=require(_0xdc32('0x1'));var moment=require(_0xdc32('0x2'));var BPromise=require(_0xdc32('0x3'));var rs=require(_0xdc32('0x4'));var fs=require('fs');var Redis=require(_0xdc32('0x5'));var db=require(_0xdc32('0x6'))['db'];var utils=require(_0xdc32('0x7'));var logger=require('../../config/logger')(_0xdc32('0x8'));var config=require(_0xdc32('0x9'));var jayson=require(_0xdc32('0xa'));var client=jayson[_0xdc32('0xb')][_0xdc32('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x159d97,_0x4feaaa,_0x47035a){return new BPromise(function(_0x449d39,_0x2aaee9){return client[_0xdc32('0xd')](_0x159d97,_0x47035a)['then'](function(_0x53378e){logger['info'](_0xdc32('0xe'),_0x4feaaa,_0xdc32('0xf'));logger['debug'](_0xdc32('0x10'),_0x4feaaa,_0xdc32('0xf'),JSON['stringify'](_0x53378e));if(_0x53378e[_0xdc32('0x11')]){if(_0x53378e[_0xdc32('0x11')]['code']===0x1f4){logger[_0xdc32('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x4feaaa,_0x53378e[_0xdc32('0x11')][_0xdc32('0x12')]);return _0x2aaee9(_0x53378e['error']['message']);}logger[_0xdc32('0x11')](_0xdc32('0xe'),_0x4feaaa,_0x53378e[_0xdc32('0x11')][_0xdc32('0x12')]);return _0x449d39(_0x53378e[_0xdc32('0x11')][_0xdc32('0x12')]);}else{logger[_0xdc32('0x13')](_0xdc32('0xe'),_0x4feaaa,'request\x20sent');_0x449d39(_0x53378e['result']['message']);}})[_0xdc32('0x14')](function(_0x55c8bc){logger['error'](_0xdc32('0xe'),_0x4feaaa,_0x55c8bc);_0x2aaee9(_0x55c8bc);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 10efa70..006ffd0 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fc9=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer','util','path'];(function(_0x157111,_0x3a9771){var _0x5b00c4=function(_0x1b15e4){while(--_0x1b15e4){_0x157111['push'](_0x157111['shift']());}};_0x5b00c4(++_0x3a9771);}(_0x9fc9,0x184));var _0x99fc=function(_0x1efb29,_0x534f55){_0x1efb29=_0x1efb29-0x0;var _0x70a633=_0x9fc9[_0x1efb29];return _0x70a633;};'use strict';var multer=require(_0x99fc('0x0'));var util=require(_0x99fc('0x1'));var path=require(_0x99fc('0x2'));var timeout=require(_0x99fc('0x3'));var express=require(_0x99fc('0x4'));var router=express['Router']();var fs_extra=require(_0x99fc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x99fc('0x6'));var config=require(_0x99fc('0x7'));var controller=require(_0x99fc('0x8'));router['get']('/',auth[_0x99fc('0x9')](),controller[_0x99fc('0xa')]);router['get'](_0x99fc('0xb'),auth[_0x99fc('0x9')](),controller['show']);router[_0x99fc('0xc')]('/',auth[_0x99fc('0x9')](),controller[_0x99fc('0xd')]);router[_0x99fc('0xe')](_0x99fc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x99fc('0xf')](_0x99fc('0xb'),auth['isAuthenticated'](),controller[_0x99fc('0x10')]);module['exports']=router; \ No newline at end of file +var _0x326e=['./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x326e,0x15c));var _0xe326=function(_0x3909e4,_0x19b566){_0x3909e4=_0x3909e4-0x0;var _0x8cb92b=_0x326e[_0x3909e4];return _0x8cb92b;};'use strict';var multer=require(_0xe326('0x0'));var util=require('util');var path=require(_0xe326('0x1'));var timeout=require(_0xe326('0x2'));var express=require(_0xe326('0x3'));var router=express[_0xe326('0x4')]();var fs_extra=require(_0xe326('0x5'));var auth=require(_0xe326('0x6'));var interaction=require(_0xe326('0x7'));var config=require(_0xe326('0x8'));var controller=require(_0xe326('0x9'));router[_0xe326('0xa')]('/',auth[_0xe326('0xb')](),controller[_0xe326('0xc')]);router[_0xe326('0xa')](_0xe326('0xd'),auth[_0xe326('0xb')](),controller['show']);router[_0xe326('0xe')]('/',auth[_0xe326('0xb')](),controller[_0xe326('0xf')]);router[_0xe326('0x10')](_0xe326('0xd'),auth[_0xe326('0xb')](),controller[_0xe326('0x11')]);router[_0xe326('0x12')](_0xe326('0xd'),auth[_0xe326('0xb')](),controller[_0xe326('0x13')]);module[_0xe326('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index a980fc5..2ac8bd5 100644 --- a/server/api/intZohoField/intZohoField.attributes.js +++ b/server/api/intZohoField/intZohoField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8211=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8211,0x117));var _0x1821=function(_0x5c6a23,_0xb7b065){_0x5c6a23=_0x5c6a23-0x0;var _0x3436ef=_0x8211[_0x5c6a23];return _0x3436ef;};'use strict';var Sequelize=require(_0x1821('0x0'));module['exports']={'type':{'type':Sequelize[_0x1821('0x1')](_0x1821('0x2'),_0x1821('0x3'),_0x1821('0x4'),_0x1821('0x5'),'picklist'),'defaultValue':_0x1821('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1821('0x1')](_0x1821('0x2'),_0x1821('0x3'),_0x1821('0x4'))},'keyContent':{'type':Sequelize[_0x1821('0x6')]},'idField':{'type':Sequelize[_0x1821('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1821('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1821('0x6')]}}; \ No newline at end of file +var _0xe922=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist'];(function(_0x32c586,_0x15b714){var _0x33ad18=function(_0x17e8fc){while(--_0x17e8fc){_0x32c586['push'](_0x32c586['shift']());}};_0x33ad18(++_0x15b714);}(_0xe922,0xa5));var _0x2e92=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xe922[_0xa30766];return _0x24e780;};'use strict';var Sequelize=require(_0x2e92('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x2e92('0x1'),_0x2e92('0x2'),_0x2e92('0x3'),_0x2e92('0x4'),_0x2e92('0x5')),'defaultValue':_0x2e92('0x1')},'content':{'type':Sequelize[_0x2e92('0x6')]},'key':{'type':Sequelize[_0x2e92('0x6')]},'keyType':{'type':Sequelize[_0x2e92('0x7')](_0x2e92('0x1'),'variable',_0x2e92('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2e92('0x6')]},'customField':{'type':Sequelize[_0x2e92('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d3620bb..d768c9c 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97e7=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set'];(function(_0x14f2dc,_0x55f185){var _0x31e975=function(_0x3c97fb){while(--_0x3c97fb){_0x14f2dc['push'](_0x14f2dc['shift']());}};_0x31e975(++_0x55f185);}(_0x97e7,0x7a));var _0x797e=function(_0x5c30ce,_0xdfc30b){_0x5c30ce=_0x5c30ce-0x0;var _0x5def98=_0x97e7[_0x5c30ce];return _0x5def98;};'use strict';var emlformat=require(_0x797e('0x0'));var rimraf=require(_0x797e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x797e('0x2'));var rp=require(_0x797e('0x3'));var moment=require(_0x797e('0x4'));var BPromise=require(_0x797e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x797e('0x6'));var sox=require(_0x797e('0x7'));var csv=require('to-csv');var ejs=require(_0x797e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x797e('0x9'));var squel=require(_0x797e('0xa'));var crypto=require(_0x797e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x797e('0xc'));var toCsv=require(_0x797e('0xd'));var querystring=require('querystring');var Papa=require(_0x797e('0xe'));var Redis=require(_0x797e('0xf'));var authService=require(_0x797e('0x10'));var qs=require(_0x797e('0x11'));var as=require(_0x797e('0x12'));var hardwareService=require(_0x797e('0x13'));var logger=require('../../config/logger')(_0x797e('0x14'));var utils=require('../../config/utils');var config=require(_0x797e('0x15'));var licenseUtil=require(_0x797e('0x16'));var db=require(_0x797e('0x17'))['db'];function respondWithStatusCode(_0x302ccb,_0x5b7315){_0x5b7315=_0x5b7315||0xcc;return function(_0x4b8063){if(_0x4b8063){return _0x302ccb['sendStatus'](_0x5b7315);}return _0x302ccb['status'](_0x5b7315)[_0x797e('0x18')]();};}function respondWithResult(_0x59ac08,_0x4016f6){_0x4016f6=_0x4016f6||0xc8;return function(_0x85791d){if(_0x85791d){return _0x59ac08[_0x797e('0x19')](_0x4016f6)[_0x797e('0x1a')](_0x85791d);}};}function respondWithFilteredResult(_0x6dba47,_0x5e10e6){return function(_0x14cff8){if(_0x14cff8){var _0x567e6c=typeof _0x5e10e6[_0x797e('0x1b')]===_0x797e('0x1c')&&typeof _0x5e10e6[_0x797e('0x1d')]===_0x797e('0x1c');var _0x2c7922=_0x14cff8[_0x797e('0x1e')];var _0xfaab85=_0x567e6c?0x0:_0x5e10e6['offset'];var _0x566d9f=_0x567e6c?_0x14cff8[_0x797e('0x1e')]:_0x5e10e6[_0x797e('0x1b')]+_0x5e10e6[_0x797e('0x1d')];var _0x5375ae;if(_0x566d9f>=_0x2c7922){_0x566d9f=_0x2c7922;_0x5375ae=0xc8;}else{_0x5375ae=0xce;}_0x6dba47[_0x797e('0x19')](_0x5375ae);return _0x6dba47[_0x797e('0x1f')](_0x797e('0x20'),_0xfaab85+'-'+_0x566d9f+'/'+_0x2c7922)[_0x797e('0x1a')](_0x14cff8);}return null;};}function patchUpdates(_0x1eec17){return function(_0x288c61){try{jsonpatch[_0x797e('0x21')](_0x288c61,_0x1eec17,!![]);}catch(_0x482b9f){return BPromise[_0x797e('0x22')](_0x482b9f);}return _0x288c61[_0x797e('0x23')]();};}function saveUpdates(_0x55776,_0x3aa4d0){return function(_0x51b40f){if(_0x51b40f){return _0x51b40f[_0x797e('0x24')](_0x55776)[_0x797e('0x25')](function(_0x77de97){return _0x77de97;});}return null;};}function removeEntity(_0x341dc6,_0x28cd37){return function(_0x529caf){if(_0x529caf){return _0x529caf[_0x797e('0x26')]()[_0x797e('0x25')](function(){_0x341dc6[_0x797e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300e29,_0x122923){return function(_0x54e02f){if(!_0x54e02f){_0x300e29[_0x797e('0x27')](0x194);}return _0x54e02f;};}function handleError(_0x1d8166,_0x4bf88a){_0x4bf88a=_0x4bf88a||0x1f4;return function(_0x4d4c32){logger[_0x797e('0x28')](_0x4d4c32[_0x797e('0x29')]);if(_0x4d4c32[_0x797e('0x2a')]){delete _0x4d4c32[_0x797e('0x2a')];}_0x1d8166[_0x797e('0x19')](_0x4bf88a)[_0x797e('0x2b')](_0x4d4c32);};}exports[_0x797e('0x2c')]=function(_0x257c21,_0x29a14f){var _0x3241a5={},_0x562eab={},_0x5bf0fb={'count':0x0,'rows':[]};var _0x5087b4=_[_0x797e('0x2d')](db[_0x797e('0x2e')][_0x797e('0x2f')],function(_0xb69f81){return{'name':_0xb69f81[_0x797e('0x30')],'type':_0xb69f81['type'][_0x797e('0x31')]};});_0x562eab[_0x797e('0x32')]=_['map'](_0x5087b4,'name');_0x562eab[_0x797e('0x33')]=_[_0x797e('0x34')](_0x257c21[_0x797e('0x33')]);_0x562eab['filters']=_[_0x797e('0x35')](_0x562eab[_0x797e('0x32')],_0x562eab[_0x797e('0x33')]);_0x3241a5[_0x797e('0x36')]=_[_0x797e('0x35')](_0x562eab[_0x797e('0x32')],qs[_0x797e('0x37')](_0x257c21[_0x797e('0x33')]['fields']));_0x3241a5[_0x797e('0x36')]=_0x3241a5[_0x797e('0x36')][_0x797e('0x38')]?_0x3241a5[_0x797e('0x36')]:_0x562eab['model'];if(!_0x257c21[_0x797e('0x33')][_0x797e('0x39')](_0x797e('0x3a'))){_0x3241a5[_0x797e('0x1d')]=qs[_0x797e('0x1d')](_0x257c21[_0x797e('0x33')][_0x797e('0x1d')]);_0x3241a5[_0x797e('0x1b')]=qs[_0x797e('0x1b')](_0x257c21[_0x797e('0x33')][_0x797e('0x1b')]);}_0x3241a5[_0x797e('0x3b')]=qs['sort'](_0x257c21[_0x797e('0x33')][_0x797e('0x3c')]);_0x3241a5[_0x797e('0x3d')]=qs['filters'](_[_0x797e('0x3e')](_0x257c21[_0x797e('0x33')],_0x562eab[_0x797e('0x3f')]),_0x5087b4);if(_0x257c21['query'][_0x797e('0x40')]){_0x3241a5[_0x797e('0x3d')]=_[_0x797e('0x41')](_0x3241a5[_0x797e('0x3d')],{'$or':_[_0x797e('0x2d')](_0x5087b4,function(_0x29e271){if(_0x29e271[_0x797e('0x42')]!=='VIRTUAL'){var _0x24625b={};_0x24625b[_0x29e271[_0x797e('0x2a')]]={'$like':'%'+_0x257c21[_0x797e('0x33')][_0x797e('0x40')]+'%'};return _0x24625b;}})});}_0x3241a5=_[_0x797e('0x41')]({},_0x3241a5,_0x257c21[_0x797e('0x43')]);var _0x384778={'where':_0x3241a5[_0x797e('0x3d')]};return db[_0x797e('0x2e')][_0x797e('0x1e')](_0x384778)['then'](function(_0x27ca6e){_0x5bf0fb[_0x797e('0x1e')]=_0x27ca6e;if(_0x257c21[_0x797e('0x33')][_0x797e('0x44')]){_0x3241a5[_0x797e('0x45')]=[{'all':!![]}];}return db[_0x797e('0x2e')][_0x797e('0x46')](_0x3241a5);})[_0x797e('0x25')](function(_0x249850){_0x5bf0fb[_0x797e('0x47')]=_0x249850;return _0x5bf0fb;})[_0x797e('0x25')](respondWithFilteredResult(_0x29a14f,_0x3241a5))[_0x797e('0x48')](handleError(_0x29a14f,null));};exports['show']=function(_0x420d1b,_0x175f95){var _0xa5a3fe={'raw':!![],'where':{'id':_0x420d1b['params']['id']}},_0x4d3e6d={};_0x4d3e6d['model']=_[_0x797e('0x34')](db[_0x797e('0x2e')][_0x797e('0x2f')]);_0x4d3e6d[_0x797e('0x33')]=_['keys'](_0x420d1b[_0x797e('0x33')]);_0x4d3e6d[_0x797e('0x3f')]=_[_0x797e('0x35')](_0x4d3e6d[_0x797e('0x32')],_0x4d3e6d[_0x797e('0x33')]);_0xa5a3fe[_0x797e('0x36')]=_[_0x797e('0x35')](_0x4d3e6d[_0x797e('0x32')],qs[_0x797e('0x37')](_0x420d1b[_0x797e('0x33')][_0x797e('0x37')]));_0xa5a3fe[_0x797e('0x36')]=_0xa5a3fe[_0x797e('0x36')][_0x797e('0x38')]?_0xa5a3fe['attributes']:_0x4d3e6d['model'];if(_0x420d1b['query'][_0x797e('0x44')]){_0xa5a3fe[_0x797e('0x45')]=[{'all':!![]}];}_0xa5a3fe=_[_0x797e('0x41')]({},_0xa5a3fe,_0x420d1b[_0x797e('0x43')]);return db['ZohoField'][_0x797e('0x49')](_0xa5a3fe)['then'](handleEntityNotFound(_0x175f95,null))['then'](respondWithResult(_0x175f95,null))['catch'](handleError(_0x175f95,null));};exports[_0x797e('0x4a')]=function(_0xc578ba,_0x46ff32){return db[_0x797e('0x2e')][_0x797e('0x4a')](_0xc578ba['body'],{})['then'](respondWithResult(_0x46ff32,0xc9))[_0x797e('0x48')](handleError(_0x46ff32,null));};exports[_0x797e('0x24')]=function(_0x1cf24b,_0x40497c){if(_0x1cf24b['body']['id']){delete _0x1cf24b[_0x797e('0x4b')]['id'];}return db['ZohoField'][_0x797e('0x49')]({'where':{'id':_0x1cf24b[_0x797e('0x4c')]['id']}})[_0x797e('0x25')](handleEntityNotFound(_0x40497c,null))[_0x797e('0x25')](saveUpdates(_0x1cf24b[_0x797e('0x4b')],null))[_0x797e('0x25')](respondWithResult(_0x40497c,null))[_0x797e('0x48')](handleError(_0x40497c,null));};exports[_0x797e('0x26')]=function(_0x3b3c27,_0x2b1417){return db[_0x797e('0x2e')]['find']({'where':{'id':_0x3b3c27[_0x797e('0x4c')]['id']}})[_0x797e('0x25')](handleEntityNotFound(_0x2b1417,null))[_0x797e('0x25')](removeEntity(_0x2b1417,null))[_0x797e('0x48')](handleError(_0x2b1417,null));}; \ No newline at end of file +var _0x55e9=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','pick','filter','where','merge','options','ZohoField','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x55e9,0x195));var _0x955e=function(_0x213ed5,_0x26712a){_0x213ed5=_0x213ed5-0x0;var _0x191514=_0x55e9[_0x213ed5];return _0x191514;};'use strict';var emlformat=require(_0x955e('0x0'));var rimraf=require(_0x955e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x955e('0x2'));var rp=require(_0x955e('0x3'));var moment=require(_0x955e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x955e('0x5'));var path=require(_0x955e('0x6'));var sox=require('sox');var csv=require(_0x955e('0x7'));var ejs=require(_0x955e('0x8'));var fs=require('fs');var fs_extra=require(_0x955e('0x9'));var _=require(_0x955e('0xa'));var squel=require(_0x955e('0xb'));var crypto=require('crypto');var jsforce=require(_0x955e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x955e('0x7'));var querystring=require(_0x955e('0xd'));var Papa=require(_0x955e('0xe'));var Redis=require('ioredis');var authService=require(_0x955e('0xf'));var qs=require(_0x955e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x955e('0x11'))(_0x955e('0x12'));var utils=require(_0x955e('0x13'));var config=require(_0x955e('0x14'));var licenseUtil=require(_0x955e('0x15'));var db=require(_0x955e('0x16'))['db'];function respondWithStatusCode(_0x27db08,_0x1281bc){_0x1281bc=_0x1281bc||0xcc;return function(_0x3ed9aa){if(_0x3ed9aa){return _0x27db08[_0x955e('0x17')](_0x1281bc);}return _0x27db08[_0x955e('0x18')](_0x1281bc)[_0x955e('0x19')]();};}function respondWithResult(_0x3bc15d,_0x40e9b8){_0x40e9b8=_0x40e9b8||0xc8;return function(_0x126483){if(_0x126483){return _0x3bc15d[_0x955e('0x18')](_0x40e9b8)[_0x955e('0x1a')](_0x126483);}};}function respondWithFilteredResult(_0x1fc130,_0x264140){return function(_0x50f050){if(_0x50f050){var _0x5c2e10=typeof _0x264140['offset']===_0x955e('0x1b')&&typeof _0x264140[_0x955e('0x1c')]==='undefined';var _0x166fa9=_0x50f050[_0x955e('0x1d')];var _0x5bdbeb=_0x5c2e10?0x0:_0x264140[_0x955e('0x1e')];var _0x26efab=_0x5c2e10?_0x50f050[_0x955e('0x1d')]:_0x264140['offset']+_0x264140[_0x955e('0x1c')];var _0x4908c1;if(_0x26efab>=_0x166fa9){_0x26efab=_0x166fa9;_0x4908c1=0xc8;}else{_0x4908c1=0xce;}_0x1fc130[_0x955e('0x18')](_0x4908c1);return _0x1fc130[_0x955e('0x1f')](_0x955e('0x20'),_0x5bdbeb+'-'+_0x26efab+'/'+_0x166fa9)[_0x955e('0x1a')](_0x50f050);}return null;};}function patchUpdates(_0x4419be){return function(_0x271a95){try{jsonpatch[_0x955e('0x21')](_0x271a95,_0x4419be,!![]);}catch(_0x15d80f){return BPromise[_0x955e('0x22')](_0x15d80f);}return _0x271a95['save']();};}function saveUpdates(_0x26cf8d,_0x8043ca){return function(_0x20e14f){if(_0x20e14f){return _0x20e14f[_0x955e('0x23')](_0x26cf8d)[_0x955e('0x24')](function(_0x12b755){return _0x12b755;});}return null;};}function removeEntity(_0x7c4607,_0x815c9e){return function(_0x352cd1){if(_0x352cd1){return _0x352cd1[_0x955e('0x25')]()[_0x955e('0x24')](function(){_0x7c4607[_0x955e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeae92,_0x1b6bc5){return function(_0x1931a8){if(!_0x1931a8){_0xeae92[_0x955e('0x17')](0x194);}return _0x1931a8;};}function handleError(_0x40b7bd,_0x5405c4){_0x5405c4=_0x5405c4||0x1f4;return function(_0x368173){logger[_0x955e('0x26')](_0x368173[_0x955e('0x27')]);if(_0x368173['name']){delete _0x368173[_0x955e('0x28')];}_0x40b7bd[_0x955e('0x18')](_0x5405c4)['send'](_0x368173);};}exports[_0x955e('0x29')]=function(_0x5681f2,_0x30ad05){var _0x1fce16={},_0x21b461={},_0x45ff7c={'count':0x0,'rows':[]};var _0x52c5a2=_['map'](db['ZohoField'][_0x955e('0x2a')],function(_0x1b6d7e){return{'name':_0x1b6d7e['fieldName'],'type':_0x1b6d7e[_0x955e('0x2b')][_0x955e('0x2c')]};});_0x21b461['model']=_['map'](_0x52c5a2,_0x955e('0x28'));_0x21b461[_0x955e('0x2d')]=_[_0x955e('0x2e')](_0x5681f2[_0x955e('0x2d')]);_0x21b461[_0x955e('0x2f')]=_[_0x955e('0x30')](_0x21b461[_0x955e('0x31')],_0x21b461[_0x955e('0x2d')]);_0x1fce16[_0x955e('0x32')]=_[_0x955e('0x30')](_0x21b461[_0x955e('0x31')],qs[_0x955e('0x33')](_0x5681f2[_0x955e('0x2d')][_0x955e('0x33')]));_0x1fce16[_0x955e('0x32')]=_0x1fce16[_0x955e('0x32')]['length']?_0x1fce16[_0x955e('0x32')]:_0x21b461[_0x955e('0x31')];if(!_0x5681f2['query']['hasOwnProperty'](_0x955e('0x34'))){_0x1fce16[_0x955e('0x1c')]=qs[_0x955e('0x1c')](_0x5681f2[_0x955e('0x2d')][_0x955e('0x1c')]);_0x1fce16[_0x955e('0x1e')]=qs[_0x955e('0x1e')](_0x5681f2[_0x955e('0x2d')]['offset']);}_0x1fce16['order']=qs[_0x955e('0x35')](_0x5681f2['query'][_0x955e('0x35')]);_0x1fce16['where']=qs['filters'](_[_0x955e('0x36')](_0x5681f2['query'],_0x21b461['filters']),_0x52c5a2);if(_0x5681f2[_0x955e('0x2d')][_0x955e('0x37')]){_0x1fce16[_0x955e('0x38')]=_['merge'](_0x1fce16[_0x955e('0x38')],{'$or':_['map'](_0x52c5a2,function(_0x2dbd2a){if(_0x2dbd2a[_0x955e('0x2b')]!=='VIRTUAL'){var _0x53c76b={};_0x53c76b[_0x2dbd2a[_0x955e('0x28')]]={'$like':'%'+_0x5681f2[_0x955e('0x2d')]['filter']+'%'};return _0x53c76b;}})});}_0x1fce16=_[_0x955e('0x39')]({},_0x1fce16,_0x5681f2[_0x955e('0x3a')]);var _0x1f985f={'where':_0x1fce16[_0x955e('0x38')]};return db[_0x955e('0x3b')][_0x955e('0x1d')](_0x1f985f)['then'](function(_0x5b90ab){_0x45ff7c[_0x955e('0x1d')]=_0x5b90ab;if(_0x5681f2[_0x955e('0x2d')]['includeAll']){_0x1fce16[_0x955e('0x3c')]=[{'all':!![]}];}return db['ZohoField'][_0x955e('0x3d')](_0x1fce16);})[_0x955e('0x24')](function(_0x4f6c31){_0x45ff7c[_0x955e('0x3e')]=_0x4f6c31;return _0x45ff7c;})[_0x955e('0x24')](respondWithFilteredResult(_0x30ad05,_0x1fce16))[_0x955e('0x3f')](handleError(_0x30ad05,null));};exports[_0x955e('0x40')]=function(_0x56fadd,_0x59b835){var _0x278c67={'raw':!![],'where':{'id':_0x56fadd[_0x955e('0x41')]['id']}},_0x5548ff={};_0x5548ff[_0x955e('0x31')]=_[_0x955e('0x2e')](db[_0x955e('0x3b')][_0x955e('0x2a')]);_0x5548ff[_0x955e('0x2d')]=_[_0x955e('0x2e')](_0x56fadd[_0x955e('0x2d')]);_0x5548ff[_0x955e('0x2f')]=_['intersection'](_0x5548ff[_0x955e('0x31')],_0x5548ff[_0x955e('0x2d')]);_0x278c67[_0x955e('0x32')]=_[_0x955e('0x30')](_0x5548ff[_0x955e('0x31')],qs['fields'](_0x56fadd[_0x955e('0x2d')][_0x955e('0x33')]));_0x278c67['attributes']=_0x278c67['attributes'][_0x955e('0x42')]?_0x278c67['attributes']:_0x5548ff['model'];if(_0x56fadd[_0x955e('0x2d')][_0x955e('0x43')]){_0x278c67[_0x955e('0x3c')]=[{'all':!![]}];}_0x278c67=_[_0x955e('0x39')]({},_0x278c67,_0x56fadd[_0x955e('0x3a')]);return db[_0x955e('0x3b')][_0x955e('0x44')](_0x278c67)['then'](handleEntityNotFound(_0x59b835,null))[_0x955e('0x24')](respondWithResult(_0x59b835,null))[_0x955e('0x3f')](handleError(_0x59b835,null));};exports[_0x955e('0x45')]=function(_0x3149c9,_0x4e3834){return db[_0x955e('0x3b')][_0x955e('0x45')](_0x3149c9['body'],{})[_0x955e('0x24')](respondWithResult(_0x4e3834,0xc9))['catch'](handleError(_0x4e3834,null));};exports[_0x955e('0x23')]=function(_0x4ff68a,_0x52a706){if(_0x4ff68a['body']['id']){delete _0x4ff68a['body']['id'];}return db['ZohoField'][_0x955e('0x44')]({'where':{'id':_0x4ff68a[_0x955e('0x41')]['id']}})[_0x955e('0x24')](handleEntityNotFound(_0x52a706,null))[_0x955e('0x24')](saveUpdates(_0x4ff68a[_0x955e('0x46')],null))[_0x955e('0x24')](respondWithResult(_0x52a706,null))[_0x955e('0x3f')](handleError(_0x52a706,null));};exports[_0x955e('0x25')]=function(_0x51dbc1,_0x52d2e1){return db[_0x955e('0x3b')]['find']({'where':{'id':_0x51dbc1['params']['id']}})[_0x955e('0x24')](handleEntityNotFound(_0x52d2e1,null))['then'](removeEntity(_0x52d2e1,null))['catch'](handleError(_0x52d2e1,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 05178bf..8a28620 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf2e3[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5464=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash'];(function(_0x55716c,_0x1a427f){var _0x24f703=function(_0x58272d){while(--_0x58272d){_0x55716c['push'](_0x55716c['shift']());}};_0x24f703(++_0x1a427f);}(_0x5464,0x15d));var _0x4546=function(_0x3a9257,_0x3d73b7){_0x3a9257=_0x3a9257-0x0;var _0x2b776a=_0x5464[_0x3a9257];return _0x2b776a;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xc'),_0x4546('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 8e65aff..270a9ff 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3725=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x48788c,_0x22c6cf){var _0x111b0f=function(_0x4087db){while(--_0x4087db){_0x48788c['push'](_0x48788c['shift']());}};_0x111b0f(++_0x22c6cf);}(_0x3725,0x1ea));var _0x5372=function(_0x1c7954,_0x2528b1){_0x1c7954=_0x1c7954-0x0;var _0x4f317b=_0x3725[_0x1c7954];return _0x4f317b;};'use strict';var _=require(_0x5372('0x0'));var util=require('util');var moment=require(_0x5372('0x1'));var BPromise=require('bluebird');var rs=require(_0x5372('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5372('0x3'));var logger=require(_0x5372('0x4'))(_0x5372('0x5'));var config=require(_0x5372('0x6'));var jayson=require(_0x5372('0x7'));var client=jayson[_0x5372('0x8')][_0x5372('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa2ddff,_0x32719e,_0x1be696){return new BPromise(function(_0x200df8,_0x22fd0a){return client[_0x5372('0xa')](_0xa2ddff,_0x1be696)['then'](function(_0x1c3b25){logger[_0x5372('0xb')]('ZohoField,\x20%s,\x20%s',_0x32719e,_0x5372('0xc'));logger[_0x5372('0xd')](_0x5372('0xe'),_0x32719e,_0x5372('0xc'),JSON[_0x5372('0xf')](_0x1c3b25));if(_0x1c3b25[_0x5372('0x10')]){if(_0x1c3b25['error']['code']===0x1f4){logger[_0x5372('0x10')](_0x5372('0x11'),_0x32719e,_0x1c3b25[_0x5372('0x10')]['message']);return _0x22fd0a(_0x1c3b25[_0x5372('0x10')][_0x5372('0x12')]);}logger[_0x5372('0x10')](_0x5372('0x11'),_0x32719e,_0x1c3b25[_0x5372('0x10')][_0x5372('0x12')]);return _0x200df8(_0x1c3b25['error'][_0x5372('0x12')]);}else{logger[_0x5372('0xb')](_0x5372('0x11'),_0x32719e,_0x5372('0xc'));_0x200df8(_0x1c3b25[_0x5372('0x13')][_0x5372('0x12')]);}})[_0x5372('0x14')](function(_0x140a9d){logger[_0x5372('0x10')]('ZohoField,\x20%s,\x20%s',_0x32719e,_0x140a9d);_0x22fd0a(_0x140a9d);});});} \ No newline at end of file +var _0x997d=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s'];(function(_0x21f72b,_0x2f6016){var _0x358e81=function(_0x1b9723){while(--_0x1b9723){_0x21f72b['push'](_0x21f72b['shift']());}};_0x358e81(++_0x2f6016);}(_0x997d,0x10b));var _0xd997=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x997d[_0x3cf5a3];return _0x39ba2d;};'use strict';var _=require(_0xd997('0x0'));var util=require(_0xd997('0x1'));var moment=require(_0xd997('0x2'));var BPromise=require(_0xd997('0x3'));var rs=require(_0xd997('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd997('0x5'))['db'];var utils=require(_0xd997('0x6'));var logger=require(_0xd997('0x7'))(_0xd997('0x8'));var config=require(_0xd997('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd997('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cff9c,_0x2d103a,_0x50ba52){return new BPromise(function(_0x27c942,_0x20a922){return client[_0xd997('0xb')](_0x5cff9c,_0x50ba52)[_0xd997('0xc')](function(_0x19e7f4){logger[_0xd997('0xd')]('ZohoField,\x20%s,\x20%s',_0x2d103a,_0xd997('0xe'));logger[_0xd997('0xf')](_0xd997('0x10'),_0x2d103a,_0xd997('0xe'),JSON[_0xd997('0x11')](_0x19e7f4));if(_0x19e7f4[_0xd997('0x12')]){if(_0x19e7f4[_0xd997('0x12')][_0xd997('0x13')]===0x1f4){logger[_0xd997('0x12')](_0xd997('0x14'),_0x2d103a,_0x19e7f4[_0xd997('0x12')][_0xd997('0x15')]);return _0x20a922(_0x19e7f4['error'][_0xd997('0x15')]);}logger[_0xd997('0x12')]('ZohoField,\x20%s,\x20%s',_0x2d103a,_0x19e7f4['error']['message']);return _0x27c942(_0x19e7f4[_0xd997('0x12')][_0xd997('0x15')]);}else{logger[_0xd997('0xd')]('ZohoField,\x20%s,\x20%s',_0x2d103a,_0xd997('0xe'));_0x27c942(_0x19e7f4[_0xd997('0x16')][_0xd997('0x15')]);}})[_0xd997('0x17')](function(_0x88571){logger['error'](_0xd997('0x14'),_0x2d103a,_0x88571);_0x20a922(_0x88571);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a2ef847..dc113fb 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4d6e8e,_0x276467){var _0x242812=function(_0x52681b){while(--_0x52681b){_0x4d6e8e['push'](_0x4d6e8e['shift']());}};_0x242812(++_0x276467);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index cc0c73a..e0ddbcc 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1cb=['app.js','INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version'];(function(_0x50a19b,_0x80c4d0){var _0x19b42d=function(_0x15a23f){while(--_0x15a23f){_0x50a19b['push'](_0x50a19b['shift']());}};_0x19b42d(++_0x80c4d0);}(_0xf1cb,0x6d));var _0xbf1c=function(_0x10f603,_0x575599){_0x10f603=_0x10f603-0x0;var _0x1cd04c=_0xf1cb[_0x10f603];return _0x1cd04c;};'use strict';var Sequelize=require(_0xbf1c('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf1c('0x1')],'allowNull':![],'unique':_0xbf1c('0x2')},'version':{'type':Sequelize[_0xbf1c('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xbf1c('0x1')],'defaultValue':_0xbf1c('0x3')},'filename':{'type':Sequelize[_0xbf1c('0x1')]},'path':{'type':Sequelize[_0xbf1c('0x1')]},'type':{'type':Sequelize[_0xbf1c('0x1')]},'size':{'type':Sequelize[_0xbf1c('0x4')]},'active':{'type':Sequelize[_0xbf1c('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xbf1c('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xbf1c('0x1')],'unique':_0xbf1c('0x6')},'description':{'type':Sequelize[_0xbf1c('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbf1c('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x5d25=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','INTEGER'];(function(_0x12ef9a,_0x5dfbf7){var _0x3a6833=function(_0x38e1bd){while(--_0x38e1bd){_0x12ef9a['push'](_0x12ef9a['shift']());}};_0x3a6833(++_0x5dfbf7);}(_0x5d25,0x8e));var _0x55d2=function(_0x5d7042,_0x52ae62){_0x5d7042=_0x5d7042-0x0;var _0x38db3e=_0x5d25[_0x5d7042];return _0x38db3e;};'use strict';var Sequelize=require(_0x55d2('0x0'));module[_0x55d2('0x1')]={'name':{'type':Sequelize[_0x55d2('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x55d2('0x2')],'allowNull':![],'unique':_0x55d2('0x3')},'main':{'type':Sequelize[_0x55d2('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x55d2('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x55d2('0x2')]},'size':{'type':Sequelize[_0x55d2('0x4')]},'active':{'type':Sequelize[_0x55d2('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x55d2('0x2')]},'state':{'type':Sequelize[_0x55d2('0x2')],'unique':_0x55d2('0x6')},'description':{'type':Sequelize[_0x55d2('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x55d2('0x2')]},'link':{'type':Sequelize[_0x55d2('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index fd0c587..d346635 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71ab=['query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','Integration','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['Integration']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['Integration']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['Integration'][_0xb71a('0x47')](_0x1f29b7[_0xb71a('0x48')],{})[_0xb71a('0x24')](respondWithResult(_0x365bed,0xc9))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports['update']=function(_0x48fbde,_0x23b4c0){if(_0x48fbde[_0xb71a('0x48')]['id']){delete _0x48fbde[_0xb71a('0x48')]['id'];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'id':_0x48fbde[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x23b4c0,null))[_0xb71a('0x24')](saveUpdates(_0x48fbde[_0xb71a('0x48')],null))[_0xb71a('0x24')](respondWithResult(_0x23b4c0,null))['catch'](handleError(_0x23b4c0,null));};exports[_0xb71a('0x25')]=function(_0x2ce711,_0x500196){return db[_0xb71a('0x3f')]['find']({'where':{'id':_0x2ce711[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x500196,null))[_0xb71a('0x24')](removeEntity(_0x500196,null))[_0xb71a('0x42')](handleError(_0x500196,null));}; \ No newline at end of file +var _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x1967,0x173));var _0x7196=function(_0x401681,_0x36c9c8){_0x401681=_0x401681-0x0;var _0x2e240c=_0x1967[_0x401681];return _0x2e240c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 60584fa..1e012e9 100644 --- a/server/api/integration/integration.model.js +++ b/server/api/integration/integration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa850=['bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','util','api'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa850,0x17a));var _0x0a85=function(_0x162304,_0x1f6420){_0x162304=_0x162304-0x0;var _0x53e284=_0xa850[_0x162304];return _0x53e284;};'use strict';var _=require('lodash');var util=require(_0x0a85('0x0'));var logger=require('../../config/logger')(_0x0a85('0x1'));var moment=require('moment');var BPromise=require(_0x0a85('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a85('0x3'));var rimraf=require(_0x0a85('0x4'));var config=require(_0x0a85('0x5'));var attributes=require(_0x0a85('0x6'));module[_0x0a85('0x7')]=function(_0x497565,_0x2742f1){return _0x497565['define'](_0x0a85('0x8'),attributes,{'tableName':_0x0a85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x192d=['exports','Integration','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1a1fe3,_0x22d9bc){var _0xbd7ed6=function(_0x13a1d9){while(--_0x13a1d9){_0x1a1fe3['push'](_0x1a1fe3['shift']());}};_0xbd7ed6(++_0x22d9bc);}(_0x192d,0xca));var _0xd192=function(_0x490ce0,_0x222c5c){_0x490ce0=_0x490ce0-0x0;var _0x28b956=_0x192d[_0x490ce0];return _0x28b956;};'use strict';var _=require(_0xd192('0x0'));var util=require(_0xd192('0x1'));var logger=require('../../config/logger')(_0xd192('0x2'));var moment=require(_0xd192('0x3'));var BPromise=require(_0xd192('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd192('0x5'));var rimraf=require(_0xd192('0x6'));var config=require(_0xd192('0x7'));var attributes=require('./integration.attributes');module[_0xd192('0x8')]=function(_0x4e20c6,_0x19cc38){return _0x4e20c6['define'](_0xd192('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 20945c0..720ca8b 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x4975,0x86));var _0x5497=function(_0x11bb70,_0x2b0eaa){_0x11bb70=_0x11bb70-0x0;var _0x54e0a6=_0x4975[_0x11bb70];return _0x54e0a6;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Integration,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b6e87,_0x13a4cb){var _0x45d7b1=function(_0x51dfc2){while(--_0x51dfc2){_0x5b6e87['push'](_0x5b6e87['shift']());}};_0x45d7b1(++_0x13a4cb);}(_0x7880,0x1f4));var _0x0788=function(_0x358f87,_0x5a4d20){_0x358f87=_0x358f87-0x0;var _0x4b2fdb=_0x7880[_0x358f87];return _0x4b2fdb;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0214f51..796ed5a 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x834735,_0x454c1b){var _0x3c8dc5=function(_0xe6d88d){while(--_0xe6d88d){_0x834735['push'](_0x834735['shift']());}};_0x3c8dc5(++_0x454c1b);}(_0x7880,0x1f4));var _0x0788=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0x7880[_0x4812e0];return _0x252e0f;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x38acb6,_0x547082){var _0x4fd192=function(_0x4eecda){while(--_0x4eecda){_0x38acb6['push'](_0x38acb6['shift']());}};_0x4fd192(++_0x547082);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ccbbb,_0x3bf4c0){_0x4ccbbb=_0x4ccbbb-0x0;var _0x13c0c7=_0x2ef3[_0x4ccbbb];return _0x13c0c7;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6fca9bb..0d447ca 100644 --- a/server/api/integrationReport/integrationReport.attributes.js +++ b/server/api/integrationReport/integrationReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeecb=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x2580f6,_0x474e75){var _0x15a661=function(_0x22d389){while(--_0x22d389){_0x2580f6['push'](_0x2580f6['shift']());}};_0x15a661(++_0x474e75);}(_0xeecb,0x1ba));var _0xbeec=function(_0x386bfb,_0x5bbb80){_0x386bfb=_0x386bfb-0x0;var _0x596ab4=_0xeecb[_0x386bfb];return _0x596ab4;};'use strict';var Sequelize=require(_0xbeec('0x0'));module[_0xbeec('0x1')]={'integration':{'type':Sequelize[_0xbeec('0x2')]},'eventChannel':{'type':Sequelize[_0xbeec('0x2')]},'exitStatus':{'type':Sequelize[_0xbeec('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xbeec('0x3')]},'contacts':{'type':Sequelize[_0xbeec('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbeec('0x2')]},'queue':{'type':Sequelize[_0xbeec('0x2')]},'interface':{'type':Sequelize[_0xbeec('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xbeec('0x4')]},'agentconnectAt':{'type':Sequelize[_0xbeec('0x4')]},'holdtime':{'type':Sequelize[_0xbeec('0x3')]},'agentcomplete':{'type':Sequelize[_0xbeec('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbeec('0x4')]},'talktime':{'type':Sequelize[_0xbeec('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbeec('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xbeec('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbeec('0x4')]},'agentdump':{'type':Sequelize[_0xbeec('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xbeec('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xbeec('0x3')]},'channelstatedesc':{'type':Sequelize[_0xbeec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xbeec('0x2')]},'language':{'type':Sequelize[_0xbeec('0x2')]},'accountcode':{'type':Sequelize[_0xbeec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xbeec('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xbeec('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xbeec('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbeec('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbeec('0x2')]},'destlanguage':{'type':Sequelize[_0xbeec('0x2')]},'destaccountcode':{'type':Sequelize[_0xbeec('0x2')]},'destcontext':{'type':Sequelize[_0xbeec('0x2')]},'destexten':{'type':Sequelize[_0xbeec('0x2')]},'destpriority':{'type':Sequelize[_0xbeec('0x2')]},'destuniqueid':{'type':Sequelize[_0xbeec('0x2')]},'messageId':{'type':Sequelize[_0xbeec('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xbeec('0x2')]},'from':{'type':Sequelize[_0xbeec('0x2')]},'to':{'type':Sequelize[_0xbeec('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xbeec('0x6')]},'html':{'type':Sequelize[_0xbeec('0x6')]},'text':{'type':Sequelize[_0xbeec('0x6')]},'status':{'type':Sequelize[_0xbeec('0x7')](_0xbeec('0x8'),_0xbeec('0x9'),_0xbeec('0xa'),_0xbeec('0xb'))},'url':{'type':Sequelize[_0xbeec('0x2')]},'app':{'type':Sequelize[_0xbeec('0x2')]},'appdata':{'type':Sequelize[_0xbeec('0x2')]},'projectId':{'type':Sequelize[_0xbeec('0x3')]}}; \ No newline at end of file +var _0x2b7f=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT'];(function(_0x257ba0,_0x5b399c){var _0x47082d=function(_0x5a862f){while(--_0x5a862f){_0x257ba0['push'](_0x257ba0['shift']());}};_0x47082d(++_0x5b399c);}(_0x2b7f,0xad));var _0xf2b7=function(_0x562099,_0x4531b1){_0x562099=_0x562099-0x0;var _0x4da51b=_0x2b7f[_0x562099];return _0x4da51b;};'use strict';var Sequelize=require(_0xf2b7('0x0'));module[_0xf2b7('0x1')]={'integration':{'type':Sequelize[_0xf2b7('0x2')]},'eventChannel':{'type':Sequelize[_0xf2b7('0x2')]},'exitStatus':{'type':Sequelize[_0xf2b7('0x2')]},'ticketId':{'type':Sequelize[_0xf2b7('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf2b7('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf2b7('0x2')]},'queue':{'type':Sequelize[_0xf2b7('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf2b7('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf2b7('0x3')]},'agentconnectAt':{'type':Sequelize[_0xf2b7('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf2b7('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf2b7('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf2b7('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf2b7('0x5')]},'reason':{'type':Sequelize[_0xf2b7('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf2b7('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf2b7('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf2b7('0x3')]},'lastevent':{'type':Sequelize[_0xf2b7('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf2b7('0x5')]},'channelstatedesc':{'type':Sequelize[_0xf2b7('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf2b7('0x2')]},'language':{'type':Sequelize[_0xf2b7('0x2')]},'accountcode':{'type':Sequelize[_0xf2b7('0x2')]},'context':{'type':Sequelize[_0xf2b7('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf2b7('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf2b7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf2b7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf2b7('0x2')]},'destlanguage':{'type':Sequelize[_0xf2b7('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf2b7('0x2')]},'destexten':{'type':Sequelize[_0xf2b7('0x2')]},'destpriority':{'type':Sequelize[_0xf2b7('0x2')]},'destuniqueid':{'type':Sequelize[_0xf2b7('0x2')]},'messageId':{'type':Sequelize[_0xf2b7('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xf2b7('0x2')]},'from':{'type':Sequelize[_0xf2b7('0x2')]},'to':{'type':Sequelize[_0xf2b7('0x2')]},'cc':{'type':Sequelize[_0xf2b7('0x2')]},'attachment':{'type':Sequelize[_0xf2b7('0x6')]},'html':{'type':Sequelize[_0xf2b7('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xf2b7('0x7')](_0xf2b7('0x8'),_0xf2b7('0x9'),_0xf2b7('0xa'),_0xf2b7('0xb'))},'url':{'type':Sequelize[_0xf2b7('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf2b7('0x2')]},'projectId':{'type':Sequelize[_0xf2b7('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 71c6f5c..35b080a 100644 --- a/server/api/integrationReport/integrationReport.controller.js +++ b/server/api/integrationReport/integrationReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23a3=['nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','stack','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0xd976ed,_0x27c3d0){var _0x22413f=function(_0x16f45d){while(--_0x16f45d){_0xd976ed['push'](_0xd976ed['shift']());}};_0x22413f(++_0x27c3d0);}(_0x23a3,0xa5));var _0x323a=function(_0x42711a,_0x50df0d){_0x42711a=_0x42711a-0x0;var _0x5d912a=_0x23a3[_0x42711a];return _0x5d912a;};'use strict';var emlformat=require(_0x323a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x323a('0x1'));var jsonpatch=require(_0x323a('0x2'));var rp=require(_0x323a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x323a('0x4'));var util=require(_0x323a('0x5'));var path=require(_0x323a('0x6'));var sox=require(_0x323a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x323a('0x8'));var _=require('lodash');var squel=require(_0x323a('0x9'));var crypto=require(_0x323a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x323a('0xb'));var toCsv=require(_0x323a('0xc'));var querystring=require(_0x323a('0xd'));var Papa=require(_0x323a('0xe'));var Redis=require('ioredis');var authService=require(_0x323a('0xf'));var qs=require(_0x323a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x323a('0x11'));var logger=require(_0x323a('0x12'))(_0x323a('0x13'));var utils=require('../../config/utils');var config=require(_0x323a('0x14'));var licenseUtil=require(_0x323a('0x15'));var db=require(_0x323a('0x16'))['db'];function respondWithStatusCode(_0x4af600,_0x3efd0a){_0x3efd0a=_0x3efd0a||0xcc;return function(_0x215869){if(_0x215869){return _0x4af600[_0x323a('0x17')](_0x3efd0a);}return _0x4af600['status'](_0x3efd0a)['end']();};}function respondWithResult(_0x576884,_0x20da85){_0x20da85=_0x20da85||0xc8;return function(_0x14bdb8){if(_0x14bdb8){return _0x576884[_0x323a('0x18')](_0x20da85)[_0x323a('0x19')](_0x14bdb8);}};}function respondWithFilteredResult(_0x2c18eb,_0x35e15c){return function(_0x292ee4){if(_0x292ee4){var _0x5083a1=typeof _0x35e15c['offset']==='undefined'&&typeof _0x35e15c[_0x323a('0x1a')]==='undefined';var _0x314582=_0x292ee4[_0x323a('0x1b')];var _0x4bedfc=_0x5083a1?0x0:_0x35e15c[_0x323a('0x1c')];var _0x9413de=_0x5083a1?_0x292ee4[_0x323a('0x1b')]:_0x35e15c[_0x323a('0x1c')]+_0x35e15c[_0x323a('0x1a')];var _0x14d2ae;if(_0x9413de>=_0x314582){_0x9413de=_0x314582;_0x14d2ae=0xc8;}else{_0x14d2ae=0xce;}_0x2c18eb[_0x323a('0x18')](_0x14d2ae);return _0x2c18eb[_0x323a('0x1d')](_0x323a('0x1e'),_0x4bedfc+'-'+_0x9413de+'/'+_0x314582)[_0x323a('0x19')](_0x292ee4);}return null;};}function patchUpdates(_0x4f8742){return function(_0x311d19){try{jsonpatch[_0x323a('0x1f')](_0x311d19,_0x4f8742,!![]);}catch(_0x2e6302){return BPromise['reject'](_0x2e6302);}return _0x311d19['save']();};}function saveUpdates(_0x5dbe62,_0x298a56){return function(_0x2752cd){if(_0x2752cd){return _0x2752cd[_0x323a('0x20')](_0x5dbe62)[_0x323a('0x21')](function(_0x48966c){return _0x48966c;});}return null;};}function removeEntity(_0x184db2,_0x52f392){return function(_0x538b02){if(_0x538b02){return _0x538b02[_0x323a('0x22')]()[_0x323a('0x21')](function(){_0x184db2[_0x323a('0x18')](0xcc)[_0x323a('0x23')]();});}};}function handleEntityNotFound(_0x3a2cd5,_0x22cd47){return function(_0x1d1d0b){if(!_0x1d1d0b){_0x3a2cd5[_0x323a('0x17')](0x194);}return _0x1d1d0b;};}function handleError(_0x5a465d,_0x5acf6c){_0x5acf6c=_0x5acf6c||0x1f4;return function(_0x42a123){logger['error'](_0x42a123[_0x323a('0x24')]);if(_0x42a123['name']){delete _0x42a123['name'];}_0x5a465d['status'](_0x5acf6c)[_0x323a('0x25')](_0x42a123);};}exports[_0x323a('0x26')]=function(_0x470b54,_0x3d0698){var _0x1ce34e={},_0xfd8346={},_0x446dd4={'count':0x0,'rows':[]};var _0x42ad62=_['map'](db[_0x323a('0x27')][_0x323a('0x28')],function(_0x5f00f1){return{'name':_0x5f00f1[_0x323a('0x29')],'type':_0x5f00f1[_0x323a('0x2a')][_0x323a('0x2b')]};});_0xfd8346[_0x323a('0x2c')]=_[_0x323a('0x2d')](_0x42ad62,_0x323a('0x2e'));_0xfd8346['query']=_[_0x323a('0x2f')](_0x470b54[_0x323a('0x30')]);_0xfd8346[_0x323a('0x31')]=_[_0x323a('0x32')](_0xfd8346[_0x323a('0x2c')],_0xfd8346['query']);_0x1ce34e['attributes']=_[_0x323a('0x32')](_0xfd8346['model'],qs[_0x323a('0x33')](_0x470b54[_0x323a('0x30')]['fields']));_0x1ce34e[_0x323a('0x34')]=_0x1ce34e[_0x323a('0x34')]['length']?_0x1ce34e[_0x323a('0x34')]:_0xfd8346[_0x323a('0x2c')];if(!_0x470b54[_0x323a('0x30')][_0x323a('0x35')](_0x323a('0x36'))){_0x1ce34e[_0x323a('0x1a')]=qs[_0x323a('0x1a')](_0x470b54[_0x323a('0x30')][_0x323a('0x1a')]);_0x1ce34e['offset']=qs[_0x323a('0x1c')](_0x470b54[_0x323a('0x30')][_0x323a('0x1c')]);}_0x1ce34e[_0x323a('0x37')]=qs[_0x323a('0x38')](_0x470b54[_0x323a('0x30')][_0x323a('0x38')]);_0x1ce34e[_0x323a('0x39')]=qs[_0x323a('0x31')](_['pick'](_0x470b54['query'],_0xfd8346[_0x323a('0x31')]),_0x42ad62);if(_0x470b54[_0x323a('0x30')][_0x323a('0x3a')]){_0x1ce34e['where']=_['merge'](_0x1ce34e[_0x323a('0x39')],{'$or':_[_0x323a('0x2d')](_0x42ad62,function(_0x595bb9){if(_0x595bb9['type']!==_0x323a('0x3b')){var _0x27fbfc={};_0x27fbfc[_0x595bb9[_0x323a('0x2e')]]={'$like':'%'+_0x470b54[_0x323a('0x30')][_0x323a('0x3a')]+'%'};return _0x27fbfc;}})});}_0x1ce34e=_['merge']({},_0x1ce34e,_0x470b54['options']);var _0xba9e5d={'where':_0x1ce34e[_0x323a('0x39')]};return db[_0x323a('0x27')][_0x323a('0x1b')](_0xba9e5d)['then'](function(_0x45dde9){_0x446dd4[_0x323a('0x1b')]=_0x45dde9;if(_0x470b54['query'][_0x323a('0x3c')]){_0x1ce34e[_0x323a('0x3d')]=[{'all':!![]}];}return db[_0x323a('0x27')][_0x323a('0x3e')](_0x1ce34e);})[_0x323a('0x21')](function(_0x338786){_0x446dd4[_0x323a('0x3f')]=_0x338786;return _0x446dd4;})[_0x323a('0x21')](respondWithFilteredResult(_0x3d0698,_0x1ce34e))[_0x323a('0x40')](handleError(_0x3d0698,null));};exports[_0x323a('0x41')]=function(_0x32a471,_0x1ca305){var _0x1aa385={'raw':![],'where':{'id':_0x32a471[_0x323a('0x42')]['id']}},_0x19eaa1={};_0x19eaa1[_0x323a('0x2c')]=_[_0x323a('0x2f')](db[_0x323a('0x27')][_0x323a('0x28')]);_0x19eaa1[_0x323a('0x30')]=_['keys'](_0x32a471[_0x323a('0x30')]);_0x19eaa1[_0x323a('0x31')]=_[_0x323a('0x32')](_0x19eaa1[_0x323a('0x2c')],_0x19eaa1[_0x323a('0x30')]);_0x1aa385[_0x323a('0x34')]=_[_0x323a('0x32')](_0x19eaa1['model'],qs[_0x323a('0x33')](_0x32a471[_0x323a('0x30')][_0x323a('0x33')]));_0x1aa385[_0x323a('0x34')]=_0x1aa385['attributes'][_0x323a('0x43')]?_0x1aa385[_0x323a('0x34')]:_0x19eaa1['model'];if(_0x32a471[_0x323a('0x30')][_0x323a('0x3c')]){_0x1aa385['include']=[{'all':!![]}];}_0x1aa385=_['merge']({},_0x1aa385,_0x32a471[_0x323a('0x44')]);return db['IntegrationReport'][_0x323a('0x45')](_0x1aa385)[_0x323a('0x21')](handleEntityNotFound(_0x1ca305,null))[_0x323a('0x21')](respondWithResult(_0x1ca305,null))['catch'](handleError(_0x1ca305,null));};exports[_0x323a('0x46')]=function(_0x1608bc,_0x48949b){return db[_0x323a('0x27')][_0x323a('0x46')](_0x1608bc[_0x323a('0x47')],{})[_0x323a('0x21')](respondWithResult(_0x48949b,0xc9))[_0x323a('0x40')](handleError(_0x48949b,null));};exports[_0x323a('0x20')]=function(_0x451983,_0x3c4326){if(_0x451983[_0x323a('0x47')]['id']){delete _0x451983[_0x323a('0x47')]['id'];}return db[_0x323a('0x27')][_0x323a('0x45')]({'where':{'id':_0x451983[_0x323a('0x42')]['id']}})[_0x323a('0x21')](handleEntityNotFound(_0x3c4326,null))[_0x323a('0x21')](saveUpdates(_0x451983['body'],null))[_0x323a('0x21')](respondWithResult(_0x3c4326,null))[_0x323a('0x40')](handleError(_0x3c4326,null));};exports[_0x323a('0x22')]=function(_0x558f3b,_0x7bc080){return db[_0x323a('0x27')]['find']({'where':{'id':_0x558f3b[_0x323a('0x42')]['id']}})[_0x323a('0x21')](handleEntityNotFound(_0x7bc080,null))[_0x323a('0x21')](removeEntity(_0x7bc080,null))[_0x323a('0x40')](handleError(_0x7bc080,null));};exports[_0x323a('0x48')]=function(_0x3d8841,_0x33a895){return db['IntegrationReport'][_0x323a('0x48')]()[_0x323a('0x21')](respondWithResult(_0x33a895,null))[_0x323a('0x40')](handleError(_0x33a895,null));}; \ No newline at end of file +var _0x72da=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','stack','name','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x543ba1,_0x5c1ff6){var _0x18f38f=function(_0x2f97eb){while(--_0x2f97eb){_0x543ba1['push'](_0x543ba1['shift']());}};_0x18f38f(++_0x5c1ff6);}(_0x72da,0x80));var _0xa72d=function(_0x33bb07,_0x5b1849){_0x33bb07=_0x33bb07-0x0;var _0x481c81=_0x72da[_0x33bb07];return _0x481c81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa72d('0x0'));var zipdir=require(_0xa72d('0x1'));var jsonpatch=require(_0xa72d('0x2'));var rp=require(_0xa72d('0x3'));var moment=require(_0xa72d('0x4'));var BPromise=require(_0xa72d('0x5'));var Mustache=require('mustache');var util=require(_0xa72d('0x6'));var path=require(_0xa72d('0x7'));var sox=require('sox');var csv=require(_0xa72d('0x8'));var ejs=require(_0xa72d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa72d('0xa'));var squel=require(_0xa72d('0xb'));var crypto=require(_0xa72d('0xc'));var jsforce=require(_0xa72d('0xd'));var deskjs=require(_0xa72d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa72d('0xf'));var Papa=require(_0xa72d('0x10'));var Redis=require(_0xa72d('0x11'));var authService=require(_0xa72d('0x12'));var qs=require(_0xa72d('0x13'));var as=require(_0xa72d('0x14'));var hardwareService=require(_0xa72d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa72d('0x16'));var config=require(_0xa72d('0x17'));var licenseUtil=require(_0xa72d('0x18'));var db=require(_0xa72d('0x19'))['db'];function respondWithStatusCode(_0x4ff07d,_0x49846f){_0x49846f=_0x49846f||0xcc;return function(_0x14f296){if(_0x14f296){return _0x4ff07d[_0xa72d('0x1a')](_0x49846f);}return _0x4ff07d[_0xa72d('0x1b')](_0x49846f)[_0xa72d('0x1c')]();};}function respondWithResult(_0xf8eb2e,_0xc188c8){_0xc188c8=_0xc188c8||0xc8;return function(_0x3abb11){if(_0x3abb11){return _0xf8eb2e[_0xa72d('0x1b')](_0xc188c8)[_0xa72d('0x1d')](_0x3abb11);}};}function respondWithFilteredResult(_0x29a903,_0x43d829){return function(_0x443b8f){if(_0x443b8f){var _0x27acf5=typeof _0x43d829[_0xa72d('0x1e')]==='undefined'&&typeof _0x43d829[_0xa72d('0x1f')]==='undefined';var _0x2f92f3=_0x443b8f['count'];var _0x35aeec=_0x27acf5?0x0:_0x43d829[_0xa72d('0x1e')];var _0x7c1acd=_0x27acf5?_0x443b8f[_0xa72d('0x20')]:_0x43d829[_0xa72d('0x1e')]+_0x43d829[_0xa72d('0x1f')];var _0x36a572;if(_0x7c1acd>=_0x2f92f3){_0x7c1acd=_0x2f92f3;_0x36a572=0xc8;}else{_0x36a572=0xce;}_0x29a903['status'](_0x36a572);return _0x29a903[_0xa72d('0x21')]('Content-Range',_0x35aeec+'-'+_0x7c1acd+'/'+_0x2f92f3)[_0xa72d('0x1d')](_0x443b8f);}return null;};}function patchUpdates(_0x8bf49c){return function(_0x266ba3){try{jsonpatch[_0xa72d('0x22')](_0x266ba3,_0x8bf49c,!![]);}catch(_0x108ce1){return BPromise[_0xa72d('0x23')](_0x108ce1);}return _0x266ba3[_0xa72d('0x24')]();};}function saveUpdates(_0x12b929,_0x4b72ee){return function(_0x40681b){if(_0x40681b){return _0x40681b[_0xa72d('0x25')](_0x12b929)[_0xa72d('0x26')](function(_0x4d96b5){return _0x4d96b5;});}return null;};}function removeEntity(_0x38768e,_0x552752){return function(_0x4671cd){if(_0x4671cd){return _0x4671cd[_0xa72d('0x27')]()[_0xa72d('0x26')](function(){_0x38768e['status'](0xcc)[_0xa72d('0x1c')]();});}};}function handleEntityNotFound(_0x468549,_0x555e50){return function(_0x587050){if(!_0x587050){_0x468549[_0xa72d('0x1a')](0x194);}return _0x587050;};}function handleError(_0x79ab21,_0x5f073a){_0x5f073a=_0x5f073a||0x1f4;return function(_0x26180b){logger['error'](_0x26180b[_0xa72d('0x28')]);if(_0x26180b[_0xa72d('0x29')]){delete _0x26180b[_0xa72d('0x29')];}_0x79ab21[_0xa72d('0x1b')](_0x5f073a)['send'](_0x26180b);};}exports['index']=function(_0x43c36d,_0x37ed71){var _0x519c38={},_0x3f6c53={},_0x49123c={'count':0x0,'rows':[]};var _0x58a48e=_[_0xa72d('0x2a')](db[_0xa72d('0x2b')]['rawAttributes'],function(_0x2fe8ec){return{'name':_0x2fe8ec[_0xa72d('0x2c')],'type':_0x2fe8ec[_0xa72d('0x2d')][_0xa72d('0x2e')]};});_0x3f6c53[_0xa72d('0x2f')]=_['map'](_0x58a48e,_0xa72d('0x29'));_0x3f6c53[_0xa72d('0x30')]=_[_0xa72d('0x31')](_0x43c36d[_0xa72d('0x30')]);_0x3f6c53[_0xa72d('0x32')]=_['intersection'](_0x3f6c53[_0xa72d('0x2f')],_0x3f6c53[_0xa72d('0x30')]);_0x519c38[_0xa72d('0x33')]=_[_0xa72d('0x34')](_0x3f6c53[_0xa72d('0x2f')],qs[_0xa72d('0x35')](_0x43c36d[_0xa72d('0x30')][_0xa72d('0x35')]));_0x519c38[_0xa72d('0x33')]=_0x519c38[_0xa72d('0x33')][_0xa72d('0x36')]?_0x519c38[_0xa72d('0x33')]:_0x3f6c53[_0xa72d('0x2f')];if(!_0x43c36d[_0xa72d('0x30')][_0xa72d('0x37')](_0xa72d('0x38'))){_0x519c38['limit']=qs[_0xa72d('0x1f')](_0x43c36d['query'][_0xa72d('0x1f')]);_0x519c38[_0xa72d('0x1e')]=qs[_0xa72d('0x1e')](_0x43c36d[_0xa72d('0x30')]['offset']);}_0x519c38[_0xa72d('0x39')]=qs[_0xa72d('0x3a')](_0x43c36d['query'][_0xa72d('0x3a')]);_0x519c38['where']=qs[_0xa72d('0x32')](_[_0xa72d('0x3b')](_0x43c36d['query'],_0x3f6c53[_0xa72d('0x32')]),_0x58a48e);if(_0x43c36d['query']['filter']){_0x519c38['where']=_[_0xa72d('0x3c')](_0x519c38[_0xa72d('0x3d')],{'$or':_[_0xa72d('0x2a')](_0x58a48e,function(_0x5941f4){if(_0x5941f4[_0xa72d('0x2d')]!==_0xa72d('0x3e')){var _0x3168fa={};_0x3168fa[_0x5941f4[_0xa72d('0x29')]]={'$like':'%'+_0x43c36d['query'][_0xa72d('0x3f')]+'%'};return _0x3168fa;}})});}_0x519c38=_[_0xa72d('0x3c')]({},_0x519c38,_0x43c36d[_0xa72d('0x40')]);var _0x51b2f2={'where':_0x519c38[_0xa72d('0x3d')]};return db[_0xa72d('0x2b')][_0xa72d('0x20')](_0x51b2f2)[_0xa72d('0x26')](function(_0x76a42d){_0x49123c[_0xa72d('0x20')]=_0x76a42d;if(_0x43c36d[_0xa72d('0x30')][_0xa72d('0x41')]){_0x519c38['include']=[{'all':!![]}];}return db[_0xa72d('0x2b')]['findAll'](_0x519c38);})[_0xa72d('0x26')](function(_0x577402){_0x49123c[_0xa72d('0x42')]=_0x577402;return _0x49123c;})[_0xa72d('0x26')](respondWithFilteredResult(_0x37ed71,_0x519c38))[_0xa72d('0x43')](handleError(_0x37ed71,null));};exports[_0xa72d('0x44')]=function(_0x16385d,_0x4358a7){var _0x42b3f4={'raw':![],'where':{'id':_0x16385d[_0xa72d('0x45')]['id']}},_0x22c433={};_0x22c433['model']=_[_0xa72d('0x31')](db['IntegrationReport']['rawAttributes']);_0x22c433[_0xa72d('0x30')]=_[_0xa72d('0x31')](_0x16385d[_0xa72d('0x30')]);_0x22c433[_0xa72d('0x32')]=_[_0xa72d('0x34')](_0x22c433[_0xa72d('0x2f')],_0x22c433[_0xa72d('0x30')]);_0x42b3f4['attributes']=_[_0xa72d('0x34')](_0x22c433[_0xa72d('0x2f')],qs[_0xa72d('0x35')](_0x16385d['query'][_0xa72d('0x35')]));_0x42b3f4['attributes']=_0x42b3f4[_0xa72d('0x33')]['length']?_0x42b3f4['attributes']:_0x22c433['model'];if(_0x16385d[_0xa72d('0x30')][_0xa72d('0x41')]){_0x42b3f4[_0xa72d('0x46')]=[{'all':!![]}];}_0x42b3f4=_['merge']({},_0x42b3f4,_0x16385d['options']);return db[_0xa72d('0x2b')]['find'](_0x42b3f4)['then'](handleEntityNotFound(_0x4358a7,null))['then'](respondWithResult(_0x4358a7,null))['catch'](handleError(_0x4358a7,null));};exports[_0xa72d('0x47')]=function(_0x3b725d,_0xb5e16a){return db[_0xa72d('0x2b')][_0xa72d('0x47')](_0x3b725d[_0xa72d('0x48')],{})['then'](respondWithResult(_0xb5e16a,0xc9))[_0xa72d('0x43')](handleError(_0xb5e16a,null));};exports[_0xa72d('0x25')]=function(_0x4cb739,_0x369149){if(_0x4cb739[_0xa72d('0x48')]['id']){delete _0x4cb739[_0xa72d('0x48')]['id'];}return db['IntegrationReport'][_0xa72d('0x49')]({'where':{'id':_0x4cb739['params']['id']}})[_0xa72d('0x26')](handleEntityNotFound(_0x369149,null))[_0xa72d('0x26')](saveUpdates(_0x4cb739[_0xa72d('0x48')],null))['then'](respondWithResult(_0x369149,null))[_0xa72d('0x43')](handleError(_0x369149,null));};exports['destroy']=function(_0x5d6fc4,_0x32c7cb){return db['IntegrationReport'][_0xa72d('0x49')]({'where':{'id':_0x5d6fc4[_0xa72d('0x45')]['id']}})[_0xa72d('0x26')](handleEntityNotFound(_0x32c7cb,null))[_0xa72d('0x26')](removeEntity(_0x32c7cb,null))['catch'](handleError(_0x32c7cb,null));};exports['describe']=function(_0xe09b20,_0x1c8e56){return db[_0xa72d('0x2b')][_0xa72d('0x4a')]()[_0xa72d('0x26')](respondWithResult(_0x1c8e56,null))[_0xa72d('0x43')](handleError(_0x1c8e56,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5ee1d3f..45fd538 100644 --- a/server/api/integrationReport/integrationReport.model.js +++ b/server/api/integrationReport/integrationReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea8b=['../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xc2db38,_0x5c4e54){var _0xd433b8=function(_0x4cac04){while(--_0x4cac04){_0xc2db38['push'](_0xc2db38['shift']());}};_0xd433b8(++_0x5c4e54);}(_0xea8b,0x12b));var _0xbea8=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xea8b[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xbea8('0x0'));var util=require(_0xbea8('0x1'));var logger=require(_0xbea8('0x2'))(_0xbea8('0x3'));var moment=require(_0xbea8('0x4'));var BPromise=require(_0xbea8('0x5'));var rp=require(_0xbea8('0x6'));var fs=require('fs');var path=require(_0xbea8('0x7'));var rimraf=require(_0xbea8('0x8'));var config=require(_0xbea8('0x9'));var attributes=require(_0xbea8('0xa'));module[_0xbea8('0xb')]=function(_0x20517,_0x5c1f54){return _0x20517[_0xbea8('0xc')](_0xbea8('0xd'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5a4=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','IntegrationReport'];(function(_0x285260,_0x15f9ad){var _0xa73eb5=function(_0x1ac5d6){while(--_0x1ac5d6){_0x285260['push'](_0x285260['shift']());}};_0xa73eb5(++_0x15f9ad);}(_0xe5a4,0x1dd));var _0x4e5a=function(_0x897b6f,_0x366557){_0x897b6f=_0x897b6f-0x0;var _0x2ecba3=_0xe5a4[_0x897b6f];return _0x2ecba3;};'use strict';var _=require('lodash');var util=require(_0x4e5a('0x0'));var logger=require(_0x4e5a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4e5a('0x2'));var rp=require(_0x4e5a('0x3'));var fs=require('fs');var path=require(_0x4e5a('0x4'));var rimraf=require('rimraf');var config=require(_0x4e5a('0x5'));var attributes=require(_0x4e5a('0x6'));module[_0x4e5a('0x7')]=function(_0x2c27d7,_0x5f3f8f){return _0x2c27d7['define'](_0x4e5a('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index d2104b7..9612868 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x468d12,_0x10ef66){_0x468d12=_0x468d12-0x0;var _0x176a61=_0x3f8a[_0x468d12];return _0x176a61;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0x687b,0x14a));var _0xb687=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0x687b[_0x473b41];return _0x4e521d;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index e47f8ce..1b19fb3 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f26=['/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','show','isAuthenticated','getIntervals','post','create','/:id/sub_intervals','addInterval'];(function(_0x45dee5,_0x190252){var _0x156f90=function(_0x3d2ff5){while(--_0x3d2ff5){_0x45dee5['push'](_0x45dee5['shift']());}};_0x156f90(++_0x190252);}(_0x1f26,0xb5));var _0x61f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f26[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x61f2('0x0'));var util=require(_0x61f2('0x1'));var path=require(_0x61f2('0x2'));var timeout=require('connect-timeout');var express=require(_0x61f2('0x3'));var router=express[_0x61f2('0x4')]();var fs_extra=require(_0x61f2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x61f2('0x6'));var config=require(_0x61f2('0x7'));var controller=require(_0x61f2('0x8'));router[_0x61f2('0x9')]('/',auth['isAuthenticated'](),controller[_0x61f2('0xa')]);router[_0x61f2('0x9')](_0x61f2('0xb'),auth['isAuthenticated'](),controller[_0x61f2('0xc')]);router[_0x61f2('0x9')]('/:id/sub_intervals',auth[_0x61f2('0xd')](),controller[_0x61f2('0xe')]);router[_0x61f2('0xf')]('/',auth['isAuthenticated'](),controller[_0x61f2('0x10')]);router['post'](_0x61f2('0x11'),auth['isAuthenticated'](),controller[_0x61f2('0x12')]);router[_0x61f2('0xf')](_0x61f2('0x13'),auth[_0x61f2('0xd')](),controller[_0x61f2('0x14')]);router['put'](_0x61f2('0xb'),auth[_0x61f2('0xd')](),controller[_0x61f2('0x15')]);router[_0x61f2('0x16')](_0x61f2('0xb'),auth[_0x61f2('0xd')](),controller[_0x61f2('0x17')]);module[_0x61f2('0x18')]=router; \ No newline at end of file +var _0x2f38=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer'];(function(_0x42b9ab,_0x4cc4c0){var _0x144df2=function(_0x101c1d){while(--_0x101c1d){_0x42b9ab['push'](_0x42b9ab['shift']());}};_0x144df2(++_0x4cc4c0);}(_0x2f38,0x95));var _0x82f3=function(_0x2a1281,_0x560258){_0x2a1281=_0x2a1281-0x0;var _0x352b14=_0x2f38[_0x2a1281];return _0x352b14;};'use strict';var multer=require(_0x82f3('0x0'));var util=require('util');var path=require(_0x82f3('0x1'));var timeout=require(_0x82f3('0x2'));var express=require(_0x82f3('0x3'));var router=express[_0x82f3('0x4')]();var fs_extra=require(_0x82f3('0x5'));var auth=require(_0x82f3('0x6'));var interaction=require(_0x82f3('0x7'));var config=require(_0x82f3('0x8'));var controller=require(_0x82f3('0x9'));router['get']('/',auth[_0x82f3('0xa')](),controller[_0x82f3('0xb')]);router[_0x82f3('0xc')](_0x82f3('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x82f3('0xe'),auth[_0x82f3('0xa')](),controller[_0x82f3('0xf')]);router['post']('/',auth[_0x82f3('0xa')](),controller[_0x82f3('0x10')]);router[_0x82f3('0x11')](_0x82f3('0xe'),auth[_0x82f3('0xa')](),controller[_0x82f3('0x12')]);router[_0x82f3('0x11')](_0x82f3('0x13'),auth[_0x82f3('0xa')](),controller['addIntervals']);router[_0x82f3('0x14')]('/:id',auth[_0x82f3('0xa')](),controller[_0x82f3('0x15')]);router[_0x82f3('0x16')](_0x82f3('0xd'),auth['isAuthenticated'](),controller[_0x82f3('0x17')]);module[_0x82f3('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 06706fb..7bac891 100644 --- a/server/api/interval/interval.attributes.js +++ b/server/api/interval/interval.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3267=['exports','STRING','sequelize'];(function(_0x4bdc85,_0x1c2446){var _0x2379cf=function(_0x2153e8){while(--_0x2153e8){_0x4bdc85['push'](_0x4bdc85['shift']());}};_0x2379cf(++_0x1c2446);}(_0x3267,0xe0));var _0x7326=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x3267[_0x46401e];return _0x447cba;};'use strict';var Sequelize=require(_0x7326('0x0'));module[_0x7326('0x1')]={'name':{'type':Sequelize[_0x7326('0x2')]},'description':{'type':Sequelize[_0x7326('0x2')]},'interval':{'type':Sequelize[_0x7326('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x37e1=['exports','STRING','sequelize'];(function(_0x1eaf6b,_0x27c321){var _0x23a8c4=function(_0x12d972){while(--_0x12d972){_0x1eaf6b['push'](_0x1eaf6b['shift']());}};_0x23a8c4(++_0x27c321);}(_0x37e1,0x167));var _0x137e=function(_0x4819e3,_0x5dcdb1){_0x4819e3=_0x4819e3-0x0;var _0x3255c8=_0x37e1[_0x4819e3];return _0x3255c8;};'use strict';var Sequelize=require(_0x137e('0x0'));module[_0x137e('0x1')]={'name':{'type':Sequelize[_0x137e('0x2')]},'description':{'type':Sequelize[_0x137e('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 6744064..b55a6cf 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95c4=['get','Intervals','UserProfileResource','stack','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','name','options','Interval','includeAll','include','rows','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','length','pick','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','json','apply','reject','save','then','destroy'];(function(_0x54acb7,_0x288d0e){var _0xd6353a=function(_0x17c64b){while(--_0x17c64b){_0x54acb7['push'](_0x54acb7['shift']());}};_0xd6353a(++_0x288d0e);}(_0x95c4,0xe1));var _0x495c=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x95c4[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0x495c('0x0'));var rimraf=require(_0x495c('0x1'));var zipdir=require(_0x495c('0x2'));var jsonpatch=require(_0x495c('0x3'));var rp=require(_0x495c('0x4'));var moment=require(_0x495c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x495c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x495c('0x7'));var csv=require(_0x495c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x495c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x495c('0xa'));var jsforce=require(_0x495c('0xb'));var deskjs=require(_0x495c('0xc'));var toCsv=require(_0x495c('0x8'));var querystring=require(_0x495c('0xd'));var Papa=require(_0x495c('0xe'));var Redis=require(_0x495c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x495c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x495c('0x11'))(_0x495c('0x12'));var utils=require(_0x495c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x495c('0x14'));var db=require(_0x495c('0x15'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x146ea7,_0x4bb19f){_0x4bb19f=_0x4bb19f||0xcc;return function(_0x30e5b0){if(_0x30e5b0){return _0x146ea7[_0x495c('0x16')](_0x4bb19f);}return _0x146ea7['status'](_0x4bb19f)[_0x495c('0x17')]();};}function respondWithResult(_0x230b5f,_0x2a3254){_0x2a3254=_0x2a3254||0xc8;return function(_0x357246){if(_0x357246){return _0x230b5f['status'](_0x2a3254)['json'](_0x357246);}};}function respondWithFilteredResult(_0xefaa1,_0x586bd3){return function(_0x6459ff){if(_0x6459ff){var _0x348a97=typeof _0x586bd3['offset']===_0x495c('0x18')&&typeof _0x586bd3[_0x495c('0x19')]===_0x495c('0x18');var _0x3bb2a5=_0x6459ff[_0x495c('0x1a')];var _0x3c5d24=_0x348a97?0x0:_0x586bd3[_0x495c('0x1b')];var _0x46190d=_0x348a97?_0x6459ff[_0x495c('0x1a')]:_0x586bd3[_0x495c('0x1b')]+_0x586bd3[_0x495c('0x19')];var _0x183c5e;if(_0x46190d>=_0x3bb2a5){_0x46190d=_0x3bb2a5;_0x183c5e=0xc8;}else{_0x183c5e=0xce;}_0xefaa1[_0x495c('0x1c')](_0x183c5e);return _0xefaa1[_0x495c('0x1d')]('Content-Range',_0x3c5d24+'-'+_0x46190d+'/'+_0x3bb2a5)[_0x495c('0x1e')](_0x6459ff);}return null;};}function patchUpdates(_0x19afba){return function(_0x58770e){try{jsonpatch[_0x495c('0x1f')](_0x58770e,_0x19afba,!![]);}catch(_0x10c82a){return BPromise[_0x495c('0x20')](_0x10c82a);}return _0x58770e[_0x495c('0x21')]();};}function saveUpdates(_0x1cdc01,_0x5e9f68){return function(_0xb858d7){if(_0xb858d7){return _0xb858d7['update'](_0x1cdc01)[_0x495c('0x22')](function(_0xd31b60){return _0xd31b60;});}return null;};}function removeEntity(_0x47feb2,_0x581d92){return function(_0x2cbc73){if(_0x2cbc73){return _0x2cbc73[_0x495c('0x23')]()[_0x495c('0x22')](function(){var _0xa6fcba=_0x2cbc73[_0x495c('0x24')]({'plain':!![]});var _0x4489be=_0x495c('0x25');return db[_0x495c('0x26')][_0x495c('0x23')]({'where':{'type':_0x4489be,'resourceId':_0xa6fcba['id']}})[_0x495c('0x22')](function(){return _0x2cbc73;});})[_0x495c('0x22')](function(){_0x47feb2[_0x495c('0x1c')](0xcc)[_0x495c('0x17')]();});}};}function handleEntityNotFound(_0x19b3ad,_0x1c623b){return function(_0x31ef67){if(!_0x31ef67){_0x19b3ad[_0x495c('0x16')](0x194);}return _0x31ef67;};}function handleError(_0x1c50f5,_0x303b76){_0x303b76=_0x303b76||0x1f4;return function(_0x50136f){logger['error'](_0x50136f[_0x495c('0x27')]);if(_0x50136f['name']){delete _0x50136f['name'];}_0x1c50f5[_0x495c('0x1c')](_0x303b76)[_0x495c('0x28')](_0x50136f);};}exports['index']=function(_0x4fe8d1,_0x1886e8){var _0x5d3d1b={},_0x3c3ace={},_0x999ded={'count':0x0,'rows':[]};var _0x1ae11f=_[_0x495c('0x29')](db['Interval'][_0x495c('0x2a')],function(_0x1f3054){return{'name':_0x1f3054['fieldName'],'type':_0x1f3054[_0x495c('0x2b')][_0x495c('0x2c')]};});_0x3c3ace[_0x495c('0x2d')]=_[_0x495c('0x29')](_0x1ae11f,'name');_0x3c3ace[_0x495c('0x2e')]=_[_0x495c('0x2f')](_0x4fe8d1['query']);_0x3c3ace[_0x495c('0x30')]=_['intersection'](_0x3c3ace[_0x495c('0x2d')],_0x3c3ace[_0x495c('0x2e')]);_0x5d3d1b[_0x495c('0x31')]=_[_0x495c('0x32')](_0x3c3ace[_0x495c('0x2d')],qs[_0x495c('0x33')](_0x4fe8d1[_0x495c('0x2e')][_0x495c('0x33')]));_0x5d3d1b[_0x495c('0x31')]=_0x5d3d1b[_0x495c('0x31')]['length']?_0x5d3d1b[_0x495c('0x31')]:_0x3c3ace['model'];if(!_0x4fe8d1[_0x495c('0x2e')][_0x495c('0x34')](_0x495c('0x35'))){_0x5d3d1b['limit']=qs[_0x495c('0x19')](_0x4fe8d1[_0x495c('0x2e')][_0x495c('0x19')]);_0x5d3d1b[_0x495c('0x1b')]=qs['offset'](_0x4fe8d1['query'][_0x495c('0x1b')]);}_0x5d3d1b[_0x495c('0x36')]=qs[_0x495c('0x37')](_0x4fe8d1[_0x495c('0x2e')][_0x495c('0x37')]);_0x5d3d1b['where']=qs[_0x495c('0x30')](_['pick'](_0x4fe8d1[_0x495c('0x2e')],_0x3c3ace['filters']),_0x1ae11f);if(_0x4fe8d1[_0x495c('0x2e')][_0x495c('0x38')]){_0x5d3d1b[_0x495c('0x39')]=_[_0x495c('0x3a')](_0x5d3d1b[_0x495c('0x39')],{'$or':_[_0x495c('0x29')](_0x1ae11f,function(_0x465fec){if(_0x465fec[_0x495c('0x2b')]!==_0x495c('0x3b')){var _0x5e4d23={};_0x5e4d23[_0x465fec[_0x495c('0x3c')]]={'$like':'%'+_0x4fe8d1[_0x495c('0x2e')][_0x495c('0x38')]+'%'};return _0x5e4d23;}})});}_0x5d3d1b=_[_0x495c('0x3a')]({},_0x5d3d1b,_0x4fe8d1[_0x495c('0x3d')]);var _0x361608={'where':_0x5d3d1b['where']};return db[_0x495c('0x3e')]['count'](_0x361608)[_0x495c('0x22')](function(_0xfb3695){_0x999ded[_0x495c('0x1a')]=_0xfb3695;if(_0x4fe8d1[_0x495c('0x2e')][_0x495c('0x3f')]){_0x5d3d1b[_0x495c('0x40')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x5d3d1b);})[_0x495c('0x22')](function(_0x5ca00c){_0x999ded[_0x495c('0x41')]=_0x5ca00c;return _0x999ded;})['then'](respondWithFilteredResult(_0x1886e8,_0x5d3d1b))['catch'](handleError(_0x1886e8,null));};exports['show']=function(_0x435ec1,_0x586805){var _0x20e979={'raw':!![],'where':{'id':_0x435ec1['params']['id']}},_0x164060={};_0x164060[_0x495c('0x2d')]=_['keys'](db[_0x495c('0x3e')][_0x495c('0x2a')]);_0x164060[_0x495c('0x2e')]=_[_0x495c('0x2f')](_0x435ec1[_0x495c('0x2e')]);_0x164060[_0x495c('0x30')]=_[_0x495c('0x32')](_0x164060['model'],_0x164060[_0x495c('0x2e')]);_0x20e979[_0x495c('0x31')]=_['intersection'](_0x164060['model'],qs['fields'](_0x435ec1[_0x495c('0x2e')][_0x495c('0x33')]));_0x20e979[_0x495c('0x31')]=_0x20e979[_0x495c('0x31')]['length']?_0x20e979['attributes']:_0x164060['model'];if(_0x435ec1[_0x495c('0x2e')][_0x495c('0x3f')]){_0x20e979[_0x495c('0x40')]=[{'all':!![]}];}_0x20e979=_[_0x495c('0x3a')]({},_0x20e979,_0x435ec1['options']);return db['Interval'][_0x495c('0x42')](_0x20e979)[_0x495c('0x22')](handleEntityNotFound(_0x586805,null))[_0x495c('0x22')](respondWithResult(_0x586805,null))[_0x495c('0x43')](handleError(_0x586805,null));};exports[_0x495c('0x44')]=function(_0x1825c5,_0x5a272e){return db[_0x495c('0x3e')][_0x495c('0x44')](_0x1825c5[_0x495c('0x45')],{})['then'](function(_0x4ef6f1){var _0x490c68=_0x1825c5[_0x495c('0x46')]['get']({'plain':!![]});if(!_0x490c68)throw new Error(_0x495c('0x47'));if(_0x490c68['role']===_0x495c('0x46')){var _0x1f1a1e=_0x4ef6f1[_0x495c('0x24')]({'plain':!![]});var _0xc6c6de='Intervals';return db['UserProfileSection'][_0x495c('0x42')]({'where':{'name':_0xc6c6de,'userProfileId':_0x490c68['userProfileId']},'raw':!![]})[_0x495c('0x22')](function(_0x4c9f85){if(_0x4c9f85&&_0x4c9f85[_0x495c('0x48')]===0x0){return db[_0x495c('0x26')][_0x495c('0x44')]({'name':_0x1f1a1e[_0x495c('0x3c')],'resourceId':_0x1f1a1e['id'],'type':_0x4c9f85['name'],'sectionId':_0x4c9f85['id']},{})[_0x495c('0x22')](function(){return _0x4ef6f1;});}else{return _0x4ef6f1;}})[_0x495c('0x43')](function(_0x256973){logger['error'](_0x495c('0x49'),_0x256973);throw _0x256973;});}return _0x4ef6f1;})['then'](respondWithResult(_0x5a272e,0xc9))[_0x495c('0x43')](handleError(_0x5a272e,null));};exports[_0x495c('0x4a')]=function(_0x295afb,_0x15b5bb){if(_0x295afb[_0x495c('0x45')]['id']){delete _0x295afb[_0x495c('0x45')]['id'];}return db['Interval'][_0x495c('0x42')]({'where':{'id':_0x295afb['params']['id']}})[_0x495c('0x22')](handleEntityNotFound(_0x15b5bb,null))[_0x495c('0x22')](saveUpdates(_0x295afb[_0x495c('0x45')],null))[_0x495c('0x22')](respondWithResult(_0x15b5bb,null))[_0x495c('0x43')](handleError(_0x15b5bb,null));};exports['destroy']=function(_0x4a19d5,_0x478de7){return db['Interval'][_0x495c('0x42')]({'where':{'id':_0x4a19d5[_0x495c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x478de7,null))[_0x495c('0x22')](removeEntity(_0x478de7,null))[_0x495c('0x43')](handleError(_0x478de7,null));};exports[_0x495c('0x4c')]=function(_0x1b786c,_0x5625af,_0x5928e0){if(_0x1b786c['body']['id']){delete _0x1b786c[_0x495c('0x45')]['id'];}return db[_0x495c('0x3e')][_0x495c('0x42')]({'where':{'id':_0x1b786c[_0x495c('0x4b')]['id']}})[_0x495c('0x22')](handleEntityNotFound(_0x5625af,null))[_0x495c('0x22')](function(_0x1bd610){if(_0x1bd610){_0x1b786c['body'][_0x495c('0x4d')]=_0x1bd610['id'];return db[_0x495c('0x3e')][_0x495c('0x44')](_0x1b786c['body']);}})['then'](respondWithResult(_0x5625af,null))[_0x495c('0x43')](handleError(_0x5625af,null));};exports[_0x495c('0x4e')]=function(_0x900b62,_0xa4044a,_0x18ab99){var _0x182bc7={};var _0x5599b4={};var _0x58ba6e;var _0x4f7866;return db[_0x495c('0x3e')][_0x495c('0x4f')]({'where':{'id':_0x900b62[_0x495c('0x4b')]['id']}})[_0x495c('0x22')](handleEntityNotFound(_0xa4044a,null))[_0x495c('0x22')](function(_0x36f8c2){if(_0x36f8c2){_0x58ba6e=_0x36f8c2;_0x5599b4[_0x495c('0x2d')]=_[_0x495c('0x2f')](db[_0x495c('0x3e')][_0x495c('0x2a')]);_0x5599b4[_0x495c('0x2e')]=_[_0x495c('0x2f')](_0x900b62['query']);_0x5599b4[_0x495c('0x30')]=_[_0x495c('0x32')](_0x5599b4[_0x495c('0x2d')],_0x5599b4[_0x495c('0x2e')]);_0x182bc7[_0x495c('0x31')]=_['intersection'](_0x5599b4[_0x495c('0x2d')],qs[_0x495c('0x33')](_0x900b62[_0x495c('0x2e')][_0x495c('0x33')]));_0x182bc7['attributes']=_0x182bc7['attributes'][_0x495c('0x50')]?_0x182bc7[_0x495c('0x31')]:_0x5599b4[_0x495c('0x2d')];_0x182bc7[_0x495c('0x36')]=qs[_0x495c('0x37')](_0x900b62[_0x495c('0x2e')][_0x495c('0x37')]);_0x182bc7[_0x495c('0x39')]=qs['filters'](_[_0x495c('0x51')](_0x900b62[_0x495c('0x2e')],_0x5599b4[_0x495c('0x30')]));if(_0x900b62[_0x495c('0x2e')]['filter']){_0x182bc7['where']=_[_0x495c('0x3a')](_0x182bc7[_0x495c('0x39')],{'$or':_[_0x495c('0x29')](_0x182bc7['attributes'],function(_0x1e2eee){var _0x59ee13={};_0x59ee13[_0x1e2eee]={'$like':'%'+_0x900b62[_0x495c('0x2e')][_0x495c('0x38')]+'%'};return _0x59ee13;})});}_0x182bc7=_[_0x495c('0x3a')]({},_0x182bc7,_0x900b62[_0x495c('0x3d')]);return _0x58ba6e[_0x495c('0x4e')](_0x182bc7);}})[_0x495c('0x22')](function(_0x498c75){if(_0x498c75){_0x4f7866=_0x498c75[_0x495c('0x50')];if(!_0x900b62[_0x495c('0x2e')][_0x495c('0x34')](_0x495c('0x35'))){_0x182bc7['limit']=qs['limit'](_0x900b62[_0x495c('0x2e')]['limit']);_0x182bc7[_0x495c('0x1b')]=qs[_0x495c('0x1b')](_0x900b62[_0x495c('0x2e')][_0x495c('0x1b')]);}return _0x58ba6e[_0x495c('0x4e')](_0x182bc7);}})['then'](function(_0xeb801){if(_0xeb801){return _0xeb801?{'count':_0x4f7866,'rows':_0xeb801}:null;}})[_0x495c('0x22')](respondWithResult(_0xa4044a,null))['catch'](handleError(_0xa4044a,null));};exports[_0x495c('0x52')]=function(_0x2c5ecb,_0x2f9fca,_0x1c8941){return db[_0x495c('0x3e')][_0x495c('0x4f')]({'where':{'id':_0x2c5ecb[_0x495c('0x4b')]['id']}})[_0x495c('0x22')](handleEntityNotFound(_0x2f9fca,null))['then'](function(_0x41534f){if(_0x41534f){return db[_0x495c('0x53')][_0x495c('0x54')](function(_0x3c07f2){return db[_0x495c('0x3e')]['destroy']({'where':{'IntervalId':_0x2c5ecb[_0x495c('0x4b')]['id']},'transaction':_0x3c07f2})['then'](function(_0x304ef4){var _0x2456c3=_['map'](_0x2c5ecb[_0x495c('0x45')],function(_0x4c9e9f){delete _0x4c9e9f['id'];_0x4c9e9f[_0x495c('0x4d')]=_0x2c5ecb[_0x495c('0x4b')]['id'];return _0x4c9e9f;});return db[_0x495c('0x3e')][_0x495c('0x55')](_0x2456c3,{'transaction':_0x3c07f2});});})['then'](function(){return db[_0x495c('0x3e')][_0x495c('0x56')]({'where':{'IntervalId':_0x2c5ecb[_0x495c('0x4b')]['id']}});});}})['then'](respondWithResult(_0x2f9fca,null))[_0x495c('0x43')](handleError(_0x2f9fca,null));}; \ No newline at end of file +var _0x464b=['count','set','apply','reject','save','update','then','get','Intervals','UserProfileResource','error','name','map','Interval','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','length','addIntervals','sequelize','transaction','destroy','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined'];(function(_0x227e24,_0x573dd6){var _0x2ccc99=function(_0x177963){while(--_0x177963){_0x227e24['push'](_0x227e24['shift']());}};_0x2ccc99(++_0x573dd6);}(_0x464b,0x18f));var _0xb464=function(_0x38073a,_0xd7d67e){_0x38073a=_0x38073a-0x0;var _0x18e766=_0x464b[_0x38073a];return _0x18e766;};'use strict';var emlformat=require(_0xb464('0x0'));var rimraf=require(_0xb464('0x1'));var zipdir=require(_0xb464('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb464('0x3'));var moment=require(_0xb464('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb464('0x5'));var util=require(_0xb464('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb464('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb464('0x8'));var jsforce=require(_0xb464('0x9'));var deskjs=require(_0xb464('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb464('0xb'));var Papa=require(_0xb464('0xc'));var Redis=require(_0xb464('0xd'));var authService=require(_0xb464('0xe'));var qs=require(_0xb464('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb464('0x10'));var utils=require(_0xb464('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xb464('0x12'));var db=require('../../mysqldb')['db'];var extensions=require(_0xb464('0x13'));function respondWithStatusCode(_0x12d85a,_0x36d76e){_0x36d76e=_0x36d76e||0xcc;return function(_0x21f344){if(_0x21f344){return _0x12d85a[_0xb464('0x14')](_0x36d76e);}return _0x12d85a[_0xb464('0x15')](_0x36d76e)[_0xb464('0x16')]();};}function respondWithResult(_0x211084,_0x2257f8){_0x2257f8=_0x2257f8||0xc8;return function(_0x24795f){if(_0x24795f){return _0x211084[_0xb464('0x15')](_0x2257f8)[_0xb464('0x17')](_0x24795f);}};}function respondWithFilteredResult(_0x5f1f78,_0x2a557d){return function(_0x1633a9){if(_0x1633a9){var _0x450a8b=typeof _0x2a557d[_0xb464('0x18')]===_0xb464('0x19')&&typeof _0x2a557d['limit']===_0xb464('0x19');var _0xf33172=_0x1633a9[_0xb464('0x1a')];var _0x1d03cc=_0x450a8b?0x0:_0x2a557d[_0xb464('0x18')];var _0x1d9aaf=_0x450a8b?_0x1633a9[_0xb464('0x1a')]:_0x2a557d[_0xb464('0x18')]+_0x2a557d['limit'];var _0x1c60ad;if(_0x1d9aaf>=_0xf33172){_0x1d9aaf=_0xf33172;_0x1c60ad=0xc8;}else{_0x1c60ad=0xce;}_0x5f1f78[_0xb464('0x15')](_0x1c60ad);return _0x5f1f78[_0xb464('0x1b')]('Content-Range',_0x1d03cc+'-'+_0x1d9aaf+'/'+_0xf33172)[_0xb464('0x17')](_0x1633a9);}return null;};}function patchUpdates(_0x1ad36b){return function(_0x116135){try{jsonpatch[_0xb464('0x1c')](_0x116135,_0x1ad36b,!![]);}catch(_0x2977c3){return BPromise[_0xb464('0x1d')](_0x2977c3);}return _0x116135[_0xb464('0x1e')]();};}function saveUpdates(_0x58059a,_0x27f402){return function(_0x45f533){if(_0x45f533){return _0x45f533[_0xb464('0x1f')](_0x58059a)[_0xb464('0x20')](function(_0x2f2c0a){return _0x2f2c0a;});}return null;};}function removeEntity(_0x45a3d5,_0x16ddef){return function(_0x37475b){if(_0x37475b){return _0x37475b['destroy']()[_0xb464('0x20')](function(){var _0x17c3ec=_0x37475b[_0xb464('0x21')]({'plain':!![]});var _0x57c25a=_0xb464('0x22');return db[_0xb464('0x23')]['destroy']({'where':{'type':_0x57c25a,'resourceId':_0x17c3ec['id']}})[_0xb464('0x20')](function(){return _0x37475b;});})['then'](function(){_0x45a3d5['status'](0xcc)[_0xb464('0x16')]();});}};}function handleEntityNotFound(_0x3027b8,_0x187568){return function(_0x4ad5ad){if(!_0x4ad5ad){_0x3027b8[_0xb464('0x14')](0x194);}return _0x4ad5ad;};}function handleError(_0x245b95,_0x5a7ac1){_0x5a7ac1=_0x5a7ac1||0x1f4;return function(_0x37629f){logger[_0xb464('0x24')](_0x37629f['stack']);if(_0x37629f[_0xb464('0x25')]){delete _0x37629f[_0xb464('0x25')];}_0x245b95['status'](_0x5a7ac1)['send'](_0x37629f);};}exports['index']=function(_0x5e34f0,_0x1b70b1){var _0xb85de={},_0x59a533={},_0xbabe4a={'count':0x0,'rows':[]};var _0x11a7b5=_[_0xb464('0x26')](db[_0xb464('0x27')][_0xb464('0x28')],function(_0x52401c){return{'name':_0x52401c[_0xb464('0x29')],'type':_0x52401c['type'][_0xb464('0x2a')]};});_0x59a533[_0xb464('0x2b')]=_[_0xb464('0x26')](_0x11a7b5,_0xb464('0x25'));_0x59a533['query']=_[_0xb464('0x2c')](_0x5e34f0[_0xb464('0x2d')]);_0x59a533[_0xb464('0x2e')]=_[_0xb464('0x2f')](_0x59a533[_0xb464('0x2b')],_0x59a533[_0xb464('0x2d')]);_0xb85de[_0xb464('0x30')]=_[_0xb464('0x2f')](_0x59a533['model'],qs[_0xb464('0x31')](_0x5e34f0[_0xb464('0x2d')][_0xb464('0x31')]));_0xb85de[_0xb464('0x30')]=_0xb85de['attributes']['length']?_0xb85de['attributes']:_0x59a533['model'];if(!_0x5e34f0['query'][_0xb464('0x32')](_0xb464('0x33'))){_0xb85de[_0xb464('0x34')]=qs[_0xb464('0x34')](_0x5e34f0[_0xb464('0x2d')][_0xb464('0x34')]);_0xb85de[_0xb464('0x18')]=qs[_0xb464('0x18')](_0x5e34f0[_0xb464('0x2d')][_0xb464('0x18')]);}_0xb85de[_0xb464('0x35')]=qs[_0xb464('0x36')](_0x5e34f0[_0xb464('0x2d')][_0xb464('0x36')]);_0xb85de[_0xb464('0x37')]=qs[_0xb464('0x2e')](_[_0xb464('0x38')](_0x5e34f0[_0xb464('0x2d')],_0x59a533[_0xb464('0x2e')]),_0x11a7b5);if(_0x5e34f0[_0xb464('0x2d')][_0xb464('0x39')]){_0xb85de['where']=_[_0xb464('0x3a')](_0xb85de[_0xb464('0x37')],{'$or':_[_0xb464('0x26')](_0x11a7b5,function(_0x627e58){if(_0x627e58[_0xb464('0x3b')]!=='VIRTUAL'){var _0x5dd05c={};_0x5dd05c[_0x627e58[_0xb464('0x25')]]={'$like':'%'+_0x5e34f0[_0xb464('0x2d')][_0xb464('0x39')]+'%'};return _0x5dd05c;}})});}_0xb85de=_['merge']({},_0xb85de,_0x5e34f0[_0xb464('0x3c')]);var _0x57e44f={'where':_0xb85de[_0xb464('0x37')]};return db[_0xb464('0x27')]['count'](_0x57e44f)['then'](function(_0x30568f){_0xbabe4a[_0xb464('0x1a')]=_0x30568f;if(_0x5e34f0[_0xb464('0x2d')][_0xb464('0x3d')]){_0xb85de[_0xb464('0x3e')]=[{'all':!![]}];}return db[_0xb464('0x27')][_0xb464('0x3f')](_0xb85de);})[_0xb464('0x20')](function(_0x13c123){_0xbabe4a[_0xb464('0x40')]=_0x13c123;return _0xbabe4a;})[_0xb464('0x20')](respondWithFilteredResult(_0x1b70b1,_0xb85de))['catch'](handleError(_0x1b70b1,null));};exports['show']=function(_0x3a778b,_0x3b4618){var _0x1ae73e={'raw':!![],'where':{'id':_0x3a778b[_0xb464('0x41')]['id']}},_0x415832={};_0x415832[_0xb464('0x2b')]=_[_0xb464('0x2c')](db[_0xb464('0x27')][_0xb464('0x28')]);_0x415832[_0xb464('0x2d')]=_['keys'](_0x3a778b[_0xb464('0x2d')]);_0x415832[_0xb464('0x2e')]=_[_0xb464('0x2f')](_0x415832[_0xb464('0x2b')],_0x415832[_0xb464('0x2d')]);_0x1ae73e[_0xb464('0x30')]=_['intersection'](_0x415832[_0xb464('0x2b')],qs[_0xb464('0x31')](_0x3a778b[_0xb464('0x2d')][_0xb464('0x31')]));_0x1ae73e['attributes']=_0x1ae73e[_0xb464('0x30')]['length']?_0x1ae73e[_0xb464('0x30')]:_0x415832[_0xb464('0x2b')];if(_0x3a778b['query'][_0xb464('0x3d')]){_0x1ae73e['include']=[{'all':!![]}];}_0x1ae73e=_[_0xb464('0x3a')]({},_0x1ae73e,_0x3a778b['options']);return db[_0xb464('0x27')][_0xb464('0x42')](_0x1ae73e)[_0xb464('0x20')](handleEntityNotFound(_0x3b4618,null))[_0xb464('0x20')](respondWithResult(_0x3b4618,null))['catch'](handleError(_0x3b4618,null));};exports['create']=function(_0x1232db,_0x556632){return db[_0xb464('0x27')][_0xb464('0x43')](_0x1232db[_0xb464('0x44')],{})[_0xb464('0x20')](function(_0x5b5262){var _0x5a19ff=_0x1232db[_0xb464('0x45')][_0xb464('0x21')]({'plain':!![]});if(!_0x5a19ff)throw new Error(_0xb464('0x46'));if(_0x5a19ff['role']===_0xb464('0x45')){var _0x55c567=_0x5b5262[_0xb464('0x21')]({'plain':!![]});var _0x20a7c1='Intervals';return db[_0xb464('0x47')]['find']({'where':{'name':_0x20a7c1,'userProfileId':_0x5a19ff[_0xb464('0x48')]},'raw':!![]})[_0xb464('0x20')](function(_0x184c70){if(_0x184c70&&_0x184c70[_0xb464('0x49')]===0x0){return db[_0xb464('0x23')][_0xb464('0x43')]({'name':_0x55c567[_0xb464('0x25')],'resourceId':_0x55c567['id'],'type':_0x184c70[_0xb464('0x25')],'sectionId':_0x184c70['id']},{})[_0xb464('0x20')](function(){return _0x5b5262;});}else{return _0x5b5262;}})[_0xb464('0x4a')](function(_0x32931d){logger[_0xb464('0x24')](_0xb464('0x4b'),_0x32931d);throw _0x32931d;});}return _0x5b5262;})[_0xb464('0x20')](respondWithResult(_0x556632,0xc9))[_0xb464('0x4a')](handleError(_0x556632,null));};exports[_0xb464('0x1f')]=function(_0x513af0,_0x4e58fc){if(_0x513af0[_0xb464('0x44')]['id']){delete _0x513af0[_0xb464('0x44')]['id'];}return db[_0xb464('0x27')][_0xb464('0x42')]({'where':{'id':_0x513af0['params']['id']}})['then'](handleEntityNotFound(_0x4e58fc,null))['then'](saveUpdates(_0x513af0[_0xb464('0x44')],null))[_0xb464('0x20')](respondWithResult(_0x4e58fc,null))[_0xb464('0x4a')](handleError(_0x4e58fc,null));};exports['destroy']=function(_0x5ee662,_0x5b7948){return db[_0xb464('0x27')]['find']({'where':{'id':_0x5ee662[_0xb464('0x41')]['id']}})[_0xb464('0x20')](handleEntityNotFound(_0x5b7948,null))[_0xb464('0x20')](removeEntity(_0x5b7948,null))[_0xb464('0x4a')](handleError(_0x5b7948,null));};exports[_0xb464('0x4c')]=function(_0x283dd1,_0x4ecfb2,_0x2c2d40){if(_0x283dd1[_0xb464('0x44')]['id']){delete _0x283dd1[_0xb464('0x44')]['id'];}return db[_0xb464('0x27')]['find']({'where':{'id':_0x283dd1[_0xb464('0x41')]['id']}})[_0xb464('0x20')](handleEntityNotFound(_0x4ecfb2,null))[_0xb464('0x20')](function(_0x27e201){if(_0x27e201){_0x283dd1[_0xb464('0x44')]['IntervalId']=_0x27e201['id'];return db[_0xb464('0x27')][_0xb464('0x43')](_0x283dd1['body']);}})[_0xb464('0x20')](respondWithResult(_0x4ecfb2,null))[_0xb464('0x4a')](handleError(_0x4ecfb2,null));};exports['getIntervals']=function(_0x34d695,_0x35fb54,_0x544b38){var _0x25ef3c={};var _0x2eef3d={};var _0x5661b8;var _0x4a1d7f;return db[_0xb464('0x27')][_0xb464('0x4d')]({'where':{'id':_0x34d695[_0xb464('0x41')]['id']}})[_0xb464('0x20')](handleEntityNotFound(_0x35fb54,null))[_0xb464('0x20')](function(_0x4beeb3){if(_0x4beeb3){_0x5661b8=_0x4beeb3;_0x2eef3d[_0xb464('0x2b')]=_[_0xb464('0x2c')](db[_0xb464('0x27')][_0xb464('0x28')]);_0x2eef3d[_0xb464('0x2d')]=_[_0xb464('0x2c')](_0x34d695[_0xb464('0x2d')]);_0x2eef3d[_0xb464('0x2e')]=_[_0xb464('0x2f')](_0x2eef3d[_0xb464('0x2b')],_0x2eef3d['query']);_0x25ef3c[_0xb464('0x30')]=_['intersection'](_0x2eef3d[_0xb464('0x2b')],qs[_0xb464('0x31')](_0x34d695[_0xb464('0x2d')][_0xb464('0x31')]));_0x25ef3c[_0xb464('0x30')]=_0x25ef3c[_0xb464('0x30')][_0xb464('0x4e')]?_0x25ef3c['attributes']:_0x2eef3d[_0xb464('0x2b')];_0x25ef3c[_0xb464('0x35')]=qs[_0xb464('0x36')](_0x34d695[_0xb464('0x2d')][_0xb464('0x36')]);_0x25ef3c['where']=qs[_0xb464('0x2e')](_[_0xb464('0x38')](_0x34d695[_0xb464('0x2d')],_0x2eef3d[_0xb464('0x2e')]));if(_0x34d695[_0xb464('0x2d')][_0xb464('0x39')]){_0x25ef3c[_0xb464('0x37')]=_[_0xb464('0x3a')](_0x25ef3c['where'],{'$or':_[_0xb464('0x26')](_0x25ef3c[_0xb464('0x30')],function(_0x2f5e82){var _0x5a720b={};_0x5a720b[_0x2f5e82]={'$like':'%'+_0x34d695[_0xb464('0x2d')][_0xb464('0x39')]+'%'};return _0x5a720b;})});}_0x25ef3c=_[_0xb464('0x3a')]({},_0x25ef3c,_0x34d695['options']);return _0x5661b8['getIntervals'](_0x25ef3c);}})['then'](function(_0x5196a1){if(_0x5196a1){_0x4a1d7f=_0x5196a1['length'];if(!_0x34d695['query']['hasOwnProperty'](_0xb464('0x33'))){_0x25ef3c[_0xb464('0x34')]=qs[_0xb464('0x34')](_0x34d695[_0xb464('0x2d')][_0xb464('0x34')]);_0x25ef3c[_0xb464('0x18')]=qs[_0xb464('0x18')](_0x34d695[_0xb464('0x2d')][_0xb464('0x18')]);}return _0x5661b8['getIntervals'](_0x25ef3c);}})[_0xb464('0x20')](function(_0x417b48){if(_0x417b48){return _0x417b48?{'count':_0x4a1d7f,'rows':_0x417b48}:null;}})[_0xb464('0x20')](respondWithResult(_0x35fb54,null))['catch'](handleError(_0x35fb54,null));};exports[_0xb464('0x4f')]=function(_0x2b0d35,_0x4f3de4,_0x587013){return db['Interval']['findOne']({'where':{'id':_0x2b0d35[_0xb464('0x41')]['id']}})[_0xb464('0x20')](handleEntityNotFound(_0x4f3de4,null))[_0xb464('0x20')](function(_0x3adda9){if(_0x3adda9){return db[_0xb464('0x50')][_0xb464('0x51')](function(_0x377ec9){return db[_0xb464('0x27')][_0xb464('0x52')]({'where':{'IntervalId':_0x2b0d35[_0xb464('0x41')]['id']},'transaction':_0x377ec9})[_0xb464('0x20')](function(_0x166da8){var _0x53650e=_[_0xb464('0x26')](_0x2b0d35['body'],function(_0x19211c){delete _0x19211c['id'];_0x19211c[_0xb464('0x53')]=_0x2b0d35[_0xb464('0x41')]['id'];return _0x19211c;});return db['Interval'][_0xb464('0x54')](_0x53650e,{'transaction':_0x377ec9});});})[_0xb464('0x20')](function(){return db[_0xb464('0x27')][_0xb464('0x3f')]({'where':{'IntervalId':_0x2b0d35[_0xb464('0x41')]['id']}});});}})[_0xb464('0x20')](respondWithResult(_0x4f3de4,null))[_0xb464('0x4a')](handleError(_0x4f3de4,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 17aa072..ebd2c58 100644 --- a/server/api/interval/interval.model.js +++ b/server/api/interval/interval.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc0c=['rewrite','interval','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','exports','define'];(function(_0x26a0af,_0x4e12f3){var _0x49e64c=function(_0x35c7ac){while(--_0x35c7ac){_0x26a0af['push'](_0x26a0af['shift']());}};_0x49e64c(++_0x4e12f3);}(_0xbc0c,0x1e8));var _0xcbc0=function(_0x37582b,_0x39095f){_0x37582b=_0x37582b-0x0;var _0xd4fc20=_0xbc0c[_0x37582b];return _0xd4fc20;};'use strict';var attributes=require(_0xcbc0('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xcbc0('0x1'))['iftime'];module[_0xcbc0('0x2')]=function(_0x3d06d2){return _0x3d06d2[_0xcbc0('0x3')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c6fd5){extensions[_0xcbc0('0x4')](_0x3d06d2,_0x3c6fd5);},'afterBulkCreate':function(_0x43384f,_0x4dffef,_0xd59b82){_0xd59b82();extensions[_0xcbc0('0x4')](_0x3d06d2,_0x43384f[0x0]);},'afterUpdate':function(_0x4ac250){extensions['rewrite'](_0x3d06d2,_0x4ac250);},'afterDestroy':function(_0xbc3c58){extensions[_0xcbc0('0x4')](_0x3d06d2,_0xbc3c58);}},'instanceMethods':{'ifTime':function(_0x147247=undefined,_0x40fd8a=new Date()){if(typeof this[_0xcbc0('0x5')]==='string'){return iftime(this[_0xcbc0('0x5')],_0x147247,_0x40fd8a);}else{return this[_0xcbc0('0x6')]()[_0xcbc0('0x7')](function(_0x44a8f8){return Promise[_0xcbc0('0x8')](_0x44a8f8[_0xcbc0('0x9')](function(_0x5503ca){return _0x5503ca[_0xcbc0('0xa')](_0x147247,_0x40fd8a);}));})['then'](function(_0x200d7e){return _0x200d7e[_0xcbc0('0xb')](function(_0x391797,_0x39958b){return _0x391797||_0x39958b;},![]);});}}}});}; \ No newline at end of file +var _0xc79b=['define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime','reduce','../../utils/iftime','iftime','exports'];(function(_0x4ad544,_0x18fe04){var _0x4ad1da=function(_0x54ebc9){while(--_0x54ebc9){_0x4ad544['push'](_0x4ad544['shift']());}};_0x4ad1da(++_0x18fe04);}(_0xc79b,0x129));var _0xbc79=function(_0x242ea7,_0x6e2212){_0x242ea7=_0x242ea7-0x0;var _0xdfdc78=_0xc79b[_0x242ea7];return _0xdfdc78;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xbc79('0x0'))[_0xbc79('0x1')];module[_0xbc79('0x2')]=function(_0x3f7336){return _0x3f7336[_0xbc79('0x3')](_0xbc79('0x4'),attributes,{'tableName':_0xbc79('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd85c5f){extensions['rewrite'](_0x3f7336,_0xd85c5f);},'afterBulkCreate':function(_0x487569,_0x301ddc,_0x30f354){_0x30f354();extensions[_0xbc79('0x6')](_0x3f7336,_0x487569[0x0]);},'afterUpdate':function(_0x288f5e){extensions['rewrite'](_0x3f7336,_0x288f5e);},'afterDestroy':function(_0x366644){extensions[_0xbc79('0x6')](_0x3f7336,_0x366644);}},'instanceMethods':{'ifTime':function(_0xdba7e8=undefined,_0x3ae937=new Date()){if(typeof this[_0xbc79('0x7')]===_0xbc79('0x8')){return iftime(this[_0xbc79('0x7')],_0xdba7e8,_0x3ae937);}else{return this[_0xbc79('0x9')]()[_0xbc79('0xa')](function(_0x3b8988){return Promise[_0xbc79('0xb')](_0x3b8988[_0xbc79('0xc')](function(_0x253611){return _0x253611[_0xbc79('0xd')](_0xdba7e8,_0x3ae937);}));})[_0xbc79('0xa')](function(_0x379896){return _0x379896[_0xbc79('0xe')](function(_0x4c6ecc,_0x9aa393){return _0x4c6ecc||_0x9aa393;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7713ec3..c7571c9 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3775=['isArray','reduce','lodash','util','../../mysqldb','iftime','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','ShowInterval','Interval','message','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve'];(function(_0x3a6a55,_0x2fbb05){var _0x363506=function(_0x24a10b){while(--_0x24a10b){_0x3a6a55['push'](_0x3a6a55['shift']());}};_0x363506(++_0x2fbb05);}(_0x3775,0xaa));var _0x5377=function(_0x48d804,_0x4a4f88){_0x48d804=_0x48d804-0x0;var _0x49b642=_0x3775[_0x48d804];return _0x49b642;};'use strict';var _=require(_0x5377('0x0'));var util=require(_0x5377('0x1'));var db=require(_0x5377('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x5377('0x3')];var logger=require('../../config/logger')(_0x5377('0x4'));exports[_0x5377('0x5')]=function(_0x5c30d5){var _0xb3d4dd=this;return new Promise(function(_0x524eeb,_0x57657b){return db['Interval'][_0x5377('0x6')]({'raw':_0x5c30d5[_0x5377('0x7')]?_0x5c30d5[_0x5377('0x7')][_0x5377('0x8')]===undefined?!![]:![]:!![],'where':_0x5c30d5[_0x5377('0x7')]?_0x5c30d5[_0x5377('0x7')][_0x5377('0x9')]||null:null,'attributes':_0x5c30d5[_0x5377('0x7')]?_0x5c30d5[_0x5377('0x7')][_0x5377('0xa')]||null:null,'limit':_0x5c30d5[_0x5377('0x7')]?_0x5c30d5[_0x5377('0x7')][_0x5377('0xb')]||null:null,'include':_0x5c30d5[_0x5377('0x7')]?_0x5c30d5[_0x5377('0x7')][_0x5377('0xc')]?_[_0x5377('0xd')](_0x5c30d5[_0x5377('0x7')]['include'],function(_0x2d25a9){return{'model':db[_0x2d25a9[_0x5377('0xe')]],'as':_0x2d25a9['as'],'attributes':_0x2d25a9[_0x5377('0xa')],'include':_0x2d25a9[_0x5377('0xc')]?_[_0x5377('0xd')](_0x2d25a9[_0x5377('0xc')],function(_0x42f541){return{'model':db[_0x42f541[_0x5377('0xe')]],'as':_0x42f541['as'],'attributes':_0x42f541[_0x5377('0xa')],'include':_0x42f541[_0x5377('0xc')]?_['map'](_0x42f541[_0x5377('0xc')],function(_0x1e6235){return{'model':db[_0x1e6235[_0x5377('0xe')]],'as':_0x1e6235['as'],'attributes':_0x1e6235[_0x5377('0xa')]};}):[]};}):[]};}):[]:[]})[_0x5377('0xf')](function(_0x105fb1){logger[_0x5377('0x10')](_0x5377('0x5'),_0x5c30d5);logger[_0x5377('0x11')](_0x5377('0x5'),_0x5c30d5,JSON[_0x5377('0x12')](_0x105fb1));_0x524eeb(_0x105fb1);})[_0x5377('0x13')](function(_0x2ad045){logger[_0x5377('0x14')](_0x5377('0x5'),_0x2ad045['message'],_0x5c30d5);_0x57657b(_0xb3d4dd['error'](0x1f4,_0x2ad045['message']));});});};exports[_0x5377('0x15')]=function(_0xb70164){var _0x1948b7=this;return new Promise(function(_0x1090db,_0x3b2f5c){return db[_0x5377('0x16')]['find']({'raw':_0xb70164[_0x5377('0x7')]?_0xb70164[_0x5377('0x7')][_0x5377('0x8')]===undefined?!![]:![]:!![],'where':_0xb70164['options']?_0xb70164[_0x5377('0x7')][_0x5377('0x9')]||null:null,'attributes':_0xb70164[_0x5377('0x7')]?_0xb70164[_0x5377('0x7')][_0x5377('0xa')]||null:null,'include':_0xb70164[_0x5377('0x7')]?_0xb70164['options']['include']?_[_0x5377('0xd')](_0xb70164[_0x5377('0x7')][_0x5377('0xc')],function(_0x4ce889){return{'model':db[_0x4ce889[_0x5377('0xe')]],'as':_0x4ce889['as'],'attributes':_0x4ce889[_0x5377('0xa')],'include':_0x4ce889['include']?_[_0x5377('0xd')](_0x4ce889[_0x5377('0xc')],function(_0x4aa369){return{'model':db[_0x4aa369['model']],'as':_0x4aa369['as'],'attributes':_0x4aa369[_0x5377('0xa')],'include':_0x4aa369[_0x5377('0xc')]?_['map'](_0x4aa369[_0x5377('0xc')],function(_0x3e7e88){return{'model':db[_0x3e7e88[_0x5377('0xe')]],'as':_0x3e7e88['as'],'attributes':_0x3e7e88['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x543b8b){logger[_0x5377('0x10')]('ShowInterval',_0xb70164);logger[_0x5377('0x11')](_0x5377('0x15'),_0xb70164,JSON[_0x5377('0x12')](_0x543b8b));_0x1090db(_0x543b8b);})['catch'](function(_0x55d01b){logger['error']('ShowInterval',_0x55d01b[_0x5377('0x17')],_0xb70164);_0x3b2f5c(_0x1948b7[_0x5377('0x14')](0x1f4,_0x55d01b[_0x5377('0x17')]));});});};function checkArrayOfIntervals(_0x3a74c8,_0x55fdce){var _0x3bf375=[];return db['Interval'][_0x5377('0x6')]({'where':{'id':_0x3a74c8}})[_0x5377('0xf')](function(_0x1a96cf){_0x3bf375=_0x1a96cf;return Promise['all'](_0x3bf375['map'](function(_0x5ec3e4){return _0x5ec3e4[_0x5377('0x18')](_0x55fdce);}));})[_0x5377('0xf')](function(_0x556fb9){var _0x29bd2c=_0x556fb9['reduce'](function(_0x1c0562,_0x3a35b9){return _0x1c0562||_0x3a35b9;},![]);logger[_0x5377('0x10')](util[_0x5377('0x19')](_0x5377('0x1a'),_0x3bf375[_0x5377('0xd')](function(_0x1ff5a6){return _0x1ff5a6['name'];})[_0x5377('0x1b')](',\x20'),_0x3bf375['map'](function(_0x5de0f1){return _0x5de0f1['id'];})[_0x5377('0x1b')](',\x20')));return _0x29bd2c;});}function checkSingleInterval(_0x75601e,_0x4d53bf){return db[_0x5377('0x16')][_0x5377('0x1c')](_0x75601e)['then'](function(_0x1f4d1a){if(_0x1f4d1a){logger[_0x5377('0x10')](util['format'](_0x5377('0x1d'),_0x1f4d1a[_0x5377('0x1e')],_0x1f4d1a['id']));return _0x1f4d1a[_0x5377('0x18')](_0x4d53bf);}});}exports['IntervalIftime']=function(_0x465a80){var _0x3288c7=_0x465a80['intervalIds'];var _0x58dc4c=Array['isArray'](_0x465a80[_0x5377('0x1f')])?_0x465a80[_0x5377('0x1f')]:typeof _0x465a80[_0x5377('0x1f')]===_0x5377('0x20')?[_0x465a80[_0x5377('0x1f')]]:[];var _0x1219d1=_0x465a80['timezone']||undefined;var _0x58b964=![];if(_0x58dc4c[_0x5377('0x21')]){logger['info'](util[_0x5377('0x19')](_0x5377('0x22'),_0x58dc4c[_0x5377('0x1b')](';\x20')));}if(_0x1219d1){logger[_0x5377('0x10')](util[_0x5377('0x19')](_0x5377('0x23'),_0x1219d1));}logger[_0x5377('0x11')](_0x5377('0x24'),_0x58b964);logger[_0x5377('0x25')](_0x5377('0x26'),_0x465a80);return Promise[_0x5377('0x27')]()[_0x5377('0xf')](function(){if(Array[_0x5377('0x28')](_0x3288c7)){return checkArrayOfIntervals(_0x3288c7,_0x1219d1);}else if(_0x3288c7){return checkSingleInterval(_0x3288c7,_0x1219d1);}})['then'](function(_0x1997d7){var _0x3acc87=_0x58dc4c[_0x5377('0x29')](function(_0x2e27e1,_0x4d8e2c){return _0x2e27e1||iftime(_0x4d8e2c,_0x1219d1);},![]);_0x58b964=_0x1997d7||_0x3acc87;return _0x58b964;})[_0x5377('0x13')](function(_0x2fa914){logger['error']('IntervalIftime',_0x465a80,_0x2fa914);throw this['error'](0x1f4,_0x2fa914['message']);});}; \ No newline at end of file +var _0xc255=['model','map','then','info','debug','stringify','error','message','ShowInterval','find','catch','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','reduce','lodash','util','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','options','raw','where','attributes','limit','include'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xc255,0x153));var _0x5c25=function(_0x24fd11,_0x57c976){_0x24fd11=_0x24fd11-0x0;var _0x5da68f=_0xc255[_0x24fd11];return _0x5da68f;};'use strict';var _=require(_0x5c25('0x0'));var util=require(_0x5c25('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0x5c25('0x2'))['iftime'];var logger=require(_0x5c25('0x3'))(_0x5c25('0x4'));exports[_0x5c25('0x5')]=function(_0x375b24){var _0x56cfcc=this;return new Promise(function(_0x74047b,_0xd496c5){return db[_0x5c25('0x6')]['findAll']({'raw':_0x375b24[_0x5c25('0x7')]?_0x375b24[_0x5c25('0x7')][_0x5c25('0x8')]===undefined?!![]:![]:!![],'where':_0x375b24[_0x5c25('0x7')]?_0x375b24[_0x5c25('0x7')][_0x5c25('0x9')]||null:null,'attributes':_0x375b24['options']?_0x375b24[_0x5c25('0x7')][_0x5c25('0xa')]||null:null,'limit':_0x375b24[_0x5c25('0x7')]?_0x375b24[_0x5c25('0x7')][_0x5c25('0xb')]||null:null,'include':_0x375b24[_0x5c25('0x7')]?_0x375b24['options'][_0x5c25('0xc')]?_['map'](_0x375b24[_0x5c25('0x7')][_0x5c25('0xc')],function(_0x2a7142){return{'model':db[_0x2a7142[_0x5c25('0xd')]],'as':_0x2a7142['as'],'attributes':_0x2a7142[_0x5c25('0xa')],'include':_0x2a7142[_0x5c25('0xc')]?_[_0x5c25('0xe')](_0x2a7142[_0x5c25('0xc')],function(_0x191de5){return{'model':db[_0x191de5['model']],'as':_0x191de5['as'],'attributes':_0x191de5[_0x5c25('0xa')],'include':_0x191de5['include']?_[_0x5c25('0xe')](_0x191de5[_0x5c25('0xc')],function(_0x384821){return{'model':db[_0x384821[_0x5c25('0xd')]],'as':_0x384821['as'],'attributes':_0x384821['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c25('0xf')](function(_0x1302cf){logger[_0x5c25('0x10')](_0x5c25('0x5'),_0x375b24);logger[_0x5c25('0x11')](_0x5c25('0x5'),_0x375b24,JSON[_0x5c25('0x12')](_0x1302cf));_0x74047b(_0x1302cf);})['catch'](function(_0x47feda){logger[_0x5c25('0x13')](_0x5c25('0x5'),_0x47feda[_0x5c25('0x14')],_0x375b24);_0xd496c5(_0x56cfcc[_0x5c25('0x13')](0x1f4,_0x47feda['message']));});});};exports[_0x5c25('0x15')]=function(_0x5430d0){var _0x4a7e81=this;return new Promise(function(_0x1c7b99,_0x13eb53){return db['Interval'][_0x5c25('0x16')]({'raw':_0x5430d0['options']?_0x5430d0[_0x5c25('0x7')][_0x5c25('0x8')]===undefined?!![]:![]:!![],'where':_0x5430d0[_0x5c25('0x7')]?_0x5430d0[_0x5c25('0x7')][_0x5c25('0x9')]||null:null,'attributes':_0x5430d0['options']?_0x5430d0[_0x5c25('0x7')][_0x5c25('0xa')]||null:null,'include':_0x5430d0[_0x5c25('0x7')]?_0x5430d0['options'][_0x5c25('0xc')]?_[_0x5c25('0xe')](_0x5430d0[_0x5c25('0x7')][_0x5c25('0xc')],function(_0x50c8ce){return{'model':db[_0x50c8ce['model']],'as':_0x50c8ce['as'],'attributes':_0x50c8ce[_0x5c25('0xa')],'include':_0x50c8ce[_0x5c25('0xc')]?_[_0x5c25('0xe')](_0x50c8ce[_0x5c25('0xc')],function(_0x5d023d){return{'model':db[_0x5d023d[_0x5c25('0xd')]],'as':_0x5d023d['as'],'attributes':_0x5d023d['attributes'],'include':_0x5d023d[_0x5c25('0xc')]?_[_0x5c25('0xe')](_0x5d023d[_0x5c25('0xc')],function(_0xcdd60e){return{'model':db[_0xcdd60e[_0x5c25('0xd')]],'as':_0xcdd60e['as'],'attributes':_0xcdd60e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c25('0xf')](function(_0x522af9){logger[_0x5c25('0x10')](_0x5c25('0x15'),_0x5430d0);logger[_0x5c25('0x11')](_0x5c25('0x15'),_0x5430d0,JSON[_0x5c25('0x12')](_0x522af9));_0x1c7b99(_0x522af9);})[_0x5c25('0x17')](function(_0x10507d){logger['error'](_0x5c25('0x15'),_0x10507d[_0x5c25('0x14')],_0x5430d0);_0x13eb53(_0x4a7e81[_0x5c25('0x13')](0x1f4,_0x10507d[_0x5c25('0x14')]));});});};function checkArrayOfIntervals(_0x75069c,_0x507825){var _0x41ffeb=[];return db[_0x5c25('0x6')]['findAll']({'where':{'id':_0x75069c}})['then'](function(_0x5d6cb8){_0x41ffeb=_0x5d6cb8;return Promise[_0x5c25('0x18')](_0x41ffeb[_0x5c25('0xe')](function(_0x339398){return _0x339398[_0x5c25('0x19')](_0x507825);}));})[_0x5c25('0xf')](function(_0x61a3b7){var _0x16d0fe=_0x61a3b7['reduce'](function(_0x53413a,_0x418a73){return _0x53413a||_0x418a73;},![]);logger[_0x5c25('0x10')](util[_0x5c25('0x1a')](_0x5c25('0x1b'),_0x41ffeb['map'](function(_0x2edc3e){return _0x2edc3e[_0x5c25('0x1c')];})['join'](',\x20'),_0x41ffeb[_0x5c25('0xe')](function(_0x4de0fa){return _0x4de0fa['id'];})[_0x5c25('0x1d')](',\x20')));return _0x16d0fe;});}function checkSingleInterval(_0x21d1d7,_0x4fc0c1){return db[_0x5c25('0x6')][_0x5c25('0x1e')](_0x21d1d7)[_0x5c25('0xf')](function(_0x2736ad){if(_0x2736ad){logger[_0x5c25('0x10')](util[_0x5c25('0x1a')](_0x5c25('0x1f'),_0x2736ad['name'],_0x2736ad['id']));return _0x2736ad['ifTime'](_0x4fc0c1);}});}exports[_0x5c25('0x20')]=function(_0x32e9e6){var _0x19f47d=_0x32e9e6[_0x5c25('0x21')];var _0xe61f09=Array[_0x5c25('0x22')](_0x32e9e6[_0x5c25('0x23')])?_0x32e9e6[_0x5c25('0x23')]:typeof _0x32e9e6['intervals']===_0x5c25('0x24')?[_0x32e9e6[_0x5c25('0x23')]]:[];var _0x32ba7c=_0x32e9e6['timezone']||undefined;var _0x5afec2=![];if(_0xe61f09[_0x5c25('0x25')]){logger['info'](util[_0x5c25('0x1a')](_0x5c25('0x26'),_0xe61f09[_0x5c25('0x1d')](';\x20')));}if(_0x32ba7c){logger[_0x5c25('0x10')](util[_0x5c25('0x1a')](_0x5c25('0x27'),_0x32ba7c));}logger[_0x5c25('0x11')](_0x5c25('0x28'),_0x5afec2);logger[_0x5c25('0x29')](_0x5c25('0x20'),_0x32e9e6);return Promise[_0x5c25('0x2a')]()['then'](function(){if(Array['isArray'](_0x19f47d)){return checkArrayOfIntervals(_0x19f47d,_0x32ba7c);}else if(_0x19f47d){return checkSingleInterval(_0x19f47d,_0x32ba7c);}})['then'](function(_0x15a384){var _0x122673=_0xe61f09[_0x5c25('0x2b')](function(_0xa4385a,_0x3c40d2){return _0xa4385a||iftime(_0x3c40d2,_0x32ba7c);},![]);_0x5afec2=_0x15a384||_0x122673;return _0x5afec2;})[_0x5c25('0x17')](function(_0x26aa0a){logger[_0x5c25('0x13')](_0x5c25('0x20'),_0x32e9e6,_0x26aa0a);throw this[_0x5c25('0x13')](0x1f4,_0x26aa0a[_0x5c25('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2c9a8a1..525d6dc 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x332d5c,_0x4a2336){_0x332d5c=_0x332d5c-0x0;var _0x47448d=_0xb10b[_0x332d5c];return _0x47448d;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x1ef433,_0x4f285b){var _0x3259a1=function(_0x14da75){while(--_0x14da75){_0x1ef433['push'](_0x1ef433['shift']());}};_0x3259a1(++_0x4f285b);}(_0x2032,0xd9));var _0x2203=function(_0x5017d7,_0x4de8bb){_0x5017d7=_0x5017d7-0x0;var _0x5c1771=_0x2032[_0x5017d7];return _0x5c1771;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 061c78c..a10d0ea 100644 --- a/server/api/jira/jira.controller.js +++ b/server/api/jira/jira.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1916=['fields','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','summary','Report','\x20from\x20','description','stringify','issuetype','Bug'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1916,0x164));var _0x6191=function(_0x49919f,_0x22f8d3){_0x49919f=_0x49919f-0x0;var _0x5152f2=_0x1916[_0x49919f];return _0x5152f2;};'use strict';var BPromise=require(_0x6191('0x0'));var https=require(_0x6191('0x1'));var logger=require('../../config/logger')(_0x6191('0x2'));var USERNAME=_0x6191('0x3');var PASSWORD=_0x6191('0x4');function openIssue(_0xf2442a,_0x53f905){var _0x2fe6ca={'fields':{'project':{'key':_0xf2442a['key']||'MOTGUI'},'summary':(_0xf2442a[_0x6191('0x5')]||_0x6191('0x6'))+_0x6191('0x7')+_0xf2442a['ip'],'description':_0xf2442a[_0x6191('0x8')]||JSON[_0x6191('0x9')](_0xf2442a),'issuetype':{'name':_0xf2442a[_0x6191('0xa')]||_0x6191('0xb')}}};_0x2fe6ca[_0x6191('0xc')]['customfield_11500']=_0xf2442a[_0x6191('0xd')];_0x2fe6ca[_0x6191('0xc')][_0x6191('0xe')]=_0xf2442a[_0x6191('0xf')];_0x2fe6ca['fields'][_0x6191('0x10')]=_0xf2442a['newToken'];_0x2fe6ca[_0x6191('0xc')][_0x6191('0x11')]=_0xf2442a[_0x6191('0x12')];_0x2fe6ca[_0x6191('0xc')][_0x6191('0x13')]=_0xf2442a[_0x6191('0x14')];_0x2fe6ca[_0x6191('0xc')]['customfield_10102']=_0xf2442a['ip'];var _0x3ebb59={'host':_0x6191('0x15'),'port':0x1bb,'path':_0x6191('0x16'),'method':_0x6191('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x6191('0x18'),'Authorization':_0x6191('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x6191('0x1a')](_0x6191('0x1b'))}};var _0x125cc3=JSON[_0x6191('0x9')](_0x2fe6ca);var _0x5f0d59=https['request'](_0x3ebb59,function(_0xf3c556){_0xf3c556[_0x6191('0x1c')](_0x6191('0x1d'));var _0x12fc95='';_0xf3c556['on'](_0x6191('0x1e'),function(_0x29db74){_0x12fc95+=_0x29db74;});_0xf3c556['on'](_0x6191('0x1f'),function(){if(_0x53f905){return _0x53f905[_0x6191('0x20')](_0xf3c556[_0x6191('0x21')])[_0x6191('0x22')](JSON[_0x6191('0x23')](_0x12fc95));}});});_0x5f0d59['on'](_0x6191('0x24'),function(_0x406bde){if(_0x53f905){return _0x53f905['status'](0x1f4)[_0x6191('0x22')]({'errors':[{'message':_0x6191('0x25'),'type':_0x6191('0x26')}]});}});_0x5f0d59['write'](_0x125cc3);_0x5f0d59[_0x6191('0x1f')]();}exports['openIssue']=openIssue;exports[_0x6191('0x27')]=function(_0x5d4d7d,_0x49bf69){_0x5d4d7d[_0x6191('0x28')]['ip']=_0x5d4d7d[_0x6191('0x29')][_0x6191('0x2a')]||_0x5d4d7d[_0x6191('0x2b')][_0x6191('0x2c')]||_0x5d4d7d[_0x6191('0x2d')]['remoteAddress']||_0x5d4d7d[_0x6191('0x2b')][_0x6191('0x2d')][_0x6191('0x2c')];return openIssue(_0x5d4d7d['body'],_0x49bf69);}; \ No newline at end of file +var _0xc4ea=['x-forwarded-for','remoteAddress','socket','connection','bluebird','../../config/logger','api','support','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','customfield_11501','oldToken','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','json','write','end','send','body'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xc4ea,0x131));var _0xac4e=function(_0x253c67,_0x1787d2){_0x253c67=_0x253c67-0x0;var _0x3dc867=_0xc4ea[_0x253c67];return _0x3dc867;};'use strict';var BPromise=require(_0xac4e('0x0'));var https=require('https');var logger=require(_0xac4e('0x1'))(_0xac4e('0x2'));var USERNAME=_0xac4e('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x294b55,_0x21883a){var _0xcec583={'fields':{'project':{'key':_0x294b55[_0xac4e('0x4')]||_0xac4e('0x5')},'summary':(_0x294b55[_0xac4e('0x6')]||_0xac4e('0x7'))+_0xac4e('0x8')+_0x294b55['ip'],'description':_0x294b55['description']||JSON[_0xac4e('0x9')](_0x294b55),'issuetype':{'name':_0x294b55[_0xac4e('0xa')]||_0xac4e('0xb')}}};_0xcec583['fields']['customfield_11500']=_0x294b55['email'];_0xcec583['fields'][_0xac4e('0xc')]=_0x294b55[_0xac4e('0xd')];_0xcec583[_0xac4e('0xe')][_0xac4e('0xf')]=_0x294b55[_0xac4e('0x10')];_0xcec583[_0xac4e('0xe')][_0xac4e('0x11')]=_0x294b55[_0xac4e('0x12')];_0xcec583[_0xac4e('0xe')][_0xac4e('0x13')]=_0x294b55[_0xac4e('0x14')];_0xcec583[_0xac4e('0xe')][_0xac4e('0x15')]=_0x294b55['ip'];var _0x49d3a5={'host':_0xac4e('0x16'),'port':0x1bb,'path':_0xac4e('0x17'),'method':_0xac4e('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xac4e('0x19'),'Authorization':_0xac4e('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xac4e('0x1b')](_0xac4e('0x1c'))}};var _0x270974=JSON[_0xac4e('0x9')](_0xcec583);var _0x29fb8f=https[_0xac4e('0x1d')](_0x49d3a5,function(_0x2b68ca){_0x2b68ca[_0xac4e('0x1e')](_0xac4e('0x1f'));var _0x187432='';_0x2b68ca['on'](_0xac4e('0x20'),function(_0x35dec0){_0x187432+=_0x35dec0;});_0x2b68ca['on']('end',function(){if(_0x21883a){return _0x21883a[_0xac4e('0x21')](_0x2b68ca['statusCode'])[_0xac4e('0x22')](JSON['parse'](_0x187432));}});});_0x29fb8f['on']('error',function(_0x1b4508){if(_0x21883a){return _0x21883a[_0xac4e('0x21')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x29fb8f[_0xac4e('0x23')](_0x270974);_0x29fb8f[_0xac4e('0x24')]();}exports['openIssue']=openIssue;exports[_0xac4e('0x25')]=function(_0x4fc2f9,_0x41b839){_0x4fc2f9[_0xac4e('0x26')]['ip']=_0x4fc2f9['headers'][_0xac4e('0x27')]||_0x4fc2f9['connection'][_0xac4e('0x28')]||_0x4fc2f9[_0xac4e('0x29')][_0xac4e('0x28')]||_0x4fc2f9[_0xac4e('0x2a')][_0xac4e('0x29')][_0xac4e('0x28')];return openIssue(_0x4fc2f9['body'],_0x41b839);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 06f2ce2..8ce864f 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x2f499d,_0x2df133){var _0x2fb4f5=function(_0x3644cc){while(--_0x3644cc){_0x2f499d['push'](_0x2f499d['shift']());}};_0x2fb4f5(++_0x2df133);}(_0x41bb,0xc5));var _0xb41b=function(_0x36807d,_0x40c05e){_0x36807d=_0x36807d-0x0;var _0x14b69a=_0x41bb[_0x36807d];return _0x14b69a;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file +var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x17ba,0xab));var _0xa17b=function(_0x4b94a8,_0x24e5a6){_0x4b94a8=_0x4b94a8-0x0;var _0x55ac5d=_0x17ba[_0x4b94a8];return _0x55ac5d;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9d806e3..1dbb306 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0x50e54b,_0xc0862b){_0x50e54b=_0x50e54b-0x0;var _0x4241c9=_0x7a54[_0x50e54b];return _0x4241c9;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a54,0x106));var _0x47a5=function(_0xd2894,_0x7e16e4){_0xd2894=_0xd2894-0x0;var _0x3e7a3e=_0x7a54[_0xd2894];return _0x3e7a3e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 3f44b59..cfa889c 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc949=['eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','catch','rawAttributes','intersection','include','find','create','body','params','describe'];(function(_0x444a0b,_0x4cc5d4){var _0x6e781d=function(_0x5781ee){while(--_0x5781ee){_0x444a0b['push'](_0x444a0b['shift']());}};_0x6e781d(++_0x4cc5d4);}(_0xc949,0x181));var _0x9c94=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xc949[_0x3ce3c];return _0x55a2c9;};'use strict';var emlformat=require(_0x9c94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c94('0x1'));var jsonpatch=require(_0x9c94('0x2'));var rp=require(_0x9c94('0x3'));var moment=require(_0x9c94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c94('0x5'));var util=require(_0x9c94('0x6'));var path=require('path');var sox=require(_0x9c94('0x7'));var csv=require(_0x9c94('0x8'));var ejs=require(_0x9c94('0x9'));var fs=require('fs');var fs_extra=require(_0x9c94('0xa'));var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x8'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];function respondWithStatusCode(_0x423adb,_0x30f64e){_0x30f64e=_0x30f64e||0xcc;return function(_0x1e326f){if(_0x1e326f){return _0x423adb[_0x9c94('0x1b')](_0x30f64e);}return _0x423adb[_0x9c94('0x1c')](_0x30f64e)[_0x9c94('0x1d')]();};}function respondWithResult(_0x15c51c,_0x54d956){_0x54d956=_0x54d956||0xc8;return function(_0x9789bc){if(_0x9789bc){return _0x15c51c['status'](_0x54d956)[_0x9c94('0x1e')](_0x9789bc);}};}function respondWithFilteredResult(_0x26e629,_0x4f0013){return function(_0xe52641){if(_0xe52641){var _0x4d6308=typeof _0x4f0013['offset']===_0x9c94('0x1f')&&typeof _0x4f0013['limit']===_0x9c94('0x1f');var _0x33bd19=_0xe52641['count'];var _0x201e04=_0x4d6308?0x0:_0x4f0013[_0x9c94('0x20')];var _0x412804=_0x4d6308?_0xe52641[_0x9c94('0x21')]:_0x4f0013[_0x9c94('0x20')]+_0x4f0013[_0x9c94('0x22')];var _0x3e361c;if(_0x412804>=_0x33bd19){_0x412804=_0x33bd19;_0x3e361c=0xc8;}else{_0x3e361c=0xce;}_0x26e629['status'](_0x3e361c);return _0x26e629[_0x9c94('0x23')](_0x9c94('0x24'),_0x201e04+'-'+_0x412804+'/'+_0x33bd19)['json'](_0xe52641);}return null;};}function patchUpdates(_0x141801){return function(_0x845304){try{jsonpatch[_0x9c94('0x25')](_0x845304,_0x141801,!![]);}catch(_0x326b38){return BPromise[_0x9c94('0x26')](_0x326b38);}return _0x845304[_0x9c94('0x27')]();};}function saveUpdates(_0xadab16,_0x23cdf5){return function(_0x8fe4fb){if(_0x8fe4fb){return _0x8fe4fb[_0x9c94('0x28')](_0xadab16)[_0x9c94('0x29')](function(_0xe9280a){return _0xe9280a;});}return null;};}function removeEntity(_0x44d732,_0x8c0b7f){return function(_0x5b1020){if(_0x5b1020){return _0x5b1020[_0x9c94('0x2a')]()[_0x9c94('0x29')](function(){_0x44d732['status'](0xcc)[_0x9c94('0x1d')]();});}};}function handleEntityNotFound(_0x2c3d25,_0x4795bb){return function(_0x335184){if(!_0x335184){_0x2c3d25[_0x9c94('0x1b')](0x194);}return _0x335184;};}function handleError(_0x4dd38e,_0xc18230){_0xc18230=_0xc18230||0x1f4;return function(_0x45cf4d){logger['error'](_0x45cf4d[_0x9c94('0x2b')]);if(_0x45cf4d['name']){delete _0x45cf4d[_0x9c94('0x2c')];}_0x4dd38e[_0x9c94('0x1c')](_0xc18230)[_0x9c94('0x2d')](_0x45cf4d);};}exports[_0x9c94('0x2e')]=function(_0x1581c0,_0x3f2622){var _0xf30dd1={},_0x561fdc={},_0x5a6b1c={'count':0x0,'rows':[]};var _0xc4a819=_[_0x9c94('0x2f')](db[_0x9c94('0x30')]['rawAttributes'],function(_0x25a6b9){return{'name':_0x25a6b9['fieldName'],'type':_0x25a6b9[_0x9c94('0x31')][_0x9c94('0x32')]};});_0x561fdc[_0x9c94('0x33')]=_['map'](_0xc4a819,'name');_0x561fdc[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x1581c0[_0x9c94('0x34')]);_0x561fdc['filters']=_['intersection'](_0x561fdc['model'],_0x561fdc['query']);_0xf30dd1[_0x9c94('0x36')]=_['intersection'](_0x561fdc[_0x9c94('0x33')],qs[_0x9c94('0x37')](_0x1581c0['query']['fields']));_0xf30dd1[_0x9c94('0x36')]=_0xf30dd1[_0x9c94('0x36')][_0x9c94('0x38')]?_0xf30dd1[_0x9c94('0x36')]:_0x561fdc[_0x9c94('0x33')];if(!_0x1581c0[_0x9c94('0x34')][_0x9c94('0x39')](_0x9c94('0x3a'))){_0xf30dd1[_0x9c94('0x22')]=qs[_0x9c94('0x22')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x22')]);_0xf30dd1[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x20')]);}_0xf30dd1[_0x9c94('0x3b')]=qs[_0x9c94('0x3c')](_0x1581c0['query'][_0x9c94('0x3c')]);_0xf30dd1[_0x9c94('0x3d')]=qs[_0x9c94('0x3e')](_[_0x9c94('0x3f')](_0x1581c0[_0x9c94('0x34')],_0x561fdc[_0x9c94('0x3e')]),_0xc4a819);if(_0x1581c0[_0x9c94('0x34')]['filter']){_0xf30dd1[_0x9c94('0x3d')]=_['merge'](_0xf30dd1[_0x9c94('0x3d')],{'$or':_[_0x9c94('0x2f')](_0xc4a819,function(_0x442d46){if(_0x442d46[_0x9c94('0x31')]!=='VIRTUAL'){var _0x245278={};_0x245278[_0x442d46['name']]={'$like':'%'+_0x1581c0[_0x9c94('0x34')][_0x9c94('0x40')]+'%'};return _0x245278;}})});}_0xf30dd1=_[_0x9c94('0x41')]({},_0xf30dd1,_0x1581c0['options']);var _0x21e9f7={'where':_0xf30dd1['where']};return db[_0x9c94('0x30')]['count'](_0x21e9f7)['then'](function(_0x9a75f0){_0x5a6b1c[_0x9c94('0x21')]=_0x9a75f0;if(_0x1581c0[_0x9c94('0x34')][_0x9c94('0x42')]){_0xf30dd1['include']=[{'all':!![]}];}return db[_0x9c94('0x30')][_0x9c94('0x43')](_0xf30dd1);})[_0x9c94('0x29')](function(_0x360960){_0x5a6b1c['rows']=_0x360960;return _0x5a6b1c;})[_0x9c94('0x29')](respondWithFilteredResult(_0x3f2622,_0xf30dd1))[_0x9c94('0x44')](handleError(_0x3f2622,null));};exports['show']=function(_0x24e74c,_0x3d8b31){var _0x2a5bd5={'raw':!![],'where':{'id':_0x24e74c['params']['id']}},_0x5e6a90={};_0x5e6a90[_0x9c94('0x33')]=_[_0x9c94('0x35')](db[_0x9c94('0x30')][_0x9c94('0x45')]);_0x5e6a90[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x24e74c[_0x9c94('0x34')]);_0x5e6a90[_0x9c94('0x3e')]=_[_0x9c94('0x46')](_0x5e6a90[_0x9c94('0x33')],_0x5e6a90[_0x9c94('0x34')]);_0x2a5bd5['attributes']=_[_0x9c94('0x46')](_0x5e6a90['model'],qs[_0x9c94('0x37')](_0x24e74c[_0x9c94('0x34')][_0x9c94('0x37')]));_0x2a5bd5[_0x9c94('0x36')]=_0x2a5bd5[_0x9c94('0x36')][_0x9c94('0x38')]?_0x2a5bd5[_0x9c94('0x36')]:_0x5e6a90['model'];if(_0x24e74c['query'][_0x9c94('0x42')]){_0x2a5bd5[_0x9c94('0x47')]=[{'all':!![]}];}_0x2a5bd5=_[_0x9c94('0x41')]({},_0x2a5bd5,_0x24e74c['options']);return db[_0x9c94('0x30')][_0x9c94('0x48')](_0x2a5bd5)['then'](handleEntityNotFound(_0x3d8b31,null))['then'](respondWithResult(_0x3d8b31,null))['catch'](handleError(_0x3d8b31,null));};exports['create']=function(_0x2b94e0,_0x5362f4){return db['JscriptyAnswerReport'][_0x9c94('0x49')](_0x2b94e0['body'],{})[_0x9c94('0x29')](respondWithResult(_0x5362f4,0xc9))[_0x9c94('0x44')](handleError(_0x5362f4,null));};exports[_0x9c94('0x28')]=function(_0x205f51,_0x22eaa4){if(_0x205f51['body']['id']){delete _0x205f51[_0x9c94('0x4a')]['id'];}return db[_0x9c94('0x30')][_0x9c94('0x48')]({'where':{'id':_0x205f51[_0x9c94('0x4b')]['id']}})[_0x9c94('0x29')](handleEntityNotFound(_0x22eaa4,null))[_0x9c94('0x29')](saveUpdates(_0x205f51['body'],null))[_0x9c94('0x29')](respondWithResult(_0x22eaa4,null))['catch'](handleError(_0x22eaa4,null));};exports[_0x9c94('0x2a')]=function(_0x38bb48,_0x426c0f){return db['JscriptyAnswerReport'][_0x9c94('0x48')]({'where':{'id':_0x38bb48[_0x9c94('0x4b')]['id']}})['then'](handleEntityNotFound(_0x426c0f,null))[_0x9c94('0x29')](removeEntity(_0x426c0f,null))['catch'](handleError(_0x426c0f,null));};exports[_0x9c94('0x4c')]=function(_0x3aa1dd,_0x537c78){return db['JscriptyAnswerReport'][_0x9c94('0x4c')]()['then'](respondWithResult(_0x537c78,null))[_0x9c94('0x44')](handleError(_0x537c78,null));}; \ No newline at end of file +var _0xf3be=['then','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','query','keys','intersection','attributes','fields','model','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','catch','rawAttributes','length','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x3bfb58,_0x139b55){var _0xdbd27a=function(_0x180607){while(--_0x180607){_0x3bfb58['push'](_0x3bfb58['shift']());}};_0xdbd27a(++_0x139b55);}(_0xf3be,0x1e1));var _0xef3b=function(_0x3c1c77,_0x39fc1c){_0x3c1c77=_0x3c1c77-0x0;var _0x31b7e6=_0xf3be[_0x3c1c77];return _0x31b7e6;};'use strict';var emlformat=require(_0xef3b('0x0'));var rimraf=require(_0xef3b('0x1'));var zipdir=require(_0xef3b('0x2'));var jsonpatch=require(_0xef3b('0x3'));var rp=require('request-promise');var moment=require(_0xef3b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xef3b('0x5'));var csv=require(_0xef3b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef3b('0x7'));var _=require(_0xef3b('0x8'));var squel=require(_0xef3b('0x9'));var crypto=require(_0xef3b('0xa'));var jsforce=require(_0xef3b('0xb'));var deskjs=require(_0xef3b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef3b('0xd'));var Redis=require('ioredis');var authService=require(_0xef3b('0xe'));var qs=require(_0xef3b('0xf'));var as=require(_0xef3b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef3b('0x11'))('api');var utils=require(_0xef3b('0x12'));var config=require(_0xef3b('0x13'));var licenseUtil=require(_0xef3b('0x14'));var db=require(_0xef3b('0x15'))['db'];function respondWithStatusCode(_0x2a2a27,_0x3aef79){_0x3aef79=_0x3aef79||0xcc;return function(_0x169b2c){if(_0x169b2c){return _0x2a2a27[_0xef3b('0x16')](_0x3aef79);}return _0x2a2a27[_0xef3b('0x17')](_0x3aef79)[_0xef3b('0x18')]();};}function respondWithResult(_0x510cc3,_0x5a53b9){_0x5a53b9=_0x5a53b9||0xc8;return function(_0x138ea5){if(_0x138ea5){return _0x510cc3[_0xef3b('0x17')](_0x5a53b9)[_0xef3b('0x19')](_0x138ea5);}};}function respondWithFilteredResult(_0x118a31,_0x416801){return function(_0x529e89){if(_0x529e89){var _0x169803=typeof _0x416801[_0xef3b('0x1a')]===_0xef3b('0x1b')&&typeof _0x416801[_0xef3b('0x1c')]===_0xef3b('0x1b');var _0x5908cb=_0x529e89[_0xef3b('0x1d')];var _0x406eb7=_0x169803?0x0:_0x416801['offset'];var _0x280ccf=_0x169803?_0x529e89['count']:_0x416801[_0xef3b('0x1a')]+_0x416801['limit'];var _0x278de3;if(_0x280ccf>=_0x5908cb){_0x280ccf=_0x5908cb;_0x278de3=0xc8;}else{_0x278de3=0xce;}_0x118a31[_0xef3b('0x17')](_0x278de3);return _0x118a31[_0xef3b('0x1e')](_0xef3b('0x1f'),_0x406eb7+'-'+_0x280ccf+'/'+_0x5908cb)[_0xef3b('0x19')](_0x529e89);}return null;};}function patchUpdates(_0x3d18ef){return function(_0x19d4b5){try{jsonpatch[_0xef3b('0x20')](_0x19d4b5,_0x3d18ef,!![]);}catch(_0x4a3fbf){return BPromise[_0xef3b('0x21')](_0x4a3fbf);}return _0x19d4b5[_0xef3b('0x22')]();};}function saveUpdates(_0x214b53,_0xfe39a4){return function(_0x93a080){if(_0x93a080){return _0x93a080[_0xef3b('0x23')](_0x214b53)['then'](function(_0x27cc47){return _0x27cc47;});}return null;};}function removeEntity(_0x574042,_0x57b14a){return function(_0xc68cb2){if(_0xc68cb2){return _0xc68cb2[_0xef3b('0x24')]()[_0xef3b('0x25')](function(){_0x574042[_0xef3b('0x17')](0xcc)[_0xef3b('0x18')]();});}};}function handleEntityNotFound(_0x179338,_0x4ecb5e){return function(_0x487ae6){if(!_0x487ae6){_0x179338[_0xef3b('0x16')](0x194);}return _0x487ae6;};}function handleError(_0x4b6ee7,_0x4d5449){_0x4d5449=_0x4d5449||0x1f4;return function(_0x13dd47){logger[_0xef3b('0x26')](_0x13dd47[_0xef3b('0x27')]);if(_0x13dd47[_0xef3b('0x28')]){delete _0x13dd47[_0xef3b('0x28')];}_0x4b6ee7[_0xef3b('0x17')](_0x4d5449)[_0xef3b('0x29')](_0x13dd47);};}exports[_0xef3b('0x2a')]=function(_0x556c5c,_0xded00b){var _0x2b073b={},_0x634a45={},_0x187d1b={'count':0x0,'rows':[]};var _0x27ab13=_[_0xef3b('0x2b')](db[_0xef3b('0x2c')]['rawAttributes'],function(_0x4c9a84){return{'name':_0x4c9a84[_0xef3b('0x2d')],'type':_0x4c9a84[_0xef3b('0x2e')][_0xef3b('0x2f')]};});_0x634a45['model']=_[_0xef3b('0x2b')](_0x27ab13,_0xef3b('0x28'));_0x634a45[_0xef3b('0x30')]=_[_0xef3b('0x31')](_0x556c5c[_0xef3b('0x30')]);_0x634a45['filters']=_[_0xef3b('0x32')](_0x634a45['model'],_0x634a45[_0xef3b('0x30')]);_0x2b073b[_0xef3b('0x33')]=_[_0xef3b('0x32')](_0x634a45['model'],qs[_0xef3b('0x34')](_0x556c5c[_0xef3b('0x30')][_0xef3b('0x34')]));_0x2b073b['attributes']=_0x2b073b[_0xef3b('0x33')]['length']?_0x2b073b[_0xef3b('0x33')]:_0x634a45[_0xef3b('0x35')];if(!_0x556c5c['query']['hasOwnProperty'](_0xef3b('0x36'))){_0x2b073b[_0xef3b('0x1c')]=qs[_0xef3b('0x1c')](_0x556c5c['query'][_0xef3b('0x1c')]);_0x2b073b[_0xef3b('0x1a')]=qs[_0xef3b('0x1a')](_0x556c5c[_0xef3b('0x30')][_0xef3b('0x1a')]);}_0x2b073b[_0xef3b('0x37')]=qs['sort'](_0x556c5c['query'][_0xef3b('0x38')]);_0x2b073b[_0xef3b('0x39')]=qs[_0xef3b('0x3a')](_[_0xef3b('0x3b')](_0x556c5c[_0xef3b('0x30')],_0x634a45[_0xef3b('0x3a')]),_0x27ab13);if(_0x556c5c['query'][_0xef3b('0x3c')]){_0x2b073b[_0xef3b('0x39')]=_[_0xef3b('0x3d')](_0x2b073b['where'],{'$or':_[_0xef3b('0x2b')](_0x27ab13,function(_0x5ab5eb){if(_0x5ab5eb[_0xef3b('0x2e')]!=='VIRTUAL'){var _0x3a361f={};_0x3a361f[_0x5ab5eb['name']]={'$like':'%'+_0x556c5c[_0xef3b('0x30')]['filter']+'%'};return _0x3a361f;}})});}_0x2b073b=_[_0xef3b('0x3d')]({},_0x2b073b,_0x556c5c[_0xef3b('0x3e')]);var _0x1108e1={'where':_0x2b073b[_0xef3b('0x39')]};return db[_0xef3b('0x2c')][_0xef3b('0x1d')](_0x1108e1)[_0xef3b('0x25')](function(_0x219cfc){_0x187d1b['count']=_0x219cfc;if(_0x556c5c[_0xef3b('0x30')]['includeAll']){_0x2b073b[_0xef3b('0x3f')]=[{'all':!![]}];}return db[_0xef3b('0x2c')]['findAll'](_0x2b073b);})['then'](function(_0x51fb51){_0x187d1b[_0xef3b('0x40')]=_0x51fb51;return _0x187d1b;})['then'](respondWithFilteredResult(_0xded00b,_0x2b073b))[_0xef3b('0x41')](handleError(_0xded00b,null));};exports['show']=function(_0x4b2230,_0x516d08){var _0x5cec25={'raw':!![],'where':{'id':_0x4b2230['params']['id']}},_0x48699a={};_0x48699a['model']=_[_0xef3b('0x31')](db[_0xef3b('0x2c')][_0xef3b('0x42')]);_0x48699a['query']=_['keys'](_0x4b2230[_0xef3b('0x30')]);_0x48699a[_0xef3b('0x3a')]=_[_0xef3b('0x32')](_0x48699a[_0xef3b('0x35')],_0x48699a['query']);_0x5cec25[_0xef3b('0x33')]=_['intersection'](_0x48699a[_0xef3b('0x35')],qs[_0xef3b('0x34')](_0x4b2230[_0xef3b('0x30')][_0xef3b('0x34')]));_0x5cec25[_0xef3b('0x33')]=_0x5cec25['attributes'][_0xef3b('0x43')]?_0x5cec25[_0xef3b('0x33')]:_0x48699a[_0xef3b('0x35')];if(_0x4b2230[_0xef3b('0x30')][_0xef3b('0x44')]){_0x5cec25[_0xef3b('0x3f')]=[{'all':!![]}];}_0x5cec25=_[_0xef3b('0x3d')]({},_0x5cec25,_0x4b2230[_0xef3b('0x3e')]);return db[_0xef3b('0x2c')]['find'](_0x5cec25)[_0xef3b('0x25')](handleEntityNotFound(_0x516d08,null))[_0xef3b('0x25')](respondWithResult(_0x516d08,null))[_0xef3b('0x41')](handleError(_0x516d08,null));};exports['create']=function(_0x3f3e8b,_0x5d48c8){return db[_0xef3b('0x2c')][_0xef3b('0x45')](_0x3f3e8b[_0xef3b('0x46')],{})['then'](respondWithResult(_0x5d48c8,0xc9))['catch'](handleError(_0x5d48c8,null));};exports[_0xef3b('0x23')]=function(_0x38ee41,_0x4b368c){if(_0x38ee41[_0xef3b('0x46')]['id']){delete _0x38ee41[_0xef3b('0x46')]['id'];}return db[_0xef3b('0x2c')][_0xef3b('0x47')]({'where':{'id':_0x38ee41['params']['id']}})[_0xef3b('0x25')](handleEntityNotFound(_0x4b368c,null))[_0xef3b('0x25')](saveUpdates(_0x38ee41[_0xef3b('0x46')],null))[_0xef3b('0x25')](respondWithResult(_0x4b368c,null))[_0xef3b('0x41')](handleError(_0x4b368c,null));};exports[_0xef3b('0x24')]=function(_0x5e66fe,_0x2f45b1){return db[_0xef3b('0x2c')][_0xef3b('0x47')]({'where':{'id':_0x5e66fe[_0xef3b('0x48')]['id']}})[_0xef3b('0x25')](handleEntityNotFound(_0x2f45b1,null))[_0xef3b('0x25')](removeEntity(_0x2f45b1,null))[_0xef3b('0x41')](handleError(_0x2f45b1,null));};exports[_0xef3b('0x49')]=function(_0x3995b9,_0xf30f16){return db[_0xef3b('0x2c')][_0xef3b('0x49')]()[_0xef3b('0x25')](respondWithResult(_0xf30f16,null))['catch'](handleError(_0xf30f16,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a6fd4e8..f419675 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71bf=['report_jscripty_answers','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x71bf,0x153));var _0xf71b=function(_0x20634c,_0x5534fc){_0x20634c=_0x20634c-0x0;var _0x5d8936=_0x71bf[_0x20634c];return _0x5d8936;};'use strict';var _=require('lodash');var util=require(_0xf71b('0x0'));var logger=require(_0xf71b('0x1'))(_0xf71b('0x2'));var moment=require(_0xf71b('0x3'));var BPromise=require(_0xf71b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf71b('0x5'));var rimraf=require(_0xf71b('0x6'));var config=require(_0xf71b('0x7'));var attributes=require(_0xf71b('0x8'));module[_0xf71b('0x9')]=function(_0x459c27,_0x2aa391){return _0x459c27[_0xf71b('0xa')](_0xf71b('0xb'),attributes,{'tableName':_0xf71b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f1c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','util'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x2f1c,0x173));var _0xc2f1=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x2f1c[_0x146484];return _0x4c7aa3;};'use strict';var _=require('lodash');var util=require(_0xc2f1('0x0'));var logger=require(_0xc2f1('0x1'))(_0xc2f1('0x2'));var moment=require('moment');var BPromise=require(_0xc2f1('0x3'));var rp=require(_0xc2f1('0x4'));var fs=require('fs');var path=require(_0xc2f1('0x5'));var rimraf=require(_0xc2f1('0x6'));var config=require(_0xc2f1('0x7'));var attributes=require(_0xc2f1('0x8'));module[_0xc2f1('0x9')]=function(_0x385a5c,_0x356f32){return _0x385a5c['define'](_0xc2f1('0xa'),attributes,{'tableName':_0xc2f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index fa763e5..6351574 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22cb=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x2cdd4d,_0x394c2f){var _0x55cbc8=function(_0x3b92cb){while(--_0x3b92cb){_0x2cdd4d['push'](_0x2cdd4d['shift']());}};_0x55cbc8(++_0x394c2f);}(_0x22cb,0x1e9));var _0xb22c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x22cb[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xb22c('0x0'));var util=require(_0xb22c('0x1'));var moment=require(_0xb22c('0x2'));var BPromise=require(_0xb22c('0x3'));var rs=require(_0xb22c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb22c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb22c('0x6'))(_0xb22c('0x7'));var config=require(_0xb22c('0x8'));var jayson=require(_0xb22c('0x9'));var client=jayson[_0xb22c('0xa')][_0xb22c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x444aeb,_0x5243f9,_0x239052){return new BPromise(function(_0x5ecc4f,_0x14e224){return client[_0xb22c('0xc')](_0x444aeb,_0x239052)['then'](function(_0x4354f9){logger[_0xb22c('0xd')](_0xb22c('0xe'),_0x5243f9,_0xb22c('0xf'));logger['debug'](_0xb22c('0x10'),_0x5243f9,_0xb22c('0xf'),JSON[_0xb22c('0x11')](_0x4354f9));if(_0x4354f9[_0xb22c('0x12')]){if(_0x4354f9[_0xb22c('0x12')]['code']===0x1f4){logger[_0xb22c('0x12')](_0xb22c('0xe'),_0x5243f9,_0x4354f9[_0xb22c('0x12')][_0xb22c('0x13')]);return _0x14e224(_0x4354f9[_0xb22c('0x12')][_0xb22c('0x13')]);}logger[_0xb22c('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5243f9,_0x4354f9['error'][_0xb22c('0x13')]);return _0x5ecc4f(_0x4354f9[_0xb22c('0x12')]['message']);}else{logger['info'](_0xb22c('0xe'),_0x5243f9,_0xb22c('0xf'));_0x5ecc4f(_0x4354f9[_0xb22c('0x14')][_0xb22c('0x13')]);}})[_0xb22c('0x15')](function(_0x50f4c9){logger[_0xb22c('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5243f9,_0x50f4c9);_0x14e224(_0x50f4c9);});});} \ No newline at end of file +var _0x59ea=['http','request','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x59ea,0x101));var _0xa59e=function(_0x13ce02,_0x21f749){_0x13ce02=_0x13ce02-0x0;var _0x3ca2a1=_0x59ea[_0x13ce02];return _0x3ca2a1;};'use strict';var _=require('lodash');var util=require(_0xa59e('0x0'));var moment=require(_0xa59e('0x1'));var BPromise=require(_0xa59e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa59e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa59e('0x4'))(_0xa59e('0x5'));var config=require(_0xa59e('0x6'));var jayson=require(_0xa59e('0x7'));var client=jayson[_0xa59e('0x8')][_0xa59e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bb728,_0xf7665b,_0x15f325){return new BPromise(function(_0x192aa5,_0x25dc22){return client[_0xa59e('0xa')](_0x3bb728,_0x15f325)['then'](function(_0x458330){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0xf7665b,_0xa59e('0xb'));logger['debug'](_0xa59e('0xc'),_0xf7665b,_0xa59e('0xb'),JSON[_0xa59e('0xd')](_0x458330));if(_0x458330[_0xa59e('0xe')]){if(_0x458330[_0xa59e('0xe')][_0xa59e('0xf')]===0x1f4){logger[_0xa59e('0xe')](_0xa59e('0x10'),_0xf7665b,_0x458330[_0xa59e('0xe')][_0xa59e('0x11')]);return _0x25dc22(_0x458330['error']['message']);}logger[_0xa59e('0xe')](_0xa59e('0x10'),_0xf7665b,_0x458330[_0xa59e('0xe')]['message']);return _0x192aa5(_0x458330[_0xa59e('0xe')][_0xa59e('0x11')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0xf7665b,_0xa59e('0xb'));_0x192aa5(_0x458330['result']['message']);}})[_0xa59e('0x12')](function(_0xb47b2d){logger[_0xa59e('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf7665b,_0xb47b2d);_0x25dc22(_0xb47b2d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3f53f3d..f1f73a6 100644 --- a/server/api/jscriptyProject/index.js +++ b/server/api/jscriptyProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe50c=['index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated'];(function(_0x5dd2e7,_0x373046){var _0x1828c4=function(_0xa34e27){while(--_0xa34e27){_0x5dd2e7['push'](_0x5dd2e7['shift']());}};_0x1828c4(++_0x373046);}(_0xe50c,0xfe));var _0xce50=function(_0x35a12e,_0x41f3ef){_0x35a12e=_0x35a12e-0x0;var _0x319781=_0xe50c[_0x35a12e];return _0x319781;};'use strict';var multer=require(_0xce50('0x0'));var util=require(_0xce50('0x1'));var path=require(_0xce50('0x2'));var timeout=require('connect-timeout');var express=require(_0xce50('0x3'));var router=express[_0xce50('0x4')]();var fs_extra=require(_0xce50('0x5'));var auth=require(_0xce50('0x6'));var interaction=require(_0xce50('0x7'));var config=require('../../config/environment');var controller=require(_0xce50('0x8'));router['get']('/',auth[_0xce50('0x9')](),controller[_0xce50('0xa')]);router[_0xce50('0xb')](_0xce50('0xc'),auth[_0xce50('0x9')](),controller[_0xce50('0xd')]);router[_0xce50('0xb')](_0xce50('0xe'),auth['isAuthenticated'](),controller[_0xce50('0xf')]);router[_0xce50('0xb')](_0xce50('0x10'),auth[_0xce50('0x9')](),controller['getAnswers']);router[_0xce50('0xb')](_0xce50('0x11'),auth[_0xce50('0x9')](),timeout('30s'),controller['getSummary']);router[_0xce50('0x12')]('/',auth['isAuthenticated'](),controller[_0xce50('0x13')]);router[_0xce50('0x12')]('/:id/clone',auth[_0xce50('0x9')](),controller['clone']);router[_0xce50('0x14')](_0xce50('0xc'),auth[_0xce50('0x9')](),controller[_0xce50('0x15')]);router['delete'](_0xce50('0xc'),auth[_0xce50('0x9')](),controller[_0xce50('0x16')]);module[_0xce50('0x17')]=router; \ No newline at end of file +var _0x7d0e=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','clone','put','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7d0e,0x78));var _0xe7d0=function(_0x3f9aef,_0x261f25){_0x3f9aef=_0x3f9aef-0x0;var _0x9efef2=_0x7d0e[_0x3f9aef];return _0x9efef2;};'use strict';var multer=require(_0xe7d0('0x0'));var util=require(_0xe7d0('0x1'));var path=require('path');var timeout=require(_0xe7d0('0x2'));var express=require(_0xe7d0('0x3'));var router=express[_0xe7d0('0x4')]();var fs_extra=require(_0xe7d0('0x5'));var auth=require(_0xe7d0('0x6'));var interaction=require(_0xe7d0('0x7'));var config=require('../../config/environment');var controller=require(_0xe7d0('0x8'));router['get']('/',auth[_0xe7d0('0x9')](),controller[_0xe7d0('0xa')]);router[_0xe7d0('0xb')](_0xe7d0('0xc'),auth[_0xe7d0('0x9')](),controller[_0xe7d0('0xd')]);router['get']('/:id/sessions',auth[_0xe7d0('0x9')](),controller[_0xe7d0('0xe')]);router[_0xe7d0('0xb')](_0xe7d0('0xf'),auth[_0xe7d0('0x9')](),controller[_0xe7d0('0x10')]);router[_0xe7d0('0xb')]('/:id/summary',auth[_0xe7d0('0x9')](),timeout(_0xe7d0('0x11')),controller[_0xe7d0('0x12')]);router[_0xe7d0('0x13')]('/',auth[_0xe7d0('0x9')](),controller[_0xe7d0('0x14')]);router[_0xe7d0('0x13')]('/:id/clone',auth[_0xe7d0('0x9')](),controller[_0xe7d0('0x15')]);router[_0xe7d0('0x16')]('/:id',auth[_0xe7d0('0x9')](),controller['update']);router[_0xe7d0('0x17')](_0xe7d0('0xc'),auth[_0xe7d0('0x9')](),controller[_0xe7d0('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 81efa59..9dd1bdb 100644 --- a/server/api/jscriptyProject/jscriptyProject.attributes.js +++ b/server/api/jscriptyProject/jscriptyProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83bc=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','lodash','exports','STRING','isObjectLike','setDataValue','formData','stringify'];(function(_0x3d512b,_0x5e890e){var _0x406f5b=function(_0x2058ea){while(--_0x2058ea){_0x3d512b['push'](_0x3d512b['shift']());}};_0x406f5b(++_0x5e890e);}(_0x83bc,0x1b5));var _0xc83b=function(_0x941166,_0x2d67e0){_0x941166=_0x941166-0x0;var _0x2f9791=_0x83bc[_0x941166];return _0x2f9791;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc83b('0x0'));var util=require('util');module[_0xc83b('0x1')]={'name':{'type':Sequelize[_0xc83b('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xc83b('0x2')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x2003a3){if(_[_0xc83b('0x3')](_0x2003a3)){this[_0xc83b('0x4')](_0xc83b('0x5'),JSON[_0xc83b('0x6')](_0x2003a3));}else if(_[_0xc83b('0x7')](_0x2003a3)){this['setDataValue'](_0xc83b('0x5'),_0x2003a3);}else{this[_0xc83b('0x4')](_0xc83b('0x5'),util[_0xc83b('0x8')](_0xc83b('0x9'),this[_0xc83b('0xa')]('name')||'',this[_0xc83b('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc83b('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x1328=['formData','stringify','isString','setDataValue','format','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','long'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x1328,0x1cb));var _0x8132=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x1328[_0x179e11];return _0x549f04;};'use strict';var Sequelize=require(_0x8132('0x0'));var _=require(_0x8132('0x1'));var util=require(_0x8132('0x2'));module[_0x8132('0x3')]={'name':{'type':Sequelize[_0x8132('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x8132('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x8132('0x5')),'set':function(_0x14671f){if(_['isObjectLike'](_0x14671f)){this['setDataValue'](_0x8132('0x6'),JSON[_0x8132('0x7')](_0x14671f));}else if(_[_0x8132('0x8')](_0x14671f)){this[_0x8132('0x9')]('formData',_0x14671f);}else{this[_0x8132('0x9')](_0x8132('0x6'),util[_0x8132('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x8132('0xb')](_0x8132('0xc'))||'',this[_0x8132('0xb')](_0x8132('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8132('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8132('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index b0879b1..7d0a272 100644 --- a/server/api/jscriptyProject/jscriptyProject.controller.js +++ b/server/api/jscriptyProject/jscriptyProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc6d=['zip-dir','fast-json-patch','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','Projects','UserProfileResource','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','JscriptyProject','includeAll','findAll','catch','show','params','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf'];(function(_0x87171,_0xecb843){var _0x288606=function(_0xfb4bb5){while(--_0xfb4bb5){_0x87171['push'](_0x87171['shift']());}};_0x288606(++_0xecb843);}(_0xfc6d,0x1e6));var _0xdfc6=function(_0x49ed85,_0x4b256d){_0x49ed85=_0x49ed85-0x0;var _0x2d4ebf=_0xfc6d[_0x49ed85];return _0x2d4ebf;};'use strict';var emlformat=require(_0xdfc6('0x0'));var rimraf=require(_0xdfc6('0x1'));var zipdir=require(_0xdfc6('0x2'));var jsonpatch=require(_0xdfc6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdfc6('0x4'));var Mustache=require('mustache');var util=require(_0xdfc6('0x5'));var path=require(_0xdfc6('0x6'));var sox=require('sox');var csv=require(_0xdfc6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfc6('0x8'));var _=require(_0xdfc6('0x9'));var squel=require(_0xdfc6('0xa'));var crypto=require(_0xdfc6('0xb'));var jsforce=require(_0xdfc6('0xc'));var deskjs=require(_0xdfc6('0xd'));var toCsv=require(_0xdfc6('0x7'));var querystring=require(_0xdfc6('0xe'));var Papa=require(_0xdfc6('0xf'));var Redis=require(_0xdfc6('0x10'));var authService=require(_0xdfc6('0x11'));var qs=require(_0xdfc6('0x12'));var as=require(_0xdfc6('0x13'));var hardwareService=require(_0xdfc6('0x14'));var logger=require(_0xdfc6('0x15'))('api');var utils=require(_0xdfc6('0x16'));var config=require(_0xdfc6('0x17'));var licenseUtil=require(_0xdfc6('0x18'));var db=require(_0xdfc6('0x19'))['db'];function respondWithStatusCode(_0x4c1cf8,_0x40f810){_0x40f810=_0x40f810||0xcc;return function(_0x1d6533){if(_0x1d6533){return _0x4c1cf8[_0xdfc6('0x1a')](_0x40f810);}return _0x4c1cf8[_0xdfc6('0x1b')](_0x40f810)[_0xdfc6('0x1c')]();};}function respondWithResult(_0x213496,_0x1f8fd0){_0x1f8fd0=_0x1f8fd0||0xc8;return function(_0x195fdf){if(_0x195fdf){return _0x213496[_0xdfc6('0x1b')](_0x1f8fd0)[_0xdfc6('0x1d')](_0x195fdf);}};}function respondWithFilteredResult(_0x376309,_0x9ff209){return function(_0x5b9873){if(_0x5b9873){var _0x40472a=typeof _0x9ff209[_0xdfc6('0x1e')]===_0xdfc6('0x1f')&&typeof _0x9ff209[_0xdfc6('0x20')]===_0xdfc6('0x1f');var _0x39f856=_0x5b9873[_0xdfc6('0x21')];var _0x1762b5=_0x40472a?0x0:_0x9ff209[_0xdfc6('0x1e')];var _0xde1571=_0x40472a?_0x5b9873['count']:_0x9ff209[_0xdfc6('0x1e')]+_0x9ff209['limit'];var _0x111852;if(_0xde1571>=_0x39f856){_0xde1571=_0x39f856;_0x111852=0xc8;}else{_0x111852=0xce;}_0x376309[_0xdfc6('0x1b')](_0x111852);return _0x376309[_0xdfc6('0x22')]('Content-Range',_0x1762b5+'-'+_0xde1571+'/'+_0x39f856)[_0xdfc6('0x1d')](_0x5b9873);}return null;};}function patchUpdates(_0x2a283d){return function(_0x48f04a){try{jsonpatch[_0xdfc6('0x23')](_0x48f04a,_0x2a283d,!![]);}catch(_0x21faba){return BPromise[_0xdfc6('0x24')](_0x21faba);}return _0x48f04a[_0xdfc6('0x25')]();};}function saveUpdates(_0x443992,_0x389bb6){return function(_0x5e614c){if(_0x5e614c){return _0x5e614c[_0xdfc6('0x26')](_0x443992)['then'](function(_0x233cc5){return _0x233cc5;});}return null;};}function removeEntity(_0x1b532f,_0x240fa6){return function(_0x231e6f){if(_0x231e6f){return _0x231e6f[_0xdfc6('0x27')]()['then'](function(){var _0xb421c8=_0x231e6f[_0xdfc6('0x28')]({'plain':!![]});var _0x393d0f=_0xdfc6('0x29');return db[_0xdfc6('0x2a')]['destroy']({'where':{'type':_0x393d0f,'resourceId':_0xb421c8['id']}})[_0xdfc6('0x2b')](function(){return _0x231e6f;});})['then'](function(){_0x1b532f['status'](0xcc)[_0xdfc6('0x1c')]();});}};}function handleEntityNotFound(_0x4e8566,_0x53ce6c){return function(_0x7bc143){if(!_0x7bc143){_0x4e8566[_0xdfc6('0x1a')](0x194);}return _0x7bc143;};}function handleError(_0x57df3f,_0x45d59f){_0x45d59f=_0x45d59f||0x1f4;return function(_0x4a9d6c){logger[_0xdfc6('0x2c')](_0x4a9d6c[_0xdfc6('0x2d')]);if(_0x4a9d6c['name']){delete _0x4a9d6c[_0xdfc6('0x2e')];}_0x57df3f['status'](_0x45d59f)['send'](_0x4a9d6c);};}exports[_0xdfc6('0x2f')]=function(_0x4b3777,_0x26ced3){var _0x2f6993={},_0x5e337b={},_0x1677ff={'count':0x0,'rows':[]};var _0x55badc=_[_0xdfc6('0x30')](db['JscriptyProject'][_0xdfc6('0x31')],function(_0x10fab0){return{'name':_0x10fab0[_0xdfc6('0x32')],'type':_0x10fab0[_0xdfc6('0x33')]['key']};});_0x5e337b[_0xdfc6('0x34')]=_[_0xdfc6('0x30')](_0x55badc,_0xdfc6('0x2e'));_0x5e337b[_0xdfc6('0x35')]=_[_0xdfc6('0x36')](_0x4b3777[_0xdfc6('0x35')]);_0x5e337b[_0xdfc6('0x37')]=_[_0xdfc6('0x38')](_0x5e337b[_0xdfc6('0x34')],_0x5e337b['query']);_0x2f6993['attributes']=_[_0xdfc6('0x38')](_0x5e337b['model'],qs[_0xdfc6('0x39')](_0x4b3777[_0xdfc6('0x35')][_0xdfc6('0x39')]));_0x2f6993[_0xdfc6('0x3a')]=_0x2f6993[_0xdfc6('0x3a')][_0xdfc6('0x3b')]?_0x2f6993[_0xdfc6('0x3a')]:_0x5e337b[_0xdfc6('0x34')];if(!_0x4b3777[_0xdfc6('0x35')][_0xdfc6('0x3c')](_0xdfc6('0x3d'))){_0x2f6993[_0xdfc6('0x20')]=qs[_0xdfc6('0x20')](_0x4b3777[_0xdfc6('0x35')]['limit']);_0x2f6993['offset']=qs[_0xdfc6('0x1e')](_0x4b3777[_0xdfc6('0x35')][_0xdfc6('0x1e')]);}_0x2f6993[_0xdfc6('0x3e')]=qs['sort'](_0x4b3777[_0xdfc6('0x35')][_0xdfc6('0x3f')]);_0x2f6993[_0xdfc6('0x40')]=qs[_0xdfc6('0x37')](_['pick'](_0x4b3777[_0xdfc6('0x35')],_0x5e337b['filters']),_0x55badc);if(_0x4b3777[_0xdfc6('0x35')][_0xdfc6('0x41')]){_0x2f6993['where']=_['merge'](_0x2f6993[_0xdfc6('0x40')],{'$or':_[_0xdfc6('0x30')](_0x55badc,function(_0x302b13){if(_0x302b13[_0xdfc6('0x33')]!==_0xdfc6('0x42')){var _0x54a790={};_0x54a790[_0x302b13[_0xdfc6('0x2e')]]={'$like':'%'+_0x4b3777['query'][_0xdfc6('0x41')]+'%'};return _0x54a790;}})});}_0x2f6993=_[_0xdfc6('0x43')]({},_0x2f6993,_0x4b3777[_0xdfc6('0x44')]);var _0x5587ad={'where':_0x2f6993[_0xdfc6('0x40')]};return db[_0xdfc6('0x45')][_0xdfc6('0x21')](_0x5587ad)[_0xdfc6('0x2b')](function(_0x1c7342){_0x1677ff[_0xdfc6('0x21')]=_0x1c7342;if(_0x4b3777[_0xdfc6('0x35')][_0xdfc6('0x46')]){_0x2f6993['include']=[{'all':!![]}];}return db[_0xdfc6('0x45')][_0xdfc6('0x47')](_0x2f6993);})[_0xdfc6('0x2b')](function(_0x25aa69){_0x1677ff['rows']=_0x25aa69;return _0x1677ff;})[_0xdfc6('0x2b')](respondWithFilteredResult(_0x26ced3,_0x2f6993))[_0xdfc6('0x48')](handleError(_0x26ced3,null));};exports[_0xdfc6('0x49')]=function(_0x260d1f,_0x1662b8){var _0x355a20={'raw':![],'where':{'id':_0x260d1f[_0xdfc6('0x4a')]['id']}},_0x442714={};_0x442714['model']=_[_0xdfc6('0x36')](db['JscriptyProject']['rawAttributes']);_0x442714[_0xdfc6('0x35')]=_[_0xdfc6('0x36')](_0x260d1f['query']);_0x442714[_0xdfc6('0x37')]=_[_0xdfc6('0x38')](_0x442714[_0xdfc6('0x34')],_0x442714[_0xdfc6('0x35')]);_0x355a20[_0xdfc6('0x3a')]=_['intersection'](_0x442714[_0xdfc6('0x34')],qs['fields'](_0x260d1f[_0xdfc6('0x35')][_0xdfc6('0x39')]));_0x355a20['attributes']=_0x355a20[_0xdfc6('0x3a')][_0xdfc6('0x3b')]?_0x355a20[_0xdfc6('0x3a')]:_0x442714[_0xdfc6('0x34')];if(_0x260d1f['query'][_0xdfc6('0x46')]){_0x355a20[_0xdfc6('0x4b')]=[{'all':!![]}];}_0x355a20=_[_0xdfc6('0x43')]({},_0x355a20,_0x260d1f[_0xdfc6('0x44')]);return db[_0xdfc6('0x45')][_0xdfc6('0x4c')](_0x355a20)[_0xdfc6('0x2b')](handleEntityNotFound(_0x1662b8,null))['then'](respondWithResult(_0x1662b8,null))['catch'](handleError(_0x1662b8,null));};exports[_0xdfc6('0x4d')]=function(_0x9734d,_0x144e02){return db['JscriptyProject'][_0xdfc6('0x4d')](_0x9734d[_0xdfc6('0x4e')],{})[_0xdfc6('0x2b')](function(_0x7917bb){var _0x3850d3=_0x9734d[_0xdfc6('0x4f')][_0xdfc6('0x28')]({'plain':!![]});if(!_0x3850d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3850d3[_0xdfc6('0x50')]===_0xdfc6('0x4f')){var _0x2fc65b=_0x7917bb[_0xdfc6('0x28')]({'plain':!![]});var _0x10132f=_0xdfc6('0x29');return db[_0xdfc6('0x51')][_0xdfc6('0x4c')]({'where':{'name':_0x10132f,'userProfileId':_0x3850d3[_0xdfc6('0x52')]},'raw':!![]})['then'](function(_0x34b25a){if(_0x34b25a&&_0x34b25a[_0xdfc6('0x53')]===0x0){return db[_0xdfc6('0x2a')][_0xdfc6('0x4d')]({'name':_0x2fc65b[_0xdfc6('0x2e')],'resourceId':_0x2fc65b['id'],'type':_0x34b25a[_0xdfc6('0x2e')],'sectionId':_0x34b25a['id']},{})[_0xdfc6('0x2b')](function(){return _0x7917bb;});}else{return _0x7917bb;}})[_0xdfc6('0x48')](function(_0x10f8bc){logger[_0xdfc6('0x2c')](_0xdfc6('0x54'),_0x10f8bc);throw _0x10f8bc;});}return _0x7917bb;})[_0xdfc6('0x2b')](respondWithResult(_0x144e02,0xc9))[_0xdfc6('0x48')](handleError(_0x144e02,null));};exports[_0xdfc6('0x55')]=function(_0x3f0aa9,_0xe94724){var _0x143424={'where':{'id':_0x3f0aa9[_0xdfc6('0x4a')]['id']}},_0x37e791={};_0x37e791[_0xdfc6('0x34')]=_['keys'](db[_0xdfc6('0x45')][_0xdfc6('0x31')]);_0x143424[_0xdfc6('0x3a')]=_[_0xdfc6('0x38')](_0x37e791[_0xdfc6('0x34')],qs[_0xdfc6('0x39')](_0x3f0aa9[_0xdfc6('0x35')][_0xdfc6('0x39')]));_0x143424[_0xdfc6('0x3a')]=_0x143424['attributes']['length']?_0x143424[_0xdfc6('0x3a')]:_0x37e791[_0xdfc6('0x34')];if(_0x3f0aa9['query'][_0xdfc6('0x46')]){_0x143424[_0xdfc6('0x4b')]=[{'all':!![]}];}_0x143424=_['merge']({},_0x143424,_0x3f0aa9['options']);return db['JscriptyProject']['find'](_0x143424)[_0xdfc6('0x2b')](handleEntityNotFound(_0xe94724,null))[_0xdfc6('0x2b')](function(_0x2f6e90){if(_0x2f6e90){var _0x1db45c=_0x2f6e90[_0xdfc6('0x28')]({'plain':!![]});_0x1db45c=qs[_0xdfc6('0x56')](_0x1db45c,['id',_0xdfc6('0x57'),_0xdfc6('0x58')]);_0x3f0aa9[_0xdfc6('0x4e')]=_[_0xdfc6('0x56')](_0x3f0aa9[_0xdfc6('0x4e')],['id','createdAt','updatedAt']);return db[_0xdfc6('0x45')]['create'](_['merge'](_0x1db45c,_0x3f0aa9[_0xdfc6('0x4e')]),{'include':_0x3f0aa9['query'][_0xdfc6('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x5040e2){var _0x3489bb=_0x3f0aa9[_0xdfc6('0x4f')][_0xdfc6('0x28')]({'plain':!![]});if(!_0x3489bb)throw new Error(_0xdfc6('0x59'));if(_0x3489bb[_0xdfc6('0x50')]===_0xdfc6('0x4f')){var _0xdeec3=_0x5040e2[_0xdfc6('0x28')]({'plain':!![]});var _0x2b54ff=_0xdfc6('0x29');return db[_0xdfc6('0x51')][_0xdfc6('0x4c')]({'where':{'name':_0x2b54ff,'userProfileId':_0x3489bb[_0xdfc6('0x52')]},'raw':!![]})[_0xdfc6('0x2b')](function(_0xdd661d){if(_0xdd661d&&_0xdd661d[_0xdfc6('0x53')]===0x0){return db[_0xdfc6('0x2a')][_0xdfc6('0x4d')]({'name':_0xdeec3[_0xdfc6('0x2e')],'resourceId':_0xdeec3['id'],'type':_0xdd661d['name'],'sectionId':_0xdd661d['id']},{})[_0xdfc6('0x2b')](function(){return _0x5040e2;});}else{return _0x5040e2;}})[_0xdfc6('0x48')](function(_0x54e74d){logger[_0xdfc6('0x2c')](_0xdfc6('0x54'),_0x54e74d);throw _0x54e74d;});}return _0x5040e2;});}})['then'](respondWithResult(_0xe94724,0xc9))[_0xdfc6('0x48')](handleError(_0xe94724,null));};exports[_0xdfc6('0x26')]=function(_0x4022a8,_0x17d69){if(_0x4022a8[_0xdfc6('0x4e')]['id']){delete _0x4022a8['body']['id'];}return db[_0xdfc6('0x45')][_0xdfc6('0x4c')]({'where':{'id':_0x4022a8[_0xdfc6('0x4a')]['id']}})[_0xdfc6('0x2b')](handleEntityNotFound(_0x17d69,null))['then'](saveUpdates(_0x4022a8[_0xdfc6('0x4e')],null))[_0xdfc6('0x2b')](respondWithResult(_0x17d69,null))['catch'](handleError(_0x17d69,null));};exports[_0xdfc6('0x27')]=function(_0x4dda6,_0x2389ea){return db[_0xdfc6('0x45')][_0xdfc6('0x4c')]({'where':{'id':_0x4dda6[_0xdfc6('0x4a')]['id']}})[_0xdfc6('0x2b')](handleEntityNotFound(_0x2389ea,null))[_0xdfc6('0x2b')](removeEntity(_0x2389ea,null))['catch'](handleError(_0x2389ea,null));};exports[_0xdfc6('0x5a')]=function(_0x229a39,_0x3d7d32,_0x2d791f){var _0x4e58d6={'raw':!![],'where':{}};var _0xa0b24c={};var _0xd63c3d={'count':0x0,'rows':[]};return db[_0xdfc6('0x45')][_0xdfc6('0x5b')]({'where':{'id':_0x229a39[_0xdfc6('0x4a')]['id']}})[_0xdfc6('0x2b')](handleEntityNotFound(_0x3d7d32,null))[_0xdfc6('0x2b')](function(_0x9d37f5){if(_0x9d37f5){_0xa0b24c['model']=_['keys'](db[_0xdfc6('0x5c')]['rawAttributes']);_0xa0b24c[_0xdfc6('0x35')]=_['keys'](_0x229a39[_0xdfc6('0x35')]);_0xa0b24c[_0xdfc6('0x37')]=_[_0xdfc6('0x38')](_0xa0b24c['model'],_0xa0b24c['query']);_0x4e58d6[_0xdfc6('0x3a')]=_[_0xdfc6('0x38')](_0xa0b24c[_0xdfc6('0x34')],qs[_0xdfc6('0x39')](_0x229a39['query'][_0xdfc6('0x39')]));_0x4e58d6['attributes']=_0x4e58d6[_0xdfc6('0x3a')][_0xdfc6('0x3b')]?_0x4e58d6[_0xdfc6('0x3a')]:_0xa0b24c[_0xdfc6('0x34')];if(!_0x229a39[_0xdfc6('0x35')]['hasOwnProperty']('nolimit')){_0x4e58d6['limit']=qs[_0xdfc6('0x20')](_0x229a39[_0xdfc6('0x35')]['limit']);_0x4e58d6[_0xdfc6('0x1e')]=qs[_0xdfc6('0x1e')](_0x229a39[_0xdfc6('0x35')][_0xdfc6('0x1e')]);}_0x4e58d6[_0xdfc6('0x3e')]=qs[_0xdfc6('0x3f')](_0x229a39[_0xdfc6('0x35')][_0xdfc6('0x3f')]);_0x4e58d6[_0xdfc6('0x40')]=qs[_0xdfc6('0x37')](_[_0xdfc6('0x5d')](_0x229a39[_0xdfc6('0x35')],_0xa0b24c['filters']));_0x4e58d6[_0xdfc6('0x40')][_0xdfc6('0x5e')]=_0x9d37f5['id'];if(_0x229a39[_0xdfc6('0x35')]['filter']){_0x4e58d6['where']=_['merge'](_0x4e58d6[_0xdfc6('0x40')],{'$or':_['map'](_0x4e58d6[_0xdfc6('0x3a')],function(_0x4d588d){var _0x2f8d1d={};_0x2f8d1d[_0x4d588d]={'$like':'%'+_0x229a39['query'][_0xdfc6('0x41')]+'%'};return _0x2f8d1d;})});}_0x4e58d6=_['merge']({},_0x4e58d6,_0x229a39[_0xdfc6('0x44')]);return db['JscriptySessionReport'][_0xdfc6('0x21')]({'where':_0x4e58d6['where']})[_0xdfc6('0x2b')](function(_0x5708bb){_0xd63c3d[_0xdfc6('0x21')]=_0x5708bb;if(_0x229a39[_0xdfc6('0x35')][_0xdfc6('0x46')]){_0x4e58d6[_0xdfc6('0x4b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xdfc6('0x47')](_0x4e58d6);})['then'](function(_0x364fae){_0xd63c3d[_0xdfc6('0x5f')]=_0x364fae;return _0xd63c3d;});}})[_0xdfc6('0x2b')](respondWithFilteredResult(_0x3d7d32,_0x4e58d6))[_0xdfc6('0x48')](handleError(_0x3d7d32,null));};exports[_0xdfc6('0x60')]=function(_0x26a2f6,_0x2c15ed,_0x19a049){var _0x3c02b3={'raw':!![],'where':{}};var _0x534af5={};var _0x4e244d={'count':0x0,'rows':[]};return db[_0xdfc6('0x45')][_0xdfc6('0x5b')]({'where':{'id':_0x26a2f6[_0xdfc6('0x4a')]['id']}})[_0xdfc6('0x2b')](handleEntityNotFound(_0x2c15ed,null))['then'](function(_0x1b1454){if(_0x1b1454){_0x534af5[_0xdfc6('0x34')]=_[_0xdfc6('0x36')](db[_0xdfc6('0x61')][_0xdfc6('0x31')]);_0x534af5[_0xdfc6('0x35')]=_[_0xdfc6('0x36')](_0x26a2f6[_0xdfc6('0x35')]);_0x534af5[_0xdfc6('0x37')]=_[_0xdfc6('0x38')](_0x534af5['model'],_0x534af5[_0xdfc6('0x35')]);_0x3c02b3['attributes']=_['intersection'](_0x534af5[_0xdfc6('0x34')],qs[_0xdfc6('0x39')](_0x26a2f6[_0xdfc6('0x35')][_0xdfc6('0x39')]));_0x3c02b3[_0xdfc6('0x3a')]=_0x3c02b3[_0xdfc6('0x3a')][_0xdfc6('0x3b')]?_0x3c02b3[_0xdfc6('0x3a')]:_0x534af5[_0xdfc6('0x34')];if(!_0x26a2f6[_0xdfc6('0x35')]['hasOwnProperty']('nolimit')){_0x3c02b3[_0xdfc6('0x20')]=qs[_0xdfc6('0x20')](_0x26a2f6[_0xdfc6('0x35')][_0xdfc6('0x20')]);_0x3c02b3[_0xdfc6('0x1e')]=qs[_0xdfc6('0x1e')](_0x26a2f6[_0xdfc6('0x35')][_0xdfc6('0x1e')]);}_0x3c02b3[_0xdfc6('0x3e')]=qs['sort'](_0x26a2f6[_0xdfc6('0x35')][_0xdfc6('0x3f')]);_0x3c02b3['where']=qs[_0xdfc6('0x37')](_['pick'](_0x26a2f6['query'],_0x534af5[_0xdfc6('0x37')]));_0x3c02b3['where'][_0xdfc6('0x5e')]=_0x1b1454['id'];if(_0x26a2f6[_0xdfc6('0x35')][_0xdfc6('0x41')]){_0x3c02b3[_0xdfc6('0x40')]=_[_0xdfc6('0x43')](_0x3c02b3[_0xdfc6('0x40')],{'$or':_['map'](_0x3c02b3[_0xdfc6('0x3a')],function(_0x350a79){var _0x474496={};_0x474496[_0x350a79]={'$like':'%'+_0x26a2f6[_0xdfc6('0x35')][_0xdfc6('0x41')]+'%'};return _0x474496;})});}_0x3c02b3=_[_0xdfc6('0x43')]({},_0x3c02b3,_0x26a2f6[_0xdfc6('0x44')]);return db[_0xdfc6('0x61')]['count']({'where':_0x3c02b3[_0xdfc6('0x40')]})[_0xdfc6('0x2b')](function(_0x2774f8){_0x4e244d[_0xdfc6('0x21')]=_0x2774f8;if(_0x26a2f6['query']['includeAll']){_0x3c02b3[_0xdfc6('0x4b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xdfc6('0x47')](_0x3c02b3);})[_0xdfc6('0x2b')](function(_0x527a27){_0x4e244d[_0xdfc6('0x5f')]=_0x527a27;return _0x4e244d;});}})[_0xdfc6('0x2b')](respondWithFilteredResult(_0x2c15ed,_0x3c02b3))['catch'](handleError(_0x2c15ed,null));};function char(_0x51e414){return'number'===typeof _0x51e414?String['fromCharCode'][_0xdfc6('0x23')](null,arguments):_0x51e414;}function needsEncapsulation(_0x35f4bc){return!!_0x35f4bc&&(_0x35f4bc[_0xdfc6('0x62')]()['indexOf'](char(0xd))>=0x0||_0x35f4bc[_0xdfc6('0x62')]()['indexOf'](char(0xa))>=0x0||_0x35f4bc[_0xdfc6('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x35f4bc[_0xdfc6('0x62')]()[_0xdfc6('0x63')](char(0x22))>=0x0);}function encapsulate(_0x40352d){var _0x2b8c7c=char(0x22),_0x29dfb2='\x5c'+char(0x22),_0x2536dd=_0x40352d[_0xdfc6('0x62')]()[_0xdfc6('0x64')](new RegExp(_0x2b8c7c,'g'),_0x29dfb2);return _0x2b8c7c+_0x2536dd+_0x2b8c7c;}exports[_0xdfc6('0x65')]=function(_0x5362e7,_0x3359d,_0x4d5614){var _0x5bad7c,_0x8550d6;var _0x3ef86f={'where':{'ProjectId':_0x5362e7[_0xdfc6('0x4a')]['id']}};if(_0x5362e7['query'][_0xdfc6('0x66')]){_0x3ef86f[_0xdfc6('0x40')][_0xdfc6('0x67')]=JSON[_0xdfc6('0x68')](_0x5362e7['query']['startTime']);}return db['JscriptySessionReport'][_0xdfc6('0x47')](_0x3ef86f)[_0xdfc6('0x2b')](handleEntityNotFound(_0x3359d,null))[_0xdfc6('0x2b')](function(_0x23dc2c){if(_0x23dc2c){_0x5bad7c=_0x23dc2c;return db['JscriptyQuestionReport'][_0xdfc6('0x47')]({'where':{'SessionId':{'$in':_[_0xdfc6('0x30')](_0x5bad7c,'id')},'ProjectId':_0x5362e7['params']['id']},'order':_0xdfc6('0x69')});}})[_0xdfc6('0x2b')](handleEntityNotFound(_0x3359d,null))[_0xdfc6('0x2b')](function(_0x4a837d){if(_0x4a837d){_0x8550d6=_0x4a837d;var _0x5dcd3e={};for(var _0x214e3f=0x0,_0x4e5b3a=_0x8550d6['length'];_0x214e3f<_0x4e5b3a;_0x214e3f++){if(!_0x5dcd3e['hasOwnProperty'](_0x8550d6[_0x214e3f]['questionId'])){_0x5dcd3e[_0x8550d6[_0x214e3f]['questionId']]=needsEncapsulation(_0x8550d6[_0x214e3f]['question'])?encapsulate(_0x8550d6[_0x214e3f]['question']):_0x8550d6[_0x214e3f][_0xdfc6('0x6a')];}}var _0x7ad4d1=[],_0xfcb60a={};for(var _0xf18510=0x0,_0x386994=_0x5bad7c[_0xdfc6('0x3b')];_0xf18510<_0x386994;_0xf18510++){_0xfcb60a={'ProjectId':_0x5362e7[_0xdfc6('0x4a')]['id'],'SessionId':_0x5bad7c[_0xf18510]['id'],'StartTime':moment(_0x5bad7c[_0xf18510][_0xdfc6('0x67')])['format'](_0xdfc6('0x6b'))};for(var _0x40513b=0x0,_0x9524f5=_0x8550d6[_0xdfc6('0x3b')];_0x40513b<_0x9524f5;_0x40513b++){if(_0x8550d6[_0x40513b][_0xdfc6('0x6c')]==_0x5bad7c[_0xf18510]['id']&&_0x5dcd3e['hasOwnProperty'](_0x8550d6[_0x40513b][_0xdfc6('0x6d')])){_0xfcb60a[_0x5dcd3e[_0x8550d6[_0x40513b][_0xdfc6('0x6d')]]]=_0x8550d6[_0x40513b][_0xdfc6('0x6e')];}}for(var _0x1bb1fe in _0x5dcd3e){if(!_0xfcb60a[_0xdfc6('0x3c')](_0x5dcd3e[_0x1bb1fe])){_0xfcb60a[_0x5dcd3e[_0x1bb1fe]]=null;}}_0x7ad4d1[_0xdfc6('0x6f')](_0xfcb60a);}return _0x7ad4d1;}})[_0xdfc6('0x2b')](function(_0xc60e76){if(!_[_0xdfc6('0x70')](_0xc60e76)){var _0x4d021d=toCsv(_0xc60e76);var _0x3701f3=Date[_0xdfc6('0x71')]();fs['writeFileSync'](util[_0xdfc6('0x72')](_0xdfc6('0x73'),_0x5362e7[_0xdfc6('0x4a')]['id'],_0x3701f3),_0x4d021d);_0x3359d[_0xdfc6('0x74')](_0xdfc6('0x75'),_0xdfc6('0x76')+util[_0xdfc6('0x72')](_0xdfc6('0x77'),_0x5362e7[_0xdfc6('0x4a')]['id'],_0x3701f3));_0x3359d['setHeader'](_0xdfc6('0x78'),_0xdfc6('0x79'));return _0x3359d['download'](util[_0xdfc6('0x72')](_0xdfc6('0x73'),_0x5362e7[_0xdfc6('0x4a')]['id'],_0x3701f3));}else{return _0x3359d[_0xdfc6('0x1a')](0xcc);}})[_0xdfc6('0x48')](handleError(_0x3359d,null));}; \ No newline at end of file +var _0x25a9=['/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','rows','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','autoAssociation','params','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','now','writeFileSync'];(function(_0x2355b0,_0x44ea2d){var _0x487e7d=function(_0x1811da){while(--_0x1811da){_0x2355b0['push'](_0x2355b0['shift']());}};_0x487e7d(++_0x44ea2d);}(_0x25a9,0xf1));var _0x925a=function(_0x2d93d4,_0x149172){_0x2d93d4=_0x2d93d4-0x0;var _0x44df30=_0x25a9[_0x2d93d4];return _0x44df30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x925a('0x0'));var zipdir=require(_0x925a('0x1'));var jsonpatch=require(_0x925a('0x2'));var rp=require(_0x925a('0x3'));var moment=require(_0x925a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x925a('0x5'));var util=require(_0x925a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x925a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x925a('0x8'));var _=require(_0x925a('0x9'));var squel=require(_0x925a('0xa'));var crypto=require(_0x925a('0xb'));var jsforce=require(_0x925a('0xc'));var deskjs=require(_0x925a('0xd'));var toCsv=require(_0x925a('0x7'));var querystring=require('querystring');var Papa=require(_0x925a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x925a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x925a('0x10'))(_0x925a('0x11'));var utils=require(_0x925a('0x12'));var config=require(_0x925a('0x13'));var licenseUtil=require(_0x925a('0x14'));var db=require(_0x925a('0x15'))['db'];function respondWithStatusCode(_0x55552e,_0x22c673){_0x22c673=_0x22c673||0xcc;return function(_0x39df47){if(_0x39df47){return _0x55552e[_0x925a('0x16')](_0x22c673);}return _0x55552e[_0x925a('0x17')](_0x22c673)[_0x925a('0x18')]();};}function respondWithResult(_0x4bd135,_0x26e2c0){_0x26e2c0=_0x26e2c0||0xc8;return function(_0x530360){if(_0x530360){return _0x4bd135[_0x925a('0x17')](_0x26e2c0)[_0x925a('0x19')](_0x530360);}};}function respondWithFilteredResult(_0xf0efa7,_0x4639b1){return function(_0x494bc5){if(_0x494bc5){var _0xa915f0=typeof _0x4639b1[_0x925a('0x1a')]==='undefined'&&typeof _0x4639b1[_0x925a('0x1b')]===_0x925a('0x1c');var _0x3a08f0=_0x494bc5[_0x925a('0x1d')];var _0x54fa22=_0xa915f0?0x0:_0x4639b1[_0x925a('0x1a')];var _0x2643ad=_0xa915f0?_0x494bc5[_0x925a('0x1d')]:_0x4639b1[_0x925a('0x1a')]+_0x4639b1[_0x925a('0x1b')];var _0x517cef;if(_0x2643ad>=_0x3a08f0){_0x2643ad=_0x3a08f0;_0x517cef=0xc8;}else{_0x517cef=0xce;}_0xf0efa7['status'](_0x517cef);return _0xf0efa7[_0x925a('0x1e')](_0x925a('0x1f'),_0x54fa22+'-'+_0x2643ad+'/'+_0x3a08f0)['json'](_0x494bc5);}return null;};}function patchUpdates(_0x2abbdc){return function(_0x374dd0){try{jsonpatch[_0x925a('0x20')](_0x374dd0,_0x2abbdc,!![]);}catch(_0x34fec0){return BPromise[_0x925a('0x21')](_0x34fec0);}return _0x374dd0[_0x925a('0x22')]();};}function saveUpdates(_0x2a0f28,_0x3458d5){return function(_0x5a0683){if(_0x5a0683){return _0x5a0683[_0x925a('0x23')](_0x2a0f28)[_0x925a('0x24')](function(_0x2c3949){return _0x2c3949;});}return null;};}function removeEntity(_0x5be491,_0x3e8be6){return function(_0x6079b9){if(_0x6079b9){return _0x6079b9['destroy']()[_0x925a('0x24')](function(){var _0x550a27=_0x6079b9[_0x925a('0x25')]({'plain':!![]});var _0x30fb0e=_0x925a('0x26');return db[_0x925a('0x27')][_0x925a('0x28')]({'where':{'type':_0x30fb0e,'resourceId':_0x550a27['id']}})[_0x925a('0x24')](function(){return _0x6079b9;});})[_0x925a('0x24')](function(){_0x5be491[_0x925a('0x17')](0xcc)[_0x925a('0x18')]();});}};}function handleEntityNotFound(_0x159c0a,_0x47f8a8){return function(_0xb1a056){if(!_0xb1a056){_0x159c0a[_0x925a('0x16')](0x194);}return _0xb1a056;};}function handleError(_0x24d304,_0x417c7f){_0x417c7f=_0x417c7f||0x1f4;return function(_0x5cb909){logger[_0x925a('0x29')](_0x5cb909['stack']);if(_0x5cb909[_0x925a('0x2a')]){delete _0x5cb909['name'];}_0x24d304[_0x925a('0x17')](_0x417c7f)[_0x925a('0x2b')](_0x5cb909);};}exports[_0x925a('0x2c')]=function(_0x2ad0ca,_0x28e81b){var _0x156372={},_0x1c951b={},_0x34e311={'count':0x0,'rows':[]};var _0x5f289a=_[_0x925a('0x2d')](db['JscriptyProject'][_0x925a('0x2e')],function(_0x37e2f6){return{'name':_0x37e2f6[_0x925a('0x2f')],'type':_0x37e2f6['type'][_0x925a('0x30')]};});_0x1c951b[_0x925a('0x31')]=_[_0x925a('0x2d')](_0x5f289a,_0x925a('0x2a'));_0x1c951b[_0x925a('0x32')]=_[_0x925a('0x33')](_0x2ad0ca['query']);_0x1c951b[_0x925a('0x34')]=_[_0x925a('0x35')](_0x1c951b[_0x925a('0x31')],_0x1c951b[_0x925a('0x32')]);_0x156372['attributes']=_['intersection'](_0x1c951b[_0x925a('0x31')],qs[_0x925a('0x36')](_0x2ad0ca[_0x925a('0x32')]['fields']));_0x156372[_0x925a('0x37')]=_0x156372[_0x925a('0x37')][_0x925a('0x38')]?_0x156372[_0x925a('0x37')]:_0x1c951b['model'];if(!_0x2ad0ca['query'][_0x925a('0x39')](_0x925a('0x3a'))){_0x156372[_0x925a('0x1b')]=qs[_0x925a('0x1b')](_0x2ad0ca[_0x925a('0x32')][_0x925a('0x1b')]);_0x156372['offset']=qs[_0x925a('0x1a')](_0x2ad0ca['query']['offset']);}_0x156372[_0x925a('0x3b')]=qs[_0x925a('0x3c')](_0x2ad0ca['query'][_0x925a('0x3c')]);_0x156372[_0x925a('0x3d')]=qs['filters'](_[_0x925a('0x3e')](_0x2ad0ca['query'],_0x1c951b['filters']),_0x5f289a);if(_0x2ad0ca['query'][_0x925a('0x3f')]){_0x156372[_0x925a('0x3d')]=_[_0x925a('0x40')](_0x156372[_0x925a('0x3d')],{'$or':_[_0x925a('0x2d')](_0x5f289a,function(_0x19e801){if(_0x19e801['type']!==_0x925a('0x41')){var _0x1d8960={};_0x1d8960[_0x19e801[_0x925a('0x2a')]]={'$like':'%'+_0x2ad0ca[_0x925a('0x32')][_0x925a('0x3f')]+'%'};return _0x1d8960;}})});}_0x156372=_[_0x925a('0x40')]({},_0x156372,_0x2ad0ca[_0x925a('0x42')]);var _0x42e375={'where':_0x156372[_0x925a('0x3d')]};return db[_0x925a('0x43')][_0x925a('0x1d')](_0x42e375)[_0x925a('0x24')](function(_0x4e4d0c){_0x34e311['count']=_0x4e4d0c;if(_0x2ad0ca[_0x925a('0x32')][_0x925a('0x44')]){_0x156372[_0x925a('0x45')]=[{'all':!![]}];}return db['JscriptyProject'][_0x925a('0x46')](_0x156372);})[_0x925a('0x24')](function(_0x3d5365){_0x34e311[_0x925a('0x47')]=_0x3d5365;return _0x34e311;})['then'](respondWithFilteredResult(_0x28e81b,_0x156372))[_0x925a('0x48')](handleError(_0x28e81b,null));};exports['show']=function(_0x570296,_0x3aa159){var _0x3da366={'raw':![],'where':{'id':_0x570296['params']['id']}},_0x59a75e={};_0x59a75e[_0x925a('0x31')]=_['keys'](db['JscriptyProject'][_0x925a('0x2e')]);_0x59a75e[_0x925a('0x32')]=_[_0x925a('0x33')](_0x570296['query']);_0x59a75e[_0x925a('0x34')]=_[_0x925a('0x35')](_0x59a75e[_0x925a('0x31')],_0x59a75e[_0x925a('0x32')]);_0x3da366[_0x925a('0x37')]=_[_0x925a('0x35')](_0x59a75e[_0x925a('0x31')],qs[_0x925a('0x36')](_0x570296['query'][_0x925a('0x36')]));_0x3da366[_0x925a('0x37')]=_0x3da366[_0x925a('0x37')][_0x925a('0x38')]?_0x3da366[_0x925a('0x37')]:_0x59a75e['model'];if(_0x570296[_0x925a('0x32')][_0x925a('0x44')]){_0x3da366[_0x925a('0x45')]=[{'all':!![]}];}_0x3da366=_[_0x925a('0x40')]({},_0x3da366,_0x570296[_0x925a('0x42')]);return db[_0x925a('0x43')]['find'](_0x3da366)[_0x925a('0x24')](handleEntityNotFound(_0x3aa159,null))[_0x925a('0x24')](respondWithResult(_0x3aa159,null))[_0x925a('0x48')](handleError(_0x3aa159,null));};exports['create']=function(_0x1d1975,_0x22db0b){return db[_0x925a('0x43')]['create'](_0x1d1975['body'],{})['then'](function(_0x2d0355){var _0x1a1fba=_0x1d1975[_0x925a('0x49')][_0x925a('0x25')]({'plain':!![]});if(!_0x1a1fba)throw new Error(_0x925a('0x4a'));if(_0x1a1fba['role']===_0x925a('0x49')){var _0xe15d43=_0x2d0355[_0x925a('0x25')]({'plain':!![]});var _0x248376='Projects';return db[_0x925a('0x4b')][_0x925a('0x4c')]({'where':{'name':_0x248376,'userProfileId':_0x1a1fba[_0x925a('0x4d')]},'raw':!![]})[_0x925a('0x24')](function(_0x3031e5){if(_0x3031e5&&_0x3031e5['autoAssociation']===0x0){return db[_0x925a('0x27')][_0x925a('0x4e')]({'name':_0xe15d43[_0x925a('0x2a')],'resourceId':_0xe15d43['id'],'type':_0x3031e5['name'],'sectionId':_0x3031e5['id']},{})[_0x925a('0x24')](function(){return _0x2d0355;});}else{return _0x2d0355;}})[_0x925a('0x48')](function(_0x502fc4){logger[_0x925a('0x29')](_0x925a('0x4f'),_0x502fc4);throw _0x502fc4;});}return _0x2d0355;})[_0x925a('0x24')](respondWithResult(_0x22db0b,0xc9))['catch'](handleError(_0x22db0b,null));};exports[_0x925a('0x50')]=function(_0x5aa23a,_0x2bf8ee){var _0x379941={'where':{'id':_0x5aa23a['params']['id']}},_0x406f3e={};_0x406f3e['model']=_['keys'](db['JscriptyProject'][_0x925a('0x2e')]);_0x379941['attributes']=_[_0x925a('0x35')](_0x406f3e[_0x925a('0x31')],qs[_0x925a('0x36')](_0x5aa23a[_0x925a('0x32')][_0x925a('0x36')]));_0x379941[_0x925a('0x37')]=_0x379941[_0x925a('0x37')]['length']?_0x379941[_0x925a('0x37')]:_0x406f3e[_0x925a('0x31')];if(_0x5aa23a[_0x925a('0x32')][_0x925a('0x44')]){_0x379941[_0x925a('0x45')]=[{'all':!![]}];}_0x379941=_['merge']({},_0x379941,_0x5aa23a['options']);return db[_0x925a('0x43')][_0x925a('0x4c')](_0x379941)['then'](handleEntityNotFound(_0x2bf8ee,null))[_0x925a('0x24')](function(_0x40a08c){if(_0x40a08c){var _0x3fc611=_0x40a08c[_0x925a('0x25')]({'plain':!![]});_0x3fc611=qs[_0x925a('0x51')](_0x3fc611,['id','createdAt',_0x925a('0x52')]);_0x5aa23a['body']=_['omit'](_0x5aa23a[_0x925a('0x53')],['id',_0x925a('0x54'),'updatedAt']);return db[_0x925a('0x43')][_0x925a('0x4e')](_[_0x925a('0x40')](_0x3fc611,_0x5aa23a[_0x925a('0x53')]),{'include':_0x5aa23a[_0x925a('0x32')][_0x925a('0x44')]?[{'all':!![]}]:undefined})[_0x925a('0x24')](function(_0x9cfc25){var _0x181460=_0x5aa23a[_0x925a('0x49')][_0x925a('0x25')]({'plain':!![]});if(!_0x181460)throw new Error(_0x925a('0x4a'));if(_0x181460['role']===_0x925a('0x49')){var _0xe99b2a=_0x9cfc25['get']({'plain':!![]});var _0x26832d=_0x925a('0x26');return db['UserProfileSection'][_0x925a('0x4c')]({'where':{'name':_0x26832d,'userProfileId':_0x181460[_0x925a('0x4d')]},'raw':!![]})[_0x925a('0x24')](function(_0x1f7b30){if(_0x1f7b30&&_0x1f7b30[_0x925a('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0xe99b2a[_0x925a('0x2a')],'resourceId':_0xe99b2a['id'],'type':_0x1f7b30[_0x925a('0x2a')],'sectionId':_0x1f7b30['id']},{})['then'](function(){return _0x9cfc25;});}else{return _0x9cfc25;}})['catch'](function(_0x18e52e){logger[_0x925a('0x29')](_0x925a('0x4f'),_0x18e52e);throw _0x18e52e;});}return _0x9cfc25;});}})['then'](respondWithResult(_0x2bf8ee,0xc9))[_0x925a('0x48')](handleError(_0x2bf8ee,null));};exports[_0x925a('0x23')]=function(_0xcbda86,_0x2732f1){if(_0xcbda86['body']['id']){delete _0xcbda86[_0x925a('0x53')]['id'];}return db['JscriptyProject'][_0x925a('0x4c')]({'where':{'id':_0xcbda86[_0x925a('0x56')]['id']}})[_0x925a('0x24')](handleEntityNotFound(_0x2732f1,null))[_0x925a('0x24')](saveUpdates(_0xcbda86[_0x925a('0x53')],null))['then'](respondWithResult(_0x2732f1,null))[_0x925a('0x48')](handleError(_0x2732f1,null));};exports[_0x925a('0x28')]=function(_0x4da3b6,_0x1a6664){return db['JscriptyProject'][_0x925a('0x4c')]({'where':{'id':_0x4da3b6[_0x925a('0x56')]['id']}})[_0x925a('0x24')](handleEntityNotFound(_0x1a6664,null))[_0x925a('0x24')](removeEntity(_0x1a6664,null))[_0x925a('0x48')](handleError(_0x1a6664,null));};exports[_0x925a('0x57')]=function(_0x1d283a,_0xac7bca,_0x44bd9c){var _0x546b80={'raw':!![],'where':{}};var _0x6fcb91={};var _0x2ac150={'count':0x0,'rows':[]};return db[_0x925a('0x43')][_0x925a('0x58')]({'where':{'id':_0x1d283a['params']['id']}})[_0x925a('0x24')](handleEntityNotFound(_0xac7bca,null))[_0x925a('0x24')](function(_0x1850a6){if(_0x1850a6){_0x6fcb91[_0x925a('0x31')]=_[_0x925a('0x33')](db['JscriptySessionReport'][_0x925a('0x2e')]);_0x6fcb91[_0x925a('0x32')]=_[_0x925a('0x33')](_0x1d283a['query']);_0x6fcb91['filters']=_[_0x925a('0x35')](_0x6fcb91[_0x925a('0x31')],_0x6fcb91[_0x925a('0x32')]);_0x546b80[_0x925a('0x37')]=_['intersection'](_0x6fcb91[_0x925a('0x31')],qs[_0x925a('0x36')](_0x1d283a['query'][_0x925a('0x36')]));_0x546b80[_0x925a('0x37')]=_0x546b80[_0x925a('0x37')]['length']?_0x546b80['attributes']:_0x6fcb91[_0x925a('0x31')];if(!_0x1d283a[_0x925a('0x32')][_0x925a('0x39')](_0x925a('0x3a'))){_0x546b80[_0x925a('0x1b')]=qs[_0x925a('0x1b')](_0x1d283a[_0x925a('0x32')]['limit']);_0x546b80[_0x925a('0x1a')]=qs[_0x925a('0x1a')](_0x1d283a[_0x925a('0x32')][_0x925a('0x1a')]);}_0x546b80[_0x925a('0x3b')]=qs[_0x925a('0x3c')](_0x1d283a[_0x925a('0x32')]['sort']);_0x546b80['where']=qs[_0x925a('0x34')](_[_0x925a('0x3e')](_0x1d283a['query'],_0x6fcb91[_0x925a('0x34')]));_0x546b80['where']['ProjectId']=_0x1850a6['id'];if(_0x1d283a[_0x925a('0x32')]['filter']){_0x546b80[_0x925a('0x3d')]=_[_0x925a('0x40')](_0x546b80['where'],{'$or':_[_0x925a('0x2d')](_0x546b80[_0x925a('0x37')],function(_0x48173e){var _0x8befdb={};_0x8befdb[_0x48173e]={'$like':'%'+_0x1d283a[_0x925a('0x32')][_0x925a('0x3f')]+'%'};return _0x8befdb;})});}_0x546b80=_[_0x925a('0x40')]({},_0x546b80,_0x1d283a[_0x925a('0x42')]);return db[_0x925a('0x59')][_0x925a('0x1d')]({'where':_0x546b80[_0x925a('0x3d')]})['then'](function(_0x655d0){_0x2ac150[_0x925a('0x1d')]=_0x655d0;if(_0x1d283a['query']['includeAll']){_0x546b80[_0x925a('0x45')]=[{'all':!![]}];}return db[_0x925a('0x59')][_0x925a('0x46')](_0x546b80);})[_0x925a('0x24')](function(_0x110a1d){_0x2ac150[_0x925a('0x47')]=_0x110a1d;return _0x2ac150;});}})[_0x925a('0x24')](respondWithFilteredResult(_0xac7bca,_0x546b80))[_0x925a('0x48')](handleError(_0xac7bca,null));};exports[_0x925a('0x5a')]=function(_0x160ad8,_0x3d3550,_0x17b0ca){var _0x1c9884={'raw':!![],'where':{}};var _0x336b77={};var _0x5774e5={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x160ad8['params']['id']}})['then'](handleEntityNotFound(_0x3d3550,null))['then'](function(_0x256760){if(_0x256760){_0x336b77[_0x925a('0x31')]=_[_0x925a('0x33')](db[_0x925a('0x5b')][_0x925a('0x2e')]);_0x336b77['query']=_[_0x925a('0x33')](_0x160ad8[_0x925a('0x32')]);_0x336b77[_0x925a('0x34')]=_[_0x925a('0x35')](_0x336b77[_0x925a('0x31')],_0x336b77[_0x925a('0x32')]);_0x1c9884[_0x925a('0x37')]=_[_0x925a('0x35')](_0x336b77[_0x925a('0x31')],qs['fields'](_0x160ad8['query'][_0x925a('0x36')]));_0x1c9884['attributes']=_0x1c9884[_0x925a('0x37')][_0x925a('0x38')]?_0x1c9884[_0x925a('0x37')]:_0x336b77['model'];if(!_0x160ad8['query'][_0x925a('0x39')](_0x925a('0x3a'))){_0x1c9884[_0x925a('0x1b')]=qs[_0x925a('0x1b')](_0x160ad8[_0x925a('0x32')]['limit']);_0x1c9884['offset']=qs[_0x925a('0x1a')](_0x160ad8[_0x925a('0x32')]['offset']);}_0x1c9884['order']=qs['sort'](_0x160ad8[_0x925a('0x32')][_0x925a('0x3c')]);_0x1c9884[_0x925a('0x3d')]=qs[_0x925a('0x34')](_[_0x925a('0x3e')](_0x160ad8[_0x925a('0x32')],_0x336b77[_0x925a('0x34')]));_0x1c9884['where'][_0x925a('0x5c')]=_0x256760['id'];if(_0x160ad8[_0x925a('0x32')][_0x925a('0x3f')]){_0x1c9884[_0x925a('0x3d')]=_[_0x925a('0x40')](_0x1c9884[_0x925a('0x3d')],{'$or':_[_0x925a('0x2d')](_0x1c9884[_0x925a('0x37')],function(_0x3e72ca){var _0xe31d13={};_0xe31d13[_0x3e72ca]={'$like':'%'+_0x160ad8['query']['filter']+'%'};return _0xe31d13;})});}_0x1c9884=_['merge']({},_0x1c9884,_0x160ad8[_0x925a('0x42')]);return db['JscriptyAnswerReport'][_0x925a('0x1d')]({'where':_0x1c9884[_0x925a('0x3d')]})[_0x925a('0x24')](function(_0x19cbd8){_0x5774e5['count']=_0x19cbd8;if(_0x160ad8[_0x925a('0x32')]['includeAll']){_0x1c9884[_0x925a('0x45')]=[{'all':!![]}];}return db[_0x925a('0x5b')][_0x925a('0x46')](_0x1c9884);})[_0x925a('0x24')](function(_0x1a1e10){_0x5774e5[_0x925a('0x47')]=_0x1a1e10;return _0x5774e5;});}})[_0x925a('0x24')](respondWithFilteredResult(_0x3d3550,_0x1c9884))[_0x925a('0x48')](handleError(_0x3d3550,null));};function char(_0x21f312){return _0x925a('0x5d')===typeof _0x21f312?String[_0x925a('0x5e')]['apply'](null,arguments):_0x21f312;}function needsEncapsulation(_0x5e2175){return!!_0x5e2175&&(_0x5e2175[_0x925a('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x5e2175[_0x925a('0x5f')]()[_0x925a('0x60')](char(0xa))>=0x0||_0x5e2175[_0x925a('0x5f')]()[_0x925a('0x60')](char(0x2c))>=0x0||_0x5e2175[_0x925a('0x5f')]()[_0x925a('0x60')](char(0x22))>=0x0);}function encapsulate(_0x572f3f){var _0x35a5bb=char(0x22),_0x3ccb3f='\x5c'+char(0x22),_0xcc0fba=_0x572f3f[_0x925a('0x5f')]()[_0x925a('0x61')](new RegExp(_0x35a5bb,'g'),_0x3ccb3f);return _0x35a5bb+_0xcc0fba+_0x35a5bb;}exports['getSummary']=function(_0x52d3ee,_0x3ee0c0,_0x28b65f){var _0x280f81,_0x57fc9e;var _0x5ddc8c={'where':{'ProjectId':_0x52d3ee[_0x925a('0x56')]['id']}};if(_0x52d3ee['query'][_0x925a('0x62')]){_0x5ddc8c['where'][_0x925a('0x63')]=JSON[_0x925a('0x64')](_0x52d3ee[_0x925a('0x32')][_0x925a('0x62')]);}return db[_0x925a('0x59')][_0x925a('0x46')](_0x5ddc8c)[_0x925a('0x24')](handleEntityNotFound(_0x3ee0c0,null))['then'](function(_0x161098){if(_0x161098){_0x280f81=_0x161098;return db[_0x925a('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0x925a('0x2d')](_0x280f81,'id')},'ProjectId':_0x52d3ee[_0x925a('0x56')]['id']},'order':_0x925a('0x66')});}})['then'](handleEntityNotFound(_0x3ee0c0,null))[_0x925a('0x24')](function(_0x551ac1){if(_0x551ac1){_0x57fc9e=_0x551ac1;var _0x47b63a={};for(var _0x328c7a=0x0,_0xa28e69=_0x57fc9e['length'];_0x328c7a<_0xa28e69;_0x328c7a++){if(!_0x47b63a['hasOwnProperty'](_0x57fc9e[_0x328c7a][_0x925a('0x67')])){_0x47b63a[_0x57fc9e[_0x328c7a][_0x925a('0x67')]]=needsEncapsulation(_0x57fc9e[_0x328c7a][_0x925a('0x68')])?encapsulate(_0x57fc9e[_0x328c7a][_0x925a('0x68')]):_0x57fc9e[_0x328c7a]['question'];}}var _0x2242fb=[],_0x50e560={};for(var _0xf71d5c=0x0,_0x4d3d13=_0x280f81['length'];_0xf71d5c<_0x4d3d13;_0xf71d5c++){_0x50e560={'ProjectId':_0x52d3ee[_0x925a('0x56')]['id'],'SessionId':_0x280f81[_0xf71d5c]['id'],'StartTime':moment(_0x280f81[_0xf71d5c]['starttime'])[_0x925a('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1b3f90=0x0,_0x19c7f8=_0x57fc9e[_0x925a('0x38')];_0x1b3f90<_0x19c7f8;_0x1b3f90++){if(_0x57fc9e[_0x1b3f90][_0x925a('0x6a')]==_0x280f81[_0xf71d5c]['id']&&_0x47b63a[_0x925a('0x39')](_0x57fc9e[_0x1b3f90][_0x925a('0x67')])){_0x50e560[_0x47b63a[_0x57fc9e[_0x1b3f90]['questionId']]]=_0x57fc9e[_0x1b3f90][_0x925a('0x6b')];}}for(var _0x47e503 in _0x47b63a){if(!_0x50e560['hasOwnProperty'](_0x47b63a[_0x47e503])){_0x50e560[_0x47b63a[_0x47e503]]=null;}}_0x2242fb['push'](_0x50e560);}return _0x2242fb;}})[_0x925a('0x24')](function(_0xc463eb){if(!_['isEmpty'](_0xc463eb)){var _0x2309de=toCsv(_0xc463eb);var _0x23d8ad=Date[_0x925a('0x6c')]();fs[_0x925a('0x6d')](util['format'](_0x925a('0x6e'),_0x52d3ee[_0x925a('0x56')]['id'],_0x23d8ad),_0x2309de);_0x3ee0c0[_0x925a('0x6f')](_0x925a('0x70'),'attachment;\x20filename='+util['format'](_0x925a('0x71'),_0x52d3ee[_0x925a('0x56')]['id'],_0x23d8ad));_0x3ee0c0[_0x925a('0x6f')](_0x925a('0x72'),_0x925a('0x73'));return _0x3ee0c0[_0x925a('0x74')](util['format'](_0x925a('0x6e'),_0x52d3ee[_0x925a('0x56')]['id'],_0x23d8ad));}else{return _0x3ee0c0[_0x925a('0x16')](0xcc);}})[_0x925a('0x48')](handleError(_0x3ee0c0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 158c39a..07641cc 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56e6=['exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x2f6f93,_0x13588b){var _0x4e12f3=function(_0x17d89e){while(--_0x17d89e){_0x2f6f93['push'](_0x2f6f93['shift']());}};_0x4e12f3(++_0x13588b);}(_0x56e6,0x6b));var _0x656e=function(_0x2aedda,_0x1a6ae9){_0x2aedda=_0x2aedda-0x0;var _0x38e852=_0x56e6[_0x2aedda];return _0x38e852;};'use strict';var _=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var logger=require(_0x656e('0x2'))(_0x656e('0x3'));var moment=require(_0x656e('0x4'));var BPromise=require(_0x656e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x656e('0x6'));var rimraf=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var attributes=require(_0x656e('0x9'));module[_0x656e('0xa')]=function(_0x3fef98,_0x81c232){return _0x3fef98['define'](_0x656e('0xb'),attributes,{'tableName':_0x656e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x7217,0x19e));var _0x7721=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7217[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 68a0f0c..b825355 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1de3a0,_0x17593c){_0x1de3a0=_0x1de3a0-0x0;var _0x396141=_0xbdb7[_0x1de3a0];return _0x396141;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1310de,_0x58554b){var _0x182e9c=function(_0x4d4b10){while(--_0x4d4b10){_0x1310de['push'](_0x1310de['shift']());}};_0x182e9c(++_0x58554b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1226ff,_0x14c129){_0x1226ff=_0x1226ff-0x0;var _0x173695=_0xb43b[_0x1226ff];return _0x173695;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 2164834..e75b2a4 100644 --- a/server/api/jscriptyQuestionReport/index.js +++ b/server/api/jscriptyQuestionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ae4=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','isAuthenticated','index','get','describe','/:id','show'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x1ae4,0x79));var _0x41ae=function(_0x1ddfcf,_0x2f4acd){_0x1ddfcf=_0x1ddfcf-0x0;var _0x366f2a=_0x1ae4[_0x1ddfcf];return _0x366f2a;};'use strict';var multer=require(_0x41ae('0x0'));var util=require(_0x41ae('0x1'));var path=require('path');var timeout=require(_0x41ae('0x2'));var express=require(_0x41ae('0x3'));var router=express[_0x41ae('0x4')]();var fs_extra=require(_0x41ae('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x41ae('0x6')](),controller[_0x41ae('0x7')]);router[_0x41ae('0x8')]('/describe',auth[_0x41ae('0x6')](),controller[_0x41ae('0x9')]);router[_0x41ae('0x8')](_0x41ae('0xa'),auth[_0x41ae('0x6')](),controller[_0x41ae('0xb')]);router[_0x41ae('0xc')]('/',auth['isAuthenticated'](),controller[_0x41ae('0xd')]);router[_0x41ae('0xe')](_0x41ae('0xa'),auth[_0x41ae('0x6')](),controller[_0x41ae('0xf')]);router[_0x41ae('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x41ae('0x11')]);module[_0x41ae('0x12')]=router; \ No newline at end of file +var _0x35c5=['show','post','put','update','destroy','multer','util','connect-timeout','Router','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x35c5,0x1d5));var _0x535c=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x35c5[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0x535c('0x0'));var util=require(_0x535c('0x1'));var path=require('path');var timeout=require(_0x535c('0x2'));var express=require('express');var router=express[_0x535c('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x535c('0x4'));router['get']('/',auth[_0x535c('0x5')](),controller[_0x535c('0x6')]);router[_0x535c('0x7')](_0x535c('0x8'),auth[_0x535c('0x5')](),controller[_0x535c('0x9')]);router[_0x535c('0x7')](_0x535c('0xa'),auth[_0x535c('0x5')](),controller[_0x535c('0xb')]);router[_0x535c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x535c('0xd')](_0x535c('0xa'),auth['isAuthenticated'](),controller[_0x535c('0xe')]);router['delete']('/:id',auth[_0x535c('0x5')](),controller[_0x535c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f40b749..b1980c4 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x28cebb,_0x21578f){_0x28cebb=_0x28cebb-0x0;var _0x26b43a=_0x7a54[_0x28cebb];return _0x26b43a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a54,0x106));var _0x47a5=function(_0x1be18c,_0x58dcfb){_0x1be18c=_0x1be18c-0x0;var _0x5c0523=_0x7a54[_0x1be18c];return _0x5c0523;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index a3b168c..01367b6 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x487c=['keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query'];(function(_0x594c95,_0x4371b8){var _0x248eab=function(_0x1f15c8){while(--_0x1f15c8){_0x594c95['push'](_0x594c95['shift']());}};_0x248eab(++_0x4371b8);}(_0x487c,0x181));var _0xc487=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x487c[_0x36dfbd];return _0x4ecad9;};'use strict';var emlformat=require(_0xc487('0x0'));var rimraf=require(_0xc487('0x1'));var zipdir=require(_0xc487('0x2'));var jsonpatch=require(_0xc487('0x3'));var rp=require(_0xc487('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc487('0x5'));var util=require(_0xc487('0x6'));var path=require(_0xc487('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc487('0x8'));var _=require(_0xc487('0x9'));var squel=require(_0xc487('0xa'));var crypto=require('crypto');var jsforce=require(_0xc487('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc487('0xc'));var querystring=require('querystring');var Papa=require(_0xc487('0xd'));var Redis=require(_0xc487('0xe'));var authService=require(_0xc487('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc487('0x10'));var hardwareService=require(_0xc487('0x11'));var logger=require(_0xc487('0x12'))('api');var utils=require(_0xc487('0x13'));var config=require(_0xc487('0x14'));var licenseUtil=require(_0xc487('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d8eb0,_0x453b59){_0x453b59=_0x453b59||0xcc;return function(_0x3d2ab1){if(_0x3d2ab1){return _0x4d8eb0[_0xc487('0x16')](_0x453b59);}return _0x4d8eb0[_0xc487('0x17')](_0x453b59)['end']();};}function respondWithResult(_0x2f409a,_0x42300b){_0x42300b=_0x42300b||0xc8;return function(_0xa9a21c){if(_0xa9a21c){return _0x2f409a['status'](_0x42300b)[_0xc487('0x18')](_0xa9a21c);}};}function respondWithFilteredResult(_0xbc6fda,_0x358769){return function(_0x48d7f8){if(_0x48d7f8){var _0x627d5d=typeof _0x358769['offset']===_0xc487('0x19')&&typeof _0x358769[_0xc487('0x1a')]===_0xc487('0x19');var _0x43943d=_0x48d7f8[_0xc487('0x1b')];var _0x4e0960=_0x627d5d?0x0:_0x358769['offset'];var _0x3a3e69=_0x627d5d?_0x48d7f8[_0xc487('0x1b')]:_0x358769[_0xc487('0x1c')]+_0x358769[_0xc487('0x1a')];var _0x21b2f5;if(_0x3a3e69>=_0x43943d){_0x3a3e69=_0x43943d;_0x21b2f5=0xc8;}else{_0x21b2f5=0xce;}_0xbc6fda[_0xc487('0x17')](_0x21b2f5);return _0xbc6fda[_0xc487('0x1d')](_0xc487('0x1e'),_0x4e0960+'-'+_0x3a3e69+'/'+_0x43943d)[_0xc487('0x18')](_0x48d7f8);}return null;};}function patchUpdates(_0x424f7a){return function(_0x1db7c8){try{jsonpatch[_0xc487('0x1f')](_0x1db7c8,_0x424f7a,!![]);}catch(_0xdd39cd){return BPromise['reject'](_0xdd39cd);}return _0x1db7c8['save']();};}function saveUpdates(_0x48c293,_0x2ef4bb){return function(_0x11c887){if(_0x11c887){return _0x11c887[_0xc487('0x20')](_0x48c293)[_0xc487('0x21')](function(_0x547cbe){return _0x547cbe;});}return null;};}function removeEntity(_0x4c97b8,_0x5b9e3c){return function(_0x3188f9){if(_0x3188f9){return _0x3188f9[_0xc487('0x22')]()[_0xc487('0x21')](function(){_0x4c97b8[_0xc487('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1613c1,_0x6b67ad){return function(_0x3ff909){if(!_0x3ff909){_0x1613c1[_0xc487('0x16')](0x194);}return _0x3ff909;};}function handleError(_0x33bff2,_0x151593){_0x151593=_0x151593||0x1f4;return function(_0x16970b){logger[_0xc487('0x23')](_0x16970b[_0xc487('0x24')]);if(_0x16970b[_0xc487('0x25')]){delete _0x16970b[_0xc487('0x25')];}_0x33bff2[_0xc487('0x17')](_0x151593)[_0xc487('0x26')](_0x16970b);};}exports[_0xc487('0x27')]=function(_0x3c427e,_0x363781){var _0x27e26a={},_0x2b04a4={},_0x44ebe2={'count':0x0,'rows':[]};var _0x3403e3=_[_0xc487('0x28')](db[_0xc487('0x29')][_0xc487('0x2a')],function(_0x429800){return{'name':_0x429800[_0xc487('0x2b')],'type':_0x429800[_0xc487('0x2c')][_0xc487('0x2d')]};});_0x2b04a4['model']=_[_0xc487('0x28')](_0x3403e3,_0xc487('0x25'));_0x2b04a4[_0xc487('0x2e')]=_[_0xc487('0x2f')](_0x3c427e[_0xc487('0x2e')]);_0x2b04a4['filters']=_[_0xc487('0x30')](_0x2b04a4['model'],_0x2b04a4['query']);_0x27e26a['attributes']=_['intersection'](_0x2b04a4[_0xc487('0x31')],qs['fields'](_0x3c427e['query'][_0xc487('0x32')]));_0x27e26a[_0xc487('0x33')]=_0x27e26a['attributes'][_0xc487('0x34')]?_0x27e26a[_0xc487('0x33')]:_0x2b04a4[_0xc487('0x31')];if(!_0x3c427e[_0xc487('0x2e')][_0xc487('0x35')](_0xc487('0x36'))){_0x27e26a[_0xc487('0x1a')]=qs[_0xc487('0x1a')](_0x3c427e[_0xc487('0x2e')][_0xc487('0x1a')]);_0x27e26a['offset']=qs[_0xc487('0x1c')](_0x3c427e[_0xc487('0x2e')][_0xc487('0x1c')]);}_0x27e26a[_0xc487('0x37')]=qs[_0xc487('0x38')](_0x3c427e[_0xc487('0x2e')][_0xc487('0x38')]);_0x27e26a[_0xc487('0x39')]=qs[_0xc487('0x3a')](_['pick'](_0x3c427e[_0xc487('0x2e')],_0x2b04a4[_0xc487('0x3a')]),_0x3403e3);if(_0x3c427e[_0xc487('0x2e')]['filter']){_0x27e26a['where']=_[_0xc487('0x3b')](_0x27e26a[_0xc487('0x39')],{'$or':_['map'](_0x3403e3,function(_0x42b0ac){if(_0x42b0ac[_0xc487('0x2c')]!==_0xc487('0x3c')){var _0x280fcc={};_0x280fcc[_0x42b0ac['name']]={'$like':'%'+_0x3c427e[_0xc487('0x2e')][_0xc487('0x3d')]+'%'};return _0x280fcc;}})});}_0x27e26a=_[_0xc487('0x3b')]({},_0x27e26a,_0x3c427e[_0xc487('0x3e')]);var _0x3e8f5b={'where':_0x27e26a[_0xc487('0x39')]};return db[_0xc487('0x29')]['count'](_0x3e8f5b)[_0xc487('0x21')](function(_0x509f9f){_0x44ebe2['count']=_0x509f9f;if(_0x3c427e[_0xc487('0x2e')][_0xc487('0x3f')]){_0x27e26a[_0xc487('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc487('0x41')](_0x27e26a);})['then'](function(_0x542689){_0x44ebe2['rows']=_0x542689;return _0x44ebe2;})['then'](respondWithFilteredResult(_0x363781,_0x27e26a))[_0xc487('0x42')](handleError(_0x363781,null));};exports[_0xc487('0x43')]=function(_0x259041,_0x7ac928){var _0x5d3416={'raw':!![],'where':{'id':_0x259041[_0xc487('0x44')]['id']}},_0x373d44={};_0x373d44[_0xc487('0x31')]=_[_0xc487('0x2f')](db[_0xc487('0x29')][_0xc487('0x2a')]);_0x373d44[_0xc487('0x2e')]=_[_0xc487('0x2f')](_0x259041[_0xc487('0x2e')]);_0x373d44[_0xc487('0x3a')]=_[_0xc487('0x30')](_0x373d44['model'],_0x373d44[_0xc487('0x2e')]);_0x5d3416['attributes']=_[_0xc487('0x30')](_0x373d44[_0xc487('0x31')],qs[_0xc487('0x32')](_0x259041['query'][_0xc487('0x32')]));_0x5d3416[_0xc487('0x33')]=_0x5d3416['attributes']['length']?_0x5d3416[_0xc487('0x33')]:_0x373d44[_0xc487('0x31')];if(_0x259041[_0xc487('0x2e')][_0xc487('0x3f')]){_0x5d3416[_0xc487('0x40')]=[{'all':!![]}];}_0x5d3416=_[_0xc487('0x3b')]({},_0x5d3416,_0x259041[_0xc487('0x3e')]);return db[_0xc487('0x29')][_0xc487('0x45')](_0x5d3416)[_0xc487('0x21')](handleEntityNotFound(_0x7ac928,null))[_0xc487('0x21')](respondWithResult(_0x7ac928,null))[_0xc487('0x42')](handleError(_0x7ac928,null));};exports['create']=function(_0x932b56,_0x10e606){return db['JscriptyQuestionReport'][_0xc487('0x46')](_0x932b56[_0xc487('0x47')],{})[_0xc487('0x21')](respondWithResult(_0x10e606,0xc9))[_0xc487('0x42')](handleError(_0x10e606,null));};exports['update']=function(_0x4c6094,_0x3218f8){if(_0x4c6094[_0xc487('0x47')]['id']){delete _0x4c6094[_0xc487('0x47')]['id'];}return db[_0xc487('0x29')][_0xc487('0x45')]({'where':{'id':_0x4c6094[_0xc487('0x44')]['id']}})[_0xc487('0x21')](handleEntityNotFound(_0x3218f8,null))[_0xc487('0x21')](saveUpdates(_0x4c6094[_0xc487('0x47')],null))[_0xc487('0x21')](respondWithResult(_0x3218f8,null))[_0xc487('0x42')](handleError(_0x3218f8,null));};exports['destroy']=function(_0x3f5871,_0x54761d){return db[_0xc487('0x29')][_0xc487('0x45')]({'where':{'id':_0x3f5871['params']['id']}})[_0xc487('0x21')](handleEntityNotFound(_0x54761d,null))[_0xc487('0x21')](removeEntity(_0x54761d,null))[_0xc487('0x42')](handleError(_0x54761d,null));};exports['describe']=function(_0x58c0d9,_0x56cfaa){return db[_0xc487('0x29')]['describe']()[_0xc487('0x21')](respondWithResult(_0x56cfaa,null))[_0xc487('0x42')](handleError(_0x56cfaa,null));}; \ No newline at end of file +var _0xc343=['findAll','rows','catch','show','params','keys','include','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll'];(function(_0x529591,_0x86a5a4){var _0x501c11=function(_0x4cfe09){while(--_0x4cfe09){_0x529591['push'](_0x529591['shift']());}};_0x501c11(++_0x86a5a4);}(_0xc343,0xf3));var _0x3c34=function(_0x16cc1a,_0x2a1851){_0x16cc1a=_0x16cc1a-0x0;var _0xf16d2e=_0xc343[_0x16cc1a];return _0xf16d2e;};'use strict';var emlformat=require(_0x3c34('0x0'));var rimraf=require(_0x3c34('0x1'));var zipdir=require(_0x3c34('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c34('0x3'));var moment=require(_0x3c34('0x4'));var BPromise=require(_0x3c34('0x5'));var Mustache=require(_0x3c34('0x6'));var util=require(_0x3c34('0x7'));var path=require('path');var sox=require(_0x3c34('0x8'));var csv=require(_0x3c34('0x9'));var ejs=require(_0x3c34('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c34('0xb'));var squel=require('squel');var crypto=require(_0x3c34('0xc'));var jsforce=require(_0x3c34('0xd'));var deskjs=require(_0x3c34('0xe'));var toCsv=require(_0x3c34('0x9'));var querystring=require(_0x3c34('0xf'));var Papa=require(_0x3c34('0x10'));var Redis=require(_0x3c34('0x11'));var authService=require(_0x3c34('0x12'));var qs=require(_0x3c34('0x13'));var as=require(_0x3c34('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c34('0x15'))(_0x3c34('0x16'));var utils=require(_0x3c34('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230464,_0x2ec72d){_0x2ec72d=_0x2ec72d||0xcc;return function(_0x5298f4){if(_0x5298f4){return _0x230464['sendStatus'](_0x2ec72d);}return _0x230464[_0x3c34('0x18')](_0x2ec72d)[_0x3c34('0x19')]();};}function respondWithResult(_0x382c43,_0x2522fd){_0x2522fd=_0x2522fd||0xc8;return function(_0x15296d){if(_0x15296d){return _0x382c43[_0x3c34('0x18')](_0x2522fd)[_0x3c34('0x1a')](_0x15296d);}};}function respondWithFilteredResult(_0x2a7c74,_0x19cdeb){return function(_0x223891){if(_0x223891){var _0x216ac1=typeof _0x19cdeb[_0x3c34('0x1b')]===_0x3c34('0x1c')&&typeof _0x19cdeb[_0x3c34('0x1d')]==='undefined';var _0x104a15=_0x223891['count'];var _0x5d32fe=_0x216ac1?0x0:_0x19cdeb[_0x3c34('0x1b')];var _0x5686bf=_0x216ac1?_0x223891[_0x3c34('0x1e')]:_0x19cdeb['offset']+_0x19cdeb[_0x3c34('0x1d')];var _0x55c309;if(_0x5686bf>=_0x104a15){_0x5686bf=_0x104a15;_0x55c309=0xc8;}else{_0x55c309=0xce;}_0x2a7c74[_0x3c34('0x18')](_0x55c309);return _0x2a7c74[_0x3c34('0x1f')]('Content-Range',_0x5d32fe+'-'+_0x5686bf+'/'+_0x104a15)[_0x3c34('0x1a')](_0x223891);}return null;};}function patchUpdates(_0x1ba13d){return function(_0x4e4a3f){try{jsonpatch[_0x3c34('0x20')](_0x4e4a3f,_0x1ba13d,!![]);}catch(_0x10776b){return BPromise[_0x3c34('0x21')](_0x10776b);}return _0x4e4a3f[_0x3c34('0x22')]();};}function saveUpdates(_0xb702bc,_0x502609){return function(_0x471abe){if(_0x471abe){return _0x471abe['update'](_0xb702bc)[_0x3c34('0x23')](function(_0x3cb65a){return _0x3cb65a;});}return null;};}function removeEntity(_0x55007e,_0x1ee6ee){return function(_0x218929){if(_0x218929){return _0x218929[_0x3c34('0x24')]()[_0x3c34('0x23')](function(){_0x55007e[_0x3c34('0x18')](0xcc)[_0x3c34('0x19')]();});}};}function handleEntityNotFound(_0x4c0dc2,_0x2184fd){return function(_0x56de7a){if(!_0x56de7a){_0x4c0dc2[_0x3c34('0x25')](0x194);}return _0x56de7a;};}function handleError(_0x4ac0e6,_0x6b504){_0x6b504=_0x6b504||0x1f4;return function(_0x54e250){logger[_0x3c34('0x26')](_0x54e250[_0x3c34('0x27')]);if(_0x54e250['name']){delete _0x54e250['name'];}_0x4ac0e6['status'](_0x6b504)[_0x3c34('0x28')](_0x54e250);};}exports[_0x3c34('0x29')]=function(_0x640686,_0x309b2d){var _0x2743e7={},_0xd8b67={},_0x2cfb73={'count':0x0,'rows':[]};var _0x14a393=_[_0x3c34('0x2a')](db[_0x3c34('0x2b')][_0x3c34('0x2c')],function(_0x42ce8e){return{'name':_0x42ce8e['fieldName'],'type':_0x42ce8e[_0x3c34('0x2d')][_0x3c34('0x2e')]};});_0xd8b67[_0x3c34('0x2f')]=_[_0x3c34('0x2a')](_0x14a393,_0x3c34('0x30'));_0xd8b67[_0x3c34('0x31')]=_['keys'](_0x640686['query']);_0xd8b67['filters']=_[_0x3c34('0x32')](_0xd8b67[_0x3c34('0x2f')],_0xd8b67['query']);_0x2743e7['attributes']=_[_0x3c34('0x32')](_0xd8b67['model'],qs[_0x3c34('0x33')](_0x640686['query'][_0x3c34('0x33')]));_0x2743e7[_0x3c34('0x34')]=_0x2743e7[_0x3c34('0x34')][_0x3c34('0x35')]?_0x2743e7[_0x3c34('0x34')]:_0xd8b67[_0x3c34('0x2f')];if(!_0x640686['query'][_0x3c34('0x36')]('nolimit')){_0x2743e7[_0x3c34('0x1d')]=qs[_0x3c34('0x1d')](_0x640686[_0x3c34('0x31')]['limit']);_0x2743e7[_0x3c34('0x1b')]=qs[_0x3c34('0x1b')](_0x640686[_0x3c34('0x31')]['offset']);}_0x2743e7[_0x3c34('0x37')]=qs[_0x3c34('0x38')](_0x640686[_0x3c34('0x31')][_0x3c34('0x38')]);_0x2743e7[_0x3c34('0x39')]=qs[_0x3c34('0x3a')](_[_0x3c34('0x3b')](_0x640686['query'],_0xd8b67[_0x3c34('0x3a')]),_0x14a393);if(_0x640686[_0x3c34('0x31')][_0x3c34('0x3c')]){_0x2743e7[_0x3c34('0x39')]=_['merge'](_0x2743e7[_0x3c34('0x39')],{'$or':_[_0x3c34('0x2a')](_0x14a393,function(_0x4ac881){if(_0x4ac881[_0x3c34('0x2d')]!==_0x3c34('0x3d')){var _0x4a2096={};_0x4a2096[_0x4ac881['name']]={'$like':'%'+_0x640686[_0x3c34('0x31')][_0x3c34('0x3c')]+'%'};return _0x4a2096;}})});}_0x2743e7=_[_0x3c34('0x3e')]({},_0x2743e7,_0x640686[_0x3c34('0x3f')]);var _0x666d65={'where':_0x2743e7[_0x3c34('0x39')]};return db['JscriptyQuestionReport'][_0x3c34('0x1e')](_0x666d65)['then'](function(_0x26b66e){_0x2cfb73[_0x3c34('0x1e')]=_0x26b66e;if(_0x640686[_0x3c34('0x31')][_0x3c34('0x40')]){_0x2743e7['include']=[{'all':!![]}];}return db[_0x3c34('0x2b')][_0x3c34('0x41')](_0x2743e7);})[_0x3c34('0x23')](function(_0x445d6e){_0x2cfb73[_0x3c34('0x42')]=_0x445d6e;return _0x2cfb73;})[_0x3c34('0x23')](respondWithFilteredResult(_0x309b2d,_0x2743e7))[_0x3c34('0x43')](handleError(_0x309b2d,null));};exports[_0x3c34('0x44')]=function(_0x4f59e0,_0x54b1cc){var _0x4034da={'raw':!![],'where':{'id':_0x4f59e0[_0x3c34('0x45')]['id']}},_0x26da36={};_0x26da36[_0x3c34('0x2f')]=_[_0x3c34('0x46')](db[_0x3c34('0x2b')][_0x3c34('0x2c')]);_0x26da36['query']=_['keys'](_0x4f59e0['query']);_0x26da36[_0x3c34('0x3a')]=_[_0x3c34('0x32')](_0x26da36[_0x3c34('0x2f')],_0x26da36[_0x3c34('0x31')]);_0x4034da['attributes']=_[_0x3c34('0x32')](_0x26da36[_0x3c34('0x2f')],qs['fields'](_0x4f59e0[_0x3c34('0x31')][_0x3c34('0x33')]));_0x4034da[_0x3c34('0x34')]=_0x4034da[_0x3c34('0x34')][_0x3c34('0x35')]?_0x4034da[_0x3c34('0x34')]:_0x26da36[_0x3c34('0x2f')];if(_0x4f59e0[_0x3c34('0x31')][_0x3c34('0x40')]){_0x4034da[_0x3c34('0x47')]=[{'all':!![]}];}_0x4034da=_['merge']({},_0x4034da,_0x4f59e0[_0x3c34('0x3f')]);return db[_0x3c34('0x2b')]['find'](_0x4034da)[_0x3c34('0x23')](handleEntityNotFound(_0x54b1cc,null))[_0x3c34('0x23')](respondWithResult(_0x54b1cc,null))[_0x3c34('0x43')](handleError(_0x54b1cc,null));};exports['create']=function(_0x22d5f1,_0x435bae){return db[_0x3c34('0x2b')][_0x3c34('0x48')](_0x22d5f1['body'],{})[_0x3c34('0x23')](respondWithResult(_0x435bae,0xc9))[_0x3c34('0x43')](handleError(_0x435bae,null));};exports[_0x3c34('0x49')]=function(_0x421f57,_0x51c8f1){if(_0x421f57[_0x3c34('0x4a')]['id']){delete _0x421f57[_0x3c34('0x4a')]['id'];}return db[_0x3c34('0x2b')][_0x3c34('0x4b')]({'where':{'id':_0x421f57['params']['id']}})[_0x3c34('0x23')](handleEntityNotFound(_0x51c8f1,null))[_0x3c34('0x23')](saveUpdates(_0x421f57[_0x3c34('0x4a')],null))['then'](respondWithResult(_0x51c8f1,null))[_0x3c34('0x43')](handleError(_0x51c8f1,null));};exports[_0x3c34('0x24')]=function(_0xb6a4dd,_0x3ea7d5){return db[_0x3c34('0x2b')]['find']({'where':{'id':_0xb6a4dd[_0x3c34('0x45')]['id']}})[_0x3c34('0x23')](handleEntityNotFound(_0x3ea7d5,null))[_0x3c34('0x23')](removeEntity(_0x3ea7d5,null))[_0x3c34('0x43')](handleError(_0x3ea7d5,null));};exports[_0x3c34('0x4c')]=function(_0x10002b,_0x34e777){return db[_0x3c34('0x2b')][_0x3c34('0x4c')]()[_0x3c34('0x23')](respondWithResult(_0x34e777,null))[_0x3c34('0x43')](handleError(_0x34e777,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 24ebc09..3359623 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0a4=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions'];(function(_0x496377,_0x3a68a4){var _0x151575=function(_0xcbca9a){while(--_0xcbca9a){_0x496377['push'](_0x496377['shift']());}};_0x151575(++_0x3a68a4);}(_0xe0a4,0xc0));var _0x4e0a=function(_0x52799e,_0x2e3622){_0x52799e=_0x52799e-0x0;var _0x28973a=_0xe0a4[_0x52799e];return _0x28973a;};'use strict';var _=require(_0x4e0a('0x0'));var util=require(_0x4e0a('0x1'));var logger=require(_0x4e0a('0x2'))('api');var moment=require(_0x4e0a('0x3'));var BPromise=require(_0x4e0a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e0a('0x5'));var rimraf=require(_0x4e0a('0x6'));var config=require(_0x4e0a('0x7'));var attributes=require(_0x4e0a('0x8'));module[_0x4e0a('0x9')]=function(_0x4f4416,_0x4d40a4){return _0x4f4416[_0x4e0a('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x4e0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ecf=['JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x23c791,_0xa8bee3){var _0x57b777=function(_0x25f8c4){while(--_0x25f8c4){_0x23c791['push'](_0x23c791['shift']());}};_0x57b777(++_0xa8bee3);}(_0x9ecf,0x12d));var _0xf9ec=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0x9ecf[_0x4178af];return _0x20f4b1;};'use strict';var _=require(_0xf9ec('0x0'));var util=require('util');var logger=require(_0xf9ec('0x1'))(_0xf9ec('0x2'));var moment=require(_0xf9ec('0x3'));var BPromise=require(_0xf9ec('0x4'));var rp=require(_0xf9ec('0x5'));var fs=require('fs');var path=require(_0xf9ec('0x6'));var rimraf=require(_0xf9ec('0x7'));var config=require(_0xf9ec('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xf9ec('0x9')]=function(_0x45a686,_0x54803f){return _0x45a686[_0xf9ec('0xa')](_0xf9ec('0xb'),attributes,{'tableName':_0xf9ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 1edebd1..7e0d2d7 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3aed=['result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x5b98a8,_0x300571){var _0x2208d1=function(_0x56113a){while(--_0x56113a){_0x5b98a8['push'](_0x5b98a8['shift']());}};_0x2208d1(++_0x300571);}(_0x3aed,0x10c));var _0xd3ae=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x3aed[_0x41c381];return _0x427981;};'use strict';var _=require(_0xd3ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd3ae('0x1'));var fs=require('fs');var Redis=require(_0xd3ae('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3ae('0x3'));var logger=require(_0xd3ae('0x4'))(_0xd3ae('0x5'));var config=require(_0xd3ae('0x6'));var jayson=require(_0xd3ae('0x7'));var client=jayson['client'][_0xd3ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b3e8e,_0x1f668c,_0x2c54f6){return new BPromise(function(_0xe56db2,_0x41fb36){return client[_0xd3ae('0x9')](_0x2b3e8e,_0x2c54f6)[_0xd3ae('0xa')](function(_0x29d24a){logger[_0xd3ae('0xb')](_0xd3ae('0xc'),_0x1f668c,_0xd3ae('0xd'));logger[_0xd3ae('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x1f668c,'request\x20sent',JSON['stringify'](_0x29d24a));if(_0x29d24a[_0xd3ae('0xf')]){if(_0x29d24a['error']['code']===0x1f4){logger['error'](_0xd3ae('0xc'),_0x1f668c,_0x29d24a[_0xd3ae('0xf')][_0xd3ae('0x10')]);return _0x41fb36(_0x29d24a[_0xd3ae('0xf')][_0xd3ae('0x10')]);}logger[_0xd3ae('0xf')](_0xd3ae('0xc'),_0x1f668c,_0x29d24a['error'][_0xd3ae('0x10')]);return _0xe56db2(_0x29d24a[_0xd3ae('0xf')][_0xd3ae('0x10')]);}else{logger['info'](_0xd3ae('0xc'),_0x1f668c,_0xd3ae('0xd'));_0xe56db2(_0x29d24a[_0xd3ae('0x11')][_0xd3ae('0x10')]);}})[_0xd3ae('0x12')](function(_0x59d0e3){logger['error'](_0xd3ae('0xc'),_0x1f668c,_0x59d0e3);_0x41fb36(_0x59d0e3);});});} \ No newline at end of file +var _0xd56b=['then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x589f5e,_0x2bdc96){var _0x14276e=function(_0x428254){while(--_0x428254){_0x589f5e['push'](_0x589f5e['shift']());}};_0x14276e(++_0x2bdc96);}(_0xd56b,0x81));var _0xbd56=function(_0x3a00f2,_0x293f4e){_0x3a00f2=_0x3a00f2-0x0;var _0x2c7e6a=_0xd56b[_0x3a00f2];return _0x2c7e6a;};'use strict';var _=require('lodash');var util=require(_0xbd56('0x0'));var moment=require(_0xbd56('0x1'));var BPromise=require(_0xbd56('0x2'));var rs=require(_0xbd56('0x3'));var fs=require('fs');var Redis=require(_0xbd56('0x4'));var db=require(_0xbd56('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd56('0x6'))(_0xbd56('0x7'));var config=require(_0xbd56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd56('0x9')][_0xbd56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46df80,_0x252367,_0x1d59a8){return new BPromise(function(_0x47b43c,_0x41f6aa){return client['request'](_0x46df80,_0x1d59a8)[_0xbd56('0xb')](function(_0x307879){logger['info'](_0xbd56('0xc'),_0x252367,_0xbd56('0xd'));logger[_0xbd56('0xe')](_0xbd56('0xf'),_0x252367,_0xbd56('0xd'),JSON[_0xbd56('0x10')](_0x307879));if(_0x307879[_0xbd56('0x11')]){if(_0x307879[_0xbd56('0x11')]['code']===0x1f4){logger[_0xbd56('0x11')](_0xbd56('0xc'),_0x252367,_0x307879['error'][_0xbd56('0x12')]);return _0x41f6aa(_0x307879[_0xbd56('0x11')][_0xbd56('0x12')]);}logger[_0xbd56('0x11')](_0xbd56('0xc'),_0x252367,_0x307879[_0xbd56('0x11')]['message']);return _0x47b43c(_0x307879[_0xbd56('0x11')][_0xbd56('0x12')]);}else{logger['info'](_0xbd56('0xc'),_0x252367,'request\x20sent');_0x47b43c(_0x307879['result'][_0xbd56('0x12')]);}})[_0xbd56('0x13')](function(_0x35f6ad){logger[_0xbd56('0x11')](_0xbd56('0xc'),_0x252367,_0x35f6ad);_0x41f6aa(_0x35f6ad);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 3515989..e59b1ff 100644 --- a/server/api/jscriptySessionReport/index.js +++ b/server/api/jscriptySessionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c9a=['util','path','connect-timeout','express','Router','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','/:id/questions','getQuestions','create','delete','multer'];(function(_0x19895d,_0x33e4bd){var _0x3012f8=function(_0x5bbb76){while(--_0x5bbb76){_0x19895d['push'](_0x19895d['shift']());}};_0x3012f8(++_0x33e4bd);}(_0x9c9a,0x76));var _0xa9c9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c9a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa9c9('0x0'));var util=require(_0xa9c9('0x1'));var path=require(_0xa9c9('0x2'));var timeout=require(_0xa9c9('0x3'));var express=require(_0xa9c9('0x4'));var router=express[_0xa9c9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9c9('0x6'));var controller=require(_0xa9c9('0x7'));router[_0xa9c9('0x8')]('/',auth[_0xa9c9('0x9')](),controller['index']);router['get'](_0xa9c9('0xa'),auth[_0xa9c9('0x9')](),controller[_0xa9c9('0xb')]);router['get'](_0xa9c9('0xc'),auth[_0xa9c9('0x9')](),controller['show']);router['get'](_0xa9c9('0xd'),auth[_0xa9c9('0x9')](),controller[_0xa9c9('0xe')]);router['post']('/',auth[_0xa9c9('0x9')](),controller[_0xa9c9('0xf')]);router['put'](_0xa9c9('0xc'),auth[_0xa9c9('0x9')](),controller['update']);router[_0xa9c9('0x10')](_0xa9c9('0xc'),auth[_0xa9c9('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x58c6=['/:id/questions','getQuestions','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x24fc3a,_0x460f70){var _0x888d9c=function(_0x86a5c0){while(--_0x86a5c0){_0x24fc3a['push'](_0x24fc3a['shift']());}};_0x888d9c(++_0x460f70);}(_0x58c6,0x181));var _0x658c=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x58c6[_0x466bc5];return _0x138952;};'use strict';var multer=require(_0x658c('0x0'));var util=require('util');var path=require(_0x658c('0x1'));var timeout=require(_0x658c('0x2'));var express=require('express');var router=express[_0x658c('0x3')]();var fs_extra=require(_0x658c('0x4'));var auth=require(_0x658c('0x5'));var interaction=require(_0x658c('0x6'));var config=require(_0x658c('0x7'));var controller=require(_0x658c('0x8'));router[_0x658c('0x9')]('/',auth[_0x658c('0xa')](),controller[_0x658c('0xb')]);router[_0x658c('0x9')](_0x658c('0xc'),auth[_0x658c('0xa')](),controller[_0x658c('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x658c('0xe')]);router['get'](_0x658c('0xf'),auth[_0x658c('0xa')](),controller[_0x658c('0x10')]);router[_0x658c('0x11')]('/',auth['isAuthenticated'](),controller[_0x658c('0x12')]);router[_0x658c('0x13')]('/:id',auth[_0x658c('0xa')](),controller[_0x658c('0x14')]);router[_0x658c('0x15')](_0x658c('0x16'),auth[_0x658c('0xa')](),controller[_0x658c('0x17')]);module[_0x658c('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9f0ab16..e622daa 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcc2=['YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','moment','exports','setDataValue','endtime','format'];(function(_0x425d5e,_0x3b9040){var _0x3cc67b=function(_0x121446){while(--_0x121446){_0x425d5e['push'](_0x425d5e['shift']());}};_0x3cc67b(++_0x3b9040);}(_0xbcc2,0x93));var _0x2bcc=function(_0x5f4749,_0x50acc3){_0x5f4749=_0x5f4749-0x0;var _0x57d267=_0xbcc2[_0x5f4749];return _0x57d267;};'use strict';var moment=require(_0x2bcc('0x0'));var Sequelize=require('sequelize');module[_0x2bcc('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3fe763){this[_0x2bcc('0x2')]('starttime',_0x3fe763);this['setDataValue'](_0x2bcc('0x3'),moment()[_0x2bcc('0x4')](_0x2bcc('0x5')));}},'endtime':{'type':Sequelize[_0x2bcc('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2bcc('0x7')]},'queue':{'type':Sequelize[_0x2bcc('0x7')]},'uniqueid':{'type':Sequelize[_0x2bcc('0x7')]},'calleridname':{'type':Sequelize[_0x2bcc('0x7')]},'calleridnum':{'type':Sequelize[_0x2bcc('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7669=['sequelize','exports','setDataValue','starttime','endtime','format','DATE','STRING','BOOLEAN','moment'];(function(_0x4c4fda,_0x3b1a99){var _0x1a9bc4=function(_0x4ad743){while(--_0x4ad743){_0x4c4fda['push'](_0x4c4fda['shift']());}};_0x1a9bc4(++_0x3b1a99);}(_0x7669,0xe5));var _0x9766=function(_0x1673ba,_0x3ec489){_0x1673ba=_0x1673ba-0x0;var _0x3c6899=_0x7669[_0x1673ba];return _0x3c6899;};'use strict';var moment=require(_0x9766('0x0'));var Sequelize=require(_0x9766('0x1'));module[_0x9766('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xceb9ac){this[_0x9766('0x3')](_0x9766('0x4'),_0xceb9ac);this[_0x9766('0x3')](_0x9766('0x5'),moment()[_0x9766('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x9766('0x7')]},'membername':{'type':Sequelize[_0x9766('0x8')]},'projectname':{'type':Sequelize[_0x9766('0x8')]},'queue':{'type':Sequelize[_0x9766('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9766('0x8')]},'calleridnum':{'type':Sequelize[_0x9766('0x8')]},'completed':{'type':Sequelize[_0x9766('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e7bc350..bf3a565 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ad9=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','error','stack','name','JscriptySessionReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rimraf'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x7ad9,0xe3));var _0x97ad=function(_0x7018c4,_0x9837fc){_0x7018c4=_0x7018c4-0x0;var _0x3c52d4=_0x7ad9[_0x7018c4];return _0x3c52d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97ad('0x0'));var zipdir=require(_0x97ad('0x1'));var jsonpatch=require(_0x97ad('0x2'));var rp=require(_0x97ad('0x3'));var moment=require('moment');var BPromise=require(_0x97ad('0x4'));var Mustache=require(_0x97ad('0x5'));var util=require(_0x97ad('0x6'));var path=require(_0x97ad('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x97ad('0x8'));var fs=require('fs');var fs_extra=require(_0x97ad('0x9'));var _=require(_0x97ad('0xa'));var squel=require(_0x97ad('0xb'));var crypto=require(_0x97ad('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x97ad('0xd'));var toCsv=require(_0x97ad('0xe'));var querystring=require(_0x97ad('0xf'));var Papa=require('papaparse');var Redis=require(_0x97ad('0x10'));var authService=require(_0x97ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x97ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97ad('0x13'))('api');var utils=require(_0x97ad('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x97ad('0x15'))['db'];function respondWithStatusCode(_0x5e81b6,_0x4d253c){_0x4d253c=_0x4d253c||0xcc;return function(_0x78ac1d){if(_0x78ac1d){return _0x5e81b6['sendStatus'](_0x4d253c);}return _0x5e81b6[_0x97ad('0x16')](_0x4d253c)[_0x97ad('0x17')]();};}function respondWithResult(_0xc98cd8,_0x56ffd3){_0x56ffd3=_0x56ffd3||0xc8;return function(_0x498d4b){if(_0x498d4b){return _0xc98cd8[_0x97ad('0x16')](_0x56ffd3)[_0x97ad('0x18')](_0x498d4b);}};}function respondWithFilteredResult(_0x8e19b8,_0x42eda2){return function(_0x36c9a1){if(_0x36c9a1){var _0x4dac2b=typeof _0x42eda2[_0x97ad('0x19')]==='undefined'&&typeof _0x42eda2[_0x97ad('0x1a')]===_0x97ad('0x1b');var _0x65876d=_0x36c9a1[_0x97ad('0x1c')];var _0x8bd1c4=_0x4dac2b?0x0:_0x42eda2[_0x97ad('0x19')];var _0x239ddb=_0x4dac2b?_0x36c9a1[_0x97ad('0x1c')]:_0x42eda2[_0x97ad('0x19')]+_0x42eda2['limit'];var _0x5e28db;if(_0x239ddb>=_0x65876d){_0x239ddb=_0x65876d;_0x5e28db=0xc8;}else{_0x5e28db=0xce;}_0x8e19b8['status'](_0x5e28db);return _0x8e19b8['set'](_0x97ad('0x1d'),_0x8bd1c4+'-'+_0x239ddb+'/'+_0x65876d)[_0x97ad('0x18')](_0x36c9a1);}return null;};}function patchUpdates(_0x154eb8){return function(_0x3f22fc){try{jsonpatch['apply'](_0x3f22fc,_0x154eb8,!![]);}catch(_0x17f752){return BPromise[_0x97ad('0x1e')](_0x17f752);}return _0x3f22fc[_0x97ad('0x1f')]();};}function saveUpdates(_0x47e28b,_0x4e4213){return function(_0x22ab87){if(_0x22ab87){return _0x22ab87[_0x97ad('0x20')](_0x47e28b)['then'](function(_0x4a9f6b){return _0x4a9f6b;});}return null;};}function removeEntity(_0x31f080,_0x3c9115){return function(_0x206487){if(_0x206487){return _0x206487['destroy']()[_0x97ad('0x21')](function(){_0x31f080['status'](0xcc)[_0x97ad('0x17')]();});}};}function handleEntityNotFound(_0x3bb93a,_0x5e1e06){return function(_0x5563ee){if(!_0x5563ee){_0x3bb93a['sendStatus'](0x194);}return _0x5563ee;};}function handleError(_0x65b0,_0x55c72f){_0x55c72f=_0x55c72f||0x1f4;return function(_0x1d0c22){logger[_0x97ad('0x22')](_0x1d0c22[_0x97ad('0x23')]);if(_0x1d0c22['name']){delete _0x1d0c22[_0x97ad('0x24')];}_0x65b0['status'](_0x55c72f)['send'](_0x1d0c22);};}exports['index']=function(_0x48e3db,_0x159973){var _0x275f1e={},_0x250ca6={},_0x5b7aaf={'count':0x0,'rows':[]};var _0x30c738=_['map'](db[_0x97ad('0x25')][_0x97ad('0x26')],function(_0x168eab){return{'name':_0x168eab[_0x97ad('0x27')],'type':_0x168eab[_0x97ad('0x28')]['key']};});_0x250ca6[_0x97ad('0x29')]=_[_0x97ad('0x2a')](_0x30c738,_0x97ad('0x24'));_0x250ca6[_0x97ad('0x2b')]=_[_0x97ad('0x2c')](_0x48e3db['query']);_0x250ca6[_0x97ad('0x2d')]=_[_0x97ad('0x2e')](_0x250ca6['model'],_0x250ca6[_0x97ad('0x2b')]);_0x275f1e[_0x97ad('0x2f')]=_[_0x97ad('0x2e')](_0x250ca6[_0x97ad('0x29')],qs[_0x97ad('0x30')](_0x48e3db[_0x97ad('0x2b')]['fields']));_0x275f1e[_0x97ad('0x2f')]=_0x275f1e[_0x97ad('0x2f')]['length']?_0x275f1e[_0x97ad('0x2f')]:_0x250ca6[_0x97ad('0x29')];if(!_0x48e3db[_0x97ad('0x2b')][_0x97ad('0x31')](_0x97ad('0x32'))){_0x275f1e[_0x97ad('0x1a')]=qs['limit'](_0x48e3db[_0x97ad('0x2b')][_0x97ad('0x1a')]);_0x275f1e[_0x97ad('0x19')]=qs[_0x97ad('0x19')](_0x48e3db[_0x97ad('0x2b')][_0x97ad('0x19')]);}_0x275f1e[_0x97ad('0x33')]=qs[_0x97ad('0x34')](_0x48e3db['query'][_0x97ad('0x34')]);_0x275f1e[_0x97ad('0x35')]=qs[_0x97ad('0x2d')](_[_0x97ad('0x36')](_0x48e3db[_0x97ad('0x2b')],_0x250ca6['filters']),_0x30c738);if(_0x48e3db[_0x97ad('0x2b')]['filter']){_0x275f1e[_0x97ad('0x35')]=_[_0x97ad('0x37')](_0x275f1e[_0x97ad('0x35')],{'$or':_['map'](_0x30c738,function(_0x3c210b){if(_0x3c210b['type']!==_0x97ad('0x38')){var _0x45b674={};_0x45b674[_0x3c210b[_0x97ad('0x24')]]={'$like':'%'+_0x48e3db[_0x97ad('0x2b')][_0x97ad('0x39')]+'%'};return _0x45b674;}})});}_0x275f1e=_[_0x97ad('0x37')]({},_0x275f1e,_0x48e3db[_0x97ad('0x3a')]);var _0x118d8c={'where':_0x275f1e['where']};return db['JscriptySessionReport'][_0x97ad('0x1c')](_0x118d8c)[_0x97ad('0x21')](function(_0x27cf4b){_0x5b7aaf[_0x97ad('0x1c')]=_0x27cf4b;if(_0x48e3db[_0x97ad('0x2b')][_0x97ad('0x3b')]){_0x275f1e[_0x97ad('0x3c')]=[{'all':!![]}];}return db[_0x97ad('0x25')][_0x97ad('0x3d')](_0x275f1e);})[_0x97ad('0x21')](function(_0x3bf64e){_0x5b7aaf[_0x97ad('0x3e')]=_0x3bf64e;return _0x5b7aaf;})[_0x97ad('0x21')](respondWithFilteredResult(_0x159973,_0x275f1e))[_0x97ad('0x3f')](handleError(_0x159973,null));};exports[_0x97ad('0x40')]=function(_0x44ff28,_0x2dad9e){var _0x226df3={'raw':!![],'where':{'id':_0x44ff28[_0x97ad('0x41')]['id']}},_0x156564={};_0x156564['model']=_[_0x97ad('0x2c')](db[_0x97ad('0x25')][_0x97ad('0x26')]);_0x156564['query']=_[_0x97ad('0x2c')](_0x44ff28['query']);_0x156564['filters']=_[_0x97ad('0x2e')](_0x156564[_0x97ad('0x29')],_0x156564[_0x97ad('0x2b')]);_0x226df3[_0x97ad('0x2f')]=_[_0x97ad('0x2e')](_0x156564['model'],qs['fields'](_0x44ff28[_0x97ad('0x2b')][_0x97ad('0x30')]));_0x226df3[_0x97ad('0x2f')]=_0x226df3[_0x97ad('0x2f')][_0x97ad('0x42')]?_0x226df3[_0x97ad('0x2f')]:_0x156564[_0x97ad('0x29')];if(_0x44ff28[_0x97ad('0x2b')][_0x97ad('0x3b')]){_0x226df3['include']=[{'all':!![]}];}_0x226df3=_['merge']({},_0x226df3,_0x44ff28['options']);return db['JscriptySessionReport'][_0x97ad('0x43')](_0x226df3)[_0x97ad('0x21')](handleEntityNotFound(_0x2dad9e,null))['then'](respondWithResult(_0x2dad9e,null))[_0x97ad('0x3f')](handleError(_0x2dad9e,null));};exports['create']=function(_0x5295e0,_0x43cb94){return db[_0x97ad('0x25')][_0x97ad('0x44')](_0x5295e0[_0x97ad('0x45')],{})[_0x97ad('0x21')](respondWithResult(_0x43cb94,0xc9))[_0x97ad('0x3f')](handleError(_0x43cb94,null));};exports['update']=function(_0x51c038,_0x2b781c){if(_0x51c038[_0x97ad('0x45')]['id']){delete _0x51c038[_0x97ad('0x45')]['id'];}return db[_0x97ad('0x25')][_0x97ad('0x43')]({'where':{'id':_0x51c038[_0x97ad('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b781c,null))[_0x97ad('0x21')](saveUpdates(_0x51c038['body'],null))['then'](respondWithResult(_0x2b781c,null))[_0x97ad('0x3f')](handleError(_0x2b781c,null));};exports[_0x97ad('0x46')]=function(_0x5dc253,_0x9130a3){return db[_0x97ad('0x25')]['find']({'where':{'id':_0x5dc253[_0x97ad('0x41')]['id']}})[_0x97ad('0x21')](handleEntityNotFound(_0x9130a3,null))[_0x97ad('0x21')](removeEntity(_0x9130a3,null))[_0x97ad('0x3f')](handleError(_0x9130a3,null));};exports[_0x97ad('0x47')]=function(_0x566ad7,_0x2fe4be){return db[_0x97ad('0x25')]['describe']()[_0x97ad('0x21')](respondWithResult(_0x2fe4be,null))[_0x97ad('0x3f')](handleError(_0x2fe4be,null));};exports[_0x97ad('0x48')]=function(_0x5e87f8,_0x5c3356,_0x44e605){var _0xa2ba7f={'raw':!![],'where':{}};var _0x4872a1={};var _0x405eee={'count':0x0,'rows':[]};return db[_0x97ad('0x25')][_0x97ad('0x49')]({'where':{'id':_0x5e87f8['params']['id']}})[_0x97ad('0x21')](handleEntityNotFound(_0x5c3356,null))[_0x97ad('0x21')](function(_0x26fc59){if(_0x26fc59){_0x4872a1[_0x97ad('0x29')]=_[_0x97ad('0x2c')](db[_0x97ad('0x4a')][_0x97ad('0x26')]);_0x4872a1[_0x97ad('0x2b')]=_['keys'](_0x5e87f8[_0x97ad('0x2b')]);_0x4872a1['filters']=_['intersection'](_0x4872a1[_0x97ad('0x29')],_0x4872a1['query']);_0xa2ba7f[_0x97ad('0x2f')]=_['intersection'](_0x4872a1[_0x97ad('0x29')],qs[_0x97ad('0x30')](_0x5e87f8[_0x97ad('0x2b')][_0x97ad('0x30')]));_0xa2ba7f['attributes']=_0xa2ba7f['attributes'][_0x97ad('0x42')]?_0xa2ba7f['attributes']:_0x4872a1['model'];if(!_0x5e87f8[_0x97ad('0x2b')][_0x97ad('0x31')]('nolimit')){_0xa2ba7f[_0x97ad('0x1a')]=qs[_0x97ad('0x1a')](_0x5e87f8[_0x97ad('0x2b')][_0x97ad('0x1a')]);_0xa2ba7f['offset']=qs[_0x97ad('0x19')](_0x5e87f8['query']['offset']);}_0xa2ba7f[_0x97ad('0x33')]=qs['sort'](_0x5e87f8[_0x97ad('0x2b')]['sort']);_0xa2ba7f[_0x97ad('0x35')]=qs[_0x97ad('0x2d')](_[_0x97ad('0x36')](_0x5e87f8[_0x97ad('0x2b')],_0x4872a1[_0x97ad('0x2d')]));_0xa2ba7f[_0x97ad('0x35')][_0x97ad('0x4b')]=_0x26fc59['id'];if(_0x5e87f8['query'][_0x97ad('0x39')]){_0xa2ba7f[_0x97ad('0x35')]=_[_0x97ad('0x37')](_0xa2ba7f['where'],{'$or':_[_0x97ad('0x2a')](_0xa2ba7f[_0x97ad('0x2f')],function(_0x535725){var _0x4e57c2={};_0x4e57c2[_0x535725]={'$like':'%'+_0x5e87f8[_0x97ad('0x2b')][_0x97ad('0x39')]+'%'};return _0x4e57c2;})});}_0xa2ba7f=_['merge']({},_0xa2ba7f,_0x5e87f8['options']);return db['JscriptyQuestionReport'][_0x97ad('0x1c')]({'where':_0xa2ba7f[_0x97ad('0x35')]})[_0x97ad('0x21')](function(_0x55d816){_0x405eee[_0x97ad('0x1c')]=_0x55d816;if(_0x5e87f8['query'][_0x97ad('0x3b')]){_0xa2ba7f[_0x97ad('0x3c')]=[{'all':!![]}];}return db[_0x97ad('0x4a')][_0x97ad('0x3d')](_0xa2ba7f);})[_0x97ad('0x21')](function(_0x52be7d){_0x405eee[_0x97ad('0x3e')]=_0x52be7d;return _0x405eee;});}})['then'](respondWithFilteredResult(_0x5c3356,_0xa2ba7f))['catch'](handleError(_0x5c3356,null));}; \ No newline at end of file +var _0xd695=['options','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getQuestions','hasOwnProperty','order','SessionId'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xd695,0xa4));var _0x5d69=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0xd695[_0x456a4b];return _0x42957c;};'use strict';var emlformat=require(_0x5d69('0x0'));var rimraf=require(_0x5d69('0x1'));var zipdir=require(_0x5d69('0x2'));var jsonpatch=require(_0x5d69('0x3'));var rp=require(_0x5d69('0x4'));var moment=require('moment');var BPromise=require(_0x5d69('0x5'));var Mustache=require('mustache');var util=require(_0x5d69('0x6'));var path=require(_0x5d69('0x7'));var sox=require(_0x5d69('0x8'));var csv=require(_0x5d69('0x9'));var ejs=require(_0x5d69('0xa'));var fs=require('fs');var fs_extra=require(_0x5d69('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d69('0xc'));var jsforce=require(_0x5d69('0xd'));var deskjs=require(_0x5d69('0xe'));var toCsv=require(_0x5d69('0x9'));var querystring=require(_0x5d69('0xf'));var Papa=require(_0x5d69('0x10'));var Redis=require('ioredis');var authService=require(_0x5d69('0x11'));var qs=require(_0x5d69('0x12'));var as=require(_0x5d69('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5d69('0x14'));var utils=require(_0x5d69('0x15'));var config=require(_0x5d69('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d69('0x17'))['db'];function respondWithStatusCode(_0x3816e,_0x1ccf35){_0x1ccf35=_0x1ccf35||0xcc;return function(_0x499f4a){if(_0x499f4a){return _0x3816e['sendStatus'](_0x1ccf35);}return _0x3816e[_0x5d69('0x18')](_0x1ccf35)[_0x5d69('0x19')]();};}function respondWithResult(_0x3682ba,_0x5daa0e){_0x5daa0e=_0x5daa0e||0xc8;return function(_0x2dfd88){if(_0x2dfd88){return _0x3682ba[_0x5d69('0x18')](_0x5daa0e)[_0x5d69('0x1a')](_0x2dfd88);}};}function respondWithFilteredResult(_0x115868,_0x299998){return function(_0x5bf6ef){if(_0x5bf6ef){var _0x2edc00=typeof _0x299998[_0x5d69('0x1b')]===_0x5d69('0x1c')&&typeof _0x299998[_0x5d69('0x1d')]==='undefined';var _0xe65826=_0x5bf6ef['count'];var _0x154c7e=_0x2edc00?0x0:_0x299998[_0x5d69('0x1b')];var _0x51ccc8=_0x2edc00?_0x5bf6ef[_0x5d69('0x1e')]:_0x299998[_0x5d69('0x1b')]+_0x299998[_0x5d69('0x1d')];var _0x4b72b7;if(_0x51ccc8>=_0xe65826){_0x51ccc8=_0xe65826;_0x4b72b7=0xc8;}else{_0x4b72b7=0xce;}_0x115868[_0x5d69('0x18')](_0x4b72b7);return _0x115868[_0x5d69('0x1f')](_0x5d69('0x20'),_0x154c7e+'-'+_0x51ccc8+'/'+_0xe65826)[_0x5d69('0x1a')](_0x5bf6ef);}return null;};}function patchUpdates(_0x35509d){return function(_0xfa954e){try{jsonpatch['apply'](_0xfa954e,_0x35509d,!![]);}catch(_0x286b18){return BPromise[_0x5d69('0x21')](_0x286b18);}return _0xfa954e[_0x5d69('0x22')]();};}function saveUpdates(_0x165247,_0x3d76e7){return function(_0x24048a){if(_0x24048a){return _0x24048a[_0x5d69('0x23')](_0x165247)[_0x5d69('0x24')](function(_0x1f3c34){return _0x1f3c34;});}return null;};}function removeEntity(_0x12c998,_0x57eb69){return function(_0x4f52ef){if(_0x4f52ef){return _0x4f52ef[_0x5d69('0x25')]()[_0x5d69('0x24')](function(){_0x12c998['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b310,_0x79d4bb){return function(_0x2e6737){if(!_0x2e6737){_0x19b310[_0x5d69('0x26')](0x194);}return _0x2e6737;};}function handleError(_0x26b80c,_0x22e068){_0x22e068=_0x22e068||0x1f4;return function(_0x858d2){logger[_0x5d69('0x27')](_0x858d2[_0x5d69('0x28')]);if(_0x858d2[_0x5d69('0x29')]){delete _0x858d2[_0x5d69('0x29')];}_0x26b80c['status'](_0x22e068)['send'](_0x858d2);};}exports[_0x5d69('0x2a')]=function(_0x273137,_0x17027e){var _0x5a5ec={},_0x5ce001={},_0x313fb9={'count':0x0,'rows':[]};var _0x2cc768=_[_0x5d69('0x2b')](db[_0x5d69('0x2c')][_0x5d69('0x2d')],function(_0x33dcb2){return{'name':_0x33dcb2[_0x5d69('0x2e')],'type':_0x33dcb2[_0x5d69('0x2f')][_0x5d69('0x30')]};});_0x5ce001[_0x5d69('0x31')]=_[_0x5d69('0x2b')](_0x2cc768,_0x5d69('0x29'));_0x5ce001['query']=_[_0x5d69('0x32')](_0x273137[_0x5d69('0x33')]);_0x5ce001[_0x5d69('0x34')]=_[_0x5d69('0x35')](_0x5ce001[_0x5d69('0x31')],_0x5ce001[_0x5d69('0x33')]);_0x5a5ec['attributes']=_['intersection'](_0x5ce001[_0x5d69('0x31')],qs[_0x5d69('0x36')](_0x273137['query'][_0x5d69('0x36')]));_0x5a5ec[_0x5d69('0x37')]=_0x5a5ec[_0x5d69('0x37')][_0x5d69('0x38')]?_0x5a5ec[_0x5d69('0x37')]:_0x5ce001[_0x5d69('0x31')];if(!_0x273137['query']['hasOwnProperty'](_0x5d69('0x39'))){_0x5a5ec[_0x5d69('0x1d')]=qs[_0x5d69('0x1d')](_0x273137['query'][_0x5d69('0x1d')]);_0x5a5ec[_0x5d69('0x1b')]=qs[_0x5d69('0x1b')](_0x273137[_0x5d69('0x33')]['offset']);}_0x5a5ec['order']=qs[_0x5d69('0x3a')](_0x273137[_0x5d69('0x33')][_0x5d69('0x3a')]);_0x5a5ec[_0x5d69('0x3b')]=qs[_0x5d69('0x34')](_[_0x5d69('0x3c')](_0x273137[_0x5d69('0x33')],_0x5ce001['filters']),_0x2cc768);if(_0x273137['query'][_0x5d69('0x3d')]){_0x5a5ec[_0x5d69('0x3b')]=_[_0x5d69('0x3e')](_0x5a5ec[_0x5d69('0x3b')],{'$or':_['map'](_0x2cc768,function(_0x406750){if(_0x406750[_0x5d69('0x2f')]!==_0x5d69('0x3f')){var _0x107c58={};_0x107c58[_0x406750[_0x5d69('0x29')]]={'$like':'%'+_0x273137[_0x5d69('0x33')][_0x5d69('0x3d')]+'%'};return _0x107c58;}})});}_0x5a5ec=_[_0x5d69('0x3e')]({},_0x5a5ec,_0x273137['options']);var _0x455f82={'where':_0x5a5ec[_0x5d69('0x3b')]};return db[_0x5d69('0x2c')]['count'](_0x455f82)['then'](function(_0x5ebe7f){_0x313fb9['count']=_0x5ebe7f;if(_0x273137[_0x5d69('0x33')]['includeAll']){_0x5a5ec[_0x5d69('0x40')]=[{'all':!![]}];}return db[_0x5d69('0x2c')][_0x5d69('0x41')](_0x5a5ec);})[_0x5d69('0x24')](function(_0x1332a4){_0x313fb9[_0x5d69('0x42')]=_0x1332a4;return _0x313fb9;})[_0x5d69('0x24')](respondWithFilteredResult(_0x17027e,_0x5a5ec))[_0x5d69('0x43')](handleError(_0x17027e,null));};exports[_0x5d69('0x44')]=function(_0x1370b8,_0x3023eb){var _0x596c59={'raw':!![],'where':{'id':_0x1370b8[_0x5d69('0x45')]['id']}},_0x185eff={};_0x185eff[_0x5d69('0x31')]=_['keys'](db[_0x5d69('0x2c')][_0x5d69('0x2d')]);_0x185eff[_0x5d69('0x33')]=_['keys'](_0x1370b8[_0x5d69('0x33')]);_0x185eff[_0x5d69('0x34')]=_[_0x5d69('0x35')](_0x185eff[_0x5d69('0x31')],_0x185eff[_0x5d69('0x33')]);_0x596c59['attributes']=_[_0x5d69('0x35')](_0x185eff['model'],qs['fields'](_0x1370b8['query']['fields']));_0x596c59[_0x5d69('0x37')]=_0x596c59[_0x5d69('0x37')]['length']?_0x596c59[_0x5d69('0x37')]:_0x185eff[_0x5d69('0x31')];if(_0x1370b8[_0x5d69('0x33')][_0x5d69('0x46')]){_0x596c59[_0x5d69('0x40')]=[{'all':!![]}];}_0x596c59=_[_0x5d69('0x3e')]({},_0x596c59,_0x1370b8['options']);return db[_0x5d69('0x2c')][_0x5d69('0x47')](_0x596c59)['then'](handleEntityNotFound(_0x3023eb,null))[_0x5d69('0x24')](respondWithResult(_0x3023eb,null))[_0x5d69('0x43')](handleError(_0x3023eb,null));};exports[_0x5d69('0x48')]=function(_0x79ca43,_0x1f6075){return db['JscriptySessionReport']['create'](_0x79ca43[_0x5d69('0x49')],{})[_0x5d69('0x24')](respondWithResult(_0x1f6075,0xc9))['catch'](handleError(_0x1f6075,null));};exports[_0x5d69('0x23')]=function(_0x26f23f,_0x24c5ed){if(_0x26f23f['body']['id']){delete _0x26f23f['body']['id'];}return db[_0x5d69('0x2c')][_0x5d69('0x47')]({'where':{'id':_0x26f23f[_0x5d69('0x45')]['id']}})['then'](handleEntityNotFound(_0x24c5ed,null))['then'](saveUpdates(_0x26f23f[_0x5d69('0x49')],null))[_0x5d69('0x24')](respondWithResult(_0x24c5ed,null))[_0x5d69('0x43')](handleError(_0x24c5ed,null));};exports['destroy']=function(_0x29294f,_0x2fd7d6){return db['JscriptySessionReport'][_0x5d69('0x47')]({'where':{'id':_0x29294f[_0x5d69('0x45')]['id']}})[_0x5d69('0x24')](handleEntityNotFound(_0x2fd7d6,null))[_0x5d69('0x24')](removeEntity(_0x2fd7d6,null))['catch'](handleError(_0x2fd7d6,null));};exports['describe']=function(_0x32b802,_0x77fcc1){return db[_0x5d69('0x2c')][_0x5d69('0x4a')]()['then'](respondWithResult(_0x77fcc1,null))[_0x5d69('0x43')](handleError(_0x77fcc1,null));};exports[_0x5d69('0x4b')]=function(_0x4b5504,_0x3f240e,_0x5723bf){var _0x55afb3={'raw':!![],'where':{}};var _0x59bef1={};var _0x16f36d={'count':0x0,'rows':[]};return db[_0x5d69('0x2c')]['findOne']({'where':{'id':_0x4b5504['params']['id']}})[_0x5d69('0x24')](handleEntityNotFound(_0x3f240e,null))[_0x5d69('0x24')](function(_0x2cbcfd){if(_0x2cbcfd){_0x59bef1['model']=_[_0x5d69('0x32')](db['JscriptyQuestionReport'][_0x5d69('0x2d')]);_0x59bef1[_0x5d69('0x33')]=_[_0x5d69('0x32')](_0x4b5504[_0x5d69('0x33')]);_0x59bef1[_0x5d69('0x34')]=_[_0x5d69('0x35')](_0x59bef1[_0x5d69('0x31')],_0x59bef1['query']);_0x55afb3[_0x5d69('0x37')]=_[_0x5d69('0x35')](_0x59bef1['model'],qs[_0x5d69('0x36')](_0x4b5504[_0x5d69('0x33')][_0x5d69('0x36')]));_0x55afb3[_0x5d69('0x37')]=_0x55afb3[_0x5d69('0x37')][_0x5d69('0x38')]?_0x55afb3[_0x5d69('0x37')]:_0x59bef1[_0x5d69('0x31')];if(!_0x4b5504[_0x5d69('0x33')][_0x5d69('0x4c')](_0x5d69('0x39'))){_0x55afb3[_0x5d69('0x1d')]=qs[_0x5d69('0x1d')](_0x4b5504[_0x5d69('0x33')][_0x5d69('0x1d')]);_0x55afb3[_0x5d69('0x1b')]=qs[_0x5d69('0x1b')](_0x4b5504[_0x5d69('0x33')]['offset']);}_0x55afb3[_0x5d69('0x4d')]=qs['sort'](_0x4b5504['query'][_0x5d69('0x3a')]);_0x55afb3[_0x5d69('0x3b')]=qs['filters'](_[_0x5d69('0x3c')](_0x4b5504[_0x5d69('0x33')],_0x59bef1[_0x5d69('0x34')]));_0x55afb3[_0x5d69('0x3b')][_0x5d69('0x4e')]=_0x2cbcfd['id'];if(_0x4b5504['query'][_0x5d69('0x3d')]){_0x55afb3[_0x5d69('0x3b')]=_[_0x5d69('0x3e')](_0x55afb3[_0x5d69('0x3b')],{'$or':_['map'](_0x55afb3[_0x5d69('0x37')],function(_0xf39873){var _0x2f875e={};_0x2f875e[_0xf39873]={'$like':'%'+_0x4b5504[_0x5d69('0x33')][_0x5d69('0x3d')]+'%'};return _0x2f875e;})});}_0x55afb3=_[_0x5d69('0x3e')]({},_0x55afb3,_0x4b5504[_0x5d69('0x4f')]);return db[_0x5d69('0x50')][_0x5d69('0x1e')]({'where':_0x55afb3[_0x5d69('0x3b')]})[_0x5d69('0x24')](function(_0x1958a0){_0x16f36d[_0x5d69('0x1e')]=_0x1958a0;if(_0x4b5504[_0x5d69('0x33')]['includeAll']){_0x55afb3['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x55afb3);})['then'](function(_0x57b484){_0x16f36d[_0x5d69('0x42')]=_0x57b484;return _0x16f36d;});}})[_0x5d69('0x24')](respondWithFilteredResult(_0x3f240e,_0x55afb3))[_0x5d69('0x43')](handleError(_0x3f240e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6407189..7dad628 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ee1=['report_jscripty_sessions','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x59f4ee,_0x24d657){var _0x580873=function(_0x192b9d){while(--_0x192b9d){_0x59f4ee['push'](_0x59f4ee['shift']());}};_0x580873(++_0x24d657);}(_0x7ee1,0x8d));var _0x17ee=function(_0xa3d440,_0x2978cb){_0xa3d440=_0xa3d440-0x0;var _0x2a17a9=_0x7ee1[_0xa3d440];return _0x2a17a9;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x4864ea,_0x7764ed){var _0x12e74f=function(_0x3fe41d){while(--_0x3fe41d){_0x4864ea['push'](_0x4864ea['shift']());}};_0x12e74f(++_0x7764ed);}(_0x723e,0x179));var _0xe723=function(_0x1198a7,_0x58ca47){_0x1198a7=_0x1198a7-0x0;var _0x34e937=_0x723e[_0x1198a7];return _0x34e937;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 6137f77..8a71872 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0424,0x159));var _0x4042=function(_0x23e4b4,_0x132419){_0x23e4b4=_0x23e4b4-0x0;var _0x3bc471=_0x0424[_0x23e4b4];return _0x3bc471;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file +var _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x278dd7,_0x59de46){var _0x2ad2b7=function(_0x2da0ef){while(--_0x2da0ef){_0x278dd7['push'](_0x278dd7['shift']());}};_0x2ad2b7(++_0x59de46);}(_0x1883,0xab));var _0x3188=function(_0x1c01fa,_0x8a5a1e){_0x1c01fa=_0x1c01fa-0x0;var _0x21591a=_0x1883[_0x1c01fa];return _0x21591a;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4d39ad8..c6befe1 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf603=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put','/:id','update','/download_log_file','isAuthenticated'];(function(_0x524d6f,_0x4a1ed3){var _0xe528d8=function(_0x1748b0){while(--_0x1748b0){_0x524d6f['push'](_0x524d6f['shift']());}};_0xe528d8(++_0x4a1ed3);}(_0xf603,0x11e));var _0x3f60=function(_0x2871cc,_0x3b72cf){_0x2871cc=_0x2871cc-0x0;var _0x110cc7=_0xf603[_0x2871cc];return _0x110cc7;};'use strict';var multer=require(_0x3f60('0x0'));var util=require(_0x3f60('0x1'));var path=require('path');var timeout=require(_0x3f60('0x2'));var express=require(_0x3f60('0x3'));var router=express[_0x3f60('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f60('0x5'));var interaction=require(_0x3f60('0x6'));var config=require(_0x3f60('0x7'));var controller=require('./license.controller');router[_0x3f60('0x8')]('/',controller['index']);router[_0x3f60('0x9')](_0x3f60('0xa'),auth['isAuthenticated'](),controller[_0x3f60('0xb')]);router[_0x3f60('0x8')](_0x3f60('0xc'),auth[_0x3f60('0xd')](),controller['downloadLogFile']);module[_0x3f60('0xe')]=router; \ No newline at end of file +var _0xf5d9=['isAuthenticated','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x53e1d8,_0x29c784){var _0xf1d188=function(_0x34ea1a){while(--_0x34ea1a){_0x53e1d8['push'](_0x53e1d8['shift']());}};_0xf1d188(++_0x29c784);}(_0xf5d9,0x1bc));var _0x9f5d=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xf5d9[_0x1db251];return _0x56685a;};'use strict';var multer=require('multer');var util=require(_0x9f5d('0x0'));var path=require(_0x9f5d('0x1'));var timeout=require(_0x9f5d('0x2'));var express=require(_0x9f5d('0x3'));var router=express[_0x9f5d('0x4')]();var fs_extra=require(_0x9f5d('0x5'));var auth=require(_0x9f5d('0x6'));var interaction=require(_0x9f5d('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x9f5d('0x8')]('/',controller[_0x9f5d('0x9')]);router['put'](_0x9f5d('0xa'),auth[_0x9f5d('0xb')](),controller[_0x9f5d('0xc')]);router['get']('/download_log_file',auth[_0x9f5d('0xb')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d850648..a7e2202 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe982=['sequelize','exports','TEXT','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe982,0x150));var _0x2e98=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe982[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x2e98('0x0'));module[_0x2e98('0x1')]={'license':{'type':Sequelize[_0x2e98('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x2e98('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xda50=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x568ea1,_0x5adc3f){var _0x4d72fd=function(_0x4bd9fe){while(--_0x4bd9fe){_0x568ea1['push'](_0x568ea1['shift']());}};_0x4d72fd(++_0x5adc3f);}(_0xda50,0x10d));var _0x0da5=function(_0x305639,_0x555250){_0x305639=_0x305639-0x0;var _0x53d611=_0xda50[_0x305639];return _0x53d611;};'use strict';var Sequelize=require(_0x0da5('0x0'));module[_0x0da5('0x1')]={'license':{'type':Sequelize[_0x0da5('0x2')]},'data1':{'type':Sequelize[_0x0da5('0x3')]},'data2':{'type':Sequelize[_0x0da5('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x0da5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 198a2ec..a956baf 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0cb=['key','demo','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','download','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','getLicense','catch','body','params','get','checkLicense'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0cb,0xd9));var _0xbf0c=function(_0x4a4d88,_0x2be95a){_0x4a4d88=_0x4a4d88-0x0;var _0x479329=_0xf0cb[_0x4a4d88];return _0x479329;};'use strict';var emlformat=require(_0xbf0c('0x0'));var rimraf=require(_0xbf0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf0c('0x2'));var rp=require('request-promise');var moment=require(_0xbf0c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf0c('0x4'));var util=require(_0xbf0c('0x5'));var path=require('path');var sox=require(_0xbf0c('0x6'));var csv=require('to-csv');var ejs=require(_0xbf0c('0x7'));var fs=require('fs');var fs_extra=require(_0xbf0c('0x8'));var _=require(_0xbf0c('0x9'));var squel=require('squel');var crypto=require(_0xbf0c('0xa'));var jsforce=require(_0xbf0c('0xb'));var deskjs=require(_0xbf0c('0xc'));var toCsv=require(_0xbf0c('0xd'));var querystring=require(_0xbf0c('0xe'));var Papa=require(_0xbf0c('0xf'));var Redis=require(_0xbf0c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf0c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbf0c('0x12'));var config=require(_0xbf0c('0x13'));var licenseUtil=require(_0xbf0c('0x14'));var db=require(_0xbf0c('0x15'))['db'];function respondWithStatusCode(_0x2d9d0a,_0xbec77e){_0xbec77e=_0xbec77e||0xcc;return function(_0x54a17c){if(_0x54a17c){return _0x2d9d0a['sendStatus'](_0xbec77e);}return _0x2d9d0a[_0xbf0c('0x16')](_0xbec77e)[_0xbf0c('0x17')]();};}function respondWithResult(_0x182640,_0x41c19a){_0x41c19a=_0x41c19a||0xc8;return function(_0x3af01c){if(_0x3af01c){return _0x182640['status'](_0x41c19a)[_0xbf0c('0x18')](_0x3af01c);}};}function respondWithFilteredResult(_0x29d34d,_0x75ca59){return function(_0xa99416){if(_0xa99416){var _0x40c571=typeof _0x75ca59[_0xbf0c('0x19')]===_0xbf0c('0x1a')&&typeof _0x75ca59[_0xbf0c('0x1b')]===_0xbf0c('0x1a');var _0x310515=_0xa99416['count'];var _0x24e0fa=_0x40c571?0x0:_0x75ca59[_0xbf0c('0x19')];var _0x2869f9=_0x40c571?_0xa99416[_0xbf0c('0x1c')]:_0x75ca59[_0xbf0c('0x19')]+_0x75ca59['limit'];var _0x4d02e3;if(_0x2869f9>=_0x310515){_0x2869f9=_0x310515;_0x4d02e3=0xc8;}else{_0x4d02e3=0xce;}_0x29d34d[_0xbf0c('0x16')](_0x4d02e3);return _0x29d34d['set'](_0xbf0c('0x1d'),_0x24e0fa+'-'+_0x2869f9+'/'+_0x310515)[_0xbf0c('0x18')](_0xa99416);}return null;};}function patchUpdates(_0x525e59){return function(_0x4064f2){try{jsonpatch[_0xbf0c('0x1e')](_0x4064f2,_0x525e59,!![]);}catch(_0x3020bf){return BPromise[_0xbf0c('0x1f')](_0x3020bf);}return _0x4064f2[_0xbf0c('0x20')]();};}function saveUpdates(_0x14d8be,_0x5b0ffa){return function(_0xc47a2e){if(_0xc47a2e){return _0xc47a2e['update'](_0x14d8be)[_0xbf0c('0x21')](function(_0x320184){return _0x320184;});}return null;};}function removeEntity(_0x2cbec9,_0x59645d){return function(_0x5bc118){if(_0x5bc118){return _0x5bc118[_0xbf0c('0x22')]()[_0xbf0c('0x21')](function(){_0x2cbec9[_0xbf0c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e177f,_0x43ca71){return function(_0x5a58c9){if(!_0x5a58c9){_0x5e177f[_0xbf0c('0x23')](0x194);}return _0x5a58c9;};}function handleError(_0x3b650c,_0x466a7e){_0x466a7e=_0x466a7e||0x1f4;return function(_0x569c24){logger['error'](_0x569c24[_0xbf0c('0x24')]);if(_0x569c24[_0xbf0c('0x25')]){delete _0x569c24[_0xbf0c('0x25')];}_0x3b650c[_0xbf0c('0x16')](_0x466a7e)[_0xbf0c('0x26')](_0x569c24);};}var utilLicense=require(_0xbf0c('0x14'));exports[_0xbf0c('0x27')]=function(_0x52784b,_0x14adbe){var _0x2e7807={'raw':!![],'where':{'id':0x1}},_0x3c0037={};_0x3c0037[_0xbf0c('0x28')]=_[_0xbf0c('0x29')](db['License'][_0xbf0c('0x2a')]);_0x3c0037[_0xbf0c('0x2b')]=_[_0xbf0c('0x29')](_0x52784b['query']);_0x3c0037[_0xbf0c('0x2c')]=_[_0xbf0c('0x2d')](_0x3c0037[_0xbf0c('0x28')],_0x3c0037[_0xbf0c('0x2b')]);_0x2e7807[_0xbf0c('0x2e')]=_[_0xbf0c('0x2d')](_0x3c0037[_0xbf0c('0x28')],qs[_0xbf0c('0x2f')](_0x52784b[_0xbf0c('0x2b')][_0xbf0c('0x2f')]));_0x2e7807[_0xbf0c('0x2e')]=_0x2e7807[_0xbf0c('0x2e')]['length']?_0x2e7807[_0xbf0c('0x2e')]:_0x3c0037[_0xbf0c('0x28')];_0x2e7807=_[_0xbf0c('0x30')]({},_0x2e7807,_0x52784b['options']);return utilLicense[_0xbf0c('0x31')](_0x2e7807)['then'](respondWithResult(_0x14adbe,null))[_0xbf0c('0x32')](handleError(_0x14adbe,null));};exports['update']=function(_0x4fabef,_0x290dd4){if(_0x4fabef[_0xbf0c('0x33')]['id']){delete _0x4fabef[_0xbf0c('0x33')]['id'];}return db['License']['find']({'where':{'id':_0x4fabef[_0xbf0c('0x34')]['id']}})[_0xbf0c('0x21')](handleEntityNotFound(_0x290dd4,null))[_0xbf0c('0x21')](function(_0x10d95c){var _0x3e74e8=_0x10d95c[_0xbf0c('0x35')]({'plain':!![]});return utilLicense[_0xbf0c('0x36')](_0x3e74e8,_0x4fabef[_0xbf0c('0x33')][_0xbf0c('0x37')]);})['then'](function(_0x382cb8){if(!_0x382cb8[_0xbf0c('0x38')]){return saveUpdates(_0x4fabef[_0xbf0c('0x33')],null);}return _0x382cb8;})['then'](respondWithResult(_0x290dd4,null))[_0xbf0c('0x32')](handleError(_0x290dd4,null));};exports[_0xbf0c('0x39')]=function(_0xbf010b,_0xb8b46b){var _0x23f715=_0xbf0c('0x3a');var _0x1e4b94=path['join'](_0xbf0c('0x3b'),_0xbf0c('0x3c'),_0xbf0c('0x3d'),_0x23f715);_0xb8b46b[_0xbf0c('0x3e')](_0xbf0c('0x3f'),_0xbf0c('0x40')+_0x23f715);_0xb8b46b[_0xbf0c('0x41')](_0xbf0c('0x42'),'text/plain');_0xb8b46b[_0xbf0c('0x43')](_0x1e4b94);}; \ No newline at end of file +var _0x2aa1=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','keys','License','rawAttributes','query','intersection','model','attributes','merge','options','getLicense','body','params','get','checkLicense','key','catch','downloadLogFile','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4e5dbd,_0x54a87f){var _0x4d2c21=function(_0x111339){while(--_0x111339){_0x4e5dbd['push'](_0x4e5dbd['shift']());}};_0x4d2c21(++_0x54a87f);}(_0x2aa1,0x77));var _0x12aa=function(_0x2482d7,_0x43df42){_0x2482d7=_0x2482d7-0x0;var _0x3fad1f=_0x2aa1[_0x2482d7];return _0x3fad1f;};'use strict';var emlformat=require(_0x12aa('0x0'));var rimraf=require(_0x12aa('0x1'));var zipdir=require(_0x12aa('0x2'));var jsonpatch=require(_0x12aa('0x3'));var rp=require('request-promise');var moment=require(_0x12aa('0x4'));var BPromise=require(_0x12aa('0x5'));var Mustache=require(_0x12aa('0x6'));var util=require(_0x12aa('0x7'));var path=require(_0x12aa('0x8'));var sox=require(_0x12aa('0x9'));var csv=require('to-csv');var ejs=require(_0x12aa('0xa'));var fs=require('fs');var fs_extra=require(_0x12aa('0xb'));var _=require('lodash');var squel=require(_0x12aa('0xc'));var crypto=require(_0x12aa('0xd'));var jsforce=require(_0x12aa('0xe'));var deskjs=require(_0x12aa('0xf'));var toCsv=require('to-csv');var querystring=require(_0x12aa('0x10'));var Papa=require(_0x12aa('0x11'));var Redis=require(_0x12aa('0x12'));var authService=require(_0x12aa('0x13'));var qs=require(_0x12aa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x12aa('0x15'))(_0x12aa('0x16'));var utils=require(_0x12aa('0x17'));var config=require(_0x12aa('0x18'));var licenseUtil=require(_0x12aa('0x19'));var db=require(_0x12aa('0x1a'))['db'];function respondWithStatusCode(_0x25f899,_0x57337a){_0x57337a=_0x57337a||0xcc;return function(_0x131702){if(_0x131702){return _0x25f899[_0x12aa('0x1b')](_0x57337a);}return _0x25f899['status'](_0x57337a)[_0x12aa('0x1c')]();};}function respondWithResult(_0x3e3b35,_0x534cba){_0x534cba=_0x534cba||0xc8;return function(_0x269972){if(_0x269972){return _0x3e3b35[_0x12aa('0x1d')](_0x534cba)[_0x12aa('0x1e')](_0x269972);}};}function respondWithFilteredResult(_0x4e2ed5,_0xf0f4c3){return function(_0x3d13d2){if(_0x3d13d2){var _0x39b53a=typeof _0xf0f4c3[_0x12aa('0x1f')]===_0x12aa('0x20')&&typeof _0xf0f4c3[_0x12aa('0x21')]===_0x12aa('0x20');var _0x5ac2c1=_0x3d13d2[_0x12aa('0x22')];var _0x5be8eb=_0x39b53a?0x0:_0xf0f4c3['offset'];var _0x2c1243=_0x39b53a?_0x3d13d2['count']:_0xf0f4c3[_0x12aa('0x1f')]+_0xf0f4c3[_0x12aa('0x21')];var _0x525de0;if(_0x2c1243>=_0x5ac2c1){_0x2c1243=_0x5ac2c1;_0x525de0=0xc8;}else{_0x525de0=0xce;}_0x4e2ed5[_0x12aa('0x1d')](_0x525de0);return _0x4e2ed5[_0x12aa('0x23')](_0x12aa('0x24'),_0x5be8eb+'-'+_0x2c1243+'/'+_0x5ac2c1)[_0x12aa('0x1e')](_0x3d13d2);}return null;};}function patchUpdates(_0x3b9807){return function(_0x1baaae){try{jsonpatch[_0x12aa('0x25')](_0x1baaae,_0x3b9807,!![]);}catch(_0x3a9f77){return BPromise[_0x12aa('0x26')](_0x3a9f77);}return _0x1baaae[_0x12aa('0x27')]();};}function saveUpdates(_0x3f4064,_0x1294f9){return function(_0x41a442){if(_0x41a442){return _0x41a442[_0x12aa('0x28')](_0x3f4064)['then'](function(_0x57045b){return _0x57045b;});}return null;};}function removeEntity(_0x3e0c7c,_0x1a008e){return function(_0x410a14){if(_0x410a14){return _0x410a14[_0x12aa('0x29')]()[_0x12aa('0x2a')](function(){_0x3e0c7c[_0x12aa('0x1d')](0xcc)[_0x12aa('0x1c')]();});}};}function handleEntityNotFound(_0x222e45,_0x23ec9d){return function(_0xbda849){if(!_0xbda849){_0x222e45[_0x12aa('0x1b')](0x194);}return _0xbda849;};}function handleError(_0x26b8b8,_0x385471){_0x385471=_0x385471||0x1f4;return function(_0x5dbdac){logger[_0x12aa('0x2b')](_0x5dbdac[_0x12aa('0x2c')]);if(_0x5dbdac['name']){delete _0x5dbdac[_0x12aa('0x2d')];}_0x26b8b8[_0x12aa('0x1d')](_0x385471)[_0x12aa('0x2e')](_0x5dbdac);};}var utilLicense=require(_0x12aa('0x19'));exports[_0x12aa('0x2f')]=function(_0x1f858f,_0x481350){var _0x575ace={'raw':!![],'where':{'id':0x1}},_0x3b6178={};_0x3b6178['model']=_[_0x12aa('0x30')](db[_0x12aa('0x31')][_0x12aa('0x32')]);_0x3b6178[_0x12aa('0x33')]=_[_0x12aa('0x30')](_0x1f858f['query']);_0x3b6178['filters']=_[_0x12aa('0x34')](_0x3b6178[_0x12aa('0x35')],_0x3b6178[_0x12aa('0x33')]);_0x575ace[_0x12aa('0x36')]=_[_0x12aa('0x34')](_0x3b6178[_0x12aa('0x35')],qs['fields'](_0x1f858f[_0x12aa('0x33')]['fields']));_0x575ace['attributes']=_0x575ace[_0x12aa('0x36')]['length']?_0x575ace[_0x12aa('0x36')]:_0x3b6178[_0x12aa('0x35')];_0x575ace=_[_0x12aa('0x37')]({},_0x575ace,_0x1f858f[_0x12aa('0x38')]);return utilLicense[_0x12aa('0x39')](_0x575ace)['then'](respondWithResult(_0x481350,null))['catch'](handleError(_0x481350,null));};exports['update']=function(_0x3989b0,_0x27f731){if(_0x3989b0[_0x12aa('0x3a')]['id']){delete _0x3989b0[_0x12aa('0x3a')]['id'];}return db[_0x12aa('0x31')]['find']({'where':{'id':_0x3989b0[_0x12aa('0x3b')]['id']}})[_0x12aa('0x2a')](handleEntityNotFound(_0x27f731,null))[_0x12aa('0x2a')](function(_0x1a5bc3){var _0x35317c=_0x1a5bc3[_0x12aa('0x3c')]({'plain':!![]});return utilLicense[_0x12aa('0x3d')](_0x35317c,_0x3989b0[_0x12aa('0x3a')][_0x12aa('0x3e')]);})[_0x12aa('0x2a')](function(_0x1864be){if(!_0x1864be['demo']){return saveUpdates(_0x3989b0[_0x12aa('0x3a')],null);}return _0x1864be;})[_0x12aa('0x2a')](respondWithResult(_0x27f731,null))[_0x12aa('0x3f')](handleError(_0x27f731,null));};exports[_0x12aa('0x40')]=function(_0x5ae373,_0x2d9e5e){var _0x55bb4c='license-info.log';var _0x2efef5=path['join'](_0x12aa('0x41'),_0x12aa('0x42'),_0x12aa('0x43'),_0x55bb4c);_0x2d9e5e[_0x12aa('0x44')](_0x12aa('0x45'),'attachment;\x20filename='+_0x55bb4c);_0x2d9e5e[_0x12aa('0x23')](_0x12aa('0x46'),_0x12aa('0x47'));_0x2d9e5e[_0x12aa('0x48')](_0x2efef5);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 304f117..1e90f53 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75a6=['exports','License','license','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4a89b8,_0x207f61){var _0x2356b6=function(_0x5e81de){while(--_0x5e81de){_0x4a89b8['push'](_0x4a89b8['shift']());}};_0x2356b6(++_0x207f61);}(_0x75a6,0x6f));var _0x675a=function(_0x3c3db7,_0x842501){_0x3c3db7=_0x3c3db7-0x0;var _0x2b30f5=_0x75a6[_0x3c3db7];return _0x2b30f5;};'use strict';var _=require(_0x675a('0x0'));var util=require('util');var logger=require(_0x675a('0x1'))(_0x675a('0x2'));var moment=require('moment');var BPromise=require(_0x675a('0x3'));var rp=require(_0x675a('0x4'));var fs=require('fs');var path=require(_0x675a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x675a('0x6')]=function(_0x4fdf9a,_0x183add){return _0x4fdf9a['define'](_0x675a('0x7'),attributes,{'tableName':_0x675a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd56b=['moment','request-promise','path','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger','api'];(function(_0x20d9ff,_0x1bcc4b){var _0x1f78aa=function(_0x4ab48e){while(--_0x4ab48e){_0x20d9ff['push'](_0x20d9ff['shift']());}};_0x1f78aa(++_0x1bcc4b);}(_0xd56b,0x173));var _0xbd56=function(_0x5ba334,_0x25b0a5){_0x5ba334=_0x5ba334-0x0;var _0x284715=_0xd56b[_0x5ba334];return _0x284715;};'use strict';var _=require(_0xbd56('0x0'));var util=require('util');var logger=require(_0xbd56('0x1'))(_0xbd56('0x2'));var moment=require(_0xbd56('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd56('0x4'));var fs=require('fs');var path=require(_0xbd56('0x5'));var rimraf=require('rimraf');var config=require(_0xbd56('0x6'));var attributes=require(_0xbd56('0x7'));module[_0xbd56('0x8')]=function(_0x154689,_0x16fae4){return _0x154689[_0xbd56('0x9')]('License',attributes,{'tableName':_0xbd56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 7e79649..b1d5a9e 100644 --- a/server/api/license/license.rpc.js +++ b/server/api/license/license.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04cb=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x04cb,0x173));var _0xb04c=function(_0x5dd740,_0x3b0dab){_0x5dd740=_0x5dd740-0x0;var _0x43acab=_0x04cb[_0x5dd740];return _0x43acab;};'use strict';var _=require(_0xb04c('0x0'));var util=require(_0xb04c('0x1'));var moment=require(_0xb04c('0x2'));var BPromise=require(_0xb04c('0x3'));var rs=require(_0xb04c('0x4'));var fs=require('fs');var Redis=require(_0xb04c('0x5'));var db=require(_0xb04c('0x6'))['db'];var utils=require(_0xb04c('0x7'));var logger=require(_0xb04c('0x8'))(_0xb04c('0x9'));var config=require(_0xb04c('0xa'));var jayson=require(_0xb04c('0xb'));var client=jayson[_0xb04c('0xc')][_0xb04c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x573ded,_0x21752e,_0x457660){return new BPromise(function(_0x23640d,_0x39de04){return client[_0xb04c('0xe')](_0x573ded,_0x457660)[_0xb04c('0xf')](function(_0x331a5f){logger[_0xb04c('0x10')](_0xb04c('0x11'),_0x21752e,_0xb04c('0x12'));logger[_0xb04c('0x13')](_0xb04c('0x14'),_0x21752e,'request\x20sent',JSON[_0xb04c('0x15')](_0x331a5f));if(_0x331a5f[_0xb04c('0x16')]){if(_0x331a5f[_0xb04c('0x16')][_0xb04c('0x17')]===0x1f4){logger[_0xb04c('0x16')](_0xb04c('0x11'),_0x21752e,_0x331a5f['error'][_0xb04c('0x18')]);return _0x39de04(_0x331a5f['error'][_0xb04c('0x18')]);}logger[_0xb04c('0x16')](_0xb04c('0x11'),_0x21752e,_0x331a5f[_0xb04c('0x16')][_0xb04c('0x18')]);return _0x23640d(_0x331a5f['error']['message']);}else{logger['info'](_0xb04c('0x11'),_0x21752e,_0xb04c('0x12'));_0x23640d(_0x331a5f[_0xb04c('0x19')][_0xb04c('0x18')]);}})[_0xb04c('0x1a')](function(_0x195864){logger['error'](_0xb04c('0x11'),_0x21752e,_0x195864);_0x39de04(_0x195864);});});} \ No newline at end of file +var _0x0258=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','bluebird'];(function(_0xb7c8f0,_0x166a07){var _0x2018cc=function(_0x2f55d6){while(--_0x2f55d6){_0xb7c8f0['push'](_0xb7c8f0['shift']());}};_0x2018cc(++_0x166a07);}(_0x0258,0x184));var _0x8025=function(_0x55ca3c,_0x1a784){_0x55ca3c=_0x55ca3c-0x0;var _0x8d06a5=_0x0258[_0x55ca3c];return _0x8d06a5;};'use strict';var _=require(_0x8025('0x0'));var util=require('util');var moment=require(_0x8025('0x1'));var BPromise=require(_0x8025('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8025('0x3'));var db=require(_0x8025('0x4'))['db'];var utils=require(_0x8025('0x5'));var logger=require(_0x8025('0x6'))('rpc');var config=require(_0x8025('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8025('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43b8d6,_0x4db572,_0x28fcf6){return new BPromise(function(_0x25266f,_0x4ba5e7){return client['request'](_0x43b8d6,_0x28fcf6)['then'](function(_0x292b6f){logger[_0x8025('0x9')](_0x8025('0xa'),_0x4db572,_0x8025('0xb'));logger[_0x8025('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x4db572,_0x8025('0xb'),JSON[_0x8025('0xd')](_0x292b6f));if(_0x292b6f[_0x8025('0xe')]){if(_0x292b6f[_0x8025('0xe')]['code']===0x1f4){logger['error'](_0x8025('0xa'),_0x4db572,_0x292b6f['error'][_0x8025('0xf')]);return _0x4ba5e7(_0x292b6f[_0x8025('0xe')][_0x8025('0xf')]);}logger[_0x8025('0xe')]('License,\x20%s,\x20%s',_0x4db572,_0x292b6f['error']['message']);return _0x25266f(_0x292b6f[_0x8025('0xe')][_0x8025('0xf')]);}else{logger[_0x8025('0x9')](_0x8025('0xa'),_0x4db572,_0x8025('0xb'));_0x25266f(_0x292b6f[_0x8025('0x10')]['message']);}})['catch'](function(_0x5c0596){logger[_0x8025('0xe')](_0x8025('0xa'),_0x4db572,_0x5c0596);_0x4ba5e7(_0x5c0596);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 163aa65..1324e1a 100644 --- a/server/api/mailAccount/index.js +++ b/server/api/mailAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x503d=['addSmtp','/:id/interactions','/:id/applications','addApplications','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/messages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create'];(function(_0xd75d34,_0x2d31c6){var _0x8c5975=function(_0xb94783){while(--_0xb94783){_0xd75d34['push'](_0xd75d34['shift']());}};_0x8c5975(++_0x2d31c6);}(_0x503d,0x69));var _0xd503=function(_0x24310a,_0x22f59f){_0x24310a=_0x24310a-0x0;var _0x34fe89=_0x503d[_0x24310a];return _0x34fe89;};'use strict';var multer=require(_0xd503('0x0'));var util=require(_0xd503('0x1'));var path=require(_0xd503('0x2'));var timeout=require(_0xd503('0x3'));var express=require('express');var router=express[_0xd503('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd503('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd503('0x6'));var controller=require(_0xd503('0x7'));router[_0xd503('0x8')]('/',auth[_0xd503('0x9')](),controller['index']);router[_0xd503('0x8')](_0xd503('0xa'),auth['isAuthenticated'](),controller[_0xd503('0xb')]);router['get'](_0xd503('0xc'),auth[_0xd503('0x9')](),controller[_0xd503('0xd')]);router[_0xd503('0x8')](_0xd503('0xe'),auth[_0xd503('0x9')](),controller[_0xd503('0xf')]);router[_0xd503('0x8')](_0xd503('0x10'),auth[_0xd503('0x9')](),controller[_0xd503('0x11')]);router[_0xd503('0x8')](_0xd503('0x12'),auth[_0xd503('0x9')](),controller[_0xd503('0x13')]);router[_0xd503('0x8')](_0xd503('0x14'),auth[_0xd503('0x9')](),controller[_0xd503('0x15')]);router['get']('/:id/interactions',auth[_0xd503('0x9')](),controller['getInteractions']);router['get']('/:id/applications',auth[_0xd503('0x9')](),controller['getApplications']);router['get'](_0xd503('0x16'),auth[_0xd503('0x9')](),controller['getMessages']);router['get'](_0xd503('0x17'),auth[_0xd503('0x9')](),controller['verifySmtp']);router[_0xd503('0x8')](_0xd503('0x18'),auth[_0xd503('0x9')](),controller[_0xd503('0x19')]);router[_0xd503('0x1a')](_0xd503('0xe'),auth[_0xd503('0x9')](),controller[_0xd503('0x1b')]);router['post'](_0xd503('0x10'),auth[_0xd503('0x9')](),controller[_0xd503('0x1c')]);router[_0xd503('0x1a')]('/',auth[_0xd503('0x9')](),controller[_0xd503('0x1d')]);router['post'](_0xd503('0x12'),auth[_0xd503('0x9')](),controller['addImap']);router[_0xd503('0x1a')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xd503('0x1e')]);router['post'](_0xd503('0x1f'),auth[_0xd503('0x9')](),controller['addInteraction']);router[_0xd503('0x1a')](_0xd503('0x20'),auth[_0xd503('0x9')](),controller[_0xd503('0x21')]);router[_0xd503('0x1a')]('/:id/send',auth[_0xd503('0x9')](),controller[_0xd503('0x22')]);router[_0xd503('0x1a')](_0xd503('0x18'),auth['isAuthenticated'](),controller[_0xd503('0x23')]);router[_0xd503('0x24')](_0xd503('0xc'),auth[_0xd503('0x9')](),controller[_0xd503('0x25')]);router[_0xd503('0x26')]('/:id/dispositions',auth[_0xd503('0x9')](),controller[_0xd503('0x27')]);router[_0xd503('0x26')](_0xd503('0x10'),auth[_0xd503('0x9')](),controller[_0xd503('0x28')]);router[_0xd503('0x26')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xd503('0x29')]);router[_0xd503('0x26')]('/:id/out_servers',auth[_0xd503('0x9')](),controller[_0xd503('0x2a')]);router[_0xd503('0x26')]('/:id',auth[_0xd503('0x9')](),controller[_0xd503('0x2b')]);router[_0xd503('0x26')]('/:id/users',auth[_0xd503('0x9')](),controller[_0xd503('0x2c')]);module['exports']=router; \ No newline at end of file +var _0x59d2=['../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','getAgents','post','addDisposition','addImap','addSmtp','/:id/interactions','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeAnswers','removeSmtp','removeAgents','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4614e0,_0x597570){var _0x3682be=function(_0x55fa62){while(--_0x55fa62){_0x4614e0['push'](_0x4614e0['shift']());}};_0x3682be(++_0x597570);}(_0x59d2,0x7c));var _0x259d=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x59d2[_0x587fb5];return _0x551105;};'use strict';var multer=require(_0x259d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x259d('0x1'));var express=require(_0x259d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x259d('0x3'));var interaction=require(_0x259d('0x4'));var config=require(_0x259d('0x5'));var controller=require(_0x259d('0x6'));router[_0x259d('0x7')]('/',auth[_0x259d('0x8')](),controller[_0x259d('0x9')]);router[_0x259d('0x7')](_0x259d('0xa'),auth[_0x259d('0x8')](),controller[_0x259d('0xb')]);router[_0x259d('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x259d('0xc'),auth['isAuthenticated'](),controller[_0x259d('0xd')]);router[_0x259d('0x7')](_0x259d('0xe'),auth[_0x259d('0x8')](),controller[_0x259d('0xf')]);router['get'](_0x259d('0x10'),auth[_0x259d('0x8')](),controller[_0x259d('0x11')]);router['get'](_0x259d('0x12'),auth[_0x259d('0x8')](),controller[_0x259d('0x13')]);router[_0x259d('0x7')]('/:id/interactions',auth[_0x259d('0x8')](),controller[_0x259d('0x14')]);router[_0x259d('0x7')](_0x259d('0x15'),auth[_0x259d('0x8')](),controller[_0x259d('0x16')]);router[_0x259d('0x7')](_0x259d('0x17'),auth[_0x259d('0x8')](),controller['getMessages']);router[_0x259d('0x7')]('/:id/verify',auth['isAuthenticated'](),controller[_0x259d('0x18')]);router[_0x259d('0x7')](_0x259d('0x19'),auth[_0x259d('0x8')](),controller[_0x259d('0x1a')]);router[_0x259d('0x1b')](_0x259d('0xc'),auth[_0x259d('0x8')](),controller[_0x259d('0x1c')]);router['post']('/:id/canned_answers',auth[_0x259d('0x8')](),controller['addAnswer']);router[_0x259d('0x1b')]('/',auth[_0x259d('0x8')](),controller['create']);router['post'](_0x259d('0x10'),auth[_0x259d('0x8')](),controller[_0x259d('0x1d')]);router[_0x259d('0x1b')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x259d('0x1e')]);router[_0x259d('0x1b')](_0x259d('0x1f'),auth[_0x259d('0x8')](),controller['addInteraction']);router['post'](_0x259d('0x15'),auth[_0x259d('0x8')](),controller[_0x259d('0x20')]);router['post'](_0x259d('0x21'),auth['isAuthenticated'](),controller[_0x259d('0x22')]);router[_0x259d('0x1b')]('/:id/users',auth[_0x259d('0x8')](),controller[_0x259d('0x23')]);router[_0x259d('0x24')](_0x259d('0x25'),auth[_0x259d('0x8')](),controller[_0x259d('0x26')]);router[_0x259d('0x27')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x259d('0x27')]('/:id/canned_answers',auth[_0x259d('0x8')](),controller[_0x259d('0x28')]);router[_0x259d('0x27')]('/:id/in_servers',auth[_0x259d('0x8')](),controller['removeImap']);router[_0x259d('0x27')](_0x259d('0x12'),auth[_0x259d('0x8')](),controller[_0x259d('0x29')]);router[_0x259d('0x27')]('/:id',auth[_0x259d('0x8')](),controller['destroy']);router[_0x259d('0x27')](_0x259d('0x19'),auth[_0x259d('0x8')](),controller[_0x259d('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d46ef5d..6e816f6 100644 --- a/server/api/mailAccount/mailAccount.attributes.js +++ b/server/api/mailAccount/mailAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d24=['provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','hotmail','outlook365','getDataValue','custom'];(function(_0x598c64,_0x5ad036){var _0x35c2a6=function(_0x59aaab){while(--_0x59aaab){_0x598c64['push'](_0x598c64['shift']());}};_0x35c2a6(++_0x5ad036);}(_0x2d24,0xd3));var _0x42d2=function(_0x342bd4,_0x5b29af){_0x342bd4=_0x342bd4-0x0;var _0x18f085=_0x2d24[_0x342bd4];return _0x18f085;};'use strict';var Sequelize=require(_0x42d2('0x0'));module[_0x42d2('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x42d2('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x42d2('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x42d2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x42d2('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x42d2('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x42d2('0x2')],'allowNull':![],'defaultValue':_0x42d2('0x4')},'fontSize':{'type':Sequelize[_0x42d2('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x42d2('0x6');}},'notificationSound':{'type':Sequelize[_0x42d2('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x42d2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x42d2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x42d2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x42d2('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x42d2('0x3')],'defaultValue':![],'comment':_0x42d2('0x7'),'set':function(_0x45062a){if(!_0x45062a)this[_0x42d2('0x8')](_0x42d2('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x45062a);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x42d2('0xa'),'yahoo',_0x42d2('0xb')),'defaultValue':null,'get':function(){if(!this[_0x42d2('0xc')]('provider'))return _0x42d2('0xd');return this[_0x42d2('0xc')]('provider');},'set':function(_0x326e5c){if(_0x326e5c===_0x42d2('0xd'))_0x326e5c=null;return this[_0x42d2('0x8')](_0x42d2('0xe'),_0x326e5c);}}}; \ No newline at end of file +var _0x396a=['STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports'];(function(_0x245cc5,_0x3bf87d){var _0x5bc91b=function(_0x264a0a){while(--_0x264a0a){_0x245cc5['push'](_0x245cc5['shift']());}};_0x5bc91b(++_0x3bf87d);}(_0x396a,0x130));var _0xa396=function(_0x32ed6a,_0x1cd968){_0x32ed6a=_0x32ed6a-0x0;var _0x5d670c=_0x396a[_0x32ed6a];return _0x5d670c;};'use strict';var Sequelize=require(_0xa396('0x0'));module[_0xa396('0x1')]={'description':{'type':Sequelize[_0xa396('0x2')]},'name':{'type':Sequelize[_0xa396('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xa396('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa396('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xa396('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa396('0x4')]},'markAsUnread':{'type':Sequelize[_0xa396('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa396('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xa396('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa396('0x4')],'defaultValue':function(){return _0xa396('0x6');}},'notificationSound':{'type':Sequelize[_0xa396('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa396('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa396('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa396('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa396('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa396('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xa396('0x3')],'defaultValue':![],'comment':_0xa396('0x8'),'set':function(_0x15da1f){if(!_0x15da1f)this[_0xa396('0x9')]('mandatoryDispositionPauseId',null);this[_0xa396('0x9')]('mandatoryDisposition',_0x15da1f);}},'provider':{'type':Sequelize[_0xa396('0xa')](_0xa396('0xb'),_0xa396('0xc'),_0xa396('0xd'),_0xa396('0xe')),'defaultValue':null,'get':function(){if(!this[_0xa396('0xf')](_0xa396('0x10')))return _0xa396('0x11');return this[_0xa396('0xf')](_0xa396('0x10'));},'set':function(_0x5b7f02){if(_0x5b7f02===_0xa396('0x11'))_0x5b7f02=null;return this[_0xa396('0x9')](_0xa396('0x10'),_0x5b7f02);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 2f1a36a..2614a1b 100644 --- a/server/api/mailAccount/mailAccount.controller.js +++ b/server/api/mailAccount/mailAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa14=['info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','user','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','username','host','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','MailAccount','includeAll','findAll','rows','show','params','include','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','hasOwnProperty','nolimit','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','custom','email','ListId','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','split','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','defaults','localhost','redis','client','then'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xaa14,0xb6));var _0x4aa1=function(_0x48e6c6,_0xaeb656){_0x48e6c6=_0x48e6c6-0x0;var _0x5190a2=_0xaa14[_0x48e6c6];return _0x5190a2;};'use strict';var moment=require(_0x4aa1('0x0'));var BPromise=require(_0x4aa1('0x1'));var util=require(_0x4aa1('0x2'));var path=require(_0x4aa1('0x3'));var _=require(_0x4aa1('0x4'));var juice=require(_0x4aa1('0x5'));var Redis=require(_0x4aa1('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4aa1('0x7'));var config=require(_0x4aa1('0x8'));var db=require(_0x4aa1('0x9'))['db'];config['redis']=_[_0x4aa1('0xa')](config['redis'],{'host':_0x4aa1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4aa1('0xc')]));require('./mailAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4aa1('0xd')]['http']({'port':0x232b});function respondWithRpcPromise(_0xa9ec83,_0x4b336e,_0x3e961d,_0x2d3ba9){return new BPromise(function(_0x5d34bb,_0x5b1d3a){var _0x5b7ad1=_0x2d3ba9||client;return _0x5b7ad1['request'](_0xa9ec83,_0x3e961d)[_0x4aa1('0xe')](function(_0x462188){logger[_0x4aa1('0xf')](_0x4aa1('0x10'),_0x4b336e,_0x4aa1('0x11'));logger[_0x4aa1('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4b336e,'request\x20sent',JSON['stringify'](_0x462188));if(_0x462188[_0x4aa1('0x13')]){if(_0x462188['error']['code']===0x1f4){logger['error'](_0x4aa1('0x10'),_0x4b336e,_0x462188[_0x4aa1('0x13')][_0x4aa1('0x14')]);return _0x5b1d3a(_0x462188[_0x4aa1('0x13')][_0x4aa1('0x14')]);}logger[_0x4aa1('0x13')](_0x4aa1('0x10'),_0x4b336e,_0x462188[_0x4aa1('0x13')][_0x4aa1('0x14')]);return _0x5d34bb(_0x462188[_0x4aa1('0x13')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x4b336e,_0x4aa1('0x11'));_0x5d34bb(_0x462188[_0x4aa1('0x15')]['message']);}})[_0x4aa1('0x16')](function(_0x3836a9){logger['error'](_0x4aa1('0x10'),_0x4b336e,_0x3836a9);_0x5b1d3a(_0x3836a9);});});}function respondWithStatusCode(_0x2c0eab,_0x5125a3){_0x5125a3=_0x5125a3||0xcc;return function(_0x4ccafd){if(_0x4ccafd){return _0x2c0eab[_0x4aa1('0x17')](_0x5125a3);}return _0x2c0eab[_0x4aa1('0x18')](_0x5125a3)[_0x4aa1('0x19')]();};}function respondWithResult(_0x5ee70d,_0x33612c){_0x33612c=_0x33612c||0xc8;return function(_0x22781d){if(_0x22781d){return _0x5ee70d[_0x4aa1('0x18')](_0x33612c)[_0x4aa1('0x1a')](_0x22781d);}};}function respondWithFilteredResult(_0x50d846,_0x459311){return function(_0x563b3f){if(_0x563b3f){var _0x3f9aa1=typeof _0x459311[_0x4aa1('0x1b')]===_0x4aa1('0x1c')&&typeof _0x459311[_0x4aa1('0x1d')]===_0x4aa1('0x1c');var _0x41c6f4=_0x563b3f['count'];var _0x480529=_0x3f9aa1?0x0:_0x459311[_0x4aa1('0x1b')];var _0xd500f8=_0x3f9aa1?_0x563b3f[_0x4aa1('0x1e')]:_0x459311[_0x4aa1('0x1b')]+_0x459311[_0x4aa1('0x1d')];var _0x43c90e;if(_0xd500f8>=_0x41c6f4){_0xd500f8=_0x41c6f4;_0x43c90e=0xc8;}else{_0x43c90e=0xce;}_0x50d846[_0x4aa1('0x18')](_0x43c90e);return _0x50d846[_0x4aa1('0x1f')](_0x4aa1('0x20'),_0x480529+'-'+_0xd500f8+'/'+_0x41c6f4)[_0x4aa1('0x1a')](_0x563b3f);}return null;};}function saveUpdates(_0xa8eaed){return function(_0x41556e){if(_0x41556e){return _0x41556e[_0x4aa1('0x21')](_0xa8eaed)['then'](function(_0x5f462b){return _0x5f462b;});}return null;};}function removeEntity(_0x5d156e){return function(_0x162920){if(_0x162920){return _0x162920[_0x4aa1('0x22')]()['then'](function(){var _0x28abd1=_0x162920[_0x4aa1('0x23')]({'plain':!![]});var _0x5de782=_0x4aa1('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5de782,'resourceId':_0x28abd1['id']}})[_0x4aa1('0xe')](function(){return _0x162920;});})[_0x4aa1('0xe')](function(){_0x5d156e[_0x4aa1('0x18')](0xcc)[_0x4aa1('0x19')]();});}};}function handleEntityNotFound(_0x4af450){return function(_0x3bcef7){if(!_0x3bcef7){_0x4af450[_0x4aa1('0x17')](0x194);}return _0x3bcef7;};}function handleError(_0x443438,_0xdd1a63){_0xdd1a63=_0xdd1a63||0x1f4;return function(_0x23b9d6){logger[_0x4aa1('0x13')](_0x23b9d6[_0x4aa1('0x25')]);if(_0x23b9d6[_0x4aa1('0x26')]){delete _0x23b9d6[_0x4aa1('0x26')];}_0x443438[_0x4aa1('0x18')](_0xdd1a63)[_0x4aa1('0x27')](_0x23b9d6);};}function getImapHost(_0x305bb8){switch(_0x305bb8){case _0x4aa1('0x28'):return _0x4aa1('0x29');case _0x4aa1('0x2a'):return _0x4aa1('0x2b');case'hotmail':return _0x4aa1('0x2c');case _0x4aa1('0x2d'):return'outlook.office365.com';}throw new Error(_0x4aa1('0x2e'),_0x305bb8);}function getSmtpHost(_0x36b382){switch(_0x36b382){case'gmail':return _0x4aa1('0x2f');case _0x4aa1('0x2a'):return _0x4aa1('0x30');case _0x4aa1('0x31'):return _0x4aa1('0x32');case _0x4aa1('0x2d'):return'smtp.office365.com';}throw new Error(_0x4aa1('0x2e'),_0x36b382);}function getAuthenticationOptions(_0x324bbc,_0x554f62){var _0x3e988f={};var _0x53d143={};if(_0x324bbc){_0x3e988f[_0x4aa1('0x33')]=_0x53d143[_0x4aa1('0x33')]=_0x554f62['username'];_0x3e988f[_0x4aa1('0x34')]=_0x53d143[_0x4aa1('0x35')]=_0x554f62[_0x4aa1('0x34')];if(_0x554f62['modernAuthentication']){_0x3e988f['modernAuthentication']=_0x53d143[_0x4aa1('0x36')]=!![];_0x3e988f['CloudProviderId']=_0x53d143[_0x4aa1('0x37')]=_0x554f62[_0x4aa1('0x37')];_0x3e988f[_0x4aa1('0x34')]=_0x53d143['pass']=null;}else{_0x3e988f['CloudProviderId']=_0x53d143[_0x4aa1('0x37')]=null;}_0x3e988f['host']=getImapHost(_0x324bbc);_0x3e988f['port']=0x3e1;_0x53d143['host']=getSmtpHost(_0x324bbc);_0x53d143[_0x4aa1('0x38')]=0x24b;_0x53d143[_0x4aa1('0x39')]=![];_0x3e988f[_0x4aa1('0x3a')]=_0x53d143[_0x4aa1('0x3a')]=null;}else{if(_0x554f62[_0x4aa1('0x3b')]){_0x3e988f[_0x4aa1('0x33')]=_0x53d143[_0x4aa1('0x33')]=_0x554f62[_0x4aa1('0x3c')];_0x3e988f[_0x4aa1('0x34')]=_0x53d143['pass']=_0x554f62[_0x4aa1('0x34')];}else{_0x3e988f['authentication']=_0x53d143['authentication']=![];_0x3e988f[_0x4aa1('0x33')]=_0x53d143[_0x4aa1('0x33')]=null;_0x3e988f['password']=_0x53d143[_0x4aa1('0x35')]=null;}_0x3e988f[_0x4aa1('0x3d')]=_0x554f62[_0x4aa1('0x3e')][_0x4aa1('0x3d')];_0x3e988f[_0x4aa1('0x38')]=_0x554f62[_0x4aa1('0x3e')][_0x4aa1('0x38')];_0x53d143['host']=_0x554f62[_0x4aa1('0x3f')][_0x4aa1('0x3d')];_0x53d143['port']=_0x554f62[_0x4aa1('0x3f')]['port'];}return{'Imap':_0x3e988f,'Smtp':_0x53d143};}exports['index']=function(_0x1602d9,_0x3c3aa1){var _0x2e0f84={'include':[{'model':db[_0x4aa1('0x40')],'as':_0x4aa1('0x3e')},{'model':db[_0x4aa1('0x41')],'as':_0x4aa1('0x3f')},{'model':db[_0x4aa1('0x42')],'as':_0x4aa1('0x43')}]},_0x170dae={},_0x355e78={'count':0x0,'rows':[]};var _0x39b2fe=_[_0x4aa1('0x44')](db['MailAccount'][_0x4aa1('0x45')],function(_0xa22f6c){return{'name':_0xa22f6c[_0x4aa1('0x46')],'type':_0xa22f6c[_0x4aa1('0x47')]['key']};});_0x170dae[_0x4aa1('0x48')]=_[_0x4aa1('0x44')](_0x39b2fe,'name');_0x170dae['query']=_[_0x4aa1('0x49')](_0x1602d9[_0x4aa1('0x4a')]);_0x170dae[_0x4aa1('0x4b')]=_[_0x4aa1('0x4c')](_0x170dae[_0x4aa1('0x48')],_0x170dae['query']);_0x2e0f84[_0x4aa1('0x4d')]=_['intersection'](_0x170dae[_0x4aa1('0x48')],qs['fields'](_0x1602d9[_0x4aa1('0x4a')][_0x4aa1('0x4e')]));_0x2e0f84[_0x4aa1('0x4d')]=_0x2e0f84[_0x4aa1('0x4d')][_0x4aa1('0x4f')]?_0x2e0f84[_0x4aa1('0x4d')]:_0x170dae[_0x4aa1('0x48')];if(!_0x1602d9[_0x4aa1('0x4a')]['hasOwnProperty']('nolimit')){_0x2e0f84[_0x4aa1('0x1d')]=qs[_0x4aa1('0x1d')](_0x1602d9[_0x4aa1('0x4a')][_0x4aa1('0x1d')]);_0x2e0f84['offset']=qs['offset'](_0x1602d9[_0x4aa1('0x4a')][_0x4aa1('0x1b')]);}_0x2e0f84[_0x4aa1('0x50')]=qs[_0x4aa1('0x51')](_0x1602d9['query']['sort']);_0x2e0f84[_0x4aa1('0x52')]=qs[_0x4aa1('0x4b')](_[_0x4aa1('0x53')](_0x1602d9[_0x4aa1('0x4a')],_0x170dae['filters']),_0x39b2fe);if(_0x1602d9[_0x4aa1('0x4a')][_0x4aa1('0x54')]){_0x2e0f84[_0x4aa1('0x52')]=_[_0x4aa1('0x55')](_0x2e0f84[_0x4aa1('0x52')],{'$or':_['map'](_0x39b2fe,function(_0x118718){if(_0x118718['type']!==_0x4aa1('0x56')){var _0xed09aa={};_0xed09aa[_0x118718['name']]={'$like':'%'+_0x1602d9['query'][_0x4aa1('0x54')]+'%'};return _0xed09aa;}})});}_0x2e0f84=_['merge']({},_0x2e0f84,_0x1602d9['options']);var _0x14401e={'where':_0x2e0f84['where']};return db[_0x4aa1('0x57')][_0x4aa1('0x1e')](_0x14401e)[_0x4aa1('0xe')](function(_0x48602b){_0x355e78[_0x4aa1('0x1e')]=_0x48602b;if(_0x1602d9['query'][_0x4aa1('0x58')]){_0x2e0f84['include']=[{'all':!![]}];}return db[_0x4aa1('0x57')][_0x4aa1('0x59')](_0x2e0f84);})[_0x4aa1('0xe')](function(_0xfd09b7){_0x355e78[_0x4aa1('0x5a')]=_0xfd09b7;return _0x355e78;})['then'](respondWithFilteredResult(_0x3c3aa1,_0x2e0f84))[_0x4aa1('0x16')](handleError(_0x3c3aa1,null));};exports[_0x4aa1('0x5b')]=function(_0x2f0db2,_0x49adc7){var _0x2f5f65={'raw':![],'where':{'id':_0x2f0db2[_0x4aa1('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x4aa1('0x3e')},{'model':db['MailServerOut'],'as':_0x4aa1('0x3f')},{'model':db['Pause'],'as':_0x4aa1('0x43')}]},_0x52c818={};_0x52c818[_0x4aa1('0x48')]=_[_0x4aa1('0x49')](db[_0x4aa1('0x57')][_0x4aa1('0x45')]);_0x52c818['query']=_['keys'](_0x2f0db2['query']);_0x52c818[_0x4aa1('0x4b')]=_['intersection'](_0x52c818[_0x4aa1('0x48')],_0x52c818[_0x4aa1('0x4a')]);_0x2f5f65[_0x4aa1('0x4d')]=_[_0x4aa1('0x4c')](_0x52c818[_0x4aa1('0x48')],qs[_0x4aa1('0x4e')](_0x2f0db2[_0x4aa1('0x4a')]['fields']));_0x2f5f65[_0x4aa1('0x4d')]=_0x2f5f65[_0x4aa1('0x4d')][_0x4aa1('0x4f')]?_0x2f5f65['attributes']:_0x52c818[_0x4aa1('0x48')];if(_0x2f0db2[_0x4aa1('0x4a')][_0x4aa1('0x58')]){_0x2f5f65[_0x4aa1('0x5d')]=[{'all':!![]}];}_0x2f5f65=_[_0x4aa1('0x55')]({},_0x2f5f65,_0x2f0db2[_0x4aa1('0x5e')]);return db['MailAccount'][_0x4aa1('0x5f')](_0x2f5f65)['then'](handleEntityNotFound(_0x49adc7,null))[_0x4aa1('0xe')](respondWithResult(_0x49adc7,null))[_0x4aa1('0x16')](handleError(_0x49adc7,null));};exports[_0x4aa1('0x21')]=function(_0x218d39,_0x224720){if(_0x218d39[_0x4aa1('0x60')]['id']){delete _0x218d39[_0x4aa1('0x60')]['id'];}var _0x5cae20=_0x218d39['body']['provider']==='custom'?null:_0x218d39[_0x4aa1('0x60')][_0x4aa1('0x61')];var _0xa38049=_0x218d39[_0x4aa1('0x60')][_0x4aa1('0x3e')]||{};var _0x3de798=_0x218d39[_0x4aa1('0x60')][_0x4aa1('0x3f')]||{};if(_0x5cae20){_0xa38049[_0x4aa1('0x3d')]=getImapHost(_0x5cae20);_0xa38049['port']=0x3e1;_0x3de798[_0x4aa1('0x3d')]=getSmtpHost(_0x5cae20);_0x3de798[_0x4aa1('0x38')]=0x24b;_0x3de798[_0x4aa1('0x39')]=![];}if(_0x3de798[_0x4aa1('0x36')]){_0x3de798[_0x4aa1('0x39')]=![];}else{_0x3de798[_0x4aa1('0x37')]=null;}if(!_0xa38049[_0x4aa1('0x36')])_0xa38049[_0x4aa1('0x37')]=null;_0x218d39[_0x4aa1('0x60')]['Imap']=_0xa38049;_0x218d39[_0x4aa1('0x60')][_0x4aa1('0x3f')]=_0x3de798;return db['MailAccount'][_0x4aa1('0x5f')]({'where':{'id':_0x218d39[_0x4aa1('0x5c')]['id']},'include':[{'model':db[_0x4aa1('0x40')],'as':_0x4aa1('0x3e')},{'model':db[_0x4aa1('0x41')],'as':_0x4aa1('0x3f')},{'model':db[_0x4aa1('0x42')],'as':'mandatoryDispositionPause'}]})[_0x4aa1('0xe')](handleEntityNotFound(_0x224720,null))[_0x4aa1('0xe')](function(_0x4e3c28){if(!_0x4e3c28)throw new Error(_0x4aa1('0x62'));if(_0x4e3c28[_0x4aa1('0x3a')])delete _0x218d39[_0x4aa1('0x60')][_0x4aa1('0x3e')];return _0x4e3c28;})[_0x4aa1('0xe')](saveUpdates(_0x218d39[_0x4aa1('0x60')],null))[_0x4aa1('0xe')](function(_0x3d0108){if(!_0x218d39[_0x4aa1('0x60')][_0x4aa1('0x3e')])return _0x3d0108;return db[_0x4aa1('0x40')][_0x4aa1('0x21')](_0x218d39[_0x4aa1('0x60')]['Imap'],{'where':{'MailAccountId':_0x3d0108['id']}})['then'](function(){return _0x3d0108;});})[_0x4aa1('0xe')](function(_0x40f407){if(!_0x218d39[_0x4aa1('0x60')][_0x4aa1('0x3f')])return _0x40f407;return db['MailServerOut'][_0x4aa1('0x21')](_0x218d39[_0x4aa1('0x60')][_0x4aa1('0x3f')],{'where':{'MailAccountId':_0x40f407['id']}})['then'](function(){return _0x40f407;});})[_0x4aa1('0xe')](respondWithResult(_0x224720,null))[_0x4aa1('0x16')](handleError(_0x224720,null));};exports[_0x4aa1('0x63')]=function(_0x2fc419,_0x495798){return db[_0x4aa1('0x57')]['describe']()[_0x4aa1('0xe')](respondWithResult(_0x495798,null))[_0x4aa1('0x16')](handleError(_0x495798,null));};exports[_0x4aa1('0x64')]=function(_0x3b30eb,_0x39c01f){if(_0x3b30eb[_0x4aa1('0x60')]['id']){delete _0x3b30eb['body']['id'];}return db[_0x4aa1('0x57')][_0x4aa1('0x5f')]({'where':{'id':_0x3b30eb['params']['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x39c01f,null))['then'](function(_0x2a9cb8){if(_0x2a9cb8){_0x3b30eb[_0x4aa1('0x60')][_0x4aa1('0x65')]=_0x2a9cb8['id'];return db['Disposition'][_0x4aa1('0x66')](_0x3b30eb[_0x4aa1('0x60')]);}})[_0x4aa1('0xe')](respondWithResult(_0x39c01f,null))['catch'](handleError(_0x39c01f,null));};exports[_0x4aa1('0x67')]=function(_0x3fb49a,_0x58ac43){var _0x44887e={'raw':![],'where':{}};var _0x3a5d8e={};var _0x2dcbd1={'count':0x0,'rows':[]};return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x3fb49a['params']['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x58ac43,null))[_0x4aa1('0xe')](function(_0x584e82){if(_0x584e82){_0x3a5d8e[_0x4aa1('0x48')]=_[_0x4aa1('0x49')](db['Disposition'][_0x4aa1('0x45')]);_0x3a5d8e[_0x4aa1('0x4a')]=_[_0x4aa1('0x49')](_0x3fb49a[_0x4aa1('0x4a')]);_0x3a5d8e[_0x4aa1('0x4b')]=_[_0x4aa1('0x4c')](_0x3a5d8e['model'],_0x3a5d8e[_0x4aa1('0x4a')]);_0x44887e[_0x4aa1('0x4d')]=_[_0x4aa1('0x4c')](_0x3a5d8e[_0x4aa1('0x48')],qs[_0x4aa1('0x4e')](_0x3fb49a[_0x4aa1('0x4a')]['fields']));_0x44887e[_0x4aa1('0x4d')]=_0x44887e[_0x4aa1('0x4d')]['length']?_0x44887e[_0x4aa1('0x4d')]:_0x3a5d8e[_0x4aa1('0x48')];if(!_0x3fb49a[_0x4aa1('0x4a')][_0x4aa1('0x69')](_0x4aa1('0x6a'))){_0x44887e[_0x4aa1('0x1d')]=qs[_0x4aa1('0x1d')](_0x3fb49a[_0x4aa1('0x4a')][_0x4aa1('0x1d')]);_0x44887e[_0x4aa1('0x1b')]=qs['offset'](_0x3fb49a[_0x4aa1('0x4a')]['offset']);}_0x44887e[_0x4aa1('0x50')]=qs[_0x4aa1('0x51')](_0x3fb49a['query'][_0x4aa1('0x51')]);_0x44887e['where']=qs[_0x4aa1('0x4b')](_[_0x4aa1('0x53')](_0x3fb49a[_0x4aa1('0x4a')],_0x3a5d8e[_0x4aa1('0x4b')]));_0x44887e[_0x4aa1('0x52')][_0x4aa1('0x65')]=_0x584e82['id'];if(_0x3fb49a['query'][_0x4aa1('0x54')]){_0x44887e[_0x4aa1('0x52')]=_[_0x4aa1('0x55')](_0x44887e[_0x4aa1('0x52')],{'$or':_[_0x4aa1('0x44')](_0x44887e['attributes'],function(_0x3f0525){var _0x59de8f={};_0x59de8f[_0x3f0525]={'$like':'%'+_0x3fb49a['query'][_0x4aa1('0x54')]+'%'};return _0x59de8f;})});}_0x44887e=_[_0x4aa1('0x55')]({},_0x44887e,_0x3fb49a[_0x4aa1('0x5e')]);return db[_0x4aa1('0x6b')][_0x4aa1('0x1e')]({'where':_0x44887e[_0x4aa1('0x52')]})[_0x4aa1('0xe')](function(_0x313fb7){_0x2dcbd1[_0x4aa1('0x1e')]=_0x313fb7;if(_0x3fb49a['query'][_0x4aa1('0x58')]){_0x44887e[_0x4aa1('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0x4aa1('0x59')](_0x44887e);})['then'](function(_0x23c291){_0x2dcbd1['rows']=_0x23c291;return _0x2dcbd1;});}})[_0x4aa1('0xe')](respondWithFilteredResult(_0x58ac43,_0x44887e))['catch'](handleError(_0x58ac43,null));};exports[_0x4aa1('0x6c')]=function(_0x1c2118,_0x18ac7b){return db[_0x4aa1('0x57')]['find']({'where':{'id':_0x1c2118['params']['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x18ac7b,null))[_0x4aa1('0xe')](function(_0x4d9fc8){if(_0x4d9fc8){return _0x4d9fc8['removeDispositions'](_0x1c2118[_0x4aa1('0x4a')][_0x4aa1('0x6d')]);}})[_0x4aa1('0xe')](respondWithStatusCode(_0x18ac7b,null))[_0x4aa1('0x16')](handleError(_0x18ac7b,null));};exports[_0x4aa1('0x6e')]=function(_0x2c27aa,_0x45173e){if(_0x2c27aa[_0x4aa1('0x60')]['id']){delete _0x2c27aa[_0x4aa1('0x60')]['id'];}return db[_0x4aa1('0x57')][_0x4aa1('0x5f')]({'where':{'id':_0x2c27aa['params']['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x45173e,null))['then'](function(_0x19cf8c){if(_0x19cf8c){_0x2c27aa[_0x4aa1('0x60')][_0x4aa1('0x65')]=_0x19cf8c['id'];return db['CannedAnswer']['create'](_0x2c27aa[_0x4aa1('0x60')]);}})[_0x4aa1('0xe')](respondWithResult(_0x45173e,null))[_0x4aa1('0x16')](handleError(_0x45173e,null));};exports[_0x4aa1('0x6f')]=function(_0x4a69ae,_0x4338cd){var _0x355ac9={'raw':![],'where':{}};var _0x5043ba={};var _0x5bba41={'count':0x0,'rows':[]};return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x4a69ae['params']['id']}})['then'](handleEntityNotFound(_0x4338cd,null))[_0x4aa1('0xe')](function(_0x2c6e59){if(_0x2c6e59){_0x5043ba[_0x4aa1('0x48')]=_['keys'](db[_0x4aa1('0x70')][_0x4aa1('0x45')]);_0x5043ba[_0x4aa1('0x4a')]=_[_0x4aa1('0x49')](_0x4a69ae[_0x4aa1('0x4a')]);_0x5043ba[_0x4aa1('0x4b')]=_[_0x4aa1('0x4c')](_0x5043ba[_0x4aa1('0x48')],_0x5043ba[_0x4aa1('0x4a')]);_0x355ac9['attributes']=_[_0x4aa1('0x4c')](_0x5043ba[_0x4aa1('0x48')],qs[_0x4aa1('0x4e')](_0x4a69ae[_0x4aa1('0x4a')]['fields']));_0x355ac9[_0x4aa1('0x4d')]=_0x355ac9[_0x4aa1('0x4d')][_0x4aa1('0x4f')]?_0x355ac9[_0x4aa1('0x4d')]:_0x5043ba[_0x4aa1('0x48')];if(!_0x4a69ae[_0x4aa1('0x4a')][_0x4aa1('0x69')](_0x4aa1('0x6a'))){_0x355ac9[_0x4aa1('0x1d')]=qs[_0x4aa1('0x1d')](_0x4a69ae[_0x4aa1('0x4a')]['limit']);_0x355ac9[_0x4aa1('0x1b')]=qs[_0x4aa1('0x1b')](_0x4a69ae[_0x4aa1('0x4a')]['offset']);}_0x355ac9['order']=qs[_0x4aa1('0x51')](_0x4a69ae[_0x4aa1('0x4a')][_0x4aa1('0x51')]);_0x355ac9[_0x4aa1('0x52')]=qs[_0x4aa1('0x4b')](_[_0x4aa1('0x53')](_0x4a69ae[_0x4aa1('0x4a')],_0x5043ba[_0x4aa1('0x4b')]));_0x355ac9['where'][_0x4aa1('0x65')]=_0x2c6e59['id'];if(_0x4a69ae[_0x4aa1('0x4a')][_0x4aa1('0x54')]){_0x355ac9[_0x4aa1('0x52')]=_[_0x4aa1('0x55')](_0x355ac9[_0x4aa1('0x52')],{'$or':_[_0x4aa1('0x44')](_0x355ac9['attributes'],function(_0x55ba3a){var _0x1183ce={};_0x1183ce[_0x55ba3a]={'$like':'%'+_0x4a69ae[_0x4aa1('0x4a')][_0x4aa1('0x54')]+'%'};return _0x1183ce;})});}_0x355ac9=_[_0x4aa1('0x55')]({},_0x355ac9,_0x4a69ae[_0x4aa1('0x5e')]);return db[_0x4aa1('0x70')][_0x4aa1('0x1e')]({'where':_0x355ac9[_0x4aa1('0x52')]})[_0x4aa1('0xe')](function(_0x45f61b){_0x5bba41[_0x4aa1('0x1e')]=_0x45f61b;if(_0x4a69ae[_0x4aa1('0x4a')][_0x4aa1('0x58')]){_0x355ac9['include']=[{'all':!![]}];}return db[_0x4aa1('0x70')][_0x4aa1('0x59')](_0x355ac9);})[_0x4aa1('0xe')](function(_0x588c05){_0x5bba41[_0x4aa1('0x5a')]=_0x588c05;return _0x5bba41;});}})[_0x4aa1('0xe')](respondWithFilteredResult(_0x4338cd,_0x355ac9))['catch'](handleError(_0x4338cd,null));};exports[_0x4aa1('0x71')]=function(_0x26c8c0,_0x3a0682){return db[_0x4aa1('0x57')]['find']({'where':{'id':_0x26c8c0[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x3a0682,null))['then'](function(_0x3f763e){if(_0x3f763e){return _0x3f763e[_0x4aa1('0x71')](_0x26c8c0['query'][_0x4aa1('0x6d')]);}})['then'](respondWithStatusCode(_0x3a0682,null))[_0x4aa1('0x16')](handleError(_0x3a0682,null));};exports[_0x4aa1('0x66')]=function(_0x8cd8ce,_0x1312e8){var _0x1edaa8={'name':_0x8cd8ce[_0x4aa1('0x60')][_0x4aa1('0x26')],'key':_0x8cd8ce['body']['key'],'provider':_0x8cd8ce[_0x4aa1('0x60')][_0x4aa1('0x61')]===_0x4aa1('0x72')?null:_0x8cd8ce[_0x4aa1('0x60')][_0x4aa1('0x61')],'email':_0x8cd8ce['body'][_0x4aa1('0x73')],'ListId':_0x8cd8ce[_0x4aa1('0x60')][_0x4aa1('0x74')],'active':!_[_0x4aa1('0x75')](_0x8cd8ce[_0x4aa1('0x60')]['active'])?_0x8cd8ce[_0x4aa1('0x60')]['active']:!![],'description':_0x8cd8ce[_0x4aa1('0x60')][_0x4aa1('0x76')]||null};var _0x16dbf4=getAuthenticationOptions(_0x1edaa8[_0x4aa1('0x61')],_0x8cd8ce[_0x4aa1('0x60')]);_0x1edaa8[_0x4aa1('0x3e')]=_0x16dbf4[_0x4aa1('0x3e')];_0x1edaa8[_0x4aa1('0x3f')]=_0x16dbf4['Smtp'];return db[_0x4aa1('0x57')][_0x4aa1('0x66')](_0x1edaa8,{'include':[{'model':db[_0x4aa1('0x41')],'as':_0x4aa1('0x3f')},{'model':db[_0x4aa1('0x40')],'as':_0x4aa1('0x3e')}]})[_0x4aa1('0xe')](function(_0x2c70de){var _0x5869cf=_0x8cd8ce[_0x4aa1('0x33')]['get']({'plain':!![]});if(!_0x5869cf)throw new Error(_0x4aa1('0x77'));if(_0x5869cf['role']===_0x4aa1('0x33')){var _0x4e3d58=_0x2c70de[_0x4aa1('0x23')]({'plain':!![]});return db[_0x4aa1('0x78')][_0x4aa1('0x5f')]({'where':{'name':_0x4aa1('0x24'),'userProfileId':_0x5869cf[_0x4aa1('0x79')]},'raw':!![]})['then'](function(_0x3bcf9a){if(_0x3bcf9a&&_0x3bcf9a[_0x4aa1('0x7a')]===0x0){return db[_0x4aa1('0x7b')]['create']({'name':_0x4e3d58['name'],'resourceId':_0x4e3d58['id'],'type':_0x3bcf9a[_0x4aa1('0x26')],'sectionId':_0x3bcf9a['id']},{})[_0x4aa1('0xe')](function(){return _0x2c70de;});}else{return _0x2c70de;}})[_0x4aa1('0x16')](function(_0xc7a5fd){logger[_0x4aa1('0x13')](_0x4aa1('0x7c'),_0xc7a5fd);throw _0xc7a5fd;});}return _0x2c70de;})[_0x4aa1('0xe')](respondWithResult(_0x1312e8,0xc9))[_0x4aa1('0x16')](handleError(_0x1312e8,null));};exports[_0x4aa1('0x7d')]=function(_0x49d62f,_0x209a10){return db[_0x4aa1('0x57')]['findOne']({'where':{'id':_0x49d62f['params']['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x209a10,null))[_0x4aa1('0xe')](function(_0x2b1e96){if(_0x2b1e96){return _0x2b1e96[_0x4aa1('0x7d')]();}return null;})[_0x4aa1('0xe')](respondWithResult(_0x209a10,null))[_0x4aa1('0x16')](handleError(_0x209a10,null));};exports[_0x4aa1('0x7e')]=function(_0x4d61e9,_0x142b2f){if(_0x4d61e9['body']['id']){delete _0x4d61e9[_0x4aa1('0x60')]['id'];}return db[_0x4aa1('0x57')][_0x4aa1('0x5f')]({'where':{'id':_0x4d61e9[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x142b2f,null))[_0x4aa1('0xe')](function(_0x5bff84){if(_0x5bff84){_0x4d61e9[_0x4aa1('0x60')][_0x4aa1('0x65')]=_0x5bff84['id'];return db['MailServerIn']['create'](_0x4d61e9[_0x4aa1('0x60')]);}})['then'](respondWithResult(_0x142b2f,null))['catch'](handleError(_0x142b2f,null));};exports[_0x4aa1('0x7f')]=function(_0x20579d,_0x44b7d6){return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x20579d[_0x4aa1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x44b7d6,null))[_0x4aa1('0xe')](function(_0x570885){if(_0x570885){return _0x570885[_0x4aa1('0x80')](null);}return null;})[_0x4aa1('0xe')](respondWithStatusCode(_0x44b7d6,null))['catch'](handleError(_0x44b7d6,null));};exports['getSmtp']=function(_0x28d75d,_0x47c7ba){return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x28d75d[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x47c7ba,null))[_0x4aa1('0xe')](function(_0x33cbaa){if(_0x33cbaa){return _0x33cbaa[_0x4aa1('0x81')]();}return null;})['then'](respondWithResult(_0x47c7ba,null))['catch'](handleError(_0x47c7ba,null));};exports['addSmtp']=function(_0x37324a,_0x33b59b){if(_0x37324a[_0x4aa1('0x60')]['id']){delete _0x37324a[_0x4aa1('0x60')]['id'];}return db['MailAccount'][_0x4aa1('0x5f')]({'where':{'id':_0x37324a[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x33b59b,null))['then'](function(_0x1ae535){if(_0x1ae535){_0x37324a[_0x4aa1('0x60')][_0x4aa1('0x65')]=_0x1ae535['id'];return db['MailServerOut'][_0x4aa1('0x66')](_0x37324a['body']);}})[_0x4aa1('0xe')](respondWithResult(_0x33b59b,null))[_0x4aa1('0x16')](handleError(_0x33b59b,null));};exports[_0x4aa1('0x82')]=function(_0x2d985f,_0x15d27f){return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x2d985f[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x15d27f,null))[_0x4aa1('0xe')](function(_0x4796ef){if(_0x4796ef){return _0x4796ef[_0x4aa1('0x83')](null);}return null;})[_0x4aa1('0xe')](respondWithStatusCode(_0x15d27f,null))['catch'](handleError(_0x15d27f,null));};exports[_0x4aa1('0x84')]=function(_0x425585,_0x971da8){return db['MailInteraction'][_0x4aa1('0x5f')]({'where':{'id':_0x425585['params']['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x971da8,null))[_0x4aa1('0xe')](function(_0x878309){if(_0x878309){return _0x878309['addInteraction'](_0x425585[_0x4aa1('0x60')]['ids'],_['omit'](_0x425585[_0x4aa1('0x60')],['ids','id'])||{});}})[_0x4aa1('0xe')](respondWithResult(_0x971da8,null))[_0x4aa1('0x16')](handleError(_0x971da8,null));};exports[_0x4aa1('0x85')]=function(_0x2f4ccf,_0x228133){var _0x49ec0d={'raw':![],'where':{}};var _0x2d6296={};var _0x2d6fea={'count':0x0,'rows':[]};return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x2f4ccf['params']['id']}})['then'](handleEntityNotFound(_0x228133,null))['then'](function(_0x2f772c){if(_0x2f772c){_0x2d6296['model']=_[_0x4aa1('0x49')](db[_0x4aa1('0x86')][_0x4aa1('0x45')]);_0x2d6296[_0x4aa1('0x4a')]=_[_0x4aa1('0x49')](_0x2f4ccf[_0x4aa1('0x4a')]);_0x2d6296['filters']=_[_0x4aa1('0x4c')](_0x2d6296[_0x4aa1('0x48')],_0x2d6296[_0x4aa1('0x4a')]);_0x49ec0d[_0x4aa1('0x4d')]=_['intersection'](_0x2d6296['model'],qs[_0x4aa1('0x4e')](_0x2f4ccf['query'][_0x4aa1('0x4e')]));_0x49ec0d[_0x4aa1('0x4d')]=_0x49ec0d[_0x4aa1('0x4d')][_0x4aa1('0x4f')]?_0x49ec0d[_0x4aa1('0x4d')]:_0x2d6296[_0x4aa1('0x48')];if(!_0x2f4ccf['query'][_0x4aa1('0x69')](_0x4aa1('0x6a'))){_0x49ec0d[_0x4aa1('0x1d')]=qs['limit'](_0x2f4ccf[_0x4aa1('0x4a')][_0x4aa1('0x1d')]);_0x49ec0d['offset']=qs[_0x4aa1('0x1b')](_0x2f4ccf[_0x4aa1('0x4a')]['offset']);}_0x49ec0d[_0x4aa1('0x50')]=qs[_0x4aa1('0x51')](_0x2f4ccf[_0x4aa1('0x4a')][_0x4aa1('0x51')]);_0x49ec0d[_0x4aa1('0x52')]=qs[_0x4aa1('0x4b')](_['pick'](_0x2f4ccf[_0x4aa1('0x4a')],_0x2d6296[_0x4aa1('0x4b')]));_0x49ec0d[_0x4aa1('0x52')]['MailAccountId']=_0x2f772c['id'];if(_0x2f4ccf[_0x4aa1('0x4a')][_0x4aa1('0x54')]){_0x49ec0d['where']=_[_0x4aa1('0x55')](_0x49ec0d[_0x4aa1('0x52')],{'$or':_[_0x4aa1('0x44')](_0x49ec0d['attributes'],function(_0x183851){var _0x16687f={};_0x16687f[_0x183851]={'$like':'%'+_0x2f4ccf[_0x4aa1('0x4a')][_0x4aa1('0x54')]+'%'};return _0x16687f;})});}_0x49ec0d=_[_0x4aa1('0x55')]({},_0x49ec0d,_0x2f4ccf[_0x4aa1('0x5e')]);return db[_0x4aa1('0x86')][_0x4aa1('0x1e')]({'where':_0x49ec0d[_0x4aa1('0x52')]})[_0x4aa1('0xe')](function(_0x464eb2){_0x2d6fea[_0x4aa1('0x1e')]=_0x464eb2;if(_0x2f4ccf[_0x4aa1('0x4a')][_0x4aa1('0x58')]){_0x49ec0d[_0x4aa1('0x5d')]=[{'model':db[_0x4aa1('0x87')],'as':_0x4aa1('0x88'),'required':![]},{'model':db[_0x4aa1('0x89')],'as':'Owner','attributes':['name',_0x4aa1('0x8a'),_0x4aa1('0x8b')],'required':![]},{'model':db[_0x4aa1('0x8c')],'as':_0x4aa1('0x8d'),'attributes':['id',_0x4aa1('0x26'),_0x4aa1('0x8e')],'where':_0x2f4ccf['query'][_0x4aa1('0x8f')]?{'id':_0x2f4ccf[_0x4aa1('0x4a')][_0x4aa1('0x8f')]}:undefined,'required':_0x2f4ccf[_0x4aa1('0x4a')][_0x4aa1('0x8f')]?!![]:![]}];}return db['MailInteraction'][_0x4aa1('0x59')](_0x49ec0d);})['then'](function(_0x1d2fa5){_0x2d6fea[_0x4aa1('0x5a')]=_0x1d2fa5;return _0x2d6fea;});}})[_0x4aa1('0xe')](respondWithFilteredResult(_0x228133,_0x49ec0d))['catch'](handleError(_0x228133,null));};exports['addApplications']=function addApplications(_0x515abb,_0x4a121a){var _0x34e9ec=_0x515abb[_0x4aa1('0x5c')]['id'];var _0x64d75e=_0x515abb[_0x4aa1('0x60')];var _0x2fb50c=0xc8;var _0x4fc22f=null;return db['sequelize'][_0x4aa1('0x90')]({'isolationLevel':db[_0x4aa1('0x91')]['Transaction'][_0x4aa1('0x92')][_0x4aa1('0x93')]},function(_0x559977){return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x34e9ec},'transaction':_0x559977})[_0x4aa1('0xe')](function(_0x62cf9f){if(_0x62cf9f){return db[_0x4aa1('0x94')]['destroy']({'where':{'MailAccountId':_0x34e9ec},'transaction':_0x559977})['then'](function(){var _0x403753=_[_0x4aa1('0x44')](_0x64d75e,function(_0x3ff189){_0x3ff189[_0x4aa1('0x65')]=_0x34e9ec;return _0x3ff189;});return db[_0x4aa1('0x94')][_0x4aa1('0x95')](_0x403753,{'transaction':_0x559977});});}else{_0x2fb50c=0x194;_0x4fc22f=[];}});})[_0x4aa1('0xe')](function(){if(_0x2fb50c!==0x194){return db[_0x4aa1('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x34e9ec},'order':_0x4aa1('0x96')})['then'](function(_0x2f1f3e){_0x4fc22f=_0x2f1f3e;});}})[_0x4aa1('0x16')](function(_0x4127e2){_0x2fb50c=0x1f4;logger[_0x4aa1('0x13')](_0x4127e2[_0x4aa1('0x25')]);if(_0x4127e2['name']){delete _0x4127e2['name'];}_0x4fc22f=_0x4127e2;})[_0x4aa1('0x97')](function(){if(_0x4fc22f===null){_0x4a121a[_0x4aa1('0x17')](_0x2fb50c);}else{if(_0x2fb50c===0x1f4){_0x4a121a['status'](_0x2fb50c)[_0x4aa1('0x27')](_0x4fc22f);}else{_0x4a121a[_0x4aa1('0x18')](_0x2fb50c)[_0x4aa1('0x1a')](_0x4fc22f);}}});};exports[_0x4aa1('0x98')]=function(_0xaaeecb,_0x21f465){var _0x485629={};var _0x171a04={};var _0x1bbe2a;var _0x1f7505;return db['MailAccount'][_0x4aa1('0x68')]({'where':{'id':_0xaaeecb[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x21f465,null))[_0x4aa1('0xe')](function(_0x6eb9dc){if(_0x6eb9dc){_0x1bbe2a=_0x6eb9dc;_0x171a04['model']=_[_0x4aa1('0x49')](db[_0x4aa1('0x94')][_0x4aa1('0x45')]);_0x171a04[_0x4aa1('0x4a')]=_[_0x4aa1('0x49')](_0xaaeecb[_0x4aa1('0x4a')]);_0x171a04['filters']=_[_0x4aa1('0x4c')](_0x171a04[_0x4aa1('0x48')],_0x171a04[_0x4aa1('0x4a')]);_0x485629['attributes']=_[_0x4aa1('0x4c')](_0x171a04['model'],qs[_0x4aa1('0x4e')](_0xaaeecb[_0x4aa1('0x4a')]['fields']));_0x485629[_0x4aa1('0x4d')]=_0x485629[_0x4aa1('0x4d')][_0x4aa1('0x4f')]?_0x485629[_0x4aa1('0x4d')]:_0x171a04['model'];_0x485629[_0x4aa1('0x50')]=qs['sort'](_0xaaeecb['query'][_0x4aa1('0x51')]);_0x485629[_0x4aa1('0x52')]=qs[_0x4aa1('0x4b')](_[_0x4aa1('0x53')](_0xaaeecb[_0x4aa1('0x4a')],_0x171a04[_0x4aa1('0x4b')]));if(_0xaaeecb[_0x4aa1('0x4a')][_0x4aa1('0x54')]){_0x485629[_0x4aa1('0x52')]=_[_0x4aa1('0x55')](_0x485629[_0x4aa1('0x52')],{'$or':_[_0x4aa1('0x44')](_0x485629['attributes'],function(_0x17e8b3){var _0x29d33b={};_0x29d33b[_0x17e8b3]={'$like':'%'+_0xaaeecb[_0x4aa1('0x4a')]['filter']+'%'};return _0x29d33b;})});}_0x485629=_[_0x4aa1('0x55')]({},_0x485629,_0xaaeecb[_0x4aa1('0x5e')]);return _0x1bbe2a['getApplications'](_0x485629);}})['then'](function(_0x21510a){if(_0x21510a){_0x1f7505=_0x21510a[_0x4aa1('0x4f')];if(!_0xaaeecb[_0x4aa1('0x4a')]['hasOwnProperty']('nolimit')){_0x485629[_0x4aa1('0x1d')]=qs[_0x4aa1('0x1d')](_0xaaeecb[_0x4aa1('0x4a')][_0x4aa1('0x1d')]);_0x485629['offset']=qs[_0x4aa1('0x1b')](_0xaaeecb[_0x4aa1('0x4a')][_0x4aa1('0x1b')]);}return _0x1bbe2a[_0x4aa1('0x98')](_0x485629);}})[_0x4aa1('0xe')](function(_0x2073c2){if(_0x2073c2){return _0x2073c2?{'count':_0x1f7505,'rows':_0x2073c2}:null;}})['then'](respondWithResult(_0x21f465,null))[_0x4aa1('0x16')](handleError(_0x21f465,null));};exports[_0x4aa1('0x99')]=function(_0x82a374,_0x2e898a){var _0xb24d15={'raw':!![],'where':{}};var _0x2caa38={};var _0x1874df={'count':0x0,'rows':[]};return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x82a374[_0x4aa1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2e898a,null))['then'](function(_0x4eb4b7){if(_0x4eb4b7){_0x2caa38['model']=_[_0x4aa1('0x49')](db[_0x4aa1('0x9a')][_0x4aa1('0x45')]);_0x2caa38[_0x4aa1('0x4a')]=_[_0x4aa1('0x49')](_0x82a374[_0x4aa1('0x4a')]);_0x2caa38[_0x4aa1('0x4b')]=_[_0x4aa1('0x4c')](_0x2caa38[_0x4aa1('0x48')],_0x2caa38[_0x4aa1('0x4a')]);_0xb24d15[_0x4aa1('0x4d')]=_['intersection'](_0x2caa38['model'],qs[_0x4aa1('0x4e')](_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x4e')]));_0xb24d15[_0x4aa1('0x4d')]=_0xb24d15[_0x4aa1('0x4d')]['length']?_0xb24d15[_0x4aa1('0x4d')]:_0x2caa38[_0x4aa1('0x48')];if(!_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x69')]('nolimit')){_0xb24d15[_0x4aa1('0x1d')]=qs['limit'](_0x82a374['query'][_0x4aa1('0x1d')]);_0xb24d15[_0x4aa1('0x1b')]=qs['offset'](_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x1b')]);}_0xb24d15[_0x4aa1('0x50')]=qs[_0x4aa1('0x51')](_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x51')]);_0xb24d15[_0x4aa1('0x52')]=qs[_0x4aa1('0x4b')](_[_0x4aa1('0x53')](_0x82a374[_0x4aa1('0x4a')],_0x2caa38[_0x4aa1('0x4b')]));_0xb24d15[_0x4aa1('0x52')][_0x4aa1('0x65')]=_0x4eb4b7['id'];if(_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x54')]){_0xb24d15[_0x4aa1('0x52')]=_[_0x4aa1('0x55')](_0xb24d15[_0x4aa1('0x52')],{'$or':_[_0x4aa1('0x44')](_0xb24d15[_0x4aa1('0x4d')],function(_0x2186f8){var _0x48f0ff={};_0x48f0ff[_0x2186f8]={'$like':'%'+_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x54')]+'%'};return _0x48f0ff;})});}if(_0x82a374['query']['$gte']){var _0x4a4dfb=_0x82a374['query'][_0x4aa1('0x9b')][_0x4aa1('0x9c')](',');var _0x177add={};_0x177add[_0x4a4dfb[0x0]]={'$gte':moment(_0x4a4dfb[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xb24d15[_0x4aa1('0x52')]=_['merge'](_0xb24d15['where'],_0x177add);}_0xb24d15=_[_0x4aa1('0x55')]({},_0xb24d15,_0x82a374[_0x4aa1('0x5e')]);return db['MailMessage'][_0x4aa1('0x1e')]({'where':_0xb24d15[_0x4aa1('0x52')]})[_0x4aa1('0xe')](function(_0x27a62f){_0x1874df[_0x4aa1('0x1e')]=_0x27a62f;if(_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x58')]){_0xb24d15[_0x4aa1('0x5d')]=[{'all':!![]}];}return db[_0x4aa1('0x9a')][_0x4aa1('0x59')](_0xb24d15);})['then'](function(_0xeb2590){if(_0x82a374[_0x4aa1('0x4a')][_0x4aa1('0x9d')]===_0x4aa1('0x9e')){for(var _0x23285e=0x0;_0x23285e<_0xeb2590[_0x4aa1('0x4f')];_0x23285e++){_0xeb2590[_0x23285e][_0x4aa1('0x60')]=juice(_0xeb2590[_0x23285e]['body']);}}_0x1874df['rows']=_0xeb2590;return _0x1874df;});}})['then'](respondWithFilteredResult(_0x2e898a,_0xb24d15))[_0x4aa1('0x16')](handleError(_0x2e898a,null));};exports[_0x4aa1('0x27')]=function(_0x5e8280,_0xa4e723){var _0x546d1a,_0x43e5fa={},_0x3eed86;if(_0x5e8280['body']['to']){_0x3eed86=_0x5e8280['body']['to'][_0x4aa1('0x9c')](',')[0x0];}return db[_0x4aa1('0x57')][_0x4aa1('0x5f')]({'where':{'id':_0x5e8280[_0x4aa1('0x5c')]['id']},'include':[{'model':db[_0x4aa1('0x9f')],'as':_0x4aa1('0xa0'),'include':[{'model':db[_0x4aa1('0x87')],'as':_0x4aa1('0xa1'),'where':{'email':_0x3eed86},'limit':0x1,'order':[[_0x4aa1('0xa2'),_0x4aa1('0xa3')]]}]},{'model':db[_0x4aa1('0x41')],'as':_0x4aa1('0x3f'),'raw':!![],'include':[{'model':db[_0x4aa1('0xa4')],'as':_0x4aa1('0xa4'),'raw':!![]}]}]})[_0x4aa1('0xe')](handleEntityNotFound(_0xa4e723,null))[_0x4aa1('0xe')](function(_0x5afbb3){if(!_0x5afbb3)return;_0x546d1a=_0x5afbb3;if(!_0x5afbb3[_0x4aa1('0x3f')])throw new Error(_0x4aa1('0xa5'));if(_[_0x4aa1('0x75')](_0x5e8280[_0x4aa1('0x60')]['from'])){_0x5e8280[_0x4aa1('0x60')][_0x4aa1('0xa6')]=util[_0x4aa1('0xa7')](_0x4aa1('0xa8'),_0x5afbb3[_0x4aa1('0x26')],_0x5afbb3[_0x4aa1('0x73')]||_0x5afbb3[_0x4aa1('0x3f')][_0x4aa1('0x33')]);}if(_0x5e8280['body'][_0x4aa1('0xa9')]&&_0x5e8280[_0x4aa1('0x60')][_0x4aa1('0xa9')][_0x4aa1('0x4f')]){for(var _0x30fefd=0x0;_0x30fefd<_0x5e8280[_0x4aa1('0x60')]['attachments'][_0x4aa1('0x4f')];_0x30fefd+=0x1){_0x5e8280[_0x4aa1('0x60')][_0x4aa1('0xa9')][_0x30fefd]={'filename':_0x5e8280['body'][_0x4aa1('0xa9')][_0x30fefd][_0x4aa1('0x26')],'path':path[_0x4aa1('0xaa')](config[_0x4aa1('0xab')],_0x4aa1('0xac'),_0x5e8280[_0x4aa1('0x60')]['attachments'][_0x30fefd][_0x4aa1('0xad')])};}}var _0x4067cd=_0x5afbb3['getSmtpOptions']();return respondWithRpcPromise(_0x4aa1('0xae'),_0x4aa1('0xaf'),{'account':_0x4067cd,'message':_0x5e8280['body']});})['then'](function(_0x225067){if(!_0x225067)return;_0x43e5fa=_0x225067;if(!_0x546d1a[_0x4aa1('0xa0')])throw new Error(_0x4aa1('0xb0'));if(_0x546d1a['List'][_0x4aa1('0xa1')][_0x4aa1('0x4f')])return _0x546d1a[_0x4aa1('0xa0')][_0x4aa1('0xa1')][0x0];return db[_0x4aa1('0x87')][_0x4aa1('0x66')](_[_0x4aa1('0xa')](_0x5e8280[_0x4aa1('0x60')],{'firstName':_0x5e8280[_0x4aa1('0x60')]['to'],'email':_0x5e8280['body']['to'],'phone':_0x5e8280[_0x4aa1('0x60')]['to'],'ListId':_0x546d1a[_0x4aa1('0x74')]}));})[_0x4aa1('0xe')](function(_0x172630){if(!_0x172630)return;var _0x3239fb={'UserId':_0x5e8280[_0x4aa1('0x33')]['id'],'ContactId':_0x172630['id'],'MailAccountId':_0x546d1a['id'],'inReplyTo':_0x43e5fa[_0x4aa1('0xb1')],'to':_0x5e8280[_0x4aa1('0x60')]['from'],'cc':_0x5e8280['body']['cc'],'subject':_0x5e8280['body'][_0x4aa1('0xb2')],'attach':_0x5e8280['body'][_0x4aa1('0xb3')],'firstMsgDirection':_0x4aa1('0xb4'),'lastMsgAt':moment()[_0x4aa1('0xa7')](_0x4aa1('0xb5')),'lastMsgDirection':_0x4aa1('0xb4'),'Messages':[_[_0x4aa1('0x55')](_0x5e8280[_0x4aa1('0x60')],{'messageId':_0x43e5fa['messageId'],'sentAt':moment()[_0x4aa1('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x546d1a['id'],'UserId':_0x5e8280['user']['id'],'ContactId':_0x172630['id']})]};if(_0x5e8280['body']['Interaction']){_0x3239fb=_[_0x4aa1('0x55')](_0x3239fb,_0x5e8280[_0x4aa1('0x60')][_0x4aa1('0xb6')]);}return db[_0x4aa1('0x86')]['create'](_0x3239fb,{'include':[{'model':db['MailMessage'],'as':_0x4aa1('0xb7')}]});})['then'](respondWithResult(_0xa4e723,null))['catch'](handleError(_0xa4e723,null));};exports[_0x4aa1('0xb8')]=function(_0x4ad098,_0x2a3452){return db['MailAccount'][_0x4aa1('0x5f')]({'where':{'id':_0x4ad098[_0x4aa1('0x5c')]['id']},'include':[{'model':db[_0x4aa1('0x41')],'as':_0x4aa1('0x3f'),'raw':!![],'include':[{'model':db[_0x4aa1('0xa4')],'as':_0x4aa1('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2a3452,null))[_0x4aa1('0xe')](function(_0x3af721){if(!_0x3af721[_0x4aa1('0x3f')])return;var _0x5ce635=_0x3af721[_0x4aa1('0xb9')]();return respondWithRpcPromise(_0x4aa1('0xba'),_0x4aa1('0xb8'),{'account':_0x5ce635});})[_0x4aa1('0xe')](respondWithResult(_0x2a3452,null))[_0x4aa1('0x16')](handleError(_0x2a3452,null));};exports[_0x4aa1('0x22')]=function(_0x51bdb5,_0x5dd817){return db[_0x4aa1('0x57')][_0x4aa1('0x5f')]({'where':{'id':_0x51bdb5[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x5dd817,null))[_0x4aa1('0xe')](function(_0x5b7d0d){if(_0x5b7d0d&&_0x5b7d0d[_0x4aa1('0x3a')]){throw new db[(_0x4aa1('0xbb'))][(_0x4aa1('0xbc'))](_0x4aa1('0xbd'));}return _0x5b7d0d;})[_0x4aa1('0xe')](removeEntity(_0x5dd817,null))[_0x4aa1('0x16')](handleError(_0x5dd817,null));};exports['addAgents']=function(_0x40ec1e,_0x2b0cfe){return db[_0x4aa1('0x57')][_0x4aa1('0x5f')]({'where':{'id':_0x40ec1e[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x2b0cfe,null))['then'](function(_0x44052e){if(_0x44052e){return _0x44052e['addAgents'](_0x40ec1e[_0x4aa1('0x60')][_0x4aa1('0x6d')],_[_0x4aa1('0xbe')](_0x40ec1e[_0x4aa1('0x60')],[_0x4aa1('0x6d'),'id'])||{})[_0x4aa1('0xbf')](function(_0x166cf5){for(var _0x4b281a=0x0;_0x4b281a<_0x40ec1e[_0x4aa1('0x60')][_0x4aa1('0x6d')][_0x4aa1('0x4f')];_0x4b281a+=0x1){socket[_0x4aa1('0xc0')](_0x4aa1('0xc1'),{'UserId':Number(_0x40ec1e[_0x4aa1('0x60')][_0x4aa1('0x6d')][_0x4b281a]),'MailAccountId':Number(_0x40ec1e[_0x4aa1('0x5c')]['id'])});}return _0x166cf5;});}})[_0x4aa1('0xe')](respondWithResult(_0x2b0cfe,null))[_0x4aa1('0x16')](handleError(_0x2b0cfe,null));};exports[_0x4aa1('0xc2')]=function(_0x235217,_0x15f16){return db[_0x4aa1('0x57')][_0x4aa1('0x5f')]({'where':{'id':_0x235217['params']['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x15f16,null))[_0x4aa1('0xe')](function(_0x3bc684){if(_0x3bc684){return _0x3bc684[_0x4aa1('0xc2')](_0x235217[_0x4aa1('0x4a')]['ids'])[_0x4aa1('0xe')](function(){if(_['isArray'](_0x235217[_0x4aa1('0x4a')]['ids'])){for(var _0x4721db=0x0;_0x4721db<_0x235217[_0x4aa1('0x4a')][_0x4aa1('0x6d')][_0x4aa1('0x4f')];_0x4721db+=0x1){socket['emit'](_0x4aa1('0xc3'),{'UserId':Number(_0x235217['query'][_0x4aa1('0x6d')][_0x4721db]),'MailAccountId':Number(_0x235217[_0x4aa1('0x5c')]['id'])});}}else{socket[_0x4aa1('0xc0')](_0x4aa1('0xc3'),{'UserId':Number(_0x235217[_0x4aa1('0x4a')][_0x4aa1('0x6d')]),'MailAccountId':Number(_0x235217['params']['id'])});}});}})[_0x4aa1('0xe')](respondWithStatusCode(_0x15f16,null))[_0x4aa1('0x16')](handleError(_0x15f16,null));};exports[_0x4aa1('0xc4')]=function(_0x230dc0,_0x3583d8){var _0x4e76a0={};var _0x1e495a={};var _0x4b5a8b;var _0x265aad;return db[_0x4aa1('0x57')][_0x4aa1('0x68')]({'where':{'id':_0x230dc0[_0x4aa1('0x5c')]['id']}})[_0x4aa1('0xe')](handleEntityNotFound(_0x3583d8,null))[_0x4aa1('0xe')](function(_0x5f124f){if(_0x5f124f){_0x4b5a8b=_0x5f124f;_0x1e495a['model']=_[_0x4aa1('0x49')](db[_0x4aa1('0x89')][_0x4aa1('0x45')]);_0x1e495a[_0x4aa1('0x4a')]=_[_0x4aa1('0x49')](_0x230dc0['query']);_0x1e495a[_0x4aa1('0x4b')]=_[_0x4aa1('0x4c')](_0x1e495a['model'],_0x1e495a['query']);_0x4e76a0[_0x4aa1('0x4d')]=_[_0x4aa1('0x4c')](_0x1e495a[_0x4aa1('0x48')],qs[_0x4aa1('0x4e')](_0x230dc0[_0x4aa1('0x4a')][_0x4aa1('0x4e')]));_0x4e76a0[_0x4aa1('0x4d')]=_0x4e76a0['attributes'][_0x4aa1('0x4f')]?_0x4e76a0[_0x4aa1('0x4d')]:_0x1e495a[_0x4aa1('0x48')];_0x4e76a0[_0x4aa1('0x50')]=qs[_0x4aa1('0x51')](_0x230dc0[_0x4aa1('0x4a')][_0x4aa1('0x51')]);_0x4e76a0[_0x4aa1('0x52')]=qs[_0x4aa1('0x4b')](_[_0x4aa1('0x53')](_0x230dc0[_0x4aa1('0x4a')],_0x1e495a[_0x4aa1('0x4b')]));if(_0x230dc0['query'][_0x4aa1('0x54')]){_0x4e76a0[_0x4aa1('0x52')]=_[_0x4aa1('0x55')](_0x4e76a0[_0x4aa1('0x52')],{'$or':_['map'](_0x4e76a0[_0x4aa1('0x4d')],function(_0xd6bf4e){var _0x203f03={};_0x203f03[_0xd6bf4e]={'$like':'%'+_0x230dc0[_0x4aa1('0x4a')]['filter']+'%'};return _0x203f03;})});}_0x4e76a0=_[_0x4aa1('0x55')]({},_0x4e76a0,_0x230dc0[_0x4aa1('0x5e')]);return _0x4b5a8b[_0x4aa1('0xc4')](_0x4e76a0);}})[_0x4aa1('0xe')](function(_0x515f9a){if(_0x515f9a){_0x265aad=_0x515f9a['length'];if(!_0x230dc0[_0x4aa1('0x4a')][_0x4aa1('0x69')]('nolimit')){_0x4e76a0['limit']=qs[_0x4aa1('0x1d')](_0x230dc0[_0x4aa1('0x4a')]['limit']);_0x4e76a0['offset']=qs[_0x4aa1('0x1b')](_0x230dc0[_0x4aa1('0x4a')][_0x4aa1('0x1b')]);}return _0x4b5a8b[_0x4aa1('0xc4')](_0x4e76a0);}})[_0x4aa1('0xe')](function(_0x2b8731){if(_0x2b8731){return _0x2b8731?{'count':_0x265aad,'rows':_0x2b8731}:null;}})['then'](respondWithResult(_0x3583d8,null))[_0x4aa1('0x16')](handleError(_0x3583d8,null));}; \ No newline at end of file +var _0x9bbb=['imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','pass','Imap','Smtp','MailServerIn','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','MailServerOut','Pause','length','options','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','find','params','Disposition','getDispositions','order','sort','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','findOne','include','removeAnswers','email','ListId','active','description','create','get','UserProfileSection','MailAccounts','userProfileId','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','send','getApplications','$gte','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','CmList','List','CmContact','Contacts','DESC','CloudProvider','from','format','%s\x20<%s>','attachments','join','basename','getSmtpOptions','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','update','UserProfileResource','destroy','stack','name','gmail','imap.gmail.com','yahoo'];(function(_0x2d624b,_0x21b889){var _0xa8609c=function(_0x1f5be0){while(--_0x1f5be0){_0x2d624b['push'](_0x2d624b['shift']());}};_0xa8609c(++_0x21b889);}(_0x9bbb,0x157));var _0xb9bb=function(_0x46fea6,_0x20902a){_0x46fea6=_0x46fea6-0x0;var _0x91bef9=_0x9bbb[_0x46fea6];return _0x91bef9;};'use strict';var moment=require(_0xb9bb('0x0'));var BPromise=require('bluebird');var util=require(_0xb9bb('0x1'));var path=require(_0xb9bb('0x2'));var _=require(_0xb9bb('0x3'));var juice=require(_0xb9bb('0x4'));var Redis=require('ioredis');var qs=require(_0xb9bb('0x5'));var logger=require(_0xb9bb('0x6'))(_0xb9bb('0x7'));var config=require(_0xb9bb('0x8'));var db=require(_0xb9bb('0x9'))['db'];config[_0xb9bb('0xa')]=_[_0xb9bb('0xb')](config[_0xb9bb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9bb('0xc'))(new Redis(config[_0xb9bb('0xa')]));require(_0xb9bb('0xd'))[_0xb9bb('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb9bb('0xf')][_0xb9bb('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x386b37,_0x387e15,_0x3057d7,_0x3539a6){return new BPromise(function(_0x2da8cf,_0xb5c3a6){var _0x2ddd5f=_0x3539a6||client;return _0x2ddd5f[_0xb9bb('0x11')](_0x386b37,_0x3057d7)[_0xb9bb('0x12')](function(_0x2cafe7){logger[_0xb9bb('0x13')](_0xb9bb('0x14'),_0x387e15,_0xb9bb('0x15'));logger[_0xb9bb('0x16')](_0xb9bb('0x17'),_0x387e15,_0xb9bb('0x15'),JSON[_0xb9bb('0x18')](_0x2cafe7));if(_0x2cafe7[_0xb9bb('0x19')]){if(_0x2cafe7[_0xb9bb('0x19')]['code']===0x1f4){logger[_0xb9bb('0x19')](_0xb9bb('0x14'),_0x387e15,_0x2cafe7['error'][_0xb9bb('0x1a')]);return _0xb5c3a6(_0x2cafe7[_0xb9bb('0x19')][_0xb9bb('0x1a')]);}logger[_0xb9bb('0x19')](_0xb9bb('0x14'),_0x387e15,_0x2cafe7['error'][_0xb9bb('0x1a')]);return _0x2da8cf(_0x2cafe7[_0xb9bb('0x19')]['message']);}else{logger[_0xb9bb('0x13')](_0xb9bb('0x14'),_0x387e15,_0xb9bb('0x15'));_0x2da8cf(_0x2cafe7['result'][_0xb9bb('0x1a')]);}})['catch'](function(_0x15184d){logger[_0xb9bb('0x19')](_0xb9bb('0x14'),_0x387e15,_0x15184d);_0xb5c3a6(_0x15184d);});});}function respondWithStatusCode(_0x3f9731,_0x4648e4){_0x4648e4=_0x4648e4||0xcc;return function(_0x58b6a3){if(_0x58b6a3){return _0x3f9731[_0xb9bb('0x1b')](_0x4648e4);}return _0x3f9731['status'](_0x4648e4)[_0xb9bb('0x1c')]();};}function respondWithResult(_0x10f639,_0x3a760b){_0x3a760b=_0x3a760b||0xc8;return function(_0x5cc424){if(_0x5cc424){return _0x10f639[_0xb9bb('0x1d')](_0x3a760b)[_0xb9bb('0x1e')](_0x5cc424);}};}function respondWithFilteredResult(_0x5370e7,_0x22d717){return function(_0x5c482a){if(_0x5c482a){var _0x4ac737=typeof _0x22d717['offset']==='undefined'&&typeof _0x22d717[_0xb9bb('0x1f')]===_0xb9bb('0x20');var _0x3f6331=_0x5c482a['count'];var _0x334468=_0x4ac737?0x0:_0x22d717[_0xb9bb('0x21')];var _0x2380f0=_0x4ac737?_0x5c482a[_0xb9bb('0x22')]:_0x22d717[_0xb9bb('0x21')]+_0x22d717[_0xb9bb('0x1f')];var _0x561dbc;if(_0x2380f0>=_0x3f6331){_0x2380f0=_0x3f6331;_0x561dbc=0xc8;}else{_0x561dbc=0xce;}_0x5370e7[_0xb9bb('0x1d')](_0x561dbc);return _0x5370e7[_0xb9bb('0x23')](_0xb9bb('0x24'),_0x334468+'-'+_0x2380f0+'/'+_0x3f6331)[_0xb9bb('0x1e')](_0x5c482a);}return null;};}function saveUpdates(_0x490d02){return function(_0x199564){if(_0x199564){return _0x199564[_0xb9bb('0x25')](_0x490d02)[_0xb9bb('0x12')](function(_0x4fe30d){return _0x4fe30d;});}return null;};}function removeEntity(_0x21d2d0){return function(_0x3cc9bc){if(_0x3cc9bc){return _0x3cc9bc['destroy']()[_0xb9bb('0x12')](function(){var _0x10e0d9=_0x3cc9bc['get']({'plain':!![]});var _0x2d21fb='MailAccounts';return db[_0xb9bb('0x26')][_0xb9bb('0x27')]({'where':{'type':_0x2d21fb,'resourceId':_0x10e0d9['id']}})[_0xb9bb('0x12')](function(){return _0x3cc9bc;});})[_0xb9bb('0x12')](function(){_0x21d2d0[_0xb9bb('0x1d')](0xcc)[_0xb9bb('0x1c')]();});}};}function handleEntityNotFound(_0x4f2570){return function(_0x5c96ed){if(!_0x5c96ed){_0x4f2570[_0xb9bb('0x1b')](0x194);}return _0x5c96ed;};}function handleError(_0xdef47a,_0x31339f){_0x31339f=_0x31339f||0x1f4;return function(_0x3dc4a6){logger['error'](_0x3dc4a6[_0xb9bb('0x28')]);if(_0x3dc4a6[_0xb9bb('0x29')]){delete _0x3dc4a6[_0xb9bb('0x29')];}_0xdef47a['status'](_0x31339f)['send'](_0x3dc4a6);};}function getImapHost(_0x5f1335){switch(_0x5f1335){case _0xb9bb('0x2a'):return _0xb9bb('0x2b');case _0xb9bb('0x2c'):return _0xb9bb('0x2d');case _0xb9bb('0x2e'):return _0xb9bb('0x2f');case _0xb9bb('0x30'):return _0xb9bb('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5f1335);}function getSmtpHost(_0x6b86d5){switch(_0x6b86d5){case'gmail':return _0xb9bb('0x32');case'yahoo':return _0xb9bb('0x33');case'hotmail':return'smtp-mail.outlook.com';case _0xb9bb('0x30'):return _0xb9bb('0x34');}throw new Error(_0xb9bb('0x35'),_0x6b86d5);}function getAuthenticationOptions(_0x2e2825,_0xea5fab){var _0x155013={};var _0x14cace={};if(_0x2e2825){_0x155013[_0xb9bb('0x36')]=_0x14cace['user']=_0xea5fab[_0xb9bb('0x37')];_0x155013[_0xb9bb('0x38')]=_0x14cace['pass']=_0xea5fab[_0xb9bb('0x38')];if(_0xea5fab[_0xb9bb('0x39')]){_0x155013['modernAuthentication']=_0x14cace['modernAuthentication']=!![];_0x155013[_0xb9bb('0x3a')]=_0x14cace[_0xb9bb('0x3a')]=_0xea5fab[_0xb9bb('0x3a')];_0x155013['password']=_0x14cace['pass']=null;}else{_0x155013[_0xb9bb('0x3a')]=_0x14cace[_0xb9bb('0x3a')]=null;}_0x155013[_0xb9bb('0x3b')]=getImapHost(_0x2e2825);_0x155013[_0xb9bb('0x3c')]=0x3e1;_0x14cace['host']=getSmtpHost(_0x2e2825);_0x14cace[_0xb9bb('0x3c')]=0x24b;_0x14cace[_0xb9bb('0x3d')]=![];_0x155013[_0xb9bb('0x3e')]=_0x14cace[_0xb9bb('0x3e')]=null;}else{if(_0xea5fab[_0xb9bb('0x3f')]){_0x155013[_0xb9bb('0x36')]=_0x14cace[_0xb9bb('0x36')]=_0xea5fab[_0xb9bb('0x37')];_0x155013[_0xb9bb('0x38')]=_0x14cace[_0xb9bb('0x40')]=_0xea5fab[_0xb9bb('0x38')];}else{_0x155013[_0xb9bb('0x3f')]=_0x14cace[_0xb9bb('0x3f')]=![];_0x155013[_0xb9bb('0x36')]=_0x14cace[_0xb9bb('0x36')]=null;_0x155013[_0xb9bb('0x38')]=_0x14cace[_0xb9bb('0x40')]=null;}_0x155013[_0xb9bb('0x3b')]=_0xea5fab[_0xb9bb('0x41')][_0xb9bb('0x3b')];_0x155013['port']=_0xea5fab[_0xb9bb('0x41')][_0xb9bb('0x3c')];_0x14cace[_0xb9bb('0x3b')]=_0xea5fab[_0xb9bb('0x42')][_0xb9bb('0x3b')];_0x14cace[_0xb9bb('0x3c')]=_0xea5fab[_0xb9bb('0x42')][_0xb9bb('0x3c')];}return{'Imap':_0x155013,'Smtp':_0x14cace};}exports['index']=function(_0x426fac,_0x13db6c){var _0x3e4106={'include':[{'model':db[_0xb9bb('0x43')],'as':_0xb9bb('0x41')},{'model':db['MailServerOut'],'as':_0xb9bb('0x42')},{'model':db['Pause'],'as':_0xb9bb('0x44')}]},_0x3d8412={},_0x5998af={'count':0x0,'rows':[]};var _0x51d6a5=_['map'](db[_0xb9bb('0x45')][_0xb9bb('0x46')],function(_0x217fcc){return{'name':_0x217fcc[_0xb9bb('0x47')],'type':_0x217fcc['type'][_0xb9bb('0x48')]};});_0x3d8412[_0xb9bb('0x49')]=_[_0xb9bb('0x4a')](_0x51d6a5,_0xb9bb('0x29'));_0x3d8412[_0xb9bb('0x4b')]=_[_0xb9bb('0x4c')](_0x426fac[_0xb9bb('0x4b')]);_0x3d8412[_0xb9bb('0x4d')]=_[_0xb9bb('0x4e')](_0x3d8412[_0xb9bb('0x49')],_0x3d8412[_0xb9bb('0x4b')]);_0x3e4106[_0xb9bb('0x4f')]=_['intersection'](_0x3d8412['model'],qs[_0xb9bb('0x50')](_0x426fac[_0xb9bb('0x4b')][_0xb9bb('0x50')]));_0x3e4106[_0xb9bb('0x4f')]=_0x3e4106['attributes']['length']?_0x3e4106['attributes']:_0x3d8412[_0xb9bb('0x49')];if(!_0x426fac[_0xb9bb('0x4b')][_0xb9bb('0x51')](_0xb9bb('0x52'))){_0x3e4106['limit']=qs['limit'](_0x426fac[_0xb9bb('0x4b')]['limit']);_0x3e4106[_0xb9bb('0x21')]=qs[_0xb9bb('0x21')](_0x426fac['query']['offset']);}_0x3e4106['order']=qs['sort'](_0x426fac[_0xb9bb('0x4b')]['sort']);_0x3e4106[_0xb9bb('0x53')]=qs[_0xb9bb('0x4d')](_['pick'](_0x426fac[_0xb9bb('0x4b')],_0x3d8412[_0xb9bb('0x4d')]),_0x51d6a5);if(_0x426fac[_0xb9bb('0x4b')][_0xb9bb('0x54')]){_0x3e4106[_0xb9bb('0x53')]=_[_0xb9bb('0x55')](_0x3e4106[_0xb9bb('0x53')],{'$or':_['map'](_0x51d6a5,function(_0x21ebc0){if(_0x21ebc0[_0xb9bb('0x56')]!==_0xb9bb('0x57')){var _0x125800={};_0x125800[_0x21ebc0[_0xb9bb('0x29')]]={'$like':'%'+_0x426fac['query'][_0xb9bb('0x54')]+'%'};return _0x125800;}})});}_0x3e4106=_[_0xb9bb('0x55')]({},_0x3e4106,_0x426fac['options']);var _0x39061e={'where':_0x3e4106[_0xb9bb('0x53')]};return db[_0xb9bb('0x45')][_0xb9bb('0x22')](_0x39061e)['then'](function(_0x36acaa){_0x5998af[_0xb9bb('0x22')]=_0x36acaa;if(_0x426fac[_0xb9bb('0x4b')][_0xb9bb('0x58')]){_0x3e4106['include']=[{'all':!![]}];}return db[_0xb9bb('0x45')][_0xb9bb('0x59')](_0x3e4106);})[_0xb9bb('0x12')](function(_0x4f042b){_0x5998af[_0xb9bb('0x5a')]=_0x4f042b;return _0x5998af;})[_0xb9bb('0x12')](respondWithFilteredResult(_0x13db6c,_0x3e4106))[_0xb9bb('0x5b')](handleError(_0x13db6c,null));};exports[_0xb9bb('0x5c')]=function(_0xd6ef1e,_0x23382b){var _0x4b4d6f={'raw':![],'where':{'id':_0xd6ef1e['params']['id']},'include':[{'model':db[_0xb9bb('0x43')],'as':_0xb9bb('0x41')},{'model':db[_0xb9bb('0x5d')],'as':_0xb9bb('0x42')},{'model':db[_0xb9bb('0x5e')],'as':'mandatoryDispositionPause'}]},_0x19b244={};_0x19b244[_0xb9bb('0x49')]=_[_0xb9bb('0x4c')](db[_0xb9bb('0x45')][_0xb9bb('0x46')]);_0x19b244[_0xb9bb('0x4b')]=_['keys'](_0xd6ef1e['query']);_0x19b244[_0xb9bb('0x4d')]=_[_0xb9bb('0x4e')](_0x19b244['model'],_0x19b244[_0xb9bb('0x4b')]);_0x4b4d6f[_0xb9bb('0x4f')]=_['intersection'](_0x19b244[_0xb9bb('0x49')],qs['fields'](_0xd6ef1e['query']['fields']));_0x4b4d6f[_0xb9bb('0x4f')]=_0x4b4d6f[_0xb9bb('0x4f')][_0xb9bb('0x5f')]?_0x4b4d6f[_0xb9bb('0x4f')]:_0x19b244['model'];if(_0xd6ef1e[_0xb9bb('0x4b')][_0xb9bb('0x58')]){_0x4b4d6f['include']=[{'all':!![]}];}_0x4b4d6f=_[_0xb9bb('0x55')]({},_0x4b4d6f,_0xd6ef1e[_0xb9bb('0x60')]);return db[_0xb9bb('0x45')]['find'](_0x4b4d6f)[_0xb9bb('0x12')](handleEntityNotFound(_0x23382b,null))[_0xb9bb('0x12')](respondWithResult(_0x23382b,null))[_0xb9bb('0x5b')](handleError(_0x23382b,null));};exports['update']=function(_0x504ee0,_0x3f0fd3){if(_0x504ee0['body']['id']){delete _0x504ee0[_0xb9bb('0x61')]['id'];}var _0x1fbeb4=_0x504ee0[_0xb9bb('0x61')][_0xb9bb('0x62')]===_0xb9bb('0x63')?null:_0x504ee0['body'][_0xb9bb('0x62')];var _0x197201=_0x504ee0[_0xb9bb('0x61')][_0xb9bb('0x41')]||{};var _0x1a6155=_0x504ee0[_0xb9bb('0x61')][_0xb9bb('0x42')]||{};if(_0x1fbeb4){_0x197201[_0xb9bb('0x3b')]=getImapHost(_0x1fbeb4);_0x197201[_0xb9bb('0x3c')]=0x3e1;_0x1a6155[_0xb9bb('0x3b')]=getSmtpHost(_0x1fbeb4);_0x1a6155['port']=0x24b;_0x1a6155[_0xb9bb('0x3d')]=![];}if(_0x1a6155['modernAuthentication']){_0x1a6155[_0xb9bb('0x3d')]=![];}else{_0x1a6155['CloudProviderId']=null;}if(!_0x197201[_0xb9bb('0x39')])_0x197201[_0xb9bb('0x3a')]=null;_0x504ee0[_0xb9bb('0x61')][_0xb9bb('0x41')]=_0x197201;_0x504ee0[_0xb9bb('0x61')]['Smtp']=_0x1a6155;return db[_0xb9bb('0x45')]['find']({'where':{'id':_0x504ee0['params']['id']},'include':[{'model':db[_0xb9bb('0x43')],'as':_0xb9bb('0x41')},{'model':db[_0xb9bb('0x5d')],'as':_0xb9bb('0x42')},{'model':db[_0xb9bb('0x5e')],'as':_0xb9bb('0x44')}]})['then'](handleEntityNotFound(_0x3f0fd3,null))[_0xb9bb('0x12')](function(_0xc0ee0a){if(!_0xc0ee0a)throw new Error(_0xb9bb('0x64'));if(_0xc0ee0a['service'])delete _0x504ee0[_0xb9bb('0x61')]['Imap'];return _0xc0ee0a;})[_0xb9bb('0x12')](saveUpdates(_0x504ee0[_0xb9bb('0x61')],null))[_0xb9bb('0x12')](function(_0x1425a7){if(!_0x504ee0[_0xb9bb('0x61')][_0xb9bb('0x41')])return _0x1425a7;return db[_0xb9bb('0x43')][_0xb9bb('0x25')](_0x504ee0[_0xb9bb('0x61')]['Imap'],{'where':{'MailAccountId':_0x1425a7['id']}})[_0xb9bb('0x12')](function(){return _0x1425a7;});})[_0xb9bb('0x12')](function(_0x1bd358){if(!_0x504ee0[_0xb9bb('0x61')]['Smtp'])return _0x1bd358;return db[_0xb9bb('0x5d')]['update'](_0x504ee0['body']['Smtp'],{'where':{'MailAccountId':_0x1bd358['id']}})[_0xb9bb('0x12')](function(){return _0x1bd358;});})[_0xb9bb('0x12')](respondWithResult(_0x3f0fd3,null))[_0xb9bb('0x5b')](handleError(_0x3f0fd3,null));};exports[_0xb9bb('0x65')]=function(_0x4c0759,_0x5f28d7){return db['MailAccount'][_0xb9bb('0x65')]()[_0xb9bb('0x12')](respondWithResult(_0x5f28d7,null))[_0xb9bb('0x5b')](handleError(_0x5f28d7,null));};exports[_0xb9bb('0x66')]=function(_0x2c3080,_0x5ad8d5){if(_0x2c3080[_0xb9bb('0x61')]['id']){delete _0x2c3080[_0xb9bb('0x61')]['id'];}return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x2c3080[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x5ad8d5,null))['then'](function(_0x221e6a){if(_0x221e6a){_0x2c3080[_0xb9bb('0x61')]['MailAccountId']=_0x221e6a['id'];return db[_0xb9bb('0x69')]['create'](_0x2c3080[_0xb9bb('0x61')]);}})[_0xb9bb('0x12')](respondWithResult(_0x5ad8d5,null))[_0xb9bb('0x5b')](handleError(_0x5ad8d5,null));};exports[_0xb9bb('0x6a')]=function(_0x90fa43,_0x497d4d){var _0x41a263={'raw':![],'where':{}};var _0x5f4283={};var _0x333944={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x90fa43[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x497d4d,null))[_0xb9bb('0x12')](function(_0x924e87){if(_0x924e87){_0x5f4283[_0xb9bb('0x49')]=_['keys'](db[_0xb9bb('0x69')][_0xb9bb('0x46')]);_0x5f4283[_0xb9bb('0x4b')]=_[_0xb9bb('0x4c')](_0x90fa43[_0xb9bb('0x4b')]);_0x5f4283[_0xb9bb('0x4d')]=_['intersection'](_0x5f4283[_0xb9bb('0x49')],_0x5f4283[_0xb9bb('0x4b')]);_0x41a263[_0xb9bb('0x4f')]=_[_0xb9bb('0x4e')](_0x5f4283[_0xb9bb('0x49')],qs[_0xb9bb('0x50')](_0x90fa43[_0xb9bb('0x4b')][_0xb9bb('0x50')]));_0x41a263[_0xb9bb('0x4f')]=_0x41a263[_0xb9bb('0x4f')]['length']?_0x41a263[_0xb9bb('0x4f')]:_0x5f4283[_0xb9bb('0x49')];if(!_0x90fa43[_0xb9bb('0x4b')][_0xb9bb('0x51')]('nolimit')){_0x41a263[_0xb9bb('0x1f')]=qs[_0xb9bb('0x1f')](_0x90fa43[_0xb9bb('0x4b')]['limit']);_0x41a263['offset']=qs['offset'](_0x90fa43['query'][_0xb9bb('0x21')]);}_0x41a263[_0xb9bb('0x6b')]=qs[_0xb9bb('0x6c')](_0x90fa43[_0xb9bb('0x4b')]['sort']);_0x41a263['where']=qs['filters'](_[_0xb9bb('0x6d')](_0x90fa43['query'],_0x5f4283['filters']));_0x41a263[_0xb9bb('0x53')]['MailAccountId']=_0x924e87['id'];if(_0x90fa43['query'][_0xb9bb('0x54')]){_0x41a263[_0xb9bb('0x53')]=_[_0xb9bb('0x55')](_0x41a263[_0xb9bb('0x53')],{'$or':_['map'](_0x41a263['attributes'],function(_0x5b9be4){var _0x53b15f={};_0x53b15f[_0x5b9be4]={'$like':'%'+_0x90fa43[_0xb9bb('0x4b')][_0xb9bb('0x54')]+'%'};return _0x53b15f;})});}_0x41a263=_['merge']({},_0x41a263,_0x90fa43[_0xb9bb('0x60')]);return db[_0xb9bb('0x69')][_0xb9bb('0x22')]({'where':_0x41a263['where']})[_0xb9bb('0x12')](function(_0x242848){_0x333944[_0xb9bb('0x22')]=_0x242848;if(_0x90fa43[_0xb9bb('0x4b')][_0xb9bb('0x58')]){_0x41a263['include']=[{'all':!![]}];}return db[_0xb9bb('0x69')][_0xb9bb('0x59')](_0x41a263);})['then'](function(_0x494eda){_0x333944['rows']=_0x494eda;return _0x333944;});}})['then'](respondWithFilteredResult(_0x497d4d,_0x41a263))[_0xb9bb('0x5b')](handleError(_0x497d4d,null));};exports['removeDispositions']=function(_0x4f1cfa,_0x2fbbdb){return db[_0xb9bb('0x45')]['find']({'where':{'id':_0x4f1cfa['params']['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x2fbbdb,null))[_0xb9bb('0x12')](function(_0x30614e){if(_0x30614e){return _0x30614e[_0xb9bb('0x6e')](_0x4f1cfa[_0xb9bb('0x4b')][_0xb9bb('0x6f')]);}})['then'](respondWithStatusCode(_0x2fbbdb,null))[_0xb9bb('0x5b')](handleError(_0x2fbbdb,null));};exports[_0xb9bb('0x70')]=function(_0x1ba920,_0x1e3fd7){if(_0x1ba920[_0xb9bb('0x61')]['id']){delete _0x1ba920[_0xb9bb('0x61')]['id'];}return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x1ba920[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x1e3fd7,null))['then'](function(_0x2838a1){if(_0x2838a1){_0x1ba920[_0xb9bb('0x61')][_0xb9bb('0x71')]=_0x2838a1['id'];return db[_0xb9bb('0x72')]['create'](_0x1ba920[_0xb9bb('0x61')]);}})[_0xb9bb('0x12')](respondWithResult(_0x1e3fd7,null))[_0xb9bb('0x5b')](handleError(_0x1e3fd7,null));};exports[_0xb9bb('0x73')]=function(_0x385768,_0x35bda0){var _0x10f670={'raw':![],'where':{}};var _0x3ffd6d={};var _0x98ef50={'count':0x0,'rows':[]};return db[_0xb9bb('0x45')][_0xb9bb('0x74')]({'where':{'id':_0x385768[_0xb9bb('0x68')]['id']}})['then'](handleEntityNotFound(_0x35bda0,null))[_0xb9bb('0x12')](function(_0xa89af4){if(_0xa89af4){_0x3ffd6d[_0xb9bb('0x49')]=_[_0xb9bb('0x4c')](db['CannedAnswer'][_0xb9bb('0x46')]);_0x3ffd6d[_0xb9bb('0x4b')]=_[_0xb9bb('0x4c')](_0x385768['query']);_0x3ffd6d['filters']=_[_0xb9bb('0x4e')](_0x3ffd6d[_0xb9bb('0x49')],_0x3ffd6d[_0xb9bb('0x4b')]);_0x10f670[_0xb9bb('0x4f')]=_[_0xb9bb('0x4e')](_0x3ffd6d[_0xb9bb('0x49')],qs[_0xb9bb('0x50')](_0x385768['query'][_0xb9bb('0x50')]));_0x10f670[_0xb9bb('0x4f')]=_0x10f670[_0xb9bb('0x4f')][_0xb9bb('0x5f')]?_0x10f670[_0xb9bb('0x4f')]:_0x3ffd6d[_0xb9bb('0x49')];if(!_0x385768[_0xb9bb('0x4b')][_0xb9bb('0x51')](_0xb9bb('0x52'))){_0x10f670[_0xb9bb('0x1f')]=qs[_0xb9bb('0x1f')](_0x385768[_0xb9bb('0x4b')]['limit']);_0x10f670[_0xb9bb('0x21')]=qs[_0xb9bb('0x21')](_0x385768[_0xb9bb('0x4b')][_0xb9bb('0x21')]);}_0x10f670['order']=qs[_0xb9bb('0x6c')](_0x385768[_0xb9bb('0x4b')]['sort']);_0x10f670[_0xb9bb('0x53')]=qs[_0xb9bb('0x4d')](_[_0xb9bb('0x6d')](_0x385768['query'],_0x3ffd6d[_0xb9bb('0x4d')]));_0x10f670[_0xb9bb('0x53')]['MailAccountId']=_0xa89af4['id'];if(_0x385768[_0xb9bb('0x4b')]['filter']){_0x10f670[_0xb9bb('0x53')]=_[_0xb9bb('0x55')](_0x10f670[_0xb9bb('0x53')],{'$or':_[_0xb9bb('0x4a')](_0x10f670[_0xb9bb('0x4f')],function(_0x47f757){var _0x21d7b5={};_0x21d7b5[_0x47f757]={'$like':'%'+_0x385768[_0xb9bb('0x4b')][_0xb9bb('0x54')]+'%'};return _0x21d7b5;})});}_0x10f670=_[_0xb9bb('0x55')]({},_0x10f670,_0x385768[_0xb9bb('0x60')]);return db[_0xb9bb('0x72')][_0xb9bb('0x22')]({'where':_0x10f670[_0xb9bb('0x53')]})['then'](function(_0x213502){_0x98ef50[_0xb9bb('0x22')]=_0x213502;if(_0x385768['query'][_0xb9bb('0x58')]){_0x10f670[_0xb9bb('0x75')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb9bb('0x59')](_0x10f670);})[_0xb9bb('0x12')](function(_0x279787){_0x98ef50['rows']=_0x279787;return _0x98ef50;});}})[_0xb9bb('0x12')](respondWithFilteredResult(_0x35bda0,_0x10f670))['catch'](handleError(_0x35bda0,null));};exports[_0xb9bb('0x76')]=function(_0x32ff03,_0x3f2014){return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x32ff03['params']['id']}})['then'](handleEntityNotFound(_0x3f2014,null))['then'](function(_0x438424){if(_0x438424){return _0x438424['removeAnswers'](_0x32ff03[_0xb9bb('0x4b')][_0xb9bb('0x6f')]);}})['then'](respondWithStatusCode(_0x3f2014,null))[_0xb9bb('0x5b')](handleError(_0x3f2014,null));};exports['create']=function(_0xf35980,_0x316bc0){var _0x5414ff={'name':_0xf35980['body'][_0xb9bb('0x29')],'key':_0xf35980['body']['key'],'provider':_0xf35980['body'][_0xb9bb('0x62')]===_0xb9bb('0x63')?null:_0xf35980[_0xb9bb('0x61')][_0xb9bb('0x62')],'email':_0xf35980[_0xb9bb('0x61')][_0xb9bb('0x77')],'ListId':_0xf35980[_0xb9bb('0x61')][_0xb9bb('0x78')],'active':!_['isNil'](_0xf35980[_0xb9bb('0x61')][_0xb9bb('0x79')])?_0xf35980[_0xb9bb('0x61')][_0xb9bb('0x79')]:!![],'description':_0xf35980[_0xb9bb('0x61')][_0xb9bb('0x7a')]||null};var _0x2e3344=getAuthenticationOptions(_0x5414ff[_0xb9bb('0x62')],_0xf35980[_0xb9bb('0x61')]);_0x5414ff[_0xb9bb('0x41')]=_0x2e3344[_0xb9bb('0x41')];_0x5414ff[_0xb9bb('0x42')]=_0x2e3344[_0xb9bb('0x42')];return db[_0xb9bb('0x45')][_0xb9bb('0x7b')](_0x5414ff,{'include':[{'model':db[_0xb9bb('0x5d')],'as':_0xb9bb('0x42')},{'model':db['MailServerIn'],'as':_0xb9bb('0x41')}]})[_0xb9bb('0x12')](function(_0x3838a5){var _0x1d67cf=_0xf35980['user'][_0xb9bb('0x7c')]({'plain':!![]});if(!_0x1d67cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d67cf['role']===_0xb9bb('0x36')){var _0x3160ae=_0x3838a5[_0xb9bb('0x7c')]({'plain':!![]});return db[_0xb9bb('0x7d')][_0xb9bb('0x67')]({'where':{'name':_0xb9bb('0x7e'),'userProfileId':_0x1d67cf[_0xb9bb('0x7f')]},'raw':!![]})['then'](function(_0x21c8cf){if(_0x21c8cf&&_0x21c8cf['autoAssociation']===0x0){return db[_0xb9bb('0x26')][_0xb9bb('0x7b')]({'name':_0x3160ae[_0xb9bb('0x29')],'resourceId':_0x3160ae['id'],'type':_0x21c8cf[_0xb9bb('0x29')],'sectionId':_0x21c8cf['id']},{})[_0xb9bb('0x12')](function(){return _0x3838a5;});}else{return _0x3838a5;}})[_0xb9bb('0x5b')](function(_0x450bab){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x450bab);throw _0x450bab;});}return _0x3838a5;})[_0xb9bb('0x12')](respondWithResult(_0x316bc0,0xc9))[_0xb9bb('0x5b')](handleError(_0x316bc0,null));};exports[_0xb9bb('0x80')]=function(_0x2546b2,_0x326777){return db[_0xb9bb('0x45')][_0xb9bb('0x74')]({'where':{'id':_0x2546b2[_0xb9bb('0x68')]['id']}})['then'](handleEntityNotFound(_0x326777,null))['then'](function(_0x266611){if(_0x266611){return _0x266611['getImap']();}return null;})[_0xb9bb('0x12')](respondWithResult(_0x326777,null))['catch'](handleError(_0x326777,null));};exports[_0xb9bb('0x81')]=function(_0x5a793d,_0x24a077){if(_0x5a793d['body']['id']){delete _0x5a793d[_0xb9bb('0x61')]['id'];}return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x5a793d[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x24a077,null))[_0xb9bb('0x12')](function(_0x2106b9){if(_0x2106b9){_0x5a793d[_0xb9bb('0x61')]['MailAccountId']=_0x2106b9['id'];return db[_0xb9bb('0x43')][_0xb9bb('0x7b')](_0x5a793d[_0xb9bb('0x61')]);}})['then'](respondWithResult(_0x24a077,null))['catch'](handleError(_0x24a077,null));};exports[_0xb9bb('0x82')]=function(_0x59e698,_0x4188a8){return db[_0xb9bb('0x45')]['findOne']({'where':{'id':_0x59e698[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x4188a8,null))[_0xb9bb('0x12')](function(_0x10e406){if(_0x10e406){return _0x10e406[_0xb9bb('0x83')](null);}return null;})[_0xb9bb('0x12')](respondWithStatusCode(_0x4188a8,null))[_0xb9bb('0x5b')](handleError(_0x4188a8,null));};exports[_0xb9bb('0x84')]=function(_0x1bb36a,_0x2658f8){return db[_0xb9bb('0x45')]['findOne']({'where':{'id':_0x1bb36a[_0xb9bb('0x68')]['id']}})['then'](handleEntityNotFound(_0x2658f8,null))[_0xb9bb('0x12')](function(_0x4902e0){if(_0x4902e0){return _0x4902e0[_0xb9bb('0x84')]();}return null;})[_0xb9bb('0x12')](respondWithResult(_0x2658f8,null))[_0xb9bb('0x5b')](handleError(_0x2658f8,null));};exports[_0xb9bb('0x85')]=function(_0x4c5eec,_0x3ca9bb){if(_0x4c5eec['body']['id']){delete _0x4c5eec[_0xb9bb('0x61')]['id'];}return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x4c5eec[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x3ca9bb,null))['then'](function(_0x22691a){if(_0x22691a){_0x4c5eec['body'][_0xb9bb('0x71')]=_0x22691a['id'];return db['MailServerOut'][_0xb9bb('0x7b')](_0x4c5eec[_0xb9bb('0x61')]);}})[_0xb9bb('0x12')](respondWithResult(_0x3ca9bb,null))['catch'](handleError(_0x3ca9bb,null));};exports[_0xb9bb('0x86')]=function(_0x462484,_0x4b2649){return db[_0xb9bb('0x45')]['findOne']({'where':{'id':_0x462484[_0xb9bb('0x68')]['id']}})['then'](handleEntityNotFound(_0x4b2649,null))[_0xb9bb('0x12')](function(_0x2f528c){if(_0x2f528c){return _0x2f528c[_0xb9bb('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x4b2649,null))[_0xb9bb('0x5b')](handleError(_0x4b2649,null));};exports[_0xb9bb('0x88')]=function(_0xd42a22,_0x1dc085){return db[_0xb9bb('0x89')][_0xb9bb('0x67')]({'where':{'id':_0xd42a22[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x1dc085,null))[_0xb9bb('0x12')](function(_0x5dad7b){if(_0x5dad7b){return _0x5dad7b[_0xb9bb('0x88')](_0xd42a22[_0xb9bb('0x61')][_0xb9bb('0x6f')],_[_0xb9bb('0x8a')](_0xd42a22[_0xb9bb('0x61')],[_0xb9bb('0x6f'),'id'])||{});}})[_0xb9bb('0x12')](respondWithResult(_0x1dc085,null))['catch'](handleError(_0x1dc085,null));};exports['getInteractions']=function(_0x137794,_0x4806b0){var _0x52ccc5={'raw':![],'where':{}};var _0x24a47b={};var _0x228a0d={'count':0x0,'rows':[]};return db[_0xb9bb('0x45')][_0xb9bb('0x74')]({'where':{'id':_0x137794[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x4806b0,null))[_0xb9bb('0x12')](function(_0x4f96e4){if(_0x4f96e4){_0x24a47b['model']=_['keys'](db[_0xb9bb('0x89')][_0xb9bb('0x46')]);_0x24a47b[_0xb9bb('0x4b')]=_['keys'](_0x137794[_0xb9bb('0x4b')]);_0x24a47b['filters']=_[_0xb9bb('0x4e')](_0x24a47b[_0xb9bb('0x49')],_0x24a47b[_0xb9bb('0x4b')]);_0x52ccc5[_0xb9bb('0x4f')]=_['intersection'](_0x24a47b[_0xb9bb('0x49')],qs[_0xb9bb('0x50')](_0x137794[_0xb9bb('0x4b')][_0xb9bb('0x50')]));_0x52ccc5[_0xb9bb('0x4f')]=_0x52ccc5[_0xb9bb('0x4f')][_0xb9bb('0x5f')]?_0x52ccc5[_0xb9bb('0x4f')]:_0x24a47b[_0xb9bb('0x49')];if(!_0x137794['query']['hasOwnProperty'](_0xb9bb('0x52'))){_0x52ccc5[_0xb9bb('0x1f')]=qs[_0xb9bb('0x1f')](_0x137794[_0xb9bb('0x4b')][_0xb9bb('0x1f')]);_0x52ccc5[_0xb9bb('0x21')]=qs['offset'](_0x137794['query']['offset']);}_0x52ccc5[_0xb9bb('0x6b')]=qs[_0xb9bb('0x6c')](_0x137794[_0xb9bb('0x4b')][_0xb9bb('0x6c')]);_0x52ccc5[_0xb9bb('0x53')]=qs[_0xb9bb('0x4d')](_[_0xb9bb('0x6d')](_0x137794[_0xb9bb('0x4b')],_0x24a47b['filters']));_0x52ccc5[_0xb9bb('0x53')][_0xb9bb('0x71')]=_0x4f96e4['id'];if(_0x137794[_0xb9bb('0x4b')][_0xb9bb('0x54')]){_0x52ccc5['where']=_['merge'](_0x52ccc5['where'],{'$or':_[_0xb9bb('0x4a')](_0x52ccc5['attributes'],function(_0x41dd68){var _0x33c32c={};_0x33c32c[_0x41dd68]={'$like':'%'+_0x137794[_0xb9bb('0x4b')]['filter']+'%'};return _0x33c32c;})});}_0x52ccc5=_['merge']({},_0x52ccc5,_0x137794['options']);return db[_0xb9bb('0x89')][_0xb9bb('0x22')]({'where':_0x52ccc5[_0xb9bb('0x53')]})[_0xb9bb('0x12')](function(_0x1b89b2){_0x228a0d[_0xb9bb('0x22')]=_0x1b89b2;if(_0x137794[_0xb9bb('0x4b')]['includeAll']){_0x52ccc5[_0xb9bb('0x75')]=[{'model':db['CmContact'],'as':_0xb9bb('0x8b'),'required':![]},{'model':db[_0xb9bb('0x8c')],'as':'Owner','attributes':[_0xb9bb('0x29'),_0xb9bb('0x8d'),'internal'],'required':![]},{'model':db[_0xb9bb('0x8e')],'as':_0xb9bb('0x8f'),'attributes':['id','name',_0xb9bb('0x90')],'where':_0x137794[_0xb9bb('0x4b')]['tag']?{'id':_0x137794[_0xb9bb('0x4b')][_0xb9bb('0x91')]}:undefined,'required':_0x137794[_0xb9bb('0x4b')][_0xb9bb('0x91')]?!![]:![]}];}return db[_0xb9bb('0x89')][_0xb9bb('0x59')](_0x52ccc5);})[_0xb9bb('0x12')](function(_0x8b99fb){_0x228a0d[_0xb9bb('0x5a')]=_0x8b99fb;return _0x228a0d;});}})['then'](respondWithFilteredResult(_0x4806b0,_0x52ccc5))['catch'](handleError(_0x4806b0,null));};exports[_0xb9bb('0x92')]=function addApplications(_0x40c862,_0x3c8d84){var _0xaf59df=_0x40c862[_0xb9bb('0x68')]['id'];var _0x346ef1=_0x40c862[_0xb9bb('0x61')];var _0x206727=0xc8;var _0x2f92bc=null;return db[_0xb9bb('0x93')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xb9bb('0x94')][_0xb9bb('0x95')]},function(_0x4846bf){return db['MailAccount'][_0xb9bb('0x74')]({'where':{'id':_0xaf59df},'transaction':_0x4846bf})[_0xb9bb('0x12')](function(_0x3f46a7){if(_0x3f46a7){return db[_0xb9bb('0x96')][_0xb9bb('0x27')]({'where':{'MailAccountId':_0xaf59df},'transaction':_0x4846bf})['then'](function(){var _0x4b2feb=_[_0xb9bb('0x4a')](_0x346ef1,function(_0x47b684){_0x47b684['MailAccountId']=_0xaf59df;return _0x47b684;});return db[_0xb9bb('0x96')][_0xb9bb('0x97')](_0x4b2feb,{'transaction':_0x4846bf});});}else{_0x206727=0x194;_0x2f92bc=[];}});})[_0xb9bb('0x12')](function(){if(_0x206727!==0x194){return db['MailApplication'][_0xb9bb('0x98')]({'where':{'MailAccountId':_0xaf59df},'order':'priority'})[_0xb9bb('0x12')](function(_0x5ef3ae){_0x2f92bc=_0x5ef3ae;});}})[_0xb9bb('0x5b')](function(_0x42d25f){_0x206727=0x1f4;logger[_0xb9bb('0x19')](_0x42d25f[_0xb9bb('0x28')]);if(_0x42d25f[_0xb9bb('0x29')]){delete _0x42d25f[_0xb9bb('0x29')];}_0x2f92bc=_0x42d25f;})[_0xb9bb('0x99')](function(){if(_0x2f92bc===null){_0x3c8d84[_0xb9bb('0x1b')](_0x206727);}else{if(_0x206727===0x1f4){_0x3c8d84[_0xb9bb('0x1d')](_0x206727)[_0xb9bb('0x9a')](_0x2f92bc);}else{_0x3c8d84[_0xb9bb('0x1d')](_0x206727)[_0xb9bb('0x1e')](_0x2f92bc);}}});};exports[_0xb9bb('0x9b')]=function(_0x395512,_0x22285f){var _0x2419ef={};var _0x50726b={};var _0x2ff3db;var _0x3a1ebf;return db[_0xb9bb('0x45')][_0xb9bb('0x74')]({'where':{'id':_0x395512[_0xb9bb('0x68')]['id']}})['then'](handleEntityNotFound(_0x22285f,null))['then'](function(_0x13fcde){if(_0x13fcde){_0x2ff3db=_0x13fcde;_0x50726b[_0xb9bb('0x49')]=_[_0xb9bb('0x4c')](db[_0xb9bb('0x96')]['rawAttributes']);_0x50726b[_0xb9bb('0x4b')]=_[_0xb9bb('0x4c')](_0x395512[_0xb9bb('0x4b')]);_0x50726b[_0xb9bb('0x4d')]=_[_0xb9bb('0x4e')](_0x50726b[_0xb9bb('0x49')],_0x50726b[_0xb9bb('0x4b')]);_0x2419ef['attributes']=_[_0xb9bb('0x4e')](_0x50726b[_0xb9bb('0x49')],qs['fields'](_0x395512['query'][_0xb9bb('0x50')]));_0x2419ef[_0xb9bb('0x4f')]=_0x2419ef[_0xb9bb('0x4f')]['length']?_0x2419ef[_0xb9bb('0x4f')]:_0x50726b['model'];_0x2419ef[_0xb9bb('0x6b')]=qs[_0xb9bb('0x6c')](_0x395512[_0xb9bb('0x4b')][_0xb9bb('0x6c')]);_0x2419ef[_0xb9bb('0x53')]=qs[_0xb9bb('0x4d')](_[_0xb9bb('0x6d')](_0x395512['query'],_0x50726b[_0xb9bb('0x4d')]));if(_0x395512['query'][_0xb9bb('0x54')]){_0x2419ef[_0xb9bb('0x53')]=_[_0xb9bb('0x55')](_0x2419ef['where'],{'$or':_[_0xb9bb('0x4a')](_0x2419ef[_0xb9bb('0x4f')],function(_0x34ca85){var _0x462d47={};_0x462d47[_0x34ca85]={'$like':'%'+_0x395512[_0xb9bb('0x4b')][_0xb9bb('0x54')]+'%'};return _0x462d47;})});}_0x2419ef=_[_0xb9bb('0x55')]({},_0x2419ef,_0x395512[_0xb9bb('0x60')]);return _0x2ff3db[_0xb9bb('0x9b')](_0x2419ef);}})[_0xb9bb('0x12')](function(_0x4afe24){if(_0x4afe24){_0x3a1ebf=_0x4afe24[_0xb9bb('0x5f')];if(!_0x395512[_0xb9bb('0x4b')]['hasOwnProperty'](_0xb9bb('0x52'))){_0x2419ef['limit']=qs[_0xb9bb('0x1f')](_0x395512[_0xb9bb('0x4b')]['limit']);_0x2419ef[_0xb9bb('0x21')]=qs['offset'](_0x395512[_0xb9bb('0x4b')]['offset']);}return _0x2ff3db[_0xb9bb('0x9b')](_0x2419ef);}})[_0xb9bb('0x12')](function(_0x304266){if(_0x304266){return _0x304266?{'count':_0x3a1ebf,'rows':_0x304266}:null;}})['then'](respondWithResult(_0x22285f,null))[_0xb9bb('0x5b')](handleError(_0x22285f,null));};exports['getMessages']=function(_0x1ec2a2,_0x2e86f5){var _0x3f751b={'raw':!![],'where':{}};var _0x326963={};var _0x2e0314={'count':0x0,'rows':[]};return db[_0xb9bb('0x45')][_0xb9bb('0x74')]({'where':{'id':_0x1ec2a2[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x2e86f5,null))[_0xb9bb('0x12')](function(_0xe2a153){if(_0xe2a153){_0x326963[_0xb9bb('0x49')]=_['keys'](db['MailMessage']['rawAttributes']);_0x326963[_0xb9bb('0x4b')]=_['keys'](_0x1ec2a2[_0xb9bb('0x4b')]);_0x326963[_0xb9bb('0x4d')]=_[_0xb9bb('0x4e')](_0x326963[_0xb9bb('0x49')],_0x326963['query']);_0x3f751b[_0xb9bb('0x4f')]=_[_0xb9bb('0x4e')](_0x326963[_0xb9bb('0x49')],qs['fields'](_0x1ec2a2['query'][_0xb9bb('0x50')]));_0x3f751b[_0xb9bb('0x4f')]=_0x3f751b[_0xb9bb('0x4f')][_0xb9bb('0x5f')]?_0x3f751b[_0xb9bb('0x4f')]:_0x326963[_0xb9bb('0x49')];if(!_0x1ec2a2['query'][_0xb9bb('0x51')](_0xb9bb('0x52'))){_0x3f751b['limit']=qs[_0xb9bb('0x1f')](_0x1ec2a2[_0xb9bb('0x4b')][_0xb9bb('0x1f')]);_0x3f751b[_0xb9bb('0x21')]=qs['offset'](_0x1ec2a2[_0xb9bb('0x4b')][_0xb9bb('0x21')]);}_0x3f751b[_0xb9bb('0x6b')]=qs[_0xb9bb('0x6c')](_0x1ec2a2[_0xb9bb('0x4b')][_0xb9bb('0x6c')]);_0x3f751b[_0xb9bb('0x53')]=qs[_0xb9bb('0x4d')](_[_0xb9bb('0x6d')](_0x1ec2a2['query'],_0x326963['filters']));_0x3f751b[_0xb9bb('0x53')]['MailAccountId']=_0xe2a153['id'];if(_0x1ec2a2['query'][_0xb9bb('0x54')]){_0x3f751b['where']=_['merge'](_0x3f751b[_0xb9bb('0x53')],{'$or':_[_0xb9bb('0x4a')](_0x3f751b[_0xb9bb('0x4f')],function(_0x22d452){var _0x2025d1={};_0x2025d1[_0x22d452]={'$like':'%'+_0x1ec2a2[_0xb9bb('0x4b')][_0xb9bb('0x54')]+'%'};return _0x2025d1;})});}if(_0x1ec2a2['query'][_0xb9bb('0x9c')]){var _0x5f2aad=_0x1ec2a2[_0xb9bb('0x4b')][_0xb9bb('0x9c')]['split'](',');var _0x10abd6={};_0x10abd6[_0x5f2aad[0x0]]={'$gte':moment(_0x5f2aad[0x1])['format'](_0xb9bb('0x9d'))};_0x3f751b['where']=_[_0xb9bb('0x55')](_0x3f751b['where'],_0x10abd6);}_0x3f751b=_['merge']({},_0x3f751b,_0x1ec2a2[_0xb9bb('0x60')]);return db['MailMessage'][_0xb9bb('0x22')]({'where':_0x3f751b[_0xb9bb('0x53')]})[_0xb9bb('0x12')](function(_0x5744f0){_0x2e0314[_0xb9bb('0x22')]=_0x5744f0;if(_0x1ec2a2[_0xb9bb('0x4b')][_0xb9bb('0x58')]){_0x3f751b[_0xb9bb('0x75')]=[{'all':!![]}];}return db[_0xb9bb('0x9e')]['findAll'](_0x3f751b);})['then'](function(_0x3cdfa5){if(_0x1ec2a2[_0xb9bb('0x4b')][_0xb9bb('0x9f')]===_0xb9bb('0xa0')){for(var _0x1e1dfb=0x0;_0x1e1dfb<_0x3cdfa5[_0xb9bb('0x5f')];_0x1e1dfb++){_0x3cdfa5[_0x1e1dfb]['body']=juice(_0x3cdfa5[_0x1e1dfb][_0xb9bb('0x61')]);}}_0x2e0314[_0xb9bb('0x5a')]=_0x3cdfa5;return _0x2e0314;});}})[_0xb9bb('0x12')](respondWithFilteredResult(_0x2e86f5,_0x3f751b))[_0xb9bb('0x5b')](handleError(_0x2e86f5,null));};exports[_0xb9bb('0x9a')]=function(_0x4a6646,_0x2c8c4f){var _0x2ecaff,_0x2cb451={},_0x319f0e;if(_0x4a6646[_0xb9bb('0x61')]['to']){_0x319f0e=_0x4a6646[_0xb9bb('0x61')]['to'][_0xb9bb('0xa1')](',')[0x0];}return db[_0xb9bb('0x45')]['find']({'where':{'id':_0x4a6646[_0xb9bb('0x68')]['id']},'include':[{'model':db[_0xb9bb('0xa2')],'as':_0xb9bb('0xa3'),'include':[{'model':db[_0xb9bb('0xa4')],'as':_0xb9bb('0xa5'),'where':{'email':_0x319f0e},'limit':0x1,'order':[['updatedAt',_0xb9bb('0xa6')]]}]},{'model':db[_0xb9bb('0x5d')],'as':_0xb9bb('0x42'),'raw':!![],'include':[{'model':db[_0xb9bb('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0xb9bb('0x12')](handleEntityNotFound(_0x2c8c4f,null))[_0xb9bb('0x12')](function(_0x6b9f3d){if(!_0x6b9f3d)return;_0x2ecaff=_0x6b9f3d;if(!_0x6b9f3d[_0xb9bb('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xa8')])){_0x4a6646[_0xb9bb('0x61')]['from']=util[_0xb9bb('0xa9')](_0xb9bb('0xaa'),_0x6b9f3d[_0xb9bb('0x29')],_0x6b9f3d['email']||_0x6b9f3d['Smtp'][_0xb9bb('0x36')]);}if(_0x4a6646[_0xb9bb('0x61')]['attachments']&&_0x4a6646['body'][_0xb9bb('0xab')]['length']){for(var _0x5ee4f5=0x0;_0x5ee4f5<_0x4a6646[_0xb9bb('0x61')]['attachments']['length'];_0x5ee4f5+=0x1){_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xab')][_0x5ee4f5]={'filename':_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xab')][_0x5ee4f5]['name'],'path':path[_0xb9bb('0xac')](config['root'],'server/files/attachments',_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xab')][_0x5ee4f5][_0xb9bb('0xad')])};}}var _0x48543d=_0x6b9f3d[_0xb9bb('0xae')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x48543d,'message':_0x4a6646[_0xb9bb('0x61')]});})[_0xb9bb('0x12')](function(_0x15b9d6){if(!_0x15b9d6)return;_0x2cb451=_0x15b9d6;if(!_0x2ecaff[_0xb9bb('0xa3')])throw new Error(_0xb9bb('0xaf'));if(_0x2ecaff[_0xb9bb('0xa3')]['Contacts'][_0xb9bb('0x5f')])return _0x2ecaff[_0xb9bb('0xa3')][_0xb9bb('0xa5')][0x0];return db[_0xb9bb('0xa4')][_0xb9bb('0x7b')](_[_0xb9bb('0xb')](_0x4a6646[_0xb9bb('0x61')],{'firstName':_0x4a6646[_0xb9bb('0x61')]['to'],'email':_0x4a6646[_0xb9bb('0x61')]['to'],'phone':_0x4a6646[_0xb9bb('0x61')]['to'],'ListId':_0x2ecaff[_0xb9bb('0x78')]}));})[_0xb9bb('0x12')](function(_0x443b4c){if(!_0x443b4c)return;var _0x102302={'UserId':_0x4a6646[_0xb9bb('0x36')]['id'],'ContactId':_0x443b4c['id'],'MailAccountId':_0x2ecaff['id'],'inReplyTo':_0x2cb451[_0xb9bb('0xb0')],'to':_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xa8')],'cc':_0x4a6646[_0xb9bb('0x61')]['cc'],'subject':_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xb1')],'attach':_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xb2')],'firstMsgDirection':_0xb9bb('0xb3'),'lastMsgAt':moment()[_0xb9bb('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xb9bb('0xb3'),'Messages':[_['merge'](_0x4a6646[_0xb9bb('0x61')],{'messageId':_0x2cb451['messageId'],'sentAt':moment()[_0xb9bb('0xa9')](_0xb9bb('0x9d')),'read':!![],'MailAccountId':_0x2ecaff['id'],'UserId':_0x4a6646[_0xb9bb('0x36')]['id'],'ContactId':_0x443b4c['id']})]};if(_0x4a6646['body'][_0xb9bb('0xb4')]){_0x102302=_[_0xb9bb('0x55')](_0x102302,_0x4a6646[_0xb9bb('0x61')][_0xb9bb('0xb4')]);}return db[_0xb9bb('0x89')][_0xb9bb('0x7b')](_0x102302,{'include':[{'model':db[_0xb9bb('0x9e')],'as':_0xb9bb('0xb5')}]});})[_0xb9bb('0x12')](respondWithResult(_0x2c8c4f,null))[_0xb9bb('0x5b')](handleError(_0x2c8c4f,null));};exports[_0xb9bb('0xb6')]=function(_0x34bc28,_0x9c611d){return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x34bc28[_0xb9bb('0x68')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xb9bb('0x42'),'raw':!![],'include':[{'model':db[_0xb9bb('0xa7')],'as':_0xb9bb('0xa7'),'raw':!![]}]}]})[_0xb9bb('0x12')](handleEntityNotFound(_0x9c611d,null))['then'](function(_0x27f153){if(!_0x27f153['Smtp'])return;var _0x2111e0=_0x27f153[_0xb9bb('0xae')]();return respondWithRpcPromise(_0xb9bb('0xb7'),_0xb9bb('0xb6'),{'account':_0x2111e0});})['then'](respondWithResult(_0x9c611d,null))['catch'](handleError(_0x9c611d,null));};exports[_0xb9bb('0x27')]=function(_0x209e42,_0x55ca28){return db[_0xb9bb('0x45')]['find']({'where':{'id':_0x209e42['params']['id']}})['then'](handleEntityNotFound(_0x55ca28,null))[_0xb9bb('0x12')](function(_0x41a292){if(_0x41a292&&_0x41a292[_0xb9bb('0x3e')]){throw new db[(_0xb9bb('0xb8'))][(_0xb9bb('0xb9'))](_0xb9bb('0xba'));}return _0x41a292;})[_0xb9bb('0x12')](removeEntity(_0x55ca28,null))['catch'](handleError(_0x55ca28,null));};exports[_0xb9bb('0xbb')]=function(_0x1d8d95,_0x9d3aac){return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x1d8d95[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x9d3aac,null))['then'](function(_0x1b585d){if(_0x1b585d){return _0x1b585d[_0xb9bb('0xbb')](_0x1d8d95[_0xb9bb('0x61')][_0xb9bb('0x6f')],_[_0xb9bb('0x8a')](_0x1d8d95['body'],[_0xb9bb('0x6f'),'id'])||{})[_0xb9bb('0xbc')](function(_0x18c6b5){for(var _0x46cfa4=0x0;_0x46cfa4<_0x1d8d95[_0xb9bb('0x61')][_0xb9bb('0x6f')][_0xb9bb('0x5f')];_0x46cfa4+=0x1){socket[_0xb9bb('0xbd')]('userMailAccount:save',{'UserId':Number(_0x1d8d95[_0xb9bb('0x61')][_0xb9bb('0x6f')][_0x46cfa4]),'MailAccountId':Number(_0x1d8d95[_0xb9bb('0x68')]['id'])});}return _0x18c6b5;});}})[_0xb9bb('0x12')](respondWithResult(_0x9d3aac,null))['catch'](handleError(_0x9d3aac,null));};exports[_0xb9bb('0xbe')]=function(_0x4c94ac,_0x2c5863){return db[_0xb9bb('0x45')][_0xb9bb('0x67')]({'where':{'id':_0x4c94ac[_0xb9bb('0x68')]['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x2c5863,null))[_0xb9bb('0x12')](function(_0x558305){if(_0x558305){return _0x558305['removeAgents'](_0x4c94ac[_0xb9bb('0x4b')]['ids'])[_0xb9bb('0x12')](function(){if(_[_0xb9bb('0xbf')](_0x4c94ac['query'][_0xb9bb('0x6f')])){for(var _0x483e38=0x0;_0x483e38<_0x4c94ac[_0xb9bb('0x4b')][_0xb9bb('0x6f')][_0xb9bb('0x5f')];_0x483e38+=0x1){socket['emit'](_0xb9bb('0xc0'),{'UserId':Number(_0x4c94ac[_0xb9bb('0x4b')][_0xb9bb('0x6f')][_0x483e38]),'MailAccountId':Number(_0x4c94ac['params']['id'])});}}else{socket[_0xb9bb('0xbd')](_0xb9bb('0xc0'),{'UserId':Number(_0x4c94ac['query'][_0xb9bb('0x6f')]),'MailAccountId':Number(_0x4c94ac['params']['id'])});}});}})[_0xb9bb('0x12')](respondWithStatusCode(_0x2c5863,null))[_0xb9bb('0x5b')](handleError(_0x2c5863,null));};exports[_0xb9bb('0xc1')]=function(_0x69a64a,_0x96be5f){var _0x326501={};var _0x4f64dd={};var _0x553ead;var _0x491642;return db[_0xb9bb('0x45')][_0xb9bb('0x74')]({'where':{'id':_0x69a64a['params']['id']}})[_0xb9bb('0x12')](handleEntityNotFound(_0x96be5f,null))['then'](function(_0x210b7b){if(_0x210b7b){_0x553ead=_0x210b7b;_0x4f64dd[_0xb9bb('0x49')]=_[_0xb9bb('0x4c')](db[_0xb9bb('0x8c')][_0xb9bb('0x46')]);_0x4f64dd['query']=_['keys'](_0x69a64a[_0xb9bb('0x4b')]);_0x4f64dd[_0xb9bb('0x4d')]=_[_0xb9bb('0x4e')](_0x4f64dd['model'],_0x4f64dd[_0xb9bb('0x4b')]);_0x326501['attributes']=_['intersection'](_0x4f64dd[_0xb9bb('0x49')],qs[_0xb9bb('0x50')](_0x69a64a[_0xb9bb('0x4b')][_0xb9bb('0x50')]));_0x326501[_0xb9bb('0x4f')]=_0x326501[_0xb9bb('0x4f')][_0xb9bb('0x5f')]?_0x326501[_0xb9bb('0x4f')]:_0x4f64dd[_0xb9bb('0x49')];_0x326501[_0xb9bb('0x6b')]=qs[_0xb9bb('0x6c')](_0x69a64a['query']['sort']);_0x326501['where']=qs[_0xb9bb('0x4d')](_['pick'](_0x69a64a['query'],_0x4f64dd[_0xb9bb('0x4d')]));if(_0x69a64a[_0xb9bb('0x4b')][_0xb9bb('0x54')]){_0x326501['where']=_[_0xb9bb('0x55')](_0x326501[_0xb9bb('0x53')],{'$or':_[_0xb9bb('0x4a')](_0x326501[_0xb9bb('0x4f')],function(_0x3eb9a2){var _0x5cd244={};_0x5cd244[_0x3eb9a2]={'$like':'%'+_0x69a64a[_0xb9bb('0x4b')][_0xb9bb('0x54')]+'%'};return _0x5cd244;})});}_0x326501=_[_0xb9bb('0x55')]({},_0x326501,_0x69a64a['options']);return _0x553ead[_0xb9bb('0xc1')](_0x326501);}})[_0xb9bb('0x12')](function(_0x40a39a){if(_0x40a39a){_0x491642=_0x40a39a[_0xb9bb('0x5f')];if(!_0x69a64a[_0xb9bb('0x4b')][_0xb9bb('0x51')](_0xb9bb('0x52'))){_0x326501[_0xb9bb('0x1f')]=qs[_0xb9bb('0x1f')](_0x69a64a[_0xb9bb('0x4b')]['limit']);_0x326501['offset']=qs[_0xb9bb('0x21')](_0x69a64a['query'][_0xb9bb('0x21')]);}return _0x553ead['getAgents'](_0x326501);}})[_0xb9bb('0x12')](function(_0x3e77e2){if(_0x3e77e2){return _0x3e77e2?{'count':_0x491642,'rows':_0x3e77e2}:null;}})['then'](respondWithResult(_0x96be5f,null))[_0xb9bb('0x5b')](handleError(_0x96be5f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2a542ad..af013d1 100644 --- a/server/api/mailAccount/mailAccount.events.js +++ b/server/api/mailAccount/mailAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x980f=['events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4cb279,_0x5adab8){var _0x5e4e9d=function(_0x3bf137){while(--_0x3bf137){_0x4cb279['push'](_0x4cb279['shift']());}};_0x5e4e9d(++_0x5adab8);}(_0x980f,0xe6));var _0xf980=function(_0x33d615,_0x1a5af7){_0x33d615=_0x33d615-0x0;var _0x254611=_0x980f[_0x33d615];return _0x254611;};'use strict';var EventEmitter=require(_0xf980('0x0'));var MailAccount=require(_0xf980('0x1'))['db'][_0xf980('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf980('0x3')](0x0);var events={'afterCreate':_0xf980('0x4'),'afterUpdate':'update','afterDestroy':_0xf980('0x5')};function emitEvent(_0x26bb38){return function(_0x4865a7,_0x2a9289,_0x236228){MailAccountEvents[_0xf980('0x6')](_0x26bb38+':'+_0x4865a7['id'],_0x4865a7);MailAccountEvents[_0xf980('0x6')](_0x26bb38,_0x4865a7);_0x236228(null);};}for(var e in events){if(events[_0xf980('0x7')](e)){var event=events[e];MailAccount[_0xf980('0x8')](e,emitEvent(event));}}module[_0xf980('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xeb85=['MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5ae148,_0x25e23d){var _0x7c706a=function(_0x50e937){while(--_0x50e937){_0x5ae148['push'](_0x5ae148['shift']());}};_0x7c706a(++_0x25e23d);}(_0xeb85,0x167));var _0x5eb8=function(_0x397510,_0xc493cc){_0x397510=_0x397510-0x0;var _0x362d82=_0xeb85[_0x397510];return _0x362d82;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x5eb8('0x0'))['db'][_0x5eb8('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5eb8('0x2')](0x0);var events={'afterCreate':_0x5eb8('0x3'),'afterUpdate':_0x5eb8('0x4'),'afterDestroy':'remove'};function emitEvent(_0xdb2102){return function(_0x3cefca,_0x55b51d,_0x475d34){MailAccountEvents[_0x5eb8('0x5')](_0xdb2102+':'+_0x3cefca['id'],_0x3cefca);MailAccountEvents['emit'](_0xdb2102,_0x3cefca);_0x475d34(null);};}for(var e in events){if(events[_0x5eb8('0x6')](e)){var event=events[e];MailAccount[_0x5eb8('0x7')](e,emitEvent(event));}}module[_0x5eb8('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 2f4e69b..1659afa 100644 --- a/server/api/mailAccount/mailAccount.model.js +++ b/server/api/mailAccount/mailAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bbc=['mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','data5','./mailAccount.attributes','exports'];(function(_0xfcbf57,_0x4b05fd){var _0x1078fa=function(_0xb65856){while(--_0xb65856){_0xfcbf57['push'](_0xfcbf57['shift']());}};_0x1078fa(++_0x4b05fd);}(_0x0bbc,0x75));var _0xc0bb=function(_0x3a794c,_0x51ec6a){_0x3a794c=_0x3a794c-0x0;var _0x34d165=_0x0bbc[_0x3a794c];return _0x34d165;};'use strict';var attributes=require(_0xc0bb('0x0'));module[_0xc0bb('0x1')]=function(_0x4c5130){return _0x4c5130['define']('MailAccount',attributes,{'tableName':_0xc0bb('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x460d51=this;var _0x579aba={'id':_0x460d51['id'],'tls':{'rejectUnauthorized':![]}};if(_0x460d51[_0xc0bb('0x3')]!==_0xc0bb('0x4')){_0x579aba[_0xc0bb('0x5')]=_0x460d51[_0xc0bb('0x3')];}else{_0x579aba[_0xc0bb('0x6')]=_0x460d51[_0xc0bb('0x7')][_0xc0bb('0x6')];_0x579aba[_0xc0bb('0x8')]=_0x460d51[_0xc0bb('0x7')]['port'];_0x579aba[_0xc0bb('0x9')]=_0x460d51['Smtp']['secure'];}if(_0x460d51[_0xc0bb('0x7')][_0xc0bb('0xa')]){if(_0x460d51[_0xc0bb('0x7')][_0xc0bb('0xb')]){if(!_0x460d51['Smtp']['CloudProvider'])throw new Error(_0xc0bb('0xc'));_0x579aba[_0xc0bb('0xd')]={'type':'OAuth2','user':_0x460d51[_0xc0bb('0x7')][_0xc0bb('0xe')],'accessToken':_0x460d51[_0xc0bb('0x7')][_0xc0bb('0xf')][_0xc0bb('0x10')]};}else{_0x579aba[_0xc0bb('0xd')]={'user':_0x460d51['Smtp']['user'],'pass':_0x460d51[_0xc0bb('0x7')]['pass']};}}return _0x579aba;}}});}; \ No newline at end of file +var _0x6be9=['auth','OAuth2','user','data5','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','custom','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x2d19ea,_0x51e0bf){var _0x543c09=function(_0x4c0d11){while(--_0x4c0d11){_0x2d19ea['push'](_0x2d19ea['shift']());}};_0x543c09(++_0x51e0bf);}(_0x6be9,0x1c6));var _0x96be=function(_0x80400c,_0x436344){_0x80400c=_0x80400c-0x0;var _0xe69a55=_0x6be9[_0x80400c];return _0xe69a55;};'use strict';var attributes=require(_0x96be('0x0'));module[_0x96be('0x1')]=function(_0x516c8d){return _0x516c8d['define'](_0x96be('0x2'),attributes,{'tableName':_0x96be('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5c9061=this;var _0x92425d={'id':_0x5c9061['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5c9061[_0x96be('0x4')]!==_0x96be('0x5')){_0x92425d['service']=_0x5c9061[_0x96be('0x4')];}else{_0x92425d['host']=_0x5c9061['Smtp'][_0x96be('0x6')];_0x92425d[_0x96be('0x7')]=_0x5c9061[_0x96be('0x8')]['port'];_0x92425d[_0x96be('0x9')]=_0x5c9061[_0x96be('0x8')]['secure'];}if(_0x5c9061[_0x96be('0x8')][_0x96be('0xa')]){if(_0x5c9061['Smtp'][_0x96be('0xb')]){if(!_0x5c9061[_0x96be('0x8')][_0x96be('0xc')])throw new Error(_0x96be('0xd'));_0x92425d[_0x96be('0xe')]={'type':_0x96be('0xf'),'user':_0x5c9061['Smtp'][_0x96be('0x10')],'accessToken':_0x5c9061[_0x96be('0x8')][_0x96be('0xc')][_0x96be('0x11')]};}else{_0x92425d[_0x96be('0xe')]={'user':_0x5c9061[_0x96be('0x8')][_0x96be('0x10')],'pass':_0x5c9061['Smtp']['pass']};}}return _0x92425d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 519a09e..9147ecb 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x1da2a5,_0x5c7c58){var _0x447acc=function(_0x41a4e5){while(--_0x41a4e5){_0x1da2a5['push'](_0x1da2a5['shift']());}};_0x447acc(++_0x5c7c58);}(_0x2ef3,0xba));var _0x32ef=function(_0x2989a8,_0x339279){_0x2989a8=_0x2989a8-0x0;var _0x4386e1=_0x2ef3[_0x2989a8];return _0x4386e1;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file +var _0x7880=['info','ShowMailAccount','find','where','smtp','smtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','DESC','MailApplication','Applications','Smtp','CloudProvider','get','getSmtpOptions','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','Contact\x20not\x20found','update','format','interaction','created','attachments','originTo','originCc','bcc','originChannel','Attachment','Attachments','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','map','model'];(function(_0x34ef36,_0x2ee74){var _0x355279=function(_0x4bf2eb){while(--_0x4bf2eb){_0x34ef36['push'](_0x34ef36['shift']());}};_0x355279(++_0x2ee74);}(_0x7880,0x1f4));var _0x0788=function(_0x2f35a2,_0x9c1ac){_0x2f35a2=_0x2f35a2-0x0;var _0x503004=_0x7880[_0x2f35a2];return _0x503004;};'use strict';var _=require('lodash');var moment=require(_0x0788('0x0'));var BPromise=require(_0x0788('0x1'));var rs=require(_0x0788('0x2'));var Redis=require(_0x0788('0x3'));var db=require(_0x0788('0x4'))['db'];var logger=require(_0x0788('0x5'))('rpc');var config=require(_0x0788('0x6'));var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232c});config[_0x0788('0xa')]=_[_0x0788('0xb')](config[_0x0788('0xa')],{'host':_0x0788('0xc'),'port':0x18eb});var socket=require(_0x0788('0xd'))(new Redis(config[_0x0788('0xa')]));require('./mailAccount.socket')[_0x0788('0xe')](socket);function respondWithRpcPromise(_0x49f53b,_0xabaf81,_0x53b2f2){return new BPromise(function(_0x433c26,_0x3c6d18){return client[_0x0788('0xf')](_0x49f53b,_0x53b2f2)[_0x0788('0x10')](function(_0x469ebe){logger['info'](_0x0788('0x11'),_0xabaf81,_0x0788('0x12'));logger[_0x0788('0x13')](_0x0788('0x14'),_0xabaf81,_0x0788('0x12'),JSON[_0x0788('0x15')](_0x469ebe));if(_0x469ebe[_0x0788('0x16')]){if(_0x469ebe['error'][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')](_0x0788('0x11'),_0xabaf81,_0x469ebe[_0x0788('0x16')]['message']);return _0x3c6d18(_0x469ebe[_0x0788('0x16')]['message']);}logger[_0x0788('0x16')](_0x0788('0x11'),_0xabaf81,_0x469ebe[_0x0788('0x16')][_0x0788('0x18')]);return _0x433c26(_0x469ebe[_0x0788('0x16')][_0x0788('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0xabaf81,_0x0788('0x12'));_0x433c26(_0x469ebe[_0x0788('0x19')]['message']);}})[_0x0788('0x1a')](function(_0x415f19){logger[_0x0788('0x16')]('MailAccount,\x20%s,\x20%s',_0xabaf81,_0x415f19);_0x3c6d18(_0x415f19);});});}exports[_0x0788('0x1b')]=function(_0x3fb723){var _0x492c2c=this;return new Promise(function(_0x11ea01,_0x5173d6){return db[_0x0788('0x1c')]['findAll']({'raw':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')][_0x0788('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')]['where']||null:null,'attributes':_0x3fb723['options']?_0x3fb723[_0x0788('0x1d')][_0x0788('0x1f')]||null:null,'limit':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')]['limit']||null:null,'include':_0x3fb723['options']?_0x3fb723[_0x0788('0x1d')][_0x0788('0x20')]?_[_0x0788('0x21')](_0x3fb723['options']['include'],function(_0x240459){return{'model':db[_0x240459[_0x0788('0x22')]],'as':_0x240459['as'],'attributes':_0x240459['attributes'],'include':_0x240459['include']?_[_0x0788('0x21')](_0x240459[_0x0788('0x20')],function(_0x57fda1){return{'model':db[_0x57fda1[_0x0788('0x22')]],'as':_0x57fda1['as'],'attributes':_0x57fda1[_0x0788('0x1f')],'include':_0x57fda1[_0x0788('0x20')]?_[_0x0788('0x21')](_0x57fda1[_0x0788('0x20')],function(_0xb2f4a5){return{'model':db[_0xb2f4a5[_0x0788('0x22')]],'as':_0xb2f4a5['as'],'attributes':_0xb2f4a5[_0x0788('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a5178){logger[_0x0788('0x23')](_0x0788('0x1b'),_0x3fb723);logger['debug']('GetMailAccount',_0x3fb723,JSON[_0x0788('0x15')](_0x5a5178));_0x11ea01(_0x5a5178);})[_0x0788('0x1a')](function(_0x20fcd8){logger[_0x0788('0x16')](_0x0788('0x1b'),_0x20fcd8[_0x0788('0x18')],_0x3fb723);_0x5173d6(_0x492c2c[_0x0788('0x16')](0x1f4,_0x20fcd8[_0x0788('0x18')]));});});};exports[_0x0788('0x24')]=function(_0x85e579){var _0x5ec0ed=this;return new Promise(function(_0x2a08b7,_0x1aab6a){return db[_0x0788('0x1c')][_0x0788('0x25')]({'raw':_0x85e579[_0x0788('0x1d')]?_0x85e579[_0x0788('0x1d')][_0x0788('0x1e')]===undefined?!![]:![]:!![],'where':_0x85e579[_0x0788('0x1d')]?_0x85e579[_0x0788('0x1d')][_0x0788('0x26')]||null:null,'attributes':_0x85e579['options']?_0x85e579['options']['attributes']||null:null,'include':_0x85e579['options']?_0x85e579['options']['include']?_[_0x0788('0x21')](_0x85e579[_0x0788('0x1d')][_0x0788('0x20')],function(_0x574576){return{'model':db[_0x574576[_0x0788('0x22')]],'as':_0x574576['as'],'attributes':_0x574576[_0x0788('0x1f')],'include':_0x574576[_0x0788('0x20')]?_[_0x0788('0x21')](_0x574576['include'],function(_0x2ed940){return{'model':db[_0x2ed940['model']],'as':_0x2ed940['as'],'attributes':_0x2ed940[_0x0788('0x1f')],'include':_0x2ed940['include']?_[_0x0788('0x21')](_0x2ed940[_0x0788('0x20')],function(_0x498e16){return{'model':db[_0x498e16[_0x0788('0x22')]],'as':_0x498e16['as'],'attributes':_0x498e16[_0x0788('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17240e){if(_0x85e579['options'][_0x0788('0x27')]===!![])_0x17240e['setDataValue'](_0x0788('0x28'),_0x17240e['getSmtpOptions']());logger[_0x0788('0x23')]('ShowMailAccount',_0x85e579);logger['debug'](_0x0788('0x24'),_0x85e579,JSON[_0x0788('0x15')](_0x17240e));_0x2a08b7(_0x17240e);})[_0x0788('0x1a')](function(_0x2d17b0){logger[_0x0788('0x16')]('ShowMailAccount',_0x2d17b0['message'],_0x85e579);_0x1aab6a(_0x5ec0ed['error'](0x1f4,_0x2d17b0['message']));});});};exports[_0x0788('0x29')]=function(_0x1202c4){var _0x45b247=this;return new Promise(function(_0x358a22,_0x362c49){var _0x5993ad={'body':_0x1202c4['body'],'channel':_0x0788('0x2a')};var _0x6770a8=_[_0x0788('0x2b')](_[_0x0788('0x2c')](db[_0x0788('0x2d')][_0x0788('0x2e')]),[_0x0788('0x2f'),_0x0788('0x30'),_0x0788('0x31'),'ListId']);var _0x5581e6=![];if(_0x1202c4[_0x0788('0x32')]['id']){delete _0x1202c4[_0x0788('0x32')]['id'];}if(_[_0x0788('0x33')](_0x1202c4['body']['from'])){return _0x362c49(_0x45b247['error'](0x1f4,_0x0788('0x34')));}if(_[_0x0788('0x33')](_0x1202c4[_0x0788('0x32')][_0x0788('0x32')])||_0x1202c4[_0x0788('0x32')][_0x0788('0x32')]===''){return _0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x0788('0x35')));}if(_['isNil'](_0x1202c4[_0x0788('0x32')][_0x0788('0x36')])){return _0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x0788('0x37')+_0x6770a8));}if(!_['includes'](_0x6770a8,_0x1202c4[_0x0788('0x32')][_0x0788('0x36')])){return _0x362c49(_0x45b247['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6770a8));}var _0x524b43={};_0x524b43[_0x1202c4[_0x0788('0x32')]['mapKey']]=_0x1202c4[_0x0788('0x32')][_0x0788('0x38')];return db[_0x0788('0x1c')][_0x0788('0x25')]({'where':{'id':_0x1202c4[_0x0788('0x39')]['id']},'include':[{'model':db[_0x0788('0x3a')],'as':_0x0788('0x3b'),'include':[{'model':db[_0x0788('0x2d')],'as':'Contacts','where':_0x524b43,'limit':0x1,'order':[['updatedAt',_0x0788('0x3c')]]}]},{'model':db[_0x0788('0x3d')],'as':_0x0788('0x3e')},{'model':db['MailServerOut'],'as':_0x0788('0x3f'),'include':[{'model':db[_0x0788('0x40')],'as':_0x0788('0x40')}]}]})[_0x0788('0x10')](function(_0x2395ad){if(_0x2395ad&&_0x2395ad['List']){var _0x5c436a=_0x2395ad[_0x0788('0x41')]({'plain':!![]});_0x5993ad[_0x0788('0x39')]=_['omit'](_0x5c436a,[_0x0788('0x3e'),'List']);_0x5993ad[_0x0788('0x39')][_0x0788('0x28')]=_0x2395ad[_0x0788('0x42')]();_0x5993ad[_0x0788('0x43')]=_0x5c436a[_0x0788('0x3e')];_0x5993ad[_0x0788('0x44')]=_0x5c436a[_0x0788('0x3b')];_0x5993ad[_0x0788('0x43')]=_['orderBy'](_0x5993ad[_0x0788('0x43')],[_0x0788('0x45')],[_0x0788('0x46')]);if(_0x5993ad['account']&&_0x5993ad[_0x0788('0x39')][_0x0788('0x47')]){_0x5993ad['applications'][_0x0788('0x48')]({'id':0x0,'priority':_0x5993ad[_0x0788('0x43')][_0x0788('0x49')]+0x1,'app':_0x0788('0x4a'),'appdata':_0x0788('0x47'),'interval':_0x0788('0x4b')});}if(_0x5993ad['account']['Applications']){delete _0x5993ad[_0x0788('0x39')][_0x0788('0x3e')];}if(_0x5993ad['account'][_0x0788('0x3b')]){delete _0x5993ad[_0x0788('0x39')][_0x0788('0x3b')];}if(_0x5c436a[_0x0788('0x3b')][_0x0788('0x4c')][_0x0788('0x49')]){return _0x5c436a[_0x0788('0x3b')][_0x0788('0x4c')][0x0];}var _0x35f290=_[_0x0788('0xb')](_0x1202c4[_0x0788('0x32')],{'firstName':_0x1202c4[_0x0788('0x32')]['from'],'ListId':_0x5c436a[_0x0788('0x4d')]});_0x35f290[_0x1202c4[_0x0788('0x32')][_0x0788('0x36')]]=_0x1202c4['body'][_0x0788('0x38')];return db[_0x0788('0x2d')]['create'](_0x35f290);}else{throw new Error('List\x20not\x20found');}})[_0x0788('0x10')](function(_0x26826a){_0x5993ad[_0x0788('0x4e')]=_0x26826a;if(_0x26826a){if(!_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x4f')]){_0x1202c4['body'][_0x0788('0x18')][_0x0788('0x4f')]=rs[_0x0788('0x50')]()+'\x20'+_0x1202c4['body']['message'][_0x0788('0x38')];}var _0x5419d9={'ContactId':_0x26826a['id'],'MailAccountId':_0x1202c4[_0x0788('0x39')]['id'],'inReplyTo':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x4f')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x38')],'cc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['cc'],'subject':_0x1202c4[_0x0788('0x32')]['message'][_0x0788('0x51')],'attach':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x52')],'lastMsgAt':moment()['format'](_0x0788('0x53')),'lastMsgDirection':'in'};return db[_0x0788('0x54')][_0x0788('0x25')]({'where':{'closed':![],'MailAccountId':_0x1202c4[_0x0788('0x39')]['id']},'include':[{'model':db[_0x0788('0x55')],'as':'Messages','attributes':[_0x0788('0x4f')],'where':{'messageId':_0x1202c4['body'][_0x0788('0x18')][_0x0788('0x56')]}}]})[_0x0788('0x10')](function(_0x47f22c){if(_0x47f22c){return[_0x47f22c,![]];}return db[_0x0788('0x54')][_0x0788('0x57')](_0x5419d9)[_0x0788('0x10')](function(_0x150403){return[_0x150403,!![]];});});}else{throw new Error(_0x0788('0x58'));}})['spread'](function(_0x25201f,_0x2dea6c){if(_0x25201f){_0x5581e6=_0x2dea6c;if(!_0x2dea6c){return _0x25201f[_0x0788('0x59')]({'inReplyTo':_0x1202c4['body']['message'][_0x0788('0x4f')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['from'],'cc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['cc'],'subject':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['subject'],'attach':_0x25201f['attach']?_0x25201f['attach']:_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x52')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0788('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x25201f;}}})[_0x0788('0x10')](function(_0x3d1181){_0x5993ad[_0x0788('0x5b')]=_0x3d1181[_0x0788('0x41')]({'plain':!![]});_0x5993ad[_0x0788('0x5b')][_0x0788('0x5c')]=_0x5581e6;return db[_0x0788('0x55')][_0x0788('0x57')]({'body':_0x1202c4[_0x0788('0x32')][_0x0788('0x32')],'MailAccountId':_0x1202c4['account']['id'],'MailInteractionId':_0x3d1181['id'],'direction':'in','ContactId':_0x5993ad[_0x0788('0x4e')]['id'],'messageId':_0x1202c4[_0x0788('0x32')]['message']['messageId'],'from':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x38')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['to'],'cc':_0x1202c4[_0x0788('0x32')]['message']['cc'],'subject':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x51')],'attach':_0x1202c4[_0x0788('0x32')]['message'][_0x0788('0x52')],'Attachments':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x5d')],'originTo':_0x1202c4['body']['message'][_0x0788('0x5e')],'originCc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x5f')],'bcc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x60')],'ChatWebsiteId':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['ChatWebsiteId']||null,'originChannel':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x61')]||'Email','ChatOfflineMessageId':_0x1202c4['body'][_0x0788('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0788('0x62')],'as':_0x0788('0x63')}]});})[_0x0788('0x10')](function(_0xa4b3f8){_0x5993ad[_0x0788('0x18')]=_0xa4b3f8;if(_0x5993ad[_0x0788('0x5b')][_0x0788('0x64')]){return db[_0x0788('0x65')][_0x0788('0x25')]({'attributes':['id','name'],'where':{'id':_0x5993ad[_0x0788('0x5b')][_0x0788('0x64')]}})[_0x0788('0x10')](function(_0x54fd89){if(_0x54fd89){_0x5993ad[_0x0788('0x43')][_0x0788('0x66')]({'id':0x0,'priority':0x0,'app':_0x0788('0x67'),'appdata':_0x54fd89['name']+','+(_0x5993ad[_0x0788('0x39')][_0x0788('0x68')]||0xa),'interval':_0x0788('0x4b')});}return respondWithRpcPromise(_0x0788('0x69'),_0x0788('0x6a'),_0x5993ad);});}return respondWithRpcPromise(_0x0788('0x69'),_0x0788('0x6a'),_0x5993ad);})[_0x0788('0x10')](function(_0x25058b){_0x358a22(_0x25058b);})['catch'](function(_0x471b3a){_0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x471b3a[_0x0788('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1cf9880..4ca2a57 100644 --- a/server/api/mailAccount/mailAccount.socket.js +++ b/server/api/mailAccount/mailAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd49=['mailAccount:','./mailAccount.events','save','remove','update','removeListener'];(function(_0x4080dd,_0x5b595d){var _0x4ecf85=function(_0x5d281a){while(--_0x5d281a){_0x4080dd['push'](_0x4080dd['shift']());}};_0x4ecf85(++_0x5b595d);}(_0xfd49,0x91));var _0x9fd4=function(_0x24af15,_0x3f95b7){_0x24af15=_0x24af15-0x0;var _0x505fbc=_0xfd49[_0x24af15];return _0x505fbc;};'use strict';var MailAccountEvents=require(_0x9fd4('0x0'));var events=[_0x9fd4('0x1'),_0x9fd4('0x2'),_0x9fd4('0x3')];function createListener(_0x3c34b6,_0x3ac18d){return function(_0x138952){_0x3ac18d['emit'](_0x3c34b6,_0x138952);};}function removeListener(_0x4c6d44,_0x53108f){return function(){MailAccountEvents[_0x9fd4('0x4')](_0x4c6d44,_0x53108f);};}exports['register']=function(_0x35f894){for(var _0x37e564=0x0,_0x1ac096=events['length'];_0x37e564<_0x1ac096;_0x37e564++){var _0x5ce929=events[_0x37e564];var _0x21b91a=createListener(_0x9fd4('0x5')+_0x5ce929,_0x35f894);MailAccountEvents['on'](_0x5ce929,_0x21b91a);}}; \ No newline at end of file +var _0x5524=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5524,0x166));var _0x4552=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x5524[_0xbca1b1];return _0x4e1686;};'use strict';var MailAccountEvents=require(_0x4552('0x0'));var events=['save',_0x4552('0x1'),_0x4552('0x2')];function createListener(_0x423017,_0x247a6b){return function(_0x54f8e4){_0x247a6b[_0x4552('0x3')](_0x423017,_0x54f8e4);};}function removeListener(_0xc736bd,_0x58e4ed){return function(){MailAccountEvents[_0x4552('0x4')](_0xc736bd,_0x58e4ed);};}exports[_0x4552('0x5')]=function(_0x4d497c){for(var _0x249c9d=0x0,_0x257294=events[_0x4552('0x6')];_0x249c9d<_0x257294;_0x249c9d++){var _0x1ce47d=events[_0x249c9d];var _0x27ed32=createListener(_0x4552('0x7')+_0x1ce47d,_0x4d497c);MailAccountEvents['on'](_0x1ce47d,_0x27ed32);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index b3ddbbc..3391d80 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x221f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x541dee,_0xfd9dab){var _0x51f2e2=function(_0x19cdf5){while(--_0x19cdf5){_0x541dee['push'](_0x541dee['shift']());}};_0x51f2e2(++_0xfd9dab);}(_0x221f,0x18d));var _0xf221=function(_0x6ea106,_0x181b3d){_0x6ea106=_0x6ea106-0x0;var _0x49ecfe=_0x221f[_0x6ea106];return _0x49ecfe;};'use strict';var multer=require(_0xf221('0x0'));var util=require(_0xf221('0x1'));var path=require(_0xf221('0x2'));var timeout=require('connect-timeout');var express=require(_0xf221('0x3'));var router=express[_0xf221('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf221('0x5'));var interaction=require(_0xf221('0x6'));var config=require(_0xf221('0x7'));var controller=require(_0xf221('0x8'));router['get']('/:id',auth[_0xf221('0x9')](),controller['show']);router[_0xf221('0xa')](_0xf221('0xb'),auth['isAuthenticated'](),controller[_0xf221('0xc')]);router[_0xf221('0xd')](_0xf221('0xb'),auth[_0xf221('0x9')](),controller[_0xf221('0xe')]);module[_0xf221('0xf')]=router; \ No newline at end of file +var _0x7551=['../../components/interaction/service','./mailApplication.controller','isAuthenticated','show','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x396474,_0x58ec28){var _0x59542d=function(_0x12cdb9){while(--_0x12cdb9){_0x396474['push'](_0x396474['shift']());}};_0x59542d(++_0x58ec28);}(_0x7551,0x19d));var _0x1755=function(_0x33d38c,_0x2ff27b){_0x33d38c=_0x33d38c-0x0;var _0x537b31=_0x7551[_0x33d38c];return _0x537b31;};'use strict';var multer=require(_0x1755('0x0'));var util=require(_0x1755('0x1'));var path=require('path');var timeout=require(_0x1755('0x2'));var express=require(_0x1755('0x3'));var router=express[_0x1755('0x4')]();var fs_extra=require(_0x1755('0x5'));var auth=require(_0x1755('0x6'));var interaction=require(_0x1755('0x7'));var config=require('../../config/environment');var controller=require(_0x1755('0x8'));router['get']('/:id',auth[_0x1755('0x9')](),controller[_0x1755('0xa')]);router['put']('/:id',auth[_0x1755('0x9')](),controller[_0x1755('0xb')]);router[_0x1755('0xc')]('/:id',auth[_0x1755('0x9')](),controller['destroy']);module[_0x1755('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 6457713..5ada440 100644 --- a/server/api/mailApplication/mailApplication.attributes.js +++ b/server/api/mailApplication/mailApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95f6=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x47e66a,_0xd9823e){var _0x526cda=function(_0x563062){while(--_0x563062){_0x47e66a['push'](_0x47e66a['shift']());}};_0x526cda(++_0xd9823e);}(_0x95f6,0x1ad));var _0x695f=function(_0x265c81,_0x4d539a){_0x265c81=_0x265c81-0x0;var _0x3e63d1=_0x95f6[_0x265c81];return _0x3e63d1;};'use strict';var Sequelize=require(_0x695f('0x0'));module[_0x695f('0x1')]={'priority':{'type':Sequelize[_0x695f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x695f('0x3')],'allowNull':![],'defaultValue':_0x695f('0x4')},'appdata':{'type':Sequelize[_0x695f('0x5')]()},'description':{'type':Sequelize[_0x695f('0x3')]},'interval':{'type':Sequelize[_0x695f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf44f=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x3a1236,_0x51f85d){var _0x52e3c0=function(_0x35b3ec){while(--_0x35b3ec){_0x3a1236['push'](_0x3a1236['shift']());}};_0x52e3c0(++_0x51f85d);}(_0xf44f,0x160));var _0xff44=function(_0x2043e3,_0x72ad64){_0x2043e3=_0x2043e3-0x0;var _0x2d2b57=_0xf44f[_0x2043e3];return _0x2d2b57;};'use strict';var Sequelize=require('sequelize');module[_0xff44('0x0')]={'priority':{'type':Sequelize[_0xff44('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xff44('0x2')],'allowNull':![],'defaultValue':_0xff44('0x3')},'appdata':{'type':Sequelize[_0xff44('0x4')]()},'description':{'type':Sequelize[_0xff44('0x2')]},'interval':{'type':Sequelize[_0xff44('0x2')],'defaultValue':_0xff44('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8b2d68b..8513111 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x46306e,_0x4119ee){var _0x449ba4=function(_0x5d810a){while(--_0x5d810a){_0x46306e['push'](_0x46306e['shift']());}};_0x449ba4(++_0x4119ee);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x52ce3e,_0x25abc7){var _0x49f0ef=function(_0x108653){while(--_0x108653){_0x52ce3e['push'](_0x52ce3e['shift']());}};_0x49f0ef(++_0x25abc7);}(_0x70e0,0x17b));var _0x070e=function(_0x550d9a,_0x136c52){_0x550d9a=_0x550d9a-0x0;var _0x5a1e66=_0x70e0[_0x550d9a];return _0x5a1e66;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 2a345fa..d6191f6 100644 --- a/server/api/mailApplication/mailApplication.model.js +++ b/server/api/mailApplication/mailApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8447=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x344a63,_0x18cc30){var _0x3d4f3e=function(_0x1ad242){while(--_0x1ad242){_0x344a63['push'](_0x344a63['shift']());}};_0x3d4f3e(++_0x18cc30);}(_0x8447,0xd4));var _0x7844=function(_0x113273,_0x5c4c6c){_0x113273=_0x113273-0x0;var _0x385a39=_0x8447[_0x113273];return _0x385a39;};'use strict';var _=require(_0x7844('0x0'));var util=require(_0x7844('0x1'));var logger=require(_0x7844('0x2'))(_0x7844('0x3'));var moment=require(_0x7844('0x4'));var BPromise=require('bluebird');var rp=require(_0x7844('0x5'));var fs=require('fs');var path=require(_0x7844('0x6'));var rimraf=require(_0x7844('0x7'));var config=require('../../config/environment');var attributes=require(_0x7844('0x8'));module[_0x7844('0x9')]=function(_0x467d3c,_0x3de91a){return _0x467d3c[_0x7844('0xa')](_0x7844('0xb'),attributes,{'tableName':_0x7844('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7844('0xd'),'collate':_0x7844('0xe')});}; \ No newline at end of file +var _0xd294=['define','mail_applications','lodash','api','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports'];(function(_0x2b7906,_0x12a0a7){var _0x1420c0=function(_0x51b4a7){while(--_0x51b4a7){_0x2b7906['push'](_0x2b7906['shift']());}};_0x1420c0(++_0x12a0a7);}(_0xd294,0x110));var _0x4d29=function(_0x3bdac7,_0xa80a86){_0x3bdac7=_0x3bdac7-0x0;var _0x37edb8=_0xd294[_0x3bdac7];return _0x37edb8;};'use strict';var _=require(_0x4d29('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d29('0x1'));var moment=require('moment');var BPromise=require(_0x4d29('0x2'));var rp=require(_0x4d29('0x3'));var fs=require('fs');var path=require(_0x4d29('0x4'));var rimraf=require(_0x4d29('0x5'));var config=require('../../config/environment');var attributes=require(_0x4d29('0x6'));module[_0x4d29('0x7')]=function(_0x5abba8,_0x2208c9){return _0x5abba8[_0x4d29('0x8')]('MailApplication',attributes,{'tableName':_0x4d29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c9907bf..a963941 100644 --- a/server/api/mailApplication/mailApplication.rpc.js +++ b/server/api/mailApplication/mailApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee49=['message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x3ff83f,_0xeaef68){var _0x536550=function(_0x158ab0){while(--_0x158ab0){_0x3ff83f['push'](_0x3ff83f['shift']());}};_0x536550(++_0xeaef68);}(_0xee49,0x15b));var _0x9ee4=function(_0x126d27,_0x5d5d0e){_0x126d27=_0x126d27-0x0;var _0x18f24c=_0xee49[_0x126d27];return _0x18f24c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ee4('0x0'));var BPromise=require(_0x9ee4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ee4('0x2'))['db'];var utils=require(_0x9ee4('0x3'));var logger=require('../../config/logger')(_0x9ee4('0x4'));var config=require(_0x9ee4('0x5'));var jayson=require(_0x9ee4('0x6'));var client=jayson[_0x9ee4('0x7')][_0x9ee4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5011b9,_0x28c7ee,_0x526436){return new BPromise(function(_0x4d4c8d,_0x291bb6){return client[_0x9ee4('0x9')](_0x5011b9,_0x526436)[_0x9ee4('0xa')](function(_0x4c0f61){logger[_0x9ee4('0xb')](_0x9ee4('0xc'),_0x28c7ee,'request\x20sent');logger[_0x9ee4('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x28c7ee,_0x9ee4('0xe'),JSON['stringify'](_0x4c0f61));if(_0x4c0f61[_0x9ee4('0xf')]){if(_0x4c0f61[_0x9ee4('0xf')][_0x9ee4('0x10')]===0x1f4){logger[_0x9ee4('0xf')](_0x9ee4('0xc'),_0x28c7ee,_0x4c0f61[_0x9ee4('0xf')]['message']);return _0x291bb6(_0x4c0f61[_0x9ee4('0xf')][_0x9ee4('0x11')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x28c7ee,_0x4c0f61[_0x9ee4('0xf')][_0x9ee4('0x11')]);return _0x4d4c8d(_0x4c0f61[_0x9ee4('0xf')][_0x9ee4('0x11')]);}else{logger[_0x9ee4('0xb')](_0x9ee4('0xc'),_0x28c7ee,'request\x20sent');_0x4d4c8d(_0x4c0f61[_0x9ee4('0x12')][_0x9ee4('0x11')]);}})[_0x9ee4('0x13')](function(_0x3c756e){logger[_0x9ee4('0xf')](_0x9ee4('0xc'),_0x28c7ee,_0x3c756e);_0x291bb6(_0x3c756e);});});}exports[_0x9ee4('0x14')]=function(_0xeed44a){var _0x353291=this;return new Promise(function(_0x2742a7,_0x3b73ca){return db[_0x9ee4('0x15')][_0x9ee4('0x16')](_0xeed44a[_0x9ee4('0x17')],{'raw':_0xeed44a[_0x9ee4('0x18')]?_0xeed44a['options'][_0x9ee4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeed44a[_0x9ee4('0x18')]?_0xeed44a[_0x9ee4('0x18')]['where']||null:null,'attributes':_0xeed44a['options']?_0xeed44a[_0x9ee4('0x18')][_0x9ee4('0x1a')]||null:null,'limit':_0xeed44a['options']?_0xeed44a['options'][_0x9ee4('0x1b')]||null:null})[_0x9ee4('0xa')](function(_0x23073c){logger[_0x9ee4('0xb')](_0x9ee4('0x14'),_0xeed44a);logger[_0x9ee4('0xd')](_0x9ee4('0x14'),_0xeed44a,JSON['stringify'](_0x23073c));_0x2742a7(_0x23073c);})[_0x9ee4('0x13')](function(_0x5ac658){logger['error'](_0x9ee4('0x14'),_0x5ac658[_0x9ee4('0x11')],_0xeed44a);_0x3b73ca(_0x353291[_0x9ee4('0xf')](0x1f4,_0x5ac658['message']));});});}; \ No newline at end of file +var _0xe3c6=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','info','result','UpdateMailApplication','body','options','raw','where','attributes','limit','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xe3c6,0x1c4));var _0x6e3c=function(_0x31b2a5,_0x2480b4){_0x31b2a5=_0x31b2a5-0x0;var _0x198fa4=_0xe3c6[_0x31b2a5];return _0x198fa4;};'use strict';var _=require(_0x6e3c('0x0'));var util=require(_0x6e3c('0x1'));var moment=require(_0x6e3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e3c('0x3'));var fs=require('fs');var Redis=require(_0x6e3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e3c('0x5'));var logger=require('../../config/logger')(_0x6e3c('0x6'));var config=require(_0x6e3c('0x7'));var jayson=require(_0x6e3c('0x8'));var client=jayson[_0x6e3c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14f162,_0x282980,_0x50cf7b){return new BPromise(function(_0x1c2a70,_0x2549d1){return client[_0x6e3c('0xa')](_0x14f162,_0x50cf7b)[_0x6e3c('0xb')](function(_0x397c56){logger['info'](_0x6e3c('0xc'),_0x282980,_0x6e3c('0xd'));logger[_0x6e3c('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x282980,_0x6e3c('0xd'),JSON[_0x6e3c('0xf')](_0x397c56));if(_0x397c56['error']){if(_0x397c56['error'][_0x6e3c('0x10')]===0x1f4){logger['error'](_0x6e3c('0xc'),_0x282980,_0x397c56['error'][_0x6e3c('0x11')]);return _0x2549d1(_0x397c56[_0x6e3c('0x12')][_0x6e3c('0x11')]);}logger[_0x6e3c('0x12')](_0x6e3c('0xc'),_0x282980,_0x397c56[_0x6e3c('0x12')][_0x6e3c('0x11')]);return _0x1c2a70(_0x397c56[_0x6e3c('0x12')][_0x6e3c('0x11')]);}else{logger[_0x6e3c('0x13')](_0x6e3c('0xc'),_0x282980,_0x6e3c('0xd'));_0x1c2a70(_0x397c56[_0x6e3c('0x14')]['message']);}})['catch'](function(_0x2c6f73){logger[_0x6e3c('0x12')](_0x6e3c('0xc'),_0x282980,_0x2c6f73);_0x2549d1(_0x2c6f73);});});}exports[_0x6e3c('0x15')]=function(_0x3031fd){var _0x347df9=this;return new Promise(function(_0x572e8c,_0x10fb23){return db['MailApplication']['update'](_0x3031fd[_0x6e3c('0x16')],{'raw':_0x3031fd[_0x6e3c('0x17')]?_0x3031fd[_0x6e3c('0x17')][_0x6e3c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3031fd['options']?_0x3031fd[_0x6e3c('0x17')][_0x6e3c('0x19')]||null:null,'attributes':_0x3031fd[_0x6e3c('0x17')]?_0x3031fd[_0x6e3c('0x17')][_0x6e3c('0x1a')]||null:null,'limit':_0x3031fd[_0x6e3c('0x17')]?_0x3031fd['options'][_0x6e3c('0x1b')]||null:null})['then'](function(_0x45aea2){logger[_0x6e3c('0x13')](_0x6e3c('0x15'),_0x3031fd);logger[_0x6e3c('0xe')](_0x6e3c('0x15'),_0x3031fd,JSON[_0x6e3c('0xf')](_0x45aea2));_0x572e8c(_0x45aea2);})[_0x6e3c('0x1c')](function(_0x326c32){logger[_0x6e3c('0x12')](_0x6e3c('0x15'),_0x326c32[_0x6e3c('0x11')],_0x3031fd);_0x10fb23(_0x347df9[_0x6e3c('0x12')](0x1f4,_0x326c32[_0x6e3c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 19ae425..e9911e3 100644 --- a/server/api/mailInteraction/index.js +++ b/server/api/mailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9591=['put','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','/:id/tags','removeTags','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','tracked','mail','mailinteraction:addtags','addTags'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0x9591,0x18e));var _0x1959=function(_0x4c931c,_0x2c033e){_0x4c931c=_0x4c931c-0x0;var _0x472eac=_0x9591[_0x4c931c];return _0x472eac;};'use strict';var express=require('express');var router=express[_0x1959('0x0')]();var auth=require(_0x1959('0x1'));var interaction=require(_0x1959('0x2'));var controller=require(_0x1959('0x3'));router[_0x1959('0x4')]('/',auth[_0x1959('0x5')](),controller[_0x1959('0x6')]);router[_0x1959('0x4')](_0x1959('0x7'),auth[_0x1959('0x5')](),controller[_0x1959('0x8')]);router[_0x1959('0x4')](_0x1959('0x9'),auth[_0x1959('0x5')](),controller[_0x1959('0xa')]);router[_0x1959('0x4')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1959('0xb')]);router[_0x1959('0x4')](_0x1959('0xc'),auth[_0x1959('0x5')](),controller[_0x1959('0xd')]);router['post']('/',auth[_0x1959('0x5')](),controller[_0x1959('0xe')]);router[_0x1959('0xf')](_0x1959('0x10'),auth[_0x1959('0x5')](),controller[_0x1959('0x11')]);router[_0x1959('0xf')]('/:id/tags',auth[_0x1959('0x5')](),interaction[_0x1959('0x12')](_0x1959('0x13'),_0x1959('0x14')),controller[_0x1959('0x15')]);router[_0x1959('0x16')](_0x1959('0x9'),auth[_0x1959('0x5')](),interaction[_0x1959('0x12')]('mail',_0x1959('0x17')),controller[_0x1959('0x18')]);router['delete'](_0x1959('0x9'),auth[_0x1959('0x5')](),interaction[_0x1959('0x12')]('mail',_0x1959('0x19')),controller[_0x1959('0x1a')]);router[_0x1959('0x1b')](_0x1959('0x1c'),auth['isAuthenticated'](),controller[_0x1959('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xbedf=['/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','destroy','delete','removeTags','exports','Router','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe','/:id','show','/:id/messages','getMessages','isAuthenticated','download','create','addMessage','post'];(function(_0x11f363,_0x1f9526){var _0x11f6e4=function(_0x414f4c){while(--_0x414f4c){_0x11f363['push'](_0x11f363['shift']());}};_0x11f6e4(++_0x1f9526);}(_0xbedf,0x1e8));var _0xfbed=function(_0x9ae685,_0x2c6652){_0x9ae685=_0x9ae685-0x0;var _0x4c492e=_0xbedf[_0x9ae685];return _0x4c492e;};'use strict';var express=require('express');var router=express[_0xfbed('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0xfbed('0x1'));var controller=require(_0xfbed('0x2'));router[_0xfbed('0x3')]('/',auth['isAuthenticated'](),controller[_0xfbed('0x4')]);router['get'](_0xfbed('0x5'),auth['isAuthenticated'](),controller[_0xfbed('0x6')]);router[_0xfbed('0x3')](_0xfbed('0x7'),auth['isAuthenticated'](),controller[_0xfbed('0x8')]);router[_0xfbed('0x3')](_0xfbed('0x9'),auth['isAuthenticated'](),controller[_0xfbed('0xa')]);router[_0xfbed('0x3')]('/:id/download',auth[_0xfbed('0xb')](),controller[_0xfbed('0xc')]);router['post']('/',auth[_0xfbed('0xb')](),controller[_0xfbed('0xd')]);router['post']('/:id/messages',auth[_0xfbed('0xb')](),controller[_0xfbed('0xe')]);router[_0xfbed('0xf')](_0xfbed('0x10'),auth['isAuthenticated'](),interaction['tracked'](_0xfbed('0x11'),_0xfbed('0x12')),controller[_0xfbed('0x13')]);router[_0xfbed('0x14')](_0xfbed('0x7'),auth['isAuthenticated'](),interaction[_0xfbed('0x15')](_0xfbed('0x11'),_0xfbed('0x16')),controller[_0xfbed('0x17')]);router['delete'](_0xfbed('0x7'),auth[_0xfbed('0xb')](),interaction[_0xfbed('0x15')]('mail','mailinteraction:destroy'),controller[_0xfbed('0x18')]);router[_0xfbed('0x19')](_0xfbed('0x10'),auth[_0xfbed('0xb')](),controller[_0xfbed('0x1a')]);module[_0xfbed('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index c0ea015..930d2b9 100644 --- a/server/api/mailInteraction/mailInteraction.attributes.js +++ b/server/api/mailInteraction/mailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa265=['iconv','exports','BOOLEAN','DATE','STRING','long','ENUM','out','sequelize'];(function(_0x530c4d,_0x394395){var _0x509ace=function(_0x10f0f0){while(--_0x10f0f0){_0x530c4d['push'](_0x530c4d['shift']());}};_0x509ace(++_0x394395);}(_0xa265,0x18b));var _0x5a26=function(_0xdaa6df,_0x1927da){_0xdaa6df=_0xdaa6df-0x0;var _0x353af2=_0xa265[_0xdaa6df];return _0x353af2;};'use strict';var Sequelize=require(_0x5a26('0x0'));var iconv=require(_0x5a26('0x1'));module[_0x5a26('0x2')]={'closed':{'type':Sequelize[_0x5a26('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5a26('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5a26('0x5')]},'thirdDisposition':{'type':Sequelize[_0x5a26('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5a26('0x5')](0x1fe)},'to':{'type':Sequelize[_0x5a26('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x5a26('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x5a26('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5a26('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x5a26('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5a26('0x7')]('in',_0x5a26('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5a26('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x5a26('0x7')]('in',_0x5a26('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5a26('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf715=['exports','BOOLEAN','DATE','STRING','long','ENUM','out','iconv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf715,0x1ef));var _0x5f71=function(_0x16708f,_0x304682){_0x16708f=_0x16708f-0x0;var _0x2c90d5=_0xf715[_0x16708f];return _0x2c90d5;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x5f71('0x0'));module[_0x5f71('0x1')]={'closed':{'type':Sequelize[_0x5f71('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5f71('0x3')]},'disposition':{'type':Sequelize[_0x5f71('0x4')]},'secondDisposition':{'type':Sequelize[_0x5f71('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5f71('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5f71('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x5f71('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x5f71('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5f71('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x5f71('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5f71('0x6')]('in',_0x5f71('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5f71('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index f3460dd..6718b08 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69a3=['redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','json','offset','undefined','count','set','Content-Range','destroy','then','end','sendStatus','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','describe','addMessage','MailMessage','ids','length','hasOwnProperty','nolimit','limit','sort','pick','where','MailInteractionId','merge','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','addTags','setTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','Attachment','Messages','from','bcc','subject','get','mkdirSync','each','createdAt','headers','Attachments','basename','existsSync','readFileSync','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults'];(function(_0x36a89e,_0x818ef3){var _0x3bf3b9=function(_0x44f14a){while(--_0x44f14a){_0x36a89e['push'](_0x36a89e['shift']());}};_0x3bf3b9(++_0x818ef3);}(_0x69a3,0xd0));var _0x369a=function(_0x59850d,_0x55e88e){_0x59850d=_0x59850d-0x0;var _0xdac1da=_0x69a3[_0x59850d];return _0xdac1da;};'use strict';var emlformat=require(_0x369a('0x0'));var rimraf=require(_0x369a('0x1'));var zipdir=require('zip-dir');var moment=require(_0x369a('0x2'));var BPromise=require(_0x369a('0x3'));var util=require(_0x369a('0x4'));var path=require(_0x369a('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0x369a('0x6'));var Redis=require(_0x369a('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x369a('0x8'))(_0x369a('0x9'));var config=require(_0x369a('0xa'));var db=require(_0x369a('0xb'))['db'];var htmlEntities=require(_0x369a('0xc'));config['redis']=_[_0x369a('0xd')](config[_0x369a('0xe')],{'host':_0x369a('0xf'),'port':0x18eb});var socket=require(_0x369a('0x10'))(new Redis(config['redis']));require(_0x369a('0x11'))[_0x369a('0x12')](socket);function respondWithStatusCode(_0x4180ed,_0x2acad6){_0x2acad6=_0x2acad6||0xcc;return function(_0x11494c){if(_0x11494c){return _0x4180ed['sendStatus'](_0x2acad6);}return _0x4180ed['status'](_0x2acad6)['end']();};}function respondWithResult(_0x1dd8e8,_0x252641){_0x252641=_0x252641||0xc8;return function(_0x3c613f){if(_0x3c613f){return _0x1dd8e8[_0x369a('0x13')](_0x252641)[_0x369a('0x14')](_0x3c613f);}};}function respondWithFilteredResult(_0x57eab8,_0x1ea384){return function(_0x5dc093){if(_0x5dc093){var _0x3b2490=typeof _0x1ea384[_0x369a('0x15')]===_0x369a('0x16')&&typeof _0x1ea384['limit']===_0x369a('0x16');var _0x1daa27=_0x5dc093['count'];var _0x2daee7=_0x3b2490?0x0:_0x1ea384[_0x369a('0x15')];var _0x1a5743=_0x3b2490?_0x5dc093[_0x369a('0x17')]:_0x1ea384[_0x369a('0x15')]+_0x1ea384['limit'];var _0x5aac5e;if(_0x1a5743>=_0x1daa27){_0x1a5743=_0x1daa27;_0x5aac5e=0xc8;}else{_0x5aac5e=0xce;}_0x57eab8[_0x369a('0x13')](_0x5aac5e);return _0x57eab8[_0x369a('0x18')](_0x369a('0x19'),_0x2daee7+'-'+_0x1a5743+'/'+_0x1daa27)[_0x369a('0x14')](_0x5dc093);}return null;};}function saveUpdates(_0x57682e){return function(_0x50b30e){if(_0x50b30e){return _0x50b30e['update'](_0x57682e)['then'](function(_0x29dc54){return _0x29dc54;});}return null;};}function removeEntity(_0x15b267){return function(_0xd70ef6){if(_0xd70ef6){return _0xd70ef6[_0x369a('0x1a')]()[_0x369a('0x1b')](function(){_0x15b267['status'](0xcc)[_0x369a('0x1c')]();});}};}function handleEntityNotFound(_0xc92177){return function(_0x5808cf){if(!_0x5808cf){_0xc92177[_0x369a('0x1d')](0x194);}return _0x5808cf;};}function handleError(_0x464861,_0x3f9e7d){_0x3f9e7d=_0x3f9e7d||0x1f4;return function(_0x1f2c35){logger['error'](_0x1f2c35[_0x369a('0x1e')]);if(_0x1f2c35[_0x369a('0x1f')]){delete _0x1f2c35[_0x369a('0x1f')];}_0x464861['status'](_0x3f9e7d)[_0x369a('0x20')](_0x1f2c35);};}exports[_0x369a('0x21')]=function(_0x3e9ebd,_0x2fcb55){var _0x951043={};var _0x4ac100=_[_0x369a('0x22')](db[_0x369a('0x23')][_0x369a('0x24')],function(_0x399ec2){return{'name':_0x399ec2[_0x369a('0x25')],'type':_0x399ec2[_0x369a('0x26')][_0x369a('0x27')]};});_0x951043=qs[_0x369a('0x28')](_0x4ac100,_0x3e9ebd);return interaction[_0x369a('0x29')]('mail',_0x3e9ebd['query'],_0x3e9ebd[_0x369a('0x2a')],_0x951043,_0x4ac100)[_0x369a('0x1b')](respondWithFilteredResult(_0x2fcb55,_0x951043))[_0x369a('0x2b')](handleError(_0x2fcb55,null));};exports[_0x369a('0x2c')]=function(_0x56ec39,_0x4727ae){var _0x24abae={'raw':![],'where':{'id':_0x56ec39[_0x369a('0x2d')]['id']}},_0x3421ed={};_0x3421ed[_0x369a('0x2e')]=_[_0x369a('0x2f')](db[_0x369a('0x23')][_0x369a('0x24')]);_0x3421ed[_0x369a('0x30')]=_[_0x369a('0x2f')](_0x56ec39[_0x369a('0x30')]);_0x3421ed[_0x369a('0x31')]=_[_0x369a('0x32')](_0x3421ed[_0x369a('0x2e')],_0x3421ed[_0x369a('0x30')]);_0x24abae[_0x369a('0x33')]=_[_0x369a('0x32')](_0x3421ed[_0x369a('0x2e')],qs[_0x369a('0x34')](_0x56ec39['query'][_0x369a('0x34')]));_0x24abae['attributes']=_0x24abae['attributes']['length']?_0x24abae[_0x369a('0x33')]:_0x3421ed['model'];if(_0x56ec39[_0x369a('0x30')][_0x369a('0x35')]){_0x24abae['include']=[{'all':!![]}];}_0x24abae=_['merge']({},_0x24abae,_0x56ec39[_0x369a('0x36')]);return db[_0x369a('0x23')][_0x369a('0x37')](_0x24abae)[_0x369a('0x1b')](handleEntityNotFound(_0x4727ae,null))[_0x369a('0x1b')](respondWithResult(_0x4727ae,null))[_0x369a('0x2b')](handleError(_0x4727ae,null));};exports[_0x369a('0x38')]=function(_0x3a75da,_0x3a6be6){return db[_0x369a('0x23')][_0x369a('0x38')](_0x3a75da[_0x369a('0x39')],{})[_0x369a('0x1b')](respondWithResult(_0x3a6be6,0xc9))['catch'](handleError(_0x3a6be6,null));};exports['update']=function(_0x223209,_0xb9019f){if(_0x223209[_0x369a('0x39')]['id']){delete _0x223209[_0x369a('0x39')]['id'];}return db[_0x369a('0x23')][_0x369a('0x37')]({'where':{'id':_0x223209[_0x369a('0x2d')]['id']}})[_0x369a('0x1b')](handleEntityNotFound(_0xb9019f,null))[_0x369a('0x1b')](saveUpdates(_0x223209[_0x369a('0x39')],null))[_0x369a('0x1b')](respondWithResult(_0xb9019f,null))['catch'](handleError(_0xb9019f,null));};exports[_0x369a('0x1a')]=function(_0x32c124,_0x5d43fd){return db[_0x369a('0x23')][_0x369a('0x37')]({'where':{'id':_0x32c124[_0x369a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5d43fd,null))[_0x369a('0x1b')](removeEntity(_0x5d43fd,null))[_0x369a('0x2b')](handleError(_0x5d43fd,null));};exports[_0x369a('0x3a')]=function(_0x580eb1,_0x4b8af2){return db['MailInteraction'][_0x369a('0x3a')]()[_0x369a('0x1b')](respondWithResult(_0x4b8af2,null))['catch'](handleError(_0x4b8af2,null));};exports[_0x369a('0x3b')]=function(_0x505db3,_0x23bd80){return db[_0x369a('0x3c')]['find']({'where':{'id':_0x505db3[_0x369a('0x2d')]['id']}})[_0x369a('0x1b')](handleEntityNotFound(_0x23bd80,null))[_0x369a('0x1b')](function(_0x3c0e01){if(_0x3c0e01){return _0x3c0e01['addMessage'](_0x505db3[_0x369a('0x39')][_0x369a('0x3d')],_['omit'](_0x505db3['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x23bd80,null))['catch'](handleError(_0x23bd80,null));};exports['getMessages']=function(_0x387c51,_0x4bb6ac){var _0x473e0e={'raw':![],'where':{}};var _0x4b81fa={};var _0x689d8b={'count':0x0,'rows':[]};return db[_0x369a('0x23')]['findOne']({'where':{'id':_0x387c51[_0x369a('0x2d')]['id']}})[_0x369a('0x1b')](handleEntityNotFound(_0x4bb6ac,null))['then'](function(_0x1c7d7d){if(_0x1c7d7d){_0x4b81fa['model']=_[_0x369a('0x2f')](db[_0x369a('0x3c')][_0x369a('0x24')]);_0x4b81fa[_0x369a('0x30')]=_['keys'](_0x387c51[_0x369a('0x30')]);_0x4b81fa['filters']=_[_0x369a('0x32')](_0x4b81fa[_0x369a('0x2e')],_0x4b81fa[_0x369a('0x30')]);_0x473e0e[_0x369a('0x33')]=_['intersection'](_0x4b81fa[_0x369a('0x2e')],qs[_0x369a('0x34')](_0x387c51['query'][_0x369a('0x34')]));_0x473e0e[_0x369a('0x33')]=_0x473e0e[_0x369a('0x33')][_0x369a('0x3e')]?_0x473e0e['attributes']:_0x4b81fa[_0x369a('0x2e')];if(!_0x387c51[_0x369a('0x30')][_0x369a('0x3f')](_0x369a('0x40'))){_0x473e0e[_0x369a('0x41')]=qs['limit'](_0x387c51[_0x369a('0x30')]['limit']);_0x473e0e[_0x369a('0x15')]=qs['offset'](_0x387c51[_0x369a('0x30')][_0x369a('0x15')]);}_0x473e0e['order']=qs['sort'](_0x387c51[_0x369a('0x30')][_0x369a('0x42')]);_0x473e0e['where']=qs[_0x369a('0x31')](_[_0x369a('0x43')](_0x387c51['query'],_0x4b81fa[_0x369a('0x31')]));_0x473e0e[_0x369a('0x44')][_0x369a('0x45')]=_0x1c7d7d['id'];if(_0x387c51['query']['filter']){_0x473e0e[_0x369a('0x44')]=_[_0x369a('0x46')](_0x473e0e[_0x369a('0x44')],{'$or':_[_0x369a('0x22')](_0x473e0e[_0x369a('0x33')],function(_0x4717a6){var _0x136682={};_0x136682[_0x4717a6]={'$like':'%'+_0x387c51['query'][_0x369a('0x47')]+'%'};return _0x136682;})});}if(_0x387c51[_0x369a('0x30')][_0x369a('0x48')]){var _0x457e95=_0x387c51['query']['$gte']['split'](',');var _0x6e8daa={};_0x6e8daa[_0x457e95[0x0]]={'$gte':moment(_0x457e95[0x1])[_0x369a('0x49')](_0x369a('0x4a'))};_0x473e0e[_0x369a('0x44')]=_[_0x369a('0x46')](_0x473e0e[_0x369a('0x44')],_0x6e8daa);}_0x473e0e=_[_0x369a('0x46')]({},_0x473e0e,_0x387c51['options']);return db[_0x369a('0x3c')][_0x369a('0x17')]({'where':_0x473e0e[_0x369a('0x44')]})[_0x369a('0x1b')](function(_0x18ef6f){_0x689d8b[_0x369a('0x17')]=_0x18ef6f;if(_0x387c51[_0x369a('0x30')][_0x369a('0x35')]){_0x473e0e[_0x369a('0x4b')]=[{'all':!![]}];}return db[_0x369a('0x3c')][_0x369a('0x29')](_0x473e0e);})[_0x369a('0x1b')](function(_0x2e4aea){if(_0x387c51['query'][_0x369a('0x4c')]===_0x369a('0x4d')){for(var _0x8a6b87=0x0;_0x8a6b87<_0x2e4aea[_0x369a('0x3e')];_0x8a6b87++){_0x2e4aea[_0x8a6b87][_0x369a('0x39')]=juice(_0x2e4aea[_0x8a6b87][_0x369a('0x39')]);}}_0x689d8b['rows']=_0x2e4aea;return _0x689d8b;});}})[_0x369a('0x1b')](respondWithFilteredResult(_0x4bb6ac,_0x473e0e))[_0x369a('0x2b')](handleError(_0x4bb6ac,null));};exports[_0x369a('0x4e')]=function(_0x5c4eec,_0x35b3ec){return db['MailInteraction'][_0x369a('0x37')]({'where':{'id':_0x5c4eec[_0x369a('0x2d')]['id']}})[_0x369a('0x1b')](handleEntityNotFound(_0x35b3ec,null))[_0x369a('0x1b')](function(_0x25bfe5){if(_0x25bfe5){return _0x25bfe5[_0x369a('0x4f')](_0x5c4eec['body'][_0x369a('0x3d')],_[_0x369a('0x50')](_0x5c4eec[_0x369a('0x39')],[_0x369a('0x3d'),'id'])||{})[_0x369a('0x51')](function(){return db[_0x369a('0x52')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x5c4eec[_0x369a('0x39')]['ids']}});})['then'](function(_0x4050b0){socket[_0x369a('0x53')](_0x369a('0x54'),{'id':Number(_0x5c4eec[_0x369a('0x2d')]['id']),'tags':_0x4050b0||[]});return{'id':Number(_0x5c4eec[_0x369a('0x2d')]['id']),'tags':_0x4050b0||[]};});}})['then'](respondWithResult(_0x35b3ec,null))[_0x369a('0x2b')](handleError(_0x35b3ec,null));};exports[_0x369a('0x55')]=function(_0x5eb10b,_0x2dafbc){return db[_0x369a('0x23')][_0x369a('0x37')]({'where':{'id':_0x5eb10b[_0x369a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2dafbc,null))[_0x369a('0x1b')](function(_0xe7e09e){if(_0xe7e09e){return _0xe7e09e[_0x369a('0x55')](_0x5eb10b[_0x369a('0x30')][_0x369a('0x3d')]);}})[_0x369a('0x1b')](respondWithStatusCode(_0x2dafbc,null))[_0x369a('0x2b')](handleError(_0x2dafbc,null));};exports['download']=function(_0x484b00,_0x15ef38){var _0x5c185d=moment()[_0x369a('0x56')]()['toString']();var _0x39edbc=path['join'](config[_0x369a('0x57')],_0x369a('0x58'),_0x369a('0x59'),_0x369a('0x5a'));var _0x1b2212=path[_0x369a('0x5b')](config[_0x369a('0x57')],_0x369a('0x58'),_0x369a('0x59'),_0x369a('0x5c'));var _0x5435fa=path[_0x369a('0x5b')](_0x39edbc,_0x5c185d);var _0x4dc8d3=util['format']('transcript-%d-%s.zip',_0x484b00[_0x369a('0x2d')]['id'],_0x5c185d);var _0x374c73=path[_0x369a('0x5b')](_0x39edbc,_0x4dc8d3);var _0x25b72b=[];if(_0x484b00[_0x369a('0x30')][_0x369a('0x5c')]){_0x25b72b['push']({'model':db[_0x369a('0x5d')],'as':'Attachments','raw':!![]});}var _0x53d51b=[{'model':db[_0x369a('0x3c')],'as':_0x369a('0x5e'),'attributes':['id',_0x369a('0x39'),_0x369a('0x5f'),'to','cc',_0x369a('0x60'),_0x369a('0x61'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x25b72b}];return db[_0x369a('0x23')][_0x369a('0x37')]({'where':{'id':_0x484b00['params']['id']},'include':_0x53d51b})[_0x369a('0x1b')](handleEntityNotFound(_0x15ef38,null))[_0x369a('0x1b')](function(_0x3583bb){if(_0x3583bb&&_0x3583bb[_0x369a('0x5e')]){var _0xc71de3=_0x3583bb[_0x369a('0x62')]({'plain':!![]});fs[_0x369a('0x63')](_0x5435fa);return BPromise[_0x369a('0x64')](_0xc71de3[_0x369a('0x5e')],function(_0x1c320b,_0x4de60f){var _0x443b2c={'from':_0x1c320b[_0x369a('0x5f')],'to':_0x1c320b['to']||'missing.recipient@your.company.com','subject':_0x1c320b[_0x369a('0x61')],'html':htmlEntities['decode'](_0x1c320b['body']),'headers':{'Date':moment(_0x1c320b[_0x369a('0x65')])[_0x369a('0x49')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1c320b['cc']){_0x443b2c[_0x369a('0x66')]['Cc']=_0x1c320b['cc'];}if(_0x1c320b[_0x369a('0x60')]){_0x443b2c[_0x369a('0x66')]['Bcc']=_0x1c320b['bcc'];}return new BPromise(function(_0x141cc8,_0x7bff6){if(_0x1c320b[_0x369a('0x67')]){for(var _0x13c449=0x0;_0x13c449<_0x1c320b[_0x369a('0x67')][_0x369a('0x3e')];_0x13c449++){var _0x4682b2=_0x1c320b[_0x369a('0x67')][_0x13c449];var _0xf08ac7=path[_0x369a('0x5b')](_0x1b2212,_0x4682b2[_0x369a('0x68')]);if(fs[_0x369a('0x69')](_0xf08ac7)){_0x443b2c[_0x369a('0x5c')]['push']({'name':_0x4682b2[_0x369a('0x1f')],'contentType':_0x4682b2[_0x369a('0x26')],'data':fs[_0x369a('0x6a')](_0xf08ac7)});}}}emlformat['build'](_0x443b2c,function(_0x459c1e,_0x2ba638){if(_0x459c1e)return _0x7bff6(_0x459c1e);fs[_0x369a('0x6b')](path[_0x369a('0x5b')](_0x5435fa,util[_0x369a('0x49')](_0x369a('0x6c'),_0x4de60f)),_0x2ba638);return _0x141cc8(_0x2ba638);});});})['then'](function(){return new BPromise(function(_0x1a80af,_0x387412){zipdir(_0x5435fa,{'saveTo':_0x374c73},function(_0x5e80b5,_0x4636fe){if(_0x5e80b5)return _0x387412(_0x5e80b5);return _0x1a80af(_0x4636fe);});})[_0x369a('0x1b')](function(){return new BPromise(function(_0x88407c,_0x52a954){rimraf(_0x5435fa,function(_0x53e70d){if(_0x53e70d)_0x52a954(_0x53e70d);return _0x88407c();});});})[_0x369a('0x1b')](function(){return _0x15ef38[_0x369a('0x6d')](_0x374c73,_0x4dc8d3,function(_0xde1a45){if(!_0xde1a45)fs[_0x369a('0x6e')](_0x374c73);});});});}else{return _0x15ef38[_0x369a('0x1d')](0xc8);}})[_0x369a('0x2b')](handleError(_0x15ef38,null));}; \ No newline at end of file +var _0xc579=['root','server','files','tmp','attachments','join','transcript-%d-%s.zip','push','Messages','bcc','subject','createdAt','mkdirSync','from','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','readFileSync','build','writeFileSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','inlineCss','true','setTags','color','emit','mailInteractionTags:save','removeTags','download','toString'];(function(_0xdfebf,_0x556893){var _0x5862f8=function(_0x41d16b){while(--_0x41d16b){_0xdfebf['push'](_0xdfebf['shift']());}};_0x5862f8(++_0x556893);}(_0xc579,0x1d8));var _0x9c57=function(_0x2c7fb7,_0x101c54){_0x2c7fb7=_0x2c7fb7-0x0;var _0x51116a=_0xc579[_0x2c7fb7];return _0x51116a;};'use strict';var emlformat=require(_0x9c57('0x0'));var rimraf=require(_0x9c57('0x1'));var zipdir=require(_0x9c57('0x2'));var moment=require(_0x9c57('0x3'));var BPromise=require(_0x9c57('0x4'));var util=require(_0x9c57('0x5'));var path=require(_0x9c57('0x6'));var fs=require('fs');var _=require(_0x9c57('0x7'));var juice=require(_0x9c57('0x8'));var Redis=require(_0x9c57('0x9'));var interaction=require(_0x9c57('0xa'));var qs=require(_0x9c57('0xb'));var logger=require(_0x9c57('0xc'))('api');var config=require(_0x9c57('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x9c57('0xe'));config['redis']=_[_0x9c57('0xf')](config[_0x9c57('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c57('0x11'))(new Redis(config[_0x9c57('0x10')]));require(_0x9c57('0x12'))[_0x9c57('0x13')](socket);function respondWithStatusCode(_0x250b14,_0x37c4bb){_0x37c4bb=_0x37c4bb||0xcc;return function(_0x4853bc){if(_0x4853bc){return _0x250b14['sendStatus'](_0x37c4bb);}return _0x250b14[_0x9c57('0x14')](_0x37c4bb)[_0x9c57('0x15')]();};}function respondWithResult(_0x1ad0b1,_0x4254a2){_0x4254a2=_0x4254a2||0xc8;return function(_0x4013f7){if(_0x4013f7){return _0x1ad0b1[_0x9c57('0x14')](_0x4254a2)[_0x9c57('0x16')](_0x4013f7);}};}function respondWithFilteredResult(_0x27c606,_0x583c94){return function(_0x8cdede){if(_0x8cdede){var _0x336c91=typeof _0x583c94[_0x9c57('0x17')]===_0x9c57('0x18')&&typeof _0x583c94[_0x9c57('0x19')]===_0x9c57('0x18');var _0x48edc9=_0x8cdede[_0x9c57('0x1a')];var _0x1ace9d=_0x336c91?0x0:_0x583c94[_0x9c57('0x17')];var _0x3355bf=_0x336c91?_0x8cdede['count']:_0x583c94[_0x9c57('0x17')]+_0x583c94[_0x9c57('0x19')];var _0x45ac64;if(_0x3355bf>=_0x48edc9){_0x3355bf=_0x48edc9;_0x45ac64=0xc8;}else{_0x45ac64=0xce;}_0x27c606[_0x9c57('0x14')](_0x45ac64);return _0x27c606['set'](_0x9c57('0x1b'),_0x1ace9d+'-'+_0x3355bf+'/'+_0x48edc9)[_0x9c57('0x16')](_0x8cdede);}return null;};}function saveUpdates(_0x15c972){return function(_0x4c477c){if(_0x4c477c){return _0x4c477c[_0x9c57('0x1c')](_0x15c972)['then'](function(_0x5a58f0){return _0x5a58f0;});}return null;};}function removeEntity(_0x31991d){return function(_0x46bf32){if(_0x46bf32){return _0x46bf32['destroy']()[_0x9c57('0x1d')](function(){_0x31991d['status'](0xcc)[_0x9c57('0x15')]();});}};}function handleEntityNotFound(_0x372713){return function(_0x3948e1){if(!_0x3948e1){_0x372713[_0x9c57('0x1e')](0x194);}return _0x3948e1;};}function handleError(_0x3d0b98,_0xa67a6){_0xa67a6=_0xa67a6||0x1f4;return function(_0x19d38b){logger[_0x9c57('0x1f')](_0x19d38b[_0x9c57('0x20')]);if(_0x19d38b[_0x9c57('0x21')]){delete _0x19d38b['name'];}_0x3d0b98['status'](_0xa67a6)[_0x9c57('0x22')](_0x19d38b);};}exports['index']=function(_0x53219a,_0x16ec26){var _0x33cfe9={};var _0x6bafb4=_[_0x9c57('0x23')](db[_0x9c57('0x24')][_0x9c57('0x25')],function(_0x513d40){return{'name':_0x513d40[_0x9c57('0x26')],'type':_0x513d40[_0x9c57('0x27')][_0x9c57('0x28')]};});_0x33cfe9=qs[_0x9c57('0x29')](_0x6bafb4,_0x53219a);return interaction[_0x9c57('0x2a')]('mail',_0x53219a['query'],_0x53219a['user'],_0x33cfe9,_0x6bafb4)[_0x9c57('0x1d')](respondWithFilteredResult(_0x16ec26,_0x33cfe9))[_0x9c57('0x2b')](handleError(_0x16ec26,null));};exports[_0x9c57('0x2c')]=function(_0x58db25,_0x42ed18){var _0x549c1e={'raw':![],'where':{'id':_0x58db25[_0x9c57('0x2d')]['id']}},_0xdedd8d={};_0xdedd8d[_0x9c57('0x2e')]=_['keys'](db[_0x9c57('0x24')][_0x9c57('0x25')]);_0xdedd8d['query']=_[_0x9c57('0x2f')](_0x58db25[_0x9c57('0x30')]);_0xdedd8d['filters']=_[_0x9c57('0x31')](_0xdedd8d['model'],_0xdedd8d[_0x9c57('0x30')]);_0x549c1e[_0x9c57('0x32')]=_[_0x9c57('0x31')](_0xdedd8d[_0x9c57('0x2e')],qs[_0x9c57('0x33')](_0x58db25['query'][_0x9c57('0x33')]));_0x549c1e[_0x9c57('0x32')]=_0x549c1e[_0x9c57('0x32')][_0x9c57('0x34')]?_0x549c1e[_0x9c57('0x32')]:_0xdedd8d[_0x9c57('0x2e')];if(_0x58db25[_0x9c57('0x30')][_0x9c57('0x35')]){_0x549c1e[_0x9c57('0x36')]=[{'all':!![]}];}_0x549c1e=_[_0x9c57('0x37')]({},_0x549c1e,_0x58db25['options']);return db[_0x9c57('0x24')][_0x9c57('0x38')](_0x549c1e)[_0x9c57('0x1d')](handleEntityNotFound(_0x42ed18,null))[_0x9c57('0x1d')](respondWithResult(_0x42ed18,null))[_0x9c57('0x2b')](handleError(_0x42ed18,null));};exports[_0x9c57('0x39')]=function(_0x4b3377,_0x2105e3){return db[_0x9c57('0x24')][_0x9c57('0x39')](_0x4b3377[_0x9c57('0x3a')],{})[_0x9c57('0x1d')](respondWithResult(_0x2105e3,0xc9))[_0x9c57('0x2b')](handleError(_0x2105e3,null));};exports[_0x9c57('0x1c')]=function(_0x1a95c0,_0x4ddc3f){if(_0x1a95c0[_0x9c57('0x3a')]['id']){delete _0x1a95c0[_0x9c57('0x3a')]['id'];}return db[_0x9c57('0x24')]['find']({'where':{'id':_0x1a95c0[_0x9c57('0x2d')]['id']}})[_0x9c57('0x1d')](handleEntityNotFound(_0x4ddc3f,null))[_0x9c57('0x1d')](saveUpdates(_0x1a95c0[_0x9c57('0x3a')],null))[_0x9c57('0x1d')](respondWithResult(_0x4ddc3f,null))[_0x9c57('0x2b')](handleError(_0x4ddc3f,null));};exports[_0x9c57('0x3b')]=function(_0x59883d,_0x2b33bb){return db['MailInteraction'][_0x9c57('0x38')]({'where':{'id':_0x59883d[_0x9c57('0x2d')]['id']}})[_0x9c57('0x1d')](handleEntityNotFound(_0x2b33bb,null))[_0x9c57('0x1d')](removeEntity(_0x2b33bb,null))[_0x9c57('0x2b')](handleError(_0x2b33bb,null));};exports[_0x9c57('0x3c')]=function(_0x42dd69,_0x33a6f2){return db[_0x9c57('0x24')][_0x9c57('0x3c')]()[_0x9c57('0x1d')](respondWithResult(_0x33a6f2,null))['catch'](handleError(_0x33a6f2,null));};exports[_0x9c57('0x3d')]=function(_0x5666aa,_0x33cff7){return db[_0x9c57('0x3e')][_0x9c57('0x38')]({'where':{'id':_0x5666aa[_0x9c57('0x2d')]['id']}})[_0x9c57('0x1d')](handleEntityNotFound(_0x33cff7,null))['then'](function(_0x1b4e9a){if(_0x1b4e9a){return _0x1b4e9a[_0x9c57('0x3d')](_0x5666aa[_0x9c57('0x3a')][_0x9c57('0x3f')],_[_0x9c57('0x40')](_0x5666aa['body'],['ids','id'])||{});}})[_0x9c57('0x1d')](respondWithResult(_0x33cff7,null))[_0x9c57('0x2b')](handleError(_0x33cff7,null));};exports[_0x9c57('0x41')]=function(_0x1da4a4,_0x5e5a50){var _0xf471de={'raw':![],'where':{}};var _0x43ec90={};var _0x1dfb7d={'count':0x0,'rows':[]};return db[_0x9c57('0x24')]['findOne']({'where':{'id':_0x1da4a4[_0x9c57('0x2d')]['id']}})[_0x9c57('0x1d')](handleEntityNotFound(_0x5e5a50,null))['then'](function(_0x40a9eb){if(_0x40a9eb){_0x43ec90[_0x9c57('0x2e')]=_[_0x9c57('0x2f')](db['MailMessage']['rawAttributes']);_0x43ec90[_0x9c57('0x30')]=_[_0x9c57('0x2f')](_0x1da4a4['query']);_0x43ec90[_0x9c57('0x42')]=_[_0x9c57('0x31')](_0x43ec90['model'],_0x43ec90['query']);_0xf471de[_0x9c57('0x32')]=_[_0x9c57('0x31')](_0x43ec90[_0x9c57('0x2e')],qs[_0x9c57('0x33')](_0x1da4a4[_0x9c57('0x30')]['fields']));_0xf471de['attributes']=_0xf471de[_0x9c57('0x32')][_0x9c57('0x34')]?_0xf471de['attributes']:_0x43ec90['model'];if(!_0x1da4a4[_0x9c57('0x30')][_0x9c57('0x43')](_0x9c57('0x44'))){_0xf471de[_0x9c57('0x19')]=qs[_0x9c57('0x19')](_0x1da4a4[_0x9c57('0x30')][_0x9c57('0x19')]);_0xf471de[_0x9c57('0x17')]=qs['offset'](_0x1da4a4[_0x9c57('0x30')]['offset']);}_0xf471de[_0x9c57('0x45')]=qs[_0x9c57('0x46')](_0x1da4a4[_0x9c57('0x30')][_0x9c57('0x46')]);_0xf471de[_0x9c57('0x47')]=qs[_0x9c57('0x42')](_['pick'](_0x1da4a4[_0x9c57('0x30')],_0x43ec90[_0x9c57('0x42')]));_0xf471de[_0x9c57('0x47')][_0x9c57('0x48')]=_0x40a9eb['id'];if(_0x1da4a4['query'][_0x9c57('0x49')]){_0xf471de['where']=_[_0x9c57('0x37')](_0xf471de[_0x9c57('0x47')],{'$or':_[_0x9c57('0x23')](_0xf471de[_0x9c57('0x32')],function(_0xe0961b){var _0x8b8aa5={};_0x8b8aa5[_0xe0961b]={'$like':'%'+_0x1da4a4[_0x9c57('0x30')][_0x9c57('0x49')]+'%'};return _0x8b8aa5;})});}if(_0x1da4a4[_0x9c57('0x30')][_0x9c57('0x4a')]){var _0x363dac=_0x1da4a4[_0x9c57('0x30')]['$gte'][_0x9c57('0x4b')](',');var _0x523c55={};_0x523c55[_0x363dac[0x0]]={'$gte':moment(_0x363dac[0x1])[_0x9c57('0x4c')](_0x9c57('0x4d'))};_0xf471de[_0x9c57('0x47')]=_[_0x9c57('0x37')](_0xf471de['where'],_0x523c55);}_0xf471de=_[_0x9c57('0x37')]({},_0xf471de,_0x1da4a4[_0x9c57('0x4e')]);return db[_0x9c57('0x3e')][_0x9c57('0x1a')]({'where':_0xf471de[_0x9c57('0x47')]})['then'](function(_0x2c0211){_0x1dfb7d[_0x9c57('0x1a')]=_0x2c0211;if(_0x1da4a4[_0x9c57('0x30')][_0x9c57('0x35')]){_0xf471de[_0x9c57('0x36')]=[{'all':!![]}];}return db[_0x9c57('0x3e')][_0x9c57('0x2a')](_0xf471de);})[_0x9c57('0x1d')](function(_0x3c68bb){if(_0x1da4a4[_0x9c57('0x30')][_0x9c57('0x4f')]===_0x9c57('0x50')){for(var _0xbd63a2=0x0;_0xbd63a2<_0x3c68bb['length'];_0xbd63a2++){_0x3c68bb[_0xbd63a2]['body']=juice(_0x3c68bb[_0xbd63a2][_0x9c57('0x3a')]);}}_0x1dfb7d['rows']=_0x3c68bb;return _0x1dfb7d;});}})[_0x9c57('0x1d')](respondWithFilteredResult(_0x5e5a50,_0xf471de))[_0x9c57('0x2b')](handleError(_0x5e5a50,null));};exports['addTags']=function(_0x44ffcd,_0x7728f6){return db[_0x9c57('0x24')][_0x9c57('0x38')]({'where':{'id':_0x44ffcd[_0x9c57('0x2d')]['id']}})['then'](handleEntityNotFound(_0x7728f6,null))[_0x9c57('0x1d')](function(_0x727fbf){if(_0x727fbf){return _0x727fbf[_0x9c57('0x51')](_0x44ffcd[_0x9c57('0x3a')][_0x9c57('0x3f')],_[_0x9c57('0x40')](_0x44ffcd['body'],[_0x9c57('0x3f'),'id'])||{})['spread'](function(){return db['Tag'][_0x9c57('0x2a')]({'attributes':['id',_0x9c57('0x21'),_0x9c57('0x52')],'where':{'id':_0x44ffcd[_0x9c57('0x3a')][_0x9c57('0x3f')]}});})[_0x9c57('0x1d')](function(_0x40df54){socket[_0x9c57('0x53')](_0x9c57('0x54'),{'id':Number(_0x44ffcd['params']['id']),'tags':_0x40df54||[]});return{'id':Number(_0x44ffcd['params']['id']),'tags':_0x40df54||[]};});}})[_0x9c57('0x1d')](respondWithResult(_0x7728f6,null))[_0x9c57('0x2b')](handleError(_0x7728f6,null));};exports[_0x9c57('0x55')]=function(_0x1e2e7e,_0x2a16a3){return db[_0x9c57('0x24')][_0x9c57('0x38')]({'where':{'id':_0x1e2e7e[_0x9c57('0x2d')]['id']}})[_0x9c57('0x1d')](handleEntityNotFound(_0x2a16a3,null))['then'](function(_0x21cf5b){if(_0x21cf5b){return _0x21cf5b[_0x9c57('0x55')](_0x1e2e7e[_0x9c57('0x30')][_0x9c57('0x3f')]);}})['then'](respondWithStatusCode(_0x2a16a3,null))['catch'](handleError(_0x2a16a3,null));};exports[_0x9c57('0x56')]=function(_0x55f14d,_0x5a343a){var _0x33ffe6=moment()['unix']()[_0x9c57('0x57')]();var _0x593e4d=path['join'](config[_0x9c57('0x58')],_0x9c57('0x59'),_0x9c57('0x5a'),_0x9c57('0x5b'));var _0x21ca5e=path['join'](config['root'],_0x9c57('0x59'),'files',_0x9c57('0x5c'));var _0x3c17c1=path[_0x9c57('0x5d')](_0x593e4d,_0x33ffe6);var _0x19cf5c=util[_0x9c57('0x4c')](_0x9c57('0x5e'),_0x55f14d[_0x9c57('0x2d')]['id'],_0x33ffe6);var _0x2726c0=path[_0x9c57('0x5d')](_0x593e4d,_0x19cf5c);var _0xb0c627=[];if(_0x55f14d[_0x9c57('0x30')][_0x9c57('0x5c')]){_0xb0c627[_0x9c57('0x5f')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4a992f=[{'model':db[_0x9c57('0x3e')],'as':_0x9c57('0x60'),'attributes':['id',_0x9c57('0x3a'),'from','to','cc',_0x9c57('0x61'),_0x9c57('0x62'),_0x9c57('0x63')],'where':{'secret':![]},'order':qs[_0x9c57('0x46')]('id'),'include':_0xb0c627}];return db[_0x9c57('0x24')]['find']({'where':{'id':_0x55f14d[_0x9c57('0x2d')]['id']},'include':_0x4a992f})['then'](handleEntityNotFound(_0x5a343a,null))[_0x9c57('0x1d')](function(_0x2b944a){if(_0x2b944a&&_0x2b944a[_0x9c57('0x60')]){var _0xcae1b3=_0x2b944a['get']({'plain':!![]});fs[_0x9c57('0x64')](_0x3c17c1);return BPromise['each'](_0xcae1b3['Messages'],function(_0x3bf288,_0xf1b362){var _0x1f3252={'from':_0x3bf288[_0x9c57('0x65')],'to':_0x3bf288['to']||_0x9c57('0x66'),'subject':_0x3bf288[_0x9c57('0x62')],'html':htmlEntities[_0x9c57('0x67')](_0x3bf288['body']),'headers':{'Date':moment(_0x3bf288[_0x9c57('0x63')])[_0x9c57('0x4c')](_0x9c57('0x68'))},'attachments':[]};if(_0x3bf288['cc']){_0x1f3252[_0x9c57('0x69')]['Cc']=_0x3bf288['cc'];}if(_0x3bf288[_0x9c57('0x61')]){_0x1f3252[_0x9c57('0x69')]['Bcc']=_0x3bf288[_0x9c57('0x61')];}return new BPromise(function(_0x3f770a,_0x34ebab){if(_0x3bf288[_0x9c57('0x6a')]){for(var _0x5b37a6=0x0;_0x5b37a6<_0x3bf288[_0x9c57('0x6a')][_0x9c57('0x34')];_0x5b37a6++){var _0x3654e9=_0x3bf288[_0x9c57('0x6a')][_0x5b37a6];var _0x31ab0e=path['join'](_0x21ca5e,_0x3654e9[_0x9c57('0x6b')]);if(fs[_0x9c57('0x6c')](_0x31ab0e)){_0x1f3252[_0x9c57('0x5c')][_0x9c57('0x5f')]({'name':_0x3654e9['name'],'contentType':_0x3654e9[_0x9c57('0x27')],'data':fs[_0x9c57('0x6d')](_0x31ab0e)});}}}emlformat[_0x9c57('0x6e')](_0x1f3252,function(_0x113db7,_0x5bb934){if(_0x113db7)return _0x34ebab(_0x113db7);fs[_0x9c57('0x6f')](path['join'](_0x3c17c1,util['format']('message%d.eml',_0xf1b362)),_0x5bb934);return _0x3f770a(_0x5bb934);});});})[_0x9c57('0x1d')](function(){return new BPromise(function(_0x4499f4,_0x50547f){zipdir(_0x3c17c1,{'saveTo':_0x2726c0},function(_0x1ba565,_0x45cceb){if(_0x1ba565)return _0x50547f(_0x1ba565);return _0x4499f4(_0x45cceb);});})['then'](function(){return new BPromise(function(_0x498f5d,_0x43de76){rimraf(_0x3c17c1,function(_0x2dfd9d){if(_0x2dfd9d)_0x43de76(_0x2dfd9d);return _0x498f5d();});});})['then'](function(){return _0x5a343a[_0x9c57('0x56')](_0x2726c0,_0x19cf5c,function(_0x293517){if(!_0x293517)fs['unlinkSync'](_0x2726c0);});});});}else{return _0x5a343a[_0x9c57('0x1e')](0xc8);}})[_0x9c57('0x2b')](handleError(_0x5a343a,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a5e004f..5593c8b 100644 --- a/server/api/mailInteraction/mailInteraction.events.js +++ b/server/api/mailInteraction/mailInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd36c=['Users','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','MailInteraction','../../mysqldb','MailMessage','save','update','remove','getUsers','then','setDataValue'];(function(_0x58c608,_0x16f6df){var _0x4fb8aa=function(_0xcc6b8d){while(--_0xcc6b8d){_0x58c608['push'](_0x58c608['shift']());}};_0x4fb8aa(++_0x16f6df);}(_0xd36c,0x197));var _0xcd36=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd36c[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xcd36('0x0')];var MailMessage=require(_0xcd36('0x1'))['db'][_0xcd36('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd36('0x3'),'afterUpdate':_0xcd36('0x4'),'afterDestroy':_0xcd36('0x5')};function emitEvent(_0x553a69){return function(_0x35aac3,_0x1203c8,_0x1cb53a){_0x35aac3[_0xcd36('0x6')]({'attributes':['id'],'raw':!![]})[_0xcd36('0x7')](function(_0x3ed5b3){_0x35aac3[_0xcd36('0x8')](_0xcd36('0x9'),_0x3ed5b3['map'](function(_0x39f18c){return{'id':_0x39f18c['id']};}));return MailMessage[_0xcd36('0xa')]({'where':{'MailInteractionId':_0x35aac3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x42b55c){_0x35aac3[_0xcd36('0x8')](_0xcd36('0xb'),_0x42b55c['length']);MailInteractionEvents[_0xcd36('0xc')](_0x553a69+':'+_0x35aac3['id'],_0x35aac3);MailInteractionEvents['emit'](_0x553a69,_0x35aac3);_0x1cb53a(null);})[_0xcd36('0xd')](_0x1cb53a(null));};}for(var e in events){if(events[_0xcd36('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xcd36('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xe980=['then','setDataValue','map','unreadMessages','length','emit','catch','exports','events','../../mysqldb','MailInteraction','MailMessage','save','update','getUsers'];(function(_0x23eb7d,_0x371683){var _0x50d16d=function(_0x3b7ce5){while(--_0x3b7ce5){_0x23eb7d['push'](_0x23eb7d['shift']());}};_0x50d16d(++_0x371683);}(_0xe980,0x152));var _0x0e98=function(_0xaf0675,_0x1ee2ff){_0xaf0675=_0xaf0675-0x0;var _0x4f62e0=_0xe980[_0xaf0675];return _0x4f62e0;};'use strict';var EventEmitter=require(_0x0e98('0x0'));var MailInteraction=require(_0x0e98('0x1'))['db'][_0x0e98('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x0e98('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e98('0x4'),'afterUpdate':_0x0e98('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5ec306){return function(_0x1641ac,_0x55dff7,_0x53733b){_0x1641ac[_0x0e98('0x6')]({'attributes':['id'],'raw':!![]})[_0x0e98('0x7')](function(_0x6962d4){_0x1641ac[_0x0e98('0x8')]('Users',_0x6962d4[_0x0e98('0x9')](function(_0x4a95b6){return{'id':_0x4a95b6['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1641ac['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5a7fc3){_0x1641ac[_0x0e98('0x8')](_0x0e98('0xa'),_0x5a7fc3[_0x0e98('0xb')]);MailInteractionEvents[_0x0e98('0xc')](_0x5ec306+':'+_0x1641ac['id'],_0x1641ac);MailInteractionEvents[_0x0e98('0xc')](_0x5ec306,_0x1641ac);_0x53733b(null);})[_0x0e98('0xd')](_0x53733b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x0e98('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 7fe7290..4285610 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd663=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','substatus','substatusAt','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x27f9b2,_0x18b6e8){var _0x31c487=function(_0x547716){while(--_0x547716){_0x27f9b2['push'](_0x27f9b2['shift']());}};_0x31c487(++_0x18b6e8);}(_0xd663,0x1ed));var _0x3d66=function(_0x4ccff2,_0x584183){_0x4ccff2=_0x4ccff2-0x0;var _0x43b41a=_0xd663[_0x4ccff2];return _0x43b41a;};'use strict';var _=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var logger=require(_0x3d66('0x2'))(_0x3d66('0x3'));var moment=require('moment');var BPromise=require(_0x3d66('0x4'));var rp=require(_0x3d66('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d66('0x6'));var config=require(_0x3d66('0x7'));var attributes=require(_0x3d66('0x8'));module[_0x3d66('0x9')]=function(_0x4f8af3,_0x332f00){return _0x4f8af3[_0x3d66('0xa')](_0x3d66('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x3d66('0xc'),'to'],'type':_0x3d66('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x13ee1a,_0x5c27cc,_0x41f912){if(_0x13ee1a[_0x3d66('0xe')]){_0x13ee1a[_0x3d66('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x13ee1a[_0x3d66('0x10')]){_0x13ee1a[_0x3d66('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x41f912(null,_0x5c27cc);},'beforeUpdate':function(_0x2bd751,_0x20d859,_0x4740ed){if(_0x2bd751['changed'](_0x3d66('0xe'))){_0x2bd751[_0x3d66('0xf')]=_0x2bd751['substatus']?moment()[_0x3d66('0x12')](_0x3d66('0x13')):null;}if(_0x2bd751[_0x3d66('0x14')](_0x3d66('0x10'))){_0x2bd751['closedAt']=moment()[_0x3d66('0x12')](_0x3d66('0x13'));_0x2bd751[_0x3d66('0xe')]=null;_0x2bd751['substatusAt']=null;}_0x4740ed(null,_0x2bd751);},'afterUpdate':function(_0x519700,_0x4909d3,_0x1d250a){var _0x14917e=_0x4f8af3['models'];var _0x3ce550=_0x519700[_0x3d66('0x15')]({'plain':!![]});if(_0x3ce550[_0x3d66('0x10')]){return _0x14917e[_0x3d66('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3ce550['id']}})[_0x3d66('0x17')](function(){_0x1d250a();})['catch'](function(_0x7d83e5){_0x1d250a(_0x7d83e5);});}else{_0x1d250a();}}},'charset':_0x3d66('0x18'),'collate':_0x3d66('0x19')});}; \ No newline at end of file +var _0x0b50=['format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','substatus','substatusAt'];(function(_0xbac4eb,_0x1f9014){var _0x112e23=function(_0x2cef3e){while(--_0x2cef3e){_0xbac4eb['push'](_0xbac4eb['shift']());}};_0x112e23(++_0x1f9014);}(_0x0b50,0x13f));var _0x00b5=function(_0x4b8968,_0x5c9b44){_0x4b8968=_0x4b8968-0x0;var _0x3a0ab7=_0x0b50[_0x4b8968];return _0x3a0ab7;};'use strict';var _=require('lodash');var util=require(_0x00b5('0x0'));var logger=require(_0x00b5('0x1'))(_0x00b5('0x2'));var moment=require(_0x00b5('0x3'));var BPromise=require(_0x00b5('0x4'));var rp=require(_0x00b5('0x5'));var fs=require('fs');var path=require(_0x00b5('0x6'));var rimraf=require(_0x00b5('0x7'));var config=require(_0x00b5('0x8'));var attributes=require(_0x00b5('0x9'));module[_0x00b5('0xa')]=function(_0x24e15d,_0x5cf55c){return _0x24e15d[_0x00b5('0xb')](_0x00b5('0xc'),attributes,{'tableName':_0x00b5('0xd'),'paranoid':![],'indexes':[{'name':_0x00b5('0xe'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4c3d45,_0x582ee1,_0x12413a){if(_0x4c3d45[_0x00b5('0xf')]){_0x4c3d45[_0x00b5('0x10')]=moment()[_0x00b5('0x11')](_0x00b5('0x12'));}if(_0x4c3d45[_0x00b5('0x13')]){_0x4c3d45['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x12413a(null,_0x582ee1);},'beforeUpdate':function(_0x4956c1,_0xc2bd94,_0x4bde7c){if(_0x4956c1['changed'](_0x00b5('0xf'))){_0x4956c1[_0x00b5('0x10')]=_0x4956c1['substatus']?moment()[_0x00b5('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4956c1['changed'](_0x00b5('0x13'))){_0x4956c1[_0x00b5('0x14')]=moment()['format'](_0x00b5('0x12'));_0x4956c1[_0x00b5('0xf')]=null;_0x4956c1[_0x00b5('0x10')]=null;}_0x4bde7c(null,_0x4956c1);},'afterUpdate':function(_0x4fd5c9,_0x28866c,_0x4674b7){var _0x2eceea=_0x24e15d[_0x00b5('0x15')];var _0x5caf07=_0x4fd5c9[_0x00b5('0x16')]({'plain':!![]});if(_0x5caf07[_0x00b5('0x13')]){return _0x2eceea[_0x00b5('0x17')][_0x00b5('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x5caf07['id']}})[_0x00b5('0x19')](function(){_0x4674b7();})['catch'](function(_0x58aedb){_0x4674b7(_0x58aedb);});}else{_0x4674b7();}}},'charset':_0x00b5('0x1a'),'collate':_0x00b5('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 502f565..917f30f 100644 --- a/server/api/mailInteraction/mailInteraction.rpc.js +++ b/server/api/mailInteraction/mailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2d0=['message','info','MailInteraction','update','body','options','raw','where','limit','then','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','ids','omit','AddTags','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x491df5,_0xdde8ca){var _0xb9cf5d=function(_0x4ea793){while(--_0x4ea793){_0x491df5['push'](_0x491df5['shift']());}};_0xb9cf5d(++_0xdde8ca);}(_0xd2d0,0x80));var _0x0d2d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd2d0[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0d2d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d2d('0x1'));var db=require(_0x0d2d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d2d('0x3'))(_0x0d2d('0x4'));var config=require(_0x0d2d('0x5'));var jayson=require(_0x0d2d('0x6'));var client=jayson[_0x0d2d('0x7')]['http']({'port':0x232a});config[_0x0d2d('0x8')]=_[_0x0d2d('0x9')](config['redis'],{'host':_0x0d2d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d2d('0x8')]));require(_0x0d2d('0xb'))[_0x0d2d('0xc')](socket);function respondWithRpcPromise(_0x459390,_0x41c4cf,_0x343c14){return new BPromise(function(_0x336dd4,_0x7dcc5e){return client[_0x0d2d('0xd')](_0x459390,_0x343c14)['then'](function(_0x54d451){logger['info'](_0x0d2d('0xe'),_0x41c4cf,_0x0d2d('0xf'));logger[_0x0d2d('0x10')](_0x0d2d('0x11'),_0x41c4cf,_0x0d2d('0xf'),JSON[_0x0d2d('0x12')](_0x54d451));if(_0x54d451[_0x0d2d('0x13')]){if(_0x54d451['error']['code']===0x1f4){logger[_0x0d2d('0x13')](_0x0d2d('0xe'),_0x41c4cf,_0x54d451[_0x0d2d('0x13')][_0x0d2d('0x14')]);return _0x7dcc5e(_0x54d451['error'][_0x0d2d('0x14')]);}logger['error'](_0x0d2d('0xe'),_0x41c4cf,_0x54d451[_0x0d2d('0x13')][_0x0d2d('0x14')]);return _0x336dd4(_0x54d451[_0x0d2d('0x13')][_0x0d2d('0x14')]);}else{logger[_0x0d2d('0x15')](_0x0d2d('0xe'),_0x41c4cf,_0x0d2d('0xf'));_0x336dd4(_0x54d451['result']['message']);}})['catch'](function(_0x2ab016){logger[_0x0d2d('0x13')]('MailInteraction,\x20%s,\x20%s',_0x41c4cf,_0x2ab016);_0x7dcc5e(_0x2ab016);});});}exports['UpdateMailInteraction']=function(_0x1bc278){var _0x3ad219=this;return new Promise(function(_0x516978,_0x320cc8){return db[_0x0d2d('0x16')][_0x0d2d('0x17')](_0x1bc278[_0x0d2d('0x18')],{'raw':_0x1bc278[_0x0d2d('0x19')]?_0x1bc278[_0x0d2d('0x19')][_0x0d2d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bc278[_0x0d2d('0x19')]?_0x1bc278[_0x0d2d('0x19')][_0x0d2d('0x1b')]||null:null,'attributes':_0x1bc278[_0x0d2d('0x19')]?_0x1bc278[_0x0d2d('0x19')]['attributes']||null:null,'limit':_0x1bc278[_0x0d2d('0x19')]?_0x1bc278[_0x0d2d('0x19')][_0x0d2d('0x1c')]||null:null})[_0x0d2d('0x1d')](function(_0x335caf){logger['info'](_0x0d2d('0x1e'),_0x1bc278);logger[_0x0d2d('0x10')](_0x0d2d('0x1e'),_0x1bc278,JSON[_0x0d2d('0x12')](_0x335caf));_0x516978(_0x335caf);})[_0x0d2d('0x1f')](function(_0xf09fd4){logger[_0x0d2d('0x13')](_0x0d2d('0x1e'),_0xf09fd4[_0x0d2d('0x14')],_0x1bc278);_0x320cc8(_0x3ad219['error'](0x1f4,_0xf09fd4[_0x0d2d('0x14')]));});});};exports[_0x0d2d('0x20')]=function(_0x40e574){return new Promise(function(_0x28185c,_0x8788e0){return db[_0x0d2d('0x16')][_0x0d2d('0x21')]({'where':_0x40e574[_0x0d2d('0x19')]?_0x40e574[_0x0d2d('0x19')]['where']||null:null})['then'](function(_0xd3e526){if(_0xd3e526){return _0xd3e526['addTags'](_0x40e574[_0x0d2d('0x18')][_0x0d2d('0x22')],_[_0x0d2d('0x23')](_0x40e574[_0x0d2d('0x18')],[_0x0d2d('0x22'),'id'])||{});}})['spread'](function(_0x22acc7){logger[_0x0d2d('0x15')](_0x0d2d('0x24'),_0x40e574);logger[_0x0d2d('0x10')](_0x0d2d('0x24'),_0x40e574,JSON[_0x0d2d('0x12')](_0x22acc7));_0x28185c(_0x22acc7);})['catch'](function(_0x1a5105){logger[_0x0d2d('0x13')](_0x0d2d('0x24'),_0x1a5105[_0x0d2d('0x14')],_0x40e574);_0x8788e0(_this[_0x0d2d('0x13')](0x1f4,_0x1a5105[_0x0d2d('0x14')]));});});}; \ No newline at end of file +var _0x4cb5=['update','options','raw','where','limit','then','AddTagsToMailInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4cb5,0x8f));var _0x54cb=function(_0x1f0791,_0x4a84e5){_0x1f0791=_0x1f0791-0x0;var _0x1bec5c=_0x4cb5[_0x1f0791];return _0x1bec5c;};'use strict';var _=require(_0x54cb('0x0'));var util=require(_0x54cb('0x1'));var moment=require(_0x54cb('0x2'));var BPromise=require(_0x54cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54cb('0x4'));var db=require(_0x54cb('0x5'))['db'];var utils=require(_0x54cb('0x6'));var logger=require(_0x54cb('0x7'))(_0x54cb('0x8'));var config=require(_0x54cb('0x9'));var jayson=require(_0x54cb('0xa'));var client=jayson['client'][_0x54cb('0xb')]({'port':0x232a});config[_0x54cb('0xc')]=_['defaults'](config[_0x54cb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x54cb('0xd'))(new Redis(config[_0x54cb('0xc')]));require(_0x54cb('0xe'))[_0x54cb('0xf')](socket);function respondWithRpcPromise(_0x42e677,_0x305358,_0x55a794){return new BPromise(function(_0x57bd86,_0x931085){return client[_0x54cb('0x10')](_0x42e677,_0x55a794)['then'](function(_0x2f5730){logger[_0x54cb('0x11')](_0x54cb('0x12'),_0x305358,_0x54cb('0x13'));logger[_0x54cb('0x14')](_0x54cb('0x15'),_0x305358,'request\x20sent',JSON[_0x54cb('0x16')](_0x2f5730));if(_0x2f5730[_0x54cb('0x17')]){if(_0x2f5730[_0x54cb('0x17')][_0x54cb('0x18')]===0x1f4){logger[_0x54cb('0x17')](_0x54cb('0x12'),_0x305358,_0x2f5730['error'][_0x54cb('0x19')]);return _0x931085(_0x2f5730[_0x54cb('0x17')][_0x54cb('0x19')]);}logger[_0x54cb('0x17')](_0x54cb('0x12'),_0x305358,_0x2f5730['error'][_0x54cb('0x19')]);return _0x57bd86(_0x2f5730[_0x54cb('0x17')][_0x54cb('0x19')]);}else{logger[_0x54cb('0x11')](_0x54cb('0x12'),_0x305358,'request\x20sent');_0x57bd86(_0x2f5730['result'][_0x54cb('0x19')]);}})[_0x54cb('0x1a')](function(_0x1f5130){logger[_0x54cb('0x17')](_0x54cb('0x12'),_0x305358,_0x1f5130);_0x931085(_0x1f5130);});});}exports[_0x54cb('0x1b')]=function(_0xd6534a){var _0x27eb97=this;return new Promise(function(_0x52f046,_0x4d3c9a){return db[_0x54cb('0x1c')][_0x54cb('0x1d')](_0xd6534a['body'],{'raw':_0xd6534a[_0x54cb('0x1e')]?_0xd6534a[_0x54cb('0x1e')][_0x54cb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd6534a[_0x54cb('0x1e')]?_0xd6534a[_0x54cb('0x1e')][_0x54cb('0x20')]||null:null,'attributes':_0xd6534a[_0x54cb('0x1e')]?_0xd6534a['options']['attributes']||null:null,'limit':_0xd6534a[_0x54cb('0x1e')]?_0xd6534a[_0x54cb('0x1e')][_0x54cb('0x21')]||null:null})[_0x54cb('0x22')](function(_0x493ce6){logger[_0x54cb('0x11')](_0x54cb('0x1b'),_0xd6534a);logger[_0x54cb('0x14')](_0x54cb('0x1b'),_0xd6534a,JSON[_0x54cb('0x16')](_0x493ce6));_0x52f046(_0x493ce6);})[_0x54cb('0x1a')](function(_0x5f3cf1){logger['error']('UpdateMailInteraction',_0x5f3cf1[_0x54cb('0x19')],_0xd6534a);_0x4d3c9a(_0x27eb97[_0x54cb('0x17')](0x1f4,_0x5f3cf1[_0x54cb('0x19')]));});});};exports[_0x54cb('0x23')]=function(_0x47cb30){return new Promise(function(_0x463fd3,_0x2df471){return db['MailInteraction'][_0x54cb('0x24')]({'where':_0x47cb30[_0x54cb('0x1e')]?_0x47cb30[_0x54cb('0x1e')][_0x54cb('0x20')]||null:null})[_0x54cb('0x22')](function(_0x3bb658){if(_0x3bb658){return _0x3bb658[_0x54cb('0x25')](_0x47cb30['body'][_0x54cb('0x26')],_[_0x54cb('0x27')](_0x47cb30[_0x54cb('0x28')],['ids','id'])||{});}})[_0x54cb('0x29')](function(_0x5352b2){logger[_0x54cb('0x11')](_0x54cb('0x2a'),_0x47cb30);logger['debug']('AddTags',_0x47cb30,JSON[_0x54cb('0x16')](_0x5352b2));_0x463fd3(_0x5352b2);})[_0x54cb('0x1a')](function(_0x52eef5){logger['error'](_0x54cb('0x2a'),_0x52eef5[_0x54cb('0x19')],_0x47cb30);_0x2df471(_this[_0x54cb('0x17')](0x1f4,_0x52eef5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index eb76a1e..0bcbd8f 100644 --- a/server/api/mailInteraction/mailInteraction.socket.js +++ b/server/api/mailInteraction/mailInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa858=['register','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x4ec911,_0x3534a0){var _0x13ab51=function(_0x3ced5c){while(--_0x3ced5c){_0x4ec911['push'](_0x4ec911['shift']());}};_0x13ab51(++_0x3534a0);}(_0xa858,0x162));var _0x8a85=function(_0x2494c7,_0x4d7950){_0x2494c7=_0x2494c7-0x0;var _0x7cf711=_0xa858[_0x2494c7];return _0x7cf711;};'use strict';var MailInteractionEvents=require(_0x8a85('0x0'));var events=[_0x8a85('0x1'),_0x8a85('0x2'),_0x8a85('0x3')];function createListener(_0x23414d,_0x47b8fe){return function(_0x54b3d4){_0x47b8fe[_0x8a85('0x4')](_0x23414d,_0x54b3d4);};}function removeListener(_0x27fd22,_0x9c53c){return function(){MailInteractionEvents[_0x8a85('0x5')](_0x27fd22,_0x9c53c);};}exports[_0x8a85('0x6')]=function(_0x3f524d){for(var _0x178bbd=0x0,_0x14a07a=events['length'];_0x178bbd<_0x14a07a;_0x178bbd++){var _0x5bc2ef=events[_0x178bbd];var _0x509de4=createListener(_0x8a85('0x7')+_0x5bc2ef,_0x3f524d);MailInteractionEvents['on'](_0x5bc2ef,_0x509de4);}}; \ No newline at end of file +var _0x4f67=['update','emit','removeListener','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x1b0010,_0x318cd2){var _0x1e607f=function(_0x1a7d5b){while(--_0x1a7d5b){_0x1b0010['push'](_0x1b0010['shift']());}};_0x1e607f(++_0x318cd2);}(_0x4f67,0x1e5));var _0x74f6=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x4f67[_0x120bc2];return _0x454a41;};'use strict';var MailInteractionEvents=require(_0x74f6('0x0'));var events=[_0x74f6('0x1'),_0x74f6('0x2'),_0x74f6('0x3')];function createListener(_0x2fc961,_0x382626){return function(_0x2cebf1){_0x382626[_0x74f6('0x4')](_0x2fc961,_0x2cebf1);};}function removeListener(_0x5e8abd,_0xdf1593){return function(){MailInteractionEvents[_0x74f6('0x5')](_0x5e8abd,_0xdf1593);};}exports['register']=function(_0x506ee1){for(var _0x5d5741=0x0,_0x4f6619=events[_0x74f6('0x6')];_0x5d5741<_0x4f6619;_0x5d5741++){var _0x208123=events[_0x5d5741];var _0x273db9=createListener(_0x74f6('0x7')+_0x208123,_0x506ee1);MailInteractionEvents['on'](_0x208123,_0x273db9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c8e8d0c..d408dcc 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92ba=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete'];(function(_0x519d33,_0xb10c7a){var _0x20d204=function(_0x23c269){while(--_0x23c269){_0x519d33['push'](_0x519d33['shift']());}};_0x20d204(++_0xb10c7a);}(_0x92ba,0x17c));var _0xa92b=function(_0x406ede,_0x52d0d4){_0x406ede=_0x406ede-0x0;var _0x448f44=_0x92ba[_0x406ede];return _0x448f44;};'use strict';var multer=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var path=require('path');var timeout=require(_0xa92b('0x2'));var express=require(_0xa92b('0x3'));var router=express[_0xa92b('0x4')]();var fs_extra=require(_0xa92b('0x5'));var auth=require(_0xa92b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa92b('0x7'));var controller=require(_0xa92b('0x8'));router[_0xa92b('0x9')]('/',auth[_0xa92b('0xa')](),controller['index']);router[_0xa92b('0x9')](_0xa92b('0xb'),auth['isAuthenticated'](),controller[_0xa92b('0xc')]);router[_0xa92b('0x9')](_0xa92b('0xd'),auth[_0xa92b('0xa')](),controller[_0xa92b('0xe')]);router[_0xa92b('0x9')](_0xa92b('0xf'),auth['isAuthenticated'](),controller[_0xa92b('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0xa92b('0x11')),controller[_0xa92b('0x12')]);router[_0xa92b('0x13')](_0xa92b('0xd'),auth[_0xa92b('0xa')](),controller[_0xa92b('0x14')]);router[_0xa92b('0x13')](_0xa92b('0x15'),auth[_0xa92b('0xa')](),controller['accept']);router[_0xa92b('0x13')](_0xa92b('0x16'),auth[_0xa92b('0xa')](),controller[_0xa92b('0x17')]);router[_0xa92b('0x18')](_0xa92b('0xd'),auth[_0xa92b('0xa')](),controller[_0xa92b('0x19')]);module[_0xa92b('0x1a')]=router; \ No newline at end of file +var _0xbdeb=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','/:id/download','download','post','tracked','mail','put','/:id/accept','accept','/:id/reject','delete','/:id','exports','util','connect-timeout','Router','fs-extra'];(function(_0x4a6fec,_0xc3697f){var _0x3cf303=function(_0x334df3){while(--_0x334df3){_0x4a6fec['push'](_0x4a6fec['shift']());}};_0x3cf303(++_0xc3697f);}(_0xbdeb,0x6f));var _0xbbde=function(_0x479b02,_0x39f476){_0x479b02=_0x479b02-0x0;var _0xae26b8=_0xbdeb[_0x479b02];return _0xae26b8;};'use strict';var multer=require('multer');var util=require(_0xbbde('0x0'));var path=require('path');var timeout=require(_0xbbde('0x1'));var express=require('express');var router=express[_0xbbde('0x2')]();var fs_extra=require(_0xbbde('0x3'));var auth=require(_0xbbde('0x4'));var interaction=require(_0xbbde('0x5'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xbbde('0x6')]('/',auth[_0xbbde('0x7')](),controller[_0xbbde('0x8')]);router[_0xbbde('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xbbde('0x9')]);router[_0xbbde('0x6')]('/:id',auth[_0xbbde('0x7')](),controller[_0xbbde('0xa')]);router[_0xbbde('0x6')](_0xbbde('0xb'),auth[_0xbbde('0x7')](),controller[_0xbbde('0xc')]);router[_0xbbde('0xd')]('/',auth[_0xbbde('0x7')](),interaction[_0xbbde('0xe')](_0xbbde('0xf'),'mailmessage:create'),controller['create']);router[_0xbbde('0x10')]('/:id',auth[_0xbbde('0x7')](),controller['update']);router[_0xbbde('0x10')](_0xbbde('0x11'),auth[_0xbbde('0x7')](),controller[_0xbbde('0x12')]);router[_0xbbde('0x10')](_0xbbde('0x13'),auth[_0xbbde('0x7')](),controller['reject']);router[_0xbbde('0x14')](_0xbbde('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0xbbde('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 3e23dc7..6700d7c 100644 --- a/server/api/mailMessage/mailMessage.attributes.js +++ b/server/api/mailMessage/mailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x739b=['out','STRING','DATE','INTEGER','Chat','Email','sequelize','exports','TEXT','long','BOOLEAN','ENUM'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x739b,0x96));var _0xb739=function(_0x4b6d72,_0x15a92a){_0x4b6d72=_0x4b6d72-0x0;var _0x28eeed=_0x739b[_0x4b6d72];return _0x28eeed;};'use strict';var Sequelize=require(_0xb739('0x0'));var _=require('lodash');module[_0xb739('0x1')]={'body':{'type':Sequelize[_0xb739('0x2')](_0xb739('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0xb739('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb739('0x5')]('in',_0xb739('0x6')),'defaultValue':_0xb739('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb739('0x7')](0x1fe)},'from':{'type':Sequelize[_0xb739('0x7')]},'to':{'type':Sequelize[_0xb739('0x2')](_0xb739('0x3'))},'cc':{'type':Sequelize[_0xb739('0x2')](_0xb739('0x3'))},'bcc':{'type':Sequelize[_0xb739('0x2')](_0xb739('0x3'))},'subject':{'type':Sequelize[_0xb739('0x2')]},'sentAt':{'type':Sequelize[_0xb739('0x8')]},'attach':{'type':Sequelize[_0xb739('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb739('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xb739('0x2')](_0xb739('0x3'))},'originCc':{'type':Sequelize[_0xb739('0x2')](_0xb739('0x3'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0xb739('0xa')),'defaultValue':_0xb739('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x1cd6=['TEXT','long','medium','out','STRING','DATE','INTEGER','BOOLEAN','ENUM','Email','Chat','sequelize','lodash','exports'];(function(_0x51ccac,_0x25f18a){var _0x5ecd7a=function(_0x5c1cb2){while(--_0x5c1cb2){_0x51ccac['push'](_0x51ccac['shift']());}};_0x5ecd7a(++_0x25f18a);}(_0x1cd6,0xdd));var _0x61cd=function(_0x273436,_0x4aee5e){_0x273436=_0x273436-0x0;var _0x39dcb4=_0x1cd6[_0x273436];return _0x39dcb4;};'use strict';var Sequelize=require(_0x61cd('0x0'));var _=require(_0x61cd('0x1'));module[_0x61cd('0x2')]={'body':{'type':Sequelize[_0x61cd('0x3')](_0x61cd('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x61cd('0x3')](_0x61cd('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x61cd('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x61cd('0x7')](0x1fe)},'from':{'type':Sequelize[_0x61cd('0x7')]},'to':{'type':Sequelize[_0x61cd('0x3')](_0x61cd('0x4'))},'cc':{'type':Sequelize[_0x61cd('0x3')](_0x61cd('0x4'))},'bcc':{'type':Sequelize[_0x61cd('0x3')](_0x61cd('0x4'))},'subject':{'type':Sequelize[_0x61cd('0x3')]},'sentAt':{'type':Sequelize[_0x61cd('0x8')]},'attach':{'type':Sequelize[_0x61cd('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x61cd('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x61cd('0x8')]},'originTo':{'type':Sequelize[_0x61cd('0x3')](_0x61cd('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x61cd('0x4'))},'originChannel':{'type':Sequelize[_0x61cd('0xb')](_0x61cd('0xc'),_0x61cd('0xd')),'defaultValue':_0x61cd('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index ce9fdfa..63ac0df 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6462=['where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','params','options','find','update','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','contact','internal','SIP/%s','reject','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','push','writeFileSync','unlinkSync','eml-format','moment','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','html-entities','./mailMessage.socket','register','http','client','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','end','name','send','map','MailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x3d407c,_0x8127b5){var _0x7d17dc=function(_0xe3f088){while(--_0xe3f088){_0x3d407c['push'](_0x3d407c['shift']());}};_0x7d17dc(++_0x8127b5);}(_0x6462,0x69));var _0x2646=function(_0x111cfe,_0x486cdf){_0x111cfe=_0x111cfe-0x0;var _0x336fc9=_0x6462[_0x111cfe];return _0x336fc9;};'use strict';var emlformat=require(_0x2646('0x0'));var moment=require(_0x2646('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x2646('0x2'));var fs=require('fs');var _=require(_0x2646('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x2646('0x4'));var qs=require(_0x2646('0x5'));var logger=require(_0x2646('0x6'))(_0x2646('0x7'));var interaction_log=require('../../config/logger')(_0x2646('0x8'));var config=require(_0x2646('0x9'));var db=require(_0x2646('0xa'))['db'];config[_0x2646('0xb')]=_[_0x2646('0xc')](config[_0x2646('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0x2646('0xd'));require(_0x2646('0xe'))[_0x2646('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2646('0x10')]({'port':0x232c});var client9003=jayson[_0x2646('0x11')][_0x2646('0x10')]({'port':0x232b});var client9002=jayson[_0x2646('0x11')][_0x2646('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x5018b2,_0x1085e3,_0x37ae67,_0x47c6d7){return new BPromise(function(_0x2d1bab,_0x2f4ad2){var _0xd95429=_0x47c6d7||client;return _0xd95429[_0x2646('0x12')](_0x5018b2,_0x37ae67)['then'](function(_0x3bcb9e){logger['info'](_0x2646('0x13'),_0x1085e3,_0x2646('0x14'));logger[_0x2646('0x15')](_0x2646('0x16'),_0x1085e3,'request\x20sent',JSON[_0x2646('0x17')](_0x3bcb9e));if(_0x3bcb9e[_0x2646('0x18')]){if(_0x3bcb9e[_0x2646('0x18')]['code']===0x1f4){logger[_0x2646('0x18')]('MailMessage,\x20%s,\x20%s',_0x1085e3,_0x3bcb9e[_0x2646('0x18')][_0x2646('0x19')]);return _0x2f4ad2(_0x3bcb9e['error']['message']);}logger[_0x2646('0x18')](_0x2646('0x13'),_0x1085e3,_0x3bcb9e[_0x2646('0x18')][_0x2646('0x19')]);return _0x2d1bab(_0x3bcb9e[_0x2646('0x18')][_0x2646('0x19')]);}else{logger['info'](_0x2646('0x13'),_0x1085e3,'request\x20sent');_0x2d1bab(_0x3bcb9e[_0x2646('0x1a')][_0x2646('0x19')]);}})[_0x2646('0x1b')](function(_0x2875ab){logger['error']('MailMessage,\x20%s,\x20%s',_0x1085e3,_0x2875ab);_0x2f4ad2(_0x2875ab);});});}function respondWithResult(_0x145648,_0x47bb6c){_0x47bb6c=_0x47bb6c||0xc8;return function(_0x5f29a7){if(_0x5f29a7){return _0x145648[_0x2646('0x1c')](_0x47bb6c)[_0x2646('0x1d')](_0x5f29a7);}};}function respondWithFilteredResult(_0x346864,_0x328446){return function(_0x19a875){if(_0x19a875){var _0x511820=typeof _0x328446[_0x2646('0x1e')]==='undefined'&&typeof _0x328446[_0x2646('0x1f')]===_0x2646('0x20');var _0x59dc5f=_0x19a875[_0x2646('0x21')];var _0x2a5290=_0x511820?0x0:_0x328446['offset'];var _0x3e5943=_0x511820?_0x19a875[_0x2646('0x21')]:_0x328446['offset']+_0x328446[_0x2646('0x1f')];var _0x37402b;if(_0x3e5943>=_0x59dc5f){_0x3e5943=_0x59dc5f;_0x37402b=0xc8;}else{_0x37402b=0xce;}_0x346864[_0x2646('0x1c')](_0x37402b);return _0x346864[_0x2646('0x22')](_0x2646('0x23'),_0x2a5290+'-'+_0x3e5943+'/'+_0x59dc5f)[_0x2646('0x1d')](_0x19a875);}return null;};}function saveUpdates(_0x1bcac5){return function(_0x5312c6){if(_0x5312c6){return _0x5312c6['update'](_0x1bcac5)[_0x2646('0x24')](function(_0x477079){return _0x477079;});}return null;};}function removeEntity(_0x56c2ca){return function(_0x4569ac){if(_0x4569ac){return _0x4569ac[_0x2646('0x25')]()[_0x2646('0x24')](function(){_0x56c2ca[_0x2646('0x1c')](0xcc)[_0x2646('0x26')]();});}};}function handleEntityNotFound(_0x4b6089){return function(_0x5b328c){if(!_0x5b328c){_0x4b6089['sendStatus'](0x194);}return _0x5b328c;};}function handleError(_0x14ceb8,_0x51e58){_0x51e58=_0x51e58||0x1f4;return function(_0x56f22b){logger[_0x2646('0x18')](_0x56f22b['stack']);if(_0x56f22b[_0x2646('0x27')]){delete _0x56f22b[_0x2646('0x27')];}_0x14ceb8[_0x2646('0x1c')](_0x51e58)[_0x2646('0x28')](_0x56f22b);};}exports['index']=function(_0xdb0953,_0x481e4d){var _0x2f23a6={},_0x20a163={},_0x2ffab5={'count':0x0,'rows':[]};var _0x436cd6=_[_0x2646('0x29')](db[_0x2646('0x2a')][_0x2646('0x2b')],function(_0x506c04){return{'name':_0x506c04[_0x2646('0x2c')],'type':_0x506c04['type'][_0x2646('0x2d')]};});_0x20a163[_0x2646('0x2e')]=_[_0x2646('0x29')](_0x436cd6,_0x2646('0x27'));_0x20a163[_0x2646('0x2f')]=_[_0x2646('0x30')](_0xdb0953[_0x2646('0x2f')]);_0x20a163[_0x2646('0x31')]=_[_0x2646('0x32')](_0x20a163['model'],_0x20a163['query']);_0x2f23a6[_0x2646('0x33')]=_[_0x2646('0x32')](_0x20a163[_0x2646('0x2e')],qs[_0x2646('0x34')](_0xdb0953[_0x2646('0x2f')][_0x2646('0x34')]));_0x2f23a6[_0x2646('0x33')]=_0x2f23a6['attributes'][_0x2646('0x35')]?_0x2f23a6[_0x2646('0x33')]:_0x20a163[_0x2646('0x2e')];if(!_0xdb0953[_0x2646('0x2f')][_0x2646('0x36')](_0x2646('0x37'))){_0x2f23a6[_0x2646('0x1f')]=qs[_0x2646('0x1f')](_0xdb0953[_0x2646('0x2f')][_0x2646('0x1f')]);_0x2f23a6[_0x2646('0x1e')]=qs['offset'](_0xdb0953[_0x2646('0x2f')][_0x2646('0x1e')]);}_0x2f23a6['order']=qs[_0x2646('0x38')](_0xdb0953[_0x2646('0x2f')][_0x2646('0x38')]);_0x2f23a6[_0x2646('0x39')]=qs[_0x2646('0x31')](_[_0x2646('0x3a')](_0xdb0953[_0x2646('0x2f')],_0x20a163[_0x2646('0x31')]),_0x436cd6);if(_0xdb0953[_0x2646('0x2f')][_0x2646('0x3b')]){_0x2f23a6[_0x2646('0x39')]=_['merge'](_0x2f23a6['where'],{'$or':_['map'](_0x436cd6,function(_0x401fdc){if(_0x401fdc[_0x2646('0x3c')]!==_0x2646('0x3d')){var _0x198e8e={};_0x198e8e[_0x401fdc[_0x2646('0x27')]]={'$like':'%'+_0xdb0953[_0x2646('0x2f')][_0x2646('0x3b')]+'%'};return _0x198e8e;}})});}_0x2f23a6=_[_0x2646('0x3e')]({},_0x2f23a6,_0xdb0953['options']);var _0x1d2da4={'where':_0x2f23a6[_0x2646('0x39')]};return db['MailMessage']['count'](_0x1d2da4)[_0x2646('0x24')](function(_0x43ae29){_0x2ffab5[_0x2646('0x21')]=_0x43ae29;if(_0xdb0953[_0x2646('0x2f')][_0x2646('0x3f')]){_0x2f23a6[_0x2646('0x40')]=[{'all':!![]}];}return db['MailMessage'][_0x2646('0x41')](_0x2f23a6);})['then'](function(_0x24003a){_0x2ffab5[_0x2646('0x42')]=_0x24003a;return _0x2ffab5;})[_0x2646('0x24')](respondWithFilteredResult(_0x481e4d,_0x2f23a6))[_0x2646('0x1b')](handleError(_0x481e4d,null));};exports['show']=function(_0x101162,_0x44c6ad){var _0x592e3d={'raw':!![],'where':{'id':_0x101162[_0x2646('0x43')]['id']}},_0x46b458={};_0x46b458[_0x2646('0x2e')]=_[_0x2646('0x30')](db[_0x2646('0x2a')]['rawAttributes']);_0x46b458['query']=_[_0x2646('0x30')](_0x101162['query']);_0x46b458[_0x2646('0x31')]=_['intersection'](_0x46b458[_0x2646('0x2e')],_0x46b458[_0x2646('0x2f')]);_0x592e3d[_0x2646('0x33')]=_['intersection'](_0x46b458[_0x2646('0x2e')],qs[_0x2646('0x34')](_0x101162[_0x2646('0x2f')][_0x2646('0x34')]));_0x592e3d['attributes']=_0x592e3d['attributes'][_0x2646('0x35')]?_0x592e3d[_0x2646('0x33')]:_0x46b458[_0x2646('0x2e')];if(_0x101162[_0x2646('0x2f')][_0x2646('0x3f')]){_0x592e3d['include']=[{'all':!![]}];}_0x592e3d=_[_0x2646('0x3e')]({},_0x592e3d,_0x101162[_0x2646('0x44')]);return db[_0x2646('0x2a')][_0x2646('0x45')](_0x592e3d)[_0x2646('0x24')](handleEntityNotFound(_0x44c6ad,null))['then'](respondWithResult(_0x44c6ad,null))[_0x2646('0x1b')](handleError(_0x44c6ad,null));};exports[_0x2646('0x46')]=function(_0x494f93,_0x5918a0){if(_0x494f93[_0x2646('0x47')]['id']){delete _0x494f93[_0x2646('0x47')]['id'];}return db[_0x2646('0x2a')]['find']({'where':{'id':_0x494f93['params']['id']}})['then'](handleEntityNotFound(_0x5918a0,null))[_0x2646('0x24')](saveUpdates(_0x494f93['body'],null))['then'](respondWithResult(_0x5918a0,null))[_0x2646('0x1b')](handleError(_0x5918a0,null));};exports[_0x2646('0x25')]=function(_0xf96867,_0x53424d){return db['MailMessage']['find']({'where':{'id':_0xf96867[_0x2646('0x43')]['id']}})['then'](handleEntityNotFound(_0x53424d,null))[_0x2646('0x24')](removeEntity(_0x53424d,null))[_0x2646('0x1b')](handleError(_0x53424d,null));};exports[_0x2646('0x48')]=function(_0x4d7a7f,_0x31359e){return db['MailMessage'][_0x2646('0x48')]()['then'](respondWithResult(_0x31359e,null))[_0x2646('0x1b')](handleError(_0x31359e,null));};exports[_0x2646('0x49')]=function(_0x3a566f,_0x3162c3){return db['MailMessage']['create'](_0x3a566f[_0x2646('0x47')])['then'](function(_0x2858fa){if(_0x2858fa){if(_0x2858fa['direction']===_0x2646('0x4a')&&!_0x2858fa[_0x2646('0x4b')]){var _0xef1c99,_0xa644c9,_0x1e5bb1;if(_0x3a566f[_0x2646('0x47')]['to']){_0xa644c9=_0x3a566f[_0x2646('0x47')]['to'][_0x2646('0x4c')](',')[0x0];}return db[_0x2646('0x4d')][_0x2646('0x4e')]({'where':{'id':_0x2858fa[_0x2646('0x4f')]},'include':[{'model':db['CmList'],'as':_0x2646('0x50'),'include':[{'model':db[_0x2646('0x51')],'as':'Contacts','where':{'email':_0xa644c9},'limit':0x1,'order':[['updatedAt',_0x2646('0x52')]]}]},{'model':db[_0x2646('0x53')],'as':_0x2646('0x54'),'raw':!![],'include':[{'model':db[_0x2646('0x55')],'as':_0x2646('0x55'),'raw':!![]}]}]})[_0x2646('0x24')](function(_0x9f16d4){_0xef1c99=_0x9f16d4;if(!_0xef1c99||!_0xef1c99['Smtp'])return;var _0x6f994f=_0xef1c99[_0x2646('0x56')]();if(_0x3a566f[_0x2646('0x47')][_0x2646('0x57')]&&_0x3a566f['body']['attachments']['length']){for(var _0x2b3d8a=0x0;_0x2b3d8a<_0x3a566f[_0x2646('0x47')][_0x2646('0x57')]['length'];_0x2b3d8a+=0x1){_0x3a566f[_0x2646('0x47')][_0x2646('0x57')][_0x2b3d8a]={'filename':_0x3a566f[_0x2646('0x47')][_0x2646('0x57')][_0x2b3d8a][_0x2646('0x27')],'path':path[_0x2646('0x58')](config[_0x2646('0x59')],_0x2646('0x5a'),_0x3a566f[_0x2646('0x47')][_0x2646('0x57')][_0x2b3d8a]['basename'])};}}_0x1e5bb1={'account':_0x6f994f,'message':_0x3a566f[_0x2646('0x47')]};return;})[_0x2646('0x24')](function(){if(_0xef1c99[_0x2646('0x50')]){if(_0xef1c99[_0x2646('0x50')][_0x2646('0x5b')][_0x2646('0x35')]){return _0xef1c99[_0x2646('0x50')][_0x2646('0x5b')][0x0];}else{return db[_0x2646('0x51')]['create'](_[_0x2646('0xc')](_0x3a566f[_0x2646('0x47')],{'firstName':_0x3a566f[_0x2646('0x47')]['to'],'email':_0x3a566f[_0x2646('0x47')]['to'],'phone':_0x3a566f[_0x2646('0x47')]['to'],'ListId':_0xef1c99[_0x2646('0x5c')]}));}}else{throw new Error(_0x2646('0x5d'));}})[_0x2646('0x24')](function(){if(_0x1e5bb1){return respondWithRpcPromise(_0x2646('0x5e'),_0x2646('0x5f'),_0x1e5bb1,client9003)[_0x2646('0x24')](function(_0x3c66d8){return _0x2858fa[_0x2646('0x46')]({'read':!![],'messageId':_0x3c66d8[_0x2646('0x60')],'sentAt':moment()[_0x2646('0x61')](_0x2646('0x62'))});})[_0x2646('0x1b')](function(_0x249ab1){logger[_0x2646('0x18')]('%s',JSON[_0x2646('0x17')](_0x249ab1));return _0x2858fa;});}return _0x2858fa;});}return _0x2858fa;}})['then'](respondWithResult(_0x3162c3,0xc9))[_0x2646('0x1b')](handleError(_0x3162c3,null));};exports[_0x2646('0x63')]=function(_0x199758,_0x27135c){var _0x4d63f6={'agent':{},'channel':_0x2646('0x64')};if(_0x199758['body']['id']){delete _0x199758[_0x2646('0x47')]['id'];}_0x199758[_0x2646('0x47')]['read']=!![];_0x199758[_0x2646('0x47')][_0x2646('0x65')]=moment()[_0x2646('0x61')](_0x2646('0x62'));_0x199758['body'][_0x2646('0x66')]=_0x199758[_0x2646('0x47')][_0x2646('0x66')]||_0x199758[_0x2646('0x67')]['id'];_0x4d63f6[_0x2646('0x68')]['id']=_0x199758[_0x2646('0x47')]['UserId'];return db[_0x2646('0x2a')][_0x2646('0x45')]({'where':{'id':_0x199758[_0x2646('0x43')]['id'],'UserId':null}})[_0x2646('0x24')](handleEntityNotFound(_0x27135c,null))[_0x2646('0x24')](saveUpdates(_0x199758[_0x2646('0x47')],null))[_0x2646('0x24')](function(_0x29f137){if(_0x29f137){_0x4d63f6[_0x2646('0x19')]=_0x29f137[_0x2646('0x69')]({'plain':!![]});return db[_0x2646('0x6a')][_0x2646('0x45')]({'where':{'id':_0x29f137[_0x2646('0x6b')]}});}return null;})[_0x2646('0x24')](handleEntityNotFound(_0x27135c,null))[_0x2646('0x24')](function(_0x321000){if(_0x321000){return _0x321000['update']({'UserId':_0x199758[_0x2646('0x47')][_0x2646('0x66')],'read1stAt':_[_0x2646('0x6c')](_0x321000[_0x2646('0x6d')])?moment()[_0x2646('0x61')](_0x2646('0x62')):undefined});}return null;})[_0x2646('0x24')](function(_0x34f1e4){if(_0x34f1e4){_0x4d63f6[_0x2646('0x6e')]=_0x34f1e4[_0x2646('0x69')]({'plain':!![]});interaction_log[_0x2646('0x6f')](_0x2646('0x70'),_0x199758['user']['id'],_0x199758[_0x2646('0x67')][_0x2646('0x27')],_0x199758[_0x2646('0x67')][_0x2646('0x71')],_0x4d63f6[_0x2646('0x6e')]['id'],_0x199758[_0x2646('0x47')]?JSON[_0x2646('0x17')](_0x199758['body']):'null');return respondWithRpcPromise(_0x2646('0x72'),_0x2646('0x73'),_0x4d63f6);}return null;})['then'](function(_0x23fcbd){var _0xa6ee32='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x23fcbd[_0x2646('0x19')][_0x2646('0x74')];return db[_0x2646('0x75')]['query'](_0xa6ee32,{'type':db[_0x2646('0x76')][_0x2646('0x77')][_0x2646('0x78')],'raw':!![]})[_0x2646('0x24')](function(_0x4f9eba){return _0x4f9eba;});})[_0x2646('0x24')](function(_0x5e0d5e){if(_0x5e0d5e){_0x4d63f6['message']['contact']=_0x5e0d5e[0x0];if(!_0x199758['body'][_0x2646('0x66')])return;return db[_0x2646('0x79')][_0x2646('0x45')]({'where':{'id':_0x199758['body']['UserId'],'role':_0x2646('0x68')},'attributes':['id',_0x2646('0x27'),_0x2646('0x7a'),_0x2646('0x7b'),'internal'],'raw':!![]});}return null;})[_0x2646('0x24')](function(_0x4c3417){if(!_0x4c3417)return null;_0x4d63f6['message']['agent']=_0x4c3417;return _0x4d63f6;})['then'](function(_0x416f04){if(_0x416f04){if(_0x199758[_0x2646('0x47')][_0x2646('0x7c')]){_0x4d63f6[_0x2646('0x19')][_0x2646('0x7d')]=util[_0x2646('0x61')]('SIP/%s',_0x199758[_0x2646('0x67')][_0x2646('0x27')]);_0x4d63f6[_0x2646('0x19')][_0x2646('0x7e')]=_0x4d63f6[_0x2646('0x7e')];_0x4d63f6[_0x2646('0x19')][_0x2646('0x7f')]=_0x4d63f6[_0x2646('0x7e')];_0x4d63f6[_0x2646('0x19')][_0x2646('0x80')]=_0x2646('0x63');_0x4d63f6[_0x2646('0x19')][_0x2646('0x47')]=htmlToText[_0x2646('0x81')](_0x4d63f6['message']['body']);return respondWithRpcPromise(_0x2646('0x82'),'EventManager',{'event':_0x2646('0x83'),'message':_0x4d63f6['message']},client9002)[_0x2646('0x24')](function(){return _0x4d63f6;});}return _0x4d63f6;}return null;})[_0x2646('0x24')](respondWithResult(_0x27135c,null))['catch'](handleError(_0x27135c,null));};exports['reject']=function(_0x2e3039,_0xe269e9){var _0xc7c64e={'agent':{},'channel':_0x2646('0x64')};if(_0x2e3039[_0x2646('0x47')]['id']){delete _0x2e3039[_0x2646('0x47')]['id'];}_0x2e3039[_0x2646('0x47')][_0x2646('0x66')]=_0x2e3039['body']['UserId']||_0x2e3039[_0x2646('0x67')]['id'];_0xc7c64e[_0x2646('0x68')]['id']=_0x2e3039[_0x2646('0x47')][_0x2646('0x66')];return db[_0x2646('0x2a')]['find']({'where':{'id':_0x2e3039['params']['id'],'UserId':null}})[_0x2646('0x24')](handleEntityNotFound(_0xe269e9,null))[_0x2646('0x24')](function(_0x4e3673){if(_0x4e3673){_0xc7c64e[_0x2646('0x19')]=_0x4e3673[_0x2646('0x69')]({'plain':!![]});return db[_0x2646('0x6a')]['find']({'where':{'id':_0x4e3673[_0x2646('0x6b')]}});}return null;})[_0x2646('0x24')](handleEntityNotFound(_0xe269e9,null))[_0x2646('0x24')](function(_0xb586fd){if(_0xb586fd){_0xc7c64e[_0x2646('0x6e')]=_0xb586fd[_0x2646('0x69')]({'plain':!![]});interaction_log['info'](_0x2646('0x84'),_0x2e3039[_0x2646('0x67')]['id'],_0x2e3039['user'][_0x2646('0x27')],_0x2e3039[_0x2646('0x67')]['role'],_0xc7c64e[_0x2646('0x6e')]['id'],_0x2e3039[_0x2646('0x47')]?JSON['stringify'](_0x2e3039[_0x2646('0x47')]):_0x2646('0x85'));return respondWithRpcPromise(_0x2646('0x86'),_0x2646('0x87'),_0xc7c64e);}return null;})[_0x2646('0x24')](function(_0x364cfd){var _0x2ece8c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x364cfd[_0x2646('0x19')][_0x2646('0x74')];return db[_0x2646('0x75')][_0x2646('0x2f')](_0x2ece8c,{'type':db['Sequelize'][_0x2646('0x77')]['SELECT'],'raw':!![]})['then'](function(_0x989d8d){return _0x989d8d;});})[_0x2646('0x24')](function(_0xd9110a){if(_0xd9110a){_0xc7c64e['message'][_0x2646('0x88')]=_0xd9110a[0x0];if(!_0x2e3039[_0x2646('0x47')]['UserId'])return;return db[_0x2646('0x79')]['find']({'where':{'id':_0x2e3039[_0x2646('0x47')][_0x2646('0x66')],'role':'agent'},'attributes':['id',_0x2646('0x27'),'fullname','email',_0x2646('0x89')],'raw':!![]});}return null;})[_0x2646('0x24')](function(_0x314dcb){if(!_0x314dcb)return null;_0xc7c64e[_0x2646('0x19')]['agent']=_0x314dcb;return _0xc7c64e;})[_0x2646('0x24')](function(_0x24b2be){if(_0x24b2be){_0x24b2be[_0x2646('0x19')][_0x2646('0x7d')]=util[_0x2646('0x61')](_0x2646('0x8a'),_0x2e3039['user'][_0x2646('0x27')]);_0x24b2be[_0x2646('0x19')][_0x2646('0x7e')]=_0xc7c64e[_0x2646('0x7e')];_0x24b2be[_0x2646('0x19')][_0x2646('0x7f')]=_0xc7c64e[_0x2646('0x7e')];_0x24b2be[_0x2646('0x19')][_0x2646('0x80')]=_0x2646('0x8b');_0x24b2be[_0x2646('0x19')][_0x2646('0x47')]=htmlToText[_0x2646('0x81')](_0xc7c64e[_0x2646('0x19')][_0x2646('0x47')]);respondWithRpcPromise(_0x2646('0x82'),_0x2646('0x82'),{'event':_0x2646('0x8c'),'message':_0x24b2be[_0x2646('0x19')]},client9002);return _0xc7c64e;}return null;})['then'](respondWithResult(_0xe269e9,null))[_0x2646('0x1b')](handleError(_0xe269e9,null));};exports[_0x2646('0x8d')]=function(_0x8c5553,_0x509d40){var _0x1fc5ef=moment()[_0x2646('0x8e')]()[_0x2646('0x8f')]();var _0x7d14d5=path[_0x2646('0x58')](config[_0x2646('0x59')],'server',_0x2646('0x90'),_0x2646('0x91'));var _0x13d160=path[_0x2646('0x58')](config[_0x2646('0x59')],_0x2646('0x92'),_0x2646('0x90'),'attachments');var _0x1a223a=util[_0x2646('0x61')](_0x2646('0x93'),_0x1fc5ef);return db[_0x2646('0x2a')]['find']({'where':{'id':_0x8c5553[_0x2646('0x43')]['id']},'attributes':['id',_0x2646('0x47'),'from','to','cc',_0x2646('0x94'),_0x2646('0x95'),_0x2646('0x96')],'include':_0x8c5553[_0x2646('0x2f')][_0x2646('0x57')]?[{'model':db[_0x2646('0x97')],'as':'Attachments'}]:undefined})[_0x2646('0x24')](handleEntityNotFound(_0x509d40,null))['then'](function(_0x4c72c2){if(_0x4c72c2){var _0x58c239=_0x4c72c2;var _0x3480cd={'from':_0x58c239[_0x2646('0x98')],'to':_0x58c239['to'],'subject':_0x58c239[_0x2646('0x95')],'html':htmlEntities['decode'](_0x58c239[_0x2646('0x47')]),'headers':{'Date':moment(_0x58c239[_0x2646('0x96')])['format'](_0x2646('0x99'))},'attachments':[]};if(_0x4c72c2['cc']){_0x3480cd['headers']['Cc']=_0x4c72c2['cc'];}if(_0x4c72c2[_0x2646('0x94')]){_0x3480cd[_0x2646('0x9a')][_0x2646('0x9b')]=_0x4c72c2['bcc'];}return new BPromise(function(_0x175088,_0x562fde){if(_0x4c72c2['Attachments']){for(var _0xe919b3=0x0;_0xe919b3<_0x4c72c2[_0x2646('0x9c')][_0x2646('0x35')];_0xe919b3++){var _0x2fcdcd=_0x4c72c2[_0x2646('0x9c')][_0xe919b3];var _0x178cbe=path[_0x2646('0x58')](_0x13d160,_0x2fcdcd[_0x2646('0x9d')]);if(fs[_0x2646('0x9e')](_0x178cbe)){_0x3480cd['attachments'][_0x2646('0x9f')]({'name':_0x2fcdcd[_0x2646('0x27')],'contentType':_0x2fcdcd[_0x2646('0x3c')],'data':fs['readFileSync'](_0x178cbe)});}}}emlformat['build'](_0x3480cd,function(_0x46779e,_0x44cf51){if(_0x46779e)return _0x562fde(_0x46779e);fs[_0x2646('0xa0')](path['join'](_0x7d14d5,_0x1a223a),_0x44cf51);return _0x175088(_0x44cf51);});});}})[_0x2646('0x24')](function(_0x271fa0){if(_0x271fa0){return _0x509d40[_0x2646('0x8d')](path[_0x2646('0x58')](_0x7d14d5,_0x1a223a),_0x1a223a,function(_0x5dd886){if(!_0x5dd886)fs[_0x2646('0xa1')](path['join'](_0x7d14d5,_0x1a223a));});}})[_0x2646('0x1b')](handleError(_0x509d40,null));}; \ No newline at end of file +var _0xe3ae=['rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','root','basename','Contacts','ListId','List\x20not\x20found','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','manual','interface','SIP/%s','channel','fromString','EventManager','reject','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','motionChannel','event','rejectmessage','download','toString','server','files','tmp','join','message-%s.eml','from','Attachments','decode','createdAt','headers','bcc','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','MailMessage'];(function(_0x47032a,_0x3750d3){var _0x5609ba=function(_0x4428ce){while(--_0x4428ce){_0x47032a['push'](_0x47032a['shift']());}};_0x5609ba(++_0x3750d3);}(_0xe3ae,0x108));var _0xee3a=function(_0x6466ab,_0x55d497){_0x6466ab=_0x6466ab-0x0;var _0x5c8ca2=_0xe3ae[_0x6466ab];return _0x5c8ca2;};'use strict';var emlformat=require(_0xee3a('0x0'));var moment=require(_0xee3a('0x1'));var BPromise=require(_0xee3a('0x2'));var util=require(_0xee3a('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xee3a('0x4'));var Redis=require(_0xee3a('0x5'));var htmlToText=require(_0xee3a('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xee3a('0x7'))(_0xee3a('0x8'));var interaction_log=require(_0xee3a('0x7'))(_0xee3a('0x9'));var config=require('../../config/environment');var db=require(_0xee3a('0xa'))['db'];config[_0xee3a('0xb')]=_[_0xee3a('0xc')](config[_0xee3a('0xb')],{'host':_0xee3a('0xd'),'port':0x18eb});var socket=require(_0xee3a('0xe'))(new Redis(config[_0xee3a('0xb')]));var htmlEntities=require(_0xee3a('0xf'));require(_0xee3a('0x10'))['register'](socket);var jayson=require(_0xee3a('0x11'));var client=jayson[_0xee3a('0x12')][_0xee3a('0x13')]({'port':0x232c});var client9003=jayson[_0xee3a('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xee3a('0x12')][_0xee3a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x398557,_0x49296c,_0x9e6c4a,_0x49e177){return new BPromise(function(_0x7af817,_0x2c9bd7){var _0xfa5a7d=_0x49e177||client;return _0xfa5a7d['request'](_0x398557,_0x9e6c4a)[_0xee3a('0x14')](function(_0x461182){logger[_0xee3a('0x15')]('MailMessage,\x20%s,\x20%s',_0x49296c,_0xee3a('0x16'));logger[_0xee3a('0x17')](_0xee3a('0x18'),_0x49296c,'request\x20sent',JSON[_0xee3a('0x19')](_0x461182));if(_0x461182[_0xee3a('0x1a')]){if(_0x461182[_0xee3a('0x1a')]['code']===0x1f4){logger[_0xee3a('0x1a')](_0xee3a('0x1b'),_0x49296c,_0x461182[_0xee3a('0x1a')][_0xee3a('0x1c')]);return _0x2c9bd7(_0x461182[_0xee3a('0x1a')]['message']);}logger[_0xee3a('0x1a')](_0xee3a('0x1b'),_0x49296c,_0x461182['error']['message']);return _0x7af817(_0x461182[_0xee3a('0x1a')][_0xee3a('0x1c')]);}else{logger[_0xee3a('0x15')](_0xee3a('0x1b'),_0x49296c,'request\x20sent');_0x7af817(_0x461182[_0xee3a('0x1d')]['message']);}})[_0xee3a('0x1e')](function(_0x301a8d){logger[_0xee3a('0x1a')](_0xee3a('0x1b'),_0x49296c,_0x301a8d);_0x2c9bd7(_0x301a8d);});});}function respondWithResult(_0x362852,_0x137d8e){_0x137d8e=_0x137d8e||0xc8;return function(_0xf09e74){if(_0xf09e74){return _0x362852[_0xee3a('0x1f')](_0x137d8e)[_0xee3a('0x20')](_0xf09e74);}};}function respondWithFilteredResult(_0x536c19,_0x10fc71){return function(_0x53bd7c){if(_0x53bd7c){var _0x50fc2f=typeof _0x10fc71[_0xee3a('0x21')]===_0xee3a('0x22')&&typeof _0x10fc71[_0xee3a('0x23')]===_0xee3a('0x22');var _0x25cebf=_0x53bd7c[_0xee3a('0x24')];var _0x1bcba0=_0x50fc2f?0x0:_0x10fc71['offset'];var _0x5f044b=_0x50fc2f?_0x53bd7c[_0xee3a('0x24')]:_0x10fc71['offset']+_0x10fc71['limit'];var _0x255edb;if(_0x5f044b>=_0x25cebf){_0x5f044b=_0x25cebf;_0x255edb=0xc8;}else{_0x255edb=0xce;}_0x536c19[_0xee3a('0x1f')](_0x255edb);return _0x536c19[_0xee3a('0x25')](_0xee3a('0x26'),_0x1bcba0+'-'+_0x5f044b+'/'+_0x25cebf)[_0xee3a('0x20')](_0x53bd7c);}return null;};}function saveUpdates(_0x22ecd6){return function(_0x2c9faa){if(_0x2c9faa){return _0x2c9faa[_0xee3a('0x27')](_0x22ecd6)[_0xee3a('0x14')](function(_0xd48b02){return _0xd48b02;});}return null;};}function removeEntity(_0x2f61e4){return function(_0x4a5d23){if(_0x4a5d23){return _0x4a5d23[_0xee3a('0x28')]()[_0xee3a('0x14')](function(){_0x2f61e4['status'](0xcc)[_0xee3a('0x29')]();});}};}function handleEntityNotFound(_0x4eb60c){return function(_0x5cc2fc){if(!_0x5cc2fc){_0x4eb60c[_0xee3a('0x2a')](0x194);}return _0x5cc2fc;};}function handleError(_0x50058c,_0x295f26){_0x295f26=_0x295f26||0x1f4;return function(_0x589afb){logger[_0xee3a('0x1a')](_0x589afb['stack']);if(_0x589afb[_0xee3a('0x2b')]){delete _0x589afb[_0xee3a('0x2b')];}_0x50058c[_0xee3a('0x1f')](_0x295f26)[_0xee3a('0x2c')](_0x589afb);};}exports[_0xee3a('0x2d')]=function(_0x1df5e6,_0x5c0123){var _0x431c3c={},_0x3eba13={},_0x44c6a1={'count':0x0,'rows':[]};var _0x165317=_[_0xee3a('0x2e')](db[_0xee3a('0x2f')][_0xee3a('0x30')],function(_0x483c40){return{'name':_0x483c40[_0xee3a('0x31')],'type':_0x483c40[_0xee3a('0x32')]['key']};});_0x3eba13['model']=_[_0xee3a('0x2e')](_0x165317,_0xee3a('0x2b'));_0x3eba13['query']=_[_0xee3a('0x33')](_0x1df5e6[_0xee3a('0x34')]);_0x3eba13[_0xee3a('0x35')]=_[_0xee3a('0x36')](_0x3eba13[_0xee3a('0x37')],_0x3eba13[_0xee3a('0x34')]);_0x431c3c[_0xee3a('0x38')]=_[_0xee3a('0x36')](_0x3eba13['model'],qs[_0xee3a('0x39')](_0x1df5e6['query'][_0xee3a('0x39')]));_0x431c3c['attributes']=_0x431c3c[_0xee3a('0x38')][_0xee3a('0x3a')]?_0x431c3c[_0xee3a('0x38')]:_0x3eba13[_0xee3a('0x37')];if(!_0x1df5e6[_0xee3a('0x34')]['hasOwnProperty'](_0xee3a('0x3b'))){_0x431c3c[_0xee3a('0x23')]=qs[_0xee3a('0x23')](_0x1df5e6['query'][_0xee3a('0x23')]);_0x431c3c['offset']=qs[_0xee3a('0x21')](_0x1df5e6[_0xee3a('0x34')][_0xee3a('0x21')]);}_0x431c3c[_0xee3a('0x3c')]=qs[_0xee3a('0x3d')](_0x1df5e6[_0xee3a('0x34')][_0xee3a('0x3d')]);_0x431c3c[_0xee3a('0x3e')]=qs['filters'](_['pick'](_0x1df5e6[_0xee3a('0x34')],_0x3eba13[_0xee3a('0x35')]),_0x165317);if(_0x1df5e6[_0xee3a('0x34')][_0xee3a('0x3f')]){_0x431c3c[_0xee3a('0x3e')]=_[_0xee3a('0x40')](_0x431c3c['where'],{'$or':_[_0xee3a('0x2e')](_0x165317,function(_0x259263){if(_0x259263[_0xee3a('0x32')]!==_0xee3a('0x41')){var _0x4c9ffc={};_0x4c9ffc[_0x259263[_0xee3a('0x2b')]]={'$like':'%'+_0x1df5e6[_0xee3a('0x34')][_0xee3a('0x3f')]+'%'};return _0x4c9ffc;}})});}_0x431c3c=_[_0xee3a('0x40')]({},_0x431c3c,_0x1df5e6[_0xee3a('0x42')]);var _0x287c93={'where':_0x431c3c[_0xee3a('0x3e')]};return db[_0xee3a('0x2f')][_0xee3a('0x24')](_0x287c93)['then'](function(_0x1635f1){_0x44c6a1[_0xee3a('0x24')]=_0x1635f1;if(_0x1df5e6['query'][_0xee3a('0x43')]){_0x431c3c[_0xee3a('0x44')]=[{'all':!![]}];}return db[_0xee3a('0x2f')][_0xee3a('0x45')](_0x431c3c);})[_0xee3a('0x14')](function(_0x1f357e){_0x44c6a1[_0xee3a('0x46')]=_0x1f357e;return _0x44c6a1;})['then'](respondWithFilteredResult(_0x5c0123,_0x431c3c))[_0xee3a('0x1e')](handleError(_0x5c0123,null));};exports[_0xee3a('0x47')]=function(_0x58d0f0,_0x2de5d5){var _0x5de084={'raw':!![],'where':{'id':_0x58d0f0[_0xee3a('0x48')]['id']}},_0x137937={};_0x137937['model']=_[_0xee3a('0x33')](db[_0xee3a('0x2f')][_0xee3a('0x30')]);_0x137937[_0xee3a('0x34')]=_[_0xee3a('0x33')](_0x58d0f0['query']);_0x137937[_0xee3a('0x35')]=_[_0xee3a('0x36')](_0x137937[_0xee3a('0x37')],_0x137937['query']);_0x5de084[_0xee3a('0x38')]=_['intersection'](_0x137937[_0xee3a('0x37')],qs[_0xee3a('0x39')](_0x58d0f0['query'][_0xee3a('0x39')]));_0x5de084[_0xee3a('0x38')]=_0x5de084[_0xee3a('0x38')][_0xee3a('0x3a')]?_0x5de084[_0xee3a('0x38')]:_0x137937[_0xee3a('0x37')];if(_0x58d0f0[_0xee3a('0x34')]['includeAll']){_0x5de084[_0xee3a('0x44')]=[{'all':!![]}];}_0x5de084=_[_0xee3a('0x40')]({},_0x5de084,_0x58d0f0[_0xee3a('0x42')]);return db[_0xee3a('0x2f')][_0xee3a('0x49')](_0x5de084)[_0xee3a('0x14')](handleEntityNotFound(_0x2de5d5,null))[_0xee3a('0x14')](respondWithResult(_0x2de5d5,null))[_0xee3a('0x1e')](handleError(_0x2de5d5,null));};exports['update']=function(_0x58575a,_0x31baf0){if(_0x58575a[_0xee3a('0x4a')]['id']){delete _0x58575a[_0xee3a('0x4a')]['id'];}return db[_0xee3a('0x2f')][_0xee3a('0x49')]({'where':{'id':_0x58575a[_0xee3a('0x48')]['id']}})[_0xee3a('0x14')](handleEntityNotFound(_0x31baf0,null))['then'](saveUpdates(_0x58575a['body'],null))[_0xee3a('0x14')](respondWithResult(_0x31baf0,null))['catch'](handleError(_0x31baf0,null));};exports['destroy']=function(_0x5a471b,_0xb23998){return db[_0xee3a('0x2f')]['find']({'where':{'id':_0x5a471b[_0xee3a('0x48')]['id']}})[_0xee3a('0x14')](handleEntityNotFound(_0xb23998,null))[_0xee3a('0x14')](removeEntity(_0xb23998,null))[_0xee3a('0x1e')](handleError(_0xb23998,null));};exports[_0xee3a('0x4b')]=function(_0x57a911,_0x324087){return db[_0xee3a('0x2f')][_0xee3a('0x4b')]()[_0xee3a('0x14')](respondWithResult(_0x324087,null))['catch'](handleError(_0x324087,null));};exports[_0xee3a('0x4c')]=function(_0x137676,_0x309902){return db[_0xee3a('0x2f')][_0xee3a('0x4c')](_0x137676[_0xee3a('0x4a')])['then'](function(_0x3fbc91){if(_0x3fbc91){if(_0x3fbc91['direction']===_0xee3a('0x4d')&&!_0x3fbc91[_0xee3a('0x4e')]){var _0x11bab8,_0x8a7649,_0x57c229;if(_0x137676[_0xee3a('0x4a')]['to']){_0x8a7649=_0x137676[_0xee3a('0x4a')]['to'][_0xee3a('0x4f')](',')[0x0];}return db[_0xee3a('0x50')][_0xee3a('0x51')]({'where':{'id':_0x3fbc91[_0xee3a('0x52')]},'include':[{'model':db[_0xee3a('0x53')],'as':_0xee3a('0x54'),'include':[{'model':db[_0xee3a('0x55')],'as':'Contacts','where':{'email':_0x8a7649},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xee3a('0x56')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xee3a('0x57')],'as':_0xee3a('0x57'),'raw':!![]}]}]})[_0xee3a('0x14')](function(_0x2ea5f2){_0x11bab8=_0x2ea5f2;if(!_0x11bab8||!_0x11bab8[_0xee3a('0x58')])return;var _0x382d2b=_0x11bab8[_0xee3a('0x59')]();if(_0x137676[_0xee3a('0x4a')][_0xee3a('0x5a')]&&_0x137676[_0xee3a('0x4a')][_0xee3a('0x5a')][_0xee3a('0x3a')]){for(var _0x4d8352=0x0;_0x4d8352<_0x137676[_0xee3a('0x4a')][_0xee3a('0x5a')][_0xee3a('0x3a')];_0x4d8352+=0x1){_0x137676['body']['attachments'][_0x4d8352]={'filename':_0x137676[_0xee3a('0x4a')][_0xee3a('0x5a')][_0x4d8352]['name'],'path':path['join'](config[_0xee3a('0x5b')],'server/files/attachments',_0x137676[_0xee3a('0x4a')]['attachments'][_0x4d8352][_0xee3a('0x5c')])};}}_0x57c229={'account':_0x382d2b,'message':_0x137676[_0xee3a('0x4a')]};return;})['then'](function(){if(_0x11bab8['List']){if(_0x11bab8[_0xee3a('0x54')][_0xee3a('0x5d')][_0xee3a('0x3a')]){return _0x11bab8[_0xee3a('0x54')][_0xee3a('0x5d')][0x0];}else{return db['CmContact'][_0xee3a('0x4c')](_[_0xee3a('0xc')](_0x137676[_0xee3a('0x4a')],{'firstName':_0x137676[_0xee3a('0x4a')]['to'],'email':_0x137676[_0xee3a('0x4a')]['to'],'phone':_0x137676['body']['to'],'ListId':_0x11bab8[_0xee3a('0x5e')]}));}}else{throw new Error(_0xee3a('0x5f'));}})[_0xee3a('0x14')](function(){if(_0x57c229){return respondWithRpcPromise('SendMail','sendMail',_0x57c229,client9003)[_0xee3a('0x14')](function(_0x49f33a){return _0x3fbc91[_0xee3a('0x27')]({'read':!![],'messageId':_0x49f33a['messageId'],'sentAt':moment()[_0xee3a('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x29263e){logger[_0xee3a('0x1a')]('%s',JSON[_0xee3a('0x19')](_0x29263e));return _0x3fbc91;});}return _0x3fbc91;});}return _0x3fbc91;}})[_0xee3a('0x14')](respondWithResult(_0x309902,0xc9))['catch'](handleError(_0x309902,null));};exports[_0xee3a('0x61')]=function(_0x2eea04,_0x515e82){var _0x3e50fe={'agent':{},'channel':_0xee3a('0x62')};if(_0x2eea04[_0xee3a('0x4a')]['id']){delete _0x2eea04[_0xee3a('0x4a')]['id'];}_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x63')]=!![];_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x64')]=moment()['format'](_0xee3a('0x65'));_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x66')]=_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x66')]||_0x2eea04[_0xee3a('0x67')]['id'];_0x3e50fe[_0xee3a('0x68')]['id']=_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x66')];return db[_0xee3a('0x2f')][_0xee3a('0x49')]({'where':{'id':_0x2eea04[_0xee3a('0x48')]['id'],'UserId':null}})[_0xee3a('0x14')](handleEntityNotFound(_0x515e82,null))[_0xee3a('0x14')](saveUpdates(_0x2eea04['body'],null))['then'](function(_0x814d06){if(_0x814d06){_0x3e50fe[_0xee3a('0x1c')]=_0x814d06[_0xee3a('0x69')]({'plain':!![]});return db[_0xee3a('0x6a')][_0xee3a('0x49')]({'where':{'id':_0x814d06[_0xee3a('0x6b')]}});}return null;})[_0xee3a('0x14')](handleEntityNotFound(_0x515e82,null))[_0xee3a('0x14')](function(_0x53951c){if(_0x53951c){return _0x53951c[_0xee3a('0x27')]({'UserId':_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x66')],'read1stAt':_[_0xee3a('0x6c')](_0x53951c['read1stAt'])?moment()[_0xee3a('0x60')](_0xee3a('0x65')):undefined});}return null;})[_0xee3a('0x14')](function(_0x31ec49){if(_0x31ec49){_0x3e50fe[_0xee3a('0x6d')]=_0x31ec49[_0xee3a('0x69')]({'plain':!![]});interaction_log[_0xee3a('0x15')](_0xee3a('0x6e'),_0x2eea04[_0xee3a('0x67')]['id'],_0x2eea04['user'][_0xee3a('0x2b')],_0x2eea04[_0xee3a('0x67')]['role'],_0x3e50fe[_0xee3a('0x6d')]['id'],_0x2eea04[_0xee3a('0x4a')]?JSON[_0xee3a('0x19')](_0x2eea04[_0xee3a('0x4a')]):_0xee3a('0x6f'));return respondWithRpcPromise(_0xee3a('0x70'),'acceptMessage',_0x3e50fe);}return null;})['then'](function(_0x530a08){var _0x5eb577='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x530a08[_0xee3a('0x1c')]['ContactId'];return db[_0xee3a('0x71')][_0xee3a('0x34')](_0x5eb577,{'type':db[_0xee3a('0x72')][_0xee3a('0x73')]['SELECT'],'raw':!![]})[_0xee3a('0x14')](function(_0x4440b3){return _0x4440b3;});})[_0xee3a('0x14')](function(_0x5babc2){if(_0x5babc2){_0x3e50fe[_0xee3a('0x1c')][_0xee3a('0x74')]=_0x5babc2[0x0];if(!_0x2eea04[_0xee3a('0x4a')]['UserId'])return;return db[_0xee3a('0x75')][_0xee3a('0x49')]({'where':{'id':_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x66')],'role':_0xee3a('0x68')},'attributes':['id',_0xee3a('0x2b'),_0xee3a('0x76'),_0xee3a('0x77'),'internal'],'raw':!![]});}return null;})[_0xee3a('0x14')](function(_0x157357){if(!_0x157357)return null;_0x3e50fe[_0xee3a('0x1c')][_0xee3a('0x68')]=_0x157357;return _0x3e50fe;})[_0xee3a('0x14')](function(_0xa35552){if(_0xa35552){if(_0x2eea04[_0xee3a('0x4a')][_0xee3a('0x78')]){_0x3e50fe[_0xee3a('0x1c')][_0xee3a('0x79')]=util['format'](_0xee3a('0x7a'),_0x2eea04[_0xee3a('0x67')][_0xee3a('0x2b')]);_0x3e50fe[_0xee3a('0x1c')][_0xee3a('0x7b')]=_0x3e50fe['channel'];_0x3e50fe['message']['motionChannel']=_0x3e50fe[_0xee3a('0x7b')];_0x3e50fe['message']['event']='accept';_0x3e50fe[_0xee3a('0x1c')][_0xee3a('0x4a')]=htmlToText[_0xee3a('0x7c')](_0x3e50fe['message']['body']);return respondWithRpcPromise(_0xee3a('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x3e50fe[_0xee3a('0x1c')]},client9002)[_0xee3a('0x14')](function(){return _0x3e50fe;});}return _0x3e50fe;}return null;})[_0xee3a('0x14')](respondWithResult(_0x515e82,null))[_0xee3a('0x1e')](handleError(_0x515e82,null));};exports[_0xee3a('0x7e')]=function(_0x153fd8,_0x135c47){var _0x150c9d={'agent':{},'channel':_0xee3a('0x62')};if(_0x153fd8[_0xee3a('0x4a')]['id']){delete _0x153fd8[_0xee3a('0x4a')]['id'];}_0x153fd8[_0xee3a('0x4a')][_0xee3a('0x66')]=_0x153fd8[_0xee3a('0x4a')][_0xee3a('0x66')]||_0x153fd8['user']['id'];_0x150c9d[_0xee3a('0x68')]['id']=_0x153fd8[_0xee3a('0x4a')][_0xee3a('0x66')];return db[_0xee3a('0x2f')][_0xee3a('0x49')]({'where':{'id':_0x153fd8[_0xee3a('0x48')]['id'],'UserId':null}})[_0xee3a('0x14')](handleEntityNotFound(_0x135c47,null))['then'](function(_0xff3d83){if(_0xff3d83){_0x150c9d['message']=_0xff3d83['get']({'plain':!![]});return db[_0xee3a('0x6a')][_0xee3a('0x49')]({'where':{'id':_0xff3d83[_0xee3a('0x6b')]}});}return null;})[_0xee3a('0x14')](handleEntityNotFound(_0x135c47,null))[_0xee3a('0x14')](function(_0x467078){if(_0x467078){_0x150c9d[_0xee3a('0x6d')]=_0x467078['get']({'plain':!![]});interaction_log[_0xee3a('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x153fd8[_0xee3a('0x67')]['id'],_0x153fd8[_0xee3a('0x67')][_0xee3a('0x2b')],_0x153fd8['user'][_0xee3a('0x7f')],_0x150c9d[_0xee3a('0x6d')]['id'],_0x153fd8[_0xee3a('0x4a')]?JSON[_0xee3a('0x19')](_0x153fd8[_0xee3a('0x4a')]):_0xee3a('0x6f'));return respondWithRpcPromise(_0xee3a('0x80'),_0xee3a('0x81'),_0x150c9d);}return null;})[_0xee3a('0x14')](function(_0x1c155e){var _0x395514=_0xee3a('0x82')+_0x1c155e[_0xee3a('0x1c')][_0xee3a('0x83')];return db[_0xee3a('0x71')][_0xee3a('0x34')](_0x395514,{'type':db[_0xee3a('0x72')][_0xee3a('0x73')][_0xee3a('0x84')],'raw':!![]})[_0xee3a('0x14')](function(_0x372dd6){return _0x372dd6;});})['then'](function(_0x2fbefc){if(_0x2fbefc){_0x150c9d[_0xee3a('0x1c')]['contact']=_0x2fbefc[0x0];if(!_0x153fd8[_0xee3a('0x4a')][_0xee3a('0x66')])return;return db[_0xee3a('0x75')][_0xee3a('0x49')]({'where':{'id':_0x153fd8['body']['UserId'],'role':_0xee3a('0x68')},'attributes':['id','name',_0xee3a('0x76'),_0xee3a('0x77'),'internal'],'raw':!![]});}return null;})[_0xee3a('0x14')](function(_0x3b04f9){if(!_0x3b04f9)return null;_0x150c9d['message'][_0xee3a('0x68')]=_0x3b04f9;return _0x150c9d;})[_0xee3a('0x14')](function(_0x300a99){if(_0x300a99){_0x300a99['message'][_0xee3a('0x79')]=util[_0xee3a('0x60')](_0xee3a('0x7a'),_0x153fd8[_0xee3a('0x67')]['name']);_0x300a99[_0xee3a('0x1c')][_0xee3a('0x7b')]=_0x150c9d[_0xee3a('0x7b')];_0x300a99[_0xee3a('0x1c')][_0xee3a('0x85')]=_0x150c9d[_0xee3a('0x7b')];_0x300a99[_0xee3a('0x1c')][_0xee3a('0x86')]=_0xee3a('0x7e');_0x300a99[_0xee3a('0x1c')][_0xee3a('0x4a')]=htmlToText[_0xee3a('0x7c')](_0x150c9d['message'][_0xee3a('0x4a')]);respondWithRpcPromise('EventManager',_0xee3a('0x7d'),{'event':_0xee3a('0x87'),'message':_0x300a99[_0xee3a('0x1c')]},client9002);return _0x150c9d;}return null;})[_0xee3a('0x14')](respondWithResult(_0x135c47,null))[_0xee3a('0x1e')](handleError(_0x135c47,null));};exports[_0xee3a('0x88')]=function(_0x16475d,_0x285b31){var _0x4b8fe6=moment()['unix']()[_0xee3a('0x89')]();var _0x408c2f=path['join'](config[_0xee3a('0x5b')],_0xee3a('0x8a'),_0xee3a('0x8b'),_0xee3a('0x8c'));var _0x500f4e=path[_0xee3a('0x8d')](config[_0xee3a('0x5b')],_0xee3a('0x8a'),_0xee3a('0x8b'),'attachments');var _0x51c255=util['format'](_0xee3a('0x8e'),_0x4b8fe6);return db[_0xee3a('0x2f')]['find']({'where':{'id':_0x16475d[_0xee3a('0x48')]['id']},'attributes':['id',_0xee3a('0x4a'),_0xee3a('0x8f'),'to','cc','bcc','subject','createdAt'],'include':_0x16475d['query'][_0xee3a('0x5a')]?[{'model':db['Attachment'],'as':_0xee3a('0x90')}]:undefined})[_0xee3a('0x14')](handleEntityNotFound(_0x285b31,null))[_0xee3a('0x14')](function(_0x1c59c0){if(_0x1c59c0){var _0x5900bf=_0x1c59c0;var _0x582afb={'from':_0x5900bf[_0xee3a('0x8f')],'to':_0x5900bf['to'],'subject':_0x5900bf['subject'],'html':htmlEntities[_0xee3a('0x91')](_0x5900bf[_0xee3a('0x4a')]),'headers':{'Date':moment(_0x5900bf[_0xee3a('0x92')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1c59c0['cc']){_0x582afb[_0xee3a('0x93')]['Cc']=_0x1c59c0['cc'];}if(_0x1c59c0[_0xee3a('0x94')]){_0x582afb['headers'][_0xee3a('0x95')]=_0x1c59c0['bcc'];}return new BPromise(function(_0x3dc488,_0x304363){if(_0x1c59c0[_0xee3a('0x90')]){for(var _0x5cc42b=0x0;_0x5cc42b<_0x1c59c0[_0xee3a('0x90')][_0xee3a('0x3a')];_0x5cc42b++){var _0x33d95f=_0x1c59c0[_0xee3a('0x90')][_0x5cc42b];var _0x119e6d=path[_0xee3a('0x8d')](_0x500f4e,_0x33d95f[_0xee3a('0x5c')]);if(fs[_0xee3a('0x96')](_0x119e6d)){_0x582afb['attachments'][_0xee3a('0x97')]({'name':_0x33d95f[_0xee3a('0x2b')],'contentType':_0x33d95f[_0xee3a('0x32')],'data':fs[_0xee3a('0x98')](_0x119e6d)});}}}emlformat[_0xee3a('0x99')](_0x582afb,function(_0x5d841c,_0x2eb488){if(_0x5d841c)return _0x304363(_0x5d841c);fs[_0xee3a('0x9a')](path[_0xee3a('0x8d')](_0x408c2f,_0x51c255),_0x2eb488);return _0x3dc488(_0x2eb488);});});}})[_0xee3a('0x14')](function(_0x450d23){if(_0x450d23){return _0x285b31[_0xee3a('0x88')](path[_0xee3a('0x8d')](_0x408c2f,_0x51c255),_0x51c255,function(_0x42fe3f){if(!_0x42fe3f)fs[_0xee3a('0x9b')](path[_0xee3a('0x8d')](_0x408c2f,_0x51c255));});}})[_0xee3a('0x1e')](handleError(_0x285b31,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 4cf475c..b757464 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x692c=['remove','emit','hasOwnProperty','hook','events','MailMessage','setMaxListeners','save'];(function(_0x423c29,_0x28b364){var _0x34172e=function(_0x4281fe){while(--_0x4281fe){_0x423c29['push'](_0x423c29['shift']());}};_0x34172e(++_0x28b364);}(_0x692c,0x1ac));var _0xc692=function(_0x4ac857,_0x5a016e){_0x4ac857=_0x4ac857-0x0;var _0x23ca77=_0x692c[_0x4ac857];return _0x23ca77;};'use strict';var EventEmitter=require(_0xc692('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc692('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc692('0x2')](0x0);var events={'afterCreate':_0xc692('0x3'),'afterUpdate':'update','afterDestroy':_0xc692('0x4')};function emitEvent(_0x531c0c){return function(_0x5cb34a,_0x57aea6,_0x296a83){MailMessageEvents[_0xc692('0x5')](_0x531c0c+':'+_0x5cb34a['id'],_0x5cb34a);MailMessageEvents['emit'](_0x531c0c,_0x5cb34a);_0x296a83(null);};}for(var e in events){if(events[_0xc692('0x6')](e)){var event=events[e];MailMessage[_0xc692('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xa686=['remove','emit','hook','exports','events','../../mysqldb','MailMessage','save'];(function(_0x20feae,_0x31e753){var _0x5c3dd2=function(_0x114638){while(--_0x114638){_0x20feae['push'](_0x20feae['shift']());}};_0x5c3dd2(++_0x31e753);}(_0xa686,0x1bc));var _0x6a68=function(_0x1ffdcb,_0x4bc7ef){_0x1ffdcb=_0x1ffdcb-0x0;var _0x2eeff9=_0xa686[_0x1ffdcb];return _0x2eeff9;};'use strict';var EventEmitter=require(_0x6a68('0x0'));var MailMessage=require(_0x6a68('0x1'))['db'][_0x6a68('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a68('0x3'),'afterUpdate':'update','afterDestroy':_0x6a68('0x4')};function emitEvent(_0x13e6e0){return function(_0x3aff86,_0x46052b,_0x35cf50){MailMessageEvents[_0x6a68('0x5')](_0x13e6e0+':'+_0x3aff86['id'],_0x3aff86);MailMessageEvents['emit'](_0x13e6e0,_0x3aff86);_0x35cf50(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x6a68('0x6')](e,emitEvent(event));}}module[_0x6a68('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 52bb11a..c026dd7 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5252=['UserId','MailInteraction','findOne','MailInteractionId','update','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','isNil'];(function(_0x362edb,_0x2570c9){var _0x1a0c68=function(_0x8ad15c){while(--_0x8ad15c){_0x362edb['push'](_0x362edb['shift']());}};_0x1a0c68(++_0x2570c9);}(_0x5252,0x139));var _0x2525=function(_0x282015,_0x13b07f){_0x282015=_0x282015-0x0;var _0x32a240=_0x5252[_0x282015];return _0x32a240;};'use strict';var _=require(_0x2525('0x0'));var util=require('util');var logger=require(_0x2525('0x1'))(_0x2525('0x2'));var moment=require(_0x2525('0x3'));var BPromise=require(_0x2525('0x4'));var rp=require(_0x2525('0x5'));var htmlToText=require(_0x2525('0x6'));var fs=require('fs');var path=require(_0x2525('0x7'));var rimraf=require(_0x2525('0x8'));var config=require(_0x2525('0x9'));var attributes=require('./mailMessage.attributes');module[_0x2525('0xa')]=function(_0x13b3a4,_0x4156fe){return _0x13b3a4[_0x2525('0xb')](_0x2525('0xc'),attributes,{'tableName':_0x2525('0xd'),'paranoid':![],'indexes':[{'name':_0x2525('0xe'),'fields':['messageId']},{'name':_0x2525('0xf'),'fields':[_0x2525('0x10'),_0x2525('0x11')],'type':_0x2525('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b93e6,_0x267885,_0xa58eb){if(_0x5b93e6[_0x2525('0x13')]){_0x5b93e6[_0x2525('0x10')]=htmlToText[_0x2525('0x14')](_0x5b93e6[_0x2525('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xa58eb(null,_0x267885);},'afterCreate':function(_0x2600f2,_0x349ca4,_0x517161){var _0x28cc97=_0x13b3a4[_0x2525('0x15')];var _0x432e37=_0x2600f2[_0x2525('0x16')]({'plain':!![]});if(_0x432e37['direction'][_0x2525('0x17')]()==='in'||_0x432e37[_0x2525('0x18')]['toLowerCase']()===_0x2525('0x19')&&!_0x432e37['secret']&&!_[_0x2525('0x1a')](_0x432e37[_0x2525('0x1b')])){_0x28cc97[_0x2525('0x1c')][_0x2525('0x1d')]({'where':{'id':_0x432e37[_0x2525('0x1e')]}})['then'](function(_0x326cd5){if(_0x326cd5){_0x326cd5[_0x2525('0x1f')]({'lastMsgAt':_0x432e37['createdAt'],'lastMsgDirection':_0x432e37[_0x2525('0x18')][_0x2525('0x17')]()});}})['catch'](function(_0x40ec6b){console[_0x2525('0x20')](_0x40ec6b);});}_0x517161();}},'charset':_0x2525('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4729=['models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','FULLTEXT','plainBody','fromString','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4729,0x139));var _0x9472=function(_0x247699,_0x8a672b){_0x247699=_0x247699-0x0;var _0x27ac96=_0x4729[_0x247699];return _0x27ac96;};'use strict';var _=require(_0x9472('0x0'));var util=require(_0x9472('0x1'));var logger=require(_0x9472('0x2'))(_0x9472('0x3'));var moment=require(_0x9472('0x4'));var BPromise=require(_0x9472('0x5'));var rp=require(_0x9472('0x6'));var htmlToText=require(_0x9472('0x7'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9472('0x8'));var attributes=require(_0x9472('0x9'));module[_0x9472('0xa')]=function(_0x439395,_0x42c40f){return _0x439395['define'](_0x9472('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x9472('0xc'),'fields':[_0x9472('0xc')]},{'name':'fti_mail_messages','fields':['plainBody','subject'],'type':_0x9472('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x576fc8,_0x42cd5e,_0xe2945){if(_0x576fc8['body']){_0x576fc8[_0x9472('0xe')]=htmlToText[_0x9472('0xf')](_0x576fc8[_0x9472('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xe2945(null,_0x42cd5e);},'afterCreate':function(_0x2a83ee,_0x3684ca,_0x25246d){var _0x4e50be=_0x439395[_0x9472('0x11')];var _0x48b026=_0x2a83ee[_0x9472('0x12')]({'plain':!![]});if(_0x48b026[_0x9472('0x13')][_0x9472('0x14')]()==='in'||_0x48b026[_0x9472('0x13')][_0x9472('0x14')]()===_0x9472('0x15')&&!_0x48b026[_0x9472('0x16')]&&!_[_0x9472('0x17')](_0x48b026['UserId'])){_0x4e50be[_0x9472('0x18')][_0x9472('0x19')]({'where':{'id':_0x48b026[_0x9472('0x1a')]}})[_0x9472('0x1b')](function(_0x183b20){if(_0x183b20){_0x183b20[_0x9472('0x1c')]({'lastMsgAt':_0x48b026[_0x9472('0x1d')],'lastMsgDirection':_0x48b026[_0x9472('0x13')][_0x9472('0x14')]()});}})[_0x9472('0x1e')](function(_0x2b07fd){console[_0x9472('0x1f')](_0x2b07fd);});}_0x25246d();}},'charset':'utf8mb4','collate':_0x9472('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b808b63..d24d9d4 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4888=['code','message','request\x20sent','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x1734d9,_0x47ead7){var _0x2ad3bf=function(_0x412570){while(--_0x412570){_0x1734d9['push'](_0x1734d9['shift']());}};_0x2ad3bf(++_0x47ead7);}(_0x4888,0x198));var _0x8488=function(_0x3044e3,_0x255336){_0x3044e3=_0x3044e3-0x0;var _0x389181=_0x4888[_0x3044e3];return _0x389181;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});config[_0x8488('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0xc')]));require(_0x8488('0xd'))['register'](socket);function respondWithRpcPromise(_0x19c994,_0x1334fe,_0x98223){return new BPromise(function(_0x19a2ee,_0x515ea8){return client[_0x8488('0xe')](_0x19c994,_0x98223)[_0x8488('0xf')](function(_0x468896){logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,'request\x20sent');logger[_0x8488('0x12')](_0x8488('0x13'),_0x1334fe,'request\x20sent',JSON['stringify'](_0x468896));if(_0x468896[_0x8488('0x14')]){if(_0x468896['error'][_0x8488('0x15')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x1334fe,_0x468896[_0x8488('0x14')][_0x8488('0x16')]);return _0x515ea8(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x468896[_0x8488('0x14')]['message']);return _0x19a2ee(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}else{logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,_0x8488('0x17'));_0x19a2ee(_0x468896[_0x8488('0x18')][_0x8488('0x16')]);}})[_0x8488('0x19')](function(_0x514c31){logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x514c31);_0x515ea8(_0x514c31);});});}exports[_0x8488('0x1a')]=function(_0x3dd93e){var _0x554ec6=this;return new Promise(function(_0x4a1b45,_0x340d6b){return db[_0x8488('0x1b')][_0x8488('0x1c')](_0x3dd93e[_0x8488('0x1d')],{'raw':_0x3dd93e[_0x8488('0x1e')]?_0x3dd93e[_0x8488('0x1e')][_0x8488('0x1f')]===undefined?!![]:![]:!![]})[_0x8488('0xf')](function(_0x39dd43){logger['info'](_0x8488('0x1a'),_0x3dd93e);logger[_0x8488('0x12')](_0x8488('0x1a'),_0x3dd93e,JSON[_0x8488('0x20')](_0x39dd43));_0x4a1b45(_0x39dd43);})[_0x8488('0x19')](function(_0x54ecda){logger['error']('CreateMailMessage',_0x54ecda['message'],_0x3dd93e);_0x340d6b(_0x554ec6[_0x8488('0x14')](0x1f4,_0x54ecda['message']));});});}; \ No newline at end of file +var _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x335db2,_0x3e70f6){var _0x410499=function(_0x47a829){while(--_0x47a829){_0x335db2['push'](_0x335db2['shift']());}};_0x410499(++_0x3e70f6);}(_0x1399,0x16c));var _0x9139=function(_0x404acd,_0x2c3d96){_0x404acd=_0x404acd-0x0;var _0x31676c=_0x1399[_0x404acd];return _0x31676c;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index feeac2d..730a164 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c90=['register','./mailMessage.events','remove','emit'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0x2c90,0xe5));var _0x02c9=function(_0x3e64d6,_0x557858){_0x3e64d6=_0x3e64d6-0x0;var _0x2c3419=_0x2c90[_0x3e64d6];return _0x2c3419;};'use strict';var MailMessageEvents=require(_0x02c9('0x0'));var events=['save',_0x02c9('0x1'),'update'];function createListener(_0x3b3825,_0x543717){return function(_0x53aef7){_0x543717[_0x02c9('0x2')](_0x3b3825,_0x53aef7);};}function removeListener(_0x82603a,_0x5ea6b1){return function(){MailMessageEvents['removeListener'](_0x82603a,_0x5ea6b1);};}exports[_0x02c9('0x3')]=function(_0x1fe97d){for(var _0x1adacb=0x0,_0x33d800=events['length'];_0x1adacb<_0x33d800;_0x1adacb++){var _0x43ec6f=events[_0x1adacb];var _0x2739c0=createListener('mailMessage:'+_0x43ec6f,_0x1fe97d);MailMessageEvents['on'](_0x43ec6f,_0x2739c0);}}; \ No newline at end of file +var _0x34bd=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x4badaf,_0x5922e6){var _0x302bb5=function(_0x147d32){while(--_0x147d32){_0x4badaf['push'](_0x4badaf['shift']());}};_0x302bb5(++_0x5922e6);}(_0x34bd,0x10e));var _0xd34b=function(_0x37aed4,_0x254b7d){_0x37aed4=_0x37aed4-0x0;var _0x1ec4f3=_0x34bd[_0x37aed4];return _0x1ec4f3;};'use strict';var MailMessageEvents=require(_0xd34b('0x0'));var events=['save',_0xd34b('0x1'),_0xd34b('0x2')];function createListener(_0x12c395,_0x349e88){return function(_0x5691d8){_0x349e88[_0xd34b('0x3')](_0x12c395,_0x5691d8);};}function removeListener(_0x4bb503,_0x79fb84){return function(){MailMessageEvents[_0xd34b('0x4')](_0x4bb503,_0x79fb84);};}exports[_0xd34b('0x5')]=function(_0x162ce){for(var _0x5b86d8=0x0,_0x4c2b6c=events[_0xd34b('0x6')];_0x5b86d8<_0x4c2b6c;_0x5b86d8++){var _0x3cea90=events[_0x5b86d8];var _0x59af22=createListener(_0xd34b('0x7')+_0x3cea90,_0x162ce);MailMessageEvents['on'](_0x3cea90,_0x59af22);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ba77a17..255ea59 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc76e=['show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x52a9a4,_0x5d352c){var _0x78da67=function(_0x2e561c){while(--_0x2e561c){_0x52a9a4['push'](_0x52a9a4['shift']());}};_0x78da67(++_0x5d352c);}(_0xc76e,0x109));var _0xec76=function(_0x33f0d5,_0x495718){_0x33f0d5=_0x33f0d5-0x0;var _0xc07131=_0xc76e[_0x33f0d5];return _0xc07131;};'use strict';var multer=require(_0xec76('0x0'));var util=require(_0xec76('0x1'));var path=require(_0xec76('0x2'));var timeout=require(_0xec76('0x3'));var express=require(_0xec76('0x4'));var router=express[_0xec76('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xec76('0x6'));var interaction=require(_0xec76('0x7'));var config=require(_0xec76('0x8'));var controller=require(_0xec76('0x9'));router[_0xec76('0xa')]('/',auth[_0xec76('0xb')](),controller[_0xec76('0xc')]);router['get'](_0xec76('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xec76('0xa')](_0xec76('0xe'),auth[_0xec76('0xb')](),controller[_0xec76('0xf')]);router[_0xec76('0xa')]('/:id/members',auth[_0xec76('0xb')](),controller['getMembers']);router['get'](_0xec76('0x10'),auth[_0xec76('0xb')](),controller[_0xec76('0x11')]);router['get'](_0xec76('0x12'),auth['isAuthenticated'](),controller[_0xec76('0x13')]);router[_0xec76('0x14')]('/',auth['isAuthenticated'](),controller[_0xec76('0x15')]);router[_0xec76('0x14')](_0xec76('0x10'),auth[_0xec76('0xb')](),controller[_0xec76('0x16')]);router[_0xec76('0x14')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xec76('0x17')](_0xec76('0xe'),auth[_0xec76('0xb')](),controller['update']);router['delete'](_0xec76('0xe'),auth['isAuthenticated'](),controller[_0xec76('0x18')]);router[_0xec76('0x19')](_0xec76('0x10'),auth[_0xec76('0xb')](),controller['removeTeams']);router[_0xec76('0x19')](_0xec76('0x12'),auth[_0xec76('0xb')](),controller[_0xec76('0x1a')]);module[_0xec76('0x1b')]=router; \ No newline at end of file +var _0x5163=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','removeTeams','delete','multer','util','path','express','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5163,0xa3));var _0x3516=function(_0x3433c4,_0x439a5e){_0x3433c4=_0x3433c4-0x0;var _0x4ddf99=_0x5163[_0x3433c4];return _0x4ddf99;};'use strict';var multer=require(_0x3516('0x0'));var util=require(_0x3516('0x1'));var path=require(_0x3516('0x2'));var timeout=require('connect-timeout');var express=require(_0x3516('0x3'));var router=express['Router']();var fs_extra=require(_0x3516('0x4'));var auth=require(_0x3516('0x5'));var interaction=require(_0x3516('0x6'));var config=require(_0x3516('0x7'));var controller=require('./mailQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3516('0x8')](_0x3516('0x9'),auth[_0x3516('0xa')](),controller[_0x3516('0xb')]);router['get'](_0x3516('0xc'),auth[_0x3516('0xa')](),controller[_0x3516('0xd')]);router['get']('/:id/members',auth[_0x3516('0xa')](),controller[_0x3516('0xe')]);router[_0x3516('0x8')](_0x3516('0xf'),auth[_0x3516('0xa')](),controller[_0x3516('0x10')]);router[_0x3516('0x8')](_0x3516('0x11'),auth[_0x3516('0xa')](),controller[_0x3516('0x12')]);router[_0x3516('0x13')]('/',auth['isAuthenticated'](),controller[_0x3516('0x14')]);router[_0x3516('0x13')](_0x3516('0xf'),auth[_0x3516('0xa')](),controller[_0x3516('0x15')]);router['post'](_0x3516('0x11'),auth[_0x3516('0xa')](),controller[_0x3516('0x16')]);router[_0x3516('0x17')]('/:id',auth[_0x3516('0xa')](),controller[_0x3516('0x18')]);router['delete'](_0x3516('0xc'),auth[_0x3516('0xa')](),controller[_0x3516('0x19')]);router['delete'](_0x3516('0xf'),auth[_0x3516('0xa')](),controller[_0x3516('0x1a')]);router[_0x3516('0x1b')](_0x3516('0x11'),auth[_0x3516('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5afd591..aaf5dc4 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39ee=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x9df1ed,_0x50690c){var _0x3ad581=function(_0x576f50){while(--_0x576f50){_0x9df1ed['push'](_0x9df1ed['shift']());}};_0x3ad581(++_0x50690c);}(_0x39ee,0x7b));var _0xe39e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39ee[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe39e('0x0'));module[_0xe39e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe39e('0x2')]},'timeout':{'type':Sequelize[_0xe39e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe39e('0x4')](_0xe39e('0x5'),_0xe39e('0x6'),_0xe39e('0x7'))}}; \ No newline at end of file +var _0xa6d1=['STRING','ENUM','sequelize'];(function(_0x37054d,_0x37bcae){var _0x3a6e4f=function(_0x2b0873){while(--_0x2b0873){_0x37054d['push'](_0x37054d['shift']());}};_0x3a6e4f(++_0x37bcae);}(_0xa6d1,0xb9));var _0x1a6d=function(_0x5bbf77,_0xbf75a7){_0x5bbf77=_0x5bbf77-0x0;var _0x49e6e3=_0xa6d1[_0x5bbf77];return _0x49e6e3;};'use strict';var Sequelize=require(_0x1a6d('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a6d('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a6d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a6d('0x2')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ba58f19..9c5bee3 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x736b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','offset','undefined','limit','Content-Range','json','reject','save','update','then','MailQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','MailQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','MailQueueId','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','online','interface','transaction','each','forEach','emit','userMailQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','every','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents'];(function(_0x13b53d,_0x2d40c6){var _0x45c927=function(_0x2973fc){while(--_0x2973fc){_0x13b53d['push'](_0x13b53d['shift']());}};_0x45c927(++_0x2d40c6);}(_0x736b,0x8a));var _0xb736=function(_0x462df4,_0x4ab1b5){_0x462df4=_0x462df4-0x0;var _0x4a9b2a=_0x736b[_0x462df4];return _0x4a9b2a;};'use strict';var emlformat=require(_0xb736('0x0'));var rimraf=require(_0xb736('0x1'));var zipdir=require(_0xb736('0x2'));var jsonpatch=require(_0xb736('0x3'));var rp=require(_0xb736('0x4'));var moment=require(_0xb736('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb736('0x6'));var util=require(_0xb736('0x7'));var path=require(_0xb736('0x8'));var sox=require(_0xb736('0x9'));var csv=require(_0xb736('0xa'));var ejs=require(_0xb736('0xb'));var fs=require('fs');var fs_extra=require(_0xb736('0xc'));var _=require(_0xb736('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb736('0xe'));var deskjs=require(_0xb736('0xf'));var toCsv=require(_0xb736('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb736('0x10'));var authService=require(_0xb736('0x11'));var qs=require(_0xb736('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb736('0x13'))('api');var utils=require(_0xb736('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb736('0x15'));var db=require(_0xb736('0x16'))['db'];config[_0xb736('0x17')]=_[_0xb736('0x18')](config[_0xb736('0x17')],{'host':_0xb736('0x19'),'port':0x18eb});var socket=require(_0xb736('0x1a'))(new Redis(config[_0xb736('0x17')]));require(_0xb736('0x1b'))[_0xb736('0x1c')](socket);function respondWithStatusCode(_0xea9652,_0x24441c){_0x24441c=_0x24441c||0xcc;return function(_0x5d335d){if(_0x5d335d){return _0xea9652['sendStatus'](_0x24441c);}return _0xea9652[_0xb736('0x1d')](_0x24441c)['end']();};}function respondWithResult(_0x1f4299,_0xbc42b0){_0xbc42b0=_0xbc42b0||0xc8;return function(_0x5bc285){if(_0x5bc285){return _0x1f4299[_0xb736('0x1d')](_0xbc42b0)['json'](_0x5bc285);}};}function respondWithFilteredResult(_0xb7ec77,_0x34effb){return function(_0x48d62a){if(_0x48d62a){var _0x229fa7=typeof _0x34effb[_0xb736('0x1e')]===_0xb736('0x1f')&&typeof _0x34effb[_0xb736('0x20')]===_0xb736('0x1f');var _0xbb2c47=_0x48d62a['count'];var _0x204b0b=_0x229fa7?0x0:_0x34effb['offset'];var _0x3c1e56=_0x229fa7?_0x48d62a['count']:_0x34effb[_0xb736('0x1e')]+_0x34effb['limit'];var _0x50b99b;if(_0x3c1e56>=_0xbb2c47){_0x3c1e56=_0xbb2c47;_0x50b99b=0xc8;}else{_0x50b99b=0xce;}_0xb7ec77['status'](_0x50b99b);return _0xb7ec77['set'](_0xb736('0x21'),_0x204b0b+'-'+_0x3c1e56+'/'+_0xbb2c47)[_0xb736('0x22')](_0x48d62a);}return null;};}function patchUpdates(_0x1b6664){return function(_0x3527d5){try{jsonpatch['apply'](_0x3527d5,_0x1b6664,!![]);}catch(_0x3d01e4){return BPromise[_0xb736('0x23')](_0x3d01e4);}return _0x3527d5[_0xb736('0x24')]();};}function saveUpdates(_0xf6d8cc,_0x3a30e6){return function(_0x1389f6){if(_0x1389f6){return _0x1389f6[_0xb736('0x25')](_0xf6d8cc)[_0xb736('0x26')](function(_0x4eca54){return _0x4eca54;});}return null;};}function removeEntity(_0x348867,_0x5a3e1f){return function(_0x5af324){if(_0x5af324){return _0x5af324['destroy']()['then'](function(){var _0x3a7f60=_0x5af324['get']({'plain':!![]});var _0x187df6=_0xb736('0x27');return db[_0xb736('0x28')][_0xb736('0x29')]({'where':{'type':_0x187df6,'resourceId':_0x3a7f60['id']}})[_0xb736('0x26')](function(){return _0x5af324;});})[_0xb736('0x26')](function(){_0x348867[_0xb736('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dba5f,_0x419288){return function(_0x26d4fa){if(!_0x26d4fa){_0x2dba5f[_0xb736('0x2a')](0x194);}return _0x26d4fa;};}function handleError(_0xeb46e4,_0x3015ff){_0x3015ff=_0x3015ff||0x1f4;return function(_0x4f2f49){logger['error'](_0x4f2f49[_0xb736('0x2b')]);if(_0x4f2f49[_0xb736('0x2c')]){delete _0x4f2f49[_0xb736('0x2c')];}_0xeb46e4[_0xb736('0x1d')](_0x3015ff)[_0xb736('0x2d')](_0x4f2f49);};}exports[_0xb736('0x2e')]=function(_0x96e197,_0x36af7f){var _0x23862a={},_0x595b03={},_0x4b96d8={'count':0x0,'rows':[]};var _0x331bbc=_[_0xb736('0x2f')](db[_0xb736('0x30')]['rawAttributes'],function(_0x21d1f9){return{'name':_0x21d1f9[_0xb736('0x31')],'type':_0x21d1f9['type'][_0xb736('0x32')]};});_0x595b03[_0xb736('0x33')]=_['map'](_0x331bbc,_0xb736('0x2c'));_0x595b03[_0xb736('0x34')]=_[_0xb736('0x35')](_0x96e197[_0xb736('0x34')]);_0x595b03[_0xb736('0x36')]=_[_0xb736('0x37')](_0x595b03[_0xb736('0x33')],_0x595b03[_0xb736('0x34')]);_0x23862a[_0xb736('0x38')]=_[_0xb736('0x37')](_0x595b03[_0xb736('0x33')],qs['fields'](_0x96e197[_0xb736('0x34')][_0xb736('0x39')]));_0x23862a[_0xb736('0x38')]=_0x23862a['attributes'][_0xb736('0x3a')]?_0x23862a[_0xb736('0x38')]:_0x595b03[_0xb736('0x33')];if(!_0x96e197[_0xb736('0x34')]['hasOwnProperty']('nolimit')){_0x23862a[_0xb736('0x20')]=qs[_0xb736('0x20')](_0x96e197[_0xb736('0x34')][_0xb736('0x20')]);_0x23862a[_0xb736('0x1e')]=qs[_0xb736('0x1e')](_0x96e197[_0xb736('0x34')][_0xb736('0x1e')]);}_0x23862a['order']=qs[_0xb736('0x3b')](_0x96e197[_0xb736('0x34')][_0xb736('0x3b')]);_0x23862a[_0xb736('0x3c')]=qs['filters'](_[_0xb736('0x3d')](_0x96e197['query'],_0x595b03[_0xb736('0x36')]),_0x331bbc);if(_0x96e197[_0xb736('0x34')][_0xb736('0x3e')]){_0x23862a[_0xb736('0x3c')]=_[_0xb736('0x3f')](_0x23862a[_0xb736('0x3c')],{'$or':_['map'](_0x331bbc,function(_0x520399){if(_0x520399['type']!==_0xb736('0x40')){var _0xe736cd={};_0xe736cd[_0x520399['name']]={'$like':'%'+_0x96e197['query']['filter']+'%'};return _0xe736cd;}})});}_0x23862a=_[_0xb736('0x3f')]({},_0x23862a,_0x96e197[_0xb736('0x41')]);var _0x1db12f={'where':_0x23862a[_0xb736('0x3c')]};return db[_0xb736('0x30')][_0xb736('0x42')](_0x1db12f)['then'](function(_0x2db525){_0x4b96d8[_0xb736('0x42')]=_0x2db525;if(_0x96e197[_0xb736('0x34')][_0xb736('0x43')]){_0x23862a[_0xb736('0x44')]=[{'all':!![]}];}return db[_0xb736('0x30')][_0xb736('0x45')](_0x23862a);})[_0xb736('0x26')](function(_0x3fde4a){_0x4b96d8[_0xb736('0x46')]=_0x3fde4a;return _0x4b96d8;})['then'](respondWithFilteredResult(_0x36af7f,_0x23862a))[_0xb736('0x47')](handleError(_0x36af7f,null));};exports[_0xb736('0x48')]=function(_0x322dc1,_0x55e395){var _0x1f23f4={'raw':!![],'where':{'id':_0x322dc1[_0xb736('0x49')]['id']}},_0x137a62={};_0x137a62['model']=_[_0xb736('0x35')](db[_0xb736('0x30')][_0xb736('0x4a')]);_0x137a62['query']=_[_0xb736('0x35')](_0x322dc1[_0xb736('0x34')]);_0x137a62[_0xb736('0x36')]=_[_0xb736('0x37')](_0x137a62[_0xb736('0x33')],_0x137a62[_0xb736('0x34')]);_0x1f23f4[_0xb736('0x38')]=_['intersection'](_0x137a62[_0xb736('0x33')],qs[_0xb736('0x39')](_0x322dc1[_0xb736('0x34')]['fields']));_0x1f23f4[_0xb736('0x38')]=_0x1f23f4[_0xb736('0x38')][_0xb736('0x3a')]?_0x1f23f4[_0xb736('0x38')]:_0x137a62[_0xb736('0x33')];if(_0x322dc1[_0xb736('0x34')]['includeAll']){_0x1f23f4[_0xb736('0x44')]=[{'all':!![]}];}_0x1f23f4=_[_0xb736('0x3f')]({},_0x1f23f4,_0x322dc1['options']);return db[_0xb736('0x30')][_0xb736('0x4b')](_0x1f23f4)[_0xb736('0x26')](handleEntityNotFound(_0x55e395,null))[_0xb736('0x26')](respondWithResult(_0x55e395,null))[_0xb736('0x47')](handleError(_0x55e395,null));};exports[_0xb736('0x4c')]=function(_0x11342f,_0x18098f){return db[_0xb736('0x30')]['create'](_0x11342f[_0xb736('0x4d')],{})[_0xb736('0x26')](function(_0x119be5){var _0x21025f=_0x11342f['user'][_0xb736('0x4e')]({'plain':!![]});if(!_0x21025f)throw new Error(_0xb736('0x4f'));if(_0x21025f[_0xb736('0x50')]==='user'){var _0x1c85f4=_0x119be5[_0xb736('0x4e')]({'plain':!![]});var _0x30092d=_0xb736('0x27');return db[_0xb736('0x51')]['find']({'where':{'name':_0x30092d,'userProfileId':_0x21025f[_0xb736('0x52')]},'raw':!![]})['then'](function(_0x5148cb){if(_0x5148cb&&_0x5148cb['autoAssociation']===0x0){return db[_0xb736('0x28')]['create']({'name':_0x1c85f4['name'],'resourceId':_0x1c85f4['id'],'type':_0x5148cb['name'],'sectionId':_0x5148cb['id']},{})['then'](function(){return _0x119be5;});}else{return _0x119be5;}})[_0xb736('0x47')](function(_0xeb8228){logger[_0xb736('0x53')](_0xb736('0x54'),_0xeb8228);throw _0xeb8228;});}return _0x119be5;})[_0xb736('0x26')](respondWithResult(_0x18098f,0xc9))[_0xb736('0x47')](handleError(_0x18098f,null));};exports['update']=function(_0x392a7b,_0x269fc5){if(_0x392a7b[_0xb736('0x4d')]['id']){delete _0x392a7b[_0xb736('0x4d')]['id'];}return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0x392a7b[_0xb736('0x49')]['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x269fc5,null))['then'](saveUpdates(_0x392a7b[_0xb736('0x4d')],null))[_0xb736('0x26')](respondWithResult(_0x269fc5,null))[_0xb736('0x47')](handleError(_0x269fc5,null));};exports['destroy']=function(_0x152b6e,_0xc832dc){return db[_0xb736('0x30')]['find']({'where':{'id':_0x152b6e[_0xb736('0x49')]['id']}})['then'](handleEntityNotFound(_0xc832dc,null))[_0xb736('0x26')](removeEntity(_0xc832dc,null))['catch'](handleError(_0xc832dc,null));};exports[_0xb736('0x55')]=function(_0x3aecf9,_0x31f5ef){return db['MailQueue'][_0xb736('0x55')]()[_0xb736('0x26')](respondWithResult(_0x31f5ef,null))[_0xb736('0x47')](handleError(_0x31f5ef,null));};exports['getMembers']=function(_0x1bf389,_0x40640c,_0x1a817c){var _0x36e386={'raw':!![],'where':{}},_0x14aa2a={},_0x508241;return db[_0xb736('0x30')][_0xb736('0x56')]({'where':{'id':_0x1bf389[_0xb736('0x49')]['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x40640c,null))['then'](function(_0x52474a){if(_0x52474a){_0x508241=_0x52474a[_0xb736('0x4e')]({'plain':!![]});_0x14aa2a[_0xb736('0x33')]=_[_0xb736('0x35')](db[_0xb736('0x57')][_0xb736('0x4a')]);_0x14aa2a[_0xb736('0x34')]=_[_0xb736('0x35')](_0x1bf389[_0xb736('0x34')]);_0x14aa2a[_0xb736('0x36')]=_[_0xb736('0x37')](_0x14aa2a[_0xb736('0x33')],_0x14aa2a['query']);_0x36e386[_0xb736('0x38')]=_[_0xb736('0x37')](_0x14aa2a[_0xb736('0x33')],qs['fields'](_0x1bf389[_0xb736('0x34')]['fields']));_0x36e386[_0xb736('0x38')]=_0x36e386[_0xb736('0x38')][_0xb736('0x3a')]?_0x36e386[_0xb736('0x38')]:_0x14aa2a['model'];if(!_0x1bf389[_0xb736('0x34')][_0xb736('0x58')](_0xb736('0x59'))){_0x36e386[_0xb736('0x20')]=qs[_0xb736('0x20')](_0x1bf389['query'][_0xb736('0x20')]);_0x36e386[_0xb736('0x1e')]=qs['offset'](_0x1bf389['query'][_0xb736('0x1e')]);}_0x36e386[_0xb736('0x5a')]=qs[_0xb736('0x3b')](_0x1bf389['query'][_0xb736('0x3b')]);_0x36e386['where']=qs[_0xb736('0x36')](_[_0xb736('0x3d')](_0x1bf389[_0xb736('0x34')],_0x14aa2a[_0xb736('0x36')]));_0x36e386[_0xb736('0x3c')][_0xb736('0x5b')]=_0x52474a['id'];if(_0x1bf389[_0xb736('0x34')][_0xb736('0x3e')]){_0x36e386[_0xb736('0x3c')]=_[_0xb736('0x3f')](_0x36e386[_0xb736('0x3c')],{'$or':_[_0xb736('0x2f')](_0x36e386[_0xb736('0x38')],function(_0x4cb524){var _0x2de064={};_0x2de064[_0x4cb524]={'$like':'%'+_0x1bf389[_0xb736('0x34')][_0xb736('0x3e')]+'%'};return _0x2de064;})});}_0x36e386=_[_0xb736('0x3f')]({},_0x36e386,_0x1bf389[_0xb736('0x41')]);return db[_0xb736('0x57')]['findAll'](_0x36e386);}})['then'](function(_0x4a0e65){if(_0x4a0e65){return db['User']['findAndCountAll']({'where':{'id':_[_0xb736('0x2f')](_0x4a0e65,_0xb736('0x5c')),'role':_0xb736('0x5d')},'attributes':['id',_0xb736('0x2c'),_0xb736('0x5e'),_0xb736('0x5f'),_0xb736('0x60')]});}})[_0xb736('0x26')](function(_0x48f335){if(_0x48f335){return{'count':_0x48f335[_0xb736('0x42')],'rows':_['map'](_0x48f335['rows'],function(_0x10a9c8){return{'membername':_0x10a9c8['name'],'UserId':_0x10a9c8['id'],'queue_name':_0x508241[_0xb736('0x2c')],'MailQueueId':_0x508241['id'],'interface':util[_0xb736('0x61')](_0xb736('0x62'),_0xb736('0x63'),_0x10a9c8['name']),'penalty':0x0,'paused':_0x10a9c8[_0xb736('0x5e')],'createdAt':_0x10a9c8[_0xb736('0x60')],'updatedAt':_0x10a9c8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x40640c,_0x36e386))['catch'](handleError(_0x40640c,null));};exports['getTeams']=function(_0x5eb164,_0x4e15a1,_0x36b376){var _0x7ce863={};var _0x381e2e={};var _0x44986a;var _0x34fb3b;return db['MailQueue'][_0xb736('0x56')]({'where':{'id':_0x5eb164[_0xb736('0x49')]['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x4e15a1,null))[_0xb736('0x26')](function(_0x358bf5){if(_0x358bf5){_0x44986a=_0x358bf5;_0x381e2e['model']=_[_0xb736('0x35')](db[_0xb736('0x64')][_0xb736('0x4a')]);_0x381e2e[_0xb736('0x34')]=_[_0xb736('0x35')](_0x5eb164[_0xb736('0x34')]);_0x381e2e['filters']=_[_0xb736('0x37')](_0x381e2e[_0xb736('0x33')],_0x381e2e['query']);_0x7ce863[_0xb736('0x38')]=_['intersection'](_0x381e2e[_0xb736('0x33')],qs['fields'](_0x5eb164[_0xb736('0x34')][_0xb736('0x39')]));_0x7ce863[_0xb736('0x38')]=_0x7ce863[_0xb736('0x38')][_0xb736('0x3a')]?_0x7ce863[_0xb736('0x38')]:_0x381e2e['model'];_0x7ce863[_0xb736('0x5a')]=qs[_0xb736('0x3b')](_0x5eb164[_0xb736('0x34')][_0xb736('0x3b')]);_0x7ce863[_0xb736('0x3c')]=qs[_0xb736('0x36')](_[_0xb736('0x3d')](_0x5eb164['query'],_0x381e2e[_0xb736('0x36')]));if(_0x5eb164[_0xb736('0x34')][_0xb736('0x3e')]){_0x7ce863[_0xb736('0x3c')]=_[_0xb736('0x3f')](_0x7ce863[_0xb736('0x3c')],{'$or':_[_0xb736('0x2f')](_0x7ce863[_0xb736('0x38')],function(_0x25426d){var _0x4787ee={};_0x4787ee[_0x25426d]={'$like':'%'+_0x5eb164[_0xb736('0x34')]['filter']+'%'};return _0x4787ee;})});}_0x7ce863=_[_0xb736('0x3f')]({},_0x7ce863,_0x5eb164['options']);return _0x44986a[_0xb736('0x65')](_0x7ce863);}})[_0xb736('0x26')](function(_0x435b7c){if(_0x435b7c){_0x34fb3b=_0x435b7c['length'];if(!_0x5eb164[_0xb736('0x34')][_0xb736('0x58')](_0xb736('0x59'))){_0x7ce863['limit']=qs[_0xb736('0x20')](_0x5eb164[_0xb736('0x34')][_0xb736('0x20')]);_0x7ce863[_0xb736('0x1e')]=qs[_0xb736('0x1e')](_0x5eb164[_0xb736('0x34')]['offset']);}return _0x44986a['getTeams'](_0x7ce863);}})[_0xb736('0x26')](function(_0x1b3f87){if(_0x1b3f87){return _0x1b3f87?{'count':_0x34fb3b,'rows':_0x1b3f87}:null;}})[_0xb736('0x26')](respondWithResult(_0x4e15a1,null))[_0xb736('0x47')](handleError(_0x4e15a1,null));};exports[_0xb736('0x66')]=function(_0xaa639,_0x21e9d2,_0x187887){var _0x55e952=_0xaa639[_0xb736('0x4d')][_0xb736('0x67')];return db[_0xb736('0x64')][_0xb736('0x45')]({'where':{'id':_0x55e952},'attributes':['id'],'include':[{'model':db[_0xb736('0x68')],'as':'Agents','attributes':['id','name',_0xb736('0x69'),'voicePause',_0xb736('0x6a')],'raw':!![]}]})[_0xb736('0x26')](function(_0x728a25){if(_0x728a25){var _0x34bfe8=_['flatMap'](_0x728a25,function(_0x344d2b){var _0x8a31bc=_0x344d2b[_0xb736('0x4e')]({'plain':!![]});return _0x8a31bc['Agents'];});return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0xaa639[_0xb736('0x49')]['id']}})['then'](function(_0x4c6e70){return db['sequelize'][_0xb736('0x6b')](function(_0x50f9f7){return _0x4c6e70[_0xb736('0x66')](_0x55e952,{'transaction':_0x50f9f7})['then'](function(){return BPromise[_0xb736('0x6c')](_0x34bfe8,function(_0x3c4083){return db[_0xb736('0x57')]['findOrCreate']({'where':{'UserId':_0x3c4083['id'],'MailQueueId':_0xaa639[_0xb736('0x49')]['id']},'transaction':_0x50f9f7});});})['then'](function(){_0x34bfe8[_0xb736('0x6d')](function(_0x5c325e){socket[_0xb736('0x6e')](_0xb736('0x6f'),{'UserId':_0x5c325e['id'],'MailQueueId':_0x4c6e70['id']});});});});});}})['then'](respondWithStatusCode(_0x21e9d2,null))['catch'](handleError(_0x21e9d2,null));};exports[_0xb736('0x70')]=function(_0xfca020,_0x43df33,_0x4ccc09){return db[_0xb736('0x64')][_0xb736('0x45')]({'where':{'id':_0xfca020[_0xb736('0x34')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb736('0x71'),'attributes':['id'],'raw':!![]}]})[_0xb736('0x26')](handleEntityNotFound(_0x43df33,null))[_0xb736('0x26')](function(_0x3fddf6){var _0x29038c=_['map'](_0x3fddf6,'id');var _0x1515b7=[];var _0xf138f6=[];var _0x48c7b5=squel[_0xb736('0x72')]();_0x48c7b5[_0xb736('0x73')](_0xb736('0x74'))[_0xb736('0x75')](_0xb736('0x76'),'tq')[_0xb736('0x77')](_0xb736('0x78'),'ut',_0xb736('0x79'))[_0xb736('0x3c')](_0xb736('0x7a'),_0xfca020[_0xb736('0x49')]['id']);for(var _0x48c0f8=0x0;_0x48c0f8<_0x3fddf6[_0xb736('0x3a')];_0x48c0f8+=0x1){let _0x464d03=_0x3fddf6[_0x48c0f8];for(var _0x2dcd92=0x0;_0x2dcd92<_0x464d03['Agents'][_0xb736('0x3a')];_0x2dcd92+=0x1){let _0x989742=_0x464d03[_0xb736('0x71')][_0x2dcd92];var _0x17f54a=_0x48c7b5[_0xb736('0x7b')]();_0x17f54a[_0xb736('0x3c')](_0xb736('0x7c'),_0x989742['id']);_0xf138f6['push'](db['sequelize']['query'](_0x17f54a['toString'](),{'type':db[_0xb736('0x7d')][_0xb736('0x7e')]['SELECT']})[_0xb736('0x26')](function(_0x1e269b){if(_0x1e269b['length']===0x1){return _0x989742['id'];}else{var _0x958ce5=_[_0xb736('0x7f')](_['map'](_0x1e269b,'TeamId'),function(_0x284b58){return _['includes'](_0x29038c,_0x284b58);});if(_0x958ce5){return _0x989742['id'];}}}));}}return BPromise['all'](_0xf138f6)[_0xb736('0x26')](function(_0xd5c527){_0x1515b7=_(_0x1515b7)[_0xb736('0x80')](_0xd5c527)['compact']()[_0xb736('0x81')]();return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0xfca020['params']['id']}})['then'](function(_0x31b75b){return db[_0xb736('0x7d')]['transaction'](function(_0x5cb633){return _0x31b75b['removeTeams'](_0xfca020['query'][_0xb736('0x67')],{'transaction':_0x5cb633})[_0xb736('0x26')](function(){if(!_[_0xb736('0x82')](_0x1515b7)){return _0x31b75b[_0xb736('0x83')](_0x1515b7,{'transaction':_0x5cb633});}})[_0xb736('0x26')](function(){_0x1515b7[_0xb736('0x6d')](function(_0x3aa012){socket[_0xb736('0x6e')](_0xb736('0x84'),{'UserId':_0x3aa012,'MailQueueId':_0x31b75b['id']});});});});});});})[_0xb736('0x26')](respondWithStatusCode(_0x43df33,null))['catch'](handleError(_0x43df33,null));};exports[_0xb736('0x85')]=function(_0x2d16b3,_0x2bb522,_0xb7c45a){return db[_0xb736('0x30')]['find']({'where':{'id':_0x2d16b3['params']['id']}})[_0xb736('0x26')](handleEntityNotFound(_0x2bb522,null))[_0xb736('0x26')](function(_0x7ba16b){if(_0x7ba16b){return _0x7ba16b[_0xb736('0x85')](_0x2d16b3['body'][_0xb736('0x67')],_[_0xb736('0x86')](_0x2d16b3['body'],[_0xb736('0x67'),'id'])||{})[_0xb736('0x87')](function(_0xead7e8){for(var _0x2201fc=0x0;_0x2201fc<_0x2d16b3['body'][_0xb736('0x67')][_0xb736('0x3a')];_0x2201fc+=0x1){socket[_0xb736('0x6e')](_0xb736('0x6f'),{'UserId':Number(_0x2d16b3[_0xb736('0x4d')][_0xb736('0x67')][_0x2201fc]),'MailQueueId':Number(_0x2d16b3[_0xb736('0x49')]['id'])});}return _0xead7e8;});}})[_0xb736('0x26')](respondWithResult(_0x2bb522,null))['catch'](handleError(_0x2bb522,null));};exports[_0xb736('0x83')]=function(_0x58cd4e,_0x19c992,_0x17cbcd){return db[_0xb736('0x30')][_0xb736('0x4b')]({'where':{'id':_0x58cd4e['params']['id']}})['then'](handleEntityNotFound(_0x19c992,null))['then'](function(_0x66b835){if(_0x66b835){return _0x66b835['removeAgents'](_0x58cd4e[_0xb736('0x34')][_0xb736('0x67')])[_0xb736('0x26')](function(){if(_[_0xb736('0x88')](_0x58cd4e['query'][_0xb736('0x67')])){for(var _0x16f64f=0x0;_0x16f64f<_0x58cd4e['query'][_0xb736('0x67')][_0xb736('0x3a')];_0x16f64f+=0x1){socket[_0xb736('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x58cd4e[_0xb736('0x34')][_0xb736('0x67')][_0x16f64f]),'MailQueueId':Number(_0x58cd4e[_0xb736('0x49')]['id'])});}}else{socket[_0xb736('0x6e')](_0xb736('0x84'),{'UserId':Number(_0x58cd4e[_0xb736('0x34')][_0xb736('0x67')]),'MailQueueId':Number(_0x58cd4e[_0xb736('0x49')]['id'])});}});}})[_0xb736('0x26')](respondWithStatusCode(_0x19c992,null))[_0xb736('0x47')](handleError(_0x19c992,null));};exports[_0xb736('0x89')]=function(_0x3bf2f0,_0x1158d8,_0x481263){var _0x56acb1={};var _0x49dbdb={};var _0x2ed05d;var _0xc9c2a4;return db[_0xb736('0x30')][_0xb736('0x56')]({'where':{'id':_0x3bf2f0[_0xb736('0x49')]['id']}})['then'](handleEntityNotFound(_0x1158d8,null))['then'](function(_0x3fac3a){if(_0x3fac3a){_0x2ed05d=_0x3fac3a;_0x49dbdb['model']=_[_0xb736('0x35')](db['User'][_0xb736('0x4a')]);_0x49dbdb['query']=_[_0xb736('0x35')](_0x3bf2f0['query']);_0x49dbdb[_0xb736('0x36')]=_[_0xb736('0x37')](_0x49dbdb[_0xb736('0x33')],_0x49dbdb[_0xb736('0x34')]);_0x56acb1[_0xb736('0x38')]=_[_0xb736('0x37')](_0x49dbdb[_0xb736('0x33')],qs['fields'](_0x3bf2f0[_0xb736('0x34')][_0xb736('0x39')]));_0x56acb1[_0xb736('0x38')]=_0x56acb1[_0xb736('0x38')]['length']?_0x56acb1[_0xb736('0x38')]:_0x49dbdb['model'];_0x56acb1['order']=qs['sort'](_0x3bf2f0['query'][_0xb736('0x3b')]);_0x56acb1[_0xb736('0x3c')]=qs[_0xb736('0x36')](_[_0xb736('0x3d')](_0x3bf2f0[_0xb736('0x34')],_0x49dbdb[_0xb736('0x36')]));if(_0x3bf2f0[_0xb736('0x34')][_0xb736('0x3e')]){_0x56acb1['where']=_['merge'](_0x56acb1[_0xb736('0x3c')],{'$or':_[_0xb736('0x2f')](_0x56acb1[_0xb736('0x38')],function(_0x260a8d){var _0x2605ed={};_0x2605ed[_0x260a8d]={'$like':'%'+_0x3bf2f0[_0xb736('0x34')][_0xb736('0x3e')]+'%'};return _0x2605ed;})});}_0x56acb1=_[_0xb736('0x3f')]({},_0x56acb1,_0x3bf2f0[_0xb736('0x41')]);return _0x2ed05d[_0xb736('0x89')](_0x56acb1);}})['then'](function(_0x567d8e){if(_0x567d8e){_0xc9c2a4=_0x567d8e['length'];if(!_0x3bf2f0[_0xb736('0x34')]['hasOwnProperty'](_0xb736('0x59'))){_0x56acb1['limit']=qs[_0xb736('0x20')](_0x3bf2f0[_0xb736('0x34')][_0xb736('0x20')]);_0x56acb1['offset']=qs[_0xb736('0x1e')](_0x3bf2f0[_0xb736('0x34')]['offset']);}return _0x2ed05d['getAgents'](_0x56acb1);}})[_0xb736('0x26')](function(_0x568174){if(_0x568174){return _0x568174?{'count':_0xc9c2a4,'rows':_0x568174}:null;}})['then'](respondWithResult(_0x1158d8,null))[_0xb736('0x47')](handleError(_0x1158d8,null));}; \ No newline at end of file +var _0x56ce=['options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','update','describe','getMembers','UserMailQueue','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','User','online','voicePause','Agents','transaction','addTeams','each','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','every','TeamId','includes','all','union','removeTeams','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','offset','undefined','limit','count','status','set','json','save','then','destroy','MailQueues','end','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge'];(function(_0x2d697c,_0xb804eb){var _0x1a4cc0=function(_0x271e6b){while(--_0x271e6b){_0x2d697c['push'](_0x2d697c['shift']());}};_0x1a4cc0(++_0xb804eb);}(_0x56ce,0x1e9));var _0xe56c=function(_0x259038,_0x496071){_0x259038=_0x259038-0x0;var _0x30fb6b=_0x56ce[_0x259038];return _0x30fb6b;};'use strict';var emlformat=require(_0xe56c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe56c('0x1'));var jsonpatch=require(_0xe56c('0x2'));var rp=require(_0xe56c('0x3'));var moment=require(_0xe56c('0x4'));var BPromise=require(_0xe56c('0x5'));var Mustache=require(_0xe56c('0x6'));var util=require(_0xe56c('0x7'));var path=require(_0xe56c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe56c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe56c('0xa'));var squel=require(_0xe56c('0xb'));var crypto=require(_0xe56c('0xc'));var jsforce=require(_0xe56c('0xd'));var deskjs=require(_0xe56c('0xe'));var toCsv=require(_0xe56c('0xf'));var querystring=require(_0xe56c('0x10'));var Papa=require(_0xe56c('0x11'));var Redis=require(_0xe56c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe56c('0x13'));var hardwareService=require(_0xe56c('0x14'));var logger=require(_0xe56c('0x15'))(_0xe56c('0x16'));var utils=require(_0xe56c('0x17'));var config=require(_0xe56c('0x18'));var licenseUtil=require(_0xe56c('0x19'));var db=require(_0xe56c('0x1a'))['db'];config[_0xe56c('0x1b')]=_[_0xe56c('0x1c')](config[_0xe56c('0x1b')],{'host':_0xe56c('0x1d'),'port':0x18eb});var socket=require(_0xe56c('0x1e'))(new Redis(config[_0xe56c('0x1b')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0xf5177b,_0x356d7a){_0x356d7a=_0x356d7a||0xcc;return function(_0x218d7a){if(_0x218d7a){return _0xf5177b[_0xe56c('0x1f')](_0x356d7a);}return _0xf5177b['status'](_0x356d7a)['end']();};}function respondWithResult(_0x46f350,_0x58a8c8){_0x58a8c8=_0x58a8c8||0xc8;return function(_0x173669){if(_0x173669){return _0x46f350['status'](_0x58a8c8)['json'](_0x173669);}};}function respondWithFilteredResult(_0xf19778,_0x534300){return function(_0x3d80bb){if(_0x3d80bb){var _0x32db0f=typeof _0x534300[_0xe56c('0x20')]===_0xe56c('0x21')&&typeof _0x534300[_0xe56c('0x22')]===_0xe56c('0x21');var _0x27870c=_0x3d80bb[_0xe56c('0x23')];var _0x8c0afd=_0x32db0f?0x0:_0x534300['offset'];var _0x87b2ad=_0x32db0f?_0x3d80bb[_0xe56c('0x23')]:_0x534300[_0xe56c('0x20')]+_0x534300[_0xe56c('0x22')];var _0x562461;if(_0x87b2ad>=_0x27870c){_0x87b2ad=_0x27870c;_0x562461=0xc8;}else{_0x562461=0xce;}_0xf19778[_0xe56c('0x24')](_0x562461);return _0xf19778[_0xe56c('0x25')]('Content-Range',_0x8c0afd+'-'+_0x87b2ad+'/'+_0x27870c)[_0xe56c('0x26')](_0x3d80bb);}return null;};}function patchUpdates(_0x34d36c){return function(_0x26b862){try{jsonpatch['apply'](_0x26b862,_0x34d36c,!![]);}catch(_0x45f7bc){return BPromise['reject'](_0x45f7bc);}return _0x26b862[_0xe56c('0x27')]();};}function saveUpdates(_0x4bf585,_0x17432f){return function(_0x40dbc6){if(_0x40dbc6){return _0x40dbc6['update'](_0x4bf585)[_0xe56c('0x28')](function(_0xd96297){return _0xd96297;});}return null;};}function removeEntity(_0x21202e,_0x3cf868){return function(_0x29e421){if(_0x29e421){return _0x29e421[_0xe56c('0x29')]()[_0xe56c('0x28')](function(){var _0x33fc5d=_0x29e421['get']({'plain':!![]});var _0x2e7e70=_0xe56c('0x2a');return db['UserProfileResource'][_0xe56c('0x29')]({'where':{'type':_0x2e7e70,'resourceId':_0x33fc5d['id']}})[_0xe56c('0x28')](function(){return _0x29e421;});})[_0xe56c('0x28')](function(){_0x21202e[_0xe56c('0x24')](0xcc)[_0xe56c('0x2b')]();});}};}function handleEntityNotFound(_0xc9f0dd,_0x6336a){return function(_0x5f2676){if(!_0x5f2676){_0xc9f0dd['sendStatus'](0x194);}return _0x5f2676;};}function handleError(_0x486608,_0x321ab0){_0x321ab0=_0x321ab0||0x1f4;return function(_0x232ea0){logger[_0xe56c('0x2c')](_0x232ea0[_0xe56c('0x2d')]);if(_0x232ea0[_0xe56c('0x2e')]){delete _0x232ea0['name'];}_0x486608[_0xe56c('0x24')](_0x321ab0)[_0xe56c('0x2f')](_0x232ea0);};}exports[_0xe56c('0x30')]=function(_0x11b98f,_0x2f4235){var _0x5f2318={},_0x80bebd={},_0x22b499={'count':0x0,'rows':[]};var _0x485141=_[_0xe56c('0x31')](db[_0xe56c('0x32')][_0xe56c('0x33')],function(_0x462bc8){return{'name':_0x462bc8[_0xe56c('0x34')],'type':_0x462bc8['type'][_0xe56c('0x35')]};});_0x80bebd['model']=_[_0xe56c('0x31')](_0x485141,_0xe56c('0x2e'));_0x80bebd['query']=_[_0xe56c('0x36')](_0x11b98f[_0xe56c('0x37')]);_0x80bebd[_0xe56c('0x38')]=_[_0xe56c('0x39')](_0x80bebd[_0xe56c('0x3a')],_0x80bebd[_0xe56c('0x37')]);_0x5f2318[_0xe56c('0x3b')]=_[_0xe56c('0x39')](_0x80bebd['model'],qs[_0xe56c('0x3c')](_0x11b98f[_0xe56c('0x37')][_0xe56c('0x3c')]));_0x5f2318[_0xe56c('0x3b')]=_0x5f2318[_0xe56c('0x3b')][_0xe56c('0x3d')]?_0x5f2318[_0xe56c('0x3b')]:_0x80bebd[_0xe56c('0x3a')];if(!_0x11b98f['query'][_0xe56c('0x3e')](_0xe56c('0x3f'))){_0x5f2318[_0xe56c('0x22')]=qs[_0xe56c('0x22')](_0x11b98f[_0xe56c('0x37')][_0xe56c('0x22')]);_0x5f2318['offset']=qs[_0xe56c('0x20')](_0x11b98f[_0xe56c('0x37')][_0xe56c('0x20')]);}_0x5f2318[_0xe56c('0x40')]=qs['sort'](_0x11b98f[_0xe56c('0x37')][_0xe56c('0x41')]);_0x5f2318[_0xe56c('0x42')]=qs['filters'](_[_0xe56c('0x43')](_0x11b98f[_0xe56c('0x37')],_0x80bebd[_0xe56c('0x38')]),_0x485141);if(_0x11b98f['query']['filter']){_0x5f2318[_0xe56c('0x42')]=_['merge'](_0x5f2318[_0xe56c('0x42')],{'$or':_[_0xe56c('0x31')](_0x485141,function(_0x3e96dd){if(_0x3e96dd[_0xe56c('0x44')]!=='VIRTUAL'){var _0x487119={};_0x487119[_0x3e96dd[_0xe56c('0x2e')]]={'$like':'%'+_0x11b98f[_0xe56c('0x37')][_0xe56c('0x45')]+'%'};return _0x487119;}})});}_0x5f2318=_[_0xe56c('0x46')]({},_0x5f2318,_0x11b98f[_0xe56c('0x47')]);var _0x191ccd={'where':_0x5f2318[_0xe56c('0x42')]};return db[_0xe56c('0x32')][_0xe56c('0x23')](_0x191ccd)['then'](function(_0x97d6bb){_0x22b499['count']=_0x97d6bb;if(_0x11b98f[_0xe56c('0x37')][_0xe56c('0x48')]){_0x5f2318[_0xe56c('0x49')]=[{'all':!![]}];}return db[_0xe56c('0x32')][_0xe56c('0x4a')](_0x5f2318);})[_0xe56c('0x28')](function(_0x2f8c17){_0x22b499[_0xe56c('0x4b')]=_0x2f8c17;return _0x22b499;})['then'](respondWithFilteredResult(_0x2f4235,_0x5f2318))[_0xe56c('0x4c')](handleError(_0x2f4235,null));};exports['show']=function(_0x4ce8d8,_0x50cb31){var _0x3d4692={'raw':!![],'where':{'id':_0x4ce8d8[_0xe56c('0x4d')]['id']}},_0x545399={};_0x545399[_0xe56c('0x3a')]=_[_0xe56c('0x36')](db[_0xe56c('0x32')][_0xe56c('0x33')]);_0x545399['query']=_[_0xe56c('0x36')](_0x4ce8d8[_0xe56c('0x37')]);_0x545399[_0xe56c('0x38')]=_[_0xe56c('0x39')](_0x545399[_0xe56c('0x3a')],_0x545399['query']);_0x3d4692[_0xe56c('0x3b')]=_['intersection'](_0x545399[_0xe56c('0x3a')],qs[_0xe56c('0x3c')](_0x4ce8d8[_0xe56c('0x37')][_0xe56c('0x3c')]));_0x3d4692[_0xe56c('0x3b')]=_0x3d4692[_0xe56c('0x3b')][_0xe56c('0x3d')]?_0x3d4692['attributes']:_0x545399[_0xe56c('0x3a')];if(_0x4ce8d8[_0xe56c('0x37')][_0xe56c('0x48')]){_0x3d4692['include']=[{'all':!![]}];}_0x3d4692=_[_0xe56c('0x46')]({},_0x3d4692,_0x4ce8d8[_0xe56c('0x47')]);return db['MailQueue'][_0xe56c('0x4e')](_0x3d4692)[_0xe56c('0x28')](handleEntityNotFound(_0x50cb31,null))['then'](respondWithResult(_0x50cb31,null))[_0xe56c('0x4c')](handleError(_0x50cb31,null));};exports[_0xe56c('0x4f')]=function(_0x417940,_0x2d70dd){return db[_0xe56c('0x32')][_0xe56c('0x4f')](_0x417940[_0xe56c('0x50')],{})[_0xe56c('0x28')](function(_0x3d77af){var _0x8df016=_0x417940[_0xe56c('0x51')][_0xe56c('0x52')]({'plain':!![]});if(!_0x8df016)throw new Error(_0xe56c('0x53'));if(_0x8df016['role']==='user'){var _0x3a0a9a=_0x3d77af[_0xe56c('0x52')]({'plain':!![]});var _0x41d738=_0xe56c('0x2a');return db[_0xe56c('0x54')][_0xe56c('0x4e')]({'where':{'name':_0x41d738,'userProfileId':_0x8df016[_0xe56c('0x55')]},'raw':!![]})[_0xe56c('0x28')](function(_0x39d213){if(_0x39d213&&_0x39d213['autoAssociation']===0x0){return db['UserProfileResource'][_0xe56c('0x4f')]({'name':_0x3a0a9a[_0xe56c('0x2e')],'resourceId':_0x3a0a9a['id'],'type':_0x39d213['name'],'sectionId':_0x39d213['id']},{})[_0xe56c('0x28')](function(){return _0x3d77af;});}else{return _0x3d77af;}})[_0xe56c('0x4c')](function(_0x407d67){logger[_0xe56c('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x407d67);throw _0x407d67;});}return _0x3d77af;})[_0xe56c('0x28')](respondWithResult(_0x2d70dd,0xc9))[_0xe56c('0x4c')](handleError(_0x2d70dd,null));};exports[_0xe56c('0x56')]=function(_0x1aa2f6,_0x59c09c){if(_0x1aa2f6[_0xe56c('0x50')]['id']){delete _0x1aa2f6[_0xe56c('0x50')]['id'];}return db[_0xe56c('0x32')]['find']({'where':{'id':_0x1aa2f6['params']['id']}})[_0xe56c('0x28')](handleEntityNotFound(_0x59c09c,null))['then'](saveUpdates(_0x1aa2f6[_0xe56c('0x50')],null))[_0xe56c('0x28')](respondWithResult(_0x59c09c,null))[_0xe56c('0x4c')](handleError(_0x59c09c,null));};exports[_0xe56c('0x29')]=function(_0x100a58,_0x1ae9c0){return db[_0xe56c('0x32')]['find']({'where':{'id':_0x100a58[_0xe56c('0x4d')]['id']}})[_0xe56c('0x28')](handleEntityNotFound(_0x1ae9c0,null))[_0xe56c('0x28')](removeEntity(_0x1ae9c0,null))[_0xe56c('0x4c')](handleError(_0x1ae9c0,null));};exports['describe']=function(_0x381bbf,_0x5ce1a1){return db['MailQueue'][_0xe56c('0x57')]()['then'](respondWithResult(_0x5ce1a1,null))['catch'](handleError(_0x5ce1a1,null));};exports[_0xe56c('0x58')]=function(_0x2e477d,_0x7f8f1d,_0x58acb1){var _0x55608c={'raw':!![],'where':{}},_0xc4a8f2={},_0x53d19a;return db['MailQueue']['findOne']({'where':{'id':_0x2e477d[_0xe56c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x7f8f1d,null))[_0xe56c('0x28')](function(_0x702271){if(_0x702271){_0x53d19a=_0x702271[_0xe56c('0x52')]({'plain':!![]});_0xc4a8f2[_0xe56c('0x3a')]=_[_0xe56c('0x36')](db[_0xe56c('0x59')][_0xe56c('0x33')]);_0xc4a8f2[_0xe56c('0x37')]=_['keys'](_0x2e477d[_0xe56c('0x37')]);_0xc4a8f2[_0xe56c('0x38')]=_[_0xe56c('0x39')](_0xc4a8f2[_0xe56c('0x3a')],_0xc4a8f2[_0xe56c('0x37')]);_0x55608c[_0xe56c('0x3b')]=_['intersection'](_0xc4a8f2[_0xe56c('0x3a')],qs[_0xe56c('0x3c')](_0x2e477d[_0xe56c('0x37')]['fields']));_0x55608c['attributes']=_0x55608c[_0xe56c('0x3b')][_0xe56c('0x3d')]?_0x55608c[_0xe56c('0x3b')]:_0xc4a8f2[_0xe56c('0x3a')];if(!_0x2e477d[_0xe56c('0x37')][_0xe56c('0x3e')](_0xe56c('0x3f'))){_0x55608c[_0xe56c('0x22')]=qs[_0xe56c('0x22')](_0x2e477d[_0xe56c('0x37')][_0xe56c('0x22')]);_0x55608c['offset']=qs['offset'](_0x2e477d['query'][_0xe56c('0x20')]);}_0x55608c[_0xe56c('0x40')]=qs['sort'](_0x2e477d[_0xe56c('0x37')]['sort']);_0x55608c[_0xe56c('0x42')]=qs[_0xe56c('0x38')](_[_0xe56c('0x43')](_0x2e477d[_0xe56c('0x37')],_0xc4a8f2[_0xe56c('0x38')]));_0x55608c[_0xe56c('0x42')][_0xe56c('0x5a')]=_0x702271['id'];if(_0x2e477d['query'][_0xe56c('0x45')]){_0x55608c[_0xe56c('0x42')]=_[_0xe56c('0x46')](_0x55608c[_0xe56c('0x42')],{'$or':_['map'](_0x55608c['attributes'],function(_0x51f5ab){var _0xe7a0e9={};_0xe7a0e9[_0x51f5ab]={'$like':'%'+_0x2e477d[_0xe56c('0x37')]['filter']+'%'};return _0xe7a0e9;})});}_0x55608c=_['merge']({},_0x55608c,_0x2e477d[_0xe56c('0x47')]);return db[_0xe56c('0x59')][_0xe56c('0x4a')](_0x55608c);}})[_0xe56c('0x28')](function(_0x5b2835){if(_0x5b2835){return db['User'][_0xe56c('0x5b')]({'where':{'id':_[_0xe56c('0x31')](_0x5b2835,_0xe56c('0x5c')),'role':_0xe56c('0x5d')},'attributes':['id',_0xe56c('0x2e'),_0xe56c('0x5e'),_0xe56c('0x5f'),_0xe56c('0x60')]});}})[_0xe56c('0x28')](function(_0x432aae){if(_0x432aae){return{'count':_0x432aae[_0xe56c('0x23')],'rows':_[_0xe56c('0x31')](_0x432aae[_0xe56c('0x4b')],function(_0x1178fb){return{'membername':_0x1178fb[_0xe56c('0x2e')],'UserId':_0x1178fb['id'],'queue_name':_0x53d19a['name'],'MailQueueId':_0x53d19a['id'],'interface':util[_0xe56c('0x61')](_0xe56c('0x62'),_0xe56c('0x63'),_0x1178fb[_0xe56c('0x2e')]),'penalty':0x0,'paused':_0x1178fb['mailPause'],'createdAt':_0x1178fb['createdAt'],'updatedAt':_0x1178fb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x7f8f1d,_0x55608c))[_0xe56c('0x4c')](handleError(_0x7f8f1d,null));};exports[_0xe56c('0x64')]=function(_0x5b5b68,_0x1a037d,_0x409290){var _0x5d15ef={};var _0x48788a={};var _0x1590f0;var _0x3622ec;return db[_0xe56c('0x32')][_0xe56c('0x65')]({'where':{'id':_0x5b5b68['params']['id']}})[_0xe56c('0x28')](handleEntityNotFound(_0x1a037d,null))[_0xe56c('0x28')](function(_0x1d4504){if(_0x1d4504){_0x1590f0=_0x1d4504;_0x48788a[_0xe56c('0x3a')]=_[_0xe56c('0x36')](db[_0xe56c('0x66')][_0xe56c('0x33')]);_0x48788a[_0xe56c('0x37')]=_['keys'](_0x5b5b68[_0xe56c('0x37')]);_0x48788a[_0xe56c('0x38')]=_['intersection'](_0x48788a[_0xe56c('0x3a')],_0x48788a[_0xe56c('0x37')]);_0x5d15ef['attributes']=_[_0xe56c('0x39')](_0x48788a['model'],qs[_0xe56c('0x3c')](_0x5b5b68[_0xe56c('0x37')][_0xe56c('0x3c')]));_0x5d15ef[_0xe56c('0x3b')]=_0x5d15ef[_0xe56c('0x3b')][_0xe56c('0x3d')]?_0x5d15ef[_0xe56c('0x3b')]:_0x48788a[_0xe56c('0x3a')];_0x5d15ef[_0xe56c('0x40')]=qs[_0xe56c('0x41')](_0x5b5b68['query'][_0xe56c('0x41')]);_0x5d15ef[_0xe56c('0x42')]=qs['filters'](_['pick'](_0x5b5b68[_0xe56c('0x37')],_0x48788a['filters']));if(_0x5b5b68['query'][_0xe56c('0x45')]){_0x5d15ef[_0xe56c('0x42')]=_[_0xe56c('0x46')](_0x5d15ef[_0xe56c('0x42')],{'$or':_[_0xe56c('0x31')](_0x5d15ef['attributes'],function(_0x1c10c7){var _0x3f596b={};_0x3f596b[_0x1c10c7]={'$like':'%'+_0x5b5b68[_0xe56c('0x37')][_0xe56c('0x45')]+'%'};return _0x3f596b;})});}_0x5d15ef=_['merge']({},_0x5d15ef,_0x5b5b68[_0xe56c('0x47')]);return _0x1590f0[_0xe56c('0x64')](_0x5d15ef);}})[_0xe56c('0x28')](function(_0x3f204c){if(_0x3f204c){_0x3622ec=_0x3f204c[_0xe56c('0x3d')];if(!_0x5b5b68[_0xe56c('0x37')]['hasOwnProperty'](_0xe56c('0x3f'))){_0x5d15ef[_0xe56c('0x22')]=qs[_0xe56c('0x22')](_0x5b5b68[_0xe56c('0x37')][_0xe56c('0x22')]);_0x5d15ef[_0xe56c('0x20')]=qs['offset'](_0x5b5b68[_0xe56c('0x37')][_0xe56c('0x20')]);}return _0x1590f0[_0xe56c('0x64')](_0x5d15ef);}})[_0xe56c('0x28')](function(_0x1dd996){if(_0x1dd996){return _0x1dd996?{'count':_0x3622ec,'rows':_0x1dd996}:null;}})['then'](respondWithResult(_0x1a037d,null))[_0xe56c('0x4c')](handleError(_0x1a037d,null));};exports['addTeams']=function(_0x17f97c,_0xb79333,_0xb1e17a){var _0x569ec2=_0x17f97c['body'][_0xe56c('0x67')];return db['Team'][_0xe56c('0x4a')]({'where':{'id':_0x569ec2},'attributes':['id'],'include':[{'model':db[_0xe56c('0x68')],'as':'Agents','attributes':['id','name',_0xe56c('0x69'),_0xe56c('0x6a'),'interface'],'raw':!![]}]})[_0xe56c('0x28')](function(_0x3da381){if(_0x3da381){var _0x5bcdab=_['flatMap'](_0x3da381,function(_0x77924a){var _0x589c51=_0x77924a['get']({'plain':!![]});return _0x589c51[_0xe56c('0x6b')];});return db[_0xe56c('0x32')][_0xe56c('0x4e')]({'where':{'id':_0x17f97c[_0xe56c('0x4d')]['id']}})[_0xe56c('0x28')](function(_0x579549){return db['sequelize'][_0xe56c('0x6c')](function(_0x571995){return _0x579549[_0xe56c('0x6d')](_0x569ec2,{'transaction':_0x571995})['then'](function(){return BPromise[_0xe56c('0x6e')](_0x5bcdab,function(_0x5ab896){return db[_0xe56c('0x59')][_0xe56c('0x6f')]({'where':{'UserId':_0x5ab896['id'],'MailQueueId':_0x17f97c[_0xe56c('0x4d')]['id']},'transaction':_0x571995});});})[_0xe56c('0x28')](function(){_0x5bcdab[_0xe56c('0x70')](function(_0x31002c){socket[_0xe56c('0x71')]('userMailQueue:save',{'UserId':_0x31002c['id'],'MailQueueId':_0x579549['id']});});});});});}})[_0xe56c('0x28')](respondWithStatusCode(_0xb79333,null))['catch'](handleError(_0xb79333,null));};exports['removeTeams']=function(_0x5faa82,_0x4574b0,_0x378e2e){return db['Team'][_0xe56c('0x4a')]({'where':{'id':_0x5faa82['query'][_0xe56c('0x67')]},'attributes':['id'],'include':[{'model':db[_0xe56c('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe56c('0x28')](handleEntityNotFound(_0x4574b0,null))['then'](function(_0x3fdbfe){var _0xcc0ea=_[_0xe56c('0x31')](_0x3fdbfe,'id');var _0x5815d9=[];var _0x43fd47=[];var _0x5dd558=squel[_0xe56c('0x72')]();_0x5dd558['field'](_0xe56c('0x73'))[_0xe56c('0x74')](_0xe56c('0x75'),'tq')[_0xe56c('0x76')]('user_has_teams','ut',_0xe56c('0x77'))[_0xe56c('0x42')](_0xe56c('0x78'),_0x5faa82[_0xe56c('0x4d')]['id']);for(var _0x13bb21=0x0;_0x13bb21<_0x3fdbfe[_0xe56c('0x3d')];_0x13bb21+=0x1){let _0x366a84=_0x3fdbfe[_0x13bb21];for(var _0x17e97a=0x0;_0x17e97a<_0x366a84['Agents'][_0xe56c('0x3d')];_0x17e97a+=0x1){let _0x2d03d9=_0x366a84[_0xe56c('0x6b')][_0x17e97a];var _0x404ffa=_0x5dd558[_0xe56c('0x79')]();_0x404ffa['where'](_0xe56c('0x7a'),_0x2d03d9['id']);_0x43fd47[_0xe56c('0x7b')](db[_0xe56c('0x7c')]['query'](_0x404ffa[_0xe56c('0x7d')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0xe56c('0x28')](function(_0x509da8){if(_0x509da8[_0xe56c('0x3d')]===0x1){return _0x2d03d9['id'];}else{var _0x18aeb7=_[_0xe56c('0x7e')](_[_0xe56c('0x31')](_0x509da8,_0xe56c('0x7f')),function(_0x1177fc){return _[_0xe56c('0x80')](_0xcc0ea,_0x1177fc);});if(_0x18aeb7){return _0x2d03d9['id'];}}}));}}return BPromise[_0xe56c('0x81')](_0x43fd47)[_0xe56c('0x28')](function(_0x3b850a){_0x5815d9=_(_0x5815d9)[_0xe56c('0x82')](_0x3b850a)['compact']()['value']();return db[_0xe56c('0x32')][_0xe56c('0x4e')]({'where':{'id':_0x5faa82[_0xe56c('0x4d')]['id']}})[_0xe56c('0x28')](function(_0xfe2a39){return db['sequelize']['transaction'](function(_0x30353b){return _0xfe2a39[_0xe56c('0x83')](_0x5faa82['query'][_0xe56c('0x67')],{'transaction':_0x30353b})[_0xe56c('0x28')](function(){if(!_['isEmpty'](_0x5815d9)){return _0xfe2a39[_0xe56c('0x84')](_0x5815d9,{'transaction':_0x30353b});}})[_0xe56c('0x28')](function(){_0x5815d9[_0xe56c('0x70')](function(_0x37cb54){socket['emit'](_0xe56c('0x85'),{'UserId':_0x37cb54,'MailQueueId':_0xfe2a39['id']});});});});});});})['then'](respondWithStatusCode(_0x4574b0,null))[_0xe56c('0x4c')](handleError(_0x4574b0,null));};exports[_0xe56c('0x86')]=function(_0x110427,_0x546a2a,_0x3bfac2){return db['MailQueue'][_0xe56c('0x4e')]({'where':{'id':_0x110427[_0xe56c('0x4d')]['id']}})[_0xe56c('0x28')](handleEntityNotFound(_0x546a2a,null))[_0xe56c('0x28')](function(_0xe1d363){if(_0xe1d363){return _0xe1d363['addAgents'](_0x110427[_0xe56c('0x50')]['ids'],_[_0xe56c('0x87')](_0x110427['body'],[_0xe56c('0x67'),'id'])||{})[_0xe56c('0x88')](function(_0x110ba6){for(var _0x491ac1=0x0;_0x491ac1<_0x110427[_0xe56c('0x50')][_0xe56c('0x67')][_0xe56c('0x3d')];_0x491ac1+=0x1){socket['emit'](_0xe56c('0x89'),{'UserId':Number(_0x110427[_0xe56c('0x50')][_0xe56c('0x67')][_0x491ac1]),'MailQueueId':Number(_0x110427['params']['id'])});}return _0x110ba6;});}})[_0xe56c('0x28')](respondWithResult(_0x546a2a,null))[_0xe56c('0x4c')](handleError(_0x546a2a,null));};exports[_0xe56c('0x84')]=function(_0x3922ef,_0x11d839,_0x44f07a){return db[_0xe56c('0x32')]['find']({'where':{'id':_0x3922ef[_0xe56c('0x4d')]['id']}})[_0xe56c('0x28')](handleEntityNotFound(_0x11d839,null))[_0xe56c('0x28')](function(_0x3e0b3c){if(_0x3e0b3c){return _0x3e0b3c['removeAgents'](_0x3922ef[_0xe56c('0x37')]['ids'])['then'](function(){if(_[_0xe56c('0x8a')](_0x3922ef['query'][_0xe56c('0x67')])){for(var _0x54996b=0x0;_0x54996b<_0x3922ef[_0xe56c('0x37')][_0xe56c('0x67')][_0xe56c('0x3d')];_0x54996b+=0x1){socket['emit'](_0xe56c('0x85'),{'UserId':Number(_0x3922ef[_0xe56c('0x37')]['ids'][_0x54996b]),'MailQueueId':Number(_0x3922ef['params']['id'])});}}else{socket[_0xe56c('0x71')](_0xe56c('0x85'),{'UserId':Number(_0x3922ef['query']['ids']),'MailQueueId':Number(_0x3922ef[_0xe56c('0x4d')]['id'])});}});}})[_0xe56c('0x28')](respondWithStatusCode(_0x11d839,null))[_0xe56c('0x4c')](handleError(_0x11d839,null));};exports[_0xe56c('0x8b')]=function(_0x487e5e,_0x2d7cef,_0x32f9fb){var _0x11fcae={};var _0x6a540c={};var _0x4fb89b;var _0x40969c;return db['MailQueue'][_0xe56c('0x65')]({'where':{'id':_0x487e5e[_0xe56c('0x4d')]['id']}})[_0xe56c('0x28')](handleEntityNotFound(_0x2d7cef,null))[_0xe56c('0x28')](function(_0x5b9e9f){if(_0x5b9e9f){_0x4fb89b=_0x5b9e9f;_0x6a540c[_0xe56c('0x3a')]=_[_0xe56c('0x36')](db[_0xe56c('0x68')][_0xe56c('0x33')]);_0x6a540c['query']=_[_0xe56c('0x36')](_0x487e5e['query']);_0x6a540c[_0xe56c('0x38')]=_[_0xe56c('0x39')](_0x6a540c['model'],_0x6a540c[_0xe56c('0x37')]);_0x11fcae[_0xe56c('0x3b')]=_['intersection'](_0x6a540c[_0xe56c('0x3a')],qs[_0xe56c('0x3c')](_0x487e5e[_0xe56c('0x37')][_0xe56c('0x3c')]));_0x11fcae[_0xe56c('0x3b')]=_0x11fcae['attributes'][_0xe56c('0x3d')]?_0x11fcae[_0xe56c('0x3b')]:_0x6a540c[_0xe56c('0x3a')];_0x11fcae[_0xe56c('0x40')]=qs[_0xe56c('0x41')](_0x487e5e[_0xe56c('0x37')][_0xe56c('0x41')]);_0x11fcae[_0xe56c('0x42')]=qs[_0xe56c('0x38')](_[_0xe56c('0x43')](_0x487e5e[_0xe56c('0x37')],_0x6a540c[_0xe56c('0x38')]));if(_0x487e5e[_0xe56c('0x37')]['filter']){_0x11fcae[_0xe56c('0x42')]=_[_0xe56c('0x46')](_0x11fcae['where'],{'$or':_[_0xe56c('0x31')](_0x11fcae['attributes'],function(_0x464de6){var _0x4067d4={};_0x4067d4[_0x464de6]={'$like':'%'+_0x487e5e[_0xe56c('0x37')][_0xe56c('0x45')]+'%'};return _0x4067d4;})});}_0x11fcae=_[_0xe56c('0x46')]({},_0x11fcae,_0x487e5e[_0xe56c('0x47')]);return _0x4fb89b[_0xe56c('0x8b')](_0x11fcae);}})[_0xe56c('0x28')](function(_0x44ada0){if(_0x44ada0){_0x40969c=_0x44ada0[_0xe56c('0x3d')];if(!_0x487e5e['query']['hasOwnProperty']('nolimit')){_0x11fcae[_0xe56c('0x22')]=qs[_0xe56c('0x22')](_0x487e5e['query']['limit']);_0x11fcae['offset']=qs[_0xe56c('0x20')](_0x487e5e[_0xe56c('0x37')][_0xe56c('0x20')]);}return _0x4fb89b['getAgents'](_0x11fcae);}})[_0xe56c('0x28')](function(_0x22ad57){if(_0x22ad57){return _0x22ad57?{'count':_0x40969c,'rows':_0x22ad57}:null;}})[_0xe56c('0x28')](respondWithResult(_0x2d7cef,null))[_0xe56c('0x4c')](handleError(_0x2d7cef,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 8be59cc..71326ba 100644 --- a/server/api/mailQueue/mailQueue.events.js +++ b/server/api/mailQueue/mailQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60af=['../../mysqldb','MailQueue','remove','emit','hook','exports','events'];(function(_0x59c445,_0x5956b8){var _0xf63eb=function(_0x3db5c4){while(--_0x3db5c4){_0x59c445['push'](_0x59c445['shift']());}};_0xf63eb(++_0x5956b8);}(_0x60af,0x8b));var _0xf60a=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x60af[_0x2ce6d5];return _0x32d272;};'use strict';var EventEmitter=require(_0xf60a('0x0'));var MailQueue=require(_0xf60a('0x1'))['db'][_0xf60a('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf60a('0x3')};function emitEvent(_0x13cb29){return function(_0x34cf80,_0x34bb99,_0x2e2f27){MailQueueEvents[_0xf60a('0x4')](_0x13cb29+':'+_0x34cf80['id'],_0x34cf80);MailQueueEvents['emit'](_0x13cb29,_0x34cf80);_0x2e2f27(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xf60a('0x5')](e,emitEvent(event));}}module[_0xf60a('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x800e=['../../mysqldb','MailQueue','setMaxListeners','remove','hasOwnProperty','hook','exports'];(function(_0x5d0395,_0x41a6a7){var _0x589865=function(_0x41ff4b){while(--_0x41ff4b){_0x5d0395['push'](_0x5d0395['shift']());}};_0x589865(++_0x41a6a7);}(_0x800e,0xe7));var _0xe800=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x800e[_0x355ce8];return _0x1db8b8;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xe800('0x0'))['db'][_0xe800('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe800('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe800('0x3')};function emitEvent(_0x274d15){return function(_0x1b9393,_0x1c7825,_0x11ece2){MailQueueEvents['emit'](_0x274d15+':'+_0x1b9393['id'],_0x1b9393);MailQueueEvents['emit'](_0x274d15,_0x1b9393);_0x11ece2(null);};}for(var e in events){if(events[_0xe800('0x4')](e)){var event=events[e];MailQueue[_0xe800('0x5')](e,emitEvent(event));}}module[_0xe800('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index ad2ae67..fcc40ad 100644 --- a/server/api/mailQueue/mailQueue.model.js +++ b/server/api/mailQueue/mailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa334=['rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa334,0x1d9));var _0x4a33=function(_0x1fc80d,_0x25deea){_0x1fc80d=_0x1fc80d-0x0;var _0x4a8fd1=_0xa334[_0x1fc80d];return _0x4a8fd1;};'use strict';var _=require(_0x4a33('0x0'));var util=require('util');var logger=require(_0x4a33('0x1'))(_0x4a33('0x2'));var moment=require(_0x4a33('0x3'));var BPromise=require(_0x4a33('0x4'));var rp=require(_0x4a33('0x5'));var fs=require('fs');var path=require(_0x4a33('0x6'));var rimraf=require(_0x4a33('0x7'));var config=require(_0x4a33('0x8'));var attributes=require(_0x4a33('0x9'));module['exports']=function(_0x1e6922,_0x56066a){return _0x1e6922[_0x4a33('0xa')]('MailQueue',attributes,{'tableName':_0x4a33('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13cc=['path','exports','define','MailQueue','util','../../config/logger','moment'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x13cc,0x6d));var _0xc13c=function(_0x1cacfe,_0x413c4b){_0x1cacfe=_0x1cacfe-0x0;var _0x10a65f=_0x13cc[_0x1cacfe];return _0x10a65f;};'use strict';var _=require('lodash');var util=require(_0xc13c('0x0'));var logger=require(_0xc13c('0x1'))('api');var moment=require(_0xc13c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc13c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xc13c('0x4')]=function(_0x328c5b,_0x4ca427){return _0x328c5b[_0xc13c('0x5')](_0xc13c('0x6'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index f791c3c..cb49543 100644 --- a/server/api/mailQueue/mailQueue.rpc.js +++ b/server/api/mailQueue/mailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf440=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','request','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','model','map','then','ShowMailQueue'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xf440,0x1ee));var _0x0f44=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xf440[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0x0f44('0x0'));var moment=require(_0x0f44('0x1'));var BPromise=require(_0x0f44('0x2'));var rs=require(_0x0f44('0x3'));var fs=require('fs');var Redis=require(_0x0f44('0x4'));var db=require(_0x0f44('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0f44('0x6'));var config=require(_0x0f44('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0f44('0x8')][_0x0f44('0x9')]({'port':0x232a});config[_0x0f44('0xa')]=_[_0x0f44('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0f44('0xc'))(new Redis(config[_0x0f44('0xa')]));require(_0x0f44('0xd'))['register'](socket);function respondWithRpcPromise(_0xdba293,_0x227e29,_0x20530f){return new BPromise(function(_0x21f89f,_0x5f104f){return client[_0x0f44('0xe')](_0xdba293,_0x20530f)['then'](function(_0x57f62d){logger[_0x0f44('0xf')]('MailQueue,\x20%s,\x20%s',_0x227e29,_0x0f44('0x10'));logger[_0x0f44('0x11')](_0x0f44('0x12'),_0x227e29,'request\x20sent',JSON[_0x0f44('0x13')](_0x57f62d));if(_0x57f62d['error']){if(_0x57f62d[_0x0f44('0x14')][_0x0f44('0x15')]===0x1f4){logger[_0x0f44('0x14')](_0x0f44('0x16'),_0x227e29,_0x57f62d[_0x0f44('0x14')]['message']);return _0x5f104f(_0x57f62d[_0x0f44('0x14')][_0x0f44('0x17')]);}logger[_0x0f44('0x14')]('MailQueue,\x20%s,\x20%s',_0x227e29,_0x57f62d['error'][_0x0f44('0x17')]);return _0x21f89f(_0x57f62d[_0x0f44('0x14')][_0x0f44('0x17')]);}else{logger[_0x0f44('0xf')](_0x0f44('0x16'),_0x227e29,_0x0f44('0x10'));_0x21f89f(_0x57f62d[_0x0f44('0x18')][_0x0f44('0x17')]);}})[_0x0f44('0x19')](function(_0x17bab1){logger[_0x0f44('0x14')](_0x0f44('0x16'),_0x227e29,_0x17bab1);_0x5f104f(_0x17bab1);});});}exports[_0x0f44('0x1a')]=function(_0x21b121){var _0x2a5b5a=this;return new Promise(function(_0x2f9ad1,_0x481f5f){return db[_0x0f44('0x1b')]['findAll']({'raw':_0x21b121['options']?_0x21b121[_0x0f44('0x1c')][_0x0f44('0x1d')]===undefined?!![]:![]:!![],'where':_0x21b121[_0x0f44('0x1c')]?_0x21b121[_0x0f44('0x1c')][_0x0f44('0x1e')]||null:null,'attributes':_0x21b121['options']?_0x21b121[_0x0f44('0x1c')][_0x0f44('0x1f')]||null:null,'limit':_0x21b121[_0x0f44('0x1c')]?_0x21b121[_0x0f44('0x1c')][_0x0f44('0x20')]||null:null,'include':_0x21b121[_0x0f44('0x1c')]?_0x21b121[_0x0f44('0x1c')][_0x0f44('0x21')]?_['map'](_0x21b121[_0x0f44('0x1c')][_0x0f44('0x21')],function(_0x253b8f){return{'model':db[_0x253b8f[_0x0f44('0x22')]],'as':_0x253b8f['as'],'attributes':_0x253b8f[_0x0f44('0x1f')],'include':_0x253b8f[_0x0f44('0x21')]?_[_0x0f44('0x23')](_0x253b8f['include'],function(_0x1291db){return{'model':db[_0x1291db[_0x0f44('0x22')]],'as':_0x1291db['as'],'attributes':_0x1291db['attributes'],'include':_0x1291db[_0x0f44('0x21')]?_[_0x0f44('0x23')](_0x1291db[_0x0f44('0x21')],function(_0x555e61){return{'model':db[_0x555e61['model']],'as':_0x555e61['as'],'attributes':_0x555e61[_0x0f44('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0f44('0x24')](function(_0x117dc8){logger[_0x0f44('0xf')](_0x0f44('0x1a'),_0x21b121);logger['debug'](_0x0f44('0x1a'),_0x21b121,JSON['stringify'](_0x117dc8));_0x2f9ad1(_0x117dc8);})['catch'](function(_0x36000){logger[_0x0f44('0x14')]('GetMailQueue',_0x36000['message'],_0x21b121);_0x481f5f(_0x2a5b5a[_0x0f44('0x14')](0x1f4,_0x36000[_0x0f44('0x17')]));});});};exports[_0x0f44('0x25')]=function(_0x227f4d){var _0x53dd93=this;return new Promise(function(_0x22ce8b,_0x4311db){return db[_0x0f44('0x1b')]['find']({'raw':_0x227f4d[_0x0f44('0x1c')]?_0x227f4d[_0x0f44('0x1c')][_0x0f44('0x1d')]===undefined?!![]:![]:!![],'where':_0x227f4d['options']?_0x227f4d[_0x0f44('0x1c')]['where']||null:null,'attributes':_0x227f4d['options']?_0x227f4d[_0x0f44('0x1c')][_0x0f44('0x1f')]||null:null,'include':_0x227f4d[_0x0f44('0x1c')]?_0x227f4d[_0x0f44('0x1c')][_0x0f44('0x21')]?_[_0x0f44('0x23')](_0x227f4d[_0x0f44('0x1c')]['include'],function(_0x5e5360){return{'model':db[_0x5e5360[_0x0f44('0x22')]],'as':_0x5e5360['as'],'attributes':_0x5e5360['attributes'],'include':_0x5e5360[_0x0f44('0x21')]?_[_0x0f44('0x23')](_0x5e5360[_0x0f44('0x21')],function(_0x448299){return{'model':db[_0x448299[_0x0f44('0x22')]],'as':_0x448299['as'],'attributes':_0x448299[_0x0f44('0x1f')],'include':_0x448299[_0x0f44('0x21')]?_[_0x0f44('0x23')](_0x448299['include'],function(_0x10a018){return{'model':db[_0x10a018[_0x0f44('0x22')]],'as':_0x10a018['as'],'attributes':_0x10a018[_0x0f44('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0f44('0x24')](function(_0x52bbfa){logger['info']('ShowMailQueue',_0x227f4d);logger[_0x0f44('0x11')](_0x0f44('0x25'),_0x227f4d,JSON[_0x0f44('0x13')](_0x52bbfa));_0x22ce8b(_0x52bbfa);})[_0x0f44('0x19')](function(_0x1dcee3){logger[_0x0f44('0x14')]('ShowMailQueue',_0x1dcee3[_0x0f44('0x17')],_0x227f4d);_0x4311db(_0x53dd93[_0x0f44('0x14')](0x1f4,_0x1dcee3['message']));});});}; \ No newline at end of file +var _0x848a=['attributes','limit','model','map','include','ShowMailQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw'];(function(_0x7a58d8,_0x4eb056){var _0xbce939=function(_0x3b73c7){while(--_0x3b73c7){_0x7a58d8['push'](_0x7a58d8['shift']());}};_0xbce939(++_0x4eb056);}(_0x848a,0x1b6));var _0xa848=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x848a[_0x15d18f];return _0xd12bf7;};'use strict';var _=require(_0xa848('0x0'));var util=require('util');var moment=require(_0xa848('0x1'));var BPromise=require(_0xa848('0x2'));var rs=require(_0xa848('0x3'));var fs=require('fs');var Redis=require(_0xa848('0x4'));var db=require(_0xa848('0x5'))['db'];var utils=require(_0xa848('0x6'));var logger=require('../../config/logger')(_0xa848('0x7'));var config=require(_0xa848('0x8'));var jayson=require(_0xa848('0x9'));var client=jayson[_0xa848('0xa')][_0xa848('0xb')]({'port':0x232a});config[_0xa848('0xc')]=_[_0xa848('0xd')](config[_0xa848('0xc')],{'host':_0xa848('0xe'),'port':0x18eb});var socket=require(_0xa848('0xf'))(new Redis(config[_0xa848('0xc')]));require(_0xa848('0x10'))[_0xa848('0x11')](socket);function respondWithRpcPromise(_0x5339fb,_0x14f89b,_0x5c6be9){return new BPromise(function(_0x4e49f1,_0x482332){return client['request'](_0x5339fb,_0x5c6be9)[_0xa848('0x12')](function(_0x143c49){logger[_0xa848('0x13')](_0xa848('0x14'),_0x14f89b,_0xa848('0x15'));logger[_0xa848('0x16')](_0xa848('0x17'),_0x14f89b,_0xa848('0x15'),JSON[_0xa848('0x18')](_0x143c49));if(_0x143c49[_0xa848('0x19')]){if(_0x143c49[_0xa848('0x19')][_0xa848('0x1a')]===0x1f4){logger[_0xa848('0x19')](_0xa848('0x14'),_0x14f89b,_0x143c49['error'][_0xa848('0x1b')]);return _0x482332(_0x143c49[_0xa848('0x19')]['message']);}logger[_0xa848('0x19')](_0xa848('0x14'),_0x14f89b,_0x143c49[_0xa848('0x19')]['message']);return _0x4e49f1(_0x143c49[_0xa848('0x19')][_0xa848('0x1b')]);}else{logger[_0xa848('0x13')](_0xa848('0x14'),_0x14f89b,'request\x20sent');_0x4e49f1(_0x143c49[_0xa848('0x1c')]['message']);}})[_0xa848('0x1d')](function(_0x415b66){logger['error']('MailQueue,\x20%s,\x20%s',_0x14f89b,_0x415b66);_0x482332(_0x415b66);});});}exports[_0xa848('0x1e')]=function(_0x44e13b){var _0x23ef12=this;return new Promise(function(_0x2a0483,_0x430825){return db[_0xa848('0x1f')][_0xa848('0x20')]({'raw':_0x44e13b[_0xa848('0x21')]?_0x44e13b[_0xa848('0x21')][_0xa848('0x22')]===undefined?!![]:![]:!![],'where':_0x44e13b['options']?_0x44e13b[_0xa848('0x21')]['where']||null:null,'attributes':_0x44e13b[_0xa848('0x21')]?_0x44e13b[_0xa848('0x21')][_0xa848('0x23')]||null:null,'limit':_0x44e13b[_0xa848('0x21')]?_0x44e13b[_0xa848('0x21')][_0xa848('0x24')]||null:null,'include':_0x44e13b[_0xa848('0x21')]?_0x44e13b[_0xa848('0x21')]['include']?_['map'](_0x44e13b[_0xa848('0x21')]['include'],function(_0x38957f){return{'model':db[_0x38957f[_0xa848('0x25')]],'as':_0x38957f['as'],'attributes':_0x38957f['attributes'],'include':_0x38957f['include']?_[_0xa848('0x26')](_0x38957f[_0xa848('0x27')],function(_0x243983){return{'model':db[_0x243983[_0xa848('0x25')]],'as':_0x243983['as'],'attributes':_0x243983[_0xa848('0x23')],'include':_0x243983['include']?_[_0xa848('0x26')](_0x243983[_0xa848('0x27')],function(_0x4b00ab){return{'model':db[_0x4b00ab[_0xa848('0x25')]],'as':_0x4b00ab['as'],'attributes':_0x4b00ab[_0xa848('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa848('0x12')](function(_0x4702d3){logger[_0xa848('0x13')](_0xa848('0x1e'),_0x44e13b);logger[_0xa848('0x16')]('GetMailQueue',_0x44e13b,JSON[_0xa848('0x18')](_0x4702d3));_0x2a0483(_0x4702d3);})[_0xa848('0x1d')](function(_0xfa2895){logger['error'](_0xa848('0x1e'),_0xfa2895[_0xa848('0x1b')],_0x44e13b);_0x430825(_0x23ef12['error'](0x1f4,_0xfa2895[_0xa848('0x1b')]));});});};exports[_0xa848('0x28')]=function(_0x2dd05b){var _0x5af5da=this;return new Promise(function(_0x15a2a3,_0x5ba518){return db['MailQueue'][_0xa848('0x29')]({'raw':_0x2dd05b['options']?_0x2dd05b[_0xa848('0x21')][_0xa848('0x22')]===undefined?!![]:![]:!![],'where':_0x2dd05b[_0xa848('0x21')]?_0x2dd05b[_0xa848('0x21')][_0xa848('0x2a')]||null:null,'attributes':_0x2dd05b['options']?_0x2dd05b[_0xa848('0x21')][_0xa848('0x23')]||null:null,'include':_0x2dd05b[_0xa848('0x21')]?_0x2dd05b[_0xa848('0x21')][_0xa848('0x27')]?_[_0xa848('0x26')](_0x2dd05b['options']['include'],function(_0x1586b8){return{'model':db[_0x1586b8[_0xa848('0x25')]],'as':_0x1586b8['as'],'attributes':_0x1586b8[_0xa848('0x23')],'include':_0x1586b8[_0xa848('0x27')]?_[_0xa848('0x26')](_0x1586b8[_0xa848('0x27')],function(_0x2f5331){return{'model':db[_0x2f5331[_0xa848('0x25')]],'as':_0x2f5331['as'],'attributes':_0x2f5331[_0xa848('0x23')],'include':_0x2f5331['include']?_['map'](_0x2f5331['include'],function(_0x12c4f3){return{'model':db[_0x12c4f3['model']],'as':_0x12c4f3['as'],'attributes':_0x12c4f3['attributes']};}):[]};}):[]};}):[]:[]})[_0xa848('0x12')](function(_0x3cd7cd){logger[_0xa848('0x13')]('ShowMailQueue',_0x2dd05b);logger[_0xa848('0x16')]('ShowMailQueue',_0x2dd05b,JSON[_0xa848('0x18')](_0x3cd7cd));_0x15a2a3(_0x3cd7cd);})[_0xa848('0x1d')](function(_0x491cc8){logger['error'](_0xa848('0x28'),_0x491cc8[_0xa848('0x1b')],_0x2dd05b);_0x5ba518(_0x5af5da['error'](0x1f4,_0x491cc8[_0xa848('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1b69da7..c84090e 100644 --- a/server/api/mailQueue/mailQueue.socket.js +++ b/server/api/mailQueue/mailQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a36=['register','./mailQueue.events','save','remove','update','emit'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5a36,0x133));var _0x65a3=function(_0x3c5249,_0x589225){_0x3c5249=_0x3c5249-0x0;var _0x5ea071=_0x5a36[_0x3c5249];return _0x5ea071;};'use strict';var MailQueueEvents=require(_0x65a3('0x0'));var events=[_0x65a3('0x1'),_0x65a3('0x2'),_0x65a3('0x3')];function createListener(_0x2495f8,_0x5188bb){return function(_0x5ed140){_0x5188bb[_0x65a3('0x4')](_0x2495f8,_0x5ed140);};}function removeListener(_0x1a018b,_0x431d44){return function(){MailQueueEvents['removeListener'](_0x1a018b,_0x431d44);};}exports[_0x65a3('0x5')]=function(_0x3d1b8c){for(var _0x3b61e4=0x0,_0x326c4e=events['length'];_0x3b61e4<_0x326c4e;_0x3b61e4++){var _0x2e4464=events[_0x3b61e4];var _0x19614f=createListener('mailQueue:'+_0x2e4464,_0x3d1b8c);MailQueueEvents['on'](_0x2e4464,_0x19614f);}}; \ No newline at end of file +var _0xd80d=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x5ae04b,_0x5223fd){var _0x31585e=function(_0x4a2d4e){while(--_0x4a2d4e){_0x5ae04b['push'](_0x5ae04b['shift']());}};_0x31585e(++_0x5223fd);}(_0xd80d,0x1c1));var _0xdd80=function(_0x54afd6,_0x190294){_0x54afd6=_0x54afd6-0x0;var _0x425cfe=_0xd80d[_0x54afd6];return _0x425cfe;};'use strict';var MailQueueEvents=require(_0xdd80('0x0'));var events=[_0xdd80('0x1'),_0xdd80('0x2'),_0xdd80('0x3')];function createListener(_0x166641,_0x4bfe97){return function(_0x204e76){_0x4bfe97[_0xdd80('0x4')](_0x166641,_0x204e76);};}function removeListener(_0x165753,_0x22b6a6){return function(){MailQueueEvents[_0xdd80('0x5')](_0x165753,_0x22b6a6);};}exports[_0xdd80('0x6')]=function(_0x4feee8){for(var _0x371f56=0x0,_0x1f0415=events[_0xdd80('0x7')];_0x371f56<_0x1f0415;_0x371f56++){var _0x3e3b3b=events[_0x371f56];var _0x5d55ae=createListener(_0xdd80('0x8')+_0x3e3b3b,_0x4feee8);MailQueueEvents['on'](_0x3e3b3b,_0x5d55ae);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 224c5a8..509aecc 100644 --- a/server/api/mailQueueReport/index.js +++ b/server/api/mailQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04c4=['express','fs-extra','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x257b8b,_0x29d90b){var _0x428dc3=function(_0x132d98){while(--_0x132d98){_0x257b8b['push'](_0x257b8b['shift']());}};_0x428dc3(++_0x29d90b);}(_0x04c4,0xa7));var _0x404c=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0x04c4[_0x555ebb];return _0x3c0a4a;};'use strict';var multer=require(_0x404c('0x0'));var util=require(_0x404c('0x1'));var path=require(_0x404c('0x2'));var timeout=require(_0x404c('0x3'));var express=require(_0x404c('0x4'));var router=express['Router']();var fs_extra=require(_0x404c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x404c('0x6'));var config=require('../../config/environment');var controller=require(_0x404c('0x7'));router['get']('/',auth[_0x404c('0x8')](),controller[_0x404c('0x9')]);router[_0x404c('0xa')](_0x404c('0xb'),auth[_0x404c('0x8')](),controller[_0x404c('0xc')]);router[_0x404c('0xa')](_0x404c('0xd'),auth['isAuthenticated'](),controller[_0x404c('0xe')]);router[_0x404c('0xf')]('/',auth[_0x404c('0x8')](),controller['create']);router[_0x404c('0x10')](_0x404c('0xd'),auth[_0x404c('0x8')](),controller['update']);router['delete'](_0x404c('0xd'),auth['isAuthenticated'](),controller[_0x404c('0x11')]);module[_0x404c('0x12')]=router; \ No newline at end of file +var _0xd8c4=['multer','util','path','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd8c4,0x150));var _0x4d8c=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xd8c4[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x4d8c('0x0'));var util=require(_0x4d8c('0x1'));var path=require(_0x4d8c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d8c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d8c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4d8c('0x5'));var controller=require(_0x4d8c('0x6'));router['get']('/',auth[_0x4d8c('0x7')](),controller['index']);router[_0x4d8c('0x8')](_0x4d8c('0x9'),auth[_0x4d8c('0x7')](),controller[_0x4d8c('0xa')]);router[_0x4d8c('0x8')](_0x4d8c('0xb'),auth[_0x4d8c('0x7')](),controller[_0x4d8c('0xc')]);router[_0x4d8c('0xd')]('/',auth[_0x4d8c('0x7')](),controller['create']);router[_0x4d8c('0xe')](_0x4d8c('0xb'),auth[_0x4d8c('0x7')](),controller[_0x4d8c('0xf')]);router['delete'](_0x4d8c('0xb'),auth[_0x4d8c('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1a50330..13a84e9 100644 --- a/server/api/mailQueueReport/mailQueueReport.attributes.js +++ b/server/api/mailQueueReport/mailQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49aa=['sequelize','STRING','DATE'];(function(_0x554d41,_0x42b0c8){var _0x53bba3=function(_0x495397){while(--_0x495397){_0x554d41['push'](_0x554d41['shift']());}};_0x53bba3(++_0x42b0c8);}(_0x49aa,0x10e));var _0xa49a=function(_0x244aa4,_0x412db6){_0x244aa4=_0x244aa4-0x0;var _0x159fc4=_0x49aa[_0x244aa4];return _0x159fc4;};'use strict';var moment=require('moment');var Sequelize=require(_0xa49a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa49a('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa49a('0x2')]},'exitAt':{'type':Sequelize[_0xa49a('0x2')]},'reason':{'type':Sequelize[_0xa49a('0x1')]}}; \ No newline at end of file +var _0x5a78=['DATE','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a78,0x19b));var _0x85a7=function(_0x7837b0,_0x282725){_0x7837b0=_0x7837b0-0x0;var _0x428eca=_0x5a78[_0x7837b0];return _0x428eca;};'use strict';var moment=require(_0x85a7('0x0'));var Sequelize=require(_0x85a7('0x1'));module[_0x85a7('0x2')]={'uniqueid':{'type':Sequelize[_0x85a7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x85a7('0x3')]},'joinAt':{'type':Sequelize[_0x85a7('0x4')]},'leaveAt':{'type':Sequelize[_0x85a7('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x85a7('0x4')]},'reason':{'type':Sequelize[_0x85a7('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0bb63a7..af4dfc6 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0adf=['find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x3b6112,_0x31a6f3){var _0x263088=function(_0x447239){while(--_0x447239){_0x3b6112['push'](_0x3b6112['shift']());}};_0x263088(++_0x31a6f3);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x279472,_0xdbb8cd){_0x279472=_0x279472-0x0;var _0x307f9a=_0x0adf[_0x279472];return _0x307f9a;};'use strict';var emlformat=require(_0xf0ad('0x0'));var rimraf=require(_0xf0ad('0x1'));var zipdir=require(_0xf0ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0ad('0x3'));var moment=require(_0xf0ad('0x4'));var BPromise=require(_0xf0ad('0x5'));var Mustache=require(_0xf0ad('0x6'));var util=require(_0xf0ad('0x7'));var path=require(_0xf0ad('0x8'));var sox=require(_0xf0ad('0x9'));var csv=require('to-csv');var ejs=require(_0xf0ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0ad('0xb'));var squel=require(_0xf0ad('0xc'));var crypto=require(_0xf0ad('0xd'));var jsforce=require(_0xf0ad('0xe'));var deskjs=require(_0xf0ad('0xf'));var toCsv=require(_0xf0ad('0x10'));var querystring=require(_0xf0ad('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf0ad('0x13'));var as=require(_0xf0ad('0x14'));var hardwareService=require(_0xf0ad('0x15'));var logger=require(_0xf0ad('0x16'))(_0xf0ad('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0ad('0x18'));var db=require(_0xf0ad('0x19'))['db'];function respondWithStatusCode(_0x3646a2,_0x238c3b){_0x238c3b=_0x238c3b||0xcc;return function(_0x597c40){if(_0x597c40){return _0x3646a2[_0xf0ad('0x1a')](_0x238c3b);}return _0x3646a2[_0xf0ad('0x1b')](_0x238c3b)['end']();};}function respondWithResult(_0x49df92,_0x5332e9){_0x5332e9=_0x5332e9||0xc8;return function(_0x221d7b){if(_0x221d7b){return _0x49df92['status'](_0x5332e9)[_0xf0ad('0x1c')](_0x221d7b);}};}function respondWithFilteredResult(_0x313ad6,_0xfa544c){return function(_0xfa829e){if(_0xfa829e){var _0x237dd9=typeof _0xfa544c['offset']===_0xf0ad('0x1d')&&typeof _0xfa544c[_0xf0ad('0x1e')]===_0xf0ad('0x1d');var _0x1c9fac=_0xfa829e['count'];var _0x4e9970=_0x237dd9?0x0:_0xfa544c[_0xf0ad('0x1f')];var _0x46fb20=_0x237dd9?_0xfa829e['count']:_0xfa544c[_0xf0ad('0x1f')]+_0xfa544c[_0xf0ad('0x1e')];var _0x9a95bf;if(_0x46fb20>=_0x1c9fac){_0x46fb20=_0x1c9fac;_0x9a95bf=0xc8;}else{_0x9a95bf=0xce;}_0x313ad6[_0xf0ad('0x1b')](_0x9a95bf);return _0x313ad6['set']('Content-Range',_0x4e9970+'-'+_0x46fb20+'/'+_0x1c9fac)[_0xf0ad('0x1c')](_0xfa829e);}return null;};}function patchUpdates(_0x2da425){return function(_0x37b968){try{jsonpatch[_0xf0ad('0x20')](_0x37b968,_0x2da425,!![]);}catch(_0x2ac8ba){return BPromise[_0xf0ad('0x21')](_0x2ac8ba);}return _0x37b968['save']();};}function saveUpdates(_0x33c95d,_0x16e62a){return function(_0x31635b){if(_0x31635b){return _0x31635b[_0xf0ad('0x22')](_0x33c95d)[_0xf0ad('0x23')](function(_0x88b47b){return _0x88b47b;});}return null;};}function removeEntity(_0xb91769,_0x276322){return function(_0x3fc97e){if(_0x3fc97e){return _0x3fc97e[_0xf0ad('0x24')]()[_0xf0ad('0x23')](function(){_0xb91769[_0xf0ad('0x1b')](0xcc)[_0xf0ad('0x25')]();});}};}function handleEntityNotFound(_0x456f81,_0x879f89){return function(_0x557f90){if(!_0x557f90){_0x456f81[_0xf0ad('0x1a')](0x194);}return _0x557f90;};}function handleError(_0x1507a3,_0x248794){_0x248794=_0x248794||0x1f4;return function(_0x7377d7){logger[_0xf0ad('0x26')](_0x7377d7[_0xf0ad('0x27')]);if(_0x7377d7['name']){delete _0x7377d7[_0xf0ad('0x28')];}_0x1507a3[_0xf0ad('0x1b')](_0x248794)[_0xf0ad('0x29')](_0x7377d7);};}exports[_0xf0ad('0x2a')]=function(_0x1b6880,_0x1ac25c){var _0x267b7a={},_0x1bee71={},_0x2386e8={'count':0x0,'rows':[]};var _0x39c46c=_[_0xf0ad('0x2b')](db['MailQueueReport'][_0xf0ad('0x2c')],function(_0x5f5115){return{'name':_0x5f5115[_0xf0ad('0x2d')],'type':_0x5f5115['type'][_0xf0ad('0x2e')]};});_0x1bee71[_0xf0ad('0x2f')]=_[_0xf0ad('0x2b')](_0x39c46c,_0xf0ad('0x28'));_0x1bee71[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x1b6880[_0xf0ad('0x30')]);_0x1bee71[_0xf0ad('0x32')]=_['intersection'](_0x1bee71['model'],_0x1bee71[_0xf0ad('0x30')]);_0x267b7a[_0xf0ad('0x33')]=_[_0xf0ad('0x34')](_0x1bee71[_0xf0ad('0x2f')],qs['fields'](_0x1b6880[_0xf0ad('0x30')]['fields']));_0x267b7a[_0xf0ad('0x33')]=_0x267b7a['attributes'][_0xf0ad('0x35')]?_0x267b7a['attributes']:_0x1bee71[_0xf0ad('0x2f')];if(!_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x36')](_0xf0ad('0x37'))){_0x267b7a[_0xf0ad('0x1e')]=qs[_0xf0ad('0x1e')](_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x1e')]);_0x267b7a['offset']=qs[_0xf0ad('0x1f')](_0x1b6880['query'][_0xf0ad('0x1f')]);}_0x267b7a['order']=qs[_0xf0ad('0x38')](_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x38')]);_0x267b7a[_0xf0ad('0x39')]=qs[_0xf0ad('0x32')](_['pick'](_0x1b6880[_0xf0ad('0x30')],_0x1bee71[_0xf0ad('0x32')]),_0x39c46c);if(_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x3a')]){_0x267b7a[_0xf0ad('0x39')]=_[_0xf0ad('0x3b')](_0x267b7a[_0xf0ad('0x39')],{'$or':_['map'](_0x39c46c,function(_0x2e0c7a){if(_0x2e0c7a[_0xf0ad('0x3c')]!==_0xf0ad('0x3d')){var _0x189f67={};_0x189f67[_0x2e0c7a[_0xf0ad('0x28')]]={'$like':'%'+_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x3a')]+'%'};return _0x189f67;}})});}_0x267b7a=_[_0xf0ad('0x3b')]({},_0x267b7a,_0x1b6880[_0xf0ad('0x3e')]);var _0x5dd631={'where':_0x267b7a[_0xf0ad('0x39')]};return db[_0xf0ad('0x3f')][_0xf0ad('0x40')](_0x5dd631)['then'](function(_0x510f54){_0x2386e8['count']=_0x510f54;if(_0x1b6880[_0xf0ad('0x30')][_0xf0ad('0x41')]){_0x267b7a[_0xf0ad('0x42')]=[{'all':!![]}];}return db[_0xf0ad('0x3f')][_0xf0ad('0x43')](_0x267b7a);})[_0xf0ad('0x23')](function(_0x39083d){_0x2386e8[_0xf0ad('0x44')]=_0x39083d;return _0x2386e8;})[_0xf0ad('0x23')](respondWithFilteredResult(_0x1ac25c,_0x267b7a))[_0xf0ad('0x45')](handleError(_0x1ac25c,null));};exports[_0xf0ad('0x46')]=function(_0x516a72,_0x4ea947){var _0x5cd1dc={'raw':!![],'where':{'id':_0x516a72[_0xf0ad('0x47')]['id']}},_0x1c0609={};_0x1c0609['model']=_[_0xf0ad('0x31')](db[_0xf0ad('0x3f')]['rawAttributes']);_0x1c0609[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x516a72[_0xf0ad('0x30')]);_0x1c0609[_0xf0ad('0x32')]=_['intersection'](_0x1c0609[_0xf0ad('0x2f')],_0x1c0609[_0xf0ad('0x30')]);_0x5cd1dc[_0xf0ad('0x33')]=_[_0xf0ad('0x34')](_0x1c0609[_0xf0ad('0x2f')],qs[_0xf0ad('0x48')](_0x516a72[_0xf0ad('0x30')][_0xf0ad('0x48')]));_0x5cd1dc[_0xf0ad('0x33')]=_0x5cd1dc[_0xf0ad('0x33')][_0xf0ad('0x35')]?_0x5cd1dc['attributes']:_0x1c0609[_0xf0ad('0x2f')];if(_0x516a72[_0xf0ad('0x30')][_0xf0ad('0x41')]){_0x5cd1dc['include']=[{'all':!![]}];}_0x5cd1dc=_['merge']({},_0x5cd1dc,_0x516a72[_0xf0ad('0x3e')]);return db[_0xf0ad('0x3f')][_0xf0ad('0x49')](_0x5cd1dc)[_0xf0ad('0x23')](handleEntityNotFound(_0x4ea947,null))[_0xf0ad('0x23')](respondWithResult(_0x4ea947,null))[_0xf0ad('0x45')](handleError(_0x4ea947,null));};exports[_0xf0ad('0x4a')]=function(_0x561f2a,_0x1e35ce){return db['MailQueueReport'][_0xf0ad('0x4a')](_0x561f2a[_0xf0ad('0x4b')],{})[_0xf0ad('0x23')](respondWithResult(_0x1e35ce,0xc9))[_0xf0ad('0x45')](handleError(_0x1e35ce,null));};exports[_0xf0ad('0x22')]=function(_0x5b18a7,_0x4e8ef5){if(_0x5b18a7[_0xf0ad('0x4b')]['id']){delete _0x5b18a7[_0xf0ad('0x4b')]['id'];}return db[_0xf0ad('0x3f')][_0xf0ad('0x49')]({'where':{'id':_0x5b18a7[_0xf0ad('0x47')]['id']}})[_0xf0ad('0x23')](handleEntityNotFound(_0x4e8ef5,null))[_0xf0ad('0x23')](saveUpdates(_0x5b18a7['body'],null))[_0xf0ad('0x23')](respondWithResult(_0x4e8ef5,null))[_0xf0ad('0x45')](handleError(_0x4e8ef5,null));};exports[_0xf0ad('0x24')]=function(_0xda0e52,_0x2cb082){return db['MailQueueReport'][_0xf0ad('0x49')]({'where':{'id':_0xda0e52[_0xf0ad('0x47')]['id']}})[_0xf0ad('0x23')](handleEntityNotFound(_0x2cb082,null))[_0xf0ad('0x23')](removeEntity(_0x2cb082,null))[_0xf0ad('0x45')](handleError(_0x2cb082,null));};exports[_0xf0ad('0x4c')]=function(_0x3d156d,_0x5e75d0){return db[_0xf0ad('0x3f')][_0xf0ad('0x4c')]()[_0xf0ad('0x23')](respondWithResult(_0x5e75d0,null))['catch'](handleError(_0x5e75d0,null));}; \ No newline at end of file +var _0x8f4c=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','MailQueueReport','includeAll','include','findAll','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x396dc6,_0x529342){var _0x285078=function(_0x198a28){while(--_0x198a28){_0x396dc6['push'](_0x396dc6['shift']());}};_0x285078(++_0x529342);}(_0x8f4c,0x113));var _0xc8f4=function(_0x18b0a1,_0x535aac){_0x18b0a1=_0x18b0a1-0x0;var _0x55005a=_0x8f4c[_0x18b0a1];return _0x55005a;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];function respondWithStatusCode(_0x729f8f,_0x39b785){_0x39b785=_0x39b785||0xcc;return function(_0x4e31cf){if(_0x4e31cf){return _0x729f8f[_0xc8f4('0x17')](_0x39b785);}return _0x729f8f[_0xc8f4('0x18')](_0x39b785)[_0xc8f4('0x19')]();};}function respondWithResult(_0x14bc11,_0x1dcee5){_0x1dcee5=_0x1dcee5||0xc8;return function(_0x411c5c){if(_0x411c5c){return _0x14bc11['status'](_0x1dcee5)[_0xc8f4('0x1a')](_0x411c5c);}};}function respondWithFilteredResult(_0x2c7bc1,_0x1518a6){return function(_0x46ac15){if(_0x46ac15){var _0x22c08a=typeof _0x1518a6['offset']===_0xc8f4('0x1b')&&typeof _0x1518a6['limit']==='undefined';var _0x14bc02=_0x46ac15[_0xc8f4('0x1c')];var _0x108076=_0x22c08a?0x0:_0x1518a6[_0xc8f4('0x1d')];var _0x4763c1=_0x22c08a?_0x46ac15[_0xc8f4('0x1c')]:_0x1518a6[_0xc8f4('0x1d')]+_0x1518a6[_0xc8f4('0x1e')];var _0x1982bb;if(_0x4763c1>=_0x14bc02){_0x4763c1=_0x14bc02;_0x1982bb=0xc8;}else{_0x1982bb=0xce;}_0x2c7bc1[_0xc8f4('0x18')](_0x1982bb);return _0x2c7bc1[_0xc8f4('0x1f')](_0xc8f4('0x20'),_0x108076+'-'+_0x4763c1+'/'+_0x14bc02)[_0xc8f4('0x1a')](_0x46ac15);}return null;};}function patchUpdates(_0x5f3264){return function(_0x378f56){try{jsonpatch[_0xc8f4('0x21')](_0x378f56,_0x5f3264,!![]);}catch(_0x29e52d){return BPromise[_0xc8f4('0x22')](_0x29e52d);}return _0x378f56[_0xc8f4('0x23')]();};}function saveUpdates(_0x3b42ee,_0xaeee7d){return function(_0x43eb57){if(_0x43eb57){return _0x43eb57['update'](_0x3b42ee)[_0xc8f4('0x24')](function(_0x205c41){return _0x205c41;});}return null;};}function removeEntity(_0x3195ff,_0x1d159e){return function(_0x5d54a9){if(_0x5d54a9){return _0x5d54a9[_0xc8f4('0x25')]()['then'](function(){_0x3195ff[_0xc8f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x177a44,_0x3dd717){return function(_0x5c94c6){if(!_0x5c94c6){_0x177a44[_0xc8f4('0x17')](0x194);}return _0x5c94c6;};}function handleError(_0x21062f,_0x11f766){_0x11f766=_0x11f766||0x1f4;return function(_0x2fa052){logger['error'](_0x2fa052[_0xc8f4('0x26')]);if(_0x2fa052[_0xc8f4('0x27')]){delete _0x2fa052['name'];}_0x21062f[_0xc8f4('0x18')](_0x11f766)[_0xc8f4('0x28')](_0x2fa052);};}exports[_0xc8f4('0x29')]=function(_0x1b70bc,_0x24bef0){var _0x385e41={},_0x4a25da={},_0x45f972={'count':0x0,'rows':[]};var _0x24bb78=_[_0xc8f4('0x2a')](db['MailQueueReport'][_0xc8f4('0x2b')],function(_0x3a4b1b){return{'name':_0x3a4b1b['fieldName'],'type':_0x3a4b1b['type']['key']};});_0x4a25da[_0xc8f4('0x2c')]=_[_0xc8f4('0x2a')](_0x24bb78,_0xc8f4('0x27'));_0x4a25da[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x1b70bc[_0xc8f4('0x2d')]);_0x4a25da[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x4a25da['model'],_0x4a25da[_0xc8f4('0x2d')]);_0x385e41[_0xc8f4('0x31')]=_[_0xc8f4('0x30')](_0x4a25da['model'],qs[_0xc8f4('0x32')](_0x1b70bc[_0xc8f4('0x2d')]['fields']));_0x385e41[_0xc8f4('0x31')]=_0x385e41[_0xc8f4('0x31')][_0xc8f4('0x33')]?_0x385e41['attributes']:_0x4a25da[_0xc8f4('0x2c')];if(!_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x34')]('nolimit')){_0x385e41[_0xc8f4('0x1e')]=qs[_0xc8f4('0x1e')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1e')]);_0x385e41[_0xc8f4('0x1d')]=qs[_0xc8f4('0x1d')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1d')]);}_0x385e41[_0xc8f4('0x35')]=qs[_0xc8f4('0x36')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x36')]);_0x385e41[_0xc8f4('0x37')]=qs[_0xc8f4('0x2f')](_[_0xc8f4('0x38')](_0x1b70bc[_0xc8f4('0x2d')],_0x4a25da['filters']),_0x24bb78);if(_0x1b70bc[_0xc8f4('0x2d')]['filter']){_0x385e41[_0xc8f4('0x37')]=_['merge'](_0x385e41[_0xc8f4('0x37')],{'$or':_[_0xc8f4('0x2a')](_0x24bb78,function(_0x7ef69a){if(_0x7ef69a[_0xc8f4('0x39')]!==_0xc8f4('0x3a')){var _0x724060={};_0x724060[_0x7ef69a[_0xc8f4('0x27')]]={'$like':'%'+_0x1b70bc['query'][_0xc8f4('0x3b')]+'%'};return _0x724060;}})});}_0x385e41=_[_0xc8f4('0x3c')]({},_0x385e41,_0x1b70bc[_0xc8f4('0x3d')]);var _0x14ce2e={'where':_0x385e41['where']};return db[_0xc8f4('0x3e')][_0xc8f4('0x1c')](_0x14ce2e)[_0xc8f4('0x24')](function(_0x1d0b2d){_0x45f972[_0xc8f4('0x1c')]=_0x1d0b2d;if(_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x385e41[_0xc8f4('0x40')]=[{'all':!![]}];}return db[_0xc8f4('0x3e')][_0xc8f4('0x41')](_0x385e41);})[_0xc8f4('0x24')](function(_0xd56415){_0x45f972['rows']=_0xd56415;return _0x45f972;})[_0xc8f4('0x24')](respondWithFilteredResult(_0x24bef0,_0x385e41))[_0xc8f4('0x42')](handleError(_0x24bef0,null));};exports[_0xc8f4('0x43')]=function(_0x275f4a,_0x588ff9){var _0x49da16={'raw':!![],'where':{'id':_0x275f4a[_0xc8f4('0x44')]['id']}},_0x413a55={};_0x413a55['model']=_[_0xc8f4('0x2e')](db[_0xc8f4('0x3e')]['rawAttributes']);_0x413a55['query']=_[_0xc8f4('0x2e')](_0x275f4a[_0xc8f4('0x2d')]);_0x413a55[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x413a55[_0xc8f4('0x2c')],_0x413a55[_0xc8f4('0x2d')]);_0x49da16['attributes']=_['intersection'](_0x413a55[_0xc8f4('0x2c')],qs[_0xc8f4('0x32')](_0x275f4a[_0xc8f4('0x2d')]['fields']));_0x49da16['attributes']=_0x49da16['attributes']['length']?_0x49da16['attributes']:_0x413a55[_0xc8f4('0x2c')];if(_0x275f4a[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x49da16[_0xc8f4('0x40')]=[{'all':!![]}];}_0x49da16=_[_0xc8f4('0x3c')]({},_0x49da16,_0x275f4a[_0xc8f4('0x3d')]);return db['MailQueueReport'][_0xc8f4('0x45')](_0x49da16)[_0xc8f4('0x24')](handleEntityNotFound(_0x588ff9,null))['then'](respondWithResult(_0x588ff9,null))['catch'](handleError(_0x588ff9,null));};exports[_0xc8f4('0x46')]=function(_0x82a5e,_0x3ca0d6){return db[_0xc8f4('0x3e')]['create'](_0x82a5e['body'],{})[_0xc8f4('0x24')](respondWithResult(_0x3ca0d6,0xc9))[_0xc8f4('0x42')](handleError(_0x3ca0d6,null));};exports[_0xc8f4('0x47')]=function(_0x2bc4db,_0x141f81){if(_0x2bc4db[_0xc8f4('0x48')]['id']){delete _0x2bc4db['body']['id'];}return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x2bc4db[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x141f81,null))[_0xc8f4('0x24')](saveUpdates(_0x2bc4db[_0xc8f4('0x48')],null))[_0xc8f4('0x24')](respondWithResult(_0x141f81,null))[_0xc8f4('0x42')](handleError(_0x141f81,null));};exports[_0xc8f4('0x25')]=function(_0x3d9d67,_0x5b4035){return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x3d9d67[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x5b4035,null))[_0xc8f4('0x24')](removeEntity(_0x5b4035,null))[_0xc8f4('0x42')](handleError(_0x5b4035,null));};exports[_0xc8f4('0x49')]=function(_0x4715f3,_0x36c304){return db[_0xc8f4('0x3e')][_0xc8f4('0x49')]()[_0xc8f4('0x24')](respondWithResult(_0x36c304,null))[_0xc8f4('0x42')](handleError(_0x36c304,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 122865b..ddb350e 100644 --- a/server/api/mailQueueReport/mailQueueReport.model.js +++ b/server/api/mailQueueReport/mailQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bc0=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x3c4519,_0x1fccdf){var _0x3ff5f4=function(_0x47b6e4){while(--_0x47b6e4){_0x3c4519['push'](_0x3c4519['shift']());}};_0x3ff5f4(++_0x1fccdf);}(_0x4bc0,0x1df));var _0x04bc=function(_0x54bb01,_0x8d44df){_0x54bb01=_0x54bb01-0x0;var _0x3aa3ad=_0x4bc0[_0x54bb01];return _0x3aa3ad;};'use strict';var _=require(_0x04bc('0x0'));var util=require(_0x04bc('0x1'));var logger=require(_0x04bc('0x2'))(_0x04bc('0x3'));var moment=require(_0x04bc('0x4'));var BPromise=require(_0x04bc('0x5'));var rp=require(_0x04bc('0x6'));var fs=require('fs');var path=require(_0x04bc('0x7'));var rimraf=require(_0x04bc('0x8'));var config=require(_0x04bc('0x9'));var attributes=require(_0x04bc('0xa'));module['exports']=function(_0x1e4f48,_0x575df5){return _0x1e4f48['define'](_0x04bc('0xb'),attributes,{'tableName':_0x04bc('0xc'),'paranoid':![],'indexes':[{'name':_0x04bc('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e91=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x5681c2,_0x102b11){var _0x4f0f6e=function(_0x5957a4){while(--_0x5957a4){_0x5681c2['push'](_0x5681c2['shift']());}};_0x4f0f6e(++_0x102b11);}(_0x9e91,0x1ca));var _0x19e9=function(_0x3a5520,_0xd3d178){_0x3a5520=_0x3a5520-0x0;var _0x4e6608=_0x9e91[_0x3a5520];return _0x4e6608;};'use strict';var _=require(_0x19e9('0x0'));var util=require(_0x19e9('0x1'));var logger=require(_0x19e9('0x2'))(_0x19e9('0x3'));var moment=require(_0x19e9('0x4'));var BPromise=require(_0x19e9('0x5'));var rp=require(_0x19e9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19e9('0x7'));var config=require(_0x19e9('0x8'));var attributes=require(_0x19e9('0x9'));module['exports']=function(_0x1420d8,_0x5557d4){return _0x1420d8['define'](_0x19e9('0xa'),attributes,{'tableName':_0x19e9('0xb'),'paranoid':![],'indexes':[{'name':_0x19e9('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index dcd6978..53ec373 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x15edc8,_0x1d6a33){var _0x358d92=function(_0xfa5fa5){while(--_0xfa5fa5){_0x15edc8['push'](_0x15edc8['shift']());}};_0x358d92(++_0x1d6a33);}(_0xadb5,0xad));var _0x5adb=function(_0x450410,_0x5d9ae1){_0x450410=_0x450410-0x0;var _0x4701a8=_0xadb5[_0x450410];return _0x4701a8;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x4bdca7,_0x39d008){var _0xcbd0fd=function(_0x54e4f1){while(--_0x54e4f1){_0x4bdca7['push'](_0x4bdca7['shift']());}};_0xcbd0fd(++_0x39d008);}(_0x7a54,0x106));var _0x47a5=function(_0x83404,_0x24b682){_0x83404=_0x83404-0x0;var _0x5e8032=_0x7a54[_0x83404];return _0x5e8032;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5ba2a67..9d23fe9 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x17b55e,_0x343aec){var _0x239d97=function(_0x5391d4){while(--_0x5391d4){_0x17b55e['push'](_0x17b55e['shift']());}};_0x239d97(++_0x343aec);}(_0xe706,0xa3));var _0x6e70=function(_0x6f2ce5,_0x4231eb){_0x6f2ce5=_0x6f2ce5-0x0;var _0x28a54a=_0xe706[_0x6f2ce5];return _0x28a54a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ace26,_0x51d3af){var _0x2924fc=function(_0x2a7699){while(--_0x2a7699){_0x2ace26['push'](_0x2ace26['shift']());}};_0x2924fc(++_0x51d3af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xcb91[_0x2ed8f3];return _0x525a55;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 61097fd..5e7251f 100644 --- a/server/api/mailServerIn/mailServerIn.attributes.js +++ b/server/api/mailServerIn/mailServerIn.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe24a=['INBOX','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x1de238,_0x2ad5fa){var _0x23e701=function(_0x4136b3){while(--_0x4136b3){_0x1de238['push'](_0x1de238['shift']());}};_0x23e701(++_0x2ad5fa);}(_0xe24a,0x151));var _0xae24=function(_0x18b490,_0x2aa68f){_0x18b490=_0x18b490-0x0;var _0xd9261=_0xe24a[_0x18b490];return _0xd9261;};'use strict';var Sequelize=require(_0xae24('0x0'));module[_0xae24('0x1')]={'description':{'type':Sequelize[_0xae24('0x2')]},'host':{'type':Sequelize[_0xae24('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xae24('0x3')]},'tls':{'type':Sequelize[_0xae24('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xae24('0x2')],'defaultValue':_0xae24('0x5')},'connTimeout':{'type':Sequelize[_0xae24('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xae24('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xae24('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf9a3=['sequelize','exports','STRING','INTEGER','INBOX'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xf9a3,0x1c7));var _0x3f9a=function(_0x28bbb7,_0x3fa663){_0x28bbb7=_0x28bbb7-0x0;var _0xfe9bd1=_0xf9a3[_0x28bbb7];return _0xfe9bd1;};'use strict';var Sequelize=require(_0x3f9a('0x0'));module[_0x3f9a('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3f9a('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x3f9a('0x2')]},'password':{'type':Sequelize[_0x3f9a('0x2')]},'port':{'type':Sequelize[_0x3f9a('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3f9a('0x2')],'defaultValue':_0x3f9a('0x4')},'connTimeout':{'type':Sequelize[_0x3f9a('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3f9a('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ca73552..2dcb522 100644 --- a/server/api/mailServerIn/mailServerIn.model.js +++ b/server/api/mailServerIn/mailServerIn.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22d9=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','lodash'];(function(_0x2f8437,_0x206ece){var _0x5079f5=function(_0x4fe111){while(--_0x4fe111){_0x2f8437['push'](_0x2f8437['shift']());}};_0x5079f5(++_0x206ece);}(_0x22d9,0xbf));var _0x922d=function(_0x385f32,_0x39c778){_0x385f32=_0x385f32-0x0;var _0x338c20=_0x22d9[_0x385f32];return _0x338c20;};'use strict';var _=require(_0x922d('0x0'));var util=require(_0x922d('0x1'));var logger=require(_0x922d('0x2'))('api');var moment=require(_0x922d('0x3'));var BPromise=require(_0x922d('0x4'));var rp=require(_0x922d('0x5'));var fs=require('fs');var path=require(_0x922d('0x6'));var rimraf=require(_0x922d('0x7'));var config=require(_0x922d('0x8'));var attributes=require(_0x922d('0x9'));module[_0x922d('0xa')]=function(_0x1839a5,_0x48e166){return _0x1839a5[_0x922d('0xb')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5ab=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','mail_servers_in','lodash'];(function(_0x24f1ac,_0x35dae1){var _0x2a24df=function(_0xfc5389){while(--_0xfc5389){_0x24f1ac['push'](_0x24f1ac['shift']());}};_0x2a24df(++_0x35dae1);}(_0xa5ab,0x15d));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba5a('0x0'));var util=require(_0xba5a('0x1'));var logger=require(_0xba5a('0x2'))(_0xba5a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba5a('0x4'));var fs=require('fs');var path=require(_0xba5a('0x5'));var rimraf=require(_0xba5a('0x6'));var config=require(_0xba5a('0x7'));var attributes=require(_0xba5a('0x8'));module['exports']=function(_0x55be9d,_0x57dbb1){return _0x55be9d['define']('MailServerIn',attributes,{'tableName':_0xba5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 3970c3a..e5b5d85 100644 --- a/server/api/mailServerIn/mailServerIn.rpc.js +++ b/server/api/mailServerIn/mailServerIn.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc1e=['result','GetMailServerIn','findAll','options','attributes','limit','include','map','model','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3adc6c,_0x51623f){var _0x42c7e0=function(_0x2a644c){while(--_0x2a644c){_0x3adc6c['push'](_0x3adc6c['shift']());}};_0x42c7e0(++_0x51623f);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xfc1e[_0x34f545];return _0x1ff6b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xefc1('0x0'));var rs=require(_0xefc1('0x1'));var fs=require('fs');var Redis=require(_0xefc1('0x2'));var db=require(_0xefc1('0x3'))['db'];var utils=require(_0xefc1('0x4'));var logger=require('../../config/logger')(_0xefc1('0x5'));var config=require(_0xefc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38927c,_0x44d15b,_0x3ff4a7){return new BPromise(function(_0x45bec4,_0x77f637){return client[_0xefc1('0x8')](_0x38927c,_0x3ff4a7)[_0xefc1('0x9')](function(_0x244927){logger[_0xefc1('0xa')](_0xefc1('0xb'),_0x44d15b,'request\x20sent');logger[_0xefc1('0xc')](_0xefc1('0xd'),_0x44d15b,_0xefc1('0xe'),JSON[_0xefc1('0xf')](_0x244927));if(_0x244927[_0xefc1('0x10')]){if(_0x244927[_0xefc1('0x10')][_0xefc1('0x11')]===0x1f4){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x77f637(_0x244927['error'][_0xefc1('0x12')]);}logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);return _0x45bec4(_0x244927[_0xefc1('0x10')][_0xefc1('0x12')]);}else{logger[_0xefc1('0xa')]('MailServerIn,\x20%s,\x20%s',_0x44d15b,_0xefc1('0xe'));_0x45bec4(_0x244927[_0xefc1('0x13')][_0xefc1('0x12')]);}})['catch'](function(_0x159adb){logger[_0xefc1('0x10')](_0xefc1('0xb'),_0x44d15b,_0x159adb);_0x77f637(_0x159adb);});});}exports[_0xefc1('0x14')]=function(_0x257914){var _0x38923c=this;return new Promise(function(_0x3b5a6e,_0x126052){return db['MailServerIn'][_0xefc1('0x15')]({'raw':_0x257914[_0xefc1('0x16')]?_0x257914[_0xefc1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x257914['options']?_0x257914[_0xefc1('0x16')]['where']||null:null,'attributes':_0x257914[_0xefc1('0x16')]?_0x257914['options'][_0xefc1('0x17')]||null:null,'limit':_0x257914[_0xefc1('0x16')]?_0x257914['options'][_0xefc1('0x18')]||null:null,'include':_0x257914[_0xefc1('0x16')]?_0x257914[_0xefc1('0x16')][_0xefc1('0x19')]?_[_0xefc1('0x1a')](_0x257914[_0xefc1('0x16')]['include'],function(_0x2f4935){return{'model':db[_0x2f4935[_0xefc1('0x1b')]],'as':_0x2f4935['as'],'attributes':_0x2f4935['attributes'],'include':_0x2f4935[_0xefc1('0x19')]?_['map'](_0x2f4935['include'],function(_0x21aa3b){return{'model':db[_0x21aa3b[_0xefc1('0x1b')]],'as':_0x21aa3b['as'],'attributes':_0x21aa3b[_0xefc1('0x17')],'include':_0x21aa3b[_0xefc1('0x19')]?_[_0xefc1('0x1a')](_0x21aa3b[_0xefc1('0x19')],function(_0x538145){return{'model':db[_0x538145['model']],'as':_0x538145['as'],'attributes':_0x538145[_0xefc1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xefc1('0x9')](function(_0x20e438){logger[_0xefc1('0xa')](_0xefc1('0x14'),_0x257914);logger['debug'](_0xefc1('0x14'),_0x257914,JSON[_0xefc1('0xf')](_0x20e438));_0x3b5a6e(_0x20e438);})['catch'](function(_0x486a5b){logger[_0xefc1('0x10')](_0xefc1('0x14'),_0x486a5b[_0xefc1('0x12')],_0x257914);_0x126052(_0x38923c['error'](0x1f4,_0x486a5b[_0xefc1('0x12')]));});});}; \ No newline at end of file +var _0x8525=['where','attributes','include','model','map','then','stringify','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x32e002,_0x121b0d){var _0x725970=function(_0x4dfe95){while(--_0x4dfe95){_0x32e002['push'](_0x32e002['shift']());}};_0x725970(++_0x121b0d);}(_0x8525,0xc7));var _0x5852=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8525[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5852('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5852('0x1'));var fs=require('fs');var Redis=require(_0x5852('0x2'));var db=require(_0x5852('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5852('0x4'))(_0x5852('0x5'));var config=require('../../config/environment');var jayson=require(_0x5852('0x6'));var client=jayson[_0x5852('0x7')][_0x5852('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23aa8e,_0x2a4368,_0x58f94d){return new BPromise(function(_0x6150d4,_0x5d8ad7){return client[_0x5852('0x9')](_0x23aa8e,_0x58f94d)['then'](function(_0x3c2e06){logger[_0x5852('0xa')](_0x5852('0xb'),_0x2a4368,_0x5852('0xc'));logger[_0x5852('0xd')](_0x5852('0xe'),_0x2a4368,_0x5852('0xc'),JSON['stringify'](_0x3c2e06));if(_0x3c2e06[_0x5852('0xf')]){if(_0x3c2e06[_0x5852('0xf')][_0x5852('0x10')]===0x1f4){logger[_0x5852('0xf')](_0x5852('0xb'),_0x2a4368,_0x3c2e06[_0x5852('0xf')][_0x5852('0x11')]);return _0x5d8ad7(_0x3c2e06[_0x5852('0xf')][_0x5852('0x11')]);}logger[_0x5852('0xf')](_0x5852('0xb'),_0x2a4368,_0x3c2e06[_0x5852('0xf')]['message']);return _0x6150d4(_0x3c2e06[_0x5852('0xf')][_0x5852('0x11')]);}else{logger['info'](_0x5852('0xb'),_0x2a4368,_0x5852('0xc'));_0x6150d4(_0x3c2e06[_0x5852('0x12')]['message']);}})[_0x5852('0x13')](function(_0x123ce1){logger[_0x5852('0xf')](_0x5852('0xb'),_0x2a4368,_0x123ce1);_0x5d8ad7(_0x123ce1);});});}exports[_0x5852('0x14')]=function(_0x1c3537){var _0x475f92=this;return new Promise(function(_0x103812,_0x46a0af){return db[_0x5852('0x15')][_0x5852('0x16')]({'raw':_0x1c3537[_0x5852('0x17')]?_0x1c3537['options'][_0x5852('0x18')]===undefined?!![]:![]:!![],'where':_0x1c3537[_0x5852('0x17')]?_0x1c3537[_0x5852('0x17')][_0x5852('0x19')]||null:null,'attributes':_0x1c3537[_0x5852('0x17')]?_0x1c3537['options'][_0x5852('0x1a')]||null:null,'limit':_0x1c3537[_0x5852('0x17')]?_0x1c3537[_0x5852('0x17')]['limit']||null:null,'include':_0x1c3537[_0x5852('0x17')]?_0x1c3537[_0x5852('0x17')][_0x5852('0x1b')]?_['map'](_0x1c3537[_0x5852('0x17')][_0x5852('0x1b')],function(_0x1a226b){return{'model':db[_0x1a226b[_0x5852('0x1c')]],'as':_0x1a226b['as'],'attributes':_0x1a226b['attributes'],'include':_0x1a226b[_0x5852('0x1b')]?_[_0x5852('0x1d')](_0x1a226b[_0x5852('0x1b')],function(_0x330fb6){return{'model':db[_0x330fb6['model']],'as':_0x330fb6['as'],'attributes':_0x330fb6[_0x5852('0x1a')],'include':_0x330fb6['include']?_[_0x5852('0x1d')](_0x330fb6[_0x5852('0x1b')],function(_0x5f59dc){return{'model':db[_0x5f59dc[_0x5852('0x1c')]],'as':_0x5f59dc['as'],'attributes':_0x5f59dc[_0x5852('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5852('0x1e')](function(_0x3849bb){logger[_0x5852('0xa')](_0x5852('0x14'),_0x1c3537);logger[_0x5852('0xd')](_0x5852('0x14'),_0x1c3537,JSON[_0x5852('0x1f')](_0x3849bb));_0x103812(_0x3849bb);})['catch'](function(_0x28fccc){logger[_0x5852('0xf')](_0x5852('0x14'),_0x28fccc[_0x5852('0x11')],_0x1c3537);_0x46a0af(_0x475f92[_0x5852('0xf')](0x1f4,_0x28fccc[_0x5852('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 5196ae2..a1d7e4b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7a54,0x106));var _0x47a5=function(_0xec99ed,_0x38ccc7){_0xec99ed=_0xec99ed-0x0;var _0x551da1=_0x7a54[_0xec99ed];return _0x551da1;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x17e1da,_0x5c241e){_0x17e1da=_0x17e1da-0x0;var _0x47e74f=_0x7a54[_0x17e1da];return _0x47e74f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 1d8a9aa..7e7e781 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x1558be,_0xe0739f){var _0x1a24ed=function(_0x3d169a){while(--_0x3d169a){_0x1558be['push'](_0x1558be['shift']());}};_0x1a24ed(++_0xe0739f);}(_0xb7e7,0x121));var _0x7b7e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb7e7[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'description':{'type':Sequelize[_0x7b7e('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x7b7e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7b7e('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x7b7e('0x1')]},'authentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa5fa=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x31c50a,_0x292631){var _0x2d09e0=function(_0x1213c4){while(--_0x1213c4){_0x31c50a['push'](_0x31c50a['shift']());}};_0x2d09e0(++_0x292631);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x20e4a7,_0x44787f){_0x20e4a7=_0x20e4a7-0x0;var _0x5108e3=_0xa5fa[_0x20e4a7];return _0x5108e3;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'description':{'type':Sequelize[_0xaa5f('0x1')]},'host':{'type':Sequelize[_0xaa5f('0x1')]},'user':{'type':Sequelize[_0xaa5f('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa5f('0x2')]},'secure':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 728393f..a516f2c 100644 --- a/server/api/mailServerOut/mailServerOut.controller.js +++ b/server/api/mailServerOut/mailServerOut.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08d9=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','MailServerOut','findAll','catch','show','keys','rawAttributes','includeAll','include','create','body','params','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x1b41a0,_0x24e232){var _0x5e5e27=function(_0x33c16f){while(--_0x33c16f){_0x1b41a0['push'](_0x1b41a0['shift']());}};_0x5e5e27(++_0x24e232);}(_0x08d9,0x1af));var _0x908d=function(_0x1a4739,_0x37a984){_0x1a4739=_0x1a4739-0x0;var _0x465aa2=_0x08d9[_0x1a4739];return _0x465aa2;};'use strict';var emlformat=require(_0x908d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x908d('0x1'));var rp=require(_0x908d('0x2'));var moment=require(_0x908d('0x3'));var BPromise=require(_0x908d('0x4'));var Mustache=require(_0x908d('0x5'));var util=require('util');var path=require(_0x908d('0x6'));var sox=require(_0x908d('0x7'));var csv=require(_0x908d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x908d('0x9'));var _=require(_0x908d('0xa'));var squel=require(_0x908d('0xb'));var crypto=require(_0x908d('0xc'));var jsforce=require(_0x908d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x908d('0x8'));var querystring=require('querystring');var Papa=require(_0x908d('0xe'));var Redis=require(_0x908d('0xf'));var authService=require(_0x908d('0x10'));var qs=require(_0x908d('0x11'));var as=require(_0x908d('0x12'));var hardwareService=require(_0x908d('0x13'));var logger=require(_0x908d('0x14'))(_0x908d('0x15'));var utils=require(_0x908d('0x16'));var config=require(_0x908d('0x17'));var licenseUtil=require(_0x908d('0x18'));var db=require(_0x908d('0x19'))['db'];function respondWithStatusCode(_0xab851e,_0x39fa94){_0x39fa94=_0x39fa94||0xcc;return function(_0xca003a){if(_0xca003a){return _0xab851e[_0x908d('0x1a')](_0x39fa94);}return _0xab851e[_0x908d('0x1b')](_0x39fa94)[_0x908d('0x1c')]();};}function respondWithResult(_0x447912,_0x3fb4f1){_0x3fb4f1=_0x3fb4f1||0xc8;return function(_0x2d28d3){if(_0x2d28d3){return _0x447912[_0x908d('0x1b')](_0x3fb4f1)['json'](_0x2d28d3);}};}function respondWithFilteredResult(_0x22e63b,_0x10324c){return function(_0xefe024){if(_0xefe024){var _0x510f1e=typeof _0x10324c[_0x908d('0x1d')]==='undefined'&&typeof _0x10324c[_0x908d('0x1e')]==='undefined';var _0xe54e33=_0xefe024[_0x908d('0x1f')];var _0x5060c0=_0x510f1e?0x0:_0x10324c[_0x908d('0x1d')];var _0x3a4bfe=_0x510f1e?_0xefe024['count']:_0x10324c['offset']+_0x10324c[_0x908d('0x1e')];var _0x2c4ad8;if(_0x3a4bfe>=_0xe54e33){_0x3a4bfe=_0xe54e33;_0x2c4ad8=0xc8;}else{_0x2c4ad8=0xce;}_0x22e63b[_0x908d('0x1b')](_0x2c4ad8);return _0x22e63b['set'](_0x908d('0x20'),_0x5060c0+'-'+_0x3a4bfe+'/'+_0xe54e33)['json'](_0xefe024);}return null;};}function patchUpdates(_0x4ddc99){return function(_0x15170d){try{jsonpatch[_0x908d('0x21')](_0x15170d,_0x4ddc99,!![]);}catch(_0x48897b){return BPromise[_0x908d('0x22')](_0x48897b);}return _0x15170d[_0x908d('0x23')]();};}function saveUpdates(_0x1db06f,_0x3593d2){return function(_0x142637){if(_0x142637){return _0x142637['update'](_0x1db06f)[_0x908d('0x24')](function(_0x456b46){return _0x456b46;});}return null;};}function removeEntity(_0x3a0633,_0xd074c9){return function(_0x582d37){if(_0x582d37){return _0x582d37[_0x908d('0x25')]()['then'](function(){_0x3a0633[_0x908d('0x1b')](0xcc)[_0x908d('0x1c')]();});}};}function handleEntityNotFound(_0x30311d,_0x5500bf){return function(_0x32370f){if(!_0x32370f){_0x30311d[_0x908d('0x1a')](0x194);}return _0x32370f;};}function handleError(_0x49e1ac,_0x5d0b71){_0x5d0b71=_0x5d0b71||0x1f4;return function(_0x2646fa){logger['error'](_0x2646fa[_0x908d('0x26')]);if(_0x2646fa[_0x908d('0x27')]){delete _0x2646fa[_0x908d('0x27')];}_0x49e1ac['status'](_0x5d0b71)[_0x908d('0x28')](_0x2646fa);};}exports[_0x908d('0x29')]=function(_0x3f1d9a,_0x370497){var _0x10fff8={},_0x5209f5={},_0x5143a6={'count':0x0,'rows':[]};var _0xdbd978=_['map'](db['MailServerOut']['rawAttributes'],function(_0xc501fb){return{'name':_0xc501fb[_0x908d('0x2a')],'type':_0xc501fb[_0x908d('0x2b')][_0x908d('0x2c')]};});_0x5209f5[_0x908d('0x2d')]=_[_0x908d('0x2e')](_0xdbd978,_0x908d('0x27'));_0x5209f5['query']=_['keys'](_0x3f1d9a['query']);_0x5209f5[_0x908d('0x2f')]=_[_0x908d('0x30')](_0x5209f5[_0x908d('0x2d')],_0x5209f5[_0x908d('0x31')]);_0x10fff8[_0x908d('0x32')]=_[_0x908d('0x30')](_0x5209f5[_0x908d('0x2d')],qs[_0x908d('0x33')](_0x3f1d9a[_0x908d('0x31')][_0x908d('0x33')]));_0x10fff8[_0x908d('0x32')]=_0x10fff8[_0x908d('0x32')][_0x908d('0x34')]?_0x10fff8['attributes']:_0x5209f5['model'];if(!_0x3f1d9a[_0x908d('0x31')][_0x908d('0x35')](_0x908d('0x36'))){_0x10fff8[_0x908d('0x1e')]=qs[_0x908d('0x1e')](_0x3f1d9a[_0x908d('0x31')][_0x908d('0x1e')]);_0x10fff8[_0x908d('0x1d')]=qs[_0x908d('0x1d')](_0x3f1d9a[_0x908d('0x31')][_0x908d('0x1d')]);}_0x10fff8[_0x908d('0x37')]=qs[_0x908d('0x38')](_0x3f1d9a[_0x908d('0x31')][_0x908d('0x38')]);_0x10fff8[_0x908d('0x39')]=qs[_0x908d('0x2f')](_['pick'](_0x3f1d9a[_0x908d('0x31')],_0x5209f5[_0x908d('0x2f')]),_0xdbd978);if(_0x3f1d9a[_0x908d('0x31')][_0x908d('0x3a')]){_0x10fff8[_0x908d('0x39')]=_['merge'](_0x10fff8[_0x908d('0x39')],{'$or':_['map'](_0xdbd978,function(_0x1c5e83){if(_0x1c5e83[_0x908d('0x2b')]!==_0x908d('0x3b')){var _0x1f97eb={};_0x1f97eb[_0x1c5e83[_0x908d('0x27')]]={'$like':'%'+_0x3f1d9a['query']['filter']+'%'};return _0x1f97eb;}})});}_0x10fff8=_[_0x908d('0x3c')]({},_0x10fff8,_0x3f1d9a[_0x908d('0x3d')]);var _0x2ece91={'where':_0x10fff8[_0x908d('0x39')]};return db[_0x908d('0x3e')]['count'](_0x2ece91)[_0x908d('0x24')](function(_0x2f131d){_0x5143a6[_0x908d('0x1f')]=_0x2f131d;if(_0x3f1d9a[_0x908d('0x31')]['includeAll']){_0x10fff8['include']=[{'all':!![]}];}return db['MailServerOut'][_0x908d('0x3f')](_0x10fff8);})['then'](function(_0x4497c6){_0x5143a6['rows']=_0x4497c6;return _0x5143a6;})[_0x908d('0x24')](respondWithFilteredResult(_0x370497,_0x10fff8))[_0x908d('0x40')](handleError(_0x370497,null));};exports[_0x908d('0x41')]=function(_0xc9bc72,_0xefb311){var _0x5d6d9a={'raw':!![],'where':{'id':_0xc9bc72['params']['id']}},_0x20923a={};_0x20923a[_0x908d('0x2d')]=_[_0x908d('0x42')](db[_0x908d('0x3e')][_0x908d('0x43')]);_0x20923a['query']=_[_0x908d('0x42')](_0xc9bc72[_0x908d('0x31')]);_0x20923a[_0x908d('0x2f')]=_[_0x908d('0x30')](_0x20923a[_0x908d('0x2d')],_0x20923a[_0x908d('0x31')]);_0x5d6d9a['attributes']=_[_0x908d('0x30')](_0x20923a[_0x908d('0x2d')],qs[_0x908d('0x33')](_0xc9bc72[_0x908d('0x31')][_0x908d('0x33')]));_0x5d6d9a['attributes']=_0x5d6d9a[_0x908d('0x32')][_0x908d('0x34')]?_0x5d6d9a[_0x908d('0x32')]:_0x20923a[_0x908d('0x2d')];if(_0xc9bc72['query'][_0x908d('0x44')]){_0x5d6d9a[_0x908d('0x45')]=[{'all':!![]}];}_0x5d6d9a=_['merge']({},_0x5d6d9a,_0xc9bc72[_0x908d('0x3d')]);return db[_0x908d('0x3e')]['find'](_0x5d6d9a)['then'](handleEntityNotFound(_0xefb311,null))[_0x908d('0x24')](respondWithResult(_0xefb311,null))[_0x908d('0x40')](handleError(_0xefb311,null));};exports[_0x908d('0x46')]=function(_0x159b41,_0x12bcef){return db['MailServerOut']['create'](_0x159b41['body'],{})[_0x908d('0x24')](respondWithResult(_0x12bcef,0xc9))['catch'](handleError(_0x12bcef,null));};exports['update']=function(_0x10aafe,_0x192517){if(_0x10aafe[_0x908d('0x47')]['id']){delete _0x10aafe[_0x908d('0x47')]['id'];}return db[_0x908d('0x3e')]['find']({'where':{'id':_0x10aafe[_0x908d('0x48')]['id']}})[_0x908d('0x24')](handleEntityNotFound(_0x192517,null))[_0x908d('0x24')](saveUpdates(_0x10aafe['body'],null))[_0x908d('0x24')](respondWithResult(_0x192517,null))[_0x908d('0x40')](handleError(_0x192517,null));};exports['destroy']=function(_0x50ed62,_0x5f4eaf){return db[_0x908d('0x3e')][_0x908d('0x49')]({'where':{'id':_0x50ed62[_0x908d('0x48')]['id']}})[_0x908d('0x24')](handleEntityNotFound(_0x5f4eaf,null))['then'](removeEntity(_0x5f4eaf,null))[_0x908d('0x40')](handleError(_0x5f4eaf,null));}; \ No newline at end of file +var _0xaa8d=['send','index','map','MailServerOut','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','end','error','stack','name'];(function(_0x55810e,_0x141350){var _0x3825d8=function(_0x5e5fcc){while(--_0x5e5fcc){_0x55810e['push'](_0x55810e['shift']());}};_0x3825d8(++_0x141350);}(_0xaa8d,0x146));var _0xdaa8=function(_0x2de99e,_0xeaf32f){_0x2de99e=_0x2de99e-0x0;var _0x3e91d2=_0xaa8d[_0x2de99e];return _0x3e91d2;};'use strict';var emlformat=require(_0xdaa8('0x0'));var rimraf=require(_0xdaa8('0x1'));var zipdir=require(_0xdaa8('0x2'));var jsonpatch=require(_0xdaa8('0x3'));var rp=require(_0xdaa8('0x4'));var moment=require(_0xdaa8('0x5'));var BPromise=require(_0xdaa8('0x6'));var Mustache=require(_0xdaa8('0x7'));var util=require(_0xdaa8('0x8'));var path=require('path');var sox=require(_0xdaa8('0x9'));var csv=require(_0xdaa8('0xa'));var ejs=require(_0xdaa8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaa8('0xc'));var squel=require(_0xdaa8('0xd'));var crypto=require(_0xdaa8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdaa8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdaa8('0x10'));var Papa=require(_0xdaa8('0x11'));var Redis=require('ioredis');var authService=require(_0xdaa8('0x12'));var qs=require(_0xdaa8('0x13'));var as=require(_0xdaa8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xdaa8('0x15'));var licenseUtil=require(_0xdaa8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11fbb4,_0xdcc463){_0xdcc463=_0xdcc463||0xcc;return function(_0x3f0e79){if(_0x3f0e79){return _0x11fbb4[_0xdaa8('0x17')](_0xdcc463);}return _0x11fbb4[_0xdaa8('0x18')](_0xdcc463)['end']();};}function respondWithResult(_0xb09eb1,_0x3b2d3a){_0x3b2d3a=_0x3b2d3a||0xc8;return function(_0x59bbcf){if(_0x59bbcf){return _0xb09eb1[_0xdaa8('0x18')](_0x3b2d3a)[_0xdaa8('0x19')](_0x59bbcf);}};}function respondWithFilteredResult(_0x5e3811,_0x5a97c1){return function(_0x5a474e){if(_0x5a474e){var _0x1c90e9=typeof _0x5a97c1[_0xdaa8('0x1a')]===_0xdaa8('0x1b')&&typeof _0x5a97c1[_0xdaa8('0x1c')]===_0xdaa8('0x1b');var _0x3d024f=_0x5a474e[_0xdaa8('0x1d')];var _0x856ee6=_0x1c90e9?0x0:_0x5a97c1[_0xdaa8('0x1a')];var _0x2d981b=_0x1c90e9?_0x5a474e[_0xdaa8('0x1d')]:_0x5a97c1[_0xdaa8('0x1a')]+_0x5a97c1[_0xdaa8('0x1c')];var _0x28caac;if(_0x2d981b>=_0x3d024f){_0x2d981b=_0x3d024f;_0x28caac=0xc8;}else{_0x28caac=0xce;}_0x5e3811['status'](_0x28caac);return _0x5e3811[_0xdaa8('0x1e')](_0xdaa8('0x1f'),_0x856ee6+'-'+_0x2d981b+'/'+_0x3d024f)[_0xdaa8('0x19')](_0x5a474e);}return null;};}function patchUpdates(_0x328d99){return function(_0x19aac9){try{jsonpatch[_0xdaa8('0x20')](_0x19aac9,_0x328d99,!![]);}catch(_0x397371){return BPromise['reject'](_0x397371);}return _0x19aac9['save']();};}function saveUpdates(_0x30082f,_0x219ffb){return function(_0x3d441e){if(_0x3d441e){return _0x3d441e['update'](_0x30082f)[_0xdaa8('0x21')](function(_0x443058){return _0x443058;});}return null;};}function removeEntity(_0x56a56c,_0x153c4a){return function(_0x233b51){if(_0x233b51){return _0x233b51[_0xdaa8('0x22')]()[_0xdaa8('0x21')](function(){_0x56a56c['status'](0xcc)[_0xdaa8('0x23')]();});}};}function handleEntityNotFound(_0x3dbc4c,_0x1ab8d4){return function(_0x214214){if(!_0x214214){_0x3dbc4c['sendStatus'](0x194);}return _0x214214;};}function handleError(_0x3acc50,_0x6dacfe){_0x6dacfe=_0x6dacfe||0x1f4;return function(_0x4d0989){logger[_0xdaa8('0x24')](_0x4d0989[_0xdaa8('0x25')]);if(_0x4d0989[_0xdaa8('0x26')]){delete _0x4d0989[_0xdaa8('0x26')];}_0x3acc50[_0xdaa8('0x18')](_0x6dacfe)[_0xdaa8('0x27')](_0x4d0989);};}exports[_0xdaa8('0x28')]=function(_0x106c23,_0x319e36){var _0x3718d8={},_0x3f9bb2={},_0x31e850={'count':0x0,'rows':[]};var _0x1ff82f=_[_0xdaa8('0x29')](db[_0xdaa8('0x2a')][_0xdaa8('0x2b')],function(_0x3866d3){return{'name':_0x3866d3['fieldName'],'type':_0x3866d3[_0xdaa8('0x2c')][_0xdaa8('0x2d')]};});_0x3f9bb2[_0xdaa8('0x2e')]=_[_0xdaa8('0x29')](_0x1ff82f,'name');_0x3f9bb2[_0xdaa8('0x2f')]=_['keys'](_0x106c23['query']);_0x3f9bb2['filters']=_[_0xdaa8('0x30')](_0x3f9bb2[_0xdaa8('0x2e')],_0x3f9bb2[_0xdaa8('0x2f')]);_0x3718d8[_0xdaa8('0x31')]=_['intersection'](_0x3f9bb2[_0xdaa8('0x2e')],qs[_0xdaa8('0x32')](_0x106c23[_0xdaa8('0x2f')][_0xdaa8('0x32')]));_0x3718d8[_0xdaa8('0x31')]=_0x3718d8[_0xdaa8('0x31')][_0xdaa8('0x33')]?_0x3718d8[_0xdaa8('0x31')]:_0x3f9bb2[_0xdaa8('0x2e')];if(!_0x106c23[_0xdaa8('0x2f')][_0xdaa8('0x34')](_0xdaa8('0x35'))){_0x3718d8[_0xdaa8('0x1c')]=qs['limit'](_0x106c23[_0xdaa8('0x2f')]['limit']);_0x3718d8[_0xdaa8('0x1a')]=qs[_0xdaa8('0x1a')](_0x106c23['query'][_0xdaa8('0x1a')]);}_0x3718d8['order']=qs[_0xdaa8('0x36')](_0x106c23[_0xdaa8('0x2f')][_0xdaa8('0x36')]);_0x3718d8[_0xdaa8('0x37')]=qs[_0xdaa8('0x38')](_[_0xdaa8('0x39')](_0x106c23[_0xdaa8('0x2f')],_0x3f9bb2[_0xdaa8('0x38')]),_0x1ff82f);if(_0x106c23[_0xdaa8('0x2f')][_0xdaa8('0x3a')]){_0x3718d8[_0xdaa8('0x37')]=_[_0xdaa8('0x3b')](_0x3718d8[_0xdaa8('0x37')],{'$or':_[_0xdaa8('0x29')](_0x1ff82f,function(_0x230e54){if(_0x230e54[_0xdaa8('0x2c')]!==_0xdaa8('0x3c')){var _0x2617ea={};_0x2617ea[_0x230e54['name']]={'$like':'%'+_0x106c23[_0xdaa8('0x2f')][_0xdaa8('0x3a')]+'%'};return _0x2617ea;}})});}_0x3718d8=_[_0xdaa8('0x3b')]({},_0x3718d8,_0x106c23['options']);var _0x2bb2ff={'where':_0x3718d8[_0xdaa8('0x37')]};return db[_0xdaa8('0x2a')][_0xdaa8('0x1d')](_0x2bb2ff)[_0xdaa8('0x21')](function(_0x4f6e74){_0x31e850[_0xdaa8('0x1d')]=_0x4f6e74;if(_0x106c23['query']['includeAll']){_0x3718d8[_0xdaa8('0x3d')]=[{'all':!![]}];}return db[_0xdaa8('0x2a')][_0xdaa8('0x3e')](_0x3718d8);})[_0xdaa8('0x21')](function(_0x13a66d){_0x31e850[_0xdaa8('0x3f')]=_0x13a66d;return _0x31e850;})[_0xdaa8('0x21')](respondWithFilteredResult(_0x319e36,_0x3718d8))[_0xdaa8('0x40')](handleError(_0x319e36,null));};exports[_0xdaa8('0x41')]=function(_0x56e6cd,_0x4c7b7d){var _0x130fe0={'raw':!![],'where':{'id':_0x56e6cd[_0xdaa8('0x42')]['id']}},_0x50bae9={};_0x50bae9[_0xdaa8('0x2e')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x50bae9[_0xdaa8('0x2f')]=_[_0xdaa8('0x43')](_0x56e6cd[_0xdaa8('0x2f')]);_0x50bae9[_0xdaa8('0x38')]=_[_0xdaa8('0x30')](_0x50bae9[_0xdaa8('0x2e')],_0x50bae9['query']);_0x130fe0[_0xdaa8('0x31')]=_['intersection'](_0x50bae9[_0xdaa8('0x2e')],qs[_0xdaa8('0x32')](_0x56e6cd[_0xdaa8('0x2f')][_0xdaa8('0x32')]));_0x130fe0[_0xdaa8('0x31')]=_0x130fe0[_0xdaa8('0x31')][_0xdaa8('0x33')]?_0x130fe0[_0xdaa8('0x31')]:_0x50bae9[_0xdaa8('0x2e')];if(_0x56e6cd[_0xdaa8('0x2f')][_0xdaa8('0x44')]){_0x130fe0[_0xdaa8('0x3d')]=[{'all':!![]}];}_0x130fe0=_[_0xdaa8('0x3b')]({},_0x130fe0,_0x56e6cd['options']);return db[_0xdaa8('0x2a')][_0xdaa8('0x45')](_0x130fe0)[_0xdaa8('0x21')](handleEntityNotFound(_0x4c7b7d,null))[_0xdaa8('0x21')](respondWithResult(_0x4c7b7d,null))[_0xdaa8('0x40')](handleError(_0x4c7b7d,null));};exports[_0xdaa8('0x46')]=function(_0x366bc2,_0x31c08b){return db['MailServerOut']['create'](_0x366bc2[_0xdaa8('0x47')],{})['then'](respondWithResult(_0x31c08b,0xc9))['catch'](handleError(_0x31c08b,null));};exports[_0xdaa8('0x48')]=function(_0x375ab3,_0x5539e1){if(_0x375ab3['body']['id']){delete _0x375ab3['body']['id'];}return db[_0xdaa8('0x2a')][_0xdaa8('0x45')]({'where':{'id':_0x375ab3[_0xdaa8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5539e1,null))[_0xdaa8('0x21')](saveUpdates(_0x375ab3[_0xdaa8('0x47')],null))[_0xdaa8('0x21')](respondWithResult(_0x5539e1,null))['catch'](handleError(_0x5539e1,null));};exports[_0xdaa8('0x22')]=function(_0x12e286,_0x12fa43){return db[_0xdaa8('0x2a')][_0xdaa8('0x45')]({'where':{'id':_0x12e286[_0xdaa8('0x42')]['id']}})[_0xdaa8('0x21')](handleEntityNotFound(_0x12fa43,null))[_0xdaa8('0x21')](removeEntity(_0x12fa43,null))[_0xdaa8('0x40')](handleError(_0x12fa43,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 01be200..a514db3 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['api','moment','request-promise','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','../../config/logger'];(function(_0x369bf2,_0x3b7c97){var _0x39fe4e=function(_0x25c765){while(--_0x25c765){_0x369bf2['push'](_0x369bf2['shift']());}};_0x39fe4e(++_0x3b7c97);}(_0xa8a8,0x1c1));var _0x8a8a=function(_0x414bae,_0x58e10b){_0x414bae=_0x414bae-0x0;var _0x1ccdca=_0xa8a8[_0x414bae];return _0x1ccdca;};'use strict';var _=require(_0x8a8a('0x0'));var util=require('util');var logger=require(_0x8a8a('0x1'))(_0x8a8a('0x2'));var moment=require(_0x8a8a('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a8a('0x4'));var fs=require('fs');var path=require(_0x8a8a('0x5'));var rimraf=require('rimraf');var config=require(_0x8a8a('0x6'));var attributes=require(_0x8a8a('0x7'));module['exports']=function(_0x42a281,_0x2d030b){return _0x42a281[_0x8a8a('0x8')](_0x8a8a('0x9'),attributes,{'tableName':_0x8a8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7cf=['exports','define','MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x31c43d,_0x3edf8d){var _0x418885=function(_0x4f7de4){while(--_0x4f7de4){_0x31c43d['push'](_0x31c43d['shift']());}};_0x418885(++_0x3edf8d);}(_0xd7cf,0x1e0));var _0xfd7c=function(_0x4c3a36,_0xdba60f){_0x4c3a36=_0x4c3a36-0x0;var _0x40f945=_0xd7cf[_0x4c3a36];return _0x40f945;};'use strict';var _=require(_0xfd7c('0x0'));var util=require(_0xfd7c('0x1'));var logger=require('../../config/logger')(_0xfd7c('0x2'));var moment=require(_0xfd7c('0x3'));var BPromise=require(_0xfd7c('0x4'));var rp=require(_0xfd7c('0x5'));var fs=require('fs');var path=require(_0xfd7c('0x6'));var rimraf=require(_0xfd7c('0x7'));var config=require(_0xfd7c('0x8'));var attributes=require(_0xfd7c('0x9'));module[_0xfd7c('0xa')]=function(_0x2e6d26,_0x11fdc0){return _0x2e6d26[_0xfd7c('0xb')](_0xfd7c('0xc'),attributes,{'tableName':_0xfd7c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index bd684cc..735c766 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1c0261,_0xbe62af){var _0x1f81d0=function(_0xd4ea57){while(--_0xd4ea57){_0x1c0261['push'](_0x1c0261['shift']());}};_0x1f81d0(++_0xbe62af);}(_0xadb5,0xad));var _0x5adb=function(_0x590a73,_0x188557){_0x590a73=_0x590a73-0x0;var _0x427a51=_0xadb5[_0x590a73];return _0x427a51;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4b0c74,_0xa3c38d){var _0x3c548b=function(_0x105e7e){while(--_0x105e7e){_0x4b0c74['push'](_0x4b0c74['shift']());}};_0x3c548b(++_0xa3c38d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x40692b,_0xaa6103){_0x40692b=_0x40692b-0x0;var _0x3d4a1a=_0x5f2f[_0x40692b];return _0x3d4a1a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e43b049..23b38f8 100644 --- a/server/api/mailSubstatus/index.js +++ b/server/api/mailSubstatus/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43ae=['post','create','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x169600,_0x1d1346){var _0x3bee22=function(_0x19639b){while(--_0x19639b){_0x169600['push'](_0x169600['shift']());}};_0x3bee22(++_0x1d1346);}(_0x43ae,0x181));var _0xe43a=function(_0x179b39,_0x15bd1b){_0x179b39=_0x179b39-0x0;var _0x31d4d5=_0x43ae[_0x179b39];return _0x31d4d5;};'use strict';var multer=require(_0xe43a('0x0'));var util=require(_0xe43a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe43a('0x2'));var router=express[_0xe43a('0x3')]();var fs_extra=require(_0xe43a('0x4'));var auth=require(_0xe43a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe43a('0x6'));var controller=require(_0xe43a('0x7'));router[_0xe43a('0x8')]('/',auth[_0xe43a('0x9')](),controller[_0xe43a('0xa')]);router[_0xe43a('0x8')]('/describe',auth[_0xe43a('0x9')](),controller[_0xe43a('0xb')]);router['get'](_0xe43a('0xc'),auth[_0xe43a('0x9')](),controller[_0xe43a('0xd')]);router[_0xe43a('0xe')]('/',auth[_0xe43a('0x9')](),controller[_0xe43a('0xf')]);router['put']('/:id',auth[_0xe43a('0x9')](),controller[_0xe43a('0x10')]);router['delete'](_0xe43a('0xc'),auth[_0xe43a('0x9')](),controller[_0xe43a('0x11')]);module[_0xe43a('0x12')]=router; \ No newline at end of file +var _0xa904=['post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x5f4b36,_0x18cb34){var _0x4765ec=function(_0x2a6c85){while(--_0x2a6c85){_0x5f4b36['push'](_0x5f4b36['shift']());}};_0x4765ec(++_0x18cb34);}(_0xa904,0x175));var _0x4a90=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xa904[_0x1cfe2e];return _0x39233f;};'use strict';var multer=require(_0x4a90('0x0'));var util=require(_0x4a90('0x1'));var path=require('path');var timeout=require(_0x4a90('0x2'));var express=require(_0x4a90('0x3'));var router=express[_0x4a90('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a90('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4a90('0x6'));var controller=require('./mailSubstatus.controller');router[_0x4a90('0x7')]('/',auth[_0x4a90('0x8')](),controller['index']);router[_0x4a90('0x7')]('/describe',auth[_0x4a90('0x8')](),controller[_0x4a90('0x9')]);router[_0x4a90('0x7')](_0x4a90('0xa'),auth[_0x4a90('0x8')](),controller['show']);router[_0x4a90('0xb')]('/',auth[_0x4a90('0x8')](),controller[_0x4a90('0xc')]);router['put'](_0x4a90('0xa'),auth['isAuthenticated'](),controller[_0x4a90('0xd')]);router[_0x4a90('0xe')](_0x4a90('0xa'),auth[_0x4a90('0x8')](),controller[_0x4a90('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a2dd490..b176c39 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f9d=['STRING','sequelize'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x8f9d,0x93));var _0xd8f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f9d[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xd8f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd8f9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8f9('0x1')]}}; \ No newline at end of file +var _0x5d17=['sequelize','exports','STRING'];(function(_0x469b35,_0x59629d){var _0x17a821=function(_0x3f54a0){while(--_0x3f54a0){_0x469b35['push'](_0x469b35['shift']());}};_0x17a821(++_0x59629d);}(_0x5d17,0x114));var _0x75d1=function(_0x1a663e,_0x357c47){_0x1a663e=_0x1a663e-0x0;var _0x4055ab=_0x5d17[_0x1a663e];return _0x4055ab;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x75d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7113536..2fc5cdb 100644 --- a/server/api/mailSubstatus/mailSubstatus.controller.js +++ b/server/api/mailSubstatus/mailSubstatus.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4ce=['undefined','limit','count','set','json','apply','reject','update','destroy','then','stack','name','index','map','MailSubstatus','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','merge','filter','options','where','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x5ccb11,_0x2a7465){var _0xd0e6d7=function(_0x5115a3){while(--_0x5115a3){_0x5ccb11['push'](_0x5ccb11['shift']());}};_0xd0e6d7(++_0x2a7465);}(_0xb4ce,0x147));var _0xeb4c=function(_0x336b8a,_0x5aa503){_0x336b8a=_0x336b8a-0x0;var _0x29a921=_0xb4ce[_0x336b8a];return _0x29a921;};'use strict';var emlformat=require(_0xeb4c('0x0'));var rimraf=require(_0xeb4c('0x1'));var zipdir=require(_0xeb4c('0x2'));var jsonpatch=require(_0xeb4c('0x3'));var rp=require(_0xeb4c('0x4'));var moment=require(_0xeb4c('0x5'));var BPromise=require(_0xeb4c('0x6'));var Mustache=require(_0xeb4c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xeb4c('0x8'));var csv=require(_0xeb4c('0x9'));var ejs=require(_0xeb4c('0xa'));var fs=require('fs');var fs_extra=require(_0xeb4c('0xb'));var _=require('lodash');var squel=require(_0xeb4c('0xc'));var crypto=require(_0xeb4c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeb4c('0xe'));var toCsv=require(_0xeb4c('0x9'));var querystring=require(_0xeb4c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeb4c('0x10'));var qs=require(_0xeb4c('0x11'));var as=require(_0xeb4c('0x12'));var hardwareService=require(_0xeb4c('0x13'));var logger=require('../../config/logger')(_0xeb4c('0x14'));var utils=require(_0xeb4c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeb4c('0x16'));var db=require(_0xeb4c('0x17'))['db'];function respondWithStatusCode(_0x2a4bf4,_0xbc6a93){_0xbc6a93=_0xbc6a93||0xcc;return function(_0x3d3acc){if(_0x3d3acc){return _0x2a4bf4[_0xeb4c('0x18')](_0xbc6a93);}return _0x2a4bf4[_0xeb4c('0x19')](_0xbc6a93)[_0xeb4c('0x1a')]();};}function respondWithResult(_0x2af9b9,_0x2e3bbb){_0x2e3bbb=_0x2e3bbb||0xc8;return function(_0x3e1f1b){if(_0x3e1f1b){return _0x2af9b9[_0xeb4c('0x19')](_0x2e3bbb)['json'](_0x3e1f1b);}};}function respondWithFilteredResult(_0x306734,_0x3ff4ae){return function(_0x158d22){if(_0x158d22){var _0x4b973f=typeof _0x3ff4ae[_0xeb4c('0x1b')]===_0xeb4c('0x1c')&&typeof _0x3ff4ae[_0xeb4c('0x1d')]==='undefined';var _0x10f64a=_0x158d22[_0xeb4c('0x1e')];var _0x30d362=_0x4b973f?0x0:_0x3ff4ae[_0xeb4c('0x1b')];var _0x41b146=_0x4b973f?_0x158d22[_0xeb4c('0x1e')]:_0x3ff4ae['offset']+_0x3ff4ae[_0xeb4c('0x1d')];var _0x37efc5;if(_0x41b146>=_0x10f64a){_0x41b146=_0x10f64a;_0x37efc5=0xc8;}else{_0x37efc5=0xce;}_0x306734[_0xeb4c('0x19')](_0x37efc5);return _0x306734[_0xeb4c('0x1f')]('Content-Range',_0x30d362+'-'+_0x41b146+'/'+_0x10f64a)[_0xeb4c('0x20')](_0x158d22);}return null;};}function patchUpdates(_0x222661){return function(_0x45c56b){try{jsonpatch[_0xeb4c('0x21')](_0x45c56b,_0x222661,!![]);}catch(_0x29de7b){return BPromise[_0xeb4c('0x22')](_0x29de7b);}return _0x45c56b['save']();};}function saveUpdates(_0x1a2fd1,_0x10ecc7){return function(_0x1238cd){if(_0x1238cd){return _0x1238cd[_0xeb4c('0x23')](_0x1a2fd1)['then'](function(_0x2b0a92){return _0x2b0a92;});}return null;};}function removeEntity(_0x5af150,_0x3e6d50){return function(_0x24f8d8){if(_0x24f8d8){return _0x24f8d8[_0xeb4c('0x24')]()[_0xeb4c('0x25')](function(){_0x5af150['status'](0xcc)[_0xeb4c('0x1a')]();});}};}function handleEntityNotFound(_0x1a78d0,_0x5653c8){return function(_0x32a38b){if(!_0x32a38b){_0x1a78d0['sendStatus'](0x194);}return _0x32a38b;};}function handleError(_0x118aef,_0x5a3002){_0x5a3002=_0x5a3002||0x1f4;return function(_0x30956c){logger['error'](_0x30956c[_0xeb4c('0x26')]);if(_0x30956c[_0xeb4c('0x27')]){delete _0x30956c[_0xeb4c('0x27')];}_0x118aef[_0xeb4c('0x19')](_0x5a3002)['send'](_0x30956c);};}exports[_0xeb4c('0x28')]=function(_0x158326,_0x5b0351){var _0xc95d7a={},_0x22432d={},_0x190421={'count':0x0,'rows':[]};var _0x268e67=_[_0xeb4c('0x29')](db[_0xeb4c('0x2a')]['rawAttributes'],function(_0x3ebc0d){return{'name':_0x3ebc0d[_0xeb4c('0x2b')],'type':_0x3ebc0d[_0xeb4c('0x2c')]['key']};});_0x22432d[_0xeb4c('0x2d')]=_[_0xeb4c('0x29')](_0x268e67,_0xeb4c('0x27'));_0x22432d[_0xeb4c('0x2e')]=_['keys'](_0x158326[_0xeb4c('0x2e')]);_0x22432d['filters']=_[_0xeb4c('0x2f')](_0x22432d[_0xeb4c('0x2d')],_0x22432d['query']);_0xc95d7a['attributes']=_['intersection'](_0x22432d[_0xeb4c('0x2d')],qs['fields'](_0x158326['query'][_0xeb4c('0x30')]));_0xc95d7a[_0xeb4c('0x31')]=_0xc95d7a[_0xeb4c('0x31')][_0xeb4c('0x32')]?_0xc95d7a['attributes']:_0x22432d['model'];if(!_0x158326['query'][_0xeb4c('0x33')](_0xeb4c('0x34'))){_0xc95d7a['limit']=qs[_0xeb4c('0x1d')](_0x158326[_0xeb4c('0x2e')][_0xeb4c('0x1d')]);_0xc95d7a[_0xeb4c('0x1b')]=qs[_0xeb4c('0x1b')](_0x158326['query'][_0xeb4c('0x1b')]);}_0xc95d7a[_0xeb4c('0x35')]=qs[_0xeb4c('0x36')](_0x158326[_0xeb4c('0x2e')][_0xeb4c('0x36')]);_0xc95d7a['where']=qs['filters'](_['pick'](_0x158326[_0xeb4c('0x2e')],_0x22432d[_0xeb4c('0x37')]),_0x268e67);if(_0x158326['query']['filter']){_0xc95d7a['where']=_[_0xeb4c('0x38')](_0xc95d7a['where'],{'$or':_[_0xeb4c('0x29')](_0x268e67,function(_0x572268){if(_0x572268['type']!=='VIRTUAL'){var _0x4f67c5={};_0x4f67c5[_0x572268['name']]={'$like':'%'+_0x158326['query'][_0xeb4c('0x39')]+'%'};return _0x4f67c5;}})});}_0xc95d7a=_[_0xeb4c('0x38')]({},_0xc95d7a,_0x158326[_0xeb4c('0x3a')]);var _0x2eac46={'where':_0xc95d7a[_0xeb4c('0x3b')]};return db[_0xeb4c('0x2a')]['count'](_0x2eac46)[_0xeb4c('0x25')](function(_0x401972){_0x190421[_0xeb4c('0x1e')]=_0x401972;if(_0x158326[_0xeb4c('0x2e')][_0xeb4c('0x3c')]){_0xc95d7a[_0xeb4c('0x3d')]=[{'all':!![]}];}return db[_0xeb4c('0x2a')][_0xeb4c('0x3e')](_0xc95d7a);})['then'](function(_0x840854){_0x190421[_0xeb4c('0x3f')]=_0x840854;return _0x190421;})[_0xeb4c('0x25')](respondWithFilteredResult(_0x5b0351,_0xc95d7a))['catch'](handleError(_0x5b0351,null));};exports['show']=function(_0x3c9562,_0x457775){var _0x471d2f={'raw':!![],'where':{'id':_0x3c9562[_0xeb4c('0x40')]['id']}},_0x18985b={};_0x18985b[_0xeb4c('0x2d')]=_[_0xeb4c('0x41')](db[_0xeb4c('0x2a')][_0xeb4c('0x42')]);_0x18985b[_0xeb4c('0x2e')]=_[_0xeb4c('0x41')](_0x3c9562['query']);_0x18985b[_0xeb4c('0x37')]=_['intersection'](_0x18985b[_0xeb4c('0x2d')],_0x18985b[_0xeb4c('0x2e')]);_0x471d2f[_0xeb4c('0x31')]=_['intersection'](_0x18985b['model'],qs[_0xeb4c('0x30')](_0x3c9562[_0xeb4c('0x2e')][_0xeb4c('0x30')]));_0x471d2f[_0xeb4c('0x31')]=_0x471d2f[_0xeb4c('0x31')][_0xeb4c('0x32')]?_0x471d2f[_0xeb4c('0x31')]:_0x18985b[_0xeb4c('0x2d')];if(_0x3c9562[_0xeb4c('0x2e')][_0xeb4c('0x3c')]){_0x471d2f['include']=[{'all':!![]}];}_0x471d2f=_['merge']({},_0x471d2f,_0x3c9562['options']);return db[_0xeb4c('0x2a')][_0xeb4c('0x43')](_0x471d2f)[_0xeb4c('0x25')](handleEntityNotFound(_0x457775,null))[_0xeb4c('0x25')](respondWithResult(_0x457775,null))[_0xeb4c('0x44')](handleError(_0x457775,null));};exports['create']=function(_0x12a760,_0x54930c){return db[_0xeb4c('0x2a')]['create'](_0x12a760[_0xeb4c('0x45')],{})[_0xeb4c('0x25')](respondWithResult(_0x54930c,0xc9))[_0xeb4c('0x44')](handleError(_0x54930c,null));};exports[_0xeb4c('0x23')]=function(_0x33bae9,_0x5dbfdf){if(_0x33bae9[_0xeb4c('0x45')]['id']){delete _0x33bae9[_0xeb4c('0x45')]['id'];}return db[_0xeb4c('0x2a')][_0xeb4c('0x43')]({'where':{'id':_0x33bae9[_0xeb4c('0x40')]['id']}})[_0xeb4c('0x25')](handleEntityNotFound(_0x5dbfdf,null))[_0xeb4c('0x25')](saveUpdates(_0x33bae9[_0xeb4c('0x45')],null))[_0xeb4c('0x25')](respondWithResult(_0x5dbfdf,null))['catch'](handleError(_0x5dbfdf,null));};exports[_0xeb4c('0x24')]=function(_0x2d1c8f,_0x3bc128){return db[_0xeb4c('0x2a')]['find']({'where':{'id':_0x2d1c8f[_0xeb4c('0x40')]['id']}})[_0xeb4c('0x25')](handleEntityNotFound(_0x3bc128,null))[_0xeb4c('0x25')](removeEntity(_0x3bc128,null))[_0xeb4c('0x44')](handleError(_0x3bc128,null));};exports[_0xeb4c('0x46')]=function(_0x25f979,_0x2f055b){return db[_0xeb4c('0x2a')][_0xeb4c('0x46')]()[_0xeb4c('0x25')](respondWithResult(_0x2f055b,null))[_0xeb4c('0x44')](handleError(_0x2f055b,null));}; \ No newline at end of file +var _0xd882=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','options','MailSubstatus','includeAll','include','rows','show','params','length','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4c4e7d,_0x541bc7){var _0x414968=function(_0x5f3090){while(--_0x5f3090){_0x4c4e7d['push'](_0x4c4e7d['shift']());}};_0x414968(++_0x541bc7);}(_0xd882,0xd1));var _0x2d88=function(_0x7d0149,_0x1b6d23){_0x7d0149=_0x7d0149-0x0;var _0xaabd78=_0xd882[_0x7d0149];return _0xaabd78;};'use strict';var emlformat=require(_0x2d88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d88('0x1'));var jsonpatch=require(_0x2d88('0x2'));var rp=require(_0x2d88('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2d88('0x4'));var sox=require(_0x2d88('0x5'));var csv=require(_0x2d88('0x6'));var ejs=require(_0x2d88('0x7'));var fs=require('fs');var fs_extra=require(_0x2d88('0x8'));var _=require(_0x2d88('0x9'));var squel=require(_0x2d88('0xa'));var crypto=require(_0x2d88('0xb'));var jsforce=require(_0x2d88('0xc'));var deskjs=require(_0x2d88('0xd'));var toCsv=require(_0x2d88('0x6'));var querystring=require(_0x2d88('0xe'));var Papa=require(_0x2d88('0xf'));var Redis=require(_0x2d88('0x10'));var authService=require(_0x2d88('0x11'));var qs=require(_0x2d88('0x12'));var as=require(_0x2d88('0x13'));var hardwareService=require(_0x2d88('0x14'));var logger=require(_0x2d88('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2d88('0x16'));var licenseUtil=require(_0x2d88('0x17'));var db=require(_0x2d88('0x18'))['db'];function respondWithStatusCode(_0x110a36,_0x426fb0){_0x426fb0=_0x426fb0||0xcc;return function(_0x41c5fe){if(_0x41c5fe){return _0x110a36[_0x2d88('0x19')](_0x426fb0);}return _0x110a36[_0x2d88('0x1a')](_0x426fb0)[_0x2d88('0x1b')]();};}function respondWithResult(_0x54f3b3,_0xf41ec){_0xf41ec=_0xf41ec||0xc8;return function(_0x466b75){if(_0x466b75){return _0x54f3b3['status'](_0xf41ec)[_0x2d88('0x1c')](_0x466b75);}};}function respondWithFilteredResult(_0x23476a,_0x1c27c6){return function(_0x2b5e18){if(_0x2b5e18){var _0x396ddd=typeof _0x1c27c6[_0x2d88('0x1d')]==='undefined'&&typeof _0x1c27c6['limit']==='undefined';var _0x55131f=_0x2b5e18['count'];var _0x3e5db=_0x396ddd?0x0:_0x1c27c6[_0x2d88('0x1d')];var _0x1896db=_0x396ddd?_0x2b5e18[_0x2d88('0x1e')]:_0x1c27c6[_0x2d88('0x1d')]+_0x1c27c6[_0x2d88('0x1f')];var _0x4561a9;if(_0x1896db>=_0x55131f){_0x1896db=_0x55131f;_0x4561a9=0xc8;}else{_0x4561a9=0xce;}_0x23476a[_0x2d88('0x1a')](_0x4561a9);return _0x23476a[_0x2d88('0x20')](_0x2d88('0x21'),_0x3e5db+'-'+_0x1896db+'/'+_0x55131f)[_0x2d88('0x1c')](_0x2b5e18);}return null;};}function patchUpdates(_0x196ea5){return function(_0x148b1d){try{jsonpatch['apply'](_0x148b1d,_0x196ea5,!![]);}catch(_0x2f521d){return BPromise['reject'](_0x2f521d);}return _0x148b1d[_0x2d88('0x22')]();};}function saveUpdates(_0x30e73b,_0x1e57f7){return function(_0x6f9339){if(_0x6f9339){return _0x6f9339[_0x2d88('0x23')](_0x30e73b)[_0x2d88('0x24')](function(_0x52f52f){return _0x52f52f;});}return null;};}function removeEntity(_0xb7adea,_0x5110f6){return function(_0x23e137){if(_0x23e137){return _0x23e137['destroy']()['then'](function(){_0xb7adea[_0x2d88('0x1a')](0xcc)[_0x2d88('0x1b')]();});}};}function handleEntityNotFound(_0x12689c,_0x114585){return function(_0x5de4c6){if(!_0x5de4c6){_0x12689c[_0x2d88('0x19')](0x194);}return _0x5de4c6;};}function handleError(_0x5e96a8,_0x1e2ed2){_0x1e2ed2=_0x1e2ed2||0x1f4;return function(_0x4681ab){logger[_0x2d88('0x25')](_0x4681ab['stack']);if(_0x4681ab['name']){delete _0x4681ab[_0x2d88('0x26')];}_0x5e96a8[_0x2d88('0x1a')](_0x1e2ed2)[_0x2d88('0x27')](_0x4681ab);};}exports[_0x2d88('0x28')]=function(_0x1ef089,_0x2466ea){var _0x36828e={},_0x52d183={},_0x2419db={'count':0x0,'rows':[]};var _0x36f93c=_[_0x2d88('0x29')](db['MailSubstatus'][_0x2d88('0x2a')],function(_0x27fe54){return{'name':_0x27fe54[_0x2d88('0x2b')],'type':_0x27fe54[_0x2d88('0x2c')][_0x2d88('0x2d')]};});_0x52d183[_0x2d88('0x2e')]=_[_0x2d88('0x29')](_0x36f93c,_0x2d88('0x26'));_0x52d183[_0x2d88('0x2f')]=_[_0x2d88('0x30')](_0x1ef089[_0x2d88('0x2f')]);_0x52d183[_0x2d88('0x31')]=_[_0x2d88('0x32')](_0x52d183[_0x2d88('0x2e')],_0x52d183[_0x2d88('0x2f')]);_0x36828e['attributes']=_[_0x2d88('0x32')](_0x52d183[_0x2d88('0x2e')],qs[_0x2d88('0x33')](_0x1ef089[_0x2d88('0x2f')][_0x2d88('0x33')]));_0x36828e[_0x2d88('0x34')]=_0x36828e[_0x2d88('0x34')]['length']?_0x36828e[_0x2d88('0x34')]:_0x52d183[_0x2d88('0x2e')];if(!_0x1ef089[_0x2d88('0x2f')]['hasOwnProperty'](_0x2d88('0x35'))){_0x36828e[_0x2d88('0x1f')]=qs[_0x2d88('0x1f')](_0x1ef089['query'][_0x2d88('0x1f')]);_0x36828e[_0x2d88('0x1d')]=qs[_0x2d88('0x1d')](_0x1ef089[_0x2d88('0x2f')][_0x2d88('0x1d')]);}_0x36828e[_0x2d88('0x36')]=qs['sort'](_0x1ef089[_0x2d88('0x2f')][_0x2d88('0x37')]);_0x36828e['where']=qs[_0x2d88('0x31')](_[_0x2d88('0x38')](_0x1ef089[_0x2d88('0x2f')],_0x52d183[_0x2d88('0x31')]),_0x36f93c);if(_0x1ef089[_0x2d88('0x2f')][_0x2d88('0x39')]){_0x36828e['where']=_[_0x2d88('0x3a')](_0x36828e[_0x2d88('0x3b')],{'$or':_['map'](_0x36f93c,function(_0x59b6e5){if(_0x59b6e5[_0x2d88('0x2c')]!=='VIRTUAL'){var _0x3c8727={};_0x3c8727[_0x59b6e5[_0x2d88('0x26')]]={'$like':'%'+_0x1ef089[_0x2d88('0x2f')][_0x2d88('0x39')]+'%'};return _0x3c8727;}})});}_0x36828e=_[_0x2d88('0x3a')]({},_0x36828e,_0x1ef089[_0x2d88('0x3c')]);var _0x545161={'where':_0x36828e['where']};return db[_0x2d88('0x3d')]['count'](_0x545161)[_0x2d88('0x24')](function(_0xc39cb1){_0x2419db[_0x2d88('0x1e')]=_0xc39cb1;if(_0x1ef089[_0x2d88('0x2f')][_0x2d88('0x3e')]){_0x36828e[_0x2d88('0x3f')]=[{'all':!![]}];}return db[_0x2d88('0x3d')]['findAll'](_0x36828e);})[_0x2d88('0x24')](function(_0x18d014){_0x2419db[_0x2d88('0x40')]=_0x18d014;return _0x2419db;})[_0x2d88('0x24')](respondWithFilteredResult(_0x2466ea,_0x36828e))['catch'](handleError(_0x2466ea,null));};exports[_0x2d88('0x41')]=function(_0x4f93ad,_0x477faa){var _0x47cee5={'raw':!![],'where':{'id':_0x4f93ad[_0x2d88('0x42')]['id']}},_0x559a5e={};_0x559a5e[_0x2d88('0x2e')]=_[_0x2d88('0x30')](db[_0x2d88('0x3d')]['rawAttributes']);_0x559a5e[_0x2d88('0x2f')]=_[_0x2d88('0x30')](_0x4f93ad[_0x2d88('0x2f')]);_0x559a5e[_0x2d88('0x31')]=_[_0x2d88('0x32')](_0x559a5e[_0x2d88('0x2e')],_0x559a5e[_0x2d88('0x2f')]);_0x47cee5['attributes']=_[_0x2d88('0x32')](_0x559a5e[_0x2d88('0x2e')],qs[_0x2d88('0x33')](_0x4f93ad['query'][_0x2d88('0x33')]));_0x47cee5[_0x2d88('0x34')]=_0x47cee5['attributes'][_0x2d88('0x43')]?_0x47cee5[_0x2d88('0x34')]:_0x559a5e[_0x2d88('0x2e')];if(_0x4f93ad[_0x2d88('0x2f')][_0x2d88('0x3e')]){_0x47cee5[_0x2d88('0x3f')]=[{'all':!![]}];}_0x47cee5=_[_0x2d88('0x3a')]({},_0x47cee5,_0x4f93ad[_0x2d88('0x3c')]);return db['MailSubstatus']['find'](_0x47cee5)['then'](handleEntityNotFound(_0x477faa,null))[_0x2d88('0x24')](respondWithResult(_0x477faa,null))[_0x2d88('0x44')](handleError(_0x477faa,null));};exports['create']=function(_0x3f3930,_0x165604){return db[_0x2d88('0x3d')][_0x2d88('0x45')](_0x3f3930[_0x2d88('0x46')],{})[_0x2d88('0x24')](respondWithResult(_0x165604,0xc9))[_0x2d88('0x44')](handleError(_0x165604,null));};exports[_0x2d88('0x23')]=function(_0x4eb2b6,_0x1de575){if(_0x4eb2b6[_0x2d88('0x46')]['id']){delete _0x4eb2b6[_0x2d88('0x46')]['id'];}return db[_0x2d88('0x3d')][_0x2d88('0x47')]({'where':{'id':_0x4eb2b6['params']['id']}})['then'](handleEntityNotFound(_0x1de575,null))[_0x2d88('0x24')](saveUpdates(_0x4eb2b6[_0x2d88('0x46')],null))[_0x2d88('0x24')](respondWithResult(_0x1de575,null))[_0x2d88('0x44')](handleError(_0x1de575,null));};exports['destroy']=function(_0x7f8897,_0x517249){return db[_0x2d88('0x3d')]['find']({'where':{'id':_0x7f8897[_0x2d88('0x42')]['id']}})[_0x2d88('0x24')](handleEntityNotFound(_0x517249,null))['then'](removeEntity(_0x517249,null))['catch'](handleError(_0x517249,null));};exports[_0x2d88('0x48')]=function(_0x5abb34,_0x52d63f){return db[_0x2d88('0x3d')][_0x2d88('0x48')]()['then'](respondWithResult(_0x52d63f,null))[_0x2d88('0x44')](handleError(_0x52d63f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 84b7121..301725f 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x349a=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hook'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x349a,0xba));var _0xa349=function(_0x54cda0,_0x3bf6e9){_0x54cda0=_0x54cda0-0x0;var _0x26f2c2=_0x349a[_0x54cda0];return _0x26f2c2;};'use strict';var EventEmitter=require(_0xa349('0x0'));var MailSubstatus=require(_0xa349('0x1'))['db'][_0xa349('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa349('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x31c070){return function(_0x485149,_0x21a8e2,_0x3db1d9){MailSubstatusEvents['emit'](_0x31c070+':'+_0x485149['id'],_0x485149);MailSubstatusEvents[_0xa349('0x4')](_0x31c070,_0x485149);_0x3db1d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xa349('0x5')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x9556=['exports','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x4b32db,_0x5d8441){var _0x2ae42b=function(_0x15a190){while(--_0x15a190){_0x4b32db['push'](_0x4b32db['shift']());}};_0x2ae42b(++_0x5d8441);}(_0x9556,0xfd));var _0x6955=function(_0xded807,_0x330d83){_0xded807=_0xded807-0x0;var _0x2f7277=_0x9556[_0xded807];return _0x2f7277;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x6955('0x0'))['db'][_0x6955('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x6955('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x16c950){return function(_0x55ef85,_0xe421e6,_0x363a08){MailSubstatusEvents[_0x6955('0x3')](_0x16c950+':'+_0x55ef85['id'],_0x55ef85);MailSubstatusEvents[_0x6955('0x3')](_0x16c950,_0x55ef85);_0x363a08(null);};}for(var e in events){if(events[_0x6955('0x4')](e)){var event=events[e];MailSubstatus[_0x6955('0x5')](e,emitEvent(event));}}module[_0x6955('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5d57aff..b79db8a 100644 --- a/server/api/mailSubstatus/mailSubstatus.model.js +++ b/server/api/mailSubstatus/mailSubstatus.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba62=['_previousDataValues','catch','./mailSubstatus.attributes','define','MailSubstatus','update','name','mailSubstatus'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xba62,0x18a));var _0x2ba6=function(_0x14ea32,_0x262909){_0x14ea32=_0x14ea32-0x0;var _0x137bbb=_0xba62[_0x14ea32];return _0x137bbb;};'use strict';var attributes=require(_0x2ba6('0x0'));module['exports']=function(_0x27022){var _0x2b09f8=_0x27022['models'];return _0x27022[_0x2ba6('0x1')](_0x2ba6('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x962f6d,_0x1c6412,_0x59ac87){return _0x2b09f8['Condition'][_0x2ba6('0x3')]({'value':_0x962f6d[_0x2ba6('0x4')]},{'where':{'field':_0x2ba6('0x5'),'value':_0x962f6d[_0x2ba6('0x6')][_0x2ba6('0x4')]}})['then'](function(){_0x59ac87();})[_0x2ba6('0x7')](function(_0x170201){_0x59ac87(_0x170201);});}}});}; \ No newline at end of file +var _0x8423=['define','MailSubstatus','Condition','name','_previousDataValues','then','catch','exports','models'];(function(_0x3e6a4d,_0x24ef9b){var _0x38f617=function(_0x4ab5b8){while(--_0x4ab5b8){_0x3e6a4d['push'](_0x3e6a4d['shift']());}};_0x38f617(++_0x24ef9b);}(_0x8423,0x11e));var _0x3842=function(_0xc2a696,_0x15cb38){_0xc2a696=_0xc2a696-0x0;var _0x9497da=_0x8423[_0xc2a696];return _0x9497da;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x3842('0x0')]=function(_0x26449f){var _0x5083c4=_0x26449f[_0x3842('0x1')];return _0x26449f[_0x3842('0x2')](_0x3842('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x586d99,_0xf3adb8,_0x36f0d7){return _0x5083c4[_0x3842('0x4')]['update']({'value':_0x586d99[_0x3842('0x5')]},{'where':{'field':'mailSubstatus','value':_0x586d99[_0x3842('0x6')][_0x3842('0x5')]}})[_0x3842('0x7')](function(){_0x36f0d7();})[_0x3842('0x8')](function(_0xa3cc3f){_0x36f0d7(_0xa3cc3f);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 798bcb2..a19958e 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x845a=['code','message','MailSubstatus,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x845a,0x1d2));var _0xa845=function(_0x49115d,_0x48555a){_0x49115d=_0x49115d-0x0;var _0x116c65=_0x845a[_0x49115d];return _0x116c65;};'use strict';var _=require(_0xa845('0x0'));var util=require(_0xa845('0x1'));var moment=require(_0xa845('0x2'));var BPromise=require(_0xa845('0x3'));var rs=require(_0xa845('0x4'));var fs=require('fs');var Redis=require(_0xa845('0x5'));var db=require(_0xa845('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa845('0x7'))(_0xa845('0x8'));var config=require(_0xa845('0x9'));var jayson=require(_0xa845('0xa'));var client=jayson[_0xa845('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f4edd,_0x2a939a,_0x45a0a6){return new BPromise(function(_0x1d5709,_0x255980){return client[_0xa845('0xc')](_0x4f4edd,_0x45a0a6)[_0xa845('0xd')](function(_0x283161){logger[_0xa845('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x2a939a,_0xa845('0xf'));logger['debug'](_0xa845('0x10'),_0x2a939a,'request\x20sent',JSON['stringify'](_0x283161));if(_0x283161[_0xa845('0x11')]){if(_0x283161[_0xa845('0x11')][_0xa845('0x12')]===0x1f4){logger[_0xa845('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x2a939a,_0x283161[_0xa845('0x11')][_0xa845('0x13')]);return _0x255980(_0x283161['error'][_0xa845('0x13')]);}logger['error'](_0xa845('0x14'),_0x2a939a,_0x283161[_0xa845('0x11')][_0xa845('0x13')]);return _0x1d5709(_0x283161[_0xa845('0x11')][_0xa845('0x13')]);}else{logger[_0xa845('0xe')](_0xa845('0x14'),_0x2a939a,_0xa845('0xf'));_0x1d5709(_0x283161[_0xa845('0x15')][_0xa845('0x13')]);}})['catch'](function(_0x2fa811){logger[_0xa845('0x11')](_0xa845('0x14'),_0x2a939a,_0x2fa811);_0x255980(_0x2fa811);});});} \ No newline at end of file +var _0xc834=['message','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x501741,_0x4cd8a1){var _0x2cd07b=function(_0x46b9a8){while(--_0x46b9a8){_0x501741['push'](_0x501741['shift']());}};_0x2cd07b(++_0x4cd8a1);}(_0xc834,0x18d));var _0x4c83=function(_0x244a18,_0x48c537){_0x244a18=_0x244a18-0x0;var _0x56975a=_0xc834[_0x244a18];return _0x56975a;};'use strict';var _=require(_0x4c83('0x0'));var util=require(_0x4c83('0x1'));var moment=require(_0x4c83('0x2'));var BPromise=require(_0x4c83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c83('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c83('0x5'));var logger=require('../../config/logger')(_0x4c83('0x6'));var config=require(_0x4c83('0x7'));var jayson=require(_0x4c83('0x8'));var client=jayson[_0x4c83('0x9')][_0x4c83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e6f69,_0x47421b,_0x1c8bea){return new BPromise(function(_0x3b161a,_0x3e64bb){return client[_0x4c83('0xb')](_0x5e6f69,_0x1c8bea)[_0x4c83('0xc')](function(_0x51417a){logger[_0x4c83('0xd')](_0x4c83('0xe'),_0x47421b,_0x4c83('0xf'));logger[_0x4c83('0x10')](_0x4c83('0x11'),_0x47421b,_0x4c83('0xf'),JSON[_0x4c83('0x12')](_0x51417a));if(_0x51417a[_0x4c83('0x13')]){if(_0x51417a[_0x4c83('0x13')][_0x4c83('0x14')]===0x1f4){logger[_0x4c83('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x47421b,_0x51417a[_0x4c83('0x13')][_0x4c83('0x15')]);return _0x3e64bb(_0x51417a[_0x4c83('0x13')]['message']);}logger[_0x4c83('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x47421b,_0x51417a[_0x4c83('0x13')][_0x4c83('0x15')]);return _0x3b161a(_0x51417a[_0x4c83('0x13')][_0x4c83('0x15')]);}else{logger[_0x4c83('0xd')](_0x4c83('0xe'),_0x47421b,_0x4c83('0xf'));_0x3b161a(_0x51417a['result'][_0x4c83('0x15')]);}})['catch'](function(_0x12bf22){logger[_0x4c83('0x13')](_0x4c83('0xe'),_0x47421b,_0x12bf22);_0x3e64bb(_0x12bf22);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 2ff467b..be79472 100644 --- a/server/api/mailTransferReport/index.js +++ b/server/api/mailTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6564=['/:id','destroy','multer','util','path','connect-timeout','Router','./mailTransferReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create','put','update','delete'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x6564,0xf9));var _0x4656=function(_0x34e3b5,_0x5a0238){_0x34e3b5=_0x34e3b5-0x0;var _0x5f4d91=_0x6564[_0x34e3b5];return _0x5f4d91;};'use strict';var multer=require(_0x4656('0x0'));var util=require(_0x4656('0x1'));var path=require(_0x4656('0x2'));var timeout=require(_0x4656('0x3'));var express=require('express');var router=express[_0x4656('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4656('0x5'));router['get']('/',auth[_0x4656('0x6')](),controller[_0x4656('0x7')]);router['get'](_0x4656('0x8'),auth[_0x4656('0x6')](),controller[_0x4656('0x9')]);router[_0x4656('0xa')]('/:id',auth[_0x4656('0x6')](),controller[_0x4656('0xb')]);router[_0x4656('0xc')]('/',auth[_0x4656('0x6')](),controller[_0x4656('0xd')]);router[_0x4656('0xe')]('/:id',auth[_0x4656('0x6')](),controller[_0x4656('0xf')]);router[_0x4656('0x10')](_0x4656('0x11'),auth['isAuthenticated'](),controller[_0x4656('0x12')]);module['exports']=router; \ No newline at end of file +var _0x985d=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer'];(function(_0x242a36,_0x4294b0){var _0x2cbf1a=function(_0x28dbe5){while(--_0x28dbe5){_0x242a36['push'](_0x242a36['shift']());}};_0x2cbf1a(++_0x4294b0);}(_0x985d,0x84));var _0xd985=function(_0x1128ad,_0x176c0b){_0x1128ad=_0x1128ad-0x0;var _0x87eb88=_0x985d[_0x1128ad];return _0x87eb88;};'use strict';var multer=require(_0xd985('0x0'));var util=require('util');var path=require(_0xd985('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd985('0x2')]();var fs_extra=require(_0xd985('0x3'));var auth=require(_0xd985('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd985('0x5'));var controller=require(_0xd985('0x6'));router['get']('/',auth[_0xd985('0x7')](),controller[_0xd985('0x8')]);router[_0xd985('0x9')](_0xd985('0xa'),auth[_0xd985('0x7')](),controller[_0xd985('0xb')]);router[_0xd985('0x9')](_0xd985('0xc'),auth[_0xd985('0x7')](),controller[_0xd985('0xd')]);router[_0xd985('0xe')]('/',auth[_0xd985('0x7')](),controller[_0xd985('0xf')]);router[_0xd985('0x10')](_0xd985('0xc'),auth[_0xd985('0x7')](),controller[_0xd985('0x11')]);router['delete'](_0xd985('0xc'),auth[_0xd985('0x7')](),controller['destroy']);module[_0xd985('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3a39b90..71fdf94 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4992c9,_0x1035ae){var _0x3b0a6f=function(_0x76753d){while(--_0x76753d){_0x4992c9['push'](_0x4992c9['shift']());}};_0x3b0a6f(++_0x1035ae);}(_0xaa88,0x137));var _0x8aa8=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xaa88[_0x47408e];return _0x1636bc;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3c8db3,_0xaab683){var _0x571f81=function(_0x3e6513){while(--_0x3e6513){_0x3c8db3['push'](_0x3c8db3['shift']());}};_0x571f81(++_0xaab683);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xcb91[_0x82129b];return _0x2ae5dc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0bc556e..7b3d19a 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9468=['MailTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','include','findAll','catch','params','keys','length','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','name','map'];(function(_0x3f127b,_0x986b51){var _0x23ed00=function(_0x305f37){while(--_0x305f37){_0x3f127b['push'](_0x3f127b['shift']());}};_0x23ed00(++_0x986b51);}(_0x9468,0x12a));var _0x8946=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0x9468[_0x53d172];return _0x1bd0a2;};'use strict';var emlformat=require(_0x8946('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8946('0x2'));var moment=require('moment');var BPromise=require(_0x8946('0x3'));var Mustache=require(_0x8946('0x4'));var util=require('util');var path=require(_0x8946('0x5'));var sox=require('sox');var csv=require(_0x8946('0x6'));var ejs=require(_0x8946('0x7'));var fs=require('fs');var fs_extra=require(_0x8946('0x8'));var _=require('lodash');var squel=require(_0x8946('0x9'));var crypto=require(_0x8946('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8946('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8946('0xc'));var Papa=require(_0x8946('0xd'));var Redis=require(_0x8946('0xe'));var authService=require(_0x8946('0xf'));var qs=require(_0x8946('0x10'));var as=require(_0x8946('0x11'));var hardwareService=require(_0x8946('0x12'));var logger=require(_0x8946('0x13'))(_0x8946('0x14'));var utils=require(_0x8946('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8946('0x16'));var db=require(_0x8946('0x17'))['db'];function respondWithStatusCode(_0x4db5e1,_0x4e7a78){_0x4e7a78=_0x4e7a78||0xcc;return function(_0x3c8f05){if(_0x3c8f05){return _0x4db5e1[_0x8946('0x18')](_0x4e7a78);}return _0x4db5e1[_0x8946('0x19')](_0x4e7a78)['end']();};}function respondWithResult(_0x430cb0,_0x35eb09){_0x35eb09=_0x35eb09||0xc8;return function(_0x5c48a0){if(_0x5c48a0){return _0x430cb0[_0x8946('0x19')](_0x35eb09)[_0x8946('0x1a')](_0x5c48a0);}};}function respondWithFilteredResult(_0x473f24,_0xa4cbff){return function(_0x1c3079){if(_0x1c3079){var _0x1543ea=typeof _0xa4cbff['offset']===_0x8946('0x1b')&&typeof _0xa4cbff[_0x8946('0x1c')]===_0x8946('0x1b');var _0x4a4148=_0x1c3079[_0x8946('0x1d')];var _0x215e59=_0x1543ea?0x0:_0xa4cbff['offset'];var _0x201137=_0x1543ea?_0x1c3079[_0x8946('0x1d')]:_0xa4cbff[_0x8946('0x1e')]+_0xa4cbff['limit'];var _0x871fea;if(_0x201137>=_0x4a4148){_0x201137=_0x4a4148;_0x871fea=0xc8;}else{_0x871fea=0xce;}_0x473f24[_0x8946('0x19')](_0x871fea);return _0x473f24[_0x8946('0x1f')](_0x8946('0x20'),_0x215e59+'-'+_0x201137+'/'+_0x4a4148)[_0x8946('0x1a')](_0x1c3079);}return null;};}function patchUpdates(_0x21ead5){return function(_0x5ec245){try{jsonpatch['apply'](_0x5ec245,_0x21ead5,!![]);}catch(_0x2e7800){return BPromise['reject'](_0x2e7800);}return _0x5ec245['save']();};}function saveUpdates(_0x22b09a,_0x2b39d){return function(_0xda7d83){if(_0xda7d83){return _0xda7d83[_0x8946('0x21')](_0x22b09a)[_0x8946('0x22')](function(_0x2cd5d6){return _0x2cd5d6;});}return null;};}function removeEntity(_0x363128,_0x4767c2){return function(_0x5167d1){if(_0x5167d1){return _0x5167d1['destroy']()['then'](function(){_0x363128[_0x8946('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3edcdf,_0x24e898){return function(_0xcbe989){if(!_0xcbe989){_0x3edcdf[_0x8946('0x18')](0x194);}return _0xcbe989;};}function handleError(_0x2069d2,_0x27df6c){_0x27df6c=_0x27df6c||0x1f4;return function(_0x3bc71d){logger['error'](_0x3bc71d['stack']);if(_0x3bc71d[_0x8946('0x23')]){delete _0x3bc71d[_0x8946('0x23')];}_0x2069d2[_0x8946('0x19')](_0x27df6c)['send'](_0x3bc71d);};}exports['index']=function(_0x13ca4e,_0xe2fce8){var _0xd3c7={},_0x329018={},_0x1e6201={'count':0x0,'rows':[]};var _0x121deb=_[_0x8946('0x24')](db[_0x8946('0x25')][_0x8946('0x26')],function(_0x4f4fd4){return{'name':_0x4f4fd4[_0x8946('0x27')],'type':_0x4f4fd4[_0x8946('0x28')][_0x8946('0x29')]};});_0x329018[_0x8946('0x2a')]=_[_0x8946('0x24')](_0x121deb,_0x8946('0x23'));_0x329018[_0x8946('0x2b')]=_['keys'](_0x13ca4e[_0x8946('0x2b')]);_0x329018['filters']=_[_0x8946('0x2c')](_0x329018[_0x8946('0x2a')],_0x329018[_0x8946('0x2b')]);_0xd3c7[_0x8946('0x2d')]=_[_0x8946('0x2c')](_0x329018[_0x8946('0x2a')],qs['fields'](_0x13ca4e[_0x8946('0x2b')][_0x8946('0x2e')]));_0xd3c7[_0x8946('0x2d')]=_0xd3c7[_0x8946('0x2d')]['length']?_0xd3c7['attributes']:_0x329018[_0x8946('0x2a')];if(!_0x13ca4e[_0x8946('0x2b')][_0x8946('0x2f')](_0x8946('0x30'))){_0xd3c7[_0x8946('0x1c')]=qs[_0x8946('0x1c')](_0x13ca4e[_0x8946('0x2b')]['limit']);_0xd3c7[_0x8946('0x1e')]=qs[_0x8946('0x1e')](_0x13ca4e[_0x8946('0x2b')][_0x8946('0x1e')]);}_0xd3c7[_0x8946('0x31')]=qs[_0x8946('0x32')](_0x13ca4e[_0x8946('0x2b')]['sort']);_0xd3c7[_0x8946('0x33')]=qs['filters'](_['pick'](_0x13ca4e[_0x8946('0x2b')],_0x329018[_0x8946('0x34')]),_0x121deb);if(_0x13ca4e['query']['filter']){_0xd3c7[_0x8946('0x33')]=_[_0x8946('0x35')](_0xd3c7[_0x8946('0x33')],{'$or':_['map'](_0x121deb,function(_0xc9012f){if(_0xc9012f[_0x8946('0x28')]!=='VIRTUAL'){var _0x5c8173={};_0x5c8173[_0xc9012f[_0x8946('0x23')]]={'$like':'%'+_0x13ca4e['query']['filter']+'%'};return _0x5c8173;}})});}_0xd3c7=_[_0x8946('0x35')]({},_0xd3c7,_0x13ca4e[_0x8946('0x36')]);var _0x213a05={'where':_0xd3c7[_0x8946('0x33')]};return db[_0x8946('0x25')][_0x8946('0x1d')](_0x213a05)[_0x8946('0x22')](function(_0x45c866){_0x1e6201[_0x8946('0x1d')]=_0x45c866;if(_0x13ca4e[_0x8946('0x2b')]['includeAll']){_0xd3c7[_0x8946('0x37')]=[{'all':!![]}];}return db[_0x8946('0x25')][_0x8946('0x38')](_0xd3c7);})[_0x8946('0x22')](function(_0x3c1b7b){_0x1e6201['rows']=_0x3c1b7b;return _0x1e6201;})[_0x8946('0x22')](respondWithFilteredResult(_0xe2fce8,_0xd3c7))[_0x8946('0x39')](handleError(_0xe2fce8,null));};exports['show']=function(_0x4a98bf,_0x5ce767){var _0x512060={'raw':!![],'where':{'id':_0x4a98bf[_0x8946('0x3a')]['id']}},_0x4c90e1={};_0x4c90e1[_0x8946('0x2a')]=_[_0x8946('0x3b')](db[_0x8946('0x25')]['rawAttributes']);_0x4c90e1[_0x8946('0x2b')]=_[_0x8946('0x3b')](_0x4a98bf['query']);_0x4c90e1[_0x8946('0x34')]=_[_0x8946('0x2c')](_0x4c90e1['model'],_0x4c90e1[_0x8946('0x2b')]);_0x512060[_0x8946('0x2d')]=_[_0x8946('0x2c')](_0x4c90e1['model'],qs['fields'](_0x4a98bf['query'][_0x8946('0x2e')]));_0x512060[_0x8946('0x2d')]=_0x512060[_0x8946('0x2d')][_0x8946('0x3c')]?_0x512060[_0x8946('0x2d')]:_0x4c90e1[_0x8946('0x2a')];if(_0x4a98bf[_0x8946('0x2b')][_0x8946('0x3d')]){_0x512060[_0x8946('0x37')]=[{'all':!![]}];}_0x512060=_[_0x8946('0x35')]({},_0x512060,_0x4a98bf[_0x8946('0x36')]);return db[_0x8946('0x25')][_0x8946('0x3e')](_0x512060)[_0x8946('0x22')](handleEntityNotFound(_0x5ce767,null))['then'](respondWithResult(_0x5ce767,null))['catch'](handleError(_0x5ce767,null));};exports[_0x8946('0x3f')]=function(_0x3610d3,_0x4ef6b9){return db['MailTransferReport'][_0x8946('0x3f')](_0x3610d3[_0x8946('0x40')],{})[_0x8946('0x22')](respondWithResult(_0x4ef6b9,0xc9))['catch'](handleError(_0x4ef6b9,null));};exports['update']=function(_0x523859,_0x4a4ba2){if(_0x523859[_0x8946('0x40')]['id']){delete _0x523859[_0x8946('0x40')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x523859['params']['id']}})[_0x8946('0x22')](handleEntityNotFound(_0x4a4ba2,null))[_0x8946('0x22')](saveUpdates(_0x523859[_0x8946('0x40')],null))[_0x8946('0x22')](respondWithResult(_0x4a4ba2,null))['catch'](handleError(_0x4a4ba2,null));};exports[_0x8946('0x41')]=function(_0x12916e,_0x10174e){return db[_0x8946('0x25')][_0x8946('0x3e')]({'where':{'id':_0x12916e[_0x8946('0x3a')]['id']}})[_0x8946('0x22')](handleEntityNotFound(_0x10174e,null))[_0x8946('0x22')](removeEntity(_0x10174e,null))[_0x8946('0x39')](handleError(_0x10174e,null));};exports['describe']=function(_0x26bd54,_0x482837){return db['MailTransferReport'][_0x8946('0x42')]()[_0x8946('0x22')](respondWithResult(_0x482837,null))['catch'](handleError(_0x482837,null));}; \ No newline at end of file +var _0xb684=['MailTransferReport','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name'];(function(_0x100bd4,_0x320516){var _0x11ddb2=function(_0x4a00fe){while(--_0x4a00fe){_0x100bd4['push'](_0x100bd4['shift']());}};_0x11ddb2(++_0x320516);}(_0xb684,0xb2));var _0x4b68=function(_0x4dfea6,_0x171ec5){_0x4dfea6=_0x4dfea6-0x0;var _0x4177e3=_0xb684[_0x4dfea6];return _0x4177e3;};'use strict';var emlformat=require(_0x4b68('0x0'));var rimraf=require(_0x4b68('0x1'));var zipdir=require(_0x4b68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b68('0x3'));var moment=require('moment');var BPromise=require(_0x4b68('0x4'));var Mustache=require(_0x4b68('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4b68('0x6'));var csv=require(_0x4b68('0x7'));var ejs=require(_0x4b68('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b68('0x9'));var squel=require(_0x4b68('0xa'));var crypto=require(_0x4b68('0xb'));var jsforce=require(_0x4b68('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b68('0xd'));var Papa=require(_0x4b68('0xe'));var Redis=require(_0x4b68('0xf'));var authService=require(_0x4b68('0x10'));var qs=require(_0x4b68('0x11'));var as=require(_0x4b68('0x12'));var hardwareService=require(_0x4b68('0x13'));var logger=require(_0x4b68('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4b68('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b68('0x16'))['db'];function respondWithStatusCode(_0x5798d6,_0x587b57){_0x587b57=_0x587b57||0xcc;return function(_0x5eb96e){if(_0x5eb96e){return _0x5798d6[_0x4b68('0x17')](_0x587b57);}return _0x5798d6[_0x4b68('0x18')](_0x587b57)['end']();};}function respondWithResult(_0x5ab055,_0x392147){_0x392147=_0x392147||0xc8;return function(_0x8c4756){if(_0x8c4756){return _0x5ab055[_0x4b68('0x18')](_0x392147)[_0x4b68('0x19')](_0x8c4756);}};}function respondWithFilteredResult(_0x56d4f7,_0x67cb73){return function(_0x2da5b6){if(_0x2da5b6){var _0x35222a=typeof _0x67cb73[_0x4b68('0x1a')]==='undefined'&&typeof _0x67cb73[_0x4b68('0x1b')]===_0x4b68('0x1c');var _0x3112a0=_0x2da5b6[_0x4b68('0x1d')];var _0x24eb4c=_0x35222a?0x0:_0x67cb73['offset'];var _0xca84cf=_0x35222a?_0x2da5b6[_0x4b68('0x1d')]:_0x67cb73[_0x4b68('0x1a')]+_0x67cb73[_0x4b68('0x1b')];var _0x173641;if(_0xca84cf>=_0x3112a0){_0xca84cf=_0x3112a0;_0x173641=0xc8;}else{_0x173641=0xce;}_0x56d4f7[_0x4b68('0x18')](_0x173641);return _0x56d4f7[_0x4b68('0x1e')](_0x4b68('0x1f'),_0x24eb4c+'-'+_0xca84cf+'/'+_0x3112a0)[_0x4b68('0x19')](_0x2da5b6);}return null;};}function patchUpdates(_0x10d06){return function(_0xfd3427){try{jsonpatch[_0x4b68('0x20')](_0xfd3427,_0x10d06,!![]);}catch(_0x745a6b){return BPromise['reject'](_0x745a6b);}return _0xfd3427[_0x4b68('0x21')]();};}function saveUpdates(_0x81773a,_0x4dde50){return function(_0x5798a6){if(_0x5798a6){return _0x5798a6[_0x4b68('0x22')](_0x81773a)[_0x4b68('0x23')](function(_0x36b46b){return _0x36b46b;});}return null;};}function removeEntity(_0x48f462,_0x3811b3){return function(_0x50117d){if(_0x50117d){return _0x50117d[_0x4b68('0x24')]()[_0x4b68('0x23')](function(){_0x48f462[_0x4b68('0x18')](0xcc)[_0x4b68('0x25')]();});}};}function handleEntityNotFound(_0x5ad2b8,_0x15ff01){return function(_0x1a34c3){if(!_0x1a34c3){_0x5ad2b8['sendStatus'](0x194);}return _0x1a34c3;};}function handleError(_0x4bac20,_0x4d5f59){_0x4d5f59=_0x4d5f59||0x1f4;return function(_0x125bdf){logger[_0x4b68('0x26')](_0x125bdf[_0x4b68('0x27')]);if(_0x125bdf[_0x4b68('0x28')]){delete _0x125bdf[_0x4b68('0x28')];}_0x4bac20[_0x4b68('0x18')](_0x4d5f59)['send'](_0x125bdf);};}exports['index']=function(_0x89b4bc,_0xea72a3){var _0x5b6198={},_0x2e6a05={},_0x352963={'count':0x0,'rows':[]};var _0xef2192=_['map'](db[_0x4b68('0x29')][_0x4b68('0x2a')],function(_0x2e98bb){return{'name':_0x2e98bb['fieldName'],'type':_0x2e98bb[_0x4b68('0x2b')][_0x4b68('0x2c')]};});_0x2e6a05['model']=_[_0x4b68('0x2d')](_0xef2192,_0x4b68('0x28'));_0x2e6a05[_0x4b68('0x2e')]=_[_0x4b68('0x2f')](_0x89b4bc[_0x4b68('0x2e')]);_0x2e6a05[_0x4b68('0x30')]=_['intersection'](_0x2e6a05[_0x4b68('0x31')],_0x2e6a05[_0x4b68('0x2e')]);_0x5b6198[_0x4b68('0x32')]=_[_0x4b68('0x33')](_0x2e6a05[_0x4b68('0x31')],qs[_0x4b68('0x34')](_0x89b4bc['query']['fields']));_0x5b6198[_0x4b68('0x32')]=_0x5b6198[_0x4b68('0x32')]['length']?_0x5b6198[_0x4b68('0x32')]:_0x2e6a05[_0x4b68('0x31')];if(!_0x89b4bc[_0x4b68('0x2e')][_0x4b68('0x35')](_0x4b68('0x36'))){_0x5b6198[_0x4b68('0x1b')]=qs[_0x4b68('0x1b')](_0x89b4bc['query']['limit']);_0x5b6198[_0x4b68('0x1a')]=qs[_0x4b68('0x1a')](_0x89b4bc[_0x4b68('0x2e')][_0x4b68('0x1a')]);}_0x5b6198[_0x4b68('0x37')]=qs[_0x4b68('0x38')](_0x89b4bc[_0x4b68('0x2e')][_0x4b68('0x38')]);_0x5b6198[_0x4b68('0x39')]=qs[_0x4b68('0x30')](_[_0x4b68('0x3a')](_0x89b4bc[_0x4b68('0x2e')],_0x2e6a05[_0x4b68('0x30')]),_0xef2192);if(_0x89b4bc[_0x4b68('0x2e')][_0x4b68('0x3b')]){_0x5b6198['where']=_[_0x4b68('0x3c')](_0x5b6198[_0x4b68('0x39')],{'$or':_[_0x4b68('0x2d')](_0xef2192,function(_0x5e4955){if(_0x5e4955['type']!=='VIRTUAL'){var _0x3ddc27={};_0x3ddc27[_0x5e4955[_0x4b68('0x28')]]={'$like':'%'+_0x89b4bc[_0x4b68('0x2e')][_0x4b68('0x3b')]+'%'};return _0x3ddc27;}})});}_0x5b6198=_[_0x4b68('0x3c')]({},_0x5b6198,_0x89b4bc['options']);var _0xd1e40c={'where':_0x5b6198[_0x4b68('0x39')]};return db[_0x4b68('0x29')][_0x4b68('0x1d')](_0xd1e40c)[_0x4b68('0x23')](function(_0x3993fd){_0x352963[_0x4b68('0x1d')]=_0x3993fd;if(_0x89b4bc[_0x4b68('0x2e')][_0x4b68('0x3d')]){_0x5b6198[_0x4b68('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0x4b68('0x3f')](_0x5b6198);})['then'](function(_0x37a573){_0x352963[_0x4b68('0x40')]=_0x37a573;return _0x352963;})[_0x4b68('0x23')](respondWithFilteredResult(_0xea72a3,_0x5b6198))[_0x4b68('0x41')](handleError(_0xea72a3,null));};exports[_0x4b68('0x42')]=function(_0x4fcb3b,_0x2a8be5){var _0x37004d={'raw':!![],'where':{'id':_0x4fcb3b[_0x4b68('0x43')]['id']}},_0x53b6f4={};_0x53b6f4[_0x4b68('0x31')]=_[_0x4b68('0x2f')](db[_0x4b68('0x29')]['rawAttributes']);_0x53b6f4[_0x4b68('0x2e')]=_[_0x4b68('0x2f')](_0x4fcb3b[_0x4b68('0x2e')]);_0x53b6f4[_0x4b68('0x30')]=_[_0x4b68('0x33')](_0x53b6f4[_0x4b68('0x31')],_0x53b6f4[_0x4b68('0x2e')]);_0x37004d[_0x4b68('0x32')]=_['intersection'](_0x53b6f4['model'],qs[_0x4b68('0x34')](_0x4fcb3b[_0x4b68('0x2e')][_0x4b68('0x34')]));_0x37004d[_0x4b68('0x32')]=_0x37004d['attributes']['length']?_0x37004d['attributes']:_0x53b6f4[_0x4b68('0x31')];if(_0x4fcb3b[_0x4b68('0x2e')][_0x4b68('0x3d')]){_0x37004d[_0x4b68('0x3e')]=[{'all':!![]}];}_0x37004d=_[_0x4b68('0x3c')]({},_0x37004d,_0x4fcb3b[_0x4b68('0x44')]);return db[_0x4b68('0x29')]['find'](_0x37004d)[_0x4b68('0x23')](handleEntityNotFound(_0x2a8be5,null))['then'](respondWithResult(_0x2a8be5,null))[_0x4b68('0x41')](handleError(_0x2a8be5,null));};exports[_0x4b68('0x45')]=function(_0x48cb66,_0x46adc5){return db[_0x4b68('0x29')][_0x4b68('0x45')](_0x48cb66[_0x4b68('0x46')],{})[_0x4b68('0x23')](respondWithResult(_0x46adc5,0xc9))[_0x4b68('0x41')](handleError(_0x46adc5,null));};exports['update']=function(_0x43d6de,_0xedcd57){if(_0x43d6de[_0x4b68('0x46')]['id']){delete _0x43d6de[_0x4b68('0x46')]['id'];}return db['MailTransferReport'][_0x4b68('0x47')]({'where':{'id':_0x43d6de[_0x4b68('0x43')]['id']}})['then'](handleEntityNotFound(_0xedcd57,null))[_0x4b68('0x23')](saveUpdates(_0x43d6de[_0x4b68('0x46')],null))[_0x4b68('0x23')](respondWithResult(_0xedcd57,null))[_0x4b68('0x41')](handleError(_0xedcd57,null));};exports[_0x4b68('0x24')]=function(_0x167d4e,_0xa23823){return db[_0x4b68('0x29')][_0x4b68('0x47')]({'where':{'id':_0x167d4e[_0x4b68('0x43')]['id']}})[_0x4b68('0x23')](handleEntityNotFound(_0xa23823,null))['then'](removeEntity(_0xa23823,null))[_0x4b68('0x41')](handleError(_0xa23823,null));};exports['describe']=function(_0x122313,_0x2ac01a){return db[_0x4b68('0x29')][_0x4b68('0x48')]()[_0x4b68('0x23')](respondWithResult(_0x2ac01a,null))['catch'](handleError(_0x2ac01a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8437c52..8c47e23 100644 --- a/server/api/mailTransferReport/mailTransferReport.model.js +++ b/server/api/mailTransferReport/mailTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x018d=['report_mail_transfer','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailTransferReport.attributes','define'];(function(_0x208b7a,_0x2e3baa){var _0x37b7ec=function(_0x3a163d){while(--_0x3a163d){_0x208b7a['push'](_0x208b7a['shift']());}};_0x37b7ec(++_0x2e3baa);}(_0x018d,0x79));var _0xd018=function(_0x3c3c0a,_0x55292c){_0x3c3c0a=_0x3c3c0a-0x0;var _0xf63fd6=_0x018d[_0x3c3c0a];return _0xf63fd6;};'use strict';var _=require(_0xd018('0x0'));var util=require('util');var logger=require(_0xd018('0x1'))(_0xd018('0x2'));var moment=require(_0xd018('0x3'));var BPromise=require(_0xd018('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd018('0x5'));var rimraf=require('rimraf');var config=require(_0xd018('0x6'));var attributes=require(_0xd018('0x7'));module['exports']=function(_0xbfa885,_0x269d95){return _0xbfa885[_0xd018('0x8')]('MailTransferReport',attributes,{'tableName':_0xd018('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c3=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var moment=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var rp=require(_0x3e0c('0x5'));var fs=require('fs');var path=require(_0x3e0c('0x6'));var rimraf=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var attributes=require(_0x3e0c('0x9'));module['exports']=function(_0x530ebf,_0x163adf){return _0x530ebf[_0x3e0c('0xa')](_0x3e0c('0xb'),attributes,{'tableName':_0x3e0c('0xc'),'paranoid':![],'indexes':[{'name':_0x3e0c('0xd'),'fields':[_0x3e0c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e656fa6..aec4870 100644 --- a/server/api/mailTransferReport/mailTransferReport.rpc.js +++ b/server/api/mailTransferReport/mailTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaf7=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfaf7,0x156));var _0x7faf=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfaf7[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7faf('0x0'));var util=require(_0x7faf('0x1'));var moment=require(_0x7faf('0x2'));var BPromise=require(_0x7faf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7faf('0x4'));var db=require(_0x7faf('0x5'))['db'];var utils=require(_0x7faf('0x6'));var logger=require(_0x7faf('0x7'))('rpc');var config=require(_0x7faf('0x8'));var jayson=require(_0x7faf('0x9'));var client=jayson[_0x7faf('0xa')][_0x7faf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c856c,_0x5cd05c,_0x1ef186){return new BPromise(function(_0x5edadd,_0x1c1273){return client[_0x7faf('0xc')](_0x1c856c,_0x1ef186)['then'](function(_0x554908){logger[_0x7faf('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x5cd05c,'request\x20sent');logger[_0x7faf('0xe')](_0x7faf('0xf'),_0x5cd05c,_0x7faf('0x10'),JSON['stringify'](_0x554908));if(_0x554908[_0x7faf('0x11')]){if(_0x554908[_0x7faf('0x11')][_0x7faf('0x12')]===0x1f4){logger[_0x7faf('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x5cd05c,_0x554908[_0x7faf('0x11')][_0x7faf('0x13')]);return _0x1c1273(_0x554908[_0x7faf('0x11')][_0x7faf('0x13')]);}logger[_0x7faf('0x11')](_0x7faf('0x14'),_0x5cd05c,_0x554908['error']['message']);return _0x5edadd(_0x554908[_0x7faf('0x11')]['message']);}else{logger['info'](_0x7faf('0x14'),_0x5cd05c,_0x7faf('0x10'));_0x5edadd(_0x554908[_0x7faf('0x15')]['message']);}})[_0x7faf('0x16')](function(_0x29758f){logger[_0x7faf('0x11')](_0x7faf('0x14'),_0x5cd05c,_0x29758f);_0x1c1273(_0x29758f);});});} \ No newline at end of file +var _0x21cb=['error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b8927,_0x472787){var _0x4a065f=function(_0x343a66){while(--_0x343a66){_0x4b8927['push'](_0x4b8927['shift']());}};_0x4a065f(++_0x472787);}(_0x21cb,0x116));var _0xb21c=function(_0x1d05c2,_0x1a6c2d){_0x1d05c2=_0x1d05c2-0x0;var _0x4766f5=_0x21cb[_0x1d05c2];return _0x4766f5;};'use strict';var _=require(_0xb21c('0x0'));var util=require(_0xb21c('0x1'));var moment=require(_0xb21c('0x2'));var BPromise=require(_0xb21c('0x3'));var rs=require(_0xb21c('0x4'));var fs=require('fs');var Redis=require(_0xb21c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb21c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb21c('0x7'));var client=jayson[_0xb21c('0x8')][_0xb21c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12bcdb,_0x5aa8df,_0x1b4b54){return new BPromise(function(_0x5219e5,_0x371947){return client['request'](_0x12bcdb,_0x1b4b54)[_0xb21c('0xa')](function(_0x2773fa){logger[_0xb21c('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x5aa8df,'request\x20sent');logger[_0xb21c('0xc')](_0xb21c('0xd'),_0x5aa8df,_0xb21c('0xe'),JSON[_0xb21c('0xf')](_0x2773fa));if(_0x2773fa[_0xb21c('0x10')]){if(_0x2773fa[_0xb21c('0x10')]['code']===0x1f4){logger[_0xb21c('0x10')](_0xb21c('0x11'),_0x5aa8df,_0x2773fa[_0xb21c('0x10')]['message']);return _0x371947(_0x2773fa['error'][_0xb21c('0x12')]);}logger[_0xb21c('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x5aa8df,_0x2773fa[_0xb21c('0x10')][_0xb21c('0x12')]);return _0x5219e5(_0x2773fa[_0xb21c('0x10')][_0xb21c('0x12')]);}else{logger[_0xb21c('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x5aa8df,_0xb21c('0xe'));_0x5219e5(_0x2773fa[_0xb21c('0x13')][_0xb21c('0x12')]);}})[_0xb21c('0x14')](function(_0x486adf){logger['error'](_0xb21c('0x11'),_0x5aa8df,_0x486adf);_0x371947(_0x486adf);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0ac1af1..390d304 100644 --- a/server/api/memberReport/index.js +++ b/server/api/memberReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x852b=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','show','create','put','/:id','update','destroy'];(function(_0x31f8d5,_0x132a3c){var _0x30536e=function(_0x564c07){while(--_0x564c07){_0x31f8d5['push'](_0x31f8d5['shift']());}};_0x30536e(++_0x132a3c);}(_0x852b,0x85));var _0xb852=function(_0x2aea24,_0x47663b){_0x2aea24=_0x2aea24-0x0;var _0xefaf35=_0x852b[_0x2aea24];return _0xefaf35;};'use strict';var multer=require(_0xb852('0x0'));var util=require(_0xb852('0x1'));var path=require(_0xb852('0x2'));var timeout=require(_0xb852('0x3'));var express=require(_0xb852('0x4'));var router=express[_0xb852('0x5')]();var fs_extra=require(_0xb852('0x6'));var auth=require(_0xb852('0x7'));var interaction=require(_0xb852('0x8'));var config=require(_0xb852('0x9'));var controller=require(_0xb852('0xa'));router[_0xb852('0xb')]('/',auth[_0xb852('0xc')](),controller[_0xb852('0xd')]);router[_0xb852('0xb')]('/describe',auth[_0xb852('0xc')](),controller[_0xb852('0xe')]);router[_0xb852('0xb')]('/:id',auth[_0xb852('0xc')](),controller[_0xb852('0xf')]);router['post']('/',auth[_0xb852('0xc')](),controller[_0xb852('0x10')]);router[_0xb852('0x11')](_0xb852('0x12'),auth[_0xb852('0xc')](),controller[_0xb852('0x13')]);router['delete'](_0xb852('0x12'),auth[_0xb852('0xc')](),controller[_0xb852('0x14')]);module[_0xb852('0x15')]=router; \ No newline at end of file +var _0xb24e=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id'];(function(_0x55d950,_0x2b9e89){var _0x4c4aa8=function(_0x758113){while(--_0x758113){_0x55d950['push'](_0x55d950['shift']());}};_0x4c4aa8(++_0x2b9e89);}(_0xb24e,0x16b));var _0xeb24=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb24e[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xeb24('0x0'));var util=require(_0xeb24('0x1'));var path=require(_0xeb24('0x2'));var timeout=require(_0xeb24('0x3'));var express=require(_0xeb24('0x4'));var router=express[_0xeb24('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xeb24('0x6'));var config=require('../../config/environment');var controller=require(_0xeb24('0x7'));router['get']('/',auth[_0xeb24('0x8')](),controller[_0xeb24('0x9')]);router[_0xeb24('0xa')]('/describe',auth[_0xeb24('0x8')](),controller[_0xeb24('0xb')]);router['get']('/:id',auth[_0xeb24('0x8')](),controller[_0xeb24('0xc')]);router[_0xeb24('0xd')]('/',auth[_0xeb24('0x8')](),controller[_0xeb24('0xe')]);router[_0xeb24('0xf')](_0xeb24('0x10'),auth[_0xeb24('0x8')](),controller['update']);router[_0xeb24('0x11')](_0xeb24('0x10'),auth[_0xeb24('0x8')](),controller['destroy']);module[_0xeb24('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f70a3cd..e0eab38 100644 --- a/server/api/memberReport/memberReport.attributes.js +++ b/server/api/memberReport/memberReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9de1=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x9de1,0x16d));var _0x19de=function(_0x38cf38,_0x12ce83){_0x38cf38=_0x38cf38-0x0;var _0x2e7888=_0x9de1[_0x38cf38];return _0x2e7888;};'use strict';var Sequelize=require(_0x19de('0x0'));var moment=require(_0x19de('0x1'));module['exports']={'channel':{'type':Sequelize[_0x19de('0x2')]},'membername':{'type':Sequelize[_0x19de('0x2')]},'interface':{'type':Sequelize[_0x19de('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x19de('0x3'),'comment':_0x19de('0x4')},'duration':{'type':Sequelize[_0x19de('0x5')]},'enterAt':{'type':Sequelize[_0x19de('0x6')]},'exitAt':{'type':Sequelize[_0x19de('0x6')],'set':function(_0x2cece0){var _0x46cc5a=moment(_0x2cece0);var _0x32a454=moment(this['getDataValue'](_0x19de('0x7')));var _0x30021c=_0x46cc5a['diff'](_0x32a454,_0x19de('0x8'));this['setDataValue'](_0x19de('0x9'),_0x2cece0);this[_0x19de('0xa')]('duration',_0x30021c>=0x0?_0x30021c:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x19de('0xb')},'data2':{'type':Sequelize[_0x19de('0x2')],'comment':_0x19de('0xc')},'data3':{'type':Sequelize[_0x19de('0x2')],'comment':_0x19de('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0x19de('0xe')},'data5':{'type':Sequelize[_0x19de('0x2')],'comment':_0x19de('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x19de('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd3fc=['INTEGER','DATE','getDataValue','diff','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd3fc,0xa4));var _0xcd3f=function(_0x48476a,_0x5d443b){_0x48476a=_0x48476a-0x0;var _0x5c0e1b=_0xd3fc[_0x48476a];return _0x5c0e1b;};'use strict';var Sequelize=require(_0xcd3f('0x0'));var moment=require(_0xcd3f('0x1'));module['exports']={'channel':{'type':Sequelize[_0xcd3f('0x2')]},'membername':{'type':Sequelize[_0xcd3f('0x2')]},'interface':{'type':Sequelize[_0xcd3f('0x2')]},'type':{'type':Sequelize[_0xcd3f('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xcd3f('0x3')},'duration':{'type':Sequelize[_0xcd3f('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcd3f('0x5')],'set':function(_0x5052b5){var _0x2a25c5=moment(_0x5052b5);var _0xe8d831=moment(this[_0xcd3f('0x6')]('enterAt'));var _0x358d31=_0x2a25c5[_0xcd3f('0x7')](_0xe8d831,'seconds');this[_0xcd3f('0x8')](_0xcd3f('0x9'),_0x5052b5);this[_0xcd3f('0x8')](_0xcd3f('0xa'),_0x358d31>=0x0?_0x358d31:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xcd3f('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0xcd3f('0xc')},'data4':{'type':Sequelize[_0xcd3f('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xcd3f('0x2')],'comment':_0xcd3f('0xd')},'role':{'type':Sequelize[_0xcd3f('0x2')]},'internal':{'type':Sequelize[_0xcd3f('0x4')]},'uniqueid':{'type':Sequelize[_0xcd3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e459de6..b3320dd 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x34e8,0x12c));var _0x834e=function(_0x468756,_0x52afbf){_0x468756=_0x468756-0x0;var _0x29ae2f=_0x34e8[_0x468756];return _0x29ae2f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x23afff,_0x383ac0){var _0x41263d=function(_0x2c8424){while(--_0x2c8424){_0x23afff['push'](_0x23afff['shift']());}};_0x41263d(++_0x383ac0);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 529a62a..65ff579 100644 --- a/server/api/memberReport/memberReport.model.js +++ b/server/api/memberReport/memberReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0736=['define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x0736,0x1c0));var _0x6073=function(_0x15647d,_0x33afe6){_0x15647d=_0x15647d-0x0;var _0x581f21=_0x0736[_0x15647d];return _0x581f21;};'use strict';var _=require(_0x6073('0x0'));var util=require(_0x6073('0x1'));var logger=require('../../config/logger')(_0x6073('0x2'));var moment=require(_0x6073('0x3'));var BPromise=require(_0x6073('0x4'));var rp=require(_0x6073('0x5'));var fs=require('fs');var path=require(_0x6073('0x6'));var rimraf=require(_0x6073('0x7'));var config=require(_0x6073('0x8'));var attributes=require(_0x6073('0x9'));module[_0x6073('0xa')]=function(_0x1058d6,_0x2b5120){return _0x1058d6[_0x6073('0xb')](_0x6073('0xc'),attributes,{'tableName':_0x6073('0xd'),'paranoid':![],'indexes':[{'name':_0x6073('0xe'),'fields':[_0x6073('0xf'),_0x6073('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd69=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','../../config/logger'];(function(_0x91cb24,_0x67adea){var _0x10bfe4=function(_0x3de9d1){while(--_0x3de9d1){_0x91cb24['push'](_0x91cb24['shift']());}};_0x10bfe4(++_0x67adea);}(_0xcd69,0x16b));var _0x9cd6=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xcd69[_0x39e84d];return _0x1991bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9cd6('0x0'))(_0x9cd6('0x1'));var moment=require(_0x9cd6('0x2'));var BPromise=require(_0x9cd6('0x3'));var rp=require(_0x9cd6('0x4'));var fs=require('fs');var path=require(_0x9cd6('0x5'));var rimraf=require(_0x9cd6('0x6'));var config=require(_0x9cd6('0x7'));var attributes=require(_0x9cd6('0x8'));module['exports']=function(_0x4952e7,_0x45deec){return _0x4952e7['define'](_0x9cd6('0x9'),attributes,{'tableName':_0x9cd6('0xa'),'paranoid':![],'indexes':[{'name':_0x9cd6('0xb'),'fields':[_0x9cd6('0xc'),_0x9cd6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b356fe9..8f2598c 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9829=['CreateMemberReport','create','body','raw','UpdateMemberReport','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','attributes','limit','include','map','model'];(function(_0x4cacf2,_0x13ebc9){var _0x46b362=function(_0x58a3b8){while(--_0x58a3b8){_0x4cacf2['push'](_0x4cacf2['shift']());}};_0x46b362(++_0x13ebc9);}(_0x9829,0xc4));var _0x9982=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x9829[_0x1dbaf7];return _0x593f05;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var moment=require(_0x9982('0x2'));var BPromise=require(_0x9982('0x3'));var rs=require(_0x9982('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9982('0x5'))['db'];var utils=require(_0x9982('0x6'));var logger=require(_0x9982('0x7'))('rpc');var config=require(_0x9982('0x8'));var jayson=require(_0x9982('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340d62,_0x35a93f,_0x5d0824){return new BPromise(function(_0x25f30a,_0x1a3931){return client[_0x9982('0xa')](_0x340d62,_0x5d0824)[_0x9982('0xb')](function(_0x1e7881){logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));logger[_0x9982('0xf')](_0x9982('0x10'),_0x35a93f,_0x9982('0xe'),JSON[_0x9982('0x11')](_0x1e7881));if(_0x1e7881[_0x9982('0x12')]){if(_0x1e7881[_0x9982('0x12')][_0x9982('0x13')]===0x1f4){logger[_0x9982('0x12')](_0x9982('0xd'),_0x35a93f,_0x1e7881[_0x9982('0x12')]['message']);return _0x1a3931(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}logger['error'](_0x9982('0xd'),_0x35a93f,_0x1e7881['error'][_0x9982('0x14')]);return _0x25f30a(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}else{logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));_0x25f30a(_0x1e7881[_0x9982('0x15')][_0x9982('0x14')]);}})[_0x9982('0x16')](function(_0x50ca89){logger[_0x9982('0x12')]('MemberReport,\x20%s,\x20%s',_0x35a93f,_0x50ca89);_0x1a3931(_0x50ca89);});});}exports[_0x9982('0x17')]=function(_0x44b5ed){var _0x51fc02=this;return new Promise(function(_0x2558e1,_0xef3382){return db[_0x9982('0x18')][_0x9982('0x19')]({'raw':_0x44b5ed[_0x9982('0x1a')]?_0x44b5ed[_0x9982('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x44b5ed[_0x9982('0x1a')]?_0x44b5ed[_0x9982('0x1a')]['where']||null:null,'attributes':_0x44b5ed[_0x9982('0x1a')]?_0x44b5ed[_0x9982('0x1a')][_0x9982('0x1b')]||null:null,'limit':_0x44b5ed[_0x9982('0x1a')]?_0x44b5ed[_0x9982('0x1a')][_0x9982('0x1c')]||null:null,'include':_0x44b5ed[_0x9982('0x1a')]?_0x44b5ed[_0x9982('0x1a')][_0x9982('0x1d')]?_[_0x9982('0x1e')](_0x44b5ed[_0x9982('0x1a')][_0x9982('0x1d')],function(_0x3797be){return{'model':db[_0x3797be['model']],'as':_0x3797be['as'],'attributes':_0x3797be[_0x9982('0x1b')],'include':_0x3797be[_0x9982('0x1d')]?_[_0x9982('0x1e')](_0x3797be[_0x9982('0x1d')],function(_0x2d4622){return{'model':db[_0x2d4622[_0x9982('0x1f')]],'as':_0x2d4622['as'],'attributes':_0x2d4622[_0x9982('0x1b')],'include':_0x2d4622[_0x9982('0x1d')]?_[_0x9982('0x1e')](_0x2d4622[_0x9982('0x1d')],function(_0xe752e3){return{'model':db[_0xe752e3[_0x9982('0x1f')]],'as':_0xe752e3['as'],'attributes':_0xe752e3[_0x9982('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9982('0xb')](function(_0x14d49c){logger[_0x9982('0xc')](_0x9982('0x17'),_0x44b5ed);logger[_0x9982('0xf')]('GetMemberReport',_0x44b5ed,JSON['stringify'](_0x14d49c));_0x2558e1(_0x14d49c);})[_0x9982('0x16')](function(_0x3b3bc5){logger[_0x9982('0x12')](_0x9982('0x17'),_0x3b3bc5[_0x9982('0x14')],_0x44b5ed);_0xef3382(_0x51fc02[_0x9982('0x12')](0x1f4,_0x3b3bc5[_0x9982('0x14')]));});});};exports[_0x9982('0x20')]=function(_0x1a1d91){var _0x26a999=this;return new Promise(function(_0x33a4de,_0x3fc45b){return db['MemberReport'][_0x9982('0x21')](_0x1a1d91[_0x9982('0x22')],{'raw':_0x1a1d91[_0x9982('0x1a')]?_0x1a1d91[_0x9982('0x1a')][_0x9982('0x23')]===undefined?!![]:![]:!![]})[_0x9982('0xb')](function(_0x511f32){logger[_0x9982('0xc')]('CreateMemberReport',_0x1a1d91);logger[_0x9982('0xf')](_0x9982('0x20'),_0x1a1d91,JSON[_0x9982('0x11')](_0x511f32));_0x33a4de(_0x511f32);})[_0x9982('0x16')](function(_0x44c650){logger[_0x9982('0x12')](_0x9982('0x20'),_0x44c650['message'],_0x1a1d91);_0x3fc45b(_0x26a999[_0x9982('0x12')](0x1f4,_0x44c650[_0x9982('0x14')]));});});};exports[_0x9982('0x24')]=function(_0x22e4df){var _0x395cf0=this;return new Promise(function(_0x4ab903,_0x214554){return db['MemberReport']['update'](_0x22e4df[_0x9982('0x22')],{'raw':_0x22e4df[_0x9982('0x1a')]?_0x22e4df['options'][_0x9982('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22e4df[_0x9982('0x1a')]?_0x22e4df[_0x9982('0x1a')][_0x9982('0x25')]||null:null,'attributes':_0x22e4df[_0x9982('0x1a')]?_0x22e4df[_0x9982('0x1a')][_0x9982('0x1b')]||null:null,'limit':_0x22e4df[_0x9982('0x1a')]?_0x22e4df[_0x9982('0x1a')][_0x9982('0x1c')]||null:null})[_0x9982('0xb')](function(_0x30c27d){logger['info'](_0x9982('0x24'),_0x22e4df);logger[_0x9982('0xf')](_0x9982('0x24'),_0x22e4df,JSON[_0x9982('0x11')](_0x30c27d));_0x4ab903(_0x30c27d);})[_0x9982('0x16')](function(_0x57a3fc){logger['error']('UpdateMemberReport',_0x57a3fc[_0x9982('0x14')],_0x22e4df);_0x214554(_0x395cf0[_0x9982('0x12')](0x1f4,_0x57a3fc['message']));});});}; \ No newline at end of file +var _0x7fbe=['attributes','limit','include','map','model','info','GetMemberReport','create','raw','CreateMemberReport','UpdateMemberReport','update','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MemberReport','findAll','options','where'];(function(_0x292011,_0xee7976){var _0x6d9784=function(_0x30438f){while(--_0x30438f){_0x292011['push'](_0x292011['shift']());}};_0x6d9784(++_0xee7976);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x99250c,_0x4603c0){_0x99250c=_0x99250c-0x0;var _0x3927d5=_0x7fbe[_0x99250c];return _0x3927d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['GetMemberReport']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'limit':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]||null:null,'include':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1e')]?_[_0xe7fb('0x1f')](_0x293a47['options']['include'],function(_0x52f08b){return{'model':db[_0x52f08b[_0xe7fb('0x20')]],'as':_0x52f08b['as'],'attributes':_0x52f08b['attributes'],'include':_0x52f08b['include']?_[_0xe7fb('0x1f')](_0x52f08b[_0xe7fb('0x1e')],function(_0x2996ae){return{'model':db[_0x2996ae['model']],'as':_0x2996ae['as'],'attributes':_0x2996ae[_0xe7fb('0x1c')],'include':_0x2996ae[_0xe7fb('0x1e')]?_[_0xe7fb('0x1f')](_0x2996ae[_0xe7fb('0x1e')],function(_0x392d75){return{'model':db[_0x392d75[_0xe7fb('0x20')]],'as':_0x392d75['as'],'attributes':_0x392d75[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5df9f2){logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x293a47);logger[_0xe7fb('0x10')]('GetMemberReport',_0x293a47,JSON[_0xe7fb('0x12')](_0x5df9f2));_0x1e77fd(_0x5df9f2);})[_0xe7fb('0x17')](function(_0xd3fffe){logger[_0xe7fb('0x13')](_0xe7fb('0x22'),_0xd3fffe[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0xd3fffe[_0xe7fb('0x15')]));});});};exports['CreateMemberReport']=function(_0x3d1fb5){var _0x1742f3=this;return new Promise(function(_0x29d1ca,_0x547a04){return db['MemberReport'][_0xe7fb('0x23')](_0x3d1fb5['body'],{'raw':_0x3d1fb5[_0xe7fb('0x1a')]?_0x3d1fb5[_0xe7fb('0x1a')][_0xe7fb('0x24')]===undefined?!![]:![]:!![]})[_0xe7fb('0xd')](function(_0x556368){logger[_0xe7fb('0x21')](_0xe7fb('0x25'),_0x3d1fb5);logger[_0xe7fb('0x10')](_0xe7fb('0x25'),_0x3d1fb5,JSON[_0xe7fb('0x12')](_0x556368));_0x29d1ca(_0x556368);})['catch'](function(_0x256694){logger[_0xe7fb('0x13')](_0xe7fb('0x25'),_0x256694[_0xe7fb('0x15')],_0x3d1fb5);_0x547a04(_0x1742f3[_0xe7fb('0x13')](0x1f4,_0x256694[_0xe7fb('0x15')]));});});};exports[_0xe7fb('0x26')]=function(_0x147eb1){var _0x389903=this;return new Promise(function(_0x59f9df,_0x44d8cf){return db[_0xe7fb('0x18')][_0xe7fb('0x27')](_0x147eb1['body'],{'raw':_0x147eb1[_0xe7fb('0x1a')]?_0x147eb1[_0xe7fb('0x1a')][_0xe7fb('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x147eb1[_0xe7fb('0x1a')]?_0x147eb1[_0xe7fb('0x1a')][_0xe7fb('0x1b')]||null:null,'attributes':_0x147eb1[_0xe7fb('0x1a')]?_0x147eb1[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'limit':_0x147eb1[_0xe7fb('0x1a')]?_0x147eb1[_0xe7fb('0x1a')][_0xe7fb('0x1d')]||null:null})[_0xe7fb('0xd')](function(_0x1c81fe){logger[_0xe7fb('0x21')](_0xe7fb('0x26'),_0x147eb1);logger[_0xe7fb('0x10')](_0xe7fb('0x26'),_0x147eb1,JSON[_0xe7fb('0x12')](_0x1c81fe));_0x59f9df(_0x1c81fe);})['catch'](function(_0x261ec5){logger[_0xe7fb('0x13')](_0xe7fb('0x26'),_0x261ec5[_0xe7fb('0x15')],_0x147eb1);_0x44d8cf(_0x389903['error'](0x1f4,_0x261ec5[_0xe7fb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 0d88565..bcf76f7 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa28b=['get','index','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./migration.controller'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa28b,0x1dc));var _0xba28=function(_0x1aa1c5,_0xe2862a){_0x1aa1c5=_0x1aa1c5-0x0;var _0x372c7e=_0xa28b[_0x1aa1c5];return _0x372c7e;};'use strict';var multer=require(_0xba28('0x0'));var util=require(_0xba28('0x1'));var path=require(_0xba28('0x2'));var timeout=require(_0xba28('0x3'));var express=require('express');var router=express[_0xba28('0x4')]();var fs_extra=require(_0xba28('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba28('0x6'));var controller=require(_0xba28('0x7'));router[_0xba28('0x8')]('/',controller[_0xba28('0x9')]);module[_0xba28('0xa')]=router; \ No newline at end of file +var _0x13f5=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x10cd74,_0x13ab6c){var _0x4d37b9=function(_0x35a6c7){while(--_0x35a6c7){_0x10cd74['push'](_0x10cd74['shift']());}};_0x4d37b9(++_0x13ab6c);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var path=require(_0x513f('0x2'));var timeout=require(_0x513f('0x3'));var express=require('express');var router=express[_0x513f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var controller=require(_0x513f('0x7'));router[_0x513f('0x8')]('/',controller[_0x513f('0x9')]);module[_0x513f('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8e4d05d..5927fd5 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7684=['STRING','sequelize'];(function(_0xc313cb,_0x7d5219){var _0x41d773=function(_0x3de774){while(--_0x3de774){_0xc313cb['push'](_0xc313cb['shift']());}};_0x41d773(++_0x7d5219);}(_0x7684,0x67));var _0x4768=function(_0x5cb70d,_0x1dae4b){_0x5cb70d=_0x5cb70d-0x0;var _0x54da82=_0x7684[_0x5cb70d];return _0x54da82;};'use strict';var Sequelize=require(_0x4768('0x0'));module['exports']={'version':{'type':Sequelize[_0x4768('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xdb28=['version','sequelize','exports','STRING'];(function(_0x573479,_0xd10da7){var _0x2a81ab=function(_0x27110a){while(--_0x27110a){_0x573479['push'](_0x573479['shift']());}};_0x2a81ab(++_0xd10da7);}(_0xdb28,0x1bd));var _0x8db2=function(_0x391452,_0x3be0f7){_0x391452=_0x391452-0x0;var _0x50472c=_0xdb28[_0x391452];return _0x50472c;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'version':{'type':Sequelize[_0x8db2('0x2')],'unique':_0x8db2('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 0bfc082..22814d2 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14f1=['../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','name','send','Migration','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14f1,0x71));var _0x114f=function(_0x343c4a,_0x173006){_0x343c4a=_0x343c4a-0x0;var _0x35fd6b=_0x14f1[_0x343c4a];return _0x35fd6b;};'use strict';var emlformat=require(_0x114f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x114f('0x1'));var jsonpatch=require(_0x114f('0x2'));var rp=require('request-promise');var moment=require(_0x114f('0x3'));var BPromise=require(_0x114f('0x4'));var Mustache=require(_0x114f('0x5'));var util=require(_0x114f('0x6'));var path=require(_0x114f('0x7'));var sox=require(_0x114f('0x8'));var csv=require(_0x114f('0x9'));var ejs=require(_0x114f('0xa'));var fs=require('fs');var fs_extra=require(_0x114f('0xb'));var _=require(_0x114f('0xc'));var squel=require(_0x114f('0xd'));var crypto=require(_0x114f('0xe'));var jsforce=require(_0x114f('0xf'));var deskjs=require(_0x114f('0x10'));var toCsv=require(_0x114f('0x9'));var querystring=require(_0x114f('0x11'));var Papa=require(_0x114f('0x12'));var Redis=require('ioredis');var authService=require(_0x114f('0x13'));var qs=require(_0x114f('0x14'));var as=require(_0x114f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x114f('0x16'))(_0x114f('0x17'));var utils=require('../../config/utils');var config=require(_0x114f('0x18'));var licenseUtil=require(_0x114f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd7b6,_0x2c4f4f){_0x2c4f4f=_0x2c4f4f||0xcc;return function(_0x3831ab){if(_0x3831ab){return _0x5cd7b6[_0x114f('0x1a')](_0x2c4f4f);}return _0x5cd7b6[_0x114f('0x1b')](_0x2c4f4f)[_0x114f('0x1c')]();};}function respondWithResult(_0x2662d7,_0x36cb57){_0x36cb57=_0x36cb57||0xc8;return function(_0x4b593e){if(_0x4b593e){return _0x2662d7[_0x114f('0x1b')](_0x36cb57)[_0x114f('0x1d')](_0x4b593e);}};}function respondWithFilteredResult(_0xabd01b,_0x8ed84e){return function(_0x465d29){if(_0x465d29){var _0x584aba=typeof _0x8ed84e[_0x114f('0x1e')]==='undefined'&&typeof _0x8ed84e[_0x114f('0x1f')]===_0x114f('0x20');var _0x2b6b0a=_0x465d29['count'];var _0x4155e5=_0x584aba?0x0:_0x8ed84e[_0x114f('0x1e')];var _0x4202dc=_0x584aba?_0x465d29[_0x114f('0x21')]:_0x8ed84e['offset']+_0x8ed84e[_0x114f('0x1f')];var _0x2d392f;if(_0x4202dc>=_0x2b6b0a){_0x4202dc=_0x2b6b0a;_0x2d392f=0xc8;}else{_0x2d392f=0xce;}_0xabd01b['status'](_0x2d392f);return _0xabd01b['set'](_0x114f('0x22'),_0x4155e5+'-'+_0x4202dc+'/'+_0x2b6b0a)[_0x114f('0x1d')](_0x465d29);}return null;};}function patchUpdates(_0x50244f){return function(_0xbf68cb){try{jsonpatch[_0x114f('0x23')](_0xbf68cb,_0x50244f,!![]);}catch(_0x29e2b8){return BPromise[_0x114f('0x24')](_0x29e2b8);}return _0xbf68cb['save']();};}function saveUpdates(_0x5a1b1d,_0xbbc001){return function(_0x4dae99){if(_0x4dae99){return _0x4dae99[_0x114f('0x25')](_0x5a1b1d)[_0x114f('0x26')](function(_0x2fabde){return _0x2fabde;});}return null;};}function removeEntity(_0x54c66e,_0x1f2b8b){return function(_0x150a48){if(_0x150a48){return _0x150a48[_0x114f('0x27')]()[_0x114f('0x26')](function(){_0x54c66e[_0x114f('0x1b')](0xcc)[_0x114f('0x1c')]();});}};}function handleEntityNotFound(_0x1c8db7,_0x3a9ecb){return function(_0x4db409){if(!_0x4db409){_0x1c8db7[_0x114f('0x1a')](0x194);}return _0x4db409;};}function handleError(_0x2ea08a,_0x57bf2b){_0x57bf2b=_0x57bf2b||0x1f4;return function(_0x57b33a){logger[_0x114f('0x28')](_0x57b33a['stack']);if(_0x57b33a[_0x114f('0x29')]){delete _0x57b33a[_0x114f('0x29')];}_0x2ea08a['status'](_0x57bf2b)[_0x114f('0x2a')](_0x57b33a);};}exports['index']=function(_0x3e5499,_0x4a9148){var _0x52b55d={},_0x269af6={},_0x1196e3={'count':0x0,'rows':[]};var _0x5c7a0f=_['map'](db[_0x114f('0x2b')][_0x114f('0x2c')],function(_0x210901){return{'name':_0x210901[_0x114f('0x2d')],'type':_0x210901[_0x114f('0x2e')][_0x114f('0x2f')]};});_0x269af6['model']=_[_0x114f('0x30')](_0x5c7a0f,_0x114f('0x29'));_0x269af6['query']=_[_0x114f('0x31')](_0x3e5499[_0x114f('0x32')]);_0x269af6[_0x114f('0x33')]=_[_0x114f('0x34')](_0x269af6[_0x114f('0x35')],_0x269af6[_0x114f('0x32')]);_0x52b55d[_0x114f('0x36')]=_[_0x114f('0x34')](_0x269af6[_0x114f('0x35')],qs['fields'](_0x3e5499[_0x114f('0x32')][_0x114f('0x37')]));_0x52b55d[_0x114f('0x36')]=_0x52b55d[_0x114f('0x36')][_0x114f('0x38')]?_0x52b55d[_0x114f('0x36')]:_0x269af6[_0x114f('0x35')];if(!_0x3e5499['query'][_0x114f('0x39')]('nolimit')){_0x52b55d['limit']=qs[_0x114f('0x1f')](_0x3e5499['query'][_0x114f('0x1f')]);_0x52b55d[_0x114f('0x1e')]=qs[_0x114f('0x1e')](_0x3e5499[_0x114f('0x32')]['offset']);}_0x52b55d[_0x114f('0x3a')]=qs[_0x114f('0x3b')](_0x3e5499[_0x114f('0x32')][_0x114f('0x3b')]);_0x52b55d[_0x114f('0x3c')]=qs[_0x114f('0x33')](_[_0x114f('0x3d')](_0x3e5499['query'],_0x269af6[_0x114f('0x33')]),_0x5c7a0f);if(_0x3e5499[_0x114f('0x32')][_0x114f('0x3e')]){_0x52b55d[_0x114f('0x3c')]=_[_0x114f('0x3f')](_0x52b55d[_0x114f('0x3c')],{'$or':_[_0x114f('0x30')](_0x5c7a0f,function(_0x4b1cb1){if(_0x4b1cb1[_0x114f('0x2e')]!=='VIRTUAL'){var _0x573f0a={};_0x573f0a[_0x4b1cb1['name']]={'$like':'%'+_0x3e5499[_0x114f('0x32')][_0x114f('0x3e')]+'%'};return _0x573f0a;}})});}_0x52b55d=_[_0x114f('0x3f')]({},_0x52b55d,_0x3e5499[_0x114f('0x40')]);var _0x48690e={'where':_0x52b55d[_0x114f('0x3c')]};return db[_0x114f('0x2b')][_0x114f('0x21')](_0x48690e)[_0x114f('0x26')](function(_0x2ab0a4){_0x1196e3[_0x114f('0x21')]=_0x2ab0a4;if(_0x3e5499['query']['includeAll']){_0x52b55d[_0x114f('0x41')]=[{'all':!![]}];}return db['Migration'][_0x114f('0x42')](_0x52b55d);})['then'](function(_0x2cce12){_0x1196e3[_0x114f('0x43')]=_0x2cce12;return _0x1196e3;})['then'](respondWithFilteredResult(_0x4a9148,_0x52b55d))[_0x114f('0x44')](handleError(_0x4a9148,null));}; \ No newline at end of file +var _0x1d8d=['json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x4423da,_0x13bdc1){var _0xe5a20b=function(_0x45f7c5){while(--_0x45f7c5){_0x4423da['push'](_0x4423da['shift']());}};_0xe5a20b(++_0x13bdc1);}(_0x1d8d,0x142));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd1d8('0x0'));var rimraf=require(_0xd1d8('0x1'));var zipdir=require(_0xd1d8('0x2'));var jsonpatch=require(_0xd1d8('0x3'));var rp=require(_0xd1d8('0x4'));var moment=require(_0xd1d8('0x5'));var BPromise=require(_0xd1d8('0x6'));var Mustache=require(_0xd1d8('0x7'));var util=require(_0xd1d8('0x8'));var path=require(_0xd1d8('0x9'));var sox=require('sox');var csv=require(_0xd1d8('0xa'));var ejs=require(_0xd1d8('0xb'));var fs=require('fs');var fs_extra=require(_0xd1d8('0xc'));var _=require('lodash');var squel=require(_0xd1d8('0xd'));var crypto=require(_0xd1d8('0xe'));var jsforce=require(_0xd1d8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd1d8('0x10'));var Papa=require('papaparse');var Redis=require(_0xd1d8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd1d8('0x12'));var as=require(_0xd1d8('0x13'));var hardwareService=require(_0xd1d8('0x14'));var logger=require(_0xd1d8('0x15'))(_0xd1d8('0x16'));var utils=require('../../config/utils');var config=require(_0xd1d8('0x17'));var licenseUtil=require(_0xd1d8('0x18'));var db=require(_0xd1d8('0x19'))['db'];function respondWithStatusCode(_0x17f594,_0x4fb6fa){_0x4fb6fa=_0x4fb6fa||0xcc;return function(_0x3cd96c){if(_0x3cd96c){return _0x17f594[_0xd1d8('0x1a')](_0x4fb6fa);}return _0x17f594['status'](_0x4fb6fa)['end']();};}function respondWithResult(_0x4b60e9,_0x342602){_0x342602=_0x342602||0xc8;return function(_0x95ad50){if(_0x95ad50){return _0x4b60e9[_0xd1d8('0x1b')](_0x342602)[_0xd1d8('0x1c')](_0x95ad50);}};}function respondWithFilteredResult(_0x45452b,_0x492719){return function(_0x22dc73){if(_0x22dc73){var _0x3fb84c=typeof _0x492719['offset']===_0xd1d8('0x1d')&&typeof _0x492719[_0xd1d8('0x1e')]==='undefined';var _0x103073=_0x22dc73[_0xd1d8('0x1f')];var _0x3949d6=_0x3fb84c?0x0:_0x492719[_0xd1d8('0x20')];var _0x23222b=_0x3fb84c?_0x22dc73[_0xd1d8('0x1f')]:_0x492719[_0xd1d8('0x20')]+_0x492719[_0xd1d8('0x1e')];var _0x8eb77b;if(_0x23222b>=_0x103073){_0x23222b=_0x103073;_0x8eb77b=0xc8;}else{_0x8eb77b=0xce;}_0x45452b[_0xd1d8('0x1b')](_0x8eb77b);return _0x45452b['set'](_0xd1d8('0x21'),_0x3949d6+'-'+_0x23222b+'/'+_0x103073)[_0xd1d8('0x1c')](_0x22dc73);}return null;};}function patchUpdates(_0x4556af){return function(_0xf5127a){try{jsonpatch[_0xd1d8('0x22')](_0xf5127a,_0x4556af,!![]);}catch(_0x59aa39){return BPromise[_0xd1d8('0x23')](_0x59aa39);}return _0xf5127a['save']();};}function saveUpdates(_0x54859a,_0x42d8ff){return function(_0x10e71b){if(_0x10e71b){return _0x10e71b[_0xd1d8('0x24')](_0x54859a)[_0xd1d8('0x25')](function(_0x398443){return _0x398443;});}return null;};}function removeEntity(_0xf25ace,_0x560419){return function(_0x478649){if(_0x478649){return _0x478649[_0xd1d8('0x26')]()[_0xd1d8('0x25')](function(){_0xf25ace[_0xd1d8('0x1b')](0xcc)[_0xd1d8('0x27')]();});}};}function handleEntityNotFound(_0x4b915e,_0x288538){return function(_0x38e396){if(!_0x38e396){_0x4b915e['sendStatus'](0x194);}return _0x38e396;};}function handleError(_0x2463b8,_0x2fcd5c){_0x2fcd5c=_0x2fcd5c||0x1f4;return function(_0x98119e){logger[_0xd1d8('0x28')](_0x98119e[_0xd1d8('0x29')]);if(_0x98119e[_0xd1d8('0x2a')]){delete _0x98119e[_0xd1d8('0x2a')];}_0x2463b8['status'](_0x2fcd5c)[_0xd1d8('0x2b')](_0x98119e);};}exports[_0xd1d8('0x2c')]=function(_0x143e21,_0x514db4){var _0x32166e={},_0x1e35df={},_0x1cae24={'count':0x0,'rows':[]};var _0x4f109e=_[_0xd1d8('0x2d')](db[_0xd1d8('0x2e')][_0xd1d8('0x2f')],function(_0x2a3a64){return{'name':_0x2a3a64[_0xd1d8('0x30')],'type':_0x2a3a64[_0xd1d8('0x31')][_0xd1d8('0x32')]};});_0x1e35df[_0xd1d8('0x33')]=_[_0xd1d8('0x2d')](_0x4f109e,_0xd1d8('0x2a'));_0x1e35df[_0xd1d8('0x34')]=_[_0xd1d8('0x35')](_0x143e21[_0xd1d8('0x34')]);_0x1e35df[_0xd1d8('0x36')]=_[_0xd1d8('0x37')](_0x1e35df[_0xd1d8('0x33')],_0x1e35df[_0xd1d8('0x34')]);_0x32166e['attributes']=_[_0xd1d8('0x37')](_0x1e35df[_0xd1d8('0x33')],qs[_0xd1d8('0x38')](_0x143e21[_0xd1d8('0x34')]['fields']));_0x32166e[_0xd1d8('0x39')]=_0x32166e[_0xd1d8('0x39')][_0xd1d8('0x3a')]?_0x32166e[_0xd1d8('0x39')]:_0x1e35df['model'];if(!_0x143e21[_0xd1d8('0x34')]['hasOwnProperty'](_0xd1d8('0x3b'))){_0x32166e[_0xd1d8('0x1e')]=qs[_0xd1d8('0x1e')](_0x143e21[_0xd1d8('0x34')][_0xd1d8('0x1e')]);_0x32166e[_0xd1d8('0x20')]=qs[_0xd1d8('0x20')](_0x143e21[_0xd1d8('0x34')][_0xd1d8('0x20')]);}_0x32166e['order']=qs['sort'](_0x143e21[_0xd1d8('0x34')][_0xd1d8('0x3c')]);_0x32166e[_0xd1d8('0x3d')]=qs[_0xd1d8('0x36')](_[_0xd1d8('0x3e')](_0x143e21[_0xd1d8('0x34')],_0x1e35df[_0xd1d8('0x36')]),_0x4f109e);if(_0x143e21[_0xd1d8('0x34')][_0xd1d8('0x3f')]){_0x32166e[_0xd1d8('0x3d')]=_[_0xd1d8('0x40')](_0x32166e[_0xd1d8('0x3d')],{'$or':_[_0xd1d8('0x2d')](_0x4f109e,function(_0x2bb499){if(_0x2bb499[_0xd1d8('0x31')]!=='VIRTUAL'){var _0x4baf4f={};_0x4baf4f[_0x2bb499['name']]={'$like':'%'+_0x143e21[_0xd1d8('0x34')]['filter']+'%'};return _0x4baf4f;}})});}_0x32166e=_[_0xd1d8('0x40')]({},_0x32166e,_0x143e21[_0xd1d8('0x41')]);var _0x5ca03b={'where':_0x32166e[_0xd1d8('0x3d')]};return db[_0xd1d8('0x2e')]['count'](_0x5ca03b)[_0xd1d8('0x25')](function(_0x52f187){_0x1cae24[_0xd1d8('0x1f')]=_0x52f187;if(_0x143e21[_0xd1d8('0x34')][_0xd1d8('0x42')]){_0x32166e[_0xd1d8('0x43')]=[{'all':!![]}];}return db['Migration'][_0xd1d8('0x44')](_0x32166e);})[_0xd1d8('0x25')](function(_0x4b70a8){_0x1cae24['rows']=_0x4b70a8;return _0x1cae24;})[_0xd1d8('0x25')](respondWithFilteredResult(_0x514db4,_0x32166e))[_0xd1d8('0x45')](handleError(_0x514db4,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 0b20648..4a7113e 100644 --- a/server/api/migration/migration.model.js +++ b/server/api/migration/migration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed52=['./migration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x39acf8,_0x158e5a){var _0x378ac3=function(_0x2f00e0){while(--_0x2f00e0){_0x39acf8['push'](_0x39acf8['shift']());}};_0x378ac3(++_0x158e5a);}(_0xed52,0x7c));var _0x2ed5=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xed52[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x2ed5('0x0'));var util=require('util');var logger=require(_0x2ed5('0x1'))(_0x2ed5('0x2'));var moment=require(_0x2ed5('0x3'));var BPromise=require(_0x2ed5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ed5('0x5'));var rimraf=require(_0x2ed5('0x6'));var config=require(_0x2ed5('0x7'));var attributes=require(_0x2ed5('0x8'));module[_0x2ed5('0x9')]=function(_0x17e994,_0x1adeed){return _0x17e994[_0x2ed5('0xa')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc179=['../../config/environment','exports','Migration','migrations','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x304107,_0xa47eaf){var _0x43d4af=function(_0x1d88b8){while(--_0x1d88b8){_0x304107['push'](_0x304107['shift']());}};_0x43d4af(++_0xa47eaf);}(_0xc179,0x1da));var _0x9c17=function(_0x260f28,_0x4e9b30){_0x260f28=_0x260f28-0x0;var _0x3aefcc=_0xc179[_0x260f28];return _0x3aefcc;};'use strict';var _=require(_0x9c17('0x0'));var util=require('util');var logger=require(_0x9c17('0x1'))('api');var moment=require(_0x9c17('0x2'));var BPromise=require(_0x9c17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c17('0x4'));var rimraf=require(_0x9c17('0x5'));var config=require(_0x9c17('0x6'));var attributes=require('./migration.attributes');module[_0x9c17('0x7')]=function(_0xe1c536,_0x240d91){return _0xe1c536['define'](_0x9c17('0x8'),attributes,{'tableName':_0x9c17('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 7a29796..bcc611b 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8c=['Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info'];(function(_0x2c3eac,_0x34d157){var _0x4feaec=function(_0x3f76cd){while(--_0x3f76cd){_0x2c3eac['push'](_0x2c3eac['shift']());}};_0x4feaec(++_0x34d157);}(_0x3f8c,0x104));var _0xc3f8=function(_0x29a93e,_0x151341){_0x29a93e=_0x29a93e-0x0;var _0x324829=_0x3f8c[_0x29a93e];return _0x324829;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('Migration,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});} \ No newline at end of file +var _0x3d15=['debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Migration,\x20%s,\x20%s'];(function(_0x29d7dc,_0x3a7521){var _0x1435c3=function(_0x4ad3cc){while(--_0x4ad3cc){_0x29d7dc['push'](_0x29d7dc['shift']());}};_0x1435c3(++_0x3a7521);}(_0x3d15,0x127));var _0x53d1=function(_0x118439,_0x1907d9){_0x118439=_0x118439-0x0;var _0x209b67=_0x3d15[_0x118439];return _0x209b67;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var moment=require(_0x53d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x53d1('0x2'));var fs=require('fs');var Redis=require(_0x53d1('0x3'));var db=require(_0x53d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x53d1('0x5'))(_0x53d1('0x6'));var config=require(_0x53d1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x53d1('0x8')][_0x53d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b4385,_0x8abe67,_0x32dfe1){return new BPromise(function(_0x1c4833,_0x49309e){return client[_0x53d1('0xa')](_0x4b4385,_0x32dfe1)[_0x53d1('0xb')](function(_0x59f965){logger['info'](_0x53d1('0xc'),_0x8abe67,'request\x20sent');logger[_0x53d1('0xd')](_0x53d1('0xe'),_0x8abe67,_0x53d1('0xf'),JSON[_0x53d1('0x10')](_0x59f965));if(_0x59f965[_0x53d1('0x11')]){if(_0x59f965[_0x53d1('0x11')][_0x53d1('0x12')]===0x1f4){logger[_0x53d1('0x11')]('Migration,\x20%s,\x20%s',_0x8abe67,_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);return _0x49309e(_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);}logger[_0x53d1('0x11')](_0x53d1('0xc'),_0x8abe67,_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);return _0x1c4833(_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);}else{logger[_0x53d1('0x14')](_0x53d1('0xc'),_0x8abe67,_0x53d1('0xf'));_0x1c4833(_0x59f965['result'][_0x53d1('0x13')]);}})[_0x53d1('0x15')](function(_0x4438ef){logger['error'](_0x53d1('0xc'),_0x8abe67,_0x4438ef);_0x49309e(_0x4438ef);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 9796517..0efb1b0 100644 --- a/server/api/network/index.js +++ b/server/api/network/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f0=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','create','put'];(function(_0x5813de,_0x4ab37a){var _0x338d72=function(_0x1d4b7e){while(--_0x1d4b7e){_0x5813de['push'](_0x5813de['shift']());}};_0x338d72(++_0x4ab37a);}(_0xd4f0,0x122));var _0x0d4f=function(_0x98db33,_0x397f20){_0x98db33=_0x98db33-0x0;var _0x5ae63a=_0xd4f0[_0x98db33];return _0x5ae63a;};'use strict';var multer=require(_0x0d4f('0x0'));var util=require(_0x0d4f('0x1'));var path=require(_0x0d4f('0x2'));var timeout=require(_0x0d4f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0d4f('0x4'));var interaction=require(_0x0d4f('0x5'));var config=require(_0x0d4f('0x6'));var controller=require(_0x0d4f('0x7'));router[_0x0d4f('0x8')]('/',auth[_0x0d4f('0x9')](),controller[_0x0d4f('0xa')]);router[_0x0d4f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0d4f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d4f('0xc')]);router[_0x0d4f('0xd')](_0x0d4f('0xe'),auth[_0x0d4f('0x9')](),controller[_0x0d4f('0xf')]);router[_0x0d4f('0x10')](_0x0d4f('0xe'),auth[_0x0d4f('0x9')](),controller[_0x0d4f('0x11')]);module[_0x0d4f('0x12')]=router; \ No newline at end of file +var _0xf55c=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x3a85be,_0x315510){var _0x4a12d1=function(_0x46508c){while(--_0x46508c){_0x3a85be['push'](_0x3a85be['shift']());}};_0x4a12d1(++_0x315510);}(_0xf55c,0x1e7));var _0xcf55=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xf55c[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xcf55('0x0'));var util=require('util');var path=require(_0xcf55('0x1'));var timeout=require(_0xcf55('0x2'));var express=require(_0xcf55('0x3'));var router=express[_0xcf55('0x4')]();var fs_extra=require(_0xcf55('0x5'));var auth=require(_0xcf55('0x6'));var interaction=require(_0xcf55('0x7'));var config=require('../../config/environment');var controller=require(_0xcf55('0x8'));router[_0xcf55('0x9')]('/',auth[_0xcf55('0xa')](),controller[_0xcf55('0xb')]);router['get'](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0xd')]);router[_0xcf55('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf55('0xf')]);router[_0xcf55('0x10')](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0x11')]);router[_0xcf55('0x12')](_0xcf55('0xc'),auth['isAuthenticated'](),controller[_0xcf55('0x13')]);module[_0xcf55('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 5d96cc9..dd51997 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd70e=['externip','stun','turn','STRING','ENUM','localnet'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd70e,0x196));var _0xed70=function(_0x273033,_0x24f181){_0x273033=_0x273033-0x0;var _0x1e6b54=_0xd70e[_0x273033];return _0x1e6b54;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xed70('0x0')](_0xed70('0x1'),_0xed70('0x2'),_0xed70('0x3'),_0xed70('0x4'))},'value':{'type':Sequelize[_0xed70('0x5')]},'username':{'type':Sequelize[_0xed70('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f9d=['exports','ENUM','stun','turn','STRING','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6f9d,0x173));var _0xd6f9=function(_0x545b28,_0x3cc402){_0x545b28=_0x545b28-0x0;var _0x108ec9=_0x6f9d[_0x545b28];return _0x108ec9;};'use strict';var Sequelize=require(_0xd6f9('0x0'));module[_0xd6f9('0x1')]={'type':{'type':Sequelize[_0xd6f9('0x2')]('localnet','externip',_0xd6f9('0x3'),_0xd6f9('0x4'))},'value':{'type':Sequelize[_0xd6f9('0x5')]},'username':{'type':Sequelize[_0xd6f9('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5f5947d..b58239f 100644 --- a/server/api/network/network.controller.js +++ b/server/api/network/network.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x881a=['where','pick','filter','merge','options','includeAll','include','rows','show','params','catch','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','create','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','res_stun_monitor.so','destroy','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','jayson/promise','http','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','update','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x881a,0x77));var _0xa881=function(_0x720e20,_0x1a827){_0x720e20=_0x720e20-0x0;var _0xfef46e=_0x881a[_0x720e20];return _0xfef46e;};'use strict';var util=require(_0xa881('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa881('0x1'));var qs=require(_0xa881('0x2'));var logger=require(_0xa881('0x3'))('api');var config=require('../../config/environment');var db=require(_0xa881('0x4'))['db'];var jayson=require(_0xa881('0x5'));var client=jayson['client'][_0xa881('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x143630,_0x36b661,_0x9e8b5f,_0x1a1f15){return new Promise(function(_0x453744,_0x46ba7d){var _0x5174ed=_0x1a1f15||client;return _0x5174ed[_0xa881('0x7')](_0x143630,_0x9e8b5f)[_0xa881('0x8')](function(_0x15f5b1){logger['info']('Network,\x20%s,\x20%s',_0x36b661,_0xa881('0x9'));logger['debug'](_0xa881('0xa'),_0x36b661,_0xa881('0x9'),JSON[_0xa881('0xb')](_0x15f5b1));if(_0x15f5b1[_0xa881('0xc')]){if(_0x15f5b1['error'][_0xa881('0xd')]===0x1f4){logger[_0xa881('0xc')](_0xa881('0xe'),_0x36b661,_0x15f5b1[_0xa881('0xc')][_0xa881('0xf')]);return _0x46ba7d(_0x15f5b1[_0xa881('0xc')][_0xa881('0xf')]);}logger[_0xa881('0xc')](_0xa881('0xe'),_0x36b661,_0x15f5b1[_0xa881('0xc')][_0xa881('0xf')]);return _0x453744(_0x15f5b1[_0xa881('0xc')][_0xa881('0xf')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x36b661,_0xa881('0x9'));_0x453744(_0x15f5b1[_0xa881('0x10')]['message']);}})['catch'](function(_0x2304bb){logger[_0xa881('0xc')](_0xa881('0xe'),_0x36b661,_0x2304bb);_0x46ba7d(_0x2304bb);});});}function respondWithResult(_0xc35cfd,_0x18605b){_0x18605b=_0x18605b||0xc8;return function(_0x1039ab){if(_0x1039ab){return _0xc35cfd[_0xa881('0x11')](_0x18605b)[_0xa881('0x12')](_0x1039ab);}};}function respondWithFilteredResult(_0x3ea41e,_0x1902b2){return function(_0x23b672){if(_0x23b672){var _0x3fde64=typeof _0x1902b2[_0xa881('0x13')]===_0xa881('0x14')&&typeof _0x1902b2[_0xa881('0x15')]===_0xa881('0x14');var _0x5653bf=_0x23b672[_0xa881('0x16')];var _0x59051f=_0x3fde64?0x0:_0x1902b2[_0xa881('0x13')];var _0x3340ba=_0x3fde64?_0x23b672[_0xa881('0x16')]:_0x1902b2[_0xa881('0x13')]+_0x1902b2[_0xa881('0x15')];var _0x5c91da;if(_0x3340ba>=_0x5653bf){_0x3340ba=_0x5653bf;_0x5c91da=0xc8;}else{_0x5c91da=0xce;}_0x3ea41e[_0xa881('0x11')](_0x5c91da);return _0x3ea41e[_0xa881('0x17')]('Content-Range',_0x59051f+'-'+_0x3340ba+'/'+_0x5653bf)[_0xa881('0x12')](_0x23b672);}return null;};}function saveUpdates(_0x50f412){return function(_0x562d54){if(_0x562d54){return _0x562d54[_0xa881('0x18')](_0x50f412)[_0xa881('0x8')](function(_0x7f424c){return _0x7f424c;});}return null;};}function removeEntity(_0x1858cc){return function(_0x17b169){if(_0x17b169){return _0x17b169['destroy']()[_0xa881('0x8')](function(){_0x1858cc[_0xa881('0x11')](0xcc)[_0xa881('0x19')]();});}};}function handleEntityNotFound(_0x13296a){return function(_0x5352a1){if(!_0x5352a1){_0x13296a[_0xa881('0x1a')](0x194);}return _0x5352a1;};}function handleError(_0xd836ab,_0x54d1a5){_0x54d1a5=_0x54d1a5||0x1f4;return function(_0xfad506){logger['error'](_0xfad506[_0xa881('0x1b')]);if(_0xfad506[_0xa881('0x1c')]){delete _0xfad506[_0xa881('0x1c')];}_0xd836ab[_0xa881('0x11')](_0x54d1a5)[_0xa881('0x1d')](_0xfad506);};}exports[_0xa881('0x1e')]=function(_0x465d45,_0x5066aa){var _0x4c46d8={},_0x10835a={},_0x4720b1={'count':0x0,'rows':[]};var _0x4d23eb=_[_0xa881('0x1f')](db[_0xa881('0x20')][_0xa881('0x21')],function(_0x438881){return{'name':_0x438881[_0xa881('0x22')],'type':_0x438881[_0xa881('0x23')][_0xa881('0x24')]};});_0x10835a['model']=_[_0xa881('0x1f')](_0x4d23eb,_0xa881('0x1c'));_0x10835a['query']=_[_0xa881('0x25')](_0x465d45[_0xa881('0x26')]);_0x10835a[_0xa881('0x27')]=_['intersection'](_0x10835a['model'],_0x10835a[_0xa881('0x26')]);_0x4c46d8['attributes']=_[_0xa881('0x28')](_0x10835a[_0xa881('0x29')],qs[_0xa881('0x2a')](_0x465d45['query'][_0xa881('0x2a')]));_0x4c46d8[_0xa881('0x2b')]=_0x4c46d8[_0xa881('0x2b')][_0xa881('0x2c')]?_0x4c46d8[_0xa881('0x2b')]:_0x10835a[_0xa881('0x29')];if(!_0x465d45[_0xa881('0x26')][_0xa881('0x2d')](_0xa881('0x2e'))){_0x4c46d8['limit']=qs[_0xa881('0x15')](_0x465d45[_0xa881('0x26')][_0xa881('0x15')]);_0x4c46d8[_0xa881('0x13')]=qs[_0xa881('0x13')](_0x465d45[_0xa881('0x26')][_0xa881('0x13')]);}_0x4c46d8[_0xa881('0x2f')]=qs[_0xa881('0x30')](_0x465d45[_0xa881('0x26')][_0xa881('0x30')]);_0x4c46d8[_0xa881('0x31')]=qs[_0xa881('0x27')](_[_0xa881('0x32')](_0x465d45[_0xa881('0x26')],_0x10835a[_0xa881('0x27')]),_0x4d23eb);if(_0x465d45['query'][_0xa881('0x33')]){_0x4c46d8[_0xa881('0x31')]=_[_0xa881('0x34')](_0x4c46d8[_0xa881('0x31')],{'$or':_['map'](_0x4d23eb,function(_0x5d98dc){if(_0x5d98dc[_0xa881('0x23')]!=='VIRTUAL'){var _0x5e2c7d={};_0x5e2c7d[_0x5d98dc[_0xa881('0x1c')]]={'$like':'%'+_0x465d45[_0xa881('0x26')][_0xa881('0x33')]+'%'};return _0x5e2c7d;}})});}_0x4c46d8=_[_0xa881('0x34')]({},_0x4c46d8,_0x465d45[_0xa881('0x35')]);var _0x18252c={'where':_0x4c46d8[_0xa881('0x31')]};return db['Network'][_0xa881('0x16')](_0x18252c)[_0xa881('0x8')](function(_0x2e9778){_0x4720b1[_0xa881('0x16')]=_0x2e9778;if(_0x465d45['query'][_0xa881('0x36')]){_0x4c46d8[_0xa881('0x37')]=[{'all':!![]}];}return db[_0xa881('0x20')]['findAll'](_0x4c46d8);})['then'](function(_0x3efb7a){_0x4720b1[_0xa881('0x38')]=_0x3efb7a;return _0x4720b1;})[_0xa881('0x8')](respondWithFilteredResult(_0x5066aa,_0x4c46d8))['catch'](handleError(_0x5066aa,null));};exports[_0xa881('0x39')]=function(_0xd25bd,_0x40584e){var _0x11917f={'raw':!![],'where':{'id':_0xd25bd[_0xa881('0x3a')]['id']}},_0x12e5d1={};_0x12e5d1[_0xa881('0x29')]=_[_0xa881('0x25')](db['Network'][_0xa881('0x21')]);_0x12e5d1[_0xa881('0x26')]=_[_0xa881('0x25')](_0xd25bd[_0xa881('0x26')]);_0x12e5d1[_0xa881('0x27')]=_[_0xa881('0x28')](_0x12e5d1[_0xa881('0x29')],_0x12e5d1[_0xa881('0x26')]);_0x11917f[_0xa881('0x2b')]=_[_0xa881('0x28')](_0x12e5d1[_0xa881('0x29')],qs['fields'](_0xd25bd[_0xa881('0x26')]['fields']));_0x11917f[_0xa881('0x2b')]=_0x11917f[_0xa881('0x2b')][_0xa881('0x2c')]?_0x11917f[_0xa881('0x2b')]:_0x12e5d1['model'];if(_0xd25bd[_0xa881('0x26')][_0xa881('0x36')]){_0x11917f[_0xa881('0x37')]=[{'all':!![]}];}_0x11917f=_[_0xa881('0x34')]({},_0x11917f,_0xd25bd[_0xa881('0x35')]);return db[_0xa881('0x20')]['find'](_0x11917f)[_0xa881('0x8')](handleEntityNotFound(_0x40584e,null))[_0xa881('0x8')](respondWithResult(_0x40584e,null))[_0xa881('0x3b')](handleError(_0x40584e,null));};exports['create']=function(_0x3e7e8b,_0x59b3cb){var _0x3de9b5;return db['Network']['create'](_0x3e7e8b[_0xa881('0x3c')],{'raw':!![]})['then'](function(_0x3343ac){_0x3de9b5=_0x3343ac;return db[_0xa881('0x20')][_0xa881('0x3d')]({'where':{'type':_0x3e7e8b[_0xa881('0x3c')][_0xa881('0x23')]},'raw':!![]});})[_0xa881('0x8')](function(_0x49e45e){if(_0x3de9b5[_0xa881('0x23')][_0xa881('0x3e')]()==_0xa881('0x3f')){var _0x21d8c3=fs[_0xa881('0x40')](path[_0xa881('0x41')](config[_0xa881('0x42')],_0xa881('0x43')),_0xa881('0x44'));var _0x441bfc=ejs[_0xa881('0x45')](_0x21d8c3,{'networks':_0x49e45e||[]});fs[_0xa881('0x46')](_0xa881('0x47'),_0x441bfc);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x3de9b5['type'][_0xa881('0x3e')]()==_0xa881('0x48')){var _0x4a5e44=fs['readFileSync'](path['join'](config['root'],_0xa881('0x49')),_0xa881('0x44'));var _0x4f32a8=ejs[_0xa881('0x45')](_0x4a5e44,{'networks':_0x49e45e||[]});fs[_0xa881('0x46')](_0xa881('0x4a'),_0x4f32a8);return respondWithRpcPromise(_0xa881('0x4b'),_0xa881('0x4c'),{'module':'res_stun_monitor.so'});}else{var _0xf733e5=fs['readFileSync'](path[_0xa881('0x41')](config['root'],_0xa881('0x4d')),_0xa881('0x44'));var _0x162e3c=ejs[_0xa881('0x45')](_0xf733e5,{'networks':_0x49e45e||[]});fs['writeFileSync'](util[_0xa881('0x4e')](_0xa881('0x4f'),_0x3e7e8b['body'][_0xa881('0x23')][_0xa881('0x50')]()),_0x162e3c);return respondWithRpcPromise('Reload',_0xa881('0x4c'),{'module':_0xa881('0x51')});}})[_0xa881('0x8')](function(){return _0x3de9b5;})[_0xa881('0x8')](respondWithResult(_0x59b3cb,0xc9))['catch'](handleError(_0x59b3cb,null));};exports[_0xa881('0x18')]=function(_0xd601f3,_0x15b51a){var _0x54f48c;return db[_0xa881('0x20')]['find']({'where':{'id':_0xd601f3['params']['id']}})['then'](handleEntityNotFound(_0x15b51a,null))['then'](saveUpdates(_0xd601f3[_0xa881('0x3c')],null))[_0xa881('0x8')](function(_0x4c66f6){if(_0x4c66f6){_0x54f48c=_0x4c66f6;return db[_0xa881('0x20')][_0xa881('0x3d')]({'where':{'type':_0x54f48c['type']},'raw':!![]});}return null;})[_0xa881('0x8')](function(_0x342ef1){if(_0x54f48c[_0xa881('0x23')]['toUpperCase']()=='STUN'){var _0x22ac31=fs['readFileSync'](path[_0xa881('0x41')](config[_0xa881('0x42')],_0xa881('0x43')),_0xa881('0x44'));var _0x491554=ejs[_0xa881('0x45')](_0x22ac31,{'networks':_0x342ef1||[]});fs[_0xa881('0x46')](_0xa881('0x47'),_0x491554);return respondWithRpcPromise(_0xa881('0x4b'),'update',{'module':_0xa881('0x52')});}else if(_0x54f48c[_0xa881('0x23')]['toUpperCase']()==_0xa881('0x48')){var _0x588ca1=fs['readFileSync'](path[_0xa881('0x41')](config[_0xa881('0x42')],_0xa881('0x49')),_0xa881('0x44'));var _0x44c2cc=ejs[_0xa881('0x45')](_0x588ca1,{'networks':_0x342ef1||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x44c2cc);return respondWithRpcPromise(_0xa881('0x4b'),_0xa881('0x18'),{'module':'res_stun_monitor.so'});}else{var _0xe7d84c=fs[_0xa881('0x40')](path[_0xa881('0x41')](config[_0xa881('0x42')],_0xa881('0x4d')),_0xa881('0x44'));var _0x19c399=ejs[_0xa881('0x45')](_0xe7d84c,{'networks':_0x342ef1||[]});fs[_0xa881('0x46')](util[_0xa881('0x4e')](_0xa881('0x4f'),_0xd601f3[_0xa881('0x3c')][_0xa881('0x23')][_0xa881('0x50')]()),_0x19c399);return respondWithRpcPromise('Reload',_0xa881('0x18'),{'module':_0xa881('0x51')});}})['then'](function(_0x193204){if(_0x193204){return _0x54f48c;}return null;})[_0xa881('0x8')](respondWithResult(_0x15b51a,null))[_0xa881('0x3b')](handleError(_0x15b51a,null));};exports['destroy']=function(_0x4b4d20,_0xfb4eb5){var _0x35f85b;return db['Network']['find']({'where':{'id':_0x4b4d20[_0xa881('0x3a')]['id']}})[_0xa881('0x8')](function(_0x52e5a0){_0x35f85b=_0x52e5a0;return _0x52e5a0;})['then'](handleEntityNotFound(_0xfb4eb5,null))[_0xa881('0x8')](removeEntity(_0xfb4eb5,null))[_0xa881('0x8')](function(){if(_0x35f85b){return db['Network']['findAll']({'where':{'type':_0x35f85b['type']},'raw':!![]});}})[_0xa881('0x8')](function(_0x3d3020){if(_0x35f85b[_0xa881('0x23')]['toUpperCase']()=='STUN'){var _0x11481a=fs[_0xa881('0x40')](path[_0xa881('0x41')](config['root'],_0xa881('0x43')),_0xa881('0x44'));var _0x4de560=ejs[_0xa881('0x45')](_0x11481a,{'networks':_0x3d3020||[]});fs[_0xa881('0x46')]('/etc/asterisk/stun_xcally.conf',_0x4de560);return respondWithRpcPromise(_0xa881('0x4b'),_0xa881('0x53'),{'module':_0xa881('0x52')});}else if(_0x35f85b['type']['toUpperCase']()==_0xa881('0x48')){var _0x410a78=fs[_0xa881('0x40')](path['join'](config[_0xa881('0x42')],_0xa881('0x49')),_0xa881('0x44'));var _0x189ae9=ejs[_0xa881('0x45')](_0x410a78,{'networks':_0x3d3020||[]});fs[_0xa881('0x46')](_0xa881('0x4a'),_0x189ae9);return respondWithRpcPromise(_0xa881('0x4b'),_0xa881('0x53'),{'module':'res_stun_monitor.so'});}else{var _0x546717=fs[_0xa881('0x40')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xa881('0x44'));var _0xe2e9fd=ejs[_0xa881('0x45')](_0x546717,{'networks':_0x3d3020||[]});fs[_0xa881('0x46')](util[_0xa881('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x35f85b[_0xa881('0x23')][_0xa881('0x50')]()),_0xe2e9fd);return respondWithRpcPromise(_0xa881('0x4b'),_0xa881('0x53'),{'module':_0xa881('0x51')});}})['catch'](handleError(_0xfb4eb5,null));}; \ No newline at end of file +var _0x059f=['merge','VIRTUAL','filter','options','includeAll','findAll','rows','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','offset','count','limit','set','update','destroy','end','sendStatus','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x059f,0x121));var _0xf059=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x059f[_0x1c546c];return _0x2cc384;};'use strict';var util=require(_0xf059('0x0'));var path=require(_0xf059('0x1'));var ejs=require(_0xf059('0x2'));var fs=require('fs');var _=require(_0xf059('0x3'));var qs=require(_0xf059('0x4'));var logger=require(_0xf059('0x5'))(_0xf059('0x6'));var config=require(_0xf059('0x7'));var db=require(_0xf059('0x8'))['db'];var jayson=require(_0xf059('0x9'));var client=jayson[_0xf059('0xa')][_0xf059('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b520a,_0x32f483,_0x1efc88,_0xbaaa27){return new Promise(function(_0x2648be,_0x40d8a2){var _0x2a6dca=_0xbaaa27||client;return _0x2a6dca[_0xf059('0xc')](_0x2b520a,_0x1efc88)[_0xf059('0xd')](function(_0x2355bc){logger[_0xf059('0xe')](_0xf059('0xf'),_0x32f483,_0xf059('0x10'));logger['debug'](_0xf059('0x11'),_0x32f483,_0xf059('0x10'),JSON['stringify'](_0x2355bc));if(_0x2355bc[_0xf059('0x12')]){if(_0x2355bc['error'][_0xf059('0x13')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x32f483,_0x2355bc['error'][_0xf059('0x14')]);return _0x40d8a2(_0x2355bc[_0xf059('0x12')][_0xf059('0x14')]);}logger['error'](_0xf059('0xf'),_0x32f483,_0x2355bc[_0xf059('0x12')]['message']);return _0x2648be(_0x2355bc[_0xf059('0x12')][_0xf059('0x14')]);}else{logger['info'](_0xf059('0xf'),_0x32f483,'request\x20sent');_0x2648be(_0x2355bc[_0xf059('0x15')][_0xf059('0x14')]);}})[_0xf059('0x16')](function(_0x2da12f){logger[_0xf059('0x12')](_0xf059('0xf'),_0x32f483,_0x2da12f);_0x40d8a2(_0x2da12f);});});}function respondWithResult(_0x417a07,_0xab9e61){_0xab9e61=_0xab9e61||0xc8;return function(_0x47bfb4){if(_0x47bfb4){return _0x417a07[_0xf059('0x17')](_0xab9e61)[_0xf059('0x18')](_0x47bfb4);}};}function respondWithFilteredResult(_0xaacfbb,_0x13481f){return function(_0x17887d){if(_0x17887d){var _0x498428=typeof _0x13481f['offset']===_0xf059('0x19')&&typeof _0x13481f['limit']==='undefined';var _0x431f20=_0x17887d['count'];var _0x298ba5=_0x498428?0x0:_0x13481f[_0xf059('0x1a')];var _0x327da5=_0x498428?_0x17887d[_0xf059('0x1b')]:_0x13481f[_0xf059('0x1a')]+_0x13481f[_0xf059('0x1c')];var _0x2d343d;if(_0x327da5>=_0x431f20){_0x327da5=_0x431f20;_0x2d343d=0xc8;}else{_0x2d343d=0xce;}_0xaacfbb[_0xf059('0x17')](_0x2d343d);return _0xaacfbb[_0xf059('0x1d')]('Content-Range',_0x298ba5+'-'+_0x327da5+'/'+_0x431f20)[_0xf059('0x18')](_0x17887d);}return null;};}function saveUpdates(_0x83c357){return function(_0x368759){if(_0x368759){return _0x368759[_0xf059('0x1e')](_0x83c357)[_0xf059('0xd')](function(_0x2154e4){return _0x2154e4;});}return null;};}function removeEntity(_0x14d9c1){return function(_0x88a02){if(_0x88a02){return _0x88a02[_0xf059('0x1f')]()[_0xf059('0xd')](function(){_0x14d9c1[_0xf059('0x17')](0xcc)[_0xf059('0x20')]();});}};}function handleEntityNotFound(_0xc41eed){return function(_0x117b8f){if(!_0x117b8f){_0xc41eed[_0xf059('0x21')](0x194);}return _0x117b8f;};}function handleError(_0x35b868,_0x482644){_0x482644=_0x482644||0x1f4;return function(_0xc2b6e4){logger[_0xf059('0x12')](_0xc2b6e4['stack']);if(_0xc2b6e4[_0xf059('0x22')]){delete _0xc2b6e4[_0xf059('0x22')];}_0x35b868[_0xf059('0x17')](_0x482644)[_0xf059('0x23')](_0xc2b6e4);};}exports[_0xf059('0x24')]=function(_0x4ff722,_0x598fdd){var _0x14d8e6={},_0x40bb48={},_0x29f895={'count':0x0,'rows':[]};var _0x483e5a=_[_0xf059('0x25')](db[_0xf059('0x26')][_0xf059('0x27')],function(_0x1a2d80){return{'name':_0x1a2d80[_0xf059('0x28')],'type':_0x1a2d80[_0xf059('0x29')][_0xf059('0x2a')]};});_0x40bb48[_0xf059('0x2b')]=_[_0xf059('0x25')](_0x483e5a,_0xf059('0x22'));_0x40bb48[_0xf059('0x2c')]=_['keys'](_0x4ff722[_0xf059('0x2c')]);_0x40bb48[_0xf059('0x2d')]=_[_0xf059('0x2e')](_0x40bb48[_0xf059('0x2b')],_0x40bb48[_0xf059('0x2c')]);_0x14d8e6[_0xf059('0x2f')]=_['intersection'](_0x40bb48['model'],qs[_0xf059('0x30')](_0x4ff722[_0xf059('0x2c')][_0xf059('0x30')]));_0x14d8e6[_0xf059('0x2f')]=_0x14d8e6[_0xf059('0x2f')][_0xf059('0x31')]?_0x14d8e6['attributes']:_0x40bb48[_0xf059('0x2b')];if(!_0x4ff722[_0xf059('0x2c')][_0xf059('0x32')]('nolimit')){_0x14d8e6[_0xf059('0x1c')]=qs['limit'](_0x4ff722[_0xf059('0x2c')]['limit']);_0x14d8e6[_0xf059('0x1a')]=qs[_0xf059('0x1a')](_0x4ff722[_0xf059('0x2c')][_0xf059('0x1a')]);}_0x14d8e6[_0xf059('0x33')]=qs[_0xf059('0x34')](_0x4ff722[_0xf059('0x2c')][_0xf059('0x34')]);_0x14d8e6[_0xf059('0x35')]=qs['filters'](_[_0xf059('0x36')](_0x4ff722[_0xf059('0x2c')],_0x40bb48['filters']),_0x483e5a);if(_0x4ff722[_0xf059('0x2c')]['filter']){_0x14d8e6[_0xf059('0x35')]=_[_0xf059('0x37')](_0x14d8e6['where'],{'$or':_['map'](_0x483e5a,function(_0x1e3cf9){if(_0x1e3cf9['type']!==_0xf059('0x38')){var _0xd1a813={};_0xd1a813[_0x1e3cf9[_0xf059('0x22')]]={'$like':'%'+_0x4ff722[_0xf059('0x2c')][_0xf059('0x39')]+'%'};return _0xd1a813;}})});}_0x14d8e6=_[_0xf059('0x37')]({},_0x14d8e6,_0x4ff722[_0xf059('0x3a')]);var _0x4822e9={'where':_0x14d8e6[_0xf059('0x35')]};return db[_0xf059('0x26')][_0xf059('0x1b')](_0x4822e9)['then'](function(_0x440ed3){_0x29f895[_0xf059('0x1b')]=_0x440ed3;if(_0x4ff722[_0xf059('0x2c')][_0xf059('0x3b')]){_0x14d8e6['include']=[{'all':!![]}];}return db[_0xf059('0x26')][_0xf059('0x3c')](_0x14d8e6);})[_0xf059('0xd')](function(_0x394335){_0x29f895[_0xf059('0x3d')]=_0x394335;return _0x29f895;})[_0xf059('0xd')](respondWithFilteredResult(_0x598fdd,_0x14d8e6))[_0xf059('0x16')](handleError(_0x598fdd,null));};exports['show']=function(_0x551f4b,_0x31a9ba){var _0x1e5fbb={'raw':!![],'where':{'id':_0x551f4b['params']['id']}},_0x4be829={};_0x4be829['model']=_['keys'](db['Network'][_0xf059('0x27')]);_0x4be829['query']=_['keys'](_0x551f4b['query']);_0x4be829['filters']=_[_0xf059('0x2e')](_0x4be829[_0xf059('0x2b')],_0x4be829[_0xf059('0x2c')]);_0x1e5fbb[_0xf059('0x2f')]=_[_0xf059('0x2e')](_0x4be829[_0xf059('0x2b')],qs[_0xf059('0x30')](_0x551f4b[_0xf059('0x2c')]['fields']));_0x1e5fbb[_0xf059('0x2f')]=_0x1e5fbb[_0xf059('0x2f')][_0xf059('0x31')]?_0x1e5fbb[_0xf059('0x2f')]:_0x4be829[_0xf059('0x2b')];if(_0x551f4b[_0xf059('0x2c')]['includeAll']){_0x1e5fbb['include']=[{'all':!![]}];}_0x1e5fbb=_[_0xf059('0x37')]({},_0x1e5fbb,_0x551f4b[_0xf059('0x3a')]);return db['Network'][_0xf059('0x3e')](_0x1e5fbb)[_0xf059('0xd')](handleEntityNotFound(_0x31a9ba,null))[_0xf059('0xd')](respondWithResult(_0x31a9ba,null))[_0xf059('0x16')](handleError(_0x31a9ba,null));};exports[_0xf059('0x3f')]=function(_0x40a170,_0x496dee){var _0x9b99de;return db[_0xf059('0x26')]['create'](_0x40a170['body'],{'raw':!![]})[_0xf059('0xd')](function(_0x1a8eaf){_0x9b99de=_0x1a8eaf;return db[_0xf059('0x26')][_0xf059('0x3c')]({'where':{'type':_0x40a170[_0xf059('0x40')][_0xf059('0x29')]},'raw':!![]});})[_0xf059('0xd')](function(_0x4af530){if(_0x9b99de[_0xf059('0x29')][_0xf059('0x41')]()==_0xf059('0x42')){var _0xfec04d=fs[_0xf059('0x43')](path[_0xf059('0x44')](config[_0xf059('0x45')],_0xf059('0x46')),_0xf059('0x47'));var _0x1b5ed0=ejs[_0xf059('0x48')](_0xfec04d,{'networks':_0x4af530||[]});fs[_0xf059('0x49')](_0xf059('0x4a'),_0x1b5ed0);return respondWithRpcPromise(_0xf059('0x4b'),_0xf059('0x3f'),{'module':_0xf059('0x4c')});}else if(_0x9b99de[_0xf059('0x29')][_0xf059('0x41')]()==_0xf059('0x4d')){var _0x31e041=fs[_0xf059('0x43')](path['join'](config[_0xf059('0x45')],_0xf059('0x4e')),_0xf059('0x47'));var _0x812e6f=ejs[_0xf059('0x48')](_0x31e041,{'networks':_0x4af530||[]});fs[_0xf059('0x49')](_0xf059('0x4f'),_0x812e6f);return respondWithRpcPromise(_0xf059('0x4b'),_0xf059('0x3f'),{'module':_0xf059('0x4c')});}else{var _0x159f7d=fs[_0xf059('0x43')](path[_0xf059('0x44')](config[_0xf059('0x45')],_0xf059('0x50')),_0xf059('0x47'));var _0x316f7a=ejs['render'](_0x159f7d,{'networks':_0x4af530||[]});fs[_0xf059('0x49')](util[_0xf059('0x51')](_0xf059('0x52'),_0x40a170['body'][_0xf059('0x29')][_0xf059('0x53')]()),_0x316f7a);return respondWithRpcPromise('Reload',_0xf059('0x3f'),{'module':'chan_sip.so'});}})['then'](function(){return _0x9b99de;})['then'](respondWithResult(_0x496dee,0xc9))[_0xf059('0x16')](handleError(_0x496dee,null));};exports[_0xf059('0x1e')]=function(_0x173002,_0x5d15b2){var _0x57db7d;return db['Network'][_0xf059('0x3e')]({'where':{'id':_0x173002[_0xf059('0x54')]['id']}})[_0xf059('0xd')](handleEntityNotFound(_0x5d15b2,null))[_0xf059('0xd')](saveUpdates(_0x173002['body'],null))[_0xf059('0xd')](function(_0x2aeab4){if(_0x2aeab4){_0x57db7d=_0x2aeab4;return db[_0xf059('0x26')][_0xf059('0x3c')]({'where':{'type':_0x57db7d['type']},'raw':!![]});}return null;})[_0xf059('0xd')](function(_0x5edfda){if(_0x57db7d['type'][_0xf059('0x41')]()==_0xf059('0x42')){var _0x3f657f=fs[_0xf059('0x43')](path[_0xf059('0x44')](config[_0xf059('0x45')],_0xf059('0x46')),_0xf059('0x47'));var _0x19001f=ejs[_0xf059('0x48')](_0x3f657f,{'networks':_0x5edfda||[]});fs[_0xf059('0x49')](_0xf059('0x4a'),_0x19001f);return respondWithRpcPromise('Reload',_0xf059('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x57db7d['type']['toUpperCase']()==_0xf059('0x4d')){var _0x4b3de7=fs[_0xf059('0x43')](path[_0xf059('0x44')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xf059('0x47'));var _0x1a453f=ejs['render'](_0x4b3de7,{'networks':_0x5edfda||[]});fs[_0xf059('0x49')](_0xf059('0x4f'),_0x1a453f);return respondWithRpcPromise(_0xf059('0x4b'),_0xf059('0x1e'),{'module':_0xf059('0x4c')});}else{var _0x467549=fs['readFileSync'](path['join'](config['root'],'server/files/templates/network.ejs'),_0xf059('0x47'));var _0x35611d=ejs['render'](_0x467549,{'networks':_0x5edfda||[]});fs[_0xf059('0x49')](util['format'](_0xf059('0x52'),_0x173002[_0xf059('0x40')][_0xf059('0x29')][_0xf059('0x53')]()),_0x35611d);return respondWithRpcPromise('Reload','update',{'module':_0xf059('0x55')});}})[_0xf059('0xd')](function(_0x23e80c){if(_0x23e80c){return _0x57db7d;}return null;})[_0xf059('0xd')](respondWithResult(_0x5d15b2,null))[_0xf059('0x16')](handleError(_0x5d15b2,null));};exports[_0xf059('0x1f')]=function(_0x1d966f,_0x26c014){var _0x191fe9;return db['Network'][_0xf059('0x3e')]({'where':{'id':_0x1d966f[_0xf059('0x54')]['id']}})[_0xf059('0xd')](function(_0x34e082){_0x191fe9=_0x34e082;return _0x34e082;})[_0xf059('0xd')](handleEntityNotFound(_0x26c014,null))[_0xf059('0xd')](removeEntity(_0x26c014,null))[_0xf059('0xd')](function(){if(_0x191fe9){return db[_0xf059('0x26')][_0xf059('0x3c')]({'where':{'type':_0x191fe9[_0xf059('0x29')]},'raw':!![]});}})[_0xf059('0xd')](function(_0x2362ba){if(_0x191fe9[_0xf059('0x29')]['toUpperCase']()=='STUN'){var _0x24d3b7=fs['readFileSync'](path[_0xf059('0x44')](config[_0xf059('0x45')],_0xf059('0x46')),_0xf059('0x47'));var _0x260219=ejs[_0xf059('0x48')](_0x24d3b7,{'networks':_0x2362ba||[]});fs[_0xf059('0x49')](_0xf059('0x4a'),_0x260219);return respondWithRpcPromise(_0xf059('0x4b'),_0xf059('0x1f'),{'module':_0xf059('0x4c')});}else if(_0x191fe9[_0xf059('0x29')]['toUpperCase']()==_0xf059('0x4d')){var _0x292f37=fs[_0xf059('0x43')](path[_0xf059('0x44')](config['root'],_0xf059('0x4e')),'utf8');var _0x353fbb=ejs[_0xf059('0x48')](_0x292f37,{'networks':_0x2362ba||[]});fs[_0xf059('0x49')]('/etc/asterisk/turn_xcally.conf',_0x353fbb);return respondWithRpcPromise(_0xf059('0x4b'),_0xf059('0x1f'),{'module':_0xf059('0x4c')});}else{var _0x3af960=fs['readFileSync'](path[_0xf059('0x44')](config[_0xf059('0x45')],_0xf059('0x50')),_0xf059('0x47'));var _0x5e5a60=ejs[_0xf059('0x48')](_0x3af960,{'networks':_0x2362ba||[]});fs['writeFileSync'](util[_0xf059('0x51')](_0xf059('0x52'),_0x191fe9[_0xf059('0x29')][_0xf059('0x53')]()),_0x5e5a60);return respondWithRpcPromise(_0xf059('0x4b'),_0xf059('0x1f'),{'module':_0xf059('0x55')});}})[_0xf059('0x16')](handleError(_0x26c014,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 1a4c8db..b9b6aa5 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1152=['moment','bluebird','request-promise','path','../../config/environment','exports','lodash','util','../../config/logger','api'];(function(_0x208aeb,_0x2efc85){var _0x19579e=function(_0x44d860){while(--_0x44d860){_0x208aeb['push'](_0x208aeb['shift']());}};_0x19579e(++_0x2efc85);}(_0x1152,0x182));var _0x2115=function(_0xa656ef,_0x3d31df){_0xa656ef=_0xa656ef-0x0;var _0x20e81=_0x1152[_0xa656ef];return _0x20e81;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require(_0x2115('0x8'));var attributes=require('./network.attributes');module[_0x2115('0x9')]=function(_0x241dcb,_0x51a3cf){return _0x241dcb['define']('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x4fff81,_0x255401){var _0x3c1f53=function(_0x5b925b){while(--_0x5b925b){_0x4fff81['push'](_0x4fff81['shift']());}};_0x3c1f53(++_0x255401);}(_0x99e9,0xb4));var _0x999e=function(_0x4f027d,_0x3f9587){_0x4f027d=_0x4f027d-0x0;var _0xc46890=_0x99e9[_0x4f027d];return _0xc46890;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 08fb200..061c4e2 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x19bcaf,_0x4d5b1a){var _0xde3a6b=function(_0x21c78e){while(--_0x21c78e){_0x19bcaf['push'](_0x19bcaf['shift']());}};_0xde3a6b(++_0x4d5b1a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x427dd4,_0x1223a6){_0x427dd4=_0x427dd4-0x0;var _0x2519f0=_0x7a54[_0x427dd4];return _0x2519f0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 31dc35e..fbfb8cb 100644 --- a/server/api/openchannelAccount/index.js +++ b/server/api/openchannelAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9da=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0xf9da,0x132));var _0xaf9d=function(_0x111a45,_0x2b9385){_0x111a45=_0x111a45-0x0;var _0x10e6cd=_0xf9da[_0x111a45];return _0x10e6cd;};'use strict';var multer=require(_0xaf9d('0x0'));var util=require(_0xaf9d('0x1'));var path=require('path');var timeout=require(_0xaf9d('0x2'));var express=require(_0xaf9d('0x3'));var router=express[_0xaf9d('0x4')]();var fs_extra=require(_0xaf9d('0x5'));var auth=require(_0xaf9d('0x6'));var interaction=require(_0xaf9d('0x7'));var config=require(_0xaf9d('0x8'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0xaf9d('0x9')](),controller[_0xaf9d('0xa')]);router[_0xaf9d('0xb')](_0xaf9d('0xc'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0xd')]);router[_0xaf9d('0xb')](_0xaf9d('0xe'),auth['isAuthenticated'](),controller[_0xaf9d('0xf')]);router[_0xaf9d('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xaf9d('0x10')]);router[_0xaf9d('0xb')](_0xaf9d('0x11'),auth[_0xaf9d('0x9')](),controller['getAnswers']);router[_0xaf9d('0xb')](_0xaf9d('0x12'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x13')]);router[_0xaf9d('0xb')](_0xaf9d('0x14'),auth['isAuthenticated'](),controller[_0xaf9d('0x15')]);router['get'](_0xaf9d('0x16'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x17')]);router['post']('/',auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x18')]);router[_0xaf9d('0x19')](_0xaf9d('0x1a'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xaf9d('0x19')](_0xaf9d('0x11'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x1b')]);router[_0xaf9d('0x19')](_0xaf9d('0x1c'),controller['notify']);router[_0xaf9d('0x19')](_0xaf9d('0x12'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x1d')]);router['post'](_0xaf9d('0x16'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x1e')]);router[_0xaf9d('0x19')](_0xaf9d('0x1f'),auth[_0xaf9d('0x9')](),controller['send']);router[_0xaf9d('0x20')](_0xaf9d('0xe'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x21')]);router[_0xaf9d('0x22')]('/:id',auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x23')]);router[_0xaf9d('0x22')](_0xaf9d('0x1a'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x24')]);router['delete'](_0xaf9d('0x11'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x25')]);router[_0xaf9d('0x22')](_0xaf9d('0x16'),auth[_0xaf9d('0x9')](),controller[_0xaf9d('0x26')]);module['exports']=router; \ No newline at end of file +var _0x71b2=['update','delete','removeDispositions','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','notify','/:id/applications','addApplications','addAgents','/:id/send','send','put','/:id'];(function(_0x55010e,_0x2f8ecd){var _0x4cef1e=function(_0x2f9870){while(--_0x2f9870){_0x55010e['push'](_0x55010e['shift']());}};_0x4cef1e(++_0x2f8ecd);}(_0x71b2,0x19c));var _0x271b=function(_0x1ad0d0,_0x3e4614){_0x1ad0d0=_0x1ad0d0-0x0;var _0xa5e9ae=_0x71b2[_0x1ad0d0];return _0xa5e9ae;};'use strict';var multer=require(_0x271b('0x0'));var util=require('util');var path=require(_0x271b('0x1'));var timeout=require('connect-timeout');var express=require(_0x271b('0x2'));var router=express[_0x271b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x271b('0x4'));var interaction=require(_0x271b('0x5'));var config=require(_0x271b('0x6'));var controller=require('./openchannelAccount.controller');router[_0x271b('0x7')]('/',auth[_0x271b('0x8')](),controller[_0x271b('0x9')]);router[_0x271b('0x7')](_0x271b('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x271b('0x7')]('/:id',auth[_0x271b('0x8')](),controller[_0x271b('0xb')]);router['get'](_0x271b('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x271b('0x7')]('/:id/canned_answers',auth[_0x271b('0x8')](),controller[_0x271b('0xd')]);router[_0x271b('0x7')]('/:id/applications',auth[_0x271b('0x8')](),controller[_0x271b('0xe')]);router[_0x271b('0x7')](_0x271b('0xf'),auth['isAuthenticated'](),controller[_0x271b('0x10')]);router['get'](_0x271b('0x11'),auth[_0x271b('0x8')](),controller[_0x271b('0x12')]);router[_0x271b('0x13')]('/',auth[_0x271b('0x8')](),controller[_0x271b('0x14')]);router[_0x271b('0x13')](_0x271b('0xc'),auth['isAuthenticated'](),controller[_0x271b('0x15')]);router[_0x271b('0x13')](_0x271b('0x16'),auth[_0x271b('0x8')](),controller[_0x271b('0x17')]);router[_0x271b('0x13')]('/:id/notify',controller[_0x271b('0x18')]);router[_0x271b('0x13')](_0x271b('0x19'),auth[_0x271b('0x8')](),controller[_0x271b('0x1a')]);router[_0x271b('0x13')](_0x271b('0x11'),auth[_0x271b('0x8')](),controller[_0x271b('0x1b')]);router[_0x271b('0x13')](_0x271b('0x1c'),auth[_0x271b('0x8')](),controller[_0x271b('0x1d')]);router[_0x271b('0x1e')](_0x271b('0x1f'),auth[_0x271b('0x8')](),controller[_0x271b('0x20')]);router[_0x271b('0x21')](_0x271b('0x1f'),auth[_0x271b('0x8')](),controller['destroy']);router['delete'](_0x271b('0xc'),auth['isAuthenticated'](),controller[_0x271b('0x22')]);router[_0x271b('0x21')]('/:id/canned_answers',auth[_0x271b('0x8')](),controller['removeAnswers']);router[_0x271b('0x21')](_0x271b('0x11'),auth['isAuthenticated'](),controller[_0x271b('0x23')]);module[_0x271b('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0219b5a..a6e61e0 100644 --- a/server/api/openchannelAccount/openchannelAccount.attributes.js +++ b/server/api/openchannelAccount/openchannelAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd13a=['randomstring','exports','STRING','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x73865a,_0x451e72){var _0x47767f=function(_0x56aa35){while(--_0x56aa35){_0x73865a['push'](_0x73865a['shift']());}};_0x47767f(++_0x451e72);}(_0xd13a,0x1af));var _0xad13=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd13a[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0xad13('0x0'));var rs=require(_0xad13('0x1'));module[_0xad13('0x2')]={'name':{'type':Sequelize[_0xad13('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xad13('0x3')]},'token':{'type':Sequelize[_0xad13('0x3')],'defaultValue':function(){return rs[_0xad13('0x4')]();}},'replyUri':{'type':Sequelize[_0xad13('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xad13('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xad13('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xad13('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xad13('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xad13('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xad13('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad13('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xad13('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xad13('0x5')],'defaultValue':![],'comment':_0xad13('0x8'),'set':function(_0x542ca0){if(!_0x542ca0)this[_0xad13('0x9')](_0xad13('0xa'),null);this['setDataValue'](_0xad13('0xb'),_0x542ca0);}}}; \ No newline at end of file +var _0xb836=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','randomstring','exports','name','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x3a3ab4,_0x1ca080){var _0x30e072=function(_0x20e058){while(--_0x20e058){_0x3a3ab4['push'](_0x3a3ab4['shift']());}};_0x30e072(++_0x1ca080);}(_0xb836,0x18f));var _0x6b83=function(_0x57436e,_0x23b94c){_0x57436e=_0x57436e-0x0;var _0x4c4e7f=_0xb836[_0x57436e];return _0x4c4e7f;};'use strict';var Sequelize=require(_0x6b83('0x0'));var rs=require(_0x6b83('0x1'));module[_0x6b83('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x6b83('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6b83('0x4')]},'token':{'type':Sequelize[_0x6b83('0x4')],'defaultValue':function(){return rs[_0x6b83('0x5')]();}},'replyUri':{'type':Sequelize[_0x6b83('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6b83('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6b83('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6b83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6b83('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6b83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6b83('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6b83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x6b83('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x6b83('0x7')],'defaultValue':![],'comment':_0x6b83('0xa'),'set':function(_0x39877d){if(!_0x39877d)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x39877d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7327567..28629c0 100644 --- a/server/api/openchannelAccount/openchannelAccount.controller.js +++ b/server/api/openchannelAccount/openchannelAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1e1=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','Contacts','OpenchannelApplication','Applications','account','applications','list','priority','asc','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','contact','messageId','interaction','created','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','filter','getInteractions','Contact','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','Messages','OpenchannelMessage','dataValues','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','OpenchannelAccounts','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','includeAll','findAll','catch','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','Disposition','getDispositions','findOne','order','sort','options','rows','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','map','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x3a0f9e,_0x105ca){var _0x5f27ee=function(_0x1826ac){while(--_0x1826ac){_0x3a0f9e['push'](_0x3a0f9e['shift']());}};_0x5f27ee(++_0x105ca);}(_0xf1e1,0x102));var _0x1f1e=function(_0x5ed5e4,_0x15d7fc){_0x5ed5e4=_0x5ed5e4-0x0;var _0xcc956a=_0xf1e1[_0x5ed5e4];return _0xcc956a;};'use strict';var emlformat=require(_0x1f1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f1e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f1e('0x2'));var moment=require('moment');var BPromise=require(_0x1f1e('0x3'));var Mustache=require(_0x1f1e('0x4'));var util=require(_0x1f1e('0x5'));var path=require(_0x1f1e('0x6'));var sox=require(_0x1f1e('0x7'));var csv=require(_0x1f1e('0x8'));var ejs=require(_0x1f1e('0x9'));var fs=require('fs');var fs_extra=require(_0x1f1e('0xa'));var _=require(_0x1f1e('0xb'));var squel=require(_0x1f1e('0xc'));var crypto=require(_0x1f1e('0xd'));var jsforce=require(_0x1f1e('0xe'));var deskjs=require(_0x1f1e('0xf'));var toCsv=require(_0x1f1e('0x8'));var querystring=require('querystring');var Papa=require(_0x1f1e('0x10'));var Redis=require(_0x1f1e('0x11'));var authService=require(_0x1f1e('0x12'));var qs=require(_0x1f1e('0x13'));var as=require(_0x1f1e('0x14'));var hardwareService=require(_0x1f1e('0x15'));var logger=require(_0x1f1e('0x16'))(_0x1f1e('0x17'));var utils=require(_0x1f1e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1f1e('0x19'));var db=require(_0x1f1e('0x1a'))['db'];config[_0x1f1e('0x1b')]=_[_0x1f1e('0x1c')](config[_0x1f1e('0x1b')],{'host':_0x1f1e('0x1d'),'port':0x18eb});var socket=require(_0x1f1e('0x1e'))(new Redis(config['redis']));require(_0x1f1e('0x1f'))[_0x1f1e('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1f1e('0x21')][_0x1f1e('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x1f1e('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x21da96,_0xe4cef0,_0x2b0a44,_0x47d1b9){return new BPromise(function(_0x3f978f,_0x2d122e){var _0x2e9227=_0x47d1b9||client;return _0x2e9227[_0x1f1e('0x23')](_0x21da96,_0x2b0a44)['then'](function(_0x4b876c){logger[_0x1f1e('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0xe4cef0,_0x1f1e('0x25'));logger[_0x1f1e('0x26')](_0x1f1e('0x27'),_0xe4cef0,'request\x20sent',JSON['stringify'](_0x4b876c));if(_0x4b876c['error']){if(_0x4b876c[_0x1f1e('0x28')][_0x1f1e('0x29')]===0x1f4){logger[_0x1f1e('0x28')](_0x1f1e('0x2a'),_0xe4cef0,_0x4b876c[_0x1f1e('0x28')][_0x1f1e('0x2b')]);return _0x2d122e(_0x4b876c[_0x1f1e('0x28')][_0x1f1e('0x2b')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xe4cef0,_0x4b876c['error'][_0x1f1e('0x2b')]);return _0x3f978f(_0x4b876c[_0x1f1e('0x28')][_0x1f1e('0x2b')]);}else{logger[_0x1f1e('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0xe4cef0,_0x1f1e('0x25'));_0x3f978f(_0x4b876c[_0x1f1e('0x2c')][_0x1f1e('0x2b')]);}})['catch'](function(_0x5b2394){logger[_0x1f1e('0x28')](_0x1f1e('0x2a'),_0xe4cef0,_0x5b2394);_0x2d122e(_0x5b2394);});});}function respondWithStatusCode(_0x430310,_0x5102e2){_0x5102e2=_0x5102e2||0xcc;return function(_0x2e76e5){if(_0x2e76e5){return _0x430310[_0x1f1e('0x2d')](_0x5102e2);}return _0x430310['status'](_0x5102e2)[_0x1f1e('0x2e')]();};}function respondWithResult(_0x518c2d,_0x46cc43){_0x46cc43=_0x46cc43||0xc8;return function(_0xe84434){if(_0xe84434){return _0x518c2d[_0x1f1e('0x2f')](_0x46cc43)[_0x1f1e('0x30')](_0xe84434);}};}function respondWithFilteredResult(_0xa2076c,_0x420e4b){return function(_0x52e414){if(_0x52e414){var _0x2b24a6=typeof _0x420e4b[_0x1f1e('0x31')]===_0x1f1e('0x32')&&typeof _0x420e4b[_0x1f1e('0x33')]===_0x1f1e('0x32');var _0x23729b=_0x52e414[_0x1f1e('0x34')];var _0x5b1610=_0x2b24a6?0x0:_0x420e4b[_0x1f1e('0x31')];var _0xfbc2f8=_0x2b24a6?_0x52e414[_0x1f1e('0x34')]:_0x420e4b[_0x1f1e('0x31')]+_0x420e4b[_0x1f1e('0x33')];var _0xee02ed;if(_0xfbc2f8>=_0x23729b){_0xfbc2f8=_0x23729b;_0xee02ed=0xc8;}else{_0xee02ed=0xce;}_0xa2076c[_0x1f1e('0x2f')](_0xee02ed);return _0xa2076c[_0x1f1e('0x35')]('Content-Range',_0x5b1610+'-'+_0xfbc2f8+'/'+_0x23729b)['json'](_0x52e414);}return null;};}function patchUpdates(_0x676066){return function(_0x5ba49d){try{jsonpatch['apply'](_0x5ba49d,_0x676066,!![]);}catch(_0x60848a){return BPromise[_0x1f1e('0x36')](_0x60848a);}return _0x5ba49d[_0x1f1e('0x37')]();};}function saveUpdates(_0x2decf4,_0x4043ce){return function(_0x3096ad){if(_0x3096ad){return _0x3096ad['update'](_0x2decf4)[_0x1f1e('0x38')](function(_0x361148){return _0x361148;});}return null;};}function removeEntity(_0x17af5a,_0x580587){return function(_0x1d4f49){if(_0x1d4f49){return _0x1d4f49[_0x1f1e('0x39')]()['then'](function(){var _0x5cdf2c=_0x1d4f49['get']({'plain':!![]});var _0x5a2503=_0x1f1e('0x3a');return db['UserProfileResource'][_0x1f1e('0x39')]({'where':{'type':_0x5a2503,'resourceId':_0x5cdf2c['id']}})[_0x1f1e('0x38')](function(){return _0x1d4f49;});})['then'](function(){_0x17af5a[_0x1f1e('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x301651,_0x4cb97b){return function(_0x1e0378){if(!_0x1e0378){_0x301651[_0x1f1e('0x2d')](0x194);}return _0x1e0378;};}function handleError(_0x311e50,_0x40dede){_0x40dede=_0x40dede||0x1f4;return function(_0x25e591){logger[_0x1f1e('0x28')](_0x25e591[_0x1f1e('0x3b')]);if(_0x25e591['name']){delete _0x25e591[_0x1f1e('0x3c')];}_0x311e50['status'](_0x40dede)[_0x1f1e('0x3d')](_0x25e591);};}exports['index']=function(_0x555876,_0x30fabd){var _0x5a531e={'include':[{'model':db[_0x1f1e('0x3e')],'as':_0x1f1e('0x3f')}]},_0x9aa814={},_0x55e62f={'count':0x0,'rows':[]};var _0x401c79=_['map'](db[_0x1f1e('0x40')][_0x1f1e('0x41')],function(_0x477ed0){return{'name':_0x477ed0[_0x1f1e('0x42')],'type':_0x477ed0[_0x1f1e('0x43')][_0x1f1e('0x44')]};});_0x9aa814['model']=_['map'](_0x401c79,_0x1f1e('0x3c'));_0x9aa814[_0x1f1e('0x45')]=_['keys'](_0x555876['query']);_0x9aa814[_0x1f1e('0x46')]=_['intersection'](_0x9aa814[_0x1f1e('0x47')],_0x9aa814[_0x1f1e('0x45')]);_0x5a531e[_0x1f1e('0x48')]=_[_0x1f1e('0x49')](_0x9aa814[_0x1f1e('0x47')],qs['fields'](_0x555876[_0x1f1e('0x45')][_0x1f1e('0x4a')]));_0x5a531e[_0x1f1e('0x48')]=_0x5a531e[_0x1f1e('0x48')][_0x1f1e('0x4b')]?_0x5a531e[_0x1f1e('0x48')]:_0x9aa814[_0x1f1e('0x47')];if(!_0x555876[_0x1f1e('0x45')][_0x1f1e('0x4c')](_0x1f1e('0x4d'))){_0x5a531e[_0x1f1e('0x33')]=qs[_0x1f1e('0x33')](_0x555876[_0x1f1e('0x45')][_0x1f1e('0x33')]);_0x5a531e[_0x1f1e('0x31')]=qs[_0x1f1e('0x31')](_0x555876[_0x1f1e('0x45')]['offset']);}_0x5a531e['order']=qs['sort'](_0x555876[_0x1f1e('0x45')]['sort']);_0x5a531e[_0x1f1e('0x4e')]=qs[_0x1f1e('0x46')](_[_0x1f1e('0x4f')](_0x555876[_0x1f1e('0x45')],_0x9aa814[_0x1f1e('0x46')]),_0x401c79);if(_0x555876['query']['filter']){_0x5a531e[_0x1f1e('0x4e')]=_[_0x1f1e('0x50')](_0x5a531e[_0x1f1e('0x4e')],{'$or':_['map'](_0x401c79,function(_0x1a9133){if(_0x1a9133['type']!==_0x1f1e('0x51')){var _0x207744={};_0x207744[_0x1a9133[_0x1f1e('0x3c')]]={'$like':'%'+_0x555876['query']['filter']+'%'};return _0x207744;}})});}_0x5a531e=_[_0x1f1e('0x50')]({},_0x5a531e,_0x555876['options']);var _0x33c145={'where':_0x5a531e[_0x1f1e('0x4e')]};return db[_0x1f1e('0x40')][_0x1f1e('0x34')](_0x33c145)[_0x1f1e('0x38')](function(_0x4d8cd8){_0x55e62f[_0x1f1e('0x34')]=_0x4d8cd8;if(_0x555876['query'][_0x1f1e('0x52')]){_0x5a531e['include']=[{'all':!![]}];}return db[_0x1f1e('0x40')][_0x1f1e('0x53')](_0x5a531e);})['then'](function(_0x3f4755){_0x55e62f['rows']=_0x3f4755;return _0x55e62f;})[_0x1f1e('0x38')](respondWithFilteredResult(_0x30fabd,_0x5a531e))[_0x1f1e('0x54')](handleError(_0x30fabd,null));};exports['show']=function(_0x3b2407,_0x581a5c){var _0x46e049={'raw':![],'where':{'id':_0x3b2407['params']['id']},'include':[{'model':db[_0x1f1e('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3294b9={};_0x3294b9['model']=_['keys'](db['OpenchannelAccount'][_0x1f1e('0x41')]);_0x3294b9[_0x1f1e('0x45')]=_[_0x1f1e('0x55')](_0x3b2407[_0x1f1e('0x45')]);_0x3294b9[_0x1f1e('0x46')]=_['intersection'](_0x3294b9[_0x1f1e('0x47')],_0x3294b9[_0x1f1e('0x45')]);_0x46e049[_0x1f1e('0x48')]=_[_0x1f1e('0x49')](_0x3294b9[_0x1f1e('0x47')],qs[_0x1f1e('0x4a')](_0x3b2407[_0x1f1e('0x45')][_0x1f1e('0x4a')]));_0x46e049[_0x1f1e('0x48')]=_0x46e049[_0x1f1e('0x48')][_0x1f1e('0x4b')]?_0x46e049[_0x1f1e('0x48')]:_0x3294b9[_0x1f1e('0x47')];if(_0x3b2407[_0x1f1e('0x45')]['includeAll']){_0x46e049[_0x1f1e('0x56')]=[{'all':!![]}];}_0x46e049=_['merge']({},_0x46e049,_0x3b2407['options']);return db[_0x1f1e('0x40')][_0x1f1e('0x57')](_0x46e049)['then'](handleEntityNotFound(_0x581a5c,null))[_0x1f1e('0x38')](respondWithResult(_0x581a5c,null))[_0x1f1e('0x54')](handleError(_0x581a5c,null));};exports[_0x1f1e('0x58')]=function(_0xa739af,_0x1b0e30){return db[_0x1f1e('0x40')][_0x1f1e('0x58')](_0xa739af[_0x1f1e('0x59')],{})[_0x1f1e('0x38')](function(_0x3e49de){var _0x4cc742=_0xa739af[_0x1f1e('0x5a')][_0x1f1e('0x5b')]({'plain':!![]});if(!_0x4cc742)throw new Error(_0x1f1e('0x5c'));if(_0x4cc742[_0x1f1e('0x5d')]===_0x1f1e('0x5a')){var _0x31fb98=_0x3e49de[_0x1f1e('0x5b')]({'plain':!![]});var _0x40a939=_0x1f1e('0x3a');return db[_0x1f1e('0x5e')][_0x1f1e('0x57')]({'where':{'name':_0x40a939,'userProfileId':_0x4cc742['userProfileId']},'raw':!![]})[_0x1f1e('0x38')](function(_0x4c3fdf){if(_0x4c3fdf&&_0x4c3fdf['autoAssociation']===0x0){return db[_0x1f1e('0x5f')][_0x1f1e('0x58')]({'name':_0x31fb98[_0x1f1e('0x3c')],'resourceId':_0x31fb98['id'],'type':_0x4c3fdf[_0x1f1e('0x3c')],'sectionId':_0x4c3fdf['id']},{})['then'](function(){return _0x3e49de;});}else{return _0x3e49de;}})[_0x1f1e('0x54')](function(_0x505401){logger[_0x1f1e('0x28')](_0x1f1e('0x60'),_0x505401);throw _0x505401;});}return _0x3e49de;})[_0x1f1e('0x38')](respondWithResult(_0x1b0e30,0xc9))[_0x1f1e('0x54')](handleError(_0x1b0e30,null));};exports[_0x1f1e('0x61')]=function(_0x286472,_0x4b4259){if(_0x286472['body']['id']){delete _0x286472[_0x1f1e('0x59')]['id'];}return db[_0x1f1e('0x40')][_0x1f1e('0x57')]({'where':{'id':_0x286472[_0x1f1e('0x62')]['id']},'include':[{'model':db[_0x1f1e('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x1f1e('0x38')](handleEntityNotFound(_0x4b4259,null))[_0x1f1e('0x38')](saveUpdates(_0x286472[_0x1f1e('0x59')],null))[_0x1f1e('0x38')](respondWithResult(_0x4b4259,null))[_0x1f1e('0x54')](handleError(_0x4b4259,null));};exports[_0x1f1e('0x39')]=function(_0x2c131e,_0x1bb64e){return db['OpenchannelAccount'][_0x1f1e('0x57')]({'where':{'id':_0x2c131e[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x1bb64e,null))[_0x1f1e('0x38')](removeEntity(_0x1bb64e,null))[_0x1f1e('0x54')](handleError(_0x1bb64e,null));};exports[_0x1f1e('0x63')]=function(_0x3175fe,_0x4e9466){return db[_0x1f1e('0x40')][_0x1f1e('0x63')]()[_0x1f1e('0x38')](respondWithResult(_0x4e9466,null))[_0x1f1e('0x54')](handleError(_0x4e9466,null));};exports[_0x1f1e('0x64')]=function(_0x1a45e1,_0x6af31,_0x4902b7){if(_0x1a45e1['body']['id']){delete _0x1a45e1[_0x1f1e('0x59')]['id'];}return db[_0x1f1e('0x40')]['find']({'where':{'id':_0x1a45e1['params']['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x6af31,null))[_0x1f1e('0x38')](function(_0x5bc77f){if(_0x5bc77f){_0x1a45e1[_0x1f1e('0x59')]['OpenchannelAccountId']=_0x5bc77f['id'];return db[_0x1f1e('0x65')]['create'](_0x1a45e1[_0x1f1e('0x59')]);}})[_0x1f1e('0x38')](respondWithResult(_0x6af31,null))[_0x1f1e('0x54')](handleError(_0x6af31,null));};exports[_0x1f1e('0x66')]=function(_0x334b19,_0x4af707,_0x36b16d){var _0x58d0e9={'raw':![],'where':{}};var _0x4db40f={};var _0x6eeb30={'count':0x0,'rows':[]};return db[_0x1f1e('0x40')][_0x1f1e('0x67')]({'where':{'id':_0x334b19['params']['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x4af707,null))[_0x1f1e('0x38')](function(_0x5a72d2){if(_0x5a72d2){_0x4db40f[_0x1f1e('0x47')]=_[_0x1f1e('0x55')](db[_0x1f1e('0x65')]['rawAttributes']);_0x4db40f[_0x1f1e('0x45')]=_['keys'](_0x334b19[_0x1f1e('0x45')]);_0x4db40f[_0x1f1e('0x46')]=_[_0x1f1e('0x49')](_0x4db40f[_0x1f1e('0x47')],_0x4db40f[_0x1f1e('0x45')]);_0x58d0e9[_0x1f1e('0x48')]=_[_0x1f1e('0x49')](_0x4db40f[_0x1f1e('0x47')],qs['fields'](_0x334b19['query'][_0x1f1e('0x4a')]));_0x58d0e9[_0x1f1e('0x48')]=_0x58d0e9[_0x1f1e('0x48')][_0x1f1e('0x4b')]?_0x58d0e9[_0x1f1e('0x48')]:_0x4db40f[_0x1f1e('0x47')];if(!_0x334b19[_0x1f1e('0x45')][_0x1f1e('0x4c')](_0x1f1e('0x4d'))){_0x58d0e9['limit']=qs['limit'](_0x334b19['query'][_0x1f1e('0x33')]);_0x58d0e9['offset']=qs[_0x1f1e('0x31')](_0x334b19[_0x1f1e('0x45')]['offset']);}_0x58d0e9[_0x1f1e('0x68')]=qs[_0x1f1e('0x69')](_0x334b19[_0x1f1e('0x45')][_0x1f1e('0x69')]);_0x58d0e9[_0x1f1e('0x4e')]=qs[_0x1f1e('0x46')](_[_0x1f1e('0x4f')](_0x334b19[_0x1f1e('0x45')],_0x4db40f['filters']));_0x58d0e9[_0x1f1e('0x4e')]['OpenchannelAccountId']=_0x5a72d2['id'];if(_0x334b19['query']['filter']){_0x58d0e9[_0x1f1e('0x4e')]=_[_0x1f1e('0x50')](_0x58d0e9[_0x1f1e('0x4e')],{'$or':_['map'](_0x58d0e9[_0x1f1e('0x48')],function(_0x12a7b8){var _0x29fc5f={};_0x29fc5f[_0x12a7b8]={'$like':'%'+_0x334b19[_0x1f1e('0x45')]['filter']+'%'};return _0x29fc5f;})});}_0x58d0e9=_[_0x1f1e('0x50')]({},_0x58d0e9,_0x334b19[_0x1f1e('0x6a')]);return db[_0x1f1e('0x65')][_0x1f1e('0x34')]({'where':_0x58d0e9[_0x1f1e('0x4e')]})[_0x1f1e('0x38')](function(_0x441dba){_0x6eeb30[_0x1f1e('0x34')]=_0x441dba;if(_0x334b19['query'][_0x1f1e('0x52')]){_0x58d0e9[_0x1f1e('0x56')]=[{'all':!![]}];}return db[_0x1f1e('0x65')][_0x1f1e('0x53')](_0x58d0e9);})[_0x1f1e('0x38')](function(_0x5a79c8){_0x6eeb30[_0x1f1e('0x6b')]=_0x5a79c8;return _0x6eeb30;});}})['then'](respondWithFilteredResult(_0x4af707,_0x58d0e9))['catch'](handleError(_0x4af707,null));};exports[_0x1f1e('0x6c')]=function(_0x37b74a,_0x49ce51,_0x405f86){return db[_0x1f1e('0x40')][_0x1f1e('0x57')]({'where':{'id':_0x37b74a[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x49ce51,null))[_0x1f1e('0x38')](function(_0x14eeb7){if(_0x14eeb7){return _0x14eeb7[_0x1f1e('0x6c')](_0x37b74a[_0x1f1e('0x45')][_0x1f1e('0x6d')]);}})['then'](respondWithStatusCode(_0x49ce51,null))[_0x1f1e('0x54')](handleError(_0x49ce51,null));};exports[_0x1f1e('0x6e')]=function(_0x7f6a43,_0x3d0770,_0x69b7f7){if(_0x7f6a43[_0x1f1e('0x59')]['id']){delete _0x7f6a43[_0x1f1e('0x59')]['id'];}return db[_0x1f1e('0x40')][_0x1f1e('0x57')]({'where':{'id':_0x7f6a43['params']['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x3d0770,null))[_0x1f1e('0x38')](function(_0xc1e965){if(_0xc1e965){_0x7f6a43[_0x1f1e('0x59')][_0x1f1e('0x6f')]=_0xc1e965['id'];return db[_0x1f1e('0x70')][_0x1f1e('0x58')](_0x7f6a43[_0x1f1e('0x59')]);}})[_0x1f1e('0x38')](respondWithResult(_0x3d0770,null))[_0x1f1e('0x54')](handleError(_0x3d0770,null));};exports[_0x1f1e('0x71')]=function(_0x23f217,_0x182895,_0x15dc79){var _0x915aa2={'raw':![],'where':{}};var _0x430c90={};var _0x59316a={'count':0x0,'rows':[]};return db[_0x1f1e('0x40')][_0x1f1e('0x67')]({'where':{'id':_0x23f217[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x182895,null))['then'](function(_0x2b3dd5){if(_0x2b3dd5){_0x430c90['model']=_['keys'](db[_0x1f1e('0x70')]['rawAttributes']);_0x430c90[_0x1f1e('0x45')]=_['keys'](_0x23f217['query']);_0x430c90['filters']=_[_0x1f1e('0x49')](_0x430c90[_0x1f1e('0x47')],_0x430c90['query']);_0x915aa2[_0x1f1e('0x48')]=_[_0x1f1e('0x49')](_0x430c90[_0x1f1e('0x47')],qs[_0x1f1e('0x4a')](_0x23f217[_0x1f1e('0x45')][_0x1f1e('0x4a')]));_0x915aa2[_0x1f1e('0x48')]=_0x915aa2[_0x1f1e('0x48')][_0x1f1e('0x4b')]?_0x915aa2['attributes']:_0x430c90[_0x1f1e('0x47')];if(!_0x23f217[_0x1f1e('0x45')][_0x1f1e('0x4c')](_0x1f1e('0x4d'))){_0x915aa2[_0x1f1e('0x33')]=qs[_0x1f1e('0x33')](_0x23f217[_0x1f1e('0x45')][_0x1f1e('0x33')]);_0x915aa2['offset']=qs[_0x1f1e('0x31')](_0x23f217[_0x1f1e('0x45')]['offset']);}_0x915aa2[_0x1f1e('0x68')]=qs['sort'](_0x23f217[_0x1f1e('0x45')][_0x1f1e('0x69')]);_0x915aa2[_0x1f1e('0x4e')]=qs[_0x1f1e('0x46')](_[_0x1f1e('0x4f')](_0x23f217[_0x1f1e('0x45')],_0x430c90['filters']));_0x915aa2[_0x1f1e('0x4e')][_0x1f1e('0x6f')]=_0x2b3dd5['id'];if(_0x23f217['query']['filter']){_0x915aa2['where']=_[_0x1f1e('0x50')](_0x915aa2['where'],{'$or':_[_0x1f1e('0x72')](_0x915aa2[_0x1f1e('0x48')],function(_0x287934){var _0xd27767={};_0xd27767[_0x287934]={'$like':'%'+_0x23f217['query']['filter']+'%'};return _0xd27767;})});}_0x915aa2=_['merge']({},_0x915aa2,_0x23f217[_0x1f1e('0x6a')]);return db[_0x1f1e('0x70')]['count']({'where':_0x915aa2[_0x1f1e('0x4e')]})['then'](function(_0x459572){_0x59316a[_0x1f1e('0x34')]=_0x459572;if(_0x23f217[_0x1f1e('0x45')][_0x1f1e('0x52')]){_0x915aa2['include']=[{'all':!![]}];}return db[_0x1f1e('0x70')][_0x1f1e('0x53')](_0x915aa2);})[_0x1f1e('0x38')](function(_0x2eeb14){_0x59316a[_0x1f1e('0x6b')]=_0x2eeb14;return _0x59316a;});}})[_0x1f1e('0x38')](respondWithFilteredResult(_0x182895,_0x915aa2))['catch'](handleError(_0x182895,null));};exports[_0x1f1e('0x73')]=function(_0x5e52c0,_0x16176d,_0x2fd00f){return db[_0x1f1e('0x40')][_0x1f1e('0x57')]({'where':{'id':_0x5e52c0[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x16176d,null))[_0x1f1e('0x38')](function(_0x2af30a){if(_0x2af30a){return _0x2af30a[_0x1f1e('0x73')](_0x5e52c0[_0x1f1e('0x45')][_0x1f1e('0x6d')]);}})['then'](respondWithStatusCode(_0x16176d,null))[_0x1f1e('0x54')](handleError(_0x16176d,null));};exports[_0x1f1e('0x74')]=function(_0x9b534d,_0x1d3285,_0xffd94a){var _0x5767c3={'body':_0x9b534d['body'],'channel':_0x1f1e('0x75')};var _0x237406=[];var _0x2b188e=[];var _0x39eee9={};var _0x1780ee=![];return db['CmContact']['describe']()[_0x1f1e('0x38')](function(_0x315604){if(!_0x315604){throw new db[(_0x1f1e('0x76'))][(_0x1f1e('0x77'))](_0x1f1e('0x78'));}_0x237406=_[_0x1f1e('0x79')](_[_0x1f1e('0x55')](_0x315604),[_0x1f1e('0x7a'),_0x1f1e('0x7b')]);_0x2b188e=_[_0x1f1e('0x79')](_[_0x1f1e('0x55')](_0x315604),[_0x1f1e('0x7a'),_0x1f1e('0x7b'),'CompanyId',_0x1f1e('0x7c')]);if(_0x9b534d[_0x1f1e('0x59')]['id']){delete _0x9b534d[_0x1f1e('0x59')]['id'];}if(_[_0x1f1e('0x7d')](_0x9b534d[_0x1f1e('0x59')]['from'])){throw new db[(_0x1f1e('0x76'))][(_0x1f1e('0x77'))]('from\x20is\x20mandatory');}if(_[_0x1f1e('0x7d')](_0x9b534d['body']['body'])||_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x59')]===''){throw new db[(_0x1f1e('0x76'))][(_0x1f1e('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1f1e('0x7d')](_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x7e')])){throw new db[(_0x1f1e('0x76'))][(_0x1f1e('0x77'))](_0x1f1e('0x7f')+_0x2b188e);}if(!_['includes'](_0x2b188e,_0x9b534d['body'][_0x1f1e('0x7e')])){throw new db[(_0x1f1e('0x76'))][(_0x1f1e('0x77'))](_0x1f1e('0x80')+_0x2b188e);}_0x39eee9[_0x9b534d[_0x1f1e('0x59')]['mapKey']]=_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x81')];})[_0x1f1e('0x38')](function(){return db[_0x1f1e('0x40')][_0x1f1e('0x57')]({'where':{'id':_0x9b534d[_0x1f1e('0x62')]['id']},'include':[{'model':db[_0x1f1e('0x82')],'as':_0x1f1e('0x83'),'include':[{'model':db[_0x1f1e('0x84')],'as':_0x1f1e('0x85'),'where':_0x39eee9,'limit':0x1,'order':[[_0x1f1e('0x7b'),'DESC']]}]},{'model':db[_0x1f1e('0x86')],'as':_0x1f1e('0x87')}]});})['then'](handleEntityNotFound(_0x1d3285,null))[_0x1f1e('0x38')](function(_0x154cdb){if(_0x154cdb&&_0x154cdb[_0x1f1e('0x83')]){_0x5767c3[_0x1f1e('0x88')]=_0x154cdb;_0x5767c3[_0x1f1e('0x89')]=_0x154cdb[_0x1f1e('0x87')];_0x5767c3[_0x1f1e('0x8a')]=_0x154cdb[_0x1f1e('0x83')];_0x5767c3[_0x1f1e('0x89')]=_['orderBy'](_0x5767c3[_0x1f1e('0x89')],[_0x1f1e('0x8b')],[_0x1f1e('0x8c')]);if(_0x5767c3['account'][_0x1f1e('0x87')]){delete _0x5767c3[_0x1f1e('0x88')][_0x1f1e('0x87')];}if(_0x5767c3[_0x1f1e('0x88')]['List']&&_0x5767c3[_0x1f1e('0x88')][_0x1f1e('0x83')][_0x1f1e('0x85')]['length']){return _0x5767c3[_0x1f1e('0x88')]['List'][_0x1f1e('0x85')][0x0];}var _0x229247=_['defaults'](_0x9b534d[_0x1f1e('0x59')],{'firstName':_0x9b534d['body'][_0x1f1e('0x81')],'ListId':_0x154cdb[_0x1f1e('0x7c')]});_0x229247[_0x9b534d['body'][_0x1f1e('0x7e')]]=_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x81')];return db[_0x1f1e('0x84')]['create'](_0x229247,{'fields':_0x237406,'raw':!![]});}})[_0x1f1e('0x38')](handleEntityNotFound(_0x1d3285,null))[_0x1f1e('0x38')](function(_0x419701){_0x5767c3['contact']=_0x419701;if(_0x419701){var _0x4d3e6b={'ContactId':_0x419701['id'],'OpenchannelAccountId':_0x9b534d[_0x1f1e('0x62')]['id'],'from':(_0x419701['firstName']||'')+'\x20'+(_0x419701[_0x1f1e('0x8d')]||'')};var _0xef2ea5={'OpenchannelAccountId':_0x9b534d['params']['id'],'closed':![]};if(_0x9b534d['body'][_0x1f1e('0x8e')]){_0xef2ea5[_0x1f1e('0x8e')]=_0x9b534d[_0x1f1e('0x59')]['threadId'];return db[_0x1f1e('0x8f')][_0x1f1e('0x57')]({'where':_0xef2ea5})[_0x1f1e('0x38')](function(_0x5f4a64){if(_0x5f4a64){return[_0x5f4a64,![]];}_0x4d3e6b[_0x1f1e('0x8e')]=_0x9b534d[_0x1f1e('0x59')]['threadId'];_0x4d3e6b[_0x1f1e('0x90')]=_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x90')];return db['OpenchannelInteraction'][_0x1f1e('0x58')](_0x4d3e6b)[_0x1f1e('0x38')](function(_0x9c9dfe){return[_0x9c9dfe,!![]];});});}else{_0xef2ea5[_0x1f1e('0x8e')]=null;}_0xef2ea5[_0x1f1e('0x91')]=_0x419701['id'];return db[_0x1f1e('0x8f')][_0x1f1e('0x57')]({'where':_0xef2ea5})['then'](function(_0x338ffb){if(_0x338ffb){return[_0x338ffb,![]];}return db[_0x1f1e('0x8f')]['create'](_0x4d3e6b)[_0x1f1e('0x38')](function(_0x22f306){return[_0x22f306,!![]];});});}})[_0x1f1e('0x92')](function(_0x1af6cb,_0x35213e){if(_0x1af6cb){_0x1780ee=_0x35213e;if(!_0x35213e){var _0x39620e={'from':(_0x5767c3['contact'][_0x1f1e('0x93')]||'')+'\x20'+(_0x5767c3[_0x1f1e('0x94')][_0x1f1e('0x8d')]||'')};if(_0x9b534d[_0x1f1e('0x59')]['threadId']&&_0x9b534d['body']['messageId']&&_0x9b534d[_0x1f1e('0x59')]['threadId']!=_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x95')]){_0x39620e[_0x1f1e('0x8e')]=_0x9b534d['body']['messageId'];}return _0x1af6cb['update'](_0x39620e);}else{return _0x1af6cb;}}})['then'](function(_0x13cb17){_0x5767c3[_0x1f1e('0x96')]=_0x13cb17[_0x1f1e('0x5b')]({'plain':!![]});_0x5767c3['interaction'][_0x1f1e('0x97')]=_0x1780ee;if(_0x5767c3[_0x1f1e('0x96')][_0x1f1e('0x97')]){if(_0x5767c3['account']['autoclose']){_0x5767c3['applications'][_0x1f1e('0x98')]({'id':0x0,'priority':_0x5767c3[_0x1f1e('0x89')][_0x1f1e('0x4b')]+0x1,'app':_0x1f1e('0x99'),'appdata':'unmanaged','interval':_0x1f1e('0x9a')});}}return db['OpenchannelMessage'][_0x1f1e('0x58')]({'body':_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x59')],'OpenchannelAccountId':_0x9b534d[_0x1f1e('0x62')]['id'],'OpenchannelInteractionId':_0x13cb17['id'],'direction':'in','ContactId':_0x5767c3[_0x1f1e('0x94')]['id'],'AttachmentId':_0x9b534d[_0x1f1e('0x59')][_0x1f1e('0x9b')]});})[_0x1f1e('0x38')](function(_0x41d010){_0x5767c3[_0x1f1e('0x2b')]=_0x41d010;if(_0x5767c3[_0x1f1e('0x96')][_0x1f1e('0x9c')]){return db[_0x1f1e('0x9d')][_0x1f1e('0x57')]({'attributes':['id','name'],'where':{'id':_0x5767c3['interaction'][_0x1f1e('0x9c')]}})[_0x1f1e('0x38')](function(_0x26ffeb){if(_0x26ffeb){_0x5767c3[_0x1f1e('0x89')][_0x1f1e('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x26ffeb[_0x1f1e('0x3c')]+','+(_0x5767c3[_0x1f1e('0x88')][_0x1f1e('0x9f')]||0xa),'interval':_0x1f1e('0x9a')});_0x5767c3[_0x1f1e('0xa0')]=![];}return respondWithRpcPromise('Start',_0x1f1e('0xa1'),_0x5767c3);});}return respondWithRpcPromise('Start',_0x1f1e('0xa1'),_0x5767c3);})[_0x1f1e('0x38')](function(_0x37b538){respondWithRpcPromise(_0x1f1e('0xa2'),_0x1f1e('0xa2'),{'event':_0x1f1e('0x74'),'message':_0x37b538},client9002);return _0x37b538;})['then'](respondWithResult(_0x1d3285,null))['catch'](handleError(_0x1d3285,null));};exports[_0x1f1e('0xa3')]=function(_0x1b7131,_0x45b3f5){var _0xccc18d=_0x1b7131[_0x1f1e('0x62')]['id'];var _0x1450a8=_0x1b7131[_0x1f1e('0x59')];var _0x4f8000=0xc8;var _0x237b22=null;return db[_0x1f1e('0xa4')][_0x1f1e('0xa5')]({'isolationLevel':db[_0x1f1e('0xa4')][_0x1f1e('0xa6')][_0x1f1e('0xa7')][_0x1f1e('0xa8')]},function(_0x5e1f7f){return db[_0x1f1e('0x40')][_0x1f1e('0x67')]({'where':{'id':_0xccc18d},'transaction':_0x5e1f7f})['then'](function(_0x4b256c){if(_0x4b256c){return db[_0x1f1e('0x86')]['destroy']({'where':{'OpenchannelAccountId':_0xccc18d},'transaction':_0x5e1f7f})[_0x1f1e('0x38')](function(){var _0x3d7f83=_[_0x1f1e('0x72')](_0x1450a8,function(_0x271e86){_0x271e86['OpenchannelAccountId']=_0xccc18d;return _0x271e86;});return db[_0x1f1e('0x86')][_0x1f1e('0xa9')](_0x3d7f83,{'transaction':_0x5e1f7f});});}else{_0x4f8000=0x194;_0x237b22=[];}});})['then'](function(){if(_0x4f8000!==0x194){return db[_0x1f1e('0x86')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0xccc18d},'order':'priority'})[_0x1f1e('0x38')](function(_0x4cffe2){_0x237b22=_0x4cffe2;});}})[_0x1f1e('0x54')](function(_0x445a8b){_0x4f8000=0x1f4;logger[_0x1f1e('0x28')](_0x445a8b['stack']);if(_0x445a8b[_0x1f1e('0x3c')]){delete _0x445a8b['name'];}_0x237b22=_0x445a8b;})[_0x1f1e('0xaa')](function(){if(_0x237b22===null){_0x45b3f5[_0x1f1e('0x2d')](_0x4f8000);}else{if(_0x4f8000===0x1f4){_0x45b3f5[_0x1f1e('0x2f')](_0x4f8000)[_0x1f1e('0x3d')](_0x237b22);}else{_0x45b3f5['status'](_0x4f8000)['json'](_0x237b22);}}});};exports[_0x1f1e('0xab')]=function(_0x3dfec0,_0x249ee2,_0x1f8607){var _0x52e2c7={};var _0x49a8a2={};var _0x5ce4d3;var _0x4740d2;return db[_0x1f1e('0x40')][_0x1f1e('0x67')]({'where':{'id':_0x3dfec0[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x249ee2,null))[_0x1f1e('0x38')](function(_0x1a29a3){if(_0x1a29a3){_0x5ce4d3=_0x1a29a3;_0x49a8a2[_0x1f1e('0x47')]=_['keys'](db[_0x1f1e('0x86')][_0x1f1e('0x41')]);_0x49a8a2[_0x1f1e('0x45')]=_[_0x1f1e('0x55')](_0x3dfec0['query']);_0x49a8a2[_0x1f1e('0x46')]=_[_0x1f1e('0x49')](_0x49a8a2[_0x1f1e('0x47')],_0x49a8a2['query']);_0x52e2c7['attributes']=_['intersection'](_0x49a8a2[_0x1f1e('0x47')],qs[_0x1f1e('0x4a')](_0x3dfec0[_0x1f1e('0x45')]['fields']));_0x52e2c7[_0x1f1e('0x48')]=_0x52e2c7[_0x1f1e('0x48')][_0x1f1e('0x4b')]?_0x52e2c7[_0x1f1e('0x48')]:_0x49a8a2[_0x1f1e('0x47')];_0x52e2c7['order']=qs['sort'](_0x3dfec0[_0x1f1e('0x45')]['sort']);_0x52e2c7[_0x1f1e('0x4e')]=qs[_0x1f1e('0x46')](_[_0x1f1e('0x4f')](_0x3dfec0[_0x1f1e('0x45')],_0x49a8a2[_0x1f1e('0x46')]));if(_0x3dfec0[_0x1f1e('0x45')][_0x1f1e('0xac')]){_0x52e2c7['where']=_['merge'](_0x52e2c7[_0x1f1e('0x4e')],{'$or':_[_0x1f1e('0x72')](_0x52e2c7[_0x1f1e('0x48')],function(_0x375ee5){var _0x272029={};_0x272029[_0x375ee5]={'$like':'%'+_0x3dfec0[_0x1f1e('0x45')]['filter']+'%'};return _0x272029;})});}_0x52e2c7=_[_0x1f1e('0x50')]({},_0x52e2c7,_0x3dfec0[_0x1f1e('0x6a')]);return _0x5ce4d3['getApplications'](_0x52e2c7);}})[_0x1f1e('0x38')](function(_0x99571){if(_0x99571){_0x4740d2=_0x99571[_0x1f1e('0x4b')];if(!_0x3dfec0[_0x1f1e('0x45')]['hasOwnProperty'](_0x1f1e('0x4d'))){_0x52e2c7[_0x1f1e('0x33')]=qs[_0x1f1e('0x33')](_0x3dfec0[_0x1f1e('0x45')][_0x1f1e('0x33')]);_0x52e2c7[_0x1f1e('0x31')]=qs[_0x1f1e('0x31')](_0x3dfec0[_0x1f1e('0x45')][_0x1f1e('0x31')]);}return _0x5ce4d3['getApplications'](_0x52e2c7);}})[_0x1f1e('0x38')](function(_0x36e2aa){if(_0x36e2aa){return _0x36e2aa?{'count':_0x4740d2,'rows':_0x36e2aa}:null;}})['then'](respondWithResult(_0x249ee2,null))['catch'](handleError(_0x249ee2,null));};exports[_0x1f1e('0xad')]=function(_0x3c6d5a,_0x4592be,_0x293078){var _0x3995d8={'raw':![],'where':{}};var _0xb86cd3={};var _0x42e349={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1f1e('0x67')]({'where':{'id':_0x3c6d5a[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x4592be,null))[_0x1f1e('0x38')](function(_0x5b8a39){if(_0x5b8a39){_0xb86cd3['model']=_[_0x1f1e('0x55')](db[_0x1f1e('0x8f')][_0x1f1e('0x41')]);_0xb86cd3[_0x1f1e('0x45')]=_[_0x1f1e('0x55')](_0x3c6d5a['query']);_0xb86cd3[_0x1f1e('0x46')]=_[_0x1f1e('0x49')](_0xb86cd3[_0x1f1e('0x47')],_0xb86cd3[_0x1f1e('0x45')]);_0x3995d8[_0x1f1e('0x48')]=_[_0x1f1e('0x49')](_0xb86cd3['model'],qs[_0x1f1e('0x4a')](_0x3c6d5a[_0x1f1e('0x45')][_0x1f1e('0x4a')]));_0x3995d8[_0x1f1e('0x48')]=_0x3995d8['attributes'][_0x1f1e('0x4b')]?_0x3995d8[_0x1f1e('0x48')]:_0xb86cd3[_0x1f1e('0x47')];if(!_0x3c6d5a[_0x1f1e('0x45')]['hasOwnProperty']('nolimit')){_0x3995d8[_0x1f1e('0x33')]=qs[_0x1f1e('0x33')](_0x3c6d5a[_0x1f1e('0x45')][_0x1f1e('0x33')]);_0x3995d8[_0x1f1e('0x31')]=qs[_0x1f1e('0x31')](_0x3c6d5a['query'][_0x1f1e('0x31')]);}_0x3995d8[_0x1f1e('0x68')]=qs[_0x1f1e('0x69')](_0x3c6d5a['query']['sort']);_0x3995d8[_0x1f1e('0x4e')]=qs[_0x1f1e('0x46')](_[_0x1f1e('0x4f')](_0x3c6d5a[_0x1f1e('0x45')],_0xb86cd3['filters']));_0x3995d8[_0x1f1e('0x4e')][_0x1f1e('0x6f')]=_0x5b8a39['id'];if(_0x3c6d5a[_0x1f1e('0x45')][_0x1f1e('0xac')]){_0x3995d8['where']=_[_0x1f1e('0x50')](_0x3995d8[_0x1f1e('0x4e')],{'$or':_[_0x1f1e('0x72')](_0x3995d8[_0x1f1e('0x48')],function(_0x179197){var _0x44995a={};_0x44995a[_0x179197]={'$like':'%'+_0x3c6d5a[_0x1f1e('0x45')]['filter']+'%'};return _0x44995a;})});}_0x3995d8=_['merge']({},_0x3995d8,_0x3c6d5a[_0x1f1e('0x6a')]);return db['OpenchannelInteraction'][_0x1f1e('0x34')]({'where':_0x3995d8[_0x1f1e('0x4e')]})[_0x1f1e('0x38')](function(_0x8fbc8f){_0x42e349[_0x1f1e('0x34')]=_0x8fbc8f;if(_0x3c6d5a[_0x1f1e('0x45')]['includeAll']){_0x3995d8['include']=[{'model':db[_0x1f1e('0x84')],'as':_0x1f1e('0xae'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x1f1e('0x3c'),'fullname',_0x1f1e('0xaf')],'required':![]},{'model':db[_0x1f1e('0xb0')],'as':_0x1f1e('0xb1'),'attributes':['id',_0x1f1e('0x3c'),_0x1f1e('0xb2')],'where':_0x3c6d5a[_0x1f1e('0x45')][_0x1f1e('0xb3')]?{'id':_0x3c6d5a[_0x1f1e('0x45')][_0x1f1e('0xb3')]}:undefined,'required':_0x3c6d5a['query'][_0x1f1e('0xb3')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x1f1e('0x53')](_0x3995d8);})['then'](function(_0x5d60d3){_0x42e349['rows']=_0x5d60d3;return _0x42e349;});}})['then'](respondWithFilteredResult(_0x4592be,_0x3995d8))[_0x1f1e('0x54')](handleError(_0x4592be,null));};exports[_0x1f1e('0xb4')]=function(_0x48ffb0,_0x3fb3ba,_0x23b237){return db[_0x1f1e('0x40')]['find']({'where':{'id':_0x48ffb0[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x3fb3ba,null))[_0x1f1e('0x38')](function(_0x136fd3){if(_0x136fd3){return _0x136fd3['addAgents'](_0x48ffb0[_0x1f1e('0x59')]['ids'],_['omit'](_0x48ffb0[_0x1f1e('0x59')],[_0x1f1e('0x6d'),'id'])||{})[_0x1f1e('0x92')](function(_0x571510){for(var _0x46c443=0x0;_0x46c443<_0x48ffb0[_0x1f1e('0x59')][_0x1f1e('0x6d')][_0x1f1e('0x4b')];_0x46c443+=0x1){socket[_0x1f1e('0xb5')](_0x1f1e('0xb6'),{'UserId':Number(_0x48ffb0[_0x1f1e('0x59')][_0x1f1e('0x6d')][_0x46c443]),'OpenchannelAccountId':Number(_0x48ffb0[_0x1f1e('0x62')]['id'])});}return _0x571510;});}})[_0x1f1e('0x38')](respondWithResult(_0x3fb3ba,null))[_0x1f1e('0x54')](handleError(_0x3fb3ba,null));};exports[_0x1f1e('0xb7')]=function(_0x37f34c,_0xb6a5cf,_0x40e8a0){return db[_0x1f1e('0x40')][_0x1f1e('0x57')]({'where':{'id':_0x37f34c[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0xb6a5cf,null))[_0x1f1e('0x38')](function(_0x173757){if(_0x173757){return _0x173757[_0x1f1e('0xb7')](_0x37f34c['query'][_0x1f1e('0x6d')])[_0x1f1e('0x38')](function(){if(_[_0x1f1e('0xb8')](_0x37f34c['query'][_0x1f1e('0x6d')])){for(var _0x30b428=0x0;_0x30b428<_0x37f34c['query'][_0x1f1e('0x6d')]['length'];_0x30b428+=0x1){socket[_0x1f1e('0xb5')](_0x1f1e('0xb9'),{'UserId':Number(_0x37f34c['query'][_0x1f1e('0x6d')][_0x30b428]),'OpenchannelAccountId':Number(_0x37f34c[_0x1f1e('0x62')]['id'])});}}else{socket['emit'](_0x1f1e('0xb9'),{'UserId':Number(_0x37f34c[_0x1f1e('0x45')]['ids']),'OpenchannelAccountId':Number(_0x37f34c[_0x1f1e('0x62')]['id'])});}});}})[_0x1f1e('0x38')](respondWithStatusCode(_0xb6a5cf,null))[_0x1f1e('0x54')](handleError(_0xb6a5cf,null));};exports['getAgents']=function(_0x396227,_0x55dea6,_0x4b7547){var _0x1bcc86={};var _0x4f8ae3={};var _0x52d822;var _0x34a127;return db[_0x1f1e('0x40')][_0x1f1e('0x67')]({'where':{'id':_0x396227[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x55dea6,null))['then'](function(_0x20dabc){if(_0x20dabc){_0x52d822=_0x20dabc;_0x4f8ae3['model']=_[_0x1f1e('0x55')](db[_0x1f1e('0x9d')][_0x1f1e('0x41')]);_0x4f8ae3['query']=_[_0x1f1e('0x55')](_0x396227[_0x1f1e('0x45')]);_0x4f8ae3[_0x1f1e('0x46')]=_[_0x1f1e('0x49')](_0x4f8ae3['model'],_0x4f8ae3[_0x1f1e('0x45')]);_0x1bcc86[_0x1f1e('0x48')]=_[_0x1f1e('0x49')](_0x4f8ae3['model'],qs['fields'](_0x396227[_0x1f1e('0x45')][_0x1f1e('0x4a')]));_0x1bcc86['attributes']=_0x1bcc86[_0x1f1e('0x48')][_0x1f1e('0x4b')]?_0x1bcc86[_0x1f1e('0x48')]:_0x4f8ae3[_0x1f1e('0x47')];_0x1bcc86['order']=qs[_0x1f1e('0x69')](_0x396227[_0x1f1e('0x45')]['sort']);_0x1bcc86[_0x1f1e('0x4e')]=qs['filters'](_[_0x1f1e('0x4f')](_0x396227['query'],_0x4f8ae3[_0x1f1e('0x46')]));if(_0x396227['query'][_0x1f1e('0xac')]){_0x1bcc86[_0x1f1e('0x4e')]=_[_0x1f1e('0x50')](_0x1bcc86[_0x1f1e('0x4e')],{'$or':_[_0x1f1e('0x72')](_0x1bcc86['attributes'],function(_0x490f60){var _0x5e8249={};_0x5e8249[_0x490f60]={'$like':'%'+_0x396227[_0x1f1e('0x45')][_0x1f1e('0xac')]+'%'};return _0x5e8249;})});}_0x1bcc86=_[_0x1f1e('0x50')]({},_0x1bcc86,_0x396227[_0x1f1e('0x6a')]);return _0x52d822[_0x1f1e('0xba')](_0x1bcc86);}})[_0x1f1e('0x38')](function(_0x412b1f){if(_0x412b1f){_0x34a127=_0x412b1f[_0x1f1e('0x4b')];if(!_0x396227[_0x1f1e('0x45')][_0x1f1e('0x4c')]('nolimit')){_0x1bcc86[_0x1f1e('0x33')]=qs[_0x1f1e('0x33')](_0x396227['query'][_0x1f1e('0x33')]);_0x1bcc86[_0x1f1e('0x31')]=qs[_0x1f1e('0x31')](_0x396227[_0x1f1e('0x45')][_0x1f1e('0x31')]);}return _0x52d822['getAgents'](_0x1bcc86);}})[_0x1f1e('0x38')](function(_0x39cc07){if(_0x39cc07){return _0x39cc07?{'count':_0x34a127,'rows':_0x39cc07}:null;}})['then'](respondWithResult(_0x55dea6,null))[_0x1f1e('0x54')](handleError(_0x55dea6,null));};exports[_0x1f1e('0x3d')]=function(_0x168d95,_0x5bca08,_0x41279d){var _0x583dbf,_0x3b6292,_0x325be1;if(_[_0x1f1e('0x7d')](_0x168d95[_0x1f1e('0x59')][_0x1f1e('0x59')])||_0x168d95[_0x1f1e('0x59')][_0x1f1e('0x59')]===''){throw new db[(_0x1f1e('0x76'))][(_0x1f1e('0x77'))](_0x1f1e('0xbb'));}if(_[_0x1f1e('0x7d')](_0x168d95[_0x1f1e('0x59')]['to'])){}_0x583dbf=_0x168d95[_0x1f1e('0x59')]['to'];return db['OpenchannelAccount'][_0x1f1e('0x67')]({'where':{'id':_0x168d95[_0x1f1e('0x62')]['id']}})[_0x1f1e('0x38')](handleEntityNotFound(_0x5bca08,null))[_0x1f1e('0x38')](function(_0x107f9e){if(_0x107f9e){return db[_0x1f1e('0x40')]['find']({'where':{'id':_0x107f9e['id']},'include':[{'model':db[_0x1f1e('0x82')],'as':'List','include':[{'model':db[_0x1f1e('0x84')],'as':_0x1f1e('0x85'),'where':{[_0x107f9e[_0x1f1e('0x7e')]]:_0x583dbf},'limit':0x1,'order':[[_0x1f1e('0x7b'),_0x1f1e('0xbc')]]}]}]})[_0x1f1e('0x38')](handleEntityNotFound(_0x5bca08,null))['then'](function(_0x1e73cb){if(_0x1e73cb&&_0x1e73cb[_0x1f1e('0x83')]){_0x3b6292=_0x1e73cb[_0x1f1e('0x5b')]({'plain':!![]});if(_0x3b6292['List']&&_0x3b6292[_0x1f1e('0x83')]['Contacts'][_0x1f1e('0x4b')]){return _0x3b6292['List']['Contacts'][0x0];}return db['CmContact'][_0x1f1e('0x58')](_[_0x1f1e('0x1c')](_0x168d95[_0x1f1e('0x59')],{'firstName':_0x583dbf,[_0x1e73cb[_0x1f1e('0x7e')]]:_0x583dbf,'phone':_0x583dbf,'ListId':_0x3b6292['ListId']}));}})[_0x1f1e('0x38')](handleEntityNotFound(_0x5bca08,null))[_0x1f1e('0x38')](function(_0x27db7b){if(_0x27db7b){_0x325be1=_0x27db7b;return db[_0x1f1e('0x8f')]['find']({'where':{'ContactId':_0x325be1['id'],'closed':![],'OpenchannelAccountId':_0x3b6292['id']}})['then'](function(_0x34c684){if(_0x34c684){return[_0x34c684,![]];}return db[_0x1f1e('0x8f')][_0x1f1e('0x58')]({'UserId':_0x168d95[_0x1f1e('0x5a')]['id'],'ContactId':_0x325be1['id'],'OpenchannelAccountId':_0x3b6292['id'],'lastMsgDirection':'out','firstMsgDirection':_0x1f1e('0xbd'),'Messages':[_[_0x1f1e('0x50')](_0x168d95[_0x1f1e('0x59')],{'read':![],'body':_0x168d95[_0x1f1e('0x59')][_0x1f1e('0x59')],'OpenchannelAccountId':_0x3b6292['id'],'UserId':_0x168d95[_0x1f1e('0x5a')]['id'],'ContactId':_0x325be1['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x1f1e('0xbe')}]})['then'](function(_0x17ec71){return[_0x17ec71,!![]];});});}})[_0x1f1e('0x92')](function(_0x2ff294,_0x3ade76){if(_0x3ade76){return _0x2ff294;}return db[_0x1f1e('0xbf')]['create'](_[_0x1f1e('0x50')](_0x168d95[_0x1f1e('0x59')],{'read':![],'body':_0x168d95[_0x1f1e('0x59')][_0x1f1e('0x59')],'OpenchannelAccountId':_0x3b6292['id'],'OpenchannelInteractionId':_0x2ff294['id'],'UserId':_0x168d95[_0x1f1e('0x5a')]['id'],'ContactId':_0x325be1['id']}))[_0x1f1e('0x38')](function(_0x1a2867){_0x2ff294['dataValues'][_0x1f1e('0xbe')]=[];_0x2ff294['dataValues']['Messages'][_0x1f1e('0x98')](_0x1a2867[_0x1f1e('0xc0')]);return _0x2ff294;});});}})[_0x1f1e('0x38')](respondWithResult(_0x5bca08,null))['catch'](handleError(_0x5bca08,null));}; \ No newline at end of file +var _0xaa3f=['error','OpenchannelAccount,\x20%s,\x20%s','message','info','request\x20sent','catch','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','no\x20available\x20attributes','difference','updatedAt','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','includes','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','orderBy','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','internal','Tags','tag','addAgents','ids','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x23ac58,_0x2fda98){var _0x109a1d=function(_0x522b90){while(--_0x522b90){_0x23ac58['push'](_0x23ac58['shift']());}};_0x109a1d(++_0x2fda98);}(_0xaa3f,0x95));var _0xfaa3=function(_0x4599d7,_0x3fa5d1){_0x4599d7=_0x4599d7-0x0;var _0x5c89d3=_0xaa3f[_0x4599d7];return _0x5c89d3;};'use strict';var emlformat=require(_0xfaa3('0x0'));var rimraf=require(_0xfaa3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfaa3('0x2'));var rp=require(_0xfaa3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfaa3('0x4'));var util=require(_0xfaa3('0x5'));var path=require('path');var sox=require(_0xfaa3('0x6'));var csv=require('to-csv');var ejs=require(_0xfaa3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfaa3('0x8'));var squel=require(_0xfaa3('0x9'));var crypto=require(_0xfaa3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfaa3('0xb'));var querystring=require(_0xfaa3('0xc'));var Papa=require(_0xfaa3('0xd'));var Redis=require('ioredis');var authService=require(_0xfaa3('0xe'));var qs=require(_0xfaa3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfaa3('0x10'));var logger=require(_0xfaa3('0x11'))(_0xfaa3('0x12'));var utils=require('../../config/utils');var config=require(_0xfaa3('0x13'));var licenseUtil=require(_0xfaa3('0x14'));var db=require(_0xfaa3('0x15'))['db'];config[_0xfaa3('0x16')]=_['defaults'](config[_0xfaa3('0x16')],{'host':_0xfaa3('0x17'),'port':0x18eb});var socket=require(_0xfaa3('0x18'))(new Redis(config[_0xfaa3('0x16')]));require(_0xfaa3('0x19'))[_0xfaa3('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfaa3('0x1b')][_0xfaa3('0x1c')]({'port':0x232c});var client9002=jayson[_0xfaa3('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2d4e,_0xdcb52,_0x4e1a44,_0x466c08){return new BPromise(function(_0x5856c1,_0x5d0552){var _0x549302=_0x466c08||client;return _0x549302[_0xfaa3('0x1d')](_0x3c2d4e,_0x4e1a44)[_0xfaa3('0x1e')](function(_0xd732ce){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xdcb52,'request\x20sent');logger['debug'](_0xfaa3('0x1f'),_0xdcb52,'request\x20sent',JSON[_0xfaa3('0x20')](_0xd732ce));if(_0xd732ce['error']){if(_0xd732ce['error']['code']===0x1f4){logger[_0xfaa3('0x21')](_0xfaa3('0x22'),_0xdcb52,_0xd732ce[_0xfaa3('0x21')][_0xfaa3('0x23')]);return _0x5d0552(_0xd732ce[_0xfaa3('0x21')][_0xfaa3('0x23')]);}logger['error'](_0xfaa3('0x22'),_0xdcb52,_0xd732ce[_0xfaa3('0x21')][_0xfaa3('0x23')]);return _0x5856c1(_0xd732ce[_0xfaa3('0x21')][_0xfaa3('0x23')]);}else{logger[_0xfaa3('0x24')](_0xfaa3('0x22'),_0xdcb52,_0xfaa3('0x25'));_0x5856c1(_0xd732ce['result'][_0xfaa3('0x23')]);}})[_0xfaa3('0x26')](function(_0x5000ec){logger['error'](_0xfaa3('0x22'),_0xdcb52,_0x5000ec);_0x5d0552(_0x5000ec);});});}function respondWithStatusCode(_0x5beef7,_0xdba825){_0xdba825=_0xdba825||0xcc;return function(_0x500126){if(_0x500126){return _0x5beef7[_0xfaa3('0x27')](_0xdba825);}return _0x5beef7[_0xfaa3('0x28')](_0xdba825)[_0xfaa3('0x29')]();};}function respondWithResult(_0x468d72,_0x255eda){_0x255eda=_0x255eda||0xc8;return function(_0x2fb407){if(_0x2fb407){return _0x468d72[_0xfaa3('0x28')](_0x255eda)['json'](_0x2fb407);}};}function respondWithFilteredResult(_0x3f9cf2,_0x3cf2be){return function(_0xf65fe0){if(_0xf65fe0){var _0x315783=typeof _0x3cf2be['offset']==='undefined'&&typeof _0x3cf2be[_0xfaa3('0x2a')]===_0xfaa3('0x2b');var _0x2ccb53=_0xf65fe0[_0xfaa3('0x2c')];var _0x591b3a=_0x315783?0x0:_0x3cf2be[_0xfaa3('0x2d')];var _0xeaefe5=_0x315783?_0xf65fe0[_0xfaa3('0x2c')]:_0x3cf2be['offset']+_0x3cf2be[_0xfaa3('0x2a')];var _0x13dc00;if(_0xeaefe5>=_0x2ccb53){_0xeaefe5=_0x2ccb53;_0x13dc00=0xc8;}else{_0x13dc00=0xce;}_0x3f9cf2[_0xfaa3('0x28')](_0x13dc00);return _0x3f9cf2[_0xfaa3('0x2e')]('Content-Range',_0x591b3a+'-'+_0xeaefe5+'/'+_0x2ccb53)[_0xfaa3('0x2f')](_0xf65fe0);}return null;};}function patchUpdates(_0xd7aab8){return function(_0x58fc2d){try{jsonpatch[_0xfaa3('0x30')](_0x58fc2d,_0xd7aab8,!![]);}catch(_0x15f5bd){return BPromise[_0xfaa3('0x31')](_0x15f5bd);}return _0x58fc2d[_0xfaa3('0x32')]();};}function saveUpdates(_0x2d51c7,_0x1e8ab6){return function(_0x285dcb){if(_0x285dcb){return _0x285dcb['update'](_0x2d51c7)[_0xfaa3('0x1e')](function(_0x471745){return _0x471745;});}return null;};}function removeEntity(_0x561685,_0x21a496){return function(_0x2829b6){if(_0x2829b6){return _0x2829b6[_0xfaa3('0x33')]()['then'](function(){var _0x2d9547=_0x2829b6[_0xfaa3('0x34')]({'plain':!![]});var _0x575688='OpenchannelAccounts';return db[_0xfaa3('0x35')][_0xfaa3('0x33')]({'where':{'type':_0x575688,'resourceId':_0x2d9547['id']}})[_0xfaa3('0x1e')](function(){return _0x2829b6;});})[_0xfaa3('0x1e')](function(){_0x561685[_0xfaa3('0x28')](0xcc)[_0xfaa3('0x29')]();});}};}function handleEntityNotFound(_0x5734f8,_0x56461f){return function(_0x5c107c){if(!_0x5c107c){_0x5734f8[_0xfaa3('0x27')](0x194);}return _0x5c107c;};}function handleError(_0x2fd99c,_0x5ae36e){_0x5ae36e=_0x5ae36e||0x1f4;return function(_0x3c93c0){logger[_0xfaa3('0x21')](_0x3c93c0[_0xfaa3('0x36')]);if(_0x3c93c0[_0xfaa3('0x37')]){delete _0x3c93c0[_0xfaa3('0x37')];}_0x2fd99c[_0xfaa3('0x28')](_0x5ae36e)[_0xfaa3('0x38')](_0x3c93c0);};}exports[_0xfaa3('0x39')]=function(_0x212c6a,_0x1ebd0e){var _0xb3e3d0={'include':[{'model':db[_0xfaa3('0x3a')],'as':_0xfaa3('0x3b')}]},_0x1cf80c={},_0x45f01f={'count':0x0,'rows':[]};var _0x5126b3=_['map'](db[_0xfaa3('0x3c')][_0xfaa3('0x3d')],function(_0x27cb98){return{'name':_0x27cb98[_0xfaa3('0x3e')],'type':_0x27cb98['type'][_0xfaa3('0x3f')]};});_0x1cf80c[_0xfaa3('0x40')]=_[_0xfaa3('0x41')](_0x5126b3,_0xfaa3('0x37'));_0x1cf80c[_0xfaa3('0x42')]=_[_0xfaa3('0x43')](_0x212c6a[_0xfaa3('0x42')]);_0x1cf80c[_0xfaa3('0x44')]=_[_0xfaa3('0x45')](_0x1cf80c[_0xfaa3('0x40')],_0x1cf80c[_0xfaa3('0x42')]);_0xb3e3d0[_0xfaa3('0x46')]=_[_0xfaa3('0x45')](_0x1cf80c[_0xfaa3('0x40')],qs['fields'](_0x212c6a[_0xfaa3('0x42')][_0xfaa3('0x47')]));_0xb3e3d0[_0xfaa3('0x46')]=_0xb3e3d0[_0xfaa3('0x46')][_0xfaa3('0x48')]?_0xb3e3d0[_0xfaa3('0x46')]:_0x1cf80c[_0xfaa3('0x40')];if(!_0x212c6a[_0xfaa3('0x42')][_0xfaa3('0x49')](_0xfaa3('0x4a'))){_0xb3e3d0['limit']=qs['limit'](_0x212c6a['query'][_0xfaa3('0x2a')]);_0xb3e3d0['offset']=qs[_0xfaa3('0x2d')](_0x212c6a[_0xfaa3('0x42')][_0xfaa3('0x2d')]);}_0xb3e3d0[_0xfaa3('0x4b')]=qs[_0xfaa3('0x4c')](_0x212c6a[_0xfaa3('0x42')][_0xfaa3('0x4c')]);_0xb3e3d0['where']=qs[_0xfaa3('0x44')](_[_0xfaa3('0x4d')](_0x212c6a['query'],_0x1cf80c[_0xfaa3('0x44')]),_0x5126b3);if(_0x212c6a['query'][_0xfaa3('0x4e')]){_0xb3e3d0[_0xfaa3('0x4f')]=_[_0xfaa3('0x50')](_0xb3e3d0[_0xfaa3('0x4f')],{'$or':_[_0xfaa3('0x41')](_0x5126b3,function(_0x59276e){if(_0x59276e[_0xfaa3('0x51')]!==_0xfaa3('0x52')){var _0x4723b0={};_0x4723b0[_0x59276e[_0xfaa3('0x37')]]={'$like':'%'+_0x212c6a[_0xfaa3('0x42')][_0xfaa3('0x4e')]+'%'};return _0x4723b0;}})});}_0xb3e3d0=_['merge']({},_0xb3e3d0,_0x212c6a['options']);var _0x5e5d89={'where':_0xb3e3d0[_0xfaa3('0x4f')]};return db[_0xfaa3('0x3c')][_0xfaa3('0x2c')](_0x5e5d89)[_0xfaa3('0x1e')](function(_0x132557){_0x45f01f[_0xfaa3('0x2c')]=_0x132557;if(_0x212c6a[_0xfaa3('0x42')][_0xfaa3('0x53')]){_0xb3e3d0[_0xfaa3('0x54')]=[{'all':!![]}];}return db[_0xfaa3('0x3c')][_0xfaa3('0x55')](_0xb3e3d0);})[_0xfaa3('0x1e')](function(_0x17c686){_0x45f01f[_0xfaa3('0x56')]=_0x17c686;return _0x45f01f;})['then'](respondWithFilteredResult(_0x1ebd0e,_0xb3e3d0))['catch'](handleError(_0x1ebd0e,null));};exports[_0xfaa3('0x57')]=function(_0x1253cd,_0x150f5f){var _0x25fe21={'raw':![],'where':{'id':_0x1253cd[_0xfaa3('0x58')]['id']},'include':[{'model':db[_0xfaa3('0x3a')],'as':_0xfaa3('0x3b')}]},_0x5641ed={};_0x5641ed['model']=_['keys'](db['OpenchannelAccount']['rawAttributes']);_0x5641ed[_0xfaa3('0x42')]=_[_0xfaa3('0x43')](_0x1253cd[_0xfaa3('0x42')]);_0x5641ed['filters']=_['intersection'](_0x5641ed[_0xfaa3('0x40')],_0x5641ed[_0xfaa3('0x42')]);_0x25fe21[_0xfaa3('0x46')]=_[_0xfaa3('0x45')](_0x5641ed[_0xfaa3('0x40')],qs[_0xfaa3('0x47')](_0x1253cd[_0xfaa3('0x42')]['fields']));_0x25fe21[_0xfaa3('0x46')]=_0x25fe21[_0xfaa3('0x46')][_0xfaa3('0x48')]?_0x25fe21[_0xfaa3('0x46')]:_0x5641ed['model'];if(_0x1253cd[_0xfaa3('0x42')][_0xfaa3('0x53')]){_0x25fe21[_0xfaa3('0x54')]=[{'all':!![]}];}_0x25fe21=_[_0xfaa3('0x50')]({},_0x25fe21,_0x1253cd[_0xfaa3('0x59')]);return db['OpenchannelAccount'][_0xfaa3('0x5a')](_0x25fe21)[_0xfaa3('0x1e')](handleEntityNotFound(_0x150f5f,null))[_0xfaa3('0x1e')](respondWithResult(_0x150f5f,null))[_0xfaa3('0x26')](handleError(_0x150f5f,null));};exports[_0xfaa3('0x5b')]=function(_0x38d99e,_0x3cf7ab){return db[_0xfaa3('0x3c')][_0xfaa3('0x5b')](_0x38d99e[_0xfaa3('0x5c')],{})[_0xfaa3('0x1e')](function(_0x516335){var _0x15303e=_0x38d99e[_0xfaa3('0x5d')][_0xfaa3('0x34')]({'plain':!![]});if(!_0x15303e)throw new Error(_0xfaa3('0x5e'));if(_0x15303e[_0xfaa3('0x5f')]===_0xfaa3('0x5d')){var _0x3e3a93=_0x516335['get']({'plain':!![]});var _0x284cfd='OpenchannelAccounts';return db[_0xfaa3('0x60')][_0xfaa3('0x5a')]({'where':{'name':_0x284cfd,'userProfileId':_0x15303e[_0xfaa3('0x61')]},'raw':!![]})[_0xfaa3('0x1e')](function(_0x6f72c4){if(_0x6f72c4&&_0x6f72c4[_0xfaa3('0x62')]===0x0){return db[_0xfaa3('0x35')][_0xfaa3('0x5b')]({'name':_0x3e3a93[_0xfaa3('0x37')],'resourceId':_0x3e3a93['id'],'type':_0x6f72c4[_0xfaa3('0x37')],'sectionId':_0x6f72c4['id']},{})[_0xfaa3('0x1e')](function(){return _0x516335;});}else{return _0x516335;}})[_0xfaa3('0x26')](function(_0x34e091){logger['error'](_0xfaa3('0x63'),_0x34e091);throw _0x34e091;});}return _0x516335;})[_0xfaa3('0x1e')](respondWithResult(_0x3cf7ab,0xc9))['catch'](handleError(_0x3cf7ab,null));};exports[_0xfaa3('0x64')]=function(_0x4192c0,_0x33819e){if(_0x4192c0['body']['id']){delete _0x4192c0[_0xfaa3('0x5c')]['id'];}return db[_0xfaa3('0x3c')][_0xfaa3('0x5a')]({'where':{'id':_0x4192c0[_0xfaa3('0x58')]['id']},'include':[{'model':db[_0xfaa3('0x3a')],'as':_0xfaa3('0x3b')}]})[_0xfaa3('0x1e')](handleEntityNotFound(_0x33819e,null))['then'](saveUpdates(_0x4192c0[_0xfaa3('0x5c')],null))[_0xfaa3('0x1e')](respondWithResult(_0x33819e,null))[_0xfaa3('0x26')](handleError(_0x33819e,null));};exports['destroy']=function(_0x1c7fa3,_0x2fb068){return db[_0xfaa3('0x3c')][_0xfaa3('0x5a')]({'where':{'id':_0x1c7fa3['params']['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x2fb068,null))['then'](removeEntity(_0x2fb068,null))[_0xfaa3('0x26')](handleError(_0x2fb068,null));};exports[_0xfaa3('0x65')]=function(_0x342620,_0x565063){return db[_0xfaa3('0x3c')]['describe']()[_0xfaa3('0x1e')](respondWithResult(_0x565063,null))[_0xfaa3('0x26')](handleError(_0x565063,null));};exports['addDisposition']=function(_0x5da38f,_0x272927,_0x9be91c){if(_0x5da38f[_0xfaa3('0x5c')]['id']){delete _0x5da38f[_0xfaa3('0x5c')]['id'];}return db[_0xfaa3('0x3c')][_0xfaa3('0x5a')]({'where':{'id':_0x5da38f['params']['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x272927,null))[_0xfaa3('0x1e')](function(_0x437a0e){if(_0x437a0e){_0x5da38f['body']['OpenchannelAccountId']=_0x437a0e['id'];return db[_0xfaa3('0x66')][_0xfaa3('0x5b')](_0x5da38f[_0xfaa3('0x5c')]);}})['then'](respondWithResult(_0x272927,null))[_0xfaa3('0x26')](handleError(_0x272927,null));};exports[_0xfaa3('0x67')]=function(_0x397c16,_0x2952f7,_0x1732c6){var _0x422e49={'raw':![],'where':{}};var _0x2e4904={};var _0xc7aa46={'count':0x0,'rows':[]};return db[_0xfaa3('0x3c')][_0xfaa3('0x68')]({'where':{'id':_0x397c16['params']['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x2952f7,null))[_0xfaa3('0x1e')](function(_0x23cc41){if(_0x23cc41){_0x2e4904['model']=_[_0xfaa3('0x43')](db[_0xfaa3('0x66')][_0xfaa3('0x3d')]);_0x2e4904[_0xfaa3('0x42')]=_['keys'](_0x397c16['query']);_0x2e4904[_0xfaa3('0x44')]=_[_0xfaa3('0x45')](_0x2e4904[_0xfaa3('0x40')],_0x2e4904[_0xfaa3('0x42')]);_0x422e49[_0xfaa3('0x46')]=_[_0xfaa3('0x45')](_0x2e4904[_0xfaa3('0x40')],qs['fields'](_0x397c16['query'][_0xfaa3('0x47')]));_0x422e49['attributes']=_0x422e49[_0xfaa3('0x46')][_0xfaa3('0x48')]?_0x422e49['attributes']:_0x2e4904[_0xfaa3('0x40')];if(!_0x397c16[_0xfaa3('0x42')][_0xfaa3('0x49')](_0xfaa3('0x4a'))){_0x422e49[_0xfaa3('0x2a')]=qs[_0xfaa3('0x2a')](_0x397c16[_0xfaa3('0x42')][_0xfaa3('0x2a')]);_0x422e49[_0xfaa3('0x2d')]=qs[_0xfaa3('0x2d')](_0x397c16['query'][_0xfaa3('0x2d')]);}_0x422e49[_0xfaa3('0x4b')]=qs[_0xfaa3('0x4c')](_0x397c16[_0xfaa3('0x42')][_0xfaa3('0x4c')]);_0x422e49[_0xfaa3('0x4f')]=qs[_0xfaa3('0x44')](_['pick'](_0x397c16[_0xfaa3('0x42')],_0x2e4904[_0xfaa3('0x44')]));_0x422e49[_0xfaa3('0x4f')][_0xfaa3('0x69')]=_0x23cc41['id'];if(_0x397c16['query'][_0xfaa3('0x4e')]){_0x422e49[_0xfaa3('0x4f')]=_[_0xfaa3('0x50')](_0x422e49[_0xfaa3('0x4f')],{'$or':_['map'](_0x422e49[_0xfaa3('0x46')],function(_0x3fa50e){var _0x3ccaa9={};_0x3ccaa9[_0x3fa50e]={'$like':'%'+_0x397c16['query']['filter']+'%'};return _0x3ccaa9;})});}_0x422e49=_[_0xfaa3('0x50')]({},_0x422e49,_0x397c16[_0xfaa3('0x59')]);return db[_0xfaa3('0x66')][_0xfaa3('0x2c')]({'where':_0x422e49[_0xfaa3('0x4f')]})[_0xfaa3('0x1e')](function(_0x73ab0c){_0xc7aa46['count']=_0x73ab0c;if(_0x397c16[_0xfaa3('0x42')][_0xfaa3('0x53')]){_0x422e49[_0xfaa3('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xfaa3('0x55')](_0x422e49);})[_0xfaa3('0x1e')](function(_0x11a400){_0xc7aa46[_0xfaa3('0x56')]=_0x11a400;return _0xc7aa46;});}})[_0xfaa3('0x1e')](respondWithFilteredResult(_0x2952f7,_0x422e49))[_0xfaa3('0x26')](handleError(_0x2952f7,null));};exports['removeDispositions']=function(_0x4a7535,_0x142833,_0x27e556){return db[_0xfaa3('0x3c')][_0xfaa3('0x5a')]({'where':{'id':_0x4a7535['params']['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x142833,null))[_0xfaa3('0x1e')](function(_0x3539d4){if(_0x3539d4){return _0x3539d4['removeDispositions'](_0x4a7535[_0xfaa3('0x42')]['ids']);}})[_0xfaa3('0x1e')](respondWithStatusCode(_0x142833,null))[_0xfaa3('0x26')](handleError(_0x142833,null));};exports[_0xfaa3('0x6a')]=function(_0x35ce08,_0x378870,_0x36d43a){if(_0x35ce08[_0xfaa3('0x5c')]['id']){delete _0x35ce08[_0xfaa3('0x5c')]['id'];}return db[_0xfaa3('0x3c')]['find']({'where':{'id':_0x35ce08[_0xfaa3('0x58')]['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x378870,null))[_0xfaa3('0x1e')](function(_0x238998){if(_0x238998){_0x35ce08[_0xfaa3('0x5c')][_0xfaa3('0x69')]=_0x238998['id'];return db[_0xfaa3('0x6b')][_0xfaa3('0x5b')](_0x35ce08[_0xfaa3('0x5c')]);}})[_0xfaa3('0x1e')](respondWithResult(_0x378870,null))['catch'](handleError(_0x378870,null));};exports[_0xfaa3('0x6c')]=function(_0x31e660,_0x1673a4,_0x13b9a1){var _0xba6c88={'raw':![],'where':{}};var _0x17a3a9={};var _0x51e183={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xfaa3('0x68')]({'where':{'id':_0x31e660[_0xfaa3('0x58')]['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x1673a4,null))['then'](function(_0x12c749){if(_0x12c749){_0x17a3a9['model']=_[_0xfaa3('0x43')](db['CannedAnswer'][_0xfaa3('0x3d')]);_0x17a3a9['query']=_[_0xfaa3('0x43')](_0x31e660[_0xfaa3('0x42')]);_0x17a3a9[_0xfaa3('0x44')]=_[_0xfaa3('0x45')](_0x17a3a9[_0xfaa3('0x40')],_0x17a3a9['query']);_0xba6c88[_0xfaa3('0x46')]=_[_0xfaa3('0x45')](_0x17a3a9[_0xfaa3('0x40')],qs[_0xfaa3('0x47')](_0x31e660['query'][_0xfaa3('0x47')]));_0xba6c88['attributes']=_0xba6c88[_0xfaa3('0x46')]['length']?_0xba6c88[_0xfaa3('0x46')]:_0x17a3a9['model'];if(!_0x31e660['query'][_0xfaa3('0x49')]('nolimit')){_0xba6c88['limit']=qs[_0xfaa3('0x2a')](_0x31e660[_0xfaa3('0x42')][_0xfaa3('0x2a')]);_0xba6c88['offset']=qs[_0xfaa3('0x2d')](_0x31e660[_0xfaa3('0x42')][_0xfaa3('0x2d')]);}_0xba6c88[_0xfaa3('0x4b')]=qs['sort'](_0x31e660[_0xfaa3('0x42')][_0xfaa3('0x4c')]);_0xba6c88[_0xfaa3('0x4f')]=qs['filters'](_[_0xfaa3('0x4d')](_0x31e660[_0xfaa3('0x42')],_0x17a3a9['filters']));_0xba6c88[_0xfaa3('0x4f')][_0xfaa3('0x69')]=_0x12c749['id'];if(_0x31e660[_0xfaa3('0x42')][_0xfaa3('0x4e')]){_0xba6c88[_0xfaa3('0x4f')]=_[_0xfaa3('0x50')](_0xba6c88[_0xfaa3('0x4f')],{'$or':_['map'](_0xba6c88[_0xfaa3('0x46')],function(_0x204f0a){var _0x5d30b0={};_0x5d30b0[_0x204f0a]={'$like':'%'+_0x31e660[_0xfaa3('0x42')][_0xfaa3('0x4e')]+'%'};return _0x5d30b0;})});}_0xba6c88=_[_0xfaa3('0x50')]({},_0xba6c88,_0x31e660[_0xfaa3('0x59')]);return db[_0xfaa3('0x6b')][_0xfaa3('0x2c')]({'where':_0xba6c88[_0xfaa3('0x4f')]})[_0xfaa3('0x1e')](function(_0x5bc41a){_0x51e183['count']=_0x5bc41a;if(_0x31e660[_0xfaa3('0x42')]['includeAll']){_0xba6c88[_0xfaa3('0x54')]=[{'all':!![]}];}return db[_0xfaa3('0x6b')][_0xfaa3('0x55')](_0xba6c88);})[_0xfaa3('0x1e')](function(_0x5c3db8){_0x51e183['rows']=_0x5c3db8;return _0x51e183;});}})[_0xfaa3('0x1e')](respondWithFilteredResult(_0x1673a4,_0xba6c88))[_0xfaa3('0x26')](handleError(_0x1673a4,null));};exports[_0xfaa3('0x6d')]=function(_0x55d6f0,_0x1f65e5,_0x3b5989){return db[_0xfaa3('0x3c')][_0xfaa3('0x5a')]({'where':{'id':_0x55d6f0[_0xfaa3('0x58')]['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x1f65e5,null))[_0xfaa3('0x1e')](function(_0x45f1c2){if(_0x45f1c2){return _0x45f1c2[_0xfaa3('0x6d')](_0x55d6f0[_0xfaa3('0x42')]['ids']);}})[_0xfaa3('0x1e')](respondWithStatusCode(_0x1f65e5,null))['catch'](handleError(_0x1f65e5,null));};exports[_0xfaa3('0x6e')]=function(_0x17c4dc,_0x1cbfcb,_0x4fc698){var _0x266671={'body':_0x17c4dc[_0xfaa3('0x5c')],'channel':'openchannel'};var _0x2a0f7f=[];var _0x3d4735=[];var _0x1f8127={};var _0x22e879=![];return db[_0xfaa3('0x6f')][_0xfaa3('0x65')]()['then'](function(_0x42a929){if(!_0x42a929){throw new db['Sequelize']['ValidationError'](_0xfaa3('0x70'));}_0x2a0f7f=_[_0xfaa3('0x71')](_[_0xfaa3('0x43')](_0x42a929),['createdAt',_0xfaa3('0x72')]);_0x3d4735=_[_0xfaa3('0x71')](_[_0xfaa3('0x43')](_0x42a929),['createdAt',_0xfaa3('0x72'),'CompanyId',_0xfaa3('0x73')]);if(_0x17c4dc[_0xfaa3('0x5c')]['id']){delete _0x17c4dc[_0xfaa3('0x5c')]['id'];}if(_[_0xfaa3('0x74')](_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x75')])){throw new db['Sequelize'][(_0xfaa3('0x76'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x17c4dc['body'][_0xfaa3('0x5c')])||_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x5c')]===''){throw new db['Sequelize'][(_0xfaa3('0x76'))](_0xfaa3('0x77'));}if(_[_0xfaa3('0x74')](_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x78')])){throw new db[(_0xfaa3('0x79'))][(_0xfaa3('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d4735);}if(!_[_0xfaa3('0x7a')](_0x3d4735,_0x17c4dc['body'][_0xfaa3('0x78')])){throw new db['Sequelize'][(_0xfaa3('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d4735);}_0x1f8127[_0x17c4dc['body'][_0xfaa3('0x78')]]=_0x17c4dc['body'][_0xfaa3('0x75')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x17c4dc[_0xfaa3('0x58')]['id']},'include':[{'model':db[_0xfaa3('0x7b')],'as':_0xfaa3('0x7c'),'include':[{'model':db[_0xfaa3('0x6f')],'as':_0xfaa3('0x7d'),'where':_0x1f8127,'limit':0x1,'order':[[_0xfaa3('0x72'),'DESC']]}]},{'model':db[_0xfaa3('0x7e')],'as':_0xfaa3('0x7f')}]});})[_0xfaa3('0x1e')](handleEntityNotFound(_0x1cbfcb,null))[_0xfaa3('0x1e')](function(_0x4776ff){if(_0x4776ff&&_0x4776ff[_0xfaa3('0x7c')]){_0x266671[_0xfaa3('0x80')]=_0x4776ff;_0x266671[_0xfaa3('0x81')]=_0x4776ff[_0xfaa3('0x7f')];_0x266671['list']=_0x4776ff[_0xfaa3('0x7c')];_0x266671[_0xfaa3('0x81')]=_[_0xfaa3('0x82')](_0x266671[_0xfaa3('0x81')],['priority'],[_0xfaa3('0x83')]);if(_0x266671[_0xfaa3('0x80')][_0xfaa3('0x7f')]){delete _0x266671[_0xfaa3('0x80')][_0xfaa3('0x7f')];}if(_0x266671[_0xfaa3('0x80')][_0xfaa3('0x7c')]&&_0x266671[_0xfaa3('0x80')][_0xfaa3('0x7c')]['Contacts']['length']){return _0x266671[_0xfaa3('0x80')][_0xfaa3('0x7c')]['Contacts'][0x0];}var _0x2d31fb=_[_0xfaa3('0x84')](_0x17c4dc[_0xfaa3('0x5c')],{'firstName':_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x75')],'ListId':_0x4776ff[_0xfaa3('0x73')]});_0x2d31fb[_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x78')]]=_0x17c4dc['body']['from'];return db[_0xfaa3('0x6f')][_0xfaa3('0x5b')](_0x2d31fb,{'fields':_0x2a0f7f,'raw':!![]});}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x1cbfcb,null))['then'](function(_0x101bc7){_0x266671[_0xfaa3('0x85')]=_0x101bc7;if(_0x101bc7){var _0x36c38f={'ContactId':_0x101bc7['id'],'OpenchannelAccountId':_0x17c4dc[_0xfaa3('0x58')]['id'],'from':(_0x101bc7[_0xfaa3('0x86')]||'')+'\x20'+(_0x101bc7[_0xfaa3('0x87')]||'')};var _0x3dc0c6={'OpenchannelAccountId':_0x17c4dc[_0xfaa3('0x58')]['id'],'closed':![]};if(_0x17c4dc['body'][_0xfaa3('0x88')]){_0x3dc0c6[_0xfaa3('0x88')]=_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x88')];return db[_0xfaa3('0x89')][_0xfaa3('0x5a')]({'where':_0x3dc0c6})[_0xfaa3('0x1e')](function(_0x1ec193){if(_0x1ec193){return[_0x1ec193,![]];}_0x36c38f[_0xfaa3('0x88')]=_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x88')];_0x36c38f['externalUrl']=_0x17c4dc[_0xfaa3('0x5c')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0x36c38f)['then'](function(_0x33d0b8){return[_0x33d0b8,!![]];});});}else{_0x3dc0c6['threadId']=null;}_0x3dc0c6['ContactId']=_0x101bc7['id'];return db[_0xfaa3('0x89')]['find']({'where':_0x3dc0c6})[_0xfaa3('0x1e')](function(_0x2d85e9){if(_0x2d85e9){return[_0x2d85e9,![]];}return db[_0xfaa3('0x89')][_0xfaa3('0x5b')](_0x36c38f)[_0xfaa3('0x1e')](function(_0x19899f){return[_0x19899f,!![]];});});}})[_0xfaa3('0x8a')](function(_0x130ab8,_0x2205b6){if(_0x130ab8){_0x22e879=_0x2205b6;if(!_0x2205b6){var _0x4a699c={'from':(_0x266671['contact'][_0xfaa3('0x86')]||'')+'\x20'+(_0x266671[_0xfaa3('0x85')]['lastName']||'')};if(_0x17c4dc[_0xfaa3('0x5c')]['threadId']&&_0x17c4dc['body']['messageId']&&_0x17c4dc['body'][_0xfaa3('0x88')]!=_0x17c4dc['body']['messageId']){_0x4a699c[_0xfaa3('0x88')]=_0x17c4dc[_0xfaa3('0x5c')]['messageId'];}return _0x130ab8[_0xfaa3('0x64')](_0x4a699c);}else{return _0x130ab8;}}})[_0xfaa3('0x1e')](function(_0x152501){_0x266671[_0xfaa3('0x8b')]=_0x152501['get']({'plain':!![]});_0x266671['interaction'][_0xfaa3('0x8c')]=_0x22e879;if(_0x266671['interaction']['created']){if(_0x266671['account'][_0xfaa3('0x8d')]){_0x266671['applications'][_0xfaa3('0x8e')]({'id':0x0,'priority':_0x266671[_0xfaa3('0x81')][_0xfaa3('0x48')]+0x1,'app':_0xfaa3('0x8f'),'appdata':'unmanaged','interval':_0xfaa3('0x90')});}}return db['OpenchannelMessage'][_0xfaa3('0x5b')]({'body':_0x17c4dc[_0xfaa3('0x5c')]['body'],'OpenchannelAccountId':_0x17c4dc['params']['id'],'OpenchannelInteractionId':_0x152501['id'],'direction':'in','ContactId':_0x266671[_0xfaa3('0x85')]['id'],'AttachmentId':_0x17c4dc[_0xfaa3('0x5c')][_0xfaa3('0x91')]});})[_0xfaa3('0x1e')](function(_0x3be31d){_0x266671['message']=_0x3be31d;if(_0x266671[_0xfaa3('0x8b')][_0xfaa3('0x92')]){return db[_0xfaa3('0x93')]['find']({'attributes':['id',_0xfaa3('0x37')],'where':{'id':_0x266671['interaction'][_0xfaa3('0x92')]}})[_0xfaa3('0x1e')](function(_0x49b379){if(_0x49b379){_0x266671[_0xfaa3('0x81')][_0xfaa3('0x94')]({'id':0x0,'priority':0x0,'app':_0xfaa3('0x95'),'appdata':_0x49b379[_0xfaa3('0x37')]+','+(_0x266671[_0xfaa3('0x80')][_0xfaa3('0x96')]||0xa),'interval':_0xfaa3('0x90')});_0x266671[_0xfaa3('0x97')]=![];}return respondWithRpcPromise(_0xfaa3('0x98'),'startRouting',_0x266671);});}return respondWithRpcPromise(_0xfaa3('0x98'),_0xfaa3('0x99'),_0x266671);})['then'](function(_0xd3470b){respondWithRpcPromise(_0xfaa3('0x9a'),_0xfaa3('0x9a'),{'event':_0xfaa3('0x6e'),'message':_0xd3470b},client9002);return _0xd3470b;})[_0xfaa3('0x1e')](respondWithResult(_0x1cbfcb,null))[_0xfaa3('0x26')](handleError(_0x1cbfcb,null));};exports[_0xfaa3('0x9b')]=function(_0x25944c,_0xcbf4f5){var _0x395bf3=_0x25944c[_0xfaa3('0x58')]['id'];var _0x149941=_0x25944c[_0xfaa3('0x5c')];var _0x4fe300=0xc8;var _0x1eea0b=null;return db[_0xfaa3('0x9c')]['transaction']({'isolationLevel':db[_0xfaa3('0x9c')][_0xfaa3('0x9d')][_0xfaa3('0x9e')][_0xfaa3('0x9f')]},function(_0x10ae07){return db[_0xfaa3('0x3c')][_0xfaa3('0x68')]({'where':{'id':_0x395bf3},'transaction':_0x10ae07})[_0xfaa3('0x1e')](function(_0x3d74c9){if(_0x3d74c9){return db['OpenchannelApplication'][_0xfaa3('0x33')]({'where':{'OpenchannelAccountId':_0x395bf3},'transaction':_0x10ae07})[_0xfaa3('0x1e')](function(){var _0x1c140c=_[_0xfaa3('0x41')](_0x149941,function(_0x116bdb){_0x116bdb[_0xfaa3('0x69')]=_0x395bf3;return _0x116bdb;});return db[_0xfaa3('0x7e')][_0xfaa3('0xa0')](_0x1c140c,{'transaction':_0x10ae07});});}else{_0x4fe300=0x194;_0x1eea0b=[];}});})[_0xfaa3('0x1e')](function(){if(_0x4fe300!==0x194){return db[_0xfaa3('0x7e')][_0xfaa3('0xa1')]({'where':{'OpenchannelAccountId':_0x395bf3},'order':_0xfaa3('0xa2')})[_0xfaa3('0x1e')](function(_0x18ba63){_0x1eea0b=_0x18ba63;});}})[_0xfaa3('0x26')](function(_0x537a27){_0x4fe300=0x1f4;logger['error'](_0x537a27[_0xfaa3('0x36')]);if(_0x537a27[_0xfaa3('0x37')]){delete _0x537a27[_0xfaa3('0x37')];}_0x1eea0b=_0x537a27;})['finally'](function(){if(_0x1eea0b===null){_0xcbf4f5[_0xfaa3('0x27')](_0x4fe300);}else{if(_0x4fe300===0x1f4){_0xcbf4f5['status'](_0x4fe300)['send'](_0x1eea0b);}else{_0xcbf4f5['status'](_0x4fe300)['json'](_0x1eea0b);}}});};exports[_0xfaa3('0xa3')]=function(_0x5b25b7,_0x2efdaf,_0x5af79e){var _0x2bd6a6={};var _0x202cfe={};var _0x146984;var _0x36a17a;return db[_0xfaa3('0x3c')][_0xfaa3('0x68')]({'where':{'id':_0x5b25b7[_0xfaa3('0x58')]['id']}})['then'](handleEntityNotFound(_0x2efdaf,null))[_0xfaa3('0x1e')](function(_0x280b05){if(_0x280b05){_0x146984=_0x280b05;_0x202cfe[_0xfaa3('0x40')]=_[_0xfaa3('0x43')](db[_0xfaa3('0x7e')]['rawAttributes']);_0x202cfe['query']=_[_0xfaa3('0x43')](_0x5b25b7[_0xfaa3('0x42')]);_0x202cfe['filters']=_['intersection'](_0x202cfe[_0xfaa3('0x40')],_0x202cfe['query']);_0x2bd6a6[_0xfaa3('0x46')]=_['intersection'](_0x202cfe['model'],qs[_0xfaa3('0x47')](_0x5b25b7[_0xfaa3('0x42')][_0xfaa3('0x47')]));_0x2bd6a6[_0xfaa3('0x46')]=_0x2bd6a6[_0xfaa3('0x46')][_0xfaa3('0x48')]?_0x2bd6a6['attributes']:_0x202cfe[_0xfaa3('0x40')];_0x2bd6a6['order']=qs['sort'](_0x5b25b7[_0xfaa3('0x42')][_0xfaa3('0x4c')]);_0x2bd6a6[_0xfaa3('0x4f')]=qs[_0xfaa3('0x44')](_[_0xfaa3('0x4d')](_0x5b25b7['query'],_0x202cfe['filters']));if(_0x5b25b7['query']['filter']){_0x2bd6a6['where']=_['merge'](_0x2bd6a6[_0xfaa3('0x4f')],{'$or':_[_0xfaa3('0x41')](_0x2bd6a6['attributes'],function(_0xf37ed1){var _0x387064={};_0x387064[_0xf37ed1]={'$like':'%'+_0x5b25b7['query'][_0xfaa3('0x4e')]+'%'};return _0x387064;})});}_0x2bd6a6=_[_0xfaa3('0x50')]({},_0x2bd6a6,_0x5b25b7[_0xfaa3('0x59')]);return _0x146984[_0xfaa3('0xa3')](_0x2bd6a6);}})['then'](function(_0x13ae77){if(_0x13ae77){_0x36a17a=_0x13ae77[_0xfaa3('0x48')];if(!_0x5b25b7[_0xfaa3('0x42')]['hasOwnProperty']('nolimit')){_0x2bd6a6[_0xfaa3('0x2a')]=qs[_0xfaa3('0x2a')](_0x5b25b7[_0xfaa3('0x42')]['limit']);_0x2bd6a6[_0xfaa3('0x2d')]=qs[_0xfaa3('0x2d')](_0x5b25b7['query'][_0xfaa3('0x2d')]);}return _0x146984[_0xfaa3('0xa3')](_0x2bd6a6);}})[_0xfaa3('0x1e')](function(_0x4eeae6){if(_0x4eeae6){return _0x4eeae6?{'count':_0x36a17a,'rows':_0x4eeae6}:null;}})[_0xfaa3('0x1e')](respondWithResult(_0x2efdaf,null))['catch'](handleError(_0x2efdaf,null));};exports[_0xfaa3('0xa4')]=function(_0x2ef1a9,_0x5d48a2,_0x57562d){var _0x4d8748={'raw':![],'where':{}};var _0x5087b0={};var _0xfea88a={'count':0x0,'rows':[]};return db[_0xfaa3('0x3c')][_0xfaa3('0x68')]({'where':{'id':_0x2ef1a9[_0xfaa3('0x58')]['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x5d48a2,null))[_0xfaa3('0x1e')](function(_0x39f6ff){if(_0x39f6ff){_0x5087b0[_0xfaa3('0x40')]=_[_0xfaa3('0x43')](db['OpenchannelInteraction'][_0xfaa3('0x3d')]);_0x5087b0[_0xfaa3('0x42')]=_[_0xfaa3('0x43')](_0x2ef1a9[_0xfaa3('0x42')]);_0x5087b0['filters']=_[_0xfaa3('0x45')](_0x5087b0[_0xfaa3('0x40')],_0x5087b0[_0xfaa3('0x42')]);_0x4d8748[_0xfaa3('0x46')]=_['intersection'](_0x5087b0[_0xfaa3('0x40')],qs[_0xfaa3('0x47')](_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0x47')]));_0x4d8748[_0xfaa3('0x46')]=_0x4d8748[_0xfaa3('0x46')][_0xfaa3('0x48')]?_0x4d8748[_0xfaa3('0x46')]:_0x5087b0[_0xfaa3('0x40')];if(!_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0x49')](_0xfaa3('0x4a'))){_0x4d8748[_0xfaa3('0x2a')]=qs[_0xfaa3('0x2a')](_0x2ef1a9[_0xfaa3('0x42')]['limit']);_0x4d8748['offset']=qs[_0xfaa3('0x2d')](_0x2ef1a9[_0xfaa3('0x42')]['offset']);}_0x4d8748[_0xfaa3('0x4b')]=qs[_0xfaa3('0x4c')](_0x2ef1a9[_0xfaa3('0x42')]['sort']);_0x4d8748['where']=qs[_0xfaa3('0x44')](_[_0xfaa3('0x4d')](_0x2ef1a9[_0xfaa3('0x42')],_0x5087b0['filters']));_0x4d8748[_0xfaa3('0x4f')]['OpenchannelAccountId']=_0x39f6ff['id'];if(_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0x4e')]){_0x4d8748[_0xfaa3('0x4f')]=_[_0xfaa3('0x50')](_0x4d8748['where'],{'$or':_[_0xfaa3('0x41')](_0x4d8748[_0xfaa3('0x46')],function(_0x25d79e){var _0x18c0e9={};_0x18c0e9[_0x25d79e]={'$like':'%'+_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0x4e')]+'%'};return _0x18c0e9;})});}_0x4d8748=_[_0xfaa3('0x50')]({},_0x4d8748,_0x2ef1a9[_0xfaa3('0x59')]);return db[_0xfaa3('0x89')][_0xfaa3('0x2c')]({'where':_0x4d8748[_0xfaa3('0x4f')]})[_0xfaa3('0x1e')](function(_0x575502){_0xfea88a['count']=_0x575502;if(_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0x53')]){_0x4d8748[_0xfaa3('0x54')]=[{'model':db[_0xfaa3('0x6f')],'as':_0xfaa3('0xa5'),'required':![]},{'model':db['User'],'as':_0xfaa3('0xa6'),'attributes':[_0xfaa3('0x37'),'fullname',_0xfaa3('0xa7')],'required':![]},{'model':db['Tag'],'as':_0xfaa3('0xa8'),'attributes':['id','name','color'],'where':_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0xa9')]?{'id':_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0xa9')]}:undefined,'required':_0x2ef1a9[_0xfaa3('0x42')][_0xfaa3('0xa9')]?!![]:![]}];}return db[_0xfaa3('0x89')]['findAll'](_0x4d8748);})[_0xfaa3('0x1e')](function(_0x5565cc){_0xfea88a[_0xfaa3('0x56')]=_0x5565cc;return _0xfea88a;});}})[_0xfaa3('0x1e')](respondWithFilteredResult(_0x5d48a2,_0x4d8748))[_0xfaa3('0x26')](handleError(_0x5d48a2,null));};exports[_0xfaa3('0xaa')]=function(_0x4441c2,_0x291ee8,_0x48bd54){return db[_0xfaa3('0x3c')][_0xfaa3('0x5a')]({'where':{'id':_0x4441c2[_0xfaa3('0x58')]['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x291ee8,null))[_0xfaa3('0x1e')](function(_0x9e8dbe){if(_0x9e8dbe){return _0x9e8dbe[_0xfaa3('0xaa')](_0x4441c2[_0xfaa3('0x5c')]['ids'],_['omit'](_0x4441c2[_0xfaa3('0x5c')],[_0xfaa3('0xab'),'id'])||{})[_0xfaa3('0x8a')](function(_0x199fd2){for(var _0xce1269=0x0;_0xce1269<_0x4441c2['body'][_0xfaa3('0xab')][_0xfaa3('0x48')];_0xce1269+=0x1){socket['emit'](_0xfaa3('0xac'),{'UserId':Number(_0x4441c2[_0xfaa3('0x5c')][_0xfaa3('0xab')][_0xce1269]),'OpenchannelAccountId':Number(_0x4441c2[_0xfaa3('0x58')]['id'])});}return _0x199fd2;});}})[_0xfaa3('0x1e')](respondWithResult(_0x291ee8,null))[_0xfaa3('0x26')](handleError(_0x291ee8,null));};exports['removeAgents']=function(_0x1de400,_0x473137,_0xcec1a3){return db[_0xfaa3('0x3c')]['find']({'where':{'id':_0x1de400['params']['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x473137,null))[_0xfaa3('0x1e')](function(_0x36ec10){if(_0x36ec10){return _0x36ec10[_0xfaa3('0xad')](_0x1de400[_0xfaa3('0x42')][_0xfaa3('0xab')])[_0xfaa3('0x1e')](function(){if(_[_0xfaa3('0xae')](_0x1de400['query']['ids'])){for(var _0x1a6d0d=0x0;_0x1a6d0d<_0x1de400[_0xfaa3('0x42')][_0xfaa3('0xab')][_0xfaa3('0x48')];_0x1a6d0d+=0x1){socket[_0xfaa3('0xaf')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1de400[_0xfaa3('0x42')][_0xfaa3('0xab')][_0x1a6d0d]),'OpenchannelAccountId':Number(_0x1de400[_0xfaa3('0x58')]['id'])});}}else{socket[_0xfaa3('0xaf')](_0xfaa3('0xb0'),{'UserId':Number(_0x1de400['query']['ids']),'OpenchannelAccountId':Number(_0x1de400[_0xfaa3('0x58')]['id'])});}});}})[_0xfaa3('0x1e')](respondWithStatusCode(_0x473137,null))[_0xfaa3('0x26')](handleError(_0x473137,null));};exports[_0xfaa3('0xb1')]=function(_0x1555e4,_0x39cf92,_0x533954){var _0x8e0d34={};var _0x52677d={};var _0xc7600;var _0x55aae6;return db['OpenchannelAccount'][_0xfaa3('0x68')]({'where':{'id':_0x1555e4[_0xfaa3('0x58')]['id']}})['then'](handleEntityNotFound(_0x39cf92,null))['then'](function(_0x13c1f1){if(_0x13c1f1){_0xc7600=_0x13c1f1;_0x52677d[_0xfaa3('0x40')]=_[_0xfaa3('0x43')](db[_0xfaa3('0x93')][_0xfaa3('0x3d')]);_0x52677d[_0xfaa3('0x42')]=_[_0xfaa3('0x43')](_0x1555e4[_0xfaa3('0x42')]);_0x52677d[_0xfaa3('0x44')]=_['intersection'](_0x52677d['model'],_0x52677d[_0xfaa3('0x42')]);_0x8e0d34['attributes']=_[_0xfaa3('0x45')](_0x52677d[_0xfaa3('0x40')],qs['fields'](_0x1555e4[_0xfaa3('0x42')][_0xfaa3('0x47')]));_0x8e0d34['attributes']=_0x8e0d34['attributes'][_0xfaa3('0x48')]?_0x8e0d34['attributes']:_0x52677d[_0xfaa3('0x40')];_0x8e0d34[_0xfaa3('0x4b')]=qs['sort'](_0x1555e4[_0xfaa3('0x42')][_0xfaa3('0x4c')]);_0x8e0d34[_0xfaa3('0x4f')]=qs[_0xfaa3('0x44')](_[_0xfaa3('0x4d')](_0x1555e4['query'],_0x52677d['filters']));if(_0x1555e4['query']['filter']){_0x8e0d34[_0xfaa3('0x4f')]=_[_0xfaa3('0x50')](_0x8e0d34[_0xfaa3('0x4f')],{'$or':_[_0xfaa3('0x41')](_0x8e0d34[_0xfaa3('0x46')],function(_0x3fecb5){var _0x4f9f44={};_0x4f9f44[_0x3fecb5]={'$like':'%'+_0x1555e4[_0xfaa3('0x42')][_0xfaa3('0x4e')]+'%'};return _0x4f9f44;})});}_0x8e0d34=_[_0xfaa3('0x50')]({},_0x8e0d34,_0x1555e4[_0xfaa3('0x59')]);return _0xc7600[_0xfaa3('0xb1')](_0x8e0d34);}})['then'](function(_0x559ad0){if(_0x559ad0){_0x55aae6=_0x559ad0[_0xfaa3('0x48')];if(!_0x1555e4[_0xfaa3('0x42')][_0xfaa3('0x49')](_0xfaa3('0x4a'))){_0x8e0d34[_0xfaa3('0x2a')]=qs[_0xfaa3('0x2a')](_0x1555e4[_0xfaa3('0x42')][_0xfaa3('0x2a')]);_0x8e0d34['offset']=qs[_0xfaa3('0x2d')](_0x1555e4['query'][_0xfaa3('0x2d')]);}return _0xc7600[_0xfaa3('0xb1')](_0x8e0d34);}})['then'](function(_0x5d0722){if(_0x5d0722){return _0x5d0722?{'count':_0x55aae6,'rows':_0x5d0722}:null;}})[_0xfaa3('0x1e')](respondWithResult(_0x39cf92,null))['catch'](handleError(_0x39cf92,null));};exports[_0xfaa3('0x38')]=function(_0x19f540,_0x216758,_0x2bd7e6){var _0x383c84,_0x53ff98,_0x168993;if(_[_0xfaa3('0x74')](_0x19f540[_0xfaa3('0x5c')][_0xfaa3('0x5c')])||_0x19f540['body']['body']===''){throw new db[(_0xfaa3('0x79'))][(_0xfaa3('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfaa3('0x74')](_0x19f540[_0xfaa3('0x5c')]['to'])){}_0x383c84=_0x19f540[_0xfaa3('0x5c')]['to'];return db[_0xfaa3('0x3c')][_0xfaa3('0x68')]({'where':{'id':_0x19f540[_0xfaa3('0x58')]['id']}})[_0xfaa3('0x1e')](handleEntityNotFound(_0x216758,null))[_0xfaa3('0x1e')](function(_0x1110cd){if(_0x1110cd){return db['OpenchannelAccount'][_0xfaa3('0x5a')]({'where':{'id':_0x1110cd['id']},'include':[{'model':db[_0xfaa3('0x7b')],'as':_0xfaa3('0x7c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x1110cd[_0xfaa3('0x78')]]:_0x383c84},'limit':0x1,'order':[[_0xfaa3('0x72'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x216758,null))[_0xfaa3('0x1e')](function(_0x5b5bbd){if(_0x5b5bbd&&_0x5b5bbd[_0xfaa3('0x7c')]){_0x53ff98=_0x5b5bbd[_0xfaa3('0x34')]({'plain':!![]});if(_0x53ff98[_0xfaa3('0x7c')]&&_0x53ff98[_0xfaa3('0x7c')]['Contacts'][_0xfaa3('0x48')]){return _0x53ff98['List'][_0xfaa3('0x7d')][0x0];}return db[_0xfaa3('0x6f')][_0xfaa3('0x5b')](_['defaults'](_0x19f540[_0xfaa3('0x5c')],{'firstName':_0x383c84,[_0x5b5bbd['mapKey']]:_0x383c84,'phone':_0x383c84,'ListId':_0x53ff98[_0xfaa3('0x73')]}));}})['then'](handleEntityNotFound(_0x216758,null))[_0xfaa3('0x1e')](function(_0x3f7293){if(_0x3f7293){_0x168993=_0x3f7293;return db[_0xfaa3('0x89')][_0xfaa3('0x5a')]({'where':{'ContactId':_0x168993['id'],'closed':![],'OpenchannelAccountId':_0x53ff98['id']}})['then'](function(_0x91850b){if(_0x91850b){return[_0x91850b,![]];}return db[_0xfaa3('0x89')][_0xfaa3('0x5b')]({'UserId':_0x19f540[_0xfaa3('0x5d')]['id'],'ContactId':_0x168993['id'],'OpenchannelAccountId':_0x53ff98['id'],'lastMsgDirection':_0xfaa3('0xb2'),'firstMsgDirection':_0xfaa3('0xb2'),'Messages':[_[_0xfaa3('0x50')](_0x19f540['body'],{'read':![],'body':_0x19f540[_0xfaa3('0x5c')][_0xfaa3('0x5c')],'OpenchannelAccountId':_0x53ff98['id'],'UserId':_0x19f540[_0xfaa3('0x5d')]['id'],'ContactId':_0x168993['id']})]},{'include':[{'model':db[_0xfaa3('0xb3')],'as':_0xfaa3('0xb4')}]})[_0xfaa3('0x1e')](function(_0x6a47cd){return[_0x6a47cd,!![]];});});}})[_0xfaa3('0x8a')](function(_0x3bd060,_0x500555){if(_0x500555){return _0x3bd060;}return db['OpenchannelMessage'][_0xfaa3('0x5b')](_[_0xfaa3('0x50')](_0x19f540[_0xfaa3('0x5c')],{'read':![],'body':_0x19f540[_0xfaa3('0x5c')][_0xfaa3('0x5c')],'OpenchannelAccountId':_0x53ff98['id'],'OpenchannelInteractionId':_0x3bd060['id'],'UserId':_0x19f540['user']['id'],'ContactId':_0x168993['id']}))[_0xfaa3('0x1e')](function(_0x2d3873){_0x3bd060['dataValues'][_0xfaa3('0xb4')]=[];_0x3bd060[_0xfaa3('0xb5')]['Messages'][_0xfaa3('0x8e')](_0x2d3873[_0xfaa3('0xb5')]);return _0x3bd060;});});}})[_0xfaa3('0x1e')](respondWithResult(_0x216758,null))[_0xfaa3('0x26')](handleError(_0x216758,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 4b17bdc..216ad99 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x5bf18d,_0x264c55){var _0x1d6cc0=function(_0x2d69d9){while(--_0x2d69d9){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x1d6cc0(++_0x264c55);}(_0x4ea3,0x70));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x34ea('0x0'));var OpenchannelAccount=require(_0x34ea('0x1'))['db'][_0x34ea('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x34ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x34ea('0x4'),'afterDestroy':'remove'};function emitEvent(_0x269d4c){return function(_0x571f1b,_0x5e5a84,_0x2ce955){OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c+':'+_0x571f1b['id'],_0x571f1b);OpenchannelAccountEvents[_0x34ea('0x5')](_0x269d4c,_0x571f1b);_0x2ce955(null);};}for(var e in events){if(events[_0x34ea('0x6')](e)){var event=events[e];OpenchannelAccount[_0x34ea('0x7')](e,emitEvent(event));}}module[_0x34ea('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x55e0=['remove','emit','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x5a5ad8,_0x34911c){var _0x5512e5=function(_0x18cbe6){while(--_0x18cbe6){_0x5a5ad8['push'](_0x5a5ad8['shift']());}};_0x5512e5(++_0x34911c);}(_0x55e0,0xdc));var _0x055e=function(_0x520ae1,_0x124adc){_0x520ae1=_0x520ae1-0x0;var _0x587c3a=_0x55e0[_0x520ae1];return _0x587c3a;};'use strict';var EventEmitter=require(_0x055e('0x0'));var OpenchannelAccount=require(_0x055e('0x1'))['db'][_0x055e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x055e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x055e('0x4')};function emitEvent(_0x2d9bd5){return function(_0x33cd7b,_0x2773e4,_0x157473){OpenchannelAccountEvents[_0x055e('0x5')](_0x2d9bd5+':'+_0x33cd7b['id'],_0x33cd7b);OpenchannelAccountEvents['emit'](_0x2d9bd5,_0x33cd7b);_0x157473(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x055e('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 18cacc9..b435a58 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x347df4,_0x343550){var _0x3a13fa=function(_0x17391e){while(--_0x17391e){_0x347df4['push'](_0x347df4['shift']());}};_0x3a13fa(++_0x343550);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xd4192a,_0x312e1f){var _0x5b98bf=function(_0xcbdcd4){while(--_0xcbdcd4){_0xd4192a['push'](_0xd4192a['shift']());}};_0x5b98bf(++_0x312e1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 6dd5631..ec007fe 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request'];(function(_0x22e326,_0xa441){var _0x5e2544=function(_0x56a054){while(--_0x56a054){_0x22e326['push'](_0x22e326['shift']());}};_0x5e2544(++_0xa441);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1ebc88,_0x638cd6){_0x1ebc88=_0x1ebc88-0x0;var _0xcef294=_0x9c00[_0x1ebc88];return _0xcef294;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x09c0('0x9')]=_[_0x09c0('0xa')](config[_0x09c0('0x9')],{'host':_0x09c0('0xb'),'port':0x18eb});var socket=require(_0x09c0('0xc'))(new Redis(config['redis']));require(_0x09c0('0xd'))[_0x09c0('0xe')](socket);function respondWithRpcPromise(_0xa20b5c,_0x1feb1d,_0x27a33c){return new BPromise(function(_0x1e16f4,_0x1fec4f){return client[_0x09c0('0xf')](_0xa20b5c,_0x27a33c)[_0x09c0('0x10')](function(_0x4523ea){logger[_0x09c0('0x11')](_0x09c0('0x12'),_0x1feb1d,_0x09c0('0x13'));logger[_0x09c0('0x14')](_0x09c0('0x15'),_0x1feb1d,_0x09c0('0x13'),JSON[_0x09c0('0x16')](_0x4523ea));if(_0x4523ea[_0x09c0('0x17')]){if(_0x4523ea[_0x09c0('0x17')][_0x09c0('0x18')]===0x1f4){logger[_0x09c0('0x17')](_0x09c0('0x12'),_0x1feb1d,_0x4523ea[_0x09c0('0x17')][_0x09c0('0x19')]);return _0x1fec4f(_0x4523ea[_0x09c0('0x17')][_0x09c0('0x19')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1feb1d,_0x4523ea['error'][_0x09c0('0x19')]);return _0x1e16f4(_0x4523ea[_0x09c0('0x17')][_0x09c0('0x19')]);}else{logger[_0x09c0('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x1feb1d,_0x09c0('0x13'));_0x1e16f4(_0x4523ea['result']['message']);}})[_0x09c0('0x1a')](function(_0x50fccc){logger[_0x09c0('0x17')](_0x09c0('0x12'),_0x1feb1d,_0x50fccc);_0x1fec4f(_0x50fccc);});});} \ No newline at end of file +var _0x6599=['request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','register','then','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x5c0232,_0x1c449f){var _0x589366=function(_0x31cd62){while(--_0x31cd62){_0x5c0232['push'](_0x5c0232['shift']());}};_0x589366(++_0x1c449f);}(_0x6599,0xb0));var _0x9659=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x6599[_0x48999d];return _0x1ad0d1;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9659('0xa')],{'host':_0x9659('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9659('0xa')]));require('./openchannelAccount.socket')[_0x9659('0xc')](socket);function respondWithRpcPromise(_0x194d48,_0x58552a,_0x147cac){return new BPromise(function(_0x25a460,_0x349cfb){return client['request'](_0x194d48,_0x147cac)[_0x9659('0xd')](function(_0x520848){logger[_0x9659('0xe')](_0x9659('0xf'),_0x58552a,_0x9659('0x10'));logger['debug'](_0x9659('0x11'),_0x58552a,_0x9659('0x10'),JSON[_0x9659('0x12')](_0x520848));if(_0x520848[_0x9659('0x13')]){if(_0x520848[_0x9659('0x13')][_0x9659('0x14')]===0x1f4){logger[_0x9659('0x13')](_0x9659('0xf'),_0x58552a,_0x520848[_0x9659('0x13')][_0x9659('0x15')]);return _0x349cfb(_0x520848[_0x9659('0x13')][_0x9659('0x15')]);}logger[_0x9659('0x13')](_0x9659('0xf'),_0x58552a,_0x520848['error'][_0x9659('0x15')]);return _0x25a460(_0x520848[_0x9659('0x13')][_0x9659('0x15')]);}else{logger[_0x9659('0xe')](_0x9659('0xf'),_0x58552a,_0x9659('0x10'));_0x25a460(_0x520848[_0x9659('0x16')][_0x9659('0x15')]);}})[_0x9659('0x17')](function(_0x525d27){logger[_0x9659('0x13')](_0x9659('0xf'),_0x58552a,_0x525d27);_0x349cfb(_0x525d27);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0d55349..cdf75fd 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb07f=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb07f,0x109));var _0xfb07=function(_0x54d8bf,_0x4b924f){_0x54d8bf=_0x54d8bf-0x0;var _0x59a527=_0xb07f[_0x54d8bf];return _0x59a527;};'use strict';var OpenchannelAccountEvents=require(_0xfb07('0x0'));var events=[_0xfb07('0x1'),_0xfb07('0x2'),_0xfb07('0x3')];function createListener(_0x2e561d,_0xc9317c){return function(_0x3a262e){_0xc9317c[_0xfb07('0x4')](_0x2e561d,_0x3a262e);};}function removeListener(_0x3b3c05,_0x2fc1ce){return function(){OpenchannelAccountEvents[_0xfb07('0x5')](_0x3b3c05,_0x2fc1ce);};}exports['register']=function(_0x3c79a9){for(var _0x934f98=0x0,_0x14fc69=events[_0xfb07('0x6')];_0x934f98<_0x14fc69;_0x934f98++){var _0x41d73a=events[_0x934f98];var _0x3bb9cf=createListener(_0xfb07('0x7')+_0x41d73a,_0x3c79a9);OpenchannelAccountEvents['on'](_0x41d73a,_0x3bb9cf);}}; \ No newline at end of file +var _0x938c=['./openchannelAccount.events','save','update','removeListener','register','length','openchannelAccount:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x938c,0x11f));var _0xc938=function(_0x3aac47,_0x44c719){_0x3aac47=_0x3aac47-0x0;var _0xdfd31f=_0x938c[_0x3aac47];return _0xdfd31f;};'use strict';var OpenchannelAccountEvents=require(_0xc938('0x0'));var events=[_0xc938('0x1'),'remove',_0xc938('0x2')];function createListener(_0x5cd37a,_0x502809){return function(_0x257b7c){_0x502809['emit'](_0x5cd37a,_0x257b7c);};}function removeListener(_0x15a960,_0xa06f0c){return function(){OpenchannelAccountEvents[_0xc938('0x3')](_0x15a960,_0xa06f0c);};}exports[_0xc938('0x4')]=function(_0x235110){for(var _0x8cfbb6=0x0,_0x5c08fe=events[_0xc938('0x5')];_0x8cfbb6<_0x5c08fe;_0x8cfbb6++){var _0x6e8871=events[_0x8cfbb6];var _0x52fbb1=createListener(_0xc938('0x6')+_0x6e8871,_0x235110);OpenchannelAccountEvents['on'](_0x6e8871,_0x52fbb1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4de560d..895080f 100644 --- a/server/api/openchannelApplication/index.js +++ b/server/api/openchannelApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57df=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x4658b8,_0x585640){var _0x31796e=function(_0x40690e){while(--_0x40690e){_0x4658b8['push'](_0x4658b8['shift']());}};_0x31796e(++_0x585640);}(_0x57df,0xe8));var _0xf57d=function(_0x572d9d,_0x46b179){_0x572d9d=_0x572d9d-0x0;var _0x2b7dc2=_0x57df[_0x572d9d];return _0x2b7dc2;};'use strict';var multer=require(_0xf57d('0x0'));var util=require(_0xf57d('0x1'));var path=require(_0xf57d('0x2'));var timeout=require(_0xf57d('0x3'));var express=require('express');var router=express[_0xf57d('0x4')]();var fs_extra=require(_0xf57d('0x5'));var auth=require(_0xf57d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf57d('0x7'));var controller=require(_0xf57d('0x8'));router[_0xf57d('0x9')]('/',auth['isAuthenticated'](),controller[_0xf57d('0xa')]);router[_0xf57d('0x9')](_0xf57d('0xb'),auth[_0xf57d('0xc')](),controller[_0xf57d('0xd')]);router[_0xf57d('0xe')]('/',auth[_0xf57d('0xc')](),controller['create']);router[_0xf57d('0xf')](_0xf57d('0xb'),auth[_0xf57d('0xc')](),controller['update']);router[_0xf57d('0x10')](_0xf57d('0xb'),auth[_0xf57d('0xc')](),controller[_0xf57d('0x11')]);module[_0xf57d('0x12')]=router; \ No newline at end of file +var _0x94af=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','put','destroy','exports','util','path'];(function(_0x4349f1,_0x1de6dd){var _0x317a34=function(_0x1ddc5c){while(--_0x1ddc5c){_0x4349f1['push'](_0x4349f1['shift']());}};_0x317a34(++_0x1de6dd);}(_0x94af,0x75));var _0xf94a=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x94af[_0x5037ab];return _0x512adb;};'use strict';var multer=require('multer');var util=require(_0xf94a('0x0'));var path=require(_0xf94a('0x1'));var timeout=require('connect-timeout');var express=require(_0xf94a('0x2'));var router=express['Router']();var fs_extra=require(_0xf94a('0x3'));var auth=require(_0xf94a('0x4'));var interaction=require(_0xf94a('0x5'));var config=require(_0xf94a('0x6'));var controller=require(_0xf94a('0x7'));router[_0xf94a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf94a('0x9')]);router[_0xf94a('0x8')](_0xf94a('0xa'),auth[_0xf94a('0xb')](),controller[_0xf94a('0xc')]);router[_0xf94a('0xd')]('/',auth[_0xf94a('0xb')](),controller['create']);router[_0xf94a('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xf94a('0xa'),auth[_0xf94a('0xb')](),controller[_0xf94a('0xf')]);module[_0xf94a('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d21ab88..d42ed13 100644 --- a/server/api/openchannelApplication/openchannelApplication.attributes.js +++ b/server/api/openchannelApplication/openchannelApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03ac=['*,*,*,*','sequelize','STRING'];(function(_0x2bdc9d,_0x5ef92b){var _0x1ac0ba=function(_0x3980c8){while(--_0x3980c8){_0x2bdc9d['push'](_0x2bdc9d['shift']());}};_0x1ac0ba(++_0x5ef92b);}(_0x03ac,0x7c));var _0xc03a=function(_0x1b90ee,_0x163683){_0x1b90ee=_0x1b90ee-0x0;var _0x7319f5=_0x03ac[_0x1b90ee];return _0x7319f5;};'use strict';var Sequelize=require(_0xc03a('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc03a('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc03a('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc03a('0x2')}}; \ No newline at end of file +var _0x252f=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x8c6bae,_0x4e3693){var _0x499566=function(_0x885e85){while(--_0x885e85){_0x8c6bae['push'](_0x8c6bae['shift']());}};_0x499566(++_0x4e3693);}(_0x252f,0x6e));var _0xf252=function(_0x12b756,_0x43f6f3){_0x12b756=_0x12b756-0x0;var _0x40cc2e=_0x252f[_0x12b756];return _0x40cc2e;};'use strict';var Sequelize=require(_0xf252('0x0'));module[_0xf252('0x1')]={'priority':{'type':Sequelize[_0xf252('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf252('0x3')],'allowNull':![],'defaultValue':_0xf252('0x4')},'appdata':{'type':Sequelize[_0xf252('0x5')]()},'description':{'type':Sequelize[_0xf252('0x3')]},'interval':{'type':Sequelize[_0xf252('0x3')],'defaultValue':_0xf252('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 285fe07..9dcaa03 100644 --- a/server/api/openchannelApplication/openchannelApplication.controller.js +++ b/server/api/openchannelApplication/openchannelApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfe3=['map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','length','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xbfe3,0x108));var _0x3bfe=function(_0x29fe74,_0x4eea41){_0x29fe74=_0x29fe74-0x0;var _0x3073c6=_0xbfe3[_0x29fe74];return _0x3073c6;};'use strict';var emlformat=require(_0x3bfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bfe('0x1'));var jsonpatch=require(_0x3bfe('0x2'));var rp=require(_0x3bfe('0x3'));var moment=require(_0x3bfe('0x4'));var BPromise=require(_0x3bfe('0x5'));var Mustache=require(_0x3bfe('0x6'));var util=require(_0x3bfe('0x7'));var path=require('path');var sox=require(_0x3bfe('0x8'));var csv=require(_0x3bfe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bfe('0xa'));var _=require(_0x3bfe('0xb'));var squel=require('squel');var crypto=require(_0x3bfe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3bfe('0xd'));var toCsv=require(_0x3bfe('0x9'));var querystring=require('querystring');var Papa=require(_0x3bfe('0xe'));var Redis=require(_0x3bfe('0xf'));var authService=require(_0x3bfe('0x10'));var qs=require(_0x3bfe('0x11'));var as=require(_0x3bfe('0x12'));var hardwareService=require(_0x3bfe('0x13'));var logger=require(_0x3bfe('0x14'))(_0x3bfe('0x15'));var utils=require(_0x3bfe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3bfe('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52d3f7,_0x42376f){_0x42376f=_0x42376f||0xcc;return function(_0x27be77){if(_0x27be77){return _0x52d3f7[_0x3bfe('0x18')](_0x42376f);}return _0x52d3f7[_0x3bfe('0x19')](_0x42376f)[_0x3bfe('0x1a')]();};}function respondWithResult(_0x9c9a12,_0x2833c7){_0x2833c7=_0x2833c7||0xc8;return function(_0x24d106){if(_0x24d106){return _0x9c9a12['status'](_0x2833c7)['json'](_0x24d106);}};}function respondWithFilteredResult(_0x35fa0f,_0x24f060){return function(_0x203247){if(_0x203247){var _0x44c3c4=typeof _0x24f060['offset']===_0x3bfe('0x1b')&&typeof _0x24f060['limit']==='undefined';var _0x34b733=_0x203247[_0x3bfe('0x1c')];var _0x449e3e=_0x44c3c4?0x0:_0x24f060[_0x3bfe('0x1d')];var _0x588ff7=_0x44c3c4?_0x203247[_0x3bfe('0x1c')]:_0x24f060[_0x3bfe('0x1d')]+_0x24f060[_0x3bfe('0x1e')];var _0x362ad4;if(_0x588ff7>=_0x34b733){_0x588ff7=_0x34b733;_0x362ad4=0xc8;}else{_0x362ad4=0xce;}_0x35fa0f[_0x3bfe('0x19')](_0x362ad4);return _0x35fa0f[_0x3bfe('0x1f')](_0x3bfe('0x20'),_0x449e3e+'-'+_0x588ff7+'/'+_0x34b733)[_0x3bfe('0x21')](_0x203247);}return null;};}function patchUpdates(_0x4bf298){return function(_0x4c1445){try{jsonpatch[_0x3bfe('0x22')](_0x4c1445,_0x4bf298,!![]);}catch(_0x2646cb){return BPromise[_0x3bfe('0x23')](_0x2646cb);}return _0x4c1445['save']();};}function saveUpdates(_0x5e5f79,_0x2bfc02){return function(_0x4a8387){if(_0x4a8387){return _0x4a8387[_0x3bfe('0x24')](_0x5e5f79)[_0x3bfe('0x25')](function(_0x890718){return _0x890718;});}return null;};}function removeEntity(_0x134802,_0x14039b){return function(_0x5e87f5){if(_0x5e87f5){return _0x5e87f5[_0x3bfe('0x26')]()[_0x3bfe('0x25')](function(){_0x134802[_0x3bfe('0x19')](0xcc)[_0x3bfe('0x1a')]();});}};}function handleEntityNotFound(_0x4f4ff7,_0x2ef2f6){return function(_0xa6c62c){if(!_0xa6c62c){_0x4f4ff7['sendStatus'](0x194);}return _0xa6c62c;};}function handleError(_0x3a316f,_0x193e5f){_0x193e5f=_0x193e5f||0x1f4;return function(_0x42dfa5){logger[_0x3bfe('0x27')](_0x42dfa5[_0x3bfe('0x28')]);if(_0x42dfa5[_0x3bfe('0x29')]){delete _0x42dfa5[_0x3bfe('0x29')];}_0x3a316f[_0x3bfe('0x19')](_0x193e5f)[_0x3bfe('0x2a')](_0x42dfa5);};}exports[_0x3bfe('0x2b')]=function(_0x34bd61,_0x1428b9){var _0x558a9c={},_0x37436a={},_0xc093b1={'count':0x0,'rows':[]};var _0x3c6b3e=_[_0x3bfe('0x2c')](db[_0x3bfe('0x2d')][_0x3bfe('0x2e')],function(_0x509bf6){return{'name':_0x509bf6[_0x3bfe('0x2f')],'type':_0x509bf6['type'][_0x3bfe('0x30')]};});_0x37436a[_0x3bfe('0x31')]=_[_0x3bfe('0x2c')](_0x3c6b3e,'name');_0x37436a[_0x3bfe('0x32')]=_['keys'](_0x34bd61[_0x3bfe('0x32')]);_0x37436a[_0x3bfe('0x33')]=_[_0x3bfe('0x34')](_0x37436a[_0x3bfe('0x31')],_0x37436a[_0x3bfe('0x32')]);_0x558a9c[_0x3bfe('0x35')]=_[_0x3bfe('0x34')](_0x37436a['model'],qs[_0x3bfe('0x36')](_0x34bd61['query'][_0x3bfe('0x36')]));_0x558a9c[_0x3bfe('0x35')]=_0x558a9c[_0x3bfe('0x35')]['length']?_0x558a9c[_0x3bfe('0x35')]:_0x37436a[_0x3bfe('0x31')];if(!_0x34bd61[_0x3bfe('0x32')][_0x3bfe('0x37')](_0x3bfe('0x38'))){_0x558a9c['limit']=qs[_0x3bfe('0x1e')](_0x34bd61[_0x3bfe('0x32')][_0x3bfe('0x1e')]);_0x558a9c[_0x3bfe('0x1d')]=qs[_0x3bfe('0x1d')](_0x34bd61[_0x3bfe('0x32')][_0x3bfe('0x1d')]);}_0x558a9c[_0x3bfe('0x39')]=qs['sort'](_0x34bd61[_0x3bfe('0x32')][_0x3bfe('0x3a')]);_0x558a9c[_0x3bfe('0x3b')]=qs[_0x3bfe('0x33')](_[_0x3bfe('0x3c')](_0x34bd61[_0x3bfe('0x32')],_0x37436a[_0x3bfe('0x33')]),_0x3c6b3e);if(_0x34bd61[_0x3bfe('0x32')][_0x3bfe('0x3d')]){_0x558a9c[_0x3bfe('0x3b')]=_[_0x3bfe('0x3e')](_0x558a9c[_0x3bfe('0x3b')],{'$or':_['map'](_0x3c6b3e,function(_0x396a09){if(_0x396a09[_0x3bfe('0x3f')]!==_0x3bfe('0x40')){var _0x3b62f4={};_0x3b62f4[_0x396a09[_0x3bfe('0x29')]]={'$like':'%'+_0x34bd61[_0x3bfe('0x32')][_0x3bfe('0x3d')]+'%'};return _0x3b62f4;}})});}_0x558a9c=_['merge']({},_0x558a9c,_0x34bd61['options']);var _0x5f90a3={'where':_0x558a9c['where']};return db[_0x3bfe('0x2d')][_0x3bfe('0x1c')](_0x5f90a3)[_0x3bfe('0x25')](function(_0x6d772d){_0xc093b1[_0x3bfe('0x1c')]=_0x6d772d;if(_0x34bd61[_0x3bfe('0x32')][_0x3bfe('0x41')]){_0x558a9c['include']=[{'all':!![]}];}return db[_0x3bfe('0x2d')][_0x3bfe('0x42')](_0x558a9c);})[_0x3bfe('0x25')](function(_0x5e58f1){_0xc093b1[_0x3bfe('0x43')]=_0x5e58f1;return _0xc093b1;})['then'](respondWithFilteredResult(_0x1428b9,_0x558a9c))[_0x3bfe('0x44')](handleError(_0x1428b9,null));};exports[_0x3bfe('0x45')]=function(_0x1c04f1,_0x20dfb4){var _0x295706={'raw':!![],'where':{'id':_0x1c04f1[_0x3bfe('0x46')]['id']}},_0x209749={};_0x209749[_0x3bfe('0x31')]=_[_0x3bfe('0x47')](db[_0x3bfe('0x2d')][_0x3bfe('0x2e')]);_0x209749[_0x3bfe('0x32')]=_[_0x3bfe('0x47')](_0x1c04f1[_0x3bfe('0x32')]);_0x209749[_0x3bfe('0x33')]=_[_0x3bfe('0x34')](_0x209749['model'],_0x209749[_0x3bfe('0x32')]);_0x295706[_0x3bfe('0x35')]=_[_0x3bfe('0x34')](_0x209749[_0x3bfe('0x31')],qs[_0x3bfe('0x36')](_0x1c04f1[_0x3bfe('0x32')][_0x3bfe('0x36')]));_0x295706[_0x3bfe('0x35')]=_0x295706['attributes'][_0x3bfe('0x48')]?_0x295706[_0x3bfe('0x35')]:_0x209749[_0x3bfe('0x31')];if(_0x1c04f1[_0x3bfe('0x32')][_0x3bfe('0x41')]){_0x295706['include']=[{'all':!![]}];}_0x295706=_[_0x3bfe('0x3e')]({},_0x295706,_0x1c04f1[_0x3bfe('0x49')]);return db[_0x3bfe('0x2d')][_0x3bfe('0x4a')](_0x295706)[_0x3bfe('0x25')](handleEntityNotFound(_0x20dfb4,null))['then'](respondWithResult(_0x20dfb4,null))[_0x3bfe('0x44')](handleError(_0x20dfb4,null));};exports[_0x3bfe('0x4b')]=function(_0x310ed0,_0x28fbb7){return db[_0x3bfe('0x2d')][_0x3bfe('0x4b')](_0x310ed0[_0x3bfe('0x4c')],{})[_0x3bfe('0x25')](respondWithResult(_0x28fbb7,0xc9))[_0x3bfe('0x44')](handleError(_0x28fbb7,null));};exports[_0x3bfe('0x24')]=function(_0x7b9691,_0x3a1344){if(_0x7b9691[_0x3bfe('0x4c')]['id']){delete _0x7b9691[_0x3bfe('0x4c')]['id'];}return db[_0x3bfe('0x2d')][_0x3bfe('0x4a')]({'where':{'id':_0x7b9691[_0x3bfe('0x46')]['id']}})[_0x3bfe('0x25')](handleEntityNotFound(_0x3a1344,null))[_0x3bfe('0x25')](saveUpdates(_0x7b9691[_0x3bfe('0x4c')],null))[_0x3bfe('0x25')](respondWithResult(_0x3a1344,null))[_0x3bfe('0x44')](handleError(_0x3a1344,null));};exports[_0x3bfe('0x26')]=function(_0x41d900,_0x27d034){return db[_0x3bfe('0x2d')][_0x3bfe('0x4a')]({'where':{'id':_0x41d900[_0x3bfe('0x46')]['id']}})[_0x3bfe('0x25')](handleEntityNotFound(_0x27d034,null))[_0x3bfe('0x25')](removeEntity(_0x27d034,null))[_0x3bfe('0x44')](handleError(_0x27d034,null));}; \ No newline at end of file +var _0x96cb=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','then','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','includeAll','include','findAll','catch','params','options','create','body','update','rimraf','zip-dir','moment','bluebird','mustache','util','sox'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x96cb,0x185));var _0xb96c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96cb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb96c('0x0'));var zipdir=require(_0xb96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb96c('0x2'));var BPromise=require(_0xb96c('0x3'));var Mustache=require(_0xb96c('0x4'));var util=require(_0xb96c('0x5'));var path=require('path');var sox=require(_0xb96c('0x6'));var csv=require(_0xb96c('0x7'));var ejs=require(_0xb96c('0x8'));var fs=require('fs');var fs_extra=require(_0xb96c('0x9'));var _=require(_0xb96c('0xa'));var squel=require('squel');var crypto=require(_0xb96c('0xb'));var jsforce=require(_0xb96c('0xc'));var deskjs=require(_0xb96c('0xd'));var toCsv=require(_0xb96c('0x7'));var querystring=require(_0xb96c('0xe'));var Papa=require(_0xb96c('0xf'));var Redis=require(_0xb96c('0x10'));var authService=require(_0xb96c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb96c('0x12'));var hardwareService=require(_0xb96c('0x13'));var logger=require('../../config/logger')(_0xb96c('0x14'));var utils=require(_0xb96c('0x15'));var config=require(_0xb96c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb96c('0x17'))['db'];function respondWithStatusCode(_0x1e4bc6,_0x564cd6){_0x564cd6=_0x564cd6||0xcc;return function(_0x436728){if(_0x436728){return _0x1e4bc6[_0xb96c('0x18')](_0x564cd6);}return _0x1e4bc6['status'](_0x564cd6)[_0xb96c('0x19')]();};}function respondWithResult(_0x2b2eaa,_0x115473){_0x115473=_0x115473||0xc8;return function(_0x5a531e){if(_0x5a531e){return _0x2b2eaa[_0xb96c('0x1a')](_0x115473)[_0xb96c('0x1b')](_0x5a531e);}};}function respondWithFilteredResult(_0xda495f,_0x3a6ef3){return function(_0x5531d4){if(_0x5531d4){var _0x549597=typeof _0x3a6ef3[_0xb96c('0x1c')]===_0xb96c('0x1d')&&typeof _0x3a6ef3[_0xb96c('0x1e')]==='undefined';var _0x3a24c5=_0x5531d4[_0xb96c('0x1f')];var _0xec0796=_0x549597?0x0:_0x3a6ef3[_0xb96c('0x1c')];var _0xae58eb=_0x549597?_0x5531d4['count']:_0x3a6ef3['offset']+_0x3a6ef3[_0xb96c('0x1e')];var _0x5744bb;if(_0xae58eb>=_0x3a24c5){_0xae58eb=_0x3a24c5;_0x5744bb=0xc8;}else{_0x5744bb=0xce;}_0xda495f[_0xb96c('0x1a')](_0x5744bb);return _0xda495f[_0xb96c('0x20')]('Content-Range',_0xec0796+'-'+_0xae58eb+'/'+_0x3a24c5)['json'](_0x5531d4);}return null;};}function patchUpdates(_0x3aadb4){return function(_0x13dd75){try{jsonpatch[_0xb96c('0x21')](_0x13dd75,_0x3aadb4,!![]);}catch(_0x538ae1){return BPromise[_0xb96c('0x22')](_0x538ae1);}return _0x13dd75['save']();};}function saveUpdates(_0x132ff2,_0x2a0b96){return function(_0x21dad7){if(_0x21dad7){return _0x21dad7['update'](_0x132ff2)[_0xb96c('0x23')](function(_0x5747d8){return _0x5747d8;});}return null;};}function removeEntity(_0x438584,_0xf9b4a7){return function(_0x5e00b8){if(_0x5e00b8){return _0x5e00b8['destroy']()[_0xb96c('0x23')](function(){_0x438584[_0xb96c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x342a5e,_0x5a1ece){return function(_0x44cf4d){if(!_0x44cf4d){_0x342a5e[_0xb96c('0x18')](0x194);}return _0x44cf4d;};}function handleError(_0x1d5472,_0x2561a5){_0x2561a5=_0x2561a5||0x1f4;return function(_0x50e990){logger['error'](_0x50e990['stack']);if(_0x50e990[_0xb96c('0x24')]){delete _0x50e990[_0xb96c('0x24')];}_0x1d5472['status'](_0x2561a5)[_0xb96c('0x25')](_0x50e990);};}exports[_0xb96c('0x26')]=function(_0x537846,_0x43f25e){var _0x25ffda={},_0x4d8e7e={},_0x106e94={'count':0x0,'rows':[]};var _0x4c2e31=_[_0xb96c('0x27')](db[_0xb96c('0x28')][_0xb96c('0x29')],function(_0x45b3b8){return{'name':_0x45b3b8[_0xb96c('0x2a')],'type':_0x45b3b8[_0xb96c('0x2b')][_0xb96c('0x2c')]};});_0x4d8e7e[_0xb96c('0x2d')]=_[_0xb96c('0x27')](_0x4c2e31,_0xb96c('0x24'));_0x4d8e7e[_0xb96c('0x2e')]=_[_0xb96c('0x2f')](_0x537846['query']);_0x4d8e7e[_0xb96c('0x30')]=_[_0xb96c('0x31')](_0x4d8e7e[_0xb96c('0x2d')],_0x4d8e7e[_0xb96c('0x2e')]);_0x25ffda[_0xb96c('0x32')]=_['intersection'](_0x4d8e7e['model'],qs[_0xb96c('0x33')](_0x537846[_0xb96c('0x2e')][_0xb96c('0x33')]));_0x25ffda['attributes']=_0x25ffda[_0xb96c('0x32')][_0xb96c('0x34')]?_0x25ffda[_0xb96c('0x32')]:_0x4d8e7e['model'];if(!_0x537846[_0xb96c('0x2e')]['hasOwnProperty']('nolimit')){_0x25ffda['limit']=qs[_0xb96c('0x1e')](_0x537846[_0xb96c('0x2e')]['limit']);_0x25ffda[_0xb96c('0x1c')]=qs['offset'](_0x537846[_0xb96c('0x2e')]['offset']);}_0x25ffda['order']=qs['sort'](_0x537846[_0xb96c('0x2e')][_0xb96c('0x35')]);_0x25ffda[_0xb96c('0x36')]=qs[_0xb96c('0x30')](_[_0xb96c('0x37')](_0x537846[_0xb96c('0x2e')],_0x4d8e7e[_0xb96c('0x30')]),_0x4c2e31);if(_0x537846[_0xb96c('0x2e')]['filter']){_0x25ffda[_0xb96c('0x36')]=_[_0xb96c('0x38')](_0x25ffda['where'],{'$or':_[_0xb96c('0x27')](_0x4c2e31,function(_0x190816){if(_0x190816[_0xb96c('0x2b')]!=='VIRTUAL'){var _0x4e2362={};_0x4e2362[_0x190816[_0xb96c('0x24')]]={'$like':'%'+_0x537846['query']['filter']+'%'};return _0x4e2362;}})});}_0x25ffda=_[_0xb96c('0x38')]({},_0x25ffda,_0x537846['options']);var _0x4177d4={'where':_0x25ffda[_0xb96c('0x36')]};return db[_0xb96c('0x28')][_0xb96c('0x1f')](_0x4177d4)[_0xb96c('0x23')](function(_0x25a63a){_0x106e94[_0xb96c('0x1f')]=_0x25a63a;if(_0x537846['query'][_0xb96c('0x39')]){_0x25ffda[_0xb96c('0x3a')]=[{'all':!![]}];}return db[_0xb96c('0x28')][_0xb96c('0x3b')](_0x25ffda);})[_0xb96c('0x23')](function(_0x61adb0){_0x106e94['rows']=_0x61adb0;return _0x106e94;})[_0xb96c('0x23')](respondWithFilteredResult(_0x43f25e,_0x25ffda))[_0xb96c('0x3c')](handleError(_0x43f25e,null));};exports['show']=function(_0x4cc582,_0x29bdf7){var _0x49e8bb={'raw':!![],'where':{'id':_0x4cc582[_0xb96c('0x3d')]['id']}},_0x309111={};_0x309111[_0xb96c('0x2d')]=_['keys'](db['OpenchannelApplication'][_0xb96c('0x29')]);_0x309111[_0xb96c('0x2e')]=_[_0xb96c('0x2f')](_0x4cc582[_0xb96c('0x2e')]);_0x309111[_0xb96c('0x30')]=_[_0xb96c('0x31')](_0x309111['model'],_0x309111[_0xb96c('0x2e')]);_0x49e8bb['attributes']=_[_0xb96c('0x31')](_0x309111[_0xb96c('0x2d')],qs['fields'](_0x4cc582[_0xb96c('0x2e')][_0xb96c('0x33')]));_0x49e8bb[_0xb96c('0x32')]=_0x49e8bb['attributes'][_0xb96c('0x34')]?_0x49e8bb['attributes']:_0x309111['model'];if(_0x4cc582[_0xb96c('0x2e')][_0xb96c('0x39')]){_0x49e8bb[_0xb96c('0x3a')]=[{'all':!![]}];}_0x49e8bb=_[_0xb96c('0x38')]({},_0x49e8bb,_0x4cc582[_0xb96c('0x3e')]);return db[_0xb96c('0x28')]['find'](_0x49e8bb)[_0xb96c('0x23')](handleEntityNotFound(_0x29bdf7,null))[_0xb96c('0x23')](respondWithResult(_0x29bdf7,null))[_0xb96c('0x3c')](handleError(_0x29bdf7,null));};exports[_0xb96c('0x3f')]=function(_0x190886,_0x23d7d9){return db[_0xb96c('0x28')][_0xb96c('0x3f')](_0x190886[_0xb96c('0x40')],{})[_0xb96c('0x23')](respondWithResult(_0x23d7d9,0xc9))[_0xb96c('0x3c')](handleError(_0x23d7d9,null));};exports[_0xb96c('0x41')]=function(_0x498d99,_0x4e217c){if(_0x498d99['body']['id']){delete _0x498d99[_0xb96c('0x40')]['id'];}return db[_0xb96c('0x28')]['find']({'where':{'id':_0x498d99['params']['id']}})[_0xb96c('0x23')](handleEntityNotFound(_0x4e217c,null))[_0xb96c('0x23')](saveUpdates(_0x498d99[_0xb96c('0x40')],null))[_0xb96c('0x23')](respondWithResult(_0x4e217c,null))[_0xb96c('0x3c')](handleError(_0x4e217c,null));};exports['destroy']=function(_0x3dcf0f,_0x383852){return db[_0xb96c('0x28')]['find']({'where':{'id':_0x3dcf0f[_0xb96c('0x3d')]['id']}})[_0xb96c('0x23')](handleEntityNotFound(_0x383852,null))[_0xb96c('0x23')](removeEntity(_0x383852,null))['catch'](handleError(_0x383852,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f473ed8..612f5ea 100644 --- a/server/api/openchannelApplication/openchannelApplication.model.js +++ b/server/api/openchannelApplication/openchannelApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed38=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x31f259,_0x3b511a){var _0x14d7c4=function(_0x19b236){while(--_0x19b236){_0x31f259['push'](_0x31f259['shift']());}};_0x14d7c4(++_0x3b511a);}(_0xed38,0xa7));var _0x8ed3=function(_0x5780b7,_0x2364a1){_0x5780b7=_0x5780b7-0x0;var _0x3b43f8=_0xed38[_0x5780b7];return _0x3b43f8;};'use strict';var _=require(_0x8ed3('0x0'));var util=require('util');var logger=require(_0x8ed3('0x1'))(_0x8ed3('0x2'));var moment=require(_0x8ed3('0x3'));var BPromise=require(_0x8ed3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ed3('0x5'));var rimraf=require(_0x8ed3('0x6'));var config=require(_0x8ed3('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x8ed3('0x8')]=function(_0x5afd23,_0x277f21){return _0x5afd23[_0x8ed3('0x9')](_0x8ed3('0xa'),attributes,{'tableName':_0x8ed3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ed3('0xc'),'collate':_0x8ed3('0xd')});}; \ No newline at end of file +var _0xbba8=['define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes'];(function(_0x48cb61,_0x2cb0a9){var _0x80543f=function(_0x5d3fd1){while(--_0x5d3fd1){_0x48cb61['push'](_0x48cb61['shift']());}};_0x80543f(++_0x2cb0a9);}(_0xbba8,0x83));var _0x8bba=function(_0x1b730f,_0x1a263b){_0x1b730f=_0x1b730f-0x0;var _0x1ee571=_0xbba8[_0x1b730f];return _0x1ee571;};'use strict';var _=require(_0x8bba('0x0'));var util=require('util');var logger=require(_0x8bba('0x1'))(_0x8bba('0x2'));var moment=require(_0x8bba('0x3'));var BPromise=require(_0x8bba('0x4'));var rp=require(_0x8bba('0x5'));var fs=require('fs');var path=require(_0x8bba('0x6'));var rimraf=require(_0x8bba('0x7'));var config=require('../../config/environment');var attributes=require(_0x8bba('0x8'));module['exports']=function(_0x24394c,_0x3c19a4){return _0x24394c[_0x8bba('0x9')](_0x8bba('0xa'),attributes,{'tableName':_0x8bba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8bba('0xc'),'collate':_0x8bba('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0d6906b..ed218c6 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4627=['attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where'];(function(_0x16ccf2,_0x30b506){var _0x86ea1f=function(_0x5543b3){while(--_0x5543b3){_0x16ccf2['push'](_0x16ccf2['shift']());}};_0x86ea1f(++_0x30b506);}(_0x4627,0xda));var _0x7462=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x4627[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0x7462('0x0'));var util=require('util');var moment=require(_0x7462('0x1'));var BPromise=require(_0x7462('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7462('0x3'));var db=require(_0x7462('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7462('0x5'))(_0x7462('0x6'));var config=require(_0x7462('0x7'));var jayson=require(_0x7462('0x8'));var client=jayson[_0x7462('0x9')][_0x7462('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd572e,_0x62ed35,_0x4e5962){return new BPromise(function(_0x54572e,_0x83c3e6){return client[_0x7462('0xb')](_0xd572e,_0x4e5962)[_0x7462('0xc')](function(_0x27f1e8){logger[_0x7462('0xd')](_0x7462('0xe'),_0x62ed35,_0x7462('0xf'));logger[_0x7462('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x62ed35,_0x7462('0xf'),JSON[_0x7462('0x11')](_0x27f1e8));if(_0x27f1e8[_0x7462('0x12')]){if(_0x27f1e8['error'][_0x7462('0x13')]===0x1f4){logger[_0x7462('0x12')](_0x7462('0xe'),_0x62ed35,_0x27f1e8[_0x7462('0x12')]['message']);return _0x83c3e6(_0x27f1e8[_0x7462('0x12')][_0x7462('0x14')]);}logger[_0x7462('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x62ed35,_0x27f1e8['error'][_0x7462('0x14')]);return _0x54572e(_0x27f1e8['error']['message']);}else{logger['info'](_0x7462('0xe'),_0x62ed35,_0x7462('0xf'));_0x54572e(_0x27f1e8[_0x7462('0x15')][_0x7462('0x14')]);}})[_0x7462('0x16')](function(_0x45ca75){logger[_0x7462('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x62ed35,_0x45ca75);_0x83c3e6(_0x45ca75);});});}exports[_0x7462('0x17')]=function(_0x207b19){var _0x10b254=this;return new Promise(function(_0x575193,_0x27c9a2){return db[_0x7462('0x18')][_0x7462('0x19')](_0x207b19[_0x7462('0x1a')],{'raw':_0x207b19[_0x7462('0x1b')]?_0x207b19[_0x7462('0x1b')][_0x7462('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x207b19[_0x7462('0x1b')]?_0x207b19[_0x7462('0x1b')][_0x7462('0x1d')]||null:null,'attributes':_0x207b19[_0x7462('0x1b')]?_0x207b19['options'][_0x7462('0x1e')]||null:null,'limit':_0x207b19['options']?_0x207b19['options']['limit']||null:null})[_0x7462('0xc')](function(_0x2f9f02){logger[_0x7462('0xd')](_0x7462('0x17'),_0x207b19);logger['debug'](_0x7462('0x17'),_0x207b19,JSON[_0x7462('0x11')](_0x2f9f02));_0x575193(_0x2f9f02);})[_0x7462('0x16')](function(_0x47d911){logger[_0x7462('0x12')](_0x7462('0x17'),_0x47d911[_0x7462('0x14')],_0x207b19);_0x27c9a2(_0x10b254[_0x7462('0x12')](0x1f4,_0x47d911[_0x7462('0x14')]));});});}; \ No newline at end of file +var _0xc859=['message','result','catch','OpenchannelApplication,\x20%s,\x20%s','UpdateOpenchannelApplication','body','options','raw','attributes','limit','debug','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2dcdb3,_0x226ee8){var _0x90cd40=function(_0x2a66a6){while(--_0x2a66a6){_0x2dcdb3['push'](_0x2dcdb3['shift']());}};_0x90cd40(++_0x226ee8);}(_0xc859,0x182));var _0x9c85=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xc859[_0x3635ce];return _0x97ecd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9c85('0x0'));var rs=require(_0x9c85('0x1'));var fs=require('fs');var Redis=require(_0x9c85('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c85('0x3'));var logger=require(_0x9c85('0x4'))(_0x9c85('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea618,_0x3654f9,_0x1d866c){return new BPromise(function(_0x3d9b7f,_0x24cdb5){return client[_0x9c85('0x6')](_0x4ea618,_0x1d866c)[_0x9c85('0x7')](function(_0x2440d5){logger[_0x9c85('0x8')]('OpenchannelApplication,\x20%s,\x20%s',_0x3654f9,_0x9c85('0x9'));logger['debug'](_0x9c85('0xa'),_0x3654f9,_0x9c85('0x9'),JSON[_0x9c85('0xb')](_0x2440d5));if(_0x2440d5[_0x9c85('0xc')]){if(_0x2440d5[_0x9c85('0xc')][_0x9c85('0xd')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3654f9,_0x2440d5[_0x9c85('0xc')][_0x9c85('0xe')]);return _0x24cdb5(_0x2440d5[_0x9c85('0xc')][_0x9c85('0xe')]);}logger[_0x9c85('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x3654f9,_0x2440d5[_0x9c85('0xc')][_0x9c85('0xe')]);return _0x3d9b7f(_0x2440d5[_0x9c85('0xc')][_0x9c85('0xe')]);}else{logger[_0x9c85('0x8')]('OpenchannelApplication,\x20%s,\x20%s',_0x3654f9,_0x9c85('0x9'));_0x3d9b7f(_0x2440d5[_0x9c85('0xf')][_0x9c85('0xe')]);}})[_0x9c85('0x10')](function(_0x24d923){logger[_0x9c85('0xc')](_0x9c85('0x11'),_0x3654f9,_0x24d923);_0x24cdb5(_0x24d923);});});}exports[_0x9c85('0x12')]=function(_0x31c1c2){var _0x4bb54d=this;return new Promise(function(_0x18eb76,_0x17f43f){return db['OpenchannelApplication']['update'](_0x31c1c2[_0x9c85('0x13')],{'raw':_0x31c1c2[_0x9c85('0x14')]?_0x31c1c2['options'][_0x9c85('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31c1c2[_0x9c85('0x14')]?_0x31c1c2[_0x9c85('0x14')]['where']||null:null,'attributes':_0x31c1c2[_0x9c85('0x14')]?_0x31c1c2[_0x9c85('0x14')][_0x9c85('0x16')]||null:null,'limit':_0x31c1c2[_0x9c85('0x14')]?_0x31c1c2[_0x9c85('0x14')][_0x9c85('0x17')]||null:null})[_0x9c85('0x7')](function(_0x1aa86d){logger[_0x9c85('0x8')](_0x9c85('0x12'),_0x31c1c2);logger[_0x9c85('0x18')](_0x9c85('0x12'),_0x31c1c2,JSON['stringify'](_0x1aa86d));_0x18eb76(_0x1aa86d);})[_0x9c85('0x10')](function(_0x306030){logger['error']('UpdateOpenchannelApplication',_0x306030[_0x9c85('0xe')],_0x31c1c2);_0x17f43f(_0x4bb54d[_0x9c85('0xc')](0x1f4,_0x306030['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9abeaed..c4917b3 100644 --- a/server/api/openchannelInteraction/index.js +++ b/server/api/openchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad6b=['openchannel','openchannelinteraction:addtags','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','isAuthenticated','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x25378a,_0x3058b7){var _0x39e84a=function(_0x313d9d){while(--_0x313d9d){_0x25378a['push'](_0x25378a['shift']());}};_0x39e84a(++_0x3058b7);}(_0xad6b,0x94));var _0xbad6=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xad6b[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0xbad6('0x0'));var util=require('util');var path=require(_0xbad6('0x1'));var timeout=require(_0xbad6('0x2'));var express=require(_0xbad6('0x3'));var router=express['Router']();var fs_extra=require(_0xbad6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbad6('0x5'));var config=require(_0xbad6('0x6'));var controller=require(_0xbad6('0x7'));router[_0xbad6('0x8')]('/',auth['isAuthenticated'](),controller[_0xbad6('0x9')]);router[_0xbad6('0x8')]('/describe',auth[_0xbad6('0xa')](),controller['describe']);router[_0xbad6('0x8')](_0xbad6('0xb'),auth[_0xbad6('0xa')](),controller['show']);router[_0xbad6('0x8')](_0xbad6('0xc'),auth['isAuthenticated'](),controller[_0xbad6('0xd')]);router[_0xbad6('0x8')]('/:id/download',auth[_0xbad6('0xa')](),controller[_0xbad6('0xe')]);router[_0xbad6('0xf')]('/',auth[_0xbad6('0xa')](),controller[_0xbad6('0x10')]);router['post'](_0xbad6('0xc'),auth[_0xbad6('0xa')](),controller[_0xbad6('0x11')]);router[_0xbad6('0xf')](_0xbad6('0x12'),auth[_0xbad6('0xa')](),interaction[_0xbad6('0x13')](_0xbad6('0x14'),_0xbad6('0x15')),controller['addTags']);router['put'](_0xbad6('0xb'),auth[_0xbad6('0xa')](),interaction[_0xbad6('0x13')](_0xbad6('0x14'),_0xbad6('0x16')),controller[_0xbad6('0x17')]);router[_0xbad6('0x18')](_0xbad6('0xb'),auth[_0xbad6('0xa')](),interaction[_0xbad6('0x13')](_0xbad6('0x14'),'openchannelinteraction:destroy'),controller[_0xbad6('0x19')]);router[_0xbad6('0x18')](_0xbad6('0x12'),auth[_0xbad6('0xa')](),controller[_0xbad6('0x1a')]);module[_0xbad6('0x1b')]=router; \ No newline at end of file +var _0x5e5a=['/describe','isAuthenticated','describe','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','/:id','openchannelinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index'];(function(_0x402983,_0x5b1129){var _0x2dfa7e=function(_0x5d5757){while(--_0x5d5757){_0x402983['push'](_0x402983['shift']());}};_0x2dfa7e(++_0x5b1129);}(_0x5e5a,0x9d));var _0xa5e5=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x5e5a[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0xa5e5('0x0'));var util=require(_0xa5e5('0x1'));var path=require(_0xa5e5('0x2'));var timeout=require(_0xa5e5('0x3'));var express=require(_0xa5e5('0x4'));var router=express[_0xa5e5('0x5')]();var fs_extra=require(_0xa5e5('0x6'));var auth=require(_0xa5e5('0x7'));var interaction=require(_0xa5e5('0x8'));var config=require(_0xa5e5('0x9'));var controller=require(_0xa5e5('0xa'));router[_0xa5e5('0xb')]('/',auth['isAuthenticated'](),controller[_0xa5e5('0xc')]);router[_0xa5e5('0xb')](_0xa5e5('0xd'),auth[_0xa5e5('0xe')](),controller[_0xa5e5('0xf')]);router[_0xa5e5('0xb')]('/:id',auth[_0xa5e5('0xe')](),controller[_0xa5e5('0x10')]);router[_0xa5e5('0xb')](_0xa5e5('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa5e5('0xb')](_0xa5e5('0x12'),auth[_0xa5e5('0xe')](),controller[_0xa5e5('0x13')]);router[_0xa5e5('0x14')]('/',auth[_0xa5e5('0xe')](),controller[_0xa5e5('0x15')]);router['post']('/:id/messages',auth[_0xa5e5('0xe')](),controller[_0xa5e5('0x16')]);router[_0xa5e5('0x14')]('/:id/tags',auth[_0xa5e5('0xe')](),interaction[_0xa5e5('0x17')](_0xa5e5('0x18'),_0xa5e5('0x19')),controller[_0xa5e5('0x1a')]);router[_0xa5e5('0x1b')]('/:id',auth[_0xa5e5('0xe')](),interaction['tracked']('openchannel',_0xa5e5('0x1c')),controller['update']);router['delete'](_0xa5e5('0x1d'),auth[_0xa5e5('0xe')](),interaction[_0xa5e5('0x17')](_0xa5e5('0x18'),_0xa5e5('0x1e')),controller[_0xa5e5('0x1f')]);router['delete'](_0xa5e5('0x20'),auth[_0xa5e5('0xe')](),controller['removeTags']);module[_0xa5e5('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index c46c62d..248aa91 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.attributes.js +++ b/server/api/openchannelInteraction/openchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0884=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x247ada,_0x1e4bef){var _0x4c15fa=function(_0x16150e){while(--_0x16150e){_0x247ada['push'](_0x247ada['shift']());}};_0x4c15fa(++_0x1e4bef);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4088('0x0'));module[_0x4088('0x1')]={'closed':{'type':Sequelize[_0x4088('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4088('0x3')]},'disposition':{'type':Sequelize[_0x4088('0x4')]},'secondDisposition':{'type':Sequelize[_0x4088('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4088('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4088('0x3')]},'threadId':{'type':Sequelize[_0x4088('0x4')]},'externalUrl':{'type':Sequelize[_0x4088('0x4')]},'lastMsgAt':{'type':Sequelize[_0x4088('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4088('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4088('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x4088('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4627=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x24d9df,_0x571fa5){var _0x2c71d2=function(_0x341e91){while(--_0x341e91){_0x24d9df['push'](_0x24d9df['shift']());}};_0x2c71d2(++_0x571fa5);}(_0x4627,0x115));var _0x7462=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4627[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x7462('0x0'));module[_0x7462('0x1')]={'closed':{'type':Sequelize[_0x7462('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7462('0x3')]},'disposition':{'type':Sequelize[_0x7462('0x4')]},'secondDisposition':{'type':Sequelize[_0x7462('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7462('0x4')]},'note':{'type':Sequelize[_0x7462('0x4')]},'read1stAt':{'type':Sequelize[_0x7462('0x3')]},'threadId':{'type':Sequelize[_0x7462('0x4')]},'externalUrl':{'type':Sequelize[_0x7462('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7462('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7462('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7462('0x5')]('in',_0x7462('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7462('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7462('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3e68e25..17ba121 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.controller.js +++ b/server/api/openchannelInteraction/openchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaec5=['color','removeTags','unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','firstName','Contact','value','renderFile','views','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','findAll','openchannel','query','catch','from','params','keys','filters','model','attributes','intersection','fields','length','includeAll','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','order','sort','pick','OpenchannelInteractionId','filter','where','split','merge','include','rows','addTags','setTags','spread','Tag'];(function(_0x148ffe,_0x50f897){var _0x141d7f=function(_0x26ca03){while(--_0x26ca03){_0x148ffe['push'](_0x148ffe['shift']());}};_0x141d7f(++_0x50f897);}(_0xaec5,0x1bb));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x5aec('0x0'));var util=require(_0x5aec('0x1'));var path=require('path');var ejs=require(_0x5aec('0x2'));var fs=require('fs');var _=require(_0x5aec('0x3'));var Redis=require(_0x5aec('0x4'));var interaction=require(_0x5aec('0x5'));var qs=require(_0x5aec('0x6'));var pdf=require(_0x5aec('0x7'));var logger=require(_0x5aec('0x8'))(_0x5aec('0x9'));var config=require(_0x5aec('0xa'));var db=require(_0x5aec('0xb'))['db'];config[_0x5aec('0xc')]=_[_0x5aec('0xd')](config['redis'],{'host':_0x5aec('0xe'),'port':0x18eb});var socket=require(_0x5aec('0xf'))(new Redis(config['redis']));require(_0x5aec('0x10'))[_0x5aec('0x11')](socket);function respondWithStatusCode(_0x59c2be,_0x134d06){_0x134d06=_0x134d06||0xcc;return function(_0x439115){if(_0x439115){return _0x59c2be[_0x5aec('0x12')](_0x134d06);}return _0x59c2be[_0x5aec('0x13')](_0x134d06)[_0x5aec('0x14')]();};}function respondWithResult(_0x483d3b,_0x37fdf5){_0x37fdf5=_0x37fdf5||0xc8;return function(_0x33dfa6){if(_0x33dfa6){return _0x483d3b['status'](_0x37fdf5)[_0x5aec('0x15')](_0x33dfa6);}};}function respondWithFilteredResult(_0x2044e4,_0x5314ed){return function(_0x4518d3){if(_0x4518d3){var _0x5e95d8=typeof _0x5314ed['offset']===_0x5aec('0x16')&&typeof _0x5314ed[_0x5aec('0x17')]==='undefined';var _0x4d864c=_0x4518d3[_0x5aec('0x18')];var _0x14a3de=_0x5e95d8?0x0:_0x5314ed[_0x5aec('0x19')];var _0x1b9eee=_0x5e95d8?_0x4518d3['count']:_0x5314ed['offset']+_0x5314ed['limit'];var _0x54418d;if(_0x1b9eee>=_0x4d864c){_0x1b9eee=_0x4d864c;_0x54418d=0xc8;}else{_0x54418d=0xce;}_0x2044e4[_0x5aec('0x13')](_0x54418d);return _0x2044e4[_0x5aec('0x1a')](_0x5aec('0x1b'),_0x14a3de+'-'+_0x1b9eee+'/'+_0x4d864c)[_0x5aec('0x15')](_0x4518d3);}return null;};}function saveUpdates(_0x3a3a38){return function(_0x2c099a){if(_0x2c099a){return _0x2c099a[_0x5aec('0x1c')](_0x3a3a38)[_0x5aec('0x1d')](function(_0x3b4f30){return _0x3b4f30;});}return null;};}function removeEntity(_0xc6f5b3){return function(_0x3477db){if(_0x3477db){return _0x3477db[_0x5aec('0x1e')]()[_0x5aec('0x1d')](function(){_0xc6f5b3['status'](0xcc)[_0x5aec('0x14')]();});}};}function handleEntityNotFound(_0x2c5103){return function(_0x15f815){if(!_0x15f815){_0x2c5103[_0x5aec('0x12')](0x194);}return _0x15f815;};}function handleError(_0x460ad4,_0x2dadbe){_0x2dadbe=_0x2dadbe||0x1f4;return function(_0x1ebfb6){logger[_0x5aec('0x1f')](_0x1ebfb6[_0x5aec('0x20')]);if(_0x1ebfb6[_0x5aec('0x21')]){delete _0x1ebfb6['name'];}_0x460ad4[_0x5aec('0x13')](_0x2dadbe)[_0x5aec('0x22')](_0x1ebfb6);};}exports[_0x5aec('0x23')]=function(_0xc2816e,_0x2f6e6f){var _0x7a7210={};var _0x51b874=_[_0x5aec('0x24')](db[_0x5aec('0x25')][_0x5aec('0x26')],function(_0x41c870){return{'name':_0x41c870['fieldName'],'type':_0x41c870[_0x5aec('0x27')][_0x5aec('0x28')]};});_0x7a7210=qs[_0x5aec('0x29')](_0x51b874,_0xc2816e);return interaction[_0x5aec('0x2a')](_0x5aec('0x2b'),_0xc2816e[_0x5aec('0x2c')],_0xc2816e['user'],_0x7a7210,_0x51b874)[_0x5aec('0x1d')](respondWithFilteredResult(_0x2f6e6f,_0x7a7210))[_0x5aec('0x2d')](handleError(_0x2f6e6f,null));};exports['show']=function(_0xf7dc,_0x434c2b){var _0x2bde4f={};if(_0xf7dc[_0x5aec('0x2c')][_0x5aec('0x27')]&&_0xf7dc[_0x5aec('0x2c')][_0x5aec('0x27')]===_0x5aec('0x2e')){_0x2bde4f[_0x5aec('0x2e')]=_0xf7dc[_0x5aec('0x2f')]['id'];}else{_0x2bde4f['id']=_0xf7dc[_0x5aec('0x2f')]['id'];}var _0x8f2947={'raw':![],'where':_0x2bde4f},_0x394c9b={};_0x394c9b['model']=_['keys'](db['OpenchannelInteraction'][_0x5aec('0x26')]);_0x394c9b['query']=_[_0x5aec('0x30')](_0xf7dc[_0x5aec('0x2c')]);_0x394c9b[_0x5aec('0x31')]=_['intersection'](_0x394c9b[_0x5aec('0x32')],_0x394c9b['query']);_0x8f2947[_0x5aec('0x33')]=_[_0x5aec('0x34')](_0x394c9b[_0x5aec('0x32')],qs[_0x5aec('0x35')](_0xf7dc['query']['fields']));_0x8f2947[_0x5aec('0x33')]=_0x8f2947[_0x5aec('0x33')][_0x5aec('0x36')]?_0x8f2947[_0x5aec('0x33')]:_0x394c9b[_0x5aec('0x32')];if(_0xf7dc['query'][_0x5aec('0x37')]){_0x8f2947['include']=[{'all':!![]}];}_0x8f2947=_['merge']({},_0x8f2947,_0xf7dc[_0x5aec('0x38')]);return db[_0x5aec('0x25')][_0x5aec('0x39')](_0x8f2947)['then'](handleEntityNotFound(_0x434c2b,null))[_0x5aec('0x1d')](respondWithResult(_0x434c2b,null))[_0x5aec('0x2d')](handleError(_0x434c2b,null));};exports[_0x5aec('0x3a')]=function(_0xb2391e,_0x55e328){return db[_0x5aec('0x25')][_0x5aec('0x3a')](_0xb2391e[_0x5aec('0x3b')],{})[_0x5aec('0x1d')](respondWithResult(_0x55e328,0xc9))['catch'](handleError(_0x55e328,null));};exports[_0x5aec('0x1c')]=function(_0x541588,_0x48d068){if(_0x541588[_0x5aec('0x3b')]['id']){delete _0x541588[_0x5aec('0x3b')]['id'];}return db[_0x5aec('0x25')][_0x5aec('0x39')]({'where':{'id':_0x541588['params']['id']}})[_0x5aec('0x1d')](handleEntityNotFound(_0x48d068,null))[_0x5aec('0x1d')](saveUpdates(_0x541588[_0x5aec('0x3b')],null))[_0x5aec('0x1d')](respondWithResult(_0x48d068,null))[_0x5aec('0x2d')](handleError(_0x48d068,null));};exports['destroy']=function(_0x2bcf22,_0x469939){return db['OpenchannelInteraction'][_0x5aec('0x39')]({'where':{'id':_0x2bcf22[_0x5aec('0x2f')]['id']}})[_0x5aec('0x1d')](handleEntityNotFound(_0x469939,null))[_0x5aec('0x1d')](removeEntity(_0x469939,null))['catch'](handleError(_0x469939,null));};exports[_0x5aec('0x3c')]=function(_0x3700b7,_0xf063c2){return db[_0x5aec('0x25')][_0x5aec('0x3c')]()[_0x5aec('0x1d')](respondWithResult(_0xf063c2,null))[_0x5aec('0x2d')](handleError(_0xf063c2,null));};exports[_0x5aec('0x3d')]=function(_0x4ca11b,_0x50253d){return db[_0x5aec('0x3e')][_0x5aec('0x39')]({'where':{'id':_0x4ca11b['params']['id']}})[_0x5aec('0x1d')](handleEntityNotFound(_0x50253d,null))[_0x5aec('0x1d')](function(_0x154931){if(_0x154931){return _0x154931[_0x5aec('0x3d')](_0x4ca11b[_0x5aec('0x3b')][_0x5aec('0x3f')],_[_0x5aec('0x40')](_0x4ca11b[_0x5aec('0x3b')],[_0x5aec('0x3f'),'id'])||{});}})[_0x5aec('0x1d')](respondWithResult(_0x50253d,null))['catch'](handleError(_0x50253d,null));};exports[_0x5aec('0x41')]=function(_0x468e3e,_0x24ca33){var _0x29d583={'raw':![],'where':{}};var _0x288be9={};var _0x1800fd={'count':0x0,'rows':[]};return db[_0x5aec('0x25')][_0x5aec('0x42')]({'where':{'id':_0x468e3e[_0x5aec('0x2f')]['id']}})[_0x5aec('0x1d')](handleEntityNotFound(_0x24ca33,null))['then'](function(_0x2c65c8){if(_0x2c65c8){_0x288be9[_0x5aec('0x32')]=_[_0x5aec('0x30')](db[_0x5aec('0x3e')]['rawAttributes']);_0x288be9['query']=_[_0x5aec('0x30')](_0x468e3e[_0x5aec('0x2c')]);_0x288be9[_0x5aec('0x31')]=_['intersection'](_0x288be9[_0x5aec('0x32')],_0x288be9[_0x5aec('0x2c')]);_0x29d583[_0x5aec('0x33')]=_[_0x5aec('0x34')](_0x288be9['model'],qs[_0x5aec('0x35')](_0x468e3e[_0x5aec('0x2c')]['fields']));_0x29d583[_0x5aec('0x33')]=_0x29d583[_0x5aec('0x33')][_0x5aec('0x36')]?_0x29d583[_0x5aec('0x33')]:_0x288be9[_0x5aec('0x32')];if(!_0x468e3e[_0x5aec('0x2c')]['hasOwnProperty']('nolimit')){_0x29d583[_0x5aec('0x17')]=qs[_0x5aec('0x17')](_0x468e3e[_0x5aec('0x2c')][_0x5aec('0x17')]);_0x29d583[_0x5aec('0x19')]=qs[_0x5aec('0x19')](_0x468e3e[_0x5aec('0x2c')][_0x5aec('0x19')]);}_0x29d583[_0x5aec('0x43')]=qs[_0x5aec('0x44')](_0x468e3e['query'][_0x5aec('0x44')]);_0x29d583['where']=qs[_0x5aec('0x31')](_[_0x5aec('0x45')](_0x468e3e[_0x5aec('0x2c')],_0x288be9[_0x5aec('0x31')]));_0x29d583['where'][_0x5aec('0x46')]=_0x2c65c8['id'];if(_0x468e3e[_0x5aec('0x2c')][_0x5aec('0x47')]){_0x29d583['where']=_['merge'](_0x29d583[_0x5aec('0x48')],{'$or':_[_0x5aec('0x24')](_0x29d583[_0x5aec('0x33')],function(_0x114166){var _0x3c55be={};_0x3c55be[_0x114166]={'$like':'%'+_0x468e3e[_0x5aec('0x2c')][_0x5aec('0x47')]+'%'};return _0x3c55be;})});}if(_0x468e3e[_0x5aec('0x2c')]['$gte']){var _0x3c8857=_0x468e3e[_0x5aec('0x2c')]['$gte'][_0x5aec('0x49')](',');var _0x11d7e2={};_0x11d7e2[_0x3c8857[0x0]]={'$gte':moment(_0x3c8857[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x29d583[_0x5aec('0x48')]=_[_0x5aec('0x4a')](_0x29d583['where'],_0x11d7e2);}_0x29d583=_[_0x5aec('0x4a')]({},_0x29d583,_0x468e3e[_0x5aec('0x38')]);return db[_0x5aec('0x3e')][_0x5aec('0x18')]({'where':_0x29d583['where']})[_0x5aec('0x1d')](function(_0x49a5a1){_0x1800fd[_0x5aec('0x18')]=_0x49a5a1;if(_0x468e3e['query'][_0x5aec('0x37')]){_0x29d583[_0x5aec('0x4b')]=[{'all':!![]}];}return db[_0x5aec('0x3e')][_0x5aec('0x2a')](_0x29d583);})[_0x5aec('0x1d')](function(_0x4557a7){_0x1800fd[_0x5aec('0x4c')]=_0x4557a7;return _0x1800fd;});}})['then'](respondWithFilteredResult(_0x24ca33,_0x29d583))[_0x5aec('0x2d')](handleError(_0x24ca33,null));};exports[_0x5aec('0x4d')]=function(_0x3b3af8,_0x489d60){return db['OpenchannelInteraction'][_0x5aec('0x39')]({'where':{'id':_0x3b3af8[_0x5aec('0x2f')]['id']}})[_0x5aec('0x1d')](handleEntityNotFound(_0x489d60,null))[_0x5aec('0x1d')](function(_0x7a509b){if(_0x7a509b){return _0x7a509b[_0x5aec('0x4e')](_0x3b3af8[_0x5aec('0x3b')][_0x5aec('0x3f')],_[_0x5aec('0x40')](_0x3b3af8[_0x5aec('0x3b')],[_0x5aec('0x3f'),'id'])||{})[_0x5aec('0x4f')](function(){return db[_0x5aec('0x50')][_0x5aec('0x2a')]({'attributes':['id','name',_0x5aec('0x51')],'where':{'id':_0x3b3af8[_0x5aec('0x3b')]['ids']}});})[_0x5aec('0x1d')](function(_0x5783aa){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x3b3af8[_0x5aec('0x2f')]['id']),'tags':_0x5783aa||[]});return{'id':Number(_0x3b3af8['params']['id']),'tags':_0x5783aa||[]};});}})[_0x5aec('0x1d')](respondWithResult(_0x489d60,null))[_0x5aec('0x2d')](handleError(_0x489d60,null));};exports[_0x5aec('0x52')]=function(_0xb5d57a,_0x4b1e6e){return db[_0x5aec('0x25')][_0x5aec('0x39')]({'where':{'id':_0xb5d57a[_0x5aec('0x2f')]['id']}})[_0x5aec('0x1d')](handleEntityNotFound(_0x4b1e6e,null))[_0x5aec('0x1d')](function(_0x117d0c){if(_0x117d0c){return _0x117d0c[_0x5aec('0x52')](_0xb5d57a[_0x5aec('0x2c')][_0x5aec('0x3f')]);}})[_0x5aec('0x1d')](respondWithStatusCode(_0x4b1e6e,null))['catch'](handleError(_0x4b1e6e,null));};exports['download']=function(_0xeaec3e,_0x22b309){var _0x58e60b=moment()[_0x5aec('0x53')]()[_0x5aec('0x54')]();var _0x305c22=path['join'](config[_0x5aec('0x55')],_0x5aec('0x56'),_0x5aec('0x57'),'tmp');var _0x11d23b=path[_0x5aec('0x58')](config[_0x5aec('0x55')],_0x5aec('0x56'),_0x5aec('0x57'),_0x5aec('0x59'));var _0x318000=path[_0x5aec('0x58')](_0x305c22,_0x58e60b);var _0x48134d=util['format'](_0x5aec('0x5a'),_0xeaec3e[_0x5aec('0x2f')]['id'],_0x58e60b);var _0x5d5df2=path[_0x5aec('0x58')](_0x305c22,_0x48134d);var _0x3f44a5=[];_0x3f44a5[_0x5aec('0x5b')]({'model':db[_0x5aec('0x5c')],'as':_0x5aec('0x5c'),'attributes':['id',_0x5aec('0x5d')],'raw':!![]});_0x3f44a5[_0x5aec('0x5b')]({'model':db[_0x5aec('0x5e')],'as':'Contact','attributes':['id','firstName',_0x5aec('0x5f')],'raw':!![]});if(_0xeaec3e['query'][_0x5aec('0x59')]){_0x3f44a5[_0x5aec('0x5b')]({'model':db[_0x5aec('0x60')],'as':_0x5aec('0x60'),'raw':!![]});}var _0x12afc5=[{'model':db['OpenchannelMessage'],'as':_0x5aec('0x61'),'attributes':['id',_0x5aec('0x3b'),_0x5aec('0x62'),_0x5aec('0x63'),_0x5aec('0x64'),_0x5aec('0x65')],'include':_0x3f44a5}];_0x12afc5[_0x5aec('0x5b')]({'model':db[_0x5aec('0x66')],'as':_0x5aec('0x67'),'attributes':['id',_0x5aec('0x21')]});_0x12afc5[_0x5aec('0x5b')]({'model':db[_0x5aec('0x5c')],'as':_0x5aec('0x68'),'attributes':['id','fullname']});return db[_0x5aec('0x25')][_0x5aec('0x39')]({'where':{'id':_0xeaec3e['params']['id']},'include':_0x12afc5})[_0x5aec('0x1d')](handleEntityNotFound(_0x22b309,null))[_0x5aec('0x1d')](function(_0x3a3439){if(_0x3a3439){var _0x36b11b=_0x3a3439[_0x5aec('0x69')]({'plain':!![]});fs[_0x5aec('0x6a')](_0x318000);var _0x3b02cb={'channel':_0x5aec('0x6b'),'account':_0x36b11b[_0x5aec('0x67')][_0x5aec('0x21')],'agent':_0x36b11b['Owner']?_0x36b11b['Owner']['fullname']:_0x5aec('0x6c'),'createdAt':moment(_0x36b11b[_0x5aec('0x62')])[_0x5aec('0x6d')](_0x5aec('0x6e'))[_0x5aec('0x54')](),'closedAt':_0x36b11b[_0x5aec('0x6f')]?moment(_0x36b11b[_0x5aec('0x70')])[_0x5aec('0x6d')](_0x5aec('0x6e'))[_0x5aec('0x54')]():'','disposition':_0x36b11b[_0x5aec('0x71')],'visibility':_0x36b11b['threadId']?_0x5aec('0x72'):_0x5aec('0x73'),'messages':_(_0x36b11b[_0x5aec('0x61')])[_0x5aec('0x47')]({'secret':![]})[_0x5aec('0x24')](function(_0x3a05fb){if(_0x3a05fb[_0x5aec('0x60')]){var _0x4f8293=path[_0x5aec('0x58')](_0x11d23b,_0x3a05fb[_0x5aec('0x60')][_0x5aec('0x74')]);if(fs[_0x5aec('0x75')](_0x4f8293)){fs[_0x5aec('0x76')](_0x4f8293)['pipe'](fs[_0x5aec('0x77')](path[_0x5aec('0x58')](_0x318000,_0x3a05fb[_0x5aec('0x60')][_0x5aec('0x74')])));}}return{'date':moment(_0x3a05fb[_0x5aec('0x62')])[_0x5aec('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5aec('0x54')](),'sender':_0x3a05fb[_0x5aec('0x63')]===_0x5aec('0x78')?_0x3a05fb[_0x5aec('0x5c')]?_0x3a05fb[_0x5aec('0x5c')][_0x5aec('0x5d')]:_0x5aec('0x79'):_0x3a05fb['Contact'][_0x5aec('0x7a')]+(_0x3a05fb[_0x5aec('0x7b')]['lastName']?'\x20'+_0x3a05fb[_0x5aec('0x7b')][_0x5aec('0x5f')]:''),'body':_0x3a05fb['Attachment']?_0x3a05fb[_0x5aec('0x60')]['basename']:_0x3a05fb[_0x5aec('0x3b')],'direction':_0x3a05fb['direction']===_0x5aec('0x78')?'A':'C','secret':_0x3a05fb[_0x5aec('0x64')],'read':_0x3a05fb[_0x5aec('0x65')],'attachment':_0x3a05fb['Attachment']};})[_0x5aec('0x7c')]()};return ejs[_0x5aec('0x7d')](path[_0x5aec('0x58')](config[_0x5aec('0x55')],'server',_0x5aec('0x7e'),'downloadInteraction.ejs'),{'interaction':_0x3b02cb})['then'](function(_0x2ae7ab){var _0x4dc35e=path['join'](_0x318000,'transcript-'+_0x36b11b['id']+'-'+_0x58e60b+_0x5aec('0x7f'));var _0x4617e9={'path':_0x4dc35e,'channel':_0x5aec('0x6b'),'interactionId':_0x36b11b['id']};return pdf[_0x5aec('0x80')](_0x2ae7ab,_0x4617e9);})[_0x5aec('0x1d')](function(){return new Promise(function(_0x386e11,_0x1d03d3){zipdir(_0x318000,{'saveTo':_0x5d5df2},function(_0x599b73,_0x579abe){if(_0x599b73)return _0x1d03d3(_0x599b73);return _0x386e11(_0x579abe);});})[_0x5aec('0x1d')](function(){return new Promise(function(_0x4f1664,_0xd856c){rimraf(_0x318000,function(_0x2be5d9){if(_0x2be5d9)_0xd856c(_0x2be5d9);return _0x4f1664();});});})[_0x5aec('0x1d')](function(){return _0x22b309[_0x5aec('0x81')](_0x5d5df2,_0x48134d,function(_0x595244){if(_0x595244){logger[_0x5aec('0x1f')](_0x5aec('0x82'),_0x595244);}else{fs['unlinkSync'](_0x5d5df2);}});});});}else{return _0x22b309['sendStatus'](0xc8);}})[_0x5aec('0x2d')](handleError(_0x22b309,null));}; \ No newline at end of file +var _0x3e16=['closed','closedAt','disposition','threadId','Public','Private','filter','basename','createReadStream','pipe','createWriteStream','out','Contact','firstName','value','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','sendStatus','rimraf','zip-dir','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','end','error','stack','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','rows','setTags','spread','Tag','name','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','N.A.','toString'];(function(_0x563a3c,_0x30d52a){var _0x156a1=function(_0x62286){while(--_0x62286){_0x563a3c['push'](_0x563a3c['shift']());}};_0x156a1(++_0x30d52a);}(_0x3e16,0x11f));var _0x63e1=function(_0x34c1ac,_0x571dfe){_0x34c1ac=_0x34c1ac-0x0;var _0x16e2c1=_0x3e16[_0x34c1ac];return _0x16e2c1;};'use strict';var rimraf=require(_0x63e1('0x0'));var zipdir=require(_0x63e1('0x1'));var moment=require('moment');var util=require(_0x63e1('0x2'));var path=require(_0x63e1('0x3'));var ejs=require(_0x63e1('0x4'));var fs=require('fs');var _=require(_0x63e1('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x63e1('0x6'));var pdf=require(_0x63e1('0x7'));var logger=require(_0x63e1('0x8'))(_0x63e1('0x9'));var config=require(_0x63e1('0xa'));var db=require(_0x63e1('0xb'))['db'];config[_0x63e1('0xc')]=_[_0x63e1('0xd')](config['redis'],{'host':_0x63e1('0xe'),'port':0x18eb});var socket=require(_0x63e1('0xf'))(new Redis(config[_0x63e1('0xc')]));require(_0x63e1('0x10'))[_0x63e1('0x11')](socket);function respondWithStatusCode(_0x2bb6c2,_0x3f948d){_0x3f948d=_0x3f948d||0xcc;return function(_0xe01dcf){if(_0xe01dcf){return _0x2bb6c2['sendStatus'](_0x3f948d);}return _0x2bb6c2['status'](_0x3f948d)['end']();};}function respondWithResult(_0x3ff208,_0x247eae){_0x247eae=_0x247eae||0xc8;return function(_0x7e2e0a){if(_0x7e2e0a){return _0x3ff208[_0x63e1('0x12')](_0x247eae)[_0x63e1('0x13')](_0x7e2e0a);}};}function respondWithFilteredResult(_0x52bdef,_0x67fca0){return function(_0x3cafb7){if(_0x3cafb7){var _0x4fa8f6=typeof _0x67fca0['offset']===_0x63e1('0x14')&&typeof _0x67fca0[_0x63e1('0x15')]==='undefined';var _0x39dc1c=_0x3cafb7[_0x63e1('0x16')];var _0x551cfd=_0x4fa8f6?0x0:_0x67fca0[_0x63e1('0x17')];var _0x42abd9=_0x4fa8f6?_0x3cafb7[_0x63e1('0x16')]:_0x67fca0['offset']+_0x67fca0[_0x63e1('0x15')];var _0xfa6f37;if(_0x42abd9>=_0x39dc1c){_0x42abd9=_0x39dc1c;_0xfa6f37=0xc8;}else{_0xfa6f37=0xce;}_0x52bdef[_0x63e1('0x12')](_0xfa6f37);return _0x52bdef['set'](_0x63e1('0x18'),_0x551cfd+'-'+_0x42abd9+'/'+_0x39dc1c)[_0x63e1('0x13')](_0x3cafb7);}return null;};}function saveUpdates(_0x1a8dbb){return function(_0x30b26a){if(_0x30b26a){return _0x30b26a[_0x63e1('0x19')](_0x1a8dbb)[_0x63e1('0x1a')](function(_0x14a758){return _0x14a758;});}return null;};}function removeEntity(_0x518f9f){return function(_0x15a231){if(_0x15a231){return _0x15a231[_0x63e1('0x1b')]()['then'](function(){_0x518f9f[_0x63e1('0x12')](0xcc)[_0x63e1('0x1c')]();});}};}function handleEntityNotFound(_0x1696a9){return function(_0x553d7a){if(!_0x553d7a){_0x1696a9['sendStatus'](0x194);}return _0x553d7a;};}function handleError(_0x1c4fde,_0x464d32){_0x464d32=_0x464d32||0x1f4;return function(_0x1c01ec){logger[_0x63e1('0x1d')](_0x1c01ec[_0x63e1('0x1e')]);if(_0x1c01ec['name']){delete _0x1c01ec['name'];}_0x1c4fde[_0x63e1('0x12')](_0x464d32)['send'](_0x1c01ec);};}exports[_0x63e1('0x1f')]=function(_0xe5c095,_0x54cdab){var _0x5cc50f={};var _0x3d7ca5=_[_0x63e1('0x20')](db[_0x63e1('0x21')][_0x63e1('0x22')],function(_0x3cf832){return{'name':_0x3cf832[_0x63e1('0x23')],'type':_0x3cf832[_0x63e1('0x24')][_0x63e1('0x25')]};});_0x5cc50f=qs[_0x63e1('0x26')](_0x3d7ca5,_0xe5c095);return interaction[_0x63e1('0x27')](_0x63e1('0x28'),_0xe5c095[_0x63e1('0x29')],_0xe5c095[_0x63e1('0x2a')],_0x5cc50f,_0x3d7ca5)[_0x63e1('0x1a')](respondWithFilteredResult(_0x54cdab,_0x5cc50f))[_0x63e1('0x2b')](handleError(_0x54cdab,null));};exports[_0x63e1('0x2c')]=function(_0x3bf4fb,_0x1bc83b){var _0x13fa9a={};if(_0x3bf4fb['query'][_0x63e1('0x24')]&&_0x3bf4fb[_0x63e1('0x29')]['type']===_0x63e1('0x2d')){_0x13fa9a['from']=_0x3bf4fb[_0x63e1('0x2e')]['id'];}else{_0x13fa9a['id']=_0x3bf4fb[_0x63e1('0x2e')]['id'];}var _0x4a7c3c={'raw':![],'where':_0x13fa9a},_0x5687b0={};_0x5687b0[_0x63e1('0x2f')]=_[_0x63e1('0x30')](db['OpenchannelInteraction'][_0x63e1('0x22')]);_0x5687b0[_0x63e1('0x29')]=_[_0x63e1('0x30')](_0x3bf4fb[_0x63e1('0x29')]);_0x5687b0[_0x63e1('0x31')]=_[_0x63e1('0x32')](_0x5687b0[_0x63e1('0x2f')],_0x5687b0[_0x63e1('0x29')]);_0x4a7c3c[_0x63e1('0x33')]=_['intersection'](_0x5687b0[_0x63e1('0x2f')],qs[_0x63e1('0x34')](_0x3bf4fb[_0x63e1('0x29')][_0x63e1('0x34')]));_0x4a7c3c[_0x63e1('0x33')]=_0x4a7c3c[_0x63e1('0x33')][_0x63e1('0x35')]?_0x4a7c3c[_0x63e1('0x33')]:_0x5687b0[_0x63e1('0x2f')];if(_0x3bf4fb[_0x63e1('0x29')]['includeAll']){_0x4a7c3c[_0x63e1('0x36')]=[{'all':!![]}];}_0x4a7c3c=_[_0x63e1('0x37')]({},_0x4a7c3c,_0x3bf4fb[_0x63e1('0x38')]);return db[_0x63e1('0x21')][_0x63e1('0x39')](_0x4a7c3c)[_0x63e1('0x1a')](handleEntityNotFound(_0x1bc83b,null))[_0x63e1('0x1a')](respondWithResult(_0x1bc83b,null))['catch'](handleError(_0x1bc83b,null));};exports[_0x63e1('0x3a')]=function(_0x39b144,_0x4a232d){return db[_0x63e1('0x21')][_0x63e1('0x3a')](_0x39b144[_0x63e1('0x3b')],{})[_0x63e1('0x1a')](respondWithResult(_0x4a232d,0xc9))[_0x63e1('0x2b')](handleError(_0x4a232d,null));};exports[_0x63e1('0x19')]=function(_0xa98ef3,_0x3a24c4){if(_0xa98ef3['body']['id']){delete _0xa98ef3[_0x63e1('0x3b')]['id'];}return db[_0x63e1('0x21')][_0x63e1('0x39')]({'where':{'id':_0xa98ef3[_0x63e1('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3a24c4,null))['then'](saveUpdates(_0xa98ef3[_0x63e1('0x3b')],null))[_0x63e1('0x1a')](respondWithResult(_0x3a24c4,null))[_0x63e1('0x2b')](handleError(_0x3a24c4,null));};exports['destroy']=function(_0x491c95,_0x36d08a){return db['OpenchannelInteraction'][_0x63e1('0x39')]({'where':{'id':_0x491c95[_0x63e1('0x2e')]['id']}})['then'](handleEntityNotFound(_0x36d08a,null))[_0x63e1('0x1a')](removeEntity(_0x36d08a,null))[_0x63e1('0x2b')](handleError(_0x36d08a,null));};exports[_0x63e1('0x3c')]=function(_0x356daf,_0x22e489){return db[_0x63e1('0x21')][_0x63e1('0x3c')]()[_0x63e1('0x1a')](respondWithResult(_0x22e489,null))['catch'](handleError(_0x22e489,null));};exports['addMessage']=function(_0x381a6c,_0x2c0522){return db['OpenchannelMessage'][_0x63e1('0x39')]({'where':{'id':_0x381a6c[_0x63e1('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2c0522,null))[_0x63e1('0x1a')](function(_0x588947){if(_0x588947){return _0x588947[_0x63e1('0x3d')](_0x381a6c[_0x63e1('0x3b')][_0x63e1('0x3e')],_[_0x63e1('0x3f')](_0x381a6c['body'],[_0x63e1('0x3e'),'id'])||{});}})[_0x63e1('0x1a')](respondWithResult(_0x2c0522,null))[_0x63e1('0x2b')](handleError(_0x2c0522,null));};exports[_0x63e1('0x40')]=function(_0x216679,_0x205d87){var _0x589862={'raw':![],'where':{}};var _0x4321d4={};var _0x3546e7={'count':0x0,'rows':[]};return db[_0x63e1('0x21')][_0x63e1('0x41')]({'where':{'id':_0x216679['params']['id']}})[_0x63e1('0x1a')](handleEntityNotFound(_0x205d87,null))[_0x63e1('0x1a')](function(_0x3077a2){if(_0x3077a2){_0x4321d4[_0x63e1('0x2f')]=_[_0x63e1('0x30')](db['OpenchannelMessage'][_0x63e1('0x22')]);_0x4321d4[_0x63e1('0x29')]=_[_0x63e1('0x30')](_0x216679['query']);_0x4321d4['filters']=_[_0x63e1('0x32')](_0x4321d4[_0x63e1('0x2f')],_0x4321d4[_0x63e1('0x29')]);_0x589862[_0x63e1('0x33')]=_['intersection'](_0x4321d4[_0x63e1('0x2f')],qs[_0x63e1('0x34')](_0x216679[_0x63e1('0x29')]['fields']));_0x589862[_0x63e1('0x33')]=_0x589862['attributes']['length']?_0x589862['attributes']:_0x4321d4[_0x63e1('0x2f')];if(!_0x216679['query'][_0x63e1('0x42')](_0x63e1('0x43'))){_0x589862[_0x63e1('0x15')]=qs[_0x63e1('0x15')](_0x216679[_0x63e1('0x29')][_0x63e1('0x15')]);_0x589862['offset']=qs[_0x63e1('0x17')](_0x216679[_0x63e1('0x29')][_0x63e1('0x17')]);}_0x589862[_0x63e1('0x44')]=qs[_0x63e1('0x45')](_0x216679['query'][_0x63e1('0x45')]);_0x589862[_0x63e1('0x46')]=qs[_0x63e1('0x31')](_[_0x63e1('0x47')](_0x216679[_0x63e1('0x29')],_0x4321d4['filters']));_0x589862['where']['OpenchannelInteractionId']=_0x3077a2['id'];if(_0x216679[_0x63e1('0x29')]['filter']){_0x589862[_0x63e1('0x46')]=_[_0x63e1('0x37')](_0x589862['where'],{'$or':_[_0x63e1('0x20')](_0x589862[_0x63e1('0x33')],function(_0x401cbf){var _0x2b9c3b={};_0x2b9c3b[_0x401cbf]={'$like':'%'+_0x216679[_0x63e1('0x29')]['filter']+'%'};return _0x2b9c3b;})});}if(_0x216679[_0x63e1('0x29')][_0x63e1('0x48')]){var _0x57dc95=_0x216679[_0x63e1('0x29')][_0x63e1('0x48')][_0x63e1('0x49')](',');var _0x477c62={};_0x477c62[_0x57dc95[0x0]]={'$gte':moment(_0x57dc95[0x1])[_0x63e1('0x4a')](_0x63e1('0x4b'))};_0x589862[_0x63e1('0x46')]=_['merge'](_0x589862[_0x63e1('0x46')],_0x477c62);}_0x589862=_[_0x63e1('0x37')]({},_0x589862,_0x216679[_0x63e1('0x38')]);return db[_0x63e1('0x4c')][_0x63e1('0x16')]({'where':_0x589862[_0x63e1('0x46')]})[_0x63e1('0x1a')](function(_0x3bc2a7){_0x3546e7[_0x63e1('0x16')]=_0x3bc2a7;if(_0x216679[_0x63e1('0x29')]['includeAll']){_0x589862[_0x63e1('0x36')]=[{'all':!![]}];}return db[_0x63e1('0x4c')][_0x63e1('0x27')](_0x589862);})['then'](function(_0xfe0c97){_0x3546e7[_0x63e1('0x4d')]=_0xfe0c97;return _0x3546e7;});}})[_0x63e1('0x1a')](respondWithFilteredResult(_0x205d87,_0x589862))[_0x63e1('0x2b')](handleError(_0x205d87,null));};exports['addTags']=function(_0x2bb1ee,_0x589a00){return db[_0x63e1('0x21')][_0x63e1('0x39')]({'where':{'id':_0x2bb1ee[_0x63e1('0x2e')]['id']}})['then'](handleEntityNotFound(_0x589a00,null))[_0x63e1('0x1a')](function(_0x1bcbc7){if(_0x1bcbc7){return _0x1bcbc7[_0x63e1('0x4e')](_0x2bb1ee[_0x63e1('0x3b')][_0x63e1('0x3e')],_[_0x63e1('0x3f')](_0x2bb1ee[_0x63e1('0x3b')],[_0x63e1('0x3e'),'id'])||{})[_0x63e1('0x4f')](function(){return db[_0x63e1('0x50')][_0x63e1('0x27')]({'attributes':['id',_0x63e1('0x51'),'color'],'where':{'id':_0x2bb1ee['body'][_0x63e1('0x3e')]}});})[_0x63e1('0x1a')](function(_0x4ea963){socket[_0x63e1('0x52')]('openchannelInteractionTags:save',{'id':Number(_0x2bb1ee['params']['id']),'tags':_0x4ea963||[]});return{'id':Number(_0x2bb1ee['params']['id']),'tags':_0x4ea963||[]};});}})[_0x63e1('0x1a')](respondWithResult(_0x589a00,null))[_0x63e1('0x2b')](handleError(_0x589a00,null));};exports['removeTags']=function(_0x27666c,_0x1c8e4f){return db[_0x63e1('0x21')][_0x63e1('0x39')]({'where':{'id':_0x27666c[_0x63e1('0x2e')]['id']}})[_0x63e1('0x1a')](handleEntityNotFound(_0x1c8e4f,null))[_0x63e1('0x1a')](function(_0x19365f){if(_0x19365f){return _0x19365f[_0x63e1('0x53')](_0x27666c[_0x63e1('0x29')][_0x63e1('0x3e')]);}})[_0x63e1('0x1a')](respondWithStatusCode(_0x1c8e4f,null))[_0x63e1('0x2b')](handleError(_0x1c8e4f,null));};exports[_0x63e1('0x54')]=function(_0x29d7bb,_0x31e2dc){var _0x34139=moment()[_0x63e1('0x55')]()['toString']();var _0x54ff09=path[_0x63e1('0x56')](config[_0x63e1('0x57')],_0x63e1('0x58'),_0x63e1('0x59'),'tmp');var _0x2859dd=path['join'](config[_0x63e1('0x57')],_0x63e1('0x58'),_0x63e1('0x59'),_0x63e1('0x5a'));var _0x181a68=path[_0x63e1('0x56')](_0x54ff09,_0x34139);var _0x39bc39=util[_0x63e1('0x4a')](_0x63e1('0x5b'),_0x29d7bb[_0x63e1('0x2e')]['id'],_0x34139);var _0x295c6a=path[_0x63e1('0x56')](_0x54ff09,_0x39bc39);var _0x2ccb22=[];_0x2ccb22['push']({'model':db[_0x63e1('0x5c')],'as':_0x63e1('0x5c'),'attributes':['id',_0x63e1('0x5d')],'raw':!![]});_0x2ccb22[_0x63e1('0x5e')]({'model':db[_0x63e1('0x5f')],'as':'Contact','attributes':['id','firstName',_0x63e1('0x60')],'raw':!![]});if(_0x29d7bb[_0x63e1('0x29')][_0x63e1('0x5a')]){_0x2ccb22[_0x63e1('0x5e')]({'model':db[_0x63e1('0x61')],'as':'Attachment','raw':!![]});}var _0x2183a2=[{'model':db[_0x63e1('0x4c')],'as':_0x63e1('0x62'),'attributes':['id',_0x63e1('0x3b'),_0x63e1('0x63'),_0x63e1('0x64'),_0x63e1('0x65'),_0x63e1('0x66')],'include':_0x2ccb22}];_0x2183a2['push']({'model':db[_0x63e1('0x67')],'as':_0x63e1('0x68'),'attributes':['id',_0x63e1('0x51')]});_0x2183a2[_0x63e1('0x5e')]({'model':db[_0x63e1('0x5c')],'as':_0x63e1('0x69'),'attributes':['id',_0x63e1('0x5d')]});return db[_0x63e1('0x21')][_0x63e1('0x39')]({'where':{'id':_0x29d7bb[_0x63e1('0x2e')]['id']},'include':_0x2183a2})[_0x63e1('0x1a')](handleEntityNotFound(_0x31e2dc,null))[_0x63e1('0x1a')](function(_0x45f9e7){if(_0x45f9e7){var _0x2eb631=_0x45f9e7[_0x63e1('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x181a68);var _0xb9a0af={'channel':'Openchannel','account':_0x2eb631[_0x63e1('0x68')][_0x63e1('0x51')],'agent':_0x2eb631[_0x63e1('0x69')]?_0x2eb631[_0x63e1('0x69')][_0x63e1('0x5d')]:_0x63e1('0x6b'),'createdAt':moment(_0x2eb631['createdAt'])['format'](_0x63e1('0x4b'))[_0x63e1('0x6c')](),'closedAt':_0x2eb631[_0x63e1('0x6d')]?moment(_0x2eb631[_0x63e1('0x6e')])[_0x63e1('0x4a')](_0x63e1('0x4b'))['toString']():'','disposition':_0x2eb631[_0x63e1('0x6f')],'visibility':_0x2eb631[_0x63e1('0x70')]?_0x63e1('0x71'):_0x63e1('0x72'),'messages':_(_0x2eb631[_0x63e1('0x62')])[_0x63e1('0x73')]({'secret':![]})[_0x63e1('0x20')](function(_0x5c5f3d){if(_0x5c5f3d['Attachment']){var _0x3c3ff2=path[_0x63e1('0x56')](_0x2859dd,_0x5c5f3d[_0x63e1('0x61')][_0x63e1('0x74')]);if(fs['existsSync'](_0x3c3ff2)){fs[_0x63e1('0x75')](_0x3c3ff2)[_0x63e1('0x76')](fs[_0x63e1('0x77')](path[_0x63e1('0x56')](_0x181a68,_0x5c5f3d[_0x63e1('0x61')][_0x63e1('0x74')])));}}return{'date':moment(_0x5c5f3d[_0x63e1('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x5c5f3d['direction']===_0x63e1('0x78')?_0x5c5f3d[_0x63e1('0x5c')]?_0x5c5f3d[_0x63e1('0x5c')][_0x63e1('0x5d')]:'System':_0x5c5f3d[_0x63e1('0x79')][_0x63e1('0x7a')]+(_0x5c5f3d[_0x63e1('0x79')]['lastName']?'\x20'+_0x5c5f3d[_0x63e1('0x79')]['lastName']:''),'body':_0x5c5f3d['Attachment']?_0x5c5f3d[_0x63e1('0x61')][_0x63e1('0x74')]:_0x5c5f3d[_0x63e1('0x3b')],'direction':_0x5c5f3d['direction']===_0x63e1('0x78')?'A':'C','secret':_0x5c5f3d['secret'],'read':_0x5c5f3d[_0x63e1('0x66')],'attachment':_0x5c5f3d[_0x63e1('0x61')]};})[_0x63e1('0x7b')]()};return ejs['renderFile'](path['join'](config['root'],_0x63e1('0x58'),_0x63e1('0x7c'),_0x63e1('0x7d')),{'interaction':_0xb9a0af})['then'](function(_0x3b96c9){var _0x51991a=path[_0x63e1('0x56')](_0x181a68,_0x63e1('0x7e')+_0x2eb631['id']+'-'+_0x34139+_0x63e1('0x7f'));var _0x203ad6={'path':_0x51991a,'channel':_0x63e1('0x80'),'interactionId':_0x2eb631['id']};return pdf[_0x63e1('0x81')](_0x3b96c9,_0x203ad6);})[_0x63e1('0x1a')](function(){return new Promise(function(_0x2bdfd0,_0x4c026f){zipdir(_0x181a68,{'saveTo':_0x295c6a},function(_0x5e5807,_0x536287){if(_0x5e5807)return _0x4c026f(_0x5e5807);return _0x2bdfd0(_0x536287);});})[_0x63e1('0x1a')](function(){return new Promise(function(_0x583e55,_0x4a43f8){rimraf(_0x181a68,function(_0xae57aa){if(_0xae57aa)_0x4a43f8(_0xae57aa);return _0x583e55();});});})[_0x63e1('0x1a')](function(){return _0x31e2dc[_0x63e1('0x54')](_0x295c6a,_0x39bc39,function(_0x56c4cd){if(_0x56c4cd){logger[_0x63e1('0x1d')](_0x63e1('0x82'),_0x56c4cd);}else{fs['unlinkSync'](_0x295c6a);}});});});}else{return _0x31e2dc[_0x63e1('0x83')](0xc8);}})[_0x63e1('0x2b')](handleError(_0x31e2dc,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7c64516..4a450f1 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.events.js +++ b/server/api/openchannelInteraction/openchannelInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf96a=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','setDataValue','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf96a,0x7c));var _0xaf96=function(_0x6d9e0c,_0x2373bb){_0x6d9e0c=_0x6d9e0c-0x0;var _0x485a1b=_0xf96a[_0x6d9e0c];return _0x485a1b;};'use strict';var EventEmitter=require(_0xaf96('0x0'));var OpenchannelInteraction=require(_0xaf96('0x1'))['db'][_0xaf96('0x2')];var OpenchannelMessage=require(_0xaf96('0x1'))['db'][_0xaf96('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xaf96('0x4')](0x0);var events={'afterCreate':_0xaf96('0x5'),'afterUpdate':_0xaf96('0x6'),'afterDestroy':_0xaf96('0x7')};function emitEvent(_0x367979){return function(_0x5e9aeb,_0x169ce3,_0x1b93e9){_0x5e9aeb[_0xaf96('0x8')]({'attributes':['id'],'raw':!![]})[_0xaf96('0x9')](function(_0x50c55f){_0x5e9aeb['setDataValue'](_0xaf96('0xa'),_0x50c55f[_0xaf96('0xb')](function(_0x137b7b){return{'id':_0x137b7b['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5e9aeb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaf96('0x9')](function(_0x316454){_0x5e9aeb[_0xaf96('0xc')]('unreadMessages',_0x316454[_0xaf96('0xd')]);OpenchannelInteractionEvents[_0xaf96('0xe')](_0x367979+':'+_0x5e9aeb['id'],_0x5e9aeb);OpenchannelInteractionEvents[_0xaf96('0xe')](_0x367979,_0x5e9aeb);_0x1b93e9(null);})[_0xaf96('0xf')](_0x1b93e9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xaf96('0x10')](e,emitEvent(event));}}module[_0xaf96('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x0427=['save','update','getUsers','then','Users','map','findAll','setDataValue','emit','catch','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x0427,0x6c));var _0x7042=function(_0x336a97,_0x47419b){_0x336a97=_0x336a97-0x0;var _0x5827b7=_0x0427[_0x336a97];return _0x5827b7;};'use strict';var EventEmitter=require(_0x7042('0x0'));var OpenchannelInteraction=require(_0x7042('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x7042('0x1'))['db'][_0x7042('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7042('0x3')](0x0);var events={'afterCreate':_0x7042('0x4'),'afterUpdate':_0x7042('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1ab30e){return function(_0x1c9b6f,_0x1dad4d,_0xb6e6e1){_0x1c9b6f[_0x7042('0x6')]({'attributes':['id'],'raw':!![]})[_0x7042('0x7')](function(_0x121be1){_0x1c9b6f['setDataValue'](_0x7042('0x8'),_0x121be1[_0x7042('0x9')](function(_0x1d34ae){return{'id':_0x1d34ae['id']};}));return OpenchannelMessage[_0x7042('0xa')]({'where':{'OpenchannelInteractionId':_0x1c9b6f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7042('0x7')](function(_0x117abf){_0x1c9b6f[_0x7042('0xb')]('unreadMessages',_0x117abf['length']);OpenchannelInteractionEvents[_0x7042('0xc')](_0x1ab30e+':'+_0x1c9b6f['id'],_0x1c9b6f);OpenchannelInteractionEvents[_0x7042('0xc')](_0x1ab30e,_0x1c9b6f);_0xb6e6e1(null);})[_0x7042('0xd')](_0xb6e6e1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x7042('0xe')](e,emitEvent(event));}}module[_0x7042('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 17eb02c..361f288 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.model.js +++ b/server/api/openchannelInteraction/openchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57d7=['bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0xcec086,_0x9ff0dd){var _0x35a377=function(_0x1a6e7e){while(--_0x1a6e7e){_0xcec086['push'](_0xcec086['shift']());}};_0x35a377(++_0x9ff0dd);}(_0x57d7,0x73));var _0x757d=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x57d7[_0x1db481];return _0x3db95b;};'use strict';var _=require(_0x757d('0x0'));var util=require(_0x757d('0x1'));var logger=require(_0x757d('0x2'))(_0x757d('0x3'));var moment=require(_0x757d('0x4'));var BPromise=require(_0x757d('0x5'));var rp=require(_0x757d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x757d('0x7'));var config=require(_0x757d('0x8'));var attributes=require(_0x757d('0x9'));module[_0x757d('0xa')]=function(_0x5a3f03,_0x3a22a1){return _0x5a3f03['define'](_0x757d('0xb'),attributes,{'tableName':_0x757d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x757d('0xd'),'collate':_0x757d('0xe'),'hooks':{'beforeUpdate':function(_0x35cdfa,_0x3d2931,_0x13a20c){if(_0x35cdfa[_0x757d('0xf')](_0x757d('0x10'))){_0x35cdfa[_0x757d('0x11')]=moment()[_0x757d('0x12')](_0x757d('0x13'));}_0x13a20c(null,_0x35cdfa);}}});}; \ No newline at end of file +var _0x8bd6=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x32ea52,_0xa05db2){var _0x4590e1=function(_0x33b56f){while(--_0x33b56f){_0x32ea52['push'](_0x32ea52['shift']());}};_0x4590e1(++_0xa05db2);}(_0x8bd6,0x98));var _0x68bd=function(_0x25a392,_0x36d3b2){_0x25a392=_0x25a392-0x0;var _0x5e2ee3=_0x8bd6[_0x25a392];return _0x5e2ee3;};'use strict';var _=require('lodash');var util=require(_0x68bd('0x0'));var logger=require(_0x68bd('0x1'))(_0x68bd('0x2'));var moment=require(_0x68bd('0x3'));var BPromise=require(_0x68bd('0x4'));var rp=require(_0x68bd('0x5'));var fs=require('fs');var path=require(_0x68bd('0x6'));var rimraf=require(_0x68bd('0x7'));var config=require(_0x68bd('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x68bd('0x9')]=function(_0x45f8be,_0x47087c){return _0x45f8be[_0x68bd('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x68bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x68bd('0xc'),'collate':_0x68bd('0xd'),'hooks':{'beforeUpdate':function(_0x328224,_0x1af195,_0x5edef5){if(_0x328224[_0x68bd('0xe')](_0x68bd('0xf'))){_0x328224[_0x68bd('0x10')]=moment()[_0x68bd('0x11')](_0x68bd('0x12'));}_0x5edef5(null,_0x328224);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 043b8e3..a7e683e 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.rpc.js +++ b/server/api/openchannelInteraction/openchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bf1=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x1d606d,_0x376e51){var _0x3c38bd=function(_0x2ea4e2){while(--_0x2ea4e2){_0x1d606d['push'](_0x1d606d['shift']());}};_0x3c38bd(++_0x376e51);}(_0x1bf1,0x1ea));var _0x11bf=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0x1bf1[_0x440917];return _0x5e906b;};'use strict';var _=require(_0x11bf('0x0'));var util=require(_0x11bf('0x1'));var moment=require('moment');var BPromise=require(_0x11bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11bf('0x3'));var db=require(_0x11bf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x11bf('0x5'))(_0x11bf('0x6'));var config=require(_0x11bf('0x7'));var jayson=require(_0x11bf('0x8'));var client=jayson[_0x11bf('0x9')][_0x11bf('0xa')]({'port':0x232a});config['redis']=_[_0x11bf('0xb')](config['redis'],{'host':_0x11bf('0xc'),'port':0x18eb});var socket=require(_0x11bf('0xd'))(new Redis(config[_0x11bf('0xe')]));require(_0x11bf('0xf'))[_0x11bf('0x10')](socket);function respondWithRpcPromise(_0x32e7ea,_0x508565,_0x726881){return new BPromise(function(_0x347217,_0x436a9b){return client[_0x11bf('0x11')](_0x32e7ea,_0x726881)[_0x11bf('0x12')](function(_0x19aa5c){logger['info'](_0x11bf('0x13'),_0x508565,_0x11bf('0x14'));logger[_0x11bf('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x508565,_0x11bf('0x14'),JSON[_0x11bf('0x16')](_0x19aa5c));if(_0x19aa5c[_0x11bf('0x17')]){if(_0x19aa5c[_0x11bf('0x17')]['code']===0x1f4){logger[_0x11bf('0x17')](_0x11bf('0x13'),_0x508565,_0x19aa5c[_0x11bf('0x17')][_0x11bf('0x18')]);return _0x436a9b(_0x19aa5c[_0x11bf('0x17')][_0x11bf('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x508565,_0x19aa5c[_0x11bf('0x17')][_0x11bf('0x18')]);return _0x347217(_0x19aa5c['error'][_0x11bf('0x18')]);}else{logger[_0x11bf('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x508565,'request\x20sent');_0x347217(_0x19aa5c['result']['message']);}})[_0x11bf('0x1a')](function(_0xbde63){logger[_0x11bf('0x17')](_0x11bf('0x13'),_0x508565,_0xbde63);_0x436a9b(_0xbde63);});});}exports['UpdateOpenchannelInteraction']=function(_0x4c1d8f){var _0x4e6a8e=this;return new Promise(function(_0x2f5af3,_0x4157ee){return db['OpenchannelInteraction'][_0x11bf('0x1b')](_0x4c1d8f[_0x11bf('0x1c')],{'raw':_0x4c1d8f[_0x11bf('0x1d')]?_0x4c1d8f[_0x11bf('0x1d')][_0x11bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c1d8f[_0x11bf('0x1d')]?_0x4c1d8f[_0x11bf('0x1d')][_0x11bf('0x1f')]||null:null,'attributes':_0x4c1d8f[_0x11bf('0x1d')]?_0x4c1d8f['options'][_0x11bf('0x20')]||null:null,'limit':_0x4c1d8f[_0x11bf('0x1d')]?_0x4c1d8f[_0x11bf('0x1d')][_0x11bf('0x21')]||null:null})['then'](function(_0x2c6361){logger[_0x11bf('0x19')](_0x11bf('0x22'),_0x4c1d8f);logger[_0x11bf('0x15')](_0x11bf('0x22'),_0x4c1d8f,JSON[_0x11bf('0x16')](_0x2c6361));_0x2f5af3(_0x2c6361);})[_0x11bf('0x1a')](function(_0x41547e){logger[_0x11bf('0x17')](_0x11bf('0x22'),_0x41547e['message'],_0x4c1d8f);_0x4157ee(_0x4e6a8e[_0x11bf('0x17')](0x1f4,_0x41547e[_0x11bf('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x5cbfcd){return new Promise(function(_0x2adab3,_0x2b0183){return db['OpenchannelInteraction'][_0x11bf('0x23')]({'where':_0x5cbfcd[_0x11bf('0x1d')]?_0x5cbfcd[_0x11bf('0x1d')][_0x11bf('0x1f')]||null:null})[_0x11bf('0x12')](function(_0x288d35){if(_0x288d35){return _0x288d35[_0x11bf('0x24')](_0x5cbfcd['body'][_0x11bf('0x25')],_[_0x11bf('0x26')](_0x5cbfcd[_0x11bf('0x1c')],[_0x11bf('0x25'),'id'])||{});}})[_0x11bf('0x27')](function(_0x20dcd2){logger[_0x11bf('0x19')](_0x11bf('0x28'),_0x5cbfcd);logger[_0x11bf('0x15')](_0x11bf('0x28'),_0x5cbfcd,JSON[_0x11bf('0x16')](_0x20dcd2));_0x2adab3(_0x20dcd2);})[_0x11bf('0x1a')](function(_0x387f22){logger['error']('AddTags',_0x387f22[_0x11bf('0x18')],_0x5cbfcd);_0x2b0183(_this[_0x11bf('0x17')](0x1f4,_0x387f22[_0x11bf('0x18')]));});});}; \ No newline at end of file +var _0xfb5a=['options','raw','where','attributes','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','info','OpenchannelInteraction','body'];(function(_0x191828,_0x3614f9){var _0x29e588=function(_0xa0837e){while(--_0xa0837e){_0x191828['push'](_0x191828['shift']());}};_0x29e588(++_0x3614f9);}(_0xfb5a,0x1ec));var _0xafb5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfb5a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xafb5('0x0'));var BPromise=require(_0xafb5('0x1'));var rs=require(_0xafb5('0x2'));var fs=require('fs');var Redis=require(_0xafb5('0x3'));var db=require(_0xafb5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xafb5('0x5'))(_0xafb5('0x6'));var config=require(_0xafb5('0x7'));var jayson=require(_0xafb5('0x8'));var client=jayson[_0xafb5('0x9')]['http']({'port':0x232a});config[_0xafb5('0xa')]=_['defaults'](config[_0xafb5('0xa')],{'host':_0xafb5('0xb'),'port':0x18eb});var socket=require(_0xafb5('0xc'))(new Redis(config['redis']));require(_0xafb5('0xd'))[_0xafb5('0xe')](socket);function respondWithRpcPromise(_0x16a8f9,_0x53ca8f,_0x2c9277){return new BPromise(function(_0x45bcea,_0x370dee){return client['request'](_0x16a8f9,_0x2c9277)[_0xafb5('0xf')](function(_0x52b25b){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x53ca8f,'request\x20sent');logger[_0xafb5('0x10')](_0xafb5('0x11'),_0x53ca8f,_0xafb5('0x12'),JSON[_0xafb5('0x13')](_0x52b25b));if(_0x52b25b['error']){if(_0x52b25b[_0xafb5('0x14')]['code']===0x1f4){logger[_0xafb5('0x14')](_0xafb5('0x15'),_0x53ca8f,_0x52b25b[_0xafb5('0x14')][_0xafb5('0x16')]);return _0x370dee(_0x52b25b[_0xafb5('0x14')][_0xafb5('0x16')]);}logger[_0xafb5('0x14')](_0xafb5('0x15'),_0x53ca8f,_0x52b25b[_0xafb5('0x14')][_0xafb5('0x16')]);return _0x45bcea(_0x52b25b['error'][_0xafb5('0x16')]);}else{logger[_0xafb5('0x17')](_0xafb5('0x15'),_0x53ca8f,'request\x20sent');_0x45bcea(_0x52b25b['result'][_0xafb5('0x16')]);}})['catch'](function(_0x29361a){logger[_0xafb5('0x14')](_0xafb5('0x15'),_0x53ca8f,_0x29361a);_0x370dee(_0x29361a);});});}exports['UpdateOpenchannelInteraction']=function(_0x174332){var _0x553c19=this;return new Promise(function(_0x2eace9,_0x1b2841){return db[_0xafb5('0x18')]['update'](_0x174332[_0xafb5('0x19')],{'raw':_0x174332[_0xafb5('0x1a')]?_0x174332[_0xafb5('0x1a')][_0xafb5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x174332[_0xafb5('0x1a')]?_0x174332[_0xafb5('0x1a')][_0xafb5('0x1c')]||null:null,'attributes':_0x174332[_0xafb5('0x1a')]?_0x174332['options'][_0xafb5('0x1d')]||null:null,'limit':_0x174332[_0xafb5('0x1a')]?_0x174332[_0xafb5('0x1a')]['limit']||null:null})[_0xafb5('0xf')](function(_0x177970){logger[_0xafb5('0x17')](_0xafb5('0x1e'),_0x174332);logger[_0xafb5('0x10')](_0xafb5('0x1e'),_0x174332,JSON[_0xafb5('0x13')](_0x177970));_0x2eace9(_0x177970);})[_0xafb5('0x1f')](function(_0x42346c){logger[_0xafb5('0x14')](_0xafb5('0x1e'),_0x42346c[_0xafb5('0x16')],_0x174332);_0x1b2841(_0x553c19[_0xafb5('0x14')](0x1f4,_0x42346c[_0xafb5('0x16')]));});});};exports[_0xafb5('0x20')]=function(_0x39e986){return new Promise(function(_0x3a16c8,_0x3d89e7){return db[_0xafb5('0x18')][_0xafb5('0x21')]({'where':_0x39e986[_0xafb5('0x1a')]?_0x39e986['options']['where']||null:null})[_0xafb5('0xf')](function(_0x3603aa){if(_0x3603aa){return _0x3603aa['addTags'](_0x39e986[_0xafb5('0x19')]['ids'],_[_0xafb5('0x22')](_0x39e986['body'],['ids','id'])||{});}})[_0xafb5('0x23')](function(_0x314424){logger['info'](_0xafb5('0x24'),_0x39e986);logger[_0xafb5('0x10')]('AddTags',_0x39e986,JSON[_0xafb5('0x13')](_0x314424));_0x3a16c8(_0x314424);})[_0xafb5('0x1f')](function(_0x24048b){logger[_0xafb5('0x14')](_0xafb5('0x24'),_0x24048b['message'],_0x39e986);_0x3d89e7(_this['error'](0x1f4,_0x24048b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9ec8597..240ac03 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.socket.js +++ b/server/api/openchannelInteraction/openchannelInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36af=['save','remove','update','register','length','./openchannelInteraction.events'];(function(_0x25ecc7,_0x240e49){var _0x54a86e=function(_0x31ee20){while(--_0x31ee20){_0x25ecc7['push'](_0x25ecc7['shift']());}};_0x54a86e(++_0x240e49);}(_0x36af,0xb3));var _0xf36a=function(_0x417279,_0x235e39){_0x417279=_0x417279-0x0;var _0x12205d=_0x36af[_0x417279];return _0x12205d;};'use strict';var OpenchannelInteractionEvents=require(_0xf36a('0x0'));var events=[_0xf36a('0x1'),_0xf36a('0x2'),_0xf36a('0x3')];function createListener(_0x526d9e,_0x1aaa47){return function(_0x2a5d84){_0x1aaa47['emit'](_0x526d9e,_0x2a5d84);};}function removeListener(_0x3d78c3,_0x25b257){return function(){OpenchannelInteractionEvents['removeListener'](_0x3d78c3,_0x25b257);};}exports[_0xf36a('0x4')]=function(_0x3caba0){for(var _0x40ada4=0x0,_0x4b2569=events[_0xf36a('0x5')];_0x40ada4<_0x4b2569;_0x40ada4++){var _0x311266=events[_0x40ada4];var _0x4b0060=createListener('openchannelInteraction:'+_0x311266,_0x3caba0);OpenchannelInteractionEvents['on'](_0x311266,_0x4b0060);}}; \ No newline at end of file +var _0x0863=['./openchannelInteraction.events','update','emit'];(function(_0x1661aa,_0x20b2c6){var _0x521ba8=function(_0x46ed5a){while(--_0x46ed5a){_0x1661aa['push'](_0x1661aa['shift']());}};_0x521ba8(++_0x20b2c6);}(_0x0863,0x102));var _0x3086=function(_0xed7460,_0x435f2d){_0xed7460=_0xed7460-0x0;var _0x4236ed=_0x0863[_0xed7460];return _0x4236ed;};'use strict';var OpenchannelInteractionEvents=require(_0x3086('0x0'));var events=['save','remove',_0x3086('0x1')];function createListener(_0xf06686,_0x276460){return function(_0x44607d){_0x276460[_0x3086('0x2')](_0xf06686,_0x44607d);};}function removeListener(_0x3a6ba2,_0x3a7f97){return function(){OpenchannelInteractionEvents['removeListener'](_0x3a6ba2,_0x3a7f97);};}exports['register']=function(_0xe0d56){for(var _0x373a0f=0x0,_0x3d03fb=events['length'];_0x373a0f<_0x3d03fb;_0x373a0f++){var _0x515a99=events[_0x373a0f];var _0x39cf46=createListener('openchannelInteraction:'+_0x515a99,_0xe0d56);OpenchannelInteractionEvents['on'](_0x515a99,_0x39cf46);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1292cd4..e7f4667 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x3708f0,_0x32a16a){_0x3708f0=_0x3708f0-0x0;var _0x55eff0=_0x70e0[_0x3708f0];return _0x55eff0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x305bd8,_0x49f432){_0x305bd8=_0x305bd8-0x0;var _0x4804ad=_0x70e0[_0x305bd8];return _0x4804ad;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 8274864..d554a12 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb4=['sequelize','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x349da4,_0x483cac){var _0x29f9de=function(_0x480483){while(--_0x480483){_0x349da4['push'](_0x349da4['shift']());}};_0x29f9de(++_0x483cac);}(_0x0bb4,0x77));var _0x40bb=function(_0x400ce9,_0x3feba3){_0x400ce9=_0x400ce9-0x0;var _0x1e7b4b=_0x0bb4[_0x400ce9];return _0x1e7b4b;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'body':{'type':Sequelize['TEXT'](_0x40bb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x40bb('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x40bb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x40bb('0x4')]('in','out'),'defaultValue':_0x40bb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x40bb('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8164=['out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x4b941a,_0x4be70){var _0x282020=function(_0x3df69b){while(--_0x3df69b){_0x4b941a['push'](_0x4b941a['shift']());}};_0x282020(++_0x4be70);}(_0x8164,0x170));var _0x4816=function(_0x1e0a4a,_0x55752e){_0x1e0a4a=_0x1e0a4a-0x0;var _0x352afd=_0x8164[_0x1e0a4a];return _0x352afd;};'use strict';var Sequelize=require(_0x4816('0x0'));module[_0x4816('0x1')]={'body':{'type':Sequelize[_0x4816('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4816('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4816('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4816('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x4816('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 5085718..e202782 100644 --- a/server/api/openchannelMessage/openchannelMessage.controller.js +++ b/server/api/openchannelMessage/openchannelMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec66=['rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','QueryTypes','email'];(function(_0x2697a9,_0x53c4b8){var _0x198bb0=function(_0x893bbc){while(--_0x893bbc){_0x2697a9['push'](_0x2697a9['shift']());}};_0x198bb0(++_0x53c4b8);}(_0xec66,0x103));var _0x6ec6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xec66[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x6ec6('0x0'));var rimraf=require(_0x6ec6('0x1'));var zipdir=require(_0x6ec6('0x2'));var jsonpatch=require(_0x6ec6('0x3'));var rp=require('request-promise');var moment=require(_0x6ec6('0x4'));var BPromise=require(_0x6ec6('0x5'));var Mustache=require(_0x6ec6('0x6'));var util=require('util');var path=require(_0x6ec6('0x7'));var sox=require('sox');var csv=require(_0x6ec6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ec6('0x9'));var _=require(_0x6ec6('0xa'));var squel=require(_0x6ec6('0xb'));var crypto=require(_0x6ec6('0xc'));var jsforce=require(_0x6ec6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6ec6('0xe'));var Redis=require(_0x6ec6('0xf'));var authService=require(_0x6ec6('0x10'));var qs=require(_0x6ec6('0x11'));var as=require(_0x6ec6('0x12'));var hardwareService=require(_0x6ec6('0x13'));var logger=require(_0x6ec6('0x14'))(_0x6ec6('0x15'));var utils=require(_0x6ec6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6ec6('0x17'));var db=require(_0x6ec6('0x18'))['db'];config[_0x6ec6('0x19')]=_[_0x6ec6('0x1a')](config[_0x6ec6('0x19')],{'host':_0x6ec6('0x1b'),'port':0x18eb});var socket=require(_0x6ec6('0x1c'))(new Redis(config[_0x6ec6('0x19')]));require(_0x6ec6('0x1d'))[_0x6ec6('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6ec6('0x1f')]({'port':0x232c});var client9002=jayson[_0x6ec6('0x20')][_0x6ec6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xa570b1,_0x25d68e,_0x3c591d,_0x5317dd){return new BPromise(function(_0x12ad2f,_0x15962f){var _0x53de27=_0x5317dd||client;return _0x53de27['request'](_0xa570b1,_0x3c591d)[_0x6ec6('0x21')](function(_0x1ef506){logger[_0x6ec6('0x22')](_0x6ec6('0x23'),_0x25d68e,_0x6ec6('0x24'));logger['debug'](_0x6ec6('0x25'),_0x25d68e,_0x6ec6('0x24'),JSON[_0x6ec6('0x26')](_0x1ef506));if(_0x1ef506[_0x6ec6('0x27')]){if(_0x1ef506[_0x6ec6('0x27')][_0x6ec6('0x28')]===0x1f4){logger[_0x6ec6('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x25d68e,_0x1ef506[_0x6ec6('0x27')][_0x6ec6('0x29')]);return _0x15962f(_0x1ef506['error'][_0x6ec6('0x29')]);}logger[_0x6ec6('0x27')](_0x6ec6('0x23'),_0x25d68e,_0x1ef506[_0x6ec6('0x27')][_0x6ec6('0x29')]);return _0x12ad2f(_0x1ef506[_0x6ec6('0x27')]['message']);}else{logger[_0x6ec6('0x22')](_0x6ec6('0x23'),_0x25d68e,_0x6ec6('0x24'));_0x12ad2f(_0x1ef506[_0x6ec6('0x2a')][_0x6ec6('0x29')]);}})[_0x6ec6('0x2b')](function(_0x25c32d){logger[_0x6ec6('0x27')](_0x6ec6('0x23'),_0x25d68e,_0x25c32d);_0x15962f(_0x25c32d);});});}function respondWithStatusCode(_0x48c4ca,_0x6b0fd4){_0x6b0fd4=_0x6b0fd4||0xcc;return function(_0x52be7d){if(_0x52be7d){return _0x48c4ca[_0x6ec6('0x2c')](_0x6b0fd4);}return _0x48c4ca[_0x6ec6('0x2d')](_0x6b0fd4)[_0x6ec6('0x2e')]();};}function respondWithResult(_0x470fd2,_0x43c5ee){_0x43c5ee=_0x43c5ee||0xc8;return function(_0x4d1c8a){if(_0x4d1c8a){return _0x470fd2['status'](_0x43c5ee)[_0x6ec6('0x2f')](_0x4d1c8a);}};}function respondWithFilteredResult(_0x580d3a,_0x2df116){return function(_0x4b20e4){if(_0x4b20e4){var _0x40cd1c=typeof _0x2df116[_0x6ec6('0x30')]==='undefined'&&typeof _0x2df116[_0x6ec6('0x31')]==='undefined';var _0x5a85e1=_0x4b20e4[_0x6ec6('0x32')];var _0x18917f=_0x40cd1c?0x0:_0x2df116['offset'];var _0x27dd22=_0x40cd1c?_0x4b20e4[_0x6ec6('0x32')]:_0x2df116[_0x6ec6('0x30')]+_0x2df116[_0x6ec6('0x31')];var _0x42717b;if(_0x27dd22>=_0x5a85e1){_0x27dd22=_0x5a85e1;_0x42717b=0xc8;}else{_0x42717b=0xce;}_0x580d3a['status'](_0x42717b);return _0x580d3a[_0x6ec6('0x33')](_0x6ec6('0x34'),_0x18917f+'-'+_0x27dd22+'/'+_0x5a85e1)[_0x6ec6('0x2f')](_0x4b20e4);}return null;};}function patchUpdates(_0x4078b9){return function(_0x53cbed){try{jsonpatch['apply'](_0x53cbed,_0x4078b9,!![]);}catch(_0x5365d9){return BPromise['reject'](_0x5365d9);}return _0x53cbed['save']();};}function saveUpdates(_0xae11e6,_0x1e443f){return function(_0x1dbd8d){if(_0x1dbd8d){return _0x1dbd8d[_0x6ec6('0x35')](_0xae11e6)[_0x6ec6('0x21')](function(_0x59cb7b){return _0x59cb7b;});}return null;};}function removeEntity(_0x15db21,_0x586dd6){return function(_0xb20f4e){if(_0xb20f4e){return _0xb20f4e[_0x6ec6('0x36')]()['then'](function(){_0x15db21['status'](0xcc)[_0x6ec6('0x2e')]();});}};}function handleEntityNotFound(_0x458e61,_0x4cc0ae){return function(_0x475db6){if(!_0x475db6){_0x458e61[_0x6ec6('0x2c')](0x194);}return _0x475db6;};}function handleError(_0x3bdf7e,_0x5edfda){_0x5edfda=_0x5edfda||0x1f4;return function(_0x366864){logger[_0x6ec6('0x27')](_0x366864[_0x6ec6('0x37')]);if(_0x366864[_0x6ec6('0x38')]){delete _0x366864[_0x6ec6('0x38')];}_0x3bdf7e['status'](_0x5edfda)[_0x6ec6('0x39')](_0x366864);};}exports[_0x6ec6('0x3a')]=function(_0x4fe81f,_0x1c565e){var _0x5871af={},_0x5e4563={},_0x5b89d6={'count':0x0,'rows':[]};var _0x12b0f8=_[_0x6ec6('0x3b')](db[_0x6ec6('0x3c')]['rawAttributes'],function(_0x1257b9){return{'name':_0x1257b9[_0x6ec6('0x3d')],'type':_0x1257b9[_0x6ec6('0x3e')][_0x6ec6('0x3f')]};});_0x5e4563['model']=_[_0x6ec6('0x3b')](_0x12b0f8,'name');_0x5e4563[_0x6ec6('0x40')]=_[_0x6ec6('0x41')](_0x4fe81f[_0x6ec6('0x40')]);_0x5e4563[_0x6ec6('0x42')]=_[_0x6ec6('0x43')](_0x5e4563['model'],_0x5e4563[_0x6ec6('0x40')]);_0x5871af[_0x6ec6('0x44')]=_[_0x6ec6('0x43')](_0x5e4563[_0x6ec6('0x45')],qs[_0x6ec6('0x46')](_0x4fe81f[_0x6ec6('0x40')][_0x6ec6('0x46')]));_0x5871af[_0x6ec6('0x44')]=_0x5871af[_0x6ec6('0x44')][_0x6ec6('0x47')]?_0x5871af[_0x6ec6('0x44')]:_0x5e4563[_0x6ec6('0x45')];if(!_0x4fe81f[_0x6ec6('0x40')]['hasOwnProperty']('nolimit')){_0x5871af['limit']=qs[_0x6ec6('0x31')](_0x4fe81f[_0x6ec6('0x40')][_0x6ec6('0x31')]);_0x5871af[_0x6ec6('0x30')]=qs[_0x6ec6('0x30')](_0x4fe81f[_0x6ec6('0x40')][_0x6ec6('0x30')]);}_0x5871af[_0x6ec6('0x48')]=qs['sort'](_0x4fe81f[_0x6ec6('0x40')][_0x6ec6('0x49')]);_0x5871af[_0x6ec6('0x4a')]=qs[_0x6ec6('0x42')](_[_0x6ec6('0x4b')](_0x4fe81f[_0x6ec6('0x40')],_0x5e4563[_0x6ec6('0x42')]),_0x12b0f8);if(_0x4fe81f[_0x6ec6('0x40')][_0x6ec6('0x4c')]){_0x5871af[_0x6ec6('0x4a')]=_[_0x6ec6('0x4d')](_0x5871af[_0x6ec6('0x4a')],{'$or':_[_0x6ec6('0x3b')](_0x12b0f8,function(_0x24cfa5){if(_0x24cfa5[_0x6ec6('0x3e')]!==_0x6ec6('0x4e')){var _0x55ab50={};_0x55ab50[_0x24cfa5[_0x6ec6('0x38')]]={'$like':'%'+_0x4fe81f[_0x6ec6('0x40')][_0x6ec6('0x4c')]+'%'};return _0x55ab50;}})});}_0x5871af=_[_0x6ec6('0x4d')]({},_0x5871af,_0x4fe81f[_0x6ec6('0x4f')]);var _0x5f565b={'where':_0x5871af[_0x6ec6('0x4a')]};return db[_0x6ec6('0x3c')][_0x6ec6('0x32')](_0x5f565b)[_0x6ec6('0x21')](function(_0x1a7a8e){_0x5b89d6['count']=_0x1a7a8e;if(_0x4fe81f[_0x6ec6('0x40')][_0x6ec6('0x50')]){_0x5871af[_0x6ec6('0x51')]=[{'all':!![]}];}return db[_0x6ec6('0x3c')][_0x6ec6('0x52')](_0x5871af);})[_0x6ec6('0x21')](function(_0x404e40){_0x5b89d6[_0x6ec6('0x53')]=_0x404e40;return _0x5b89d6;})[_0x6ec6('0x21')](respondWithFilteredResult(_0x1c565e,_0x5871af))[_0x6ec6('0x2b')](handleError(_0x1c565e,null));};exports[_0x6ec6('0x54')]=function(_0x55a1ce,_0x148cdf){var _0x138f7d={'raw':!![],'where':{'id':_0x55a1ce[_0x6ec6('0x55')]['id']}},_0x3400ec={};_0x3400ec[_0x6ec6('0x45')]=_[_0x6ec6('0x41')](db['OpenchannelMessage']['rawAttributes']);_0x3400ec[_0x6ec6('0x40')]=_[_0x6ec6('0x41')](_0x55a1ce['query']);_0x3400ec['filters']=_[_0x6ec6('0x43')](_0x3400ec['model'],_0x3400ec[_0x6ec6('0x40')]);_0x138f7d['attributes']=_[_0x6ec6('0x43')](_0x3400ec[_0x6ec6('0x45')],qs[_0x6ec6('0x46')](_0x55a1ce[_0x6ec6('0x40')][_0x6ec6('0x46')]));_0x138f7d[_0x6ec6('0x44')]=_0x138f7d[_0x6ec6('0x44')]['length']?_0x138f7d[_0x6ec6('0x44')]:_0x3400ec[_0x6ec6('0x45')];if(_0x55a1ce[_0x6ec6('0x40')]['includeAll']){_0x138f7d[_0x6ec6('0x51')]=[{'all':!![]}];}_0x138f7d=_[_0x6ec6('0x4d')]({},_0x138f7d,_0x55a1ce[_0x6ec6('0x4f')]);return db['OpenchannelMessage'][_0x6ec6('0x56')](_0x138f7d)[_0x6ec6('0x21')](handleEntityNotFound(_0x148cdf,null))['then'](respondWithResult(_0x148cdf,null))[_0x6ec6('0x2b')](handleError(_0x148cdf,null));};exports[_0x6ec6('0x57')]=function(_0x286e87,_0x37d042){return db[_0x6ec6('0x3c')]['create'](_0x286e87['body'],{})[_0x6ec6('0x21')](respondWithResult(_0x37d042,0xc9))['catch'](handleError(_0x37d042,null));};exports[_0x6ec6('0x35')]=function(_0x4b3ad7,_0x5e6742){if(_0x4b3ad7[_0x6ec6('0x58')]['id']){delete _0x4b3ad7[_0x6ec6('0x58')]['id'];}return db[_0x6ec6('0x3c')]['find']({'where':{'id':_0x4b3ad7[_0x6ec6('0x55')]['id']}})[_0x6ec6('0x21')](handleEntityNotFound(_0x5e6742,null))['then'](saveUpdates(_0x4b3ad7[_0x6ec6('0x58')],null))[_0x6ec6('0x21')](respondWithResult(_0x5e6742,null))[_0x6ec6('0x2b')](handleError(_0x5e6742,null));};exports[_0x6ec6('0x36')]=function(_0x1363f4,_0x1857c6){return db['OpenchannelMessage'][_0x6ec6('0x56')]({'where':{'id':_0x1363f4[_0x6ec6('0x55')]['id']}})['then'](handleEntityNotFound(_0x1857c6,null))[_0x6ec6('0x21')](removeEntity(_0x1857c6,null))[_0x6ec6('0x2b')](handleError(_0x1857c6,null));};exports[_0x6ec6('0x59')]=function(_0x36d4ff,_0x4693eb){return db[_0x6ec6('0x3c')][_0x6ec6('0x59')]()['then'](respondWithResult(_0x4693eb,null))['catch'](handleError(_0x4693eb,null));};var interaction_log=require(_0x6ec6('0x14'))(_0x6ec6('0x5a'));exports[_0x6ec6('0x5b')]=function(_0x1bbd57,_0x12c498,_0x35eadf){var _0x450797={'agent':{},'channel':_0x6ec6('0x5c')};if(_0x1bbd57[_0x6ec6('0x58')]['id']){delete _0x1bbd57['body']['id'];}_0x1bbd57[_0x6ec6('0x58')][_0x6ec6('0x5d')]=!![];_0x1bbd57[_0x6ec6('0x58')][_0x6ec6('0x5e')]=moment()[_0x6ec6('0x5f')](_0x6ec6('0x60'));_0x1bbd57['body'][_0x6ec6('0x61')]=_0x1bbd57[_0x6ec6('0x58')]['UserId']||_0x1bbd57[_0x6ec6('0x62')]['id'];_0x450797[_0x6ec6('0x63')]['id']=_0x1bbd57[_0x6ec6('0x58')][_0x6ec6('0x61')];return db[_0x6ec6('0x3c')][_0x6ec6('0x56')]({'where':{'id':_0x1bbd57[_0x6ec6('0x55')]['id'],'UserId':null}})[_0x6ec6('0x21')](handleEntityNotFound(_0x12c498,null))[_0x6ec6('0x21')](saveUpdates(_0x1bbd57['body'],null))[_0x6ec6('0x21')](function(_0x3d08bf){if(_0x3d08bf){_0x450797['message']=_0x3d08bf[_0x6ec6('0x64')]({'plain':!![]});return db[_0x6ec6('0x65')][_0x6ec6('0x56')]({'where':{'id':_0x3d08bf[_0x6ec6('0x66')]}});}return null;})[_0x6ec6('0x21')](handleEntityNotFound(_0x12c498,null))[_0x6ec6('0x21')](function(_0x3ca1d8){if(_0x3ca1d8){return _0x3ca1d8[_0x6ec6('0x35')]({'UserId':_0x1bbd57['body'][_0x6ec6('0x61')],'read1stAt':_[_0x6ec6('0x67')](_0x3ca1d8['read1stAt'])?moment()[_0x6ec6('0x5f')](_0x6ec6('0x60')):undefined});}return null;})[_0x6ec6('0x21')](function(_0x21cbe9){if(_0x21cbe9){_0x450797['interaction']=_0x21cbe9['get']({'plain':!![]});interaction_log[_0x6ec6('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1bbd57[_0x6ec6('0x62')]['id'],_0x1bbd57[_0x6ec6('0x62')][_0x6ec6('0x38')],_0x1bbd57['user'][_0x6ec6('0x68')],_0x450797[_0x6ec6('0x69')]['id'],_0x1bbd57[_0x6ec6('0x58')]?JSON[_0x6ec6('0x26')](_0x1bbd57[_0x6ec6('0x58')]):_0x6ec6('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x6ec6('0x6b'),_0x450797);}return null;})[_0x6ec6('0x21')](function(_0x49df15){var _0x40ea34=_0x6ec6('0x6c')+_0x49df15[_0x6ec6('0x29')]['ContactId'];return db[_0x6ec6('0x6d')][_0x6ec6('0x40')](_0x40ea34,{'type':db[_0x6ec6('0x6e')]['QueryTypes'][_0x6ec6('0x6f')],'raw':!![]})[_0x6ec6('0x21')](function(_0x6ca246){return _0x6ca246;});})[_0x6ec6('0x21')](function(_0xf2d880){if(_0xf2d880){_0x450797[_0x6ec6('0x29')][_0x6ec6('0x70')]=_0xf2d880[0x0];if(!_0x1bbd57['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x1bbd57[_0x6ec6('0x58')][_0x6ec6('0x61')],'role':'agent'},'attributes':['id','name',_0x6ec6('0x71'),'email',_0x6ec6('0x72')],'raw':!![]});}return null;})[_0x6ec6('0x21')](function(_0x516e01){if(!_0x516e01)return null;_0x450797['message']['agent']=_0x516e01;return _0x450797;})[_0x6ec6('0x21')](function(_0x10dd84){if(_0x10dd84){if(_0x1bbd57[_0x6ec6('0x58')][_0x6ec6('0x73')]){_0x450797[_0x6ec6('0x29')][_0x6ec6('0x74')]=util[_0x6ec6('0x5f')](_0x6ec6('0x75'),_0x1bbd57[_0x6ec6('0x62')]['name']);_0x450797['message'][_0x6ec6('0x76')]=_0x450797[_0x6ec6('0x76')];_0x450797[_0x6ec6('0x29')][_0x6ec6('0x77')]=_0x450797[_0x6ec6('0x76')];_0x450797[_0x6ec6('0x29')][_0x6ec6('0x78')]='accept';return respondWithRpcPromise(_0x6ec6('0x79'),_0x6ec6('0x79'),{'event':_0x6ec6('0x7a'),'message':_0x450797[_0x6ec6('0x29')]},client9002)[_0x6ec6('0x21')](function(){return _0x450797;});}return _0x450797;}return null;})['then'](respondWithResult(_0x12c498,null))[_0x6ec6('0x2b')](handleError(_0x12c498,null));};var interaction_log=require('../../config/logger')(_0x6ec6('0x5a'));exports['reject']=function(_0xd9afe5,_0x31f2cd,_0x9a1320){var _0x2a65f3={'agent':{},'channel':_0x6ec6('0x5c')};if(_0xd9afe5[_0x6ec6('0x58')]['id']){delete _0xd9afe5[_0x6ec6('0x58')]['id'];}_0xd9afe5[_0x6ec6('0x58')][_0x6ec6('0x61')]=_0xd9afe5['body'][_0x6ec6('0x61')]||_0xd9afe5[_0x6ec6('0x62')]['id'];_0x2a65f3[_0x6ec6('0x63')]['id']=_0xd9afe5[_0x6ec6('0x58')][_0x6ec6('0x61')];return db[_0x6ec6('0x3c')]['find']({'where':{'id':_0xd9afe5[_0x6ec6('0x55')]['id'],'UserId':null}})[_0x6ec6('0x21')](handleEntityNotFound(_0x31f2cd,null))[_0x6ec6('0x21')](function(_0x3e4c08){if(_0x3e4c08){_0x2a65f3[_0x6ec6('0x29')]=_0x3e4c08[_0x6ec6('0x64')]({'plain':!![]});return db[_0x6ec6('0x65')][_0x6ec6('0x56')]({'where':{'id':_0x3e4c08[_0x6ec6('0x66')]}});}return null;})[_0x6ec6('0x21')](handleEntityNotFound(_0x31f2cd,null))[_0x6ec6('0x21')](function(_0x14daa5){if(_0x14daa5){_0x2a65f3['interaction']=_0x14daa5[_0x6ec6('0x64')]({'plain':!![]});interaction_log[_0x6ec6('0x22')](_0x6ec6('0x7b'),_0xd9afe5[_0x6ec6('0x62')]['id'],_0xd9afe5[_0x6ec6('0x62')]['name'],_0xd9afe5[_0x6ec6('0x62')][_0x6ec6('0x68')],_0x2a65f3['interaction']['id'],_0xd9afe5[_0x6ec6('0x58')]?JSON[_0x6ec6('0x26')](_0xd9afe5['body']):'null');return respondWithRpcPromise('RejectMessage',_0x6ec6('0x7c'),_0x2a65f3);}return null;})[_0x6ec6('0x21')](function(_0x2de644){var _0x27de4f=_0x6ec6('0x6c')+_0x2de644[_0x6ec6('0x29')][_0x6ec6('0x7d')];return db[_0x6ec6('0x6d')]['query'](_0x27de4f,{'type':db[_0x6ec6('0x6e')][_0x6ec6('0x7e')]['SELECT'],'raw':!![]})[_0x6ec6('0x21')](function(_0x1a69d4){return _0x1a69d4;});})[_0x6ec6('0x21')](function(_0x52cb07){if(_0x52cb07){_0x2a65f3[_0x6ec6('0x29')][_0x6ec6('0x70')]=_0x52cb07[0x0];if(!_0xd9afe5[_0x6ec6('0x58')][_0x6ec6('0x61')])return;return db['User'][_0x6ec6('0x56')]({'where':{'id':_0xd9afe5['body'][_0x6ec6('0x61')],'role':_0x6ec6('0x63')},'attributes':['id',_0x6ec6('0x38'),_0x6ec6('0x71'),_0x6ec6('0x7f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x171cd0){if(!_0x171cd0)return null;_0x2a65f3[_0x6ec6('0x29')]['agent']=_0x171cd0;return _0x2a65f3;})['then'](function(_0x241879){if(_0x241879){_0x241879[_0x6ec6('0x29')][_0x6ec6('0x74')]=util[_0x6ec6('0x5f')]('SIP/%s',_0xd9afe5[_0x6ec6('0x62')][_0x6ec6('0x38')]);_0x241879['message'][_0x6ec6('0x76')]=_0x2a65f3[_0x6ec6('0x76')];_0x241879[_0x6ec6('0x29')][_0x6ec6('0x77')]=_0x2a65f3[_0x6ec6('0x76')];_0x241879['message'][_0x6ec6('0x78')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x6ec6('0x80'),'message':_0x241879[_0x6ec6('0x29')]},client9002);return _0x2a65f3;}return null;})['then'](respondWithResult(_0x31f2cd,null))[_0x6ec6('0x2b')](handleError(_0x31f2cd,null));}; \ No newline at end of file +var _0x87cc=['stringify','error','code','message','result','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','destroy','sendStatus','name','send','index','OpenchannelMessage','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','order','sort','pick','filter','merge','where','map','VIRTUAL','includeAll','findAll','rows','show','params','keys','length','include','find','body','update','describe','openchannel-interactions','accept','openchannel','read','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','role','RejectMessage','rejectMessage','fullname','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x87cc,0x15c));var _0xc87c=function(_0x382464,_0x4ea466){_0x382464=_0x382464-0x0;var _0x5a547b=_0x87cc[_0x382464];return _0x5a547b;};'use strict';var emlformat=require(_0xc87c('0x0'));var rimraf=require(_0xc87c('0x1'));var zipdir=require(_0xc87c('0x2'));var jsonpatch=require(_0xc87c('0x3'));var rp=require(_0xc87c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc87c('0x5'));var util=require('util');var path=require(_0xc87c('0x6'));var sox=require(_0xc87c('0x7'));var csv=require(_0xc87c('0x8'));var ejs=require(_0xc87c('0x9'));var fs=require('fs');var fs_extra=require(_0xc87c('0xa'));var _=require(_0xc87c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc87c('0xc'));var deskjs=require(_0xc87c('0xd'));var toCsv=require(_0xc87c('0x8'));var querystring=require('querystring');var Papa=require(_0xc87c('0xe'));var Redis=require('ioredis');var authService=require(_0xc87c('0xf'));var qs=require(_0xc87c('0x10'));var as=require(_0xc87c('0x11'));var hardwareService=require(_0xc87c('0x12'));var logger=require(_0xc87c('0x13'))('api');var utils=require(_0xc87c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc87c('0x15'))['db'];config[_0xc87c('0x16')]=_[_0xc87c('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc87c('0x18'))(new Redis(config[_0xc87c('0x16')]));require(_0xc87c('0x19'))[_0xc87c('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc87c('0x1b')][_0xc87c('0x1c')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25311f,_0x14f385,_0x599fe1,_0x49e504){return new BPromise(function(_0x199119,_0x301d1e){var _0x3b7265=_0x49e504||client;return _0x3b7265[_0xc87c('0x1d')](_0x25311f,_0x599fe1)[_0xc87c('0x1e')](function(_0x347dfc){logger[_0xc87c('0x1f')](_0xc87c('0x20'),_0x14f385,_0xc87c('0x21'));logger[_0xc87c('0x22')](_0xc87c('0x23'),_0x14f385,_0xc87c('0x21'),JSON[_0xc87c('0x24')](_0x347dfc));if(_0x347dfc[_0xc87c('0x25')]){if(_0x347dfc['error'][_0xc87c('0x26')]===0x1f4){logger[_0xc87c('0x25')](_0xc87c('0x20'),_0x14f385,_0x347dfc['error'][_0xc87c('0x27')]);return _0x301d1e(_0x347dfc[_0xc87c('0x25')][_0xc87c('0x27')]);}logger[_0xc87c('0x25')](_0xc87c('0x20'),_0x14f385,_0x347dfc[_0xc87c('0x25')][_0xc87c('0x27')]);return _0x199119(_0x347dfc['error'][_0xc87c('0x27')]);}else{logger[_0xc87c('0x1f')](_0xc87c('0x20'),_0x14f385,_0xc87c('0x21'));_0x199119(_0x347dfc[_0xc87c('0x28')]['message']);}})[_0xc87c('0x29')](function(_0x5dd06b){logger[_0xc87c('0x25')](_0xc87c('0x20'),_0x14f385,_0x5dd06b);_0x301d1e(_0x5dd06b);});});}function respondWithStatusCode(_0x49746e,_0x572033){_0x572033=_0x572033||0xcc;return function(_0x54ef04){if(_0x54ef04){return _0x49746e['sendStatus'](_0x572033);}return _0x49746e['status'](_0x572033)[_0xc87c('0x2a')]();};}function respondWithResult(_0x1b82e3,_0x156c97){_0x156c97=_0x156c97||0xc8;return function(_0x48e87e){if(_0x48e87e){return _0x1b82e3[_0xc87c('0x2b')](_0x156c97)[_0xc87c('0x2c')](_0x48e87e);}};}function respondWithFilteredResult(_0x4e59ff,_0x4d9ca0){return function(_0x45f4ba){if(_0x45f4ba){var _0x5557bb=typeof _0x4d9ca0[_0xc87c('0x2d')]==='undefined'&&typeof _0x4d9ca0[_0xc87c('0x2e')]===_0xc87c('0x2f');var _0x5eb3ea=_0x45f4ba[_0xc87c('0x30')];var _0x17f97c=_0x5557bb?0x0:_0x4d9ca0[_0xc87c('0x2d')];var _0x32a5cc=_0x5557bb?_0x45f4ba[_0xc87c('0x30')]:_0x4d9ca0[_0xc87c('0x2d')]+_0x4d9ca0[_0xc87c('0x2e')];var _0x89053;if(_0x32a5cc>=_0x5eb3ea){_0x32a5cc=_0x5eb3ea;_0x89053=0xc8;}else{_0x89053=0xce;}_0x4e59ff[_0xc87c('0x2b')](_0x89053);return _0x4e59ff[_0xc87c('0x31')](_0xc87c('0x32'),_0x17f97c+'-'+_0x32a5cc+'/'+_0x5eb3ea)[_0xc87c('0x2c')](_0x45f4ba);}return null;};}function patchUpdates(_0x418f34){return function(_0x1d8f8c){try{jsonpatch['apply'](_0x1d8f8c,_0x418f34,!![]);}catch(_0x42396b){return BPromise[_0xc87c('0x33')](_0x42396b);}return _0x1d8f8c['save']();};}function saveUpdates(_0x56c732,_0x3f8044){return function(_0x487167){if(_0x487167){return _0x487167['update'](_0x56c732)[_0xc87c('0x1e')](function(_0x991136){return _0x991136;});}return null;};}function removeEntity(_0xf52eb1,_0x498eeb){return function(_0x33e617){if(_0x33e617){return _0x33e617[_0xc87c('0x34')]()[_0xc87c('0x1e')](function(){_0xf52eb1[_0xc87c('0x2b')](0xcc)[_0xc87c('0x2a')]();});}};}function handleEntityNotFound(_0x4039cc,_0x2ec4bd){return function(_0x36a7f8){if(!_0x36a7f8){_0x4039cc[_0xc87c('0x35')](0x194);}return _0x36a7f8;};}function handleError(_0x3424e4,_0x47f840){_0x47f840=_0x47f840||0x1f4;return function(_0x43dd56){logger[_0xc87c('0x25')](_0x43dd56['stack']);if(_0x43dd56[_0xc87c('0x36')]){delete _0x43dd56['name'];}_0x3424e4['status'](_0x47f840)[_0xc87c('0x37')](_0x43dd56);};}exports[_0xc87c('0x38')]=function(_0x2b14a0,_0xa4fe3){var _0x4b2dbd={},_0x340440={},_0x17bb89={'count':0x0,'rows':[]};var _0x404da6=_['map'](db[_0xc87c('0x39')][_0xc87c('0x3a')],function(_0x3d0c04){return{'name':_0x3d0c04['fieldName'],'type':_0x3d0c04[_0xc87c('0x3b')][_0xc87c('0x3c')]};});_0x340440['model']=_['map'](_0x404da6,_0xc87c('0x36'));_0x340440[_0xc87c('0x3d')]=_['keys'](_0x2b14a0[_0xc87c('0x3d')]);_0x340440[_0xc87c('0x3e')]=_[_0xc87c('0x3f')](_0x340440[_0xc87c('0x40')],_0x340440[_0xc87c('0x3d')]);_0x4b2dbd[_0xc87c('0x41')]=_['intersection'](_0x340440[_0xc87c('0x40')],qs['fields'](_0x2b14a0[_0xc87c('0x3d')][_0xc87c('0x42')]));_0x4b2dbd['attributes']=_0x4b2dbd[_0xc87c('0x41')]['length']?_0x4b2dbd[_0xc87c('0x41')]:_0x340440[_0xc87c('0x40')];if(!_0x2b14a0[_0xc87c('0x3d')]['hasOwnProperty']('nolimit')){_0x4b2dbd[_0xc87c('0x2e')]=qs[_0xc87c('0x2e')](_0x2b14a0[_0xc87c('0x3d')][_0xc87c('0x2e')]);_0x4b2dbd[_0xc87c('0x2d')]=qs['offset'](_0x2b14a0[_0xc87c('0x3d')][_0xc87c('0x2d')]);}_0x4b2dbd[_0xc87c('0x43')]=qs[_0xc87c('0x44')](_0x2b14a0['query'][_0xc87c('0x44')]);_0x4b2dbd['where']=qs[_0xc87c('0x3e')](_[_0xc87c('0x45')](_0x2b14a0[_0xc87c('0x3d')],_0x340440[_0xc87c('0x3e')]),_0x404da6);if(_0x2b14a0[_0xc87c('0x3d')][_0xc87c('0x46')]){_0x4b2dbd['where']=_[_0xc87c('0x47')](_0x4b2dbd[_0xc87c('0x48')],{'$or':_[_0xc87c('0x49')](_0x404da6,function(_0x1a8c31){if(_0x1a8c31['type']!==_0xc87c('0x4a')){var _0x1017fc={};_0x1017fc[_0x1a8c31[_0xc87c('0x36')]]={'$like':'%'+_0x2b14a0[_0xc87c('0x3d')][_0xc87c('0x46')]+'%'};return _0x1017fc;}})});}_0x4b2dbd=_[_0xc87c('0x47')]({},_0x4b2dbd,_0x2b14a0['options']);var _0x37f866={'where':_0x4b2dbd[_0xc87c('0x48')]};return db[_0xc87c('0x39')][_0xc87c('0x30')](_0x37f866)[_0xc87c('0x1e')](function(_0x3f86e7){_0x17bb89[_0xc87c('0x30')]=_0x3f86e7;if(_0x2b14a0[_0xc87c('0x3d')][_0xc87c('0x4b')]){_0x4b2dbd['include']=[{'all':!![]}];}return db[_0xc87c('0x39')][_0xc87c('0x4c')](_0x4b2dbd);})[_0xc87c('0x1e')](function(_0x960f3e){_0x17bb89[_0xc87c('0x4d')]=_0x960f3e;return _0x17bb89;})[_0xc87c('0x1e')](respondWithFilteredResult(_0xa4fe3,_0x4b2dbd))[_0xc87c('0x29')](handleError(_0xa4fe3,null));};exports[_0xc87c('0x4e')]=function(_0x20721b,_0x57d607){var _0x2b2358={'raw':!![],'where':{'id':_0x20721b[_0xc87c('0x4f')]['id']}},_0x1bc2b9={};_0x1bc2b9[_0xc87c('0x40')]=_['keys'](db[_0xc87c('0x39')]['rawAttributes']);_0x1bc2b9[_0xc87c('0x3d')]=_[_0xc87c('0x50')](_0x20721b[_0xc87c('0x3d')]);_0x1bc2b9[_0xc87c('0x3e')]=_['intersection'](_0x1bc2b9['model'],_0x1bc2b9[_0xc87c('0x3d')]);_0x2b2358[_0xc87c('0x41')]=_[_0xc87c('0x3f')](_0x1bc2b9[_0xc87c('0x40')],qs['fields'](_0x20721b[_0xc87c('0x3d')][_0xc87c('0x42')]));_0x2b2358[_0xc87c('0x41')]=_0x2b2358['attributes'][_0xc87c('0x51')]?_0x2b2358[_0xc87c('0x41')]:_0x1bc2b9[_0xc87c('0x40')];if(_0x20721b[_0xc87c('0x3d')][_0xc87c('0x4b')]){_0x2b2358[_0xc87c('0x52')]=[{'all':!![]}];}_0x2b2358=_[_0xc87c('0x47')]({},_0x2b2358,_0x20721b['options']);return db[_0xc87c('0x39')][_0xc87c('0x53')](_0x2b2358)['then'](handleEntityNotFound(_0x57d607,null))['then'](respondWithResult(_0x57d607,null))[_0xc87c('0x29')](handleError(_0x57d607,null));};exports['create']=function(_0x59132d,_0x53f30d){return db[_0xc87c('0x39')]['create'](_0x59132d[_0xc87c('0x54')],{})[_0xc87c('0x1e')](respondWithResult(_0x53f30d,0xc9))[_0xc87c('0x29')](handleError(_0x53f30d,null));};exports[_0xc87c('0x55')]=function(_0x3b55cd,_0x2eb9b9){if(_0x3b55cd[_0xc87c('0x54')]['id']){delete _0x3b55cd[_0xc87c('0x54')]['id'];}return db[_0xc87c('0x39')][_0xc87c('0x53')]({'where':{'id':_0x3b55cd['params']['id']}})['then'](handleEntityNotFound(_0x2eb9b9,null))[_0xc87c('0x1e')](saveUpdates(_0x3b55cd[_0xc87c('0x54')],null))[_0xc87c('0x1e')](respondWithResult(_0x2eb9b9,null))[_0xc87c('0x29')](handleError(_0x2eb9b9,null));};exports[_0xc87c('0x34')]=function(_0x45556a,_0xe31823){return db[_0xc87c('0x39')][_0xc87c('0x53')]({'where':{'id':_0x45556a[_0xc87c('0x4f')]['id']}})['then'](handleEntityNotFound(_0xe31823,null))[_0xc87c('0x1e')](removeEntity(_0xe31823,null))[_0xc87c('0x29')](handleError(_0xe31823,null));};exports[_0xc87c('0x56')]=function(_0x3d14b8,_0x5baba9){return db[_0xc87c('0x39')]['describe']()[_0xc87c('0x1e')](respondWithResult(_0x5baba9,null))[_0xc87c('0x29')](handleError(_0x5baba9,null));};var interaction_log=require(_0xc87c('0x13'))(_0xc87c('0x57'));exports[_0xc87c('0x58')]=function(_0x4b95e1,_0x6527b,_0x44e3f0){var _0x11acfc={'agent':{},'channel':_0xc87c('0x59')};if(_0x4b95e1['body']['id']){delete _0x4b95e1['body']['id'];}_0x4b95e1[_0xc87c('0x54')][_0xc87c('0x5a')]=!![];_0x4b95e1[_0xc87c('0x54')]['readAt']=moment()[_0xc87c('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b95e1[_0xc87c('0x54')][_0xc87c('0x5c')]=_0x4b95e1[_0xc87c('0x54')][_0xc87c('0x5c')]||_0x4b95e1[_0xc87c('0x5d')]['id'];_0x11acfc[_0xc87c('0x5e')]['id']=_0x4b95e1[_0xc87c('0x54')][_0xc87c('0x5c')];return db[_0xc87c('0x39')]['find']({'where':{'id':_0x4b95e1[_0xc87c('0x4f')]['id'],'UserId':null}})[_0xc87c('0x1e')](handleEntityNotFound(_0x6527b,null))[_0xc87c('0x1e')](saveUpdates(_0x4b95e1['body'],null))[_0xc87c('0x1e')](function(_0x24afcd){if(_0x24afcd){_0x11acfc[_0xc87c('0x27')]=_0x24afcd[_0xc87c('0x5f')]({'plain':!![]});return db[_0xc87c('0x60')]['find']({'where':{'id':_0x24afcd[_0xc87c('0x61')]}});}return null;})[_0xc87c('0x1e')](handleEntityNotFound(_0x6527b,null))[_0xc87c('0x1e')](function(_0x5ae5ba){if(_0x5ae5ba){return _0x5ae5ba[_0xc87c('0x55')]({'UserId':_0x4b95e1[_0xc87c('0x54')]['UserId'],'read1stAt':_[_0xc87c('0x62')](_0x5ae5ba[_0xc87c('0x63')])?moment()[_0xc87c('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc87c('0x1e')](function(_0x138ff1){if(_0x138ff1){_0x11acfc[_0xc87c('0x64')]=_0x138ff1[_0xc87c('0x5f')]({'plain':!![]});interaction_log[_0xc87c('0x1f')](_0xc87c('0x65'),_0x4b95e1[_0xc87c('0x5d')]['id'],_0x4b95e1['user']['name'],_0x4b95e1[_0xc87c('0x5d')]['role'],_0x11acfc[_0xc87c('0x64')]['id'],_0x4b95e1['body']?JSON[_0xc87c('0x24')](_0x4b95e1[_0xc87c('0x54')]):_0xc87c('0x66'));return respondWithRpcPromise(_0xc87c('0x67'),_0xc87c('0x68'),_0x11acfc);}return null;})[_0xc87c('0x1e')](function(_0x4b74a9){var _0x3c0c02=_0xc87c('0x69')+_0x4b74a9[_0xc87c('0x27')][_0xc87c('0x6a')];return db[_0xc87c('0x6b')]['query'](_0x3c0c02,{'type':db[_0xc87c('0x6c')][_0xc87c('0x6d')][_0xc87c('0x6e')],'raw':!![]})['then'](function(_0x52384e){return _0x52384e;});})['then'](function(_0x2f5b97){if(_0x2f5b97){_0x11acfc[_0xc87c('0x27')][_0xc87c('0x6f')]=_0x2f5b97[0x0];if(!_0x4b95e1['body'][_0xc87c('0x5c')])return;return db[_0xc87c('0x70')][_0xc87c('0x53')]({'where':{'id':_0x4b95e1[_0xc87c('0x54')][_0xc87c('0x5c')],'role':_0xc87c('0x5e')},'attributes':['id','name','fullname',_0xc87c('0x71'),_0xc87c('0x72')],'raw':!![]});}return null;})[_0xc87c('0x1e')](function(_0x3a7dc1){if(!_0x3a7dc1)return null;_0x11acfc[_0xc87c('0x27')][_0xc87c('0x5e')]=_0x3a7dc1;return _0x11acfc;})[_0xc87c('0x1e')](function(_0x53b766){if(_0x53b766){if(_0x4b95e1[_0xc87c('0x54')][_0xc87c('0x73')]){_0x11acfc[_0xc87c('0x27')][_0xc87c('0x74')]=util[_0xc87c('0x5b')](_0xc87c('0x75'),_0x4b95e1[_0xc87c('0x5d')]['name']);_0x11acfc[_0xc87c('0x27')]['channel']=_0x11acfc[_0xc87c('0x76')];_0x11acfc[_0xc87c('0x27')][_0xc87c('0x77')]=_0x11acfc[_0xc87c('0x76')];_0x11acfc[_0xc87c('0x27')][_0xc87c('0x78')]=_0xc87c('0x58');return respondWithRpcPromise('EventManager',_0xc87c('0x79'),{'event':_0xc87c('0x7a'),'message':_0x11acfc[_0xc87c('0x27')]},client9002)[_0xc87c('0x1e')](function(){return _0x11acfc;});}return _0x11acfc;}return null;})['then'](respondWithResult(_0x6527b,null))[_0xc87c('0x29')](handleError(_0x6527b,null));};var interaction_log=require(_0xc87c('0x13'))(_0xc87c('0x57'));exports[_0xc87c('0x33')]=function(_0xcee62e,_0x99b2c7,_0x13151e){var _0x2cc6ec={'agent':{},'channel':_0xc87c('0x59')};if(_0xcee62e['body']['id']){delete _0xcee62e[_0xc87c('0x54')]['id'];}_0xcee62e['body'][_0xc87c('0x5c')]=_0xcee62e[_0xc87c('0x54')][_0xc87c('0x5c')]||_0xcee62e[_0xc87c('0x5d')]['id'];_0x2cc6ec[_0xc87c('0x5e')]['id']=_0xcee62e['body'][_0xc87c('0x5c')];return db[_0xc87c('0x39')][_0xc87c('0x53')]({'where':{'id':_0xcee62e['params']['id'],'UserId':null}})[_0xc87c('0x1e')](handleEntityNotFound(_0x99b2c7,null))['then'](function(_0x292245){if(_0x292245){_0x2cc6ec[_0xc87c('0x27')]=_0x292245[_0xc87c('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0xc87c('0x53')]({'where':{'id':_0x292245[_0xc87c('0x61')]}});}return null;})[_0xc87c('0x1e')](handleEntityNotFound(_0x99b2c7,null))['then'](function(_0x3827c9){if(_0x3827c9){_0x2cc6ec[_0xc87c('0x64')]=_0x3827c9[_0xc87c('0x5f')]({'plain':!![]});interaction_log[_0xc87c('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xcee62e[_0xc87c('0x5d')]['id'],_0xcee62e['user'][_0xc87c('0x36')],_0xcee62e['user'][_0xc87c('0x7b')],_0x2cc6ec[_0xc87c('0x64')]['id'],_0xcee62e[_0xc87c('0x54')]?JSON[_0xc87c('0x24')](_0xcee62e['body']):'null');return respondWithRpcPromise(_0xc87c('0x7c'),_0xc87c('0x7d'),_0x2cc6ec);}return null;})[_0xc87c('0x1e')](function(_0x3a8070){var _0x525004=_0xc87c('0x69')+_0x3a8070[_0xc87c('0x27')][_0xc87c('0x6a')];return db[_0xc87c('0x6b')]['query'](_0x525004,{'type':db[_0xc87c('0x6c')][_0xc87c('0x6d')][_0xc87c('0x6e')],'raw':!![]})['then'](function(_0x4c7497){return _0x4c7497;});})[_0xc87c('0x1e')](function(_0x2407a6){if(_0x2407a6){_0x2cc6ec[_0xc87c('0x27')][_0xc87c('0x6f')]=_0x2407a6[0x0];if(!_0xcee62e[_0xc87c('0x54')]['UserId'])return;return db[_0xc87c('0x70')][_0xc87c('0x53')]({'where':{'id':_0xcee62e[_0xc87c('0x54')][_0xc87c('0x5c')],'role':_0xc87c('0x5e')},'attributes':['id','name',_0xc87c('0x7e'),'email',_0xc87c('0x72')],'raw':!![]});}return null;})[_0xc87c('0x1e')](function(_0x2e7f72){if(!_0x2e7f72)return null;_0x2cc6ec[_0xc87c('0x27')][_0xc87c('0x5e')]=_0x2e7f72;return _0x2cc6ec;})['then'](function(_0xe5dc5c){if(_0xe5dc5c){_0xe5dc5c['message'][_0xc87c('0x74')]=util[_0xc87c('0x5b')]('SIP/%s',_0xcee62e[_0xc87c('0x5d')][_0xc87c('0x36')]);_0xe5dc5c[_0xc87c('0x27')][_0xc87c('0x76')]=_0x2cc6ec[_0xc87c('0x76')];_0xe5dc5c[_0xc87c('0x27')]['motionChannel']=_0x2cc6ec[_0xc87c('0x76')];_0xe5dc5c[_0xc87c('0x27')][_0xc87c('0x78')]=_0xc87c('0x33');respondWithRpcPromise(_0xc87c('0x79'),_0xc87c('0x79'),{'event':_0xc87c('0x7f'),'message':_0xe5dc5c[_0xc87c('0x27')]},client9002);return _0x2cc6ec;}return null;})[_0xc87c('0x1e')](respondWithResult(_0x99b2c7,null))['catch'](handleError(_0x99b2c7,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0d90897..8d64d92 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49a3=['exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1e62b0,_0x17948f){var _0xda3926=function(_0x1dc503){while(--_0x1dc503){_0x1e62b0['push'](_0x1e62b0['shift']());}};_0xda3926(++_0x17948f);}(_0x49a3,0x17b));var _0x349a=function(_0x3b48c7,_0x17d7c2){_0x3b48c7=_0x3b48c7-0x0;var _0x18c0b3=_0x49a3[_0x3b48c7];return _0x18c0b3;};'use strict';var EventEmitter=require(_0x349a('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x349a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x349a('0x2')](0x0);var events={'afterCreate':_0x349a('0x3'),'afterUpdate':_0x349a('0x4'),'afterDestroy':_0x349a('0x5')};function emitEvent(_0xff494d){return function(_0x1f4d0f,_0x1b148f,_0x404d53){OpenchannelMessageEvents[_0x349a('0x6')](_0xff494d+':'+_0x1f4d0f['id'],_0x1f4d0f);OpenchannelMessageEvents[_0x349a('0x6')](_0xff494d,_0x1f4d0f);_0x404d53(null);};}for(var e in events){if(events[_0x349a('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x349a('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xd8bb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x94b5be,_0x45265e){var _0x55655f=function(_0x1a6d44){while(--_0x1a6d44){_0x94b5be['push'](_0x94b5be['shift']());}};_0x55655f(++_0x45265e);}(_0xd8bb,0x1d4));var _0xbd8b=function(_0x57e22e,_0x1077e4){_0x57e22e=_0x57e22e-0x0;var _0x401301=_0xd8bb[_0x57e22e];return _0x401301;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xbd8b('0x0'))['db'][_0xbd8b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbd8b('0x2')](0x0);var events={'afterCreate':_0xbd8b('0x3'),'afterUpdate':_0xbd8b('0x4'),'afterDestroy':_0xbd8b('0x5')};function emitEvent(_0x8ab33e){return function(_0xd75c93,_0x1475f5,_0x2b8efb){OpenchannelMessageEvents[_0xbd8b('0x6')](_0x8ab33e+':'+_0xd75c93['id'],_0xd75c93);OpenchannelMessageEvents[_0xbd8b('0x6')](_0x8ab33e,_0xd75c93);_0x2b8efb(null);};}for(var e in events){if(events[_0xbd8b('0x7')](e)){var event=events[e];OpenchannelMessage[_0xbd8b('0x8')](e,emitEvent(event));}}module[_0xbd8b('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 29297c8..29e028e 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb79a=['out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','describe','then','OpenchannelAccount','Interactions','CmContact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','Contact','POST','method','format','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x522a93,_0x3ef1e6){var _0x36a4d6=function(_0x395a37){while(--_0x395a37){_0x522a93['push'](_0x522a93['shift']());}};_0x36a4d6(++_0x3ef1e6);}(_0xb79a,0x88));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var logger=require('../../config/logger')(_0xab79('0x2'));var moment=require(_0xab79('0x3'));var BPromise=require(_0xab79('0x4'));var rp=require(_0xab79('0x5'));var fs=require('fs');var path=require(_0xab79('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab79('0x7'));module['exports']=function(_0x4b70ad,_0x16e604){return _0x4b70ad['define'](_0xab79('0x8'),attributes,{'tableName':_0xab79('0x9'),'paranoid':![],'indexes':[{'name':_0xab79('0xa'),'fields':[_0xab79('0xb')],'type':_0xab79('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a501e,_0x22382d,_0x4a808d){var _0x594f50=_0x4b70ad[_0xab79('0xd')];var _0x87c527=_0x3a501e[_0xab79('0xe')]({'plain':!![]});if(_0x87c527[_0xab79('0xf')][_0xab79('0x10')]()==='in'||_0x87c527[_0xab79('0xf')][_0xab79('0x10')]()===_0xab79('0x11')&&!_0x87c527[_0xab79('0x12')]&&!_[_0xab79('0x13')](_0x87c527[_0xab79('0x14')])){_0x594f50[_0xab79('0x15')][_0xab79('0x16')]({'where':{'id':_0x87c527[_0xab79('0x17')]}})['then'](function(_0x21af37){if(_0x21af37){_0x21af37[_0xab79('0x18')]({'lastMsgAt':_0x87c527[_0xab79('0x19')],'lastMsgDirection':_0x87c527[_0xab79('0xf')]['toLowerCase']()});}})[_0xab79('0x1a')](function(_0x2bebc2){console[_0xab79('0x1b')](_0x2bebc2);});}if(_0x87c527['direction']==='out'&&!_0x87c527[_0xab79('0x12')]){var _0x52c048;_0x594f50['CmContact'][_0xab79('0x1c')]()[_0xab79('0x1d')](function(_0x471f49){return _0x594f50[_0xab79('0x1e')]['find']({'where':{'id':_0x87c527['OpenchannelAccountId']},'include':[{'model':_0x594f50[_0xab79('0x15')],'as':_0xab79('0x1f'),'where':{'id':_0x87c527['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x594f50[_0xab79('0x20')],'as':'Contact','attributes':_[_0xab79('0x21')](_0x471f49)}]}]});})[_0xab79('0x1d')](function(_0x3c8e2f){_0x52c048=_0x3c8e2f[_0xab79('0xe')]({'plain':!![]});if(_0x52c048&&_0x52c048[_0xab79('0x22')]){logger[_0xab79('0x23')](_0xab79('0x24'),_0xab79('0x25'),util['format'](_0xab79('0x26'),_0x87c527['id'],_0x52c048[_0xab79('0x22')]));if(_0x52c048['Interactions']&&_0x52c048['Interactions'][_0xab79('0x27')]){_0x87c527['Interaction']=_[_0xab79('0x28')](_0x52c048[_0xab79('0x1f')][0x0],_0xab79('0x29'));_0x87c527[_0xab79('0x29')]=_0x52c048[_0xab79('0x1f')][0x0][_0xab79('0x29')];}var _0x22382d={'method':_0xab79('0x2a'),'uri':encodeURI(_0x52c048['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x22382d[_0xab79('0x2b')]){case'GET':_0x22382d['qs']=_0x87c527;break;case _0xab79('0x2a'):_0x22382d['body']=_0x87c527;break;}return rp(_0x22382d)[_0xab79('0x1d')](function(_0x4ca51e){logger['info'](_0xab79('0x24'),_0xab79('0x25'),util[_0xab79('0x2c')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x87c527['id'],_0x52c048[_0xab79('0x22')]));if(_0x4ca51e[_0xab79('0xb')]['threadId']&&_0x4ca51e[_0xab79('0xb')][_0xab79('0x2d')]!=_0x87c527[_0xab79('0x2e')]['threadId']){return _0x594f50[_0xab79('0x15')][_0xab79('0x18')]({'threadId':_0x4ca51e['body'][_0xab79('0x2d')]},{'where':{'id':_0x87c527[_0xab79('0x2e')]['id']}});}else{return;}})[_0xab79('0x1d')](function(){return _0x3a501e[_0xab79('0x18')]({'read':!![]});})['catch'](function(_0x267066){logger[_0xab79('0x1b')](_0xab79('0x24'),_0xab79('0x25'),util[_0xab79('0x2f')](_0x267066,{'showHidden':![],'depth':null}));_0x4a808d();});}else{_0x4a808d();}})[_0xab79('0x30')](function(){_0x4a808d();});}else{_0x4a808d();}}},'charset':_0xab79('0x31'),'collate':_0xab79('0x32')});}; \ No newline at end of file +var _0x6492=['OpenchannelMessage,\x20%s,\x20%s','format','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','GET','body'];(function(_0x1ce1f9,_0x59e719){var _0x154368=function(_0x47454f){while(--_0x47454f){_0x1ce1f9['push'](_0x1ce1f9['shift']());}};_0x154368(++_0x59e719);}(_0x6492,0xa6));var _0x2649=function(_0x3617ad,_0x453dd8){_0x3617ad=_0x3617ad-0x0;var _0x37fd29=_0x6492[_0x3617ad];return _0x37fd29;};'use strict';var _=require(_0x2649('0x0'));var util=require(_0x2649('0x1'));var logger=require(_0x2649('0x2'))(_0x2649('0x3'));var moment=require(_0x2649('0x4'));var BPromise=require(_0x2649('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2649('0x6'));var config=require(_0x2649('0x7'));var attributes=require(_0x2649('0x8'));module[_0x2649('0x9')]=function(_0x421f7c,_0x2a5a60){return _0x421f7c[_0x2649('0xa')](_0x2649('0xb'),attributes,{'tableName':_0x2649('0xc'),'paranoid':![],'indexes':[{'name':_0x2649('0xd'),'fields':['body'],'type':_0x2649('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27a364,_0x51a8ac,_0x5c823e){var _0x50e28f=_0x421f7c[_0x2649('0xf')];var _0x3b5994=_0x27a364[_0x2649('0x10')]({'plain':!![]});if(_0x3b5994[_0x2649('0x11')][_0x2649('0x12')]()==='in'||_0x3b5994[_0x2649('0x11')][_0x2649('0x12')]()===_0x2649('0x13')&&!_0x3b5994[_0x2649('0x14')]&&!_[_0x2649('0x15')](_0x3b5994[_0x2649('0x16')])){_0x50e28f[_0x2649('0x17')][_0x2649('0x18')]({'where':{'id':_0x3b5994[_0x2649('0x19')]}})[_0x2649('0x1a')](function(_0x54e594){if(_0x54e594){_0x54e594[_0x2649('0x1b')]({'lastMsgAt':_0x3b5994[_0x2649('0x1c')],'lastMsgDirection':_0x3b5994[_0x2649('0x11')][_0x2649('0x12')]()});}})[_0x2649('0x1d')](function(_0x2acfea){console[_0x2649('0x1e')](_0x2acfea);});}if(_0x3b5994[_0x2649('0x11')]===_0x2649('0x13')&&!_0x3b5994[_0x2649('0x14')]){var _0x7ec53e;_0x50e28f[_0x2649('0x1f')][_0x2649('0x20')]()[_0x2649('0x1a')](function(_0x119fce){return _0x50e28f['OpenchannelAccount'][_0x2649('0x21')]({'where':{'id':_0x3b5994[_0x2649('0x22')]},'include':[{'model':_0x50e28f[_0x2649('0x17')],'as':_0x2649('0x23'),'where':{'id':_0x3b5994[_0x2649('0x19')]},'limit':0x1,'include':[{'model':_0x50e28f['CmContact'],'as':_0x2649('0x24'),'attributes':_[_0x2649('0x25')](_0x119fce)}]}]});})['then'](function(_0x543720){_0x7ec53e=_0x543720[_0x2649('0x10')]({'plain':!![]});if(_0x7ec53e&&_0x7ec53e[_0x2649('0x26')]){logger[_0x2649('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x2649('0x28'),util['format'](_0x2649('0x29'),_0x3b5994['id'],_0x7ec53e['replyUri']));if(_0x7ec53e[_0x2649('0x23')]&&_0x7ec53e['Interactions']['length']){_0x3b5994['Interaction']=_[_0x2649('0x2a')](_0x7ec53e[_0x2649('0x23')][0x0],_0x2649('0x24'));_0x3b5994['Contact']=_0x7ec53e['Interactions'][0x0]['Contact'];}var _0x51a8ac={'method':_0x2649('0x2b'),'uri':encodeURI(_0x7ec53e['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x51a8ac['method']){case _0x2649('0x2c'):_0x51a8ac['qs']=_0x3b5994;break;case _0x2649('0x2b'):_0x51a8ac[_0x2649('0x2d')]=_0x3b5994;break;}return rp(_0x51a8ac)[_0x2649('0x1a')](function(_0x2ae6d5){logger[_0x2649('0x27')](_0x2649('0x2e'),_0x2649('0x28'),util[_0x2649('0x2f')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x3b5994['id'],_0x7ec53e['replyUri']));if(_0x2ae6d5['body']['threadId']&&_0x2ae6d5[_0x2649('0x2d')][_0x2649('0x30')]!=_0x3b5994[_0x2649('0x31')][_0x2649('0x30')]){return _0x50e28f[_0x2649('0x17')][_0x2649('0x1b')]({'threadId':_0x2ae6d5[_0x2649('0x2d')][_0x2649('0x30')]},{'where':{'id':_0x3b5994[_0x2649('0x31')]['id']}});}else{return;}})[_0x2649('0x1a')](function(){return _0x27a364['update']({'read':!![]});})[_0x2649('0x1d')](function(_0x149751){logger['error'](_0x2649('0x2e'),_0x2649('0x28'),util[_0x2649('0x32')](_0x149751,{'showHidden':![],'depth':null}));_0x5c823e();});}else{_0x5c823e();}})[_0x2649('0x33')](function(){_0x5c823e();});}else{_0x5c823e();}}},'charset':'utf8mb4','collate':_0x2649('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c5799be..9e3755e 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2c6b31,_0x581eb3){var _0x4c3913=function(_0xd0d33d){while(--_0xd0d33d){_0x2c6b31['push'](_0x2c6b31['shift']());}};_0x4c3913(++_0x581eb3);}(_0x7a54,0x106));var _0x47a5=function(_0x112d6f,_0x30b5ad){_0x112d6f=_0x112d6f-0x0;var _0xd471f7=_0x7a54[_0x112d6f];return _0xd471f7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x36add0,_0x1a5d33){var _0x53a7a0=function(_0x572364){while(--_0x572364){_0x36add0['push'](_0x36add0['shift']());}};_0x53a7a0(++_0x1a5d33);}(_0xadb5,0xad));var _0x5adb=function(_0x471277,_0x14bf1f){_0x471277=_0x471277-0x0;var _0x18d915=_0xadb5[_0x471277];return _0x18d915;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 97f55ad..7eeaf4d 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1171=['update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x1171,0x10b));var _0x1117=function(_0x5b9d3a,_0x1f1842){_0x5b9d3a=_0x5b9d3a-0x0;var _0x383375=_0x1171[_0x5b9d3a];return _0x383375;};'use strict';var OpenchannelMessageEvents=require(_0x1117('0x0'));var events=[_0x1117('0x1'),_0x1117('0x2'),_0x1117('0x3')];function createListener(_0x13a072,_0x17fb48){return function(_0x564add){_0x17fb48[_0x1117('0x4')](_0x13a072,_0x564add);};}function removeListener(_0x2bfcd3,_0x2a7e68){return function(){OpenchannelMessageEvents[_0x1117('0x5')](_0x2bfcd3,_0x2a7e68);};}exports[_0x1117('0x6')]=function(_0x28fa23){for(var _0x2d6240=0x0,_0x1ff55b=events[_0x1117('0x7')];_0x2d6240<_0x1ff55b;_0x2d6240++){var _0x253e44=events[_0x2d6240];var _0x5e333d=createListener(_0x1117('0x8')+_0x253e44,_0x28fa23);OpenchannelMessageEvents['on'](_0x253e44,_0x5e333d);}}; \ No newline at end of file +var _0x958f=['save','remove','update','emit','removeListener','openchannelMessage:'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x958f,0x16e));var _0xf958=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x958f[_0x4a9fb1];return _0x348672;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xf958('0x0'),_0xf958('0x1'),_0xf958('0x2')];function createListener(_0x35758a,_0xbd09d9){return function(_0x4d8410){_0xbd09d9[_0xf958('0x3')](_0x35758a,_0x4d8410);};}function removeListener(_0x38b3f7,_0x5cf322){return function(){OpenchannelMessageEvents[_0xf958('0x4')](_0x38b3f7,_0x5cf322);};}exports['register']=function(_0x204612){for(var _0x1e0718=0x0,_0x7c19f4=events['length'];_0x1e0718<_0x7c19f4;_0x1e0718++){var _0x4f5a7a=events[_0x1e0718];var _0x4769ad=createListener(_0xf958('0x5')+_0x4f5a7a,_0x204612);OpenchannelMessageEvents['on'](_0x4f5a7a,_0x4769ad);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5848edd..fa220ec 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe346=['destroy','removeTeams','removeAgents','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe346,0x14d));var _0x6e34=function(_0x374b96,_0x16cbc0){_0x374b96=_0x374b96-0x0;var _0x4cfd6e=_0xe346[_0x374b96];return _0x4cfd6e;};'use strict';var multer=require(_0x6e34('0x0'));var util=require(_0x6e34('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6e34('0x2'));var router=express['Router']();var fs_extra=require(_0x6e34('0x3'));var auth=require(_0x6e34('0x4'));var interaction=require(_0x6e34('0x5'));var config=require(_0x6e34('0x6'));var controller=require(_0x6e34('0x7'));router[_0x6e34('0x8')]('/',auth[_0x6e34('0x9')](),controller[_0x6e34('0xa')]);router[_0x6e34('0x8')](_0x6e34('0xb'),auth['isAuthenticated'](),controller[_0x6e34('0xc')]);router['get'](_0x6e34('0xd'),auth[_0x6e34('0x9')](),controller[_0x6e34('0xe')]);router[_0x6e34('0x8')](_0x6e34('0xf'),auth['isAuthenticated'](),controller[_0x6e34('0x10')]);router[_0x6e34('0x8')](_0x6e34('0x11'),auth[_0x6e34('0x9')](),controller['getTeams']);router[_0x6e34('0x8')](_0x6e34('0x12'),auth['isAuthenticated'](),controller[_0x6e34('0x13')]);router[_0x6e34('0x14')]('/',auth[_0x6e34('0x9')](),controller[_0x6e34('0x15')]);router[_0x6e34('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6e34('0x16')]);router[_0x6e34('0x14')](_0x6e34('0x12'),auth['isAuthenticated'](),controller[_0x6e34('0x17')]);router[_0x6e34('0x18')](_0x6e34('0xd'),auth['isAuthenticated'](),controller[_0x6e34('0x19')]);router[_0x6e34('0x1a')](_0x6e34('0xd'),auth[_0x6e34('0x9')](),controller[_0x6e34('0x1b')]);router[_0x6e34('0x1a')](_0x6e34('0x11'),auth[_0x6e34('0x9')](),controller[_0x6e34('0x1c')]);router['delete']('/:id/users',auth[_0x6e34('0x9')](),controller[_0x6e34('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x8680=['addAgents','update','delete','destroy','removeTeams','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','addTeams'];(function(_0x3e25a9,_0x331892){var _0x16fd57=function(_0x129722){while(--_0x129722){_0x3e25a9['push'](_0x3e25a9['shift']());}};_0x16fd57(++_0x331892);}(_0x8680,0x180));var _0x0868=function(_0x53a129,_0x59b021){_0x53a129=_0x53a129-0x0;var _0x372505=_0x8680[_0x53a129];return _0x372505;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0868('0x0'));var timeout=require(_0x0868('0x1'));var express=require(_0x0868('0x2'));var router=express[_0x0868('0x3')]();var fs_extra=require(_0x0868('0x4'));var auth=require(_0x0868('0x5'));var interaction=require(_0x0868('0x6'));var config=require('../../config/environment');var controller=require(_0x0868('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0868('0x8')]);router[_0x0868('0x9')](_0x0868('0xa'),auth[_0x0868('0xb')](),controller['describe']);router['get'](_0x0868('0xc'),auth[_0x0868('0xb')](),controller[_0x0868('0xd')]);router[_0x0868('0x9')](_0x0868('0xe'),auth[_0x0868('0xb')](),controller['getMembers']);router[_0x0868('0x9')](_0x0868('0xf'),auth['isAuthenticated'](),controller[_0x0868('0x10')]);router[_0x0868('0x9')]('/:id/users',auth[_0x0868('0xb')](),controller[_0x0868('0x11')]);router[_0x0868('0x12')]('/',auth[_0x0868('0xb')](),controller[_0x0868('0x13')]);router['post'](_0x0868('0xf'),auth[_0x0868('0xb')](),controller[_0x0868('0x14')]);router[_0x0868('0x12')]('/:id/users',auth[_0x0868('0xb')](),controller[_0x0868('0x15')]);router['put'](_0x0868('0xc'),auth['isAuthenticated'](),controller[_0x0868('0x16')]);router[_0x0868('0x17')]('/:id',auth[_0x0868('0xb')](),controller[_0x0868('0x18')]);router['delete'](_0x0868('0xf'),auth[_0x0868('0xb')](),controller[_0x0868('0x19')]);router[_0x0868('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x0868('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5c28c2b..8484fcb 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0ee=['INTEGER','ENUM','roundrobin','sequelize','exports','name','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb0ee,0x1c3));var _0xeb0e=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xb0ee[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0xeb0e('0x0'));module[_0xeb0e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xeb0e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xeb0e('0x3')]},'timeout':{'type':Sequelize[_0xeb0e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeb0e('0x5')]('rrmemory','beepall',_0xeb0e('0x6'))}}; \ No newline at end of file +var _0x6e64=['INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x22e6bf,_0xaeb6e0){var _0x2fc152=function(_0x7698){while(--_0x7698){_0x22e6bf['push'](_0x22e6bf['shift']());}};_0x2fc152(++_0xaeb6e0);}(_0x6e64,0x1bf));var _0x46e6=function(_0x39503d,_0x533c16){_0x39503d=_0x39503d-0x0;var _0x3cc8d2=_0x6e64[_0x39503d];return _0x3cc8d2;};'use strict';var Sequelize=require(_0x46e6('0x0'));module[_0x46e6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x46e6('0x2')]},'timeout':{'type':Sequelize[_0x46e6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x46e6('0x4'),_0x46e6('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index bba9926..2b66a6a 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58c7=['flatMap','sequelize','each','forEach','emit','userOpenchannelQueue:save','ids','select','field','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','pick','UserOpenchannelQueue','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','SIP','getTeams','addTeams','Team','Agents','online','voicePause'];(function(_0xc3a766,_0x52bbaa){var _0x4e8fce=function(_0x3f18ba){while(--_0x3f18ba){_0xc3a766['push'](_0xc3a766['shift']());}};_0x4e8fce(++_0x52bbaa);}(_0x58c7,0x12f));var _0x758c=function(_0x5c3432,_0x46c2b2){_0x5c3432=_0x5c3432-0x0;var _0x2985cd=_0x58c7[_0x5c3432];return _0x2985cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x758c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x758c('0x1'));var rp=require(_0x758c('0x2'));var moment=require(_0x758c('0x3'));var BPromise=require(_0x758c('0x4'));var Mustache=require(_0x758c('0x5'));var util=require(_0x758c('0x6'));var path=require(_0x758c('0x7'));var sox=require(_0x758c('0x8'));var csv=require('to-csv');var ejs=require(_0x758c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x758c('0xa'));var squel=require(_0x758c('0xb'));var crypto=require(_0x758c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x758c('0xd'));var toCsv=require(_0x758c('0xe'));var querystring=require(_0x758c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x758c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x758c('0x11'));var logger=require(_0x758c('0x12'))(_0x758c('0x13'));var utils=require(_0x758c('0x14'));var config=require(_0x758c('0x15'));var licenseUtil=require(_0x758c('0x16'));var db=require(_0x758c('0x17'))['db'];config[_0x758c('0x18')]=_['defaults'](config[_0x758c('0x18')],{'host':_0x758c('0x19'),'port':0x18eb});var socket=require(_0x758c('0x1a'))(new Redis(config[_0x758c('0x18')]));require(_0x758c('0x1b'))[_0x758c('0x1c')](socket);function respondWithStatusCode(_0x4d2a12,_0x238313){_0x238313=_0x238313||0xcc;return function(_0x4b1f64){if(_0x4b1f64){return _0x4d2a12[_0x758c('0x1d')](_0x238313);}return _0x4d2a12[_0x758c('0x1e')](_0x238313)[_0x758c('0x1f')]();};}function respondWithResult(_0x5d2639,_0xa5a38c){_0xa5a38c=_0xa5a38c||0xc8;return function(_0x101e87){if(_0x101e87){return _0x5d2639[_0x758c('0x1e')](_0xa5a38c)[_0x758c('0x20')](_0x101e87);}};}function respondWithFilteredResult(_0x42ecda,_0xd22a5){return function(_0x5cb97d){if(_0x5cb97d){var _0xf5c3ab=typeof _0xd22a5[_0x758c('0x21')]==='undefined'&&typeof _0xd22a5[_0x758c('0x22')]==='undefined';var _0x46bd54=_0x5cb97d[_0x758c('0x23')];var _0x39ecf5=_0xf5c3ab?0x0:_0xd22a5[_0x758c('0x21')];var _0x9ee59b=_0xf5c3ab?_0x5cb97d['count']:_0xd22a5[_0x758c('0x21')]+_0xd22a5[_0x758c('0x22')];var _0x27b7cd;if(_0x9ee59b>=_0x46bd54){_0x9ee59b=_0x46bd54;_0x27b7cd=0xc8;}else{_0x27b7cd=0xce;}_0x42ecda[_0x758c('0x1e')](_0x27b7cd);return _0x42ecda[_0x758c('0x24')](_0x758c('0x25'),_0x39ecf5+'-'+_0x9ee59b+'/'+_0x46bd54)[_0x758c('0x20')](_0x5cb97d);}return null;};}function patchUpdates(_0x19b985){return function(_0xa634e6){try{jsonpatch[_0x758c('0x26')](_0xa634e6,_0x19b985,!![]);}catch(_0x4fb559){return BPromise[_0x758c('0x27')](_0x4fb559);}return _0xa634e6['save']();};}function saveUpdates(_0x30752e,_0xf95187){return function(_0x3bd099){if(_0x3bd099){return _0x3bd099[_0x758c('0x28')](_0x30752e)[_0x758c('0x29')](function(_0x253329){return _0x253329;});}return null;};}function removeEntity(_0x3cb93b,_0xb38671){return function(_0x28453c){if(_0x28453c){return _0x28453c[_0x758c('0x2a')]()[_0x758c('0x29')](function(){var _0x2b85e5=_0x28453c[_0x758c('0x2b')]({'plain':!![]});var _0x5ee186=_0x758c('0x2c');return db[_0x758c('0x2d')][_0x758c('0x2a')]({'where':{'type':_0x5ee186,'resourceId':_0x2b85e5['id']}})['then'](function(){return _0x28453c;});})[_0x758c('0x29')](function(){_0x3cb93b[_0x758c('0x1e')](0xcc)[_0x758c('0x1f')]();});}};}function handleEntityNotFound(_0x5cd0f5,_0xc0260a){return function(_0x49d51d){if(!_0x49d51d){_0x5cd0f5[_0x758c('0x1d')](0x194);}return _0x49d51d;};}function handleError(_0xad0963,_0x22cfce){_0x22cfce=_0x22cfce||0x1f4;return function(_0x268877){logger[_0x758c('0x2e')](_0x268877[_0x758c('0x2f')]);if(_0x268877['name']){delete _0x268877[_0x758c('0x30')];}_0xad0963[_0x758c('0x1e')](_0x22cfce)[_0x758c('0x31')](_0x268877);};}exports[_0x758c('0x32')]=function(_0x304e11,_0x10eaaf){var _0x5b2fa5={},_0xd1cdd7={},_0x483ec6={'count':0x0,'rows':[]};var _0x30d938=_[_0x758c('0x33')](db[_0x758c('0x34')][_0x758c('0x35')],function(_0x5b4fd2){return{'name':_0x5b4fd2[_0x758c('0x36')],'type':_0x5b4fd2[_0x758c('0x37')][_0x758c('0x38')]};});_0xd1cdd7[_0x758c('0x39')]=_[_0x758c('0x33')](_0x30d938,_0x758c('0x30'));_0xd1cdd7[_0x758c('0x3a')]=_['keys'](_0x304e11[_0x758c('0x3a')]);_0xd1cdd7[_0x758c('0x3b')]=_['intersection'](_0xd1cdd7[_0x758c('0x39')],_0xd1cdd7[_0x758c('0x3a')]);_0x5b2fa5[_0x758c('0x3c')]=_[_0x758c('0x3d')](_0xd1cdd7['model'],qs[_0x758c('0x3e')](_0x304e11['query'][_0x758c('0x3e')]));_0x5b2fa5[_0x758c('0x3c')]=_0x5b2fa5[_0x758c('0x3c')][_0x758c('0x3f')]?_0x5b2fa5['attributes']:_0xd1cdd7[_0x758c('0x39')];if(!_0x304e11[_0x758c('0x3a')][_0x758c('0x40')]('nolimit')){_0x5b2fa5['limit']=qs[_0x758c('0x22')](_0x304e11[_0x758c('0x3a')][_0x758c('0x22')]);_0x5b2fa5[_0x758c('0x21')]=qs['offset'](_0x304e11[_0x758c('0x3a')][_0x758c('0x21')]);}_0x5b2fa5[_0x758c('0x41')]=qs[_0x758c('0x42')](_0x304e11['query']['sort']);_0x5b2fa5[_0x758c('0x43')]=qs[_0x758c('0x3b')](_['pick'](_0x304e11[_0x758c('0x3a')],_0xd1cdd7[_0x758c('0x3b')]),_0x30d938);if(_0x304e11[_0x758c('0x3a')][_0x758c('0x44')]){_0x5b2fa5[_0x758c('0x43')]=_[_0x758c('0x45')](_0x5b2fa5['where'],{'$or':_[_0x758c('0x33')](_0x30d938,function(_0x22750c){if(_0x22750c[_0x758c('0x37')]!==_0x758c('0x46')){var _0x4cf3bf={};_0x4cf3bf[_0x22750c['name']]={'$like':'%'+_0x304e11[_0x758c('0x3a')][_0x758c('0x44')]+'%'};return _0x4cf3bf;}})});}_0x5b2fa5=_[_0x758c('0x45')]({},_0x5b2fa5,_0x304e11[_0x758c('0x47')]);var _0x571216={'where':_0x5b2fa5['where']};return db[_0x758c('0x34')][_0x758c('0x23')](_0x571216)[_0x758c('0x29')](function(_0x39f28d){_0x483ec6[_0x758c('0x23')]=_0x39f28d;if(_0x304e11[_0x758c('0x3a')][_0x758c('0x48')]){_0x5b2fa5[_0x758c('0x49')]=[{'all':!![]}];}return db[_0x758c('0x34')][_0x758c('0x4a')](_0x5b2fa5);})[_0x758c('0x29')](function(_0x1c9263){_0x483ec6['rows']=_0x1c9263;return _0x483ec6;})[_0x758c('0x29')](respondWithFilteredResult(_0x10eaaf,_0x5b2fa5))[_0x758c('0x4b')](handleError(_0x10eaaf,null));};exports['show']=function(_0x5b6e06,_0x11b05f){var _0x5b264e={'raw':!![],'where':{'id':_0x5b6e06[_0x758c('0x4c')]['id']}},_0x306538={};_0x306538['model']=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x306538[_0x758c('0x3a')]=_[_0x758c('0x4d')](_0x5b6e06['query']);_0x306538[_0x758c('0x3b')]=_['intersection'](_0x306538[_0x758c('0x39')],_0x306538[_0x758c('0x3a')]);_0x5b264e[_0x758c('0x3c')]=_[_0x758c('0x3d')](_0x306538[_0x758c('0x39')],qs[_0x758c('0x3e')](_0x5b6e06[_0x758c('0x3a')][_0x758c('0x3e')]));_0x5b264e[_0x758c('0x3c')]=_0x5b264e[_0x758c('0x3c')][_0x758c('0x3f')]?_0x5b264e[_0x758c('0x3c')]:_0x306538[_0x758c('0x39')];if(_0x5b6e06['query']['includeAll']){_0x5b264e[_0x758c('0x49')]=[{'all':!![]}];}_0x5b264e=_[_0x758c('0x45')]({},_0x5b264e,_0x5b6e06[_0x758c('0x47')]);return db[_0x758c('0x34')]['find'](_0x5b264e)[_0x758c('0x29')](handleEntityNotFound(_0x11b05f,null))[_0x758c('0x29')](respondWithResult(_0x11b05f,null))[_0x758c('0x4b')](handleError(_0x11b05f,null));};exports[_0x758c('0x4e')]=function(_0x4168d3,_0x5a658a){return db[_0x758c('0x34')][_0x758c('0x4e')](_0x4168d3[_0x758c('0x4f')],{})['then'](function(_0x567bbb){var _0x23d272=_0x4168d3[_0x758c('0x50')][_0x758c('0x2b')]({'plain':!![]});if(!_0x23d272)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23d272[_0x758c('0x51')]===_0x758c('0x50')){var _0x63d1c8=_0x567bbb['get']({'plain':!![]});var _0x206be8='OpenchannelQueues';return db[_0x758c('0x52')][_0x758c('0x53')]({'where':{'name':_0x206be8,'userProfileId':_0x23d272[_0x758c('0x54')]},'raw':!![]})['then'](function(_0x4b9b34){if(_0x4b9b34&&_0x4b9b34[_0x758c('0x55')]===0x0){return db[_0x758c('0x2d')][_0x758c('0x4e')]({'name':_0x63d1c8[_0x758c('0x30')],'resourceId':_0x63d1c8['id'],'type':_0x4b9b34['name'],'sectionId':_0x4b9b34['id']},{})[_0x758c('0x29')](function(){return _0x567bbb;});}else{return _0x567bbb;}})[_0x758c('0x4b')](function(_0x4217fd){logger[_0x758c('0x2e')](_0x758c('0x56'),_0x4217fd);throw _0x4217fd;});}return _0x567bbb;})[_0x758c('0x29')](respondWithResult(_0x5a658a,0xc9))[_0x758c('0x4b')](handleError(_0x5a658a,null));};exports[_0x758c('0x28')]=function(_0x477f73,_0x2fed2e){if(_0x477f73[_0x758c('0x4f')]['id']){delete _0x477f73[_0x758c('0x4f')]['id'];}return db[_0x758c('0x34')][_0x758c('0x53')]({'where':{'id':_0x477f73[_0x758c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2fed2e,null))[_0x758c('0x29')](saveUpdates(_0x477f73[_0x758c('0x4f')],null))[_0x758c('0x29')](respondWithResult(_0x2fed2e,null))['catch'](handleError(_0x2fed2e,null));};exports[_0x758c('0x2a')]=function(_0x513a0e,_0x527896){return db['OpenchannelQueue'][_0x758c('0x53')]({'where':{'id':_0x513a0e[_0x758c('0x4c')]['id']}})[_0x758c('0x29')](handleEntityNotFound(_0x527896,null))[_0x758c('0x29')](removeEntity(_0x527896,null))[_0x758c('0x4b')](handleError(_0x527896,null));};exports[_0x758c('0x57')]=function(_0x41ee22,_0x505ab3){return db[_0x758c('0x34')][_0x758c('0x57')]()[_0x758c('0x29')](respondWithResult(_0x505ab3,null))[_0x758c('0x4b')](handleError(_0x505ab3,null));};exports[_0x758c('0x58')]=function(_0x29fc94,_0x4ae332,_0x30acd0){var _0x245911={'raw':!![],'where':{}},_0x4d2380={},_0x40f1ea;return db[_0x758c('0x34')][_0x758c('0x59')]({'where':{'id':_0x29fc94[_0x758c('0x4c')]['id']}})[_0x758c('0x29')](handleEntityNotFound(_0x4ae332,null))[_0x758c('0x29')](function(_0x385a9b){if(_0x385a9b){_0x40f1ea=_0x385a9b['get']({'plain':!![]});_0x4d2380['model']=_['keys'](db['UserOpenchannelQueue'][_0x758c('0x35')]);_0x4d2380[_0x758c('0x3a')]=_[_0x758c('0x4d')](_0x29fc94[_0x758c('0x3a')]);_0x4d2380[_0x758c('0x3b')]=_[_0x758c('0x3d')](_0x4d2380[_0x758c('0x39')],_0x4d2380['query']);_0x245911['attributes']=_['intersection'](_0x4d2380[_0x758c('0x39')],qs[_0x758c('0x3e')](_0x29fc94['query']['fields']));_0x245911[_0x758c('0x3c')]=_0x245911['attributes'][_0x758c('0x3f')]?_0x245911[_0x758c('0x3c')]:_0x4d2380[_0x758c('0x39')];if(!_0x29fc94[_0x758c('0x3a')][_0x758c('0x40')](_0x758c('0x5a'))){_0x245911['limit']=qs[_0x758c('0x22')](_0x29fc94['query'][_0x758c('0x22')]);_0x245911['offset']=qs['offset'](_0x29fc94[_0x758c('0x3a')][_0x758c('0x21')]);}_0x245911[_0x758c('0x41')]=qs['sort'](_0x29fc94[_0x758c('0x3a')][_0x758c('0x42')]);_0x245911['where']=qs[_0x758c('0x3b')](_[_0x758c('0x5b')](_0x29fc94[_0x758c('0x3a')],_0x4d2380['filters']));_0x245911[_0x758c('0x43')]['OpenchannelQueueId']=_0x385a9b['id'];if(_0x29fc94[_0x758c('0x3a')]['filter']){_0x245911[_0x758c('0x43')]=_[_0x758c('0x45')](_0x245911['where'],{'$or':_[_0x758c('0x33')](_0x245911[_0x758c('0x3c')],function(_0x80df6){var _0x388e31={};_0x388e31[_0x80df6]={'$like':'%'+_0x29fc94[_0x758c('0x3a')][_0x758c('0x44')]+'%'};return _0x388e31;})});}_0x245911=_[_0x758c('0x45')]({},_0x245911,_0x29fc94['options']);return db[_0x758c('0x5c')][_0x758c('0x4a')](_0x245911);}})['then'](function(_0x3f4602){if(_0x3f4602){return db[_0x758c('0x5d')][_0x758c('0x5e')]({'where':{'id':_[_0x758c('0x33')](_0x3f4602,'UserId'),'role':_0x758c('0x5f')},'attributes':['id',_0x758c('0x30'),_0x758c('0x60'),_0x758c('0x61'),_0x758c('0x62')]});}})[_0x758c('0x29')](function(_0x186431){if(_0x186431){return{'count':_0x186431[_0x758c('0x23')],'rows':_[_0x758c('0x33')](_0x186431[_0x758c('0x63')],function(_0x2f57c8){return{'membername':_0x2f57c8[_0x758c('0x30')],'UserId':_0x2f57c8['id'],'queue_name':_0x40f1ea[_0x758c('0x30')],'OpenchannelQueueId':_0x40f1ea['id'],'interface':util[_0x758c('0x64')]('%s/%s',_0x758c('0x65'),_0x2f57c8['name']),'penalty':0x0,'paused':_0x2f57c8[_0x758c('0x60')],'createdAt':_0x2f57c8['createdAt'],'updatedAt':_0x2f57c8[_0x758c('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ae332,_0x245911))[_0x758c('0x4b')](handleError(_0x4ae332,null));};exports[_0x758c('0x66')]=function(_0x4ebeca,_0x3530b6,_0x16edff){var _0x124401={};var _0x5a949d={};var _0x268757;var _0x2c1216;return db[_0x758c('0x34')][_0x758c('0x59')]({'where':{'id':_0x4ebeca['params']['id']}})[_0x758c('0x29')](handleEntityNotFound(_0x3530b6,null))[_0x758c('0x29')](function(_0x1d78ab){if(_0x1d78ab){_0x268757=_0x1d78ab;_0x5a949d[_0x758c('0x39')]=_[_0x758c('0x4d')](db['Team'][_0x758c('0x35')]);_0x5a949d[_0x758c('0x3a')]=_[_0x758c('0x4d')](_0x4ebeca[_0x758c('0x3a')]);_0x5a949d[_0x758c('0x3b')]=_[_0x758c('0x3d')](_0x5a949d[_0x758c('0x39')],_0x5a949d['query']);_0x124401[_0x758c('0x3c')]=_['intersection'](_0x5a949d[_0x758c('0x39')],qs[_0x758c('0x3e')](_0x4ebeca[_0x758c('0x3a')][_0x758c('0x3e')]));_0x124401[_0x758c('0x3c')]=_0x124401[_0x758c('0x3c')][_0x758c('0x3f')]?_0x124401[_0x758c('0x3c')]:_0x5a949d[_0x758c('0x39')];_0x124401['order']=qs[_0x758c('0x42')](_0x4ebeca[_0x758c('0x3a')][_0x758c('0x42')]);_0x124401['where']=qs['filters'](_[_0x758c('0x5b')](_0x4ebeca[_0x758c('0x3a')],_0x5a949d[_0x758c('0x3b')]));if(_0x4ebeca['query'][_0x758c('0x44')]){_0x124401[_0x758c('0x43')]=_[_0x758c('0x45')](_0x124401[_0x758c('0x43')],{'$or':_[_0x758c('0x33')](_0x124401[_0x758c('0x3c')],function(_0x18d4e0){var _0x5d32d8={};_0x5d32d8[_0x18d4e0]={'$like':'%'+_0x4ebeca[_0x758c('0x3a')]['filter']+'%'};return _0x5d32d8;})});}_0x124401=_[_0x758c('0x45')]({},_0x124401,_0x4ebeca[_0x758c('0x47')]);return _0x268757[_0x758c('0x66')](_0x124401);}})[_0x758c('0x29')](function(_0x186fc7){if(_0x186fc7){_0x2c1216=_0x186fc7['length'];if(!_0x4ebeca['query']['hasOwnProperty'](_0x758c('0x5a'))){_0x124401['limit']=qs[_0x758c('0x22')](_0x4ebeca[_0x758c('0x3a')][_0x758c('0x22')]);_0x124401['offset']=qs[_0x758c('0x21')](_0x4ebeca[_0x758c('0x3a')][_0x758c('0x21')]);}return _0x268757['getTeams'](_0x124401);}})[_0x758c('0x29')](function(_0xa56ba3){if(_0xa56ba3){return _0xa56ba3?{'count':_0x2c1216,'rows':_0xa56ba3}:null;}})[_0x758c('0x29')](respondWithResult(_0x3530b6,null))['catch'](handleError(_0x3530b6,null));};exports[_0x758c('0x67')]=function(_0x3e0717,_0x57e293,_0x5c6ec1){var _0x54844f=_0x3e0717['body']['ids'];return db[_0x758c('0x68')][_0x758c('0x4a')]({'where':{'id':_0x54844f},'attributes':['id'],'include':[{'model':db[_0x758c('0x5d')],'as':_0x758c('0x69'),'attributes':['id',_0x758c('0x30'),_0x758c('0x6a'),_0x758c('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x3f7766){if(_0x3f7766){var _0x1a8b1b=_[_0x758c('0x6c')](_0x3f7766,function(_0xaeaa34){var _0x40696f=_0xaeaa34['get']({'plain':!![]});return _0x40696f[_0x758c('0x69')];});return db[_0x758c('0x34')]['find']({'where':{'id':_0x3e0717[_0x758c('0x4c')]['id']}})[_0x758c('0x29')](function(_0x1fadf9){return db[_0x758c('0x6d')]['transaction'](function(_0x2f9c89){return _0x1fadf9[_0x758c('0x67')](_0x54844f,{'transaction':_0x2f9c89})['then'](function(){return BPromise[_0x758c('0x6e')](_0x1a8b1b,function(_0x673503){return db[_0x758c('0x5c')]['findOrCreate']({'where':{'UserId':_0x673503['id'],'OpenchannelQueueId':_0x3e0717[_0x758c('0x4c')]['id']},'transaction':_0x2f9c89});});})[_0x758c('0x29')](function(){_0x1a8b1b[_0x758c('0x6f')](function(_0x21cc81){socket[_0x758c('0x70')](_0x758c('0x71'),{'UserId':_0x21cc81['id'],'OpenchannelQueueId':_0x1fadf9['id']});});});});});}})[_0x758c('0x29')](respondWithStatusCode(_0x57e293,null))[_0x758c('0x4b')](handleError(_0x57e293,null));};exports['removeTeams']=function(_0x38d027,_0x55273d,_0x589521){return db[_0x758c('0x68')][_0x758c('0x4a')]({'where':{'id':_0x38d027[_0x758c('0x3a')][_0x758c('0x72')]},'attributes':['id'],'include':[{'model':db[_0x758c('0x5d')],'as':_0x758c('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x55273d,null))[_0x758c('0x29')](function(_0x3e79fd){var _0x1bd78f=_[_0x758c('0x33')](_0x3e79fd,'id');var _0x49920a=[];var _0x2d276e=[];var _0x142fe3=squel[_0x758c('0x73')]();_0x142fe3[_0x758c('0x74')](_0x758c('0x75'))[_0x758c('0x76')]('team_has_openchannel_queues','tq')[_0x758c('0x77')](_0x758c('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x758c('0x79'),_0x38d027[_0x758c('0x4c')]['id']);for(var _0x120fdb=0x0;_0x120fdb<_0x3e79fd[_0x758c('0x3f')];_0x120fdb+=0x1){let _0x1cc50c=_0x3e79fd[_0x120fdb];for(var _0x9ef75d=0x0;_0x9ef75d<_0x1cc50c[_0x758c('0x69')][_0x758c('0x3f')];_0x9ef75d+=0x1){let _0x2c7701=_0x1cc50c[_0x758c('0x69')][_0x9ef75d];var _0x13b5a8=_0x142fe3[_0x758c('0x7a')]();_0x13b5a8[_0x758c('0x43')](_0x758c('0x7b'),_0x2c7701['id']);_0x2d276e[_0x758c('0x7c')](db['sequelize'][_0x758c('0x3a')](_0x13b5a8[_0x758c('0x7d')](),{'type':db[_0x758c('0x6d')][_0x758c('0x7e')]['SELECT']})[_0x758c('0x29')](function(_0x439cb1){if(_0x439cb1[_0x758c('0x3f')]===0x1){return _0x2c7701['id'];}else{var _0x4b19d7=_[_0x758c('0x7f')](_[_0x758c('0x33')](_0x439cb1,'TeamId'),function(_0x418895){return _['includes'](_0x1bd78f,_0x418895);});if(_0x4b19d7){return _0x2c7701['id'];}}}));}}return BPromise[_0x758c('0x80')](_0x2d276e)['then'](function(_0x56b291){_0x49920a=_(_0x49920a)['union'](_0x56b291)[_0x758c('0x81')]()['value']();return db['OpenchannelQueue'][_0x758c('0x53')]({'where':{'id':_0x38d027['params']['id']}})['then'](function(_0x533f39){return db['sequelize']['transaction'](function(_0x498f42){return _0x533f39[_0x758c('0x82')](_0x38d027[_0x758c('0x3a')][_0x758c('0x72')],{'transaction':_0x498f42})[_0x758c('0x29')](function(){if(!_[_0x758c('0x83')](_0x49920a)){return _0x533f39[_0x758c('0x84')](_0x49920a,{'transaction':_0x498f42});}})[_0x758c('0x29')](function(){_0x49920a['forEach'](function(_0x2b0764){socket[_0x758c('0x70')](_0x758c('0x85'),{'UserId':_0x2b0764,'OpenchannelQueueId':_0x533f39['id']});});});});});});})[_0x758c('0x29')](respondWithStatusCode(_0x55273d,null))[_0x758c('0x4b')](handleError(_0x55273d,null));};exports[_0x758c('0x86')]=function(_0x148546,_0x295ad1,_0x1ccb3f){return db[_0x758c('0x34')][_0x758c('0x53')]({'where':{'id':_0x148546[_0x758c('0x4c')]['id']}})[_0x758c('0x29')](handleEntityNotFound(_0x295ad1,null))['then'](function(_0x1bd6f6){if(_0x1bd6f6){return _0x1bd6f6[_0x758c('0x86')](_0x148546['body'][_0x758c('0x72')],_['omit'](_0x148546[_0x758c('0x4f')],[_0x758c('0x72'),'id'])||{})[_0x758c('0x87')](function(_0x2189d5){for(var _0x209897=0x0;_0x209897<_0x148546[_0x758c('0x4f')][_0x758c('0x72')][_0x758c('0x3f')];_0x209897+=0x1){socket[_0x758c('0x70')](_0x758c('0x71'),{'UserId':Number(_0x148546[_0x758c('0x4f')][_0x758c('0x72')][_0x209897]),'OpenchannelQueueId':Number(_0x148546[_0x758c('0x4c')]['id'])});}return _0x2189d5;});}})[_0x758c('0x29')](respondWithResult(_0x295ad1,null))[_0x758c('0x4b')](handleError(_0x295ad1,null));};exports['removeAgents']=function(_0x490c2f,_0xff0f67,_0x15be18){return db[_0x758c('0x34')][_0x758c('0x53')]({'where':{'id':_0x490c2f[_0x758c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xff0f67,null))[_0x758c('0x29')](function(_0x349987){if(_0x349987){return _0x349987[_0x758c('0x84')](_0x490c2f['query']['ids'])[_0x758c('0x29')](function(){if(_['isArray'](_0x490c2f['query'][_0x758c('0x72')])){for(var _0x25160a=0x0;_0x25160a<_0x490c2f[_0x758c('0x3a')][_0x758c('0x72')][_0x758c('0x3f')];_0x25160a+=0x1){socket[_0x758c('0x70')](_0x758c('0x85'),{'UserId':Number(_0x490c2f[_0x758c('0x3a')][_0x758c('0x72')][_0x25160a]),'OpenchannelQueueId':Number(_0x490c2f[_0x758c('0x4c')]['id'])});}}else{socket[_0x758c('0x70')](_0x758c('0x85'),{'UserId':Number(_0x490c2f['query']['ids']),'OpenchannelQueueId':Number(_0x490c2f['params']['id'])});}});}})['then'](respondWithStatusCode(_0xff0f67,null))[_0x758c('0x4b')](handleError(_0xff0f67,null));};exports[_0x758c('0x88')]=function(_0x4ff9a2,_0x175d44,_0x56cd4b){var _0x20c34a={};var _0x1060b9={};var _0xaa082b;var _0x2ed54c;return db[_0x758c('0x34')][_0x758c('0x59')]({'where':{'id':_0x4ff9a2[_0x758c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x175d44,null))[_0x758c('0x29')](function(_0x275874){if(_0x275874){_0xaa082b=_0x275874;_0x1060b9[_0x758c('0x39')]=_[_0x758c('0x4d')](db['User'][_0x758c('0x35')]);_0x1060b9[_0x758c('0x3a')]=_[_0x758c('0x4d')](_0x4ff9a2[_0x758c('0x3a')]);_0x1060b9[_0x758c('0x3b')]=_[_0x758c('0x3d')](_0x1060b9[_0x758c('0x39')],_0x1060b9['query']);_0x20c34a['attributes']=_['intersection'](_0x1060b9['model'],qs[_0x758c('0x3e')](_0x4ff9a2[_0x758c('0x3a')][_0x758c('0x3e')]));_0x20c34a[_0x758c('0x3c')]=_0x20c34a[_0x758c('0x3c')][_0x758c('0x3f')]?_0x20c34a[_0x758c('0x3c')]:_0x1060b9[_0x758c('0x39')];_0x20c34a['order']=qs[_0x758c('0x42')](_0x4ff9a2[_0x758c('0x3a')]['sort']);_0x20c34a['where']=qs[_0x758c('0x3b')](_['pick'](_0x4ff9a2[_0x758c('0x3a')],_0x1060b9[_0x758c('0x3b')]));if(_0x4ff9a2[_0x758c('0x3a')][_0x758c('0x44')]){_0x20c34a[_0x758c('0x43')]=_[_0x758c('0x45')](_0x20c34a['where'],{'$or':_['map'](_0x20c34a['attributes'],function(_0x86d81f){var _0x1898a6={};_0x1898a6[_0x86d81f]={'$like':'%'+_0x4ff9a2['query'][_0x758c('0x44')]+'%'};return _0x1898a6;})});}_0x20c34a=_[_0x758c('0x45')]({},_0x20c34a,_0x4ff9a2[_0x758c('0x47')]);return _0xaa082b['getAgents'](_0x20c34a);}})[_0x758c('0x29')](function(_0x4946a1){if(_0x4946a1){_0x2ed54c=_0x4946a1[_0x758c('0x3f')];if(!_0x4ff9a2[_0x758c('0x3a')]['hasOwnProperty']('nolimit')){_0x20c34a[_0x758c('0x22')]=qs['limit'](_0x4ff9a2[_0x758c('0x3a')][_0x758c('0x22')]);_0x20c34a[_0x758c('0x21')]=qs[_0x758c('0x21')](_0x4ff9a2[_0x758c('0x3a')][_0x758c('0x21')]);}return _0xaa082b[_0x758c('0x88')](_0x20c34a);}})[_0x758c('0x29')](function(_0x5490d3){if(_0x5490d3){return _0x5490d3?{'count':_0x2ed54c,'rows':_0x5490d3}:null;}})['then'](respondWithResult(_0x175d44,null))[_0x758c('0x4b')](handleError(_0x175d44,null));}; \ No newline at end of file +var _0xdf73=['then','destroy','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','all','compact','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update'];(function(_0x34d293,_0x3474c1){var _0xbb500e=function(_0x261843){while(--_0x261843){_0x34d293['push'](_0x34d293['shift']());}};_0xbb500e(++_0x3474c1);}(_0xdf73,0x16e));var _0x3df7=function(_0x55dfeb,_0x3bdbd5){_0x55dfeb=_0x55dfeb-0x0;var _0x41a517=_0xdf73[_0x55dfeb];return _0x41a517;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3df7('0x0'));var jsonpatch=require(_0x3df7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3df7('0x2'));var util=require(_0x3df7('0x3'));var path=require(_0x3df7('0x4'));var sox=require(_0x3df7('0x5'));var csv=require(_0x3df7('0x6'));var ejs=require(_0x3df7('0x7'));var fs=require('fs');var fs_extra=require(_0x3df7('0x8'));var _=require('lodash');var squel=require(_0x3df7('0x9'));var crypto=require(_0x3df7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3df7('0x6'));var querystring=require(_0x3df7('0xb'));var Papa=require(_0x3df7('0xc'));var Redis=require(_0x3df7('0xd'));var authService=require(_0x3df7('0xe'));var qs=require(_0x3df7('0xf'));var as=require(_0x3df7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3df7('0x11'))(_0x3df7('0x12'));var utils=require(_0x3df7('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3df7('0x14')](config[_0x3df7('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x3df7('0x16'))(new Redis(config[_0x3df7('0x15')]));require(_0x3df7('0x17'))['register'](socket);function respondWithStatusCode(_0x32009a,_0x42ed63){_0x42ed63=_0x42ed63||0xcc;return function(_0x59acd9){if(_0x59acd9){return _0x32009a[_0x3df7('0x18')](_0x42ed63);}return _0x32009a[_0x3df7('0x19')](_0x42ed63)[_0x3df7('0x1a')]();};}function respondWithResult(_0x554fc7,_0x2e09ca){_0x2e09ca=_0x2e09ca||0xc8;return function(_0x5deaa0){if(_0x5deaa0){return _0x554fc7[_0x3df7('0x19')](_0x2e09ca)[_0x3df7('0x1b')](_0x5deaa0);}};}function respondWithFilteredResult(_0x455eca,_0x21b52c){return function(_0x14dfda){if(_0x14dfda){var _0x5a8aa0=typeof _0x21b52c['offset']===_0x3df7('0x1c')&&typeof _0x21b52c[_0x3df7('0x1d')]===_0x3df7('0x1c');var _0x3dad10=_0x14dfda['count'];var _0xf8b52a=_0x5a8aa0?0x0:_0x21b52c[_0x3df7('0x1e')];var _0x342bde=_0x5a8aa0?_0x14dfda[_0x3df7('0x1f')]:_0x21b52c[_0x3df7('0x1e')]+_0x21b52c[_0x3df7('0x1d')];var _0x50d2b3;if(_0x342bde>=_0x3dad10){_0x342bde=_0x3dad10;_0x50d2b3=0xc8;}else{_0x50d2b3=0xce;}_0x455eca[_0x3df7('0x19')](_0x50d2b3);return _0x455eca[_0x3df7('0x20')](_0x3df7('0x21'),_0xf8b52a+'-'+_0x342bde+'/'+_0x3dad10)[_0x3df7('0x1b')](_0x14dfda);}return null;};}function patchUpdates(_0x2277f7){return function(_0x51b531){try{jsonpatch['apply'](_0x51b531,_0x2277f7,!![]);}catch(_0x3db10c){return BPromise[_0x3df7('0x22')](_0x3db10c);}return _0x51b531['save']();};}function saveUpdates(_0x52feb2,_0x5bf2eb){return function(_0x28ee9e){if(_0x28ee9e){return _0x28ee9e[_0x3df7('0x23')](_0x52feb2)[_0x3df7('0x24')](function(_0xcff710){return _0xcff710;});}return null;};}function removeEntity(_0x21eea4,_0x48a583){return function(_0x41babe){if(_0x41babe){return _0x41babe[_0x3df7('0x25')]()[_0x3df7('0x24')](function(){var _0x180cd6=_0x41babe['get']({'plain':!![]});var _0x2313e3=_0x3df7('0x26');return db[_0x3df7('0x27')][_0x3df7('0x25')]({'where':{'type':_0x2313e3,'resourceId':_0x180cd6['id']}})[_0x3df7('0x24')](function(){return _0x41babe;});})[_0x3df7('0x24')](function(){_0x21eea4[_0x3df7('0x19')](0xcc)[_0x3df7('0x1a')]();});}};}function handleEntityNotFound(_0x5befc3,_0x2cc408){return function(_0x1dc2c0){if(!_0x1dc2c0){_0x5befc3['sendStatus'](0x194);}return _0x1dc2c0;};}function handleError(_0x10130a,_0x1411ca){_0x1411ca=_0x1411ca||0x1f4;return function(_0xef81cd){logger[_0x3df7('0x28')](_0xef81cd['stack']);if(_0xef81cd['name']){delete _0xef81cd[_0x3df7('0x29')];}_0x10130a['status'](_0x1411ca)[_0x3df7('0x2a')](_0xef81cd);};}exports[_0x3df7('0x2b')]=function(_0x3d1c4f,_0x3f0ff8){var _0x56c214={},_0x165e7b={},_0x1ac0e7={'count':0x0,'rows':[]};var _0x4a6d91=_[_0x3df7('0x2c')](db[_0x3df7('0x2d')][_0x3df7('0x2e')],function(_0x2101d9){return{'name':_0x2101d9['fieldName'],'type':_0x2101d9['type']['key']};});_0x165e7b[_0x3df7('0x2f')]=_[_0x3df7('0x2c')](_0x4a6d91,_0x3df7('0x29'));_0x165e7b[_0x3df7('0x30')]=_[_0x3df7('0x31')](_0x3d1c4f[_0x3df7('0x30')]);_0x165e7b[_0x3df7('0x32')]=_[_0x3df7('0x33')](_0x165e7b['model'],_0x165e7b[_0x3df7('0x30')]);_0x56c214[_0x3df7('0x34')]=_[_0x3df7('0x33')](_0x165e7b[_0x3df7('0x2f')],qs[_0x3df7('0x35')](_0x3d1c4f[_0x3df7('0x30')]['fields']));_0x56c214[_0x3df7('0x34')]=_0x56c214['attributes']['length']?_0x56c214[_0x3df7('0x34')]:_0x165e7b[_0x3df7('0x2f')];if(!_0x3d1c4f[_0x3df7('0x30')]['hasOwnProperty'](_0x3df7('0x36'))){_0x56c214[_0x3df7('0x1d')]=qs[_0x3df7('0x1d')](_0x3d1c4f['query'][_0x3df7('0x1d')]);_0x56c214[_0x3df7('0x1e')]=qs[_0x3df7('0x1e')](_0x3d1c4f[_0x3df7('0x30')][_0x3df7('0x1e')]);}_0x56c214[_0x3df7('0x37')]=qs[_0x3df7('0x38')](_0x3d1c4f[_0x3df7('0x30')][_0x3df7('0x38')]);_0x56c214['where']=qs[_0x3df7('0x32')](_[_0x3df7('0x39')](_0x3d1c4f[_0x3df7('0x30')],_0x165e7b[_0x3df7('0x32')]),_0x4a6d91);if(_0x3d1c4f[_0x3df7('0x30')]['filter']){_0x56c214[_0x3df7('0x3a')]=_[_0x3df7('0x3b')](_0x56c214[_0x3df7('0x3a')],{'$or':_[_0x3df7('0x2c')](_0x4a6d91,function(_0x16415e){if(_0x16415e[_0x3df7('0x3c')]!==_0x3df7('0x3d')){var _0x4add12={};_0x4add12[_0x16415e[_0x3df7('0x29')]]={'$like':'%'+_0x3d1c4f['query'][_0x3df7('0x3e')]+'%'};return _0x4add12;}})});}_0x56c214=_['merge']({},_0x56c214,_0x3d1c4f[_0x3df7('0x3f')]);var _0x356b26={'where':_0x56c214[_0x3df7('0x3a')]};return db[_0x3df7('0x2d')][_0x3df7('0x1f')](_0x356b26)['then'](function(_0x1b8a07){_0x1ac0e7['count']=_0x1b8a07;if(_0x3d1c4f['query']['includeAll']){_0x56c214[_0x3df7('0x40')]=[{'all':!![]}];}return db[_0x3df7('0x2d')][_0x3df7('0x41')](_0x56c214);})['then'](function(_0x49e61c){_0x1ac0e7['rows']=_0x49e61c;return _0x1ac0e7;})[_0x3df7('0x24')](respondWithFilteredResult(_0x3f0ff8,_0x56c214))[_0x3df7('0x42')](handleError(_0x3f0ff8,null));};exports[_0x3df7('0x43')]=function(_0x2d9b90,_0x2dbbed){var _0x99e02e={'raw':!![],'where':{'id':_0x2d9b90[_0x3df7('0x44')]['id']}},_0x1cde47={};_0x1cde47['model']=_[_0x3df7('0x31')](db[_0x3df7('0x2d')][_0x3df7('0x2e')]);_0x1cde47[_0x3df7('0x30')]=_[_0x3df7('0x31')](_0x2d9b90[_0x3df7('0x30')]);_0x1cde47['filters']=_['intersection'](_0x1cde47['model'],_0x1cde47[_0x3df7('0x30')]);_0x99e02e[_0x3df7('0x34')]=_[_0x3df7('0x33')](_0x1cde47[_0x3df7('0x2f')],qs[_0x3df7('0x35')](_0x2d9b90[_0x3df7('0x30')][_0x3df7('0x35')]));_0x99e02e['attributes']=_0x99e02e['attributes']['length']?_0x99e02e['attributes']:_0x1cde47[_0x3df7('0x2f')];if(_0x2d9b90['query'][_0x3df7('0x45')]){_0x99e02e[_0x3df7('0x40')]=[{'all':!![]}];}_0x99e02e=_[_0x3df7('0x3b')]({},_0x99e02e,_0x2d9b90[_0x3df7('0x3f')]);return db[_0x3df7('0x2d')][_0x3df7('0x46')](_0x99e02e)[_0x3df7('0x24')](handleEntityNotFound(_0x2dbbed,null))['then'](respondWithResult(_0x2dbbed,null))[_0x3df7('0x42')](handleError(_0x2dbbed,null));};exports['create']=function(_0x1fe8cd,_0x179279){return db[_0x3df7('0x2d')][_0x3df7('0x47')](_0x1fe8cd[_0x3df7('0x48')],{})[_0x3df7('0x24')](function(_0x305ca1){var _0x2f9703=_0x1fe8cd[_0x3df7('0x49')]['get']({'plain':!![]});if(!_0x2f9703)throw new Error(_0x3df7('0x4a'));if(_0x2f9703['role']==='user'){var _0x17c380=_0x305ca1[_0x3df7('0x4b')]({'plain':!![]});var _0x178f79=_0x3df7('0x26');return db[_0x3df7('0x4c')][_0x3df7('0x46')]({'where':{'name':_0x178f79,'userProfileId':_0x2f9703[_0x3df7('0x4d')]},'raw':!![]})[_0x3df7('0x24')](function(_0x2656cc){if(_0x2656cc&&_0x2656cc[_0x3df7('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x17c380['name'],'resourceId':_0x17c380['id'],'type':_0x2656cc[_0x3df7('0x29')],'sectionId':_0x2656cc['id']},{})[_0x3df7('0x24')](function(){return _0x305ca1;});}else{return _0x305ca1;}})[_0x3df7('0x42')](function(_0x3e73a6){logger[_0x3df7('0x28')](_0x3df7('0x4f'),_0x3e73a6);throw _0x3e73a6;});}return _0x305ca1;})[_0x3df7('0x24')](respondWithResult(_0x179279,0xc9))[_0x3df7('0x42')](handleError(_0x179279,null));};exports[_0x3df7('0x23')]=function(_0x20d03f,_0x50de0e){if(_0x20d03f['body']['id']){delete _0x20d03f[_0x3df7('0x48')]['id'];}return db[_0x3df7('0x2d')]['find']({'where':{'id':_0x20d03f[_0x3df7('0x44')]['id']}})[_0x3df7('0x24')](handleEntityNotFound(_0x50de0e,null))['then'](saveUpdates(_0x20d03f[_0x3df7('0x48')],null))[_0x3df7('0x24')](respondWithResult(_0x50de0e,null))[_0x3df7('0x42')](handleError(_0x50de0e,null));};exports[_0x3df7('0x25')]=function(_0x36bab5,_0x1ea99b){return db[_0x3df7('0x2d')]['find']({'where':{'id':_0x36bab5['params']['id']}})['then'](handleEntityNotFound(_0x1ea99b,null))[_0x3df7('0x24')](removeEntity(_0x1ea99b,null))['catch'](handleError(_0x1ea99b,null));};exports[_0x3df7('0x50')]=function(_0x3baace,_0x3ae13e){return db[_0x3df7('0x2d')][_0x3df7('0x50')]()[_0x3df7('0x24')](respondWithResult(_0x3ae13e,null))[_0x3df7('0x42')](handleError(_0x3ae13e,null));};exports[_0x3df7('0x51')]=function(_0x25fd7f,_0x40de73,_0x5b678c){var _0x54bfb0={'raw':!![],'where':{}},_0x2cd624={},_0x49cf4a;return db[_0x3df7('0x2d')][_0x3df7('0x52')]({'where':{'id':_0x25fd7f[_0x3df7('0x44')]['id']}})[_0x3df7('0x24')](handleEntityNotFound(_0x40de73,null))['then'](function(_0x349ab5){if(_0x349ab5){_0x49cf4a=_0x349ab5[_0x3df7('0x4b')]({'plain':!![]});_0x2cd624['model']=_[_0x3df7('0x31')](db[_0x3df7('0x53')]['rawAttributes']);_0x2cd624[_0x3df7('0x30')]=_['keys'](_0x25fd7f['query']);_0x2cd624[_0x3df7('0x32')]=_[_0x3df7('0x33')](_0x2cd624[_0x3df7('0x2f')],_0x2cd624['query']);_0x54bfb0[_0x3df7('0x34')]=_[_0x3df7('0x33')](_0x2cd624[_0x3df7('0x2f')],qs[_0x3df7('0x35')](_0x25fd7f[_0x3df7('0x30')]['fields']));_0x54bfb0[_0x3df7('0x34')]=_0x54bfb0[_0x3df7('0x34')][_0x3df7('0x54')]?_0x54bfb0[_0x3df7('0x34')]:_0x2cd624[_0x3df7('0x2f')];if(!_0x25fd7f[_0x3df7('0x30')][_0x3df7('0x55')](_0x3df7('0x36'))){_0x54bfb0[_0x3df7('0x1d')]=qs[_0x3df7('0x1d')](_0x25fd7f[_0x3df7('0x30')][_0x3df7('0x1d')]);_0x54bfb0[_0x3df7('0x1e')]=qs[_0x3df7('0x1e')](_0x25fd7f[_0x3df7('0x30')][_0x3df7('0x1e')]);}_0x54bfb0[_0x3df7('0x37')]=qs[_0x3df7('0x38')](_0x25fd7f['query'][_0x3df7('0x38')]);_0x54bfb0[_0x3df7('0x3a')]=qs['filters'](_[_0x3df7('0x39')](_0x25fd7f[_0x3df7('0x30')],_0x2cd624[_0x3df7('0x32')]));_0x54bfb0[_0x3df7('0x3a')][_0x3df7('0x56')]=_0x349ab5['id'];if(_0x25fd7f['query'][_0x3df7('0x3e')]){_0x54bfb0[_0x3df7('0x3a')]=_['merge'](_0x54bfb0[_0x3df7('0x3a')],{'$or':_[_0x3df7('0x2c')](_0x54bfb0[_0x3df7('0x34')],function(_0x7a3fb9){var _0x291e77={};_0x291e77[_0x7a3fb9]={'$like':'%'+_0x25fd7f[_0x3df7('0x30')][_0x3df7('0x3e')]+'%'};return _0x291e77;})});}_0x54bfb0=_[_0x3df7('0x3b')]({},_0x54bfb0,_0x25fd7f['options']);return db['UserOpenchannelQueue'][_0x3df7('0x41')](_0x54bfb0);}})[_0x3df7('0x24')](function(_0x33640d){if(_0x33640d){return db[_0x3df7('0x57')]['findAndCountAll']({'where':{'id':_['map'](_0x33640d,_0x3df7('0x58')),'role':_0x3df7('0x59')},'attributes':['id',_0x3df7('0x29'),_0x3df7('0x5a'),_0x3df7('0x5b'),_0x3df7('0x5c')]});}})[_0x3df7('0x24')](function(_0x2179bc){if(_0x2179bc){return{'count':_0x2179bc['count'],'rows':_[_0x3df7('0x2c')](_0x2179bc['rows'],function(_0x3e6ecf){return{'membername':_0x3e6ecf['name'],'UserId':_0x3e6ecf['id'],'queue_name':_0x49cf4a[_0x3df7('0x29')],'OpenchannelQueueId':_0x49cf4a['id'],'interface':util[_0x3df7('0x5d')](_0x3df7('0x5e'),_0x3df7('0x5f'),_0x3e6ecf[_0x3df7('0x29')]),'penalty':0x0,'paused':_0x3e6ecf[_0x3df7('0x5a')],'createdAt':_0x3e6ecf[_0x3df7('0x5c')],'updatedAt':_0x3e6ecf['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3df7('0x24')](respondWithFilteredResult(_0x40de73,_0x54bfb0))[_0x3df7('0x42')](handleError(_0x40de73,null));};exports[_0x3df7('0x60')]=function(_0xcf452b,_0x566ac6,_0x50ccf2){var _0x6b7b02={};var _0xd512d9={};var _0x5b3475;var _0x4e726c;return db['OpenchannelQueue'][_0x3df7('0x52')]({'where':{'id':_0xcf452b['params']['id']}})[_0x3df7('0x24')](handleEntityNotFound(_0x566ac6,null))[_0x3df7('0x24')](function(_0x526d9d){if(_0x526d9d){_0x5b3475=_0x526d9d;_0xd512d9[_0x3df7('0x2f')]=_[_0x3df7('0x31')](db[_0x3df7('0x61')]['rawAttributes']);_0xd512d9[_0x3df7('0x30')]=_[_0x3df7('0x31')](_0xcf452b[_0x3df7('0x30')]);_0xd512d9['filters']=_['intersection'](_0xd512d9[_0x3df7('0x2f')],_0xd512d9[_0x3df7('0x30')]);_0x6b7b02[_0x3df7('0x34')]=_[_0x3df7('0x33')](_0xd512d9[_0x3df7('0x2f')],qs[_0x3df7('0x35')](_0xcf452b[_0x3df7('0x30')][_0x3df7('0x35')]));_0x6b7b02[_0x3df7('0x34')]=_0x6b7b02[_0x3df7('0x34')][_0x3df7('0x54')]?_0x6b7b02['attributes']:_0xd512d9['model'];_0x6b7b02[_0x3df7('0x37')]=qs[_0x3df7('0x38')](_0xcf452b[_0x3df7('0x30')]['sort']);_0x6b7b02[_0x3df7('0x3a')]=qs[_0x3df7('0x32')](_[_0x3df7('0x39')](_0xcf452b[_0x3df7('0x30')],_0xd512d9['filters']));if(_0xcf452b[_0x3df7('0x30')][_0x3df7('0x3e')]){_0x6b7b02[_0x3df7('0x3a')]=_[_0x3df7('0x3b')](_0x6b7b02[_0x3df7('0x3a')],{'$or':_[_0x3df7('0x2c')](_0x6b7b02[_0x3df7('0x34')],function(_0xf70f4d){var _0x1e01fa={};_0x1e01fa[_0xf70f4d]={'$like':'%'+_0xcf452b[_0x3df7('0x30')][_0x3df7('0x3e')]+'%'};return _0x1e01fa;})});}_0x6b7b02=_[_0x3df7('0x3b')]({},_0x6b7b02,_0xcf452b[_0x3df7('0x3f')]);return _0x5b3475['getTeams'](_0x6b7b02);}})['then'](function(_0x50bc91){if(_0x50bc91){_0x4e726c=_0x50bc91['length'];if(!_0xcf452b['query'][_0x3df7('0x55')]('nolimit')){_0x6b7b02[_0x3df7('0x1d')]=qs[_0x3df7('0x1d')](_0xcf452b[_0x3df7('0x30')]['limit']);_0x6b7b02[_0x3df7('0x1e')]=qs['offset'](_0xcf452b[_0x3df7('0x30')][_0x3df7('0x1e')]);}return _0x5b3475['getTeams'](_0x6b7b02);}})['then'](function(_0x28c330){if(_0x28c330){return _0x28c330?{'count':_0x4e726c,'rows':_0x28c330}:null;}})['then'](respondWithResult(_0x566ac6,null))['catch'](handleError(_0x566ac6,null));};exports[_0x3df7('0x62')]=function(_0x2917f8,_0x3f5af9,_0x417e4c){var _0x3c70db=_0x2917f8['body'][_0x3df7('0x63')];return db[_0x3df7('0x61')][_0x3df7('0x41')]({'where':{'id':_0x3c70db},'attributes':['id'],'include':[{'model':db[_0x3df7('0x57')],'as':'Agents','attributes':['id','name',_0x3df7('0x64'),_0x3df7('0x65'),'interface'],'raw':!![]}]})[_0x3df7('0x24')](function(_0x460f84){if(_0x460f84){var _0x2e6a04=_[_0x3df7('0x66')](_0x460f84,function(_0x108f82){var _0x12e0a9=_0x108f82[_0x3df7('0x4b')]({'plain':!![]});return _0x12e0a9[_0x3df7('0x67')];});return db[_0x3df7('0x2d')][_0x3df7('0x46')]({'where':{'id':_0x2917f8[_0x3df7('0x44')]['id']}})['then'](function(_0x2dd0d4){return db[_0x3df7('0x68')][_0x3df7('0x69')](function(_0xb12566){return _0x2dd0d4[_0x3df7('0x62')](_0x3c70db,{'transaction':_0xb12566})[_0x3df7('0x24')](function(){return BPromise['each'](_0x2e6a04,function(_0x92fee8){return db[_0x3df7('0x53')][_0x3df7('0x6a')]({'where':{'UserId':_0x92fee8['id'],'OpenchannelQueueId':_0x2917f8[_0x3df7('0x44')]['id']},'transaction':_0xb12566});});})[_0x3df7('0x24')](function(){_0x2e6a04[_0x3df7('0x6b')](function(_0x2b2de8){socket['emit'](_0x3df7('0x6c'),{'UserId':_0x2b2de8['id'],'OpenchannelQueueId':_0x2dd0d4['id']});});});});});}})[_0x3df7('0x24')](respondWithStatusCode(_0x3f5af9,null))['catch'](handleError(_0x3f5af9,null));};exports[_0x3df7('0x6d')]=function(_0x4dfae9,_0x19a141,_0x2efa18){return db[_0x3df7('0x61')]['findAll']({'where':{'id':_0x4dfae9[_0x3df7('0x30')][_0x3df7('0x63')]},'attributes':['id'],'include':[{'model':db[_0x3df7('0x57')],'as':_0x3df7('0x67'),'attributes':['id'],'raw':!![]}]})[_0x3df7('0x24')](handleEntityNotFound(_0x19a141,null))[_0x3df7('0x24')](function(_0x146e59){var _0x4a486a=_['map'](_0x146e59,'id');var _0x1a3398=[];var _0x13a2ea=[];var _0x5cad1d=squel[_0x3df7('0x6e')]();_0x5cad1d[_0x3df7('0x6f')](_0x3df7('0x70'))[_0x3df7('0x71')](_0x3df7('0x72'),'tq')[_0x3df7('0x73')](_0x3df7('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x3df7('0x75'),_0x4dfae9[_0x3df7('0x44')]['id']);for(var _0x50cb9b=0x0;_0x50cb9b<_0x146e59['length'];_0x50cb9b+=0x1){let _0x10c276=_0x146e59[_0x50cb9b];for(var _0x4edd96=0x0;_0x4edd96<_0x10c276[_0x3df7('0x67')][_0x3df7('0x54')];_0x4edd96+=0x1){let _0x191362=_0x10c276[_0x3df7('0x67')][_0x4edd96];var _0x392de3=_0x5cad1d[_0x3df7('0x76')]();_0x392de3['where']('ut.UserId\x20=\x20?',_0x191362['id']);_0x13a2ea[_0x3df7('0x77')](db['sequelize'][_0x3df7('0x30')](_0x392de3[_0x3df7('0x78')](),{'type':db['sequelize'][_0x3df7('0x79')][_0x3df7('0x7a')]})[_0x3df7('0x24')](function(_0x49f598){if(_0x49f598[_0x3df7('0x54')]===0x1){return _0x191362['id'];}else{var _0x576d0e=_[_0x3df7('0x7b')](_['map'](_0x49f598,'TeamId'),function(_0x545413){return _['includes'](_0x4a486a,_0x545413);});if(_0x576d0e){return _0x191362['id'];}}}));}}return BPromise[_0x3df7('0x7c')](_0x13a2ea)[_0x3df7('0x24')](function(_0x36fa5c){_0x1a3398=_(_0x1a3398)['union'](_0x36fa5c)[_0x3df7('0x7d')]()[_0x3df7('0x7e')]();return db[_0x3df7('0x2d')][_0x3df7('0x46')]({'where':{'id':_0x4dfae9[_0x3df7('0x44')]['id']}})['then'](function(_0x2388cb){return db[_0x3df7('0x68')][_0x3df7('0x69')](function(_0x54f69a){return _0x2388cb[_0x3df7('0x6d')](_0x4dfae9[_0x3df7('0x30')][_0x3df7('0x63')],{'transaction':_0x54f69a})[_0x3df7('0x24')](function(){if(!_['isEmpty'](_0x1a3398)){return _0x2388cb[_0x3df7('0x7f')](_0x1a3398,{'transaction':_0x54f69a});}})[_0x3df7('0x24')](function(){_0x1a3398[_0x3df7('0x6b')](function(_0x38396e){socket[_0x3df7('0x80')](_0x3df7('0x81'),{'UserId':_0x38396e,'OpenchannelQueueId':_0x2388cb['id']});});});});});});})[_0x3df7('0x24')](respondWithStatusCode(_0x19a141,null))[_0x3df7('0x42')](handleError(_0x19a141,null));};exports[_0x3df7('0x82')]=function(_0x316d4b,_0x3ba77c,_0x596a49){return db[_0x3df7('0x2d')][_0x3df7('0x46')]({'where':{'id':_0x316d4b[_0x3df7('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ba77c,null))[_0x3df7('0x24')](function(_0x1ef7bc){if(_0x1ef7bc){return _0x1ef7bc[_0x3df7('0x82')](_0x316d4b['body'][_0x3df7('0x63')],_[_0x3df7('0x83')](_0x316d4b[_0x3df7('0x48')],[_0x3df7('0x63'),'id'])||{})['spread'](function(_0x2bfc4f){for(var _0x2ac210=0x0;_0x2ac210<_0x316d4b['body'][_0x3df7('0x63')]['length'];_0x2ac210+=0x1){socket[_0x3df7('0x80')](_0x3df7('0x6c'),{'UserId':Number(_0x316d4b['body'][_0x3df7('0x63')][_0x2ac210]),'OpenchannelQueueId':Number(_0x316d4b[_0x3df7('0x44')]['id'])});}return _0x2bfc4f;});}})[_0x3df7('0x24')](respondWithResult(_0x3ba77c,null))[_0x3df7('0x42')](handleError(_0x3ba77c,null));};exports['removeAgents']=function(_0x258eb6,_0x50696f,_0x4f3548){return db[_0x3df7('0x2d')]['find']({'where':{'id':_0x258eb6[_0x3df7('0x44')]['id']}})[_0x3df7('0x24')](handleEntityNotFound(_0x50696f,null))[_0x3df7('0x24')](function(_0x5bc2a3){if(_0x5bc2a3){return _0x5bc2a3[_0x3df7('0x7f')](_0x258eb6[_0x3df7('0x30')][_0x3df7('0x63')])[_0x3df7('0x24')](function(){if(_[_0x3df7('0x84')](_0x258eb6[_0x3df7('0x30')]['ids'])){for(var _0x526533=0x0;_0x526533<_0x258eb6[_0x3df7('0x30')][_0x3df7('0x63')][_0x3df7('0x54')];_0x526533+=0x1){socket['emit'](_0x3df7('0x81'),{'UserId':Number(_0x258eb6['query'][_0x3df7('0x63')][_0x526533]),'OpenchannelQueueId':Number(_0x258eb6[_0x3df7('0x44')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x258eb6[_0x3df7('0x30')][_0x3df7('0x63')]),'OpenchannelQueueId':Number(_0x258eb6[_0x3df7('0x44')]['id'])});}});}})[_0x3df7('0x24')](respondWithStatusCode(_0x50696f,null))['catch'](handleError(_0x50696f,null));};exports[_0x3df7('0x85')]=function(_0x1de33d,_0x22a9c3,_0x35e453){var _0x5bdd33={};var _0x7c1e80={};var _0x301219;var _0x1d5aea;return db['OpenchannelQueue'][_0x3df7('0x52')]({'where':{'id':_0x1de33d[_0x3df7('0x44')]['id']}})[_0x3df7('0x24')](handleEntityNotFound(_0x22a9c3,null))[_0x3df7('0x24')](function(_0x575e90){if(_0x575e90){_0x301219=_0x575e90;_0x7c1e80['model']=_[_0x3df7('0x31')](db[_0x3df7('0x57')]['rawAttributes']);_0x7c1e80[_0x3df7('0x30')]=_[_0x3df7('0x31')](_0x1de33d[_0x3df7('0x30')]);_0x7c1e80['filters']=_[_0x3df7('0x33')](_0x7c1e80[_0x3df7('0x2f')],_0x7c1e80[_0x3df7('0x30')]);_0x5bdd33[_0x3df7('0x34')]=_['intersection'](_0x7c1e80[_0x3df7('0x2f')],qs[_0x3df7('0x35')](_0x1de33d[_0x3df7('0x30')]['fields']));_0x5bdd33[_0x3df7('0x34')]=_0x5bdd33['attributes']['length']?_0x5bdd33['attributes']:_0x7c1e80[_0x3df7('0x2f')];_0x5bdd33['order']=qs[_0x3df7('0x38')](_0x1de33d[_0x3df7('0x30')][_0x3df7('0x38')]);_0x5bdd33['where']=qs[_0x3df7('0x32')](_[_0x3df7('0x39')](_0x1de33d['query'],_0x7c1e80[_0x3df7('0x32')]));if(_0x1de33d['query']['filter']){_0x5bdd33['where']=_[_0x3df7('0x3b')](_0x5bdd33[_0x3df7('0x3a')],{'$or':_[_0x3df7('0x2c')](_0x5bdd33[_0x3df7('0x34')],function(_0x1a1afb){var _0x5b9fbc={};_0x5b9fbc[_0x1a1afb]={'$like':'%'+_0x1de33d[_0x3df7('0x30')][_0x3df7('0x3e')]+'%'};return _0x5b9fbc;})});}_0x5bdd33=_[_0x3df7('0x3b')]({},_0x5bdd33,_0x1de33d['options']);return _0x301219[_0x3df7('0x85')](_0x5bdd33);}})[_0x3df7('0x24')](function(_0x143b64){if(_0x143b64){_0x1d5aea=_0x143b64[_0x3df7('0x54')];if(!_0x1de33d[_0x3df7('0x30')]['hasOwnProperty'](_0x3df7('0x36'))){_0x5bdd33[_0x3df7('0x1d')]=qs[_0x3df7('0x1d')](_0x1de33d[_0x3df7('0x30')][_0x3df7('0x1d')]);_0x5bdd33['offset']=qs['offset'](_0x1de33d[_0x3df7('0x30')][_0x3df7('0x1e')]);}return _0x301219[_0x3df7('0x85')](_0x5bdd33);}})[_0x3df7('0x24')](function(_0x5bcb61){if(_0x5bcb61){return _0x5bcb61?{'count':_0x1d5aea,'rows':_0x5bcb61}:null;}})[_0x3df7('0x24')](respondWithResult(_0x22a9c3,null))[_0x3df7('0x42')](handleError(_0x22a9c3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 963bfcf..b284863 100644 --- a/server/api/openchannelQueue/openchannelQueue.events.js +++ b/server/api/openchannelQueue/openchannelQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2a1=['exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc2a1,0x1e9));var _0x1c2a=function(_0x5eaa8a,_0x396d27){_0x5eaa8a=_0x5eaa8a-0x0;var _0x558bc8=_0xc2a1[_0x5eaa8a];return _0x558bc8;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x1c2a('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1c2a('0x1')](0x0);var events={'afterCreate':_0x1c2a('0x2'),'afterUpdate':_0x1c2a('0x3'),'afterDestroy':_0x1c2a('0x4')};function emitEvent(_0x33c392){return function(_0x3dd051,_0x19f0f7,_0x418731){OpenchannelQueueEvents['emit'](_0x33c392+':'+_0x3dd051['id'],_0x3dd051);OpenchannelQueueEvents[_0x1c2a('0x5')](_0x33c392,_0x3dd051);_0x418731(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x1c2a('0x6')](e,emitEvent(event));}}module[_0x1c2a('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x35f4=['../../mysqldb','OpenchannelQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4a085d,_0x1ba54d){var _0x17c5a5=function(_0x43a511){while(--_0x43a511){_0x4a085d['push'](_0x4a085d['shift']());}};_0x17c5a5(++_0x1ba54d);}(_0x35f4,0xe0));var _0x435f=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x35f4[_0x3e0b8f];return _0x22f742;};'use strict';var EventEmitter=require(_0x435f('0x0'));var OpenchannelQueue=require(_0x435f('0x1'))['db'][_0x435f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x435f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x435f('0x4')};function emitEvent(_0x18cdea){return function(_0x3ed4f3,_0x143005,_0x13e3d1){OpenchannelQueueEvents[_0x435f('0x5')](_0x18cdea+':'+_0x3ed4f3['id'],_0x3ed4f3);OpenchannelQueueEvents[_0x435f('0x5')](_0x18cdea,_0x3ed4f3);_0x13e3d1(null);};}for(var e in events){if(events[_0x435f('0x6')](e)){var event=events[e];OpenchannelQueue[_0x435f('0x7')](e,emitEvent(event));}}module[_0x435f('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 771b29b..5f2c8e3 100644 --- a/server/api/openchannelQueue/openchannelQueue.model.js +++ b/server/api/openchannelQueue/openchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd9e=['bluebird','request-promise','path','../../config/environment','exports','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api'];(function(_0x280587,_0x4e9971){var _0x3b7543=function(_0x1e94de){while(--_0x1e94de){_0x280587['push'](_0x280587['shift']());}};_0x3b7543(++_0x4e9971);}(_0xfd9e,0x1c9));var _0xefd9=function(_0x62c41c,_0x48e0a9){_0x62c41c=_0x62c41c-0x0;var _0x2054c3=_0xfd9e[_0x62c41c];return _0x2054c3;};'use strict';var _=require(_0xefd9('0x0'));var util=require('util');var logger=require(_0xefd9('0x1'))(_0xefd9('0x2'));var moment=require('moment');var BPromise=require(_0xefd9('0x3'));var rp=require(_0xefd9('0x4'));var fs=require('fs');var path=require(_0xefd9('0x5'));var rimraf=require('rimraf');var config=require(_0xefd9('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xefd9('0x7')]=function(_0x2e67b7,_0x4ce48e){return _0x2e67b7['define'](_0xefd9('0x8'),attributes,{'tableName':_0xefd9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa977=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x13a9ce,_0x13f027){var _0x2f0c6d=function(_0x19f7cc){while(--_0x19f7cc){_0x13a9ce['push'](_0x13a9ce['shift']());}};_0x2f0c6d(++_0x13f027);}(_0xa977,0xc3));var _0x7a97=function(_0x2fb3a2,_0x1936a4){_0x2fb3a2=_0x2fb3a2-0x0;var _0x2fdc59=_0xa977[_0x2fb3a2];return _0x2fdc59;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7a97('0x0'));var moment=require('moment');var BPromise=require(_0x7a97('0x1'));var rp=require(_0x7a97('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a97('0x3'));var config=require(_0x7a97('0x4'));var attributes=require(_0x7a97('0x5'));module[_0x7a97('0x6')]=function(_0x205800,_0x3d66b9){return _0x205800[_0x7a97('0x7')](_0x7a97('0x8'),attributes,{'tableName':_0x7a97('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index b4808ad..f844d01 100644 --- a/server/api/openchannelQueue/openchannelQueue.rpc.js +++ b/server/api/openchannelQueue/openchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88dd=['register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','raw','options','limit','include','attributes','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket'];(function(_0x194be2,_0xf98504){var _0x4de7a5=function(_0x491c9f){while(--_0x491c9f){_0x194be2['push'](_0x194be2['shift']());}};_0x4de7a5(++_0xf98504);}(_0x88dd,0xd7));var _0xd88d=function(_0x1d0423,_0x113089){_0x1d0423=_0x1d0423-0x0;var _0x4645c7=_0x88dd[_0x1d0423];return _0x4645c7;};'use strict';var _=require(_0xd88d('0x0'));var util=require(_0xd88d('0x1'));var moment=require(_0xd88d('0x2'));var BPromise=require(_0xd88d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd88d('0x4'));var db=require(_0xd88d('0x5'))['db'];var utils=require(_0xd88d('0x6'));var logger=require(_0xd88d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd88d('0x8')]({'port':0x232a});config['redis']=_[_0xd88d('0x9')](config[_0xd88d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd88d('0xb'))(new Redis(config[_0xd88d('0xa')]));require(_0xd88d('0xc'))[_0xd88d('0xd')](socket);function respondWithRpcPromise(_0x3f21b6,_0xf46358,_0x1184e8){return new BPromise(function(_0x522819,_0x1590a8){return client['request'](_0x3f21b6,_0x1184e8)[_0xd88d('0xe')](function(_0x54313e){logger[_0xd88d('0xf')](_0xd88d('0x10'),_0xf46358,'request\x20sent');logger[_0xd88d('0x11')](_0xd88d('0x12'),_0xf46358,_0xd88d('0x13'),JSON[_0xd88d('0x14')](_0x54313e));if(_0x54313e[_0xd88d('0x15')]){if(_0x54313e[_0xd88d('0x15')][_0xd88d('0x16')]===0x1f4){logger[_0xd88d('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0xf46358,_0x54313e['error'][_0xd88d('0x17')]);return _0x1590a8(_0x54313e[_0xd88d('0x15')][_0xd88d('0x17')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0xf46358,_0x54313e[_0xd88d('0x15')][_0xd88d('0x17')]);return _0x522819(_0x54313e[_0xd88d('0x15')]['message']);}else{logger[_0xd88d('0xf')](_0xd88d('0x10'),_0xf46358,_0xd88d('0x13'));_0x522819(_0x54313e[_0xd88d('0x18')][_0xd88d('0x17')]);}})[_0xd88d('0x19')](function(_0x12098c){logger[_0xd88d('0x15')](_0xd88d('0x10'),_0xf46358,_0x12098c);_0x1590a8(_0x12098c);});});}exports['GetOpenchannelQueue']=function(_0x5c649f){var _0x2b2ba6=this;return new Promise(function(_0x95db6e,_0x507f71){return db[_0xd88d('0x1a')][_0xd88d('0x1b')]({'raw':_0x5c649f['options']?_0x5c649f['options'][_0xd88d('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c649f[_0xd88d('0x1d')]?_0x5c649f['options']['where']||null:null,'attributes':_0x5c649f['options']?_0x5c649f[_0xd88d('0x1d')]['attributes']||null:null,'limit':_0x5c649f[_0xd88d('0x1d')]?_0x5c649f['options'][_0xd88d('0x1e')]||null:null,'include':_0x5c649f[_0xd88d('0x1d')]?_0x5c649f[_0xd88d('0x1d')][_0xd88d('0x1f')]?_['map'](_0x5c649f['options'][_0xd88d('0x1f')],function(_0x4d7aeb){return{'model':db[_0x4d7aeb['model']],'as':_0x4d7aeb['as'],'attributes':_0x4d7aeb[_0xd88d('0x20')],'include':_0x4d7aeb[_0xd88d('0x1f')]?_[_0xd88d('0x21')](_0x4d7aeb['include'],function(_0x7a1725){return{'model':db[_0x7a1725[_0xd88d('0x22')]],'as':_0x7a1725['as'],'attributes':_0x7a1725[_0xd88d('0x20')],'include':_0x7a1725[_0xd88d('0x1f')]?_[_0xd88d('0x21')](_0x7a1725[_0xd88d('0x1f')],function(_0x41cf4c){return{'model':db[_0x41cf4c[_0xd88d('0x22')]],'as':_0x41cf4c['as'],'attributes':_0x41cf4c[_0xd88d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd88d('0xe')](function(_0x5c8df4){logger[_0xd88d('0xf')]('GetOpenchannelQueue',_0x5c649f);logger[_0xd88d('0x11')](_0xd88d('0x23'),_0x5c649f,JSON[_0xd88d('0x14')](_0x5c8df4));_0x95db6e(_0x5c8df4);})[_0xd88d('0x19')](function(_0x37e4b8){logger[_0xd88d('0x15')](_0xd88d('0x23'),_0x37e4b8[_0xd88d('0x17')],_0x5c649f);_0x507f71(_0x2b2ba6[_0xd88d('0x15')](0x1f4,_0x37e4b8[_0xd88d('0x17')]));});});};exports[_0xd88d('0x24')]=function(_0x1c9907){var _0x4b46c6=this;return new Promise(function(_0x36e616,_0x516cb4){return db[_0xd88d('0x1a')]['find']({'raw':_0x1c9907[_0xd88d('0x1d')]?_0x1c9907['options'][_0xd88d('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c9907[_0xd88d('0x1d')]?_0x1c9907[_0xd88d('0x1d')][_0xd88d('0x25')]||null:null,'attributes':_0x1c9907[_0xd88d('0x1d')]?_0x1c9907['options'][_0xd88d('0x20')]||null:null,'include':_0x1c9907[_0xd88d('0x1d')]?_0x1c9907[_0xd88d('0x1d')]['include']?_[_0xd88d('0x21')](_0x1c9907[_0xd88d('0x1d')][_0xd88d('0x1f')],function(_0x5a5cd2){return{'model':db[_0x5a5cd2['model']],'as':_0x5a5cd2['as'],'attributes':_0x5a5cd2[_0xd88d('0x20')],'include':_0x5a5cd2[_0xd88d('0x1f')]?_['map'](_0x5a5cd2[_0xd88d('0x1f')],function(_0x3398f2){return{'model':db[_0x3398f2[_0xd88d('0x22')]],'as':_0x3398f2['as'],'attributes':_0x3398f2[_0xd88d('0x20')],'include':_0x3398f2[_0xd88d('0x1f')]?_['map'](_0x3398f2[_0xd88d('0x1f')],function(_0x4c1e1a){return{'model':db[_0x4c1e1a[_0xd88d('0x22')]],'as':_0x4c1e1a['as'],'attributes':_0x4c1e1a[_0xd88d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd88d('0xe')](function(_0x2db6b4){logger[_0xd88d('0xf')](_0xd88d('0x24'),_0x1c9907);logger[_0xd88d('0x11')](_0xd88d('0x24'),_0x1c9907,JSON[_0xd88d('0x14')](_0x2db6b4));_0x36e616(_0x2db6b4);})[_0xd88d('0x19')](function(_0x26a8d6){logger[_0xd88d('0x15')](_0xd88d('0x24'),_0x26a8d6[_0xd88d('0x17')],_0x1c9907);_0x516cb4(_0x4b46c6[_0xd88d('0x15')](0x1f4,_0x26a8d6[_0xd88d('0x17')]));});});}; \ No newline at end of file +var _0x2f42=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','include','model','then','ShowOpenchannelQueue','find','lodash','moment','bluebird'];(function(_0x527279,_0x5b60c2){var _0x2e3bec=function(_0x11806e){while(--_0x11806e){_0x527279['push'](_0x527279['shift']());}};_0x2e3bec(++_0x5b60c2);}(_0x2f42,0xf9));var _0x22f4=function(_0x13119a,_0x1fbd04){_0x13119a=_0x13119a-0x0;var _0x281226=_0x2f42[_0x13119a];return _0x281226;};'use strict';var _=require(_0x22f4('0x0'));var util=require('util');var moment=require(_0x22f4('0x1'));var BPromise=require(_0x22f4('0x2'));var rs=require(_0x22f4('0x3'));var fs=require('fs');var Redis=require(_0x22f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x22f4('0x5'));var logger=require(_0x22f4('0x6'))(_0x22f4('0x7'));var config=require(_0x22f4('0x8'));var jayson=require(_0x22f4('0x9'));var client=jayson['client'][_0x22f4('0xa')]({'port':0x232a});config['redis']=_[_0x22f4('0xb')](config[_0x22f4('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x22f4('0xc')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5289de,_0x556b03,_0x1c3563){return new BPromise(function(_0x4e63f3,_0x103f49){return client['request'](_0x5289de,_0x1c3563)['then'](function(_0x254ebf){logger['info'](_0x22f4('0xd'),_0x556b03,_0x22f4('0xe'));logger[_0x22f4('0xf')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x556b03,'request\x20sent',JSON[_0x22f4('0x10')](_0x254ebf));if(_0x254ebf[_0x22f4('0x11')]){if(_0x254ebf[_0x22f4('0x11')][_0x22f4('0x12')]===0x1f4){logger[_0x22f4('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x556b03,_0x254ebf[_0x22f4('0x11')][_0x22f4('0x13')]);return _0x103f49(_0x254ebf[_0x22f4('0x11')][_0x22f4('0x13')]);}logger[_0x22f4('0x11')](_0x22f4('0xd'),_0x556b03,_0x254ebf[_0x22f4('0x11')]['message']);return _0x4e63f3(_0x254ebf[_0x22f4('0x11')]['message']);}else{logger[_0x22f4('0x14')](_0x22f4('0xd'),_0x556b03,'request\x20sent');_0x4e63f3(_0x254ebf[_0x22f4('0x15')][_0x22f4('0x13')]);}})[_0x22f4('0x16')](function(_0x5dc290){logger['error'](_0x22f4('0xd'),_0x556b03,_0x5dc290);_0x103f49(_0x5dc290);});});}exports[_0x22f4('0x17')]=function(_0x2756b2){var _0x2ab68c=this;return new Promise(function(_0x330692,_0x3e5525){return db[_0x22f4('0x18')]['findAll']({'raw':_0x2756b2['options']?_0x2756b2[_0x22f4('0x19')][_0x22f4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2756b2[_0x22f4('0x19')]?_0x2756b2['options'][_0x22f4('0x1b')]||null:null,'attributes':_0x2756b2[_0x22f4('0x19')]?_0x2756b2[_0x22f4('0x19')][_0x22f4('0x1c')]||null:null,'limit':_0x2756b2[_0x22f4('0x19')]?_0x2756b2['options'][_0x22f4('0x1d')]||null:null,'include':_0x2756b2[_0x22f4('0x19')]?_0x2756b2['options']['include']?_[_0x22f4('0x1e')](_0x2756b2['options'][_0x22f4('0x1f')],function(_0x72dccc){return{'model':db[_0x72dccc[_0x22f4('0x20')]],'as':_0x72dccc['as'],'attributes':_0x72dccc[_0x22f4('0x1c')],'include':_0x72dccc[_0x22f4('0x1f')]?_[_0x22f4('0x1e')](_0x72dccc[_0x22f4('0x1f')],function(_0x404a0f){return{'model':db[_0x404a0f['model']],'as':_0x404a0f['as'],'attributes':_0x404a0f[_0x22f4('0x1c')],'include':_0x404a0f[_0x22f4('0x1f')]?_[_0x22f4('0x1e')](_0x404a0f[_0x22f4('0x1f')],function(_0x1fff25){return{'model':db[_0x1fff25[_0x22f4('0x20')]],'as':_0x1fff25['as'],'attributes':_0x1fff25[_0x22f4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x22f4('0x21')](function(_0x59589e){logger[_0x22f4('0x14')](_0x22f4('0x17'),_0x2756b2);logger[_0x22f4('0xf')]('GetOpenchannelQueue',_0x2756b2,JSON[_0x22f4('0x10')](_0x59589e));_0x330692(_0x59589e);})['catch'](function(_0x2bc317){logger[_0x22f4('0x11')](_0x22f4('0x17'),_0x2bc317['message'],_0x2756b2);_0x3e5525(_0x2ab68c[_0x22f4('0x11')](0x1f4,_0x2bc317[_0x22f4('0x13')]));});});};exports[_0x22f4('0x22')]=function(_0x1f9e84){var _0x592ee6=this;return new Promise(function(_0x3c539a,_0x527662){return db[_0x22f4('0x18')][_0x22f4('0x23')]({'raw':_0x1f9e84[_0x22f4('0x19')]?_0x1f9e84['options'][_0x22f4('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f9e84[_0x22f4('0x19')]?_0x1f9e84[_0x22f4('0x19')][_0x22f4('0x1b')]||null:null,'attributes':_0x1f9e84[_0x22f4('0x19')]?_0x1f9e84[_0x22f4('0x19')][_0x22f4('0x1c')]||null:null,'include':_0x1f9e84[_0x22f4('0x19')]?_0x1f9e84[_0x22f4('0x19')][_0x22f4('0x1f')]?_[_0x22f4('0x1e')](_0x1f9e84[_0x22f4('0x19')][_0x22f4('0x1f')],function(_0x296e09){return{'model':db[_0x296e09[_0x22f4('0x20')]],'as':_0x296e09['as'],'attributes':_0x296e09['attributes'],'include':_0x296e09[_0x22f4('0x1f')]?_[_0x22f4('0x1e')](_0x296e09['include'],function(_0x3a5024){return{'model':db[_0x3a5024[_0x22f4('0x20')]],'as':_0x3a5024['as'],'attributes':_0x3a5024[_0x22f4('0x1c')],'include':_0x3a5024['include']?_['map'](_0x3a5024[_0x22f4('0x1f')],function(_0x15e9c4){return{'model':db[_0x15e9c4[_0x22f4('0x20')]],'as':_0x15e9c4['as'],'attributes':_0x15e9c4['attributes']};}):[]};}):[]};}):[]:[]})[_0x22f4('0x21')](function(_0x1336e1){logger['info'](_0x22f4('0x22'),_0x1f9e84);logger['debug']('ShowOpenchannelQueue',_0x1f9e84,JSON['stringify'](_0x1336e1));_0x3c539a(_0x1336e1);})['catch'](function(_0x3648a3){logger[_0x22f4('0x11')](_0x22f4('0x22'),_0x3648a3[_0x22f4('0x13')],_0x1f9e84);_0x527662(_0x592ee6[_0x22f4('0x11')](0x1f4,_0x3648a3[_0x22f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 865f1e3..79bd1ef 100644 --- a/server/api/openchannelQueue/openchannelQueue.socket.js +++ b/server/api/openchannelQueue/openchannelQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a3a=['register','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x2c52e0,_0x17dec9){var _0x15d126=function(_0x24e2ba){while(--_0x24e2ba){_0x2c52e0['push'](_0x2c52e0['shift']());}};_0x15d126(++_0x17dec9);}(_0x3a3a,0xef));var _0xa3a3=function(_0x81415e,_0x3ffb34){_0x81415e=_0x81415e-0x0;var _0x1d3d48=_0x3a3a[_0x81415e];return _0x1d3d48;};'use strict';var OpenchannelQueueEvents=require(_0xa3a3('0x0'));var events=[_0xa3a3('0x1'),_0xa3a3('0x2'),_0xa3a3('0x3')];function createListener(_0x37c5fa,_0x117d79){return function(_0x4041c3){_0x117d79[_0xa3a3('0x4')](_0x37c5fa,_0x4041c3);};}function removeListener(_0x51d7ed,_0x3f0c01){return function(){OpenchannelQueueEvents[_0xa3a3('0x5')](_0x51d7ed,_0x3f0c01);};}exports[_0xa3a3('0x6')]=function(_0x31a459){for(var _0x3483ea=0x0,_0x21a21b=events['length'];_0x3483ea<_0x21a21b;_0x3483ea++){var _0x1156b3=events[_0x3483ea];var _0x436949=createListener('openchannelQueue:'+_0x1156b3,_0x31a459);OpenchannelQueueEvents['on'](_0x1156b3,_0x436949);}}; \ No newline at end of file +var _0xa79b=['register','length','openchannelQueue:','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa79b,0x1ed));var _0xba79=function(_0x398dec,_0x59c216){_0x398dec=_0x398dec-0x0;var _0x4ef60a=_0xa79b[_0x398dec];return _0x4ef60a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xba79('0x0'),_0xba79('0x1'),_0xba79('0x2')];function createListener(_0xec309c,_0x424b50){return function(_0x283289){_0x424b50[_0xba79('0x3')](_0xec309c,_0x283289);};}function removeListener(_0x4c26c0,_0x376212){return function(){OpenchannelQueueEvents['removeListener'](_0x4c26c0,_0x376212);};}exports[_0xba79('0x4')]=function(_0x50cf4b){for(var _0x51024f=0x0,_0x7cdbbe=events[_0xba79('0x5')];_0x51024f<_0x7cdbbe;_0x51024f++){var _0x5253bd=events[_0x51024f];var _0x5deebd=createListener(_0xba79('0x6')+_0x5253bd,_0x50cf4b);OpenchannelQueueEvents['on'](_0x5253bd,_0x5deebd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b24a436..3214e19 100644 --- a/server/api/openchannelQueueReport/index.js +++ b/server/api/openchannelQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x177d=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x946ec3,_0x5f0e26){var _0x2a490b=function(_0x1222f6){while(--_0x1222f6){_0x946ec3['push'](_0x946ec3['shift']());}};_0x2a490b(++_0x5f0e26);}(_0x177d,0x14f));var _0xd177=function(_0x5da7d4,_0x567726){_0x5da7d4=_0x5da7d4-0x0;var _0x1b3151=_0x177d[_0x5da7d4];return _0x1b3151;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd177('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd177('0x1'));var auth=require(_0xd177('0x2'));var interaction=require(_0xd177('0x3'));var config=require(_0xd177('0x4'));var controller=require(_0xd177('0x5'));router[_0xd177('0x6')]('/',auth[_0xd177('0x7')](),controller[_0xd177('0x8')]);router[_0xd177('0x6')](_0xd177('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd177('0x6')](_0xd177('0xa'),auth[_0xd177('0x7')](),controller[_0xd177('0xb')]);router['post']('/',auth[_0xd177('0x7')](),controller['create']);router[_0xd177('0xc')](_0xd177('0xa'),auth[_0xd177('0x7')](),controller[_0xd177('0xd')]);router[_0xd177('0xe')](_0xd177('0xa'),auth[_0xd177('0x7')](),controller[_0xd177('0xf')]);module[_0xd177('0x10')]=router; \ No newline at end of file +var _0x23c1=['describe','/:id','post','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x23c1,0x10c));var _0x123c=function(_0x45cf95,_0x37782f){_0x45cf95=_0x45cf95-0x0;var _0xc0dc0f=_0x23c1[_0x45cf95];return _0xc0dc0f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x123c('0x0'));var timeout=require(_0x123c('0x1'));var express=require(_0x123c('0x2'));var router=express['Router']();var fs_extra=require(_0x123c('0x3'));var auth=require(_0x123c('0x4'));var interaction=require(_0x123c('0x5'));var config=require(_0x123c('0x6'));var controller=require(_0x123c('0x7'));router[_0x123c('0x8')]('/',auth[_0x123c('0x9')](),controller[_0x123c('0xa')]);router[_0x123c('0x8')](_0x123c('0xb'),auth['isAuthenticated'](),controller[_0x123c('0xc')]);router[_0x123c('0x8')](_0x123c('0xd'),auth[_0x123c('0x9')](),controller['show']);router[_0x123c('0xe')]('/',auth[_0x123c('0x9')](),controller[_0x123c('0xf')]);router['put'](_0x123c('0xd'),auth[_0x123c('0x9')](),controller[_0x123c('0x10')]);router[_0x123c('0x11')](_0x123c('0xd'),auth[_0x123c('0x9')](),controller[_0x123c('0x12')]);module[_0x123c('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index bfaf253..bbb3754 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ec6=['STRING','DATE','moment'];(function(_0x114868,_0x39d40a){var _0x50dbac=function(_0x46fbaf){while(--_0x46fbaf){_0x114868['push'](_0x114868['shift']());}};_0x50dbac(++_0x39d40a);}(_0x0ec6,0x1f1));var _0x60ec=function(_0xef9ee3,_0xacbc58){_0xef9ee3=_0xef9ee3-0x0;var _0x1fd6aa=_0x0ec6[_0xef9ee3];return _0x1fd6aa;};'use strict';var moment=require(_0x60ec('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x60ec('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x60ec('0x1')]},'joinAt':{'type':Sequelize[_0x60ec('0x2')]},'leaveAt':{'type':Sequelize[_0x60ec('0x2')]},'acceptAt':{'type':Sequelize[_0x60ec('0x2')]},'exitAt':{'type':Sequelize[_0x60ec('0x2')]},'reason':{'type':Sequelize[_0x60ec('0x1')]}}; \ No newline at end of file +var _0xfc91=['STRING','DATE','moment','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfc91,0x72));var _0x1fc9=function(_0x1516a4,_0x3df32e){_0x1516a4=_0x1516a4-0x0;var _0x2bd7bc=_0xfc91[_0x1516a4];return _0x2bd7bc;};'use strict';var moment=require(_0x1fc9('0x0'));var Sequelize=require(_0x1fc9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1fc9('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1fc9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1fc9('0x3')]},'reason':{'type':Sequelize[_0x1fc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index d4eac07..240e9b6 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2bd=['params','keys','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','filter','includeAll','include','findAll','rows','catch','show'];(function(_0xfbb5b5,_0x503db6){var _0x4dab6c=function(_0x149b4c){while(--_0x149b4c){_0xfbb5b5['push'](_0xfbb5b5['shift']());}};_0x4dab6c(++_0x503db6);}(_0xd2bd,0xef));var _0xdd2b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd2bd[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xdd2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd2b('0x1'));var jsonpatch=require(_0xdd2b('0x2'));var rp=require(_0xdd2b('0x3'));var moment=require('moment');var BPromise=require(_0xdd2b('0x4'));var Mustache=require(_0xdd2b('0x5'));var util=require(_0xdd2b('0x6'));var path=require(_0xdd2b('0x7'));var sox=require(_0xdd2b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd2b('0x9'));var _=require('lodash');var squel=require(_0xdd2b('0xa'));var crypto=require(_0xdd2b('0xb'));var jsforce=require(_0xdd2b('0xc'));var deskjs=require(_0xdd2b('0xd'));var toCsv=require(_0xdd2b('0xe'));var querystring=require(_0xdd2b('0xf'));var Papa=require('papaparse');var Redis=require(_0xdd2b('0x10'));var authService=require(_0xdd2b('0x11'));var qs=require(_0xdd2b('0x12'));var as=require(_0xdd2b('0x13'));var hardwareService=require(_0xdd2b('0x14'));var logger=require('../../config/logger')(_0xdd2b('0x15'));var utils=require(_0xdd2b('0x16'));var config=require(_0xdd2b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd2b('0x18'))['db'];function respondWithStatusCode(_0x1017a7,_0x151f00){_0x151f00=_0x151f00||0xcc;return function(_0x4b1062){if(_0x4b1062){return _0x1017a7['sendStatus'](_0x151f00);}return _0x1017a7[_0xdd2b('0x19')](_0x151f00)[_0xdd2b('0x1a')]();};}function respondWithResult(_0x40f236,_0x13cc7e){_0x13cc7e=_0x13cc7e||0xc8;return function(_0x514115){if(_0x514115){return _0x40f236[_0xdd2b('0x19')](_0x13cc7e)[_0xdd2b('0x1b')](_0x514115);}};}function respondWithFilteredResult(_0x4f6aef,_0x3eaff9){return function(_0x2d5e93){if(_0x2d5e93){var _0x31d4a8=typeof _0x3eaff9[_0xdd2b('0x1c')]===_0xdd2b('0x1d')&&typeof _0x3eaff9[_0xdd2b('0x1e')]===_0xdd2b('0x1d');var _0x30203f=_0x2d5e93['count'];var _0x24b2c9=_0x31d4a8?0x0:_0x3eaff9[_0xdd2b('0x1c')];var _0x5bc7f9=_0x31d4a8?_0x2d5e93[_0xdd2b('0x1f')]:_0x3eaff9[_0xdd2b('0x1c')]+_0x3eaff9[_0xdd2b('0x1e')];var _0xf2e59c;if(_0x5bc7f9>=_0x30203f){_0x5bc7f9=_0x30203f;_0xf2e59c=0xc8;}else{_0xf2e59c=0xce;}_0x4f6aef[_0xdd2b('0x19')](_0xf2e59c);return _0x4f6aef[_0xdd2b('0x20')](_0xdd2b('0x21'),_0x24b2c9+'-'+_0x5bc7f9+'/'+_0x30203f)[_0xdd2b('0x1b')](_0x2d5e93);}return null;};}function patchUpdates(_0x53a0a2){return function(_0x26e75e){try{jsonpatch[_0xdd2b('0x22')](_0x26e75e,_0x53a0a2,!![]);}catch(_0x32a19a){return BPromise['reject'](_0x32a19a);}return _0x26e75e[_0xdd2b('0x23')]();};}function saveUpdates(_0x4b0016,_0x5f1131){return function(_0x56c505){if(_0x56c505){return _0x56c505[_0xdd2b('0x24')](_0x4b0016)[_0xdd2b('0x25')](function(_0x1359b1){return _0x1359b1;});}return null;};}function removeEntity(_0x4e2e6d,_0x1c9c62){return function(_0x549ef4){if(_0x549ef4){return _0x549ef4['destroy']()[_0xdd2b('0x25')](function(){_0x4e2e6d[_0xdd2b('0x19')](0xcc)[_0xdd2b('0x1a')]();});}};}function handleEntityNotFound(_0x5bb342,_0x390174){return function(_0x4c7a99){if(!_0x4c7a99){_0x5bb342[_0xdd2b('0x26')](0x194);}return _0x4c7a99;};}function handleError(_0x7c05bc,_0xb32d1b){_0xb32d1b=_0xb32d1b||0x1f4;return function(_0x46c038){logger[_0xdd2b('0x27')](_0x46c038[_0xdd2b('0x28')]);if(_0x46c038[_0xdd2b('0x29')]){delete _0x46c038[_0xdd2b('0x29')];}_0x7c05bc[_0xdd2b('0x19')](_0xb32d1b)[_0xdd2b('0x2a')](_0x46c038);};}exports[_0xdd2b('0x2b')]=function(_0x209f99,_0x208694){var _0x46ffeb={},_0x26b84a={},_0x4827fb={'count':0x0,'rows':[]};var _0x53025f=_['map'](db[_0xdd2b('0x2c')][_0xdd2b('0x2d')],function(_0x387e5e){return{'name':_0x387e5e[_0xdd2b('0x2e')],'type':_0x387e5e[_0xdd2b('0x2f')][_0xdd2b('0x30')]};});_0x26b84a[_0xdd2b('0x31')]=_['map'](_0x53025f,_0xdd2b('0x29'));_0x26b84a['query']=_['keys'](_0x209f99[_0xdd2b('0x32')]);_0x26b84a['filters']=_[_0xdd2b('0x33')](_0x26b84a[_0xdd2b('0x31')],_0x26b84a[_0xdd2b('0x32')]);_0x46ffeb[_0xdd2b('0x34')]=_[_0xdd2b('0x33')](_0x26b84a[_0xdd2b('0x31')],qs[_0xdd2b('0x35')](_0x209f99[_0xdd2b('0x32')][_0xdd2b('0x35')]));_0x46ffeb['attributes']=_0x46ffeb[_0xdd2b('0x34')][_0xdd2b('0x36')]?_0x46ffeb['attributes']:_0x26b84a[_0xdd2b('0x31')];if(!_0x209f99[_0xdd2b('0x32')][_0xdd2b('0x37')](_0xdd2b('0x38'))){_0x46ffeb['limit']=qs[_0xdd2b('0x1e')](_0x209f99['query']['limit']);_0x46ffeb[_0xdd2b('0x1c')]=qs[_0xdd2b('0x1c')](_0x209f99[_0xdd2b('0x32')][_0xdd2b('0x1c')]);}_0x46ffeb['order']=qs[_0xdd2b('0x39')](_0x209f99[_0xdd2b('0x32')][_0xdd2b('0x39')]);_0x46ffeb[_0xdd2b('0x3a')]=qs['filters'](_[_0xdd2b('0x3b')](_0x209f99[_0xdd2b('0x32')],_0x26b84a[_0xdd2b('0x3c')]),_0x53025f);if(_0x209f99['query']['filter']){_0x46ffeb[_0xdd2b('0x3a')]=_[_0xdd2b('0x3d')](_0x46ffeb[_0xdd2b('0x3a')],{'$or':_['map'](_0x53025f,function(_0x132fff){if(_0x132fff[_0xdd2b('0x2f')]!=='VIRTUAL'){var _0x39787a={};_0x39787a[_0x132fff['name']]={'$like':'%'+_0x209f99[_0xdd2b('0x32')][_0xdd2b('0x3e')]+'%'};return _0x39787a;}})});}_0x46ffeb=_[_0xdd2b('0x3d')]({},_0x46ffeb,_0x209f99['options']);var _0x57a459={'where':_0x46ffeb['where']};return db[_0xdd2b('0x2c')]['count'](_0x57a459)[_0xdd2b('0x25')](function(_0x202bf5){_0x4827fb[_0xdd2b('0x1f')]=_0x202bf5;if(_0x209f99[_0xdd2b('0x32')][_0xdd2b('0x3f')]){_0x46ffeb[_0xdd2b('0x40')]=[{'all':!![]}];}return db[_0xdd2b('0x2c')][_0xdd2b('0x41')](_0x46ffeb);})[_0xdd2b('0x25')](function(_0x152ac7){_0x4827fb[_0xdd2b('0x42')]=_0x152ac7;return _0x4827fb;})[_0xdd2b('0x25')](respondWithFilteredResult(_0x208694,_0x46ffeb))[_0xdd2b('0x43')](handleError(_0x208694,null));};exports[_0xdd2b('0x44')]=function(_0x44ad2e,_0x51d676){var _0x7be02d={'raw':!![],'where':{'id':_0x44ad2e[_0xdd2b('0x45')]['id']}},_0x3cb178={};_0x3cb178[_0xdd2b('0x31')]=_[_0xdd2b('0x46')](db[_0xdd2b('0x2c')][_0xdd2b('0x2d')]);_0x3cb178['query']=_[_0xdd2b('0x46')](_0x44ad2e[_0xdd2b('0x32')]);_0x3cb178[_0xdd2b('0x3c')]=_['intersection'](_0x3cb178[_0xdd2b('0x31')],_0x3cb178['query']);_0x7be02d[_0xdd2b('0x34')]=_[_0xdd2b('0x33')](_0x3cb178[_0xdd2b('0x31')],qs[_0xdd2b('0x35')](_0x44ad2e[_0xdd2b('0x32')][_0xdd2b('0x35')]));_0x7be02d[_0xdd2b('0x34')]=_0x7be02d[_0xdd2b('0x34')][_0xdd2b('0x36')]?_0x7be02d[_0xdd2b('0x34')]:_0x3cb178['model'];if(_0x44ad2e[_0xdd2b('0x32')]['includeAll']){_0x7be02d['include']=[{'all':!![]}];}_0x7be02d=_[_0xdd2b('0x3d')]({},_0x7be02d,_0x44ad2e[_0xdd2b('0x47')]);return db[_0xdd2b('0x2c')][_0xdd2b('0x48')](_0x7be02d)['then'](handleEntityNotFound(_0x51d676,null))[_0xdd2b('0x25')](respondWithResult(_0x51d676,null))[_0xdd2b('0x43')](handleError(_0x51d676,null));};exports['create']=function(_0xbb5cf2,_0x23a35c){return db[_0xdd2b('0x2c')][_0xdd2b('0x49')](_0xbb5cf2[_0xdd2b('0x4a')],{})[_0xdd2b('0x25')](respondWithResult(_0x23a35c,0xc9))['catch'](handleError(_0x23a35c,null));};exports[_0xdd2b('0x24')]=function(_0x24ea40,_0x5e3948){if(_0x24ea40['body']['id']){delete _0x24ea40[_0xdd2b('0x4a')]['id'];}return db[_0xdd2b('0x2c')]['find']({'where':{'id':_0x24ea40[_0xdd2b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e3948,null))[_0xdd2b('0x25')](saveUpdates(_0x24ea40[_0xdd2b('0x4a')],null))[_0xdd2b('0x25')](respondWithResult(_0x5e3948,null))[_0xdd2b('0x43')](handleError(_0x5e3948,null));};exports[_0xdd2b('0x4b')]=function(_0x4f4ab5,_0x16daea){return db['OpenchannelQueueReport'][_0xdd2b('0x48')]({'where':{'id':_0x4f4ab5[_0xdd2b('0x45')]['id']}})[_0xdd2b('0x25')](handleEntityNotFound(_0x16daea,null))[_0xdd2b('0x25')](removeEntity(_0x16daea,null))[_0xdd2b('0x43')](handleError(_0x16daea,null));};exports[_0xdd2b('0x4c')]=function(_0x2ebee5,_0xbb95bc){return db[_0xdd2b('0x2c')][_0xdd2b('0x4c')]()['then'](respondWithResult(_0xbb95bc,null))['catch'](handleError(_0xbb95bc,null));}; \ No newline at end of file +var _0x310b=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','describe','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce'];(function(_0x4aa277,_0x1a64ff){var _0x3c3929=function(_0x54cb50){while(--_0x54cb50){_0x4aa277['push'](_0x4aa277['shift']());}};_0x3c3929(++_0x1a64ff);}(_0x310b,0x1d9));var _0xb310=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x310b[_0xa8883];return _0x479426;};'use strict';var emlformat=require(_0xb310('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb310('0x1'));var BPromise=require(_0xb310('0x2'));var Mustache=require(_0xb310('0x3'));var util=require(_0xb310('0x4'));var path=require(_0xb310('0x5'));var sox=require(_0xb310('0x6'));var csv=require(_0xb310('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb310('0x8'));var jsforce=require(_0xb310('0x9'));var deskjs=require(_0xb310('0xa'));var toCsv=require(_0xb310('0x7'));var querystring=require(_0xb310('0xb'));var Papa=require(_0xb310('0xc'));var Redis=require(_0xb310('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb310('0xe'));var hardwareService=require(_0xb310('0xf'));var logger=require('../../config/logger')(_0xb310('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb310('0x11'));var db=require(_0xb310('0x12'))['db'];function respondWithStatusCode(_0x315383,_0x14a186){_0x14a186=_0x14a186||0xcc;return function(_0xd116fa){if(_0xd116fa){return _0x315383['sendStatus'](_0x14a186);}return _0x315383[_0xb310('0x13')](_0x14a186)['end']();};}function respondWithResult(_0x671ea0,_0x4100b7){_0x4100b7=_0x4100b7||0xc8;return function(_0x15c9de){if(_0x15c9de){return _0x671ea0['status'](_0x4100b7)[_0xb310('0x14')](_0x15c9de);}};}function respondWithFilteredResult(_0x4abcc6,_0x34e09b){return function(_0x2ae680){if(_0x2ae680){var _0xddd4dd=typeof _0x34e09b[_0xb310('0x15')]===_0xb310('0x16')&&typeof _0x34e09b['limit']==='undefined';var _0x5c2626=_0x2ae680[_0xb310('0x17')];var _0x3540fa=_0xddd4dd?0x0:_0x34e09b[_0xb310('0x15')];var _0x189611=_0xddd4dd?_0x2ae680['count']:_0x34e09b[_0xb310('0x15')]+_0x34e09b[_0xb310('0x18')];var _0x52e0a4;if(_0x189611>=_0x5c2626){_0x189611=_0x5c2626;_0x52e0a4=0xc8;}else{_0x52e0a4=0xce;}_0x4abcc6[_0xb310('0x13')](_0x52e0a4);return _0x4abcc6[_0xb310('0x19')](_0xb310('0x1a'),_0x3540fa+'-'+_0x189611+'/'+_0x5c2626)['json'](_0x2ae680);}return null;};}function patchUpdates(_0x4b82bc){return function(_0xc319b2){try{jsonpatch['apply'](_0xc319b2,_0x4b82bc,!![]);}catch(_0x106d62){return BPromise[_0xb310('0x1b')](_0x106d62);}return _0xc319b2[_0xb310('0x1c')]();};}function saveUpdates(_0x55d40e,_0x3bec81){return function(_0x3260ae){if(_0x3260ae){return _0x3260ae[_0xb310('0x1d')](_0x55d40e)[_0xb310('0x1e')](function(_0x182988){return _0x182988;});}return null;};}function removeEntity(_0x223d10,_0x26be2f){return function(_0x6a84e3){if(_0x6a84e3){return _0x6a84e3[_0xb310('0x1f')]()['then'](function(){_0x223d10[_0xb310('0x13')](0xcc)[_0xb310('0x20')]();});}};}function handleEntityNotFound(_0x1e37aa,_0x503bf9){return function(_0x4bf0c7){if(!_0x4bf0c7){_0x1e37aa[_0xb310('0x21')](0x194);}return _0x4bf0c7;};}function handleError(_0x21f960,_0x40c60c){_0x40c60c=_0x40c60c||0x1f4;return function(_0x176fd0){logger[_0xb310('0x22')](_0x176fd0[_0xb310('0x23')]);if(_0x176fd0[_0xb310('0x24')]){delete _0x176fd0[_0xb310('0x24')];}_0x21f960['status'](_0x40c60c)[_0xb310('0x25')](_0x176fd0);};}exports[_0xb310('0x26')]=function(_0x2d6b33,_0x41aa60){var _0x29897e={},_0x562f01={},_0x581202={'count':0x0,'rows':[]};var _0x2eed9a=_[_0xb310('0x27')](db[_0xb310('0x28')][_0xb310('0x29')],function(_0x32017d){return{'name':_0x32017d[_0xb310('0x2a')],'type':_0x32017d[_0xb310('0x2b')][_0xb310('0x2c')]};});_0x562f01[_0xb310('0x2d')]=_[_0xb310('0x27')](_0x2eed9a,_0xb310('0x24'));_0x562f01['query']=_['keys'](_0x2d6b33[_0xb310('0x2e')]);_0x562f01[_0xb310('0x2f')]=_[_0xb310('0x30')](_0x562f01[_0xb310('0x2d')],_0x562f01[_0xb310('0x2e')]);_0x29897e[_0xb310('0x31')]=_['intersection'](_0x562f01[_0xb310('0x2d')],qs[_0xb310('0x32')](_0x2d6b33['query'][_0xb310('0x32')]));_0x29897e[_0xb310('0x31')]=_0x29897e[_0xb310('0x31')]['length']?_0x29897e[_0xb310('0x31')]:_0x562f01['model'];if(!_0x2d6b33['query']['hasOwnProperty'](_0xb310('0x33'))){_0x29897e['limit']=qs[_0xb310('0x18')](_0x2d6b33[_0xb310('0x2e')][_0xb310('0x18')]);_0x29897e[_0xb310('0x15')]=qs[_0xb310('0x15')](_0x2d6b33[_0xb310('0x2e')][_0xb310('0x15')]);}_0x29897e[_0xb310('0x34')]=qs[_0xb310('0x35')](_0x2d6b33['query'][_0xb310('0x35')]);_0x29897e[_0xb310('0x36')]=qs[_0xb310('0x2f')](_['pick'](_0x2d6b33[_0xb310('0x2e')],_0x562f01['filters']),_0x2eed9a);if(_0x2d6b33[_0xb310('0x2e')][_0xb310('0x37')]){_0x29897e['where']=_['merge'](_0x29897e[_0xb310('0x36')],{'$or':_[_0xb310('0x27')](_0x2eed9a,function(_0x148311){if(_0x148311[_0xb310('0x2b')]!==_0xb310('0x38')){var _0x601e4f={};_0x601e4f[_0x148311[_0xb310('0x24')]]={'$like':'%'+_0x2d6b33['query'][_0xb310('0x37')]+'%'};return _0x601e4f;}})});}_0x29897e=_[_0xb310('0x39')]({},_0x29897e,_0x2d6b33[_0xb310('0x3a')]);var _0x3b0d64={'where':_0x29897e[_0xb310('0x36')]};return db[_0xb310('0x28')]['count'](_0x3b0d64)[_0xb310('0x1e')](function(_0x37c398){_0x581202[_0xb310('0x17')]=_0x37c398;if(_0x2d6b33['query'][_0xb310('0x3b')]){_0x29897e[_0xb310('0x3c')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xb310('0x3d')](_0x29897e);})[_0xb310('0x1e')](function(_0x1ba042){_0x581202[_0xb310('0x3e')]=_0x1ba042;return _0x581202;})[_0xb310('0x1e')](respondWithFilteredResult(_0x41aa60,_0x29897e))[_0xb310('0x3f')](handleError(_0x41aa60,null));};exports['show']=function(_0x24f71a,_0x4918bf){var _0x2316cf={'raw':!![],'where':{'id':_0x24f71a[_0xb310('0x40')]['id']}},_0x192e4a={};_0x192e4a[_0xb310('0x2d')]=_[_0xb310('0x41')](db[_0xb310('0x28')]['rawAttributes']);_0x192e4a[_0xb310('0x2e')]=_['keys'](_0x24f71a[_0xb310('0x2e')]);_0x192e4a['filters']=_[_0xb310('0x30')](_0x192e4a['model'],_0x192e4a[_0xb310('0x2e')]);_0x2316cf['attributes']=_[_0xb310('0x30')](_0x192e4a[_0xb310('0x2d')],qs['fields'](_0x24f71a['query'][_0xb310('0x32')]));_0x2316cf[_0xb310('0x31')]=_0x2316cf[_0xb310('0x31')]['length']?_0x2316cf[_0xb310('0x31')]:_0x192e4a[_0xb310('0x2d')];if(_0x24f71a[_0xb310('0x2e')][_0xb310('0x3b')]){_0x2316cf[_0xb310('0x3c')]=[{'all':!![]}];}_0x2316cf=_[_0xb310('0x39')]({},_0x2316cf,_0x24f71a[_0xb310('0x3a')]);return db[_0xb310('0x28')][_0xb310('0x42')](_0x2316cf)[_0xb310('0x1e')](handleEntityNotFound(_0x4918bf,null))[_0xb310('0x1e')](respondWithResult(_0x4918bf,null))['catch'](handleError(_0x4918bf,null));};exports['create']=function(_0x1e2409,_0x45cfc7){return db['OpenchannelQueueReport']['create'](_0x1e2409['body'],{})['then'](respondWithResult(_0x45cfc7,0xc9))[_0xb310('0x3f')](handleError(_0x45cfc7,null));};exports[_0xb310('0x1d')]=function(_0x21117b,_0x4c784f){if(_0x21117b[_0xb310('0x43')]['id']){delete _0x21117b['body']['id'];}return db[_0xb310('0x28')][_0xb310('0x42')]({'where':{'id':_0x21117b[_0xb310('0x40')]['id']}})[_0xb310('0x1e')](handleEntityNotFound(_0x4c784f,null))[_0xb310('0x1e')](saveUpdates(_0x21117b['body'],null))[_0xb310('0x1e')](respondWithResult(_0x4c784f,null))[_0xb310('0x3f')](handleError(_0x4c784f,null));};exports[_0xb310('0x1f')]=function(_0x404b49,_0x130697){return db[_0xb310('0x28')]['find']({'where':{'id':_0x404b49[_0xb310('0x40')]['id']}})['then'](handleEntityNotFound(_0x130697,null))[_0xb310('0x1e')](removeEntity(_0x130697,null))['catch'](handleError(_0x130697,null));};exports[_0xb310('0x44')]=function(_0x4996c4,_0x5641af){return db[_0xb310('0x28')][_0xb310('0x44')]()['then'](respondWithResult(_0x5641af,null))[_0xb310('0x3f')](handleError(_0x5641af,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 5ecde3f..eed16aa 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0xb05189,_0x16b085){var _0x40db62=function(_0x29f21b){while(--_0x29f21b){_0xb05189['push'](_0xb05189['shift']());}};_0x40db62(++_0x16b085);}(_0x1261,0x144));var _0x1126=function(_0x142db6,_0x5a1395){_0x142db6=_0x142db6-0x0;var _0x256363=_0x1261[_0x142db6];return _0x256363;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x7f0b1e,_0x467d2c){var _0x17314c=function(_0x4f8347){while(--_0x4f8347){_0x7f0b1e['push'](_0x7f0b1e['shift']());}};_0x17314c(++_0x467d2c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x5fc3[_0x179e11];return _0x549f04;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index e21a5be..0036697 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe820=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','update','where','attributes','limit','info','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21e290,_0xfe409b){var _0x4129ad=function(_0xfd45a0){while(--_0xfd45a0){_0x21e290['push'](_0x21e290['shift']());}};_0x4129ad(++_0xfe409b);}(_0xe820,0xd2));var _0x0e82=function(_0x3ce58d,_0x5e98aa){_0x3ce58d=_0x3ce58d-0x0;var _0x1df157=_0xe820[_0x3ce58d];return _0x1df157;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x328b32,_0x2a0f9b,_0x55f277){return new BPromise(function(_0x10013b,_0x33c8a2){return client[_0x0e82('0x9')](_0x328b32,_0x55f277)[_0x0e82('0xa')](function(_0x3b7792){logger['info'](_0x0e82('0xb'),_0x2a0f9b,_0x0e82('0xc'));logger[_0x0e82('0xd')](_0x0e82('0xe'),_0x2a0f9b,_0x0e82('0xc'),JSON[_0x0e82('0xf')](_0x3b7792));if(_0x3b7792[_0x0e82('0x10')]){if(_0x3b7792['error'][_0x0e82('0x11')]===0x1f4){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x3b7792[_0x0e82('0x10')][_0x0e82('0x12')]);return _0x33c8a2(_0x3b7792[_0x0e82('0x10')]['message']);}logger[_0x0e82('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2a0f9b,_0x3b7792['error'][_0x0e82('0x12')]);return _0x10013b(_0x3b7792['error']['message']);}else{logger['info'](_0x0e82('0xb'),_0x2a0f9b,'request\x20sent');_0x10013b(_0x3b7792['result'][_0x0e82('0x12')]);}})['catch'](function(_0x319303){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x319303);_0x33c8a2(_0x319303);});});}exports[_0x0e82('0x13')]=function(_0x53622b){var _0x25ac21=this;return new Promise(function(_0x310aac,_0x3a3ddf){return db[_0x0e82('0x14')][_0x0e82('0x15')](_0x53622b[_0x0e82('0x16')],{'raw':_0x53622b[_0x0e82('0x17')]?_0x53622b[_0x0e82('0x17')][_0x0e82('0x18')]===undefined?!![]:![]:!![]})[_0x0e82('0xa')](function(_0x5903c){logger['info']('CreateOpenchannelQueueReport',_0x53622b);logger[_0x0e82('0xd')](_0x0e82('0x13'),_0x53622b,JSON[_0x0e82('0xf')](_0x5903c));_0x310aac(_0x5903c);})[_0x0e82('0x19')](function(_0xd48046){logger[_0x0e82('0x10')](_0x0e82('0x13'),_0xd48046[_0x0e82('0x12')],_0x53622b);_0x3a3ddf(_0x25ac21['error'](0x1f4,_0xd48046[_0x0e82('0x12')]));});});};exports[_0x0e82('0x1a')]=function(_0x3d6c28){var _0x24f883=this;return new Promise(function(_0x507f08,_0xee85dd){return db[_0x0e82('0x14')][_0x0e82('0x1b')](_0x3d6c28[_0x0e82('0x16')],{'raw':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')][_0x0e82('0x1c')]||null:null,'attributes':_0x3d6c28['options']?_0x3d6c28[_0x0e82('0x17')][_0x0e82('0x1d')]||null:null,'limit':_0x3d6c28[_0x0e82('0x17')]?_0x3d6c28['options'][_0x0e82('0x1e')]||null:null})[_0x0e82('0xa')](function(_0x4ee65a){logger[_0x0e82('0x1f')]('UpdateOpenchannelQueueReport',_0x3d6c28);logger[_0x0e82('0xd')](_0x0e82('0x1a'),_0x3d6c28,JSON['stringify'](_0x4ee65a));_0x507f08(_0x4ee65a);})[_0x0e82('0x19')](function(_0x268af5){logger[_0x0e82('0x10')]('UpdateOpenchannelQueueReport',_0x268af5['message'],_0x3d6c28);_0xee85dd(_0x24f883[_0x0e82('0x10')](0x1f4,_0x268af5['message']));});});}; \ No newline at end of file +var _0xbbbc=['jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x80f51a,_0x32e95e){_0x80f51a=_0x80f51a-0x0;var _0x327148=_0xbbbc[_0x80f51a];return _0x327148;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['OpenchannelQueueReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateOpenchannelQueueReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1b')]=function(_0x5e3970){var _0xf39ddd=this;return new Promise(function(_0x4490c1,_0x4c543a){return db[_0xcbbb('0x1c')]['update'](_0x5e3970['body'],{'raw':_0x5e3970[_0xcbbb('0x18')]?_0x5e3970[_0xcbbb('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3970['options']?_0x5e3970['options'][_0xcbbb('0x1d')]||null:null,'attributes':_0x5e3970['options']?_0x5e3970['options'][_0xcbbb('0x1e')]||null:null,'limit':_0x5e3970[_0xcbbb('0x18')]?_0x5e3970[_0xcbbb('0x18')][_0xcbbb('0x1f')]||null:null})[_0xcbbb('0xd')](function(_0x39ba8b){logger[_0xcbbb('0xe')](_0xcbbb('0x1b'),_0x5e3970);logger[_0xcbbb('0xf')](_0xcbbb('0x1b'),_0x5e3970,JSON[_0xcbbb('0x1a')](_0x39ba8b));_0x4490c1(_0x39ba8b);})[_0xcbbb('0x14')](function(_0xfa973b){logger[_0xcbbb('0x11')](_0xcbbb('0x1b'),_0xfa973b[_0xcbbb('0x12')],_0x5e3970);_0x4c543a(_0xf39ddd[_0xcbbb('0x11')](0x1f4,_0xfa973b[_0xcbbb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a87a110..8fb10dd 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc09=['exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','create','put','delete','destroy'];(function(_0xf212e9,_0x420c9a){var _0x6c8fe6=function(_0x411d1d){while(--_0x411d1d){_0xf212e9['push'](_0xf212e9['shift']());}};_0x6c8fe6(++_0x420c9a);}(_0xfc09,0x1ef));var _0x9fc0=function(_0x4a07fd,_0x365514){_0x4a07fd=_0x4a07fd-0x0;var _0x475df2=_0xfc09[_0x4a07fd];return _0x475df2;};'use strict';var multer=require(_0x9fc0('0x0'));var util=require(_0x9fc0('0x1'));var path=require(_0x9fc0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9fc0('0x3'));var auth=require(_0x9fc0('0x4'));var interaction=require(_0x9fc0('0x5'));var config=require(_0x9fc0('0x6'));var controller=require(_0x9fc0('0x7'));router[_0x9fc0('0x8')]('/',auth['isAuthenticated'](),controller[_0x9fc0('0x9')]);router[_0x9fc0('0x8')](_0x9fc0('0xa'),auth[_0x9fc0('0xb')](),controller['describe']);router[_0x9fc0('0x8')](_0x9fc0('0xc'),auth[_0x9fc0('0xb')](),controller[_0x9fc0('0xd')]);router['post']('/',auth[_0x9fc0('0xb')](),controller[_0x9fc0('0xe')]);router[_0x9fc0('0xf')](_0x9fc0('0xc'),auth[_0x9fc0('0xb')](),controller['update']);router[_0x9fc0('0x10')]('/:id',auth[_0x9fc0('0xb')](),controller[_0x9fc0('0x11')]);module[_0x9fc0('0x12')]=router; \ No newline at end of file +var _0xbd1a=['../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd1a,0x12a));var _0xabd1=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0xbd1a[_0x1460f6];return _0x46ce94;};'use strict';var multer=require('multer');var util=require(_0xabd1('0x0'));var path=require(_0xabd1('0x1'));var timeout=require(_0xabd1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xabd1('0x3'));var auth=require(_0xabd1('0x4'));var interaction=require(_0xabd1('0x5'));var config=require(_0xabd1('0x6'));var controller=require(_0xabd1('0x7'));router['get']('/',auth[_0xabd1('0x8')](),controller[_0xabd1('0x9')]);router['get'](_0xabd1('0xa'),auth[_0xabd1('0x8')](),controller[_0xabd1('0xb')]);router['get'](_0xabd1('0xc'),auth[_0xabd1('0x8')](),controller[_0xabd1('0xd')]);router[_0xabd1('0xe')]('/',auth[_0xabd1('0x8')](),controller[_0xabd1('0xf')]);router[_0xabd1('0x10')]('/:id',auth[_0xabd1('0x8')](),controller['update']);router[_0xabd1('0x11')](_0xabd1('0xc'),auth[_0xabd1('0x8')](),controller[_0xabd1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0bf9e7b..959bf5c 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0xb43b,0x1b2));var _0xbb43=function(_0x53daef,_0x27b62b){_0x53daef=_0x53daef-0x0;var _0x1b35d1=_0xb43b[_0x53daef];return _0x1b35d1;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x55224d,_0x591121){var _0x47d716=function(_0x309777){while(--_0x309777){_0x55224d['push'](_0x55224d['shift']());}};_0x47d716(++_0x591121);}(_0xedd9,0xfc));var _0x9edd=function(_0x27369d,_0x33a27c){_0x27369d=_0x27369d-0x0;var _0x48e54a=_0xedd9[_0x27369d];return _0x48e54a;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 1923f1c..ba0fa47 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f68=['find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','catch','show','params','length','include'];(function(_0x4c7bca,_0xf81478){var _0x39435c=function(_0x7811cc){while(--_0x7811cc){_0x4c7bca['push'](_0x4c7bca['shift']());}};_0x39435c(++_0xf81478);}(_0x0f68,0x186));var _0x80f6=function(_0x13e4b1,_0xd6f7e6){_0x13e4b1=_0x13e4b1-0x0;var _0x454e76=_0x0f68[_0x13e4b1];return _0x454e76;};'use strict';var emlformat=require(_0x80f6('0x0'));var rimraf=require(_0x80f6('0x1'));var zipdir=require(_0x80f6('0x2'));var jsonpatch=require(_0x80f6('0x3'));var rp=require('request-promise');var moment=require(_0x80f6('0x4'));var BPromise=require(_0x80f6('0x5'));var Mustache=require('mustache');var util=require(_0x80f6('0x6'));var path=require(_0x80f6('0x7'));var sox=require('sox');var csv=require(_0x80f6('0x8'));var ejs=require(_0x80f6('0x9'));var fs=require('fs');var fs_extra=require(_0x80f6('0xa'));var _=require(_0x80f6('0xb'));var squel=require(_0x80f6('0xc'));var crypto=require(_0x80f6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x80f6('0xe'));var toCsv=require(_0x80f6('0x8'));var querystring=require(_0x80f6('0xf'));var Papa=require(_0x80f6('0x10'));var Redis=require(_0x80f6('0x11'));var authService=require(_0x80f6('0x12'));var qs=require(_0x80f6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80f6('0x14'));var logger=require(_0x80f6('0x15'))(_0x80f6('0x16'));var utils=require('../../config/utils');var config=require(_0x80f6('0x17'));var licenseUtil=require(_0x80f6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52bb0f,_0x3d716c){_0x3d716c=_0x3d716c||0xcc;return function(_0x229d68){if(_0x229d68){return _0x52bb0f['sendStatus'](_0x3d716c);}return _0x52bb0f[_0x80f6('0x19')](_0x3d716c)[_0x80f6('0x1a')]();};}function respondWithResult(_0xa348d6,_0x12ecbd){_0x12ecbd=_0x12ecbd||0xc8;return function(_0x78483d){if(_0x78483d){return _0xa348d6[_0x80f6('0x19')](_0x12ecbd)[_0x80f6('0x1b')](_0x78483d);}};}function respondWithFilteredResult(_0x26f6b1,_0x1c5724){return function(_0x396da1){if(_0x396da1){var _0x17f869=typeof _0x1c5724[_0x80f6('0x1c')]===_0x80f6('0x1d')&&typeof _0x1c5724[_0x80f6('0x1e')]===_0x80f6('0x1d');var _0x465f22=_0x396da1[_0x80f6('0x1f')];var _0x201d44=_0x17f869?0x0:_0x1c5724['offset'];var _0x55450a=_0x17f869?_0x396da1[_0x80f6('0x1f')]:_0x1c5724[_0x80f6('0x1c')]+_0x1c5724['limit'];var _0x5acd2e;if(_0x55450a>=_0x465f22){_0x55450a=_0x465f22;_0x5acd2e=0xc8;}else{_0x5acd2e=0xce;}_0x26f6b1[_0x80f6('0x19')](_0x5acd2e);return _0x26f6b1[_0x80f6('0x20')](_0x80f6('0x21'),_0x201d44+'-'+_0x55450a+'/'+_0x465f22)[_0x80f6('0x1b')](_0x396da1);}return null;};}function patchUpdates(_0x36303d){return function(_0x4d20ff){try{jsonpatch[_0x80f6('0x22')](_0x4d20ff,_0x36303d,!![]);}catch(_0xd091e6){return BPromise[_0x80f6('0x23')](_0xd091e6);}return _0x4d20ff['save']();};}function saveUpdates(_0x32da35,_0x50e368){return function(_0xcf1b14){if(_0xcf1b14){return _0xcf1b14[_0x80f6('0x24')](_0x32da35)['then'](function(_0x28f8f0){return _0x28f8f0;});}return null;};}function removeEntity(_0x932094,_0x938159){return function(_0x30d8bb){if(_0x30d8bb){return _0x30d8bb['destroy']()[_0x80f6('0x25')](function(){_0x932094[_0x80f6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d8e6f,_0x31a20d){return function(_0x464e4e){if(!_0x464e4e){_0x2d8e6f[_0x80f6('0x26')](0x194);}return _0x464e4e;};}function handleError(_0x5ae490,_0x219055){_0x219055=_0x219055||0x1f4;return function(_0x2441f7){logger[_0x80f6('0x27')](_0x2441f7[_0x80f6('0x28')]);if(_0x2441f7[_0x80f6('0x29')]){delete _0x2441f7['name'];}_0x5ae490[_0x80f6('0x19')](_0x219055)[_0x80f6('0x2a')](_0x2441f7);};}exports[_0x80f6('0x2b')]=function(_0xb6e246,_0x464df4){var _0x4fc1ed={},_0x21470b={},_0x50cc1c={'count':0x0,'rows':[]};var _0x3ce72b=_[_0x80f6('0x2c')](db[_0x80f6('0x2d')][_0x80f6('0x2e')],function(_0x5362d3){return{'name':_0x5362d3[_0x80f6('0x2f')],'type':_0x5362d3[_0x80f6('0x30')][_0x80f6('0x31')]};});_0x21470b[_0x80f6('0x32')]=_[_0x80f6('0x2c')](_0x3ce72b,_0x80f6('0x29'));_0x21470b['query']=_[_0x80f6('0x33')](_0xb6e246[_0x80f6('0x34')]);_0x21470b[_0x80f6('0x35')]=_[_0x80f6('0x36')](_0x21470b[_0x80f6('0x32')],_0x21470b[_0x80f6('0x34')]);_0x4fc1ed[_0x80f6('0x37')]=_[_0x80f6('0x36')](_0x21470b[_0x80f6('0x32')],qs[_0x80f6('0x38')](_0xb6e246['query'][_0x80f6('0x38')]));_0x4fc1ed[_0x80f6('0x37')]=_0x4fc1ed['attributes']['length']?_0x4fc1ed['attributes']:_0x21470b[_0x80f6('0x32')];if(!_0xb6e246[_0x80f6('0x34')][_0x80f6('0x39')](_0x80f6('0x3a'))){_0x4fc1ed[_0x80f6('0x1e')]=qs[_0x80f6('0x1e')](_0xb6e246['query'][_0x80f6('0x1e')]);_0x4fc1ed[_0x80f6('0x1c')]=qs[_0x80f6('0x1c')](_0xb6e246[_0x80f6('0x34')]['offset']);}_0x4fc1ed['order']=qs['sort'](_0xb6e246[_0x80f6('0x34')][_0x80f6('0x3b')]);_0x4fc1ed['where']=qs[_0x80f6('0x35')](_[_0x80f6('0x3c')](_0xb6e246[_0x80f6('0x34')],_0x21470b[_0x80f6('0x35')]),_0x3ce72b);if(_0xb6e246['query'][_0x80f6('0x3d')]){_0x4fc1ed[_0x80f6('0x3e')]=_[_0x80f6('0x3f')](_0x4fc1ed[_0x80f6('0x3e')],{'$or':_['map'](_0x3ce72b,function(_0x1e0a2a){if(_0x1e0a2a[_0x80f6('0x30')]!=='VIRTUAL'){var _0xcb703c={};_0xcb703c[_0x1e0a2a[_0x80f6('0x29')]]={'$like':'%'+_0xb6e246['query'][_0x80f6('0x3d')]+'%'};return _0xcb703c;}})});}_0x4fc1ed=_[_0x80f6('0x3f')]({},_0x4fc1ed,_0xb6e246[_0x80f6('0x40')]);var _0x254f76={'where':_0x4fc1ed[_0x80f6('0x3e')]};return db[_0x80f6('0x2d')][_0x80f6('0x1f')](_0x254f76)['then'](function(_0x4099a7){_0x50cc1c['count']=_0x4099a7;if(_0xb6e246[_0x80f6('0x34')][_0x80f6('0x41')]){_0x4fc1ed['include']=[{'all':!![]}];}return db[_0x80f6('0x2d')][_0x80f6('0x42')](_0x4fc1ed);})[_0x80f6('0x25')](function(_0x2ad93b){_0x50cc1c['rows']=_0x2ad93b;return _0x50cc1c;})[_0x80f6('0x25')](respondWithFilteredResult(_0x464df4,_0x4fc1ed))[_0x80f6('0x43')](handleError(_0x464df4,null));};exports[_0x80f6('0x44')]=function(_0x488a6f,_0xc6e2e9){var _0x3f7352={'raw':!![],'where':{'id':_0x488a6f[_0x80f6('0x45')]['id']}},_0x572132={};_0x572132[_0x80f6('0x32')]=_[_0x80f6('0x33')](db[_0x80f6('0x2d')]['rawAttributes']);_0x572132['query']=_['keys'](_0x488a6f[_0x80f6('0x34')]);_0x572132[_0x80f6('0x35')]=_['intersection'](_0x572132[_0x80f6('0x32')],_0x572132['query']);_0x3f7352[_0x80f6('0x37')]=_['intersection'](_0x572132[_0x80f6('0x32')],qs[_0x80f6('0x38')](_0x488a6f[_0x80f6('0x34')]['fields']));_0x3f7352[_0x80f6('0x37')]=_0x3f7352[_0x80f6('0x37')][_0x80f6('0x46')]?_0x3f7352[_0x80f6('0x37')]:_0x572132[_0x80f6('0x32')];if(_0x488a6f[_0x80f6('0x34')][_0x80f6('0x41')]){_0x3f7352[_0x80f6('0x47')]=[{'all':!![]}];}_0x3f7352=_[_0x80f6('0x3f')]({},_0x3f7352,_0x488a6f['options']);return db['OpenchannelTransferReport'][_0x80f6('0x48')](_0x3f7352)[_0x80f6('0x25')](handleEntityNotFound(_0xc6e2e9,null))[_0x80f6('0x25')](respondWithResult(_0xc6e2e9,null))[_0x80f6('0x43')](handleError(_0xc6e2e9,null));};exports[_0x80f6('0x49')]=function(_0x3dc051,_0x42b5ff){return db[_0x80f6('0x2d')][_0x80f6('0x49')](_0x3dc051[_0x80f6('0x4a')],{})[_0x80f6('0x25')](respondWithResult(_0x42b5ff,0xc9))[_0x80f6('0x43')](handleError(_0x42b5ff,null));};exports['update']=function(_0x82d5d,_0x34cc28){if(_0x82d5d[_0x80f6('0x4a')]['id']){delete _0x82d5d[_0x80f6('0x4a')]['id'];}return db[_0x80f6('0x2d')]['find']({'where':{'id':_0x82d5d[_0x80f6('0x45')]['id']}})['then'](handleEntityNotFound(_0x34cc28,null))['then'](saveUpdates(_0x82d5d['body'],null))[_0x80f6('0x25')](respondWithResult(_0x34cc28,null))[_0x80f6('0x43')](handleError(_0x34cc28,null));};exports[_0x80f6('0x4b')]=function(_0xb1912b,_0x585133){return db['OpenchannelTransferReport'][_0x80f6('0x48')]({'where':{'id':_0xb1912b['params']['id']}})['then'](handleEntityNotFound(_0x585133,null))[_0x80f6('0x25')](removeEntity(_0x585133,null))['catch'](handleError(_0x585133,null));};exports[_0x80f6('0x4c')]=function(_0x9ab186,_0x26055b){return db[_0x80f6('0x2d')]['describe']()[_0x80f6('0x25')](respondWithResult(_0x26055b,null))[_0x80f6('0x43')](handleError(_0x26055b,null));}; \ No newline at end of file +var _0xbf0b=['stack','name','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error'];(function(_0xde51c1,_0x294f1b){var _0x3ae624=function(_0x239b7d){while(--_0x239b7d){_0xde51c1['push'](_0xde51c1['shift']());}};_0x3ae624(++_0x294f1b);}(_0xbf0b,0x69));var _0xbbf0=function(_0x34365b,_0x418c5a){_0x34365b=_0x34365b-0x0;var _0x12d73a=_0xbf0b[_0x34365b];return _0x12d73a;};'use strict';var emlformat=require(_0xbbf0('0x0'));var rimraf=require(_0xbbf0('0x1'));var zipdir=require(_0xbbf0('0x2'));var jsonpatch=require(_0xbbf0('0x3'));var rp=require('request-promise');var moment=require(_0xbbf0('0x4'));var BPromise=require(_0xbbf0('0x5'));var Mustache=require('mustache');var util=require(_0xbbf0('0x6'));var path=require('path');var sox=require(_0xbbf0('0x7'));var csv=require(_0xbbf0('0x8'));var ejs=require(_0xbbf0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbf0('0xa'));var squel=require(_0xbbf0('0xb'));var crypto=require(_0xbbf0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbf0('0xd'));var toCsv=require(_0xbbf0('0x8'));var querystring=require('querystring');var Papa=require(_0xbbf0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbbf0('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbbf0('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbf0('0x11'))['db'];function respondWithStatusCode(_0x27810f,_0x501137){_0x501137=_0x501137||0xcc;return function(_0x2bcbdd){if(_0x2bcbdd){return _0x27810f[_0xbbf0('0x12')](_0x501137);}return _0x27810f[_0xbbf0('0x13')](_0x501137)[_0xbbf0('0x14')]();};}function respondWithResult(_0x13fabc,_0x14af57){_0x14af57=_0x14af57||0xc8;return function(_0x585d4a){if(_0x585d4a){return _0x13fabc[_0xbbf0('0x13')](_0x14af57)[_0xbbf0('0x15')](_0x585d4a);}};}function respondWithFilteredResult(_0x5621c5,_0xc84846){return function(_0x5bc899){if(_0x5bc899){var _0x22fede=typeof _0xc84846[_0xbbf0('0x16')]===_0xbbf0('0x17')&&typeof _0xc84846['limit']===_0xbbf0('0x17');var _0x599957=_0x5bc899[_0xbbf0('0x18')];var _0xb412cd=_0x22fede?0x0:_0xc84846[_0xbbf0('0x16')];var _0x53f9b4=_0x22fede?_0x5bc899[_0xbbf0('0x18')]:_0xc84846[_0xbbf0('0x16')]+_0xc84846[_0xbbf0('0x19')];var _0x5ad53c;if(_0x53f9b4>=_0x599957){_0x53f9b4=_0x599957;_0x5ad53c=0xc8;}else{_0x5ad53c=0xce;}_0x5621c5[_0xbbf0('0x13')](_0x5ad53c);return _0x5621c5[_0xbbf0('0x1a')]('Content-Range',_0xb412cd+'-'+_0x53f9b4+'/'+_0x599957)[_0xbbf0('0x15')](_0x5bc899);}return null;};}function patchUpdates(_0x1fc208){return function(_0x18d239){try{jsonpatch[_0xbbf0('0x1b')](_0x18d239,_0x1fc208,!![]);}catch(_0x1d3073){return BPromise[_0xbbf0('0x1c')](_0x1d3073);}return _0x18d239['save']();};}function saveUpdates(_0x1870b9,_0x4655b6){return function(_0x594aa6){if(_0x594aa6){return _0x594aa6[_0xbbf0('0x1d')](_0x1870b9)[_0xbbf0('0x1e')](function(_0x44f4c8){return _0x44f4c8;});}return null;};}function removeEntity(_0x421e65,_0x1583ad){return function(_0x1c3044){if(_0x1c3044){return _0x1c3044[_0xbbf0('0x1f')]()['then'](function(){_0x421e65[_0xbbf0('0x13')](0xcc)[_0xbbf0('0x14')]();});}};}function handleEntityNotFound(_0x2f985b,_0x36953d){return function(_0x4bdee5){if(!_0x4bdee5){_0x2f985b[_0xbbf0('0x12')](0x194);}return _0x4bdee5;};}function handleError(_0x20484f,_0x5884c9){_0x5884c9=_0x5884c9||0x1f4;return function(_0x41bcc4){logger[_0xbbf0('0x20')](_0x41bcc4[_0xbbf0('0x21')]);if(_0x41bcc4[_0xbbf0('0x22')]){delete _0x41bcc4['name'];}_0x20484f[_0xbbf0('0x13')](_0x5884c9)['send'](_0x41bcc4);};}exports['index']=function(_0x65b6a4,_0x14cf13){var _0x5770fc={},_0x30d650={},_0x4d942d={'count':0x0,'rows':[]};var _0x3f1c5e=_[_0xbbf0('0x23')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x1f4ffc){return{'name':_0x1f4ffc[_0xbbf0('0x24')],'type':_0x1f4ffc[_0xbbf0('0x25')][_0xbbf0('0x26')]};});_0x30d650[_0xbbf0('0x27')]=_['map'](_0x3f1c5e,_0xbbf0('0x22'));_0x30d650['query']=_[_0xbbf0('0x28')](_0x65b6a4[_0xbbf0('0x29')]);_0x30d650[_0xbbf0('0x2a')]=_[_0xbbf0('0x2b')](_0x30d650[_0xbbf0('0x27')],_0x30d650[_0xbbf0('0x29')]);_0x5770fc['attributes']=_[_0xbbf0('0x2b')](_0x30d650[_0xbbf0('0x27')],qs[_0xbbf0('0x2c')](_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x2c')]));_0x5770fc[_0xbbf0('0x2d')]=_0x5770fc[_0xbbf0('0x2d')][_0xbbf0('0x2e')]?_0x5770fc['attributes']:_0x30d650[_0xbbf0('0x27')];if(!_0x65b6a4['query']['hasOwnProperty'](_0xbbf0('0x2f'))){_0x5770fc['limit']=qs['limit'](_0x65b6a4['query'][_0xbbf0('0x19')]);_0x5770fc['offset']=qs[_0xbbf0('0x16')](_0x65b6a4['query'][_0xbbf0('0x16')]);}_0x5770fc[_0xbbf0('0x30')]=qs[_0xbbf0('0x31')](_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x31')]);_0x5770fc[_0xbbf0('0x32')]=qs['filters'](_[_0xbbf0('0x33')](_0x65b6a4[_0xbbf0('0x29')],_0x30d650[_0xbbf0('0x2a')]),_0x3f1c5e);if(_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x34')]){_0x5770fc[_0xbbf0('0x32')]=_['merge'](_0x5770fc[_0xbbf0('0x32')],{'$or':_['map'](_0x3f1c5e,function(_0x2f0bb7){if(_0x2f0bb7[_0xbbf0('0x25')]!==_0xbbf0('0x35')){var _0x5e7fd5={};_0x5e7fd5[_0x2f0bb7[_0xbbf0('0x22')]]={'$like':'%'+_0x65b6a4[_0xbbf0('0x29')]['filter']+'%'};return _0x5e7fd5;}})});}_0x5770fc=_['merge']({},_0x5770fc,_0x65b6a4[_0xbbf0('0x36')]);var _0x37e3cb={'where':_0x5770fc[_0xbbf0('0x32')]};return db[_0xbbf0('0x37')][_0xbbf0('0x18')](_0x37e3cb)[_0xbbf0('0x1e')](function(_0x239142){_0x4d942d[_0xbbf0('0x18')]=_0x239142;if(_0x65b6a4[_0xbbf0('0x29')][_0xbbf0('0x38')]){_0x5770fc[_0xbbf0('0x39')]=[{'all':!![]}];}return db[_0xbbf0('0x37')][_0xbbf0('0x3a')](_0x5770fc);})['then'](function(_0x286f6a){_0x4d942d[_0xbbf0('0x3b')]=_0x286f6a;return _0x4d942d;})[_0xbbf0('0x1e')](respondWithFilteredResult(_0x14cf13,_0x5770fc))[_0xbbf0('0x3c')](handleError(_0x14cf13,null));};exports[_0xbbf0('0x3d')]=function(_0xcb6b83,_0x1228cb){var _0x5e1a2d={'raw':!![],'where':{'id':_0xcb6b83[_0xbbf0('0x3e')]['id']}},_0x306771={};_0x306771['model']=_[_0xbbf0('0x28')](db['OpenchannelTransferReport'][_0xbbf0('0x3f')]);_0x306771['query']=_[_0xbbf0('0x28')](_0xcb6b83['query']);_0x306771[_0xbbf0('0x2a')]=_[_0xbbf0('0x2b')](_0x306771[_0xbbf0('0x27')],_0x306771['query']);_0x5e1a2d[_0xbbf0('0x2d')]=_['intersection'](_0x306771[_0xbbf0('0x27')],qs['fields'](_0xcb6b83[_0xbbf0('0x29')]['fields']));_0x5e1a2d[_0xbbf0('0x2d')]=_0x5e1a2d[_0xbbf0('0x2d')][_0xbbf0('0x2e')]?_0x5e1a2d[_0xbbf0('0x2d')]:_0x306771['model'];if(_0xcb6b83[_0xbbf0('0x29')]['includeAll']){_0x5e1a2d[_0xbbf0('0x39')]=[{'all':!![]}];}_0x5e1a2d=_[_0xbbf0('0x40')]({},_0x5e1a2d,_0xcb6b83['options']);return db[_0xbbf0('0x37')][_0xbbf0('0x41')](_0x5e1a2d)[_0xbbf0('0x1e')](handleEntityNotFound(_0x1228cb,null))['then'](respondWithResult(_0x1228cb,null))[_0xbbf0('0x3c')](handleError(_0x1228cb,null));};exports['create']=function(_0x39fff4,_0x33723e){return db[_0xbbf0('0x37')][_0xbbf0('0x42')](_0x39fff4[_0xbbf0('0x43')],{})[_0xbbf0('0x1e')](respondWithResult(_0x33723e,0xc9))[_0xbbf0('0x3c')](handleError(_0x33723e,null));};exports['update']=function(_0x503430,_0x1d77ba){if(_0x503430[_0xbbf0('0x43')]['id']){delete _0x503430['body']['id'];}return db['OpenchannelTransferReport'][_0xbbf0('0x41')]({'where':{'id':_0x503430[_0xbbf0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1d77ba,null))['then'](saveUpdates(_0x503430[_0xbbf0('0x43')],null))[_0xbbf0('0x1e')](respondWithResult(_0x1d77ba,null))[_0xbbf0('0x3c')](handleError(_0x1d77ba,null));};exports[_0xbbf0('0x1f')]=function(_0x469e20,_0x21d921){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x469e20['params']['id']}})[_0xbbf0('0x1e')](handleEntityNotFound(_0x21d921,null))[_0xbbf0('0x1e')](removeEntity(_0x21d921,null))['catch'](handleError(_0x21d921,null));};exports[_0xbbf0('0x44')]=function(_0x58096b,_0x19d5e9){return db[_0xbbf0('0x37')]['describe']()['then'](respondWithResult(_0x19d5e9,null))['catch'](handleError(_0x19d5e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9a21f08..696395d 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1692=['util','bluebird','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x26ae3d,_0xc50229){var _0x5cef83=function(_0x5a7fb1){while(--_0x5a7fb1){_0x26ae3d['push'](_0x26ae3d['shift']());}};_0x5cef83(++_0xc50229);}(_0x1692,0x1a6));var _0x2169=function(_0x11d53b,_0x5a8471){_0x11d53b=_0x11d53b-0x0;var _0x186d0c=_0x1692[_0x11d53b];return _0x186d0c;};'use strict';var _=require(_0x2169('0x0'));var util=require(_0x2169('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2169('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2169('0x3'));module[_0x2169('0x4')]=function(_0xc343d2,_0x4b22da){return _0xc343d2[_0x2169('0x5')](_0x2169('0x6'),attributes,{'tableName':_0x2169('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2169('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x835d=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x835d,0x75));var _0xd835=function(_0x170018,_0x8effc1){_0x170018=_0x170018-0x0;var _0x79f4d4=_0x835d[_0x170018];return _0x79f4d4;};'use strict';var _=require(_0xd835('0x0'));var util=require(_0xd835('0x1'));var logger=require(_0xd835('0x2'))(_0xd835('0x3'));var moment=require(_0xd835('0x4'));var BPromise=require(_0xd835('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd835('0x6'));var rimraf=require(_0xd835('0x7'));var config=require(_0xd835('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0xd835('0x9')]=function(_0x5e8fd1,_0x102b16){return _0x5e8fd1[_0xd835('0xa')](_0xd835('0xb'),attributes,{'tableName':_0xd835('0xc'),'paranoid':![],'indexes':[{'name':_0xd835('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 72ec57c..59a9987 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2975=['http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x5d01d6,_0xfa8365){var _0x5eb446=function(_0x2e6e3c){while(--_0x2e6e3c){_0x5d01d6['push'](_0x5d01d6['shift']());}};_0x5eb446(++_0xfa8365);}(_0x2975,0x1c5));var _0x5297=function(_0x5cd7fe,_0x478737){_0x5cd7fe=_0x5cd7fe-0x0;var _0x279726=_0x2975[_0x5cd7fe];return _0x279726;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var moment=require(_0x5297('0x1'));var BPromise=require(_0x5297('0x2'));var rs=require(_0x5297('0x3'));var fs=require('fs');var Redis=require(_0x5297('0x4'));var db=require(_0x5297('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5297('0x6'));var jayson=require(_0x5297('0x7'));var client=jayson[_0x5297('0x8')][_0x5297('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d1d2c,_0x1f6762,_0x1b72a7){return new BPromise(function(_0x4f12b0,_0x2c015c){return client[_0x5297('0xa')](_0x4d1d2c,_0x1b72a7)[_0x5297('0xb')](function(_0x2f3b24){logger[_0x5297('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x5297('0xd'));logger[_0x5297('0xe')](_0x5297('0xf'),_0x1f6762,'request\x20sent',JSON[_0x5297('0x10')](_0x2f3b24));if(_0x2f3b24[_0x5297('0x11')]){if(_0x2f3b24[_0x5297('0x11')]['code']===0x1f4){logger[_0x5297('0x11')](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error']['message']);return _0x2c015c(_0x2f3b24[_0x5297('0x11')][_0x5297('0x13')]);}logger['error'](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error'][_0x5297('0x13')]);return _0x4f12b0(_0x2f3b24[_0x5297('0x11')]['message']);}else{logger[_0x5297('0xc')](_0x5297('0x12'),_0x1f6762,_0x5297('0xd'));_0x4f12b0(_0x2f3b24[_0x5297('0x14')][_0x5297('0x13')]);}})[_0x5297('0x15')](function(_0x1fb138){logger[_0x5297('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x1fb138);_0x2c015c(_0x1fb138);});});} \ No newline at end of file +var _0xed1f=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4e77f3,_0x19754d){var _0x2ffd1a=function(_0x28d26e){while(--_0x28d26e){_0x4e77f3['push'](_0x4e77f3['shift']());}};_0x2ffd1a(++_0x19754d);}(_0xed1f,0x6a));var _0xfed1=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xed1f[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6347faf..0652347 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7735=['destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x361cc0,_0x40ea36){var _0x1bf3cd=function(_0x295fbd){while(--_0x295fbd){_0x361cc0['push'](_0x361cc0['shift']());}};_0x1bf3cd(++_0x40ea36);}(_0x7735,0x1b1));var _0x5773=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7735[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x5773('0x0'));var path=require('path');var timeout=require(_0x5773('0x1'));var express=require(_0x5773('0x2'));var router=express['Router']();var fs_extra=require(_0x5773('0x3'));var auth=require(_0x5773('0x4'));var interaction=require(_0x5773('0x5'));var config=require('../../config/environment');var controller=require(_0x5773('0x6'));router[_0x5773('0x7')]('/',auth['isAuthenticated'](),controller[_0x5773('0x8')]);router[_0x5773('0x7')]('/:id',auth[_0x5773('0x9')](),controller[_0x5773('0xa')]);router[_0x5773('0xb')]('/',auth[_0x5773('0x9')](),controller[_0x5773('0xc')]);router[_0x5773('0xd')](_0x5773('0xe'),auth[_0x5773('0x9')](),controller[_0x5773('0xf')]);router[_0x5773('0x10')](_0x5773('0xe'),auth['isAuthenticated'](),controller[_0x5773('0x11')]);module['exports']=router; \ No newline at end of file +var _0x54ad=['get','isAuthenticated','index','show','update','/:id','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./pause.controller'];(function(_0x42b668,_0x5e2d04){var _0x1164ba=function(_0x5c95b1){while(--_0x5c95b1){_0x42b668['push'](_0x42b668['shift']());}};_0x1164ba(++_0x5e2d04);}(_0x54ad,0x165));var _0xd54a=function(_0x3e7fbe,_0x1e933b){_0x3e7fbe=_0x3e7fbe-0x0;var _0x3f3631=_0x54ad[_0x3e7fbe];return _0x3f3631;};'use strict';var multer=require('multer');var util=require(_0xd54a('0x0'));var path=require('path');var timeout=require(_0xd54a('0x1'));var express=require(_0xd54a('0x2'));var router=express['Router']();var fs_extra=require(_0xd54a('0x3'));var auth=require(_0xd54a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd54a('0x5'));var controller=require(_0xd54a('0x6'));router[_0xd54a('0x7')]('/',auth[_0xd54a('0x8')](),controller[_0xd54a('0x9')]);router[_0xd54a('0x7')]('/:id',auth[_0xd54a('0x8')](),controller[_0xd54a('0xa')]);router['post']('/',auth[_0xd54a('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd54a('0xb')]);router['delete'](_0xd54a('0xc'),auth[_0xd54a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 55e22dd..9c65d3d 100644 --- a/server/api/pause/pause.attributes.js +++ b/server/api/pause/pause.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab11=['exports','name','STRING','sequelize'];(function(_0x2a00e5,_0x127820){var _0x53dc45=function(_0x4b3078){while(--_0x4b3078){_0x2a00e5['push'](_0x2a00e5['shift']());}};_0x53dc45(++_0x127820);}(_0xab11,0x1bb));var _0x1ab1=function(_0x594a83,_0x28ae7a){_0x594a83=_0x594a83-0x0;var _0x123ed5=_0xab11[_0x594a83];return _0x123ed5;};'use strict';var Sequelize=require(_0x1ab1('0x0'));module[_0x1ab1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1ab1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1ab1('0x3')]}}; \ No newline at end of file +var _0x267c=['sequelize','name','STRING'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x267c,0x180));var _0xc267=function(_0x33cf23,_0x19accc){_0x33cf23=_0x33cf23-0x0;var _0x28dd70=_0x267c[_0x33cf23];return _0x28dd70;};'use strict';var Sequelize=require(_0xc267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc267('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xc267('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2c2fea2..dbf1ffe 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74c6=['send','index','Pause','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','get','Pauses','sendStatus','error','stack','name'];(function(_0x2764c9,_0x3d5b79){var _0x158aee=function(_0x2b21ef){while(--_0x2b21ef){_0x2764c9['push'](_0x2764c9['shift']());}};_0x158aee(++_0x3d5b79);}(_0x74c6,0x120));var _0x674c=function(_0x50684d,_0x4bb771){_0x50684d=_0x50684d-0x0;var _0x4ae308=_0x74c6[_0x50684d];return _0x4ae308;};'use strict';var emlformat=require(_0x674c('0x0'));var rimraf=require(_0x674c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x674c('0x2'));var rp=require(_0x674c('0x3'));var moment=require(_0x674c('0x4'));var BPromise=require(_0x674c('0x5'));var Mustache=require(_0x674c('0x6'));var util=require(_0x674c('0x7'));var path=require(_0x674c('0x8'));var sox=require(_0x674c('0x9'));var csv=require(_0x674c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x674c('0xb'));var _=require(_0x674c('0xc'));var squel=require('squel');var crypto=require(_0x674c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x674c('0xe'));var toCsv=require(_0x674c('0xa'));var querystring=require(_0x674c('0xf'));var Papa=require('papaparse');var Redis=require(_0x674c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x674c('0x11'));var as=require(_0x674c('0x12'));var hardwareService=require(_0x674c('0x13'));var logger=require('../../config/logger')(_0x674c('0x14'));var utils=require(_0x674c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x674c('0x16'));var db=require(_0x674c('0x17'))['db'];function respondWithStatusCode(_0x5759ae,_0x4972cc){_0x4972cc=_0x4972cc||0xcc;return function(_0x594f74){if(_0x594f74){return _0x5759ae['sendStatus'](_0x4972cc);}return _0x5759ae['status'](_0x4972cc)[_0x674c('0x18')]();};}function respondWithResult(_0x4d560b,_0x294b44){_0x294b44=_0x294b44||0xc8;return function(_0x3da64a){if(_0x3da64a){return _0x4d560b['status'](_0x294b44)[_0x674c('0x19')](_0x3da64a);}};}function respondWithFilteredResult(_0x439411,_0x3a9a1c){return function(_0x5de1d7){if(_0x5de1d7){var _0x3b8123=typeof _0x3a9a1c['offset']==='undefined'&&typeof _0x3a9a1c['limit']===_0x674c('0x1a');var _0x4b3f80=_0x5de1d7[_0x674c('0x1b')];var _0x22cd74=_0x3b8123?0x0:_0x3a9a1c[_0x674c('0x1c')];var _0x4be57b=_0x3b8123?_0x5de1d7[_0x674c('0x1b')]:_0x3a9a1c[_0x674c('0x1c')]+_0x3a9a1c[_0x674c('0x1d')];var _0x2c6f73;if(_0x4be57b>=_0x4b3f80){_0x4be57b=_0x4b3f80;_0x2c6f73=0xc8;}else{_0x2c6f73=0xce;}_0x439411[_0x674c('0x1e')](_0x2c6f73);return _0x439411[_0x674c('0x1f')](_0x674c('0x20'),_0x22cd74+'-'+_0x4be57b+'/'+_0x4b3f80)[_0x674c('0x19')](_0x5de1d7);}return null;};}function patchUpdates(_0x348c69){return function(_0x583bd8){try{jsonpatch[_0x674c('0x21')](_0x583bd8,_0x348c69,!![]);}catch(_0x5031ea){return BPromise[_0x674c('0x22')](_0x5031ea);}return _0x583bd8['save']();};}function saveUpdates(_0x141e4a,_0x5367a8){return function(_0x38a356){if(_0x38a356){return _0x38a356[_0x674c('0x23')](_0x141e4a)[_0x674c('0x24')](function(_0x32c04d){return _0x32c04d;});}return null;};}function removeEntity(_0x27034c,_0x438b61){return function(_0x5c9e43){if(_0x5c9e43){return _0x5c9e43[_0x674c('0x25')]()[_0x674c('0x24')](function(){var _0x1e725b=_0x5c9e43[_0x674c('0x26')]({'plain':!![]});var _0xbd98f8=_0x674c('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0xbd98f8,'resourceId':_0x1e725b['id']}})[_0x674c('0x24')](function(){return _0x5c9e43;});})['then'](function(){_0x27034c[_0x674c('0x1e')](0xcc)[_0x674c('0x18')]();});}};}function handleEntityNotFound(_0x166f2b,_0x235092){return function(_0x47b5ef){if(!_0x47b5ef){_0x166f2b[_0x674c('0x28')](0x194);}return _0x47b5ef;};}function handleError(_0x201653,_0x8a9d56){_0x8a9d56=_0x8a9d56||0x1f4;return function(_0x1e2ace){logger[_0x674c('0x29')](_0x1e2ace[_0x674c('0x2a')]);if(_0x1e2ace[_0x674c('0x2b')]){delete _0x1e2ace[_0x674c('0x2b')];}_0x201653[_0x674c('0x1e')](_0x8a9d56)[_0x674c('0x2c')](_0x1e2ace);};}exports[_0x674c('0x2d')]=function(_0x534234,_0x420c97){var _0x353258={},_0x120554={},_0x263818={'count':0x0,'rows':[]};var _0x2180db=_['map'](db[_0x674c('0x2e')][_0x674c('0x2f')],function(_0xc56efd){return{'name':_0xc56efd[_0x674c('0x30')],'type':_0xc56efd[_0x674c('0x31')][_0x674c('0x32')]};});_0x120554['model']=_['map'](_0x2180db,_0x674c('0x2b'));_0x120554[_0x674c('0x33')]=_[_0x674c('0x34')](_0x534234['query']);_0x120554[_0x674c('0x35')]=_['intersection'](_0x120554['model'],_0x120554['query']);_0x353258[_0x674c('0x36')]=_[_0x674c('0x37')](_0x120554[_0x674c('0x38')],qs[_0x674c('0x39')](_0x534234[_0x674c('0x33')][_0x674c('0x39')]));_0x353258[_0x674c('0x36')]=_0x353258[_0x674c('0x36')][_0x674c('0x3a')]?_0x353258['attributes']:_0x120554[_0x674c('0x38')];if(!_0x534234['query'][_0x674c('0x3b')](_0x674c('0x3c'))){_0x353258[_0x674c('0x1d')]=qs[_0x674c('0x1d')](_0x534234['query']['limit']);_0x353258[_0x674c('0x1c')]=qs[_0x674c('0x1c')](_0x534234[_0x674c('0x33')][_0x674c('0x1c')]);}_0x353258[_0x674c('0x3d')]=qs['sort'](_0x534234[_0x674c('0x33')][_0x674c('0x3e')]);_0x353258[_0x674c('0x3f')]=qs[_0x674c('0x35')](_['pick'](_0x534234[_0x674c('0x33')],_0x120554[_0x674c('0x35')]),_0x2180db);if(_0x534234[_0x674c('0x33')][_0x674c('0x40')]){_0x353258[_0x674c('0x3f')]=_[_0x674c('0x41')](_0x353258[_0x674c('0x3f')],{'$or':_[_0x674c('0x42')](_0x2180db,function(_0x30feb9){if(_0x30feb9['type']!==_0x674c('0x43')){var _0x2a4d9b={};_0x2a4d9b[_0x30feb9['name']]={'$like':'%'+_0x534234[_0x674c('0x33')][_0x674c('0x40')]+'%'};return _0x2a4d9b;}})});}_0x353258=_['merge']({},_0x353258,_0x534234[_0x674c('0x44')]);var _0x38997c={'where':_0x353258['where']};return db[_0x674c('0x2e')]['count'](_0x38997c)[_0x674c('0x24')](function(_0x3b5a97){_0x263818[_0x674c('0x1b')]=_0x3b5a97;if(_0x534234[_0x674c('0x33')][_0x674c('0x45')]){_0x353258[_0x674c('0x46')]=[{'all':!![]}];}return db['Pause'][_0x674c('0x47')](_0x353258);})['then'](function(_0x19ccd6){_0x263818['rows']=_0x19ccd6;return _0x263818;})['then'](respondWithFilteredResult(_0x420c97,_0x353258))[_0x674c('0x48')](handleError(_0x420c97,null));};exports['show']=function(_0x170fe6,_0x1b052e){var _0x2ae1e7={'raw':!![],'where':{'id':_0x170fe6[_0x674c('0x49')]['id']}},_0x2af0a4={};_0x2af0a4[_0x674c('0x38')]=_[_0x674c('0x34')](db[_0x674c('0x2e')][_0x674c('0x2f')]);_0x2af0a4[_0x674c('0x33')]=_['keys'](_0x170fe6[_0x674c('0x33')]);_0x2af0a4[_0x674c('0x35')]=_[_0x674c('0x37')](_0x2af0a4['model'],_0x2af0a4[_0x674c('0x33')]);_0x2ae1e7[_0x674c('0x36')]=_[_0x674c('0x37')](_0x2af0a4[_0x674c('0x38')],qs['fields'](_0x170fe6[_0x674c('0x33')][_0x674c('0x39')]));_0x2ae1e7[_0x674c('0x36')]=_0x2ae1e7[_0x674c('0x36')]['length']?_0x2ae1e7[_0x674c('0x36')]:_0x2af0a4['model'];if(_0x170fe6[_0x674c('0x33')][_0x674c('0x45')]){_0x2ae1e7['include']=[{'all':!![]}];}_0x2ae1e7=_['merge']({},_0x2ae1e7,_0x170fe6[_0x674c('0x44')]);return db[_0x674c('0x2e')][_0x674c('0x4a')](_0x2ae1e7)['then'](handleEntityNotFound(_0x1b052e,null))[_0x674c('0x24')](respondWithResult(_0x1b052e,null))['catch'](handleError(_0x1b052e,null));};exports['create']=function(_0x5d68c5,_0x464043){return db[_0x674c('0x2e')][_0x674c('0x4b')](_0x5d68c5[_0x674c('0x4c')],{})[_0x674c('0x24')](function(_0x1dcdb5){var _0x573ce4=_0x5d68c5[_0x674c('0x4d')][_0x674c('0x26')]({'plain':!![]});if(!_0x573ce4)throw new Error(_0x674c('0x4e'));if(_0x573ce4['role']===_0x674c('0x4d')){var _0x1d912a=_0x1dcdb5[_0x674c('0x26')]({'plain':!![]});var _0x987fe9=_0x674c('0x27');return db[_0x674c('0x4f')]['find']({'where':{'name':_0x987fe9,'userProfileId':_0x573ce4[_0x674c('0x50')]},'raw':!![]})['then'](function(_0x3ee4d){if(_0x3ee4d&&_0x3ee4d[_0x674c('0x51')]===0x0){return db[_0x674c('0x52')][_0x674c('0x4b')]({'name':_0x1d912a['name'],'resourceId':_0x1d912a['id'],'type':_0x3ee4d[_0x674c('0x2b')],'sectionId':_0x3ee4d['id']},{})[_0x674c('0x24')](function(){return _0x1dcdb5;});}else{return _0x1dcdb5;}})[_0x674c('0x48')](function(_0x2be31e){logger[_0x674c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2be31e);throw _0x2be31e;});}return _0x1dcdb5;})['then'](respondWithResult(_0x464043,0xc9))[_0x674c('0x48')](handleError(_0x464043,null));};exports[_0x674c('0x23')]=function(_0x3dedc0,_0x379b98){if(_0x3dedc0[_0x674c('0x4c')]['id']){delete _0x3dedc0[_0x674c('0x4c')]['id'];}return db[_0x674c('0x2e')][_0x674c('0x4a')]({'where':{'id':_0x3dedc0[_0x674c('0x49')]['id']}})[_0x674c('0x24')](handleEntityNotFound(_0x379b98,null))[_0x674c('0x24')](saveUpdates(_0x3dedc0[_0x674c('0x4c')],null))[_0x674c('0x24')](respondWithResult(_0x379b98,null))[_0x674c('0x48')](handleError(_0x379b98,null));};exports['destroy']=function(_0x135920,_0x1cd782){return db[_0x674c('0x2e')][_0x674c('0x4a')]({'where':{'id':_0x135920[_0x674c('0x49')]['id']}})[_0x674c('0x24')](handleEntityNotFound(_0x1cd782,null))[_0x674c('0x24')](removeEntity(_0x1cd782,null))[_0x674c('0x48')](handleError(_0x1cd782,null));}; \ No newline at end of file +var _0x9ef8=['merge','options','include','findAll','rows','catch','show','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','Pauses','UserProfileResource','error','stack','send','map','Pause','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','name'];(function(_0x571102,_0x1ae44e){var _0x3703fc=function(_0x29d023){while(--_0x29d023){_0x571102['push'](_0x571102['shift']());}};_0x3703fc(++_0x1ae44e);}(_0x9ef8,0x154));var _0x89ef=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x9ef8[_0x2e8418];return _0x548fe6;};'use strict';var emlformat=require(_0x89ef('0x0'));var rimraf=require(_0x89ef('0x1'));var zipdir=require(_0x89ef('0x2'));var jsonpatch=require(_0x89ef('0x3'));var rp=require(_0x89ef('0x4'));var moment=require('moment');var BPromise=require(_0x89ef('0x5'));var Mustache=require(_0x89ef('0x6'));var util=require('util');var path=require(_0x89ef('0x7'));var sox=require('sox');var csv=require(_0x89ef('0x8'));var ejs=require(_0x89ef('0x9'));var fs=require('fs');var fs_extra=require(_0x89ef('0xa'));var _=require(_0x89ef('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x89ef('0xc'));var deskjs=require(_0x89ef('0xd'));var toCsv=require(_0x89ef('0x8'));var querystring=require(_0x89ef('0xe'));var Papa=require(_0x89ef('0xf'));var Redis=require(_0x89ef('0x10'));var authService=require(_0x89ef('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x89ef('0x12'));var hardwareService=require(_0x89ef('0x13'));var logger=require('../../config/logger')(_0x89ef('0x14'));var utils=require(_0x89ef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x89ef('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x181696,_0x23ff72){_0x23ff72=_0x23ff72||0xcc;return function(_0x1ed67a){if(_0x1ed67a){return _0x181696[_0x89ef('0x17')](_0x23ff72);}return _0x181696[_0x89ef('0x18')](_0x23ff72)[_0x89ef('0x19')]();};}function respondWithResult(_0x1dd581,_0xeec0e6){_0xeec0e6=_0xeec0e6||0xc8;return function(_0xceedd0){if(_0xceedd0){return _0x1dd581['status'](_0xeec0e6)['json'](_0xceedd0);}};}function respondWithFilteredResult(_0x35ac4e,_0x537ec8){return function(_0x3d3ad2){if(_0x3d3ad2){var _0x1fd660=typeof _0x537ec8['offset']===_0x89ef('0x1a')&&typeof _0x537ec8['limit']===_0x89ef('0x1a');var _0x4337e2=_0x3d3ad2[_0x89ef('0x1b')];var _0x390e6c=_0x1fd660?0x0:_0x537ec8['offset'];var _0x52bfa6=_0x1fd660?_0x3d3ad2[_0x89ef('0x1b')]:_0x537ec8['offset']+_0x537ec8[_0x89ef('0x1c')];var _0x5a2021;if(_0x52bfa6>=_0x4337e2){_0x52bfa6=_0x4337e2;_0x5a2021=0xc8;}else{_0x5a2021=0xce;}_0x35ac4e[_0x89ef('0x18')](_0x5a2021);return _0x35ac4e[_0x89ef('0x1d')](_0x89ef('0x1e'),_0x390e6c+'-'+_0x52bfa6+'/'+_0x4337e2)[_0x89ef('0x1f')](_0x3d3ad2);}return null;};}function patchUpdates(_0x2d8392){return function(_0x113afe){try{jsonpatch[_0x89ef('0x20')](_0x113afe,_0x2d8392,!![]);}catch(_0x29d229){return BPromise[_0x89ef('0x21')](_0x29d229);}return _0x113afe['save']();};}function saveUpdates(_0x2ec54b,_0x563275){return function(_0x52e5c3){if(_0x52e5c3){return _0x52e5c3[_0x89ef('0x22')](_0x2ec54b)['then'](function(_0x166b4d){return _0x166b4d;});}return null;};}function removeEntity(_0x211760,_0x6b7b95){return function(_0x1c17c9){if(_0x1c17c9){return _0x1c17c9[_0x89ef('0x23')]()[_0x89ef('0x24')](function(){var _0x391332=_0x1c17c9[_0x89ef('0x25')]({'plain':!![]});var _0x3cdeee=_0x89ef('0x26');return db[_0x89ef('0x27')]['destroy']({'where':{'type':_0x3cdeee,'resourceId':_0x391332['id']}})[_0x89ef('0x24')](function(){return _0x1c17c9;});})[_0x89ef('0x24')](function(){_0x211760[_0x89ef('0x18')](0xcc)[_0x89ef('0x19')]();});}};}function handleEntityNotFound(_0x219750,_0x15f580){return function(_0x3afb42){if(!_0x3afb42){_0x219750[_0x89ef('0x17')](0x194);}return _0x3afb42;};}function handleError(_0x4b7802,_0x4db9af){_0x4db9af=_0x4db9af||0x1f4;return function(_0x2678af){logger[_0x89ef('0x28')](_0x2678af[_0x89ef('0x29')]);if(_0x2678af['name']){delete _0x2678af['name'];}_0x4b7802[_0x89ef('0x18')](_0x4db9af)[_0x89ef('0x2a')](_0x2678af);};}exports['index']=function(_0x4a22d2,_0x592ec3){var _0x25990a={},_0x37bf14={},_0x44ea37={'count':0x0,'rows':[]};var _0x28d8a7=_[_0x89ef('0x2b')](db[_0x89ef('0x2c')][_0x89ef('0x2d')],function(_0xeed636){return{'name':_0xeed636[_0x89ef('0x2e')],'type':_0xeed636['type']['key']};});_0x37bf14[_0x89ef('0x2f')]=_['map'](_0x28d8a7,'name');_0x37bf14[_0x89ef('0x30')]=_[_0x89ef('0x31')](_0x4a22d2[_0x89ef('0x30')]);_0x37bf14[_0x89ef('0x32')]=_[_0x89ef('0x33')](_0x37bf14[_0x89ef('0x2f')],_0x37bf14[_0x89ef('0x30')]);_0x25990a[_0x89ef('0x34')]=_[_0x89ef('0x33')](_0x37bf14['model'],qs['fields'](_0x4a22d2['query'][_0x89ef('0x35')]));_0x25990a[_0x89ef('0x34')]=_0x25990a[_0x89ef('0x34')]['length']?_0x25990a[_0x89ef('0x34')]:_0x37bf14[_0x89ef('0x2f')];if(!_0x4a22d2[_0x89ef('0x30')][_0x89ef('0x36')](_0x89ef('0x37'))){_0x25990a[_0x89ef('0x1c')]=qs[_0x89ef('0x1c')](_0x4a22d2['query']['limit']);_0x25990a['offset']=qs[_0x89ef('0x38')](_0x4a22d2[_0x89ef('0x30')][_0x89ef('0x38')]);}_0x25990a[_0x89ef('0x39')]=qs[_0x89ef('0x3a')](_0x4a22d2[_0x89ef('0x30')][_0x89ef('0x3a')]);_0x25990a[_0x89ef('0x3b')]=qs['filters'](_[_0x89ef('0x3c')](_0x4a22d2[_0x89ef('0x30')],_0x37bf14[_0x89ef('0x32')]),_0x28d8a7);if(_0x4a22d2['query'][_0x89ef('0x3d')]){_0x25990a[_0x89ef('0x3b')]=_['merge'](_0x25990a[_0x89ef('0x3b')],{'$or':_[_0x89ef('0x2b')](_0x28d8a7,function(_0x319fcc){if(_0x319fcc[_0x89ef('0x3e')]!==_0x89ef('0x3f')){var _0x1e92b0={};_0x1e92b0[_0x319fcc[_0x89ef('0x40')]]={'$like':'%'+_0x4a22d2[_0x89ef('0x30')][_0x89ef('0x3d')]+'%'};return _0x1e92b0;}})});}_0x25990a=_[_0x89ef('0x41')]({},_0x25990a,_0x4a22d2[_0x89ef('0x42')]);var _0x34236a={'where':_0x25990a['where']};return db['Pause'][_0x89ef('0x1b')](_0x34236a)['then'](function(_0x3b5b5a){_0x44ea37[_0x89ef('0x1b')]=_0x3b5b5a;if(_0x4a22d2[_0x89ef('0x30')]['includeAll']){_0x25990a[_0x89ef('0x43')]=[{'all':!![]}];}return db[_0x89ef('0x2c')][_0x89ef('0x44')](_0x25990a);})['then'](function(_0x41928a){_0x44ea37[_0x89ef('0x45')]=_0x41928a;return _0x44ea37;})['then'](respondWithFilteredResult(_0x592ec3,_0x25990a))[_0x89ef('0x46')](handleError(_0x592ec3,null));};exports[_0x89ef('0x47')]=function(_0x1f957e,_0x568972){var _0x259d48={'raw':!![],'where':{'id':_0x1f957e['params']['id']}},_0x5baa3a={};_0x5baa3a[_0x89ef('0x2f')]=_[_0x89ef('0x31')](db[_0x89ef('0x2c')]['rawAttributes']);_0x5baa3a['query']=_[_0x89ef('0x31')](_0x1f957e['query']);_0x5baa3a['filters']=_[_0x89ef('0x33')](_0x5baa3a[_0x89ef('0x2f')],_0x5baa3a[_0x89ef('0x30')]);_0x259d48[_0x89ef('0x34')]=_[_0x89ef('0x33')](_0x5baa3a[_0x89ef('0x2f')],qs[_0x89ef('0x35')](_0x1f957e['query'][_0x89ef('0x35')]));_0x259d48['attributes']=_0x259d48[_0x89ef('0x34')]['length']?_0x259d48[_0x89ef('0x34')]:_0x5baa3a[_0x89ef('0x2f')];if(_0x1f957e[_0x89ef('0x30')]['includeAll']){_0x259d48[_0x89ef('0x43')]=[{'all':!![]}];}_0x259d48=_['merge']({},_0x259d48,_0x1f957e[_0x89ef('0x42')]);return db[_0x89ef('0x2c')][_0x89ef('0x48')](_0x259d48)[_0x89ef('0x24')](handleEntityNotFound(_0x568972,null))['then'](respondWithResult(_0x568972,null))[_0x89ef('0x46')](handleError(_0x568972,null));};exports[_0x89ef('0x49')]=function(_0x35ef6e,_0x486d28){return db['Pause'][_0x89ef('0x49')](_0x35ef6e[_0x89ef('0x4a')],{})[_0x89ef('0x24')](function(_0x2f3479){var _0x377e37=_0x35ef6e[_0x89ef('0x4b')]['get']({'plain':!![]});if(!_0x377e37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x377e37['role']===_0x89ef('0x4b')){var _0x5d597e=_0x2f3479['get']({'plain':!![]});var _0x5d7be0=_0x89ef('0x26');return db[_0x89ef('0x4c')][_0x89ef('0x48')]({'where':{'name':_0x5d7be0,'userProfileId':_0x377e37[_0x89ef('0x4d')]},'raw':!![]})['then'](function(_0x5ac68c){if(_0x5ac68c&&_0x5ac68c[_0x89ef('0x4e')]===0x0){return db[_0x89ef('0x27')][_0x89ef('0x49')]({'name':_0x5d597e['name'],'resourceId':_0x5d597e['id'],'type':_0x5ac68c[_0x89ef('0x40')],'sectionId':_0x5ac68c['id']},{})['then'](function(){return _0x2f3479;});}else{return _0x2f3479;}})['catch'](function(_0x5c53c1){logger[_0x89ef('0x28')](_0x89ef('0x4f'),_0x5c53c1);throw _0x5c53c1;});}return _0x2f3479;})[_0x89ef('0x24')](respondWithResult(_0x486d28,0xc9))[_0x89ef('0x46')](handleError(_0x486d28,null));};exports[_0x89ef('0x22')]=function(_0x3ea2f8,_0x2f3a6b){if(_0x3ea2f8[_0x89ef('0x4a')]['id']){delete _0x3ea2f8[_0x89ef('0x4a')]['id'];}return db['Pause']['find']({'where':{'id':_0x3ea2f8[_0x89ef('0x50')]['id']}})[_0x89ef('0x24')](handleEntityNotFound(_0x2f3a6b,null))[_0x89ef('0x24')](saveUpdates(_0x3ea2f8[_0x89ef('0x4a')],null))['then'](respondWithResult(_0x2f3a6b,null))[_0x89ef('0x46')](handleError(_0x2f3a6b,null));};exports[_0x89ef('0x23')]=function(_0x2427f5,_0x953717){return db['Pause'][_0x89ef('0x48')]({'where':{'id':_0x2427f5[_0x89ef('0x50')]['id']}})[_0x89ef('0x24')](handleEntityNotFound(_0x953717,null))['then'](removeEntity(_0x953717,null))[_0x89ef('0x46')](handleError(_0x953717,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a5a43cb..7cad99b 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x3165af,_0x4cb1e0){var _0x2d42ad=function(_0x375374){while(--_0x375374){_0x3165af['push'](_0x3165af['shift']());}};_0x2d42ad(++_0x4cb1e0);}(_0xf494,0x1c6));var _0x4f49=function(_0x34d44f,_0x5dbe00){_0x34d44f=_0x34d44f-0x0;var _0x2b9d21=_0xf494[_0x34d44f];return _0x2b9d21;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x7217,0x19e));var _0x7721=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x7217[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index f342f72..4e928bc 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2a2d31,_0x59301a){var _0x1041f7=function(_0x52b4af){while(--_0x52b4af){_0x2a2d31['push'](_0x2a2d31['shift']());}};_0x1041f7(++_0x59301a);}(_0x7a54,0x106));var _0x47a5=function(_0x571599,_0x44bffb){_0x571599=_0x571599-0x0;var _0x42c0e4=_0x7a54[_0x571599];return _0x42c0e4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x58848b,_0x18d40c){var _0x286207=function(_0x26da0f){while(--_0x26da0f){_0x58848b['push'](_0x58848b['shift']());}};_0x286207(++_0x18d40c);}(_0xb10b,0x12a));var _0xbb10=function(_0x34046c,_0x283124){_0x34046c=_0x34046c-0x0;var _0x5d4d17=_0xb10b[_0x34046c];return _0x5d4d17;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index bbdb5c2..fed63c9 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fdb=['server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','/webhook','webhookGet','get','show','/:id/download','download','diskStorage','root'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x1ec6fd,_0x51118){_0x1ec6fd=_0x1ec6fd-0x0;var _0x4ea888=_0x4fdb[_0x1ec6fd];return _0x4ea888;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),controller[_0xb4fd('0xc')]);router[_0xb4fd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0xd')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x10')]);var upload=multer({'storage':multer[_0xb4fd('0x11')]({'destination':function(_0x2148db,_0x23b08f,_0x306bd4){_0x306bd4(null,path['join'](config[_0xb4fd('0x12')],_0xb4fd('0x13')));},'filename':function(_0x2e8ee1,_0x120c2e,_0x5ba7e1){_0x120c2e[_0xb4fd('0x14')]=_0x120c2e[_0xb4fd('0x14')][_0xb4fd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba7e1(null,util['format'](_0xb4fd('0x16'),path[_0xb4fd('0x17')](_0x120c2e[_0xb4fd('0x14')],path[_0xb4fd('0x18')](_0x120c2e[_0xb4fd('0x14')])),Date[_0xb4fd('0x19')](),path[_0xb4fd('0x18')](_0x120c2e['originalname'])));}})});router[_0xb4fd('0x1a')]('/',upload[_0xb4fd('0x1b')](_0xb4fd('0x1c')),controller[_0xb4fd('0x1d')]);router[_0xb4fd('0x1a')](_0xb4fd('0xb'),controller[_0xb4fd('0x1e')]);router[_0xb4fd('0x1f')](_0xb4fd('0x20'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xb4fd('0x22')]=router; \ No newline at end of file +var _0x4fdb=['server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','/webhook','webhookGet','get','show','/:id/download','download','diskStorage','root'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x470967,_0x4e495b){_0x470967=_0x470967-0x0;var _0xe1e694=_0x4fdb[_0x470967];return _0xe1e694;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),controller[_0xb4fd('0xc')]);router[_0xb4fd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0xd')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x10')]);var upload=multer({'storage':multer[_0xb4fd('0x11')]({'destination':function(_0x2148db,_0x23b08f,_0x306bd4){_0x306bd4(null,path['join'](config[_0xb4fd('0x12')],_0xb4fd('0x13')));},'filename':function(_0x2e8ee1,_0x120c2e,_0x5ba7e1){_0x120c2e[_0xb4fd('0x14')]=_0x120c2e[_0xb4fd('0x14')][_0xb4fd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba7e1(null,util['format'](_0xb4fd('0x16'),path[_0xb4fd('0x17')](_0x120c2e[_0xb4fd('0x14')],path[_0xb4fd('0x18')](_0x120c2e[_0xb4fd('0x14')])),Date[_0xb4fd('0x19')](),path[_0xb4fd('0x18')](_0x120c2e['originalname'])));}})});router[_0xb4fd('0x1a')]('/',upload[_0xb4fd('0x1b')](_0xb4fd('0x1c')),controller[_0xb4fd('0x1d')]);router[_0xb4fd('0x1a')](_0xb4fd('0xb'),controller[_0xb4fd('0x1e')]);router[_0xb4fd('0x1f')](_0xb4fd('0x20'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xb4fd('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 00a3a77..4deabd6 100644 --- a/server/api/plugin/plugin.attributes.js +++ b/server/api/plugin/plugin.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fbf=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','agentOnly'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x3fbf,0x93));var _0xf3fb=function(_0x3cb86b,_0x3c75f6){_0x3cb86b=_0x3cb86b-0x0;var _0x3c10a0=_0x3fbf[_0x3cb86b];return _0x3c10a0;};'use strict';var Sequelize=require(_0xf3fb('0x0'));module['exports']={'name':{'type':Sequelize[_0xf3fb('0x1')]},'type':{'type':Sequelize['ENUM']('html','script')},'description':{'type':Sequelize[_0xf3fb('0x2')]},'version':{'type':Sequelize[_0xf3fb('0x2')]},'path':{'type':Sequelize[_0xf3fb('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf3fb('0x3')},'sidebar':{'type':Sequelize[_0xf3fb('0x4')]('adminOnly',_0xf3fb('0x5'),_0xf3fb('0x6'),_0xf3fb('0x7')),'defaultValue':_0xf3fb('0x6'),'comment':_0xf3fb('0x8')},'icon':{'type':Sequelize[_0xf3fb('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf3fb('0x1')]},'scriptName':{'type':Sequelize[_0xf3fb('0x1')]},'scriptPath':{'type':Sequelize[_0xf3fb('0x1')]}}; \ No newline at end of file +var _0x5622=['TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script'];(function(_0x2a7d02,_0x136e24){var _0x3cd79d=function(_0x1b2722){while(--_0x1b2722){_0x2a7d02['push'](_0x2a7d02['shift']());}};_0x3cd79d(++_0x136e24);}(_0x5622,0xf8));var _0x2562=function(_0x4a3518,_0x247eda){_0x4a3518=_0x4a3518-0x0;var _0xf60dc4=_0x5622[_0x4a3518];return _0xf60dc4;};'use strict';var Sequelize=require(_0x2562('0x0'));module['exports']={'name':{'type':Sequelize[_0x2562('0x1')]},'type':{'type':Sequelize[_0x2562('0x2')](_0x2562('0x3'),_0x2562('0x4'))},'description':{'type':Sequelize[_0x2562('0x5')]},'version':{'type':Sequelize[_0x2562('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2562('0x6')},'sidebar':{'type':Sequelize[_0x2562('0x2')]('adminOnly',_0x2562('0x7'),_0x2562('0x8'),_0x2562('0x9')),'defaultValue':'always','comment':_0x2562('0xa')},'icon':{'type':Sequelize[_0x2562('0x1')]},'adminUrl':{'type':Sequelize[_0x2562('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x2562('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c165ed6..21066c7 100644 --- a/server/api/plugin/plugin.controller.js +++ b/server/api/plugin/plugin.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6df8=['Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','delete','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Plugins','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Plugin','includeAll','include','catch','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','root','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x6df8,0x198));var _0x86df=function(_0x2468cb,_0x59671a){_0x2468cb=_0x2468cb-0x0;var _0x53ebfd=_0x6df8[_0x2468cb];return _0x53ebfd;};'use strict';var emlformat=require(_0x86df('0x0'));var rimraf=require(_0x86df('0x1'));var zipdir=require(_0x86df('0x2'));var jsonpatch=require(_0x86df('0x3'));var rp=require(_0x86df('0x4'));var moment=require(_0x86df('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x86df('0x6'));var util=require('util');var path=require(_0x86df('0x7'));var sox=require(_0x86df('0x8'));var csv=require(_0x86df('0x9'));var ejs=require(_0x86df('0xa'));var fs=require('fs');var fs_extra=require(_0x86df('0xb'));var _=require(_0x86df('0xc'));var squel=require(_0x86df('0xd'));var crypto=require(_0x86df('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x86df('0xf'));var toCsv=require(_0x86df('0x9'));var querystring=require(_0x86df('0x10'));var Papa=require(_0x86df('0x11'));var extract=require(_0x86df('0x12'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x86df('0x13'));var authService=require(_0x86df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x86df('0x15'));var hardwareService=require(_0x86df('0x16'));var logger=require(_0x86df('0x17'))(_0x86df('0x18'));var utils=require('../../config/utils');var config=require(_0x86df('0x19'));var licenseUtil=require(_0x86df('0x1a'));var db=require(_0x86df('0x1b'))['db'];config[_0x86df('0x1c')]=_['defaults'](config[_0x86df('0x1c')],{'host':_0x86df('0x1d'),'port':0x18eb});var socket=require(_0x86df('0x1e'))(new Redis(config[_0x86df('0x1c')]));require(_0x86df('0x1f'))[_0x86df('0x20')](socket);function respondWithStatusCode(_0x47e584,_0x228289){_0x228289=_0x228289||0xcc;return function(_0x42d843){if(_0x42d843){return _0x47e584[_0x86df('0x21')](_0x228289);}return _0x47e584['status'](_0x228289)[_0x86df('0x22')]();};}function respondWithResult(_0x52b441,_0x5193c2){_0x5193c2=_0x5193c2||0xc8;return function(_0xbf06b8){if(_0xbf06b8){return _0x52b441['status'](_0x5193c2)['json'](_0xbf06b8);}};}function respondWithFilteredResult(_0x1f5c82,_0x46417b){return function(_0xa80230){if(_0xa80230){var _0x57b3f7=typeof _0x46417b[_0x86df('0x23')]===_0x86df('0x24')&&typeof _0x46417b[_0x86df('0x25')]===_0x86df('0x24');var _0x4ea1fc=_0xa80230[_0x86df('0x26')];var _0x3e8173=_0x57b3f7?0x0:_0x46417b['offset'];var _0x4b69ea=_0x57b3f7?_0xa80230[_0x86df('0x26')]:_0x46417b[_0x86df('0x23')]+_0x46417b[_0x86df('0x25')];var _0x736d3c;if(_0x4b69ea>=_0x4ea1fc){_0x4b69ea=_0x4ea1fc;_0x736d3c=0xc8;}else{_0x736d3c=0xce;}_0x1f5c82[_0x86df('0x27')](_0x736d3c);return _0x1f5c82[_0x86df('0x28')](_0x86df('0x29'),_0x3e8173+'-'+_0x4b69ea+'/'+_0x4ea1fc)[_0x86df('0x2a')](_0xa80230);}return null;};}function patchUpdates(_0x55cd56){return function(_0xc6bdb){try{jsonpatch[_0x86df('0x2b')](_0xc6bdb,_0x55cd56,!![]);}catch(_0x3b1af1){return BPromise[_0x86df('0x2c')](_0x3b1af1);}return _0xc6bdb[_0x86df('0x2d')]();};}function saveUpdates(_0x4d57e6,_0x3fd9d9){return function(_0x97a77d){if(_0x97a77d){return _0x97a77d[_0x86df('0x2e')](_0x4d57e6)[_0x86df('0x2f')](function(_0xec09de){return _0xec09de;});}return null;};}function removeEntity(_0x2a6af7,_0x5ed1c6){return function(_0x1968d9){if(_0x1968d9){return _0x1968d9[_0x86df('0x30')]()[_0x86df('0x2f')](function(){var _0x13810e=_0x1968d9[_0x86df('0x31')]({'plain':!![]});var _0x1a9eb5=_0x86df('0x32');return db['UserProfileResource'][_0x86df('0x30')]({'where':{'type':_0x1a9eb5,'resourceId':_0x13810e['id']}})['then'](function(){return _0x1968d9;});})[_0x86df('0x2f')](function(){_0x2a6af7['status'](0xcc)[_0x86df('0x22')]();});}};}function handleEntityNotFound(_0x2894a5,_0xa50bb2){return function(_0x4ae0f7){if(!_0x4ae0f7){_0x2894a5[_0x86df('0x21')](0x194);}return _0x4ae0f7;};}function handleError(_0x3783ce,_0x57ffd0){_0x57ffd0=_0x57ffd0||0x1f4;return function(_0x3b28d3){logger[_0x86df('0x33')](_0x3b28d3[_0x86df('0x34')]);if(_0x3b28d3['name']){delete _0x3b28d3[_0x86df('0x35')];}_0x3783ce['status'](_0x57ffd0)[_0x86df('0x36')](_0x3b28d3);};}exports[_0x86df('0x37')]=function(_0x39caad,_0x252818){var _0x42f7e0={},_0x5994f7={},_0x31aa91={'count':0x0,'rows':[]};var _0x2d027a=_['map'](db['Plugin'][_0x86df('0x38')],function(_0x4d138b){return{'name':_0x4d138b[_0x86df('0x39')],'type':_0x4d138b[_0x86df('0x3a')][_0x86df('0x3b')]};});_0x5994f7[_0x86df('0x3c')]=_[_0x86df('0x3d')](_0x2d027a,_0x86df('0x35'));_0x5994f7[_0x86df('0x3e')]=_[_0x86df('0x3f')](_0x39caad[_0x86df('0x3e')]);_0x5994f7[_0x86df('0x40')]=_[_0x86df('0x41')](_0x5994f7[_0x86df('0x3c')],_0x5994f7[_0x86df('0x3e')]);_0x42f7e0['attributes']=_[_0x86df('0x41')](_0x5994f7[_0x86df('0x3c')],qs[_0x86df('0x42')](_0x39caad['query'][_0x86df('0x42')]));_0x42f7e0[_0x86df('0x43')]=_0x42f7e0[_0x86df('0x43')][_0x86df('0x44')]?_0x42f7e0[_0x86df('0x43')]:_0x5994f7[_0x86df('0x3c')];if(!_0x39caad['query'][_0x86df('0x45')](_0x86df('0x46'))){_0x42f7e0[_0x86df('0x25')]=qs['limit'](_0x39caad[_0x86df('0x3e')][_0x86df('0x25')]);_0x42f7e0[_0x86df('0x23')]=qs[_0x86df('0x23')](_0x39caad[_0x86df('0x3e')][_0x86df('0x23')]);}_0x42f7e0[_0x86df('0x47')]=qs[_0x86df('0x48')](_0x39caad['query'][_0x86df('0x48')]);_0x42f7e0[_0x86df('0x49')]=qs['filters'](_[_0x86df('0x4a')](_0x39caad[_0x86df('0x3e')],_0x5994f7[_0x86df('0x40')]),_0x2d027a);if(_0x39caad[_0x86df('0x3e')][_0x86df('0x4b')]){_0x42f7e0['where']=_['merge'](_0x42f7e0[_0x86df('0x49')],{'$or':_[_0x86df('0x3d')](_0x2d027a,function(_0x1bcb3d){if(_0x1bcb3d['type']!=='VIRTUAL'){var _0x190867={};_0x190867[_0x1bcb3d[_0x86df('0x35')]]={'$like':'%'+_0x39caad[_0x86df('0x3e')][_0x86df('0x4b')]+'%'};return _0x190867;}})});}_0x42f7e0=_[_0x86df('0x4c')]({},_0x42f7e0,_0x39caad[_0x86df('0x4d')]);var _0x1ffe68={'where':_0x42f7e0[_0x86df('0x49')]};return db[_0x86df('0x4e')][_0x86df('0x26')](_0x1ffe68)[_0x86df('0x2f')](function(_0x4e3fcc){_0x31aa91['count']=_0x4e3fcc;if(_0x39caad[_0x86df('0x3e')][_0x86df('0x4f')]){_0x42f7e0[_0x86df('0x50')]=[{'all':!![]}];}return db[_0x86df('0x4e')]['findAll'](_0x42f7e0);})[_0x86df('0x2f')](function(_0x14a42d){_0x31aa91['rows']=_0x14a42d;return _0x31aa91;})[_0x86df('0x2f')](respondWithFilteredResult(_0x252818,_0x42f7e0))[_0x86df('0x51')](handleError(_0x252818,null));};exports['show']=function(_0xee23b8,_0x34c108){var _0x3ca3ac={'raw':!![],'where':{'id':_0xee23b8['params']['id']}},_0x52b49f={};_0x52b49f[_0x86df('0x3c')]=_[_0x86df('0x3f')](db[_0x86df('0x4e')][_0x86df('0x38')]);_0x52b49f[_0x86df('0x3e')]=_[_0x86df('0x3f')](_0xee23b8[_0x86df('0x3e')]);_0x52b49f[_0x86df('0x40')]=_[_0x86df('0x41')](_0x52b49f[_0x86df('0x3c')],_0x52b49f[_0x86df('0x3e')]);_0x3ca3ac[_0x86df('0x43')]=_['intersection'](_0x52b49f[_0x86df('0x3c')],qs[_0x86df('0x42')](_0xee23b8[_0x86df('0x3e')]['fields']));_0x3ca3ac['attributes']=_0x3ca3ac[_0x86df('0x43')]['length']?_0x3ca3ac[_0x86df('0x43')]:_0x52b49f[_0x86df('0x3c')];if(_0xee23b8[_0x86df('0x3e')][_0x86df('0x4f')]){_0x3ca3ac[_0x86df('0x50')]=[{'all':!![]}];}_0x3ca3ac=_[_0x86df('0x4c')]({},_0x3ca3ac,_0xee23b8[_0x86df('0x4d')]);return db[_0x86df('0x4e')][_0x86df('0x52')](_0x3ca3ac)[_0x86df('0x2f')](handleEntityNotFound(_0x34c108,null))[_0x86df('0x2f')](respondWithResult(_0x34c108,null))[_0x86df('0x51')](handleError(_0x34c108,null));};exports['download']=function(_0xe5bde2,_0x34b972,_0x211560){return db[_0x86df('0x4e')][_0x86df('0x52')]({'where':{'id':_0xe5bde2['params']['id']},'attributes':[_0x86df('0x35'),_0x86df('0x7')],'raw':!![]})[_0x86df('0x2f')](handleEntityNotFound(_0x34b972,null))[_0x86df('0x2f')](function(_0x20f2ec){if(_0x20f2ec){var _0x28f256=path[_0x86df('0x53')](config['root'],_0x86df('0x54'),util[_0x86df('0x55')](_0x86df('0x56'),path[_0x86df('0x57')](_0x20f2ec['path'])));var _0x12b3bf=fs[_0x86df('0x58')](_0x28f256);var _0x27dd7f=archiver(_0x86df('0x59'),{'zlib':{'level':0x9}});_0x27dd7f['on'](_0x86df('0x5a'),function(_0x30a6a0){if(_0x30a6a0[_0x86df('0x5b')]==='ENOENT'){logger[_0x86df('0x33')](_0x30a6a0);}else{throw new db[(_0x86df('0x5c'))][(_0x86df('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x27dd7f['on']('error',function(_0x534d56){throw new db['Sequelize'][(_0x86df('0x5d'))](_0x86df('0x5e'));});_0x27dd7f['pipe'](_0x12b3bf);_0x27dd7f['glob']('**/*',{'cwd':path[_0x86df('0x53')](config[_0x86df('0x5f')],_0x86df('0x54'),path[_0x86df('0x60')](_0x20f2ec[_0x86df('0x7')])),'ignore':[path[_0x86df('0x53')](path[_0x86df('0x57')](_0x20f2ec[_0x86df('0x7')]),'node_modules/**/*'),path['join'](path['basename'](_0x20f2ec[_0x86df('0x7')]),_0x86df('0x61'))],'nodir':!![]})[_0x86df('0x62')]();_0x12b3bf['on'](_0x86df('0x63'),function(){if(!fs[_0x86df('0x64')](_0x28f256)){throw new db[(_0x86df('0x5c'))][(_0x86df('0x5d'))](_0x86df('0x65'));}return _0x34b972[_0x86df('0x66')](_0x28f256,util['format']('%s.zip',path[_0x86df('0x57')](_0x20f2ec[_0x86df('0x7')])),function(_0x1f74c6){if(_0x1f74c6){throw new db['Sequelize'][(_0x86df('0x5d'))](_0x86df('0x67'));}fs['unlinkSync'](_0x28f256);logger['info']('Download\x20completed');logger[_0x86df('0x68')](_0x86df('0x69'));});});}return null;})[_0x86df('0x51')](handleError(_0x34b972,null));};exports[_0x86df('0x6a')]=function(_0x6be11b,_0x507baf,_0x5c0cff){var _0x8c60c1=path[_0x86df('0x57')](_0x6be11b[_0x86df('0x6b')][_0x86df('0x6c')],path[_0x86df('0x6d')](_0x6be11b[_0x86df('0x6b')][_0x86df('0x6c')]));var _0x224388=path[_0x86df('0x53')](config['root'],_0x86df('0x54'),_0x6be11b['file'][_0x86df('0x6c')]);var _0x34e740=path[_0x86df('0x53')](config[_0x86df('0x5f')],_0x86df('0x54'),_0x8c60c1);logger['info'](_0x86df('0x6e'),_0x224388);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x34e740);try{fs['chmodSync'](_0x224388,parseInt(_0x86df('0x6f'),0x8));extract(_0x224388,{'dir':_0x34e740},function(_0x325009){if(_0x325009){logger[_0x86df('0x33')](_0x325009);handleError(_0x325009,!![]);};var _0x392cc7=fs[_0x86df('0x70')](_0x34e740);if(_0x392cc7[_0x86df('0x44')]>0x1){removeReferences(_0x224388,_0x34e740);logger[_0x86df('0x33')](_0x86df('0x71'));return _0x5c0cff(new Error(_0x86df('0x71')));}var _0x129c91=fs[_0x86df('0x72')](path[_0x86df('0x53')](_0x34e740,_0x392cc7[0x0]));if(_0x129c91['isFile']()){removeReferences(_0x224388,_0x34e740);logger[_0x86df('0x33')](_0x86df('0x71'));return _0x5c0cff(new Error(_0x86df('0x71')));}if(_0x129c91[_0x86df('0x73')]()){var _0x3b82b7=fs[_0x86df('0x70')](path[_0x86df('0x53')](_0x34e740,_0x392cc7[0x0]));if(_0x3b82b7[_0x86df('0x44')]===0x0){removeReferences(_0x224388,_0x34e740);logger[_0x86df('0x33')](_0x86df('0x71'));return _0x5c0cff(new Error(_0x86df('0x71')));}var _0x46e384=_0x3b82b7[_0x86df('0x74')](function(_0x318d13){return _0x318d13===_0x86df('0x75');});if(!_0x46e384){return _0x5c0cff(new Error(_0x86df('0x76')));}var _0x57f27f=fs[_0x86df('0x77')](path[_0x86df('0x53')](_0x34e740,_0x392cc7[0x0],_0x86df('0x75')));var _0x212909=JSON['parse'](_0x57f27f);if(_0x86df('0x24')==typeof _0x212909[_0x86df('0x35')]){return _0x5c0cff(new Error(_0x86df('0x78')));}if(_0x86df('0x24')==typeof _0x212909[_0x86df('0x3a')]){return _0x5c0cff(new Error(_0x86df('0x79')));}if(_0x86df('0x24')==typeof _0x212909[_0x86df('0x7a')]){return _0x5c0cff(new Error(_0x86df('0x7b')));}if(_0x86df('0x24')==typeof _0x212909[_0x86df('0x7c')]){return _0x5c0cff(new Error(_0x86df('0x7d')));}if(_0x212909['type']===_0x86df('0x7e')){if(_0x86df('0x24')==typeof _0x212909['parameters'][_0x86df('0x7f')]){return _0x5c0cff(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x86df('0x24')==typeof _0x212909[_0x86df('0x7c')][_0x86df('0x7f')]['admin']&&_0x86df('0x24')==typeof _0x212909[_0x86df('0x7c')][_0x86df('0x7f')][_0x86df('0x80')]){return _0x5c0cff(new Error(_0x86df('0x81')));}}else if(_0x212909[_0x86df('0x3a')]===_0x86df('0x82')){if('undefined'==typeof _0x212909['parameters'][_0x86df('0x83')]){return _0x5c0cff(new Error(_0x86df('0x84')));}if(_0x86df('0x24')==typeof _0x212909[_0x86df('0x7c')][_0x86df('0x85')]){return _0x5c0cff(new Error(_0x86df('0x86')));}}else{return _0x5c0cff(new Error(_0x86df('0x87')));}var _0x2983c9=_0x212909[_0x86df('0x35')];var _0x3cd6ad=_0x212909[_0x86df('0x88')];var _0x2ea080=_0x212909[_0x86df('0x3a')];var _0xd35693=_0x212909['sidebar']?_0x212909[_0x86df('0x89')]:'always';var _0x3dd870=_0x212909[_0x86df('0x8a')]?_0x212909[_0x86df('0x8a')]:_0x86df('0x8b');var _0x582578='';var _0x4a7374='';var _0x1c9f6c='';var _0x5e63a8='';var _0x2adf9f=_0x212909[_0x86df('0x7a')];if(_0x2ea080===_0x86df('0x7e')){if(_0x86df('0x24')!=typeof _0x212909[_0x86df('0x7c')][_0x86df('0x7f')]['admin']){var _0x233c7e=_0x212909[_0x86df('0x7c')]['views'][_0x86df('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x86df('0x8d')](_0x233c7e)){_0x582578=path[_0x86df('0x53')]('plugins',_0x8c60c1,_0x392cc7[0x0],_0x233c7e);}else{_0x582578=_0x233c7e;}}else{logger[_0x86df('0x68')](_0x86df('0x8e'));}if(_0x86df('0x24')!=typeof _0x212909[_0x86df('0x7c')][_0x86df('0x7f')][_0x86df('0x80')]){var _0x138139=_0x212909[_0x86df('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x86df('0x8d')](_0x138139)){_0x4a7374=path[_0x86df('0x53')](_0x86df('0x8f'),_0x8c60c1,_0x392cc7[0x0],_0x138139);}else{_0x4a7374=_0x138139;}}else{logger['info'](_0x86df('0x90'));}}else if(_0x2ea080==='script'){_0x1c9f6c=_0x212909[_0x86df('0x7c')]['scriptName'];_0x5e63a8=_0x212909['parameters']['scriptPath'];if(_0x86df('0x24')!=typeof _0x212909['parameters'][_0x86df('0x7f')]){if(_0x86df('0x24')!=typeof _0x212909[_0x86df('0x7c')][_0x86df('0x7f')][_0x86df('0x8c')]){var _0x233c7e=_0x212909[_0x86df('0x7c')][_0x86df('0x7f')][_0x86df('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x86df('0x8d')](_0x233c7e)){_0x582578=path['join'](_0x86df('0x8f'),_0x8c60c1,_0x392cc7[0x0],_0x233c7e);}else{_0x582578=_0x233c7e;}}if(_0x86df('0x24')!=typeof _0x212909[_0x86df('0x7c')]['views'][_0x86df('0x80')]){var _0x138139=_0x212909[_0x86df('0x7c')]['views'][_0x86df('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x86df('0x8d')](_0x138139)){_0x4a7374=path[_0x86df('0x53')]('plugins',_0x8c60c1,_0x392cc7[0x0],_0x138139);}else{_0x4a7374=_0x138139;}}}}var _0x53156b={'name':_0x2983c9,'description':_0x3cd6ad,'path':path[_0x86df('0x53')](_0x8c60c1,_0x392cc7[0x0]),'type':_0x2ea080,'sidebar':_0xd35693,'icon':_0x3dd870,'adminUrl':_0x582578,'agentUrl':_0x4a7374,'scriptName':_0x1c9f6c,'scriptPath':_0x5e63a8,'version':_0x2adf9f};removeReferences(_0x224388,null);return db[_0x86df('0x4e')][_0x86df('0x91')](_0x53156b)[_0x86df('0x2f')](function(_0x43ef47){var _0x400be8={'role':_0x6be11b[_0x86df('0x92')]['role'],'userProfileId':_0x6be11b['body']['userProfileId']};if(!_0x400be8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x400be8['role']===_0x86df('0x93')){var _0x414cdc=_0x43ef47[_0x86df('0x31')]({'plain':!![]});return db['UserProfileSection'][_0x86df('0x52')]({'where':{'name':'Plugins','userProfileId':_0x400be8[_0x86df('0x94')]},'raw':!![]})[_0x86df('0x2f')](function(_0x4bccbb){if(_0x4bccbb&&_0x4bccbb['autoAssociation']===0x0){return db['UserProfileResource'][_0x86df('0x91')]({'name':_0x414cdc['name'],'resourceId':_0x414cdc['id'],'type':_0x4bccbb['name'],'sectionId':_0x4bccbb['id']},{})[_0x86df('0x2f')](function(){return _0x43ef47;});}else{return _0x43ef47;}})[_0x86df('0x51')](function(_0x5c7545){logger['error'](_0x86df('0x95'),_0x5c7545);throw _0x5c7545;});}return _0x43ef47;})[_0x86df('0x2f')](respondWithResult(_0x507baf,null))[_0x86df('0x51')](handleError(_0x507baf,null));}});}catch(_0x696a6a){_0x507baf['status'](0x1f4)[_0x86df('0x36')](_0x696a6a);}};function removeReferences(_0x4742f2,_0x2fc547){try{if(_0x4742f2){fs[_0x86df('0x96')](_0x4742f2);logger[_0x86df('0x68')](_0x86df('0x97'));}if(_0x2fc547){rimraf(_0x2fc547,function(){});logger['info'](_0x86df('0x98'));}}catch(_0x3243f6){logger[_0x86df('0x33')](_0x3243f6);}}exports['update']=function(_0x3883c3,_0x3e06cd,_0x4c11b7){return db[_0x86df('0x4e')][_0x86df('0x52')]({'where':{'id':_0x3883c3[_0x86df('0x99')]['id']}})[_0x86df('0x2f')](handleEntityNotFound(_0x3e06cd,null))[_0x86df('0x2f')](saveUpdates(_0x3883c3[_0x86df('0x92')],null))[_0x86df('0x2f')](respondWithResult(_0x3e06cd,null))[_0x86df('0x51')](handleError(_0x3e06cd,null));};exports[_0x86df('0x9a')]=function(_0xb60591,_0xbcf8f9,_0x5465a5){return db[_0x86df('0x4e')][_0x86df('0x52')]({'where':{'id':_0xb60591[_0x86df('0x99')]['id']}})[_0x86df('0x2f')](function(_0x34fc8e){if(_0x34fc8e){return _0x34fc8e['destroy']();}})[_0x86df('0x2f')](function(_0x37fa9a){rimraf(path[_0x86df('0x53')](config[_0x86df('0x5f')],_0x86df('0x54'),path['dirname'](_0x37fa9a[_0x86df('0x7')])),function(){});return _0x37fa9a;})['then'](handleEntityNotFound(_0xbcf8f9,null))['then'](respondWithStatusCode(_0xbcf8f9,null))[_0x86df('0x51')](handleError(_0xbcf8f9,null));};exports[_0x86df('0x9b')]=function(_0x283a9e,_0x1ce500,_0x2ee922){return BPromise['resolve']()[_0x86df('0x2f')](function(){if(!_0x283a9e[_0x86df('0x3e')][_0x86df('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x283a9e[_0x86df('0x3e')][_0x86df('0x9c')]){throw new Error(_0x86df('0x9d'));}var _0x38bb52=_0x283a9e[_0x86df('0x3e')][_0x86df('0x9e')]?_0x283a9e[_0x86df('0x3e')][_0x86df('0x9e')]+':'+_0x283a9e[_0x86df('0x3e')]['port']:_0x86df('0x9f')+_0x283a9e[_0x86df('0x3e')][_0x86df('0x9c')];var _0x1537d0=_0x283a9e[_0x86df('0x3e')][_0x86df('0x2a')]?_0x283a9e[_0x86df('0x3e')][_0x86df('0x2a')]:!![];var _0x4f44f3=_0x283a9e[_0x86df('0x3e')]['encoding']?_0x283a9e[_0x86df('0x3e')][_0x86df('0xa0')]:null;var _0x2d8e90={'method':_0x283a9e[_0x86df('0xa1')],'uri':util[_0x86df('0x55')](_0x86df('0xa2'),_0x38bb52,_0x283a9e[_0x86df('0x3e')][_0x86df('0x7')]),'json':_0x1537d0,'resolveWithFullResponse':!![],'encoding':_0x4f44f3,'qs':_0x283a9e[_0x86df('0x3e')]};if(_0x283a9e[_0x86df('0xa3')]){_0x2d8e90[_0x86df('0xa3')]=_0x283a9e[_0x86df('0xa3')];if(_0x2d8e90[_0x86df('0xa3')]['content-length']){delete _0x2d8e90[_0x86df('0xa3')][_0x86df('0xa4')];}}if(_0x2d8e90[_0x86df('0xa3')][_0x86df('0xa5')]){delete _0x2d8e90['headers'][_0x86df('0xa5')];}return rp(_0x2d8e90);})[_0x86df('0x2f')](function(_0x21bd6e){if(_0x21bd6e){_0x1ce500[_0x86df('0x28')](_0x21bd6e[_0x86df('0xa3')]);logger[_0x86df('0x68')](_0x21bd6e[_0x86df('0x92')]);if(_[_0x86df('0xa6')](_0x283a9e[_0x86df('0x3e')]['path'],_0x86df('0x66'))&&_0x21bd6e[_0x86df('0xa7')]==0x1f4){return _0x1ce500[_0x86df('0x21')](_0x21bd6e[_0x86df('0xa7')]);}else{return _0x1ce500['status'](_0x21bd6e[_0x86df('0xa7')])[_0x86df('0x36')](_0x21bd6e[_0x86df('0x92')]);}}else{return _0x1ce500['sendStatus'](0xc8);}})['catch'](handleError(_0x1ce500,null));};exports[_0x86df('0xa8')]=function(_0x2f071a,_0x2ca8b8,_0x44579b){return BPromise[_0x86df('0xa9')]()['then'](function(){if(!_0x2f071a[_0x86df('0x3e')][_0x86df('0x7')]){throw new Error(_0x86df('0xaa'));}if(!_0x2f071a[_0x86df('0x3e')][_0x86df('0x9c')]){throw new Error(_0x86df('0x9d'));}var _0x3ae168=_0x2f071a[_0x86df('0x3e')][_0x86df('0x9e')]?_0x2f071a[_0x86df('0x3e')][_0x86df('0x9e')]+':'+_0x2f071a[_0x86df('0x3e')][_0x86df('0x9c')]:'http://localhost:'+_0x2f071a['query'][_0x86df('0x9c')];var _0x1a4c0b=_0x2f071a['query']['json']?_0x2f071a['query']['json']:!![];var _0x55d597=_0x2f071a['query'][_0x86df('0xa0')]?_0x2f071a['query']['encoding']:null;var _0x441a81={'method':_0x2f071a[_0x86df('0xa1')],'uri':util[_0x86df('0x55')](_0x86df('0xa2'),_0x3ae168,_0x2f071a[_0x86df('0x3e')][_0x86df('0x7')]),'json':_0x1a4c0b,'resolveWithFullResponse':!![],'encoding':_0x55d597,'body':_0x2f071a[_0x86df('0x92')]};if(_0x2f071a[_0x86df('0xa3')]){_0x441a81[_0x86df('0xa3')]=_0x2f071a[_0x86df('0xa3')];if(_0x441a81[_0x86df('0xa3')][_0x86df('0xa4')]){delete _0x441a81['headers'][_0x86df('0xa4')];}}if(_0x441a81['headers'][_0x86df('0xa5')]){delete _0x441a81['headers'][_0x86df('0xa5')];}return rp(_0x441a81);})['then'](function(_0x41d883){if(_0x41d883){_0x2ca8b8[_0x86df('0x28')](_0x41d883['headers']);logger[_0x86df('0x68')](_0x41d883['body']);return _0x2ca8b8[_0x86df('0x27')](_0x41d883['statusCode'])[_0x86df('0x36')](_0x41d883[_0x86df('0x92')]);}else{return _0x2ca8b8[_0x86df('0x21')](0xc8);}})['catch'](handleError(_0x2ca8b8,null));}; \ No newline at end of file +var _0xf7b2=['defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','options','findAll','rows','catch','show','params','rawAttributes','includeAll','find','download','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','join','node_modules/**/*','attachments/**/*','finalize','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','version','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','role','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','method','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xf7b2,0x90));var _0x2f7b=function(_0x2888a9,_0x345712){_0x2888a9=_0x2888a9-0x0;var _0x5a76b5=_0xf7b2[_0x2888a9];return _0x5a76b5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f7b('0x0'));var jsonpatch=require(_0x2f7b('0x1'));var rp=require(_0x2f7b('0x2'));var moment=require(_0x2f7b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2f7b('0x4'));var path=require(_0x2f7b('0x5'));var sox=require(_0x2f7b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f7b('0x7'));var squel=require(_0x2f7b('0x8'));var crypto=require(_0x2f7b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2f7b('0xa'));var querystring=require(_0x2f7b('0xb'));var Papa=require(_0x2f7b('0xc'));var extract=require('extract-zip');var rimraf=require(_0x2f7b('0xd'));var archiver=require(_0x2f7b('0xe'));var Redis=require(_0x2f7b('0xf'));var authService=require(_0x2f7b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2f7b('0x11'));var hardwareService=require(_0x2f7b('0x12'));var logger=require(_0x2f7b('0x13'))(_0x2f7b('0x14'));var utils=require('../../config/utils');var config=require(_0x2f7b('0x15'));var licenseUtil=require(_0x2f7b('0x16'));var db=require(_0x2f7b('0x17'))['db'];config[_0x2f7b('0x18')]=_[_0x2f7b('0x19')](config[_0x2f7b('0x18')],{'host':_0x2f7b('0x1a'),'port':0x18eb});var socket=require(_0x2f7b('0x1b'))(new Redis(config[_0x2f7b('0x18')]));require(_0x2f7b('0x1c'))[_0x2f7b('0x1d')](socket);function respondWithStatusCode(_0x202e48,_0x502052){_0x502052=_0x502052||0xcc;return function(_0x3ee52e){if(_0x3ee52e){return _0x202e48[_0x2f7b('0x1e')](_0x502052);}return _0x202e48['status'](_0x502052)[_0x2f7b('0x1f')]();};}function respondWithResult(_0x59f6c5,_0x38d213){_0x38d213=_0x38d213||0xc8;return function(_0x464064){if(_0x464064){return _0x59f6c5[_0x2f7b('0x20')](_0x38d213)['json'](_0x464064);}};}function respondWithFilteredResult(_0x1ace2d,_0x596228){return function(_0x26d1e7){if(_0x26d1e7){var _0x483c9a=typeof _0x596228[_0x2f7b('0x21')]===_0x2f7b('0x22')&&typeof _0x596228['limit']==='undefined';var _0x1a797f=_0x26d1e7[_0x2f7b('0x23')];var _0x3f8aa9=_0x483c9a?0x0:_0x596228[_0x2f7b('0x21')];var _0x105500=_0x483c9a?_0x26d1e7[_0x2f7b('0x23')]:_0x596228['offset']+_0x596228[_0x2f7b('0x24')];var _0xd2d149;if(_0x105500>=_0x1a797f){_0x105500=_0x1a797f;_0xd2d149=0xc8;}else{_0xd2d149=0xce;}_0x1ace2d[_0x2f7b('0x20')](_0xd2d149);return _0x1ace2d[_0x2f7b('0x25')](_0x2f7b('0x26'),_0x3f8aa9+'-'+_0x105500+'/'+_0x1a797f)[_0x2f7b('0x27')](_0x26d1e7);}return null;};}function patchUpdates(_0x48b53e){return function(_0x2c6835){try{jsonpatch[_0x2f7b('0x28')](_0x2c6835,_0x48b53e,!![]);}catch(_0x4feb12){return BPromise[_0x2f7b('0x29')](_0x4feb12);}return _0x2c6835['save']();};}function saveUpdates(_0x53aa92,_0x3ab982){return function(_0x3fda07){if(_0x3fda07){return _0x3fda07[_0x2f7b('0x2a')](_0x53aa92)[_0x2f7b('0x2b')](function(_0x52e4fa){return _0x52e4fa;});}return null;};}function removeEntity(_0x4573dd,_0x48fef8){return function(_0x4f7914){if(_0x4f7914){return _0x4f7914[_0x2f7b('0x2c')]()[_0x2f7b('0x2b')](function(){var _0x6bad0f=_0x4f7914[_0x2f7b('0x2d')]({'plain':!![]});var _0x2c482a=_0x2f7b('0x2e');return db[_0x2f7b('0x2f')][_0x2f7b('0x2c')]({'where':{'type':_0x2c482a,'resourceId':_0x6bad0f['id']}})[_0x2f7b('0x2b')](function(){return _0x4f7914;});})[_0x2f7b('0x2b')](function(){_0x4573dd[_0x2f7b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d73b3,_0x41341a){return function(_0x56212f){if(!_0x56212f){_0x3d73b3['sendStatus'](0x194);}return _0x56212f;};}function handleError(_0x9bf55d,_0x133798){_0x133798=_0x133798||0x1f4;return function(_0x26c26f){logger[_0x2f7b('0x30')](_0x26c26f[_0x2f7b('0x31')]);if(_0x26c26f[_0x2f7b('0x32')]){delete _0x26c26f[_0x2f7b('0x32')];}_0x9bf55d['status'](_0x133798)[_0x2f7b('0x33')](_0x26c26f);};}exports[_0x2f7b('0x34')]=function(_0x5cfaf9,_0xa739e9){var _0x4e12d2={},_0x2ca6df={},_0x2f340d={'count':0x0,'rows':[]};var _0x5c9354=_['map'](db[_0x2f7b('0x35')]['rawAttributes'],function(_0x4785bf){return{'name':_0x4785bf['fieldName'],'type':_0x4785bf[_0x2f7b('0x36')][_0x2f7b('0x37')]};});_0x2ca6df[_0x2f7b('0x38')]=_['map'](_0x5c9354,_0x2f7b('0x32'));_0x2ca6df[_0x2f7b('0x39')]=_[_0x2f7b('0x3a')](_0x5cfaf9['query']);_0x2ca6df[_0x2f7b('0x3b')]=_[_0x2f7b('0x3c')](_0x2ca6df['model'],_0x2ca6df['query']);_0x4e12d2['attributes']=_[_0x2f7b('0x3c')](_0x2ca6df[_0x2f7b('0x38')],qs[_0x2f7b('0x3d')](_0x5cfaf9[_0x2f7b('0x39')][_0x2f7b('0x3d')]));_0x4e12d2[_0x2f7b('0x3e')]=_0x4e12d2[_0x2f7b('0x3e')][_0x2f7b('0x3f')]?_0x4e12d2[_0x2f7b('0x3e')]:_0x2ca6df[_0x2f7b('0x38')];if(!_0x5cfaf9['query'][_0x2f7b('0x40')]('nolimit')){_0x4e12d2[_0x2f7b('0x24')]=qs['limit'](_0x5cfaf9[_0x2f7b('0x39')]['limit']);_0x4e12d2['offset']=qs[_0x2f7b('0x21')](_0x5cfaf9[_0x2f7b('0x39')][_0x2f7b('0x21')]);}_0x4e12d2['order']=qs[_0x2f7b('0x41')](_0x5cfaf9[_0x2f7b('0x39')][_0x2f7b('0x41')]);_0x4e12d2[_0x2f7b('0x42')]=qs[_0x2f7b('0x3b')](_[_0x2f7b('0x43')](_0x5cfaf9[_0x2f7b('0x39')],_0x2ca6df[_0x2f7b('0x3b')]),_0x5c9354);if(_0x5cfaf9[_0x2f7b('0x39')][_0x2f7b('0x44')]){_0x4e12d2['where']=_['merge'](_0x4e12d2['where'],{'$or':_[_0x2f7b('0x45')](_0x5c9354,function(_0x37ca41){if(_0x37ca41[_0x2f7b('0x36')]!==_0x2f7b('0x46')){var _0x373959={};_0x373959[_0x37ca41[_0x2f7b('0x32')]]={'$like':'%'+_0x5cfaf9[_0x2f7b('0x39')]['filter']+'%'};return _0x373959;}})});}_0x4e12d2=_[_0x2f7b('0x47')]({},_0x4e12d2,_0x5cfaf9[_0x2f7b('0x48')]);var _0x5db9f1={'where':_0x4e12d2['where']};return db[_0x2f7b('0x35')][_0x2f7b('0x23')](_0x5db9f1)[_0x2f7b('0x2b')](function(_0x26e515){_0x2f340d[_0x2f7b('0x23')]=_0x26e515;if(_0x5cfaf9[_0x2f7b('0x39')]['includeAll']){_0x4e12d2['include']=[{'all':!![]}];}return db[_0x2f7b('0x35')][_0x2f7b('0x49')](_0x4e12d2);})[_0x2f7b('0x2b')](function(_0x16b593){_0x2f340d[_0x2f7b('0x4a')]=_0x16b593;return _0x2f340d;})[_0x2f7b('0x2b')](respondWithFilteredResult(_0xa739e9,_0x4e12d2))[_0x2f7b('0x4b')](handleError(_0xa739e9,null));};exports[_0x2f7b('0x4c')]=function(_0x47060c,_0xa1d514){var _0x2828da={'raw':!![],'where':{'id':_0x47060c[_0x2f7b('0x4d')]['id']}},_0xa967c2={};_0xa967c2['model']=_['keys'](db[_0x2f7b('0x35')][_0x2f7b('0x4e')]);_0xa967c2[_0x2f7b('0x39')]=_[_0x2f7b('0x3a')](_0x47060c['query']);_0xa967c2[_0x2f7b('0x3b')]=_['intersection'](_0xa967c2['model'],_0xa967c2[_0x2f7b('0x39')]);_0x2828da[_0x2f7b('0x3e')]=_[_0x2f7b('0x3c')](_0xa967c2[_0x2f7b('0x38')],qs[_0x2f7b('0x3d')](_0x47060c[_0x2f7b('0x39')]['fields']));_0x2828da['attributes']=_0x2828da[_0x2f7b('0x3e')][_0x2f7b('0x3f')]?_0x2828da['attributes']:_0xa967c2[_0x2f7b('0x38')];if(_0x47060c[_0x2f7b('0x39')][_0x2f7b('0x4f')]){_0x2828da['include']=[{'all':!![]}];}_0x2828da=_[_0x2f7b('0x47')]({},_0x2828da,_0x47060c[_0x2f7b('0x48')]);return db[_0x2f7b('0x35')][_0x2f7b('0x50')](_0x2828da)[_0x2f7b('0x2b')](handleEntityNotFound(_0xa1d514,null))[_0x2f7b('0x2b')](respondWithResult(_0xa1d514,null))[_0x2f7b('0x4b')](handleError(_0xa1d514,null));};exports[_0x2f7b('0x51')]=function(_0x20b81b,_0x26f55e,_0x1eaeec){return db['Plugin'][_0x2f7b('0x50')]({'where':{'id':_0x20b81b['params']['id']},'attributes':[_0x2f7b('0x32'),_0x2f7b('0x5')],'raw':!![]})[_0x2f7b('0x2b')](handleEntityNotFound(_0x26f55e,null))[_0x2f7b('0x2b')](function(_0x1fc73a){if(_0x1fc73a){var _0x59f772=path['join'](config[_0x2f7b('0x52')],_0x2f7b('0x53'),util['format'](_0x2f7b('0x54'),path[_0x2f7b('0x55')](_0x1fc73a['path'])));var _0x7e48f9=fs[_0x2f7b('0x56')](_0x59f772);var _0x5f2a75=archiver(_0x2f7b('0x57'),{'zlib':{'level':0x9}});_0x5f2a75['on'](_0x2f7b('0x58'),function(_0x23d934){if(_0x23d934[_0x2f7b('0x59')]===_0x2f7b('0x5a')){logger[_0x2f7b('0x30')](_0x23d934);}else{throw new db[(_0x2f7b('0x5b'))]['Error'](_0x2f7b('0x5c'));}});_0x5f2a75['on'](_0x2f7b('0x30'),function(_0x433fe0){throw new db[(_0x2f7b('0x5b'))][(_0x2f7b('0x5d'))](_0x2f7b('0x5c'));});_0x5f2a75[_0x2f7b('0x5e')](_0x7e48f9);_0x5f2a75['glob'](_0x2f7b('0x5f'),{'cwd':path['join'](config[_0x2f7b('0x52')],'server/files/plugins',path['dirname'](_0x1fc73a[_0x2f7b('0x5')])),'ignore':[path[_0x2f7b('0x60')](path[_0x2f7b('0x55')](_0x1fc73a[_0x2f7b('0x5')]),_0x2f7b('0x61')),path[_0x2f7b('0x60')](path['basename'](_0x1fc73a['path']),_0x2f7b('0x62'))],'nodir':!![]})[_0x2f7b('0x63')]();_0x7e48f9['on']('close',function(){if(!fs['existsSync'](_0x59f772)){throw new db['Sequelize'][(_0x2f7b('0x5d'))]('Plugin\x20not\x20found');}return _0x26f55e[_0x2f7b('0x51')](_0x59f772,util[_0x2f7b('0x64')]('%s.zip',path[_0x2f7b('0x55')](_0x1fc73a[_0x2f7b('0x5')])),function(_0x161385){if(_0x161385){throw new db[(_0x2f7b('0x5b'))][(_0x2f7b('0x5d'))](_0x2f7b('0x65'));}fs[_0x2f7b('0x66')](_0x59f772);logger[_0x2f7b('0x67')](_0x2f7b('0x68'));logger[_0x2f7b('0x67')](_0x2f7b('0x69'));});});}return null;})[_0x2f7b('0x4b')](handleError(_0x26f55e,null));};exports['upload']=function(_0x11715f,_0x590e6b,_0x42df59){var _0x375397=path[_0x2f7b('0x55')](_0x11715f[_0x2f7b('0x6a')][_0x2f7b('0x6b')],path[_0x2f7b('0x6c')](_0x11715f['file'][_0x2f7b('0x6b')]));var _0x4b907d=path[_0x2f7b('0x60')](config[_0x2f7b('0x52')],_0x2f7b('0x53'),_0x11715f[_0x2f7b('0x6a')]['filename']);var _0x578808=path[_0x2f7b('0x60')](config[_0x2f7b('0x52')],'server/files/plugins',_0x375397);logger['info'](_0x2f7b('0x6d'),_0x4b907d);logger[_0x2f7b('0x67')](_0x2f7b('0x6e'),_0x578808);try{fs[_0x2f7b('0x6f')](_0x4b907d,parseInt(_0x2f7b('0x70'),0x8));extract(_0x4b907d,{'dir':_0x578808},function(_0x47bb07){if(_0x47bb07){logger[_0x2f7b('0x30')](_0x47bb07);handleError(_0x47bb07,!![]);};var _0x1b0dfe=fs[_0x2f7b('0x71')](_0x578808);if(_0x1b0dfe[_0x2f7b('0x3f')]>0x1){removeReferences(_0x4b907d,_0x578808);logger[_0x2f7b('0x30')](_0x2f7b('0x72'));return _0x42df59(new Error(_0x2f7b('0x72')));}var _0x331825=fs['lstatSync'](path[_0x2f7b('0x60')](_0x578808,_0x1b0dfe[0x0]));if(_0x331825[_0x2f7b('0x73')]()){removeReferences(_0x4b907d,_0x578808);logger[_0x2f7b('0x30')](_0x2f7b('0x72'));return _0x42df59(new Error('Invalid\x20plugin\x20structure'));}if(_0x331825[_0x2f7b('0x74')]()){var _0x33a8aa=fs[_0x2f7b('0x71')](path[_0x2f7b('0x60')](_0x578808,_0x1b0dfe[0x0]));if(_0x33a8aa[_0x2f7b('0x3f')]===0x0){removeReferences(_0x4b907d,_0x578808);logger[_0x2f7b('0x30')]('Invalid\x20plugin\x20structure');return _0x42df59(new Error(_0x2f7b('0x72')));}var _0x1c8069=_0x33a8aa['some'](function(_0x4c7490){return _0x4c7490===_0x2f7b('0x75');});if(!_0x1c8069){return _0x42df59(new Error(_0x2f7b('0x76')));}var _0x26d739=fs[_0x2f7b('0x77')](path[_0x2f7b('0x60')](_0x578808,_0x1b0dfe[0x0],_0x2f7b('0x75')));var _0x2fa32e=JSON[_0x2f7b('0x78')](_0x26d739);if(_0x2f7b('0x22')==typeof _0x2fa32e[_0x2f7b('0x32')]){return _0x42df59(new Error(_0x2f7b('0x79')));}if(_0x2f7b('0x22')==typeof _0x2fa32e[_0x2f7b('0x36')]){return _0x42df59(new Error(_0x2f7b('0x7a')));}if(_0x2f7b('0x22')==typeof _0x2fa32e['version']){return _0x42df59(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x2fa32e[_0x2f7b('0x7b')]){return _0x42df59(new Error(_0x2f7b('0x7c')));}if(_0x2fa32e[_0x2f7b('0x36')]==='html'){if(_0x2f7b('0x22')==typeof _0x2fa32e[_0x2f7b('0x7b')]['views']){return _0x42df59(new Error(_0x2f7b('0x7d')));}if(_0x2f7b('0x22')==typeof _0x2fa32e['parameters'][_0x2f7b('0x7e')]['admin']&&_0x2f7b('0x22')==typeof _0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x7e')][_0x2f7b('0x7f')]){return _0x42df59(new Error(_0x2f7b('0x80')));}}else if(_0x2fa32e['type']===_0x2f7b('0x81')){if(_0x2f7b('0x22')==typeof _0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x82')]){return _0x42df59(new Error(_0x2f7b('0x83')));}if(_0x2f7b('0x22')==typeof _0x2fa32e['parameters'][_0x2f7b('0x84')]){return _0x42df59(new Error(_0x2f7b('0x85')));}}else{return _0x42df59(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4653b9=_0x2fa32e[_0x2f7b('0x32')];var _0x2992f7=_0x2fa32e['description'];var _0x262f73=_0x2fa32e[_0x2f7b('0x36')];var _0x2baab=_0x2fa32e[_0x2f7b('0x86')]?_0x2fa32e[_0x2f7b('0x86')]:_0x2f7b('0x87');var _0x1c3ddb=_0x2fa32e[_0x2f7b('0x88')]?_0x2fa32e['icon']:_0x2f7b('0x89');var _0x5159bd='';var _0x28592c='';var _0x2794f6='';var _0x4da7f6='';var _0x35921f=_0x2fa32e[_0x2f7b('0x8a')];if(_0x262f73==='html'){if('undefined'!=typeof _0x2fa32e['parameters'][_0x2f7b('0x7e')]['admin']){var _0x15e09e=_0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x7e')][_0x2f7b('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x2f7b('0x8c')](_0x15e09e)){_0x5159bd=path['join'](_0x2f7b('0x8d'),_0x375397,_0x1b0dfe[0x0],_0x15e09e);}else{_0x5159bd=_0x15e09e;}}else{logger[_0x2f7b('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x2f7b('0x22')!=typeof _0x2fa32e['parameters']['views'][_0x2f7b('0x7f')]){var _0x475662=_0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x2f7b('0x8c')](_0x475662)){_0x28592c=path['join']('plugins',_0x375397,_0x1b0dfe[0x0],_0x475662);}else{_0x28592c=_0x475662;}}else{logger[_0x2f7b('0x67')](_0x2f7b('0x8e'));}}else if(_0x262f73==='script'){_0x2794f6=_0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x82')];_0x4da7f6=_0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x84')];if(_0x2f7b('0x22')!=typeof _0x2fa32e['parameters']['views']){if('undefined'!=typeof _0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x7e')][_0x2f7b('0x8b')]){var _0x15e09e=_0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x7e')][_0x2f7b('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x2f7b('0x8c')](_0x15e09e)){_0x5159bd=path[_0x2f7b('0x60')](_0x2f7b('0x8d'),_0x375397,_0x1b0dfe[0x0],_0x15e09e);}else{_0x5159bd=_0x15e09e;}}if(_0x2f7b('0x22')!=typeof _0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x7e')]['agent']){var _0x475662=_0x2fa32e[_0x2f7b('0x7b')][_0x2f7b('0x7e')][_0x2f7b('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x2f7b('0x8c')](_0x475662)){_0x28592c=path['join']('plugins',_0x375397,_0x1b0dfe[0x0],_0x475662);}else{_0x28592c=_0x475662;}}}}var _0x4a4e03={'name':_0x4653b9,'description':_0x2992f7,'path':path[_0x2f7b('0x60')](_0x375397,_0x1b0dfe[0x0]),'type':_0x262f73,'sidebar':_0x2baab,'icon':_0x1c3ddb,'adminUrl':_0x5159bd,'agentUrl':_0x28592c,'scriptName':_0x2794f6,'scriptPath':_0x4da7f6,'version':_0x35921f};removeReferences(_0x4b907d,null);return db['Plugin'][_0x2f7b('0x8f')](_0x4a4e03)[_0x2f7b('0x2b')](function(_0x373255){var _0x3944dd={'role':_0x11715f[_0x2f7b('0x90')]['role'],'userProfileId':_0x11715f[_0x2f7b('0x90')][_0x2f7b('0x91')]};if(!_0x3944dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3944dd[_0x2f7b('0x92')]===_0x2f7b('0x93')){var _0x2356fe=_0x373255['get']({'plain':!![]});return db[_0x2f7b('0x94')][_0x2f7b('0x50')]({'where':{'name':_0x2f7b('0x2e'),'userProfileId':_0x3944dd[_0x2f7b('0x91')]},'raw':!![]})[_0x2f7b('0x2b')](function(_0x21bcff){if(_0x21bcff&&_0x21bcff[_0x2f7b('0x95')]===0x0){return db[_0x2f7b('0x2f')][_0x2f7b('0x8f')]({'name':_0x2356fe['name'],'resourceId':_0x2356fe['id'],'type':_0x21bcff[_0x2f7b('0x32')],'sectionId':_0x21bcff['id']},{})[_0x2f7b('0x2b')](function(){return _0x373255;});}else{return _0x373255;}})['catch'](function(_0x331a59){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x331a59);throw _0x331a59;});}return _0x373255;})['then'](respondWithResult(_0x590e6b,null))['catch'](handleError(_0x590e6b,null));}});}catch(_0x5c77a4){_0x590e6b[_0x2f7b('0x20')](0x1f4)['send'](_0x5c77a4);}};function removeReferences(_0x2304af,_0x592e13){try{if(_0x2304af){fs[_0x2f7b('0x66')](_0x2304af);logger['info'](_0x2f7b('0x96'));}if(_0x592e13){rimraf(_0x592e13,function(){});logger[_0x2f7b('0x67')](_0x2f7b('0x97'));}}catch(_0xb511ca){logger[_0x2f7b('0x30')](_0xb511ca);}}exports[_0x2f7b('0x2a')]=function(_0x1ff7b9,_0x2951a9,_0x2ced45){return db[_0x2f7b('0x35')][_0x2f7b('0x50')]({'where':{'id':_0x1ff7b9['params']['id']}})['then'](handleEntityNotFound(_0x2951a9,null))['then'](saveUpdates(_0x1ff7b9[_0x2f7b('0x90')],null))['then'](respondWithResult(_0x2951a9,null))[_0x2f7b('0x4b')](handleError(_0x2951a9,null));};exports[_0x2f7b('0x98')]=function(_0x4ac19e,_0x4f5c5f,_0x3fd92b){return db[_0x2f7b('0x35')]['find']({'where':{'id':_0x4ac19e[_0x2f7b('0x4d')]['id']}})[_0x2f7b('0x2b')](function(_0xda445b){if(_0xda445b){return _0xda445b[_0x2f7b('0x2c')]();}})[_0x2f7b('0x2b')](function(_0x3950c7){rimraf(path[_0x2f7b('0x60')](config['root'],_0x2f7b('0x53'),path['dirname'](_0x3950c7[_0x2f7b('0x5')])),function(){});return _0x3950c7;})[_0x2f7b('0x2b')](handleEntityNotFound(_0x4f5c5f,null))['then'](respondWithStatusCode(_0x4f5c5f,null))[_0x2f7b('0x4b')](handleError(_0x4f5c5f,null));};exports[_0x2f7b('0x99')]=function(_0xcf7b8e,_0x381c6d,_0x472b62){return BPromise[_0x2f7b('0x9a')]()[_0x2f7b('0x2b')](function(){if(!_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x5')]){throw new Error(_0x2f7b('0x9b'));}if(!_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x9c')]){throw new Error(_0x2f7b('0x9d'));}var _0x2581de=_0xcf7b8e['query']['hostname']?_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x9e')]+':'+_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x9c')]:'http://localhost:'+_0xcf7b8e[_0x2f7b('0x39')]['port'];var _0xec7d30=_0xcf7b8e[_0x2f7b('0x39')]['json']?_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x27')]:!![];var _0x30364a=_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x9f')]?_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x9f')]:null;var _0x31c82a={'method':_0xcf7b8e['method'],'uri':util[_0x2f7b('0x64')](_0x2f7b('0xa0'),_0x2581de,_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x5')]),'json':_0xec7d30,'resolveWithFullResponse':!![],'encoding':_0x30364a,'qs':_0xcf7b8e[_0x2f7b('0x39')]};if(_0xcf7b8e[_0x2f7b('0xa1')]){_0x31c82a[_0x2f7b('0xa1')]=_0xcf7b8e['headers'];if(_0x31c82a[_0x2f7b('0xa1')][_0x2f7b('0xa2')]){delete _0x31c82a[_0x2f7b('0xa1')][_0x2f7b('0xa2')];}}if(_0x31c82a[_0x2f7b('0xa1')][_0x2f7b('0xa3')]){delete _0x31c82a[_0x2f7b('0xa1')][_0x2f7b('0xa3')];}return rp(_0x31c82a);})[_0x2f7b('0x2b')](function(_0x4c88f9){if(_0x4c88f9){_0x381c6d[_0x2f7b('0x25')](_0x4c88f9[_0x2f7b('0xa1')]);logger[_0x2f7b('0x67')](_0x4c88f9[_0x2f7b('0x90')]);if(_[_0x2f7b('0xa4')](_0xcf7b8e[_0x2f7b('0x39')][_0x2f7b('0x5')],'download')&&_0x4c88f9[_0x2f7b('0xa5')]==0x1f4){return _0x381c6d[_0x2f7b('0x1e')](_0x4c88f9[_0x2f7b('0xa5')]);}else{return _0x381c6d[_0x2f7b('0x20')](_0x4c88f9[_0x2f7b('0xa5')])[_0x2f7b('0x33')](_0x4c88f9[_0x2f7b('0x90')]);}}else{return _0x381c6d[_0x2f7b('0x1e')](0xc8);}})['catch'](handleError(_0x381c6d,null));};exports[_0x2f7b('0xa6')]=function(_0x4ada75,_0x41ae1b,_0x38e231){return BPromise[_0x2f7b('0x9a')]()['then'](function(){if(!_0x4ada75[_0x2f7b('0x39')]['path']){throw new Error(_0x2f7b('0x9b'));}if(!_0x4ada75['query'][_0x2f7b('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x76e6c1=_0x4ada75[_0x2f7b('0x39')][_0x2f7b('0x9e')]?_0x4ada75[_0x2f7b('0x39')][_0x2f7b('0x9e')]+':'+_0x4ada75['query'][_0x2f7b('0x9c')]:_0x2f7b('0xa7')+_0x4ada75[_0x2f7b('0x39')]['port'];var _0x30bbb5=_0x4ada75['query'][_0x2f7b('0x27')]?_0x4ada75['query'][_0x2f7b('0x27')]:!![];var _0x21a083=_0x4ada75[_0x2f7b('0x39')][_0x2f7b('0x9f')]?_0x4ada75[_0x2f7b('0x39')][_0x2f7b('0x9f')]:null;var _0x3b9845={'method':_0x4ada75[_0x2f7b('0xa8')],'uri':util[_0x2f7b('0x64')]('%s%s',_0x76e6c1,_0x4ada75['query'][_0x2f7b('0x5')]),'json':_0x30bbb5,'resolveWithFullResponse':!![],'encoding':_0x21a083,'body':_0x4ada75[_0x2f7b('0x90')]};if(_0x4ada75[_0x2f7b('0xa1')]){_0x3b9845[_0x2f7b('0xa1')]=_0x4ada75[_0x2f7b('0xa1')];if(_0x3b9845[_0x2f7b('0xa1')][_0x2f7b('0xa2')]){delete _0x3b9845[_0x2f7b('0xa1')][_0x2f7b('0xa2')];}}if(_0x3b9845[_0x2f7b('0xa1')]['content-type']){delete _0x3b9845[_0x2f7b('0xa1')]['content-type'];}return rp(_0x3b9845);})[_0x2f7b('0x2b')](function(_0x24c058){if(_0x24c058){_0x41ae1b[_0x2f7b('0x25')](_0x24c058[_0x2f7b('0xa1')]);logger[_0x2f7b('0x67')](_0x24c058['body']);return _0x41ae1b['status'](_0x24c058[_0x2f7b('0xa5')])[_0x2f7b('0x33')](_0x24c058[_0x2f7b('0x90')]);}else{return _0x41ae1b[_0x2f7b('0x1e')](0xc8);}})[_0x2f7b('0x4b')](handleError(_0x41ae1b,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 18071ad..7b0675f 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b47=['update','remove','emit','exports','events','Plugin','setMaxListeners','save'];(function(_0x29fdef,_0x4e3ffe){var _0x567b8b=function(_0x44ab82){while(--_0x44ab82){_0x29fdef['push'](_0x29fdef['shift']());}};_0x567b8b(++_0x4e3ffe);}(_0x4b47,0x1b4));var _0x74b4=function(_0x5f35c1,_0x618cd8){_0x5f35c1=_0x5f35c1-0x0;var _0x5b3df3=_0x4b47[_0x5f35c1];return _0x5b3df3;};'use strict';var EventEmitter=require(_0x74b4('0x0'));var Plugin=require('../../mysqldb')['db'][_0x74b4('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x74b4('0x2')](0x0);var events={'afterCreate':_0x74b4('0x3'),'afterUpdate':_0x74b4('0x4'),'afterDestroy':_0x74b4('0x5')};function emitEvent(_0x2795e9){return function(_0x565f6b,_0x4ed4fe,_0x27ddaf){PluginEvents[_0x74b4('0x6')](_0x2795e9+':'+_0x565f6b['id'],_0x565f6b);PluginEvents['emit'](_0x2795e9,_0x565f6b);_0x27ddaf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x74b4('0x7')]=PluginEvents; \ No newline at end of file +var _0xd7c3=['remove','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x5a8316,_0x36874b){var _0x325d0b=function(_0x1ea7c5){while(--_0x1ea7c5){_0x5a8316['push'](_0x5a8316['shift']());}};_0x325d0b(++_0x36874b);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x1b2ea1,_0x2f13c4){_0x1b2ea1=_0x1b2ea1-0x0;var _0x30c070=_0xd7c3[_0x1b2ea1];return _0x30c070;};'use strict';var EventEmitter=require(_0x3d7c('0x0'));var Plugin=require(_0x3d7c('0x1'))['db'][_0x3d7c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3d7c('0x3')](0x0);var events={'afterCreate':_0x3d7c('0x4'),'afterUpdate':_0x3d7c('0x5'),'afterDestroy':_0x3d7c('0x6')};function emitEvent(_0x17c96a){return function(_0x22396c,_0x538ca7,_0x2da8b6){PluginEvents['emit'](_0x17c96a+':'+_0x22396c['id'],_0x22396c);PluginEvents['emit'](_0x17c96a,_0x22396c);_0x2da8b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x3d7c('0x7')](e,emitEvent(event));}}module[_0x3d7c('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index dd8d3d3..bc524bb 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3519=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Plugin','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3519,0x99));var _0x9351=function(_0x5184d1,_0x12d323){_0x5184d1=_0x5184d1-0x0;var _0x1a8857=_0x3519[_0x5184d1];return _0x1a8857;};'use strict';var _=require(_0x9351('0x0'));var util=require(_0x9351('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9351('0x2'));var BPromise=require(_0x9351('0x3'));var rp=require(_0x9351('0x4'));var fs=require('fs');var path=require(_0x9351('0x5'));var rimraf=require(_0x9351('0x6'));var config=require(_0x9351('0x7'));var attributes=require('./plugin.attributes');module[_0x9351('0x8')]=function(_0x4760b5,_0x59a6a8){return _0x4760b5[_0x9351('0x9')](_0x9351('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x475e=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Plugin'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x475e,0xd0));var _0xe475=function(_0x3a433d,_0xce7a35){_0x3a433d=_0x3a433d-0x0;var _0x12b284=_0x475e[_0x3a433d];return _0x12b284;};'use strict';var _=require(_0xe475('0x0'));var util=require(_0xe475('0x1'));var logger=require(_0xe475('0x2'))(_0xe475('0x3'));var moment=require(_0xe475('0x4'));var BPromise=require(_0xe475('0x5'));var rp=require(_0xe475('0x6'));var fs=require('fs');var path=require(_0xe475('0x7'));var rimraf=require(_0xe475('0x8'));var config=require(_0xe475('0x9'));var attributes=require('./plugin.attributes');module[_0xe475('0xa')]=function(_0x162a0b,_0x2e1815){return _0x162a0b[_0xe475('0xb')](_0xe475('0xc'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a1a278b..4a9e65e 100644 --- a/server/api/plugin/plugin.rpc.js +++ b/server/api/plugin/plugin.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d4d=['socket.io-emitter','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis'];(function(_0x4b90b3,_0x164fb2){var _0x45472e=function(_0x4580d3){while(--_0x4580d3){_0x4b90b3['push'](_0x4b90b3['shift']());}};_0x45472e(++_0x164fb2);}(_0x8d4d,0x14b));var _0xd8d4=function(_0x47bc3a,_0x10898e){_0x47bc3a=_0x47bc3a-0x0;var _0x52f53d=_0x8d4d[_0x47bc3a];return _0x52f53d;};'use strict';var _=require('lodash');var util=require(_0xd8d4('0x0'));var moment=require('moment');var BPromise=require(_0xd8d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8d4('0x2'));var db=require(_0xd8d4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8d4('0x4'));var config=require(_0xd8d4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd8d4('0x6')][_0xd8d4('0x7')]({'port':0x232a});config['redis']=_[_0xd8d4('0x8')](config[_0xd8d4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8d4('0xa'))(new Redis(config[_0xd8d4('0x9')]));require('./plugin.socket')[_0xd8d4('0xb')](socket);function respondWithRpcPromise(_0x4edb89,_0x5caff0,_0x23ce43){return new BPromise(function(_0x509a99,_0x22df84){return client[_0xd8d4('0xc')](_0x4edb89,_0x23ce43)[_0xd8d4('0xd')](function(_0x14b23b){logger[_0xd8d4('0xe')]('Plugin,\x20%s,\x20%s',_0x5caff0,_0xd8d4('0xf'));logger[_0xd8d4('0x10')](_0xd8d4('0x11'),_0x5caff0,_0xd8d4('0xf'),JSON[_0xd8d4('0x12')](_0x14b23b));if(_0x14b23b[_0xd8d4('0x13')]){if(_0x14b23b[_0xd8d4('0x13')][_0xd8d4('0x14')]===0x1f4){logger[_0xd8d4('0x13')](_0xd8d4('0x15'),_0x5caff0,_0x14b23b[_0xd8d4('0x13')][_0xd8d4('0x16')]);return _0x22df84(_0x14b23b[_0xd8d4('0x13')][_0xd8d4('0x16')]);}logger[_0xd8d4('0x13')]('Plugin,\x20%s,\x20%s',_0x5caff0,_0x14b23b[_0xd8d4('0x13')][_0xd8d4('0x16')]);return _0x509a99(_0x14b23b[_0xd8d4('0x13')][_0xd8d4('0x16')]);}else{logger[_0xd8d4('0xe')](_0xd8d4('0x15'),_0x5caff0,_0xd8d4('0xf'));_0x509a99(_0x14b23b[_0xd8d4('0x17')]['message']);}})[_0xd8d4('0x18')](function(_0x3829b3){logger['error'](_0xd8d4('0x15'),_0x5caff0,_0x3829b3);_0x22df84(_0x3829b3);});});}exports['CreatePlugin']=function(_0xee1f13){var _0x168bc4=this;return new Promise(function(_0x3da2c2,_0x541ca1){return db[_0xd8d4('0x19')][_0xd8d4('0x1a')](_0xee1f13[_0xd8d4('0x1b')],{'raw':_0xee1f13[_0xd8d4('0x1c')]?_0xee1f13[_0xd8d4('0x1c')][_0xd8d4('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3b48ca){logger['info']('CreatePlugin',_0xee1f13);logger['debug'](_0xd8d4('0x1e'),_0xee1f13,JSON[_0xd8d4('0x12')](_0x3b48ca));_0x3da2c2(_0x3b48ca);})[_0xd8d4('0x18')](function(_0x26472c){logger[_0xd8d4('0x13')](_0xd8d4('0x1e'),_0x26472c[_0xd8d4('0x16')],_0xee1f13);_0x541ca1(_0x168bc4[_0xd8d4('0x13')](0x1f4,_0x26472c[_0xd8d4('0x16')]));});});}; \ No newline at end of file +var _0xeaa2=['http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','then','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xeaa2,0x115));var _0x2eaa=function(_0x5cb634,_0x3fd713){_0x5cb634=_0x5cb634-0x0;var _0x2369f6=_0xeaa2[_0x5cb634];return _0x2369f6;};'use strict';var _=require(_0x2eaa('0x0'));var util=require(_0x2eaa('0x1'));var moment=require(_0x2eaa('0x2'));var BPromise=require(_0x2eaa('0x3'));var rs=require(_0x2eaa('0x4'));var fs=require('fs');var Redis=require(_0x2eaa('0x5'));var db=require(_0x2eaa('0x6'))['db'];var utils=require(_0x2eaa('0x7'));var logger=require(_0x2eaa('0x8'))(_0x2eaa('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2eaa('0xa')][_0x2eaa('0xb')]({'port':0x232a});config[_0x2eaa('0xc')]=_[_0x2eaa('0xd')](config[_0x2eaa('0xc')],{'host':_0x2eaa('0xe'),'port':0x18eb});var socket=require(_0x2eaa('0xf'))(new Redis(config[_0x2eaa('0xc')]));require(_0x2eaa('0x10'))[_0x2eaa('0x11')](socket);function respondWithRpcPromise(_0x3d7af7,_0x5226a4,_0x1db493){return new BPromise(function(_0x2f144e,_0x5db7be){return client[_0x2eaa('0x12')](_0x3d7af7,_0x1db493)['then'](function(_0x1a6576){logger[_0x2eaa('0x13')](_0x2eaa('0x14'),_0x5226a4,'request\x20sent');logger[_0x2eaa('0x15')](_0x2eaa('0x16'),_0x5226a4,_0x2eaa('0x17'),JSON[_0x2eaa('0x18')](_0x1a6576));if(_0x1a6576[_0x2eaa('0x19')]){if(_0x1a6576[_0x2eaa('0x19')][_0x2eaa('0x1a')]===0x1f4){logger[_0x2eaa('0x19')](_0x2eaa('0x14'),_0x5226a4,_0x1a6576[_0x2eaa('0x19')][_0x2eaa('0x1b')]);return _0x5db7be(_0x1a6576[_0x2eaa('0x19')][_0x2eaa('0x1b')]);}logger[_0x2eaa('0x19')]('Plugin,\x20%s,\x20%s',_0x5226a4,_0x1a6576[_0x2eaa('0x19')][_0x2eaa('0x1b')]);return _0x2f144e(_0x1a6576[_0x2eaa('0x19')][_0x2eaa('0x1b')]);}else{logger[_0x2eaa('0x13')](_0x2eaa('0x14'),_0x5226a4,_0x2eaa('0x17'));_0x2f144e(_0x1a6576[_0x2eaa('0x1c')][_0x2eaa('0x1b')]);}})[_0x2eaa('0x1d')](function(_0x49bae3){logger[_0x2eaa('0x19')]('Plugin,\x20%s,\x20%s',_0x5226a4,_0x49bae3);_0x5db7be(_0x49bae3);});});}exports['CreatePlugin']=function(_0x257f32){var _0x170670=this;return new Promise(function(_0x4a0e9e,_0x3323a8){return db['Plugin'][_0x2eaa('0x1e')](_0x257f32[_0x2eaa('0x1f')],{'raw':_0x257f32[_0x2eaa('0x20')]?_0x257f32['options'][_0x2eaa('0x21')]===undefined?!![]:![]:!![]})[_0x2eaa('0x22')](function(_0x2e2e34){logger[_0x2eaa('0x13')](_0x2eaa('0x23'),_0x257f32);logger[_0x2eaa('0x15')](_0x2eaa('0x23'),_0x257f32,JSON[_0x2eaa('0x18')](_0x2e2e34));_0x4a0e9e(_0x2e2e34);})[_0x2eaa('0x1d')](function(_0x1c62c0){logger[_0x2eaa('0x19')](_0x2eaa('0x23'),_0x1c62c0[_0x2eaa('0x1b')],_0x257f32);_0x3323a8(_0x170670[_0x2eaa('0x19')](0x1f4,_0x1c62c0[_0x2eaa('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 024061e..33fefc1 100644 --- a/server/api/plugin/plugin.socket.js +++ b/server/api/plugin/plugin.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a2c=['save','remove','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x515692,_0x1ab92a){var _0x99e8bd=function(_0x4c00f5){while(--_0x4c00f5){_0x515692['push'](_0x515692['shift']());}};_0x99e8bd(++_0x1ab92a);}(_0x0a2c,0x17f));var _0xc0a2=function(_0x13938b,_0x5ab134){_0x13938b=_0x13938b-0x0;var _0x4919f5=_0x0a2c[_0x13938b];return _0x4919f5;};'use strict';var PluginEvents=require(_0xc0a2('0x0'));var events=[_0xc0a2('0x1'),_0xc0a2('0x2'),'update'];function createListener(_0x4b92d1,_0x4a21de){return function(_0x9dfae9){_0x4a21de[_0xc0a2('0x3')](_0x4b92d1,_0x9dfae9);};}function removeListener(_0x5a4806,_0x579b4d){return function(){PluginEvents[_0xc0a2('0x4')](_0x5a4806,_0x579b4d);};}exports[_0xc0a2('0x5')]=function(_0x267ed5){for(var _0x1d56c1=0x0,_0x539021=events[_0xc0a2('0x6')];_0x1d56c1<_0x539021;_0x1d56c1++){var _0x379b62=events[_0x1d56c1];var _0x2a9c84=createListener(_0xc0a2('0x7')+_0x379b62,_0x267ed5);PluginEvents['on'](_0x379b62,_0x2a9c84);}}; \ No newline at end of file +var _0x4412=['emit','register','./plugin.events','save','remove','update'];(function(_0x41cc78,_0x29c9dc){var _0x28886f=function(_0x1076f5){while(--_0x1076f5){_0x41cc78['push'](_0x41cc78['shift']());}};_0x28886f(++_0x29c9dc);}(_0x4412,0xd4));var _0x2441=function(_0x81cc29,_0x225ff0){_0x81cc29=_0x81cc29-0x0;var _0x52a908=_0x4412[_0x81cc29];return _0x52a908;};'use strict';var PluginEvents=require(_0x2441('0x0'));var events=[_0x2441('0x1'),_0x2441('0x2'),_0x2441('0x3')];function createListener(_0x4dbfee,_0xbdbdc4){return function(_0x4f593e){_0xbdbdc4[_0x2441('0x4')](_0x4dbfee,_0x4f593e);};}function removeListener(_0x155dfb,_0x549aeb){return function(){PluginEvents['removeListener'](_0x155dfb,_0x549aeb);};}exports[_0x2441('0x5')]=function(_0x40d25a){for(var _0xab78a9=0x0,_0x4fa8aa=events['length'];_0xab78a9<_0x4fa8aa;_0xab78a9++){var _0x544548=events[_0xab78a9];var _0x3a8745=createListener('plugin:'+_0x544548,_0x40d25a);PluginEvents['on'](_0x544548,_0x3a8745);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 2f9f9c1..86468c4 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x1263cb,_0x2bc17d){var _0x37db1a=function(_0x1be185){while(--_0x1be185){_0x1263cb['push'](_0x1263cb['shift']());}};_0x37db1a(++_0x2bc17d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x4eff49,_0x37365e){var _0x55f220=function(_0x29cfa6){while(--_0x29cfa6){_0x4eff49['push'](_0x4eff49['shift']());}};_0x55f220(++_0x37365e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 754044a..360e465 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22fb=['reject','motion2','length','catch','describe','params','create','body','script','join','cwd','chdir','dirname','dump','update','restart','stop','delete','../../config/logger','path','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','index','list','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x22fb,0x192));var _0xb22f=function(_0xb622b8,_0x435f21){_0xb622b8=_0xb622b8-0x0;var _0x1450bf=_0x22fb[_0xb622b8];return _0x1450bf;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0xb22f('0x0'))('api');var path=require(_0xb22f('0x1'));var exec=require(_0xb22f('0x2'))[_0xb22f('0x3')];var BPromise=require(_0xb22f('0x4'));function handleEntityNotFound(_0x201512,_0x50cdab){return function(_0x44717d){if(!_0x44717d){_0x201512[_0xb22f('0x5')](0x194);;}return _0x44717d;};}function respondWithResult(_0x2d1fb3,_0xc3ffcc){_0xc3ffcc=_0xc3ffcc||0xc8;return function(_0x412a95){if(_0x412a95){return _0x2d1fb3[_0xb22f('0x6')](_0xc3ffcc)['json'](_0x412a95);}return null;};}function handleError(_0x34433b,_0x22c509){_0x22c509=_0x22c509||0x1f4;return function(_0x36e238){logger[_0xb22f('0x7')](_0x36e238[_0xb22f('0x8')]);if(_0x36e238[_0xb22f('0x9')]){delete _0x36e238[_0xb22f('0x9')];}_0x34433b[_0xb22f('0x6')](_0x22c509)[_0xb22f('0xa')](_0x36e238);};}function execChildProcess(){return new BPromise(function(_0x2676f3,_0x3473d4){exec('npm\x20install',function(_0x4b9e56,_0x5b2399,_0x1caf67){logger['info'](_0x5b2399);logger['info'](_0x1caf67);if(_0x4b9e56){logger['error'](_0x4b9e56);return _0x3473d4(_0x4b9e56);}return _0x2676f3(_0x5b2399);});});}exports[_0xb22f('0xb')]=function(_0x40fcf8,_0x4ae6bb){return pm2[_0xb22f('0xc')]()[_0xb22f('0xd')](function(_0x32d796){if(_0x32d796){var _0x5c6ccf=_[_0xb22f('0xe')](_0x32d796,function(_0x5f1590){return _0x5f1590[_0xb22f('0x9')]==='express'||_0x5f1590[_0xb22f('0x9')]===_0xb22f('0xf');});return{'rows':_0x5c6ccf,'count':_0x5c6ccf[_0xb22f('0x10')]};}return null;})[_0xb22f('0xd')](respondWithResult(_0x4ae6bb,null))[_0xb22f('0x11')](handleError(_0x4ae6bb,null));};exports['show']=function(_0x1530f7,_0x53a59b){return pm2[_0xb22f('0x12')](_0x1530f7[_0xb22f('0x13')]['id'])[_0xb22f('0xd')](respondWithResult(_0x53a59b,null))[_0xb22f('0xd')](handleEntityNotFound(_0x53a59b,null))[_0xb22f('0x11')](handleError(_0x53a59b,null));};exports[_0xb22f('0x14')]=function(_0x5c843b,_0x72994){if(_0x5c843b['body'][_0xb22f('0x9')]&&_0x5c843b[_0xb22f('0x15')][_0xb22f('0x16')]){var _0x2239b8=path[_0xb22f('0x17')](__dirname,'../../files/plugins',_0x5c843b['body'][_0xb22f('0x16')]);var _0x19e480=process[_0xb22f('0x18')]();process[_0xb22f('0x19')](path[_0xb22f('0x1a')](_0x2239b8));return execChildProcess()[_0xb22f('0xd')](function(_0x201764){process[_0xb22f('0x19')](_0x19e480);return pm2['start']({'name':_0x5c843b['body'][_0xb22f('0x9')],'script':_0x2239b8});})[_0xb22f('0xd')](function(_0x5e1b8c){pm2[_0xb22f('0x1b')]();return _0x5e1b8c[0x0];})[_0xb22f('0xd')](respondWithResult(_0x72994,0xc9))['catch'](handleError(_0x72994,null));}else{return _0x72994[_0xb22f('0x6')](0x1f4)[_0xb22f('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb22f('0x1c')]=function(_0x2c4a9e,_0xcddbca){if(_0x2c4a9e[_0xb22f('0x15')]['id']){delete _0x2c4a9e[_0xb22f('0x15')]['id'];}var _0x246a0c={'online':_0xb22f('0x1d'),'stopped':_0xb22f('0x1e')};if(_0x246a0c['hasOwnProperty'](_0x2c4a9e['body']['status'])){return pm2[_0x246a0c[_0x2c4a9e[_0xb22f('0x15')]['status']]](_0x2c4a9e[_0xb22f('0x13')]['id'])[_0xb22f('0xd')](respondWithResult(_0xcddbca,0xc8))[_0xb22f('0x11')](handleError(_0xcddbca,null));}else{return _0xcddbca[_0xb22f('0x6')](0x1f4)[_0xb22f('0xa')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x435690,_0x12c042){if(_0x435690[_0xb22f('0x15')]['id']){delete _0x435690[_0xb22f('0x15')]['id'];}if(_0x435690['params']['id']){return pm2[_0xb22f('0x1f')](_0x435690[_0xb22f('0x13')]['id'])['then'](function(_0x344c30){pm2[_0xb22f('0x1b')]();return _0x344c30[0x0];})[_0xb22f('0xd')](respondWithResult(_0x12c042,null))[_0xb22f('0x11')](handleError(_0x12c042,null));}else{return _0x12c042[_0xb22f('0x6')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x668b=['index','list','then','reject','express','motion2','length','show','describe','create','body','join','../../files/plugins','cwd','dirname','start','dump','catch','restart','stop','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','exec','status','json','error','stack','name','send','npm\x20install','info'];(function(_0x3a349e,_0x35c4af){var _0x3130ae=function(_0xfebce5){while(--_0xfebce5){_0x3a349e['push'](_0x3a349e['shift']());}};_0x3130ae(++_0x35c4af);}(_0x668b,0x140));var _0xb668=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x668b[_0x413b4d];return _0x8b810a;};'use strict';var _=require(_0xb668('0x0'));var pm2=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var path=require(_0xb668('0x3'));var exec=require('child_process')[_0xb668('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2fab11,_0x4092a6){return function(_0x2960f5){if(!_0x2960f5){_0x2fab11['sendStatus'](0x194);;}return _0x2960f5;};}function respondWithResult(_0x9b99a8,_0x296fa9){_0x296fa9=_0x296fa9||0xc8;return function(_0x3be92e){if(_0x3be92e){return _0x9b99a8[_0xb668('0x5')](_0x296fa9)[_0xb668('0x6')](_0x3be92e);}return null;};}function handleError(_0x3f01bc,_0x517fc5){_0x517fc5=_0x517fc5||0x1f4;return function(_0x11bb5e){logger[_0xb668('0x7')](_0x11bb5e[_0xb668('0x8')]);if(_0x11bb5e[_0xb668('0x9')]){delete _0x11bb5e[_0xb668('0x9')];}_0x3f01bc[_0xb668('0x5')](_0x517fc5)[_0xb668('0xa')](_0x11bb5e);};}function execChildProcess(){return new BPromise(function(_0x3616e9,_0x567ea9){exec(_0xb668('0xb'),function(_0x27dbf7,_0x27de15,_0x2ea5fc){logger[_0xb668('0xc')](_0x27de15);logger[_0xb668('0xc')](_0x2ea5fc);if(_0x27dbf7){logger[_0xb668('0x7')](_0x27dbf7);return _0x567ea9(_0x27dbf7);}return _0x3616e9(_0x27de15);});});}exports[_0xb668('0xd')]=function(_0x3e5be0,_0x25c5c5){return pm2[_0xb668('0xe')]()[_0xb668('0xf')](function(_0x3aed25){if(_0x3aed25){var _0xd0450f=_[_0xb668('0x10')](_0x3aed25,function(_0x3b0c84){return _0x3b0c84[_0xb668('0x9')]===_0xb668('0x11')||_0x3b0c84[_0xb668('0x9')]===_0xb668('0x12');});return{'rows':_0xd0450f,'count':_0xd0450f[_0xb668('0x13')]};}return null;})[_0xb668('0xf')](respondWithResult(_0x25c5c5,null))['catch'](handleError(_0x25c5c5,null));};exports[_0xb668('0x14')]=function(_0x567ad7,_0x30742a){return pm2[_0xb668('0x15')](_0x567ad7['params']['id'])[_0xb668('0xf')](respondWithResult(_0x30742a,null))[_0xb668('0xf')](handleEntityNotFound(_0x30742a,null))['catch'](handleError(_0x30742a,null));};exports[_0xb668('0x16')]=function(_0x5b31ab,_0x12fb3f){if(_0x5b31ab[_0xb668('0x17')][_0xb668('0x9')]&&_0x5b31ab[_0xb668('0x17')]['script']){var _0x2b7f96=path[_0xb668('0x18')](__dirname,_0xb668('0x19'),_0x5b31ab['body']['script']);var _0x43a70b=process[_0xb668('0x1a')]();process['chdir'](path[_0xb668('0x1b')](_0x2b7f96));return execChildProcess()['then'](function(_0x2f1394){process['chdir'](_0x43a70b);return pm2[_0xb668('0x1c')]({'name':_0x5b31ab[_0xb668('0x17')][_0xb668('0x9')],'script':_0x2b7f96});})[_0xb668('0xf')](function(_0x2a5b3d){pm2[_0xb668('0x1d')]();return _0x2a5b3d[0x0];})['then'](respondWithResult(_0x12fb3f,0xc9))[_0xb668('0x1e')](handleError(_0x12fb3f,null));}else{return _0x12fb3f[_0xb668('0x5')](0x1f4)[_0xb668('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0xe62fce,_0x2a826d){if(_0xe62fce[_0xb668('0x17')]['id']){delete _0xe62fce['body']['id'];}var _0x3a2543={'online':_0xb668('0x1f'),'stopped':_0xb668('0x20')};if(_0x3a2543['hasOwnProperty'](_0xe62fce['body'][_0xb668('0x5')])){return pm2[_0x3a2543[_0xe62fce[_0xb668('0x17')]['status']]](_0xe62fce[_0xb668('0x21')]['id'])[_0xb668('0xf')](respondWithResult(_0x2a826d,0xc8))[_0xb668('0x1e')](handleError(_0x2a826d,null));}else{return _0x2a826d[_0xb668('0x5')](0x1f4)[_0xb668('0xa')]({'message':'Unknown\x20status'});}};exports[_0xb668('0x22')]=function(_0x3bd27c,_0x5dfa2c){if(_0x3bd27c[_0xb668('0x17')]['id']){delete _0x3bd27c['body']['id'];}if(_0x3bd27c[_0xb668('0x21')]['id']){return pm2[_0xb668('0x23')](_0x3bd27c[_0xb668('0x21')]['id'])[_0xb668('0xf')](function(_0x2e40dd){pm2[_0xb668('0x1d')]();return _0x2e40dd[0x0];})[_0xb668('0xf')](respondWithResult(_0x5dfa2c,null))[_0xb668('0x1e')](handleError(_0x5dfa2c,null));}else{return _0x5dfa2c[_0xb668('0x5')](0x1f4)['send']({'message':_0xb668('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 2fb40a5..66a3c7f 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb272=['/agents','isAuthenticated','/queues','getQueues','exports','express','../../components/auth/service','./realtime.controller','get'];(function(_0xfc594f,_0x5819db){var _0x339548=function(_0x4a884d){while(--_0x4a884d){_0xfc594f['push'](_0xfc594f['shift']());}};_0x339548(++_0x5819db);}(_0xb272,0x1d9));var _0x2b27=function(_0x368c85,_0x586b0a){_0x368c85=_0x368c85-0x0;var _0x3477c2=_0xb272[_0x368c85];return _0x3477c2;};'use strict';var express=require(_0x2b27('0x0'));var router=express['Router']();var auth=require(_0x2b27('0x1'));var controller=require(_0x2b27('0x2'));router[_0x2b27('0x3')](_0x2b27('0x4'),auth[_0x2b27('0x5')](),controller['getAgents']);router[_0x2b27('0x3')](_0x2b27('0x6'),auth[_0x2b27('0x5')](),controller[_0x2b27('0x7')]);module[_0x2b27('0x8')]=router; \ No newline at end of file +var _0xa503=['../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router'];(function(_0x4ce07e,_0x46cc38){var _0x1d134d=function(_0x54f673){while(--_0x54f673){_0x4ce07e['push'](_0x4ce07e['shift']());}};_0x1d134d(++_0x46cc38);}(_0xa503,0x94));var _0x3a50=function(_0x56e3df,_0x57e10c){_0x56e3df=_0x56e3df-0x0;var _0x49faed=_0xa503[_0x56e3df];return _0x49faed;};'use strict';var express=require(_0x3a50('0x0'));var router=express[_0x3a50('0x1')]();var auth=require(_0x3a50('0x2'));var controller=require(_0x3a50('0x3'));router['get'](_0x3a50('0x4'),auth[_0x3a50('0x5')](),controller[_0x3a50('0x6')]);router['get'](_0x3a50('0x7'),auth[_0x3a50('0x5')](),controller[_0x3a50('0x8')]);module[_0x3a50('0x9')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index aef27ee..4a2c69a 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc95=['pauseTypeFilter','pause','*pause','resolve','channel','toLowerCase','sort','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','then','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','online','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','userProfileId','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','merge','getAgentStatus','includes','Status','sortAgentsByStatus','pick','catch','getQueues','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','voice','dialMethod','getOptions','outbound','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','undefined','limit','count','offset','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter'];(function(_0x137d6f,_0x40377e){var _0x355b2d=function(_0x1d9ff0){while(--_0x1d9ff0){_0x137d6f['push'](_0x137d6f['shift']());}};_0x355b2d(++_0x40377e);}(_0xdc95,0x98));var _0x5dc9=function(_0x273311,_0x3db53c){_0x273311=_0x273311-0x0;var _0x139054=_0xdc95[_0x273311];return _0x139054;};'use strict';var _=require('lodash');var util=require(_0x5dc9('0x0'));var rta=require(_0x5dc9('0x1'));var rtq=require(_0x5dc9('0x2'));var qs=require(_0x5dc9('0x3'));var utils=require(_0x5dc9('0x4'));var db=require(_0x5dc9('0x5'))['db'];var APIBadRequestError=require(_0x5dc9('0x6'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')[_0x5dc9('0x7')];function respondWithFilteredResult(_0x13d610,_0x3c584a){return function(_0x1dcca1){if(_0x1dcca1){var _0x2084a=typeof _0x3c584a['offset']===_0x5dc9('0x8')&&typeof _0x3c584a[_0x5dc9('0x9')]===_0x5dc9('0x8');var _0x5b3b30=_0x1dcca1[_0x5dc9('0xa')];var _0x49cc6e=_0x2084a?0x0:_0x3c584a['offset'];var _0x3188e4=_0x2084a?_0x1dcca1['count']:_0x3c584a[_0x5dc9('0xb')]+_0x3c584a[_0x5dc9('0x9')];var _0x34eec0;if(_0x3188e4>=_0x5b3b30){_0x3188e4=_0x5b3b30;_0x34eec0=0xc8;}else{_0x34eec0=0xce;}_0x13d610[_0x5dc9('0xc')](_0x34eec0);return _0x13d610[_0x5dc9('0xd')](_0x5dc9('0xe'),_0x49cc6e+'-'+_0x3188e4+'/'+_0x5b3b30)['json'](_0x1dcca1);}return null;};}exports[_0x5dc9('0xf')]=function(_0x3cc54,_0x11b7e1){var _0x369281={'count':0x0,'rows':[]};var _0x5a3cca={};var _0x20d5a1;var _0x476ac2=utils[_0x5dc9('0x10')]();var _0x1dfa1f;var _0x774b68;var _0x3dc844=_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x12')];var _0x37ccb9=_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x13')];var _0xf1067e=_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x14')];var _0x3d22fc=_0x37ccb9===_0x5dc9('0x15')||_0x37ccb9===_0x5dc9('0x16')?!![]:![];var _0x2d805d=[];var _0x2aacc4;var _0x1a7d6f;Promise[_0x5dc9('0x17')]()['then'](function(){if(_0x3cc54['query'][_0x5dc9('0x18')]){if(!utils['isValidChannel'](_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x18')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x18')]));}_0x20d5a1=_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x18')][_0x5dc9('0x19')]();}if(!_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x1a')]||!_0x3cc54[_0x5dc9('0x11')]['sort']['includes'](_0x5dc9('0x1b'))){_0x3cc54['query']['sort']=rta[_0x5dc9('0x1c')](_0x3cc54['query']['sort']);return;}var _0x3baeee=rta['getUpdatedSortOptions'](_0x3cc54[_0x5dc9('0x11')]['sort']);_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x1a')]=_0x3baeee[_0x5dc9('0x1d')][_0x5dc9('0x1e')](',');_0x2aacc4=_0x3baeee[_0x5dc9('0x1f')];})['then'](function(){if(!_0x3dc844){return[];}return rta[_0x5dc9('0x20')](_0x3dc844,_0x20d5a1);})['then'](function(_0x2125bc){_0x2d805d=_0x2125bc;return rta['getRealtimeAgents']();})[_0x5dc9('0x21')](function(_0x55f49c){_0x774b68=_0x55f49c[_0x5dc9('0x22')];if((!_0x37ccb9||_0x3d22fc)&&!_0x2aacc4){return _0x2d805d;}if(_0x2aacc4&&!_0x37ccb9){return rta[_0x5dc9('0x23')](_0x774b68,_0x2d805d,_0x2aacc4);}else{return rta[_0x5dc9('0x24')](_0x774b68,_0x2d805d,_0x37ccb9);}})[_0x5dc9('0x21')](function(_0x1f097a){_0x2d805d=_0x1f097a;var _0x509ffc=![];if(_0x2d805d[_0x5dc9('0x25')]===0x0){if(_0x3dc844||_0x37ccb9){_0x509ffc=!![];}if(_0x3d22fc){_0x509ffc=![];}}if(_0x509ffc){return _0x369281;}var _0x368eda=_[_0x5dc9('0x26')](db[_0x5dc9('0x27')][_0x5dc9('0x28')],function(_0x5a8ffb){return{'name':_0x5a8ffb[_0x5dc9('0x29')],'type':_0x5a8ffb[_0x5dc9('0x2a')][_0x5dc9('0x2b')]};});_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x2c')]=_0x5dc9('0x2d');_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x2e')]=!![];_0x5a3cca=qs['getOptions'](_0x368eda,_0x3cc54);_0x5a3cca[_0x5dc9('0x2f')]=!![];var _0x371de4=[];if(_0x2d805d[_0x5dc9('0x25')]>0x0){_0x371de4[_0x5dc9('0x30')]({'id':{'$in':_0x2d805d}});if(_0x2aacc4&&!_0x37ccb9){_0x1a7d6f=[db[_0x5dc9('0x31')][_0x5dc9('0x32')](_0x5dc9('0x33')+_0x2d805d+')')];_0x5a3cca[_0x5dc9('0x1f')]=_0x1a7d6f;}}if(_0x3d22fc){_0x476ac2[_0x5dc9('0x34')](function(_0x4a0849){var _0x1ea3e3=!![];if(_0x37ccb9===_0x5dc9('0x16')&&_0x20d5a1!==_0x4a0849){_0x1ea3e3=![];}_0x371de4[_0x5dc9('0x30')]({[_0x4a0849+_0x5dc9('0x35')]:_0x1ea3e3});});if(_0xf1067e){_0x371de4[_0x5dc9('0x30')]({'pauseType':_0xf1067e});}}else if(_0x37ccb9){_0x476ac2[_0x5dc9('0x34')](function(_0x889702){_0x371de4[_0x5dc9('0x30')]({[_0x889702+_0x5dc9('0x35')]:![]});});}_0x5a3cca[_0x5dc9('0x36')]=_['merge'](_0x5a3cca['where'],{'$and':_0x371de4});if(_0x3cc54[_0x5dc9('0x37')]['role']===_0x5dc9('0x37')){var _0x387f2b={'params':{'id':_0x3cc54[_0x5dc9('0x37')][_0x5dc9('0x38')]},'query':{'section':'Agents','role':_0x5dc9('0x2d'),'online':!![],'raw':!![],'ids':_0x2d805d,'customSorting':_0x1a7d6f}};if(_0x3d22fc){_0x387f2b[_0x5dc9('0x11')][_0x5dc9('0x39')]=_0x371de4;}_0x387f2b[_0x5dc9('0x11')]=Object[_0x5dc9('0x3a')](_0x387f2b[_0x5dc9('0x11')],_0x3cc54[_0x5dc9('0x11')]);delete _0x387f2b['query']['id'];return db[_0x5dc9('0x3b')][_0x5dc9('0x3c')](_0x387f2b);}return db[_0x5dc9('0x27')][_0x5dc9('0x3d')](_0x5a3cca);})[_0x5dc9('0x21')](function(_0x5c3d72){_0x369281[_0x5dc9('0xa')]=_0x5c3d72['count'];_0x1dfa1f=_0x5c3d72[_0x5dc9('0x22')];return _0x1dfa1f[_0x5dc9('0x26')](function(_0x220a55){var _0x4a69b5=_['find'](_0x774b68,['id',_0x220a55['id']]);if(_0x4a69b5){var _0x222ba6=rta[_0x5dc9('0x3e')](_0x4a69b5);_[_0x5dc9('0x3f')](_0x220a55,_0x222ba6);}_0x220a55['globalStatus']=rta[_0x5dc9('0x40')](_0x220a55);if(_0x220a55[_0x5dc9('0x1b')][_0x5dc9('0x41')]('pause')){_0x476ac2[_0x5dc9('0x34')](function(_0x57ef92){if(_0x220a55[_0x57ef92+_0x5dc9('0x35')]){_0x220a55[_0x57ef92+_0x5dc9('0x42')]=_0x5dc9('0x15');}});}return _0x220a55;});})['then'](function(_0x2a4ee2){if(!_0x2aacc4||_0x1a7d6f){return _0x2a4ee2;}return rta[_0x5dc9('0x43')](_0x2a4ee2,_0x2aacc4);})[_0x5dc9('0x21')](function(_0x142190){var _0x3b378f=null;if(_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x1d')]){var _0x66a5b=_0x3cc54[_0x5dc9('0x11')][_0x5dc9('0x1d')]['split'](',');_0x3b378f=_0x142190['map'](function(_0xc33487){return _[_0x5dc9('0x44')](_0xc33487,_0x66a5b);});}_0x369281['rows']=_0x3b378f||_0x142190;return _0x369281;})[_0x5dc9('0x21')](respondWithFilteredResult(_0x11b7e1,_0x5a3cca))[_0x5dc9('0x45')](APIHandleError(_0x11b7e1));};exports[_0x5dc9('0x46')]=function(_0x3d5383,_0x4a3959){var _0x4d17f1={'count':0x0,'rows':[]};var _0x448ea4={};var _0xdc3189;var _0x30ce30;var _0x5b3d14;Promise[_0x5dc9('0x17')]()[_0x5dc9('0x21')](function(){if(_0x3d5383[_0x5dc9('0x11')]['channel']){if(!utils[_0x5dc9('0x47')](_0x3d5383['query'][_0x5dc9('0x18')])){throw new APIBadRequestError(util[_0x5dc9('0x48')](_0x5dc9('0x49'),_0x3d5383[_0x5dc9('0x11')][_0x5dc9('0x18')]));}_0xdc3189=_0x3d5383[_0x5dc9('0x11')][_0x5dc9('0x18')]['toLowerCase']();}var _0xfe5c12=_[_0x5dc9('0x4a')](_0xdc3189)+_0x5dc9('0x4b');var _0x4b0b2d=_[_0x5dc9('0x26')](db[_0xfe5c12][_0x5dc9('0x28')],function(_0x34195c){return{'name':_0x34195c[_0x5dc9('0x29')],'type':_0x34195c['type']['key']};});if(!_0x3d5383[_0x5dc9('0x11')]['fields']){var _0x4d5ccc=['id','name'];if(_0xdc3189===_0x5dc9('0x4c')){_0x4d5ccc[_0x5dc9('0x30')](_0x5dc9('0x2a'));if(_0x3d5383[_0x5dc9('0x11')][_0x5dc9('0x2a')]==='outbound'){_0x4d5ccc[_0x5dc9('0x30')](['dialActive',_0x5dc9('0x4d')]);}}_0x3d5383[_0x5dc9('0x11')][_0x5dc9('0x1d')]=_0x4d5ccc[_0x5dc9('0x1e')](',');}_0x448ea4=qs[_0x5dc9('0x4e')](_0x4b0b2d,_0x3d5383);if(_0x3d5383[_0x5dc9('0x37')][_0x5dc9('0x2c')]===_0x5dc9('0x37')){var _0x450f87={'params':{'id':_0x3d5383[_0x5dc9('0x37')][_0x5dc9('0x38')]},'query':{'section':_0xdc3189===_0x5dc9('0x4c')&&_0x3d5383[_0x5dc9('0x11')][_0x5dc9('0x2a')]===_0x5dc9('0x4f')?_0x5dc9('0x50'):_[_0x5dc9('0x4a')](_0xdc3189)+_0x5dc9('0x51'),'type':_0x3d5383['query']['type'],'nolimit':!![],'sort':_0x5dc9('0x52'),'filter':_0x3d5383[_0x5dc9('0x11')][_0x5dc9('0x53')]}};return db[_0x5dc9('0x3b')]['getResources'](_0x450f87);}return db[_0xfe5c12][_0x5dc9('0x3d')](_0x448ea4);})[_0x5dc9('0x21')](function(_0x6db6ff){_0x4d17f1[_0x5dc9('0xa')]=_0x6db6ff[_0x5dc9('0xa')];_0x30ce30=_0x6db6ff[_0x5dc9('0x22')];return rtq[_0x5dc9('0x54')](_0x3d5383,_0xdc3189);})['then'](function(_0x3ffdf8){_0x5b3d14=_0x3ffdf8[_0x5dc9('0x22')];return rtq[_0x5dc9('0x55')](_0x30ce30,_0x5b3d14,_0xdc3189,_0x3d5383[_0x5dc9('0x11')][_0x5dc9('0x2a')]);})[_0x5dc9('0x21')](function(_0x1e3f9f){_0x4d17f1[_0x5dc9('0x22')]=_0x1e3f9f;return _0x4d17f1;})['then'](respondWithFilteredResult(_0x4a3959,_0x448ea4))[_0x5dc9('0x45')](APIHandleError(_0x4a3959));}; \ No newline at end of file +var _0xb3a1=['startCase','Queues','name','filter','UserProfile','getResources','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','status','set','Content-Range','json','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','map','User','rawAttributes','fieldName','key','role','agent','getOptions','raw','length','push','literal','FIELD(id,','forEach','Pause','where','user','Agents','extraQueryConditions','assign','findAndCountAll','count','find','filterAgentAttributes','merge','globalStatus','getAgentStatus','Status','sortAgentsByStatus','split','getQueues','Queue','voice','type','outbound','dialActive','dialMethod','userProfileId','QueueCampaigns'];(function(_0x528ade,_0x5e2c11){var _0x84db00=function(_0x2abf37){while(--_0x2abf37){_0x528ade['push'](_0x528ade['shift']());}};_0x84db00(++_0x5e2c11);}(_0xb3a1,0xb6));var _0x1b3a=function(_0x46a5e9,_0x1a5966){_0x46a5e9=_0x46a5e9-0x0;var _0x2466bb=_0xb3a1[_0x46a5e9];return _0x2466bb;};'use strict';var _=require(_0x1b3a('0x0'));var util=require(_0x1b3a('0x1'));var rta=require(_0x1b3a('0x2'));var rtq=require(_0x1b3a('0x3'));var qs=require(_0x1b3a('0x4'));var utils=require(_0x1b3a('0x5'));var db=require(_0x1b3a('0x6'))['db'];var APIBadRequestError=require(_0x1b3a('0x7'))[_0x1b3a('0x8')];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x4485f2,_0x4fe4e6){return function(_0x3914da){if(_0x3914da){var _0xc2f3f=typeof _0x4fe4e6[_0x1b3a('0x9')]===_0x1b3a('0xa')&&typeof _0x4fe4e6[_0x1b3a('0xb')]===_0x1b3a('0xa');var _0x175ea4=_0x3914da['count'];var _0x12fe14=_0xc2f3f?0x0:_0x4fe4e6['offset'];var _0x2a741d=_0xc2f3f?_0x3914da['count']:_0x4fe4e6[_0x1b3a('0x9')]+_0x4fe4e6['limit'];var _0x4fa918;if(_0x2a741d>=_0x175ea4){_0x2a741d=_0x175ea4;_0x4fa918=0xc8;}else{_0x4fa918=0xce;}_0x4485f2[_0x1b3a('0xc')](_0x4fa918);return _0x4485f2[_0x1b3a('0xd')](_0x1b3a('0xe'),_0x12fe14+'-'+_0x2a741d+'/'+_0x175ea4)[_0x1b3a('0xf')](_0x3914da);}return null;};}exports['getAgents']=function(_0x10db97,_0x53fbe8){var _0x5b8430={'count':0x0,'rows':[]};var _0x32dde5={};var _0x35931a;var _0x29e814=utils[_0x1b3a('0x10')]();var _0x5bd555;var _0x12ed83;var _0x34b927=_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x12')];var _0x2ed755=_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x13')];var _0xd35b04=_0x10db97['query'][_0x1b3a('0x14')];var _0x5ed68f=_0x2ed755===_0x1b3a('0x15')||_0x2ed755===_0x1b3a('0x16')?!![]:![];var _0x4c8d25=[];var _0x3ef4c9;var _0x4de323;Promise[_0x1b3a('0x17')]()[_0x1b3a('0x18')](function(){if(_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x19')]){if(!utils[_0x1b3a('0x1a')](_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x19')])){throw new APIBadRequestError(util[_0x1b3a('0x1b')](_0x1b3a('0x1c'),_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x19')]));}_0x35931a=_0x10db97[_0x1b3a('0x11')]['channel'][_0x1b3a('0x1d')]();}if(!_0x10db97['query'][_0x1b3a('0x1e')]||!_0x10db97['query'][_0x1b3a('0x1e')][_0x1b3a('0x1f')]('globalStatus')){_0x10db97['query'][_0x1b3a('0x1e')]=rta[_0x1b3a('0x20')](_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x1e')]);return;}var _0x10cfe9=rta[_0x1b3a('0x21')](_0x10db97[_0x1b3a('0x11')]['sort']);_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x1e')]=_0x10cfe9[_0x1b3a('0x22')][_0x1b3a('0x23')](',');_0x3ef4c9=_0x10cfe9['order'];})[_0x1b3a('0x18')](function(){if(!_0x34b927){return[];}return rta[_0x1b3a('0x24')](_0x34b927,_0x35931a);})['then'](function(_0x3d0850){_0x4c8d25=_0x3d0850;return rta[_0x1b3a('0x25')]();})[_0x1b3a('0x18')](function(_0x2d24f3){_0x12ed83=_0x2d24f3[_0x1b3a('0x26')];if((!_0x2ed755||_0x5ed68f)&&!_0x3ef4c9){return _0x4c8d25;}if(_0x3ef4c9&&!_0x2ed755){return rta['getSortedAgentsIdsByStatus'](_0x12ed83,_0x4c8d25,_0x3ef4c9);}else{return rta[_0x1b3a('0x27')](_0x12ed83,_0x4c8d25,_0x2ed755);}})['then'](function(_0x5e7aef){_0x4c8d25=_0x5e7aef;var _0x2ab178=![];if(_0x4c8d25['length']===0x0){if(_0x34b927||_0x2ed755){_0x2ab178=!![];}if(_0x5ed68f){_0x2ab178=![];}}if(_0x2ab178){return _0x5b8430;}var _0x13be69=_[_0x1b3a('0x28')](db[_0x1b3a('0x29')][_0x1b3a('0x2a')],function(_0x49af4c){return{'name':_0x49af4c[_0x1b3a('0x2b')],'type':_0x49af4c['type'][_0x1b3a('0x2c')]};});_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x2d')]=_0x1b3a('0x2e');_0x10db97[_0x1b3a('0x11')]['online']=!![];_0x32dde5=qs[_0x1b3a('0x2f')](_0x13be69,_0x10db97);_0x32dde5[_0x1b3a('0x30')]=!![];var _0x5b2475=[];if(_0x4c8d25[_0x1b3a('0x31')]>0x0){_0x5b2475[_0x1b3a('0x32')]({'id':{'$in':_0x4c8d25}});if(_0x3ef4c9&&!_0x2ed755){_0x4de323=[db['sequelize'][_0x1b3a('0x33')](_0x1b3a('0x34')+_0x4c8d25+')')];_0x32dde5['order']=_0x4de323;}}if(_0x5ed68f){_0x29e814[_0x1b3a('0x35')](function(_0x18c746){var _0x4f1c01=!![];if(_0x2ed755===_0x1b3a('0x16')&&_0x35931a!==_0x18c746){_0x4f1c01=![];}_0x5b2475[_0x1b3a('0x32')]({[_0x18c746+_0x1b3a('0x36')]:_0x4f1c01});});if(_0xd35b04){_0x5b2475[_0x1b3a('0x32')]({'pauseType':_0xd35b04});}}else if(_0x2ed755){_0x29e814[_0x1b3a('0x35')](function(_0x538c29){_0x5b2475[_0x1b3a('0x32')]({[_0x538c29+_0x1b3a('0x36')]:![]});});}_0x32dde5[_0x1b3a('0x37')]=_['merge'](_0x32dde5[_0x1b3a('0x37')],{'$and':_0x5b2475});if(_0x10db97[_0x1b3a('0x38')][_0x1b3a('0x2d')]===_0x1b3a('0x38')){var _0x28b62d={'params':{'id':_0x10db97[_0x1b3a('0x38')]['userProfileId']},'query':{'section':_0x1b3a('0x39'),'role':_0x1b3a('0x2e'),'online':!![],'raw':!![],'ids':_0x4c8d25,'customSorting':_0x4de323}};if(_0x5ed68f){_0x28b62d[_0x1b3a('0x11')][_0x1b3a('0x3a')]=_0x5b2475;}_0x28b62d[_0x1b3a('0x11')]=Object[_0x1b3a('0x3b')](_0x28b62d[_0x1b3a('0x11')],_0x10db97[_0x1b3a('0x11')]);delete _0x28b62d[_0x1b3a('0x11')]['id'];return db['UserProfile']['getResources'](_0x28b62d);}return db['User'][_0x1b3a('0x3c')](_0x32dde5);})[_0x1b3a('0x18')](function(_0x3d5929){_0x5b8430[_0x1b3a('0x3d')]=_0x3d5929[_0x1b3a('0x3d')];_0x5bd555=_0x3d5929['rows'];return _0x5bd555[_0x1b3a('0x28')](function(_0x46b68d){var _0x2ba177=_[_0x1b3a('0x3e')](_0x12ed83,['id',_0x46b68d['id']]);if(_0x2ba177){var _0x496b17=rta[_0x1b3a('0x3f')](_0x2ba177);_[_0x1b3a('0x40')](_0x46b68d,_0x496b17);}_0x46b68d[_0x1b3a('0x41')]=rta[_0x1b3a('0x42')](_0x46b68d);if(_0x46b68d[_0x1b3a('0x41')][_0x1b3a('0x1f')](_0x1b3a('0x15'))){_0x29e814['forEach'](function(_0x34fcea){if(_0x46b68d[_0x34fcea+'Pause']){_0x46b68d[_0x34fcea+_0x1b3a('0x43')]=_0x1b3a('0x15');}});}return _0x46b68d;});})[_0x1b3a('0x18')](function(_0x7f3def){if(!_0x3ef4c9||_0x4de323){return _0x7f3def;}return rta[_0x1b3a('0x44')](_0x7f3def,_0x3ef4c9);})[_0x1b3a('0x18')](function(_0x1098a7){var _0x214bce=null;if(_0x10db97['query']['fields']){var _0x1ab8e9=_0x10db97[_0x1b3a('0x11')][_0x1b3a('0x22')][_0x1b3a('0x45')](',');_0x214bce=_0x1098a7['map'](function(_0x5f17e1){return _['pick'](_0x5f17e1,_0x1ab8e9);});}_0x5b8430[_0x1b3a('0x26')]=_0x214bce||_0x1098a7;return _0x5b8430;})[_0x1b3a('0x18')](respondWithFilteredResult(_0x53fbe8,_0x32dde5))['catch'](APIHandleError(_0x53fbe8));};exports[_0x1b3a('0x46')]=function(_0x58d696,_0x17b373){var _0x5054f3={'count':0x0,'rows':[]};var _0x11b6f4={};var _0x55f8bb;var _0x29a59b;var _0x5ad5e1;Promise['resolve']()[_0x1b3a('0x18')](function(){if(_0x58d696[_0x1b3a('0x11')][_0x1b3a('0x19')]){if(!utils['isValidChannel'](_0x58d696[_0x1b3a('0x11')][_0x1b3a('0x19')])){throw new APIBadRequestError(util[_0x1b3a('0x1b')](_0x1b3a('0x1c'),_0x58d696['query'][_0x1b3a('0x19')]));}_0x55f8bb=_0x58d696[_0x1b3a('0x11')][_0x1b3a('0x19')][_0x1b3a('0x1d')]();}var _0x16206b=_['startCase'](_0x55f8bb)+_0x1b3a('0x47');var _0x2313c8=_[_0x1b3a('0x28')](db[_0x16206b][_0x1b3a('0x2a')],function(_0x1f2213){return{'name':_0x1f2213[_0x1b3a('0x2b')],'type':_0x1f2213['type'][_0x1b3a('0x2c')]};});if(!_0x58d696['query'][_0x1b3a('0x22')]){var _0x1d4bb4=['id','name'];if(_0x55f8bb===_0x1b3a('0x48')){_0x1d4bb4[_0x1b3a('0x32')](_0x1b3a('0x49'));if(_0x58d696[_0x1b3a('0x11')][_0x1b3a('0x49')]===_0x1b3a('0x4a')){_0x1d4bb4[_0x1b3a('0x32')]([_0x1b3a('0x4b'),_0x1b3a('0x4c')]);}}_0x58d696[_0x1b3a('0x11')]['fields']=_0x1d4bb4['join'](',');}_0x11b6f4=qs[_0x1b3a('0x2f')](_0x2313c8,_0x58d696);if(_0x58d696[_0x1b3a('0x38')][_0x1b3a('0x2d')]===_0x1b3a('0x38')){var _0x56663a={'params':{'id':_0x58d696[_0x1b3a('0x38')][_0x1b3a('0x4d')]},'query':{'section':_0x55f8bb===_0x1b3a('0x48')&&_0x58d696[_0x1b3a('0x11')][_0x1b3a('0x49')]===_0x1b3a('0x4a')?_0x1b3a('0x4e'):_[_0x1b3a('0x4f')](_0x55f8bb)+_0x1b3a('0x50'),'type':_0x58d696[_0x1b3a('0x11')][_0x1b3a('0x49')],'nolimit':!![],'sort':_0x1b3a('0x51'),'filter':_0x58d696[_0x1b3a('0x11')][_0x1b3a('0x52')]}};return db[_0x1b3a('0x53')][_0x1b3a('0x54')](_0x56663a);}return db[_0x16206b][_0x1b3a('0x3c')](_0x11b6f4);})[_0x1b3a('0x18')](function(_0x3b0397){_0x5054f3[_0x1b3a('0x3d')]=_0x3b0397[_0x1b3a('0x3d')];_0x29a59b=_0x3b0397[_0x1b3a('0x26')];return rtq[_0x1b3a('0x55')](_0x58d696,_0x55f8bb);})[_0x1b3a('0x18')](function(_0x5a207c){_0x5ad5e1=_0x5a207c['rows'];return rtq[_0x1b3a('0x56')](_0x29a59b,_0x5ad5e1,_0x55f8bb,_0x58d696['query'][_0x1b3a('0x49')]);})[_0x1b3a('0x18')](function(_0x1b391a){_0x5054f3[_0x1b3a('0x26')]=_0x1b391a;return _0x5054f3;})['then'](respondWithFilteredResult(_0x17b373,_0x11b6f4))['catch'](APIHandleError(_0x17b373));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 788670d..59042ec 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3815b2,_0xdeaa84){var _0x2ebd79=function(_0x4ed85a){while(--_0x4ed85a){_0x3815b2['push'](_0x3815b2['shift']());}};_0x2ebd79(++_0xdeaa84);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x32239b,_0x347094){var _0x52af50=function(_0x393fec){while(--_0x393fec){_0x32239b['push'](_0x32239b['shift']());}};_0x52af50(++_0x347094);}(_0x70e0,0x17b));var _0x070e=function(_0x275060,_0x6a0c6c){_0x275060=_0x275060-0x0;var _0x2c2cf7=_0x70e0[_0x275060];return _0x2c2cf7;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b3d67fd..e564030 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c49=['STRING','sequelize','exports','DATE'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x7c49,0x141));var _0x97c4=function(_0xc7e8c,_0x1a2912){_0xc7e8c=_0xc7e8c-0x0;var _0x3d97e3=_0x7c49[_0xc7e8c];return _0x3d97e3;};'use strict';var Sequelize=require(_0x97c4('0x0'));module[_0x97c4('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x97c4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x97c4('0x2')]},'responsetime':{'type':Sequelize[_0x97c4('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x97c4('0x3')]},'membername':{'type':Sequelize[_0x97c4('0x3')]}}; \ No newline at end of file +var _0xae30=['STRING','sequelize','exports','INTEGER','DATE'];(function(_0x58dda8,_0x2b5c7a){var _0xffa0c3=function(_0x2df228){while(--_0x2df228){_0x58dda8['push'](_0x58dda8['shift']());}};_0xffa0c3(++_0x2b5c7a);}(_0xae30,0x10a));var _0x0ae3=function(_0x1bdfe7,_0x5c062c){_0x1bdfe7=_0x1bdfe7-0x0;var _0x6dc98e=_0xae30[_0x1bdfe7];return _0x6dc98e;};'use strict';var Sequelize=require(_0x0ae3('0x0'));module[_0x0ae3('0x1')]={'state':{'type':Sequelize[_0x0ae3('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0ae3('0x3')]},'uniqueid':{'type':Sequelize[_0x0ae3('0x4')]},'starttime':{'type':Sequelize[_0x0ae3('0x3')]},'responsetime':{'type':Sequelize[_0x0ae3('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0ae3('0x4')]},'campaigntype':{'type':Sequelize[_0x0ae3('0x4')]},'membername':{'type':Sequelize[_0x0ae3('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 81e2e42..3516190 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.model.js +++ b/server/api/reportAgentPreview/reportAgentPreview.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1619=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x4423f1,_0x17f0d3){var _0x38e024=function(_0x8ed767){while(--_0x8ed767){_0x4423f1['push'](_0x4423f1['shift']());}};_0x38e024(++_0x17f0d3);}(_0x1619,0x1eb));var _0x9161=function(_0x1e58b9,_0x9e81e1){_0x1e58b9=_0x1e58b9-0x0;var _0x280af3=_0x1619[_0x1e58b9];return _0x280af3;};'use strict';var _=require(_0x9161('0x0'));var util=require(_0x9161('0x1'));var logger=require(_0x9161('0x2'))(_0x9161('0x3'));var moment=require(_0x9161('0x4'));var BPromise=require(_0x9161('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9161('0x6'));var rimraf=require(_0x9161('0x7'));var config=require(_0x9161('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x9161('0x9')]=function(_0x250a4f,_0x58a673){return _0x250a4f[_0x9161('0xa')](_0x9161('0xb'),attributes,{'tableName':_0x9161('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x257b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0x257b,0x124));var _0xb257=function(_0x333edd,_0x5c797b){_0x333edd=_0x333edd-0x0;var _0x522512=_0x257b[_0x333edd];return _0x522512;};'use strict';var _=require(_0xb257('0x0'));var util=require(_0xb257('0x1'));var logger=require(_0xb257('0x2'))(_0xb257('0x3'));var moment=require(_0xb257('0x4'));var BPromise=require(_0xb257('0x5'));var rp=require(_0xb257('0x6'));var fs=require('fs');var path=require(_0xb257('0x7'));var rimraf=require(_0xb257('0x8'));var config=require(_0xb257('0x9'));var attributes=require(_0xb257('0xa'));module[_0xb257('0xb')]=function(_0x2aaf8d,_0x538843){return _0x2aaf8d[_0xb257('0xc')]('ReportAgentPreview',attributes,{'tableName':_0xb257('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index cb4d393..631b05f 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.rpc.js +++ b/server/api/reportAgentPreview/reportAgentPreview.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bc2=['message','catch','ReportAgentPreview','body','options','raw','info','CreateReportAgentPreview','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x37b22d,_0x2f88fe){var _0x3c6a71=function(_0x224719){while(--_0x224719){_0x37b22d['push'](_0x37b22d['shift']());}};_0x3c6a71(++_0x2f88fe);}(_0x1bc2,0x102));var _0x21bc=function(_0x3dd995,_0x526c7e){_0x3dd995=_0x3dd995-0x0;var _0x3583e0=_0x1bc2[_0x3dd995];return _0x3583e0;};'use strict';var _=require('lodash');var util=require(_0x21bc('0x0'));var moment=require(_0x21bc('0x1'));var BPromise=require(_0x21bc('0x2'));var rs=require(_0x21bc('0x3'));var fs=require('fs');var Redis=require(_0x21bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x21bc('0x5'))(_0x21bc('0x6'));var config=require('../../config/environment');var jayson=require(_0x21bc('0x7'));var client=jayson[_0x21bc('0x8')][_0x21bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x878d0a,_0x35f7f1,_0x2f42ab){return new BPromise(function(_0x13b365,_0x378c49){return client['request'](_0x878d0a,_0x2f42ab)[_0x21bc('0xa')](function(_0x1c4021){logger['info'](_0x21bc('0xb'),_0x35f7f1,_0x21bc('0xc'));logger[_0x21bc('0xd')](_0x21bc('0xe'),_0x35f7f1,_0x21bc('0xc'),JSON[_0x21bc('0xf')](_0x1c4021));if(_0x1c4021[_0x21bc('0x10')]){if(_0x1c4021[_0x21bc('0x10')]['code']===0x1f4){logger['error'](_0x21bc('0xb'),_0x35f7f1,_0x1c4021[_0x21bc('0x10')][_0x21bc('0x11')]);return _0x378c49(_0x1c4021[_0x21bc('0x10')]['message']);}logger['error'](_0x21bc('0xb'),_0x35f7f1,_0x1c4021[_0x21bc('0x10')]['message']);return _0x13b365(_0x1c4021[_0x21bc('0x10')][_0x21bc('0x11')]);}else{logger['info'](_0x21bc('0xb'),_0x35f7f1,_0x21bc('0xc'));_0x13b365(_0x1c4021['result'][_0x21bc('0x11')]);}})[_0x21bc('0x12')](function(_0x4bcb11){logger['error'](_0x21bc('0xb'),_0x35f7f1,_0x4bcb11);_0x378c49(_0x4bcb11);});});}exports['CreateReportAgentPreview']=function(_0x11dc37){var _0x4543e7=this;return new Promise(function(_0x2ce915,_0x3b09fb){return db[_0x21bc('0x13')]['create'](_0x11dc37[_0x21bc('0x14')],{'raw':_0x11dc37[_0x21bc('0x15')]?_0x11dc37['options'][_0x21bc('0x16')]===undefined?!![]:![]:!![]})[_0x21bc('0xa')](function(_0x473c3a){logger[_0x21bc('0x17')]('CreateReportAgentPreview',_0x11dc37);logger[_0x21bc('0xd')](_0x21bc('0x18'),_0x11dc37,JSON[_0x21bc('0xf')](_0x473c3a));_0x2ce915(_0x473c3a);})[_0x21bc('0x12')](function(_0x48d459){logger['error'](_0x21bc('0x18'),_0x48d459[_0x21bc('0x11')],_0x11dc37);_0x3b09fb(_0x4543e7['error'](0x1f4,_0x48d459[_0x21bc('0x11')]));});});}; \ No newline at end of file +var _0x97bc=['jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x25cf3e,_0x15e565){var _0x4579f8=function(_0x43b787){while(--_0x43b787){_0x25cf3e['push'](_0x25cf3e['shift']());}};_0x4579f8(++_0x15e565);}(_0x97bc,0x18a));var _0xc97b=function(_0x17a2b5,_0x239133){_0x17a2b5=_0x17a2b5-0x0;var _0x1be2a0=_0x97bc[_0x17a2b5];return _0x1be2a0;};'use strict';var _=require('lodash');var util=require(_0xc97b('0x0'));var moment=require(_0xc97b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc97b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc97b('0x3'))['db'];var utils=require(_0xc97b('0x4'));var logger=require('../../config/logger')(_0xc97b('0x5'));var config=require('../../config/environment');var jayson=require(_0xc97b('0x6'));var client=jayson['client'][_0xc97b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x414ec4,_0x316160,_0x5dff4b){return new BPromise(function(_0x2c6850,_0x7ae74e){return client[_0xc97b('0x8')](_0x414ec4,_0x5dff4b)[_0xc97b('0x9')](function(_0x39c1b2){logger[_0xc97b('0xa')](_0xc97b('0xb'),_0x316160,_0xc97b('0xc'));logger[_0xc97b('0xd')](_0xc97b('0xe'),_0x316160,_0xc97b('0xc'),JSON[_0xc97b('0xf')](_0x39c1b2));if(_0x39c1b2[_0xc97b('0x10')]){if(_0x39c1b2[_0xc97b('0x10')][_0xc97b('0x11')]===0x1f4){logger[_0xc97b('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x316160,_0x39c1b2['error'][_0xc97b('0x12')]);return _0x7ae74e(_0x39c1b2[_0xc97b('0x10')][_0xc97b('0x12')]);}logger[_0xc97b('0x10')](_0xc97b('0xb'),_0x316160,_0x39c1b2['error'][_0xc97b('0x12')]);return _0x2c6850(_0x39c1b2[_0xc97b('0x10')][_0xc97b('0x12')]);}else{logger[_0xc97b('0xa')](_0xc97b('0xb'),_0x316160,'request\x20sent');_0x2c6850(_0x39c1b2[_0xc97b('0x13')]['message']);}})[_0xc97b('0x14')](function(_0x5ee56c){logger[_0xc97b('0x10')](_0xc97b('0xb'),_0x316160,_0x5ee56c);_0x7ae74e(_0x5ee56c);});});}exports[_0xc97b('0x15')]=function(_0x27d18a){var _0x429865=this;return new Promise(function(_0x5e72d5,_0x4f6b67){return db[_0xc97b('0x16')]['create'](_0x27d18a[_0xc97b('0x17')],{'raw':_0x27d18a[_0xc97b('0x18')]?_0x27d18a[_0xc97b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc97b('0x9')](function(_0x36972c){logger['info']('CreateReportAgentPreview',_0x27d18a);logger[_0xc97b('0xd')](_0xc97b('0x15'),_0x27d18a,JSON[_0xc97b('0xf')](_0x36972c));_0x5e72d5(_0x36972c);})['catch'](function(_0x641a3e){logger['error'](_0xc97b('0x15'),_0x641a3e[_0xc97b('0x12')],_0x27d18a);_0x4f6b67(_0x429865[_0xc97b('0x10')](0x1f4,_0x641a3e[_0xc97b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index df3a41c..94ba5fe 100644 --- a/server/api/rpc/index.js +++ b/server/api/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten'];(function(_0x3862d9,_0x483475){var _0x46877c=function(_0x3f47e2){while(--_0x3f47e2){_0x3862d9['push'](_0x3862d9['shift']());}};_0x46877c(++_0x483475);}(_0x236c,0x164));var _0xc236=function(_0x15ff66,_0x2c3b6f){_0x15ff66=_0x15ff66-0x0;var _0x431fa5=_0x236c[_0x15ff66];return _0x431fa5;};'use strict';var multer=require(_0xc236('0x0'));var util=require(_0xc236('0x1'));var path=require(_0xc236('0x2'));var express=require(_0xc236('0x3'));var router=express[_0xc236('0x4')]();var auth=require(_0xc236('0x5'));var controller=require(_0xc236('0x6'));router[_0xc236('0x7')](_0xc236('0x8'),auth['isAuthenticated'](),controller[_0xc236('0x9')]);router[_0xc236('0x7')](_0xc236('0xa'),auth[_0xc236('0xb')](),controller['voiceChannelMixMonitor']);router['get'](_0xc236('0xc'),auth[_0xc236('0xb')](),controller['voiceChannelStopMixMonitor']);router[_0xc236('0x7')]('/voice/queues',auth['isAuthenticated'](),controller['voiceQueues']);router[_0xc236('0x7')](_0xc236('0xd'),auth[_0xc236('0xb')](),controller[_0xc236('0xe')]);router['get'](_0xc236('0xf'),auth[_0xc236('0xb')](),controller[_0xc236('0x10')]);router[_0xc236('0x7')](_0xc236('0x11'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0xc236('0x7')](_0xc236('0x12'),auth[_0xc236('0xb')](),controller[_0xc236('0x13')]);router['get'](_0xc236('0x14'),auth['isAuthenticated'](),controller[_0xc236('0x15')]);router[_0xc236('0x7')]('/whatsapp/queues',auth[_0xc236('0xb')](),controller['whatsappQueues']);router[_0xc236('0x7')]('/fax/queues',auth['isAuthenticated'](),controller[_0xc236('0x16')]);router[_0xc236('0x7')]('/voice/queues/preview/:id',auth[_0xc236('0xb')](),controller[_0xc236('0x17')]);router[_0xc236('0x7')](_0xc236('0x18'),auth[_0xc236('0xb')](),controller[_0xc236('0x19')]);router[_0xc236('0x7')](_0xc236('0x1a'),auth[_0xc236('0xb')](),controller['voiceQueuesChannel']);router[_0xc236('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xc236('0xb')](),controller[_0xc236('0x1b')]);router[_0xc236('0x7')](_0xc236('0x1c'),auth['isAuthenticated'](),controller[_0xc236('0x1d')]);router[_0xc236('0x7')](_0xc236('0x1e'),auth[_0xc236('0xb')](),controller['showVoiceQueues']);router[_0xc236('0x1f')]('/voice/queues/:id',auth[_0xc236('0xb')](),controller[_0xc236('0x20')]);router['get'](_0xc236('0x21'),auth['isAuthenticated'](),controller[_0xc236('0x22')]);router[_0xc236('0x7')](_0xc236('0x23'),auth[_0xc236('0xb')](),controller['outboundChannels']);router[_0xc236('0x7')](_0xc236('0x24'),auth[_0xc236('0xb')](),controller['agents']);router['put'](_0xc236('0x25'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0xc236('0x7')](_0xc236('0x26'),auth[_0xc236('0xb')](),controller[_0xc236('0x27')]);router[_0xc236('0x7')](_0xc236('0x28'),auth[_0xc236('0xb')](),controller[_0xc236('0x29')]);router[_0xc236('0x7')](_0xc236('0x2a'),auth[_0xc236('0xb')](),controller[_0xc236('0x2b')]);router[_0xc236('0x7')](_0xc236('0x2c'),auth[_0xc236('0xb')](),controller[_0xc236('0x2d')]);router[_0xc236('0x7')](_0xc236('0x2e'),auth[_0xc236('0xb')](),controller['chatQueuesWaitingInteractions']);router[_0xc236('0x7')]('/mail/queues/waitinginteractions',auth[_0xc236('0xb')](),controller['mailQueuesWaitingInteractions']);router[_0xc236('0x7')](_0xc236('0x2f'),auth['isAuthenticated'](),controller[_0xc236('0x30')]);router[_0xc236('0x7')](_0xc236('0x31'),auth[_0xc236('0xb')](),controller[_0xc236('0x32')]);router[_0xc236('0x7')](_0xc236('0x33'),auth[_0xc236('0xb')](),controller[_0xc236('0x34')]);router[_0xc236('0x7')](_0xc236('0x35'),auth[_0xc236('0xb')](),controller[_0xc236('0x36')]);router[_0xc236('0x7')](_0xc236('0x37'),auth['isAuthenticated'](),controller[_0xc236('0x38')]);router['post'](_0xc236('0x39'),auth[_0xc236('0xb')](),controller[_0xc236('0x3a')](_0xc236('0x3b')));router[_0xc236('0x7')]('/mail/queues/:id',auth[_0xc236('0xb')](),controller['showMailQueues']);router[_0xc236('0x3c')](_0xc236('0x3d'),auth[_0xc236('0xb')](),controller[_0xc236('0x3a')](_0xc236('0x3e')));router[_0xc236('0x7')](_0xc236('0x3f'),auth[_0xc236('0xb')](),controller[_0xc236('0x40')]);router[_0xc236('0x3c')](_0xc236('0x41'),auth[_0xc236('0xb')](),controller[_0xc236('0x3a')]('fax'));router[_0xc236('0x7')](_0xc236('0x42'),auth[_0xc236('0xb')](),controller['showFaxQueues']);router[_0xc236('0x3c')]('/openchannel/queues/:id/notify',auth[_0xc236('0xb')](),controller[_0xc236('0x3a')](_0xc236('0x43')));router[_0xc236('0x7')](_0xc236('0x44'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post'](_0xc236('0x45'),auth[_0xc236('0xb')](),controller[_0xc236('0x3a')]('sms'));router[_0xc236('0x3c')](_0xc236('0x46'),auth[_0xc236('0xb')](),controller[_0xc236('0x3a')](_0xc236('0x47')));router['get'](_0xc236('0x48'),auth[_0xc236('0xb')](),controller['showSmsQueues']);router[_0xc236('0x7')]('/whatsapp/queues/:id',auth[_0xc236('0xb')](),controller[_0xc236('0x49')]);router[_0xc236('0x3c')](_0xc236('0x4a'),auth[_0xc236('0xb')](),controller[_0xc236('0x4b')]);module[_0xc236('0x4c')]=router; \ No newline at end of file +var _0x6936=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x6936,0x12c));var _0x6693=function(_0x4463f8,_0x4cdd92){_0x4463f8=_0x4463f8-0x0;var _0x1db57d=_0x6936[_0x4463f8];return _0x1db57d;};'use strict';var multer=require(_0x6693('0x0'));var util=require(_0x6693('0x1'));var path=require(_0x6693('0x2'));var express=require(_0x6693('0x3'));var router=express[_0x6693('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0x6693('0x5'));router[_0x6693('0x6')](_0x6693('0x7'),auth[_0x6693('0x8')](),controller['voiceChannels']);router[_0x6693('0x6')](_0x6693('0x9'),auth[_0x6693('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0x6693('0xa'),auth[_0x6693('0x8')](),controller[_0x6693('0xb')]);router[_0x6693('0x6')]('/voice/queues',auth[_0x6693('0x8')](),controller[_0x6693('0xc')]);router[_0x6693('0x6')](_0x6693('0xd'),auth[_0x6693('0x8')](),controller[_0x6693('0xe')]);router['get'](_0x6693('0xf'),auth['isAuthenticated'](),controller[_0x6693('0x10')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0x6693('0x11')]);router[_0x6693('0x6')]('/openchannel/queues',auth[_0x6693('0x8')](),controller[_0x6693('0x12')]);router[_0x6693('0x6')](_0x6693('0x13'),auth[_0x6693('0x8')](),controller['smsQueues']);router['get'](_0x6693('0x14'),auth['isAuthenticated'](),controller[_0x6693('0x15')]);router[_0x6693('0x6')](_0x6693('0x16'),auth[_0x6693('0x8')](),controller[_0x6693('0x17')]);router[_0x6693('0x6')](_0x6693('0x18'),auth[_0x6693('0x8')](),controller[_0x6693('0x19')]);router['get'](_0x6693('0x1a'),auth[_0x6693('0x8')](),controller['voiceQueuesChannels']);router[_0x6693('0x6')](_0x6693('0x1b'),auth[_0x6693('0x8')](),controller['voiceQueuesChannel']);router[_0x6693('0x6')](_0x6693('0x1c'),auth[_0x6693('0x8')](),controller[_0x6693('0x1d')]);router[_0x6693('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x6693('0x8')](),controller[_0x6693('0x1e')]);router[_0x6693('0x6')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x6693('0x1f')]);router[_0x6693('0x20')](_0x6693('0x21'),auth[_0x6693('0x8')](),controller[_0x6693('0x22')]);router[_0x6693('0x6')](_0x6693('0x23'),auth[_0x6693('0x8')](),controller[_0x6693('0x24')]);router[_0x6693('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x6693('0x25')]);router[_0x6693('0x6')](_0x6693('0x26'),auth[_0x6693('0x8')](),controller[_0x6693('0x27')]);router['put'](_0x6693('0x28'),auth[_0x6693('0x8')](),controller[_0x6693('0x29')]);router['get'](_0x6693('0x2a'),auth['isAuthenticated'](),controller[_0x6693('0x2b')]);router[_0x6693('0x6')](_0x6693('0x2c'),auth[_0x6693('0x8')](),controller['trunks']);router[_0x6693('0x6')](_0x6693('0x2d'),auth[_0x6693('0x8')](),controller[_0x6693('0x2e')]);router[_0x6693('0x6')]('/fax/accounts',auth[_0x6693('0x8')](),controller[_0x6693('0x2f')]);router[_0x6693('0x6')]('/chat/queues/waitinginteractions',auth[_0x6693('0x8')](),controller[_0x6693('0x30')]);router[_0x6693('0x6')](_0x6693('0x31'),auth[_0x6693('0x8')](),controller[_0x6693('0x32')]);router[_0x6693('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x6693('0x8')](),controller[_0x6693('0x33')]);router['get'](_0x6693('0x34'),auth[_0x6693('0x8')](),controller[_0x6693('0x35')]);router['get'](_0x6693('0x36'),auth[_0x6693('0x8')](),controller[_0x6693('0x37')]);router[_0x6693('0x6')](_0x6693('0x38'),auth[_0x6693('0x8')](),controller[_0x6693('0x39')]);router[_0x6693('0x6')](_0x6693('0x3a'),auth[_0x6693('0x8')](),controller[_0x6693('0x3b')]);router['post'](_0x6693('0x3c'),auth[_0x6693('0x8')](),controller[_0x6693('0x3d')](_0x6693('0x3e')));router['get']('/mail/queues/:id',auth[_0x6693('0x8')](),controller[_0x6693('0x3f')]);router[_0x6693('0x40')](_0x6693('0x41'),auth[_0x6693('0x8')](),controller['queueNotify'](_0x6693('0x42')));router[_0x6693('0x6')](_0x6693('0x43'),auth[_0x6693('0x8')](),controller[_0x6693('0x44')]);router['post'](_0x6693('0x45'),auth[_0x6693('0x8')](),controller[_0x6693('0x3d')]('fax'));router['get']('/fax/queues/:id',auth[_0x6693('0x8')](),controller['showFaxQueues']);router['post'](_0x6693('0x46'),auth['isAuthenticated'](),controller['queueNotify'](_0x6693('0x47')));router[_0x6693('0x6')](_0x6693('0x48'),auth['isAuthenticated'](),controller[_0x6693('0x49')]);router[_0x6693('0x40')]('/sms/queues/:id/notify',auth[_0x6693('0x8')](),controller[_0x6693('0x3d')](_0x6693('0x4a')));router[_0x6693('0x40')](_0x6693('0x4b'),auth['isAuthenticated'](),controller[_0x6693('0x3d')](_0x6693('0x4c')));router['get']('/sms/queues/:id',auth[_0x6693('0x8')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x6693('0x8')](),controller[_0x6693('0x4d')]);router[_0x6693('0x40')](_0x6693('0x4e'),auth[_0x6693('0x8')](),controller[_0x6693('0x4f')]);module[_0x6693('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3a1d053..0b62c02 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['name','send','isNil','find','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','INTERACTION','agent','internal','AgentCapacity','telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','sendStatus','stack'];(function(_0x16822f,_0x4a9c03){var _0xbc663e=function(_0x15c95c){while(--_0x15c95c){_0x16822f['push'](_0x16822f['shift']());}};_0xbc663e(++_0x4a9c03);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1c9736,_0x38481a){_0x1c9736=_0x1c9736-0x0;var _0x9fe8e2=_0x8ef6[_0x1c9736];return _0x9fe8e2;};'use strict';var BPromise=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var util=require(_0x68ef('0x3'));var db=require(_0x68ef('0x4'))['db'];var logger=require(_0x68ef('0x5'))(_0x68ef('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232a});var mailClient=jayson[_0x68ef('0x7')][_0x68ef('0x8')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){var _0x31007e=_0x2de776?_0x2de776:amiClient;return _0x31007e[_0x68ef('0x9')](_0x3c2ff3,_0x4740e8)[_0x68ef('0xa')](function(_0x112b18){if(_0x112b18[_0x68ef('0xb')]){if(_0x112b18[_0x68ef('0xb')][_0x68ef('0xc')]===0x1f4){return _0x228967(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}return _0x4eb5eb(_0x112b18[_0x68ef('0xb')][_0x68ef('0xd')]);}else{_0x4eb5eb(_0x112b18['result']);}})[_0x68ef('0xe')](function(_0x46356f){_0x228967(_0x46356f);});});}function respondWithResult(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xc8;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0xf')](_0x454ef4)['json'](_0x40f253);}return _0x1e117a[_0x68ef('0x10')](0x194);};}function handleError(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0x1f4;return function(_0x47fbb5){logger[_0x68ef('0xb')](_0x47fbb5[_0x68ef('0x11')]);if(_0x47fbb5[_0x68ef('0x12')]){delete _0x47fbb5['name'];}_0xc50cce[_0x68ef('0xf')](_0x2657c5)[_0x68ef('0x13')](_0x47fbb5);};}function findById(_0x3d1e90){return function(_0x3780a4){if(!_['isNil'](_0x3d1e90)&&!_[_0x68ef('0x14')](_0x3780a4)&&!_['isNil'](_0x3780a4['rows'])){return _[_0x68ef('0x15')](_0x3780a4[_0x68ef('0x16')],function(_0x4ade0d){return _0x4ade0d['id']==_0x3d1e90;});}return null;};}exports['voiceChannels']=function(_0x3c4c1f,_0x2cd92c){return respondWithRpcPromise(_0x68ef('0x17'),_0x3c4c1f['query'])[_0x68ef('0xa')](respondWithResult(_0x2cd92c,null))[_0x68ef('0xe')](handleError(_0x2cd92c,null));};exports[_0x68ef('0x18')]=function(_0x5b246b,_0x3c46d4){return respondWithRpcPromise(_0x68ef('0x19'),_['merge'](_0x5b246b[_0x68ef('0x1a')],_0x5b246b[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x3c46d4,null))['catch'](handleError(_0x3c46d4,null));};exports['voiceChannelStopMixMonitor']=function(_0x59bebc,_0x26018d){return respondWithRpcPromise(_0x68ef('0x1c'),_[_0x68ef('0x1d')](_0x59bebc[_0x68ef('0x1a')],_0x59bebc[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x26018d,null))[_0x68ef('0xe')](handleError(_0x26018d,null));};exports[_0x68ef('0x1e')]=function(_0x65fd09,_0x13280b){return respondWithRpcPromise('VoiceQueues',_0x65fd09[_0x68ef('0x1a')])['then'](respondWithResult(_0x13280b,null))['catch'](handleError(_0x13280b,null));};exports['showVoiceQueues']=function(_0x1a7ce1,_0x268f32){return respondWithRpcPromise(_0x68ef('0x1f'),_0x1a7ce1[_0x68ef('0x1a')])['then'](findById(_0x1a7ce1['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x268f32,null))[_0x68ef('0xe')](handleError(_0x268f32,null));};exports[_0x68ef('0x20')]=function(_0x263b30,_0x22ef25){return respondWithRpcPromise(_0x68ef('0x21'),_[_0x68ef('0x1d')](_0x263b30[_0x68ef('0x22')],_0x263b30['params']))[_0x68ef('0xa')](respondWithResult(_0x22ef25,null))[_0x68ef('0xe')](handleError(_0x22ef25,null));};exports[_0x68ef('0x23')]=function(_0x4c25aa,_0x370a8f){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x68ef('0x1d')](_0x4c25aa[_0x68ef('0x1a')],_0x4c25aa['params']))['then'](respondWithResult(_0x370a8f,null))[_0x68ef('0xe')](handleError(_0x370a8f,null));};exports[_0x68ef('0x24')]=function(_0x4b8fc8,_0xf58fa1){return respondWithRpcPromise(_0x68ef('0x25'),_0x4b8fc8[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0xf58fa1,null))['catch'](handleError(_0xf58fa1,null));};exports[_0x68ef('0x26')]=function(_0x1d69ac,_0x5f137b){return respondWithRpcPromise(_0x68ef('0x27'),_['merge'](_0x1d69ac[_0x68ef('0x1a')],_0x1d69ac[_0x68ef('0x1b')]))['then'](respondWithResult(_0x5f137b,null))[_0x68ef('0xe')](handleError(_0x5f137b,null));};exports['voiceQueuesChannelHangup']=function(_0x38c2f8,_0x575f43){return respondWithRpcPromise(_0x68ef('0x28'),_[_0x68ef('0x1d')](_0x38c2f8[_0x68ef('0x1a')],_0x38c2f8['params']))[_0x68ef('0xa')](respondWithResult(_0x575f43,null))['catch'](handleError(_0x575f43,null));};exports[_0x68ef('0x29')]=function(_0x4c9506,_0x474ffa){return respondWithRpcPromise(_0x68ef('0x2a'),_[_0x68ef('0x1d')](_0x4c9506[_0x68ef('0x1a')],_0x4c9506[_0x68ef('0x1b')]))[_0x68ef('0xa')](respondWithResult(_0x474ffa,null))['catch'](handleError(_0x474ffa,null));};exports[_0x68ef('0x2b')]=function(_0x15a6ab,_0x32074a){return respondWithRpcPromise('Outbound',_0x15a6ab[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x32074a,null))[_0x68ef('0xe')](handleError(_0x32074a,null));};exports['outboundChannels']=function(_0x49f260,_0x14f0fc){return respondWithRpcPromise(_0x68ef('0x2c'),_0x49f260[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x14f0fc,null))[_0x68ef('0xe')](handleError(_0x14f0fc,null));};exports[_0x68ef('0x2d')]=function(_0x41ffe0,_0x5b1246){var _0xaf7df1;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')])[_0x68ef('0xa')](function(_0x492b74){_0xaf7df1=_0x492b74;return respondWithRpcPromise(_0x68ef('0x2e'),_0x41ffe0[_0x68ef('0x1a')],routingClient);})[_0x68ef('0xa')](function(_0x410c10){return _[_0x68ef('0x1d')]({},_0x410c10,_0xaf7df1);})[_0x68ef('0xa')](respondWithResult(_0x5b1246,null))['catch'](handleError(_0x5b1246,null));};exports[_0x68ef('0x2f')]=function(_0x3f7699,_0xf5010c){if(_0x3f7699[_0x68ef('0x22')]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]&&_0x3f7699[_0x68ef('0x31')]&&_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')]){for(var _0x531096 in _0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')]){if(_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x68ef('0x32')](_0x531096)){db[_0x68ef('0x33')][_0x68ef('0x34')]({'where':{'channel':_0x531096,'membername':_0x3f7699['user'][_0x68ef('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]&&_0x3f7699[_0x68ef('0x22')][_0x68ef('0x30')][_0x531096]['length']?{'$notIn':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096]}:{'$ne':null}}})[_0x68ef('0xa')](function(_0x499423){var _0x227e36=moment()[_0x68ef('0x35')](_0x68ef('0x36'));for(var _0x5c4a66=0x0,_0x59b148=_0x499423[_0x68ef('0x37')];_0x5c4a66<_0x59b148;_0x5c4a66+=0x1){_0x499423[_0x5c4a66][_0x68ef('0x38')]({'exitAt':_0x227e36});}});for(var _0x58d72a=0x0;_0x58d72a<_0x3f7699['body']['interaction'][_0x531096][_0x68ef('0x37')];_0x58d72a+=0x1){db[_0x68ef('0x33')][_0x68ef('0x39')]({'where':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'type':'INTERACTION','uniqueid':_0x3f7699['body'][_0x68ef('0x30')][_0x531096][_0x58d72a],'exitAt':null},'defaults':{'channel':_0x531096,'membername':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x12')],'interface':_[_0x68ef('0x14')](_0x3f7699['user'][_0x68ef('0x3a')])?util[_0x68ef('0x35')](_0x68ef('0x3b'),_0x3f7699[_0x68ef('0x31')]['name']):_0x3f7699['user'][_0x68ef('0x3a')],'type':_0x68ef('0x3c'),'enterAt':moment()['format'](_0x68ef('0x36')),'role':_0x68ef('0x3d'),'internal':_0x3f7699[_0x68ef('0x31')][_0x68ef('0x3e')],'uniqueid':_0x3f7699[_0x68ef('0x22')]['interaction'][_0x531096][_0x58d72a]}});}}}}return respondWithRpcPromise(_0x68ef('0x3f'),{'id':_0x3f7699[_0x68ef('0x1b')]['id'],'capacity':_0x3f7699[_0x68ef('0x22')]['capacity']},routingClient)[_0x68ef('0xa')](respondWithResult(_0xf5010c,null))[_0x68ef('0xe')](handleError(_0xf5010c,null));};exports[_0x68ef('0x40')]=function(_0x50ef1f,_0x7dce90){return respondWithRpcPromise('Telephones',_0x50ef1f['query'])[_0x68ef('0xa')](respondWithResult(_0x7dce90,null))['catch'](handleError(_0x7dce90,null));};exports[_0x68ef('0x41')]=function(_0xb33afd,_0x53ebd){return respondWithRpcPromise(_0x68ef('0x42'),_0xb33afd[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x53ebd,null))[_0x68ef('0xe')](handleError(_0x53ebd,null));};exports[_0x68ef('0x43')]=function(_0x2b35f4,_0x247915){return respondWithRpcPromise('Campaigns',_0x2b35f4['query'])[_0x68ef('0xa')](respondWithResult(_0x247915,null))[_0x68ef('0xe')](handleError(_0x247915,null));};exports[_0x68ef('0x44')]=function(_0xdc83f4,_0x82df12){return respondWithRpcPromise(_0x68ef('0x45'),_0xdc83f4[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x82df12,null))[_0x68ef('0xe')](handleError(_0x82df12,null));};exports['showChatQueues']=function(_0x5685bb,_0x42a4b2){return respondWithRpcPromise('ChatQueues',_0x5685bb[_0x68ef('0x1a')],routingClient)['then'](findById(_0x5685bb[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x42a4b2,null))['catch'](handleError(_0x42a4b2,null));};exports[_0x68ef('0x46')]=function(_0x4e097e,_0x407c6d){return respondWithRpcPromise(_0x68ef('0x47'),_0x4e097e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x407c6d,null))[_0x68ef('0xe')](handleError(_0x407c6d,null));};exports[_0x68ef('0x48')]=function(_0x5c347c,_0x1cdaef){return respondWithRpcPromise(_0x68ef('0x47'),_0x5c347c[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x5c347c[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x1cdaef,null))['catch'](handleError(_0x1cdaef,null));};exports[_0x68ef('0x49')]=function(_0x42d2a3,_0x4886af){return respondWithRpcPromise(_0x68ef('0x4a'),_0x42d2a3[_0x68ef('0x1a')],mailClient)[_0x68ef('0xa')](respondWithResult(_0x4886af,null))['catch'](handleError(_0x4886af,null));};exports[_0x68ef('0x4b')]=function(_0x49d197,_0x5412ea){return respondWithRpcPromise(_0x68ef('0x4c'),_0x49d197['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x5412ea,null))['catch'](handleError(_0x5412ea,null));};exports[_0x68ef('0x4d')]=function(_0x9e8554,_0x304405){return respondWithRpcPromise(_0x68ef('0x4c'),_0x9e8554[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x9e8554['params']['id']))[_0x68ef('0xa')](respondWithResult(_0x304405,null))['catch'](handleError(_0x304405,null));};exports[_0x68ef('0x4e')]=function(_0x4b0c3e,_0x2f97c5){return respondWithRpcPromise(_0x68ef('0x4f'),_0x4b0c3e[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x2f97c5,null))[_0x68ef('0xe')](handleError(_0x2f97c5,null));};exports[_0x68ef('0x50')]=function(_0x1be626,_0x52d29a){return respondWithRpcPromise(_0x68ef('0x4f'),_0x1be626[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](findById(_0x1be626[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x52d29a,null))['catch'](handleError(_0x52d29a,null));};exports[_0x68ef('0x51')]=function(_0x561e8d,_0x1ed172){return respondWithRpcPromise('WhatsappQueues',_0x561e8d['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1ed172,null))[_0x68ef('0xe')](handleError(_0x1ed172,null));};exports[_0x68ef('0x52')]=function(_0x21b2ce,_0x51f905){return respondWithRpcPromise(_0x68ef('0x53'),_0x21b2ce['query'],routingClient)[_0x68ef('0xa')](findById(_0x21b2ce[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x51f905,null))['catch'](handleError(_0x51f905,null));};exports['faxQueues']=function(_0x3e74d2,_0x1092f8){return respondWithRpcPromise(_0x68ef('0x54'),_0x3e74d2[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x1092f8,null))[_0x68ef('0xe')](handleError(_0x1092f8,null));};exports[_0x68ef('0x55')]=function(_0x19c20f,_0x21b104){return respondWithRpcPromise('FaxQueues',_0x19c20f[_0x68ef('0x1a')],routingClient)['then'](findById(_0x19c20f[_0x68ef('0x1b')]['id']))[_0x68ef('0xa')](respondWithResult(_0x21b104,null))[_0x68ef('0xe')](handleError(_0x21b104,null));};exports[_0x68ef('0x56')]=function(_0xed16d1,_0x52cb2a){return respondWithRpcPromise(_0x68ef('0x57'),_0xed16d1[_0x68ef('0x1a')])[_0x68ef('0xa')](respondWithResult(_0x52cb2a,null))['catch'](handleError(_0x52cb2a,null));};exports[_0x68ef('0x58')]=function(_0x4de108,_0x69b1c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4de108['query'],routingClient)[_0x68ef('0xa')](respondWithResult(_0x69b1c,null))[_0x68ef('0xe')](handleError(_0x69b1c,null));};exports[_0x68ef('0x59')]=function(_0x405971,_0x501004){return respondWithRpcPromise(_0x68ef('0x5a'),_0x405971[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x501004,null))['catch'](handleError(_0x501004,null));};exports[_0x68ef('0x5b')]=function(_0x2db826,_0xea2a81){return respondWithRpcPromise(_0x68ef('0x5c'),_0x2db826[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0xea2a81,null))[_0x68ef('0xe')](handleError(_0xea2a81,null));};exports[_0x68ef('0x5d')]=function(_0x156ce3,_0x11feff){return respondWithRpcPromise(_0x68ef('0x5c'),_0x156ce3[_0x68ef('0x1a')],routingClient)['then'](function(_0x15378c){if(_0x156ce3[_0x68ef('0x1a')]['type']!==undefined){var _0x513c69=_(_0x15378c[_0x68ef('0x16')])['filter']([_0x156ce3[_0x68ef('0x1a')][_0x68ef('0x5e')],_0x156ce3['params']['id']])['map'](_0x68ef('0x5f'))['uniq']()[_0x68ef('0x60')]();return _0x15378c['rows'][_0x68ef('0x61')](function(_0x4f425f){return _0x513c69[_0x68ef('0x62')](_0x4f425f[_0x68ef('0x5f')])>-0x1;});}else{return _0x15378c['rows'][_0x68ef('0x61')](function(_0x357be7){return _0x357be7[_0x68ef('0x5f')]===parseInt(_0x156ce3[_0x68ef('0x1b')]['id']);});}})['then'](respondWithResult(_0x11feff,null))[_0x68ef('0xe')](handleError(_0x11feff,null));};exports[_0x68ef('0x63')]=function(_0x5b2e89,_0x3bb3b6){return respondWithRpcPromise(_0x68ef('0x64'),_0x5b2e89[_0x68ef('0x1a')],routingClient)['then'](respondWithResult(_0x3bb3b6,null))[_0x68ef('0xe')](handleError(_0x3bb3b6,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xe6bf05,_0x36c109){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xe6bf05['query'],routingClient)['then'](respondWithResult(_0x36c109,null))['catch'](handleError(_0x36c109,null));};exports[_0x68ef('0x65')]=function(_0x28ad22,_0x1217f9){return respondWithRpcPromise(_0x68ef('0x66'),_0x28ad22[_0x68ef('0x1a')],routingClient)[_0x68ef('0xa')](respondWithResult(_0x1217f9,null))[_0x68ef('0xe')](handleError(_0x1217f9,null));};exports[_0x68ef('0x67')]=function(_0x24ba34){return function(_0x3ae3e9,_0x17892c){var _0x108223,_0x717d7b;var _0x4bd5c3=_[_0x68ef('0x68')](_0x24ba34);var _0x556dfc=_0x24ba34===_0x68ef('0x69')?'Website':'Account';return db[_0x4bd5c3+_0x68ef('0x6a')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x3ae3e9[_0x68ef('0x1b')]['id']}})[_0x68ef('0xa')](function(_0x518c9a){if(_['isNil'](_0x518c9a)){throw new Error(_0x4bd5c3+_0x68ef('0x6c'));}_0x108223=_0x518c9a;return db[_0x4bd5c3+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x3ae3e9['body'][_0x68ef('0x6e')]},'include':[{'model':db[_0x4bd5c3+_0x68ef('0x6f')],'as':_0x68ef('0x6f')},{'model':db[_0x4bd5c3+_0x556dfc],'as':_0x68ef('0x70')}]});})['then'](function(_0x214e89){if(_[_0x68ef('0x14')](_0x214e89)){throw new Error(_0x4bd5c3+_0x68ef('0x71'));}_0x717d7b=_0x214e89;return _0x214e89[_0x68ef('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x346049={'uniqueid':_0x24ba34+'.'+_0x717d7b['id']+'.'+_0x717d7b['Interaction']['id'],'FromUserId':_0x3ae3e9[_0x68ef('0x31')]['id'],'type':'queue'};_0x346049[_0x4bd5c3+_0x68ef('0x73')]=_0x717d7b['id'];_0x346049[_0x4bd5c3+_0x68ef('0x74')]=_0x717d7b[_0x68ef('0x6f')]['id'];_0x346049[_0x68ef('0x75')+_0x4bd5c3+_0x556dfc+'Id']=_0x717d7b['Account']['id'];_0x346049['To'+_0x4bd5c3+_0x68ef('0x76')]=_0x108223['id'];return db[_0x4bd5c3+'TransferReport'][_0x68ef('0x77')](_0x346049);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x24ba34,'interaction':_0x717d7b['Interaction'],'message':_0x717d7b,'account':_0x717d7b[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x108223[_0x68ef('0x12')]+','+(_0x717d7b['Account'][_0x68ef('0x78')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x17892c,null))[_0x68ef('0xe')](handleError(_0x17892c,null));};};exports[_0x68ef('0x7a')]=function(_0x66a7a8,_0x51b8db){var _0x17d014,_0x463356;if(_[_0x68ef('0x14')](_0x66a7a8[_0x68ef('0x22')][_0x68ef('0x7b')])){throw new Error(_0x68ef('0x7c'));}var _0x303add=_0x66a7a8['body'][_0x68ef('0x7b')];var _0x373ab4=_[_0x68ef('0x68')](_0x303add);var _0x2e20aa=_0x303add===_0x68ef('0x69')?_0x68ef('0x7d'):_0x68ef('0x70');return db[_0x68ef('0x7e')][_0x68ef('0x6b')]({'raw':!![],'where':{'id':_0x66a7a8['params']['id'],'role':_0x68ef('0x3d')}})['then'](function(_0x5f3b79){if(_['isNil'](_0x5f3b79)){throw new Error(_0x68ef('0x7f'));}_0x17d014=_0x5f3b79;return db[_0x373ab4+_0x68ef('0x6d')][_0x68ef('0x6b')]({'where':{'id':_0x66a7a8['body']['messageId']},'include':[{'model':db[_0x373ab4+'Interaction'],'as':_0x68ef('0x6f')},{'model':db[_0x373ab4+_0x2e20aa],'as':_0x68ef('0x70')}]});})[_0x68ef('0xa')](function(_0x40996e){if(_[_0x68ef('0x14')](_0x40996e)){throw new Error(_0x373ab4+_0x68ef('0x71'));}_0x463356=_0x40996e;return _0x40996e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x68ef('0xa')](function(){var _0x2c7f18={'uniqueid':_0x303add+'.'+_0x463356['id']+'.'+_0x463356[_0x68ef('0x6f')]['id'],'FromUserId':_0x66a7a8[_0x68ef('0x31')]['id'],'type':'queue','ToUserId':_0x17d014['id']};_0x2c7f18[_0x373ab4+_0x68ef('0x73')]=_0x463356['id'];_0x2c7f18[_0x373ab4+_0x68ef('0x74')]=_0x463356[_0x68ef('0x6f')]['id'];_0x2c7f18[_0x68ef('0x75')+_0x373ab4+_0x2e20aa+'Id']=_0x463356[_0x68ef('0x70')]['id'];return db[_0x373ab4+_0x68ef('0x80')][_0x68ef('0x77')](_0x2c7f18);})[_0x68ef('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x303add,'interaction':_0x463356[_0x68ef('0x6f')],'message':_0x463356,'account':_0x463356[_0x68ef('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x17d014[_0x68ef('0x12')]+','+(_0x463356[_0x68ef('0x70')][_0x68ef('0x81')]||0x12c),'interval':_0x68ef('0x79')}]},routingClient);})[_0x68ef('0xa')](respondWithResult(_0x51b8db,null))[_0x68ef('0xe')](handleError(_0x51b8db,null));}; \ No newline at end of file +var _0x8958=['faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','agentNotify','channel','Agent\x20not\x20found','Message','Start','agentTransferTimeout','*,*,*,*','moment','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','interaction','MemberReport','findAll','user','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions'];(function(_0x49d2f4,_0x33ac25){var _0xa980b3=function(_0x1b8d2f){while(--_0x1b8d2f){_0x49d2f4['push'](_0x49d2f4['shift']());}};_0xa980b3(++_0x33ac25);}(_0x8958,0x93));var _0x8895=function(_0xf97b12,_0x3032ff){_0xf97b12=_0xf97b12-0x0;var _0x556e5d=_0x8958[_0xf97b12];return _0x556e5d;};'use strict';var BPromise=require('bluebird');var moment=require(_0x8895('0x0'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8895('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232a});var mailClient=jayson[_0x8895('0x2')]['http']({'port':0x232b});var routingClient=jayson[_0x8895('0x2')][_0x8895('0x3')]({'port':0x232c});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){var _0xc2be9f=_0x33013a?_0x33013a:amiClient;return _0xc2be9f[_0x8895('0x4')](_0x124e1e,_0x40cec6)[_0x8895('0x5')](function(_0x6eab1e){if(_0x6eab1e[_0x8895('0x6')]){if(_0x6eab1e[_0x8895('0x6')][_0x8895('0x7')]===0x1f4){return _0xe018b8(_0x6eab1e[_0x8895('0x6')][_0x8895('0x8')]);}return _0x51376b(_0x6eab1e['error'][_0x8895('0x8')]);}else{_0x51376b(_0x6eab1e[_0x8895('0x9')]);}})[_0x8895('0xa')](function(_0x301bec){_0xe018b8(_0x301bec);});});}function respondWithResult(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xc8;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0xb')](_0xaf93bc)[_0x8895('0xc')](_0x5af0ef);}return _0x446e1a[_0x8895('0xd')](0x194);};}function handleError(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0x1f4;return function(_0x9191b8){logger['error'](_0x9191b8[_0x8895('0xe')]);if(_0x9191b8[_0x8895('0xf')]){delete _0x9191b8[_0x8895('0xf')];}_0x57d40a[_0x8895('0xb')](_0x47b9fe)[_0x8895('0x10')](_0x9191b8);};}function findById(_0x5b4c2e){return function(_0x4128e2){if(!_[_0x8895('0x11')](_0x5b4c2e)&&!_[_0x8895('0x11')](_0x4128e2)&&!_[_0x8895('0x11')](_0x4128e2[_0x8895('0x12')])){return _[_0x8895('0x13')](_0x4128e2[_0x8895('0x12')],function(_0x26cee0){return _0x26cee0['id']==_0x5b4c2e;});}return null;};}exports[_0x8895('0x14')]=function(_0x2da618,_0x24fef0){return respondWithRpcPromise(_0x8895('0x15'),_0x2da618[_0x8895('0x16')])['then'](respondWithResult(_0x24fef0,null))['catch'](handleError(_0x24fef0,null));};exports['voiceChannelMixMonitor']=function(_0x3daf43,_0x456282){return respondWithRpcPromise(_0x8895('0x17'),_[_0x8895('0x18')](_0x3daf43[_0x8895('0x16')],_0x3daf43[_0x8895('0x19')]))[_0x8895('0x5')](respondWithResult(_0x456282,null))[_0x8895('0xa')](handleError(_0x456282,null));};exports['voiceChannelStopMixMonitor']=function(_0x1a4c5b,_0x5db3a0){return respondWithRpcPromise(_0x8895('0x1a'),_[_0x8895('0x18')](_0x1a4c5b[_0x8895('0x16')],_0x1a4c5b['params']))['then'](respondWithResult(_0x5db3a0,null))[_0x8895('0xa')](handleError(_0x5db3a0,null));};exports[_0x8895('0x1b')]=function(_0x38f7ad,_0x24a376){return respondWithRpcPromise('VoiceQueues',_0x38f7ad[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x24a376,null))[_0x8895('0xa')](handleError(_0x24a376,null));};exports['showVoiceQueues']=function(_0x4aee03,_0x78b57){return respondWithRpcPromise('VoiceQueues',_0x4aee03[_0x8895('0x16')])[_0x8895('0x5')](findById(_0x4aee03[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x78b57,null))[_0x8895('0xa')](handleError(_0x78b57,null));};exports['updateVoiceQueue']=function(_0x4d567a,_0x6e449d){return respondWithRpcPromise(_0x8895('0x1c'),_[_0x8895('0x18')](_0x4d567a[_0x8895('0x1d')],_0x4d567a[_0x8895('0x19')]))['then'](respondWithResult(_0x6e449d,null))['catch'](handleError(_0x6e449d,null));};exports[_0x8895('0x1e')]=function(_0x848a11,_0x1c16f6){return respondWithRpcPromise(_0x8895('0x1f'),_[_0x8895('0x18')](_0x848a11['query'],_0x848a11[_0x8895('0x19')]))['then'](respondWithResult(_0x1c16f6,null))[_0x8895('0xa')](handleError(_0x1c16f6,null));};exports['voiceQueuesChannels']=function(_0x40ba14,_0x1a3fe5){return respondWithRpcPromise(_0x8895('0x20'),_0x40ba14[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1a3fe5,null))['catch'](handleError(_0x1a3fe5,null));};exports[_0x8895('0x21')]=function(_0xcba076,_0x1b5359){return respondWithRpcPromise(_0x8895('0x22'),_[_0x8895('0x18')](_0xcba076['query'],_0xcba076[_0x8895('0x19')]))['then'](respondWithResult(_0x1b5359,null))[_0x8895('0xa')](handleError(_0x1b5359,null));};exports['voiceQueuesChannelHangup']=function(_0x21c22b,_0x15a865){return respondWithRpcPromise(_0x8895('0x23'),_[_0x8895('0x18')](_0x21c22b[_0x8895('0x16')],_0x21c22b['params']))[_0x8895('0x5')](respondWithResult(_0x15a865,null))['catch'](handleError(_0x15a865,null));};exports[_0x8895('0x24')]=function(_0xcc735f,_0x36e13b){return respondWithRpcPromise(_0x8895('0x25'),_[_0x8895('0x18')](_0xcc735f[_0x8895('0x16')],_0xcc735f['params']))[_0x8895('0x5')](respondWithResult(_0x36e13b,null))[_0x8895('0xa')](handleError(_0x36e13b,null));};exports['outbound']=function(_0x2557fc,_0x54ca09){return respondWithRpcPromise(_0x8895('0x26'),_0x2557fc[_0x8895('0x16')])['then'](respondWithResult(_0x54ca09,null))[_0x8895('0xa')](handleError(_0x54ca09,null));};exports[_0x8895('0x27')]=function(_0x5b7204,_0x58751a){return respondWithRpcPromise(_0x8895('0x28'),_0x5b7204[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x58751a,null))[_0x8895('0xa')](handleError(_0x58751a,null));};exports[_0x8895('0x29')]=function(_0x4917d1,_0x42ed1f){var _0x25c854;return respondWithRpcPromise(_0x8895('0x2a'),_0x4917d1[_0x8895('0x16')])[_0x8895('0x5')](function(_0x534876){_0x25c854=_0x534876;return respondWithRpcPromise('Agents',_0x4917d1[_0x8895('0x16')],routingClient);})['then'](function(_0x20a521){return _[_0x8895('0x18')]({},_0x20a521,_0x25c854);})['then'](respondWithResult(_0x42ed1f,null))[_0x8895('0xa')](handleError(_0x42ed1f,null));};exports['agentCapacity']=function(_0x1e6395,_0x5e6413){if(_0x1e6395['body']&&_0x1e6395['body']['interaction']&&_0x1e6395['user']&&_0x1e6395['user'][_0x8895('0xf')]){for(var _0x206f57 in _0x1e6395['body']['interaction']){if(_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')]['hasOwnProperty'](_0x206f57)){db[_0x8895('0x2c')][_0x8895('0x2d')]({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')],'type':_0x8895('0x2f'),'exitAt':null,'uniqueid':_0x1e6395['body']['interaction'][_0x206f57]&&_0x1e6395['body'][_0x8895('0x2b')][_0x206f57]['length']?{'$notIn':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57]}:{'$ne':null}}})[_0x8895('0x5')](function(_0x28aaa9){var _0x587ccb=moment()[_0x8895('0x30')](_0x8895('0x31'));for(var _0x3413cd=0x0,_0x167302=_0x28aaa9[_0x8895('0x32')];_0x3413cd<_0x167302;_0x3413cd+=0x1){_0x28aaa9[_0x3413cd][_0x8895('0x33')]({'exitAt':_0x587ccb});}});for(var _0x14295a=0x0;_0x14295a<_0x1e6395[_0x8895('0x1d')]['interaction'][_0x206f57][_0x8895('0x32')];_0x14295a+=0x1){db[_0x8895('0x2c')]['findOrCreate']({'where':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'type':'INTERACTION','uniqueid':_0x1e6395[_0x8895('0x1d')][_0x8895('0x2b')][_0x206f57][_0x14295a],'exitAt':null},'defaults':{'channel':_0x206f57,'membername':_0x1e6395[_0x8895('0x2e')]['name'],'interface':_[_0x8895('0x11')](_0x1e6395['user'][_0x8895('0x34')])?util[_0x8895('0x30')](_0x8895('0x35'),_0x1e6395[_0x8895('0x2e')][_0x8895('0xf')]):_0x1e6395[_0x8895('0x2e')][_0x8895('0x34')],'type':'INTERACTION','enterAt':moment()['format'](_0x8895('0x31')),'role':_0x8895('0x36'),'internal':_0x1e6395['user'][_0x8895('0x37')],'uniqueid':_0x1e6395['body']['interaction'][_0x206f57][_0x14295a]}});}}}}return respondWithRpcPromise(_0x8895('0x38'),{'id':_0x1e6395['params']['id'],'capacity':_0x1e6395[_0x8895('0x1d')][_0x8895('0x39')]},routingClient)[_0x8895('0x5')](respondWithResult(_0x5e6413,null))[_0x8895('0xa')](handleError(_0x5e6413,null));};exports[_0x8895('0x3a')]=function(_0x39a1d9,_0x306481){return respondWithRpcPromise(_0x8895('0x3b'),_0x39a1d9['query'])[_0x8895('0x5')](respondWithResult(_0x306481,null))[_0x8895('0xa')](handleError(_0x306481,null));};exports[_0x8895('0x3c')]=function(_0x5a5bc6,_0x1935aa){return respondWithRpcPromise(_0x8895('0x3d'),_0x5a5bc6[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x1935aa,null))[_0x8895('0xa')](handleError(_0x1935aa,null));};exports[_0x8895('0x3e')]=function(_0x434ab8,_0x216e6e){return respondWithRpcPromise(_0x8895('0x3f'),_0x434ab8[_0x8895('0x16')])['then'](respondWithResult(_0x216e6e,null))[_0x8895('0xa')](handleError(_0x216e6e,null));};exports[_0x8895('0x40')]=function(_0xb3d1ab,_0x10560a){return respondWithRpcPromise(_0x8895('0x41'),_0xb3d1ab['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x10560a,null))[_0x8895('0xa')](handleError(_0x10560a,null));};exports[_0x8895('0x42')]=function(_0x3d17bd,_0x37a7b4){return respondWithRpcPromise('ChatQueues',_0x3d17bd[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x3d17bd[_0x8895('0x19')]['id']))['then'](respondWithResult(_0x37a7b4,null))[_0x8895('0xa')](handleError(_0x37a7b4,null));};exports[_0x8895('0x43')]=function(_0x2c777b,_0x4ec8eb){return respondWithRpcPromise(_0x8895('0x44'),_0x2c777b[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x4ec8eb,null))[_0x8895('0xa')](handleError(_0x4ec8eb,null));};exports[_0x8895('0x45')]=function(_0x5198f8,_0x2f990a){return respondWithRpcPromise(_0x8895('0x44'),_0x5198f8[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x5198f8['params']['id']))['then'](respondWithResult(_0x2f990a,null))[_0x8895('0xa')](handleError(_0x2f990a,null));};exports[_0x8895('0x46')]=function(_0x49877,_0x51eb9c){return respondWithRpcPromise(_0x8895('0x47'),_0x49877[_0x8895('0x16')],mailClient)['then'](respondWithResult(_0x51eb9c,null))[_0x8895('0xa')](handleError(_0x51eb9c,null));};exports['openchannelQueues']=function(_0x435e36,_0x2bd955){return respondWithRpcPromise(_0x8895('0x48'),_0x435e36[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x2bd955,null))['catch'](handleError(_0x2bd955,null));};exports['showOpenchannelQueues']=function(_0x239401,_0x216abb){return respondWithRpcPromise('OpenchannelQueues',_0x239401[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x239401[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x216abb,null))['catch'](handleError(_0x216abb,null));};exports[_0x8895('0x49')]=function(_0x2d2bf9,_0x1b1bc0){return respondWithRpcPromise(_0x8895('0x4a'),_0x2d2bf9[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x1b1bc0,null))[_0x8895('0xa')](handleError(_0x1b1bc0,null));};exports[_0x8895('0x4b')]=function(_0x2bffd7,_0x21c7bb){return respondWithRpcPromise(_0x8895('0x4a'),_0x2bffd7[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x2bffd7[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x21c7bb,null))['catch'](handleError(_0x21c7bb,null));};exports['whatsappQueues']=function(_0x5b96fe,_0x13b143){return respondWithRpcPromise(_0x8895('0x4c'),_0x5b96fe[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x13b143,null))[_0x8895('0xa')](handleError(_0x13b143,null));};exports['showWhatsappQueues']=function(_0x816803,_0xc6af80){return respondWithRpcPromise('WhatsappQueues',_0x816803[_0x8895('0x16')],routingClient)[_0x8895('0x5')](findById(_0x816803[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0xc6af80,null))[_0x8895('0xa')](handleError(_0xc6af80,null));};exports['faxQueues']=function(_0x6440ea,_0x3c318c){return respondWithRpcPromise(_0x8895('0x4d'),_0x6440ea[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0x3c318c,null))[_0x8895('0xa')](handleError(_0x3c318c,null));};exports[_0x8895('0x4e')]=function(_0x5e7048,_0x10d395){return respondWithRpcPromise(_0x8895('0x4d'),_0x5e7048['query'],routingClient)[_0x8895('0x5')](findById(_0x5e7048[_0x8895('0x19')]['id']))[_0x8895('0x5')](respondWithResult(_0x10d395,null))[_0x8895('0xa')](handleError(_0x10d395,null));};exports[_0x8895('0x4f')]=function(_0x560381,_0x16cd17){return respondWithRpcPromise('FaxAccounts',_0x560381[_0x8895('0x16')])[_0x8895('0x5')](respondWithResult(_0x16cd17,null))['catch'](handleError(_0x16cd17,null));};exports[_0x8895('0x50')]=function(_0x24f1c5,_0x140b2a){return respondWithRpcPromise(_0x8895('0x51'),_0x24f1c5['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x140b2a,null))['catch'](handleError(_0x140b2a,null));};exports['mailQueuesWaitingInteractions']=function(_0x1a198d,_0x185351){return respondWithRpcPromise(_0x8895('0x52'),_0x1a198d['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x185351,null))['catch'](handleError(_0x185351,null));};exports[_0x8895('0x53')]=function(_0x930a13,_0x3893fb){return respondWithRpcPromise(_0x8895('0x54'),_0x930a13[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x3893fb,null))['catch'](handleError(_0x3893fb,null));};exports[_0x8895('0x55')]=function(_0x5517a2,_0x3707a6){return respondWithRpcPromise(_0x8895('0x54'),_0x5517a2['query'],routingClient)[_0x8895('0x5')](function(_0xd9637a){if(_0x5517a2[_0x8895('0x16')][_0x8895('0x56')]!==undefined){var _0x166e9a=_(_0xd9637a['rows'])[_0x8895('0x57')]([_0x5517a2['query']['type'],_0x5517a2[_0x8895('0x19')]['id']])['map'](_0x8895('0x58'))[_0x8895('0x59')]()[_0x8895('0x5a')]();return _0xd9637a[_0x8895('0x12')]['filter'](function(_0x4d802e){return _0x166e9a['indexOf'](_0x4d802e[_0x8895('0x58')])>-0x1;});}else{return _0xd9637a[_0x8895('0x12')][_0x8895('0x57')](function(_0x14fd1f){return _0x14fd1f[_0x8895('0x58')]===parseInt(_0x5517a2[_0x8895('0x19')]['id']);});}})['then'](respondWithResult(_0x3707a6,null))[_0x8895('0xa')](handleError(_0x3707a6,null));};exports[_0x8895('0x5b')]=function(_0x4deccc,_0x584a1f){return respondWithRpcPromise(_0x8895('0x5c'),_0x4deccc['query'],routingClient)[_0x8895('0x5')](respondWithResult(_0x584a1f,null))['catch'](handleError(_0x584a1f,null));};exports[_0x8895('0x5d')]=function(_0x452756,_0x553437){return respondWithRpcPromise(_0x8895('0x5e'),_0x452756[_0x8895('0x16')],routingClient)['then'](respondWithResult(_0x553437,null))[_0x8895('0xa')](handleError(_0x553437,null));};exports[_0x8895('0x5f')]=function(_0x2af98f,_0xef59db){return respondWithRpcPromise(_0x8895('0x60'),_0x2af98f[_0x8895('0x16')],routingClient)[_0x8895('0x5')](respondWithResult(_0xef59db,null))['catch'](handleError(_0xef59db,null));};exports[_0x8895('0x61')]=function(_0x5ada19){return function(_0x330506,_0x1f583a){var _0x32d52c,_0x325597;var _0x4e6691=_[_0x8895('0x62')](_0x5ada19);var _0x1d50f6=_0x5ada19===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db[_0x4e6691+_0x8895('0x66')][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x330506[_0x8895('0x19')]['id']}})['then'](function(_0x3b4092){if(_[_0x8895('0x11')](_0x3b4092)){throw new Error(_0x4e6691+'\x20Queue\x20not\x20found');}_0x32d52c=_0x3b4092;return db[_0x4e6691+'Message'][_0x8895('0x67')]({'where':{'id':_0x330506[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x4e6691+_0x8895('0x69')],'as':'Interaction'},{'model':db[_0x4e6691+_0x1d50f6],'as':'Account'}]});})[_0x8895('0x5')](function(_0x42ebe2){if(_[_0x8895('0x11')](_0x42ebe2)){throw new Error(_0x4e6691+_0x8895('0x6a'));}_0x325597=_0x42ebe2;return _0x42ebe2[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2cd8b0={'uniqueid':_0x5ada19+'.'+_0x325597['id']+'.'+_0x325597[_0x8895('0x69')]['id'],'FromUserId':_0x330506['user']['id'],'type':_0x8895('0x6c')};_0x2cd8b0[_0x4e6691+_0x8895('0x6d')]=_0x325597['id'];_0x2cd8b0[_0x4e6691+_0x8895('0x6e')]=_0x325597[_0x8895('0x69')]['id'];_0x2cd8b0[_0x8895('0x6f')+_0x4e6691+_0x1d50f6+'Id']=_0x325597[_0x8895('0x65')]['id'];_0x2cd8b0['To'+_0x4e6691+'QueueId']=_0x32d52c['id'];return db[_0x4e6691+_0x8895('0x70')][_0x8895('0x71')](_0x2cd8b0);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5ada19,'interaction':_0x325597['Interaction'],'message':_0x325597,'account':_0x325597[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8895('0x6c'),'appdata':_0x32d52c['name']+','+(_0x325597[_0x8895('0x65')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1f583a,null))[_0x8895('0xa')](handleError(_0x1f583a,null));};};exports[_0x8895('0x72')]=function(_0x28d7ab,_0x20b607){var _0x605f47,_0x54cf18;if(_[_0x8895('0x11')](_0x28d7ab[_0x8895('0x1d')][_0x8895('0x73')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x4a4d4b=_0x28d7ab['body'][_0x8895('0x73')];var _0x1d796a=_[_0x8895('0x62')](_0x4a4d4b);var _0x2084b1=_0x4a4d4b===_0x8895('0x63')?_0x8895('0x64'):_0x8895('0x65');return db['User'][_0x8895('0x67')]({'raw':!![],'where':{'id':_0x28d7ab['params']['id'],'role':_0x8895('0x36')}})['then'](function(_0x2f2908){if(_[_0x8895('0x11')](_0x2f2908)){throw new Error(_0x8895('0x74'));}_0x605f47=_0x2f2908;return db[_0x1d796a+_0x8895('0x75')][_0x8895('0x67')]({'where':{'id':_0x28d7ab[_0x8895('0x1d')][_0x8895('0x68')]},'include':[{'model':db[_0x1d796a+'Interaction'],'as':_0x8895('0x69')},{'model':db[_0x1d796a+_0x2084b1],'as':_0x8895('0x65')}]});})[_0x8895('0x5')](function(_0x3ce240){if(_[_0x8895('0x11')](_0x3ce240)){throw new Error(_0x1d796a+'\x20Message\x20not\x20found');}_0x54cf18=_0x3ce240;return _0x3ce240[_0x8895('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x20f574={'uniqueid':_0x4a4d4b+'.'+_0x54cf18['id']+'.'+_0x54cf18[_0x8895('0x69')]['id'],'FromUserId':_0x28d7ab[_0x8895('0x2e')]['id'],'type':_0x8895('0x6c'),'ToUserId':_0x605f47['id']};_0x20f574[_0x1d796a+_0x8895('0x6d')]=_0x54cf18['id'];_0x20f574[_0x1d796a+_0x8895('0x6e')]=_0x54cf18[_0x8895('0x69')]['id'];_0x20f574[_0x8895('0x6f')+_0x1d796a+_0x2084b1+'Id']=_0x54cf18[_0x8895('0x65')]['id'];return db[_0x1d796a+'TransferReport'][_0x8895('0x71')](_0x20f574);})['then'](function(){return respondWithRpcPromise(_0x8895('0x76'),{'channel':_0x4a4d4b,'interaction':_0x54cf18[_0x8895('0x69')],'message':_0x54cf18,'account':_0x54cf18[_0x8895('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x605f47[_0x8895('0xf')]+','+(_0x54cf18['Account'][_0x8895('0x77')]||0x12c),'interval':_0x8895('0x78')}]},routingClient);})[_0x8895('0x5')](respondWithResult(_0x20b607,null))[_0x8895('0xa')](handleError(_0x20b607,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8cf52d3..dd419dd 100644 --- a/server/api/schedule/index.js +++ b/server/api/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0b5=['run','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id/run'];(function(_0x50e30b,_0x216368){var _0x4b7300=function(_0x8f06d7){while(--_0x8f06d7){_0x50e30b['push'](_0x50e30b['shift']());}};_0x4b7300(++_0x216368);}(_0xb0b5,0x125));var _0x5b0b=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xb0b5[_0x420b24];return _0x4da552;};'use strict';var multer=require(_0x5b0b('0x0'));var util=require(_0x5b0b('0x1'));var path=require(_0x5b0b('0x2'));var timeout=require(_0x5b0b('0x3'));var express=require(_0x5b0b('0x4'));var router=express[_0x5b0b('0x5')]();var fs_extra=require(_0x5b0b('0x6'));var auth=require(_0x5b0b('0x7'));var interaction=require(_0x5b0b('0x8'));var config=require(_0x5b0b('0x9'));var controller=require(_0x5b0b('0xa'));router[_0x5b0b('0xb')]('/',auth[_0x5b0b('0xc')](),controller[_0x5b0b('0xd')]);router['get']('/:id',auth[_0x5b0b('0xc')](),controller['show']);router[_0x5b0b('0xb')](_0x5b0b('0xe'),auth['isAuthenticated'](),controller[_0x5b0b('0xf')]);router[_0x5b0b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5b0b('0x11'),auth['isAuthenticated'](),controller[_0x5b0b('0x12')]);router[_0x5b0b('0x13')](_0x5b0b('0x11'),auth[_0x5b0b('0xc')](),controller[_0x5b0b('0x14')]);module[_0x5b0b('0x15')]=router; \ No newline at end of file +var _0xc347=['/:id','show','run','post','create','put','update','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xc347,0x149));var _0x7c34=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xc347[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0x7c34('0x0'));var util=require(_0x7c34('0x1'));var path=require(_0x7c34('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7c34('0x3'));var auth=require(_0x7c34('0x4'));var interaction=require(_0x7c34('0x5'));var config=require(_0x7c34('0x6'));var controller=require(_0x7c34('0x7'));router[_0x7c34('0x8')]('/',auth[_0x7c34('0x9')](),controller[_0x7c34('0xa')]);router['get'](_0x7c34('0xb'),auth[_0x7c34('0x9')](),controller[_0x7c34('0xc')]);router[_0x7c34('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0x7c34('0xd')]);router[_0x7c34('0xe')]('/',auth['isAuthenticated'](),controller[_0x7c34('0xf')]);router[_0x7c34('0x10')](_0x7c34('0xb'),auth[_0x7c34('0x9')](),controller[_0x7c34('0x11')]);router[_0x7c34('0x12')](_0x7c34('0xb'),auth['isAuthenticated'](),controller[_0x7c34('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b44294a..971e9da 100644 --- a/server/api/schedule/schedule.attributes.js +++ b/server/api/schedule/schedule.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7227=['BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','years','quarters','weeks','days','ENUM','csv','xlsx','custom','default'];(function(_0xa7999c,_0x19ed4e){var _0x4106ef=function(_0x31f631){while(--_0x31f631){_0xa7999c['push'](_0xa7999c['shift']());}};_0x4106ef(++_0x19ed4e);}(_0x7227,0xf2));var _0x7722=function(_0x4c21ee,_0x217ce3){_0x4c21ee=_0x4c21ee-0x0;var _0x34e9dc=_0x7227[_0x4c21ee];return _0x34e9dc;};'use strict';var Sequelize=require(_0x7722('0x0'));module['exports']={'name':{'type':Sequelize[_0x7722('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7722('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7722('0x2')},'startAt':{'type':Sequelize[_0x7722('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7722('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x7722('0x4'),_0x7722('0x5'),'months',_0x7722('0x6'),_0x7722('0x7'),'hours','minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x7722('0x8')](_0x7722('0x9'),'pdf',_0x7722('0xa')),'allowNull':![],'defaultValue':_0x7722('0x9')},'type':{'type':Sequelize['ENUM'](_0x7722('0xb'),_0x7722('0xc')),'allowNull':![],'defaultValue':_0x7722('0xb')},'sendMail':{'type':Sequelize[_0x7722('0xd')],'defaultValue':![]},'email':{'type':Sequelize[_0x7722('0x1')]},'cc':{'type':Sequelize[_0x7722('0xe')]},'bcc':{'type':Sequelize[_0x7722('0xe')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x69d1=['minutes','pdf','xlsx','csv','default','custom','BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','days','hours'];(function(_0x3a3460,_0x20c0bf){var _0x3927be=function(_0x3a50f5){while(--_0x3a50f5){_0x3a3460['push'](_0x3a3460['shift']());}};_0x3927be(++_0x20c0bf);}(_0x69d1,0xff));var _0x169d=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x69d1[_0x4f0e62];return _0x117ab8;};'use strict';var Sequelize=require(_0x169d('0x0'));module['exports']={'name':{'type':Sequelize[_0x169d('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x169d('0x1')],'allowNull':![],'defaultValue':_0x169d('0x2')},'startAt':{'type':Sequelize[_0x169d('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x169d('0x4')](_0x169d('0x5'),_0x169d('0x6'),_0x169d('0x7'),_0x169d('0x8'),_0x169d('0x9'),_0x169d('0xa'),_0x169d('0xb')),'allowNull':![],'defaultValue':_0x169d('0x9')},'output':{'type':Sequelize[_0x169d('0x4')]('csv',_0x169d('0xc'),_0x169d('0xd')),'allowNull':![],'defaultValue':_0x169d('0xe')},'type':{'type':Sequelize[_0x169d('0x4')]('custom',_0x169d('0xf')),'allowNull':![],'defaultValue':_0x169d('0x10')},'sendMail':{'type':Sequelize[_0x169d('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0x169d('0x1')]},'cc':{'type':Sequelize[_0x169d('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d17f6e5..29fcb32 100644 --- a/server/api/schedule/schedule.controller.js +++ b/server/api/schedule/schedule.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c95=['request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','zip-dir','fast-json-patch'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x5c95,0x1ab));var _0x55c9=function(_0x3e1721,_0x53af68){_0x3e1721=_0x3e1721-0x0;var _0xf195b3=_0x5c95[_0x3e1721];return _0xf195b3;};'use strict';var emlformat=require(_0x55c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x55c9('0x1'));var jsonpatch=require(_0x55c9('0x2'));var rp=require(_0x55c9('0x3'));var moment=require(_0x55c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x55c9('0x5'));var util=require(_0x55c9('0x6'));var path=require('path');var sox=require(_0x55c9('0x7'));var csv=require(_0x55c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55c9('0x9'));var squel=require(_0x55c9('0xa'));var crypto=require(_0x55c9('0xb'));var jsforce=require(_0x55c9('0xc'));var deskjs=require(_0x55c9('0xd'));var toCsv=require(_0x55c9('0x8'));var querystring=require(_0x55c9('0xe'));var Papa=require(_0x55c9('0xf'));var Redis=require(_0x55c9('0x10'));var authService=require(_0x55c9('0x11'));var qs=require(_0x55c9('0x12'));var as=require(_0x55c9('0x13'));var hardwareService=require(_0x55c9('0x14'));var logger=require(_0x55c9('0x15'))(_0x55c9('0x16'));var utils=require(_0x55c9('0x17'));var config=require(_0x55c9('0x18'));var licenseUtil=require(_0x55c9('0x19'));var db=require(_0x55c9('0x1a'))['db'];function respondWithStatusCode(_0x1f0112,_0x4947d7){_0x4947d7=_0x4947d7||0xcc;return function(_0x24a232){if(_0x24a232){return _0x1f0112[_0x55c9('0x1b')](_0x4947d7);}return _0x1f0112[_0x55c9('0x1c')](_0x4947d7)[_0x55c9('0x1d')]();};}function respondWithResult(_0x49a08a,_0x3a3632){_0x3a3632=_0x3a3632||0xc8;return function(_0x524e75){if(_0x524e75){return _0x49a08a[_0x55c9('0x1c')](_0x3a3632)[_0x55c9('0x1e')](_0x524e75);}};}function respondWithFilteredResult(_0x372744,_0x56bd34){return function(_0x311b01){if(_0x311b01){var _0x92c0a7=typeof _0x56bd34['offset']===_0x55c9('0x1f')&&typeof _0x56bd34[_0x55c9('0x20')]==='undefined';var _0x495355=_0x311b01[_0x55c9('0x21')];var _0x480522=_0x92c0a7?0x0:_0x56bd34[_0x55c9('0x22')];var _0x27a038=_0x92c0a7?_0x311b01[_0x55c9('0x21')]:_0x56bd34[_0x55c9('0x22')]+_0x56bd34[_0x55c9('0x20')];var _0x1b9439;if(_0x27a038>=_0x495355){_0x27a038=_0x495355;_0x1b9439=0xc8;}else{_0x1b9439=0xce;}_0x372744[_0x55c9('0x1c')](_0x1b9439);return _0x372744[_0x55c9('0x23')]('Content-Range',_0x480522+'-'+_0x27a038+'/'+_0x495355)['json'](_0x311b01);}return null;};}function patchUpdates(_0x5ba9c2){return function(_0xec2a92){try{jsonpatch[_0x55c9('0x24')](_0xec2a92,_0x5ba9c2,!![]);}catch(_0x3f4fec){return BPromise[_0x55c9('0x25')](_0x3f4fec);}return _0xec2a92['save']();};}function saveUpdates(_0x4b1fa3,_0x21fcc2){return function(_0x5d15bd){if(_0x5d15bd){return _0x5d15bd[_0x55c9('0x26')](_0x4b1fa3)[_0x55c9('0x27')](function(_0x3bcb22){return _0x3bcb22;});}return null;};}function removeEntity(_0x133874,_0x221a35){return function(_0x250eda){if(_0x250eda){return _0x250eda[_0x55c9('0x28')]()[_0x55c9('0x27')](function(){var _0x5968af=_0x250eda[_0x55c9('0x29')]({'plain':!![]});var _0x2e089a=_0x55c9('0x2a');return db[_0x55c9('0x2b')][_0x55c9('0x28')]({'where':{'type':_0x2e089a,'resourceId':_0x5968af['id']}})[_0x55c9('0x27')](function(){return _0x250eda;});})['then'](function(){_0x133874[_0x55c9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8a23,_0x297cef){return function(_0x3051df){if(!_0x3051df){_0x5e8a23[_0x55c9('0x1b')](0x194);}return _0x3051df;};}function handleError(_0x39bb96,_0x195e20){_0x195e20=_0x195e20||0x1f4;return function(_0x5f4927){logger[_0x55c9('0x2c')](_0x5f4927[_0x55c9('0x2d')]);if(_0x5f4927[_0x55c9('0x2e')]){delete _0x5f4927[_0x55c9('0x2e')];}_0x39bb96[_0x55c9('0x1c')](_0x195e20)[_0x55c9('0x2f')](_0x5f4927);};}exports[_0x55c9('0x30')]=function(_0x2afe76,_0xf17f10){var _0xe89347={},_0x1dbf87={},_0x4bc042={'count':0x0,'rows':[]};var _0x462aec=_['map'](db[_0x55c9('0x31')][_0x55c9('0x32')],function(_0x5e647a){return{'name':_0x5e647a[_0x55c9('0x33')],'type':_0x5e647a[_0x55c9('0x34')][_0x55c9('0x35')]};});_0x1dbf87[_0x55c9('0x36')]=_[_0x55c9('0x37')](_0x462aec,_0x55c9('0x2e'));_0x1dbf87[_0x55c9('0x38')]=_['keys'](_0x2afe76[_0x55c9('0x38')]);_0x1dbf87[_0x55c9('0x39')]=_['intersection'](_0x1dbf87[_0x55c9('0x36')],_0x1dbf87[_0x55c9('0x38')]);_0xe89347['attributes']=_[_0x55c9('0x3a')](_0x1dbf87['model'],qs[_0x55c9('0x3b')](_0x2afe76[_0x55c9('0x38')][_0x55c9('0x3b')]));_0xe89347[_0x55c9('0x3c')]=_0xe89347[_0x55c9('0x3c')]['length']?_0xe89347['attributes']:_0x1dbf87[_0x55c9('0x36')];if(!_0x2afe76[_0x55c9('0x38')][_0x55c9('0x3d')]('nolimit')){_0xe89347['limit']=qs[_0x55c9('0x20')](_0x2afe76['query'][_0x55c9('0x20')]);_0xe89347[_0x55c9('0x22')]=qs[_0x55c9('0x22')](_0x2afe76['query'][_0x55c9('0x22')]);}_0xe89347['order']=qs[_0x55c9('0x3e')](_0x2afe76[_0x55c9('0x38')][_0x55c9('0x3e')]);_0xe89347[_0x55c9('0x3f')]=qs['filters'](_[_0x55c9('0x40')](_0x2afe76['query'],_0x1dbf87[_0x55c9('0x39')]),_0x462aec);if(_0x2afe76[_0x55c9('0x38')][_0x55c9('0x41')]){_0xe89347[_0x55c9('0x3f')]=_['merge'](_0xe89347[_0x55c9('0x3f')],{'$or':_[_0x55c9('0x37')](_0x462aec,function(_0x1c6574){if(_0x1c6574[_0x55c9('0x34')]!==_0x55c9('0x42')){var _0x24b992={};_0x24b992[_0x1c6574['name']]={'$like':'%'+_0x2afe76['query'][_0x55c9('0x41')]+'%'};return _0x24b992;}})});}_0xe89347=_[_0x55c9('0x43')]({},_0xe89347,_0x2afe76['options']);var _0x42c794={'where':_0xe89347['where']};return db[_0x55c9('0x31')][_0x55c9('0x21')](_0x42c794)['then'](function(_0x5156f8){_0x4bc042['count']=_0x5156f8;if(_0x2afe76[_0x55c9('0x38')][_0x55c9('0x44')]){_0xe89347['include']=[{'all':!![]}];}return db[_0x55c9('0x31')][_0x55c9('0x45')](_0xe89347);})['then'](function(_0x48d05f){_0x4bc042['rows']=_0x48d05f;return _0x4bc042;})[_0x55c9('0x27')](respondWithFilteredResult(_0xf17f10,_0xe89347))[_0x55c9('0x46')](handleError(_0xf17f10,null));};exports[_0x55c9('0x47')]=function(_0x123f5b,_0x29d9d5){var _0x115487={'raw':![],'where':{'id':_0x123f5b[_0x55c9('0x48')]['id']}},_0x239d35={};_0x239d35[_0x55c9('0x36')]=_[_0x55c9('0x49')](db[_0x55c9('0x31')][_0x55c9('0x32')]);_0x239d35['query']=_[_0x55c9('0x49')](_0x123f5b[_0x55c9('0x38')]);_0x239d35[_0x55c9('0x39')]=_[_0x55c9('0x3a')](_0x239d35[_0x55c9('0x36')],_0x239d35[_0x55c9('0x38')]);_0x115487[_0x55c9('0x3c')]=_[_0x55c9('0x3a')](_0x239d35['model'],qs['fields'](_0x123f5b[_0x55c9('0x38')][_0x55c9('0x3b')]));_0x115487[_0x55c9('0x3c')]=_0x115487[_0x55c9('0x3c')][_0x55c9('0x4a')]?_0x115487[_0x55c9('0x3c')]:_0x239d35[_0x55c9('0x36')];if(_0x123f5b[_0x55c9('0x38')][_0x55c9('0x44')]){_0x115487['include']=[{'all':!![]}];}_0x115487=_[_0x55c9('0x43')]({},_0x115487,_0x123f5b['options']);return db[_0x55c9('0x31')][_0x55c9('0x4b')](_0x115487)['then'](handleEntityNotFound(_0x29d9d5,null))[_0x55c9('0x27')](respondWithResult(_0x29d9d5,null))['catch'](handleError(_0x29d9d5,null));};exports[_0x55c9('0x4c')]=function(_0x259487,_0x1e749f){return db[_0x55c9('0x31')][_0x55c9('0x4c')](_0x259487[_0x55c9('0x4d')],{})[_0x55c9('0x27')](function(_0x11f6db){var _0x396e7b=_0x259487[_0x55c9('0x4e')]['get']({'plain':!![]});if(!_0x396e7b)throw new Error(_0x55c9('0x4f'));if(_0x396e7b[_0x55c9('0x50')]==='user'){var _0x59be99=_0x11f6db[_0x55c9('0x29')]({'plain':!![]});var _0x2653f1=_0x55c9('0x2a');return db['UserProfileSection'][_0x55c9('0x4b')]({'where':{'name':_0x2653f1,'userProfileId':_0x396e7b[_0x55c9('0x51')]},'raw':!![]})[_0x55c9('0x27')](function(_0x11bc60){if(_0x11bc60&&_0x11bc60[_0x55c9('0x52')]===0x0){return db['UserProfileResource'][_0x55c9('0x4c')]({'name':_0x59be99[_0x55c9('0x2e')],'resourceId':_0x59be99['id'],'type':_0x11bc60[_0x55c9('0x2e')],'sectionId':_0x11bc60['id']},{})[_0x55c9('0x27')](function(){return _0x11f6db;});}else{return _0x11f6db;}})[_0x55c9('0x46')](function(_0x289c82){logger[_0x55c9('0x2c')](_0x55c9('0x53'),_0x289c82);throw _0x289c82;});}return _0x11f6db;})[_0x55c9('0x27')](respondWithResult(_0x1e749f,0xc9))[_0x55c9('0x46')](handleError(_0x1e749f,null));};exports[_0x55c9('0x26')]=function(_0x4ec7a5,_0xd66f46){if(_0x4ec7a5[_0x55c9('0x4d')]['id']){delete _0x4ec7a5[_0x55c9('0x4d')]['id'];}return db['Schedule'][_0x55c9('0x4b')]({'where':{'id':_0x4ec7a5[_0x55c9('0x48')]['id']}})[_0x55c9('0x27')](handleEntityNotFound(_0xd66f46,null))[_0x55c9('0x27')](saveUpdates(_0x4ec7a5[_0x55c9('0x4d')],null))['then'](respondWithResult(_0xd66f46,null))['catch'](handleError(_0xd66f46,null));};exports[_0x55c9('0x28')]=function(_0x3c1f60,_0x514490){return db[_0x55c9('0x31')]['find']({'where':{'id':_0x3c1f60['params']['id']}})[_0x55c9('0x27')](handleEntityNotFound(_0x514490,null))[_0x55c9('0x27')](removeEntity(_0x514490,null))[_0x55c9('0x46')](handleError(_0x514490,null));};exports[_0x55c9('0x54')]=function(_0x547280,_0x43f2a1,_0x3d4e1d){var _0x3bfec7=require(_0x55c9('0x55'));return db['Schedule']['find']({'where':{'id':_0x547280[_0x55c9('0x48')]['id']},'raw':!![]})[_0x55c9('0x27')](handleEntityNotFound(_0x43f2a1,null))[_0x55c9('0x27')](function(){_0x3bfec7[_0x55c9('0x54')](_0x547280[_0x55c9('0x48')]['id']);})[_0x55c9('0x27')](respondWithStatusCode(_0x43f2a1,null))[_0x55c9('0x46')](handleError(_0x43f2a1,null));}; \ No newline at end of file +var _0x60a9=['catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Scheduler','destroy','end','sendStatus','error','stack','name','send','index','Schedule','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','merge','VIRTUAL','filter','options','where','includeAll','include','findAll'];(function(_0x3d31b1,_0x57919b){var _0x1ec81d=function(_0x557673){while(--_0x557673){_0x3d31b1['push'](_0x3d31b1['shift']());}};_0x1ec81d(++_0x57919b);}(_0x60a9,0xfc));var _0x960a=function(_0x40ad8b,_0x5c91fa){_0x40ad8b=_0x40ad8b-0x0;var _0x383ede=_0x60a9[_0x40ad8b];return _0x383ede;};'use strict';var emlformat=require(_0x960a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x960a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x960a('0x2'));var moment=require(_0x960a('0x3'));var BPromise=require(_0x960a('0x4'));var Mustache=require('mustache');var util=require(_0x960a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x960a('0x6'));var ejs=require(_0x960a('0x7'));var fs=require('fs');var fs_extra=require(_0x960a('0x8'));var _=require('lodash');var squel=require(_0x960a('0x9'));var crypto=require(_0x960a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x960a('0x6'));var querystring=require(_0x960a('0xb'));var Papa=require(_0x960a('0xc'));var Redis=require(_0x960a('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x960a('0xe'))(_0x960a('0xf'));var utils=require(_0x960a('0x10'));var config=require(_0x960a('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x960a('0x12'))['db'];function respondWithStatusCode(_0xfdb0a8,_0x597b2c){_0x597b2c=_0x597b2c||0xcc;return function(_0x1ff25c){if(_0x1ff25c){return _0xfdb0a8['sendStatus'](_0x597b2c);}return _0xfdb0a8[_0x960a('0x13')](_0x597b2c)['end']();};}function respondWithResult(_0x4c8d4a,_0x25e2e4){_0x25e2e4=_0x25e2e4||0xc8;return function(_0x4f0606){if(_0x4f0606){return _0x4c8d4a[_0x960a('0x13')](_0x25e2e4)[_0x960a('0x14')](_0x4f0606);}};}function respondWithFilteredResult(_0x19e6ce,_0x5a6adc){return function(_0x166b41){if(_0x166b41){var _0x3cd2d4=typeof _0x5a6adc[_0x960a('0x15')]===_0x960a('0x16')&&typeof _0x5a6adc[_0x960a('0x17')]===_0x960a('0x16');var _0x1844ad=_0x166b41[_0x960a('0x18')];var _0x4b56e2=_0x3cd2d4?0x0:_0x5a6adc[_0x960a('0x15')];var _0x59d2a8=_0x3cd2d4?_0x166b41[_0x960a('0x18')]:_0x5a6adc[_0x960a('0x15')]+_0x5a6adc[_0x960a('0x17')];var _0x3edefd;if(_0x59d2a8>=_0x1844ad){_0x59d2a8=_0x1844ad;_0x3edefd=0xc8;}else{_0x3edefd=0xce;}_0x19e6ce['status'](_0x3edefd);return _0x19e6ce[_0x960a('0x19')](_0x960a('0x1a'),_0x4b56e2+'-'+_0x59d2a8+'/'+_0x1844ad)[_0x960a('0x14')](_0x166b41);}return null;};}function patchUpdates(_0x323054){return function(_0x19e945){try{jsonpatch[_0x960a('0x1b')](_0x19e945,_0x323054,!![]);}catch(_0x368beb){return BPromise[_0x960a('0x1c')](_0x368beb);}return _0x19e945['save']();};}function saveUpdates(_0x12d363,_0x4e20e1){return function(_0x33c1b4){if(_0x33c1b4){return _0x33c1b4[_0x960a('0x1d')](_0x12d363)[_0x960a('0x1e')](function(_0x1ac685){return _0x1ac685;});}return null;};}function removeEntity(_0xbaf742,_0x30dca9){return function(_0x8e26b){if(_0x8e26b){return _0x8e26b['destroy']()[_0x960a('0x1e')](function(){var _0x4b85c9=_0x8e26b[_0x960a('0x1f')]({'plain':!![]});var _0x3358be=_0x960a('0x20');return db['UserProfileResource'][_0x960a('0x21')]({'where':{'type':_0x3358be,'resourceId':_0x4b85c9['id']}})[_0x960a('0x1e')](function(){return _0x8e26b;});})[_0x960a('0x1e')](function(){_0xbaf742[_0x960a('0x13')](0xcc)[_0x960a('0x22')]();});}};}function handleEntityNotFound(_0x22ccaa,_0x772832){return function(_0x41b9bf){if(!_0x41b9bf){_0x22ccaa[_0x960a('0x23')](0x194);}return _0x41b9bf;};}function handleError(_0x300295,_0x4e41f0){_0x4e41f0=_0x4e41f0||0x1f4;return function(_0x27b9b0){logger[_0x960a('0x24')](_0x27b9b0[_0x960a('0x25')]);if(_0x27b9b0[_0x960a('0x26')]){delete _0x27b9b0[_0x960a('0x26')];}_0x300295[_0x960a('0x13')](_0x4e41f0)[_0x960a('0x27')](_0x27b9b0);};}exports[_0x960a('0x28')]=function(_0x3158ac,_0x605679){var _0x1aea1a={},_0x4b3d80={},_0x5312c4={'count':0x0,'rows':[]};var _0x16a877=_['map'](db[_0x960a('0x29')]['rawAttributes'],function(_0x4aac8e){return{'name':_0x4aac8e['fieldName'],'type':_0x4aac8e[_0x960a('0x2a')][_0x960a('0x2b')]};});_0x4b3d80['model']=_[_0x960a('0x2c')](_0x16a877,_0x960a('0x26'));_0x4b3d80[_0x960a('0x2d')]=_[_0x960a('0x2e')](_0x3158ac[_0x960a('0x2d')]);_0x4b3d80[_0x960a('0x2f')]=_[_0x960a('0x30')](_0x4b3d80[_0x960a('0x31')],_0x4b3d80[_0x960a('0x2d')]);_0x1aea1a[_0x960a('0x32')]=_[_0x960a('0x30')](_0x4b3d80[_0x960a('0x31')],qs[_0x960a('0x33')](_0x3158ac[_0x960a('0x2d')][_0x960a('0x33')]));_0x1aea1a[_0x960a('0x32')]=_0x1aea1a['attributes'][_0x960a('0x34')]?_0x1aea1a[_0x960a('0x32')]:_0x4b3d80[_0x960a('0x31')];if(!_0x3158ac[_0x960a('0x2d')][_0x960a('0x35')](_0x960a('0x36'))){_0x1aea1a['limit']=qs[_0x960a('0x17')](_0x3158ac[_0x960a('0x2d')]['limit']);_0x1aea1a[_0x960a('0x15')]=qs[_0x960a('0x15')](_0x3158ac[_0x960a('0x2d')][_0x960a('0x15')]);}_0x1aea1a['order']=qs[_0x960a('0x37')](_0x3158ac['query'][_0x960a('0x37')]);_0x1aea1a['where']=qs[_0x960a('0x2f')](_['pick'](_0x3158ac[_0x960a('0x2d')],_0x4b3d80[_0x960a('0x2f')]),_0x16a877);if(_0x3158ac[_0x960a('0x2d')]['filter']){_0x1aea1a['where']=_[_0x960a('0x38')](_0x1aea1a['where'],{'$or':_[_0x960a('0x2c')](_0x16a877,function(_0x1664c6){if(_0x1664c6[_0x960a('0x2a')]!==_0x960a('0x39')){var _0x4a3119={};_0x4a3119[_0x1664c6[_0x960a('0x26')]]={'$like':'%'+_0x3158ac[_0x960a('0x2d')][_0x960a('0x3a')]+'%'};return _0x4a3119;}})});}_0x1aea1a=_[_0x960a('0x38')]({},_0x1aea1a,_0x3158ac[_0x960a('0x3b')]);var _0x4653aa={'where':_0x1aea1a[_0x960a('0x3c')]};return db['Schedule'][_0x960a('0x18')](_0x4653aa)['then'](function(_0x161472){_0x5312c4[_0x960a('0x18')]=_0x161472;if(_0x3158ac[_0x960a('0x2d')][_0x960a('0x3d')]){_0x1aea1a[_0x960a('0x3e')]=[{'all':!![]}];}return db[_0x960a('0x29')][_0x960a('0x3f')](_0x1aea1a);})['then'](function(_0x165b55){_0x5312c4['rows']=_0x165b55;return _0x5312c4;})[_0x960a('0x1e')](respondWithFilteredResult(_0x605679,_0x1aea1a))[_0x960a('0x40')](handleError(_0x605679,null));};exports[_0x960a('0x41')]=function(_0x45a0f4,_0x2c7d3){var _0xb4fbf3={'raw':![],'where':{'id':_0x45a0f4['params']['id']}},_0x18e85c={};_0x18e85c[_0x960a('0x31')]=_['keys'](db['Schedule']['rawAttributes']);_0x18e85c['query']=_[_0x960a('0x2e')](_0x45a0f4['query']);_0x18e85c[_0x960a('0x2f')]=_['intersection'](_0x18e85c[_0x960a('0x31')],_0x18e85c[_0x960a('0x2d')]);_0xb4fbf3[_0x960a('0x32')]=_[_0x960a('0x30')](_0x18e85c[_0x960a('0x31')],qs[_0x960a('0x33')](_0x45a0f4[_0x960a('0x2d')][_0x960a('0x33')]));_0xb4fbf3[_0x960a('0x32')]=_0xb4fbf3[_0x960a('0x32')][_0x960a('0x34')]?_0xb4fbf3['attributes']:_0x18e85c['model'];if(_0x45a0f4[_0x960a('0x2d')]['includeAll']){_0xb4fbf3[_0x960a('0x3e')]=[{'all':!![]}];}_0xb4fbf3=_['merge']({},_0xb4fbf3,_0x45a0f4['options']);return db['Schedule'][_0x960a('0x42')](_0xb4fbf3)['then'](handleEntityNotFound(_0x2c7d3,null))[_0x960a('0x1e')](respondWithResult(_0x2c7d3,null))[_0x960a('0x40')](handleError(_0x2c7d3,null));};exports[_0x960a('0x43')]=function(_0x4d6d90,_0x10f982){return db[_0x960a('0x29')]['create'](_0x4d6d90[_0x960a('0x44')],{})[_0x960a('0x1e')](function(_0x18fdd5){var _0x47939d=_0x4d6d90[_0x960a('0x45')][_0x960a('0x1f')]({'plain':!![]});if(!_0x47939d)throw new Error(_0x960a('0x46'));if(_0x47939d[_0x960a('0x47')]===_0x960a('0x45')){var _0x1f1f08=_0x18fdd5[_0x960a('0x1f')]({'plain':!![]});var _0xf18284=_0x960a('0x20');return db[_0x960a('0x48')][_0x960a('0x42')]({'where':{'name':_0xf18284,'userProfileId':_0x47939d[_0x960a('0x49')]},'raw':!![]})[_0x960a('0x1e')](function(_0x26ea55){if(_0x26ea55&&_0x26ea55[_0x960a('0x4a')]===0x0){return db[_0x960a('0x4b')][_0x960a('0x43')]({'name':_0x1f1f08[_0x960a('0x26')],'resourceId':_0x1f1f08['id'],'type':_0x26ea55[_0x960a('0x26')],'sectionId':_0x26ea55['id']},{})[_0x960a('0x1e')](function(){return _0x18fdd5;});}else{return _0x18fdd5;}})[_0x960a('0x40')](function(_0x27166f){logger[_0x960a('0x24')](_0x960a('0x4c'),_0x27166f);throw _0x27166f;});}return _0x18fdd5;})[_0x960a('0x1e')](respondWithResult(_0x10f982,0xc9))[_0x960a('0x40')](handleError(_0x10f982,null));};exports['update']=function(_0x5d301d,_0x33f060){if(_0x5d301d['body']['id']){delete _0x5d301d[_0x960a('0x44')]['id'];}return db[_0x960a('0x29')][_0x960a('0x42')]({'where':{'id':_0x5d301d['params']['id']}})[_0x960a('0x1e')](handleEntityNotFound(_0x33f060,null))[_0x960a('0x1e')](saveUpdates(_0x5d301d['body'],null))[_0x960a('0x1e')](respondWithResult(_0x33f060,null))['catch'](handleError(_0x33f060,null));};exports[_0x960a('0x21')]=function(_0x29bf6b,_0x1a809e){return db['Schedule'][_0x960a('0x42')]({'where':{'id':_0x29bf6b[_0x960a('0x4d')]['id']}})[_0x960a('0x1e')](handleEntityNotFound(_0x1a809e,null))[_0x960a('0x1e')](removeEntity(_0x1a809e,null))[_0x960a('0x40')](handleError(_0x1a809e,null));};exports[_0x960a('0x4e')]=function(_0x3fcebb,_0xbd837b,_0x22ba27){var _0x70d4f=require('../../config/schedule');return db[_0x960a('0x29')][_0x960a('0x42')]({'where':{'id':_0x3fcebb[_0x960a('0x4d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbd837b,null))[_0x960a('0x1e')](function(){_0x70d4f['run'](_0x3fcebb[_0x960a('0x4d')]['id']);})[_0x960a('0x1e')](respondWithStatusCode(_0xbd837b,null))[_0x960a('0x40')](handleError(_0xbd837b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c818501..fef7164 100644 --- a/server/api/schedule/schedule.model.js +++ b/server/api/schedule/schedule.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6071=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util'];(function(_0x5f1899,_0x4b8653){var _0x70dff0=function(_0x3cc5ea){while(--_0x3cc5ea){_0x5f1899['push'](_0x5f1899['shift']());}};_0x70dff0(++_0x4b8653);}(_0x6071,0xee));var _0x1607=function(_0x472906,_0xd2b25e){_0x472906=_0x472906-0x0;var _0x35dbb8=_0x6071[_0x472906];return _0x35dbb8;};'use strict';var _=require(_0x1607('0x0'));var util=require(_0x1607('0x1'));var logger=require(_0x1607('0x2'))(_0x1607('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1607('0x4'));var fs=require('fs');var path=require(_0x1607('0x5'));var rimraf=require(_0x1607('0x6'));var config=require(_0x1607('0x7'));var attributes=require('./schedule.attributes');module[_0x1607('0x8')]=function(_0x207ffd,_0x121fa7){return _0x207ffd[_0x1607('0x9')](_0x1607('0xa'),attributes,{'tableName':_0x1607('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde10=['request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x37e4c6,_0x31c1eb){var _0x140cf1=function(_0x466d9f){while(--_0x466d9f){_0x37e4c6['push'](_0x37e4c6['shift']());}};_0x140cf1(++_0x31c1eb);}(_0xde10,0x1f2));var _0x0de1=function(_0x44d868,_0x864eb2){_0x44d868=_0x44d868-0x0;var _0x6ab29a=_0xde10[_0x44d868];return _0x6ab29a;};'use strict';var _=require(_0x0de1('0x0'));var util=require(_0x0de1('0x1'));var logger=require(_0x0de1('0x2'))(_0x0de1('0x3'));var moment=require(_0x0de1('0x4'));var BPromise=require(_0x0de1('0x5'));var rp=require(_0x0de1('0x6'));var fs=require('fs');var path=require(_0x0de1('0x7'));var rimraf=require(_0x0de1('0x8'));var config=require(_0x0de1('0x9'));var attributes=require(_0x0de1('0xa'));module['exports']=function(_0x3cd135,_0x21e86f){return _0x3cd135[_0x0de1('0xb')](_0x0de1('0xc'),attributes,{'tableName':_0x0de1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 6c309f9..ae5077d 100644 --- a/server/api/schedule/schedule.rpc.js +++ b/server/api/schedule/schedule.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x764e=['message','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x579e77,_0x35f7a0){var _0x85acfd=function(_0x1375ee){while(--_0x1375ee){_0x579e77['push'](_0x579e77['shift']());}};_0x85acfd(++_0x35f7a0);}(_0x764e,0xda));var _0xe764=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x764e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe764('0x0'));var util=require(_0xe764('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe764('0x2'));var fs=require('fs');var Redis=require(_0xe764('0x3'));var db=require(_0xe764('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe764('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe764('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc8d182,_0x1b2a66,_0x18ce4d){return new BPromise(function(_0x551e6f,_0x40745a){return client[_0xe764('0x7')](_0xc8d182,_0x18ce4d)[_0xe764('0x8')](function(_0x36c9f8){logger[_0xe764('0x9')](_0xe764('0xa'),_0x1b2a66,_0xe764('0xb'));logger['debug'](_0xe764('0xc'),_0x1b2a66,_0xe764('0xb'),JSON[_0xe764('0xd')](_0x36c9f8));if(_0x36c9f8[_0xe764('0xe')]){if(_0x36c9f8[_0xe764('0xe')][_0xe764('0xf')]===0x1f4){logger[_0xe764('0xe')]('Schedule,\x20%s,\x20%s',_0x1b2a66,_0x36c9f8['error'][_0xe764('0x10')]);return _0x40745a(_0x36c9f8[_0xe764('0xe')]['message']);}logger[_0xe764('0xe')](_0xe764('0xa'),_0x1b2a66,_0x36c9f8[_0xe764('0xe')][_0xe764('0x10')]);return _0x551e6f(_0x36c9f8[_0xe764('0xe')][_0xe764('0x10')]);}else{logger[_0xe764('0x9')](_0xe764('0xa'),_0x1b2a66,_0xe764('0xb'));_0x551e6f(_0x36c9f8['result'][_0xe764('0x10')]);}})[_0xe764('0x11')](function(_0x547eae){logger[_0xe764('0xe')]('Schedule,\x20%s,\x20%s',_0x1b2a66,_0x547eae);_0x40745a(_0x547eae);});});} \ No newline at end of file +var _0x9220=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','result'];(function(_0x22bb24,_0x4f26f6){var _0x52c903=function(_0xeb70fa){while(--_0xeb70fa){_0x22bb24['push'](_0x22bb24['shift']());}};_0x52c903(++_0x4f26f6);}(_0x9220,0xb8));var _0x0922=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x9220[_0x15c421];return _0x5e5ed5;};'use strict';var _=require('lodash');var util=require(_0x0922('0x0'));var moment=require(_0x0922('0x1'));var BPromise=require('bluebird');var rs=require(_0x0922('0x2'));var fs=require('fs');var Redis=require(_0x0922('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0922('0x4'));var logger=require(_0x0922('0x5'))(_0x0922('0x6'));var config=require(_0x0922('0x7'));var jayson=require(_0x0922('0x8'));var client=jayson[_0x0922('0x9')][_0x0922('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5856a7,_0x5b653b,_0x55f989){return new BPromise(function(_0x5aa613,_0x54455c){return client[_0x0922('0xb')](_0x5856a7,_0x55f989)[_0x0922('0xc')](function(_0x1effec){logger[_0x0922('0xd')]('Schedule,\x20%s,\x20%s',_0x5b653b,'request\x20sent');logger[_0x0922('0xe')](_0x0922('0xf'),_0x5b653b,_0x0922('0x10'),JSON[_0x0922('0x11')](_0x1effec));if(_0x1effec['error']){if(_0x1effec[_0x0922('0x12')][_0x0922('0x13')]===0x1f4){logger[_0x0922('0x12')](_0x0922('0x14'),_0x5b653b,_0x1effec[_0x0922('0x12')][_0x0922('0x15')]);return _0x54455c(_0x1effec[_0x0922('0x12')][_0x0922('0x15')]);}logger[_0x0922('0x12')](_0x0922('0x14'),_0x5b653b,_0x1effec['error']['message']);return _0x5aa613(_0x1effec[_0x0922('0x12')][_0x0922('0x15')]);}else{logger[_0x0922('0xd')](_0x0922('0x14'),_0x5b653b,'request\x20sent');_0x5aa613(_0x1effec[_0x0922('0x16')]['message']);}})['catch'](function(_0x34195c){logger[_0x0922('0x12')](_0x0922('0x14'),_0x5b653b,_0x34195c);_0x54455c(_0x34195c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 1e77f2b..0ed5c6c 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc45c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','post','create','update','delete','util','path'];(function(_0x434878,_0x1d4adb){var _0x2162dd=function(_0x2a4fc6){while(--_0x2a4fc6){_0x434878['push'](_0x434878['shift']());}};_0x2162dd(++_0x1d4adb);}(_0xc45c,0x152));var _0xcc45=function(_0x195fc1,_0x50c867){_0x195fc1=_0x195fc1-0x0;var _0x268fbe=_0xc45c[_0x195fc1];return _0x268fbe;};'use strict';var multer=require('multer');var util=require(_0xcc45('0x0'));var path=require(_0xcc45('0x1'));var timeout=require(_0xcc45('0x2'));var express=require(_0xcc45('0x3'));var router=express[_0xcc45('0x4')]();var fs_extra=require(_0xcc45('0x5'));var auth=require(_0xcc45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcc45('0x7'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xcc45('0x8')](),controller[_0xcc45('0x9')]);router[_0xcc45('0xa')](_0xcc45('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xcc45('0xa')](_0xcc45('0xc'),auth[_0xcc45('0x8')](),controller['show']);router['get']('/:id/download',auth[_0xcc45('0x8')](),controller['download']);router[_0xcc45('0xd')]('/',auth[_0xcc45('0x8')](),controller[_0xcc45('0xe')]);router['put'](_0xcc45('0xc'),auth[_0xcc45('0x8')](),controller[_0xcc45('0xf')]);router[_0xcc45('0x10')]('/:id',auth[_0xcc45('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb592=['./screenRecording.controller','isAuthenticated','index','get','describe','/:id','download','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15379e,_0x35a39d){var _0x2f7561=function(_0x2a959b){while(--_0x2a959b){_0x15379e['push'](_0x15379e['shift']());}};_0x2f7561(++_0x35a39d);}(_0xb592,0x1f0));var _0x2b59=function(_0x11fcba,_0x46ac13){_0x11fcba=_0x11fcba-0x0;var _0x2c792a=_0xb592[_0x11fcba];return _0x2c792a;};'use strict';var multer=require('multer');var util=require(_0x2b59('0x0'));var path=require(_0x2b59('0x1'));var timeout=require(_0x2b59('0x2'));var express=require(_0x2b59('0x3'));var router=express[_0x2b59('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2b59('0x5'));var interaction=require(_0x2b59('0x6'));var config=require(_0x2b59('0x7'));var controller=require(_0x2b59('0x8'));router['get']('/',auth[_0x2b59('0x9')](),controller[_0x2b59('0xa')]);router[_0x2b59('0xb')]('/describe',auth[_0x2b59('0x9')](),controller[_0x2b59('0xc')]);router[_0x2b59('0xb')](_0x2b59('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x2b59('0xb')]('/:id/download',auth[_0x2b59('0x9')](),controller[_0x2b59('0xe')]);router[_0x2b59('0xf')]('/',auth[_0x2b59('0x9')](),controller[_0x2b59('0x10')]);router['put']('/:id',auth[_0x2b59('0x9')](),controller[_0x2b59('0x11')]);router[_0x2b59('0x12')](_0x2b59('0xd'),auth[_0x2b59('0x9')](),controller[_0x2b59('0x13')]);module[_0x2b59('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9103c92..6b3e475 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ca7=['sequelize','moment','path','exports','VIRTUAL','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt'];(function(_0x337c4d,_0x466f33){var _0x458589=function(_0x35a774){while(--_0x35a774){_0x337c4d['push'](_0x337c4d['shift']());}};_0x458589(++_0x466f33);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x2d58da,_0x5c9ed2){_0x2d58da=_0x2d58da-0x0;var _0xdd13bc=_0x4ca7[_0x2d58da];return _0xdd13bc;};'use strict';var Sequelize=require(_0x74ca('0x0'));var moment=require(_0x74ca('0x1'));var path=require(_0x74ca('0x2'));var config=require('../../config/environment');module[_0x74ca('0x3')]={'format':{'type':Sequelize[_0x74ca('0x4')],'get':function(){return this['getDataValue']('value')?path[_0x74ca('0x5')](this['getDataValue'](_0x74ca('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x74ca('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x74ca('0x7')],'set':function(_0x572dc2){var _0x453b45=_0x572dc2[_0x74ca('0x8')](/\\/g,'/');this[_0x74ca('0x9')](_0x74ca('0x6'),_0x453b45);}},'rating':{'type':Sequelize[_0x74ca('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x74ca('0xa')],'set':function(_0x116715){this['setDataValue'](_0x74ca('0xb'),moment()['subtract'](_0x116715,'ms'));this[_0x74ca('0x9')](_0x74ca('0xc'),moment());this['setDataValue'](_0x74ca('0xd'),_0x116715);}},'startedAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this[_0x74ca('0xf')](_0x74ca('0xb')))[_0x74ca('0x10')](_0x74ca('0x11'))[_0x74ca('0x12')]();}},'closedAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this['getDataValue'](_0x74ca('0xc')))[_0x74ca('0x10')](_0x74ca('0x11'))[_0x74ca('0x12')]();}},'createdAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this[_0x74ca('0xf')](_0x74ca('0x13')))[_0x74ca('0x10')](_0x74ca('0x11'))[_0x74ca('0x12')]();}},'updatedAt':{'type':Sequelize[_0x74ca('0xe')],'get':function(){return moment(this[_0x74ca('0xf')](_0x74ca('0x14')))[_0x74ca('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x74ca('0x12')]();}}}; \ No newline at end of file +var _0x62f1=['INTEGER','startedAt','closedAt','MM-DD-YYYY\x20HH:mm','toString','DATE','format','createdAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue'];(function(_0x3954b0,_0x57e367){var _0x21c3d1=function(_0x2005e1){while(--_0x2005e1){_0x3954b0['push'](_0x3954b0['shift']());}};_0x21c3d1(++_0x57e367);}(_0x62f1,0x112));var _0x162f=function(_0x4af827,_0x1313b7){_0x4af827=_0x4af827-0x0;var _0x3f11db=_0x62f1[_0x4af827];return _0x3f11db;};'use strict';var Sequelize=require(_0x162f('0x0'));var moment=require('moment');var path=require(_0x162f('0x1'));var config=require(_0x162f('0x2'));module[_0x162f('0x3')]={'format':{'type':Sequelize[_0x162f('0x4')],'get':function(){return this[_0x162f('0x5')](_0x162f('0x6'))?path[_0x162f('0x7')](this[_0x162f('0x5')](_0x162f('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x162f('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x162f('0x8')],'set':function(_0x2e763a){var _0x593029=_0x2e763a[_0x162f('0x9')](/\\/g,'/');this[_0x162f('0xa')](_0x162f('0x6'),_0x593029);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x162f('0xb')],'set':function(_0x3d795c){this[_0x162f('0xa')](_0x162f('0xc'),moment()['subtract'](_0x3d795c,'ms'));this[_0x162f('0xa')](_0x162f('0xd'),moment());this[_0x162f('0xa')]('duration',_0x3d795c);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x162f('0xc')))['format'](_0x162f('0xe'))[_0x162f('0xf')]();}},'closedAt':{'type':Sequelize[_0x162f('0x10')],'get':function(){return moment(this[_0x162f('0x5')]('closedAt'))[_0x162f('0x11')](_0x162f('0xe'))[_0x162f('0xf')]();}},'createdAt':{'type':Sequelize[_0x162f('0x10')],'get':function(){return moment(this['getDataValue'](_0x162f('0x12')))['format'](_0x162f('0xe'))[_0x162f('0xf')]();}},'updatedAt':{'type':Sequelize[_0x162f('0x10')],'get':function(){return moment(this[_0x162f('0x5')]('updatedAt'))['format'](_0x162f('0xe'))[_0x162f('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f76d3c5..05e75fb 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5604c8,_0xaaa1ef){_0x5604c8=_0x5604c8-0x0;var _0x493896=_0xdbf5[_0x5604c8];return _0x493896;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file +var _0x84ab=['describe','download','join','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','rawAttributes','type','key','model','differenceBy','map','format','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','ScreenRecording','rows','params','keys','intersection','find','catch','body','createdAt','value'];(function(_0x444a7f,_0x22ba67){var _0x501d1d=function(_0x45ff9b){while(--_0x45ff9b){_0x444a7f['push'](_0x444a7f['shift']());}};_0x501d1d(++_0x22ba67);}(_0x84ab,0x12f));var _0xb84a=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x84ab[_0xfb0cfd];return _0x2fd8aa;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x409df0,_0x19bdfa){return function(_0x3258a9){if(!_0x3258a9){_0x409df0[_0xb84a('0x16')](0x194);}return _0x3258a9;};}function handleError(_0x3ff0bc,_0x3b6805){_0x3b6805=_0x3b6805||0x1f4;return function(_0xd468c3){logger[_0xb84a('0x24')](_0xd468c3[_0xb84a('0x25')]);if(_0xd468c3[_0xb84a('0x26')]){delete _0xd468c3[_0xb84a('0x26')];}_0x3ff0bc[_0xb84a('0x17')](_0x3b6805)[_0xb84a('0x27')](_0xd468c3);};}exports['index']=function(_0x582954,_0x4608ce){var _0x2c30b0={},_0x4dab4e={},_0x1f690a={'count':0x0,'rows':[]};var _0x36b4f4=_['map'](db['ScreenRecording'][_0xb84a('0x28')],function(_0x8e9319){return{'name':_0x8e9319['fieldName'],'type':_0x8e9319[_0xb84a('0x29')][_0xb84a('0x2a')]};});_0x4dab4e[_0xb84a('0x2b')]=_[_0xb84a('0x2c')](_[_0xb84a('0x2d')](_0x36b4f4,_0xb84a('0x26')),[_0xb84a('0x2e')]);_0x4dab4e[_0xb84a('0x2f')]=_['keys'](_0x582954[_0xb84a('0x2f')]);_0x4dab4e['filters']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],_0x4dab4e[_0xb84a('0x2f')]);_0x2c30b0['attributes']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],qs[_0xb84a('0x30')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x2c30b0[_0xb84a('0x31')]=_0x2c30b0[_0xb84a('0x31')][_0xb84a('0x32')]?_0x2c30b0[_0xb84a('0x31')]:_0x4dab4e['model'];if(!_0x582954[_0xb84a('0x2f')][_0xb84a('0x33')](_0xb84a('0x34'))){_0x2c30b0[_0xb84a('0x1c')]=qs[_0xb84a('0x1c')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x2c30b0['offset']=qs[_0xb84a('0x1a')](_0x582954['query'][_0xb84a('0x1a')]);}_0x2c30b0[_0xb84a('0x35')]=qs[_0xb84a('0x36')](_0x582954['query']['sort']);_0x2c30b0[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_[_0xb84a('0x39')](_0x582954[_0xb84a('0x2f')],_0x4dab4e[_0xb84a('0x38')]),_0x36b4f4);if(_0x582954['query'][_0xb84a('0x3a')]){_0x2c30b0[_0xb84a('0x37')]=_['merge'](_0x2c30b0[_0xb84a('0x37')],{'$or':_[_0xb84a('0x2d')](_0x36b4f4,function(_0x19634b){if(_0x19634b[_0xb84a('0x29')]!=='VIRTUAL'){var _0x57a1a8={};_0x57a1a8[_0x19634b['name']]={'$like':'%'+_0x582954[_0xb84a('0x2f')][_0xb84a('0x3a')]+'%'};return _0x57a1a8;}})});}_0x2c30b0=_[_0xb84a('0x3b')]({},_0x2c30b0,_0x582954[_0xb84a('0x3c')]);var _0x55b0b8={'where':_0x2c30b0[_0xb84a('0x37')]};return db['ScreenRecording'][_0xb84a('0x1d')](_0x55b0b8)['then'](function(_0x48db18){_0x1f690a['count']=_0x48db18;if(_0x582954[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x2c30b0[_0xb84a('0x3e')]=[{'all':!![]}];}return db[_0xb84a('0x3f')]['findAll'](_0x2c30b0);})[_0xb84a('0x22')](function(_0x42f0b6){_0x1f690a[_0xb84a('0x40')]=_0x42f0b6;return _0x1f690a;})[_0xb84a('0x22')](respondWithFilteredResult(_0x4608ce,_0x2c30b0))['catch'](handleError(_0x4608ce,null));};exports['show']=function(_0x15a621,_0x1f3e04){var _0x541cc4={'raw':![],'where':{'id':_0x15a621[_0xb84a('0x41')]['id']}},_0x1045ee={};_0x1045ee[_0xb84a('0x2b')]=_[_0xb84a('0x42')](db[_0xb84a('0x3f')][_0xb84a('0x28')]);_0x1045ee[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x15a621[_0xb84a('0x2f')]);_0x1045ee[_0xb84a('0x38')]=_[_0xb84a('0x43')](_0x1045ee[_0xb84a('0x2b')],_0x1045ee[_0xb84a('0x2f')]);_0x541cc4[_0xb84a('0x31')]=_[_0xb84a('0x43')](_0x1045ee['model'],qs[_0xb84a('0x30')](_0x15a621[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x541cc4[_0xb84a('0x31')]=_0x541cc4[_0xb84a('0x31')][_0xb84a('0x32')]?_0x541cc4['attributes']:_0x1045ee[_0xb84a('0x2b')];if(_0x15a621['query'][_0xb84a('0x3d')]){_0x541cc4[_0xb84a('0x3e')]=[{'all':!![]}];}_0x541cc4=_[_0xb84a('0x3b')]({},_0x541cc4,_0x15a621[_0xb84a('0x3c')]);return db['ScreenRecording'][_0xb84a('0x44')](_0x541cc4)[_0xb84a('0x22')](handleEntityNotFound(_0x1f3e04,null))[_0xb84a('0x22')](respondWithResult(_0x1f3e04,null))['catch'](handleError(_0x1f3e04,null));};exports['create']=function(_0x385986,_0x10b0cc){return db[_0xb84a('0x3f')]['create'](_0x385986['body'],{})['then'](respondWithResult(_0x10b0cc,0xc9))[_0xb84a('0x45')](handleError(_0x10b0cc,null));};exports[_0xb84a('0x21')]=function(_0x38f329,_0x4476bc){if(_0x38f329[_0xb84a('0x46')]['id']){delete _0x38f329['body']['id'];}delete _0x38f329['body']['duration'];delete _0x38f329['body'][_0xb84a('0x47')];delete _0x38f329[_0xb84a('0x46')]['closedAt'];delete _0x38f329[_0xb84a('0x46')][_0xb84a('0x48')];return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x38f329[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](handleEntityNotFound(_0x4476bc,null))['then'](saveUpdates(_0x38f329['body'],null))[_0xb84a('0x22')](respondWithResult(_0x4476bc,null))['catch'](handleError(_0x4476bc,null));};exports[_0xb84a('0x49')]=function(_0x4d1a29,_0x575908){return db['ScreenRecording'][_0xb84a('0x49')]()[_0xb84a('0x22')](respondWithResult(_0x575908,null))[_0xb84a('0x45')](handleError(_0x575908,null));};exports[_0xb84a('0x4a')]=function(_0x33adfc,_0x46f7eb,_0x37ca26){var _0x29ff35=require('../../components/encryptor');var _0x5afdd0=![];var _0x4c5bdf={};if(_0x33adfc[_0xb84a('0x2f')][_0xb84a('0x29')]&&_0x33adfc['query'][_0xb84a('0x29')]==='uniqueid'){_0x4c5bdf['uniqueid']=_0x33adfc['params']['id'];}else{_0x4c5bdf['id']=_0x33adfc[_0xb84a('0x41')]['id'];}return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':_0x4c5bdf,'attributes':['id','value'],'raw':!![]})[_0xb84a('0x22')](handleEntityNotFound(_0x46f7eb,null))[_0xb84a('0x22')](function(_0x136d61){if(_0x136d61){var _0x505994=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x136d61[_0xb84a('0x48')]);var _0x47a8a2=util[_0xb84a('0x2e')]('%s.cypher',_0x505994);if(fs[_0xb84a('0x4c')](_0x47a8a2)){_0x5afdd0=!![];return _0x29ff35[_0xb84a('0x4d')](_0x47a8a2,_0x505994,config[_0xb84a('0x4e')][_0xb84a('0x4f')])['then'](function(){return _0x136d61;});}return _0x136d61;}})['then'](function(_0x4fc998){if(_0x4fc998){var _0x40b392=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x4fc998[_0xb84a('0x48')]);if(!fs[_0xb84a('0x4c')](_0x40b392)){throw new db[(_0xb84a('0x50'))]['ValidationError'](_0xb84a('0x51'));}if(_0x4fc998[_0xb84a('0x52')]){return _0x46f7eb['download'](_0x40b392,_0x4fc998[_0xb84a('0x52')]+path[_0xb84a('0x53')](_0x40b392),function(){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}else{return _0x46f7eb[_0xb84a('0x4a')](_0x40b392,function(_0x3bbc69){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}}})[_0xb84a('0x45')](function(_0x47c27f){if(_0x47c27f[_0xb84a('0x55')]===_0xb84a('0x51')){_0x46f7eb['status'](0x194)[_0xb84a('0x27')](_0xb84a('0x56'));}else{return handleError(_0x46f7eb,null);}});};exports[_0xb84a('0x23')]=function(_0x3e16d8,_0x347998){return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x3e16d8[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](function(_0x5dd660){if(_[_0xb84a('0x57')](_0x5dd660)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5dd660;})['then'](function(_0x19d635){var _0x5e11c8=path[_0xb84a('0x4b')](config['root'],_0xb84a('0x58'),_0x19d635[_0xb84a('0x48')]);logger['info'](_0xb84a('0x59'),_0x5e11c8);if(!_[_0xb84a('0x57')](_0x19d635[_0xb84a('0x48')])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}_0x5e11c8=_0x5e11c8+_0xb84a('0x5d');if(!_['isNil'](_0x19d635['value'])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}return _0x19d635;})['then'](function(_0x43031f){if(!_0x43031f)throw new InternalError();return _0x43031f[_0xb84a('0x23')]();})[_0xb84a('0x22')](function(){_0x347998[_0xb84a('0x17')](0xcc)['end']();})[_0xb84a('0x45')](handleError(_0x347998,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 9488e4f..8de1d44 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd612=['exports','interactionid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./screenRecording.attributes'];(function(_0x135ae0,_0x34fd8b){var _0x373e16=function(_0x546920){while(--_0x546920){_0x135ae0['push'](_0x135ae0['shift']());}};_0x373e16(++_0x34fd8b);}(_0xd612,0x66));var _0x2d61=function(_0x44f9db,_0x2743c7){_0x44f9db=_0x44f9db-0x0;var _0x18f999=_0xd612[_0x44f9db];return _0x18f999;};'use strict';var _=require(_0x2d61('0x0'));var util=require(_0x2d61('0x1'));var logger=require(_0x2d61('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2d61('0x3'));var rp=require(_0x2d61('0x4'));var fs=require('fs');var path=require(_0x2d61('0x5'));var rimraf=require(_0x2d61('0x6'));var config=require('../../config/environment');var attributes=require(_0x2d61('0x7'));module[_0x2d61('0x8')]=function(_0x942fc7,_0x48e498){return _0x942fc7['define']('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x2d61('0x9'),'fields':[_0x2d61('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5270=['interactionid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define'];(function(_0x1f9eb7,_0x1983c2){var _0xa58db7=function(_0x3425a0){while(--_0x3425a0){_0x1f9eb7['push'](_0x1f9eb7['shift']());}};_0xa58db7(++_0x1983c2);}(_0x5270,0x161));var _0x0527=function(_0xc0bfbb,_0x5e41ed){_0xc0bfbb=_0xc0bfbb-0x0;var _0x46de99=_0x5270[_0xc0bfbb];return _0x46de99;};'use strict';var _=require(_0x0527('0x0'));var util=require(_0x0527('0x1'));var logger=require(_0x0527('0x2'))(_0x0527('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0527('0x4'));var fs=require('fs');var path=require(_0x0527('0x5'));var rimraf=require(_0x0527('0x6'));var config=require(_0x0527('0x7'));var attributes=require(_0x0527('0x8'));module['exports']=function(_0x2cd2d9,_0x15121c){return _0x2cd2d9[_0x0527('0x9')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x0527('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index bda9062..d9b955c 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd43=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','ScreenRecording,\x20%s,\x20%s','result','catch'];(function(_0x4ee806,_0x33c72d){var _0x3ddc84=function(_0x2571dc){while(--_0x2571dc){_0x4ee806['push'](_0x4ee806['shift']());}};_0x3ddc84(++_0x33c72d);}(_0xcd43,0xc8));var _0x3cd4=function(_0x472179,_0x5cdcc1){_0x472179=_0x472179-0x0;var _0x10200f=_0xcd43[_0x472179];return _0x10200f;};'use strict';var _=require(_0x3cd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3cd4('0x1'));var rs=require(_0x3cd4('0x2'));var fs=require('fs');var Redis=require(_0x3cd4('0x3'));var db=require(_0x3cd4('0x4'))['db'];var utils=require(_0x3cd4('0x5'));var logger=require('../../config/logger')(_0x3cd4('0x6'));var config=require('../../config/environment');var jayson=require(_0x3cd4('0x7'));var client=jayson[_0x3cd4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a395,_0x2d1aa4,_0x5e2402){return new BPromise(function(_0x2ca444,_0x369166){return client[_0x3cd4('0x9')](_0x24a395,_0x5e2402)[_0x3cd4('0xa')](function(_0x1ddbd3){logger[_0x3cd4('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x2d1aa4,_0x3cd4('0xc'));logger[_0x3cd4('0xd')](_0x3cd4('0xe'),_0x2d1aa4,_0x3cd4('0xc'),JSON['stringify'](_0x1ddbd3));if(_0x1ddbd3[_0x3cd4('0xf')]){if(_0x1ddbd3[_0x3cd4('0xf')]['code']===0x1f4){logger[_0x3cd4('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x2d1aa4,_0x1ddbd3[_0x3cd4('0xf')][_0x3cd4('0x10')]);return _0x369166(_0x1ddbd3[_0x3cd4('0xf')][_0x3cd4('0x10')]);}logger[_0x3cd4('0xf')](_0x3cd4('0x11'),_0x2d1aa4,_0x1ddbd3[_0x3cd4('0xf')][_0x3cd4('0x10')]);return _0x2ca444(_0x1ddbd3[_0x3cd4('0xf')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x2d1aa4,_0x3cd4('0xc'));_0x2ca444(_0x1ddbd3[_0x3cd4('0x12')][_0x3cd4('0x10')]);}})[_0x3cd4('0x13')](function(_0x5a0e6e){logger[_0x3cd4('0xf')](_0x3cd4('0x11'),_0x2d1aa4,_0x5a0e6e);_0x369166(_0x5a0e6e);});});} \ No newline at end of file +var _0x876b=['lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x366641,_0x670dc6){var _0x24d1e2=function(_0x2e671d){while(--_0x2e671d){_0x366641['push'](_0x366641['shift']());}};_0x24d1e2(++_0x670dc6);}(_0x876b,0x1c8));var _0xb876=function(_0x12336d,_0x4f33b){_0x12336d=_0x12336d-0x0;var _0x1c6a3a=_0x876b[_0x12336d];return _0x1c6a3a;};'use strict';var _=require(_0xb876('0x0'));var util=require(_0xb876('0x1'));var moment=require(_0xb876('0x2'));var BPromise=require(_0xb876('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb876('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb876('0x5'));var config=require(_0xb876('0x6'));var jayson=require(_0xb876('0x7'));var client=jayson[_0xb876('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ebf9f,_0x1f1312,_0x5452d5){return new BPromise(function(_0x5a46f2,_0x3f6dba){return client['request'](_0x5ebf9f,_0x5452d5)[_0xb876('0x9')](function(_0x964d98){logger[_0xb876('0xa')](_0xb876('0xb'),_0x1f1312,_0xb876('0xc'));logger['debug'](_0xb876('0xd'),_0x1f1312,_0xb876('0xc'),JSON[_0xb876('0xe')](_0x964d98));if(_0x964d98[_0xb876('0xf')]){if(_0x964d98[_0xb876('0xf')][_0xb876('0x10')]===0x1f4){logger[_0xb876('0xf')](_0xb876('0xb'),_0x1f1312,_0x964d98[_0xb876('0xf')][_0xb876('0x11')]);return _0x3f6dba(_0x964d98[_0xb876('0xf')][_0xb876('0x11')]);}logger['error'](_0xb876('0xb'),_0x1f1312,_0x964d98[_0xb876('0xf')][_0xb876('0x11')]);return _0x5a46f2(_0x964d98[_0xb876('0xf')][_0xb876('0x11')]);}else{logger[_0xb876('0xa')](_0xb876('0xb'),_0x1f1312,_0xb876('0xc'));_0x5a46f2(_0x964d98[_0xb876('0x12')][_0xb876('0x11')]);}})['catch'](function(_0x1b3e8b){logger[_0xb876('0xf')](_0xb876('0xb'),_0x1f1312,_0x1b3e8b);_0x3f6dba(_0x1b3e8b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 0f603b3..eb6e146 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25ee=['index','/now','getDate','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','join','root','server/files/images/logos/','format','logo','post','single','file','addLogo','diskStorage','%s%s','extname','originalname','/:id/logo_login','addLogoLogin','preferred','addPreferred','addFavicon','put','/:id','update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated'];(function(_0x39db05,_0x3868d0){var _0x3f0e22=function(_0x532c4f){while(--_0x532c4f){_0x39db05['push'](_0x39db05['shift']());}};_0x3f0e22(++_0x3868d0);}(_0x25ee,0x14f));var _0xe25e=function(_0x2b682b,_0x10f1f8){_0x2b682b=_0x2b682b-0x0;var _0x5f0ab3=_0x25ee[_0x2b682b];return _0x5f0ab3;};'use strict';var multer=require(_0xe25e('0x0'));var util=require(_0xe25e('0x1'));var path=require(_0xe25e('0x2'));var timeout=require('connect-timeout');var express=require(_0xe25e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe25e('0x4'));var interaction=require(_0xe25e('0x5'));var config=require('../../config/environment');var controller=require(_0xe25e('0x6'));router[_0xe25e('0x7')]('/',auth[_0xe25e('0x8')](),controller[_0xe25e('0x9')]);router[_0xe25e('0x7')](_0xe25e('0xa'),controller[_0xe25e('0xb')]);router[_0xe25e('0x7')]('/:id',controller[_0xe25e('0xc')]);router['get'](_0xe25e('0xd'),controller[_0xe25e('0xe')]);router[_0xe25e('0x7')]('/:id/logo_login',controller[_0xe25e('0xf')]);router[_0xe25e('0x7')](_0xe25e('0x10'),controller[_0xe25e('0x11')]);router['get'](_0xe25e('0x12'),controller[_0xe25e('0x13')]);router[_0xe25e('0x7')]('/:id/favicon',controller[_0xe25e('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cfb7c,_0x1dda82,_0x3ae8c8){_0x3ae8c8(null,path[_0xe25e('0x15')](config[_0xe25e('0x16')],_0xe25e('0x17')));},'filename':function(_0x128863,_0x4e4da5,_0x5b5c37){_0x5b5c37(null,util[_0xe25e('0x18')]('%s%s',_0xe25e('0x19'),path['extname'](_0x4e4da5['originalname'])));}})});router[_0xe25e('0x1a')](_0xe25e('0xd'),upload[_0xe25e('0x1b')](_0xe25e('0x1c')),controller[_0xe25e('0x1d')]);var upload=multer({'storage':multer[_0xe25e('0x1e')]({'destination':function(_0x70d945,_0x56f993,_0x5b59eb){_0x5b59eb(null,path[_0xe25e('0x15')](config[_0xe25e('0x16')],_0xe25e('0x17')));},'filename':function(_0x24258c,_0x45baf6,_0x1d6a46){_0x1d6a46(null,util[_0xe25e('0x18')](_0xe25e('0x1f'),'logologin',path[_0xe25e('0x20')](_0x45baf6[_0xe25e('0x21')])));}})});router['post'](_0xe25e('0x22'),upload[_0xe25e('0x1b')]('file'),controller[_0xe25e('0x23')]);var upload=multer({'storage':multer[_0xe25e('0x1e')]({'destination':function(_0x1f8749,_0x4a6ec0,_0x56c8a0){_0x56c8a0(null,path[_0xe25e('0x15')](config[_0xe25e('0x16')],_0xe25e('0x17')));},'filename':function(_0x4a74e2,_0x4de213,_0x54ddef){_0x54ddef(null,util[_0xe25e('0x18')]('%s%s',_0xe25e('0x24'),path[_0xe25e('0x20')](_0x4de213[_0xe25e('0x21')])));}})});router['post'](_0xe25e('0x12'),upload['single'](_0xe25e('0x1c')),controller[_0xe25e('0x25')]);var upload=multer({'storage':multer[_0xe25e('0x1e')]({'destination':function(_0x2206f4,_0x3c9157,_0x1c75d7){_0x1c75d7(null,path['join'](config[_0xe25e('0x16')],_0xe25e('0x17')));},'filename':function(_0x50a9d3,_0x4da99a,_0x25d449){_0x25d449(null,util[_0xe25e('0x18')]('%s%s','favicon',path[_0xe25e('0x20')](_0x4da99a[_0xe25e('0x21')])));}})});router[_0xe25e('0x1a')]('/:id/favicon',upload[_0xe25e('0x1b')](_0xe25e('0x1c')),controller[_0xe25e('0x26')]);router[_0xe25e('0x27')](_0xe25e('0x28'),auth[_0xe25e('0x8')](),controller[_0xe25e('0x29')]);module[_0xe25e('0x2a')]=router; \ No newline at end of file +var _0x771a=['getFavicon','diskStorage','join','server/files/images/logos/','%s%s','logo','post','single','file','addLogo','root','format','logologin','extname','preferred','originalname','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./setting.controller','get','isAuthenticated','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x771a,0xee));var _0xa771=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x771a[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0xa771('0x0'));var util=require(_0xa771('0x1'));var path=require(_0xa771('0x2'));var timeout=require(_0xa771('0x3'));var express=require(_0xa771('0x4'));var router=express[_0xa771('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa771('0x6'));var config=require('../../config/environment');var controller=require(_0xa771('0x7'));router[_0xa771('0x8')]('/',auth[_0xa771('0x9')](),controller['index']);router[_0xa771('0x8')](_0xa771('0xa'),controller['getDate']);router['get'](_0xa771('0xb'),controller[_0xa771('0xc')]);router[_0xa771('0x8')](_0xa771('0xd'),controller[_0xa771('0xe')]);router['get'](_0xa771('0xf'),controller['getLogoLogin']);router[_0xa771('0x8')](_0xa771('0x10'),controller[_0xa771('0x11')]);router[_0xa771('0x8')](_0xa771('0x12'),controller[_0xa771('0x13')]);router['get']('/:id/favicon',controller[_0xa771('0x14')]);var upload=multer({'storage':multer[_0xa771('0x15')]({'destination':function(_0x5d96fc,_0x9ae4b0,_0x17c40a){_0x17c40a(null,path[_0xa771('0x16')](config['root'],_0xa771('0x17')));},'filename':function(_0x2a44b3,_0x10e32a,_0x2a615a){_0x2a615a(null,util['format'](_0xa771('0x18'),_0xa771('0x19'),path['extname'](_0x10e32a['originalname'])));}})});router[_0xa771('0x1a')](_0xa771('0xd'),upload[_0xa771('0x1b')](_0xa771('0x1c')),controller[_0xa771('0x1d')]);var upload=multer({'storage':multer[_0xa771('0x15')]({'destination':function(_0x1d3528,_0x594ac6,_0x209b40){_0x209b40(null,path[_0xa771('0x16')](config[_0xa771('0x1e')],'server/files/images/logos/'));},'filename':function(_0x2a63d,_0x48e593,_0x495a57){_0x495a57(null,util[_0xa771('0x1f')](_0xa771('0x18'),_0xa771('0x20'),path[_0xa771('0x21')](_0x48e593['originalname'])));}})});router[_0xa771('0x1a')](_0xa771('0xf'),upload[_0xa771('0x1b')](_0xa771('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xa771('0x15')]({'destination':function(_0x5ba300,_0x43ae90,_0x5bc7d7){_0x5bc7d7(null,path[_0xa771('0x16')](config[_0xa771('0x1e')],'server/files/images/logos/'));},'filename':function(_0x213cdd,_0x22242a,_0x48138b){_0x48138b(null,util['format'](_0xa771('0x18'),_0xa771('0x22'),path['extname'](_0x22242a[_0xa771('0x23')])));}})});router[_0xa771('0x1a')](_0xa771('0x12'),upload[_0xa771('0x1b')](_0xa771('0x1c')),controller[_0xa771('0x24')]);var upload=multer({'storage':multer[_0xa771('0x15')]({'destination':function(_0x125a9b,_0x120039,_0x41a098){_0x41a098(null,path[_0xa771('0x16')](config[_0xa771('0x1e')],_0xa771('0x17')));},'filename':function(_0xee224a,_0x51006c,_0x2f747b){_0x2f747b(null,util['format']('%s%s',_0xa771('0x25'),path['extname'](_0x51006c[_0xa771('0x23')])));}})});router[_0xa771('0x1a')](_0xa771('0x26'),upload['single'](_0xa771('0x1c')),controller[_0xa771('0x27')]);router[_0xa771('0x28')](_0xa771('0xb'),auth['isAuthenticated'](),controller[_0xa771('0x29')]);module[_0xa771('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 6e5f8fa..1b813f0 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x244961,_0x209ab2){var _0x27f0e6=function(_0x2ad29c){while(--_0x2ad29c){_0x244961['push'](_0x244961['shift']());}};_0x27f0e6(++_0x209ab2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x325859,_0x2b3976){var _0xd45e82=function(_0x53dc73){while(--_0x53dc73){_0x325859['push'](_0x325859['shift']());}};_0xd45e82(++_0x2b3976);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c8ca9df..e2a9f71 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4fa=['../../config/environment','../../config/license/util','../../mysqldb','client','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Setting','includeAll','findAll','catch','find','body','file','logo','filename','params','addLogoLogin','loginLogo','server/files/images/logos','getLicense','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default','upperFirst','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','favicon','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','defaultLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils'];(function(_0x4ba12e,_0x177b38){var _0x6ea280=function(_0x353cd4){while(--_0x353cd4){_0x4ba12e['push'](_0x4ba12e['shift']());}};_0x6ea280(++_0x177b38);}(_0xa4fa,0x1ca));var _0xaa4f=function(_0x43d252,_0x1a0d28){_0x43d252=_0x43d252-0x0;var _0x404c0d=_0xa4fa[_0x43d252];return _0x404c0d;};'use strict';var emlformat=require(_0xaa4f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa4f('0x1'));var rp=require(_0xaa4f('0x2'));var moment=require('moment');var BPromise=require(_0xaa4f('0x3'));var Mustache=require(_0xaa4f('0x4'));var util=require('util');var path=require(_0xaa4f('0x5'));var sox=require('sox');var csv=require(_0xaa4f('0x6'));var ejs=require(_0xaa4f('0x7'));var fs=require('fs');var fs_extra=require(_0xaa4f('0x8'));var _=require(_0xaa4f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa4f('0xa'));var deskjs=require(_0xaa4f('0xb'));var toCsv=require(_0xaa4f('0x6'));var querystring=require(_0xaa4f('0xc'));var Papa=require(_0xaa4f('0xd'));var Redis=require(_0xaa4f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa4f('0xf'));var logger=require('../../config/logger')(_0xaa4f('0x10'));var utils=require(_0xaa4f('0x11'));var config=require(_0xaa4f('0x12'));var licenseUtil=require(_0xaa4f('0x13'));var db=require(_0xaa4f('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xaa4f('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50abd5,_0x2fd1a8,_0x4a8c02,_0x7848b1){return new BPromise(function(_0x5ad081,_0x3626d1){var _0xd4bce4=_0x7848b1||client;return _0xd4bce4[_0xaa4f('0x16')](_0x50abd5,_0x4a8c02)[_0xaa4f('0x17')](function(_0x37241f){logger['info']('Setting,\x20%s,\x20%s',_0x2fd1a8,_0xaa4f('0x18'));logger[_0xaa4f('0x19')](_0xaa4f('0x1a'),_0x2fd1a8,_0xaa4f('0x18'),JSON['stringify'](_0x37241f));if(_0x37241f[_0xaa4f('0x1b')]){if(_0x37241f[_0xaa4f('0x1b')][_0xaa4f('0x1c')]===0x1f4){logger[_0xaa4f('0x1b')](_0xaa4f('0x1d'),_0x2fd1a8,_0x37241f['error']['message']);return _0x3626d1(_0x37241f[_0xaa4f('0x1b')]['message']);}logger[_0xaa4f('0x1b')](_0xaa4f('0x1d'),_0x2fd1a8,_0x37241f[_0xaa4f('0x1b')][_0xaa4f('0x1e')]);return _0x5ad081(_0x37241f[_0xaa4f('0x1b')]['message']);}else{logger[_0xaa4f('0x1f')](_0xaa4f('0x1d'),_0x2fd1a8,_0xaa4f('0x18'));_0x5ad081(_0x37241f[_0xaa4f('0x20')][_0xaa4f('0x1e')]);}})['catch'](function(_0x503bd2){logger[_0xaa4f('0x1b')](_0xaa4f('0x1d'),_0x2fd1a8,_0x503bd2);_0x3626d1(_0x503bd2);});});}function respondWithStatusCode(_0x1293fe,_0x14bdc9){_0x14bdc9=_0x14bdc9||0xcc;return function(_0x2256d6){if(_0x2256d6){return _0x1293fe[_0xaa4f('0x21')](_0x14bdc9);}return _0x1293fe[_0xaa4f('0x22')](_0x14bdc9)[_0xaa4f('0x23')]();};}function respondWithResult(_0xc058cc,_0x3de504){_0x3de504=_0x3de504||0xc8;return function(_0x3bfe9d){if(_0x3bfe9d){return _0xc058cc[_0xaa4f('0x22')](_0x3de504)[_0xaa4f('0x24')](_0x3bfe9d);}};}function respondWithFilteredResult(_0x1594da,_0x59bb12){return function(_0x48d089){if(_0x48d089){var _0x55a330=typeof _0x59bb12[_0xaa4f('0x25')]==='undefined'&&typeof _0x59bb12[_0xaa4f('0x26')]===_0xaa4f('0x27');var _0x1bace5=_0x48d089[_0xaa4f('0x28')];var _0x49ec43=_0x55a330?0x0:_0x59bb12[_0xaa4f('0x25')];var _0x37b018=_0x55a330?_0x48d089[_0xaa4f('0x28')]:_0x59bb12[_0xaa4f('0x25')]+_0x59bb12[_0xaa4f('0x26')];var _0x327dff;if(_0x37b018>=_0x1bace5){_0x37b018=_0x1bace5;_0x327dff=0xc8;}else{_0x327dff=0xce;}_0x1594da[_0xaa4f('0x22')](_0x327dff);return _0x1594da[_0xaa4f('0x29')]('Content-Range',_0x49ec43+'-'+_0x37b018+'/'+_0x1bace5)[_0xaa4f('0x24')](_0x48d089);}return null;};}function patchUpdates(_0x16a41a){return function(_0x75de36){try{jsonpatch[_0xaa4f('0x2a')](_0x75de36,_0x16a41a,!![]);}catch(_0x197463){return BPromise[_0xaa4f('0x2b')](_0x197463);}return _0x75de36[_0xaa4f('0x2c')]();};}function saveUpdates(_0x5f24e2,_0x1fc89b){return function(_0x3e7925){if(_0x3e7925){return _0x3e7925[_0xaa4f('0x2d')](_0x5f24e2)[_0xaa4f('0x17')](function(_0x41a04e){return _0x41a04e;});}return null;};}function removeEntity(_0x196e83,_0x3b63d5){return function(_0x370c4b){if(_0x370c4b){return _0x370c4b[_0xaa4f('0x2e')]()[_0xaa4f('0x17')](function(){_0x196e83['status'](0xcc)[_0xaa4f('0x23')]();});}};}function handleEntityNotFound(_0x59ea94,_0x471ef6){return function(_0x34c4ca){if(!_0x34c4ca){_0x59ea94['sendStatus'](0x194);}return _0x34c4ca;};}function handleError(_0x443b95,_0x201050){_0x201050=_0x201050||0x1f4;return function(_0x1aa961){logger[_0xaa4f('0x1b')](_0x1aa961['stack']);if(_0x1aa961[_0xaa4f('0x2f')]){delete _0x1aa961['name'];}_0x443b95[_0xaa4f('0x22')](_0x201050)[_0xaa4f('0x30')](_0x1aa961);};}exports[_0xaa4f('0x31')]=function(_0x5c5b14,_0x25186e){var _0x5ebd4f={},_0x43d4a5={},_0x1e608f={'count':0x0,'rows':[]};var _0x65f626=_[_0xaa4f('0x32')](db['Setting'][_0xaa4f('0x33')],function(_0x1b4d57){return{'name':_0x1b4d57[_0xaa4f('0x34')],'type':_0x1b4d57[_0xaa4f('0x35')][_0xaa4f('0x36')]};});_0x43d4a5[_0xaa4f('0x37')]=_['map'](_0x65f626,'name');_0x43d4a5[_0xaa4f('0x38')]=_[_0xaa4f('0x39')](_0x5c5b14[_0xaa4f('0x38')]);_0x43d4a5['filters']=_[_0xaa4f('0x3a')](_0x43d4a5[_0xaa4f('0x37')],_0x43d4a5['query']);_0x5ebd4f['attributes']=_[_0xaa4f('0x3a')](_0x43d4a5[_0xaa4f('0x37')],qs[_0xaa4f('0x3b')](_0x5c5b14['query'][_0xaa4f('0x3b')]));_0x5ebd4f['attributes']=_0x5ebd4f[_0xaa4f('0x3c')][_0xaa4f('0x3d')]?_0x5ebd4f[_0xaa4f('0x3c')]:_0x43d4a5[_0xaa4f('0x37')];if(!_0x5c5b14[_0xaa4f('0x38')][_0xaa4f('0x3e')](_0xaa4f('0x3f'))){_0x5ebd4f[_0xaa4f('0x26')]=qs[_0xaa4f('0x26')](_0x5c5b14[_0xaa4f('0x38')][_0xaa4f('0x26')]);_0x5ebd4f[_0xaa4f('0x25')]=qs[_0xaa4f('0x25')](_0x5c5b14[_0xaa4f('0x38')][_0xaa4f('0x25')]);}_0x5ebd4f['order']=qs['sort'](_0x5c5b14[_0xaa4f('0x38')][_0xaa4f('0x40')]);_0x5ebd4f[_0xaa4f('0x41')]=qs[_0xaa4f('0x42')](_[_0xaa4f('0x43')](_0x5c5b14[_0xaa4f('0x38')],_0x43d4a5['filters']),_0x65f626);if(_0x5c5b14[_0xaa4f('0x38')][_0xaa4f('0x44')]){_0x5ebd4f['where']=_[_0xaa4f('0x45')](_0x5ebd4f[_0xaa4f('0x41')],{'$or':_[_0xaa4f('0x32')](_0x65f626,function(_0x2f783a){if(_0x2f783a['type']!==_0xaa4f('0x46')){var _0x110525={};_0x110525[_0x2f783a[_0xaa4f('0x2f')]]={'$like':'%'+_0x5c5b14['query'][_0xaa4f('0x44')]+'%'};return _0x110525;}})});}_0x5ebd4f=_['merge']({},_0x5ebd4f,_0x5c5b14[_0xaa4f('0x47')]);var _0x30e676={'where':_0x5ebd4f['where']};return db[_0xaa4f('0x48')][_0xaa4f('0x28')](_0x30e676)[_0xaa4f('0x17')](function(_0x523520){_0x1e608f[_0xaa4f('0x28')]=_0x523520;if(_0x5c5b14[_0xaa4f('0x38')][_0xaa4f('0x49')]){_0x5ebd4f['include']=[{'all':!![]}];}return db['Setting'][_0xaa4f('0x4a')](_0x5ebd4f);})[_0xaa4f('0x17')](function(_0x7f4713){_0x1e608f['rows']=_0x7f4713;return _0x1e608f;})['then'](respondWithFilteredResult(_0x25186e,_0x5ebd4f))[_0xaa4f('0x4b')](handleError(_0x25186e,null));};exports['show']=function(_0x5e1bf8,_0x4ca528){var _0x456449={'raw':![],'where':{'id':_0x5e1bf8['params']['id']}},_0x33ebcc={};_0x33ebcc[_0xaa4f('0x37')]=_[_0xaa4f('0x39')](db[_0xaa4f('0x48')][_0xaa4f('0x33')]);_0x33ebcc[_0xaa4f('0x38')]=_[_0xaa4f('0x39')](_0x5e1bf8['query']);_0x33ebcc[_0xaa4f('0x42')]=_[_0xaa4f('0x3a')](_0x33ebcc[_0xaa4f('0x37')],_0x33ebcc[_0xaa4f('0x38')]);_0x456449[_0xaa4f('0x3c')]=_[_0xaa4f('0x3a')](_0x33ebcc['model'],qs[_0xaa4f('0x3b')](_0x5e1bf8[_0xaa4f('0x38')][_0xaa4f('0x3b')]));_0x456449[_0xaa4f('0x3c')]=_0x456449['attributes'][_0xaa4f('0x3d')]?_0x456449[_0xaa4f('0x3c')]:_0x33ebcc[_0xaa4f('0x37')];if(_0x5e1bf8[_0xaa4f('0x38')][_0xaa4f('0x49')]){_0x456449['include']=[{'all':!![]}];}_0x456449=_[_0xaa4f('0x45')]({},_0x456449,_0x5e1bf8[_0xaa4f('0x47')]);return db[_0xaa4f('0x48')][_0xaa4f('0x4c')](_0x456449)[_0xaa4f('0x17')](handleEntityNotFound(_0x4ca528,null))[_0xaa4f('0x17')](respondWithResult(_0x4ca528,null))[_0xaa4f('0x4b')](handleError(_0x4ca528,null));};exports[_0xaa4f('0x2d')]=function(_0x4f2ec5,_0xeb40dc){if(_0x4f2ec5[_0xaa4f('0x4d')]['id']){delete _0x4f2ec5[_0xaa4f('0x4d')]['id'];}return db[_0xaa4f('0x48')]['find']({'where':{'id':_0x4f2ec5['params']['id']}})[_0xaa4f('0x17')](handleEntityNotFound(_0xeb40dc,null))['then'](saveUpdates(_0x4f2ec5[_0xaa4f('0x4d')],null))[_0xaa4f('0x17')](respondWithResult(_0xeb40dc,null))['catch'](handleError(_0xeb40dc,null));};exports['addLogo']=function(_0x29dcf2,_0x7625a9,_0x353937){if(_0x29dcf2[_0xaa4f('0x4e')]&&_0x29dcf2[_0xaa4f('0x4e')]['filename']){_0x29dcf2['body'][_0xaa4f('0x4f')]=_0x29dcf2['file'][_0xaa4f('0x50')];}return db[_0xaa4f('0x48')][_0xaa4f('0x4c')]({'where':{'id':_0x29dcf2[_0xaa4f('0x51')]['id']}})[_0xaa4f('0x17')](handleEntityNotFound(_0x7625a9,null))[_0xaa4f('0x17')](saveUpdates(_0x29dcf2[_0xaa4f('0x4d')],null))[_0xaa4f('0x17')](respondWithResult(_0x7625a9,null))['catch'](handleError(_0x7625a9,null));};exports[_0xaa4f('0x52')]=function(_0xd54fbe,_0x13f558,_0xe6c938){if(_0xd54fbe['file']&&_0xd54fbe['file'][_0xaa4f('0x50')]){_0xd54fbe['body'][_0xaa4f('0x53')]=_0xd54fbe[_0xaa4f('0x4e')][_0xaa4f('0x50')];}return db[_0xaa4f('0x48')][_0xaa4f('0x4c')]({'where':{'id':_0xd54fbe[_0xaa4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x13f558,null))[_0xaa4f('0x17')](saveUpdates(_0xd54fbe['body'],null))['then'](respondWithResult(_0x13f558,null))[_0xaa4f('0x4b')](handleError(_0x13f558,null));};var utilLicense=require(_0xaa4f('0x13'));exports['getLogo']=function(_0x9bb696,_0x1e37e4,_0x3873a1){var _0xef133d=_0xaa4f('0x54');var _0x35225f={'custom':![]};return utilLicense[_0xaa4f('0x55')]()[_0xaa4f('0x17')](function(_0x5458ab){if(_0x5458ab){_0x35225f=_0x5458ab;}return db[_0xaa4f('0x48')]['find']({'where':{'id':_0x9bb696[_0xaa4f('0x51')]['id']},'attributes':[_0xaa4f('0x4f'),'loginLogo','preferred','favicon','defaultLogo',_0xaa4f('0x56'),_0xaa4f('0x57'),_0xaa4f('0x58')],'raw':!![]});})[_0xaa4f('0x17')](handleEntityNotFound(_0x1e37e4,null))[_0xaa4f('0x17')](function(_0x48a4f1){if(_0x48a4f1){var _0x2ba0ef=_0x48a4f1[_0xaa4f('0x4f')]&&fs[_0xaa4f('0x59')](path['join'](config[_0xaa4f('0x5a')],_0xef133d,_[_0xaa4f('0x5b')](_0x48a4f1['logo'])))?path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0xef133d,_[_0xaa4f('0x5b')](_0x48a4f1[_0xaa4f('0x4f')])):path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0xef133d,_[_0xaa4f('0x5b')]('default_logo.svg'));var _0x2d1bca=_0xaa4f('0x5d')+_[_0xaa4f('0x5e')]('logo');if(_0x48a4f1[_0x2d1bca]||!_0x35225f['custom']){_0x2ba0ef=path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0xef133d,_[_0xaa4f('0x5b')](_0xaa4f('0x5f')));}if(!fs['existsSync'](_0x2ba0ef)){throw new db[(_0xaa4f('0x60'))][(_0xaa4f('0x61'))](_[_0xaa4f('0x5e')](_0xaa4f('0x4f'))+_0xaa4f('0x62'));}return _0x1e37e4[_0xaa4f('0x63')](_0x2ba0ef);}})['catch'](handleError(_0x1e37e4,null));};var utilLicense=require(_0xaa4f('0x13'));exports[_0xaa4f('0x64')]=function(_0x33a40c,_0x2b5a40,_0x8976a){var _0x35c373=_0xaa4f('0x54');var _0x368189={'custom':![]};return utilLicense[_0xaa4f('0x55')]()[_0xaa4f('0x17')](function(_0x2ff2cf){if(_0x2ff2cf){_0x368189=_0x2ff2cf;}return db['Setting']['find']({'where':{'id':_0x33a40c['params']['id']},'attributes':[_0xaa4f('0x4f'),'loginLogo',_0xaa4f('0x65'),_0xaa4f('0x66'),'defaultLogo',_0xaa4f('0x56'),'defaultPreferred',_0xaa4f('0x58')],'raw':!![]});})[_0xaa4f('0x17')](handleEntityNotFound(_0x2b5a40,null))['then'](function(_0x2826dd){if(_0x2826dd){var _0x99e53e=_0x2826dd[_0xaa4f('0x53')]&&fs[_0xaa4f('0x59')](path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x35c373,_['toLower'](_0x2826dd[_0xaa4f('0x53')])))?path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x35c373,_[_0xaa4f('0x5b')](_0x2826dd[_0xaa4f('0x53')])):path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x35c373,_[_0xaa4f('0x5b')](_0xaa4f('0x67')));var _0xc4324f='default'+_['upperFirst'](_0xaa4f('0x53'));if(_0x2826dd[_0xc4324f]||!_0x368189[_0xaa4f('0x68')]){_0x99e53e=path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x35c373,_['toLower'](_0xaa4f('0x67')));}if(!fs[_0xaa4f('0x59')](_0x99e53e)){throw new db['Sequelize'][(_0xaa4f('0x61'))](_[_0xaa4f('0x5e')](_0xaa4f('0x53'))+_0xaa4f('0x62'));}return _0x2b5a40[_0xaa4f('0x63')](_0x99e53e);}})['catch'](handleError(_0x2b5a40,null));};exports[_0xaa4f('0x69')]=function(_0x42f9e5,_0x5450e3){return db['Setting']['find']({'where':{'id':_0x42f9e5[_0xaa4f('0x51')]['id']},'attributes':[_0xaa4f('0x6a')]})['then'](respondWithResult(_0x5450e3,null))[_0xaa4f('0x4b')](handleError(_0x5450e3,null));};exports[_0xaa4f('0x6b')]=function(_0x4e44e8,_0x58e4af,_0x2e6c48){if(_0x4e44e8[_0xaa4f('0x4e')]&&_0x4e44e8[_0xaa4f('0x4e')][_0xaa4f('0x50')]){_0x4e44e8[_0xaa4f('0x4d')][_0xaa4f('0x65')]=_0x4e44e8[_0xaa4f('0x4e')][_0xaa4f('0x50')];}return db[_0xaa4f('0x48')][_0xaa4f('0x4c')]({'where':{'id':_0x4e44e8['params']['id']}})[_0xaa4f('0x17')](handleEntityNotFound(_0x58e4af,null))[_0xaa4f('0x17')](saveUpdates(_0x4e44e8[_0xaa4f('0x4d')],null))['then'](respondWithResult(_0x58e4af,null))[_0xaa4f('0x4b')](handleError(_0x58e4af,null));};var utilLicense=require(_0xaa4f('0x13'));exports[_0xaa4f('0x6c')]=function(_0x1bf1f5,_0x48b152,_0x24a614){var _0x23ec7=_0xaa4f('0x54');var _0x5f12c3={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x3c3dfc){if(_0x3c3dfc){_0x5f12c3=_0x3c3dfc;}return db[_0xaa4f('0x48')]['find']({'where':{'id':_0x1bf1f5['params']['id']},'attributes':['logo',_0xaa4f('0x53'),_0xaa4f('0x65'),_0xaa4f('0x66'),_0xaa4f('0x6d'),_0xaa4f('0x56'),_0xaa4f('0x57'),_0xaa4f('0x58')],'raw':!![]});})[_0xaa4f('0x17')](handleEntityNotFound(_0x48b152,null))[_0xaa4f('0x17')](function(_0x32e71d){if(_0x32e71d){var _0x498691=_0x32e71d[_0xaa4f('0x65')]&&fs['existsSync'](path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x23ec7,_['toLower'](_0x32e71d['preferred'])))?path[_0xaa4f('0x5c')](config['root'],_0x23ec7,_['toLower'](_0x32e71d['preferred'])):path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x23ec7,_[_0xaa4f('0x5b')](_0xaa4f('0x6e')));var _0x5547bd=_0xaa4f('0x5d')+_[_0xaa4f('0x5e')](_0xaa4f('0x65'));if(_0x32e71d[_0x5547bd]||!_0x5f12c3[_0xaa4f('0x68')]||!_0x5f12c3[_0xaa4f('0x65')]){_0x498691=path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x23ec7,_[_0xaa4f('0x5b')](_0xaa4f('0x6e')));}if(!fs[_0xaa4f('0x59')](_0x498691)){throw new db[(_0xaa4f('0x60'))][(_0xaa4f('0x61'))](_['upperFirst'](_0xaa4f('0x65'))+_0xaa4f('0x62'));}return _0x48b152[_0xaa4f('0x63')](_0x498691);}})[_0xaa4f('0x4b')](handleError(_0x48b152,null));};exports[_0xaa4f('0x6f')]=function(_0x491593,_0x443fbd,_0x370fde){if(_0x491593['file']&&_0x491593['file'][_0xaa4f('0x50')]){_0x491593[_0xaa4f('0x4d')]['favicon']=_0x491593[_0xaa4f('0x4e')][_0xaa4f('0x50')];}return db[_0xaa4f('0x48')][_0xaa4f('0x4c')]({'where':{'id':_0x491593[_0xaa4f('0x51')]['id']}})[_0xaa4f('0x17')](handleEntityNotFound(_0x443fbd,null))[_0xaa4f('0x17')](saveUpdates(_0x491593['body'],null))['then'](respondWithResult(_0x443fbd,null))['catch'](handleError(_0x443fbd,null));};var utilLicense=require(_0xaa4f('0x13'));exports[_0xaa4f('0x70')]=function(_0x698c3d,_0x1284c8,_0x50ae1a){var _0x23456a=_0xaa4f('0x54');var _0x2a69af={'custom':![]};return utilLicense[_0xaa4f('0x55')]()[_0xaa4f('0x17')](function(_0x7cc65b){if(_0x7cc65b){_0x2a69af=_0x7cc65b;}return db[_0xaa4f('0x48')][_0xaa4f('0x4c')]({'where':{'id':_0x698c3d[_0xaa4f('0x51')]['id']},'attributes':[_0xaa4f('0x4f'),'loginLogo','preferred',_0xaa4f('0x66'),_0xaa4f('0x6d'),_0xaa4f('0x56'),'defaultPreferred',_0xaa4f('0x58')],'raw':!![]});})['then'](handleEntityNotFound(_0x1284c8,null))[_0xaa4f('0x17')](function(_0x1fbace){if(_0x1fbace){var _0x472aeb=_0x1fbace[_0xaa4f('0x66')]&&fs[_0xaa4f('0x59')](path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x23456a,_[_0xaa4f('0x5b')](_0x1fbace[_0xaa4f('0x66')])))?path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x23456a,_[_0xaa4f('0x5b')](_0x1fbace[_0xaa4f('0x66')])):path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x23456a,_[_0xaa4f('0x5b')](_0xaa4f('0x71')));var _0x21ff28=_0xaa4f('0x5d')+_['upperFirst']('favicon');if(_0x1fbace[_0x21ff28]||!_0x2a69af[_0xaa4f('0x68')]){_0x472aeb=path[_0xaa4f('0x5c')](config[_0xaa4f('0x5a')],_0x23456a,_[_0xaa4f('0x5b')](_0xaa4f('0x71')));}if(!fs[_0xaa4f('0x59')](_0x472aeb)){throw new db[(_0xaa4f('0x60'))][(_0xaa4f('0x61'))](_[_0xaa4f('0x5e')](_0xaa4f('0x66'))+_0xaa4f('0x62'));}return _0x1284c8[_0xaa4f('0x63')](_0x472aeb);}})[_0xaa4f('0x4b')](handleError(_0x1284c8,null));};exports[_0xaa4f('0x72')]=function(_0x36fc26,_0x139f68){var _0x18485f={'offset':moment()[_0xaa4f('0x73')]()};_0x18485f[_0xaa4f('0x74')]=moment()[_0xaa4f('0x73')](_0x18485f['offset'])[_0xaa4f('0x75')](_0xaa4f('0x76'));return _0x139f68['status'](0xc8)['send'](_0x18485f);}; \ No newline at end of file +var _0x1974=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','sendStatus','name','send','index','map','Setting','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','filter','options','findAll','show','params','includeAll','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLicense','defaultLogo','defaultLoginLogo','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x1974,0x1d3));var _0x4197=function(_0x1e1bbf,_0x5b5fa){_0x1e1bbf=_0x1e1bbf-0x0;var _0x6c8742=_0x1974[_0x1e1bbf];return _0x6c8742;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4197('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4197('0x1'));var moment=require(_0x4197('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4197('0x3'));var util=require(_0x4197('0x4'));var path=require(_0x4197('0x5'));var sox=require(_0x4197('0x6'));var csv=require(_0x4197('0x7'));var ejs=require(_0x4197('0x8'));var fs=require('fs');var fs_extra=require(_0x4197('0x9'));var _=require(_0x4197('0xa'));var squel=require(_0x4197('0xb'));var crypto=require(_0x4197('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4197('0x7'));var querystring=require(_0x4197('0xd'));var Papa=require(_0x4197('0xe'));var Redis=require(_0x4197('0xf'));var authService=require(_0x4197('0x10'));var qs=require(_0x4197('0x11'));var as=require(_0x4197('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4197('0x13'))(_0x4197('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4197('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4197('0x16'));var client=jayson[_0x4197('0x17')][_0x4197('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3e08a5,_0x23351c,_0xf08901,_0x246c4f){return new BPromise(function(_0x37f56f,_0x3fccc5){var _0x12f05a=_0x246c4f||client;return _0x12f05a[_0x4197('0x19')](_0x3e08a5,_0xf08901)[_0x4197('0x1a')](function(_0x10d378){logger[_0x4197('0x1b')](_0x4197('0x1c'),_0x23351c,_0x4197('0x1d'));logger[_0x4197('0x1e')](_0x4197('0x1f'),_0x23351c,'request\x20sent',JSON[_0x4197('0x20')](_0x10d378));if(_0x10d378['error']){if(_0x10d378['error'][_0x4197('0x21')]===0x1f4){logger[_0x4197('0x22')]('Setting,\x20%s,\x20%s',_0x23351c,_0x10d378[_0x4197('0x22')]['message']);return _0x3fccc5(_0x10d378[_0x4197('0x22')][_0x4197('0x23')]);}logger['error'](_0x4197('0x1c'),_0x23351c,_0x10d378[_0x4197('0x22')]['message']);return _0x37f56f(_0x10d378[_0x4197('0x22')][_0x4197('0x23')]);}else{logger['info'](_0x4197('0x1c'),_0x23351c,'request\x20sent');_0x37f56f(_0x10d378[_0x4197('0x24')][_0x4197('0x23')]);}})[_0x4197('0x25')](function(_0x5346e4){logger[_0x4197('0x22')](_0x4197('0x1c'),_0x23351c,_0x5346e4);_0x3fccc5(_0x5346e4);});});}function respondWithStatusCode(_0x87ee95,_0x19e1df){_0x19e1df=_0x19e1df||0xcc;return function(_0x3abbe2){if(_0x3abbe2){return _0x87ee95['sendStatus'](_0x19e1df);}return _0x87ee95[_0x4197('0x26')](_0x19e1df)[_0x4197('0x27')]();};}function respondWithResult(_0x3d60d3,_0x5ac774){_0x5ac774=_0x5ac774||0xc8;return function(_0x97cb76){if(_0x97cb76){return _0x3d60d3[_0x4197('0x26')](_0x5ac774)['json'](_0x97cb76);}};}function respondWithFilteredResult(_0x5b0c13,_0x1a1c6d){return function(_0xce5c0f){if(_0xce5c0f){var _0x3bb82e=typeof _0x1a1c6d[_0x4197('0x28')]===_0x4197('0x29')&&typeof _0x1a1c6d[_0x4197('0x2a')]===_0x4197('0x29');var _0x326c8b=_0xce5c0f[_0x4197('0x2b')];var _0xf83858=_0x3bb82e?0x0:_0x1a1c6d[_0x4197('0x28')];var _0x44c8fb=_0x3bb82e?_0xce5c0f[_0x4197('0x2b')]:_0x1a1c6d[_0x4197('0x28')]+_0x1a1c6d['limit'];var _0x1bca16;if(_0x44c8fb>=_0x326c8b){_0x44c8fb=_0x326c8b;_0x1bca16=0xc8;}else{_0x1bca16=0xce;}_0x5b0c13['status'](_0x1bca16);return _0x5b0c13['set'](_0x4197('0x2c'),_0xf83858+'-'+_0x44c8fb+'/'+_0x326c8b)[_0x4197('0x2d')](_0xce5c0f);}return null;};}function patchUpdates(_0x1b92e6){return function(_0x2410c7){try{jsonpatch['apply'](_0x2410c7,_0x1b92e6,!![]);}catch(_0x77fc69){return BPromise[_0x4197('0x2e')](_0x77fc69);}return _0x2410c7[_0x4197('0x2f')]();};}function saveUpdates(_0x531fa8,_0x231e64){return function(_0x5aa0de){if(_0x5aa0de){return _0x5aa0de[_0x4197('0x30')](_0x531fa8)['then'](function(_0xcb8ca9){return _0xcb8ca9;});}return null;};}function removeEntity(_0x5b524b,_0x141916){return function(_0x5843f8){if(_0x5843f8){return _0x5843f8['destroy']()['then'](function(){_0x5b524b[_0x4197('0x26')](0xcc)[_0x4197('0x27')]();});}};}function handleEntityNotFound(_0x5af5ed,_0x28ccd4){return function(_0x2db227){if(!_0x2db227){_0x5af5ed[_0x4197('0x31')](0x194);}return _0x2db227;};}function handleError(_0x188a4a,_0x13a7fc){_0x13a7fc=_0x13a7fc||0x1f4;return function(_0x45ac23){logger[_0x4197('0x22')](_0x45ac23['stack']);if(_0x45ac23[_0x4197('0x32')]){delete _0x45ac23[_0x4197('0x32')];}_0x188a4a['status'](_0x13a7fc)[_0x4197('0x33')](_0x45ac23);};}exports[_0x4197('0x34')]=function(_0x581156,_0x1ae777){var _0x39d2fb={},_0x4df13d={},_0x481ce1={'count':0x0,'rows':[]};var _0x1d5e48=_[_0x4197('0x35')](db[_0x4197('0x36')][_0x4197('0x37')],function(_0x79c6d9){return{'name':_0x79c6d9[_0x4197('0x38')],'type':_0x79c6d9[_0x4197('0x39')][_0x4197('0x3a')]};});_0x4df13d['model']=_[_0x4197('0x35')](_0x1d5e48,'name');_0x4df13d[_0x4197('0x3b')]=_[_0x4197('0x3c')](_0x581156[_0x4197('0x3b')]);_0x4df13d['filters']=_[_0x4197('0x3d')](_0x4df13d[_0x4197('0x3e')],_0x4df13d[_0x4197('0x3b')]);_0x39d2fb[_0x4197('0x3f')]=_[_0x4197('0x3d')](_0x4df13d[_0x4197('0x3e')],qs[_0x4197('0x40')](_0x581156['query'][_0x4197('0x40')]));_0x39d2fb[_0x4197('0x3f')]=_0x39d2fb[_0x4197('0x3f')][_0x4197('0x41')]?_0x39d2fb[_0x4197('0x3f')]:_0x4df13d['model'];if(!_0x581156[_0x4197('0x3b')][_0x4197('0x42')](_0x4197('0x43'))){_0x39d2fb[_0x4197('0x2a')]=qs['limit'](_0x581156[_0x4197('0x3b')][_0x4197('0x2a')]);_0x39d2fb['offset']=qs['offset'](_0x581156[_0x4197('0x3b')][_0x4197('0x28')]);}_0x39d2fb['order']=qs['sort'](_0x581156[_0x4197('0x3b')][_0x4197('0x44')]);_0x39d2fb['where']=qs[_0x4197('0x45')](_[_0x4197('0x46')](_0x581156['query'],_0x4df13d[_0x4197('0x45')]),_0x1d5e48);if(_0x581156[_0x4197('0x3b')]['filter']){_0x39d2fb[_0x4197('0x47')]=_[_0x4197('0x48')](_0x39d2fb[_0x4197('0x47')],{'$or':_[_0x4197('0x35')](_0x1d5e48,function(_0x2113d0){if(_0x2113d0[_0x4197('0x39')]!=='VIRTUAL'){var _0x54fc5c={};_0x54fc5c[_0x2113d0['name']]={'$like':'%'+_0x581156[_0x4197('0x3b')][_0x4197('0x49')]+'%'};return _0x54fc5c;}})});}_0x39d2fb=_[_0x4197('0x48')]({},_0x39d2fb,_0x581156[_0x4197('0x4a')]);var _0xf34a22={'where':_0x39d2fb[_0x4197('0x47')]};return db[_0x4197('0x36')]['count'](_0xf34a22)[_0x4197('0x1a')](function(_0x54bff7){_0x481ce1[_0x4197('0x2b')]=_0x54bff7;if(_0x581156[_0x4197('0x3b')]['includeAll']){_0x39d2fb['include']=[{'all':!![]}];}return db[_0x4197('0x36')][_0x4197('0x4b')](_0x39d2fb);})['then'](function(_0x408a3f){_0x481ce1['rows']=_0x408a3f;return _0x481ce1;})[_0x4197('0x1a')](respondWithFilteredResult(_0x1ae777,_0x39d2fb))[_0x4197('0x25')](handleError(_0x1ae777,null));};exports[_0x4197('0x4c')]=function(_0x29f5f6,_0x407c81){var _0x262ed8={'raw':![],'where':{'id':_0x29f5f6[_0x4197('0x4d')]['id']}},_0x55859c={};_0x55859c[_0x4197('0x3e')]=_[_0x4197('0x3c')](db['Setting'][_0x4197('0x37')]);_0x55859c['query']=_[_0x4197('0x3c')](_0x29f5f6[_0x4197('0x3b')]);_0x55859c[_0x4197('0x45')]=_[_0x4197('0x3d')](_0x55859c[_0x4197('0x3e')],_0x55859c['query']);_0x262ed8[_0x4197('0x3f')]=_[_0x4197('0x3d')](_0x55859c[_0x4197('0x3e')],qs[_0x4197('0x40')](_0x29f5f6[_0x4197('0x3b')][_0x4197('0x40')]));_0x262ed8[_0x4197('0x3f')]=_0x262ed8['attributes'][_0x4197('0x41')]?_0x262ed8['attributes']:_0x55859c['model'];if(_0x29f5f6['query'][_0x4197('0x4e')]){_0x262ed8['include']=[{'all':!![]}];}_0x262ed8=_[_0x4197('0x48')]({},_0x262ed8,_0x29f5f6['options']);return db[_0x4197('0x36')][_0x4197('0x4f')](_0x262ed8)[_0x4197('0x1a')](handleEntityNotFound(_0x407c81,null))[_0x4197('0x1a')](respondWithResult(_0x407c81,null))[_0x4197('0x25')](handleError(_0x407c81,null));};exports[_0x4197('0x30')]=function(_0x32b649,_0x475d01){if(_0x32b649['body']['id']){delete _0x32b649[_0x4197('0x50')]['id'];}return db[_0x4197('0x36')]['find']({'where':{'id':_0x32b649[_0x4197('0x4d')]['id']}})[_0x4197('0x1a')](handleEntityNotFound(_0x475d01,null))[_0x4197('0x1a')](saveUpdates(_0x32b649[_0x4197('0x50')],null))[_0x4197('0x1a')](respondWithResult(_0x475d01,null))['catch'](handleError(_0x475d01,null));};exports[_0x4197('0x51')]=function(_0x5d7f69,_0x80b07,_0x26c92a){if(_0x5d7f69[_0x4197('0x52')]&&_0x5d7f69[_0x4197('0x52')]['filename']){_0x5d7f69['body'][_0x4197('0x53')]=_0x5d7f69[_0x4197('0x52')][_0x4197('0x54')];}return db[_0x4197('0x36')][_0x4197('0x4f')]({'where':{'id':_0x5d7f69['params']['id']}})['then'](handleEntityNotFound(_0x80b07,null))[_0x4197('0x1a')](saveUpdates(_0x5d7f69['body'],null))[_0x4197('0x1a')](respondWithResult(_0x80b07,null))[_0x4197('0x25')](handleError(_0x80b07,null));};exports[_0x4197('0x55')]=function(_0x20f696,_0x140e7b,_0x41b76e){if(_0x20f696[_0x4197('0x52')]&&_0x20f696[_0x4197('0x52')][_0x4197('0x54')]){_0x20f696[_0x4197('0x50')][_0x4197('0x56')]=_0x20f696[_0x4197('0x52')][_0x4197('0x54')];}return db[_0x4197('0x36')][_0x4197('0x4f')]({'where':{'id':_0x20f696[_0x4197('0x4d')]['id']}})[_0x4197('0x1a')](handleEntityNotFound(_0x140e7b,null))['then'](saveUpdates(_0x20f696[_0x4197('0x50')],null))['then'](respondWithResult(_0x140e7b,null))[_0x4197('0x25')](handleError(_0x140e7b,null));};var utilLicense=require(_0x4197('0x15'));exports[_0x4197('0x57')]=function(_0x3200ed,_0x276b05,_0x349c6d){var _0x5d9dc0=_0x4197('0x58');var _0x8f4b8e={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x434b92){if(_0x434b92){_0x8f4b8e=_0x434b92;}return db['Setting'][_0x4197('0x4f')]({'where':{'id':_0x3200ed[_0x4197('0x4d')]['id']},'attributes':['logo',_0x4197('0x56'),_0x4197('0x59'),_0x4197('0x5a'),'defaultLogo','defaultLoginLogo',_0x4197('0x5b'),_0x4197('0x5c')],'raw':!![]});})[_0x4197('0x1a')](handleEntityNotFound(_0x276b05,null))[_0x4197('0x1a')](function(_0x2c3be4){if(_0x2c3be4){var _0x5067f9=_0x2c3be4[_0x4197('0x53')]&&fs[_0x4197('0x5d')](path['join'](config[_0x4197('0x5e')],_0x5d9dc0,_[_0x4197('0x5f')](_0x2c3be4[_0x4197('0x53')])))?path['join'](config['root'],_0x5d9dc0,_['toLower'](_0x2c3be4[_0x4197('0x53')])):path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x5d9dc0,_[_0x4197('0x5f')](_0x4197('0x61')));var _0x31fc00=_0x4197('0x62')+_[_0x4197('0x63')](_0x4197('0x53'));if(_0x2c3be4[_0x31fc00]||!_0x8f4b8e['custom']){_0x5067f9=path['join'](config[_0x4197('0x5e')],_0x5d9dc0,_[_0x4197('0x5f')](_0x4197('0x61')));}if(!fs[_0x4197('0x5d')](_0x5067f9)){throw new db[(_0x4197('0x64'))][(_0x4197('0x65'))](_[_0x4197('0x63')](_0x4197('0x53'))+_0x4197('0x66'));}return _0x276b05[_0x4197('0x67')](_0x5067f9);}})[_0x4197('0x25')](handleError(_0x276b05,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x5cf990,_0x320907,_0x35cecd){var _0x54cc32=_0x4197('0x58');var _0x30a48f={'custom':![]};return utilLicense[_0x4197('0x68')]()['then'](function(_0xad9250){if(_0xad9250){_0x30a48f=_0xad9250;}return db['Setting'][_0x4197('0x4f')]({'where':{'id':_0x5cf990['params']['id']},'attributes':[_0x4197('0x53'),'loginLogo',_0x4197('0x59'),_0x4197('0x5a'),_0x4197('0x69'),_0x4197('0x6a'),_0x4197('0x5b'),_0x4197('0x5c')],'raw':!![]});})[_0x4197('0x1a')](handleEntityNotFound(_0x320907,null))[_0x4197('0x1a')](function(_0x579812){if(_0x579812){var _0x12cef4=_0x579812[_0x4197('0x56')]&&fs[_0x4197('0x5d')](path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x54cc32,_[_0x4197('0x5f')](_0x579812[_0x4197('0x56')])))?path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x54cc32,_[_0x4197('0x5f')](_0x579812[_0x4197('0x56')])):path['join'](config['root'],_0x54cc32,_['toLower'](_0x4197('0x6b')));var _0x520bf9=_0x4197('0x62')+_['upperFirst'](_0x4197('0x56'));if(_0x579812[_0x520bf9]||!_0x30a48f['custom']){_0x12cef4=path[_0x4197('0x60')](config['root'],_0x54cc32,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x4197('0x5d')](_0x12cef4)){throw new db[(_0x4197('0x64'))]['ValidationError'](_[_0x4197('0x63')](_0x4197('0x56'))+_0x4197('0x66'));}return _0x320907[_0x4197('0x67')](_0x12cef4);}})[_0x4197('0x25')](handleError(_0x320907,null));};exports['gdpr']=function(_0x3a05a6,_0x15ad5e){return db[_0x4197('0x36')][_0x4197('0x4f')]({'where':{'id':_0x3a05a6[_0x4197('0x4d')]['id']},'attributes':[_0x4197('0x6c')]})[_0x4197('0x1a')](respondWithResult(_0x15ad5e,null))[_0x4197('0x25')](handleError(_0x15ad5e,null));};exports[_0x4197('0x6d')]=function(_0x3ac0ad,_0x4253b9,_0x2107ee){if(_0x3ac0ad['file']&&_0x3ac0ad[_0x4197('0x52')]['filename']){_0x3ac0ad['body'][_0x4197('0x59')]=_0x3ac0ad['file'][_0x4197('0x54')];}return db[_0x4197('0x36')][_0x4197('0x4f')]({'where':{'id':_0x3ac0ad[_0x4197('0x4d')]['id']}})[_0x4197('0x1a')](handleEntityNotFound(_0x4253b9,null))['then'](saveUpdates(_0x3ac0ad[_0x4197('0x50')],null))[_0x4197('0x1a')](respondWithResult(_0x4253b9,null))[_0x4197('0x25')](handleError(_0x4253b9,null));};var utilLicense=require(_0x4197('0x15'));exports[_0x4197('0x6e')]=function(_0x393f59,_0x207540,_0x2339f1){var _0x48b612=_0x4197('0x58');var _0x16a895={'custom':![]};return utilLicense[_0x4197('0x68')]()[_0x4197('0x1a')](function(_0x2cd1a6){if(_0x2cd1a6){_0x16a895=_0x2cd1a6;}return db['Setting'][_0x4197('0x4f')]({'where':{'id':_0x393f59['params']['id']},'attributes':['logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo',_0x4197('0x5b'),_0x4197('0x5c')],'raw':!![]});})[_0x4197('0x1a')](handleEntityNotFound(_0x207540,null))[_0x4197('0x1a')](function(_0x22003f){if(_0x22003f){var _0x108cda=_0x22003f[_0x4197('0x59')]&&fs[_0x4197('0x5d')](path[_0x4197('0x60')](config['root'],_0x48b612,_['toLower'](_0x22003f['preferred'])))?path[_0x4197('0x60')](config['root'],_0x48b612,_[_0x4197('0x5f')](_0x22003f[_0x4197('0x59')])):path[_0x4197('0x60')](config['root'],_0x48b612,_[_0x4197('0x5f')](_0x4197('0x6f')));var _0x415c51='default'+_[_0x4197('0x63')](_0x4197('0x59'));if(_0x22003f[_0x415c51]||!_0x16a895[_0x4197('0x70')]||!_0x16a895[_0x4197('0x59')]){_0x108cda=path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x48b612,_['toLower']('default_preferred.png'));}if(!fs[_0x4197('0x5d')](_0x108cda)){throw new db['Sequelize'][(_0x4197('0x65'))](_['upperFirst']('preferred')+_0x4197('0x66'));}return _0x207540['download'](_0x108cda);}})[_0x4197('0x25')](handleError(_0x207540,null));};exports[_0x4197('0x71')]=function(_0x1c3851,_0x44e057,_0x41e164){if(_0x1c3851[_0x4197('0x52')]&&_0x1c3851[_0x4197('0x52')][_0x4197('0x54')]){_0x1c3851['body'][_0x4197('0x5a')]=_0x1c3851['file'][_0x4197('0x54')];}return db[_0x4197('0x36')]['find']({'where':{'id':_0x1c3851[_0x4197('0x4d')]['id']}})[_0x4197('0x1a')](handleEntityNotFound(_0x44e057,null))['then'](saveUpdates(_0x1c3851[_0x4197('0x50')],null))['then'](respondWithResult(_0x44e057,null))[_0x4197('0x25')](handleError(_0x44e057,null));};var utilLicense=require(_0x4197('0x15'));exports[_0x4197('0x72')]=function(_0xd6c75,_0x216197,_0x446b9c){var _0x11df58=_0x4197('0x58');var _0x146409={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2cd213){if(_0x2cd213){_0x146409=_0x2cd213;}return db['Setting'][_0x4197('0x4f')]({'where':{'id':_0xd6c75[_0x4197('0x4d')]['id']},'attributes':[_0x4197('0x53'),'loginLogo','preferred',_0x4197('0x5a'),_0x4197('0x69'),_0x4197('0x6a'),_0x4197('0x5b'),_0x4197('0x5c')],'raw':!![]});})[_0x4197('0x1a')](handleEntityNotFound(_0x216197,null))[_0x4197('0x1a')](function(_0x3a379f){if(_0x3a379f){var _0x135355=_0x3a379f['favicon']&&fs[_0x4197('0x5d')](path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x11df58,_['toLower'](_0x3a379f[_0x4197('0x5a')])))?path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x11df58,_[_0x4197('0x5f')](_0x3a379f[_0x4197('0x5a')])):path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x11df58,_['toLower'](_0x4197('0x73')));var _0xd977bb='default'+_['upperFirst'](_0x4197('0x5a'));if(_0x3a379f[_0xd977bb]||!_0x146409['custom']){_0x135355=path[_0x4197('0x60')](config[_0x4197('0x5e')],_0x11df58,_[_0x4197('0x5f')]('default_favicon.ico'));}if(!fs[_0x4197('0x5d')](_0x135355)){throw new db[(_0x4197('0x64'))][(_0x4197('0x65'))](_[_0x4197('0x63')](_0x4197('0x5a'))+_0x4197('0x66'));}return _0x216197[_0x4197('0x67')](_0x135355);}})[_0x4197('0x25')](handleError(_0x216197,null));};exports[_0x4197('0x74')]=function(_0xe39511,_0x33198d){var _0x582abd={'offset':moment()[_0x4197('0x75')]()};_0x582abd['now']=moment()['utcOffset'](_0x582abd[_0x4197('0x28')])[_0x4197('0x76')](_0x4197('0x77'));return _0x33198d[_0x4197('0x26')](0xc8)['send'](_0x582abd);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 42c697b..736060d 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x1f6691,_0x3a3d46){var _0xf786b6=function(_0x2afbdb){while(--_0x2afbdb){_0x1f6691['push'](_0x1f6691['shift']());}};_0xf786b6(++_0x3a3d46);}(_0x3e74,0x175));var _0x43e7=function(_0xfd2cc,_0x6b18d5){_0xfd2cc=_0xfd2cc-0x0;var _0x112093=_0x3e74[_0xfd2cc];return _0x112093;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x34a32e,_0x26f089){var _0x24ca9b=function(_0x47c1c5){while(--_0x47c1c5){_0x34a32e['push'](_0x34a32e['shift']());}};_0x24ca9b(++_0x26f089);}(_0x008c,0x188));var _0xc008=function(_0x2fbb45,_0x1b2c7f){_0x2fbb45=_0x2fbb45-0x0;var _0x526325=_0x008c[_0x2fbb45];return _0x526325;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 5f8e716..aeaca96 100644 --- a/server/api/setting/setting.rpc.js +++ b/server/api/setting/setting.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbed2=['catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','stringify'];(function(_0x3369f7,_0x53b60f){var _0x2a3c8b=function(_0x7e367a){while(--_0x7e367a){_0x3369f7['push'](_0x3369f7['shift']());}};_0x2a3c8b(++_0x53b60f);}(_0xbed2,0x1e1));var _0x2bed=function(_0x49a84b,_0x17c1be){_0x49a84b=_0x49a84b-0x0;var _0x171650=_0xbed2[_0x49a84b];return _0x171650;};'use strict';var _=require(_0x2bed('0x0'));var util=require('util');var moment=require(_0x2bed('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bed('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bed('0x3'));var logger=require(_0x2bed('0x4'))(_0x2bed('0x5'));var config=require(_0x2bed('0x6'));var jayson=require(_0x2bed('0x7'));var client=jayson[_0x2bed('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d160a,_0x4d94a6,_0x21d5cf){return new BPromise(function(_0x1dbcbc,_0x3c3d60){return client[_0x2bed('0x9')](_0x3d160a,_0x21d5cf)[_0x2bed('0xa')](function(_0x47ddee){logger[_0x2bed('0xb')](_0x2bed('0xc'),_0x4d94a6,_0x2bed('0xd'));logger[_0x2bed('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x4d94a6,'request\x20sent',JSON['stringify'](_0x47ddee));if(_0x47ddee[_0x2bed('0xf')]){if(_0x47ddee[_0x2bed('0xf')][_0x2bed('0x10')]===0x1f4){logger[_0x2bed('0xf')](_0x2bed('0xc'),_0x4d94a6,_0x47ddee['error'][_0x2bed('0x11')]);return _0x3c3d60(_0x47ddee[_0x2bed('0xf')][_0x2bed('0x11')]);}logger[_0x2bed('0xf')]('Setting,\x20%s,\x20%s',_0x4d94a6,_0x47ddee[_0x2bed('0xf')][_0x2bed('0x11')]);return _0x1dbcbc(_0x47ddee[_0x2bed('0xf')][_0x2bed('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x4d94a6,'request\x20sent');_0x1dbcbc(_0x47ddee['result'][_0x2bed('0x11')]);}})['catch'](function(_0x1a6fbc){logger[_0x2bed('0xf')](_0x2bed('0xc'),_0x4d94a6,_0x1a6fbc);_0x3c3d60(_0x1a6fbc);});});}exports[_0x2bed('0x12')]=function(_0x425082){var _0x297f58=this;return new Promise(function(_0x4f4472,_0x5f4b54){return db[_0x2bed('0x13')][_0x2bed('0x14')]({'raw':_0x425082[_0x2bed('0x15')]?_0x425082['options'][_0x2bed('0x16')]===undefined?!![]:![]:!![],'where':_0x425082['options']?_0x425082[_0x2bed('0x15')][_0x2bed('0x17')]||null:null,'attributes':_0x425082[_0x2bed('0x15')]?_0x425082[_0x2bed('0x15')][_0x2bed('0x18')]||null:null,'include':_0x425082[_0x2bed('0x15')]?_0x425082[_0x2bed('0x15')][_0x2bed('0x19')]?_[_0x2bed('0x1a')](_0x425082[_0x2bed('0x15')][_0x2bed('0x19')],function(_0x160b67){return{'model':db[_0x160b67['model']],'as':_0x160b67['as'],'attributes':_0x160b67['attributes'],'include':_0x160b67[_0x2bed('0x19')]?_['map'](_0x160b67['include'],function(_0x571aba){return{'model':db[_0x571aba[_0x2bed('0x1b')]],'as':_0x571aba['as'],'attributes':_0x571aba[_0x2bed('0x18')],'include':_0x571aba['include']?_['map'](_0x571aba[_0x2bed('0x19')],function(_0x1481a7){return{'model':db[_0x1481a7[_0x2bed('0x1b')]],'as':_0x1481a7['as'],'attributes':_0x1481a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x2bed('0xa')](function(_0x507dc3){logger[_0x2bed('0xb')](_0x2bed('0x12'),_0x425082);logger[_0x2bed('0xe')]('ShowSetting',_0x425082,JSON[_0x2bed('0x1c')](_0x507dc3));_0x4f4472(_0x507dc3);})[_0x2bed('0x1d')](function(_0x367a77){logger[_0x2bed('0xf')](_0x2bed('0x12'),_0x367a77[_0x2bed('0x11')],_0x425082);_0x5f4b54(_0x297f58[_0x2bed('0xf')](0x1f4,_0x367a77[_0x2bed('0x11')]));});});}; \ No newline at end of file +var _0xe9aa=['request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','raw','options','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x12e08c,_0x55b271){var _0x110966=function(_0x46ae1b){while(--_0x46ae1b){_0x12e08c['push'](_0x12e08c['shift']());}};_0x110966(++_0x55b271);}(_0xe9aa,0xdc));var _0xae9a=function(_0x4045a2,_0x1b28c2){_0x4045a2=_0x4045a2-0x0;var _0x2cc543=_0xe9aa[_0x4045a2];return _0x2cc543;};'use strict';var _=require(_0xae9a('0x0'));var util=require(_0xae9a('0x1'));var moment=require(_0xae9a('0x2'));var BPromise=require(_0xae9a('0x3'));var rs=require(_0xae9a('0x4'));var fs=require('fs');var Redis=require(_0xae9a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae9a('0x6'));var logger=require(_0xae9a('0x7'))('rpc');var config=require(_0xae9a('0x8'));var jayson=require(_0xae9a('0x9'));var client=jayson[_0xae9a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ad907,_0x3ac465,_0x198c23){return new BPromise(function(_0x3762e1,_0x504901){return client[_0xae9a('0xb')](_0x2ad907,_0x198c23)[_0xae9a('0xc')](function(_0x32ba6a){logger[_0xae9a('0xd')](_0xae9a('0xe'),_0x3ac465,_0xae9a('0xf'));logger[_0xae9a('0x10')](_0xae9a('0x11'),_0x3ac465,_0xae9a('0xf'),JSON[_0xae9a('0x12')](_0x32ba6a));if(_0x32ba6a[_0xae9a('0x13')]){if(_0x32ba6a[_0xae9a('0x13')][_0xae9a('0x14')]===0x1f4){logger[_0xae9a('0x13')](_0xae9a('0xe'),_0x3ac465,_0x32ba6a[_0xae9a('0x13')][_0xae9a('0x15')]);return _0x504901(_0x32ba6a[_0xae9a('0x13')]['message']);}logger['error']('Setting,\x20%s,\x20%s',_0x3ac465,_0x32ba6a[_0xae9a('0x13')][_0xae9a('0x15')]);return _0x3762e1(_0x32ba6a[_0xae9a('0x13')][_0xae9a('0x15')]);}else{logger[_0xae9a('0xd')](_0xae9a('0xe'),_0x3ac465,_0xae9a('0xf'));_0x3762e1(_0x32ba6a[_0xae9a('0x16')][_0xae9a('0x15')]);}})[_0xae9a('0x17')](function(_0x1cdad5){logger['error'](_0xae9a('0xe'),_0x3ac465,_0x1cdad5);_0x504901(_0x1cdad5);});});}exports[_0xae9a('0x18')]=function(_0x5b6332){var _0xa6ccdc=this;return new Promise(function(_0xb4d110,_0x9498f6){return db[_0xae9a('0x19')][_0xae9a('0x1a')]({'raw':_0x5b6332['options']?_0x5b6332['options'][_0xae9a('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b6332[_0xae9a('0x1c')]?_0x5b6332['options']['where']||null:null,'attributes':_0x5b6332[_0xae9a('0x1c')]?_0x5b6332[_0xae9a('0x1c')][_0xae9a('0x1d')]||null:null,'include':_0x5b6332[_0xae9a('0x1c')]?_0x5b6332[_0xae9a('0x1c')][_0xae9a('0x1e')]?_['map'](_0x5b6332[_0xae9a('0x1c')][_0xae9a('0x1e')],function(_0x41b26b){return{'model':db[_0x41b26b[_0xae9a('0x1f')]],'as':_0x41b26b['as'],'attributes':_0x41b26b[_0xae9a('0x1d')],'include':_0x41b26b[_0xae9a('0x1e')]?_[_0xae9a('0x20')](_0x41b26b[_0xae9a('0x1e')],function(_0x3d3874){return{'model':db[_0x3d3874[_0xae9a('0x1f')]],'as':_0x3d3874['as'],'attributes':_0x3d3874[_0xae9a('0x1d')],'include':_0x3d3874[_0xae9a('0x1e')]?_[_0xae9a('0x20')](_0x3d3874['include'],function(_0x25b9ab){return{'model':db[_0x25b9ab[_0xae9a('0x1f')]],'as':_0x25b9ab['as'],'attributes':_0x25b9ab[_0xae9a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xae9a('0xc')](function(_0x10e5ad){logger[_0xae9a('0xd')](_0xae9a('0x18'),_0x5b6332);logger[_0xae9a('0x10')](_0xae9a('0x18'),_0x5b6332,JSON[_0xae9a('0x12')](_0x10e5ad));_0xb4d110(_0x10e5ad);})['catch'](function(_0x57bd08){logger[_0xae9a('0x13')](_0xae9a('0x18'),_0x57bd08[_0xae9a('0x15')],_0x5b6332);_0x9498f6(_0xa6ccdc[_0xae9a('0x13')](0x1f4,_0x57bd08[_0xae9a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 1f74aaa..d2ce842 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x2e7e29,_0x4febc9){var _0x1c4c87=function(_0x2b5f5b){while(--_0x2b5f5b){_0x2e7e29['push'](_0x2e7e29['shift']());}};_0x1c4c87(++_0x4febc9);}(_0xabce,0x103));var _0xeabc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xabce[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x3a096c,_0x1f9d72){var _0x44a6a4=function(_0x5d482c){while(--_0x5d482c){_0x3a096c['push'](_0x3a096c['shift']());}};_0x44a6a4(++_0x1f9d72);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 42ed6bd..7bc1155 100644 --- a/server/api/smsAccount/smsAccount.attributes.js +++ b/server/api/smsAccount/smsAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe930=['clicksend','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','STRING','name','generate','ENUM','connectel'];(function(_0x211206,_0x49e42c){var _0x1165d6=function(_0x579e05){while(--_0x579e05){_0x211206['push'](_0x211206['shift']());}};_0x1165d6(++_0x49e42c);}(_0xe930,0x14e));var _0x0e93=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xe930[_0x3a6e4b];return _0x36572d;};'use strict';var Sequelize=require(_0x0e93('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x0e93('0x1')],'unique':_0x0e93('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0e93('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x0e93('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0e93('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0e93('0x4')]('twilio','skebby',_0x0e93('0x5'),_0x0e93('0x6'),'plivo',_0x0e93('0x7'),_0x0e93('0x8'),_0x0e93('0x9'),'infobip',_0x0e93('0xa'))},'accountSid':{'type':Sequelize[_0x0e93('0x1')]},'authId':{'type':Sequelize[_0x0e93('0x1')]},'authToken':{'type':Sequelize[_0x0e93('0x1')]},'smsMethod':{'type':Sequelize[_0x0e93('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0e93('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0e93('0x1')]},'applicationId':{'type':Sequelize[_0x0e93('0x1')]},'accountId':{'type':Sequelize[_0x0e93('0x1')]},'senderString':{'type':Sequelize[_0x0e93('0x1')]},'deliveryReport':{'type':Sequelize[_0x0e93('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0e93('0xc')],'defaultValue':function(){return _0x0e93('0xd');}},'notificationSound':{'type':Sequelize[_0x0e93('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0e93('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0e93('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0e93('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0e93('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0e93('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0e93('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0e93('0xe')],'comment':_0x0e93('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x543964){if(!_0x543964)this[_0x0e93('0x10')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x543964);}}}; \ No newline at end of file +var _0xa37b=['csc','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','twilio','skebby','connectel','bandwidth'];(function(_0x773236,_0x53f1e5){var _0x5714ef=function(_0x2136dc){while(--_0x2136dc){_0x773236['push'](_0x773236['shift']());}};_0x5714ef(++_0x53f1e5);}(_0xa37b,0x102));var _0xba37=function(_0x4995b5,_0x45b4eb){_0x4995b5=_0x4995b5-0x0;var _0x22050d=_0xa37b[_0x4995b5];return _0x22050d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xba37('0x0'));module[_0xba37('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xba37('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xba37('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xba37('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xba37('0x3')]},'type':{'type':Sequelize['ENUM'](_0xba37('0x4'),_0xba37('0x5'),_0xba37('0x6'),'clicksend','plivo','clickatell',_0xba37('0x7'),_0xba37('0x8'),'infobip',_0xba37('0x9'))},'accountSid':{'type':Sequelize[_0xba37('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xba37('0x3')]},'smsMethod':{'type':Sequelize[_0xba37('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0xba37('0x3')]},'password':{'type':Sequelize[_0xba37('0x3')]},'apiKey':{'type':Sequelize[_0xba37('0x3')]},'applicationId':{'type':Sequelize[_0xba37('0x3')]},'accountId':{'type':Sequelize[_0xba37('0x3')]},'senderString':{'type':Sequelize[_0xba37('0x3')]},'deliveryReport':{'type':Sequelize[_0xba37('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xba37('0x3')]},'notificationTemplate':{'type':Sequelize[_0xba37('0xc')],'defaultValue':function(){return _0xba37('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba37('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba37('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xba37('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba37('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xba37('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba37('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xba37('0xb')],'defaultValue':![],'comment':_0xba37('0xf'),'set':function(_0x4644da){if(!_0x4644da)this[_0xba37('0x10')](_0xba37('0x11'),null);this[_0xba37('0x10')](_0xba37('0x12'),_0x4644da);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6cf812b..2e1d836 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x084a=['rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','merge','options','include','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','hasOwnProperty','where','includeAll','removeDispositions','ids','getAnswers','findOne','CannedAnswer','nolimit','findAll','rows','removeAnswers','notify','sms','Applications','priority','account','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','sender','text','clicksend','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','get','created','autoclose','applications','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','\x0a','addApplications','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','redif','skebby','error_code','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','SmsAccounts','stack','name','send','mandatoryDispositionPause','SmsAccount'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x084a,0x185));var _0xa084=function(_0x97a72b,_0x5d95b4){_0x97a72b=_0x97a72b-0x0;var _0x4a0e6f=_0x084a[_0x97a72b];return _0x4a0e6f;};'use strict';var emlformat=require(_0xa084('0x0'));var rimraf=require(_0xa084('0x1'));var zipdir=require(_0xa084('0x2'));var jsonpatch=require(_0xa084('0x3'));var rp=require('request-promise');var moment=require(_0xa084('0x4'));var BPromise=require(_0xa084('0x5'));var Mustache=require(_0xa084('0x6'));var util=require(_0xa084('0x7'));var path=require('path');var sox=require(_0xa084('0x8'));var csv=require(_0xa084('0x9'));var ejs=require(_0xa084('0xa'));var fs=require('fs');var fs_extra=require(_0xa084('0xb'));var _=require(_0xa084('0xc'));var squel=require(_0xa084('0xd'));var crypto=require(_0xa084('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa084('0x9'));var querystring=require(_0xa084('0xf'));var Papa=require(_0xa084('0x10'));var Redis=require('ioredis');var authService=require(_0xa084('0x11'));var qs=require(_0xa084('0x12'));var as=require(_0xa084('0x13'));var hardwareService=require(_0xa084('0x14'));var logger=require(_0xa084('0x15'))('api');var utils=require(_0xa084('0x16'));var config=require(_0xa084('0x17'));var licenseUtil=require(_0xa084('0x18'));var db=require(_0xa084('0x19'))['db'];config[_0xa084('0x1a')]=_[_0xa084('0x1b')](config['redis'],{'host':_0xa084('0x1c'),'port':0x18eb});var socket=require(_0xa084('0x1d'))(new Redis(config[_0xa084('0x1a')]));require(_0xa084('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xa084('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x131e13,_0x5723f7,_0x16e398,_0x5d94c3){return new BPromise(function(_0x573a3c,_0x1f3048){var _0x235886=_0x5d94c3||client;return _0x235886['request'](_0x131e13,_0x16e398)[_0xa084('0x20')](function(_0x12d842){logger[_0xa084('0x21')](_0xa084('0x22'),_0x5723f7,_0xa084('0x23'));logger[_0xa084('0x24')](_0xa084('0x25'),_0x5723f7,'request\x20sent',JSON[_0xa084('0x26')](_0x12d842));if(_0x12d842[_0xa084('0x27')]){if(_0x12d842[_0xa084('0x27')][_0xa084('0x28')]===0x1f4){logger[_0xa084('0x27')](_0xa084('0x22'),_0x5723f7,_0x12d842[_0xa084('0x27')]['message']);return _0x1f3048(_0x12d842[_0xa084('0x27')][_0xa084('0x29')]);}logger[_0xa084('0x27')]('SmsAccount,\x20%s,\x20%s',_0x5723f7,_0x12d842[_0xa084('0x27')][_0xa084('0x29')]);return _0x573a3c(_0x12d842[_0xa084('0x27')][_0xa084('0x29')]);}else{logger[_0xa084('0x21')](_0xa084('0x22'),_0x5723f7,'request\x20sent');_0x573a3c(_0x12d842[_0xa084('0x2a')][_0xa084('0x29')]);}})[_0xa084('0x2b')](function(_0x4f4c66){logger[_0xa084('0x27')](_0xa084('0x22'),_0x5723f7,_0x4f4c66);_0x1f3048(_0x4f4c66);});});}function respondWithStatusCode(_0x23d758,_0x31fa37){_0x31fa37=_0x31fa37||0xcc;return function(_0x5cce94){if(_0x5cce94){return _0x23d758[_0xa084('0x2c')](_0x31fa37);}return _0x23d758[_0xa084('0x2d')](_0x31fa37)[_0xa084('0x2e')]();};}function respondWithResult(_0x5ae9f4,_0xe853df){_0xe853df=_0xe853df||0xc8;return function(_0x4b81f6){if(_0x4b81f6){return _0x5ae9f4['status'](_0xe853df)[_0xa084('0x2f')](_0x4b81f6);}};}function respondWithFilteredResult(_0x166c6a,_0x3d958d){return function(_0x3172f7){if(_0x3172f7){var _0x418ea0=typeof _0x3d958d[_0xa084('0x30')]===_0xa084('0x31')&&typeof _0x3d958d[_0xa084('0x32')]===_0xa084('0x31');var _0x1cf830=_0x3172f7['count'];var _0x5d1534=_0x418ea0?0x0:_0x3d958d[_0xa084('0x30')];var _0x47e885=_0x418ea0?_0x3172f7[_0xa084('0x33')]:_0x3d958d[_0xa084('0x30')]+_0x3d958d[_0xa084('0x32')];var _0x305c8c;if(_0x47e885>=_0x1cf830){_0x47e885=_0x1cf830;_0x305c8c=0xc8;}else{_0x305c8c=0xce;}_0x166c6a[_0xa084('0x2d')](_0x305c8c);return _0x166c6a['set'](_0xa084('0x34'),_0x5d1534+'-'+_0x47e885+'/'+_0x1cf830)['json'](_0x3172f7);}return null;};}function patchUpdates(_0x2224fc){return function(_0x300678){try{jsonpatch['apply'](_0x300678,_0x2224fc,!![]);}catch(_0x5383bd){return BPromise[_0xa084('0x35')](_0x5383bd);}return _0x300678[_0xa084('0x36')]();};}function saveUpdates(_0x10b12a,_0x36d406){return function(_0x311dd5){if(_0x311dd5){return _0x311dd5[_0xa084('0x37')](_0x10b12a)[_0xa084('0x20')](function(_0x55272b){return _0x55272b;});}return null;};}function removeEntity(_0x4a9641,_0xd183e){return function(_0x3bf135){if(_0x3bf135){return _0x3bf135[_0xa084('0x38')]()[_0xa084('0x20')](function(){var _0x13edf4=_0x3bf135['get']({'plain':!![]});var _0x306ec5=_0xa084('0x39');return db['UserProfileResource'][_0xa084('0x38')]({'where':{'type':_0x306ec5,'resourceId':_0x13edf4['id']}})[_0xa084('0x20')](function(){return _0x3bf135;});})['then'](function(){_0x4a9641[_0xa084('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d34d3,_0x2d3dea){return function(_0x3e6ee8){if(!_0x3e6ee8){_0x3d34d3[_0xa084('0x2c')](0x194);}return _0x3e6ee8;};}function handleError(_0x46de7f,_0x347181){_0x347181=_0x347181||0x1f4;return function(_0x23373c){logger[_0xa084('0x27')](_0x23373c[_0xa084('0x3a')]);if(_0x23373c[_0xa084('0x3b')]){delete _0x23373c[_0xa084('0x3b')];}_0x46de7f[_0xa084('0x2d')](_0x347181)[_0xa084('0x3c')](_0x23373c);};}exports['index']=function(_0x2f2a1a,_0x48b1d2){var _0x3eb4a4={'include':[{'model':db['Pause'],'as':_0xa084('0x3d')}]},_0x5464f9={},_0xdb0cab={'count':0x0,'rows':[]};var _0x44893f=_['map'](db[_0xa084('0x3e')][_0xa084('0x3f')],function(_0x483085){return{'name':_0x483085[_0xa084('0x40')],'type':_0x483085[_0xa084('0x41')][_0xa084('0x42')]};});_0x5464f9[_0xa084('0x43')]=_[_0xa084('0x44')](_0x44893f,_0xa084('0x3b'));_0x5464f9['query']=_[_0xa084('0x45')](_0x2f2a1a[_0xa084('0x46')]);_0x5464f9[_0xa084('0x47')]=_[_0xa084('0x48')](_0x5464f9['model'],_0x5464f9[_0xa084('0x46')]);_0x3eb4a4[_0xa084('0x49')]=_[_0xa084('0x48')](_0x5464f9[_0xa084('0x43')],qs[_0xa084('0x4a')](_0x2f2a1a[_0xa084('0x46')][_0xa084('0x4a')]));_0x3eb4a4[_0xa084('0x49')]=_0x3eb4a4[_0xa084('0x49')][_0xa084('0x4b')]?_0x3eb4a4[_0xa084('0x49')]:_0x5464f9['model'];if(!_0x2f2a1a[_0xa084('0x46')]['hasOwnProperty']('nolimit')){_0x3eb4a4[_0xa084('0x32')]=qs['limit'](_0x2f2a1a[_0xa084('0x46')][_0xa084('0x32')]);_0x3eb4a4[_0xa084('0x30')]=qs[_0xa084('0x30')](_0x2f2a1a[_0xa084('0x46')]['offset']);}_0x3eb4a4[_0xa084('0x4c')]=qs[_0xa084('0x4d')](_0x2f2a1a['query'][_0xa084('0x4d')]);_0x3eb4a4['where']=qs[_0xa084('0x47')](_[_0xa084('0x4e')](_0x2f2a1a[_0xa084('0x46')],_0x5464f9[_0xa084('0x47')]),_0x44893f);if(_0x2f2a1a[_0xa084('0x46')][_0xa084('0x4f')]){_0x3eb4a4['where']=_[_0xa084('0x50')](_0x3eb4a4['where'],{'$or':_[_0xa084('0x44')](_0x44893f,function(_0x54026d){if(_0x54026d[_0xa084('0x41')]!=='VIRTUAL'){var _0x1dab77={};_0x1dab77[_0x54026d[_0xa084('0x3b')]]={'$like':'%'+_0x2f2a1a[_0xa084('0x46')]['filter']+'%'};return _0x1dab77;}})});}_0x3eb4a4=_[_0xa084('0x50')]({},_0x3eb4a4,_0x2f2a1a[_0xa084('0x51')]);var _0x164947={'where':_0x3eb4a4['where']};return db[_0xa084('0x3e')][_0xa084('0x33')](_0x164947)[_0xa084('0x20')](function(_0x18e92f){_0xdb0cab[_0xa084('0x33')]=_0x18e92f;if(_0x2f2a1a['query']['includeAll']){_0x3eb4a4[_0xa084('0x52')]=[{'all':!![]}];}return db[_0xa084('0x3e')]['findAll'](_0x3eb4a4);})['then'](function(_0x3a4f1b){_0xdb0cab['rows']=_0x3a4f1b;return _0xdb0cab;})['then'](respondWithFilteredResult(_0x48b1d2,_0x3eb4a4))['catch'](handleError(_0x48b1d2,null));};exports['show']=function(_0x340a1b,_0x5d477d){var _0x2949e8={'raw':![],'where':{'id':_0x340a1b[_0xa084('0x53')]['id']},'include':[{'model':db[_0xa084('0x54')],'as':_0xa084('0x3d')}]},_0x12f857={};_0x12f857['model']=_[_0xa084('0x45')](db[_0xa084('0x3e')][_0xa084('0x3f')]);_0x12f857[_0xa084('0x46')]=_['keys'](_0x340a1b[_0xa084('0x46')]);_0x12f857['filters']=_['intersection'](_0x12f857['model'],_0x12f857[_0xa084('0x46')]);_0x2949e8[_0xa084('0x49')]=_[_0xa084('0x48')](_0x12f857['model'],qs['fields'](_0x340a1b[_0xa084('0x46')][_0xa084('0x4a')]));_0x2949e8['attributes']=_0x2949e8[_0xa084('0x49')]['length']?_0x2949e8[_0xa084('0x49')]:_0x12f857[_0xa084('0x43')];if(_0x340a1b[_0xa084('0x46')]['includeAll']){_0x2949e8[_0xa084('0x52')]=[{'all':!![]}];}_0x2949e8=_[_0xa084('0x50')]({},_0x2949e8,_0x340a1b['options']);return db[_0xa084('0x3e')][_0xa084('0x55')](_0x2949e8)[_0xa084('0x20')](handleEntityNotFound(_0x5d477d,null))[_0xa084('0x20')](respondWithResult(_0x5d477d,null))[_0xa084('0x2b')](handleError(_0x5d477d,null));};exports['create']=function(_0x28e7c2,_0x382ec9){return db['SmsAccount'][_0xa084('0x56')](_0x28e7c2[_0xa084('0x57')],{})[_0xa084('0x20')](function(_0x2e01ff){var _0x3ce4a8=_0x28e7c2[_0xa084('0x58')]['get']({'plain':!![]});if(!_0x3ce4a8)throw new Error(_0xa084('0x59'));if(_0x3ce4a8['role']===_0xa084('0x58')){var _0x281012=_0x2e01ff['get']({'plain':!![]});var _0x88a5a9='SmsAccounts';return db['UserProfileSection'][_0xa084('0x55')]({'where':{'name':_0x88a5a9,'userProfileId':_0x3ce4a8['userProfileId']},'raw':!![]})[_0xa084('0x20')](function(_0x403a9a){if(_0x403a9a&&_0x403a9a[_0xa084('0x5a')]===0x0){return db[_0xa084('0x5b')][_0xa084('0x56')]({'name':_0x281012[_0xa084('0x3b')],'resourceId':_0x281012['id'],'type':_0x403a9a['name'],'sectionId':_0x403a9a['id']},{})[_0xa084('0x20')](function(){return _0x2e01ff;});}else{return _0x2e01ff;}})['catch'](function(_0x10d66f){logger[_0xa084('0x27')](_0xa084('0x5c'),_0x10d66f);throw _0x10d66f;});}return _0x2e01ff;})[_0xa084('0x20')](respondWithResult(_0x382ec9,0xc9))[_0xa084('0x2b')](handleError(_0x382ec9,null));};exports[_0xa084('0x37')]=function(_0x2c685b,_0xda444a){if(_0x2c685b[_0xa084('0x57')]['id']){delete _0x2c685b[_0xa084('0x57')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x2c685b[_0xa084('0x53')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xda444a,null))[_0xa084('0x20')](saveUpdates(_0x2c685b['body'],null))[_0xa084('0x20')](respondWithResult(_0xda444a,null))[_0xa084('0x2b')](handleError(_0xda444a,null));};exports['destroy']=function(_0x2f9edb,_0x54137d){return db[_0xa084('0x3e')][_0xa084('0x55')]({'where':{'id':_0x2f9edb[_0xa084('0x53')]['id']}})['then'](handleEntityNotFound(_0x54137d,null))[_0xa084('0x20')](removeEntity(_0x54137d,null))[_0xa084('0x2b')](handleError(_0x54137d,null));};exports[_0xa084('0x5d')]=function(_0x1177ea,_0x543a22){return db[_0xa084('0x3e')]['describe']()[_0xa084('0x20')](respondWithResult(_0x543a22,null))[_0xa084('0x2b')](handleError(_0x543a22,null));};exports[_0xa084('0x5e')]=function(_0x12f17b,_0x19ef32,_0x13aba1){if(_0x12f17b['body']['id']){delete _0x12f17b[_0xa084('0x57')]['id'];}return db[_0xa084('0x3e')][_0xa084('0x55')]({'where':{'id':_0x12f17b['params']['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x19ef32,null))['then'](function(_0x1d4164){if(_0x1d4164){_0x12f17b[_0xa084('0x57')][_0xa084('0x5f')]=_0x1d4164['id'];return db[_0xa084('0x60')][_0xa084('0x56')](_0x12f17b[_0xa084('0x57')]);}})['then'](respondWithResult(_0x19ef32,null))[_0xa084('0x2b')](handleError(_0x19ef32,null));};exports[_0xa084('0x61')]=function(_0x233ae2,_0x34f4ca,_0x17411e){var _0xc275d={'raw':![],'where':{}};var _0x498917={};var _0x4b0c87={'count':0x0,'rows':[]};return db[_0xa084('0x3e')]['findOne']({'where':{'id':_0x233ae2[_0xa084('0x53')]['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x34f4ca,null))[_0xa084('0x20')](function(_0xa5fadd){if(_0xa5fadd){_0x498917['model']=_[_0xa084('0x45')](db[_0xa084('0x60')]['rawAttributes']);_0x498917['query']=_['keys'](_0x233ae2[_0xa084('0x46')]);_0x498917[_0xa084('0x47')]=_[_0xa084('0x48')](_0x498917[_0xa084('0x43')],_0x498917[_0xa084('0x46')]);_0xc275d[_0xa084('0x49')]=_[_0xa084('0x48')](_0x498917['model'],qs['fields'](_0x233ae2[_0xa084('0x46')]['fields']));_0xc275d[_0xa084('0x49')]=_0xc275d['attributes']['length']?_0xc275d[_0xa084('0x49')]:_0x498917[_0xa084('0x43')];if(!_0x233ae2[_0xa084('0x46')][_0xa084('0x62')]('nolimit')){_0xc275d['limit']=qs[_0xa084('0x32')](_0x233ae2[_0xa084('0x46')][_0xa084('0x32')]);_0xc275d[_0xa084('0x30')]=qs[_0xa084('0x30')](_0x233ae2[_0xa084('0x46')][_0xa084('0x30')]);}_0xc275d[_0xa084('0x4c')]=qs['sort'](_0x233ae2['query'][_0xa084('0x4d')]);_0xc275d[_0xa084('0x63')]=qs[_0xa084('0x47')](_[_0xa084('0x4e')](_0x233ae2['query'],_0x498917[_0xa084('0x47')]));_0xc275d[_0xa084('0x63')][_0xa084('0x5f')]=_0xa5fadd['id'];if(_0x233ae2[_0xa084('0x46')][_0xa084('0x4f')]){_0xc275d[_0xa084('0x63')]=_[_0xa084('0x50')](_0xc275d[_0xa084('0x63')],{'$or':_['map'](_0xc275d[_0xa084('0x49')],function(_0x181120){var _0x28f5ce={};_0x28f5ce[_0x181120]={'$like':'%'+_0x233ae2['query'][_0xa084('0x4f')]+'%'};return _0x28f5ce;})});}_0xc275d=_[_0xa084('0x50')]({},_0xc275d,_0x233ae2['options']);return db[_0xa084('0x60')][_0xa084('0x33')]({'where':_0xc275d[_0xa084('0x63')]})[_0xa084('0x20')](function(_0x3819f1){_0x4b0c87[_0xa084('0x33')]=_0x3819f1;if(_0x233ae2[_0xa084('0x46')][_0xa084('0x64')]){_0xc275d[_0xa084('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xc275d);})[_0xa084('0x20')](function(_0x3eec9){_0x4b0c87['rows']=_0x3eec9;return _0x4b0c87;});}})[_0xa084('0x20')](respondWithFilteredResult(_0x34f4ca,_0xc275d))[_0xa084('0x2b')](handleError(_0x34f4ca,null));};exports[_0xa084('0x65')]=function(_0x54ffc9,_0x21aec3,_0x4972f9){return db[_0xa084('0x3e')]['find']({'where':{'id':_0x54ffc9[_0xa084('0x53')]['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x21aec3,null))[_0xa084('0x20')](function(_0x2cea6d){if(_0x2cea6d){return _0x2cea6d['removeDispositions'](_0x54ffc9['query'][_0xa084('0x66')]);}})['then'](respondWithStatusCode(_0x21aec3,null))[_0xa084('0x2b')](handleError(_0x21aec3,null));};exports['addAnswer']=function(_0x2b4cc5,_0x3246f9,_0x5aa845){if(_0x2b4cc5[_0xa084('0x57')]['id']){delete _0x2b4cc5['body']['id'];}return db[_0xa084('0x3e')][_0xa084('0x55')]({'where':{'id':_0x2b4cc5[_0xa084('0x53')]['id']}})['then'](handleEntityNotFound(_0x3246f9,null))[_0xa084('0x20')](function(_0xd7f325){if(_0xd7f325){_0x2b4cc5[_0xa084('0x57')]['SmsAccountId']=_0xd7f325['id'];return db['CannedAnswer'][_0xa084('0x56')](_0x2b4cc5[_0xa084('0x57')]);}})[_0xa084('0x20')](respondWithResult(_0x3246f9,null))['catch'](handleError(_0x3246f9,null));};exports[_0xa084('0x67')]=function(_0xdb6821,_0x3ae26e,_0x280f88){var _0xc2e3ce={'raw':![],'where':{}};var _0x5caf3f={};var _0x5c18f5={'count':0x0,'rows':[]};return db[_0xa084('0x3e')][_0xa084('0x68')]({'where':{'id':_0xdb6821['params']['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x3ae26e,null))[_0xa084('0x20')](function(_0x389082){if(_0x389082){_0x5caf3f[_0xa084('0x43')]=_[_0xa084('0x45')](db[_0xa084('0x69')][_0xa084('0x3f')]);_0x5caf3f[_0xa084('0x46')]=_[_0xa084('0x45')](_0xdb6821[_0xa084('0x46')]);_0x5caf3f[_0xa084('0x47')]=_[_0xa084('0x48')](_0x5caf3f['model'],_0x5caf3f['query']);_0xc2e3ce['attributes']=_['intersection'](_0x5caf3f[_0xa084('0x43')],qs[_0xa084('0x4a')](_0xdb6821[_0xa084('0x46')]['fields']));_0xc2e3ce[_0xa084('0x49')]=_0xc2e3ce[_0xa084('0x49')][_0xa084('0x4b')]?_0xc2e3ce[_0xa084('0x49')]:_0x5caf3f[_0xa084('0x43')];if(!_0xdb6821[_0xa084('0x46')][_0xa084('0x62')](_0xa084('0x6a'))){_0xc2e3ce['limit']=qs[_0xa084('0x32')](_0xdb6821[_0xa084('0x46')][_0xa084('0x32')]);_0xc2e3ce[_0xa084('0x30')]=qs['offset'](_0xdb6821[_0xa084('0x46')][_0xa084('0x30')]);}_0xc2e3ce[_0xa084('0x4c')]=qs['sort'](_0xdb6821['query']['sort']);_0xc2e3ce['where']=qs[_0xa084('0x47')](_[_0xa084('0x4e')](_0xdb6821['query'],_0x5caf3f['filters']));_0xc2e3ce[_0xa084('0x63')][_0xa084('0x5f')]=_0x389082['id'];if(_0xdb6821[_0xa084('0x46')][_0xa084('0x4f')]){_0xc2e3ce[_0xa084('0x63')]=_[_0xa084('0x50')](_0xc2e3ce[_0xa084('0x63')],{'$or':_[_0xa084('0x44')](_0xc2e3ce[_0xa084('0x49')],function(_0x5af3e5){var _0x44995d={};_0x44995d[_0x5af3e5]={'$like':'%'+_0xdb6821[_0xa084('0x46')][_0xa084('0x4f')]+'%'};return _0x44995d;})});}_0xc2e3ce=_[_0xa084('0x50')]({},_0xc2e3ce,_0xdb6821['options']);return db[_0xa084('0x69')][_0xa084('0x33')]({'where':_0xc2e3ce[_0xa084('0x63')]})[_0xa084('0x20')](function(_0x25846f){_0x5c18f5['count']=_0x25846f;if(_0xdb6821['query'][_0xa084('0x64')]){_0xc2e3ce[_0xa084('0x52')]=[{'all':!![]}];}return db[_0xa084('0x69')][_0xa084('0x6b')](_0xc2e3ce);})['then'](function(_0x5512cd){_0x5c18f5[_0xa084('0x6c')]=_0x5512cd;return _0x5c18f5;});}})[_0xa084('0x20')](respondWithFilteredResult(_0x3ae26e,_0xc2e3ce))[_0xa084('0x2b')](handleError(_0x3ae26e,null));};exports[_0xa084('0x6d')]=function(_0x78b571,_0x3ac001,_0x32f14e){return db[_0xa084('0x3e')][_0xa084('0x55')]({'where':{'id':_0x78b571[_0xa084('0x53')]['id']}})['then'](handleEntityNotFound(_0x3ac001,null))[_0xa084('0x20')](function(_0x105568){if(_0x105568){return _0x105568['removeAnswers'](_0x78b571[_0xa084('0x46')][_0xa084('0x66')]);}})[_0xa084('0x20')](respondWithStatusCode(_0x3ac001,null))[_0xa084('0x2b')](handleError(_0x3ac001,null));};exports[_0xa084('0x6e')]=function(_0x3a3004,_0x328071,_0x352324){var _0x3e76e6={'channel':_0xa084('0x6f')};var _0x42e48f=[];var _0x49f1e1=[];var _0x23fa99={};return db[_0xa084('0x3e')]['find']({'where':{'id':_0x3a3004[_0xa084('0x53')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xa084('0x70')}]})[_0xa084('0x20')](handleEntityNotFound(_0x328071,null))['then'](function(_0x37b1af){_0x3e76e6['account']=_0x37b1af;_0x3e76e6['applications']=_['orderBy'](_0x37b1af[_0xa084('0x70')],[_0xa084('0x71')],['asc']);if(_0x3e76e6[_0xa084('0x72')][_0xa084('0x70')]){delete _0x3e76e6[_0xa084('0x72')][_0xa084('0x70')];}return db[_0xa084('0x73')]['describe']();})[_0xa084('0x20')](function(_0x4a9c40){if(!_0x4a9c40){throw new db[(_0xa084('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x42e48f=_[_0xa084('0x75')](_[_0xa084('0x45')](_0x4a9c40),[_0xa084('0x76'),_0xa084('0x77')]);_0x49f1e1=_[_0xa084('0x75')](_[_0xa084('0x45')](_0x4a9c40),[_0xa084('0x76'),_0xa084('0x77'),_0xa084('0x78'),_0xa084('0x79')]);_0x3e76e6[_0xa084('0x57')]={'mapKey':_0xa084('0x7a')};if(_0x3e76e6[_0xa084('0x72')][_0xa084('0x41')]){switch(_0x3e76e6['account'][_0xa084('0x41')]){case'twilio':_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x7c')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x7d')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x7e')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x7f')];break;case'skebby':_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')]='+'+_0x3a3004['body'][_0xa084('0x80')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x81')];break;case'connectel':_0x3e76e6['body'][_0xa084('0x7b')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x7b')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x29')];break;case _0xa084('0x82'):_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')]=_0x3a3004['body'][_0xa084('0x7b')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]=_0x3a3004[_0xa084('0x57')]['body'];_0x3e76e6['body'][_0xa084('0x7e')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x83')];break;case _0xa084('0x84'):_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')]=_0x3a3004['body'][_0xa084('0x7c')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]=_0x3a3004['body'][_0xa084('0x85')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x7e')]=_0x3a3004['body']['MessageUUID'];break;case _0xa084('0x86'):_0x3e76e6['body']['from']='+'+_0x3a3004[_0xa084('0x57')][_0xa084('0x87')][0x0][_0xa084('0x7b')];_0x3e76e6['body'][_0xa084('0x57')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x87')][0x0][_0xa084('0x81')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x7e')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x87')][0x0]['messageId'];break;case _0xa084('0x88'):_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x89')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x8a')]['message'];break;case _0xa084('0x8b'):_0x3e76e6['body'][_0xa084('0x7b')]=_0x3a3004['body'][_0xa084('0x8c')];_0x3e76e6[_0xa084('0x57')]['body']=_0x3a3004[_0xa084('0x57')]['text'];_0x3e76e6['body']['messageId']=_0x3a3004[_0xa084('0x57')]['replyMessageId'];break;case _0xa084('0x8d'):_0x3e76e6[_0xa084('0x57')][_0xa084('0x7e')]=_0x3a3004[_0xa084('0x57')][0x0][_0xa084('0x29')]['id'];_0x3e76e6['body']['from']=_0x3a3004[_0xa084('0x57')][0x0][_0xa084('0x29')][_0xa084('0x7b')];_0x3e76e6[_0xa084('0x57')]['body']=_0x3a3004[_0xa084('0x57')][0x0][_0xa084('0x29')]['text'];break;case _0xa084('0x8e'):_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x7b')];_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]=_0x3a3004[_0xa084('0x57')]['message'];_0x3e76e6[_0xa084('0x57')][_0xa084('0x7e')]=_0x3a3004[_0xa084('0x57')][_0xa084('0x8f')];break;}}if(_0x3e76e6['body']['id']){delete _0x3e76e6[_0xa084('0x57')]['id'];}if(_[_0xa084('0x90')](_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')])){throw new db[(_0xa084('0x74'))][(_0xa084('0x91'))](_0xa084('0x92'));}if(_[_0xa084('0x90')](_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')])||_0x3e76e6[_0xa084('0x57')][_0xa084('0x57')]===''){throw new db['Sequelize'][(_0xa084('0x91'))](_0xa084('0x93'));}if(_['isNil'](_0x3e76e6[_0xa084('0x57')][_0xa084('0x94')])){throw new db['Sequelize'][(_0xa084('0x91'))](_0xa084('0x95')+_0x49f1e1);}if(!_[_0xa084('0x96')](_0x49f1e1,_0x3e76e6[_0xa084('0x57')]['mapKey'])){throw new db['Sequelize'][(_0xa084('0x91'))](_0xa084('0x97')+_0x49f1e1);}_0x23fa99[_0x3e76e6[_0xa084('0x57')][_0xa084('0x94')]]=_0x3e76e6[_0xa084('0x57')]['from'];return db[_0xa084('0x98')][_0xa084('0x55')]({'where':{'id':_0x3e76e6['account'][_0xa084('0x79')]},'include':[{'model':db[_0xa084('0x73')],'as':'Contacts','where':_0x23fa99,'limit':0x1,'order':[['updatedAt',_0xa084('0x99')]]}]});})['then'](handleEntityNotFound(_0x328071,null))[_0xa084('0x20')](function(_0x276ef8){if(_0x276ef8){_0x3e76e6[_0xa084('0x9a')]=_[_0xa084('0x9b')](_0x276ef8,[_0xa084('0x9c')]);if(_0x276ef8[_0xa084('0x9c')]['length']){return _0x276ef8[_0xa084('0x9c')][0x0];}var _0x478935=_[_0xa084('0x1b')](_0x3e76e6[_0xa084('0x57')],{'firstName':_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')],'ListId':_0x276ef8['id']});_0x478935[_0x3e76e6[_0xa084('0x57')][_0xa084('0x94')]]=_0x3e76e6[_0xa084('0x57')]['from'];return db[_0xa084('0x73')][_0xa084('0x56')](_0x478935,{'fields':_0x42e48f,'raw':!![]});}})['then'](handleEntityNotFound(_0x328071,null))['then'](function(_0x154fa4){if(_0x154fa4){_0x3e76e6[_0xa084('0x9d')]=_0x154fa4;var _0x1c1cbd={'ContactId':_0x154fa4['id'],'phone':_0x3e76e6[_0xa084('0x57')]['from'],'SmsAccountId':_0x3a3004[_0xa084('0x53')]['id']};var _0x1c1d99={'ContactId':_0x154fa4['id'],'SmsAccountId':_0x3a3004[_0xa084('0x53')]['id'],'closed':![]};return db[_0xa084('0x9e')][_0xa084('0x55')]({'where':_0x1c1d99})[_0xa084('0x20')](function(_0x15fb0a){if(_0x15fb0a){return[_0x15fb0a,![]];}return db[_0xa084('0x9e')]['create'](_0x1c1cbd)[_0xa084('0x20')](function(_0x5a2ec1){return[_0x5a2ec1,!![]];});});}})[_0xa084('0x9f')](function(_0x32bfaa,_0x2b113b){_0x3e76e6[_0xa084('0xa0')]=_0x32bfaa[_0xa084('0xa1')]({'plain':!![]});_0x3e76e6[_0xa084('0xa0')][_0xa084('0xa2')]=![];if(_0x2b113b){if(_0x3e76e6[_0xa084('0x72')][_0xa084('0xa3')]){_0x3e76e6[_0xa084('0xa4')][_0xa084('0xa5')]({'id':0x0,'priority':_0x3e76e6[_0xa084('0xa4')]['length']+0x1,'app':_0xa084('0xa6'),'appdata':_0xa084('0xa7'),'interval':'*,*,*,*'});}_0x3e76e6[_0xa084('0xa0')][_0xa084('0xa2')]=!![];}return db[_0xa084('0xa8')][_0xa084('0x56')]({'phone':_0x3e76e6[_0xa084('0x57')][_0xa084('0x7b')],'messageId':_0x3e76e6[_0xa084('0x57')][_0xa084('0x7e')],'body':_0x3e76e6['body'][_0xa084('0x57')],'SmsAccountId':_0x3a3004['params']['id'],'SmsInteractionId':_0x32bfaa['id'],'direction':'in','ContactId':_0x32bfaa[_0xa084('0xa9')],'AttachmentId':_0x3e76e6[_0xa084('0x57')][_0xa084('0xaa')]});})[_0xa084('0x20')](function(_0x81f2f7){_0x3e76e6[_0xa084('0x29')]=_0x81f2f7;if(_0x3e76e6[_0xa084('0xa0')]['UserId']){return db[_0xa084('0xab')]['find']({'attributes':['id','name'],'where':{'id':_0x3e76e6[_0xa084('0xa0')]['UserId']}})[_0xa084('0x20')](function(_0x1893ae){if(_0x1893ae){_0x3e76e6[_0xa084('0xa4')][_0xa084('0xac')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1893ae[_0xa084('0x3b')]+','+(_0x3e76e6[_0xa084('0x72')][_0xa084('0xad')]||0xa),'interval':_0xa084('0xae')});}return respondWithRpcPromise(_0xa084('0xaf'),_0xa084('0xb0'),_0x3e76e6);});}return respondWithRpcPromise(_0xa084('0xaf'),_0xa084('0xb0'),_0x3e76e6);})[_0xa084('0x20')](function(_0x570e72){if(_0x570e72){var _0x2253d8=0xc8;var _0x3453d0='receiveMessage';logger[_0xa084('0x21')](_0xa084('0x25'),_0x3453d0,_0x2253d8,_0xa084('0xb1'));logger[_0xa084('0x24')](_0xa084('0xb2'),_0x3453d0,_0x2253d8,'entity\x20found',JSON['stringify'](_0x570e72));if(_0x3e76e6[_0xa084('0x72')][_0xa084('0x41')]===_0xa084('0xb3')){return _0x328071[_0xa084('0x2d')](_0x2253d8)[_0xa084('0xb4')](_0xa084('0xb5'),'text/xml')['send'](_0xa084('0xb6'));}else{return _0x328071[_0xa084('0x2d')](_0x2253d8)[_0xa084('0x2f')](_0x570e72);}}})[_0xa084('0x2b')](handleError(_0x328071,null));};exports[_0xa084('0xb7')]=function(_0x1242df,_0x1d1c2c){var _0x578d88=_0x1242df['params']['id'];var _0x28100c=_0x1242df[_0xa084('0x57')];var _0x40afab=0xc8;var _0x49661b=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xa084('0xb8')][_0xa084('0xb9')]},function(_0xcd9902){return db['SmsAccount'][_0xa084('0x68')]({'where':{'id':_0x578d88},'transaction':_0xcd9902})[_0xa084('0x20')](function(_0x423a56){if(_0x423a56){return db[_0xa084('0xba')][_0xa084('0x38')]({'where':{'SmsAccountId':_0x578d88},'transaction':_0xcd9902})[_0xa084('0x20')](function(){var _0x395f58=_[_0xa084('0x44')](_0x28100c,function(_0x3a0ddd){_0x3a0ddd[_0xa084('0x5f')]=_0x578d88;return _0x3a0ddd;});return db[_0xa084('0xba')][_0xa084('0xbb')](_0x395f58,{'transaction':_0xcd9902});});}else{_0x40afab=0x194;_0x49661b=[];}});})[_0xa084('0x20')](function(){if(_0x40afab!==0x194){return db[_0xa084('0xba')][_0xa084('0xbc')]({'where':{'SmsAccountId':_0x578d88},'order':_0xa084('0x71')})[_0xa084('0x20')](function(_0x313a70){_0x49661b=_0x313a70;});}})[_0xa084('0x2b')](function(_0x383a4d){_0x40afab=0x1f4;logger[_0xa084('0x27')](_0x383a4d[_0xa084('0x3a')]);if(_0x383a4d[_0xa084('0x3b')]){delete _0x383a4d[_0xa084('0x3b')];}_0x49661b=_0x383a4d;})['finally'](function(){if(_0x49661b===null){_0x1d1c2c[_0xa084('0x2c')](_0x40afab);}else{if(_0x40afab===0x1f4){_0x1d1c2c[_0xa084('0x2d')](_0x40afab)[_0xa084('0x3c')](_0x49661b);}else{_0x1d1c2c[_0xa084('0x2d')](_0x40afab)[_0xa084('0x2f')](_0x49661b);}}});};exports['getApplications']=function(_0x4b4e23,_0x1deece,_0x493586){var _0x2341f3={};var _0x491f0a={};var _0x172376;var _0x3cbe8c;return db[_0xa084('0x3e')][_0xa084('0x68')]({'where':{'id':_0x4b4e23[_0xa084('0x53')]['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x1deece,null))[_0xa084('0x20')](function(_0x3e78fd){if(_0x3e78fd){_0x172376=_0x3e78fd;_0x491f0a['model']=_[_0xa084('0x45')](db['SmsApplication']['rawAttributes']);_0x491f0a['query']=_[_0xa084('0x45')](_0x4b4e23[_0xa084('0x46')]);_0x491f0a[_0xa084('0x47')]=_[_0xa084('0x48')](_0x491f0a['model'],_0x491f0a[_0xa084('0x46')]);_0x2341f3[_0xa084('0x49')]=_['intersection'](_0x491f0a[_0xa084('0x43')],qs[_0xa084('0x4a')](_0x4b4e23[_0xa084('0x46')][_0xa084('0x4a')]));_0x2341f3[_0xa084('0x49')]=_0x2341f3[_0xa084('0x49')][_0xa084('0x4b')]?_0x2341f3[_0xa084('0x49')]:_0x491f0a[_0xa084('0x43')];_0x2341f3[_0xa084('0x4c')]=qs[_0xa084('0x4d')](_0x4b4e23['query']['sort']);_0x2341f3[_0xa084('0x63')]=qs[_0xa084('0x47')](_[_0xa084('0x4e')](_0x4b4e23[_0xa084('0x46')],_0x491f0a[_0xa084('0x47')]));if(_0x4b4e23[_0xa084('0x46')][_0xa084('0x4f')]){_0x2341f3[_0xa084('0x63')]=_[_0xa084('0x50')](_0x2341f3[_0xa084('0x63')],{'$or':_['map'](_0x2341f3[_0xa084('0x49')],function(_0x568417){var _0x5d7546={};_0x5d7546[_0x568417]={'$like':'%'+_0x4b4e23[_0xa084('0x46')][_0xa084('0x4f')]+'%'};return _0x5d7546;})});}_0x2341f3=_[_0xa084('0x50')]({},_0x2341f3,_0x4b4e23[_0xa084('0x51')]);return _0x172376[_0xa084('0xbd')](_0x2341f3);}})['then'](function(_0x94f730){if(_0x94f730){_0x3cbe8c=_0x94f730[_0xa084('0x4b')];if(!_0x4b4e23[_0xa084('0x46')]['hasOwnProperty'](_0xa084('0x6a'))){_0x2341f3[_0xa084('0x32')]=qs[_0xa084('0x32')](_0x4b4e23[_0xa084('0x46')][_0xa084('0x32')]);_0x2341f3['offset']=qs[_0xa084('0x30')](_0x4b4e23[_0xa084('0x46')][_0xa084('0x30')]);}return _0x172376['getApplications'](_0x2341f3);}})[_0xa084('0x20')](function(_0x3b2152){if(_0x3b2152){return _0x3b2152?{'count':_0x3cbe8c,'rows':_0x3b2152}:null;}})[_0xa084('0x20')](respondWithResult(_0x1deece,null))[_0xa084('0x2b')](handleError(_0x1deece,null));};exports['getInteractions']=function(_0x7f6525,_0x2a71b4,_0x6846a7){var _0x5370c8={'raw':![],'where':{}};var _0x3293ea={};var _0x20611b={'count':0x0,'rows':[]};return db[_0xa084('0x3e')][_0xa084('0x68')]({'where':{'id':_0x7f6525[_0xa084('0x53')]['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x2a71b4,null))[_0xa084('0x20')](function(_0x40c76f){if(_0x40c76f){_0x3293ea[_0xa084('0x43')]=_[_0xa084('0x45')](db[_0xa084('0x9e')][_0xa084('0x3f')]);_0x3293ea[_0xa084('0x46')]=_[_0xa084('0x45')](_0x7f6525[_0xa084('0x46')]);_0x3293ea[_0xa084('0x47')]=_['intersection'](_0x3293ea['model'],_0x3293ea[_0xa084('0x46')]);_0x5370c8[_0xa084('0x49')]=_[_0xa084('0x48')](_0x3293ea[_0xa084('0x43')],qs['fields'](_0x7f6525[_0xa084('0x46')][_0xa084('0x4a')]));_0x5370c8[_0xa084('0x49')]=_0x5370c8[_0xa084('0x49')]['length']?_0x5370c8['attributes']:_0x3293ea[_0xa084('0x43')];if(!_0x7f6525['query']['hasOwnProperty'](_0xa084('0x6a'))){_0x5370c8[_0xa084('0x32')]=qs[_0xa084('0x32')](_0x7f6525['query'][_0xa084('0x32')]);_0x5370c8[_0xa084('0x30')]=qs[_0xa084('0x30')](_0x7f6525['query'][_0xa084('0x30')]);}_0x5370c8[_0xa084('0x4c')]=qs[_0xa084('0x4d')](_0x7f6525[_0xa084('0x46')]['sort']);_0x5370c8[_0xa084('0x63')]=qs[_0xa084('0x47')](_[_0xa084('0x4e')](_0x7f6525[_0xa084('0x46')],_0x3293ea[_0xa084('0x47')]));_0x5370c8[_0xa084('0x63')][_0xa084('0x5f')]=_0x40c76f['id'];if(_0x7f6525['query'][_0xa084('0x4f')]){_0x5370c8[_0xa084('0x63')]=_[_0xa084('0x50')](_0x5370c8[_0xa084('0x63')],{'$or':_[_0xa084('0x44')](_0x5370c8['attributes'],function(_0x5e257b){var _0x551b1d={};_0x551b1d[_0x5e257b]={'$like':'%'+_0x7f6525[_0xa084('0x46')][_0xa084('0x4f')]+'%'};return _0x551b1d;})});}_0x5370c8=_[_0xa084('0x50')]({},_0x5370c8,_0x7f6525[_0xa084('0x51')]);return db['SmsInteraction'][_0xa084('0x33')]({'where':_0x5370c8[_0xa084('0x63')]})[_0xa084('0x20')](function(_0x5adc2d){_0x20611b[_0xa084('0x33')]=_0x5adc2d;if(_0x7f6525[_0xa084('0x46')][_0xa084('0x64')]){_0x5370c8[_0xa084('0x52')]=[{'model':db[_0xa084('0x73')],'as':_0xa084('0xbe'),'required':![]},{'model':db[_0xa084('0xab')],'as':'Owner','attributes':['name',_0xa084('0xbf'),_0xa084('0xc0')],'required':![]},{'model':db[_0xa084('0xc1')],'as':_0xa084('0xc2'),'attributes':['id',_0xa084('0x3b'),'color'],'where':_0x7f6525[_0xa084('0x46')][_0xa084('0xc3')]?{'id':_0x7f6525['query'][_0xa084('0xc3')]}:undefined,'required':_0x7f6525[_0xa084('0x46')][_0xa084('0xc3')]?!![]:![]}];}return db[_0xa084('0x9e')][_0xa084('0x6b')](_0x5370c8);})[_0xa084('0x20')](function(_0xf39cbb){_0x20611b[_0xa084('0x6c')]=_0xf39cbb;return _0x20611b;});}})[_0xa084('0x20')](respondWithFilteredResult(_0x2a71b4,_0x5370c8))[_0xa084('0x2b')](handleError(_0x2a71b4,null));};exports[_0xa084('0x3c')]=function(_0x211812,_0x4c805e,_0xad1cb7){var _0x105337,_0x58f827,_0x51c8d9;if(_['isNil'](_0x211812[_0xa084('0x57')][_0xa084('0x57')])||_0x211812[_0xa084('0x57')][_0xa084('0x57')]===''){throw new db[(_0xa084('0x74'))][(_0xa084('0x91'))](_0xa084('0x93'));}if(_['isNil'](_0x211812['body']['to'])){throw new db[(_0xa084('0x74'))][(_0xa084('0x91'))](_0xa084('0xc4'));}_0x105337=_0x211812['body']['to'];return db[_0xa084('0x3e')]['find']({'where':{'id':_0x211812[_0xa084('0x53')]['id']},'include':[{'model':db[_0xa084('0x98')],'as':_0xa084('0xc5'),'include':[{'model':db[_0xa084('0x73')],'as':_0xa084('0x9c'),'where':{'mobile':_0x105337},'limit':0x1,'order':[[_0xa084('0x77'),'DESC']]}]}]})[_0xa084('0x20')](handleEntityNotFound(_0x4c805e,null))['then'](function(_0x4b777c){if(_0x4b777c&&_0x4b777c[_0xa084('0xc5')]){_0x58f827=_0x4b777c[_0xa084('0xa1')]({'plain':!![]});if(_0x58f827[_0xa084('0xc5')]&&_0x58f827['List'][_0xa084('0x9c')]['length']){return _0x58f827[_0xa084('0xc5')][_0xa084('0x9c')][0x0];}return db['CmContact']['create'](_[_0xa084('0x1b')](_0x211812['body'],{'firstName':_0x105337,'mobile':_0x105337,'phone':_0x105337,'ListId':_0x58f827['ListId']}));}})[_0xa084('0x20')](handleEntityNotFound(_0x4c805e,null))[_0xa084('0x20')](function(_0x436ad8){if(_0x436ad8){_0x51c8d9=_0x436ad8;return db[_0xa084('0x9e')][_0xa084('0x55')]({'where':{'ContactId':_0x51c8d9['id'],'closed':![],'SmsAccountId':_0x58f827['id']}})[_0xa084('0x20')](function(_0x4ce5d6){if(_0x4ce5d6){return[_0x4ce5d6,![]];}return db['SmsInteraction'][_0xa084('0x56')]({'UserId':_0x211812[_0xa084('0x58')]['id'],'ContactId':_0x51c8d9['id'],'SmsAccountId':_0x58f827['id'],'phone':_0x105337,'firstMsgDirection':'out','Messages':[_[_0xa084('0x50')](_0x211812[_0xa084('0x57')],{'read':![],'body':_0x211812[_0xa084('0x57')][_0xa084('0x57')],'phone':_0x105337,'SmsAccountId':_0x58f827['id'],'UserId':_0x211812[_0xa084('0x58')]['id'],'ContactId':_0x51c8d9['id']})]},{'include':[{'model':db[_0xa084('0xa8')],'as':'Messages'}]})[_0xa084('0x20')](function(_0x33c0fc){return[_0x33c0fc,!![]];});});}})['spread'](function(_0xae59e9,_0x35f772){if(_0x35f772){return _0xae59e9;}return db[_0xa084('0xa8')]['create'](_['merge'](_0x211812[_0xa084('0x57')],{'read':![],'body':_0x211812[_0xa084('0x57')]['body'],'phone':_0x105337,'SmsAccountId':_0x58f827['id'],'SmsInteractionId':_0xae59e9['id'],'UserId':_0x211812['user']['id'],'ContactId':_0x51c8d9['id']}))[_0xa084('0x20')](function(_0x2b5a20){_0xae59e9[_0xa084('0xc6')][_0xa084('0xc7')]=[];_0xae59e9[_0xa084('0xc6')][_0xa084('0xc7')]['push'](_0x2b5a20[_0xa084('0xc6')]);return _0xae59e9;});})['then'](respondWithResult(_0x4c805e,null))['catch'](handleError(_0x4c805e,null));};exports[_0xa084('0x2d')]=function(_0x307d7c,_0x5d536e,_0x2835cd){if(_0x307d7c[_0xa084('0x57')]['id']){delete _0x307d7c[_0xa084('0x57')]['id'];}var _0x253527,_0xb3c341,_0x28c633;return db[_0xa084('0x3e')][_0xa084('0x55')]({'where':{'id':_0x307d7c[_0xa084('0x53')]['id']}})['then'](handleEntityNotFound(_0x5d536e,null))['then'](function(_0x2be37d){if(_0x2be37d){_0x28c633=_0x2be37d;logger[_0xa084('0x24')](_0xa084('0x25'),_0xa084('0x2d'),_0xa084('0xc8'),_0x2be37d['type'],util[_0xa084('0xc9')](_0x307d7c[_0xa084('0x57')],{'showHidden':![],'depth':null}));switch(_0x2be37d[_0xa084('0x41')]){case'skebby':if(_0x307d7c['body'][_0xa084('0xca')]&&_0x307d7c[_0xa084('0x57')]['status']){_0xb3c341=_0x307d7c['body']['status'];return db[_0xa084('0xa8')][_0xa084('0x55')]({'where':{'messageId':_0x307d7c[_0xa084('0x57')][_0xa084('0xca')]}});}break;case _0xa084('0xcb'):if(_0x307d7c['body'][_0xa084('0xcc')]&&_0x307d7c[_0xa084('0x57')][_0xa084('0xcd')]){_0xb3c341=_0x307d7c['body'][_0xa084('0xcd')];return db[_0xa084('0xa8')]['find']({'where':{'messageId':_0x307d7c[_0xa084('0x57')]['requestid']}});}break;case _0xa084('0x82'):if(_0x307d7c[_0xa084('0x57')]['message_id']&&_0x307d7c[_0xa084('0x57')]['status_code']){_0xb3c341=_0x307d7c[_0xa084('0x57')][_0xa084('0xce')];return db[_0xa084('0xa8')][_0xa084('0x55')]({'where':{'messageId':_0x307d7c[_0xa084('0x57')][_0xa084('0x83')]}});}break;case'infobip':var _0x1b8c43=_0x307d7c['body']['results'][0x0];if(_0x1b8c43[_0xa084('0x7e')]&&_0x1b8c43[_0xa084('0x2d')][_0xa084('0xcf')]==='DELIVERED'){_0xb3c341=_0x1b8c43[_0xa084('0x2d')][_0xa084('0xcf')];return db[_0xa084('0xa8')][_0xa084('0x55')]({'where':{'messageId':_0x1b8c43[_0xa084('0x7e')]}});}break;case _0xa084('0x8b'):if(_0x307d7c[_0xa084('0x57')][_0xa084('0x7e')]&&_0x307d7c[_0xa084('0x57')]['status']){_0xb3c341=_0x307d7c['body'][_0xa084('0x2d')];return db['SmsMessage']['find']({'where':{'messageId':_0x307d7c['body'][_0xa084('0x7e')]}});}break;case'bandwidth':if(_0x307d7c[_0xa084('0x57')][0x0][_0xa084('0x29')]['id']){_0xb3c341=_0x307d7c[_0xa084('0x57')][0x0]['type'];return db[_0xa084('0xa8')][_0xa084('0x55')]({'where':{'messageId':_0x307d7c[_0xa084('0x57')][0x0]['message']['id']}});}break;case _0xa084('0x8e'):if(_0x307d7c[_0xa084('0x57')][_0xa084('0xd0')]&&_0x307d7c[_0xa084('0x57')][_0xa084('0x2d')]){_0xb3c341=_0x307d7c[_0xa084('0x57')][_0xa084('0x2d')];return db[_0xa084('0xa8')][_0xa084('0x55')]({'where':{'messageId':_0x307d7c[_0xa084('0x57')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x5d536e,null))[_0xa084('0x20')](function(_0x268c51){if(_0x268c51){_0x253527=_0x268c51;switch(_0x28c633[_0xa084('0x41')]){case _0xa084('0xd1'):if(_0xb3c341==='DELIVERED'){return _0x253527['update']({'read':!![]});}else{logger[_0xa084('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa084('0x2d'),'skebby',util[_0xa084('0xc9')](_0x307d7c[_0xa084('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa084('0xcb'):if(_0xb3c341==='1'){return _0x253527[_0xa084('0x37')]({'read':!![]});}else{logger[_0xa084('0x27')](_0xa084('0x25'),_0xa084('0x2d'),_0xa084('0xd1'),util[_0xa084('0xc9')](_0x307d7c['body'],{'showHidden':![],'depth':null}));}break;case _0xa084('0x82'):if(!_0x307d7c['body'][_0xa084('0xd2')]&&_0xb3c341>=0xc8&&_0xb3c341<=0xce){return _0x253527[_0xa084('0x37')]({'read':!![]});}else{logger[_0xa084('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa084('0x2d'),_0xa084('0x82'),util[_0xa084('0xc9')](_0x307d7c[_0xa084('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa084('0x86'):var _0x50c1b3=_0x307d7c[_0xa084('0x57')][_0xa084('0x87')][0x0];if(_0x50c1b3[_0xa084('0x2d')][_0xa084('0xcf')]===_0xa084('0xd3')){return _0x253527[_0xa084('0x37')]({'read':!![]});}else{logger[_0xa084('0x27')](_0xa084('0x25'),_0xa084('0x2d'),_0xa084('0x86'),util[_0xa084('0xc9')](_0x307d7c[_0xa084('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa084('0x8b'):if(_0xb3c341==_0xa084('0xd4')||_0xb3c341=='RECEIVED_BY_RECIPIENT'){return _0x253527[_0xa084('0x37')]({'read':!![]});}else{logger['error'](_0xa084('0x25'),_0xa084('0x2d'),_0xa084('0x8b'),util[_0xa084('0xc9')](_0x307d7c[_0xa084('0x57')],{'showHidden':![],'depth':null}));}break;case _0xa084('0x8d'):if(_0xb3c341==_0xa084('0xd5')){return _0x253527[_0xa084('0x37')]({'read':!![]});}else{logger['error'](_0xa084('0x25'),_0xa084('0x2d'),'bandwidth',util[_0xa084('0xc9')](_0x307d7c['body'],{'showHidden':![],'depth':null}));}break;case _0xa084('0x8e'):if(_0xb3c341===_0xa084('0xd6')||_0xb3c341===_0xa084('0xd7')){return _0x253527[_0xa084('0x37')]({'read':!![]});}else{logger[_0xa084('0x27')](_0xa084('0x25'),_0xa084('0x2d'),'intelepeer',util[_0xa084('0xc9')](_0x307d7c[_0xa084('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x253527;}})[_0xa084('0x20')](respondWithResult(_0x5d536e,null))['catch'](handleError(_0x5d536e,null));};exports[_0xa084('0xd8')]=function(_0x57d1ad,_0x3d7da0,_0x5a95e){var _0x36314f,_0x163b02,_0x2da33f;return db[_0xa084('0x3e')]['find']({'where':{'id':_0x57d1ad['params']['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x3d7da0,null))[_0xa084('0x20')](function(_0x378393){if(_0x378393){_0x2da33f=_0x378393;logger[_0xa084('0x24')](_0xa084('0x25'),_0xa084('0x2d'),_0xa084('0xc8'),_0x378393['type'],util[_0xa084('0xc9')](_0x57d1ad[_0xa084('0x46')],{'showHidden':![],'depth':null}));switch(_0x378393[_0xa084('0x41')]){case _0xa084('0x88'):if(_0x57d1ad[_0xa084('0x46')][_0xa084('0xd9')]&&_0x57d1ad['query'][_0xa084('0xda')]){_0x163b02=_0x57d1ad[_0xa084('0x46')][_0xa084('0xda')];return db[_0xa084('0xa8')][_0xa084('0x55')]({'where':{'messageId':_0x57d1ad[_0xa084('0x46')][_0xa084('0xd9')]}});}break;}}})[_0xa084('0x20')](handleEntityNotFound(_0x3d7da0,null))[_0xa084('0x20')](function(_0xf5f9e5){if(_0xf5f9e5){_0x36314f=_0xf5f9e5;switch(_0x2da33f['type']){case _0xa084('0x88'):if(_0x163b02==='2'||_0x163b02==='6'){return _0x36314f[_0xa084('0x37')]({'read':!![]});}else{logger[_0xa084('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa084('0x2d'),_0xa084('0x88'),util[_0xa084('0xc9')](_0x57d1ad[_0xa084('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x36314f;}})[_0xa084('0x20')](respondWithResult(_0x3d7da0,null))[_0xa084('0x2b')](handleError(_0x3d7da0,null));};exports[_0xa084('0xdb')]=function(_0xf7357e,_0x5d54e6,_0x27a43c){return db[_0xa084('0x3e')][_0xa084('0x55')]({'where':{'id':_0xf7357e[_0xa084('0x53')]['id']}})[_0xa084('0x20')](handleEntityNotFound(_0x5d54e6,null))[_0xa084('0x20')](function(_0xc93292){if(_0xc93292){return _0xc93292[_0xa084('0xdb')](_0xf7357e[_0xa084('0x57')][_0xa084('0x66')],_[_0xa084('0x9b')](_0xf7357e[_0xa084('0x57')],[_0xa084('0x66'),'id'])||{})[_0xa084('0x9f')](function(_0x405095){for(var _0xa5a651=0x0;_0xa5a651<_0xf7357e[_0xa084('0x57')]['ids'][_0xa084('0x4b')];_0xa5a651+=0x1){socket[_0xa084('0xdc')](_0xa084('0xdd'),{'UserId':Number(_0xf7357e[_0xa084('0x57')][_0xa084('0x66')][_0xa5a651]),'SmsAccountId':Number(_0xf7357e['params']['id'])});}return _0x405095;});}})[_0xa084('0x20')](respondWithResult(_0x5d54e6,null))[_0xa084('0x2b')](handleError(_0x5d54e6,null));};exports[_0xa084('0xde')]=function(_0x2cf739,_0x29cb6b,_0x42eb9d){return db['SmsAccount']['find']({'where':{'id':_0x2cf739[_0xa084('0x53')]['id']}})['then'](handleEntityNotFound(_0x29cb6b,null))[_0xa084('0x20')](function(_0xd880ef){if(_0xd880ef){return _0xd880ef[_0xa084('0xde')](_0x2cf739[_0xa084('0x46')][_0xa084('0x66')])[_0xa084('0x20')](function(){if(_[_0xa084('0xdf')](_0x2cf739[_0xa084('0x46')][_0xa084('0x66')])){for(var _0x4b6d0e=0x0;_0x4b6d0e<_0x2cf739['query']['ids'][_0xa084('0x4b')];_0x4b6d0e+=0x1){socket[_0xa084('0xdc')](_0xa084('0xe0'),{'UserId':Number(_0x2cf739[_0xa084('0x46')][_0xa084('0x66')][_0x4b6d0e]),'SmsAccountId':Number(_0x2cf739['params']['id'])});}}else{socket[_0xa084('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x2cf739['query'][_0xa084('0x66')]),'SmsAccountId':Number(_0x2cf739[_0xa084('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x29cb6b,null))['catch'](handleError(_0x29cb6b,null));};exports[_0xa084('0xe1')]=function(_0x4536e8,_0x40c36c,_0x1022ef){var _0x9ba951={};var _0x2c5152={};var _0x2a3be7;var _0xd052f;return db[_0xa084('0x3e')][_0xa084('0x68')]({'where':{'id':_0x4536e8['params']['id']}})['then'](handleEntityNotFound(_0x40c36c,null))[_0xa084('0x20')](function(_0x3feaaf){if(_0x3feaaf){_0x2a3be7=_0x3feaaf;_0x2c5152['model']=_[_0xa084('0x45')](db['User'][_0xa084('0x3f')]);_0x2c5152[_0xa084('0x46')]=_[_0xa084('0x45')](_0x4536e8[_0xa084('0x46')]);_0x2c5152[_0xa084('0x47')]=_[_0xa084('0x48')](_0x2c5152[_0xa084('0x43')],_0x2c5152['query']);_0x9ba951[_0xa084('0x49')]=_[_0xa084('0x48')](_0x2c5152['model'],qs[_0xa084('0x4a')](_0x4536e8[_0xa084('0x46')][_0xa084('0x4a')]));_0x9ba951[_0xa084('0x49')]=_0x9ba951[_0xa084('0x49')][_0xa084('0x4b')]?_0x9ba951[_0xa084('0x49')]:_0x2c5152['model'];_0x9ba951['order']=qs[_0xa084('0x4d')](_0x4536e8['query'][_0xa084('0x4d')]);_0x9ba951[_0xa084('0x63')]=qs['filters'](_[_0xa084('0x4e')](_0x4536e8['query'],_0x2c5152[_0xa084('0x47')]));if(_0x4536e8[_0xa084('0x46')]['filter']){_0x9ba951[_0xa084('0x63')]=_[_0xa084('0x50')](_0x9ba951[_0xa084('0x63')],{'$or':_['map'](_0x9ba951[_0xa084('0x49')],function(_0x29489e){var _0x5203da={};_0x5203da[_0x29489e]={'$like':'%'+_0x4536e8[_0xa084('0x46')]['filter']+'%'};return _0x5203da;})});}_0x9ba951=_[_0xa084('0x50')]({},_0x9ba951,_0x4536e8[_0xa084('0x51')]);return _0x2a3be7['getAgents'](_0x9ba951);}})[_0xa084('0x20')](function(_0x1e128a){if(_0x1e128a){_0xd052f=_0x1e128a['length'];if(!_0x4536e8[_0xa084('0x46')][_0xa084('0x62')](_0xa084('0x6a'))){_0x9ba951[_0xa084('0x32')]=qs['limit'](_0x4536e8['query'][_0xa084('0x32')]);_0x9ba951[_0xa084('0x30')]=qs[_0xa084('0x30')](_0x4536e8[_0xa084('0x46')][_0xa084('0x30')]);}return _0x2a3be7[_0xa084('0xe1')](_0x9ba951);}})[_0xa084('0x20')](function(_0xcb7dde){if(_0xcb7dde){return _0xcb7dde?{'count':_0xd052f,'rows':_0xcb7dde}:null;}})['then'](respondWithResult(_0x40c36c,null))[_0xa084('0x2b')](handleError(_0x40c36c,null));}; \ No newline at end of file +var _0x5201=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','include','catch','show','params','rawAttributes','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','findOne','hasOwnProperty','order','findAll','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','rows','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','Body','skebby','from','text','connectel','clicksend','message_id','messageId','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','list','SmsInteraction','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','SmsMessage','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Contact','Owner','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','received\x20delivery\x20report\x20from','inspect','statusInt','requestid','status_code','groupName','DELIVERED','intelepeer','redif','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x5df82c,_0x38a2d5){var _0x1ad008=function(_0x4c54ce){while(--_0x4c54ce){_0x5df82c['push'](_0x5df82c['shift']());}};_0x1ad008(++_0x38a2d5);}(_0x5201,0xd4));var _0x1520=function(_0x5b2330,_0x4e88b4){_0x5b2330=_0x5b2330-0x0;var _0x3486f7=_0x5201[_0x5b2330];return _0x3486f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1520('0x0'));var zipdir=require(_0x1520('0x1'));var jsonpatch=require(_0x1520('0x2'));var rp=require(_0x1520('0x3'));var moment=require(_0x1520('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1520('0x5'));var util=require(_0x1520('0x6'));var path=require(_0x1520('0x7'));var sox=require(_0x1520('0x8'));var csv=require(_0x1520('0x9'));var ejs=require(_0x1520('0xa'));var fs=require('fs');var fs_extra=require(_0x1520('0xb'));var _=require(_0x1520('0xc'));var squel=require('squel');var crypto=require(_0x1520('0xd'));var jsforce=require(_0x1520('0xe'));var deskjs=require(_0x1520('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1520('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1520('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1520('0x12'));var utils=require('../../config/utils');var config=require(_0x1520('0x13'));var licenseUtil=require(_0x1520('0x14'));var db=require(_0x1520('0x15'))['db'];config['redis']=_[_0x1520('0x16')](config['redis'],{'host':_0x1520('0x17'),'port':0x18eb});var socket=require(_0x1520('0x18'))(new Redis(config[_0x1520('0x19')]));require(_0x1520('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x1520('0x1b')][_0x1520('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x933bde,_0x43aab8,_0x1722b3,_0x73d688){return new BPromise(function(_0x1e8d6d,_0x4ac8a6){var _0x465fe4=_0x73d688||client;return _0x465fe4['request'](_0x933bde,_0x1722b3)[_0x1520('0x1d')](function(_0x11a75b){logger[_0x1520('0x1e')](_0x1520('0x1f'),_0x43aab8,_0x1520('0x20'));logger[_0x1520('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x43aab8,'request\x20sent',JSON[_0x1520('0x22')](_0x11a75b));if(_0x11a75b[_0x1520('0x23')]){if(_0x11a75b['error'][_0x1520('0x24')]===0x1f4){logger['error'](_0x1520('0x1f'),_0x43aab8,_0x11a75b[_0x1520('0x23')][_0x1520('0x25')]);return _0x4ac8a6(_0x11a75b[_0x1520('0x23')][_0x1520('0x25')]);}logger['error'](_0x1520('0x1f'),_0x43aab8,_0x11a75b[_0x1520('0x23')]['message']);return _0x1e8d6d(_0x11a75b[_0x1520('0x23')]['message']);}else{logger[_0x1520('0x1e')](_0x1520('0x1f'),_0x43aab8,_0x1520('0x20'));_0x1e8d6d(_0x11a75b['result'][_0x1520('0x25')]);}})['catch'](function(_0x581407){logger[_0x1520('0x23')](_0x1520('0x1f'),_0x43aab8,_0x581407);_0x4ac8a6(_0x581407);});});}function respondWithStatusCode(_0x5b446b,_0x3576b3){_0x3576b3=_0x3576b3||0xcc;return function(_0x55a55c){if(_0x55a55c){return _0x5b446b[_0x1520('0x26')](_0x3576b3);}return _0x5b446b['status'](_0x3576b3)[_0x1520('0x27')]();};}function respondWithResult(_0x164a43,_0x36674c){_0x36674c=_0x36674c||0xc8;return function(_0x4bb53f){if(_0x4bb53f){return _0x164a43['status'](_0x36674c)[_0x1520('0x28')](_0x4bb53f);}};}function respondWithFilteredResult(_0x13ed7e,_0x1d038c){return function(_0x46685a){if(_0x46685a){var _0x242563=typeof _0x1d038c[_0x1520('0x29')]===_0x1520('0x2a')&&typeof _0x1d038c[_0x1520('0x2b')]==='undefined';var _0x17ba68=_0x46685a[_0x1520('0x2c')];var _0x2abe8f=_0x242563?0x0:_0x1d038c[_0x1520('0x29')];var _0x1b6a6e=_0x242563?_0x46685a[_0x1520('0x2c')]:_0x1d038c[_0x1520('0x29')]+_0x1d038c[_0x1520('0x2b')];var _0x143fc2;if(_0x1b6a6e>=_0x17ba68){_0x1b6a6e=_0x17ba68;_0x143fc2=0xc8;}else{_0x143fc2=0xce;}_0x13ed7e[_0x1520('0x2d')](_0x143fc2);return _0x13ed7e['set'](_0x1520('0x2e'),_0x2abe8f+'-'+_0x1b6a6e+'/'+_0x17ba68)[_0x1520('0x28')](_0x46685a);}return null;};}function patchUpdates(_0x2bdd78){return function(_0x4d63c6){try{jsonpatch[_0x1520('0x2f')](_0x4d63c6,_0x2bdd78,!![]);}catch(_0x47f70){return BPromise[_0x1520('0x30')](_0x47f70);}return _0x4d63c6[_0x1520('0x31')]();};}function saveUpdates(_0xc8fcb3,_0x495d8d){return function(_0x5f0b8c){if(_0x5f0b8c){return _0x5f0b8c[_0x1520('0x32')](_0xc8fcb3)[_0x1520('0x1d')](function(_0x200655){return _0x200655;});}return null;};}function removeEntity(_0x48007,_0x32c5d2){return function(_0x175abc){if(_0x175abc){return _0x175abc[_0x1520('0x33')]()[_0x1520('0x1d')](function(){var _0x4d207e=_0x175abc[_0x1520('0x34')]({'plain':!![]});var _0x4b91a2=_0x1520('0x35');return db['UserProfileResource'][_0x1520('0x33')]({'where':{'type':_0x4b91a2,'resourceId':_0x4d207e['id']}})['then'](function(){return _0x175abc;});})['then'](function(){_0x48007[_0x1520('0x2d')](0xcc)[_0x1520('0x27')]();});}};}function handleEntityNotFound(_0x4484f6,_0x3ed917){return function(_0x597224){if(!_0x597224){_0x4484f6[_0x1520('0x26')](0x194);}return _0x597224;};}function handleError(_0xed63b2,_0x4e0b85){_0x4e0b85=_0x4e0b85||0x1f4;return function(_0x32daab){logger[_0x1520('0x23')](_0x32daab['stack']);if(_0x32daab[_0x1520('0x36')]){delete _0x32daab['name'];}_0xed63b2[_0x1520('0x2d')](_0x4e0b85)[_0x1520('0x37')](_0x32daab);};}exports[_0x1520('0x38')]=function(_0x2e7348,_0x70e2ee){var _0x4d5e62={'include':[{'model':db[_0x1520('0x39')],'as':_0x1520('0x3a')}]},_0x25d969={},_0x2abec1={'count':0x0,'rows':[]};var _0x1f06b7=_[_0x1520('0x3b')](db[_0x1520('0x3c')]['rawAttributes'],function(_0x5b64ca){return{'name':_0x5b64ca[_0x1520('0x3d')],'type':_0x5b64ca[_0x1520('0x3e')][_0x1520('0x3f')]};});_0x25d969[_0x1520('0x40')]=_[_0x1520('0x3b')](_0x1f06b7,_0x1520('0x36'));_0x25d969[_0x1520('0x41')]=_[_0x1520('0x42')](_0x2e7348[_0x1520('0x41')]);_0x25d969[_0x1520('0x43')]=_[_0x1520('0x44')](_0x25d969[_0x1520('0x40')],_0x25d969[_0x1520('0x41')]);_0x4d5e62[_0x1520('0x45')]=_[_0x1520('0x44')](_0x25d969[_0x1520('0x40')],qs[_0x1520('0x46')](_0x2e7348['query'][_0x1520('0x46')]));_0x4d5e62[_0x1520('0x45')]=_0x4d5e62[_0x1520('0x45')][_0x1520('0x47')]?_0x4d5e62[_0x1520('0x45')]:_0x25d969['model'];if(!_0x2e7348[_0x1520('0x41')]['hasOwnProperty']('nolimit')){_0x4d5e62[_0x1520('0x2b')]=qs[_0x1520('0x2b')](_0x2e7348[_0x1520('0x41')][_0x1520('0x2b')]);_0x4d5e62['offset']=qs[_0x1520('0x29')](_0x2e7348['query'][_0x1520('0x29')]);}_0x4d5e62['order']=qs[_0x1520('0x48')](_0x2e7348[_0x1520('0x41')][_0x1520('0x48')]);_0x4d5e62['where']=qs[_0x1520('0x43')](_[_0x1520('0x49')](_0x2e7348[_0x1520('0x41')],_0x25d969['filters']),_0x1f06b7);if(_0x2e7348[_0x1520('0x41')][_0x1520('0x4a')]){_0x4d5e62[_0x1520('0x4b')]=_[_0x1520('0x4c')](_0x4d5e62[_0x1520('0x4b')],{'$or':_['map'](_0x1f06b7,function(_0x24678d){if(_0x24678d[_0x1520('0x3e')]!==_0x1520('0x4d')){var _0x33eb5={};_0x33eb5[_0x24678d[_0x1520('0x36')]]={'$like':'%'+_0x2e7348[_0x1520('0x41')][_0x1520('0x4a')]+'%'};return _0x33eb5;}})});}_0x4d5e62=_[_0x1520('0x4c')]({},_0x4d5e62,_0x2e7348[_0x1520('0x4e')]);var _0x3b6a6e={'where':_0x4d5e62[_0x1520('0x4b')]};return db[_0x1520('0x3c')][_0x1520('0x2c')](_0x3b6a6e)[_0x1520('0x1d')](function(_0x5bd1e7){_0x2abec1[_0x1520('0x2c')]=_0x5bd1e7;if(_0x2e7348[_0x1520('0x41')]['includeAll']){_0x4d5e62[_0x1520('0x4f')]=[{'all':!![]}];}return db[_0x1520('0x3c')]['findAll'](_0x4d5e62);})['then'](function(_0x5aa7e6){_0x2abec1['rows']=_0x5aa7e6;return _0x2abec1;})['then'](respondWithFilteredResult(_0x70e2ee,_0x4d5e62))[_0x1520('0x50')](handleError(_0x70e2ee,null));};exports[_0x1520('0x51')]=function(_0x196264,_0x428eb3){var _0x117f52={'raw':![],'where':{'id':_0x196264[_0x1520('0x52')]['id']},'include':[{'model':db[_0x1520('0x39')],'as':'mandatoryDispositionPause'}]},_0x10746c={};_0x10746c[_0x1520('0x40')]=_[_0x1520('0x42')](db[_0x1520('0x3c')][_0x1520('0x53')]);_0x10746c[_0x1520('0x41')]=_[_0x1520('0x42')](_0x196264[_0x1520('0x41')]);_0x10746c[_0x1520('0x43')]=_['intersection'](_0x10746c[_0x1520('0x40')],_0x10746c['query']);_0x117f52[_0x1520('0x45')]=_[_0x1520('0x44')](_0x10746c[_0x1520('0x40')],qs[_0x1520('0x46')](_0x196264[_0x1520('0x41')]['fields']));_0x117f52[_0x1520('0x45')]=_0x117f52['attributes'][_0x1520('0x47')]?_0x117f52[_0x1520('0x45')]:_0x10746c['model'];if(_0x196264[_0x1520('0x41')][_0x1520('0x54')]){_0x117f52['include']=[{'all':!![]}];}_0x117f52=_['merge']({},_0x117f52,_0x196264[_0x1520('0x4e')]);return db[_0x1520('0x3c')]['find'](_0x117f52)[_0x1520('0x1d')](handleEntityNotFound(_0x428eb3,null))[_0x1520('0x1d')](respondWithResult(_0x428eb3,null))[_0x1520('0x50')](handleError(_0x428eb3,null));};exports[_0x1520('0x55')]=function(_0xe80c86,_0x2d9844){return db[_0x1520('0x3c')][_0x1520('0x55')](_0xe80c86[_0x1520('0x56')],{})[_0x1520('0x1d')](function(_0x30dcb9){var _0x26188a=_0xe80c86['user'][_0x1520('0x34')]({'plain':!![]});if(!_0x26188a)throw new Error(_0x1520('0x57'));if(_0x26188a['role']===_0x1520('0x58')){var _0x5bf033=_0x30dcb9[_0x1520('0x34')]({'plain':!![]});var _0x5264e9='SmsAccounts';return db[_0x1520('0x59')][_0x1520('0x5a')]({'where':{'name':_0x5264e9,'userProfileId':_0x26188a['userProfileId']},'raw':!![]})['then'](function(_0x30faab){if(_0x30faab&&_0x30faab[_0x1520('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x5bf033[_0x1520('0x36')],'resourceId':_0x5bf033['id'],'type':_0x30faab[_0x1520('0x36')],'sectionId':_0x30faab['id']},{})[_0x1520('0x1d')](function(){return _0x30dcb9;});}else{return _0x30dcb9;}})['catch'](function(_0x3f5e22){logger['error'](_0x1520('0x5c'),_0x3f5e22);throw _0x3f5e22;});}return _0x30dcb9;})['then'](respondWithResult(_0x2d9844,0xc9))['catch'](handleError(_0x2d9844,null));};exports[_0x1520('0x32')]=function(_0x4544a0,_0x35a123){if(_0x4544a0['body']['id']){delete _0x4544a0[_0x1520('0x56')]['id'];}return db['SmsAccount'][_0x1520('0x5a')]({'where':{'id':_0x4544a0[_0x1520('0x52')]['id']},'include':[{'model':db[_0x1520('0x39')],'as':_0x1520('0x3a')}]})[_0x1520('0x1d')](handleEntityNotFound(_0x35a123,null))[_0x1520('0x1d')](saveUpdates(_0x4544a0['body'],null))[_0x1520('0x1d')](respondWithResult(_0x35a123,null))['catch'](handleError(_0x35a123,null));};exports['destroy']=function(_0x427f0c,_0x4a7140){return db[_0x1520('0x3c')][_0x1520('0x5a')]({'where':{'id':_0x427f0c[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x4a7140,null))[_0x1520('0x1d')](removeEntity(_0x4a7140,null))[_0x1520('0x50')](handleError(_0x4a7140,null));};exports[_0x1520('0x5d')]=function(_0x215aca,_0x44f28b){return db[_0x1520('0x3c')]['describe']()[_0x1520('0x1d')](respondWithResult(_0x44f28b,null))[_0x1520('0x50')](handleError(_0x44f28b,null));};exports[_0x1520('0x5e')]=function(_0x31706c,_0x43cb72,_0x33dfe9){if(_0x31706c[_0x1520('0x56')]['id']){delete _0x31706c[_0x1520('0x56')]['id'];}return db[_0x1520('0x3c')][_0x1520('0x5a')]({'where':{'id':_0x31706c[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x43cb72,null))[_0x1520('0x1d')](function(_0x44b26d){if(_0x44b26d){_0x31706c['body'][_0x1520('0x5f')]=_0x44b26d['id'];return db[_0x1520('0x60')]['create'](_0x31706c[_0x1520('0x56')]);}})['then'](respondWithResult(_0x43cb72,null))[_0x1520('0x50')](handleError(_0x43cb72,null));};exports['getDispositions']=function(_0x1783f8,_0x44205c,_0x101410){var _0x53b2ad={'raw':![],'where':{}};var _0x609a5c={};var _0x475ba7={'count':0x0,'rows':[]};return db[_0x1520('0x3c')][_0x1520('0x61')]({'where':{'id':_0x1783f8[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x44205c,null))[_0x1520('0x1d')](function(_0x5ec5e1){if(_0x5ec5e1){_0x609a5c[_0x1520('0x40')]=_[_0x1520('0x42')](db[_0x1520('0x60')][_0x1520('0x53')]);_0x609a5c[_0x1520('0x41')]=_[_0x1520('0x42')](_0x1783f8[_0x1520('0x41')]);_0x609a5c[_0x1520('0x43')]=_[_0x1520('0x44')](_0x609a5c[_0x1520('0x40')],_0x609a5c['query']);_0x53b2ad[_0x1520('0x45')]=_[_0x1520('0x44')](_0x609a5c[_0x1520('0x40')],qs[_0x1520('0x46')](_0x1783f8[_0x1520('0x41')][_0x1520('0x46')]));_0x53b2ad[_0x1520('0x45')]=_0x53b2ad[_0x1520('0x45')]['length']?_0x53b2ad[_0x1520('0x45')]:_0x609a5c['model'];if(!_0x1783f8[_0x1520('0x41')][_0x1520('0x62')]('nolimit')){_0x53b2ad[_0x1520('0x2b')]=qs[_0x1520('0x2b')](_0x1783f8['query'][_0x1520('0x2b')]);_0x53b2ad['offset']=qs['offset'](_0x1783f8[_0x1520('0x41')]['offset']);}_0x53b2ad[_0x1520('0x63')]=qs[_0x1520('0x48')](_0x1783f8[_0x1520('0x41')][_0x1520('0x48')]);_0x53b2ad[_0x1520('0x4b')]=qs[_0x1520('0x43')](_[_0x1520('0x49')](_0x1783f8[_0x1520('0x41')],_0x609a5c[_0x1520('0x43')]));_0x53b2ad[_0x1520('0x4b')][_0x1520('0x5f')]=_0x5ec5e1['id'];if(_0x1783f8[_0x1520('0x41')]['filter']){_0x53b2ad[_0x1520('0x4b')]=_[_0x1520('0x4c')](_0x53b2ad[_0x1520('0x4b')],{'$or':_[_0x1520('0x3b')](_0x53b2ad['attributes'],function(_0x540dfd){var _0x520022={};_0x520022[_0x540dfd]={'$like':'%'+_0x1783f8[_0x1520('0x41')][_0x1520('0x4a')]+'%'};return _0x520022;})});}_0x53b2ad=_[_0x1520('0x4c')]({},_0x53b2ad,_0x1783f8[_0x1520('0x4e')]);return db['Disposition'][_0x1520('0x2c')]({'where':_0x53b2ad[_0x1520('0x4b')]})[_0x1520('0x1d')](function(_0x3b4629){_0x475ba7[_0x1520('0x2c')]=_0x3b4629;if(_0x1783f8['query'][_0x1520('0x54')]){_0x53b2ad[_0x1520('0x4f')]=[{'all':!![]}];}return db['Disposition'][_0x1520('0x64')](_0x53b2ad);})[_0x1520('0x1d')](function(_0x50bb8b){_0x475ba7['rows']=_0x50bb8b;return _0x475ba7;});}})['then'](respondWithFilteredResult(_0x44205c,_0x53b2ad))['catch'](handleError(_0x44205c,null));};exports[_0x1520('0x65')]=function(_0x48ff0c,_0x2e1576,_0x17e8fa){return db[_0x1520('0x3c')]['find']({'where':{'id':_0x48ff0c['params']['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x2e1576,null))[_0x1520('0x1d')](function(_0x5c2b91){if(_0x5c2b91){return _0x5c2b91[_0x1520('0x65')](_0x48ff0c['query'][_0x1520('0x66')]);}})[_0x1520('0x1d')](respondWithStatusCode(_0x2e1576,null))[_0x1520('0x50')](handleError(_0x2e1576,null));};exports['addAnswer']=function(_0xccbad4,_0x31190c,_0x239dc6){if(_0xccbad4[_0x1520('0x56')]['id']){delete _0xccbad4[_0x1520('0x56')]['id'];}return db[_0x1520('0x3c')]['find']({'where':{'id':_0xccbad4[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x31190c,null))[_0x1520('0x1d')](function(_0x233507){if(_0x233507){_0xccbad4[_0x1520('0x56')]['SmsAccountId']=_0x233507['id'];return db[_0x1520('0x67')][_0x1520('0x55')](_0xccbad4[_0x1520('0x56')]);}})['then'](respondWithResult(_0x31190c,null))[_0x1520('0x50')](handleError(_0x31190c,null));};exports[_0x1520('0x68')]=function(_0x458992,_0x35b3fa,_0x50611f){var _0x57f51b={'raw':![],'where':{}};var _0x313403={};var _0x479047={'count':0x0,'rows':[]};return db[_0x1520('0x3c')][_0x1520('0x61')]({'where':{'id':_0x458992[_0x1520('0x52')]['id']}})['then'](handleEntityNotFound(_0x35b3fa,null))['then'](function(_0x40222e){if(_0x40222e){_0x313403[_0x1520('0x40')]=_[_0x1520('0x42')](db[_0x1520('0x67')][_0x1520('0x53')]);_0x313403[_0x1520('0x41')]=_[_0x1520('0x42')](_0x458992[_0x1520('0x41')]);_0x313403[_0x1520('0x43')]=_[_0x1520('0x44')](_0x313403[_0x1520('0x40')],_0x313403['query']);_0x57f51b[_0x1520('0x45')]=_[_0x1520('0x44')](_0x313403[_0x1520('0x40')],qs[_0x1520('0x46')](_0x458992[_0x1520('0x41')][_0x1520('0x46')]));_0x57f51b[_0x1520('0x45')]=_0x57f51b[_0x1520('0x45')][_0x1520('0x47')]?_0x57f51b[_0x1520('0x45')]:_0x313403[_0x1520('0x40')];if(!_0x458992['query']['hasOwnProperty'](_0x1520('0x69'))){_0x57f51b[_0x1520('0x2b')]=qs[_0x1520('0x2b')](_0x458992[_0x1520('0x41')][_0x1520('0x2b')]);_0x57f51b['offset']=qs['offset'](_0x458992[_0x1520('0x41')]['offset']);}_0x57f51b['order']=qs[_0x1520('0x48')](_0x458992[_0x1520('0x41')][_0x1520('0x48')]);_0x57f51b[_0x1520('0x4b')]=qs[_0x1520('0x43')](_[_0x1520('0x49')](_0x458992[_0x1520('0x41')],_0x313403['filters']));_0x57f51b[_0x1520('0x4b')][_0x1520('0x5f')]=_0x40222e['id'];if(_0x458992[_0x1520('0x41')][_0x1520('0x4a')]){_0x57f51b[_0x1520('0x4b')]=_[_0x1520('0x4c')](_0x57f51b[_0x1520('0x4b')],{'$or':_[_0x1520('0x3b')](_0x57f51b['attributes'],function(_0x1cd736){var _0x2ef9bd={};_0x2ef9bd[_0x1cd736]={'$like':'%'+_0x458992[_0x1520('0x41')][_0x1520('0x4a')]+'%'};return _0x2ef9bd;})});}_0x57f51b=_[_0x1520('0x4c')]({},_0x57f51b,_0x458992['options']);return db[_0x1520('0x67')][_0x1520('0x2c')]({'where':_0x57f51b[_0x1520('0x4b')]})[_0x1520('0x1d')](function(_0x1a96de){_0x479047[_0x1520('0x2c')]=_0x1a96de;if(_0x458992[_0x1520('0x41')][_0x1520('0x54')]){_0x57f51b['include']=[{'all':!![]}];}return db[_0x1520('0x67')][_0x1520('0x64')](_0x57f51b);})[_0x1520('0x1d')](function(_0xf413f8){_0x479047[_0x1520('0x6a')]=_0xf413f8;return _0x479047;});}})[_0x1520('0x1d')](respondWithFilteredResult(_0x35b3fa,_0x57f51b))['catch'](handleError(_0x35b3fa,null));};exports['removeAnswers']=function(_0x1d5479,_0x41e9e4,_0x4775dd){return db[_0x1520('0x3c')]['find']({'where':{'id':_0x1d5479[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x41e9e4,null))['then'](function(_0x2d8d22){if(_0x2d8d22){return _0x2d8d22[_0x1520('0x6b')](_0x1d5479[_0x1520('0x41')][_0x1520('0x66')]);}})[_0x1520('0x1d')](respondWithStatusCode(_0x41e9e4,null))[_0x1520('0x50')](handleError(_0x41e9e4,null));};exports[_0x1520('0x6c')]=function(_0xe59de1,_0x5e7898,_0x437207){var _0x20d75a={'channel':_0x1520('0x6d')};var _0x16fe0b=[];var _0x137d69=[];var _0x40c9f5={};return db[_0x1520('0x3c')][_0x1520('0x5a')]({'where':{'id':_0xe59de1[_0x1520('0x52')]['id']},'include':[{'model':db[_0x1520('0x6e')],'as':_0x1520('0x6f')}]})[_0x1520('0x1d')](handleEntityNotFound(_0x5e7898,null))[_0x1520('0x1d')](function(_0x4435e0){_0x20d75a[_0x1520('0x70')]=_0x4435e0;_0x20d75a['applications']=_[_0x1520('0x71')](_0x4435e0[_0x1520('0x6f')],[_0x1520('0x72')],[_0x1520('0x73')]);if(_0x20d75a[_0x1520('0x70')][_0x1520('0x6f')]){delete _0x20d75a[_0x1520('0x70')][_0x1520('0x6f')];}return db[_0x1520('0x74')][_0x1520('0x5d')]();})[_0x1520('0x1d')](function(_0x41a3bb){if(!_0x41a3bb){throw new db[(_0x1520('0x75'))][(_0x1520('0x76'))](_0x1520('0x77'));}_0x16fe0b=_['difference'](_[_0x1520('0x42')](_0x41a3bb),[_0x1520('0x78'),_0x1520('0x79')]);_0x137d69=_['difference'](_[_0x1520('0x42')](_0x41a3bb),[_0x1520('0x78'),_0x1520('0x79'),_0x1520('0x7a'),_0x1520('0x7b')]);_0x20d75a['body']={'mapKey':_0x1520('0x7c')};if(_0x20d75a[_0x1520('0x70')]['type']){switch(_0x20d75a[_0x1520('0x70')][_0x1520('0x3e')]){case'twilio':_0x20d75a[_0x1520('0x56')]['from']=_0xe59de1[_0x1520('0x56')]['From'];_0x20d75a['body'][_0x1520('0x56')]=_0xe59de1['body'][_0x1520('0x7d')];_0x20d75a[_0x1520('0x56')]['messageId']=_0xe59de1[_0x1520('0x56')]['MessageSid'];break;case _0x1520('0x7e'):_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')]='+'+_0xe59de1[_0x1520('0x56')]['sender'];_0x20d75a[_0x1520('0x56')][_0x1520('0x56')]=_0xe59de1['body'][_0x1520('0x80')];break;case _0x1520('0x81'):_0x20d75a[_0x1520('0x56')]['from']=_0xe59de1['body'][_0x1520('0x7f')];_0x20d75a[_0x1520('0x56')][_0x1520('0x56')]=_0xe59de1[_0x1520('0x56')][_0x1520('0x25')];break;case _0x1520('0x82'):_0x20d75a[_0x1520('0x56')]['from']=_0xe59de1['body'][_0x1520('0x7f')];_0x20d75a[_0x1520('0x56')][_0x1520('0x56')]=_0xe59de1[_0x1520('0x56')][_0x1520('0x56')];_0x20d75a[_0x1520('0x56')]['messageId']=_0xe59de1[_0x1520('0x56')][_0x1520('0x83')];break;case'plivo':_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')]=_0xe59de1[_0x1520('0x56')]['From'];_0x20d75a['body'][_0x1520('0x56')]=_0xe59de1['body']['Text'];_0x20d75a[_0x1520('0x56')][_0x1520('0x84')]=_0xe59de1[_0x1520('0x56')][_0x1520('0x85')];break;case'infobip':_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')]='+'+_0xe59de1[_0x1520('0x56')][_0x1520('0x86')][0x0]['from'];_0x20d75a[_0x1520('0x56')]['body']=_0xe59de1[_0x1520('0x56')][_0x1520('0x86')][0x0][_0x1520('0x80')];_0x20d75a['body'][_0x1520('0x84')]=_0xe59de1[_0x1520('0x56')][_0x1520('0x86')][0x0][_0x1520('0x84')];break;case _0x1520('0x87'):_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')]=_0xe59de1[_0x1520('0x56')][_0x1520('0x88')];_0x20d75a['body'][_0x1520('0x56')]=_0xe59de1[_0x1520('0x56')]['segmentedMessage'][_0x1520('0x25')];break;case _0x1520('0x89'):_0x20d75a['body'][_0x1520('0x7f')]=_0xe59de1[_0x1520('0x56')][_0x1520('0x8a')];_0x20d75a['body'][_0x1520('0x56')]=_0xe59de1[_0x1520('0x56')]['text'];_0x20d75a['body']['messageId']=_0xe59de1[_0x1520('0x56')][_0x1520('0x8b')];break;case _0x1520('0x8c'):_0x20d75a['body'][_0x1520('0x84')]=_0xe59de1[_0x1520('0x56')][0x0]['message']['id'];_0x20d75a['body'][_0x1520('0x7f')]=_0xe59de1[_0x1520('0x56')][0x0][_0x1520('0x25')][_0x1520('0x7f')];_0x20d75a['body'][_0x1520('0x56')]=_0xe59de1[_0x1520('0x56')][0x0][_0x1520('0x25')][_0x1520('0x80')];break;case'intelepeer':_0x20d75a['body'][_0x1520('0x7f')]=_0xe59de1['body'][_0x1520('0x7f')];_0x20d75a['body'][_0x1520('0x56')]=_0xe59de1[_0x1520('0x56')]['message'];_0x20d75a['body'][_0x1520('0x84')]=_0xe59de1[_0x1520('0x56')][_0x1520('0x8d')];break;}}if(_0x20d75a[_0x1520('0x56')]['id']){delete _0x20d75a['body']['id'];}if(_[_0x1520('0x8e')](_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')])){throw new db[(_0x1520('0x75'))][(_0x1520('0x76'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x20d75a['body'][_0x1520('0x56')])||_0x20d75a[_0x1520('0x56')]['body']===''){throw new db[(_0x1520('0x75'))]['ValidationError'](_0x1520('0x8f'));}if(_[_0x1520('0x8e')](_0x20d75a['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x1520('0x90')+_0x137d69);}if(!_['includes'](_0x137d69,_0x20d75a[_0x1520('0x56')]['mapKey'])){throw new db[(_0x1520('0x75'))]['ValidationError'](_0x1520('0x91')+_0x137d69);}_0x40c9f5[_0x20d75a[_0x1520('0x56')][_0x1520('0x92')]]=_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')];return db[_0x1520('0x93')][_0x1520('0x5a')]({'where':{'id':_0x20d75a[_0x1520('0x70')][_0x1520('0x7b')]},'include':[{'model':db[_0x1520('0x74')],'as':_0x1520('0x94'),'where':_0x40c9f5,'limit':0x1,'order':[['updatedAt',_0x1520('0x95')]]}]});})[_0x1520('0x1d')](handleEntityNotFound(_0x5e7898,null))[_0x1520('0x1d')](function(_0x175aa0){if(_0x175aa0){_0x20d75a[_0x1520('0x96')]=_['omit'](_0x175aa0,['Contacts']);if(_0x175aa0[_0x1520('0x94')][_0x1520('0x47')]){return _0x175aa0[_0x1520('0x94')][0x0];}var _0x3aba0=_[_0x1520('0x16')](_0x20d75a[_0x1520('0x56')],{'firstName':_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')],'ListId':_0x175aa0['id']});_0x3aba0[_0x20d75a[_0x1520('0x56')]['mapKey']]=_0x20d75a['body'][_0x1520('0x7f')];return db[_0x1520('0x74')]['create'](_0x3aba0,{'fields':_0x16fe0b,'raw':!![]});}})[_0x1520('0x1d')](handleEntityNotFound(_0x5e7898,null))['then'](function(_0x4db619){if(_0x4db619){_0x20d75a['contact']=_0x4db619;var _0x13be8b={'ContactId':_0x4db619['id'],'phone':_0x20d75a[_0x1520('0x56')][_0x1520('0x7f')],'SmsAccountId':_0xe59de1[_0x1520('0x52')]['id']};var _0x5d6771={'ContactId':_0x4db619['id'],'SmsAccountId':_0xe59de1[_0x1520('0x52')]['id'],'closed':![]};return db[_0x1520('0x97')]['find']({'where':_0x5d6771})[_0x1520('0x1d')](function(_0x2d3b94){if(_0x2d3b94){return[_0x2d3b94,![]];}return db[_0x1520('0x97')][_0x1520('0x55')](_0x13be8b)['then'](function(_0x238261){return[_0x238261,!![]];});});}})['spread'](function(_0x38d12b,_0x4fa353){_0x20d75a[_0x1520('0x98')]=_0x38d12b['get']({'plain':!![]});_0x20d75a['interaction'][_0x1520('0x99')]=![];if(_0x4fa353){if(_0x20d75a[_0x1520('0x70')][_0x1520('0x9a')]){_0x20d75a[_0x1520('0x9b')][_0x1520('0x9c')]({'id':0x0,'priority':_0x20d75a[_0x1520('0x9b')]['length']+0x1,'app':'close','appdata':_0x1520('0x9d'),'interval':_0x1520('0x9e')});}_0x20d75a[_0x1520('0x98')]['created']=!![];}return db[_0x1520('0x9f')]['create']({'phone':_0x20d75a[_0x1520('0x56')]['from'],'messageId':_0x20d75a[_0x1520('0x56')][_0x1520('0x84')],'body':_0x20d75a[_0x1520('0x56')][_0x1520('0x56')],'SmsAccountId':_0xe59de1[_0x1520('0x52')]['id'],'SmsInteractionId':_0x38d12b['id'],'direction':'in','ContactId':_0x38d12b[_0x1520('0xa0')],'AttachmentId':_0x20d75a['body']['AttachmentId']});})[_0x1520('0x1d')](function(_0x461358){_0x20d75a[_0x1520('0x25')]=_0x461358;if(_0x20d75a[_0x1520('0x98')]['UserId']){return db[_0x1520('0xa1')]['find']({'attributes':['id',_0x1520('0x36')],'where':{'id':_0x20d75a['interaction'][_0x1520('0xa2')]}})[_0x1520('0x1d')](function(_0x3cefb3){if(_0x3cefb3){_0x20d75a[_0x1520('0x9b')][_0x1520('0xa3')]({'id':0x0,'priority':0x0,'app':_0x1520('0xa4'),'appdata':_0x3cefb3[_0x1520('0x36')]+','+(_0x20d75a[_0x1520('0x70')][_0x1520('0xa5')]||0xa),'interval':_0x1520('0x9e')});}return respondWithRpcPromise(_0x1520('0xa6'),_0x1520('0xa7'),_0x20d75a);});}return respondWithRpcPromise(_0x1520('0xa6'),_0x1520('0xa7'),_0x20d75a);})[_0x1520('0x1d')](function(_0x2562c7){if(_0x2562c7){var _0x16cd54=0xc8;var _0x31265d='receiveMessage';logger[_0x1520('0x1e')](_0x1520('0xa8'),_0x31265d,_0x16cd54,_0x1520('0xa9'));logger['debug'](_0x1520('0xaa'),_0x31265d,_0x16cd54,_0x1520('0xa9'),JSON['stringify'](_0x2562c7));if(_0x20d75a[_0x1520('0x70')][_0x1520('0x3e')]===_0x1520('0xab')){return _0x5e7898['status'](_0x16cd54)[_0x1520('0xac')](_0x1520('0xad'),_0x1520('0xae'))[_0x1520('0x37')](_0x1520('0xaf'));}else{return _0x5e7898['status'](_0x16cd54)[_0x1520('0x28')](_0x2562c7);}}})[_0x1520('0x50')](handleError(_0x5e7898,null));};exports[_0x1520('0xb0')]=function(_0x20da97,_0x49de75){var _0x4052dc=_0x20da97['params']['id'];var _0x5de852=_0x20da97[_0x1520('0x56')];var _0x48a4cc=0xc8;var _0x32562a=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x1520('0xb1')][_0x1520('0xb2')][_0x1520('0xb3')][_0x1520('0xb4')]},function(_0xeaa6e9){return db[_0x1520('0x3c')]['findOne']({'where':{'id':_0x4052dc},'transaction':_0xeaa6e9})[_0x1520('0x1d')](function(_0x1e0307){if(_0x1e0307){return db[_0x1520('0x6e')][_0x1520('0x33')]({'where':{'SmsAccountId':_0x4052dc},'transaction':_0xeaa6e9})[_0x1520('0x1d')](function(){var _0x5b1756=_[_0x1520('0x3b')](_0x5de852,function(_0x385ab4){_0x385ab4[_0x1520('0x5f')]=_0x4052dc;return _0x385ab4;});return db[_0x1520('0x6e')][_0x1520('0xb5')](_0x5b1756,{'transaction':_0xeaa6e9});});}else{_0x48a4cc=0x194;_0x32562a=[];}});})[_0x1520('0x1d')](function(){if(_0x48a4cc!==0x194){return db[_0x1520('0x6e')][_0x1520('0xb6')]({'where':{'SmsAccountId':_0x4052dc},'order':_0x1520('0x72')})['then'](function(_0x4158a6){_0x32562a=_0x4158a6;});}})[_0x1520('0x50')](function(_0x67ba4b){_0x48a4cc=0x1f4;logger['error'](_0x67ba4b[_0x1520('0xb7')]);if(_0x67ba4b[_0x1520('0x36')]){delete _0x67ba4b[_0x1520('0x36')];}_0x32562a=_0x67ba4b;})['finally'](function(){if(_0x32562a===null){_0x49de75[_0x1520('0x26')](_0x48a4cc);}else{if(_0x48a4cc===0x1f4){_0x49de75[_0x1520('0x2d')](_0x48a4cc)['send'](_0x32562a);}else{_0x49de75['status'](_0x48a4cc)[_0x1520('0x28')](_0x32562a);}}});};exports[_0x1520('0xb8')]=function(_0x4c32e1,_0xfe92ad,_0xbad6e3){var _0x12feac={};var _0x326ea7={};var _0x2f38e8;var _0x6a1090;return db[_0x1520('0x3c')][_0x1520('0x61')]({'where':{'id':_0x4c32e1['params']['id']}})['then'](handleEntityNotFound(_0xfe92ad,null))['then'](function(_0x285a3f){if(_0x285a3f){_0x2f38e8=_0x285a3f;_0x326ea7[_0x1520('0x40')]=_['keys'](db[_0x1520('0x6e')][_0x1520('0x53')]);_0x326ea7[_0x1520('0x41')]=_[_0x1520('0x42')](_0x4c32e1[_0x1520('0x41')]);_0x326ea7[_0x1520('0x43')]=_['intersection'](_0x326ea7[_0x1520('0x40')],_0x326ea7[_0x1520('0x41')]);_0x12feac[_0x1520('0x45')]=_[_0x1520('0x44')](_0x326ea7[_0x1520('0x40')],qs[_0x1520('0x46')](_0x4c32e1[_0x1520('0x41')]['fields']));_0x12feac[_0x1520('0x45')]=_0x12feac[_0x1520('0x45')][_0x1520('0x47')]?_0x12feac[_0x1520('0x45')]:_0x326ea7[_0x1520('0x40')];_0x12feac['order']=qs[_0x1520('0x48')](_0x4c32e1['query'][_0x1520('0x48')]);_0x12feac['where']=qs[_0x1520('0x43')](_[_0x1520('0x49')](_0x4c32e1[_0x1520('0x41')],_0x326ea7[_0x1520('0x43')]));if(_0x4c32e1[_0x1520('0x41')][_0x1520('0x4a')]){_0x12feac['where']=_['merge'](_0x12feac['where'],{'$or':_['map'](_0x12feac[_0x1520('0x45')],function(_0x11debc){var _0x3c613b={};_0x3c613b[_0x11debc]={'$like':'%'+_0x4c32e1['query'][_0x1520('0x4a')]+'%'};return _0x3c613b;})});}_0x12feac=_[_0x1520('0x4c')]({},_0x12feac,_0x4c32e1[_0x1520('0x4e')]);return _0x2f38e8[_0x1520('0xb8')](_0x12feac);}})[_0x1520('0x1d')](function(_0x5b4069){if(_0x5b4069){_0x6a1090=_0x5b4069[_0x1520('0x47')];if(!_0x4c32e1[_0x1520('0x41')][_0x1520('0x62')](_0x1520('0x69'))){_0x12feac[_0x1520('0x2b')]=qs[_0x1520('0x2b')](_0x4c32e1[_0x1520('0x41')]['limit']);_0x12feac[_0x1520('0x29')]=qs[_0x1520('0x29')](_0x4c32e1[_0x1520('0x41')]['offset']);}return _0x2f38e8['getApplications'](_0x12feac);}})[_0x1520('0x1d')](function(_0x20499c){if(_0x20499c){return _0x20499c?{'count':_0x6a1090,'rows':_0x20499c}:null;}})['then'](respondWithResult(_0xfe92ad,null))[_0x1520('0x50')](handleError(_0xfe92ad,null));};exports[_0x1520('0xb9')]=function(_0x594a23,_0x1cc8a5,_0x57a9d3){var _0x484393={'raw':![],'where':{}};var _0x3abff6={};var _0x590d0a={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1520('0x61')]({'where':{'id':_0x594a23[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x1cc8a5,null))[_0x1520('0x1d')](function(_0x3d6294){if(_0x3d6294){_0x3abff6[_0x1520('0x40')]=_[_0x1520('0x42')](db[_0x1520('0x97')]['rawAttributes']);_0x3abff6['query']=_[_0x1520('0x42')](_0x594a23[_0x1520('0x41')]);_0x3abff6['filters']=_[_0x1520('0x44')](_0x3abff6[_0x1520('0x40')],_0x3abff6[_0x1520('0x41')]);_0x484393[_0x1520('0x45')]=_[_0x1520('0x44')](_0x3abff6[_0x1520('0x40')],qs[_0x1520('0x46')](_0x594a23[_0x1520('0x41')]['fields']));_0x484393[_0x1520('0x45')]=_0x484393[_0x1520('0x45')][_0x1520('0x47')]?_0x484393['attributes']:_0x3abff6['model'];if(!_0x594a23['query'][_0x1520('0x62')](_0x1520('0x69'))){_0x484393[_0x1520('0x2b')]=qs[_0x1520('0x2b')](_0x594a23['query']['limit']);_0x484393[_0x1520('0x29')]=qs[_0x1520('0x29')](_0x594a23[_0x1520('0x41')][_0x1520('0x29')]);}_0x484393[_0x1520('0x63')]=qs[_0x1520('0x48')](_0x594a23['query'][_0x1520('0x48')]);_0x484393['where']=qs['filters'](_[_0x1520('0x49')](_0x594a23[_0x1520('0x41')],_0x3abff6[_0x1520('0x43')]));_0x484393[_0x1520('0x4b')]['SmsAccountId']=_0x3d6294['id'];if(_0x594a23[_0x1520('0x41')][_0x1520('0x4a')]){_0x484393[_0x1520('0x4b')]=_[_0x1520('0x4c')](_0x484393[_0x1520('0x4b')],{'$or':_[_0x1520('0x3b')](_0x484393['attributes'],function(_0x37962e){var _0x38b4e2={};_0x38b4e2[_0x37962e]={'$like':'%'+_0x594a23[_0x1520('0x41')][_0x1520('0x4a')]+'%'};return _0x38b4e2;})});}_0x484393=_[_0x1520('0x4c')]({},_0x484393,_0x594a23[_0x1520('0x4e')]);return db[_0x1520('0x97')][_0x1520('0x2c')]({'where':_0x484393[_0x1520('0x4b')]})[_0x1520('0x1d')](function(_0x39eebe){_0x590d0a[_0x1520('0x2c')]=_0x39eebe;if(_0x594a23['query'][_0x1520('0x54')]){_0x484393['include']=[{'model':db[_0x1520('0x74')],'as':_0x1520('0xba'),'required':![]},{'model':db['User'],'as':_0x1520('0xbb'),'attributes':['name','fullname',_0x1520('0xbc')],'required':![]},{'model':db[_0x1520('0xbd')],'as':'Tags','attributes':['id',_0x1520('0x36'),_0x1520('0xbe')],'where':_0x594a23[_0x1520('0x41')][_0x1520('0xbf')]?{'id':_0x594a23[_0x1520('0x41')][_0x1520('0xbf')]}:undefined,'required':_0x594a23[_0x1520('0x41')][_0x1520('0xbf')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x484393);})[_0x1520('0x1d')](function(_0x37216b){_0x590d0a[_0x1520('0x6a')]=_0x37216b;return _0x590d0a;});}})[_0x1520('0x1d')](respondWithFilteredResult(_0x1cc8a5,_0x484393))[_0x1520('0x50')](handleError(_0x1cc8a5,null));};exports[_0x1520('0x37')]=function(_0x304cf5,_0x2216ac,_0x48fc39){var _0x56d0b7,_0x35aec9,_0x38c3ab;if(_[_0x1520('0x8e')](_0x304cf5[_0x1520('0x56')][_0x1520('0x56')])||_0x304cf5[_0x1520('0x56')][_0x1520('0x56')]===''){throw new db[(_0x1520('0x75'))][(_0x1520('0x76'))](_0x1520('0x8f'));}if(_['isNil'](_0x304cf5[_0x1520('0x56')]['to'])){throw new db[(_0x1520('0x75'))]['ValidationError'](_0x1520('0xc0'));}_0x56d0b7=_0x304cf5[_0x1520('0x56')]['to'];return db[_0x1520('0x3c')][_0x1520('0x5a')]({'where':{'id':_0x304cf5[_0x1520('0x52')]['id']},'include':[{'model':db[_0x1520('0x93')],'as':_0x1520('0xc1'),'include':[{'model':db[_0x1520('0x74')],'as':_0x1520('0x94'),'where':{'mobile':_0x56d0b7},'limit':0x1,'order':[[_0x1520('0x79'),_0x1520('0x95')]]}]}]})['then'](handleEntityNotFound(_0x2216ac,null))[_0x1520('0x1d')](function(_0x2297a8){if(_0x2297a8&&_0x2297a8[_0x1520('0xc1')]){_0x35aec9=_0x2297a8[_0x1520('0x34')]({'plain':!![]});if(_0x35aec9[_0x1520('0xc1')]&&_0x35aec9[_0x1520('0xc1')][_0x1520('0x94')][_0x1520('0x47')]){return _0x35aec9[_0x1520('0xc1')][_0x1520('0x94')][0x0];}return db[_0x1520('0x74')][_0x1520('0x55')](_[_0x1520('0x16')](_0x304cf5[_0x1520('0x56')],{'firstName':_0x56d0b7,'mobile':_0x56d0b7,'phone':_0x56d0b7,'ListId':_0x35aec9[_0x1520('0x7b')]}));}})['then'](handleEntityNotFound(_0x2216ac,null))[_0x1520('0x1d')](function(_0x23ad93){if(_0x23ad93){_0x38c3ab=_0x23ad93;return db[_0x1520('0x97')][_0x1520('0x5a')]({'where':{'ContactId':_0x38c3ab['id'],'closed':![],'SmsAccountId':_0x35aec9['id']}})[_0x1520('0x1d')](function(_0x5e8909){if(_0x5e8909){return[_0x5e8909,![]];}return db['SmsInteraction'][_0x1520('0x55')]({'UserId':_0x304cf5[_0x1520('0x58')]['id'],'ContactId':_0x38c3ab['id'],'SmsAccountId':_0x35aec9['id'],'phone':_0x56d0b7,'firstMsgDirection':_0x1520('0xc2'),'Messages':[_[_0x1520('0x4c')](_0x304cf5['body'],{'read':![],'body':_0x304cf5[_0x1520('0x56')]['body'],'phone':_0x56d0b7,'SmsAccountId':_0x35aec9['id'],'UserId':_0x304cf5['user']['id'],'ContactId':_0x38c3ab['id']})]},{'include':[{'model':db[_0x1520('0x9f')],'as':_0x1520('0xc3')}]})[_0x1520('0x1d')](function(_0x1b00a4){return[_0x1b00a4,!![]];});});}})[_0x1520('0xc4')](function(_0x1ef7e9,_0x12ccac){if(_0x12ccac){return _0x1ef7e9;}return db[_0x1520('0x9f')][_0x1520('0x55')](_['merge'](_0x304cf5[_0x1520('0x56')],{'read':![],'body':_0x304cf5[_0x1520('0x56')]['body'],'phone':_0x56d0b7,'SmsAccountId':_0x35aec9['id'],'SmsInteractionId':_0x1ef7e9['id'],'UserId':_0x304cf5[_0x1520('0x58')]['id'],'ContactId':_0x38c3ab['id']}))['then'](function(_0x3f5757){_0x1ef7e9['dataValues'][_0x1520('0xc3')]=[];_0x1ef7e9['dataValues'][_0x1520('0xc3')][_0x1520('0x9c')](_0x3f5757['dataValues']);return _0x1ef7e9;});})[_0x1520('0x1d')](respondWithResult(_0x2216ac,null))[_0x1520('0x50')](handleError(_0x2216ac,null));};exports[_0x1520('0x2d')]=function(_0x5c3318,_0x50de4d,_0x1ba328){if(_0x5c3318['body']['id']){delete _0x5c3318[_0x1520('0x56')]['id'];}var _0x735abb,_0x3fe79a,_0x184e35;return db['SmsAccount'][_0x1520('0x5a')]({'where':{'id':_0x5c3318['params']['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x50de4d,null))[_0x1520('0x1d')](function(_0x5cf5e7){if(_0x5cf5e7){_0x184e35=_0x5cf5e7;logger[_0x1520('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1520('0x2d'),_0x1520('0xc5'),_0x5cf5e7[_0x1520('0x3e')],util[_0x1520('0xc6')](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));switch(_0x5cf5e7[_0x1520('0x3e')]){case _0x1520('0x7e'):if(_0x5c3318[_0x1520('0x56')]['skebby_dispatch_id']&&_0x5c3318[_0x1520('0x56')][_0x1520('0x2d')]){_0x3fe79a=_0x5c3318[_0x1520('0x56')][_0x1520('0x2d')];return db[_0x1520('0x9f')]['find']({'where':{'messageId':_0x5c3318['body']['skebby_dispatch_id']}});}break;case _0x1520('0x81'):if(_0x5c3318['body']['requestid']&&_0x5c3318[_0x1520('0x56')][_0x1520('0xc7')]){_0x3fe79a=_0x5c3318['body'][_0x1520('0xc7')];return db[_0x1520('0x9f')]['find']({'where':{'messageId':_0x5c3318[_0x1520('0x56')][_0x1520('0xc8')]}});}break;case _0x1520('0x82'):if(_0x5c3318['body'][_0x1520('0x83')]&&_0x5c3318[_0x1520('0x56')][_0x1520('0xc9')]){_0x3fe79a=_0x5c3318[_0x1520('0x56')][_0x1520('0xc9')];return db['SmsMessage']['find']({'where':{'messageId':_0x5c3318[_0x1520('0x56')][_0x1520('0x83')]}});}break;case'infobip':var _0x209569=_0x5c3318[_0x1520('0x56')][_0x1520('0x86')][0x0];if(_0x209569[_0x1520('0x84')]&&_0x209569[_0x1520('0x2d')][_0x1520('0xca')]===_0x1520('0xcb')){_0x3fe79a=_0x209569[_0x1520('0x2d')][_0x1520('0xca')];return db['SmsMessage'][_0x1520('0x5a')]({'where':{'messageId':_0x209569[_0x1520('0x84')]}});}break;case _0x1520('0x89'):if(_0x5c3318[_0x1520('0x56')][_0x1520('0x84')]&&_0x5c3318[_0x1520('0x56')][_0x1520('0x2d')]){_0x3fe79a=_0x5c3318['body'][_0x1520('0x2d')];return db[_0x1520('0x9f')][_0x1520('0x5a')]({'where':{'messageId':_0x5c3318[_0x1520('0x56')][_0x1520('0x84')]}});}break;case _0x1520('0x8c'):if(_0x5c3318[_0x1520('0x56')][0x0][_0x1520('0x25')]['id']){_0x3fe79a=_0x5c3318[_0x1520('0x56')][0x0][_0x1520('0x3e')];return db[_0x1520('0x9f')][_0x1520('0x5a')]({'where':{'messageId':_0x5c3318[_0x1520('0x56')][0x0][_0x1520('0x25')]['id']}});}break;case _0x1520('0xcc'):if(_0x5c3318['body']['redif']&&_0x5c3318[_0x1520('0x56')][_0x1520('0x2d')]){_0x3fe79a=_0x5c3318[_0x1520('0x56')]['status'];return db[_0x1520('0x9f')][_0x1520('0x5a')]({'where':{'messageId':_0x5c3318[_0x1520('0x56')][_0x1520('0xcd')]}});}break;}}})[_0x1520('0x1d')](handleEntityNotFound(_0x50de4d,null))[_0x1520('0x1d')](function(_0x2f1a10){if(_0x2f1a10){_0x735abb=_0x2f1a10;switch(_0x184e35[_0x1520('0x3e')]){case'skebby':if(_0x3fe79a===_0x1520('0xcb')){return _0x735abb[_0x1520('0x32')]({'read':!![]});}else{logger[_0x1520('0x23')](_0x1520('0xa8'),_0x1520('0x2d'),_0x1520('0x7e'),util[_0x1520('0xc6')](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1520('0x81'):if(_0x3fe79a==='1'){return _0x735abb['update']({'read':!![]});}else{logger[_0x1520('0x23')](_0x1520('0xa8'),_0x1520('0x2d'),_0x1520('0x7e'),util[_0x1520('0xc6')](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1520('0x82'):if(!_0x5c3318[_0x1520('0x56')]['error_code']&&_0x3fe79a>=0xc8&&_0x3fe79a<=0xce){return _0x735abb[_0x1520('0x32')]({'read':!![]});}else{logger[_0x1520('0x23')](_0x1520('0xa8'),_0x1520('0x2d'),_0x1520('0x82'),util[_0x1520('0xc6')](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1520('0xce'):var _0x177cf3=_0x5c3318[_0x1520('0x56')][_0x1520('0x86')][0x0];if(_0x177cf3[_0x1520('0x2d')][_0x1520('0xca')]===_0x1520('0xcb')){return _0x735abb[_0x1520('0x32')]({'read':!![]});}else{logger['error'](_0x1520('0xa8'),_0x1520('0x2d'),'infobip',util[_0x1520('0xc6')](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1520('0x89'):if(_0x3fe79a==_0x1520('0xcf')||_0x3fe79a==_0x1520('0xd0')){return _0x735abb[_0x1520('0x32')]({'read':!![]});}else{logger[_0x1520('0x23')](_0x1520('0xa8'),_0x1520('0x2d'),_0x1520('0x89'),util['inspect'](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));}break;case _0x1520('0x8c'):if(_0x3fe79a==_0x1520('0xd1')){return _0x735abb[_0x1520('0x32')]({'read':!![]});}else{logger[_0x1520('0x23')](_0x1520('0xa8'),_0x1520('0x2d'),_0x1520('0x8c'),util['inspect'](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3fe79a==='DELIVRD'||_0x3fe79a===_0x1520('0xd2')){return _0x735abb['update']({'read':!![]});}else{logger['error'](_0x1520('0xa8'),_0x1520('0x2d'),_0x1520('0xcc'),util[_0x1520('0xc6')](_0x5c3318[_0x1520('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x735abb;}})['then'](respondWithResult(_0x50de4d,null))[_0x1520('0x50')](handleError(_0x50de4d,null));};exports[_0x1520('0xd3')]=function(_0x197ba8,_0x2249ae,_0x961fed){var _0x1c4be1,_0x11e910,_0x3835be;return db[_0x1520('0x3c')]['find']({'where':{'id':_0x197ba8[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x2249ae,null))[_0x1520('0x1d')](function(_0x3f8f1e){if(_0x3f8f1e){_0x3835be=_0x3f8f1e;logger[_0x1520('0x21')](_0x1520('0xa8'),_0x1520('0x2d'),_0x1520('0xc5'),_0x3f8f1e['type'],util['inspect'](_0x197ba8[_0x1520('0x41')],{'showHidden':![],'depth':null}));switch(_0x3f8f1e[_0x1520('0x3e')]){case'csc':if(_0x197ba8[_0x1520('0x41')][_0x1520('0xd4')]&&_0x197ba8[_0x1520('0x41')][_0x1520('0xd5')]){_0x11e910=_0x197ba8[_0x1520('0x41')][_0x1520('0xd5')];return db['SmsMessage'][_0x1520('0x5a')]({'where':{'messageId':_0x197ba8[_0x1520('0x41')][_0x1520('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x2249ae,null))[_0x1520('0x1d')](function(_0x20bf93){if(_0x20bf93){_0x1c4be1=_0x20bf93;switch(_0x3835be[_0x1520('0x3e')]){case'csc':if(_0x11e910==='2'||_0x11e910==='6'){return _0x1c4be1['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1520('0x2d'),'csc',util[_0x1520('0xc6')](_0x197ba8[_0x1520('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x1c4be1;}})[_0x1520('0x1d')](respondWithResult(_0x2249ae,null))[_0x1520('0x50')](handleError(_0x2249ae,null));};exports[_0x1520('0xd6')]=function(_0x7f3da5,_0xbec305,_0x1a275a){return db[_0x1520('0x3c')][_0x1520('0x5a')]({'where':{'id':_0x7f3da5['params']['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0xbec305,null))[_0x1520('0x1d')](function(_0x3056f0){if(_0x3056f0){return _0x3056f0[_0x1520('0xd6')](_0x7f3da5[_0x1520('0x56')][_0x1520('0x66')],_['omit'](_0x7f3da5[_0x1520('0x56')],[_0x1520('0x66'),'id'])||{})['spread'](function(_0x38a6b2){for(var _0x2231c7=0x0;_0x2231c7<_0x7f3da5['body'][_0x1520('0x66')][_0x1520('0x47')];_0x2231c7+=0x1){socket[_0x1520('0xd7')](_0x1520('0xd8'),{'UserId':Number(_0x7f3da5[_0x1520('0x56')][_0x1520('0x66')][_0x2231c7]),'SmsAccountId':Number(_0x7f3da5['params']['id'])});}return _0x38a6b2;});}})['then'](respondWithResult(_0xbec305,null))[_0x1520('0x50')](handleError(_0xbec305,null));};exports[_0x1520('0xd9')]=function(_0x28b8f1,_0x14bef1,_0x30fd91){return db[_0x1520('0x3c')][_0x1520('0x5a')]({'where':{'id':_0x28b8f1[_0x1520('0x52')]['id']}})[_0x1520('0x1d')](handleEntityNotFound(_0x14bef1,null))[_0x1520('0x1d')](function(_0x3a0671){if(_0x3a0671){return _0x3a0671['removeAgents'](_0x28b8f1[_0x1520('0x41')]['ids'])['then'](function(){if(_[_0x1520('0xda')](_0x28b8f1[_0x1520('0x41')][_0x1520('0x66')])){for(var _0x14f369=0x0;_0x14f369<_0x28b8f1[_0x1520('0x41')][_0x1520('0x66')][_0x1520('0x47')];_0x14f369+=0x1){socket[_0x1520('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x28b8f1['query']['ids'][_0x14f369]),'SmsAccountId':Number(_0x28b8f1[_0x1520('0x52')]['id'])});}}else{socket['emit'](_0x1520('0xdb'),{'UserId':Number(_0x28b8f1['query']['ids']),'SmsAccountId':Number(_0x28b8f1[_0x1520('0x52')]['id'])});}});}})[_0x1520('0x1d')](respondWithStatusCode(_0x14bef1,null))[_0x1520('0x50')](handleError(_0x14bef1,null));};exports[_0x1520('0xdc')]=function(_0x2c2de5,_0x37b00a,_0x2f9bf9){var _0x21675b={};var _0x46976b={};var _0x78b5e1;var _0x36557e;return db[_0x1520('0x3c')][_0x1520('0x61')]({'where':{'id':_0x2c2de5['params']['id']}})['then'](handleEntityNotFound(_0x37b00a,null))[_0x1520('0x1d')](function(_0x4c9f3e){if(_0x4c9f3e){_0x78b5e1=_0x4c9f3e;_0x46976b[_0x1520('0x40')]=_['keys'](db[_0x1520('0xa1')][_0x1520('0x53')]);_0x46976b[_0x1520('0x41')]=_[_0x1520('0x42')](_0x2c2de5[_0x1520('0x41')]);_0x46976b[_0x1520('0x43')]=_['intersection'](_0x46976b[_0x1520('0x40')],_0x46976b[_0x1520('0x41')]);_0x21675b[_0x1520('0x45')]=_[_0x1520('0x44')](_0x46976b[_0x1520('0x40')],qs[_0x1520('0x46')](_0x2c2de5[_0x1520('0x41')][_0x1520('0x46')]));_0x21675b['attributes']=_0x21675b[_0x1520('0x45')][_0x1520('0x47')]?_0x21675b[_0x1520('0x45')]:_0x46976b[_0x1520('0x40')];_0x21675b[_0x1520('0x63')]=qs[_0x1520('0x48')](_0x2c2de5[_0x1520('0x41')][_0x1520('0x48')]);_0x21675b[_0x1520('0x4b')]=qs[_0x1520('0x43')](_[_0x1520('0x49')](_0x2c2de5[_0x1520('0x41')],_0x46976b[_0x1520('0x43')]));if(_0x2c2de5[_0x1520('0x41')][_0x1520('0x4a')]){_0x21675b['where']=_[_0x1520('0x4c')](_0x21675b[_0x1520('0x4b')],{'$or':_[_0x1520('0x3b')](_0x21675b['attributes'],function(_0x2345aa){var _0x15de4e={};_0x15de4e[_0x2345aa]={'$like':'%'+_0x2c2de5[_0x1520('0x41')][_0x1520('0x4a')]+'%'};return _0x15de4e;})});}_0x21675b=_[_0x1520('0x4c')]({},_0x21675b,_0x2c2de5[_0x1520('0x4e')]);return _0x78b5e1[_0x1520('0xdc')](_0x21675b);}})[_0x1520('0x1d')](function(_0x199b5d){if(_0x199b5d){_0x36557e=_0x199b5d['length'];if(!_0x2c2de5[_0x1520('0x41')][_0x1520('0x62')]('nolimit')){_0x21675b['limit']=qs[_0x1520('0x2b')](_0x2c2de5[_0x1520('0x41')]['limit']);_0x21675b[_0x1520('0x29')]=qs[_0x1520('0x29')](_0x2c2de5[_0x1520('0x41')][_0x1520('0x29')]);}return _0x78b5e1['getAgents'](_0x21675b);}})['then'](function(_0x1e9239){if(_0x1e9239){return _0x1e9239?{'count':_0x36557e,'rows':_0x1e9239}:null;}})[_0x1520('0x1d')](respondWithResult(_0x37b00a,null))[_0x1520('0x50')](handleError(_0x37b00a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5c37cc2..b66e9bb 100644 --- a/server/api/smsAccount/smsAccount.events.js +++ b/server/api/smsAccount/smsAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1232=['hasOwnProperty','exports','events','../../mysqldb','save','emit'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x1232,0xaa));var _0x2123=function(_0x5e33b4,_0x1b619c){_0x5e33b4=_0x5e33b4-0x0;var _0xc81af2=_0x1232[_0x5e33b4];return _0xc81af2;};'use strict';var EventEmitter=require(_0x2123('0x0'));var SmsAccount=require(_0x2123('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2123('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5a67f7){return function(_0x5be5ca,_0x5f1754,_0x3f3994){SmsAccountEvents['emit'](_0x5a67f7+':'+_0x5be5ca['id'],_0x5be5ca);SmsAccountEvents[_0x2123('0x3')](_0x5a67f7,_0x5be5ca);_0x3f3994(null);};}for(var e in events){if(events[_0x2123('0x4')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x2123('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0x95ec=['SmsAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x446e02,_0x27c8e1){var _0x54c862=function(_0x4d5f08){while(--_0x4d5f08){_0x446e02['push'](_0x446e02['shift']());}};_0x54c862(++_0x27c8e1);}(_0x95ec,0x97));var _0xc95e=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x95ec[_0x4ded65];return _0x5864fb;};'use strict';var EventEmitter=require(_0xc95e('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xc95e('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc95e('0x2')](0x0);var events={'afterCreate':_0xc95e('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1cf72e){return function(_0x2145f4,_0x309541,_0x33706e){SmsAccountEvents[_0xc95e('0x4')](_0x1cf72e+':'+_0x2145f4['id'],_0x2145f4);SmsAccountEvents['emit'](_0x1cf72e,_0x2145f4);_0x33706e(null);};}for(var e in events){if(events[_0xc95e('0x5')](e)){var event=events[e];SmsAccount[_0xc95e('0x6')](e,emitEvent(event));}}module[_0xc95e('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 6bb504c..1fef471 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c8c=['./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x4718a7,_0x172e35){var _0x18877e=function(_0x3b9ec6){while(--_0x3b9ec6){_0x4718a7['push'](_0x4718a7['shift']());}};_0x18877e(++_0x172e35);}(_0x8c8c,0x185));var _0xc8c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8c8c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc8c8('0x0'));var util=require(_0xc8c8('0x1'));var logger=require(_0xc8c8('0x2'))(_0xc8c8('0x3'));var moment=require('moment');var BPromise=require(_0xc8c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc8c8('0x5'));var config=require(_0xc8c8('0x6'));var attributes=require(_0xc8c8('0x7'));module[_0xc8c8('0x8')]=function(_0x235f78,_0x5180ce){return _0x235f78[_0xc8c8('0x9')](_0xc8c8('0xa'),attributes,{'tableName':_0xc8c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c5e=['bluebird','path','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util','../../config/logger','moment'];(function(_0x34267a,_0x12ed47){var _0x131e4e=function(_0x165ad6){while(--_0x165ad6){_0x34267a['push'](_0x34267a['shift']());}};_0x131e4e(++_0x12ed47);}(_0x3c5e,0xcd));var _0xe3c5=function(_0x347bb9,_0x5ddc04){_0x347bb9=_0x347bb9-0x0;var _0x142bb0=_0x3c5e[_0x347bb9];return _0x142bb0;};'use strict';var _=require(_0xe3c5('0x0'));var util=require(_0xe3c5('0x1'));var logger=require(_0xe3c5('0x2'))('api');var moment=require(_0xe3c5('0x3'));var BPromise=require(_0xe3c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3c5('0x5'));var rimraf=require('rimraf');var config=require(_0xe3c5('0x6'));var attributes=require(_0xe3c5('0x7'));module[_0xe3c5('0x8')]=function(_0x229aec,_0x4bc65a){return _0x229aec[_0xe3c5('0x9')]('SmsAccount',attributes,{'tableName':_0xe3c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b683b42..129baeb 100644 --- a/server/api/smsAccount/smsAccount.rpc.js +++ b/server/api/smsAccount/smsAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6240=['where','attributes','include','map','model','ShowSmsAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','SmsAccount','find','raw','options'];(function(_0x2585f9,_0x18f23a){var _0x3b6da5=function(_0x58e482){while(--_0x58e482){_0x2585f9['push'](_0x2585f9['shift']());}};_0x3b6da5(++_0x18f23a);}(_0x6240,0x12f));var _0x0624=function(_0x4222e1,_0xc4baf9){_0x4222e1=_0x4222e1-0x0;var _0x239468=_0x6240[_0x4222e1];return _0x239468;};'use strict';var _=require(_0x0624('0x0'));var util=require('util');var moment=require(_0x0624('0x1'));var BPromise=require(_0x0624('0x2'));var rs=require(_0x0624('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0624('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0624('0x5'))(_0x0624('0x6'));var config=require('../../config/environment');var jayson=require(_0x0624('0x7'));var client=jayson['client'][_0x0624('0x8')]({'port':0x232a});config[_0x0624('0x9')]=_[_0x0624('0xa')](config['redis'],{'host':_0x0624('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0624('0x9')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3165c0,_0x3ca132,_0x443366){return new BPromise(function(_0x113545,_0x22327c){return client[_0x0624('0xc')](_0x3165c0,_0x443366)[_0x0624('0xd')](function(_0x55298e){logger[_0x0624('0xe')](_0x0624('0xf'),_0x3ca132,'request\x20sent');logger[_0x0624('0x10')](_0x0624('0x11'),_0x3ca132,_0x0624('0x12'),JSON[_0x0624('0x13')](_0x55298e));if(_0x55298e[_0x0624('0x14')]){if(_0x55298e[_0x0624('0x14')]['code']===0x1f4){logger['error'](_0x0624('0xf'),_0x3ca132,_0x55298e['error'][_0x0624('0x15')]);return _0x22327c(_0x55298e[_0x0624('0x14')][_0x0624('0x15')]);}logger[_0x0624('0x14')](_0x0624('0xf'),_0x3ca132,_0x55298e[_0x0624('0x14')][_0x0624('0x15')]);return _0x113545(_0x55298e[_0x0624('0x14')][_0x0624('0x15')]);}else{logger[_0x0624('0xe')](_0x0624('0xf'),_0x3ca132,_0x0624('0x12'));_0x113545(_0x55298e[_0x0624('0x16')][_0x0624('0x15')]);}})['catch'](function(_0x148c33){logger[_0x0624('0x14')](_0x0624('0xf'),_0x3ca132,_0x148c33);_0x22327c(_0x148c33);});});}exports['ShowSmsAccount']=function(_0x380a6f){var _0x2cee9d=this;return new Promise(function(_0x479aa9,_0x537e7b){return db[_0x0624('0x17')][_0x0624('0x18')]({'raw':_0x380a6f['options']?_0x380a6f['options'][_0x0624('0x19')]===undefined?!![]:![]:!![],'where':_0x380a6f[_0x0624('0x1a')]?_0x380a6f['options'][_0x0624('0x1b')]||null:null,'attributes':_0x380a6f[_0x0624('0x1a')]?_0x380a6f['options'][_0x0624('0x1c')]||null:null,'include':_0x380a6f['options']?_0x380a6f['options'][_0x0624('0x1d')]?_[_0x0624('0x1e')](_0x380a6f['options']['include'],function(_0x5b97be){return{'model':db[_0x5b97be['model']],'as':_0x5b97be['as'],'attributes':_0x5b97be['attributes'],'include':_0x5b97be[_0x0624('0x1d')]?_[_0x0624('0x1e')](_0x5b97be[_0x0624('0x1d')],function(_0x24357a){return{'model':db[_0x24357a[_0x0624('0x1f')]],'as':_0x24357a['as'],'attributes':_0x24357a[_0x0624('0x1c')],'include':_0x24357a[_0x0624('0x1d')]?_[_0x0624('0x1e')](_0x24357a[_0x0624('0x1d')],function(_0x3dbd3a){return{'model':db[_0x3dbd3a[_0x0624('0x1f')]],'as':_0x3dbd3a['as'],'attributes':_0x3dbd3a[_0x0624('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2856c9){logger[_0x0624('0xe')]('ShowSmsAccount',_0x380a6f);logger['debug'](_0x0624('0x20'),_0x380a6f,JSON['stringify'](_0x2856c9));_0x479aa9(_0x2856c9);})['catch'](function(_0x2908dd){logger[_0x0624('0x14')]('ShowSmsAccount',_0x2908dd['message'],_0x380a6f);_0x537e7b(_0x2cee9d[_0x0624('0x14')](0x1f4,_0x2908dd[_0x0624('0x15')]));});});}; \ No newline at end of file +var _0x594e=['request','then','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register'];(function(_0x1d0fac,_0x40578a){var _0x5c03e9=function(_0x57c1a2){while(--_0x57c1a2){_0x1d0fac['push'](_0x1d0fac['shift']());}};_0x5c03e9(++_0x40578a);}(_0x594e,0xff));var _0xe594=function(_0x4da65e,_0x3fbb19){_0x4da65e=_0x4da65e-0x0;var _0x9a0275=_0x594e[_0x4da65e];return _0x9a0275;};'use strict';var _=require(_0xe594('0x0'));var util=require(_0xe594('0x1'));var moment=require('moment');var BPromise=require(_0xe594('0x2'));var rs=require(_0xe594('0x3'));var fs=require('fs');var Redis=require(_0xe594('0x4'));var db=require(_0xe594('0x5'))['db'];var utils=require(_0xe594('0x6'));var logger=require(_0xe594('0x7'))(_0xe594('0x8'));var config=require(_0xe594('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe594('0xa')][_0xe594('0xb')]({'port':0x232a});config['redis']=_[_0xe594('0xc')](config[_0xe594('0xd')],{'host':_0xe594('0xe'),'port':0x18eb});var socket=require(_0xe594('0xf'))(new Redis(config[_0xe594('0xd')]));require(_0xe594('0x10'))[_0xe594('0x11')](socket);function respondWithRpcPromise(_0x39b4aa,_0x252530,_0x2e4a49){return new BPromise(function(_0x89b680,_0x178b36){return client[_0xe594('0x12')](_0x39b4aa,_0x2e4a49)[_0xe594('0x13')](function(_0x564aab){logger[_0xe594('0x14')]('SmsAccount,\x20%s,\x20%s',_0x252530,_0xe594('0x15'));logger[_0xe594('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x252530,_0xe594('0x15'),JSON[_0xe594('0x17')](_0x564aab));if(_0x564aab['error']){if(_0x564aab[_0xe594('0x18')][_0xe594('0x19')]===0x1f4){logger[_0xe594('0x18')](_0xe594('0x1a'),_0x252530,_0x564aab[_0xe594('0x18')][_0xe594('0x1b')]);return _0x178b36(_0x564aab[_0xe594('0x18')][_0xe594('0x1b')]);}logger['error'](_0xe594('0x1a'),_0x252530,_0x564aab[_0xe594('0x18')]['message']);return _0x89b680(_0x564aab[_0xe594('0x18')][_0xe594('0x1b')]);}else{logger['info'](_0xe594('0x1a'),_0x252530,_0xe594('0x15'));_0x89b680(_0x564aab[_0xe594('0x1c')]['message']);}})[_0xe594('0x1d')](function(_0x29b1ee){logger['error'](_0xe594('0x1a'),_0x252530,_0x29b1ee);_0x178b36(_0x29b1ee);});});}exports[_0xe594('0x1e')]=function(_0x484df4){var _0x279b6f=this;return new Promise(function(_0xaafde1,_0x558735){return db[_0xe594('0x1f')]['find']({'raw':_0x484df4[_0xe594('0x20')]?_0x484df4[_0xe594('0x20')][_0xe594('0x21')]===undefined?!![]:![]:!![],'where':_0x484df4[_0xe594('0x20')]?_0x484df4[_0xe594('0x20')][_0xe594('0x22')]||null:null,'attributes':_0x484df4['options']?_0x484df4[_0xe594('0x20')][_0xe594('0x23')]||null:null,'include':_0x484df4[_0xe594('0x20')]?_0x484df4['options'][_0xe594('0x24')]?_['map'](_0x484df4[_0xe594('0x20')][_0xe594('0x24')],function(_0x5d1c16){return{'model':db[_0x5d1c16[_0xe594('0x25')]],'as':_0x5d1c16['as'],'attributes':_0x5d1c16[_0xe594('0x23')],'include':_0x5d1c16[_0xe594('0x24')]?_[_0xe594('0x26')](_0x5d1c16[_0xe594('0x24')],function(_0x6be978){return{'model':db[_0x6be978[_0xe594('0x25')]],'as':_0x6be978['as'],'attributes':_0x6be978[_0xe594('0x23')],'include':_0x6be978[_0xe594('0x24')]?_[_0xe594('0x26')](_0x6be978['include'],function(_0x5934cf){return{'model':db[_0x5934cf['model']],'as':_0x5934cf['as'],'attributes':_0x5934cf[_0xe594('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe594('0x13')](function(_0x5f2a55){logger[_0xe594('0x14')](_0xe594('0x1e'),_0x484df4);logger[_0xe594('0x16')](_0xe594('0x1e'),_0x484df4,JSON['stringify'](_0x5f2a55));_0xaafde1(_0x5f2a55);})[_0xe594('0x1d')](function(_0x164ab0){logger[_0xe594('0x18')](_0xe594('0x1e'),_0x164ab0['message'],_0x484df4);_0x558735(_0x279b6f[_0xe594('0x18')](0x1f4,_0x164ab0[_0xe594('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c975e44..595af56 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 19afdf5..f67cd09 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x3dca15,_0x1e5608){var _0x1329bc=function(_0x5b5588){while(--_0x5b5588){_0x3dca15['push'](_0x3dca15['shift']());}};_0x1329bc(++_0x1e5608);}(_0xe14b,0x93));var _0xbe14=function(_0x2b9d8f,_0x5ec9d2){_0x2b9d8f=_0x2b9d8f-0x0;var _0x17a608=_0xe14b[_0x2b9d8f];return _0x17a608;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4e69b6,_0x2b069f){var _0x3bc2d4=function(_0x3dc13f){while(--_0x3dc13f){_0x4e69b6['push'](_0x4e69b6['shift']());}};_0x3bc2d4(++_0x2b069f);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ba1dc,_0x351436){_0x5ba1dc=_0x5ba1dc-0x0;var _0x5845e7=_0xedd9[_0x5ba1dc];return _0x5845e7;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index e31fd8c..c93106e 100644 --- a/server/api/smsApplication/smsApplication.attributes.js +++ b/server/api/smsApplication/smsApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d81=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x39e5d0,_0x7a4c75){var _0x493984=function(_0x3d6c86){while(--_0x3d6c86){_0x39e5d0['push'](_0x39e5d0['shift']());}};_0x493984(++_0x7a4c75);}(_0x8d81,0xd8));var _0x18d8=function(_0x824fad,_0x269b81){_0x824fad=_0x824fad-0x0;var _0x23cb18=_0x8d81[_0x824fad];return _0x23cb18;};'use strict';var Sequelize=require(_0x18d8('0x0'));module[_0x18d8('0x1')]={'priority':{'type':Sequelize[_0x18d8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x18d8('0x3')],'allowNull':![],'defaultValue':_0x18d8('0x4')},'appdata':{'type':Sequelize[_0x18d8('0x5')]()},'description':{'type':Sequelize[_0x18d8('0x3')]},'interval':{'type':Sequelize[_0x18d8('0x3')],'defaultValue':_0x18d8('0x6')}}; \ No newline at end of file +var _0x460f=['exports','INTEGER','STRING','sequelize'];(function(_0x10edeb,_0x1b93b8){var _0x1c5fea=function(_0x16a1c5){while(--_0x16a1c5){_0x10edeb['push'](_0x10edeb['shift']());}};_0x1c5fea(++_0x1b93b8);}(_0x460f,0x1ab));var _0xf460=function(_0x3ff927,_0x3c90d5){_0x3ff927=_0x3ff927-0x0;var _0x36a48a=_0x460f[_0x3ff927];return _0x36a48a;};'use strict';var Sequelize=require(_0xf460('0x0'));module[_0xf460('0x1')]={'priority':{'type':Sequelize[_0xf460('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf460('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf460('0x3')]},'interval':{'type':Sequelize[_0xf460('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 2d176b2..447d84a 100644 --- a/server/api/smsApplication/smsApplication.controller.js +++ b/server/api/smsApplication/smsApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52c6=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x14990c,_0x4aedd0){var _0x227e75=function(_0x22188b){while(--_0x22188b){_0x14990c['push'](_0x14990c['shift']());}};_0x227e75(++_0x4aedd0);}(_0x52c6,0x1ad));var _0x652c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x52c6[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x652c('0x0'));var zipdir=require(_0x652c('0x1'));var jsonpatch=require(_0x652c('0x2'));var rp=require(_0x652c('0x3'));var moment=require(_0x652c('0x4'));var BPromise=require(_0x652c('0x5'));var Mustache=require(_0x652c('0x6'));var util=require(_0x652c('0x7'));var path=require(_0x652c('0x8'));var sox=require(_0x652c('0x9'));var csv=require(_0x652c('0xa'));var ejs=require(_0x652c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x652c('0xc'));var squel=require(_0x652c('0xd'));var crypto=require(_0x652c('0xe'));var jsforce=require(_0x652c('0xf'));var deskjs=require(_0x652c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x652c('0x11'));var Papa=require(_0x652c('0x12'));var Redis=require('ioredis');var authService=require(_0x652c('0x13'));var qs=require(_0x652c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x652c('0x15'));var logger=require(_0x652c('0x16'))(_0x652c('0x17'));var utils=require(_0x652c('0x18'));var config=require(_0x652c('0x19'));var licenseUtil=require(_0x652c('0x1a'));var db=require(_0x652c('0x1b'))['db'];function respondWithStatusCode(_0x28248e,_0x9ed338){_0x9ed338=_0x9ed338||0xcc;return function(_0x9c3a4){if(_0x9c3a4){return _0x28248e['sendStatus'](_0x9ed338);}return _0x28248e[_0x652c('0x1c')](_0x9ed338)[_0x652c('0x1d')]();};}function respondWithResult(_0x358ff5,_0x456b6d){_0x456b6d=_0x456b6d||0xc8;return function(_0x584e99){if(_0x584e99){return _0x358ff5[_0x652c('0x1c')](_0x456b6d)[_0x652c('0x1e')](_0x584e99);}};}function respondWithFilteredResult(_0x38349e,_0x1438d0){return function(_0x28b6fc){if(_0x28b6fc){var _0x3e2811=typeof _0x1438d0[_0x652c('0x1f')]===_0x652c('0x20')&&typeof _0x1438d0['limit']===_0x652c('0x20');var _0x1aec8b=_0x28b6fc['count'];var _0x114639=_0x3e2811?0x0:_0x1438d0['offset'];var _0x1067ae=_0x3e2811?_0x28b6fc[_0x652c('0x21')]:_0x1438d0[_0x652c('0x1f')]+_0x1438d0[_0x652c('0x22')];var _0x479041;if(_0x1067ae>=_0x1aec8b){_0x1067ae=_0x1aec8b;_0x479041=0xc8;}else{_0x479041=0xce;}_0x38349e[_0x652c('0x1c')](_0x479041);return _0x38349e[_0x652c('0x23')]('Content-Range',_0x114639+'-'+_0x1067ae+'/'+_0x1aec8b)[_0x652c('0x1e')](_0x28b6fc);}return null;};}function patchUpdates(_0x375bb9){return function(_0x18d2ed){try{jsonpatch[_0x652c('0x24')](_0x18d2ed,_0x375bb9,!![]);}catch(_0x1fb024){return BPromise[_0x652c('0x25')](_0x1fb024);}return _0x18d2ed['save']();};}function saveUpdates(_0x50999c,_0x3a7e50){return function(_0x388b74){if(_0x388b74){return _0x388b74[_0x652c('0x26')](_0x50999c)[_0x652c('0x27')](function(_0x1c8e71){return _0x1c8e71;});}return null;};}function removeEntity(_0x615207,_0x45c9eb){return function(_0x3b6571){if(_0x3b6571){return _0x3b6571[_0x652c('0x28')]()[_0x652c('0x27')](function(){_0x615207[_0x652c('0x1c')](0xcc)[_0x652c('0x1d')]();});}};}function handleEntityNotFound(_0x592113,_0x440cb3){return function(_0x5deb2e){if(!_0x5deb2e){_0x592113['sendStatus'](0x194);}return _0x5deb2e;};}function handleError(_0x2c99b6,_0x2f7dcb){_0x2f7dcb=_0x2f7dcb||0x1f4;return function(_0x4a7870){logger['error'](_0x4a7870[_0x652c('0x29')]);if(_0x4a7870[_0x652c('0x2a')]){delete _0x4a7870[_0x652c('0x2a')];}_0x2c99b6[_0x652c('0x1c')](_0x2f7dcb)['send'](_0x4a7870);};}exports[_0x652c('0x2b')]=function(_0x25e553,_0x898869){var _0x40cb57={},_0x40a90={},_0x1caf78={'count':0x0,'rows':[]};var _0xc4432e=_[_0x652c('0x2c')](db[_0x652c('0x2d')][_0x652c('0x2e')],function(_0x527709){return{'name':_0x527709[_0x652c('0x2f')],'type':_0x527709[_0x652c('0x30')][_0x652c('0x31')]};});_0x40a90['model']=_['map'](_0xc4432e,_0x652c('0x2a'));_0x40a90['query']=_['keys'](_0x25e553[_0x652c('0x32')]);_0x40a90[_0x652c('0x33')]=_[_0x652c('0x34')](_0x40a90[_0x652c('0x35')],_0x40a90['query']);_0x40cb57['attributes']=_[_0x652c('0x34')](_0x40a90[_0x652c('0x35')],qs['fields'](_0x25e553[_0x652c('0x32')][_0x652c('0x36')]));_0x40cb57['attributes']=_0x40cb57[_0x652c('0x37')][_0x652c('0x38')]?_0x40cb57[_0x652c('0x37')]:_0x40a90['model'];if(!_0x25e553[_0x652c('0x32')]['hasOwnProperty'](_0x652c('0x39'))){_0x40cb57[_0x652c('0x22')]=qs[_0x652c('0x22')](_0x25e553['query'][_0x652c('0x22')]);_0x40cb57[_0x652c('0x1f')]=qs[_0x652c('0x1f')](_0x25e553[_0x652c('0x32')][_0x652c('0x1f')]);}_0x40cb57[_0x652c('0x3a')]=qs[_0x652c('0x3b')](_0x25e553[_0x652c('0x32')][_0x652c('0x3b')]);_0x40cb57[_0x652c('0x3c')]=qs[_0x652c('0x33')](_['pick'](_0x25e553[_0x652c('0x32')],_0x40a90[_0x652c('0x33')]),_0xc4432e);if(_0x25e553[_0x652c('0x32')][_0x652c('0x3d')]){_0x40cb57[_0x652c('0x3c')]=_['merge'](_0x40cb57['where'],{'$or':_[_0x652c('0x2c')](_0xc4432e,function(_0x136c05){if(_0x136c05[_0x652c('0x30')]!==_0x652c('0x3e')){var _0x16a413={};_0x16a413[_0x136c05[_0x652c('0x2a')]]={'$like':'%'+_0x25e553['query']['filter']+'%'};return _0x16a413;}})});}_0x40cb57=_[_0x652c('0x3f')]({},_0x40cb57,_0x25e553[_0x652c('0x40')]);var _0x2c14b6={'where':_0x40cb57[_0x652c('0x3c')]};return db[_0x652c('0x2d')][_0x652c('0x21')](_0x2c14b6)[_0x652c('0x27')](function(_0x1860ca){_0x1caf78[_0x652c('0x21')]=_0x1860ca;if(_0x25e553[_0x652c('0x32')][_0x652c('0x41')]){_0x40cb57[_0x652c('0x42')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x40cb57);})[_0x652c('0x27')](function(_0x34af9e){_0x1caf78[_0x652c('0x43')]=_0x34af9e;return _0x1caf78;})[_0x652c('0x27')](respondWithFilteredResult(_0x898869,_0x40cb57))[_0x652c('0x44')](handleError(_0x898869,null));};exports[_0x652c('0x45')]=function(_0x4c4ad8,_0x15c661){var _0x3264d9={'raw':!![],'where':{'id':_0x4c4ad8[_0x652c('0x46')]['id']}},_0x413609={};_0x413609[_0x652c('0x35')]=_[_0x652c('0x47')](db['SmsApplication'][_0x652c('0x2e')]);_0x413609[_0x652c('0x32')]=_[_0x652c('0x47')](_0x4c4ad8[_0x652c('0x32')]);_0x413609[_0x652c('0x33')]=_[_0x652c('0x34')](_0x413609[_0x652c('0x35')],_0x413609[_0x652c('0x32')]);_0x3264d9[_0x652c('0x37')]=_['intersection'](_0x413609['model'],qs[_0x652c('0x36')](_0x4c4ad8[_0x652c('0x32')][_0x652c('0x36')]));_0x3264d9['attributes']=_0x3264d9[_0x652c('0x37')][_0x652c('0x38')]?_0x3264d9[_0x652c('0x37')]:_0x413609[_0x652c('0x35')];if(_0x4c4ad8[_0x652c('0x32')][_0x652c('0x41')]){_0x3264d9[_0x652c('0x42')]=[{'all':!![]}];}_0x3264d9=_[_0x652c('0x3f')]({},_0x3264d9,_0x4c4ad8[_0x652c('0x40')]);return db[_0x652c('0x2d')]['find'](_0x3264d9)['then'](handleEntityNotFound(_0x15c661,null))['then'](respondWithResult(_0x15c661,null))[_0x652c('0x44')](handleError(_0x15c661,null));};exports['create']=function(_0x230896,_0x2d4473){return db[_0x652c('0x2d')]['create'](_0x230896[_0x652c('0x48')],{})[_0x652c('0x27')](respondWithResult(_0x2d4473,0xc9))[_0x652c('0x44')](handleError(_0x2d4473,null));};exports['update']=function(_0x2b79a6,_0x33d15e){if(_0x2b79a6['body']['id']){delete _0x2b79a6['body']['id'];}return db[_0x652c('0x2d')]['find']({'where':{'id':_0x2b79a6[_0x652c('0x46')]['id']}})[_0x652c('0x27')](handleEntityNotFound(_0x33d15e,null))[_0x652c('0x27')](saveUpdates(_0x2b79a6['body'],null))[_0x652c('0x27')](respondWithResult(_0x33d15e,null))[_0x652c('0x44')](handleError(_0x33d15e,null));};exports[_0x652c('0x28')]=function(_0x1d940b,_0x22b744){return db['SmsApplication'][_0x652c('0x49')]({'where':{'id':_0x1d940b[_0x652c('0x46')]['id']}})[_0x652c('0x27')](handleEntityNotFound(_0x22b744,null))[_0x652c('0x27')](removeEntity(_0x22b744,null))[_0x652c('0x44')](handleError(_0x22b744,null));}; \ No newline at end of file +var _0xb902=['key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type'];(function(_0x58d092,_0x36a559){var _0xe2d411=function(_0x3b3c34){while(--_0x3b3c34){_0x58d092['push'](_0x58d092['shift']());}};_0xe2d411(++_0x36a559);}(_0xb902,0x144));var _0x2b90=function(_0x4d41b3,_0x431a8d){_0x4d41b3=_0x4d41b3-0x0;var _0xebc234=_0xb902[_0x4d41b3];return _0xebc234;};'use strict';var emlformat=require(_0x2b90('0x0'));var rimraf=require(_0x2b90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b90('0x2'));var rp=require(_0x2b90('0x3'));var moment=require(_0x2b90('0x4'));var BPromise=require(_0x2b90('0x5'));var Mustache=require(_0x2b90('0x6'));var util=require(_0x2b90('0x7'));var path=require(_0x2b90('0x8'));var sox=require(_0x2b90('0x9'));var csv=require('to-csv');var ejs=require(_0x2b90('0xa'));var fs=require('fs');var fs_extra=require(_0x2b90('0xb'));var _=require(_0x2b90('0xc'));var squel=require(_0x2b90('0xd'));var crypto=require(_0x2b90('0xe'));var jsforce=require(_0x2b90('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b90('0x10'));var Papa=require(_0x2b90('0x11'));var Redis=require(_0x2b90('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2b90('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b90('0x14'));var logger=require(_0x2b90('0x15'))('api');var utils=require(_0x2b90('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2b90('0x17'));var db=require(_0x2b90('0x18'))['db'];function respondWithStatusCode(_0x167206,_0x4312f2){_0x4312f2=_0x4312f2||0xcc;return function(_0x43c524){if(_0x43c524){return _0x167206['sendStatus'](_0x4312f2);}return _0x167206['status'](_0x4312f2)['end']();};}function respondWithResult(_0xaa2325,_0x4ec0f4){_0x4ec0f4=_0x4ec0f4||0xc8;return function(_0x3eefca){if(_0x3eefca){return _0xaa2325[_0x2b90('0x19')](_0x4ec0f4)['json'](_0x3eefca);}};}function respondWithFilteredResult(_0x2f19c8,_0x499cc6){return function(_0x5a8a07){if(_0x5a8a07){var _0x37f125=typeof _0x499cc6[_0x2b90('0x1a')]===_0x2b90('0x1b')&&typeof _0x499cc6['limit']===_0x2b90('0x1b');var _0x2b2dff=_0x5a8a07['count'];var _0x2a5714=_0x37f125?0x0:_0x499cc6['offset'];var _0x339507=_0x37f125?_0x5a8a07[_0x2b90('0x1c')]:_0x499cc6[_0x2b90('0x1a')]+_0x499cc6[_0x2b90('0x1d')];var _0x379cb3;if(_0x339507>=_0x2b2dff){_0x339507=_0x2b2dff;_0x379cb3=0xc8;}else{_0x379cb3=0xce;}_0x2f19c8['status'](_0x379cb3);return _0x2f19c8[_0x2b90('0x1e')](_0x2b90('0x1f'),_0x2a5714+'-'+_0x339507+'/'+_0x2b2dff)[_0x2b90('0x20')](_0x5a8a07);}return null;};}function patchUpdates(_0x575ffc){return function(_0x25ef34){try{jsonpatch[_0x2b90('0x21')](_0x25ef34,_0x575ffc,!![]);}catch(_0x4afec6){return BPromise[_0x2b90('0x22')](_0x4afec6);}return _0x25ef34[_0x2b90('0x23')]();};}function saveUpdates(_0x149dc5,_0x48e5d){return function(_0x2d37fe){if(_0x2d37fe){return _0x2d37fe[_0x2b90('0x24')](_0x149dc5)['then'](function(_0x35721b){return _0x35721b;});}return null;};}function removeEntity(_0x42c0eb,_0x96fec0){return function(_0x75b9ae){if(_0x75b9ae){return _0x75b9ae[_0x2b90('0x25')]()[_0x2b90('0x26')](function(){_0x42c0eb[_0x2b90('0x19')](0xcc)[_0x2b90('0x27')]();});}};}function handleEntityNotFound(_0x4c0f07,_0x32a37a){return function(_0x432725){if(!_0x432725){_0x4c0f07[_0x2b90('0x28')](0x194);}return _0x432725;};}function handleError(_0x4e4113,_0x513d8c){_0x513d8c=_0x513d8c||0x1f4;return function(_0x5b41e0){logger[_0x2b90('0x29')](_0x5b41e0[_0x2b90('0x2a')]);if(_0x5b41e0['name']){delete _0x5b41e0[_0x2b90('0x2b')];}_0x4e4113['status'](_0x513d8c)[_0x2b90('0x2c')](_0x5b41e0);};}exports[_0x2b90('0x2d')]=function(_0x1e7436,_0x63e65f){var _0x8511a0={},_0x2789da={},_0x4400cb={'count':0x0,'rows':[]};var _0xf59d4d=_[_0x2b90('0x2e')](db[_0x2b90('0x2f')][_0x2b90('0x30')],function(_0x4e2970){return{'name':_0x4e2970[_0x2b90('0x31')],'type':_0x4e2970[_0x2b90('0x32')][_0x2b90('0x33')]};});_0x2789da['model']=_[_0x2b90('0x2e')](_0xf59d4d,_0x2b90('0x2b'));_0x2789da[_0x2b90('0x34')]=_[_0x2b90('0x35')](_0x1e7436[_0x2b90('0x34')]);_0x2789da[_0x2b90('0x36')]=_[_0x2b90('0x37')](_0x2789da[_0x2b90('0x38')],_0x2789da[_0x2b90('0x34')]);_0x8511a0['attributes']=_['intersection'](_0x2789da[_0x2b90('0x38')],qs[_0x2b90('0x39')](_0x1e7436[_0x2b90('0x34')]['fields']));_0x8511a0[_0x2b90('0x3a')]=_0x8511a0['attributes']['length']?_0x8511a0[_0x2b90('0x3a')]:_0x2789da[_0x2b90('0x38')];if(!_0x1e7436[_0x2b90('0x34')][_0x2b90('0x3b')]('nolimit')){_0x8511a0[_0x2b90('0x1d')]=qs[_0x2b90('0x1d')](_0x1e7436[_0x2b90('0x34')][_0x2b90('0x1d')]);_0x8511a0[_0x2b90('0x1a')]=qs[_0x2b90('0x1a')](_0x1e7436['query'][_0x2b90('0x1a')]);}_0x8511a0[_0x2b90('0x3c')]=qs['sort'](_0x1e7436[_0x2b90('0x34')]['sort']);_0x8511a0[_0x2b90('0x3d')]=qs[_0x2b90('0x36')](_[_0x2b90('0x3e')](_0x1e7436[_0x2b90('0x34')],_0x2789da[_0x2b90('0x36')]),_0xf59d4d);if(_0x1e7436[_0x2b90('0x34')][_0x2b90('0x3f')]){_0x8511a0[_0x2b90('0x3d')]=_[_0x2b90('0x40')](_0x8511a0[_0x2b90('0x3d')],{'$or':_[_0x2b90('0x2e')](_0xf59d4d,function(_0x2689b8){if(_0x2689b8[_0x2b90('0x32')]!==_0x2b90('0x41')){var _0x48ae72={};_0x48ae72[_0x2689b8[_0x2b90('0x2b')]]={'$like':'%'+_0x1e7436['query'][_0x2b90('0x3f')]+'%'};return _0x48ae72;}})});}_0x8511a0=_['merge']({},_0x8511a0,_0x1e7436['options']);var _0x52f910={'where':_0x8511a0[_0x2b90('0x3d')]};return db[_0x2b90('0x2f')][_0x2b90('0x1c')](_0x52f910)[_0x2b90('0x26')](function(_0x226a76){_0x4400cb[_0x2b90('0x1c')]=_0x226a76;if(_0x1e7436[_0x2b90('0x34')][_0x2b90('0x42')]){_0x8511a0[_0x2b90('0x43')]=[{'all':!![]}];}return db[_0x2b90('0x2f')][_0x2b90('0x44')](_0x8511a0);})[_0x2b90('0x26')](function(_0x2cb372){_0x4400cb['rows']=_0x2cb372;return _0x4400cb;})[_0x2b90('0x26')](respondWithFilteredResult(_0x63e65f,_0x8511a0))[_0x2b90('0x45')](handleError(_0x63e65f,null));};exports['show']=function(_0x260450,_0x2f32a3){var _0xc9a174={'raw':!![],'where':{'id':_0x260450[_0x2b90('0x46')]['id']}},_0x131e52={};_0x131e52['model']=_[_0x2b90('0x35')](db[_0x2b90('0x2f')][_0x2b90('0x30')]);_0x131e52['query']=_[_0x2b90('0x35')](_0x260450['query']);_0x131e52[_0x2b90('0x36')]=_['intersection'](_0x131e52[_0x2b90('0x38')],_0x131e52[_0x2b90('0x34')]);_0xc9a174[_0x2b90('0x3a')]=_[_0x2b90('0x37')](_0x131e52[_0x2b90('0x38')],qs[_0x2b90('0x39')](_0x260450[_0x2b90('0x34')]['fields']));_0xc9a174['attributes']=_0xc9a174['attributes']['length']?_0xc9a174[_0x2b90('0x3a')]:_0x131e52['model'];if(_0x260450[_0x2b90('0x34')][_0x2b90('0x42')]){_0xc9a174[_0x2b90('0x43')]=[{'all':!![]}];}_0xc9a174=_[_0x2b90('0x40')]({},_0xc9a174,_0x260450[_0x2b90('0x47')]);return db[_0x2b90('0x2f')]['find'](_0xc9a174)['then'](handleEntityNotFound(_0x2f32a3,null))['then'](respondWithResult(_0x2f32a3,null))[_0x2b90('0x45')](handleError(_0x2f32a3,null));};exports[_0x2b90('0x48')]=function(_0x29bc09,_0xa0bde4){return db[_0x2b90('0x2f')][_0x2b90('0x48')](_0x29bc09[_0x2b90('0x49')],{})[_0x2b90('0x26')](respondWithResult(_0xa0bde4,0xc9))[_0x2b90('0x45')](handleError(_0xa0bde4,null));};exports[_0x2b90('0x24')]=function(_0x358f6f,_0x5a6efd){if(_0x358f6f[_0x2b90('0x49')]['id']){delete _0x358f6f[_0x2b90('0x49')]['id'];}return db[_0x2b90('0x2f')][_0x2b90('0x4a')]({'where':{'id':_0x358f6f['params']['id']}})['then'](handleEntityNotFound(_0x5a6efd,null))[_0x2b90('0x26')](saveUpdates(_0x358f6f[_0x2b90('0x49')],null))[_0x2b90('0x26')](respondWithResult(_0x5a6efd,null))[_0x2b90('0x45')](handleError(_0x5a6efd,null));};exports[_0x2b90('0x25')]=function(_0x1ca830,_0x367914){return db[_0x2b90('0x2f')][_0x2b90('0x4a')]({'where':{'id':_0x1ca830[_0x2b90('0x46')]['id']}})[_0x2b90('0x26')](handleEntityNotFound(_0x367914,null))[_0x2b90('0x26')](removeEntity(_0x367914,null))['catch'](handleError(_0x367914,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 48c78c9..f5eb675 100644 --- a/server/api/smsApplication/smsApplication.model.js +++ b/server/api/smsApplication/smsApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20ae=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0x20ae,0x120));var _0xe20a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x20ae[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xe20a('0x0'));var util=require(_0xe20a('0x1'));var logger=require('../../config/logger')(_0xe20a('0x2'));var moment=require('moment');var BPromise=require(_0xe20a('0x3'));var rp=require(_0xe20a('0x4'));var fs=require('fs');var path=require(_0xe20a('0x5'));var rimraf=require(_0xe20a('0x6'));var config=require(_0xe20a('0x7'));var attributes=require(_0xe20a('0x8'));module['exports']=function(_0x23a94c,_0x22ca01){return _0x23a94c['define'](_0xe20a('0x9'),attributes,{'tableName':_0xe20a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe20a('0xb'),'collate':_0xe20a('0xc')});}; \ No newline at end of file +var _0xb0d9=['SmsApplication','sms_applications','utf8mb4','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x1ad7fc,_0x444145){var _0x3bb433=function(_0x1e27ef){while(--_0x1e27ef){_0x1ad7fc['push'](_0x1ad7fc['shift']());}};_0x3bb433(++_0x444145);}(_0xb0d9,0x78));var _0x9b0d=function(_0xe01e53,_0x30ef5d){_0xe01e53=_0xe01e53-0x0;var _0x2d8b2d=_0xb0d9[_0xe01e53];return _0x2d8b2d;};'use strict';var _=require(_0x9b0d('0x0'));var util=require('util');var logger=require(_0x9b0d('0x1'))(_0x9b0d('0x2'));var moment=require(_0x9b0d('0x3'));var BPromise=require('bluebird');var rp=require(_0x9b0d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b0d('0x5'));var config=require(_0x9b0d('0x6'));var attributes=require(_0x9b0d('0x7'));module[_0x9b0d('0x8')]=function(_0x156945,_0x4f4bff){return _0x156945[_0x9b0d('0x9')](_0x9b0d('0xa'),attributes,{'tableName':_0x9b0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b0d('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 98b2042..c458b58 100644 --- a/server/api/smsApplication/smsApplication.rpc.js +++ b/server/api/smsApplication/smsApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x161a=['moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x69de29,_0x3111b0){var _0x430da6=function(_0x391d52){while(--_0x391d52){_0x69de29['push'](_0x69de29['shift']());}};_0x430da6(++_0x3111b0);}(_0x161a,0x140));var _0xa161=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x161a[_0x13992d];return _0x3d15bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa161('0x0'));var BPromise=require(_0xa161('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa161('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa161('0x3'));var logger=require(_0xa161('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa161('0x5'));var client=jayson[_0xa161('0x6')][_0xa161('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8a253b,_0x264bd0,_0x28aaf5){return new BPromise(function(_0x3fa9e2,_0x48a7c2){return client[_0xa161('0x8')](_0x8a253b,_0x28aaf5)[_0xa161('0x9')](function(_0x327221){logger[_0xa161('0xa')](_0xa161('0xb'),_0x264bd0,_0xa161('0xc'));logger[_0xa161('0xd')](_0xa161('0xe'),_0x264bd0,_0xa161('0xc'),JSON[_0xa161('0xf')](_0x327221));if(_0x327221[_0xa161('0x10')]){if(_0x327221[_0xa161('0x10')][_0xa161('0x11')]===0x1f4){logger['error'](_0xa161('0xb'),_0x264bd0,_0x327221[_0xa161('0x10')][_0xa161('0x12')]);return _0x48a7c2(_0x327221[_0xa161('0x10')]['message']);}logger[_0xa161('0x10')](_0xa161('0xb'),_0x264bd0,_0x327221['error'][_0xa161('0x12')]);return _0x3fa9e2(_0x327221[_0xa161('0x10')]['message']);}else{logger[_0xa161('0xa')](_0xa161('0xb'),_0x264bd0,_0xa161('0xc'));_0x3fa9e2(_0x327221['result'][_0xa161('0x12')]);}})[_0xa161('0x13')](function(_0x27b79f){logger[_0xa161('0x10')](_0xa161('0xb'),_0x264bd0,_0x27b79f);_0x48a7c2(_0x27b79f);});});} \ No newline at end of file +var _0xa5c1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x341902,_0x1329e1){_0x341902=_0x341902-0x0;var _0x5033ae=_0xa5c1[_0x341902];return _0x5033ae;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var moment=require(_0x1a5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a5c('0x4'));var logger=require(_0x1a5c('0x5'))(_0x1a5c('0x6'));var config=require(_0x1a5c('0x7'));var jayson=require(_0x1a5c('0x8'));var client=jayson[_0x1a5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9853,_0x580a2e,_0x438f8f){return new BPromise(function(_0x43a2ed,_0x1702ce){return client['request'](_0x9853,_0x438f8f)[_0x1a5c('0xa')](function(_0x4c0bd2){logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x580a2e,'request\x20sent',JSON[_0x1a5c('0xf')](_0x4c0bd2));if(_0x4c0bd2[_0x1a5c('0x10')]){if(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x11')]===0x1f4){logger[_0x1a5c('0x10')](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x1702ce(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}logger['error'](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x43a2ed(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}else{logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');_0x43a2ed(_0x4c0bd2[_0x1a5c('0x13')]['message']);}})[_0x1a5c('0x14')](function(_0x44648a){logger[_0x1a5c('0x10')]('SmsApplication,\x20%s,\x20%s',_0x580a2e,_0x44648a);_0x1702ce(_0x44648a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index ff349d5..4bb26b7 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x4d94a4,_0x3e6dba){var _0x5f31e3=function(_0x5bd0d1){while(--_0x5bd0d1){_0x4d94a4['push'](_0x4d94a4['shift']());}};_0x5f31e3(++_0x3e6dba);}(_0x7708,0x188));var _0x8770=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7708[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file +var _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x17c3dd,_0x2b2eff){var _0x3c1fd6=function(_0x2241e5){while(--_0x2241e5){_0x17c3dd['push'](_0x17c3dd['shift']());}};_0x3c1fd6(++_0x2b2eff);}(_0xea28,0x13a));var _0x8ea2=function(_0x35a00b,_0x5b2ba9){_0x35a00b=_0x35a00b-0x0;var _0x4193aa=_0xea28[_0x35a00b];return _0x4193aa;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 39b387d..44e09a6 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb8b=['STRING','DATE','ENUM','out','moment','exports','BOOLEAN'];(function(_0x463038,_0x909586){var _0x2fe185=function(_0x2f1c49){while(--_0x2f1c49){_0x463038['push'](_0x463038['shift']());}};_0x2fe185(++_0x909586);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x107a13,_0x89c753){_0x107a13=_0x107a13-0x0;var _0x5a3e44=_0xdb8b[_0x107a13];return _0x5a3e44;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbdb8('0x0'));module[_0xbdb8('0x1')]={'closed':{'type':Sequelize[_0xbdb8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbdb8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbdb8('0x3')]},'phone':{'type':Sequelize[_0xbdb8('0x3')]},'read1stAt':{'type':Sequelize[_0xbdb8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xbdb8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbdb8('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbdb8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbdb8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8ef6=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x3425d2,_0x26fa24){var _0x4feaef=function(_0x3181e0){while(--_0x3181e0){_0x3425d2['push'](_0x3425d2['shift']());}};_0x4feaef(++_0x26fa24);}(_0x8ef6,0xf2));var _0x68ef=function(_0x442dfb,_0xdb0b34){_0x442dfb=_0x442dfb-0x0;var _0x46aae3=_0x8ef6[_0x442dfb];return _0x46aae3;};'use strict';var Sequelize=require(_0x68ef('0x0'));var moment=require(_0x68ef('0x1'));module[_0x68ef('0x2')]={'closed':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x68ef('0x4')]},'disposition':{'type':Sequelize[_0x68ef('0x5')]},'secondDisposition':{'type':Sequelize[_0x68ef('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x68ef('0x5')]},'phone':{'type':Sequelize[_0x68ef('0x5')]},'read1stAt':{'type':Sequelize[_0x68ef('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x68ef('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x68ef('0x6')]('in',_0x68ef('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x68ef('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 006b9e4..7dab367 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6df0=['YYYY-MM-DD\x20HH:mm:ss','options','rows','setTags','omit','spread','Tag','findAll','color','emit','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','fullname','createdAt','closed','closedAt','map','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','offset','limit','count','set','json','update','then','destroy','error','stack','name','SmsInteraction','rawAttributes','key','getOptions','catch','keys','query','filters','model','attributes','fields','includeAll','include','find','create','body','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','merge','split','format'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6df0,0xaa));var _0x06df=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x6df0[_0x3b150c];return _0x5cd414;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x06df('0x0'));var moment=require('moment');var BPromise=require(_0x06df('0x1'));var util=require(_0x06df('0x2'));var path=require(_0x06df('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x06df('0x4'));var Redis=require(_0x06df('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x06df('0x6'));var pdf=require(_0x06df('0x7'));var logger=require(_0x06df('0x8'))(_0x06df('0x9'));var config=require(_0x06df('0xa'));var db=require(_0x06df('0xb'))['db'];config[_0x06df('0xc')]=_[_0x06df('0xd')](config[_0x06df('0xc')],{'host':_0x06df('0xe'),'port':0x18eb});var socket=require(_0x06df('0xf'))(new Redis(config[_0x06df('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x19af86,_0x38e0ac){_0x38e0ac=_0x38e0ac||0xcc;return function(_0x16fe2f){if(_0x16fe2f){return _0x19af86[_0x06df('0x10')](_0x38e0ac);}return _0x19af86['status'](_0x38e0ac)[_0x06df('0x11')]();};}function respondWithResult(_0x267d50,_0x16b2df){_0x16b2df=_0x16b2df||0xc8;return function(_0x158a81){if(_0x158a81){return _0x267d50[_0x06df('0x12')](_0x16b2df)['json'](_0x158a81);}};}function respondWithFilteredResult(_0x2a5f48,_0x34bcf4){return function(_0x5f45f8){if(_0x5f45f8){var _0x4556eb=typeof _0x34bcf4[_0x06df('0x13')]==='undefined'&&typeof _0x34bcf4[_0x06df('0x14')]==='undefined';var _0x2456d4=_0x5f45f8[_0x06df('0x15')];var _0x361738=_0x4556eb?0x0:_0x34bcf4[_0x06df('0x13')];var _0x284a2f=_0x4556eb?_0x5f45f8['count']:_0x34bcf4['offset']+_0x34bcf4[_0x06df('0x14')];var _0x54e1fb;if(_0x284a2f>=_0x2456d4){_0x284a2f=_0x2456d4;_0x54e1fb=0xc8;}else{_0x54e1fb=0xce;}_0x2a5f48['status'](_0x54e1fb);return _0x2a5f48[_0x06df('0x16')]('Content-Range',_0x361738+'-'+_0x284a2f+'/'+_0x2456d4)[_0x06df('0x17')](_0x5f45f8);}return null;};}function saveUpdates(_0x143625){return function(_0x10b78f){if(_0x10b78f){return _0x10b78f[_0x06df('0x18')](_0x143625)[_0x06df('0x19')](function(_0xe9e3d3){return _0xe9e3d3;});}return null;};}function removeEntity(_0x919fe4){return function(_0x5a6c79){if(_0x5a6c79){return _0x5a6c79[_0x06df('0x1a')]()['then'](function(){_0x919fe4[_0x06df('0x12')](0xcc)[_0x06df('0x11')]();});}};}function handleEntityNotFound(_0x1b4939){return function(_0x2dac96){if(!_0x2dac96){_0x1b4939[_0x06df('0x10')](0x194);}return _0x2dac96;};}function handleError(_0xe9a5a2,_0x30567f){_0x30567f=_0x30567f||0x1f4;return function(_0x583a4d){logger[_0x06df('0x1b')](_0x583a4d[_0x06df('0x1c')]);if(_0x583a4d[_0x06df('0x1d')]){delete _0x583a4d[_0x06df('0x1d')];}_0xe9a5a2[_0x06df('0x12')](_0x30567f)['send'](_0x583a4d);};}exports['index']=function(_0x4f0c85,_0x47dde1){var _0x129c11={};var _0x5ac149=_['map'](db[_0x06df('0x1e')][_0x06df('0x1f')],function(_0x116aa8){return{'name':_0x116aa8['fieldName'],'type':_0x116aa8['type'][_0x06df('0x20')]};});_0x129c11=qs[_0x06df('0x21')](_0x5ac149,_0x4f0c85);return interaction['findAll']('sms',_0x4f0c85['query'],_0x4f0c85['user'],_0x129c11,_0x5ac149)[_0x06df('0x19')](respondWithFilteredResult(_0x47dde1,_0x129c11))[_0x06df('0x22')](handleError(_0x47dde1,null));};exports['show']=function(_0x3b7ce4,_0x5d9a1b){var _0x8f89d5={'raw':![],'where':{'id':_0x3b7ce4['params']['id']}},_0x28e2ee={};_0x28e2ee['model']=_[_0x06df('0x23')](db[_0x06df('0x1e')][_0x06df('0x1f')]);_0x28e2ee[_0x06df('0x24')]=_[_0x06df('0x23')](_0x3b7ce4[_0x06df('0x24')]);_0x28e2ee[_0x06df('0x25')]=_['intersection'](_0x28e2ee[_0x06df('0x26')],_0x28e2ee[_0x06df('0x24')]);_0x8f89d5[_0x06df('0x27')]=_['intersection'](_0x28e2ee[_0x06df('0x26')],qs[_0x06df('0x28')](_0x3b7ce4['query']['fields']));_0x8f89d5['attributes']=_0x8f89d5[_0x06df('0x27')]['length']?_0x8f89d5[_0x06df('0x27')]:_0x28e2ee[_0x06df('0x26')];if(_0x3b7ce4[_0x06df('0x24')][_0x06df('0x29')]){_0x8f89d5[_0x06df('0x2a')]=[{'all':!![]}];}_0x8f89d5=_['merge']({},_0x8f89d5,_0x3b7ce4['options']);return db[_0x06df('0x1e')][_0x06df('0x2b')](_0x8f89d5)[_0x06df('0x19')](handleEntityNotFound(_0x5d9a1b,null))[_0x06df('0x19')](respondWithResult(_0x5d9a1b,null))['catch'](handleError(_0x5d9a1b,null));};exports[_0x06df('0x2c')]=function(_0x136120,_0x5fb461){return db[_0x06df('0x1e')][_0x06df('0x2c')](_0x136120[_0x06df('0x2d')],{})['then'](respondWithResult(_0x5fb461,0xc9))[_0x06df('0x22')](handleError(_0x5fb461,null));};exports[_0x06df('0x18')]=function(_0x38c88e,_0x349086){if(_0x38c88e[_0x06df('0x2d')]['id']){delete _0x38c88e[_0x06df('0x2d')]['id'];}return db[_0x06df('0x1e')][_0x06df('0x2b')]({'where':{'id':_0x38c88e['params']['id']}})[_0x06df('0x19')](handleEntityNotFound(_0x349086,null))[_0x06df('0x19')](saveUpdates(_0x38c88e[_0x06df('0x2d')],null))[_0x06df('0x19')](respondWithResult(_0x349086,null))['catch'](handleError(_0x349086,null));};exports[_0x06df('0x1a')]=function(_0x59822b,_0x1436cc){return db[_0x06df('0x1e')][_0x06df('0x2b')]({'where':{'id':_0x59822b[_0x06df('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1436cc,null))[_0x06df('0x19')](removeEntity(_0x1436cc,null))['catch'](handleError(_0x1436cc,null));};exports[_0x06df('0x2f')]=function(_0x1273ca,_0x312980){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x312980,null))[_0x06df('0x22')](handleError(_0x312980,null));};exports[_0x06df('0x30')]=function(_0x1049af,_0x5b3e56){return db[_0x06df('0x31')][_0x06df('0x2b')]({'where':{'id':_0x1049af[_0x06df('0x2e')]['id']}})[_0x06df('0x19')](handleEntityNotFound(_0x5b3e56,null))['then'](function(_0x589f95){if(_0x589f95){return _0x589f95[_0x06df('0x30')](_0x1049af[_0x06df('0x2d')][_0x06df('0x32')],_['omit'](_0x1049af['body'],[_0x06df('0x32'),'id'])||{});}})[_0x06df('0x19')](respondWithResult(_0x5b3e56,null))[_0x06df('0x22')](handleError(_0x5b3e56,null));};exports[_0x06df('0x33')]=function(_0xd61603,_0x26257b){var _0x4891d4={'raw':![],'where':{}};var _0x22149a={};var _0x4cfa57={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x06df('0x34')]({'where':{'id':_0xd61603[_0x06df('0x2e')]['id']}})[_0x06df('0x19')](handleEntityNotFound(_0x26257b,null))[_0x06df('0x19')](function(_0x549c89){if(_0x549c89){_0x22149a[_0x06df('0x26')]=_['keys'](db[_0x06df('0x31')][_0x06df('0x1f')]);_0x22149a['query']=_[_0x06df('0x23')](_0xd61603[_0x06df('0x24')]);_0x22149a[_0x06df('0x25')]=_[_0x06df('0x35')](_0x22149a[_0x06df('0x26')],_0x22149a['query']);_0x4891d4['attributes']=_[_0x06df('0x35')](_0x22149a['model'],qs[_0x06df('0x28')](_0xd61603['query']['fields']));_0x4891d4['attributes']=_0x4891d4[_0x06df('0x27')][_0x06df('0x36')]?_0x4891d4['attributes']:_0x22149a['model'];if(!_0xd61603[_0x06df('0x24')][_0x06df('0x37')](_0x06df('0x38'))){_0x4891d4[_0x06df('0x14')]=qs[_0x06df('0x14')](_0xd61603[_0x06df('0x24')][_0x06df('0x14')]);_0x4891d4[_0x06df('0x13')]=qs[_0x06df('0x13')](_0xd61603[_0x06df('0x24')]['offset']);}_0x4891d4[_0x06df('0x39')]=qs[_0x06df('0x3a')](_0xd61603[_0x06df('0x24')][_0x06df('0x3a')]);_0x4891d4[_0x06df('0x3b')]=qs[_0x06df('0x25')](_[_0x06df('0x3c')](_0xd61603[_0x06df('0x24')],_0x22149a[_0x06df('0x25')]));_0x4891d4[_0x06df('0x3b')][_0x06df('0x3d')]=_0x549c89['id'];if(_0xd61603['query'][_0x06df('0x3e')]){_0x4891d4['where']=_[_0x06df('0x3f')](_0x4891d4[_0x06df('0x3b')],{'$or':_['map'](_0x4891d4[_0x06df('0x27')],function(_0x4d1f84){var _0x5ba6db={};_0x5ba6db[_0x4d1f84]={'$like':'%'+_0xd61603[_0x06df('0x24')][_0x06df('0x3e')]+'%'};return _0x5ba6db;})});}if(_0xd61603[_0x06df('0x24')]['$gte']){var _0x31333b=_0xd61603[_0x06df('0x24')]['$gte'][_0x06df('0x40')](',');var _0x216cbb={};_0x216cbb[_0x31333b[0x0]]={'$gte':moment(_0x31333b[0x1])[_0x06df('0x41')](_0x06df('0x42'))};_0x4891d4[_0x06df('0x3b')]=_[_0x06df('0x3f')](_0x4891d4[_0x06df('0x3b')],_0x216cbb);}_0x4891d4=_[_0x06df('0x3f')]({},_0x4891d4,_0xd61603[_0x06df('0x43')]);return db[_0x06df('0x31')][_0x06df('0x15')]({'where':_0x4891d4[_0x06df('0x3b')]})[_0x06df('0x19')](function(_0x2d4e72){_0x4cfa57[_0x06df('0x15')]=_0x2d4e72;if(_0xd61603['query'][_0x06df('0x29')]){_0x4891d4[_0x06df('0x2a')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x4891d4);})[_0x06df('0x19')](function(_0x296ba5){_0x4cfa57[_0x06df('0x44')]=_0x296ba5;return _0x4cfa57;});}})['then'](respondWithFilteredResult(_0x26257b,_0x4891d4))[_0x06df('0x22')](handleError(_0x26257b,null));};exports['addTags']=function(_0x3c3af1,_0x4eddd1){return db[_0x06df('0x1e')][_0x06df('0x2b')]({'where':{'id':_0x3c3af1['params']['id']}})[_0x06df('0x19')](handleEntityNotFound(_0x4eddd1,null))[_0x06df('0x19')](function(_0x3ba06e){if(_0x3ba06e){return _0x3ba06e[_0x06df('0x45')](_0x3c3af1['body'][_0x06df('0x32')],_[_0x06df('0x46')](_0x3c3af1[_0x06df('0x2d')],[_0x06df('0x32'),'id'])||{})[_0x06df('0x47')](function(){return db[_0x06df('0x48')][_0x06df('0x49')]({'attributes':['id',_0x06df('0x1d'),_0x06df('0x4a')],'where':{'id':_0x3c3af1['body']['ids']}});})[_0x06df('0x19')](function(_0x470ccf){socket[_0x06df('0x4b')]('smsInteractionTags:save',{'id':Number(_0x3c3af1[_0x06df('0x2e')]['id']),'tags':_0x470ccf||[]});return{'id':Number(_0x3c3af1[_0x06df('0x2e')]['id']),'tags':_0x470ccf||[]};});}})['then'](respondWithResult(_0x4eddd1,null))[_0x06df('0x22')](handleError(_0x4eddd1,null));};exports[_0x06df('0x4c')]=function(_0x85f936,_0x3a5edc){return db[_0x06df('0x1e')]['find']({'where':{'id':_0x85f936['params']['id']}})[_0x06df('0x19')](handleEntityNotFound(_0x3a5edc,null))[_0x06df('0x19')](function(_0x52fc50){if(_0x52fc50){return _0x52fc50['removeTags'](_0x85f936[_0x06df('0x24')]['ids']);}})[_0x06df('0x19')](respondWithStatusCode(_0x3a5edc,null))[_0x06df('0x22')](handleError(_0x3a5edc,null));};exports[_0x06df('0x4d')]=function(_0x12703d,_0x50b0d6){var _0x1ff7d3=moment()[_0x06df('0x4e')]()[_0x06df('0x4f')]();var _0x26fb0d=path[_0x06df('0x50')](config[_0x06df('0x51')],_0x06df('0x52'),_0x06df('0x53'),'tmp');var _0x3cd6a9=path[_0x06df('0x50')](_0x26fb0d,_0x1ff7d3);var _0x537de7=util[_0x06df('0x41')](_0x06df('0x54'),_0x12703d['params']['id'],_0x1ff7d3);var _0x4a2155=path[_0x06df('0x50')](_0x26fb0d,_0x537de7);var _0x270a84=[];_0x270a84[_0x06df('0x55')]({'model':db[_0x06df('0x56')],'as':_0x06df('0x56'),'attributes':['id','fullname'],'raw':!![]});_0x270a84[_0x06df('0x55')]({'model':db[_0x06df('0x57')],'as':_0x06df('0x58'),'attributes':['id',_0x06df('0x59'),_0x06df('0x5a')],'raw':!![]});var _0x4ec7e2=[{'model':db[_0x06df('0x31')],'as':_0x06df('0x5b'),'attributes':['id',_0x06df('0x2d'),'createdAt',_0x06df('0x5c'),_0x06df('0x5d'),_0x06df('0x5e')],'include':_0x270a84}];_0x4ec7e2[_0x06df('0x55')]({'model':db[_0x06df('0x5f')],'as':_0x06df('0x60'),'attributes':['id',_0x06df('0x1d')]});_0x4ec7e2[_0x06df('0x55')]({'model':db['User'],'as':_0x06df('0x61'),'attributes':['id','fullname']});return db[_0x06df('0x1e')][_0x06df('0x2b')]({'where':{'id':_0x12703d[_0x06df('0x2e')]['id']},'include':_0x4ec7e2})[_0x06df('0x19')](handleEntityNotFound(_0x50b0d6,null))[_0x06df('0x19')](function(_0x372cf0){if(_0x372cf0){var _0x45aeaa=_0x372cf0[_0x06df('0x62')]({'plain':!![]});fs[_0x06df('0x63')](_0x3cd6a9);var _0x72cb7e={'channel':_0x06df('0x64'),'account':_0x45aeaa[_0x06df('0x60')]['name'],'agent':_0x45aeaa[_0x06df('0x61')]?_0x45aeaa[_0x06df('0x61')][_0x06df('0x65')]:'N.A.','createdAt':moment(_0x45aeaa[_0x06df('0x66')])[_0x06df('0x41')](_0x06df('0x42'))[_0x06df('0x4f')](),'closedAt':_0x45aeaa[_0x06df('0x67')]?moment(_0x45aeaa[_0x06df('0x68')])['format'](_0x06df('0x42'))[_0x06df('0x4f')]():'','disposition':_0x45aeaa['disposition'],'messages':_(_0x45aeaa[_0x06df('0x5b')])['filter']({'secret':![]})[_0x06df('0x69')](function(_0x58483f){return{'date':moment(_0x58483f[_0x06df('0x66')])[_0x06df('0x41')]('YYYY-MM-DD\x20HH:mm:ss')[_0x06df('0x4f')](),'sender':_0x58483f[_0x06df('0x5c')]===_0x06df('0x6a')?_0x58483f[_0x06df('0x56')]?_0x58483f[_0x06df('0x56')][_0x06df('0x65')]:_0x06df('0x6b'):_0x58483f[_0x06df('0x58')][_0x06df('0x59')]+(_0x58483f[_0x06df('0x58')][_0x06df('0x5a')]?'\x20'+_0x58483f[_0x06df('0x58')][_0x06df('0x5a')]:''),'body':_0x58483f[_0x06df('0x2d')],'direction':_0x58483f[_0x06df('0x5c')]===_0x06df('0x6a')?'A':'C','secret':_0x58483f[_0x06df('0x5d')],'read':_0x58483f[_0x06df('0x5e')]};})[_0x06df('0x6c')]()};return ejs[_0x06df('0x6d')](path[_0x06df('0x50')](config['root'],_0x06df('0x52'),_0x06df('0x6e'),_0x06df('0x6f')),{'interaction':_0x72cb7e})[_0x06df('0x19')](function(_0x2da795){var _0x7ddef9=path[_0x06df('0x50')](_0x3cd6a9,_0x06df('0x70')+_0x45aeaa['id']+'-'+_0x1ff7d3+_0x06df('0x71'));var _0x468331={'path':_0x7ddef9,'channel':_0x06df('0x64'),'interactionId':_0x45aeaa['id']};return pdf[_0x06df('0x72')](_0x2da795,_0x468331);})['then'](function(){return new BPromise(function(_0x4bbba6,_0xa0cbc4){zipdir(_0x3cd6a9,{'saveTo':_0x4a2155},function(_0x566513,_0x5665dc){if(_0x566513)return _0xa0cbc4(_0x566513);return _0x4bbba6(_0x5665dc);});})[_0x06df('0x19')](function(){return new BPromise(function(_0x28ee20,_0x382e9d){rimraf(_0x3cd6a9,function(_0x42cea6){if(_0x42cea6)_0x382e9d(_0x42cea6);return _0x28ee20();});});})[_0x06df('0x19')](function(){return _0x50b0d6[_0x06df('0x4d')](_0x4a2155,_0x537de7,function(_0x413f9c){if(_0x413f9c){console[_0x06df('0x73')](_0x06df('0x74'),_0x413f9c);}else{fs[_0x06df('0x75')](_0x4a2155);}});});});}else{return _0x50b0d6[_0x06df('0x10')](0xc8);}})[_0x06df('0x22')](handleError(_0x50b0d6,null));}; \ No newline at end of file +var _0xcbfb=['read','SmsAccount','Account','Owner','Sms','N.A.','closedAt','disposition','direction','out','System','Contact','value','renderFile','root','views','.pdf','createPdfFromHTML','download','log','unlinkSync','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','error','name','send','rawAttributes','fieldName','type','getOptions','findAll','query','catch','show','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','includeAll','include','merge','options','find','body','update','destroy','describe','addMessage','SmsMessage','ids','omit','findOne','length','hasOwnProperty','nolimit','sort','pick','where','SmsInteractionId','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','smsInteractionTags:save','removeTags','unix','toString','server','files','transcript-%d-%s.zip','join','push','User','fullname','firstName','lastName','Messages','createdAt','secret'];(function(_0x22f7a7,_0x42d2a1){var _0x5e0ff6=function(_0x305ac9){while(--_0x305ac9){_0x22f7a7['push'](_0x22f7a7['shift']());}};_0x5e0ff6(++_0x42d2a1);}(_0xcbfb,0x1dd));var _0xbcbf=function(_0x5b5881,_0x2544d7){_0x5b5881=_0x5b5881-0x0;var _0x311675=_0xcbfb[_0x5b5881];return _0x311675;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xbcbf('0x0'));var BPromise=require(_0xbcbf('0x1'));var util=require(_0xbcbf('0x2'));var path=require(_0xbcbf('0x3'));var ejs=require(_0xbcbf('0x4'));var fs=require('fs');var _=require(_0xbcbf('0x5'));var Redis=require(_0xbcbf('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xbcbf('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xbcbf('0x8'));var config=require(_0xbcbf('0x9'));var db=require(_0xbcbf('0xa'))['db'];config[_0xbcbf('0xb')]=_[_0xbcbf('0xc')](config[_0xbcbf('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcbf('0xd'))(new Redis(config[_0xbcbf('0xb')]));require(_0xbcbf('0xe'))[_0xbcbf('0xf')](socket);function respondWithStatusCode(_0x1d7ba0,_0x166e1d){_0x166e1d=_0x166e1d||0xcc;return function(_0xde6174){if(_0xde6174){return _0x1d7ba0[_0xbcbf('0x10')](_0x166e1d);}return _0x1d7ba0[_0xbcbf('0x11')](_0x166e1d)[_0xbcbf('0x12')]();};}function respondWithResult(_0x2187ec,_0x44d19e){_0x44d19e=_0x44d19e||0xc8;return function(_0x391df1){if(_0x391df1){return _0x2187ec[_0xbcbf('0x11')](_0x44d19e)[_0xbcbf('0x13')](_0x391df1);}};}function respondWithFilteredResult(_0x1235b4,_0x3927b1){return function(_0x44c3b6){if(_0x44c3b6){var _0xc92238=typeof _0x3927b1[_0xbcbf('0x14')]===_0xbcbf('0x15')&&typeof _0x3927b1[_0xbcbf('0x16')]==='undefined';var _0x396da0=_0x44c3b6[_0xbcbf('0x17')];var _0x4c6661=_0xc92238?0x0:_0x3927b1[_0xbcbf('0x14')];var _0x1daa7a=_0xc92238?_0x44c3b6[_0xbcbf('0x17')]:_0x3927b1[_0xbcbf('0x14')]+_0x3927b1[_0xbcbf('0x16')];var _0x4462a2;if(_0x1daa7a>=_0x396da0){_0x1daa7a=_0x396da0;_0x4462a2=0xc8;}else{_0x4462a2=0xce;}_0x1235b4[_0xbcbf('0x11')](_0x4462a2);return _0x1235b4[_0xbcbf('0x18')](_0xbcbf('0x19'),_0x4c6661+'-'+_0x1daa7a+'/'+_0x396da0)[_0xbcbf('0x13')](_0x44c3b6);}return null;};}function saveUpdates(_0x31e6ba){return function(_0x5c6341){if(_0x5c6341){return _0x5c6341['update'](_0x31e6ba)[_0xbcbf('0x1a')](function(_0x95af4e){return _0x95af4e;});}return null;};}function removeEntity(_0x5298c4){return function(_0x426a2f){if(_0x426a2f){return _0x426a2f['destroy']()[_0xbcbf('0x1a')](function(){_0x5298c4[_0xbcbf('0x11')](0xcc)[_0xbcbf('0x12')]();});}};}function handleEntityNotFound(_0x465e66){return function(_0x34cab2){if(!_0x34cab2){_0x465e66['sendStatus'](0x194);}return _0x34cab2;};}function handleError(_0x8c94cf,_0x29bbd7){_0x29bbd7=_0x29bbd7||0x1f4;return function(_0x5deefc){logger[_0xbcbf('0x1b')](_0x5deefc['stack']);if(_0x5deefc[_0xbcbf('0x1c')]){delete _0x5deefc[_0xbcbf('0x1c')];}_0x8c94cf[_0xbcbf('0x11')](_0x29bbd7)[_0xbcbf('0x1d')](_0x5deefc);};}exports['index']=function(_0x31c21c,_0x1fb061){var _0x44745b={};var _0x47c69e=_['map'](db['SmsInteraction'][_0xbcbf('0x1e')],function(_0x34ea79){return{'name':_0x34ea79[_0xbcbf('0x1f')],'type':_0x34ea79[_0xbcbf('0x20')]['key']};});_0x44745b=qs[_0xbcbf('0x21')](_0x47c69e,_0x31c21c);return interaction[_0xbcbf('0x22')]('sms',_0x31c21c[_0xbcbf('0x23')],_0x31c21c['user'],_0x44745b,_0x47c69e)[_0xbcbf('0x1a')](respondWithFilteredResult(_0x1fb061,_0x44745b))[_0xbcbf('0x24')](handleError(_0x1fb061,null));};exports[_0xbcbf('0x25')]=function(_0x42457e,_0x425749){var _0x20840b={'raw':![],'where':{'id':_0x42457e[_0xbcbf('0x26')]['id']}},_0x420923={};_0x420923[_0xbcbf('0x27')]=_[_0xbcbf('0x28')](db[_0xbcbf('0x29')][_0xbcbf('0x1e')]);_0x420923['query']=_[_0xbcbf('0x28')](_0x42457e[_0xbcbf('0x23')]);_0x420923[_0xbcbf('0x2a')]=_[_0xbcbf('0x2b')](_0x420923['model'],_0x420923[_0xbcbf('0x23')]);_0x20840b[_0xbcbf('0x2c')]=_[_0xbcbf('0x2b')](_0x420923['model'],qs[_0xbcbf('0x2d')](_0x42457e[_0xbcbf('0x23')]['fields']));_0x20840b[_0xbcbf('0x2c')]=_0x20840b[_0xbcbf('0x2c')]['length']?_0x20840b[_0xbcbf('0x2c')]:_0x420923[_0xbcbf('0x27')];if(_0x42457e['query'][_0xbcbf('0x2e')]){_0x20840b[_0xbcbf('0x2f')]=[{'all':!![]}];}_0x20840b=_[_0xbcbf('0x30')]({},_0x20840b,_0x42457e[_0xbcbf('0x31')]);return db[_0xbcbf('0x29')][_0xbcbf('0x32')](_0x20840b)['then'](handleEntityNotFound(_0x425749,null))[_0xbcbf('0x1a')](respondWithResult(_0x425749,null))[_0xbcbf('0x24')](handleError(_0x425749,null));};exports['create']=function(_0x4baf5d,_0x4c32f5){return db[_0xbcbf('0x29')]['create'](_0x4baf5d[_0xbcbf('0x33')],{})[_0xbcbf('0x1a')](respondWithResult(_0x4c32f5,0xc9))[_0xbcbf('0x24')](handleError(_0x4c32f5,null));};exports[_0xbcbf('0x34')]=function(_0x527623,_0x3a8730){if(_0x527623[_0xbcbf('0x33')]['id']){delete _0x527623['body']['id'];}return db[_0xbcbf('0x29')][_0xbcbf('0x32')]({'where':{'id':_0x527623[_0xbcbf('0x26')]['id']}})[_0xbcbf('0x1a')](handleEntityNotFound(_0x3a8730,null))[_0xbcbf('0x1a')](saveUpdates(_0x527623[_0xbcbf('0x33')],null))[_0xbcbf('0x1a')](respondWithResult(_0x3a8730,null))['catch'](handleError(_0x3a8730,null));};exports[_0xbcbf('0x35')]=function(_0x3a2ddc,_0x131bdd){return db['SmsInteraction'][_0xbcbf('0x32')]({'where':{'id':_0x3a2ddc[_0xbcbf('0x26')]['id']}})[_0xbcbf('0x1a')](handleEntityNotFound(_0x131bdd,null))[_0xbcbf('0x1a')](removeEntity(_0x131bdd,null))[_0xbcbf('0x24')](handleError(_0x131bdd,null));};exports['describe']=function(_0x31f215,_0xb68cd1){return db[_0xbcbf('0x29')][_0xbcbf('0x36')]()[_0xbcbf('0x1a')](respondWithResult(_0xb68cd1,null))[_0xbcbf('0x24')](handleError(_0xb68cd1,null));};exports[_0xbcbf('0x37')]=function(_0xef1d5b,_0x12da29){return db[_0xbcbf('0x38')][_0xbcbf('0x32')]({'where':{'id':_0xef1d5b['params']['id']}})[_0xbcbf('0x1a')](handleEntityNotFound(_0x12da29,null))[_0xbcbf('0x1a')](function(_0x737b53){if(_0x737b53){return _0x737b53['addMessage'](_0xef1d5b['body'][_0xbcbf('0x39')],_[_0xbcbf('0x3a')](_0xef1d5b[_0xbcbf('0x33')],[_0xbcbf('0x39'),'id'])||{});}})[_0xbcbf('0x1a')](respondWithResult(_0x12da29,null))[_0xbcbf('0x24')](handleError(_0x12da29,null));};exports['getMessages']=function(_0x16dea9,_0x20960e){var _0x1b2ca8={'raw':![],'where':{}};var _0x286d85={};var _0x562892={'count':0x0,'rows':[]};return db[_0xbcbf('0x29')][_0xbcbf('0x3b')]({'where':{'id':_0x16dea9[_0xbcbf('0x26')]['id']}})[_0xbcbf('0x1a')](handleEntityNotFound(_0x20960e,null))[_0xbcbf('0x1a')](function(_0x5a9532){if(_0x5a9532){_0x286d85[_0xbcbf('0x27')]=_[_0xbcbf('0x28')](db[_0xbcbf('0x38')]['rawAttributes']);_0x286d85['query']=_[_0xbcbf('0x28')](_0x16dea9['query']);_0x286d85[_0xbcbf('0x2a')]=_['intersection'](_0x286d85[_0xbcbf('0x27')],_0x286d85[_0xbcbf('0x23')]);_0x1b2ca8[_0xbcbf('0x2c')]=_[_0xbcbf('0x2b')](_0x286d85[_0xbcbf('0x27')],qs[_0xbcbf('0x2d')](_0x16dea9['query'][_0xbcbf('0x2d')]));_0x1b2ca8[_0xbcbf('0x2c')]=_0x1b2ca8[_0xbcbf('0x2c')][_0xbcbf('0x3c')]?_0x1b2ca8[_0xbcbf('0x2c')]:_0x286d85[_0xbcbf('0x27')];if(!_0x16dea9[_0xbcbf('0x23')][_0xbcbf('0x3d')](_0xbcbf('0x3e'))){_0x1b2ca8[_0xbcbf('0x16')]=qs[_0xbcbf('0x16')](_0x16dea9[_0xbcbf('0x23')][_0xbcbf('0x16')]);_0x1b2ca8['offset']=qs[_0xbcbf('0x14')](_0x16dea9[_0xbcbf('0x23')]['offset']);}_0x1b2ca8['order']=qs[_0xbcbf('0x3f')](_0x16dea9[_0xbcbf('0x23')][_0xbcbf('0x3f')]);_0x1b2ca8['where']=qs[_0xbcbf('0x2a')](_[_0xbcbf('0x40')](_0x16dea9[_0xbcbf('0x23')],_0x286d85['filters']));_0x1b2ca8[_0xbcbf('0x41')][_0xbcbf('0x42')]=_0x5a9532['id'];if(_0x16dea9[_0xbcbf('0x23')]['filter']){_0x1b2ca8[_0xbcbf('0x41')]=_['merge'](_0x1b2ca8[_0xbcbf('0x41')],{'$or':_[_0xbcbf('0x43')](_0x1b2ca8[_0xbcbf('0x2c')],function(_0x37a74c){var _0x2450f8={};_0x2450f8[_0x37a74c]={'$like':'%'+_0x16dea9[_0xbcbf('0x23')][_0xbcbf('0x44')]+'%'};return _0x2450f8;})});}if(_0x16dea9[_0xbcbf('0x23')][_0xbcbf('0x45')]){var _0x2c2b78=_0x16dea9[_0xbcbf('0x23')][_0xbcbf('0x45')][_0xbcbf('0x46')](',');var _0x32c531={};_0x32c531[_0x2c2b78[0x0]]={'$gte':moment(_0x2c2b78[0x1])[_0xbcbf('0x47')](_0xbcbf('0x48'))};_0x1b2ca8['where']=_[_0xbcbf('0x30')](_0x1b2ca8[_0xbcbf('0x41')],_0x32c531);}_0x1b2ca8=_['merge']({},_0x1b2ca8,_0x16dea9['options']);return db[_0xbcbf('0x38')]['count']({'where':_0x1b2ca8[_0xbcbf('0x41')]})[_0xbcbf('0x1a')](function(_0x23ea25){_0x562892['count']=_0x23ea25;if(_0x16dea9[_0xbcbf('0x23')]['includeAll']){_0x1b2ca8['include']=[{'all':!![]}];}return db[_0xbcbf('0x38')][_0xbcbf('0x22')](_0x1b2ca8);})['then'](function(_0x1265fa){_0x562892[_0xbcbf('0x49')]=_0x1265fa;return _0x562892;});}})[_0xbcbf('0x1a')](respondWithFilteredResult(_0x20960e,_0x1b2ca8))[_0xbcbf('0x24')](handleError(_0x20960e,null));};exports[_0xbcbf('0x4a')]=function(_0x9fd3a9,_0x1a989a){return db[_0xbcbf('0x29')][_0xbcbf('0x32')]({'where':{'id':_0x9fd3a9[_0xbcbf('0x26')]['id']}})[_0xbcbf('0x1a')](handleEntityNotFound(_0x1a989a,null))[_0xbcbf('0x1a')](function(_0x1323ae){if(_0x1323ae){return _0x1323ae['setTags'](_0x9fd3a9[_0xbcbf('0x33')][_0xbcbf('0x39')],_[_0xbcbf('0x3a')](_0x9fd3a9[_0xbcbf('0x33')],[_0xbcbf('0x39'),'id'])||{})[_0xbcbf('0x4b')](function(){return db[_0xbcbf('0x4c')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x9fd3a9[_0xbcbf('0x33')][_0xbcbf('0x39')]}});})['then'](function(_0x9b1099){socket['emit'](_0xbcbf('0x4d'),{'id':Number(_0x9fd3a9[_0xbcbf('0x26')]['id']),'tags':_0x9b1099||[]});return{'id':Number(_0x9fd3a9[_0xbcbf('0x26')]['id']),'tags':_0x9b1099||[]};});}})[_0xbcbf('0x1a')](respondWithResult(_0x1a989a,null))[_0xbcbf('0x24')](handleError(_0x1a989a,null));};exports[_0xbcbf('0x4e')]=function(_0x10b335,_0x5b30bc){return db[_0xbcbf('0x29')]['find']({'where':{'id':_0x10b335['params']['id']}})['then'](handleEntityNotFound(_0x5b30bc,null))['then'](function(_0x13ddf8){if(_0x13ddf8){return _0x13ddf8['removeTags'](_0x10b335[_0xbcbf('0x23')][_0xbcbf('0x39')]);}})[_0xbcbf('0x1a')](respondWithStatusCode(_0x5b30bc,null))[_0xbcbf('0x24')](handleError(_0x5b30bc,null));};exports['download']=function(_0x4cc999,_0x3b12b2){var _0x56c8f4=moment()[_0xbcbf('0x4f')]()[_0xbcbf('0x50')]();var _0x487f44=path['join'](config['root'],_0xbcbf('0x51'),_0xbcbf('0x52'),'tmp');var _0x2b64b0=path['join'](_0x487f44,_0x56c8f4);var _0x11021b=util[_0xbcbf('0x47')](_0xbcbf('0x53'),_0x4cc999[_0xbcbf('0x26')]['id'],_0x56c8f4);var _0x19cd1e=path[_0xbcbf('0x54')](_0x487f44,_0x11021b);var _0x4c20e9=[];_0x4c20e9[_0xbcbf('0x55')]({'model':db[_0xbcbf('0x56')],'as':'User','attributes':['id',_0xbcbf('0x57')],'raw':!![]});_0x4c20e9[_0xbcbf('0x55')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xbcbf('0x58'),_0xbcbf('0x59')],'raw':!![]});var _0x3b3ba3=[{'model':db[_0xbcbf('0x38')],'as':_0xbcbf('0x5a'),'attributes':['id','body',_0xbcbf('0x5b'),'direction',_0xbcbf('0x5c'),_0xbcbf('0x5d')],'include':_0x4c20e9}];_0x3b3ba3['push']({'model':db[_0xbcbf('0x5e')],'as':_0xbcbf('0x5f'),'attributes':['id',_0xbcbf('0x1c')]});_0x3b3ba3[_0xbcbf('0x55')]({'model':db[_0xbcbf('0x56')],'as':_0xbcbf('0x60'),'attributes':['id',_0xbcbf('0x57')]});return db[_0xbcbf('0x29')][_0xbcbf('0x32')]({'where':{'id':_0x4cc999[_0xbcbf('0x26')]['id']},'include':_0x3b3ba3})[_0xbcbf('0x1a')](handleEntityNotFound(_0x3b12b2,null))[_0xbcbf('0x1a')](function(_0x13c673){if(_0x13c673){var _0x5b725f=_0x13c673['get']({'plain':!![]});fs['mkdirSync'](_0x2b64b0);var _0x3c9479={'channel':_0xbcbf('0x61'),'account':_0x5b725f[_0xbcbf('0x5f')][_0xbcbf('0x1c')],'agent':_0x5b725f[_0xbcbf('0x60')]?_0x5b725f[_0xbcbf('0x60')][_0xbcbf('0x57')]:_0xbcbf('0x62'),'createdAt':moment(_0x5b725f[_0xbcbf('0x5b')])[_0xbcbf('0x47')](_0xbcbf('0x48'))[_0xbcbf('0x50')](),'closedAt':_0x5b725f['closed']?moment(_0x5b725f[_0xbcbf('0x63')])[_0xbcbf('0x47')](_0xbcbf('0x48'))[_0xbcbf('0x50')]():'','disposition':_0x5b725f[_0xbcbf('0x64')],'messages':_(_0x5b725f[_0xbcbf('0x5a')])[_0xbcbf('0x44')]({'secret':![]})[_0xbcbf('0x43')](function(_0x2deaa5){return{'date':moment(_0x2deaa5[_0xbcbf('0x5b')])[_0xbcbf('0x47')](_0xbcbf('0x48'))[_0xbcbf('0x50')](),'sender':_0x2deaa5[_0xbcbf('0x65')]===_0xbcbf('0x66')?_0x2deaa5[_0xbcbf('0x56')]?_0x2deaa5[_0xbcbf('0x56')][_0xbcbf('0x57')]:_0xbcbf('0x67'):_0x2deaa5[_0xbcbf('0x68')][_0xbcbf('0x58')]+(_0x2deaa5[_0xbcbf('0x68')][_0xbcbf('0x59')]?'\x20'+_0x2deaa5[_0xbcbf('0x68')][_0xbcbf('0x59')]:''),'body':_0x2deaa5[_0xbcbf('0x33')],'direction':_0x2deaa5[_0xbcbf('0x65')]===_0xbcbf('0x66')?'A':'C','secret':_0x2deaa5[_0xbcbf('0x5c')],'read':_0x2deaa5[_0xbcbf('0x5d')]};})[_0xbcbf('0x69')]()};return ejs[_0xbcbf('0x6a')](path['join'](config[_0xbcbf('0x6b')],_0xbcbf('0x51'),_0xbcbf('0x6c'),'downloadInteraction.ejs'),{'interaction':_0x3c9479})[_0xbcbf('0x1a')](function(_0x15b118){var _0x45fab5=path[_0xbcbf('0x54')](_0x2b64b0,'transcript-'+_0x5b725f['id']+'-'+_0x56c8f4+_0xbcbf('0x6d'));var _0x209dcb={'path':_0x45fab5,'channel':_0xbcbf('0x61'),'interactionId':_0x5b725f['id']};return pdf[_0xbcbf('0x6e')](_0x15b118,_0x209dcb);})['then'](function(){return new BPromise(function(_0x552c70,_0x2be5d2){zipdir(_0x2b64b0,{'saveTo':_0x19cd1e},function(_0x1bc51c,_0x352eb4){if(_0x1bc51c)return _0x2be5d2(_0x1bc51c);return _0x552c70(_0x352eb4);});})['then'](function(){return new BPromise(function(_0x34a046,_0x57a736){rimraf(_0x2b64b0,function(_0x11164d){if(_0x11164d)_0x57a736(_0x11164d);return _0x34a046();});});})[_0xbcbf('0x1a')](function(){return _0x3b12b2[_0xbcbf('0x6f')](_0x19cd1e,_0x11021b,function(_0x4146d3){if(_0x4146d3){console[_0xbcbf('0x70')]('err',_0x4146d3);}else{fs[_0xbcbf('0x71')](_0x19cd1e);}});});});}else{return _0x3b12b2['sendStatus'](0xc8);}})[_0xbcbf('0x24')](handleError(_0x3b12b2,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 10bebe1..0c21fde 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x35b988,_0x30c284){var _0x56a938=function(_0x26ad08){while(--_0x26ad08){_0x35b988['push'](_0x35b988['shift']());}};_0x56a938(++_0x30c284);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x781d=['map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users'];(function(_0x544a53,_0x49656d){var _0x1bc56a=function(_0x4bc3a6){while(--_0x4bc3a6){_0x544a53['push'](_0x544a53['shift']());}};_0x1bc56a(++_0x49656d);}(_0x781d,0x14a));var _0xd781=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x781d[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0xd781('0x0'));var SmsInteraction=require(_0xd781('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xd781('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xd781('0x3')](0x0);var events={'afterCreate':_0xd781('0x4'),'afterUpdate':_0xd781('0x5'),'afterDestroy':_0xd781('0x6')};function emitEvent(_0x42258e){return function(_0x446534,_0x1d4f4e,_0x830b){_0x446534[_0xd781('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x133509){_0x446534[_0xd781('0x8')](_0xd781('0x9'),_0x133509[_0xd781('0xa')](function(_0x4b1a57){return{'id':_0x4b1a57['id']};}));return SmsMessage[_0xd781('0xb')]({'where':{'SmsInteractionId':_0x446534['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x43d863){_0x446534[_0xd781('0x8')]('unreadMessages',_0x43d863[_0xd781('0xc')]);SmsInteractionEvents[_0xd781('0xd')](_0x42258e+':'+_0x446534['id'],_0x446534);SmsInteractionEvents['emit'](_0x42258e,_0x446534);_0x830b(null);})['catch'](_0x830b(null));};}for(var e in events){if(events[_0xd781('0xe')](e)){var event=events[e];SmsInteraction[_0xd781('0xf')](e,emitEvent(event));}}module[_0xd781('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 957fb39..0db78d1 100644 --- a/server/api/smsInteraction/smsInteraction.model.js +++ b/server/api/smsInteraction/smsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a43=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x47645c,_0x10c85c){var _0xde3a27=function(_0xfbda6c){while(--_0xfbda6c){_0x47645c['push'](_0x47645c['shift']());}};_0xde3a27(++_0x10c85c);}(_0x8a43,0x177));var _0x38a4=function(_0x2504fb,_0x79b1fa){_0x2504fb=_0x2504fb-0x0;var _0x1aabf8=_0x8a43[_0x2504fb];return _0x1aabf8;};'use strict';var _=require(_0x38a4('0x0'));var util=require(_0x38a4('0x1'));var logger=require(_0x38a4('0x2'))('api');var moment=require(_0x38a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x38a4('0x4'));var fs=require('fs');var path=require(_0x38a4('0x5'));var rimraf=require('rimraf');var config=require(_0x38a4('0x6'));var attributes=require(_0x38a4('0x7'));module[_0x38a4('0x8')]=function(_0x1e2710,_0x190fd9){return _0x1e2710[_0x38a4('0x9')](_0x38a4('0xa'),attributes,{'tableName':_0x38a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4133c3,_0x163d36,_0xf1a37a){if(_0x4133c3[_0x38a4('0xc')](_0x38a4('0xd'))){_0x4133c3[_0x38a4('0xe')]=moment()[_0x38a4('0xf')](_0x38a4('0x10'));}_0xf1a37a(null,_0x4133c3);}}});}; \ No newline at end of file +var _0x5eb7=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0x24fbf4,_0x1b2f64){var _0x3e5522=function(_0x33a1e3){while(--_0x33a1e3){_0x24fbf4['push'](_0x24fbf4['shift']());}};_0x3e5522(++_0x1b2f64);}(_0x5eb7,0x94));var _0x75eb=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0x5eb7[_0x2fcf18];return _0x4c68cc;};'use strict';var _=require(_0x75eb('0x0'));var util=require('util');var logger=require(_0x75eb('0x1'))(_0x75eb('0x2'));var moment=require(_0x75eb('0x3'));var BPromise=require(_0x75eb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75eb('0x5'));var rimraf=require(_0x75eb('0x6'));var config=require('../../config/environment');var attributes=require(_0x75eb('0x7'));module[_0x75eb('0x8')]=function(_0x851d01,_0x3666e7){return _0x851d01[_0x75eb('0x9')](_0x75eb('0xa'),attributes,{'tableName':_0x75eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x554a04,_0x456648,_0x3abe58){if(_0x554a04[_0x75eb('0xc')](_0x75eb('0xd'))){_0x554a04[_0x75eb('0xe')]=moment()['format'](_0x75eb('0xf'));}_0x3abe58(null,_0x554a04);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ab7ad8b..5beca10 100644 --- a/server/api/smsInteraction/smsInteraction.rpc.js +++ b/server/api/smsInteraction/smsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44da=['socket.io-emitter','./smsInteraction.socket','register','request','then','info','debug','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','result','SmsInteraction','update','options','where','attributes','limit','UpdateSmsInteraction','find','addTags','body','ids','omit','spread','catch','AddTags','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x44da,0x1ac));var _0xa44d=function(_0x2404f1,_0x5c092a){_0x2404f1=_0x2404f1-0x0;var _0x49601e=_0x44da[_0x2404f1];return _0x49601e;};'use strict';var _=require('lodash');var util=require(_0xa44d('0x0'));var moment=require(_0xa44d('0x1'));var BPromise=require(_0xa44d('0x2'));var rs=require(_0xa44d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa44d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa44d('0x5'));var config=require(_0xa44d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa44d('0x7')][_0xa44d('0x8')]({'port':0x232a});config[_0xa44d('0x9')]=_[_0xa44d('0xa')](config[_0xa44d('0x9')],{'host':_0xa44d('0xb'),'port':0x18eb});var socket=require(_0xa44d('0xc'))(new Redis(config[_0xa44d('0x9')]));require(_0xa44d('0xd'))[_0xa44d('0xe')](socket);function respondWithRpcPromise(_0xeec217,_0x308e67,_0x56316b){return new BPromise(function(_0x4f698e,_0xbb8559){return client[_0xa44d('0xf')](_0xeec217,_0x56316b)[_0xa44d('0x10')](function(_0x83e0f5){logger[_0xa44d('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x308e67,'request\x20sent');logger[_0xa44d('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x308e67,'request\x20sent',JSON[_0xa44d('0x13')](_0x83e0f5));if(_0x83e0f5['error']){if(_0x83e0f5[_0xa44d('0x14')][_0xa44d('0x15')]===0x1f4){logger[_0xa44d('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x308e67,_0x83e0f5[_0xa44d('0x14')][_0xa44d('0x16')]);return _0xbb8559(_0x83e0f5['error'][_0xa44d('0x16')]);}logger['error'](_0xa44d('0x17'),_0x308e67,_0x83e0f5[_0xa44d('0x14')][_0xa44d('0x16')]);return _0x4f698e(_0x83e0f5['error'][_0xa44d('0x16')]);}else{logger[_0xa44d('0x11')](_0xa44d('0x17'),_0x308e67,'request\x20sent');_0x4f698e(_0x83e0f5[_0xa44d('0x18')][_0xa44d('0x16')]);}})['catch'](function(_0x5c3b46){logger['error'](_0xa44d('0x17'),_0x308e67,_0x5c3b46);_0xbb8559(_0x5c3b46);});});}exports['UpdateSmsInteraction']=function(_0x48324e){var _0x2559cd=this;return new Promise(function(_0x54fb13,_0x3d53b8){return db[_0xa44d('0x19')][_0xa44d('0x1a')](_0x48324e['body'],{'raw':_0x48324e[_0xa44d('0x1b')]?_0x48324e[_0xa44d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48324e[_0xa44d('0x1b')]?_0x48324e[_0xa44d('0x1b')][_0xa44d('0x1c')]||null:null,'attributes':_0x48324e[_0xa44d('0x1b')]?_0x48324e[_0xa44d('0x1b')][_0xa44d('0x1d')]||null:null,'limit':_0x48324e[_0xa44d('0x1b')]?_0x48324e['options'][_0xa44d('0x1e')]||null:null})['then'](function(_0x10c0a9){logger['info'](_0xa44d('0x1f'),_0x48324e);logger[_0xa44d('0x12')](_0xa44d('0x1f'),_0x48324e,JSON[_0xa44d('0x13')](_0x10c0a9));_0x54fb13(_0x10c0a9);})['catch'](function(_0x695f6){logger['error']('UpdateSmsInteraction',_0x695f6[_0xa44d('0x16')],_0x48324e);_0x3d53b8(_0x2559cd['error'](0x1f4,_0x695f6[_0xa44d('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x20f1e9){return new Promise(function(_0x3bf33b,_0x5a7309){return db[_0xa44d('0x19')][_0xa44d('0x20')]({'where':_0x20f1e9[_0xa44d('0x1b')]?_0x20f1e9['options'][_0xa44d('0x1c')]||null:null})[_0xa44d('0x10')](function(_0x34ed87){if(_0x34ed87){return _0x34ed87[_0xa44d('0x21')](_0x20f1e9[_0xa44d('0x22')][_0xa44d('0x23')],_[_0xa44d('0x24')](_0x20f1e9[_0xa44d('0x22')],[_0xa44d('0x23'),'id'])||{});}})[_0xa44d('0x25')](function(_0x5b4d98){logger[_0xa44d('0x11')]('AddTags',_0x20f1e9);logger[_0xa44d('0x12')]('AddTags',_0x20f1e9,JSON['stringify'](_0x5b4d98));_0x3bf33b(_0x5b4d98);})[_0xa44d('0x26')](function(_0x389af9){logger[_0xa44d('0x14')](_0xa44d('0x27'),_0x389af9[_0xa44d('0x16')],_0x20f1e9);_0x5a7309(_this['error'](0x1f4,_0x389af9['message']));});});}; \ No newline at end of file +var _0x4f98=['AddTagsToSmsInteraction','find','ids','spread','AddTags','lodash','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x2c4519,_0x4c6e69){var _0x17cfa1=function(_0xcfa228){while(--_0xcfa228){_0x2c4519['push'](_0x2c4519['shift']());}};_0x17cfa1(++_0x4c6e69);}(_0x4f98,0x7a));var _0x84f9=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x4f98[_0x5192de];return _0x4e287e;};'use strict';var _=require(_0x84f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84f9('0x1'))['db'];var utils=require(_0x84f9('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x84f9('0x3'));var jayson=require(_0x84f9('0x4'));var client=jayson[_0x84f9('0x5')]['http']({'port':0x232a});config[_0x84f9('0x6')]=_[_0x84f9('0x7')](config[_0x84f9('0x6')],{'host':_0x84f9('0x8'),'port':0x18eb});var socket=require(_0x84f9('0x9'))(new Redis(config[_0x84f9('0x6')]));require(_0x84f9('0xa'))[_0x84f9('0xb')](socket);function respondWithRpcPromise(_0x48bc43,_0x5d6d34,_0x30ec4e){return new BPromise(function(_0x20026b,_0xbc92f0){return client[_0x84f9('0xc')](_0x48bc43,_0x30ec4e)[_0x84f9('0xd')](function(_0x392b35){logger[_0x84f9('0xe')](_0x84f9('0xf'),_0x5d6d34,_0x84f9('0x10'));logger[_0x84f9('0x11')](_0x84f9('0x12'),_0x5d6d34,_0x84f9('0x10'),JSON[_0x84f9('0x13')](_0x392b35));if(_0x392b35[_0x84f9('0x14')]){if(_0x392b35['error'][_0x84f9('0x15')]===0x1f4){logger['error'](_0x84f9('0xf'),_0x5d6d34,_0x392b35[_0x84f9('0x14')]['message']);return _0xbc92f0(_0x392b35[_0x84f9('0x14')][_0x84f9('0x16')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x5d6d34,_0x392b35[_0x84f9('0x14')][_0x84f9('0x16')]);return _0x20026b(_0x392b35[_0x84f9('0x14')][_0x84f9('0x16')]);}else{logger[_0x84f9('0xe')](_0x84f9('0xf'),_0x5d6d34,_0x84f9('0x10'));_0x20026b(_0x392b35[_0x84f9('0x17')][_0x84f9('0x16')]);}})[_0x84f9('0x18')](function(_0x258f6b){logger['error'](_0x84f9('0xf'),_0x5d6d34,_0x258f6b);_0xbc92f0(_0x258f6b);});});}exports[_0x84f9('0x19')]=function(_0x33e171){var _0x563f9d=this;return new Promise(function(_0x452e30,_0x324c38){return db[_0x84f9('0x1a')][_0x84f9('0x1b')](_0x33e171[_0x84f9('0x1c')],{'raw':_0x33e171[_0x84f9('0x1d')]?_0x33e171[_0x84f9('0x1d')][_0x84f9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33e171[_0x84f9('0x1d')]?_0x33e171[_0x84f9('0x1d')][_0x84f9('0x1f')]||null:null,'attributes':_0x33e171['options']?_0x33e171[_0x84f9('0x1d')][_0x84f9('0x20')]||null:null,'limit':_0x33e171[_0x84f9('0x1d')]?_0x33e171['options'][_0x84f9('0x21')]||null:null})[_0x84f9('0xd')](function(_0x1cf512){logger['info'](_0x84f9('0x19'),_0x33e171);logger[_0x84f9('0x11')](_0x84f9('0x19'),_0x33e171,JSON[_0x84f9('0x13')](_0x1cf512));_0x452e30(_0x1cf512);})[_0x84f9('0x18')](function(_0x3f4600){logger['error'](_0x84f9('0x19'),_0x3f4600[_0x84f9('0x16')],_0x33e171);_0x324c38(_0x563f9d[_0x84f9('0x14')](0x1f4,_0x3f4600[_0x84f9('0x16')]));});});};exports[_0x84f9('0x22')]=function(_0x282279){return new Promise(function(_0x304ca7,_0x271793){return db[_0x84f9('0x1a')][_0x84f9('0x23')]({'where':_0x282279[_0x84f9('0x1d')]?_0x282279[_0x84f9('0x1d')][_0x84f9('0x1f')]||null:null})[_0x84f9('0xd')](function(_0x84ee57){if(_0x84ee57){return _0x84ee57['addTags'](_0x282279[_0x84f9('0x1c')]['ids'],_['omit'](_0x282279[_0x84f9('0x1c')],[_0x84f9('0x24'),'id'])||{});}})[_0x84f9('0x25')](function(_0x8a4c3){logger[_0x84f9('0xe')]('AddTags',_0x282279);logger[_0x84f9('0x11')](_0x84f9('0x26'),_0x282279,JSON[_0x84f9('0x13')](_0x8a4c3));_0x304ca7(_0x8a4c3);})[_0x84f9('0x18')](function(_0xccc367){logger[_0x84f9('0x14')]('AddTags',_0xccc367['message'],_0x282279);_0x271793(_this[_0x84f9('0x14')](0x1f4,_0xccc367[_0x84f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e0dd47f..6c649ed 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ff9=['./smsInteraction.events','save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x539f6a,_0x1ae661){var _0x353409=function(_0x51d22b){while(--_0x51d22b){_0x539f6a['push'](_0x539f6a['shift']());}};_0x353409(++_0x1ae661);}(_0x7ff9,0x170));var _0x97ff=function(_0xdd0d8d,_0x2ef50a){_0xdd0d8d=_0xdd0d8d-0x0;var _0x4d11e0=_0x7ff9[_0xdd0d8d];return _0x4d11e0;};'use strict';var SmsInteractionEvents=require(_0x97ff('0x0'));var events=[_0x97ff('0x1'),_0x97ff('0x2'),_0x97ff('0x3')];function createListener(_0x52a358,_0x35cb3b){return function(_0x423e42){_0x35cb3b['emit'](_0x52a358,_0x423e42);};}function removeListener(_0x2c1ee6,_0x2c3900){return function(){SmsInteractionEvents[_0x97ff('0x4')](_0x2c1ee6,_0x2c3900);};}exports[_0x97ff('0x5')]=function(_0x3b5672){for(var _0x1b87b5=0x0,_0xca26a9=events[_0x97ff('0x6')];_0x1b87b5<_0xca26a9;_0x1b87b5++){var _0x15477b=events[_0x1b87b5];var _0x419767=createListener(_0x97ff('0x7')+_0x15477b,_0x3b5672);SmsInteractionEvents['on'](_0x15477b,_0x419767);}}; \ No newline at end of file +var _0x3e82=['./smsInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x31c80d,_0x409867){var _0x4515fa=function(_0xf8a1b1){while(--_0xf8a1b1){_0x31c80d['push'](_0x31c80d['shift']());}};_0x4515fa(++_0x409867);}(_0x3e82,0x85));var _0x23e8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3e82[_0x321bb2];return _0x9c12ed;};'use strict';var SmsInteractionEvents=require(_0x23e8('0x0'));var events=[_0x23e8('0x1'),'remove',_0x23e8('0x2')];function createListener(_0x56d1ce,_0x5934e3){return function(_0x516057){_0x5934e3[_0x23e8('0x3')](_0x56d1ce,_0x516057);};}function removeListener(_0x5be74c,_0x3e8059){return function(){SmsInteractionEvents[_0x23e8('0x4')](_0x5be74c,_0x3e8059);};}exports[_0x23e8('0x5')]=function(_0xa11837){for(var _0xea1870=0x0,_0x3c6d6c=events[_0x23e8('0x6')];_0xea1870<_0x3c6d6c;_0xea1870++){var _0x3917c7=events[_0xea1870];var _0x3f4c7a=createListener('smsInteraction:'+_0x3917c7,_0xa11837);SmsInteractionEvents['on'](_0x3917c7,_0x3f4c7a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 7e5871d..64ac259 100644 --- a/server/api/smsMessage/index.js +++ b/server/api/smsMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e0e=['describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe'];(function(_0x4e7844,_0x30ce77){var _0x336119=function(_0x508b1c){while(--_0x508b1c){_0x4e7844['push'](_0x4e7844['shift']());}};_0x336119(++_0x30ce77);}(_0x5e0e,0x1c3));var _0xe5e0=function(_0x410612,_0x551c48){_0x410612=_0x410612-0x0;var _0xbfa860=_0x5e0e[_0x410612];return _0xbfa860;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require(_0xe5e0('0x2'));var timeout=require(_0xe5e0('0x3'));var express=require(_0xe5e0('0x4'));var router=express[_0xe5e0('0x5')]();var fs_extra=require(_0xe5e0('0x6'));var auth=require(_0xe5e0('0x7'));var interaction=require(_0xe5e0('0x8'));var config=require(_0xe5e0('0x9'));var controller=require(_0xe5e0('0xa'));router[_0xe5e0('0xb')]('/',auth[_0xe5e0('0xc')](),controller['index']);router[_0xe5e0('0xb')](_0xe5e0('0xd'),auth[_0xe5e0('0xc')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0xb')](_0xe5e0('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xe5e0('0x10')]('/',auth[_0xe5e0('0xc')](),interaction[_0xe5e0('0x11')](_0xe5e0('0x12'),_0xe5e0('0x13')),controller[_0xe5e0('0x14')]);router[_0xe5e0('0x10')](_0xe5e0('0x15'),controller[_0xe5e0('0x16')]);router[_0xe5e0('0x17')](_0xe5e0('0xf'),auth[_0xe5e0('0xc')](),controller['update']);router['put'](_0xe5e0('0x18'),auth['isAuthenticated'](),controller[_0xe5e0('0x19')]);router[_0xe5e0('0x17')](_0xe5e0('0x1a'),auth[_0xe5e0('0xc')](),controller[_0xe5e0('0x1b')]);router[_0xe5e0('0x1c')](_0xe5e0('0xf'),auth['isAuthenticated'](),controller[_0xe5e0('0x1d')]);module[_0xe5e0('0x1e')]=router; \ No newline at end of file +var _0xb935=['express','Router','fs-extra','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb935,0x6c));var _0x5b93=function(_0x1c1903,_0x1efec5){_0x1c1903=_0x1c1903-0x0;var _0x251b8d=_0xb935[_0x1c1903];return _0x251b8d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5b93('0x0'));var router=express[_0x5b93('0x1')]();var fs_extra=require(_0x5b93('0x2'));var auth=require(_0x5b93('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b93('0x4'));router[_0x5b93('0x5')]('/',auth[_0x5b93('0x6')](),controller[_0x5b93('0x7')]);router[_0x5b93('0x5')](_0x5b93('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x5b93('0x5')](_0x5b93('0x9'),auth[_0x5b93('0x6')](),controller[_0x5b93('0xa')]);router[_0x5b93('0xb')]('/',auth[_0x5b93('0x6')](),interaction[_0x5b93('0xc')](_0x5b93('0xd'),_0x5b93('0xe')),controller[_0x5b93('0xf')]);router[_0x5b93('0xb')](_0x5b93('0x10'),controller[_0x5b93('0x11')]);router[_0x5b93('0x12')](_0x5b93('0x9'),auth[_0x5b93('0x6')](),controller[_0x5b93('0x13')]);router['put'](_0x5b93('0x14'),auth[_0x5b93('0x6')](),controller[_0x5b93('0x15')]);router[_0x5b93('0x12')](_0x5b93('0x16'),auth[_0x5b93('0x6')](),controller[_0x5b93('0x17')]);router[_0x5b93('0x18')](_0x5b93('0x9'),auth[_0x5b93('0x6')](),controller[_0x5b93('0x19')]);module[_0x5b93('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index b6c8404..5384323 100644 --- a/server/api/smsMessage/smsMessage.attributes.js +++ b/server/api/smsMessage/smsMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f35=['DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3abdf9,_0x4da677){var _0x48270=function(_0x8c1a6f){while(--_0x8c1a6f){_0x3abdf9['push'](_0x3abdf9['shift']());}};_0x48270(++_0x4da677);}(_0x8f35,0x107));var _0x58f3=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x8f35[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0x58f3('0x0'));module[_0x58f3('0x1')]={'body':{'type':Sequelize['TEXT'](_0x58f3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x58f3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x58f3('0x4')]('in',_0x58f3('0x5')),'defaultValue':_0x58f3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x58f3('0x6')](0xbe)},'phone':{'type':Sequelize[_0x58f3('0x6')]},'readAt':{'type':Sequelize[_0x58f3('0x7')]},'secret':{'type':Sequelize[_0x58f3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x58f3('0x6')]},'providerResponse':{'type':Sequelize[_0x58f3('0x8')]}}; \ No newline at end of file +var _0x94ac=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x94ac,0x139));var _0xc94a=function(_0x142461,_0x7cd223){_0x142461=_0x142461-0x0;var _0x1c4241=_0x94ac[_0x142461];return _0x1c4241;};'use strict';var Sequelize=require(_0xc94a('0x0'));module[_0xc94a('0x1')]={'body':{'type':Sequelize[_0xc94a('0x2')](_0xc94a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc94a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc94a('0x5')]('in',_0xc94a('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc94a('0x7')](0xbe)},'phone':{'type':Sequelize[_0xc94a('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc94a('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6e49b3e..ea0d63e 100644 --- a/server/api/smsMessage/smsMessage.controller.js +++ b/server/api/smsMessage/smsMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14c7=['sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','User','fullname','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','type','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','results','groupName','infobip','eml-format','rimraf','zip-dir','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','sms-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager'];(function(_0x2497ba,_0x3bf4b5){var _0x306a03=function(_0x590d36){while(--_0x590d36){_0x2497ba['push'](_0x2497ba['shift']());}};_0x306a03(++_0x3bf4b5);}(_0x14c7,0x1d9));var _0x714c=function(_0x4552c5,_0x3bfcc3){_0x4552c5=_0x4552c5-0x0;var _0x3a7037=_0x14c7[_0x4552c5];return _0x3a7037;};'use strict';var emlformat=require(_0x714c('0x0'));var rimraf=require(_0x714c('0x1'));var zipdir=require(_0x714c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x714c('0x3'));var moment=require(_0x714c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x714c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x714c('0x6'));var ejs=require(_0x714c('0x7'));var fs=require('fs');var fs_extra=require(_0x714c('0x8'));var _=require(_0x714c('0x9'));var squel=require('squel');var crypto=require(_0x714c('0xa'));var jsforce=require(_0x714c('0xb'));var deskjs=require(_0x714c('0xc'));var toCsv=require(_0x714c('0x6'));var querystring=require(_0x714c('0xd'));var Papa=require('papaparse');var Redis=require(_0x714c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x714c('0xf'));var as=require(_0x714c('0x10'));var hardwareService=require(_0x714c('0x11'));var logger=require(_0x714c('0x12'))(_0x714c('0x13'));var utils=require(_0x714c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x714c('0x15'));var db=require('../../mysqldb')['db'];config[_0x714c('0x16')]=_[_0x714c('0x17')](config[_0x714c('0x16')],{'host':_0x714c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x714c('0x16')]));require(_0x714c('0x19'))[_0x714c('0x1a')](socket);var jayson=require(_0x714c('0x1b'));var client=jayson[_0x714c('0x1c')][_0x714c('0x1d')]({'port':0x232c});var client9002=jayson[_0x714c('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa35b1e,_0x45674f,_0x2fadfb,_0x44561e){return new BPromise(function(_0x401c62,_0x37e637){var _0x2d5ad8=_0x44561e||client;return _0x2d5ad8[_0x714c('0x1e')](_0xa35b1e,_0x2fadfb)[_0x714c('0x1f')](function(_0x249aef){logger[_0x714c('0x20')](_0x714c('0x21'),_0x45674f,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x45674f,'request\x20sent',JSON[_0x714c('0x22')](_0x249aef));if(_0x249aef[_0x714c('0x23')]){if(_0x249aef[_0x714c('0x23')][_0x714c('0x24')]===0x1f4){logger[_0x714c('0x23')](_0x714c('0x21'),_0x45674f,_0x249aef[_0x714c('0x23')]['message']);return _0x37e637(_0x249aef['error'][_0x714c('0x25')]);}logger[_0x714c('0x23')](_0x714c('0x21'),_0x45674f,_0x249aef[_0x714c('0x23')]['message']);return _0x401c62(_0x249aef['error'][_0x714c('0x25')]);}else{logger[_0x714c('0x20')](_0x714c('0x21'),_0x45674f,_0x714c('0x26'));_0x401c62(_0x249aef[_0x714c('0x27')]['message']);}})[_0x714c('0x28')](function(_0xa9bc93){logger[_0x714c('0x23')](_0x714c('0x21'),_0x45674f,_0xa9bc93);_0x37e637(_0xa9bc93);});});}function respondWithStatusCode(_0x41ea23,_0x3cad28){_0x3cad28=_0x3cad28||0xcc;return function(_0x4b6e19){if(_0x4b6e19){return _0x41ea23[_0x714c('0x29')](_0x3cad28);}return _0x41ea23['status'](_0x3cad28)[_0x714c('0x2a')]();};}function respondWithResult(_0x3cdb80,_0x342a95){_0x342a95=_0x342a95||0xc8;return function(_0x43979d){if(_0x43979d){return _0x3cdb80[_0x714c('0x2b')](_0x342a95)[_0x714c('0x2c')](_0x43979d);}};}function respondWithFilteredResult(_0x965577,_0x17dea7){return function(_0x45a470){if(_0x45a470){var _0x109162=typeof _0x17dea7[_0x714c('0x2d')]===_0x714c('0x2e')&&typeof _0x17dea7[_0x714c('0x2f')]===_0x714c('0x2e');var _0x38f1c2=_0x45a470['count'];var _0x4765fa=_0x109162?0x0:_0x17dea7[_0x714c('0x2d')];var _0x539556=_0x109162?_0x45a470[_0x714c('0x30')]:_0x17dea7['offset']+_0x17dea7[_0x714c('0x2f')];var _0xdc2d1a;if(_0x539556>=_0x38f1c2){_0x539556=_0x38f1c2;_0xdc2d1a=0xc8;}else{_0xdc2d1a=0xce;}_0x965577['status'](_0xdc2d1a);return _0x965577['set']('Content-Range',_0x4765fa+'-'+_0x539556+'/'+_0x38f1c2)[_0x714c('0x2c')](_0x45a470);}return null;};}function patchUpdates(_0x2e8fae){return function(_0x4e4d7f){try{jsonpatch[_0x714c('0x31')](_0x4e4d7f,_0x2e8fae,!![]);}catch(_0x44d107){return BPromise[_0x714c('0x32')](_0x44d107);}return _0x4e4d7f[_0x714c('0x33')]();};}function saveUpdates(_0xd37fa4,_0x2da507){return function(_0x288eb4){if(_0x288eb4){return _0x288eb4[_0x714c('0x34')](_0xd37fa4)[_0x714c('0x1f')](function(_0x542450){return _0x542450;});}return null;};}function removeEntity(_0x1040cd,_0x12ba98){return function(_0x1e1180){if(_0x1e1180){return _0x1e1180[_0x714c('0x35')]()['then'](function(){_0x1040cd[_0x714c('0x2b')](0xcc)[_0x714c('0x2a')]();});}};}function handleEntityNotFound(_0x9b7973,_0x12c6f3){return function(_0x37ab45){if(!_0x37ab45){_0x9b7973[_0x714c('0x29')](0x194);}return _0x37ab45;};}function handleError(_0x4f91e2,_0x205991){_0x205991=_0x205991||0x1f4;return function(_0x3da28c){logger['error'](_0x3da28c['stack']);if(_0x3da28c[_0x714c('0x36')]){delete _0x3da28c[_0x714c('0x36')];}_0x4f91e2['status'](_0x205991)[_0x714c('0x37')](_0x3da28c);};}exports[_0x714c('0x38')]=function(_0x4c0e2c,_0x3d15b7){var _0xdb1bc8={},_0xf5469e={},_0x1a9e8d={'count':0x0,'rows':[]};var _0x307141=_[_0x714c('0x39')](db[_0x714c('0x3a')][_0x714c('0x3b')],function(_0x3782bf){return{'name':_0x3782bf[_0x714c('0x3c')],'type':_0x3782bf['type'][_0x714c('0x3d')]};});_0xf5469e['model']=_[_0x714c('0x39')](_0x307141,_0x714c('0x36'));_0xf5469e[_0x714c('0x3e')]=_[_0x714c('0x3f')](_0x4c0e2c[_0x714c('0x3e')]);_0xf5469e[_0x714c('0x40')]=_[_0x714c('0x41')](_0xf5469e[_0x714c('0x42')],_0xf5469e[_0x714c('0x3e')]);_0xdb1bc8['attributes']=_[_0x714c('0x41')](_0xf5469e[_0x714c('0x42')],qs[_0x714c('0x43')](_0x4c0e2c[_0x714c('0x3e')][_0x714c('0x43')]));_0xdb1bc8[_0x714c('0x44')]=_0xdb1bc8['attributes'][_0x714c('0x45')]?_0xdb1bc8[_0x714c('0x44')]:_0xf5469e[_0x714c('0x42')];if(!_0x4c0e2c[_0x714c('0x3e')][_0x714c('0x46')](_0x714c('0x47'))){_0xdb1bc8[_0x714c('0x2f')]=qs[_0x714c('0x2f')](_0x4c0e2c[_0x714c('0x3e')][_0x714c('0x2f')]);_0xdb1bc8[_0x714c('0x2d')]=qs['offset'](_0x4c0e2c[_0x714c('0x3e')][_0x714c('0x2d')]);}_0xdb1bc8[_0x714c('0x48')]=qs[_0x714c('0x49')](_0x4c0e2c[_0x714c('0x3e')][_0x714c('0x49')]);_0xdb1bc8[_0x714c('0x4a')]=qs['filters'](_[_0x714c('0x4b')](_0x4c0e2c[_0x714c('0x3e')],_0xf5469e[_0x714c('0x40')]),_0x307141);if(_0x4c0e2c[_0x714c('0x3e')][_0x714c('0x4c')]){_0xdb1bc8[_0x714c('0x4a')]=_[_0x714c('0x4d')](_0xdb1bc8[_0x714c('0x4a')],{'$or':_[_0x714c('0x39')](_0x307141,function(_0x21212f){if(_0x21212f['type']!==_0x714c('0x4e')){var _0x4bb3bb={};_0x4bb3bb[_0x21212f[_0x714c('0x36')]]={'$like':'%'+_0x4c0e2c['query'][_0x714c('0x4c')]+'%'};return _0x4bb3bb;}})});}_0xdb1bc8=_['merge']({},_0xdb1bc8,_0x4c0e2c[_0x714c('0x4f')]);var _0x36c9f9={'where':_0xdb1bc8[_0x714c('0x4a')]};return db['SmsMessage'][_0x714c('0x30')](_0x36c9f9)[_0x714c('0x1f')](function(_0x2cfbd0){_0x1a9e8d['count']=_0x2cfbd0;if(_0x4c0e2c[_0x714c('0x3e')][_0x714c('0x50')]){_0xdb1bc8[_0x714c('0x51')]=[{'all':!![]}];}return db[_0x714c('0x3a')][_0x714c('0x52')](_0xdb1bc8);})[_0x714c('0x1f')](function(_0x3785c1){_0x1a9e8d[_0x714c('0x53')]=_0x3785c1;return _0x1a9e8d;})[_0x714c('0x1f')](respondWithFilteredResult(_0x3d15b7,_0xdb1bc8))[_0x714c('0x28')](handleError(_0x3d15b7,null));};exports[_0x714c('0x54')]=function(_0x21c7db,_0x80746b){var _0x297f3a={'raw':!![],'where':{'id':_0x21c7db[_0x714c('0x55')]['id']}},_0x30a595={};_0x30a595[_0x714c('0x42')]=_[_0x714c('0x3f')](db['SmsMessage'][_0x714c('0x3b')]);_0x30a595[_0x714c('0x3e')]=_[_0x714c('0x3f')](_0x21c7db['query']);_0x30a595[_0x714c('0x40')]=_[_0x714c('0x41')](_0x30a595[_0x714c('0x42')],_0x30a595[_0x714c('0x3e')]);_0x297f3a[_0x714c('0x44')]=_[_0x714c('0x41')](_0x30a595[_0x714c('0x42')],qs['fields'](_0x21c7db[_0x714c('0x3e')]['fields']));_0x297f3a[_0x714c('0x44')]=_0x297f3a['attributes'][_0x714c('0x45')]?_0x297f3a[_0x714c('0x44')]:_0x30a595['model'];if(_0x21c7db[_0x714c('0x3e')][_0x714c('0x50')]){_0x297f3a[_0x714c('0x51')]=[{'all':!![]}];}_0x297f3a=_[_0x714c('0x4d')]({},_0x297f3a,_0x21c7db[_0x714c('0x4f')]);return db['SmsMessage']['find'](_0x297f3a)[_0x714c('0x1f')](handleEntityNotFound(_0x80746b,null))[_0x714c('0x1f')](respondWithResult(_0x80746b,null))['catch'](handleError(_0x80746b,null));};exports[_0x714c('0x56')]=function(_0x3f2e98,_0xf6c12f){return db[_0x714c('0x3a')][_0x714c('0x56')](_0x3f2e98[_0x714c('0x57')],{})[_0x714c('0x1f')](respondWithResult(_0xf6c12f,0xc9))[_0x714c('0x28')](handleError(_0xf6c12f,null));};exports['update']=function(_0x4af34f,_0xf0dfcf){if(_0x4af34f[_0x714c('0x57')]['id']){delete _0x4af34f[_0x714c('0x57')]['id'];}return db['SmsMessage'][_0x714c('0x58')]({'where':{'id':_0x4af34f[_0x714c('0x55')]['id']}})[_0x714c('0x1f')](handleEntityNotFound(_0xf0dfcf,null))[_0x714c('0x1f')](saveUpdates(_0x4af34f[_0x714c('0x57')],null))[_0x714c('0x1f')](respondWithResult(_0xf0dfcf,null))[_0x714c('0x28')](handleError(_0xf0dfcf,null));};exports['destroy']=function(_0x2ffedc,_0x30a349){return db['SmsMessage'][_0x714c('0x58')]({'where':{'id':_0x2ffedc[_0x714c('0x55')]['id']}})['then'](handleEntityNotFound(_0x30a349,null))[_0x714c('0x1f')](removeEntity(_0x30a349,null))[_0x714c('0x28')](handleError(_0x30a349,null));};exports[_0x714c('0x59')]=function(_0x5b72fa,_0x1144e5){return db['SmsMessage'][_0x714c('0x59')]()[_0x714c('0x1f')](respondWithResult(_0x1144e5,null))[_0x714c('0x28')](handleError(_0x1144e5,null));};var interaction_log=require(_0x714c('0x12'))(_0x714c('0x5a'));exports[_0x714c('0x5b')]=function(_0x43c3b6,_0x127ec2,_0x3ec9f1){var _0x1f90ac={'agent':{},'channel':'sms'};if(_0x43c3b6[_0x714c('0x57')]['id']){delete _0x43c3b6[_0x714c('0x57')]['id'];}_0x43c3b6[_0x714c('0x57')][_0x714c('0x5c')]=!![];_0x43c3b6['body']['readAt']=moment()[_0x714c('0x5d')](_0x714c('0x5e'));_0x43c3b6[_0x714c('0x57')][_0x714c('0x5f')]=_0x43c3b6[_0x714c('0x57')][_0x714c('0x5f')]||_0x43c3b6[_0x714c('0x60')]['id'];_0x1f90ac['agent']['id']=_0x43c3b6['body']['UserId'];return db['SmsMessage'][_0x714c('0x58')]({'where':{'id':_0x43c3b6[_0x714c('0x55')]['id'],'UserId':null}})[_0x714c('0x1f')](handleEntityNotFound(_0x127ec2,null))[_0x714c('0x1f')](saveUpdates(_0x43c3b6['body'],null))[_0x714c('0x1f')](function(_0x983a1e){if(_0x983a1e){_0x1f90ac[_0x714c('0x25')]=_0x983a1e[_0x714c('0x61')]({'plain':!![]});return db[_0x714c('0x62')][_0x714c('0x58')]({'where':{'id':_0x983a1e[_0x714c('0x63')]}});}return null;})[_0x714c('0x1f')](handleEntityNotFound(_0x127ec2,null))[_0x714c('0x1f')](function(_0x1e671e){if(_0x1e671e){return _0x1e671e[_0x714c('0x34')]({'UserId':_0x43c3b6[_0x714c('0x57')][_0x714c('0x5f')],'read1stAt':_[_0x714c('0x64')](_0x1e671e[_0x714c('0x65')])?moment()[_0x714c('0x5d')](_0x714c('0x5e')):undefined});}return null;})['then'](function(_0x548b88){if(_0x548b88){_0x1f90ac['interaction']=_0x548b88[_0x714c('0x61')]({'plain':!![]});interaction_log[_0x714c('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43c3b6[_0x714c('0x60')]['id'],_0x43c3b6['user'][_0x714c('0x36')],_0x43c3b6[_0x714c('0x60')][_0x714c('0x66')],_0x1f90ac[_0x714c('0x67')]['id'],_0x43c3b6[_0x714c('0x57')]?JSON[_0x714c('0x22')](_0x43c3b6[_0x714c('0x57')]):_0x714c('0x68'));return respondWithRpcPromise(_0x714c('0x69'),_0x714c('0x6a'),_0x1f90ac);}return null;})[_0x714c('0x1f')](function(_0x659d79){var _0x355a72=_0x714c('0x6b')+_0x659d79[_0x714c('0x25')][_0x714c('0x6c')];return db[_0x714c('0x6d')][_0x714c('0x3e')](_0x355a72,{'type':db[_0x714c('0x6e')][_0x714c('0x6f')]['SELECT'],'raw':!![]})[_0x714c('0x1f')](function(_0x3e8d00){return _0x3e8d00;});})[_0x714c('0x1f')](function(_0x3b410b){if(_0x3b410b){_0x1f90ac[_0x714c('0x25')][_0x714c('0x70')]=_0x3b410b[0x0];if(!_0x43c3b6[_0x714c('0x57')][_0x714c('0x5f')])return;return db['User'][_0x714c('0x58')]({'where':{'id':_0x43c3b6[_0x714c('0x57')][_0x714c('0x5f')],'role':_0x714c('0x71')},'attributes':['id','name','fullname',_0x714c('0x72'),_0x714c('0x73')],'raw':!![]});}return null;})[_0x714c('0x1f')](function(_0x3a18c3){if(!_0x3a18c3)return null;_0x1f90ac[_0x714c('0x25')]['agent']=_0x3a18c3;return _0x1f90ac;})[_0x714c('0x1f')](function(_0x3fdbfe){if(_0x3fdbfe){if(_0x43c3b6[_0x714c('0x57')][_0x714c('0x74')]){_0x1f90ac['message'][_0x714c('0x75')]=util['format'](_0x714c('0x76'),_0x43c3b6['user'][_0x714c('0x36')]);_0x1f90ac['message'][_0x714c('0x77')]=_0x1f90ac[_0x714c('0x77')];_0x1f90ac['message'][_0x714c('0x78')]=_0x1f90ac[_0x714c('0x77')];_0x1f90ac[_0x714c('0x25')][_0x714c('0x79')]=_0x714c('0x5b');return respondWithRpcPromise(_0x714c('0x7a'),_0x714c('0x7a'),{'event':'acceptmessage','message':_0x1f90ac[_0x714c('0x25')]},client9002)[_0x714c('0x1f')](function(){return _0x1f90ac;});}return _0x1f90ac;}return null;})['then'](respondWithResult(_0x127ec2,null))['catch'](handleError(_0x127ec2,null));};var interaction_log=require(_0x714c('0x12'))(_0x714c('0x5a'));exports[_0x714c('0x32')]=function(_0x292a15,_0x16d40d,_0x4cd8a5){var _0x193041={'agent':{},'channel':_0x714c('0x7b')};if(_0x292a15[_0x714c('0x57')]['id']){delete _0x292a15['body']['id'];}_0x292a15['body'][_0x714c('0x5f')]=_0x292a15[_0x714c('0x57')][_0x714c('0x5f')]||_0x292a15[_0x714c('0x60')]['id'];_0x193041['agent']['id']=_0x292a15['body'][_0x714c('0x5f')];return db['SmsMessage'][_0x714c('0x58')]({'where':{'id':_0x292a15[_0x714c('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x16d40d,null))['then'](function(_0x972383){if(_0x972383){_0x193041[_0x714c('0x25')]=_0x972383[_0x714c('0x61')]({'plain':!![]});return db[_0x714c('0x62')][_0x714c('0x58')]({'where':{'id':_0x972383[_0x714c('0x63')]}});}return null;})[_0x714c('0x1f')](handleEntityNotFound(_0x16d40d,null))[_0x714c('0x1f')](function(_0x359d1c){if(_0x359d1c){_0x193041['interaction']=_0x359d1c[_0x714c('0x61')]({'plain':!![]});interaction_log[_0x714c('0x20')](_0x714c('0x7c'),_0x292a15['user']['id'],_0x292a15[_0x714c('0x60')][_0x714c('0x36')],_0x292a15['user']['role'],_0x193041[_0x714c('0x67')]['id'],_0x292a15['body']?JSON[_0x714c('0x22')](_0x292a15['body']):_0x714c('0x68'));return respondWithRpcPromise(_0x714c('0x7d'),'rejectMessage',_0x193041);}return null;})[_0x714c('0x1f')](function(_0x40c701){var _0x49830e=_0x714c('0x6b')+_0x40c701[_0x714c('0x25')][_0x714c('0x6c')];return db['sequelize'][_0x714c('0x3e')](_0x49830e,{'type':db[_0x714c('0x6e')][_0x714c('0x6f')][_0x714c('0x7e')],'raw':!![]})['then'](function(_0x4df9df){return _0x4df9df;});})[_0x714c('0x1f')](function(_0x4823aa){if(_0x4823aa){_0x193041[_0x714c('0x25')][_0x714c('0x70')]=_0x4823aa[0x0];if(!_0x292a15[_0x714c('0x57')][_0x714c('0x5f')])return;return db[_0x714c('0x7f')][_0x714c('0x58')]({'where':{'id':_0x292a15[_0x714c('0x57')][_0x714c('0x5f')],'role':_0x714c('0x71')},'attributes':['id',_0x714c('0x36'),_0x714c('0x80'),_0x714c('0x72'),'internal'],'raw':!![]});}return null;})[_0x714c('0x1f')](function(_0x287fa3){if(!_0x287fa3)return null;_0x193041[_0x714c('0x25')][_0x714c('0x71')]=_0x287fa3;return _0x193041;})[_0x714c('0x1f')](function(_0x740edd){if(_0x740edd){_0x740edd[_0x714c('0x25')]['interface']=util[_0x714c('0x5d')](_0x714c('0x76'),_0x292a15[_0x714c('0x60')][_0x714c('0x36')]);_0x740edd[_0x714c('0x25')][_0x714c('0x77')]=_0x193041['channel'];_0x740edd[_0x714c('0x25')][_0x714c('0x78')]=_0x193041[_0x714c('0x77')];_0x740edd[_0x714c('0x25')]['event']=_0x714c('0x32');respondWithRpcPromise(_0x714c('0x7a'),_0x714c('0x7a'),{'event':_0x714c('0x81'),'message':_0x740edd[_0x714c('0x25')]},client9002);return _0x193041;}return null;})[_0x714c('0x1f')](respondWithResult(_0x16d40d,null))[_0x714c('0x28')](handleError(_0x16d40d,null));};exports[_0x714c('0x2b')]=function(_0x28cbf7,_0x59560e,_0x353668){if(_0x28cbf7['body']['id']){delete _0x28cbf7[_0x714c('0x57')]['id'];}var _0x5433ff;return db[_0x714c('0x3a')][_0x714c('0x58')]({'where':{'id':_0x28cbf7['params']['id']}})[_0x714c('0x1f')](handleEntityNotFound(_0x59560e,null))[_0x714c('0x1f')](function(_0x32b707){if(_0x32b707){_0x5433ff=_0x32b707;return db[_0x714c('0x82')][_0x714c('0x58')]({'where':{'id':_0x32b707[_0x714c('0x83')]}});}})[_0x714c('0x1f')](handleEntityNotFound(_0x59560e,null))[_0x714c('0x1f')](function(_0x481a4a){if(_0x481a4a){logger[_0x714c('0x84')](_0x714c('0x85'),_0x714c('0x2b'),_0x714c('0x86'),_0x481a4a['type'],util[_0x714c('0x87')](_0x28cbf7[_0x714c('0x57')],{'showHidden':![],'depth':null}));switch(_0x481a4a[_0x714c('0x88')]){case'twilio':if(_0x28cbf7['body'][_0x714c('0x89')]&&_0x28cbf7['body'][_0x714c('0x89')]===_0x5433ff[_0x714c('0x8a')]){return _0x5433ff[_0x714c('0x34')]({'read':!![]});}else{logger[_0x714c('0x23')](_0x714c('0x8b'),_0x714c('0x2b'),'twilio',util[_0x714c('0x87')](_0x28cbf7['body'],{'showHidden':![],'depth':null}));}break;case _0x714c('0x8c'):if(_0x28cbf7[_0x714c('0x57')][_0x714c('0x8d')]&&_0x28cbf7['body'][_0x714c('0x8d')]===_0x5433ff['messageId']&&_[_0x714c('0x8e')](['sent',_0x714c('0x8f')],_0x28cbf7[_0x714c('0x57')][_0x714c('0x90')])>=0x0){return _0x5433ff['update']({'read':!![]});}else{logger[_0x714c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x714c('0x2b'),_0x714c('0x91'),util[_0x714c('0x87')](_0x28cbf7[_0x714c('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x19f890=_0x28cbf7[_0x714c('0x57')][_0x714c('0x92')][0x0];if(_0x19f890[_0x714c('0x2b')][_0x714c('0x93')]==='DELIVERED'){return _0x5433ff[_0x714c('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x714c('0x94'),util[_0x714c('0x87')](_0x28cbf7['body'],{'showHidden':![],'depth':null}));}break;}return _0x5433ff;}})[_0x714c('0x1f')](respondWithResult(_0x59560e,null))[_0x714c('0x28')](handleError(_0x59560e,null));}; \ No newline at end of file +var _0xcf61=['includeAll','include','findAll','rows','params','keys','length','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','type','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','infobip','results','groupName','DELIVERED','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x487e2d,_0x1fe8ba){var _0xe4457c=function(_0x394c39){while(--_0x394c39){_0x487e2d['push'](_0x487e2d['shift']());}};_0xe4457c(++_0x1fe8ba);}(_0xcf61,0xda));var _0x1cf6=function(_0x28c0ae,_0x5aa5ff){_0x28c0ae=_0x28c0ae-0x0;var _0xad7b1c=_0xcf61[_0x28c0ae];return _0xad7b1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cf6('0x0'));var zipdir=require(_0x1cf6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cf6('0x2'));var moment=require(_0x1cf6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1cf6('0x4'));var path=require(_0x1cf6('0x5'));var sox=require('sox');var csv=require(_0x1cf6('0x6'));var ejs=require(_0x1cf6('0x7'));var fs=require('fs');var fs_extra=require(_0x1cf6('0x8'));var _=require(_0x1cf6('0x9'));var squel=require(_0x1cf6('0xa'));var crypto=require('crypto');var jsforce=require(_0x1cf6('0xb'));var deskjs=require(_0x1cf6('0xc'));var toCsv=require(_0x1cf6('0x6'));var querystring=require(_0x1cf6('0xd'));var Papa=require(_0x1cf6('0xe'));var Redis=require(_0x1cf6('0xf'));var authService=require(_0x1cf6('0x10'));var qs=require(_0x1cf6('0x11'));var as=require(_0x1cf6('0x12'));var hardwareService=require(_0x1cf6('0x13'));var logger=require(_0x1cf6('0x14'))(_0x1cf6('0x15'));var utils=require(_0x1cf6('0x16'));var config=require(_0x1cf6('0x17'));var licenseUtil=require(_0x1cf6('0x18'));var db=require(_0x1cf6('0x19'))['db'];config['redis']=_[_0x1cf6('0x1a')](config[_0x1cf6('0x1b')],{'host':_0x1cf6('0x1c'),'port':0x18eb});var socket=require(_0x1cf6('0x1d'))(new Redis(config[_0x1cf6('0x1b')]));require('./smsMessage.socket')[_0x1cf6('0x1e')](socket);var jayson=require(_0x1cf6('0x1f'));var client=jayson[_0x1cf6('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x1cf6('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d239d,_0xfcfe28,_0x2271c9,_0x471445){return new BPromise(function(_0x6fb890,_0x594a84){var _0x306bc3=_0x471445||client;return _0x306bc3[_0x1cf6('0x21')](_0x9d239d,_0x2271c9)[_0x1cf6('0x22')](function(_0x28e7f2){logger[_0x1cf6('0x23')](_0x1cf6('0x24'),_0xfcfe28,_0x1cf6('0x25'));logger[_0x1cf6('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfcfe28,_0x1cf6('0x25'),JSON[_0x1cf6('0x27')](_0x28e7f2));if(_0x28e7f2[_0x1cf6('0x28')]){if(_0x28e7f2[_0x1cf6('0x28')][_0x1cf6('0x29')]===0x1f4){logger[_0x1cf6('0x28')](_0x1cf6('0x24'),_0xfcfe28,_0x28e7f2[_0x1cf6('0x28')][_0x1cf6('0x2a')]);return _0x594a84(_0x28e7f2['error'][_0x1cf6('0x2a')]);}logger[_0x1cf6('0x28')](_0x1cf6('0x24'),_0xfcfe28,_0x28e7f2[_0x1cf6('0x28')][_0x1cf6('0x2a')]);return _0x6fb890(_0x28e7f2[_0x1cf6('0x28')][_0x1cf6('0x2a')]);}else{logger[_0x1cf6('0x23')](_0x1cf6('0x24'),_0xfcfe28,_0x1cf6('0x25'));_0x6fb890(_0x28e7f2[_0x1cf6('0x2b')]['message']);}})[_0x1cf6('0x2c')](function(_0x5519bb){logger[_0x1cf6('0x28')](_0x1cf6('0x24'),_0xfcfe28,_0x5519bb);_0x594a84(_0x5519bb);});});}function respondWithStatusCode(_0x10292d,_0x2619f4){_0x2619f4=_0x2619f4||0xcc;return function(_0x5dde7d){if(_0x5dde7d){return _0x10292d[_0x1cf6('0x2d')](_0x2619f4);}return _0x10292d[_0x1cf6('0x2e')](_0x2619f4)[_0x1cf6('0x2f')]();};}function respondWithResult(_0x3e12b4,_0x53a844){_0x53a844=_0x53a844||0xc8;return function(_0x5a0543){if(_0x5a0543){return _0x3e12b4[_0x1cf6('0x2e')](_0x53a844)['json'](_0x5a0543);}};}function respondWithFilteredResult(_0x46faf8,_0x2b2d98){return function(_0x5ade2c){if(_0x5ade2c){var _0x4ded2c=typeof _0x2b2d98[_0x1cf6('0x30')]===_0x1cf6('0x31')&&typeof _0x2b2d98[_0x1cf6('0x32')]===_0x1cf6('0x31');var _0x1af028=_0x5ade2c[_0x1cf6('0x33')];var _0x335dac=_0x4ded2c?0x0:_0x2b2d98[_0x1cf6('0x30')];var _0x29b8f2=_0x4ded2c?_0x5ade2c[_0x1cf6('0x33')]:_0x2b2d98['offset']+_0x2b2d98[_0x1cf6('0x32')];var _0xa8c02a;if(_0x29b8f2>=_0x1af028){_0x29b8f2=_0x1af028;_0xa8c02a=0xc8;}else{_0xa8c02a=0xce;}_0x46faf8['status'](_0xa8c02a);return _0x46faf8['set'](_0x1cf6('0x34'),_0x335dac+'-'+_0x29b8f2+'/'+_0x1af028)[_0x1cf6('0x35')](_0x5ade2c);}return null;};}function patchUpdates(_0x44813a){return function(_0xcf92b6){try{jsonpatch[_0x1cf6('0x36')](_0xcf92b6,_0x44813a,!![]);}catch(_0x3b4b52){return BPromise['reject'](_0x3b4b52);}return _0xcf92b6[_0x1cf6('0x37')]();};}function saveUpdates(_0x3be6a2,_0x965adc){return function(_0x2b19be){if(_0x2b19be){return _0x2b19be[_0x1cf6('0x38')](_0x3be6a2)[_0x1cf6('0x22')](function(_0x16a858){return _0x16a858;});}return null;};}function removeEntity(_0xeb7d74,_0x1d88be){return function(_0x5b3a49){if(_0x5b3a49){return _0x5b3a49[_0x1cf6('0x39')]()[_0x1cf6('0x22')](function(){_0xeb7d74['status'](0xcc)[_0x1cf6('0x2f')]();});}};}function handleEntityNotFound(_0x3aba0d,_0x3dd3ff){return function(_0x3a494a){if(!_0x3a494a){_0x3aba0d[_0x1cf6('0x2d')](0x194);}return _0x3a494a;};}function handleError(_0x326737,_0x1bd4c1){_0x1bd4c1=_0x1bd4c1||0x1f4;return function(_0x1d3436){logger[_0x1cf6('0x28')](_0x1d3436['stack']);if(_0x1d3436[_0x1cf6('0x3a')]){delete _0x1d3436[_0x1cf6('0x3a')];}_0x326737[_0x1cf6('0x2e')](_0x1bd4c1)['send'](_0x1d3436);};}exports[_0x1cf6('0x3b')]=function(_0x245aff,_0x2d640c){var _0x2fefb9={},_0xc7889b={},_0x36e54c={'count':0x0,'rows':[]};var _0x27ef93=_[_0x1cf6('0x3c')](db[_0x1cf6('0x3d')][_0x1cf6('0x3e')],function(_0x59a7cf){return{'name':_0x59a7cf[_0x1cf6('0x3f')],'type':_0x59a7cf['type'][_0x1cf6('0x40')]};});_0xc7889b['model']=_[_0x1cf6('0x3c')](_0x27ef93,_0x1cf6('0x3a'));_0xc7889b[_0x1cf6('0x41')]=_['keys'](_0x245aff[_0x1cf6('0x41')]);_0xc7889b[_0x1cf6('0x42')]=_[_0x1cf6('0x43')](_0xc7889b[_0x1cf6('0x44')],_0xc7889b[_0x1cf6('0x41')]);_0x2fefb9[_0x1cf6('0x45')]=_[_0x1cf6('0x43')](_0xc7889b['model'],qs[_0x1cf6('0x46')](_0x245aff[_0x1cf6('0x41')][_0x1cf6('0x46')]));_0x2fefb9['attributes']=_0x2fefb9[_0x1cf6('0x45')]['length']?_0x2fefb9[_0x1cf6('0x45')]:_0xc7889b[_0x1cf6('0x44')];if(!_0x245aff[_0x1cf6('0x41')][_0x1cf6('0x47')](_0x1cf6('0x48'))){_0x2fefb9[_0x1cf6('0x32')]=qs[_0x1cf6('0x32')](_0x245aff[_0x1cf6('0x41')][_0x1cf6('0x32')]);_0x2fefb9[_0x1cf6('0x30')]=qs[_0x1cf6('0x30')](_0x245aff[_0x1cf6('0x41')][_0x1cf6('0x30')]);}_0x2fefb9['order']=qs['sort'](_0x245aff[_0x1cf6('0x41')][_0x1cf6('0x49')]);_0x2fefb9[_0x1cf6('0x4a')]=qs[_0x1cf6('0x42')](_[_0x1cf6('0x4b')](_0x245aff[_0x1cf6('0x41')],_0xc7889b[_0x1cf6('0x42')]),_0x27ef93);if(_0x245aff[_0x1cf6('0x41')][_0x1cf6('0x4c')]){_0x2fefb9[_0x1cf6('0x4a')]=_[_0x1cf6('0x4d')](_0x2fefb9['where'],{'$or':_[_0x1cf6('0x3c')](_0x27ef93,function(_0x1315bd){if(_0x1315bd['type']!==_0x1cf6('0x4e')){var _0x3de5cb={};_0x3de5cb[_0x1315bd[_0x1cf6('0x3a')]]={'$like':'%'+_0x245aff[_0x1cf6('0x41')]['filter']+'%'};return _0x3de5cb;}})});}_0x2fefb9=_[_0x1cf6('0x4d')]({},_0x2fefb9,_0x245aff[_0x1cf6('0x4f')]);var _0x2a0951={'where':_0x2fefb9[_0x1cf6('0x4a')]};return db[_0x1cf6('0x3d')][_0x1cf6('0x33')](_0x2a0951)[_0x1cf6('0x22')](function(_0x41867f){_0x36e54c[_0x1cf6('0x33')]=_0x41867f;if(_0x245aff['query'][_0x1cf6('0x50')]){_0x2fefb9[_0x1cf6('0x51')]=[{'all':!![]}];}return db[_0x1cf6('0x3d')][_0x1cf6('0x52')](_0x2fefb9);})[_0x1cf6('0x22')](function(_0xcb82af){_0x36e54c[_0x1cf6('0x53')]=_0xcb82af;return _0x36e54c;})[_0x1cf6('0x22')](respondWithFilteredResult(_0x2d640c,_0x2fefb9))[_0x1cf6('0x2c')](handleError(_0x2d640c,null));};exports['show']=function(_0x44efa4,_0x53c8ff){var _0x5c212b={'raw':!![],'where':{'id':_0x44efa4[_0x1cf6('0x54')]['id']}},_0x22c682={};_0x22c682[_0x1cf6('0x44')]=_[_0x1cf6('0x55')](db[_0x1cf6('0x3d')][_0x1cf6('0x3e')]);_0x22c682['query']=_[_0x1cf6('0x55')](_0x44efa4[_0x1cf6('0x41')]);_0x22c682[_0x1cf6('0x42')]=_[_0x1cf6('0x43')](_0x22c682[_0x1cf6('0x44')],_0x22c682[_0x1cf6('0x41')]);_0x5c212b[_0x1cf6('0x45')]=_[_0x1cf6('0x43')](_0x22c682[_0x1cf6('0x44')],qs['fields'](_0x44efa4[_0x1cf6('0x41')][_0x1cf6('0x46')]));_0x5c212b['attributes']=_0x5c212b['attributes'][_0x1cf6('0x56')]?_0x5c212b[_0x1cf6('0x45')]:_0x22c682[_0x1cf6('0x44')];if(_0x44efa4[_0x1cf6('0x41')][_0x1cf6('0x50')]){_0x5c212b[_0x1cf6('0x51')]=[{'all':!![]}];}_0x5c212b=_['merge']({},_0x5c212b,_0x44efa4['options']);return db[_0x1cf6('0x3d')]['find'](_0x5c212b)['then'](handleEntityNotFound(_0x53c8ff,null))[_0x1cf6('0x22')](respondWithResult(_0x53c8ff,null))[_0x1cf6('0x2c')](handleError(_0x53c8ff,null));};exports['create']=function(_0x2d2d30,_0x479e56){return db['SmsMessage'][_0x1cf6('0x57')](_0x2d2d30[_0x1cf6('0x58')],{})['then'](respondWithResult(_0x479e56,0xc9))[_0x1cf6('0x2c')](handleError(_0x479e56,null));};exports['update']=function(_0x29bc2c,_0xb6977c){if(_0x29bc2c[_0x1cf6('0x58')]['id']){delete _0x29bc2c['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x29bc2c['params']['id']}})[_0x1cf6('0x22')](handleEntityNotFound(_0xb6977c,null))['then'](saveUpdates(_0x29bc2c[_0x1cf6('0x58')],null))[_0x1cf6('0x22')](respondWithResult(_0xb6977c,null))[_0x1cf6('0x2c')](handleError(_0xb6977c,null));};exports[_0x1cf6('0x39')]=function(_0x1f5c32,_0xd45454){return db[_0x1cf6('0x3d')][_0x1cf6('0x59')]({'where':{'id':_0x1f5c32[_0x1cf6('0x54')]['id']}})[_0x1cf6('0x22')](handleEntityNotFound(_0xd45454,null))[_0x1cf6('0x22')](removeEntity(_0xd45454,null))[_0x1cf6('0x2c')](handleError(_0xd45454,null));};exports['describe']=function(_0x116bc1,_0x12e3f1){return db[_0x1cf6('0x3d')][_0x1cf6('0x5a')]()['then'](respondWithResult(_0x12e3f1,null))['catch'](handleError(_0x12e3f1,null));};var interaction_log=require(_0x1cf6('0x14'))(_0x1cf6('0x5b'));exports[_0x1cf6('0x5c')]=function(_0x130653,_0x4adaaf,_0x143016){var _0x193a9c={'agent':{},'channel':_0x1cf6('0x5d')};if(_0x130653['body']['id']){delete _0x130653[_0x1cf6('0x58')]['id'];}_0x130653[_0x1cf6('0x58')][_0x1cf6('0x5e')]=!![];_0x130653[_0x1cf6('0x58')][_0x1cf6('0x5f')]=moment()[_0x1cf6('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x130653[_0x1cf6('0x58')][_0x1cf6('0x61')]=_0x130653['body'][_0x1cf6('0x61')]||_0x130653[_0x1cf6('0x62')]['id'];_0x193a9c['agent']['id']=_0x130653[_0x1cf6('0x58')][_0x1cf6('0x61')];return db[_0x1cf6('0x3d')]['find']({'where':{'id':_0x130653['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4adaaf,null))[_0x1cf6('0x22')](saveUpdates(_0x130653[_0x1cf6('0x58')],null))[_0x1cf6('0x22')](function(_0x137f2d){if(_0x137f2d){_0x193a9c[_0x1cf6('0x2a')]=_0x137f2d[_0x1cf6('0x63')]({'plain':!![]});return db[_0x1cf6('0x64')][_0x1cf6('0x59')]({'where':{'id':_0x137f2d[_0x1cf6('0x65')]}});}return null;})[_0x1cf6('0x22')](handleEntityNotFound(_0x4adaaf,null))[_0x1cf6('0x22')](function(_0x5712c3){if(_0x5712c3){return _0x5712c3['update']({'UserId':_0x130653[_0x1cf6('0x58')]['UserId'],'read1stAt':_[_0x1cf6('0x66')](_0x5712c3['read1stAt'])?moment()[_0x1cf6('0x60')](_0x1cf6('0x67')):undefined});}return null;})[_0x1cf6('0x22')](function(_0x5a2645){if(_0x5a2645){_0x193a9c[_0x1cf6('0x68')]=_0x5a2645[_0x1cf6('0x63')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x130653[_0x1cf6('0x62')]['id'],_0x130653[_0x1cf6('0x62')][_0x1cf6('0x3a')],_0x130653[_0x1cf6('0x62')][_0x1cf6('0x69')],_0x193a9c[_0x1cf6('0x68')]['id'],_0x130653[_0x1cf6('0x58')]?JSON[_0x1cf6('0x27')](_0x130653['body']):_0x1cf6('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x1cf6('0x6b'),_0x193a9c);}return null;})[_0x1cf6('0x22')](function(_0x39fa3c){var _0x110693=_0x1cf6('0x6c')+_0x39fa3c[_0x1cf6('0x2a')][_0x1cf6('0x6d')];return db[_0x1cf6('0x6e')]['query'](_0x110693,{'type':db[_0x1cf6('0x6f')][_0x1cf6('0x70')][_0x1cf6('0x71')],'raw':!![]})[_0x1cf6('0x22')](function(_0x40e7a4){return _0x40e7a4;});})[_0x1cf6('0x22')](function(_0x4e7796){if(_0x4e7796){_0x193a9c[_0x1cf6('0x2a')][_0x1cf6('0x72')]=_0x4e7796[0x0];if(!_0x130653[_0x1cf6('0x58')][_0x1cf6('0x61')])return;return db[_0x1cf6('0x73')][_0x1cf6('0x59')]({'where':{'id':_0x130653['body'][_0x1cf6('0x61')],'role':'agent'},'attributes':['id',_0x1cf6('0x3a'),_0x1cf6('0x74'),_0x1cf6('0x75'),_0x1cf6('0x76')],'raw':!![]});}return null;})['then'](function(_0x196520){if(!_0x196520)return null;_0x193a9c[_0x1cf6('0x2a')][_0x1cf6('0x77')]=_0x196520;return _0x193a9c;})[_0x1cf6('0x22')](function(_0x34b4ae){if(_0x34b4ae){if(_0x130653[_0x1cf6('0x58')]['manual']){_0x193a9c[_0x1cf6('0x2a')][_0x1cf6('0x78')]=util[_0x1cf6('0x60')](_0x1cf6('0x79'),_0x130653[_0x1cf6('0x62')]['name']);_0x193a9c[_0x1cf6('0x2a')][_0x1cf6('0x7a')]=_0x193a9c[_0x1cf6('0x7a')];_0x193a9c[_0x1cf6('0x2a')][_0x1cf6('0x7b')]=_0x193a9c[_0x1cf6('0x7a')];_0x193a9c[_0x1cf6('0x2a')]['event']=_0x1cf6('0x5c');return respondWithRpcPromise(_0x1cf6('0x7c'),'EventManager',{'event':_0x1cf6('0x7d'),'message':_0x193a9c[_0x1cf6('0x2a')]},client9002)[_0x1cf6('0x22')](function(){return _0x193a9c;});}return _0x193a9c;}return null;})[_0x1cf6('0x22')](respondWithResult(_0x4adaaf,null))[_0x1cf6('0x2c')](handleError(_0x4adaaf,null));};var interaction_log=require('../../config/logger')(_0x1cf6('0x5b'));exports[_0x1cf6('0x7e')]=function(_0x50231f,_0x155979,_0x4cad13){var _0x3600a1={'agent':{},'channel':'sms'};if(_0x50231f[_0x1cf6('0x58')]['id']){delete _0x50231f[_0x1cf6('0x58')]['id'];}_0x50231f[_0x1cf6('0x58')]['UserId']=_0x50231f['body']['UserId']||_0x50231f['user']['id'];_0x3600a1[_0x1cf6('0x77')]['id']=_0x50231f[_0x1cf6('0x58')][_0x1cf6('0x61')];return db[_0x1cf6('0x3d')][_0x1cf6('0x59')]({'where':{'id':_0x50231f['params']['id'],'UserId':null}})[_0x1cf6('0x22')](handleEntityNotFound(_0x155979,null))[_0x1cf6('0x22')](function(_0x48892c){if(_0x48892c){_0x3600a1[_0x1cf6('0x2a')]=_0x48892c[_0x1cf6('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x1cf6('0x59')]({'where':{'id':_0x48892c[_0x1cf6('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x155979,null))[_0x1cf6('0x22')](function(_0x3fe554){if(_0x3fe554){_0x3600a1[_0x1cf6('0x68')]=_0x3fe554[_0x1cf6('0x63')]({'plain':!![]});interaction_log[_0x1cf6('0x23')](_0x1cf6('0x7f'),_0x50231f[_0x1cf6('0x62')]['id'],_0x50231f[_0x1cf6('0x62')][_0x1cf6('0x3a')],_0x50231f[_0x1cf6('0x62')][_0x1cf6('0x69')],_0x3600a1[_0x1cf6('0x68')]['id'],_0x50231f[_0x1cf6('0x58')]?JSON['stringify'](_0x50231f['body']):'null');return respondWithRpcPromise(_0x1cf6('0x80'),_0x1cf6('0x81'),_0x3600a1);}return null;})['then'](function(_0x115cb6){var _0xdbd902=_0x1cf6('0x6c')+_0x115cb6[_0x1cf6('0x2a')][_0x1cf6('0x6d')];return db[_0x1cf6('0x6e')][_0x1cf6('0x41')](_0xdbd902,{'type':db['Sequelize'][_0x1cf6('0x70')][_0x1cf6('0x71')],'raw':!![]})[_0x1cf6('0x22')](function(_0x11d1e0){return _0x11d1e0;});})[_0x1cf6('0x22')](function(_0x1e2c60){if(_0x1e2c60){_0x3600a1[_0x1cf6('0x2a')][_0x1cf6('0x72')]=_0x1e2c60[0x0];if(!_0x50231f[_0x1cf6('0x58')][_0x1cf6('0x61')])return;return db[_0x1cf6('0x73')]['find']({'where':{'id':_0x50231f[_0x1cf6('0x58')][_0x1cf6('0x61')],'role':_0x1cf6('0x77')},'attributes':['id',_0x1cf6('0x3a'),'fullname',_0x1cf6('0x75'),'internal'],'raw':!![]});}return null;})[_0x1cf6('0x22')](function(_0x2e6f70){if(!_0x2e6f70)return null;_0x3600a1[_0x1cf6('0x2a')][_0x1cf6('0x77')]=_0x2e6f70;return _0x3600a1;})[_0x1cf6('0x22')](function(_0x424b18){if(_0x424b18){_0x424b18['message'][_0x1cf6('0x78')]=util[_0x1cf6('0x60')]('SIP/%s',_0x50231f[_0x1cf6('0x62')][_0x1cf6('0x3a')]);_0x424b18[_0x1cf6('0x2a')][_0x1cf6('0x7a')]=_0x3600a1[_0x1cf6('0x7a')];_0x424b18[_0x1cf6('0x2a')][_0x1cf6('0x7b')]=_0x3600a1[_0x1cf6('0x7a')];_0x424b18[_0x1cf6('0x2a')]['event']=_0x1cf6('0x7e');respondWithRpcPromise(_0x1cf6('0x7c'),_0x1cf6('0x7c'),{'event':_0x1cf6('0x82'),'message':_0x424b18[_0x1cf6('0x2a')]},client9002);return _0x3600a1;}return null;})[_0x1cf6('0x22')](respondWithResult(_0x155979,null))[_0x1cf6('0x2c')](handleError(_0x155979,null));};exports[_0x1cf6('0x2e')]=function(_0x14690a,_0x5babf2,_0x36ccd8){if(_0x14690a['body']['id']){delete _0x14690a['body']['id'];}var _0x238fe4;return db[_0x1cf6('0x3d')][_0x1cf6('0x59')]({'where':{'id':_0x14690a[_0x1cf6('0x54')]['id']}})['then'](handleEntityNotFound(_0x5babf2,null))[_0x1cf6('0x22')](function(_0xf72b80){if(_0xf72b80){_0x238fe4=_0xf72b80;return db[_0x1cf6('0x83')][_0x1cf6('0x59')]({'where':{'id':_0xf72b80['SmsAccountId']}});}})[_0x1cf6('0x22')](handleEntityNotFound(_0x5babf2,null))['then'](function(_0x5cdd2b){if(_0x5cdd2b){logger[_0x1cf6('0x26')](_0x1cf6('0x84'),_0x1cf6('0x2e'),_0x1cf6('0x85'),_0x5cdd2b['type'],util[_0x1cf6('0x86')](_0x14690a[_0x1cf6('0x58')],{'showHidden':![],'depth':null}));switch(_0x5cdd2b[_0x1cf6('0x87')]){case _0x1cf6('0x88'):if(_0x14690a[_0x1cf6('0x58')][_0x1cf6('0x89')]&&_0x14690a[_0x1cf6('0x58')][_0x1cf6('0x89')]===_0x238fe4[_0x1cf6('0x8a')]){return _0x238fe4[_0x1cf6('0x38')]({'read':!![]});}else{logger[_0x1cf6('0x28')](_0x1cf6('0x8b'),_0x1cf6('0x2e'),_0x1cf6('0x88'),util[_0x1cf6('0x86')](_0x14690a['body'],{'showHidden':![],'depth':null}));}break;case _0x1cf6('0x8c'):if(_0x14690a[_0x1cf6('0x58')][_0x1cf6('0x8d')]&&_0x14690a[_0x1cf6('0x58')][_0x1cf6('0x8d')]===_0x238fe4[_0x1cf6('0x8a')]&&_[_0x1cf6('0x8e')]([_0x1cf6('0x8f'),'delivered'],_0x14690a[_0x1cf6('0x58')][_0x1cf6('0x90')])>=0x0){return _0x238fe4[_0x1cf6('0x38')]({'read':!![]});}else{logger[_0x1cf6('0x28')](_0x1cf6('0x8b'),'status','plivio',util[_0x1cf6('0x86')](_0x14690a['body'],{'showHidden':![],'depth':null}));}break;case _0x1cf6('0x91'):var _0x15d335=_0x14690a['body'][_0x1cf6('0x92')][0x0];if(_0x15d335[_0x1cf6('0x2e')][_0x1cf6('0x93')]===_0x1cf6('0x94')){return _0x238fe4[_0x1cf6('0x38')]({'read':!![]});}else{logger['error'](_0x1cf6('0x8b'),_0x1cf6('0x2e'),_0x1cf6('0x91'),util[_0x1cf6('0x86')](_0x14690a[_0x1cf6('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x238fe4;}})['then'](respondWithResult(_0x5babf2,null))[_0x1cf6('0x2c')](handleError(_0x5babf2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 8675526..cc19e98 100644 --- a/server/api/smsMessage/smsMessage.events.js +++ b/server/api/smsMessage/smsMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07c2=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x370c4d,_0x38ac8d){var _0x3d2648=function(_0x32b19c){while(--_0x32b19c){_0x370c4d['push'](_0x370c4d['shift']());}};_0x3d2648(++_0x38ac8d);}(_0x07c2,0x1e1));var _0x207c=function(_0x900a8d,_0x1f009a){_0x900a8d=_0x900a8d-0x0;var _0x5b80fc=_0x07c2[_0x900a8d];return _0x5b80fc;};'use strict';var EventEmitter=require(_0x207c('0x0'));var SmsMessage=require(_0x207c('0x1'))['db'][_0x207c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x207c('0x3')](0x0);var events={'afterCreate':_0x207c('0x4'),'afterUpdate':_0x207c('0x5'),'afterDestroy':_0x207c('0x6')};function emitEvent(_0x3851ee){return function(_0x28de67,_0x2145b5,_0x3746ba){SmsMessageEvents[_0x207c('0x7')](_0x3851ee+':'+_0x28de67['id'],_0x28de67);SmsMessageEvents[_0x207c('0x7')](_0x3851ee,_0x28de67);_0x3746ba(null);};}for(var e in events){if(events[_0x207c('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x207c('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x3dc8=['emit','hasOwnProperty','hook','events','setMaxListeners','save','update','remove'];(function(_0x443433,_0x162fbe){var _0x2aa055=function(_0x5078a2){while(--_0x5078a2){_0x443433['push'](_0x443433['shift']());}};_0x2aa055(++_0x162fbe);}(_0x3dc8,0x163));var _0x83dc=function(_0xa8b46a,_0x16d18e){_0xa8b46a=_0xa8b46a-0x0;var _0x59f821=_0x3dc8[_0xa8b46a];return _0x59f821;};'use strict';var EventEmitter=require(_0x83dc('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x83dc('0x1')](0x0);var events={'afterCreate':_0x83dc('0x2'),'afterUpdate':_0x83dc('0x3'),'afterDestroy':_0x83dc('0x4')};function emitEvent(_0x716d85){return function(_0x226aa8,_0xe0f425,_0x292b33){SmsMessageEvents[_0x83dc('0x5')](_0x716d85+':'+_0x226aa8['id'],_0x226aa8);SmsMessageEvents[_0x83dc('0x5')](_0x716d85,_0x226aa8);_0x292b33(null);};}for(var e in events){if(events[_0x83dc('0x6')](e)){var event=events[e];SmsMessage[_0x83dc('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2dbf45e..b47e2eb 100644 --- a/server/api/smsMessage/smsMessage.model.js +++ b/server/api/smsMessage/smsMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e77=['session_key','total_sent','internal_order_id','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','message_id','clickSend','authId','/api/sms/messages/','token','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','infobip','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','digest','hex','signature=','/external/get/send.php?','id_sms','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','error','SmsAccount','SmsAccountId','type','authToken','accountSid','messages','body','phone','remote','/status?token=','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms'];(function(_0x57166e,_0x4d098d){var _0x4a7abd=function(_0x508c10){while(--_0x508c10){_0x57166e['push'](_0x57166e['shift']());}};_0x4a7abd(++_0x4d098d);}(_0x0e77,0xbb));var _0x70e7=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0e77[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x70e7('0x0'));var util=require(_0x70e7('0x1'));var logger=require(_0x70e7('0x2'))(_0x70e7('0x3'));var moment=require(_0x70e7('0x4'));var BPromise=require(_0x70e7('0x5'));var rp=require(_0x70e7('0x6'));var fs=require('fs');var path=require(_0x70e7('0x7'));var rimraf=require(_0x70e7('0x8'));var config=require(_0x70e7('0x9'));var attributes=require(_0x70e7('0xa'));module['exports']=function(_0x556663,_0x96e08c){return _0x556663[_0x70e7('0xb')](_0x70e7('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x70e7('0xd'),'fields':[_0x70e7('0xd')]},{'name':_0x70e7('0xe'),'fields':['body'],'type':_0x70e7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x502780,_0x2434cb,_0x2ee53c){var _0x5b204c=_0x556663[_0x70e7('0x10')];var _0x225cac=_0x502780[_0x70e7('0x11')]({'plain':!![]});if(_0x225cac[_0x70e7('0x12')][_0x70e7('0x13')]()==='in'||_0x225cac[_0x70e7('0x12')][_0x70e7('0x13')]()===_0x70e7('0x14')&&!_0x225cac['secret']&&!_[_0x70e7('0x15')](_0x225cac[_0x70e7('0x16')])&&!_[_0x70e7('0x15')](_0x225cac[_0x70e7('0x17')])){_0x5b204c[_0x70e7('0x18')][_0x70e7('0x19')]({'where':{'id':_0x225cac[_0x70e7('0x17')]}})[_0x70e7('0x1a')](function(_0x1775f6){if(_0x1775f6){_0x1775f6[_0x70e7('0x1b')]({'lastMsgAt':_0x225cac['createdAt'],'lastMsgDirection':_0x225cac['direction'][_0x70e7('0x13')]()});}})['catch'](function(_0x399870){console[_0x70e7('0x1c')](_0x399870);});}if(_0x225cac['direction']===_0x70e7('0x14')&&!_0x225cac['secret']){var _0x11d947;_0x5b204c[_0x70e7('0x1d')]['find']({'where':{'id':_0x225cac[_0x70e7('0x1e')]},'raw':!![]})[_0x70e7('0x1a')](function(_0x256c40){_0x11d947=_0x256c40;if(_0x11d947&&_0x11d947[_0x70e7('0x1f')]){switch(_0x11d947[_0x70e7('0x1f')]){case'twilio':var _0x1d0b1a=require('twilio');if(_0x11d947['accountSid']&&_0x11d947[_0x70e7('0x20')]&&_0x11d947['phone']){var _0x83b1fe=new _0x1d0b1a(_0x11d947[_0x70e7('0x21')],_0x11d947[_0x70e7('0x20')]);_0x83b1fe[_0x70e7('0x22')]['create']({'body':_0x225cac[_0x70e7('0x23')],'to':_0x225cac[_0x70e7('0x24')],'from':_0x11d947[_0x70e7('0x24')],'statusCallback':_0x11d947[_0x70e7('0x25')]+'/api/sms/messages/'+_0x225cac['id']+_0x70e7('0x26')+_0x11d947['token']})[_0x70e7('0x1a')](function(_0x4efa16){if(_0x4efa16[_0x70e7('0x27')]){return _0x502780[_0x70e7('0x1b')]({'messageId':_0x4efa16['sid']});}})[_0x70e7('0x28')](function(_0x3f6810){logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x2b'),util[_0x70e7('0x2c')](_0x3f6810,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x2b'),_0x70e7('0x2d'));}break;case'skebby':var _0x125884='https://api.skebby.it/API/v1.0/REST/';if(_0x11d947[_0x70e7('0x2e')]&&_0x11d947[_0x70e7('0x2f')]){var _0xb8bc3e={'recipient':[_0x225cac[_0x70e7('0x24')]],'message':_0x225cac[_0x70e7('0x23')],'message_type':_0x11d947[_0x70e7('0x30')]};if(_0x11d947[_0x70e7('0x30')]&&_0x11d947[_0x70e7('0x30')]!=='SI'){_0xb8bc3e[_0x70e7('0x31')]=_0x11d947[_0x70e7('0x24')];}var _0x1e5865={'url':_0x125884+_0x70e7('0x32')+_0x11d947[_0x70e7('0x2e')]+_0x70e7('0x33')+_0x11d947[_0x70e7('0x2f')],'method':_0x70e7('0x34')};rp(_0x1e5865)[_0x70e7('0x1a')](function(_0x2e7e11){var _0x19210c=_0x2e7e11[_0x70e7('0x35')](';');var _0x2ec2a8={'user_key':_0x19210c[0x0],'session_key':_0x19210c[0x1]};_0x1e5865={'url':_0x125884+_0x70e7('0x36'),'method':'POST','headers':{'user_key':_0x2ec2a8['user_key'],'Session_key':_0x2ec2a8[_0x70e7('0x37')]},'json':!![],'body':_0xb8bc3e};return rp(_0x1e5865);})[_0x70e7('0x1a')](function(_0x517184){if(_0x517184[_0x70e7('0x38')]>=0x1){var _0x16aee6={'messageId':_0x517184[_0x70e7('0x39')]};if(_0x11d947[_0x70e7('0x30')]!=='GP'||!_0x11d947['deliveryReport']){_0x16aee6[_0x70e7('0x3a')]=!![];}return _0x502780[_0x70e7('0x1b')](_0x16aee6);}else{return logger[_0x70e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x70e7('0x2a'),_0x70e7('0x3b'),util[_0x70e7('0x2c')](_0x517184,{'showHidden':![],'depth':null}));}})[_0x70e7('0x28')](function(_0x2c3dd6){return logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),'skebby',util[_0x70e7('0x2c')](_0x2c3dd6,{'showHidden':![],'depth':null}));});}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x3b'),_0x70e7('0x3c'));}break;case _0x70e7('0x3d'):if(_0x11d947[_0x70e7('0x20')]){var _0x315f1b={'recipient':_0x225cac[_0x70e7('0x24')],'message':_0x225cac['body'],'sender':_0x11d947[_0x70e7('0x3e')]||_0x11d947[_0x70e7('0x24')],'authorization':_0x11d947[_0x70e7('0x20')]};var _0x2434cb={'method':_0x70e7('0x3f'),'uri':_0x70e7('0x40'),'body':_0x315f1b,'json':!![]};rp(_0x2434cb)[_0x70e7('0x1a')](function(_0x2acf50){var _0x42c3e9={'messageId':_0x2acf50[_0x70e7('0x41')]};if(!_0x11d947[_0x70e7('0x42')]){_0x42c3e9['read']=!![];}return _0x502780[_0x70e7('0x1b')](_0x42c3e9);})[_0x70e7('0x28')](function(_0x40a806){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x70e7('0x2a'),'connectel',util['inspect'](_0x40a806,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x3d'),_0x70e7('0x43'));}break;case _0x70e7('0x44'):if(_0x11d947[_0x70e7('0x2e')]&&_0x11d947['password']){var _0x315f1b={'messages':[{'source':_0x70e7('0x45'),'to':_0x225cac[_0x70e7('0x24')],'body':_0x225cac[_0x70e7('0x23')],'from':_0x11d947[_0x70e7('0x3e')]||_0x11d947[_0x70e7('0x24')]}]};var _0x27acaa=util[_0x70e7('0x46')](_0x70e7('0x47'),_0x11d947['username'],_0x11d947[_0x70e7('0x2f')]);var _0x2434cb={'method':_0x70e7('0x3f'),'uri':_0x70e7('0x48'),'body':_0x315f1b,'headers':{'Authorization':util[_0x70e7('0x46')](_0x70e7('0x49'),new Buffer(_0x27acaa)['toString'](_0x70e7('0x4a')))},'json':!![]};rp(_0x2434cb)['then'](function(_0x1fd7df){if(_0x1fd7df[_0x70e7('0x4b')]>=0xc8&&_0x1fd7df[_0x70e7('0x4b')]<=0xce){if(_0x1fd7df[_0x70e7('0x4c')]&&_0x1fd7df['data'][_0x70e7('0x4d')]>0x0){var _0x59706a=_['head'](_0x1fd7df[_0x70e7('0x4c')]['messages']);var _0x4f30b1={'messageId':_0x59706a[_0x70e7('0x4e')]};if(!_0x11d947[_0x70e7('0x42')]){_0x4f30b1[_0x70e7('0x3a')]=!![];}return _0x502780['update'](_0x4f30b1);}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),'clickSend',util[_0x70e7('0x2c')](_0x1fd7df,{'showHidden':![],'depth':null}));}}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x4f'),util[_0x70e7('0x2c')](_0x1fd7df,{'showHidden':![],'depth':null}));}})[_0x70e7('0x28')](function(_0x4b3158){logger[_0x70e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x70e7('0x2a'),_0x70e7('0x4f'),util['inspect'](_0x4b3158,{'showHidden':![],'depth':null}));});}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x4f'),_0x70e7('0x3c'));}break;case'plivo':if(_0x11d947[_0x70e7('0x50')]&&_0x11d947[_0x70e7('0x20')]){var _0x315f1b={'dst':_0x225cac[_0x70e7('0x24')],'text':_0x225cac[_0x70e7('0x23')],'src':_0x11d947[_0x70e7('0x3e')]||_0x11d947[_0x70e7('0x24')],'url':_0x11d947[_0x70e7('0x25')]+_0x70e7('0x51')+_0x225cac['id']+_0x70e7('0x26')+_0x11d947[_0x70e7('0x52')]};var _0x27acaa=util[_0x70e7('0x46')](_0x70e7('0x47'),_0x11d947['authId'],_0x11d947[_0x70e7('0x20')]);var _0x2434cb={'method':_0x70e7('0x3f'),'uri':util[_0x70e7('0x46')](_0x70e7('0x53'),_0x11d947['authId']),'body':_0x315f1b,'headers':{'Authorization':util[_0x70e7('0x46')](_0x70e7('0x49'),new Buffer(_0x27acaa)[_0x70e7('0x54')](_0x70e7('0x4a')))},'json':!![]};rp(_0x2434cb)[_0x70e7('0x1a')](function(_0x5ca7c2){var _0x3c6def={'messageId':_0x5ca7c2[_0x70e7('0x55')][0x0]};return _0x502780['update'](_0x3c6def);})['catch'](function(_0x48cae5){logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x56'),util[_0x70e7('0x2c')](_0x48cae5,{'showHidden':![],'depth':null}));});}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),'plivo',_0x70e7('0x57'));}break;case'infobip':if(_0x11d947['username']&&_0x11d947[_0x70e7('0x2f')]){if(_0x11d947[_0x70e7('0x58')]){var _0x22797b={'method':_0x70e7('0x3f'),'uri':_0x11d947[_0x70e7('0x58')]+'/auth/1/session','body':{'username':_0x11d947['username'],'password':_0x11d947[_0x70e7('0x2f')]},'json':!![]};return rp(_0x22797b)[_0x70e7('0x1a')](function(_0x1229e0){var _0x4c18a2={'method':_0x70e7('0x3f'),'uri':_0x11d947[_0x70e7('0x58')]+_0x70e7('0x59'),'body':{'messages':[{'from':_0x11d947[_0x70e7('0x24')],'destinations':[{'to':_0x225cac['phone']}],'text':_0x225cac[_0x70e7('0x23')],'notifyUrl':_0x11d947['remote']+_0x70e7('0x51')+_0x225cac['id']+'/status?token='+_0x11d947[_0x70e7('0x52')],'notifyContentType':'application/json','callbackData':_0x11d947[_0x70e7('0x24')]+';'+_0x225cac[_0x70e7('0x23')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1229e0['token']},'json':!![]};return rp(_0x4c18a2)[_0x70e7('0x1a')](function(_0x27b879){if(_0x27b879[_0x70e7('0x22')]){var _0x39b95a={'messageId':_0x27b879['messages'][0x0]['messageId']};if(!_0x11d947['deliveryReport']){_0x39b95a[_0x70e7('0x3a')]=!![];}return _0x502780[_0x70e7('0x1b')](_0x39b95a);}else{return logger['error'](_0x70e7('0x29'),'afterCreate',_0x70e7('0x5a'),util[_0x70e7('0x2c')](_0x27b879,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x479cf3){return logger[_0x70e7('0x1c')](_0x70e7('0x29'),'afterCreate',_0x70e7('0x5a'),util['inspect'](_0x479cf3,{'showHidden':![],'depth':null}));});}else{logger[_0x70e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x70e7('0x5a'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),'infobip',_0x70e7('0x3c'));}break;case _0x70e7('0x5b'):var _0x9a8e96=require(_0x70e7('0x5c'));if(_0x11d947[_0x70e7('0x5d')]){var _0x52d7d4={};_0x52d7d4[_0x70e7('0x5e')]=_0x11d947[_0x70e7('0x2e')];_0x52d7d4[_0x70e7('0x24')]=_0x225cac['phone'];_0x52d7d4[_0x70e7('0x31')]=_0x11d947[_0x70e7('0x24')];_0x52d7d4[_0x70e7('0x5f')]=_0x225cac[_0x70e7('0x23')];_0x52d7d4[_0x70e7('0x60')]=+new Date();var _0x30a410='';var _0x1ccad1='';var _0x468f4b=Object[_0x70e7('0x61')](_0x52d7d4);_0x468f4b[_0x70e7('0x62')]();for(var _0x3bd886=0x0;_0x3bd886<_0x468f4b['length'];_0x3bd886++){if(_0x30a410!=''){_0x30a410+='&';}_0x30a410+=_0x468f4b[_0x3bd886]+'='+encodeURIComponent(_0x52d7d4[_0x468f4b[_0x3bd886]]);_0x1ccad1+=_0x52d7d4[_0x468f4b[_0x3bd886]];}_0x1ccad1+=_0x11d947['apiKey'];_0x1ccad1=_0x9a8e96[_0x70e7('0x63')]('md5')['update'](_0x1ccad1)[_0x70e7('0x64')](_0x70e7('0x65'));if(_0x30a410!==''){_0x30a410+='&';}_0x30a410+=_0x70e7('0x66')+_0x1ccad1;var _0x1e5865={'method':_0x70e7('0x34'),'uri':_0x11d947[_0x70e7('0x58')]+_0x70e7('0x67')+_0x30a410,'json':!![]};return rp(_0x1e5865)['then'](function(_0x27e3b5){var _0x1a85ad=Object[_0x70e7('0x61')](_0x27e3b5);if(_0x27e3b5[_0x1a85ad[0x0]]['error']&&parseInt(_0x27e3b5[_0x1a85ad[0x0]][_0x70e7('0x1c')])===0x0){var _0x33a240={'messageId':_0x27e3b5[_0x1a85ad[0x0]][_0x70e7('0x68')]};if(!_0x11d947[_0x70e7('0x42')]){_0x33a240[_0x70e7('0x3a')]=!![];}return _0x502780[_0x70e7('0x1b')](_0x33a240);}else{return logger[_0x70e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x70e7('0x2a'),'csc',util[_0x70e7('0x2c')](_0x27e3b5[_0x70e7('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1199c5){return logger[_0x70e7('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x70e7('0x2a'),_0x70e7('0x5b'),util[_0x70e7('0x2c')](_0x1199c5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x11d947[_0x70e7('0x5d')]){var _0x2ad62d={'method':_0x70e7('0x3f'),'uri':_0x70e7('0x69'),'headers':{'Authorization':_0x11d947['apiKey']},'body':{'content':_0x225cac[_0x70e7('0x23')],'to':[_0x225cac['phone']],'from':_0x11d947[_0x70e7('0x24')],'binary':![],'clientMessageId':_0x70e7('0x6a'),'charset':_0x70e7('0x6b')},'json':!![]};rp(_0x2ad62d)['then'](function(_0x4c8a23){if(!_0x4c8a23[_0x70e7('0x1c')]){var _0x1a0087={'messageId':_0x4c8a23[_0x70e7('0x22')][0x0][_0x70e7('0x6c')]};if(!_0x11d947['deliveryReport']){_0x1a0087[_0x70e7('0x3a')]=!![];}return _0x502780[_0x70e7('0x1b')](_0x1a0087);}else{return logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),'clickatell',util[_0x70e7('0x2c')](_0x4c8a23[_0x70e7('0x1c')],{'showHidden':![],'depth':null}));}})[_0x70e7('0x28')](function(_0x4ef534){return logger['error'](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x6d'),util[_0x70e7('0x2c')](_0x4ef534,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x70e7('0x29'),'afterCreate','clickatell',_0x70e7('0x6e'));}break;case _0x70e7('0x6f'):if(_0x11d947[_0x70e7('0x2e')]&&_0x11d947[_0x70e7('0x2f')]){var _0x27acaa=util['format'](_0x70e7('0x47'),_0x11d947[_0x70e7('0x2e')],_0x11d947[_0x70e7('0x2f')]);var _0x2434cb={'method':_0x70e7('0x3f'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x11d947['accountId']+_0x70e7('0x70'),'body':{'to':[_0x225cac[_0x70e7('0x24')]],'text':_0x225cac[_0x70e7('0x23')],'from':_0x11d947[_0x70e7('0x24')],'applicationId':_0x11d947['applicationId']},'headers':{'Authorization':util[_0x70e7('0x46')](_0x70e7('0x49'),new Buffer(_0x27acaa)['toString'](_0x70e7('0x4a')))},'json':!![]};rp(_0x2434cb)['then'](function(_0x51a031){if(_0x51a031['id']){var _0x546eb4={'messageId':_0x51a031['id']};return _0x502780[_0x70e7('0x1b')](_0x546eb4);}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x6f'),util['inspect'](_0x51a031,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c5acf){logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),'bandwidth',util[_0x70e7('0x2c')](_0x3c5acf,{'showHidden':![],'depth':null}));});}else{logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x6f'),_0x70e7('0x3c'));}break;case'intelepeer':if(_0x11d947[_0x70e7('0x5d')]){var _0x634f32={};var _0x1e5865={'method':_0x70e7('0x3f'),'uri':_0x70e7('0x71'),'headers':{'Authorization':_0x70e7('0x72')+_0x11d947[_0x70e7('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x11d947['phone'],'to':_0x225cac[_0x70e7('0x24')],'text':_0x225cac[_0x70e7('0x23')]},'json':!![]};return rp(_0x1e5865)[_0x70e7('0x1a')](function(_0x19ee2c){if(_0x19ee2c[_0x70e7('0x73')]==0xca){_0x634f32[_0x70e7('0x74')]=_0x19ee2c;var _0x54c3da={'method':'POST','uri':_0x70e7('0x75'),'headers':{'Authorization':_0x70e7('0x72')+_0x11d947['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x634f32[_0x70e7('0x74')]['refid']},'json':!![]};return rp(_0x54c3da)['then'](function(_0x4e056b){_0x634f32['status']=_0x4e056b;var _0x34d027={'messageId':_0x634f32[_0x70e7('0x74')][_0x70e7('0x76')],'read':!![]};return _0x502780['update'](_0x34d027);});}else{return logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x77'),util[_0x70e7('0x2c')](_0x19ee2c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3a558b){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x70e7('0x2a'),_0x70e7('0x77'),util[_0x70e7('0x2c')](_0x3a558b,{'showHidden':![],'depth':null}));});}else{return logger[_0x70e7('0x1c')](_0x70e7('0x29'),_0x70e7('0x2a'),_0x70e7('0x77'),'Token\x20not\x20received');}break;}}})[_0x70e7('0x78')](function(){_0x2ee53c();});}else{_0x2ee53c();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdd0c=['clickatell','apiKey','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','application/json','message','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','secret','SmsAccountId','type','twilio','authToken','accountSid','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','requestid','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','infobip','baseUrl','/sms/2/text/advanced','Missing\x20parameters:\x20base_url','csc','crypto','login','timestamp','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey'];(function(_0x3a97c0,_0x50a18b){var _0x1c4f47=function(_0x1a776b){while(--_0x1a776b){_0x3a97c0['push'](_0x3a97c0['shift']());}};_0x1c4f47(++_0x50a18b);}(_0xdd0c,0x183));var _0xcdd0=function(_0x4487b3,_0x120905){_0x4487b3=_0x4487b3-0x0;var _0x5a9a7a=_0xdd0c[_0x4487b3];return _0x5a9a7a;};'use strict';var _=require(_0xcdd0('0x0'));var util=require(_0xcdd0('0x1'));var logger=require('../../config/logger')(_0xcdd0('0x2'));var moment=require(_0xcdd0('0x3'));var BPromise=require(_0xcdd0('0x4'));var rp=require(_0xcdd0('0x5'));var fs=require('fs');var path=require(_0xcdd0('0x6'));var rimraf=require(_0xcdd0('0x7'));var config=require(_0xcdd0('0x8'));var attributes=require('./smsMessage.attributes');module[_0xcdd0('0x9')]=function(_0x18aac9,_0x4518db){return _0x18aac9[_0xcdd0('0xa')](_0xcdd0('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xcdd0('0xc'),'fields':['messageId']},{'name':_0xcdd0('0xd'),'fields':[_0xcdd0('0xe')],'type':_0xcdd0('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5646d0,_0x232680,_0xa28313){var _0x536b57=_0x18aac9[_0xcdd0('0x10')];var _0x177d42=_0x5646d0[_0xcdd0('0x11')]({'plain':!![]});if(_0x177d42[_0xcdd0('0x12')][_0xcdd0('0x13')]()==='in'||_0x177d42['direction'][_0xcdd0('0x13')]()===_0xcdd0('0x14')&&!_0x177d42['secret']&&!_[_0xcdd0('0x15')](_0x177d42[_0xcdd0('0x16')])&&!_[_0xcdd0('0x15')](_0x177d42[_0xcdd0('0x17')])){_0x536b57[_0xcdd0('0x18')][_0xcdd0('0x19')]({'where':{'id':_0x177d42[_0xcdd0('0x17')]}})[_0xcdd0('0x1a')](function(_0x27b535){if(_0x27b535){_0x27b535['update']({'lastMsgAt':_0x177d42[_0xcdd0('0x1b')],'lastMsgDirection':_0x177d42[_0xcdd0('0x12')][_0xcdd0('0x13')]()});}})['catch'](function(_0x238fb5){console['error'](_0x238fb5);});}if(_0x177d42[_0xcdd0('0x12')]===_0xcdd0('0x14')&&!_0x177d42[_0xcdd0('0x1c')]){var _0x11055a;_0x536b57['SmsAccount']['find']({'where':{'id':_0x177d42[_0xcdd0('0x1d')]},'raw':!![]})[_0xcdd0('0x1a')](function(_0x43e6fd){_0x11055a=_0x43e6fd;if(_0x11055a&&_0x11055a[_0xcdd0('0x1e')]){switch(_0x11055a['type']){case _0xcdd0('0x1f'):var _0x24649f=require('twilio');if(_0x11055a['accountSid']&&_0x11055a[_0xcdd0('0x20')]&&_0x11055a['phone']){var _0x3d285a=new _0x24649f(_0x11055a[_0xcdd0('0x21')],_0x11055a['authToken']);_0x3d285a[_0xcdd0('0x22')][_0xcdd0('0x23')]({'body':_0x177d42[_0xcdd0('0xe')],'to':_0x177d42[_0xcdd0('0x24')],'from':_0x11055a[_0xcdd0('0x24')],'statusCallback':_0x11055a[_0xcdd0('0x25')]+_0xcdd0('0x26')+_0x177d42['id']+_0xcdd0('0x27')+_0x11055a[_0xcdd0('0x28')]})[_0xcdd0('0x1a')](function(_0x50bc5f){if(_0x50bc5f[_0xcdd0('0x29')]){return _0x5646d0[_0xcdd0('0x2a')]({'messageId':_0x50bc5f[_0xcdd0('0x29')]});}})[_0xcdd0('0x2b')](function(_0x34e0c1){logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x1f'),util[_0xcdd0('0x2f')](_0x34e0c1,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x1f'),_0xcdd0('0x30'));}break;case _0xcdd0('0x31'):var _0x296af9='https://api.skebby.it/API/v1.0/REST/';if(_0x11055a[_0xcdd0('0x32')]&&_0x11055a[_0xcdd0('0x33')]){var _0x3c59e5={'recipient':[_0x177d42[_0xcdd0('0x24')]],'message':_0x177d42['body'],'message_type':_0x11055a[_0xcdd0('0x34')]};if(_0x11055a['smsMethod']&&_0x11055a[_0xcdd0('0x34')]!=='SI'){_0x3c59e5[_0xcdd0('0x35')]=_0x11055a[_0xcdd0('0x24')];}var _0x2ac3b9={'url':_0x296af9+_0xcdd0('0x36')+_0x11055a[_0xcdd0('0x32')]+'&password='+_0x11055a[_0xcdd0('0x33')],'method':_0xcdd0('0x37')};rp(_0x2ac3b9)[_0xcdd0('0x1a')](function(_0x1ba878){var _0x150736=_0x1ba878[_0xcdd0('0x38')](';');var _0x5b5394={'user_key':_0x150736[0x0],'session_key':_0x150736[0x1]};_0x2ac3b9={'url':_0x296af9+_0xcdd0('0x39'),'method':_0xcdd0('0x3a'),'headers':{'user_key':_0x5b5394['user_key'],'Session_key':_0x5b5394[_0xcdd0('0x3b')]},'json':!![],'body':_0x3c59e5};return rp(_0x2ac3b9);})[_0xcdd0('0x1a')](function(_0x2ff9a5){if(_0x2ff9a5[_0xcdd0('0x3c')]>=0x1){var _0x3fb7f9={'messageId':_0x2ff9a5[_0xcdd0('0x3d')]};if(_0x11055a['smsMethod']!=='GP'||!_0x11055a[_0xcdd0('0x3e')]){_0x3fb7f9['read']=!![];}return _0x5646d0[_0xcdd0('0x2a')](_0x3fb7f9);}else{return logger['error'](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x31'),util[_0xcdd0('0x2f')](_0x2ff9a5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x633c04){return logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x31'),util[_0xcdd0('0x2f')](_0x633c04,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x31'),_0xcdd0('0x3f'));}break;case'connectel':if(_0x11055a[_0xcdd0('0x20')]){var _0x554f96={'recipient':_0x177d42[_0xcdd0('0x24')],'message':_0x177d42[_0xcdd0('0xe')],'sender':_0x11055a['senderString']||_0x11055a[_0xcdd0('0x24')],'authorization':_0x11055a[_0xcdd0('0x20')]};var _0x232680={'method':_0xcdd0('0x3a'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x554f96,'json':!![]};rp(_0x232680)[_0xcdd0('0x1a')](function(_0xf52edb){var _0x345d35={'messageId':_0xf52edb[_0xcdd0('0x40')]};if(!_0x11055a[_0xcdd0('0x3e')]){_0x345d35[_0xcdd0('0x41')]=!![];}return _0x5646d0[_0xcdd0('0x2a')](_0x345d35);})[_0xcdd0('0x2b')](function(_0x600d18){logger[_0xcdd0('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcdd0('0x2e'),'connectel',util[_0xcdd0('0x2f')](_0x600d18,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x42'),_0xcdd0('0x43'));}break;case _0xcdd0('0x44'):if(_0x11055a[_0xcdd0('0x32')]&&_0x11055a[_0xcdd0('0x33')]){var _0x554f96={'messages':[{'source':_0xcdd0('0x45'),'to':_0x177d42[_0xcdd0('0x24')],'body':_0x177d42[_0xcdd0('0xe')],'from':_0x11055a[_0xcdd0('0x46')]||_0x11055a['phone']}]};var _0x5e3c78=util[_0xcdd0('0x47')]('%s:%s',_0x11055a['username'],_0x11055a[_0xcdd0('0x33')]);var _0x232680={'method':_0xcdd0('0x3a'),'uri':_0xcdd0('0x48'),'body':_0x554f96,'headers':{'Authorization':util[_0xcdd0('0x47')]('Basic\x20%s',new Buffer(_0x5e3c78)['toString'](_0xcdd0('0x49')))},'json':!![]};rp(_0x232680)[_0xcdd0('0x1a')](function(_0x1ab840){if(_0x1ab840[_0xcdd0('0x4a')]>=0xc8&&_0x1ab840[_0xcdd0('0x4a')]<=0xce){if(_0x1ab840[_0xcdd0('0x4b')]&&_0x1ab840[_0xcdd0('0x4b')][_0xcdd0('0x4c')]>0x0){var _0x1ebab4=_[_0xcdd0('0x4d')](_0x1ab840['data'][_0xcdd0('0x22')]);var _0x1f1469={'messageId':_0x1ebab4[_0xcdd0('0x4e')]};if(!_0x11055a['deliveryReport']){_0x1f1469[_0xcdd0('0x41')]=!![];}return _0x5646d0['update'](_0x1f1469);}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x4f'),util[_0xcdd0('0x2f')](_0x1ab840,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xcdd0('0x2d'),_0xcdd0('0x2e'),'clickSend',util[_0xcdd0('0x2f')](_0x1ab840,{'showHidden':![],'depth':null}));}})[_0xcdd0('0x2b')](function(_0xa0ad99){logger[_0xcdd0('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcdd0('0x2e'),_0xcdd0('0x4f'),util['inspect'](_0xa0ad99,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),'clickSend',_0xcdd0('0x3f'));}break;case _0xcdd0('0x50'):if(_0x11055a[_0xcdd0('0x51')]&&_0x11055a[_0xcdd0('0x20')]){var _0x554f96={'dst':_0x177d42[_0xcdd0('0x24')],'text':_0x177d42[_0xcdd0('0xe')],'src':_0x11055a['senderString']||_0x11055a[_0xcdd0('0x24')],'url':_0x11055a[_0xcdd0('0x25')]+'/api/sms/messages/'+_0x177d42['id']+'/status?token='+_0x11055a[_0xcdd0('0x28')]};var _0x5e3c78=util[_0xcdd0('0x47')](_0xcdd0('0x52'),_0x11055a[_0xcdd0('0x51')],_0x11055a[_0xcdd0('0x20')]);var _0x232680={'method':_0xcdd0('0x3a'),'uri':util[_0xcdd0('0x47')](_0xcdd0('0x53'),_0x11055a[_0xcdd0('0x51')]),'body':_0x554f96,'headers':{'Authorization':util[_0xcdd0('0x47')](_0xcdd0('0x54'),new Buffer(_0x5e3c78)[_0xcdd0('0x55')]('base64'))},'json':!![]};rp(_0x232680)['then'](function(_0x47140d){var _0x18c8ff={'messageId':_0x47140d[_0xcdd0('0x56')][0x0]};return _0x5646d0[_0xcdd0('0x2a')](_0x18c8ff);})[_0xcdd0('0x2b')](function(_0x39cd2e){logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),'plivo',util['inspect'](_0x39cd2e,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcdd0('0x2e'),_0xcdd0('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xcdd0('0x57'):if(_0x11055a[_0xcdd0('0x32')]&&_0x11055a[_0xcdd0('0x33')]){if(_0x11055a[_0xcdd0('0x58')]){var _0x5c7a2c={'method':'POST','uri':_0x11055a['baseUrl']+'/auth/1/session','body':{'username':_0x11055a['username'],'password':_0x11055a[_0xcdd0('0x33')]},'json':!![]};return rp(_0x5c7a2c)[_0xcdd0('0x1a')](function(_0x159e94){var _0x2af48c={'method':_0xcdd0('0x3a'),'uri':_0x11055a[_0xcdd0('0x58')]+_0xcdd0('0x59'),'body':{'messages':[{'from':_0x11055a[_0xcdd0('0x24')],'destinations':[{'to':_0x177d42[_0xcdd0('0x24')]}],'text':_0x177d42[_0xcdd0('0xe')],'notifyUrl':_0x11055a['remote']+'/api/sms/messages/'+_0x177d42['id']+_0xcdd0('0x27')+_0x11055a[_0xcdd0('0x28')],'notifyContentType':'application/json','callbackData':_0x11055a['phone']+';'+_0x177d42[_0xcdd0('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x159e94[_0xcdd0('0x28')]},'json':!![]};return rp(_0x2af48c)[_0xcdd0('0x1a')](function(_0x2b83a3){if(_0x2b83a3[_0xcdd0('0x22')]){var _0x4d0e9b={'messageId':_0x2b83a3[_0xcdd0('0x22')][0x0][_0xcdd0('0xc')]};if(!_0x11055a[_0xcdd0('0x3e')]){_0x4d0e9b[_0xcdd0('0x41')]=!![];}return _0x5646d0[_0xcdd0('0x2a')](_0x4d0e9b);}else{return logger['error'](_0xcdd0('0x2d'),_0xcdd0('0x2e'),'infobip',util[_0xcdd0('0x2f')](_0x2b83a3,{'showHidden':![],'depth':null}));}});})[_0xcdd0('0x2b')](function(_0x3cc262){return logger[_0xcdd0('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcdd0('0x2e'),_0xcdd0('0x57'),util['inspect'](_0x3cc262,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x57'),_0xcdd0('0x5a'));}}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x57'),_0xcdd0('0x3f'));}break;case _0xcdd0('0x5b'):var _0x387f58=require(_0xcdd0('0x5c'));if(_0x11055a['apiKey']){var _0x1dfaea={};_0x1dfaea[_0xcdd0('0x5d')]=_0x11055a[_0xcdd0('0x32')];_0x1dfaea[_0xcdd0('0x24')]=_0x177d42['phone'];_0x1dfaea[_0xcdd0('0x35')]=_0x11055a[_0xcdd0('0x24')];_0x1dfaea['text']=_0x177d42[_0xcdd0('0xe')];_0x1dfaea[_0xcdd0('0x5e')]=+new Date();var _0x12665e='';var _0x9646d='';var _0x5a9a44=Object['keys'](_0x1dfaea);_0x5a9a44[_0xcdd0('0x5f')]();for(var _0x2ea140=0x0;_0x2ea140<_0x5a9a44['length'];_0x2ea140++){if(_0x12665e!=''){_0x12665e+='&';}_0x12665e+=_0x5a9a44[_0x2ea140]+'='+encodeURIComponent(_0x1dfaea[_0x5a9a44[_0x2ea140]]);_0x9646d+=_0x1dfaea[_0x5a9a44[_0x2ea140]];}_0x9646d+=_0x11055a['apiKey'];_0x9646d=_0x387f58[_0xcdd0('0x60')](_0xcdd0('0x61'))[_0xcdd0('0x2a')](_0x9646d)[_0xcdd0('0x62')](_0xcdd0('0x63'));if(_0x12665e!==''){_0x12665e+='&';}_0x12665e+=_0xcdd0('0x64')+_0x9646d;var _0x2ac3b9={'method':'GET','uri':_0x11055a['baseUrl']+_0xcdd0('0x65')+_0x12665e,'json':!![]};return rp(_0x2ac3b9)[_0xcdd0('0x1a')](function(_0x37d752){var _0x1bad2e=Object[_0xcdd0('0x66')](_0x37d752);if(_0x37d752[_0x1bad2e[0x0]][_0xcdd0('0x2c')]&&parseInt(_0x37d752[_0x1bad2e[0x0]]['error'])===0x0){var _0x5984cd={'messageId':_0x37d752[_0x1bad2e[0x0]][_0xcdd0('0x67')]};if(!_0x11055a[_0xcdd0('0x3e')]){_0x5984cd[_0xcdd0('0x41')]=!![];}return _0x5646d0['update'](_0x5984cd);}else{return logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x5b'),util[_0xcdd0('0x2f')](_0x37d752[_0xcdd0('0x2c')],{'showHidden':![],'depth':null}));}})[_0xcdd0('0x2b')](function(_0x5ea3ce){return logger[_0xcdd0('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcdd0('0x2e'),_0xcdd0('0x5b'),util[_0xcdd0('0x2f')](_0x5ea3ce,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),'csc',_0xcdd0('0x68'));}break;case _0xcdd0('0x69'):if(_0x11055a[_0xcdd0('0x6a')]){var _0xe3f9d9={'method':_0xcdd0('0x3a'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x11055a[_0xcdd0('0x6a')]},'body':{'content':_0x177d42['body'],'to':[_0x177d42[_0xcdd0('0x24')]],'from':_0x11055a[_0xcdd0('0x24')],'binary':![],'clientMessageId':_0xcdd0('0x6b'),'charset':_0xcdd0('0x6c')},'json':!![]};rp(_0xe3f9d9)['then'](function(_0x2b1cb9){if(!_0x2b1cb9['error']){var _0x167dcf={'messageId':_0x2b1cb9['messages'][0x0][_0xcdd0('0x6d')]};if(!_0x11055a['deliveryReport']){_0x167dcf[_0xcdd0('0x41')]=!![];}return _0x5646d0[_0xcdd0('0x2a')](_0x167dcf);}else{return logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x69'),util[_0xcdd0('0x2f')](_0x2b1cb9['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x26665e){return logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),'afterCreate',_0xcdd0('0x69'),util[_0xcdd0('0x2f')](_0x26665e,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x69'),_0xcdd0('0x68'));}break;case _0xcdd0('0x6e'):if(_0x11055a[_0xcdd0('0x32')]&&_0x11055a['password']){var _0x5e3c78=util[_0xcdd0('0x47')]('%s:%s',_0x11055a[_0xcdd0('0x32')],_0x11055a[_0xcdd0('0x33')]);var _0x232680={'method':_0xcdd0('0x3a'),'uri':_0xcdd0('0x6f')+_0x11055a['accountId']+'/messages','body':{'to':[_0x177d42['phone']],'text':_0x177d42[_0xcdd0('0xe')],'from':_0x11055a[_0xcdd0('0x24')],'applicationId':_0x11055a['applicationId']},'headers':{'Authorization':util['format'](_0xcdd0('0x54'),new Buffer(_0x5e3c78)[_0xcdd0('0x55')]('base64'))},'json':!![]};rp(_0x232680)[_0xcdd0('0x1a')](function(_0x2b6d8b){if(_0x2b6d8b['id']){var _0x54c6ee={'messageId':_0x2b6d8b['id']};return _0x5646d0[_0xcdd0('0x2a')](_0x54c6ee);}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x6e'),util[_0xcdd0('0x2f')](_0x2b6d8b,{'showHidden':![],'depth':null}));}})[_0xcdd0('0x2b')](function(_0x1b9e17){logger[_0xcdd0('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcdd0('0x2e'),_0xcdd0('0x6e'),util[_0xcdd0('0x2f')](_0x1b9e17,{'showHidden':![],'depth':null}));});}else{logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x6e'),_0xcdd0('0x3f'));}break;case _0xcdd0('0x70'):if(_0x11055a[_0xcdd0('0x6a')]){var _0x39859d={};var _0x2ac3b9={'method':_0xcdd0('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xcdd0('0x71')+_0x11055a[_0xcdd0('0x6a')],'Content-Type':'application/json'},'body':{'from':_0x11055a[_0xcdd0('0x24')],'to':_0x177d42[_0xcdd0('0x24')],'text':_0x177d42[_0xcdd0('0xe')]},'json':!![]};return rp(_0x2ac3b9)[_0xcdd0('0x1a')](function(_0x5f569c){if(_0x5f569c[_0xcdd0('0x72')]==0xca){_0x39859d['message']=_0x5f569c;var _0x55b6eb={'method':_0xcdd0('0x3a'),'uri':_0xcdd0('0x73'),'headers':{'Authorization':_0xcdd0('0x71')+_0x11055a[_0xcdd0('0x6a')],'Content-Type':_0xcdd0('0x74')},'body':{'refid':_0x39859d[_0xcdd0('0x75')][_0xcdd0('0x76')]},'json':!![]};return rp(_0x55b6eb)['then'](function(_0x19b13b){_0x39859d[_0xcdd0('0x77')]=_0x19b13b;var _0x14e2c3={'messageId':_0x39859d[_0xcdd0('0x75')][_0xcdd0('0x76')],'read':!![]};return _0x5646d0[_0xcdd0('0x2a')](_0x14e2c3);});}else{return logger['error'](_0xcdd0('0x2d'),'afterCreate',_0xcdd0('0x70'),util[_0xcdd0('0x2f')](_0x5f569c,{'showHidden':![],'depth':null}));}})[_0xcdd0('0x2b')](function(_0x3a75f6){return logger['error'](_0xcdd0('0x2d'),_0xcdd0('0x2e'),_0xcdd0('0x70'),util['inspect'](_0x3a75f6,{'showHidden':![],'depth':null}));});}else{return logger[_0xcdd0('0x2c')](_0xcdd0('0x2d'),'afterCreate',_0xcdd0('0x70'),_0xcdd0('0x78'));}break;}}})[_0xcdd0('0x79')](function(){_0xa28313();});}else{_0xa28313();}}},'charset':_0xcdd0('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 888cba6..9d51eff 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbebd=['stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22c08b,_0x5ef5f0){var _0x439d18=function(_0x1c757f){while(--_0x1c757f){_0x22c08b['push'](_0x22c08b['shift']());}};_0x439d18(++_0x5ef5f0);}(_0xbebd,0x10a));var _0xdbeb=function(_0x120ffb,_0x10e7d9){_0x120ffb=_0x120ffb-0x0;var _0x52ae39=_0xbebd[_0x120ffb];return _0x52ae39;};'use strict';var _=require('lodash');var util=require(_0xdbeb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbeb('0x1'));var db=require(_0xdbeb('0x2'))['db'];var utils=require(_0xdbeb('0x3'));var logger=require(_0xdbeb('0x4'))(_0xdbeb('0x5'));var config=require(_0xdbeb('0x6'));var jayson=require(_0xdbeb('0x7'));var client=jayson[_0xdbeb('0x8')][_0xdbeb('0x9')]({'port':0x232a});config['redis']=_[_0xdbeb('0xa')](config[_0xdbeb('0xb')],{'host':_0xdbeb('0xc'),'port':0x18eb});var socket=require(_0xdbeb('0xd'))(new Redis(config['redis']));require(_0xdbeb('0xe'))[_0xdbeb('0xf')](socket);function respondWithRpcPromise(_0x32bd1a,_0x20d4fb,_0x5d51a6){return new BPromise(function(_0x323363,_0x397ed2){return client[_0xdbeb('0x10')](_0x32bd1a,_0x5d51a6)[_0xdbeb('0x11')](function(_0x177e5b){logger[_0xdbeb('0x12')](_0xdbeb('0x13'),_0x20d4fb,_0xdbeb('0x14'));logger[_0xdbeb('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x20d4fb,_0xdbeb('0x14'),JSON[_0xdbeb('0x16')](_0x177e5b));if(_0x177e5b[_0xdbeb('0x17')]){if(_0x177e5b[_0xdbeb('0x17')][_0xdbeb('0x18')]===0x1f4){logger[_0xdbeb('0x17')](_0xdbeb('0x13'),_0x20d4fb,_0x177e5b['error'][_0xdbeb('0x19')]);return _0x397ed2(_0x177e5b['error'][_0xdbeb('0x19')]);}logger[_0xdbeb('0x17')]('SmsMessage,\x20%s,\x20%s',_0x20d4fb,_0x177e5b[_0xdbeb('0x17')][_0xdbeb('0x19')]);return _0x323363(_0x177e5b['error']['message']);}else{logger[_0xdbeb('0x12')]('SmsMessage,\x20%s,\x20%s',_0x20d4fb,_0xdbeb('0x14'));_0x323363(_0x177e5b[_0xdbeb('0x1a')][_0xdbeb('0x19')]);}})[_0xdbeb('0x1b')](function(_0x289efc){logger[_0xdbeb('0x17')](_0xdbeb('0x13'),_0x20d4fb,_0x289efc);_0x397ed2(_0x289efc);});});}exports[_0xdbeb('0x1c')]=function(_0x225191){var _0x18b601=this;return new Promise(function(_0x40356d,_0x143b2f){return db[_0xdbeb('0x1d')][_0xdbeb('0x1e')](_0x225191[_0xdbeb('0x1f')],{'raw':_0x225191['options']?_0x225191['options']['raw']===undefined?!![]:![]:!![]})[_0xdbeb('0x11')](function(_0x2a4dd4){logger['info'](_0xdbeb('0x1c'),_0x225191);logger[_0xdbeb('0x15')](_0xdbeb('0x1c'),_0x225191,JSON[_0xdbeb('0x16')](_0x2a4dd4));_0x40356d(_0x2a4dd4);})['catch'](function(_0x1b0fae){logger[_0xdbeb('0x17')](_0xdbeb('0x1c'),_0x1b0fae[_0xdbeb('0x19')],_0x225191);_0x143b2f(_0x18b601[_0xdbeb('0x17')](0x1f4,_0x1b0fae['message']));});});}; \ No newline at end of file +var _0x91d1=['defaults','socket.io-emitter','./smsMessage.socket','register','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis'];(function(_0x537044,_0x4de18f){var _0x5ba75e=function(_0x58cccc){while(--_0x58cccc){_0x537044['push'](_0x537044['shift']());}};_0x5ba75e(++_0x4de18f);}(_0x91d1,0x115));var _0x191d=function(_0x578336,_0xa251d5){_0x578336=_0x578336-0x0;var _0x1e8433=_0x91d1[_0x578336];return _0x1e8433;};'use strict';var _=require(_0x191d('0x0'));var util=require(_0x191d('0x1'));var moment=require(_0x191d('0x2'));var BPromise=require(_0x191d('0x3'));var rs=require(_0x191d('0x4'));var fs=require('fs');var Redis=require(_0x191d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x191d('0x6'));var logger=require('../../config/logger')(_0x191d('0x7'));var config=require(_0x191d('0x8'));var jayson=require(_0x191d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x191d('0xa')]=_[_0x191d('0xb')](config[_0x191d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x191d('0xc'))(new Redis(config['redis']));require(_0x191d('0xd'))[_0x191d('0xe')](socket);function respondWithRpcPromise(_0x3f6c96,_0x441d14,_0x32aea6){return new BPromise(function(_0x5dbe60,_0x68bdd1){return client['request'](_0x3f6c96,_0x32aea6)[_0x191d('0xf')](function(_0x4e51a4){logger['info']('SmsMessage,\x20%s,\x20%s',_0x441d14,_0x191d('0x10'));logger[_0x191d('0x11')](_0x191d('0x12'),_0x441d14,_0x191d('0x10'),JSON[_0x191d('0x13')](_0x4e51a4));if(_0x4e51a4[_0x191d('0x14')]){if(_0x4e51a4[_0x191d('0x14')][_0x191d('0x15')]===0x1f4){logger[_0x191d('0x14')](_0x191d('0x16'),_0x441d14,_0x4e51a4[_0x191d('0x14')][_0x191d('0x17')]);return _0x68bdd1(_0x4e51a4[_0x191d('0x14')]['message']);}logger[_0x191d('0x14')](_0x191d('0x16'),_0x441d14,_0x4e51a4[_0x191d('0x14')]['message']);return _0x5dbe60(_0x4e51a4[_0x191d('0x14')][_0x191d('0x17')]);}else{logger[_0x191d('0x18')](_0x191d('0x16'),_0x441d14,'request\x20sent');_0x5dbe60(_0x4e51a4[_0x191d('0x19')][_0x191d('0x17')]);}})[_0x191d('0x1a')](function(_0x312a16){logger['error'](_0x191d('0x16'),_0x441d14,_0x312a16);_0x68bdd1(_0x312a16);});});}exports[_0x191d('0x1b')]=function(_0x123202){var _0x3a9263=this;return new Promise(function(_0x1f2bb6,_0xb74dc8){return db[_0x191d('0x1c')][_0x191d('0x1d')](_0x123202[_0x191d('0x1e')],{'raw':_0x123202[_0x191d('0x1f')]?_0x123202[_0x191d('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x191d('0xf')](function(_0x4b930c){logger[_0x191d('0x18')]('CreateSmsMessage',_0x123202);logger[_0x191d('0x11')](_0x191d('0x1b'),_0x123202,JSON[_0x191d('0x13')](_0x4b930c));_0x1f2bb6(_0x4b930c);})[_0x191d('0x1a')](function(_0x17c66d){logger[_0x191d('0x14')](_0x191d('0x1b'),_0x17c66d[_0x191d('0x17')],_0x123202);_0xb74dc8(_0x3a9263[_0x191d('0x14')](0x1f4,_0x17c66d[_0x191d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 6378817..35a9949 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb6d=['register','length','smsMessage:','./smsMessage.events','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb6d,0x193));var _0xdeb6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xeb6d[_0x5f0089];return _0x193892;};'use strict';var SmsMessageEvents=require(_0xdeb6('0x0'));var events=[_0xdeb6('0x1'),_0xdeb6('0x2'),'update'];function createListener(_0x28c620,_0x5a78a8){return function(_0x477838){_0x5a78a8[_0xdeb6('0x3')](_0x28c620,_0x477838);};}function removeListener(_0xf47d11,_0x41ee52){return function(){SmsMessageEvents[_0xdeb6('0x4')](_0xf47d11,_0x41ee52);};}exports[_0xdeb6('0x5')]=function(_0x38764e){for(var _0x41f4c7=0x0,_0x504790=events[_0xdeb6('0x6')];_0x41f4c7<_0x504790;_0x41f4c7++){var _0x56fc18=events[_0x41f4c7];var _0x3ade06=createListener(_0xdeb6('0x7')+_0x56fc18,_0x38764e);SmsMessageEvents['on'](_0x56fc18,_0x3ade06);}}; \ No newline at end of file +var _0x26c5=['removeListener','register','length','smsMessage:','save','remove','update','emit'];(function(_0x2389cb,_0x3d47d8){var _0x3fba70=function(_0x1d178d){while(--_0x1d178d){_0x2389cb['push'](_0x2389cb['shift']());}};_0x3fba70(++_0x3d47d8);}(_0x26c5,0xd4));var _0x526c=function(_0x6f6c98,_0x470e42){_0x6f6c98=_0x6f6c98-0x0;var _0x20f154=_0x26c5[_0x6f6c98];return _0x20f154;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x526c('0x0'),_0x526c('0x1'),_0x526c('0x2')];function createListener(_0xd6c7f7,_0x799109){return function(_0x38bccf){_0x799109[_0x526c('0x3')](_0xd6c7f7,_0x38bccf);};}function removeListener(_0x4037e4,_0x8013bf){return function(){SmsMessageEvents[_0x526c('0x4')](_0x4037e4,_0x8013bf);};}exports[_0x526c('0x5')]=function(_0x5e838e){for(var _0x2fdf4c=0x0,_0x13a4c6=events[_0x526c('0x6')];_0x2fdf4c<_0x13a4c6;_0x2fdf4c++){var _0xd38b7e=events[_0x2fdf4c];var _0x397d46=createListener(_0x526c('0x7')+_0xd38b7e,_0x5e838e);SmsMessageEvents['on'](_0xd38b7e,_0x397d46);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 2080036..b44745a 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d3d=['/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','delete','/:id','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','show','getMembers','getTeams'];(function(_0xeb4f14,_0x40b0bb){var _0xbdb9ae=function(_0x1ccfe4){while(--_0x1ccfe4){_0xeb4f14['push'](_0xeb4f14['shift']());}};_0xbdb9ae(++_0x40b0bb);}(_0x1d3d,0x7c));var _0xd1d3=function(_0x38325,_0x262d3c){_0x38325=_0x38325-0x0;var _0x2994d6=_0x1d3d[_0x38325];return _0x2994d6;};'use strict';var multer=require('multer');var util=require(_0xd1d3('0x0'));var path=require(_0xd1d3('0x1'));var timeout=require(_0xd1d3('0x2'));var express=require(_0xd1d3('0x3'));var router=express[_0xd1d3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd1d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd1d3('0x6'));var controller=require(_0xd1d3('0x7'));router['get']('/',auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x9')]);router[_0xd1d3('0xa')](_0xd1d3('0xb'),auth['isAuthenticated'](),controller[_0xd1d3('0xc')]);router[_0xd1d3('0xa')]('/:id',auth[_0xd1d3('0x8')](),controller[_0xd1d3('0xd')]);router[_0xd1d3('0xa')]('/:id/members',auth[_0xd1d3('0x8')](),controller[_0xd1d3('0xe')]);router[_0xd1d3('0xa')]('/:id/teams',auth[_0xd1d3('0x8')](),controller[_0xd1d3('0xf')]);router['get'](_0xd1d3('0x10'),auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x11')]);router[_0xd1d3('0x12')]('/',auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x13')]);router[_0xd1d3('0x12')](_0xd1d3('0x14'),auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x15')]);router[_0xd1d3('0x12')](_0xd1d3('0x10'),auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x16')]);router['put']('/:id',auth[_0xd1d3('0x8')](),controller['update']);router[_0xd1d3('0x17')](_0xd1d3('0x18'),auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x19')]);router['delete'](_0xd1d3('0x14'),auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x1a')]);router['delete'](_0xd1d3('0x10'),auth[_0xd1d3('0x8')](),controller[_0xd1d3('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xe05b=['removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete'];(function(_0x5e4e5d,_0x381d6c){var _0x2bcec1=function(_0x5b49ab){while(--_0x5b49ab){_0x5e4e5d['push'](_0x5e4e5d['shift']());}};_0x2bcec1(++_0x381d6c);}(_0xe05b,0xc5));var _0xbe05=function(_0x158001,_0x30d302){_0x158001=_0x158001-0x0;var _0x56cf61=_0xe05b[_0x158001];return _0x56cf61;};'use strict';var multer=require(_0xbe05('0x0'));var util=require(_0xbe05('0x1'));var path=require('path');var timeout=require(_0xbe05('0x2'));var express=require(_0xbe05('0x3'));var router=express[_0xbe05('0x4')]();var fs_extra=require(_0xbe05('0x5'));var auth=require(_0xbe05('0x6'));var interaction=require(_0xbe05('0x7'));var config=require(_0xbe05('0x8'));var controller=require(_0xbe05('0x9'));router['get']('/',auth[_0xbe05('0xa')](),controller['index']);router[_0xbe05('0xb')](_0xbe05('0xc'),auth[_0xbe05('0xa')](),controller[_0xbe05('0xd')]);router['get'](_0xbe05('0xe'),auth[_0xbe05('0xa')](),controller[_0xbe05('0xf')]);router[_0xbe05('0xb')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xbe05('0xb')](_0xbe05('0x10'),auth[_0xbe05('0xa')](),controller['getTeams']);router[_0xbe05('0xb')](_0xbe05('0x11'),auth[_0xbe05('0xa')](),controller[_0xbe05('0x12')]);router[_0xbe05('0x13')]('/',auth['isAuthenticated'](),controller[_0xbe05('0x14')]);router[_0xbe05('0x13')](_0xbe05('0x10'),auth[_0xbe05('0xa')](),controller[_0xbe05('0x15')]);router[_0xbe05('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe05('0x16')]);router[_0xbe05('0x17')]('/:id',auth[_0xbe05('0xa')](),controller[_0xbe05('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbe05('0x19')]);router[_0xbe05('0x1a')](_0xbe05('0x10'),auth[_0xbe05('0xa')](),controller[_0xbe05('0x1b')]);router[_0xbe05('0x1a')](_0xbe05('0x11'),auth[_0xbe05('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index af74c2d..afe5a97 100644 --- a/server/api/smsQueue/smsQueue.attributes.js +++ b/server/api/smsQueue/smsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe1a=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x128832,_0x480891){var _0x245228=function(_0x4e1641){while(--_0x4e1641){_0x128832['push'](_0x128832['shift']());}};_0x245228(++_0x480891);}(_0xbe1a,0x1b4));var _0xabe1=function(_0xb1b665,_0x5de333){_0xb1b665=_0xb1b665-0x0;var _0x22521a=_0xbe1a[_0xb1b665];return _0x22521a;};'use strict';var Sequelize=require(_0xabe1('0x0'));module[_0xabe1('0x1')]={'name':{'type':Sequelize[_0xabe1('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xabe1('0x2')]},'timeout':{'type':Sequelize[_0xabe1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabe1('0x4')](_0xabe1('0x5'),_0xabe1('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x175d=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x175d,0x100));var _0xd175=function(_0x38110e,_0x5bd177){_0x38110e=_0x38110e-0x0;var _0x5d4946=_0x175d[_0x38110e];return _0x5d4946;};'use strict';var Sequelize=require(_0xd175('0x0'));module[_0xd175('0x1')]={'name':{'type':Sequelize[_0xd175('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd175('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd175('0x4')](_0xd175('0x5'),_0xd175('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 646c085..06a5f34 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b47=['../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','SmsQueue','findAll','show','params','length','include','find','create','body','role','user','SmsQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x208dd6,_0x5692bc){var _0x23b269=function(_0x3a2313){while(--_0x3a2313){_0x208dd6['push'](_0x208dd6['shift']());}};_0x23b269(++_0x5692bc);}(_0x2b47,0x77));var _0x72b4=function(_0x4b315d,_0x342ef6){_0x4b315d=_0x4b315d-0x0;var _0x292c30=_0x2b47[_0x4b315d];return _0x292c30;};'use strict';var emlformat=require(_0x72b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x72b4('0x1'));var rp=require(_0x72b4('0x2'));var moment=require(_0x72b4('0x3'));var BPromise=require(_0x72b4('0x4'));var Mustache=require(_0x72b4('0x5'));var util=require('util');var path=require(_0x72b4('0x6'));var sox=require('sox');var csv=require(_0x72b4('0x7'));var ejs=require(_0x72b4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x72b4('0x9'));var jsforce=require(_0x72b4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x72b4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x72b4('0xb'));var authService=require(_0x72b4('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72b4('0xd'));var logger=require('../../config/logger')(_0x72b4('0xe'));var utils=require(_0x72b4('0xf'));var config=require(_0x72b4('0x10'));var licenseUtil=require(_0x72b4('0x11'));var db=require('../../mysqldb')['db'];config[_0x72b4('0x12')]=_[_0x72b4('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x72b4('0x14'))(new Redis(config[_0x72b4('0x12')]));require(_0x72b4('0x15'))[_0x72b4('0x16')](socket);function respondWithStatusCode(_0x383706,_0x3c7e2e){_0x3c7e2e=_0x3c7e2e||0xcc;return function(_0x90dc7){if(_0x90dc7){return _0x383706[_0x72b4('0x17')](_0x3c7e2e);}return _0x383706[_0x72b4('0x18')](_0x3c7e2e)[_0x72b4('0x19')]();};}function respondWithResult(_0x2f54aa,_0x2ba378){_0x2ba378=_0x2ba378||0xc8;return function(_0x1589b2){if(_0x1589b2){return _0x2f54aa['status'](_0x2ba378)[_0x72b4('0x1a')](_0x1589b2);}};}function respondWithFilteredResult(_0x20b639,_0x593d54){return function(_0x44ec76){if(_0x44ec76){var _0x2f09da=typeof _0x593d54[_0x72b4('0x1b')]==='undefined'&&typeof _0x593d54['limit']===_0x72b4('0x1c');var _0x1443f6=_0x44ec76[_0x72b4('0x1d')];var _0xea007f=_0x2f09da?0x0:_0x593d54['offset'];var _0x436cee=_0x2f09da?_0x44ec76[_0x72b4('0x1d')]:_0x593d54[_0x72b4('0x1b')]+_0x593d54[_0x72b4('0x1e')];var _0x10c0d6;if(_0x436cee>=_0x1443f6){_0x436cee=_0x1443f6;_0x10c0d6=0xc8;}else{_0x10c0d6=0xce;}_0x20b639['status'](_0x10c0d6);return _0x20b639[_0x72b4('0x1f')](_0x72b4('0x20'),_0xea007f+'-'+_0x436cee+'/'+_0x1443f6)['json'](_0x44ec76);}return null;};}function patchUpdates(_0x2df539){return function(_0x2595f7){try{jsonpatch[_0x72b4('0x21')](_0x2595f7,_0x2df539,!![]);}catch(_0xe0abfe){return BPromise[_0x72b4('0x22')](_0xe0abfe);}return _0x2595f7[_0x72b4('0x23')]();};}function saveUpdates(_0x93b070,_0x825987){return function(_0x4ac5ae){if(_0x4ac5ae){return _0x4ac5ae[_0x72b4('0x24')](_0x93b070)[_0x72b4('0x25')](function(_0x53cc63){return _0x53cc63;});}return null;};}function removeEntity(_0x29deba,_0x34bc6b){return function(_0x1fc237){if(_0x1fc237){return _0x1fc237['destroy']()[_0x72b4('0x25')](function(){var _0x52b425=_0x1fc237[_0x72b4('0x26')]({'plain':!![]});var _0x40c78c='SmsQueues';return db['UserProfileResource'][_0x72b4('0x27')]({'where':{'type':_0x40c78c,'resourceId':_0x52b425['id']}})[_0x72b4('0x25')](function(){return _0x1fc237;});})[_0x72b4('0x25')](function(){_0x29deba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bf3ef,_0x4c19bb){return function(_0x282227){if(!_0x282227){_0x2bf3ef[_0x72b4('0x17')](0x194);}return _0x282227;};}function handleError(_0x39a3d3,_0x3c0078){_0x3c0078=_0x3c0078||0x1f4;return function(_0x59800d){logger[_0x72b4('0x28')](_0x59800d[_0x72b4('0x29')]);if(_0x59800d[_0x72b4('0x2a')]){delete _0x59800d[_0x72b4('0x2a')];}_0x39a3d3[_0x72b4('0x18')](_0x3c0078)[_0x72b4('0x2b')](_0x59800d);};}exports[_0x72b4('0x2c')]=function(_0xc19d7e,_0x37472e){var _0x462710={},_0x58ea89={},_0x2fa41e={'count':0x0,'rows':[]};var _0x1cecf4=_[_0x72b4('0x2d')](db['SmsQueue'][_0x72b4('0x2e')],function(_0x34be7c){return{'name':_0x34be7c['fieldName'],'type':_0x34be7c[_0x72b4('0x2f')][_0x72b4('0x30')]};});_0x58ea89[_0x72b4('0x31')]=_['map'](_0x1cecf4,_0x72b4('0x2a'));_0x58ea89[_0x72b4('0x32')]=_[_0x72b4('0x33')](_0xc19d7e[_0x72b4('0x32')]);_0x58ea89[_0x72b4('0x34')]=_[_0x72b4('0x35')](_0x58ea89['model'],_0x58ea89[_0x72b4('0x32')]);_0x462710['attributes']=_[_0x72b4('0x35')](_0x58ea89[_0x72b4('0x31')],qs[_0x72b4('0x36')](_0xc19d7e['query']['fields']));_0x462710[_0x72b4('0x37')]=_0x462710[_0x72b4('0x37')]['length']?_0x462710[_0x72b4('0x37')]:_0x58ea89[_0x72b4('0x31')];if(!_0xc19d7e[_0x72b4('0x32')]['hasOwnProperty'](_0x72b4('0x38'))){_0x462710[_0x72b4('0x1e')]=qs[_0x72b4('0x1e')](_0xc19d7e[_0x72b4('0x32')][_0x72b4('0x1e')]);_0x462710[_0x72b4('0x1b')]=qs[_0x72b4('0x1b')](_0xc19d7e[_0x72b4('0x32')][_0x72b4('0x1b')]);}_0x462710[_0x72b4('0x39')]=qs['sort'](_0xc19d7e[_0x72b4('0x32')][_0x72b4('0x3a')]);_0x462710[_0x72b4('0x3b')]=qs[_0x72b4('0x34')](_[_0x72b4('0x3c')](_0xc19d7e[_0x72b4('0x32')],_0x58ea89[_0x72b4('0x34')]),_0x1cecf4);if(_0xc19d7e['query'][_0x72b4('0x3d')]){_0x462710[_0x72b4('0x3b')]=_[_0x72b4('0x3e')](_0x462710[_0x72b4('0x3b')],{'$or':_['map'](_0x1cecf4,function(_0x3c61c9){if(_0x3c61c9[_0x72b4('0x2f')]!=='VIRTUAL'){var _0xa17196={};_0xa17196[_0x3c61c9[_0x72b4('0x2a')]]={'$like':'%'+_0xc19d7e[_0x72b4('0x32')][_0x72b4('0x3d')]+'%'};return _0xa17196;}})});}_0x462710=_[_0x72b4('0x3e')]({},_0x462710,_0xc19d7e['options']);var _0x40d958={'where':_0x462710['where']};return db['SmsQueue'][_0x72b4('0x1d')](_0x40d958)[_0x72b4('0x25')](function(_0x26a1e1){_0x2fa41e['count']=_0x26a1e1;if(_0xc19d7e[_0x72b4('0x32')][_0x72b4('0x3f')]){_0x462710['include']=[{'all':!![]}];}return db[_0x72b4('0x40')][_0x72b4('0x41')](_0x462710);})[_0x72b4('0x25')](function(_0xab6ec8){_0x2fa41e['rows']=_0xab6ec8;return _0x2fa41e;})[_0x72b4('0x25')](respondWithFilteredResult(_0x37472e,_0x462710))['catch'](handleError(_0x37472e,null));};exports[_0x72b4('0x42')]=function(_0x425c37,_0x33f3a1){var _0x25299a={'raw':!![],'where':{'id':_0x425c37[_0x72b4('0x43')]['id']}},_0x13d908={};_0x13d908['model']=_[_0x72b4('0x33')](db['SmsQueue']['rawAttributes']);_0x13d908[_0x72b4('0x32')]=_[_0x72b4('0x33')](_0x425c37['query']);_0x13d908[_0x72b4('0x34')]=_[_0x72b4('0x35')](_0x13d908[_0x72b4('0x31')],_0x13d908[_0x72b4('0x32')]);_0x25299a[_0x72b4('0x37')]=_[_0x72b4('0x35')](_0x13d908[_0x72b4('0x31')],qs[_0x72b4('0x36')](_0x425c37[_0x72b4('0x32')][_0x72b4('0x36')]));_0x25299a[_0x72b4('0x37')]=_0x25299a['attributes'][_0x72b4('0x44')]?_0x25299a[_0x72b4('0x37')]:_0x13d908[_0x72b4('0x31')];if(_0x425c37['query'][_0x72b4('0x3f')]){_0x25299a[_0x72b4('0x45')]=[{'all':!![]}];}_0x25299a=_[_0x72b4('0x3e')]({},_0x25299a,_0x425c37['options']);return db[_0x72b4('0x40')][_0x72b4('0x46')](_0x25299a)['then'](handleEntityNotFound(_0x33f3a1,null))[_0x72b4('0x25')](respondWithResult(_0x33f3a1,null))['catch'](handleError(_0x33f3a1,null));};exports[_0x72b4('0x47')]=function(_0x3cc9b1,_0x776709){return db['SmsQueue'][_0x72b4('0x47')](_0x3cc9b1[_0x72b4('0x48')],{})['then'](function(_0x4000e8){var _0x294ded=_0x3cc9b1['user'][_0x72b4('0x26')]({'plain':!![]});if(!_0x294ded)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x294ded[_0x72b4('0x49')]===_0x72b4('0x4a')){var _0x468790=_0x4000e8[_0x72b4('0x26')]({'plain':!![]});var _0x37901e=_0x72b4('0x4b');return db['UserProfileSection'][_0x72b4('0x46')]({'where':{'name':_0x37901e,'userProfileId':_0x294ded[_0x72b4('0x4c')]},'raw':!![]})[_0x72b4('0x25')](function(_0x16fe3c){if(_0x16fe3c&&_0x16fe3c[_0x72b4('0x4d')]===0x0){return db['UserProfileResource'][_0x72b4('0x47')]({'name':_0x468790[_0x72b4('0x2a')],'resourceId':_0x468790['id'],'type':_0x16fe3c[_0x72b4('0x2a')],'sectionId':_0x16fe3c['id']},{})['then'](function(){return _0x4000e8;});}else{return _0x4000e8;}})['catch'](function(_0x4670d6){logger[_0x72b4('0x28')](_0x72b4('0x4e'),_0x4670d6);throw _0x4670d6;});}return _0x4000e8;})[_0x72b4('0x25')](respondWithResult(_0x776709,0xc9))[_0x72b4('0x4f')](handleError(_0x776709,null));};exports[_0x72b4('0x24')]=function(_0x41a45d,_0x488448){if(_0x41a45d[_0x72b4('0x48')]['id']){delete _0x41a45d[_0x72b4('0x48')]['id'];}return db[_0x72b4('0x40')][_0x72b4('0x46')]({'where':{'id':_0x41a45d['params']['id']}})['then'](handleEntityNotFound(_0x488448,null))[_0x72b4('0x25')](saveUpdates(_0x41a45d['body'],null))[_0x72b4('0x25')](respondWithResult(_0x488448,null))[_0x72b4('0x4f')](handleError(_0x488448,null));};exports[_0x72b4('0x27')]=function(_0x284035,_0x1818b8){return db[_0x72b4('0x40')][_0x72b4('0x46')]({'where':{'id':_0x284035[_0x72b4('0x43')]['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x1818b8,null))[_0x72b4('0x25')](removeEntity(_0x1818b8,null))[_0x72b4('0x4f')](handleError(_0x1818b8,null));};exports[_0x72b4('0x50')]=function(_0x50221e,_0x2277fd){return db[_0x72b4('0x40')]['describe']()[_0x72b4('0x25')](respondWithResult(_0x2277fd,null))['catch'](handleError(_0x2277fd,null));};exports[_0x72b4('0x51')]=function(_0x480be9,_0x5c3ba0,_0x320918){var _0x40cc65={'raw':!![],'where':{}},_0x42215f={},_0x27ccd3;return db['SmsQueue'][_0x72b4('0x52')]({'where':{'id':_0x480be9['params']['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x5c3ba0,null))[_0x72b4('0x25')](function(_0x2875e7){if(_0x2875e7){_0x27ccd3=_0x2875e7['get']({'plain':!![]});_0x42215f[_0x72b4('0x31')]=_[_0x72b4('0x33')](db[_0x72b4('0x53')][_0x72b4('0x2e')]);_0x42215f[_0x72b4('0x32')]=_[_0x72b4('0x33')](_0x480be9[_0x72b4('0x32')]);_0x42215f[_0x72b4('0x34')]=_[_0x72b4('0x35')](_0x42215f[_0x72b4('0x31')],_0x42215f[_0x72b4('0x32')]);_0x40cc65[_0x72b4('0x37')]=_[_0x72b4('0x35')](_0x42215f[_0x72b4('0x31')],qs['fields'](_0x480be9[_0x72b4('0x32')][_0x72b4('0x36')]));_0x40cc65[_0x72b4('0x37')]=_0x40cc65[_0x72b4('0x37')][_0x72b4('0x44')]?_0x40cc65[_0x72b4('0x37')]:_0x42215f[_0x72b4('0x31')];if(!_0x480be9['query'][_0x72b4('0x54')]('nolimit')){_0x40cc65[_0x72b4('0x1e')]=qs['limit'](_0x480be9['query'][_0x72b4('0x1e')]);_0x40cc65[_0x72b4('0x1b')]=qs[_0x72b4('0x1b')](_0x480be9[_0x72b4('0x32')][_0x72b4('0x1b')]);}_0x40cc65[_0x72b4('0x39')]=qs[_0x72b4('0x3a')](_0x480be9[_0x72b4('0x32')][_0x72b4('0x3a')]);_0x40cc65[_0x72b4('0x3b')]=qs[_0x72b4('0x34')](_[_0x72b4('0x3c')](_0x480be9[_0x72b4('0x32')],_0x42215f[_0x72b4('0x34')]));_0x40cc65[_0x72b4('0x3b')][_0x72b4('0x55')]=_0x2875e7['id'];if(_0x480be9[_0x72b4('0x32')][_0x72b4('0x3d')]){_0x40cc65[_0x72b4('0x3b')]=_[_0x72b4('0x3e')](_0x40cc65[_0x72b4('0x3b')],{'$or':_[_0x72b4('0x2d')](_0x40cc65['attributes'],function(_0x5c6cce){var _0x50a34d={};_0x50a34d[_0x5c6cce]={'$like':'%'+_0x480be9['query']['filter']+'%'};return _0x50a34d;})});}_0x40cc65=_['merge']({},_0x40cc65,_0x480be9['options']);return db[_0x72b4('0x53')][_0x72b4('0x41')](_0x40cc65);}})['then'](function(_0x5439ce){if(_0x5439ce){return db['User'][_0x72b4('0x56')]({'where':{'id':_[_0x72b4('0x2d')](_0x5439ce,_0x72b4('0x57')),'role':_0x72b4('0x58')},'attributes':['id',_0x72b4('0x2a'),'smsPause',_0x72b4('0x59'),_0x72b4('0x5a')]});}})[_0x72b4('0x25')](function(_0x46e537){if(_0x46e537){return{'count':_0x46e537['count'],'rows':_['map'](_0x46e537['rows'],function(_0x533a16){return{'membername':_0x533a16[_0x72b4('0x2a')],'UserId':_0x533a16['id'],'queue_name':_0x27ccd3[_0x72b4('0x2a')],'SmsQueueId':_0x27ccd3['id'],'interface':util[_0x72b4('0x5b')](_0x72b4('0x5c'),_0x72b4('0x5d'),_0x533a16[_0x72b4('0x2a')]),'penalty':0x0,'paused':_0x533a16['smsPause'],'createdAt':_0x533a16[_0x72b4('0x5a')],'updatedAt':_0x533a16['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x72b4('0x25')](respondWithFilteredResult(_0x5c3ba0,_0x40cc65))[_0x72b4('0x4f')](handleError(_0x5c3ba0,null));};exports[_0x72b4('0x5e')]=function(_0xc864de,_0x3144f9,_0x493095){var _0x1cce57={};var _0x1e3ac3={};var _0x1048e7;var _0x4e6e9a;return db[_0x72b4('0x40')][_0x72b4('0x52')]({'where':{'id':_0xc864de['params']['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x3144f9,null))[_0x72b4('0x25')](function(_0x583893){if(_0x583893){_0x1048e7=_0x583893;_0x1e3ac3[_0x72b4('0x31')]=_[_0x72b4('0x33')](db[_0x72b4('0x5f')][_0x72b4('0x2e')]);_0x1e3ac3['query']=_[_0x72b4('0x33')](_0xc864de[_0x72b4('0x32')]);_0x1e3ac3[_0x72b4('0x34')]=_[_0x72b4('0x35')](_0x1e3ac3[_0x72b4('0x31')],_0x1e3ac3['query']);_0x1cce57['attributes']=_[_0x72b4('0x35')](_0x1e3ac3[_0x72b4('0x31')],qs[_0x72b4('0x36')](_0xc864de[_0x72b4('0x32')]['fields']));_0x1cce57['attributes']=_0x1cce57[_0x72b4('0x37')][_0x72b4('0x44')]?_0x1cce57[_0x72b4('0x37')]:_0x1e3ac3[_0x72b4('0x31')];_0x1cce57[_0x72b4('0x39')]=qs[_0x72b4('0x3a')](_0xc864de['query'][_0x72b4('0x3a')]);_0x1cce57[_0x72b4('0x3b')]=qs[_0x72b4('0x34')](_[_0x72b4('0x3c')](_0xc864de[_0x72b4('0x32')],_0x1e3ac3[_0x72b4('0x34')]));if(_0xc864de['query'][_0x72b4('0x3d')]){_0x1cce57['where']=_['merge'](_0x1cce57['where'],{'$or':_[_0x72b4('0x2d')](_0x1cce57['attributes'],function(_0x19b5d1){var _0x26025f={};_0x26025f[_0x19b5d1]={'$like':'%'+_0xc864de[_0x72b4('0x32')][_0x72b4('0x3d')]+'%'};return _0x26025f;})});}_0x1cce57=_['merge']({},_0x1cce57,_0xc864de[_0x72b4('0x60')]);return _0x1048e7[_0x72b4('0x5e')](_0x1cce57);}})[_0x72b4('0x25')](function(_0x304549){if(_0x304549){_0x4e6e9a=_0x304549[_0x72b4('0x44')];if(!_0xc864de[_0x72b4('0x32')]['hasOwnProperty'](_0x72b4('0x38'))){_0x1cce57[_0x72b4('0x1e')]=qs[_0x72b4('0x1e')](_0xc864de[_0x72b4('0x32')]['limit']);_0x1cce57[_0x72b4('0x1b')]=qs[_0x72b4('0x1b')](_0xc864de[_0x72b4('0x32')][_0x72b4('0x1b')]);}return _0x1048e7[_0x72b4('0x5e')](_0x1cce57);}})[_0x72b4('0x25')](function(_0x23a72e){if(_0x23a72e){return _0x23a72e?{'count':_0x4e6e9a,'rows':_0x23a72e}:null;}})[_0x72b4('0x25')](respondWithResult(_0x3144f9,null))['catch'](handleError(_0x3144f9,null));};exports['addTeams']=function(_0xe2e387,_0x47263d,_0x244fc1){var _0x2636aa=_0xe2e387[_0x72b4('0x48')][_0x72b4('0x61')];return db['Team'][_0x72b4('0x41')]({'where':{'id':_0x2636aa},'attributes':['id'],'include':[{'model':db[_0x72b4('0x62')],'as':'Agents','attributes':['id','name',_0x72b4('0x63'),_0x72b4('0x64'),_0x72b4('0x65')],'raw':!![]}]})[_0x72b4('0x25')](function(_0x3237e6){if(_0x3237e6){var _0x60e748=_[_0x72b4('0x66')](_0x3237e6,function(_0x28beb6){var _0x40aedf=_0x28beb6['get']({'plain':!![]});return _0x40aedf[_0x72b4('0x67')];});return db[_0x72b4('0x40')]['find']({'where':{'id':_0xe2e387[_0x72b4('0x43')]['id']}})[_0x72b4('0x25')](function(_0x5b2c78){return db[_0x72b4('0x68')][_0x72b4('0x69')](function(_0x4ecc2f){return _0x5b2c78[_0x72b4('0x6a')](_0x2636aa,{'transaction':_0x4ecc2f})[_0x72b4('0x25')](function(){return BPromise['each'](_0x60e748,function(_0x1004b8){return db[_0x72b4('0x53')][_0x72b4('0x6b')]({'where':{'UserId':_0x1004b8['id'],'SmsQueueId':_0xe2e387[_0x72b4('0x43')]['id']},'transaction':_0x4ecc2f});});})['then'](function(){_0x60e748[_0x72b4('0x6c')](function(_0x3d218a){socket[_0x72b4('0x6d')](_0x72b4('0x6e'),{'UserId':_0x3d218a['id'],'SmsQueueId':_0x5b2c78['id']});});});});});}})['then'](respondWithStatusCode(_0x47263d,null))[_0x72b4('0x4f')](handleError(_0x47263d,null));};exports['removeTeams']=function(_0xa2f1c,_0x15db2f,_0x50589b){return db[_0x72b4('0x5f')][_0x72b4('0x41')]({'where':{'id':_0xa2f1c[_0x72b4('0x32')][_0x72b4('0x61')]},'attributes':['id'],'include':[{'model':db[_0x72b4('0x62')],'as':_0x72b4('0x67'),'attributes':['id'],'raw':!![]}]})[_0x72b4('0x25')](handleEntityNotFound(_0x15db2f,null))[_0x72b4('0x25')](function(_0x346a66){var _0x4e8960=_[_0x72b4('0x2d')](_0x346a66,'id');var _0x356feb=[];var _0x5f4534=[];var _0x2f7829=squel[_0x72b4('0x6f')]();_0x2f7829[_0x72b4('0x70')](_0x72b4('0x71'))['from']('team_has_sms_queues','tq')[_0x72b4('0x72')](_0x72b4('0x73'),'ut',_0x72b4('0x74'))['where'](_0x72b4('0x75'),_0xa2f1c[_0x72b4('0x43')]['id']);for(var _0x3ae172=0x0;_0x3ae172<_0x346a66[_0x72b4('0x44')];_0x3ae172+=0x1){let _0xcacb47=_0x346a66[_0x3ae172];for(var _0x19d990=0x0;_0x19d990<_0xcacb47[_0x72b4('0x67')][_0x72b4('0x44')];_0x19d990+=0x1){let _0x1052ef=_0xcacb47['Agents'][_0x19d990];var _0x5e5b44=_0x2f7829[_0x72b4('0x76')]();_0x5e5b44['where'](_0x72b4('0x77'),_0x1052ef['id']);_0x5f4534[_0x72b4('0x78')](db[_0x72b4('0x68')][_0x72b4('0x32')](_0x5e5b44['toString'](),{'type':db[_0x72b4('0x68')][_0x72b4('0x79')]['SELECT']})['then'](function(_0x5d5dc2){if(_0x5d5dc2[_0x72b4('0x44')]===0x1){return _0x1052ef['id'];}else{var _0x49de76=_['every'](_[_0x72b4('0x2d')](_0x5d5dc2,_0x72b4('0x7a')),function(_0xe6afff){return _[_0x72b4('0x7b')](_0x4e8960,_0xe6afff);});if(_0x49de76){return _0x1052ef['id'];}}}));}}return BPromise[_0x72b4('0x7c')](_0x5f4534)['then'](function(_0x5f0198){_0x356feb=_(_0x356feb)['union'](_0x5f0198)[_0x72b4('0x7d')]()[_0x72b4('0x7e')]();return db[_0x72b4('0x40')][_0x72b4('0x46')]({'where':{'id':_0xa2f1c[_0x72b4('0x43')]['id']}})[_0x72b4('0x25')](function(_0x3c4f81){return db[_0x72b4('0x68')]['transaction'](function(_0x281ce4){return _0x3c4f81[_0x72b4('0x7f')](_0xa2f1c[_0x72b4('0x32')][_0x72b4('0x61')],{'transaction':_0x281ce4})[_0x72b4('0x25')](function(){if(!_[_0x72b4('0x80')](_0x356feb)){return _0x3c4f81[_0x72b4('0x81')](_0x356feb,{'transaction':_0x281ce4});}})[_0x72b4('0x25')](function(){_0x356feb[_0x72b4('0x6c')](function(_0x1cede2){socket[_0x72b4('0x6d')](_0x72b4('0x82'),{'UserId':_0x1cede2,'SmsQueueId':_0x3c4f81['id']});});});});});});})[_0x72b4('0x25')](respondWithStatusCode(_0x15db2f,null))[_0x72b4('0x4f')](handleError(_0x15db2f,null));};exports[_0x72b4('0x83')]=function(_0x342c22,_0x213854,_0x368d43){return db[_0x72b4('0x40')][_0x72b4('0x46')]({'where':{'id':_0x342c22[_0x72b4('0x43')]['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x213854,null))[_0x72b4('0x25')](function(_0x4ca82e){if(_0x4ca82e){return _0x4ca82e[_0x72b4('0x83')](_0x342c22[_0x72b4('0x48')][_0x72b4('0x61')],_[_0x72b4('0x84')](_0x342c22[_0x72b4('0x48')],[_0x72b4('0x61'),'id'])||{})['spread'](function(_0x5d75bc){for(var _0x13be42=0x0;_0x13be42<_0x342c22[_0x72b4('0x48')][_0x72b4('0x61')][_0x72b4('0x44')];_0x13be42+=0x1){socket[_0x72b4('0x6d')]('userSmsQueue:save',{'UserId':Number(_0x342c22[_0x72b4('0x48')][_0x72b4('0x61')][_0x13be42]),'SmsQueueId':Number(_0x342c22[_0x72b4('0x43')]['id'])});}return _0x5d75bc;});}})['then'](respondWithResult(_0x213854,null))[_0x72b4('0x4f')](handleError(_0x213854,null));};exports['removeAgents']=function(_0x4bf73f,_0x95a40c,_0x181c66){return db[_0x72b4('0x40')][_0x72b4('0x46')]({'where':{'id':_0x4bf73f[_0x72b4('0x43')]['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x95a40c,null))[_0x72b4('0x25')](function(_0x7d98dc){if(_0x7d98dc){return _0x7d98dc[_0x72b4('0x81')](_0x4bf73f[_0x72b4('0x32')][_0x72b4('0x61')])[_0x72b4('0x25')](function(){if(_[_0x72b4('0x85')](_0x4bf73f[_0x72b4('0x32')][_0x72b4('0x61')])){for(var _0x355407=0x0;_0x355407<_0x4bf73f[_0x72b4('0x32')][_0x72b4('0x61')]['length'];_0x355407+=0x1){socket['emit'](_0x72b4('0x82'),{'UserId':Number(_0x4bf73f[_0x72b4('0x32')][_0x72b4('0x61')][_0x355407]),'SmsQueueId':Number(_0x4bf73f[_0x72b4('0x43')]['id'])});}}else{socket[_0x72b4('0x6d')](_0x72b4('0x82'),{'UserId':Number(_0x4bf73f[_0x72b4('0x32')][_0x72b4('0x61')]),'SmsQueueId':Number(_0x4bf73f[_0x72b4('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x95a40c,null))['catch'](handleError(_0x95a40c,null));};exports[_0x72b4('0x86')]=function(_0x17e3f6,_0x3672a8,_0x364cee){var _0x53d169={};var _0x47028a={};var _0x209cf1;var _0x270b9c;return db[_0x72b4('0x40')][_0x72b4('0x52')]({'where':{'id':_0x17e3f6[_0x72b4('0x43')]['id']}})[_0x72b4('0x25')](handleEntityNotFound(_0x3672a8,null))['then'](function(_0x229275){if(_0x229275){_0x209cf1=_0x229275;_0x47028a[_0x72b4('0x31')]=_[_0x72b4('0x33')](db['User']['rawAttributes']);_0x47028a['query']=_['keys'](_0x17e3f6[_0x72b4('0x32')]);_0x47028a[_0x72b4('0x34')]=_['intersection'](_0x47028a['model'],_0x47028a[_0x72b4('0x32')]);_0x53d169[_0x72b4('0x37')]=_[_0x72b4('0x35')](_0x47028a[_0x72b4('0x31')],qs[_0x72b4('0x36')](_0x17e3f6['query'][_0x72b4('0x36')]));_0x53d169['attributes']=_0x53d169[_0x72b4('0x37')][_0x72b4('0x44')]?_0x53d169[_0x72b4('0x37')]:_0x47028a['model'];_0x53d169[_0x72b4('0x39')]=qs['sort'](_0x17e3f6[_0x72b4('0x32')][_0x72b4('0x3a')]);_0x53d169['where']=qs['filters'](_[_0x72b4('0x3c')](_0x17e3f6[_0x72b4('0x32')],_0x47028a[_0x72b4('0x34')]));if(_0x17e3f6['query'][_0x72b4('0x3d')]){_0x53d169[_0x72b4('0x3b')]=_[_0x72b4('0x3e')](_0x53d169[_0x72b4('0x3b')],{'$or':_[_0x72b4('0x2d')](_0x53d169[_0x72b4('0x37')],function(_0x2026fc){var _0x3b258d={};_0x3b258d[_0x2026fc]={'$like':'%'+_0x17e3f6[_0x72b4('0x32')]['filter']+'%'};return _0x3b258d;})});}_0x53d169=_[_0x72b4('0x3e')]({},_0x53d169,_0x17e3f6[_0x72b4('0x60')]);return _0x209cf1['getAgents'](_0x53d169);}})[_0x72b4('0x25')](function(_0x50cae2){if(_0x50cae2){_0x270b9c=_0x50cae2[_0x72b4('0x44')];if(!_0x17e3f6['query']['hasOwnProperty'](_0x72b4('0x38'))){_0x53d169['limit']=qs[_0x72b4('0x1e')](_0x17e3f6['query'][_0x72b4('0x1e')]);_0x53d169['offset']=qs[_0x72b4('0x1b')](_0x17e3f6[_0x72b4('0x32')][_0x72b4('0x1b')]);}return _0x209cf1[_0x72b4('0x86')](_0x53d169);}})[_0x72b4('0x25')](function(_0x5f15ad){if(_0x5f15ad){return _0x5f15ad?{'count':_0x270b9c,'rows':_0x5f15ad}:null;}})[_0x72b4('0x25')](respondWithResult(_0x3672a8,null))['catch'](handleError(_0x3672a8,null));}; \ No newline at end of file +var _0x859e=['forEach','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','SmsQueues','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','SmsQueueId','filter','UserSmsQueue','findAll','User','findAndCountAll','UserId','agent','smsPause','createdAt','rows','format','%s/%s','updatedAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents'];(function(_0x212588,_0x2e76d8){var _0x365f74=function(_0x50d669){while(--_0x50d669){_0x212588['push'](_0x212588['shift']());}};_0x365f74(++_0x2e76d8);}(_0x859e,0x1ad));var _0xe859=function(_0x3c8e7f,_0x5ac5dd){_0x3c8e7f=_0x3c8e7f-0x0;var _0x363d67=_0x859e[_0x3c8e7f];return _0x363d67;};'use strict';var emlformat=require(_0xe859('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe859('0x1'));var jsonpatch=require(_0xe859('0x2'));var rp=require(_0xe859('0x3'));var moment=require(_0xe859('0x4'));var BPromise=require(_0xe859('0x5'));var Mustache=require('mustache');var util=require(_0xe859('0x6'));var path=require(_0xe859('0x7'));var sox=require('sox');var csv=require(_0xe859('0x8'));var ejs=require(_0xe859('0x9'));var fs=require('fs');var fs_extra=require(_0xe859('0xa'));var _=require('lodash');var squel=require(_0xe859('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe859('0x8'));var querystring=require(_0xe859('0xc'));var Papa=require(_0xe859('0xd'));var Redis=require('ioredis');var authService=require(_0xe859('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe859('0xf'));var hardwareService=require(_0xe859('0x10'));var logger=require(_0xe859('0x11'))(_0xe859('0x12'));var utils=require(_0xe859('0x13'));var config=require(_0xe859('0x14'));var licenseUtil=require(_0xe859('0x15'));var db=require('../../mysqldb')['db'];config[_0xe859('0x16')]=_['defaults'](config[_0xe859('0x16')],{'host':_0xe859('0x17'),'port':0x18eb});var socket=require(_0xe859('0x18'))(new Redis(config[_0xe859('0x16')]));require(_0xe859('0x19'))[_0xe859('0x1a')](socket);function respondWithStatusCode(_0x1e2eab,_0x331dd0){_0x331dd0=_0x331dd0||0xcc;return function(_0x31f38b){if(_0x31f38b){return _0x1e2eab[_0xe859('0x1b')](_0x331dd0);}return _0x1e2eab[_0xe859('0x1c')](_0x331dd0)['end']();};}function respondWithResult(_0x4e4572,_0x3ab933){_0x3ab933=_0x3ab933||0xc8;return function(_0x39ce78){if(_0x39ce78){return _0x4e4572['status'](_0x3ab933)[_0xe859('0x1d')](_0x39ce78);}};}function respondWithFilteredResult(_0xa77a53,_0x540c56){return function(_0x43bdde){if(_0x43bdde){var _0x79f433=typeof _0x540c56[_0xe859('0x1e')]===_0xe859('0x1f')&&typeof _0x540c56[_0xe859('0x20')]===_0xe859('0x1f');var _0x279c85=_0x43bdde[_0xe859('0x21')];var _0x386af0=_0x79f433?0x0:_0x540c56[_0xe859('0x1e')];var _0x5ba8e3=_0x79f433?_0x43bdde[_0xe859('0x21')]:_0x540c56['offset']+_0x540c56[_0xe859('0x20')];var _0x409e80;if(_0x5ba8e3>=_0x279c85){_0x5ba8e3=_0x279c85;_0x409e80=0xc8;}else{_0x409e80=0xce;}_0xa77a53['status'](_0x409e80);return _0xa77a53['set'](_0xe859('0x22'),_0x386af0+'-'+_0x5ba8e3+'/'+_0x279c85)[_0xe859('0x1d')](_0x43bdde);}return null;};}function patchUpdates(_0x33d8b4){return function(_0x303394){try{jsonpatch[_0xe859('0x23')](_0x303394,_0x33d8b4,!![]);}catch(_0x17c7c9){return BPromise[_0xe859('0x24')](_0x17c7c9);}return _0x303394[_0xe859('0x25')]();};}function saveUpdates(_0x3358ca,_0xbf9cfa){return function(_0x2daf18){if(_0x2daf18){return _0x2daf18[_0xe859('0x26')](_0x3358ca)['then'](function(_0x1df6a2){return _0x1df6a2;});}return null;};}function removeEntity(_0x49af49,_0x233baa){return function(_0x2f3bae){if(_0x2f3bae){return _0x2f3bae[_0xe859('0x27')]()[_0xe859('0x28')](function(){var _0x14b719=_0x2f3bae[_0xe859('0x29')]({'plain':!![]});var _0x42f410=_0xe859('0x2a');return db['UserProfileResource'][_0xe859('0x27')]({'where':{'type':_0x42f410,'resourceId':_0x14b719['id']}})[_0xe859('0x28')](function(){return _0x2f3bae;});})[_0xe859('0x28')](function(){_0x49af49[_0xe859('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x788e50,_0x292338){return function(_0x33241d){if(!_0x33241d){_0x788e50[_0xe859('0x1b')](0x194);}return _0x33241d;};}function handleError(_0x190989,_0x3fb9f2){_0x3fb9f2=_0x3fb9f2||0x1f4;return function(_0xe3654b){logger[_0xe859('0x2b')](_0xe3654b[_0xe859('0x2c')]);if(_0xe3654b[_0xe859('0x2d')]){delete _0xe3654b[_0xe859('0x2d')];}_0x190989[_0xe859('0x1c')](_0x3fb9f2)[_0xe859('0x2e')](_0xe3654b);};}exports[_0xe859('0x2f')]=function(_0x5de441,_0x3ca237){var _0x5c1592={},_0x4e6341={},_0x279b58={'count':0x0,'rows':[]};var _0x3bddd0=_[_0xe859('0x30')](db[_0xe859('0x31')][_0xe859('0x32')],function(_0x341e6e){return{'name':_0x341e6e[_0xe859('0x33')],'type':_0x341e6e[_0xe859('0x34')][_0xe859('0x35')]};});_0x4e6341[_0xe859('0x36')]=_[_0xe859('0x30')](_0x3bddd0,_0xe859('0x2d'));_0x4e6341[_0xe859('0x37')]=_[_0xe859('0x38')](_0x5de441[_0xe859('0x37')]);_0x4e6341[_0xe859('0x39')]=_['intersection'](_0x4e6341[_0xe859('0x36')],_0x4e6341[_0xe859('0x37')]);_0x5c1592[_0xe859('0x3a')]=_['intersection'](_0x4e6341['model'],qs[_0xe859('0x3b')](_0x5de441[_0xe859('0x37')][_0xe859('0x3b')]));_0x5c1592[_0xe859('0x3a')]=_0x5c1592[_0xe859('0x3a')][_0xe859('0x3c')]?_0x5c1592[_0xe859('0x3a')]:_0x4e6341[_0xe859('0x36')];if(!_0x5de441['query'][_0xe859('0x3d')](_0xe859('0x3e'))){_0x5c1592['limit']=qs[_0xe859('0x20')](_0x5de441[_0xe859('0x37')][_0xe859('0x20')]);_0x5c1592['offset']=qs[_0xe859('0x1e')](_0x5de441[_0xe859('0x37')][_0xe859('0x1e')]);}_0x5c1592[_0xe859('0x3f')]=qs[_0xe859('0x40')](_0x5de441['query'][_0xe859('0x40')]);_0x5c1592[_0xe859('0x41')]=qs[_0xe859('0x39')](_[_0xe859('0x42')](_0x5de441[_0xe859('0x37')],_0x4e6341['filters']),_0x3bddd0);if(_0x5de441['query']['filter']){_0x5c1592[_0xe859('0x41')]=_['merge'](_0x5c1592['where'],{'$or':_[_0xe859('0x30')](_0x3bddd0,function(_0x724b8f){if(_0x724b8f[_0xe859('0x34')]!==_0xe859('0x43')){var _0x19f7ce={};_0x19f7ce[_0x724b8f[_0xe859('0x2d')]]={'$like':'%'+_0x5de441[_0xe859('0x37')]['filter']+'%'};return _0x19f7ce;}})});}_0x5c1592=_[_0xe859('0x44')]({},_0x5c1592,_0x5de441[_0xe859('0x45')]);var _0x3cadc6={'where':_0x5c1592[_0xe859('0x41')]};return db['SmsQueue'][_0xe859('0x21')](_0x3cadc6)[_0xe859('0x28')](function(_0x2747ee){_0x279b58[_0xe859('0x21')]=_0x2747ee;if(_0x5de441[_0xe859('0x37')][_0xe859('0x46')]){_0x5c1592[_0xe859('0x47')]=[{'all':!![]}];}return db[_0xe859('0x31')]['findAll'](_0x5c1592);})[_0xe859('0x28')](function(_0x44748e){_0x279b58['rows']=_0x44748e;return _0x279b58;})[_0xe859('0x28')](respondWithFilteredResult(_0x3ca237,_0x5c1592))[_0xe859('0x48')](handleError(_0x3ca237,null));};exports[_0xe859('0x49')]=function(_0x10b11e,_0x3feb9f){var _0x2a761a={'raw':!![],'where':{'id':_0x10b11e[_0xe859('0x4a')]['id']}},_0x304353={};_0x304353[_0xe859('0x36')]=_[_0xe859('0x38')](db[_0xe859('0x31')]['rawAttributes']);_0x304353['query']=_['keys'](_0x10b11e[_0xe859('0x37')]);_0x304353[_0xe859('0x39')]=_[_0xe859('0x4b')](_0x304353['model'],_0x304353[_0xe859('0x37')]);_0x2a761a[_0xe859('0x3a')]=_['intersection'](_0x304353[_0xe859('0x36')],qs[_0xe859('0x3b')](_0x10b11e['query']['fields']));_0x2a761a[_0xe859('0x3a')]=_0x2a761a[_0xe859('0x3a')]['length']?_0x2a761a[_0xe859('0x3a')]:_0x304353[_0xe859('0x36')];if(_0x10b11e[_0xe859('0x37')][_0xe859('0x46')]){_0x2a761a[_0xe859('0x47')]=[{'all':!![]}];}_0x2a761a=_[_0xe859('0x44')]({},_0x2a761a,_0x10b11e['options']);return db[_0xe859('0x31')][_0xe859('0x4c')](_0x2a761a)[_0xe859('0x28')](handleEntityNotFound(_0x3feb9f,null))[_0xe859('0x28')](respondWithResult(_0x3feb9f,null))[_0xe859('0x48')](handleError(_0x3feb9f,null));};exports['create']=function(_0x4cd9e5,_0x59cae8){return db[_0xe859('0x31')][_0xe859('0x4d')](_0x4cd9e5[_0xe859('0x4e')],{})['then'](function(_0x5865b8){var _0x53eea6=_0x4cd9e5[_0xe859('0x4f')][_0xe859('0x29')]({'plain':!![]});if(!_0x53eea6)throw new Error(_0xe859('0x50'));if(_0x53eea6[_0xe859('0x51')]==='user'){var _0x59ddf4=_0x5865b8[_0xe859('0x29')]({'plain':!![]});var _0x6e0ba1=_0xe859('0x2a');return db['UserProfileSection'][_0xe859('0x4c')]({'where':{'name':_0x6e0ba1,'userProfileId':_0x53eea6['userProfileId']},'raw':!![]})[_0xe859('0x28')](function(_0x273b7d){if(_0x273b7d&&_0x273b7d['autoAssociation']===0x0){return db[_0xe859('0x52')][_0xe859('0x4d')]({'name':_0x59ddf4[_0xe859('0x2d')],'resourceId':_0x59ddf4['id'],'type':_0x273b7d['name'],'sectionId':_0x273b7d['id']},{})[_0xe859('0x28')](function(){return _0x5865b8;});}else{return _0x5865b8;}})[_0xe859('0x48')](function(_0x46ea41){logger[_0xe859('0x2b')](_0xe859('0x53'),_0x46ea41);throw _0x46ea41;});}return _0x5865b8;})[_0xe859('0x28')](respondWithResult(_0x59cae8,0xc9))[_0xe859('0x48')](handleError(_0x59cae8,null));};exports['update']=function(_0x43dd9d,_0x3e989e){if(_0x43dd9d[_0xe859('0x4e')]['id']){delete _0x43dd9d[_0xe859('0x4e')]['id'];}return db[_0xe859('0x31')]['find']({'where':{'id':_0x43dd9d[_0xe859('0x4a')]['id']}})[_0xe859('0x28')](handleEntityNotFound(_0x3e989e,null))[_0xe859('0x28')](saveUpdates(_0x43dd9d[_0xe859('0x4e')],null))[_0xe859('0x28')](respondWithResult(_0x3e989e,null))[_0xe859('0x48')](handleError(_0x3e989e,null));};exports['destroy']=function(_0x12ac60,_0x33dee0){return db[_0xe859('0x31')][_0xe859('0x4c')]({'where':{'id':_0x12ac60[_0xe859('0x4a')]['id']}})[_0xe859('0x28')](handleEntityNotFound(_0x33dee0,null))[_0xe859('0x28')](removeEntity(_0x33dee0,null))[_0xe859('0x48')](handleError(_0x33dee0,null));};exports[_0xe859('0x54')]=function(_0x4a7029,_0x18b6a8){return db[_0xe859('0x31')][_0xe859('0x54')]()[_0xe859('0x28')](respondWithResult(_0x18b6a8,null))[_0xe859('0x48')](handleError(_0x18b6a8,null));};exports['getMembers']=function(_0x17aacd,_0x5c71e3,_0x122782){var _0x3fecca={'raw':!![],'where':{}},_0x1769f3={},_0x2c49ac;return db[_0xe859('0x31')][_0xe859('0x55')]({'where':{'id':_0x17aacd['params']['id']}})[_0xe859('0x28')](handleEntityNotFound(_0x5c71e3,null))[_0xe859('0x28')](function(_0x4db45c){if(_0x4db45c){_0x2c49ac=_0x4db45c[_0xe859('0x29')]({'plain':!![]});_0x1769f3[_0xe859('0x36')]=_['keys'](db['UserSmsQueue'][_0xe859('0x32')]);_0x1769f3[_0xe859('0x37')]=_[_0xe859('0x38')](_0x17aacd[_0xe859('0x37')]);_0x1769f3[_0xe859('0x39')]=_[_0xe859('0x4b')](_0x1769f3[_0xe859('0x36')],_0x1769f3[_0xe859('0x37')]);_0x3fecca[_0xe859('0x3a')]=_['intersection'](_0x1769f3['model'],qs['fields'](_0x17aacd['query']['fields']));_0x3fecca['attributes']=_0x3fecca[_0xe859('0x3a')]['length']?_0x3fecca[_0xe859('0x3a')]:_0x1769f3[_0xe859('0x36')];if(!_0x17aacd[_0xe859('0x37')][_0xe859('0x3d')](_0xe859('0x3e'))){_0x3fecca[_0xe859('0x20')]=qs[_0xe859('0x20')](_0x17aacd[_0xe859('0x37')][_0xe859('0x20')]);_0x3fecca[_0xe859('0x1e')]=qs[_0xe859('0x1e')](_0x17aacd[_0xe859('0x37')]['offset']);}_0x3fecca[_0xe859('0x3f')]=qs[_0xe859('0x40')](_0x17aacd[_0xe859('0x37')][_0xe859('0x40')]);_0x3fecca[_0xe859('0x41')]=qs[_0xe859('0x39')](_['pick'](_0x17aacd[_0xe859('0x37')],_0x1769f3[_0xe859('0x39')]));_0x3fecca[_0xe859('0x41')][_0xe859('0x56')]=_0x4db45c['id'];if(_0x17aacd[_0xe859('0x37')][_0xe859('0x57')]){_0x3fecca['where']=_[_0xe859('0x44')](_0x3fecca['where'],{'$or':_[_0xe859('0x30')](_0x3fecca[_0xe859('0x3a')],function(_0x4061d2){var _0x348a26={};_0x348a26[_0x4061d2]={'$like':'%'+_0x17aacd['query'][_0xe859('0x57')]+'%'};return _0x348a26;})});}_0x3fecca=_[_0xe859('0x44')]({},_0x3fecca,_0x17aacd[_0xe859('0x45')]);return db[_0xe859('0x58')][_0xe859('0x59')](_0x3fecca);}})[_0xe859('0x28')](function(_0x310208){if(_0x310208){return db[_0xe859('0x5a')][_0xe859('0x5b')]({'where':{'id':_[_0xe859('0x30')](_0x310208,_0xe859('0x5c')),'role':_0xe859('0x5d')},'attributes':['id',_0xe859('0x2d'),_0xe859('0x5e'),'updatedAt',_0xe859('0x5f')]});}})[_0xe859('0x28')](function(_0x4ef001){if(_0x4ef001){return{'count':_0x4ef001['count'],'rows':_['map'](_0x4ef001[_0xe859('0x60')],function(_0x3aa049){return{'membername':_0x3aa049['name'],'UserId':_0x3aa049['id'],'queue_name':_0x2c49ac['name'],'SmsQueueId':_0x2c49ac['id'],'interface':util[_0xe859('0x61')](_0xe859('0x62'),'SIP',_0x3aa049['name']),'penalty':0x0,'paused':_0x3aa049[_0xe859('0x5e')],'createdAt':_0x3aa049[_0xe859('0x5f')],'updatedAt':_0x3aa049[_0xe859('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe859('0x28')](respondWithFilteredResult(_0x5c71e3,_0x3fecca))['catch'](handleError(_0x5c71e3,null));};exports[_0xe859('0x64')]=function(_0x18d02c,_0x283c9c,_0x266acb){var _0x3edb20={};var _0x48f8ba={};var _0x3582b7;var _0x453eba;return db[_0xe859('0x31')][_0xe859('0x55')]({'where':{'id':_0x18d02c['params']['id']}})[_0xe859('0x28')](handleEntityNotFound(_0x283c9c,null))[_0xe859('0x28')](function(_0x167409){if(_0x167409){_0x3582b7=_0x167409;_0x48f8ba[_0xe859('0x36')]=_['keys'](db[_0xe859('0x65')]['rawAttributes']);_0x48f8ba[_0xe859('0x37')]=_[_0xe859('0x38')](_0x18d02c[_0xe859('0x37')]);_0x48f8ba[_0xe859('0x39')]=_[_0xe859('0x4b')](_0x48f8ba['model'],_0x48f8ba[_0xe859('0x37')]);_0x3edb20[_0xe859('0x3a')]=_['intersection'](_0x48f8ba[_0xe859('0x36')],qs[_0xe859('0x3b')](_0x18d02c[_0xe859('0x37')]['fields']));_0x3edb20[_0xe859('0x3a')]=_0x3edb20[_0xe859('0x3a')][_0xe859('0x3c')]?_0x3edb20[_0xe859('0x3a')]:_0x48f8ba['model'];_0x3edb20[_0xe859('0x3f')]=qs['sort'](_0x18d02c[_0xe859('0x37')][_0xe859('0x40')]);_0x3edb20[_0xe859('0x41')]=qs[_0xe859('0x39')](_[_0xe859('0x42')](_0x18d02c[_0xe859('0x37')],_0x48f8ba[_0xe859('0x39')]));if(_0x18d02c[_0xe859('0x37')][_0xe859('0x57')]){_0x3edb20['where']=_[_0xe859('0x44')](_0x3edb20[_0xe859('0x41')],{'$or':_[_0xe859('0x30')](_0x3edb20[_0xe859('0x3a')],function(_0x21c9cd){var _0x4be178={};_0x4be178[_0x21c9cd]={'$like':'%'+_0x18d02c[_0xe859('0x37')][_0xe859('0x57')]+'%'};return _0x4be178;})});}_0x3edb20=_[_0xe859('0x44')]({},_0x3edb20,_0x18d02c[_0xe859('0x45')]);return _0x3582b7['getTeams'](_0x3edb20);}})[_0xe859('0x28')](function(_0x448d4c){if(_0x448d4c){_0x453eba=_0x448d4c[_0xe859('0x3c')];if(!_0x18d02c[_0xe859('0x37')]['hasOwnProperty'](_0xe859('0x3e'))){_0x3edb20[_0xe859('0x20')]=qs[_0xe859('0x20')](_0x18d02c[_0xe859('0x37')]['limit']);_0x3edb20[_0xe859('0x1e')]=qs[_0xe859('0x1e')](_0x18d02c[_0xe859('0x37')][_0xe859('0x1e')]);}return _0x3582b7['getTeams'](_0x3edb20);}})['then'](function(_0x4877f4){if(_0x4877f4){return _0x4877f4?{'count':_0x453eba,'rows':_0x4877f4}:null;}})[_0xe859('0x28')](respondWithResult(_0x283c9c,null))[_0xe859('0x48')](handleError(_0x283c9c,null));};exports['addTeams']=function(_0x33bc33,_0x15b76d,_0x3331b0){var _0x5e8139=_0x33bc33[_0xe859('0x4e')][_0xe859('0x66')];return db['Team'][_0xe859('0x59')]({'where':{'id':_0x5e8139},'attributes':['id'],'include':[{'model':db[_0xe859('0x5a')],'as':_0xe859('0x67'),'attributes':['id','name',_0xe859('0x68'),_0xe859('0x69'),_0xe859('0x6a')],'raw':!![]}]})[_0xe859('0x28')](function(_0x4157b1){if(_0x4157b1){var _0x18b4f3=_[_0xe859('0x6b')](_0x4157b1,function(_0xf7e7ec){var _0x3cba47=_0xf7e7ec[_0xe859('0x29')]({'plain':!![]});return _0x3cba47['Agents'];});return db[_0xe859('0x31')][_0xe859('0x4c')]({'where':{'id':_0x33bc33[_0xe859('0x4a')]['id']}})[_0xe859('0x28')](function(_0x5767eb){return db[_0xe859('0x6c')]['transaction'](function(_0x1c49d6){return _0x5767eb[_0xe859('0x6d')](_0x5e8139,{'transaction':_0x1c49d6})[_0xe859('0x28')](function(){return BPromise['each'](_0x18b4f3,function(_0x5ba7b0){return db[_0xe859('0x58')][_0xe859('0x6e')]({'where':{'UserId':_0x5ba7b0['id'],'SmsQueueId':_0x33bc33[_0xe859('0x4a')]['id']},'transaction':_0x1c49d6});});})['then'](function(){_0x18b4f3['forEach'](function(_0x367e29){socket[_0xe859('0x6f')](_0xe859('0x70'),{'UserId':_0x367e29['id'],'SmsQueueId':_0x5767eb['id']});});});});});}})[_0xe859('0x28')](respondWithStatusCode(_0x15b76d,null))[_0xe859('0x48')](handleError(_0x15b76d,null));};exports['removeTeams']=function(_0x78f10a,_0x2e00cc,_0x5e0267){return db[_0xe859('0x65')][_0xe859('0x59')]({'where':{'id':_0x78f10a[_0xe859('0x37')][_0xe859('0x66')]},'attributes':['id'],'include':[{'model':db[_0xe859('0x5a')],'as':_0xe859('0x67'),'attributes':['id'],'raw':!![]}]})[_0xe859('0x28')](handleEntityNotFound(_0x2e00cc,null))[_0xe859('0x28')](function(_0x341ea9){var _0x23294f=_[_0xe859('0x30')](_0x341ea9,'id');var _0x3ab861=[];var _0x915c88=[];var _0x57bfd6=squel[_0xe859('0x71')]();_0x57bfd6[_0xe859('0x72')](_0xe859('0x73'))[_0xe859('0x74')](_0xe859('0x75'),'tq')['join'](_0xe859('0x76'),'ut',_0xe859('0x77'))[_0xe859('0x41')](_0xe859('0x78'),_0x78f10a[_0xe859('0x4a')]['id']);for(var _0x396c19=0x0;_0x396c19<_0x341ea9[_0xe859('0x3c')];_0x396c19+=0x1){let _0x4e71f4=_0x341ea9[_0x396c19];for(var _0x359272=0x0;_0x359272<_0x4e71f4[_0xe859('0x67')][_0xe859('0x3c')];_0x359272+=0x1){let _0x383745=_0x4e71f4[_0xe859('0x67')][_0x359272];var _0x1d65d1=_0x57bfd6[_0xe859('0x79')]();_0x1d65d1['where']('ut.UserId\x20=\x20?',_0x383745['id']);_0x915c88[_0xe859('0x7a')](db[_0xe859('0x6c')][_0xe859('0x37')](_0x1d65d1[_0xe859('0x7b')](),{'type':db[_0xe859('0x6c')][_0xe859('0x7c')][_0xe859('0x7d')]})[_0xe859('0x28')](function(_0x2cf205){if(_0x2cf205[_0xe859('0x3c')]===0x1){return _0x383745['id'];}else{var _0x2aaee2=_['every'](_[_0xe859('0x30')](_0x2cf205,_0xe859('0x7e')),function(_0x5b1ec9){return _['includes'](_0x23294f,_0x5b1ec9);});if(_0x2aaee2){return _0x383745['id'];}}}));}}return BPromise[_0xe859('0x7f')](_0x915c88)[_0xe859('0x28')](function(_0xdb941a){_0x3ab861=_(_0x3ab861)[_0xe859('0x80')](_0xdb941a)[_0xe859('0x81')]()[_0xe859('0x82')]();return db['SmsQueue'][_0xe859('0x4c')]({'where':{'id':_0x78f10a['params']['id']}})['then'](function(_0x27d536){return db[_0xe859('0x6c')][_0xe859('0x83')](function(_0x3480df){return _0x27d536[_0xe859('0x84')](_0x78f10a[_0xe859('0x37')][_0xe859('0x66')],{'transaction':_0x3480df})['then'](function(){if(!_[_0xe859('0x85')](_0x3ab861)){return _0x27d536[_0xe859('0x86')](_0x3ab861,{'transaction':_0x3480df});}})[_0xe859('0x28')](function(){_0x3ab861[_0xe859('0x87')](function(_0x1098a2){socket[_0xe859('0x6f')](_0xe859('0x88'),{'UserId':_0x1098a2,'SmsQueueId':_0x27d536['id']});});});});});});})[_0xe859('0x28')](respondWithStatusCode(_0x2e00cc,null))[_0xe859('0x48')](handleError(_0x2e00cc,null));};exports['addAgents']=function(_0x48b772,_0x3c2e81,_0x504612){return db['SmsQueue'][_0xe859('0x4c')]({'where':{'id':_0x48b772[_0xe859('0x4a')]['id']}})[_0xe859('0x28')](handleEntityNotFound(_0x3c2e81,null))[_0xe859('0x28')](function(_0x178154){if(_0x178154){return _0x178154[_0xe859('0x89')](_0x48b772[_0xe859('0x4e')][_0xe859('0x66')],_[_0xe859('0x8a')](_0x48b772[_0xe859('0x4e')],[_0xe859('0x66'),'id'])||{})['spread'](function(_0x3210a4){for(var _0x3a14aa=0x0;_0x3a14aa<_0x48b772[_0xe859('0x4e')][_0xe859('0x66')][_0xe859('0x3c')];_0x3a14aa+=0x1){socket[_0xe859('0x6f')](_0xe859('0x70'),{'UserId':Number(_0x48b772[_0xe859('0x4e')]['ids'][_0x3a14aa]),'SmsQueueId':Number(_0x48b772['params']['id'])});}return _0x3210a4;});}})[_0xe859('0x28')](respondWithResult(_0x3c2e81,null))['catch'](handleError(_0x3c2e81,null));};exports[_0xe859('0x86')]=function(_0x111523,_0x5774e0,_0x1add17){return db[_0xe859('0x31')][_0xe859('0x4c')]({'where':{'id':_0x111523['params']['id']}})[_0xe859('0x28')](handleEntityNotFound(_0x5774e0,null))[_0xe859('0x28')](function(_0x561dce){if(_0x561dce){return _0x561dce[_0xe859('0x86')](_0x111523[_0xe859('0x37')][_0xe859('0x66')])[_0xe859('0x28')](function(){if(_[_0xe859('0x8b')](_0x111523[_0xe859('0x37')][_0xe859('0x66')])){for(var _0x4a1fae=0x0;_0x4a1fae<_0x111523[_0xe859('0x37')]['ids'][_0xe859('0x3c')];_0x4a1fae+=0x1){socket[_0xe859('0x6f')](_0xe859('0x88'),{'UserId':Number(_0x111523[_0xe859('0x37')]['ids'][_0x4a1fae]),'SmsQueueId':Number(_0x111523[_0xe859('0x4a')]['id'])});}}else{socket[_0xe859('0x6f')](_0xe859('0x88'),{'UserId':Number(_0x111523[_0xe859('0x37')][_0xe859('0x66')]),'SmsQueueId':Number(_0x111523[_0xe859('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5774e0,null))['catch'](handleError(_0x5774e0,null));};exports['getAgents']=function(_0x555db0,_0x285b98,_0x41eb6e){var _0x1aa4bf={};var _0x30dc82={};var _0x288046;var _0x42a876;return db[_0xe859('0x31')]['findOne']({'where':{'id':_0x555db0[_0xe859('0x4a')]['id']}})['then'](handleEntityNotFound(_0x285b98,null))['then'](function(_0x4a0cf8){if(_0x4a0cf8){_0x288046=_0x4a0cf8;_0x30dc82[_0xe859('0x36')]=_[_0xe859('0x38')](db[_0xe859('0x5a')][_0xe859('0x32')]);_0x30dc82[_0xe859('0x37')]=_[_0xe859('0x38')](_0x555db0[_0xe859('0x37')]);_0x30dc82[_0xe859('0x39')]=_[_0xe859('0x4b')](_0x30dc82[_0xe859('0x36')],_0x30dc82[_0xe859('0x37')]);_0x1aa4bf['attributes']=_[_0xe859('0x4b')](_0x30dc82[_0xe859('0x36')],qs['fields'](_0x555db0[_0xe859('0x37')]['fields']));_0x1aa4bf[_0xe859('0x3a')]=_0x1aa4bf[_0xe859('0x3a')]['length']?_0x1aa4bf[_0xe859('0x3a')]:_0x30dc82[_0xe859('0x36')];_0x1aa4bf[_0xe859('0x3f')]=qs[_0xe859('0x40')](_0x555db0[_0xe859('0x37')][_0xe859('0x40')]);_0x1aa4bf[_0xe859('0x41')]=qs['filters'](_[_0xe859('0x42')](_0x555db0[_0xe859('0x37')],_0x30dc82[_0xe859('0x39')]));if(_0x555db0[_0xe859('0x37')][_0xe859('0x57')]){_0x1aa4bf[_0xe859('0x41')]=_[_0xe859('0x44')](_0x1aa4bf['where'],{'$or':_[_0xe859('0x30')](_0x1aa4bf[_0xe859('0x3a')],function(_0x4e8e86){var _0x1b68c5={};_0x1b68c5[_0x4e8e86]={'$like':'%'+_0x555db0['query'][_0xe859('0x57')]+'%'};return _0x1b68c5;})});}_0x1aa4bf=_[_0xe859('0x44')]({},_0x1aa4bf,_0x555db0[_0xe859('0x45')]);return _0x288046[_0xe859('0x8c')](_0x1aa4bf);}})[_0xe859('0x28')](function(_0x90f22){if(_0x90f22){_0x42a876=_0x90f22[_0xe859('0x3c')];if(!_0x555db0[_0xe859('0x37')]['hasOwnProperty'](_0xe859('0x3e'))){_0x1aa4bf['limit']=qs['limit'](_0x555db0[_0xe859('0x37')][_0xe859('0x20')]);_0x1aa4bf['offset']=qs[_0xe859('0x1e')](_0x555db0['query'][_0xe859('0x1e')]);}return _0x288046[_0xe859('0x8c')](_0x1aa4bf);}})[_0xe859('0x28')](function(_0x3abdc2){if(_0x3abdc2){return _0x3abdc2?{'count':_0x42a876,'rows':_0x3abdc2}:null;}})[_0xe859('0x28')](respondWithResult(_0x285b98,null))[_0xe859('0x48')](handleError(_0x285b98,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 891ee8b..8a848b3 100644 --- a/server/api/smsQueue/smsQueue.events.js +++ b/server/api/smsQueue/smsQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x894a=['hook','events','SmsQueue','save','remove','emit','hasOwnProperty'];(function(_0x3ee83c,_0x1f122a){var _0x5f2c3a=function(_0xf7cb13){while(--_0xf7cb13){_0x3ee83c['push'](_0x3ee83c['shift']());}};_0x5f2c3a(++_0x1f122a);}(_0x894a,0x14a));var _0xa894=function(_0x7d7cba,_0x3784bc){_0x7d7cba=_0x7d7cba-0x0;var _0x1f4baa=_0x894a[_0x7d7cba];return _0x1f4baa;};'use strict';var EventEmitter=require(_0xa894('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xa894('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa894('0x2'),'afterUpdate':'update','afterDestroy':_0xa894('0x3')};function emitEvent(_0x4204df){return function(_0x1ff378,_0x151118,_0x327e65){SmsQueueEvents['emit'](_0x4204df+':'+_0x1ff378['id'],_0x1ff378);SmsQueueEvents[_0xa894('0x4')](_0x4204df,_0x1ff378);_0x327e65(null);};}for(var e in events){if(events[_0xa894('0x5')](e)){var event=events[e];SmsQueue[_0xa894('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xd70b=['hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','remove','emit'];(function(_0x31c855,_0x6e6f69){var _0x268fa3=function(_0x2cbcbf){while(--_0x2cbcbf){_0x31c855['push'](_0x31c855['shift']());}};_0x268fa3(++_0x6e6f69);}(_0xd70b,0x142));var _0xbd70=function(_0x304730,_0x483b78){_0x304730=_0x304730-0x0;var _0xe27bbf=_0xd70b[_0x304730];return _0xe27bbf;};'use strict';var EventEmitter=require(_0xbd70('0x0'));var SmsQueue=require(_0xbd70('0x1'))['db'][_0xbd70('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xbd70('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbd70('0x4')};function emitEvent(_0x5f140b){return function(_0x10df1d,_0xda0f68,_0x464441){SmsQueueEvents[_0xbd70('0x5')](_0x5f140b+':'+_0x10df1d['id'],_0x10df1d);SmsQueueEvents[_0xbd70('0x5')](_0x5f140b,_0x10df1d);_0x464441(null);};}for(var e in events){if(events[_0xbd70('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xbd70('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 730ae06..559e6ae 100644 --- a/server/api/smsQueue/smsQueue.model.js +++ b/server/api/smsQueue/smsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6ca=['./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb6ca,0x16c));var _0xab6c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb6ca[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xab6c('0x0'));var util=require('util');var logger=require(_0xab6c('0x1'))(_0xab6c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab6c('0x3'));var rimraf=require(_0xab6c('0x4'));var config=require(_0xab6c('0x5'));var attributes=require(_0xab6c('0x6'));module['exports']=function(_0x4cf8a4,_0x191f67){return _0x4cf8a4[_0xab6c('0x7')](_0xab6c('0x8'),attributes,{'tableName':_0xab6c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaef5=['./smsQueue.attributes','exports','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x287fa4,_0x120a7f){var _0xb58dc0=function(_0x5110b1){while(--_0x5110b1){_0x287fa4['push'](_0x287fa4['shift']());}};_0xb58dc0(++_0x120a7f);}(_0xaef5,0xe2));var _0x5aef=function(_0x189886,_0x3086b3){_0x189886=_0x189886-0x0;var _0x3aad36=_0xaef5[_0x189886];return _0x3aad36;};'use strict';var _=require(_0x5aef('0x0'));var util=require(_0x5aef('0x1'));var logger=require(_0x5aef('0x2'))(_0x5aef('0x3'));var moment=require(_0x5aef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5aef('0x5'));var config=require('../../config/environment');var attributes=require(_0x5aef('0x6'));module[_0x5aef('0x7')]=function(_0x478c31,_0x216bf4){return _0x478c31['define']('SmsQueue',attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 45f69ab..2e05288 100644 --- a/server/api/smsQueue/smsQueue.rpc.js +++ b/server/api/smsQueue/smsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fd0=['info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsQueue','findAll','options','attributes','limit','map','include','model','GetSmsQueue','debug','where','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then'];(function(_0x5a0a30,_0x5c3679){var _0x43e759=function(_0xc02f0f){while(--_0xc02f0f){_0x5a0a30['push'](_0x5a0a30['shift']());}};_0x43e759(++_0x5c3679);}(_0x4fd0,0x120));var _0x04fd=function(_0x1eda88,_0x555454){_0x1eda88=_0x1eda88-0x0;var _0x2eb594=_0x4fd0[_0x1eda88];return _0x2eb594;};'use strict';var _=require(_0x04fd('0x0'));var util=require(_0x04fd('0x1'));var moment=require(_0x04fd('0x2'));var BPromise=require(_0x04fd('0x3'));var rs=require(_0x04fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04fd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x04fd('0x6'));var client=jayson[_0x04fd('0x7')][_0x04fd('0x8')]({'port':0x232a});config['redis']=_[_0x04fd('0x9')](config['redis'],{'host':_0x04fd('0xa'),'port':0x18eb});var socket=require(_0x04fd('0xb'))(new Redis(config[_0x04fd('0xc')]));require('./smsQueue.socket')[_0x04fd('0xd')](socket);function respondWithRpcPromise(_0x1e81e0,_0x45e1bd,_0x3771ec){return new BPromise(function(_0x2b3562,_0x524d33){return client[_0x04fd('0xe')](_0x1e81e0,_0x3771ec)[_0x04fd('0xf')](function(_0x3ae4a1){logger[_0x04fd('0x10')](_0x04fd('0x11'),_0x45e1bd,'request\x20sent');logger['debug'](_0x04fd('0x12'),_0x45e1bd,_0x04fd('0x13'),JSON[_0x04fd('0x14')](_0x3ae4a1));if(_0x3ae4a1[_0x04fd('0x15')]){if(_0x3ae4a1[_0x04fd('0x15')][_0x04fd('0x16')]===0x1f4){logger[_0x04fd('0x15')](_0x04fd('0x11'),_0x45e1bd,_0x3ae4a1['error'][_0x04fd('0x17')]);return _0x524d33(_0x3ae4a1[_0x04fd('0x15')][_0x04fd('0x17')]);}logger['error'](_0x04fd('0x11'),_0x45e1bd,_0x3ae4a1[_0x04fd('0x15')]['message']);return _0x2b3562(_0x3ae4a1['error']['message']);}else{logger['info'](_0x04fd('0x11'),_0x45e1bd,_0x04fd('0x13'));_0x2b3562(_0x3ae4a1[_0x04fd('0x18')][_0x04fd('0x17')]);}})[_0x04fd('0x19')](function(_0x12b6b1){logger['error'](_0x04fd('0x11'),_0x45e1bd,_0x12b6b1);_0x524d33(_0x12b6b1);});});}exports['GetSmsQueue']=function(_0x968e64){var _0x1b7dd1=this;return new Promise(function(_0x1b6cf2,_0x1bdbba){return db[_0x04fd('0x1a')][_0x04fd('0x1b')]({'raw':_0x968e64['options']?_0x968e64['options']['raw']===undefined?!![]:![]:!![],'where':_0x968e64[_0x04fd('0x1c')]?_0x968e64[_0x04fd('0x1c')]['where']||null:null,'attributes':_0x968e64[_0x04fd('0x1c')]?_0x968e64[_0x04fd('0x1c')][_0x04fd('0x1d')]||null:null,'limit':_0x968e64['options']?_0x968e64[_0x04fd('0x1c')][_0x04fd('0x1e')]||null:null,'include':_0x968e64[_0x04fd('0x1c')]?_0x968e64[_0x04fd('0x1c')]['include']?_[_0x04fd('0x1f')](_0x968e64[_0x04fd('0x1c')][_0x04fd('0x20')],function(_0x235910){return{'model':db[_0x235910[_0x04fd('0x21')]],'as':_0x235910['as'],'attributes':_0x235910[_0x04fd('0x1d')],'include':_0x235910[_0x04fd('0x20')]?_[_0x04fd('0x1f')](_0x235910[_0x04fd('0x20')],function(_0x41c47b){return{'model':db[_0x41c47b[_0x04fd('0x21')]],'as':_0x41c47b['as'],'attributes':_0x41c47b['attributes'],'include':_0x41c47b[_0x04fd('0x20')]?_[_0x04fd('0x1f')](_0x41c47b[_0x04fd('0x20')],function(_0x4dd66d){return{'model':db[_0x4dd66d['model']],'as':_0x4dd66d['as'],'attributes':_0x4dd66d[_0x04fd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x04fd('0xf')](function(_0x2b5a8c){logger[_0x04fd('0x10')](_0x04fd('0x22'),_0x968e64);logger[_0x04fd('0x23')](_0x04fd('0x22'),_0x968e64,JSON[_0x04fd('0x14')](_0x2b5a8c));_0x1b6cf2(_0x2b5a8c);})[_0x04fd('0x19')](function(_0x27b9b2){logger['error']('GetSmsQueue',_0x27b9b2['message'],_0x968e64);_0x1bdbba(_0x1b7dd1[_0x04fd('0x15')](0x1f4,_0x27b9b2[_0x04fd('0x17')]));});});};exports['ShowSmsQueue']=function(_0x3d29c0){var _0x1fe60e=this;return new Promise(function(_0x53faf7,_0x327a9c){return db[_0x04fd('0x1a')]['find']({'raw':_0x3d29c0[_0x04fd('0x1c')]?_0x3d29c0[_0x04fd('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3d29c0[_0x04fd('0x1c')]?_0x3d29c0['options'][_0x04fd('0x24')]||null:null,'attributes':_0x3d29c0[_0x04fd('0x1c')]?_0x3d29c0[_0x04fd('0x1c')][_0x04fd('0x1d')]||null:null,'include':_0x3d29c0[_0x04fd('0x1c')]?_0x3d29c0[_0x04fd('0x1c')][_0x04fd('0x20')]?_[_0x04fd('0x1f')](_0x3d29c0[_0x04fd('0x1c')]['include'],function(_0x3ee9d9){return{'model':db[_0x3ee9d9[_0x04fd('0x21')]],'as':_0x3ee9d9['as'],'attributes':_0x3ee9d9[_0x04fd('0x1d')],'include':_0x3ee9d9[_0x04fd('0x20')]?_[_0x04fd('0x1f')](_0x3ee9d9[_0x04fd('0x20')],function(_0x2894fa){return{'model':db[_0x2894fa[_0x04fd('0x21')]],'as':_0x2894fa['as'],'attributes':_0x2894fa[_0x04fd('0x1d')],'include':_0x2894fa[_0x04fd('0x20')]?_[_0x04fd('0x1f')](_0x2894fa[_0x04fd('0x20')],function(_0x572f71){return{'model':db[_0x572f71[_0x04fd('0x21')]],'as':_0x572f71['as'],'attributes':_0x572f71[_0x04fd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x04fd('0xf')](function(_0xa625b6){logger[_0x04fd('0x10')](_0x04fd('0x25'),_0x3d29c0);logger[_0x04fd('0x23')](_0x04fd('0x25'),_0x3d29c0,JSON['stringify'](_0xa625b6));_0x53faf7(_0xa625b6);})['catch'](function(_0x4939a6){logger['error'](_0x04fd('0x25'),_0x4939a6['message'],_0x3d29c0);_0x327a9c(_0x1fe60e[_0x04fd('0x15')](0x1f4,_0x4939a6[_0x04fd('0x17')]));});});}; \ No newline at end of file +var _0x1f69=['result','GetSmsQueue','SmsQueue','options','raw','attributes','include','map','model','catch','ShowSmsQueue','find','where','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1a968e,_0x3f45f4){var _0x2c7b23=function(_0xc1e5c4){while(--_0xc1e5c4){_0x1a968e['push'](_0x1a968e['shift']());}};_0x2c7b23(++_0x3f45f4);}(_0x1f69,0x1bd));var _0x91f6=function(_0x22a2d7,_0x494787){_0x22a2d7=_0x22a2d7-0x0;var _0x4729d0=_0x1f69[_0x22a2d7];return _0x4729d0;};'use strict';var _=require(_0x91f6('0x0'));var util=require(_0x91f6('0x1'));var moment=require('moment');var BPromise=require(_0x91f6('0x2'));var rs=require(_0x91f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x91f6('0x4'));var logger=require(_0x91f6('0x5'))('rpc');var config=require(_0x91f6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91f6('0x7')]({'port':0x232a});config[_0x91f6('0x8')]=_['defaults'](config[_0x91f6('0x8')],{'host':_0x91f6('0x9'),'port':0x18eb});var socket=require(_0x91f6('0xa'))(new Redis(config[_0x91f6('0x8')]));require('./smsQueue.socket')[_0x91f6('0xb')](socket);function respondWithRpcPromise(_0x3df3ba,_0x2a490f,_0x4ecc5c){return new BPromise(function(_0x30ab9f,_0x4d4718){return client[_0x91f6('0xc')](_0x3df3ba,_0x4ecc5c)[_0x91f6('0xd')](function(_0x4866f3){logger[_0x91f6('0xe')](_0x91f6('0xf'),_0x2a490f,_0x91f6('0x10'));logger[_0x91f6('0x11')](_0x91f6('0x12'),_0x2a490f,_0x91f6('0x10'),JSON[_0x91f6('0x13')](_0x4866f3));if(_0x4866f3[_0x91f6('0x14')]){if(_0x4866f3[_0x91f6('0x14')][_0x91f6('0x15')]===0x1f4){logger[_0x91f6('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2a490f,_0x4866f3['error'][_0x91f6('0x16')]);return _0x4d4718(_0x4866f3[_0x91f6('0x14')][_0x91f6('0x16')]);}logger[_0x91f6('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2a490f,_0x4866f3[_0x91f6('0x14')]['message']);return _0x30ab9f(_0x4866f3[_0x91f6('0x14')][_0x91f6('0x16')]);}else{logger[_0x91f6('0xe')](_0x91f6('0xf'),_0x2a490f,_0x91f6('0x10'));_0x30ab9f(_0x4866f3[_0x91f6('0x17')][_0x91f6('0x16')]);}})['catch'](function(_0xd5775a){logger['error'](_0x91f6('0xf'),_0x2a490f,_0xd5775a);_0x4d4718(_0xd5775a);});});}exports[_0x91f6('0x18')]=function(_0xae8a7d){var _0x2c7da6=this;return new Promise(function(_0x1e262e,_0x33bf75){return db[_0x91f6('0x19')]['findAll']({'raw':_0xae8a7d[_0x91f6('0x1a')]?_0xae8a7d[_0x91f6('0x1a')][_0x91f6('0x1b')]===undefined?!![]:![]:!![],'where':_0xae8a7d[_0x91f6('0x1a')]?_0xae8a7d['options']['where']||null:null,'attributes':_0xae8a7d[_0x91f6('0x1a')]?_0xae8a7d[_0x91f6('0x1a')][_0x91f6('0x1c')]||null:null,'limit':_0xae8a7d[_0x91f6('0x1a')]?_0xae8a7d[_0x91f6('0x1a')]['limit']||null:null,'include':_0xae8a7d[_0x91f6('0x1a')]?_0xae8a7d[_0x91f6('0x1a')][_0x91f6('0x1d')]?_[_0x91f6('0x1e')](_0xae8a7d[_0x91f6('0x1a')][_0x91f6('0x1d')],function(_0x26d36e){return{'model':db[_0x26d36e[_0x91f6('0x1f')]],'as':_0x26d36e['as'],'attributes':_0x26d36e[_0x91f6('0x1c')],'include':_0x26d36e[_0x91f6('0x1d')]?_['map'](_0x26d36e[_0x91f6('0x1d')],function(_0x353c7f){return{'model':db[_0x353c7f['model']],'as':_0x353c7f['as'],'attributes':_0x353c7f[_0x91f6('0x1c')],'include':_0x353c7f['include']?_[_0x91f6('0x1e')](_0x353c7f['include'],function(_0x2d41f7){return{'model':db[_0x2d41f7[_0x91f6('0x1f')]],'as':_0x2d41f7['as'],'attributes':_0x2d41f7[_0x91f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x91f6('0xd')](function(_0x21c287){logger[_0x91f6('0xe')]('GetSmsQueue',_0xae8a7d);logger[_0x91f6('0x11')](_0x91f6('0x18'),_0xae8a7d,JSON[_0x91f6('0x13')](_0x21c287));_0x1e262e(_0x21c287);})[_0x91f6('0x20')](function(_0x44b86b){logger[_0x91f6('0x14')](_0x91f6('0x18'),_0x44b86b[_0x91f6('0x16')],_0xae8a7d);_0x33bf75(_0x2c7da6['error'](0x1f4,_0x44b86b['message']));});});};exports[_0x91f6('0x21')]=function(_0x1953c6){var _0x40e11e=this;return new Promise(function(_0x10b434,_0x1f1d2f){return db[_0x91f6('0x19')][_0x91f6('0x22')]({'raw':_0x1953c6[_0x91f6('0x1a')]?_0x1953c6['options']['raw']===undefined?!![]:![]:!![],'where':_0x1953c6[_0x91f6('0x1a')]?_0x1953c6[_0x91f6('0x1a')][_0x91f6('0x23')]||null:null,'attributes':_0x1953c6[_0x91f6('0x1a')]?_0x1953c6[_0x91f6('0x1a')][_0x91f6('0x1c')]||null:null,'include':_0x1953c6[_0x91f6('0x1a')]?_0x1953c6[_0x91f6('0x1a')][_0x91f6('0x1d')]?_[_0x91f6('0x1e')](_0x1953c6[_0x91f6('0x1a')]['include'],function(_0x46e621){return{'model':db[_0x46e621[_0x91f6('0x1f')]],'as':_0x46e621['as'],'attributes':_0x46e621[_0x91f6('0x1c')],'include':_0x46e621['include']?_[_0x91f6('0x1e')](_0x46e621[_0x91f6('0x1d')],function(_0x47814f){return{'model':db[_0x47814f[_0x91f6('0x1f')]],'as':_0x47814f['as'],'attributes':_0x47814f[_0x91f6('0x1c')],'include':_0x47814f['include']?_[_0x91f6('0x1e')](_0x47814f[_0x91f6('0x1d')],function(_0xdc2871){return{'model':db[_0xdc2871[_0x91f6('0x1f')]],'as':_0xdc2871['as'],'attributes':_0xdc2871[_0x91f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x91f6('0xd')](function(_0x38d8ca){logger[_0x91f6('0xe')](_0x91f6('0x21'),_0x1953c6);logger['debug']('ShowSmsQueue',_0x1953c6,JSON[_0x91f6('0x13')](_0x38d8ca));_0x10b434(_0x38d8ca);})['catch'](function(_0x414d50){logger['error']('ShowSmsQueue',_0x414d50[_0x91f6('0x16')],_0x1953c6);_0x1f1d2f(_0x40e11e['error'](0x1f4,_0x414d50[_0x91f6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a7ef9ef..365367e 100644 --- a/server/api/smsQueue/smsQueue.socket.js +++ b/server/api/smsQueue/smsQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ff5=['smsQueue:','remove','update','emit','removeListener','register'];(function(_0x3eadef,_0x4eb7fc){var _0x4db5e2=function(_0x25a430){while(--_0x25a430){_0x3eadef['push'](_0x3eadef['shift']());}};_0x4db5e2(++_0x4eb7fc);}(_0x9ff5,0x1d5));var _0x59ff=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9ff5[_0x1d50f2];return _0x3769b8;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0x59ff('0x0'),_0x59ff('0x1')];function createListener(_0x212593,_0x5d2894){return function(_0x1c4e3f){_0x5d2894[_0x59ff('0x2')](_0x212593,_0x1c4e3f);};}function removeListener(_0x5cb81c,_0x395440){return function(){SmsQueueEvents[_0x59ff('0x3')](_0x5cb81c,_0x395440);};}exports[_0x59ff('0x4')]=function(_0x172548){for(var _0x28c227=0x0,_0x42a6c1=events['length'];_0x28c227<_0x42a6c1;_0x28c227++){var _0x45033f=events[_0x28c227];var _0x5c7d43=createListener(_0x59ff('0x5')+_0x45033f,_0x172548);SmsQueueEvents['on'](_0x45033f,_0x5c7d43);}}; \ No newline at end of file +var _0xc590=['removeListener','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x2e9187,_0x371a5a){var _0x1fa9df=function(_0x15621e){while(--_0x15621e){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fa9df(++_0x371a5a);}(_0xc590,0xfe));var _0x0c59=function(_0xccc972,_0x5a251f){_0xccc972=_0xccc972-0x0;var _0x94122c=_0xc590[_0xccc972];return _0x94122c;};'use strict';var SmsQueueEvents=require(_0x0c59('0x0'));var events=[_0x0c59('0x1'),_0x0c59('0x2'),_0x0c59('0x3')];function createListener(_0x3adb09,_0x489e53){return function(_0x2d523e){_0x489e53[_0x0c59('0x4')](_0x3adb09,_0x2d523e);};}function removeListener(_0x229718,_0x4c67cc){return function(){SmsQueueEvents[_0x0c59('0x5')](_0x229718,_0x4c67cc);};}exports['register']=function(_0x2b17dd){for(var _0x28f5fd=0x0,_0x48d886=events['length'];_0x28f5fd<_0x48d886;_0x28f5fd++){var _0xa1492d=events[_0x28f5fd];var _0x3c1c58=createListener(_0x0c59('0x6')+_0xa1492d,_0x2b17dd);SmsQueueEvents['on'](_0xa1492d,_0x3c1c58);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 95545cd..1b639f5 100644 --- a/server/api/smsQueueReport/index.js +++ b/server/api/smsQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc6f=['get','isAuthenticated','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2618fd,_0x2cea31){var _0x127b28=function(_0x3b5580){while(--_0x3b5580){_0x2618fd['push'](_0x2618fd['shift']());}};_0x127b28(++_0x2cea31);}(_0xcc6f,0x10f));var _0xfcc6=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xcc6f[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require(_0xfcc6('0x0'));var util=require(_0xfcc6('0x1'));var path=require(_0xfcc6('0x2'));var timeout=require(_0xfcc6('0x3'));var express=require('express');var router=express[_0xfcc6('0x4')]();var fs_extra=require(_0xfcc6('0x5'));var auth=require(_0xfcc6('0x6'));var interaction=require(_0xfcc6('0x7'));var config=require(_0xfcc6('0x8'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfcc6('0x9')]('/describe',auth[_0xfcc6('0xa')](),controller[_0xfcc6('0xb')]);router['get']('/:id',auth[_0xfcc6('0xa')](),controller[_0xfcc6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfcc6('0xd')]);router[_0xfcc6('0xe')](_0xfcc6('0xf'),auth['isAuthenticated'](),controller[_0xfcc6('0x10')]);router[_0xfcc6('0x11')]('/:id',auth[_0xfcc6('0xa')](),controller[_0xfcc6('0x12')]);module[_0xfcc6('0x13')]=router; \ No newline at end of file +var _0xfbaf=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x52698d,_0x335b66){var _0x307209=function(_0x1f185f){while(--_0x1f185f){_0x52698d['push'](_0x52698d['shift']());}};_0x307209(++_0x335b66);}(_0xfbaf,0xcb));var _0xffba=function(_0x8570dc,_0x21990d){_0x8570dc=_0x8570dc-0x0;var _0x349771=_0xfbaf[_0x8570dc];return _0x349771;};'use strict';var multer=require(_0xffba('0x0'));var util=require(_0xffba('0x1'));var path=require('path');var timeout=require(_0xffba('0x2'));var express=require(_0xffba('0x3'));var router=express['Router']();var fs_extra=require(_0xffba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xffba('0x5'));var config=require(_0xffba('0x6'));var controller=require(_0xffba('0x7'));router[_0xffba('0x8')]('/',auth[_0xffba('0x9')](),controller[_0xffba('0xa')]);router[_0xffba('0x8')](_0xffba('0xb'),auth[_0xffba('0x9')](),controller[_0xffba('0xc')]);router[_0xffba('0x8')](_0xffba('0xd'),auth[_0xffba('0x9')](),controller['show']);router[_0xffba('0xe')]('/',auth[_0xffba('0x9')](),controller[_0xffba('0xf')]);router['put'](_0xffba('0xd'),auth[_0xffba('0x9')](),controller[_0xffba('0x10')]);router['delete'](_0xffba('0xd'),auth[_0xffba('0x9')](),controller[_0xffba('0x11')]);module[_0xffba('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1a099de..0abef2f 100644 --- a/server/api/smsQueueReport/smsQueueReport.attributes.js +++ b/server/api/smsQueueReport/smsQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd56f=['DATE','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd56f,0xb5));var _0xfd56=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0xd56f[_0x1073ad];return _0x528474;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xfd56('0x0')]={'uniqueid':{'type':Sequelize[_0xfd56('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xfd56('0x1')]},'joinAt':{'type':Sequelize[_0xfd56('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfd56('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfd56('0x1')]}}; \ No newline at end of file +var _0x10da=['STRING','moment','exports','DATE'];(function(_0x2d1b30,_0x4b3372){var _0x246e5a=function(_0x1304cb){while(--_0x1304cb){_0x2d1b30['push'](_0x2d1b30['shift']());}};_0x246e5a(++_0x4b3372);}(_0x10da,0x71));var _0xa10d=function(_0x5bf672,_0x2032ab){_0x5bf672=_0x5bf672-0x0;var _0x1aa1fd=_0x10da[_0x5bf672];return _0x1aa1fd;};'use strict';var moment=require(_0xa10d('0x0'));var Sequelize=require('sequelize');module[_0xa10d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa10d('0x2')]},'leaveAt':{'type':Sequelize[_0xa10d('0x2')]},'acceptAt':{'type':Sequelize[_0xa10d('0x2')]},'exitAt':{'type':Sequelize[_0xa10d('0x2')]},'reason':{'type':Sequelize[_0xa10d('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4a33113..7be8646 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3322=['destroy','name','index','SmsQueueReport','rawAttributes','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then'];(function(_0x1b4d0b,_0x39a22c){var _0x282aef=function(_0xf8180b){while(--_0xf8180b){_0x1b4d0b['push'](_0x1b4d0b['shift']());}};_0x282aef(++_0x39a22c);}(_0x3322,0x1c6));var _0x2332=function(_0x3c9e5f,_0x2aa395){_0x3c9e5f=_0x3c9e5f-0x0;var _0x9f8732=_0x3322[_0x3c9e5f];return _0x9f8732;};'use strict';var emlformat=require(_0x2332('0x0'));var rimraf=require(_0x2332('0x1'));var zipdir=require(_0x2332('0x2'));var jsonpatch=require(_0x2332('0x3'));var rp=require(_0x2332('0x4'));var moment=require(_0x2332('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2332('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2332('0x7'));var csv=require(_0x2332('0x8'));var ejs=require(_0x2332('0x9'));var fs=require('fs');var fs_extra=require(_0x2332('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2332('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2332('0xc'));var toCsv=require(_0x2332('0x8'));var querystring=require(_0x2332('0xd'));var Papa=require(_0x2332('0xe'));var Redis=require(_0x2332('0xf'));var authService=require(_0x2332('0x10'));var qs=require(_0x2332('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2332('0x12'));var logger=require(_0x2332('0x13'))(_0x2332('0x14'));var utils=require(_0x2332('0x15'));var config=require(_0x2332('0x16'));var licenseUtil=require(_0x2332('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa45b18,_0xecfc3b){_0xecfc3b=_0xecfc3b||0xcc;return function(_0x30b039){if(_0x30b039){return _0xa45b18[_0x2332('0x18')](_0xecfc3b);}return _0xa45b18[_0x2332('0x19')](_0xecfc3b)[_0x2332('0x1a')]();};}function respondWithResult(_0x12aafd,_0x4e6cbb){_0x4e6cbb=_0x4e6cbb||0xc8;return function(_0x5ac957){if(_0x5ac957){return _0x12aafd[_0x2332('0x19')](_0x4e6cbb)[_0x2332('0x1b')](_0x5ac957);}};}function respondWithFilteredResult(_0x338559,_0x13a2f9){return function(_0x21656d){if(_0x21656d){var _0x51ccb0=typeof _0x13a2f9[_0x2332('0x1c')]===_0x2332('0x1d')&&typeof _0x13a2f9[_0x2332('0x1e')]==='undefined';var _0x5da66c=_0x21656d[_0x2332('0x1f')];var _0x3383bc=_0x51ccb0?0x0:_0x13a2f9[_0x2332('0x1c')];var _0xb6e10f=_0x51ccb0?_0x21656d[_0x2332('0x1f')]:_0x13a2f9['offset']+_0x13a2f9['limit'];var _0x489dbe;if(_0xb6e10f>=_0x5da66c){_0xb6e10f=_0x5da66c;_0x489dbe=0xc8;}else{_0x489dbe=0xce;}_0x338559[_0x2332('0x19')](_0x489dbe);return _0x338559['set']('Content-Range',_0x3383bc+'-'+_0xb6e10f+'/'+_0x5da66c)[_0x2332('0x1b')](_0x21656d);}return null;};}function patchUpdates(_0x3945aa){return function(_0x71d4c4){try{jsonpatch[_0x2332('0x20')](_0x71d4c4,_0x3945aa,!![]);}catch(_0x35218b){return BPromise[_0x2332('0x21')](_0x35218b);}return _0x71d4c4['save']();};}function saveUpdates(_0x3c8756,_0x16ede5){return function(_0x167714){if(_0x167714){return _0x167714[_0x2332('0x22')](_0x3c8756)[_0x2332('0x23')](function(_0x175f56){return _0x175f56;});}return null;};}function removeEntity(_0x5c1cae,_0xe61eba){return function(_0x873d0b){if(_0x873d0b){return _0x873d0b[_0x2332('0x24')]()['then'](function(){_0x5c1cae[_0x2332('0x19')](0xcc)[_0x2332('0x1a')]();});}};}function handleEntityNotFound(_0x65abf7,_0x5388a3){return function(_0x1a492e){if(!_0x1a492e){_0x65abf7['sendStatus'](0x194);}return _0x1a492e;};}function handleError(_0xd7b18a,_0x2c68c9){_0x2c68c9=_0x2c68c9||0x1f4;return function(_0x4cd8d9){logger['error'](_0x4cd8d9['stack']);if(_0x4cd8d9[_0x2332('0x25')]){delete _0x4cd8d9[_0x2332('0x25')];}_0xd7b18a[_0x2332('0x19')](_0x2c68c9)['send'](_0x4cd8d9);};}exports[_0x2332('0x26')]=function(_0x514120,_0x32d8d7){var _0x4b65bb={},_0x46f7ff={},_0x216da8={'count':0x0,'rows':[]};var _0x16b6f6=_['map'](db[_0x2332('0x27')][_0x2332('0x28')],function(_0x3f49b4){return{'name':_0x3f49b4['fieldName'],'type':_0x3f49b4['type']['key']};});_0x46f7ff['model']=_[_0x2332('0x29')](_0x16b6f6,_0x2332('0x25'));_0x46f7ff[_0x2332('0x2a')]=_[_0x2332('0x2b')](_0x514120[_0x2332('0x2a')]);_0x46f7ff['filters']=_[_0x2332('0x2c')](_0x46f7ff[_0x2332('0x2d')],_0x46f7ff['query']);_0x4b65bb['attributes']=_[_0x2332('0x2c')](_0x46f7ff['model'],qs[_0x2332('0x2e')](_0x514120['query']['fields']));_0x4b65bb[_0x2332('0x2f')]=_0x4b65bb[_0x2332('0x2f')]['length']?_0x4b65bb[_0x2332('0x2f')]:_0x46f7ff[_0x2332('0x2d')];if(!_0x514120['query'][_0x2332('0x30')](_0x2332('0x31'))){_0x4b65bb[_0x2332('0x1e')]=qs[_0x2332('0x1e')](_0x514120[_0x2332('0x2a')][_0x2332('0x1e')]);_0x4b65bb[_0x2332('0x1c')]=qs[_0x2332('0x1c')](_0x514120[_0x2332('0x2a')][_0x2332('0x1c')]);}_0x4b65bb['order']=qs[_0x2332('0x32')](_0x514120[_0x2332('0x2a')][_0x2332('0x32')]);_0x4b65bb['where']=qs[_0x2332('0x33')](_[_0x2332('0x34')](_0x514120[_0x2332('0x2a')],_0x46f7ff[_0x2332('0x33')]),_0x16b6f6);if(_0x514120[_0x2332('0x2a')][_0x2332('0x35')]){_0x4b65bb[_0x2332('0x36')]=_['merge'](_0x4b65bb['where'],{'$or':_[_0x2332('0x29')](_0x16b6f6,function(_0x12baa1){if(_0x12baa1['type']!==_0x2332('0x37')){var _0x5dce3b={};_0x5dce3b[_0x12baa1['name']]={'$like':'%'+_0x514120['query']['filter']+'%'};return _0x5dce3b;}})});}_0x4b65bb=_[_0x2332('0x38')]({},_0x4b65bb,_0x514120[_0x2332('0x39')]);var _0x294a86={'where':_0x4b65bb[_0x2332('0x36')]};return db[_0x2332('0x27')][_0x2332('0x1f')](_0x294a86)['then'](function(_0x232775){_0x216da8['count']=_0x232775;if(_0x514120['query'][_0x2332('0x3a')]){_0x4b65bb[_0x2332('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x2332('0x3c')](_0x4b65bb);})[_0x2332('0x23')](function(_0x54fb59){_0x216da8[_0x2332('0x3d')]=_0x54fb59;return _0x216da8;})[_0x2332('0x23')](respondWithFilteredResult(_0x32d8d7,_0x4b65bb))[_0x2332('0x3e')](handleError(_0x32d8d7,null));};exports[_0x2332('0x3f')]=function(_0x11f4d9,_0x285e0a){var _0x159c3f={'raw':!![],'where':{'id':_0x11f4d9[_0x2332('0x40')]['id']}},_0xe22628={};_0xe22628[_0x2332('0x2d')]=_['keys'](db['SmsQueueReport'][_0x2332('0x28')]);_0xe22628['query']=_[_0x2332('0x2b')](_0x11f4d9['query']);_0xe22628[_0x2332('0x33')]=_['intersection'](_0xe22628[_0x2332('0x2d')],_0xe22628['query']);_0x159c3f[_0x2332('0x2f')]=_[_0x2332('0x2c')](_0xe22628[_0x2332('0x2d')],qs['fields'](_0x11f4d9['query'][_0x2332('0x2e')]));_0x159c3f['attributes']=_0x159c3f['attributes'][_0x2332('0x41')]?_0x159c3f[_0x2332('0x2f')]:_0xe22628[_0x2332('0x2d')];if(_0x11f4d9[_0x2332('0x2a')][_0x2332('0x3a')]){_0x159c3f[_0x2332('0x3b')]=[{'all':!![]}];}_0x159c3f=_[_0x2332('0x38')]({},_0x159c3f,_0x11f4d9['options']);return db['SmsQueueReport'][_0x2332('0x42')](_0x159c3f)[_0x2332('0x23')](handleEntityNotFound(_0x285e0a,null))['then'](respondWithResult(_0x285e0a,null))[_0x2332('0x3e')](handleError(_0x285e0a,null));};exports[_0x2332('0x43')]=function(_0x4dbb73,_0x14987e){return db[_0x2332('0x27')][_0x2332('0x43')](_0x4dbb73['body'],{})[_0x2332('0x23')](respondWithResult(_0x14987e,0xc9))[_0x2332('0x3e')](handleError(_0x14987e,null));};exports[_0x2332('0x22')]=function(_0x5438e6,_0x2f275f){if(_0x5438e6[_0x2332('0x44')]['id']){delete _0x5438e6[_0x2332('0x44')]['id'];}return db[_0x2332('0x27')][_0x2332('0x42')]({'where':{'id':_0x5438e6[_0x2332('0x40')]['id']}})[_0x2332('0x23')](handleEntityNotFound(_0x2f275f,null))[_0x2332('0x23')](saveUpdates(_0x5438e6[_0x2332('0x44')],null))[_0x2332('0x23')](respondWithResult(_0x2f275f,null))[_0x2332('0x3e')](handleError(_0x2f275f,null));};exports[_0x2332('0x24')]=function(_0x515ea9,_0x17fd00){return db[_0x2332('0x27')][_0x2332('0x42')]({'where':{'id':_0x515ea9['params']['id']}})[_0x2332('0x23')](handleEntityNotFound(_0x17fd00,null))['then'](removeEntity(_0x17fd00,null))[_0x2332('0x3e')](handleError(_0x17fd00,null));};exports['describe']=function(_0x1005f2,_0x2963cd){return db['SmsQueueReport'][_0x2332('0x45')]()[_0x2332('0x23')](respondWithResult(_0x2963cd,null))[_0x2332('0x3e')](handleError(_0x2963cd,null));}; \ No newline at end of file +var _0xcdfe=['pick','filter','merge','type','VIRTUAL','includeAll','include','rows','params','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x153099,_0x24cc13){var _0x4a8c61=function(_0x15f5fd){while(--_0x15f5fd){_0x153099['push'](_0x153099['shift']());}};_0x4a8c61(++_0x24cc13);}(_0xcdfe,0x1d1));var _0xecdf=function(_0x4a9ce5,_0x5842a1){_0x4a9ce5=_0x4a9ce5-0x0;var _0x251ad7=_0xcdfe[_0x4a9ce5];return _0x251ad7;};'use strict';var emlformat=require(_0xecdf('0x0'));var rimraf=require(_0xecdf('0x1'));var zipdir=require(_0xecdf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecdf('0x3'));var moment=require(_0xecdf('0x4'));var BPromise=require(_0xecdf('0x5'));var Mustache=require(_0xecdf('0x6'));var util=require(_0xecdf('0x7'));var path=require(_0xecdf('0x8'));var sox=require(_0xecdf('0x9'));var csv=require(_0xecdf('0xa'));var ejs=require(_0xecdf('0xb'));var fs=require('fs');var fs_extra=require(_0xecdf('0xc'));var _=require(_0xecdf('0xd'));var squel=require(_0xecdf('0xe'));var crypto=require(_0xecdf('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xecdf('0x10'));var toCsv=require(_0xecdf('0xa'));var querystring=require(_0xecdf('0x11'));var Papa=require(_0xecdf('0x12'));var Redis=require(_0xecdf('0x13'));var authService=require(_0xecdf('0x14'));var qs=require(_0xecdf('0x15'));var as=require(_0xecdf('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xecdf('0x17'))['db'];function respondWithStatusCode(_0x8273bb,_0x5785b8){_0x5785b8=_0x5785b8||0xcc;return function(_0x3b6a84){if(_0x3b6a84){return _0x8273bb[_0xecdf('0x18')](_0x5785b8);}return _0x8273bb[_0xecdf('0x19')](_0x5785b8)[_0xecdf('0x1a')]();};}function respondWithResult(_0x3de9eb,_0x5d05e0){_0x5d05e0=_0x5d05e0||0xc8;return function(_0x17104f){if(_0x17104f){return _0x3de9eb[_0xecdf('0x19')](_0x5d05e0)[_0xecdf('0x1b')](_0x17104f);}};}function respondWithFilteredResult(_0x2fde40,_0x2da702){return function(_0x28bc5a){if(_0x28bc5a){var _0x437853=typeof _0x2da702[_0xecdf('0x1c')]===_0xecdf('0x1d')&&typeof _0x2da702[_0xecdf('0x1e')]===_0xecdf('0x1d');var _0x57d676=_0x28bc5a[_0xecdf('0x1f')];var _0x4e74ed=_0x437853?0x0:_0x2da702['offset'];var _0x44caf6=_0x437853?_0x28bc5a[_0xecdf('0x1f')]:_0x2da702[_0xecdf('0x1c')]+_0x2da702[_0xecdf('0x1e')];var _0x244f0b;if(_0x44caf6>=_0x57d676){_0x44caf6=_0x57d676;_0x244f0b=0xc8;}else{_0x244f0b=0xce;}_0x2fde40[_0xecdf('0x19')](_0x244f0b);return _0x2fde40[_0xecdf('0x20')]('Content-Range',_0x4e74ed+'-'+_0x44caf6+'/'+_0x57d676)['json'](_0x28bc5a);}return null;};}function patchUpdates(_0x168f93){return function(_0x2c07cd){try{jsonpatch[_0xecdf('0x21')](_0x2c07cd,_0x168f93,!![]);}catch(_0xec4d56){return BPromise[_0xecdf('0x22')](_0xec4d56);}return _0x2c07cd[_0xecdf('0x23')]();};}function saveUpdates(_0x221a31,_0x5d2085){return function(_0x113654){if(_0x113654){return _0x113654[_0xecdf('0x24')](_0x221a31)[_0xecdf('0x25')](function(_0x2e310d){return _0x2e310d;});}return null;};}function removeEntity(_0x58fb98,_0x224b15){return function(_0x1e14e3){if(_0x1e14e3){return _0x1e14e3['destroy']()['then'](function(){_0x58fb98[_0xecdf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a74cb,_0x3521df){return function(_0x2c40e9){if(!_0x2c40e9){_0x5a74cb['sendStatus'](0x194);}return _0x2c40e9;};}function handleError(_0x3f8255,_0x256ab6){_0x256ab6=_0x256ab6||0x1f4;return function(_0x2beec5){logger[_0xecdf('0x26')](_0x2beec5[_0xecdf('0x27')]);if(_0x2beec5[_0xecdf('0x28')]){delete _0x2beec5[_0xecdf('0x28')];}_0x3f8255[_0xecdf('0x19')](_0x256ab6)[_0xecdf('0x29')](_0x2beec5);};}exports[_0xecdf('0x2a')]=function(_0x198f65,_0x1eab1a){var _0x5d3b9e={},_0x5130f4={},_0x2c5dc2={'count':0x0,'rows':[]};var _0x39492f=_[_0xecdf('0x2b')](db[_0xecdf('0x2c')][_0xecdf('0x2d')],function(_0x49622d){return{'name':_0x49622d[_0xecdf('0x2e')],'type':_0x49622d['type'][_0xecdf('0x2f')]};});_0x5130f4[_0xecdf('0x30')]=_['map'](_0x39492f,_0xecdf('0x28'));_0x5130f4[_0xecdf('0x31')]=_[_0xecdf('0x32')](_0x198f65[_0xecdf('0x31')]);_0x5130f4[_0xecdf('0x33')]=_[_0xecdf('0x34')](_0x5130f4[_0xecdf('0x30')],_0x5130f4['query']);_0x5d3b9e[_0xecdf('0x35')]=_[_0xecdf('0x34')](_0x5130f4[_0xecdf('0x30')],qs[_0xecdf('0x36')](_0x198f65[_0xecdf('0x31')]['fields']));_0x5d3b9e['attributes']=_0x5d3b9e[_0xecdf('0x35')][_0xecdf('0x37')]?_0x5d3b9e[_0xecdf('0x35')]:_0x5130f4[_0xecdf('0x30')];if(!_0x198f65[_0xecdf('0x31')][_0xecdf('0x38')]('nolimit')){_0x5d3b9e[_0xecdf('0x1e')]=qs['limit'](_0x198f65['query'][_0xecdf('0x1e')]);_0x5d3b9e['offset']=qs[_0xecdf('0x1c')](_0x198f65[_0xecdf('0x31')][_0xecdf('0x1c')]);}_0x5d3b9e[_0xecdf('0x39')]=qs['sort'](_0x198f65[_0xecdf('0x31')][_0xecdf('0x3a')]);_0x5d3b9e[_0xecdf('0x3b')]=qs[_0xecdf('0x33')](_[_0xecdf('0x3c')](_0x198f65[_0xecdf('0x31')],_0x5130f4[_0xecdf('0x33')]),_0x39492f);if(_0x198f65[_0xecdf('0x31')][_0xecdf('0x3d')]){_0x5d3b9e['where']=_[_0xecdf('0x3e')](_0x5d3b9e[_0xecdf('0x3b')],{'$or':_[_0xecdf('0x2b')](_0x39492f,function(_0x11772d){if(_0x11772d[_0xecdf('0x3f')]!==_0xecdf('0x40')){var _0x3bdfb6={};_0x3bdfb6[_0x11772d[_0xecdf('0x28')]]={'$like':'%'+_0x198f65[_0xecdf('0x31')]['filter']+'%'};return _0x3bdfb6;}})});}_0x5d3b9e=_[_0xecdf('0x3e')]({},_0x5d3b9e,_0x198f65['options']);var _0x4d1db3={'where':_0x5d3b9e[_0xecdf('0x3b')]};return db['SmsQueueReport']['count'](_0x4d1db3)[_0xecdf('0x25')](function(_0x1a216e){_0x2c5dc2[_0xecdf('0x1f')]=_0x1a216e;if(_0x198f65[_0xecdf('0x31')][_0xecdf('0x41')]){_0x5d3b9e[_0xecdf('0x42')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x5d3b9e);})[_0xecdf('0x25')](function(_0x2f7fd9){_0x2c5dc2[_0xecdf('0x43')]=_0x2f7fd9;return _0x2c5dc2;})[_0xecdf('0x25')](respondWithFilteredResult(_0x1eab1a,_0x5d3b9e))['catch'](handleError(_0x1eab1a,null));};exports['show']=function(_0x18f61d,_0x3a1087){var _0x5ce18d={'raw':!![],'where':{'id':_0x18f61d[_0xecdf('0x44')]['id']}},_0x393abc={};_0x393abc['model']=_[_0xecdf('0x32')](db['SmsQueueReport'][_0xecdf('0x2d')]);_0x393abc[_0xecdf('0x31')]=_[_0xecdf('0x32')](_0x18f61d[_0xecdf('0x31')]);_0x393abc[_0xecdf('0x33')]=_['intersection'](_0x393abc[_0xecdf('0x30')],_0x393abc[_0xecdf('0x31')]);_0x5ce18d[_0xecdf('0x35')]=_[_0xecdf('0x34')](_0x393abc[_0xecdf('0x30')],qs[_0xecdf('0x36')](_0x18f61d['query'][_0xecdf('0x36')]));_0x5ce18d[_0xecdf('0x35')]=_0x5ce18d['attributes'][_0xecdf('0x37')]?_0x5ce18d['attributes']:_0x393abc[_0xecdf('0x30')];if(_0x18f61d[_0xecdf('0x31')][_0xecdf('0x41')]){_0x5ce18d[_0xecdf('0x42')]=[{'all':!![]}];}_0x5ce18d=_[_0xecdf('0x3e')]({},_0x5ce18d,_0x18f61d['options']);return db[_0xecdf('0x2c')][_0xecdf('0x45')](_0x5ce18d)[_0xecdf('0x25')](handleEntityNotFound(_0x3a1087,null))[_0xecdf('0x25')](respondWithResult(_0x3a1087,null))['catch'](handleError(_0x3a1087,null));};exports['create']=function(_0x3abec6,_0x2ffceb){return db[_0xecdf('0x2c')][_0xecdf('0x46')](_0x3abec6[_0xecdf('0x47')],{})['then'](respondWithResult(_0x2ffceb,0xc9))[_0xecdf('0x48')](handleError(_0x2ffceb,null));};exports[_0xecdf('0x24')]=function(_0x99b068,_0x12df9d){if(_0x99b068['body']['id']){delete _0x99b068['body']['id'];}return db[_0xecdf('0x2c')][_0xecdf('0x45')]({'where':{'id':_0x99b068['params']['id']}})[_0xecdf('0x25')](handleEntityNotFound(_0x12df9d,null))[_0xecdf('0x25')](saveUpdates(_0x99b068[_0xecdf('0x47')],null))[_0xecdf('0x25')](respondWithResult(_0x12df9d,null))[_0xecdf('0x48')](handleError(_0x12df9d,null));};exports[_0xecdf('0x49')]=function(_0x214705,_0x50f280){return db[_0xecdf('0x2c')]['find']({'where':{'id':_0x214705['params']['id']}})[_0xecdf('0x25')](handleEntityNotFound(_0x50f280,null))[_0xecdf('0x25')](removeEntity(_0x50f280,null))[_0xecdf('0x48')](handleError(_0x50f280,null));};exports['describe']=function(_0x30aee8,_0x304dab){return db['SmsQueueReport'][_0xecdf('0x4a')]()[_0xecdf('0x25')](respondWithResult(_0x304dab,null))[_0xecdf('0x48')](handleError(_0x304dab,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 808890a..f82d3af 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x89050a,_0x1b7e4f){var _0x8c6346=function(_0x1550df){while(--_0x1550df){_0x89050a['push'](_0x89050a['shift']());}};_0x8c6346(++_0x1b7e4f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index a53b50b..9633f93 100644 --- a/server/api/smsQueueReport/smsQueueReport.rpc.js +++ b/server/api/smsQueueReport/smsQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0577=['request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','request','then','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x4e6154,_0x573ffe){var _0x4fb016=function(_0xad6f46){while(--_0xad6f46){_0x4e6154['push'](_0x4e6154['shift']());}};_0x4fb016(++_0x573ffe);}(_0x0577,0xcc));var _0x7057=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0577[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7057('0x0'));var util=require(_0x7057('0x1'));var moment=require(_0x7057('0x2'));var BPromise=require(_0x7057('0x3'));var rs=require(_0x7057('0x4'));var fs=require('fs');var Redis=require(_0x7057('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7057('0x6'));var config=require(_0x7057('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7057('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54a163,_0x504f37,_0x3f8365){return new BPromise(function(_0xcf808,_0x1835f0){return client[_0x7057('0x9')](_0x54a163,_0x3f8365)[_0x7057('0xa')](function(_0x32fe94){logger[_0x7057('0xb')](_0x7057('0xc'),_0x504f37,_0x7057('0xd'));logger[_0x7057('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x504f37,'request\x20sent',JSON[_0x7057('0xf')](_0x32fe94));if(_0x32fe94[_0x7057('0x10')]){if(_0x32fe94[_0x7057('0x10')][_0x7057('0x11')]===0x1f4){logger[_0x7057('0x10')](_0x7057('0xc'),_0x504f37,_0x32fe94[_0x7057('0x10')][_0x7057('0x12')]);return _0x1835f0(_0x32fe94['error'][_0x7057('0x12')]);}logger['error'](_0x7057('0xc'),_0x504f37,_0x32fe94[_0x7057('0x10')][_0x7057('0x12')]);return _0xcf808(_0x32fe94[_0x7057('0x10')][_0x7057('0x12')]);}else{logger[_0x7057('0xb')](_0x7057('0xc'),_0x504f37,_0x7057('0xd'));_0xcf808(_0x32fe94[_0x7057('0x13')]['message']);}})[_0x7057('0x14')](function(_0x2104c3){logger[_0x7057('0x10')](_0x7057('0xc'),_0x504f37,_0x2104c3);_0x1835f0(_0x2104c3);});});}exports[_0x7057('0x15')]=function(_0x3e6dfd){var _0x1a2e1c=this;return new Promise(function(_0x3bff26,_0xc8a561){return db[_0x7057('0x16')][_0x7057('0x17')](_0x3e6dfd[_0x7057('0x18')],{'raw':_0x3e6dfd[_0x7057('0x19')]?_0x3e6dfd[_0x7057('0x19')][_0x7057('0x1a')]===undefined?!![]:![]:!![]})[_0x7057('0xa')](function(_0x55ea44){logger[_0x7057('0xb')](_0x7057('0x15'),_0x3e6dfd);logger[_0x7057('0xe')](_0x7057('0x15'),_0x3e6dfd,JSON[_0x7057('0xf')](_0x55ea44));_0x3bff26(_0x55ea44);})[_0x7057('0x14')](function(_0x87a0ec){logger['error'](_0x7057('0x15'),_0x87a0ec[_0x7057('0x12')],_0x3e6dfd);_0xc8a561(_0x1a2e1c[_0x7057('0x10')](0x1f4,_0x87a0ec[_0x7057('0x12')]));});});};exports[_0x7057('0x1b')]=function(_0x295c82){var _0x12af47=this;return new Promise(function(_0x27dd3d,_0x8c765){return db[_0x7057('0x16')][_0x7057('0x1c')](_0x295c82['body'],{'raw':_0x295c82[_0x7057('0x19')]?_0x295c82[_0x7057('0x19')][_0x7057('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295c82[_0x7057('0x19')]?_0x295c82[_0x7057('0x19')]['where']||null:null,'attributes':_0x295c82[_0x7057('0x19')]?_0x295c82[_0x7057('0x19')][_0x7057('0x1d')]||null:null,'limit':_0x295c82['options']?_0x295c82['options'][_0x7057('0x1e')]||null:null})[_0x7057('0xa')](function(_0x180952){logger['info'](_0x7057('0x1b'),_0x295c82);logger[_0x7057('0xe')](_0x7057('0x1b'),_0x295c82,JSON[_0x7057('0xf')](_0x180952));_0x27dd3d(_0x180952);})[_0x7057('0x14')](function(_0xb8b1a7){logger[_0x7057('0x10')](_0x7057('0x1b'),_0xb8b1a7[_0x7057('0x12')],_0x295c82);_0x8c765(_0x12af47[_0x7057('0x10')](0x1f4,_0xb8b1a7[_0x7057('0x12')]));});});}; \ No newline at end of file +var _0x57e3=['attributes','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','update'];(function(_0x85ee79,_0x19acef){var _0x28b9f5=function(_0x4bfd11){while(--_0x4bfd11){_0x85ee79['push'](_0x85ee79['shift']());}};_0x28b9f5(++_0x19acef);}(_0x57e3,0x65));var _0x357e=function(_0x403a9a,_0x24f63e){_0x403a9a=_0x403a9a-0x0;var _0x2d6bce=_0x57e3[_0x403a9a];return _0x2d6bce;};'use strict';var _=require(_0x357e('0x0'));var util=require(_0x357e('0x1'));var moment=require(_0x357e('0x2'));var BPromise=require(_0x357e('0x3'));var rs=require(_0x357e('0x4'));var fs=require('fs');var Redis=require(_0x357e('0x5'));var db=require(_0x357e('0x6'))['db'];var utils=require(_0x357e('0x7'));var logger=require(_0x357e('0x8'))(_0x357e('0x9'));var config=require('../../config/environment');var jayson=require(_0x357e('0xa'));var client=jayson['client'][_0x357e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2de3f8,_0xb24e69,_0x118dfa){return new BPromise(function(_0x32027d,_0x355c53){return client[_0x357e('0xc')](_0x2de3f8,_0x118dfa)[_0x357e('0xd')](function(_0x4bd280){logger[_0x357e('0xe')](_0x357e('0xf'),_0xb24e69,_0x357e('0x10'));logger[_0x357e('0x11')](_0x357e('0x12'),_0xb24e69,_0x357e('0x10'),JSON[_0x357e('0x13')](_0x4bd280));if(_0x4bd280[_0x357e('0x14')]){if(_0x4bd280[_0x357e('0x14')]['code']===0x1f4){logger['error'](_0x357e('0xf'),_0xb24e69,_0x4bd280[_0x357e('0x14')][_0x357e('0x15')]);return _0x355c53(_0x4bd280[_0x357e('0x14')]['message']);}logger[_0x357e('0x14')](_0x357e('0xf'),_0xb24e69,_0x4bd280[_0x357e('0x14')]['message']);return _0x32027d(_0x4bd280['error'][_0x357e('0x15')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xb24e69,_0x357e('0x10'));_0x32027d(_0x4bd280[_0x357e('0x16')][_0x357e('0x15')]);}})[_0x357e('0x17')](function(_0xa4312a){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0xb24e69,_0xa4312a);_0x355c53(_0xa4312a);});});}exports['CreateSmsQueueReport']=function(_0x4fc783){var _0x5f31fc=this;return new Promise(function(_0x59b7e7,_0x3d6fea){return db[_0x357e('0x18')][_0x357e('0x19')](_0x4fc783[_0x357e('0x1a')],{'raw':_0x4fc783[_0x357e('0x1b')]?_0x4fc783[_0x357e('0x1b')][_0x357e('0x1c')]===undefined?!![]:![]:!![]})[_0x357e('0xd')](function(_0x4a3a99){logger[_0x357e('0xe')](_0x357e('0x1d'),_0x4fc783);logger['debug'](_0x357e('0x1d'),_0x4fc783,JSON[_0x357e('0x13')](_0x4a3a99));_0x59b7e7(_0x4a3a99);})[_0x357e('0x17')](function(_0x56c499){logger[_0x357e('0x14')](_0x357e('0x1d'),_0x56c499[_0x357e('0x15')],_0x4fc783);_0x3d6fea(_0x5f31fc['error'](0x1f4,_0x56c499['message']));});});};exports['UpdateSmsQueueReport']=function(_0x3351f3){var _0x36445c=this;return new Promise(function(_0x2c38b5,_0x42b035){return db[_0x357e('0x18')][_0x357e('0x1e')](_0x3351f3[_0x357e('0x1a')],{'raw':_0x3351f3[_0x357e('0x1b')]?_0x3351f3[_0x357e('0x1b')][_0x357e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3351f3['options']?_0x3351f3['options']['where']||null:null,'attributes':_0x3351f3[_0x357e('0x1b')]?_0x3351f3[_0x357e('0x1b')][_0x357e('0x1f')]||null:null,'limit':_0x3351f3[_0x357e('0x1b')]?_0x3351f3['options']['limit']||null:null})[_0x357e('0xd')](function(_0x55c74c){logger[_0x357e('0xe')](_0x357e('0x20'),_0x3351f3);logger[_0x357e('0x11')]('UpdateSmsQueueReport',_0x3351f3,JSON['stringify'](_0x55c74c));_0x2c38b5(_0x55c74c);})[_0x357e('0x17')](function(_0x355bc5){logger[_0x357e('0x14')]('UpdateSmsQueueReport',_0x355bc5[_0x357e('0x15')],_0x3351f3);_0x42b035(_0x36445c['error'](0x1f4,_0x355bc5[_0x357e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d49a268..d63355d 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x1db29a,_0x5263e6){var _0x53525b=function(_0x469d7d){while(--_0x469d7d){_0x1db29a['push'](_0x1db29a['shift']());}};_0x53525b(++_0x5263e6);}(_0x84ab,0x12f));var _0xb84a=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x84ab[_0x4191bc];return _0x1ffd4e;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5075=['get','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index'];(function(_0x36276f,_0x45d707){var _0x4f1490=function(_0x411a6d){while(--_0x411a6d){_0x36276f['push'](_0x36276f['shift']());}};_0x4f1490(++_0x45d707);}(_0x5075,0x73));var _0x5507=function(_0x1b81b9,_0x1d314a){_0x1b81b9=_0x1b81b9-0x0;var _0x27a94d=_0x5075[_0x1b81b9];return _0x27a94d;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5507('0xa')]);router[_0x5507('0xb')]('/describe',auth[_0x5507('0xc')](),controller[_0x5507('0xd')]);router[_0x5507('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')]('/',auth[_0x5507('0xc')](),controller[_0x5507('0x10')]);router['put'](_0x5507('0x11'),auth[_0x5507('0xc')](),controller['update']);router[_0x5507('0x12')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x13')]);module[_0x5507('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 92ab600..9ecc728 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x4fb8fd,_0xa695bf){var _0x523428=function(_0x3139d5){while(--_0x3139d5){_0x4fb8fd['push'](_0x4fb8fd['shift']());}};_0x523428(++_0xa695bf);}(_0x70e0,0x17b));var _0x070e=function(_0x185575,_0x1c2f69){_0x185575=_0x185575-0x0;var _0x34e474=_0x70e0[_0x185575];return _0x34e474;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 94d25d2..903db97 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x779f=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','error','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','filter','merge','where','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x779f,0x83));var _0xf779=function(_0xe0917d,_0x1ec275){_0xe0917d=_0xe0917d-0x0;var _0x34eb5a=_0x779f[_0xe0917d];return _0x34eb5a;};'use strict';var emlformat=require(_0xf779('0x0'));var rimraf=require(_0xf779('0x1'));var zipdir=require(_0xf779('0x2'));var jsonpatch=require(_0xf779('0x3'));var rp=require('request-promise');var moment=require(_0xf779('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf779('0x5'));var util=require(_0xf779('0x6'));var path=require(_0xf779('0x7'));var sox=require(_0xf779('0x8'));var csv=require(_0xf779('0x9'));var ejs=require(_0xf779('0xa'));var fs=require('fs');var fs_extra=require(_0xf779('0xb'));var _=require('lodash');var squel=require(_0xf779('0xc'));var crypto=require('crypto');var jsforce=require(_0xf779('0xd'));var deskjs=require(_0xf779('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf779('0xf'));var Papa=require(_0xf779('0x10'));var Redis=require('ioredis');var authService=require(_0xf779('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf779('0x12'));var hardwareService=require(_0xf779('0x13'));var logger=require(_0xf779('0x14'))(_0xf779('0x15'));var utils=require(_0xf779('0x16'));var config=require(_0xf779('0x17'));var licenseUtil=require(_0xf779('0x18'));var db=require(_0xf779('0x19'))['db'];function respondWithStatusCode(_0x456977,_0x517920){_0x517920=_0x517920||0xcc;return function(_0x43982e){if(_0x43982e){return _0x456977[_0xf779('0x1a')](_0x517920);}return _0x456977[_0xf779('0x1b')](_0x517920)[_0xf779('0x1c')]();};}function respondWithResult(_0x3fa628,_0x499622){_0x499622=_0x499622||0xc8;return function(_0x2a14de){if(_0x2a14de){return _0x3fa628['status'](_0x499622)[_0xf779('0x1d')](_0x2a14de);}};}function respondWithFilteredResult(_0x27a531,_0x775c2f){return function(_0x4ce676){if(_0x4ce676){var _0x27d4a6=typeof _0x775c2f[_0xf779('0x1e')]===_0xf779('0x1f')&&typeof _0x775c2f[_0xf779('0x20')]==='undefined';var _0x1434a7=_0x4ce676[_0xf779('0x21')];var _0x2551b2=_0x27d4a6?0x0:_0x775c2f[_0xf779('0x1e')];var _0x304731=_0x27d4a6?_0x4ce676['count']:_0x775c2f[_0xf779('0x1e')]+_0x775c2f[_0xf779('0x20')];var _0x91bd50;if(_0x304731>=_0x1434a7){_0x304731=_0x1434a7;_0x91bd50=0xc8;}else{_0x91bd50=0xce;}_0x27a531['status'](_0x91bd50);return _0x27a531[_0xf779('0x22')](_0xf779('0x23'),_0x2551b2+'-'+_0x304731+'/'+_0x1434a7)['json'](_0x4ce676);}return null;};}function patchUpdates(_0x28dab3){return function(_0x32dfe6){try{jsonpatch[_0xf779('0x24')](_0x32dfe6,_0x28dab3,!![]);}catch(_0x40ac0d){return BPromise[_0xf779('0x25')](_0x40ac0d);}return _0x32dfe6[_0xf779('0x26')]();};}function saveUpdates(_0x16d431,_0x328409){return function(_0x2422be){if(_0x2422be){return _0x2422be['update'](_0x16d431)['then'](function(_0x487fbe){return _0x487fbe;});}return null;};}function removeEntity(_0x2ed97c,_0x183869){return function(_0x14b68c){if(_0x14b68c){return _0x14b68c['destroy']()['then'](function(){_0x2ed97c[_0xf779('0x1b')](0xcc)[_0xf779('0x1c')]();});}};}function handleEntityNotFound(_0x8ede91,_0x56b127){return function(_0x12cad3){if(!_0x12cad3){_0x8ede91[_0xf779('0x1a')](0x194);}return _0x12cad3;};}function handleError(_0x2b1287,_0x3834b1){_0x3834b1=_0x3834b1||0x1f4;return function(_0x3d4df8){logger[_0xf779('0x27')](_0x3d4df8[_0xf779('0x28')]);if(_0x3d4df8[_0xf779('0x29')]){delete _0x3d4df8[_0xf779('0x29')];}_0x2b1287[_0xf779('0x1b')](_0x3834b1)[_0xf779('0x2a')](_0x3d4df8);};}exports[_0xf779('0x2b')]=function(_0x5905a4,_0x4fa61c){var _0x1880c8={},_0xcedc={},_0x3771b3={'count':0x0,'rows':[]};var _0x2d3ecd=_['map'](db[_0xf779('0x2c')][_0xf779('0x2d')],function(_0x1a5b30){return{'name':_0x1a5b30[_0xf779('0x2e')],'type':_0x1a5b30['type'][_0xf779('0x2f')]};});_0xcedc[_0xf779('0x30')]=_[_0xf779('0x31')](_0x2d3ecd,_0xf779('0x29'));_0xcedc['query']=_[_0xf779('0x32')](_0x5905a4[_0xf779('0x33')]);_0xcedc[_0xf779('0x34')]=_['intersection'](_0xcedc[_0xf779('0x30')],_0xcedc[_0xf779('0x33')]);_0x1880c8[_0xf779('0x35')]=_[_0xf779('0x36')](_0xcedc[_0xf779('0x30')],qs[_0xf779('0x37')](_0x5905a4[_0xf779('0x33')][_0xf779('0x37')]));_0x1880c8['attributes']=_0x1880c8[_0xf779('0x35')]['length']?_0x1880c8[_0xf779('0x35')]:_0xcedc['model'];if(!_0x5905a4[_0xf779('0x33')][_0xf779('0x38')]('nolimit')){_0x1880c8['limit']=qs[_0xf779('0x20')](_0x5905a4[_0xf779('0x33')][_0xf779('0x20')]);_0x1880c8[_0xf779('0x1e')]=qs[_0xf779('0x1e')](_0x5905a4[_0xf779('0x33')][_0xf779('0x1e')]);}_0x1880c8['order']=qs['sort'](_0x5905a4[_0xf779('0x33')][_0xf779('0x39')]);_0x1880c8['where']=qs['filters'](_['pick'](_0x5905a4[_0xf779('0x33')],_0xcedc[_0xf779('0x34')]),_0x2d3ecd);if(_0x5905a4[_0xf779('0x33')][_0xf779('0x3a')]){_0x1880c8['where']=_[_0xf779('0x3b')](_0x1880c8[_0xf779('0x3c')],{'$or':_['map'](_0x2d3ecd,function(_0x4901d5){if(_0x4901d5[_0xf779('0x3d')]!==_0xf779('0x3e')){var _0x4abf23={};_0x4abf23[_0x4901d5[_0xf779('0x29')]]={'$like':'%'+_0x5905a4[_0xf779('0x33')][_0xf779('0x3a')]+'%'};return _0x4abf23;}})});}_0x1880c8=_[_0xf779('0x3b')]({},_0x1880c8,_0x5905a4[_0xf779('0x3f')]);var _0x2994ac={'where':_0x1880c8[_0xf779('0x3c')]};return db[_0xf779('0x2c')][_0xf779('0x21')](_0x2994ac)[_0xf779('0x40')](function(_0x51e809){_0x3771b3[_0xf779('0x21')]=_0x51e809;if(_0x5905a4[_0xf779('0x33')][_0xf779('0x41')]){_0x1880c8[_0xf779('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xf779('0x43')](_0x1880c8);})['then'](function(_0x224360){_0x3771b3[_0xf779('0x44')]=_0x224360;return _0x3771b3;})[_0xf779('0x40')](respondWithFilteredResult(_0x4fa61c,_0x1880c8))[_0xf779('0x45')](handleError(_0x4fa61c,null));};exports[_0xf779('0x46')]=function(_0x9e6b18,_0x108bfb){var _0x1fce34={'raw':!![],'where':{'id':_0x9e6b18[_0xf779('0x47')]['id']}},_0x10fe4f={};_0x10fe4f[_0xf779('0x30')]=_['keys'](db[_0xf779('0x2c')][_0xf779('0x2d')]);_0x10fe4f[_0xf779('0x33')]=_[_0xf779('0x32')](_0x9e6b18[_0xf779('0x33')]);_0x10fe4f[_0xf779('0x34')]=_['intersection'](_0x10fe4f[_0xf779('0x30')],_0x10fe4f[_0xf779('0x33')]);_0x1fce34[_0xf779('0x35')]=_[_0xf779('0x36')](_0x10fe4f['model'],qs['fields'](_0x9e6b18[_0xf779('0x33')]['fields']));_0x1fce34[_0xf779('0x35')]=_0x1fce34[_0xf779('0x35')][_0xf779('0x48')]?_0x1fce34[_0xf779('0x35')]:_0x10fe4f[_0xf779('0x30')];if(_0x9e6b18['query']['includeAll']){_0x1fce34[_0xf779('0x42')]=[{'all':!![]}];}_0x1fce34=_[_0xf779('0x3b')]({},_0x1fce34,_0x9e6b18[_0xf779('0x3f')]);return db[_0xf779('0x2c')][_0xf779('0x49')](_0x1fce34)[_0xf779('0x40')](handleEntityNotFound(_0x108bfb,null))[_0xf779('0x40')](respondWithResult(_0x108bfb,null))[_0xf779('0x45')](handleError(_0x108bfb,null));};exports[_0xf779('0x4a')]=function(_0x1455a5,_0xb2154){return db['SmsTransferReport'][_0xf779('0x4a')](_0x1455a5[_0xf779('0x4b')],{})[_0xf779('0x40')](respondWithResult(_0xb2154,0xc9))['catch'](handleError(_0xb2154,null));};exports['update']=function(_0x3d62fc,_0x153163){if(_0x3d62fc[_0xf779('0x4b')]['id']){delete _0x3d62fc[_0xf779('0x4b')]['id'];}return db[_0xf779('0x2c')][_0xf779('0x49')]({'where':{'id':_0x3d62fc[_0xf779('0x47')]['id']}})[_0xf779('0x40')](handleEntityNotFound(_0x153163,null))[_0xf779('0x40')](saveUpdates(_0x3d62fc[_0xf779('0x4b')],null))['then'](respondWithResult(_0x153163,null))[_0xf779('0x45')](handleError(_0x153163,null));};exports[_0xf779('0x4c')]=function(_0x8d46a9,_0x3c203b){return db[_0xf779('0x2c')][_0xf779('0x49')]({'where':{'id':_0x8d46a9[_0xf779('0x47')]['id']}})[_0xf779('0x40')](handleEntityNotFound(_0x3c203b,null))[_0xf779('0x40')](removeEntity(_0x3c203b,null))['catch'](handleError(_0x3c203b,null));};exports[_0xf779('0x4d')]=function(_0x58f80c,_0x18465e){return db['SmsTransferReport']['describe']()['then'](respondWithResult(_0x18465e,null))[_0xf779('0x45')](handleError(_0x18465e,null));}; \ No newline at end of file +var _0xa23d=['squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xa23d,0xc9));var _0xda23=function(_0x309681,_0x4a9d3c){_0x309681=_0x309681-0x0;var _0x2b503d=_0xa23d[_0x309681];return _0x2b503d;};'use strict';var emlformat=require(_0xda23('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda23('0x1'));var jsonpatch=require(_0xda23('0x2'));var rp=require(_0xda23('0x3'));var moment=require(_0xda23('0x4'));var BPromise=require(_0xda23('0x5'));var Mustache=require(_0xda23('0x6'));var util=require(_0xda23('0x7'));var path=require('path');var sox=require(_0xda23('0x8'));var csv=require(_0xda23('0x9'));var ejs=require(_0xda23('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda23('0xb'));var squel=require(_0xda23('0xc'));var crypto=require('crypto');var jsforce=require(_0xda23('0xd'));var deskjs=require(_0xda23('0xe'));var toCsv=require(_0xda23('0x9'));var querystring=require(_0xda23('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xda23('0x10'));var hardwareService=require(_0xda23('0x11'));var logger=require(_0xda23('0x12'))(_0xda23('0x13'));var utils=require(_0xda23('0x14'));var config=require(_0xda23('0x15'));var licenseUtil=require(_0xda23('0x16'));var db=require(_0xda23('0x17'))['db'];function respondWithStatusCode(_0xf2e503,_0x551b91){_0x551b91=_0x551b91||0xcc;return function(_0x443d83){if(_0x443d83){return _0xf2e503[_0xda23('0x18')](_0x551b91);}return _0xf2e503[_0xda23('0x19')](_0x551b91)[_0xda23('0x1a')]();};}function respondWithResult(_0x1ddf37,_0x877897){_0x877897=_0x877897||0xc8;return function(_0xd33f71){if(_0xd33f71){return _0x1ddf37[_0xda23('0x19')](_0x877897)[_0xda23('0x1b')](_0xd33f71);}};}function respondWithFilteredResult(_0x11d282,_0x322ced){return function(_0x4cff25){if(_0x4cff25){var _0x4fb297=typeof _0x322ced[_0xda23('0x1c')]===_0xda23('0x1d')&&typeof _0x322ced[_0xda23('0x1e')]===_0xda23('0x1d');var _0x46d936=_0x4cff25[_0xda23('0x1f')];var _0x664189=_0x4fb297?0x0:_0x322ced['offset'];var _0x33265=_0x4fb297?_0x4cff25[_0xda23('0x1f')]:_0x322ced[_0xda23('0x1c')]+_0x322ced[_0xda23('0x1e')];var _0x2746dc;if(_0x33265>=_0x46d936){_0x33265=_0x46d936;_0x2746dc=0xc8;}else{_0x2746dc=0xce;}_0x11d282['status'](_0x2746dc);return _0x11d282[_0xda23('0x20')]('Content-Range',_0x664189+'-'+_0x33265+'/'+_0x46d936)['json'](_0x4cff25);}return null;};}function patchUpdates(_0x172132){return function(_0x12532f){try{jsonpatch['apply'](_0x12532f,_0x172132,!![]);}catch(_0x56a3ad){return BPromise[_0xda23('0x21')](_0x56a3ad);}return _0x12532f['save']();};}function saveUpdates(_0x2d9af5,_0x1d967b){return function(_0x5c6f15){if(_0x5c6f15){return _0x5c6f15[_0xda23('0x22')](_0x2d9af5)[_0xda23('0x23')](function(_0x2b1b9d){return _0x2b1b9d;});}return null;};}function removeEntity(_0x54c47c,_0x309aa5){return function(_0x36c18a){if(_0x36c18a){return _0x36c18a[_0xda23('0x24')]()['then'](function(){_0x54c47c[_0xda23('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x348fcf,_0x267b2f){return function(_0x49d43b){if(!_0x49d43b){_0x348fcf[_0xda23('0x18')](0x194);}return _0x49d43b;};}function handleError(_0x207b4e,_0x59354c){_0x59354c=_0x59354c||0x1f4;return function(_0x54b0df){logger['error'](_0x54b0df[_0xda23('0x25')]);if(_0x54b0df[_0xda23('0x26')]){delete _0x54b0df['name'];}_0x207b4e[_0xda23('0x19')](_0x59354c)[_0xda23('0x27')](_0x54b0df);};}exports['index']=function(_0x72a62e,_0x4d4736){var _0x133f6c={},_0x3afbc7={},_0x431499={'count':0x0,'rows':[]};var _0x19addd=_[_0xda23('0x28')](db[_0xda23('0x29')][_0xda23('0x2a')],function(_0x536619){return{'name':_0x536619[_0xda23('0x2b')],'type':_0x536619[_0xda23('0x2c')][_0xda23('0x2d')]};});_0x3afbc7[_0xda23('0x2e')]=_[_0xda23('0x28')](_0x19addd,_0xda23('0x26'));_0x3afbc7[_0xda23('0x2f')]=_[_0xda23('0x30')](_0x72a62e[_0xda23('0x2f')]);_0x3afbc7[_0xda23('0x31')]=_[_0xda23('0x32')](_0x3afbc7[_0xda23('0x2e')],_0x3afbc7[_0xda23('0x2f')]);_0x133f6c[_0xda23('0x33')]=_[_0xda23('0x32')](_0x3afbc7[_0xda23('0x2e')],qs[_0xda23('0x34')](_0x72a62e[_0xda23('0x2f')][_0xda23('0x34')]));_0x133f6c[_0xda23('0x33')]=_0x133f6c[_0xda23('0x33')]['length']?_0x133f6c[_0xda23('0x33')]:_0x3afbc7[_0xda23('0x2e')];if(!_0x72a62e[_0xda23('0x2f')]['hasOwnProperty'](_0xda23('0x35'))){_0x133f6c['limit']=qs[_0xda23('0x1e')](_0x72a62e['query'][_0xda23('0x1e')]);_0x133f6c[_0xda23('0x1c')]=qs[_0xda23('0x1c')](_0x72a62e[_0xda23('0x2f')][_0xda23('0x1c')]);}_0x133f6c[_0xda23('0x36')]=qs['sort'](_0x72a62e[_0xda23('0x2f')][_0xda23('0x37')]);_0x133f6c['where']=qs[_0xda23('0x31')](_[_0xda23('0x38')](_0x72a62e[_0xda23('0x2f')],_0x3afbc7[_0xda23('0x31')]),_0x19addd);if(_0x72a62e[_0xda23('0x2f')]['filter']){_0x133f6c[_0xda23('0x39')]=_[_0xda23('0x3a')](_0x133f6c[_0xda23('0x39')],{'$or':_[_0xda23('0x28')](_0x19addd,function(_0x5b8938){if(_0x5b8938[_0xda23('0x2c')]!==_0xda23('0x3b')){var _0xcd1de7={};_0xcd1de7[_0x5b8938[_0xda23('0x26')]]={'$like':'%'+_0x72a62e['query']['filter']+'%'};return _0xcd1de7;}})});}_0x133f6c=_[_0xda23('0x3a')]({},_0x133f6c,_0x72a62e[_0xda23('0x3c')]);var _0x19c000={'where':_0x133f6c[_0xda23('0x39')]};return db[_0xda23('0x29')][_0xda23('0x1f')](_0x19c000)[_0xda23('0x23')](function(_0x59eabd){_0x431499[_0xda23('0x1f')]=_0x59eabd;if(_0x72a62e[_0xda23('0x2f')][_0xda23('0x3d')]){_0x133f6c['include']=[{'all':!![]}];}return db[_0xda23('0x29')][_0xda23('0x3e')](_0x133f6c);})[_0xda23('0x23')](function(_0x5d1f17){_0x431499['rows']=_0x5d1f17;return _0x431499;})[_0xda23('0x23')](respondWithFilteredResult(_0x4d4736,_0x133f6c))[_0xda23('0x3f')](handleError(_0x4d4736,null));};exports[_0xda23('0x40')]=function(_0x4d58e4,_0x21704d){var _0x359a34={'raw':!![],'where':{'id':_0x4d58e4[_0xda23('0x41')]['id']}},_0x66ab55={};_0x66ab55['model']=_['keys'](db['SmsTransferReport'][_0xda23('0x2a')]);_0x66ab55['query']=_['keys'](_0x4d58e4[_0xda23('0x2f')]);_0x66ab55['filters']=_['intersection'](_0x66ab55[_0xda23('0x2e')],_0x66ab55[_0xda23('0x2f')]);_0x359a34[_0xda23('0x33')]=_[_0xda23('0x32')](_0x66ab55[_0xda23('0x2e')],qs[_0xda23('0x34')](_0x4d58e4['query'][_0xda23('0x34')]));_0x359a34[_0xda23('0x33')]=_0x359a34[_0xda23('0x33')][_0xda23('0x42')]?_0x359a34[_0xda23('0x33')]:_0x66ab55[_0xda23('0x2e')];if(_0x4d58e4[_0xda23('0x2f')][_0xda23('0x3d')]){_0x359a34[_0xda23('0x43')]=[{'all':!![]}];}_0x359a34=_[_0xda23('0x3a')]({},_0x359a34,_0x4d58e4[_0xda23('0x3c')]);return db[_0xda23('0x29')]['find'](_0x359a34)['then'](handleEntityNotFound(_0x21704d,null))['then'](respondWithResult(_0x21704d,null))['catch'](handleError(_0x21704d,null));};exports['create']=function(_0x37f4fd,_0x220506){return db['SmsTransferReport'][_0xda23('0x44')](_0x37f4fd[_0xda23('0x45')],{})['then'](respondWithResult(_0x220506,0xc9))[_0xda23('0x3f')](handleError(_0x220506,null));};exports[_0xda23('0x22')]=function(_0x32240a,_0x56b1d7){if(_0x32240a[_0xda23('0x45')]['id']){delete _0x32240a['body']['id'];}return db[_0xda23('0x29')]['find']({'where':{'id':_0x32240a[_0xda23('0x41')]['id']}})[_0xda23('0x23')](handleEntityNotFound(_0x56b1d7,null))[_0xda23('0x23')](saveUpdates(_0x32240a[_0xda23('0x45')],null))[_0xda23('0x23')](respondWithResult(_0x56b1d7,null))['catch'](handleError(_0x56b1d7,null));};exports[_0xda23('0x24')]=function(_0x20f055,_0x3ec342){return db[_0xda23('0x29')]['find']({'where':{'id':_0x20f055['params']['id']}})['then'](handleEntityNotFound(_0x3ec342,null))[_0xda23('0x23')](removeEntity(_0x3ec342,null))[_0xda23('0x3f')](handleError(_0x3ec342,null));};exports[_0xda23('0x46')]=function(_0x227251,_0x599016){return db[_0xda23('0x29')][_0xda23('0x46')]()[_0xda23('0x23')](respondWithResult(_0x599016,null))[_0xda23('0x3f')](handleError(_0x599016,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index dc8da9b..e45c195 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39a9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x39a9,0x1d0));var _0x939a=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x39a9[_0x3ff4a3];return _0x38676f;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var logger=require(_0x939a('0x2'))(_0x939a('0x3'));var moment=require(_0x939a('0x4'));var BPromise=require(_0x939a('0x5'));var rp=require(_0x939a('0x6'));var fs=require('fs');var path=require(_0x939a('0x7'));var rimraf=require(_0x939a('0x8'));var config=require(_0x939a('0x9'));var attributes=require(_0x939a('0xa'));module['exports']=function(_0x5793fe,_0xed3974){return _0x5793fe[_0x939a('0xb')](_0x939a('0xc'),attributes,{'tableName':_0x939a('0xd'),'paranoid':![],'indexes':[{'name':_0x939a('0xe'),'fields':[_0x939a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x80d9=['request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x20073b,_0x9c031e){var _0x428d14=function(_0x1c6d8b){while(--_0x1c6d8b){_0x20073b['push'](_0x20073b['shift']());}};_0x428d14(++_0x9c031e);}(_0x80d9,0x15c));var _0x980d=function(_0x4ea4e0,_0x301221){_0x4ea4e0=_0x4ea4e0-0x0;var _0x387921=_0x80d9[_0x4ea4e0];return _0x387921;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('SmsTransferReport',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[{'name':_0x980d('0xa'),'fields':[_0x980d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 939f9d5..38a0906 100644 --- a/server/api/smsTransferReport/smsTransferReport.rpc.js +++ b/server/api/smsTransferReport/smsTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x5d55,0x1a4));var _0x55d5=function(_0x38a73c,_0x2134c7){_0x38a73c=_0x38a73c-0x0;var _0x563a57=_0x5d55[_0x38a73c];return _0x563a57;};'use strict';var _=require('lodash');var util=require(_0x55d5('0x0'));var moment=require('moment');var BPromise=require(_0x55d5('0x1'));var rs=require(_0x55d5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x55d5('0x3'))['db'];var utils=require(_0x55d5('0x4'));var logger=require(_0x55d5('0x5'))('rpc');var config=require(_0x55d5('0x6'));var jayson=require(_0x55d5('0x7'));var client=jayson[_0x55d5('0x8')][_0x55d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16d364,_0x2f854a,_0x454144){return new BPromise(function(_0x3937d3,_0x20a6d7){return client['request'](_0x16d364,_0x454144)[_0x55d5('0xa')](function(_0x217d99){logger[_0x55d5('0xb')](_0x55d5('0xc'),_0x2f854a,_0x55d5('0xd'));logger['debug'](_0x55d5('0xe'),_0x2f854a,'request\x20sent',JSON[_0x55d5('0xf')](_0x217d99));if(_0x217d99[_0x55d5('0x10')]){if(_0x217d99[_0x55d5('0x10')][_0x55d5('0x11')]===0x1f4){logger[_0x55d5('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x2f854a,_0x217d99[_0x55d5('0x10')][_0x55d5('0x12')]);return _0x20a6d7(_0x217d99[_0x55d5('0x10')]['message']);}logger[_0x55d5('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x2f854a,_0x217d99[_0x55d5('0x10')][_0x55d5('0x12')]);return _0x3937d3(_0x217d99[_0x55d5('0x10')][_0x55d5('0x12')]);}else{logger['info'](_0x55d5('0xc'),_0x2f854a,_0x55d5('0xd'));_0x3937d3(_0x217d99[_0x55d5('0x13')]['message']);}})[_0x55d5('0x14')](function(_0x5d45e2){logger[_0x55d5('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x2f854a,_0x5d45e2);_0x20a6d7(_0x5d45e2);});});} \ No newline at end of file +var _0xef8b=['error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3599af,_0x299d94){var _0x5e6a76=function(_0x4e2e74){while(--_0x4e2e74){_0x3599af['push'](_0x3599af['shift']());}};_0x5e6a76(++_0x299d94);}(_0xef8b,0x192));var _0xbef8=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0xef8b[_0x19e928];return _0x4e941f;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var moment=require(_0xbef8('0x1'));var BPromise=require(_0xbef8('0x2'));var rs=require(_0xbef8('0x3'));var fs=require('fs');var Redis=require(_0xbef8('0x4'));var db=require(_0xbef8('0x5'))['db'];var utils=require(_0xbef8('0x6'));var logger=require(_0xbef8('0x7'))(_0xbef8('0x8'));var config=require(_0xbef8('0x9'));var jayson=require(_0xbef8('0xa'));var client=jayson['client'][_0xbef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359be9,_0x26b756,_0x5d2773){return new BPromise(function(_0x22d84e,_0x1a6d83){return client['request'](_0x359be9,_0x5d2773)['then'](function(_0x48addc){logger[_0xbef8('0xc')](_0xbef8('0xd'),_0x26b756,_0xbef8('0xe'));logger[_0xbef8('0xf')](_0xbef8('0x10'),_0x26b756,_0xbef8('0xe'),JSON[_0xbef8('0x11')](_0x48addc));if(_0x48addc[_0xbef8('0x12')]){if(_0x48addc[_0xbef8('0x12')]['code']===0x1f4){logger[_0xbef8('0x12')](_0xbef8('0xd'),_0x26b756,_0x48addc[_0xbef8('0x12')]['message']);return _0x1a6d83(_0x48addc['error']['message']);}logger[_0xbef8('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x26b756,_0x48addc[_0xbef8('0x12')][_0xbef8('0x13')]);return _0x22d84e(_0x48addc['error'][_0xbef8('0x13')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x26b756,_0xbef8('0xe'));_0x22d84e(_0x48addc['result']['message']);}})[_0xbef8('0x14')](function(_0x1e8060){logger[_0xbef8('0x12')](_0xbef8('0xd'),_0x26b756,_0x1e8060);_0x1a6d83(_0x1e8060);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 8bdd277..1830268 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f1d=['join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','extname','now','originalname','post','single','file','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage'];(function(_0x33a6bd,_0x564362){var _0x339aff=function(_0xfa38d1){while(--_0xfa38d1){_0x33a6bd['push'](_0x33a6bd['shift']());}};_0x339aff(++_0x564362);}(_0x7f1d,0x119));var _0xd7f1=function(_0x51733c,_0x448082){_0x51733c=_0x51733c-0x0;var _0x5f50f9=_0x7f1d[_0x51733c];return _0x5f50f9;};'use strict';var multer=require('multer');var util=require(_0xd7f1('0x0'));var path=require(_0xd7f1('0x1'));var timeout=require(_0xd7f1('0x2'));var express=require('express');var router=express[_0xd7f1('0x3')]();var fs_extra=require(_0xd7f1('0x4'));var auth=require(_0xd7f1('0x5'));var interaction=require(_0xd7f1('0x6'));var config=require(_0xd7f1('0x7'));var controller=require(_0xd7f1('0x8'));router[_0xd7f1('0x9')]('/',auth[_0xd7f1('0xa')](),controller[_0xd7f1('0xb')]);router['get'](_0xd7f1('0xc'),auth['isAuthenticated'](),controller[_0xd7f1('0xd')]);router[_0xd7f1('0x9')](_0xd7f1('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xd7f1('0xf')]({'destination':function(_0x28b32e,_0x48b9a6,_0x130387){_0x130387(null,path[_0xd7f1('0x10')](config[_0xd7f1('0x11')],_0xd7f1('0x12')));},'filename':function(_0x303b0c,_0x54cd80,_0x56ba0f){_0x54cd80['originalname']=_0x54cd80['originalname'][_0xd7f1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56ba0f(null,util[_0xd7f1('0x14')](_0xd7f1('0x15'),path[_0xd7f1('0x16')](_0x54cd80['originalname'],path[_0xd7f1('0x17')](_0x54cd80['originalname'])),Date[_0xd7f1('0x18')](),path[_0xd7f1('0x17')](_0x54cd80[_0xd7f1('0x19')])));}})});router[_0xd7f1('0x1a')]('/',upload[_0xd7f1('0x1b')](_0xd7f1('0x1c')),controller['create']);router[_0xd7f1('0x1d')](_0xd7f1('0xc'),auth[_0xd7f1('0xa')](),controller[_0xd7f1('0x1e')]);router[_0xd7f1('0x1f')]('/:id',auth[_0xd7f1('0xa')](),controller[_0xd7f1('0x1f')]);module[_0xd7f1('0x20')]=router; \ No newline at end of file +var _0x713c=['download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x713c,0xd8));var _0xc713=function(_0x39c7df,_0x1ca465){_0x39c7df=_0x39c7df-0x0;var _0x21445a=_0x713c[_0x39c7df];return _0x21445a;};'use strict';var multer=require(_0xc713('0x0'));var util=require(_0xc713('0x1'));var path=require(_0xc713('0x2'));var timeout=require(_0xc713('0x3'));var express=require('express');var router=express[_0xc713('0x4')]();var fs_extra=require(_0xc713('0x5'));var auth=require(_0xc713('0x6'));var interaction=require(_0xc713('0x7'));var config=require(_0xc713('0x8'));var controller=require('./sound.controller');router[_0xc713('0x9')]('/',auth[_0xc713('0xa')](),controller[_0xc713('0xb')]);router['get'](_0xc713('0xc'),auth[_0xc713('0xa')](),controller[_0xc713('0xd')]);router['get'](_0xc713('0xe'),auth[_0xc713('0xa')](),controller[_0xc713('0xf')]);var upload=multer({'storage':multer[_0xc713('0x10')]({'destination':function(_0xafd43e,_0x527526,_0x72c01){_0x72c01(null,path[_0xc713('0x11')](config['root'],_0xc713('0x12')));},'filename':function(_0x28df42,_0x274511,_0xf3117e){_0x274511['originalname']=_0x274511[_0xc713('0x13')][_0xc713('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf3117e(null,util[_0xc713('0x15')](_0xc713('0x16'),path[_0xc713('0x17')](_0x274511['originalname'],path[_0xc713('0x18')](_0x274511[_0xc713('0x13')])),Date['now'](),path[_0xc713('0x18')](_0x274511[_0xc713('0x13')])));}})});router[_0xc713('0x19')]('/',upload[_0xc713('0x1a')](_0xc713('0x1b')),controller[_0xc713('0x1c')]);router[_0xc713('0x1d')](_0xc713('0xc'),auth[_0xc713('0xa')](),controller[_0xc713('0x1e')]);router[_0xc713('0x1f')](_0xc713('0xc'),auth['isAuthenticated'](),controller[_0xc713('0x1f')]);module[_0xc713('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3f84e72..f7c71c9 100644 --- a/server/api/sound/sound.attributes.js +++ b/server/api/sound/sound.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1288=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x4c722c,_0x53db4b){var _0x59d533=function(_0x446ab8){while(--_0x446ab8){_0x4c722c['push'](_0x4c722c['shift']());}};_0x59d533(++_0x53db4b);}(_0x1288,0x14c));var _0x8128=function(_0x49aab7,_0x1d6397){_0x49aab7=_0x49aab7-0x0;var _0x587b6f=_0x1288[_0x49aab7];return _0x587b6f;};'use strict';var Sequelize=require(_0x8128('0x0'));module['exports']={'name':{'type':Sequelize[_0x8128('0x1')],'unique':_0x8128('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8128('0x1')]},'display_name':{'type':Sequelize[_0x8128('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x8128('0x1')]},'original_format':{'type':Sequelize[_0x8128('0x1')]},'original_duration':{'type':Sequelize[_0x8128('0x3')]},'original_sampleCount':{'type':Sequelize[_0x8128('0x4')]},'original_channelCount':{'type':Sequelize[_0x8128('0x5')]},'original_bitRate':{'type':Sequelize[_0x8128('0x4')]},'original_sampleRate':{'type':Sequelize[_0x8128('0x5')]},'converted_format':{'type':Sequelize[_0x8128('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x8128('0x4')]},'converted_channelCount':{'type':Sequelize[_0x8128('0x5')]},'converted_bitRate':{'type':Sequelize[_0x8128('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x8128('0x5')]}}; \ No newline at end of file +var _0x9558=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x9558,0x181));var _0x8955=function(_0x152999,_0x1dd83b){_0x152999=_0x152999-0x0;var _0x32ef67=_0x9558[_0x152999];return _0x32ef67;};'use strict';var Sequelize=require(_0x8955('0x0'));module[_0x8955('0x1')]={'name':{'type':Sequelize[_0x8955('0x2')],'unique':_0x8955('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8955('0x2')]},'display_name':{'type':Sequelize[_0x8955('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x8955('0x2')]},'original_duration':{'type':Sequelize[_0x8955('0x4')]},'original_sampleCount':{'type':Sequelize[_0x8955('0x5')]},'original_channelCount':{'type':Sequelize[_0x8955('0x6')]},'original_bitRate':{'type':Sequelize[_0x8955('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x8955('0x5')]},'converted_channelCount':{'type':Sequelize[_0x8955('0x6')]},'converted_bitRate':{'type':Sequelize[_0x8955('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x8955('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 21e218b..ec2a5f0 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4aa=['catch','show','params','options','find','download','save_name','converted_format','existsSync','root','Sequelize','ValidationError','Sound\x20not\x20found','join','server/files/sounds/converted','%s.%s','format','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','offset','count','Content-Range','save','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows'];(function(_0x148eef,_0x31c55c){var _0x35094e=function(_0x10d7c4){while(--_0x10d7c4){_0x148eef['push'](_0x148eef['shift']());}};_0x35094e(++_0x31c55c);}(_0xe4aa,0x121));var _0xae4a=function(_0x1f4713,_0x3e77f1){_0x1f4713=_0x1f4713-0x0;var _0x5f4f1d=_0xe4aa[_0x1f4713];return _0x5f4f1d;};'use strict';var emlformat=require(_0xae4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xae4a('0x1'));var rp=require(_0xae4a('0x2'));var moment=require('moment');var BPromise=require(_0xae4a('0x3'));var Mustache=require('mustache');var util=require(_0xae4a('0x4'));var path=require(_0xae4a('0x5'));var sox=require(_0xae4a('0x6'));var csv=require(_0xae4a('0x7'));var ejs=require(_0xae4a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae4a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae4a('0xa'));var deskjs=require(_0xae4a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xae4a('0xc'));var Papa=require(_0xae4a('0xd'));var Redis=require(_0xae4a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xae4a('0xf'));var hardwareService=require(_0xae4a('0x10'));var logger=require('../../config/logger')(_0xae4a('0x11'));var utils=require(_0xae4a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xae4a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284c5f,_0xd560cd){_0xd560cd=_0xd560cd||0xcc;return function(_0x5ad4ac){if(_0x5ad4ac){return _0x284c5f['sendStatus'](_0xd560cd);}return _0x284c5f[_0xae4a('0x14')](_0xd560cd)[_0xae4a('0x15')]();};}function respondWithResult(_0x540409,_0x42e388){_0x42e388=_0x42e388||0xc8;return function(_0x2a1413){if(_0x2a1413){return _0x540409[_0xae4a('0x14')](_0x42e388)[_0xae4a('0x16')](_0x2a1413);}};}function respondWithFilteredResult(_0x556fcf,_0x11a136){return function(_0xc80521){if(_0xc80521){var _0x7aa03b=typeof _0x11a136['offset']===_0xae4a('0x17')&&typeof _0x11a136[_0xae4a('0x18')]===_0xae4a('0x17');var _0x35099c=_0xc80521['count'];var _0xb8df12=_0x7aa03b?0x0:_0x11a136[_0xae4a('0x19')];var _0x4a073e=_0x7aa03b?_0xc80521[_0xae4a('0x1a')]:_0x11a136['offset']+_0x11a136['limit'];var _0x56562b;if(_0x4a073e>=_0x35099c){_0x4a073e=_0x35099c;_0x56562b=0xc8;}else{_0x56562b=0xce;}_0x556fcf[_0xae4a('0x14')](_0x56562b);return _0x556fcf['set'](_0xae4a('0x1b'),_0xb8df12+'-'+_0x4a073e+'/'+_0x35099c)['json'](_0xc80521);}return null;};}function patchUpdates(_0x5371d8){return function(_0x42384e){try{jsonpatch['apply'](_0x42384e,_0x5371d8,!![]);}catch(_0x2d9271){return BPromise['reject'](_0x2d9271);}return _0x42384e[_0xae4a('0x1c')]();};}function saveUpdates(_0x2f3381,_0x5f4539){return function(_0x3a51a3){if(_0x3a51a3){return _0x3a51a3[_0xae4a('0x1d')](_0x2f3381)[_0xae4a('0x1e')](function(_0x47ce3f){return _0x47ce3f;});}return null;};}function removeEntity(_0x427479,_0x6c523a){return function(_0x1ca948){if(_0x1ca948){return _0x1ca948[_0xae4a('0x1f')]()['then'](function(){var _0x3599eb=_0x1ca948[_0xae4a('0x20')]({'plain':!![]});var _0x260445=_0xae4a('0x21');return db[_0xae4a('0x22')][_0xae4a('0x1f')]({'where':{'type':_0x260445,'resourceId':_0x3599eb['id']}})[_0xae4a('0x1e')](function(){return _0x1ca948;});})[_0xae4a('0x1e')](function(){_0x427479[_0xae4a('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20c667,_0x475384){return function(_0x4b2e87){if(!_0x4b2e87){_0x20c667['sendStatus'](0x194);}return _0x4b2e87;};}function handleError(_0x1824cd,_0xbdc332){_0xbdc332=_0xbdc332||0x1f4;return function(_0x30c2c6){logger[_0xae4a('0x23')](_0x30c2c6[_0xae4a('0x24')]);if(_0x30c2c6[_0xae4a('0x25')]){delete _0x30c2c6['name'];}_0x1824cd['status'](_0xbdc332)[_0xae4a('0x26')](_0x30c2c6);};}exports[_0xae4a('0x27')]=function(_0x54c2f8,_0x466552){var _0x1851e5={},_0x4a1233={},_0x476cb6={'count':0x0,'rows':[]};var _0x9e7d57=_[_0xae4a('0x28')](db[_0xae4a('0x29')][_0xae4a('0x2a')],function(_0x15ae43){return{'name':_0x15ae43['fieldName'],'type':_0x15ae43[_0xae4a('0x2b')][_0xae4a('0x2c')]};});_0x4a1233[_0xae4a('0x2d')]=_[_0xae4a('0x28')](_0x9e7d57,'name');_0x4a1233[_0xae4a('0x2e')]=_[_0xae4a('0x2f')](_0x54c2f8[_0xae4a('0x2e')]);_0x4a1233[_0xae4a('0x30')]=_[_0xae4a('0x31')](_0x4a1233[_0xae4a('0x2d')],_0x4a1233[_0xae4a('0x2e')]);_0x1851e5[_0xae4a('0x32')]=_[_0xae4a('0x31')](_0x4a1233[_0xae4a('0x2d')],qs['fields'](_0x54c2f8['query'][_0xae4a('0x33')]));_0x1851e5[_0xae4a('0x32')]=_0x1851e5['attributes'][_0xae4a('0x34')]?_0x1851e5['attributes']:_0x4a1233['model'];if(!_0x54c2f8[_0xae4a('0x2e')][_0xae4a('0x35')](_0xae4a('0x36'))){_0x1851e5['limit']=qs[_0xae4a('0x18')](_0x54c2f8[_0xae4a('0x2e')][_0xae4a('0x18')]);_0x1851e5[_0xae4a('0x19')]=qs[_0xae4a('0x19')](_0x54c2f8[_0xae4a('0x2e')][_0xae4a('0x19')]);}_0x1851e5[_0xae4a('0x37')]=qs[_0xae4a('0x38')](_0x54c2f8[_0xae4a('0x2e')][_0xae4a('0x38')]);_0x1851e5[_0xae4a('0x39')]=qs['filters'](_[_0xae4a('0x3a')](_0x54c2f8['query'],_0x4a1233[_0xae4a('0x30')]),_0x9e7d57);if(_0x54c2f8[_0xae4a('0x2e')][_0xae4a('0x3b')]){_0x1851e5[_0xae4a('0x39')]=_[_0xae4a('0x3c')](_0x1851e5[_0xae4a('0x39')],{'$or':_[_0xae4a('0x28')](_0x9e7d57,function(_0x2cdde5){if(_0x2cdde5[_0xae4a('0x2b')]!==_0xae4a('0x3d')){var _0x5bbd13={};_0x5bbd13[_0x2cdde5['name']]={'$like':'%'+_0x54c2f8[_0xae4a('0x2e')][_0xae4a('0x3b')]+'%'};return _0x5bbd13;}})});}_0x1851e5=_[_0xae4a('0x3c')]({},_0x1851e5,_0x54c2f8['options']);var _0x57a28f={'where':_0x1851e5['where']};return db[_0xae4a('0x29')][_0xae4a('0x1a')](_0x57a28f)[_0xae4a('0x1e')](function(_0x2aee79){_0x476cb6[_0xae4a('0x1a')]=_0x2aee79;if(_0x54c2f8[_0xae4a('0x2e')][_0xae4a('0x3e')]){_0x1851e5[_0xae4a('0x3f')]=[{'all':!![]}];}return db[_0xae4a('0x29')]['findAll'](_0x1851e5);})['then'](function(_0x410293){_0x476cb6[_0xae4a('0x40')]=_0x410293;return _0x476cb6;})['then'](respondWithFilteredResult(_0x466552,_0x1851e5))[_0xae4a('0x41')](handleError(_0x466552,null));};exports[_0xae4a('0x42')]=function(_0x22ada1,_0x3c32d3){var _0x49df5e={'raw':!![],'where':{'id':_0x22ada1[_0xae4a('0x43')]['id']}},_0xeaad3c={};_0xeaad3c[_0xae4a('0x2d')]=_[_0xae4a('0x2f')](db[_0xae4a('0x29')][_0xae4a('0x2a')]);_0xeaad3c[_0xae4a('0x2e')]=_[_0xae4a('0x2f')](_0x22ada1[_0xae4a('0x2e')]);_0xeaad3c[_0xae4a('0x30')]=_[_0xae4a('0x31')](_0xeaad3c[_0xae4a('0x2d')],_0xeaad3c[_0xae4a('0x2e')]);_0x49df5e[_0xae4a('0x32')]=_[_0xae4a('0x31')](_0xeaad3c[_0xae4a('0x2d')],qs[_0xae4a('0x33')](_0x22ada1[_0xae4a('0x2e')][_0xae4a('0x33')]));_0x49df5e[_0xae4a('0x32')]=_0x49df5e[_0xae4a('0x32')]['length']?_0x49df5e[_0xae4a('0x32')]:_0xeaad3c[_0xae4a('0x2d')];if(_0x22ada1[_0xae4a('0x2e')][_0xae4a('0x3e')]){_0x49df5e['include']=[{'all':!![]}];}_0x49df5e=_[_0xae4a('0x3c')]({},_0x49df5e,_0x22ada1[_0xae4a('0x44')]);return db[_0xae4a('0x29')][_0xae4a('0x45')](_0x49df5e)[_0xae4a('0x1e')](handleEntityNotFound(_0x3c32d3,null))[_0xae4a('0x1e')](respondWithResult(_0x3c32d3,null))[_0xae4a('0x41')](handleError(_0x3c32d3,null));};exports[_0xae4a('0x46')]=function(_0x546256,_0x355f86,_0x39ff52){return db[_0xae4a('0x29')][_0xae4a('0x45')]({'where':{'id':_0x546256[_0xae4a('0x43')]['id']},'attributes':[_0xae4a('0x25'),_0xae4a('0x47'),_0xae4a('0x48')],'raw':!![]})[_0xae4a('0x1e')](handleEntityNotFound(_0x355f86,null))[_0xae4a('0x1e')](function(_0x815404){if(_0x815404){if(!fs[_0xae4a('0x49')](path['join'](config[_0xae4a('0x4a')],'server/files/sounds/converted',_0x815404[_0xae4a('0x47')]+'.'+_0x815404[_0xae4a('0x48')]))){throw new db[(_0xae4a('0x4b'))][(_0xae4a('0x4c'))](_0xae4a('0x4d'));}return _0x355f86['download'](path[_0xae4a('0x4e')](config[_0xae4a('0x4a')],_0xae4a('0x4f'),util['format'](_0xae4a('0x50'),_0x815404[_0xae4a('0x47')],_0x815404['converted_format'])),util[_0xae4a('0x51')](_0xae4a('0x50'),_0x815404[_0xae4a('0x25')],_0x815404[_0xae4a('0x48')]));}return null;})[_0xae4a('0x41')](handleError(_0x355f86,null));};exports[_0xae4a('0x52')]=function(_0x4a8f2b,_0x3c7ba3,_0x199437){var _0x166e92={'name':path[_0xae4a('0x53')](_0x4a8f2b[_0xae4a('0x54')][_0xae4a('0x55')],path[_0xae4a('0x56')](_0x4a8f2b[_0xae4a('0x54')][_0xae4a('0x55')])),'save_name':path['basename'](_0x4a8f2b[_0xae4a('0x54')][_0xae4a('0x57')],path['extname'](_0x4a8f2b[_0xae4a('0x54')][_0xae4a('0x57')])),'original_format':path['extname'](_0x4a8f2b['file'][_0xae4a('0x55')])['substring'](0x1),'converted_format':_0xae4a('0x58')};var _0x5abf5a=path[_0xae4a('0x4e')](config[_0xae4a('0x4a')],_0xae4a('0x59'),_0x4a8f2b['file'][_0xae4a('0x57')]);var _0x277024=path[_0xae4a('0x4e')](config['root'],_0xae4a('0x4f'),util[_0xae4a('0x51')](_0xae4a('0x50'),path[_0xae4a('0x53')](_0x4a8f2b[_0xae4a('0x54')]['filename'],path[_0xae4a('0x56')](_0x4a8f2b['file']['filename'])),_0x166e92['converted_format']));logger[_0xae4a('0x5a')](_0xae4a('0x5b'),_0x5abf5a);logger[_0xae4a('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x277024);try{fs[_0xae4a('0x5c')](_0x5abf5a,parseInt(_0xae4a('0x5d'),0x8));var _0x2d218e=sox[_0xae4a('0x5e')](_0x5abf5a,_0x277024,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2d218e['on'](_0xae4a('0x23'),function(_0x28892e){fs[_0xae4a('0x5f')](_0x5abf5a);_0x3c7ba3[_0xae4a('0x14')](0x1f4)[_0xae4a('0x26')](_0x28892e);});_0x2d218e['on']('src',function(_0x1c73bc){_0x166e92['original_duration']=isNaN(_0x1c73bc['duration'])?null:_0x1c73bc[_0xae4a('0x60')]*0x3e8;_0x166e92[_0xae4a('0x61')]=isNaN(_0x1c73bc[_0xae4a('0x62')])?null:_0x1c73bc[_0xae4a('0x62')];_0x166e92[_0xae4a('0x63')]=isNaN(_0x1c73bc[_0xae4a('0x64')])?null:_0x1c73bc['channelCount'];_0x166e92[_0xae4a('0x65')]=isNaN(_0x1c73bc[_0xae4a('0x66')])?null:_0x1c73bc[_0xae4a('0x66')];_0x166e92[_0xae4a('0x67')]=isNaN(_0x1c73bc[_0xae4a('0x68')])?null:_0x1c73bc['sampleRate'];});_0x2d218e['on'](_0xae4a('0x69'),function(_0x469584){_0x166e92[_0xae4a('0x6a')]=isNaN(_0x469584[_0xae4a('0x60')])?null:_0x469584[_0xae4a('0x60')]*0x3e8;_0x166e92['converted_sampleCount']=isNaN(_0x469584[_0xae4a('0x62')])?null:_0x469584[_0xae4a('0x62')];_0x166e92[_0xae4a('0x6b')]=isNaN(_0x469584['channelCount'])?null:_0x469584[_0xae4a('0x64')];_0x166e92['converted_bitRate']=isNaN(_0x469584[_0xae4a('0x66')])?null:_0x469584[_0xae4a('0x66')];_0x166e92[_0xae4a('0x6c')]=isNaN(_0x469584[_0xae4a('0x68')])?null:_0x469584[_0xae4a('0x68')];});_0x2d218e['on'](_0xae4a('0x15'),function(){fs['chmodSync'](_0x277024,parseInt(_0xae4a('0x5d'),0x8));return db[_0xae4a('0x29')][_0xae4a('0x52')](_0x166e92)[_0xae4a('0x1e')](function(_0x565fef){var _0x50d1e7={'role':_0x4a8f2b[_0xae4a('0x6d')][_0xae4a('0x6e')],'userProfileId':_0x4a8f2b['body'][_0xae4a('0x6f')]};if(!_0x50d1e7)throw new Error(_0xae4a('0x70'));if(_0x50d1e7[_0xae4a('0x6e')]===_0xae4a('0x71')){var _0x3d09b2=_0x565fef[_0xae4a('0x20')]({'plain':!![]});return db['UserProfileSection'][_0xae4a('0x45')]({'where':{'name':_0xae4a('0x21'),'userProfileId':_0x50d1e7[_0xae4a('0x6f')]},'raw':!![]})[_0xae4a('0x1e')](function(_0x2aabf9){if(_0x2aabf9&&_0x2aabf9[_0xae4a('0x72')]===0x0){return db['UserProfileResource'][_0xae4a('0x52')]({'name':_0x3d09b2[_0xae4a('0x25')],'resourceId':_0x3d09b2['id'],'type':_0x2aabf9[_0xae4a('0x25')],'sectionId':_0x2aabf9['id']},{})[_0xae4a('0x1e')](function(){return _0x565fef;});}else{return _0x565fef;}})[_0xae4a('0x41')](function(_0x107de5){logger[_0xae4a('0x23')](_0xae4a('0x73'),_0x107de5);throw _0x107de5;});}return _0x565fef;})[_0xae4a('0x1e')](respondWithResult(_0x3c7ba3,null))[_0xae4a('0x41')](handleError(_0x3c7ba3,null));});_0x2d218e['start']();}catch(_0x189290){_0x3c7ba3[_0xae4a('0x14')](0x1f4)[_0xae4a('0x26')](_0x189290);}};exports[_0xae4a('0x1d')]=function(_0x272832,_0x1869af,_0x1b3ec2){return db[_0xae4a('0x29')][_0xae4a('0x45')]({'where':{'id':_0x272832[_0xae4a('0x43')]['id']}})[_0xae4a('0x1e')](handleEntityNotFound(_0x1869af,null))['then'](saveUpdates(_[_0xae4a('0x3a')](_0x272832[_0xae4a('0x6d')],[_0xae4a('0x25'),'description']),null))[_0xae4a('0x1e')](respondWithResult(_0x1869af,null))[_0xae4a('0x41')](handleError(_0x1869af,null));};exports[_0xae4a('0x74')]=function(_0x14f4ab,_0xdc32b8,_0x5be6d5){return db['Sound'][_0xae4a('0x45')]({'where':{'id':_0x14f4ab[_0xae4a('0x43')]['id']}})[_0xae4a('0x1e')](function(_0x32e5e3){if(_0x32e5e3){return _0x32e5e3[_0xae4a('0x1f')]();}})['then'](function(_0xdca66d){var _0x447402=path[_0xae4a('0x4e')](config[_0xae4a('0x4a')],_0xae4a('0x59'),util[_0xae4a('0x51')]('%s.%s',_0xdca66d[_0xae4a('0x47')],_0xdca66d[_0xae4a('0x75')]));var _0x4813a1=path[_0xae4a('0x4e')](config[_0xae4a('0x4a')],_0xae4a('0x4f'),util[_0xae4a('0x51')](_0xae4a('0x50'),_0xdca66d[_0xae4a('0x47')],_0xdca66d[_0xae4a('0x48')]));fs[_0xae4a('0x5f')](_0x447402);fs[_0xae4a('0x5f')](_0x4813a1);return _0xdca66d;})['then'](function(_0x123837){if(_0x123837){return _0xdc32b8[_0xae4a('0x14')](0xcc)[_0xae4a('0x15')]();}})[_0xae4a('0x1e')](handleEntityNotFound(_0xdc32b8,null))[_0xae4a('0x41')](handleError(_0xdc32b8,null));}; \ No newline at end of file +var _0xc7bf=['converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','unlinkSync','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','filter','options','where','includeAll','include','Sound','findAll','catch','show','length','find','download','params','save_name','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','basename','file','filename','extname','originalname','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','wav','error','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest'];(function(_0x46a688,_0x16b598){var _0x1555ed=function(_0x3e6d50){while(--_0x3e6d50){_0x46a688['push'](_0x46a688['shift']());}};_0x1555ed(++_0x16b598);}(_0xc7bf,0x110));var _0xfc7b=function(_0x183ca8,_0x1c302b){_0x183ca8=_0x183ca8-0x0;var _0x4b7f87=_0xc7bf[_0x183ca8];return _0x4b7f87;};'use strict';var emlformat=require(_0xfc7b('0x0'));var rimraf=require(_0xfc7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc7b('0x2'));var moment=require('moment');var BPromise=require(_0xfc7b('0x3'));var Mustache=require(_0xfc7b('0x4'));var util=require(_0xfc7b('0x5'));var path=require(_0xfc7b('0x6'));var sox=require('sox');var csv=require(_0xfc7b('0x7'));var ejs=require(_0xfc7b('0x8'));var fs=require('fs');var fs_extra=require(_0xfc7b('0x9'));var _=require(_0xfc7b('0xa'));var squel=require(_0xfc7b('0xb'));var crypto=require(_0xfc7b('0xc'));var jsforce=require(_0xfc7b('0xd'));var deskjs=require(_0xfc7b('0xe'));var toCsv=require(_0xfc7b('0x7'));var querystring=require('querystring');var Papa=require(_0xfc7b('0xf'));var Redis=require(_0xfc7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc7b('0x11'));var as=require(_0xfc7b('0x12'));var hardwareService=require(_0xfc7b('0x13'));var logger=require(_0xfc7b('0x14'))('api');var utils=require(_0xfc7b('0x15'));var config=require(_0xfc7b('0x16'));var licenseUtil=require(_0xfc7b('0x17'));var db=require(_0xfc7b('0x18'))['db'];function respondWithStatusCode(_0x2b49d1,_0x2e9e5f){_0x2e9e5f=_0x2e9e5f||0xcc;return function(_0x3bd6e4){if(_0x3bd6e4){return _0x2b49d1[_0xfc7b('0x19')](_0x2e9e5f);}return _0x2b49d1[_0xfc7b('0x1a')](_0x2e9e5f)[_0xfc7b('0x1b')]();};}function respondWithResult(_0x291c03,_0x3c5c04){_0x3c5c04=_0x3c5c04||0xc8;return function(_0x2a4496){if(_0x2a4496){return _0x291c03[_0xfc7b('0x1a')](_0x3c5c04)[_0xfc7b('0x1c')](_0x2a4496);}};}function respondWithFilteredResult(_0x2f772e,_0x38be0b){return function(_0x264676){if(_0x264676){var _0x590b40=typeof _0x38be0b[_0xfc7b('0x1d')]===_0xfc7b('0x1e')&&typeof _0x38be0b[_0xfc7b('0x1f')]===_0xfc7b('0x1e');var _0x14b180=_0x264676[_0xfc7b('0x20')];var _0x7f7b80=_0x590b40?0x0:_0x38be0b['offset'];var _0x187fc6=_0x590b40?_0x264676[_0xfc7b('0x20')]:_0x38be0b[_0xfc7b('0x1d')]+_0x38be0b[_0xfc7b('0x1f')];var _0x503e97;if(_0x187fc6>=_0x14b180){_0x187fc6=_0x14b180;_0x503e97=0xc8;}else{_0x503e97=0xce;}_0x2f772e[_0xfc7b('0x1a')](_0x503e97);return _0x2f772e['set'](_0xfc7b('0x21'),_0x7f7b80+'-'+_0x187fc6+'/'+_0x14b180)[_0xfc7b('0x1c')](_0x264676);}return null;};}function patchUpdates(_0xda3927){return function(_0x4c8a27){try{jsonpatch[_0xfc7b('0x22')](_0x4c8a27,_0xda3927,!![]);}catch(_0x2dff01){return BPromise['reject'](_0x2dff01);}return _0x4c8a27[_0xfc7b('0x23')]();};}function saveUpdates(_0x4c0f67,_0xbfc026){return function(_0xca0bef){if(_0xca0bef){return _0xca0bef[_0xfc7b('0x24')](_0x4c0f67)['then'](function(_0x578510){return _0x578510;});}return null;};}function removeEntity(_0x38dfc0,_0x5c4573){return function(_0x2afcc3){if(_0x2afcc3){return _0x2afcc3[_0xfc7b('0x25')]()[_0xfc7b('0x26')](function(){var _0x35977f=_0x2afcc3['get']({'plain':!![]});var _0x5e2fa6='Sounds';return db['UserProfileResource'][_0xfc7b('0x25')]({'where':{'type':_0x5e2fa6,'resourceId':_0x35977f['id']}})['then'](function(){return _0x2afcc3;});})[_0xfc7b('0x26')](function(){_0x38dfc0['status'](0xcc)[_0xfc7b('0x1b')]();});}};}function handleEntityNotFound(_0x11189a,_0x13051e){return function(_0x1607d2){if(!_0x1607d2){_0x11189a[_0xfc7b('0x19')](0x194);}return _0x1607d2;};}function handleError(_0x780bd4,_0x4e77e2){_0x4e77e2=_0x4e77e2||0x1f4;return function(_0xcfc601){logger['error'](_0xcfc601[_0xfc7b('0x27')]);if(_0xcfc601['name']){delete _0xcfc601[_0xfc7b('0x28')];}_0x780bd4[_0xfc7b('0x1a')](_0x4e77e2)['send'](_0xcfc601);};}exports[_0xfc7b('0x29')]=function(_0x511954,_0x21815b){var _0x28e190={},_0x377a97={},_0x5a933b={'count':0x0,'rows':[]};var _0x6e2c6f=_[_0xfc7b('0x2a')](db['Sound'][_0xfc7b('0x2b')],function(_0x38f990){return{'name':_0x38f990[_0xfc7b('0x2c')],'type':_0x38f990[_0xfc7b('0x2d')][_0xfc7b('0x2e')]};});_0x377a97[_0xfc7b('0x2f')]=_[_0xfc7b('0x2a')](_0x6e2c6f,_0xfc7b('0x28'));_0x377a97[_0xfc7b('0x30')]=_[_0xfc7b('0x31')](_0x511954[_0xfc7b('0x30')]);_0x377a97['filters']=_[_0xfc7b('0x32')](_0x377a97[_0xfc7b('0x2f')],_0x377a97[_0xfc7b('0x30')]);_0x28e190[_0xfc7b('0x33')]=_[_0xfc7b('0x32')](_0x377a97[_0xfc7b('0x2f')],qs[_0xfc7b('0x34')](_0x511954['query']['fields']));_0x28e190['attributes']=_0x28e190[_0xfc7b('0x33')]['length']?_0x28e190[_0xfc7b('0x33')]:_0x377a97[_0xfc7b('0x2f')];if(!_0x511954['query'][_0xfc7b('0x35')](_0xfc7b('0x36'))){_0x28e190[_0xfc7b('0x1f')]=qs[_0xfc7b('0x1f')](_0x511954['query'][_0xfc7b('0x1f')]);_0x28e190[_0xfc7b('0x1d')]=qs[_0xfc7b('0x1d')](_0x511954['query'][_0xfc7b('0x1d')]);}_0x28e190[_0xfc7b('0x37')]=qs[_0xfc7b('0x38')](_0x511954[_0xfc7b('0x30')][_0xfc7b('0x38')]);_0x28e190['where']=qs[_0xfc7b('0x39')](_[_0xfc7b('0x3a')](_0x511954[_0xfc7b('0x30')],_0x377a97[_0xfc7b('0x39')]),_0x6e2c6f);if(_0x511954[_0xfc7b('0x30')]['filter']){_0x28e190['where']=_[_0xfc7b('0x3b')](_0x28e190['where'],{'$or':_[_0xfc7b('0x2a')](_0x6e2c6f,function(_0x437dc9){if(_0x437dc9[_0xfc7b('0x2d')]!==_0xfc7b('0x3c')){var _0x4a220a={};_0x4a220a[_0x437dc9[_0xfc7b('0x28')]]={'$like':'%'+_0x511954['query'][_0xfc7b('0x3d')]+'%'};return _0x4a220a;}})});}_0x28e190=_[_0xfc7b('0x3b')]({},_0x28e190,_0x511954[_0xfc7b('0x3e')]);var _0x41e541={'where':_0x28e190[_0xfc7b('0x3f')]};return db['Sound'][_0xfc7b('0x20')](_0x41e541)[_0xfc7b('0x26')](function(_0x55a984){_0x5a933b[_0xfc7b('0x20')]=_0x55a984;if(_0x511954[_0xfc7b('0x30')][_0xfc7b('0x40')]){_0x28e190[_0xfc7b('0x41')]=[{'all':!![]}];}return db[_0xfc7b('0x42')][_0xfc7b('0x43')](_0x28e190);})['then'](function(_0x1deed8){_0x5a933b['rows']=_0x1deed8;return _0x5a933b;})['then'](respondWithFilteredResult(_0x21815b,_0x28e190))[_0xfc7b('0x44')](handleError(_0x21815b,null));};exports[_0xfc7b('0x45')]=function(_0x276384,_0x9958c){var _0x2e8d1f={'raw':!![],'where':{'id':_0x276384['params']['id']}},_0x57e630={};_0x57e630['model']=_[_0xfc7b('0x31')](db['Sound'][_0xfc7b('0x2b')]);_0x57e630[_0xfc7b('0x30')]=_[_0xfc7b('0x31')](_0x276384[_0xfc7b('0x30')]);_0x57e630[_0xfc7b('0x39')]=_[_0xfc7b('0x32')](_0x57e630[_0xfc7b('0x2f')],_0x57e630[_0xfc7b('0x30')]);_0x2e8d1f[_0xfc7b('0x33')]=_[_0xfc7b('0x32')](_0x57e630[_0xfc7b('0x2f')],qs[_0xfc7b('0x34')](_0x276384['query'][_0xfc7b('0x34')]));_0x2e8d1f['attributes']=_0x2e8d1f[_0xfc7b('0x33')][_0xfc7b('0x46')]?_0x2e8d1f[_0xfc7b('0x33')]:_0x57e630['model'];if(_0x276384[_0xfc7b('0x30')][_0xfc7b('0x40')]){_0x2e8d1f['include']=[{'all':!![]}];}_0x2e8d1f=_[_0xfc7b('0x3b')]({},_0x2e8d1f,_0x276384[_0xfc7b('0x3e')]);return db[_0xfc7b('0x42')][_0xfc7b('0x47')](_0x2e8d1f)[_0xfc7b('0x26')](handleEntityNotFound(_0x9958c,null))[_0xfc7b('0x26')](respondWithResult(_0x9958c,null))[_0xfc7b('0x44')](handleError(_0x9958c,null));};exports[_0xfc7b('0x48')]=function(_0x1ac6b7,_0x3390d0,_0x380a3b){return db[_0xfc7b('0x42')][_0xfc7b('0x47')]({'where':{'id':_0x1ac6b7[_0xfc7b('0x49')]['id']},'attributes':[_0xfc7b('0x28'),_0xfc7b('0x4a'),'converted_format'],'raw':!![]})[_0xfc7b('0x26')](handleEntityNotFound(_0x3390d0,null))[_0xfc7b('0x26')](function(_0x5945ee){if(_0x5945ee){if(!fs['existsSync'](path[_0xfc7b('0x4b')](config[_0xfc7b('0x4c')],_0xfc7b('0x4d'),_0x5945ee['save_name']+'.'+_0x5945ee[_0xfc7b('0x4e')]))){throw new db[(_0xfc7b('0x4f'))][(_0xfc7b('0x50'))](_0xfc7b('0x51'));}return _0x3390d0[_0xfc7b('0x48')](path[_0xfc7b('0x4b')](config[_0xfc7b('0x4c')],_0xfc7b('0x4d'),util['format'](_0xfc7b('0x52'),_0x5945ee[_0xfc7b('0x4a')],_0x5945ee[_0xfc7b('0x4e')])),util[_0xfc7b('0x53')](_0xfc7b('0x52'),_0x5945ee[_0xfc7b('0x28')],_0x5945ee['converted_format']));}return null;})[_0xfc7b('0x44')](handleError(_0x3390d0,null));};exports[_0xfc7b('0x54')]=function(_0x473479,_0x4cacbe,_0x4a3187){var _0xf2194c={'name':path[_0xfc7b('0x55')](_0x473479[_0xfc7b('0x56')]['originalname'],path['extname'](_0x473479['file']['originalname'])),'save_name':path[_0xfc7b('0x55')](_0x473479[_0xfc7b('0x56')][_0xfc7b('0x57')],path[_0xfc7b('0x58')](_0x473479['file']['filename'])),'original_format':path['extname'](_0x473479[_0xfc7b('0x56')][_0xfc7b('0x59')])['substring'](0x1),'converted_format':'wav'};var _0x45d50d=path[_0xfc7b('0x4b')](config[_0xfc7b('0x4c')],_0xfc7b('0x5a'),_0x473479[_0xfc7b('0x56')][_0xfc7b('0x57')]);var _0x3d5b4d=path[_0xfc7b('0x4b')](config[_0xfc7b('0x4c')],_0xfc7b('0x4d'),util[_0xfc7b('0x53')](_0xfc7b('0x52'),path[_0xfc7b('0x55')](_0x473479[_0xfc7b('0x56')][_0xfc7b('0x57')],path[_0xfc7b('0x58')](_0x473479['file'][_0xfc7b('0x57')])),_0xf2194c[_0xfc7b('0x4e')]));logger[_0xfc7b('0x5b')](_0xfc7b('0x5c'),_0x45d50d);logger[_0xfc7b('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x3d5b4d);try{fs[_0xfc7b('0x5d')](_0x45d50d,parseInt(_0xfc7b('0x5e'),0x8));var _0x501533=sox[_0xfc7b('0x5f')](_0x45d50d,_0x3d5b4d,{'sampleRate':0x1f40,'format':_0xfc7b('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x501533['on'](_0xfc7b('0x61'),function(_0x1ab102){fs['unlinkSync'](_0x45d50d);_0x4cacbe[_0xfc7b('0x1a')](0x1f4)[_0xfc7b('0x62')](_0x1ab102);});_0x501533['on'](_0xfc7b('0x63'),function(_0x4177da){_0xf2194c[_0xfc7b('0x64')]=isNaN(_0x4177da[_0xfc7b('0x65')])?null:_0x4177da[_0xfc7b('0x65')]*0x3e8;_0xf2194c['original_sampleCount']=isNaN(_0x4177da[_0xfc7b('0x66')])?null:_0x4177da[_0xfc7b('0x66')];_0xf2194c[_0xfc7b('0x67')]=isNaN(_0x4177da[_0xfc7b('0x68')])?null:_0x4177da[_0xfc7b('0x68')];_0xf2194c[_0xfc7b('0x69')]=isNaN(_0x4177da['bitRate'])?null:_0x4177da[_0xfc7b('0x6a')];_0xf2194c['original_sampleRate']=isNaN(_0x4177da[_0xfc7b('0x6b')])?null:_0x4177da[_0xfc7b('0x6b')];});_0x501533['on'](_0xfc7b('0x6c'),function(_0x53213a){_0xf2194c[_0xfc7b('0x6d')]=isNaN(_0x53213a[_0xfc7b('0x65')])?null:_0x53213a[_0xfc7b('0x65')]*0x3e8;_0xf2194c[_0xfc7b('0x6e')]=isNaN(_0x53213a['sampleCount'])?null:_0x53213a['sampleCount'];_0xf2194c['converted_channelCount']=isNaN(_0x53213a['channelCount'])?null:_0x53213a[_0xfc7b('0x68')];_0xf2194c[_0xfc7b('0x6f')]=isNaN(_0x53213a[_0xfc7b('0x6a')])?null:_0x53213a[_0xfc7b('0x6a')];_0xf2194c[_0xfc7b('0x70')]=isNaN(_0x53213a[_0xfc7b('0x6b')])?null:_0x53213a[_0xfc7b('0x6b')];});_0x501533['on'](_0xfc7b('0x1b'),function(){fs[_0xfc7b('0x5d')](_0x3d5b4d,parseInt('0777',0x8));return db[_0xfc7b('0x42')][_0xfc7b('0x54')](_0xf2194c)[_0xfc7b('0x26')](function(_0x2e0c9e){var _0x57041e={'role':_0x473479['body'][_0xfc7b('0x71')],'userProfileId':_0x473479[_0xfc7b('0x72')][_0xfc7b('0x73')]};if(!_0x57041e)throw new Error(_0xfc7b('0x74'));if(_0x57041e[_0xfc7b('0x71')]===_0xfc7b('0x75')){var _0x5e3216=_0x2e0c9e[_0xfc7b('0x76')]({'plain':!![]});return db[_0xfc7b('0x77')][_0xfc7b('0x47')]({'where':{'name':_0xfc7b('0x78'),'userProfileId':_0x57041e[_0xfc7b('0x73')]},'raw':!![]})[_0xfc7b('0x26')](function(_0x43a6f6){if(_0x43a6f6&&_0x43a6f6[_0xfc7b('0x79')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e3216[_0xfc7b('0x28')],'resourceId':_0x5e3216['id'],'type':_0x43a6f6['name'],'sectionId':_0x43a6f6['id']},{})[_0xfc7b('0x26')](function(){return _0x2e0c9e;});}else{return _0x2e0c9e;}})[_0xfc7b('0x44')](function(_0x4dcbfa){logger['error'](_0xfc7b('0x7a'),_0x4dcbfa);throw _0x4dcbfa;});}return _0x2e0c9e;})[_0xfc7b('0x26')](respondWithResult(_0x4cacbe,null))[_0xfc7b('0x44')](handleError(_0x4cacbe,null));});_0x501533['start']();}catch(_0x1f2ff8){_0x4cacbe[_0xfc7b('0x1a')](0x1f4)[_0xfc7b('0x62')](_0x1f2ff8);}};exports[_0xfc7b('0x24')]=function(_0x71416c,_0x53415d,_0x4c3be8){return db['Sound'][_0xfc7b('0x47')]({'where':{'id':_0x71416c[_0xfc7b('0x49')]['id']}})[_0xfc7b('0x26')](handleEntityNotFound(_0x53415d,null))['then'](saveUpdates(_[_0xfc7b('0x3a')](_0x71416c[_0xfc7b('0x72')],[_0xfc7b('0x28'),_0xfc7b('0x7b')]),null))[_0xfc7b('0x26')](respondWithResult(_0x53415d,null))[_0xfc7b('0x44')](handleError(_0x53415d,null));};exports[_0xfc7b('0x7c')]=function(_0xeda546,_0x37a816,_0xa950ed){return db[_0xfc7b('0x42')][_0xfc7b('0x47')]({'where':{'id':_0xeda546['params']['id']}})['then'](function(_0x22d5d6){if(_0x22d5d6){return _0x22d5d6[_0xfc7b('0x25')]();}})['then'](function(_0x4de447){var _0x1262ca=path[_0xfc7b('0x4b')](config[_0xfc7b('0x4c')],_0xfc7b('0x5a'),util[_0xfc7b('0x53')](_0xfc7b('0x52'),_0x4de447[_0xfc7b('0x4a')],_0x4de447[_0xfc7b('0x7d')]));var _0x3a9506=path[_0xfc7b('0x4b')](config['root'],_0xfc7b('0x4d'),util['format'](_0xfc7b('0x52'),_0x4de447[_0xfc7b('0x4a')],_0x4de447[_0xfc7b('0x4e')]));fs['unlinkSync'](_0x1262ca);fs[_0xfc7b('0x7e')](_0x3a9506);return _0x4de447;})['then'](function(_0x819049){if(_0x819049){return _0x37a816['status'](0xcc)[_0xfc7b('0x1b')]();}})['then'](handleEntityNotFound(_0x37a816,null))[_0xfc7b('0x44')](handleError(_0x37a816,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7950138..a411474 100644 --- a/server/api/sound/sound.model.js +++ b/server/api/sound/sound.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x676b=['../../config/logger','api','moment','request-promise','./sound.attributes','define','Sound','lodash','util'];(function(_0x3dd5e1,_0x404822){var _0x278e55=function(_0x111324){while(--_0x111324){_0x3dd5e1['push'](_0x3dd5e1['shift']());}};_0x278e55(++_0x404822);}(_0x676b,0x1e4));var _0xb676=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x676b[_0x20aadb];return _0x520018;};'use strict';var _=require(_0xb676('0x0'));var util=require(_0xb676('0x1'));var logger=require(_0xb676('0x2'))(_0xb676('0x3'));var moment=require(_0xb676('0x4'));var BPromise=require('bluebird');var rp=require(_0xb676('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb676('0x6'));module['exports']=function(_0x1e72b9,_0x32200b){return _0x1e72b9[_0xb676('0x7')](_0xb676('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe06e=['path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4beaca,_0x92d420){var _0x2febe4=function(_0x349e97){while(--_0x349e97){_0x4beaca['push'](_0x4beaca['shift']());}};_0x2febe4(++_0x92d420);}(_0xe06e,0xfe));var _0xee06=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xe06e[_0xb0de07];return _0x4633d8;};'use strict';var _=require(_0xee06('0x0'));var util=require('util');var logger=require(_0xee06('0x1'))(_0xee06('0x2'));var moment=require(_0xee06('0x3'));var BPromise=require(_0xee06('0x4'));var rp=require(_0xee06('0x5'));var fs=require('fs');var path=require(_0xee06('0x6'));var rimraf=require(_0xee06('0x7'));var config=require(_0xee06('0x8'));var attributes=require(_0xee06('0x9'));module['exports']=function(_0x5b6e30,_0x5a871d){return _0x5b6e30[_0xee06('0xa')](_0xee06('0xb'),attributes,{'tableName':_0xee06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 0191df2..f03a8a3 100644 --- a/server/api/sound/sound.rpc.js +++ b/server/api/sound/sound.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0bd=['info','result','ShowSound','Sound','options','raw','where','include','map','model','attributes','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1b33ec,_0x4c5bb3){var _0x36c0a4=function(_0x4845cb){while(--_0x4845cb){_0x1b33ec['push'](_0x1b33ec['shift']());}};_0x36c0a4(++_0x4c5bb3);}(_0xb0bd,0xd7));var _0xdb0b=function(_0x35b7f8,_0x2474c0){_0x35b7f8=_0x35b7f8-0x0;var _0x38b91c=_0xb0bd[_0x35b7f8];return _0x38b91c;};'use strict';var _=require(_0xdb0b('0x0'));var util=require('util');var moment=require(_0xdb0b('0x1'));var BPromise=require(_0xdb0b('0x2'));var rs=require(_0xdb0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb0b('0x4'));var logger=require(_0xdb0b('0x5'))(_0xdb0b('0x6'));var config=require(_0xdb0b('0x7'));var jayson=require(_0xdb0b('0x8'));var client=jayson[_0xdb0b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe54120,_0x376f42,_0x55cb6d){return new BPromise(function(_0x561a64,_0x36e23b){return client['request'](_0xe54120,_0x55cb6d)[_0xdb0b('0xa')](function(_0x3847f2){logger['info'](_0xdb0b('0xb'),_0x376f42,_0xdb0b('0xc'));logger['debug'](_0xdb0b('0xd'),_0x376f42,_0xdb0b('0xc'),JSON[_0xdb0b('0xe')](_0x3847f2));if(_0x3847f2['error']){if(_0x3847f2[_0xdb0b('0xf')]['code']===0x1f4){logger[_0xdb0b('0xf')](_0xdb0b('0xb'),_0x376f42,_0x3847f2['error'][_0xdb0b('0x10')]);return _0x36e23b(_0x3847f2[_0xdb0b('0xf')][_0xdb0b('0x10')]);}logger[_0xdb0b('0xf')]('Sound,\x20%s,\x20%s',_0x376f42,_0x3847f2[_0xdb0b('0xf')][_0xdb0b('0x10')]);return _0x561a64(_0x3847f2[_0xdb0b('0xf')][_0xdb0b('0x10')]);}else{logger[_0xdb0b('0x11')](_0xdb0b('0xb'),_0x376f42,_0xdb0b('0xc'));_0x561a64(_0x3847f2[_0xdb0b('0x12')][_0xdb0b('0x10')]);}})['catch'](function(_0x2e8349){logger[_0xdb0b('0xf')]('Sound,\x20%s,\x20%s',_0x376f42,_0x2e8349);_0x36e23b(_0x2e8349);});});}exports[_0xdb0b('0x13')]=function(_0x5ac3ad){var _0x57725a=this;return new Promise(function(_0x38668a,_0x2c855c){return db[_0xdb0b('0x14')]['find']({'raw':_0x5ac3ad[_0xdb0b('0x15')]?_0x5ac3ad[_0xdb0b('0x15')][_0xdb0b('0x16')]===undefined?!![]:![]:!![],'where':_0x5ac3ad[_0xdb0b('0x15')]?_0x5ac3ad[_0xdb0b('0x15')][_0xdb0b('0x17')]||null:null,'attributes':_0x5ac3ad[_0xdb0b('0x15')]?_0x5ac3ad[_0xdb0b('0x15')]['attributes']||null:null,'include':_0x5ac3ad[_0xdb0b('0x15')]?_0x5ac3ad['options'][_0xdb0b('0x18')]?_[_0xdb0b('0x19')](_0x5ac3ad[_0xdb0b('0x15')][_0xdb0b('0x18')],function(_0x26a9c1){return{'model':db[_0x26a9c1['model']],'as':_0x26a9c1['as'],'attributes':_0x26a9c1['attributes'],'include':_0x26a9c1[_0xdb0b('0x18')]?_['map'](_0x26a9c1['include'],function(_0x202ee3){return{'model':db[_0x202ee3[_0xdb0b('0x1a')]],'as':_0x202ee3['as'],'attributes':_0x202ee3[_0xdb0b('0x1b')],'include':_0x202ee3[_0xdb0b('0x18')]?_[_0xdb0b('0x19')](_0x202ee3[_0xdb0b('0x18')],function(_0x5a8a71){return{'model':db[_0x5a8a71['model']],'as':_0x5a8a71['as'],'attributes':_0x5a8a71[_0xdb0b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdb0b('0xa')](function(_0x198a98){logger['info'](_0xdb0b('0x13'),_0x5ac3ad);logger['debug'](_0xdb0b('0x13'),_0x5ac3ad,JSON[_0xdb0b('0xe')](_0x198a98));_0x38668a(_0x198a98);})[_0xdb0b('0x1c')](function(_0x173b4a){logger['error'](_0xdb0b('0x13'),_0x173b4a[_0xdb0b('0x10')],_0x5ac3ad);_0x2c855c(_0x57725a[_0xdb0b('0xf')](0x1f4,_0x173b4a[_0xdb0b('0x10')]));});});}; \ No newline at end of file +var _0x5fb4=['stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','options','raw','where','include','map','model','attributes','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x2b1091,_0x43f042){var _0x1cd889=function(_0x361475){while(--_0x361475){_0x2b1091['push'](_0x2b1091['shift']());}};_0x1cd889(++_0x43f042);}(_0x5fb4,0x92));var _0x45fb=function(_0xbd7a78,_0x2c9c93){_0xbd7a78=_0xbd7a78-0x0;var _0x4357de=_0x5fb4[_0xbd7a78];return _0x4357de;};'use strict';var _=require(_0x45fb('0x0'));var util=require('util');var moment=require(_0x45fb('0x1'));var BPromise=require(_0x45fb('0x2'));var rs=require(_0x45fb('0x3'));var fs=require('fs');var Redis=require(_0x45fb('0x4'));var db=require(_0x45fb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x45fb('0x6'))(_0x45fb('0x7'));var config=require(_0x45fb('0x8'));var jayson=require(_0x45fb('0x9'));var client=jayson[_0x45fb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5628ae,_0x1cdd18,_0x1056a){return new BPromise(function(_0x27def3,_0x259d1c){return client['request'](_0x5628ae,_0x1056a)['then'](function(_0x3907ee){logger[_0x45fb('0xb')]('Sound,\x20%s,\x20%s',_0x1cdd18,_0x45fb('0xc'));logger['debug'](_0x45fb('0xd'),_0x1cdd18,'request\x20sent',JSON[_0x45fb('0xe')](_0x3907ee));if(_0x3907ee[_0x45fb('0xf')]){if(_0x3907ee[_0x45fb('0xf')][_0x45fb('0x10')]===0x1f4){logger[_0x45fb('0xf')](_0x45fb('0x11'),_0x1cdd18,_0x3907ee[_0x45fb('0xf')][_0x45fb('0x12')]);return _0x259d1c(_0x3907ee[_0x45fb('0xf')][_0x45fb('0x12')]);}logger['error'](_0x45fb('0x11'),_0x1cdd18,_0x3907ee[_0x45fb('0xf')]['message']);return _0x27def3(_0x3907ee[_0x45fb('0xf')][_0x45fb('0x12')]);}else{logger[_0x45fb('0xb')](_0x45fb('0x11'),_0x1cdd18,_0x45fb('0xc'));_0x27def3(_0x3907ee[_0x45fb('0x13')][_0x45fb('0x12')]);}})[_0x45fb('0x14')](function(_0x4fa7d1){logger[_0x45fb('0xf')](_0x45fb('0x11'),_0x1cdd18,_0x4fa7d1);_0x259d1c(_0x4fa7d1);});});}exports[_0x45fb('0x15')]=function(_0x5931a9){var _0x544923=this;return new Promise(function(_0x4f997e,_0x449a48){return db[_0x45fb('0x16')]['find']({'raw':_0x5931a9[_0x45fb('0x17')]?_0x5931a9[_0x45fb('0x17')][_0x45fb('0x18')]===undefined?!![]:![]:!![],'where':_0x5931a9[_0x45fb('0x17')]?_0x5931a9['options'][_0x45fb('0x19')]||null:null,'attributes':_0x5931a9[_0x45fb('0x17')]?_0x5931a9[_0x45fb('0x17')]['attributes']||null:null,'include':_0x5931a9[_0x45fb('0x17')]?_0x5931a9[_0x45fb('0x17')][_0x45fb('0x1a')]?_[_0x45fb('0x1b')](_0x5931a9['options'][_0x45fb('0x1a')],function(_0x559441){return{'model':db[_0x559441[_0x45fb('0x1c')]],'as':_0x559441['as'],'attributes':_0x559441[_0x45fb('0x1d')],'include':_0x559441[_0x45fb('0x1a')]?_[_0x45fb('0x1b')](_0x559441['include'],function(_0x4d06fd){return{'model':db[_0x4d06fd['model']],'as':_0x4d06fd['as'],'attributes':_0x4d06fd[_0x45fb('0x1d')],'include':_0x4d06fd[_0x45fb('0x1a')]?_['map'](_0x4d06fd[_0x45fb('0x1a')],function(_0x28d579){return{'model':db[_0x28d579[_0x45fb('0x1c')]],'as':_0x28d579['as'],'attributes':_0x28d579[_0x45fb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x45fb('0x1e')](function(_0x31bf60){logger[_0x45fb('0xb')](_0x45fb('0x15'),_0x5931a9);logger[_0x45fb('0x1f')]('ShowSound',_0x5931a9,JSON[_0x45fb('0xe')](_0x31bf60));_0x4f997e(_0x31bf60);})['catch'](function(_0x1f141b){logger[_0x45fb('0xf')]('ShowSound',_0x1f141b['message'],_0x5931a9);_0x449a48(_0x544923[_0x45fb('0xf')](0x1f4,_0x1f141b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7006eae..d2c76c8 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2bc2a2,_0x51e95f){var _0x20de67=function(_0x27f2d2){while(--_0x27f2d2){_0x2bc2a2['push'](_0x2bc2a2['shift']());}};_0x20de67(++_0x51e95f);}(_0x8603,0x190));var _0x3860=function(_0x23f4cc,_0x4b6d1a){_0x23f4cc=_0x23f4cc-0x0;var _0x8d3d1a=_0x8603[_0x23f4cc];return _0x8d3d1a;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x319ccc,_0x1e4f70){var _0x4cc543=function(_0x31c3e6){while(--_0x31c3e6){_0x319ccc['push'](_0x319ccc['shift']());}};_0x4cc543(++_0x1e4f70);}(_0xb10b,0x12a));var _0xbb10=function(_0x5aaf95,_0x5e8f9b){_0x5aaf95=_0x5aaf95-0x0;var _0x1eb0c5=_0xb10b[_0x5aaf95];return _0x1eb0c5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 459dcbc..e65492c 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b4d=['medium','ENUM','out','sequelize','exports','TEXT'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b4d,0x129));var _0xd7b4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7b4d[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0xd7b4('0x0'));module[_0xd7b4('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xd7b4('0x2')](_0xd7b4('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xd7b4('0x4')]('in','out'),'defaultValue':_0xd7b4('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd7b4('0x2')]}}; \ No newline at end of file +var _0x3d79=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x3d79,0x1df));var _0x93d7=function(_0x2978b5,_0x52d3c8){_0x2978b5=_0x2978b5-0x0;var _0xc54f5e=_0x3d79[_0x2978b5];return _0xc54f5e;};'use strict';var Sequelize=require(_0x93d7('0x0'));module[_0x93d7('0x1')]={'uniqueid':{'type':Sequelize[_0x93d7('0x2')]},'body':{'type':Sequelize[_0x93d7('0x3')](_0x93d7('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x93d7('0x5')]('in','out'),'defaultValue':_0x93d7('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x93d7('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index b7532ac..eb7cea3 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57fa=['pick','merge','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','limit','undefined','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','sort','where'];(function(_0x3a9973,_0x24726b){var _0x3d26a8=function(_0x12a194){while(--_0x12a194){_0x3a9973['push'](_0x3a9973['shift']());}};_0x3d26a8(++_0x24726b);}(_0x57fa,0x127));var _0xa57f=function(_0x1b0c0d,_0x32cebc){_0x1b0c0d=_0x1b0c0d-0x0;var _0xe40794=_0x57fa[_0x1b0c0d];return _0xe40794;};'use strict';var emlformat=require(_0xa57f('0x0'));var rimraf=require(_0xa57f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa57f('0x2'));var rp=require('request-promise');var moment=require(_0xa57f('0x3'));var BPromise=require(_0xa57f('0x4'));var Mustache=require(_0xa57f('0x5'));var util=require(_0xa57f('0x6'));var path=require(_0xa57f('0x7'));var sox=require(_0xa57f('0x8'));var csv=require(_0xa57f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa57f('0xa'));var squel=require('squel');var crypto=require(_0xa57f('0xb'));var jsforce=require(_0xa57f('0xc'));var deskjs=require(_0xa57f('0xd'));var toCsv=require(_0xa57f('0x9'));var querystring=require(_0xa57f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa57f('0xf'));var authService=require(_0xa57f('0x10'));var qs=require(_0xa57f('0x11'));var as=require(_0xa57f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa57f('0x13'));var utils=require(_0xa57f('0x14'));var config=require(_0xa57f('0x15'));var licenseUtil=require(_0xa57f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aab22,_0xd08ca7){_0xd08ca7=_0xd08ca7||0xcc;return function(_0xb3fd0a){if(_0xb3fd0a){return _0x4aab22['sendStatus'](_0xd08ca7);}return _0x4aab22[_0xa57f('0x17')](_0xd08ca7)['end']();};}function respondWithResult(_0x51a538,_0x1ef7ef){_0x1ef7ef=_0x1ef7ef||0xc8;return function(_0x5e7abd){if(_0x5e7abd){return _0x51a538[_0xa57f('0x17')](_0x1ef7ef)['json'](_0x5e7abd);}};}function respondWithFilteredResult(_0xadd1f8,_0x446feb){return function(_0xb5de61){if(_0xb5de61){var _0x1eb855=typeof _0x446feb['offset']==='undefined'&&typeof _0x446feb[_0xa57f('0x18')]===_0xa57f('0x19');var _0x20e400=_0xb5de61['count'];var _0x1d42a2=_0x1eb855?0x0:_0x446feb[_0xa57f('0x1a')];var _0x3c2d6b=_0x1eb855?_0xb5de61['count']:_0x446feb[_0xa57f('0x1a')]+_0x446feb[_0xa57f('0x18')];var _0x1dfcb3;if(_0x3c2d6b>=_0x20e400){_0x3c2d6b=_0x20e400;_0x1dfcb3=0xc8;}else{_0x1dfcb3=0xce;}_0xadd1f8[_0xa57f('0x17')](_0x1dfcb3);return _0xadd1f8[_0xa57f('0x1b')](_0xa57f('0x1c'),_0x1d42a2+'-'+_0x3c2d6b+'/'+_0x20e400)['json'](_0xb5de61);}return null;};}function patchUpdates(_0x37c294){return function(_0x73e2b8){try{jsonpatch[_0xa57f('0x1d')](_0x73e2b8,_0x37c294,!![]);}catch(_0x32ed6e){return BPromise[_0xa57f('0x1e')](_0x32ed6e);}return _0x73e2b8[_0xa57f('0x1f')]();};}function saveUpdates(_0x10e623,_0x2c8646){return function(_0x448a4f){if(_0x448a4f){return _0x448a4f[_0xa57f('0x20')](_0x10e623)['then'](function(_0x77a7fe){return _0x77a7fe;});}return null;};}function removeEntity(_0x5f4b73,_0x3cc2a3){return function(_0x4ffa6b){if(_0x4ffa6b){return _0x4ffa6b[_0xa57f('0x21')]()[_0xa57f('0x22')](function(){_0x5f4b73[_0xa57f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1087,_0x22ca09){return function(_0x4470e8){if(!_0x4470e8){_0x5a1087[_0xa57f('0x23')](0x194);}return _0x4470e8;};}function handleError(_0x4a8aca,_0x5f29e1){_0x5f29e1=_0x5f29e1||0x1f4;return function(_0x678b2f){logger[_0xa57f('0x24')](_0x678b2f[_0xa57f('0x25')]);if(_0x678b2f[_0xa57f('0x26')]){delete _0x678b2f[_0xa57f('0x26')];}_0x4a8aca[_0xa57f('0x17')](_0x5f29e1)[_0xa57f('0x27')](_0x678b2f);};}exports[_0xa57f('0x28')]=function(_0x13b5c1,_0x2d7360){var _0x75d7d0={},_0x39c795={},_0x1ef2e1={'count':0x0,'rows':[]};var _0x52c7bc=_[_0xa57f('0x29')](db[_0xa57f('0x2a')][_0xa57f('0x2b')],function(_0x260ca9){return{'name':_0x260ca9['fieldName'],'type':_0x260ca9[_0xa57f('0x2c')][_0xa57f('0x2d')]};});_0x39c795[_0xa57f('0x2e')]=_[_0xa57f('0x29')](_0x52c7bc,_0xa57f('0x26'));_0x39c795[_0xa57f('0x2f')]=_['keys'](_0x13b5c1[_0xa57f('0x2f')]);_0x39c795[_0xa57f('0x30')]=_[_0xa57f('0x31')](_0x39c795[_0xa57f('0x2e')],_0x39c795['query']);_0x75d7d0['attributes']=_[_0xa57f('0x31')](_0x39c795['model'],qs[_0xa57f('0x32')](_0x13b5c1[_0xa57f('0x2f')]['fields']));_0x75d7d0[_0xa57f('0x33')]=_0x75d7d0[_0xa57f('0x33')][_0xa57f('0x34')]?_0x75d7d0[_0xa57f('0x33')]:_0x39c795['model'];if(!_0x13b5c1[_0xa57f('0x2f')]['hasOwnProperty']('nolimit')){_0x75d7d0[_0xa57f('0x18')]=qs[_0xa57f('0x18')](_0x13b5c1[_0xa57f('0x2f')][_0xa57f('0x18')]);_0x75d7d0[_0xa57f('0x1a')]=qs['offset'](_0x13b5c1[_0xa57f('0x2f')]['offset']);}_0x75d7d0['order']=qs[_0xa57f('0x35')](_0x13b5c1[_0xa57f('0x2f')][_0xa57f('0x35')]);_0x75d7d0[_0xa57f('0x36')]=qs[_0xa57f('0x30')](_[_0xa57f('0x37')](_0x13b5c1[_0xa57f('0x2f')],_0x39c795[_0xa57f('0x30')]),_0x52c7bc);if(_0x13b5c1[_0xa57f('0x2f')]['filter']){_0x75d7d0[_0xa57f('0x36')]=_[_0xa57f('0x38')](_0x75d7d0[_0xa57f('0x36')],{'$or':_['map'](_0x52c7bc,function(_0x1f1007){if(_0x1f1007[_0xa57f('0x2c')]!=='VIRTUAL'){var _0x80fa47={};_0x80fa47[_0x1f1007[_0xa57f('0x26')]]={'$like':'%'+_0x13b5c1['query'][_0xa57f('0x39')]+'%'};return _0x80fa47;}})});}_0x75d7d0=_[_0xa57f('0x38')]({},_0x75d7d0,_0x13b5c1['options']);var _0x3de95a={'where':_0x75d7d0[_0xa57f('0x36')]};return db[_0xa57f('0x2a')][_0xa57f('0x3a')](_0x3de95a)[_0xa57f('0x22')](function(_0x5f5280){_0x1ef2e1[_0xa57f('0x3a')]=_0x5f5280;if(_0x13b5c1[_0xa57f('0x2f')][_0xa57f('0x3b')]){_0x75d7d0[_0xa57f('0x3c')]=[{'all':!![]}];}return db[_0xa57f('0x2a')][_0xa57f('0x3d')](_0x75d7d0);})[_0xa57f('0x22')](function(_0x1b516e){_0x1ef2e1[_0xa57f('0x3e')]=_0x1b516e;return _0x1ef2e1;})[_0xa57f('0x22')](respondWithFilteredResult(_0x2d7360,_0x75d7d0))[_0xa57f('0x3f')](handleError(_0x2d7360,null));};exports[_0xa57f('0x40')]=function(_0x32278f,_0x3bcd2f){var _0x925fa9={'raw':!![],'where':{'id':_0x32278f[_0xa57f('0x41')]['id']}},_0x2e5a3f={};_0x2e5a3f['model']=_[_0xa57f('0x42')](db[_0xa57f('0x2a')][_0xa57f('0x2b')]);_0x2e5a3f[_0xa57f('0x2f')]=_['keys'](_0x32278f[_0xa57f('0x2f')]);_0x2e5a3f[_0xa57f('0x30')]=_['intersection'](_0x2e5a3f[_0xa57f('0x2e')],_0x2e5a3f[_0xa57f('0x2f')]);_0x925fa9[_0xa57f('0x33')]=_[_0xa57f('0x31')](_0x2e5a3f[_0xa57f('0x2e')],qs['fields'](_0x32278f[_0xa57f('0x2f')][_0xa57f('0x32')]));_0x925fa9[_0xa57f('0x33')]=_0x925fa9[_0xa57f('0x33')][_0xa57f('0x34')]?_0x925fa9[_0xa57f('0x33')]:_0x2e5a3f[_0xa57f('0x2e')];if(_0x32278f[_0xa57f('0x2f')][_0xa57f('0x3b')]){_0x925fa9[_0xa57f('0x3c')]=[{'all':!![]}];}_0x925fa9=_[_0xa57f('0x38')]({},_0x925fa9,_0x32278f['options']);return db['SquareMessage'][_0xa57f('0x43')](_0x925fa9)[_0xa57f('0x22')](handleEntityNotFound(_0x3bcd2f,null))[_0xa57f('0x22')](respondWithResult(_0x3bcd2f,null))[_0xa57f('0x3f')](handleError(_0x3bcd2f,null));};exports['create']=function(_0x275ba1,_0xac6a50){return db[_0xa57f('0x2a')][_0xa57f('0x44')](_0x275ba1[_0xa57f('0x45')],{})[_0xa57f('0x22')](respondWithResult(_0xac6a50,0xc9))[_0xa57f('0x3f')](handleError(_0xac6a50,null));};exports[_0xa57f('0x20')]=function(_0x109306,_0x1cd0d7){if(_0x109306[_0xa57f('0x45')]['id']){delete _0x109306[_0xa57f('0x45')]['id'];}return db[_0xa57f('0x2a')][_0xa57f('0x43')]({'where':{'id':_0x109306[_0xa57f('0x41')]['id']}})[_0xa57f('0x22')](handleEntityNotFound(_0x1cd0d7,null))[_0xa57f('0x22')](saveUpdates(_0x109306[_0xa57f('0x45')],null))[_0xa57f('0x22')](respondWithResult(_0x1cd0d7,null))[_0xa57f('0x3f')](handleError(_0x1cd0d7,null));};exports[_0xa57f('0x21')]=function(_0x598c8e,_0x3bebb8){return db['SquareMessage'][_0xa57f('0x43')]({'where':{'id':_0x598c8e[_0xa57f('0x41')]['id']}})['then'](handleEntityNotFound(_0x3bebb8,null))[_0xa57f('0x22')](removeEntity(_0x3bebb8,null))[_0xa57f('0x3f')](handleError(_0x3bebb8,null));}; \ No newline at end of file +var _0x9a1b=['catch','create','body','find','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length'];(function(_0x7f7491,_0x41a85d){var _0x1a70c7=function(_0x321d41){while(--_0x321d41){_0x7f7491['push'](_0x7f7491['shift']());}};_0x1a70c7(++_0x41a85d);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x4254a5,_0x2dcd00){_0x4254a5=_0x4254a5-0x0;var _0x32a21b=_0x9a1b[_0x4254a5];return _0x32a21b;};'use strict';var emlformat=require(_0xb9a1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9a1('0x1'));var moment=require(_0xb9a1('0x2'));var BPromise=require(_0xb9a1('0x3'));var Mustache=require(_0xb9a1('0x4'));var util=require('util');var path=require(_0xb9a1('0x5'));var sox=require(_0xb9a1('0x6'));var csv=require('to-csv');var ejs=require(_0xb9a1('0x7'));var fs=require('fs');var fs_extra=require(_0xb9a1('0x8'));var _=require(_0xb9a1('0x9'));var squel=require('squel');var crypto=require(_0xb9a1('0xa'));var jsforce=require(_0xb9a1('0xb'));var deskjs=require(_0xb9a1('0xc'));var toCsv=require(_0xb9a1('0xd'));var querystring=require(_0xb9a1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb9a1('0xf'));var qs=require(_0xb9a1('0x10'));var as=require(_0xb9a1('0x11'));var hardwareService=require(_0xb9a1('0x12'));var logger=require(_0xb9a1('0x13'))(_0xb9a1('0x14'));var utils=require(_0xb9a1('0x15'));var config=require(_0xb9a1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6c0544,_0x2d1356){_0x2d1356=_0x2d1356||0xcc;return function(_0x5e3f71){if(_0x5e3f71){return _0x6c0544[_0xb9a1('0x17')](_0x2d1356);}return _0x6c0544['status'](_0x2d1356)[_0xb9a1('0x18')]();};}function respondWithResult(_0x9677ee,_0x1996df){_0x1996df=_0x1996df||0xc8;return function(_0x5d92d6){if(_0x5d92d6){return _0x9677ee[_0xb9a1('0x19')](_0x1996df)[_0xb9a1('0x1a')](_0x5d92d6);}};}function respondWithFilteredResult(_0x1027d8,_0x4de0d8){return function(_0x304c9c){if(_0x304c9c){var _0x46e3a9=typeof _0x4de0d8[_0xb9a1('0x1b')]==='undefined'&&typeof _0x4de0d8[_0xb9a1('0x1c')]===_0xb9a1('0x1d');var _0x4e9037=_0x304c9c[_0xb9a1('0x1e')];var _0x27235e=_0x46e3a9?0x0:_0x4de0d8['offset'];var _0x37b9f9=_0x46e3a9?_0x304c9c[_0xb9a1('0x1e')]:_0x4de0d8[_0xb9a1('0x1b')]+_0x4de0d8[_0xb9a1('0x1c')];var _0x53e876;if(_0x37b9f9>=_0x4e9037){_0x37b9f9=_0x4e9037;_0x53e876=0xc8;}else{_0x53e876=0xce;}_0x1027d8['status'](_0x53e876);return _0x1027d8['set'](_0xb9a1('0x1f'),_0x27235e+'-'+_0x37b9f9+'/'+_0x4e9037)[_0xb9a1('0x1a')](_0x304c9c);}return null;};}function patchUpdates(_0x4be0cb){return function(_0x5c8e0c){try{jsonpatch[_0xb9a1('0x20')](_0x5c8e0c,_0x4be0cb,!![]);}catch(_0x1f1e13){return BPromise['reject'](_0x1f1e13);}return _0x5c8e0c[_0xb9a1('0x21')]();};}function saveUpdates(_0x283bf5,_0x26bca5){return function(_0xa41c40){if(_0xa41c40){return _0xa41c40[_0xb9a1('0x22')](_0x283bf5)['then'](function(_0x5b5df6){return _0x5b5df6;});}return null;};}function removeEntity(_0x286b36,_0x3f0d23){return function(_0x32bb23){if(_0x32bb23){return _0x32bb23[_0xb9a1('0x23')]()[_0xb9a1('0x24')](function(){_0x286b36['status'](0xcc)[_0xb9a1('0x18')]();});}};}function handleEntityNotFound(_0x3f9c76,_0x5eddc9){return function(_0x31b363){if(!_0x31b363){_0x3f9c76[_0xb9a1('0x17')](0x194);}return _0x31b363;};}function handleError(_0x4511a2,_0x43811c){_0x43811c=_0x43811c||0x1f4;return function(_0x1839e3){logger[_0xb9a1('0x25')](_0x1839e3[_0xb9a1('0x26')]);if(_0x1839e3[_0xb9a1('0x27')]){delete _0x1839e3['name'];}_0x4511a2['status'](_0x43811c)[_0xb9a1('0x28')](_0x1839e3);};}exports[_0xb9a1('0x29')]=function(_0x51ec61,_0x102188){var _0x3bc126={},_0x7bdc37={},_0x3e2a88={'count':0x0,'rows':[]};var _0x2b315b=_['map'](db[_0xb9a1('0x2a')][_0xb9a1('0x2b')],function(_0x4a6e7c){return{'name':_0x4a6e7c[_0xb9a1('0x2c')],'type':_0x4a6e7c[_0xb9a1('0x2d')][_0xb9a1('0x2e')]};});_0x7bdc37['model']=_[_0xb9a1('0x2f')](_0x2b315b,_0xb9a1('0x27'));_0x7bdc37[_0xb9a1('0x30')]=_[_0xb9a1('0x31')](_0x51ec61[_0xb9a1('0x30')]);_0x7bdc37[_0xb9a1('0x32')]=_[_0xb9a1('0x33')](_0x7bdc37[_0xb9a1('0x34')],_0x7bdc37['query']);_0x3bc126[_0xb9a1('0x35')]=_[_0xb9a1('0x33')](_0x7bdc37['model'],qs[_0xb9a1('0x36')](_0x51ec61['query']['fields']));_0x3bc126[_0xb9a1('0x35')]=_0x3bc126[_0xb9a1('0x35')]['length']?_0x3bc126[_0xb9a1('0x35')]:_0x7bdc37[_0xb9a1('0x34')];if(!_0x51ec61['query'][_0xb9a1('0x37')](_0xb9a1('0x38'))){_0x3bc126['limit']=qs[_0xb9a1('0x1c')](_0x51ec61[_0xb9a1('0x30')][_0xb9a1('0x1c')]);_0x3bc126[_0xb9a1('0x1b')]=qs['offset'](_0x51ec61[_0xb9a1('0x30')][_0xb9a1('0x1b')]);}_0x3bc126['order']=qs[_0xb9a1('0x39')](_0x51ec61[_0xb9a1('0x30')][_0xb9a1('0x39')]);_0x3bc126[_0xb9a1('0x3a')]=qs[_0xb9a1('0x32')](_['pick'](_0x51ec61[_0xb9a1('0x30')],_0x7bdc37[_0xb9a1('0x32')]),_0x2b315b);if(_0x51ec61[_0xb9a1('0x30')][_0xb9a1('0x3b')]){_0x3bc126['where']=_[_0xb9a1('0x3c')](_0x3bc126[_0xb9a1('0x3a')],{'$or':_[_0xb9a1('0x2f')](_0x2b315b,function(_0x1cfecd){if(_0x1cfecd['type']!==_0xb9a1('0x3d')){var _0x3c093f={};_0x3c093f[_0x1cfecd[_0xb9a1('0x27')]]={'$like':'%'+_0x51ec61['query'][_0xb9a1('0x3b')]+'%'};return _0x3c093f;}})});}_0x3bc126=_['merge']({},_0x3bc126,_0x51ec61[_0xb9a1('0x3e')]);var _0xeb47c={'where':_0x3bc126[_0xb9a1('0x3a')]};return db[_0xb9a1('0x2a')][_0xb9a1('0x1e')](_0xeb47c)[_0xb9a1('0x24')](function(_0x179099){_0x3e2a88[_0xb9a1('0x1e')]=_0x179099;if(_0x51ec61[_0xb9a1('0x30')][_0xb9a1('0x3f')]){_0x3bc126['include']=[{'all':!![]}];}return db['SquareMessage'][_0xb9a1('0x40')](_0x3bc126);})['then'](function(_0x27b317){_0x3e2a88[_0xb9a1('0x41')]=_0x27b317;return _0x3e2a88;})[_0xb9a1('0x24')](respondWithFilteredResult(_0x102188,_0x3bc126))['catch'](handleError(_0x102188,null));};exports[_0xb9a1('0x42')]=function(_0x522619,_0xeb7e57){var _0x2d116a={'raw':!![],'where':{'id':_0x522619[_0xb9a1('0x43')]['id']}},_0x341e7e={};_0x341e7e[_0xb9a1('0x34')]=_[_0xb9a1('0x31')](db[_0xb9a1('0x2a')][_0xb9a1('0x2b')]);_0x341e7e['query']=_[_0xb9a1('0x31')](_0x522619[_0xb9a1('0x30')]);_0x341e7e[_0xb9a1('0x32')]=_[_0xb9a1('0x33')](_0x341e7e[_0xb9a1('0x34')],_0x341e7e['query']);_0x2d116a[_0xb9a1('0x35')]=_[_0xb9a1('0x33')](_0x341e7e[_0xb9a1('0x34')],qs[_0xb9a1('0x36')](_0x522619['query'][_0xb9a1('0x36')]));_0x2d116a[_0xb9a1('0x35')]=_0x2d116a['attributes'][_0xb9a1('0x44')]?_0x2d116a[_0xb9a1('0x35')]:_0x341e7e['model'];if(_0x522619[_0xb9a1('0x30')][_0xb9a1('0x3f')]){_0x2d116a['include']=[{'all':!![]}];}_0x2d116a=_['merge']({},_0x2d116a,_0x522619[_0xb9a1('0x3e')]);return db[_0xb9a1('0x2a')]['find'](_0x2d116a)[_0xb9a1('0x24')](handleEntityNotFound(_0xeb7e57,null))['then'](respondWithResult(_0xeb7e57,null))[_0xb9a1('0x45')](handleError(_0xeb7e57,null));};exports[_0xb9a1('0x46')]=function(_0x4c037b,_0x2381a3){return db[_0xb9a1('0x2a')][_0xb9a1('0x46')](_0x4c037b['body'],{})[_0xb9a1('0x24')](respondWithResult(_0x2381a3,0xc9))[_0xb9a1('0x45')](handleError(_0x2381a3,null));};exports[_0xb9a1('0x22')]=function(_0x2a811e,_0x23994c){if(_0x2a811e['body']['id']){delete _0x2a811e[_0xb9a1('0x47')]['id'];}return db[_0xb9a1('0x2a')][_0xb9a1('0x48')]({'where':{'id':_0x2a811e[_0xb9a1('0x43')]['id']}})[_0xb9a1('0x24')](handleEntityNotFound(_0x23994c,null))['then'](saveUpdates(_0x2a811e[_0xb9a1('0x47')],null))[_0xb9a1('0x24')](respondWithResult(_0x23994c,null))[_0xb9a1('0x45')](handleError(_0x23994c,null));};exports['destroy']=function(_0x444962,_0x3296d5){return db[_0xb9a1('0x2a')][_0xb9a1('0x48')]({'where':{'id':_0x444962[_0xb9a1('0x43')]['id']}})['then'](handleEntityNotFound(_0x3296d5,null))[_0xb9a1('0x24')](removeEntity(_0x3296d5,null))[_0xb9a1('0x45')](handleError(_0x3296d5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3b73a32..41559ef 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91b4=['SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x91b4,0x1b4));var _0x491b=function(_0x4eedcc,_0x33451e){_0x4eedcc=_0x4eedcc-0x0;var _0x5b4891=_0x91b4[_0x4eedcc];return _0x5b4891;};'use strict';var _=require(_0x491b('0x0'));var util=require(_0x491b('0x1'));var logger=require(_0x491b('0x2'))(_0x491b('0x3'));var moment=require(_0x491b('0x4'));var BPromise=require(_0x491b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x491b('0x6'));var rimraf=require(_0x491b('0x7'));var config=require(_0x491b('0x8'));var attributes=require(_0x491b('0x9'));module[_0x491b('0xa')]=function(_0x533153,_0xc9b769){return _0x533153[_0x491b('0xb')](_0x491b('0xc'),attributes,{'tableName':_0x491b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4db3=['api','moment','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4db3,0xf9));var _0x34db=function(_0x231940,_0x24aacb){_0x231940=_0x231940-0x0;var _0x3e0d75=_0x4db3[_0x231940];return _0x3e0d75;};'use strict';var _=require(_0x34db('0x0'));var util=require(_0x34db('0x1'));var logger=require(_0x34db('0x2'))(_0x34db('0x3'));var moment=require(_0x34db('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x34db('0x5'));var config=require(_0x34db('0x6'));var attributes=require(_0x34db('0x7'));module[_0x34db('0x8')]=function(_0x53c406,_0x1f4d33){return _0x53c406[_0x34db('0x9')](_0x34db('0xa'),attributes,{'tableName':_0x34db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 504526c..2218737 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef9c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','SquareMessage,\x20%s,\x20%s','catch','create','body','options','then','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x47a4fb,_0x456352){var _0x3571c5=function(_0x5edf6d){while(--_0x5edf6d){_0x47a4fb['push'](_0x47a4fb['shift']());}};_0x3571c5(++_0x456352);}(_0xef9c,0x7c));var _0xcef9=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0xef9c[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require(_0xcef9('0x0'));var util=require(_0xcef9('0x1'));var moment=require(_0xcef9('0x2'));var BPromise=require(_0xcef9('0x3'));var rs=require(_0xcef9('0x4'));var fs=require('fs');var Redis=require(_0xcef9('0x5'));var db=require(_0xcef9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcef9('0x7'))(_0xcef9('0x8'));var config=require(_0xcef9('0x9'));var jayson=require(_0xcef9('0xa'));var client=jayson[_0xcef9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf1d736,_0x48d103,_0x388c64){return new BPromise(function(_0x35d7ba,_0x2f6f0d){return client[_0xcef9('0xc')](_0xf1d736,_0x388c64)['then'](function(_0x37df5f){logger[_0xcef9('0xd')]('SquareMessage,\x20%s,\x20%s',_0x48d103,_0xcef9('0xe'));logger['debug'](_0xcef9('0xf'),_0x48d103,'request\x20sent',JSON['stringify'](_0x37df5f));if(_0x37df5f[_0xcef9('0x10')]){if(_0x37df5f[_0xcef9('0x10')][_0xcef9('0x11')]===0x1f4){logger[_0xcef9('0x10')]('SquareMessage,\x20%s,\x20%s',_0x48d103,_0x37df5f[_0xcef9('0x10')][_0xcef9('0x12')]);return _0x2f6f0d(_0x37df5f[_0xcef9('0x10')][_0xcef9('0x12')]);}logger[_0xcef9('0x10')](_0xcef9('0x13'),_0x48d103,_0x37df5f[_0xcef9('0x10')]['message']);return _0x35d7ba(_0x37df5f['error']['message']);}else{logger[_0xcef9('0xd')](_0xcef9('0x13'),_0x48d103,_0xcef9('0xe'));_0x35d7ba(_0x37df5f['result'][_0xcef9('0x12')]);}})[_0xcef9('0x14')](function(_0x24cf30){logger['error'](_0xcef9('0x13'),_0x48d103,_0x24cf30);_0x2f6f0d(_0x24cf30);});});}exports['CreateSquareMessage']=function(_0x22909e){var _0x489cbb=this;return new Promise(function(_0x1fdd03,_0x560219){return db['SquareMessage'][_0xcef9('0x15')](_0x22909e[_0xcef9('0x16')],{'raw':_0x22909e[_0xcef9('0x17')]?_0x22909e[_0xcef9('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xcef9('0x18')](function(_0x128208){logger[_0xcef9('0xd')]('CreateSquareMessage',_0x22909e);logger['debug'](_0xcef9('0x19'),_0x22909e,JSON['stringify'](_0x128208));_0x1fdd03(_0x128208);})['catch'](function(_0x57f245){logger[_0xcef9('0x10')](_0xcef9('0x19'),_0x57f245[_0xcef9('0x12')],_0x22909e);_0x560219(_0x489cbb[_0xcef9('0x10')](0x1f4,_0x57f245[_0xcef9('0x12')]));});});}; \ No newline at end of file +var _0xc097=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','message','SquareMessage,\x20%s,\x20%s','result','catch','SquareMessage','body','options','raw','info','CreateSquareMessage','lodash','util','randomstring','ioredis'];(function(_0x92e5e1,_0x4a1788){var _0x4173bd=function(_0x56ec45){while(--_0x56ec45){_0x92e5e1['push'](_0x92e5e1['shift']());}};_0x4173bd(++_0x4a1788);}(_0xc097,0x64));var _0x7c09=function(_0x5e6b83,_0x33ebf8){_0x5e6b83=_0x5e6b83-0x0;var _0x4f5c9e=_0xc097[_0x5e6b83];return _0x4f5c9e;};'use strict';var _=require(_0x7c09('0x0'));var util=require(_0x7c09('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c09('0x2'));var fs=require('fs');var Redis=require(_0x7c09('0x3'));var db=require(_0x7c09('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c09('0x5'))(_0x7c09('0x6'));var config=require(_0x7c09('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7c09('0x8')][_0x7c09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d7daa,_0x487e46,_0x2c0292){return new BPromise(function(_0x25db3d,_0x2454e4){return client[_0x7c09('0xa')](_0x5d7daa,_0x2c0292)[_0x7c09('0xb')](function(_0x289455){logger['info']('SquareMessage,\x20%s,\x20%s',_0x487e46,_0x7c09('0xc'));logger[_0x7c09('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x487e46,_0x7c09('0xc'),JSON[_0x7c09('0xe')](_0x289455));if(_0x289455[_0x7c09('0xf')]){if(_0x289455[_0x7c09('0xf')]['code']===0x1f4){logger[_0x7c09('0xf')]('SquareMessage,\x20%s,\x20%s',_0x487e46,_0x289455[_0x7c09('0xf')][_0x7c09('0x10')]);return _0x2454e4(_0x289455[_0x7c09('0xf')]['message']);}logger[_0x7c09('0xf')]('SquareMessage,\x20%s,\x20%s',_0x487e46,_0x289455[_0x7c09('0xf')][_0x7c09('0x10')]);return _0x25db3d(_0x289455[_0x7c09('0xf')][_0x7c09('0x10')]);}else{logger['info'](_0x7c09('0x11'),_0x487e46,_0x7c09('0xc'));_0x25db3d(_0x289455[_0x7c09('0x12')]['message']);}})[_0x7c09('0x13')](function(_0x1357c0){logger['error'](_0x7c09('0x11'),_0x487e46,_0x1357c0);_0x2454e4(_0x1357c0);});});}exports['CreateSquareMessage']=function(_0x53c6b9){var _0xfb9e49=this;return new Promise(function(_0x3e54d9,_0x29d0e1){return db[_0x7c09('0x14')]['create'](_0x53c6b9[_0x7c09('0x15')],{'raw':_0x53c6b9[_0x7c09('0x16')]?_0x53c6b9[_0x7c09('0x16')][_0x7c09('0x17')]===undefined?!![]:![]:!![]})[_0x7c09('0xb')](function(_0x4d7dae){logger[_0x7c09('0x18')](_0x7c09('0x19'),_0x53c6b9);logger[_0x7c09('0xd')](_0x7c09('0x19'),_0x53c6b9,JSON[_0x7c09('0xe')](_0x4d7dae));_0x3e54d9(_0x4d7dae);})[_0x7c09('0x13')](function(_0x5ab240){logger[_0x7c09('0xf')](_0x7c09('0x19'),_0x5ab240['message'],_0x53c6b9);_0x29d0e1(_0xfb9e49['error'](0x1f4,_0x5ab240[_0x7c09('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 53825fe..a57cc6a 100644 --- a/server/api/squareOdbc/index.js +++ b/server/api/squareOdbc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0573=['index','get','/:id','show','15s','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated'];(function(_0x3f83e6,_0x2b934c){var _0x2ed5b5=function(_0x585962){while(--_0x585962){_0x3f83e6['push'](_0x3f83e6['shift']());}};_0x2ed5b5(++_0x2b934c);}(_0x0573,0x1d9));var _0x3057=function(_0x37185d,_0x2643e1){_0x37185d=_0x37185d-0x0;var _0x3785f5=_0x0573[_0x37185d];return _0x3785f5;};'use strict';var multer=require(_0x3057('0x0'));var util=require('util');var path=require(_0x3057('0x1'));var timeout=require('connect-timeout');var express=require(_0x3057('0x2'));var router=express[_0x3057('0x3')]();var fs_extra=require(_0x3057('0x4'));var auth=require(_0x3057('0x5'));var interaction=require(_0x3057('0x6'));var config=require(_0x3057('0x7'));var controller=require(_0x3057('0x8'));router['get']('/',auth[_0x3057('0x9')](),controller[_0x3057('0xa')]);router[_0x3057('0xb')](_0x3057('0xc'),auth[_0x3057('0x9')](),controller[_0x3057('0xd')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout(_0x3057('0xe')),controller['test']);router[_0x3057('0xf')]('/',auth[_0x3057('0x9')](),controller[_0x3057('0x10')]);router[_0x3057('0x11')](_0x3057('0xc'),auth['isAuthenticated'](),controller[_0x3057('0x12')]);router['delete'](_0x3057('0xc'),auth[_0x3057('0x9')](),controller[_0x3057('0x13')]);module[_0x3057('0x14')]=router; \ No newline at end of file +var _0x809d=['connect-timeout','express','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','put','update','exports','util','path'];(function(_0x1fcf4c,_0x1c68f1){var _0xe80bfb=function(_0x4549d5){while(--_0x4549d5){_0x1fcf4c['push'](_0x1fcf4c['shift']());}};_0xe80bfb(++_0x1c68f1);}(_0x809d,0x154));var _0xd809=function(_0x17b9bc,_0x493077){_0x17b9bc=_0x17b9bc-0x0;var _0x45efdb=_0x809d[_0x17b9bc];return _0x45efdb;};'use strict';var multer=require('multer');var util=require(_0xd809('0x0'));var path=require(_0xd809('0x1'));var timeout=require(_0xd809('0x2'));var express=require(_0xd809('0x3'));var router=express['Router']();var fs_extra=require(_0xd809('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd809('0x5'));var config=require('../../config/environment');var controller=require(_0xd809('0x6'));router[_0xd809('0x7')]('/',auth[_0xd809('0x8')](),controller[_0xd809('0x9')]);router['get'](_0xd809('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd809('0x7')](_0xd809('0xb'),auth[_0xd809('0x8')](),timeout(_0xd809('0xc')),controller[_0xd809('0xd')]);router[_0xd809('0xe')]('/',auth['isAuthenticated'](),controller[_0xd809('0xf')]);router[_0xd809('0x10')]('/:id',auth[_0xd809('0x8')](),controller[_0xd809('0x11')]);router['delete'](_0xd809('0xa'),auth[_0xd809('0x8')](),controller['destroy']);module[_0xd809('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 50e1e77..6253b1c 100644 --- a/server/api/squareOdbc/squareOdbc.attributes.js +++ b/server/api/squareOdbc/squareOdbc.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ae7=['sequelize','STRING'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5ae7,0x140));var _0x75ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5ae7[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x75ae('0x0'));module['exports']={'name':{'type':Sequelize[_0x75ae('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x75ae('0x1')]},'description':{'type':Sequelize[_0x75ae('0x1')]}}; \ No newline at end of file +var _0x67d2=['STRING','exports'];(function(_0xce1ae7,_0x47a304){var _0x4f359d=function(_0x45d8b8){while(--_0x45d8b8){_0xce1ae7['push'](_0xce1ae7['shift']());}};_0x4f359d(++_0x47a304);}(_0x67d2,0x123));var _0x267d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x67d2[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x267d('0x0')]={'name':{'type':Sequelize[_0x267d('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x267d('0x1')]},'description':{'type':Sequelize[_0x267d('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 612a1f9..0174959 100644 --- a/server/api/squareOdbc/squareOdbc.controller.js +++ b/server/api/squareOdbc/squareOdbc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c6c=['findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','get','ODBC','sendStatus','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x2c6c,0x1cd));var _0xc2c6=function(_0x428dd6,_0x5d9251){_0x428dd6=_0x428dd6-0x0;var _0x88c742=_0x2c6c[_0x428dd6];return _0x88c742;};'use strict';var emlformat=require(_0xc2c6('0x0'));var rimraf=require(_0xc2c6('0x1'));var zipdir=require(_0xc2c6('0x2'));var jsonpatch=require(_0xc2c6('0x3'));var rp=require(_0xc2c6('0x4'));var moment=require(_0xc2c6('0x5'));var BPromise=require(_0xc2c6('0x6'));var Mustache=require(_0xc2c6('0x7'));var util=require(_0xc2c6('0x8'));var path=require(_0xc2c6('0x9'));var sox=require(_0xc2c6('0xa'));var csv=require(_0xc2c6('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2c6('0xc'));var _=require(_0xc2c6('0xd'));var squel=require(_0xc2c6('0xe'));var crypto=require(_0xc2c6('0xf'));var jsforce=require(_0xc2c6('0x10'));var deskjs=require(_0xc2c6('0x11'));var toCsv=require(_0xc2c6('0xb'));var querystring=require(_0xc2c6('0x12'));var Papa=require(_0xc2c6('0x13'));var Redis=require('ioredis');var authService=require(_0xc2c6('0x14'));var qs=require(_0xc2c6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2c6('0x16'));var logger=require(_0xc2c6('0x17'))(_0xc2c6('0x18'));var utils=require(_0xc2c6('0x19'));var config=require(_0xc2c6('0x1a'));var licenseUtil=require(_0xc2c6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x594404,_0x15508f){_0x15508f=_0x15508f||0xcc;return function(_0x4a0918){if(_0x4a0918){return _0x594404['sendStatus'](_0x15508f);}return _0x594404[_0xc2c6('0x1c')](_0x15508f)[_0xc2c6('0x1d')]();};}function respondWithResult(_0x3b7e97,_0x303b68){_0x303b68=_0x303b68||0xc8;return function(_0x5a31be){if(_0x5a31be){return _0x3b7e97[_0xc2c6('0x1c')](_0x303b68)[_0xc2c6('0x1e')](_0x5a31be);}};}function respondWithFilteredResult(_0x43803a,_0x20d076){return function(_0x38889a){if(_0x38889a){var _0x32435f=typeof _0x20d076[_0xc2c6('0x1f')]===_0xc2c6('0x20')&&typeof _0x20d076[_0xc2c6('0x21')]==='undefined';var _0x2044d1=_0x38889a['count'];var _0x1e96d2=_0x32435f?0x0:_0x20d076[_0xc2c6('0x1f')];var _0x1b479f=_0x32435f?_0x38889a[_0xc2c6('0x22')]:_0x20d076[_0xc2c6('0x1f')]+_0x20d076[_0xc2c6('0x21')];var _0x4047d;if(_0x1b479f>=_0x2044d1){_0x1b479f=_0x2044d1;_0x4047d=0xc8;}else{_0x4047d=0xce;}_0x43803a['status'](_0x4047d);return _0x43803a[_0xc2c6('0x23')]('Content-Range',_0x1e96d2+'-'+_0x1b479f+'/'+_0x2044d1)[_0xc2c6('0x1e')](_0x38889a);}return null;};}function patchUpdates(_0x1a77ec){return function(_0x23d9c0){try{jsonpatch[_0xc2c6('0x24')](_0x23d9c0,_0x1a77ec,!![]);}catch(_0x5ca9c9){return BPromise['reject'](_0x5ca9c9);}return _0x23d9c0[_0xc2c6('0x25')]();};}function saveUpdates(_0xe00a6f,_0x1cf4a1){return function(_0x1dc456){if(_0x1dc456){return _0x1dc456[_0xc2c6('0x26')](_0xe00a6f)['then'](function(_0x6892d8){return _0x6892d8;});}return null;};}function removeEntity(_0x3058d9,_0x4bb48c){return function(_0x99c3c5){if(_0x99c3c5){return _0x99c3c5[_0xc2c6('0x27')]()[_0xc2c6('0x28')](function(){var _0x560edf=_0x99c3c5[_0xc2c6('0x29')]({'plain':!![]});var _0xe7c851=_0xc2c6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0xe7c851,'resourceId':_0x560edf['id']}})['then'](function(){return _0x99c3c5;});})[_0xc2c6('0x28')](function(){_0x3058d9[_0xc2c6('0x1c')](0xcc)[_0xc2c6('0x1d')]();});}};}function handleEntityNotFound(_0x34f897,_0x5f4e9a){return function(_0x195ff8){if(!_0x195ff8){_0x34f897[_0xc2c6('0x2b')](0x194);}return _0x195ff8;};}function handleError(_0x151ae5,_0x3108a8){_0x3108a8=_0x3108a8||0x1f4;return function(_0x30d5e2){logger['error'](_0x30d5e2['stack']);if(_0x30d5e2[_0xc2c6('0x2c')]){delete _0x30d5e2[_0xc2c6('0x2c')];}_0x151ae5['status'](_0x3108a8)[_0xc2c6('0x2d')](_0x30d5e2);};}exports['index']=function(_0x488295,_0x5f17eb){var _0x278c17={},_0x5214c9={},_0x501a3b={'count':0x0,'rows':[]};var _0x3d5638=_[_0xc2c6('0x2e')](db[_0xc2c6('0x2f')][_0xc2c6('0x30')],function(_0x1563f9){return{'name':_0x1563f9[_0xc2c6('0x31')],'type':_0x1563f9[_0xc2c6('0x32')][_0xc2c6('0x33')]};});_0x5214c9[_0xc2c6('0x34')]=_[_0xc2c6('0x2e')](_0x3d5638,_0xc2c6('0x2c'));_0x5214c9[_0xc2c6('0x35')]=_[_0xc2c6('0x36')](_0x488295[_0xc2c6('0x35')]);_0x5214c9['filters']=_['intersection'](_0x5214c9[_0xc2c6('0x34')],_0x5214c9[_0xc2c6('0x35')]);_0x278c17[_0xc2c6('0x37')]=_[_0xc2c6('0x38')](_0x5214c9[_0xc2c6('0x34')],qs[_0xc2c6('0x39')](_0x488295[_0xc2c6('0x35')][_0xc2c6('0x39')]));_0x278c17[_0xc2c6('0x37')]=_0x278c17[_0xc2c6('0x37')]['length']?_0x278c17[_0xc2c6('0x37')]:_0x5214c9[_0xc2c6('0x34')];if(!_0x488295[_0xc2c6('0x35')][_0xc2c6('0x3a')]('nolimit')){_0x278c17[_0xc2c6('0x21')]=qs[_0xc2c6('0x21')](_0x488295[_0xc2c6('0x35')][_0xc2c6('0x21')]);_0x278c17[_0xc2c6('0x1f')]=qs[_0xc2c6('0x1f')](_0x488295[_0xc2c6('0x35')][_0xc2c6('0x1f')]);}_0x278c17[_0xc2c6('0x3b')]=qs[_0xc2c6('0x3c')](_0x488295['query'][_0xc2c6('0x3c')]);_0x278c17[_0xc2c6('0x3d')]=qs['filters'](_['pick'](_0x488295[_0xc2c6('0x35')],_0x5214c9[_0xc2c6('0x3e')]),_0x3d5638);if(_0x488295[_0xc2c6('0x35')]['filter']){_0x278c17[_0xc2c6('0x3d')]=_[_0xc2c6('0x3f')](_0x278c17[_0xc2c6('0x3d')],{'$or':_[_0xc2c6('0x2e')](_0x3d5638,function(_0x153828){if(_0x153828[_0xc2c6('0x32')]!==_0xc2c6('0x40')){var _0x51fcf2={};_0x51fcf2[_0x153828[_0xc2c6('0x2c')]]={'$like':'%'+_0x488295[_0xc2c6('0x35')][_0xc2c6('0x41')]+'%'};return _0x51fcf2;}})});}_0x278c17=_[_0xc2c6('0x3f')]({},_0x278c17,_0x488295[_0xc2c6('0x42')]);var _0x88d662={'where':_0x278c17['where']};return db[_0xc2c6('0x2f')][_0xc2c6('0x22')](_0x88d662)['then'](function(_0x285117){_0x501a3b['count']=_0x285117;if(_0x488295[_0xc2c6('0x35')]['includeAll']){_0x278c17['include']=[{'all':!![]}];}return db[_0xc2c6('0x2f')][_0xc2c6('0x43')](_0x278c17);})[_0xc2c6('0x28')](function(_0xaabcfe){_0x501a3b[_0xc2c6('0x44')]=_0xaabcfe;return _0x501a3b;})[_0xc2c6('0x28')](respondWithFilteredResult(_0x5f17eb,_0x278c17))[_0xc2c6('0x45')](handleError(_0x5f17eb,null));};exports[_0xc2c6('0x46')]=function(_0x132066,_0x411b4c){var _0x40faf3={'raw':!![],'where':{'id':_0x132066['params']['id']}},_0x445e42={};_0x445e42['model']=_[_0xc2c6('0x36')](db[_0xc2c6('0x2f')]['rawAttributes']);_0x445e42[_0xc2c6('0x35')]=_['keys'](_0x132066['query']);_0x445e42[_0xc2c6('0x3e')]=_[_0xc2c6('0x38')](_0x445e42[_0xc2c6('0x34')],_0x445e42['query']);_0x40faf3['attributes']=_[_0xc2c6('0x38')](_0x445e42[_0xc2c6('0x34')],qs['fields'](_0x132066[_0xc2c6('0x35')]['fields']));_0x40faf3[_0xc2c6('0x37')]=_0x40faf3[_0xc2c6('0x37')]['length']?_0x40faf3[_0xc2c6('0x37')]:_0x445e42[_0xc2c6('0x34')];if(_0x132066[_0xc2c6('0x35')]['includeAll']){_0x40faf3[_0xc2c6('0x47')]=[{'all':!![]}];}_0x40faf3=_[_0xc2c6('0x3f')]({},_0x40faf3,_0x132066['options']);return db[_0xc2c6('0x2f')][_0xc2c6('0x48')](_0x40faf3)['then'](handleEntityNotFound(_0x411b4c,null))[_0xc2c6('0x28')](respondWithResult(_0x411b4c,null))['catch'](handleError(_0x411b4c,null));};exports[_0xc2c6('0x49')]=function(_0x5680ea,_0x4bfcd0){return db[_0xc2c6('0x2f')]['create'](_0x5680ea[_0xc2c6('0x4a')],{})['then'](function(_0x6a19f1){var _0x17d875=_0x5680ea[_0xc2c6('0x4b')][_0xc2c6('0x29')]({'plain':!![]});if(!_0x17d875)throw new Error(_0xc2c6('0x4c'));if(_0x17d875[_0xc2c6('0x4d')]===_0xc2c6('0x4b')){var _0x51e5e9=_0x6a19f1[_0xc2c6('0x29')]({'plain':!![]});var _0x512ee0=_0xc2c6('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x512ee0,'userProfileId':_0x17d875[_0xc2c6('0x4e')]},'raw':!![]})['then'](function(_0x3e42dc){if(_0x3e42dc&&_0x3e42dc[_0xc2c6('0x4f')]===0x0){return db[_0xc2c6('0x50')][_0xc2c6('0x49')]({'name':_0x51e5e9[_0xc2c6('0x2c')],'resourceId':_0x51e5e9['id'],'type':_0x3e42dc[_0xc2c6('0x2c')],'sectionId':_0x3e42dc['id']},{})['then'](function(){return _0x6a19f1;});}else{return _0x6a19f1;}})['catch'](function(_0x43599a){logger[_0xc2c6('0x51')](_0xc2c6('0x52'),_0x43599a);throw _0x43599a;});}return _0x6a19f1;})['then'](respondWithResult(_0x4bfcd0,0xc9))[_0xc2c6('0x45')](handleError(_0x4bfcd0,null));};exports[_0xc2c6('0x26')]=function(_0x1cd0c1,_0x404b55){if(_0x1cd0c1[_0xc2c6('0x4a')]['id']){delete _0x1cd0c1[_0xc2c6('0x4a')]['id'];}return db['SquareOdbc'][_0xc2c6('0x48')]({'where':{'id':_0x1cd0c1['params']['id']}})['then'](handleEntityNotFound(_0x404b55,null))[_0xc2c6('0x28')](saveUpdates(_0x1cd0c1[_0xc2c6('0x4a')],null))[_0xc2c6('0x28')](respondWithResult(_0x404b55,null))[_0xc2c6('0x45')](handleError(_0x404b55,null));};exports[_0xc2c6('0x27')]=function(_0x2decb3,_0x3384ac){return db[_0xc2c6('0x2f')][_0xc2c6('0x48')]({'where':{'id':_0x2decb3[_0xc2c6('0x53')]['id']}})['then'](handleEntityNotFound(_0x3384ac,null))[_0xc2c6('0x28')](removeEntity(_0x3384ac,null))[_0xc2c6('0x45')](handleError(_0x3384ac,null));};exports[_0xc2c6('0x54')]=function(_0x1452ab,_0x2ae7da,_0x267cb4){var _0x2f20f8;return db['SquareOdbc'][_0xc2c6('0x48')]({'where':{'id':_0x1452ab[_0xc2c6('0x53')]['id']},'attributes':['id',_0xc2c6('0x55')]})[_0xc2c6('0x28')](handleEntityNotFound(_0x2ae7da,null))[_0xc2c6('0x28')](function(_0x5969f2){if(_0x5969f2){var _0x3ecf80=require(_0xc2c6('0x56'))();_0x3ecf80[_0xc2c6('0x57')](_0x5969f2[_0xc2c6('0x55')]);_0x3ecf80['closeSync']();return _0x5969f2;}})['then'](respondWithResult(_0x2ae7da,null))[_0xc2c6('0x45')](handleError(_0x2ae7da,null));}; \ No newline at end of file +var _0xcbad=['attributes','fields','length','hasOwnProperty','sort','filter','merge','where','options','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','fieldName','type','model','query','keys','filters'];(function(_0x4564d0,_0x5da430){var _0x45e98c=function(_0x5c0568){while(--_0x5c0568){_0x4564d0['push'](_0x4564d0['shift']());}};_0x45e98c(++_0x5da430);}(_0xcbad,0x1bd));var _0xdcba=function(_0x3aba52,_0x1e76a7){_0x3aba52=_0x3aba52-0x0;var _0x2e1a8a=_0xcbad[_0x3aba52];return _0x2e1a8a;};'use strict';var emlformat=require(_0xdcba('0x0'));var rimraf=require(_0xdcba('0x1'));var zipdir=require(_0xdcba('0x2'));var jsonpatch=require(_0xdcba('0x3'));var rp=require(_0xdcba('0x4'));var moment=require(_0xdcba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdcba('0x6'));var util=require(_0xdcba('0x7'));var path=require(_0xdcba('0x8'));var sox=require('sox');var csv=require(_0xdcba('0x9'));var ejs=require(_0xdcba('0xa'));var fs=require('fs');var fs_extra=require(_0xdcba('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdcba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdcba('0xd'));var toCsv=require(_0xdcba('0x9'));var querystring=require(_0xdcba('0xe'));var Papa=require(_0xdcba('0xf'));var Redis=require('ioredis');var authService=require(_0xdcba('0x10'));var qs=require(_0xdcba('0x11'));var as=require(_0xdcba('0x12'));var hardwareService=require(_0xdcba('0x13'));var logger=require(_0xdcba('0x14'))(_0xdcba('0x15'));var utils=require(_0xdcba('0x16'));var config=require(_0xdcba('0x17'));var licenseUtil=require(_0xdcba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45471c,_0x4bfa2d){_0x4bfa2d=_0x4bfa2d||0xcc;return function(_0x196abc){if(_0x196abc){return _0x45471c[_0xdcba('0x19')](_0x4bfa2d);}return _0x45471c[_0xdcba('0x1a')](_0x4bfa2d)[_0xdcba('0x1b')]();};}function respondWithResult(_0x18237f,_0x187451){_0x187451=_0x187451||0xc8;return function(_0x47b17){if(_0x47b17){return _0x18237f['status'](_0x187451)[_0xdcba('0x1c')](_0x47b17);}};}function respondWithFilteredResult(_0xf7ccca,_0x40ba4c){return function(_0x4a0c49){if(_0x4a0c49){var _0x3f72c8=typeof _0x40ba4c[_0xdcba('0x1d')]===_0xdcba('0x1e')&&typeof _0x40ba4c[_0xdcba('0x1f')]===_0xdcba('0x1e');var _0x3d0880=_0x4a0c49[_0xdcba('0x20')];var _0x1e63eb=_0x3f72c8?0x0:_0x40ba4c[_0xdcba('0x1d')];var _0x142411=_0x3f72c8?_0x4a0c49['count']:_0x40ba4c[_0xdcba('0x1d')]+_0x40ba4c[_0xdcba('0x1f')];var _0x334c2a;if(_0x142411>=_0x3d0880){_0x142411=_0x3d0880;_0x334c2a=0xc8;}else{_0x334c2a=0xce;}_0xf7ccca[_0xdcba('0x1a')](_0x334c2a);return _0xf7ccca['set']('Content-Range',_0x1e63eb+'-'+_0x142411+'/'+_0x3d0880)[_0xdcba('0x1c')](_0x4a0c49);}return null;};}function patchUpdates(_0xdc9aaf){return function(_0x52a958){try{jsonpatch[_0xdcba('0x21')](_0x52a958,_0xdc9aaf,!![]);}catch(_0x30c14b){return BPromise[_0xdcba('0x22')](_0x30c14b);}return _0x52a958['save']();};}function saveUpdates(_0x3a1a5e,_0x30419c){return function(_0x4e505a){if(_0x4e505a){return _0x4e505a[_0xdcba('0x23')](_0x3a1a5e)[_0xdcba('0x24')](function(_0x25d790){return _0x25d790;});}return null;};}function removeEntity(_0x3b5921,_0x28637c){return function(_0x5b7e37){if(_0x5b7e37){return _0x5b7e37[_0xdcba('0x25')]()['then'](function(){var _0xac6083=_0x5b7e37['get']({'plain':!![]});var _0x3708ec=_0xdcba('0x26');return db[_0xdcba('0x27')]['destroy']({'where':{'type':_0x3708ec,'resourceId':_0xac6083['id']}})[_0xdcba('0x24')](function(){return _0x5b7e37;});})[_0xdcba('0x24')](function(){_0x3b5921[_0xdcba('0x1a')](0xcc)[_0xdcba('0x1b')]();});}};}function handleEntityNotFound(_0x3d1781,_0x541fe7){return function(_0x16a819){if(!_0x16a819){_0x3d1781['sendStatus'](0x194);}return _0x16a819;};}function handleError(_0x3f98b1,_0x373c39){_0x373c39=_0x373c39||0x1f4;return function(_0x22f641){logger[_0xdcba('0x28')](_0x22f641[_0xdcba('0x29')]);if(_0x22f641[_0xdcba('0x2a')]){delete _0x22f641[_0xdcba('0x2a')];}_0x3f98b1[_0xdcba('0x1a')](_0x373c39)[_0xdcba('0x2b')](_0x22f641);};}exports[_0xdcba('0x2c')]=function(_0x458cb4,_0x1b845c){var _0x1a1015={},_0xe663f8={},_0x22a4fb={'count':0x0,'rows':[]};var _0x47aa6f=_[_0xdcba('0x2d')](db[_0xdcba('0x2e')]['rawAttributes'],function(_0x4b6c41){return{'name':_0x4b6c41[_0xdcba('0x2f')],'type':_0x4b6c41[_0xdcba('0x30')]['key']};});_0xe663f8[_0xdcba('0x31')]=_[_0xdcba('0x2d')](_0x47aa6f,'name');_0xe663f8[_0xdcba('0x32')]=_[_0xdcba('0x33')](_0x458cb4[_0xdcba('0x32')]);_0xe663f8[_0xdcba('0x34')]=_['intersection'](_0xe663f8[_0xdcba('0x31')],_0xe663f8[_0xdcba('0x32')]);_0x1a1015[_0xdcba('0x35')]=_['intersection'](_0xe663f8[_0xdcba('0x31')],qs['fields'](_0x458cb4['query'][_0xdcba('0x36')]));_0x1a1015['attributes']=_0x1a1015['attributes'][_0xdcba('0x37')]?_0x1a1015['attributes']:_0xe663f8['model'];if(!_0x458cb4[_0xdcba('0x32')][_0xdcba('0x38')]('nolimit')){_0x1a1015['limit']=qs[_0xdcba('0x1f')](_0x458cb4[_0xdcba('0x32')][_0xdcba('0x1f')]);_0x1a1015[_0xdcba('0x1d')]=qs[_0xdcba('0x1d')](_0x458cb4['query'][_0xdcba('0x1d')]);}_0x1a1015['order']=qs[_0xdcba('0x39')](_0x458cb4[_0xdcba('0x32')][_0xdcba('0x39')]);_0x1a1015['where']=qs[_0xdcba('0x34')](_['pick'](_0x458cb4[_0xdcba('0x32')],_0xe663f8[_0xdcba('0x34')]),_0x47aa6f);if(_0x458cb4[_0xdcba('0x32')][_0xdcba('0x3a')]){_0x1a1015['where']=_[_0xdcba('0x3b')](_0x1a1015[_0xdcba('0x3c')],{'$or':_[_0xdcba('0x2d')](_0x47aa6f,function(_0x303a27){if(_0x303a27['type']!=='VIRTUAL'){var _0x9beb3={};_0x9beb3[_0x303a27[_0xdcba('0x2a')]]={'$like':'%'+_0x458cb4[_0xdcba('0x32')][_0xdcba('0x3a')]+'%'};return _0x9beb3;}})});}_0x1a1015=_[_0xdcba('0x3b')]({},_0x1a1015,_0x458cb4[_0xdcba('0x3d')]);var _0x2fc879={'where':_0x1a1015[_0xdcba('0x3c')]};return db[_0xdcba('0x2e')]['count'](_0x2fc879)[_0xdcba('0x24')](function(_0x247a58){_0x22a4fb[_0xdcba('0x20')]=_0x247a58;if(_0x458cb4[_0xdcba('0x32')]['includeAll']){_0x1a1015['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xdcba('0x3e')](_0x1a1015);})[_0xdcba('0x24')](function(_0x5bc721){_0x22a4fb[_0xdcba('0x3f')]=_0x5bc721;return _0x22a4fb;})[_0xdcba('0x24')](respondWithFilteredResult(_0x1b845c,_0x1a1015))[_0xdcba('0x40')](handleError(_0x1b845c,null));};exports[_0xdcba('0x41')]=function(_0x343d62,_0x4f3b9a){var _0x3032e2={'raw':!![],'where':{'id':_0x343d62[_0xdcba('0x42')]['id']}},_0x13d999={};_0x13d999['model']=_[_0xdcba('0x33')](db[_0xdcba('0x2e')][_0xdcba('0x43')]);_0x13d999[_0xdcba('0x32')]=_[_0xdcba('0x33')](_0x343d62[_0xdcba('0x32')]);_0x13d999[_0xdcba('0x34')]=_[_0xdcba('0x44')](_0x13d999[_0xdcba('0x31')],_0x13d999['query']);_0x3032e2[_0xdcba('0x35')]=_[_0xdcba('0x44')](_0x13d999['model'],qs[_0xdcba('0x36')](_0x343d62['query'][_0xdcba('0x36')]));_0x3032e2[_0xdcba('0x35')]=_0x3032e2[_0xdcba('0x35')]['length']?_0x3032e2['attributes']:_0x13d999[_0xdcba('0x31')];if(_0x343d62['query'][_0xdcba('0x45')]){_0x3032e2[_0xdcba('0x46')]=[{'all':!![]}];}_0x3032e2=_['merge']({},_0x3032e2,_0x343d62[_0xdcba('0x3d')]);return db[_0xdcba('0x2e')][_0xdcba('0x47')](_0x3032e2)[_0xdcba('0x24')](handleEntityNotFound(_0x4f3b9a,null))[_0xdcba('0x24')](respondWithResult(_0x4f3b9a,null))[_0xdcba('0x40')](handleError(_0x4f3b9a,null));};exports[_0xdcba('0x48')]=function(_0x263103,_0x5d19e0){return db[_0xdcba('0x2e')][_0xdcba('0x48')](_0x263103[_0xdcba('0x49')],{})[_0xdcba('0x24')](function(_0x59d641){var _0x27b2d7=_0x263103[_0xdcba('0x4a')][_0xdcba('0x4b')]({'plain':!![]});if(!_0x27b2d7)throw new Error(_0xdcba('0x4c'));if(_0x27b2d7[_0xdcba('0x4d')]==='user'){var _0x1115e4=_0x59d641[_0xdcba('0x4b')]({'plain':!![]});var _0xdc3377=_0xdcba('0x26');return db[_0xdcba('0x4e')][_0xdcba('0x47')]({'where':{'name':_0xdc3377,'userProfileId':_0x27b2d7[_0xdcba('0x4f')]},'raw':!![]})['then'](function(_0x530238){if(_0x530238&&_0x530238['autoAssociation']===0x0){return db[_0xdcba('0x27')]['create']({'name':_0x1115e4[_0xdcba('0x2a')],'resourceId':_0x1115e4['id'],'type':_0x530238[_0xdcba('0x2a')],'sectionId':_0x530238['id']},{})[_0xdcba('0x24')](function(){return _0x59d641;});}else{return _0x59d641;}})[_0xdcba('0x40')](function(_0x58c590){logger['error'](_0xdcba('0x50'),_0x58c590);throw _0x58c590;});}return _0x59d641;})[_0xdcba('0x24')](respondWithResult(_0x5d19e0,0xc9))['catch'](handleError(_0x5d19e0,null));};exports[_0xdcba('0x23')]=function(_0x5be4f0,_0x59a64c){if(_0x5be4f0[_0xdcba('0x49')]['id']){delete _0x5be4f0[_0xdcba('0x49')]['id'];}return db[_0xdcba('0x2e')][_0xdcba('0x47')]({'where':{'id':_0x5be4f0[_0xdcba('0x42')]['id']}})['then'](handleEntityNotFound(_0x59a64c,null))[_0xdcba('0x24')](saveUpdates(_0x5be4f0['body'],null))[_0xdcba('0x24')](respondWithResult(_0x59a64c,null))[_0xdcba('0x40')](handleError(_0x59a64c,null));};exports[_0xdcba('0x25')]=function(_0x4f6539,_0x583113){return db[_0xdcba('0x2e')]['find']({'where':{'id':_0x4f6539[_0xdcba('0x42')]['id']}})[_0xdcba('0x24')](handleEntityNotFound(_0x583113,null))[_0xdcba('0x24')](removeEntity(_0x583113,null))[_0xdcba('0x40')](handleError(_0x583113,null));};exports['test']=function(_0x3af02a,_0x36863e,_0x2418c5){var _0x366aab;return db[_0xdcba('0x2e')]['find']({'where':{'id':_0x3af02a[_0xdcba('0x42')]['id']},'attributes':['id',_0xdcba('0x51')]})[_0xdcba('0x24')](handleEntityNotFound(_0x36863e,null))[_0xdcba('0x24')](function(_0x5b8d48){if(_0x5b8d48){var _0x3c0309=require('odbc')();_0x3c0309['openSync'](_0x5b8d48[_0xdcba('0x51')]);_0x3c0309[_0xdcba('0x52')]();return _0x5b8d48;}})[_0xdcba('0x24')](respondWithResult(_0x36863e,null))[_0xdcba('0x40')](handleError(_0x36863e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b90c4cd..cfd3332 100644 --- a/server/api/squareOdbc/squareOdbc.model.js +++ b/server/api/squareOdbc/squareOdbc.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe2c=['define','SquareOdbc','square_odbc','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x39844d,_0x3c8282){var _0x5d9017=function(_0x5a6418){while(--_0x5a6418){_0x39844d['push'](_0x39844d['shift']());}};_0x5d9017(++_0x3c8282);}(_0xbe2c,0x18f));var _0xcbe2=function(_0xe26dcb,_0x879703){_0xe26dcb=_0xe26dcb-0x0;var _0x15189b=_0xbe2c[_0xe26dcb];return _0x15189b;};'use strict';var _=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var logger=require('../../config/logger')(_0xcbe2('0x2'));var moment=require('moment');var BPromise=require(_0xcbe2('0x3'));var rp=require(_0xcbe2('0x4'));var fs=require('fs');var path=require(_0xcbe2('0x5'));var rimraf=require(_0xcbe2('0x6'));var config=require(_0xcbe2('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xcbe2('0x8')]=function(_0x2f1e95,_0x519925){return _0x2f1e95[_0xcbe2('0x9')](_0xcbe2('0xa'),attributes,{'tableName':_0xcbe2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43ef=['exports','define','square_odbc','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x43ef,0x19a));var _0xf43e=function(_0x58a851,_0x527db3){_0x58a851=_0x58a851-0x0;var _0x2e6ee7=_0x43ef[_0x58a851];return _0x2e6ee7;};'use strict';var _=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var logger=require('../../config/logger')(_0xf43e('0x2'));var moment=require(_0xf43e('0x3'));var BPromise=require(_0xf43e('0x4'));var rp=require(_0xf43e('0x5'));var fs=require('fs');var path=require(_0xf43e('0x6'));var rimraf=require('rimraf');var config=require(_0xf43e('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xf43e('0x8')]=function(_0x249559,_0x2297fa){return _0x249559[_0xf43e('0x9')]('SquareOdbc',attributes,{'tableName':_0xf43e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 2b980db..19f2640 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8930=['model','then','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','include'];(function(_0x565a87,_0x2a5c73){var _0x4b08c0=function(_0x2b9356){while(--_0x2b9356){_0x565a87['push'](_0x565a87['shift']());}};_0x4b08c0(++_0x2a5c73);}(_0x8930,0x142));var _0x0893=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8930[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0893('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0893('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0893('0x2'));var db=require(_0x0893('0x3'))['db'];var utils=require(_0x0893('0x4'));var logger=require(_0x0893('0x5'))(_0x0893('0x6'));var config=require(_0x0893('0x7'));var jayson=require(_0x0893('0x8'));var client=jayson[_0x0893('0x9')][_0x0893('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x253b47,_0x54d593,_0x419402){return new BPromise(function(_0x1d0189,_0x2e47e2){return client[_0x0893('0xb')](_0x253b47,_0x419402)['then'](function(_0x4304ea){logger[_0x0893('0xc')](_0x0893('0xd'),_0x54d593,_0x0893('0xe'));logger[_0x0893('0xf')](_0x0893('0x10'),_0x54d593,_0x0893('0xe'),JSON['stringify'](_0x4304ea));if(_0x4304ea[_0x0893('0x11')]){if(_0x4304ea[_0x0893('0x11')][_0x0893('0x12')]===0x1f4){logger[_0x0893('0x11')](_0x0893('0xd'),_0x54d593,_0x4304ea['error']['message']);return _0x2e47e2(_0x4304ea[_0x0893('0x11')][_0x0893('0x13')]);}logger[_0x0893('0x11')](_0x0893('0xd'),_0x54d593,_0x4304ea[_0x0893('0x11')][_0x0893('0x13')]);return _0x1d0189(_0x4304ea[_0x0893('0x11')][_0x0893('0x13')]);}else{logger[_0x0893('0xc')](_0x0893('0xd'),_0x54d593,'request\x20sent');_0x1d0189(_0x4304ea[_0x0893('0x14')]['message']);}})[_0x0893('0x15')](function(_0x4c3636){logger['error'](_0x0893('0xd'),_0x54d593,_0x4c3636);_0x2e47e2(_0x4c3636);});});}exports[_0x0893('0x16')]=function(_0x49d660){var _0x3a7225=this;return new Promise(function(_0x50bb29,_0x2836ae){return db[_0x0893('0x17')][_0x0893('0x18')]({'raw':_0x49d660[_0x0893('0x19')]?_0x49d660[_0x0893('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x49d660['options']?_0x49d660[_0x0893('0x19')][_0x0893('0x1a')]||null:null,'attributes':_0x49d660[_0x0893('0x19')]?_0x49d660[_0x0893('0x19')][_0x0893('0x1b')]||null:null,'include':_0x49d660[_0x0893('0x19')]?_0x49d660['options']['include']?_[_0x0893('0x1c')](_0x49d660[_0x0893('0x19')][_0x0893('0x1d')],function(_0x5dc74a){return{'model':db[_0x5dc74a[_0x0893('0x1e')]],'as':_0x5dc74a['as'],'attributes':_0x5dc74a[_0x0893('0x1b')],'include':_0x5dc74a[_0x0893('0x1d')]?_[_0x0893('0x1c')](_0x5dc74a[_0x0893('0x1d')],function(_0x3ffecd){return{'model':db[_0x3ffecd[_0x0893('0x1e')]],'as':_0x3ffecd['as'],'attributes':_0x3ffecd[_0x0893('0x1b')],'include':_0x3ffecd[_0x0893('0x1d')]?_[_0x0893('0x1c')](_0x3ffecd[_0x0893('0x1d')],function(_0x52c69b){return{'model':db[_0x52c69b['model']],'as':_0x52c69b['as'],'attributes':_0x52c69b[_0x0893('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0893('0x1f')](function(_0x599e6a){logger[_0x0893('0xc')](_0x0893('0x16'),_0x49d660);logger['debug']('ShowSquareOdbc',_0x49d660,JSON['stringify'](_0x599e6a));_0x50bb29(_0x599e6a);})[_0x0893('0x15')](function(_0xcfaa08){logger[_0x0893('0x11')](_0x0893('0x16'),_0xcfaa08[_0x0893('0x13')],_0x49d660);_0x2836ae(_0x3a7225[_0x0893('0x11')](0x1f4,_0xcfaa08[_0x0893('0x13')]));});});}; \ No newline at end of file +var _0x2ef7=['options','raw','where','attributes','include','map','model','then','stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x2ac5d8,_0x7c8576){var _0x117d59=function(_0x2f7c7d){while(--_0x2f7c7d){_0x2ac5d8['push'](_0x2ac5d8['shift']());}};_0x117d59(++_0x7c8576);}(_0x2ef7,0x15d));var _0x72ef=function(_0x1c0460,_0x459f0f){_0x1c0460=_0x1c0460-0x0;var _0x2bf535=_0x2ef7[_0x1c0460];return _0x2bf535;};'use strict';var _=require(_0x72ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x72ef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72ef('0x2'));var db=require(_0x72ef('0x3'))['db'];var utils=require(_0x72ef('0x4'));var logger=require(_0x72ef('0x5'))(_0x72ef('0x6'));var config=require(_0x72ef('0x7'));var jayson=require(_0x72ef('0x8'));var client=jayson[_0x72ef('0x9')][_0x72ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f2c6f,_0x172ed2,_0x4b93ae){return new BPromise(function(_0x56fbd3,_0x394751){return client[_0x72ef('0xb')](_0x3f2c6f,_0x4b93ae)['then'](function(_0x517213){logger[_0x72ef('0xc')](_0x72ef('0xd'),_0x172ed2,_0x72ef('0xe'));logger[_0x72ef('0xf')](_0x72ef('0x10'),_0x172ed2,_0x72ef('0xe'),JSON['stringify'](_0x517213));if(_0x517213[_0x72ef('0x11')]){if(_0x517213[_0x72ef('0x11')][_0x72ef('0x12')]===0x1f4){logger[_0x72ef('0x11')](_0x72ef('0xd'),_0x172ed2,_0x517213[_0x72ef('0x11')][_0x72ef('0x13')]);return _0x394751(_0x517213[_0x72ef('0x11')][_0x72ef('0x13')]);}logger['error'](_0x72ef('0xd'),_0x172ed2,_0x517213[_0x72ef('0x11')][_0x72ef('0x13')]);return _0x56fbd3(_0x517213['error']['message']);}else{logger[_0x72ef('0xc')](_0x72ef('0xd'),_0x172ed2,_0x72ef('0xe'));_0x56fbd3(_0x517213[_0x72ef('0x14')][_0x72ef('0x13')]);}})[_0x72ef('0x15')](function(_0x4e0771){logger[_0x72ef('0x11')](_0x72ef('0xd'),_0x172ed2,_0x4e0771);_0x394751(_0x4e0771);});});}exports[_0x72ef('0x16')]=function(_0x3c7651){var _0x880e42=this;return new Promise(function(_0x465985,_0x11500e){return db[_0x72ef('0x17')][_0x72ef('0x18')]({'raw':_0x3c7651[_0x72ef('0x19')]?_0x3c7651[_0x72ef('0x19')][_0x72ef('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c7651['options']?_0x3c7651[_0x72ef('0x19')][_0x72ef('0x1b')]||null:null,'attributes':_0x3c7651[_0x72ef('0x19')]?_0x3c7651[_0x72ef('0x19')][_0x72ef('0x1c')]||null:null,'include':_0x3c7651[_0x72ef('0x19')]?_0x3c7651[_0x72ef('0x19')][_0x72ef('0x1d')]?_[_0x72ef('0x1e')](_0x3c7651[_0x72ef('0x19')][_0x72ef('0x1d')],function(_0x5cdc52){return{'model':db[_0x5cdc52[_0x72ef('0x1f')]],'as':_0x5cdc52['as'],'attributes':_0x5cdc52[_0x72ef('0x1c')],'include':_0x5cdc52['include']?_[_0x72ef('0x1e')](_0x5cdc52[_0x72ef('0x1d')],function(_0x174898){return{'model':db[_0x174898['model']],'as':_0x174898['as'],'attributes':_0x174898[_0x72ef('0x1c')],'include':_0x174898['include']?_['map'](_0x174898[_0x72ef('0x1d')],function(_0x2d98ec){return{'model':db[_0x2d98ec[_0x72ef('0x1f')]],'as':_0x2d98ec['as'],'attributes':_0x2d98ec['attributes']};}):[]};}):[]};}):[]:[]})[_0x72ef('0x20')](function(_0x34761e){logger[_0x72ef('0xc')](_0x72ef('0x16'),_0x3c7651);logger[_0x72ef('0xf')](_0x72ef('0x16'),_0x3c7651,JSON[_0x72ef('0x21')](_0x34761e));_0x465985(_0x34761e);})['catch'](function(_0x10891a){logger['error'](_0x72ef('0x16'),_0x10891a['message'],_0x3c7651);_0x11500e(_0x880e42['error'](0x1f4,_0x10891a[_0x72ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index eba0def..65a7435 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0687=['fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x0687,0xf6));var _0x7068=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0687[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7068('0x0'));var util=require(_0x7068('0x1'));var path=require(_0x7068('0x2'));var timeout=require(_0x7068('0x3'));var express=require(_0x7068('0x4'));var router=express[_0x7068('0x5')]();var fs_extra=require(_0x7068('0x6'));var auth=require(_0x7068('0x7'));var interaction=require(_0x7068('0x8'));var config=require('../../config/environment');var controller=require(_0x7068('0x9'));router[_0x7068('0xa')]('/',auth[_0x7068('0xb')](),controller['index']);router['get'](_0x7068('0xc'),auth[_0x7068('0xb')](),controller[_0x7068('0xd')]);router[_0x7068('0xe')]('/',auth[_0x7068('0xb')](),controller[_0x7068('0xf')]);router[_0x7068('0x10')](_0x7068('0xc'),auth[_0x7068('0xb')](),controller[_0x7068('0x11')]);router[_0x7068('0x12')](_0x7068('0xc'),auth[_0x7068('0xb')](),controller[_0x7068('0x13')]);module[_0x7068('0x14')]=router; \ No newline at end of file +var _0x5ac9=['put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id','show','post','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ac9,0x1e0));var _0x95ac=function(_0x1b09a4,_0x30cc3f){_0x1b09a4=_0x1b09a4-0x0;var _0x324880=_0x5ac9[_0x1b09a4];return _0x324880;};'use strict';var multer=require('multer');var util=require(_0x95ac('0x0'));var path=require(_0x95ac('0x1'));var timeout=require(_0x95ac('0x2'));var express=require(_0x95ac('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x95ac('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x95ac('0x5'));var controller=require(_0x95ac('0x6'));router[_0x95ac('0x7')]('/',auth['isAuthenticated'](),controller[_0x95ac('0x8')]);router[_0x95ac('0x7')](_0x95ac('0x9'),auth['isAuthenticated'](),controller[_0x95ac('0xa')]);router[_0x95ac('0xb')]('/',auth[_0x95ac('0xc')](),controller['create']);router[_0x95ac('0xd')](_0x95ac('0x9'),auth[_0x95ac('0xc')](),controller[_0x95ac('0xe')]);router[_0x95ac('0xf')]('/:id',auth[_0x95ac('0xc')](),controller['destroy']);module[_0x95ac('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 5abc427..e12066c 100644 --- a/server/api/squareProject/squareProject.attributes.js +++ b/server/api/squareProject/squareProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a2d=['STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports'];(function(_0x45021c,_0x4a796a){var _0x32f3b5=function(_0x2b306a){while(--_0x2b306a){_0x45021c['push'](_0x45021c['shift']());}};_0x32f3b5(++_0x4a796a);}(_0x2a2d,0x1c7));var _0xd2a2=function(_0x41caac,_0x50c421){_0x41caac=_0x41caac-0x0;var _0x28d2ba=_0x2a2d[_0x41caac];return _0x28d2ba;};'use strict';var Sequelize=require('sequelize');module[_0xd2a2('0x0')]={'name':{'type':Sequelize[_0xd2a2('0x1')],'unique':_0xd2a2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd2a2('0x1')]},'notes':{'type':Sequelize[_0xd2a2('0x3')]},'preproduction':{'type':Sequelize[_0xd2a2('0x4')](_0xd2a2('0x5')),'get':function(){if(this[_0xd2a2('0x6')](_0xd2a2('0x7'))){return this[_0xd2a2('0x6')](_0xd2a2('0x7'))[_0xd2a2('0x8')](_0xd2a2('0x9'));}}},'production':{'type':Sequelize[_0xd2a2('0x4')]('long'),'get':function(){if(this['getDataValue'](_0xd2a2('0xa'))){return this[_0xd2a2('0x6')](_0xd2a2('0xa'))[_0xd2a2('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0xd2a2('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7d9b=['BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE','STRING','name','TEXT'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x7d9b,0x126));var _0xb7d9=function(_0x43d6b8,_0x15d2a7){_0x43d6b8=_0x43d6b8-0x0;var _0x45673c=_0x7d9b[_0x43d6b8];return _0x45673c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb7d9('0x0')],'unique':_0xb7d9('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb7d9('0x0')]},'notes':{'type':Sequelize[_0xb7d9('0x2')]},'preproduction':{'type':Sequelize[_0xb7d9('0x3')](_0xb7d9('0x4')),'get':function(){if(this[_0xb7d9('0x5')]('preproduction')){return this[_0xb7d9('0x5')](_0xb7d9('0x6'))[_0xb7d9('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xb7d9('0x3')]('long'),'get':function(){if(this[_0xb7d9('0x5')](_0xb7d9('0x8'))){return this[_0xb7d9('0x5')](_0xb7d9('0x8'))[_0xb7d9('0x7')](_0xb7d9('0x9'));}}},'savedAt':{'type':Sequelize[_0xb7d9('0xa')]},'publishedAt':{'type':Sequelize[_0xb7d9('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 3653538..f936cc8 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac54=['Content-Range','then','destroy','get','SquareProjects','UserProfileResource','end','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','params','length','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','agi','pick','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','set'];(function(_0x5baf3a,_0x3bea4d){var _0x5d49d6=function(_0x4b5f9a){while(--_0x4b5f9a){_0x5baf3a['push'](_0x5baf3a['shift']());}};_0x5d49d6(++_0x3bea4d);}(_0xac54,0x1d1));var _0x4ac5=function(_0x4b16cb,_0x2b9e73){_0x4b16cb=_0x4b16cb-0x0;var _0x419d70=_0xac54[_0x4b16cb];return _0x419d70;};'use strict';var _=require(_0x4ac5('0x0'));var Redis=require(_0x4ac5('0x1'));var qs=require(_0x4ac5('0x2'));var logger=require(_0x4ac5('0x3'))(_0x4ac5('0x4'));var config=require(_0x4ac5('0x5'));var db=require(_0x4ac5('0x6'))['db'];config[_0x4ac5('0x7')]=_['defaults'](config[_0x4ac5('0x7')],{'host':_0x4ac5('0x8'),'port':0x18eb});var socket=require(_0x4ac5('0x9'))(new Redis(config[_0x4ac5('0x7')]));require(_0x4ac5('0xa'))[_0x4ac5('0xb')](socket);function respondWithResult(_0x17777a,_0x5a670b){_0x5a670b=_0x5a670b||0xc8;return function(_0x3ba38e){if(_0x3ba38e){return _0x17777a[_0x4ac5('0xc')](_0x5a670b)[_0x4ac5('0xd')](_0x3ba38e);}};}function respondWithFilteredResult(_0x1b8dbc,_0x4816e5){return function(_0x1291d1){if(_0x1291d1){var _0x1b7724=typeof _0x4816e5[_0x4ac5('0xe')]===_0x4ac5('0xf')&&typeof _0x4816e5[_0x4ac5('0x10')]===_0x4ac5('0xf');var _0x3e4446=_0x1291d1['count'];var _0x1aaea5=_0x1b7724?0x0:_0x4816e5[_0x4ac5('0xe')];var _0x1e63f2=_0x1b7724?_0x1291d1['count']:_0x4816e5[_0x4ac5('0xe')]+_0x4816e5['limit'];var _0x15f6cb;if(_0x1e63f2>=_0x3e4446){_0x1e63f2=_0x3e4446;_0x15f6cb=0xc8;}else{_0x15f6cb=0xce;}_0x1b8dbc[_0x4ac5('0xc')](_0x15f6cb);return _0x1b8dbc[_0x4ac5('0x11')](_0x4ac5('0x12'),_0x1aaea5+'-'+_0x1e63f2+'/'+_0x3e4446)[_0x4ac5('0xd')](_0x1291d1);}return null;};}function saveUpdates(_0x51dea6){return function(_0x82c465){if(_0x82c465){return _0x82c465['update'](_0x51dea6)[_0x4ac5('0x13')](function(_0x386fbc){return _0x386fbc;});}return null;};}function removeEntity(_0x520867){return function(_0x22f4b6){if(_0x22f4b6){return _0x22f4b6[_0x4ac5('0x14')]()[_0x4ac5('0x13')](function(){var _0x521018=_0x22f4b6[_0x4ac5('0x15')]({'plain':!![]});var _0x5f032e=_0x4ac5('0x16');return db[_0x4ac5('0x17')]['destroy']({'where':{'type':_0x5f032e,'resourceId':_0x521018['id']}})[_0x4ac5('0x13')](function(){return _0x22f4b6;});})[_0x4ac5('0x13')](function(){var _0x823896=new Redis(config[_0x4ac5('0x7')]);_0x823896['publish']('agi',JSON['stringify']({'id':_0x22f4b6['id'],'deleted':!![]}));})['then'](function(){_0x520867[_0x4ac5('0xc')](0xcc)[_0x4ac5('0x18')]();});}};}function handleEntityNotFound(_0x4faf04){return function(_0x3d8e51){if(!_0x3d8e51){_0x4faf04[_0x4ac5('0x19')](0x194);}return _0x3d8e51;};}function handleError(_0xedf798,_0x3d9e25){_0x3d9e25=_0x3d9e25||0x1f4;return function(_0x599993){logger[_0x4ac5('0x1a')](_0x599993[_0x4ac5('0x1b')]);if(_0x599993[_0x4ac5('0x1c')]){delete _0x599993['name'];}_0xedf798[_0x4ac5('0xc')](_0x3d9e25)[_0x4ac5('0x1d')](_0x599993);};}exports['index']=function(_0x278ddf,_0x31ab42){var _0x34bdf5={},_0x329d94={},_0x4cd8a7={'count':0x0,'rows':[]};var _0x57354=_[_0x4ac5('0x1e')](db[_0x4ac5('0x1f')][_0x4ac5('0x20')],function(_0xc3e74){return{'name':_0xc3e74[_0x4ac5('0x21')],'type':_0xc3e74[_0x4ac5('0x22')][_0x4ac5('0x23')]};});_0x329d94['model']=_[_0x4ac5('0x1e')](_0x57354,_0x4ac5('0x1c'));_0x329d94['query']=_[_0x4ac5('0x24')](_0x278ddf[_0x4ac5('0x25')]);_0x329d94[_0x4ac5('0x26')]=_['intersection'](_0x329d94[_0x4ac5('0x27')],_0x329d94[_0x4ac5('0x25')]);_0x34bdf5['attributes']=_[_0x4ac5('0x28')](_0x329d94['model'],qs[_0x4ac5('0x29')](_0x278ddf[_0x4ac5('0x25')][_0x4ac5('0x29')]));_0x34bdf5['attributes']=_0x34bdf5[_0x4ac5('0x2a')]['length']?_0x34bdf5[_0x4ac5('0x2a')]:_0x329d94['model'];if(!_0x278ddf[_0x4ac5('0x25')][_0x4ac5('0x2b')]('nolimit')){_0x34bdf5[_0x4ac5('0x10')]=qs['limit'](_0x278ddf[_0x4ac5('0x25')][_0x4ac5('0x10')]);_0x34bdf5[_0x4ac5('0xe')]=qs[_0x4ac5('0xe')](_0x278ddf['query']['offset']);}_0x34bdf5[_0x4ac5('0x2c')]=qs[_0x4ac5('0x2d')](_0x278ddf[_0x4ac5('0x25')][_0x4ac5('0x2d')]);_0x34bdf5[_0x4ac5('0x2e')]=qs['filters'](_['pick'](_0x278ddf[_0x4ac5('0x25')],_0x329d94[_0x4ac5('0x26')]),_0x57354);if(_0x278ddf['query'][_0x4ac5('0x2f')]){_0x34bdf5['where']=_[_0x4ac5('0x30')](_0x34bdf5[_0x4ac5('0x2e')],{'$or':_[_0x4ac5('0x1e')](_0x57354,function(_0x39dc0e){if(_0x39dc0e['type']!==_0x4ac5('0x31')){var _0x59e085={};_0x59e085[_0x39dc0e['name']]={'$like':'%'+_0x278ddf[_0x4ac5('0x25')]['filter']+'%'};return _0x59e085;}})});}_0x34bdf5=_['merge']({},_0x34bdf5,_0x278ddf[_0x4ac5('0x32')]);var _0x37f07c={'where':_0x34bdf5[_0x4ac5('0x2e')]};return db[_0x4ac5('0x1f')]['count'](_0x37f07c)[_0x4ac5('0x13')](function(_0x2dff2b){_0x4cd8a7[_0x4ac5('0x33')]=_0x2dff2b;if(_0x278ddf[_0x4ac5('0x25')][_0x4ac5('0x34')]){_0x34bdf5['include']=[{'all':!![]}];}return db[_0x4ac5('0x1f')][_0x4ac5('0x35')](_0x34bdf5);})[_0x4ac5('0x13')](function(_0x25bf24){_0x4cd8a7['rows']=_0x25bf24;return _0x4cd8a7;})['then'](respondWithFilteredResult(_0x31ab42,_0x34bdf5))['catch'](handleError(_0x31ab42,null));};exports['show']=function(_0x38307c,_0x702710){var _0x51f837={'raw':![],'where':{'id':_0x38307c[_0x4ac5('0x36')]['id']}},_0x1a283a={};_0x1a283a[_0x4ac5('0x27')]=_[_0x4ac5('0x24')](db['SquareProject'][_0x4ac5('0x20')]);_0x1a283a[_0x4ac5('0x25')]=_[_0x4ac5('0x24')](_0x38307c[_0x4ac5('0x25')]);_0x1a283a[_0x4ac5('0x26')]=_['intersection'](_0x1a283a[_0x4ac5('0x27')],_0x1a283a[_0x4ac5('0x25')]);_0x51f837['attributes']=_[_0x4ac5('0x28')](_0x1a283a[_0x4ac5('0x27')],qs[_0x4ac5('0x29')](_0x38307c[_0x4ac5('0x25')]['fields']));_0x51f837[_0x4ac5('0x2a')]=_0x51f837[_0x4ac5('0x2a')][_0x4ac5('0x37')]?_0x51f837[_0x4ac5('0x2a')]:_0x1a283a['model'];if(_0x38307c[_0x4ac5('0x25')]['includeAll']){_0x51f837['include']=[{'all':!![]}];}_0x51f837=_[_0x4ac5('0x30')]({},_0x51f837,_0x38307c[_0x4ac5('0x32')]);return db[_0x4ac5('0x1f')][_0x4ac5('0x38')](_0x51f837)[_0x4ac5('0x13')](handleEntityNotFound(_0x702710,null))[_0x4ac5('0x13')](respondWithResult(_0x702710,null))[_0x4ac5('0x39')](handleError(_0x702710,null));};exports[_0x4ac5('0x3a')]=function(_0x139116,_0x599bd7){return db[_0x4ac5('0x1f')][_0x4ac5('0x3a')](_0x139116['body'],{})[_0x4ac5('0x13')](function(_0x109a59){var _0x5d8be9=_0x139116['user'][_0x4ac5('0x15')]({'plain':!![]});if(!_0x5d8be9)throw new Error(_0x4ac5('0x3b'));if(_0x5d8be9[_0x4ac5('0x3c')]===_0x4ac5('0x3d')){var _0x17f11c=_0x109a59[_0x4ac5('0x15')]({'plain':!![]});var _0x4c9542=_0x4ac5('0x16');return db[_0x4ac5('0x3e')][_0x4ac5('0x38')]({'where':{'name':_0x4c9542,'userProfileId':_0x5d8be9[_0x4ac5('0x3f')]},'raw':!![]})[_0x4ac5('0x13')](function(_0x3fb8f3){if(_0x3fb8f3&&_0x3fb8f3['autoAssociation']===0x0){return db[_0x4ac5('0x17')]['create']({'name':_0x17f11c[_0x4ac5('0x1c')],'resourceId':_0x17f11c['id'],'type':_0x3fb8f3[_0x4ac5('0x1c')],'sectionId':_0x3fb8f3['id']},{})[_0x4ac5('0x13')](function(){return _0x109a59;});}else{return _0x109a59;}})[_0x4ac5('0x39')](function(_0x1d1ad8){logger[_0x4ac5('0x1a')](_0x4ac5('0x40'),_0x1d1ad8);throw _0x1d1ad8;});}return _0x109a59;})['then'](respondWithResult(_0x599bd7,0xc9))[_0x4ac5('0x39')](handleError(_0x599bd7,null));};exports[_0x4ac5('0x41')]=function(_0x50fa26,_0x42c511){if(_0x50fa26[_0x4ac5('0x42')]['id']){delete _0x50fa26[_0x4ac5('0x42')]['id'];}return db[_0x4ac5('0x1f')]['find']({'where':{'id':_0x50fa26[_0x4ac5('0x36')]['id']}})['then'](handleEntityNotFound(_0x42c511,null))[_0x4ac5('0x13')](saveUpdates(_0x50fa26[_0x4ac5('0x42')],null))[_0x4ac5('0x13')](function(_0x45e54d){if(!_0x45e54d)return;var _0x25c861=_0x45e54d[_0x4ac5('0x15')]({'plain':!![]});return _0x25c861;})[_0x4ac5('0x13')](function(_0x50fab5){var _0x4844a7=new Redis(config[_0x4ac5('0x7')]);_0x4844a7['publish'](_0x4ac5('0x43'),JSON['stringify'](_[_0x4ac5('0x44')](_0x50fab5,['id',_0x4ac5('0x1c'),'production'])));return _0x50fab5;})[_0x4ac5('0x13')](respondWithResult(_0x42c511,null))[_0x4ac5('0x39')](handleError(_0x42c511,null));};exports[_0x4ac5('0x14')]=function(_0x167634,_0x253d9d){return db['SquareProject'][_0x4ac5('0x38')]({'where':{'id':_0x167634[_0x4ac5('0x36')]['id']}})[_0x4ac5('0x13')](handleEntityNotFound(_0x253d9d,null))[_0x4ac5('0x13')](removeEntity(_0x253d9d,null))[_0x4ac5('0x39')](handleError(_0x253d9d,null));}; \ No newline at end of file +var _0xe027=['production','../../components/parsers/qs','defaults','redis','localhost','socket.io-emitter','register','status','json','undefined','offset','count','limit','set','Content-Range','update','then','destroy','get','UserProfileResource','publish','stringify','end','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','agi','pick'];(function(_0x2091d2,_0x18f755){var _0x5a4c18=function(_0x5d937b){while(--_0x5d937b){_0x2091d2['push'](_0x2091d2['shift']());}};_0x5a4c18(++_0x18f755);}(_0xe027,0x1c8));var _0x7e02=function(_0x44c088,_0x46800b){_0x44c088=_0x44c088-0x0;var _0x23955c=_0xe027[_0x44c088];return _0x23955c;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x7e02('0x0'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7e02('0x1')](config[_0x7e02('0x2')],{'host':_0x7e02('0x3'),'port':0x18eb});var socket=require(_0x7e02('0x4'))(new Redis(config['redis']));require('./squareProject.socket')[_0x7e02('0x5')](socket);function respondWithResult(_0x2ac512,_0x32440f){_0x32440f=_0x32440f||0xc8;return function(_0x373952){if(_0x373952){return _0x2ac512[_0x7e02('0x6')](_0x32440f)[_0x7e02('0x7')](_0x373952);}};}function respondWithFilteredResult(_0x54a4cc,_0x360efb){return function(_0x2b80cf){if(_0x2b80cf){var _0x44b07d=typeof _0x360efb['offset']===_0x7e02('0x8')&&typeof _0x360efb['limit']===_0x7e02('0x8');var _0x4a9f74=_0x2b80cf['count'];var _0x137b5e=_0x44b07d?0x0:_0x360efb[_0x7e02('0x9')];var _0x5c1e92=_0x44b07d?_0x2b80cf[_0x7e02('0xa')]:_0x360efb[_0x7e02('0x9')]+_0x360efb[_0x7e02('0xb')];var _0x548f73;if(_0x5c1e92>=_0x4a9f74){_0x5c1e92=_0x4a9f74;_0x548f73=0xc8;}else{_0x548f73=0xce;}_0x54a4cc[_0x7e02('0x6')](_0x548f73);return _0x54a4cc[_0x7e02('0xc')](_0x7e02('0xd'),_0x137b5e+'-'+_0x5c1e92+'/'+_0x4a9f74)[_0x7e02('0x7')](_0x2b80cf);}return null;};}function saveUpdates(_0x5dc71f){return function(_0x235b4f){if(_0x235b4f){return _0x235b4f[_0x7e02('0xe')](_0x5dc71f)[_0x7e02('0xf')](function(_0x2761db){return _0x2761db;});}return null;};}function removeEntity(_0x2ce961){return function(_0x285b82){if(_0x285b82){return _0x285b82[_0x7e02('0x10')]()[_0x7e02('0xf')](function(){var _0x4c3744=_0x285b82[_0x7e02('0x11')]({'plain':!![]});var _0x428617='SquareProjects';return db[_0x7e02('0x12')][_0x7e02('0x10')]({'where':{'type':_0x428617,'resourceId':_0x4c3744['id']}})[_0x7e02('0xf')](function(){return _0x285b82;});})[_0x7e02('0xf')](function(){var _0x2e8626=new Redis(config[_0x7e02('0x2')]);_0x2e8626[_0x7e02('0x13')]('agi',JSON[_0x7e02('0x14')]({'id':_0x285b82['id'],'deleted':!![]}));})[_0x7e02('0xf')](function(){_0x2ce961[_0x7e02('0x6')](0xcc)[_0x7e02('0x15')]();});}};}function handleEntityNotFound(_0x336793){return function(_0x40c527){if(!_0x40c527){_0x336793['sendStatus'](0x194);}return _0x40c527;};}function handleError(_0x30c175,_0x34e2c9){_0x34e2c9=_0x34e2c9||0x1f4;return function(_0x3566f1){logger[_0x7e02('0x16')](_0x3566f1[_0x7e02('0x17')]);if(_0x3566f1[_0x7e02('0x18')]){delete _0x3566f1[_0x7e02('0x18')];}_0x30c175[_0x7e02('0x6')](_0x34e2c9)[_0x7e02('0x19')](_0x3566f1);};}exports['index']=function(_0x6a9467,_0x53e8f6){var _0x209bd9={},_0x233927={},_0x50951b={'count':0x0,'rows':[]};var _0x5aeda0=_[_0x7e02('0x1a')](db[_0x7e02('0x1b')][_0x7e02('0x1c')],function(_0x3c88a1){return{'name':_0x3c88a1[_0x7e02('0x1d')],'type':_0x3c88a1[_0x7e02('0x1e')][_0x7e02('0x1f')]};});_0x233927[_0x7e02('0x20')]=_[_0x7e02('0x1a')](_0x5aeda0,_0x7e02('0x18'));_0x233927[_0x7e02('0x21')]=_[_0x7e02('0x22')](_0x6a9467[_0x7e02('0x21')]);_0x233927[_0x7e02('0x23')]=_[_0x7e02('0x24')](_0x233927[_0x7e02('0x20')],_0x233927[_0x7e02('0x21')]);_0x209bd9['attributes']=_['intersection'](_0x233927['model'],qs[_0x7e02('0x25')](_0x6a9467[_0x7e02('0x21')][_0x7e02('0x25')]));_0x209bd9[_0x7e02('0x26')]=_0x209bd9[_0x7e02('0x26')][_0x7e02('0x27')]?_0x209bd9[_0x7e02('0x26')]:_0x233927[_0x7e02('0x20')];if(!_0x6a9467[_0x7e02('0x21')][_0x7e02('0x28')](_0x7e02('0x29'))){_0x209bd9[_0x7e02('0xb')]=qs['limit'](_0x6a9467[_0x7e02('0x21')][_0x7e02('0xb')]);_0x209bd9['offset']=qs[_0x7e02('0x9')](_0x6a9467['query'][_0x7e02('0x9')]);}_0x209bd9[_0x7e02('0x2a')]=qs[_0x7e02('0x2b')](_0x6a9467[_0x7e02('0x21')][_0x7e02('0x2b')]);_0x209bd9[_0x7e02('0x2c')]=qs['filters'](_['pick'](_0x6a9467[_0x7e02('0x21')],_0x233927[_0x7e02('0x23')]),_0x5aeda0);if(_0x6a9467[_0x7e02('0x21')][_0x7e02('0x2d')]){_0x209bd9[_0x7e02('0x2c')]=_[_0x7e02('0x2e')](_0x209bd9[_0x7e02('0x2c')],{'$or':_[_0x7e02('0x1a')](_0x5aeda0,function(_0x3d77bd){if(_0x3d77bd[_0x7e02('0x1e')]!==_0x7e02('0x2f')){var _0x1fb6e4={};_0x1fb6e4[_0x3d77bd[_0x7e02('0x18')]]={'$like':'%'+_0x6a9467[_0x7e02('0x21')][_0x7e02('0x2d')]+'%'};return _0x1fb6e4;}})});}_0x209bd9=_[_0x7e02('0x2e')]({},_0x209bd9,_0x6a9467[_0x7e02('0x30')]);var _0x553b4e={'where':_0x209bd9[_0x7e02('0x2c')]};return db['SquareProject'][_0x7e02('0xa')](_0x553b4e)[_0x7e02('0xf')](function(_0x417d15){_0x50951b[_0x7e02('0xa')]=_0x417d15;if(_0x6a9467[_0x7e02('0x21')][_0x7e02('0x31')]){_0x209bd9[_0x7e02('0x32')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x209bd9);})[_0x7e02('0xf')](function(_0x22567e){_0x50951b[_0x7e02('0x33')]=_0x22567e;return _0x50951b;})[_0x7e02('0xf')](respondWithFilteredResult(_0x53e8f6,_0x209bd9))[_0x7e02('0x34')](handleError(_0x53e8f6,null));};exports['show']=function(_0x282611,_0x49607c){var _0xafddc1={'raw':![],'where':{'id':_0x282611[_0x7e02('0x35')]['id']}},_0x482de6={};_0x482de6[_0x7e02('0x20')]=_[_0x7e02('0x22')](db[_0x7e02('0x1b')][_0x7e02('0x1c')]);_0x482de6['query']=_['keys'](_0x282611[_0x7e02('0x21')]);_0x482de6[_0x7e02('0x23')]=_[_0x7e02('0x24')](_0x482de6['model'],_0x482de6['query']);_0xafddc1['attributes']=_[_0x7e02('0x24')](_0x482de6[_0x7e02('0x20')],qs['fields'](_0x282611['query']['fields']));_0xafddc1['attributes']=_0xafddc1['attributes'][_0x7e02('0x27')]?_0xafddc1[_0x7e02('0x26')]:_0x482de6[_0x7e02('0x20')];if(_0x282611[_0x7e02('0x21')][_0x7e02('0x31')]){_0xafddc1['include']=[{'all':!![]}];}_0xafddc1=_[_0x7e02('0x2e')]({},_0xafddc1,_0x282611[_0x7e02('0x30')]);return db[_0x7e02('0x1b')][_0x7e02('0x36')](_0xafddc1)[_0x7e02('0xf')](handleEntityNotFound(_0x49607c,null))['then'](respondWithResult(_0x49607c,null))[_0x7e02('0x34')](handleError(_0x49607c,null));};exports[_0x7e02('0x37')]=function(_0x14123f,_0x569c4d){return db[_0x7e02('0x1b')][_0x7e02('0x37')](_0x14123f['body'],{})[_0x7e02('0xf')](function(_0x116843){var _0x59a2b0=_0x14123f['user'][_0x7e02('0x11')]({'plain':!![]});if(!_0x59a2b0)throw new Error(_0x7e02('0x38'));if(_0x59a2b0['role']===_0x7e02('0x39')){var _0x44140b=_0x116843['get']({'plain':!![]});var _0xf6ae1b='SquareProjects';return db[_0x7e02('0x3a')][_0x7e02('0x36')]({'where':{'name':_0xf6ae1b,'userProfileId':_0x59a2b0[_0x7e02('0x3b')]},'raw':!![]})['then'](function(_0x2729f6){if(_0x2729f6&&_0x2729f6['autoAssociation']===0x0){return db[_0x7e02('0x12')]['create']({'name':_0x44140b['name'],'resourceId':_0x44140b['id'],'type':_0x2729f6[_0x7e02('0x18')],'sectionId':_0x2729f6['id']},{})[_0x7e02('0xf')](function(){return _0x116843;});}else{return _0x116843;}})[_0x7e02('0x34')](function(_0x126518){logger['error'](_0x7e02('0x3c'),_0x126518);throw _0x126518;});}return _0x116843;})['then'](respondWithResult(_0x569c4d,0xc9))[_0x7e02('0x34')](handleError(_0x569c4d,null));};exports['update']=function(_0xd22f72,_0x2bdf23){if(_0xd22f72['body']['id']){delete _0xd22f72[_0x7e02('0x3d')]['id'];}return db[_0x7e02('0x1b')][_0x7e02('0x36')]({'where':{'id':_0xd22f72[_0x7e02('0x35')]['id']}})[_0x7e02('0xf')](handleEntityNotFound(_0x2bdf23,null))[_0x7e02('0xf')](saveUpdates(_0xd22f72[_0x7e02('0x3d')],null))[_0x7e02('0xf')](function(_0x1ebd1f){if(!_0x1ebd1f)return;var _0x3cdf16=_0x1ebd1f['get']({'plain':!![]});return _0x3cdf16;})[_0x7e02('0xf')](function(_0x2e1e4b){var _0x17ef2a=new Redis(config[_0x7e02('0x2')]);_0x17ef2a[_0x7e02('0x13')](_0x7e02('0x3e'),JSON[_0x7e02('0x14')](_[_0x7e02('0x3f')](_0x2e1e4b,['id','name',_0x7e02('0x40')])));return _0x2e1e4b;})['then'](respondWithResult(_0x2bdf23,null))['catch'](handleError(_0x2bdf23,null));};exports[_0x7e02('0x10')]=function(_0x13ba05,_0x12dc69){return db[_0x7e02('0x1b')][_0x7e02('0x36')]({'where':{'id':_0x13ba05['params']['id']}})[_0x7e02('0xf')](handleEntityNotFound(_0x12dc69,null))[_0x7e02('0xf')](removeEntity(_0x12dc69,null))[_0x7e02('0x34')](handleError(_0x12dc69,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e2cbaa9..5f62328 100644 --- a/server/api/squareProject/squareProject.events.js +++ b/server/api/squareProject/squareProject.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7253=['events','../../mysqldb','SquareProject','setMaxListeners','update','emit','exports'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x7253,0x7e));var _0x3725=function(_0x18debb,_0x1f62a9){_0x18debb=_0x18debb-0x0;var _0x5dd526=_0x7253[_0x18debb];return _0x5dd526;};'use strict';var EventEmitter=require(_0x3725('0x0'));var SquareProject=require(_0x3725('0x1'))['db'][_0x3725('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3725('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3725('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ec53a){return function(_0xbb127f,_0x22d803,_0x53a7a3){SquareProjectEvents[_0x3725('0x5')](_0x1ec53a+':'+_0xbb127f['id'],_0xbb127f);SquareProjectEvents[_0x3725('0x5')](_0x1ec53a,_0xbb127f);_0x53a7a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x3725('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x83f5=['remove','emit','hook','exports','events','../../mysqldb','SquareProject','save','update'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x83f5,0xb8));var _0x583f=function(_0x4b7922,_0x295784){_0x4b7922=_0x4b7922-0x0;var _0x158ae1=_0x83f5[_0x4b7922];return _0x158ae1;};'use strict';var EventEmitter=require(_0x583f('0x0'));var SquareProject=require(_0x583f('0x1'))['db'][_0x583f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x583f('0x3'),'afterUpdate':_0x583f('0x4'),'afterDestroy':_0x583f('0x5')};function emitEvent(_0x467ab){return function(_0x2813f1,_0x3f36db,_0x306714){SquareProjectEvents[_0x583f('0x6')](_0x467ab+':'+_0x2813f1['id'],_0x2813f1);SquareProjectEvents[_0x583f('0x6')](_0x467ab,_0x2813f1);_0x306714(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x583f('0x7')](e,emitEvent(event));}}module[_0x583f('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b850e3d..1af9954 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f6b=['api','moment','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2f6b,0x19c));var _0xb2f6=function(_0x45598f,_0x1649ec){_0x45598f=_0x45598f-0x0;var _0x517e2b=_0x2f6b[_0x45598f];return _0x517e2b;};'use strict';var _=require('lodash');var util=require(_0xb2f6('0x0'));var logger=require(_0xb2f6('0x1'))(_0xb2f6('0x2'));var moment=require(_0xb2f6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb2f6('0x4'));var fs=require('fs');var path=require(_0xb2f6('0x5'));var rimraf=require(_0xb2f6('0x6'));var config=require('../../config/environment');var attributes=require(_0xb2f6('0x7'));module['exports']=function(_0x5ea66d,_0x258402){return _0x5ea66d[_0xb2f6('0x8')](_0xb2f6('0x9'),attributes,{'tableName':_0xb2f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x171831,_0x2f8ef9,_0x3c19e5){if(_0x171831[_0xb2f6('0xb')](_0xb2f6('0xc'))){_0x171831[_0xb2f6('0xd')]=moment()[_0xb2f6('0xe')](_0xb2f6('0xf'));}if(_0x171831['changed'](_0xb2f6('0x10'))){_0x171831[_0xb2f6('0x11')]=moment()[_0xb2f6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c19e5(null,_0x171831);}}});}; \ No newline at end of file +var _0x399b=['rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','api','bluebird','request-promise'];(function(_0x4bc976,_0x42b279){var _0x3c0831=function(_0x1767b4){while(--_0x1767b4){_0x4bc976['push'](_0x4bc976['shift']());}};_0x3c0831(++_0x42b279);}(_0x399b,0x1ab));var _0xb399=function(_0x2f40b7,_0x2dd244){_0x2f40b7=_0x2f40b7-0x0;var _0x550657=_0x399b[_0x2f40b7];return _0x550657;};'use strict';var _=require(_0xb399('0x0'));var util=require(_0xb399('0x1'));var logger=require('../../config/logger')(_0xb399('0x2'));var moment=require('moment');var BPromise=require(_0xb399('0x3'));var rp=require(_0xb399('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb399('0x5'));var config=require(_0xb399('0x6'));var attributes=require(_0xb399('0x7'));module[_0xb399('0x8')]=function(_0x2272ca,_0x576647){return _0x2272ca[_0xb399('0x9')](_0xb399('0xa'),attributes,{'tableName':_0xb399('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31699c,_0x5a7861,_0x1e0318){if(_0x31699c[_0xb399('0xc')](_0xb399('0xd'))){_0x31699c[_0xb399('0xe')]=moment()[_0xb399('0xf')](_0xb399('0x10'));}if(_0x31699c['changed']('production')){_0x31699c[_0xb399('0x11')]=moment()[_0xb399('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1e0318(null,_0x31699c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a31729c..f19ad72 100644 --- a/server/api/squareProject/squareProject.rpc.js +++ b/server/api/squareProject/squareProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8e0=['catch','error','message','ShowSquareProject','info','debug','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify'];(function(_0x6a505f,_0x1d14f3){var _0x1ad62b=function(_0x28eb14){while(--_0x28eb14){_0x6a505f['push'](_0x6a505f['shift']());}};_0x1ad62b(++_0x1d14f3);}(_0xb8e0,0x18c));var _0x0b8e=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xb8e0[_0x5c6994];return _0x1d5c84;};'use strict';var _=require(_0x0b8e('0x0'));var Redis=require(_0x0b8e('0x1'));var db=require(_0x0b8e('0x2'))['db'];var logger=require(_0x0b8e('0x3'))('rpc');var config=require(_0x0b8e('0x4'));config[_0x0b8e('0x5')]=_[_0x0b8e('0x6')](config[_0x0b8e('0x5')],{'host':_0x0b8e('0x7'),'port':0x18eb});var socket=require(_0x0b8e('0x8'))(new Redis(config[_0x0b8e('0x5')]));require(_0x0b8e('0x9'))[_0x0b8e('0xa')](socket);exports[_0x0b8e('0xb')]=function(_0x4d6b08){var _0x260711=this;return new Promise(function(_0x6b8651,_0xedd776){return db[_0x0b8e('0xc')][_0x0b8e('0xd')]({'raw':_0x4d6b08[_0x0b8e('0xe')]?_0x4d6b08[_0x0b8e('0xe')][_0x0b8e('0xf')]===undefined?!![]:![]:!![],'where':_0x4d6b08[_0x0b8e('0xe')]?_0x4d6b08[_0x0b8e('0xe')][_0x0b8e('0x10')]||null:null,'attributes':_0x4d6b08[_0x0b8e('0xe')]?_0x4d6b08[_0x0b8e('0xe')][_0x0b8e('0x11')]||null:null,'limit':_0x4d6b08['options']?_0x4d6b08[_0x0b8e('0xe')][_0x0b8e('0x12')]||null:null,'include':_0x4d6b08[_0x0b8e('0xe')]?_0x4d6b08[_0x0b8e('0xe')][_0x0b8e('0x13')]?_['map'](_0x4d6b08['options'][_0x0b8e('0x13')],function(_0x51e1b9){return{'model':db[_0x51e1b9[_0x0b8e('0x14')]],'as':_0x51e1b9['as'],'attributes':_0x51e1b9[_0x0b8e('0x11')],'include':_0x51e1b9[_0x0b8e('0x13')]?_[_0x0b8e('0x15')](_0x51e1b9[_0x0b8e('0x13')],function(_0x4788a6){return{'model':db[_0x4788a6[_0x0b8e('0x14')]],'as':_0x4788a6['as'],'attributes':_0x4788a6[_0x0b8e('0x11')],'include':_0x4788a6[_0x0b8e('0x13')]?_['map'](_0x4788a6[_0x0b8e('0x13')],function(_0x575571){return{'model':db[_0x575571['model']],'as':_0x575571['as'],'attributes':_0x575571[_0x0b8e('0x11')]};}):[]};}):[]};}):[]:[]})[_0x0b8e('0x16')](function(_0xb2bf0a){logger['info'](_0x0b8e('0xb'),_0x4d6b08);logger['debug']('GetSquareProjects',_0x4d6b08,JSON[_0x0b8e('0x17')](_0xb2bf0a));_0x6b8651(_0xb2bf0a);})[_0x0b8e('0x18')](function(_0x47d89f){logger['error'](_0x0b8e('0xb'),_0x47d89f['message'],_0x4d6b08);_0xedd776(_0x260711[_0x0b8e('0x19')](0x1f4,_0x47d89f[_0x0b8e('0x1a')]));});});};exports[_0x0b8e('0x1b')]=function(_0x11ef50){var _0x562577=this;return new Promise(function(_0x5fde01,_0x580ea6){return db[_0x0b8e('0xc')]['find']({'raw':_0x11ef50[_0x0b8e('0xe')]?_0x11ef50[_0x0b8e('0xe')][_0x0b8e('0xf')]===undefined?!![]:![]:!![],'where':_0x11ef50[_0x0b8e('0xe')]?_0x11ef50[_0x0b8e('0xe')][_0x0b8e('0x10')]||null:null,'attributes':_0x11ef50[_0x0b8e('0xe')]?_0x11ef50[_0x0b8e('0xe')][_0x0b8e('0x11')]||null:null,'include':_0x11ef50['options']?_0x11ef50[_0x0b8e('0xe')]['include']?_[_0x0b8e('0x15')](_0x11ef50['options'][_0x0b8e('0x13')],function(_0x5089f3){return{'model':db[_0x5089f3[_0x0b8e('0x14')]],'as':_0x5089f3['as'],'attributes':_0x5089f3['attributes'],'include':_0x5089f3[_0x0b8e('0x13')]?_['map'](_0x5089f3[_0x0b8e('0x13')],function(_0x6defc5){return{'model':db[_0x6defc5['model']],'as':_0x6defc5['as'],'attributes':_0x6defc5[_0x0b8e('0x11')],'include':_0x6defc5[_0x0b8e('0x13')]?_[_0x0b8e('0x15')](_0x6defc5[_0x0b8e('0x13')],function(_0x40f9af){return{'model':db[_0x40f9af[_0x0b8e('0x14')]],'as':_0x40f9af['as'],'attributes':_0x40f9af[_0x0b8e('0x11')]};}):[]};}):[]};}):[]:[]})[_0x0b8e('0x16')](function(_0x3e38dc){logger[_0x0b8e('0x1c')](_0x0b8e('0x1b'),_0x11ef50);logger[_0x0b8e('0x1d')](_0x0b8e('0x1b'),_0x11ef50,JSON[_0x0b8e('0x17')](_0x3e38dc));_0x5fde01(_0x3e38dc);})[_0x0b8e('0x18')](function(_0x43fcd7){logger[_0x0b8e('0x19')](_0x0b8e('0x1b'),_0x43fcd7[_0x0b8e('0x1a')],_0x11ef50);_0x580ea6(_0x562577[_0x0b8e('0x19')](0x1f4,_0x43fcd7['message']));});});}; \ No newline at end of file +var _0x6cc6=['lodash','ioredis','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','error','message','ShowSquareProject','find','raw','catch'];(function(_0x4a725c,_0x336f35){var _0x1010bf=function(_0x319c91){while(--_0x319c91){_0x4a725c['push'](_0x4a725c['shift']());}};_0x1010bf(++_0x336f35);}(_0x6cc6,0x6c));var _0x66cc=function(_0x57d0dc,_0x387f3e){_0x57d0dc=_0x57d0dc-0x0;var _0x177765=_0x6cc6[_0x57d0dc];return _0x177765;};'use strict';var _=require(_0x66cc('0x0'));var Redis=require(_0x66cc('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');config[_0x66cc('0x2')]=_[_0x66cc('0x3')](config[_0x66cc('0x2')],{'host':_0x66cc('0x4'),'port':0x18eb});var socket=require(_0x66cc('0x5'))(new Redis(config[_0x66cc('0x2')]));require(_0x66cc('0x6'))[_0x66cc('0x7')](socket);exports[_0x66cc('0x8')]=function(_0x1337f3){var _0x2200ce=this;return new Promise(function(_0x5f35f0,_0x3df7f5){return db[_0x66cc('0x9')][_0x66cc('0xa')]({'raw':_0x1337f3[_0x66cc('0xb')]?_0x1337f3[_0x66cc('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x1337f3[_0x66cc('0xb')]?_0x1337f3[_0x66cc('0xb')][_0x66cc('0xc')]||null:null,'attributes':_0x1337f3[_0x66cc('0xb')]?_0x1337f3[_0x66cc('0xb')][_0x66cc('0xd')]||null:null,'limit':_0x1337f3['options']?_0x1337f3['options']['limit']||null:null,'include':_0x1337f3[_0x66cc('0xb')]?_0x1337f3[_0x66cc('0xb')][_0x66cc('0xe')]?_['map'](_0x1337f3['options'][_0x66cc('0xe')],function(_0x33858b){return{'model':db[_0x33858b['model']],'as':_0x33858b['as'],'attributes':_0x33858b['attributes'],'include':_0x33858b['include']?_[_0x66cc('0xf')](_0x33858b[_0x66cc('0xe')],function(_0x20165a){return{'model':db[_0x20165a[_0x66cc('0x10')]],'as':_0x20165a['as'],'attributes':_0x20165a[_0x66cc('0xd')],'include':_0x20165a[_0x66cc('0xe')]?_[_0x66cc('0xf')](_0x20165a[_0x66cc('0xe')],function(_0x35b222){return{'model':db[_0x35b222['model']],'as':_0x35b222['as'],'attributes':_0x35b222['attributes']};}):[]};}):[]};}):[]:[]})[_0x66cc('0x11')](function(_0x1ba5f9){logger[_0x66cc('0x12')](_0x66cc('0x8'),_0x1337f3);logger[_0x66cc('0x13')](_0x66cc('0x8'),_0x1337f3,JSON[_0x66cc('0x14')](_0x1ba5f9));_0x5f35f0(_0x1ba5f9);})['catch'](function(_0x22676e){logger[_0x66cc('0x15')](_0x66cc('0x8'),_0x22676e[_0x66cc('0x16')],_0x1337f3);_0x3df7f5(_0x2200ce[_0x66cc('0x15')](0x1f4,_0x22676e[_0x66cc('0x16')]));});});};exports[_0x66cc('0x17')]=function(_0x592878){var _0x51a479=this;return new Promise(function(_0x1e3084,_0x1e533){return db['SquareProject'][_0x66cc('0x18')]({'raw':_0x592878[_0x66cc('0xb')]?_0x592878[_0x66cc('0xb')][_0x66cc('0x19')]===undefined?!![]:![]:!![],'where':_0x592878[_0x66cc('0xb')]?_0x592878[_0x66cc('0xb')][_0x66cc('0xc')]||null:null,'attributes':_0x592878[_0x66cc('0xb')]?_0x592878[_0x66cc('0xb')][_0x66cc('0xd')]||null:null,'include':_0x592878[_0x66cc('0xb')]?_0x592878[_0x66cc('0xb')][_0x66cc('0xe')]?_[_0x66cc('0xf')](_0x592878['options'][_0x66cc('0xe')],function(_0x3af4d3){return{'model':db[_0x3af4d3[_0x66cc('0x10')]],'as':_0x3af4d3['as'],'attributes':_0x3af4d3['attributes'],'include':_0x3af4d3[_0x66cc('0xe')]?_[_0x66cc('0xf')](_0x3af4d3[_0x66cc('0xe')],function(_0x4f01cd){return{'model':db[_0x4f01cd[_0x66cc('0x10')]],'as':_0x4f01cd['as'],'attributes':_0x4f01cd[_0x66cc('0xd')],'include':_0x4f01cd['include']?_['map'](_0x4f01cd[_0x66cc('0xe')],function(_0x5e08f0){return{'model':db[_0x5e08f0['model']],'as':_0x5e08f0['as'],'attributes':_0x5e08f0[_0x66cc('0xd')]};}):[]};}):[]};}):[]:[]})[_0x66cc('0x11')](function(_0x55b568){logger[_0x66cc('0x12')]('ShowSquareProject',_0x592878);logger['debug'](_0x66cc('0x17'),_0x592878,JSON[_0x66cc('0x14')](_0x55b568));_0x1e3084(_0x55b568);})[_0x66cc('0x1a')](function(_0xea39ee){logger[_0x66cc('0x15')]('ShowSquareProject',_0xea39ee['message'],_0x592878);_0x1e533(_0x51a479[_0x66cc('0x15')](0x1f4,_0xea39ee[_0x66cc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 82e0611..e13317e 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ff3=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x2842ce,_0x58d485){var _0x36383f=function(_0x4e3618){while(--_0x4e3618){_0x2842ce['push'](_0x2842ce['shift']());}};_0x36383f(++_0x58d485);}(_0x8ff3,0x1de));var _0x38ff=function(_0x5e4d7a,_0x474456){_0x5e4d7a=_0x5e4d7a-0x0;var _0x446c84=_0x8ff3[_0x5e4d7a];return _0x446c84;};'use strict';var SquareProjectEvents=require(_0x38ff('0x0'));var events=[_0x38ff('0x1'),'remove',_0x38ff('0x2')];function createListener(_0x2a962c,_0x138368){return function(_0x589cbd){_0x138368[_0x38ff('0x3')](_0x2a962c,_0x589cbd);};}function removeListener(_0x159178,_0x3e8951){return function(){SquareProjectEvents[_0x38ff('0x4')](_0x159178,_0x3e8951);};}exports[_0x38ff('0x5')]=function(_0x16d53f){for(var _0x4eb213=0x0,_0x2352e4=events[_0x38ff('0x6')];_0x4eb213<_0x2352e4;_0x4eb213++){var _0x37f13c=events[_0x4eb213];var _0x4178f3=createListener(_0x38ff('0x7')+_0x37f13c,_0x16d53f);SquareProjectEvents['on'](_0x37f13c,_0x4178f3);}}; \ No newline at end of file +var _0xb714=['removeListener','register','squareProject:','./squareProject.events','save','remove','emit'];(function(_0x3135c7,_0x553b77){var _0x4990a6=function(_0x1f165b){while(--_0x1f165b){_0x3135c7['push'](_0x3135c7['shift']());}};_0x4990a6(++_0x553b77);}(_0xb714,0x73));var _0x4b71=function(_0x2308db,_0x2e95c9){_0x2308db=_0x2308db-0x0;var _0x38d5de=_0xb714[_0x2308db];return _0x38d5de;};'use strict';var SquareProjectEvents=require(_0x4b71('0x0'));var events=[_0x4b71('0x1'),_0x4b71('0x2'),'update'];function createListener(_0x5308af,_0x4d6d20){return function(_0x54d7c9){_0x4d6d20[_0x4b71('0x3')](_0x5308af,_0x54d7c9);};}function removeListener(_0x2e9061,_0x12711a){return function(){SquareProjectEvents[_0x4b71('0x4')](_0x2e9061,_0x12711a);};}exports[_0x4b71('0x5')]=function(_0x2ac167){for(var _0x19dc3a=0x0,_0x141cd5=events['length'];_0x19dc3a<_0x141cd5;_0x19dc3a++){var _0x5c399c=events[_0x19dc3a];var _0x260d61=createListener(_0x4b71('0x6')+_0x5c399c,_0x2ac167);SquareProjectEvents['on'](_0x5c399c,_0x260d61);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 5d6848d..bc52afd 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x479e02,_0x405bcd){var _0x491cd2=function(_0x5841c6){while(--_0x5841c6){_0x479e02['push'](_0x479e02['shift']());}};_0x491cd2(++_0x405bcd);}(_0xabce,0x103));var _0xeabc=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xabce[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0xabfceb,_0x527714){var _0x163dd9=function(_0x4da7e5){while(--_0x4da7e5){_0xabfceb['push'](_0xabfceb['shift']());}};_0x163dd9(++_0x527714);}(_0x5fab,0x177));var _0xb5fa=function(_0x1850ba,_0x55e013){_0x1850ba=_0x1850ba-0x0;var _0x2045e8=_0x5fab[_0x1850ba];return _0x2045e8;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9b39b2b..f40dd5d 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x8958,0x93));var _0x8895=function(_0x5f8c66,_0x34daf0){_0x5f8c66=_0x5f8c66-0x0;var _0x4ab883=_0x8958[_0x5f8c66];return _0x4ab883;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'dnid':{'type':Sequelize[_0x8895('0x1')]},'projectName':{'type':Sequelize[_0x8895('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8895('0x1')]},'savePath':{'type':Sequelize[_0x8895('0x1')]},'format':{'type':Sequelize[_0x8895('0x2')],'get':function(){var _0x40cec6='';var _0x33013a=this['getDataValue'](_0x8895('0x3'));if(_0x33013a){_0x40cec6=_0x33013a[_0x8895('0x4')](_0x33013a[_0x8895('0x5')]('.'));}return _0x40cec6;}}}; \ No newline at end of file +var _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x327c49,_0xad6075){var _0x329f48=function(_0x3d5470){while(--_0x3d5470){_0x327c49['push'](_0x327c49['shift']());}};_0x329f48(++_0xad6075);}(_0xb458,0x103));var _0x8b45=function(_0x3c0fbc,_0xa02f8f){_0x3c0fbc=_0x3c0fbc-0x0;var _0x27f823=_0xb458[_0x3c0fbc];return _0x27f823;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7844fb4..238d09f 100644 --- a/server/api/squareRecording/squareRecording.controller.js +++ b/server/api/squareRecording/squareRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f8d=['download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','File:\x20\x22','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','update'];(function(_0x2de809,_0x18c579){var _0x5f25b5=function(_0x234474){while(--_0x234474){_0x2de809['push'](_0x2de809['shift']());}};_0x5f25b5(++_0x18c579);}(_0x9f8d,0x134));var _0xd9f8=function(_0x487bb6,_0x6f1fe6){_0x487bb6=_0x487bb6-0x0;var _0xd89568=_0x9f8d[_0x487bb6];return _0xd89568;};'use strict';var emlformat=require(_0xd9f8('0x0'));var rimraf=require(_0xd9f8('0x1'));var zipdir=require(_0xd9f8('0x2'));var jsonpatch=require(_0xd9f8('0x3'));var rp=require(_0xd9f8('0x4'));var moment=require(_0xd9f8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd9f8('0x6'));var path=require(_0xd9f8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd9f8('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd9f8('0x9'));var toCsv=require(_0xd9f8('0xa'));var querystring=require('querystring');var Papa=require(_0xd9f8('0xb'));var Redis=require(_0xd9f8('0xc'));var authService=require(_0xd9f8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xd9f8('0xe'));var hardwareService=require(_0xd9f8('0xf'));var logger=require('../../config/logger')(_0xd9f8('0x10'));var utils=require('../../config/utils');var config=require(_0xd9f8('0x11'));var licenseUtil=require(_0xd9f8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4706c4,_0x3cccde){_0x3cccde=_0x3cccde||0xcc;return function(_0x4b3e0e){if(_0x4b3e0e){return _0x4706c4[_0xd9f8('0x13')](_0x3cccde);}return _0x4706c4[_0xd9f8('0x14')](_0x3cccde)[_0xd9f8('0x15')]();};}function respondWithResult(_0x7d860f,_0x15f456){_0x15f456=_0x15f456||0xc8;return function(_0x176367){if(_0x176367){return _0x7d860f[_0xd9f8('0x14')](_0x15f456)[_0xd9f8('0x16')](_0x176367);}};}function respondWithFilteredResult(_0x37918b,_0x377a7b){return function(_0x7f923c){if(_0x7f923c){var _0x5da033=typeof _0x377a7b[_0xd9f8('0x17')]===_0xd9f8('0x18')&&typeof _0x377a7b[_0xd9f8('0x19')]===_0xd9f8('0x18');var _0xc7be63=_0x7f923c[_0xd9f8('0x1a')];var _0x14e684=_0x5da033?0x0:_0x377a7b[_0xd9f8('0x17')];var _0x4a3654=_0x5da033?_0x7f923c['count']:_0x377a7b['offset']+_0x377a7b[_0xd9f8('0x19')];var _0x5a1cf1;if(_0x4a3654>=_0xc7be63){_0x4a3654=_0xc7be63;_0x5a1cf1=0xc8;}else{_0x5a1cf1=0xce;}_0x37918b[_0xd9f8('0x14')](_0x5a1cf1);return _0x37918b['set'](_0xd9f8('0x1b'),_0x14e684+'-'+_0x4a3654+'/'+_0xc7be63)[_0xd9f8('0x16')](_0x7f923c);}return null;};}function patchUpdates(_0x2a6539){return function(_0x5104a9){try{jsonpatch[_0xd9f8('0x1c')](_0x5104a9,_0x2a6539,!![]);}catch(_0x8df0d0){return BPromise['reject'](_0x8df0d0);}return _0x5104a9[_0xd9f8('0x1d')]();};}function saveUpdates(_0x806e10,_0x54d45f){return function(_0x104515){if(_0x104515){return _0x104515['update'](_0x806e10)[_0xd9f8('0x1e')](function(_0x5684c0){return _0x5684c0;});}return null;};}function removeEntity(_0x217a5e,_0x802880){return function(_0x7d8b68){if(_0x7d8b68){return _0x7d8b68[_0xd9f8('0x1f')]()[_0xd9f8('0x1e')](function(){_0x217a5e[_0xd9f8('0x14')](0xcc)[_0xd9f8('0x15')]();});}};}function handleEntityNotFound(_0x336231,_0x1ba687){return function(_0x56a7f1){if(!_0x56a7f1){_0x336231['sendStatus'](0x194);}return _0x56a7f1;};}function handleError(_0x58e4b1,_0x2adfe4){_0x2adfe4=_0x2adfe4||0x1f4;return function(_0x48f651){logger[_0xd9f8('0x20')](_0x48f651[_0xd9f8('0x21')]);if(_0x48f651[_0xd9f8('0x22')]){delete _0x48f651['name'];}_0x58e4b1[_0xd9f8('0x14')](_0x2adfe4)[_0xd9f8('0x23')](_0x48f651);};}exports[_0xd9f8('0x24')]=function(_0x11a091,_0x262fce){var _0xae2b8={},_0x2da35e={},_0x1b721e={'count':0x0,'rows':[]};var _0x2a211f=_[_0xd9f8('0x25')](db[_0xd9f8('0x26')][_0xd9f8('0x27')],function(_0x56ad2b){return{'name':_0x56ad2b[_0xd9f8('0x28')],'type':_0x56ad2b['type'][_0xd9f8('0x29')]};});_0x2da35e['model']=_[_0xd9f8('0x25')](_0x2a211f,_0xd9f8('0x22'));_0x2da35e[_0xd9f8('0x2a')]=_[_0xd9f8('0x2b')](_0x11a091[_0xd9f8('0x2a')]);_0x2da35e['filters']=_['intersection'](_0x2da35e[_0xd9f8('0x2c')],_0x2da35e['query']);_0xae2b8[_0xd9f8('0x2d')]=_[_0xd9f8('0x2e')](_0x2da35e[_0xd9f8('0x2c')],qs['fields'](_0x11a091['query'][_0xd9f8('0x2f')]));_0xae2b8[_0xd9f8('0x2d')]=_0xae2b8[_0xd9f8('0x2d')]['length']?_0xae2b8[_0xd9f8('0x2d')]:_0x2da35e[_0xd9f8('0x2c')];if(!_0x11a091['query'][_0xd9f8('0x30')](_0xd9f8('0x31'))){_0xae2b8[_0xd9f8('0x19')]=qs[_0xd9f8('0x19')](_0x11a091[_0xd9f8('0x2a')][_0xd9f8('0x19')]);_0xae2b8[_0xd9f8('0x17')]=qs[_0xd9f8('0x17')](_0x11a091['query'][_0xd9f8('0x17')]);}_0xae2b8[_0xd9f8('0x32')]=qs[_0xd9f8('0x33')](_0x11a091[_0xd9f8('0x2a')][_0xd9f8('0x33')]);_0xae2b8[_0xd9f8('0x34')]=qs[_0xd9f8('0x35')](_[_0xd9f8('0x36')](_0x11a091[_0xd9f8('0x2a')],_0x2da35e[_0xd9f8('0x35')]),_0x2a211f);if(_0x11a091[_0xd9f8('0x2a')][_0xd9f8('0x37')]){_0xae2b8[_0xd9f8('0x34')]=_[_0xd9f8('0x38')](_0xae2b8[_0xd9f8('0x34')],{'$or':_['map'](_0x2a211f,function(_0x3d2624){if(_0x3d2624[_0xd9f8('0x39')]!==_0xd9f8('0x3a')){var _0x530ec8={};_0x530ec8[_0x3d2624['name']]={'$like':'%'+_0x11a091[_0xd9f8('0x2a')][_0xd9f8('0x37')]+'%'};return _0x530ec8;}})});}_0xae2b8=_[_0xd9f8('0x38')]({},_0xae2b8,_0x11a091[_0xd9f8('0x3b')]);var _0x2de988={'where':_0xae2b8[_0xd9f8('0x34')]};return db[_0xd9f8('0x26')][_0xd9f8('0x1a')](_0x2de988)[_0xd9f8('0x1e')](function(_0x4f4a32){_0x1b721e[_0xd9f8('0x1a')]=_0x4f4a32;if(_0x11a091[_0xd9f8('0x2a')][_0xd9f8('0x3c')]){_0xae2b8[_0xd9f8('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0xd9f8('0x3e')](_0xae2b8);})[_0xd9f8('0x1e')](function(_0x2d7263){_0x1b721e[_0xd9f8('0x3f')]=_0x2d7263;return _0x1b721e;})[_0xd9f8('0x1e')](respondWithFilteredResult(_0x262fce,_0xae2b8))['catch'](handleError(_0x262fce,null));};exports[_0xd9f8('0x40')]=function(_0x4fd368,_0xd82273){var _0x4e0952={'raw':!![],'where':{'id':_0x4fd368[_0xd9f8('0x41')]['id']}},_0x4cff70={};_0x4cff70[_0xd9f8('0x2c')]=_[_0xd9f8('0x2b')](db[_0xd9f8('0x26')]['rawAttributes']);_0x4cff70[_0xd9f8('0x2a')]=_[_0xd9f8('0x2b')](_0x4fd368[_0xd9f8('0x2a')]);_0x4cff70[_0xd9f8('0x35')]=_['intersection'](_0x4cff70['model'],_0x4cff70[_0xd9f8('0x2a')]);_0x4e0952['attributes']=_[_0xd9f8('0x2e')](_0x4cff70[_0xd9f8('0x2c')],qs[_0xd9f8('0x2f')](_0x4fd368['query']['fields']));_0x4e0952[_0xd9f8('0x2d')]=_0x4e0952[_0xd9f8('0x2d')][_0xd9f8('0x42')]?_0x4e0952[_0xd9f8('0x2d')]:_0x4cff70['model'];if(_0x4fd368[_0xd9f8('0x2a')][_0xd9f8('0x3c')]){_0x4e0952[_0xd9f8('0x3d')]=[{'all':!![]}];}_0x4e0952=_[_0xd9f8('0x38')]({},_0x4e0952,_0x4fd368[_0xd9f8('0x3b')]);return db[_0xd9f8('0x26')][_0xd9f8('0x43')](_0x4e0952)['then'](handleEntityNotFound(_0xd82273,null))['then'](respondWithResult(_0xd82273,null))[_0xd9f8('0x44')](handleError(_0xd82273,null));};exports[_0xd9f8('0x45')]=function(_0x4f3536,_0x2c15d9){return db[_0xd9f8('0x26')][_0xd9f8('0x45')](_0x4f3536[_0xd9f8('0x46')],{})[_0xd9f8('0x1e')](respondWithResult(_0x2c15d9,0xc9))['catch'](handleError(_0x2c15d9,null));};exports[_0xd9f8('0x47')]=function(_0x578020,_0x391bc8){if(_0x578020[_0xd9f8('0x46')]['id']){delete _0x578020[_0xd9f8('0x46')]['id'];}return db[_0xd9f8('0x26')]['find']({'where':{'id':_0x578020[_0xd9f8('0x41')]['id']}})['then'](handleEntityNotFound(_0x391bc8,null))[_0xd9f8('0x1e')](saveUpdates(_0x578020[_0xd9f8('0x46')],null))[_0xd9f8('0x1e')](respondWithResult(_0x391bc8,null))[_0xd9f8('0x44')](handleError(_0x391bc8,null));};exports[_0xd9f8('0x48')]=function(_0x123c4e,_0x125c62,_0x104ec8){var _0x525c68=require(_0xd9f8('0x49'));var _0x165c2a=![];var _0xe622af={};if(_0x123c4e['query'][_0xd9f8('0x39')]&&_0x123c4e[_0xd9f8('0x2a')]['type']===_0xd9f8('0x4a')){_0xe622af[_0xd9f8('0x4a')]=_0x123c4e[_0xd9f8('0x41')]['id'];}else{_0xe622af['id']=_0x123c4e[_0xd9f8('0x41')]['id'];}return db['SquareRecording'][_0xd9f8('0x43')]({'where':_0xe622af,'attributes':['id','savePath','filename'],'raw':!![]})[_0xd9f8('0x1e')](handleEntityNotFound(_0x125c62,null))[_0xd9f8('0x1e')](function(_0x2be8d8){if(_0x2be8d8){var _0x4163a2=_0x2be8d8[_0xd9f8('0x4b')];var _0x2cf2c6=util[_0xd9f8('0x4c')](_0xd9f8('0x4d'),_0x4163a2);if(fs['existsSync'](_0x2cf2c6)){_0x165c2a=!![];return _0x525c68['decryptFile'](_0x2cf2c6,_0x4163a2,config[_0xd9f8('0x4e')][_0xd9f8('0x4f')])[_0xd9f8('0x1e')](function(){return _0x2be8d8;});}return _0x2be8d8;}})['then'](function(_0x168a78){if(_0x168a78){var _0x3bb885=_0x168a78[_0xd9f8('0x4b')];if(!fs['existsSync'](_0x3bb885)){throw new db[(_0xd9f8('0x50'))][(_0xd9f8('0x51'))](_0xd9f8('0x52'));}if(_0x168a78[_0xd9f8('0x53')]){return _0x125c62[_0xd9f8('0x48')](_0x3bb885,_0x168a78[_0xd9f8('0x53')]+path[_0xd9f8('0x54')](_0x3bb885),function(){if(_0x165c2a){fs['unlink'](_0x3bb885);}});}else{return _0x125c62[_0xd9f8('0x48')](_0x3bb885,function(_0x167465){if(_0x165c2a){fs[_0xd9f8('0x55')](_0x3bb885);}});}}})[_0xd9f8('0x44')](function(_0x42b3dd){if(_0x42b3dd[_0xd9f8('0x56')]===_0xd9f8('0x52')){_0x125c62[_0xd9f8('0x14')](0x194)[_0xd9f8('0x23')](_0xd9f8('0x57'));}else{return handleError(_0x125c62,null);}});};exports[_0xd9f8('0x1f')]=function(_0x358000,_0x21a505){return db[_0xd9f8('0x26')][_0xd9f8('0x43')]({'where':{'id':_0x358000[_0xd9f8('0x41')]['id']}})[_0xd9f8('0x1e')](function(_0x458b1f){if(_['isNil'](_0x458b1f)){throw new ReferenceError(_0xd9f8('0x58'));}return _0x458b1f;})[_0xd9f8('0x1e')](function(_0x270eed){var _0x45049f=_0x270eed['savePath'];logger[_0xd9f8('0x59')](_0xd9f8('0x5a'),_0x45049f);if(!_[_0xd9f8('0x5b')](_0x270eed['savePath'])&&fs[_0xd9f8('0x5c')](_0x45049f)){logger['info'](_0xd9f8('0x5d')+_0x45049f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd9f8('0x5e')](_0x45049f);}_0x45049f=_0x45049f+'.cypher';if(!_['isNil'](_0x270eed[_0xd9f8('0x4b')])&&fs[_0xd9f8('0x5c')](_0x45049f)){logger[_0xd9f8('0x59')](_0xd9f8('0x5d')+_0x45049f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd9f8('0x5e')](_0x45049f);}return _0x270eed;})[_0xd9f8('0x1e')](function(_0x563281){if(!_0x563281)throw new InternalError();return _0x563281[_0xd9f8('0x1f')]();})[_0xd9f8('0x1e')](function(){_0x21a505['status'](0xcc)[_0xd9f8('0x15')]();})[_0xd9f8('0x44')](handleError(_0x21a505,null));}; \ No newline at end of file +var _0x878a=['filename','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','type','options','includeAll','include','findAll','rows','params','find','catch','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x878a,0x70));var _0xa878=function(_0x529519,_0x149da8){_0x529519=_0x529519-0x0;var _0x53b21e=_0x878a[_0x529519];return _0x53b21e;};'use strict';var emlformat=require(_0xa878('0x0'));var rimraf=require(_0xa878('0x1'));var zipdir=require(_0xa878('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa878('0x3'));var moment=require(_0xa878('0x4'));var BPromise=require(_0xa878('0x5'));var Mustache=require(_0xa878('0x6'));var util=require(_0xa878('0x7'));var path=require(_0xa878('0x8'));var sox=require(_0xa878('0x9'));var csv=require(_0xa878('0xa'));var ejs=require(_0xa878('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa878('0xc'));var squel=require(_0xa878('0xd'));var crypto=require(_0xa878('0xe'));var jsforce=require(_0xa878('0xf'));var deskjs=require(_0xa878('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa878('0x11'));var Papa=require(_0xa878('0x12'));var Redis=require(_0xa878('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa878('0x14'));var as=require(_0xa878('0x15'));var hardwareService=require(_0xa878('0x16'));var logger=require(_0xa878('0x17'))(_0xa878('0x18'));var utils=require(_0xa878('0x19'));var config=require(_0xa878('0x1a'));var licenseUtil=require(_0xa878('0x1b'));var db=require(_0xa878('0x1c'))['db'];function respondWithStatusCode(_0xcedaee,_0x8776b4){_0x8776b4=_0x8776b4||0xcc;return function(_0x391e61){if(_0x391e61){return _0xcedaee[_0xa878('0x1d')](_0x8776b4);}return _0xcedaee[_0xa878('0x1e')](_0x8776b4)[_0xa878('0x1f')]();};}function respondWithResult(_0x19746c,_0xc85a23){_0xc85a23=_0xc85a23||0xc8;return function(_0x1c2501){if(_0x1c2501){return _0x19746c['status'](_0xc85a23)[_0xa878('0x20')](_0x1c2501);}};}function respondWithFilteredResult(_0x43ac98,_0x4535b2){return function(_0x7a74ee){if(_0x7a74ee){var _0x35a54d=typeof _0x4535b2[_0xa878('0x21')]==='undefined'&&typeof _0x4535b2[_0xa878('0x22')]===_0xa878('0x23');var _0xbb99a5=_0x7a74ee[_0xa878('0x24')];var _0x49f3c3=_0x35a54d?0x0:_0x4535b2[_0xa878('0x21')];var _0x22c4b4=_0x35a54d?_0x7a74ee[_0xa878('0x24')]:_0x4535b2[_0xa878('0x21')]+_0x4535b2[_0xa878('0x22')];var _0x5a6213;if(_0x22c4b4>=_0xbb99a5){_0x22c4b4=_0xbb99a5;_0x5a6213=0xc8;}else{_0x5a6213=0xce;}_0x43ac98[_0xa878('0x1e')](_0x5a6213);return _0x43ac98[_0xa878('0x25')](_0xa878('0x26'),_0x49f3c3+'-'+_0x22c4b4+'/'+_0xbb99a5)[_0xa878('0x20')](_0x7a74ee);}return null;};}function patchUpdates(_0x1ce518){return function(_0x155241){try{jsonpatch[_0xa878('0x27')](_0x155241,_0x1ce518,!![]);}catch(_0x22d0bb){return BPromise[_0xa878('0x28')](_0x22d0bb);}return _0x155241['save']();};}function saveUpdates(_0x562b9b,_0x2d3b8b){return function(_0x317c10){if(_0x317c10){return _0x317c10[_0xa878('0x29')](_0x562b9b)[_0xa878('0x2a')](function(_0x393342){return _0x393342;});}return null;};}function removeEntity(_0x26660e,_0x24bead){return function(_0x208b8e){if(_0x208b8e){return _0x208b8e[_0xa878('0x2b')]()[_0xa878('0x2a')](function(){_0x26660e[_0xa878('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b856c,_0x27143d){return function(_0x2040d4){if(!_0x2040d4){_0x5b856c[_0xa878('0x1d')](0x194);}return _0x2040d4;};}function handleError(_0x49b5a3,_0x195ef3){_0x195ef3=_0x195ef3||0x1f4;return function(_0x1650e4){logger[_0xa878('0x2c')](_0x1650e4['stack']);if(_0x1650e4['name']){delete _0x1650e4[_0xa878('0x2d')];}_0x49b5a3[_0xa878('0x1e')](_0x195ef3)[_0xa878('0x2e')](_0x1650e4);};}exports[_0xa878('0x2f')]=function(_0x57f5d8,_0x2f2c2b){var _0xec57eb={},_0x847707={},_0x5af26d={'count':0x0,'rows':[]};var _0x2b8ce2=_[_0xa878('0x30')](db[_0xa878('0x31')][_0xa878('0x32')],function(_0x5b7375){return{'name':_0x5b7375[_0xa878('0x33')],'type':_0x5b7375['type'][_0xa878('0x34')]};});_0x847707[_0xa878('0x35')]=_['map'](_0x2b8ce2,_0xa878('0x2d'));_0x847707['query']=_[_0xa878('0x36')](_0x57f5d8[_0xa878('0x37')]);_0x847707[_0xa878('0x38')]=_[_0xa878('0x39')](_0x847707[_0xa878('0x35')],_0x847707[_0xa878('0x37')]);_0xec57eb[_0xa878('0x3a')]=_[_0xa878('0x39')](_0x847707['model'],qs['fields'](_0x57f5d8[_0xa878('0x37')][_0xa878('0x3b')]));_0xec57eb[_0xa878('0x3a')]=_0xec57eb[_0xa878('0x3a')][_0xa878('0x3c')]?_0xec57eb[_0xa878('0x3a')]:_0x847707[_0xa878('0x35')];if(!_0x57f5d8[_0xa878('0x37')][_0xa878('0x3d')]('nolimit')){_0xec57eb[_0xa878('0x22')]=qs[_0xa878('0x22')](_0x57f5d8['query'][_0xa878('0x22')]);_0xec57eb[_0xa878('0x21')]=qs[_0xa878('0x21')](_0x57f5d8[_0xa878('0x37')][_0xa878('0x21')]);}_0xec57eb[_0xa878('0x3e')]=qs[_0xa878('0x3f')](_0x57f5d8[_0xa878('0x37')][_0xa878('0x3f')]);_0xec57eb['where']=qs['filters'](_['pick'](_0x57f5d8[_0xa878('0x37')],_0x847707[_0xa878('0x38')]),_0x2b8ce2);if(_0x57f5d8[_0xa878('0x37')][_0xa878('0x40')]){_0xec57eb['where']=_[_0xa878('0x41')](_0xec57eb[_0xa878('0x42')],{'$or':_[_0xa878('0x30')](_0x2b8ce2,function(_0x35f23e){if(_0x35f23e[_0xa878('0x43')]!=='VIRTUAL'){var _0x24ce58={};_0x24ce58[_0x35f23e[_0xa878('0x2d')]]={'$like':'%'+_0x57f5d8[_0xa878('0x37')][_0xa878('0x40')]+'%'};return _0x24ce58;}})});}_0xec57eb=_[_0xa878('0x41')]({},_0xec57eb,_0x57f5d8[_0xa878('0x44')]);var _0x407ece={'where':_0xec57eb[_0xa878('0x42')]};return db[_0xa878('0x31')]['count'](_0x407ece)[_0xa878('0x2a')](function(_0x54d95f){_0x5af26d[_0xa878('0x24')]=_0x54d95f;if(_0x57f5d8['query'][_0xa878('0x45')]){_0xec57eb[_0xa878('0x46')]=[{'all':!![]}];}return db[_0xa878('0x31')][_0xa878('0x47')](_0xec57eb);})[_0xa878('0x2a')](function(_0x577790){_0x5af26d[_0xa878('0x48')]=_0x577790;return _0x5af26d;})[_0xa878('0x2a')](respondWithFilteredResult(_0x2f2c2b,_0xec57eb))['catch'](handleError(_0x2f2c2b,null));};exports['show']=function(_0x14a0bc,_0x18370f){var _0x58f801={'raw':!![],'where':{'id':_0x14a0bc[_0xa878('0x49')]['id']}},_0x146e1b={};_0x146e1b[_0xa878('0x35')]=_[_0xa878('0x36')](db[_0xa878('0x31')][_0xa878('0x32')]);_0x146e1b[_0xa878('0x37')]=_[_0xa878('0x36')](_0x14a0bc[_0xa878('0x37')]);_0x146e1b[_0xa878('0x38')]=_['intersection'](_0x146e1b[_0xa878('0x35')],_0x146e1b[_0xa878('0x37')]);_0x58f801[_0xa878('0x3a')]=_[_0xa878('0x39')](_0x146e1b[_0xa878('0x35')],qs['fields'](_0x14a0bc[_0xa878('0x37')][_0xa878('0x3b')]));_0x58f801[_0xa878('0x3a')]=_0x58f801['attributes'][_0xa878('0x3c')]?_0x58f801[_0xa878('0x3a')]:_0x146e1b[_0xa878('0x35')];if(_0x14a0bc[_0xa878('0x37')]['includeAll']){_0x58f801[_0xa878('0x46')]=[{'all':!![]}];}_0x58f801=_[_0xa878('0x41')]({},_0x58f801,_0x14a0bc['options']);return db[_0xa878('0x31')][_0xa878('0x4a')](_0x58f801)['then'](handleEntityNotFound(_0x18370f,null))[_0xa878('0x2a')](respondWithResult(_0x18370f,null))[_0xa878('0x4b')](handleError(_0x18370f,null));};exports['create']=function(_0xb4c913,_0x1f06e3){return db['SquareRecording']['create'](_0xb4c913[_0xa878('0x4c')],{})[_0xa878('0x2a')](respondWithResult(_0x1f06e3,0xc9))[_0xa878('0x4b')](handleError(_0x1f06e3,null));};exports[_0xa878('0x29')]=function(_0x468a03,_0x462187){if(_0x468a03[_0xa878('0x4c')]['id']){delete _0x468a03['body']['id'];}return db[_0xa878('0x31')][_0xa878('0x4a')]({'where':{'id':_0x468a03[_0xa878('0x49')]['id']}})[_0xa878('0x2a')](handleEntityNotFound(_0x462187,null))[_0xa878('0x2a')](saveUpdates(_0x468a03['body'],null))[_0xa878('0x2a')](respondWithResult(_0x462187,null))[_0xa878('0x4b')](handleError(_0x462187,null));};exports[_0xa878('0x4d')]=function(_0x29cf0b,_0x414e4a,_0xd7ef6e){var _0x218436=require(_0xa878('0x4e'));var _0x2432c9=![];var _0x5746ad={};if(_0x29cf0b[_0xa878('0x37')][_0xa878('0x43')]&&_0x29cf0b[_0xa878('0x37')]['type']===_0xa878('0x4f')){_0x5746ad['uniqueid']=_0x29cf0b[_0xa878('0x49')]['id'];}else{_0x5746ad['id']=_0x29cf0b[_0xa878('0x49')]['id'];}return db['SquareRecording'][_0xa878('0x4a')]({'where':_0x5746ad,'attributes':['id','savePath','filename'],'raw':!![]})[_0xa878('0x2a')](handleEntityNotFound(_0x414e4a,null))['then'](function(_0x1e6ab7){if(_0x1e6ab7){var _0xdff476=_0x1e6ab7[_0xa878('0x50')];var _0x1d0bf7=util[_0xa878('0x51')](_0xa878('0x52'),_0xdff476);if(fs['existsSync'](_0x1d0bf7)){_0x2432c9=!![];return _0x218436[_0xa878('0x53')](_0x1d0bf7,_0xdff476,config[_0xa878('0x54')]['recording'])[_0xa878('0x2a')](function(){return _0x1e6ab7;});}return _0x1e6ab7;}})['then'](function(_0x344a39){if(_0x344a39){var _0x2be39a=_0x344a39['savePath'];if(!fs['existsSync'](_0x2be39a)){throw new db[(_0xa878('0x55'))][(_0xa878('0x56'))](_0xa878('0x57'));}if(_0x344a39[_0xa878('0x58')]){return _0x414e4a['download'](_0x2be39a,_0x344a39[_0xa878('0x58')]+path[_0xa878('0x59')](_0x2be39a),function(){if(_0x2432c9){fs[_0xa878('0x5a')](_0x2be39a);}});}else{return _0x414e4a[_0xa878('0x4d')](_0x2be39a,function(_0x5712ca){if(_0x2432c9){fs[_0xa878('0x5a')](_0x2be39a);}});}}})[_0xa878('0x4b')](function(_0x420c20){if(_0x420c20['message']===_0xa878('0x57')){_0x414e4a[_0xa878('0x1e')](0x194)['send']('Not\x20found');}else{return handleError(_0x414e4a,null);}});};exports[_0xa878('0x2b')]=function(_0x47e6cf,_0x5035af){return db[_0xa878('0x31')][_0xa878('0x4a')]({'where':{'id':_0x47e6cf[_0xa878('0x49')]['id']}})[_0xa878('0x2a')](function(_0x1b759c){if(_[_0xa878('0x5b')](_0x1b759c)){throw new ReferenceError(_0xa878('0x5c'));}return _0x1b759c;})['then'](function(_0x357c0e){var _0x25d39f=_0x357c0e[_0xa878('0x50')];logger[_0xa878('0x5d')](_0xa878('0x5e'),_0x25d39f);if(!_[_0xa878('0x5b')](_0x357c0e[_0xa878('0x50')])&&fs[_0xa878('0x5f')](_0x25d39f)){logger[_0xa878('0x5d')](_0xa878('0x60')+_0x25d39f+_0xa878('0x61'));fs[_0xa878('0x62')](_0x25d39f);}_0x25d39f=_0x25d39f+_0xa878('0x63');if(!_[_0xa878('0x5b')](_0x357c0e[_0xa878('0x50')])&&fs[_0xa878('0x5f')](_0x25d39f)){logger[_0xa878('0x5d')](_0xa878('0x60')+_0x25d39f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa878('0x62')](_0x25d39f);}return _0x357c0e;})[_0xa878('0x2a')](function(_0x489321){if(!_0x489321)throw new InternalError();return _0x489321[_0xa878('0x2b')]();})[_0xa878('0x2a')](function(){_0x5035af[_0xa878('0x1e')](0xcc)[_0xa878('0x1f')]();})[_0xa878('0x4b')](handleError(_0x5035af,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b75b5ba..343426c 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c24=['moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api'];(function(_0xfcfe92,_0x14ea66){var _0x166ba1=function(_0x45f01a){while(--_0x45f01a){_0xfcfe92['push'](_0xfcfe92['shift']());}};_0x166ba1(++_0x14ea66);}(_0x2c24,0x1e6));var _0x42c2=function(_0x4cfac1,_0x4dc6ae){_0x4cfac1=_0x4cfac1-0x0;var _0x19d910=_0x2c24[_0x4cfac1];return _0x19d910;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var logger=require(_0x42c2('0x2'))(_0x42c2('0x3'));var moment=require(_0x42c2('0x4'));var BPromise=require(_0x42c2('0x5'));var rp=require(_0x42c2('0x6'));var fs=require('fs');var path=require(_0x42c2('0x7'));var rimraf=require(_0x42c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x42c2('0x9'));module[_0x42c2('0xa')]=function(_0x4950c1,_0x20d310){return _0x4950c1[_0x42c2('0xb')](_0x42c2('0xc'),attributes,{'tableName':_0x42c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7524=['../../config/logger','moment','bluebird','rimraf','./squareRecording.attributes','exports','define','square_recordings','util'];(function(_0x56a2ea,_0x318c3b){var _0x1cb706=function(_0x26c5fc){while(--_0x26c5fc){_0x56a2ea['push'](_0x56a2ea['shift']());}};_0x1cb706(++_0x318c3b);}(_0x7524,0xce));var _0x4752=function(_0x4857fc,_0x5745dc){_0x4857fc=_0x4857fc-0x0;var _0xe7430f=_0x7524[_0x4857fc];return _0xe7430f;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var logger=require(_0x4752('0x1'))('api');var moment=require(_0x4752('0x2'));var BPromise=require(_0x4752('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4752('0x4'));var config=require('../../config/environment');var attributes=require(_0x4752('0x5'));module[_0x4752('0x6')]=function(_0x66a421,_0x55b411){return _0x66a421[_0x4752('0x7')]('SquareRecording',attributes,{'tableName':_0x4752('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 4642d15..4cfa9ab 100644 --- a/server/api/squareRecording/squareRecording.rpc.js +++ b/server/api/squareRecording/squareRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcec9=['SquareRecording','create','body','options','raw','then','stringify','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSquareRecording'];(function(_0xdfa7eb,_0x348b2a){var _0x5cfd44=function(_0x52a9a3){while(--_0x52a9a3){_0xdfa7eb['push'](_0xdfa7eb['shift']());}};_0x5cfd44(++_0x348b2a);}(_0xcec9,0x7b));var _0x9cec=function(_0x36ab7a,_0xce6bfd){_0x36ab7a=_0x36ab7a-0x0;var _0x4eb93d=_0xcec9[_0x36ab7a];return _0x4eb93d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9cec('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cec('0x1'));var db=require(_0x9cec('0x2'))['db'];var utils=require(_0x9cec('0x3'));var logger=require(_0x9cec('0x4'))(_0x9cec('0x5'));var config=require(_0x9cec('0x6'));var jayson=require(_0x9cec('0x7'));var client=jayson[_0x9cec('0x8')][_0x9cec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x418edd,_0x30bfbd,_0x3af558){return new BPromise(function(_0x6a048d,_0x184e67){return client[_0x9cec('0xa')](_0x418edd,_0x3af558)['then'](function(_0x538fcd){logger['info'](_0x9cec('0xb'),_0x30bfbd,_0x9cec('0xc'));logger[_0x9cec('0xd')](_0x9cec('0xe'),_0x30bfbd,_0x9cec('0xc'),JSON['stringify'](_0x538fcd));if(_0x538fcd[_0x9cec('0xf')]){if(_0x538fcd[_0x9cec('0xf')][_0x9cec('0x10')]===0x1f4){logger[_0x9cec('0xf')](_0x9cec('0xb'),_0x30bfbd,_0x538fcd[_0x9cec('0xf')][_0x9cec('0x11')]);return _0x184e67(_0x538fcd[_0x9cec('0xf')][_0x9cec('0x11')]);}logger[_0x9cec('0xf')](_0x9cec('0xb'),_0x30bfbd,_0x538fcd[_0x9cec('0xf')]['message']);return _0x6a048d(_0x538fcd[_0x9cec('0xf')][_0x9cec('0x11')]);}else{logger[_0x9cec('0x12')]('SquareRecording,\x20%s,\x20%s',_0x30bfbd,_0x9cec('0xc'));_0x6a048d(_0x538fcd[_0x9cec('0x13')]['message']);}})[_0x9cec('0x14')](function(_0x13e975){logger['error'](_0x9cec('0xb'),_0x30bfbd,_0x13e975);_0x184e67(_0x13e975);});});}exports[_0x9cec('0x15')]=function(_0x32c498){var _0x152ea7=this;return new Promise(function(_0x3c7963,_0x41eb57){return db[_0x9cec('0x16')][_0x9cec('0x17')](_0x32c498[_0x9cec('0x18')],{'raw':_0x32c498[_0x9cec('0x19')]?_0x32c498[_0x9cec('0x19')][_0x9cec('0x1a')]===undefined?!![]:![]:!![]})[_0x9cec('0x1b')](function(_0x12949c){logger[_0x9cec('0x12')]('CreateSquareRecording',_0x32c498);logger[_0x9cec('0xd')](_0x9cec('0x15'),_0x32c498,JSON[_0x9cec('0x1c')](_0x12949c));_0x3c7963(_0x12949c);})[_0x9cec('0x14')](function(_0x31210b){logger['error']('CreateSquareRecording',_0x31210b[_0x9cec('0x11')],_0x32c498);_0x41eb57(_0x152ea7[_0x9cec('0xf')](0x1f4,_0x31210b['message']));});});}; \ No newline at end of file +var _0xd649=['message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x502914,_0x1ade1a){var _0x132223=function(_0xce95c6){while(--_0xce95c6){_0x502914['push'](_0x502914['shift']());}};_0x132223(++_0x1ade1a);}(_0xd649,0x1a0));var _0x9d64=function(_0x3ce685,_0x419760){_0x3ce685=_0x3ce685-0x0;var _0x583748=_0xd649[_0x3ce685];return _0x583748;};'use strict';var _=require(_0x9d64('0x0'));var util=require(_0x9d64('0x1'));var moment=require(_0x9d64('0x2'));var BPromise=require(_0x9d64('0x3'));var rs=require(_0x9d64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d64('0x5'))['db'];var utils=require(_0x9d64('0x6'));var logger=require(_0x9d64('0x7'))('rpc');var config=require(_0x9d64('0x8'));var jayson=require(_0x9d64('0x9'));var client=jayson[_0x9d64('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40de15,_0x42608d,_0x16db5d){return new BPromise(function(_0x101f49,_0x1a3666){return client['request'](_0x40de15,_0x16db5d)[_0x9d64('0xb')](function(_0x36b012){logger[_0x9d64('0xc')](_0x9d64('0xd'),_0x42608d,_0x9d64('0xe'));logger['debug'](_0x9d64('0xf'),_0x42608d,_0x9d64('0xe'),JSON[_0x9d64('0x10')](_0x36b012));if(_0x36b012[_0x9d64('0x11')]){if(_0x36b012['error'][_0x9d64('0x12')]===0x1f4){logger[_0x9d64('0x11')](_0x9d64('0xd'),_0x42608d,_0x36b012['error'][_0x9d64('0x13')]);return _0x1a3666(_0x36b012[_0x9d64('0x11')][_0x9d64('0x13')]);}logger[_0x9d64('0x11')](_0x9d64('0xd'),_0x42608d,_0x36b012[_0x9d64('0x11')][_0x9d64('0x13')]);return _0x101f49(_0x36b012[_0x9d64('0x11')]['message']);}else{logger[_0x9d64('0xc')](_0x9d64('0xd'),_0x42608d,_0x9d64('0xe'));_0x101f49(_0x36b012[_0x9d64('0x14')][_0x9d64('0x13')]);}})[_0x9d64('0x15')](function(_0x5d1d0c){logger['error'](_0x9d64('0xd'),_0x42608d,_0x5d1d0c);_0x1a3666(_0x5d1d0c);});});}exports[_0x9d64('0x16')]=function(_0x580322){var _0x397cb5=this;return new Promise(function(_0xb4f042,_0x25b9d2){return db[_0x9d64('0x17')][_0x9d64('0x18')](_0x580322[_0x9d64('0x19')],{'raw':_0x580322[_0x9d64('0x1a')]?_0x580322['options'][_0x9d64('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22c584){logger[_0x9d64('0xc')](_0x9d64('0x16'),_0x580322);logger[_0x9d64('0x1c')](_0x9d64('0x16'),_0x580322,JSON[_0x9d64('0x10')](_0x22c584));_0xb4f042(_0x22c584);})[_0x9d64('0x15')](function(_0x8f196b){logger[_0x9d64('0x11')](_0x9d64('0x16'),_0x8f196b[_0x9d64('0x13')],_0x580322);_0x25b9d2(_0x397cb5[_0x9d64('0x11')](0x1f4,_0x8f196b[_0x9d64('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0beeaf6..f08d8fe 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x198a85,_0x31bf8b){var _0x4ca50d=function(_0x253422){while(--_0x253422){_0x198a85['push'](_0x198a85['shift']());}};_0x4ca50d(++_0x31bf8b);}(_0xe706,0xa3));var _0x6e70=function(_0x505f73,_0x1f95d8){_0x505f73=_0x505f73-0x0;var _0x227e7f=_0xe706[_0x505f73];return _0x227e7f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3e8d41,_0x2456cc){var _0x1e9f7f=function(_0x6b438f){while(--_0x6b438f){_0x3e8d41['push'](_0x3e8d41['shift']());}};_0x1e9f7f(++_0x2456cc);}(_0xe706,0xa3));var _0x6e70=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0xe706[_0x87239];return _0x53af1e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 1ef19ca..cbe8aeb 100644 --- a/server/api/squareReport/squareReport.attributes.js +++ b/server/api/squareReport/squareReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd890=['DATE','BOOLEAN','STRING'];(function(_0x515f78,_0x3b69be){var _0x506f6c=function(_0x14da41){while(--_0x14da41){_0x515f78['push'](_0x515f78['shift']());}};_0x506f6c(++_0x3b69be);}(_0xd890,0x1a3));var _0x0d89=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xd890[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x0d89('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0d89('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0d89('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0d89('0x0')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x0d89('0x0')]},'callingtns':{'type':Sequelize[_0x0d89('0x0')]},'dnid':{'type':Sequelize[_0x0d89('0x0')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0d89('0x0')]},'extension':{'type':Sequelize[_0x0d89('0x0')]},'priority':{'type':Sequelize[_0x0d89('0x0')]},'enhanced':{'type':Sequelize[_0x0d89('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x0d89('0x0')]},'project_name':{'type':Sequelize[_0x0d89('0x0')]},'joinAt':{'type':Sequelize[_0x0d89('0x1')]},'leaveAt':{'type':Sequelize[_0x0d89('0x1')]},'bot':{'type':Sequelize[_0x0d89('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb664=['DATE','STRING'];(function(_0x5a61c7,_0x18b761){var _0xd0360c=function(_0x30811a){while(--_0x30811a){_0x5a61c7['push'](_0x5a61c7['shift']());}};_0xd0360c(++_0x18b761);}(_0xb664,0x163));var _0x4b66=function(_0x5dd767,_0x1fb4b9){_0x5dd767=_0x5dd767-0x0;var _0x563870=_0xb664[_0x5dd767];return _0x563870;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x4b66('0x0')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4b66('0x0')]},'channel':{'type':Sequelize[_0x4b66('0x0')]},'language':{'type':Sequelize[_0x4b66('0x0')]},'type':{'type':Sequelize[_0x4b66('0x0')]},'uniqueid':{'type':Sequelize[_0x4b66('0x0')]},'version':{'type':Sequelize[_0x4b66('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x4b66('0x0')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4b66('0x0')]},'callingtns':{'type':Sequelize[_0x4b66('0x0')]},'dnid':{'type':Sequelize[_0x4b66('0x0')]},'rdnis':{'type':Sequelize[_0x4b66('0x0')]},'context':{'type':Sequelize[_0x4b66('0x0')]},'extension':{'type':Sequelize[_0x4b66('0x0')]},'priority':{'type':Sequelize[_0x4b66('0x0')]},'enhanced':{'type':Sequelize[_0x4b66('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x4b66('0x0')]},'joinAt':{'type':Sequelize[_0x4b66('0x1')]},'leaveAt':{'type':Sequelize[_0x4b66('0x1')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index aeadd44..807dd15 100644 --- a/server/api/squareReport/squareReport.controller.js +++ b/server/api/squareReport/squareReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x232f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x5d70cf,_0x41d400){var _0xd2e74b=function(_0x460af7){while(--_0x460af7){_0x5d70cf['push'](_0x5d70cf['shift']());}};_0xd2e74b(++_0x41d400);}(_0x232f,0xd3));var _0xf232=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x232f[_0x5c2c7c];return _0xea7ffe;};'use strict';var emlformat=require(_0xf232('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf232('0x1'));var jsonpatch=require(_0xf232('0x2'));var rp=require(_0xf232('0x3'));var moment=require(_0xf232('0x4'));var BPromise=require(_0xf232('0x5'));var Mustache=require(_0xf232('0x6'));var util=require(_0xf232('0x7'));var path=require(_0xf232('0x8'));var sox=require(_0xf232('0x9'));var csv=require('to-csv');var ejs=require(_0xf232('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf232('0xb'));var squel=require(_0xf232('0xc'));var crypto=require(_0xf232('0xd'));var jsforce=require(_0xf232('0xe'));var deskjs=require(_0xf232('0xf'));var toCsv=require(_0xf232('0x10'));var querystring=require(_0xf232('0x11'));var Papa=require(_0xf232('0x12'));var Redis=require('ioredis');var authService=require(_0xf232('0x13'));var qs=require(_0xf232('0x14'));var as=require(_0xf232('0x15'));var hardwareService=require(_0xf232('0x16'));var logger=require('../../config/logger')(_0xf232('0x17'));var utils=require(_0xf232('0x18'));var config=require(_0xf232('0x19'));var licenseUtil=require(_0xf232('0x1a'));var db=require(_0xf232('0x1b'))['db'];function respondWithStatusCode(_0x59dd2c,_0x1282d0){_0x1282d0=_0x1282d0||0xcc;return function(_0x4e25c6){if(_0x4e25c6){return _0x59dd2c[_0xf232('0x1c')](_0x1282d0);}return _0x59dd2c[_0xf232('0x1d')](_0x1282d0)['end']();};}function respondWithResult(_0x11cb8c,_0x3b4d8e){_0x3b4d8e=_0x3b4d8e||0xc8;return function(_0x53f4af){if(_0x53f4af){return _0x11cb8c[_0xf232('0x1d')](_0x3b4d8e)[_0xf232('0x1e')](_0x53f4af);}};}function respondWithFilteredResult(_0x37764d,_0x78d786){return function(_0x4534e3){if(_0x4534e3){var _0x1b8a3f=typeof _0x78d786['offset']==='undefined'&&typeof _0x78d786[_0xf232('0x1f')]===_0xf232('0x20');var _0x47368a=_0x4534e3[_0xf232('0x21')];var _0xe30a4b=_0x1b8a3f?0x0:_0x78d786['offset'];var _0x738e91=_0x1b8a3f?_0x4534e3[_0xf232('0x21')]:_0x78d786[_0xf232('0x22')]+_0x78d786[_0xf232('0x1f')];var _0x4bd5a2;if(_0x738e91>=_0x47368a){_0x738e91=_0x47368a;_0x4bd5a2=0xc8;}else{_0x4bd5a2=0xce;}_0x37764d[_0xf232('0x1d')](_0x4bd5a2);return _0x37764d[_0xf232('0x23')](_0xf232('0x24'),_0xe30a4b+'-'+_0x738e91+'/'+_0x47368a)[_0xf232('0x1e')](_0x4534e3);}return null;};}function patchUpdates(_0x5307fe){return function(_0x448aff){try{jsonpatch[_0xf232('0x25')](_0x448aff,_0x5307fe,!![]);}catch(_0x360ea4){return BPromise['reject'](_0x360ea4);}return _0x448aff['save']();};}function saveUpdates(_0xd98955,_0x4f5e0e){return function(_0xf31708){if(_0xf31708){return _0xf31708[_0xf232('0x26')](_0xd98955)[_0xf232('0x27')](function(_0x4578f2){return _0x4578f2;});}return null;};}function removeEntity(_0x257bd4,_0x3b3eac){return function(_0x503746){if(_0x503746){return _0x503746[_0xf232('0x28')]()[_0xf232('0x27')](function(){_0x257bd4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x274a84,_0x55c6dc){return function(_0x2de6ac){if(!_0x2de6ac){_0x274a84['sendStatus'](0x194);}return _0x2de6ac;};}function handleError(_0x1ec972,_0x26ac76){_0x26ac76=_0x26ac76||0x1f4;return function(_0x1e741b){logger[_0xf232('0x29')](_0x1e741b[_0xf232('0x2a')]);if(_0x1e741b[_0xf232('0x2b')]){delete _0x1e741b[_0xf232('0x2b')];}_0x1ec972[_0xf232('0x1d')](_0x26ac76)[_0xf232('0x2c')](_0x1e741b);};}exports[_0xf232('0x2d')]=function(_0xf04d5b,_0x27a891){var _0x573098={},_0x233316={},_0x3c8a6b={'count':0x0,'rows':[]};var _0x591b83=_['map'](db[_0xf232('0x2e')][_0xf232('0x2f')],function(_0xfbe500){return{'name':_0xfbe500[_0xf232('0x30')],'type':_0xfbe500['type'][_0xf232('0x31')]};});_0x233316['model']=_[_0xf232('0x32')](_0x591b83,_0xf232('0x2b'));_0x233316['query']=_[_0xf232('0x33')](_0xf04d5b[_0xf232('0x34')]);_0x233316['filters']=_[_0xf232('0x35')](_0x233316[_0xf232('0x36')],_0x233316[_0xf232('0x34')]);_0x573098[_0xf232('0x37')]=_[_0xf232('0x35')](_0x233316[_0xf232('0x36')],qs[_0xf232('0x38')](_0xf04d5b[_0xf232('0x34')][_0xf232('0x38')]));_0x573098[_0xf232('0x37')]=_0x573098[_0xf232('0x37')][_0xf232('0x39')]?_0x573098[_0xf232('0x37')]:_0x233316[_0xf232('0x36')];if(!_0xf04d5b[_0xf232('0x34')][_0xf232('0x3a')]('nolimit')){_0x573098[_0xf232('0x1f')]=qs[_0xf232('0x1f')](_0xf04d5b[_0xf232('0x34')]['limit']);_0x573098[_0xf232('0x22')]=qs[_0xf232('0x22')](_0xf04d5b[_0xf232('0x34')][_0xf232('0x22')]);}_0x573098[_0xf232('0x3b')]=qs['sort'](_0xf04d5b[_0xf232('0x34')]['sort']);_0x573098[_0xf232('0x3c')]=qs[_0xf232('0x3d')](_[_0xf232('0x3e')](_0xf04d5b[_0xf232('0x34')],_0x233316['filters']),_0x591b83);if(_0xf04d5b[_0xf232('0x34')][_0xf232('0x3f')]){_0x573098[_0xf232('0x3c')]=_[_0xf232('0x40')](_0x573098[_0xf232('0x3c')],{'$or':_[_0xf232('0x32')](_0x591b83,function(_0x2dae37){if(_0x2dae37[_0xf232('0x41')]!=='VIRTUAL'){var _0x5f01ac={};_0x5f01ac[_0x2dae37[_0xf232('0x2b')]]={'$like':'%'+_0xf04d5b[_0xf232('0x34')][_0xf232('0x3f')]+'%'};return _0x5f01ac;}})});}_0x573098=_[_0xf232('0x40')]({},_0x573098,_0xf04d5b[_0xf232('0x42')]);var _0xf3b5a3={'where':_0x573098['where']};return db['SquareReport'][_0xf232('0x21')](_0xf3b5a3)['then'](function(_0x24d791){_0x3c8a6b[_0xf232('0x21')]=_0x24d791;if(_0xf04d5b[_0xf232('0x34')][_0xf232('0x43')]){_0x573098[_0xf232('0x44')]=[{'all':!![]}];}return db[_0xf232('0x2e')][_0xf232('0x45')](_0x573098);})[_0xf232('0x27')](function(_0x18414c){_0x3c8a6b[_0xf232('0x46')]=_0x18414c;return _0x3c8a6b;})[_0xf232('0x27')](respondWithFilteredResult(_0x27a891,_0x573098))['catch'](handleError(_0x27a891,null));};exports['show']=function(_0x362655,_0x3e666f){var _0x66d8c2={'raw':!![],'where':{'id':_0x362655[_0xf232('0x47')]['id']}},_0x265787={};_0x265787[_0xf232('0x36')]=_['keys'](db[_0xf232('0x2e')]['rawAttributes']);_0x265787[_0xf232('0x34')]=_[_0xf232('0x33')](_0x362655[_0xf232('0x34')]);_0x265787[_0xf232('0x3d')]=_[_0xf232('0x35')](_0x265787[_0xf232('0x36')],_0x265787[_0xf232('0x34')]);_0x66d8c2['attributes']=_[_0xf232('0x35')](_0x265787[_0xf232('0x36')],qs[_0xf232('0x38')](_0x362655[_0xf232('0x34')][_0xf232('0x38')]));_0x66d8c2[_0xf232('0x37')]=_0x66d8c2['attributes']['length']?_0x66d8c2[_0xf232('0x37')]:_0x265787['model'];if(_0x362655[_0xf232('0x34')][_0xf232('0x43')]){_0x66d8c2['include']=[{'all':!![]}];}_0x66d8c2=_[_0xf232('0x40')]({},_0x66d8c2,_0x362655['options']);return db[_0xf232('0x2e')][_0xf232('0x48')](_0x66d8c2)[_0xf232('0x27')](handleEntityNotFound(_0x3e666f,null))[_0xf232('0x27')](respondWithResult(_0x3e666f,null))[_0xf232('0x49')](handleError(_0x3e666f,null));};exports[_0xf232('0x4a')]=function(_0x3f6bf,_0x328fb3){return db[_0xf232('0x2e')]['create'](_0x3f6bf['body'],{})['then'](respondWithResult(_0x328fb3,0xc9))['catch'](handleError(_0x328fb3,null));};exports[_0xf232('0x26')]=function(_0x1c94b2,_0x47458c){if(_0x1c94b2[_0xf232('0x4b')]['id']){delete _0x1c94b2['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x1c94b2[_0xf232('0x47')]['id']}})[_0xf232('0x27')](handleEntityNotFound(_0x47458c,null))['then'](saveUpdates(_0x1c94b2['body'],null))['then'](respondWithResult(_0x47458c,null))['catch'](handleError(_0x47458c,null));};exports[_0xf232('0x28')]=function(_0x498c0a,_0x4bc902){return db[_0xf232('0x2e')][_0xf232('0x48')]({'where':{'id':_0x498c0a[_0xf232('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bc902,null))[_0xf232('0x27')](removeEntity(_0x4bc902,null))[_0xf232('0x49')](handleError(_0x4bc902,null));};exports[_0xf232('0x4c')]=function(_0x2f84ab,_0x2b5244){return db[_0xf232('0x2e')][_0xf232('0x4c')]()[_0xf232('0x27')](respondWithResult(_0x2b5244,null))[_0xf232('0x49')](handleError(_0x2b5244,null));}; \ No newline at end of file +var _0x19b5=['stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','SquareReport','show','params','keys','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','end','error'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x19b5,0x19a));var _0x519b=function(_0x1b5804,_0x3c00bb){_0x1b5804=_0x1b5804-0x0;var _0x20f8e0=_0x19b5[_0x1b5804];return _0x20f8e0;};'use strict';var emlformat=require(_0x519b('0x0'));var rimraf=require(_0x519b('0x1'));var zipdir=require(_0x519b('0x2'));var jsonpatch=require(_0x519b('0x3'));var rp=require(_0x519b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x519b('0x5'));var util=require(_0x519b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x519b('0x7'));var ejs=require(_0x519b('0x8'));var fs=require('fs');var fs_extra=require(_0x519b('0x9'));var _=require(_0x519b('0xa'));var squel=require(_0x519b('0xb'));var crypto=require(_0x519b('0xc'));var jsforce=require(_0x519b('0xd'));var deskjs=require(_0x519b('0xe'));var toCsv=require(_0x519b('0x7'));var querystring=require(_0x519b('0xf'));var Papa=require('papaparse');var Redis=require(_0x519b('0x10'));var authService=require(_0x519b('0x11'));var qs=require(_0x519b('0x12'));var as=require(_0x519b('0x13'));var hardwareService=require(_0x519b('0x14'));var logger=require(_0x519b('0x15'))(_0x519b('0x16'));var utils=require('../../config/utils');var config=require(_0x519b('0x17'));var licenseUtil=require(_0x519b('0x18'));var db=require(_0x519b('0x19'))['db'];function respondWithStatusCode(_0x1fdf3e,_0x490b3a){_0x490b3a=_0x490b3a||0xcc;return function(_0x51adb7){if(_0x51adb7){return _0x1fdf3e[_0x519b('0x1a')](_0x490b3a);}return _0x1fdf3e[_0x519b('0x1b')](_0x490b3a)['end']();};}function respondWithResult(_0x4d80f5,_0x580e3c){_0x580e3c=_0x580e3c||0xc8;return function(_0x5897e6){if(_0x5897e6){return _0x4d80f5[_0x519b('0x1b')](_0x580e3c)[_0x519b('0x1c')](_0x5897e6);}};}function respondWithFilteredResult(_0x4298ad,_0x4512ab){return function(_0x5185bf){if(_0x5185bf){var _0x74a4d1=typeof _0x4512ab[_0x519b('0x1d')]===_0x519b('0x1e')&&typeof _0x4512ab['limit']===_0x519b('0x1e');var _0x492b5c=_0x5185bf[_0x519b('0x1f')];var _0x21a647=_0x74a4d1?0x0:_0x4512ab['offset'];var _0x31a7b6=_0x74a4d1?_0x5185bf['count']:_0x4512ab[_0x519b('0x1d')]+_0x4512ab[_0x519b('0x20')];var _0x32efc0;if(_0x31a7b6>=_0x492b5c){_0x31a7b6=_0x492b5c;_0x32efc0=0xc8;}else{_0x32efc0=0xce;}_0x4298ad[_0x519b('0x1b')](_0x32efc0);return _0x4298ad[_0x519b('0x21')](_0x519b('0x22'),_0x21a647+'-'+_0x31a7b6+'/'+_0x492b5c)['json'](_0x5185bf);}return null;};}function patchUpdates(_0x4cc895){return function(_0x3d50d0){try{jsonpatch['apply'](_0x3d50d0,_0x4cc895,!![]);}catch(_0x1e8a0f){return BPromise[_0x519b('0x23')](_0x1e8a0f);}return _0x3d50d0['save']();};}function saveUpdates(_0x12b744,_0x31fcad){return function(_0x1379e0){if(_0x1379e0){return _0x1379e0[_0x519b('0x24')](_0x12b744)[_0x519b('0x25')](function(_0x17eff7){return _0x17eff7;});}return null;};}function removeEntity(_0x4c5efd,_0x10dc26){return function(_0x536ab8){if(_0x536ab8){return _0x536ab8['destroy']()[_0x519b('0x25')](function(){_0x4c5efd['status'](0xcc)[_0x519b('0x26')]();});}};}function handleEntityNotFound(_0x2b0881,_0x3f5e39){return function(_0x284e84){if(!_0x284e84){_0x2b0881[_0x519b('0x1a')](0x194);}return _0x284e84;};}function handleError(_0x4f871f,_0x13ea41){_0x13ea41=_0x13ea41||0x1f4;return function(_0x25f7f8){logger[_0x519b('0x27')](_0x25f7f8[_0x519b('0x28')]);if(_0x25f7f8[_0x519b('0x29')]){delete _0x25f7f8[_0x519b('0x29')];}_0x4f871f[_0x519b('0x1b')](_0x13ea41)[_0x519b('0x2a')](_0x25f7f8);};}exports['index']=function(_0x152a82,_0xd8d0b9){var _0x2f8d36={},_0xda586c={},_0x2f6ac2={'count':0x0,'rows':[]};var _0x39ddbd=_['map'](db['SquareReport'][_0x519b('0x2b')],function(_0x18f0f8){return{'name':_0x18f0f8[_0x519b('0x2c')],'type':_0x18f0f8[_0x519b('0x2d')][_0x519b('0x2e')]};});_0xda586c[_0x519b('0x2f')]=_['map'](_0x39ddbd,_0x519b('0x29'));_0xda586c[_0x519b('0x30')]=_['keys'](_0x152a82[_0x519b('0x30')]);_0xda586c[_0x519b('0x31')]=_['intersection'](_0xda586c['model'],_0xda586c[_0x519b('0x30')]);_0x2f8d36[_0x519b('0x32')]=_[_0x519b('0x33')](_0xda586c[_0x519b('0x2f')],qs[_0x519b('0x34')](_0x152a82[_0x519b('0x30')]['fields']));_0x2f8d36[_0x519b('0x32')]=_0x2f8d36[_0x519b('0x32')][_0x519b('0x35')]?_0x2f8d36[_0x519b('0x32')]:_0xda586c[_0x519b('0x2f')];if(!_0x152a82['query'][_0x519b('0x36')](_0x519b('0x37'))){_0x2f8d36['limit']=qs[_0x519b('0x20')](_0x152a82[_0x519b('0x30')][_0x519b('0x20')]);_0x2f8d36[_0x519b('0x1d')]=qs['offset'](_0x152a82['query'][_0x519b('0x1d')]);}_0x2f8d36[_0x519b('0x38')]=qs[_0x519b('0x39')](_0x152a82['query'][_0x519b('0x39')]);_0x2f8d36[_0x519b('0x3a')]=qs[_0x519b('0x31')](_['pick'](_0x152a82[_0x519b('0x30')],_0xda586c[_0x519b('0x31')]),_0x39ddbd);if(_0x152a82[_0x519b('0x30')][_0x519b('0x3b')]){_0x2f8d36[_0x519b('0x3a')]=_['merge'](_0x2f8d36[_0x519b('0x3a')],{'$or':_[_0x519b('0x3c')](_0x39ddbd,function(_0x433bda){if(_0x433bda[_0x519b('0x2d')]!==_0x519b('0x3d')){var _0xa52dd4={};_0xa52dd4[_0x433bda[_0x519b('0x29')]]={'$like':'%'+_0x152a82['query'][_0x519b('0x3b')]+'%'};return _0xa52dd4;}})});}_0x2f8d36=_[_0x519b('0x3e')]({},_0x2f8d36,_0x152a82[_0x519b('0x3f')]);var _0x444ec8={'where':_0x2f8d36[_0x519b('0x3a')]};return db[_0x519b('0x40')][_0x519b('0x1f')](_0x444ec8)[_0x519b('0x25')](function(_0x2bf600){_0x2f6ac2[_0x519b('0x1f')]=_0x2bf600;if(_0x152a82[_0x519b('0x30')]['includeAll']){_0x2f8d36['include']=[{'all':!![]}];}return db[_0x519b('0x40')]['findAll'](_0x2f8d36);})['then'](function(_0x5889c5){_0x2f6ac2['rows']=_0x5889c5;return _0x2f6ac2;})['then'](respondWithFilteredResult(_0xd8d0b9,_0x2f8d36))['catch'](handleError(_0xd8d0b9,null));};exports[_0x519b('0x41')]=function(_0x3ff02f,_0x3de299){var _0x3ce3bc={'raw':!![],'where':{'id':_0x3ff02f[_0x519b('0x42')]['id']}},_0x132c59={};_0x132c59[_0x519b('0x2f')]=_[_0x519b('0x43')](db[_0x519b('0x40')][_0x519b('0x2b')]);_0x132c59[_0x519b('0x30')]=_[_0x519b('0x43')](_0x3ff02f[_0x519b('0x30')]);_0x132c59['filters']=_[_0x519b('0x33')](_0x132c59['model'],_0x132c59[_0x519b('0x30')]);_0x3ce3bc[_0x519b('0x32')]=_[_0x519b('0x33')](_0x132c59['model'],qs['fields'](_0x3ff02f[_0x519b('0x30')][_0x519b('0x34')]));_0x3ce3bc[_0x519b('0x32')]=_0x3ce3bc[_0x519b('0x32')][_0x519b('0x35')]?_0x3ce3bc[_0x519b('0x32')]:_0x132c59['model'];if(_0x3ff02f[_0x519b('0x30')][_0x519b('0x44')]){_0x3ce3bc[_0x519b('0x45')]=[{'all':!![]}];}_0x3ce3bc=_[_0x519b('0x3e')]({},_0x3ce3bc,_0x3ff02f[_0x519b('0x3f')]);return db['SquareReport'][_0x519b('0x46')](_0x3ce3bc)[_0x519b('0x25')](handleEntityNotFound(_0x3de299,null))[_0x519b('0x25')](respondWithResult(_0x3de299,null))[_0x519b('0x47')](handleError(_0x3de299,null));};exports['create']=function(_0x4ac7d0,_0x588753){return db[_0x519b('0x40')][_0x519b('0x48')](_0x4ac7d0[_0x519b('0x49')],{})[_0x519b('0x25')](respondWithResult(_0x588753,0xc9))[_0x519b('0x47')](handleError(_0x588753,null));};exports['update']=function(_0x577912,_0x497003){if(_0x577912['body']['id']){delete _0x577912[_0x519b('0x49')]['id'];}return db[_0x519b('0x40')][_0x519b('0x46')]({'where':{'id':_0x577912[_0x519b('0x42')]['id']}})[_0x519b('0x25')](handleEntityNotFound(_0x497003,null))[_0x519b('0x25')](saveUpdates(_0x577912[_0x519b('0x49')],null))[_0x519b('0x25')](respondWithResult(_0x497003,null))[_0x519b('0x47')](handleError(_0x497003,null));};exports['destroy']=function(_0x3cc0e4,_0xb0c052){return db[_0x519b('0x40')][_0x519b('0x46')]({'where':{'id':_0x3cc0e4[_0x519b('0x42')]['id']}})[_0x519b('0x25')](handleEntityNotFound(_0xb0c052,null))['then'](removeEntity(_0xb0c052,null))[_0x519b('0x47')](handleError(_0xb0c052,null));};exports['describe']=function(_0x5f39ae,_0x4495e3){return db[_0x519b('0x40')][_0x519b('0x4a')]()['then'](respondWithResult(_0x4495e3,null))[_0x519b('0x47')](handleError(_0x4495e3,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 42a5ca5..eb3bae4 100644 --- a/server/api/squareReport/squareReport.model.js +++ b/server/api/squareReport/squareReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5af2=['moment','bluebird','path','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','util','api'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5af2,0x6d));var _0x25af=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5af2[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x25af('0x0'));var util=require(_0x25af('0x1'));var logger=require('../../config/logger')(_0x25af('0x2'));var moment=require(_0x25af('0x3'));var BPromise=require(_0x25af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25af('0x5'));var rimraf=require('rimraf');var config=require(_0x25af('0x6'));var attributes=require(_0x25af('0x7'));module[_0x25af('0x8')]=function(_0xe2834d,_0x5ddfaf){return _0xe2834d['define'](_0x25af('0x9'),attributes,{'tableName':_0x25af('0xa'),'paranoid':![],'indexes':[{'name':_0x25af('0xb'),'fields':[_0x25af('0xc'),'project_name']},{'name':_0x25af('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2304=['rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','moment','request-promise','path'];(function(_0x152a21,_0x272135){var _0x4f91f6=function(_0x21b6af){while(--_0x21b6af){_0x152a21['push'](_0x152a21['shift']());}};_0x4f91f6(++_0x272135);}(_0x2304,0x93));var _0x4230=function(_0x3203fe,_0x15e644){_0x3203fe=_0x3203fe-0x0;var _0x4d7090=_0x2304[_0x3203fe];return _0x4d7090;};'use strict';var _=require(_0x4230('0x0'));var util=require(_0x4230('0x1'));var logger=require('../../config/logger')(_0x4230('0x2'));var moment=require(_0x4230('0x3'));var BPromise=require('bluebird');var rp=require(_0x4230('0x4'));var fs=require('fs');var path=require(_0x4230('0x5'));var rimraf=require(_0x4230('0x6'));var config=require(_0x4230('0x7'));var attributes=require(_0x4230('0x8'));module[_0x4230('0x9')]=function(_0x3c142b,_0x147884){return _0x3c142b[_0x4230('0xa')](_0x4230('0xb'),attributes,{'tableName':_0x4230('0xc'),'paranoid':![],'indexes':[{'name':_0x4230('0xd'),'fields':[_0x4230('0xe'),_0x4230('0xf')]},{'name':_0x4230('0x10'),'fields':[_0x4230('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 0bf5cde..f6308ad 100644 --- a/server/api/squareReport/squareReport.rpc.js +++ b/server/api/squareReport/squareReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x096d=['update','attributes','limit','UpdateSquareReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','body','options','CreateSquareReport','SquareReport'];(function(_0x25e6eb,_0x83d50b){var _0x43c611=function(_0x4ec157){while(--_0x4ec157){_0x25e6eb['push'](_0x25e6eb['shift']());}};_0x43c611(++_0x83d50b);}(_0x096d,0x9f));var _0xd096=function(_0x59547f,_0x1fe1da){_0x59547f=_0x59547f-0x0;var _0x2448d4=_0x096d[_0x59547f];return _0x2448d4;};'use strict';var _=require(_0xd096('0x0'));var util=require(_0xd096('0x1'));var moment=require('moment');var BPromise=require(_0xd096('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd096('0x3'));var db=require(_0xd096('0x4'))['db'];var utils=require(_0xd096('0x5'));var logger=require(_0xd096('0x6'))(_0xd096('0x7'));var config=require('../../config/environment');var jayson=require(_0xd096('0x8'));var client=jayson[_0xd096('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235c11,_0x3f49b5,_0x462c3d){return new BPromise(function(_0x17471f,_0x1aa2ea){return client[_0xd096('0xa')](_0x235c11,_0x462c3d)[_0xd096('0xb')](function(_0x6e2763){logger[_0xd096('0xc')]('SquareReport,\x20%s,\x20%s',_0x3f49b5,_0xd096('0xd'));logger[_0xd096('0xe')](_0xd096('0xf'),_0x3f49b5,_0xd096('0xd'),JSON[_0xd096('0x10')](_0x6e2763));if(_0x6e2763['error']){if(_0x6e2763[_0xd096('0x11')][_0xd096('0x12')]===0x1f4){logger[_0xd096('0x11')]('SquareReport,\x20%s,\x20%s',_0x3f49b5,_0x6e2763[_0xd096('0x11')][_0xd096('0x13')]);return _0x1aa2ea(_0x6e2763[_0xd096('0x11')][_0xd096('0x13')]);}logger[_0xd096('0x11')](_0xd096('0x14'),_0x3f49b5,_0x6e2763[_0xd096('0x11')]['message']);return _0x17471f(_0x6e2763[_0xd096('0x11')][_0xd096('0x13')]);}else{logger[_0xd096('0xc')]('SquareReport,\x20%s,\x20%s',_0x3f49b5,'request\x20sent');_0x17471f(_0x6e2763[_0xd096('0x15')][_0xd096('0x13')]);}})[_0xd096('0x16')](function(_0x1099b8){logger['error'](_0xd096('0x14'),_0x3f49b5,_0x1099b8);_0x1aa2ea(_0x1099b8);});});}exports['CreateSquareReport']=function(_0x599bb6){var _0xbf8214=this;return new Promise(function(_0x3e4741,_0x4a2dd9){return db['SquareReport']['create'](_0x599bb6[_0xd096('0x17')],{'raw':_0x599bb6[_0xd096('0x18')]?_0x599bb6[_0xd096('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd096('0xb')](function(_0x294ca5){logger['info'](_0xd096('0x19'),_0x599bb6);logger[_0xd096('0xe')]('CreateSquareReport',_0x599bb6,JSON[_0xd096('0x10')](_0x294ca5));_0x3e4741(_0x294ca5);})['catch'](function(_0x196c14){logger[_0xd096('0x11')](_0xd096('0x19'),_0x196c14[_0xd096('0x13')],_0x599bb6);_0x4a2dd9(_0xbf8214[_0xd096('0x11')](0x1f4,_0x196c14[_0xd096('0x13')]));});});};exports['UpdateSquareReport']=function(_0x1d91dd){var _0x1e0e94=this;return new Promise(function(_0x243e5e,_0x26eae5){return db[_0xd096('0x1a')][_0xd096('0x1b')](_0x1d91dd[_0xd096('0x17')],{'raw':_0x1d91dd[_0xd096('0x18')]?_0x1d91dd[_0xd096('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d91dd[_0xd096('0x18')]?_0x1d91dd[_0xd096('0x18')]['where']||null:null,'attributes':_0x1d91dd[_0xd096('0x18')]?_0x1d91dd['options'][_0xd096('0x1c')]||null:null,'limit':_0x1d91dd[_0xd096('0x18')]?_0x1d91dd[_0xd096('0x18')][_0xd096('0x1d')]||null:null})[_0xd096('0xb')](function(_0x57ffaa){logger[_0xd096('0xc')]('UpdateSquareReport',_0x1d91dd);logger[_0xd096('0xe')](_0xd096('0x1e'),_0x1d91dd,JSON[_0xd096('0x10')](_0x57ffaa));_0x243e5e(_0x57ffaa);})[_0xd096('0x16')](function(_0x43fb8c){logger['error']('UpdateSquareReport',_0x43fb8c[_0xd096('0x13')],_0x1d91dd);_0x26eae5(_0x1e0e94[_0xd096('0x11')](0x1f4,_0x43fb8c['message']));});});}; \ No newline at end of file +var _0x697e=['http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','debug','SquareReport','update','raw','where','attributes','UpdateSquareReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30be39,_0x7d4106){var _0x1d2a98=function(_0x1e2355){while(--_0x1e2355){_0x30be39['push'](_0x30be39['shift']());}};_0x1d2a98(++_0x7d4106);}(_0x697e,0x1d2));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe697('0x0'));var util=require(_0xe697('0x1'));var moment=require(_0xe697('0x2'));var BPromise=require('bluebird');var rs=require(_0xe697('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe697('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe697('0x5'))(_0xe697('0x6'));var config=require(_0xe697('0x7'));var jayson=require(_0xe697('0x8'));var client=jayson[_0xe697('0x9')][_0xe697('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x307d1a,_0x585f0f,_0x2c0dea){return new BPromise(function(_0x5e48f0,_0x5f33e0){return client[_0xe697('0xb')](_0x307d1a,_0x2c0dea)[_0xe697('0xc')](function(_0x452ff1){logger[_0xe697('0xd')]('SquareReport,\x20%s,\x20%s',_0x585f0f,_0xe697('0xe'));logger['debug'](_0xe697('0xf'),_0x585f0f,_0xe697('0xe'),JSON[_0xe697('0x10')](_0x452ff1));if(_0x452ff1[_0xe697('0x11')]){if(_0x452ff1['error'][_0xe697('0x12')]===0x1f4){logger[_0xe697('0x11')](_0xe697('0x13'),_0x585f0f,_0x452ff1['error'][_0xe697('0x14')]);return _0x5f33e0(_0x452ff1[_0xe697('0x11')]['message']);}logger['error'](_0xe697('0x13'),_0x585f0f,_0x452ff1[_0xe697('0x11')]['message']);return _0x5e48f0(_0x452ff1[_0xe697('0x11')][_0xe697('0x14')]);}else{logger[_0xe697('0xd')](_0xe697('0x13'),_0x585f0f,'request\x20sent');_0x5e48f0(_0x452ff1[_0xe697('0x15')][_0xe697('0x14')]);}})[_0xe697('0x16')](function(_0x54f589){logger['error'](_0xe697('0x13'),_0x585f0f,_0x54f589);_0x5f33e0(_0x54f589);});});}exports[_0xe697('0x17')]=function(_0x2a4ead){var _0x5518f7=this;return new Promise(function(_0x5697f6,_0x426330){return db['SquareReport'][_0xe697('0x18')](_0x2a4ead[_0xe697('0x19')],{'raw':_0x2a4ead[_0xe697('0x1a')]?_0x2a4ead[_0xe697('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe697('0xc')](function(_0x51f618){logger['info'](_0xe697('0x17'),_0x2a4ead);logger[_0xe697('0x1b')]('CreateSquareReport',_0x2a4ead,JSON['stringify'](_0x51f618));_0x5697f6(_0x51f618);})[_0xe697('0x16')](function(_0x53416b){logger[_0xe697('0x11')](_0xe697('0x17'),_0x53416b['message'],_0x2a4ead);_0x426330(_0x5518f7['error'](0x1f4,_0x53416b[_0xe697('0x14')]));});});};exports['UpdateSquareReport']=function(_0x2546cc){var _0x49e3e5=this;return new Promise(function(_0x4e5ac5,_0x40c066){return db[_0xe697('0x1c')][_0xe697('0x1d')](_0x2546cc['body'],{'raw':_0x2546cc[_0xe697('0x1a')]?_0x2546cc[_0xe697('0x1a')][_0xe697('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2546cc[_0xe697('0x1a')]?_0x2546cc[_0xe697('0x1a')][_0xe697('0x1f')]||null:null,'attributes':_0x2546cc[_0xe697('0x1a')]?_0x2546cc['options'][_0xe697('0x20')]||null:null,'limit':_0x2546cc['options']?_0x2546cc[_0xe697('0x1a')]['limit']||null:null})[_0xe697('0xc')](function(_0x52a7c7){logger[_0xe697('0xd')]('UpdateSquareReport',_0x2546cc);logger[_0xe697('0x1b')](_0xe697('0x21'),_0x2546cc,JSON['stringify'](_0x52a7c7));_0x4e5ac5(_0x52a7c7);})['catch'](function(_0x22f924){logger['error'](_0xe697('0x21'),_0x22f924['message'],_0x2546cc);_0x40c066(_0x49e3e5['error'](0x1f4,_0x22f924[_0xe697('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 3639582..cf076cd 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4477=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4dc2e7,_0x59a1d6){var _0x1ef1e0=function(_0x14e07f){while(--_0x14e07f){_0x4dc2e7['push'](_0x4dc2e7['shift']());}};_0x1ef1e0(++_0x59a1d6);}(_0x4477,0x18d));var _0x7447=function(_0x315e81,_0x1cd1fe){_0x315e81=_0x315e81-0x0;var _0xf48bd3=_0x4477[_0x315e81];return _0xf48bd3;};'use strict';var multer=require('multer');var util=require(_0x7447('0x0'));var path=require(_0x7447('0x1'));var timeout=require(_0x7447('0x2'));var express=require(_0x7447('0x3'));var router=express[_0x7447('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7447('0x5'));var interaction=require(_0x7447('0x6'));var config=require(_0x7447('0x7'));var controller=require(_0x7447('0x8'));router[_0x7447('0x9')]('/',auth[_0x7447('0xa')](),controller[_0x7447('0xb')]);router[_0x7447('0x9')](_0x7447('0xc'),auth[_0x7447('0xa')](),controller[_0x7447('0xd')]);router[_0x7447('0x9')](_0x7447('0xe'),auth[_0x7447('0xa')](),controller['show']);router[_0x7447('0xf')]('/',auth[_0x7447('0xa')](),controller[_0x7447('0x10')]);router['put'](_0x7447('0xe'),auth[_0x7447('0xa')](),controller['update']);router[_0x7447('0x11')]('/:id',auth[_0x7447('0xa')](),controller[_0x7447('0x12')]);module[_0x7447('0x13')]=router; \ No newline at end of file +var _0xf2ef=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3b4455,_0x3e4395){var _0x34dd09=function(_0x5006d3){while(--_0x5006d3){_0x3b4455['push'](_0x3b4455['shift']());}};_0x34dd09(++_0x3e4395);}(_0xf2ef,0x92));var _0xff2e=function(_0x14f8e8,_0x42b2ad){_0x14f8e8=_0x14f8e8-0x0;var _0x276d72=_0xf2ef[_0x14f8e8];return _0x276d72;};'use strict';var multer=require(_0xff2e('0x0'));var util=require('util');var path=require(_0xff2e('0x1'));var timeout=require(_0xff2e('0x2'));var express=require(_0xff2e('0x3'));var router=express[_0xff2e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xff2e('0x5'));var config=require(_0xff2e('0x6'));var controller=require(_0xff2e('0x7'));router[_0xff2e('0x8')]('/',auth[_0xff2e('0x9')](),controller[_0xff2e('0xa')]);router[_0xff2e('0x8')](_0xff2e('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xff2e('0xc'),auth[_0xff2e('0x9')](),controller[_0xff2e('0xd')]);router[_0xff2e('0xe')]('/',auth['isAuthenticated'](),controller[_0xff2e('0xf')]);router[_0xff2e('0x10')](_0xff2e('0xc'),auth[_0xff2e('0x9')](),controller[_0xff2e('0x11')]);router[_0xff2e('0x12')](_0xff2e('0xc'),auth[_0xff2e('0x9')](),controller[_0xff2e('0x13')]);module[_0xff2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 874ac4d..661744f 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ba0=['sequelize','exports','STRING','TEXT'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6ba0,0x15c));var _0x06ba=function(_0xa9b3cf,_0x1390b7){_0xa9b3cf=_0xa9b3cf-0x0;var _0x5521eb=_0x6ba0[_0xa9b3cf];return _0x5521eb;};'use strict';var Sequelize=require(_0x06ba('0x0'));module[_0x06ba('0x1')]={'uniqueid':{'type':Sequelize[_0x06ba('0x2')]},'node':{'type':Sequelize[_0x06ba('0x2')]},'application':{'type':Sequelize[_0x06ba('0x2')]},'data':{'type':Sequelize[_0x06ba('0x3')]},'project_name':{'type':Sequelize[_0x06ba('0x2')]},'callerid':{'type':Sequelize[_0x06ba('0x2')]}}; \ No newline at end of file +var _0xb183=['STRING','exports'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xb183,0x97));var _0x3b18=function(_0x14bece,_0x10c9c1){_0x14bece=_0x14bece-0x0;var _0x387377=_0xb183[_0x14bece];return _0x387377;};'use strict';var Sequelize=require('sequelize');module[_0x3b18('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3b18('0x1')]},'callerid':{'type':Sequelize[_0x3b18('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a7e4a1b..9147010 100644 --- a/server/api/squareReportDetail/squareReportDetail.controller.js +++ b/server/api/squareReportDetail/squareReportDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f9=['where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','rawAttributes','length','create','body','params','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','map','SquareDetailsReport','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0x54f9,0x1f1));var _0x954f=function(_0xd5c390,_0x26d0a3){_0xd5c390=_0xd5c390-0x0;var _0x28029e=_0x54f9[_0xd5c390];return _0x28029e;};'use strict';var emlformat=require(_0x954f('0x0'));var rimraf=require(_0x954f('0x1'));var zipdir=require(_0x954f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x954f('0x3'));var moment=require(_0x954f('0x4'));var BPromise=require(_0x954f('0x5'));var Mustache=require(_0x954f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x954f('0x7'));var ejs=require(_0x954f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x954f('0x9'));var squel=require('squel');var crypto=require(_0x954f('0xa'));var jsforce=require(_0x954f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x954f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x954f('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x954f('0xd'));var as=require(_0x954f('0xe'));var hardwareService=require(_0x954f('0xf'));var logger=require(_0x954f('0x10'))(_0x954f('0x11'));var utils=require(_0x954f('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x954f('0x13'))['db'];function respondWithStatusCode(_0x597c96,_0x5c0cec){_0x5c0cec=_0x5c0cec||0xcc;return function(_0x564f0e){if(_0x564f0e){return _0x597c96[_0x954f('0x14')](_0x5c0cec);}return _0x597c96[_0x954f('0x15')](_0x5c0cec)['end']();};}function respondWithResult(_0x591ac4,_0x500ecf){_0x500ecf=_0x500ecf||0xc8;return function(_0x47159d){if(_0x47159d){return _0x591ac4['status'](_0x500ecf)[_0x954f('0x16')](_0x47159d);}};}function respondWithFilteredResult(_0x5a2d2a,_0x4f163f){return function(_0x225102){if(_0x225102){var _0xc147e1=typeof _0x4f163f[_0x954f('0x17')]==='undefined'&&typeof _0x4f163f[_0x954f('0x18')]==='undefined';var _0x3501b1=_0x225102['count'];var _0x4737c3=_0xc147e1?0x0:_0x4f163f[_0x954f('0x17')];var _0x24a859=_0xc147e1?_0x225102['count']:_0x4f163f[_0x954f('0x17')]+_0x4f163f[_0x954f('0x18')];var _0x2cb67f;if(_0x24a859>=_0x3501b1){_0x24a859=_0x3501b1;_0x2cb67f=0xc8;}else{_0x2cb67f=0xce;}_0x5a2d2a[_0x954f('0x15')](_0x2cb67f);return _0x5a2d2a['set'](_0x954f('0x19'),_0x4737c3+'-'+_0x24a859+'/'+_0x3501b1)['json'](_0x225102);}return null;};}function patchUpdates(_0x2cc7ed){return function(_0x461657){try{jsonpatch['apply'](_0x461657,_0x2cc7ed,!![]);}catch(_0x1b354e){return BPromise[_0x954f('0x1a')](_0x1b354e);}return _0x461657[_0x954f('0x1b')]();};}function saveUpdates(_0xb69239,_0x393e53){return function(_0x20831a){if(_0x20831a){return _0x20831a[_0x954f('0x1c')](_0xb69239)[_0x954f('0x1d')](function(_0x4eea4a){return _0x4eea4a;});}return null;};}function removeEntity(_0x109ee0,_0x5a988e){return function(_0x4fa276){if(_0x4fa276){return _0x4fa276[_0x954f('0x1e')]()[_0x954f('0x1d')](function(){_0x109ee0[_0x954f('0x15')](0xcc)[_0x954f('0x1f')]();});}};}function handleEntityNotFound(_0x6ac8e5,_0xe3fbc){return function(_0x1ec07b){if(!_0x1ec07b){_0x6ac8e5[_0x954f('0x14')](0x194);}return _0x1ec07b;};}function handleError(_0x210b5d,_0x37c33c){_0x37c33c=_0x37c33c||0x1f4;return function(_0x356d92){logger[_0x954f('0x20')](_0x356d92[_0x954f('0x21')]);if(_0x356d92[_0x954f('0x22')]){delete _0x356d92[_0x954f('0x22')];}_0x210b5d[_0x954f('0x15')](_0x37c33c)['send'](_0x356d92);};}exports['index']=function(_0x118a73,_0x37c698){var _0x33d88d={},_0xeb0af8={},_0x559b76={'count':0x0,'rows':[]};var _0xc5b85=_[_0x954f('0x23')](db[_0x954f('0x24')]['rawAttributes'],function(_0x45d986){return{'name':_0x45d986['fieldName'],'type':_0x45d986['type'][_0x954f('0x25')]};});_0xeb0af8[_0x954f('0x26')]=_['map'](_0xc5b85,_0x954f('0x22'));_0xeb0af8[_0x954f('0x27')]=_[_0x954f('0x28')](_0x118a73[_0x954f('0x27')]);_0xeb0af8['filters']=_['intersection'](_0xeb0af8[_0x954f('0x26')],_0xeb0af8[_0x954f('0x27')]);_0x33d88d[_0x954f('0x29')]=_[_0x954f('0x2a')](_0xeb0af8[_0x954f('0x26')],qs[_0x954f('0x2b')](_0x118a73[_0x954f('0x27')]['fields']));_0x33d88d[_0x954f('0x29')]=_0x33d88d[_0x954f('0x29')]['length']?_0x33d88d[_0x954f('0x29')]:_0xeb0af8['model'];if(!_0x118a73['query'][_0x954f('0x2c')](_0x954f('0x2d'))){_0x33d88d[_0x954f('0x18')]=qs[_0x954f('0x18')](_0x118a73[_0x954f('0x27')][_0x954f('0x18')]);_0x33d88d[_0x954f('0x17')]=qs[_0x954f('0x17')](_0x118a73[_0x954f('0x27')][_0x954f('0x17')]);}_0x33d88d['order']=qs[_0x954f('0x2e')](_0x118a73[_0x954f('0x27')]['sort']);_0x33d88d[_0x954f('0x2f')]=qs[_0x954f('0x30')](_[_0x954f('0x31')](_0x118a73[_0x954f('0x27')],_0xeb0af8['filters']),_0xc5b85);if(_0x118a73[_0x954f('0x27')][_0x954f('0x32')]){_0x33d88d[_0x954f('0x2f')]=_[_0x954f('0x33')](_0x33d88d[_0x954f('0x2f')],{'$or':_[_0x954f('0x23')](_0xc5b85,function(_0xfc0ef5){if(_0xfc0ef5[_0x954f('0x34')]!==_0x954f('0x35')){var _0x24dd90={};_0x24dd90[_0xfc0ef5['name']]={'$like':'%'+_0x118a73[_0x954f('0x27')][_0x954f('0x32')]+'%'};return _0x24dd90;}})});}_0x33d88d=_[_0x954f('0x33')]({},_0x33d88d,_0x118a73[_0x954f('0x36')]);var _0x50c16d={'where':_0x33d88d['where']};return db['SquareDetailsReport'][_0x954f('0x37')](_0x50c16d)[_0x954f('0x1d')](function(_0x229f08){_0x559b76[_0x954f('0x37')]=_0x229f08;if(_0x118a73[_0x954f('0x27')][_0x954f('0x38')]){_0x33d88d[_0x954f('0x39')]=[{'all':!![]}];}return db[_0x954f('0x24')][_0x954f('0x3a')](_0x33d88d);})[_0x954f('0x1d')](function(_0x4900f9){_0x559b76['rows']=_0x4900f9;return _0x559b76;})[_0x954f('0x1d')](respondWithFilteredResult(_0x37c698,_0x33d88d))[_0x954f('0x3b')](handleError(_0x37c698,null));};exports[_0x954f('0x3c')]=function(_0x37d9f9,_0x3accbc){var _0x19d2f0={'raw':!![],'where':{'id':_0x37d9f9['params']['id']}},_0x2ca9d7={};_0x2ca9d7[_0x954f('0x26')]=_[_0x954f('0x28')](db[_0x954f('0x24')][_0x954f('0x3d')]);_0x2ca9d7[_0x954f('0x27')]=_[_0x954f('0x28')](_0x37d9f9[_0x954f('0x27')]);_0x2ca9d7[_0x954f('0x30')]=_[_0x954f('0x2a')](_0x2ca9d7[_0x954f('0x26')],_0x2ca9d7[_0x954f('0x27')]);_0x19d2f0['attributes']=_[_0x954f('0x2a')](_0x2ca9d7['model'],qs['fields'](_0x37d9f9['query'][_0x954f('0x2b')]));_0x19d2f0[_0x954f('0x29')]=_0x19d2f0[_0x954f('0x29')][_0x954f('0x3e')]?_0x19d2f0[_0x954f('0x29')]:_0x2ca9d7[_0x954f('0x26')];if(_0x37d9f9[_0x954f('0x27')][_0x954f('0x38')]){_0x19d2f0[_0x954f('0x39')]=[{'all':!![]}];}_0x19d2f0=_[_0x954f('0x33')]({},_0x19d2f0,_0x37d9f9[_0x954f('0x36')]);return db['SquareDetailsReport']['find'](_0x19d2f0)[_0x954f('0x1d')](handleEntityNotFound(_0x3accbc,null))[_0x954f('0x1d')](respondWithResult(_0x3accbc,null))['catch'](handleError(_0x3accbc,null));};exports[_0x954f('0x3f')]=function(_0x2f9eea,_0x1c7b43){return db[_0x954f('0x24')][_0x954f('0x3f')](_0x2f9eea[_0x954f('0x40')],{})[_0x954f('0x1d')](respondWithResult(_0x1c7b43,0xc9))[_0x954f('0x3b')](handleError(_0x1c7b43,null));};exports['update']=function(_0x3ef577,_0x27c128){if(_0x3ef577[_0x954f('0x40')]['id']){delete _0x3ef577[_0x954f('0x40')]['id'];}return db[_0x954f('0x24')]['find']({'where':{'id':_0x3ef577[_0x954f('0x41')]['id']}})[_0x954f('0x1d')](handleEntityNotFound(_0x27c128,null))['then'](saveUpdates(_0x3ef577['body'],null))[_0x954f('0x1d')](respondWithResult(_0x27c128,null))[_0x954f('0x3b')](handleError(_0x27c128,null));};exports[_0x954f('0x1e')]=function(_0x41cfcf,_0x20c975){return db['SquareDetailsReport'][_0x954f('0x42')]({'where':{'id':_0x41cfcf[_0x954f('0x41')]['id']}})['then'](handleEntityNotFound(_0x20c975,null))[_0x954f('0x1d')](removeEntity(_0x20c975,null))[_0x954f('0x3b')](handleError(_0x20c975,null));};exports[_0x954f('0x43')]=function(_0x29bc0a,_0x5bd967){return db[_0x954f('0x24')][_0x954f('0x43')]()[_0x954f('0x1d')](respondWithResult(_0x5bd967,null))[_0x954f('0x3b')](handleError(_0x5bd967,null));}; \ No newline at end of file +var _0xdfff=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','save','update','destroy','then','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filter','merge','type','includeAll','include','catch','show','params','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x5739d9,_0x38c622){var _0x3692cb=function(_0x335cf1){while(--_0x335cf1){_0x5739d9['push'](_0x5739d9['shift']());}};_0x3692cb(++_0x38c622);}(_0xdfff,0x115));var _0xfdff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfdff('0x0'));var rimraf=require(_0xfdff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdff('0x2'));var rp=require(_0xfdff('0x3'));var moment=require('moment');var BPromise=require(_0xfdff('0x4'));var Mustache=require(_0xfdff('0x5'));var util=require(_0xfdff('0x6'));var path=require(_0xfdff('0x7'));var sox=require('sox');var csv=require(_0xfdff('0x8'));var ejs=require(_0xfdff('0x9'));var fs=require('fs');var fs_extra=require(_0xfdff('0xa'));var _=require('lodash');var squel=require(_0xfdff('0xb'));var crypto=require(_0xfdff('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfdff('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfdff('0xe'));var Papa=require(_0xfdff('0xf'));var Redis=require(_0xfdff('0x10'));var authService=require(_0xfdff('0x11'));var qs=require(_0xfdff('0x12'));var as=require(_0xfdff('0x13'));var hardwareService=require(_0xfdff('0x14'));var logger=require(_0xfdff('0x15'))(_0xfdff('0x16'));var utils=require('../../config/utils');var config=require(_0xfdff('0x17'));var licenseUtil=require(_0xfdff('0x18'));var db=require(_0xfdff('0x19'))['db'];function respondWithStatusCode(_0x314098,_0x111ab8){_0x111ab8=_0x111ab8||0xcc;return function(_0x56bf0d){if(_0x56bf0d){return _0x314098[_0xfdff('0x1a')](_0x111ab8);}return _0x314098[_0xfdff('0x1b')](_0x111ab8)[_0xfdff('0x1c')]();};}function respondWithResult(_0x1e1b60,_0x50579d){_0x50579d=_0x50579d||0xc8;return function(_0x340bd8){if(_0x340bd8){return _0x1e1b60[_0xfdff('0x1b')](_0x50579d)[_0xfdff('0x1d')](_0x340bd8);}};}function respondWithFilteredResult(_0x29dd7a,_0x1e822e){return function(_0x210f86){if(_0x210f86){var _0x227ace=typeof _0x1e822e['offset']===_0xfdff('0x1e')&&typeof _0x1e822e['limit']===_0xfdff('0x1e');var _0x38df8e=_0x210f86[_0xfdff('0x1f')];var _0x23934a=_0x227ace?0x0:_0x1e822e['offset'];var _0x53fdeb=_0x227ace?_0x210f86[_0xfdff('0x1f')]:_0x1e822e[_0xfdff('0x20')]+_0x1e822e['limit'];var _0x3efc7f;if(_0x53fdeb>=_0x38df8e){_0x53fdeb=_0x38df8e;_0x3efc7f=0xc8;}else{_0x3efc7f=0xce;}_0x29dd7a[_0xfdff('0x1b')](_0x3efc7f);return _0x29dd7a['set'](_0xfdff('0x21'),_0x23934a+'-'+_0x53fdeb+'/'+_0x38df8e)[_0xfdff('0x1d')](_0x210f86);}return null;};}function patchUpdates(_0x47ceee){return function(_0x33f4e4){try{jsonpatch['apply'](_0x33f4e4,_0x47ceee,!![]);}catch(_0x5bb9ae){return BPromise['reject'](_0x5bb9ae);}return _0x33f4e4[_0xfdff('0x22')]();};}function saveUpdates(_0x1ad187,_0x1e2074){return function(_0x31db45){if(_0x31db45){return _0x31db45[_0xfdff('0x23')](_0x1ad187)['then'](function(_0x53152f){return _0x53152f;});}return null;};}function removeEntity(_0x512039,_0x3c7562){return function(_0x3e750c){if(_0x3e750c){return _0x3e750c[_0xfdff('0x24')]()[_0xfdff('0x25')](function(){_0x512039[_0xfdff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc8a93d,_0x49f4cc){return function(_0x53694e){if(!_0x53694e){_0xc8a93d[_0xfdff('0x1a')](0x194);}return _0x53694e;};}function handleError(_0x1a98b1,_0x30b4cf){_0x30b4cf=_0x30b4cf||0x1f4;return function(_0x2e032f){logger['error'](_0x2e032f[_0xfdff('0x26')]);if(_0x2e032f[_0xfdff('0x27')]){delete _0x2e032f[_0xfdff('0x27')];}_0x1a98b1[_0xfdff('0x1b')](_0x30b4cf)['send'](_0x2e032f);};}exports[_0xfdff('0x28')]=function(_0x3c7b6f,_0x3af431){var _0x4f9bcc={},_0x2a5fc9={},_0x4d450b={'count':0x0,'rows':[]};var _0xdf2c4d=_[_0xfdff('0x29')](db[_0xfdff('0x2a')][_0xfdff('0x2b')],function(_0x59303e){return{'name':_0x59303e[_0xfdff('0x2c')],'type':_0x59303e['type'][_0xfdff('0x2d')]};});_0x2a5fc9[_0xfdff('0x2e')]=_[_0xfdff('0x29')](_0xdf2c4d,_0xfdff('0x27'));_0x2a5fc9[_0xfdff('0x2f')]=_[_0xfdff('0x30')](_0x3c7b6f[_0xfdff('0x2f')]);_0x2a5fc9[_0xfdff('0x31')]=_['intersection'](_0x2a5fc9[_0xfdff('0x2e')],_0x2a5fc9[_0xfdff('0x2f')]);_0x4f9bcc[_0xfdff('0x32')]=_[_0xfdff('0x33')](_0x2a5fc9[_0xfdff('0x2e')],qs[_0xfdff('0x34')](_0x3c7b6f['query'][_0xfdff('0x34')]));_0x4f9bcc[_0xfdff('0x32')]=_0x4f9bcc[_0xfdff('0x32')][_0xfdff('0x35')]?_0x4f9bcc[_0xfdff('0x32')]:_0x2a5fc9[_0xfdff('0x2e')];if(!_0x3c7b6f[_0xfdff('0x2f')]['hasOwnProperty'](_0xfdff('0x36'))){_0x4f9bcc[_0xfdff('0x37')]=qs[_0xfdff('0x37')](_0x3c7b6f[_0xfdff('0x2f')][_0xfdff('0x37')]);_0x4f9bcc[_0xfdff('0x20')]=qs[_0xfdff('0x20')](_0x3c7b6f['query'][_0xfdff('0x20')]);}_0x4f9bcc[_0xfdff('0x38')]=qs[_0xfdff('0x39')](_0x3c7b6f['query'][_0xfdff('0x39')]);_0x4f9bcc[_0xfdff('0x3a')]=qs[_0xfdff('0x31')](_['pick'](_0x3c7b6f['query'],_0x2a5fc9[_0xfdff('0x31')]),_0xdf2c4d);if(_0x3c7b6f['query'][_0xfdff('0x3b')]){_0x4f9bcc[_0xfdff('0x3a')]=_[_0xfdff('0x3c')](_0x4f9bcc[_0xfdff('0x3a')],{'$or':_[_0xfdff('0x29')](_0xdf2c4d,function(_0xa2c011){if(_0xa2c011[_0xfdff('0x3d')]!=='VIRTUAL'){var _0x331a9f={};_0x331a9f[_0xa2c011[_0xfdff('0x27')]]={'$like':'%'+_0x3c7b6f[_0xfdff('0x2f')]['filter']+'%'};return _0x331a9f;}})});}_0x4f9bcc=_[_0xfdff('0x3c')]({},_0x4f9bcc,_0x3c7b6f['options']);var _0x2c35de={'where':_0x4f9bcc[_0xfdff('0x3a')]};return db[_0xfdff('0x2a')][_0xfdff('0x1f')](_0x2c35de)['then'](function(_0x4b4c56){_0x4d450b[_0xfdff('0x1f')]=_0x4b4c56;if(_0x3c7b6f[_0xfdff('0x2f')][_0xfdff('0x3e')]){_0x4f9bcc[_0xfdff('0x3f')]=[{'all':!![]}];}return db[_0xfdff('0x2a')]['findAll'](_0x4f9bcc);})[_0xfdff('0x25')](function(_0x3a1e0c){_0x4d450b['rows']=_0x3a1e0c;return _0x4d450b;})['then'](respondWithFilteredResult(_0x3af431,_0x4f9bcc))[_0xfdff('0x40')](handleError(_0x3af431,null));};exports[_0xfdff('0x41')]=function(_0x51e069,_0x5ef623){var _0x11a419={'raw':!![],'where':{'id':_0x51e069[_0xfdff('0x42')]['id']}},_0x250dc0={};_0x250dc0[_0xfdff('0x2e')]=_[_0xfdff('0x30')](db['SquareDetailsReport'][_0xfdff('0x2b')]);_0x250dc0['query']=_[_0xfdff('0x30')](_0x51e069[_0xfdff('0x2f')]);_0x250dc0[_0xfdff('0x31')]=_['intersection'](_0x250dc0['model'],_0x250dc0['query']);_0x11a419[_0xfdff('0x32')]=_[_0xfdff('0x33')](_0x250dc0['model'],qs[_0xfdff('0x34')](_0x51e069['query'][_0xfdff('0x34')]));_0x11a419[_0xfdff('0x32')]=_0x11a419[_0xfdff('0x32')]['length']?_0x11a419[_0xfdff('0x32')]:_0x250dc0[_0xfdff('0x2e')];if(_0x51e069[_0xfdff('0x2f')][_0xfdff('0x3e')]){_0x11a419[_0xfdff('0x3f')]=[{'all':!![]}];}_0x11a419=_[_0xfdff('0x3c')]({},_0x11a419,_0x51e069[_0xfdff('0x43')]);return db[_0xfdff('0x2a')]['find'](_0x11a419)[_0xfdff('0x25')](handleEntityNotFound(_0x5ef623,null))[_0xfdff('0x25')](respondWithResult(_0x5ef623,null))[_0xfdff('0x40')](handleError(_0x5ef623,null));};exports[_0xfdff('0x44')]=function(_0xd341e0,_0x2e9245){return db['SquareDetailsReport'][_0xfdff('0x44')](_0xd341e0[_0xfdff('0x45')],{})[_0xfdff('0x25')](respondWithResult(_0x2e9245,0xc9))['catch'](handleError(_0x2e9245,null));};exports[_0xfdff('0x23')]=function(_0x25ab9d,_0x2c30ff){if(_0x25ab9d[_0xfdff('0x45')]['id']){delete _0x25ab9d[_0xfdff('0x45')]['id'];}return db[_0xfdff('0x2a')]['find']({'where':{'id':_0x25ab9d['params']['id']}})['then'](handleEntityNotFound(_0x2c30ff,null))[_0xfdff('0x25')](saveUpdates(_0x25ab9d[_0xfdff('0x45')],null))['then'](respondWithResult(_0x2c30ff,null))[_0xfdff('0x40')](handleError(_0x2c30ff,null));};exports['destroy']=function(_0x55b1ef,_0xceb40f){return db['SquareDetailsReport'][_0xfdff('0x46')]({'where':{'id':_0x55b1ef[_0xfdff('0x42')]['id']}})[_0xfdff('0x25')](handleEntityNotFound(_0xceb40f,null))[_0xfdff('0x25')](removeEntity(_0xceb40f,null))[_0xfdff('0x40')](handleError(_0xceb40f,null));};exports[_0xfdff('0x47')]=function(_0x5bb754,_0x11f700){return db[_0xfdff('0x2a')]['describe']()['then'](respondWithResult(_0x11f700,null))['catch'](handleError(_0x11f700,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 17af7f0..d471acc 100644 --- a/server/api/squareReportDetail/squareReportDetail.model.js +++ b/server/api/squareReportDetail/squareReportDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5877=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5877,0x74));var _0x7587=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5877[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x7587('0x0'));var logger=require(_0x7587('0x1'))(_0x7587('0x2'));var moment=require(_0x7587('0x3'));var BPromise=require(_0x7587('0x4'));var rp=require(_0x7587('0x5'));var fs=require('fs');var path=require(_0x7587('0x6'));var rimraf=require(_0x7587('0x7'));var config=require(_0x7587('0x8'));var attributes=require(_0x7587('0x9'));module[_0x7587('0xa')]=function(_0x5a2805,_0x28f158){return _0x5a2805['define'](_0x7587('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43a8=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x26b4cb,_0x1da7c0){var _0x37acfd=function(_0x4be5b2){while(--_0x4be5b2){_0x26b4cb['push'](_0x26b4cb['shift']());}};_0x37acfd(++_0x1da7c0);}(_0x43a8,0x6d));var _0x843a=function(_0x40a734,_0x48b1a8){_0x40a734=_0x40a734-0x0;var _0x3ce8de=_0x43a8[_0x40a734];return _0x3ce8de;};'use strict';var _=require(_0x843a('0x0'));var util=require(_0x843a('0x1'));var logger=require('../../config/logger')(_0x843a('0x2'));var moment=require(_0x843a('0x3'));var BPromise=require(_0x843a('0x4'));var rp=require(_0x843a('0x5'));var fs=require('fs');var path=require(_0x843a('0x6'));var rimraf=require('rimraf');var config=require(_0x843a('0x7'));var attributes=require(_0x843a('0x8'));module[_0x843a('0x9')]=function(_0x750af9,_0x17a28a){return _0x750af9[_0x843a('0xa')](_0x843a('0xb'),attributes,{'tableName':_0x843a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 9076e5d..6f1e779 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23a3=['jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','raw','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4bfd9e,_0x2713ad){var _0x291120=function(_0x544f4e){while(--_0x544f4e){_0x4bfd9e['push'](_0x4bfd9e['shift']());}};_0x291120(++_0x2713ad);}(_0x23a3,0x131));var _0x323a=function(_0x1cbc8a,_0x456d41){_0x1cbc8a=_0x1cbc8a-0x0;var _0x36617a=_0x23a3[_0x1cbc8a];return _0x36617a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});}exports[_0x323a('0x17')]=function(_0x221ae4){var _0x2feed1=this;return new Promise(function(_0x29dd21,_0x303338){return db[_0x323a('0x18')]['create'](_0x221ae4['body'],{'raw':_0x221ae4['options']?_0x221ae4['options'][_0x323a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xc0f3e4){logger[_0x323a('0xc')](_0x323a('0x17'),_0x221ae4);logger[_0x323a('0xf')]('CreateSquareDetailsReport',_0x221ae4,JSON[_0x323a('0x11')](_0xc0f3e4));_0x29dd21(_0xc0f3e4);})['catch'](function(_0x12c8d7){logger[_0x323a('0x12')](_0x323a('0x17'),_0x12c8d7['message'],_0x221ae4);_0x303338(_0x2feed1[_0x323a('0x12')](0x1f4,_0x12c8d7[_0x323a('0x14')]));});});}; \ No newline at end of file +var _0x8caf=['../../config/environment','jayson/promise','client','http','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xa0824c,_0x206536){var _0x474b26=function(_0xeca16){while(--_0xeca16){_0xa0824c['push'](_0xa0824c['shift']());}};_0x474b26(++_0x206536);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x445fbc,_0x1a17f9){_0x445fbc=_0x445fbc-0x0;var _0x5762a9=_0x8caf[_0x445fbc];return _0x5762a9;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var moment=require(_0xf8ca('0x1'));var BPromise=require(_0xf8ca('0x2'));var rs=require(_0xf8ca('0x3'));var fs=require('fs');var Redis=require(_0xf8ca('0x4'));var db=require(_0xf8ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8ca('0x6'))(_0xf8ca('0x7'));var config=require(_0xf8ca('0x8'));var jayson=require(_0xf8ca('0x9'));var client=jayson[_0xf8ca('0xa')][_0xf8ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562eea,_0x773b9f,_0x3abd58){return new BPromise(function(_0x3a91d3,_0x31300c){return client['request'](_0x562eea,_0x3abd58)['then'](function(_0x3a9674){logger['info'](_0xf8ca('0xc'),_0x773b9f,_0xf8ca('0xd'));logger[_0xf8ca('0xe')](_0xf8ca('0xf'),_0x773b9f,'request\x20sent',JSON[_0xf8ca('0x10')](_0x3a9674));if(_0x3a9674[_0xf8ca('0x11')]){if(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x12')]===0x1f4){logger['error'](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')]['message']);return _0x31300c(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);return _0x3a91d3(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}else{logger[_0xf8ca('0x14')](_0xf8ca('0xc'),_0x773b9f,'request\x20sent');_0x3a91d3(_0x3a9674[_0xf8ca('0x15')][_0xf8ca('0x13')]);}})[_0xf8ca('0x16')](function(_0x12e8f0){logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x12e8f0);_0x31300c(_0x12e8f0);});});}exports[_0xf8ca('0x17')]=function(_0x127119){var _0x50e805=this;return new Promise(function(_0x237f44,_0x3b5400){return db[_0xf8ca('0x18')][_0xf8ca('0x19')](_0x127119['body'],{'raw':_0x127119[_0xf8ca('0x1a')]?_0x127119[_0xf8ca('0x1a')][_0xf8ca('0x1b')]===undefined?!![]:![]:!![]})[_0xf8ca('0x1c')](function(_0x18e8da){logger[_0xf8ca('0x14')]('CreateSquareDetailsReport',_0x127119);logger[_0xf8ca('0xe')]('CreateSquareDetailsReport',_0x127119,JSON[_0xf8ca('0x10')](_0x18e8da));_0x237f44(_0x18e8da);})[_0xf8ca('0x16')](function(_0x179a48){logger[_0xf8ca('0x11')](_0xf8ca('0x17'),_0x179a48[_0xf8ca('0x13')],_0x127119);_0x3b5400(_0x50e805['error'](0x1f4,_0x179a48['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 89de36e..dc1883a 100644 --- a/server/api/system/index.js +++ b/server/api/system/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x630a=['index','get','isAuthenticated','exports','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x630a,0x88));var _0xa630=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x630a[_0x5280f4];return _0xba93e7;};'use strict';var express=require(_0xa630('0x0'));var router=express[_0xa630('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa630('0x2')]);router[_0xa630('0x3')]('/process/:pid/kill',auth[_0xa630('0x4')](),controller['killProcess']);module[_0xa630('0x5')]=router; \ No newline at end of file +var _0xdf82=['index','/process/:pid/kill','killProcess','express','Router','./system.controller','get','isAuthenticated'];(function(_0x561f31,_0x5a4fd0){var _0x2224fb=function(_0x56f0ce){while(--_0x56f0ce){_0x561f31['push'](_0x561f31['shift']());}};_0x2224fb(++_0x5a4fd0);}(_0xdf82,0x143));var _0x2df8=function(_0xca77ce,_0x91f730){_0xca77ce=_0xca77ce-0x0;var _0x2114a7=_0xdf82[_0xca77ce];return _0x2114a7;};'use strict';var express=require(_0x2df8('0x0'));var router=express[_0x2df8('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x2df8('0x2'));router[_0x2df8('0x3')]('/',auth[_0x2df8('0x4')](),controller[_0x2df8('0x5')]);router['get'](_0x2df8('0x6'),auth[_0x2df8('0x4')](),controller[_0x2df8('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 4b0ee63..4811da4 100644 --- a/server/api/system/system.controller.js +++ b/server/api/system/system.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9134=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','pid','SIGINT','child_process','lodash','error','inspect','name','status','send','index','getAllData','then','catch','json','killProcess','components/import/cm','format'];(function(_0x1c4866,_0x255b66){var _0x4239e6=function(_0xb477fe){while(--_0xb477fe){_0x1c4866['push'](_0x1c4866['shift']());}};_0x4239e6(++_0x255b66);}(_0x9134,0x1a6));var _0x4913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9134[_0x3dd15e];return _0x231fd0;};'use strict';var info=require('systeminformation');var exec=require(_0x4913('0x0'))['exec'];var logger=require('../../config/logger')('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x4913('0x1'));function handleError(_0x2c2b04,_0x4ce482,_0x537b83){_0x4ce482=_0x4ce482||0x1f4;return function(_0x5a1416){logger[_0x4913('0x2')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x537b83,_0x4ce482,util[_0x4913('0x3')](_0x5a1416,{'showHidden':![],'depth':null}));delete _0x5a1416[_0x4913('0x4')];_0x2c2b04[_0x4913('0x5')](_0x4ce482)[_0x4913('0x6')](_0x5a1416);};}exports[_0x4913('0x7')]=function(_0x4a0ae7,_0x5db891){return info[_0x4913('0x8')]()[_0x4913('0x9')](function(_0x48d59c){return _0x5db891['status'](0xc8)['json'](_0x48d59c);})[_0x4913('0xa')](function(_0x5df683){return _0x5db891['status'](0x1f4)[_0x4913('0xb')](_0x5df683);});};exports[_0x4913('0xc')]=function(_0x258c42,_0x46c354){var _0x1ac93f=[_0x4913('0xd')];return new BPromise(function(_0x1333b8,_0x3a7fa1){return exec(util[_0x4913('0xe')](_0x4913('0xf'),_0x258c42[_0x4913('0x10')]['pid']),function(_0xf19d12,_0x3f8cf,_0x18f0e5){if(_0xf19d12){return _0x3a7fa1(_0xf19d12);}return _0x1333b8(_0x3f8cf);});})['then'](function(_0x4b7e71){var _0x17e90a=![];var _0x127d30=_0x4b7e71[_0x4913('0x11')](/\n/);for(var _0x3f8735=0x0,_0x3ce4dc=_0x1ac93f['length'];_0x3f8735<_0x3ce4dc,_0x17e90a===![];_0x3f8735+=0x1){if(_0x4b7e71[_0x4913('0x12')](_0x1ac93f[_0x3f8735])>=0x0){_0x17e90a=!![];}}if(!_0x17e90a){throw new Error(util[_0x4913('0xe')](_0x4913('0x13'),_0x258c42['params']['pid']));}process[_0x4913('0x14')](_0x258c42[_0x4913('0x10')][_0x4913('0x15')],_0x4913('0x16'));return _0x46c354['status'](0xc8)[_0x4913('0xb')]({'message':util[_0x4913('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x258c42['params'][_0x4913('0x15')])});})[_0x4913('0xa')](handleError(_0x46c354,null,'killProcess'));}; \ No newline at end of file +var _0x22a8=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','bluebird','lodash','error'];(function(_0x37f443,_0x4f958a){var _0x557fb1=function(_0x3b986b){while(--_0x3b986b){_0x37f443['push'](_0x37f443['shift']());}};_0x557fb1(++_0x4f958a);}(_0x22a8,0x19e));var _0x822a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x22a8[_0x4565bf];return _0x5610ba;};'use strict';var info=require(_0x822a('0x0'));var exec=require('child_process')[_0x822a('0x1')];var logger=require(_0x822a('0x2'))('api');var util=require('util');var BPromise=require(_0x822a('0x3'));var _=require(_0x822a('0x4'));function handleError(_0x5cde9f,_0x558c25,_0x7efe20){_0x558c25=_0x558c25||0x1f4;return function(_0x20108c){logger[_0x822a('0x5')](_0x822a('0x6'),_0x7efe20,_0x558c25,util[_0x822a('0x7')](_0x20108c,{'showHidden':![],'depth':null}));delete _0x20108c[_0x822a('0x8')];_0x5cde9f[_0x822a('0x9')](_0x558c25)[_0x822a('0xa')](_0x20108c);};}exports['index']=function(_0x13c9b0,_0x27533){return info[_0x822a('0xb')]()['then'](function(_0x9d8741){return _0x27533[_0x822a('0x9')](0xc8)['json'](_0x9d8741);})[_0x822a('0xc')](function(_0x332e56){return _0x27533[_0x822a('0x9')](0x1f4)[_0x822a('0xd')](_0x332e56);});};exports[_0x822a('0xe')]=function(_0x3e4027,_0x3badd9){var _0x279ec2=[_0x822a('0xf')];return new BPromise(function(_0xb91f0b,_0x52beea){return exec(util[_0x822a('0x10')](_0x822a('0x11'),_0x3e4027['params'][_0x822a('0x12')]),function(_0x3b6679,_0x4f5418,_0x588b20){if(_0x3b6679){return _0x52beea(_0x3b6679);}return _0xb91f0b(_0x4f5418);});})[_0x822a('0x13')](function(_0x160d98){var _0x559b74=![];var _0xe872f6=_0x160d98[_0x822a('0x14')](/\n/);for(var _0x20bdbe=0x0,_0x4f9834=_0x279ec2[_0x822a('0x15')];_0x20bdbe<_0x4f9834,_0x559b74===![];_0x20bdbe+=0x1){if(_0x160d98[_0x822a('0x16')](_0x279ec2[_0x20bdbe])>=0x0){_0x559b74=!![];}}if(!_0x559b74){throw new Error(util[_0x822a('0x10')](_0x822a('0x17'),_0x3e4027[_0x822a('0x18')]['pid']));}process[_0x822a('0x19')](_0x3e4027[_0x822a('0x18')][_0x822a('0x12')],_0x822a('0x1a'));return _0x3badd9[_0x822a('0x9')](0xc8)[_0x822a('0xd')]({'message':util[_0x822a('0x10')](_0x822a('0x1b'),_0x3e4027[_0x822a('0x18')][_0x822a('0x12')])});})[_0x822a('0xc')](handleError(_0x3badd9,null,_0x822a('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 736394f..ee0ead5 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeacb=['delete','destroy','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x28c768,_0x2032aa){var _0x31ab36=function(_0x134170){while(--_0x134170){_0x28c768['push'](_0x28c768['shift']());}};_0x31ab36(++_0x2032aa);}(_0xeacb,0xcf));var _0xbeac=function(_0x22026d,_0x3ec81c){_0x22026d=_0x22026d-0x0;var _0x495b60=_0xeacb[_0x22026d];return _0x495b60;};'use strict';var multer=require('multer');var util=require(_0xbeac('0x0'));var path=require(_0xbeac('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeac('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xbeac('0x3'));var config=require(_0xbeac('0x4'));var controller=require(_0xbeac('0x5'));router['get']('/',auth[_0xbeac('0x6')](),controller[_0xbeac('0x7')]);router[_0xbeac('0x8')](_0xbeac('0x9'),auth[_0xbeac('0x6')](),controller[_0xbeac('0xa')]);router[_0xbeac('0xb')]('/',auth[_0xbeac('0x6')](),controller[_0xbeac('0xc')]);router[_0xbeac('0xd')](_0xbeac('0x9'),auth[_0xbeac('0x6')](),controller['update']);router[_0xbeac('0xe')](_0xbeac('0x9'),auth[_0xbeac('0x6')](),controller[_0xbeac('0xf')]);module[_0xbeac('0x10')]=router; \ No newline at end of file +var _0xaeff=['/:id','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','index'];(function(_0x3b277e,_0x5ccbc4){var _0x5dd181=function(_0xa32f0f){while(--_0xa32f0f){_0x3b277e['push'](_0x3b277e['shift']());}};_0x5dd181(++_0x5ccbc4);}(_0xaeff,0x179));var _0xfaef=function(_0x1fdc5e,_0x1462c0){_0x1fdc5e=_0x1fdc5e-0x0;var _0x44fb6b=_0xaeff[_0x1fdc5e];return _0x44fb6b;};'use strict';var multer=require(_0xfaef('0x0'));var util=require(_0xfaef('0x1'));var path=require(_0xfaef('0x2'));var timeout=require(_0xfaef('0x3'));var express=require(_0xfaef('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfaef('0x5'));var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfaef('0x6')]);router['get'](_0xfaef('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xfaef('0x8')]('/',auth[_0xfaef('0x9')](),controller[_0xfaef('0xa')]);router[_0xfaef('0xb')]('/:id',auth[_0xfaef('0x9')](),controller[_0xfaef('0xc')]);router[_0xfaef('0xd')]('/:id',auth[_0xfaef('0x9')](),controller[_0xfaef('0xe')]);module[_0xfaef('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f577755..7a81a6d 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b74=['exports','STRING','#0091EA','sequelize'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x4b74,0x103));var _0x44b7=function(_0x13f4e6,_0x42f234){_0x13f4e6=_0x13f4e6-0x0;var _0x5841c5=_0x4b74[_0x13f4e6];return _0x5841c5;};'use strict';var Sequelize=require(_0x44b7('0x0'));module[_0x44b7('0x1')]={'name':{'type':Sequelize[_0x44b7('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x44b7('0x2')],'defaultValue':_0x44b7('0x3')},'description':{'type':Sequelize[_0x44b7('0x2')]}}; \ No newline at end of file +var _0x17d1=['#0091EA','sequelize','exports','STRING'];(function(_0x416706,_0x1d44dd){var _0x4907f9=function(_0x592bc8){while(--_0x592bc8){_0x416706['push'](_0x416706['shift']());}};_0x4907f9(++_0x1d44dd);}(_0x17d1,0xc9));var _0x117d=function(_0x35056,_0x9b2038){_0x35056=_0x35056-0x0;var _0x40cba8=_0x17d1[_0x35056];return _0x40cba8;};'use strict';var Sequelize=require(_0x117d('0x0'));module[_0x117d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x117d('0x2')],'defaultValue':_0x117d('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c99ee09..549c567 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea3=['order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','map','Tag','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x2710b7,_0x5b6c3c){var _0xfc00c2=function(_0xba4679){while(--_0xba4679){_0x2710b7['push'](_0x2710b7['shift']());}};_0xfc00c2(++_0x5b6c3c);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x34ea('0x0'));var rimraf=require(_0x34ea('0x1'));var zipdir=require(_0x34ea('0x2'));var jsonpatch=require(_0x34ea('0x3'));var rp=require('request-promise');var moment=require(_0x34ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x34ea('0x6'));var csv=require(_0x34ea('0x7'));var ejs=require(_0x34ea('0x8'));var fs=require('fs');var fs_extra=require(_0x34ea('0x9'));var _=require(_0x34ea('0xa'));var squel=require(_0x34ea('0xb'));var crypto=require(_0x34ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x34ea('0xd'));var toCsv=require(_0x34ea('0x7'));var querystring=require(_0x34ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ea('0xf'));var authService=require(_0x34ea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ea('0x11'));var logger=require(_0x34ea('0x12'))(_0x34ea('0x13'));var utils=require('../../config/utils');var config=require(_0x34ea('0x14'));var licenseUtil=require(_0x34ea('0x15'));var db=require(_0x34ea('0x16'))['db'];function respondWithStatusCode(_0x233b11,_0x60725f){_0x60725f=_0x60725f||0xcc;return function(_0xc56a7d){if(_0xc56a7d){return _0x233b11[_0x34ea('0x17')](_0x60725f);}return _0x233b11[_0x34ea('0x18')](_0x60725f)[_0x34ea('0x19')]();};}function respondWithResult(_0x2a19c6,_0x36a4c6){_0x36a4c6=_0x36a4c6||0xc8;return function(_0x5ef9ae){if(_0x5ef9ae){return _0x2a19c6[_0x34ea('0x18')](_0x36a4c6)[_0x34ea('0x1a')](_0x5ef9ae);}};}function respondWithFilteredResult(_0x14ebb9,_0x3f9ffe){return function(_0x44e44e){if(_0x44e44e){var _0x56b2d7=typeof _0x3f9ffe[_0x34ea('0x1b')]===_0x34ea('0x1c')&&typeof _0x3f9ffe[_0x34ea('0x1d')]===_0x34ea('0x1c');var _0x5f420f=_0x44e44e[_0x34ea('0x1e')];var _0x34caea=_0x56b2d7?0x0:_0x3f9ffe[_0x34ea('0x1b')];var _0x5340a4=_0x56b2d7?_0x44e44e[_0x34ea('0x1e')]:_0x3f9ffe[_0x34ea('0x1b')]+_0x3f9ffe[_0x34ea('0x1d')];var _0x127308;if(_0x5340a4>=_0x5f420f){_0x5340a4=_0x5f420f;_0x127308=0xc8;}else{_0x127308=0xce;}_0x14ebb9['status'](_0x127308);return _0x14ebb9[_0x34ea('0x1f')](_0x34ea('0x20'),_0x34caea+'-'+_0x5340a4+'/'+_0x5f420f)[_0x34ea('0x1a')](_0x44e44e);}return null;};}function patchUpdates(_0x247ee7){return function(_0x4fc1a2){try{jsonpatch['apply'](_0x4fc1a2,_0x247ee7,!![]);}catch(_0xe3b292){return BPromise[_0x34ea('0x21')](_0xe3b292);}return _0x4fc1a2[_0x34ea('0x22')]();};}function saveUpdates(_0x51022f,_0x5197a2){return function(_0x2eafc6){if(_0x2eafc6){return _0x2eafc6[_0x34ea('0x23')](_0x51022f)[_0x34ea('0x24')](function(_0x30c4b0){return _0x30c4b0;});}return null;};}function removeEntity(_0x12e7e9,_0x697475){return function(_0x5ade46){if(_0x5ade46){return _0x5ade46[_0x34ea('0x25')]()[_0x34ea('0x24')](function(){var _0x3c0983=_0x5ade46[_0x34ea('0x26')]({'plain':!![]});var _0x5b5885='Tags';return db['UserProfileResource'][_0x34ea('0x25')]({'where':{'type':_0x5b5885,'resourceId':_0x3c0983['id']}})[_0x34ea('0x24')](function(){return _0x5ade46;});})[_0x34ea('0x24')](function(){_0x12e7e9[_0x34ea('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c80b,_0x267083){return function(_0x27c6f7){if(!_0x27c6f7){_0x26c80b['sendStatus'](0x194);}return _0x27c6f7;};}function handleError(_0x4cded8,_0x5b4727){_0x5b4727=_0x5b4727||0x1f4;return function(_0x4d4360){logger[_0x34ea('0x27')](_0x4d4360[_0x34ea('0x28')]);if(_0x4d4360[_0x34ea('0x29')]){delete _0x4d4360[_0x34ea('0x29')];}_0x4cded8['status'](_0x5b4727)[_0x34ea('0x2a')](_0x4d4360);};}exports['index']=function(_0x2c6de8,_0x4f2b77){var _0x3272f9={},_0x14e018={},_0x3cb968={'count':0x0,'rows':[]};var _0x57b19d=_[_0x34ea('0x2b')](db[_0x34ea('0x2c')]['rawAttributes'],function(_0x10bcfe){return{'name':_0x10bcfe['fieldName'],'type':_0x10bcfe[_0x34ea('0x2d')][_0x34ea('0x2e')]};});_0x14e018[_0x34ea('0x2f')]=_['map'](_0x57b19d,'name');_0x14e018[_0x34ea('0x30')]=_['keys'](_0x2c6de8[_0x34ea('0x30')]);_0x14e018[_0x34ea('0x31')]=_['intersection'](_0x14e018[_0x34ea('0x2f')],_0x14e018[_0x34ea('0x30')]);_0x3272f9[_0x34ea('0x32')]=_[_0x34ea('0x33')](_0x14e018['model'],qs['fields'](_0x2c6de8['query'][_0x34ea('0x34')]));_0x3272f9[_0x34ea('0x32')]=_0x3272f9[_0x34ea('0x32')]['length']?_0x3272f9['attributes']:_0x14e018['model'];if(!_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x35')]('nolimit')){_0x3272f9[_0x34ea('0x1d')]=qs[_0x34ea('0x1d')](_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x1d')]);_0x3272f9[_0x34ea('0x1b')]=qs[_0x34ea('0x1b')](_0x2c6de8['query'][_0x34ea('0x1b')]);}_0x3272f9[_0x34ea('0x36')]=qs[_0x34ea('0x37')](_0x2c6de8[_0x34ea('0x30')]['sort']);_0x3272f9['where']=qs[_0x34ea('0x31')](_[_0x34ea('0x38')](_0x2c6de8[_0x34ea('0x30')],_0x14e018[_0x34ea('0x31')]),_0x57b19d);if(_0x2c6de8[_0x34ea('0x30')]['filter']){_0x3272f9[_0x34ea('0x39')]=_[_0x34ea('0x3a')](_0x3272f9[_0x34ea('0x39')],{'$or':_[_0x34ea('0x2b')](_0x57b19d,function(_0x5787db){if(_0x5787db[_0x34ea('0x2d')]!==_0x34ea('0x3b')){var _0xa1ff39={};_0xa1ff39[_0x5787db[_0x34ea('0x29')]]={'$like':'%'+_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x3c')]+'%'};return _0xa1ff39;}})});}_0x3272f9=_[_0x34ea('0x3a')]({},_0x3272f9,_0x2c6de8[_0x34ea('0x3d')]);var _0x41fefb={'where':_0x3272f9[_0x34ea('0x39')]};return db[_0x34ea('0x2c')]['count'](_0x41fefb)[_0x34ea('0x24')](function(_0x4ae353){_0x3cb968[_0x34ea('0x1e')]=_0x4ae353;if(_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x3e')]){_0x3272f9[_0x34ea('0x3f')]=[{'all':!![]}];}return db[_0x34ea('0x2c')][_0x34ea('0x40')](_0x3272f9);})[_0x34ea('0x24')](function(_0x17ba01){_0x3cb968[_0x34ea('0x41')]=_0x17ba01;return _0x3cb968;})['then'](respondWithFilteredResult(_0x4f2b77,_0x3272f9))[_0x34ea('0x42')](handleError(_0x4f2b77,null));};exports['show']=function(_0x45f170,_0x273a51){var _0x39bc9a={'raw':!![],'where':{'id':_0x45f170[_0x34ea('0x43')]['id']}},_0x379282={};_0x379282[_0x34ea('0x2f')]=_['keys'](db[_0x34ea('0x2c')][_0x34ea('0x44')]);_0x379282['query']=_[_0x34ea('0x45')](_0x45f170[_0x34ea('0x30')]);_0x379282[_0x34ea('0x31')]=_[_0x34ea('0x33')](_0x379282[_0x34ea('0x2f')],_0x379282['query']);_0x39bc9a[_0x34ea('0x32')]=_[_0x34ea('0x33')](_0x379282[_0x34ea('0x2f')],qs[_0x34ea('0x34')](_0x45f170[_0x34ea('0x30')][_0x34ea('0x34')]));_0x39bc9a['attributes']=_0x39bc9a['attributes'][_0x34ea('0x46')]?_0x39bc9a[_0x34ea('0x32')]:_0x379282[_0x34ea('0x2f')];if(_0x45f170['query'][_0x34ea('0x3e')]){_0x39bc9a['include']=[{'all':!![]}];}_0x39bc9a=_[_0x34ea('0x3a')]({},_0x39bc9a,_0x45f170['options']);return db[_0x34ea('0x2c')][_0x34ea('0x47')](_0x39bc9a)[_0x34ea('0x24')](handleEntityNotFound(_0x273a51,null))['then'](respondWithResult(_0x273a51,null))[_0x34ea('0x42')](handleError(_0x273a51,null));};exports['create']=function(_0x404a59,_0x3fb739){return db[_0x34ea('0x2c')][_0x34ea('0x48')](_0x404a59['body'],{})[_0x34ea('0x24')](function(_0x2d07cf){var _0x312ff8=_0x404a59[_0x34ea('0x49')][_0x34ea('0x26')]({'plain':!![]});if(!_0x312ff8)throw new Error(_0x34ea('0x4a'));if(_0x312ff8[_0x34ea('0x4b')]==='user'){var _0x1059dc=_0x2d07cf[_0x34ea('0x26')]({'plain':!![]});var _0x26ea1d=_0x34ea('0x4c');return db[_0x34ea('0x4d')][_0x34ea('0x47')]({'where':{'name':_0x26ea1d,'userProfileId':_0x312ff8[_0x34ea('0x4e')]},'raw':!![]})[_0x34ea('0x24')](function(_0x11a9f7){if(_0x11a9f7&&_0x11a9f7[_0x34ea('0x4f')]===0x0){return db[_0x34ea('0x50')][_0x34ea('0x48')]({'name':_0x1059dc[_0x34ea('0x29')],'resourceId':_0x1059dc['id'],'type':_0x11a9f7['name'],'sectionId':_0x11a9f7['id']},{})[_0x34ea('0x24')](function(){return _0x2d07cf;});}else{return _0x2d07cf;}})[_0x34ea('0x42')](function(_0x33f7c6){logger['error'](_0x34ea('0x51'),_0x33f7c6);throw _0x33f7c6;});}return _0x2d07cf;})['then'](respondWithResult(_0x3fb739,0xc9))[_0x34ea('0x42')](handleError(_0x3fb739,null));};exports[_0x34ea('0x23')]=function(_0x47aab6,_0xe8d397){if(_0x47aab6[_0x34ea('0x52')]['id']){delete _0x47aab6[_0x34ea('0x52')]['id'];}return db['Tag']['find']({'where':{'id':_0x47aab6[_0x34ea('0x43')]['id']}})['then'](handleEntityNotFound(_0xe8d397,null))['then'](saveUpdates(_0x47aab6[_0x34ea('0x52')],null))['then'](respondWithResult(_0xe8d397,null))[_0x34ea('0x42')](handleError(_0xe8d397,null));};exports[_0x34ea('0x25')]=function(_0x3918c5,_0x443c98){return db[_0x34ea('0x2c')][_0x34ea('0x47')]({'where':{'id':_0x3918c5[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x443c98,null))[_0x34ea('0x24')](removeEntity(_0x443c98,null))[_0x34ea('0x42')](handleError(_0x443c98,null));}; \ No newline at end of file +var _0x50a6=['Tag','show','params','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','merge','VIRTUAL','filter','options'];(function(_0x4cd99c,_0x3cffe7){var _0x10d28a=function(_0x5784eb){while(--_0x5784eb){_0x4cd99c['push'](_0x4cd99c['shift']());}};_0x10d28a(++_0x3cffe7);}(_0x50a6,0xa4));var _0x650a=function(_0xb2fcbd,_0x5bfcfd){_0xb2fcbd=_0xb2fcbd-0x0;var _0x253dca=_0x50a6[_0xb2fcbd];return _0x253dca;};'use strict';var emlformat=require(_0x650a('0x0'));var rimraf=require(_0x650a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x650a('0x2'));var moment=require('moment');var BPromise=require(_0x650a('0x3'));var Mustache=require(_0x650a('0x4'));var util=require(_0x650a('0x5'));var path=require('path');var sox=require(_0x650a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x650a('0x7'));var _=require(_0x650a('0x8'));var squel=require(_0x650a('0x9'));var crypto=require(_0x650a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x650a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x650a('0xc'));var Papa=require(_0x650a('0xd'));var Redis=require('ioredis');var authService=require(_0x650a('0xe'));var qs=require(_0x650a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x650a('0x10'));var logger=require('../../config/logger')(_0x650a('0x11'));var utils=require('../../config/utils');var config=require(_0x650a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x650a('0x13'))['db'];function respondWithStatusCode(_0x48077a,_0x33e73d){_0x33e73d=_0x33e73d||0xcc;return function(_0x163e5f){if(_0x163e5f){return _0x48077a[_0x650a('0x14')](_0x33e73d);}return _0x48077a['status'](_0x33e73d)[_0x650a('0x15')]();};}function respondWithResult(_0x3919a7,_0x2f727d){_0x2f727d=_0x2f727d||0xc8;return function(_0x15f2fd){if(_0x15f2fd){return _0x3919a7[_0x650a('0x16')](_0x2f727d)[_0x650a('0x17')](_0x15f2fd);}};}function respondWithFilteredResult(_0x5b7c74,_0x2460a3){return function(_0x4fdd82){if(_0x4fdd82){var _0x1f94ab=typeof _0x2460a3[_0x650a('0x18')]===_0x650a('0x19')&&typeof _0x2460a3['limit']==='undefined';var _0x5285e0=_0x4fdd82['count'];var _0x2ad2d7=_0x1f94ab?0x0:_0x2460a3[_0x650a('0x18')];var _0x41d2fa=_0x1f94ab?_0x4fdd82[_0x650a('0x1a')]:_0x2460a3[_0x650a('0x18')]+_0x2460a3['limit'];var _0x4eba86;if(_0x41d2fa>=_0x5285e0){_0x41d2fa=_0x5285e0;_0x4eba86=0xc8;}else{_0x4eba86=0xce;}_0x5b7c74[_0x650a('0x16')](_0x4eba86);return _0x5b7c74[_0x650a('0x1b')]('Content-Range',_0x2ad2d7+'-'+_0x41d2fa+'/'+_0x5285e0)[_0x650a('0x17')](_0x4fdd82);}return null;};}function patchUpdates(_0x385ecd){return function(_0x59b5e4){try{jsonpatch[_0x650a('0x1c')](_0x59b5e4,_0x385ecd,!![]);}catch(_0x1ceedd){return BPromise[_0x650a('0x1d')](_0x1ceedd);}return _0x59b5e4[_0x650a('0x1e')]();};}function saveUpdates(_0x5163fe,_0x489a5f){return function(_0x88531d){if(_0x88531d){return _0x88531d['update'](_0x5163fe)[_0x650a('0x1f')](function(_0x1d471d){return _0x1d471d;});}return null;};}function removeEntity(_0xb12c52,_0x469e53){return function(_0x2ed256){if(_0x2ed256){return _0x2ed256[_0x650a('0x20')]()[_0x650a('0x1f')](function(){var _0x322eba=_0x2ed256[_0x650a('0x21')]({'plain':!![]});var _0x2761a8=_0x650a('0x22');return db[_0x650a('0x23')][_0x650a('0x20')]({'where':{'type':_0x2761a8,'resourceId':_0x322eba['id']}})[_0x650a('0x1f')](function(){return _0x2ed256;});})[_0x650a('0x1f')](function(){_0xb12c52[_0x650a('0x16')](0xcc)[_0x650a('0x15')]();});}};}function handleEntityNotFound(_0x12fdb4,_0x4c1df6){return function(_0x2290a7){if(!_0x2290a7){_0x12fdb4[_0x650a('0x14')](0x194);}return _0x2290a7;};}function handleError(_0x558002,_0x5dee27){_0x5dee27=_0x5dee27||0x1f4;return function(_0x1c6845){logger[_0x650a('0x24')](_0x1c6845[_0x650a('0x25')]);if(_0x1c6845[_0x650a('0x26')]){delete _0x1c6845[_0x650a('0x26')];}_0x558002[_0x650a('0x16')](_0x5dee27)['send'](_0x1c6845);};}exports[_0x650a('0x27')]=function(_0x1c8621,_0x199c86){var _0x18c197={},_0x25a47c={},_0x3e15ba={'count':0x0,'rows':[]};var _0x436e28=_[_0x650a('0x28')](db['Tag'][_0x650a('0x29')],function(_0x3c2eda){return{'name':_0x3c2eda[_0x650a('0x2a')],'type':_0x3c2eda['type'][_0x650a('0x2b')]};});_0x25a47c[_0x650a('0x2c')]=_['map'](_0x436e28,_0x650a('0x26'));_0x25a47c[_0x650a('0x2d')]=_[_0x650a('0x2e')](_0x1c8621['query']);_0x25a47c['filters']=_['intersection'](_0x25a47c[_0x650a('0x2c')],_0x25a47c[_0x650a('0x2d')]);_0x18c197[_0x650a('0x2f')]=_[_0x650a('0x30')](_0x25a47c['model'],qs[_0x650a('0x31')](_0x1c8621[_0x650a('0x2d')]['fields']));_0x18c197[_0x650a('0x2f')]=_0x18c197[_0x650a('0x2f')][_0x650a('0x32')]?_0x18c197[_0x650a('0x2f')]:_0x25a47c[_0x650a('0x2c')];if(!_0x1c8621['query'][_0x650a('0x33')]('nolimit')){_0x18c197[_0x650a('0x34')]=qs[_0x650a('0x34')](_0x1c8621['query'][_0x650a('0x34')]);_0x18c197[_0x650a('0x18')]=qs['offset'](_0x1c8621[_0x650a('0x2d')][_0x650a('0x18')]);}_0x18c197[_0x650a('0x35')]=qs['sort'](_0x1c8621[_0x650a('0x2d')][_0x650a('0x36')]);_0x18c197[_0x650a('0x37')]=qs[_0x650a('0x38')](_['pick'](_0x1c8621[_0x650a('0x2d')],_0x25a47c[_0x650a('0x38')]),_0x436e28);if(_0x1c8621[_0x650a('0x2d')]['filter']){_0x18c197['where']=_[_0x650a('0x39')](_0x18c197[_0x650a('0x37')],{'$or':_['map'](_0x436e28,function(_0x1acbe5){if(_0x1acbe5['type']!==_0x650a('0x3a')){var _0x39b00b={};_0x39b00b[_0x1acbe5[_0x650a('0x26')]]={'$like':'%'+_0x1c8621[_0x650a('0x2d')][_0x650a('0x3b')]+'%'};return _0x39b00b;}})});}_0x18c197=_['merge']({},_0x18c197,_0x1c8621[_0x650a('0x3c')]);var _0x5ba502={'where':_0x18c197[_0x650a('0x37')]};return db[_0x650a('0x3d')][_0x650a('0x1a')](_0x5ba502)[_0x650a('0x1f')](function(_0x1c5c6c){_0x3e15ba[_0x650a('0x1a')]=_0x1c5c6c;if(_0x1c8621[_0x650a('0x2d')]['includeAll']){_0x18c197['include']=[{'all':!![]}];}return db[_0x650a('0x3d')]['findAll'](_0x18c197);})['then'](function(_0x1e0868){_0x3e15ba['rows']=_0x1e0868;return _0x3e15ba;})[_0x650a('0x1f')](respondWithFilteredResult(_0x199c86,_0x18c197))['catch'](handleError(_0x199c86,null));};exports[_0x650a('0x3e')]=function(_0x9a53ec,_0x1855c9){var _0x233a5f={'raw':!![],'where':{'id':_0x9a53ec[_0x650a('0x3f')]['id']}},_0x409495={};_0x409495[_0x650a('0x2c')]=_[_0x650a('0x2e')](db[_0x650a('0x3d')][_0x650a('0x29')]);_0x409495[_0x650a('0x2d')]=_[_0x650a('0x2e')](_0x9a53ec['query']);_0x409495[_0x650a('0x38')]=_[_0x650a('0x30')](_0x409495[_0x650a('0x2c')],_0x409495[_0x650a('0x2d')]);_0x233a5f[_0x650a('0x2f')]=_[_0x650a('0x30')](_0x409495['model'],qs[_0x650a('0x31')](_0x9a53ec[_0x650a('0x2d')][_0x650a('0x31')]));_0x233a5f[_0x650a('0x2f')]=_0x233a5f[_0x650a('0x2f')][_0x650a('0x32')]?_0x233a5f['attributes']:_0x409495['model'];if(_0x9a53ec[_0x650a('0x2d')][_0x650a('0x40')]){_0x233a5f[_0x650a('0x41')]=[{'all':!![]}];}_0x233a5f=_['merge']({},_0x233a5f,_0x9a53ec[_0x650a('0x3c')]);return db['Tag'][_0x650a('0x42')](_0x233a5f)[_0x650a('0x1f')](handleEntityNotFound(_0x1855c9,null))['then'](respondWithResult(_0x1855c9,null))[_0x650a('0x43')](handleError(_0x1855c9,null));};exports[_0x650a('0x44')]=function(_0x39e8e6,_0x47ec0d){return db[_0x650a('0x3d')][_0x650a('0x44')](_0x39e8e6[_0x650a('0x45')],{})['then'](function(_0x17a40d){var _0x3f2151=_0x39e8e6[_0x650a('0x46')][_0x650a('0x21')]({'plain':!![]});if(!_0x3f2151)throw new Error(_0x650a('0x47'));if(_0x3f2151['role']==='user'){var _0x215f2e=_0x17a40d[_0x650a('0x21')]({'plain':!![]});var _0x5b2907=_0x650a('0x22');return db[_0x650a('0x48')][_0x650a('0x42')]({'where':{'name':_0x5b2907,'userProfileId':_0x3f2151[_0x650a('0x49')]},'raw':!![]})[_0x650a('0x1f')](function(_0x8bef2c){if(_0x8bef2c&&_0x8bef2c['autoAssociation']===0x0){return db[_0x650a('0x23')][_0x650a('0x44')]({'name':_0x215f2e[_0x650a('0x26')],'resourceId':_0x215f2e['id'],'type':_0x8bef2c[_0x650a('0x26')],'sectionId':_0x8bef2c['id']},{})[_0x650a('0x1f')](function(){return _0x17a40d;});}else{return _0x17a40d;}})['catch'](function(_0x45346f){logger[_0x650a('0x24')](_0x650a('0x4a'),_0x45346f);throw _0x45346f;});}return _0x17a40d;})[_0x650a('0x1f')](respondWithResult(_0x47ec0d,0xc9))['catch'](handleError(_0x47ec0d,null));};exports['update']=function(_0xd782e9,_0x225fd6){if(_0xd782e9['body']['id']){delete _0xd782e9[_0x650a('0x45')]['id'];}return db[_0x650a('0x3d')][_0x650a('0x42')]({'where':{'id':_0xd782e9[_0x650a('0x3f')]['id']}})[_0x650a('0x1f')](handleEntityNotFound(_0x225fd6,null))[_0x650a('0x1f')](saveUpdates(_0xd782e9[_0x650a('0x45')],null))[_0x650a('0x1f')](respondWithResult(_0x225fd6,null))[_0x650a('0x43')](handleError(_0x225fd6,null));};exports[_0x650a('0x20')]=function(_0x304e50,_0x15db69){return db[_0x650a('0x3d')][_0x650a('0x42')]({'where':{'id':_0x304e50[_0x650a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x15db69,null))['then'](removeEntity(_0x15db69,null))[_0x650a('0x43')](handleError(_0x15db69,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 767085b..8d807d4 100644 --- a/server/api/tag/tag.model.js +++ b/server/api/tag/tag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x064a=['lodash','util','../../config/logger','moment','rimraf','./tag.attributes','define','Tag','tools_tags'];(function(_0x3690ab,_0x4d2fa8){var _0xa9df1e=function(_0x8f637a){while(--_0x8f637a){_0x3690ab['push'](_0x3690ab['shift']());}};_0xa9df1e(++_0x4d2fa8);}(_0x064a,0x168));var _0xa064=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x064a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa064('0x0'));var util=require(_0xa064('0x1'));var logger=require(_0xa064('0x2'))('api');var moment=require(_0xa064('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa064('0x4'));var config=require('../../config/environment');var attributes=require(_0xa064('0x5'));module['exports']=function(_0x17ac46,_0x5a59ad){return _0x17ac46[_0xa064('0x6')](_0xa064('0x7'),attributes,{'tableName':_0xa064('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7be=['Tag','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define'];(function(_0x4db3b6,_0x231f8c){var _0x840071=function(_0x2f09fe){while(--_0x2f09fe){_0x4db3b6['push'](_0x4db3b6['shift']());}};_0x840071(++_0x231f8c);}(_0xb7be,0x121));var _0xeb7b=function(_0x3cfb3c,_0x8b172){_0x3cfb3c=_0x3cfb3c-0x0;var _0x5c3d52=_0xb7be[_0x3cfb3c];return _0x5c3d52;};'use strict';var _=require(_0xeb7b('0x0'));var util=require(_0xeb7b('0x1'));var logger=require(_0xeb7b('0x2'))(_0xeb7b('0x3'));var moment=require('moment');var BPromise=require(_0xeb7b('0x4'));var rp=require(_0xeb7b('0x5'));var fs=require('fs');var path=require(_0xeb7b('0x6'));var rimraf=require(_0xeb7b('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb7b('0x8'));module[_0xeb7b('0x9')]=function(_0x4c87ae,_0x4c9077){return _0x4c87ae[_0xeb7b('0xa')](_0xeb7b('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 25d8a64..d706a99 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf72b=['../../config/environment','jayson/promise','client','request','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf72b,0x1d9));var _0xbf72=function(_0xef24a3,_0x4ad1d5){_0xef24a3=_0xef24a3-0x0;var _0x5932f5=_0xf72b[_0xef24a3];return _0x5932f5;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});} \ No newline at end of file +var _0x9649=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x3d1d1a,_0x5aa42c){var _0x2f18b6=function(_0x5c0635){while(--_0x5c0635){_0x3d1d1a['push'](_0x3d1d1a['shift']());}};_0x2f18b6(++_0x5aa42c);}(_0x9649,0x19f));var _0x9964=function(_0x27b512,_0x18d139){_0x27b512=_0x27b512-0x0;var _0x2239dc=_0x9649[_0x27b512];return _0x2239dc;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var moment=require(_0x9964('0x2'));var BPromise=require(_0x9964('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9964('0x4'));var db=require(_0x9964('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9964('0x6'))('rpc');var config=require(_0x9964('0x7'));var jayson=require(_0x9964('0x8'));var client=jayson[_0x9964('0x9')][_0x9964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40c60b,_0x1338e7,_0x3fa639){return new BPromise(function(_0x4bec88,_0x45dda7){return client[_0x9964('0xb')](_0x40c60b,_0x3fa639)['then'](function(_0x10b88b){logger[_0x9964('0xc')]('Tag,\x20%s,\x20%s',_0x1338e7,'request\x20sent');logger[_0x9964('0xd')](_0x9964('0xe'),_0x1338e7,_0x9964('0xf'),JSON[_0x9964('0x10')](_0x10b88b));if(_0x10b88b[_0x9964('0x11')]){if(_0x10b88b['error'][_0x9964('0x12')]===0x1f4){logger['error'](_0x9964('0x13'),_0x1338e7,_0x10b88b[_0x9964('0x11')]['message']);return _0x45dda7(_0x10b88b[_0x9964('0x11')][_0x9964('0x14')]);}logger['error'](_0x9964('0x13'),_0x1338e7,_0x10b88b[_0x9964('0x11')][_0x9964('0x14')]);return _0x4bec88(_0x10b88b[_0x9964('0x11')][_0x9964('0x14')]);}else{logger['info'](_0x9964('0x13'),_0x1338e7,_0x9964('0xf'));_0x4bec88(_0x10b88b['result'][_0x9964('0x14')]);}})[_0x9964('0x15')](function(_0x57fe55){logger[_0x9964('0x11')](_0x9964('0x13'),_0x1338e7,_0x57fe55);_0x45dda7(_0x57fe55);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a7dc675..1e8cf08 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index c796d82..257ffbb 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0xec9a86,_0x2adbea){var _0x5da295=function(_0x99a749){while(--_0x99a749){_0xec9a86['push'](_0xec9a86['shift']());}};_0x5da295(++_0x2adbea);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x38313c,_0x1f85e7){var _0x294d4c=function(_0xb73720){while(--_0xb73720){_0x38313c['push'](_0x38313c['shift']());}};_0x294d4c(++_0x1f85e7);}(_0x757a,0xde));var _0xa757=function(_0x4501b8,_0x4fff99){_0x4501b8=_0x4501b8-0x0;var _0x3daa75=_0x757a[_0x4501b8];return _0x3daa75;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9ad1409..cc39815 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc852=['UserVoiceQueueRt','upsert','isNil','all','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','addAgents','spread','removeAgents','Sms','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','request-promise','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','localhost','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','order','sort','where','pick','merge','VIRTUAL','filter','options','Team','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','Teams','end','send','getQueues','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ValidationError','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','findOrCreate','emit','User','online','voicePause','interface'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xc852,0x1c4));var _0x2c85=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc852[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x2c85('0x0'));var rimraf=require(_0x2c85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c85('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2c85('0x3'));var sox=require(_0x2c85('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c85('0x5'));var squel=require(_0x2c85('0x6'));var crypto=require(_0x2c85('0x7'));var jsforce=require(_0x2c85('0x8'));var deskjs=require(_0x2c85('0x9'));var toCsv=require(_0x2c85('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c85('0xb'));var authService=require(_0x2c85('0xc'));var qs=require(_0x2c85('0xd'));var as=require(_0x2c85('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2c85('0xf'));var utils=require(_0x2c85('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x2c85('0x11'));var db=require('../../mysqldb')['db'];config[_0x2c85('0x12')]=_['defaults'](config['redis'],{'host':_0x2c85('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c85('0x12')]));require(_0x2c85('0x14'))[_0x2c85('0x15')](socket);function respondWithStatusCode(_0x4eeb7a,_0xc24c82){_0xc24c82=_0xc24c82||0xcc;return function(_0x16e0a9){if(_0x16e0a9){return _0x4eeb7a[_0x2c85('0x16')](_0xc24c82);}return _0x4eeb7a[_0x2c85('0x17')](_0xc24c82)['end']();};}function respondWithResult(_0x4f5ad7,_0x2461cb){_0x2461cb=_0x2461cb||0xc8;return function(_0x49c6e0){if(_0x49c6e0){return _0x4f5ad7[_0x2c85('0x17')](_0x2461cb)[_0x2c85('0x18')](_0x49c6e0);}};}function respondWithFilteredResult(_0x5823aa,_0x5bd007){return function(_0x2904f9){if(_0x2904f9){var _0x1257cf=typeof _0x5bd007[_0x2c85('0x19')]===_0x2c85('0x1a')&&typeof _0x5bd007[_0x2c85('0x1b')]==='undefined';var _0x30c0d5=_0x2904f9[_0x2c85('0x1c')];var _0x469c17=_0x1257cf?0x0:_0x5bd007['offset'];var _0x13bad5=_0x1257cf?_0x2904f9[_0x2c85('0x1c')]:_0x5bd007['offset']+_0x5bd007[_0x2c85('0x1b')];var _0xf22fd6;if(_0x13bad5>=_0x30c0d5){_0x13bad5=_0x30c0d5;_0xf22fd6=0xc8;}else{_0xf22fd6=0xce;}_0x5823aa[_0x2c85('0x17')](_0xf22fd6);return _0x5823aa[_0x2c85('0x1d')]('Content-Range',_0x469c17+'-'+_0x13bad5+'/'+_0x30c0d5)['json'](_0x2904f9);}return null;};}function patchUpdates(_0x408f61){return function(_0x502390){try{jsonpatch['apply'](_0x502390,_0x408f61,!![]);}catch(_0x5e10f5){return BPromise['reject'](_0x5e10f5);}return _0x502390['save']();};}function saveUpdates(_0x1dbbe5,_0x49fe79){return function(_0x609526){if(_0x609526){return _0x609526[_0x2c85('0x1e')](_0x1dbbe5)[_0x2c85('0x1f')](function(_0x26e819){return _0x26e819;});}return null;};}function handleEntityNotFound(_0x4dea0c,_0x3a5047){return function(_0x242a41){if(!_0x242a41){_0x4dea0c['sendStatus'](0x194);}return _0x242a41;};}function handleError(_0x5328c7,_0x1eb781){_0x1eb781=_0x1eb781||0x1f4;return function(_0x541cdc){logger['error'](_0x541cdc[_0x2c85('0x20')]);if(_0x541cdc[_0x2c85('0x21')]){delete _0x541cdc[_0x2c85('0x21')];}_0x5328c7[_0x2c85('0x17')](_0x1eb781)['send'](_0x541cdc);};}exports[_0x2c85('0x22')]=function(_0x4a73fd,_0x1cd70a){var _0x20394b={},_0x139a6e={},_0x264657={'count':0x0,'rows':[]};var _0x3a1232=_[_0x2c85('0x23')](db['Team'][_0x2c85('0x24')],function(_0x1fa20e){return{'name':_0x1fa20e['fieldName'],'type':_0x1fa20e[_0x2c85('0x25')][_0x2c85('0x26')]};});_0x139a6e['model']=_[_0x2c85('0x23')](_0x3a1232,_0x2c85('0x21'));_0x139a6e[_0x2c85('0x27')]=_[_0x2c85('0x28')](_0x4a73fd[_0x2c85('0x27')]);_0x139a6e[_0x2c85('0x29')]=_[_0x2c85('0x2a')](_0x139a6e['model'],_0x139a6e[_0x2c85('0x27')]);_0x20394b[_0x2c85('0x2b')]=_[_0x2c85('0x2a')](_0x139a6e['model'],qs[_0x2c85('0x2c')](_0x4a73fd[_0x2c85('0x27')][_0x2c85('0x2c')]));_0x20394b[_0x2c85('0x2b')]=_0x20394b[_0x2c85('0x2b')][_0x2c85('0x2d')]?_0x20394b[_0x2c85('0x2b')]:_0x139a6e[_0x2c85('0x2e')];if(!_0x4a73fd['query']['hasOwnProperty']('nolimit')){_0x20394b[_0x2c85('0x1b')]=qs[_0x2c85('0x1b')](_0x4a73fd[_0x2c85('0x27')][_0x2c85('0x1b')]);_0x20394b['offset']=qs[_0x2c85('0x19')](_0x4a73fd[_0x2c85('0x27')][_0x2c85('0x19')]);}_0x20394b[_0x2c85('0x2f')]=qs[_0x2c85('0x30')](_0x4a73fd[_0x2c85('0x27')][_0x2c85('0x30')]);_0x20394b[_0x2c85('0x31')]=qs[_0x2c85('0x29')](_[_0x2c85('0x32')](_0x4a73fd[_0x2c85('0x27')],_0x139a6e[_0x2c85('0x29')]),_0x3a1232);if(_0x4a73fd[_0x2c85('0x27')]['filter']){_0x20394b[_0x2c85('0x31')]=_[_0x2c85('0x33')](_0x20394b['where'],{'$or':_['map'](_0x3a1232,function(_0x1c933a){if(_0x1c933a['type']!==_0x2c85('0x34')){var _0x46295e={};_0x46295e[_0x1c933a[_0x2c85('0x21')]]={'$like':'%'+_0x4a73fd[_0x2c85('0x27')][_0x2c85('0x35')]+'%'};return _0x46295e;}})});}_0x20394b=_[_0x2c85('0x33')]({},_0x20394b,_0x4a73fd[_0x2c85('0x36')]);var _0x196312={'where':_0x20394b['where']};return db[_0x2c85('0x37')][_0x2c85('0x1c')](_0x196312)[_0x2c85('0x1f')](function(_0x36f84c){_0x264657[_0x2c85('0x1c')]=_0x36f84c;if(_0x4a73fd[_0x2c85('0x27')][_0x2c85('0x38')]){_0x20394b[_0x2c85('0x39')]=[{'all':!![]}];}return db[_0x2c85('0x37')][_0x2c85('0x3a')](_0x20394b);})[_0x2c85('0x1f')](function(_0x250bcd){_0x264657[_0x2c85('0x3b')]=_0x250bcd;return _0x264657;})[_0x2c85('0x1f')](respondWithFilteredResult(_0x1cd70a,_0x20394b))[_0x2c85('0x3c')](handleError(_0x1cd70a,null));};exports[_0x2c85('0x3d')]=function(_0x3bab0f,_0x304ce5){var _0x4c7394={'raw':![],'where':{'id':_0x3bab0f['params']['id']}},_0x16d53c={};_0x16d53c[_0x2c85('0x2e')]=_[_0x2c85('0x28')](db[_0x2c85('0x37')][_0x2c85('0x24')]);_0x16d53c['query']=_['keys'](_0x3bab0f[_0x2c85('0x27')]);_0x16d53c[_0x2c85('0x29')]=_['intersection'](_0x16d53c[_0x2c85('0x2e')],_0x16d53c['query']);_0x4c7394[_0x2c85('0x2b')]=_['intersection'](_0x16d53c['model'],qs[_0x2c85('0x2c')](_0x3bab0f['query'][_0x2c85('0x2c')]));_0x4c7394[_0x2c85('0x2b')]=_0x4c7394[_0x2c85('0x2b')][_0x2c85('0x2d')]?_0x4c7394[_0x2c85('0x2b')]:_0x16d53c['model'];if(_0x3bab0f['query'][_0x2c85('0x38')]){_0x4c7394[_0x2c85('0x39')]=[{'all':!![]}];}_0x4c7394=_[_0x2c85('0x33')]({},_0x4c7394,_0x3bab0f[_0x2c85('0x36')]);return db['Team'][_0x2c85('0x3e')](_0x4c7394)[_0x2c85('0x1f')](handleEntityNotFound(_0x304ce5,null))['then'](respondWithResult(_0x304ce5,null))[_0x2c85('0x3c')](handleError(_0x304ce5,null));};exports[_0x2c85('0x3f')]=function(_0x310b71,_0x16b2c8){return db[_0x2c85('0x37')][_0x2c85('0x3f')](_0x310b71[_0x2c85('0x40')],{})[_0x2c85('0x1f')](function(_0x5ed85f){var _0x3d01df=_0x310b71[_0x2c85('0x41')][_0x2c85('0x42')]({'plain':!![]});if(!_0x3d01df)throw new Error(_0x2c85('0x43'));if(_0x3d01df[_0x2c85('0x44')]==='user'){var _0x500b36=_0x5ed85f[_0x2c85('0x42')]({'plain':!![]});var _0x4b76f4='Teams';return db[_0x2c85('0x45')][_0x2c85('0x3e')]({'where':{'name':_0x4b76f4,'userProfileId':_0x3d01df[_0x2c85('0x46')]},'raw':!![]})[_0x2c85('0x1f')](function(_0x398422){if(_0x398422&&_0x398422[_0x2c85('0x47')]===0x0){return db[_0x2c85('0x48')][_0x2c85('0x3f')]({'name':_0x500b36['name'],'resourceId':_0x500b36['id'],'type':_0x398422[_0x2c85('0x21')],'sectionId':_0x398422['id']},{})['then'](function(){return _0x5ed85f;});}else{return _0x5ed85f;}})[_0x2c85('0x3c')](function(_0x3fb3f6){logger[_0x2c85('0x49')](_0x2c85('0x4a'),_0x3fb3f6);throw _0x3fb3f6;});}return _0x5ed85f;})[_0x2c85('0x1f')](respondWithResult(_0x16b2c8,0xc9))[_0x2c85('0x3c')](handleError(_0x16b2c8,null));};exports['update']=function(_0x56a6c5,_0xe6aeee){if(_0x56a6c5[_0x2c85('0x40')]['id']){delete _0x56a6c5['body']['id'];}return db[_0x2c85('0x37')][_0x2c85('0x3e')]({'where':{'id':_0x56a6c5[_0x2c85('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe6aeee,null))[_0x2c85('0x1f')](saveUpdates(_0x56a6c5[_0x2c85('0x40')],null))[_0x2c85('0x1f')](respondWithResult(_0xe6aeee,null))['catch'](handleError(_0xe6aeee,null));};exports[_0x2c85('0x4c')]=function(_0x3504ff,_0x2be6ee){var _0x34ecb4=_0x3504ff[_0x2c85('0x4b')]['id'];var _0x37beca=[];return db[_0x2c85('0x4d')][_0x2c85('0x4e')](function(_0x54ea6e){var _0x174151='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x34ecb4;return db[_0x2c85('0x4d')][_0x2c85('0x27')](_0x174151,{'type':db[_0x2c85('0x4f')][_0x2c85('0x50')][_0x2c85('0x51')],'raw':!![],'transaction':_0x54ea6e})['then'](function(_0x156ea3){_0x37beca=_[_0x2c85('0x23')](_0x156ea3,function(_0x13f646){return Number(_0x13f646['UserId']);});})[_0x2c85('0x1f')](function(){var _0x434283=_0x2c85('0x52')+_0x34ecb4;return db['sequelize'][_0x2c85('0x27')](_0x434283,{'type':db['Sequelize'][_0x2c85('0x50')][_0x2c85('0x51')],'raw':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x1980bd){var _0x139eec=_[_0x2c85('0x23')](_0x1980bd,function(_0x52b845){return Number(_0x52b845[_0x2c85('0x53')]);});return db['UserVoiceQueue'][_0x2c85('0x4c')]({'where':{'UserId':{'$in':_0x37beca},'VoiceQueueId':{'$in':_0x139eec}},'transaction':_0x54ea6e});})['then'](function(){var _0x4e07e4=_0x2c85('0x54')+_0x34ecb4;return db[_0x2c85('0x4d')][_0x2c85('0x27')](_0x4e07e4,{'type':db[_0x2c85('0x4f')][_0x2c85('0x50')]['SELECT'],'raw':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x3639d7){var _0x39d419=_[_0x2c85('0x23')](_0x3639d7,function(_0xcd26){return Number(_0xcd26[_0x2c85('0x55')]);});return db[_0x2c85('0x56')][_0x2c85('0x4c')]({'where':{'UserId':{'$in':_0x37beca},'MailQueueId':{'$in':_0x39d419}},'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(){var _0x23e168=_0x2c85('0x57')+_0x34ecb4;return db['sequelize'][_0x2c85('0x27')](_0x23e168,{'type':db[_0x2c85('0x4f')][_0x2c85('0x50')][_0x2c85('0x51')],'raw':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x130646){var _0x542c73=_[_0x2c85('0x23')](_0x130646,function(_0x126e2a){return Number(_0x126e2a[_0x2c85('0x58')]);});return db[_0x2c85('0x59')][_0x2c85('0x4c')]({'where':{'UserId':{'$in':_0x37beca},'SmsQueueId':{'$in':_0x542c73}},'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(){var _0x4833fa=_0x2c85('0x5a')+_0x34ecb4;return db['sequelize'][_0x2c85('0x27')](_0x4833fa,{'type':db[_0x2c85('0x4f')]['QueryTypes'][_0x2c85('0x51')],'raw':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x36f1ba){var _0x5ea178=_[_0x2c85('0x23')](_0x36f1ba,function(_0x1ce5c7){return Number(_0x1ce5c7[_0x2c85('0x5b')]);});return db['UserChatQueue'][_0x2c85('0x4c')]({'where':{'UserId':{'$in':_0x37beca},'ChatQueueId':{'$in':_0x5ea178}},'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(){var _0x508fde='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x34ecb4;return db['sequelize']['query'](_0x508fde,{'type':db['Sequelize'][_0x2c85('0x50')][_0x2c85('0x51')],'raw':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x496456){var _0x2d02ae=_[_0x2c85('0x23')](_0x496456,function(_0x260062){return Number(_0x260062['FaxQueueId']);});return db[_0x2c85('0x5c')][_0x2c85('0x4c')]({'where':{'UserId':{'$in':_0x37beca},'FaxQueueId':{'$in':_0x2d02ae}},'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(){var _0x1cbbd9=_0x2c85('0x5d')+_0x34ecb4;return db[_0x2c85('0x4d')][_0x2c85('0x27')](_0x1cbbd9,{'type':db[_0x2c85('0x4f')][_0x2c85('0x50')][_0x2c85('0x51')],'raw':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x1ece59){var _0x5a6bfa=_[_0x2c85('0x23')](_0x1ece59,function(_0x3d82ce){return Number(_0x3d82ce[_0x2c85('0x5e')]);});return db['UserOpenchannelQueue'][_0x2c85('0x4c')]({'where':{'UserId':{'$in':_0x37beca},'OpenchannelQueueId':{'$in':_0x5a6bfa}},'transaction':_0x54ea6e});})['then'](function(){var _0x2c93d9=_0x2c85('0x5f')+_0x34ecb4;return db[_0x2c85('0x4d')][_0x2c85('0x27')](_0x2c93d9,{'type':db[_0x2c85('0x4f')][_0x2c85('0x50')]['SELECT'],'raw':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x4aed87){var _0x5131a9=_['map'](_0x4aed87,function(_0x2157cf){return Number(_0x2157cf[_0x2c85('0x60')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x37beca},'WhatsappQueueId':{'$in':_0x5131a9}},'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x34ecb4}});})[_0x2c85('0x1f')](function(_0x51c992){if(_0x51c992===null){return;}return db['UserVoicePrefix'][_0x2c85('0x4c')]({'where':{'UserId':{'$in':_0x37beca},'VoicePrefixId':_0x51c992['VoicePrefixId']},'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(){return db[_0x2c85('0x37')][_0x2c85('0x4c')]({'where':{'id':_0x34ecb4},'cascade':!![],'transaction':_0x54ea6e});})[_0x2c85('0x1f')](function(_0x2beaff){if(_0x2beaff===0x0){_0x2be6ee[_0x2c85('0x16')](0x194);}else{return db[_0x2c85('0x48')]['destroy']({'where':{'type':_0x2c85('0x61'),'resourceId':_0x34ecb4},'cascade':!![],'transaction':_0x54ea6e})['then'](function(){_0x2be6ee[_0x2c85('0x17')](0xcc)[_0x2c85('0x62')]();});}})[_0x2c85('0x3c')](function(_0x10b8d2){_0x2be6ee[_0x2c85('0x17')](0x1f4)[_0x2c85('0x63')](_0x10b8d2);});});};exports[_0x2c85('0x64')]=function(_0x43b7d2,_0x180ab9,_0x8cf4f4){return db[_0x2c85('0x37')][_0x2c85('0x65')]({'where':{'id':_0x43b7d2[_0x2c85('0x4b')]['id']}})['then'](handleEntityNotFound(_0x180ab9,null))[_0x2c85('0x1f')](function(_0x2743bc){if(!_0x43b7d2[_0x2c85('0x27')][_0x2c85('0x66')]||!utils['isValidChannel'](_0x43b7d2['query']['channel'])){throw new db[(_0x2c85('0x4f'))]['ValidationError'](_0x2c85('0x67'));}var _0x525992={};var _0x4be579={};_0x4be579[_0x2c85('0x2e')]=_[_0x2c85('0x28')](db[_[_0x2c85('0x68')](_0x43b7d2[_0x2c85('0x27')][_0x2c85('0x66')][_0x2c85('0x69')]())+_0x2c85('0x6a')][_0x2c85('0x24')]);_0x4be579[_0x2c85('0x27')]=_[_0x2c85('0x28')](_0x43b7d2[_0x2c85('0x27')]);_0x4be579[_0x2c85('0x29')]=_['intersection'](_0x4be579['model'],_0x4be579[_0x2c85('0x27')]);_0x525992[_0x2c85('0x2b')]=_['intersection'](_0x4be579['model'],qs[_0x2c85('0x2c')](_0x43b7d2['query'][_0x2c85('0x2c')]));_0x525992[_0x2c85('0x2b')]=_0x525992[_0x2c85('0x2b')][_0x2c85('0x2d')]?_0x525992[_0x2c85('0x2b')]:_0x4be579[_0x2c85('0x2e')];_0x525992['limit']=qs[_0x2c85('0x1b')](_0x43b7d2[_0x2c85('0x27')][_0x2c85('0x1b')]);_0x525992[_0x2c85('0x19')]=qs[_0x2c85('0x19')](_0x43b7d2[_0x2c85('0x27')][_0x2c85('0x19')]);_0x525992['order']=qs[_0x2c85('0x30')](_0x43b7d2[_0x2c85('0x27')][_0x2c85('0x30')]);_0x525992[_0x2c85('0x31')]=qs['filters'](_[_0x2c85('0x32')](_0x43b7d2[_0x2c85('0x27')],_0x4be579[_0x2c85('0x29')]));_0x525992=_[_0x2c85('0x33')]({},_0x525992,_0x43b7d2[_0x2c85('0x36')]);return _0x2743bc[_0x2c85('0x42')+_['capitalize'](_0x43b7d2[_0x2c85('0x27')][_0x2c85('0x66')][_0x2c85('0x69')]())+_0x2c85('0x6b')](_0x525992);})[_0x2c85('0x1f')](respondWithResult(_0x180ab9,null))['catch'](handleError(_0x180ab9,null));};exports[_0x2c85('0x6c')]=function(_0x17156e,_0x2e209b,_0x2dc1e7){return db['Team'][_0x2c85('0x65')]({'where':{'id':_0x17156e[_0x2c85('0x4b')]['id']}})[_0x2c85('0x1f')](function(_0x371606){if(_0x371606){if(!_0x17156e[_0x2c85('0x40')][_0x2c85('0x66')]||!utils[_0x2c85('0x6d')](_0x17156e[_0x2c85('0x40')][_0x2c85('0x66')])){throw new db['Sequelize'][(_0x2c85('0x6e'))](_0x2c85('0x67'));}return _0x371606['add'+_[_0x2c85('0x68')](_0x17156e[_0x2c85('0x40')][_0x2c85('0x66')]['toLowerCase']())+_0x2c85('0x6b')](_0x17156e[_0x2c85('0x40')][_0x2c85('0x6f')]);}return null;})['then'](handleEntityNotFound(_0x2e209b,null))['then'](respondWithStatusCode(_0x2e209b,null))['catch'](handleError(_0x2e209b,null));};exports[_0x2c85('0x70')]=function(_0x312f3e,_0x5bab48,_0x5ef308){return db['Team'][_0x2c85('0x65')]({'where':{'id':_0x312f3e[_0x2c85('0x4b')]['id']}})['then'](function(_0x1214a3){if(_0x1214a3){if(!_0x312f3e[_0x2c85('0x27')][_0x2c85('0x66')]||!utils[_0x2c85('0x6d')](_0x312f3e[_0x2c85('0x27')][_0x2c85('0x66')])){throw new db[(_0x2c85('0x4f'))][(_0x2c85('0x6e'))](_0x2c85('0x67'));}return _0x1214a3[_0x2c85('0x71')+_[_0x2c85('0x68')](_0x312f3e['query'][_0x2c85('0x66')][_0x2c85('0x69')]())+_0x2c85('0x6b')](_0x312f3e[_0x2c85('0x27')][_0x2c85('0x6f')]);}return null;})['then'](handleEntityNotFound(_0x5bab48,null))[_0x2c85('0x1f')](respondWithStatusCode(_0x5bab48,null))[_0x2c85('0x3c')](handleError(_0x5bab48,null));};exports['addAgents']=function(_0x328dd2,_0x1d4045){var _0x32fe04=_[_0x2c85('0x72')](_0x328dd2[_0x2c85('0x40')]['ids'])?_0x328dd2[_0x2c85('0x40')]['ids']:[_0x328dd2['body'][_0x2c85('0x6f')]];var _0x4307dd=_0x328dd2[_0x2c85('0x4b')]['id'];return db['Team'][_0x2c85('0x3e')]({'where':{'id':_0x4307dd}})['then'](handleEntityNotFound(_0x1d4045,null))[_0x2c85('0x1f')](function(_0x2e8e11){if(_0x2e8e11){var _0x814686=[_0x2c85('0x73'),_0x2c85('0x74'),_0x2c85('0x75'),'Sms',_0x2c85('0x76'),_0x2c85('0x77'),_0x2c85('0x78')];return db[_0x2c85('0x4d')][_0x2c85('0x4e')](function(_0x19fc0d){var _0x2c15f4=_[_0x2c85('0x23')](_0x814686,function(_0x28cdea){var _0x406469={'attributes':['id',_0x2c85('0x21')]};if(_0x28cdea===_0x2c85('0x73')){_0x406469[_0x2c85('0x79')]={'attributes':[_0x2c85('0x7a')]};}return _0x2e8e11['get'+_0x28cdea+_0x2c85('0x6b')](_0x406469)[_0x2c85('0x1f')](function(_0x3c260d){var _0x275050=_[_0x2c85('0x23')](_0x3c260d,function(_0x11ade6){var _0x5226c5=_[_0x2c85('0x23')](_0x32fe04,function(_0xe371ce){var _0xaa1faf={'where':{'UserId':_0xe371ce,[_0x28cdea+_0x2c85('0x7b')]:_0x11ade6['id']},'transaction':_0x19fc0d};if(_0x28cdea===_0x2c85('0x73')){_0xaa1faf[_0x2c85('0x7c')]={'penalty':_0x11ade6[_0x2c85('0x7d')]['penalty']};}return db['User'+_0x28cdea+'Queue'][_0x2c85('0x7e')](_0xaa1faf)['then'](function(){socket[_0x2c85('0x7f')](_0x2c85('0x41')+_0x28cdea+'Queue:save',{'UserId':_0xe371ce,[_0x28cdea+_0x2c85('0x7b')]:_0x11ade6['id']});if(_0x28cdea!=='Voice'){return;}return db[_0x2c85('0x80')][_0x2c85('0x3a')]({'where':{'id':_0x32fe04,'online':0x1},'attributes':['id',_0x2c85('0x21'),_0x2c85('0x81'),_0x2c85('0x82'),_0x2c85('0x83')],'raw':!![]})['then'](function(_0x1a2c89){var _0x4c906b=_[_0x2c85('0x23')](_0x1a2c89,function(_0x135bf1){return db[_0x2c85('0x84')][_0x2c85('0x85')]({'membername':_0x135bf1['name'],'UserId':_0x135bf1['id'],'queue_name':_0x11ade6['name'],'VoiceQueueId':_0x11ade6['id'],'interface':_[_0x2c85('0x86')](_0x135bf1[_0x2c85('0x83')])?util['format']('SIP/%s',_0x135bf1['name']):_0x135bf1['interface'],'paused':_0x135bf1[_0x2c85('0x82')]||![],'penalty':_0x11ade6[_0x2c85('0x7d')][_0x2c85('0x7a')]},{'transaction':_0x19fc0d});});return Promise['all'](_0x4c906b);});});});return Promise[_0x2c85('0x87')](_0x5226c5);});return Promise[_0x2c85('0x87')](_0x275050);})[_0x2c85('0x1f')](function(){return db[_0x2c85('0x88')][_0x2c85('0x65')]({'where':{'teamId':_0x4307dd}})['then'](function(_0xdd19ba){if(_0xdd19ba){var _0x17bd1b=_['map'](_0x32fe04,function(_0x435e6c){db[_0x2c85('0x89')][_0x2c85('0x85')]({'UserId':_0x435e6c,'VoicePrefixId':_0xdd19ba[_0x2c85('0x8a')]});});return Promise[_0x2c85('0x87')](_0x17bd1b);}});});});return Promise['all'](_0x2c15f4)['then'](function(){return _0x2e8e11[_0x2c85('0x8b')](_0x32fe04,{'transaction':_0x19fc0d})[_0x2c85('0x8c')](function(_0x2a2fbd){return _0x2a2fbd;});});});}})[_0x2c85('0x1f')](respondWithResult(_0x1d4045,null))['catch'](handleError(_0x1d4045,null));};exports[_0x2c85('0x8d')]=function(_0x43cd9d,_0x2fecee){var _0x3baf0b=_[_0x2c85('0x72')](_0x43cd9d[_0x2c85('0x27')][_0x2c85('0x6f')])?_0x43cd9d[_0x2c85('0x27')][_0x2c85('0x6f')]:[_0x43cd9d[_0x2c85('0x27')][_0x2c85('0x6f')]];var _0x2dfda8=_0x43cd9d[_0x2c85('0x4b')]['id'];return db[_0x2c85('0x37')]['find']({'where':{'id':_0x2dfda8}})['then'](handleEntityNotFound(_0x2fecee,null))[_0x2c85('0x1f')](function(_0x5dbb67){if(_0x5dbb67){var _0x1f1fe3=['Voice',_0x2c85('0x74'),_0x2c85('0x75'),_0x2c85('0x8e'),_0x2c85('0x76'),_0x2c85('0x77'),_0x2c85('0x78')];return db[_0x2c85('0x4d')][_0x2c85('0x4e')](function(_0x378fbb){var _0x163cec=_[_0x2c85('0x23')](_0x1f1fe3,function(_0x2dea34){var _0xc2ba9={'attributes':['id',_0x2c85('0x21')]};return _0x5dbb67[_0x2c85('0x42')+_0x2dea34+_0x2c85('0x6b')](_0xc2ba9)['then'](function(_0x4906bd){var _0x2b8a42=_['map'](_0x4906bd,function(_0xb54a3e){return _0xb54a3e[_0x2c85('0x8d')](_0x3baf0b,{'transaction':_0x378fbb})[_0x2c85('0x1f')](function(){var _0x7b6719=_[_0x2c85('0x23')](_0x3baf0b,function(_0x124f62){socket[_0x2c85('0x7f')]('user'+_0x2dea34+'Queue:remove',{'UserId':Number(_0x124f62),[_0x2dea34+_0x2c85('0x7b')]:_0xb54a3e['id']});if(_0x2dea34!==_0x2c85('0x73')){return;}return db[_0x2c85('0x84')][_0x2c85('0x4c')]({'where':{'VoiceQueueId':_0xb54a3e['id'],'UserId':_0x124f62},'transaction':_0x378fbb});});return Promise[_0x2c85('0x87')](_0x7b6719);});});return Promise[_0x2c85('0x87')](_0x2b8a42);});});return Promise[_0x2c85('0x87')](_0x163cec)[_0x2c85('0x1f')](function(){return _0x5dbb67[_0x2c85('0x8d')](_0x3baf0b,{'transaction':_0x378fbb});})[_0x2c85('0x1f')](function(){return db[_0x2c85('0x88')][_0x2c85('0x65')]({'where':{'teamId':_0x2dfda8}})[_0x2c85('0x1f')](function(_0x1ed893){if(_0x1ed893){var _0x2243bd=_[_0x2c85('0x23')](_0x3baf0b,function(_0x34c85d){db[_0x2c85('0x89')][_0x2c85('0x4c')]({'where':{'UserId':_0x34c85d,'VoicePrefixId':_0x1ed893['VoicePrefixId']}});});return Promise[_0x2c85('0x87')](_0x2243bd);}});});});}})[_0x2c85('0x1f')](respondWithStatusCode(_0x2fecee,null))[_0x2c85('0x3c')](handleError(_0x2fecee,null));};exports[_0x2c85('0x8f')]=function(_0x8426c5,_0x2c5aa8,_0x3e37f3){var _0x2b8833={};var _0x5b5615={};var _0x29387b;var _0x51b0d0;return db[_0x2c85('0x37')][_0x2c85('0x65')]({'where':{'id':_0x8426c5[_0x2c85('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2c5aa8,null))[_0x2c85('0x1f')](function(_0x1d9e1f){if(_0x1d9e1f){_0x29387b=_0x1d9e1f;_0x5b5615[_0x2c85('0x2e')]=_['keys'](db[_0x2c85('0x80')][_0x2c85('0x24')]);_0x5b5615[_0x2c85('0x27')]=_[_0x2c85('0x28')](_0x8426c5[_0x2c85('0x27')]);_0x5b5615[_0x2c85('0x29')]=_[_0x2c85('0x2a')](_0x5b5615[_0x2c85('0x2e')],_0x5b5615[_0x2c85('0x27')]);_0x2b8833[_0x2c85('0x2b')]=_[_0x2c85('0x2a')](_0x5b5615[_0x2c85('0x2e')],qs['fields'](_0x8426c5[_0x2c85('0x27')][_0x2c85('0x2c')]));_0x2b8833[_0x2c85('0x2b')]=_0x2b8833[_0x2c85('0x2b')][_0x2c85('0x2d')]?_0x2b8833[_0x2c85('0x2b')]:_0x5b5615['model'];_0x2b8833[_0x2c85('0x2f')]=qs[_0x2c85('0x30')](_0x8426c5[_0x2c85('0x27')][_0x2c85('0x30')]);_0x2b8833[_0x2c85('0x31')]=qs[_0x2c85('0x29')](_[_0x2c85('0x32')](_0x8426c5[_0x2c85('0x27')],_0x5b5615[_0x2c85('0x29')]));if(_0x8426c5['query']['filter']){_0x2b8833[_0x2c85('0x31')]=_[_0x2c85('0x33')](_0x2b8833['where'],{'$or':_[_0x2c85('0x23')](_0x2b8833[_0x2c85('0x2b')],function(_0x500bfc){var _0x8123d4={};_0x8123d4[_0x500bfc]={'$like':'%'+_0x8426c5['query'][_0x2c85('0x35')]+'%'};return _0x8123d4;})});}_0x2b8833=_[_0x2c85('0x33')]({},_0x2b8833,_0x8426c5[_0x2c85('0x36')]);return _0x29387b['getAgents'](_0x2b8833);}})[_0x2c85('0x1f')](function(_0x5e8b65){if(_0x5e8b65){_0x51b0d0=_0x5e8b65['length'];if(!_0x8426c5[_0x2c85('0x27')][_0x2c85('0x90')](_0x2c85('0x91'))){_0x2b8833[_0x2c85('0x1b')]=qs[_0x2c85('0x1b')](_0x8426c5[_0x2c85('0x27')][_0x2c85('0x1b')]);_0x2b8833['offset']=qs['offset'](_0x8426c5[_0x2c85('0x27')]['offset']);}return _0x29387b[_0x2c85('0x8f')](_0x2b8833);}})[_0x2c85('0x1f')](function(_0x184b7d){if(_0x184b7d){return _0x184b7d?{'count':_0x51b0d0,'rows':_0x184b7d}:null;}})[_0x2c85('0x1f')](respondWithResult(_0x2c5aa8,null))[_0x2c85('0x3c')](handleError(_0x2c5aa8,null));}; \ No newline at end of file +var _0x7393=['defaults','localhost','socket.io-emitter','./team.socket','register','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','sendStatus','error','stack','name','send','map','Team','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','count','includeAll','include','show','params','rawAttributes','fields','length','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','end','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','ValidationError','add','Queues','ids','remove','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','User','findAll','online','interface','upsert','isNil','format','SIP/%s','voicePause','TeamVoiceQueue','all','addAgents','spread','emit','Queue:remove','UserVoiceQueueRt','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis'];(function(_0x5ef35e,_0x329db7){var _0x4cdc0c=function(_0x20bda0){while(--_0x20bda0){_0x5ef35e['push'](_0x5ef35e['shift']());}};_0x4cdc0c(++_0x329db7);}(_0x7393,0x88));var _0x3739=function(_0x375cc6,_0x3433a0){_0x375cc6=_0x375cc6-0x0;var _0x16083e=_0x7393[_0x375cc6];return _0x16083e;};'use strict';var emlformat=require(_0x3739('0x0'));var rimraf=require(_0x3739('0x1'));var zipdir=require(_0x3739('0x2'));var jsonpatch=require(_0x3739('0x3'));var rp=require(_0x3739('0x4'));var moment=require(_0x3739('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3739('0x6'));var util=require(_0x3739('0x7'));var path=require(_0x3739('0x8'));var sox=require('sox');var csv=require(_0x3739('0x9'));var ejs=require(_0x3739('0xa'));var fs=require('fs');var fs_extra=require(_0x3739('0xb'));var _=require(_0x3739('0xc'));var squel=require(_0x3739('0xd'));var crypto=require(_0x3739('0xe'));var jsforce=require(_0x3739('0xf'));var deskjs=require(_0x3739('0x10'));var toCsv=require(_0x3739('0x9'));var querystring=require(_0x3739('0x11'));var Papa=require(_0x3739('0x12'));var Redis=require(_0x3739('0x13'));var authService=require(_0x3739('0x14'));var qs=require(_0x3739('0x15'));var as=require(_0x3739('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3739('0x17'))(_0x3739('0x18'));var utils=require(_0x3739('0x19'));var config=require(_0x3739('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3739('0x1b')]=_[_0x3739('0x1c')](config[_0x3739('0x1b')],{'host':_0x3739('0x1d'),'port':0x18eb});var socket=require(_0x3739('0x1e'))(new Redis(config[_0x3739('0x1b')]));require(_0x3739('0x1f'))[_0x3739('0x20')](socket);function respondWithStatusCode(_0x44b7bb,_0x13b3a4){_0x13b3a4=_0x13b3a4||0xcc;return function(_0x2ca01d){if(_0x2ca01d){return _0x44b7bb['sendStatus'](_0x13b3a4);}return _0x44b7bb[_0x3739('0x21')](_0x13b3a4)['end']();};}function respondWithResult(_0x164887,_0x51448e){_0x51448e=_0x51448e||0xc8;return function(_0xd4c469){if(_0xd4c469){return _0x164887[_0x3739('0x21')](_0x51448e)[_0x3739('0x22')](_0xd4c469);}};}function respondWithFilteredResult(_0x8e657c,_0x27afab){return function(_0x22c6a3){if(_0x22c6a3){var _0x39d3b7=typeof _0x27afab[_0x3739('0x23')]===_0x3739('0x24')&&typeof _0x27afab['limit']===_0x3739('0x24');var _0x2a3f55=_0x22c6a3['count'];var _0x2a778a=_0x39d3b7?0x0:_0x27afab['offset'];var _0x2e23ea=_0x39d3b7?_0x22c6a3['count']:_0x27afab['offset']+_0x27afab[_0x3739('0x25')];var _0x47f59e;if(_0x2e23ea>=_0x2a3f55){_0x2e23ea=_0x2a3f55;_0x47f59e=0xc8;}else{_0x47f59e=0xce;}_0x8e657c['status'](_0x47f59e);return _0x8e657c[_0x3739('0x26')](_0x3739('0x27'),_0x2a778a+'-'+_0x2e23ea+'/'+_0x2a3f55)[_0x3739('0x22')](_0x22c6a3);}return null;};}function patchUpdates(_0x5e3cd2){return function(_0x254b60){try{jsonpatch['apply'](_0x254b60,_0x5e3cd2,!![]);}catch(_0x1d5338){return BPromise[_0x3739('0x28')](_0x1d5338);}return _0x254b60[_0x3739('0x29')]();};}function saveUpdates(_0x990e15,_0x17f6a4){return function(_0x259a45){if(_0x259a45){return _0x259a45[_0x3739('0x2a')](_0x990e15)['then'](function(_0x3e4fcc){return _0x3e4fcc;});}return null;};}function handleEntityNotFound(_0x2b2ede,_0x4a5b32){return function(_0x5e62dd){if(!_0x5e62dd){_0x2b2ede[_0x3739('0x2b')](0x194);}return _0x5e62dd;};}function handleError(_0x196c77,_0x542425){_0x542425=_0x542425||0x1f4;return function(_0x2a5bdd){logger[_0x3739('0x2c')](_0x2a5bdd[_0x3739('0x2d')]);if(_0x2a5bdd[_0x3739('0x2e')]){delete _0x2a5bdd[_0x3739('0x2e')];}_0x196c77[_0x3739('0x21')](_0x542425)[_0x3739('0x2f')](_0x2a5bdd);};}exports['index']=function(_0x5b2c3a,_0x2a2816){var _0x406cec={},_0x2877d1={},_0x3076c8={'count':0x0,'rows':[]};var _0x58ff79=_[_0x3739('0x30')](db[_0x3739('0x31')]['rawAttributes'],function(_0x3a1efe){return{'name':_0x3a1efe[_0x3739('0x32')],'type':_0x3a1efe['type'][_0x3739('0x33')]};});_0x2877d1[_0x3739('0x34')]=_['map'](_0x58ff79,'name');_0x2877d1[_0x3739('0x35')]=_[_0x3739('0x36')](_0x5b2c3a[_0x3739('0x35')]);_0x2877d1[_0x3739('0x37')]=_[_0x3739('0x38')](_0x2877d1[_0x3739('0x34')],_0x2877d1[_0x3739('0x35')]);_0x406cec[_0x3739('0x39')]=_[_0x3739('0x38')](_0x2877d1[_0x3739('0x34')],qs['fields'](_0x5b2c3a['query']['fields']));_0x406cec[_0x3739('0x39')]=_0x406cec[_0x3739('0x39')]['length']?_0x406cec[_0x3739('0x39')]:_0x2877d1['model'];if(!_0x5b2c3a['query'][_0x3739('0x3a')]('nolimit')){_0x406cec[_0x3739('0x25')]=qs[_0x3739('0x25')](_0x5b2c3a['query'][_0x3739('0x25')]);_0x406cec[_0x3739('0x23')]=qs['offset'](_0x5b2c3a[_0x3739('0x35')]['offset']);}_0x406cec[_0x3739('0x3b')]=qs[_0x3739('0x3c')](_0x5b2c3a[_0x3739('0x35')][_0x3739('0x3c')]);_0x406cec[_0x3739('0x3d')]=qs[_0x3739('0x37')](_[_0x3739('0x3e')](_0x5b2c3a[_0x3739('0x35')],_0x2877d1['filters']),_0x58ff79);if(_0x5b2c3a[_0x3739('0x35')][_0x3739('0x3f')]){_0x406cec['where']=_[_0x3739('0x40')](_0x406cec['where'],{'$or':_['map'](_0x58ff79,function(_0x223c58){if(_0x223c58[_0x3739('0x41')]!==_0x3739('0x42')){var _0xcc1a59={};_0xcc1a59[_0x223c58[_0x3739('0x2e')]]={'$like':'%'+_0x5b2c3a[_0x3739('0x35')][_0x3739('0x3f')]+'%'};return _0xcc1a59;}})});}_0x406cec=_[_0x3739('0x40')]({},_0x406cec,_0x5b2c3a[_0x3739('0x43')]);var _0x369be2={'where':_0x406cec['where']};return db[_0x3739('0x31')]['count'](_0x369be2)[_0x3739('0x44')](function(_0x5b61fe){_0x3076c8[_0x3739('0x45')]=_0x5b61fe;if(_0x5b2c3a[_0x3739('0x35')][_0x3739('0x46')]){_0x406cec[_0x3739('0x47')]=[{'all':!![]}];}return db[_0x3739('0x31')]['findAll'](_0x406cec);})['then'](function(_0x52faec){_0x3076c8['rows']=_0x52faec;return _0x3076c8;})[_0x3739('0x44')](respondWithFilteredResult(_0x2a2816,_0x406cec))['catch'](handleError(_0x2a2816,null));};exports[_0x3739('0x48')]=function(_0x2e6deb,_0x532adf){var _0x35eabe={'raw':![],'where':{'id':_0x2e6deb[_0x3739('0x49')]['id']}},_0x4169fd={};_0x4169fd[_0x3739('0x34')]=_[_0x3739('0x36')](db[_0x3739('0x31')][_0x3739('0x4a')]);_0x4169fd[_0x3739('0x35')]=_[_0x3739('0x36')](_0x2e6deb['query']);_0x4169fd[_0x3739('0x37')]=_[_0x3739('0x38')](_0x4169fd['model'],_0x4169fd[_0x3739('0x35')]);_0x35eabe[_0x3739('0x39')]=_[_0x3739('0x38')](_0x4169fd[_0x3739('0x34')],qs['fields'](_0x2e6deb[_0x3739('0x35')][_0x3739('0x4b')]));_0x35eabe[_0x3739('0x39')]=_0x35eabe['attributes'][_0x3739('0x4c')]?_0x35eabe[_0x3739('0x39')]:_0x4169fd[_0x3739('0x34')];if(_0x2e6deb[_0x3739('0x35')][_0x3739('0x46')]){_0x35eabe['include']=[{'all':!![]}];}_0x35eabe=_[_0x3739('0x40')]({},_0x35eabe,_0x2e6deb[_0x3739('0x43')]);return db[_0x3739('0x31')]['find'](_0x35eabe)['then'](handleEntityNotFound(_0x532adf,null))['then'](respondWithResult(_0x532adf,null))[_0x3739('0x4d')](handleError(_0x532adf,null));};exports['create']=function(_0x1f0b38,_0x172efb){return db[_0x3739('0x31')][_0x3739('0x4e')](_0x1f0b38[_0x3739('0x4f')],{})[_0x3739('0x44')](function(_0x5a971d){var _0x245a26=_0x1f0b38['user'][_0x3739('0x50')]({'plain':!![]});if(!_0x245a26)throw new Error(_0x3739('0x51'));if(_0x245a26[_0x3739('0x52')]===_0x3739('0x53')){var _0x9b75c2=_0x5a971d['get']({'plain':!![]});var _0x5cc534=_0x3739('0x54');return db[_0x3739('0x55')][_0x3739('0x56')]({'where':{'name':_0x5cc534,'userProfileId':_0x245a26[_0x3739('0x57')]},'raw':!![]})['then'](function(_0x27db0a){if(_0x27db0a&&_0x27db0a[_0x3739('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x9b75c2[_0x3739('0x2e')],'resourceId':_0x9b75c2['id'],'type':_0x27db0a[_0x3739('0x2e')],'sectionId':_0x27db0a['id']},{})[_0x3739('0x44')](function(){return _0x5a971d;});}else{return _0x5a971d;}})['catch'](function(_0x169fe8){logger[_0x3739('0x2c')](_0x3739('0x59'),_0x169fe8);throw _0x169fe8;});}return _0x5a971d;})['then'](respondWithResult(_0x172efb,0xc9))[_0x3739('0x4d')](handleError(_0x172efb,null));};exports[_0x3739('0x2a')]=function(_0x29f00c,_0xa70618){if(_0x29f00c[_0x3739('0x4f')]['id']){delete _0x29f00c['body']['id'];}return db[_0x3739('0x31')]['find']({'where':{'id':_0x29f00c[_0x3739('0x49')]['id']}})[_0x3739('0x44')](handleEntityNotFound(_0xa70618,null))[_0x3739('0x44')](saveUpdates(_0x29f00c['body'],null))['then'](respondWithResult(_0xa70618,null))[_0x3739('0x4d')](handleError(_0xa70618,null));};exports[_0x3739('0x5a')]=function(_0x49f830,_0x1964ca){var _0x3eff86=_0x49f830[_0x3739('0x49')]['id'];var _0x457892=[];return db[_0x3739('0x5b')][_0x3739('0x5c')](function(_0x557b5b){var _0x548b50=_0x3739('0x5d')+_0x3eff86;return db['sequelize']['query'](_0x548b50,{'type':db[_0x3739('0x5e')][_0x3739('0x5f')]['SELECT'],'raw':!![],'transaction':_0x557b5b})[_0x3739('0x44')](function(_0x3ccdd9){_0x457892=_['map'](_0x3ccdd9,function(_0x42bf17){return Number(_0x42bf17[_0x3739('0x60')]);});})[_0x3739('0x44')](function(){var _0x15d5ea=_0x3739('0x61')+_0x3eff86;return db[_0x3739('0x5b')][_0x3739('0x35')](_0x15d5ea,{'type':db[_0x3739('0x5e')][_0x3739('0x5f')][_0x3739('0x62')],'raw':!![],'transaction':_0x557b5b});})[_0x3739('0x44')](function(_0x4dde33){var _0x31fc9f=_[_0x3739('0x30')](_0x4dde33,function(_0x928523){return Number(_0x928523['VoiceQueueId']);});return db[_0x3739('0x63')][_0x3739('0x5a')]({'where':{'UserId':{'$in':_0x457892},'VoiceQueueId':{'$in':_0x31fc9f}},'transaction':_0x557b5b});})[_0x3739('0x44')](function(){var _0x4e237a=_0x3739('0x64')+_0x3eff86;return db['sequelize'][_0x3739('0x35')](_0x4e237a,{'type':db[_0x3739('0x5e')]['QueryTypes'][_0x3739('0x62')],'raw':!![],'transaction':_0x557b5b});})[_0x3739('0x44')](function(_0x3c2827){var _0x1dc48d=_[_0x3739('0x30')](_0x3c2827,function(_0x2a4569){return Number(_0x2a4569[_0x3739('0x65')]);});return db[_0x3739('0x66')]['destroy']({'where':{'UserId':{'$in':_0x457892},'MailQueueId':{'$in':_0x1dc48d}},'transaction':_0x557b5b});})[_0x3739('0x44')](function(){var _0x3b8f5b=_0x3739('0x67')+_0x3eff86;return db[_0x3739('0x5b')][_0x3739('0x35')](_0x3b8f5b,{'type':db[_0x3739('0x5e')]['QueryTypes'][_0x3739('0x62')],'raw':!![],'transaction':_0x557b5b});})[_0x3739('0x44')](function(_0x16481f){var _0x56a37f=_[_0x3739('0x30')](_0x16481f,function(_0x3471d7){return Number(_0x3471d7[_0x3739('0x68')]);});return db[_0x3739('0x69')]['destroy']({'where':{'UserId':{'$in':_0x457892},'SmsQueueId':{'$in':_0x56a37f}},'transaction':_0x557b5b});})[_0x3739('0x44')](function(){var _0x917db7=_0x3739('0x6a')+_0x3eff86;return db[_0x3739('0x5b')][_0x3739('0x35')](_0x917db7,{'type':db[_0x3739('0x5e')][_0x3739('0x5f')]['SELECT'],'raw':!![],'transaction':_0x557b5b});})['then'](function(_0x101b83){var _0x4d0dfa=_[_0x3739('0x30')](_0x101b83,function(_0x55bd77){return Number(_0x55bd77[_0x3739('0x6b')]);});return db[_0x3739('0x6c')][_0x3739('0x5a')]({'where':{'UserId':{'$in':_0x457892},'ChatQueueId':{'$in':_0x4d0dfa}},'transaction':_0x557b5b});})['then'](function(){var _0x213dc2=_0x3739('0x6d')+_0x3eff86;return db[_0x3739('0x5b')][_0x3739('0x35')](_0x213dc2,{'type':db[_0x3739('0x5e')][_0x3739('0x5f')][_0x3739('0x62')],'raw':!![],'transaction':_0x557b5b});})['then'](function(_0x55b7e9){var _0x3efc60=_['map'](_0x55b7e9,function(_0x3dc9d1){return Number(_0x3dc9d1[_0x3739('0x6e')]);});return db[_0x3739('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x457892},'FaxQueueId':{'$in':_0x3efc60}},'transaction':_0x557b5b});})['then'](function(){var _0x1ce325=_0x3739('0x70')+_0x3eff86;return db[_0x3739('0x5b')][_0x3739('0x35')](_0x1ce325,{'type':db['Sequelize'][_0x3739('0x5f')][_0x3739('0x62')],'raw':!![],'transaction':_0x557b5b});})[_0x3739('0x44')](function(_0x46fbb0){var _0x15b458=_[_0x3739('0x30')](_0x46fbb0,function(_0x337c18){return Number(_0x337c18[_0x3739('0x71')]);});return db['UserOpenchannelQueue'][_0x3739('0x5a')]({'where':{'UserId':{'$in':_0x457892},'OpenchannelQueueId':{'$in':_0x15b458}},'transaction':_0x557b5b});})[_0x3739('0x44')](function(){var _0x5d7a5e='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3eff86;return db['sequelize'][_0x3739('0x35')](_0x5d7a5e,{'type':db[_0x3739('0x5e')][_0x3739('0x5f')][_0x3739('0x62')],'raw':!![],'transaction':_0x557b5b});})[_0x3739('0x44')](function(_0x433cee){var _0x3b13db=_[_0x3739('0x30')](_0x433cee,function(_0x3259d9){return Number(_0x3259d9[_0x3739('0x72')]);});return db[_0x3739('0x73')][_0x3739('0x5a')]({'where':{'UserId':{'$in':_0x457892},'WhatsappQueueId':{'$in':_0x3b13db}},'transaction':_0x557b5b});})[_0x3739('0x44')](function(){return db[_0x3739('0x74')]['find']({'where':{'TeamId':_0x3eff86}});})[_0x3739('0x44')](function(_0xd62282){if(_0xd62282===null){return;}return db[_0x3739('0x75')][_0x3739('0x5a')]({'where':{'UserId':{'$in':_0x457892},'VoicePrefixId':_0xd62282[_0x3739('0x76')]},'transaction':_0x557b5b});})[_0x3739('0x44')](function(){return db[_0x3739('0x31')]['destroy']({'where':{'id':_0x3eff86},'cascade':!![],'transaction':_0x557b5b});})['then'](function(_0x4bae03){if(_0x4bae03===0x0){_0x1964ca['sendStatus'](0x194);}else{return db[_0x3739('0x77')]['destroy']({'where':{'type':_0x3739('0x54'),'resourceId':_0x3eff86},'cascade':!![],'transaction':_0x557b5b})[_0x3739('0x44')](function(){_0x1964ca[_0x3739('0x21')](0xcc)[_0x3739('0x78')]();});}})[_0x3739('0x4d')](function(_0x398116){_0x1964ca[_0x3739('0x21')](0x1f4)['send'](_0x398116);});});};exports[_0x3739('0x79')]=function(_0x517383,_0x7c671,_0x2536e3){return db[_0x3739('0x31')][_0x3739('0x7a')]({'where':{'id':_0x517383[_0x3739('0x49')]['id']}})[_0x3739('0x44')](handleEntityNotFound(_0x7c671,null))['then'](function(_0x5ac1cb){if(!_0x517383[_0x3739('0x35')][_0x3739('0x7b')]||!utils[_0x3739('0x7c')](_0x517383[_0x3739('0x35')][_0x3739('0x7b')])){throw new db[(_0x3739('0x5e'))]['ValidationError'](_0x3739('0x7d'));}var _0x355b3f={};var _0x336fb4={};_0x336fb4[_0x3739('0x34')]=_[_0x3739('0x36')](db[_[_0x3739('0x7e')](_0x517383[_0x3739('0x35')][_0x3739('0x7b')][_0x3739('0x7f')]())+_0x3739('0x80')][_0x3739('0x4a')]);_0x336fb4[_0x3739('0x35')]=_[_0x3739('0x36')](_0x517383['query']);_0x336fb4[_0x3739('0x37')]=_[_0x3739('0x38')](_0x336fb4['model'],_0x336fb4[_0x3739('0x35')]);_0x355b3f[_0x3739('0x39')]=_['intersection'](_0x336fb4[_0x3739('0x34')],qs[_0x3739('0x4b')](_0x517383['query']['fields']));_0x355b3f[_0x3739('0x39')]=_0x355b3f[_0x3739('0x39')][_0x3739('0x4c')]?_0x355b3f['attributes']:_0x336fb4[_0x3739('0x34')];_0x355b3f[_0x3739('0x25')]=qs['limit'](_0x517383[_0x3739('0x35')][_0x3739('0x25')]);_0x355b3f[_0x3739('0x23')]=qs[_0x3739('0x23')](_0x517383[_0x3739('0x35')][_0x3739('0x23')]);_0x355b3f[_0x3739('0x3b')]=qs[_0x3739('0x3c')](_0x517383[_0x3739('0x35')][_0x3739('0x3c')]);_0x355b3f[_0x3739('0x3d')]=qs[_0x3739('0x37')](_[_0x3739('0x3e')](_0x517383[_0x3739('0x35')],_0x336fb4['filters']));_0x355b3f=_[_0x3739('0x40')]({},_0x355b3f,_0x517383[_0x3739('0x43')]);return _0x5ac1cb[_0x3739('0x50')+_['capitalize'](_0x517383[_0x3739('0x35')][_0x3739('0x7b')][_0x3739('0x7f')]())+'Queues'](_0x355b3f);})[_0x3739('0x44')](respondWithResult(_0x7c671,null))[_0x3739('0x4d')](handleError(_0x7c671,null));};exports[_0x3739('0x81')]=function(_0x5e6aa0,_0x42241f,_0x5c63f0){return db['Team'][_0x3739('0x7a')]({'where':{'id':_0x5e6aa0['params']['id']}})[_0x3739('0x44')](function(_0x4b3c9a){if(_0x4b3c9a){if(!_0x5e6aa0[_0x3739('0x4f')][_0x3739('0x7b')]||!utils[_0x3739('0x7c')](_0x5e6aa0[_0x3739('0x4f')][_0x3739('0x7b')])){throw new db[(_0x3739('0x5e'))][(_0x3739('0x82'))](_0x3739('0x7d'));}return _0x4b3c9a[_0x3739('0x83')+_['capitalize'](_0x5e6aa0['body']['channel'][_0x3739('0x7f')]())+_0x3739('0x84')](_0x5e6aa0['body'][_0x3739('0x85')]);}return null;})[_0x3739('0x44')](handleEntityNotFound(_0x42241f,null))[_0x3739('0x44')](respondWithStatusCode(_0x42241f,null))['catch'](handleError(_0x42241f,null));};exports['removeQueues']=function(_0x3756a9,_0xb4cb7b,_0x5e731e){return db[_0x3739('0x31')][_0x3739('0x7a')]({'where':{'id':_0x3756a9[_0x3739('0x49')]['id']}})[_0x3739('0x44')](function(_0x17eabb){if(_0x17eabb){if(!_0x3756a9[_0x3739('0x35')][_0x3739('0x7b')]||!utils[_0x3739('0x7c')](_0x3756a9[_0x3739('0x35')]['channel'])){throw new db[(_0x3739('0x5e'))][(_0x3739('0x82'))](_0x3739('0x7d'));}return _0x17eabb[_0x3739('0x86')+_['capitalize'](_0x3756a9['query'][_0x3739('0x7b')][_0x3739('0x7f')]())+_0x3739('0x84')](_0x3756a9[_0x3739('0x35')][_0x3739('0x85')]);}return null;})[_0x3739('0x44')](handleEntityNotFound(_0xb4cb7b,null))[_0x3739('0x44')](respondWithStatusCode(_0xb4cb7b,null))['catch'](handleError(_0xb4cb7b,null));};exports['addAgents']=function(_0x4c193d,_0x3cb3c9){var _0x4f2ead=_[_0x3739('0x87')](_0x4c193d['body'][_0x3739('0x85')])?_0x4c193d[_0x3739('0x4f')]['ids']:[_0x4c193d[_0x3739('0x4f')][_0x3739('0x85')]];var _0x278123=_0x4c193d[_0x3739('0x49')]['id'];return db[_0x3739('0x31')]['find']({'where':{'id':_0x278123}})['then'](handleEntityNotFound(_0x3cb3c9,null))[_0x3739('0x44')](function(_0x135275){if(_0x135275){var _0x20ccaa=[_0x3739('0x88'),_0x3739('0x89'),_0x3739('0x8a'),_0x3739('0x8b'),_0x3739('0x8c'),_0x3739('0x8d'),_0x3739('0x8e')];return db['sequelize']['transaction'](function(_0x84d75e){var _0x387d94=_[_0x3739('0x30')](_0x20ccaa,function(_0x3254c8){var _0x31ad16={'attributes':['id',_0x3739('0x2e')]};if(_0x3254c8===_0x3739('0x88')){_0x31ad16[_0x3739('0x8f')]={'attributes':[_0x3739('0x90')]};}return _0x135275[_0x3739('0x50')+_0x3254c8+_0x3739('0x84')](_0x31ad16)['then'](function(_0x42adae){var _0x405869=_['map'](_0x42adae,function(_0x242d25){var _0x41fb43=_['map'](_0x4f2ead,function(_0x1db133){var _0x2bc00c={'where':{'UserId':_0x1db133,[_0x3254c8+_0x3739('0x91')]:_0x242d25['id']},'transaction':_0x84d75e};if(_0x3254c8===_0x3739('0x88')){_0x2bc00c['defaults']={'penalty':_0x242d25['TeamVoiceQueue'][_0x3739('0x90')]};}return db['User'+_0x3254c8+'Queue']['findOrCreate'](_0x2bc00c)[_0x3739('0x44')](function(){socket['emit'](_0x3739('0x53')+_0x3254c8+'Queue:save',{'UserId':_0x1db133,[_0x3254c8+_0x3739('0x91')]:_0x242d25['id']});if(_0x3254c8!=='Voice'){return;}return db[_0x3739('0x92')][_0x3739('0x93')]({'where':{'id':_0x4f2ead,'online':0x1},'attributes':['id',_0x3739('0x2e'),_0x3739('0x94'),'voicePause',_0x3739('0x95')],'raw':!![]})['then'](function(_0x519882){var _0x2594e9=_[_0x3739('0x30')](_0x519882,function(_0x16d636){return db['UserVoiceQueueRt'][_0x3739('0x96')]({'membername':_0x16d636[_0x3739('0x2e')],'UserId':_0x16d636['id'],'queue_name':_0x242d25[_0x3739('0x2e')],'VoiceQueueId':_0x242d25['id'],'interface':_[_0x3739('0x97')](_0x16d636[_0x3739('0x95')])?util[_0x3739('0x98')](_0x3739('0x99'),_0x16d636[_0x3739('0x2e')]):_0x16d636[_0x3739('0x95')],'paused':_0x16d636[_0x3739('0x9a')]||![],'penalty':_0x242d25[_0x3739('0x9b')]['penalty']},{'transaction':_0x84d75e});});return Promise[_0x3739('0x9c')](_0x2594e9);});});});return Promise['all'](_0x41fb43);});return Promise[_0x3739('0x9c')](_0x405869);})[_0x3739('0x44')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x278123}})[_0x3739('0x44')](function(_0x312ff8){if(_0x312ff8){var _0x21ef9b=_[_0x3739('0x30')](_0x4f2ead,function(_0x5bb913){db[_0x3739('0x75')][_0x3739('0x96')]({'UserId':_0x5bb913,'VoicePrefixId':_0x312ff8['VoicePrefixId']});});return Promise['all'](_0x21ef9b);}});});});return Promise[_0x3739('0x9c')](_0x387d94)[_0x3739('0x44')](function(){return _0x135275[_0x3739('0x9d')](_0x4f2ead,{'transaction':_0x84d75e})[_0x3739('0x9e')](function(_0x3ff856){return _0x3ff856;});});});}})[_0x3739('0x44')](respondWithResult(_0x3cb3c9,null))[_0x3739('0x4d')](handleError(_0x3cb3c9,null));};exports['removeAgents']=function(_0x533547,_0x21bea9){var _0x449890=_['isArray'](_0x533547['query'][_0x3739('0x85')])?_0x533547['query'][_0x3739('0x85')]:[_0x533547[_0x3739('0x35')]['ids']];var _0x43d829=_0x533547[_0x3739('0x49')]['id'];return db[_0x3739('0x31')]['find']({'where':{'id':_0x43d829}})[_0x3739('0x44')](handleEntityNotFound(_0x21bea9,null))['then'](function(_0x133096){if(_0x133096){var _0x2acbaa=[_0x3739('0x88'),_0x3739('0x89'),_0x3739('0x8a'),_0x3739('0x8b'),_0x3739('0x8c'),'Openchannel',_0x3739('0x8e')];return db[_0x3739('0x5b')][_0x3739('0x5c')](function(_0x559d01){var _0x50a25c=_[_0x3739('0x30')](_0x2acbaa,function(_0x3cbe72){var _0x22408d={'attributes':['id',_0x3739('0x2e')]};return _0x133096[_0x3739('0x50')+_0x3cbe72+_0x3739('0x84')](_0x22408d)['then'](function(_0x52e189){var _0xd44509=_[_0x3739('0x30')](_0x52e189,function(_0x4926c6){return _0x4926c6['removeAgents'](_0x449890,{'transaction':_0x559d01})[_0x3739('0x44')](function(){var _0x29fd4a=_[_0x3739('0x30')](_0x449890,function(_0x1ee8e4){socket[_0x3739('0x9f')](_0x3739('0x53')+_0x3cbe72+_0x3739('0xa0'),{'UserId':Number(_0x1ee8e4),[_0x3cbe72+_0x3739('0x91')]:_0x4926c6['id']});if(_0x3cbe72!==_0x3739('0x88')){return;}return db[_0x3739('0xa1')][_0x3739('0x5a')]({'where':{'VoiceQueueId':_0x4926c6['id'],'UserId':_0x1ee8e4},'transaction':_0x559d01});});return Promise[_0x3739('0x9c')](_0x29fd4a);});});return Promise[_0x3739('0x9c')](_0xd44509);});});return Promise[_0x3739('0x9c')](_0x50a25c)[_0x3739('0x44')](function(){return _0x133096[_0x3739('0xa2')](_0x449890,{'transaction':_0x559d01});})[_0x3739('0x44')](function(){return db[_0x3739('0x74')][_0x3739('0x7a')]({'where':{'teamId':_0x43d829}})['then'](function(_0x10efae){if(_0x10efae){var _0x2fa9a4=_[_0x3739('0x30')](_0x449890,function(_0xa7c37c){db[_0x3739('0x75')][_0x3739('0x5a')]({'where':{'UserId':_0xa7c37c,'VoicePrefixId':_0x10efae[_0x3739('0x76')]}});});return Promise[_0x3739('0x9c')](_0x2fa9a4);}});});});}})[_0x3739('0x44')](respondWithStatusCode(_0x21bea9,null))[_0x3739('0x4d')](handleError(_0x21bea9,null));};exports['getAgents']=function(_0x5c84ab,_0x36cddf,_0x41b939){var _0x3edadb={};var _0x19c962={};var _0x551d2d;var _0x10b007;return db[_0x3739('0x31')]['findOne']({'where':{'id':_0x5c84ab[_0x3739('0x49')]['id']}})[_0x3739('0x44')](handleEntityNotFound(_0x36cddf,null))[_0x3739('0x44')](function(_0x494e73){if(_0x494e73){_0x551d2d=_0x494e73;_0x19c962[_0x3739('0x34')]=_[_0x3739('0x36')](db[_0x3739('0x92')][_0x3739('0x4a')]);_0x19c962['query']=_[_0x3739('0x36')](_0x5c84ab[_0x3739('0x35')]);_0x19c962[_0x3739('0x37')]=_[_0x3739('0x38')](_0x19c962[_0x3739('0x34')],_0x19c962[_0x3739('0x35')]);_0x3edadb[_0x3739('0x39')]=_[_0x3739('0x38')](_0x19c962[_0x3739('0x34')],qs[_0x3739('0x4b')](_0x5c84ab[_0x3739('0x35')][_0x3739('0x4b')]));_0x3edadb[_0x3739('0x39')]=_0x3edadb[_0x3739('0x39')][_0x3739('0x4c')]?_0x3edadb[_0x3739('0x39')]:_0x19c962[_0x3739('0x34')];_0x3edadb['order']=qs[_0x3739('0x3c')](_0x5c84ab[_0x3739('0x35')][_0x3739('0x3c')]);_0x3edadb[_0x3739('0x3d')]=qs[_0x3739('0x37')](_[_0x3739('0x3e')](_0x5c84ab[_0x3739('0x35')],_0x19c962[_0x3739('0x37')]));if(_0x5c84ab[_0x3739('0x35')]['filter']){_0x3edadb[_0x3739('0x3d')]=_[_0x3739('0x40')](_0x3edadb[_0x3739('0x3d')],{'$or':_[_0x3739('0x30')](_0x3edadb[_0x3739('0x39')],function(_0x4ba1b7){var _0xf13f13={};_0xf13f13[_0x4ba1b7]={'$like':'%'+_0x5c84ab[_0x3739('0x35')][_0x3739('0x3f')]+'%'};return _0xf13f13;})});}_0x3edadb=_[_0x3739('0x40')]({},_0x3edadb,_0x5c84ab['options']);return _0x551d2d[_0x3739('0xa3')](_0x3edadb);}})[_0x3739('0x44')](function(_0x47008c){if(_0x47008c){_0x10b007=_0x47008c['length'];if(!_0x5c84ab[_0x3739('0x35')][_0x3739('0x3a')]('nolimit')){_0x3edadb[_0x3739('0x25')]=qs['limit'](_0x5c84ab['query'][_0x3739('0x25')]);_0x3edadb[_0x3739('0x23')]=qs[_0x3739('0x23')](_0x5c84ab[_0x3739('0x35')][_0x3739('0x23')]);}return _0x551d2d['getAgents'](_0x3edadb);}})[_0x3739('0x44')](function(_0x3bfe63){if(_0x3bfe63){return _0x3bfe63?{'count':_0x10b007,'rows':_0x3bfe63}:null;}})['then'](respondWithResult(_0x36cddf,null))[_0x3739('0x4d')](handleError(_0x36cddf,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6092e38..1108e5e 100644 --- a/server/api/team/team.events.js +++ b/server/api/team/team.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd7a=['save','update','remove','emit','hasOwnProperty','hook','events','Team','setMaxListeners'];(function(_0x5afbe8,_0x11721b){var _0x3026cd=function(_0x2be4ed){while(--_0x2be4ed){_0x5afbe8['push'](_0x5afbe8['shift']());}};_0x3026cd(++_0x11721b);}(_0xdd7a,0x102));var _0xadd7=function(_0x535d99,_0x35220f){_0x535d99=_0x535d99-0x0;var _0x22308b=_0xdd7a[_0x535d99];return _0x22308b;};'use strict';var EventEmitter=require(_0xadd7('0x0'));var Team=require('../../mysqldb')['db'][_0xadd7('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xadd7('0x2')](0x0);var events={'afterCreate':_0xadd7('0x3'),'afterUpdate':_0xadd7('0x4'),'afterDestroy':_0xadd7('0x5')};function emitEvent(_0x5b09c4){return function(_0x4f9ac3,_0x36b803,_0x126f84){TeamEvents[_0xadd7('0x6')](_0x5b09c4+':'+_0x4f9ac3['id'],_0x4f9ac3);TeamEvents[_0xadd7('0x6')](_0x5b09c4,_0x4f9ac3);_0x126f84(null);};}for(var e in events){if(events[_0xadd7('0x7')](e)){var event=events[e];Team[_0xadd7('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x3b07=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','emit'];(function(_0x49dec9,_0x2e7aa7){var _0x3f63aa=function(_0x257391){while(--_0x257391){_0x49dec9['push'](_0x49dec9['shift']());}};_0x3f63aa(++_0x2e7aa7);}(_0x3b07,0xb2));var _0x73b0=function(_0x30a0de,_0x4f2cca){_0x30a0de=_0x30a0de-0x0;var _0x3f13e4=_0x3b07[_0x30a0de];return _0x3f13e4;};'use strict';var EventEmitter=require(_0x73b0('0x0'));var Team=require(_0x73b0('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x73b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d8e5f){return function(_0x3fa07d,_0x1146f0,_0x2318dc){TeamEvents[_0x73b0('0x3')](_0x3d8e5f+':'+_0x3fa07d['id'],_0x3fa07d);TeamEvents[_0x73b0('0x3')](_0x3d8e5f,_0x3fa07d);_0x2318dc(null);};}for(var e in events){if(events[_0x73b0('0x4')](e)){var event=events[e];Team[_0x73b0('0x5')](e,emitEvent(event));}}module[_0x73b0('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7f3e552..7912a74 100644 --- a/server/api/team/team.model.js +++ b/server/api/team/team.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5542=['get','Queues','then','map','exports','define','Team','teams','Chat','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','catch'];(function(_0x1d9d12,_0x2c7d98){var _0x4f680e=function(_0x4e1bbb){while(--_0x4e1bbb){_0x1d9d12['push'](_0x1d9d12['shift']());}};_0x4f680e(++_0x2c7d98);}(_0x5542,0x99));var _0x2554=function(_0x36c6f8,_0x17cb72){_0x36c6f8=_0x36c6f8-0x0;var _0x240ff0=_0x5542[_0x36c6f8];return _0x240ff0;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x2cc09d,_0x58ff0d){var _0x2fd156=_0x2554('0x0')+_0x58ff0d+_0x2554('0x1');return _0x2cc09d[_0x2fd156]()[_0x2554('0x2')](function(_0x20e3c9){return _[_0x2554('0x3')](_0x20e3c9,function(_0x461dd0){_0x461dd0['setDataValue']('channel',_0x58ff0d);return _0x461dd0;});})['catch'](function(_0x404495){throw _0x404495;});}module[_0x2554('0x4')]=function(_0x355522){return _0x355522[_0x2554('0x5')](_0x2554('0x6'),attributes,{'tableName':_0x2554('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3b09ce=this;var _0xd25293=[_0x2554('0x8'),'Fax',_0x2554('0x9'),_0x2554('0xa'),_0x2554('0xb'),_0x2554('0xc'),_0x2554('0xd')];return Promise[_0x2554('0xe')]()[_0x2554('0x2')](function(){var _0x269d79=_['map'](_0xd25293,function(_0x12bf47){return getQueuesByChannel(_0x3b09ce,_0x12bf47);});return Promise[_0x2554('0xf')](_0x269d79);})[_0x2554('0x10')](function(_0x262684){throw _0x262684;});}}});}; \ No newline at end of file +var _0xe177=['Team','teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp','resolve','map','all','./team.attributes','get','then','setDataValue','channel','catch','define'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0xe177,0xbf));var _0x7e17=function(_0x53a98b,_0x28c762){_0x53a98b=_0x53a98b-0x0;var _0x5c3349=_0xe177[_0x53a98b];return _0x5c3349;};'use strict';var _=require('lodash');var attributes=require(_0x7e17('0x0'));function getQueuesByChannel(_0x1ebcf6,_0x10f1ce){var _0x151f2f=_0x7e17('0x1')+_0x10f1ce+'Queues';return _0x1ebcf6[_0x151f2f]()[_0x7e17('0x2')](function(_0x43350b){return _['map'](_0x43350b,function(_0x121b2c){_0x121b2c[_0x7e17('0x3')](_0x7e17('0x4'),_0x10f1ce);return _0x121b2c;});})[_0x7e17('0x5')](function(_0x44dd02){throw _0x44dd02;});}module['exports']=function(_0x2839f6){return _0x2839f6[_0x7e17('0x6')](_0x7e17('0x7'),attributes,{'tableName':_0x7e17('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x547cc4=this;var _0x2749ee=[_0x7e17('0x9'),_0x7e17('0xa'),_0x7e17('0xb'),_0x7e17('0xc'),'Sms',_0x7e17('0xd'),_0x7e17('0xe')];return Promise[_0x7e17('0xf')]()[_0x7e17('0x2')](function(){var _0x3a46eb=_[_0x7e17('0x10')](_0x2749ee,function(_0x4375f5){return getQueuesByChannel(_0x547cc4,_0x4375f5);});return Promise[_0x7e17('0x11')](_0x3a46eb);})[_0x7e17('0x5')](function(_0x7d35be){throw _0x7d35be;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f2aa8b0..290bf13 100644 --- a/server/api/team/team.rpc.js +++ b/server/api/team/team.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84dd=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./team.socket','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Team,\x20%s,\x20%s','result'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x84dd,0xfd));var _0xd84d=function(_0x4244be,_0x1b194b){_0x4244be=_0x4244be-0x0;var _0x2f4add=_0x84dd[_0x4244be];return _0x2f4add;};'use strict';var _=require(_0xd84d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd84d('0x1'));var fs=require('fs');var Redis=require(_0xd84d('0x2'));var db=require(_0xd84d('0x3'))['db'];var utils=require(_0xd84d('0x4'));var logger=require(_0xd84d('0x5'))(_0xd84d('0x6'));var config=require(_0xd84d('0x7'));var jayson=require(_0xd84d('0x8'));var client=jayson[_0xd84d('0x9')][_0xd84d('0xa')]({'port':0x232a});config[_0xd84d('0xb')]=_['defaults'](config[_0xd84d('0xb')],{'host':_0xd84d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd84d('0xb')]));require(_0xd84d('0xd'))[_0xd84d('0xe')](socket);function respondWithRpcPromise(_0x365e36,_0x3b30c7,_0x4bcda3){return new BPromise(function(_0x40dd7a,_0x59f673){return client[_0xd84d('0xf')](_0x365e36,_0x4bcda3)[_0xd84d('0x10')](function(_0x23dcf){logger[_0xd84d('0x11')]('Team,\x20%s,\x20%s',_0x3b30c7,'request\x20sent');logger[_0xd84d('0x12')](_0xd84d('0x13'),_0x3b30c7,_0xd84d('0x14'),JSON[_0xd84d('0x15')](_0x23dcf));if(_0x23dcf[_0xd84d('0x16')]){if(_0x23dcf['error'][_0xd84d('0x17')]===0x1f4){logger[_0xd84d('0x16')]('Team,\x20%s,\x20%s',_0x3b30c7,_0x23dcf[_0xd84d('0x16')][_0xd84d('0x18')]);return _0x59f673(_0x23dcf[_0xd84d('0x16')][_0xd84d('0x18')]);}logger[_0xd84d('0x16')](_0xd84d('0x19'),_0x3b30c7,_0x23dcf[_0xd84d('0x16')][_0xd84d('0x18')]);return _0x40dd7a(_0x23dcf[_0xd84d('0x16')][_0xd84d('0x18')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x3b30c7,'request\x20sent');_0x40dd7a(_0x23dcf[_0xd84d('0x1a')]['message']);}})[_0xd84d('0x1b')](function(_0x47b993){logger[_0xd84d('0x16')](_0xd84d('0x19'),_0x3b30c7,_0x47b993);_0x59f673(_0x47b993);});});} \ No newline at end of file +var _0x1142=['./team.socket','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost'];(function(_0x52eb16,_0x89c3d8){var _0x382d3f=function(_0x378238){while(--_0x378238){_0x52eb16['push'](_0x52eb16['shift']());}};_0x382d3f(++_0x89c3d8);}(_0x1142,0x125));var _0x2114=function(_0x3ce9d3,_0x484493){_0x3ce9d3=_0x3ce9d3-0x0;var _0x452b0e=_0x1142[_0x3ce9d3];return _0x452b0e;};'use strict';var _=require('lodash');var util=require(_0x2114('0x0'));var moment=require(_0x2114('0x1'));var BPromise=require(_0x2114('0x2'));var rs=require(_0x2114('0x3'));var fs=require('fs');var Redis=require(_0x2114('0x4'));var db=require(_0x2114('0x5'))['db'];var utils=require(_0x2114('0x6'));var logger=require(_0x2114('0x7'))(_0x2114('0x8'));var config=require(_0x2114('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2114('0xa')][_0x2114('0xb')]({'port':0x232a});config['redis']=_[_0x2114('0xc')](config[_0x2114('0xd')],{'host':_0x2114('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2114('0xd')]));require(_0x2114('0xf'))['register'](socket);function respondWithRpcPromise(_0x5e68f9,_0x203849,_0x254bc6){return new BPromise(function(_0x4aafce,_0x551fb7){return client[_0x2114('0x10')](_0x5e68f9,_0x254bc6)[_0x2114('0x11')](function(_0x1f3461){logger[_0x2114('0x12')]('Team,\x20%s,\x20%s',_0x203849,_0x2114('0x13'));logger[_0x2114('0x14')](_0x2114('0x15'),_0x203849,_0x2114('0x13'),JSON[_0x2114('0x16')](_0x1f3461));if(_0x1f3461[_0x2114('0x17')]){if(_0x1f3461['error'][_0x2114('0x18')]===0x1f4){logger[_0x2114('0x17')](_0x2114('0x19'),_0x203849,_0x1f3461['error'][_0x2114('0x1a')]);return _0x551fb7(_0x1f3461['error'][_0x2114('0x1a')]);}logger[_0x2114('0x17')](_0x2114('0x19'),_0x203849,_0x1f3461[_0x2114('0x17')]['message']);return _0x4aafce(_0x1f3461[_0x2114('0x17')]['message']);}else{logger['info'](_0x2114('0x19'),_0x203849,_0x2114('0x13'));_0x4aafce(_0x1f3461[_0x2114('0x1b')][_0x2114('0x1a')]);}})['catch'](function(_0x3dd688){logger[_0x2114('0x17')](_0x2114('0x19'),_0x203849,_0x3dd688);_0x551fb7(_0x3dd688);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e8cdcd6..0d70a4f 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x112a=['remove','update','emit','removeListener','register','length','team:','./team.events','save'];(function(_0x2c50ac,_0x10c132){var _0x265a68=function(_0x387549){while(--_0x387549){_0x2c50ac['push'](_0x2c50ac['shift']());}};_0x265a68(++_0x10c132);}(_0x112a,0x115));var _0xa112=function(_0x2ee5a4,_0x5dd971){_0x2ee5a4=_0x2ee5a4-0x0;var _0x911612=_0x112a[_0x2ee5a4];return _0x911612;};'use strict';var TeamEvents=require(_0xa112('0x0'));var events=[_0xa112('0x1'),_0xa112('0x2'),_0xa112('0x3')];function createListener(_0x1d260c,_0x2099bb){return function(_0x38d241){_0x2099bb[_0xa112('0x4')](_0x1d260c,_0x38d241);};}function removeListener(_0x276a61,_0x27b96f){return function(){TeamEvents[_0xa112('0x5')](_0x276a61,_0x27b96f);};}exports[_0xa112('0x6')]=function(_0x41ca4c){for(var _0x350cc4=0x0,_0x676aa8=events[_0xa112('0x7')];_0x350cc4<_0x676aa8;_0x350cc4++){var _0x3aaae7=events[_0x350cc4];var _0x7f5ede=createListener(_0xa112('0x8')+_0x3aaae7,_0x41ca4c);TeamEvents['on'](_0x3aaae7,_0x7f5ede);}}; \ No newline at end of file +var _0x829e=['length','team:','./team.events','save','remove','update','removeListener'];(function(_0x2da019,_0x4bdb2e){var _0x14a8ad=function(_0x21b22c){while(--_0x21b22c){_0x2da019['push'](_0x2da019['shift']());}};_0x14a8ad(++_0x4bdb2e);}(_0x829e,0xaa));var _0xe829=function(_0x48f1b9,_0x2ee47f){_0x48f1b9=_0x48f1b9-0x0;var _0xb123ee=_0x829e[_0x48f1b9];return _0xb123ee;};'use strict';var TeamEvents=require(_0xe829('0x0'));var events=[_0xe829('0x1'),_0xe829('0x2'),_0xe829('0x3')];function createListener(_0x59ae56,_0x4a7395){return function(_0x159afe){_0x4a7395['emit'](_0x59ae56,_0x159afe);};}function removeListener(_0x37ce98,_0x14e304){return function(){TeamEvents[_0xe829('0x4')](_0x37ce98,_0x14e304);};}exports['register']=function(_0x1f4436){for(var _0x4d176f=0x0,_0x524075=events[_0xe829('0x5')];_0x4d176f<_0x524075;_0x4d176f++){var _0x4cc629=events[_0x4d176f];var _0x26f7db=createListener(_0xe829('0x6')+_0x4cc629,_0x1f4436);TeamEvents['on'](_0x4cc629,_0x26f7db);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 2daca3e..33acdef 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeb3=['INTEGER','sequelize','exports'];(function(_0x44ad88,_0x7ce34a){var _0x395ec3=function(_0x38e587){while(--_0x38e587){_0x44ad88['push'](_0x44ad88['shift']());}};_0x395ec3(++_0x7ce34a);}(_0xdeb3,0xeb));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x3deb('0x0'));module[_0x3deb('0x1')]={'TeamId':{'type':Sequelize[_0x3deb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3deb('0x2')]}}; \ No newline at end of file +var _0x5a8c=['sequelize','exports','INTEGER'];(function(_0x7ca44f,_0x38f5d4){var _0x6e86d9=function(_0x200dc9){while(--_0x200dc9){_0x7ca44f['push'](_0x7ca44f['shift']());}};_0x6e86d9(++_0x38f5d4);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x4d1c82,_0x19d05e){_0x4d1c82=_0x4d1c82-0x0;var _0x124760=_0x5a8c[_0x4d1c82];return _0x124760;};'use strict';var Sequelize=require(_0xc5a8('0x0'));module[_0xc5a8('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc5a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 8b78e7a..ef9d8e5 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x351d=['../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5704b4,_0x5d1271){var _0x1e3f99=function(_0x4738ee){while(--_0x4738ee){_0x5704b4['push'](_0x5704b4['shift']());}};_0x1e3f99(++_0x5d1271);}(_0x351d,0x90));var _0xd351=function(_0x220786,_0x5044bd){_0x220786=_0x220786-0x0;var _0x3593b1=_0x351d[_0x220786];return _0x3593b1;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf894=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x1ded25,_0x26be3d){var _0x8ec99f=function(_0x3017ac){while(--_0x3017ac){_0x1ded25['push'](_0x1ded25['shift']());}};_0x8ec99f(++_0x26be3d);}(_0xf894,0xfd));var _0x4f89=function(_0x593d57,_0x20b387){_0x593d57=_0x593d57-0x0;var _0x30ce72=_0xf894[_0x593d57];return _0x30ce72;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var logger=require(_0x4f89('0x2'))(_0x4f89('0x3'));var moment=require(_0x4f89('0x4'));var BPromise=require(_0x4f89('0x5'));var rp=require(_0x4f89('0x6'));var fs=require('fs');var path=require(_0x4f89('0x7'));var rimraf=require(_0x4f89('0x8'));var config=require(_0x4f89('0x9'));var attributes=require(_0x4f89('0xa'));module[_0x4f89('0xb')]=function(_0x8837a0,_0x343593){return _0x8837a0[_0x4f89('0xc')](_0x4f89('0xd'),attributes,{'tableName':_0x4f89('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8252c1d..9479f72 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x25cfcd,_0x5a294d){var _0x421a40=function(_0x4dedca){while(--_0x4dedca){_0x25cfcd['push'](_0x25cfcd['shift']());}};_0x421a40(++_0x5a294d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3790a6,_0x276d65){var _0xe6a81b=function(_0x3025a3){while(--_0x3025a3){_0x3790a6['push'](_0x3790a6['shift']());}};_0xe6a81b(++_0x276d65);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 6f5f7cb..daa4cf8 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa936=['exports','INTEGER','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa936,0x15e));var _0x6a93=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa936[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x6a93('0x0'));module[_0x6a93('0x1')]={'penalty':{'type':Sequelize[_0x6a93('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe409=['INTEGER','sequelize'];(function(_0x3ddb4e,_0x5d9ecf){var _0x16202e=function(_0x505a25){while(--_0x505a25){_0x3ddb4e['push'](_0x3ddb4e['shift']());}};_0x16202e(++_0x5d9ecf);}(_0xe409,0x195));var _0x9e40=function(_0x155871,_0x57be94){_0x155871=_0x155871-0x0;var _0x5d9402=_0xe409[_0x155871];return _0x5d9402;};'use strict';var Sequelize=require(_0x9e40('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9e40('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 566db12..5a0f5aa 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c4a=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','util'];(function(_0x1dc4fa,_0x32169c){var _0x1003c5=function(_0x770a59){while(--_0x770a59){_0x1dc4fa['push'](_0x1dc4fa['shift']());}};_0x1003c5(++_0x32169c);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x400be3,_0xfe0b0b){_0x400be3=_0x400be3-0x0;var _0x35acaf=_0x5c4a[_0x400be3];return _0x35acaf;};'use strict';var _=require('lodash');var util=require(_0xa5c4('0x0'));var logger=require(_0xa5c4('0x1'))('api');var moment=require(_0xa5c4('0x2'));var BPromise=require(_0xa5c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5c4('0x4'));var rimraf=require(_0xa5c4('0x5'));var config=require(_0xa5c4('0x6'));var attributes=require(_0xa5c4('0x7'));module[_0xa5c4('0x8')]=function(_0x49af82,_0x2410cf){return _0x49af82[_0xa5c4('0x9')](_0xa5c4('0xa'),attributes,{'tableName':_0xa5c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa7c=['../../config/environment','./teamVoiceQueue.attributes','exports','define','lodash','bluebird','request-promise','rimraf'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x55b75e,_0x12e4b5){_0x55b75e=_0x55b75e-0x0;var _0x3b4ee1=_0xaa7c[_0x55b75e];return _0x3b4ee1;};'use strict';var _=require(_0xcaa7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcaa7('0x1'));var rp=require(_0xcaa7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa7('0x3'));var config=require(_0xcaa7('0x4'));var attributes=require(_0xcaa7('0x5'));module[_0xcaa7('0x6')]=function(_0x27e610,_0x5a3674){return _0x27e610[_0xcaa7('0x7')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 8bbc787..ba51c4c 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf963=['../../config/environment','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22eeeb,_0x385a72){var _0x52bb37=function(_0x2be61b){while(--_0x2be61b){_0x22eeeb['push'](_0x22eeeb['shift']());}};_0x52bb37(++_0x385a72);}(_0xf963,0x11f));var _0x3f96=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf963[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x3f96('0x0'));var util=require(_0x3f96('0x1'));var moment=require(_0x3f96('0x2'));var BPromise=require(_0x3f96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f96('0x4'))['db'];var utils=require(_0x3f96('0x5'));var logger=require(_0x3f96('0x6'))('rpc');var config=require(_0x3f96('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x257609,_0x436edd,_0x1cd9ad){return new BPromise(function(_0x48d619,_0x312489){return client[_0x3f96('0x8')](_0x257609,_0x1cd9ad)[_0x3f96('0x9')](function(_0x479674){logger[_0x3f96('0xa')](_0x3f96('0xb'),_0x436edd,_0x3f96('0xc'));logger[_0x3f96('0xd')](_0x3f96('0xe'),_0x436edd,_0x3f96('0xc'),JSON[_0x3f96('0xf')](_0x479674));if(_0x479674[_0x3f96('0x10')]){if(_0x479674['error'][_0x3f96('0x11')]===0x1f4){logger[_0x3f96('0x10')](_0x3f96('0xb'),_0x436edd,_0x479674['error'][_0x3f96('0x12')]);return _0x312489(_0x479674[_0x3f96('0x10')][_0x3f96('0x12')]);}logger['error'](_0x3f96('0xb'),_0x436edd,_0x479674[_0x3f96('0x10')][_0x3f96('0x12')]);return _0x48d619(_0x479674[_0x3f96('0x10')][_0x3f96('0x12')]);}else{logger[_0x3f96('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x436edd,_0x3f96('0xc'));_0x48d619(_0x479674[_0x3f96('0x13')][_0x3f96('0x12')]);}})[_0x3f96('0x14')](function(_0x217f35){logger[_0x3f96('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x436edd,_0x217f35);_0x312489(_0x217f35);});});} \ No newline at end of file +var _0x730a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0x730a,0x1b1));var _0xa730=function(_0x3b84a8,_0xd456ed){_0x3b84a8=_0x3b84a8-0x0;var _0x2c020d=_0x730a[_0x3b84a8];return _0x2c020d;};'use strict';var _=require(_0xa730('0x0'));var util=require(_0xa730('0x1'));var moment=require('moment');var BPromise=require(_0xa730('0x2'));var rs=require(_0xa730('0x3'));var fs=require('fs');var Redis=require(_0xa730('0x4'));var db=require(_0xa730('0x5'))['db'];var utils=require(_0xa730('0x6'));var logger=require(_0xa730('0x7'))(_0xa730('0x8'));var config=require(_0xa730('0x9'));var jayson=require(_0xa730('0xa'));var client=jayson['client'][_0xa730('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22c8a6,_0x2c8031,_0x1fed81){return new BPromise(function(_0x52cc04,_0x351847){return client[_0xa730('0xc')](_0x22c8a6,_0x1fed81)[_0xa730('0xd')](function(_0x30e819){logger[_0xa730('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2c8031,'request\x20sent');logger[_0xa730('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2c8031,'request\x20sent',JSON[_0xa730('0x10')](_0x30e819));if(_0x30e819[_0xa730('0x11')]){if(_0x30e819[_0xa730('0x11')][_0xa730('0x12')]===0x1f4){logger[_0xa730('0x11')](_0xa730('0x13'),_0x2c8031,_0x30e819[_0xa730('0x11')][_0xa730('0x14')]);return _0x351847(_0x30e819[_0xa730('0x11')][_0xa730('0x14')]);}logger['error'](_0xa730('0x13'),_0x2c8031,_0x30e819[_0xa730('0x11')]['message']);return _0x52cc04(_0x30e819[_0xa730('0x11')][_0xa730('0x14')]);}else{logger['info'](_0xa730('0x13'),_0x2c8031,'request\x20sent');_0x52cc04(_0x30e819[_0xa730('0x15')][_0xa730('0x14')]);}})[_0xa730('0x16')](function(_0x3969a8){logger[_0xa730('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2c8031,_0x3969a8);_0x351847(_0x3969a8);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index dbd71ea..4c568c5 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7bd=['show','post','put','/:id','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x2e2dde,_0xe2929b){var _0x40bdd7=function(_0x166f01){while(--_0x166f01){_0x2e2dde['push'](_0x2e2dde['shift']());}};_0x40bdd7(++_0xe2929b);}(_0xc7bd,0x86));var _0xdc7b=function(_0x4d1906,_0x6ded3){_0x4d1906=_0x4d1906-0x0;var _0xeea6ba=_0xc7bd[_0x4d1906];return _0xeea6ba;};'use strict';var multer=require('multer');var util=require(_0xdc7b('0x0'));var path=require(_0xdc7b('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc7b('0x2'));var router=express['Router']();var fs_extra=require(_0xdc7b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc7b('0x4'));var config=require(_0xdc7b('0x5'));var controller=require(_0xdc7b('0x6'));router[_0xdc7b('0x7')]('/',auth[_0xdc7b('0x8')](),controller[_0xdc7b('0x9')]);router[_0xdc7b('0x7')]('/:id',auth[_0xdc7b('0x8')](),controller[_0xdc7b('0xa')]);router[_0xdc7b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdc7b('0xc')](_0xdc7b('0xd'),auth[_0xdc7b('0x8')](),controller[_0xdc7b('0xe')]);router[_0xdc7b('0xf')](_0xdc7b('0xd'),auth['isAuthenticated'](),controller[_0xdc7b('0x10')]);module[_0xdc7b('0x11')]=router; \ No newline at end of file +var _0x5430=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x5d1f5f,_0x2a9553){var _0x3baaf1=function(_0x10cdb3){while(--_0x10cdb3){_0x5d1f5f['push'](_0x5d1f5f['shift']());}};_0x3baaf1(++_0x2a9553);}(_0x5430,0x10c));var _0x0543=function(_0x28fe49,_0x19f6a5){_0x28fe49=_0x28fe49-0x0;var _0x22f6b7=_0x5430[_0x28fe49];return _0x22f6b7;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0xc')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xf')]);router[_0x0543('0x10')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0x11')]);module[_0x0543('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 8ea8805..d28adaf 100644 --- a/server/api/template/template.attributes.js +++ b/server/api/template/template.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2459=['TEXT','sequelize','exports','STRING'];(function(_0x409b5a,_0x5033e4){var _0x21d580=function(_0xf87631){while(--_0xf87631){_0x409b5a['push'](_0x409b5a['shift']());}};_0x21d580(++_0x5033e4);}(_0x2459,0x105));var _0x9245=function(_0x4072d0,_0x2c84bd){_0x4072d0=_0x4072d0-0x0;var _0x2fc971=_0x2459[_0x4072d0];return _0x2fc971;};'use strict';var Sequelize=require(_0x9245('0x0'));module[_0x9245('0x1')]={'name':{'type':Sequelize[_0x9245('0x2')]},'description':{'type':Sequelize[_0x9245('0x2')]},'html':{'type':Sequelize[_0x9245('0x3')]}}; \ No newline at end of file +var _0xac6f=['STRING','TEXT'];(function(_0x52041b,_0x583364){var _0x15cd5e=function(_0x407509){while(--_0x407509){_0x52041b['push'](_0x52041b['shift']());}};_0x15cd5e(++_0x583364);}(_0xac6f,0x1d0));var _0xfac6=function(_0x48c784,_0x52b6fc){_0x48c784=_0x48c784-0x0;var _0x4634d9=_0xac6f[_0x48c784];return _0x4634d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfac6('0x0')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xfac6('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index cc0f571..c4d0892 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf260=['UserProfileResource','error','stack','name','send','index','map','Template','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Templates'];(function(_0x5bdbfd,_0x3aaf24){var _0x5711c0=function(_0x14b3ac){while(--_0x14b3ac){_0x5bdbfd['push'](_0x5bdbfd['shift']());}};_0x5711c0(++_0x3aaf24);}(_0xf260,0x12b));var _0x0f26=function(_0x5da63e,_0x4d3503){_0x5da63e=_0x5da63e-0x0;var _0x442aca=_0xf260[_0x5da63e];return _0x442aca;};'use strict';var emlformat=require(_0x0f26('0x0'));var rimraf=require(_0x0f26('0x1'));var zipdir=require(_0x0f26('0x2'));var jsonpatch=require(_0x0f26('0x3'));var rp=require(_0x0f26('0x4'));var moment=require(_0x0f26('0x5'));var BPromise=require(_0x0f26('0x6'));var Mustache=require(_0x0f26('0x7'));var util=require(_0x0f26('0x8'));var path=require('path');var sox=require(_0x0f26('0x9'));var csv=require(_0x0f26('0xa'));var ejs=require(_0x0f26('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f26('0xc'));var squel=require(_0x0f26('0xd'));var crypto=require(_0x0f26('0xe'));var jsforce=require(_0x0f26('0xf'));var deskjs=require(_0x0f26('0x10'));var toCsv=require(_0x0f26('0xa'));var querystring=require(_0x0f26('0x11'));var Papa=require(_0x0f26('0x12'));var Redis=require(_0x0f26('0x13'));var authService=require(_0x0f26('0x14'));var qs=require(_0x0f26('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f26('0x16'));var logger=require(_0x0f26('0x17'))(_0x0f26('0x18'));var utils=require('../../config/utils');var config=require(_0x0f26('0x19'));var licenseUtil=require(_0x0f26('0x1a'));var db=require(_0x0f26('0x1b'))['db'];function respondWithStatusCode(_0x49044e,_0x503dd5){_0x503dd5=_0x503dd5||0xcc;return function(_0x5b169d){if(_0x5b169d){return _0x49044e[_0x0f26('0x1c')](_0x503dd5);}return _0x49044e[_0x0f26('0x1d')](_0x503dd5)[_0x0f26('0x1e')]();};}function respondWithResult(_0x587789,_0x5b996b){_0x5b996b=_0x5b996b||0xc8;return function(_0x3c7954){if(_0x3c7954){return _0x587789[_0x0f26('0x1d')](_0x5b996b)[_0x0f26('0x1f')](_0x3c7954);}};}function respondWithFilteredResult(_0xdd6584,_0xe422e1){return function(_0x2db4bb){if(_0x2db4bb){var _0xf04b31=typeof _0xe422e1[_0x0f26('0x20')]==='undefined'&&typeof _0xe422e1[_0x0f26('0x21')]===_0x0f26('0x22');var _0x4f5262=_0x2db4bb['count'];var _0x2501db=_0xf04b31?0x0:_0xe422e1['offset'];var _0x25eccf=_0xf04b31?_0x2db4bb[_0x0f26('0x23')]:_0xe422e1[_0x0f26('0x20')]+_0xe422e1['limit'];var _0x37423f;if(_0x25eccf>=_0x4f5262){_0x25eccf=_0x4f5262;_0x37423f=0xc8;}else{_0x37423f=0xce;}_0xdd6584['status'](_0x37423f);return _0xdd6584[_0x0f26('0x24')]('Content-Range',_0x2501db+'-'+_0x25eccf+'/'+_0x4f5262)[_0x0f26('0x1f')](_0x2db4bb);}return null;};}function patchUpdates(_0x54f7da){return function(_0x55bfa0){try{jsonpatch[_0x0f26('0x25')](_0x55bfa0,_0x54f7da,!![]);}catch(_0x477d8a){return BPromise[_0x0f26('0x26')](_0x477d8a);}return _0x55bfa0[_0x0f26('0x27')]();};}function saveUpdates(_0x1aa48f,_0x1a5d79){return function(_0x282d55){if(_0x282d55){return _0x282d55[_0x0f26('0x28')](_0x1aa48f)[_0x0f26('0x29')](function(_0x1aade2){return _0x1aade2;});}return null;};}function removeEntity(_0x1c7ae5,_0x29bc33){return function(_0x1591e4){if(_0x1591e4){return _0x1591e4[_0x0f26('0x2a')]()['then'](function(){var _0x117264=_0x1591e4[_0x0f26('0x2b')]({'plain':!![]});var _0xeb915f=_0x0f26('0x2c');return db[_0x0f26('0x2d')][_0x0f26('0x2a')]({'where':{'type':_0xeb915f,'resourceId':_0x117264['id']}})[_0x0f26('0x29')](function(){return _0x1591e4;});})['then'](function(){_0x1c7ae5[_0x0f26('0x1d')](0xcc)[_0x0f26('0x1e')]();});}};}function handleEntityNotFound(_0x489712,_0x290892){return function(_0x10d394){if(!_0x10d394){_0x489712[_0x0f26('0x1c')](0x194);}return _0x10d394;};}function handleError(_0x386b3a,_0x2d5ccd){_0x2d5ccd=_0x2d5ccd||0x1f4;return function(_0x468be6){logger[_0x0f26('0x2e')](_0x468be6[_0x0f26('0x2f')]);if(_0x468be6[_0x0f26('0x30')]){delete _0x468be6[_0x0f26('0x30')];}_0x386b3a['status'](_0x2d5ccd)[_0x0f26('0x31')](_0x468be6);};}exports[_0x0f26('0x32')]=function(_0x542156,_0x34828d){var _0x262f21={},_0x8f239e={},_0x43aa70={'count':0x0,'rows':[]};var _0x99f057=_[_0x0f26('0x33')](db[_0x0f26('0x34')]['rawAttributes'],function(_0x7a340){return{'name':_0x7a340[_0x0f26('0x35')],'type':_0x7a340[_0x0f26('0x36')][_0x0f26('0x37')]};});_0x8f239e['model']=_[_0x0f26('0x33')](_0x99f057,_0x0f26('0x30'));_0x8f239e[_0x0f26('0x38')]=_[_0x0f26('0x39')](_0x542156['query']);_0x8f239e[_0x0f26('0x3a')]=_[_0x0f26('0x3b')](_0x8f239e[_0x0f26('0x3c')],_0x8f239e[_0x0f26('0x38')]);_0x262f21[_0x0f26('0x3d')]=_[_0x0f26('0x3b')](_0x8f239e[_0x0f26('0x3c')],qs[_0x0f26('0x3e')](_0x542156[_0x0f26('0x38')][_0x0f26('0x3e')]));_0x262f21[_0x0f26('0x3d')]=_0x262f21[_0x0f26('0x3d')]['length']?_0x262f21[_0x0f26('0x3d')]:_0x8f239e['model'];if(!_0x542156[_0x0f26('0x38')][_0x0f26('0x3f')](_0x0f26('0x40'))){_0x262f21[_0x0f26('0x21')]=qs[_0x0f26('0x21')](_0x542156[_0x0f26('0x38')][_0x0f26('0x21')]);_0x262f21[_0x0f26('0x20')]=qs['offset'](_0x542156['query'][_0x0f26('0x20')]);}_0x262f21['order']=qs[_0x0f26('0x41')](_0x542156['query']['sort']);_0x262f21['where']=qs[_0x0f26('0x3a')](_['pick'](_0x542156['query'],_0x8f239e[_0x0f26('0x3a')]),_0x99f057);if(_0x542156[_0x0f26('0x38')][_0x0f26('0x42')]){_0x262f21[_0x0f26('0x43')]=_[_0x0f26('0x44')](_0x262f21[_0x0f26('0x43')],{'$or':_[_0x0f26('0x33')](_0x99f057,function(_0x2f15c4){if(_0x2f15c4[_0x0f26('0x36')]!=='VIRTUAL'){var _0x23faa9={};_0x23faa9[_0x2f15c4[_0x0f26('0x30')]]={'$like':'%'+_0x542156[_0x0f26('0x38')]['filter']+'%'};return _0x23faa9;}})});}_0x262f21=_[_0x0f26('0x44')]({},_0x262f21,_0x542156['options']);var _0x12c0d9={'where':_0x262f21[_0x0f26('0x43')]};return db['Template'][_0x0f26('0x23')](_0x12c0d9)[_0x0f26('0x29')](function(_0xcbae49){_0x43aa70['count']=_0xcbae49;if(_0x542156['query'][_0x0f26('0x45')]){_0x262f21[_0x0f26('0x46')]=[{'all':!![]}];}return db[_0x0f26('0x34')][_0x0f26('0x47')](_0x262f21);})['then'](function(_0x3ff0e1){_0x43aa70[_0x0f26('0x48')]=_0x3ff0e1;return _0x43aa70;})[_0x0f26('0x29')](respondWithFilteredResult(_0x34828d,_0x262f21))[_0x0f26('0x49')](handleError(_0x34828d,null));};exports[_0x0f26('0x4a')]=function(_0x559254,_0x196b8f){var _0x4800f9={'raw':!![],'where':{'id':_0x559254[_0x0f26('0x4b')]['id']}},_0x4d4c01={};_0x4d4c01[_0x0f26('0x3c')]=_['keys'](db[_0x0f26('0x34')]['rawAttributes']);_0x4d4c01[_0x0f26('0x38')]=_['keys'](_0x559254[_0x0f26('0x38')]);_0x4d4c01['filters']=_['intersection'](_0x4d4c01[_0x0f26('0x3c')],_0x4d4c01[_0x0f26('0x38')]);_0x4800f9[_0x0f26('0x3d')]=_[_0x0f26('0x3b')](_0x4d4c01['model'],qs[_0x0f26('0x3e')](_0x559254['query']['fields']));_0x4800f9[_0x0f26('0x3d')]=_0x4800f9[_0x0f26('0x3d')][_0x0f26('0x4c')]?_0x4800f9['attributes']:_0x4d4c01[_0x0f26('0x3c')];if(_0x559254[_0x0f26('0x38')][_0x0f26('0x45')]){_0x4800f9[_0x0f26('0x46')]=[{'all':!![]}];}_0x4800f9=_['merge']({},_0x4800f9,_0x559254['options']);return db['Template'][_0x0f26('0x4d')](_0x4800f9)['then'](handleEntityNotFound(_0x196b8f,null))[_0x0f26('0x29')](respondWithResult(_0x196b8f,null))['catch'](handleError(_0x196b8f,null));};exports[_0x0f26('0x4e')]=function(_0x1b8fe7,_0x5817e4){return db[_0x0f26('0x34')]['create'](_0x1b8fe7[_0x0f26('0x4f')],{})[_0x0f26('0x29')](function(_0x507d1a){var _0x5ecc35=_0x1b8fe7[_0x0f26('0x50')][_0x0f26('0x2b')]({'plain':!![]});if(!_0x5ecc35)throw new Error(_0x0f26('0x51'));if(_0x5ecc35[_0x0f26('0x52')]==='user'){var _0x3b20e7=_0x507d1a[_0x0f26('0x2b')]({'plain':!![]});var _0xf57221=_0x0f26('0x2c');return db['UserProfileSection'][_0x0f26('0x4d')]({'where':{'name':_0xf57221,'userProfileId':_0x5ecc35[_0x0f26('0x53')]},'raw':!![]})[_0x0f26('0x29')](function(_0x2e2cb8){if(_0x2e2cb8&&_0x2e2cb8[_0x0f26('0x54')]===0x0){return db[_0x0f26('0x2d')][_0x0f26('0x4e')]({'name':_0x3b20e7[_0x0f26('0x30')],'resourceId':_0x3b20e7['id'],'type':_0x2e2cb8[_0x0f26('0x30')],'sectionId':_0x2e2cb8['id']},{})[_0x0f26('0x29')](function(){return _0x507d1a;});}else{return _0x507d1a;}})[_0x0f26('0x49')](function(_0x433a58){logger[_0x0f26('0x2e')](_0x0f26('0x55'),_0x433a58);throw _0x433a58;});}return _0x507d1a;})[_0x0f26('0x29')](respondWithResult(_0x5817e4,0xc9))[_0x0f26('0x49')](handleError(_0x5817e4,null));};exports['update']=function(_0x3cc805,_0x3899e){if(_0x3cc805['body']['id']){delete _0x3cc805[_0x0f26('0x4f')]['id'];}return db[_0x0f26('0x34')][_0x0f26('0x4d')]({'where':{'id':_0x3cc805[_0x0f26('0x4b')]['id']}})[_0x0f26('0x29')](handleEntityNotFound(_0x3899e,null))['then'](saveUpdates(_0x3cc805['body'],null))['then'](respondWithResult(_0x3899e,null))[_0x0f26('0x49')](handleError(_0x3899e,null));};exports[_0x0f26('0x2a')]=function(_0xa7df4d,_0x3d2872){return db['Template'][_0x0f26('0x4d')]({'where':{'id':_0xa7df4d['params']['id']}})['then'](handleEntityNotFound(_0x3d2872,null))[_0x0f26('0x29')](removeEntity(_0x3d2872,null))['catch'](handleError(_0x3d2872,null));}; \ No newline at end of file +var _0xed8e=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','catch','show','params','keys','intersection','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x3b88a4,_0x11f9a7){var _0x1917ad=function(_0x4b8c1d){while(--_0x4b8c1d){_0x3b88a4['push'](_0x3b88a4['shift']());}};_0x1917ad(++_0x11f9a7);}(_0xed8e,0x1ac));var _0xeed8=function(_0x1ada80,_0x59a073){_0x1ada80=_0x1ada80-0x0;var _0x55140a=_0xed8e[_0x1ada80];return _0x55140a;};'use strict';var emlformat=require(_0xeed8('0x0'));var rimraf=require(_0xeed8('0x1'));var zipdir=require(_0xeed8('0x2'));var jsonpatch=require(_0xeed8('0x3'));var rp=require('request-promise');var moment=require(_0xeed8('0x4'));var BPromise=require(_0xeed8('0x5'));var Mustache=require(_0xeed8('0x6'));var util=require('util');var path=require(_0xeed8('0x7'));var sox=require(_0xeed8('0x8'));var csv=require(_0xeed8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeed8('0xa'));var _=require('lodash');var squel=require(_0xeed8('0xb'));var crypto=require('crypto');var jsforce=require(_0xeed8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeed8('0xd'));var qs=require(_0xeed8('0xe'));var as=require(_0xeed8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeed8('0x10'))(_0xeed8('0x11'));var utils=require(_0xeed8('0x12'));var config=require(_0xeed8('0x13'));var licenseUtil=require(_0xeed8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c936a,_0x147835){_0x147835=_0x147835||0xcc;return function(_0x1fbf22){if(_0x1fbf22){return _0x5c936a[_0xeed8('0x15')](_0x147835);}return _0x5c936a[_0xeed8('0x16')](_0x147835)[_0xeed8('0x17')]();};}function respondWithResult(_0xe17e41,_0x159cb3){_0x159cb3=_0x159cb3||0xc8;return function(_0x2bde1b){if(_0x2bde1b){return _0xe17e41['status'](_0x159cb3)[_0xeed8('0x18')](_0x2bde1b);}};}function respondWithFilteredResult(_0x3612d8,_0x48da7d){return function(_0x562f9f){if(_0x562f9f){var _0xcc5a61=typeof _0x48da7d['offset']===_0xeed8('0x19')&&typeof _0x48da7d[_0xeed8('0x1a')]===_0xeed8('0x19');var _0xfa9fa7=_0x562f9f[_0xeed8('0x1b')];var _0x3ac09c=_0xcc5a61?0x0:_0x48da7d['offset'];var _0x2e2f79=_0xcc5a61?_0x562f9f[_0xeed8('0x1b')]:_0x48da7d[_0xeed8('0x1c')]+_0x48da7d[_0xeed8('0x1a')];var _0x1b5444;if(_0x2e2f79>=_0xfa9fa7){_0x2e2f79=_0xfa9fa7;_0x1b5444=0xc8;}else{_0x1b5444=0xce;}_0x3612d8[_0xeed8('0x16')](_0x1b5444);return _0x3612d8[_0xeed8('0x1d')](_0xeed8('0x1e'),_0x3ac09c+'-'+_0x2e2f79+'/'+_0xfa9fa7)['json'](_0x562f9f);}return null;};}function patchUpdates(_0x5ef945){return function(_0x45835a){try{jsonpatch['apply'](_0x45835a,_0x5ef945,!![]);}catch(_0x509284){return BPromise[_0xeed8('0x1f')](_0x509284);}return _0x45835a['save']();};}function saveUpdates(_0x37bb79,_0x13d733){return function(_0x18ac25){if(_0x18ac25){return _0x18ac25[_0xeed8('0x20')](_0x37bb79)[_0xeed8('0x21')](function(_0x5d15e1){return _0x5d15e1;});}return null;};}function removeEntity(_0x160323,_0x3c7a5d){return function(_0x28c302){if(_0x28c302){return _0x28c302[_0xeed8('0x22')]()[_0xeed8('0x21')](function(){var _0xd14159=_0x28c302[_0xeed8('0x23')]({'plain':!![]});var _0x232e47=_0xeed8('0x24');return db[_0xeed8('0x25')]['destroy']({'where':{'type':_0x232e47,'resourceId':_0xd14159['id']}})['then'](function(){return _0x28c302;});})[_0xeed8('0x21')](function(){_0x160323[_0xeed8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3317d9,_0x19b304){return function(_0xc9296f){if(!_0xc9296f){_0x3317d9[_0xeed8('0x15')](0x194);}return _0xc9296f;};}function handleError(_0x55bae6,_0x388d3b){_0x388d3b=_0x388d3b||0x1f4;return function(_0x5a2b19){logger[_0xeed8('0x26')](_0x5a2b19[_0xeed8('0x27')]);if(_0x5a2b19[_0xeed8('0x28')]){delete _0x5a2b19[_0xeed8('0x28')];}_0x55bae6[_0xeed8('0x16')](_0x388d3b)[_0xeed8('0x29')](_0x5a2b19);};}exports[_0xeed8('0x2a')]=function(_0x55ac7e,_0x23a01b){var _0x57dc1c={},_0x59ec82={},_0x4eae6b={'count':0x0,'rows':[]};var _0x53e557=_[_0xeed8('0x2b')](db[_0xeed8('0x2c')][_0xeed8('0x2d')],function(_0x2c8af6){return{'name':_0x2c8af6[_0xeed8('0x2e')],'type':_0x2c8af6[_0xeed8('0x2f')][_0xeed8('0x30')]};});_0x59ec82[_0xeed8('0x31')]=_[_0xeed8('0x2b')](_0x53e557,'name');_0x59ec82[_0xeed8('0x32')]=_['keys'](_0x55ac7e[_0xeed8('0x32')]);_0x59ec82[_0xeed8('0x33')]=_['intersection'](_0x59ec82['model'],_0x59ec82[_0xeed8('0x32')]);_0x57dc1c[_0xeed8('0x34')]=_['intersection'](_0x59ec82[_0xeed8('0x31')],qs['fields'](_0x55ac7e[_0xeed8('0x32')][_0xeed8('0x35')]));_0x57dc1c['attributes']=_0x57dc1c[_0xeed8('0x34')][_0xeed8('0x36')]?_0x57dc1c[_0xeed8('0x34')]:_0x59ec82['model'];if(!_0x55ac7e[_0xeed8('0x32')][_0xeed8('0x37')](_0xeed8('0x38'))){_0x57dc1c['limit']=qs[_0xeed8('0x1a')](_0x55ac7e['query']['limit']);_0x57dc1c[_0xeed8('0x1c')]=qs[_0xeed8('0x1c')](_0x55ac7e['query'][_0xeed8('0x1c')]);}_0x57dc1c[_0xeed8('0x39')]=qs[_0xeed8('0x3a')](_0x55ac7e[_0xeed8('0x32')][_0xeed8('0x3a')]);_0x57dc1c[_0xeed8('0x3b')]=qs[_0xeed8('0x33')](_[_0xeed8('0x3c')](_0x55ac7e[_0xeed8('0x32')],_0x59ec82[_0xeed8('0x33')]),_0x53e557);if(_0x55ac7e[_0xeed8('0x32')]['filter']){_0x57dc1c[_0xeed8('0x3b')]=_['merge'](_0x57dc1c['where'],{'$or':_[_0xeed8('0x2b')](_0x53e557,function(_0x2a0538){if(_0x2a0538['type']!=='VIRTUAL'){var _0x4aeb0a={};_0x4aeb0a[_0x2a0538['name']]={'$like':'%'+_0x55ac7e[_0xeed8('0x32')]['filter']+'%'};return _0x4aeb0a;}})});}_0x57dc1c=_[_0xeed8('0x3d')]({},_0x57dc1c,_0x55ac7e[_0xeed8('0x3e')]);var _0x12f66c={'where':_0x57dc1c[_0xeed8('0x3b')]};return db[_0xeed8('0x2c')][_0xeed8('0x1b')](_0x12f66c)[_0xeed8('0x21')](function(_0x2be6a9){_0x4eae6b[_0xeed8('0x1b')]=_0x2be6a9;if(_0x55ac7e[_0xeed8('0x32')]['includeAll']){_0x57dc1c[_0xeed8('0x3f')]=[{'all':!![]}];}return db[_0xeed8('0x2c')][_0xeed8('0x40')](_0x57dc1c);})[_0xeed8('0x21')](function(_0x7658f2){_0x4eae6b['rows']=_0x7658f2;return _0x4eae6b;})[_0xeed8('0x21')](respondWithFilteredResult(_0x23a01b,_0x57dc1c))[_0xeed8('0x41')](handleError(_0x23a01b,null));};exports[_0xeed8('0x42')]=function(_0x542f02,_0x592b0e){var _0x81a6f6={'raw':!![],'where':{'id':_0x542f02[_0xeed8('0x43')]['id']}},_0x4651cb={};_0x4651cb[_0xeed8('0x31')]=_[_0xeed8('0x44')](db[_0xeed8('0x2c')]['rawAttributes']);_0x4651cb[_0xeed8('0x32')]=_[_0xeed8('0x44')](_0x542f02[_0xeed8('0x32')]);_0x4651cb[_0xeed8('0x33')]=_[_0xeed8('0x45')](_0x4651cb[_0xeed8('0x31')],_0x4651cb['query']);_0x81a6f6['attributes']=_[_0xeed8('0x45')](_0x4651cb[_0xeed8('0x31')],qs[_0xeed8('0x35')](_0x542f02[_0xeed8('0x32')]['fields']));_0x81a6f6[_0xeed8('0x34')]=_0x81a6f6['attributes'][_0xeed8('0x36')]?_0x81a6f6[_0xeed8('0x34')]:_0x4651cb[_0xeed8('0x31')];if(_0x542f02[_0xeed8('0x32')][_0xeed8('0x46')]){_0x81a6f6[_0xeed8('0x3f')]=[{'all':!![]}];}_0x81a6f6=_[_0xeed8('0x3d')]({},_0x81a6f6,_0x542f02[_0xeed8('0x3e')]);return db['Template']['find'](_0x81a6f6)[_0xeed8('0x21')](handleEntityNotFound(_0x592b0e,null))[_0xeed8('0x21')](respondWithResult(_0x592b0e,null))[_0xeed8('0x41')](handleError(_0x592b0e,null));};exports[_0xeed8('0x47')]=function(_0x3a14f0,_0x538f41){return db[_0xeed8('0x2c')][_0xeed8('0x47')](_0x3a14f0[_0xeed8('0x48')],{})[_0xeed8('0x21')](function(_0x231c89){var _0x4d9133=_0x3a14f0[_0xeed8('0x49')]['get']({'plain':!![]});if(!_0x4d9133)throw new Error(_0xeed8('0x4a'));if(_0x4d9133[_0xeed8('0x4b')]==='user'){var _0x2aa366=_0x231c89[_0xeed8('0x23')]({'plain':!![]});var _0x2f1c38='Templates';return db['UserProfileSection'][_0xeed8('0x4c')]({'where':{'name':_0x2f1c38,'userProfileId':_0x4d9133[_0xeed8('0x4d')]},'raw':!![]})['then'](function(_0x593b99){if(_0x593b99&&_0x593b99[_0xeed8('0x4e')]===0x0){return db[_0xeed8('0x25')]['create']({'name':_0x2aa366[_0xeed8('0x28')],'resourceId':_0x2aa366['id'],'type':_0x593b99[_0xeed8('0x28')],'sectionId':_0x593b99['id']},{})[_0xeed8('0x21')](function(){return _0x231c89;});}else{return _0x231c89;}})[_0xeed8('0x41')](function(_0x1c460c){logger[_0xeed8('0x26')](_0xeed8('0x4f'),_0x1c460c);throw _0x1c460c;});}return _0x231c89;})[_0xeed8('0x21')](respondWithResult(_0x538f41,0xc9))[_0xeed8('0x41')](handleError(_0x538f41,null));};exports[_0xeed8('0x20')]=function(_0x4ec211,_0x698021){if(_0x4ec211[_0xeed8('0x48')]['id']){delete _0x4ec211[_0xeed8('0x48')]['id'];}return db[_0xeed8('0x2c')][_0xeed8('0x4c')]({'where':{'id':_0x4ec211[_0xeed8('0x43')]['id']}})[_0xeed8('0x21')](handleEntityNotFound(_0x698021,null))[_0xeed8('0x21')](saveUpdates(_0x4ec211['body'],null))['then'](respondWithResult(_0x698021,null))['catch'](handleError(_0x698021,null));};exports['destroy']=function(_0x1f1e1a,_0x560c96){return db[_0xeed8('0x2c')][_0xeed8('0x4c')]({'where':{'id':_0x1f1e1a['params']['id']}})[_0xeed8('0x21')](handleEntityNotFound(_0x560c96,null))['then'](removeEntity(_0x560c96,null))[_0xeed8('0x41')](handleError(_0x560c96,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0384b76..98519f2 100644 --- a/server/api/template/template.model.js +++ b/server/api/template/template.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd955=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0xb1d704,_0xb06c94){var _0x40a59e=function(_0x1c5dc8){while(--_0x1c5dc8){_0xb1d704['push'](_0xb1d704['shift']());}};_0x40a59e(++_0xb06c94);}(_0xd955,0x12a));var _0x5d95=function(_0x4b68a2,_0x432dfa){_0x4b68a2=_0x4b68a2-0x0;var _0x50907b=_0xd955[_0x4b68a2];return _0x50907b;};'use strict';var _=require(_0x5d95('0x0'));var util=require(_0x5d95('0x1'));var logger=require(_0x5d95('0x2'))('api');var moment=require(_0x5d95('0x3'));var BPromise=require(_0x5d95('0x4'));var rp=require(_0x5d95('0x5'));var fs=require('fs');var path=require(_0x5d95('0x6'));var rimraf=require('rimraf');var config=require(_0x5d95('0x7'));var attributes=require(_0x5d95('0x8'));module[_0x5d95('0x9')]=function(_0x3eba3a,_0x34c4b6){return _0x3eba3a[_0x5d95('0xa')]('Template',attributes,{'tableName':_0x5d95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e21=['moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','util','api'];(function(_0x28f977,_0x2bd1fa){var _0x3f0f24=function(_0x3a2073){while(--_0x3a2073){_0x28f977['push'](_0x28f977['shift']());}};_0x3f0f24(++_0x2bd1fa);}(_0x7e21,0x1ba));var _0x17e2=function(_0x38e030,_0x1067fd){_0x38e030=_0x38e030-0x0;var _0x397576=_0x7e21[_0x38e030];return _0x397576;};'use strict';var _=require('lodash');var util=require(_0x17e2('0x0'));var logger=require('../../config/logger')(_0x17e2('0x1'));var moment=require(_0x17e2('0x2'));var BPromise=require('bluebird');var rp=require(_0x17e2('0x3'));var fs=require('fs');var path=require(_0x17e2('0x4'));var rimraf=require(_0x17e2('0x5'));var config=require(_0x17e2('0x6'));var attributes=require(_0x17e2('0x7'));module[_0x17e2('0x8')]=function(_0x10161a,_0x127264){return _0x10161a[_0x17e2('0x9')](_0x17e2('0xa'),attributes,{'tableName':_0x17e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 7b9573e..84a8a33 100644 --- a/server/api/template/template.rpc.js +++ b/server/api/template/template.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4ea=['jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','limit','include','model','map','attributes','lodash','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe4ea,0x18e));var _0xae4e=function(_0x52733d,_0x361963){_0x52733d=_0x52733d-0x0;var _0x331973=_0xe4ea[_0x52733d];return _0x331973;};'use strict';var _=require(_0xae4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xae4e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae4e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xae4e('0x3'))(_0xae4e('0x4'));var config=require('../../config/environment');var jayson=require(_0xae4e('0x5'));var client=jayson[_0xae4e('0x6')][_0xae4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d3e1e,_0x5e6842,_0x305bb5){return new BPromise(function(_0x667801,_0x555063){return client[_0xae4e('0x8')](_0x5d3e1e,_0x305bb5)[_0xae4e('0x9')](function(_0x543c8a){logger[_0xae4e('0xa')](_0xae4e('0xb'),_0x5e6842,'request\x20sent');logger[_0xae4e('0xc')](_0xae4e('0xd'),_0x5e6842,'request\x20sent',JSON[_0xae4e('0xe')](_0x543c8a));if(_0x543c8a[_0xae4e('0xf')]){if(_0x543c8a[_0xae4e('0xf')][_0xae4e('0x10')]===0x1f4){logger[_0xae4e('0xf')](_0xae4e('0xb'),_0x5e6842,_0x543c8a[_0xae4e('0xf')]['message']);return _0x555063(_0x543c8a[_0xae4e('0xf')][_0xae4e('0x11')]);}logger['error'](_0xae4e('0xb'),_0x5e6842,_0x543c8a[_0xae4e('0xf')]['message']);return _0x667801(_0x543c8a['error'][_0xae4e('0x11')]);}else{logger[_0xae4e('0xa')](_0xae4e('0xb'),_0x5e6842,'request\x20sent');_0x667801(_0x543c8a[_0xae4e('0x12')]['message']);}})[_0xae4e('0x13')](function(_0xdb9548){logger[_0xae4e('0xf')](_0xae4e('0xb'),_0x5e6842,_0xdb9548);_0x555063(_0xdb9548);});});}exports[_0xae4e('0x14')]=function(_0x3daa9e){var _0x5048b1=this;return new Promise(function(_0x41a96a,_0x5f4108){return db[_0xae4e('0x15')][_0xae4e('0x16')]({'raw':_0x3daa9e[_0xae4e('0x17')]?_0x3daa9e['options'][_0xae4e('0x18')]===undefined?!![]:![]:!![],'where':_0x3daa9e[_0xae4e('0x17')]?_0x3daa9e['options'][_0xae4e('0x19')]||null:null,'attributes':_0x3daa9e[_0xae4e('0x17')]?_0x3daa9e[_0xae4e('0x17')]['attributes']||null:null,'limit':_0x3daa9e['options']?_0x3daa9e[_0xae4e('0x17')][_0xae4e('0x1a')]||null:null,'include':_0x3daa9e['options']?_0x3daa9e['options'][_0xae4e('0x1b')]?_['map'](_0x3daa9e[_0xae4e('0x17')]['include'],function(_0x396117){return{'model':db[_0x396117[_0xae4e('0x1c')]],'as':_0x396117['as'],'attributes':_0x396117['attributes'],'include':_0x396117['include']?_[_0xae4e('0x1d')](_0x396117['include'],function(_0x2d6404){return{'model':db[_0x2d6404['model']],'as':_0x2d6404['as'],'attributes':_0x2d6404[_0xae4e('0x1e')],'include':_0x2d6404[_0xae4e('0x1b')]?_[_0xae4e('0x1d')](_0x2d6404[_0xae4e('0x1b')],function(_0x26d722){return{'model':db[_0x26d722[_0xae4e('0x1c')]],'as':_0x26d722['as'],'attributes':_0x26d722[_0xae4e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xae4e('0x9')](function(_0x2beb42){logger[_0xae4e('0xa')](_0xae4e('0x14'),_0x3daa9e);logger[_0xae4e('0xc')](_0xae4e('0x14'),_0x3daa9e,JSON[_0xae4e('0xe')](_0x2beb42));_0x41a96a(_0x2beb42);})['catch'](function(_0x536b66){logger[_0xae4e('0xf')](_0xae4e('0x14'),_0x536b66[_0xae4e('0x11')],_0x3daa9e);_0x5f4108(_0x5048b1[_0xae4e('0xf')](0x1f4,_0x536b66[_0xae4e('0x11')]));});});}; \ No newline at end of file +var _0x22c9=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where','limit','include','model','attributes','map','catch','lodash'];(function(_0x226190,_0x95f7b1){var _0x253fe7=function(_0x5c3a90){while(--_0x5c3a90){_0x226190['push'](_0x226190['shift']());}};_0x253fe7(++_0x95f7b1);}(_0x22c9,0x8b));var _0x922c=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0x22c9[_0x447725];return _0x399167;};'use strict';var _=require(_0x922c('0x0'));var util=require(_0x922c('0x1'));var moment=require(_0x922c('0x2'));var BPromise=require(_0x922c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x922c('0x4'))['db'];var utils=require(_0x922c('0x5'));var logger=require(_0x922c('0x6'))(_0x922c('0x7'));var config=require(_0x922c('0x8'));var jayson=require(_0x922c('0x9'));var client=jayson[_0x922c('0xa')][_0x922c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35451c,_0x1408d3,_0x395fc1){return new BPromise(function(_0xe8b783,_0x9fac83){return client[_0x922c('0xc')](_0x35451c,_0x395fc1)[_0x922c('0xd')](function(_0x5b4599){logger['info']('Template,\x20%s,\x20%s',_0x1408d3,'request\x20sent');logger[_0x922c('0xe')](_0x922c('0xf'),_0x1408d3,_0x922c('0x10'),JSON[_0x922c('0x11')](_0x5b4599));if(_0x5b4599[_0x922c('0x12')]){if(_0x5b4599[_0x922c('0x12')][_0x922c('0x13')]===0x1f4){logger['error'](_0x922c('0x14'),_0x1408d3,_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);return _0x9fac83(_0x5b4599['error']['message']);}logger['error']('Template,\x20%s,\x20%s',_0x1408d3,_0x5b4599['error'][_0x922c('0x15')]);return _0xe8b783(_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);}else{logger['info'](_0x922c('0x14'),_0x1408d3,'request\x20sent');_0xe8b783(_0x5b4599[_0x922c('0x16')][_0x922c('0x15')]);}})['catch'](function(_0x567856){logger[_0x922c('0x12')]('Template,\x20%s,\x20%s',_0x1408d3,_0x567856);_0x9fac83(_0x567856);});});}exports[_0x922c('0x17')]=function(_0x4efbf8){var _0x4a9e0=this;return new Promise(function(_0x50113d,_0x104a85){return db[_0x922c('0x18')][_0x922c('0x19')]({'raw':_0x4efbf8[_0x922c('0x1a')]?_0x4efbf8[_0x922c('0x1a')][_0x922c('0x1b')]===undefined?!![]:![]:!![],'where':_0x4efbf8[_0x922c('0x1a')]?_0x4efbf8[_0x922c('0x1a')][_0x922c('0x1c')]||null:null,'attributes':_0x4efbf8[_0x922c('0x1a')]?_0x4efbf8[_0x922c('0x1a')]['attributes']||null:null,'limit':_0x4efbf8[_0x922c('0x1a')]?_0x4efbf8[_0x922c('0x1a')][_0x922c('0x1d')]||null:null,'include':_0x4efbf8[_0x922c('0x1a')]?_0x4efbf8[_0x922c('0x1a')]['include']?_['map'](_0x4efbf8[_0x922c('0x1a')][_0x922c('0x1e')],function(_0x296144){return{'model':db[_0x296144[_0x922c('0x1f')]],'as':_0x296144['as'],'attributes':_0x296144[_0x922c('0x20')],'include':_0x296144[_0x922c('0x1e')]?_[_0x922c('0x21')](_0x296144[_0x922c('0x1e')],function(_0x1cdede){return{'model':db[_0x1cdede[_0x922c('0x1f')]],'as':_0x1cdede['as'],'attributes':_0x1cdede[_0x922c('0x20')],'include':_0x1cdede['include']?_[_0x922c('0x21')](_0x1cdede[_0x922c('0x1e')],function(_0x36b87b){return{'model':db[_0x36b87b[_0x922c('0x1f')]],'as':_0x36b87b['as'],'attributes':_0x36b87b[_0x922c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x922c('0xd')](function(_0x532b64){logger['info'](_0x922c('0x17'),_0x4efbf8);logger[_0x922c('0xe')](_0x922c('0x17'),_0x4efbf8,JSON[_0x922c('0x11')](_0x532b64));_0x50113d(_0x532b64);})[_0x922c('0x22')](function(_0x2937b6){logger[_0x922c('0x12')](_0x922c('0x17'),_0x2937b6[_0x922c('0x15')],_0x4efbf8);_0x104a85(_0x4a9e0[_0x922c('0x12')](0x1f4,_0x2937b6[_0x922c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index cb0cbd5..2dcdf6f 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb46=['../../config/environment','get','isAuthenticated','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x106ad1,_0x53253b){var _0x24ca40=function(_0x2bca94){while(--_0x2bca94){_0x106ad1['push'](_0x106ad1['shift']());}};_0x24ca40(++_0x53253b);}(_0xbb46,0x80));var _0x6bb4=function(_0x58cad0,_0x275180){_0x58cad0=_0x58cad0-0x0;var _0x534036=_0xbb46[_0x58cad0];return _0x534036;};'use strict';var multer=require(_0x6bb4('0x0'));var util=require(_0x6bb4('0x1'));var path=require(_0x6bb4('0x2'));var timeout=require(_0x6bb4('0x3'));var express=require(_0x6bb4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6bb4('0x5'));var interaction=require(_0x6bb4('0x6'));var config=require(_0x6bb4('0x7'));var controller=require('./trigger.controller');router[_0x6bb4('0x8')]('/',auth[_0x6bb4('0x9')](),controller['index']);router[_0x6bb4('0x8')](_0x6bb4('0xa'),auth[_0x6bb4('0x9')](),controller[_0x6bb4('0xb')]);router[_0x6bb4('0x8')]('/:id/all_conditions',auth[_0x6bb4('0x9')](),controller[_0x6bb4('0xc')]);router[_0x6bb4('0x8')](_0x6bb4('0xd'),auth[_0x6bb4('0x9')](),controller[_0x6bb4('0xe')]);router[_0x6bb4('0x8')](_0x6bb4('0xf'),auth[_0x6bb4('0x9')](),controller[_0x6bb4('0x10')]);router[_0x6bb4('0x11')]('/',auth[_0x6bb4('0x9')](),controller[_0x6bb4('0x12')]);router[_0x6bb4('0x11')](_0x6bb4('0x13'),auth[_0x6bb4('0x9')](),controller[_0x6bb4('0x14')]);router[_0x6bb4('0x11')](_0x6bb4('0xd'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x6bb4('0x11')](_0x6bb4('0xf'),auth[_0x6bb4('0x9')](),controller[_0x6bb4('0x15')]);router[_0x6bb4('0x16')]('/:id',auth[_0x6bb4('0x9')](),controller[_0x6bb4('0x17')]);router[_0x6bb4('0x18')](_0x6bb4('0xa'),auth[_0x6bb4('0x9')](),controller[_0x6bb4('0x19')]);module[_0x6bb4('0x1a')]=router; \ No newline at end of file +var _0xdb00=['show','/:id/all_conditions','getAnyConditions','getActions','post','create','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated'];(function(_0x4f373d,_0x273ace){var _0x5f0200=function(_0x4ebc54){while(--_0x4ebc54){_0x4f373d['push'](_0x4f373d['shift']());}};_0x5f0200(++_0x273ace);}(_0xdb00,0x1bd));var _0x0db0=function(_0xf2f46b,_0x89cf58){_0xf2f46b=_0xf2f46b-0x0;var _0x382051=_0xdb00[_0xf2f46b];return _0x382051;};'use strict';var multer=require('multer');var util=require(_0x0db0('0x0'));var path=require(_0x0db0('0x1'));var timeout=require(_0x0db0('0x2'));var express=require(_0x0db0('0x3'));var router=express[_0x0db0('0x4')]();var fs_extra=require(_0x0db0('0x5'));var auth=require(_0x0db0('0x6'));var interaction=require(_0x0db0('0x7'));var config=require(_0x0db0('0x8'));var controller=require(_0x0db0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0db0('0xa')]);router[_0x0db0('0xb')](_0x0db0('0xc'),auth[_0x0db0('0xd')](),controller[_0x0db0('0xe')]);router['get'](_0x0db0('0xf'),auth[_0x0db0('0xd')](),controller['getAllConditions']);router[_0x0db0('0xb')]('/:id/any_conditions',auth[_0x0db0('0xd')](),controller[_0x0db0('0x10')]);router[_0x0db0('0xb')]('/:id/actions',auth['isAuthenticated'](),controller[_0x0db0('0x11')]);router[_0x0db0('0x12')]('/',auth['isAuthenticated'](),controller[_0x0db0('0x13')]);router[_0x0db0('0x12')](_0x0db0('0xf'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x0db0('0x12')](_0x0db0('0x14'),auth['isAuthenticated'](),controller[_0x0db0('0x15')]);router[_0x0db0('0x12')](_0x0db0('0x16'),auth[_0x0db0('0xd')](),controller[_0x0db0('0x17')]);router['put']('/:id',auth[_0x0db0('0xd')](),controller['update']);router[_0x0db0('0x18')](_0x0db0('0xc'),auth['isAuthenticated'](),controller[_0x0db0('0x19')]);module[_0x0db0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 80e27ba..f5213de 100644 --- a/server/api/trigger/trigger.attributes.js +++ b/server/api/trigger/trigger.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a27=['sequelize','STRING'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x3a27,0x1bc));var _0x73a2=function(_0xda00ab,_0x5bc099){_0xda00ab=_0xda00ab-0x0;var _0x39fbe4=_0x3a27[_0xda00ab];return _0x39fbe4;};'use strict';var Sequelize=require(_0x73a2('0x0'));module['exports']={'name':{'type':Sequelize[_0x73a2('0x1')]},'channel':{'type':Sequelize[_0x73a2('0x1')]},'description':{'type':Sequelize[_0x73a2('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf65f=['STRING','BOOLEAN','exports'];(function(_0x5b9874,_0x327bd2){var _0x3c38ff=function(_0x44dd30){while(--_0x44dd30){_0x5b9874['push'](_0x5b9874['shift']());}};_0x3c38ff(++_0x327bd2);}(_0xf65f,0xf8));var _0xff65=function(_0x13b870,_0x58d7e7){_0x13b870=_0x13b870-0x0;var _0x512e01=_0xf65f[_0x13b870];return _0x512e01;};'use strict';var Sequelize=require('sequelize');module[_0xff65('0x0')]={'name':{'type':Sequelize[_0xff65('0x1')]},'channel':{'type':Sequelize[_0xff65('0x1')]},'description':{'type':Sequelize[_0xff65('0x1')]},'status':{'type':Sequelize[_0xff65('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index e254538..6b2040f 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55dc=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','getAllConditions','findOne','filter','getAnyConditions','addAction','TriggerId','getActions','rimraf'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x55dc,0xbf));var _0xc55d=function(_0x1cb7b9,_0x1d2489){_0x1cb7b9=_0x1cb7b9-0x0;var _0x13f4a3=_0x55dc[_0x1cb7b9];return _0x13f4a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc55d('0x0'));var zipdir=require(_0xc55d('0x1'));var jsonpatch=require(_0xc55d('0x2'));var rp=require(_0xc55d('0x3'));var moment=require(_0xc55d('0x4'));var BPromise=require(_0xc55d('0x5'));var Mustache=require('mustache');var util=require(_0xc55d('0x6'));var path=require(_0xc55d('0x7'));var sox=require(_0xc55d('0x8'));var csv=require(_0xc55d('0x9'));var ejs=require(_0xc55d('0xa'));var fs=require('fs');var fs_extra=require(_0xc55d('0xb'));var _=require(_0xc55d('0xc'));var squel=require(_0xc55d('0xd'));var crypto=require(_0xc55d('0xe'));var jsforce=require(_0xc55d('0xf'));var deskjs=require(_0xc55d('0x10'));var toCsv=require(_0xc55d('0x9'));var querystring=require(_0xc55d('0x11'));var Papa=require('papaparse');var Redis=require(_0xc55d('0x12'));var authService=require(_0xc55d('0x13'));var qs=require(_0xc55d('0x14'));var as=require(_0xc55d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc55d('0x16'))(_0xc55d('0x17'));var utils=require(_0xc55d('0x18'));var config=require(_0xc55d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc55d('0x1a'))['db'];function respondWithStatusCode(_0x441f42,_0x43ff5d){_0x43ff5d=_0x43ff5d||0xcc;return function(_0x1dc958){if(_0x1dc958){return _0x441f42[_0xc55d('0x1b')](_0x43ff5d);}return _0x441f42['status'](_0x43ff5d)[_0xc55d('0x1c')]();};}function respondWithResult(_0x559c10,_0x5ae0eb){_0x5ae0eb=_0x5ae0eb||0xc8;return function(_0x16e5fb){if(_0x16e5fb){return _0x559c10[_0xc55d('0x1d')](_0x5ae0eb)[_0xc55d('0x1e')](_0x16e5fb);}};}function respondWithFilteredResult(_0x499d61,_0x2d1e2f){return function(_0x338582){if(_0x338582){var _0xbec60f=typeof _0x2d1e2f['offset']===_0xc55d('0x1f')&&typeof _0x2d1e2f['limit']===_0xc55d('0x1f');var _0x4419ba=_0x338582[_0xc55d('0x20')];var _0x215e15=_0xbec60f?0x0:_0x2d1e2f[_0xc55d('0x21')];var _0x3e2144=_0xbec60f?_0x338582[_0xc55d('0x20')]:_0x2d1e2f['offset']+_0x2d1e2f[_0xc55d('0x22')];var _0xb9dd28;if(_0x3e2144>=_0x4419ba){_0x3e2144=_0x4419ba;_0xb9dd28=0xc8;}else{_0xb9dd28=0xce;}_0x499d61[_0xc55d('0x1d')](_0xb9dd28);return _0x499d61[_0xc55d('0x23')](_0xc55d('0x24'),_0x215e15+'-'+_0x3e2144+'/'+_0x4419ba)[_0xc55d('0x1e')](_0x338582);}return null;};}function patchUpdates(_0x18ae03){return function(_0x397584){try{jsonpatch[_0xc55d('0x25')](_0x397584,_0x18ae03,!![]);}catch(_0x53071a){return BPromise['reject'](_0x53071a);}return _0x397584[_0xc55d('0x26')]();};}function saveUpdates(_0x222cca,_0x21888e){return function(_0x22dc57){if(_0x22dc57){return _0x22dc57[_0xc55d('0x27')](_0x222cca)[_0xc55d('0x28')](function(_0x53820e){return _0x53820e;});}return null;};}function removeEntity(_0x48eb7a,_0x3bb9d6){return function(_0x424889){if(_0x424889){return _0x424889[_0xc55d('0x29')]()[_0xc55d('0x28')](function(){var _0x2b188e=_0x424889[_0xc55d('0x2a')]({'plain':!![]});var _0x3de6fa=_0xc55d('0x2b');return db[_0xc55d('0x2c')][_0xc55d('0x29')]({'where':{'type':_0x3de6fa,'resourceId':_0x2b188e['id']}})[_0xc55d('0x28')](function(){return _0x424889;});})[_0xc55d('0x28')](function(){_0x48eb7a['status'](0xcc)[_0xc55d('0x1c')]();});}};}function handleEntityNotFound(_0x2201a7,_0x37507b){return function(_0x5c3370){if(!_0x5c3370){_0x2201a7[_0xc55d('0x1b')](0x194);}return _0x5c3370;};}function handleError(_0x4b120d,_0x318b77){_0x318b77=_0x318b77||0x1f4;return function(_0x3b0d72){logger['error'](_0x3b0d72[_0xc55d('0x2d')]);if(_0x3b0d72[_0xc55d('0x2e')]){delete _0x3b0d72[_0xc55d('0x2e')];}_0x4b120d[_0xc55d('0x1d')](_0x318b77)[_0xc55d('0x2f')](_0x3b0d72);};}exports[_0xc55d('0x30')]=function(_0x24113e,_0x40f3bc){var _0x3dc02c={},_0x4d1e01={},_0x152105={'count':0x0,'rows':[]};var _0x3f8323=_[_0xc55d('0x31')](db[_0xc55d('0x32')][_0xc55d('0x33')],function(_0x1a00c8){return{'name':_0x1a00c8[_0xc55d('0x34')],'type':_0x1a00c8[_0xc55d('0x35')][_0xc55d('0x36')]};});_0x4d1e01[_0xc55d('0x37')]=_[_0xc55d('0x31')](_0x3f8323,_0xc55d('0x2e'));_0x4d1e01['query']=_[_0xc55d('0x38')](_0x24113e['query']);_0x4d1e01['filters']=_[_0xc55d('0x39')](_0x4d1e01['model'],_0x4d1e01[_0xc55d('0x3a')]);_0x3dc02c['attributes']=_['intersection'](_0x4d1e01[_0xc55d('0x37')],qs['fields'](_0x24113e[_0xc55d('0x3a')][_0xc55d('0x3b')]));_0x3dc02c[_0xc55d('0x3c')]=_0x3dc02c[_0xc55d('0x3c')]['length']?_0x3dc02c[_0xc55d('0x3c')]:_0x4d1e01[_0xc55d('0x37')];if(!_0x24113e['query'][_0xc55d('0x3d')](_0xc55d('0x3e'))){_0x3dc02c['limit']=qs['limit'](_0x24113e[_0xc55d('0x3a')][_0xc55d('0x22')]);_0x3dc02c[_0xc55d('0x21')]=qs['offset'](_0x24113e[_0xc55d('0x3a')][_0xc55d('0x21')]);}_0x3dc02c[_0xc55d('0x3f')]=qs[_0xc55d('0x40')](_0x24113e['query'][_0xc55d('0x40')]);_0x3dc02c[_0xc55d('0x41')]=qs['filters'](_[_0xc55d('0x42')](_0x24113e[_0xc55d('0x3a')],_0x4d1e01[_0xc55d('0x43')]),_0x3f8323);if(_0x24113e[_0xc55d('0x3a')]['filter']){_0x3dc02c[_0xc55d('0x41')]=_['merge'](_0x3dc02c['where'],{'$or':_[_0xc55d('0x31')](_0x3f8323,function(_0x621467){if(_0x621467['type']!=='VIRTUAL'){var _0x20e77e={};_0x20e77e[_0x621467[_0xc55d('0x2e')]]={'$like':'%'+_0x24113e[_0xc55d('0x3a')]['filter']+'%'};return _0x20e77e;}})});}_0x3dc02c=_[_0xc55d('0x44')]({},_0x3dc02c,_0x24113e[_0xc55d('0x45')]);var _0x5e4691={'where':_0x3dc02c[_0xc55d('0x41')]};return db[_0xc55d('0x32')]['count'](_0x5e4691)[_0xc55d('0x28')](function(_0x18a52b){_0x152105[_0xc55d('0x20')]=_0x18a52b;if(_0x24113e[_0xc55d('0x3a')][_0xc55d('0x46')]){_0x3dc02c[_0xc55d('0x47')]=[{'all':!![]}];}return db[_0xc55d('0x32')][_0xc55d('0x48')](_0x3dc02c);})[_0xc55d('0x28')](function(_0x41a847){_0x152105[_0xc55d('0x49')]=_0x41a847;return _0x152105;})[_0xc55d('0x28')](respondWithFilteredResult(_0x40f3bc,_0x3dc02c))[_0xc55d('0x4a')](handleError(_0x40f3bc,null));};exports[_0xc55d('0x4b')]=function(_0x3203c5,_0x14c031){var _0x2a4f37={'raw':![],'where':{'id':_0x3203c5['params']['id']}},_0x455c49={};_0x455c49[_0xc55d('0x37')]=_[_0xc55d('0x38')](db[_0xc55d('0x32')][_0xc55d('0x33')]);_0x455c49['query']=_['keys'](_0x3203c5[_0xc55d('0x3a')]);_0x455c49[_0xc55d('0x43')]=_[_0xc55d('0x39')](_0x455c49['model'],_0x455c49['query']);_0x2a4f37[_0xc55d('0x3c')]=_[_0xc55d('0x39')](_0x455c49['model'],qs['fields'](_0x3203c5[_0xc55d('0x3a')]['fields']));_0x2a4f37['attributes']=_0x2a4f37[_0xc55d('0x3c')][_0xc55d('0x4c')]?_0x2a4f37[_0xc55d('0x3c')]:_0x455c49['model'];if(_0x3203c5[_0xc55d('0x3a')][_0xc55d('0x46')]){_0x2a4f37[_0xc55d('0x47')]=[{'all':!![]}];}_0x2a4f37=_[_0xc55d('0x44')]({},_0x2a4f37,_0x3203c5[_0xc55d('0x45')]);return db[_0xc55d('0x32')][_0xc55d('0x4d')](_0x2a4f37)[_0xc55d('0x28')](handleEntityNotFound(_0x14c031,null))['then'](respondWithResult(_0x14c031,null))[_0xc55d('0x4a')](handleError(_0x14c031,null));};exports[_0xc55d('0x4e')]=function(_0x1d1c1b,_0x21dcb0){return db[_0xc55d('0x32')][_0xc55d('0x4e')](_0x1d1c1b[_0xc55d('0x4f')],{})[_0xc55d('0x28')](function(_0x134ec9){var _0x253fba=_0x1d1c1b[_0xc55d('0x50')][_0xc55d('0x2a')]({'plain':!![]});if(!_0x253fba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x253fba[_0xc55d('0x51')]===_0xc55d('0x50')){var _0x56dd00=_0x134ec9[_0xc55d('0x2a')]({'plain':!![]});var _0xef66b8=_0xc55d('0x2b');return db[_0xc55d('0x52')][_0xc55d('0x4d')]({'where':{'name':_0xef66b8,'userProfileId':_0x253fba[_0xc55d('0x53')]},'raw':!![]})[_0xc55d('0x28')](function(_0x3ea37a){if(_0x3ea37a&&_0x3ea37a[_0xc55d('0x54')]===0x0){return db[_0xc55d('0x2c')][_0xc55d('0x4e')]({'name':_0x56dd00[_0xc55d('0x2e')],'resourceId':_0x56dd00['id'],'type':_0x3ea37a['name'],'sectionId':_0x3ea37a['id']},{})[_0xc55d('0x28')](function(){return _0x134ec9;});}else{return _0x134ec9;}})[_0xc55d('0x4a')](function(_0x3405b6){logger['error'](_0xc55d('0x55'),_0x3405b6);throw _0x3405b6;});}return _0x134ec9;})[_0xc55d('0x28')](respondWithResult(_0x21dcb0,0xc9))[_0xc55d('0x4a')](handleError(_0x21dcb0,null));};exports[_0xc55d('0x27')]=function(_0x1afad4,_0x54d9da){if(_0x1afad4[_0xc55d('0x4f')]['id']){delete _0x1afad4[_0xc55d('0x4f')]['id'];}return db['Trigger'][_0xc55d('0x4d')]({'where':{'id':_0x1afad4[_0xc55d('0x56')]['id']}})[_0xc55d('0x28')](handleEntityNotFound(_0x54d9da,null))['then'](saveUpdates(_0x1afad4['body'],null))[_0xc55d('0x28')](respondWithResult(_0x54d9da,null))[_0xc55d('0x4a')](handleError(_0x54d9da,null));};exports[_0xc55d('0x29')]=function(_0x2cade0,_0x455dc3){return db[_0xc55d('0x32')]['find']({'where':{'id':_0x2cade0[_0xc55d('0x56')]['id']}})['then'](handleEntityNotFound(_0x455dc3,null))[_0xc55d('0x28')](removeEntity(_0x455dc3,null))[_0xc55d('0x4a')](handleError(_0x455dc3,null));};exports['addAllCondition']=function(_0x5303fa,_0x3c9af9,_0x2ad2c8){if(_0x5303fa[_0xc55d('0x4f')]['id']){delete _0x5303fa[_0xc55d('0x4f')]['id'];}return db[_0xc55d('0x32')][_0xc55d('0x4d')]({'where':{'id':_0x5303fa['params']['id']}})[_0xc55d('0x28')](handleEntityNotFound(_0x3c9af9,null))[_0xc55d('0x28')](function(_0x413693){if(_0x413693){_0x5303fa[_0xc55d('0x4f')][_0xc55d('0x57')]=_0x413693['id'];return db[_0xc55d('0x58')]['create'](_0x5303fa['body']);}})['then'](respondWithResult(_0x3c9af9,null))['catch'](handleError(_0x3c9af9,null));};exports['addAnyCondition']=function(_0x3057f3,_0x449e81,_0x137baf){if(_0x3057f3[_0xc55d('0x4f')]['id']){delete _0x3057f3['body']['id'];}return db[_0xc55d('0x32')]['find']({'where':{'id':_0x3057f3[_0xc55d('0x56')]['id']}})[_0xc55d('0x28')](handleEntityNotFound(_0x449e81,null))[_0xc55d('0x28')](function(_0x218453){if(_0x218453){_0x3057f3[_0xc55d('0x4f')]['TriggerAnyId']=_0x218453['id'];return db[_0xc55d('0x58')][_0xc55d('0x4e')](_0x3057f3[_0xc55d('0x4f')]);}})[_0xc55d('0x28')](respondWithResult(_0x449e81,null))[_0xc55d('0x4a')](handleError(_0x449e81,null));};exports[_0xc55d('0x59')]=function(_0x40e005,_0x418562,_0x22eb66){var _0x24c5ed={};var _0x2a93a4={};var _0x4eea5f;var _0x32dc67;return db[_0xc55d('0x32')][_0xc55d('0x5a')]({'where':{'id':_0x40e005[_0xc55d('0x56')]['id']}})[_0xc55d('0x28')](handleEntityNotFound(_0x418562,null))[_0xc55d('0x28')](function(_0x53f836){if(_0x53f836){_0x4eea5f=_0x53f836;_0x2a93a4['model']=_[_0xc55d('0x38')](db[_0xc55d('0x58')][_0xc55d('0x33')]);_0x2a93a4['query']=_[_0xc55d('0x38')](_0x40e005['query']);_0x2a93a4[_0xc55d('0x43')]=_[_0xc55d('0x39')](_0x2a93a4['model'],_0x2a93a4[_0xc55d('0x3a')]);_0x24c5ed['attributes']=_[_0xc55d('0x39')](_0x2a93a4[_0xc55d('0x37')],qs[_0xc55d('0x3b')](_0x40e005[_0xc55d('0x3a')][_0xc55d('0x3b')]));_0x24c5ed[_0xc55d('0x3c')]=_0x24c5ed[_0xc55d('0x3c')]['length']?_0x24c5ed[_0xc55d('0x3c')]:_0x2a93a4['model'];_0x24c5ed[_0xc55d('0x3f')]=qs['sort'](_0x40e005[_0xc55d('0x3a')]['sort']);_0x24c5ed['where']=qs[_0xc55d('0x43')](_['pick'](_0x40e005[_0xc55d('0x3a')],_0x2a93a4[_0xc55d('0x43')]));if(_0x40e005[_0xc55d('0x3a')][_0xc55d('0x5b')]){_0x24c5ed[_0xc55d('0x41')]=_[_0xc55d('0x44')](_0x24c5ed[_0xc55d('0x41')],{'$or':_[_0xc55d('0x31')](_0x24c5ed[_0xc55d('0x3c')],function(_0x39df16){var _0x35de13={};_0x35de13[_0x39df16]={'$like':'%'+_0x40e005[_0xc55d('0x3a')][_0xc55d('0x5b')]+'%'};return _0x35de13;})});}_0x24c5ed=_[_0xc55d('0x44')]({},_0x24c5ed,_0x40e005[_0xc55d('0x45')]);return _0x4eea5f[_0xc55d('0x59')](_0x24c5ed);}})[_0xc55d('0x28')](function(_0x77b9c){if(_0x77b9c){_0x32dc67=_0x77b9c[_0xc55d('0x4c')];if(!_0x40e005[_0xc55d('0x3a')][_0xc55d('0x3d')](_0xc55d('0x3e'))){_0x24c5ed[_0xc55d('0x22')]=qs[_0xc55d('0x22')](_0x40e005[_0xc55d('0x3a')][_0xc55d('0x22')]);_0x24c5ed[_0xc55d('0x21')]=qs[_0xc55d('0x21')](_0x40e005[_0xc55d('0x3a')]['offset']);}return _0x4eea5f[_0xc55d('0x59')](_0x24c5ed);}})[_0xc55d('0x28')](function(_0x4288eb){if(_0x4288eb){return _0x4288eb?{'count':_0x32dc67,'rows':_0x4288eb}:null;}})[_0xc55d('0x28')](respondWithResult(_0x418562,null))[_0xc55d('0x4a')](handleError(_0x418562,null));};exports[_0xc55d('0x5c')]=function(_0xda5428,_0x4e4947,_0x31430d){var _0x50b378={};var _0x22976c={};var _0x4d8da2;var _0x4b22b6;return db[_0xc55d('0x32')][_0xc55d('0x5a')]({'where':{'id':_0xda5428[_0xc55d('0x56')]['id']}})['then'](handleEntityNotFound(_0x4e4947,null))[_0xc55d('0x28')](function(_0x21174c){if(_0x21174c){_0x4d8da2=_0x21174c;_0x22976c[_0xc55d('0x37')]=_['keys'](db[_0xc55d('0x58')][_0xc55d('0x33')]);_0x22976c['query']=_[_0xc55d('0x38')](_0xda5428[_0xc55d('0x3a')]);_0x22976c['filters']=_['intersection'](_0x22976c[_0xc55d('0x37')],_0x22976c[_0xc55d('0x3a')]);_0x50b378[_0xc55d('0x3c')]=_[_0xc55d('0x39')](_0x22976c[_0xc55d('0x37')],qs['fields'](_0xda5428[_0xc55d('0x3a')][_0xc55d('0x3b')]));_0x50b378['attributes']=_0x50b378[_0xc55d('0x3c')][_0xc55d('0x4c')]?_0x50b378['attributes']:_0x22976c[_0xc55d('0x37')];_0x50b378[_0xc55d('0x3f')]=qs[_0xc55d('0x40')](_0xda5428['query'][_0xc55d('0x40')]);_0x50b378[_0xc55d('0x41')]=qs[_0xc55d('0x43')](_[_0xc55d('0x42')](_0xda5428['query'],_0x22976c[_0xc55d('0x43')]));if(_0xda5428[_0xc55d('0x3a')][_0xc55d('0x5b')]){_0x50b378['where']=_[_0xc55d('0x44')](_0x50b378[_0xc55d('0x41')],{'$or':_[_0xc55d('0x31')](_0x50b378[_0xc55d('0x3c')],function(_0x30c5dd){var _0x3c64ef={};_0x3c64ef[_0x30c5dd]={'$like':'%'+_0xda5428[_0xc55d('0x3a')][_0xc55d('0x5b')]+'%'};return _0x3c64ef;})});}_0x50b378=_['merge']({},_0x50b378,_0xda5428[_0xc55d('0x45')]);return _0x4d8da2[_0xc55d('0x5c')](_0x50b378);}})[_0xc55d('0x28')](function(_0x5f17ec){if(_0x5f17ec){_0x4b22b6=_0x5f17ec[_0xc55d('0x4c')];if(!_0xda5428[_0xc55d('0x3a')][_0xc55d('0x3d')]('nolimit')){_0x50b378[_0xc55d('0x22')]=qs['limit'](_0xda5428[_0xc55d('0x3a')][_0xc55d('0x22')]);_0x50b378[_0xc55d('0x21')]=qs[_0xc55d('0x21')](_0xda5428[_0xc55d('0x3a')][_0xc55d('0x21')]);}return _0x4d8da2['getAnyConditions'](_0x50b378);}})['then'](function(_0xf3b08b){if(_0xf3b08b){return _0xf3b08b?{'count':_0x4b22b6,'rows':_0xf3b08b}:null;}})[_0xc55d('0x28')](respondWithResult(_0x4e4947,null))['catch'](handleError(_0x4e4947,null));};exports[_0xc55d('0x5d')]=function(_0x11bf76,_0x5efd51,_0xb4d6c1){if(_0x11bf76[_0xc55d('0x4f')]['id']){delete _0x11bf76[_0xc55d('0x4f')]['id'];}return db['Trigger'][_0xc55d('0x4d')]({'where':{'id':_0x11bf76[_0xc55d('0x56')]['id']}})[_0xc55d('0x28')](handleEntityNotFound(_0x5efd51,null))[_0xc55d('0x28')](function(_0xa4ba30){if(_0xa4ba30){_0x11bf76['body'][_0xc55d('0x5e')]=_0xa4ba30['id'];return db['Action'][_0xc55d('0x4e')](_0x11bf76[_0xc55d('0x4f')]);}})[_0xc55d('0x28')](respondWithResult(_0x5efd51,null))[_0xc55d('0x4a')](handleError(_0x5efd51,null));};exports[_0xc55d('0x5f')]=function(_0x5bf9d3,_0x5b3797,_0x58d57d){var _0xb3c6a2={};var _0x158749={};var _0x3a3e31;var _0x515695;return db['Trigger'][_0xc55d('0x5a')]({'where':{'id':_0x5bf9d3[_0xc55d('0x56')]['id']}})['then'](handleEntityNotFound(_0x5b3797,null))[_0xc55d('0x28')](function(_0x38e325){if(_0x38e325){_0x3a3e31=_0x38e325;_0x158749['model']=_[_0xc55d('0x38')](db['Action'][_0xc55d('0x33')]);_0x158749[_0xc55d('0x3a')]=_[_0xc55d('0x38')](_0x5bf9d3[_0xc55d('0x3a')]);_0x158749[_0xc55d('0x43')]=_[_0xc55d('0x39')](_0x158749[_0xc55d('0x37')],_0x158749[_0xc55d('0x3a')]);_0xb3c6a2[_0xc55d('0x3c')]=_['intersection'](_0x158749[_0xc55d('0x37')],qs['fields'](_0x5bf9d3[_0xc55d('0x3a')][_0xc55d('0x3b')]));_0xb3c6a2['attributes']=_0xb3c6a2['attributes'][_0xc55d('0x4c')]?_0xb3c6a2[_0xc55d('0x3c')]:_0x158749[_0xc55d('0x37')];_0xb3c6a2[_0xc55d('0x3f')]=qs[_0xc55d('0x40')](_0x5bf9d3[_0xc55d('0x3a')]['sort']);_0xb3c6a2[_0xc55d('0x41')]=qs['filters'](_[_0xc55d('0x42')](_0x5bf9d3[_0xc55d('0x3a')],_0x158749[_0xc55d('0x43')]));if(_0x5bf9d3['query'][_0xc55d('0x5b')]){_0xb3c6a2['where']=_[_0xc55d('0x44')](_0xb3c6a2[_0xc55d('0x41')],{'$or':_[_0xc55d('0x31')](_0xb3c6a2[_0xc55d('0x3c')],function(_0x4d4a89){var _0x5f79a6={};_0x5f79a6[_0x4d4a89]={'$like':'%'+_0x5bf9d3['query'][_0xc55d('0x5b')]+'%'};return _0x5f79a6;})});}_0xb3c6a2=_[_0xc55d('0x44')]({},_0xb3c6a2,_0x5bf9d3[_0xc55d('0x45')]);return _0x3a3e31['getActions'](_0xb3c6a2);}})[_0xc55d('0x28')](function(_0x389d54){if(_0x389d54){_0x515695=_0x389d54[_0xc55d('0x4c')];if(!_0x5bf9d3[_0xc55d('0x3a')][_0xc55d('0x3d')]('nolimit')){_0xb3c6a2['limit']=qs[_0xc55d('0x22')](_0x5bf9d3[_0xc55d('0x3a')]['limit']);_0xb3c6a2[_0xc55d('0x21')]=qs['offset'](_0x5bf9d3[_0xc55d('0x3a')][_0xc55d('0x21')]);}return _0x3a3e31[_0xc55d('0x5f')](_0xb3c6a2);}})['then'](function(_0x43ad92){if(_0x43ad92){return _0x43ad92?{'count':_0x515695,'rows':_0x43ad92}:null;}})[_0xc55d('0x28')](respondWithResult(_0x5b3797,null))[_0xc55d('0x4a')](handleError(_0x5b3797,null));}; \ No newline at end of file +var _0x6afb=['create','TriggerAnyId','Condition','getAllConditions','findOne','pick','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','Trigger','body','get','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId'];(function(_0x63fc52,_0x165267){var _0x233ab7=function(_0x4b95a4){while(--_0x4b95a4){_0x63fc52['push'](_0x63fc52['shift']());}};_0x233ab7(++_0x165267);}(_0x6afb,0x11e));var _0xb6af=function(_0x295b22,_0x6efea8){_0x295b22=_0x295b22-0x0;var _0x22ebf1=_0x6afb[_0x295b22];return _0x22ebf1;};'use strict';var emlformat=require(_0xb6af('0x0'));var rimraf=require(_0xb6af('0x1'));var zipdir=require(_0xb6af('0x2'));var jsonpatch=require(_0xb6af('0x3'));var rp=require('request-promise');var moment=require(_0xb6af('0x4'));var BPromise=require(_0xb6af('0x5'));var Mustache=require(_0xb6af('0x6'));var util=require(_0xb6af('0x7'));var path=require(_0xb6af('0x8'));var sox=require(_0xb6af('0x9'));var csv=require(_0xb6af('0xa'));var ejs=require(_0xb6af('0xb'));var fs=require('fs');var fs_extra=require(_0xb6af('0xc'));var _=require('lodash');var squel=require(_0xb6af('0xd'));var crypto=require(_0xb6af('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb6af('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb6af('0xf'));var qs=require(_0xb6af('0x10'));var as=require(_0xb6af('0x11'));var hardwareService=require(_0xb6af('0x12'));var logger=require('../../config/logger')(_0xb6af('0x13'));var utils=require(_0xb6af('0x14'));var config=require(_0xb6af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb6af('0x16'))['db'];function respondWithStatusCode(_0x2892df,_0x411fe4){_0x411fe4=_0x411fe4||0xcc;return function(_0x2043af){if(_0x2043af){return _0x2892df[_0xb6af('0x17')](_0x411fe4);}return _0x2892df[_0xb6af('0x18')](_0x411fe4)[_0xb6af('0x19')]();};}function respondWithResult(_0x39222a,_0x1b1534){_0x1b1534=_0x1b1534||0xc8;return function(_0x32672b){if(_0x32672b){return _0x39222a[_0xb6af('0x18')](_0x1b1534)[_0xb6af('0x1a')](_0x32672b);}};}function respondWithFilteredResult(_0x1860f3,_0x2dc8df){return function(_0x33fc94){if(_0x33fc94){var _0x4b245c=typeof _0x2dc8df[_0xb6af('0x1b')]===_0xb6af('0x1c')&&typeof _0x2dc8df['limit']===_0xb6af('0x1c');var _0x20c1e8=_0x33fc94[_0xb6af('0x1d')];var _0x39a540=_0x4b245c?0x0:_0x2dc8df['offset'];var _0x4044d0=_0x4b245c?_0x33fc94[_0xb6af('0x1d')]:_0x2dc8df[_0xb6af('0x1b')]+_0x2dc8df[_0xb6af('0x1e')];var _0x1ca7ea;if(_0x4044d0>=_0x20c1e8){_0x4044d0=_0x20c1e8;_0x1ca7ea=0xc8;}else{_0x1ca7ea=0xce;}_0x1860f3['status'](_0x1ca7ea);return _0x1860f3[_0xb6af('0x1f')]('Content-Range',_0x39a540+'-'+_0x4044d0+'/'+_0x20c1e8)[_0xb6af('0x1a')](_0x33fc94);}return null;};}function patchUpdates(_0x1b64fb){return function(_0x5a1cc7){try{jsonpatch['apply'](_0x5a1cc7,_0x1b64fb,!![]);}catch(_0x8c6771){return BPromise[_0xb6af('0x20')](_0x8c6771);}return _0x5a1cc7[_0xb6af('0x21')]();};}function saveUpdates(_0x557da6,_0x56896d){return function(_0x15028a){if(_0x15028a){return _0x15028a[_0xb6af('0x22')](_0x557da6)['then'](function(_0x4b4c7c){return _0x4b4c7c;});}return null;};}function removeEntity(_0x6d7c9f,_0x3cd25c){return function(_0x3fe1c3){if(_0x3fe1c3){return _0x3fe1c3[_0xb6af('0x23')]()[_0xb6af('0x24')](function(){var _0x210d35=_0x3fe1c3['get']({'plain':!![]});var _0x447a0b='Triggers';return db[_0xb6af('0x25')][_0xb6af('0x23')]({'where':{'type':_0x447a0b,'resourceId':_0x210d35['id']}})[_0xb6af('0x24')](function(){return _0x3fe1c3;});})['then'](function(){_0x6d7c9f[_0xb6af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bdd75,_0xc75c0f){return function(_0x6813b0){if(!_0x6813b0){_0x1bdd75[_0xb6af('0x17')](0x194);}return _0x6813b0;};}function handleError(_0x348302,_0x141da3){_0x141da3=_0x141da3||0x1f4;return function(_0x5c7dec){logger[_0xb6af('0x26')](_0x5c7dec[_0xb6af('0x27')]);if(_0x5c7dec[_0xb6af('0x28')]){delete _0x5c7dec['name'];}_0x348302[_0xb6af('0x18')](_0x141da3)[_0xb6af('0x29')](_0x5c7dec);};}exports[_0xb6af('0x2a')]=function(_0x24c5d0,_0xc46eeb){var _0x2edddc={},_0x1077cd={},_0x42788c={'count':0x0,'rows':[]};var _0x5279f3=_['map'](db['Trigger'][_0xb6af('0x2b')],function(_0x2ff3d7){return{'name':_0x2ff3d7[_0xb6af('0x2c')],'type':_0x2ff3d7[_0xb6af('0x2d')][_0xb6af('0x2e')]};});_0x1077cd[_0xb6af('0x2f')]=_[_0xb6af('0x30')](_0x5279f3,_0xb6af('0x28'));_0x1077cd['query']=_[_0xb6af('0x31')](_0x24c5d0[_0xb6af('0x32')]);_0x1077cd['filters']=_[_0xb6af('0x33')](_0x1077cd[_0xb6af('0x2f')],_0x1077cd[_0xb6af('0x32')]);_0x2edddc[_0xb6af('0x34')]=_[_0xb6af('0x33')](_0x1077cd[_0xb6af('0x2f')],qs['fields'](_0x24c5d0['query'][_0xb6af('0x35')]));_0x2edddc[_0xb6af('0x34')]=_0x2edddc[_0xb6af('0x34')][_0xb6af('0x36')]?_0x2edddc[_0xb6af('0x34')]:_0x1077cd[_0xb6af('0x2f')];if(!_0x24c5d0[_0xb6af('0x32')][_0xb6af('0x37')](_0xb6af('0x38'))){_0x2edddc[_0xb6af('0x1e')]=qs['limit'](_0x24c5d0[_0xb6af('0x32')]['limit']);_0x2edddc[_0xb6af('0x1b')]=qs[_0xb6af('0x1b')](_0x24c5d0[_0xb6af('0x32')]['offset']);}_0x2edddc[_0xb6af('0x39')]=qs['sort'](_0x24c5d0[_0xb6af('0x32')][_0xb6af('0x3a')]);_0x2edddc[_0xb6af('0x3b')]=qs[_0xb6af('0x3c')](_['pick'](_0x24c5d0[_0xb6af('0x32')],_0x1077cd[_0xb6af('0x3c')]),_0x5279f3);if(_0x24c5d0[_0xb6af('0x32')]['filter']){_0x2edddc[_0xb6af('0x3b')]=_[_0xb6af('0x3d')](_0x2edddc[_0xb6af('0x3b')],{'$or':_['map'](_0x5279f3,function(_0x2397d0){if(_0x2397d0['type']!==_0xb6af('0x3e')){var _0x17bbc1={};_0x17bbc1[_0x2397d0[_0xb6af('0x28')]]={'$like':'%'+_0x24c5d0[_0xb6af('0x32')][_0xb6af('0x3f')]+'%'};return _0x17bbc1;}})});}_0x2edddc=_[_0xb6af('0x3d')]({},_0x2edddc,_0x24c5d0[_0xb6af('0x40')]);var _0x2eeed6={'where':_0x2edddc[_0xb6af('0x3b')]};return db['Trigger'][_0xb6af('0x1d')](_0x2eeed6)[_0xb6af('0x24')](function(_0x215a72){_0x42788c[_0xb6af('0x1d')]=_0x215a72;if(_0x24c5d0[_0xb6af('0x32')][_0xb6af('0x41')]){_0x2edddc[_0xb6af('0x42')]=[{'all':!![]}];}return db['Trigger'][_0xb6af('0x43')](_0x2edddc);})['then'](function(_0x450cf3){_0x42788c[_0xb6af('0x44')]=_0x450cf3;return _0x42788c;})[_0xb6af('0x24')](respondWithFilteredResult(_0xc46eeb,_0x2edddc))[_0xb6af('0x45')](handleError(_0xc46eeb,null));};exports[_0xb6af('0x46')]=function(_0x14a10f,_0x4ce3af){var _0x578258={'raw':![],'where':{'id':_0x14a10f[_0xb6af('0x47')]['id']}},_0x1fa109={};_0x1fa109['model']=_[_0xb6af('0x31')](db[_0xb6af('0x48')][_0xb6af('0x2b')]);_0x1fa109['query']=_[_0xb6af('0x31')](_0x14a10f[_0xb6af('0x32')]);_0x1fa109[_0xb6af('0x3c')]=_['intersection'](_0x1fa109[_0xb6af('0x2f')],_0x1fa109[_0xb6af('0x32')]);_0x578258['attributes']=_['intersection'](_0x1fa109['model'],qs['fields'](_0x14a10f['query'][_0xb6af('0x35')]));_0x578258[_0xb6af('0x34')]=_0x578258['attributes'][_0xb6af('0x36')]?_0x578258['attributes']:_0x1fa109[_0xb6af('0x2f')];if(_0x14a10f[_0xb6af('0x32')][_0xb6af('0x41')]){_0x578258[_0xb6af('0x42')]=[{'all':!![]}];}_0x578258=_[_0xb6af('0x3d')]({},_0x578258,_0x14a10f[_0xb6af('0x40')]);return db[_0xb6af('0x48')]['find'](_0x578258)['then'](handleEntityNotFound(_0x4ce3af,null))['then'](respondWithResult(_0x4ce3af,null))['catch'](handleError(_0x4ce3af,null));};exports['create']=function(_0x26c53b,_0x30a2b8){return db[_0xb6af('0x48')]['create'](_0x26c53b[_0xb6af('0x49')],{})[_0xb6af('0x24')](function(_0x170f23){var _0x980c5a=_0x26c53b['user'][_0xb6af('0x4a')]({'plain':!![]});if(!_0x980c5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x980c5a[_0xb6af('0x4b')]===_0xb6af('0x4c')){var _0x1c3516=_0x170f23[_0xb6af('0x4a')]({'plain':!![]});var _0x2ed109='Triggers';return db['UserProfileSection'][_0xb6af('0x4d')]({'where':{'name':_0x2ed109,'userProfileId':_0x980c5a['userProfileId']},'raw':!![]})[_0xb6af('0x24')](function(_0x520310){if(_0x520310&&_0x520310[_0xb6af('0x4e')]===0x0){return db[_0xb6af('0x25')]['create']({'name':_0x1c3516[_0xb6af('0x28')],'resourceId':_0x1c3516['id'],'type':_0x520310[_0xb6af('0x28')],'sectionId':_0x520310['id']},{})[_0xb6af('0x24')](function(){return _0x170f23;});}else{return _0x170f23;}})['catch'](function(_0x3f12b0){logger['error'](_0xb6af('0x4f'),_0x3f12b0);throw _0x3f12b0;});}return _0x170f23;})[_0xb6af('0x24')](respondWithResult(_0x30a2b8,0xc9))[_0xb6af('0x45')](handleError(_0x30a2b8,null));};exports[_0xb6af('0x22')]=function(_0x3aaca3,_0x3ac909){if(_0x3aaca3[_0xb6af('0x49')]['id']){delete _0x3aaca3['body']['id'];}return db[_0xb6af('0x48')][_0xb6af('0x4d')]({'where':{'id':_0x3aaca3[_0xb6af('0x47')]['id']}})[_0xb6af('0x24')](handleEntityNotFound(_0x3ac909,null))[_0xb6af('0x24')](saveUpdates(_0x3aaca3[_0xb6af('0x49')],null))[_0xb6af('0x24')](respondWithResult(_0x3ac909,null))['catch'](handleError(_0x3ac909,null));};exports['destroy']=function(_0x32c7d8,_0x5f12eb){return db[_0xb6af('0x48')][_0xb6af('0x4d')]({'where':{'id':_0x32c7d8[_0xb6af('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f12eb,null))[_0xb6af('0x24')](removeEntity(_0x5f12eb,null))[_0xb6af('0x45')](handleError(_0x5f12eb,null));};exports[_0xb6af('0x50')]=function(_0xc40b5d,_0x21459c,_0x44f4ef){if(_0xc40b5d[_0xb6af('0x49')]['id']){delete _0xc40b5d[_0xb6af('0x49')]['id'];}return db['Trigger'][_0xb6af('0x4d')]({'where':{'id':_0xc40b5d[_0xb6af('0x47')]['id']}})['then'](handleEntityNotFound(_0x21459c,null))['then'](function(_0x2ce8d6){if(_0x2ce8d6){_0xc40b5d[_0xb6af('0x49')][_0xb6af('0x51')]=_0x2ce8d6['id'];return db['Condition'][_0xb6af('0x52')](_0xc40b5d[_0xb6af('0x49')]);}})[_0xb6af('0x24')](respondWithResult(_0x21459c,null))[_0xb6af('0x45')](handleError(_0x21459c,null));};exports['addAnyCondition']=function(_0x115aed,_0x5ad0f9,_0x2cb757){if(_0x115aed[_0xb6af('0x49')]['id']){delete _0x115aed['body']['id'];}return db[_0xb6af('0x48')][_0xb6af('0x4d')]({'where':{'id':_0x115aed['params']['id']}})['then'](handleEntityNotFound(_0x5ad0f9,null))[_0xb6af('0x24')](function(_0x5e1c1a){if(_0x5e1c1a){_0x115aed['body'][_0xb6af('0x53')]=_0x5e1c1a['id'];return db[_0xb6af('0x54')][_0xb6af('0x52')](_0x115aed[_0xb6af('0x49')]);}})[_0xb6af('0x24')](respondWithResult(_0x5ad0f9,null))[_0xb6af('0x45')](handleError(_0x5ad0f9,null));};exports[_0xb6af('0x55')]=function(_0x515381,_0xfe9038,_0x4c81ed){var _0x4bc456={};var _0x1ebf15={};var _0x197468;var _0x249ff5;return db[_0xb6af('0x48')][_0xb6af('0x56')]({'where':{'id':_0x515381[_0xb6af('0x47')]['id']}})[_0xb6af('0x24')](handleEntityNotFound(_0xfe9038,null))[_0xb6af('0x24')](function(_0x5036b3){if(_0x5036b3){_0x197468=_0x5036b3;_0x1ebf15[_0xb6af('0x2f')]=_[_0xb6af('0x31')](db[_0xb6af('0x54')][_0xb6af('0x2b')]);_0x1ebf15[_0xb6af('0x32')]=_['keys'](_0x515381['query']);_0x1ebf15[_0xb6af('0x3c')]=_[_0xb6af('0x33')](_0x1ebf15[_0xb6af('0x2f')],_0x1ebf15['query']);_0x4bc456[_0xb6af('0x34')]=_[_0xb6af('0x33')](_0x1ebf15[_0xb6af('0x2f')],qs[_0xb6af('0x35')](_0x515381[_0xb6af('0x32')][_0xb6af('0x35')]));_0x4bc456[_0xb6af('0x34')]=_0x4bc456['attributes']['length']?_0x4bc456['attributes']:_0x1ebf15[_0xb6af('0x2f')];_0x4bc456['order']=qs['sort'](_0x515381[_0xb6af('0x32')][_0xb6af('0x3a')]);_0x4bc456[_0xb6af('0x3b')]=qs[_0xb6af('0x3c')](_[_0xb6af('0x57')](_0x515381[_0xb6af('0x32')],_0x1ebf15[_0xb6af('0x3c')]));if(_0x515381[_0xb6af('0x32')][_0xb6af('0x3f')]){_0x4bc456['where']=_[_0xb6af('0x3d')](_0x4bc456['where'],{'$or':_[_0xb6af('0x30')](_0x4bc456['attributes'],function(_0x2aa1a4){var _0x41425e={};_0x41425e[_0x2aa1a4]={'$like':'%'+_0x515381[_0xb6af('0x32')][_0xb6af('0x3f')]+'%'};return _0x41425e;})});}_0x4bc456=_['merge']({},_0x4bc456,_0x515381['options']);return _0x197468[_0xb6af('0x55')](_0x4bc456);}})[_0xb6af('0x24')](function(_0x29ec42){if(_0x29ec42){_0x249ff5=_0x29ec42[_0xb6af('0x36')];if(!_0x515381[_0xb6af('0x32')][_0xb6af('0x37')]('nolimit')){_0x4bc456[_0xb6af('0x1e')]=qs[_0xb6af('0x1e')](_0x515381['query'][_0xb6af('0x1e')]);_0x4bc456[_0xb6af('0x1b')]=qs[_0xb6af('0x1b')](_0x515381[_0xb6af('0x32')]['offset']);}return _0x197468[_0xb6af('0x55')](_0x4bc456);}})[_0xb6af('0x24')](function(_0x220412){if(_0x220412){return _0x220412?{'count':_0x249ff5,'rows':_0x220412}:null;}})[_0xb6af('0x24')](respondWithResult(_0xfe9038,null))[_0xb6af('0x45')](handleError(_0xfe9038,null));};exports[_0xb6af('0x58')]=function(_0x9b2bff,_0x9a5411,_0x17d65f){var _0x26cf79={};var _0x492828={};var _0x34708e;var _0x3d576a;return db[_0xb6af('0x48')][_0xb6af('0x56')]({'where':{'id':_0x9b2bff[_0xb6af('0x47')]['id']}})[_0xb6af('0x24')](handleEntityNotFound(_0x9a5411,null))[_0xb6af('0x24')](function(_0x418e80){if(_0x418e80){_0x34708e=_0x418e80;_0x492828[_0xb6af('0x2f')]=_['keys'](db['Condition']['rawAttributes']);_0x492828[_0xb6af('0x32')]=_[_0xb6af('0x31')](_0x9b2bff['query']);_0x492828[_0xb6af('0x3c')]=_[_0xb6af('0x33')](_0x492828['model'],_0x492828[_0xb6af('0x32')]);_0x26cf79[_0xb6af('0x34')]=_[_0xb6af('0x33')](_0x492828[_0xb6af('0x2f')],qs[_0xb6af('0x35')](_0x9b2bff[_0xb6af('0x32')][_0xb6af('0x35')]));_0x26cf79[_0xb6af('0x34')]=_0x26cf79[_0xb6af('0x34')][_0xb6af('0x36')]?_0x26cf79[_0xb6af('0x34')]:_0x492828[_0xb6af('0x2f')];_0x26cf79['order']=qs[_0xb6af('0x3a')](_0x9b2bff[_0xb6af('0x32')][_0xb6af('0x3a')]);_0x26cf79[_0xb6af('0x3b')]=qs[_0xb6af('0x3c')](_['pick'](_0x9b2bff[_0xb6af('0x32')],_0x492828[_0xb6af('0x3c')]));if(_0x9b2bff[_0xb6af('0x32')][_0xb6af('0x3f')]){_0x26cf79[_0xb6af('0x3b')]=_[_0xb6af('0x3d')](_0x26cf79[_0xb6af('0x3b')],{'$or':_[_0xb6af('0x30')](_0x26cf79[_0xb6af('0x34')],function(_0x5dc920){var _0x572f17={};_0x572f17[_0x5dc920]={'$like':'%'+_0x9b2bff['query'][_0xb6af('0x3f')]+'%'};return _0x572f17;})});}_0x26cf79=_[_0xb6af('0x3d')]({},_0x26cf79,_0x9b2bff[_0xb6af('0x40')]);return _0x34708e['getAnyConditions'](_0x26cf79);}})[_0xb6af('0x24')](function(_0x4a8fb8){if(_0x4a8fb8){_0x3d576a=_0x4a8fb8[_0xb6af('0x36')];if(!_0x9b2bff['query'][_0xb6af('0x37')](_0xb6af('0x38'))){_0x26cf79['limit']=qs['limit'](_0x9b2bff['query']['limit']);_0x26cf79[_0xb6af('0x1b')]=qs['offset'](_0x9b2bff[_0xb6af('0x32')][_0xb6af('0x1b')]);}return _0x34708e[_0xb6af('0x58')](_0x26cf79);}})[_0xb6af('0x24')](function(_0x554ee6){if(_0x554ee6){return _0x554ee6?{'count':_0x3d576a,'rows':_0x554ee6}:null;}})[_0xb6af('0x24')](respondWithResult(_0x9a5411,null))[_0xb6af('0x45')](handleError(_0x9a5411,null));};exports[_0xb6af('0x59')]=function(_0x525c2d,_0xb3d1c6,_0xbcf5c6){if(_0x525c2d['body']['id']){delete _0x525c2d[_0xb6af('0x49')]['id'];}return db[_0xb6af('0x48')][_0xb6af('0x4d')]({'where':{'id':_0x525c2d['params']['id']}})[_0xb6af('0x24')](handleEntityNotFound(_0xb3d1c6,null))[_0xb6af('0x24')](function(_0x133814){if(_0x133814){_0x525c2d['body']['TriggerId']=_0x133814['id'];return db[_0xb6af('0x5a')]['create'](_0x525c2d[_0xb6af('0x49')]);}})['then'](respondWithResult(_0xb3d1c6,null))[_0xb6af('0x45')](handleError(_0xb3d1c6,null));};exports[_0xb6af('0x5b')]=function(_0x16062c,_0x2bb171,_0x157112){var _0x2317af={};var _0x44185f={};var _0x1416ae;var _0x1a4aa5;return db['Trigger'][_0xb6af('0x56')]({'where':{'id':_0x16062c[_0xb6af('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bb171,null))[_0xb6af('0x24')](function(_0xd16b1c){if(_0xd16b1c){_0x1416ae=_0xd16b1c;_0x44185f[_0xb6af('0x2f')]=_[_0xb6af('0x31')](db[_0xb6af('0x5a')]['rawAttributes']);_0x44185f[_0xb6af('0x32')]=_[_0xb6af('0x31')](_0x16062c['query']);_0x44185f[_0xb6af('0x3c')]=_[_0xb6af('0x33')](_0x44185f[_0xb6af('0x2f')],_0x44185f[_0xb6af('0x32')]);_0x2317af[_0xb6af('0x34')]=_[_0xb6af('0x33')](_0x44185f['model'],qs[_0xb6af('0x35')](_0x16062c[_0xb6af('0x32')]['fields']));_0x2317af[_0xb6af('0x34')]=_0x2317af['attributes'][_0xb6af('0x36')]?_0x2317af[_0xb6af('0x34')]:_0x44185f[_0xb6af('0x2f')];_0x2317af['order']=qs[_0xb6af('0x3a')](_0x16062c[_0xb6af('0x32')]['sort']);_0x2317af['where']=qs[_0xb6af('0x3c')](_['pick'](_0x16062c['query'],_0x44185f[_0xb6af('0x3c')]));if(_0x16062c[_0xb6af('0x32')][_0xb6af('0x3f')]){_0x2317af['where']=_['merge'](_0x2317af['where'],{'$or':_[_0xb6af('0x30')](_0x2317af['attributes'],function(_0x41c22a){var _0x7bf071={};_0x7bf071[_0x41c22a]={'$like':'%'+_0x16062c['query'][_0xb6af('0x3f')]+'%'};return _0x7bf071;})});}_0x2317af=_['merge']({},_0x2317af,_0x16062c[_0xb6af('0x40')]);return _0x1416ae[_0xb6af('0x5b')](_0x2317af);}})['then'](function(_0x389be8){if(_0x389be8){_0x1a4aa5=_0x389be8[_0xb6af('0x36')];if(!_0x16062c['query'][_0xb6af('0x37')](_0xb6af('0x38'))){_0x2317af[_0xb6af('0x1e')]=qs[_0xb6af('0x1e')](_0x16062c[_0xb6af('0x32')][_0xb6af('0x1e')]);_0x2317af[_0xb6af('0x1b')]=qs[_0xb6af('0x1b')](_0x16062c['query'][_0xb6af('0x1b')]);}return _0x1416ae[_0xb6af('0x5b')](_0x2317af);}})[_0xb6af('0x24')](function(_0x385e0b){if(_0x385e0b){return _0x385e0b?{'count':_0x1a4aa5,'rows':_0x385e0b}:null;}})[_0xb6af('0x24')](respondWithResult(_0x2bb171,null))[_0xb6af('0x45')](handleError(_0x2bb171,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index cb1b63e..b4e64fb 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19da=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','util'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x19da,0x9f));var _0xa19d=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x19da[_0x251e8c];return _0x1e0c1d;};'use strict';var _=require('lodash');var util=require(_0xa19d('0x0'));var logger=require('../../config/logger')(_0xa19d('0x1'));var moment=require('moment');var BPromise=require(_0xa19d('0x2'));var rp=require(_0xa19d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa19d('0x4'));var config=require(_0xa19d('0x5'));var attributes=require('./trigger.attributes');module[_0xa19d('0x6')]=function(_0x330adb,_0x1f6e10){return _0x330adb[_0xa19d('0x7')](_0xa19d('0x8'),attributes,{'tableName':_0xa19d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2392=['exports','define','Trigger','tools_triggers','lodash','util','api','moment','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x5e214f,_0x291aaa){var _0x1fd329=function(_0xecdb0b){while(--_0xecdb0b){_0x5e214f['push'](_0x5e214f['shift']());}};_0x1fd329(++_0x291aaa);}(_0x2392,0xd0));var _0x2239=function(_0x4c0af0,_0x38de61){_0x4c0af0=_0x4c0af0-0x0;var _0x4a497a=_0x2392[_0x4c0af0];return _0x4a497a;};'use strict';var _=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var logger=require('../../config/logger')(_0x2239('0x2'));var moment=require(_0x2239('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2239('0x4'));var rimraf=require(_0x2239('0x5'));var config=require(_0x2239('0x6'));var attributes=require(_0x2239('0x7'));module[_0x2239('0x8')]=function(_0x2cefd6,_0x37833e){return _0x2cefd6[_0x2239('0x9')](_0x2239('0xa'),attributes,{'tableName':_0x2239('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 47d04bb..0d36d40 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f5d=['GetTrigger','catch','ShowTrigger','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','error','message','result','findAll','options','raw','where','attributes','limit','include','model','map','then'];(function(_0x52398e,_0x2ad8c2){var _0x454d0f=function(_0x12e20c){while(--_0x12e20c){_0x52398e['push'](_0x52398e['shift']());}};_0x454d0f(++_0x2ad8c2);}(_0x2f5d,0x149));var _0xd2f5=function(_0x2c7171,_0x28e432){_0x2c7171=_0x2c7171-0x0;var _0x4fd14b=_0x2f5d[_0x2c7171];return _0x4fd14b;};'use strict';var _=require(_0xd2f5('0x0'));var util=require(_0xd2f5('0x1'));var moment=require(_0xd2f5('0x2'));var BPromise=require(_0xd2f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2f5('0x4'));var db=require(_0xd2f5('0x5'))['db'];var utils=require(_0xd2f5('0x6'));var logger=require(_0xd2f5('0x7'))(_0xd2f5('0x8'));var config=require(_0xd2f5('0x9'));var jayson=require(_0xd2f5('0xa'));var client=jayson[_0xd2f5('0xb')][_0xd2f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5371ea,_0x552b0b,_0x42da5a){return new BPromise(function(_0x44db44,_0x4bc2eb){return client[_0xd2f5('0xd')](_0x5371ea,_0x42da5a)['then'](function(_0x424fa1){logger[_0xd2f5('0xe')](_0xd2f5('0xf'),_0x552b0b,_0xd2f5('0x10'));logger[_0xd2f5('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x552b0b,_0xd2f5('0x10'),JSON['stringify'](_0x424fa1));if(_0x424fa1[_0xd2f5('0x12')]){if(_0x424fa1['error']['code']===0x1f4){logger[_0xd2f5('0x12')](_0xd2f5('0xf'),_0x552b0b,_0x424fa1[_0xd2f5('0x12')][_0xd2f5('0x13')]);return _0x4bc2eb(_0x424fa1[_0xd2f5('0x12')]['message']);}logger[_0xd2f5('0x12')]('Trigger,\x20%s,\x20%s',_0x552b0b,_0x424fa1[_0xd2f5('0x12')][_0xd2f5('0x13')]);return _0x44db44(_0x424fa1[_0xd2f5('0x12')][_0xd2f5('0x13')]);}else{logger[_0xd2f5('0xe')](_0xd2f5('0xf'),_0x552b0b,'request\x20sent');_0x44db44(_0x424fa1[_0xd2f5('0x14')][_0xd2f5('0x13')]);}})['catch'](function(_0x163187){logger[_0xd2f5('0x12')]('Trigger,\x20%s,\x20%s',_0x552b0b,_0x163187);_0x4bc2eb(_0x163187);});});}exports['GetTrigger']=function(_0x542f0b){var _0xc16ea5=this;return new Promise(function(_0x2b87d8,_0x1db2f0){return db['Trigger'][_0xd2f5('0x15')]({'raw':_0x542f0b[_0xd2f5('0x16')]?_0x542f0b[_0xd2f5('0x16')][_0xd2f5('0x17')]===undefined?!![]:![]:!![],'where':_0x542f0b[_0xd2f5('0x16')]?_0x542f0b[_0xd2f5('0x16')][_0xd2f5('0x18')]||null:null,'attributes':_0x542f0b['options']?_0x542f0b[_0xd2f5('0x16')][_0xd2f5('0x19')]||null:null,'limit':_0x542f0b['options']?_0x542f0b['options'][_0xd2f5('0x1a')]||null:null,'include':_0x542f0b['options']?_0x542f0b[_0xd2f5('0x16')][_0xd2f5('0x1b')]?_['map'](_0x542f0b[_0xd2f5('0x16')][_0xd2f5('0x1b')],function(_0x1bfa7e){return{'model':db[_0x1bfa7e[_0xd2f5('0x1c')]],'as':_0x1bfa7e['as'],'attributes':_0x1bfa7e['attributes'],'include':_0x1bfa7e[_0xd2f5('0x1b')]?_[_0xd2f5('0x1d')](_0x1bfa7e[_0xd2f5('0x1b')],function(_0x64f94c){return{'model':db[_0x64f94c['model']],'as':_0x64f94c['as'],'attributes':_0x64f94c[_0xd2f5('0x19')],'include':_0x64f94c[_0xd2f5('0x1b')]?_['map'](_0x64f94c[_0xd2f5('0x1b')],function(_0x1ec662){return{'model':db[_0x1ec662[_0xd2f5('0x1c')]],'as':_0x1ec662['as'],'attributes':_0x1ec662['attributes']};}):[]};}):[]};}):[]:[]})[_0xd2f5('0x1e')](function(_0x198986){logger[_0xd2f5('0xe')](_0xd2f5('0x1f'),_0x542f0b);logger[_0xd2f5('0x11')]('GetTrigger',_0x542f0b,JSON['stringify'](_0x198986));_0x2b87d8(_0x198986);})[_0xd2f5('0x20')](function(_0x6085a2){logger[_0xd2f5('0x12')](_0xd2f5('0x1f'),_0x6085a2[_0xd2f5('0x13')],_0x542f0b);_0x1db2f0(_0xc16ea5['error'](0x1f4,_0x6085a2[_0xd2f5('0x13')]));});});};exports[_0xd2f5('0x21')]=function(_0x2aefca){var _0x4864a2=this;return new Promise(function(_0x50c105,_0x404d21){return db['Trigger'][_0xd2f5('0x22')]({'raw':_0x2aefca[_0xd2f5('0x16')]?_0x2aefca['options'][_0xd2f5('0x17')]===undefined?!![]:![]:!![],'where':_0x2aefca[_0xd2f5('0x16')]?_0x2aefca[_0xd2f5('0x16')][_0xd2f5('0x18')]||null:null,'attributes':_0x2aefca[_0xd2f5('0x16')]?_0x2aefca[_0xd2f5('0x16')][_0xd2f5('0x19')]||null:null,'include':_0x2aefca[_0xd2f5('0x16')]?_0x2aefca[_0xd2f5('0x16')][_0xd2f5('0x1b')]?_[_0xd2f5('0x1d')](_0x2aefca[_0xd2f5('0x16')][_0xd2f5('0x1b')],function(_0x3153d6){return{'model':db[_0x3153d6[_0xd2f5('0x1c')]],'as':_0x3153d6['as'],'attributes':_0x3153d6[_0xd2f5('0x19')],'include':_0x3153d6[_0xd2f5('0x1b')]?_['map'](_0x3153d6['include'],function(_0x4dc1f3){return{'model':db[_0x4dc1f3[_0xd2f5('0x1c')]],'as':_0x4dc1f3['as'],'attributes':_0x4dc1f3['attributes'],'include':_0x4dc1f3['include']?_[_0xd2f5('0x1d')](_0x4dc1f3[_0xd2f5('0x1b')],function(_0x553c12){return{'model':db[_0x553c12[_0xd2f5('0x1c')]],'as':_0x553c12['as'],'attributes':_0x553c12[_0xd2f5('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2f5('0x1e')](function(_0x46b175){logger[_0xd2f5('0xe')](_0xd2f5('0x21'),_0x2aefca);logger[_0xd2f5('0x11')](_0xd2f5('0x21'),_0x2aefca,JSON[_0xd2f5('0x23')](_0x46b175));_0x50c105(_0x46b175);})['catch'](function(_0x415227){logger['error']('ShowTrigger',_0x415227[_0xd2f5('0x13')],_0x2aefca);_0x404d21(_0x4864a2[_0xd2f5('0x12')](0x1f4,_0x415227[_0xd2f5('0x13')]));});});}; \ No newline at end of file +var _0xd866=['info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','stringify','find','ShowTrigger','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then'];(function(_0x3e119f,_0x1e7f99){var _0x34328c=function(_0x114273){while(--_0x114273){_0x3e119f['push'](_0x3e119f['shift']());}};_0x34328c(++_0x1e7f99);}(_0xd866,0x1a3));var _0x6d86=function(_0x57fca6,_0x497213){_0x57fca6=_0x57fca6-0x0;var _0x1f2800=_0xd866[_0x57fca6];return _0x1f2800;};'use strict';var _=require(_0x6d86('0x0'));var util=require(_0x6d86('0x1'));var moment=require('moment');var BPromise=require(_0x6d86('0x2'));var rs=require(_0x6d86('0x3'));var fs=require('fs');var Redis=require(_0x6d86('0x4'));var db=require(_0x6d86('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d86('0x6'))(_0x6d86('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6d86('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa04d2f,_0x21e4b1,_0x16442d){return new BPromise(function(_0x41a250,_0x21dc26){return client['request'](_0xa04d2f,_0x16442d)[_0x6d86('0x9')](function(_0x101677){logger[_0x6d86('0xa')](_0x6d86('0xb'),_0x21e4b1,'request\x20sent');logger[_0x6d86('0xc')](_0x6d86('0xd'),_0x21e4b1,_0x6d86('0xe'),JSON['stringify'](_0x101677));if(_0x101677['error']){if(_0x101677['error']['code']===0x1f4){logger[_0x6d86('0xf')](_0x6d86('0xb'),_0x21e4b1,_0x101677[_0x6d86('0xf')][_0x6d86('0x10')]);return _0x21dc26(_0x101677[_0x6d86('0xf')]['message']);}logger[_0x6d86('0xf')](_0x6d86('0xb'),_0x21e4b1,_0x101677['error'][_0x6d86('0x10')]);return _0x41a250(_0x101677['error']['message']);}else{logger[_0x6d86('0xa')](_0x6d86('0xb'),_0x21e4b1,_0x6d86('0xe'));_0x41a250(_0x101677[_0x6d86('0x11')][_0x6d86('0x10')]);}})[_0x6d86('0x12')](function(_0x37c7a3){logger[_0x6d86('0xf')](_0x6d86('0xb'),_0x21e4b1,_0x37c7a3);_0x21dc26(_0x37c7a3);});});}exports['GetTrigger']=function(_0x3a96bd){var _0x4d5654=this;return new Promise(function(_0x47c476,_0x3ad623){return db[_0x6d86('0x13')][_0x6d86('0x14')]({'raw':_0x3a96bd[_0x6d86('0x15')]?_0x3a96bd[_0x6d86('0x15')][_0x6d86('0x16')]===undefined?!![]:![]:!![],'where':_0x3a96bd[_0x6d86('0x15')]?_0x3a96bd[_0x6d86('0x15')][_0x6d86('0x17')]||null:null,'attributes':_0x3a96bd['options']?_0x3a96bd[_0x6d86('0x15')][_0x6d86('0x18')]||null:null,'limit':_0x3a96bd[_0x6d86('0x15')]?_0x3a96bd[_0x6d86('0x15')][_0x6d86('0x19')]||null:null,'include':_0x3a96bd[_0x6d86('0x15')]?_0x3a96bd['options'][_0x6d86('0x1a')]?_['map'](_0x3a96bd[_0x6d86('0x15')][_0x6d86('0x1a')],function(_0x529cb2){return{'model':db[_0x529cb2['model']],'as':_0x529cb2['as'],'attributes':_0x529cb2[_0x6d86('0x18')],'include':_0x529cb2[_0x6d86('0x1a')]?_['map'](_0x529cb2[_0x6d86('0x1a')],function(_0x124116){return{'model':db[_0x124116[_0x6d86('0x1b')]],'as':_0x124116['as'],'attributes':_0x124116[_0x6d86('0x18')],'include':_0x124116['include']?_[_0x6d86('0x1c')](_0x124116[_0x6d86('0x1a')],function(_0x4a797f){return{'model':db[_0x4a797f[_0x6d86('0x1b')]],'as':_0x4a797f['as'],'attributes':_0x4a797f[_0x6d86('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b1df6){logger['info'](_0x6d86('0x1d'),_0x3a96bd);logger['debug'](_0x6d86('0x1d'),_0x3a96bd,JSON[_0x6d86('0x1e')](_0x1b1df6));_0x47c476(_0x1b1df6);})[_0x6d86('0x12')](function(_0x2f3b7f){logger['error']('GetTrigger',_0x2f3b7f['message'],_0x3a96bd);_0x3ad623(_0x4d5654[_0x6d86('0xf')](0x1f4,_0x2f3b7f['message']));});});};exports['ShowTrigger']=function(_0x5dc36c){var _0x3f6b0e=this;return new Promise(function(_0x37d745,_0x513fff){return db['Trigger'][_0x6d86('0x1f')]({'raw':_0x5dc36c[_0x6d86('0x15')]?_0x5dc36c[_0x6d86('0x15')][_0x6d86('0x16')]===undefined?!![]:![]:!![],'where':_0x5dc36c[_0x6d86('0x15')]?_0x5dc36c['options'][_0x6d86('0x17')]||null:null,'attributes':_0x5dc36c[_0x6d86('0x15')]?_0x5dc36c[_0x6d86('0x15')][_0x6d86('0x18')]||null:null,'include':_0x5dc36c[_0x6d86('0x15')]?_0x5dc36c[_0x6d86('0x15')][_0x6d86('0x1a')]?_[_0x6d86('0x1c')](_0x5dc36c['options'][_0x6d86('0x1a')],function(_0x438143){return{'model':db[_0x438143[_0x6d86('0x1b')]],'as':_0x438143['as'],'attributes':_0x438143[_0x6d86('0x18')],'include':_0x438143['include']?_[_0x6d86('0x1c')](_0x438143[_0x6d86('0x1a')],function(_0x55ddbe){return{'model':db[_0x55ddbe[_0x6d86('0x1b')]],'as':_0x55ddbe['as'],'attributes':_0x55ddbe[_0x6d86('0x18')],'include':_0x55ddbe[_0x6d86('0x1a')]?_['map'](_0x55ddbe[_0x6d86('0x1a')],function(_0x52d9c1){return{'model':db[_0x52d9c1['model']],'as':_0x52d9c1['as'],'attributes':_0x52d9c1[_0x6d86('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6d86('0x9')](function(_0x44f640){logger['info'](_0x6d86('0x20'),_0x5dc36c);logger[_0x6d86('0xc')](_0x6d86('0x20'),_0x5dc36c,JSON[_0x6d86('0x1e')](_0x44f640));_0x37d745(_0x44f640);})[_0x6d86('0x12')](function(_0x5c0b1d){logger['error'](_0x6d86('0x20'),_0x5c0b1d[_0x6d86('0x10')],_0x5dc36c);_0x513fff(_0x3f6b0e['error'](0x1f4,_0x5c0b1d[_0x6d86('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ae0e4b5..558f6c3 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7279=['isAuthenticated','/:id','show','post','/:id/clone','clone','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get'];(function(_0x193628,_0x4bad55){var _0x1ba51f=function(_0x3b3a26){while(--_0x3b3a26){_0x193628['push'](_0x193628['shift']());}};_0x1ba51f(++_0x4bad55);}(_0x7279,0x10e));var _0x9727=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7279[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9727('0x0'));var util=require('util');var path=require(_0x9727('0x1'));var timeout=require(_0x9727('0x2'));var express=require(_0x9727('0x3'));var router=express[_0x9727('0x4')]();var fs_extra=require(_0x9727('0x5'));var auth=require(_0x9727('0x6'));var interaction=require(_0x9727('0x7'));var config=require('../../config/environment');var controller=require(_0x9727('0x8'));router[_0x9727('0x9')]('/',auth[_0x9727('0xa')](),controller['index']);router[_0x9727('0x9')](_0x9727('0xb'),auth[_0x9727('0xa')](),controller[_0x9727('0xc')]);router[_0x9727('0xd')](_0x9727('0xe'),auth[_0x9727('0xa')](),controller[_0x9727('0xf')]);router[_0x9727('0xd')]('/',auth[_0x9727('0xa')](),controller[_0x9727('0x10')]);router[_0x9727('0x11')](_0x9727('0xb'),auth['isAuthenticated'](),controller[_0x9727('0x12')]);router[_0x9727('0x13')](_0x9727('0xb'),auth[_0x9727('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa784=['put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','clone','post','create'];(function(_0x113b18,_0x490f6d){var _0x570b38=function(_0x387a02){while(--_0x387a02){_0x113b18['push'](_0x113b18['shift']());}};_0x570b38(++_0x490f6d);}(_0xa784,0x17d));var _0x4a78=function(_0x535bfe,_0x5a5d70){_0x535bfe=_0x535bfe-0x0;var _0x3870e5=_0xa784[_0x535bfe];return _0x3870e5;};'use strict';var multer=require(_0x4a78('0x0'));var util=require(_0x4a78('0x1'));var path=require(_0x4a78('0x2'));var timeout=require(_0x4a78('0x3'));var express=require(_0x4a78('0x4'));var router=express[_0x4a78('0x5')]();var fs_extra=require(_0x4a78('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4a78('0x7'));var config=require(_0x4a78('0x8'));var controller=require('./trunk.controller');router['get']('/',auth[_0x4a78('0x9')](),controller[_0x4a78('0xa')]);router[_0x4a78('0xb')]('/:id',auth[_0x4a78('0x9')](),controller['show']);router['post']('/:id/clone',auth[_0x4a78('0x9')](),controller[_0x4a78('0xc')]);router[_0x4a78('0xd')]('/',auth['isAuthenticated'](),controller[_0x4a78('0xe')]);router[_0x4a78('0xf')](_0x4a78('0x10'),auth[_0x4a78('0x9')](),controller[_0x4a78('0x11')]);router['delete'](_0x4a78('0x10'),auth[_0x4a78('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b12e3b8..b8d7786 100644 --- a/server/api/trunk/trunk.attributes.js +++ b/server/api/trunk/trunk.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5a8=['info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','rfc2833'];(function(_0x4a9486,_0x20a6f5){var _0x11de99=function(_0x11243a){while(--_0x11243a){_0x4a9486['push'](_0x4a9486['shift']());}};_0x11de99(++_0x20a6f5);}(_0xb5a8,0x88));var _0x8b5a=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xb5a8[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x8b5a('0x0'));module[_0x8b5a('0x1')]={'name':{'type':Sequelize[_0x8b5a('0x2')],'allowNull':![],'unique':_0x8b5a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x5'),_0x8b5a('0x6'),_0x8b5a('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x8b5a('0x2')],'allowNull':![],'defaultValue':_0x8b5a('0x8')},'callingpres':{'type':Sequelize[_0x8b5a('0x4')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x8b5a('0x9'),_0x8b5a('0xa'),_0x8b5a('0xb'),_0x8b5a('0xc'),'PROHIB_FAILED_SCREEN',_0x8b5a('0xd'))},'deny':{'type':Sequelize[_0x8b5a('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8b5a('0x2')]},'md5secret':{'type':Sequelize[_0x8b5a('0x2')]},'remotesecret':{'type':Sequelize[_0x8b5a('0x2')]},'transport':{'type':Sequelize[_0x8b5a('0x2')],'defaultValue':_0x8b5a('0xe'),'set':function(_0x38e425){this[_0x8b5a('0xf')](_0x8b5a('0x10'),_0x38e425?_0x38e425['join'](','):null);},'get':function(){return this['getDataValue'](_0x8b5a('0x10'))?this[_0x8b5a('0x11')]('transport')[_0x8b5a('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x13'),_0x8b5a('0x14'),_0x8b5a('0x15'),_0x8b5a('0x16'),_0x8b5a('0x17')),'defaultValue':_0x8b5a('0x13')},'directmedia':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no',_0x8b5a('0x19'),'update',_0x8b5a('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8b5a('0x2')]},'directmediadeny':{'type':Sequelize[_0x8b5a('0x2')]},'nat':{'type':Sequelize[_0x8b5a('0x2')],'defaultValue':_0x8b5a('0x1b'),'set':function(_0x4d478f){this[_0x8b5a('0xf')](_0x8b5a('0x1c'),_0x4d478f?_0x4d478f['join'](','):null);},'get':function(){return this[_0x8b5a('0x11')](_0x8b5a('0x1c'))?this[_0x8b5a('0x11')](_0x8b5a('0x1c'))[_0x8b5a('0x12')](','):null;},'comment':_0x8b5a('0x1d')},'callgroup':{'type':Sequelize[_0x8b5a('0x2')]},'namedcallgroup':{'type':Sequelize[_0x8b5a('0x2')]},'pickupgroup':{'type':Sequelize[_0x8b5a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8b5a('0x2')]},'language':{'type':Sequelize[_0x8b5a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8b5a('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8b5a('0x2')],'defaultValue':_0x8b5a('0x1e')},'allow':{'type':Sequelize[_0x8b5a('0x2')],'allowNull':![],'defaultValue':_0x8b5a('0x1f'),'set':function(_0x22caa5){this[_0x8b5a('0xf')](_0x8b5a('0x20'),_0x22caa5?_0x22caa5[_0x8b5a('0x21')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x8b5a('0x11')]('allow')?this[_0x8b5a('0x11')](_0x8b5a('0x20'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x8b5a('0x22'),'set':function(_0x224bc7){this[_0x8b5a('0xf')](_0x8b5a('0x23'),_0x224bc7?_0x224bc7[_0x8b5a('0x21')](','):null);},'get':function(){return this[_0x8b5a('0x11')]('insecure')?this[_0x8b5a('0x11')](_0x8b5a('0x23'))['split'](','):null;},'comment':_0x8b5a('0x24')},'trustrpid':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x8b5a('0x18'),'no',_0x8b5a('0x25'))},'promiscredir':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'setvar':{'type':Sequelize[_0x8b5a('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x8b5a('0x27')},'amaflags':{'type':Sequelize[_0x8b5a('0x2')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8b5a('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x8b5a('0x2')]},'template':{'type':Sequelize[_0x8b5a('0x2')]},'videosupport':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no',_0x8b5a('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x8b5a('0x2')]},'session_timers':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x29'),'refuse',_0x8b5a('0x2a'))},'session_expires':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x8b5a('0x2b'),_0x8b5a('0x2c')),'defaultValue':_0x8b5a('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x8b5a('0x2')]},'regexten':{'type':Sequelize[_0x8b5a('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x8b5a('0x2')]},'port':{'type':Sequelize[_0x8b5a('0x26')](0x5)},'qualify':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no'),'defaultValue':_0x8b5a('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8b5a('0x2')]},'rtptimeout':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x8b5a('0x4')]('yes','no',_0x8b5a('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x8b5a('0x2')]},'contactdeny':{'type':Sequelize[_0x8b5a('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x8b5a('0x2')]},'maxforwards':{'type':Sequelize[_0x8b5a('0x26')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x8b5a('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8b5a('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'icesupport':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no',_0x8b5a('0x2e'),_0x8b5a('0x2f'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x8b5a('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x8b5a('0x2')]},'dtlscipher':{'type':Sequelize[_0x8b5a('0x2')]},'dtlscafile':{'type':Sequelize[_0x8b5a('0x2')]},'dtlscapath':{'type':Sequelize[_0x8b5a('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8b5a('0x30'),_0x8b5a('0x31'),_0x8b5a('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8b5a('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x8b5a('0x4')](_0x8b5a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x8b5a('0x2')]},'mohinterpret':{'type':Sequelize[_0x8b5a('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x8b5a('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x8b5a('0x2')],'defaultValue':_0x8b5a('0x33')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x8b5a('0x19'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x8b5a('0x2')]},'otherFields':{'type':Sequelize[_0x8b5a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8b5a('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xa691=['all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','uac','uas','pai','certificate','active','passive','nonat','update,nonat','BOOLEAN','exports','STRING','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x2692fd,_0x42a642){var _0x3d01e2=function(_0x522c67){while(--_0x522c67){_0x2692fd['push'](_0x2692fd['shift']());}};_0x3d01e2(++_0x42a642);}(_0xa691,0xd4));var _0x1a69=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa691[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x1a69('0x0')]={'name':{'type':Sequelize[_0x1a69('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1a69('0x2')]('friend',_0x1a69('0x3'),_0x1a69('0x4')),'allowNull':![],'defaultValue':_0x1a69('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a69('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x1a69('0x7'),_0x1a69('0x8'),'ALLOWED_FAILED_SCREEN',_0x1a69('0x9'),'PROHIB_NOT_SCREENED',_0x1a69('0xa'),_0x1a69('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x1a69('0x1')]},'permit':{'type':Sequelize[_0x1a69('0x1')]},'secret':{'type':Sequelize[_0x1a69('0x1')]},'md5secret':{'type':Sequelize[_0x1a69('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':_0x1a69('0xc'),'set':function(_0x219b3d){this[_0x1a69('0xd')]('transport',_0x219b3d?_0x219b3d[_0x1a69('0xe')](','):null);},'get':function(){return this[_0x1a69('0xf')](_0x1a69('0x10'))?this[_0x1a69('0xf')]('transport')[_0x1a69('0x11')](','):null;},'comment':_0x1a69('0x12')},'dtmfmode':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x13'),_0x1a69('0x14'),_0x1a69('0x15'),'inband',_0x1a69('0x16')),'defaultValue':_0x1a69('0x13')},'directmedia':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no','nonat',_0x1a69('0x18'),_0x1a69('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x1a69('0x1')]},'nat':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x69eaee){this[_0x1a69('0xd')](_0x1a69('0x1a'),_0x69eaee?_0x69eaee['join'](','):null);},'get':function(){return this[_0x1a69('0xf')](_0x1a69('0x1a'))?this['getDataValue'](_0x1a69('0x1a'))[_0x1a69('0x11')](','):null;},'comment':_0x1a69('0x1b')},'callgroup':{'type':Sequelize[_0x1a69('0x1')]},'namedcallgroup':{'type':Sequelize[_0x1a69('0x1')]},'pickupgroup':{'type':Sequelize[_0x1a69('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1a69('0x1')]},'language':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':_0x1a69('0x1c')},'allow':{'type':Sequelize[_0x1a69('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4c4bda){this['setDataValue'](_0x1a69('0x1d'),_0x4c4bda?_0x4c4bda[_0x1a69('0xe')](';'):_0x1a69('0x1e'));},'get':function(){return this[_0x1a69('0xf')](_0x1a69('0x1d'))?this[_0x1a69('0xf')]('allow')['split'](';'):null;},'comment':_0x1a69('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no')},'insecure':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':'port,invite','set':function(_0x294bb8){this[_0x1a69('0xd')](_0x1a69('0x20'),_0x294bb8?_0x294bb8[_0x1a69('0xe')](','):null);},'get':function(){return this[_0x1a69('0xf')](_0x1a69('0x20'))?this[_0x1a69('0xf')]('insecure')[_0x1a69('0x11')](','):null;},'comment':_0x1a69('0x21')},'trustrpid':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no',_0x1a69('0x22'))},'promiscredir':{'type':Sequelize[_0x1a69('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no')},'accountcode':{'type':Sequelize[_0x1a69('0x23')](0xb)},'setvar':{'type':Sequelize[_0x1a69('0x1')]},'callerid':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1a69('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no'),'defaultValue':_0x1a69('0x17')},'busylevel':{'type':Sequelize[_0x1a69('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x1a69('0x1')]},'template':{'type':Sequelize[_0x1a69('0x1')]},'videosupport':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no',_0x1a69('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no')},'mailbox':{'type':Sequelize[_0x1a69('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x1a69('0x25'),_0x1a69('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x1a69('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x1a69('0x27'),_0x1a69('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x1a69('0x1')]},'fromdomain':{'type':Sequelize[_0x1a69('0x1')]},'fromuser':{'type':Sequelize[_0x1a69('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1a69('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x1a69('0x1')]},'defaultuser':{'type':Sequelize[_0x1a69('0x1')]},'rtptimeout':{'type':Sequelize[_0x1a69('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1a69('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1a69('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no',_0x1a69('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1a69('0x1')]},'callbackextension':{'type':Sequelize[_0x1a69('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1a69('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1a69('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x1a69('0x1')]},'contactdeny':{'type':Sequelize[_0x1a69('0x1')]},'contactacl':{'type':Sequelize[_0x1a69('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x1a69('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x1a69('0x23')](0xb)},'encryption':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no')},'force_avp':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no','fingerprint',_0x1a69('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x1a69('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1a69('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x1a69('0x1')]},'dtlscipher':{'type':Sequelize[_0x1a69('0x1')]},'dtlscafile':{'type':Sequelize[_0x1a69('0x1')]},'dtlscapath':{'type':Sequelize[_0x1a69('0x1')]},'dtlssetup':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x2b'),_0x1a69('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1a69('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x1a69('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x1a69('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x1a69('0x1')]},'parkinglot':{'type':Sequelize[_0x1a69('0x1')]},'description':{'type':Sequelize[_0x1a69('0x1')]},'host':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x1a69('0x2')](_0x1a69('0x17'),'no',_0x1a69('0x2d'),'update',_0x1a69('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1a69('0x1')]},'otherFields':{'type':Sequelize[_0x1a69('0x1')]},'active':{'type':Sequelize[_0x1a69('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1a69('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5d00ae5..1e00d2d 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x280e38,_0x53f78d){var _0x45e18b=function(_0x47df45){while(--_0x47df45){_0x280e38['push'](_0x280e38['shift']());}};_0x45e18b(++_0x53f78d);}(_0x84ab,0x12f));var _0xb84a=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x84ab[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file +var _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x510122,_0x54c2d5){var _0x582f70=function(_0x400b07){while(--_0x400b07){_0x510122['push'](_0x510122['shift']());}};_0x582f70(++_0x54c2d5);}(_0xbec5,0xe5));var _0x5bec=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0xbec5[_0x1ab180];return _0xfb2c2d;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e9bfaa1..09aed48 100644 --- a/server/api/trunk/trunk.model.js +++ b/server/api/trunk/trunk.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd50f=['api','moment','bluebird','path','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x228ecb,_0x51760e){var _0x3052f9=function(_0x42a09b){while(--_0x42a09b){_0x228ecb['push'](_0x228ecb['shift']());}};_0x3052f9(++_0x51760e);}(_0xd50f,0x1b6));var _0xfd50=function(_0x2ba8b0,_0x85d0d){_0x2ba8b0=_0x2ba8b0-0x0;var _0xd9845b=_0xd50f[_0x2ba8b0];return _0xd9845b;};'use strict';var _=require(_0xfd50('0x0'));var util=require(_0xfd50('0x1'));var logger=require('../../config/logger')(_0xfd50('0x2'));var moment=require(_0xfd50('0x3'));var BPromise=require(_0xfd50('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd50('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd50('0x6'));module[_0xfd50('0x7')]=function(_0x5233a0,_0x17797a){return _0x5233a0[_0xfd50('0x8')](_0xfd50('0x9'),attributes,{'tableName':_0xfd50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1052=['request-promise','path','../../config/environment','exports','define','Trunk','tools_trunks','lodash','../../config/logger','api'];(function(_0x56af80,_0x1f3338){var _0x2b581f=function(_0x235296){while(--_0x235296){_0x56af80['push'](_0x56af80['shift']());}};_0x2b581f(++_0x1f3338);}(_0x1052,0x133));var _0x2105=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x1052[_0x1529a3];return _0x1a0d4b;};'use strict';var _=require(_0x2105('0x0'));var util=require('util');var logger=require(_0x2105('0x1'))(_0x2105('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2105('0x3'));var fs=require('fs');var path=require(_0x2105('0x4'));var rimraf=require('rimraf');var config=require(_0x2105('0x5'));var attributes=require('./trunk.attributes');module[_0x2105('0x6')]=function(_0x551ca9,_0xb6ee76){return _0x551ca9[_0x2105('0x7')](_0x2105('0x8'),attributes,{'tableName':_0x2105('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 245e030..398e584 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac12=['model','map','then','stringify','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','code','message','error','result','catch','GetTrunk','Trunk','options','raw','where','attributes','include'];(function(_0x2a9e18,_0x58c69f){var _0x4e2ce9=function(_0x4836e6){while(--_0x4836e6){_0x2a9e18['push'](_0x2a9e18['shift']());}};_0x4e2ce9(++_0x58c69f);}(_0xac12,0x1e7));var _0x2ac1=function(_0xf294b7,_0x528163){_0xf294b7=_0xf294b7-0x0;var _0x1d5037=_0xac12[_0xf294b7];return _0x1d5037;};'use strict';var _=require(_0x2ac1('0x0'));var util=require(_0x2ac1('0x1'));var moment=require(_0x2ac1('0x2'));var BPromise=require(_0x2ac1('0x3'));var rs=require(_0x2ac1('0x4'));var fs=require('fs');var Redis=require(_0x2ac1('0x5'));var db=require(_0x2ac1('0x6'))['db'];var utils=require(_0x2ac1('0x7'));var logger=require(_0x2ac1('0x8'))(_0x2ac1('0x9'));var config=require(_0x2ac1('0xa'));var jayson=require(_0x2ac1('0xb'));var client=jayson[_0x2ac1('0xc')][_0x2ac1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xfa5ef1,_0x3aafee,_0x1b9a33){return new BPromise(function(_0x1a1a68,_0x446276){return client[_0x2ac1('0xe')](_0xfa5ef1,_0x1b9a33)['then'](function(_0x10bd74){logger[_0x2ac1('0xf')](_0x2ac1('0x10'),_0x3aafee,_0x2ac1('0x11'));logger[_0x2ac1('0x12')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3aafee,_0x2ac1('0x11'),JSON['stringify'](_0x10bd74));if(_0x10bd74['error']){if(_0x10bd74['error'][_0x2ac1('0x13')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x3aafee,_0x10bd74['error'][_0x2ac1('0x14')]);return _0x446276(_0x10bd74[_0x2ac1('0x15')][_0x2ac1('0x14')]);}logger[_0x2ac1('0x15')](_0x2ac1('0x10'),_0x3aafee,_0x10bd74[_0x2ac1('0x15')][_0x2ac1('0x14')]);return _0x1a1a68(_0x10bd74[_0x2ac1('0x15')][_0x2ac1('0x14')]);}else{logger[_0x2ac1('0xf')](_0x2ac1('0x10'),_0x3aafee,'request\x20sent');_0x1a1a68(_0x10bd74[_0x2ac1('0x16')][_0x2ac1('0x14')]);}})[_0x2ac1('0x17')](function(_0x1d1302){logger[_0x2ac1('0x15')](_0x2ac1('0x10'),_0x3aafee,_0x1d1302);_0x446276(_0x1d1302);});});}exports[_0x2ac1('0x18')]=function(_0x2a4ea8){var _0x3db860=this;return new Promise(function(_0x361262,_0x1b6ab5){return db[_0x2ac1('0x19')]['findAll']({'raw':_0x2a4ea8[_0x2ac1('0x1a')]?_0x2a4ea8[_0x2ac1('0x1a')][_0x2ac1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a4ea8['options']?_0x2a4ea8[_0x2ac1('0x1a')][_0x2ac1('0x1c')]||null:null,'attributes':_0x2a4ea8[_0x2ac1('0x1a')]?_0x2a4ea8[_0x2ac1('0x1a')][_0x2ac1('0x1d')]||null:null,'limit':_0x2a4ea8[_0x2ac1('0x1a')]?_0x2a4ea8[_0x2ac1('0x1a')]['limit']||null:null,'include':_0x2a4ea8['options']?_0x2a4ea8[_0x2ac1('0x1a')][_0x2ac1('0x1e')]?_['map'](_0x2a4ea8['options'][_0x2ac1('0x1e')],function(_0x2b4c93){return{'model':db[_0x2b4c93[_0x2ac1('0x1f')]],'as':_0x2b4c93['as'],'attributes':_0x2b4c93['attributes'],'include':_0x2b4c93['include']?_['map'](_0x2b4c93[_0x2ac1('0x1e')],function(_0x42ceb1){return{'model':db[_0x42ceb1[_0x2ac1('0x1f')]],'as':_0x42ceb1['as'],'attributes':_0x42ceb1[_0x2ac1('0x1d')],'include':_0x42ceb1[_0x2ac1('0x1e')]?_[_0x2ac1('0x20')](_0x42ceb1[_0x2ac1('0x1e')],function(_0x2e2a18){return{'model':db[_0x2e2a18[_0x2ac1('0x1f')]],'as':_0x2e2a18['as'],'attributes':_0x2e2a18['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ac1('0x21')](function(_0x49f9f7){logger['info']('GetTrunk',_0x2a4ea8);logger[_0x2ac1('0x12')](_0x2ac1('0x18'),_0x2a4ea8,JSON[_0x2ac1('0x22')](_0x49f9f7));_0x361262(_0x49f9f7);})[_0x2ac1('0x17')](function(_0x261330){logger['error'](_0x2ac1('0x18'),_0x261330['message'],_0x2a4ea8);_0x1b6ab5(_0x3db860[_0x2ac1('0x15')](0x1f4,_0x261330[_0x2ac1('0x14')]));});});};exports[_0x2ac1('0x23')]=function(_0x5bf90c){var _0x4bf2b5=this;return new Promise(function(_0x3a85a3,_0xcb1dd3){return db[_0x2ac1('0x19')][_0x2ac1('0x24')]({'raw':_0x5bf90c['options']?_0x5bf90c[_0x2ac1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5bf90c[_0x2ac1('0x1a')]?_0x5bf90c[_0x2ac1('0x1a')]['where']||null:null,'attributes':_0x5bf90c['options']?_0x5bf90c['options'][_0x2ac1('0x1d')]||null:null,'include':_0x5bf90c['options']?_0x5bf90c[_0x2ac1('0x1a')][_0x2ac1('0x1e')]?_['map'](_0x5bf90c[_0x2ac1('0x1a')][_0x2ac1('0x1e')],function(_0x1a9cd6){return{'model':db[_0x1a9cd6['model']],'as':_0x1a9cd6['as'],'attributes':_0x1a9cd6[_0x2ac1('0x1d')],'include':_0x1a9cd6[_0x2ac1('0x1e')]?_['map'](_0x1a9cd6[_0x2ac1('0x1e')],function(_0x186157){return{'model':db[_0x186157[_0x2ac1('0x1f')]],'as':_0x186157['as'],'attributes':_0x186157[_0x2ac1('0x1d')],'include':_0x186157[_0x2ac1('0x1e')]?_[_0x2ac1('0x20')](_0x186157['include'],function(_0x37fac8){return{'model':db[_0x37fac8[_0x2ac1('0x1f')]],'as':_0x37fac8['as'],'attributes':_0x37fac8[_0x2ac1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2ac1('0x21')](function(_0x390ea9){logger[_0x2ac1('0xf')](_0x2ac1('0x23'),_0x5bf90c);logger[_0x2ac1('0x12')](_0x2ac1('0x23'),_0x5bf90c,JSON[_0x2ac1('0x22')](_0x390ea9));_0x3a85a3(_0x390ea9);})[_0x2ac1('0x17')](function(_0x57b2fe){logger['error'](_0x2ac1('0x23'),_0x57b2fe[_0x2ac1('0x14')],_0x5bf90c);_0xcb1dd3(_0x4bf2b5['error'](0x1f4,_0x57b2fe[_0x2ac1('0x14')]));});});}; \ No newline at end of file +var _0x7aff=['message','result','catch','GetTrunk','Trunk','findAll','raw','options','where','attributes','include','model','map','then','stringify','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x368d91,_0x10afce){var _0x32b5f9=function(_0xb432d6){while(--_0xb432d6){_0x368d91['push'](_0x368d91['shift']());}};_0x32b5f9(++_0x10afce);}(_0x7aff,0x7a));var _0xf7af=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7aff[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xf7af('0x0'));var util=require(_0xf7af('0x1'));var moment=require(_0xf7af('0x2'));var BPromise=require(_0xf7af('0x3'));var rs=require(_0xf7af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7af('0x5'))['db'];var utils=require(_0xf7af('0x6'));var logger=require(_0xf7af('0x7'))(_0xf7af('0x8'));var config=require('../../config/environment');var jayson=require(_0xf7af('0x9'));var client=jayson[_0xf7af('0xa')][_0xf7af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36d1d6,_0x57f00c,_0x4e7f78){return new BPromise(function(_0x3e18da,_0x327395){return client['request'](_0x36d1d6,_0x4e7f78)['then'](function(_0x4e60cd){logger[_0xf7af('0xc')](_0xf7af('0xd'),_0x57f00c,'request\x20sent');logger[_0xf7af('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x57f00c,_0xf7af('0xf'),JSON['stringify'](_0x4e60cd));if(_0x4e60cd[_0xf7af('0x10')]){if(_0x4e60cd[_0xf7af('0x10')][_0xf7af('0x11')]===0x1f4){logger[_0xf7af('0x10')](_0xf7af('0xd'),_0x57f00c,_0x4e60cd[_0xf7af('0x10')]['message']);return _0x327395(_0x4e60cd[_0xf7af('0x10')][_0xf7af('0x12')]);}logger['error'](_0xf7af('0xd'),_0x57f00c,_0x4e60cd[_0xf7af('0x10')][_0xf7af('0x12')]);return _0x3e18da(_0x4e60cd[_0xf7af('0x10')]['message']);}else{logger[_0xf7af('0xc')](_0xf7af('0xd'),_0x57f00c,'request\x20sent');_0x3e18da(_0x4e60cd[_0xf7af('0x13')][_0xf7af('0x12')]);}})[_0xf7af('0x14')](function(_0x5d63d2){logger[_0xf7af('0x10')](_0xf7af('0xd'),_0x57f00c,_0x5d63d2);_0x327395(_0x5d63d2);});});}exports[_0xf7af('0x15')]=function(_0x3ae04d){var _0x5e8590=this;return new Promise(function(_0x286a7f,_0x434e9e){return db[_0xf7af('0x16')][_0xf7af('0x17')]({'raw':_0x3ae04d['options']?_0x3ae04d['options'][_0xf7af('0x18')]===undefined?!![]:![]:!![],'where':_0x3ae04d[_0xf7af('0x19')]?_0x3ae04d['options'][_0xf7af('0x1a')]||null:null,'attributes':_0x3ae04d[_0xf7af('0x19')]?_0x3ae04d[_0xf7af('0x19')][_0xf7af('0x1b')]||null:null,'limit':_0x3ae04d['options']?_0x3ae04d[_0xf7af('0x19')]['limit']||null:null,'include':_0x3ae04d[_0xf7af('0x19')]?_0x3ae04d['options'][_0xf7af('0x1c')]?_['map'](_0x3ae04d[_0xf7af('0x19')][_0xf7af('0x1c')],function(_0x2fd17f){return{'model':db[_0x2fd17f[_0xf7af('0x1d')]],'as':_0x2fd17f['as'],'attributes':_0x2fd17f[_0xf7af('0x1b')],'include':_0x2fd17f[_0xf7af('0x1c')]?_['map'](_0x2fd17f[_0xf7af('0x1c')],function(_0x4154b4){return{'model':db[_0x4154b4['model']],'as':_0x4154b4['as'],'attributes':_0x4154b4['attributes'],'include':_0x4154b4['include']?_[_0xf7af('0x1e')](_0x4154b4[_0xf7af('0x1c')],function(_0x95c425){return{'model':db[_0x95c425[_0xf7af('0x1d')]],'as':_0x95c425['as'],'attributes':_0x95c425[_0xf7af('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf7af('0x1f')](function(_0x259dc2){logger[_0xf7af('0xc')](_0xf7af('0x15'),_0x3ae04d);logger[_0xf7af('0xe')](_0xf7af('0x15'),_0x3ae04d,JSON[_0xf7af('0x20')](_0x259dc2));_0x286a7f(_0x259dc2);})[_0xf7af('0x14')](function(_0x980093){logger[_0xf7af('0x10')]('GetTrunk',_0x980093[_0xf7af('0x12')],_0x3ae04d);_0x434e9e(_0x5e8590['error'](0x1f4,_0x980093['message']));});});};exports[_0xf7af('0x21')]=function(_0xde392){var _0x5f3998=this;return new Promise(function(_0x5412ab,_0x22ea63){return db['Trunk'][_0xf7af('0x22')]({'raw':_0xde392[_0xf7af('0x19')]?_0xde392[_0xf7af('0x19')][_0xf7af('0x18')]===undefined?!![]:![]:!![],'where':_0xde392['options']?_0xde392[_0xf7af('0x19')]['where']||null:null,'attributes':_0xde392['options']?_0xde392[_0xf7af('0x19')][_0xf7af('0x1b')]||null:null,'include':_0xde392[_0xf7af('0x19')]?_0xde392[_0xf7af('0x19')][_0xf7af('0x1c')]?_['map'](_0xde392[_0xf7af('0x19')][_0xf7af('0x1c')],function(_0x5a5650){return{'model':db[_0x5a5650['model']],'as':_0x5a5650['as'],'attributes':_0x5a5650['attributes'],'include':_0x5a5650[_0xf7af('0x1c')]?_['map'](_0x5a5650[_0xf7af('0x1c')],function(_0x3e3402){return{'model':db[_0x3e3402[_0xf7af('0x1d')]],'as':_0x3e3402['as'],'attributes':_0x3e3402[_0xf7af('0x1b')],'include':_0x3e3402[_0xf7af('0x1c')]?_[_0xf7af('0x1e')](_0x3e3402[_0xf7af('0x1c')],function(_0x56ccd2){return{'model':db[_0x56ccd2[_0xf7af('0x1d')]],'as':_0x56ccd2['as'],'attributes':_0x56ccd2[_0xf7af('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf7af('0x1f')](function(_0x5afdf4){logger[_0xf7af('0xc')]('ShowTrunk',_0xde392);logger['debug']('ShowTrunk',_0xde392,JSON[_0xf7af('0x20')](_0x5afdf4));_0x5412ab(_0x5afdf4);})['catch'](function(_0xf54538){logger[_0xf7af('0x10')]('ShowTrunk',_0xf54538[_0xf7af('0x12')],_0xde392);_0x22ea63(_0x5f3998['error'](0x1f4,_0xf54538['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b5992ec..46b6ace 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30a4=['./user-setting.controller','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x5c90d7,_0x28877a){var _0x4ae184=function(_0x5661f2){while(--_0x5661f2){_0x5c90d7['push'](_0x5c90d7['shift']());}};_0x4ae184(++_0x28877a);}(_0x30a4,0x1e3));var _0x430a=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0x30a4[_0x3186aa];return _0x2d8c36;};'use strict';var express=require(_0x430a('0x0'));var router=express[_0x430a('0x1')]();var auth=require(_0x430a('0x2'));var controller=require(_0x430a('0x3'));router['put']('/:id',auth[_0x430a('0x4')](),controller['update']);module[_0x430a('0x5')]=router; \ No newline at end of file +var _0x4272=['put','/:id','isAuthenticated','express','Router','../../components/auth/service','./user-setting.controller'];(function(_0x5b0478,_0x541658){var _0x10bd0e=function(_0x19c403){while(--_0x19c403){_0x5b0478['push'](_0x5b0478['shift']());}};_0x10bd0e(++_0x541658);}(_0x4272,0x96));var _0x2427=function(_0x218db4,_0xd7de8e){_0x218db4=_0x218db4-0x0;var _0x3b17d9=_0x4272[_0x218db4];return _0x3b17d9;};'use strict';var express=require(_0x2427('0x0'));var router=express[_0x2427('0x1')]();var auth=require(_0x2427('0x2'));var controller=require(_0x2427('0x3'));router[_0x2427('0x4')](_0x2427('0x5'),auth[_0x2427('0x6')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index b6c8eef..d48d08c 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e51=['info','ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning'];(function(_0xc3f2c8,_0x3eb414){var _0x3e4f94=function(_0x28aa4d){while(--_0x28aa4d){_0xc3f2c8['push'](_0xc3f2c8['shift']());}};_0x3e4f94(++_0x3eb414);}(_0x9e51,0x126));var _0x19e5=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x9e51[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x19e5('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x19e5('0x1'),_0x19e5('0x2'),_0x19e5('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x19e5('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x19e5('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x19e5('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x19e5('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x19e5('0x7')],'unique':_0x19e5('0x8')}}; \ No newline at end of file +var _0xfec3=['UserId','sequelize','error','warning','info','ENUM','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfec3,0x181));var _0x3fec=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfec3[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x3fec('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3fec('0x1'),_0x3fec('0x2'),_0x3fec('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x3fec('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3fec('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3fec('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3fec('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x3fec('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 5b7c979..532e7be 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['json','update','then','sendStatus','error','stack','name','user','admin','Unauthorized','Invalid\x20user\x20setting\x20id','find','params','body','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status'];(function(_0x217a32,_0xf54a9d){var _0x59d0ff=function(_0x5a3113){while(--_0x5a3113){_0x217a32['push'](_0x217a32['shift']());}};_0x59d0ff(++_0xf54a9d);}(_0x34e8,0x12c));var _0x834e=function(_0x8173b4,_0x135b62){_0x8173b4=_0x8173b4-0x0;var _0x1c2789=_0x34e8[_0x8173b4];return _0x1c2789;};'use strict';var _=require(_0x834e('0x0'));var Redis=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var config=require('../../config/environment');var db=require(_0x834e('0x4'))['db'];var socket=require(_0x834e('0x5'))(new Redis(config[_0x834e('0x6')]));require(_0x834e('0x7'))[_0x834e('0x8')](socket);config[_0x834e('0x6')]=_[_0x834e('0x9')](config['redis'],{'host':_0x834e('0xa'),'port':0x18eb});function respondWithResult(_0x52056d,_0x3e16d2){_0x3e16d2=_0x3e16d2||0xc8;return function(_0x3cc2e3){if(_0x3cc2e3){return _0x52056d[_0x834e('0xb')](_0x3e16d2)[_0x834e('0xc')](_0x3cc2e3);}};}function saveUpdates(_0x33ea05){return function(_0x23501c){if(_0x23501c){return _0x23501c[_0x834e('0xd')](_0x33ea05)[_0x834e('0xe')](function(_0x3bdda9){return _0x3bdda9;});}return null;};}function handleEntityNotFound(_0x186b3b){return function(_0x1e41fe){if(!_0x1e41fe){_0x186b3b[_0x834e('0xf')](0x194);}return _0x1e41fe;};}function handleError(_0x14038b,_0x2e1a37){_0x2e1a37=_0x2e1a37||0x1f4;return function(_0x293514){logger[_0x834e('0x10')](_0x293514[_0x834e('0x11')]);if(_0x293514['name']){delete _0x293514[_0x834e('0x12')];}_0x14038b[_0x834e('0xb')](_0x2e1a37)['send'](_0x293514);};}exports[_0x834e('0xd')]=function(_0x2d95f2,_0x28e659){if(_0x2d95f2[_0x834e('0x13')]['role']!==_0x834e('0x14'))throw new Error(_0x834e('0x15'));if(isNaN(Number(_0x2d95f2['params']['id'])))throw new Error(_0x834e('0x16'));return db['UserSetting'][_0x834e('0x17')]({'where':{'id':_0x2d95f2[_0x834e('0x18')]['id']}})['then'](handleEntityNotFound(_0x28e659,null))[_0x834e('0xe')](saveUpdates(_0x2d95f2[_0x834e('0x19')],null))[_0x834e('0xe')](respondWithResult(_0x28e659,null))['catch'](handleError(_0x28e659,null));}; \ No newline at end of file +var _0x2557=['send','update','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','defaults','localhost','json','then','sendStatus','error','status'];(function(_0x5a0e1d,_0x261edc){var _0x320dc0=function(_0x2fef8a){while(--_0x2fef8a){_0x5a0e1d['push'](_0x5a0e1d['shift']());}};_0x320dc0(++_0x261edc);}(_0x2557,0x11e));var _0x7255=function(_0x5c45ce,_0x57f70a){_0x5c45ce=_0x5c45ce-0x0;var _0x54de61=_0x2557[_0x5c45ce];return _0x54de61;};'use strict';var _=require(_0x7255('0x0'));var Redis=require('ioredis');var logger=require(_0x7255('0x1'))(_0x7255('0x2'));var config=require(_0x7255('0x3'));var db=require(_0x7255('0x4'))['db'];var socket=require(_0x7255('0x5'))(new Redis(config[_0x7255('0x6')]));require('./user-setting.socket')['register'](socket);config['redis']=_[_0x7255('0x7')](config[_0x7255('0x6')],{'host':_0x7255('0x8'),'port':0x18eb});function respondWithResult(_0x841417,_0x419dc0){_0x419dc0=_0x419dc0||0xc8;return function(_0x2142a5){if(_0x2142a5){return _0x841417['status'](_0x419dc0)[_0x7255('0x9')](_0x2142a5);}};}function saveUpdates(_0x34511b){return function(_0x468316){if(_0x468316){return _0x468316['update'](_0x34511b)[_0x7255('0xa')](function(_0x18f985){return _0x18f985;});}return null;};}function handleEntityNotFound(_0x17a5c7){return function(_0xdf5bc3){if(!_0xdf5bc3){_0x17a5c7[_0x7255('0xb')](0x194);}return _0xdf5bc3;};}function handleError(_0x17601b,_0x1b8990){_0x1b8990=_0x1b8990||0x1f4;return function(_0x532392){logger[_0x7255('0xc')](_0x532392['stack']);if(_0x532392['name']){delete _0x532392['name'];}_0x17601b[_0x7255('0xd')](_0x1b8990)[_0x7255('0xe')](_0x532392);};}exports[_0x7255('0xf')]=function(_0x916da9,_0x42a98b){if(_0x916da9[_0x7255('0x10')][_0x7255('0x11')]!=='admin')throw new Error(_0x7255('0x12'));if(isNaN(Number(_0x916da9[_0x7255('0x13')]['id'])))throw new Error(_0x7255('0x14'));return db[_0x7255('0x15')][_0x7255('0x16')]({'where':{'id':_0x916da9[_0x7255('0x13')]['id']}})[_0x7255('0xa')](handleEntityNotFound(_0x42a98b,null))[_0x7255('0xa')](saveUpdates(_0x916da9[_0x7255('0x17')],null))[_0x7255('0xa')](respondWithResult(_0x42a98b,null))[_0x7255('0x18')](handleError(_0x42a98b,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index e61f106..56036da 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc78=['../../mysqldb','UserSetting','emit','hasOwnProperty','events'];(function(_0x1e465f,_0x5a75c8){var _0x102a6b=function(_0x3cc4ca){while(--_0x3cc4ca){_0x1e465f['push'](_0x1e465f['shift']());}};_0x102a6b(++_0x5a75c8);}(_0xfc78,0x77));var _0x8fc7=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xfc78[_0x365be9];return _0x185c12;};'use strict';var EventEmitter=require(_0x8fc7('0x0'));var UserSetting=require(_0x8fc7('0x1'))['db'][_0x8fc7('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1ff4cb){return function(_0x9a9f9b,_0xf68997,_0x8f5e2f){UserSettingEvents['emit'](_0x1ff4cb+':'+_0x9a9f9b['id'],_0x9a9f9b);UserSettingEvents[_0x8fc7('0x3')](_0x1ff4cb,_0x9a9f9b);_0x8f5e2f(null);};}for(var e in events){if(events[_0x8fc7('0x4')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xb236=['update','remove','emit','hasOwnProperty','hook','events','UserSetting','setMaxListeners'];(function(_0x4128db,_0x19a081){var _0x5e18a=function(_0x332e53){while(--_0x332e53){_0x4128db['push'](_0x4128db['shift']());}};_0x5e18a(++_0x19a081);}(_0xb236,0x14d));var _0x6b23=function(_0x291e43,_0x1ee9b8){_0x291e43=_0x291e43-0x0;var _0x5d8a90=_0xb236[_0x291e43];return _0x5d8a90;};'use strict';var EventEmitter=require(_0x6b23('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x6b23('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x6b23('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b23('0x3'),'afterDestroy':_0x6b23('0x4')};function emitEvent(_0x3b9bdc){return function(_0x471d3f,_0x9fba96,_0x46fe1e){UserSettingEvents['emit'](_0x3b9bdc+':'+_0x471d3f['id'],_0x471d3f);UserSettingEvents[_0x6b23('0x5')](_0x3b9bdc,_0x471d3f);_0x46fe1e(null);};}for(var e in events){if(events[_0x6b23('0x6')](e)){var event=events[e];UserSetting[_0x6b23('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index cb3311b..9ec2083 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf4c=['clientSideLoggingEnabledSince','exports','UserSetting','user_settings'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x25c426,_0x17569){_0x25c426=_0x25c426-0x0;var _0x5da8ab=_0xaf4c[_0x25c426];return _0x5da8ab;};'use strict';var attributes=require('./user-setting.attributes');module[_0xcaf4('0x0')]=function(_0x3af3b5){return _0x3af3b5['define'](_0xcaf4('0x1'),attributes,{'tableName':_0xcaf4('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19adc9){if(!_0x19adc9['clientSideLoggingEnabled'])_0x19adc9[_0xcaf4('0x3')]=null;else if(_0x19adc9[_0xcaf4('0x3')]===null)_0x19adc9[_0xcaf4('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x4157=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x71548c,_0x157aec){var _0x58a84b=function(_0x229e34){while(--_0x229e34){_0x71548c['push'](_0x71548c['shift']());}};_0x58a84b(++_0x157aec);}(_0x4157,0xf3));var _0x7415=function(_0x1c20f0,_0x5a5bb6){_0x1c20f0=_0x1c20f0-0x0;var _0x2211b7=_0x4157[_0x1c20f0];return _0x2211b7;};'use strict';var attributes=require(_0x7415('0x0'));module[_0x7415('0x1')]=function(_0x325318){return _0x325318[_0x7415('0x2')](_0x7415('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3efb60){if(!_0x3efb60[_0x7415('0x4')])_0x3efb60[_0x7415('0x5')]=null;else if(_0x3efb60[_0x7415('0x5')]===null)_0x3efb60[_0x7415('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 081ba4c..395d2b1 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9af=['user-setting:','./user-setting.events','save','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x419cba,_0x2173ee){var _0x5512ed=function(_0xf41bd){while(--_0xf41bd){_0x419cba['push'](_0x419cba['shift']());}};_0x5512ed(++_0x2173ee);}(_0xf9af,0x1a9));var _0xff9a=function(_0x12b5c1,_0xc22e4c){_0x12b5c1=_0x12b5c1-0x0;var _0x408e4e=_0xf9af[_0x12b5c1];return _0x408e4e;};'use strict';var UserSettingEvents=require(_0xff9a('0x0'));var events=[_0xff9a('0x1'),'remove','update'];function createListener(_0xe55922,_0x45824d){return function(_0x135e59){_0x45824d[_0xff9a('0x2')](_0xe55922,_0x135e59);if(_0xe55922===_0xff9a('0x3')){_0x45824d[_0xff9a('0x2')](_0xff9a('0x4')+_0x135e59[_0xff9a('0x5')],_0x135e59);}};}exports[_0xff9a('0x6')]=function(_0x4c1a0b){for(var _0x21d40f=0x0,_0x378d3c=events['length'];_0x21d40f<_0x378d3c;_0x21d40f++){var _0x2140dd=events[_0x21d40f];var _0x24ed58=createListener(_0xff9a('0x7')+_0x2140dd,_0x4c1a0b);UserSettingEvents['on'](_0x2140dd,_0x24ed58);}}; \ No newline at end of file +var _0x1160=['length','user-setting:','remove','emit','user-setting:update','UserId','register'];(function(_0x438e54,_0x5b041d){var _0x5d7a5e=function(_0x57a8a6){while(--_0x57a8a6){_0x438e54['push'](_0x438e54['shift']());}};_0x5d7a5e(++_0x5b041d);}(_0x1160,0x1c2));var _0x0116=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x1160[_0x44d9ab];return _0x31485e;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x0116('0x0'),'update'];function createListener(_0x437c75,_0x19394b){return function(_0x2bd5f1){_0x19394b[_0x0116('0x1')](_0x437c75,_0x2bd5f1);if(_0x437c75===_0x0116('0x2')){_0x19394b[_0x0116('0x1')]('user-setting:update:user-'+_0x2bd5f1[_0x0116('0x3')],_0x2bd5f1);}};}exports[_0x0116('0x4')]=function(_0x5aaa9a){for(var _0x15bd2f=0x0,_0x2d303a=events[_0x0116('0x5')];_0x15bd2f<_0x2d303a;_0x15bd2f++){var _0x16279d=events[_0x15bd2f];var _0x322275=createListener(_0x0116('0x6')+_0x16279d,_0x5aaa9a);UserSettingEvents['on'](_0x16279d,_0x322275);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 4435687..63cdf0b 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf49a=['/:id/openchannel_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getScheduledCalls','post','addContacts','create','/create_many','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts'];(function(_0x99499d,_0x5f5e06){var _0x5d0c22=function(_0x253172){while(--_0x253172){_0x99499d['push'](_0x99499d['shift']());}};_0x5d0c22(++_0x5f5e06);}(_0xf49a,0x8d));var _0xaf49=function(_0x1e9992,_0x24a7db){_0x1e9992=_0x1e9992-0x0;var _0x4204e2=_0xf49a[_0x1e9992];return _0x4204e2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaf49('0x0'));var timeout=require(_0xaf49('0x1'));var express=require(_0xaf49('0x2'));var router=express[_0xaf49('0x3')]();var fs_extra=require(_0xaf49('0x4'));var auth=require(_0xaf49('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaf49('0x6'));router['get']('/',auth[_0xaf49('0x7')](),controller[_0xaf49('0x8')]);router[_0xaf49('0x9')](_0xaf49('0xa'),auth[_0xaf49('0x7')](),controller[_0xaf49('0xb')]);router[_0xaf49('0x9')](_0xaf49('0xc'),auth['isAuthenticated'](),controller['whoami']);router[_0xaf49('0x9')](_0xaf49('0xd'),auth[_0xaf49('0x7')](),controller['getPresence']);router[_0xaf49('0x9')](_0xaf49('0xe'),auth[_0xaf49('0x7')](),controller[_0xaf49('0xf')]);router['get'](_0xaf49('0x10'),controller[_0xaf49('0x11')]);router[_0xaf49('0x9')](_0xaf49('0x12'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x13')]);router[_0xaf49('0x9')](_0xaf49('0x14'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x15')]);router[_0xaf49('0x9')](_0xaf49('0x16'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x17')]);router[_0xaf49('0x9')](_0xaf49('0x18'),auth[_0xaf49('0x7')](),controller['getVoiceQueuesRt']);router[_0xaf49('0x9')](_0xaf49('0x19'),auth[_0xaf49('0x7')](),controller['getGroups']);router[_0xaf49('0x9')](_0xaf49('0x1a'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x1b')]);router[_0xaf49('0x9')]('/:id/screen_recordings',auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0xaf49('0x9')](_0xaf49('0x1c'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x1d')]);router['get'](_0xaf49('0x1e'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x1f')]);router[_0xaf49('0x9')]('/:id/mail/interactions',auth[_0xaf49('0x7')](),controller['getMailInteractions']);router['get'](_0xaf49('0x20'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x21')]);router[_0xaf49('0x9')](_0xaf49('0x22'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x23')]);router[_0xaf49('0x9')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xaf49('0x24')]);router['get'](_0xaf49('0x25'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x26')]);router[_0xaf49('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0xaf49('0x27')]);router[_0xaf49('0x9')](_0xaf49('0x28'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x29')]);router['get'](_0xaf49('0x2a'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x2b')]);router[_0xaf49('0x9')](_0xaf49('0x2c'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x2d')]);router[_0xaf49('0x9')](_0xaf49('0x2e'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x2f')]);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xaf49('0x9')](_0xaf49('0x30'),auth['isAuthenticated'](),controller[_0xaf49('0x31')]);router['get']('/:id/chat_websites',auth[_0xaf49('0x7')](),controller['getChatWebsites']);router[_0xaf49('0x9')](_0xaf49('0x32'),auth[_0xaf49('0x7')](),controller['getWhatsappAccounts']);router[_0xaf49('0x9')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xaf49('0x33')]);router['get']('/:id/api_key',auth[_0xaf49('0x7')](),controller['getApiKey']);router[_0xaf49('0x34')]('/:id/contacts',auth[_0xaf49('0x7')](),controller[_0xaf49('0x35')]);router['post']('/',auth[_0xaf49('0x7')](),controller[_0xaf49('0x36')]);router[_0xaf49('0x34')](_0xaf49('0x37'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xaf49('0x34')](_0xaf49('0x16'),auth[_0xaf49('0x7')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46e267,_0x315c11,_0x2b22c1){_0x2b22c1(null,path['join'](config[_0xaf49('0x38')],_0xaf49('0x39')));},'filename':function(_0x49765a,_0xcfeb9a,_0x27616d){_0x27616d(null,util[_0xaf49('0x3a')](_0xaf49('0x3b'),Date[_0xaf49('0x3c')](),_0xcfeb9a[_0xaf49('0x3d')]));}})});router[_0xaf49('0x34')](_0xaf49('0x10'),upload[_0xaf49('0x3e')](_0xaf49('0x3f')),controller[_0xaf49('0x40')]);router[_0xaf49('0x34')]('/:id/login',auth[_0xaf49('0x7')](),controller[_0xaf49('0x41')]);router[_0xaf49('0x34')](_0xaf49('0x42'),auth['isAuthenticated'](),controller['logout']);router[_0xaf49('0x34')](_0xaf49('0x43'),auth['isAuthenticated'](),controller[_0xaf49('0x44')]);router[_0xaf49('0x34')](_0xaf49('0x45'),auth[_0xaf49('0x7')](),controller['unpause']);router['post'](_0xaf49('0x25'),auth['isAuthenticated'](),controller[_0xaf49('0x46')]);router[_0xaf49('0x34')]('/:id/chat_interactions',auth[_0xaf49('0x7')](),controller[_0xaf49('0x47')]);router['post'](_0xaf49('0x48'),auth[_0xaf49('0x7')](),controller['addMailInteractions']);router['post'](_0xaf49('0x49'),auth[_0xaf49('0x7')](),controller['addFaxInteractions']);router[_0xaf49('0x34')](_0xaf49('0x4a'),auth['isAuthenticated'](),controller[_0xaf49('0x4b')]);router[_0xaf49('0x34')](_0xaf49('0x4c'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x4d')]);router[_0xaf49('0x34')](_0xaf49('0x4e'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x4f')]);router[_0xaf49('0x34')]('/:id/fax_accounts',auth[_0xaf49('0x7')](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0xaf49('0x7')](),controller[_0xaf49('0x50')]);router[_0xaf49('0x34')](_0xaf49('0x51'),auth[_0xaf49('0x7')](),controller['addOpenchannelAccounts']);router['post'](_0xaf49('0x30'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x52')]);router[_0xaf49('0x34')](_0xaf49('0x53'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x54')]);router[_0xaf49('0x34')](_0xaf49('0x32'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x55')]);router['post'](_0xaf49('0x56'),auth['isAuthenticated'](),controller[_0xaf49('0x57')]);router['put']('/:id',auth[_0xaf49('0x7')](),controller[_0xaf49('0x58')]);router[_0xaf49('0x59')](_0xaf49('0x5a'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x5b')]);router[_0xaf49('0x5c')](_0xaf49('0x16'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x5d')]);router[_0xaf49('0x5c')](_0xaf49('0x25'),auth['isAuthenticated'](),controller[_0xaf49('0x5e')]);router[_0xaf49('0x5c')]('/:id',auth['isAuthenticated'](),controller[_0xaf49('0x5f')]);router[_0xaf49('0x5c')](_0xaf49('0x60'),auth['isAuthenticated'](),controller[_0xaf49('0x61')]);router['delete'](_0xaf49('0x48'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x62')]);router[_0xaf49('0x5c')](_0xaf49('0x49'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x63')]);router[_0xaf49('0x5c')](_0xaf49('0x4a'),auth['isAuthenticated'](),controller[_0xaf49('0x64')]);router[_0xaf49('0x5c')](_0xaf49('0x4c'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x65')]);router[_0xaf49('0x5c')](_0xaf49('0x4e'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x66')]);router[_0xaf49('0x5c')](_0xaf49('0x2c'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x67')]);router[_0xaf49('0x5c')](_0xaf49('0x2e'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x68')]);router[_0xaf49('0x5c')](_0xaf49('0x51'),auth['isAuthenticated'](),controller[_0xaf49('0x69')]);router[_0xaf49('0x5c')](_0xaf49('0x30'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x6a')]);router[_0xaf49('0x5c')]('/:id/chat_websites',auth[_0xaf49('0x7')](),controller[_0xaf49('0x6b')]);router['delete'](_0xaf49('0x32'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x6c')]);router['delete'](_0xaf49('0x56'),auth[_0xaf49('0x7')](),controller[_0xaf49('0x6d')]);module[_0xaf49('0x6e')]=router; \ No newline at end of file +var _0x073e=['/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','delete','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/api_key','getApiKey','addContacts','create','post','/create_many','bulkCreate','addQueues','join','root','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','unpause'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x073e,0x181));var _0xe073=function(_0x55be91,_0x1a5836){_0x55be91=_0x55be91-0x0;var _0xd5e5cc=_0x073e[_0x55be91];return _0xd5e5cc;};'use strict';var multer=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var path=require(_0xe073('0x2'));var timeout=require(_0xe073('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe073('0x4'));var interaction=require(_0xe073('0x5'));var config=require(_0xe073('0x6'));var controller=require('./user.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe073('0x7')]);router[_0xe073('0x8')](_0xe073('0x9'),auth[_0xe073('0xa')](),controller[_0xe073('0xb')]);router[_0xe073('0x8')]('/whoami',auth[_0xe073('0xa')](),controller[_0xe073('0xc')]);router[_0xe073('0x8')](_0xe073('0xd'),auth['isAuthenticated'](),controller[_0xe073('0xe')]);router[_0xe073('0x8')](_0xe073('0xf'),auth[_0xe073('0xa')](),controller[_0xe073('0x10')]);router[_0xe073('0x8')]('/:id/avatar',controller[_0xe073('0x11')]);router['get'](_0xe073('0x12'),auth['isAuthenticated'](),controller[_0xe073('0x13')]);router['get'](_0xe073('0x14'),auth[_0xe073('0xa')](),controller[_0xe073('0x15')]);router[_0xe073('0x8')](_0xe073('0x16'),auth[_0xe073('0xa')](),controller[_0xe073('0x17')]);router[_0xe073('0x8')](_0xe073('0x18'),auth[_0xe073('0xa')](),controller[_0xe073('0x19')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0xe073('0x1a')]);router[_0xe073('0x8')](_0xe073('0x1b'),auth[_0xe073('0xa')](),controller['getRecordings']);router[_0xe073('0x8')](_0xe073('0x1c'),auth[_0xe073('0xa')](),controller['getScreenRecordings']);router[_0xe073('0x8')](_0xe073('0x1d'),auth[_0xe073('0xa')](),controller[_0xe073('0x1e')]);router[_0xe073('0x8')](_0xe073('0x1f'),auth[_0xe073('0xa')](),controller[_0xe073('0x20')]);router[_0xe073('0x8')](_0xe073('0x21'),auth['isAuthenticated'](),controller[_0xe073('0x22')]);router[_0xe073('0x8')](_0xe073('0x23'),auth[_0xe073('0xa')](),controller[_0xe073('0x24')]);router[_0xe073('0x8')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xe073('0x25')]);router['get']('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0xe073('0xa')](),controller[_0xe073('0x26')]);router['get'](_0xe073('0x27'),auth[_0xe073('0xa')](),controller[_0xe073('0x28')]);router['get'](_0xe073('0x29'),auth['isAuthenticated'](),controller[_0xe073('0x2a')]);router[_0xe073('0x8')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xe073('0x2b')]);router[_0xe073('0x8')](_0xe073('0x2c'),auth[_0xe073('0xa')](),controller[_0xe073('0x2d')]);router[_0xe073('0x8')](_0xe073('0x2e'),auth[_0xe073('0xa')](),controller['getMailAccounts']);router[_0xe073('0x8')](_0xe073('0x2f'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xe073('0x8')]('/:id/sms_accounts',auth[_0xe073('0xa')](),controller[_0xe073('0x30')]);router[_0xe073('0x8')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe073('0x31')]);router[_0xe073('0x8')]('/:id/whatsapp_accounts',auth[_0xe073('0xa')](),controller[_0xe073('0x32')]);router[_0xe073('0x8')]('/:id/scheduled_calls',auth[_0xe073('0xa')](),controller['getScheduledCalls']);router['get'](_0xe073('0x33'),auth[_0xe073('0xa')](),controller[_0xe073('0x34')]);router['post'](_0xe073('0x14'),auth[_0xe073('0xa')](),controller[_0xe073('0x35')]);router['post']('/',auth[_0xe073('0xa')](),controller[_0xe073('0x36')]);router[_0xe073('0x37')](_0xe073('0x38'),auth[_0xe073('0xa')](),controller[_0xe073('0x39')]);router['post'](_0xe073('0x16'),auth[_0xe073('0xa')](),controller[_0xe073('0x3a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d8054,_0x16a4ba,_0x110416){_0x110416(null,path[_0xe073('0x3b')](config[_0xe073('0x3c')],'server/files/images/'));},'filename':function(_0x2b7cc3,_0x5abc09,_0x2c20a5){_0x2c20a5(null,util[_0xe073('0x3d')](_0xe073('0x3e'),Date[_0xe073('0x3f')](),_0x5abc09[_0xe073('0x40')]));}})});router[_0xe073('0x37')](_0xe073('0x41'),upload[_0xe073('0x42')](_0xe073('0x43')),controller[_0xe073('0x44')]);router[_0xe073('0x37')](_0xe073('0x45'),auth[_0xe073('0xa')](),controller['login']);router[_0xe073('0x37')]('/:id/logout',auth[_0xe073('0xa')](),controller[_0xe073('0x46')]);router[_0xe073('0x37')](_0xe073('0x47'),auth['isAuthenticated'](),controller[_0xe073('0x48')]);router[_0xe073('0x37')](_0xe073('0x49'),auth[_0xe073('0xa')](),controller[_0xe073('0x4a')]);router['post'](_0xe073('0x4b'),auth['isAuthenticated'](),controller[_0xe073('0x4c')]);router[_0xe073('0x37')](_0xe073('0x4d'),auth[_0xe073('0xa')](),controller[_0xe073('0x4e')]);router[_0xe073('0x37')](_0xe073('0x4f'),auth[_0xe073('0xa')](),controller[_0xe073('0x50')]);router[_0xe073('0x37')](_0xe073('0x51'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0xe073('0x37')](_0xe073('0x52'),auth[_0xe073('0xa')](),controller[_0xe073('0x53')]);router[_0xe073('0x37')]('/:id/openchannel_interactions',auth[_0xe073('0xa')](),controller[_0xe073('0x54')]);router[_0xe073('0x37')](_0xe073('0x55'),auth[_0xe073('0xa')](),controller['addWhatsappInteractions']);router[_0xe073('0x37')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe073('0x56')]);router[_0xe073('0x37')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xe073('0x57')]);router[_0xe073('0x37')](_0xe073('0x2f'),auth[_0xe073('0xa')](),controller[_0xe073('0x58')]);router[_0xe073('0x37')](_0xe073('0x59'),auth['isAuthenticated'](),controller[_0xe073('0x5a')]);router['post'](_0xe073('0x5b'),auth[_0xe073('0xa')](),controller[_0xe073('0x5c')]);router['post']('/:id/whatsapp_accounts',auth[_0xe073('0xa')](),controller[_0xe073('0x5d')]);router[_0xe073('0x37')]('/:id/api_key',auth[_0xe073('0xa')](),controller[_0xe073('0x5e')]);router[_0xe073('0x5f')](_0xe073('0xf'),auth[_0xe073('0xa')](),controller[_0xe073('0x60')]);router[_0xe073('0x5f')](_0xe073('0x61'),auth[_0xe073('0xa')](),controller['changePassword']);router[_0xe073('0x62')]('/:id/queues',auth[_0xe073('0xa')](),controller['removeQueues']);router[_0xe073('0x62')](_0xe073('0x4b'),auth[_0xe073('0xa')](),controller[_0xe073('0x63')]);router['delete'](_0xe073('0xf'),auth[_0xe073('0xa')](),controller[_0xe073('0x64')]);router['delete']('/:id/chat_interactions',auth[_0xe073('0xa')](),controller[_0xe073('0x65')]);router[_0xe073('0x62')](_0xe073('0x4f'),auth[_0xe073('0xa')](),controller['removeMailInteractions']);router[_0xe073('0x62')](_0xe073('0x51'),auth[_0xe073('0xa')](),controller[_0xe073('0x66')]);router[_0xe073('0x62')](_0xe073('0x52'),auth[_0xe073('0xa')](),controller[_0xe073('0x67')]);router[_0xe073('0x62')](_0xe073('0x68'),auth['isAuthenticated'](),controller[_0xe073('0x69')]);router['delete']('/:id/whatsapp_interactions',auth[_0xe073('0xa')](),controller[_0xe073('0x6a')]);router[_0xe073('0x62')]('/:id/fax_accounts',auth[_0xe073('0xa')](),controller[_0xe073('0x6b')]);router[_0xe073('0x62')]('/:id/mail_accounts',auth[_0xe073('0xa')](),controller['removeMailAccounts']);router[_0xe073('0x62')](_0xe073('0x2f'),auth[_0xe073('0xa')](),controller[_0xe073('0x6c')]);router[_0xe073('0x62')](_0xe073('0x59'),auth[_0xe073('0xa')](),controller[_0xe073('0x6d')]);router[_0xe073('0x62')](_0xe073('0x5b'),auth[_0xe073('0xa')](),controller[_0xe073('0x6e')]);router[_0xe073('0x62')](_0xe073('0x6f'),auth[_0xe073('0xa')](),controller[_0xe073('0x70')]);router[_0xe073('0x62')](_0xe073('0x33'),auth[_0xe073('0xa')](),controller[_0xe073('0x71')]);module[_0xe073('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 94cb38b..17d998c 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ee77adc..2f453b5 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07e6=['add','toLowerCase','capitalize','voice','online','format','UserVoiceQueueRt','remove','Queues','isArray','QueueId','Queue:remove','addAvatar','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','existsSync','download','join','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','CmContact','filters','order','sort','pick','hasOwnProperty','CmList','Tag','Tags','color','tag','getContacts','getQueues','Queue','nolimit','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','user:forcelogout','headers','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','transaction','getAssociatedQueues','addAgent','getDataValue','Voice','penalty','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','firstName','lastName','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','isEmpty','VoiceQueue','inbound','queues','flatten','lower','col','asc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','charAt','QueryTypes','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../errors/api','APIBadRequestError','handleError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','role','agent','emit','userNotification:recalc:','destroy','get','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','stack','name','index','User','fieldName','type','key','password','salt','getOptions','where','query','include','userSetting','true','attributes','push','findAll','rows','openTabs','length','dataValues','sms','fax','mail','openchannel','show','model','differenceBy','keys','rawAttributes','intersection','fields','includeAll','UserSetting','merge','options','chat','whatsapp','body','params','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','103','113','104','105','106','108','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','some','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','voicePause','interface','isValidChannel','Unknown\x20channel'];(function(_0x6d6324,_0x28bac9){var _0x61ab45=function(_0x29ee75){while(--_0x29ee75){_0x6d6324['push'](_0x6d6324['shift']());}};_0x61ab45(++_0x28bac9);}(_0x07e6,0xe4));var _0x607e=function(_0x1b40c1,_0x31238a){_0x1b40c1=_0x1b40c1-0x0;var _0x56430b=_0x07e6[_0x1b40c1];return _0x56430b;};'use strict';var moment=require('moment');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x607e('0x0'));var squel=require(_0x607e('0x1'));var jayson=require(_0x607e('0x2'));var Redis=require(_0x607e('0x3'));var authService=require(_0x607e('0x4'));var qs=require(_0x607e('0x5'));var logger=require(_0x607e('0x6'))(_0x607e('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x607e('0x8'));var APIBadRequestError=require(_0x607e('0x9'))[_0x607e('0xa')];var APINotFoundError=require(_0x607e('0x9'))['APINotFoundError'];var APIHandleError=require(_0x607e('0x9'))[_0x607e('0xb')];var db=require('../../mysqldb')['db'];var socket=require(_0x607e('0xc'))(new Redis(config[_0x607e('0xd')]));require(_0x607e('0xe'))[_0x607e('0xf')](socket);config[_0x607e('0xd')]=_[_0x607e('0x10')](config['redis'],{'host':_0x607e('0x11'),'port':0x18eb});var amiClient=jayson[_0x607e('0x12')][_0x607e('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4f84b4,_0x2bf070,_0x1b7b8f,_0x4ae79e){return new Promise(function(_0x27db21,_0x2af2c2){var _0x4f9660=_0x4ae79e||amiClient;return _0x4f9660[_0x607e('0x14')](_0x4f84b4,_0x1b7b8f)['then'](function(_0x41f7b1){logger[_0x607e('0x15')]('User,\x20%s,\x20%s',_0x2bf070,_0x607e('0x16'));logger[_0x607e('0x17')](_0x607e('0x18'),_0x2bf070,'request\x20sent',JSON[_0x607e('0x19')](_0x41f7b1));if(_0x41f7b1[_0x607e('0x1a')]){if(_0x41f7b1[_0x607e('0x1a')]['code']===0x1f4){logger['error'](_0x607e('0x1b'),_0x2bf070,_0x41f7b1[_0x607e('0x1a')][_0x607e('0x1c')]);return _0x2af2c2(_0x41f7b1[_0x607e('0x1a')][_0x607e('0x1c')]);}logger[_0x607e('0x1a')](_0x607e('0x1b'),_0x2bf070,_0x41f7b1[_0x607e('0x1a')][_0x607e('0x1c')]);return _0x27db21(_0x41f7b1['error'][_0x607e('0x1c')]);}else{logger[_0x607e('0x15')](_0x607e('0x1b'),_0x2bf070,_0x607e('0x16'));_0x27db21(_0x41f7b1[_0x607e('0x1d')][_0x607e('0x1c')]);}})[_0x607e('0x1e')](function(_0xecf113){logger[_0x607e('0x1a')](_0x607e('0x1b'),_0x2bf070,_0xecf113);_0x2af2c2(_0xecf113);});});}function respondWithStatusCode(_0x7ca429,_0x59d7f0){_0x59d7f0=_0x59d7f0||0xcc;return function(_0x528330){if(_0x528330){return _0x7ca429[_0x607e('0x1f')](_0x59d7f0);}return _0x7ca429[_0x607e('0x20')](_0x59d7f0)[_0x607e('0x21')]();};}function respondWithResult(_0x288e10,_0x3d85f4){_0x3d85f4=_0x3d85f4||0xc8;return function(_0x2d972f){if(_0x2d972f){return _0x288e10[_0x607e('0x20')](_0x3d85f4)[_0x607e('0x22')](_0x2d972f);}};}function respondWithFilteredResult(_0x282905,_0xea6244){return function(_0x4a93d5){if(_0x4a93d5){var _0x1d51c2=typeof _0xea6244['offset']===_0x607e('0x23')&&typeof _0xea6244[_0x607e('0x24')]===_0x607e('0x23');var _0x419483=_0x4a93d5[_0x607e('0x25')];var _0x528ce5=_0x1d51c2?0x0:_0xea6244[_0x607e('0x26')];var _0x1c7789=_0x1d51c2?_0x4a93d5[_0x607e('0x25')]:_0xea6244[_0x607e('0x26')]+_0xea6244[_0x607e('0x24')];var _0x1c2f4c;if(_0x1c7789>=_0x419483){_0x1c7789=_0x419483;_0x1c2f4c=0xc8;}else{_0x1c2f4c=0xce;}_0x282905[_0x607e('0x20')](_0x1c2f4c);return _0x282905[_0x607e('0x27')]('Content-Range',_0x528ce5+'-'+_0x1c7789+'/'+_0x419483)[_0x607e('0x22')](_0x4a93d5);}return null;};}function saveUpdates(_0x2e4ca3){return function(_0x1d8ac9){if(_0x1d8ac9){return _0x1d8ac9[_0x607e('0x28')](_0x2e4ca3)[_0x607e('0x29')](function(_0x2ad04a){if(_0x2ad04a[_0x607e('0x2a')]===_0x607e('0x2b')){socket[_0x607e('0x2c')](_0x607e('0x2d')+_0x2ad04a['id'],_0x2ad04a);}return _0x2ad04a;});}return null;};}function removeEntity(_0x532fa4){return function(_0x268c8f){if(_0x268c8f){return _0x268c8f[_0x607e('0x2e')]()[_0x607e('0x29')](function(){var _0x1613f1=_0x268c8f[_0x607e('0x2f')]({'plain':!![]});if(_0x1613f1[_0x607e('0x2a')]===_0x607e('0x30'))return;var _0x3112f1=[{'name':_0x607e('0x31'),'value':_0x607e('0x32'),'ignore':!![]},{'name':_0x607e('0x33'),'value':_0x607e('0x2b'),'ignore':![]},{'name':_0x607e('0x34'),'value':_0x607e('0x35'),'ignore':![]}];var _0x7e3bde=_(_0x3112f1)[_0x607e('0x36')](_0x607e('0x37'))[_0x607e('0x38')](_0x607e('0x39'))[_0x607e('0x39')]();if(_[_0x607e('0x3a')](_0x7e3bde,_0x1613f1['role'])){return;}var _0xda5dce=_[_0x607e('0x3b')](_0x3112f1,[_0x607e('0x39'),_0x1613f1[_0x607e('0x2a')]])['name'];return db[_0x607e('0x3c')][_0x607e('0x2e')]({'where':{'type':_0xda5dce,'resourceId':_0x1613f1['id']}})[_0x607e('0x29')](function(){return _0x268c8f;});})[_0x607e('0x29')](function(){_0x532fa4[_0x607e('0x20')](0xcc)[_0x607e('0x21')]();});}};}function handleEntityNotFound(_0x34ccf4){return function(_0x384a05){if(!_0x384a05){_0x34ccf4[_0x607e('0x1f')](0x194);}return _0x384a05;};}function handleError(_0x3b5e0a,_0x1f9337){_0x1f9337=_0x1f9337||0x1f4;return function(_0x561f3f){logger[_0x607e('0x1a')](_0x561f3f[_0x607e('0x3d')]);if(_0x561f3f[_0x607e('0x3e')]){delete _0x561f3f['name'];}_0x3b5e0a[_0x607e('0x20')](_0x1f9337)['send'](_0x561f3f);};}exports[_0x607e('0x3f')]=function(_0x421cc2,_0x14b39f){var _0x1ac373={},_0x511192={'count':0x0,'rows':[]};var _0x31be15=_(db[_0x607e('0x40')]['rawAttributes'])[_0x607e('0x38')](function(_0x1944b7){return{'name':_0x1944b7[_0x607e('0x41')],'type':_0x1944b7[_0x607e('0x42')][_0x607e('0x43')]};})[_0x607e('0x36')](function(_0x5c2389){return!_[_0x607e('0x3a')]([_0x607e('0x44'),_0x607e('0x45')],_0x5c2389[_0x607e('0x3e')]);})['value']();_0x1ac373=qs[_0x607e('0x46')](_0x31be15,_0x421cc2);var _0x2e300d={'where':_0x1ac373[_0x607e('0x47')]};return db[_0x607e('0x40')][_0x607e('0x25')](_0x2e300d)[_0x607e('0x29')](function(_0x5cae0b){_0x511192[_0x607e('0x25')]=_0x5cae0b;if(_0x421cc2[_0x607e('0x48')]['includeAll']){_0x1ac373[_0x607e('0x49')]=[{'all':!![]}];}if(_0x421cc2[_0x607e('0x48')][_0x607e('0x4a')]===_0x607e('0x4b')){_0x1ac373[_0x607e('0x49')]=[{'model':db['UserSetting'],'as':_0x607e('0x4a')}];}if(!_[_0x607e('0x3a')](_0x1ac373[_0x607e('0x4c')],'id')){_0x1ac373[_0x607e('0x4c')][_0x607e('0x4d')]('id');}return db[_0x607e('0x40')][_0x607e('0x4e')](_0x1ac373);})[_0x607e('0x29')](function(_0x1bc54e){_0x511192[_0x607e('0x4f')]=_0x1bc54e;if(_0x421cc2[_0x607e('0x48')][_0x607e('0x50')]===_0x607e('0x4b')){var _0xd83d01=[];for(var _0x356b1d=0x0;_0x356b1d<_0x511192['rows'][_0x607e('0x51')];_0x356b1d++){_0xd83d01[_0x607e('0x4d')](get_open_tabs('chat',_0x511192['rows'][_0x356b1d][_0x607e('0x52')]));_0xd83d01[_0x607e('0x4d')](get_open_tabs(_0x607e('0x53'),_0x511192[_0x607e('0x4f')][_0x356b1d][_0x607e('0x52')]));_0xd83d01['push'](get_open_tabs(_0x607e('0x54'),_0x511192['rows'][_0x356b1d][_0x607e('0x52')]));_0xd83d01[_0x607e('0x4d')](get_open_tabs(_0x607e('0x55'),_0x511192['rows'][_0x356b1d][_0x607e('0x52')]));_0xd83d01['push'](get_open_tabs(_0x607e('0x56'),_0x511192['rows'][_0x356b1d][_0x607e('0x52')]));_0xd83d01['push'](get_open_tabs('whatsapp',_0x511192['rows'][_0x356b1d][_0x607e('0x52')]));}return Promise['all'](_0xd83d01)[_0x607e('0x29')](function(){return _0x511192;});}else{return _0x511192;}})['then'](respondWithFilteredResult(_0x14b39f,_0x1ac373))[_0x607e('0x1e')](handleError(_0x14b39f,null));};exports[_0x607e('0x57')]=function(_0x5d30d6,_0xf9d4b7){var _0x4e7064={'raw':![],'where':{'id':_0x5d30d6['params']['id']}},_0x3e8128={};_0x3e8128[_0x607e('0x58')]=_[_0x607e('0x59')](_[_0x607e('0x5a')](db[_0x607e('0x40')][_0x607e('0x5b')]),[_0x607e('0x44'),_0x607e('0x45')]);_0x3e8128['query']=_[_0x607e('0x5a')](_0x5d30d6[_0x607e('0x48')]);_0x3e8128['filters']=_[_0x607e('0x5c')](_0x3e8128['model'],_0x3e8128['query']);_0x4e7064[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x3e8128['model'],qs[_0x607e('0x5d')](_0x5d30d6[_0x607e('0x48')][_0x607e('0x5d')]));_0x4e7064[_0x607e('0x4c')]=_0x4e7064[_0x607e('0x4c')]['length']?_0x4e7064[_0x607e('0x4c')]:_0x3e8128[_0x607e('0x58')];if(_0x5d30d6[_0x607e('0x48')][_0x607e('0x5e')]){_0x4e7064[_0x607e('0x49')]=[{'all':!![]}];}if(_0x5d30d6[_0x607e('0x48')][_0x607e('0x4a')]===_0x607e('0x4b')){_0x4e7064[_0x607e('0x49')]=[{'model':db[_0x607e('0x5f')],'as':_0x607e('0x4a')}];}_0x4e7064=_[_0x607e('0x60')]({},_0x4e7064,_0x5d30d6[_0x607e('0x61')]);if(!_[_0x607e('0x3a')](_0x4e7064[_0x607e('0x4c')],'id')){_0x4e7064[_0x607e('0x4c')][_0x607e('0x4d')]('id');}return db[_0x607e('0x40')][_0x607e('0x3b')](_0x4e7064)[_0x607e('0x29')](handleEntityNotFound(_0xf9d4b7,null))[_0x607e('0x29')](function(_0x83012d){var _0x589452=[];values=_0x83012d;if(_0x5d30d6[_0x607e('0x48')][_0x607e('0x50')]===_0x607e('0x4b')){_0x589452[_0x607e('0x4d')](get_open_tabs(_0x607e('0x62'),_0x83012d[_0x607e('0x52')]));_0x589452['push'](get_open_tabs(_0x607e('0x53'),_0x83012d['dataValues']));_0x589452[_0x607e('0x4d')](get_open_tabs(_0x607e('0x56'),_0x83012d[_0x607e('0x52')]));_0x589452[_0x607e('0x4d')](get_open_tabs(_0x607e('0x63'),_0x83012d[_0x607e('0x52')]));_0x589452[_0x607e('0x4d')](get_open_tabs(_0x607e('0x54'),_0x83012d[_0x607e('0x52')]));_0x589452[_0x607e('0x4d')](get_open_tabs('mail',_0x83012d[_0x607e('0x52')]));return Promise['all'](_0x589452);}else{return values;}})[_0x607e('0x29')](function(){return values;})[_0x607e('0x29')](respondWithResult(_0xf9d4b7,null))[_0x607e('0x1e')](handleError(_0xf9d4b7,null));};exports[_0x607e('0x28')]=function(_0x360518,_0x2df0b4){if(_0x360518[_0x607e('0x64')]['id']){delete _0x360518[_0x607e('0x64')]['id'];}delete _0x360518['body'][_0x607e('0x2a')];return db['User']['find']({'where':{'id':_0x360518[_0x607e('0x65')]['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x2df0b4,null))[_0x607e('0x29')](saveUpdates(_0x360518[_0x607e('0x64')],null))[_0x607e('0x29')](respondWithResult(_0x2df0b4,null))[_0x607e('0x1e')](handleError(_0x2df0b4,null));};exports[_0x607e('0x66')]=function(_0xc2829b,_0x1f9c75){return db['User'][_0x607e('0x66')]()[_0x607e('0x29')](respondWithResult(_0x1f9c75,null))[_0x607e('0x1e')](handleError(_0x1f9c75,null));};exports['addContacts']=function(_0x37e568,_0x27eff5){return db['User']['find']({'where':{'id':_0x37e568['params']['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x27eff5,null))[_0x607e('0x29')](function(_0x39d12e){if(_0x39d12e){return _0x39d12e[_0x607e('0x67')](_0x37e568['body'][_0x607e('0x68')],_[_0x607e('0x69')](_0x37e568['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x27eff5,null))[_0x607e('0x1e')](handleError(_0x27eff5,null));};function validateUser(_0x350aef){return new Promise(function(_0x3bece1,_0x4659c6){if(_0x350aef[_0x607e('0x6a')])return _0x3bece1(_0x350aef);return db[_0x607e('0x6b')]['findById'](0x1)[_0x607e('0x29')](function(_0x9bd50f){if(_0x9bd50f[_0x607e('0x6c')])authService[_0x607e('0x6d')](_0x350aef[_0x607e('0x44')]);db['User'][_0x607e('0x6e')](_0x607e('0x6a'))[_0x607e('0x29')](function(_0x124047){if(_[_0x607e('0x6f')](_0x124047)){_0x350aef[_0x607e('0x6a')]=_0x9bd50f['min_internal']||0x1;return;}if(_[_0x607e('0x6f')](_0x9bd50f[_0x607e('0x70')])||_0x9bd50f[_0x607e('0x70')]===_0x124047){_0x350aef['internal']=_0x124047+0x1;return;}if(_0x9bd50f[_0x607e('0x70')]>_0x124047){_0x350aef['internal']=_0x9bd50f[_0x607e('0x70')];return;}return db[_0x607e('0x71')][_0x607e('0x48')](_0x607e('0x72'),{'type':db['sequelize']['QueryTypes'][_0x607e('0x73')]})[_0x607e('0x29')](function(_0x292fa2){if(_0x292fa2&&_0x292fa2['length']){for(var _0x1631d1=0x0,_0x576540=_0x292fa2[_0x607e('0x51')];_0x1631d1<_0x576540&&_[_0x607e('0x6f')](_0x350aef[_0x607e('0x6a')]);_0x1631d1++){if(_0x9bd50f['min_internal']<=_0x292fa2[_0x1631d1][_0x607e('0x74')]){_0x350aef[_0x607e('0x6a')]=_0x292fa2[_0x1631d1][_0x607e('0x74')];}else if(_0x9bd50f[_0x607e('0x70')]>_0x292fa2[_0x1631d1][_0x607e('0x74')]&&_0x9bd50f[_0x607e('0x70')]<=_0x292fa2[_0x1631d1]['to']){_0x350aef[_0x607e('0x6a')]=_0x9bd50f[_0x607e('0x70')];}}}if(_[_0x607e('0x6f')](_0x350aef[_0x607e('0x6a')])){_0x350aef['internal']=_0x124047+0x1;}return _0x3bece1(_0x350aef);});});})[_0x607e('0x1e')](function(_0x481754){_0x4659c6(_0x481754);});});}function updateUser(_0x45b0b8){return new Promise(function(_0x5894d1,_0x30e987){try{if(_0x45b0b8[_0x607e('0x75')]){_0x45b0b8[_0x607e('0x76')]=_0x45b0b8[_0x607e('0x6a')];_0x45b0b8[_0x607e('0x77')]={'mailbox':_0x45b0b8['internal'],'password':_0x45b0b8[_0x607e('0x44')],'fullname':_0x45b0b8[_0x607e('0x78')],'email':_0x45b0b8['email']};}if(_0x45b0b8[_0x607e('0x2a')]==='agent'){if(!_0x45b0b8[_0x607e('0x79')])_0x45b0b8[_0x607e('0x79')]=[_0x607e('0x7a'),_0x607e('0x7b'),_0x607e('0x7c'),_0x607e('0x7d'),'110',_0x607e('0x7e'),_0x607e('0x7f'),_0x607e('0x80'),'107',_0x607e('0x81'),'109','100','111',_0x607e('0x82'),_0x607e('0x83')];}_0x5894d1(_0x45b0b8);}catch(_0x3cb938){_0x30e987(_0x3cb938);}});}exports[_0x607e('0x84')]=function(_0x4d5ad7,_0x41227b){if(_0x4d5ad7['user']['role']==='agent')throw new Error(_0x607e('0x85'));if(_0x4d5ad7[_0x607e('0x64')][_0x607e('0x2a')]===_0x607e('0x32')&&_0x4d5ad7[_0x607e('0x32')]['role']!==_0x607e('0x30')){throw new Error(_0x607e('0x86'));}if(_0x4d5ad7[_0x607e('0x64')][_0x607e('0x2a')]===_0x607e('0x30')&&_0x4d5ad7['user'][_0x607e('0x2a')]!==_0x607e('0x30')){throw new Error(_0x607e('0x87'));}return licenseUtil[_0x607e('0x88')]([_0x4d5ad7[_0x607e('0x64')]])[_0x607e('0x29')](function(){return validateUser(_0x4d5ad7[_0x607e('0x64')]);})[_0x607e('0x29')](function(_0x4b30fb){return updateUser(_0x4b30fb)[_0x607e('0x29')](function(_0x245f7a){if(_0x245f7a[_0x607e('0x2a')]===_0x607e('0x30')){_0x245f7a['settingsEnabled']=_0x4d5ad7[_0x607e('0x32')][_0x607e('0x89')];delete _0x245f7a[_0x607e('0x8a')];}return _0x245f7a;});})[_0x607e('0x29')](function(_0xf7cc7e){return db[_0x607e('0x40')][_0x607e('0x84')](_0xf7cc7e,{'include':[{'model':db[_0x607e('0x77')],'as':_0x607e('0x77')}]});})[_0x607e('0x29')](function(_0x216c21){if(_0x4d5ad7['body'][_0x607e('0x2a')]===_0x607e('0x32'))return _0x216c21;if(_0x4d5ad7[_0x607e('0x32')][_0x607e('0x2a')]!==_0x607e('0x32'))return _0x216c21;return db[_0x607e('0x8b')]['find']({'where':{'name':_0x216c21[_0x607e('0x2a')]===_0x607e('0x2b')?_0x607e('0x33'):_0x607e('0x34'),'userProfileId':_0x4d5ad7['user'][_0x607e('0x8a')]},'raw':!![]})['then'](function(_0x415b20){if(!_0x415b20||_0x415b20[_0x607e('0x8c')]!=0x0)return _0x216c21;return db[_0x607e('0x3c')][_0x607e('0x84')]({'name':_0x216c21[_0x607e('0x3e')],'resourceId':_0x216c21['id'],'type':_0x415b20[_0x607e('0x3e')],'sectionId':_0x415b20['id']},{})[_0x607e('0x29')](function(){return _0x216c21;});})[_0x607e('0x1e')](function(_0x3e806a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e806a);throw _0x3e806a;});})[_0x607e('0x29')](respondWithResult(_0x41227b,0xc9))[_0x607e('0x1e')](handleError(_0x41227b,null));};exports[_0x607e('0x8d')]=function(_0x2390a7,_0x28347d){var _0x2746fe=_0x2390a7['body'];var _0x56c91f=[];if(_0x2390a7[_0x607e('0x32')][_0x607e('0x2a')]===_0x607e('0x2b'))throw new Error(_0x607e('0x85'));if(_['some'](_0x2746fe,['role',_0x607e('0x32')])&&_0x2390a7[_0x607e('0x32')][_0x607e('0x2a')]!=='admin'){throw new Error(_0x607e('0x86'));}if(_['some'](_0x2746fe,[_0x607e('0x2a'),_0x607e('0x30')])&&_0x2390a7[_0x607e('0x32')][_0x607e('0x2a')]!==_0x607e('0x30')){throw new Error(_0x607e('0x8e'));}return licenseUtil[_0x607e('0x88')](_0x2746fe)[_0x607e('0x29')](function(){return validateUser(_0x2746fe[0x0]);})['then'](function(){for(var _0x461f10=0x1;_0x461f10<_0x2746fe[_0x607e('0x51')];_0x461f10++){var _0x563709=_0x2746fe[_0x461f10-0x1][_0x607e('0x6a')];if(!_0x2746fe[_0x461f10][_0x607e('0x6a')])_0x2746fe[_0x461f10]['internal']=_0x563709+0x1;_0x56c91f[_0x607e('0x4d')](validateUser(_0x2746fe[_0x461f10]));}return Promise['all'](_0x56c91f);})['then'](function(){_0x56c91f=[];for(var _0x4e594b=0x0;_0x4e594b<_0x2746fe[_0x607e('0x51')];_0x4e594b++){_0x56c91f[_0x607e('0x4d')](updateUser(_0x2746fe[_0x4e594b]));}return Promise[_0x607e('0x8f')](_0x56c91f);})['then'](function(){_0x56c91f=_0x2746fe[_0x607e('0x38')](function(_0x50286b){return db[_0x607e('0x40')][_0x607e('0x84')](_0x50286b,{'include':[{'model':db[_0x607e('0x77')],'as':_0x607e('0x77')}]})[_0x607e('0x29')](function(_0x223f19){_0x50286b['id']=_0x223f19['id'];return _0x50286b;});});return Promise[_0x607e('0x8f')](_0x56c91f);})[_0x607e('0x29')](function(_0x5792a4){if(_0x2390a7[_0x607e('0x64')]['role']===_0x607e('0x32'))return _0x5792a4;if(_0x2390a7[_0x607e('0x32')][_0x607e('0x2a')]!==_0x607e('0x32'))return _0x5792a4;var _0x27fbdd=_[_0x607e('0x90')](_0x5792a4,function(_0x24e5b8){return _0x24e5b8[_0x607e('0x2a')]==='agent'||_0x24e5b8[_0x607e('0x2a')]==='telephone';});if(!_0x27fbdd)return _0x5792a4;return db[_0x607e('0x8b')][_0x607e('0x4e')]({'where':{'name':{'$or':[_0x607e('0x33'),_0x607e('0x34')]},'userProfileId':_0x2390a7[_0x607e('0x32')]['userProfileId']},'raw':!![]})['then'](function(_0x1a7f2b){if(_['isEmpty'](_0x1a7f2b)||!_[_0x607e('0x90')](_0x1a7f2b,[_0x607e('0x8c'),0x0]))return _0x5792a4;_0x56c91f=[];var _0x3be5c4=_(_0x1a7f2b)[_0x607e('0x38')](function(_0x4162bb){if(_0x4162bb['autoAssociation']===0x1)return;return _0x4162bb['name']===_0x607e('0x33')?_0x607e('0x2b'):_0x607e('0x35');})['compact']()[_0x607e('0x39')]();for(var _0x1cbed0=0x0;_0x1cbed0<_0x5792a4[_0x607e('0x51')];_0x1cbed0++){if(!_[_0x607e('0x3a')](_0x3be5c4,_0x5792a4[_0x1cbed0][_0x607e('0x2a')]))return;var _0xe7c4b3=_0x5792a4[_0x1cbed0][_0x607e('0x2a')]===_0x607e('0x2b')?_0x607e('0x33'):_0x607e('0x34');_0x56c91f[_0x607e('0x4d')](db[_0x607e('0x3c')]['create']({'name':_0x5792a4[_0x1cbed0][_0x607e('0x3e')],'resourceId':_0x5792a4[_0x1cbed0]['id'],'type':_0xe7c4b3,'sectionId':_[_0x607e('0x3b')](_0x1a7f2b,[_0x607e('0x3e'),_0xe7c4b3])['id']},{}));}return Promise['all'](_0x56c91f);});})[_0x607e('0x29')](respondWithResult(_0x28347d,0xc9))[_0x607e('0x1e')](handleError(_0x28347d,null));};exports[_0x607e('0x91')]=function(_0x394253,_0x4c8882){if(_0x394253[_0x607e('0x64')]['id']){delete _0x394253[_0x607e('0x64')]['id'];}return db[_0x607e('0x40')][_0x607e('0x3b')]({'where':{'id':_0x394253[_0x607e('0x65')]['id']}})[_0x607e('0x29')](function(_0x560c1c){if(!_0x560c1c)return null;if(_0x560c1c['id']===_0x394253[_0x607e('0x32')]['id']){if(!_0x394253['body'][_0x607e('0x92')]||!_0x394253[_0x607e('0x64')][_0x607e('0x93')]){throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))](_0x607e('0x96'));}if(!_0x560c1c[_0x607e('0x97')](_0x394253[_0x607e('0x64')][_0x607e('0x92')])){throw new db[(_0x607e('0x94'))]['ValidationError']('Wrong\x20credentials');}if(_0x394253[_0x607e('0x64')][_0x607e('0x92')]===_0x394253['body'][_0x607e('0x93')]){throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))](_0x607e('0x98'));}}else if(_0x394253['user']['role']===_0x607e('0x30')){if(!_0x394253[_0x607e('0x64')][_0x607e('0x93')]){throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))](_0x607e('0x99'));}}else if(_0x394253[_0x607e('0x32')][_0x607e('0x2a')]===_0x607e('0x32')){if(!_0x394253[_0x607e('0x64')][_0x607e('0x93')]){throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))](_0x607e('0x99'));}if(_0x560c1c[_0x607e('0x2a')]!==_0x607e('0x2b')){throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))](_0x607e('0x85'));}}else{throw new db[(_0x607e('0x94'))]['ValidationError'](_0x607e('0x85'));}return _0x560c1c;})[_0x607e('0x29')](handleEntityNotFound(_0x4c8882,null))[_0x607e('0x29')](function(_0x5373f7){return db[_0x607e('0x6b')][_0x607e('0x9a')]({'attributes':['id','securePassword',_0x607e('0x9b'),_0x607e('0x9c')]})[_0x607e('0x29')](function(_0x23825a){if(_0x23825a['securePassword'])authService[_0x607e('0x6d')](_0x394253[_0x607e('0x64')][_0x607e('0x93')]);if(!_0x23825a[_0x607e('0x9b')]||!_0x5373f7[_0x607e('0x9d')])return _0x5373f7;authService[_0x607e('0x9e')](_0x394253['body'][_0x607e('0x93')],_0x5373f7['previousPasswords'],_0x23825a['passwordHistoryLimit']);return _0x5373f7;})[_0x607e('0x29')](saveUpdates({'password':_0x394253['body'][_0x607e('0x93')],'passwordResetAt':_0x394253[_0x607e('0x32')]['id']==_0x394253['params']['id']?moment():null,'previousPasswords':authService[_0x607e('0x9f')](_0x394253[_0x607e('0x64')][_0x607e('0x93')],_0x5373f7[_0x607e('0x9d')])},null));})[_0x607e('0x29')](respondWithResult(_0x4c8882,null))['catch'](handleError(_0x4c8882,null));};exports[_0x607e('0xa0')]=function(_0xae02ef,_0x2afdcc){var _0x434c4a=_0xae02ef[_0x607e('0x64')][_0x607e('0xa1')];return db[_0x607e('0x40')][_0x607e('0x3b')]({'where':{'id':_0xae02ef[_0x607e('0x65')]['id']},'attributes':['id',_0x607e('0x3e'),_0x607e('0x2a'),'online','loginInPause',_0x607e('0xa2'),_0x607e('0xa3')]})[_0x607e('0x29')](handleEntityNotFound(_0x2afdcc,null))[_0x607e('0x29')](function(_0x20055d){if(_0x20055d){if(!utils[_0x607e('0xa4')](_0x434c4a)){throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))](_0x607e('0xa5'));}return _0x20055d[_0x607e('0xa6')+_['capitalize'](_0x434c4a[_0x607e('0xa7')]())+'Queues'](_0xae02ef[_0x607e('0x64')][_0x607e('0x68')],{'penalty':_0xae02ef[_0x607e('0x64')]['penalty']||0x0})['spread'](function(_0x5ede73){for(var _0x31de6e=0x0;_0x31de6e<_0xae02ef[_0x607e('0x64')][_0x607e('0x68')][_0x607e('0x51')];_0x31de6e+=0x1){var _0x3f7289={'UserId':Number(_0xae02ef['params']['id'])};_0x3f7289[_[_0x607e('0xa8')](_0x434c4a[_0x607e('0xa7')]())+'QueueId']=Number(_0xae02ef['body'][_0x607e('0x68')][_0x31de6e]);socket[_0x607e('0x2c')](_0x607e('0x32')+_[_0x607e('0xa8')](_0x434c4a[_0x607e('0xa7')]())+'Queue:save',_0x3f7289);}return _0x5ede73;})[_0x607e('0x29')](function(){if(_0x434c4a===_0x607e('0xa9')){return db['VoiceQueue'][_0x607e('0x4e')]({'where':{'id':_0xae02ef[_0x607e('0x64')][_0x607e('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x607e('0x29')](function(_0xcc53fd){var _0x400ff0=_0x20055d[_0x607e('0x2f')]({'plain':!![]});var _0x58cc4e=[];if(_0x434c4a===_0x607e('0xa9')&&_0x400ff0[_0x607e('0x2a')]===_0x607e('0x2b')&&_0x400ff0[_0x607e('0xaa')]){for(let _0x277f07=0x0;_0x277f07<_0xcc53fd[_0x607e('0x51')];_0x277f07+=0x1){_0x58cc4e[_0x607e('0x4d')]({'membername':_0x400ff0[_0x607e('0x3e')],'UserId':_0x400ff0['id'],'queue_name':_0xcc53fd[_0x277f07][_0x607e('0x3e')],'VoiceQueueId':_0xcc53fd[_0x277f07]['id'],'interface':_['isNil'](_0x400ff0[_0x607e('0xa3')])?util[_0x607e('0xab')]('SIP/%s',_0x400ff0[_0x607e('0x3e')]):_0x400ff0[_0x607e('0xa3')],'paused':_0x400ff0[_0x607e('0xa2')]||![],'penalty':_0xae02ef['body']['penalty']||0x0});}return Promise[_0x607e('0x8f')](_0x58cc4e['map'](function(_0x3a1e5c){return db[_0x607e('0xac')]['upsert'](_0x3a1e5c);}));}return _0x20055d;});}})[_0x607e('0x29')](respondWithStatusCode(_0x2afdcc,null))[_0x607e('0x1e')](handleError(_0x2afdcc,null));};exports['removeQueues']=function(_0x3ddb3f,_0x686b9b){var _0x242314,_0x3ff356;return db[_0x607e('0x40')][_0x607e('0x3b')]({'where':{'id':_0x3ddb3f[_0x607e('0x65')]['id']},'attributes':['id','name',_0x607e('0x2a')]})[_0x607e('0x29')](handleEntityNotFound(_0x686b9b,null))[_0x607e('0x29')](function(_0xd292ab){if(_0xd292ab){_0x242314=_0xd292ab;if(!_0x3ddb3f[_0x607e('0x48')][_0x607e('0xa1')]||!utils['isValidChannel'](_0x3ddb3f[_0x607e('0x48')][_0x607e('0xa1')])){throw new db['Sequelize'][(_0x607e('0x95'))](_0x607e('0xa5'));}return _0xd292ab[_0x607e('0xad')+_['capitalize'](_0x3ddb3f['query'][_0x607e('0xa1')][_0x607e('0xa7')]())+_0x607e('0xae')](_0x3ddb3f[_0x607e('0x48')][_0x607e('0x68')]);}})['then'](function(_0x3bacba){if(_[_0x607e('0xaf')](_0x3ddb3f['query']['ids'])){for(var _0x71e473=0x0;_0x71e473<_0x3ddb3f[_0x607e('0x48')][_0x607e('0x68')][_0x607e('0x51')];_0x71e473+=0x1){_0x3ff356={'UserId':Number(_0x3ddb3f[_0x607e('0x65')]['id'])};_0x3ff356[_[_0x607e('0xa8')](_0x3ddb3f['query']['channel']['toLowerCase']())+_0x607e('0xb0')]=Number(_0x3ddb3f[_0x607e('0x48')][_0x607e('0x68')][_0x71e473]);socket[_0x607e('0x2c')](_0x607e('0x32')+_[_0x607e('0xa8')](_0x3ddb3f[_0x607e('0x48')]['channel'][_0x607e('0xa7')]())+_0x607e('0xb1'),_0x3ff356);}}else{_0x3ff356={'UserId':Number(_0x3ddb3f[_0x607e('0x65')]['id'])};_0x3ff356[_[_0x607e('0xa8')](_0x3ddb3f[_0x607e('0x48')][_0x607e('0xa1')][_0x607e('0xa7')]())+_0x607e('0xb0')]=Number(_0x3ddb3f['query'][_0x607e('0x68')]);socket[_0x607e('0x2c')](_0x607e('0x32')+_[_0x607e('0xa8')](_0x3ddb3f[_0x607e('0x48')][_0x607e('0xa1')]['toLowerCase']())+'Queue:remove',_0x3ff356);}return _0x3bacba;})[_0x607e('0x29')](function(){if(_0x3ddb3f['query'][_0x607e('0xa1')]===_0x607e('0xa9')){return db[_0x607e('0xac')][_0x607e('0x2e')]({'where':{'UserId':_0x3ddb3f['params']['id'],'VoiceQueueId':_0x3ddb3f['query'][_0x607e('0x68')]},'individualHooks':!![]})[_0x607e('0x29')](function(){return _0x242314;});}return _0x242314;})[_0x607e('0x29')](respondWithStatusCode(_0x686b9b,null))[_0x607e('0x1e')](handleError(_0x686b9b,null));};exports[_0x607e('0xb2')]=function(_0x3cc8c2,_0x3a4419){_0x3cc8c2[_0x607e('0x64')][_0x607e('0xb3')]=_0x3cc8c2[_0x607e('0xb4')]['filename'];return db['User'][_0x607e('0x3b')]({'where':{'id':_0x3cc8c2[_0x607e('0x65')]['id']}})['then'](handleEntityNotFound(_0x3a4419,null))[_0x607e('0x29')](saveUpdates(_0x3cc8c2[_0x607e('0x64')],null))[_0x607e('0x29')](respondWithResult(_0x3a4419,null))[_0x607e('0x1e')](handleError(_0x3a4419,null));};exports[_0x607e('0xb5')]=function(_0x5a8c9d,_0x19cae9){var _0x50e30b=path['join'](config[_0x607e('0xb6')],_0x607e('0xb7'));return db['User'][_0x607e('0x3b')]({'where':{'id':_0x5a8c9d[_0x607e('0x65')]['id']},'attributes':['id',_0x607e('0xb3')],'raw':!![]})[_0x607e('0x29')](handleEntityNotFound(_0x19cae9,null))[_0x607e('0x29')](function(_0x392e36){if(_0x392e36){if(_[_0x607e('0x6f')](_0x392e36[_0x607e('0xb3')])){return _0x19cae9['download'](_0x50e30b);}else{if(!fs[_0x607e('0xb8')](path['join'](config['root'],'server/files/images/',_0x392e36[_0x607e('0xb3')]))){return _0x19cae9['download'](_0x50e30b);}return _0x19cae9[_0x607e('0xb9')](path[_0x607e('0xba')](config[_0x607e('0xb6')],'server/files/images/',_0x392e36['userpic']));}}})[_0x607e('0x1e')](handleError(_0x19cae9,null));};exports[_0x607e('0xbb')]=function(_0x53848f,_0x350c82){return db[_0x607e('0x40')][_0x607e('0x3b')]({'where':{'id':_0x53848f['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x350c82,null))[_0x607e('0x29')](function(_0x44c6a0){var _0x2cdd4d=[];values=_0x44c6a0[_0x607e('0x52')];_0x2cdd4d[_0x607e('0x4d')](get_open_tabs('chat',_0x44c6a0[_0x607e('0x52')]));_0x2cdd4d['push'](get_open_tabs('sms',_0x44c6a0[_0x607e('0x52')]));_0x2cdd4d[_0x607e('0x4d')](get_open_tabs(_0x607e('0x56'),_0x44c6a0[_0x607e('0x52')]));_0x2cdd4d['push'](get_open_tabs(_0x607e('0x63'),_0x44c6a0[_0x607e('0x52')]));_0x2cdd4d[_0x607e('0x4d')](get_open_tabs(_0x607e('0x54'),_0x44c6a0[_0x607e('0x52')]));_0x2cdd4d[_0x607e('0x4d')](get_open_tabs(_0x607e('0x55'),_0x44c6a0['dataValues']));return Promise[_0x607e('0x8f')](_0x2cdd4d);})[_0x607e('0x29')](function(_0x7cb41){if(_0x7cb41){var _0x5a7c69=_[_0x607e('0x38')](values[_0x607e('0xbc')],function(_0x39b8b4){return{'channel':_0x607e('0xbd'),'id':_0x39b8b4['id'],'createdAt':_0x39b8b4[_0x607e('0xbe')]};});var _0x9e18b9=_[_0x607e('0x38')](values[_0x607e('0xbf')],function(_0x2152c8){return{'channel':'FAX','id':_0x2152c8['id'],'createdAt':_0x2152c8['createdAt']};});var _0x1f855b=_[_0x607e('0x38')](values[_0x607e('0xc0')],function(_0x54898a){return{'channel':'OPENCHANNEL','id':_0x54898a['id'],'createdAt':_0x54898a[_0x607e('0xbe')]};});var _0x1ecdd5=_['map'](values['MailOpenTabs'],function(_0x4b5ed7){return{'channel':'MAIL','id':_0x4b5ed7['id'],'createdAt':_0x4b5ed7[_0x607e('0xbe')]};});var _0x276e1e=_['map'](values['SmsOpenTabs'],function(_0x363b83){return{'channel':_0x607e('0xc1'),'id':_0x363b83['id'],'createdAt':_0x363b83[_0x607e('0xbe')]};});var _0x172399=_[_0x607e('0x38')](values[_0x607e('0xc2')],function(_0x7373ab){return{'channel':_0x607e('0xc3'),'id':_0x7373ab['id'],'createdAt':_0x7373ab[_0x607e('0xbe')]};});var _0x27cb72=_[_0x607e('0xc4')](_0x5a7c69,_0x9e18b9,_0x1f855b,_0x1ecdd5,_0x276e1e,_0x172399);var _0x40a431={'count':_0x27cb72[_0x607e('0x51')],'rows':_0x27cb72};return _0x40a431;}else return null;})[_0x607e('0x29')](respondWithResult(_0x350c82,null))[_0x607e('0x1e')](handleError(_0x350c82,null));};exports['getContacts']=function(_0x139f0a,_0x3f49cc){var _0x3c3d82={};var _0x27c034={};var _0x21c664;var _0x247cff;return db[_0x607e('0x40')]['findOne']({'where':{'id':_0x139f0a['params']['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x3f49cc,null))[_0x607e('0x29')](function(_0x5e3b58){if(_0x5e3b58){_0x21c664=_0x5e3b58;_0x27c034['model']=_['keys'](db[_0x607e('0xc5')][_0x607e('0x5b')]);_0x27c034[_0x607e('0x48')]=_['keys'](_0x139f0a['query']);_0x27c034[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x27c034[_0x607e('0x58')],_0x27c034[_0x607e('0x48')]);_0x3c3d82[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x27c034[_0x607e('0x58')],qs['fields'](_0x139f0a[_0x607e('0x48')]['fields']));_0x3c3d82['attributes']=_0x3c3d82[_0x607e('0x4c')]['length']?_0x3c3d82[_0x607e('0x4c')]:_0x27c034[_0x607e('0x58')];_0x3c3d82[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x139f0a[_0x607e('0x48')][_0x607e('0xc8')]);_0x3c3d82[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x139f0a['query'],_0x27c034[_0x607e('0xc6')]));if(_0x139f0a['query']['filter']){_0x3c3d82['where']=_[_0x607e('0x60')](_0x3c3d82[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x3c3d82[_0x607e('0x4c')],function(_0x589942){var _0x46b09f={};_0x46b09f[_0x589942]={'$like':'%'+_0x139f0a[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x46b09f;})});}_0x3c3d82=_[_0x607e('0x60')]({},_0x3c3d82,_0x139f0a[_0x607e('0x61')]);return _0x21c664['getContacts'](_0x3c3d82);}})[_0x607e('0x29')](function(_0x2c7011){if(_0x2c7011){_0x247cff=_0x2c7011['length'];if(_0x139f0a[_0x607e('0x48')][_0x607e('0xca')](_0x607e('0x5e'))){_0x3c3d82['include']=[{'model':db[_0x607e('0xcb')],'as':'List','required':![]},{'model':db[_0x607e('0xcc')],'as':_0x607e('0xcd'),'attributes':['id',_0x607e('0x3e'),_0x607e('0xce')],'where':_0x139f0a[_0x607e('0x48')]['tag']?{'id':_0x139f0a['query'][_0x607e('0xcf')]}:undefined,'required':_0x139f0a[_0x607e('0x48')][_0x607e('0xcf')]?!![]:![]}];}if(!_0x139f0a[_0x607e('0x48')][_0x607e('0xca')]('nolimit')){_0x3c3d82[_0x607e('0x24')]=qs['limit'](_0x139f0a[_0x607e('0x48')]['limit']);_0x3c3d82['offset']=qs[_0x607e('0x26')](_0x139f0a[_0x607e('0x48')][_0x607e('0x26')]);}return _0x21c664[_0x607e('0xd0')](_0x3c3d82);}})['then'](function(_0xb8c0d9){if(_0xb8c0d9){return _0xb8c0d9?{'count':_0x247cff,'rows':_0xb8c0d9}:null;}})['then'](respondWithResult(_0x3f49cc,null))[_0x607e('0x1e')](handleError(_0x3f49cc,null));};exports[_0x607e('0xd1')]=function(_0x43ddf5,_0x35b93a){var _0x460650;var _0x284591={};var _0xc2826e;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x43ddf5['params']['id']},'attributes':['id',_0x607e('0x3e'),_0x607e('0x2a')]})[_0x607e('0x29')](handleEntityNotFound(_0x35b93a,null))[_0x607e('0x29')](function(_0x47e578){if(!utils[_0x607e('0xa4')](_0x43ddf5['query'][_0x607e('0xa1')])){throw new db['Sequelize']['ValidationError'](_0x607e('0xa5'));}_0x460650=_0x47e578;var _0x3605ba={};_0x3605ba[_0x607e('0x58')]=_['keys'](db[_[_0x607e('0xa8')](_0x43ddf5[_0x607e('0x48')][_0x607e('0xa1')])+'Queue'][_0x607e('0x5b')]);_0x3605ba[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x43ddf5[_0x607e('0x48')]);_0x3605ba[_0x607e('0xc6')]=_['intersection'](_0x3605ba[_0x607e('0x58')],_0x3605ba['query']);_0x284591[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x3605ba[_0x607e('0x58')],qs[_0x607e('0x5d')](_0x43ddf5[_0x607e('0x48')][_0x607e('0x5d')]));_0x284591['attributes']=_0x284591[_0x607e('0x4c')]['length']?_0x284591['attributes']:_0x3605ba[_0x607e('0x58')];_0x284591[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x43ddf5['query'][_0x607e('0xc8')]);_0x284591['where']=qs['filters'](_['pick'](_0x43ddf5[_0x607e('0x48')],_0x3605ba[_0x607e('0xc6')]));if(_0x43ddf5[_0x607e('0x48')][_0x607e('0x36')]){_0x284591['where']=_[_0x607e('0x60')](_0x284591['where'],{'$or':_[_0x607e('0x38')](_0x284591[_0x607e('0x4c')],function(_0x4c432f){var _0x42cc18={};_0x42cc18[_0x4c432f]={'$like':'%'+_0x43ddf5[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x42cc18;})});}_0x284591=_[_0x607e('0x60')]({},_0x284591,_0x43ddf5[_0x607e('0x61')]);switch(_0x460650[_0x607e('0x2a')]){case'admin':return db[_[_0x607e('0xa8')](_0x43ddf5[_0x607e('0x48')][_0x607e('0xa1')])+_0x607e('0xd2')][_0x607e('0x4e')](_0x284591);case'user':case _0x607e('0x2b'):return _0x460650['get'+_[_0x607e('0xa8')](_0x43ddf5[_0x607e('0x48')][_0x607e('0xa1')])+'Queues'](_0x284591);default:throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))]('Unknown\x20role');}})['then'](function(_0x1f2671){_0xc2826e=_0x1f2671[_0x607e('0x51')];if(!_0x43ddf5[_0x607e('0x48')][_0x607e('0xca')](_0x607e('0xd3'))){_0x284591[_0x607e('0x24')]=qs[_0x607e('0x24')](_0x43ddf5['query'][_0x607e('0x24')]);_0x284591['offset']=qs[_0x607e('0x26')](_0x43ddf5[_0x607e('0x48')][_0x607e('0x26')]);}switch(_0x460650[_0x607e('0x2a')]){case _0x607e('0x30'):return db[_['capitalize'](_0x43ddf5[_0x607e('0x48')][_0x607e('0xa1')])+'Queue'][_0x607e('0x4e')](_0x284591);case _0x607e('0x32'):case _0x607e('0x2b'):return _0x460650[_0x607e('0x2f')+_[_0x607e('0xa8')](_0x43ddf5['query'][_0x607e('0xa1')])+'Queues'](_0x284591);}})[_0x607e('0x29')](function(_0x44cb7b){return{'count':_0xc2826e,'rows':_0x44cb7b};})[_0x607e('0x29')](respondWithResult(_0x35b93a,null))[_0x607e('0x1e')](handleError(_0x35b93a,null));};exports['getVoiceQueuesRt']=function(_0x2beaea,_0x1a6057){var _0x43700b={};var _0x53e308={};var _0x26021f;var _0x118d43;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x2beaea[_0x607e('0x65')]['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x1a6057,null))['then'](function(_0x124cda){if(_0x124cda){_0x26021f=_0x124cda;_0x53e308[_0x607e('0x58')]=_[_0x607e('0x5a')](db[_0x607e('0xac')][_0x607e('0x5b')]);_0x53e308[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x2beaea[_0x607e('0x48')]);_0x53e308['filters']=_['intersection'](_0x53e308['model'],_0x53e308[_0x607e('0x48')]);_0x43700b['attributes']=_[_0x607e('0x5c')](_0x53e308[_0x607e('0x58')],qs[_0x607e('0x5d')](_0x2beaea[_0x607e('0x48')]['fields']));_0x43700b[_0x607e('0x4c')]=_0x43700b[_0x607e('0x4c')][_0x607e('0x51')]?_0x43700b[_0x607e('0x4c')]:_0x53e308[_0x607e('0x58')];_0x43700b[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x2beaea[_0x607e('0x48')][_0x607e('0xc8')]);_0x43700b[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x2beaea[_0x607e('0x48')],_0x53e308[_0x607e('0xc6')]));if(_0x2beaea[_0x607e('0x48')][_0x607e('0x36')]){_0x43700b['where']=_['merge'](_0x43700b[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x43700b['attributes'],function(_0x5ac366){var _0x13eec3={};_0x13eec3[_0x5ac366]={'$like':'%'+_0x2beaea[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x13eec3;})});}_0x43700b=_[_0x607e('0x60')]({},_0x43700b,_0x2beaea['options']);return _0x26021f[_0x607e('0xd4')](_0x43700b);}})['then'](function(_0x6d957d){if(_0x6d957d){_0x118d43=_0x6d957d['length'];if(!_0x2beaea['query']['hasOwnProperty'](_0x607e('0xd3'))){_0x43700b['limit']=qs[_0x607e('0x24')](_0x2beaea[_0x607e('0x48')]['limit']);_0x43700b['offset']=qs[_0x607e('0x26')](_0x2beaea[_0x607e('0x48')][_0x607e('0x26')]);}return _0x26021f[_0x607e('0xd4')](_0x43700b);}})[_0x607e('0x29')](function(_0x1dc435){if(_0x1dc435){return _0x1dc435?{'count':_0x118d43,'rows':_0x1dc435}:null;}})[_0x607e('0x29')](respondWithResult(_0x1a6057,null))[_0x607e('0x1e')](handleError(_0x1a6057,null));};exports['getGroups']=function(_0x443b7d,_0x29983e){var _0x40e3b6={};var _0x51ad6d={};var _0x52e7b8;var _0x540ff8;return db['User'][_0x607e('0x9a')]({'where':{'id':_0x443b7d['params']['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x29983e,null))[_0x607e('0x29')](function(_0x19c3dc){if(_0x19c3dc){_0x52e7b8=_0x19c3dc;_0x51ad6d[_0x607e('0x58')]=_[_0x607e('0x5a')](db[_0x607e('0xd5')][_0x607e('0x5b')]);_0x51ad6d[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x443b7d[_0x607e('0x48')]);_0x51ad6d[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x51ad6d[_0x607e('0x58')],_0x51ad6d['query']);_0x40e3b6[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x51ad6d[_0x607e('0x58')],qs['fields'](_0x443b7d[_0x607e('0x48')]['fields']));_0x40e3b6[_0x607e('0x4c')]=_0x40e3b6[_0x607e('0x4c')][_0x607e('0x51')]?_0x40e3b6[_0x607e('0x4c')]:_0x51ad6d['model'];_0x40e3b6[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x443b7d[_0x607e('0x48')]['sort']);_0x40e3b6[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x443b7d[_0x607e('0x48')],_0x51ad6d[_0x607e('0xc6')]));if(_0x443b7d[_0x607e('0x48')]['filter']){_0x40e3b6[_0x607e('0x47')]=_[_0x607e('0x60')](_0x40e3b6[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x40e3b6[_0x607e('0x4c')],function(_0x35a96e){var _0x442217={};_0x442217[_0x35a96e]={'$like':'%'+_0x443b7d[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x442217;})});}_0x40e3b6=_[_0x607e('0x60')]({},_0x40e3b6,_0x443b7d[_0x607e('0x61')]);return _0x52e7b8[_0x607e('0xd6')](_0x40e3b6);}})['then'](function(_0x1140af){if(_0x1140af){_0x540ff8=_0x1140af[_0x607e('0x51')];if(!_0x443b7d[_0x607e('0x48')]['hasOwnProperty'](_0x607e('0xd3'))){_0x40e3b6[_0x607e('0x24')]=qs['limit'](_0x443b7d[_0x607e('0x48')][_0x607e('0x24')]);_0x40e3b6[_0x607e('0x26')]=qs['offset'](_0x443b7d[_0x607e('0x48')]['offset']);}return _0x52e7b8['getGroups'](_0x40e3b6);}})['then'](function(_0x4e85b4){if(_0x4e85b4){return _0x4e85b4?{'count':_0x540ff8,'rows':_0x4e85b4}:null;}})['then'](respondWithResult(_0x29983e,null))[_0x607e('0x1e')](handleError(_0x29983e,null));};exports[_0x607e('0xd7')]=function(_0x32fc83,_0x1db8ee){var _0x5e528f={'raw':!![],'where':{}};var _0x31c2f0={};var _0x4fcdf7={'count':0x0,'rows':[]};return db[_0x607e('0x40')]['findOne']({'where':{'id':_0x32fc83[_0x607e('0x65')]['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x1db8ee,null))[_0x607e('0x29')](function(_0xef51b8){if(_0xef51b8){_0x31c2f0['model']=_[_0x607e('0x5a')](db[_0x607e('0xd8')]['rawAttributes']);_0x31c2f0[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x32fc83[_0x607e('0x48')]);_0x31c2f0[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x31c2f0[_0x607e('0x58')],_0x31c2f0[_0x607e('0x48')]);_0x5e528f[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x31c2f0[_0x607e('0x58')],qs['fields'](_0x32fc83[_0x607e('0x48')][_0x607e('0x5d')]));_0x5e528f[_0x607e('0x4c')]=_0x5e528f['attributes']['length']?_0x5e528f[_0x607e('0x4c')]:_0x31c2f0['model'];if(!_0x32fc83[_0x607e('0x48')]['hasOwnProperty'](_0x607e('0xd3'))){_0x5e528f['limit']=qs[_0x607e('0x24')](_0x32fc83[_0x607e('0x48')][_0x607e('0x24')]);_0x5e528f[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x32fc83[_0x607e('0x48')][_0x607e('0x26')]);}_0x5e528f[_0x607e('0xc7')]=qs['sort'](_0x32fc83[_0x607e('0x48')][_0x607e('0xc8')]);_0x5e528f[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x32fc83['query'],_0x31c2f0[_0x607e('0xc6')]));_0x5e528f[_0x607e('0x47')][_0x607e('0xd9')]=_0xef51b8['id'];if(_0x32fc83[_0x607e('0x48')][_0x607e('0x36')]){_0x5e528f[_0x607e('0x47')]=_[_0x607e('0x60')](_0x5e528f[_0x607e('0x47')],{'$or':_['map'](_0x5e528f[_0x607e('0x4c')],function(_0x5060b4){var _0x54371f={};_0x54371f[_0x5060b4]={'$like':'%'+_0x32fc83[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x54371f;})});}_0x5e528f=_[_0x607e('0x60')]({},_0x5e528f,_0x32fc83[_0x607e('0x61')]);return db['VoiceRecording'][_0x607e('0x25')]({'where':_0x5e528f[_0x607e('0x47')]})[_0x607e('0x29')](function(_0xa6e020){_0x4fcdf7[_0x607e('0x25')]=_0xa6e020;if(_0x32fc83['query']['includeAll']){_0x5e528f['include']=[{'all':!![]}];}return db[_0x607e('0xd8')][_0x607e('0x4e')](_0x5e528f);})['then'](function(_0x2f3a15){_0x4fcdf7[_0x607e('0x4f')]=_0x2f3a15;return _0x4fcdf7;});}})[_0x607e('0x29')](respondWithFilteredResult(_0x1db8ee,_0x5e528f))[_0x607e('0x1e')](handleError(_0x1db8ee,null));};exports[_0x607e('0xda')]=function(_0x13b3eb,_0x23d457){var _0x564cbb={'raw':!![],'where':{}};var _0x95f937={};var _0x332c1d={'count':0x0,'rows':[]};return db[_0x607e('0x40')]['findOne']({'where':{'id':_0x13b3eb[_0x607e('0x65')]['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x23d457,null))[_0x607e('0x29')](function(_0x6c530f){if(_0x6c530f){_0x95f937['model']=_[_0x607e('0x5a')](db['ScreenRecording'][_0x607e('0x5b')]);_0x95f937[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x13b3eb[_0x607e('0x48')]);_0x95f937[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x95f937[_0x607e('0x58')],_0x95f937[_0x607e('0x48')]);_0x564cbb[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x95f937[_0x607e('0x58')],qs[_0x607e('0x5d')](_0x13b3eb[_0x607e('0x48')]['fields']));_0x564cbb['attributes']=_0x564cbb[_0x607e('0x4c')]['length']?_0x564cbb[_0x607e('0x4c')]:_0x95f937[_0x607e('0x58')];if(!_0x13b3eb['query'][_0x607e('0xca')](_0x607e('0xd3'))){_0x564cbb['limit']=qs['limit'](_0x13b3eb[_0x607e('0x48')][_0x607e('0x24')]);_0x564cbb[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x13b3eb[_0x607e('0x48')][_0x607e('0x26')]);}_0x564cbb[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x13b3eb['query'][_0x607e('0xc8')]);_0x564cbb[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x13b3eb[_0x607e('0x48')],_0x95f937[_0x607e('0xc6')]));_0x564cbb[_0x607e('0x47')]['UserId']=_0x6c530f['id'];if(_0x13b3eb[_0x607e('0x48')][_0x607e('0x36')]){_0x564cbb[_0x607e('0x47')]=_['merge'](_0x564cbb['where'],{'$or':_[_0x607e('0x38')](_0x564cbb[_0x607e('0x4c')],function(_0x584bcd){var _0x1cd9a1={};_0x1cd9a1[_0x584bcd]={'$like':'%'+_0x13b3eb['query']['filter']+'%'};return _0x1cd9a1;})});}_0x564cbb=_['merge']({},_0x564cbb,_0x13b3eb[_0x607e('0x61')]);return db['ScreenRecording'][_0x607e('0x25')]({'where':_0x564cbb['where']})['then'](function(_0xda2ba1){_0x332c1d['count']=_0xda2ba1;if(_0x13b3eb['query'][_0x607e('0x5e')]){_0x564cbb[_0x607e('0x49')]=[{'all':!![]}];}return db[_0x607e('0xdb')]['findAll'](_0x564cbb);})[_0x607e('0x29')](function(_0x3009a1){_0x332c1d[_0x607e('0x4f')]=_0x3009a1;return _0x332c1d;});}})['then'](respondWithFilteredResult(_0x23d457,_0x564cbb))['catch'](handleError(_0x23d457,null));};exports[_0x607e('0xdc')]=function(_0x266ace,_0x3ffbac){var _0xb1446f={};var _0x163fb0={};var _0x6337a6;var _0x2ca97f;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x266ace[_0x607e('0x65')]['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x3ffbac,null))[_0x607e('0x29')](function(_0x4ee5f8){if(_0x4ee5f8){_0x6337a6=_0x4ee5f8;_0x163fb0[_0x607e('0x58')]=_['keys'](db['ChatInteraction'][_0x607e('0x5b')]);_0x163fb0[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x266ace['query']);_0x163fb0[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x163fb0[_0x607e('0x58')],_0x163fb0[_0x607e('0x48')]);_0xb1446f['attributes']=_[_0x607e('0x5c')](_0x163fb0[_0x607e('0x58')],qs['fields'](_0x266ace[_0x607e('0x48')][_0x607e('0x5d')]));_0xb1446f[_0x607e('0x4c')]=_0xb1446f[_0x607e('0x4c')][_0x607e('0x51')]?_0xb1446f['attributes']:_0x163fb0[_0x607e('0x58')];_0xb1446f[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x266ace[_0x607e('0x48')][_0x607e('0xc8')]);_0xb1446f[_0x607e('0x47')]=qs['filters'](_[_0x607e('0xc9')](_0x266ace[_0x607e('0x48')],_0x163fb0['filters']));if(_0x266ace[_0x607e('0x48')]['filter']){_0xb1446f[_0x607e('0x47')]=_[_0x607e('0x60')](_0xb1446f[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0xb1446f[_0x607e('0x4c')],function(_0x4c6fe0){var _0x2e2987={};_0x2e2987[_0x4c6fe0]={'$like':'%'+_0x266ace[_0x607e('0x48')]['filter']+'%'};return _0x2e2987;})});}_0xb1446f=_[_0x607e('0x60')]({},_0xb1446f,_0x266ace[_0x607e('0x61')]);return _0x6337a6[_0x607e('0xdc')](_0xb1446f);}})[_0x607e('0x29')](function(_0x2d64d0){if(_0x2d64d0){_0x2ca97f=_0x2d64d0[_0x607e('0x51')];if(!_0x266ace['query'][_0x607e('0xca')](_0x607e('0xd3'))){_0xb1446f[_0x607e('0x24')]=qs[_0x607e('0x24')](_0x266ace[_0x607e('0x48')][_0x607e('0x24')]);_0xb1446f[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x266ace[_0x607e('0x48')][_0x607e('0x26')]);}return _0x6337a6['getChatInteractions'](_0xb1446f);}})[_0x607e('0x29')](function(_0x55d52f){if(_0x55d52f){return _0x55d52f?{'count':_0x2ca97f,'rows':_0x55d52f}:null;}})[_0x607e('0x29')](respondWithResult(_0x3ffbac,null))['catch'](handleError(_0x3ffbac,null));};exports[_0x607e('0xdd')]=function(_0x3060e9,_0x26f05d){var _0x50b681={};var _0x39294c={};var _0x3f4203;var _0x4d669d;return db['User'][_0x607e('0x9a')]({'where':{'id':_0x3060e9['params']['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x26f05d,null))[_0x607e('0x29')](function(_0x5586e6){if(_0x5586e6){_0x3f4203=_0x5586e6;_0x39294c[_0x607e('0x58')]=_[_0x607e('0x5a')](db['OpenchannelInteraction']['rawAttributes']);_0x39294c[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x3060e9[_0x607e('0x48')]);_0x39294c['filters']=_['intersection'](_0x39294c[_0x607e('0x58')],_0x39294c[_0x607e('0x48')]);_0x50b681['attributes']=_[_0x607e('0x5c')](_0x39294c['model'],qs[_0x607e('0x5d')](_0x3060e9['query']['fields']));_0x50b681[_0x607e('0x4c')]=_0x50b681[_0x607e('0x4c')][_0x607e('0x51')]?_0x50b681['attributes']:_0x39294c[_0x607e('0x58')];_0x50b681[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x3060e9[_0x607e('0x48')][_0x607e('0xc8')]);_0x50b681[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x3060e9[_0x607e('0x48')],_0x39294c[_0x607e('0xc6')]));if(_0x3060e9['query'][_0x607e('0x36')]){_0x50b681[_0x607e('0x47')]=_['merge'](_0x50b681[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x50b681[_0x607e('0x4c')],function(_0x21e63d){var _0x26ad3a={};_0x26ad3a[_0x21e63d]={'$like':'%'+_0x3060e9['query']['filter']+'%'};return _0x26ad3a;})});}_0x50b681=_[_0x607e('0x60')]({},_0x50b681,_0x3060e9['options']);return _0x3f4203[_0x607e('0xdd')](_0x50b681);}})[_0x607e('0x29')](function(_0xeacdf5){if(_0xeacdf5){_0x4d669d=_0xeacdf5[_0x607e('0x51')];if(!_0x3060e9[_0x607e('0x48')][_0x607e('0xca')](_0x607e('0xd3'))){_0x50b681[_0x607e('0x24')]=qs[_0x607e('0x24')](_0x3060e9[_0x607e('0x48')][_0x607e('0x24')]);_0x50b681[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x3060e9['query'][_0x607e('0x26')]);}return _0x3f4203[_0x607e('0xdd')](_0x50b681);}})[_0x607e('0x29')](function(_0x9e2d90){if(_0x9e2d90){return _0x9e2d90?{'count':_0x4d669d,'rows':_0x9e2d90}:null;}})[_0x607e('0x29')](respondWithResult(_0x26f05d,null))[_0x607e('0x1e')](handleError(_0x26f05d,null));};exports[_0x607e('0xde')]=function(_0x727a35,_0x3d706c){var _0x56522a={'raw':!![],'where':{}};var _0x2e5f1e={};var _0x192cd0={'count':0x0,'rows':[]};return db[_0x607e('0x40')]['findOne']({'where':{'id':_0x727a35['params']['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x3d706c,null))[_0x607e('0x29')](function(_0x5856a3){if(_0x5856a3){_0x2e5f1e[_0x607e('0x58')]=_['keys'](db['MailInteraction'][_0x607e('0x5b')]);_0x2e5f1e[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x727a35[_0x607e('0x48')]);_0x2e5f1e[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x2e5f1e[_0x607e('0x58')],_0x2e5f1e[_0x607e('0x48')]);_0x56522a[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x2e5f1e[_0x607e('0x58')],qs['fields'](_0x727a35[_0x607e('0x48')][_0x607e('0x5d')]));_0x56522a[_0x607e('0x4c')]=_0x56522a[_0x607e('0x4c')]['length']?_0x56522a[_0x607e('0x4c')]:_0x2e5f1e[_0x607e('0x58')];if(!_0x727a35[_0x607e('0x48')][_0x607e('0xca')](_0x607e('0xd3'))){_0x56522a[_0x607e('0x24')]=qs[_0x607e('0x24')](_0x727a35[_0x607e('0x48')][_0x607e('0x24')]);_0x56522a[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x727a35['query'][_0x607e('0x26')]);}_0x56522a[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x727a35[_0x607e('0x48')][_0x607e('0xc8')]);_0x56522a[_0x607e('0x47')]=qs['filters'](_[_0x607e('0xc9')](_0x727a35[_0x607e('0x48')],_0x2e5f1e[_0x607e('0xc6')]));_0x56522a[_0x607e('0x47')]['UserId']=_0x5856a3['id'];if(_0x727a35['query'][_0x607e('0x36')]){_0x56522a[_0x607e('0x47')]=_['merge'](_0x56522a[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x56522a[_0x607e('0x4c')],function(_0x31a5db){var _0x8bd209={};_0x8bd209[_0x31a5db]={'$like':'%'+_0x727a35[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x8bd209;})});}_0x56522a=_[_0x607e('0x60')]({},_0x56522a,_0x727a35['options']);return db['MailInteraction'][_0x607e('0x25')]({'where':_0x56522a[_0x607e('0x47')]})['then'](function(_0x31980c){_0x192cd0[_0x607e('0x25')]=_0x31980c;if(_0x727a35[_0x607e('0x48')][_0x607e('0x5e')]){_0x56522a[_0x607e('0x49')]=[{'all':!![]}];}return db['MailInteraction'][_0x607e('0x4e')](_0x56522a);})[_0x607e('0x29')](function(_0x8dc46a){_0x192cd0[_0x607e('0x4f')]=_0x8dc46a;return _0x192cd0;});}})['then'](respondWithFilteredResult(_0x3d706c,_0x56522a))['catch'](handleError(_0x3d706c,null));};exports[_0x607e('0xdf')]=function(_0x3eda80,_0x528189){var _0x10ff86={};var _0x25c095={};var _0x3f669a;var _0x2bcbe2;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x3eda80[_0x607e('0x65')]['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x528189,null))[_0x607e('0x29')](function(_0x308dac){if(_0x308dac){_0x3f669a=_0x308dac;_0x25c095['model']=_[_0x607e('0x5a')](db[_0x607e('0xe0')][_0x607e('0x5b')]);_0x25c095[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x3eda80['query']);_0x25c095['filters']=_['intersection'](_0x25c095[_0x607e('0x58')],_0x25c095['query']);_0x10ff86['attributes']=_[_0x607e('0x5c')](_0x25c095[_0x607e('0x58')],qs['fields'](_0x3eda80['query']['fields']));_0x10ff86[_0x607e('0x4c')]=_0x10ff86['attributes'][_0x607e('0x51')]?_0x10ff86[_0x607e('0x4c')]:_0x25c095['model'];_0x10ff86[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x3eda80[_0x607e('0x48')][_0x607e('0xc8')]);_0x10ff86['where']=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x3eda80[_0x607e('0x48')],_0x25c095[_0x607e('0xc6')]));if(_0x3eda80[_0x607e('0x48')][_0x607e('0x36')]){_0x10ff86[_0x607e('0x47')]=_[_0x607e('0x60')](_0x10ff86[_0x607e('0x47')],{'$or':_['map'](_0x10ff86[_0x607e('0x4c')],function(_0x380247){var _0x4f9ecc={};_0x4f9ecc[_0x380247]={'$like':'%'+_0x3eda80['query'][_0x607e('0x36')]+'%'};return _0x4f9ecc;})});}_0x10ff86=_[_0x607e('0x60')]({},_0x10ff86,_0x3eda80[_0x607e('0x61')]);return _0x3f669a[_0x607e('0xdf')](_0x10ff86);}})[_0x607e('0x29')](function(_0x2524cd){if(_0x2524cd){_0x2bcbe2=_0x2524cd[_0x607e('0x51')];if(!_0x3eda80['query'][_0x607e('0xca')](_0x607e('0xd3'))){_0x10ff86['limit']=qs[_0x607e('0x24')](_0x3eda80['query']['limit']);_0x10ff86[_0x607e('0x26')]=qs['offset'](_0x3eda80[_0x607e('0x48')][_0x607e('0x26')]);}return _0x3f669a['getSmsInteractions'](_0x10ff86);}})[_0x607e('0x29')](function(_0x383e83){if(_0x383e83){return _0x383e83?{'count':_0x2bcbe2,'rows':_0x383e83}:null;}})[_0x607e('0x29')](respondWithResult(_0x528189,null))[_0x607e('0x1e')](handleError(_0x528189,null));};exports[_0x607e('0xe1')]=function(_0x2e31de,_0x50ddcb){var _0x4be6ff={};var _0x3a0116={};var _0x16b5ff;var _0x37b270;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x2e31de[_0x607e('0x65')]['id']}})['then'](handleEntityNotFound(_0x50ddcb,null))[_0x607e('0x29')](function(_0x3f6a05){if(_0x3f6a05){_0x16b5ff=_0x3f6a05;_0x3a0116[_0x607e('0x58')]=_[_0x607e('0x5a')](db[_0x607e('0xe2')][_0x607e('0x5b')]);_0x3a0116[_0x607e('0x48')]=_['keys'](_0x2e31de['query']);_0x3a0116[_0x607e('0xc6')]=_['intersection'](_0x3a0116[_0x607e('0x58')],_0x3a0116[_0x607e('0x48')]);_0x4be6ff['attributes']=_[_0x607e('0x5c')](_0x3a0116[_0x607e('0x58')],qs[_0x607e('0x5d')](_0x2e31de[_0x607e('0x48')]['fields']));_0x4be6ff['attributes']=_0x4be6ff['attributes'][_0x607e('0x51')]?_0x4be6ff['attributes']:_0x3a0116[_0x607e('0x58')];_0x4be6ff[_0x607e('0xc7')]=qs['sort'](_0x2e31de[_0x607e('0x48')][_0x607e('0xc8')]);_0x4be6ff[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x2e31de['query'],_0x3a0116[_0x607e('0xc6')]));if(_0x2e31de[_0x607e('0x48')]['filter']){_0x4be6ff[_0x607e('0x47')]=_['merge'](_0x4be6ff[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x4be6ff[_0x607e('0x4c')],function(_0x567918){var _0x5e35b6={};_0x5e35b6[_0x567918]={'$like':'%'+_0x2e31de[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x5e35b6;})});}_0x4be6ff=_['merge']({},_0x4be6ff,_0x2e31de['options']);return _0x16b5ff[_0x607e('0xe1')](_0x4be6ff);}})[_0x607e('0x29')](function(_0x13c768){if(_0x13c768){_0x37b270=_0x13c768['length'];if(!_0x2e31de[_0x607e('0x48')][_0x607e('0xca')]('nolimit')){_0x4be6ff[_0x607e('0x24')]=qs[_0x607e('0x24')](_0x2e31de[_0x607e('0x48')][_0x607e('0x24')]);_0x4be6ff[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x2e31de['query'][_0x607e('0x26')]);}return _0x16b5ff['getFaxInteractions'](_0x4be6ff);}})[_0x607e('0x29')](function(_0x2b06a6){if(_0x2b06a6){return _0x2b06a6?{'count':_0x37b270,'rows':_0x2b06a6}:null;}})[_0x607e('0x29')](respondWithResult(_0x50ddcb,null))['catch'](handleError(_0x50ddcb,null));};exports['getWhatsappInteractions']=function(_0x448ad0,_0xb016b9){var _0x2bde19={};var _0x36476a={};var _0x11d19b;var _0x5cbb46;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x448ad0['params']['id']}})[_0x607e('0x29')](handleEntityNotFound(_0xb016b9,null))[_0x607e('0x29')](function(_0xdf7fad){if(_0xdf7fad){_0x11d19b=_0xdf7fad;_0x36476a[_0x607e('0x58')]=_[_0x607e('0x5a')](db[_0x607e('0xe3')][_0x607e('0x5b')]);_0x36476a[_0x607e('0x48')]=_['keys'](_0x448ad0['query']);_0x36476a['filters']=_[_0x607e('0x5c')](_0x36476a[_0x607e('0x58')],_0x36476a['query']);_0x2bde19[_0x607e('0x4c')]=_['intersection'](_0x36476a[_0x607e('0x58')],qs[_0x607e('0x5d')](_0x448ad0[_0x607e('0x48')][_0x607e('0x5d')]));_0x2bde19[_0x607e('0x4c')]=_0x2bde19[_0x607e('0x4c')]['length']?_0x2bde19[_0x607e('0x4c')]:_0x36476a['model'];_0x2bde19[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x448ad0['query'][_0x607e('0xc8')]);_0x2bde19[_0x607e('0x47')]=qs[_0x607e('0xc6')](_['pick'](_0x448ad0[_0x607e('0x48')],_0x36476a[_0x607e('0xc6')]));if(_0x448ad0['query'][_0x607e('0x36')]){_0x2bde19['where']=_['merge'](_0x2bde19[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x2bde19[_0x607e('0x4c')],function(_0x11b11a){var _0x52d437={};_0x52d437[_0x11b11a]={'$like':'%'+_0x448ad0[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x52d437;})});}_0x2bde19=_[_0x607e('0x60')]({},_0x2bde19,_0x448ad0[_0x607e('0x61')]);return _0x11d19b[_0x607e('0xe4')](_0x2bde19);}})[_0x607e('0x29')](function(_0x1f9977){if(_0x1f9977){_0x5cbb46=_0x1f9977[_0x607e('0x51')];if(!_0x448ad0[_0x607e('0x48')][_0x607e('0xca')](_0x607e('0xd3'))){_0x2bde19[_0x607e('0x24')]=qs['limit'](_0x448ad0[_0x607e('0x48')][_0x607e('0x24')]);_0x2bde19[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x448ad0['query'][_0x607e('0x26')]);}return _0x11d19b[_0x607e('0xe4')](_0x2bde19);}})[_0x607e('0x29')](function(_0x4b5fac){if(_0x4b5fac){return _0x4b5fac?{'count':_0x5cbb46,'rows':_0x4b5fac}:null;}})['then'](respondWithResult(_0xb016b9,null))[_0x607e('0x1e')](handleError(_0xb016b9,null));};exports[_0x607e('0xe5')]=function(_0x8fb2e1,_0x2c56bb,_0x2c69c7){var _0x3d1db7;var _0x22ef82;var _0x2f7ff1;var _0x2a1365=!_[_0x607e('0x6f')](_0x8fb2e1[_0x607e('0x65')]['id'])?_0x8fb2e1[_0x607e('0x65')]['id']:!_[_0x607e('0x6f')](_0x8fb2e1[_0x607e('0x32')]['id'])?_0x8fb2e1[_0x607e('0x32')]['id']:null;return db[_0x607e('0x40')][_0x607e('0x3b')]({'where':{'id':_0x2a1365,'role':{'$or':[_0x607e('0x30'),_0x607e('0x32'),_0x607e('0x2b')]}},'attributes':['id',_0x607e('0x3e'),_0x607e('0xe6'),_0x607e('0xe7'),_0x607e('0x2a'),_0x607e('0x6a'),'loginInPause']})[_0x607e('0x29')](function(_0x4982f9){if(_0x4982f9){if(_0x4982f9[_0x607e('0x2a')]===_0x607e('0x2b')){_0x3d1db7=_0x4982f9;if(_0x8fb2e1[_0x607e('0x64')][_0x607e('0xa3')]){_0x2f7ff1=util['format'](_0x607e('0xe8'),_0x3d1db7[_0x8fb2e1['body'][_0x607e('0xa3')]]);}else if(_0x8fb2e1[_0x607e('0x64')]['intrf']){_0x2f7ff1=util['format'](_0x607e('0xe9'),_0x8fb2e1[_0x607e('0x64')][_0x607e('0xea')]);}else{_0x2f7ff1=util['format']('SIP/%s',_0x3d1db7['name']);}socket['to'](util[_0x607e('0xab')](_0x607e('0xeb'),_0x3d1db7[_0x607e('0x3e')]))['emit'](_0x607e('0xec'),{'user':{'id':_0x3d1db7['id'],'name':_0x3d1db7[_0x607e('0x3e')]},'ip':_0x8fb2e1[_0x607e('0xed')]['x-forwarded-for']||_0x8fb2e1['connection'][_0x607e('0xee')]||_0x8fb2e1[_0x607e('0xef')]['remoteAddress']||_0x8fb2e1[_0x607e('0xf0')][_0x607e('0xef')][_0x607e('0xee')]});return db['UserVoiceQueueRt'][_0x607e('0x2e')]({'where':{'membername':_0x3d1db7[_0x607e('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0x607e('0x94'))][(_0x607e('0x95'))](_0x607e('0xf1'));}})[_0x607e('0x29')](function(){if(_0x3d1db7){return _0x3d1db7[_0x607e('0xf2')]({'raw':!![]});}})[_0x607e('0x29')](function(_0x5f0810){if(_0x3d1db7){if(_0x5f0810){_0x22ef82=_0x5f0810;if(_0x22ef82[_0x607e('0x51')]){var _0xf10bcf=_0x22ef82[_0x607e('0x38')](function(_0x20efe6){var _0x5ecb13={'membername':_0x3d1db7[_0x607e('0x3e')],'UserId':_0x3d1db7['id'],'queue_name':_0x20efe6[_0x607e('0x3e')],'VoiceQueueId':_0x20efe6['id'],'interface':_0x2f7ff1,'paused':_0x3d1db7[_0x607e('0xf3')]||![],'penalty':_0x20efe6[_0x607e('0xf4')]||0x0};return db[_0x607e('0xac')][_0x607e('0xf5')](_0x5ecb13);});return Promise[_0x607e('0x8f')](_0xf10bcf);}}}})[_0x607e('0x29')](function(){if(_0x3d1db7){return db[_0x607e('0xf6')][_0x607e('0x4e')]({'where':{'membername':_0x3d1db7[_0x607e('0x3e')],'exitAt':null}});}})[_0x607e('0x29')](function(_0xe6abb1){if(_0x3d1db7){var _0x1b79c6=[];_0xe6abb1[_0x607e('0xf7')](function(_0x32c7ff){_0x1b79c6[_0x607e('0x4d')](_0x32c7ff['update']({'exitAt':moment()[_0x607e('0xab')](_0x607e('0xf8'))}));});return Promise[_0x607e('0x8f')](_0x1b79c6);}})['then'](function(){if(_0x3d1db7){var _0x1590cd=[];var _0x13341c=[];var _0x548aa3=utils[_0x607e('0xf9')]();var _0x128391={'membername':_0x3d1db7[_0x607e('0x3e')],'interface':_0x2f7ff1,'enterAt':moment()[_0x607e('0xab')](_0x607e('0xf8')),'role':_0x3d1db7[_0x607e('0x2a')],'internal':_0x3d1db7[_0x607e('0x6a')]};_0x548aa3['forEach'](function(_0x4f9f1f){_0x1590cd['push'](_[_0x607e('0x60')]({'channel':_0x4f9f1f,'type':_0x607e('0xfa'),'data1':_0x8fb2e1[_0x607e('0x64')][_0x607e('0xfb')],'data2':_0x2f7ff1},_0x128391));if(_0x3d1db7[_0x607e('0xf3')]){_0x13341c['push'](_[_0x607e('0x60')]({'channel':_0x4f9f1f,'type':_0x607e('0xfc'),'data1':_0x607e('0xfd')},_0x128391));}});return db[_0x607e('0xf6')][_0x607e('0x8d')](_0x1590cd[_0x607e('0xc4')](_0x13341c),{'individualHooks':!![]});}})[_0x607e('0x29')](function(){if(_0x3d1db7){return _0x3d1db7[_0x607e('0x28')]({'online':!![],'lastLoginAt':moment()[_0x607e('0xab')](_0x607e('0xf8')),'voicePause':_0x3d1db7['loginInPause']||![],'mailPause':_0x3d1db7['loginInPause']||![],'chatPause':_0x3d1db7[_0x607e('0xf3')]||![],'faxPause':_0x3d1db7['loginInPause']||![],'smsPause':_0x3d1db7[_0x607e('0xf3')]||![],'openchannelPause':_0x3d1db7[_0x607e('0xf3')]||![],'whatsappPause':_0x3d1db7[_0x607e('0xf3')]||![],'pauseType':_0x3d1db7[_0x607e('0xf3')]?_0x607e('0xfd'):null,'interface':_0x2f7ff1,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x607e('0x29')](function(_0xc7013b){if(_0x8fb2e1['isMiddleware']){return _0x2c69c7();}else{return Promise[_0x607e('0xfe')](_0xc7013b)[_0x607e('0x29')](respondWithResult(_0x2c56bb,null));}})[_0x607e('0x1e')](handleError(_0x2c56bb,null));};exports[_0x607e('0xff')]=function(_0x5d2e59,_0x14f010){var _0xd41885;return db[_0x607e('0x40')][_0x607e('0x3b')]({'where':{'id':_0x5d2e59[_0x607e('0x65')]['id'],'role':_0x607e('0x2b')},'attributes':['id','name',_0x607e('0x2a')]})[_0x607e('0x29')](handleEntityNotFound(_0x14f010,null))['then'](function(_0x1dd284){if(_0x1dd284){_0xd41885=_0x1dd284;return db[_0x607e('0xac')][_0x607e('0x2e')]({'where':{'membername':_0xd41885['name']},'individualHooks':!![]});}})[_0x607e('0x29')](function(){return db[_0x607e('0xf6')][_0x607e('0x4e')]({'where':{'membername':_0xd41885['name'],'exitAt':null}});})['then'](function(_0x244207){var _0x133087=[];_0x244207[_0x607e('0xf7')](function(_0x42b090){_0x133087[_0x607e('0x4d')](_0x42b090[_0x607e('0x28')]({'exitAt':moment()[_0x607e('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x607e('0x8f')](_0x133087);})['then'](function(){return _0xd41885['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x607e('0x29')](respondWithResult(_0x14f010,null))[_0x607e('0x1e')](handleError(_0x14f010,null));};exports[_0x607e('0x100')]=function(_0x10232b,_0x50b73c){var _0x3702f2;return db[_0x607e('0xac')][_0x607e('0x28')]({'paused':0x1},{'where':{'UserId':_0x10232b[_0x607e('0x65')]['id']},'individualHooks':!![]})[_0x607e('0x29')](function(){return db['User'][_0x607e('0x3b')]({'where':{'id':_0x10232b[_0x607e('0x65')]['id'],'role':_0x607e('0x2b')},'attributes':['id',_0x607e('0x3e'),_0x607e('0x2a'),_0x607e('0x6a'),'interface','online']});})[_0x607e('0x29')](handleEntityNotFound(_0x50b73c,null))[_0x607e('0x29')](function(_0x2f34de){if(_0x2f34de){_0x3702f2=_0x2f34de;return respondWithRpcPromise(_0x607e('0x101'),_0x607e('0x100'),{'id':_0x3702f2['id'],'name':_0x3702f2[_0x607e('0x3e')],'pause':!![]});}})[_0x607e('0x29')](function(){if(_0x3702f2){return db['MemberReport'][_0x607e('0x4e')]({'where':{'membername':_0x3702f2['name'],'type':_0x607e('0xfc'),'exitAt':null}});}})[_0x607e('0x29')](function(_0x481843){if(_0x481843[_0x607e('0x51')]){var _0x300877=moment()[_0x607e('0xab')](_0x607e('0xf8'));for(var _0x20259b=0x0,_0x42101e=_0x481843[_0x607e('0x51')];_0x20259b<_0x42101e;_0x20259b++){_0x481843[_0x20259b]['updateAttributes']({'exitAt':_0x300877});}}})[_0x607e('0x29')](function(){var _0x50ce54=[];var _0x412eda=utils[_0x607e('0xf9')]();_0x412eda[_0x607e('0xf7')](function(_0x383f1c){_0x50ce54[_0x607e('0x4d')]({'channel':_0x383f1c,'membername':_0x3702f2[_0x607e('0x3e')],'interface':_['isNil'](_0x3702f2[_0x607e('0xa3')])?util[_0x607e('0xab')]('SIP/%s',_0x3702f2['name']):_0x3702f2[_0x607e('0xa3')],'type':_0x607e('0xfc'),'enterAt':moment()[_0x607e('0xab')](_0x607e('0xf8')),'data1':_0x10232b[_0x607e('0x64')]['type']||_0x607e('0x102'),'role':_0x3702f2[_0x607e('0x2a')],'internal':_0x3702f2['internal']});});return db['MemberReport']['bulkCreate'](_0x50ce54,{'individualHooks':!![]});})[_0x607e('0x29')](function(){return _0x3702f2[_0x607e('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x10232b[_0x607e('0x64')][_0x607e('0x42')]||_0x607e('0x102'),'lastPauseAt':moment()[_0x607e('0xab')](_0x607e('0xf8'))});})[_0x607e('0x29')](respondWithResult(_0x50b73c,null))['catch'](handleError(_0x50b73c,null));};exports[_0x607e('0x103')]=function(_0x280890,_0x4799dc){if(_0x280890[_0x607e('0x64')][_0x607e('0xa1')]&&!utils['isValidChannel'](_0x280890[_0x607e('0x64')]['channel'])){throw new APIBadRequestError(util[_0x607e('0xab')](_0x607e('0x104'),_0x280890[_0x607e('0x64')][_0x607e('0xa1')]));}return db['User'][_0x607e('0x3b')]({'where':{'id':_0x280890[_0x607e('0x65')]['id']},'attributes':['id',_0x607e('0x3e'),_0x607e('0x2a'),_0x607e('0x6a'),_0x607e('0xa3'),_0x607e('0xaa'),_0x607e('0xa2'),_0x607e('0x105'),_0x607e('0x106'),_0x607e('0x107'),'openchannelPause','smsPause',_0x607e('0x108'),_0x607e('0x109'),_0x607e('0x10a')]})[_0x607e('0x29')](function(_0x5b6066){if(!_0x5b6066){throw new APINotFoundError(util[_0x607e('0xab')](_0x607e('0x10b'),_0x280890[_0x607e('0x65')]['id']));}return _0x5b6066[_0x607e('0x103')](_0x280890[_0x607e('0x64')][_0x607e('0xa1')]);})[_0x607e('0x29')](respondWithResult(_0x4799dc,null))[_0x607e('0x1e')](APIHandleError(_0x4799dc));};exports[_0x607e('0x10c')]=function(_0x266a1a,_0xc71578){var _0x206426={};var _0x3629a4={};var _0x2eaa03;var _0x5be0bf;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x266a1a['params']['id']}})[_0x607e('0x29')](handleEntityNotFound(_0xc71578,null))[_0x607e('0x29')](function(_0x4fb8cc){if(_0x4fb8cc){_0x2eaa03=_0x4fb8cc;_0x3629a4[_0x607e('0x58')]=_[_0x607e('0x5a')](db[_0x607e('0x10d')][_0x607e('0x5b')]);_0x3629a4['query']=_[_0x607e('0x5a')](_0x266a1a[_0x607e('0x48')]);_0x3629a4[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x3629a4[_0x607e('0x58')],_0x3629a4[_0x607e('0x48')]);_0x206426[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x3629a4['model'],qs[_0x607e('0x5d')](_0x266a1a['query'][_0x607e('0x5d')]));_0x206426['attributes']=_0x206426[_0x607e('0x4c')]['length']?_0x206426[_0x607e('0x4c')]:_0x3629a4[_0x607e('0x58')];_0x206426[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x266a1a[_0x607e('0x48')][_0x607e('0xc8')]);_0x206426[_0x607e('0x47')]=qs['filters'](_[_0x607e('0xc9')](_0x266a1a[_0x607e('0x48')],_0x3629a4['filters']));if(_0x266a1a[_0x607e('0x48')][_0x607e('0x36')]){_0x206426[_0x607e('0x47')]=_[_0x607e('0x60')](_0x206426[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x206426[_0x607e('0x4c')],function(_0x2a764c){var _0x5d05ad={};_0x5d05ad[_0x2a764c]={'$like':'%'+_0x266a1a['query']['filter']+'%'};return _0x5d05ad;})});}_0x206426=_['merge']({},_0x206426,_0x266a1a[_0x607e('0x61')]);return _0x2eaa03['getTeams'](_0x206426);}})[_0x607e('0x29')](function(_0x55b0f6){if(_0x55b0f6){_0x5be0bf=_0x55b0f6['length'];if(!_0x266a1a[_0x607e('0x48')][_0x607e('0xca')](_0x607e('0xd3'))){_0x206426[_0x607e('0x24')]=qs['limit'](_0x266a1a['query']['limit']);_0x206426[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x266a1a[_0x607e('0x48')][_0x607e('0x26')]);}return _0x2eaa03[_0x607e('0x10c')](_0x206426);}})[_0x607e('0x29')](function(_0x4caa3d){if(_0x4caa3d){return _0x4caa3d?{'count':_0x5be0bf,'rows':_0x4caa3d}:null;}})[_0x607e('0x29')](respondWithResult(_0xc71578,null))[_0x607e('0x1e')](handleError(_0xc71578,null));};exports[_0x607e('0x10e')]=function(_0x4079c8,_0x44b842){var _0x5d4b4a=_0x4079c8[_0x607e('0x65')]['id'];var _0x36fa46=_0x4079c8[_0x607e('0x64')]?_0x4079c8['body']['ids']:null;var _0x143419=[];return Promise[_0x607e('0xfe')]()['then'](function(){if(!_0x36fa46)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x607e('0x29')](function(){return db[_0x607e('0x40')]['findOne']({'where':{'id':_0x5d4b4a}});})['then'](function(_0x281df8){if(!_0x281df8)throw new APINotFoundError(util['format'](_0x607e('0x10b'),_0x4079c8[_0x607e('0x65')]['id']));return db[_0x607e('0x71')][_0x607e('0x10f')](function(_0x14568f){return _0x281df8[_0x607e('0x10e')](_0x36fa46,{'transaction':_0x14568f})['then'](function(){return db[_0x607e('0x10d')][_0x607e('0x4e')]({'where':{'id':{'$in':_0x36fa46}}});})[_0x607e('0x29')](function(_0x10a4c9){var _0x11c8c3=_[_0x607e('0x38')](_0x10a4c9,function(_0x24c813){return _0x24c813[_0x607e('0x110')]();});return Promise[_0x607e('0x8f')](_0x11c8c3);})[_0x607e('0x29')](function(_0x298307){_0x143419=_['flattenDeep'](_0x298307);var _0x17ab69=_[_0x607e('0x38')](_0x143419,function(_0x11c5e3){return _0x11c5e3[_0x607e('0x111')](_0x281df8['id'],{'transaction':_0x14568f});});return Promise[_0x607e('0x8f')](_0x17ab69);})[_0x607e('0x29')](function(){if(!_0x281df8[_0x607e('0xaa')])return;var _0x4af318=_['filter'](_0x143419,function(_0x594ef0){return _0x594ef0[_0x607e('0x112')](_0x607e('0xa1'))===_0x607e('0x113');});var _0x3f1ee2=_['map'](_0x4af318,function(_0x1fb11f){return db['UserVoiceQueueRt'][_0x607e('0xf5')]({'membername':_0x281df8[_0x607e('0x3e')],'UserId':_0x281df8['id'],'queue_name':_0x1fb11f[_0x607e('0x3e')],'VoiceQueueId':_0x1fb11f['id'],'interface':_[_0x607e('0x6f')](_0x281df8['interface'])?util['format'](_0x607e('0xe9'),_0x281df8[_0x607e('0x3e')]):_0x281df8[_0x607e('0xa3')],'paused':_0x281df8[_0x607e('0xa2')]||![],'penalty':_0x281df8[_0x607e('0x114')]},{'transaction':_0x14568f});});return Promise['all'](_0x3f1ee2);})[_0x607e('0x29')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x36fa46}}});})[_0x607e('0x29')](function(_0x5867a8){var _0x34be4f=_[_0x607e('0x38')](_0x5867a8,function(_0x217c07){return db[_0x607e('0x115')][_0x607e('0x84')]({'UserId':_0x281df8['id'],'VoicePrefixId':_0x217c07[_0x607e('0x116')]},{'transaction':_0x14568f});});return Promise['all'](_0x34be4f);});});})[_0x607e('0x29')](function(){for(var _0x392bc9=0x0;_0x392bc9<_0x143419[_0x607e('0x51')];_0x392bc9++){var _0xa9047d=_0x143419[_0x392bc9][_0x607e('0x112')]('channel');var _0x3dca23=_0xa9047d+_0x607e('0xb0');socket[_0x607e('0x2c')](_0x607e('0x32')+_0xa9047d+_0x607e('0x117'),{'UserId':_0x5d4b4a,['queueField']:_0x143419[_0x392bc9]['id']});}})[_0x607e('0x29')](respondWithStatusCode(_0x44b842,null))[_0x607e('0x1e')](APIHandleError(_0x44b842));};exports[_0x607e('0x118')]=function(_0x827c68,_0x1fd17f){var _0x3465da=_0x827c68[_0x607e('0x65')]['id'];var _0x45c480=null;if(_0x827c68[_0x607e('0x48')][_0x607e('0x68')]){_0x45c480=_[_0x607e('0xaf')](_0x827c68[_0x607e('0x48')][_0x607e('0x68')])?_0x827c68[_0x607e('0x48')][_0x607e('0x68')]:[_0x827c68['query']['ids']];}var _0x16cd8e=[];return Promise[_0x607e('0xfe')]()[_0x607e('0x29')](function(){if(!_0x45c480)throw new APIBadRequestError(_0x607e('0x119'));})[_0x607e('0x29')](function(){return db['User'][_0x607e('0x9a')]({'where':{'id':_0x3465da}});})['then'](function(_0x331ad5){if(!_0x331ad5)throw new APINotFoundError(util[_0x607e('0xab')](_0x607e('0x10b'),_0x827c68['params']['id']));return db[_0x607e('0x71')]['transaction'](function(_0x4bb37c){return _0x331ad5[_0x607e('0x118')](_0x45c480,{'transaction':_0x4bb37c})[_0x607e('0x29')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x45c480}}});})['then'](function(_0x332f67){var _0x6e2041=_[_0x607e('0x38')](_0x332f67,function(_0x46d920){return _0x46d920[_0x607e('0x110')]();});return Promise[_0x607e('0x8f')](_0x6e2041);})[_0x607e('0x29')](function(_0x1c9fda){_0x16cd8e=_[_0x607e('0x11a')](_0x1c9fda);var _0x3095fd=_['map'](_0x16cd8e,function(_0x2ad980){return _0x2ad980[_0x607e('0x11b')](_0x331ad5['id'],{'transaction':_0x4bb37c});});return Promise[_0x607e('0x8f')](_0x3095fd);})['then'](function(){if(!_0x331ad5[_0x607e('0xaa')])return;var _0x55a4b1=_[_0x607e('0x36')](_0x16cd8e,function(_0x183aad){return _0x183aad[_0x607e('0x112')](_0x607e('0xa1'))===_0x607e('0x113');});var _0x1b2f5a=_['map'](_0x55a4b1,function(_0x150fc2){return db[_0x607e('0xac')][_0x607e('0x2e')]({'where':{'VoiceQueueId':_0x150fc2['id'],'UserId':_0x331ad5['id']},'transaction':_0x4bb37c});});return Promise[_0x607e('0x8f')](_0x1b2f5a);})['then'](function(){return db[_0x607e('0x11c')][_0x607e('0x4e')]({'where':{'teamId':{'$in':_0x45c480}}});})[_0x607e('0x29')](function(_0x478a6d){var _0x4d3ce3=_[_0x607e('0x38')](_0x478a6d,function(_0x2734f6){return db[_0x607e('0x115')][_0x607e('0x2e')]({'where':{'UserId':_0x331ad5['id'],'VoicePrefixId':_0x2734f6[_0x607e('0x116')]}},{'transaction':_0x4bb37c});});return Promise['all'](_0x4d3ce3);});});})[_0x607e('0x29')](function(){for(var _0x2eb978=0x0;_0x2eb978<_0x16cd8e[_0x607e('0x51')];_0x2eb978++){var _0x5d074c=_0x16cd8e[_0x2eb978][_0x607e('0x112')](_0x607e('0xa1'));var _0xeef07f=_0x5d074c+_0x607e('0xb0');socket[_0x607e('0x2c')](_0x607e('0x32')+_0x5d074c+'Queue:remove',{'UserId':_0x3465da,['queueField']:_0x16cd8e[_0x2eb978]['id']});}})[_0x607e('0x29')](respondWithStatusCode(_0x1fd17f,null))[_0x607e('0x1e')](APIHandleError(_0x1fd17f));};exports[_0x607e('0x11d')]=function(_0x5a45e4,_0x353365){var _0x1618d1={};var _0x45eeed={};var _0x48101d;var _0x3d3a89;return db[_0x607e('0x40')][_0x607e('0x9a')]({'where':{'id':_0x5a45e4[_0x607e('0x65')]['id']}})['then'](handleEntityNotFound(_0x353365,null))['then'](function(_0x3c6a90){if(_0x3c6a90){_0x48101d=_0x3c6a90;_0x45eeed[_0x607e('0x58')]=_[_0x607e('0x5a')](db['CmList']['rawAttributes']);_0x45eeed[_0x607e('0x48')]=_['keys'](_0x5a45e4['query']);_0x45eeed[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x45eeed[_0x607e('0x58')],_0x45eeed[_0x607e('0x48')]);_0x1618d1[_0x607e('0x4c')]=_['intersection'](_0x45eeed[_0x607e('0x58')],qs['fields'](_0x5a45e4[_0x607e('0x48')][_0x607e('0x5d')]));_0x1618d1['attributes']=_0x1618d1['attributes'][_0x607e('0x51')]?_0x1618d1[_0x607e('0x4c')]:_0x45eeed[_0x607e('0x58')];_0x1618d1[_0x607e('0xc7')]=qs[_0x607e('0xc8')](_0x5a45e4[_0x607e('0x48')][_0x607e('0xc8')]);_0x1618d1[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x5a45e4[_0x607e('0x48')],_0x45eeed[_0x607e('0xc6')]));if(_0x5a45e4[_0x607e('0x48')][_0x607e('0x36')]){_0x1618d1[_0x607e('0x47')]=_[_0x607e('0x60')](_0x1618d1[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x1618d1[_0x607e('0x4c')],function(_0x342040){var _0x4e1934={};_0x4e1934[_0x342040]={'$like':'%'+_0x5a45e4[_0x607e('0x48')]['filter']+'%'};return _0x4e1934;})});}_0x1618d1=_[_0x607e('0x60')]({},_0x1618d1,_0x5a45e4[_0x607e('0x61')]);return _0x48101d['getLists'](_0x1618d1);}})[_0x607e('0x29')](function(_0xd08461){if(_0xd08461){_0x3d3a89=_0xd08461[_0x607e('0x51')];if(!_0x5a45e4[_0x607e('0x48')][_0x607e('0xca')](_0x607e('0xd3'))){_0x1618d1[_0x607e('0x24')]=qs[_0x607e('0x24')](_0x5a45e4[_0x607e('0x48')][_0x607e('0x24')]);_0x1618d1[_0x607e('0x26')]=qs[_0x607e('0x26')](_0x5a45e4['query'][_0x607e('0x26')]);}return _0x48101d[_0x607e('0x11d')](_0x1618d1);}})['then'](function(_0x28c923){if(_0x28c923){return _0x28c923?{'count':_0x3d3a89,'rows':_0x28c923}:null;}})[_0x607e('0x29')](respondWithResult(_0x353365,null))[_0x607e('0x1e')](handleError(_0x353365,null));};exports[_0x607e('0x11e')]=function(_0x5948ff,_0x1fab4f){var _0x4d79e0={};var _0x52b0a3={};var _0x4dd67c;return db['User'][_0x607e('0x9a')]({'where':{'id':_0x5948ff[_0x607e('0x65')]['id']}})[_0x607e('0x29')](handleEntityNotFound(_0x1fab4f,null))['then'](function(_0x38bc54){if(_0x38bc54){_0x4dd67c=_0x38bc54;_0x52b0a3['model']=_[_0x607e('0x5a')](db['User'][_0x607e('0x5b')]);_0x52b0a3[_0x607e('0x48')]=_[_0x607e('0x5a')](_0x5948ff[_0x607e('0x48')]);_0x52b0a3[_0x607e('0xc6')]=_[_0x607e('0x5c')](_0x52b0a3[_0x607e('0x58')],_0x52b0a3[_0x607e('0x48')]);_0x4d79e0[_0x607e('0x4c')]=_[_0x607e('0x5c')](_0x52b0a3[_0x607e('0x58')],qs[_0x607e('0x5d')](_0x5948ff['query'][_0x607e('0x5d')]));_0x4d79e0[_0x607e('0x4c')]=_0x4d79e0[_0x607e('0x4c')]['length']?_0x4d79e0[_0x607e('0x4c')]:_0x52b0a3['model'];_0x4d79e0['order']=qs[_0x607e('0xc8')](_0x5948ff['query'][_0x607e('0xc8')]);_0x4d79e0[_0x607e('0x47')]=qs[_0x607e('0xc6')](_[_0x607e('0xc9')](_0x5948ff[_0x607e('0x48')],_0x52b0a3[_0x607e('0xc6')]));if(_0x5948ff[_0x607e('0x48')][_0x607e('0x36')]){_0x4d79e0[_0x607e('0x47')]=_[_0x607e('0x60')](_0x4d79e0[_0x607e('0x47')],{'$or':_[_0x607e('0x38')](_0x4d79e0['attributes'],function(_0x551054){var _0x3c989b={};_0x3c989b[_0x551054]={'$like':'%'+_0x5948ff[_0x607e('0x48')][_0x607e('0x36')]+'%'};return _0x3c989b;})});}_0x4d79e0[_0x607e('0x58')]=db[_0x607e('0x40')];_0x4d79e0['as']='Agents';_0x4d79e0=_[_0x607e('0x60')]({},_0x4d79e0,_0x5948ff[_0x607e('0x61')]);return _0x4dd67c['getVoiceQueues']({'include':[_0x4d79e0]});}})['then'](function(_0x4cf512){if(_0x4cf512){var _0x57e442={},_0xf9cb02=[];for(var _0x264979=0x0;_0x264979<_0x4cf512[_0x607e('0x51')];_0x264979+=0x1){for(var _0x364820=0x0,_0x5f54d7;_0x364820<_0x4cf512[_0x264979][_0x607e('0x33')]['length'];_0x364820+=0x1){_0x5f54d7=_0x4cf512[_0x264979][_0x607e('0x33')][_0x364820][_0x607e('0x2f')]({'plain':!![]});_0x57e442[_0x5f54d7['id']]=_0x5f54d7;}}_0x57e442=_[_0x607e('0x11f')](_0x57e442);for(var _0x2f1d43=qs[_0x607e('0x26')](_0x5948ff[_0x607e('0x48')][_0x607e('0x26')]);_0x2f1d43<_0x57e442['length']&&_0xf9cb02[_0x607e('0x51')]=_0x1127b8){_0x49ae64=_0x1127b8;_0x3f9d6d=0xc8;}else{_0x3f9d6d=0xce;}_0x2dfcc8['status'](_0x3f9d6d);return _0x2dfcc8['set'](_0x747a('0x29'),_0x2c6d7c+'-'+_0x49ae64+'/'+_0x1127b8)['json'](_0x566b61);}return null;};}function saveUpdates(_0x39ff95){return function(_0x5d001b){if(_0x5d001b){return _0x5d001b['update'](_0x39ff95)[_0x747a('0x16')](function(_0x4b726d){if(_0x4b726d[_0x747a('0x2a')]===_0x747a('0x2b')){socket[_0x747a('0x2c')](_0x747a('0x2d')+_0x4b726d['id'],_0x4b726d);}return _0x4b726d;});}return null;};}function removeEntity(_0xd9765c){return function(_0x326d4b){if(_0x326d4b){return _0x326d4b['destroy']()[_0x747a('0x16')](function(){var _0x3c5526=_0x326d4b[_0x747a('0x2e')]({'plain':!![]});if(_0x3c5526[_0x747a('0x2a')]===_0x747a('0x2f'))return;var _0xca4c75=[{'name':'Users','value':_0x747a('0x30'),'ignore':!![]},{'name':_0x747a('0x31'),'value':_0x747a('0x2b'),'ignore':![]},{'name':_0x747a('0x32'),'value':_0x747a('0x33'),'ignore':![]}];var _0x4090ca=_(_0xca4c75)[_0x747a('0x34')](_0x747a('0x35'))[_0x747a('0x36')](_0x747a('0x37'))[_0x747a('0x37')]();if(_[_0x747a('0x38')](_0x4090ca,_0x3c5526[_0x747a('0x2a')])){return;}var _0x1c2a43=_['find'](_0xca4c75,['value',_0x3c5526[_0x747a('0x2a')]])[_0x747a('0x39')];return db[_0x747a('0x3a')]['destroy']({'where':{'type':_0x1c2a43,'resourceId':_0x3c5526['id']}})['then'](function(){return _0x326d4b;});})['then'](function(){_0xd9765c[_0x747a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bc98){return function(_0x575d61){if(!_0x575d61){_0x47bc98[_0x747a('0x21')](0x194);}return _0x575d61;};}function handleError(_0x597eca,_0xa132e5){_0xa132e5=_0xa132e5||0x1f4;return function(_0xfea340){logger[_0x747a('0x1c')](_0xfea340['stack']);if(_0xfea340[_0x747a('0x39')]){delete _0xfea340[_0x747a('0x39')];}_0x597eca[_0x747a('0x22')](_0xa132e5)[_0x747a('0x3b')](_0xfea340);};}exports[_0x747a('0x3c')]=function(_0x49383a,_0x559c2b){var _0xb0510b={},_0x18c05d={'count':0x0,'rows':[]};var _0x591910=_(db[_0x747a('0x3d')][_0x747a('0x3e')])[_0x747a('0x36')](function(_0x4753e4){return{'name':_0x4753e4[_0x747a('0x3f')],'type':_0x4753e4[_0x747a('0x40')][_0x747a('0x41')]};})[_0x747a('0x34')](function(_0xc7e3d1){return!_[_0x747a('0x38')]([_0x747a('0x42'),_0x747a('0x43')],_0xc7e3d1[_0x747a('0x39')]);})['value']();_0xb0510b=qs[_0x747a('0x44')](_0x591910,_0x49383a);var _0xfcfb8e={'where':_0xb0510b['where']};return db[_0x747a('0x3d')]['count'](_0xfcfb8e)['then'](function(_0x9f331f){_0x18c05d[_0x747a('0x28')]=_0x9f331f;if(_0x49383a[_0x747a('0x45')]['includeAll']){_0xb0510b['include']=[{'all':!![]}];}if(_0x49383a[_0x747a('0x45')][_0x747a('0x46')]===_0x747a('0x47')){_0xb0510b['include']=[{'model':db[_0x747a('0x48')],'as':_0x747a('0x46')}];}if(!_['includes'](_0xb0510b[_0x747a('0x49')],'id')){_0xb0510b[_0x747a('0x49')]['push']('id');}return db[_0x747a('0x3d')][_0x747a('0x4a')](_0xb0510b);})[_0x747a('0x16')](function(_0xcbfd85){_0x18c05d[_0x747a('0x4b')]=_0xcbfd85;if(_0x49383a[_0x747a('0x45')][_0x747a('0x4c')]===_0x747a('0x47')){var _0x4cc97a=[];for(var _0xf0a458=0x0;_0xf0a458<_0x18c05d[_0x747a('0x4b')][_0x747a('0x4d')];_0xf0a458++){_0x4cc97a['push'](get_open_tabs(_0x747a('0x4e'),_0x18c05d[_0x747a('0x4b')][_0xf0a458]['dataValues']));_0x4cc97a[_0x747a('0x4f')](get_open_tabs(_0x747a('0x50'),_0x18c05d[_0x747a('0x4b')][_0xf0a458]['dataValues']));_0x4cc97a[_0x747a('0x4f')](get_open_tabs(_0x747a('0x51'),_0x18c05d[_0x747a('0x4b')][_0xf0a458][_0x747a('0x52')]));_0x4cc97a[_0x747a('0x4f')](get_open_tabs('mail',_0x18c05d['rows'][_0xf0a458][_0x747a('0x52')]));_0x4cc97a[_0x747a('0x4f')](get_open_tabs('openchannel',_0x18c05d[_0x747a('0x4b')][_0xf0a458][_0x747a('0x52')]));_0x4cc97a['push'](get_open_tabs(_0x747a('0x53'),_0x18c05d[_0x747a('0x4b')][_0xf0a458]['dataValues']));}return Promise[_0x747a('0x54')](_0x4cc97a)['then'](function(){return _0x18c05d;});}else{return _0x18c05d;}})[_0x747a('0x16')](respondWithFilteredResult(_0x559c2b,_0xb0510b))[_0x747a('0x55')](handleError(_0x559c2b,null));};exports[_0x747a('0x56')]=function(_0x2679a0,_0x52e1da){var _0x1b74b9={'raw':![],'where':{'id':_0x2679a0['params']['id']}},_0x282de3={};_0x282de3[_0x747a('0x57')]=_[_0x747a('0x58')](_['keys'](db['User'][_0x747a('0x3e')]),[_0x747a('0x42'),_0x747a('0x43')]);_0x282de3[_0x747a('0x45')]=_[_0x747a('0x59')](_0x2679a0[_0x747a('0x45')]);_0x282de3['filters']=_[_0x747a('0x5a')](_0x282de3['model'],_0x282de3[_0x747a('0x45')]);_0x1b74b9[_0x747a('0x49')]=_['intersection'](_0x282de3['model'],qs[_0x747a('0x5b')](_0x2679a0[_0x747a('0x45')][_0x747a('0x5b')]));_0x1b74b9[_0x747a('0x49')]=_0x1b74b9[_0x747a('0x49')][_0x747a('0x4d')]?_0x1b74b9['attributes']:_0x282de3[_0x747a('0x57')];if(_0x2679a0['query'][_0x747a('0x5c')]){_0x1b74b9[_0x747a('0x5d')]=[{'all':!![]}];}if(_0x2679a0[_0x747a('0x45')][_0x747a('0x46')]===_0x747a('0x47')){_0x1b74b9[_0x747a('0x5d')]=[{'model':db[_0x747a('0x48')],'as':_0x747a('0x46')}];}_0x1b74b9=_[_0x747a('0x5e')]({},_0x1b74b9,_0x2679a0[_0x747a('0x5f')]);if(!_[_0x747a('0x38')](_0x1b74b9[_0x747a('0x49')],'id')){_0x1b74b9[_0x747a('0x49')][_0x747a('0x4f')]('id');}return db['User'][_0x747a('0x60')](_0x1b74b9)[_0x747a('0x16')](handleEntityNotFound(_0x52e1da,null))[_0x747a('0x16')](function(_0x3cd42e){var _0x26c5f1=[];values=_0x3cd42e;if(_0x2679a0['query'][_0x747a('0x4c')]==='true'){_0x26c5f1[_0x747a('0x4f')](get_open_tabs(_0x747a('0x4e'),_0x3cd42e[_0x747a('0x52')]));_0x26c5f1['push'](get_open_tabs('sms',_0x3cd42e[_0x747a('0x52')]));_0x26c5f1[_0x747a('0x4f')](get_open_tabs(_0x747a('0x61'),_0x3cd42e['dataValues']));_0x26c5f1[_0x747a('0x4f')](get_open_tabs(_0x747a('0x53'),_0x3cd42e['dataValues']));_0x26c5f1[_0x747a('0x4f')](get_open_tabs('fax',_0x3cd42e[_0x747a('0x52')]));_0x26c5f1[_0x747a('0x4f')](get_open_tabs(_0x747a('0x62'),_0x3cd42e[_0x747a('0x52')]));return Promise[_0x747a('0x54')](_0x26c5f1);}else{return values;}})[_0x747a('0x16')](function(){return values;})[_0x747a('0x16')](respondWithResult(_0x52e1da,null))[_0x747a('0x55')](handleError(_0x52e1da,null));};exports[_0x747a('0x63')]=function(_0x23858f,_0x35b64f){if(_0x23858f[_0x747a('0x64')]['id']){delete _0x23858f[_0x747a('0x64')]['id'];}delete _0x23858f[_0x747a('0x64')]['role'];return db[_0x747a('0x3d')][_0x747a('0x60')]({'where':{'id':_0x23858f[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x35b64f,null))['then'](saveUpdates(_0x23858f['body'],null))[_0x747a('0x16')](respondWithResult(_0x35b64f,null))[_0x747a('0x55')](handleError(_0x35b64f,null));};exports[_0x747a('0x66')]=function(_0x53ee0f,_0x287aa1){return db[_0x747a('0x3d')]['describe']()[_0x747a('0x16')](respondWithResult(_0x287aa1,null))['catch'](handleError(_0x287aa1,null));};exports['addContacts']=function(_0x55039e,_0x463868){return db[_0x747a('0x3d')]['find']({'where':{'id':_0x55039e[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x463868,null))['then'](function(_0x137d81){if(_0x137d81){return _0x137d81[_0x747a('0x67')](_0x55039e['body'][_0x747a('0x68')],_[_0x747a('0x69')](_0x55039e[_0x747a('0x64')],['ids','id'])||{});}})[_0x747a('0x16')](respondWithResult(_0x463868,null))[_0x747a('0x55')](handleError(_0x463868,null));};function validateUser(_0x3bacd4){return new Promise(function(_0x116b31,_0x5dc9e8){if(_0x3bacd4[_0x747a('0x6a')])return _0x116b31(_0x3bacd4);return db[_0x747a('0x6b')][_0x747a('0x6c')](0x1)[_0x747a('0x16')](function(_0x186e0c){if(_0x186e0c[_0x747a('0x6d')])authService[_0x747a('0x6e')](_0x3bacd4[_0x747a('0x42')]);db[_0x747a('0x3d')]['max'](_0x747a('0x6a'))['then'](function(_0x205d55){if(_[_0x747a('0x6f')](_0x205d55)){_0x3bacd4[_0x747a('0x6a')]=_0x186e0c[_0x747a('0x70')]||0x1;return;}if(_['isNil'](_0x186e0c['min_internal'])||_0x186e0c[_0x747a('0x70')]===_0x205d55){_0x3bacd4[_0x747a('0x6a')]=_0x205d55+0x1;return;}if(_0x186e0c[_0x747a('0x70')]>_0x205d55){_0x3bacd4[_0x747a('0x6a')]=_0x186e0c[_0x747a('0x70')];return;}return db[_0x747a('0x71')][_0x747a('0x45')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x747a('0x71')]['QueryTypes'][_0x747a('0x72')]})['then'](function(_0x44f900){if(_0x44f900&&_0x44f900[_0x747a('0x4d')]){for(var _0x49c790=0x0,_0x29bc9b=_0x44f900[_0x747a('0x4d')];_0x49c790<_0x29bc9b&&_[_0x747a('0x6f')](_0x3bacd4[_0x747a('0x6a')]);_0x49c790++){if(_0x186e0c[_0x747a('0x70')]<=_0x44f900[_0x49c790][_0x747a('0x73')]){_0x3bacd4[_0x747a('0x6a')]=_0x44f900[_0x49c790]['from'];}else if(_0x186e0c['min_internal']>_0x44f900[_0x49c790]['from']&&_0x186e0c[_0x747a('0x70')]<=_0x44f900[_0x49c790]['to']){_0x3bacd4['internal']=_0x186e0c[_0x747a('0x70')];}}}if(_['isNil'](_0x3bacd4[_0x747a('0x6a')])){_0x3bacd4[_0x747a('0x6a')]=_0x205d55+0x1;}return _0x116b31(_0x3bacd4);});});})[_0x747a('0x55')](function(_0x51f1eb){_0x5dc9e8(_0x51f1eb);});});}function updateUser(_0x2205a1){return new Promise(function(_0x4bf337,_0x1b19c3){try{if(_0x2205a1[_0x747a('0x74')]){_0x2205a1[_0x747a('0x75')]=_0x2205a1['internal'];_0x2205a1[_0x747a('0x76')]={'mailbox':_0x2205a1[_0x747a('0x6a')],'password':_0x2205a1[_0x747a('0x42')],'fullname':_0x2205a1[_0x747a('0x77')],'email':_0x2205a1[_0x747a('0x78')]};}if(_0x2205a1[_0x747a('0x2a')]==='agent'){if(!_0x2205a1[_0x747a('0x79')])_0x2205a1[_0x747a('0x79')]=[_0x747a('0x7a'),_0x747a('0x7b'),_0x747a('0x7c'),_0x747a('0x7d'),'110',_0x747a('0x7e'),_0x747a('0x7f'),_0x747a('0x80'),_0x747a('0x81'),_0x747a('0x82'),_0x747a('0x83'),'100',_0x747a('0x84'),_0x747a('0x85'),'115'];}_0x4bf337(_0x2205a1);}catch(_0x50dad7){_0x1b19c3(_0x50dad7);}});}exports['create']=function(_0x12b843,_0x41f224){if(_0x12b843[_0x747a('0x30')][_0x747a('0x2a')]==='agent')throw new Error('Unauthorized');if(_0x12b843['body'][_0x747a('0x2a')]===_0x747a('0x30')&&_0x12b843[_0x747a('0x30')][_0x747a('0x2a')]!=='admin'){throw new Error(_0x747a('0x86'));}if(_0x12b843['body']['role']===_0x747a('0x2f')&&_0x12b843[_0x747a('0x30')]['role']!==_0x747a('0x2f')){throw new Error(_0x747a('0x87'));}return licenseUtil[_0x747a('0x88')]([_0x12b843[_0x747a('0x64')]])[_0x747a('0x16')](function(){return validateUser(_0x12b843[_0x747a('0x64')]);})[_0x747a('0x16')](function(_0x78d722){return updateUser(_0x78d722)[_0x747a('0x16')](function(_0xa97624){if(_0xa97624[_0x747a('0x2a')]===_0x747a('0x2f')){_0xa97624[_0x747a('0x89')]=_0x12b843[_0x747a('0x30')][_0x747a('0x89')];delete _0xa97624[_0x747a('0x8a')];}return _0xa97624;});})['then'](function(_0x1a8621){return db[_0x747a('0x3d')]['create'](_0x1a8621,{'include':[{'model':db['VoiceMail'],'as':_0x747a('0x76')}]});})['then'](function(_0x3c6220){if(_0x12b843[_0x747a('0x64')][_0x747a('0x2a')]===_0x747a('0x30'))return _0x3c6220;if(_0x12b843['user'][_0x747a('0x2a')]!==_0x747a('0x30'))return _0x3c6220;return db['UserProfileSection'][_0x747a('0x60')]({'where':{'name':_0x3c6220['role']==='agent'?'Agents':_0x747a('0x32'),'userProfileId':_0x12b843[_0x747a('0x30')][_0x747a('0x8a')]},'raw':!![]})[_0x747a('0x16')](function(_0x5c086b){if(!_0x5c086b||_0x5c086b[_0x747a('0x8b')]!=0x0)return _0x3c6220;return db[_0x747a('0x3a')]['create']({'name':_0x3c6220['name'],'resourceId':_0x3c6220['id'],'type':_0x5c086b['name'],'sectionId':_0x5c086b['id']},{})['then'](function(){return _0x3c6220;});})[_0x747a('0x55')](function(_0x17d557){logger[_0x747a('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17d557);throw _0x17d557;});})[_0x747a('0x16')](respondWithResult(_0x41f224,0xc9))[_0x747a('0x55')](handleError(_0x41f224,null));};exports['bulkCreate']=function(_0x43cd5f,_0x5f6de0){var _0x328f59=_0x43cd5f['body'];var _0xd32660=[];if(_0x43cd5f[_0x747a('0x30')]['role']===_0x747a('0x2b'))throw new Error(_0x747a('0x8c'));if(_[_0x747a('0x8d')](_0x328f59,['role','user'])&&_0x43cd5f[_0x747a('0x30')][_0x747a('0x2a')]!=='admin'){throw new Error(_0x747a('0x86'));}if(_['some'](_0x328f59,[_0x747a('0x2a'),_0x747a('0x2f')])&&_0x43cd5f[_0x747a('0x30')][_0x747a('0x2a')]!==_0x747a('0x2f')){throw new Error(_0x747a('0x8e'));}return licenseUtil[_0x747a('0x88')](_0x328f59)[_0x747a('0x16')](function(){return validateUser(_0x328f59[0x0]);})['then'](function(){for(var _0x549677=0x1;_0x549677<_0x328f59[_0x747a('0x4d')];_0x549677++){var _0x4013d9=_0x328f59[_0x549677-0x1][_0x747a('0x6a')];if(!_0x328f59[_0x549677][_0x747a('0x6a')])_0x328f59[_0x549677][_0x747a('0x6a')]=_0x4013d9+0x1;_0xd32660['push'](validateUser(_0x328f59[_0x549677]));}return Promise[_0x747a('0x54')](_0xd32660);})['then'](function(){_0xd32660=[];for(var _0x5cd384=0x0;_0x5cd384<_0x328f59[_0x747a('0x4d')];_0x5cd384++){_0xd32660['push'](updateUser(_0x328f59[_0x5cd384]));}return Promise[_0x747a('0x54')](_0xd32660);})[_0x747a('0x16')](function(){_0xd32660=_0x328f59[_0x747a('0x36')](function(_0xc6da91){return db[_0x747a('0x3d')][_0x747a('0x8f')](_0xc6da91,{'include':[{'model':db['VoiceMail'],'as':_0x747a('0x76')}]})['then'](function(_0x315279){_0xc6da91['id']=_0x315279['id'];return _0xc6da91;});});return Promise['all'](_0xd32660);})[_0x747a('0x16')](function(_0x5d2a58){if(_0x43cd5f[_0x747a('0x64')][_0x747a('0x2a')]===_0x747a('0x30'))return _0x5d2a58;if(_0x43cd5f[_0x747a('0x30')]['role']!=='user')return _0x5d2a58;var _0x15b76a=_[_0x747a('0x8d')](_0x5d2a58,function(_0x3c5252){return _0x3c5252[_0x747a('0x2a')]===_0x747a('0x2b')||_0x3c5252[_0x747a('0x2a')]==='telephone';});if(!_0x15b76a)return _0x5d2a58;return db[_0x747a('0x90')][_0x747a('0x4a')]({'where':{'name':{'$or':['Agents',_0x747a('0x32')]},'userProfileId':_0x43cd5f[_0x747a('0x30')][_0x747a('0x8a')]},'raw':!![]})['then'](function(_0x275827){if(_[_0x747a('0x91')](_0x275827)||!_[_0x747a('0x8d')](_0x275827,['autoAssociation',0x0]))return _0x5d2a58;_0xd32660=[];var _0x47c6af=_(_0x275827)[_0x747a('0x36')](function(_0x4aabe4){if(_0x4aabe4[_0x747a('0x8b')]===0x1)return;return _0x4aabe4[_0x747a('0x39')]==='Agents'?'agent':_0x747a('0x33');})[_0x747a('0x92')]()[_0x747a('0x37')]();for(var _0x48e3b6=0x0;_0x48e3b6<_0x5d2a58['length'];_0x48e3b6++){if(!_[_0x747a('0x38')](_0x47c6af,_0x5d2a58[_0x48e3b6][_0x747a('0x2a')]))return;var _0x1c9f63=_0x5d2a58[_0x48e3b6][_0x747a('0x2a')]===_0x747a('0x2b')?_0x747a('0x31'):'Telephones';_0xd32660[_0x747a('0x4f')](db[_0x747a('0x3a')]['create']({'name':_0x5d2a58[_0x48e3b6][_0x747a('0x39')],'resourceId':_0x5d2a58[_0x48e3b6]['id'],'type':_0x1c9f63,'sectionId':_[_0x747a('0x60')](_0x275827,[_0x747a('0x39'),_0x1c9f63])['id']},{}));}return Promise[_0x747a('0x54')](_0xd32660);});})[_0x747a('0x16')](respondWithResult(_0x5f6de0,0xc9))[_0x747a('0x55')](handleError(_0x5f6de0,null));};exports[_0x747a('0x93')]=function(_0x230cc3,_0x5c06e2){if(_0x230cc3[_0x747a('0x64')]['id']){delete _0x230cc3[_0x747a('0x64')]['id'];}return db[_0x747a('0x3d')]['find']({'where':{'id':_0x230cc3[_0x747a('0x65')]['id']}})[_0x747a('0x16')](function(_0x231572){if(!_0x231572)return null;if(_0x231572['id']===_0x230cc3[_0x747a('0x30')]['id']){if(!_0x230cc3[_0x747a('0x64')]['oldPassword']||!_0x230cc3['body'][_0x747a('0x94')]){throw new db['Sequelize'][(_0x747a('0x95'))](_0x747a('0x96'));}if(!_0x231572[_0x747a('0x97')](_0x230cc3[_0x747a('0x64')]['oldPassword'])){throw new db[(_0x747a('0x98'))][(_0x747a('0x95'))](_0x747a('0x99'));}if(_0x230cc3[_0x747a('0x64')][_0x747a('0x9a')]===_0x230cc3[_0x747a('0x64')][_0x747a('0x94')]){throw new db['Sequelize'][(_0x747a('0x95'))](_0x747a('0x9b'));}}else if(_0x230cc3[_0x747a('0x30')][_0x747a('0x2a')]===_0x747a('0x2f')){if(!_0x230cc3[_0x747a('0x64')][_0x747a('0x94')]){throw new db[(_0x747a('0x98'))][(_0x747a('0x95'))](_0x747a('0x9c'));}}else if(_0x230cc3[_0x747a('0x30')][_0x747a('0x2a')]===_0x747a('0x30')){if(!_0x230cc3[_0x747a('0x64')][_0x747a('0x94')]){throw new db[(_0x747a('0x98'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x231572[_0x747a('0x2a')]!==_0x747a('0x2b')){throw new db['Sequelize'][(_0x747a('0x95'))](_0x747a('0x8c'));}}else{throw new db[(_0x747a('0x98'))][(_0x747a('0x95'))](_0x747a('0x8c'));}return _0x231572;})[_0x747a('0x16')](handleEntityNotFound(_0x5c06e2,null))[_0x747a('0x16')](function(_0x3ed62f){return db[_0x747a('0x6b')][_0x747a('0x9d')]({'attributes':['id',_0x747a('0x6d'),_0x747a('0x9e'),'passwordHistoryLimit']})[_0x747a('0x16')](function(_0x1c261f){if(_0x1c261f[_0x747a('0x6d')])authService[_0x747a('0x6e')](_0x230cc3['body'][_0x747a('0x94')]);if(!_0x1c261f['enforcePasswordHistory']||!_0x3ed62f[_0x747a('0x9f')])return _0x3ed62f;authService[_0x747a('0xa0')](_0x230cc3[_0x747a('0x64')][_0x747a('0x94')],_0x3ed62f[_0x747a('0x9f')],_0x1c261f[_0x747a('0xa1')]);return _0x3ed62f;})[_0x747a('0x16')](saveUpdates({'password':_0x230cc3[_0x747a('0x64')][_0x747a('0x94')],'passwordResetAt':_0x230cc3[_0x747a('0x30')]['id']==_0x230cc3['params']['id']?moment():null,'previousPasswords':authService[_0x747a('0xa2')](_0x230cc3['body']['newPassword'],_0x3ed62f[_0x747a('0x9f')])},null));})[_0x747a('0x16')](respondWithResult(_0x5c06e2,null))[_0x747a('0x55')](handleError(_0x5c06e2,null));};exports[_0x747a('0xa3')]=function(_0x6b7555,_0x1475e4){var _0x327e45=_0x6b7555[_0x747a('0x64')][_0x747a('0xa4')];return db['User'][_0x747a('0x60')]({'where':{'id':_0x6b7555[_0x747a('0x65')]['id']},'attributes':['id','name',_0x747a('0x2a'),_0x747a('0xa5'),_0x747a('0xa6'),_0x747a('0xa7'),_0x747a('0xa8')]})[_0x747a('0x16')](handleEntityNotFound(_0x1475e4,null))[_0x747a('0x16')](function(_0x329bba){if(_0x329bba){if(!utils[_0x747a('0xa9')](_0x327e45)){throw new db[(_0x747a('0x98'))][(_0x747a('0x95'))](_0x747a('0xaa'));}return _0x329bba[_0x747a('0xab')+_[_0x747a('0xac')](_0x327e45['toLowerCase']())+_0x747a('0xad')](_0x6b7555[_0x747a('0x64')]['ids'],{'penalty':_0x6b7555[_0x747a('0x64')]['penalty']||0x0})[_0x747a('0xae')](function(_0x121879){for(var _0x42aae2=0x0;_0x42aae2<_0x6b7555[_0x747a('0x64')][_0x747a('0x68')][_0x747a('0x4d')];_0x42aae2+=0x1){var _0x50312c={'UserId':Number(_0x6b7555[_0x747a('0x65')]['id'])};_0x50312c[_[_0x747a('0xac')](_0x327e45[_0x747a('0xaf')]())+'QueueId']=Number(_0x6b7555['body'][_0x747a('0x68')][_0x42aae2]);socket[_0x747a('0x2c')](_0x747a('0x30')+_[_0x747a('0xac')](_0x327e45[_0x747a('0xaf')]())+_0x747a('0xb0'),_0x50312c);}return _0x121879;})[_0x747a('0x16')](function(){if(_0x327e45===_0x747a('0xb1')){return db['VoiceQueue'][_0x747a('0x4a')]({'where':{'id':_0x6b7555['body'][_0x747a('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x747a('0x16')](function(_0x44f33d){var _0x6bc40d=_0x329bba['get']({'plain':!![]});var _0x1ce763=[];if(_0x327e45===_0x747a('0xb1')&&_0x6bc40d[_0x747a('0x2a')]===_0x747a('0x2b')&&_0x6bc40d[_0x747a('0xa5')]){for(let _0x7c503c=0x0;_0x7c503c<_0x44f33d['length'];_0x7c503c+=0x1){_0x1ce763[_0x747a('0x4f')]({'membername':_0x6bc40d[_0x747a('0x39')],'UserId':_0x6bc40d['id'],'queue_name':_0x44f33d[_0x7c503c][_0x747a('0x39')],'VoiceQueueId':_0x44f33d[_0x7c503c]['id'],'interface':_[_0x747a('0x6f')](_0x6bc40d[_0x747a('0xa8')])?util[_0x747a('0xb2')](_0x747a('0xb3'),_0x6bc40d['name']):_0x6bc40d[_0x747a('0xa8')],'paused':_0x6bc40d['voicePause']||![],'penalty':_0x6b7555[_0x747a('0x64')][_0x747a('0xb4')]||0x0});}return Promise[_0x747a('0x54')](_0x1ce763['map'](function(_0x11fe08){return db[_0x747a('0xb5')][_0x747a('0xb6')](_0x11fe08);}));}return _0x329bba;});}})['then'](respondWithStatusCode(_0x1475e4,null))[_0x747a('0x55')](handleError(_0x1475e4,null));};exports['removeQueues']=function(_0x12c0c4,_0x430641){var _0x2c83b6,_0x2610a0;return db[_0x747a('0x3d')]['find']({'where':{'id':_0x12c0c4[_0x747a('0x65')]['id']},'attributes':['id',_0x747a('0x39'),'role']})['then'](handleEntityNotFound(_0x430641,null))[_0x747a('0x16')](function(_0x4c94a9){if(_0x4c94a9){_0x2c83b6=_0x4c94a9;if(!_0x12c0c4[_0x747a('0x45')][_0x747a('0xa4')]||!utils[_0x747a('0xa9')](_0x12c0c4[_0x747a('0x45')][_0x747a('0xa4')])){throw new db[(_0x747a('0x98'))]['ValidationError'](_0x747a('0xaa'));}return _0x4c94a9[_0x747a('0xb7')+_['capitalize'](_0x12c0c4[_0x747a('0x45')][_0x747a('0xa4')][_0x747a('0xaf')]())+_0x747a('0xad')](_0x12c0c4['query']['ids']);}})['then'](function(_0x1698ff){if(_[_0x747a('0xb8')](_0x12c0c4[_0x747a('0x45')][_0x747a('0x68')])){for(var _0x2cd32d=0x0;_0x2cd32d<_0x12c0c4[_0x747a('0x45')]['ids'][_0x747a('0x4d')];_0x2cd32d+=0x1){_0x2610a0={'UserId':Number(_0x12c0c4[_0x747a('0x65')]['id'])};_0x2610a0[_[_0x747a('0xac')](_0x12c0c4[_0x747a('0x45')][_0x747a('0xa4')]['toLowerCase']())+_0x747a('0xb9')]=Number(_0x12c0c4[_0x747a('0x45')][_0x747a('0x68')][_0x2cd32d]);socket[_0x747a('0x2c')](_0x747a('0x30')+_[_0x747a('0xac')](_0x12c0c4[_0x747a('0x45')][_0x747a('0xa4')][_0x747a('0xaf')]())+_0x747a('0xba'),_0x2610a0);}}else{_0x2610a0={'UserId':Number(_0x12c0c4[_0x747a('0x65')]['id'])};_0x2610a0[_[_0x747a('0xac')](_0x12c0c4[_0x747a('0x45')][_0x747a('0xa4')][_0x747a('0xaf')]())+_0x747a('0xb9')]=Number(_0x12c0c4[_0x747a('0x45')][_0x747a('0x68')]);socket[_0x747a('0x2c')](_0x747a('0x30')+_[_0x747a('0xac')](_0x12c0c4['query'][_0x747a('0xa4')]['toLowerCase']())+_0x747a('0xba'),_0x2610a0);}return _0x1698ff;})[_0x747a('0x16')](function(){if(_0x12c0c4[_0x747a('0x45')][_0x747a('0xa4')]==='voice'){return db[_0x747a('0xb5')][_0x747a('0xbb')]({'where':{'UserId':_0x12c0c4['params']['id'],'VoiceQueueId':_0x12c0c4[_0x747a('0x45')]['ids']},'individualHooks':!![]})[_0x747a('0x16')](function(){return _0x2c83b6;});}return _0x2c83b6;})[_0x747a('0x16')](respondWithStatusCode(_0x430641,null))[_0x747a('0x55')](handleError(_0x430641,null));};exports[_0x747a('0xbc')]=function(_0x1210d5,_0x4a526a){_0x1210d5[_0x747a('0x64')][_0x747a('0xbd')]=_0x1210d5[_0x747a('0xbe')][_0x747a('0xbf')];return db[_0x747a('0x3d')][_0x747a('0x60')]({'where':{'id':_0x1210d5[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x4a526a,null))['then'](saveUpdates(_0x1210d5['body'],null))['then'](respondWithResult(_0x4a526a,null))['catch'](handleError(_0x4a526a,null));};exports['getAvatar']=function(_0xa8ee87,_0x216c17){var _0x25ebf2=path['join'](config[_0x747a('0xc0')],_0x747a('0xc1'));return db[_0x747a('0x3d')][_0x747a('0x60')]({'where':{'id':_0xa8ee87['params']['id']},'attributes':['id',_0x747a('0xbd')],'raw':!![]})['then'](handleEntityNotFound(_0x216c17,null))['then'](function(_0x4bd2d8){if(_0x4bd2d8){if(_['isNil'](_0x4bd2d8['userpic'])){return _0x216c17[_0x747a('0xc2')](_0x25ebf2);}else{if(!fs[_0x747a('0xc3')](path[_0x747a('0xc4')](config[_0x747a('0xc0')],_0x747a('0xc5'),_0x4bd2d8[_0x747a('0xbd')]))){return _0x216c17[_0x747a('0xc2')](_0x25ebf2);}return _0x216c17[_0x747a('0xc2')](path['join'](config[_0x747a('0xc0')],'server/files/images/',_0x4bd2d8['userpic']));}}})[_0x747a('0x55')](handleError(_0x216c17,null));};exports[_0x747a('0xc6')]=function(_0x52027d,_0x20e3fc){return db[_0x747a('0x3d')][_0x747a('0x60')]({'where':{'id':_0x52027d[_0x747a('0x65')]['id']},'attributes':['id']})[_0x747a('0x16')](handleEntityNotFound(_0x20e3fc,null))['then'](function(_0x462c2b){var _0x233f57=[];values=_0x462c2b['dataValues'];_0x233f57[_0x747a('0x4f')](get_open_tabs('chat',_0x462c2b[_0x747a('0x52')]));_0x233f57[_0x747a('0x4f')](get_open_tabs(_0x747a('0x50'),_0x462c2b[_0x747a('0x52')]));_0x233f57[_0x747a('0x4f')](get_open_tabs('openchannel',_0x462c2b[_0x747a('0x52')]));_0x233f57[_0x747a('0x4f')](get_open_tabs(_0x747a('0x53'),_0x462c2b[_0x747a('0x52')]));_0x233f57['push'](get_open_tabs('fax',_0x462c2b[_0x747a('0x52')]));_0x233f57['push'](get_open_tabs(_0x747a('0x62'),_0x462c2b[_0x747a('0x52')]));return Promise[_0x747a('0x54')](_0x233f57);})[_0x747a('0x16')](function(_0x326542){if(_0x326542){var _0xd9eb7b=_[_0x747a('0x36')](values['ChatOpenTabs'],function(_0x53ff16){return{'channel':_0x747a('0xc7'),'id':_0x53ff16['id'],'createdAt':_0x53ff16[_0x747a('0xc8')]};});var _0x21ea5f=_[_0x747a('0x36')](values[_0x747a('0xc9')],function(_0x185b1f){return{'channel':_0x747a('0xca'),'id':_0x185b1f['id'],'createdAt':_0x185b1f[_0x747a('0xc8')]};});var _0x4356a4=_[_0x747a('0x36')](values[_0x747a('0xcb')],function(_0x2068b9){return{'channel':_0x747a('0xcc'),'id':_0x2068b9['id'],'createdAt':_0x2068b9[_0x747a('0xc8')]};});var _0x4add1b=_[_0x747a('0x36')](values['MailOpenTabs'],function(_0x2df875){return{'channel':'MAIL','id':_0x2df875['id'],'createdAt':_0x2df875[_0x747a('0xc8')]};});var _0x41b555=_[_0x747a('0x36')](values[_0x747a('0xcd')],function(_0x318165){return{'channel':'SMS','id':_0x318165['id'],'createdAt':_0x318165[_0x747a('0xc8')]};});var _0x29f38f=_[_0x747a('0x36')](values[_0x747a('0xce')],function(_0x267751){return{'channel':_0x747a('0xcf'),'id':_0x267751['id'],'createdAt':_0x267751[_0x747a('0xc8')]};});var _0x25eaf5=_['concat'](_0xd9eb7b,_0x21ea5f,_0x4356a4,_0x4add1b,_0x41b555,_0x29f38f);var _0x20b107={'count':_0x25eaf5[_0x747a('0x4d')],'rows':_0x25eaf5};return _0x20b107;}else return null;})[_0x747a('0x16')](respondWithResult(_0x20e3fc,null))[_0x747a('0x55')](handleError(_0x20e3fc,null));};exports[_0x747a('0xd0')]=function(_0x461450,_0x521c16){var _0x13d4ef={};var _0x4a69db={};var _0x4380ae;var _0x47ae7b;return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x461450[_0x747a('0x65')]['id']}})['then'](handleEntityNotFound(_0x521c16,null))[_0x747a('0x16')](function(_0x686bf2){if(_0x686bf2){_0x4380ae=_0x686bf2;_0x4a69db['model']=_[_0x747a('0x59')](db['CmContact'][_0x747a('0x3e')]);_0x4a69db[_0x747a('0x45')]=_[_0x747a('0x59')](_0x461450[_0x747a('0x45')]);_0x4a69db['filters']=_[_0x747a('0x5a')](_0x4a69db[_0x747a('0x57')],_0x4a69db[_0x747a('0x45')]);_0x13d4ef[_0x747a('0x49')]=_[_0x747a('0x5a')](_0x4a69db[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x461450[_0x747a('0x45')]['fields']));_0x13d4ef[_0x747a('0x49')]=_0x13d4ef['attributes']['length']?_0x13d4ef[_0x747a('0x49')]:_0x4a69db['model'];_0x13d4ef['order']=qs[_0x747a('0xd1')](_0x461450[_0x747a('0x45')][_0x747a('0xd1')]);_0x13d4ef[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x461450['query'],_0x4a69db[_0x747a('0xd3')]));if(_0x461450[_0x747a('0x45')][_0x747a('0x34')]){_0x13d4ef[_0x747a('0xd2')]=_['merge'](_0x13d4ef[_0x747a('0xd2')],{'$or':_['map'](_0x13d4ef[_0x747a('0x49')],function(_0x44f304){var _0xa0bc6c={};_0xa0bc6c[_0x44f304]={'$like':'%'+_0x461450[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0xa0bc6c;})});}_0x13d4ef=_[_0x747a('0x5e')]({},_0x13d4ef,_0x461450['options']);return _0x4380ae[_0x747a('0xd0')](_0x13d4ef);}})[_0x747a('0x16')](function(_0x53e56a){if(_0x53e56a){_0x47ae7b=_0x53e56a[_0x747a('0x4d')];if(_0x461450[_0x747a('0x45')][_0x747a('0xd5')]('includeAll')){_0x13d4ef[_0x747a('0x5d')]=[{'model':db[_0x747a('0xd6')],'as':_0x747a('0xd7'),'required':![]},{'model':db[_0x747a('0xd8')],'as':_0x747a('0xd9'),'attributes':['id',_0x747a('0x39'),_0x747a('0xda')],'where':_0x461450[_0x747a('0x45')][_0x747a('0xdb')]?{'id':_0x461450['query'][_0x747a('0xdb')]}:undefined,'required':_0x461450['query'][_0x747a('0xdb')]?!![]:![]}];}if(!_0x461450['query'][_0x747a('0xd5')](_0x747a('0xdc'))){_0x13d4ef[_0x747a('0x27')]=qs[_0x747a('0x27')](_0x461450['query'][_0x747a('0x27')]);_0x13d4ef['offset']=qs['offset'](_0x461450[_0x747a('0x45')]['offset']);}return _0x4380ae[_0x747a('0xd0')](_0x13d4ef);}})[_0x747a('0x16')](function(_0x58739d){if(_0x58739d){return _0x58739d?{'count':_0x47ae7b,'rows':_0x58739d}:null;}})[_0x747a('0x16')](respondWithResult(_0x521c16,null))[_0x747a('0x55')](handleError(_0x521c16,null));};exports[_0x747a('0xdd')]=function(_0x1c85f3,_0x14e2e6){var _0x48dfae;var _0x44097b={};var _0x2252f4;return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x1c85f3[_0x747a('0x65')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x14e2e6,null))[_0x747a('0x16')](function(_0x543a59){if(!utils[_0x747a('0xa9')](_0x1c85f3[_0x747a('0x45')]['channel'])){throw new db[(_0x747a('0x98'))]['ValidationError']('Unknown\x20channel');}_0x48dfae=_0x543a59;var _0x4dec1a={};_0x4dec1a[_0x747a('0x57')]=_[_0x747a('0x59')](db[_[_0x747a('0xac')](_0x1c85f3[_0x747a('0x45')][_0x747a('0xa4')])+'Queue']['rawAttributes']);_0x4dec1a[_0x747a('0x45')]=_[_0x747a('0x59')](_0x1c85f3['query']);_0x4dec1a[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x4dec1a[_0x747a('0x57')],_0x4dec1a[_0x747a('0x45')]);_0x44097b[_0x747a('0x49')]=_['intersection'](_0x4dec1a['model'],qs[_0x747a('0x5b')](_0x1c85f3[_0x747a('0x45')][_0x747a('0x5b')]));_0x44097b[_0x747a('0x49')]=_0x44097b[_0x747a('0x49')][_0x747a('0x4d')]?_0x44097b[_0x747a('0x49')]:_0x4dec1a[_0x747a('0x57')];_0x44097b[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x1c85f3[_0x747a('0x45')][_0x747a('0xd1')]);_0x44097b['where']=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x1c85f3[_0x747a('0x45')],_0x4dec1a[_0x747a('0xd3')]));if(_0x1c85f3[_0x747a('0x45')]['filter']){_0x44097b[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x44097b['where'],{'$or':_[_0x747a('0x36')](_0x44097b[_0x747a('0x49')],function(_0x46b586){var _0x54b597={};_0x54b597[_0x46b586]={'$like':'%'+_0x1c85f3['query']['filter']+'%'};return _0x54b597;})});}_0x44097b=_[_0x747a('0x5e')]({},_0x44097b,_0x1c85f3['options']);switch(_0x48dfae[_0x747a('0x2a')]){case'admin':return db[_[_0x747a('0xac')](_0x1c85f3[_0x747a('0x45')][_0x747a('0xa4')])+_0x747a('0xdf')][_0x747a('0x4a')](_0x44097b);case _0x747a('0x30'):case'agent':return _0x48dfae[_0x747a('0x2e')+_[_0x747a('0xac')](_0x1c85f3[_0x747a('0x45')][_0x747a('0xa4')])+_0x747a('0xad')](_0x44097b);default:throw new db[(_0x747a('0x98'))][(_0x747a('0x95'))](_0x747a('0xe0'));}})[_0x747a('0x16')](function(_0x316200){_0x2252f4=_0x316200[_0x747a('0x4d')];if(!_0x1c85f3[_0x747a('0x45')]['hasOwnProperty'](_0x747a('0xdc'))){_0x44097b[_0x747a('0x27')]=qs[_0x747a('0x27')](_0x1c85f3[_0x747a('0x45')][_0x747a('0x27')]);_0x44097b[_0x747a('0x25')]=qs['offset'](_0x1c85f3[_0x747a('0x45')]['offset']);}switch(_0x48dfae['role']){case'admin':return db[_[_0x747a('0xac')](_0x1c85f3[_0x747a('0x45')][_0x747a('0xa4')])+_0x747a('0xdf')]['findAll'](_0x44097b);case _0x747a('0x30'):case'agent':return _0x48dfae[_0x747a('0x2e')+_['capitalize'](_0x1c85f3[_0x747a('0x45')]['channel'])+'Queues'](_0x44097b);}})['then'](function(_0x214b48){return{'count':_0x2252f4,'rows':_0x214b48};})['then'](respondWithResult(_0x14e2e6,null))[_0x747a('0x55')](handleError(_0x14e2e6,null));};exports[_0x747a('0xe1')]=function(_0x11931d,_0xe416bf){var _0x517d44={};var _0x55588d={};var _0x135045;var _0x237627;return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x11931d[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0xe416bf,null))[_0x747a('0x16')](function(_0x2cf2e1){if(_0x2cf2e1){_0x135045=_0x2cf2e1;_0x55588d[_0x747a('0x57')]=_[_0x747a('0x59')](db[_0x747a('0xb5')][_0x747a('0x3e')]);_0x55588d[_0x747a('0x45')]=_[_0x747a('0x59')](_0x11931d[_0x747a('0x45')]);_0x55588d['filters']=_[_0x747a('0x5a')](_0x55588d[_0x747a('0x57')],_0x55588d[_0x747a('0x45')]);_0x517d44['attributes']=_[_0x747a('0x5a')](_0x55588d[_0x747a('0x57')],qs['fields'](_0x11931d[_0x747a('0x45')][_0x747a('0x5b')]));_0x517d44[_0x747a('0x49')]=_0x517d44[_0x747a('0x49')][_0x747a('0x4d')]?_0x517d44[_0x747a('0x49')]:_0x55588d[_0x747a('0x57')];_0x517d44['order']=qs['sort'](_0x11931d[_0x747a('0x45')][_0x747a('0xd1')]);_0x517d44['where']=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x11931d[_0x747a('0x45')],_0x55588d['filters']));if(_0x11931d[_0x747a('0x45')][_0x747a('0x34')]){_0x517d44[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x517d44[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x517d44[_0x747a('0x49')],function(_0x2db864){var _0x3f67ea={};_0x3f67ea[_0x2db864]={'$like':'%'+_0x11931d[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x3f67ea;})});}_0x517d44=_[_0x747a('0x5e')]({},_0x517d44,_0x11931d[_0x747a('0x5f')]);return _0x135045[_0x747a('0xe1')](_0x517d44);}})[_0x747a('0x16')](function(_0x48d108){if(_0x48d108){_0x237627=_0x48d108[_0x747a('0x4d')];if(!_0x11931d[_0x747a('0x45')][_0x747a('0xd5')](_0x747a('0xdc'))){_0x517d44['limit']=qs[_0x747a('0x27')](_0x11931d[_0x747a('0x45')][_0x747a('0x27')]);_0x517d44[_0x747a('0x25')]=qs['offset'](_0x11931d[_0x747a('0x45')][_0x747a('0x25')]);}return _0x135045[_0x747a('0xe1')](_0x517d44);}})[_0x747a('0x16')](function(_0x54f801){if(_0x54f801){return _0x54f801?{'count':_0x237627,'rows':_0x54f801}:null;}})[_0x747a('0x16')](respondWithResult(_0xe416bf,null))['catch'](handleError(_0xe416bf,null));};exports[_0x747a('0xe2')]=function(_0x378147,_0x5833df){var _0x2a3144={};var _0x136fa9={};var _0x2fb471;var _0xd4b3b2;return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x378147[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x5833df,null))[_0x747a('0x16')](function(_0x3c94ce){if(_0x3c94ce){_0x2fb471=_0x3c94ce;_0x136fa9[_0x747a('0x57')]=_['keys'](db[_0x747a('0xe3')][_0x747a('0x3e')]);_0x136fa9['query']=_[_0x747a('0x59')](_0x378147['query']);_0x136fa9[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x136fa9['model'],_0x136fa9['query']);_0x2a3144[_0x747a('0x49')]=_[_0x747a('0x5a')](_0x136fa9[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x378147[_0x747a('0x45')][_0x747a('0x5b')]));_0x2a3144[_0x747a('0x49')]=_0x2a3144[_0x747a('0x49')]['length']?_0x2a3144[_0x747a('0x49')]:_0x136fa9[_0x747a('0x57')];_0x2a3144[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x378147[_0x747a('0x45')][_0x747a('0xd1')]);_0x2a3144[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x378147[_0x747a('0x45')],_0x136fa9[_0x747a('0xd3')]));if(_0x378147[_0x747a('0x45')][_0x747a('0x34')]){_0x2a3144['where']=_['merge'](_0x2a3144[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x2a3144['attributes'],function(_0x5dfc0c){var _0x25649b={};_0x25649b[_0x5dfc0c]={'$like':'%'+_0x378147['query'][_0x747a('0x34')]+'%'};return _0x25649b;})});}_0x2a3144=_[_0x747a('0x5e')]({},_0x2a3144,_0x378147[_0x747a('0x5f')]);return _0x2fb471['getGroups'](_0x2a3144);}})[_0x747a('0x16')](function(_0x4d95f7){if(_0x4d95f7){_0xd4b3b2=_0x4d95f7[_0x747a('0x4d')];if(!_0x378147[_0x747a('0x45')]['hasOwnProperty'](_0x747a('0xdc'))){_0x2a3144[_0x747a('0x27')]=qs['limit'](_0x378147[_0x747a('0x45')][_0x747a('0x27')]);_0x2a3144[_0x747a('0x25')]=qs[_0x747a('0x25')](_0x378147[_0x747a('0x45')]['offset']);}return _0x2fb471['getGroups'](_0x2a3144);}})[_0x747a('0x16')](function(_0x17bbf0){if(_0x17bbf0){return _0x17bbf0?{'count':_0xd4b3b2,'rows':_0x17bbf0}:null;}})[_0x747a('0x16')](respondWithResult(_0x5833df,null))[_0x747a('0x55')](handleError(_0x5833df,null));};exports['getRecordings']=function(_0x58eeb1,_0xc0f38d){var _0x4c5510={'raw':!![],'where':{}};var _0x17d93f={};var _0x1ba96d={'count':0x0,'rows':[]};return db[_0x747a('0x3d')]['findOne']({'where':{'id':_0x58eeb1['params']['id']}})[_0x747a('0x16')](handleEntityNotFound(_0xc0f38d,null))[_0x747a('0x16')](function(_0x38c83a){if(_0x38c83a){_0x17d93f[_0x747a('0x57')]=_['keys'](db['VoiceRecording'][_0x747a('0x3e')]);_0x17d93f[_0x747a('0x45')]=_['keys'](_0x58eeb1[_0x747a('0x45')]);_0x17d93f[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x17d93f[_0x747a('0x57')],_0x17d93f['query']);_0x4c5510[_0x747a('0x49')]=_['intersection'](_0x17d93f[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x58eeb1[_0x747a('0x45')]['fields']));_0x4c5510[_0x747a('0x49')]=_0x4c5510[_0x747a('0x49')][_0x747a('0x4d')]?_0x4c5510[_0x747a('0x49')]:_0x17d93f[_0x747a('0x57')];if(!_0x58eeb1[_0x747a('0x45')][_0x747a('0xd5')](_0x747a('0xdc'))){_0x4c5510[_0x747a('0x27')]=qs[_0x747a('0x27')](_0x58eeb1[_0x747a('0x45')][_0x747a('0x27')]);_0x4c5510[_0x747a('0x25')]=qs['offset'](_0x58eeb1[_0x747a('0x45')][_0x747a('0x25')]);}_0x4c5510[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x58eeb1[_0x747a('0x45')][_0x747a('0xd1')]);_0x4c5510[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_['pick'](_0x58eeb1[_0x747a('0x45')],_0x17d93f[_0x747a('0xd3')]));_0x4c5510[_0x747a('0xd2')][_0x747a('0xe4')]=_0x38c83a['id'];if(_0x58eeb1[_0x747a('0x45')][_0x747a('0x34')]){_0x4c5510[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x4c5510[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x4c5510[_0x747a('0x49')],function(_0xd6c55e){var _0x318ccf={};_0x318ccf[_0xd6c55e]={'$like':'%'+_0x58eeb1[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x318ccf;})});}_0x4c5510=_[_0x747a('0x5e')]({},_0x4c5510,_0x58eeb1[_0x747a('0x5f')]);return db[_0x747a('0xe5')][_0x747a('0x28')]({'where':_0x4c5510[_0x747a('0xd2')]})[_0x747a('0x16')](function(_0x54809a){_0x1ba96d[_0x747a('0x28')]=_0x54809a;if(_0x58eeb1[_0x747a('0x45')][_0x747a('0x5c')]){_0x4c5510[_0x747a('0x5d')]=[{'all':!![]}];}return db[_0x747a('0xe5')][_0x747a('0x4a')](_0x4c5510);})[_0x747a('0x16')](function(_0x3313ed){_0x1ba96d[_0x747a('0x4b')]=_0x3313ed;return _0x1ba96d;});}})[_0x747a('0x16')](respondWithFilteredResult(_0xc0f38d,_0x4c5510))[_0x747a('0x55')](handleError(_0xc0f38d,null));};exports[_0x747a('0xe6')]=function(_0x137bb3,_0x53140c){var _0x3adfe6={'raw':!![],'where':{}};var _0x5cabf4={};var _0xd420af={'count':0x0,'rows':[]};return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x137bb3[_0x747a('0x65')]['id']}})['then'](handleEntityNotFound(_0x53140c,null))[_0x747a('0x16')](function(_0x35cea7){if(_0x35cea7){_0x5cabf4[_0x747a('0x57')]=_['keys'](db['ScreenRecording'][_0x747a('0x3e')]);_0x5cabf4[_0x747a('0x45')]=_[_0x747a('0x59')](_0x137bb3[_0x747a('0x45')]);_0x5cabf4['filters']=_[_0x747a('0x5a')](_0x5cabf4[_0x747a('0x57')],_0x5cabf4[_0x747a('0x45')]);_0x3adfe6[_0x747a('0x49')]=_[_0x747a('0x5a')](_0x5cabf4[_0x747a('0x57')],qs['fields'](_0x137bb3[_0x747a('0x45')][_0x747a('0x5b')]));_0x3adfe6['attributes']=_0x3adfe6[_0x747a('0x49')][_0x747a('0x4d')]?_0x3adfe6[_0x747a('0x49')]:_0x5cabf4[_0x747a('0x57')];if(!_0x137bb3[_0x747a('0x45')][_0x747a('0xd5')](_0x747a('0xdc'))){_0x3adfe6[_0x747a('0x27')]=qs['limit'](_0x137bb3[_0x747a('0x45')][_0x747a('0x27')]);_0x3adfe6[_0x747a('0x25')]=qs[_0x747a('0x25')](_0x137bb3[_0x747a('0x45')]['offset']);}_0x3adfe6[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x137bb3[_0x747a('0x45')][_0x747a('0xd1')]);_0x3adfe6['where']=qs[_0x747a('0xd3')](_['pick'](_0x137bb3[_0x747a('0x45')],_0x5cabf4[_0x747a('0xd3')]));_0x3adfe6[_0x747a('0xd2')][_0x747a('0xe4')]=_0x35cea7['id'];if(_0x137bb3[_0x747a('0x45')]['filter']){_0x3adfe6[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x3adfe6[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x3adfe6['attributes'],function(_0x44cacb){var _0x1fe1cd={};_0x1fe1cd[_0x44cacb]={'$like':'%'+_0x137bb3[_0x747a('0x45')]['filter']+'%'};return _0x1fe1cd;})});}_0x3adfe6=_[_0x747a('0x5e')]({},_0x3adfe6,_0x137bb3[_0x747a('0x5f')]);return db['ScreenRecording']['count']({'where':_0x3adfe6[_0x747a('0xd2')]})[_0x747a('0x16')](function(_0x393460){_0xd420af['count']=_0x393460;if(_0x137bb3['query'][_0x747a('0x5c')]){_0x3adfe6['include']=[{'all':!![]}];}return db[_0x747a('0xe7')][_0x747a('0x4a')](_0x3adfe6);})[_0x747a('0x16')](function(_0xb1c98d){_0xd420af['rows']=_0xb1c98d;return _0xd420af;});}})[_0x747a('0x16')](respondWithFilteredResult(_0x53140c,_0x3adfe6))[_0x747a('0x55')](handleError(_0x53140c,null));};exports[_0x747a('0xe8')]=function(_0x1ca900,_0x222567){var _0x41c0e6={};var _0xbae9e4={};var _0x3658e9;var _0x5d8125;return db[_0x747a('0x3d')]['findOne']({'where':{'id':_0x1ca900[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x222567,null))[_0x747a('0x16')](function(_0x41b706){if(_0x41b706){_0x3658e9=_0x41b706;_0xbae9e4[_0x747a('0x57')]=_[_0x747a('0x59')](db[_0x747a('0xe9')][_0x747a('0x3e')]);_0xbae9e4[_0x747a('0x45')]=_[_0x747a('0x59')](_0x1ca900[_0x747a('0x45')]);_0xbae9e4[_0x747a('0xd3')]=_['intersection'](_0xbae9e4[_0x747a('0x57')],_0xbae9e4[_0x747a('0x45')]);_0x41c0e6['attributes']=_[_0x747a('0x5a')](_0xbae9e4['model'],qs[_0x747a('0x5b')](_0x1ca900[_0x747a('0x45')][_0x747a('0x5b')]));_0x41c0e6[_0x747a('0x49')]=_0x41c0e6[_0x747a('0x49')]['length']?_0x41c0e6[_0x747a('0x49')]:_0xbae9e4[_0x747a('0x57')];_0x41c0e6[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x1ca900[_0x747a('0x45')][_0x747a('0xd1')]);_0x41c0e6['where']=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x1ca900['query'],_0xbae9e4['filters']));if(_0x1ca900[_0x747a('0x45')][_0x747a('0x34')]){_0x41c0e6[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x41c0e6[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x41c0e6[_0x747a('0x49')],function(_0x1675f1){var _0x3fe289={};_0x3fe289[_0x1675f1]={'$like':'%'+_0x1ca900[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x3fe289;})});}_0x41c0e6=_[_0x747a('0x5e')]({},_0x41c0e6,_0x1ca900['options']);return _0x3658e9[_0x747a('0xe8')](_0x41c0e6);}})[_0x747a('0x16')](function(_0x5b1d2c){if(_0x5b1d2c){_0x5d8125=_0x5b1d2c[_0x747a('0x4d')];if(!_0x1ca900['query']['hasOwnProperty'](_0x747a('0xdc'))){_0x41c0e6[_0x747a('0x27')]=qs[_0x747a('0x27')](_0x1ca900[_0x747a('0x45')][_0x747a('0x27')]);_0x41c0e6[_0x747a('0x25')]=qs[_0x747a('0x25')](_0x1ca900['query'][_0x747a('0x25')]);}return _0x3658e9['getChatInteractions'](_0x41c0e6);}})[_0x747a('0x16')](function(_0x11151a){if(_0x11151a){return _0x11151a?{'count':_0x5d8125,'rows':_0x11151a}:null;}})[_0x747a('0x16')](respondWithResult(_0x222567,null))[_0x747a('0x55')](handleError(_0x222567,null));};exports[_0x747a('0xea')]=function(_0x3abb95,_0x33a05a){var _0x3b7a69={};var _0x41438a={};var _0x598698;var _0xae4d95;return db['User'][_0x747a('0x9d')]({'where':{'id':_0x3abb95[_0x747a('0x65')]['id']}})['then'](handleEntityNotFound(_0x33a05a,null))[_0x747a('0x16')](function(_0x594d1f){if(_0x594d1f){_0x598698=_0x594d1f;_0x41438a[_0x747a('0x57')]=_[_0x747a('0x59')](db[_0x747a('0xeb')][_0x747a('0x3e')]);_0x41438a[_0x747a('0x45')]=_[_0x747a('0x59')](_0x3abb95[_0x747a('0x45')]);_0x41438a['filters']=_[_0x747a('0x5a')](_0x41438a['model'],_0x41438a[_0x747a('0x45')]);_0x3b7a69[_0x747a('0x49')]=_['intersection'](_0x41438a['model'],qs['fields'](_0x3abb95[_0x747a('0x45')][_0x747a('0x5b')]));_0x3b7a69['attributes']=_0x3b7a69[_0x747a('0x49')]['length']?_0x3b7a69[_0x747a('0x49')]:_0x41438a[_0x747a('0x57')];_0x3b7a69[_0x747a('0xde')]=qs['sort'](_0x3abb95[_0x747a('0x45')][_0x747a('0xd1')]);_0x3b7a69[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x3abb95[_0x747a('0x45')],_0x41438a[_0x747a('0xd3')]));if(_0x3abb95[_0x747a('0x45')][_0x747a('0x34')]){_0x3b7a69[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x3b7a69[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x3b7a69[_0x747a('0x49')],function(_0x3eb746){var _0x23164b={};_0x23164b[_0x3eb746]={'$like':'%'+_0x3abb95['query'][_0x747a('0x34')]+'%'};return _0x23164b;})});}_0x3b7a69=_[_0x747a('0x5e')]({},_0x3b7a69,_0x3abb95[_0x747a('0x5f')]);return _0x598698[_0x747a('0xea')](_0x3b7a69);}})[_0x747a('0x16')](function(_0x54affa){if(_0x54affa){_0xae4d95=_0x54affa[_0x747a('0x4d')];if(!_0x3abb95['query'][_0x747a('0xd5')](_0x747a('0xdc'))){_0x3b7a69[_0x747a('0x27')]=qs[_0x747a('0x27')](_0x3abb95['query'][_0x747a('0x27')]);_0x3b7a69[_0x747a('0x25')]=qs[_0x747a('0x25')](_0x3abb95[_0x747a('0x45')][_0x747a('0x25')]);}return _0x598698[_0x747a('0xea')](_0x3b7a69);}})[_0x747a('0x16')](function(_0x1388ee){if(_0x1388ee){return _0x1388ee?{'count':_0xae4d95,'rows':_0x1388ee}:null;}})['then'](respondWithResult(_0x33a05a,null))['catch'](handleError(_0x33a05a,null));};exports[_0x747a('0xec')]=function(_0x1c0667,_0x275112){var _0x4c3a78={'raw':!![],'where':{}};var _0x275f40={};var _0x5802ec={'count':0x0,'rows':[]};return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x1c0667[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x275112,null))['then'](function(_0x302bad){if(_0x302bad){_0x275f40['model']=_[_0x747a('0x59')](db[_0x747a('0xed')]['rawAttributes']);_0x275f40[_0x747a('0x45')]=_[_0x747a('0x59')](_0x1c0667[_0x747a('0x45')]);_0x275f40[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x275f40[_0x747a('0x57')],_0x275f40['query']);_0x4c3a78['attributes']=_[_0x747a('0x5a')](_0x275f40[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x1c0667[_0x747a('0x45')][_0x747a('0x5b')]));_0x4c3a78[_0x747a('0x49')]=_0x4c3a78[_0x747a('0x49')][_0x747a('0x4d')]?_0x4c3a78['attributes']:_0x275f40[_0x747a('0x57')];if(!_0x1c0667[_0x747a('0x45')][_0x747a('0xd5')](_0x747a('0xdc'))){_0x4c3a78[_0x747a('0x27')]=qs['limit'](_0x1c0667[_0x747a('0x45')]['limit']);_0x4c3a78['offset']=qs[_0x747a('0x25')](_0x1c0667['query'][_0x747a('0x25')]);}_0x4c3a78['order']=qs['sort'](_0x1c0667[_0x747a('0x45')]['sort']);_0x4c3a78[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x1c0667[_0x747a('0x45')],_0x275f40[_0x747a('0xd3')]));_0x4c3a78[_0x747a('0xd2')][_0x747a('0xe4')]=_0x302bad['id'];if(_0x1c0667[_0x747a('0x45')][_0x747a('0x34')]){_0x4c3a78[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x4c3a78[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x4c3a78['attributes'],function(_0x3ded9e){var _0x256ee4={};_0x256ee4[_0x3ded9e]={'$like':'%'+_0x1c0667[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x256ee4;})});}_0x4c3a78=_[_0x747a('0x5e')]({},_0x4c3a78,_0x1c0667[_0x747a('0x5f')]);return db[_0x747a('0xed')][_0x747a('0x28')]({'where':_0x4c3a78[_0x747a('0xd2')]})[_0x747a('0x16')](function(_0x3b01f0){_0x5802ec[_0x747a('0x28')]=_0x3b01f0;if(_0x1c0667[_0x747a('0x45')][_0x747a('0x5c')]){_0x4c3a78[_0x747a('0x5d')]=[{'all':!![]}];}return db['MailInteraction'][_0x747a('0x4a')](_0x4c3a78);})[_0x747a('0x16')](function(_0x4aa805){_0x5802ec[_0x747a('0x4b')]=_0x4aa805;return _0x5802ec;});}})[_0x747a('0x16')](respondWithFilteredResult(_0x275112,_0x4c3a78))['catch'](handleError(_0x275112,null));};exports[_0x747a('0xee')]=function(_0x1d29b4,_0x1dc335){var _0x451335={};var _0xa77123={};var _0x23b86f;var _0x3947e6;return db['User'][_0x747a('0x9d')]({'where':{'id':_0x1d29b4[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x1dc335,null))[_0x747a('0x16')](function(_0x33eb2c){if(_0x33eb2c){_0x23b86f=_0x33eb2c;_0xa77123[_0x747a('0x57')]=_['keys'](db[_0x747a('0xef')]['rawAttributes']);_0xa77123['query']=_['keys'](_0x1d29b4[_0x747a('0x45')]);_0xa77123[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0xa77123[_0x747a('0x57')],_0xa77123[_0x747a('0x45')]);_0x451335[_0x747a('0x49')]=_['intersection'](_0xa77123[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x1d29b4[_0x747a('0x45')][_0x747a('0x5b')]));_0x451335[_0x747a('0x49')]=_0x451335[_0x747a('0x49')][_0x747a('0x4d')]?_0x451335[_0x747a('0x49')]:_0xa77123[_0x747a('0x57')];_0x451335[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x1d29b4[_0x747a('0x45')]['sort']);_0x451335[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x1d29b4['query'],_0xa77123[_0x747a('0xd3')]));if(_0x1d29b4['query']['filter']){_0x451335[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x451335[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x451335[_0x747a('0x49')],function(_0x175437){var _0x4dce19={};_0x4dce19[_0x175437]={'$like':'%'+_0x1d29b4[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x4dce19;})});}_0x451335=_[_0x747a('0x5e')]({},_0x451335,_0x1d29b4[_0x747a('0x5f')]);return _0x23b86f[_0x747a('0xee')](_0x451335);}})[_0x747a('0x16')](function(_0x5077c1){if(_0x5077c1){_0x3947e6=_0x5077c1['length'];if(!_0x1d29b4['query'][_0x747a('0xd5')]('nolimit')){_0x451335['limit']=qs[_0x747a('0x27')](_0x1d29b4[_0x747a('0x45')]['limit']);_0x451335[_0x747a('0x25')]=qs[_0x747a('0x25')](_0x1d29b4[_0x747a('0x45')][_0x747a('0x25')]);}return _0x23b86f['getSmsInteractions'](_0x451335);}})[_0x747a('0x16')](function(_0x344cfb){if(_0x344cfb){return _0x344cfb?{'count':_0x3947e6,'rows':_0x344cfb}:null;}})['then'](respondWithResult(_0x1dc335,null))['catch'](handleError(_0x1dc335,null));};exports[_0x747a('0xf0')]=function(_0x1f966f,_0x4a4018){var _0x466aef={};var _0x496dd2={};var _0x1d12fe;var _0x17acc3;return db['User']['findOne']({'where':{'id':_0x1f966f[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x4a4018,null))[_0x747a('0x16')](function(_0xaa8d64){if(_0xaa8d64){_0x1d12fe=_0xaa8d64;_0x496dd2[_0x747a('0x57')]=_[_0x747a('0x59')](db[_0x747a('0xf1')][_0x747a('0x3e')]);_0x496dd2[_0x747a('0x45')]=_[_0x747a('0x59')](_0x1f966f[_0x747a('0x45')]);_0x496dd2[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x496dd2[_0x747a('0x57')],_0x496dd2[_0x747a('0x45')]);_0x466aef['attributes']=_[_0x747a('0x5a')](_0x496dd2[_0x747a('0x57')],qs['fields'](_0x1f966f[_0x747a('0x45')]['fields']));_0x466aef[_0x747a('0x49')]=_0x466aef['attributes']['length']?_0x466aef[_0x747a('0x49')]:_0x496dd2[_0x747a('0x57')];_0x466aef[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x1f966f[_0x747a('0x45')][_0x747a('0xd1')]);_0x466aef[_0x747a('0xd2')]=qs['filters'](_['pick'](_0x1f966f['query'],_0x496dd2[_0x747a('0xd3')]));if(_0x1f966f[_0x747a('0x45')]['filter']){_0x466aef[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x466aef['where'],{'$or':_['map'](_0x466aef[_0x747a('0x49')],function(_0x5a0f2f){var _0x13007c={};_0x13007c[_0x5a0f2f]={'$like':'%'+_0x1f966f[_0x747a('0x45')]['filter']+'%'};return _0x13007c;})});}_0x466aef=_[_0x747a('0x5e')]({},_0x466aef,_0x1f966f['options']);return _0x1d12fe[_0x747a('0xf0')](_0x466aef);}})[_0x747a('0x16')](function(_0x620a09){if(_0x620a09){_0x17acc3=_0x620a09['length'];if(!_0x1f966f[_0x747a('0x45')][_0x747a('0xd5')](_0x747a('0xdc'))){_0x466aef['limit']=qs[_0x747a('0x27')](_0x1f966f['query'][_0x747a('0x27')]);_0x466aef['offset']=qs['offset'](_0x1f966f[_0x747a('0x45')][_0x747a('0x25')]);}return _0x1d12fe[_0x747a('0xf0')](_0x466aef);}})[_0x747a('0x16')](function(_0x245ccf){if(_0x245ccf){return _0x245ccf?{'count':_0x17acc3,'rows':_0x245ccf}:null;}})[_0x747a('0x16')](respondWithResult(_0x4a4018,null))[_0x747a('0x55')](handleError(_0x4a4018,null));};exports[_0x747a('0xf2')]=function(_0x472d3f,_0x23bed5){var _0x49404b={};var _0x129c1b={};var _0x481431;var _0x5a2b72;return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x472d3f[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x23bed5,null))['then'](function(_0x50ceec){if(_0x50ceec){_0x481431=_0x50ceec;_0x129c1b[_0x747a('0x57')]=_[_0x747a('0x59')](db[_0x747a('0xf3')]['rawAttributes']);_0x129c1b[_0x747a('0x45')]=_['keys'](_0x472d3f[_0x747a('0x45')]);_0x129c1b[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x129c1b[_0x747a('0x57')],_0x129c1b[_0x747a('0x45')]);_0x49404b[_0x747a('0x49')]=_[_0x747a('0x5a')](_0x129c1b[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x472d3f[_0x747a('0x45')][_0x747a('0x5b')]));_0x49404b[_0x747a('0x49')]=_0x49404b[_0x747a('0x49')][_0x747a('0x4d')]?_0x49404b[_0x747a('0x49')]:_0x129c1b['model'];_0x49404b[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x472d3f[_0x747a('0x45')][_0x747a('0xd1')]);_0x49404b[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x472d3f[_0x747a('0x45')],_0x129c1b[_0x747a('0xd3')]));if(_0x472d3f[_0x747a('0x45')][_0x747a('0x34')]){_0x49404b[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x49404b['where'],{'$or':_[_0x747a('0x36')](_0x49404b[_0x747a('0x49')],function(_0x488c7a){var _0x2cb6a3={};_0x2cb6a3[_0x488c7a]={'$like':'%'+_0x472d3f[_0x747a('0x45')]['filter']+'%'};return _0x2cb6a3;})});}_0x49404b=_['merge']({},_0x49404b,_0x472d3f[_0x747a('0x5f')]);return _0x481431[_0x747a('0xf2')](_0x49404b);}})[_0x747a('0x16')](function(_0xe6f9e3){if(_0xe6f9e3){_0x5a2b72=_0xe6f9e3[_0x747a('0x4d')];if(!_0x472d3f[_0x747a('0x45')][_0x747a('0xd5')](_0x747a('0xdc'))){_0x49404b[_0x747a('0x27')]=qs[_0x747a('0x27')](_0x472d3f[_0x747a('0x45')][_0x747a('0x27')]);_0x49404b[_0x747a('0x25')]=qs[_0x747a('0x25')](_0x472d3f[_0x747a('0x45')][_0x747a('0x25')]);}return _0x481431[_0x747a('0xf2')](_0x49404b);}})[_0x747a('0x16')](function(_0x544009){if(_0x544009){return _0x544009?{'count':_0x5a2b72,'rows':_0x544009}:null;}})[_0x747a('0x16')](respondWithResult(_0x23bed5,null))[_0x747a('0x55')](handleError(_0x23bed5,null));};exports[_0x747a('0xf4')]=function(_0x5c5a6c,_0x4bcbd2,_0xace615){var _0x2c3ee1;var _0xbb5757;var _0x2f6822;var _0x2844b9=!_[_0x747a('0x6f')](_0x5c5a6c[_0x747a('0x65')]['id'])?_0x5c5a6c[_0x747a('0x65')]['id']:!_[_0x747a('0x6f')](_0x5c5a6c['user']['id'])?_0x5c5a6c[_0x747a('0x30')]['id']:null;return db[_0x747a('0x3d')]['find']({'where':{'id':_0x2844b9,'role':{'$or':[_0x747a('0x2f'),'user','agent']}},'attributes':['id',_0x747a('0x39'),_0x747a('0xf5'),_0x747a('0xf6'),_0x747a('0x2a'),'internal',_0x747a('0xa6')]})[_0x747a('0x16')](function(_0x2bba3e){if(_0x2bba3e){if(_0x2bba3e['role']===_0x747a('0x2b')){_0x2c3ee1=_0x2bba3e;if(_0x5c5a6c[_0x747a('0x64')][_0x747a('0xa8')]){_0x2f6822=util['format'](_0x747a('0xf7'),_0x2c3ee1[_0x5c5a6c[_0x747a('0x64')]['interface']]);}else if(_0x5c5a6c[_0x747a('0x64')][_0x747a('0xf8')]){_0x2f6822=util[_0x747a('0xb2')](_0x747a('0xb3'),_0x5c5a6c['body'][_0x747a('0xf8')]);}else{_0x2f6822=util[_0x747a('0xb2')](_0x747a('0xb3'),_0x2c3ee1['name']);}socket['to'](util[_0x747a('0xb2')](_0x747a('0xf9'),_0x2c3ee1[_0x747a('0x39')]))[_0x747a('0x2c')](_0x747a('0xfa'),{'user':{'id':_0x2c3ee1['id'],'name':_0x2c3ee1[_0x747a('0x39')]},'ip':_0x5c5a6c[_0x747a('0xfb')]['x-forwarded-for']||_0x5c5a6c['connection']['remoteAddress']||_0x5c5a6c[_0x747a('0xfc')][_0x747a('0xfd')]||_0x5c5a6c[_0x747a('0xfe')]['socket'][_0x747a('0xfd')]});return db[_0x747a('0xb5')]['destroy']({'where':{'membername':_0x2c3ee1[_0x747a('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0x747a('0x98'))][(_0x747a('0x95'))](_0x747a('0xff'));}})['then'](function(){if(_0x2c3ee1){return _0x2c3ee1[_0x747a('0x100')]({'raw':!![]});}})[_0x747a('0x16')](function(_0x4259fc){if(_0x2c3ee1){if(_0x4259fc){_0xbb5757=_0x4259fc;if(_0xbb5757[_0x747a('0x4d')]){var _0x155a7e=_0xbb5757[_0x747a('0x36')](function(_0x31a82c){var _0x468238={'membername':_0x2c3ee1[_0x747a('0x39')],'UserId':_0x2c3ee1['id'],'queue_name':_0x31a82c['name'],'VoiceQueueId':_0x31a82c['id'],'interface':_0x2f6822,'paused':_0x2c3ee1[_0x747a('0xa6')]||![],'penalty':_0x31a82c[_0x747a('0x101')]||0x0};return db[_0x747a('0xb5')][_0x747a('0xb6')](_0x468238);});return Promise['all'](_0x155a7e);}}}})[_0x747a('0x16')](function(){if(_0x2c3ee1){return db[_0x747a('0x102')][_0x747a('0x4a')]({'where':{'membername':_0x2c3ee1[_0x747a('0x39')],'exitAt':null}});}})[_0x747a('0x16')](function(_0x137b3a){if(_0x2c3ee1){var _0x4e4bb1=[];_0x137b3a[_0x747a('0x103')](function(_0x472d95){_0x4e4bb1[_0x747a('0x4f')](_0x472d95['update']({'exitAt':moment()[_0x747a('0xb2')](_0x747a('0x104'))}));});return Promise[_0x747a('0x54')](_0x4e4bb1);}})[_0x747a('0x16')](function(){if(_0x2c3ee1){var _0xfcd2=[];var _0x3259c5=[];var _0x504caf=utils[_0x747a('0x105')]();var _0x58c7f9={'membername':_0x2c3ee1[_0x747a('0x39')],'interface':_0x2f6822,'enterAt':moment()[_0x747a('0xb2')](_0x747a('0x104')),'role':_0x2c3ee1[_0x747a('0x2a')],'internal':_0x2c3ee1[_0x747a('0x6a')]};_0x504caf[_0x747a('0x103')](function(_0x3222c3){_0xfcd2[_0x747a('0x4f')](_[_0x747a('0x5e')]({'channel':_0x3222c3,'type':_0x747a('0x106'),'data1':_0x5c5a6c[_0x747a('0x64')]['device'],'data2':_0x2f6822},_0x58c7f9));if(_0x2c3ee1[_0x747a('0xa6')]){_0x3259c5['push'](_['merge']({'channel':_0x3222c3,'type':_0x747a('0x107'),'data1':_0x747a('0x108')},_0x58c7f9));}});return db[_0x747a('0x102')][_0x747a('0x109')](_0xfcd2[_0x747a('0x10a')](_0x3259c5),{'individualHooks':!![]});}})[_0x747a('0x16')](function(){if(_0x2c3ee1){return _0x2c3ee1[_0x747a('0x63')]({'online':!![],'lastLoginAt':moment()[_0x747a('0xb2')](_0x747a('0x104')),'voicePause':_0x2c3ee1[_0x747a('0xa6')]||![],'mailPause':_0x2c3ee1[_0x747a('0xa6')]||![],'chatPause':_0x2c3ee1['loginInPause']||![],'faxPause':_0x2c3ee1[_0x747a('0xa6')]||![],'smsPause':_0x2c3ee1[_0x747a('0xa6')]||![],'openchannelPause':_0x2c3ee1[_0x747a('0xa6')]||![],'whatsappPause':_0x2c3ee1['loginInPause']||![],'pauseType':_0x2c3ee1[_0x747a('0xa6')]?_0x747a('0x108'):null,'interface':_0x2f6822,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x747a('0x16')](function(_0x26b449){if(_0x5c5a6c['isMiddleware']){return _0xace615();}else{return Promise['resolve'](_0x26b449)[_0x747a('0x16')](respondWithResult(_0x4bcbd2,null));}})[_0x747a('0x55')](handleError(_0x4bcbd2,null));};exports[_0x747a('0x10b')]=function(_0x5ef49e,_0x464cd3){var _0x26b195;return db[_0x747a('0x3d')]['find']({'where':{'id':_0x5ef49e[_0x747a('0x65')]['id'],'role':'agent'},'attributes':['id',_0x747a('0x39'),_0x747a('0x2a')]})[_0x747a('0x16')](handleEntityNotFound(_0x464cd3,null))[_0x747a('0x16')](function(_0xdad7d7){if(_0xdad7d7){_0x26b195=_0xdad7d7;return db['UserVoiceQueueRt'][_0x747a('0xbb')]({'where':{'membername':_0x26b195[_0x747a('0x39')]},'individualHooks':!![]});}})['then'](function(){return db[_0x747a('0x102')][_0x747a('0x4a')]({'where':{'membername':_0x26b195[_0x747a('0x39')],'exitAt':null}});})[_0x747a('0x16')](function(_0x2ea177){var _0x60be40=[];_0x2ea177[_0x747a('0x103')](function(_0x55b6d9){_0x60be40[_0x747a('0x4f')](_0x55b6d9['update']({'exitAt':moment()[_0x747a('0xb2')](_0x747a('0x104'))}));});return Promise[_0x747a('0x54')](_0x60be40);})[_0x747a('0x16')](function(){return _0x26b195['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x464cd3,null))[_0x747a('0x55')](handleError(_0x464cd3,null));};exports[_0x747a('0x10c')]=function(_0x4dfdcd,_0x34bcf7){var _0x338568;return db['UserVoiceQueueRt'][_0x747a('0x63')]({'paused':0x1},{'where':{'UserId':_0x4dfdcd[_0x747a('0x65')]['id']},'individualHooks':!![]})[_0x747a('0x16')](function(){return db['User'][_0x747a('0x60')]({'where':{'id':_0x4dfdcd[_0x747a('0x65')]['id'],'role':_0x747a('0x2b')},'attributes':['id',_0x747a('0x39'),_0x747a('0x2a'),_0x747a('0x6a'),'interface',_0x747a('0xa5')]});})[_0x747a('0x16')](handleEntityNotFound(_0x34bcf7,null))['then'](function(_0x2cf11e){if(_0x2cf11e){_0x338568=_0x2cf11e;return respondWithRpcPromise(_0x747a('0x10d'),_0x747a('0x10c'),{'id':_0x338568['id'],'name':_0x338568[_0x747a('0x39')],'pause':!![]});}})[_0x747a('0x16')](function(){if(_0x338568){return db[_0x747a('0x102')][_0x747a('0x4a')]({'where':{'membername':_0x338568[_0x747a('0x39')],'type':_0x747a('0x107'),'exitAt':null}});}})[_0x747a('0x16')](function(_0x1acb06){if(_0x1acb06[_0x747a('0x4d')]){var _0x4b3bd4=moment()[_0x747a('0xb2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2539a1=0x0,_0x1119e7=_0x1acb06[_0x747a('0x4d')];_0x2539a1<_0x1119e7;_0x2539a1++){_0x1acb06[_0x2539a1][_0x747a('0x10e')]({'exitAt':_0x4b3bd4});}}})[_0x747a('0x16')](function(){var _0xe3bf10=[];var _0x1a6e84=utils[_0x747a('0x105')]();_0x1a6e84[_0x747a('0x103')](function(_0x400ca7){_0xe3bf10['push']({'channel':_0x400ca7,'membername':_0x338568['name'],'interface':_[_0x747a('0x6f')](_0x338568['interface'])?util[_0x747a('0xb2')](_0x747a('0xb3'),_0x338568[_0x747a('0x39')]):_0x338568[_0x747a('0xa8')],'type':_0x747a('0x107'),'enterAt':moment()[_0x747a('0xb2')](_0x747a('0x104')),'data1':_0x4dfdcd[_0x747a('0x64')][_0x747a('0x40')]||'DEFAULT\x20PAUSE','role':_0x338568[_0x747a('0x2a')],'internal':_0x338568[_0x747a('0x6a')]});});return db[_0x747a('0x102')][_0x747a('0x109')](_0xe3bf10,{'individualHooks':!![]});})[_0x747a('0x16')](function(){return _0x338568[_0x747a('0x63')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4dfdcd[_0x747a('0x64')][_0x747a('0x40')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x747a('0xb2')](_0x747a('0x104'))});})[_0x747a('0x16')](respondWithResult(_0x34bcf7,null))[_0x747a('0x55')](handleError(_0x34bcf7,null));};exports[_0x747a('0x10f')]=function(_0x133f6c,_0x4d03ff){if(_0x133f6c[_0x747a('0x64')][_0x747a('0xa4')]&&!utils['isValidChannel'](_0x133f6c[_0x747a('0x64')][_0x747a('0xa4')])){throw new APIBadRequestError(util[_0x747a('0xb2')](_0x747a('0x110'),_0x133f6c[_0x747a('0x64')][_0x747a('0xa4')]));}return db[_0x747a('0x3d')][_0x747a('0x60')]({'where':{'id':_0x133f6c['params']['id']},'attributes':['id',_0x747a('0x39'),_0x747a('0x2a'),_0x747a('0x6a'),_0x747a('0xa8'),_0x747a('0xa5'),_0x747a('0xa7'),'mailPause',_0x747a('0x111'),_0x747a('0x112'),'openchannelPause',_0x747a('0x113'),_0x747a('0x114'),'pauseType','lastPauseAt']})[_0x747a('0x16')](function(_0x336305){if(!_0x336305){throw new APINotFoundError(util['format'](_0x747a('0x115'),_0x133f6c[_0x747a('0x65')]['id']));}return _0x336305['unpause'](_0x133f6c[_0x747a('0x64')][_0x747a('0xa4')]);})[_0x747a('0x16')](respondWithResult(_0x4d03ff,null))[_0x747a('0x55')](APIHandleError(_0x4d03ff));};exports[_0x747a('0x116')]=function(_0x1bd630,_0x274faf){var _0x321c08={};var _0x513747={};var _0x158458;var _0x5a4886;return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x1bd630['params']['id']}})['then'](handleEntityNotFound(_0x274faf,null))['then'](function(_0x341a45){if(_0x341a45){_0x158458=_0x341a45;_0x513747[_0x747a('0x57')]=_['keys'](db['Team'][_0x747a('0x3e')]);_0x513747['query']=_['keys'](_0x1bd630[_0x747a('0x45')]);_0x513747[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x513747[_0x747a('0x57')],_0x513747[_0x747a('0x45')]);_0x321c08['attributes']=_[_0x747a('0x5a')](_0x513747[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x1bd630['query'][_0x747a('0x5b')]));_0x321c08[_0x747a('0x49')]=_0x321c08['attributes'][_0x747a('0x4d')]?_0x321c08[_0x747a('0x49')]:_0x513747[_0x747a('0x57')];_0x321c08[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x1bd630[_0x747a('0x45')][_0x747a('0xd1')]);_0x321c08[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x1bd630[_0x747a('0x45')],_0x513747['filters']));if(_0x1bd630[_0x747a('0x45')]['filter']){_0x321c08[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x321c08[_0x747a('0xd2')],{'$or':_['map'](_0x321c08['attributes'],function(_0x176255){var _0x1d1b1f={};_0x1d1b1f[_0x176255]={'$like':'%'+_0x1bd630[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x1d1b1f;})});}_0x321c08=_[_0x747a('0x5e')]({},_0x321c08,_0x1bd630['options']);return _0x158458['getTeams'](_0x321c08);}})[_0x747a('0x16')](function(_0x2325eb){if(_0x2325eb){_0x5a4886=_0x2325eb[_0x747a('0x4d')];if(!_0x1bd630[_0x747a('0x45')][_0x747a('0xd5')](_0x747a('0xdc'))){_0x321c08['limit']=qs['limit'](_0x1bd630[_0x747a('0x45')][_0x747a('0x27')]);_0x321c08['offset']=qs[_0x747a('0x25')](_0x1bd630[_0x747a('0x45')][_0x747a('0x25')]);}return _0x158458[_0x747a('0x116')](_0x321c08);}})[_0x747a('0x16')](function(_0x1fd8ad){if(_0x1fd8ad){return _0x1fd8ad?{'count':_0x5a4886,'rows':_0x1fd8ad}:null;}})[_0x747a('0x16')](respondWithResult(_0x274faf,null))[_0x747a('0x55')](handleError(_0x274faf,null));};exports['addTeams']=function(_0x4911e8,_0x49c90f){var _0x334de3=_0x4911e8[_0x747a('0x65')]['id'];var _0x55fd1e=_0x4911e8['body']?_0x4911e8['body'][_0x747a('0x68')]:null;var _0x18705b=[];return Promise[_0x747a('0x117')]()[_0x747a('0x16')](function(){if(!_0x55fd1e)throw new APIBadRequestError(_0x747a('0x118'));})[_0x747a('0x16')](function(){return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x334de3}});})['then'](function(_0x1a50be){if(!_0x1a50be)throw new APINotFoundError(util[_0x747a('0xb2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4911e8['params']['id']));return db['sequelize']['transaction'](function(_0x497a6e){return _0x1a50be[_0x747a('0x119')](_0x55fd1e,{'transaction':_0x497a6e})[_0x747a('0x16')](function(){return db[_0x747a('0x11a')][_0x747a('0x4a')]({'where':{'id':{'$in':_0x55fd1e}}});})[_0x747a('0x16')](function(_0x54d683){var _0x4a8cb1=_['map'](_0x54d683,function(_0x33d9a9){return _0x33d9a9[_0x747a('0x11b')]();});return Promise[_0x747a('0x54')](_0x4a8cb1);})[_0x747a('0x16')](function(_0x568ca2){_0x18705b=_[_0x747a('0x11c')](_0x568ca2);var _0x36dd1f=_['map'](_0x18705b,function(_0xe0954f){return _0xe0954f['addAgent'](_0x1a50be['id'],{'transaction':_0x497a6e});});return Promise[_0x747a('0x54')](_0x36dd1f);})[_0x747a('0x16')](function(){if(!_0x1a50be[_0x747a('0xa5')])return;var _0x37b4ca=_[_0x747a('0x34')](_0x18705b,function(_0x579e8b){return _0x579e8b['getDataValue'](_0x747a('0xa4'))===_0x747a('0x11d');});var _0x57388a=_[_0x747a('0x36')](_0x37b4ca,function(_0x139efd){return db[_0x747a('0xb5')][_0x747a('0xb6')]({'membername':_0x1a50be[_0x747a('0x39')],'UserId':_0x1a50be['id'],'queue_name':_0x139efd['name'],'VoiceQueueId':_0x139efd['id'],'interface':_['isNil'](_0x1a50be[_0x747a('0xa8')])?util[_0x747a('0xb2')](_0x747a('0xb3'),_0x1a50be[_0x747a('0x39')]):_0x1a50be[_0x747a('0xa8')],'paused':_0x1a50be[_0x747a('0xa7')]||![],'penalty':_0x1a50be[_0x747a('0xb4')]},{'transaction':_0x497a6e});});return Promise[_0x747a('0x54')](_0x57388a);})['then'](function(){return db['TeamVoicePrefix'][_0x747a('0x4a')]({'where':{'teamId':{'$in':_0x55fd1e}}});})[_0x747a('0x16')](function(_0x546d6b){var _0x2c5cf6=_[_0x747a('0x36')](_0x546d6b,function(_0x4bd062){return db[_0x747a('0x11e')][_0x747a('0x8f')]({'UserId':_0x1a50be['id'],'VoicePrefixId':_0x4bd062[_0x747a('0x11f')]},{'transaction':_0x497a6e});});return Promise[_0x747a('0x54')](_0x2c5cf6);});});})[_0x747a('0x16')](function(){for(var _0x5762b0=0x0;_0x5762b0<_0x18705b[_0x747a('0x4d')];_0x5762b0++){var _0x13cc25=_0x18705b[_0x5762b0][_0x747a('0x120')](_0x747a('0xa4'));var _0x38f354=_0x13cc25+_0x747a('0xb9');socket['emit'](_0x747a('0x30')+_0x13cc25+_0x747a('0xb0'),{'UserId':_0x334de3,['queueField']:_0x18705b[_0x5762b0]['id']});}})['then'](respondWithStatusCode(_0x49c90f,null))['catch'](APIHandleError(_0x49c90f));};exports[_0x747a('0x121')]=function(_0x27d240,_0x1fa76e){var _0x17df4d=_0x27d240[_0x747a('0x65')]['id'];var _0x4eb305=null;if(_0x27d240['query'][_0x747a('0x68')]){_0x4eb305=_[_0x747a('0xb8')](_0x27d240[_0x747a('0x45')]['ids'])?_0x27d240['query'][_0x747a('0x68')]:[_0x27d240[_0x747a('0x45')][_0x747a('0x68')]];}var _0x55c28f=[];return Promise['resolve']()['then'](function(){if(!_0x4eb305)throw new APIBadRequestError(_0x747a('0x122'));})[_0x747a('0x16')](function(){return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x17df4d}});})[_0x747a('0x16')](function(_0x5b664d){if(!_0x5b664d)throw new APINotFoundError(util[_0x747a('0xb2')](_0x747a('0x115'),_0x27d240[_0x747a('0x65')]['id']));return db[_0x747a('0x71')]['transaction'](function(_0x5561fa){return _0x5b664d[_0x747a('0x121')](_0x4eb305,{'transaction':_0x5561fa})['then'](function(){return db[_0x747a('0x11a')]['findAll']({'where':{'id':{'$in':_0x4eb305}}});})[_0x747a('0x16')](function(_0x5da31e){var _0x22bd8d=_[_0x747a('0x36')](_0x5da31e,function(_0x33f6c9){return _0x33f6c9['getAssociatedQueues']();});return Promise[_0x747a('0x54')](_0x22bd8d);})[_0x747a('0x16')](function(_0x2273cd){_0x55c28f=_[_0x747a('0x11c')](_0x2273cd);var _0x22ee79=_[_0x747a('0x36')](_0x55c28f,function(_0x416e8d){return _0x416e8d[_0x747a('0x123')](_0x5b664d['id'],{'transaction':_0x5561fa});});return Promise['all'](_0x22ee79);})['then'](function(){if(!_0x5b664d['online'])return;var _0x5a880e=_[_0x747a('0x34')](_0x55c28f,function(_0xd0c757){return _0xd0c757[_0x747a('0x120')]('channel')==='Voice';});var _0x1fe424=_[_0x747a('0x36')](_0x5a880e,function(_0x3c305c){return db['UserVoiceQueueRt'][_0x747a('0xbb')]({'where':{'VoiceQueueId':_0x3c305c['id'],'UserId':_0x5b664d['id']},'transaction':_0x5561fa});});return Promise['all'](_0x1fe424);})[_0x747a('0x16')](function(){return db[_0x747a('0x124')][_0x747a('0x4a')]({'where':{'teamId':{'$in':_0x4eb305}}});})['then'](function(_0x470ba0){var _0x2c67e6=_[_0x747a('0x36')](_0x470ba0,function(_0x20f099){return db[_0x747a('0x11e')][_0x747a('0xbb')]({'where':{'UserId':_0x5b664d['id'],'VoicePrefixId':_0x20f099['VoicePrefixId']}},{'transaction':_0x5561fa});});return Promise[_0x747a('0x54')](_0x2c67e6);});});})[_0x747a('0x16')](function(){for(var _0x225601=0x0;_0x225601<_0x55c28f[_0x747a('0x4d')];_0x225601++){var _0x4457d3=_0x55c28f[_0x225601][_0x747a('0x120')](_0x747a('0xa4'));var _0x35e29c=_0x4457d3+_0x747a('0xb9');socket[_0x747a('0x2c')](_0x747a('0x30')+_0x4457d3+'Queue:remove',{'UserId':_0x17df4d,['queueField']:_0x55c28f[_0x225601]['id']});}})[_0x747a('0x16')](respondWithStatusCode(_0x1fa76e,null))[_0x747a('0x55')](APIHandleError(_0x1fa76e));};exports['getLists']=function(_0x1a7e6d,_0xb4fa00){var _0x25905f={};var _0x523cb3={};var _0x20b904;var _0x254ad4;return db[_0x747a('0x3d')]['findOne']({'where':{'id':_0x1a7e6d[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0xb4fa00,null))[_0x747a('0x16')](function(_0x541a77){if(_0x541a77){_0x20b904=_0x541a77;_0x523cb3[_0x747a('0x57')]=_[_0x747a('0x59')](db[_0x747a('0xd6')][_0x747a('0x3e')]);_0x523cb3[_0x747a('0x45')]=_[_0x747a('0x59')](_0x1a7e6d['query']);_0x523cb3[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x523cb3['model'],_0x523cb3[_0x747a('0x45')]);_0x25905f[_0x747a('0x49')]=_['intersection'](_0x523cb3['model'],qs[_0x747a('0x5b')](_0x1a7e6d[_0x747a('0x45')][_0x747a('0x5b')]));_0x25905f[_0x747a('0x49')]=_0x25905f[_0x747a('0x49')]['length']?_0x25905f['attributes']:_0x523cb3['model'];_0x25905f[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x1a7e6d[_0x747a('0x45')]['sort']);_0x25905f[_0x747a('0xd2')]=qs[_0x747a('0xd3')](_[_0x747a('0xd4')](_0x1a7e6d[_0x747a('0x45')],_0x523cb3[_0x747a('0xd3')]));if(_0x1a7e6d[_0x747a('0x45')][_0x747a('0x34')]){_0x25905f[_0x747a('0xd2')]=_[_0x747a('0x5e')](_0x25905f[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x25905f[_0x747a('0x49')],function(_0xa34622){var _0x25ffc6={};_0x25ffc6[_0xa34622]={'$like':'%'+_0x1a7e6d[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x25ffc6;})});}_0x25905f=_[_0x747a('0x5e')]({},_0x25905f,_0x1a7e6d['options']);return _0x20b904[_0x747a('0x125')](_0x25905f);}})[_0x747a('0x16')](function(_0x522118){if(_0x522118){_0x254ad4=_0x522118[_0x747a('0x4d')];if(!_0x1a7e6d[_0x747a('0x45')]['hasOwnProperty'](_0x747a('0xdc'))){_0x25905f['limit']=qs[_0x747a('0x27')](_0x1a7e6d[_0x747a('0x45')][_0x747a('0x27')]);_0x25905f[_0x747a('0x25')]=qs['offset'](_0x1a7e6d[_0x747a('0x45')]['offset']);}return _0x20b904[_0x747a('0x125')](_0x25905f);}})[_0x747a('0x16')](function(_0x2c25f2){if(_0x2c25f2){return _0x2c25f2?{'count':_0x254ad4,'rows':_0x2c25f2}:null;}})['then'](respondWithResult(_0xb4fa00,null))[_0x747a('0x55')](handleError(_0xb4fa00,null));};exports['getAgents']=function(_0x4665a4,_0x534372){var _0x19341c={};var _0x287f09={};var _0x67dc53;return db[_0x747a('0x3d')][_0x747a('0x9d')]({'where':{'id':_0x4665a4[_0x747a('0x65')]['id']}})[_0x747a('0x16')](handleEntityNotFound(_0x534372,null))[_0x747a('0x16')](function(_0x225357){if(_0x225357){_0x67dc53=_0x225357;_0x287f09['model']=_['keys'](db[_0x747a('0x3d')]['rawAttributes']);_0x287f09[_0x747a('0x45')]=_[_0x747a('0x59')](_0x4665a4[_0x747a('0x45')]);_0x287f09[_0x747a('0xd3')]=_[_0x747a('0x5a')](_0x287f09[_0x747a('0x57')],_0x287f09['query']);_0x19341c[_0x747a('0x49')]=_[_0x747a('0x5a')](_0x287f09[_0x747a('0x57')],qs[_0x747a('0x5b')](_0x4665a4[_0x747a('0x45')][_0x747a('0x5b')]));_0x19341c['attributes']=_0x19341c[_0x747a('0x49')][_0x747a('0x4d')]?_0x19341c[_0x747a('0x49')]:_0x287f09[_0x747a('0x57')];_0x19341c[_0x747a('0xde')]=qs[_0x747a('0xd1')](_0x4665a4[_0x747a('0x45')]['sort']);_0x19341c[_0x747a('0xd2')]=qs['filters'](_[_0x747a('0xd4')](_0x4665a4[_0x747a('0x45')],_0x287f09[_0x747a('0xd3')]));if(_0x4665a4['query']['filter']){_0x19341c[_0x747a('0xd2')]=_['merge'](_0x19341c[_0x747a('0xd2')],{'$or':_[_0x747a('0x36')](_0x19341c[_0x747a('0x49')],function(_0x261d68){var _0x16b0ae={};_0x16b0ae[_0x261d68]={'$like':'%'+_0x4665a4[_0x747a('0x45')][_0x747a('0x34')]+'%'};return _0x16b0ae;})});}_0x19341c[_0x747a('0x57')]=db[_0x747a('0x3d')];_0x19341c['as']=_0x747a('0x31');_0x19341c=_['merge']({},_0x19341c,_0x4665a4[_0x747a('0x5f')]);return _0x67dc53[_0x747a('0x100')]({'include':[_0x19341c]});}})[_0x747a('0x16')](function(_0x339513){if(_0x339513){var _0x406455={},_0x4ac839=[];for(var _0x41c07b=0x0;_0x41c07b<_0x339513['length'];_0x41c07b+=0x1){for(var _0x29104d=0x0,_0x8b52c0;_0x29104d<_0x339513[_0x41c07b]['Agents'][_0x747a('0x4d')];_0x29104d+=0x1){_0x8b52c0=_0x339513[_0x41c07b][_0x747a('0x31')][_0x29104d]['get']({'plain':!![]});_0x406455[_0x8b52c0['id']]=_0x8b52c0;}}_0x406455=_[_0x747a('0x126')](_0x406455);for(var _0x367b83=qs['offset'](_0x4665a4['query'][_0x747a('0x25')]);_0x367b83<_0x406455[_0x747a('0x4d')]&&_0x4ac839[_0x747a('0x4d')]=_0x1b22cc[_0x4771('0x4d')]){throw new Error(_0x4771('0x4e'));}})[_0x4771('0x22')](function(){if(_0x4c7a30){return db[_0x4771('0x45')]['destroy']({'where':{'membername':_0x4c7a30['name']},'individualHooks':!![]});}})[_0x4771('0x22')](function(){if(_0x4c7a30){return _0x4c7a30['getVoiceQueues']({'raw':!![]});}})[_0x4771('0x22')](function(_0x2d222a){if(_0x4c7a30){if(_0x2d222a){var _0x353358=[];_0x4e2d5e=_0x2d222a;if(_0x4e2d5e[_0x4771('0x29')]){for(var _0x250a41=0x0;_0x250a41<_0x4e2d5e[_0x4771('0x29')];_0x250a41++){_0x353358[_0x4771('0x2e')](db[_0x4771('0x45')][_0x4771('0x4f')]({'membername':_0x4c7a30[_0x4771('0x1f')],'UserId':_0x4c7a30['id'],'queue_name':_0x4e2d5e[_0x250a41][_0x4771('0x1f')],'VoiceQueueId':_0x4e2d5e[_0x250a41]['id'],'interface':_0xa09be0,'paused':_0x4c7a30['loginInPause']||![],'penalty':_0x4e2d5e[_0x250a41][_0x4771('0x50')]||0x0}));}return BPromise[_0x4771('0x47')](_0x353358);}}}})[_0x4771('0x22')](function(){if(_0x4c7a30){return db[_0x4771('0x27')][_0x4771('0xd')]({'where':{'membername':_0x4c7a30[_0x4771('0x1f')],'exitAt':null}});}})['then'](function(_0x369095){if(_0x4c7a30){if(_0x369095&&_0x369095[_0x4771('0x29')]){var _0x2f1951=[];_0x369095[_0x4771('0x2d')](function(_0x889a67){_0x2f1951[_0x4771('0x2e')](_0x889a67[_0x4771('0x26')]({'exitAt':moment()['format'](_0x4771('0x2a'))}));});return BPromise[_0x4771('0x47')](_0x2f1951);}}})[_0x4771('0x22')](function(){if(_0x4c7a30){var _0x36edbf=[];var _0x5f3ecd=[];var _0x4aeb7e=utils[_0x4771('0x2c')]();var _0x151057={'membername':_0x4c7a30[_0x4771('0x1f')],'interface':_0xa09be0,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4c7a30['role'],'internal':_0x4c7a30[_0x4771('0x21')]};_0x4aeb7e[_0x4771('0x2d')](function(_0xccf93){_0x36edbf[_0x4771('0x2e')](_[_0x4771('0x51')]({'channel':_0xccf93,'type':_0x4771('0x52'),'data1':_0x4771('0x53'),'data2':_0xa09be0},_0x151057));if(_0x4c7a30[_0x4771('0x54')]){_0x5f3ecd[_0x4771('0x2e')](_[_0x4771('0x51')]({'channel':_0xccf93,'type':_0x4771('0x28'),'data1':_0x4771('0x55')},_0x151057));}});return db[_0x4771('0x27')]['bulkCreate'](_0x36edbf['concat'](_0x5f3ecd),{'individualHooks':!![]});}})[_0x4771('0x22')](function(){if(_0x4c7a30){return _0x4c7a30[_0x4771('0x26')]({'online':!![],'lastLoginAt':moment()[_0x4771('0x23')](_0x4771('0x2a')),'voicePause':_0x4c7a30[_0x4771('0x54')]||![],'mailPause':_0x4c7a30[_0x4771('0x54')]||![],'chatPause':_0x4c7a30[_0x4771('0x54')]||![],'faxPause':_0x4c7a30[_0x4771('0x54')]||![],'smsPause':_0x4c7a30['loginInPause']||![],'openchannelPause':_0x4c7a30[_0x4771('0x54')]||![],'pauseType':_0x4c7a30[_0x4771('0x54')]?_0x4771('0x55'):null,'lastPauseAt':moment()[_0x4771('0x23')](_0x4771('0x2a')),'interface':_0xa09be0});}})[_0x4771('0x22')](function(_0x20457b){_0x48e484(_0x20457b);})[_0x4771('0x17')](function(_0x20563f){_0x460dd8(_0x352833['error'](0x1f4,_0x20563f[_0x4771('0x1d')]));});});}; \ No newline at end of file +var _0x58ca=['concat','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','redis','localhost','./user.socket','register','GetUser','findAll','options','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowUser','User','find','raw','where','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','push','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','UnpauseUser','resolve','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','findOne','online','mailPause','chatPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','forEach','all','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate'];(function(_0x5aed32,_0xa9a87b){var _0x349427=function(_0x7f12b5){while(--_0x7f12b5){_0x5aed32['push'](_0x5aed32['shift']());}};_0x349427(++_0xa9a87b);}(_0x58ca,0x1c3));var _0xa58c=function(_0x2fbf1f,_0x87cd09){_0x2fbf1f=_0x2fbf1f-0x0;var _0x52ae9e=_0x58ca[_0x2fbf1f];return _0x52ae9e;};'use strict';var _=require(_0xa58c('0x0'));var util=require(_0xa58c('0x1'));var moment=require('moment');var BPromise=require(_0xa58c('0x2'));var Redis=require(_0xa58c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa58c('0x4'));var logger=require(_0xa58c('0x5'))('rpc');var config=require(_0xa58c('0x6'));config[_0xa58c('0x7')]=_['defaults'](config['redis'],{'host':_0xa58c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa58c('0x7')]));require(_0xa58c('0x9'))[_0xa58c('0xa')](socket);exports[_0xa58c('0xb')]=function(_0x390979){var _0xaca0b1=this;return new Promise(function(_0x21334a,_0x44f5f9){return db['User'][_0xa58c('0xc')]({'raw':_0x390979[_0xa58c('0xd')]?_0x390979['options']['raw']===undefined?!![]:![]:!![],'where':_0x390979[_0xa58c('0xd')]?_0x390979[_0xa58c('0xd')]['where']||null:null,'attributes':_0x390979['options']?_0x390979['options'][_0xa58c('0xe')]||null:null,'limit':_0x390979['options']?_0x390979[_0xa58c('0xd')][_0xa58c('0xf')]||null:null,'include':_0x390979[_0xa58c('0xd')]?_0x390979[_0xa58c('0xd')][_0xa58c('0x10')]?_['map'](_0x390979['options'][_0xa58c('0x10')],function(_0x3bcd37){return{'model':db[_0x3bcd37[_0xa58c('0x11')]],'as':_0x3bcd37['as'],'attributes':_0x3bcd37[_0xa58c('0xe')],'include':_0x3bcd37['include']?_[_0xa58c('0x12')](_0x3bcd37[_0xa58c('0x10')],function(_0x678a72){return{'model':db[_0x678a72['model']],'as':_0x678a72['as'],'attributes':_0x678a72[_0xa58c('0xe')],'include':_0x678a72[_0xa58c('0x10')]?_[_0xa58c('0x12')](_0x678a72['include'],function(_0x3df37a){return{'model':db[_0x3df37a['model']],'as':_0x3df37a['as'],'attributes':_0x3df37a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa58c('0x13')](function(_0x35cd3f){logger[_0xa58c('0x14')](_0xa58c('0xb'),_0x390979);logger[_0xa58c('0x15')]('GetUser',_0x390979,JSON[_0xa58c('0x16')](_0x35cd3f));_0x21334a(_0x35cd3f);})[_0xa58c('0x17')](function(_0xd95861){logger[_0xa58c('0x18')]('GetUser',_0xd95861[_0xa58c('0x19')],_0x390979);_0x44f5f9(_0xaca0b1[_0xa58c('0x18')](0x1f4,_0xd95861[_0xa58c('0x19')]));});});};exports[_0xa58c('0x1a')]=function(_0x177cb2){var _0x5a059f=this;return new Promise(function(_0x210554,_0x28cae2){return db[_0xa58c('0x1b')][_0xa58c('0x1c')]({'raw':_0x177cb2['options']?_0x177cb2[_0xa58c('0xd')][_0xa58c('0x1d')]===undefined?!![]:![]:!![],'where':_0x177cb2['options']?_0x177cb2['options'][_0xa58c('0x1e')]||null:null,'attributes':_0x177cb2[_0xa58c('0xd')]?_0x177cb2[_0xa58c('0xd')][_0xa58c('0xe')]||null:null,'include':_0x177cb2[_0xa58c('0xd')]?_0x177cb2[_0xa58c('0xd')]['include']?_[_0xa58c('0x12')](_0x177cb2[_0xa58c('0xd')][_0xa58c('0x10')],function(_0x2d98f9){return{'model':db[_0x2d98f9['model']],'as':_0x2d98f9['as'],'attributes':_0x2d98f9[_0xa58c('0xe')],'include':_0x2d98f9['include']?_[_0xa58c('0x12')](_0x2d98f9[_0xa58c('0x10')],function(_0x1abcb0){return{'model':db[_0x1abcb0[_0xa58c('0x11')]],'as':_0x1abcb0['as'],'attributes':_0x1abcb0['attributes'],'include':_0x1abcb0[_0xa58c('0x10')]?_[_0xa58c('0x12')](_0x1abcb0[_0xa58c('0x10')],function(_0x15828a){return{'model':db[_0x15828a[_0xa58c('0x11')]],'as':_0x15828a['as'],'attributes':_0x15828a[_0xa58c('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa58c('0x13')](function(_0x3c07a9){logger['info'](_0xa58c('0x1a'),_0x177cb2);logger[_0xa58c('0x15')](_0xa58c('0x1a'),_0x177cb2,JSON[_0xa58c('0x16')](_0x3c07a9));_0x210554(_0x3c07a9);})[_0xa58c('0x17')](function(_0x1fa0d6){logger[_0xa58c('0x18')](_0xa58c('0x1a'),_0x1fa0d6[_0xa58c('0x19')],_0x177cb2);_0x28cae2(_0x5a059f[_0xa58c('0x18')](0x1f4,_0x1fa0d6[_0xa58c('0x19')]));});});};exports[_0xa58c('0x1f')]=function(_0x9a8986){var _0x28a3b4;return db[_0xa58c('0x1b')][_0xa58c('0x1c')]({'where':_0x9a8986[_0xa58c('0xd')]['where']||{},'attributes':['id',_0xa58c('0x20'),_0xa58c('0x21'),_0xa58c('0x22'),_0xa58c('0x23')]})['then'](function(_0xdaebca){if(!_0xdaebca){throw new Error(util[_0xa58c('0x24')](_0xa58c('0x25'),_0x9a8986[_0xa58c('0x26')]['id']));}_0x28a3b4=_0xdaebca;return db[_0xa58c('0x27')][_0xa58c('0x28')]({'paused':0x1},{'where':{'UserId':_0x28a3b4['id']},'individualHooks':!![]});})[_0xa58c('0x13')](function(){return db[_0xa58c('0x29')][_0xa58c('0xc')]({'where':{'membername':_0x28a3b4[_0xa58c('0x20')],'type':_0xa58c('0x2a'),'exitAt':null}});})[_0xa58c('0x13')](function(_0x1fdeff){if(_0x1fdeff&&_0x1fdeff['length']){var _0x7ae0d=moment()['format'](_0xa58c('0x2b'));for(var _0x937564=0x0,_0x1782b7=_0x1fdeff[_0xa58c('0x2c')];_0x937564<_0x1782b7;_0x937564++){_0x1fdeff[_0x937564][_0xa58c('0x2d')]({'exitAt':_0x7ae0d});}}})['then'](function(){var _0x41094e=[];var _0x326bee=utils[_0xa58c('0x2e')]();_0x326bee['forEach'](function(_0x4a67f7){_0x41094e[_0xa58c('0x2f')]({'channel':_0x4a67f7,'membername':_0x28a3b4[_0xa58c('0x20')],'interface':_['isNil'](_0x28a3b4[_0xa58c('0x23')])?util['format'](_0xa58c('0x30'),_0x28a3b4[_0xa58c('0x20')]):_0x28a3b4[_0xa58c('0x23')],'type':_0xa58c('0x2a'),'enterAt':moment()[_0xa58c('0x24')](_0xa58c('0x2b')),'data1':_0x9a8986[_0xa58c('0x31')][_0xa58c('0x32')]||_0xa58c('0x33'),'role':_0x28a3b4['role'],'internal':_0x28a3b4[_0xa58c('0x22')],'uniqueid':_0x9a8986['body'][_0xa58c('0x34')]||null});});return db[_0xa58c('0x29')]['bulkCreate'](_0x41094e,{'individualHooks':!![]});})[_0xa58c('0x13')](function(){return _0x28a3b4[_0xa58c('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x9a8986['body'][_0xa58c('0x32')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xa58c('0x24')](_0xa58c('0x2b'))});})['catch'](function(_0x93dde3){throw _0x93dde3;});};exports[_0xa58c('0x35')]=function(_0xfe664c){return Promise[_0xa58c('0x36')]()['then'](function(){if(_0xfe664c[_0xa58c('0x31')]['channel']&&!utils[_0xa58c('0x37')](_0xfe664c[_0xa58c('0x31')]['channel'])){throw new Error(util['format'](_0xa58c('0x38'),_0xfe664c[_0xa58c('0x31')][_0xa58c('0x39')]));}return db[_0xa58c('0x1b')][_0xa58c('0x3a')]({'where':_0xfe664c[_0xa58c('0xd')][_0xa58c('0x1e')]||{},'attributes':['id',_0xa58c('0x20'),_0xa58c('0x21'),_0xa58c('0x22'),_0xa58c('0x23'),_0xa58c('0x3b'),'voicePause',_0xa58c('0x3c'),_0xa58c('0x3d'),'faxPause','openchannelPause',_0xa58c('0x3e'),_0xa58c('0x3f'),_0xa58c('0x40'),_0xa58c('0x41')]});})['then'](function(_0x50c06d){if(!_0x50c06d){throw new Error(util[_0xa58c('0x24')](_0xa58c('0x25'),_0xfe664c['params']['id']));}return _0x50c06d[_0xa58c('0x42')](_0xfe664c[_0xa58c('0x31')][_0xa58c('0x39')],_0xa58c('0x43'));})[_0xa58c('0x17')](function(_0xb994b3){throw _0xb994b3;});};exports[_0xa58c('0x44')]=function(_0x4319ce){var _0x13c826=this;return new Promise(function(_0x820db7,_0x2bff29){var _0x444a87;return db[_0xa58c('0x1b')]['findOne']({'where':_0x4319ce[_0xa58c('0xd')][_0xa58c('0x1e')]||{},'attributes':['id',_0xa58c('0x20')]})[_0xa58c('0x13')](function(_0x55c248){if(_0x55c248){_0x444a87=_0x55c248;return db[_0xa58c('0x27')][_0xa58c('0x45')]({'where':{'membername':_0x444a87[_0xa58c('0x20')]},'individualHooks':!![]});}})['then'](function(){if(_0x444a87){return db[_0xa58c('0x29')][_0xa58c('0xc')]({'where':{'membername':_0x444a87[_0xa58c('0x20')],'exitAt':null}});}})[_0xa58c('0x13')](function(_0x1be547){if(_0x444a87){if(_0x1be547&&_0x1be547[_0xa58c('0x2c')]){var _0x13a084=[];_0x1be547['forEach'](function(_0x2aba2b){_0x13a084[_0xa58c('0x2f')](_0x2aba2b[_0xa58c('0x28')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x13a084);}}})['then'](function(){if(_0x444a87){return _0x444a87[_0xa58c('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa58c('0x13')](function(_0x573198){_0x820db7(_0x573198);})['catch'](function(_0x5b325c){_0x2bff29(_0x13c826['error'](0x1f4,_0x5b325c[_0xa58c('0x19')]));});});};exports[_0xa58c('0x46')]=function(_0x5ee855){var _0x578429=this;return new Promise(function(_0x35b24b,_0xb53454){var _0x117e02;var _0x3a72cf;var _0x3cf60e;var _0x5ab5b7;return db[_0xa58c('0x1b')]['findOne']({'where':_0x5ee855[_0xa58c('0xd')]['where']||{},'attributes':['id',_0xa58c('0x20'),_0xa58c('0x21'),_0xa58c('0x47'),_0xa58c('0x48'),_0xa58c('0x22'),_0xa58c('0x49'),_0xa58c('0x23')]})[_0xa58c('0x13')](function(_0xd02e6e){if(_0xd02e6e){_0x117e02=_0xd02e6e;_0x5ab5b7=_0x5ee855[_0xa58c('0x31')][_0xa58c('0x23')]?_0x5ee855[_0xa58c('0x31')][_0xa58c('0x23')]:util[_0xa58c('0x24')](_0xa58c('0x30'),_0x117e02['name']);return db['User'][_0xa58c('0x4a')]({'where':{'role':_0xa58c('0x4b'),'online':!![],'id':{'$ne':_0x117e02['id']}}});}})[_0xa58c('0x13')](function(_0x4d65c0){if(_0x4d65c0){_0x3cf60e=_0x4d65c0;return require(_0xa58c('0x4c'))[_0xa58c('0x4d')]();}})[_0xa58c('0x13')](function(_0x551e0f){if(_0x551e0f&&_0x551e0f['agents']&&_0x3cf60e>=_0x551e0f[_0xa58c('0x4e')]){throw new Error(_0xa58c('0x4f'));}})[_0xa58c('0x13')](function(){if(_0x117e02){return db[_0xa58c('0x27')][_0xa58c('0x45')]({'where':{'membername':_0x117e02[_0xa58c('0x20')]},'individualHooks':!![]});}})['then'](function(){if(_0x117e02){return _0x117e02['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x192e87){if(_0x117e02){if(_0x192e87){var _0x35d6f5=[];_0x3a72cf=_0x192e87;if(_0x3a72cf[_0xa58c('0x2c')]){for(var _0x32f327=0x0;_0x32f327<_0x3a72cf[_0xa58c('0x2c')];_0x32f327++){_0x35d6f5[_0xa58c('0x2f')](db[_0xa58c('0x27')][_0xa58c('0x50')]({'membername':_0x117e02[_0xa58c('0x20')],'UserId':_0x117e02['id'],'queue_name':_0x3a72cf[_0x32f327][_0xa58c('0x20')],'VoiceQueueId':_0x3a72cf[_0x32f327]['id'],'interface':_0x5ab5b7,'paused':_0x117e02[_0xa58c('0x49')]||![],'penalty':_0x3a72cf[_0x32f327][_0xa58c('0x51')]||0x0}));}return BPromise['all'](_0x35d6f5);}}}})['then'](function(){if(_0x117e02){return db[_0xa58c('0x29')][_0xa58c('0xc')]({'where':{'membername':_0x117e02[_0xa58c('0x20')],'exitAt':null}});}})[_0xa58c('0x13')](function(_0x2321a7){if(_0x117e02){if(_0x2321a7&&_0x2321a7[_0xa58c('0x2c')]){var _0x1f204e=[];_0x2321a7[_0xa58c('0x52')](function(_0x263267){_0x1f204e[_0xa58c('0x2f')](_0x263267[_0xa58c('0x28')]({'exitAt':moment()['format'](_0xa58c('0x2b'))}));});return BPromise[_0xa58c('0x53')](_0x1f204e);}}})[_0xa58c('0x13')](function(){if(_0x117e02){var _0x11e912=[];var _0x4b2b47=[];var _0x1f0174=utils[_0xa58c('0x2e')]();var _0x111058={'membername':_0x117e02[_0xa58c('0x20')],'interface':_0x5ab5b7,'enterAt':moment()['format'](_0xa58c('0x2b')),'role':_0x117e02[_0xa58c('0x21')],'internal':_0x117e02['internal']};_0x1f0174[_0xa58c('0x52')](function(_0x197f05){_0x11e912[_0xa58c('0x2f')](_[_0xa58c('0x54')]({'channel':_0x197f05,'type':_0xa58c('0x55'),'data1':_0xa58c('0x56'),'data2':_0x5ab5b7},_0x111058));if(_0x117e02[_0xa58c('0x49')]){_0x4b2b47[_0xa58c('0x2f')](_[_0xa58c('0x54')]({'channel':_0x197f05,'type':'PAUSE','data1':_0xa58c('0x57')},_0x111058));}});return db[_0xa58c('0x29')][_0xa58c('0x58')](_0x11e912[_0xa58c('0x59')](_0x4b2b47),{'individualHooks':!![]});}})[_0xa58c('0x13')](function(){if(_0x117e02){return _0x117e02[_0xa58c('0x28')]({'online':!![],'lastLoginAt':moment()['format'](_0xa58c('0x2b')),'voicePause':_0x117e02[_0xa58c('0x49')]||![],'mailPause':_0x117e02[_0xa58c('0x49')]||![],'chatPause':_0x117e02[_0xa58c('0x49')]||![],'faxPause':_0x117e02[_0xa58c('0x49')]||![],'smsPause':_0x117e02[_0xa58c('0x49')]||![],'openchannelPause':_0x117e02[_0xa58c('0x49')]||![],'pauseType':_0x117e02[_0xa58c('0x49')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xa58c('0x24')](_0xa58c('0x2b')),'interface':_0x5ab5b7});}})[_0xa58c('0x13')](function(_0x3ce1cc){_0x35b24b(_0x3ce1cc);})[_0xa58c('0x17')](function(_0x268ef0){_0xb53454(_0x578429[_0xa58c('0x18')](0x1f4,_0x268ef0[_0xa58c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 07ce3f8..640f9b4 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf08c=['save','update','emit','removeListener','length'];(function(_0xf9c7cb,_0x4a68d7){var _0x313f59=function(_0x387de2){while(--_0x387de2){_0xf9c7cb['push'](_0xf9c7cb['shift']());}};_0x313f59(++_0x4a68d7);}(_0xf08c,0x14a));var _0xcf08=function(_0x596fc6,_0x2ffdb3){_0x596fc6=_0x596fc6-0x0;var _0x2cfef3=_0xf08c[_0x596fc6];return _0x2cfef3;};'use strict';var UserEvents=require('./user.events');var events=[_0xcf08('0x0'),'remove',_0xcf08('0x1')];function createListener(_0x140a64,_0xeb1cfc){return function(_0x5d0404){_0xeb1cfc[_0xcf08('0x2')](_0x140a64,_0x5d0404);};}function removeListener(_0x45b247,_0x413ae1){return function(){UserEvents[_0xcf08('0x3')](_0x45b247,_0x413ae1);};}exports['register']=function(_0x49cc4e){for(var _0xf24510=0x0,_0x7da1c9=events[_0xcf08('0x4')];_0xf24510<_0x7da1c9;_0xf24510++){var _0x5b6f73=events[_0xf24510];var _0x1e85f9=createListener('user:'+_0x5b6f73,_0x49cc4e);UserEvents['on'](_0x5b6f73,_0x1e85f9);}}; \ No newline at end of file +var _0x7e8c=['emit','removeListener','length','user:','./user.events','remove','update'];(function(_0x56f378,_0x2ba3ae){var _0x53fc30=function(_0x1251c9){while(--_0x1251c9){_0x56f378['push'](_0x56f378['shift']());}};_0x53fc30(++_0x2ba3ae);}(_0x7e8c,0x138));var _0xc7e8=function(_0x2f1e6f,_0x35bcec){_0x2f1e6f=_0x2f1e6f-0x0;var _0x274274=_0x7e8c[_0x2f1e6f];return _0x274274;};'use strict';var UserEvents=require(_0xc7e8('0x0'));var events=['save',_0xc7e8('0x1'),_0xc7e8('0x2')];function createListener(_0xfdf9fe,_0x203710){return function(_0x4d065f){_0x203710[_0xc7e8('0x3')](_0xfdf9fe,_0x4d065f);};}function removeListener(_0x25b802,_0x5e9e97){return function(){UserEvents[_0xc7e8('0x4')](_0x25b802,_0x5e9e97);};}exports['register']=function(_0xa3a821){for(var _0x38def9=0x0,_0x5cb367=events[_0xc7e8('0x5')];_0x38def9<_0x5cb367;_0x38def9++){var _0x33b6c5=events[_0x38def9];var _0x1689b5=createListener(_0xc7e8('0x6')+_0x33b6c5,_0xa3a821);UserEvents['on'](_0x33b6c5,_0x1689b5);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 99c644a..07506b4 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3a374e,_0x37b3e6){var _0x439094=function(_0x342335){while(--_0x342335){_0x3a374e['push'](_0x3a374e['shift']());}};_0x439094(++_0x37b3e6);}(_0x70e0,0x17b));var _0x070e=function(_0x412d54,_0x574304){_0x412d54=_0x412d54-0x0;var _0x5896b6=_0x70e0[_0x412d54];return _0x5896b6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3a0d88,_0x1e16b9){var _0x44beda=function(_0xf30746){while(--_0xf30746){_0x3a0d88['push'](_0x3a0d88['shift']());}};_0x44beda(++_0x1e16b9);}(_0x70e0,0x17b));var _0x070e=function(_0x2358a7,_0x363c9c){_0x2358a7=_0x2358a7-0x0;var _0x14fff9=_0x70e0[_0x2358a7];return _0x14fff9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 4631eef..460fb1e 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5395=['sequelize','INTEGER'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x5395,0x150));var _0x5539=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5395[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x5539('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5539('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x85da=['sequelize','INTEGER'];(function(_0xf56404,_0x4fc027){var _0x5cfc63=function(_0xb0aa1b){while(--_0xb0aa1b){_0xf56404['push'](_0xf56404['shift']());}};_0x5cfc63(++_0x4fc027);}(_0x85da,0x1ae));var _0xa85d=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x85da[_0x5d1044];return _0x3cd90e;};'use strict';var Sequelize=require(_0xa85d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa85d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index ebc4c7a..72e49da 100644 --- a/server/api/userChatQueue/userChatQueue.model.js +++ b/server/api/userChatQueue/userChatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa596=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','user_has_chat_queues','lodash'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xa596,0x14c));var _0x6a59=function(_0x11707c,_0x5183bb){_0x11707c=_0x11707c-0x0;var _0x5da74a=_0xa596[_0x11707c];return _0x5da74a;};'use strict';var _=require(_0x6a59('0x0'));var util=require('util');var logger=require(_0x6a59('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6a59('0x2'));var rp=require(_0x6a59('0x3'));var fs=require('fs');var path=require(_0x6a59('0x4'));var rimraf=require(_0x6a59('0x5'));var config=require(_0x6a59('0x6'));var attributes=require(_0x6a59('0x7'));module['exports']=function(_0x9009e9,_0x2a21c1){return _0x9009e9['define']('UserChatQueue',attributes,{'tableName':_0x6a59('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3c3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x4c216d,_0xa56656){var _0x1925c7=function(_0x47ea74){while(--_0x47ea74){_0x4c216d['push'](_0x4c216d['shift']());}};_0x1925c7(++_0xa56656);}(_0xf3c3,0xdd));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f3c('0x0'));var util=require(_0x3f3c('0x1'));var logger=require(_0x3f3c('0x2'))(_0x3f3c('0x3'));var moment=require(_0x3f3c('0x4'));var BPromise=require(_0x3f3c('0x5'));var rp=require(_0x3f3c('0x6'));var fs=require('fs');var path=require(_0x3f3c('0x7'));var rimraf=require(_0x3f3c('0x8'));var config=require(_0x3f3c('0x9'));var attributes=require('./userChatQueue.attributes');module[_0x3f3c('0xa')]=function(_0x476cd6,_0xa952e8){return _0x476cd6[_0x3f3c('0xb')](_0x3f3c('0xc'),attributes,{'tableName':_0x3f3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 1477348..5c511b1 100644 --- a/server/api/userChatQueue/userChatQueue.rpc.js +++ b/server/api/userChatQueue/userChatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d42=['../../config/environment','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1ac9a9,_0x3752f3){var _0x39dad9=function(_0x5d532b){while(--_0x5d532b){_0x1ac9a9['push'](_0x1ac9a9['shift']());}};_0x39dad9(++_0x3752f3);}(_0x0d42,0x72));var _0x20d4=function(_0x5871f9,_0x28ccb7){_0x5871f9=_0x5871f9-0x0;var _0x8fd1c0=_0x0d42[_0x5871f9];return _0x8fd1c0;};'use strict';var _=require('lodash');var util=require(_0x20d4('0x0'));var moment=require(_0x20d4('0x1'));var BPromise=require(_0x20d4('0x2'));var rs=require(_0x20d4('0x3'));var fs=require('fs');var Redis=require(_0x20d4('0x4'));var db=require(_0x20d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x20d4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x20d4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f4099,_0x3395d6,_0x127a3d){return new BPromise(function(_0x3b57be,_0x14bb87){return client[_0x20d4('0x8')](_0x3f4099,_0x127a3d)[_0x20d4('0x9')](function(_0x99db84){logger['info'](_0x20d4('0xa'),_0x3395d6,_0x20d4('0xb'));logger['debug'](_0x20d4('0xc'),_0x3395d6,_0x20d4('0xb'),JSON[_0x20d4('0xd')](_0x99db84));if(_0x99db84[_0x20d4('0xe')]){if(_0x99db84[_0x20d4('0xe')][_0x20d4('0xf')]===0x1f4){logger[_0x20d4('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x3395d6,_0x99db84[_0x20d4('0xe')][_0x20d4('0x10')]);return _0x14bb87(_0x99db84[_0x20d4('0xe')][_0x20d4('0x10')]);}logger[_0x20d4('0xe')](_0x20d4('0xa'),_0x3395d6,_0x99db84[_0x20d4('0xe')][_0x20d4('0x10')]);return _0x3b57be(_0x99db84[_0x20d4('0xe')][_0x20d4('0x10')]);}else{logger[_0x20d4('0x11')](_0x20d4('0xa'),_0x3395d6,_0x20d4('0xb'));_0x3b57be(_0x99db84[_0x20d4('0x12')][_0x20d4('0x10')]);}})[_0x20d4('0x13')](function(_0x48503f){logger[_0x20d4('0xe')](_0x20d4('0xa'),_0x3395d6,_0x48503f);_0x14bb87(_0x48503f);});});} \ No newline at end of file +var _0x6371=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x280a56,_0x199718){var _0x1f7bd8=function(_0x2f909a){while(--_0x2f909a){_0x280a56['push'](_0x280a56['shift']());}};_0x1f7bd8(++_0x199718);}(_0x6371,0xf0));var _0x1637=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x6371[_0x5b1c50];return _0x2d379b;};'use strict';var _=require(_0x1637('0x0'));var util=require(_0x1637('0x1'));var moment=require(_0x1637('0x2'));var BPromise=require(_0x1637('0x3'));var rs=require(_0x1637('0x4'));var fs=require('fs');var Redis=require(_0x1637('0x5'));var db=require(_0x1637('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1637('0x7'));var client=jayson['client'][_0x1637('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28cc81,_0x5531c6,_0x1d2059){return new BPromise(function(_0x5b1ac5,_0x558f98){return client[_0x1637('0x9')](_0x28cc81,_0x1d2059)[_0x1637('0xa')](function(_0x5c1b0e){logger[_0x1637('0xb')](_0x1637('0xc'),_0x5531c6,_0x1637('0xd'));logger[_0x1637('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5531c6,_0x1637('0xd'),JSON[_0x1637('0xf')](_0x5c1b0e));if(_0x5c1b0e[_0x1637('0x10')]){if(_0x5c1b0e[_0x1637('0x10')][_0x1637('0x11')]===0x1f4){logger[_0x1637('0x10')](_0x1637('0xc'),_0x5531c6,_0x5c1b0e[_0x1637('0x10')]['message']);return _0x558f98(_0x5c1b0e[_0x1637('0x10')][_0x1637('0x12')]);}logger[_0x1637('0x10')](_0x1637('0xc'),_0x5531c6,_0x5c1b0e[_0x1637('0x10')][_0x1637('0x12')]);return _0x5b1ac5(_0x5c1b0e[_0x1637('0x10')][_0x1637('0x12')]);}else{logger[_0x1637('0xb')](_0x1637('0xc'),_0x5531c6,'request\x20sent');_0x5b1ac5(_0x5c1b0e[_0x1637('0x13')][_0x1637('0x12')]);}})['catch'](function(_0x4aa665){logger[_0x1637('0x10')](_0x1637('0xc'),_0x5531c6,_0x4aa665);_0x558f98(_0x4aa665);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 20d0075..3bdf333 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3c16a9,_0x69edd6){var _0x16e2be=function(_0x25330f){while(--_0x25330f){_0x3c16a9['push'](_0x3c16a9['shift']());}};_0x16e2be(++_0x69edd6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x415005,_0x595685){var _0x50002f=function(_0x68b2a2){while(--_0x68b2a2){_0x415005['push'](_0x415005['shift']());}};_0x50002f(++_0x595685);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d75367d..ead0199 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4882=['INTEGER','STRING','sequelize','exports'];(function(_0x316af7,_0x72e80c){var _0x286d96=function(_0x1c1d7b){while(--_0x1c1d7b){_0x316af7['push'](_0x316af7['shift']());}};_0x286d96(++_0x72e80c);}(_0x4882,0x16e));var _0x2488=function(_0x14bfe2,_0x8d77db){_0x14bfe2=_0x14bfe2-0x0;var _0x595227=_0x4882[_0x14bfe2];return _0x595227;};'use strict';var Sequelize=require(_0x2488('0x0'));module[_0x2488('0x1')]={'penalty':{'type':Sequelize[_0x2488('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2488('0x3')]}}; \ No newline at end of file +var _0x1171=['STRING','sequelize','INTEGER'];(function(_0x4c152c,_0x23dfb5){var _0x8d9fa5=function(_0xcf9f87){while(--_0xcf9f87){_0x4c152c['push'](_0x4c152c['shift']());}};_0x8d9fa5(++_0x23dfb5);}(_0x1171,0x127));var _0x1117=function(_0x3634d8,_0xbfa70b){_0x3634d8=_0x3634d8-0x0;var _0x2c1369=_0x1171[_0x3634d8];return _0x2c1369;};'use strict';var Sequelize=require(_0x1117('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1117('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1117('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b030ad4..d9b9b2a 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x625b=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4fd20f,_0x5ddb05){var _0x252288=function(_0x21ffc9){while(--_0x21ffc9){_0x4fd20f['push'](_0x4fd20f['shift']());}};_0x252288(++_0x5ddb05);}(_0x625b,0x93));var _0xb625=function(_0x26c6cf,_0x590ddf){_0x26c6cf=_0x26c6cf-0x0;var _0x114ad7=_0x625b[_0x26c6cf];return _0x114ad7;};'use strict';var _=require(_0xb625('0x0'));var util=require('util');var logger=require(_0xb625('0x1'))(_0xb625('0x2'));var moment=require(_0xb625('0x3'));var BPromise=require(_0xb625('0x4'));var rp=require(_0xb625('0x5'));var fs=require('fs');var path=require(_0xb625('0x6'));var rimraf=require(_0xb625('0x7'));var config=require(_0xb625('0x8'));var attributes=require(_0xb625('0x9'));module[_0xb625('0xa')]=function(_0x3ac776,_0x5d30be){return _0x3ac776[_0xb625('0xb')](_0xb625('0xc'),attributes,{'tableName':_0xb625('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6564=['../../config/logger','api','request-promise','rimraf','./userFaxQueue.attributes','exports','user_has_fax_queues','util'];(function(_0x21d0fe,_0x40d3cf){var _0x5acdce=function(_0x35e53a){while(--_0x35e53a){_0x21d0fe['push'](_0x21d0fe['shift']());}};_0x5acdce(++_0x40d3cf);}(_0x6564,0xa7));var _0x4656=function(_0x2cd061,_0x3fde39){_0x2cd061=_0x2cd061-0x0;var _0xee1f5f=_0x6564[_0x2cd061];return _0xee1f5f;};'use strict';var _=require('lodash');var util=require(_0x4656('0x0'));var logger=require(_0x4656('0x1'))(_0x4656('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4656('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4656('0x4'));var config=require('../../config/environment');var attributes=require(_0x4656('0x5'));module[_0x4656('0x6')]=function(_0x3a84b4,_0x520674){return _0x3a84b4['define']('UserFaxQueue',attributes,{'tableName':_0x4656('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 0e653a2..6a8bbfd 100644 --- a/server/api/userFaxQueue/userFaxQueue.rpc.js +++ b/server/api/userFaxQueue/userFaxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcda5=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x4df001,_0x105ccc){var _0x2c41d0=function(_0xbab19){while(--_0xbab19){_0x4df001['push'](_0x4df001['shift']());}};_0x2c41d0(++_0x105ccc);}(_0xcda5,0x1eb));var _0x5cda=function(_0x38eefb,_0x4ffda0){_0x38eefb=_0x38eefb-0x0;var _0x1f2ce6=_0xcda5[_0x38eefb];return _0x1f2ce6;};'use strict';var _=require('lodash');var util=require(_0x5cda('0x0'));var moment=require(_0x5cda('0x1'));var BPromise=require(_0x5cda('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5cda('0x3'));var db=require(_0x5cda('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cda('0x5'))(_0x5cda('0x6'));var config=require(_0x5cda('0x7'));var jayson=require(_0x5cda('0x8'));var client=jayson[_0x5cda('0x9')][_0x5cda('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3001dd,_0x1d2e0e,_0x1554a4){return new BPromise(function(_0x4dd849,_0x2d19e3){return client['request'](_0x3001dd,_0x1554a4)[_0x5cda('0xb')](function(_0x1d8ef5){logger[_0x5cda('0xc')](_0x5cda('0xd'),_0x1d2e0e,_0x5cda('0xe'));logger[_0x5cda('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x1d2e0e,_0x5cda('0xe'),JSON[_0x5cda('0x10')](_0x1d8ef5));if(_0x1d8ef5[_0x5cda('0x11')]){if(_0x1d8ef5[_0x5cda('0x11')][_0x5cda('0x12')]===0x1f4){logger['error'](_0x5cda('0xd'),_0x1d2e0e,_0x1d8ef5[_0x5cda('0x11')][_0x5cda('0x13')]);return _0x2d19e3(_0x1d8ef5[_0x5cda('0x11')]['message']);}logger[_0x5cda('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x1d2e0e,_0x1d8ef5[_0x5cda('0x11')][_0x5cda('0x13')]);return _0x4dd849(_0x1d8ef5[_0x5cda('0x11')][_0x5cda('0x13')]);}else{logger[_0x5cda('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x1d2e0e,_0x5cda('0xe'));_0x4dd849(_0x1d8ef5[_0x5cda('0x14')][_0x5cda('0x13')]);}})['catch'](function(_0x46de4f){logger[_0x5cda('0x11')](_0x5cda('0xd'),_0x1d2e0e,_0x46de4f);_0x2d19e3(_0x46de4f);});});} \ No newline at end of file +var _0xcf79=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x25b352,_0xe62ba2){var _0xb0737f=function(_0x18bb51){while(--_0x18bb51){_0x25b352['push'](_0x25b352['shift']());}};_0xb0737f(++_0xe62ba2);}(_0xcf79,0x94));var _0x9cf7=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xcf79[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x9cf7('0x0'));var util=require(_0x9cf7('0x1'));var moment=require(_0x9cf7('0x2'));var BPromise=require(_0x9cf7('0x3'));var rs=require(_0x9cf7('0x4'));var fs=require('fs');var Redis=require(_0x9cf7('0x5'));var db=require(_0x9cf7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9cf7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a5166,_0x831044,_0x72f23b){return new BPromise(function(_0x51b07e,_0x17b492){return client[_0x9cf7('0x8')](_0x5a5166,_0x72f23b)[_0x9cf7('0x9')](function(_0x4cf726){logger[_0x9cf7('0xa')](_0x9cf7('0xb'),_0x831044,'request\x20sent');logger[_0x9cf7('0xc')](_0x9cf7('0xd'),_0x831044,_0x9cf7('0xe'),JSON[_0x9cf7('0xf')](_0x4cf726));if(_0x4cf726[_0x9cf7('0x10')]){if(_0x4cf726['error'][_0x9cf7('0x11')]===0x1f4){logger[_0x9cf7('0x10')](_0x9cf7('0xb'),_0x831044,_0x4cf726[_0x9cf7('0x10')]['message']);return _0x17b492(_0x4cf726[_0x9cf7('0x10')][_0x9cf7('0x12')]);}logger[_0x9cf7('0x10')](_0x9cf7('0xb'),_0x831044,_0x4cf726[_0x9cf7('0x10')][_0x9cf7('0x12')]);return _0x51b07e(_0x4cf726[_0x9cf7('0x10')][_0x9cf7('0x12')]);}else{logger[_0x9cf7('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x831044,'request\x20sent');_0x51b07e(_0x4cf726[_0x9cf7('0x13')][_0x9cf7('0x12')]);}})[_0x9cf7('0x14')](function(_0x5d05f9){logger['error'](_0x9cf7('0xb'),_0x831044,_0x5d05f9);_0x17b492(_0x5d05f9);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index beb9b62..3b1dcea 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x26ac67,_0x4ac7f2){var _0x26ac9f=function(_0x39ce73){while(--_0x39ce73){_0x26ac67['push'](_0x26ac67['shift']());}};_0x26ac9f(++_0x4ac7f2);}(_0x70e0,0x17b));var _0x070e=function(_0x580f5f,_0x2f6ae1){_0x580f5f=_0x580f5f-0x0;var _0x466228=_0x70e0[_0x580f5f];return _0x466228;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xcf5f8,_0x230d85){var _0x1a6818=function(_0x46c162){while(--_0x46c162){_0xcf5f8['push'](_0xcf5f8['shift']());}};_0x1a6818(++_0x230d85);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 25c3596..8f398f9 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38b4=['INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x38b4,0x13f));var _0x438b=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x38b4[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require(_0x438b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x438b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x44cb=['exports','INTEGER'];(function(_0x39622b,_0x1241c2){var _0x2b6a97=function(_0x13c12a){while(--_0x13c12a){_0x39622b['push'](_0x39622b['shift']());}};_0x2b6a97(++_0x1241c2);}(_0x44cb,0xbe));var _0xb44c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x44cb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xb44c('0x0')]={'penalty':{'type':Sequelize[_0xb44c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index cb4c936..e9616c2 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78d6=['path','rimraf','../../config/environment','./userMailQueue.attributes','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3e49c6,_0x27ad6d){var _0x32da13=function(_0x1355ed){while(--_0x1355ed){_0x3e49c6['push'](_0x3e49c6['shift']());}};_0x32da13(++_0x27ad6d);}(_0x78d6,0x1db));var _0x678d=function(_0x25db18,_0x39bab5){_0x25db18=_0x25db18-0x0;var _0x2b415f=_0x78d6[_0x25db18];return _0x2b415f;};'use strict';var _=require(_0x678d('0x0'));var util=require(_0x678d('0x1'));var logger=require(_0x678d('0x2'))(_0x678d('0x3'));var moment=require(_0x678d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x678d('0x5'));var rimraf=require(_0x678d('0x6'));var config=require(_0x678d('0x7'));var attributes=require(_0x678d('0x8'));module['exports']=function(_0x576b37,_0x78444a){return _0x576b37['define']('UserMailQueue',attributes,{'tableName':_0x678d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1521=['exports','define','UserMailQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x2c3920,_0x10b832){var _0xbc1fa3=function(_0x14a621){while(--_0x14a621){_0x2c3920['push'](_0x2c3920['shift']());}};_0xbc1fa3(++_0x10b832);}(_0x1521,0x121));var _0x1152=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x1521[_0x273f77];return _0x71e147;};'use strict';var _=require(_0x1152('0x0'));var util=require('util');var logger=require(_0x1152('0x1'))(_0x1152('0x2'));var moment=require(_0x1152('0x3'));var BPromise=require(_0x1152('0x4'));var rp=require(_0x1152('0x5'));var fs=require('fs');var path=require(_0x1152('0x6'));var rimraf=require(_0x1152('0x7'));var config=require(_0x1152('0x8'));var attributes=require(_0x1152('0x9'));module[_0x1152('0xa')]=function(_0x49015e,_0x38a0c8){return _0x49015e[_0x1152('0xb')](_0x1152('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index d32926d..9f04ac5 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1cb9,0x14e));var _0x91cb=function(_0x528b56,_0x4db81f){_0x528b56=_0x528b56-0x0;var _0x5cf560=_0x1cb9[_0x528b56];return _0x5cf560;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x48b79d,_0x9184d3){var _0x53b3a3=function(_0x2acb7c){while(--_0x2acb7c){_0x48b79d['push'](_0x48b79d['shift']());}};_0x53b3a3(++_0x9184d3);}(_0x3e74,0x175));var _0x43e7=function(_0x2a5da2,_0x510595){_0x2a5da2=_0x2a5da2-0x0;var _0x275344=_0x3e74[_0x2a5da2];return _0x275344;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 1026fc7..d4d5441 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ecb=['../../components/auth/service','./userNotification.controller','post','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0x2ecb,0xa5));var _0xb2ec=function(_0x4557a4,_0x36f89c){_0x4557a4=_0x4557a4-0x0;var _0x4ceb15=_0x2ecb[_0x4557a4];return _0x4ceb15;};'use strict';var multer=require(_0xb2ec('0x0'));var util=require('util');var path=require(_0xb2ec('0x1'));var timeout=require(_0xb2ec('0x2'));var express=require(_0xb2ec('0x3'));var router=express[_0xb2ec('0x4')]();var fs_extra=require(_0xb2ec('0x5'));var auth=require(_0xb2ec('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb2ec('0x7'));router[_0xb2ec('0x8')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x1a80=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','sendUserNotification','exports','multer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1a80,0x1ca));var _0x01a8=function(_0x117ab3,_0x4fa65a){_0x117ab3=_0x117ab3-0x0;var _0x267c91=_0x1a80[_0x117ab3];return _0x267c91;};'use strict';var multer=require(_0x01a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x01a8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x01a8('0x2'));var auth=require(_0x01a8('0x3'));var interaction=require(_0x01a8('0x4'));var config=require(_0x01a8('0x5'));var controller=require(_0x01a8('0x6'));router['post']('/',auth['isAuthenticated'](),controller[_0x01a8('0x7')]);module[_0x01a8('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b455d4b..99c6788 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0f8=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x45b1ad,_0x215b03){var _0x3d5696=function(_0x4d9e73){while(--_0x4d9e73){_0x45b1ad['push'](_0x45b1ad['shift']());}};_0x3d5696(++_0x215b03);}(_0xa0f8,0x17a));var _0x8a0f=function(_0x548503,_0x1aa00c){_0x548503=_0x548503-0x0;var _0xf8f05f=_0xa0f8[_0x548503];return _0xf8f05f;};'use strict';var Sequelize=require(_0x8a0f('0x0'));module[_0x8a0f('0x1')]={'body':{'type':Sequelize[_0x8a0f('0x2')]},'senderName':{'type':Sequelize[_0x8a0f('0x3')]},'recipientsId':{'type':Sequelize[_0x8a0f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8a0f('0x3')]},'beep':{'type':Sequelize[_0x8a0f('0x4')]}}; \ No newline at end of file +var _0x3397=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3a041d,_0x148b28){var _0x4b931b=function(_0x97767e){while(--_0x97767e){_0x3a041d['push'](_0x3a041d['shift']());}};_0x4b931b(++_0x148b28);}(_0x3397,0x12d));var _0x7339=function(_0x54a9b9,_0x31352f){_0x54a9b9=_0x54a9b9-0x0;var _0x2a34ef=_0x3397[_0x54a9b9];return _0x2a34ef;};'use strict';var Sequelize=require('sequelize');module[_0x7339('0x0')]={'body':{'type':Sequelize[_0x7339('0x1')]},'senderName':{'type':Sequelize[_0x7339('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x7339('0x2')]},'beep':{'type':Sequelize[_0x7339('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a0f4d5f..a3f9f08 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae4d=['faxqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','join','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','ids','queue','Queue','push','all','union','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue'];(function(_0x235a68,_0x124fb6){var _0x75cf16=function(_0x1bfa34){while(--_0x1bfa34){_0x235a68['push'](_0x235a68['shift']());}};_0x75cf16(++_0x124fb6);}(_0xae4d,0xf3));var _0xdae4=function(_0x44a457,_0x3e7a18){_0x44a457=_0x44a457-0x0;var _0x4d70df=_0xae4d[_0x44a457];return _0x4d70df;};'use strict';var emlformat=require(_0xdae4('0x0'));var rimraf=require(_0xdae4('0x1'));var zipdir=require(_0xdae4('0x2'));var jsonpatch=require(_0xdae4('0x3'));var rp=require(_0xdae4('0x4'));var moment=require('moment');var BPromise=require(_0xdae4('0x5'));var Mustache=require('mustache');var util=require(_0xdae4('0x6'));var path=require(_0xdae4('0x7'));var sox=require(_0xdae4('0x8'));var csv=require(_0xdae4('0x9'));var ejs=require(_0xdae4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdae4('0xb'));var squel=require(_0xdae4('0xc'));var crypto=require('crypto');var jsforce=require(_0xdae4('0xd'));var deskjs=require(_0xdae4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdae4('0xf'));var Papa=require(_0xdae4('0x10'));var Redis=require(_0xdae4('0x11'));var authService=require(_0xdae4('0x12'));var qs=require(_0xdae4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdae4('0x14'))(_0xdae4('0x15'));var utils=require(_0xdae4('0x16'));var config=require(_0xdae4('0x17'));var licenseUtil=require(_0xdae4('0x18'));var db=require(_0xdae4('0x19'))['db'];config[_0xdae4('0x1a')]=_[_0xdae4('0x1b')](config[_0xdae4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xdae4('0x1c'))(new Redis(config['redis']));require(_0xdae4('0x1d'))[_0xdae4('0x1e')](socket);function respondWithStatusCode(_0x1cc257,_0x2e3c4b){_0x2e3c4b=_0x2e3c4b||0xcc;return function(_0x379319){if(_0x379319){return _0x1cc257[_0xdae4('0x1f')](_0x2e3c4b);}return _0x1cc257[_0xdae4('0x20')](_0x2e3c4b)[_0xdae4('0x21')]();};}function respondWithResult(_0x75450c,_0x1a79c0){_0x1a79c0=_0x1a79c0||0xc8;return function(_0xde64fb){if(_0xde64fb){return _0x75450c['status'](_0x1a79c0)[_0xdae4('0x22')](_0xde64fb);}};}function respondWithFilteredResult(_0x2275ee,_0x16e8b2){return function(_0x1bda45){if(_0x1bda45){var _0x22cb52=typeof _0x16e8b2[_0xdae4('0x23')]==='undefined'&&typeof _0x16e8b2[_0xdae4('0x24')]===_0xdae4('0x25');var _0x37ce15=_0x1bda45[_0xdae4('0x26')];var _0x105736=_0x22cb52?0x0:_0x16e8b2[_0xdae4('0x23')];var _0x28952c=_0x22cb52?_0x1bda45['count']:_0x16e8b2[_0xdae4('0x23')]+_0x16e8b2['limit'];var _0x36deb5;if(_0x28952c>=_0x37ce15){_0x28952c=_0x37ce15;_0x36deb5=0xc8;}else{_0x36deb5=0xce;}_0x2275ee[_0xdae4('0x20')](_0x36deb5);return _0x2275ee['set'](_0xdae4('0x27'),_0x105736+'-'+_0x28952c+'/'+_0x37ce15)[_0xdae4('0x22')](_0x1bda45);}return null;};}function patchUpdates(_0x3f37f9){return function(_0x45e7c4){try{jsonpatch[_0xdae4('0x28')](_0x45e7c4,_0x3f37f9,!![]);}catch(_0x239de4){return BPromise[_0xdae4('0x29')](_0x239de4);}return _0x45e7c4['save']();};}function saveUpdates(_0x3e3654,_0x1969c9){return function(_0xd5d2e3){if(_0xd5d2e3){return _0xd5d2e3[_0xdae4('0x2a')](_0x3e3654)[_0xdae4('0x2b')](function(_0x2fd55b){return _0x2fd55b;});}return null;};}function removeEntity(_0xec1034,_0x4718c0){return function(_0xc9f787){if(_0xc9f787){return _0xc9f787[_0xdae4('0x2c')]()[_0xdae4('0x2b')](function(){_0xec1034[_0xdae4('0x20')](0xcc)[_0xdae4('0x21')]();});}};}function handleEntityNotFound(_0x565c90,_0x2f2a2d){return function(_0x133d29){if(!_0x133d29){_0x565c90['sendStatus'](0x194);}return _0x133d29;};}function handleError(_0x20ca0f,_0x50fb1b){_0x50fb1b=_0x50fb1b||0x1f4;return function(_0x2b7d45){logger['error'](_0x2b7d45[_0xdae4('0x2d')]);if(_0x2b7d45[_0xdae4('0x2e')]){delete _0x2b7d45[_0xdae4('0x2e')];}_0x20ca0f['status'](_0x50fb1b)[_0xdae4('0x2f')](_0x2b7d45);};}exports[_0xdae4('0x30')]=function(_0x4fce2b,_0x14f68a,_0x313965){if(!_0x4fce2b[_0xdae4('0x31')][_0xdae4('0x32')](_0xdae4('0x33'))&&!_0x4fce2b['body'][_0xdae4('0x32')]('TemplateId')){throw new db[(_0xdae4('0x34'))][(_0xdae4('0x35'))](_0xdae4('0x36'));}else{if(_0x4fce2b[_0xdae4('0x31')][_0xdae4('0x32')]('TemplateId')&&!_0x4fce2b[_0xdae4('0x31')]['hasOwnProperty'](_0xdae4('0x37'))){throw new db[(_0xdae4('0x34'))][(_0xdae4('0x35'))](_0xdae4('0x38'));}if(!_0x4fce2b[_0xdae4('0x31')][_0xdae4('0x32')]('recipients')){throw new db[(_0xdae4('0x34'))][(_0xdae4('0x35'))](_0xdae4('0x39'));}else{try{var _0x5eb2e8=JSON[_0xdae4('0x3a')](_0x4fce2b[_0xdae4('0x31')][_0xdae4('0x3b')]);}catch(_0x4e3d1b){logger[_0xdae4('0x3c')](_0x4e3d1b);throw new db[(_0xdae4('0x34'))]['ValidationError'](_0xdae4('0x3d'));}var _0x99d450=[_0xdae4('0x3e'),_0xdae4('0x3f'),'mailqueue',_0xdae4('0x40'),_0xdae4('0x41'),_0xdae4('0x42'),'whatsappqueue',_0xdae4('0x43'),_0xdae4('0x44')];if(_[_0xdae4('0x45')](_0x5eb2e8,function(_0x1d9ef6){return!_[_0xdae4('0x46')](_0x99d450,_0x1d9ef6[_0xdae4('0x47')][_0xdae4('0x48')]());})){throw new db[(_0xdae4('0x34'))][(_0xdae4('0x35'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x59bdd0={};_0x59bdd0[_0xdae4('0x49')]=_0x4fce2b['body']['hasOwnProperty']('senderName')?_0x4fce2b[_0xdae4('0x31')]['senderName']:_0x4fce2b[_0xdae4('0x44')][_0xdae4('0x4a')];_0x59bdd0['recipientsDescription']=_[_0xdae4('0x4b')](_0x4fce2b['body']['recipientsDescription'])?null:_0x4fce2b['body'][_0xdae4('0x4c')];_0x59bdd0[_0xdae4('0x4d')]=_0x4fce2b[_0xdae4('0x31')][_0xdae4('0x4d')]||![];_0x59bdd0['SenderId']=_0x4fce2b['user']['id'];return getContent(_0x4fce2b[_0xdae4('0x31')])[_0xdae4('0x2b')](function(_0x3d9710){_0x59bdd0[_0xdae4('0x31')]=_0x3d9710;return getRecipients(_0x5eb2e8);})[_0xdae4('0x2b')](function(_0x1f8f7d){_0x59bdd0[_0xdae4('0x4e')]=_['sortBy'](_0x1f8f7d)[_0xdae4('0x4f')](',');return db[_0xdae4('0x50')][_0xdae4('0x51')](function(_0x1c6589){return db[_0xdae4('0x52')][_0xdae4('0x53')](_0x59bdd0,{'raw':!![],'transaction':_0x1c6589})[_0xdae4('0x2b')](function(_0x5756ba){var _0x4f830f={'sender':_0x59bdd0[_0xdae4('0x49')],'description':_0x59bdd0['recipientsDescription'],'content':_0x59bdd0[_0xdae4('0x31')],'beep':_0x59bdd0['beep']};_0x1f8f7d[_0xdae4('0x54')](function(_0x40ff92){_0x4f830f['recipient']=_0x40ff92;socket[_0xdae4('0x55')](_0xdae4('0x56'),_0x4f830f);});return _0x5756ba;});});})[_0xdae4('0x2b')](respondWithResult(_0x14f68a,0xc9))[_0xdae4('0x57')](handleError(_0x14f68a,null));};function getContent(_0x20390d){return new BPromise(function(_0xb69876,_0xd8b5a){if(_0x20390d[_0xdae4('0x33')]){_0xb69876(_0x20390d[_0xdae4('0x33')]);return;}return db[_0xdae4('0x58')][_0xdae4('0x59')]({'attributes':[_0xdae4('0x5a')],'where':{'id':_0x20390d[_0xdae4('0x5b')]},'raw':!![]})['then'](function(_0x4248c4){if(!_0x4248c4)throw new db[(_0xdae4('0x34'))][(_0xdae4('0x35'))](_0xdae4('0x5c'));var _0x837496=Mustache[_0xdae4('0x5d')](_0x4248c4[_0xdae4('0x5a')],_0x20390d[_0xdae4('0x37')]);_0xb69876(_0x837496);})[_0xdae4('0x57')](function(_0xe5673b){_0xd8b5a(_0xe5673b);});});}function getRecipients(_0x5ab6bb){return new BPromise(function(_0x1cc27d,_0x57ee1a){var _0x21b19e=[];var _0x43ee02=[];_0x5ab6bb[_0xdae4('0x54')](function(_0x5c2842){var _0x413be0=_[_0xdae4('0x5e')](_0x5c2842[_0xdae4('0x47')]['toLowerCase']());if(_0x413be0==='User'){_0x21b19e=_['union'](_0x21b19e,_0x5c2842[_0xdae4('0x5f')]);}else{if(_[_0xdae4('0x46')](_0x413be0,_0xdae4('0x60')))_0x413be0=_0x413be0['replace'](_0xdae4('0x60'),_0xdae4('0x61'));_0x5c2842[_0xdae4('0x5f')][_0xdae4('0x54')](function(_0x8db7dd){_0x43ee02[_0xdae4('0x62')](getAgents(_0x413be0,_0x8db7dd));});}});return BPromise[_0xdae4('0x63')](_0x43ee02)[_0xdae4('0x2b')](function(_0xd8be){_0x21b19e=_[_0xdae4('0x64')](_0x21b19e,_['flatten'](_0xd8be));_0x1cc27d(_0x21b19e);})[_0xdae4('0x57')](function(_0x1aae79){_0x57ee1a(_0x1aae79);});});}function getAgents(_0x183948,_0x161bbd){return new BPromise(function(_0x2944d6,_0x58b187){return db[_0x183948][_0xdae4('0x59')]({'where':{'id':_0x161bbd}})['then'](function(_0x16e291){return _0x16e291[_0xdae4('0x65')]({'attributes':['id'],'raw':!![]})[_0xdae4('0x2b')](function(_0x4d2463){var _0x13a9b2=_['map'](_0x4d2463,'id');_0x2944d6(_0x13a9b2);});})[_0xdae4('0x57')](function(_0xb5c5fb){_0x58b187(_0xb5c5fb);});});} \ No newline at end of file +var _0xc0a8=['body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','recipientsId','sortBy','transaction','UserNotification','create','recipient','emit','catch','Template','html','render','startCase','User','Queue','ids','all','union','getAgents','map','rimraf','zip-dir','mustache','util','sox','to-csv','lodash','crypto','desk.js','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','sendUserNotification'];(function(_0x3eaa2b,_0x33bedf){var _0x3ee83a=function(_0x495550){while(--_0x495550){_0x3eaa2b['push'](_0x3eaa2b['shift']());}};_0x3ee83a(++_0x33bedf);}(_0xc0a8,0x1d2));var _0x8c0a=function(_0x21df98,_0x4902e2){_0x21df98=_0x21df98-0x0;var _0x46e5ef=_0xc0a8[_0x21df98];return _0x46e5ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c0a('0x0'));var zipdir=require(_0x8c0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c0a('0x2'));var util=require(_0x8c0a('0x3'));var path=require('path');var sox=require(_0x8c0a('0x4'));var csv=require(_0x8c0a('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c0a('0x6'));var squel=require('squel');var crypto=require(_0x8c0a('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x8c0a('0x8'));var toCsv=require(_0x8c0a('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c0a('0x9'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c0a('0xa'));var logger=require('../../config/logger')('api');var utils=require(_0x8c0a('0xb'));var config=require(_0x8c0a('0xc'));var licenseUtil=require(_0x8c0a('0xd'));var db=require(_0x8c0a('0xe'))['db'];config['redis']=_[_0x8c0a('0xf')](config[_0x8c0a('0x10')],{'host':_0x8c0a('0x11'),'port':0x18eb});var socket=require(_0x8c0a('0x12'))(new Redis(config[_0x8c0a('0x10')]));require(_0x8c0a('0x13'))[_0x8c0a('0x14')](socket);function respondWithStatusCode(_0xfa4cf3,_0xd23a76){_0xd23a76=_0xd23a76||0xcc;return function(_0x285076){if(_0x285076){return _0xfa4cf3[_0x8c0a('0x15')](_0xd23a76);}return _0xfa4cf3[_0x8c0a('0x16')](_0xd23a76)[_0x8c0a('0x17')]();};}function respondWithResult(_0x594c6e,_0x3bd3ee){_0x3bd3ee=_0x3bd3ee||0xc8;return function(_0x53c755){if(_0x53c755){return _0x594c6e[_0x8c0a('0x16')](_0x3bd3ee)['json'](_0x53c755);}};}function respondWithFilteredResult(_0x5cd711,_0x3a45e0){return function(_0x4be77f){if(_0x4be77f){var _0x297bea=typeof _0x3a45e0[_0x8c0a('0x18')]===_0x8c0a('0x19')&&typeof _0x3a45e0[_0x8c0a('0x1a')]===_0x8c0a('0x19');var _0x12ad8c=_0x4be77f[_0x8c0a('0x1b')];var _0x4c049c=_0x297bea?0x0:_0x3a45e0[_0x8c0a('0x18')];var _0x58fa5b=_0x297bea?_0x4be77f[_0x8c0a('0x1b')]:_0x3a45e0[_0x8c0a('0x18')]+_0x3a45e0['limit'];var _0x27ff14;if(_0x58fa5b>=_0x12ad8c){_0x58fa5b=_0x12ad8c;_0x27ff14=0xc8;}else{_0x27ff14=0xce;}_0x5cd711[_0x8c0a('0x16')](_0x27ff14);return _0x5cd711[_0x8c0a('0x1c')](_0x8c0a('0x1d'),_0x4c049c+'-'+_0x58fa5b+'/'+_0x12ad8c)[_0x8c0a('0x1e')](_0x4be77f);}return null;};}function patchUpdates(_0x5207d8){return function(_0x1f5483){try{jsonpatch['apply'](_0x1f5483,_0x5207d8,!![]);}catch(_0x2fbd05){return BPromise[_0x8c0a('0x1f')](_0x2fbd05);}return _0x1f5483[_0x8c0a('0x20')]();};}function saveUpdates(_0x288a70,_0x25a37d){return function(_0x12bca2){if(_0x12bca2){return _0x12bca2[_0x8c0a('0x21')](_0x288a70)[_0x8c0a('0x22')](function(_0x4b8fce){return _0x4b8fce;});}return null;};}function removeEntity(_0x23219a,_0x17fb79){return function(_0x7c6852){if(_0x7c6852){return _0x7c6852[_0x8c0a('0x23')]()[_0x8c0a('0x22')](function(){_0x23219a['status'](0xcc)[_0x8c0a('0x17')]();});}};}function handleEntityNotFound(_0x2c9381,_0x2b59dc){return function(_0x540377){if(!_0x540377){_0x2c9381[_0x8c0a('0x15')](0x194);}return _0x540377;};}function handleError(_0x5ecb04,_0x502832){_0x502832=_0x502832||0x1f4;return function(_0x49e51b){logger[_0x8c0a('0x24')](_0x49e51b['stack']);if(_0x49e51b['name']){delete _0x49e51b['name'];}_0x5ecb04[_0x8c0a('0x16')](_0x502832)['send'](_0x49e51b);};}exports[_0x8c0a('0x25')]=function(_0x49da7f,_0x41c1a6,_0x565338){if(!_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x27')](_0x8c0a('0x28'))&&!_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x27')](_0x8c0a('0x29'))){throw new db[(_0x8c0a('0x2a'))][(_0x8c0a('0x2b'))](_0x8c0a('0x2c'));}else{if(_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x27')](_0x8c0a('0x29'))&&!_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x27')]('view')){throw new db['Sequelize'][(_0x8c0a('0x2b'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x27')](_0x8c0a('0x2d'))){throw new db[(_0x8c0a('0x2a'))][(_0x8c0a('0x2b'))](_0x8c0a('0x2e'));}else{try{var _0x3d5364=JSON[_0x8c0a('0x2f')](_0x49da7f['body']['recipients']);}catch(_0x87f3ca){logger[_0x8c0a('0x24')](_0x87f3ca);throw new db['Sequelize'][(_0x8c0a('0x2b'))](_0x8c0a('0x30'));}var _0x4b1ffc=['chatqueue','faxqueue',_0x8c0a('0x31'),_0x8c0a('0x32'),_0x8c0a('0x33'),_0x8c0a('0x34'),_0x8c0a('0x35'),_0x8c0a('0x36'),_0x8c0a('0x37')];if(_[_0x8c0a('0x38')](_0x3d5364,function(_0x30f320){return!_[_0x8c0a('0x39')](_0x4b1ffc,_0x30f320[_0x8c0a('0x3a')][_0x8c0a('0x3b')]());})){throw new db[(_0x8c0a('0x2a'))][(_0x8c0a('0x2b'))](_0x8c0a('0x3c'));}}}var _0x4d0a86={};_0x4d0a86['senderName']=_0x49da7f['body'][_0x8c0a('0x27')]('senderName')?_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x3d')]:_0x49da7f[_0x8c0a('0x37')]['fullname'];_0x4d0a86['recipientsDescription']=_[_0x8c0a('0x3e')](_0x49da7f[_0x8c0a('0x26')]['recipientsDescription'])?null:_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x3f')];_0x4d0a86[_0x8c0a('0x40')]=_0x49da7f[_0x8c0a('0x26')][_0x8c0a('0x40')]||![];_0x4d0a86['SenderId']=_0x49da7f[_0x8c0a('0x37')]['id'];return getContent(_0x49da7f[_0x8c0a('0x26')])['then'](function(_0x4fcb3d){_0x4d0a86[_0x8c0a('0x26')]=_0x4fcb3d;return getRecipients(_0x3d5364);})[_0x8c0a('0x22')](function(_0x1ae869){_0x4d0a86[_0x8c0a('0x41')]=_[_0x8c0a('0x42')](_0x1ae869)['join'](',');return db['sequelize'][_0x8c0a('0x43')](function(_0x2deefc){return db[_0x8c0a('0x44')][_0x8c0a('0x45')](_0x4d0a86,{'raw':!![],'transaction':_0x2deefc})['then'](function(_0x5713ac){var _0x222ead={'sender':_0x4d0a86[_0x8c0a('0x3d')],'description':_0x4d0a86[_0x8c0a('0x3f')],'content':_0x4d0a86['body'],'beep':_0x4d0a86[_0x8c0a('0x40')]};_0x1ae869['forEach'](function(_0x444ebf){_0x222ead[_0x8c0a('0x46')]=_0x444ebf;socket[_0x8c0a('0x47')]('userNotification:send',_0x222ead);});return _0x5713ac;});});})[_0x8c0a('0x22')](respondWithResult(_0x41c1a6,0xc9))[_0x8c0a('0x48')](handleError(_0x41c1a6,null));};function getContent(_0x24c0a1){return new BPromise(function(_0x4bbf2d,_0xc812b8){if(_0x24c0a1[_0x8c0a('0x28')]){_0x4bbf2d(_0x24c0a1[_0x8c0a('0x28')]);return;}return db[_0x8c0a('0x49')]['findOne']({'attributes':[_0x8c0a('0x4a')],'where':{'id':_0x24c0a1[_0x8c0a('0x29')]},'raw':!![]})['then'](function(_0x166dd4){if(!_0x166dd4)throw new db['Sequelize']['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x5789ab=Mustache[_0x8c0a('0x4b')](_0x166dd4[_0x8c0a('0x4a')],_0x24c0a1['view']);_0x4bbf2d(_0x5789ab);})[_0x8c0a('0x48')](function(_0x413001){_0xc812b8(_0x413001);});});}function getRecipients(_0xd45b57){return new BPromise(function(_0x5bed55,_0x35b763){var _0x33f163=[];var _0x563e0b=[];_0xd45b57['forEach'](function(_0x51ada0){var _0x42f38b=_[_0x8c0a('0x4c')](_0x51ada0['model'][_0x8c0a('0x3b')]());if(_0x42f38b===_0x8c0a('0x4d')){_0x33f163=_['union'](_0x33f163,_0x51ada0['ids']);}else{if(_[_0x8c0a('0x39')](_0x42f38b,'queue'))_0x42f38b=_0x42f38b['replace']('queue',_0x8c0a('0x4e'));_0x51ada0[_0x8c0a('0x4f')]['forEach'](function(_0x5719b3){_0x563e0b['push'](getAgents(_0x42f38b,_0x5719b3));});}});return BPromise[_0x8c0a('0x50')](_0x563e0b)['then'](function(_0x2fbf3c){_0x33f163=_[_0x8c0a('0x51')](_0x33f163,_['flatten'](_0x2fbf3c));_0x5bed55(_0x33f163);})[_0x8c0a('0x48')](function(_0x555351){_0x35b763(_0x555351);});});}function getAgents(_0x226e9a,_0x271262){return new BPromise(function(_0x163707,_0x524483){return db[_0x226e9a]['findOne']({'where':{'id':_0x271262}})[_0x8c0a('0x22')](function(_0x2ed835){return _0x2ed835[_0x8c0a('0x52')]({'attributes':['id'],'raw':!![]})[_0x8c0a('0x22')](function(_0xe4d3ce){var _0x4ce80e=_[_0x8c0a('0x53')](_0xe4d3ce,'id');_0x163707(_0x4ce80e);});})[_0x8c0a('0x48')](function(_0xb358cd){_0x524483(_0xb358cd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 1507be1..4056d2c 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf43c=['hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','remove','emit'];(function(_0x6248ab,_0x54b7ec){var _0x48821a=function(_0xee3448){while(--_0xee3448){_0x6248ab['push'](_0x6248ab['shift']());}};_0x48821a(++_0x54b7ec);}(_0xf43c,0x17a));var _0xcf43=function(_0x1d54f2,_0x16c5fd){_0x1d54f2=_0x1d54f2-0x0;var _0xb4480b=_0xf43c[_0x1d54f2];return _0xb4480b;};'use strict';var EventEmitter=require(_0xcf43('0x0'));var UserNotification=require(_0xcf43('0x1'))['db'][_0xcf43('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xcf43('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcf43('0x4')};function emitEvent(_0x53e76d){return function(_0x45e1b6,_0x338b48,_0x172fc2){UserNotificationEvents[_0xcf43('0x5')](_0x53e76d+':'+_0x45e1b6['id'],_0x45e1b6);UserNotificationEvents[_0xcf43('0x5')](_0x53e76d,_0x45e1b6);_0x172fc2(null);};}for(var e in events){if(events[_0xcf43('0x6')](e)){var event=events[e];UserNotification[_0xcf43('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x71b1=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification'];(function(_0x246890,_0x46b964){var _0x2b2a5a=function(_0x4f1232){while(--_0x4f1232){_0x246890['push'](_0x246890['shift']());}};_0x2b2a5a(++_0x46b964);}(_0x71b1,0x177));var _0x171b=function(_0xe4e6c6,_0x45a683){_0xe4e6c6=_0xe4e6c6-0x0;var _0x175b25=_0x71b1[_0xe4e6c6];return _0x175b25;};'use strict';var EventEmitter=require(_0x171b('0x0'));var UserNotification=require(_0x171b('0x1'))['db'][_0x171b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x171b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x171b('0x4'),'afterDestroy':_0x171b('0x5')};function emitEvent(_0x50ad2a){return function(_0x57892f,_0x4f4bd6,_0x445c44){UserNotificationEvents['emit'](_0x50ad2a+':'+_0x57892f['id'],_0x57892f);UserNotificationEvents[_0x171b('0x6')](_0x50ad2a,_0x57892f);_0x445c44(null);};}for(var e in events){if(events[_0x171b('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x171b('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 9c6a262..4f18607 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d5b=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','UserNotification','utf8mb4'];(function(_0x45f545,_0x206708){var _0x417ab2=function(_0x148fa7){while(--_0x148fa7){_0x45f545['push'](_0x45f545['shift']());}};_0x417ab2(++_0x206708);}(_0x1d5b,0x1a1));var _0xb1d5=function(_0x33d1a7,_0x2536c3){_0x33d1a7=_0x33d1a7-0x0;var _0x32c3b7=_0x1d5b[_0x33d1a7];return _0x32c3b7;};'use strict';var _=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var logger=require(_0xb1d5('0x2'))(_0xb1d5('0x3'));var moment=require(_0xb1d5('0x4'));var BPromise=require(_0xb1d5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1d5('0x6'));var rimraf=require(_0xb1d5('0x7'));var config=require(_0xb1d5('0x8'));var attributes=require(_0xb1d5('0x9'));module['exports']=function(_0x5b206c,_0x4b4a97){return _0x5b206c['define'](_0xb1d5('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb1d5('0xb'),'collate':_0xb1d5('0xc')});}; \ No newline at end of file +var _0xf38a=['exports','userNotifications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf38a,0x199));var _0xaf38=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xf38a[_0x1385dc];return _0x2f6469;};'use strict';var _=require(_0xaf38('0x0'));var util=require(_0xaf38('0x1'));var logger=require(_0xaf38('0x2'))(_0xaf38('0x3'));var moment=require(_0xaf38('0x4'));var BPromise=require(_0xaf38('0x5'));var rp=require(_0xaf38('0x6'));var fs=require('fs');var path=require(_0xaf38('0x7'));var rimraf=require(_0xaf38('0x8'));var config=require(_0xaf38('0x9'));var attributes=require(_0xaf38('0xa'));module[_0xaf38('0xb')]=function(_0xd17a59,_0x3dd06a){return _0xd17a59['define']('UserNotification',attributes,{'tableName':_0xaf38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf38('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 59fed32..110a8a9 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27d8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird'];(function(_0x50b592,_0x230099){var _0xcd3ac7=function(_0x46b90c){while(--_0x46b90c){_0x50b592['push'](_0x50b592['shift']());}};_0xcd3ac7(++_0x230099);}(_0x27d8,0x1e1));var _0x827d=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x27d8[_0x15ca1a];return _0x507626;};'use strict';var _=require(_0x827d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x827d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x827d('0x2'))['db'];var utils=require(_0x827d('0x3'));var logger=require(_0x827d('0x4'))(_0x827d('0x5'));var config=require(_0x827d('0x6'));var jayson=require(_0x827d('0x7'));var client=jayson[_0x827d('0x8')]['http']({'port':0x232a});config[_0x827d('0x9')]=_['defaults'](config['redis'],{'host':_0x827d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x827d('0x9')]));require(_0x827d('0xb'))[_0x827d('0xc')](socket);function respondWithRpcPromise(_0x3eb700,_0x34ff9f,_0x32a167){return new BPromise(function(_0x5859ad,_0x4ecdd1){return client[_0x827d('0xd')](_0x3eb700,_0x32a167)['then'](function(_0x8145fa){logger['info'](_0x827d('0xe'),_0x34ff9f,_0x827d('0xf'));logger['debug'](_0x827d('0x10'),_0x34ff9f,_0x827d('0xf'),JSON[_0x827d('0x11')](_0x8145fa));if(_0x8145fa[_0x827d('0x12')]){if(_0x8145fa[_0x827d('0x12')]['code']===0x1f4){logger['error'](_0x827d('0xe'),_0x34ff9f,_0x8145fa[_0x827d('0x12')][_0x827d('0x13')]);return _0x4ecdd1(_0x8145fa['error'][_0x827d('0x13')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x34ff9f,_0x8145fa['error'][_0x827d('0x13')]);return _0x5859ad(_0x8145fa[_0x827d('0x12')]['message']);}else{logger['info'](_0x827d('0xe'),_0x34ff9f,_0x827d('0xf'));_0x5859ad(_0x8145fa[_0x827d('0x14')][_0x827d('0x13')]);}})['catch'](function(_0x31b96d){logger[_0x827d('0x12')](_0x827d('0xe'),_0x34ff9f,_0x31b96d);_0x4ecdd1(_0x31b96d);});});} \ No newline at end of file +var _0x409f=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','request','then','UserNotification,\x20%s,\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x409f,0xd9));var _0xf409=function(_0xf7c2a9,_0x9337fe){_0xf7c2a9=_0xf7c2a9-0x0;var _0x367b36=_0x409f[_0xf7c2a9];return _0x367b36;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf409('0x0'));var BPromise=require(_0xf409('0x1'));var rs=require(_0xf409('0x2'));var fs=require('fs');var Redis=require(_0xf409('0x3'));var db=require(_0xf409('0x4'))['db'];var utils=require(_0xf409('0x5'));var logger=require('../../config/logger')(_0xf409('0x6'));var config=require('../../config/environment');var jayson=require(_0xf409('0x7'));var client=jayson[_0xf409('0x8')][_0xf409('0x9')]({'port':0x232a});config[_0xf409('0xa')]=_[_0xf409('0xb')](config[_0xf409('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf409('0xc'))(new Redis(config['redis']));require(_0xf409('0xd'))['register'](socket);function respondWithRpcPromise(_0x1df0c3,_0x461650,_0x44e711){return new BPromise(function(_0x1d3064,_0x446fb6){return client[_0xf409('0xe')](_0x1df0c3,_0x44e711)[_0xf409('0xf')](function(_0x18f4ac){logger['info'](_0xf409('0x10'),_0x461650,_0xf409('0x11'));logger[_0xf409('0x12')](_0xf409('0x13'),_0x461650,_0xf409('0x11'),JSON['stringify'](_0x18f4ac));if(_0x18f4ac[_0xf409('0x14')]){if(_0x18f4ac['error'][_0xf409('0x15')]===0x1f4){logger[_0xf409('0x14')](_0xf409('0x10'),_0x461650,_0x18f4ac['error'][_0xf409('0x16')]);return _0x446fb6(_0x18f4ac[_0xf409('0x14')][_0xf409('0x16')]);}logger[_0xf409('0x14')](_0xf409('0x10'),_0x461650,_0x18f4ac[_0xf409('0x14')][_0xf409('0x16')]);return _0x1d3064(_0x18f4ac[_0xf409('0x14')][_0xf409('0x16')]);}else{logger[_0xf409('0x17')]('UserNotification,\x20%s,\x20%s',_0x461650,_0xf409('0x11'));_0x1d3064(_0x18f4ac[_0xf409('0x18')]['message']);}})[_0xf409('0x19')](function(_0x15ce04){logger['error'](_0xf409('0x10'),_0x461650,_0x15ce04);_0x446fb6(_0x15ce04);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 6f26cce..dad680b 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea83=['./userNotification.events','save','remove','update','removeListener','register','length','userNotification:'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xea83,0x148));var _0x3ea8=function(_0x599aaf,_0x3d3622){_0x599aaf=_0x599aaf-0x0;var _0xd995f3=_0xea83[_0x599aaf];return _0xd995f3;};'use strict';var UserNotificationEvents=require(_0x3ea8('0x0'));var events=[_0x3ea8('0x1'),_0x3ea8('0x2'),_0x3ea8('0x3')];function createListener(_0x61b082,_0x24cbd8){return function(_0x318e9e){_0x24cbd8['emit'](_0x61b082,_0x318e9e);};}function removeListener(_0x3196d6,_0x3eb89f){return function(){UserNotificationEvents[_0x3ea8('0x4')](_0x3196d6,_0x3eb89f);};}exports[_0x3ea8('0x5')]=function(_0x241ffd){for(var _0x1ef512=0x0,_0x374813=events[_0x3ea8('0x6')];_0x1ef512<_0x374813;_0x1ef512++){var _0xb2093d=events[_0x1ef512];var _0x565f97=createListener(_0x3ea8('0x7')+_0xb2093d,_0x241ffd);UserNotificationEvents['on'](_0xb2093d,_0x565f97);}}; \ No newline at end of file +var _0xf3f2=['save','update','emit','length','userNotification:','./userNotification.events'];(function(_0x57f785,_0x1b4f18){var _0x5a5eb4=function(_0x2a7381){while(--_0x2a7381){_0x57f785['push'](_0x57f785['shift']());}};_0x5a5eb4(++_0x1b4f18);}(_0xf3f2,0x1df));var _0x2f3f=function(_0x40faa5,_0x421fc8){_0x40faa5=_0x40faa5-0x0;var _0xe631cb=_0xf3f2[_0x40faa5];return _0xe631cb;};'use strict';var UserNotificationEvents=require(_0x2f3f('0x0'));var events=[_0x2f3f('0x1'),'remove',_0x2f3f('0x2')];function createListener(_0xed66ab,_0x1d1851){return function(_0x850c42){_0x1d1851[_0x2f3f('0x3')](_0xed66ab,_0x850c42);};}function removeListener(_0x2716a4,_0x19921){return function(){UserNotificationEvents['removeListener'](_0x2716a4,_0x19921);};}exports['register']=function(_0x365642){for(var _0xd3e88a=0x0,_0x1b93e2=events[_0x2f3f('0x4')];_0xd3e88a<_0x1b93e2;_0xd3e88a++){var _0x1bd7b4=events[_0xd3e88a];var _0x9fb2de=createListener(_0x2f3f('0x5')+_0x1bd7b4,_0x365642);UserNotificationEvents['on'](_0x1bd7b4,_0x9fb2de);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9f7a885..155b123 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x12860f,_0x128706){var _0x1f98e5=function(_0x2ce508){while(--_0x2ce508){_0x12860f['push'](_0x12860f['shift']());}};_0x1f98e5(++_0x128706);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3fb07b,_0x2920ca){var _0x15cdb4=function(_0x93d9d5){while(--_0x93d9d5){_0x3fb07b['push'](_0x3fb07b['shift']());}};_0x15cdb4(++_0x2920ca);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3c1f74f..845e484 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eee=['sequelize','exports','INTEGER'];(function(_0x88ff96,_0xfebc43){var _0x3733fa=function(_0x250d8a){while(--_0x250d8a){_0x88ff96['push'](_0x88ff96['shift']());}};_0x3733fa(++_0xfebc43);}(_0x8eee,0xed));var _0xe8ee=function(_0x1c4c1a,_0x1e4d6b){_0x1c4c1a=_0x1c4c1a-0x0;var _0x434002=_0x8eee[_0x1c4c1a];return _0x434002;};'use strict';var Sequelize=require(_0xe8ee('0x0'));module[_0xe8ee('0x1')]={'penalty':{'type':Sequelize[_0xe8ee('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x738e=['exports','INTEGER'];(function(_0x1aebe5,_0x1f22d1){var _0x106903=function(_0x13b452){while(--_0x13b452){_0x1aebe5['push'](_0x1aebe5['shift']());}};_0x106903(++_0x1f22d1);}(_0x738e,0xbe));var _0xe738=function(_0x5e913f,_0x265fc0){_0x5e913f=_0x5e913f-0x0;var _0x472cc4=_0x738e[_0x5e913f];return _0x472cc4;};'use strict';var Sequelize=require('sequelize');module[_0xe738('0x0')]={'penalty':{'type':Sequelize[_0xe738('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 6684d27..4f78642 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55b8=['../../config/environment','exports','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','moment','bluebird','request-promise'];(function(_0x3fde45,_0x1f2579){var _0x2bf141=function(_0x3e3ae){while(--_0x3e3ae){_0x3fde45['push'](_0x3fde45['shift']());}};_0x2bf141(++_0x1f2579);}(_0x55b8,0x1cc));var _0x855b=function(_0x4fd464,_0x402c7d){_0x4fd464=_0x4fd464-0x0;var _0x3815ff=_0x55b8[_0x4fd464];return _0x3815ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x855b('0x0'))('api');var moment=require(_0x855b('0x1'));var BPromise=require(_0x855b('0x2'));var rp=require(_0x855b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x855b('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x855b('0x5')]=function(_0x3a0865,_0x5c5b81){return _0x3a0865['define'](_0x855b('0x6'),attributes,{'tableName':_0x855b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42a7=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x339a8f,_0x3a4ab1){var _0x5e874f=function(_0x51d350){while(--_0x51d350){_0x339a8f['push'](_0x339a8f['shift']());}};_0x5e874f(++_0x3a4ab1);}(_0x42a7,0xc8));var _0x742a=function(_0x2a9cf3,_0x11bef3){_0x2a9cf3=_0x2a9cf3-0x0;var _0x22c80a=_0x42a7[_0x2a9cf3];return _0x22c80a;};'use strict';var _=require(_0x742a('0x0'));var util=require('util');var logger=require(_0x742a('0x1'))(_0x742a('0x2'));var moment=require('moment');var BPromise=require(_0x742a('0x3'));var rp=require(_0x742a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x742a('0x5'));var config=require(_0x742a('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x742a('0x7')]=function(_0x867e73,_0x2efd7f){return _0x867e73['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index a6e43c7..a0d725a 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b3f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x21b9e0,_0x4357ba){var _0x15c344=function(_0x4debd5){while(--_0x4debd5){_0x21b9e0['push'](_0x21b9e0['shift']());}};_0x15c344(++_0x4357ba);}(_0x9b3f,0x102));var _0xf9b3=function(_0x269b74,_0x1fda34){_0x269b74=_0x269b74-0x0;var _0x44c16b=_0x9b3f[_0x269b74];return _0x44c16b;};'use strict';var _=require(_0xf9b3('0x0'));var util=require(_0xf9b3('0x1'));var moment=require(_0xf9b3('0x2'));var BPromise=require(_0xf9b3('0x3'));var rs=require(_0xf9b3('0x4'));var fs=require('fs');var Redis=require(_0xf9b3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf9b3('0x6'));var logger=require(_0xf9b3('0x7'))(_0xf9b3('0x8'));var config=require(_0xf9b3('0x9'));var jayson=require(_0xf9b3('0xa'));var client=jayson[_0xf9b3('0xb')][_0xf9b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cd3e3,_0x37b88a,_0x4119dd){return new BPromise(function(_0x362260,_0x354935){return client['request'](_0x1cd3e3,_0x4119dd)[_0xf9b3('0xd')](function(_0x5a6e8d){logger['info'](_0xf9b3('0xe'),_0x37b88a,_0xf9b3('0xf'));logger[_0xf9b3('0x10')](_0xf9b3('0x11'),_0x37b88a,'request\x20sent',JSON['stringify'](_0x5a6e8d));if(_0x5a6e8d[_0xf9b3('0x12')]){if(_0x5a6e8d[_0xf9b3('0x12')][_0xf9b3('0x13')]===0x1f4){logger[_0xf9b3('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x37b88a,_0x5a6e8d[_0xf9b3('0x12')][_0xf9b3('0x14')]);return _0x354935(_0x5a6e8d[_0xf9b3('0x12')][_0xf9b3('0x14')]);}logger[_0xf9b3('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x37b88a,_0x5a6e8d[_0xf9b3('0x12')][_0xf9b3('0x14')]);return _0x362260(_0x5a6e8d[_0xf9b3('0x12')][_0xf9b3('0x14')]);}else{logger['info'](_0xf9b3('0xe'),_0x37b88a,_0xf9b3('0xf'));_0x362260(_0x5a6e8d[_0xf9b3('0x15')][_0xf9b3('0x14')]);}})['catch'](function(_0x1b618f){logger[_0xf9b3('0x12')](_0xf9b3('0xe'),_0x37b88a,_0x1b618f);_0x354935(_0x1b618f);});});} \ No newline at end of file +var _0x6785=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring'];(function(_0x369118,_0xa363c3){var _0x3c8be2=function(_0x12db8f){while(--_0x12db8f){_0x369118['push'](_0x369118['shift']());}};_0x3c8be2(++_0xa363c3);}(_0x6785,0x128));var _0x5678=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6785[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x5678('0x0'));var util=require('util');var moment=require(_0x5678('0x1'));var BPromise=require('bluebird');var rs=require(_0x5678('0x2'));var fs=require('fs');var Redis=require(_0x5678('0x3'));var db=require(_0x5678('0x4'))['db'];var utils=require(_0x5678('0x5'));var logger=require(_0x5678('0x6'))(_0x5678('0x7'));var config=require(_0x5678('0x8'));var jayson=require(_0x5678('0x9'));var client=jayson[_0x5678('0xa')][_0x5678('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x216ced,_0x2f6241,_0x4448c7){return new BPromise(function(_0x5c4d94,_0x57a9b9){return client[_0x5678('0xc')](_0x216ced,_0x4448c7)[_0x5678('0xd')](function(_0x1dff5d){logger[_0x5678('0xe')](_0x5678('0xf'),_0x2f6241,'request\x20sent');logger[_0x5678('0x10')](_0x5678('0x11'),_0x2f6241,_0x5678('0x12'),JSON['stringify'](_0x1dff5d));if(_0x1dff5d['error']){if(_0x1dff5d[_0x5678('0x13')][_0x5678('0x14')]===0x1f4){logger[_0x5678('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2f6241,_0x1dff5d[_0x5678('0x13')][_0x5678('0x15')]);return _0x57a9b9(_0x1dff5d['error'][_0x5678('0x15')]);}logger['error'](_0x5678('0xf'),_0x2f6241,_0x1dff5d['error'][_0x5678('0x15')]);return _0x5c4d94(_0x1dff5d[_0x5678('0x13')]['message']);}else{logger[_0x5678('0xe')](_0x5678('0xf'),_0x2f6241,'request\x20sent');_0x5c4d94(_0x1dff5d[_0x5678('0x16')][_0x5678('0x15')]);}})['catch'](function(_0x2215a0){logger[_0x5678('0x13')](_0x5678('0xf'),_0x2f6241,_0x2215a0);_0x57a9b9(_0x2215a0);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index c6e6989..56ffad7 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8d9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','describe','/:id/resources','isAuthenticated','getResources','post','create','clone','addSections','addResources','put','update','delete','/:id','destroy','/:id/sections','removeResources','multer','util','path','connect-timeout'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb8d9,0x175));var _0x9b8d=function(_0x5150b6,_0xa888c8){_0x5150b6=_0x5150b6-0x0;var _0x286b37=_0xb8d9[_0x5150b6];return _0x286b37;};'use strict';var multer=require(_0x9b8d('0x0'));var util=require(_0x9b8d('0x1'));var path=require(_0x9b8d('0x2'));var timeout=require(_0x9b8d('0x3'));var express=require(_0x9b8d('0x4'));var router=express[_0x9b8d('0x5')]();var fs_extra=require(_0x9b8d('0x6'));var auth=require(_0x9b8d('0x7'));var interaction=require(_0x9b8d('0x8'));var config=require(_0x9b8d('0x9'));var controller=require(_0x9b8d('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b8d('0xb')]);router[_0x9b8d('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x9b8d('0xd')]);router[_0x9b8d('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9b8d('0xc')]('/:id/sections',auth['isAuthenticated'](),controller['getSections']);router[_0x9b8d('0xc')](_0x9b8d('0xe'),auth[_0x9b8d('0xf')](),controller[_0x9b8d('0x10')]);router[_0x9b8d('0x11')]('/',auth[_0x9b8d('0xf')](),controller[_0x9b8d('0x12')]);router[_0x9b8d('0x11')]('/:id/clone',auth['isAuthenticated'](),controller[_0x9b8d('0x13')]);router[_0x9b8d('0x11')]('/:id/sections',auth[_0x9b8d('0xf')](),controller[_0x9b8d('0x14')]);router['post'](_0x9b8d('0xe'),auth[_0x9b8d('0xf')](),controller[_0x9b8d('0x15')]);router[_0x9b8d('0x16')]('/:id',auth[_0x9b8d('0xf')](),controller[_0x9b8d('0x17')]);router[_0x9b8d('0x18')](_0x9b8d('0x19'),auth['isAuthenticated'](),controller[_0x9b8d('0x1a')]);router[_0x9b8d('0x18')](_0x9b8d('0x1b'),auth[_0x9b8d('0xf')](),controller['removeSections']);router[_0x9b8d('0x18')](_0x9b8d('0xe'),auth[_0x9b8d('0xf')](),controller[_0x9b8d('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x1581=['/:id/clone','clone','addSections','/:id/resources','addResources','put','update','delete','destroy','removeResources','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getResources','post','create'];(function(_0x3975c4,_0x1091e2){var _0x106160=function(_0x3ee0f8){while(--_0x3ee0f8){_0x3975c4['push'](_0x3975c4['shift']());}};_0x106160(++_0x1091e2);}(_0x1581,0x118));var _0x1158=function(_0x874e38,_0xe9b538){_0x874e38=_0x874e38-0x0;var _0x5f0419=_0x1581[_0x874e38];return _0x5f0419;};'use strict';var multer=require(_0x1158('0x0'));var util=require(_0x1158('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1158('0x2'));var router=express['Router']();var fs_extra=require(_0x1158('0x3'));var auth=require(_0x1158('0x4'));var interaction=require(_0x1158('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x1158('0x6')]('/',auth[_0x1158('0x7')](),controller[_0x1158('0x8')]);router['get'](_0x1158('0x9'),auth['isAuthenticated'](),controller[_0x1158('0xa')]);router[_0x1158('0x6')](_0x1158('0xb'),auth[_0x1158('0x7')](),controller[_0x1158('0xc')]);router[_0x1158('0x6')](_0x1158('0xd'),auth['isAuthenticated'](),controller['getSections']);router[_0x1158('0x6')]('/:id/resources',auth['isAuthenticated'](),controller[_0x1158('0xe')]);router[_0x1158('0xf')]('/',auth[_0x1158('0x7')](),controller[_0x1158('0x10')]);router[_0x1158('0xf')](_0x1158('0x11'),auth[_0x1158('0x7')](),controller[_0x1158('0x12')]);router[_0x1158('0xf')](_0x1158('0xd'),auth[_0x1158('0x7')](),controller[_0x1158('0x13')]);router[_0x1158('0xf')](_0x1158('0x14'),auth['isAuthenticated'](),controller[_0x1158('0x15')]);router[_0x1158('0x16')](_0x1158('0xb'),auth[_0x1158('0x7')](),controller[_0x1158('0x17')]);router[_0x1158('0x18')](_0x1158('0xb'),auth[_0x1158('0x7')](),controller[_0x1158('0x19')]);router['delete'](_0x1158('0xd'),auth[_0x1158('0x7')](),controller['removeSections']);router['delete'](_0x1158('0x14'),auth[_0x1158('0x7')](),controller[_0x1158('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8162f86..d11acbb 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe836=['BOOLEAN','STRING','name','join','getDataValue','crudPermissions','split'];(function(_0x79dc84,_0x1833f8){var _0x2510d7=function(_0xb6679b){while(--_0xb6679b){_0x79dc84['push'](_0x79dc84['shift']());}};_0x2510d7(++_0x1833f8);}(_0xe836,0x143));var _0x6e83=function(_0xad984e,_0x441da5){_0xad984e=_0xad984e-0x0;var _0x1b23c7=_0xe836[_0xad984e];return _0x1b23c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6e83('0x0')],'allowNull':![],'unique':_0x6e83('0x1')},'crudPermissions':{'type':Sequelize[_0x6e83('0x0')],'set':function(_0x2a35b9){this['setDataValue']('crudPermissions',_0x2a35b9?_0x2a35b9[_0x6e83('0x2')](''):[]);},'get':function(){return this[_0x6e83('0x3')](_0x6e83('0x4'))?this[_0x6e83('0x3')](_0x6e83('0x4'))[_0x6e83('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6e83('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6e83('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6e83('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x6e83('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6e83('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6e83('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xf837=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xf837,0x18d));var _0x7f83=function(_0x327dac,_0x230179){_0x327dac=_0x327dac-0x0;var _0xef78e5=_0xf837[_0x327dac];return _0xef78e5;};'use strict';var Sequelize=require(_0x7f83('0x0'));module[_0x7f83('0x1')]={'name':{'type':Sequelize[_0x7f83('0x2')],'allowNull':![],'unique':_0x7f83('0x3')},'crudPermissions':{'type':Sequelize[_0x7f83('0x2')],'set':function(_0x5f4c7f){this[_0x7f83('0x4')](_0x7f83('0x5'),_0x5f4c7f?_0x5f4c7f[_0x7f83('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x7f83('0x5'))?this[_0x7f83('0x7')]('crudPermissions')[_0x7f83('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7f83('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7f83('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7f83('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7f83('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index ffc8c53..4293aec 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83ab=['../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','send','index','UserProfile','rawAttributes','fieldName','type','map','name','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','merge','create','clone','find','omit','updatedAt','body','createdAt','sequelize','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','transaction','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x83ab,0xc6));var _0xb83a=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0x83ab[_0x5f49c0];return _0x5ab653;};'use strict';var emlformat=require(_0xb83a('0x0'));var rimraf=require(_0xb83a('0x1'));var zipdir=require(_0xb83a('0x2'));var jsonpatch=require(_0xb83a('0x3'));var rp=require(_0xb83a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb83a('0x5'));var util=require('util');var path=require(_0xb83a('0x6'));var sox=require(_0xb83a('0x7'));var csv=require(_0xb83a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb83a('0x9'));var squel=require(_0xb83a('0xa'));var crypto=require(_0xb83a('0xb'));var jsforce=require(_0xb83a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb83a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb83a('0xd'));var as=require(_0xb83a('0xe'));var hardwareService=require(_0xb83a('0xf'));var logger=require(_0xb83a('0x10'))(_0xb83a('0x11'));var utils=require('../../config/utils');var config=require(_0xb83a('0x12'));var licenseUtil=require(_0xb83a('0x13'));var db=require('../../mysqldb')['db'];config[_0xb83a('0x14')]=_[_0xb83a('0x15')](config['redis'],{'host':_0xb83a('0x16'),'port':0x18eb});var socket=require(_0xb83a('0x17'))(new Redis(config['redis']));require(_0xb83a('0x18'))[_0xb83a('0x19')](socket);function respondWithStatusCode(_0x111af8,_0x53efff){_0x53efff=_0x53efff||0xcc;return function(_0xe8381c){if(_0xe8381c){return _0x111af8[_0xb83a('0x1a')](_0x53efff);}return _0x111af8[_0xb83a('0x1b')](_0x53efff)['end']();};}function respondWithResult(_0x21d45a,_0x53cfa0){_0x53cfa0=_0x53cfa0||0xc8;return function(_0x4119f8){if(_0x4119f8){return _0x21d45a[_0xb83a('0x1b')](_0x53cfa0)['json'](_0x4119f8);}};}function respondWithFilteredResult(_0x3931a9,_0x2bf959){return function(_0x273cdb){if(_0x273cdb){var _0x540d5f=typeof _0x2bf959[_0xb83a('0x1c')]===_0xb83a('0x1d')&&typeof _0x2bf959[_0xb83a('0x1e')]===_0xb83a('0x1d');var _0x5e14a7=_0x273cdb[_0xb83a('0x1f')];var _0x258a85=_0x540d5f?0x0:_0x2bf959['offset'];var _0x5ddf85=_0x540d5f?_0x273cdb[_0xb83a('0x1f')]:_0x2bf959[_0xb83a('0x1c')]+_0x2bf959[_0xb83a('0x1e')];var _0x43bd9c;if(_0x5ddf85>=_0x5e14a7){_0x5ddf85=_0x5e14a7;_0x43bd9c=0xc8;}else{_0x43bd9c=0xce;}_0x3931a9[_0xb83a('0x1b')](_0x43bd9c);return _0x3931a9[_0xb83a('0x20')](_0xb83a('0x21'),_0x258a85+'-'+_0x5ddf85+'/'+_0x5e14a7)['json'](_0x273cdb);}return null;};}function patchUpdates(_0x41aa70){return function(_0x4e550f){try{jsonpatch['apply'](_0x4e550f,_0x41aa70,!![]);}catch(_0x329601){return BPromise['reject'](_0x329601);}return _0x4e550f[_0xb83a('0x22')]();};}function saveUpdates(_0x253a16,_0x3b1480){return function(_0x3b24c4){if(_0x3b24c4){return _0x3b24c4[_0xb83a('0x23')](_0x253a16)[_0xb83a('0x24')](function(_0x4b5fee){return _0x4b5fee;});}return null;};}function removeEntity(_0xf600ca,_0x30182e){return function(_0x46bda2){if(_0x46bda2){return _0x46bda2[_0xb83a('0x25')]()[_0xb83a('0x24')](function(){_0xf600ca[_0xb83a('0x1b')](0xcc)[_0xb83a('0x26')]();});}};}function handleEntityNotFound(_0x3b2859,_0x464f5d){return function(_0x2fb996){if(!_0x2fb996){_0x3b2859[_0xb83a('0x1a')](0x194);}return _0x2fb996;};}function handleError(_0x117823,_0x78e1f){_0x78e1f=_0x78e1f||0x1f4;return function(_0x472098){logger[_0xb83a('0x27')](_0x472098['stack']);if(_0x472098['name']){delete _0x472098['name'];}_0x117823[_0xb83a('0x1b')](_0x78e1f)[_0xb83a('0x28')](_0x472098);};}exports[_0xb83a('0x29')]=function(_0x139d50,_0x105890){var _0x21af72={},_0x57e08d={},_0x3be5d2={'count':0x0,'rows':[]};var _0x7062a6=_['map'](db[_0xb83a('0x2a')][_0xb83a('0x2b')],function(_0x11932e){return{'name':_0x11932e[_0xb83a('0x2c')],'type':_0x11932e[_0xb83a('0x2d')]['key']};});_0x57e08d['model']=_[_0xb83a('0x2e')](_0x7062a6,_0xb83a('0x2f'));_0x57e08d[_0xb83a('0x30')]=_['keys'](_0x139d50[_0xb83a('0x30')]);_0x57e08d[_0xb83a('0x31')]=_[_0xb83a('0x32')](_0x57e08d['model'],_0x57e08d[_0xb83a('0x30')]);_0x21af72[_0xb83a('0x33')]=_['intersection'](_0x57e08d[_0xb83a('0x34')],qs[_0xb83a('0x35')](_0x139d50[_0xb83a('0x30')][_0xb83a('0x35')]));_0x21af72[_0xb83a('0x33')]=_0x21af72[_0xb83a('0x33')]['length']?_0x21af72['attributes']:_0x57e08d['model'];if(!_0x139d50[_0xb83a('0x30')][_0xb83a('0x36')]('nolimit')){_0x21af72[_0xb83a('0x1e')]=qs['limit'](_0x139d50[_0xb83a('0x30')][_0xb83a('0x1e')]);_0x21af72[_0xb83a('0x1c')]=qs[_0xb83a('0x1c')](_0x139d50[_0xb83a('0x30')]['offset']);}_0x21af72[_0xb83a('0x37')]=qs['sort'](_0x139d50[_0xb83a('0x30')][_0xb83a('0x38')]);_0x21af72['where']=qs[_0xb83a('0x31')](_[_0xb83a('0x39')](_0x139d50[_0xb83a('0x30')],_0x57e08d[_0xb83a('0x31')]),_0x7062a6);if(_0x139d50[_0xb83a('0x30')][_0xb83a('0x3a')]){_0x21af72['where']=_['merge'](_0x21af72['where'],{'$or':_[_0xb83a('0x2e')](_0x7062a6,function(_0x243f62){if(_0x243f62[_0xb83a('0x2d')]!==_0xb83a('0x3b')){var _0x235ad7={};_0x235ad7[_0x243f62[_0xb83a('0x2f')]]={'$like':'%'+_0x139d50[_0xb83a('0x30')]['filter']+'%'};return _0x235ad7;}})});}_0x21af72=_['merge']({},_0x21af72,_0x139d50[_0xb83a('0x3c')]);var _0x22b7a6={'where':_0x21af72['where']};return db[_0xb83a('0x2a')][_0xb83a('0x1f')](_0x22b7a6)[_0xb83a('0x24')](function(_0x42b96d){_0x3be5d2[_0xb83a('0x1f')]=_0x42b96d;if(_0x139d50[_0xb83a('0x30')][_0xb83a('0x3d')]){_0x21af72['include']=[{'all':!![]}];}return db['UserProfile'][_0xb83a('0x3e')](_0x21af72);})[_0xb83a('0x24')](function(_0x286daf){_0x3be5d2[_0xb83a('0x3f')]=_0x286daf;return _0x3be5d2;})['then'](respondWithFilteredResult(_0x105890,_0x21af72))[_0xb83a('0x40')](handleError(_0x105890,null));};exports['show']=function(_0xc93fa6,_0x504bdd){var _0x2d1e71={'raw':![],'where':{'id':_0xc93fa6[_0xb83a('0x41')]['id']}},_0x4ae3a5={};_0x4ae3a5[_0xb83a('0x34')]=_['keys'](db[_0xb83a('0x2a')][_0xb83a('0x2b')]);_0x4ae3a5[_0xb83a('0x30')]=_[_0xb83a('0x42')](_0xc93fa6[_0xb83a('0x30')]);_0x4ae3a5[_0xb83a('0x31')]=_[_0xb83a('0x32')](_0x4ae3a5[_0xb83a('0x34')],_0x4ae3a5['query']);_0x2d1e71[_0xb83a('0x33')]=_[_0xb83a('0x32')](_0x4ae3a5[_0xb83a('0x34')],qs[_0xb83a('0x35')](_0xc93fa6[_0xb83a('0x30')][_0xb83a('0x35')]));_0x2d1e71[_0xb83a('0x33')]=_0x2d1e71[_0xb83a('0x33')]['length']?_0x2d1e71[_0xb83a('0x33')]:_0x4ae3a5['model'];if(_0xc93fa6[_0xb83a('0x30')][_0xb83a('0x3d')]){_0x2d1e71[_0xb83a('0x43')]=[{'all':!![]}];}_0x2d1e71=_[_0xb83a('0x44')]({},_0x2d1e71,_0xc93fa6[_0xb83a('0x3c')]);return db['UserProfile']['find'](_0x2d1e71)[_0xb83a('0x24')](handleEntityNotFound(_0x504bdd,null))[_0xb83a('0x24')](respondWithResult(_0x504bdd,null))[_0xb83a('0x40')](handleError(_0x504bdd,null));};exports[_0xb83a('0x45')]=function(_0x345e4f,_0x4fe49f){return db[_0xb83a('0x2a')][_0xb83a('0x45')](_0x345e4f['body'],{})[_0xb83a('0x24')](respondWithResult(_0x4fe49f,0xc9))[_0xb83a('0x40')](handleError(_0x4fe49f,null));};exports[_0xb83a('0x46')]=function(_0x492825,_0x22dc8f){var _0x4ba058={'where':{'id':_0x492825[_0xb83a('0x41')]['id']}},_0x356d3c={};_0x356d3c['model']=_[_0xb83a('0x42')](db[_0xb83a('0x2a')][_0xb83a('0x2b')]);_0x4ba058['attributes']=_['intersection'](_0x356d3c[_0xb83a('0x34')],qs['fields'](_0x492825[_0xb83a('0x30')][_0xb83a('0x35')]));_0x4ba058[_0xb83a('0x33')]=_0x4ba058[_0xb83a('0x33')]['length']?_0x4ba058[_0xb83a('0x33')]:_0x356d3c[_0xb83a('0x34')];if(_0x492825[_0xb83a('0x30')][_0xb83a('0x3d')]){_0x4ba058[_0xb83a('0x43')]=[{'all':!![]}];}_0x4ba058=_[_0xb83a('0x44')]({},_0x4ba058,_0x492825[_0xb83a('0x3c')]);return db[_0xb83a('0x2a')][_0xb83a('0x47')](_0x4ba058)[_0xb83a('0x24')](handleEntityNotFound(_0x22dc8f,null))[_0xb83a('0x24')](function(_0x2217df){if(_0x2217df){var _0x160ec2=_0x2217df['get']({'plain':!![]});_0x160ec2=qs[_0xb83a('0x48')](_0x160ec2,['id','createdAt',_0xb83a('0x49'),'crudPermissions']);_0x492825[_0xb83a('0x4a')]=_['omit'](_0x492825[_0xb83a('0x4a')],['id',_0xb83a('0x4b'),'updatedAt']);return db[_0xb83a('0x4c')]['transaction'](function(_0x2b0bfc){return db[_0xb83a('0x2a')]['create'](_[_0xb83a('0x44')](_0x160ec2,_0x492825[_0xb83a('0x4a')]),{'include':_0x492825[_0xb83a('0x30')][_0xb83a('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0x2b0bfc})[_0xb83a('0x24')](function(_0x3e44aa){var _0x551597=_0x3e44aa[_0xb83a('0x4d')]({'plain':!![]});return db[_0xb83a('0x4e')][_0xb83a('0x3e')]({'where':{'userProfileId':_0x492825[_0xb83a('0x41')]['id']},'raw':!![]})[_0xb83a('0x24')](function(_0x20920e){if(_0x20920e){return BPromise[_0xb83a('0x4f')](_0x20920e,function(_0x33c8bb){return new BPromise(function(_0x1ff186,_0x1a2b4f){if(_0x33c8bb[_0xb83a('0x50')]===null||_0x33c8bb['autoAssociation']===0x1)_0x1ff186(null);return db[_0xb83a('0x51')][_0xb83a('0x3e')]({'where':{'sectionId':_0x33c8bb['id']},'raw':!![]})[_0xb83a('0x24')](function(_0xf43306){var _0x5b90c6=_[_0xb83a('0x2e')](_0xf43306,function(_0x3fd334){return qs[_0xb83a('0x48')](_0x3fd334,['id',_0xb83a('0x4b'),_0xb83a('0x49'),_0xb83a('0x52')]);});_0x1ff186(_0x5b90c6);})['catch'](function(_0x501b37){_0x1a2b4f(_0x501b37);});})[_0xb83a('0x24')](function(_0x30ae4a){var _0x16ee85=qs['omit'](_0x33c8bb,['id','createdAt','updatedAt']);_0x16ee85[_0xb83a('0x53')]=_0x551597['id'];if(_0x30ae4a)_0x16ee85[_0xb83a('0x54')]=_0x30ae4a;return _0x16ee85;})['then'](function(_0x3f6f15){return db['UserProfileSection'][_0xb83a('0x45')](_0x3f6f15,{'include':[{'model':db[_0xb83a('0x51')],'as':_0xb83a('0x54')}],'raw':!![],'transaction':_0x2b0bfc});});})['then'](function(){return _0x551597;});}});});});}})['then'](respondWithResult(_0x22dc8f,0xc9))[_0xb83a('0x40')](handleError(_0x22dc8f,null));};exports['update']=function(_0x390d4e,_0x32dc6c){if(_0x390d4e[_0xb83a('0x4a')]['id']){delete _0x390d4e[_0xb83a('0x4a')]['id'];}return db[_0xb83a('0x2a')][_0xb83a('0x47')]({'where':{'id':_0x390d4e[_0xb83a('0x41')]['id']}})[_0xb83a('0x24')](handleEntityNotFound(_0x32dc6c,null))['then'](saveUpdates(_0x390d4e[_0xb83a('0x4a')],null))[_0xb83a('0x24')](respondWithResult(_0x32dc6c,null))['catch'](handleError(_0x32dc6c,null));};exports[_0xb83a('0x25')]=function(_0x1b6af9,_0x34ddcb){return db['UserProfile'][_0xb83a('0x47')]({'where':{'id':_0x1b6af9[_0xb83a('0x41')]['id']}})['then'](handleEntityNotFound(_0x34ddcb,null))[_0xb83a('0x24')](removeEntity(_0x34ddcb,null))[_0xb83a('0x40')](handleError(_0x34ddcb,null));};exports[_0xb83a('0x55')]=function(_0xd35aaa,_0x53aa42){return db[_0xb83a('0x2a')]['describe']()[_0xb83a('0x24')](respondWithResult(_0x53aa42,null))[_0xb83a('0x40')](handleError(_0x53aa42,null));};exports[_0xb83a('0x56')]=function(_0x43d801,_0x586b98){var _0x50f325=_0x43d801[_0xb83a('0x4a')];return db[_0xb83a('0x2a')][_0xb83a('0x47')]({'where':{'id':_0x43d801[_0xb83a('0x41')]['id']}})[_0xb83a('0x24')](handleEntityNotFound(_0x586b98,null))[_0xb83a('0x24')](function(_0x27ce0d){if(_0x27ce0d){return db[_0xb83a('0x4c')][_0xb83a('0x57')](function(_0x69781f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x43d801[_0xb83a('0x41')]['id'],'sectionId':_['map'](_0x50f325,function(_0x3af926){return _0x3af926[_0xb83a('0x52')];})},'transaction':_0x69781f})[_0xb83a('0x24')](function(){var _0x301c71=_[_0xb83a('0x2e')](_0x50f325,function(_0x5de21f){_0x5de21f['userProfileId']=_0x43d801['params']['id'];return _0x5de21f;});var _0xdc74bc=[];return BPromise['each'](_0x301c71,function(_0x4742e8){return db[_0xb83a('0x4e')]['create'](_0x4742e8,{'include':[{'model':db[_0xb83a('0x51')],'as':_0xb83a('0x54')}],'raw':!![],'transaction':_0x69781f})[_0xb83a('0x24')](function(_0x4b7318){_0xdc74bc[_0xb83a('0x58')](_0x4b7318[_0xb83a('0x4d')]({'plain':!![]}));});})[_0xb83a('0x24')](function(){return _0xdc74bc;});});});}})[_0xb83a('0x24')](function(_0x1822ca){return _0x1822ca;})[_0xb83a('0x24')](respondWithResult(_0x586b98,null))[_0xb83a('0x40')](handleError(_0x586b98,null));};exports[_0xb83a('0x59')]=function(_0x1dbaa1,_0x5c88be){var _0xce6863;return db[_0xb83a('0x2a')][_0xb83a('0x47')]({'where':{'id':_0x1dbaa1[_0xb83a('0x41')]['id']},'attributes':['id',_0xb83a('0x2f')]})[_0xb83a('0x24')](handleEntityNotFound(_0x5c88be,null))[_0xb83a('0x24')](function(_0x1ac7bd){if(_0x1ac7bd){_0xce6863=_0x1ac7bd;return db[_0xb83a('0x4e')][_0xb83a('0x25')]({'where':{'userProfileId':_0x1dbaa1[_0xb83a('0x41')]['id'],'sectionId':_0x1dbaa1[_0xb83a('0x30')][_0xb83a('0x5a')]}});}})['then'](function(){return _0xce6863;})[_0xb83a('0x24')](respondWithStatusCode(_0x5c88be,null))[_0xb83a('0x40')](handleError(_0x5c88be,null));};exports[_0xb83a('0x5b')]=function(_0x587ce0,_0xb3b6b9){var _0x3d67d6=[];var _0x45edd1=[];return db[_0xb83a('0x4e')][_0xb83a('0x3e')]({'where':{'userProfileId':_0x587ce0['params']['id']},'raw':!![]})[_0xb83a('0x24')](function(_0x395e9f){_0x3d67d6=_[_0xb83a('0x3a')](_0x395e9f,function(_0x2ad61f){return _0x2ad61f[_0xb83a('0x5c')]===0x1||_[_0xb83a('0x5d')]([0x3eb,0x709],_0x2ad61f[_0xb83a('0x52')]);});if(!_[_0xb83a('0x5e')](_0x3d67d6)){return _['map'](_0x3d67d6,function(_0x3687a9){return _0x3687a9[_0xb83a('0x52')];});}else{return;}})[_0xb83a('0x24')](function(_0x2b4cab){if(_0x2b4cab)_0x45edd1=_0x2b4cab;if(_['includes'](_0x45edd1,0x64)){var _0x4d5352=_[_0xb83a('0x47')](_0x3d67d6,{'sectionId':0x64});return hasDefaultDashboard(_0x4d5352)[_0xb83a('0x24')](function(_0x5676bf){return _[_0xb83a('0x2e')](_0x3d67d6,function(_0x496139){if(_0x496139[_0xb83a('0x52')]===0x64){_0x496139['subsections']=_0x5676bf;}return _0x496139;});});}else{return;}})[_0xb83a('0x24')](function(_0x6f7086){if(_0x6f7086)_0x3d67d6=_0x6f7086;if(_['includes'](_0x45edd1,0x3eb)){var _0x27f8b5=_['find'](_0x3d67d6,{'sectionId':0x3eb});return getCustomDashboards(_0x27f8b5)[_0xb83a('0x24')](function(_0x58ff68){return _[_0xb83a('0x2e')](_0x3d67d6,function(_0x34ed06){if(_0x27f8b5['enabled']){if(_0x34ed06['sectionId']===0x3eb){_0x34ed06[_0xb83a('0x5f')]=_0x58ff68;}}else{if(_0x34ed06['sectionId']===0x64){if(!_0x34ed06[_0xb83a('0x5f')]){_0x34ed06['subsections']=[];}_0x34ed06['subsections']=_0x34ed06[_0xb83a('0x5f')][_0xb83a('0x60')](_0x58ff68);}}return _0x34ed06;});});}else{return;}})[_0xb83a('0x24')](function(_0x114dc1){if(_0x114dc1)_0x3d67d6=_0x114dc1;if(_[_0xb83a('0x5d')](_0x45edd1,0x709)){var _0x260375=_[_0xb83a('0x47')](_0x3d67d6,{'sectionId':0x709});return getPlugins(_0x260375)[_0xb83a('0x24')](function(_0x1aa658){if(_0x260375[_0xb83a('0x5c')]){return _[_0xb83a('0x2e')](_0x3d67d6,function(_0x16ece0){if(_0x16ece0[_0xb83a('0x52')]===0x709){_0x16ece0[_0xb83a('0x5f')]=_0x1aa658;}return _0x16ece0;});}else{var _0x283e33={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1aa658};var _0x4b1cb7=_['map'](_0x3d67d6);_0x4b1cb7['push'](_0x283e33);return _0x4b1cb7;}});}else{return;}})[_0xb83a('0x24')](function(_0x174264){if(_0x174264)_0x3d67d6=_0x174264;return _[_0xb83a('0x3a')](_0x3d67d6,['enabled',0x1]);})[_0xb83a('0x24')](respondWithResult(_0xb3b6b9,null))[_0xb83a('0x40')](handleError(_0xb3b6b9,null));};function hasDefaultDashboard(_0x3ed56d){var _0x1c2079=[0x65];return new BPromise(function(_0xa110e9,_0x2bdab8){try{if(_0x3ed56d[_0xb83a('0x50')]){_0xa110e9(_0x1c2079);}else{return db[_0xb83a('0x51')][_0xb83a('0x61')]({'where':{'sectionId':_0x3ed56d['id']},'raw':!![]})[_0xb83a('0x24')](function(_0x43fbe5){_0x43fbe5?_0xa110e9(_0x1c2079):_0xa110e9();});}}catch(_0x5c71b9){_0x2bdab8(_0x5c71b9);}});}function getCustomDashboards(_0x3c2d22){var _0x3c154d=[];return new BPromise(function(_0x994950,_0x5a0ba3){try{if(_0x3c2d22['autoAssociation']){return db[_0xb83a('0x62')][_0xb83a('0x3e')]({'raw':!![]})['then'](function(_0x27f95c){_0x27f95c['forEach'](function(_0x55fd42){_0x3c154d[_0xb83a('0x58')](_0x55fd42['id']+0x1869f);});_0x994950(_0x3c154d);});}else{return db['UserProfileResource'][_0xb83a('0x3e')]({'where':{'sectionId':_0x3c2d22['id']},'raw':!![]})[_0xb83a('0x24')](function(_0x22b4b1){_0x22b4b1[_0xb83a('0x63')](function(_0x56da8b){_0x3c154d[_0xb83a('0x58')](_0x56da8b[_0xb83a('0x64')]+0x1869f);});_0x994950(_0x3c154d);});}}catch(_0x1f8e3d){_0x5a0ba3(_0x1f8e3d);}});}function getPlugins(_0x1f83cd){var _0x44fa88=[];return new BPromise(function(_0x3d5a67,_0x3ccda1){try{if(_0x1f83cd[_0xb83a('0x50')]){return db[_0xb83a('0x65')][_0xb83a('0x3e')]({'raw':!![]})[_0xb83a('0x24')](function(_0x532407){_0x532407[_0xb83a('0x63')](function(_0x4ac45b){_0x44fa88[_0xb83a('0x58')](_0x4ac45b['id']+0x15b38);});_0x3d5a67(_0x44fa88);});}else{return db[_0xb83a('0x51')][_0xb83a('0x3e')]({'where':{'sectionId':_0x1f83cd['id']},'raw':!![]})[_0xb83a('0x24')](function(_0x2fedaa){_0x2fedaa['forEach'](function(_0x1a0fcb){_0x44fa88['push'](_0x1a0fcb[_0xb83a('0x64')]+0x15b38);});_0x3d5a67(_0x44fa88);});}}catch(_0x3f8a3b){_0x3ccda1(_0x3f8a3b);}});}exports['addResources']=function(_0x681318,_0xbc18e8){return db['UserProfile'][_0xb83a('0x47')]({'where':{'id':_0x681318[_0xb83a('0x41')]['id']}})[_0xb83a('0x24')](handleEntityNotFound(_0xbc18e8,null))[_0xb83a('0x24')](function(_0x3bad1a){if(_0x3bad1a){return db[_0xb83a('0x4c')]['transaction'](function(_0x363903){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x681318['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x53d382){if(_0x53d382){return db[_0xb83a('0x4e')][_0xb83a('0x25')]({'where':{'userProfileId':_0x681318[_0xb83a('0x41')]['id'],'id':_['map'](_0x53d382,function(_0x5eb604){return _0x5eb604['id'];})},'transaction':_0x363903});}})[_0xb83a('0x24')](function(_0x2d24f5){var _0x46eee6=_[_0xb83a('0x2e')](_0x681318['body'],function(_0x2afd18){_0x2afd18['userProfileId']=_0x681318[_0xb83a('0x41')]['id'];return _0x2afd18;});return db[_0xb83a('0x4e')][_0xb83a('0x66')](_0x46eee6,{'raw':!![],'transaction':_0x363903});})['then'](function(_0x56218f){var _0x2a2cb6=_['filter'](_[_0xb83a('0x2e')](_0x56218f,function(_0x2b1763){return _0x2b1763[_0xb83a('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x2a2cb6){return db[_0xb83a('0x4e')][_0xb83a('0x3e')]({'where':{'userProfileId':_0x681318[_0xb83a('0x41')]['id'],'sectionId':_[_0xb83a('0x2e')](_0x2a2cb6,function(_0x2133d4){return _0x2133d4[_0xb83a('0x52')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xb83a('0x24')](function(_0x106971){var _0x51a128=_[_0xb83a('0x2e')](_0x681318['body'],function(_0x4ff077){_0x4ff077[_0xb83a('0x53')]=_0x681318['params']['id'];return _0x4ff077;});return db[_0xb83a('0x51')][_0xb83a('0x66')](_0x51a128,{'raw':!![],'transaction':_0x363903});});}})[_0xb83a('0x40')](handleError(_0xbc18e8,null));});}})[_0xb83a('0x24')](function(_0x354a3d){var _0x1f3b78=_['map'](_0x354a3d,function(_0xe68138){return _0xe68138['get']({'plain':!![]});});})[_0xb83a('0x24')](respondWithResult(_0xbc18e8,null))[_0xb83a('0x40')](handleError(_0xbc18e8,null));};exports[_0xb83a('0x67')]=function(_0x2e1f12,_0x10d2f2,_0x473a77){return db[_0xb83a('0x2a')][_0xb83a('0x47')]({'where':{'id':_0x2e1f12[_0xb83a('0x41')]['id']}})['then'](handleEntityNotFound(_0x10d2f2,null))['then'](function(_0x308f8b){if(_0x308f8b){return _0x308f8b[_0xb83a('0x67')](_0x2e1f12['query'][_0xb83a('0x5a')]);}})['then'](respondWithStatusCode(_0x10d2f2,null))[_0xb83a('0x40')](handleError(_0x10d2f2,null));};exports[_0xb83a('0x68')]=function(_0x518901,_0xd4f0ef){var _0x3ea695={};if(!_0x518901[_0xb83a('0x30')]['section'])throw new Error(_0xb83a('0x69'));if(!_0x518901[_0xb83a('0x30')][_0xb83a('0x36')](_0xb83a('0x6a'))){_0x3ea695['limit']=qs['limit'](_0x518901[_0xb83a('0x30')][_0xb83a('0x1e')]);_0x3ea695[_0xb83a('0x1c')]=qs[_0xb83a('0x1c')](_0x518901[_0xb83a('0x30')][_0xb83a('0x1c')]);}return db[_0xb83a('0x2a')][_0xb83a('0x47')]({'where':{'id':_0x518901[_0xb83a('0x41')]['id']}})['then'](function(_0x51fa35){if(!_0x51fa35)throw new Error(_0xb83a('0x6b')+_0x518901[_0xb83a('0x41')]['id']);return db[_0xb83a('0x2a')][_0xb83a('0x68')](_0x518901);})['then'](respondWithFilteredResult(_0xd4f0ef,_0x3ea695))['catch'](handleError(_0xd4f0ef,null));}; \ No newline at end of file +var _0x0d91=['sort','filters','filter','where','type','merge','options','include','findAll','rows','catch','params','includeAll','create','body','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','describe','addSections','transaction','UserProfileResource','removeSections','ids','getSections','includes','isEmpty','subsections','concat','enabled','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','UserProfile','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x0d91,0x17e));var _0x10d9=function(_0x488aa8,_0x3a5022){_0x488aa8=_0x488aa8-0x0;var _0x5b561e=_0x0d91[_0x488aa8];return _0x5b561e;};'use strict';var emlformat=require(_0x10d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x10d9('0x1'));var moment=require(_0x10d9('0x2'));var BPromise=require(_0x10d9('0x3'));var Mustache=require(_0x10d9('0x4'));var util=require(_0x10d9('0x5'));var path=require(_0x10d9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10d9('0x7'));var _=require('lodash');var squel=require(_0x10d9('0x8'));var crypto=require(_0x10d9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x10d9('0xa'));var toCsv=require(_0x10d9('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x10d9('0xc'));var authService=require(_0x10d9('0xd'));var qs=require(_0x10d9('0xe'));var as=require(_0x10d9('0xf'));var hardwareService=require(_0x10d9('0x10'));var logger=require(_0x10d9('0x11'))(_0x10d9('0x12'));var utils=require('../../config/utils');var config=require(_0x10d9('0x13'));var licenseUtil=require(_0x10d9('0x14'));var db=require('../../mysqldb')['db'];config[_0x10d9('0x15')]=_[_0x10d9('0x16')](config[_0x10d9('0x15')],{'host':_0x10d9('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10d9('0x15')]));require(_0x10d9('0x18'))[_0x10d9('0x19')](socket);function respondWithStatusCode(_0x58d721,_0x370be0){_0x370be0=_0x370be0||0xcc;return function(_0x498730){if(_0x498730){return _0x58d721[_0x10d9('0x1a')](_0x370be0);}return _0x58d721[_0x10d9('0x1b')](_0x370be0)[_0x10d9('0x1c')]();};}function respondWithResult(_0x41111d,_0x14cfaf){_0x14cfaf=_0x14cfaf||0xc8;return function(_0x4a34fb){if(_0x4a34fb){return _0x41111d['status'](_0x14cfaf)[_0x10d9('0x1d')](_0x4a34fb);}};}function respondWithFilteredResult(_0x5bdd15,_0x10c712){return function(_0x252a00){if(_0x252a00){var _0x53883c=typeof _0x10c712[_0x10d9('0x1e')]===_0x10d9('0x1f')&&typeof _0x10c712[_0x10d9('0x20')]===_0x10d9('0x1f');var _0x19b103=_0x252a00[_0x10d9('0x21')];var _0x45b3ee=_0x53883c?0x0:_0x10c712['offset'];var _0x32292a=_0x53883c?_0x252a00[_0x10d9('0x21')]:_0x10c712[_0x10d9('0x1e')]+_0x10c712[_0x10d9('0x20')];var _0x36f461;if(_0x32292a>=_0x19b103){_0x32292a=_0x19b103;_0x36f461=0xc8;}else{_0x36f461=0xce;}_0x5bdd15['status'](_0x36f461);return _0x5bdd15[_0x10d9('0x22')](_0x10d9('0x23'),_0x45b3ee+'-'+_0x32292a+'/'+_0x19b103)[_0x10d9('0x1d')](_0x252a00);}return null;};}function patchUpdates(_0xc77b21){return function(_0x2ecf48){try{jsonpatch[_0x10d9('0x24')](_0x2ecf48,_0xc77b21,!![]);}catch(_0x422185){return BPromise[_0x10d9('0x25')](_0x422185);}return _0x2ecf48['save']();};}function saveUpdates(_0x3ef28d,_0x38be1f){return function(_0x1ee976){if(_0x1ee976){return _0x1ee976[_0x10d9('0x26')](_0x3ef28d)[_0x10d9('0x27')](function(_0x190d52){return _0x190d52;});}return null;};}function removeEntity(_0x244b37,_0x58f28a){return function(_0xe54224){if(_0xe54224){return _0xe54224[_0x10d9('0x28')]()[_0x10d9('0x27')](function(){_0x244b37[_0x10d9('0x1b')](0xcc)[_0x10d9('0x1c')]();});}};}function handleEntityNotFound(_0x19545f,_0x354560){return function(_0x41bb29){if(!_0x41bb29){_0x19545f[_0x10d9('0x1a')](0x194);}return _0x41bb29;};}function handleError(_0x363d5b,_0x117279){_0x117279=_0x117279||0x1f4;return function(_0x4a8ab7){logger[_0x10d9('0x29')](_0x4a8ab7[_0x10d9('0x2a')]);if(_0x4a8ab7[_0x10d9('0x2b')]){delete _0x4a8ab7[_0x10d9('0x2b')];}_0x363d5b['status'](_0x117279)['send'](_0x4a8ab7);};}exports[_0x10d9('0x2c')]=function(_0x1bf48b,_0x1f5713){var _0x9127b2={},_0x3f4c9c={},_0x5d7f74={'count':0x0,'rows':[]};var _0x2d2108=_[_0x10d9('0x2d')](db[_0x10d9('0x2e')][_0x10d9('0x2f')],function(_0x36b744){return{'name':_0x36b744['fieldName'],'type':_0x36b744['type']['key']};});_0x3f4c9c[_0x10d9('0x30')]=_[_0x10d9('0x2d')](_0x2d2108,_0x10d9('0x2b'));_0x3f4c9c[_0x10d9('0x31')]=_[_0x10d9('0x32')](_0x1bf48b[_0x10d9('0x31')]);_0x3f4c9c['filters']=_[_0x10d9('0x33')](_0x3f4c9c[_0x10d9('0x30')],_0x3f4c9c[_0x10d9('0x31')]);_0x9127b2[_0x10d9('0x34')]=_[_0x10d9('0x33')](_0x3f4c9c[_0x10d9('0x30')],qs[_0x10d9('0x35')](_0x1bf48b[_0x10d9('0x31')][_0x10d9('0x35')]));_0x9127b2[_0x10d9('0x34')]=_0x9127b2['attributes'][_0x10d9('0x36')]?_0x9127b2['attributes']:_0x3f4c9c[_0x10d9('0x30')];if(!_0x1bf48b['query'][_0x10d9('0x37')](_0x10d9('0x38'))){_0x9127b2['limit']=qs[_0x10d9('0x20')](_0x1bf48b['query'][_0x10d9('0x20')]);_0x9127b2[_0x10d9('0x1e')]=qs[_0x10d9('0x1e')](_0x1bf48b[_0x10d9('0x31')][_0x10d9('0x1e')]);}_0x9127b2[_0x10d9('0x39')]=qs[_0x10d9('0x3a')](_0x1bf48b['query'][_0x10d9('0x3a')]);_0x9127b2['where']=qs[_0x10d9('0x3b')](_['pick'](_0x1bf48b[_0x10d9('0x31')],_0x3f4c9c[_0x10d9('0x3b')]),_0x2d2108);if(_0x1bf48b['query'][_0x10d9('0x3c')]){_0x9127b2[_0x10d9('0x3d')]=_['merge'](_0x9127b2[_0x10d9('0x3d')],{'$or':_['map'](_0x2d2108,function(_0x597f32){if(_0x597f32[_0x10d9('0x3e')]!=='VIRTUAL'){var _0x821bed={};_0x821bed[_0x597f32[_0x10d9('0x2b')]]={'$like':'%'+_0x1bf48b['query'][_0x10d9('0x3c')]+'%'};return _0x821bed;}})});}_0x9127b2=_[_0x10d9('0x3f')]({},_0x9127b2,_0x1bf48b[_0x10d9('0x40')]);var _0x2b3853={'where':_0x9127b2[_0x10d9('0x3d')]};return db[_0x10d9('0x2e')][_0x10d9('0x21')](_0x2b3853)[_0x10d9('0x27')](function(_0x3f1185){_0x5d7f74[_0x10d9('0x21')]=_0x3f1185;if(_0x1bf48b[_0x10d9('0x31')]['includeAll']){_0x9127b2[_0x10d9('0x41')]=[{'all':!![]}];}return db[_0x10d9('0x2e')][_0x10d9('0x42')](_0x9127b2);})[_0x10d9('0x27')](function(_0x56a8bf){_0x5d7f74[_0x10d9('0x43')]=_0x56a8bf;return _0x5d7f74;})['then'](respondWithFilteredResult(_0x1f5713,_0x9127b2))[_0x10d9('0x44')](handleError(_0x1f5713,null));};exports['show']=function(_0x5905f0,_0xafdfcc){var _0x3caa93={'raw':![],'where':{'id':_0x5905f0[_0x10d9('0x45')]['id']}},_0x1c2f41={};_0x1c2f41[_0x10d9('0x30')]=_[_0x10d9('0x32')](db['UserProfile']['rawAttributes']);_0x1c2f41[_0x10d9('0x31')]=_[_0x10d9('0x32')](_0x5905f0['query']);_0x1c2f41[_0x10d9('0x3b')]=_['intersection'](_0x1c2f41[_0x10d9('0x30')],_0x1c2f41[_0x10d9('0x31')]);_0x3caa93[_0x10d9('0x34')]=_[_0x10d9('0x33')](_0x1c2f41[_0x10d9('0x30')],qs['fields'](_0x5905f0[_0x10d9('0x31')][_0x10d9('0x35')]));_0x3caa93['attributes']=_0x3caa93['attributes'][_0x10d9('0x36')]?_0x3caa93['attributes']:_0x1c2f41[_0x10d9('0x30')];if(_0x5905f0[_0x10d9('0x31')][_0x10d9('0x46')]){_0x3caa93['include']=[{'all':!![]}];}_0x3caa93=_[_0x10d9('0x3f')]({},_0x3caa93,_0x5905f0[_0x10d9('0x40')]);return db[_0x10d9('0x2e')]['find'](_0x3caa93)['then'](handleEntityNotFound(_0xafdfcc,null))[_0x10d9('0x27')](respondWithResult(_0xafdfcc,null))[_0x10d9('0x44')](handleError(_0xafdfcc,null));};exports['create']=function(_0x4f9c0e,_0x30a7a1){return db[_0x10d9('0x2e')][_0x10d9('0x47')](_0x4f9c0e[_0x10d9('0x48')],{})['then'](respondWithResult(_0x30a7a1,0xc9))[_0x10d9('0x44')](handleError(_0x30a7a1,null));};exports['clone']=function(_0x709ded,_0x42b8cc){var _0xbd8bf7={'where':{'id':_0x709ded[_0x10d9('0x45')]['id']}},_0x299749={};_0x299749[_0x10d9('0x30')]=_['keys'](db[_0x10d9('0x2e')][_0x10d9('0x2f')]);_0xbd8bf7[_0x10d9('0x34')]=_[_0x10d9('0x33')](_0x299749[_0x10d9('0x30')],qs['fields'](_0x709ded['query'][_0x10d9('0x35')]));_0xbd8bf7[_0x10d9('0x34')]=_0xbd8bf7['attributes'][_0x10d9('0x36')]?_0xbd8bf7[_0x10d9('0x34')]:_0x299749[_0x10d9('0x30')];if(_0x709ded['query']['includeAll']){_0xbd8bf7[_0x10d9('0x41')]=[{'all':!![]}];}_0xbd8bf7=_[_0x10d9('0x3f')]({},_0xbd8bf7,_0x709ded[_0x10d9('0x40')]);return db['UserProfile'][_0x10d9('0x49')](_0xbd8bf7)[_0x10d9('0x27')](handleEntityNotFound(_0x42b8cc,null))[_0x10d9('0x27')](function(_0x4e5ebb){if(_0x4e5ebb){var _0x5b1175=_0x4e5ebb[_0x10d9('0x4a')]({'plain':!![]});_0x5b1175=qs[_0x10d9('0x4b')](_0x5b1175,['id',_0x10d9('0x4c'),_0x10d9('0x4d'),_0x10d9('0x4e')]);_0x709ded['body']=_[_0x10d9('0x4b')](_0x709ded[_0x10d9('0x48')],['id',_0x10d9('0x4c'),'updatedAt']);return db[_0x10d9('0x4f')]['transaction'](function(_0xc85451){return db[_0x10d9('0x2e')]['create'](_['merge'](_0x5b1175,_0x709ded['body']),{'include':_0x709ded[_0x10d9('0x31')][_0x10d9('0x46')]?[{'all':!![]}]:undefined,'transaction':_0xc85451})[_0x10d9('0x27')](function(_0x2b3a5f){var _0x568a30=_0x2b3a5f[_0x10d9('0x4a')]({'plain':!![]});return db[_0x10d9('0x50')][_0x10d9('0x42')]({'where':{'userProfileId':_0x709ded[_0x10d9('0x45')]['id']},'raw':!![]})['then'](function(_0x436f11){if(_0x436f11){return BPromise[_0x10d9('0x51')](_0x436f11,function(_0xf210be){return new BPromise(function(_0x4c0c16,_0x22ba18){if(_0xf210be['autoAssociation']===null||_0xf210be[_0x10d9('0x52')]===0x1)_0x4c0c16(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0xf210be['id']},'raw':!![]})[_0x10d9('0x27')](function(_0x451cb4){var _0x4bb506=_['map'](_0x451cb4,function(_0x489b3a){return qs[_0x10d9('0x4b')](_0x489b3a,['id','createdAt','updatedAt',_0x10d9('0x53')]);});_0x4c0c16(_0x4bb506);})[_0x10d9('0x44')](function(_0x8eaaf3){_0x22ba18(_0x8eaaf3);});})[_0x10d9('0x27')](function(_0x4f99f1){var _0x1371b1=qs['omit'](_0xf210be,['id',_0x10d9('0x4c'),_0x10d9('0x4d')]);_0x1371b1[_0x10d9('0x54')]=_0x568a30['id'];if(_0x4f99f1)_0x1371b1[_0x10d9('0x55')]=_0x4f99f1;return _0x1371b1;})['then'](function(_0x5e9934){return db[_0x10d9('0x50')]['create'](_0x5e9934,{'include':[{'model':db['UserProfileResource'],'as':_0x10d9('0x55')}],'raw':!![],'transaction':_0xc85451});});})['then'](function(){return _0x568a30;});}});});});}})['then'](respondWithResult(_0x42b8cc,0xc9))[_0x10d9('0x44')](handleError(_0x42b8cc,null));};exports[_0x10d9('0x26')]=function(_0x4ce25c,_0x48ebcc){if(_0x4ce25c[_0x10d9('0x48')]['id']){delete _0x4ce25c[_0x10d9('0x48')]['id'];}return db[_0x10d9('0x2e')][_0x10d9('0x49')]({'where':{'id':_0x4ce25c['params']['id']}})[_0x10d9('0x27')](handleEntityNotFound(_0x48ebcc,null))[_0x10d9('0x27')](saveUpdates(_0x4ce25c[_0x10d9('0x48')],null))['then'](respondWithResult(_0x48ebcc,null))[_0x10d9('0x44')](handleError(_0x48ebcc,null));};exports[_0x10d9('0x28')]=function(_0x92ac14,_0x51dcf7){return db[_0x10d9('0x2e')][_0x10d9('0x49')]({'where':{'id':_0x92ac14[_0x10d9('0x45')]['id']}})[_0x10d9('0x27')](handleEntityNotFound(_0x51dcf7,null))[_0x10d9('0x27')](removeEntity(_0x51dcf7,null))[_0x10d9('0x44')](handleError(_0x51dcf7,null));};exports[_0x10d9('0x56')]=function(_0x2d6c07,_0x7a26fc){return db[_0x10d9('0x2e')][_0x10d9('0x56')]()['then'](respondWithResult(_0x7a26fc,null))[_0x10d9('0x44')](handleError(_0x7a26fc,null));};exports[_0x10d9('0x57')]=function(_0x33ed27,_0x1a7bc1){var _0xdf2824=_0x33ed27[_0x10d9('0x48')];return db[_0x10d9('0x2e')][_0x10d9('0x49')]({'where':{'id':_0x33ed27[_0x10d9('0x45')]['id']}})[_0x10d9('0x27')](handleEntityNotFound(_0x1a7bc1,null))[_0x10d9('0x27')](function(_0x458680){if(_0x458680){return db[_0x10d9('0x4f')][_0x10d9('0x58')](function(_0x121251){return db[_0x10d9('0x50')][_0x10d9('0x28')]({'where':{'userProfileId':_0x33ed27['params']['id'],'sectionId':_['map'](_0xdf2824,function(_0xcd8717){return _0xcd8717['sectionId'];})},'transaction':_0x121251})[_0x10d9('0x27')](function(){var _0x48fe21=_[_0x10d9('0x2d')](_0xdf2824,function(_0x2d8a64){_0x2d8a64['userProfileId']=_0x33ed27[_0x10d9('0x45')]['id'];return _0x2d8a64;});var _0x4f2cfe=[];return BPromise[_0x10d9('0x51')](_0x48fe21,function(_0x418983){return db[_0x10d9('0x50')][_0x10d9('0x47')](_0x418983,{'include':[{'model':db[_0x10d9('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x121251})['then'](function(_0x52bfa3){_0x4f2cfe['push'](_0x52bfa3[_0x10d9('0x4a')]({'plain':!![]}));});})[_0x10d9('0x27')](function(){return _0x4f2cfe;});});});}})[_0x10d9('0x27')](function(_0xff0473){return _0xff0473;})['then'](respondWithResult(_0x1a7bc1,null))[_0x10d9('0x44')](handleError(_0x1a7bc1,null));};exports[_0x10d9('0x5a')]=function(_0x58509e,_0x4dde0d){var _0x386211;return db[_0x10d9('0x2e')][_0x10d9('0x49')]({'where':{'id':_0x58509e[_0x10d9('0x45')]['id']},'attributes':['id','name']})[_0x10d9('0x27')](handleEntityNotFound(_0x4dde0d,null))[_0x10d9('0x27')](function(_0xcc8787){if(_0xcc8787){_0x386211=_0xcc8787;return db[_0x10d9('0x50')]['destroy']({'where':{'userProfileId':_0x58509e[_0x10d9('0x45')]['id'],'sectionId':_0x58509e['query'][_0x10d9('0x5b')]}});}})[_0x10d9('0x27')](function(){return _0x386211;})['then'](respondWithStatusCode(_0x4dde0d,null))['catch'](handleError(_0x4dde0d,null));};exports[_0x10d9('0x5c')]=function(_0x2bf074,_0x20ec51){var _0x55084e=[];var _0x24265e=[];return db[_0x10d9('0x50')][_0x10d9('0x42')]({'where':{'userProfileId':_0x2bf074[_0x10d9('0x45')]['id']},'raw':!![]})['then'](function(_0x33944f){_0x55084e=_[_0x10d9('0x3c')](_0x33944f,function(_0x21d55a){return _0x21d55a['enabled']===0x1||_[_0x10d9('0x5d')]([0x3eb,0x709],_0x21d55a[_0x10d9('0x53')]);});if(!_[_0x10d9('0x5e')](_0x55084e)){return _[_0x10d9('0x2d')](_0x55084e,function(_0x52f545){return _0x52f545[_0x10d9('0x53')];});}else{return;}})['then'](function(_0x275708){if(_0x275708)_0x24265e=_0x275708;if(_['includes'](_0x24265e,0x64)){var _0x3bd1b4=_[_0x10d9('0x49')](_0x55084e,{'sectionId':0x64});return hasDefaultDashboard(_0x3bd1b4)['then'](function(_0x58af8d){return _['map'](_0x55084e,function(_0x5f3b8c){if(_0x5f3b8c[_0x10d9('0x53')]===0x64){_0x5f3b8c['subsections']=_0x58af8d;}return _0x5f3b8c;});});}else{return;}})[_0x10d9('0x27')](function(_0x24d02f){if(_0x24d02f)_0x55084e=_0x24d02f;if(_[_0x10d9('0x5d')](_0x24265e,0x3eb)){var _0x16bb1a=_[_0x10d9('0x49')](_0x55084e,{'sectionId':0x3eb});return getCustomDashboards(_0x16bb1a)[_0x10d9('0x27')](function(_0x831a7d){return _['map'](_0x55084e,function(_0x3d4732){if(_0x16bb1a['enabled']){if(_0x3d4732[_0x10d9('0x53')]===0x3eb){_0x3d4732[_0x10d9('0x5f')]=_0x831a7d;}}else{if(_0x3d4732[_0x10d9('0x53')]===0x64){if(!_0x3d4732['subsections']){_0x3d4732[_0x10d9('0x5f')]=[];}_0x3d4732[_0x10d9('0x5f')]=_0x3d4732[_0x10d9('0x5f')][_0x10d9('0x60')](_0x831a7d);}}return _0x3d4732;});});}else{return;}})[_0x10d9('0x27')](function(_0x1a03be){if(_0x1a03be)_0x55084e=_0x1a03be;if(_['includes'](_0x24265e,0x709)){var _0x5460b7=_['find'](_0x55084e,{'sectionId':0x709});return getPlugins(_0x5460b7)[_0x10d9('0x27')](function(_0x344ca4){if(_0x5460b7[_0x10d9('0x61')]){return _[_0x10d9('0x2d')](_0x55084e,function(_0xc80dfb){if(_0xc80dfb[_0x10d9('0x53')]===0x709){_0xc80dfb[_0x10d9('0x5f')]=_0x344ca4;}return _0xc80dfb;});}else{var _0x6222f4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x344ca4};var _0x1caa14=_[_0x10d9('0x2d')](_0x55084e);_0x1caa14[_0x10d9('0x62')](_0x6222f4);return _0x1caa14;}});}else{return;}})[_0x10d9('0x27')](function(_0x302113){if(_0x302113)_0x55084e=_0x302113;return _[_0x10d9('0x3c')](_0x55084e,[_0x10d9('0x61'),0x1]);})[_0x10d9('0x27')](respondWithResult(_0x20ec51,null))[_0x10d9('0x44')](handleError(_0x20ec51,null));};function hasDefaultDashboard(_0x4b4bf9){var _0x16abc1=[0x65];return new BPromise(function(_0x593c39,_0x154bdd){try{if(_0x4b4bf9[_0x10d9('0x52')]){_0x593c39(_0x16abc1);}else{return db[_0x10d9('0x59')][_0x10d9('0x63')]({'where':{'sectionId':_0x4b4bf9['id']},'raw':!![]})[_0x10d9('0x27')](function(_0x3e4972){_0x3e4972?_0x593c39(_0x16abc1):_0x593c39();});}}catch(_0x5ba0f1){_0x154bdd(_0x5ba0f1);}});}function getCustomDashboards(_0x1af6d9){var _0x11ded6=[];return new BPromise(function(_0x31eefe,_0x1353c6){try{if(_0x1af6d9[_0x10d9('0x52')]){return db['Dashboard'][_0x10d9('0x42')]({'raw':!![]})['then'](function(_0x173d76){_0x173d76['forEach'](function(_0xce8ccc){_0x11ded6[_0x10d9('0x62')](_0xce8ccc['id']+0x1869f);});_0x31eefe(_0x11ded6);});}else{return db['UserProfileResource'][_0x10d9('0x42')]({'where':{'sectionId':_0x1af6d9['id']},'raw':!![]})['then'](function(_0x57dedb){_0x57dedb[_0x10d9('0x64')](function(_0x349c2a){_0x11ded6['push'](_0x349c2a[_0x10d9('0x65')]+0x1869f);});_0x31eefe(_0x11ded6);});}}catch(_0x40df05){_0x1353c6(_0x40df05);}});}function getPlugins(_0x357810){var _0x34c677=[];return new BPromise(function(_0x4e2bed,_0x600dc1){try{if(_0x357810['autoAssociation']){return db[_0x10d9('0x66')][_0x10d9('0x42')]({'raw':!![]})[_0x10d9('0x27')](function(_0x3dc7cb){_0x3dc7cb[_0x10d9('0x64')](function(_0x367214){_0x34c677[_0x10d9('0x62')](_0x367214['id']+0x15b38);});_0x4e2bed(_0x34c677);});}else{return db[_0x10d9('0x59')][_0x10d9('0x42')]({'where':{'sectionId':_0x357810['id']},'raw':!![]})[_0x10d9('0x27')](function(_0x38e31a){_0x38e31a[_0x10d9('0x64')](function(_0x12c3b4){_0x34c677[_0x10d9('0x62')](_0x12c3b4[_0x10d9('0x65')]+0x15b38);});_0x4e2bed(_0x34c677);});}}catch(_0x4d8461){_0x600dc1(_0x4d8461);}});}exports[_0x10d9('0x67')]=function(_0x32d8ef,_0x1173b4){return db[_0x10d9('0x2e')][_0x10d9('0x49')]({'where':{'id':_0x32d8ef[_0x10d9('0x45')]['id']}})['then'](handleEntityNotFound(_0x1173b4,null))[_0x10d9('0x27')](function(_0x614882){if(_0x614882){return db[_0x10d9('0x4f')]['transaction'](function(_0x2f877f){return db[_0x10d9('0x50')][_0x10d9('0x42')]({'where':{'userProfileId':_0x32d8ef[_0x10d9('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0x10d9('0x27')](function(_0x1b2f57){if(_0x1b2f57){return db[_0x10d9('0x50')][_0x10d9('0x28')]({'where':{'userProfileId':_0x32d8ef[_0x10d9('0x45')]['id'],'id':_[_0x10d9('0x2d')](_0x1b2f57,function(_0x3825cd){return _0x3825cd['id'];})},'transaction':_0x2f877f});}})['then'](function(_0x567216){var _0x428a67=_['map'](_0x32d8ef[_0x10d9('0x48')],function(_0x1e7ad7){_0x1e7ad7[_0x10d9('0x54')]=_0x32d8ef[_0x10d9('0x45')]['id'];return _0x1e7ad7;});return db[_0x10d9('0x50')][_0x10d9('0x68')](_0x428a67,{'raw':!![],'transaction':_0x2f877f});})[_0x10d9('0x27')](function(_0x3f27b5){var _0x2bf895=_[_0x10d9('0x3c')](_[_0x10d9('0x2d')](_0x3f27b5,function(_0x54821a){return _0x54821a[_0x10d9('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x2bf895){return db[_0x10d9('0x50')][_0x10d9('0x42')]({'where':{'userProfileId':_0x32d8ef['params']['id'],'sectionId':_[_0x10d9('0x2d')](_0x2bf895,function(_0x594eb5){return _0x594eb5[_0x10d9('0x53')];})},'attributes':['id',_0x10d9('0x53')],'raw':!![]})[_0x10d9('0x27')](function(_0x56204c){var _0x207b87=_[_0x10d9('0x2d')](_0x32d8ef[_0x10d9('0x48')],function(_0x56b3bc){_0x56b3bc[_0x10d9('0x54')]=_0x32d8ef[_0x10d9('0x45')]['id'];return _0x56b3bc;});return db['UserProfileResource']['bulkCreate'](_0x207b87,{'raw':!![],'transaction':_0x2f877f});});}})[_0x10d9('0x44')](handleError(_0x1173b4,null));});}})[_0x10d9('0x27')](function(_0x11c002){var _0x4a0fcd=_[_0x10d9('0x2d')](_0x11c002,function(_0x4c2b7f){return _0x4c2b7f['get']({'plain':!![]});});})[_0x10d9('0x27')](respondWithResult(_0x1173b4,null))[_0x10d9('0x44')](handleError(_0x1173b4,null));};exports[_0x10d9('0x69')]=function(_0x471387,_0x3e633c,_0x54bb16){return db[_0x10d9('0x2e')]['find']({'where':{'id':_0x471387[_0x10d9('0x45')]['id']}})[_0x10d9('0x27')](handleEntityNotFound(_0x3e633c,null))[_0x10d9('0x27')](function(_0x177a6f){if(_0x177a6f){return _0x177a6f[_0x10d9('0x69')](_0x471387['query'][_0x10d9('0x5b')]);}})[_0x10d9('0x27')](respondWithStatusCode(_0x3e633c,null))['catch'](handleError(_0x3e633c,null));};exports[_0x10d9('0x6a')]=function(_0x3a1aa7,_0x1295cc){var _0x245543={};if(!_0x3a1aa7[_0x10d9('0x31')][_0x10d9('0x6b')])throw new Error(_0x10d9('0x6c'));if(!_0x3a1aa7[_0x10d9('0x31')][_0x10d9('0x37')](_0x10d9('0x38'))){_0x245543[_0x10d9('0x20')]=qs[_0x10d9('0x20')](_0x3a1aa7[_0x10d9('0x31')][_0x10d9('0x20')]);_0x245543[_0x10d9('0x1e')]=qs['offset'](_0x3a1aa7[_0x10d9('0x31')][_0x10d9('0x1e')]);}return db[_0x10d9('0x2e')]['find']({'where':{'id':_0x3a1aa7[_0x10d9('0x45')]['id']}})[_0x10d9('0x27')](function(_0x35251e){if(!_0x35251e)throw new Error(_0x10d9('0x6d')+_0x3a1aa7[_0x10d9('0x45')]['id']);return db[_0x10d9('0x2e')][_0x10d9('0x6a')](_0x3a1aa7);})[_0x10d9('0x27')](respondWithFilteredResult(_0x1295cc,_0x245543))[_0x10d9('0x44')](handleError(_0x1295cc,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8112ce6..66ffa2b 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ace=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0x12a2e9,_0xbd6f2a){var _0x4bcf43=function(_0x221ed5){while(--_0x221ed5){_0x12a2e9['push'](_0x12a2e9['shift']());}};_0x4bcf43(++_0xbd6f2a);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x2c10fb,_0x380e1b){_0x2c10fb=_0x2c10fb-0x0;var _0x23e4c0=_0x8ace[_0x2c10fb];return _0x23e4c0;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var UserProfile=require(_0xe8ac('0x1'))['db'][_0xe8ac('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe8ac('0x3')](0x0);var events={'afterCreate':_0xe8ac('0x4'),'afterUpdate':_0xe8ac('0x5'),'afterDestroy':_0xe8ac('0x6')};function emitEvent(_0x274d7d){return function(_0x114351,_0xf6af00,_0x199794){UserProfileEvents[_0xe8ac('0x7')](_0x274d7d+':'+_0x114351['id'],_0x114351);UserProfileEvents[_0xe8ac('0x7')](_0x274d7d,_0x114351);_0x199794(null);};}for(var e in events){if(events[_0xe8ac('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xe8ac('0x9')]=UserProfileEvents; \ No newline at end of file +var _0xd117=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2947cc,_0x1b8829){var _0x3976be=function(_0x57ed9a){while(--_0x57ed9a){_0x2947cc['push'](_0x2947cc['shift']());}};_0x3976be(++_0x1b8829);}(_0xd117,0x182));var _0x7d11=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xd117[_0x5627e1];return _0x2f013f;};'use strict';var EventEmitter=require(_0x7d11('0x0'));var UserProfile=require(_0x7d11('0x1'))['db'][_0x7d11('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7d11('0x3')](0x0);var events={'afterCreate':_0x7d11('0x4'),'afterUpdate':_0x7d11('0x5'),'afterDestroy':_0x7d11('0x6')};function emitEvent(_0x254bb4){return function(_0x3c07be,_0x31fcb0,_0x589c51){UserProfileEvents[_0x7d11('0x7')](_0x254bb4+':'+_0x3c07be['id'],_0x3c07be);UserProfileEvents[_0x7d11('0x7')](_0x254bb4,_0x3c07be);_0x589c51(null);};}for(var e in events){if(events[_0x7d11('0x8')](e)){var event=events[e];UserProfile[_0x7d11('0x9')](e,emitEvent(event));}}module[_0x7d11('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2627d89..1af9d5b 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe38e=['voicerecordings','VoiceRecording','User','role','agent','membername','telephone','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','queuecampaigns','VoiceQueues','telephones','Users','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','foreignKey','forEach','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','ThroughTags','tag','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','squel','models','filter','value','then','associatedResources','catch','model','findAll','UserProfileResource','field','map','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail'];(function(_0x4e6141,_0x2f1516){var _0x398b49=function(_0x356727){while(--_0x356727){_0x4e6141['push'](_0x4e6141['shift']());}};_0x398b49(++_0x2f1516);}(_0xe38e,0x92));var _0xee38=function(_0x3e0f58,_0x31e035){_0x3e0f58=_0x3e0f58-0x0;var _0x180360=_0xe38e[_0x3e0f58];return _0x180360;};'use strict';var _=require('lodash');var attributes=require(_0xee38('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0xee38('0x1'));module['exports']=function(_0x467a84){var _0xd3cc1b=_0x467a84[_0xee38('0x2')];function _0x2c7b4a(_0x2deb48,_0x432dac){return new Promise(function(_0x2e46f6,_0x37695c){if(!_0x432dac)return _0x2e46f6(null);var _0x616b93=_0x432dac['filter']?{[_0x432dac[_0xee38('0x3')]['field']]:_0x432dac[_0xee38('0x3')][_0xee38('0x4')]}:undefined;return _0xd3cc1b[_0x2deb48]['findAll']({'where':_0x616b93,'raw':!![]})[_0xee38('0x5')](function(_0x41ac2d){_0x432dac[_0xee38('0x6')]=_['map'](_0x41ac2d,'id');_0x2e46f6(_0x432dac);})[_0xee38('0x7')](function(_0x4c34c5){_0x37695c(_0x4c34c5);});});}function _0x1b3ac6(_0x463ca2,_0xf22c08){return new Promise(function(_0x489d7f,_0x324067){var _0x473047=_0x463ca2[_0xee38('0x3')]?{[_0x463ca2[_0xee38('0x3')]['field']]:_0x463ca2[_0xee38('0x3')]['value']}:undefined;return _0xd3cc1b[_0x463ca2[_0xee38('0x8')]][_0xee38('0x9')]({'where':_0x473047,'raw':!![]})[_0xee38('0x5')](function(_0x34e843){_0xf22c08['associatedResources']=_['map'](_0x34e843,function(_0x43bfa6){return _0x43bfa6['name'];});_0x489d7f(_0xf22c08);})[_0xee38('0x7')](function(_0x319cca){_0x324067(_0x319cca);});});}function _0x20ec1c(_0x32486a,_0x11f74c,_0x1d2118){if(!_0x11f74c)return Promise['resolve'](null);return new Promise(function(_0x3cc6d0,_0x56a3a7){return _0xd3cc1b[_0xee38('0xa')]['findAll']({'where':{'sectionId':_0x11f74c['id']},'raw':!![]})[_0xee38('0x5')](function(_0x4c75bd){if(_0x32486a[_0xee38('0xb')]&&_0x32486a[_0xee38('0xb')]!=='id'){_0x11f74c[_0xee38('0x6')]=_[_0xee38('0xc')](_0x4c75bd,function(_0x5279bf){return _0x5279bf[_0x32486a[_0xee38('0xb')]];});}else{if(_0x1d2118===_0xee38('0xd')){_0x11f74c['associatedResources']=_[_0xee38('0xc')](_0x4c75bd,function(_0x58a7b6){return{'id':_0x58a7b6[_0xee38('0xe')],'type':_0x58a7b6[_0xee38('0xf')]};});}else{_0x11f74c[_0xee38('0x6')]=_['map'](_0x4c75bd,function(_0x9841d4){return _0x9841d4[_0xee38('0xe')];});}}_0x3cc6d0(_0x11f74c);})['catch'](function(_0x4c2e9e){_0x56a3a7(_0x4c2e9e);});});}function _0x243f57(_0x19ab04,_0x2a8437){var _0x550e04={'parentSections':[]};switch(_0x19ab04[_0xee38('0x10')]()){case _0xee38('0x11'):_0x550e04[_0xee38('0x12')]=_0xee38('0x13');break;case'odbc':_0x550e04[_0xee38('0x12')]=_0xee38('0x14');break;case _0xee38('0x15'):_0x550e04[_0xee38('0x12')]=_0xee38('0x16');_0x550e04[_0xee38('0x17')]=[{'name':_0xee38('0x18'),'field':_0xee38('0x19'),'foreignKey':_0xee38('0x1a')}];break;case _0xee38('0x1b'):_0x550e04[_0xee38('0x12')]=_0xee38('0x1c');break;case _0xee38('0x1d'):_0x550e04[_0xee38('0x12')]='CmContact';_0x550e04['parentSections']=[{'name':_0xee38('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0xee38('0x1f'):_0x550e04[_0xee38('0x12')]=_0xee38('0x20');break;case'companies':_0x550e04['childModel']=_0xee38('0x21');break;case'globalcustomfields':_0x550e04['childModel']=_0xee38('0x22');break;case _0xee38('0x23'):_0x550e04[_0xee38('0x12')]=_0xee38('0x24');break;case _0xee38('0x25'):_0x550e04[_0xee38('0x12')]='ChatWebsite';break;case'faxqueues':_0x550e04[_0xee38('0x12')]=_0xee38('0x26');break;case _0xee38('0x27'):_0x550e04[_0xee38('0x12')]='FaxAccount';break;case _0xee38('0x28'):case'internalroutes':case'outboundroutes':_0x550e04['childModel']=_0xee38('0x29');break;case _0xee38('0x2a'):_0x550e04[_0xee38('0x12')]=_0xee38('0x2b');break;case _0xee38('0x2c'):_0x550e04[_0xee38('0x12')]=_0xee38('0x2d');break;case _0xee38('0x2e'):_0x550e04[_0xee38('0x12')]=_0xee38('0x2f');_0x550e04[_0xee38('0x17')]=[{'name':'Agents','field':_0xee38('0x19'),'foreignKey':'membername','model':_0xee38('0x30'),'filter':{'field':_0xee38('0x31'),'value':[_0xee38('0x32')]}},{'name':'Telephones','field':_0xee38('0x19'),'foreignKey':_0xee38('0x33'),'model':'User','filter':{'field':_0xee38('0x31'),'value':[_0xee38('0x34')]}},{'name':'VoiceQueues','field':'name','foreignKey':'queue','model':_0xee38('0x35'),'filter':{'field':'type','value':['inbound']}},{'name':_0xee38('0x36'),'field':'name','foreignKey':_0xee38('0x37'),'model':_0xee38('0x35'),'filter':{'field':_0xee38('0xf'),'value':[_0xee38('0x38')]}}];break;case _0xee38('0x39'):_0x550e04[_0xee38('0x12')]='VoiceMusicOnHold';break;case _0xee38('0x3a'):_0x550e04[_0xee38('0x12')]=_0xee38('0x3b');break;case _0xee38('0x3c'):_0x550e04['childModel']='VoicePrefix';break;case _0xee38('0x3d'):_0x550e04[_0xee38('0x12')]=_0xee38('0x3e');break;case _0xee38('0x3f'):_0x550e04[_0xee38('0x12')]=_0xee38('0x40');break;case _0xee38('0x41'):_0x550e04[_0xee38('0x12')]=_0xee38('0x42');break;case _0xee38('0x43'):_0x550e04[_0xee38('0x12')]=_0xee38('0x44');break;case _0xee38('0x45'):_0x550e04[_0xee38('0x12')]=_0xee38('0x46');break;case _0xee38('0x47'):_0x550e04['childModel']=_0xee38('0x48');break;case _0xee38('0x49'):_0x550e04[_0xee38('0x12')]='SmsQueue';break;case _0xee38('0x4a'):_0x550e04[_0xee38('0x12')]=_0xee38('0x4b');break;case _0xee38('0x4c'):_0x550e04[_0xee38('0x12')]=_0xee38('0x4d');break;case _0xee38('0x4e'):_0x550e04[_0xee38('0x12')]='WhatsappAccount';break;case _0xee38('0x4f'):_0x550e04[_0xee38('0x12')]='Team';break;case'voicequeues':case _0xee38('0x50'):_0x550e04['childModel']='VoiceQueue';if(_0x2a8437){_0x550e04[_0xee38('0x17')]=[{'name':_0xee38('0x51')},{'name':_0xee38('0x36')}];}break;case'users':case'agents':case _0xee38('0x52'):_0x550e04[_0xee38('0x12')]=_0xee38('0x30');if(_0x2a8437){_0x550e04[_0xee38('0x17')]=[{'name':_0xee38('0x53'),'filter':{'field':_0xee38('0x31'),'value':['admin',_0xee38('0x54')]},'ignore':!![]},{'name':_0xee38('0x55')},{'name':_0xee38('0x56')}];}break;case _0xee38('0x57'):_0x550e04['childModel']=_0xee38('0x58');break;case'salesforceaccounts':_0x550e04[_0xee38('0x12')]=_0xee38('0x59');break;case _0xee38('0x5a'):_0x550e04[_0xee38('0x12')]=_0xee38('0x5b');break;case _0xee38('0x5c'):_0x550e04['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x550e04[_0xee38('0x12')]=_0xee38('0x5d');break;case'zohoaccounts':_0x550e04['childModel']='ZohoAccount';break;case _0xee38('0x5e'):_0x550e04[_0xee38('0x12')]='User';break;case _0xee38('0x5f'):_0x550e04[_0xee38('0x12')]=_0xee38('0x60');break;case'dispositions':_0x550e04[_0xee38('0x12')]=_0xee38('0x61');break;case _0xee38('0x62'):_0x550e04[_0xee38('0x12')]='Dashboard';break;case _0xee38('0x63'):_0x550e04[_0xee38('0x12')]=_0xee38('0x64');break;case _0xee38('0x65'):_0x550e04[_0xee38('0x12')]=_0xee38('0x66');break;case _0xee38('0x67'):_0x550e04[_0xee38('0x12')]=_0xee38('0x68');break;case _0xee38('0x69'):_0x550e04[_0xee38('0x12')]='Sound';break;case _0xee38('0x6a'):_0x550e04[_0xee38('0x12')]=_0xee38('0x6b');break;case _0xee38('0x6c'):_0x550e04['childModel']=_0xee38('0x6d');break;case _0xee38('0x6e'):_0x550e04[_0xee38('0x12')]=_0xee38('0x6f');break;case _0xee38('0x70'):_0x550e04[_0xee38('0x12')]=_0xee38('0x71');break;case _0xee38('0x72'):_0x550e04[_0xee38('0x12')]=_0xee38('0x73');break;case _0xee38('0x74'):_0x550e04[_0xee38('0x12')]=_0xee38('0x75');break;case _0xee38('0x76'):_0x550e04[_0xee38('0x12')]=_0xee38('0xd');_0x550e04['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xee38('0x77')}];break;case'metrics':_0x550e04[_0xee38('0x12')]=_0xee38('0x78');break;}return _0x550e04;}function _0x269cb9(_0x19e5cb,_0x265c95){var _0x1cf419=_0x19e5cb['charAt'](0x0)[_0xee38('0x79')]()+_0x19e5cb['slice'](0x1);var _0x1b8100={'type':_0xd3cc1b[_0xee38('0x7a')][_0xee38('0x7b')][_0xee38('0x7c')],'raw':!![]};return new Promise(function(_0x1a6d2c,_0x565e67){var _0x4dd49f=squel[_0xee38('0x7d')]()['field'](_0xee38('0x7e')+_0x1cf419+_0xee38('0x7f'),'id')[_0xee38('0xb')](_0xee38('0x80'))['from'](_0xee38('0x81')+_0x19e5cb+'_interactions','ui')[_0xee38('0x82')](_0xee38('0x83'),_0x265c95['id']);return _0xd3cc1b[_0xee38('0x84')][_0xee38('0x85')](_0x4dd49f[_0xee38('0x86')](),_0x1b8100)[_0xee38('0x5')](function(_0x1944ee){_0x265c95[_0x1cf419+_0xee38('0x87')]=_0x1944ee;_0x1a6d2c(_0x1944ee);})[_0xee38('0x7')](function(_0x585f3b){_0x565e67(_0x585f3b);});});}return _0x467a84[_0xee38('0x88')](_0xee38('0x89'),attributes,{'tableName':_0xee38('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x547afa){var _0x202df6={'raw':_0x547afa[_0xee38('0x85')][_0xee38('0x8b')],'where':{}};var _0x165f1a={};var _0x1cb788={'count':0x0,'rows':[]};var _0x3b9ace=_0x547afa[_0xee38('0x85')][_0xee38('0x8c')];var _0x13ade8=_0x547afa[_0xee38('0x85')][_0xee38('0x8d')]||![];var _0x4f099f=_0x243f57(_0x3b9ace,_0x13ade8);if(!_0x4f099f[_0xee38('0x12')])throw new Error(_0xee38('0x8e')+_0x3b9ace+'\x27');var _0x2f95ce=[{'name':_0x3b9ace}];if(!_[_0xee38('0x8f')](_0x4f099f[_0xee38('0x17')]))_0x2f95ce=_0x4f099f['parentSections'];var _0x2777de=[];for(var _0x5afedf=0x0;_0x5afedf<_0x2f95ce[_0xee38('0x90')];_0x5afedf++){_0x2777de[_0xee38('0x91')](_0xd3cc1b[_0xee38('0x92')][_0xee38('0x93')]({'where':{'userProfileId':_0x547afa[_0xee38('0x94')]['id'],'name':_0x2f95ce[_0x5afedf][_0xee38('0x19')]},'raw':!![]}));}return Promise['all'](_0x2777de)[_0xee38('0x5')](function(_0x221f81){var _0xf622ac=_[_0xee38('0x3')](_0x221f81,function(_0x23948e){return _0x23948e?_0x23948e:undefined;});var _0x21090d=_['filter'](_0x2f95ce,[_0xee38('0x95'),!![]]);var _0x1eb66f=_[_0xee38('0x8f')](_0xf622ac)&&_[_0xee38('0x8f')](_0x21090d)?null:_[_0xee38('0x96')](_0x21090d,_0xf622ac);if(!_0x1eb66f)return null;var _0x5e249d=[];for(var _0x514fde=0x0;_0x514fde<_0x1eb66f[_0xee38('0x90')];_0x514fde++){var _0x16ee48=_[_0xee38('0x93')](_0x2f95ce,function(_0x866eba){return _0x1eb66f[_0x514fde]?_0x866eba[_0xee38('0x19')]===_0x1eb66f[_0x514fde][_0xee38('0x19')]:null;});if(_0x16ee48){if(_0x1eb66f[_0x514fde][_0xee38('0x95')]){_0x5e249d[_0xee38('0x91')](_0x2c7b4a(_0x4f099f[_0xee38('0x12')],_0x1eb66f[_0x514fde]));}else{if(!_0x1eb66f[_0x514fde]['autoAssociation']){_0x5e249d[_0xee38('0x91')](_0x20ec1c(_0x16ee48,_0x1eb66f[_0x514fde],_0x4f099f[_0xee38('0x12')]));}else{if(_0x16ee48[_0xee38('0x8')]){_0x5e249d[_0xee38('0x91')](_0x1b3ac6(_0x16ee48,_0x1eb66f[_0x514fde]));}}}}}return Promise[_0xee38('0x97')](_0x5e249d);})[_0xee38('0x5')](function(_0x3d56d8){var _0x58b011=_0x3d56d8;var _0x555455=null;if(_0x58b011){_0x555455=_0x58b011[_0xee38('0x90')]===0x1?_0x58b011[0x0]:null;}if(!_0x555455&&!_0x58b011)return _0x1cb788;var _0x50adc2=_0xd3cc1b[_0x4f099f[_0xee38('0x12')]][_0xee38('0x98')];_0x165f1a[_0xee38('0x8')]=_[_0xee38('0x99')](_0x50adc2);_0x165f1a['query']=_[_0xee38('0x99')](_0x547afa['query']);_0x165f1a[_0xee38('0x9a')]=_[_0xee38('0x9b')](_0x165f1a['model'],_0x165f1a[_0xee38('0x85')]);_0x202df6[_0xee38('0x9c')]=_[_0xee38('0x9b')](_0x165f1a[_0xee38('0x8')],qs[_0xee38('0x9d')](_0x547afa['query']['fields']));_0x202df6[_0xee38('0x9c')]=_0x202df6[_0xee38('0x9c')][_0xee38('0x90')]?_0x202df6['attributes']:_0x165f1a[_0xee38('0x8')];if(!_0x547afa['query'][_0xee38('0x9e')]('nolimit')){_0x202df6[_0xee38('0x9f')]=qs[_0xee38('0x9f')](_0x547afa[_0xee38('0x85')][_0xee38('0x9f')]);_0x202df6[_0xee38('0xa0')]=qs[_0xee38('0xa0')](_0x547afa[_0xee38('0x85')]['offset']);}_0x202df6[_0xee38('0xa1')]=qs[_0xee38('0xa2')](_0x547afa[_0xee38('0x85')][_0xee38('0xa2')]);_0x202df6[_0xee38('0x82')]=qs[_0xee38('0x9a')](_[_0xee38('0xa3')](_0x547afa[_0xee38('0x85')],_0x165f1a[_0xee38('0x9a')]));if(_0x547afa[_0xee38('0x85')][_0xee38('0x3')]){_0x202df6[_0xee38('0x82')]=_[_0xee38('0xa4')](_0x202df6[_0xee38('0x82')],{'$or':_[_0xee38('0xc')](_0x50adc2,function(_0x5c8331){if(_0x5c8331[_0xee38('0xf')]['key']!=='VIRTUAL'){var _0x1c4eb2={};_0x1c4eb2[_0x5c8331[_0xee38('0xb')]]={'$like':'%'+_0x547afa[_0xee38('0x85')][_0xee38('0x3')]+'%'};return _0x1c4eb2;}})});}var _0x4ee595=[];var _0x41fb16=null;var _0x5ce848={};if(_0x555455){_0x41fb16=_[_0xee38('0x93')](_0x2f95ce,[_0xee38('0x19'),_0x555455[_0xee38('0x19')]]);if(_0x41fb16[_0xee38('0xb')]){_0x5ce848={};if(_0x4f099f['childModel']===_0xee38('0xd')){_0x5ce848[_0x41fb16[_0xee38('0xa5')]]=_[_0xee38('0xc')](_0x555455[_0xee38('0x6')],'id');}else{_0x5ce848[_0x41fb16[_0xee38('0xa5')]]=_0x555455[_0xee38('0x6')];}_0x4ee595[_0xee38('0x91')](_0x5ce848);}else{_0x202df6[_0xee38('0x82')]['id']=_0x555455[_0xee38('0x6')];}}else{for(var _0x95a9b2=0x0;_0x95a9b2<_0x58b011[_0xee38('0x90')];_0x95a9b2++){_0x41fb16=_[_0xee38('0x93')](_0x2f95ce,[_0xee38('0x19'),_0x58b011[_0x95a9b2][_0xee38('0x19')]]);if(_0x41fb16['field']){_0x5ce848={};_0x5ce848[_0x41fb16[_0xee38('0xa5')]]=_0x58b011[_0x95a9b2][_0xee38('0x6')];_0x4ee595['push'](_0x5ce848);}else{if(!_0x202df6[_0xee38('0x82')]['id'])_0x202df6[_0xee38('0x82')]['id']=[];_0x58b011[_0x95a9b2]['associatedResources'][_0xee38('0xa6')](function(_0x227f48){_0x202df6[_0xee38('0x82')]['id'][_0xee38('0x91')](_0x227f48);});}}}if(!_['isEmpty'](_0x4ee595)){_0x202df6[_0xee38('0x82')]=_[_0xee38('0xa4')](_0x202df6['where'],{'$and':{'$or':_0x4ee595}});}_0x202df6=_[_0xee38('0xa4')]({},_0x202df6,_0x547afa['options']);if(_0x555455&&!_0x555455[_0xee38('0xa7')]&&_0x4f099f[_0xee38('0x12')]===_0xee38('0xd')){if(_0x547afa[_0xee38('0x85')][_0xee38('0xa8')]){_0x202df6[_0xee38('0xa9')]=[{'all':!![]}];}return _0xd3cc1b[_0x4f099f[_0xee38('0x12')]][_0xee38('0x9')](_0x202df6)[_0xee38('0x5')](function(_0x5eeee8){var _0x5432b3=[];_0x5eeee8[_0xee38('0xa6')](function(_0x207279){var _0x13dde9;switch(_0x207279[_0xee38('0xaa')]){case _0xee38('0xab'):_0x13dde9=_[_0xee38('0x93')](_0x555455[_0xee38('0x6')],function(_0x3c682e){return _0x3c682e['id']===_0x207279[_0xee38('0x77')]&&_0x3c682e[_0xee38('0xf')]===_0xee38('0xac');});break;case _0xee38('0xad'):_0x13dde9=_[_0xee38('0x93')](_0x555455[_0xee38('0x6')],function(_0x4b21c2){return _0x4b21c2['id']===_0x207279['reportId']&&_0x4b21c2[_0xee38('0xf')]===_0xee38('0xae');});break;}if(_0x13dde9)_0x5432b3[_0xee38('0x91')](_0x207279);});_0x1cb788[_0xee38('0xaf')]=_0x5432b3[_0xee38('0x90')];_0x1cb788[_0xee38('0xb0')]=_0x5432b3;return _0x1cb788;});}else{if(!_[_0xee38('0x8f')](_0x547afa[_0xee38('0x85')]['ids'])){_0x202df6['where']['id']=_0x202df6[_0xee38('0x82')]['id']?_[_0xee38('0x9b')](_0x202df6['where']['id'],_0x547afa[_0xee38('0x85')][_0xee38('0xb1')]):_0x547afa[_0xee38('0x85')]['ids'];if(_0x547afa[_0xee38('0x85')][_0xee38('0xb2')]){_0x202df6[_0xee38('0xa1')]=_0x547afa['query'][_0xee38('0xb2')];}}if(_0x547afa['query']['extraQueryConditions']){_0x202df6[_0xee38('0x82')]=_[_0xee38('0xa4')](_0x202df6[_0xee38('0x82')],{'$and':_0x547afa['query'][_0xee38('0xb3')]});}return _0xd3cc1b[_0x4f099f['childModel']][_0xee38('0xaf')]({'where':_0x202df6[_0xee38('0x82')]})[_0xee38('0x5')](function(_0x5e45d2){_0x1cb788[_0xee38('0xaf')]=_0x5e45d2;if(_0x547afa['query'][_0xee38('0xa8')]){if(_0x4f099f['childModel']===_0xee38('0xb4')){_0x202df6['include']=[{'model':_0xd3cc1b[_0xee38('0x6b')],'as':_0xee38('0xb5'),'attributes':['id',_0xee38('0x19'),_0xee38('0xb6')],'required':_0x547afa[_0xee38('0x85')]['tag']?!![]:![]},{'model':_0xd3cc1b[_0xee38('0x6b')],'as':_0xee38('0xb7'),'attributes':['id','name',_0xee38('0xb6')],'through':_0x547afa[_0xee38('0x85')]['tag']?{'attributes':[],'where':{'TagId':_0x547afa['query'][_0xee38('0xb8')]||undefined}}:{},'required':_0x547afa['query'][_0xee38('0xb8')]?!![]:![]}];}else{_0x202df6['include']=[{'all':!![]}];}}return _0xd3cc1b[_0x4f099f[_0xee38('0x12')]][_0xee38('0x9')](_0x202df6);})[_0xee38('0x5')](function(_0x45af7b){_0x1cb788['rows']=_0x45af7b;if(_0x3b9ace===_0xee38('0x55')&&_0x547afa[_0xee38('0x85')][_0xee38('0xb9')]==='true'){var _0x45c515=[];for(var _0x3dfd07=0x0;_0x3dfd07<_0x1cb788['rows']['length'];_0x3dfd07++){_0x45c515[_0xee38('0x91')](_0x269cb9(_0xee38('0xba'),_0x1cb788[_0xee38('0xb0')][_0x3dfd07][_0xee38('0xbb')]));_0x45c515[_0xee38('0x91')](_0x269cb9(_0xee38('0xbc'),_0x1cb788['rows'][_0x3dfd07][_0xee38('0xbb')]));_0x45c515[_0xee38('0x91')](_0x269cb9('fax',_0x1cb788[_0xee38('0xb0')][_0x3dfd07][_0xee38('0xbb')]));_0x45c515[_0xee38('0x91')](_0x269cb9(_0xee38('0xbd'),_0x1cb788[_0xee38('0xb0')][_0x3dfd07][_0xee38('0xbb')]));_0x45c515['push'](_0x269cb9(_0xee38('0xbe'),_0x1cb788['rows'][_0x3dfd07][_0xee38('0xbb')]));_0x45c515[_0xee38('0x91')](_0x269cb9(_0xee38('0xbf'),_0x1cb788[_0xee38('0xb0')][_0x3dfd07][_0xee38('0xbb')]));}return Promise[_0xee38('0x97')](_0x45c515)['then'](function(){return _0x1cb788;});}return _0x1cb788;});}});}}});}; \ No newline at end of file +var _0xd647=['where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default','DefaultReports','custom','count','ids','customSorting','order','extraQueryConditions','include','Tags','color','tag','ThroughTags','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','then','map','catch','value','model','associatedResources','name','resolve','field','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','CmContact','parentSections','Lists','ListId','lists','CmList','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','FaxQueue','faxaccounts','outboundroutes','VoiceExtension','VoiceContext','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','teams','voicequeues','queuecampaigns','users','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','Pause','scheduler','Schedule','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','charAt','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions'];(function(_0x3cafba,_0x115e88){var _0x1c7e7b=function(_0x2cdde5){while(--_0x2cdde5){_0x3cafba['push'](_0x3cafba['shift']());}};_0x1c7e7b(++_0x115e88);}(_0xd647,0x1be));var _0x7d64=function(_0x26df48,_0x22aa50){_0x26df48=_0x26df48-0x0;var _0x209047=_0xd647[_0x26df48];return _0x209047;};'use strict';var _=require(_0x7d64('0x0'));var attributes=require(_0x7d64('0x1'));var qs=require(_0x7d64('0x2'));var squel=require(_0x7d64('0x3'));module[_0x7d64('0x4')]=function(_0x135202){var _0x196df=_0x135202[_0x7d64('0x5')];function _0x56bb98(_0x34bb56,_0x405331){return new Promise(function(_0x21bc4c,_0x508da9){if(!_0x405331)return _0x21bc4c(null);var _0x48af56=_0x405331[_0x7d64('0x6')]?{[_0x405331[_0x7d64('0x6')]['field']]:_0x405331[_0x7d64('0x6')]['value']}:undefined;return _0x196df[_0x34bb56][_0x7d64('0x7')]({'where':_0x48af56,'raw':!![]})[_0x7d64('0x8')](function(_0x4fe468){_0x405331['associatedResources']=_[_0x7d64('0x9')](_0x4fe468,'id');_0x21bc4c(_0x405331);})[_0x7d64('0xa')](function(_0x5a5907){_0x508da9(_0x5a5907);});});}function _0xed248a(_0x3bfd37,_0x8b05ad){return new Promise(function(_0x3a0da0,_0x546376){var _0x5cfb3a=_0x3bfd37[_0x7d64('0x6')]?{[_0x3bfd37[_0x7d64('0x6')]['field']]:_0x3bfd37[_0x7d64('0x6')][_0x7d64('0xb')]}:undefined;return _0x196df[_0x3bfd37[_0x7d64('0xc')]]['findAll']({'where':_0x5cfb3a,'raw':!![]})[_0x7d64('0x8')](function(_0x34a756){_0x8b05ad[_0x7d64('0xd')]=_[_0x7d64('0x9')](_0x34a756,function(_0x361714){return _0x361714[_0x7d64('0xe')];});_0x3a0da0(_0x8b05ad);})[_0x7d64('0xa')](function(_0x4636b){_0x546376(_0x4636b);});});}function _0x2c4318(_0x2a438c,_0x1385ce,_0x1884b9){if(!_0x1385ce)return Promise[_0x7d64('0xf')](null);return new Promise(function(_0x3d972d,_0x14589c){return _0x196df['UserProfileResource'][_0x7d64('0x7')]({'where':{'sectionId':_0x1385ce['id']},'raw':!![]})['then'](function(_0x189991){if(_0x2a438c[_0x7d64('0x10')]&&_0x2a438c[_0x7d64('0x10')]!=='id'){_0x1385ce[_0x7d64('0xd')]=_[_0x7d64('0x9')](_0x189991,function(_0x3608c4){return _0x3608c4[_0x2a438c['field']];});}else{if(_0x1884b9==='AnalyticExtractedReport'){_0x1385ce[_0x7d64('0xd')]=_[_0x7d64('0x9')](_0x189991,function(_0x159f89){return{'id':_0x159f89[_0x7d64('0x11')],'type':_0x159f89[_0x7d64('0x12')]};});}else{_0x1385ce[_0x7d64('0xd')]=_['map'](_0x189991,function(_0x3edcf1){return _0x3edcf1['resourceId'];});}}_0x3d972d(_0x1385ce);})['catch'](function(_0x52785d){_0x14589c(_0x52785d);});});}function _0x280879(_0x554ca3,_0x45cc4e){var _0x30823c={'parentSections':[]};switch(_0x554ca3[_0x7d64('0x13')]()){case _0x7d64('0x14'):_0x30823c[_0x7d64('0x15')]='SquareProject';break;case _0x7d64('0x16'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x17');break;case _0x7d64('0x18'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x19');_0x30823c['parentSections']=[{'name':_0x7d64('0x1a'),'field':_0x7d64('0xe'),'foreignKey':'projectName'}];break;case _0x7d64('0x1b'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x1c');break;case'contacts':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x1d');_0x30823c[_0x7d64('0x1e')]=[{'name':_0x7d64('0x1f'),'field':'id','foreignKey':_0x7d64('0x20')}];break;case _0x7d64('0x21'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x22');break;case'companies':_0x30823c[_0x7d64('0x15')]='CmCompany';break;case _0x7d64('0x23'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x24');break;case'chatqueues':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x25');break;case _0x7d64('0x26'):_0x30823c[_0x7d64('0x15')]='ChatWebsite';break;case'faxqueues':_0x30823c['childModel']=_0x7d64('0x27');break;case _0x7d64('0x28'):_0x30823c[_0x7d64('0x15')]='FaxAccount';break;case'inboundroutes':case'internalroutes':case _0x7d64('0x29'):_0x30823c['childModel']=_0x7d64('0x2a');break;case'contexts':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x2b');break;case'voicemails':_0x30823c['childModel']='VoiceMail';break;case'voicerecordings':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x2c');_0x30823c['parentSections']=[{'name':'Agents','field':_0x7d64('0xe'),'foreignKey':_0x7d64('0x2d'),'model':_0x7d64('0x2e'),'filter':{'field':_0x7d64('0x2f'),'value':['agent']}},{'name':_0x7d64('0x30'),'field':_0x7d64('0xe'),'foreignKey':_0x7d64('0x2d'),'model':_0x7d64('0x2e'),'filter':{'field':_0x7d64('0x2f'),'value':[_0x7d64('0x31')]}},{'name':_0x7d64('0x32'),'field':_0x7d64('0xe'),'foreignKey':_0x7d64('0x33'),'model':_0x7d64('0x34'),'filter':{'field':_0x7d64('0x12'),'value':[_0x7d64('0x35')]}},{'name':_0x7d64('0x36'),'field':_0x7d64('0xe'),'foreignKey':_0x7d64('0x33'),'model':_0x7d64('0x34'),'filter':{'field':_0x7d64('0x12'),'value':[_0x7d64('0x37')]}}];break;case _0x7d64('0x38'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x39');break;case _0x7d64('0x3a'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x3b');break;case _0x7d64('0x3c'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x3d');break;case _0x7d64('0x3e'):_0x30823c['childModel']='Campaign';break;case _0x7d64('0x3f'):_0x30823c['childModel']=_0x7d64('0x40');break;case'mailaccounts':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x41');break;case _0x7d64('0x42'):_0x30823c[_0x7d64('0x15')]='MailSubstatus';break;case'openchannelqueues':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x43');break;case _0x7d64('0x44'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x45');break;case _0x7d64('0x46'):_0x30823c['childModel']=_0x7d64('0x47');break;case'smsaccounts':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x48');break;case _0x7d64('0x49'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x4a');break;case'whatsappaccounts':_0x30823c[_0x7d64('0x15')]='WhatsappAccount';break;case _0x7d64('0x4b'):_0x30823c[_0x7d64('0x15')]='Team';break;case _0x7d64('0x4c'):case _0x7d64('0x4d'):_0x30823c[_0x7d64('0x15')]='VoiceQueue';if(_0x45cc4e){_0x30823c[_0x7d64('0x1e')]=[{'name':_0x7d64('0x32')},{'name':_0x7d64('0x36')}];}break;case _0x7d64('0x4e'):case'agents':case'telephones':_0x30823c['childModel']=_0x7d64('0x2e');if(_0x45cc4e){_0x30823c[_0x7d64('0x1e')]=[{'name':_0x7d64('0x4f'),'filter':{'field':_0x7d64('0x2f'),'value':[_0x7d64('0x50'),_0x7d64('0x51')]},'ignore':!![]},{'name':_0x7d64('0x52')},{'name':'Telephones'}];}break;case _0x7d64('0x53'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x54');break;case _0x7d64('0x55'):_0x30823c[_0x7d64('0x15')]='SalesforceAccount';break;case'freshdeskaccounts':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x56');break;case _0x7d64('0x57'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x58');break;case'deskaccounts':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x59');break;case _0x7d64('0x5a'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x5b');break;case _0x7d64('0x5c'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x2e');break;case _0x7d64('0x5d'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x5e');break;case _0x7d64('0x5f'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x60');break;case _0x7d64('0x61'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x62');break;case'intervals':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x63');break;case'pauses':_0x30823c['childModel']=_0x7d64('0x64');break;case _0x7d64('0x65'):_0x30823c['childModel']=_0x7d64('0x66');break;case'sounds':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x67');break;case'tags':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x68');break;case _0x7d64('0x69'):_0x30823c['childModel']=_0x7d64('0x6a');break;case _0x7d64('0x6b'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x6c');break;case _0x7d64('0x6d'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x6e');break;case _0x7d64('0x6f'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x70');break;case _0x7d64('0x71'):_0x30823c['childModel']=_0x7d64('0x72');break;case _0x7d64('0x73'):_0x30823c[_0x7d64('0x15')]=_0x7d64('0x74');_0x30823c['parentSections']=[{'name':_0x7d64('0x75'),'field':'id','foreignKey':_0x7d64('0x76')}];break;case'metrics':_0x30823c[_0x7d64('0x15')]=_0x7d64('0x77');break;}return _0x30823c;}function _0x5341d2(_0x3ad3c5,_0x104563){var _0x12473a=_0x3ad3c5[_0x7d64('0x78')](0x0)['toUpperCase']()+_0x3ad3c5['slice'](0x1);var _0x494bf7={'type':_0x196df['Sequelize'][_0x7d64('0x79')][_0x7d64('0x7a')],'raw':!![]};return new Promise(function(_0x56660f,_0x5c1982){var _0x580ac7=squel[_0x7d64('0x7b')]()[_0x7d64('0x10')](_0x7d64('0x7c')+_0x12473a+_0x7d64('0x7d'),'id')['field'](_0x7d64('0x7e'))[_0x7d64('0x7f')](_0x7d64('0x80')+_0x3ad3c5+_0x7d64('0x81'),'ui')[_0x7d64('0x82')](_0x7d64('0x83'),_0x104563['id']);return _0x196df[_0x7d64('0x84')][_0x7d64('0x85')](_0x580ac7[_0x7d64('0x86')](),_0x494bf7)['then'](function(_0x4a9ba5){_0x104563[_0x12473a+_0x7d64('0x87')]=_0x4a9ba5;_0x56660f(_0x4a9ba5);})[_0x7d64('0xa')](function(_0xefd2fd){_0x5c1982(_0xefd2fd);});});}return _0x135202[_0x7d64('0x88')](_0x7d64('0x89'),attributes,{'tableName':_0x7d64('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5ad8b0){var _0x374b6b={'raw':_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0x8b')],'where':{}};var _0x23f3e8={};var _0x336cbf={'count':0x0,'rows':[]};var _0x17144c=_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0x8c')];var _0x1f06fd=_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0x8d')]||![];var _0x2368fd=_0x280879(_0x17144c,_0x1f06fd);if(!_0x2368fd['childModel'])throw new Error(_0x7d64('0x8e')+_0x17144c+'\x27');var _0x465047=[{'name':_0x17144c}];if(!_[_0x7d64('0x8f')](_0x2368fd[_0x7d64('0x1e')]))_0x465047=_0x2368fd['parentSections'];var _0x4f430a=[];for(var _0x211beb=0x0;_0x211beb<_0x465047[_0x7d64('0x90')];_0x211beb++){_0x4f430a[_0x7d64('0x91')](_0x196df['UserProfileSection'][_0x7d64('0x92')]({'where':{'userProfileId':_0x5ad8b0[_0x7d64('0x93')]['id'],'name':_0x465047[_0x211beb]['name']},'raw':!![]}));}return Promise[_0x7d64('0x94')](_0x4f430a)[_0x7d64('0x8')](function(_0x13eb3f){var _0x4564ae=_[_0x7d64('0x6')](_0x13eb3f,function(_0x5d553e){return _0x5d553e?_0x5d553e:undefined;});var _0x62e89e=_[_0x7d64('0x6')](_0x465047,['ignore',!![]]);var _0x751150=_['isEmpty'](_0x4564ae)&&_['isEmpty'](_0x62e89e)?null:_['union'](_0x62e89e,_0x4564ae);if(!_0x751150)return null;var _0x4e373f=[];for(var _0x57ac8a=0x0;_0x57ac8a<_0x751150[_0x7d64('0x90')];_0x57ac8a++){var _0x83496d=_[_0x7d64('0x92')](_0x465047,function(_0x4249ac){return _0x751150[_0x57ac8a]?_0x4249ac['name']===_0x751150[_0x57ac8a][_0x7d64('0xe')]:null;});if(_0x83496d){if(_0x751150[_0x57ac8a]['ignore']){_0x4e373f[_0x7d64('0x91')](_0x56bb98(_0x2368fd[_0x7d64('0x15')],_0x751150[_0x57ac8a]));}else{if(!_0x751150[_0x57ac8a][_0x7d64('0x95')]){_0x4e373f[_0x7d64('0x91')](_0x2c4318(_0x83496d,_0x751150[_0x57ac8a],_0x2368fd[_0x7d64('0x15')]));}else{if(_0x83496d['model']){_0x4e373f[_0x7d64('0x91')](_0xed248a(_0x83496d,_0x751150[_0x57ac8a]));}}}}}return Promise[_0x7d64('0x94')](_0x4e373f);})[_0x7d64('0x8')](function(_0x13985d){var _0x2814f9=_0x13985d;var _0x2bfd86=null;if(_0x2814f9){_0x2bfd86=_0x2814f9[_0x7d64('0x90')]===0x1?_0x2814f9[0x0]:null;}if(!_0x2bfd86&&!_0x2814f9)return _0x336cbf;var _0x6020e=_0x196df[_0x2368fd[_0x7d64('0x15')]][_0x7d64('0x96')];_0x23f3e8[_0x7d64('0xc')]=_['keys'](_0x6020e);_0x23f3e8[_0x7d64('0x85')]=_[_0x7d64('0x97')](_0x5ad8b0[_0x7d64('0x85')]);_0x23f3e8[_0x7d64('0x98')]=_['intersection'](_0x23f3e8[_0x7d64('0xc')],_0x23f3e8[_0x7d64('0x85')]);_0x374b6b['attributes']=_[_0x7d64('0x99')](_0x23f3e8[_0x7d64('0xc')],qs[_0x7d64('0x9a')](_0x5ad8b0['query'][_0x7d64('0x9a')]));_0x374b6b[_0x7d64('0x9b')]=_0x374b6b[_0x7d64('0x9b')][_0x7d64('0x90')]?_0x374b6b[_0x7d64('0x9b')]:_0x23f3e8[_0x7d64('0xc')];if(!_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0x9c')]('nolimit')){_0x374b6b[_0x7d64('0x9d')]=qs[_0x7d64('0x9d')](_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0x9d')]);_0x374b6b[_0x7d64('0x9e')]=qs['offset'](_0x5ad8b0[_0x7d64('0x85')]['offset']);}_0x374b6b['order']=qs[_0x7d64('0x9f')](_0x5ad8b0[_0x7d64('0x85')]['sort']);_0x374b6b[_0x7d64('0x82')]=qs[_0x7d64('0x98')](_[_0x7d64('0xa0')](_0x5ad8b0[_0x7d64('0x85')],_0x23f3e8[_0x7d64('0x98')]));if(_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0x6')]){_0x374b6b[_0x7d64('0x82')]=_[_0x7d64('0xa1')](_0x374b6b['where'],{'$or':_[_0x7d64('0x9')](_0x6020e,function(_0x1f4c4b){if(_0x1f4c4b['type'][_0x7d64('0xa2')]!==_0x7d64('0xa3')){var _0xb6a05d={};_0xb6a05d[_0x1f4c4b['field']]={'$like':'%'+_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0x6')]+'%'};return _0xb6a05d;}})});}var _0x57d850=[];var _0x1934cb=null;var _0x147489={};if(_0x2bfd86){_0x1934cb=_[_0x7d64('0x92')](_0x465047,[_0x7d64('0xe'),_0x2bfd86[_0x7d64('0xe')]]);if(_0x1934cb[_0x7d64('0x10')]){_0x147489={};if(_0x2368fd[_0x7d64('0x15')]===_0x7d64('0x74')){_0x147489[_0x1934cb[_0x7d64('0xa4')]]=_['map'](_0x2bfd86['associatedResources'],'id');}else{_0x147489[_0x1934cb[_0x7d64('0xa4')]]=_0x2bfd86[_0x7d64('0xd')];}_0x57d850[_0x7d64('0x91')](_0x147489);}else{_0x374b6b[_0x7d64('0x82')]['id']=_0x2bfd86[_0x7d64('0xd')];}}else{for(var _0x4077d8=0x0;_0x4077d8<_0x2814f9[_0x7d64('0x90')];_0x4077d8++){_0x1934cb=_['find'](_0x465047,[_0x7d64('0xe'),_0x2814f9[_0x4077d8][_0x7d64('0xe')]]);if(_0x1934cb[_0x7d64('0x10')]){_0x147489={};_0x147489[_0x1934cb['foreignKey']]=_0x2814f9[_0x4077d8]['associatedResources'];_0x57d850['push'](_0x147489);}else{if(!_0x374b6b['where']['id'])_0x374b6b[_0x7d64('0x82')]['id']=[];_0x2814f9[_0x4077d8][_0x7d64('0xd')][_0x7d64('0xa5')](function(_0x1a938e){_0x374b6b['where']['id'][_0x7d64('0x91')](_0x1a938e);});}}}if(!_[_0x7d64('0x8f')](_0x57d850)){_0x374b6b[_0x7d64('0x82')]=_[_0x7d64('0xa1')](_0x374b6b[_0x7d64('0x82')],{'$and':{'$or':_0x57d850}});}_0x374b6b=_[_0x7d64('0xa1')]({},_0x374b6b,_0x5ad8b0[_0x7d64('0xa6')]);if(_0x2bfd86&&!_0x2bfd86[_0x7d64('0x95')]&&_0x2368fd[_0x7d64('0x15')]==='AnalyticExtractedReport'){if(_0x5ad8b0['query'][_0x7d64('0xa7')]){_0x374b6b['include']=[{'all':!![]}];}return _0x196df[_0x2368fd[_0x7d64('0x15')]][_0x7d64('0x7')](_0x374b6b)[_0x7d64('0x8')](function(_0x413295){var _0x3cd290=[];_0x413295[_0x7d64('0xa5')](function(_0x261cda){var _0x5468b0;switch(_0x261cda[_0x7d64('0xa8')]){case _0x7d64('0xa9'):_0x5468b0=_[_0x7d64('0x92')](_0x2bfd86[_0x7d64('0xd')],function(_0x6aa7c){return _0x6aa7c['id']===_0x261cda[_0x7d64('0x76')]&&_0x6aa7c[_0x7d64('0x12')]===_0x7d64('0xaa');});break;case _0x7d64('0xab'):_0x5468b0=_[_0x7d64('0x92')](_0x2bfd86['associatedResources'],function(_0x4d7681){return _0x4d7681['id']===_0x261cda[_0x7d64('0x76')]&&_0x4d7681[_0x7d64('0x12')]==='CustomReports';});break;}if(_0x5468b0)_0x3cd290[_0x7d64('0x91')](_0x261cda);});_0x336cbf[_0x7d64('0xac')]=_0x3cd290[_0x7d64('0x90')];_0x336cbf['rows']=_0x3cd290;return _0x336cbf;});}else{if(!_[_0x7d64('0x8f')](_0x5ad8b0[_0x7d64('0x85')]['ids'])){_0x374b6b[_0x7d64('0x82')]['id']=_0x374b6b[_0x7d64('0x82')]['id']?_[_0x7d64('0x99')](_0x374b6b['where']['id'],_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xad')]):_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xad')];if(_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xae')]){_0x374b6b[_0x7d64('0xaf')]=_0x5ad8b0[_0x7d64('0x85')]['customSorting'];}}if(_0x5ad8b0[_0x7d64('0x85')]['extraQueryConditions']){_0x374b6b['where']=_['merge'](_0x374b6b[_0x7d64('0x82')],{'$and':_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xb0')]});}return _0x196df[_0x2368fd[_0x7d64('0x15')]][_0x7d64('0xac')]({'where':_0x374b6b[_0x7d64('0x82')]})[_0x7d64('0x8')](function(_0x313dd8){_0x336cbf[_0x7d64('0xac')]=_0x313dd8;if(_0x5ad8b0['query'][_0x7d64('0xa7')]){if(_0x2368fd[_0x7d64('0x15')]==='CmContact'){_0x374b6b[_0x7d64('0xb1')]=[{'model':_0x196df['Tag'],'as':_0x7d64('0xb2'),'attributes':['id',_0x7d64('0xe'),_0x7d64('0xb3')],'required':_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xb4')]?!![]:![]},{'model':_0x196df[_0x7d64('0x68')],'as':_0x7d64('0xb5'),'attributes':['id','name','color'],'through':_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xb4')]?{'attributes':[],'where':{'TagId':_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xb4')]||undefined}}:{},'required':_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xb4')]?!![]:![]}];}else{_0x374b6b['include']=[{'all':!![]}];}}return _0x196df[_0x2368fd['childModel']][_0x7d64('0x7')](_0x374b6b);})[_0x7d64('0x8')](function(_0x1c0cd8){_0x336cbf[_0x7d64('0xb6')]=_0x1c0cd8;if(_0x17144c===_0x7d64('0x52')&&_0x5ad8b0[_0x7d64('0x85')][_0x7d64('0xb7')]===_0x7d64('0xb8')){var _0x2660bc=[];for(var _0x48a12e=0x0;_0x48a12e<_0x336cbf[_0x7d64('0xb6')]['length'];_0x48a12e++){_0x2660bc['push'](_0x5341d2(_0x7d64('0xb9'),_0x336cbf[_0x7d64('0xb6')][_0x48a12e][_0x7d64('0xba')]));_0x2660bc[_0x7d64('0x91')](_0x5341d2(_0x7d64('0xbb'),_0x336cbf['rows'][_0x48a12e][_0x7d64('0xba')]));_0x2660bc[_0x7d64('0x91')](_0x5341d2(_0x7d64('0xbc'),_0x336cbf[_0x7d64('0xb6')][_0x48a12e][_0x7d64('0xba')]));_0x2660bc[_0x7d64('0x91')](_0x5341d2(_0x7d64('0xbd'),_0x336cbf[_0x7d64('0xb6')][_0x48a12e][_0x7d64('0xba')]));_0x2660bc[_0x7d64('0x91')](_0x5341d2(_0x7d64('0xbe'),_0x336cbf[_0x7d64('0xb6')][_0x48a12e][_0x7d64('0xba')]));_0x2660bc[_0x7d64('0x91')](_0x5341d2(_0x7d64('0xbf'),_0x336cbf[_0x7d64('0xb6')][_0x48a12e][_0x7d64('0xba')]));}return Promise['all'](_0x2660bc)[_0x7d64('0x8')](function(){return _0x336cbf;});}return _0x336cbf;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 37a9fb2..27a4760 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d91=['UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17aa41,_0x1daae2){var _0x553805=function(_0x2276e8){while(--_0x2276e8){_0x17aa41['push'](_0x17aa41['shift']());}};_0x553805(++_0x1daae2);}(_0x0d91,0x76));var _0x10d9=function(_0x569744,_0x30c532){_0x569744=_0x569744-0x0;var _0x57e918=_0x0d91[_0x569744];return _0x57e918;};'use strict';var _=require(_0x10d9('0x0'));var util=require(_0x10d9('0x1'));var moment=require(_0x10d9('0x2'));var BPromise=require(_0x10d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10d9('0x4'));var db=require(_0x10d9('0x5'))['db'];var utils=require(_0x10d9('0x6'));var logger=require('../../config/logger')(_0x10d9('0x7'));var config=require(_0x10d9('0x8'));var jayson=require(_0x10d9('0x9'));var client=jayson['client'][_0x10d9('0xa')]({'port':0x232a});config[_0x10d9('0xb')]=_[_0x10d9('0xc')](config[_0x10d9('0xb')],{'host':_0x10d9('0xd'),'port':0x18eb});var socket=require(_0x10d9('0xe'))(new Redis(config[_0x10d9('0xb')]));require(_0x10d9('0xf'))[_0x10d9('0x10')](socket);function respondWithRpcPromise(_0x1aeeea,_0x698aa4,_0x258ecc){return new BPromise(function(_0x3fe0de,_0x2332c7){return client[_0x10d9('0x11')](_0x1aeeea,_0x258ecc)[_0x10d9('0x12')](function(_0x273a4c){logger['info'](_0x10d9('0x13'),_0x698aa4,_0x10d9('0x14'));logger[_0x10d9('0x15')](_0x10d9('0x16'),_0x698aa4,_0x10d9('0x14'),JSON['stringify'](_0x273a4c));if(_0x273a4c[_0x10d9('0x17')]){if(_0x273a4c['error'][_0x10d9('0x18')]===0x1f4){logger[_0x10d9('0x17')](_0x10d9('0x13'),_0x698aa4,_0x273a4c[_0x10d9('0x17')][_0x10d9('0x19')]);return _0x2332c7(_0x273a4c[_0x10d9('0x17')][_0x10d9('0x19')]);}logger[_0x10d9('0x17')](_0x10d9('0x13'),_0x698aa4,_0x273a4c[_0x10d9('0x17')]['message']);return _0x3fe0de(_0x273a4c['error'][_0x10d9('0x19')]);}else{logger[_0x10d9('0x1a')](_0x10d9('0x13'),_0x698aa4,_0x10d9('0x14'));_0x3fe0de(_0x273a4c['result'][_0x10d9('0x19')]);}})[_0x10d9('0x1b')](function(_0x1cff55){logger[_0x10d9('0x17')]('UserProfile,\x20%s,\x20%s',_0x698aa4,_0x1cff55);_0x2332c7(_0x1cff55);});});} \ No newline at end of file +var _0x908e=['../../config/utils','rpc','client','http','redis','defaults','localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x3db7bb,_0xba42a){var _0x33bca1=function(_0x438914){while(--_0x438914){_0x3db7bb['push'](_0x3db7bb['shift']());}};_0x33bca1(++_0xba42a);}(_0x908e,0x182));var _0xe908=function(_0x2dda5d,_0x4bde46){_0x2dda5d=_0x2dda5d-0x0;var _0x24166e=_0x908e[_0x2dda5d];return _0x24166e;};'use strict';var _=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe908('0x2'));var fs=require('fs');var Redis=require(_0xe908('0x3'));var db=require(_0xe908('0x4'))['db'];var utils=require(_0xe908('0x5'));var logger=require('../../config/logger')(_0xe908('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe908('0x7')][_0xe908('0x8')]({'port':0x232a});config[_0xe908('0x9')]=_[_0xe908('0xa')](config[_0xe908('0x9')],{'host':_0xe908('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe908('0x9')]));require('./userProfile.socket')[_0xe908('0xc')](socket);function respondWithRpcPromise(_0x2992dd,_0x5b8202,_0x4c0846){return new BPromise(function(_0x22c5cc,_0x78a40a){return client[_0xe908('0xd')](_0x2992dd,_0x4c0846)[_0xe908('0xe')](function(_0x32a4cf){logger[_0xe908('0xf')](_0xe908('0x10'),_0x5b8202,_0xe908('0x11'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x5b8202,_0xe908('0x11'),JSON['stringify'](_0x32a4cf));if(_0x32a4cf[_0xe908('0x12')]){if(_0x32a4cf[_0xe908('0x12')][_0xe908('0x13')]===0x1f4){logger[_0xe908('0x12')](_0xe908('0x10'),_0x5b8202,_0x32a4cf['error'][_0xe908('0x14')]);return _0x78a40a(_0x32a4cf[_0xe908('0x12')][_0xe908('0x14')]);}logger[_0xe908('0x12')]('UserProfile,\x20%s,\x20%s',_0x5b8202,_0x32a4cf['error']['message']);return _0x22c5cc(_0x32a4cf[_0xe908('0x12')][_0xe908('0x14')]);}else{logger[_0xe908('0xf')](_0xe908('0x10'),_0x5b8202,'request\x20sent');_0x22c5cc(_0x32a4cf[_0xe908('0x15')][_0xe908('0x14')]);}})[_0xe908('0x16')](function(_0x2c9787){logger[_0xe908('0x12')]('UserProfile,\x20%s,\x20%s',_0x5b8202,_0x2c9787);_0x78a40a(_0x2c9787);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5958683..7277c56 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d5e=['./userProfile.events','remove','emit','removeListener','register','length'];(function(_0x3dabd7,_0xe22a9f){var _0x339f8b=function(_0x40781b){while(--_0x40781b){_0x3dabd7['push'](_0x3dabd7['shift']());}};_0x339f8b(++_0xe22a9f);}(_0x1d5e,0x1d4));var _0xe1d5=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1d5e[_0x19950b];return _0x3c6b41;};'use strict';var UserProfileEvents=require(_0xe1d5('0x0'));var events=['save',_0xe1d5('0x1'),'update'];function createListener(_0x5d2d48,_0x7aded2){return function(_0x2beab2){_0x7aded2[_0xe1d5('0x2')](_0x5d2d48,_0x2beab2);};}function removeListener(_0x132667,_0x513f3a){return function(){UserProfileEvents[_0xe1d5('0x3')](_0x132667,_0x513f3a);};}exports[_0xe1d5('0x4')]=function(_0x3cd4db){for(var _0x1db3b2=0x0,_0x9ffd4a=events[_0xe1d5('0x5')];_0x1db3b2<_0x9ffd4a;_0x1db3b2++){var _0x14a439=events[_0x1db3b2];var _0x3029d1=createListener('userProfile:'+_0x14a439,_0x3cd4db);UserProfileEvents['on'](_0x14a439,_0x3029d1);}}; \ No newline at end of file +var _0xd379=['emit','removeListener','userProfile:','save','remove','update'];(function(_0x36ddab,_0x6daf0e){var _0x2fdaf7=function(_0x1cb28b){while(--_0x1cb28b){_0x36ddab['push'](_0x36ddab['shift']());}};_0x2fdaf7(++_0x6daf0e);}(_0xd379,0x19b));var _0x9d37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd379[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x9d37('0x0'),_0x9d37('0x1'),_0x9d37('0x2')];function createListener(_0x3ec419,_0x5a3986){return function(_0x182d75){_0x5a3986[_0x9d37('0x3')](_0x3ec419,_0x182d75);};}function removeListener(_0x855074,_0x4c3b8c){return function(){UserProfileEvents[_0x9d37('0x4')](_0x855074,_0x4c3b8c);};}exports['register']=function(_0x552a1b){for(var _0x4a69b9=0x0,_0x4d9bbf=events['length'];_0x4a69b9<_0x4d9bbf;_0x4a69b9++){var _0x424067=events[_0x4a69b9];var _0x5b6256=createListener(_0x9d37('0x5')+_0x424067,_0x552a1b);UserProfileEvents['on'](_0x424067,_0x5b6256);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c57a30d..45be750 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29a3=['create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x4058c8,_0x7ad95e){var _0x299b9b=function(_0x6caa5b){while(--_0x6caa5b){_0x4058c8['push'](_0x4058c8['shift']());}};_0x299b9b(++_0x7ad95e);}(_0x29a3,0x116));var _0x329a=function(_0x264e0b,_0x9f827f){_0x264e0b=_0x264e0b-0x0;var _0x40616b=_0x29a3[_0x264e0b];return _0x40616b;};'use strict';var multer=require('multer');var util=require(_0x329a('0x0'));var path=require(_0x329a('0x1'));var timeout=require(_0x329a('0x2'));var express=require('express');var router=express[_0x329a('0x3')]();var fs_extra=require(_0x329a('0x4'));var auth=require(_0x329a('0x5'));var interaction=require(_0x329a('0x6'));var config=require(_0x329a('0x7'));var controller=require(_0x329a('0x8'));router[_0x329a('0x9')]('/',auth[_0x329a('0xa')](),controller['index']);router[_0x329a('0x9')](_0x329a('0xb'),auth[_0x329a('0xa')](),controller[_0x329a('0xc')]);router['get'](_0x329a('0xd'),auth[_0x329a('0xa')](),controller[_0x329a('0xe')]);router[_0x329a('0xf')]('/',auth[_0x329a('0xa')](),controller[_0x329a('0x10')]);router['put'](_0x329a('0xd'),auth[_0x329a('0xa')](),controller[_0x329a('0x11')]);router[_0x329a('0x12')](_0x329a('0xd'),auth['isAuthenticated'](),controller[_0x329a('0x13')]);module[_0x329a('0x14')]=router; \ No newline at end of file +var _0xfe8a=['put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','show','post','create'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xfe8a,0x17f));var _0xafe8=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xfe8a[_0x36bfe3];return _0x9b0436;};'use strict';var multer=require(_0xafe8('0x0'));var util=require(_0xafe8('0x1'));var path=require('path');var timeout=require(_0xafe8('0x2'));var express=require(_0xafe8('0x3'));var router=express[_0xafe8('0x4')]();var fs_extra=require(_0xafe8('0x5'));var auth=require(_0xafe8('0x6'));var interaction=require(_0xafe8('0x7'));var config=require(_0xafe8('0x8'));var controller=require(_0xafe8('0x9'));router[_0xafe8('0xa')]('/',auth[_0xafe8('0xb')](),controller[_0xafe8('0xc')]);router[_0xafe8('0xa')]('/describe',auth[_0xafe8('0xb')](),controller['describe']);router[_0xafe8('0xa')]('/:id',auth[_0xafe8('0xb')](),controller[_0xafe8('0xd')]);router[_0xafe8('0xe')]('/',auth[_0xafe8('0xb')](),controller[_0xafe8('0xf')]);router[_0xafe8('0x10')](_0xafe8('0x11'),auth[_0xafe8('0xb')](),controller[_0xafe8('0x12')]);router['delete'](_0xafe8('0x11'),auth['isAuthenticated'](),controller[_0xafe8('0x13')]);module[_0xafe8('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4375fa7..2e1f55b 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77cc=['STRING','sequelize','exports'];(function(_0x54fc1f,_0x1703c2){var _0x53f699=function(_0x3fad74){while(--_0x3fad74){_0x54fc1f['push'](_0x54fc1f['shift']());}};_0x53f699(++_0x1703c2);}(_0x77cc,0x154));var _0xc77c=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x77cc[_0x540dcb];return _0x49353c;};'use strict';var Sequelize=require(_0xc77c('0x0'));module[_0xc77c('0x1')]={'name':{'type':Sequelize[_0xc77c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xc77c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8676=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8676,0x13d));var _0x6867=function(_0x268e5c,_0x42d5b4){_0x268e5c=_0x268e5c-0x0;var _0x1dddaa=_0x8676[_0x268e5c];return _0x1dddaa;};'use strict';var Sequelize=require('sequelize');module[_0x6867('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x6867('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index dc399bf..b7af59f 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','UserProfileResource','rawAttributes','type'];(function(_0x599c44,_0x2fb16e){var _0x1d6cf6=function(_0x43f375){while(--_0x43f375){_0x599c44['push'](_0x599c44['shift']());}};_0x1d6cf6(++_0x2fb16e);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['UserProfileResource'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['UserProfileResource']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['UserProfileResource'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','UserProfileResource','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x1bbe6c,_0x56d18a){var _0x76ab07=function(_0x220f14){while(--_0x220f14){_0x1bbe6c['push'](_0x1bbe6c['shift']());}};_0x76ab07(++_0x56d18a);}(_0xf61e,0x191));var _0xef61=function(_0x64c0ae,_0xe6dd2b){_0x64c0ae=_0x64c0ae-0x0;var _0x3f22c3=_0xf61e[_0x64c0ae];return _0x3f22c3;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['UserProfileResource']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['UserProfileResource'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 80c26c4..4e7bcc5 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x232f=['UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x16a7c1,_0x30d390){var _0x282ff8=function(_0xb3d006){while(--_0xb3d006){_0x16a7c1['push'](_0x16a7c1['shift']());}};_0x282ff8(++_0x30d390);}(_0x232f,0x18c));var _0xf232=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0x232f[_0xdeac17];return _0x33aabd;};'use strict';var _=require(_0xf232('0x0'));var util=require(_0xf232('0x1'));var logger=require(_0xf232('0x2'))('api');var moment=require(_0xf232('0x3'));var BPromise=require(_0xf232('0x4'));var rp=require(_0xf232('0x5'));var fs=require('fs');var path=require(_0xf232('0x6'));var rimraf=require(_0xf232('0x7'));var config=require(_0xf232('0x8'));var attributes=require(_0xf232('0x9'));module['exports']=function(_0x4ff8c9,_0x1f5f6e){return _0x4ff8c9['define'](_0xf232('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xf232('0xb'),'fields':[_0xf232('0xc'),_0xf232('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b34=['moment','request-promise','path','rimraf','./userProfileResource.attributes','exports','user_profile_has_resources','resourceId','sectionId','api'];(function(_0x5ea4e2,_0x4d83a7){var _0x4babb4=function(_0x2dcfcc){while(--_0x2dcfcc){_0x5ea4e2['push'](_0x5ea4e2['shift']());}};_0x4babb4(++_0x4d83a7);}(_0x9b34,0x12b));var _0x49b3=function(_0x57cb1b,_0x2e5898){_0x57cb1b=_0x57cb1b-0x0;var _0x10fef3=_0x9b34[_0x57cb1b];return _0x10fef3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x49b3('0x0'));var moment=require(_0x49b3('0x1'));var BPromise=require('bluebird');var rp=require(_0x49b3('0x2'));var fs=require('fs');var path=require(_0x49b3('0x3'));var rimraf=require(_0x49b3('0x4'));var config=require('../../config/environment');var attributes=require(_0x49b3('0x5'));module[_0x49b3('0x6')]=function(_0x264557,_0x376cb3){return _0x264557['define']('UserProfileResource',attributes,{'tableName':_0x49b3('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x49b3('0x8'),_0x49b3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 072739d..b4506f5 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd910=['error','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5676df,_0x14d122){var _0x1fb878=function(_0x84c80a){while(--_0x84c80a){_0x5676df['push'](_0x5676df['shift']());}};_0x1fb878(++_0x14d122);}(_0xd910,0xb9));var _0x0d91=function(_0x3be7b3,_0x5606c2){_0x3be7b3=_0x3be7b3-0x0;var _0x5a6572=_0xd910[_0x3be7b3];return _0x5a6572;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d91('0x0'));var BPromise=require('bluebird');var rs=require(_0x0d91('0x1'));var fs=require('fs');var Redis=require(_0x0d91('0x2'));var db=require(_0x0d91('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d91('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0d91('0x5'));var client=jayson[_0x0d91('0x6')][_0x0d91('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x348e20,_0x47980b,_0x17a5c8){return new BPromise(function(_0x58cc07,_0x1c0644){return client[_0x0d91('0x8')](_0x348e20,_0x17a5c8)[_0x0d91('0x9')](function(_0x5ddd77){logger['info'](_0x0d91('0xa'),_0x47980b,_0x0d91('0xb'));logger[_0x0d91('0xc')](_0x0d91('0xd'),_0x47980b,'request\x20sent',JSON[_0x0d91('0xe')](_0x5ddd77));if(_0x5ddd77[_0x0d91('0xf')]){if(_0x5ddd77['error']['code']===0x1f4){logger['error'](_0x0d91('0xa'),_0x47980b,_0x5ddd77[_0x0d91('0xf')][_0x0d91('0x10')]);return _0x1c0644(_0x5ddd77[_0x0d91('0xf')]['message']);}logger[_0x0d91('0xf')](_0x0d91('0xa'),_0x47980b,_0x5ddd77[_0x0d91('0xf')]['message']);return _0x58cc07(_0x5ddd77[_0x0d91('0xf')]['message']);}else{logger[_0x0d91('0x11')](_0x0d91('0xa'),_0x47980b,_0x0d91('0xb'));_0x58cc07(_0x5ddd77[_0x0d91('0x12')][_0x0d91('0x10')]);}})[_0x0d91('0x13')](function(_0x43dfba){logger[_0x0d91('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x47980b,_0x43dfba);_0x1c0644(_0x43dfba);});});} \ No newline at end of file +var _0xd4a2=['../../config/utils','../../config/environment','client','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0xd4a2,0x164));var _0x2d4a=function(_0xa3cb57,_0x20e2ea){_0xa3cb57=_0xa3cb57-0x0;var _0xaec979=_0xd4a2[_0xa3cb57];return _0xaec979;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require(_0x2d4a('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d4a('0x2'));var fs=require('fs');var Redis=require(_0x2d4a('0x3'));var db=require(_0x2d4a('0x4'))['db'];var utils=require(_0x2d4a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2d4a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2d4a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49634,_0x33e380,_0x3ce0c6){return new BPromise(function(_0x3b5651,_0x2f75e7){return client['request'](_0x49634,_0x3ce0c6)['then'](function(_0x1cd342){logger[_0x2d4a('0x8')](_0x2d4a('0x9'),_0x33e380,_0x2d4a('0xa'));logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x33e380,_0x2d4a('0xa'),JSON[_0x2d4a('0xd')](_0x1cd342));if(_0x1cd342[_0x2d4a('0xe')]){if(_0x1cd342[_0x2d4a('0xe')][_0x2d4a('0xf')]===0x1f4){logger[_0x2d4a('0xe')](_0x2d4a('0x9'),_0x33e380,_0x1cd342[_0x2d4a('0xe')]['message']);return _0x2f75e7(_0x1cd342['error']['message']);}logger[_0x2d4a('0xe')](_0x2d4a('0x9'),_0x33e380,_0x1cd342['error']['message']);return _0x3b5651(_0x1cd342[_0x2d4a('0xe')][_0x2d4a('0x10')]);}else{logger[_0x2d4a('0x8')]('UserProfileResource,\x20%s,\x20%s',_0x33e380,_0x2d4a('0xa'));_0x3b5651(_0x1cd342[_0x2d4a('0x11')][_0x2d4a('0x10')]);}})[_0x2d4a('0x12')](function(_0x5652a1){logger[_0x2d4a('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x33e380,_0x5652a1);_0x2f75e7(_0x5652a1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b6d444b..d1098b7 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5c8=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','post','create','put','update'];(function(_0x417774,_0x1b95e6){var _0x10015d=function(_0x2526b3){while(--_0x2526b3){_0x417774['push'](_0x417774['shift']());}};_0x10015d(++_0x1b95e6);}(_0xd5c8,0xce));var _0x8d5c=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0xd5c8[_0x260859];return _0x4b77f8;};'use strict';var multer=require(_0x8d5c('0x0'));var util=require(_0x8d5c('0x1'));var path=require(_0x8d5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d5c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d5c('0x4'));var interaction=require(_0x8d5c('0x5'));var config=require(_0x8d5c('0x6'));var controller=require('./userProfileSection.controller');router[_0x8d5c('0x7')]('/',auth[_0x8d5c('0x8')](),controller['index']);router[_0x8d5c('0x7')](_0x8d5c('0x9'),auth[_0x8d5c('0x8')](),controller['describe']);router['get'](_0x8d5c('0xa'),auth[_0x8d5c('0x8')](),controller['show']);router[_0x8d5c('0xb')]('/',auth[_0x8d5c('0x8')](),controller[_0x8d5c('0xc')]);router[_0x8d5c('0xd')](_0x8d5c('0xa'),auth[_0x8d5c('0x8')](),controller[_0x8d5c('0xe')]);router['delete'](_0x8d5c('0xa'),auth[_0x8d5c('0x8')](),controller[_0x8d5c('0xf')]);module[_0x8d5c('0x10')]=router; \ No newline at end of file +var _0xad46=['index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x193c2d,_0x2ffba6){var _0xc86526=function(_0x1dcea2){while(--_0x1dcea2){_0x193c2d['push'](_0x193c2d['shift']());}};_0xc86526(++_0x2ffba6);}(_0xad46,0x1da));var _0x6ad4=function(_0x347c14,_0xf2472f){_0x347c14=_0x347c14-0x0;var _0x46deb8=_0xad46[_0x347c14];return _0x46deb8;};'use strict';var multer=require(_0x6ad4('0x0'));var util=require(_0x6ad4('0x1'));var path=require('path');var timeout=require(_0x6ad4('0x2'));var express=require(_0x6ad4('0x3'));var router=express['Router']();var fs_extra=require(_0x6ad4('0x4'));var auth=require(_0x6ad4('0x5'));var interaction=require(_0x6ad4('0x6'));var config=require(_0x6ad4('0x7'));var controller=require(_0x6ad4('0x8'));router[_0x6ad4('0x9')]('/',auth['isAuthenticated'](),controller[_0x6ad4('0xa')]);router[_0x6ad4('0x9')](_0x6ad4('0xb'),auth[_0x6ad4('0xc')](),controller[_0x6ad4('0xd')]);router[_0x6ad4('0x9')](_0x6ad4('0xe'),auth['isAuthenticated'](),controller[_0x6ad4('0xf')]);router[_0x6ad4('0x10')]('/',auth['isAuthenticated'](),controller[_0x6ad4('0x11')]);router[_0x6ad4('0x12')](_0x6ad4('0xe'),auth[_0x6ad4('0xc')](),controller[_0x6ad4('0x13')]);router[_0x6ad4('0x14')](_0x6ad4('0xe'),auth[_0x6ad4('0xc')](),controller[_0x6ad4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 4068d38..588f21e 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34b7=['BOOLEAN','crudPermissions','join','getDataValue','STRING','INTEGER'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x34b7,0x196));var _0x734b=function(_0x5925e9,_0x51b161){_0x5925e9=_0x5925e9-0x0;var _0x72efff=_0x34b7[_0x5925e9];return _0x72efff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x734b('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x734b('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x734b('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x734b('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x734b('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x734b('0x0')],'set':function(_0x5de1ae){this['setDataValue'](_0x734b('0x3'),_0x5de1ae?_0x5de1ae[_0x734b('0x4')](''):[]);},'get':function(){return this[_0x734b('0x5')](_0x734b('0x3'))?this[_0x734b('0x5')](_0x734b('0x3'))['split'](''):[];}}}; \ No newline at end of file +var _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x1c53e3,_0x323bf5){var _0x3fb9a4=function(_0x302fe1){while(--_0x302fe1){_0x1c53e3['push'](_0x1c53e3['shift']());}};_0x3fb9a4(++_0x323bf5);}(_0xb9a7,0x112));var _0x7b9a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index ef13d8f..bd1d155 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e77=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','sendStatus','stack','name','index','map','UserProfileSection','fieldName','type','key','model','query'];(function(_0xba1993,_0x57af58){var _0x250a2f=function(_0x5a1b83){while(--_0x5a1b83){_0xba1993['push'](_0xba1993['shift']());}};_0x250a2f(++_0x57af58);}(_0x0e77,0xf3));var _0x70e7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0e77[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x70e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70e7('0x1'));var jsonpatch=require(_0x70e7('0x2'));var rp=require(_0x70e7('0x3'));var moment=require('moment');var BPromise=require(_0x70e7('0x4'));var Mustache=require(_0x70e7('0x5'));var util=require(_0x70e7('0x6'));var path=require(_0x70e7('0x7'));var sox=require(_0x70e7('0x8'));var csv=require(_0x70e7('0x9'));var ejs=require(_0x70e7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70e7('0xb'));var squel=require(_0x70e7('0xc'));var crypto=require(_0x70e7('0xd'));var jsforce=require(_0x70e7('0xe'));var deskjs=require(_0x70e7('0xf'));var toCsv=require(_0x70e7('0x9'));var querystring=require('querystring');var Papa=require(_0x70e7('0x10'));var Redis=require(_0x70e7('0x11'));var authService=require(_0x70e7('0x12'));var qs=require(_0x70e7('0x13'));var as=require(_0x70e7('0x14'));var hardwareService=require(_0x70e7('0x15'));var logger=require('../../config/logger')(_0x70e7('0x16'));var utils=require(_0x70e7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x70e7('0x18'))['db'];function respondWithStatusCode(_0x4d9c84,_0x114b55){_0x114b55=_0x114b55||0xcc;return function(_0x319987){if(_0x319987){return _0x4d9c84['sendStatus'](_0x114b55);}return _0x4d9c84[_0x70e7('0x19')](_0x114b55)[_0x70e7('0x1a')]();};}function respondWithResult(_0x1258bd,_0xed1dbb){_0xed1dbb=_0xed1dbb||0xc8;return function(_0x394fe8){if(_0x394fe8){return _0x1258bd[_0x70e7('0x19')](_0xed1dbb)[_0x70e7('0x1b')](_0x394fe8);}};}function respondWithFilteredResult(_0x19fa7b,_0x5a49c9){return function(_0x285385){if(_0x285385){var _0x1000dd=typeof _0x5a49c9[_0x70e7('0x1c')]==='undefined'&&typeof _0x5a49c9[_0x70e7('0x1d')]===_0x70e7('0x1e');var _0x4526e0=_0x285385[_0x70e7('0x1f')];var _0x174399=_0x1000dd?0x0:_0x5a49c9[_0x70e7('0x1c')];var _0x458839=_0x1000dd?_0x285385[_0x70e7('0x1f')]:_0x5a49c9[_0x70e7('0x1c')]+_0x5a49c9['limit'];var _0x2c8ff7;if(_0x458839>=_0x4526e0){_0x458839=_0x4526e0;_0x2c8ff7=0xc8;}else{_0x2c8ff7=0xce;}_0x19fa7b[_0x70e7('0x19')](_0x2c8ff7);return _0x19fa7b[_0x70e7('0x20')]('Content-Range',_0x174399+'-'+_0x458839+'/'+_0x4526e0)[_0x70e7('0x1b')](_0x285385);}return null;};}function patchUpdates(_0x1c83bb){return function(_0xa9f6f0){try{jsonpatch['apply'](_0xa9f6f0,_0x1c83bb,!![]);}catch(_0x4e9463){return BPromise[_0x70e7('0x21')](_0x4e9463);}return _0xa9f6f0[_0x70e7('0x22')]();};}function saveUpdates(_0x3a9e71,_0x3787cb){return function(_0xae564d){if(_0xae564d){return _0xae564d[_0x70e7('0x23')](_0x3a9e71)[_0x70e7('0x24')](function(_0x44bf92){return _0x44bf92;});}return null;};}function removeEntity(_0x4b0229,_0x4a07fd){return function(_0x1a0875){if(_0x1a0875){return _0x1a0875[_0x70e7('0x25')]()[_0x70e7('0x24')](function(){_0x4b0229[_0x70e7('0x19')](0xcc)[_0x70e7('0x1a')]();});}};}function handleEntityNotFound(_0x79127c,_0x3b4818){return function(_0x404404){if(!_0x404404){_0x79127c[_0x70e7('0x26')](0x194);}return _0x404404;};}function handleError(_0x28fbbc,_0x489541){_0x489541=_0x489541||0x1f4;return function(_0xae2a9b){logger['error'](_0xae2a9b[_0x70e7('0x27')]);if(_0xae2a9b['name']){delete _0xae2a9b[_0x70e7('0x28')];}_0x28fbbc[_0x70e7('0x19')](_0x489541)['send'](_0xae2a9b);};}exports[_0x70e7('0x29')]=function(_0xa1c8a0,_0x35040f){var _0x50f97d={},_0x9f6789={},_0x2eba9f={'count':0x0,'rows':[]};var _0x3fc300=_[_0x70e7('0x2a')](db[_0x70e7('0x2b')]['rawAttributes'],function(_0x10e64b){return{'name':_0x10e64b[_0x70e7('0x2c')],'type':_0x10e64b[_0x70e7('0x2d')][_0x70e7('0x2e')]};});_0x9f6789[_0x70e7('0x2f')]=_[_0x70e7('0x2a')](_0x3fc300,_0x70e7('0x28'));_0x9f6789['query']=_['keys'](_0xa1c8a0[_0x70e7('0x30')]);_0x9f6789[_0x70e7('0x31')]=_['intersection'](_0x9f6789[_0x70e7('0x2f')],_0x9f6789[_0x70e7('0x30')]);_0x50f97d[_0x70e7('0x32')]=_[_0x70e7('0x33')](_0x9f6789[_0x70e7('0x2f')],qs['fields'](_0xa1c8a0[_0x70e7('0x30')][_0x70e7('0x34')]));_0x50f97d['attributes']=_0x50f97d[_0x70e7('0x32')]['length']?_0x50f97d[_0x70e7('0x32')]:_0x9f6789[_0x70e7('0x2f')];if(!_0xa1c8a0[_0x70e7('0x30')][_0x70e7('0x35')](_0x70e7('0x36'))){_0x50f97d[_0x70e7('0x1d')]=qs[_0x70e7('0x1d')](_0xa1c8a0[_0x70e7('0x30')][_0x70e7('0x1d')]);_0x50f97d['offset']=qs[_0x70e7('0x1c')](_0xa1c8a0[_0x70e7('0x30')][_0x70e7('0x1c')]);}_0x50f97d[_0x70e7('0x37')]=qs[_0x70e7('0x38')](_0xa1c8a0[_0x70e7('0x30')][_0x70e7('0x38')]);_0x50f97d['where']=qs[_0x70e7('0x31')](_['pick'](_0xa1c8a0[_0x70e7('0x30')],_0x9f6789['filters']),_0x3fc300);if(_0xa1c8a0['query']['filter']){_0x50f97d[_0x70e7('0x39')]=_[_0x70e7('0x3a')](_0x50f97d[_0x70e7('0x39')],{'$or':_['map'](_0x3fc300,function(_0x280f8a){if(_0x280f8a[_0x70e7('0x2d')]!==_0x70e7('0x3b')){var _0x17f365={};_0x17f365[_0x280f8a[_0x70e7('0x28')]]={'$like':'%'+_0xa1c8a0[_0x70e7('0x30')]['filter']+'%'};return _0x17f365;}})});}_0x50f97d=_['merge']({},_0x50f97d,_0xa1c8a0[_0x70e7('0x3c')]);var _0x36b325={'where':_0x50f97d[_0x70e7('0x39')]};return db[_0x70e7('0x2b')][_0x70e7('0x1f')](_0x36b325)[_0x70e7('0x24')](function(_0x4fe4b8){_0x2eba9f[_0x70e7('0x1f')]=_0x4fe4b8;if(_0xa1c8a0[_0x70e7('0x30')][_0x70e7('0x3d')]){_0x50f97d[_0x70e7('0x3e')]=[{'all':!![]}];}return db[_0x70e7('0x2b')][_0x70e7('0x3f')](_0x50f97d);})[_0x70e7('0x24')](function(_0x4eb573){_0x2eba9f[_0x70e7('0x40')]=_0x4eb573;return _0x2eba9f;})[_0x70e7('0x24')](respondWithFilteredResult(_0x35040f,_0x50f97d))[_0x70e7('0x41')](handleError(_0x35040f,null));};exports['show']=function(_0x2128f2,_0x4c6713){var _0x385a50={'raw':![],'where':{'id':_0x2128f2[_0x70e7('0x42')]['id']}},_0x25e2c2={};_0x25e2c2['model']=_[_0x70e7('0x43')](db[_0x70e7('0x2b')]['rawAttributes']);_0x25e2c2[_0x70e7('0x30')]=_[_0x70e7('0x43')](_0x2128f2[_0x70e7('0x30')]);_0x25e2c2[_0x70e7('0x31')]=_[_0x70e7('0x33')](_0x25e2c2['model'],_0x25e2c2[_0x70e7('0x30')]);_0x385a50[_0x70e7('0x32')]=_['intersection'](_0x25e2c2[_0x70e7('0x2f')],qs[_0x70e7('0x34')](_0x2128f2[_0x70e7('0x30')][_0x70e7('0x34')]));_0x385a50[_0x70e7('0x32')]=_0x385a50[_0x70e7('0x32')][_0x70e7('0x44')]?_0x385a50[_0x70e7('0x32')]:_0x25e2c2[_0x70e7('0x2f')];if(_0x2128f2[_0x70e7('0x30')][_0x70e7('0x3d')]){_0x385a50[_0x70e7('0x3e')]=[{'all':!![]}];}_0x385a50=_['merge']({},_0x385a50,_0x2128f2[_0x70e7('0x3c')]);return db['UserProfileSection']['find'](_0x385a50)[_0x70e7('0x24')](handleEntityNotFound(_0x4c6713,null))[_0x70e7('0x24')](respondWithResult(_0x4c6713,null))['catch'](handleError(_0x4c6713,null));};exports[_0x70e7('0x45')]=function(_0x5c281c,_0x32b75e){return db[_0x70e7('0x2b')][_0x70e7('0x45')](_0x5c281c['body'],{})[_0x70e7('0x24')](respondWithResult(_0x32b75e,0xc9))[_0x70e7('0x41')](handleError(_0x32b75e,null));};exports[_0x70e7('0x23')]=function(_0x47553f,_0x3fce2d){if(_0x47553f[_0x70e7('0x46')]['id']){delete _0x47553f['body']['id'];}return db[_0x70e7('0x2b')]['find']({'where':{'id':_0x47553f['params']['id']}})[_0x70e7('0x24')](handleEntityNotFound(_0x3fce2d,null))[_0x70e7('0x24')](saveUpdates(_0x47553f[_0x70e7('0x46')],null))[_0x70e7('0x24')](respondWithResult(_0x3fce2d,null))[_0x70e7('0x41')](handleError(_0x3fce2d,null));};exports[_0x70e7('0x25')]=function(_0x1e1ed4,_0x5588ca){return db['UserProfileSection'][_0x70e7('0x47')]({'where':{'id':_0x1e1ed4[_0x70e7('0x42')]['id']}})[_0x70e7('0x24')](handleEntityNotFound(_0x5588ca,null))[_0x70e7('0x24')](removeEntity(_0x5588ca,null))['catch'](handleError(_0x5588ca,null));};exports['describe']=function(_0x194711,_0x5a79a8){return db[_0x70e7('0x2b')][_0x70e7('0x48')]()[_0x70e7('0x24')](respondWithResult(_0x5a79a8,null))['catch'](handleError(_0x5a79a8,null));}; \ No newline at end of file +var _0xb69b=['index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','params','options','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x3fe28f,_0x49f18d){var _0x276544=function(_0x1bc9c5){while(--_0x1bc9c5){_0x3fe28f['push'](_0x3fe28f['shift']());}};_0x276544(++_0x49f18d);}(_0xb69b,0x111));var _0xbb69=function(_0x41b80c,_0x41f711){_0x41b80c=_0x41b80c-0x0;var _0x7672bd=_0xb69b[_0x41b80c];return _0x7672bd;};'use strict';var emlformat=require(_0xbb69('0x0'));var rimraf=require(_0xbb69('0x1'));var zipdir=require(_0xbb69('0x2'));var jsonpatch=require(_0xbb69('0x3'));var rp=require(_0xbb69('0x4'));var moment=require(_0xbb69('0x5'));var BPromise=require(_0xbb69('0x6'));var Mustache=require('mustache');var util=require(_0xbb69('0x7'));var path=require(_0xbb69('0x8'));var sox=require(_0xbb69('0x9'));var csv=require(_0xbb69('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb69('0xb'));var _=require(_0xbb69('0xc'));var squel=require(_0xbb69('0xd'));var crypto=require(_0xbb69('0xe'));var jsforce=require(_0xbb69('0xf'));var deskjs=require(_0xbb69('0x10'));var toCsv=require(_0xbb69('0xa'));var querystring=require(_0xbb69('0x11'));var Papa=require(_0xbb69('0x12'));var Redis=require(_0xbb69('0x13'));var authService=require(_0xbb69('0x14'));var qs=require(_0xbb69('0x15'));var as=require(_0xbb69('0x16'));var hardwareService=require(_0xbb69('0x17'));var logger=require('../../config/logger')(_0xbb69('0x18'));var utils=require(_0xbb69('0x19'));var config=require(_0xbb69('0x1a'));var licenseUtil=require(_0xbb69('0x1b'));var db=require(_0xbb69('0x1c'))['db'];function respondWithStatusCode(_0x4f90b,_0xceaef8){_0xceaef8=_0xceaef8||0xcc;return function(_0x25e069){if(_0x25e069){return _0x4f90b[_0xbb69('0x1d')](_0xceaef8);}return _0x4f90b['status'](_0xceaef8)['end']();};}function respondWithResult(_0x2bb98e,_0x1301ad){_0x1301ad=_0x1301ad||0xc8;return function(_0x5b03a1){if(_0x5b03a1){return _0x2bb98e['status'](_0x1301ad)[_0xbb69('0x1e')](_0x5b03a1);}};}function respondWithFilteredResult(_0x2d04d6,_0x5b3a9a){return function(_0x231a00){if(_0x231a00){var _0x33331f=typeof _0x5b3a9a[_0xbb69('0x1f')]===_0xbb69('0x20')&&typeof _0x5b3a9a[_0xbb69('0x21')]===_0xbb69('0x20');var _0x11b278=_0x231a00[_0xbb69('0x22')];var _0x4fa1c7=_0x33331f?0x0:_0x5b3a9a[_0xbb69('0x1f')];var _0x149ecd=_0x33331f?_0x231a00[_0xbb69('0x22')]:_0x5b3a9a[_0xbb69('0x1f')]+_0x5b3a9a[_0xbb69('0x21')];var _0x210ee2;if(_0x149ecd>=_0x11b278){_0x149ecd=_0x11b278;_0x210ee2=0xc8;}else{_0x210ee2=0xce;}_0x2d04d6[_0xbb69('0x23')](_0x210ee2);return _0x2d04d6[_0xbb69('0x24')](_0xbb69('0x25'),_0x4fa1c7+'-'+_0x149ecd+'/'+_0x11b278)[_0xbb69('0x1e')](_0x231a00);}return null;};}function patchUpdates(_0x2a3ea3){return function(_0x37d3aa){try{jsonpatch[_0xbb69('0x26')](_0x37d3aa,_0x2a3ea3,!![]);}catch(_0x2276e5){return BPromise[_0xbb69('0x27')](_0x2276e5);}return _0x37d3aa[_0xbb69('0x28')]();};}function saveUpdates(_0x333576,_0x188b9e){return function(_0x25dd03){if(_0x25dd03){return _0x25dd03[_0xbb69('0x29')](_0x333576)[_0xbb69('0x2a')](function(_0x3afcaf){return _0x3afcaf;});}return null;};}function removeEntity(_0x49d790,_0x10235c){return function(_0x5ad526){if(_0x5ad526){return _0x5ad526[_0xbb69('0x2b')]()['then'](function(){_0x49d790[_0xbb69('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30137f,_0x4fdca5){return function(_0x282d8e){if(!_0x282d8e){_0x30137f['sendStatus'](0x194);}return _0x282d8e;};}function handleError(_0x2465fc,_0x3ab9ef){_0x3ab9ef=_0x3ab9ef||0x1f4;return function(_0xf24498){logger[_0xbb69('0x2c')](_0xf24498[_0xbb69('0x2d')]);if(_0xf24498['name']){delete _0xf24498[_0xbb69('0x2e')];}_0x2465fc[_0xbb69('0x23')](_0x3ab9ef)['send'](_0xf24498);};}exports[_0xbb69('0x2f')]=function(_0x4d7a1b,_0x3f4278){var _0x425f20={},_0x56baed={},_0x2e83a4={'count':0x0,'rows':[]};var _0x28cdc7=_[_0xbb69('0x30')](db[_0xbb69('0x31')][_0xbb69('0x32')],function(_0x3678b4){return{'name':_0x3678b4[_0xbb69('0x33')],'type':_0x3678b4[_0xbb69('0x34')][_0xbb69('0x35')]};});_0x56baed[_0xbb69('0x36')]=_[_0xbb69('0x30')](_0x28cdc7,'name');_0x56baed[_0xbb69('0x37')]=_[_0xbb69('0x38')](_0x4d7a1b['query']);_0x56baed[_0xbb69('0x39')]=_[_0xbb69('0x3a')](_0x56baed['model'],_0x56baed[_0xbb69('0x37')]);_0x425f20['attributes']=_[_0xbb69('0x3a')](_0x56baed['model'],qs[_0xbb69('0x3b')](_0x4d7a1b[_0xbb69('0x37')][_0xbb69('0x3b')]));_0x425f20[_0xbb69('0x3c')]=_0x425f20[_0xbb69('0x3c')][_0xbb69('0x3d')]?_0x425f20[_0xbb69('0x3c')]:_0x56baed[_0xbb69('0x36')];if(!_0x4d7a1b['query'][_0xbb69('0x3e')](_0xbb69('0x3f'))){_0x425f20['limit']=qs['limit'](_0x4d7a1b[_0xbb69('0x37')][_0xbb69('0x21')]);_0x425f20[_0xbb69('0x1f')]=qs[_0xbb69('0x1f')](_0x4d7a1b['query']['offset']);}_0x425f20[_0xbb69('0x40')]=qs[_0xbb69('0x41')](_0x4d7a1b[_0xbb69('0x37')][_0xbb69('0x41')]);_0x425f20['where']=qs[_0xbb69('0x39')](_[_0xbb69('0x42')](_0x4d7a1b[_0xbb69('0x37')],_0x56baed['filters']),_0x28cdc7);if(_0x4d7a1b[_0xbb69('0x37')][_0xbb69('0x43')]){_0x425f20[_0xbb69('0x44')]=_[_0xbb69('0x45')](_0x425f20[_0xbb69('0x44')],{'$or':_['map'](_0x28cdc7,function(_0x53a3db){if(_0x53a3db[_0xbb69('0x34')]!=='VIRTUAL'){var _0x23e816={};_0x23e816[_0x53a3db['name']]={'$like':'%'+_0x4d7a1b[_0xbb69('0x37')][_0xbb69('0x43')]+'%'};return _0x23e816;}})});}_0x425f20=_[_0xbb69('0x45')]({},_0x425f20,_0x4d7a1b['options']);var _0x191fdc={'where':_0x425f20['where']};return db[_0xbb69('0x31')]['count'](_0x191fdc)[_0xbb69('0x2a')](function(_0x348f27){_0x2e83a4[_0xbb69('0x22')]=_0x348f27;if(_0x4d7a1b['query'][_0xbb69('0x46')]){_0x425f20[_0xbb69('0x47')]=[{'all':!![]}];}return db[_0xbb69('0x31')][_0xbb69('0x48')](_0x425f20);})[_0xbb69('0x2a')](function(_0x4fbe21){_0x2e83a4[_0xbb69('0x49')]=_0x4fbe21;return _0x2e83a4;})['then'](respondWithFilteredResult(_0x3f4278,_0x425f20))['catch'](handleError(_0x3f4278,null));};exports['show']=function(_0x3359c2,_0x218c1b){var _0x211c84={'raw':![],'where':{'id':_0x3359c2[_0xbb69('0x4a')]['id']}},_0x39519a={};_0x39519a[_0xbb69('0x36')]=_['keys'](db[_0xbb69('0x31')][_0xbb69('0x32')]);_0x39519a[_0xbb69('0x37')]=_['keys'](_0x3359c2[_0xbb69('0x37')]);_0x39519a[_0xbb69('0x39')]=_['intersection'](_0x39519a[_0xbb69('0x36')],_0x39519a[_0xbb69('0x37')]);_0x211c84[_0xbb69('0x3c')]=_[_0xbb69('0x3a')](_0x39519a[_0xbb69('0x36')],qs['fields'](_0x3359c2[_0xbb69('0x37')][_0xbb69('0x3b')]));_0x211c84['attributes']=_0x211c84[_0xbb69('0x3c')][_0xbb69('0x3d')]?_0x211c84[_0xbb69('0x3c')]:_0x39519a[_0xbb69('0x36')];if(_0x3359c2[_0xbb69('0x37')][_0xbb69('0x46')]){_0x211c84[_0xbb69('0x47')]=[{'all':!![]}];}_0x211c84=_[_0xbb69('0x45')]({},_0x211c84,_0x3359c2[_0xbb69('0x4b')]);return db[_0xbb69('0x31')]['find'](_0x211c84)[_0xbb69('0x2a')](handleEntityNotFound(_0x218c1b,null))['then'](respondWithResult(_0x218c1b,null))['catch'](handleError(_0x218c1b,null));};exports['create']=function(_0x2db0e3,_0x552ccb){return db[_0xbb69('0x31')]['create'](_0x2db0e3[_0xbb69('0x4c')],{})[_0xbb69('0x2a')](respondWithResult(_0x552ccb,0xc9))[_0xbb69('0x4d')](handleError(_0x552ccb,null));};exports[_0xbb69('0x29')]=function(_0x4381e5,_0xdcd7fa){if(_0x4381e5[_0xbb69('0x4c')]['id']){delete _0x4381e5['body']['id'];}return db[_0xbb69('0x31')][_0xbb69('0x4e')]({'where':{'id':_0x4381e5[_0xbb69('0x4a')]['id']}})[_0xbb69('0x2a')](handleEntityNotFound(_0xdcd7fa,null))[_0xbb69('0x2a')](saveUpdates(_0x4381e5['body'],null))['then'](respondWithResult(_0xdcd7fa,null))[_0xbb69('0x4d')](handleError(_0xdcd7fa,null));};exports[_0xbb69('0x2b')]=function(_0x772f28,_0x4a4bcf){return db[_0xbb69('0x31')][_0xbb69('0x4e')]({'where':{'id':_0x772f28[_0xbb69('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a4bcf,null))[_0xbb69('0x2a')](removeEntity(_0x4a4bcf,null))[_0xbb69('0x4d')](handleError(_0x4a4bcf,null));};exports[_0xbb69('0x4f')]=function(_0x544714,_0x440c2e){return db[_0xbb69('0x31')][_0xbb69('0x4f')]()[_0xbb69('0x2a')](respondWithResult(_0x440c2e,null))[_0xbb69('0x4d')](handleError(_0x440c2e,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 1ae33f6..39a95a8 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44b7=['./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x44b7,0xa0));var _0x744b=function(_0x4c141e,_0x5b2d5e){_0x4c141e=_0x4c141e-0x0;var _0x5b4532=_0x44b7[_0x4c141e];return _0x5b4532;};'use strict';var _=require(_0x744b('0x0'));var util=require('util');var logger=require(_0x744b('0x1'))(_0x744b('0x2'));var moment=require(_0x744b('0x3'));var BPromise=require('bluebird');var rp=require(_0x744b('0x4'));var fs=require('fs');var path=require(_0x744b('0x5'));var rimraf=require(_0x744b('0x6'));var config=require(_0x744b('0x7'));var attributes=require(_0x744b('0x8'));module[_0x744b('0x9')]=function(_0x2d2017,_0x2c3cce){return _0x2d2017['define'](_0x744b('0xa'),attributes,{'tableName':_0x744b('0xb'),'paranoid':![],'indexes':[{'name':_0x744b('0xc'),'fields':['sectionId',_0x744b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39db=['../../config/environment','exports','UserProfileSection','compositeIndex','sectionId','lodash','api','moment','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x39db,0x139));var _0xb39d=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0x39db[_0x2731f0];return _0x36a180;};'use strict';var _=require(_0xb39d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb39d('0x1'));var moment=require(_0xb39d('0x2'));var BPromise=require('bluebird');var rp=require(_0xb39d('0x3'));var fs=require('fs');var path=require(_0xb39d('0x4'));var rimraf=require(_0xb39d('0x5'));var config=require(_0xb39d('0x6'));var attributes=require('./userProfileSection.attributes');module[_0xb39d('0x7')]=function(_0x1d184a,_0x6c95f9){return _0x1d184a['define'](_0xb39d('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xb39d('0x9'),'fields':[_0xb39d('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a986a19..1512b8a 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72ea=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x5329c6,_0x356185){var _0x32eb60=function(_0x43ec1a){while(--_0x43ec1a){_0x5329c6['push'](_0x5329c6['shift']());}};_0x32eb60(++_0x356185);}(_0x72ea,0x1e8));var _0xa72e=function(_0x4d9ddb,_0x5d6d9f){_0x4d9ddb=_0x4d9ddb-0x0;var _0x39b903=_0x72ea[_0x4d9ddb];return _0x39b903;};'use strict';var _=require(_0xa72e('0x0'));var util=require(_0xa72e('0x1'));var moment=require(_0xa72e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa72e('0x3'));var fs=require('fs');var Redis=require(_0xa72e('0x4'));var db=require(_0xa72e('0x5'))['db'];var utils=require(_0xa72e('0x6'));var logger=require(_0xa72e('0x7'))(_0xa72e('0x8'));var config=require(_0xa72e('0x9'));var jayson=require(_0xa72e('0xa'));var client=jayson[_0xa72e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c65a,_0x902715,_0x1b454c){return new BPromise(function(_0x372dcb,_0x459c88){return client[_0xa72e('0xc')](_0x39c65a,_0x1b454c)[_0xa72e('0xd')](function(_0x496e38){logger[_0xa72e('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x902715,_0xa72e('0xf'));logger[_0xa72e('0x10')](_0xa72e('0x11'),_0x902715,_0xa72e('0xf'),JSON[_0xa72e('0x12')](_0x496e38));if(_0x496e38[_0xa72e('0x13')]){if(_0x496e38[_0xa72e('0x13')][_0xa72e('0x14')]===0x1f4){logger[_0xa72e('0x13')](_0xa72e('0x15'),_0x902715,_0x496e38[_0xa72e('0x13')][_0xa72e('0x16')]);return _0x459c88(_0x496e38[_0xa72e('0x13')]['message']);}logger['error'](_0xa72e('0x15'),_0x902715,_0x496e38[_0xa72e('0x13')][_0xa72e('0x16')]);return _0x372dcb(_0x496e38[_0xa72e('0x13')]['message']);}else{logger['info'](_0xa72e('0x15'),_0x902715,_0xa72e('0xf'));_0x372dcb(_0x496e38[_0xa72e('0x17')][_0xa72e('0x16')]);}})['catch'](function(_0x4726e4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x902715,_0x4726e4);_0x459c88(_0x4726e4);});});} \ No newline at end of file +var _0x6305=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util'];(function(_0x4be18a,_0x326e6d){var _0x5042d4=function(_0x3f6157){while(--_0x3f6157){_0x4be18a['push'](_0x4be18a['shift']());}};_0x5042d4(++_0x326e6d);}(_0x6305,0xad));var _0x5630=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6305[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5630('0x0'));var util=require(_0x5630('0x1'));var moment=require(_0x5630('0x2'));var BPromise=require(_0x5630('0x3'));var rs=require(_0x5630('0x4'));var fs=require('fs');var Redis=require(_0x5630('0x5'));var db=require(_0x5630('0x6'))['db'];var utils=require(_0x5630('0x7'));var logger=require(_0x5630('0x8'))(_0x5630('0x9'));var config=require(_0x5630('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5630('0xb')][_0x5630('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x370805,_0x33576d,_0x51c723){return new BPromise(function(_0x1f1497,_0x20b2db){return client[_0x5630('0xd')](_0x370805,_0x51c723)[_0x5630('0xe')](function(_0x2fa06c){logger['info'](_0x5630('0xf'),_0x33576d,_0x5630('0x10'));logger[_0x5630('0x11')](_0x5630('0x12'),_0x33576d,_0x5630('0x10'),JSON['stringify'](_0x2fa06c));if(_0x2fa06c[_0x5630('0x13')]){if(_0x2fa06c[_0x5630('0x13')][_0x5630('0x14')]===0x1f4){logger[_0x5630('0x13')](_0x5630('0xf'),_0x33576d,_0x2fa06c[_0x5630('0x13')][_0x5630('0x15')]);return _0x20b2db(_0x2fa06c[_0x5630('0x13')][_0x5630('0x15')]);}logger[_0x5630('0x13')](_0x5630('0xf'),_0x33576d,_0x2fa06c[_0x5630('0x13')][_0x5630('0x15')]);return _0x1f1497(_0x2fa06c['error'][_0x5630('0x15')]);}else{logger[_0x5630('0x16')](_0x5630('0xf'),_0x33576d,'request\x20sent');_0x1f1497(_0x2fa06c[_0x5630('0x17')][_0x5630('0x15')]);}})[_0x5630('0x18')](function(_0x262ad8){logger[_0x5630('0x13')](_0x5630('0xf'),_0x33576d,_0x262ad8);_0x20b2db(_0x262ad8);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index da5e81c..115b3ac 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x311d44,_0x3ebfd){var _0x1e5d8d=function(_0x57988a){while(--_0x57988a){_0x311d44['push'](_0x311d44['shift']());}};_0x1e5d8d(++_0x3ebfd);}(_0xe706,0xa3));var _0x6e70=function(_0x48e921,_0x20cf98){_0x48e921=_0x48e921-0x0;var _0x4986fe=_0xe706[_0x48e921];return _0x4986fe;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x222884,_0x1e94f4){var _0x5560a3=function(_0x3dbd17){while(--_0x3dbd17){_0x222884['push'](_0x222884['shift']());}};_0x5560a3(++_0x1e94f4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0xcb91[_0x443494];return _0x4a6794;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 235c70b..9aa2e9d 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7749=['sequelize','exports','INTEGER'];(function(_0x3ff7bc,_0x575e1e){var _0x5a1082=function(_0xd8a735){while(--_0xd8a735){_0x3ff7bc['push'](_0x3ff7bc['shift']());}};_0x5a1082(++_0x575e1e);}(_0x7749,0xf6));var _0x9774=function(_0x1e5c71,_0x476297){_0x1e5c71=_0x1e5c71-0x0;var _0x1716aa=_0x7749[_0x1e5c71];return _0x1716aa;};'use strict';var Sequelize=require(_0x9774('0x0'));module[_0x9774('0x1')]={'penalty':{'type':Sequelize[_0x9774('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x64e1=['INTEGER','sequelize','exports'];(function(_0x55e026,_0x3b61d1){var _0x3f495a=function(_0x28868b){while(--_0x28868b){_0x55e026['push'](_0x55e026['shift']());}};_0x3f495a(++_0x3b61d1);}(_0x64e1,0x9a));var _0x164e=function(_0x4ac41d,_0x797f24){_0x4ac41d=_0x4ac41d-0x0;var _0x5b9770=_0x64e1[_0x4ac41d];return _0x5b9770;};'use strict';var Sequelize=require(_0x164e('0x0'));module[_0x164e('0x1')]={'penalty':{'type':Sequelize[_0x164e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index a95bb8f..8d437c6 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd481=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd481,0x1e4));var _0x1d48=function(_0x4d18ce,_0x5867df){_0x4d18ce=_0x4d18ce-0x0;var _0x907ce4=_0xd481[_0x4d18ce];return _0x907ce4;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var logger=require(_0x1d48('0x1'))(_0x1d48('0x2'));var moment=require('moment');var BPromise=require(_0x1d48('0x3'));var rp=require(_0x1d48('0x4'));var fs=require('fs');var path=require(_0x1d48('0x5'));var rimraf=require('rimraf');var config=require(_0x1d48('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x1d48('0x7')]=function(_0x2a4830,_0x5a0c28){return _0x2a4830[_0x1d48('0x8')](_0x1d48('0x9'),attributes,{'tableName':_0x1d48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b84=['exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0xa3db6c,_0x1d9fd3){var _0x2366f6=function(_0x30900b){while(--_0x30900b){_0xa3db6c['push'](_0xa3db6c['shift']());}};_0x2366f6(++_0x1d9fd3);}(_0x7b84,0x17c));var _0x47b8=function(_0x1f95c4,_0x5bce27){_0x1f95c4=_0x1f95c4-0x0;var _0x47ca71=_0x7b84[_0x1f95c4];return _0x47ca71;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var BPromise=require(_0x47b8('0x5'));var rp=require(_0x47b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var attributes=require(_0x47b8('0x9'));module[_0x47b8('0xa')]=function(_0x2e6853,_0xafe88a){return _0x2e6853['define'](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 754a1e8..366f2bc 100644 --- a/server/api/userSmsQueue/userSmsQueue.rpc.js +++ b/server/api/userSmsQueue/userSmsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68ba=['client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x40df63,_0x2628bb){var _0x150f42=function(_0x10ff92){while(--_0x10ff92){_0x40df63['push'](_0x40df63['shift']());}};_0x150f42(++_0x2628bb);}(_0x68ba,0xce));var _0xa68b=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x68ba[_0x90a39a];return _0x2b62f7;};'use strict';var _=require('lodash');var util=require(_0xa68b('0x0'));var moment=require(_0xa68b('0x1'));var BPromise=require(_0xa68b('0x2'));var rs=require(_0xa68b('0x3'));var fs=require('fs');var Redis=require(_0xa68b('0x4'));var db=require(_0xa68b('0x5'))['db'];var utils=require(_0xa68b('0x6'));var logger=require(_0xa68b('0x7'))('rpc');var config=require(_0xa68b('0x8'));var jayson=require(_0xa68b('0x9'));var client=jayson[_0xa68b('0xa')][_0xa68b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24a57b,_0x1bbdc5,_0xc62d8f){return new BPromise(function(_0x42a243,_0x132ffa){return client[_0xa68b('0xc')](_0x24a57b,_0xc62d8f)[_0xa68b('0xd')](function(_0x32ec82){logger[_0xa68b('0xe')](_0xa68b('0xf'),_0x1bbdc5,'request\x20sent');logger[_0xa68b('0x10')](_0xa68b('0x11'),_0x1bbdc5,_0xa68b('0x12'),JSON['stringify'](_0x32ec82));if(_0x32ec82[_0xa68b('0x13')]){if(_0x32ec82[_0xa68b('0x13')][_0xa68b('0x14')]===0x1f4){logger['error'](_0xa68b('0xf'),_0x1bbdc5,_0x32ec82['error'][_0xa68b('0x15')]);return _0x132ffa(_0x32ec82[_0xa68b('0x13')]['message']);}logger[_0xa68b('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x1bbdc5,_0x32ec82[_0xa68b('0x13')][_0xa68b('0x15')]);return _0x42a243(_0x32ec82[_0xa68b('0x13')][_0xa68b('0x15')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x1bbdc5,_0xa68b('0x12'));_0x42a243(_0x32ec82[_0xa68b('0x16')][_0xa68b('0x15')]);}})[_0xa68b('0x17')](function(_0x18ee1a){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x1bbdc5,_0x18ee1a);_0x132ffa(_0x18ee1a);});});} \ No newline at end of file +var _0xe838=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util'];(function(_0x4f7d11,_0x5d20f8){var _0x367467=function(_0xd3bad5){while(--_0xd3bad5){_0x4f7d11['push'](_0x4f7d11['shift']());}};_0x367467(++_0x5d20f8);}(_0xe838,0x6c));var _0x8e83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe838[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8e83('0x0'));var util=require(_0x8e83('0x1'));var moment=require(_0x8e83('0x2'));var BPromise=require(_0x8e83('0x3'));var rs=require(_0x8e83('0x4'));var fs=require('fs');var Redis=require(_0x8e83('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8e83('0x6'))(_0x8e83('0x7'));var config=require(_0x8e83('0x8'));var jayson=require(_0x8e83('0x9'));var client=jayson[_0x8e83('0xa')][_0x8e83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16a98a,_0x25a8fa,_0x4e23b5){return new BPromise(function(_0x21379c,_0x1e64d9){return client[_0x8e83('0xc')](_0x16a98a,_0x4e23b5)[_0x8e83('0xd')](function(_0x4da4f9){logger['info'](_0x8e83('0xe'),_0x25a8fa,_0x8e83('0xf'));logger[_0x8e83('0x10')](_0x8e83('0x11'),_0x25a8fa,_0x8e83('0xf'),JSON['stringify'](_0x4da4f9));if(_0x4da4f9[_0x8e83('0x12')]){if(_0x4da4f9[_0x8e83('0x12')][_0x8e83('0x13')]===0x1f4){logger[_0x8e83('0x12')](_0x8e83('0xe'),_0x25a8fa,_0x4da4f9[_0x8e83('0x12')][_0x8e83('0x14')]);return _0x1e64d9(_0x4da4f9[_0x8e83('0x12')]['message']);}logger[_0x8e83('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x25a8fa,_0x4da4f9[_0x8e83('0x12')]['message']);return _0x21379c(_0x4da4f9[_0x8e83('0x12')][_0x8e83('0x14')]);}else{logger[_0x8e83('0x15')](_0x8e83('0xe'),_0x25a8fa,'request\x20sent');_0x21379c(_0x4da4f9['result'][_0x8e83('0x14')]);}})['catch'](function(_0x49dc93){logger[_0x8e83('0x12')](_0x8e83('0xe'),_0x25a8fa,_0x49dc93);_0x1e64d9(_0x49dc93);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 46d46ae..35e2964 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38d6=['INTEGER','sequelize','exports'];(function(_0x526cb4,_0x38f661){var _0x239e92=function(_0x3fc4ca){while(--_0x3fc4ca){_0x526cb4['push'](_0x526cb4['shift']());}};_0x239e92(++_0x38f661);}(_0x38d6,0x79));var _0x638d=function(_0x4a9d87,_0x2cc20f){_0x4a9d87=_0x4a9d87-0x0;var _0x1ad978=_0x38d6[_0x4a9d87];return _0x1ad978;};'use strict';var Sequelize=require(_0x638d('0x0'));module[_0x638d('0x1')]={'UserId':{'type':Sequelize[_0x638d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x638d('0x2')]}}; \ No newline at end of file +var _0xd147=['INTEGER','sequelize','exports'];(function(_0x3e277f,_0x25aa94){var _0x50d76d=function(_0x3966eb){while(--_0x3966eb){_0x3e277f['push'](_0x3e277f['shift']());}};_0x50d76d(++_0x25aa94);}(_0xd147,0x79));var _0x7d14=function(_0x38731b,_0x5b9af3){_0x38731b=_0x38731b-0x0;var _0x4ad732=_0xd147[_0x38731b];return _0x4ad732;};'use strict';var Sequelize=require(_0x7d14('0x0'));module[_0x7d14('0x1')]={'UserId':{'type':Sequelize[_0x7d14('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index c9a1db2..c0e918c 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x270f99,_0x25cbbd){var _0x2a7a09=function(_0x325048){while(--_0x325048){_0x270f99['push'](_0x270f99['shift']());}};_0x2a7a09(++_0x25cbbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x16555b,_0x1153a8){var _0x5b1d2e=function(_0x5d0aca){while(--_0x5d0aca){_0x16555b['push'](_0x16555b['shift']());}};_0x5b1d2e(++_0x1153a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9f4a5fc..292b8ab 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x302c01,_0x5e0545){var _0x1007e6=function(_0x37d85b){while(--_0x37d85b){_0x302c01['push'](_0x302c01['shift']());}};_0x1007e6(++_0x5e0545);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x48c710,_0x5d995a){var _0x183b97=function(_0xaa86dc){while(--_0xaa86dc){_0x48c710['push'](_0x48c710['shift']());}};_0x183b97(++_0x5d995a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xcb91[_0x2b5513];return _0x578fd2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2e23a19..5e092f6 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ac8=['exports','INTEGER','sequelize'];(function(_0x26dc07,_0x1e744e){var _0x354058=function(_0xb0d3b1){while(--_0xb0d3b1){_0x26dc07['push'](_0x26dc07['shift']());}};_0x354058(++_0x1e744e);}(_0x0ac8,0x191));var _0x80ac=function(_0x60dad1,_0x44a161){_0x60dad1=_0x60dad1-0x0;var _0x512282=_0x0ac8[_0x60dad1];return _0x512282;};'use strict';var Sequelize=require(_0x80ac('0x0'));module[_0x80ac('0x1')]={'penalty':{'type':Sequelize[_0x80ac('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x09da=['exports','INTEGER'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x09da,0xf4));var _0xa09d=function(_0x1a39f9,_0xb12457){_0x1a39f9=_0x1a39f9-0x0;var _0x446014=_0x09da[_0x1a39f9];return _0x446014;};'use strict';var Sequelize=require('sequelize');module[_0xa09d('0x0')]={'penalty':{'type':Sequelize[_0xa09d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index bcd8114..b1fa875 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.model.js +++ b/server/api/userVoiceQueue/userVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1aab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x41cd75,_0xd4bae3){var _0xdb33f3=function(_0x1bfb4a){while(--_0x1bfb4a){_0x41cd75['push'](_0x41cd75['shift']());}};_0xdb33f3(++_0xd4bae3);}(_0x1aab,0xd0));var _0xb1aa=function(_0x20d39d,_0x5e8fd4){_0x20d39d=_0x20d39d-0x0;var _0xf75618=_0x1aab[_0x20d39d];return _0xf75618;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var logger=require(_0xb1aa('0x2'))(_0xb1aa('0x3'));var moment=require(_0xb1aa('0x4'));var BPromise=require(_0xb1aa('0x5'));var rp=require(_0xb1aa('0x6'));var fs=require('fs');var path=require(_0xb1aa('0x7'));var rimraf=require('rimraf');var config=require(_0xb1aa('0x8'));var attributes=require(_0xb1aa('0x9'));module['exports']=function(_0x1f0487,_0x5a82d8){return _0x1f0487[_0xb1aa('0xa')](_0xb1aa('0xb'),attributes,{'tableName':_0xb1aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcb1=['UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x451999,_0x1b3908){var _0x1b696e=function(_0x259ab1){while(--_0x259ab1){_0x451999['push'](_0x451999['shift']());}};_0x1b696e(++_0x1b3908);}(_0xdcb1,0x106));var _0x1dcb=function(_0x2aef56,_0x271ae4){_0x2aef56=_0x2aef56-0x0;var _0xf5a149=_0xdcb1[_0x2aef56];return _0xf5a149;};'use strict';var _=require(_0x1dcb('0x0'));var util=require(_0x1dcb('0x1'));var logger=require(_0x1dcb('0x2'))('api');var moment=require(_0x1dcb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1dcb('0x4'));var rimraf=require(_0x1dcb('0x5'));var config=require(_0x1dcb('0x6'));var attributes=require(_0x1dcb('0x7'));module['exports']=function(_0x5a380e,_0x5eeb58){return _0x5a380e['define'](_0x1dcb('0x8'),attributes,{'tableName':_0x1dcb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 9dc0823..211a29e 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.rpc.js +++ b/server/api/userVoiceQueue/userVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda53=['then','info','request\x20sent','stringify','code','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','request'];(function(_0x788c48,_0x5c0e5e){var _0x299c14=function(_0x6be4c){while(--_0x6be4c){_0x788c48['push'](_0x788c48['shift']());}};_0x299c14(++_0x5c0e5e);}(_0xda53,0x12a));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3da5('0x0'));var util=require(_0x3da5('0x1'));var moment=require('moment');var BPromise=require(_0x3da5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3da5('0x3'));var db=require(_0x3da5('0x4'))['db'];var utils=require(_0x3da5('0x5'));var logger=require(_0x3da5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x280fb7,_0x5a2331,_0x271f48){return new BPromise(function(_0x524902,_0x2e3b5e){return client[_0x3da5('0x7')](_0x280fb7,_0x271f48)[_0x3da5('0x8')](function(_0x39dff8){logger[_0x3da5('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x5a2331,_0x3da5('0xa'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5a2331,_0x3da5('0xa'),JSON[_0x3da5('0xb')](_0x39dff8));if(_0x39dff8['error']){if(_0x39dff8['error'][_0x3da5('0xc')]===0x1f4){logger[_0x3da5('0xd')](_0x3da5('0xe'),_0x5a2331,_0x39dff8[_0x3da5('0xd')][_0x3da5('0xf')]);return _0x2e3b5e(_0x39dff8[_0x3da5('0xd')][_0x3da5('0xf')]);}logger[_0x3da5('0xd')](_0x3da5('0xe'),_0x5a2331,_0x39dff8[_0x3da5('0xd')][_0x3da5('0xf')]);return _0x524902(_0x39dff8[_0x3da5('0xd')][_0x3da5('0xf')]);}else{logger[_0x3da5('0x9')](_0x3da5('0xe'),_0x5a2331,_0x3da5('0xa'));_0x524902(_0x39dff8[_0x3da5('0x10')][_0x3da5('0xf')]);}})[_0x3da5('0x11')](function(_0x3fe40a){logger[_0x3da5('0xd')](_0x3da5('0xe'),_0x5a2331,_0x3fe40a);_0x2e3b5e(_0x3fe40a);});});} \ No newline at end of file +var _0xf7d9=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xf7d9,0x1bf));var _0x9f7d=function(_0x3ac7e9,_0x12a9bf){_0x3ac7e9=_0x3ac7e9-0x0;var _0x1c3dcd=_0xf7d9[_0x3ac7e9];return _0x1c3dcd;};'use strict';var _=require(_0x9f7d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9f7d('0x1'));var rs=require(_0x9f7d('0x2'));var fs=require('fs');var Redis=require(_0x9f7d('0x3'));var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))('rpc');var config=require(_0x9f7d('0x6'));var jayson=require(_0x9f7d('0x7'));var client=jayson['client'][_0x9f7d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x538c31,_0x386169,_0xece48){return new BPromise(function(_0x4aa8b9,_0x308f3d){return client[_0x9f7d('0x9')](_0x538c31,_0xece48)[_0x9f7d('0xa')](function(_0x1ef162){logger[_0x9f7d('0xb')](_0x9f7d('0xc'),_0x386169,_0x9f7d('0xd'));logger[_0x9f7d('0xe')](_0x9f7d('0xf'),_0x386169,_0x9f7d('0xd'),JSON[_0x9f7d('0x10')](_0x1ef162));if(_0x1ef162[_0x9f7d('0x11')]){if(_0x1ef162[_0x9f7d('0x11')]['code']===0x1f4){logger[_0x9f7d('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x386169,_0x1ef162[_0x9f7d('0x11')][_0x9f7d('0x12')]);return _0x308f3d(_0x1ef162[_0x9f7d('0x11')][_0x9f7d('0x12')]);}logger[_0x9f7d('0x11')](_0x9f7d('0xc'),_0x386169,_0x1ef162[_0x9f7d('0x11')][_0x9f7d('0x12')]);return _0x4aa8b9(_0x1ef162[_0x9f7d('0x11')][_0x9f7d('0x12')]);}else{logger['info'](_0x9f7d('0xc'),_0x386169,_0x9f7d('0xd'));_0x4aa8b9(_0x1ef162['result']['message']);}})[_0x9f7d('0x13')](function(_0x301fad){logger[_0x9f7d('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x386169,_0x301fad);_0x308f3d(_0x301fad);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index fa446c8..d75beb2 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x460670,_0x21f954){var _0x510fef=function(_0x1f3e7c){while(--_0x1f3e7c){_0x460670['push'](_0x460670['shift']());}};_0x510fef(++_0x21f954);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb7bd46,_0x941298){var _0x2abe45=function(_0x2bdecc){while(--_0x2bdecc){_0xb7bd46['push'](_0xb7bd46['shift']());}};_0x2abe45(++_0x941298);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 60e5482..0037d41 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x327d=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x378d7c,_0x5c80b7){var _0x56a059=function(_0x1765cf){while(--_0x1765cf){_0x378d7c['push'](_0x378d7c['shift']());}};_0x56a059(++_0x5c80b7);}(_0x327d,0x128));var _0xd327=function(_0x54655f,_0x8ca841){_0x54655f=_0x54655f-0x0;var _0x4887b4=_0x327d[_0x54655f];return _0x4887b4;};'use strict';var Sequelize=require('sequelize');module[_0xd327('0x0')]={'uniqueid':{'type':Sequelize[_0xd327('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd327('0x2')},'membername':{'type':Sequelize[_0xd327('0x3')],'allowNull':![],'comment':_0xd327('0x2')},'UserId':{'type':Sequelize[_0xd327('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd327('0x4'),'comment':_0xd327('0x2')},'VoiceQueueId':{'type':Sequelize[_0xd327('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd327('0x4'),'comment':_0xd327('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xd327('0x2')},'paused':{'type':Sequelize[_0xd327('0x1')](0xb),'defaultValue':0x0,'comment':_0xd327('0x2')}}; \ No newline at end of file +var _0x183e=['STRING','queue_interface','INTEGER','Required\x20by\x20Asterisk'];(function(_0x755c49,_0x2698bd){var _0x17347e=function(_0x2775d3){while(--_0x2775d3){_0x755c49['push'](_0x755c49['shift']());}};_0x17347e(++_0x2698bd);}(_0x183e,0x17e));var _0xe183=function(_0x427527,_0xee8a7c){_0x427527=_0x427527-0x0;var _0x134716=_0x183e[_0x427527];return _0x134716;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe183('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe183('0x1')},'membername':{'type':Sequelize[_0xe183('0x2')],'allowNull':![],'comment':_0xe183('0x1')},'UserId':{'type':Sequelize[_0xe183('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe183('0x2')],'allowNull':![],'unique':_0xe183('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xe183('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0xe183('0x2')],'allowNull':![],'unique':_0xe183('0x3'),'comment':_0xe183('0x1')},'penalty':{'type':Sequelize[_0xe183('0x0')](0xb),'defaultValue':0x0,'comment':_0xe183('0x1')},'paused':{'type':Sequelize[_0xe183('0x0')](0xb),'defaultValue':0x0,'comment':_0xe183('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f6ad1b4..5e5d628 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50c9=['hook','events','UserVoiceQueueRt','setMaxListeners','remove','hasOwnProperty'];(function(_0x234983,_0xd66c9b){var _0x1c465e=function(_0x1d1b65){while(--_0x1d1b65){_0x234983['push'](_0x234983['shift']());}};_0x1c465e(++_0xd66c9b);}(_0x50c9,0xeb));var _0x950c=function(_0x46920d,_0x211df9){_0x46920d=_0x46920d-0x0;var _0x4f9815=_0x50c9[_0x46920d];return _0x4f9815;};'use strict';var EventEmitter=require(_0x950c('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x950c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x950c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x950c('0x3')};function emitEvent(_0x4b3a99){return function(_0x419fe6,_0x29bd9d,_0x246cbe){UserVoiceQueueRtEvents['emit'](_0x4b3a99+':'+_0x419fe6['id'],_0x419fe6);UserVoiceQueueRtEvents['emit'](_0x4b3a99,_0x419fe6);_0x246cbe(null);};}for(var e in events){if(events[_0x950c('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x950c('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x303a=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4b3c7e,_0x58aef9){var _0x3015af=function(_0x12e3f7){while(--_0x12e3f7){_0x4b3c7e['push'](_0x4b3c7e['shift']());}};_0x3015af(++_0x58aef9);}(_0x303a,0x1d0));var _0xa303=function(_0x83cc7b,_0x337a6b){_0x83cc7b=_0x83cc7b-0x0;var _0x77e5ab=_0x303a[_0x83cc7b];return _0x77e5ab;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xa303('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa303('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa303('0x2'),'afterDestroy':_0xa303('0x3')};function emitEvent(_0x3f3437){return function(_0x10bbf7,_0x5d3d6c,_0x4de017){UserVoiceQueueRtEvents[_0xa303('0x4')](_0x3f3437+':'+_0x10bbf7['id'],_0x10bbf7);UserVoiceQueueRtEvents[_0xa303('0x4')](_0x3f3437,_0x10bbf7);_0x4de017(null);};}for(var e in events){if(events[_0xa303('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xa303('0x6')](e,emitEvent(event));}}module[_0xa303('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index e72680e..ec826c1 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8752=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x50a062,_0x20fe13){var _0x14be82=function(_0x40e984){while(--_0x40e984){_0x50a062['push'](_0x50a062['shift']());}};_0x14be82(++_0x20fe13);}(_0x8752,0x72));var _0x2875=function(_0x1d2db5,_0x155608){_0x1d2db5=_0x1d2db5-0x0;var _0x32939a=_0x8752[_0x1d2db5];return _0x32939a;};'use strict';var _=require(_0x2875('0x0'));var util=require('util');var logger=require(_0x2875('0x1'))(_0x2875('0x2'));var moment=require(_0x2875('0x3'));var BPromise=require('bluebird');var rp=require(_0x2875('0x4'));var fs=require('fs');var path=require(_0x2875('0x5'));var rimraf=require('rimraf');var config=require(_0x2875('0x6'));var attributes=require(_0x2875('0x7'));module[_0x2875('0x8')]=function(_0x3c4eed,_0x5895ff){return _0x3c4eed[_0x2875('0x9')](_0x2875('0xa'),attributes,{'tableName':_0x2875('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac97=['exports','define','UserVoiceQueueRt','util','moment','rimraf'];(function(_0x49c359,_0x37849d){var _0x2ae746=function(_0x55cf3d){while(--_0x55cf3d){_0x49c359['push'](_0x49c359['shift']());}};_0x2ae746(++_0x37849d);}(_0xac97,0xa5));var _0x7ac9=function(_0x55054d,_0x35adc6){_0x55054d=_0x55054d-0x0;var _0x5324fa=_0xac97[_0x55054d];return _0x5324fa;};'use strict';var _=require('lodash');var util=require(_0x7ac9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7ac9('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7ac9('0x2'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x7ac9('0x3')]=function(_0xbda165,_0x4647b5){return _0xbda165[_0x7ac9('0x4')](_0x7ac9('0x5'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index b2d9197..84c8d60 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8df8=['literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT'];(function(_0x51a6af,_0x219d20){var _0x190e2c=function(_0x1f391b){while(--_0x1f391b){_0x51a6af['push'](_0x51a6af['shift']());}};_0x190e2c(++_0x219d20);}(_0x8df8,0x142));var _0x88df=function(_0x387ca0,_0x5c9b88){_0x387ca0=_0x387ca0-0x0;var _0x3257d3=_0x8df8[_0x387ca0];return _0x3257d3;};'use strict';var _=require(_0x88df('0x0'));var util=require(_0x88df('0x1'));var moment=require(_0x88df('0x2'));var BPromise=require(_0x88df('0x3'));var rs=require(_0x88df('0x4'));var fs=require('fs');var Redis=require(_0x88df('0x5'));var db=require(_0x88df('0x6'))['db'];var utils=require(_0x88df('0x7'));var logger=require(_0x88df('0x8'))(_0x88df('0x9'));var config=require(_0x88df('0xa'));var jayson=require(_0x88df('0xb'));var client=jayson[_0x88df('0xc')][_0x88df('0xd')]({'port':0x232a});config[_0x88df('0xe')]=_[_0x88df('0xf')](config[_0x88df('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88df('0xe')]));require(_0x88df('0x10'))[_0x88df('0x11')](socket);function respondWithRpcPromise(_0x560f7e,_0x1fb1f4,_0x4a5aaa){return new BPromise(function(_0x326251,_0xb92d12){return client[_0x88df('0x12')](_0x560f7e,_0x4a5aaa)[_0x88df('0x13')](function(_0x84e34f){logger[_0x88df('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1fb1f4,_0x88df('0x15'));logger[_0x88df('0x16')](_0x88df('0x17'),_0x1fb1f4,'request\x20sent',JSON[_0x88df('0x18')](_0x84e34f));if(_0x84e34f[_0x88df('0x19')]){if(_0x84e34f[_0x88df('0x19')][_0x88df('0x1a')]===0x1f4){logger[_0x88df('0x19')](_0x88df('0x1b'),_0x1fb1f4,_0x84e34f[_0x88df('0x19')]['message']);return _0xb92d12(_0x84e34f[_0x88df('0x19')][_0x88df('0x1c')]);}logger[_0x88df('0x19')](_0x88df('0x1b'),_0x1fb1f4,_0x84e34f[_0x88df('0x19')][_0x88df('0x1c')]);return _0x326251(_0x84e34f[_0x88df('0x19')][_0x88df('0x1c')]);}else{logger[_0x88df('0x14')](_0x88df('0x1b'),_0x1fb1f4,_0x88df('0x15'));_0x326251(_0x84e34f[_0x88df('0x1d')]['message']);}})[_0x88df('0x1e')](function(_0x2fee27){logger['error'](_0x88df('0x1b'),_0x1fb1f4,_0x2fee27);_0xb92d12(_0x2fee27);});});}exports[_0x88df('0x1f')]=function(_0x467811){var _0x11fb14=this;return new Promise(function(_0x42478a,_0x24cbb7){return db[_0x88df('0x20')][_0x88df('0x21')]({'raw':_0x467811['options']?_0x467811[_0x88df('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x467811[_0x88df('0x22')]?_0x467811[_0x88df('0x22')][_0x88df('0x23')]||null:null,'attributes':[[db[_0x88df('0x24')]['fn'](_0x88df('0x25'),db[_0x88df('0x24')]['fn']('IF',db[_0x88df('0x24')][_0x88df('0x26')](_0x88df('0x27')))),'outboundQueuePauses']]})[_0x88df('0x13')](function(_0x1e7097){logger[_0x88df('0x14')]('GetVoiceQueueRtPauses',_0x467811);logger[_0x88df('0x16')](_0x88df('0x1f'),_0x467811,JSON['stringify'](_0x1e7097));_0x42478a(_0x1e7097);})[_0x88df('0x1e')](function(_0x3bf214){logger[_0x88df('0x19')]('GetVoiceQueueRtPauses',_0x3bf214['message'],_0x467811);_0x24cbb7(_0x11fb14[_0x88df('0x19')](0x1f4,_0x3bf214[_0x88df('0x1c')]));});});}; \ No newline at end of file +var _0xd271=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5908b8,_0x544699){var _0xe24a76=function(_0x2bd33f){while(--_0x2bd33f){_0x5908b8['push'](_0x5908b8['shift']());}};_0xe24a76(++_0x544699);}(_0xd271,0x1a6));var _0x1d27=function(_0x3513fc,_0x46f835){_0x3513fc=_0x3513fc-0x0;var _0x4168f7=_0xd271[_0x3513fc];return _0x4168f7;};'use strict';var _=require(_0x1d27('0x0'));var util=require(_0x1d27('0x1'));var moment=require('moment');var BPromise=require(_0x1d27('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d27('0x3'));var db=require(_0x1d27('0x4'))['db'];var utils=require(_0x1d27('0x5'));var logger=require(_0x1d27('0x6'))(_0x1d27('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d27('0x8'));var client=jayson[_0x1d27('0x9')][_0x1d27('0xa')]({'port':0x232a});config[_0x1d27('0xb')]=_[_0x1d27('0xc')](config['redis'],{'host':_0x1d27('0xd'),'port':0x18eb});var socket=require(_0x1d27('0xe'))(new Redis(config[_0x1d27('0xb')]));require(_0x1d27('0xf'))[_0x1d27('0x10')](socket);function respondWithRpcPromise(_0x425cd1,_0xa70ec3,_0x314ae2){return new BPromise(function(_0x301ab0,_0x21ac0f){return client[_0x1d27('0x11')](_0x425cd1,_0x314ae2)[_0x1d27('0x12')](function(_0x24e7ad){logger[_0x1d27('0x13')](_0x1d27('0x14'),_0xa70ec3,_0x1d27('0x15'));logger[_0x1d27('0x16')](_0x1d27('0x17'),_0xa70ec3,'request\x20sent',JSON[_0x1d27('0x18')](_0x24e7ad));if(_0x24e7ad[_0x1d27('0x19')]){if(_0x24e7ad[_0x1d27('0x19')][_0x1d27('0x1a')]===0x1f4){logger[_0x1d27('0x19')](_0x1d27('0x14'),_0xa70ec3,_0x24e7ad[_0x1d27('0x19')][_0x1d27('0x1b')]);return _0x21ac0f(_0x24e7ad[_0x1d27('0x19')][_0x1d27('0x1b')]);}logger[_0x1d27('0x19')](_0x1d27('0x14'),_0xa70ec3,_0x24e7ad['error'][_0x1d27('0x1b')]);return _0x301ab0(_0x24e7ad[_0x1d27('0x19')][_0x1d27('0x1b')]);}else{logger[_0x1d27('0x13')](_0x1d27('0x14'),_0xa70ec3,'request\x20sent');_0x301ab0(_0x24e7ad['result']['message']);}})['catch'](function(_0x46371c){logger[_0x1d27('0x19')](_0x1d27('0x14'),_0xa70ec3,_0x46371c);_0x21ac0f(_0x46371c);});});}exports[_0x1d27('0x1c')]=function(_0x413d78){var _0x5c7c51=this;return new Promise(function(_0x18bfef,_0x2c8810){return db['UserVoiceQueueRt'][_0x1d27('0x1d')]({'raw':_0x413d78[_0x1d27('0x1e')]?_0x413d78[_0x1d27('0x1e')][_0x1d27('0x1f')]===undefined?!![]:![]:!![],'where':_0x413d78[_0x1d27('0x1e')]?_0x413d78[_0x1d27('0x1e')][_0x1d27('0x20')]||null:null,'attributes':[[db[_0x1d27('0x21')]['fn'](_0x1d27('0x22'),db['sequelize']['fn']('IF',db[_0x1d27('0x21')][_0x1d27('0x23')](_0x1d27('0x24')))),_0x1d27('0x25')]]})[_0x1d27('0x12')](function(_0x37813c){logger[_0x1d27('0x13')]('GetVoiceQueueRtPauses',_0x413d78);logger[_0x1d27('0x16')]('GetVoiceQueueRtPauses',_0x413d78,JSON[_0x1d27('0x18')](_0x37813c));_0x18bfef(_0x37813c);})[_0x1d27('0x26')](function(_0x194a6e){logger[_0x1d27('0x19')]('GetVoiceQueueRtPauses',_0x194a6e[_0x1d27('0x1b')],_0x413d78);_0x2c8810(_0x5c7c51['error'](0x1f4,_0x194a6e[_0x1d27('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e865a6a..91597cb 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0a=['remove','update','emit','removeListener','length','./userVoiceQueueRt.events'];(function(_0x177b37,_0xd9c77e){var _0x325e7f=function(_0x1cc7ad){while(--_0x1cc7ad){_0x177b37['push'](_0x177b37['shift']());}};_0x325e7f(++_0xd9c77e);}(_0x8d0a,0x65));var _0xa8d0=function(_0x20b837,_0x225a91){_0x20b837=_0x20b837-0x0;var _0x20612b=_0x8d0a[_0x20b837];return _0x20612b;};'use strict';var UserVoiceQueueRtEvents=require(_0xa8d0('0x0'));var events=['save',_0xa8d0('0x1'),_0xa8d0('0x2')];function createListener(_0x1e83ea,_0x10995c){return function(_0x6ec9e7){_0x10995c[_0xa8d0('0x3')](_0x1e83ea,_0x6ec9e7);};}function removeListener(_0x528287,_0x202833){return function(){UserVoiceQueueRtEvents[_0xa8d0('0x4')](_0x528287,_0x202833);};}exports['register']=function(_0x1cac4f){for(var _0x212aaf=0x0,_0x1f95a7=events[_0xa8d0('0x5')];_0x212aaf<_0x1f95a7;_0x212aaf++){var _0x3ee6b4=events[_0x212aaf];var _0x55ffc0=createListener('userVoiceQueueRt:'+_0x3ee6b4,_0x1cac4f);UserVoiceQueueRtEvents['on'](_0x3ee6b4,_0x55ffc0);}}; \ No newline at end of file +var _0x81c6=['userVoiceQueueRt:','save','emit','removeListener','register','length'];(function(_0x27a7fa,_0x9b474f){var _0x45cf0e=function(_0x3bfc99){while(--_0x3bfc99){_0x27a7fa['push'](_0x27a7fa['shift']());}};_0x45cf0e(++_0x9b474f);}(_0x81c6,0x1d5));var _0x681c=function(_0xeeb6dd,_0x3e5f7b){_0xeeb6dd=_0xeeb6dd-0x0;var _0x95d347=_0x81c6[_0xeeb6dd];return _0x95d347;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x681c('0x0'),'remove','update'];function createListener(_0x57f8d2,_0x62d9fc){return function(_0x2d0fc0){_0x62d9fc[_0x681c('0x1')](_0x57f8d2,_0x2d0fc0);};}function removeListener(_0x5566e5,_0x44c18e){return function(){UserVoiceQueueRtEvents[_0x681c('0x2')](_0x5566e5,_0x44c18e);};}exports[_0x681c('0x3')]=function(_0x1d31c8){for(var _0x4ea522=0x0,_0x45331=events[_0x681c('0x4')];_0x4ea522<_0x45331;_0x4ea522++){var _0x5624d7=events[_0x4ea522];var _0x5b5f22=createListener(_0x681c('0x5')+_0x5624d7,_0x1d31c8);UserVoiceQueueRtEvents['on'](_0x5624d7,_0x5b5f22);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b2741d2..7ce92ca 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d3048,_0x2ea7be){var _0x172cd7=function(_0x543edb){while(--_0x543edb){_0x3d3048['push'](_0x3d3048['shift']());}};_0x172cd7(++_0x2ea7be);}(_0xe706,0xa3));var _0x6e70=function(_0x4489b6,_0x47c466){_0x4489b6=_0x4489b6-0x0;var _0x13a4bb=_0xe706[_0x4489b6];return _0x13a4bb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x162246,_0x4e5038){var _0x32ac95=function(_0x22270b){while(--_0x22270b){_0x162246['push'](_0x162246['shift']());}};_0x32ac95(++_0x4e5038);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 530bd8a..518fe32 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9fb=['sequelize','INTEGER'];(function(_0x490620,_0x12260a){var _0x45edd7=function(_0x5e8a7b){while(--_0x5e8a7b){_0x490620['push'](_0x490620['shift']());}};_0x45edd7(++_0x12260a);}(_0xa9fb,0x164));var _0xba9f=function(_0x3b74d7,_0x580c96){_0x3b74d7=_0x3b74d7-0x0;var _0x115ab5=_0xa9fb[_0x3b74d7];return _0x115ab5;};'use strict';var Sequelize=require(_0xba9f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xba9f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7c8d=['INTEGER','sequelize','exports'];(function(_0xb7805,_0x4a7cb2){var _0x1e4fc4=function(_0x5f0f46){while(--_0x5f0f46){_0xb7805['push'](_0xb7805['shift']());}};_0x1e4fc4(++_0x4a7cb2);}(_0x7c8d,0x115));var _0xd7c8=function(_0x4f7d7a,_0x23fb09){_0x4f7d7a=_0x4f7d7a-0x0;var _0x311656=_0x7c8d[_0x4f7d7a];return _0x311656;};'use strict';var Sequelize=require(_0xd7c8('0x0'));module[_0xd7c8('0x1')]={'penalty':{'type':Sequelize[_0xd7c8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 75a7b34..8fe783b 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb1f=['path','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c8e59,_0x386929){var _0x149e65=function(_0x27b06e){while(--_0x27b06e){_0x1c8e59['push'](_0x1c8e59['shift']());}};_0x149e65(++_0x386929);}(_0xbb1f,0x18c));var _0xfbb1=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0xbb1f[_0x2aefb6];return _0x202772;};'use strict';var _=require(_0xfbb1('0x0'));var util=require(_0xfbb1('0x1'));var logger=require(_0xfbb1('0x2'))(_0xfbb1('0x3'));var moment=require(_0xfbb1('0x4'));var BPromise=require(_0xfbb1('0x5'));var rp=require(_0xfbb1('0x6'));var fs=require('fs');var path=require(_0xfbb1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfbb1('0x8'));module[_0xfbb1('0x9')]=function(_0x3e3caf,_0x78c0a7){return _0x3e3caf[_0xfbb1('0xa')](_0xfbb1('0xb'),attributes,{'tableName':_0xfbb1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8845=['lodash','../../config/logger','api','bluebird','path','rimraf','./userWhatsappQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8845,0x85));var _0x5884=function(_0x5e7a40,_0x448a31){_0x5e7a40=_0x5e7a40-0x0;var _0x137ab9=_0x8845[_0x5e7a40];return _0x137ab9;};'use strict';var _=require(_0x5884('0x0'));var util=require('util');var logger=require(_0x5884('0x1'))(_0x5884('0x2'));var moment=require('moment');var BPromise=require(_0x5884('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5884('0x4'));var rimraf=require(_0x5884('0x5'));var config=require('../../config/environment');var attributes=require(_0x5884('0x6'));module['exports']=function(_0x44df3e,_0x5cc610){return _0x44df3e['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a459f44..03e2bbf 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x153f,0x18f));var _0xf153=function(_0xc88843,_0x583ff5){_0xc88843=_0xc88843-0x0;var _0x13faed=_0x153f[_0xc88843];return _0x13faed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf153('0x0'));var BPromise=require(_0xf153('0x1'));var rs=require(_0xf153('0x2'));var fs=require('fs');var Redis=require(_0xf153('0x3'));var db=require(_0xf153('0x4'))['db'];var utils=require(_0xf153('0x5'));var logger=require('../../config/logger')(_0xf153('0x6'));var config=require(_0xf153('0x7'));var jayson=require(_0xf153('0x8'));var client=jayson[_0xf153('0x9')][_0xf153('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25435f,_0x59b9ca,_0xf15fcb){return new BPromise(function(_0x3edec4,_0x151293){return client['request'](_0x25435f,_0xf15fcb)[_0xf153('0xb')](function(_0x23ef41){logger[_0xf153('0xc')](_0xf153('0xd'),_0x59b9ca,'request\x20sent');logger[_0xf153('0xe')](_0xf153('0xf'),_0x59b9ca,_0xf153('0x10'),JSON[_0xf153('0x11')](_0x23ef41));if(_0x23ef41[_0xf153('0x12')]){if(_0x23ef41['error'][_0xf153('0x13')]===0x1f4){logger[_0xf153('0x12')](_0xf153('0xd'),_0x59b9ca,_0x23ef41[_0xf153('0x12')][_0xf153('0x14')]);return _0x151293(_0x23ef41[_0xf153('0x12')]['message']);}logger[_0xf153('0x12')](_0xf153('0xd'),_0x59b9ca,_0x23ef41[_0xf153('0x12')][_0xf153('0x14')]);return _0x3edec4(_0x23ef41['error']['message']);}else{logger[_0xf153('0xc')](_0xf153('0xd'),_0x59b9ca,_0xf153('0x10'));_0x3edec4(_0x23ef41[_0xf153('0x15')][_0xf153('0x14')]);}})[_0xf153('0x16')](function(_0xdb751c){logger[_0xf153('0x12')](_0xf153('0xd'),_0x59b9ca,_0xdb751c);_0x151293(_0xdb751c);});});} \ No newline at end of file +var _0xc932=['result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1ee601,_0x22f35a){var _0x2604b2=function(_0x1e3616){while(--_0x1e3616){_0x1ee601['push'](_0x1ee601['shift']());}};_0x2604b2(++_0x22f35a);}(_0xc932,0xa9));var _0x2c93=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0xc932[_0x424357];return _0x29c68e;};'use strict';var _=require(_0x2c93('0x0'));var util=require(_0x2c93('0x1'));var moment=require('moment');var BPromise=require(_0x2c93('0x2'));var rs=require(_0x2c93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c93('0x4'))['db'];var utils=require(_0x2c93('0x5'));var logger=require(_0x2c93('0x6'))(_0x2c93('0x7'));var config=require(_0x2c93('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c93('0x9')][_0x2c93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xffba01,_0x1e5dae,_0x41f435){return new BPromise(function(_0x3d7419,_0x23c673){return client['request'](_0xffba01,_0x41f435)[_0x2c93('0xb')](function(_0x4e9cbb){logger[_0x2c93('0xc')](_0x2c93('0xd'),_0x1e5dae,_0x2c93('0xe'));logger[_0x2c93('0xf')](_0x2c93('0x10'),_0x1e5dae,_0x2c93('0xe'),JSON['stringify'](_0x4e9cbb));if(_0x4e9cbb[_0x2c93('0x11')]){if(_0x4e9cbb[_0x2c93('0x11')][_0x2c93('0x12')]===0x1f4){logger[_0x2c93('0x11')](_0x2c93('0xd'),_0x1e5dae,_0x4e9cbb[_0x2c93('0x11')]['message']);return _0x23c673(_0x4e9cbb['error'][_0x2c93('0x13')]);}logger[_0x2c93('0x11')](_0x2c93('0xd'),_0x1e5dae,_0x4e9cbb[_0x2c93('0x11')]['message']);return _0x3d7419(_0x4e9cbb[_0x2c93('0x11')][_0x2c93('0x13')]);}else{logger[_0x2c93('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1e5dae,_0x2c93('0xe'));_0x3d7419(_0x4e9cbb[_0x2c93('0x14')][_0x2c93('0x13')]);}})['catch'](function(_0x1a0f09){logger[_0x2c93('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1e5dae,_0x1a0f09);_0x23c673(_0x1a0f09);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b9dfece..4d4bcda 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea70=['../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xea70,0x175));var _0x0ea7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xea70[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var path=require(_0x0ea7('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ea7('0x3'));var router=express['Router']();var fs_extra=require(_0x0ea7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ea7('0x5'));var config=require(_0x0ea7('0x6'));var controller=require(_0x0ea7('0x7'));router[_0x0ea7('0x8')]('/',auth[_0x0ea7('0x9')](),controller['index']);router[_0x0ea7('0x8')](_0x0ea7('0xa'),auth['isAuthenticated'](),controller[_0x0ea7('0xb')]);router[_0x0ea7('0xc')]('/',auth['isAuthenticated'](),controller[_0x0ea7('0xd')]);router[_0x0ea7('0xe')](_0x0ea7('0xa'),auth[_0x0ea7('0x9')](),controller['update']);router[_0x0ea7('0xf')](_0x0ea7('0xa'),auth[_0x0ea7('0x9')](),controller[_0x0ea7('0x10')]);module[_0x0ea7('0x11')]=router; \ No newline at end of file +var _0xf6c1=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x4df46b,_0x4eccda){var _0xfbb3c=function(_0x109dec){while(--_0x109dec){_0x4df46b['push'](_0x4df46b['shift']());}};_0xfbb3c(++_0x4eccda);}(_0xf6c1,0x99));var _0x1f6c=function(_0x43eb9f,_0x153610){_0x43eb9f=_0x43eb9f-0x0;var _0x168690=_0xf6c1[_0x43eb9f];return _0x168690;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f6c('0x0'));var timeout=require(_0x1f6c('0x1'));var express=require(_0x1f6c('0x2'));var router=express['Router']();var fs_extra=require(_0x1f6c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1f6c('0x4'));var config=require(_0x1f6c('0x5'));var controller=require(_0x1f6c('0x6'));router[_0x1f6c('0x7')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x9')]);router['get'](_0x1f6c('0xa'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xb')]);router[_0x1f6c('0xc')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xd')]);router[_0x1f6c('0xe')](_0x1f6c('0xa'),auth[_0x1f6c('0x8')](),controller['update']);router['delete']('/:id',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xf')]);module[_0x1f6c('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ebe4d3b..97d082f 100644 --- a/server/api/variable/variable.attributes.js +++ b/server/api/variable/variable.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9275=['name','exports','STRING'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x9275,0x130));var _0x5927=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x9275[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require('sequelize');module[_0x5927('0x0')]={'name':{'type':Sequelize[_0x5927('0x1')],'unique':_0x5927('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x14e4=['STRING','name','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x14e4,0x8c));var _0x414e=function(_0x15d0ca,_0x31b89d){_0x15d0ca=_0x15d0ca-0x0;var _0x3c4cc5=_0x14e4[_0x15d0ca];return _0x3c4cc5;};'use strict';var Sequelize=require('sequelize');module[_0x414e('0x0')]={'name':{'type':Sequelize[_0x414e('0x1')],'unique':_0x414e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 5900573..d28f977 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1589=['rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','sendStatus','error','stack','name','send','index','map','Variable'];(function(_0x289df0,_0x46b985){var _0x15949b=function(_0x3d5b84){while(--_0x3d5b84){_0x289df0['push'](_0x289df0['shift']());}};_0x15949b(++_0x46b985);}(_0x1589,0xcb));var _0x9158=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x1589[_0x27beea];return _0x122645;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9158('0x0'));var rp=require(_0x9158('0x1'));var moment=require(_0x9158('0x2'));var BPromise=require(_0x9158('0x3'));var Mustache=require('mustache');var util=require(_0x9158('0x4'));var path=require(_0x9158('0x5'));var sox=require(_0x9158('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9158('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9158('0x8'));var jsforce=require(_0x9158('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x9158('0xa'));var querystring=require(_0x9158('0xb'));var Papa=require('papaparse');var Redis=require(_0x9158('0xc'));var authService=require(_0x9158('0xd'));var qs=require(_0x9158('0xe'));var as=require(_0x9158('0xf'));var hardwareService=require(_0x9158('0x10'));var logger=require(_0x9158('0x11'))(_0x9158('0x12'));var utils=require(_0x9158('0x13'));var config=require(_0x9158('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x320aaf,_0x15e7f3){_0x15e7f3=_0x15e7f3||0xcc;return function(_0x4416a6){if(_0x4416a6){return _0x320aaf['sendStatus'](_0x15e7f3);}return _0x320aaf['status'](_0x15e7f3)[_0x9158('0x15')]();};}function respondWithResult(_0x322c5f,_0x2d1b0b){_0x2d1b0b=_0x2d1b0b||0xc8;return function(_0x25676e){if(_0x25676e){return _0x322c5f[_0x9158('0x16')](_0x2d1b0b)[_0x9158('0x17')](_0x25676e);}};}function respondWithFilteredResult(_0x442f43,_0x419d00){return function(_0x4fa9d5){if(_0x4fa9d5){var _0x39413d=typeof _0x419d00['offset']===_0x9158('0x18')&&typeof _0x419d00[_0x9158('0x19')]===_0x9158('0x18');var _0x4f2c50=_0x4fa9d5[_0x9158('0x1a')];var _0x4944f4=_0x39413d?0x0:_0x419d00[_0x9158('0x1b')];var _0x18af34=_0x39413d?_0x4fa9d5['count']:_0x419d00[_0x9158('0x1b')]+_0x419d00[_0x9158('0x19')];var _0x48c5d8;if(_0x18af34>=_0x4f2c50){_0x18af34=_0x4f2c50;_0x48c5d8=0xc8;}else{_0x48c5d8=0xce;}_0x442f43[_0x9158('0x16')](_0x48c5d8);return _0x442f43[_0x9158('0x1c')](_0x9158('0x1d'),_0x4944f4+'-'+_0x18af34+'/'+_0x4f2c50)[_0x9158('0x17')](_0x4fa9d5);}return null;};}function patchUpdates(_0xac9f7b){return function(_0x58eade){try{jsonpatch[_0x9158('0x1e')](_0x58eade,_0xac9f7b,!![]);}catch(_0x104907){return BPromise[_0x9158('0x1f')](_0x104907);}return _0x58eade[_0x9158('0x20')]();};}function saveUpdates(_0x526918,_0x24dbdc){return function(_0x889f59){if(_0x889f59){return _0x889f59[_0x9158('0x21')](_0x526918)[_0x9158('0x22')](function(_0x5ef931){return _0x5ef931;});}return null;};}function removeEntity(_0x4b12f7,_0x280adf){return function(_0x3ed6eb){if(_0x3ed6eb){return _0x3ed6eb[_0x9158('0x23')]()[_0x9158('0x22')](function(){var _0x45b90b=_0x3ed6eb[_0x9158('0x24')]({'plain':!![]});var _0x119eb6=_0x9158('0x25');return db['UserProfileResource'][_0x9158('0x23')]({'where':{'type':_0x119eb6,'resourceId':_0x45b90b['id']}})['then'](function(){return _0x3ed6eb;});})[_0x9158('0x22')](function(){_0x4b12f7[_0x9158('0x16')](0xcc)[_0x9158('0x15')]();});}};}function handleEntityNotFound(_0x4b21d0,_0x40bd3a){return function(_0x3faf08){if(!_0x3faf08){_0x4b21d0[_0x9158('0x26')](0x194);}return _0x3faf08;};}function handleError(_0x4568dd,_0x32a9a9){_0x32a9a9=_0x32a9a9||0x1f4;return function(_0xc4bff8){logger[_0x9158('0x27')](_0xc4bff8[_0x9158('0x28')]);if(_0xc4bff8[_0x9158('0x29')]){delete _0xc4bff8['name'];}_0x4568dd[_0x9158('0x16')](_0x32a9a9)[_0x9158('0x2a')](_0xc4bff8);};}exports[_0x9158('0x2b')]=function(_0x3865fb,_0x3fc3cb){var _0x53eb85={},_0x50636c={},_0x64e36d={'count':0x0,'rows':[]};var _0x259813=_[_0x9158('0x2c')](db[_0x9158('0x2d')][_0x9158('0x2e')],function(_0x16855f){return{'name':_0x16855f['fieldName'],'type':_0x16855f[_0x9158('0x2f')][_0x9158('0x30')]};});_0x50636c[_0x9158('0x31')]=_[_0x9158('0x2c')](_0x259813,_0x9158('0x29'));_0x50636c['query']=_[_0x9158('0x32')](_0x3865fb['query']);_0x50636c['filters']=_[_0x9158('0x33')](_0x50636c[_0x9158('0x31')],_0x50636c[_0x9158('0x34')]);_0x53eb85[_0x9158('0x35')]=_[_0x9158('0x33')](_0x50636c['model'],qs[_0x9158('0x36')](_0x3865fb['query'][_0x9158('0x36')]));_0x53eb85['attributes']=_0x53eb85[_0x9158('0x35')][_0x9158('0x37')]?_0x53eb85[_0x9158('0x35')]:_0x50636c[_0x9158('0x31')];if(!_0x3865fb[_0x9158('0x34')]['hasOwnProperty'](_0x9158('0x38'))){_0x53eb85[_0x9158('0x19')]=qs[_0x9158('0x19')](_0x3865fb[_0x9158('0x34')]['limit']);_0x53eb85[_0x9158('0x1b')]=qs[_0x9158('0x1b')](_0x3865fb['query'][_0x9158('0x1b')]);}_0x53eb85[_0x9158('0x39')]=qs[_0x9158('0x3a')](_0x3865fb[_0x9158('0x34')][_0x9158('0x3a')]);_0x53eb85[_0x9158('0x3b')]=qs[_0x9158('0x3c')](_[_0x9158('0x3d')](_0x3865fb[_0x9158('0x34')],_0x50636c[_0x9158('0x3c')]),_0x259813);if(_0x3865fb[_0x9158('0x34')][_0x9158('0x3e')]){_0x53eb85[_0x9158('0x3b')]=_[_0x9158('0x3f')](_0x53eb85[_0x9158('0x3b')],{'$or':_[_0x9158('0x2c')](_0x259813,function(_0x1d6da2){if(_0x1d6da2['type']!==_0x9158('0x40')){var _0x344d4a={};_0x344d4a[_0x1d6da2[_0x9158('0x29')]]={'$like':'%'+_0x3865fb['query'][_0x9158('0x3e')]+'%'};return _0x344d4a;}})});}_0x53eb85=_[_0x9158('0x3f')]({},_0x53eb85,_0x3865fb[_0x9158('0x41')]);var _0x37fd62={'where':_0x53eb85[_0x9158('0x3b')]};return db['Variable'][_0x9158('0x1a')](_0x37fd62)[_0x9158('0x22')](function(_0x48d58a){_0x64e36d[_0x9158('0x1a')]=_0x48d58a;if(_0x3865fb['query']['includeAll']){_0x53eb85['include']=[{'all':!![]}];}return db[_0x9158('0x2d')][_0x9158('0x42')](_0x53eb85);})['then'](function(_0x586657){_0x64e36d[_0x9158('0x43')]=_0x586657;return _0x64e36d;})[_0x9158('0x22')](respondWithFilteredResult(_0x3fc3cb,_0x53eb85))['catch'](handleError(_0x3fc3cb,null));};exports[_0x9158('0x44')]=function(_0xb32837,_0x335636){var _0x224da6={'raw':!![],'where':{'id':_0xb32837[_0x9158('0x45')]['id']}},_0x2085a8={};_0x2085a8[_0x9158('0x31')]=_['keys'](db[_0x9158('0x2d')][_0x9158('0x2e')]);_0x2085a8['query']=_[_0x9158('0x32')](_0xb32837[_0x9158('0x34')]);_0x2085a8[_0x9158('0x3c')]=_[_0x9158('0x33')](_0x2085a8[_0x9158('0x31')],_0x2085a8[_0x9158('0x34')]);_0x224da6['attributes']=_['intersection'](_0x2085a8['model'],qs['fields'](_0xb32837['query'][_0x9158('0x36')]));_0x224da6[_0x9158('0x35')]=_0x224da6[_0x9158('0x35')][_0x9158('0x37')]?_0x224da6[_0x9158('0x35')]:_0x2085a8[_0x9158('0x31')];if(_0xb32837[_0x9158('0x34')][_0x9158('0x46')]){_0x224da6['include']=[{'all':!![]}];}_0x224da6=_['merge']({},_0x224da6,_0xb32837[_0x9158('0x41')]);return db[_0x9158('0x2d')]['find'](_0x224da6)[_0x9158('0x22')](handleEntityNotFound(_0x335636,null))[_0x9158('0x22')](respondWithResult(_0x335636,null))['catch'](handleError(_0x335636,null));};exports['create']=function(_0x20b850,_0x1dd3dd){return db['Variable'][_0x9158('0x47')](_0x20b850[_0x9158('0x48')],{})[_0x9158('0x22')](function(_0x135687){var _0xc4251=_0x20b850[_0x9158('0x49')][_0x9158('0x24')]({'plain':!![]});if(!_0xc4251)throw new Error(_0x9158('0x4a'));if(_0xc4251[_0x9158('0x4b')]===_0x9158('0x49')){var _0x1ef326=_0x135687[_0x9158('0x24')]({'plain':!![]});var _0x45604d='Variables';return db[_0x9158('0x4c')][_0x9158('0x4d')]({'where':{'name':_0x45604d,'userProfileId':_0xc4251[_0x9158('0x4e')]},'raw':!![]})[_0x9158('0x22')](function(_0x4bd322){if(_0x4bd322&&_0x4bd322[_0x9158('0x4f')]===0x0){return db[_0x9158('0x50')]['create']({'name':_0x1ef326[_0x9158('0x29')],'resourceId':_0x1ef326['id'],'type':_0x4bd322[_0x9158('0x29')],'sectionId':_0x4bd322['id']},{})[_0x9158('0x22')](function(){return _0x135687;});}else{return _0x135687;}})[_0x9158('0x51')](function(_0x4545f8){logger[_0x9158('0x27')](_0x9158('0x52'),_0x4545f8);throw _0x4545f8;});}return _0x135687;})[_0x9158('0x22')](respondWithResult(_0x1dd3dd,0xc9))[_0x9158('0x51')](handleError(_0x1dd3dd,null));};exports[_0x9158('0x21')]=function(_0x5f50e3,_0x335357){if(_0x5f50e3[_0x9158('0x48')]['id']){delete _0x5f50e3[_0x9158('0x48')]['id'];}return db['Variable'][_0x9158('0x4d')]({'where':{'id':_0x5f50e3[_0x9158('0x45')]['id']}})[_0x9158('0x22')](handleEntityNotFound(_0x335357,null))[_0x9158('0x22')](saveUpdates(_0x5f50e3[_0x9158('0x48')],null))[_0x9158('0x22')](respondWithResult(_0x335357,null))[_0x9158('0x51')](handleError(_0x335357,null));};exports['destroy']=function(_0x4e2ec6,_0x510dc8){return db[_0x9158('0x2d')][_0x9158('0x4d')]({'where':{'id':_0x4e2ec6[_0x9158('0x45')]['id']}})[_0x9158('0x22')](handleEntityNotFound(_0x510dc8,null))[_0x9158('0x22')](removeEntity(_0x510dc8,null))[_0x9158('0x51')](handleError(_0x510dc8,null));}; \ No newline at end of file +var _0x3354=['limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','Variable','includeAll','include','findAll','catch','params','keys','options','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Variables','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x3354,0x1e3));var _0x4335=function(_0x295b61,_0x20b436){_0x295b61=_0x295b61-0x0;var _0x2d9519=_0x3354[_0x295b61];return _0x2d9519;};'use strict';var emlformat=require(_0x4335('0x0'));var rimraf=require(_0x4335('0x1'));var zipdir=require(_0x4335('0x2'));var jsonpatch=require(_0x4335('0x3'));var rp=require(_0x4335('0x4'));var moment=require(_0x4335('0x5'));var BPromise=require(_0x4335('0x6'));var Mustache=require(_0x4335('0x7'));var util=require(_0x4335('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x4335('0x9'));var ejs=require(_0x4335('0xa'));var fs=require('fs');var fs_extra=require(_0x4335('0xb'));var _=require(_0x4335('0xc'));var squel=require(_0x4335('0xd'));var crypto=require(_0x4335('0xe'));var jsforce=require(_0x4335('0xf'));var deskjs=require(_0x4335('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4335('0x11'));var Papa=require(_0x4335('0x12'));var Redis=require('ioredis');var authService=require(_0x4335('0x13'));var qs=require(_0x4335('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4335('0x15'));var logger=require(_0x4335('0x16'))(_0x4335('0x17'));var utils=require(_0x4335('0x18'));var config=require(_0x4335('0x19'));var licenseUtil=require(_0x4335('0x1a'));var db=require(_0x4335('0x1b'))['db'];function respondWithStatusCode(_0x246afd,_0x4e8f2a){_0x4e8f2a=_0x4e8f2a||0xcc;return function(_0x103fd3){if(_0x103fd3){return _0x246afd[_0x4335('0x1c')](_0x4e8f2a);}return _0x246afd[_0x4335('0x1d')](_0x4e8f2a)[_0x4335('0x1e')]();};}function respondWithResult(_0x174df6,_0x3cea92){_0x3cea92=_0x3cea92||0xc8;return function(_0x2b60a0){if(_0x2b60a0){return _0x174df6[_0x4335('0x1d')](_0x3cea92)[_0x4335('0x1f')](_0x2b60a0);}};}function respondWithFilteredResult(_0x20f14d,_0x146636){return function(_0x231f3e){if(_0x231f3e){var _0xf2599b=typeof _0x146636[_0x4335('0x20')]==='undefined'&&typeof _0x146636[_0x4335('0x21')]===_0x4335('0x22');var _0xcd11d1=_0x231f3e[_0x4335('0x23')];var _0x45eb0d=_0xf2599b?0x0:_0x146636[_0x4335('0x20')];var _0x9399c1=_0xf2599b?_0x231f3e['count']:_0x146636['offset']+_0x146636[_0x4335('0x21')];var _0x113a31;if(_0x9399c1>=_0xcd11d1){_0x9399c1=_0xcd11d1;_0x113a31=0xc8;}else{_0x113a31=0xce;}_0x20f14d[_0x4335('0x1d')](_0x113a31);return _0x20f14d[_0x4335('0x24')](_0x4335('0x25'),_0x45eb0d+'-'+_0x9399c1+'/'+_0xcd11d1)[_0x4335('0x1f')](_0x231f3e);}return null;};}function patchUpdates(_0x531d89){return function(_0x48b657){try{jsonpatch['apply'](_0x48b657,_0x531d89,!![]);}catch(_0x229888){return BPromise[_0x4335('0x26')](_0x229888);}return _0x48b657[_0x4335('0x27')]();};}function saveUpdates(_0x574198,_0x5bb246){return function(_0x1d7f03){if(_0x1d7f03){return _0x1d7f03[_0x4335('0x28')](_0x574198)[_0x4335('0x29')](function(_0x43149e){return _0x43149e;});}return null;};}function removeEntity(_0x59fbef,_0x5e1b53){return function(_0x3c255c){if(_0x3c255c){return _0x3c255c[_0x4335('0x2a')]()[_0x4335('0x29')](function(){var _0x2c2c0c=_0x3c255c['get']({'plain':!![]});var _0x2af1c6='Variables';return db[_0x4335('0x2b')][_0x4335('0x2a')]({'where':{'type':_0x2af1c6,'resourceId':_0x2c2c0c['id']}})[_0x4335('0x29')](function(){return _0x3c255c;});})[_0x4335('0x29')](function(){_0x59fbef[_0x4335('0x1d')](0xcc)[_0x4335('0x1e')]();});}};}function handleEntityNotFound(_0x4a6405,_0x584200){return function(_0x106e58){if(!_0x106e58){_0x4a6405[_0x4335('0x1c')](0x194);}return _0x106e58;};}function handleError(_0x3778c9,_0x47d80d){_0x47d80d=_0x47d80d||0x1f4;return function(_0xc50afb){logger[_0x4335('0x2c')](_0xc50afb[_0x4335('0x2d')]);if(_0xc50afb[_0x4335('0x2e')]){delete _0xc50afb[_0x4335('0x2e')];}_0x3778c9['status'](_0x47d80d)['send'](_0xc50afb);};}exports['index']=function(_0xbf1c65,_0x28e337){var _0x118bfb={},_0x3c3eef={},_0x5d8633={'count':0x0,'rows':[]};var _0x4d3ca5=_[_0x4335('0x2f')](db['Variable'][_0x4335('0x30')],function(_0x20adc9){return{'name':_0x20adc9[_0x4335('0x31')],'type':_0x20adc9[_0x4335('0x32')][_0x4335('0x33')]};});_0x3c3eef[_0x4335('0x34')]=_[_0x4335('0x2f')](_0x4d3ca5,_0x4335('0x2e'));_0x3c3eef[_0x4335('0x35')]=_['keys'](_0xbf1c65[_0x4335('0x35')]);_0x3c3eef['filters']=_[_0x4335('0x36')](_0x3c3eef[_0x4335('0x34')],_0x3c3eef[_0x4335('0x35')]);_0x118bfb[_0x4335('0x37')]=_[_0x4335('0x36')](_0x3c3eef[_0x4335('0x34')],qs[_0x4335('0x38')](_0xbf1c65[_0x4335('0x35')]['fields']));_0x118bfb[_0x4335('0x37')]=_0x118bfb['attributes'][_0x4335('0x39')]?_0x118bfb[_0x4335('0x37')]:_0x3c3eef[_0x4335('0x34')];if(!_0xbf1c65[_0x4335('0x35')][_0x4335('0x3a')](_0x4335('0x3b'))){_0x118bfb[_0x4335('0x21')]=qs[_0x4335('0x21')](_0xbf1c65[_0x4335('0x35')][_0x4335('0x21')]);_0x118bfb['offset']=qs['offset'](_0xbf1c65[_0x4335('0x35')]['offset']);}_0x118bfb[_0x4335('0x3c')]=qs[_0x4335('0x3d')](_0xbf1c65[_0x4335('0x35')][_0x4335('0x3d')]);_0x118bfb['where']=qs[_0x4335('0x3e')](_['pick'](_0xbf1c65[_0x4335('0x35')],_0x3c3eef[_0x4335('0x3e')]),_0x4d3ca5);if(_0xbf1c65[_0x4335('0x35')][_0x4335('0x3f')]){_0x118bfb[_0x4335('0x40')]=_['merge'](_0x118bfb[_0x4335('0x40')],{'$or':_[_0x4335('0x2f')](_0x4d3ca5,function(_0xcbb24e){if(_0xcbb24e['type']!==_0x4335('0x41')){var _0x399e22={};_0x399e22[_0xcbb24e[_0x4335('0x2e')]]={'$like':'%'+_0xbf1c65[_0x4335('0x35')][_0x4335('0x3f')]+'%'};return _0x399e22;}})});}_0x118bfb=_[_0x4335('0x42')]({},_0x118bfb,_0xbf1c65['options']);var _0x1bca20={'where':_0x118bfb[_0x4335('0x40')]};return db[_0x4335('0x43')][_0x4335('0x23')](_0x1bca20)[_0x4335('0x29')](function(_0x6eed92){_0x5d8633[_0x4335('0x23')]=_0x6eed92;if(_0xbf1c65['query'][_0x4335('0x44')]){_0x118bfb[_0x4335('0x45')]=[{'all':!![]}];}return db[_0x4335('0x43')][_0x4335('0x46')](_0x118bfb);})['then'](function(_0x542a96){_0x5d8633['rows']=_0x542a96;return _0x5d8633;})[_0x4335('0x29')](respondWithFilteredResult(_0x28e337,_0x118bfb))[_0x4335('0x47')](handleError(_0x28e337,null));};exports['show']=function(_0x87f2ec,_0x24ac3c){var _0x4457ec={'raw':!![],'where':{'id':_0x87f2ec[_0x4335('0x48')]['id']}},_0x1952c6={};_0x1952c6[_0x4335('0x34')]=_[_0x4335('0x49')](db[_0x4335('0x43')][_0x4335('0x30')]);_0x1952c6[_0x4335('0x35')]=_['keys'](_0x87f2ec['query']);_0x1952c6[_0x4335('0x3e')]=_[_0x4335('0x36')](_0x1952c6[_0x4335('0x34')],_0x1952c6[_0x4335('0x35')]);_0x4457ec[_0x4335('0x37')]=_[_0x4335('0x36')](_0x1952c6[_0x4335('0x34')],qs[_0x4335('0x38')](_0x87f2ec[_0x4335('0x35')][_0x4335('0x38')]));_0x4457ec[_0x4335('0x37')]=_0x4457ec[_0x4335('0x37')][_0x4335('0x39')]?_0x4457ec[_0x4335('0x37')]:_0x1952c6[_0x4335('0x34')];if(_0x87f2ec[_0x4335('0x35')][_0x4335('0x44')]){_0x4457ec['include']=[{'all':!![]}];}_0x4457ec=_[_0x4335('0x42')]({},_0x4457ec,_0x87f2ec[_0x4335('0x4a')]);return db[_0x4335('0x43')]['find'](_0x4457ec)['then'](handleEntityNotFound(_0x24ac3c,null))[_0x4335('0x29')](respondWithResult(_0x24ac3c,null))[_0x4335('0x47')](handleError(_0x24ac3c,null));};exports[_0x4335('0x4b')]=function(_0x480aa8,_0x4204e5){return db[_0x4335('0x43')][_0x4335('0x4b')](_0x480aa8['body'],{})[_0x4335('0x29')](function(_0x20c776){var _0x47623b=_0x480aa8['user'][_0x4335('0x4c')]({'plain':!![]});if(!_0x47623b)throw new Error(_0x4335('0x4d'));if(_0x47623b['role']===_0x4335('0x4e')){var _0xd59319=_0x20c776[_0x4335('0x4c')]({'plain':!![]});var _0x2dab54=_0x4335('0x4f');return db[_0x4335('0x50')][_0x4335('0x51')]({'where':{'name':_0x2dab54,'userProfileId':_0x47623b[_0x4335('0x52')]},'raw':!![]})[_0x4335('0x29')](function(_0x4d7871){if(_0x4d7871&&_0x4d7871[_0x4335('0x53')]===0x0){return db[_0x4335('0x2b')][_0x4335('0x4b')]({'name':_0xd59319['name'],'resourceId':_0xd59319['id'],'type':_0x4d7871[_0x4335('0x2e')],'sectionId':_0x4d7871['id']},{})['then'](function(){return _0x20c776;});}else{return _0x20c776;}})['catch'](function(_0x4ed126){logger[_0x4335('0x2c')](_0x4335('0x54'),_0x4ed126);throw _0x4ed126;});}return _0x20c776;})['then'](respondWithResult(_0x4204e5,0xc9))['catch'](handleError(_0x4204e5,null));};exports[_0x4335('0x28')]=function(_0x38269d,_0x3c4dcc){if(_0x38269d[_0x4335('0x55')]['id']){delete _0x38269d[_0x4335('0x55')]['id'];}return db[_0x4335('0x43')][_0x4335('0x51')]({'where':{'id':_0x38269d[_0x4335('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c4dcc,null))[_0x4335('0x29')](saveUpdates(_0x38269d['body'],null))[_0x4335('0x29')](respondWithResult(_0x3c4dcc,null))[_0x4335('0x47')](handleError(_0x3c4dcc,null));};exports['destroy']=function(_0x478b2b,_0x26d939){return db['Variable'][_0x4335('0x51')]({'where':{'id':_0x478b2b['params']['id']}})[_0x4335('0x29')](handleEntityNotFound(_0x26d939,null))[_0x4335('0x29')](removeEntity(_0x26d939,null))[_0x4335('0x47')](handleError(_0x26d939,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4eb82b2..8c046de 100644 --- a/server/api/variable/variable.model.js +++ b/server/api/variable/variable.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54f3=['rimraf','../../config/environment','./variable.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x3208c7,_0x3680a0){var _0x4f512e=function(_0x28387e){while(--_0x28387e){_0x3208c7['push'](_0x3208c7['shift']());}};_0x4f512e(++_0x3680a0);}(_0x54f3,0x1d9));var _0x354f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x54f3[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x354f('0x0'));var util=require(_0x354f('0x1'));var logger=require(_0x354f('0x2'))(_0x354f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x354f('0x4'));var config=require(_0x354f('0x5'));var attributes=require(_0x354f('0x6'));module[_0x354f('0x7')]=function(_0x35423d,_0x47e43f){return _0x35423d[_0x354f('0x8')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ac7=['tools_variables','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ac7,0x1bd));var _0x73ac=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3ac7[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x73ac('0x0'));var util=require(_0x73ac('0x1'));var logger=require(_0x73ac('0x2'))(_0x73ac('0x3'));var moment=require(_0x73ac('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x73ac('0x5'));var config=require(_0x73ac('0x6'));var attributes=require(_0x73ac('0x7'));module[_0x73ac('0x8')]=function(_0x381c9d,_0x37327a){return _0x381c9d[_0x73ac('0x9')](_0x73ac('0xa'),attributes,{'tableName':_0x73ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index d5e8203..c2ac06f 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x17ce1d,_0x50244b){var _0x56196d=function(_0x27c57c){while(--_0x27c57c){_0x17ce1d['push'](_0x17ce1d['shift']());}};_0x56196d(++_0x50244b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x4b84[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x2635ac,_0x5c6108){var _0x693d1e=function(_0x4e614b){while(--_0x4e614b){_0x2635ac['push'](_0x2635ac['shift']());}};_0x693d1e(++_0x5c6108);}(_0x55ca,0x126));var _0xa55c=function(_0x2dc70d,_0x26e805){_0x2dc70d=_0x2dc70d-0x0;var _0x3b9ecc=_0x55ca[_0x2dc70d];return _0x3b9ecc;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5d9de97..14fba55 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa385=['reset','/pull','isAuthenticated','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate'];(function(_0x54a017,_0x2e487d){var _0x243874=function(_0x11c094){while(--_0x11c094){_0x54a017['push'](_0x54a017['shift']());}};_0x243874(++_0x2e487d);}(_0xa385,0x1e5));var _0x5a38=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xa385[_0x6cf19c];return _0xce14f3;};'use strict';var express=require(_0x5a38('0x0'));var router=express[_0x5a38('0x1')]();var auth=require(_0x5a38('0x2'));var controller=require(_0x5a38('0x3'));router[_0x5a38('0x4')]('/',controller[_0x5a38('0x5')]);router[_0x5a38('0x4')](_0x5a38('0x6'),auth['isAuthenticated'](),auth[_0x5a38('0x7')](),controller['fetch']);router['get']('/reset',auth['isAuthenticated'](),auth[_0x5a38('0x7')](),controller[_0x5a38('0x8')]);router['get'](_0x5a38('0x9'),auth[_0x5a38('0xa')](),auth[_0x5a38('0x7')](),controller[_0x5a38('0xb')]);router[_0x5a38('0x4')](_0x5a38('0xc'),auth[_0x5a38('0xa')](),controller[_0x5a38('0xd')]);router['get'](_0x5a38('0xe'),controller[_0x5a38('0xf')]);module[_0x5a38('0x10')]=router; \ No newline at end of file +var _0x3ff1=['/pull','pull','/restart','restart','/migrations','exports','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x58c34a,_0x1ccfe7){var _0x4e1193=function(_0x3e2ca4){while(--_0x3e2ca4){_0x58c34a['push'](_0x58c34a['shift']());}};_0x4e1193(++_0x1ccfe7);}(_0x3ff1,0xba));var _0x13ff=function(_0x334676,_0x314954){_0x334676=_0x334676-0x0;var _0x2c9e4c=_0x3ff1[_0x334676];return _0x2c9e4c;};'use strict';var express=require('express');var router=express[_0x13ff('0x0')]();var auth=require(_0x13ff('0x1'));var controller=require('./version.controller');router[_0x13ff('0x2')]('/',controller[_0x13ff('0x3')]);router['get'](_0x13ff('0x4'),auth[_0x13ff('0x5')](),auth[_0x13ff('0x6')](),controller[_0x13ff('0x7')]);router['get'](_0x13ff('0x8'),auth['isAuthenticated'](),auth[_0x13ff('0x6')](),controller['reset']);router[_0x13ff('0x2')](_0x13ff('0x9'),auth[_0x13ff('0x5')](),auth[_0x13ff('0x6')](),controller[_0x13ff('0xa')]);router[_0x13ff('0x2')](_0x13ff('0xb'),auth[_0x13ff('0x5')](),controller[_0x13ff('0xc')]);router[_0x13ff('0x2')](_0x13ff('0xd'),controller['migrations']);module[_0x13ff('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index e24bc55..e73f10b 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a70=['status','json','fetch','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','replace','length','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','tags','2.0.0'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x1a70,0xcc));var _0x01a7=function(_0x497a57,_0x169a05){_0x497a57=_0x497a57-0x0;var _0x4d8ddc=_0x1a70[_0x497a57];return _0x4d8ddc;};'use strict';var Umzug=require(_0x01a7('0x0'));var path=require(_0x01a7('0x1'));var fs=require('fs');var _=require(_0x01a7('0x2'));var pkginfo=require(_0x01a7('0x3'))(module,_0x01a7('0x4'));var compareVersions=require(_0x01a7('0x5'));var exec=require(_0x01a7('0x6'))[_0x01a7('0x7')];var db=require(_0x01a7('0x8'))['db'];var config=require(_0x01a7('0x9'));var pm2=require(_0x01a7('0xa'));var logger=require(_0x01a7('0xb'))('update');var git=require(_0x01a7('0xc'))(config[_0x01a7('0xd')]);exports[_0x01a7('0xe')]=function(_0x24e4aa,_0x5622f3){var _0x512d5e={'current':module[_0x01a7('0xf')][_0x01a7('0x4')],'phonebar':0x2};if(_0x24e4aa[_0x01a7('0x10')]&&_0x24e4aa[_0x01a7('0x10')][_0x01a7('0x11')]){return git['fetch']()[_0x01a7('0x12')](function(_0x2e3bc5,_0x1eeb3f){_0x512d5e[_0x01a7('0x11')]=(_0x2e3bc5?module['exports'][_0x01a7('0x4')]:_0x1eeb3f[_0x01a7('0x11')])||_0x01a7('0x13');return _0x5622f3[_0x01a7('0x14')](0xc8)[_0x01a7('0x15')](_0x512d5e);});}else{return _0x5622f3[_0x01a7('0x14')](0xc8)['json'](_0x512d5e);}};exports['fetch']=function(_0x2e663b,_0x3090c3){return git[_0x01a7('0x16')](['origin','master'],function(_0x2af330){if(_0x2af330){logger[_0x01a7('0x17')](_0x2af330);return _0x3090c3[_0x01a7('0x14')](0x1f4)[_0x01a7('0x15')](_0x2af330);}logger[_0x01a7('0x18')](_0x01a7('0x19'));return _0x3090c3[_0x01a7('0x14')](0xc8)[_0x01a7('0x15')]({'output':_0x01a7('0x1a')});});};exports[_0x01a7('0x1b')]=function(_0x7edf3d,_0x58013e){return git[_0x01a7('0x1b')]([_0x01a7('0x1c'),'FETCH_HEAD'],function(_0x5a79dd){if(_0x5a79dd){logger[_0x01a7('0x17')](_0x5a79dd);return _0x58013e['status'](0x1f4)['json'](_0x5a79dd);}logger[_0x01a7('0x18')](_0x01a7('0x1d'));return _0x58013e['status'](0xc8)[_0x01a7('0x15')]({'output':_0x01a7('0x1e')});});};exports[_0x01a7('0x1f')]=function(_0x68303b,_0x272332){exec(_0x01a7('0x20'),function(_0x3dad4f,_0x1bbfdf,_0x47ebfe){logger['info'](_0x1bbfdf);logger[_0x01a7('0x18')](_0x47ebfe);if(_0x3dad4f){logger['error'](_0x3dad4f);return _0x272332[_0x01a7('0x14')](0x1f4)[_0x01a7('0x15')](_0x3dad4f);}return _0x272332[_0x01a7('0x14')](0xc8)['json']({'output':_0x1bbfdf});});};exports[_0x01a7('0x21')]=function(_0x1944ec,_0x33bd3d){return pm2[_0x01a7('0x21')](_0x01a7('0x22'))[_0x01a7('0x23')](function(_0x10cb22){logger[_0x01a7('0x18')](_0x01a7('0x24'),_0x10cb22);return _0x33bd3d[_0x01a7('0x14')](0xc8)[_0x01a7('0x15')]({'output':_0x01a7('0x25')});})['catch'](function(_0x14b60a){logger[_0x01a7('0x17')](_0x14b60a);return _0x33bd3d[_0x01a7('0x14')](0x1f4)['json'](_0x14b60a);});};exports[_0x01a7('0x26')]=function(_0x236c64,_0x168ac6){var _0x22cced=fs[_0x01a7('0x27')](path[_0x01a7('0x28')](config['root'],_0x01a7('0x29'),_0x01a7('0x26')));var _0x454775=[];for(var _0x4bdf40=0x0;_0x4bdf40<_0x22cced['length'];_0x4bdf40++){var _0x19ce62=_0x22cced[_0x4bdf40][_0x01a7('0x2a')]('.js','');if(compareVersions(module['exports']['version'],_0x19ce62)===-0x1){_0x454775['push'](_0x19ce62);}}if(_0x454775[_0x01a7('0x2b')]){var _0x22ea6f=_0x454775['sort'](compareVersions);var _0x39a80e=new Umzug({'storage':_0x01a7('0x2c'),'storageOptions':{'model':db[_0x01a7('0x2d')],'modelName':'Migration','columnName':_0x01a7('0x4')},'migrations':{'params':[db['sequelize'][_0x01a7('0x2e')](),db[_0x01a7('0x2c')][_0x01a7('0x2f')],function(){throw new Error(_0x01a7('0x30'));}],'path':path['join'](config[_0x01a7('0xd')],_0x01a7('0x29'),_0x01a7('0x26')),'pattern':/\.js$/}});_0x39a80e['up']({'migrations':_[_0x01a7('0x31')](_0x22ea6f,function(_0x27dd30){return _0x27dd30+_0x01a7('0x32');})})[_0x01a7('0x23')](function(){return _0x168ac6['status'](0xc8)[_0x01a7('0x15')]({'output':_0x01a7('0x33')+module[_0x01a7('0xf')][_0x01a7('0x4')]+_0x01a7('0x34')+_['last'](_0x22ea6f),'migrations':_[_0x01a7('0x28')](_0x22ea6f)});})[_0x01a7('0x35')](function(_0x6e1476){if(_0x6e1476 instanceof db[_0x01a7('0x2c')][_0x01a7('0x36')]){return _0x168ac6[_0x01a7('0x14')](0xc8)[_0x01a7('0x15')]({'output':_0x01a7('0x37')});}else{return _0x168ac6['status'](0x1f4)[_0x01a7('0x15')](_0x6e1476);}});}else{return _0x168ac6[_0x01a7('0x14')](0xc8)['json']({'output':_0x01a7('0x37')});}}; \ No newline at end of file +var _0x830f=['push','sort','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','last','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace'];(function(_0xafa84c,_0x3d9afc){var _0x44532c=function(_0x1af36c){while(--_0x1af36c){_0xafa84c['push'](_0xafa84c['shift']());}};_0x44532c(++_0x3d9afc);}(_0x830f,0x1d4));var _0xf830=function(_0x6709e7,_0x4ef9bc){_0x6709e7=_0x6709e7-0x0;var _0x2f7397=_0x830f[_0x6709e7];return _0x2f7397;};'use strict';var Umzug=require(_0xf830('0x0'));var path=require(_0xf830('0x1'));var fs=require('fs');var _=require(_0xf830('0x2'));var pkginfo=require(_0xf830('0x3'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xf830('0x4'))[_0xf830('0x5')];var db=require(_0xf830('0x6'))['db'];var config=require(_0xf830('0x7'));var pm2=require('../../config/pm2');var logger=require(_0xf830('0x8'))(_0xf830('0x9'));var git=require(_0xf830('0xa'))(config[_0xf830('0xb')]);exports[_0xf830('0xc')]=function(_0x292883,_0x23aea5){var _0x385cf4={'current':module[_0xf830('0xd')][_0xf830('0xe')],'phonebar':0x2};if(_0x292883['query']&&_0x292883[_0xf830('0xf')][_0xf830('0x10')]){return git[_0xf830('0x11')]()[_0xf830('0x12')](function(_0x5d233d,_0x190abe){_0x385cf4[_0xf830('0x10')]=(_0x5d233d?module[_0xf830('0xd')][_0xf830('0xe')]:_0x190abe[_0xf830('0x10')])||'2.0.0';return _0x23aea5[_0xf830('0x13')](0xc8)[_0xf830('0x14')](_0x385cf4);});}else{return _0x23aea5['status'](0xc8)['json'](_0x385cf4);}};exports['fetch']=function(_0x7ec312,_0xfdc1c1){return git[_0xf830('0x11')]([_0xf830('0x15'),_0xf830('0x16')],function(_0x1bd345){if(_0x1bd345){logger['error'](_0x1bd345);return _0xfdc1c1['status'](0x1f4)[_0xf830('0x14')](_0x1bd345);}logger[_0xf830('0x17')](_0xf830('0x18'));return _0xfdc1c1[_0xf830('0x13')](0xc8)['json']({'output':_0xf830('0x19')});});};exports[_0xf830('0x1a')]=function(_0x3ad530,_0x4f2c64){return git['reset'](['--hard',_0xf830('0x1b')],function(_0x584098){if(_0x584098){logger[_0xf830('0x1c')](_0x584098);return _0x4f2c64[_0xf830('0x13')](0x1f4)['json'](_0x584098);}logger[_0xf830('0x17')](_0xf830('0x1d'));return _0x4f2c64['status'](0xc8)[_0xf830('0x14')]({'output':_0xf830('0x1e')});});};exports[_0xf830('0x1f')]=function(_0x1bbcea,_0x514618){exec(_0xf830('0x20'),function(_0x132478,_0x41a774,_0x57e629){logger[_0xf830('0x17')](_0x41a774);logger[_0xf830('0x17')](_0x57e629);if(_0x132478){logger[_0xf830('0x1c')](_0x132478);return _0x514618[_0xf830('0x13')](0x1f4)[_0xf830('0x14')](_0x132478);}return _0x514618['status'](0xc8)[_0xf830('0x14')]({'output':_0x41a774});});};exports[_0xf830('0x21')]=function(_0x2c88ba,_0x5098f9){return pm2[_0xf830('0x21')](_0xf830('0x22'))[_0xf830('0x23')](function(_0x2fc9fc){logger[_0xf830('0x17')](_0xf830('0x24'),_0x2fc9fc);return _0x5098f9['status'](0xc8)[_0xf830('0x14')]({'output':_0xf830('0x25')});})[_0xf830('0x26')](function(_0x20d31e){logger[_0xf830('0x1c')](_0x20d31e);return _0x5098f9[_0xf830('0x13')](0x1f4)[_0xf830('0x14')](_0x20d31e);});};exports[_0xf830('0x27')]=function(_0x1624f3,_0x2c7a5f){var _0x3e74a6=fs[_0xf830('0x28')](path[_0xf830('0x29')](config['root'],_0xf830('0x2a'),'migrations'));var _0x15d400=[];for(var _0x27f704=0x0;_0x27f704<_0x3e74a6[_0xf830('0x2b')];_0x27f704++){var _0x4c255d=_0x3e74a6[_0x27f704][_0xf830('0x2c')]('.js','');if(compareVersions(module[_0xf830('0xd')]['version'],_0x4c255d)===-0x1){_0x15d400[_0xf830('0x2d')](_0x4c255d);}}if(_0x15d400[_0xf830('0x2b')]){var _0x4d3b1f=_0x15d400[_0xf830('0x2e')](compareVersions);var _0x1c3601=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xf830('0x2f')],'modelName':_0xf830('0x2f'),'columnName':_0xf830('0xe')},'migrations':{'params':[db['sequelize'][_0xf830('0x30')](),db['sequelize'][_0xf830('0x31')],function(){throw new Error(_0xf830('0x32'));}],'path':path[_0xf830('0x29')](config['root'],_0xf830('0x2a'),_0xf830('0x27')),'pattern':/\.js$/}});_0x1c3601['up']({'migrations':_[_0xf830('0x33')](_0x4d3b1f,function(_0x230665){return _0x230665+_0xf830('0x34');})})[_0xf830('0x23')](function(){return _0x2c7a5f['status'](0xc8)[_0xf830('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xf830('0xd')][_0xf830('0xe')]+'\x20to\x20'+_[_0xf830('0x35')](_0x4d3b1f),'migrations':_[_0xf830('0x29')](_0x4d3b1f)});})[_0xf830('0x26')](function(_0x31c3b0){if(_0x31c3b0 instanceof db[_0xf830('0x36')][_0xf830('0x37')]){return _0x2c7a5f[_0xf830('0x13')](0xc8)['json']({'output':_0xf830('0x38')});}else{return _0x2c7a5f[_0xf830('0x13')](0x1f4)['json'](_0x31c3b0);}});}else{return _0x2c7a5f[_0xf830('0x13')](0xc8)[_0xf830('0x14')]({'output':_0xf830('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a9fdd11..d9c54cd 100644 --- a/server/api/voiceAgentReport/index.js +++ b/server/api/voiceAgentReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe4b=['update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','index','get','/describe','isAuthenticated','describe','post','/:id'];(function(_0x570162,_0xd8eb05){var _0x550058=function(_0x5a2edf){while(--_0x5a2edf){_0x570162['push'](_0x570162['shift']());}};_0x550058(++_0xd8eb05);}(_0xfe4b,0x158));var _0xbfe4=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xfe4b[_0x18fb16];return _0x147b0d;};'use strict';var multer=require(_0xbfe4('0x0'));var util=require(_0xbfe4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbfe4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbfe4('0x3'));var interaction=require(_0xbfe4('0x4'));var config=require('../../config/environment');var controller=require(_0xbfe4('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xbfe4('0x6')]);router[_0xbfe4('0x7')](_0xbfe4('0x8'),auth[_0xbfe4('0x9')](),controller[_0xbfe4('0xa')]);router['get']('/:id',auth[_0xbfe4('0x9')](),controller['show']);router[_0xbfe4('0xb')]('/',auth[_0xbfe4('0x9')](),controller['create']);router['put'](_0xbfe4('0xc'),auth['isAuthenticated'](),controller[_0xbfe4('0xd')]);router[_0xbfe4('0xe')](_0xbfe4('0xc'),auth['isAuthenticated'](),controller[_0xbfe4('0xf')]);module[_0xbfe4('0x10')]=router; \ No newline at end of file +var _0x72b3=['delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x257a0,_0x42d2b4){var _0x8a44ed=function(_0x51b193){while(--_0x51b193){_0x257a0['push'](_0x257a0['shift']());}};_0x8a44ed(++_0x42d2b4);}(_0x72b3,0x1a3));var _0x372b=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x72b3[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0x372b('0x0'));var util=require('util');var path=require(_0x372b('0x1'));var timeout=require(_0x372b('0x2'));var express=require(_0x372b('0x3'));var router=express['Router']();var fs_extra=require(_0x372b('0x4'));var auth=require(_0x372b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x372b('0x6'));var controller=require(_0x372b('0x7'));router['get']('/',auth[_0x372b('0x8')](),controller['index']);router[_0x372b('0x9')](_0x372b('0xa'),auth[_0x372b('0x8')](),controller[_0x372b('0xb')]);router[_0x372b('0x9')](_0x372b('0xc'),auth[_0x372b('0x8')](),controller[_0x372b('0xd')]);router[_0x372b('0xe')]('/',auth[_0x372b('0x8')](),controller[_0x372b('0xf')]);router[_0x372b('0x10')]('/:id',auth[_0x372b('0x8')](),controller[_0x372b('0x11')]);router[_0x372b('0x12')](_0x372b('0xc'),auth[_0x372b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3db6598..00e0075 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf2f=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x17bc6c,_0x5b8b2a){var _0x328bce=function(_0x582d8a){while(--_0x582d8a){_0x17bc6c['push'](_0x17bc6c['shift']());}};_0x328bce(++_0x5b8b2a);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x258f92,_0x55e889){_0x258f92=_0x258f92-0x0;var _0x47d6e2=_0xcf2f[_0x258f92];return _0x47d6e2;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'type':{'type':Sequelize[_0xfcf2('0x2')]},'uniqueid':{'type':Sequelize[_0xfcf2('0x2')]},'calleridnum':{'type':Sequelize[_0xfcf2('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xfcf2('0x2')]},'interface':{'type':Sequelize[_0xfcf2('0x2')]},'membername':{'type':Sequelize[_0xfcf2('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfcf2('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfcf2('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xfcf2('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfcf2('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfcf2('0x3')]},'holdtime':{'type':Sequelize[_0xfcf2('0x4')]},'agentcomplete':{'type':Sequelize[_0xfcf2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfcf2('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcf2('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfcf2('0x4')]},'agentacw':{'type':Sequelize[_0xfcf2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfcf2('0x2')]},'channelstate':{'type':Sequelize[_0xfcf2('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xfcf2('0x2')]},'connectedlinename':{'type':Sequelize[_0xfcf2('0x2')]},'language':{'type':Sequelize[_0xfcf2('0x2')]},'accountcode':{'type':Sequelize[_0xfcf2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfcf2('0x2')]},'destchannel':{'type':Sequelize[_0xfcf2('0x2')]},'destchannelstate':{'type':Sequelize[_0xfcf2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xfcf2('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfcf2('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xfcf2('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfcf2('0x2')]},'destpriority':{'type':Sequelize[_0xfcf2('0x2')]},'destuniqueid':{'type':Sequelize[_0xfcf2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfcf2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xfcf2('0x2')]},'transfer':{'type':Sequelize[_0xfcf2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfcf2('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xfcf2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfcf2('0x2')]},'agententerreason':{'type':Sequelize[_0xfcf2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb8a0=['BOOLEAN','STRING','DATE','INTEGER'];(function(_0x5b116b,_0x3a7ac0){var _0x376d4f=function(_0x10380d){while(--_0x10380d){_0x5b116b['push'](_0x5b116b['shift']());}};_0x376d4f(++_0x3a7ac0);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x12a645,_0x171786){_0x12a645=_0x12a645-0x0;var _0x5992b2=_0xb8a0[_0x12a645];return _0x5992b2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0b8a('0x0')]},'uniqueid':{'type':Sequelize[_0x0b8a('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0b8a('0x0')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x0b8a('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x0b8a('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x0b8a('0x1')]},'agentdumpAt':{'type':Sequelize[_0x0b8a('0x1')]},'holdtime':{'type':Sequelize[_0x0b8a('0x2')]},'agentcomplete':{'type':Sequelize[_0x0b8a('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0b8a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0b8a('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0b8a('0x2')]},'agentacw':{'type':Sequelize[_0x0b8a('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0b8a('0x2')]},'reason':{'type':Sequelize[_0x0b8a('0x0')]},'lastevent':{'type':Sequelize[_0x0b8a('0x0')]},'channel':{'type':Sequelize[_0x0b8a('0x0')]},'channelstate':{'type':Sequelize[_0x0b8a('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0b8a('0x0')]},'connectedlinenum':{'type':Sequelize[_0x0b8a('0x0')]},'connectedlinename':{'type':Sequelize[_0x0b8a('0x0')]},'language':{'type':Sequelize[_0x0b8a('0x0')]},'accountcode':{'type':Sequelize[_0x0b8a('0x0')]},'context':{'type':Sequelize[_0x0b8a('0x0')]},'exten':{'type':Sequelize[_0x0b8a('0x0')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x0b8a('0x0')]},'destchannelstate':{'type':Sequelize[_0x0b8a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x0b8a('0x0')]},'destcalleridnum':{'type':Sequelize[_0x0b8a('0x0')]},'destcalleridname':{'type':Sequelize[_0x0b8a('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x0b8a('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x0b8a('0x0')]},'destlanguage':{'type':Sequelize[_0x0b8a('0x0')]},'destaccountcode':{'type':Sequelize[_0x0b8a('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0b8a('0x0')]},'destpriority':{'type':Sequelize[_0x0b8a('0x0')]},'destuniqueid':{'type':Sequelize[_0x0b8a('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x0b8a('0x0')]},'transfer':{'type':Sequelize[_0x0b8a('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0b8a('0x0')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x0b8a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 4f1d8fa..f438094 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 7ec5e8f..ce362c3 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0ae=['destuniqueid','../../config/logger','api','bluebird','path','rimraf','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe0ae,0xa1));var _0xee0a=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0xe0ae[_0x5e238b];return _0x389bea;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var moment=require('moment');var BPromise=require(_0xee0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0a('0x3'));var rimraf=require(_0xee0a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x5'));module['exports']=function(_0x5bef07,_0x39a302){return _0x5bef07[_0xee0a('0x6')](_0xee0a('0x7'),attributes,{'tableName':_0xee0a('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xee0a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcea5=['api','moment','request-promise','path','rimraf','../../config/environment','exports','uniqueid','destuniqueid','lodash','util','../../config/logger'];(function(_0x5c81f1,_0x1aa542){var _0x351f17=function(_0x3aabc6){while(--_0x3aabc6){_0x5c81f1['push'](_0x5c81f1['shift']());}};_0x351f17(++_0x1aa542);}(_0xcea5,0xed));var _0x5cea=function(_0x220a48,_0x3d2004){_0x220a48=_0x220a48-0x0;var _0x4622ae=_0xcea5[_0x220a48];return _0x4622ae;};'use strict';var _=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var moment=require(_0x5cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cea('0x5'));var fs=require('fs');var path=require(_0x5cea('0x6'));var rimraf=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x5cea('0x9')]=function(_0x31e6f3,_0x599bc5){return _0x31e6f3['define']('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5cea('0xa'),_0x5cea('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 755d5b2..0d32373 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d52=['client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','update','body','where','attributes','limit','UpdateVoiceAgentReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4c24a0,_0x35db64){var _0xead592=function(_0x5c3595){while(--_0x5c3595){_0x4c24a0['push'](_0x4c24a0['shift']());}};_0xead592(++_0x35db64);}(_0x7d52,0x1b0));var _0x27d5=function(_0x174fe9,_0xb622a9){_0x174fe9=_0x174fe9-0x0;var _0x23c489=_0x7d52[_0x174fe9];return _0x23c489;};'use strict';var _=require('lodash');var util=require(_0x27d5('0x0'));var moment=require(_0x27d5('0x1'));var BPromise=require(_0x27d5('0x2'));var rs=require(_0x27d5('0x3'));var fs=require('fs');var Redis=require(_0x27d5('0x4'));var db=require(_0x27d5('0x5'))['db'];var utils=require(_0x27d5('0x6'));var logger=require(_0x27d5('0x7'))(_0x27d5('0x8'));var config=require(_0x27d5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x27d5('0xa')][_0x27d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x366148,_0x40be43,_0x59dc24){return new BPromise(function(_0x6a6706,_0x314d73){return client[_0x27d5('0xc')](_0x366148,_0x59dc24)[_0x27d5('0xd')](function(_0x1c6b4d){logger[_0x27d5('0xe')](_0x27d5('0xf'),_0x40be43,_0x27d5('0x10'));logger[_0x27d5('0x11')](_0x27d5('0x12'),_0x40be43,_0x27d5('0x10'),JSON[_0x27d5('0x13')](_0x1c6b4d));if(_0x1c6b4d[_0x27d5('0x14')]){if(_0x1c6b4d[_0x27d5('0x14')]['code']===0x1f4){logger[_0x27d5('0x14')](_0x27d5('0xf'),_0x40be43,_0x1c6b4d[_0x27d5('0x14')][_0x27d5('0x15')]);return _0x314d73(_0x1c6b4d['error'][_0x27d5('0x15')]);}logger[_0x27d5('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x40be43,_0x1c6b4d[_0x27d5('0x14')][_0x27d5('0x15')]);return _0x6a6706(_0x1c6b4d[_0x27d5('0x14')][_0x27d5('0x15')]);}else{logger[_0x27d5('0xe')](_0x27d5('0xf'),_0x40be43,_0x27d5('0x10'));_0x6a6706(_0x1c6b4d['result'][_0x27d5('0x15')]);}})[_0x27d5('0x16')](function(_0x419ee0){logger[_0x27d5('0x14')](_0x27d5('0xf'),_0x40be43,_0x419ee0);_0x314d73(_0x419ee0);});});}exports[_0x27d5('0x17')]=function(_0x306f44){var _0xb109e=this;return new Promise(function(_0x13853f,_0x249770){return db[_0x27d5('0x18')][_0x27d5('0x19')](_0x306f44['body'],{'raw':_0x306f44[_0x27d5('0x1a')]?_0x306f44[_0x27d5('0x1a')][_0x27d5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x338d8a){logger['info'](_0x27d5('0x17'),_0x306f44);logger[_0x27d5('0x11')](_0x27d5('0x17'),_0x306f44,JSON[_0x27d5('0x13')](_0x338d8a));_0x13853f(_0x338d8a);})[_0x27d5('0x16')](function(_0x40cbcb){logger[_0x27d5('0x14')](_0x27d5('0x17'),_0x40cbcb[_0x27d5('0x15')],_0x306f44);_0x249770(_0xb109e[_0x27d5('0x14')](0x1f4,_0x40cbcb[_0x27d5('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x525fa3){var _0x514417=this;return new Promise(function(_0x2fb6aa,_0x2644bd){return db[_0x27d5('0x18')][_0x27d5('0x1c')](_0x525fa3[_0x27d5('0x1d')],{'raw':_0x525fa3[_0x27d5('0x1a')]?_0x525fa3[_0x27d5('0x1a')][_0x27d5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525fa3[_0x27d5('0x1a')]?_0x525fa3[_0x27d5('0x1a')][_0x27d5('0x1e')]||null:null,'attributes':_0x525fa3[_0x27d5('0x1a')]?_0x525fa3[_0x27d5('0x1a')][_0x27d5('0x1f')]||null:null,'limit':_0x525fa3[_0x27d5('0x1a')]?_0x525fa3[_0x27d5('0x1a')][_0x27d5('0x20')]||null:null})[_0x27d5('0xd')](function(_0x249d51){logger[_0x27d5('0xe')]('UpdateVoiceAgentReport',_0x525fa3);logger[_0x27d5('0x11')](_0x27d5('0x21'),_0x525fa3,JSON[_0x27d5('0x13')](_0x249d51));_0x2fb6aa(_0x249d51);})[_0x27d5('0x16')](function(_0x27a7fe){logger[_0x27d5('0x14')](_0x27d5('0x21'),_0x27a7fe[_0x27d5('0x15')],_0x525fa3);_0x2644bd(_0x514417[_0x27d5('0x14')](0x1f4,_0x27a7fe[_0x27d5('0x15')]));});});}; \ No newline at end of file +var _0xc6c8=['jayson/promise','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','options','raw','then','UpdateVoiceAgentReport','VoiceAgentReport','update','body','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5c8960,_0x7b3733){var _0xca45c7=function(_0x43b7ce){while(--_0x43b7ce){_0x5c8960['push'](_0x5c8960['shift']());}};_0xca45c7(++_0x7b3733);}(_0xc6c8,0x16c));var _0x8c6c=function(_0x477ced,_0x4819bd){_0x477ced=_0x477ced-0x0;var _0xfc6205=_0xc6c8[_0x477ced];return _0xfc6205;};'use strict';var _=require('lodash');var util=require(_0x8c6c('0x0'));var moment=require('moment');var BPromise=require(_0x8c6c('0x1'));var rs=require(_0x8c6c('0x2'));var fs=require('fs');var Redis=require(_0x8c6c('0x3'));var db=require(_0x8c6c('0x4'))['db'];var utils=require(_0x8c6c('0x5'));var logger=require(_0x8c6c('0x6'))('rpc');var config=require(_0x8c6c('0x7'));var jayson=require(_0x8c6c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a94e,_0x13e1ad,_0x7fe9c5){return new BPromise(function(_0x507b84,_0x818a60){return client[_0x8c6c('0x9')](_0x19a94e,_0x7fe9c5)['then'](function(_0x1453b2){logger[_0x8c6c('0xa')](_0x8c6c('0xb'),_0x13e1ad,_0x8c6c('0xc'));logger[_0x8c6c('0xd')](_0x8c6c('0xe'),_0x13e1ad,_0x8c6c('0xc'),JSON[_0x8c6c('0xf')](_0x1453b2));if(_0x1453b2[_0x8c6c('0x10')]){if(_0x1453b2[_0x8c6c('0x10')][_0x8c6c('0x11')]===0x1f4){logger[_0x8c6c('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x13e1ad,_0x1453b2['error'][_0x8c6c('0x12')]);return _0x818a60(_0x1453b2[_0x8c6c('0x10')]['message']);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x13e1ad,_0x1453b2[_0x8c6c('0x10')]['message']);return _0x507b84(_0x1453b2[_0x8c6c('0x10')]['message']);}else{logger[_0x8c6c('0xa')](_0x8c6c('0xb'),_0x13e1ad,_0x8c6c('0xc'));_0x507b84(_0x1453b2[_0x8c6c('0x13')][_0x8c6c('0x12')]);}})[_0x8c6c('0x14')](function(_0x1183d9){logger[_0x8c6c('0x10')](_0x8c6c('0xb'),_0x13e1ad,_0x1183d9);_0x818a60(_0x1183d9);});});}exports[_0x8c6c('0x15')]=function(_0x14eb67){var _0xbdd86c=this;return new Promise(function(_0x2928e7,_0x5d67f5){return db['VoiceAgentReport'][_0x8c6c('0x16')](_0x14eb67['body'],{'raw':_0x14eb67[_0x8c6c('0x17')]?_0x14eb67[_0x8c6c('0x17')][_0x8c6c('0x18')]===undefined?!![]:![]:!![]})[_0x8c6c('0x19')](function(_0x1ff91a){logger[_0x8c6c('0xa')](_0x8c6c('0x15'),_0x14eb67);logger[_0x8c6c('0xd')](_0x8c6c('0x15'),_0x14eb67,JSON[_0x8c6c('0xf')](_0x1ff91a));_0x2928e7(_0x1ff91a);})[_0x8c6c('0x14')](function(_0x486b7f){logger[_0x8c6c('0x10')]('CreateVoiceAgentReport',_0x486b7f[_0x8c6c('0x12')],_0x14eb67);_0x5d67f5(_0xbdd86c[_0x8c6c('0x10')](0x1f4,_0x486b7f[_0x8c6c('0x12')]));});});};exports[_0x8c6c('0x1a')]=function(_0x32d73d){var _0x3423df=this;return new Promise(function(_0x1cfaca,_0x2a5383){return db[_0x8c6c('0x1b')][_0x8c6c('0x1c')](_0x32d73d[_0x8c6c('0x1d')],{'raw':_0x32d73d['options']?_0x32d73d[_0x8c6c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32d73d[_0x8c6c('0x17')]?_0x32d73d['options']['where']||null:null,'attributes':_0x32d73d[_0x8c6c('0x17')]?_0x32d73d[_0x8c6c('0x17')][_0x8c6c('0x1e')]||null:null,'limit':_0x32d73d[_0x8c6c('0x17')]?_0x32d73d[_0x8c6c('0x17')]['limit']||null:null})[_0x8c6c('0x19')](function(_0x40fda4){logger[_0x8c6c('0xa')](_0x8c6c('0x1a'),_0x32d73d);logger[_0x8c6c('0xd')](_0x8c6c('0x1a'),_0x32d73d,JSON[_0x8c6c('0xf')](_0x40fda4));_0x1cfaca(_0x40fda4);})[_0x8c6c('0x14')](function(_0x475e87){logger[_0x8c6c('0x10')](_0x8c6c('0x1a'),_0x475e87[_0x8c6c('0x12')],_0x32d73d);_0x2a5383(_0x3423df['error'](0x1f4,_0x475e87['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index e7220b5..12696bb 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x154e7f,_0x4dd4a0){_0x154e7f=_0x154e7f-0x0;var _0x156ee4=_0xdbf5[_0x154e7f];return _0x156ee4;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0xd')]('/',auth[_0x5dbf('0x9')](),controller['create']);router[_0x5dbf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['delete']('/:id',auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0x10')]=router; \ No newline at end of file +var _0xed1f=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update'];(function(_0x14e393,_0x5ef7b3){var _0x5b5ffa=function(_0x133c89){while(--_0x133c89){_0x14e393['push'](_0x14e393['shift']());}};_0x5b5ffa(++_0x5ef7b3);}(_0xed1f,0x6a));var _0xfed1=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xed1f[_0x45783c];return _0x1161da;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),auth[_0xfed1('0xc')](),controller[_0xfed1('0xf')]);router['get'](_0xfed1('0x10'),auth[_0xfed1('0xc')](),controller['show']);router[_0xfed1('0x11')]('/',auth[_0xfed1('0xc')](),controller['create']);router[_0xfed1('0x12')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x13')]);router['delete']('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4bf6bdc..355ff04 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e6e=['dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax'];(function(_0x497b24,_0xf366ec){var _0x1c4b69=function(_0x56f500){while(--_0x56f500){_0x497b24['push'](_0x497b24['shift']());}};_0x1c4b69(++_0xf366ec);}(_0x4e6e,0x70));var _0xe4e6=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x4e6e[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require('sequelize');module[_0xe4e6('0x0')]={'uniqueid':{'type':Sequelize[_0xe4e6('0x1')]},'type':{'type':Sequelize[_0xe4e6('0x2')](_0xe4e6('0x3'),_0xe4e6('0x4'),_0xe4e6('0x5'),_0xe4e6('0x6'),_0xe4e6('0x7'),_0xe4e6('0x8'))},'tag':{'type':Sequelize[_0xe4e6('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xe4e6('0x1')]},'destinationcontext':{'type':Sequelize[_0xe4e6('0x1')]},'callerid':{'type':Sequelize[_0xe4e6('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xe4e6('0x9')]},'starttime':{'type':Sequelize[_0xe4e6('0xa')]},'systemanswertime':{'type':Sequelize[_0xe4e6('0xa')]},'answertime':{'type':Sequelize[_0xe4e6('0xa')]},'endtime':{'type':Sequelize[_0xe4e6('0xa')]},'duration':{'type':Sequelize[_0xe4e6('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xe4e6('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe4e6('0x1')]},'amaflags':{'type':Sequelize[_0xe4e6('0x1')]},'userfield':{'type':Sequelize[_0xe4e6('0x1')]},'userDisposition':{'type':Sequelize[_0xe4e6('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xe4e6('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xe4e6('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xe4e6('0x1')]}}; \ No newline at end of file +var _0x1eba=['INTEGER','sequelize','exports','STRING','ENUM','inbound','inbound-fax','outbound-fax','dialer','DATE'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x1eba[_0x460150];return _0x340677;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'uniqueid':{'type':Sequelize[_0xa1eb('0x2')]},'type':{'type':Sequelize[_0xa1eb('0x3')](_0xa1eb('0x4'),'internal','outbound',_0xa1eb('0x5'),_0xa1eb('0x6'),_0xa1eb('0x7'))},'tag':{'type':Sequelize[_0xa1eb('0x2')]},'accountcode':{'type':Sequelize[_0xa1eb('0x2')]},'source':{'type':Sequelize[_0xa1eb('0x2')]},'destination':{'type':Sequelize[_0xa1eb('0x2')]},'destinationcontext':{'type':Sequelize[_0xa1eb('0x2')]},'callerid':{'type':Sequelize[_0xa1eb('0x2')]},'channel':{'type':Sequelize[_0xa1eb('0x2')]},'destinationchannel':{'type':Sequelize[_0xa1eb('0x2')]},'lastapplication':{'type':Sequelize[_0xa1eb('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xa1eb('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa1eb('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xa1eb('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa1eb('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xa1eb('0x2')]},'userfield':{'type':Sequelize[_0xa1eb('0x2')]},'userDisposition':{'type':Sequelize[_0xa1eb('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xa1eb('0x2')]},'note':{'type':Sequelize[_0xa1eb('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xa1eb('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index db003b9..c5ab972 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x2ef3,0xba));var _0x32ef=function(_0x5c2768,_0x1076a2){_0x5c2768=_0x5c2768-0x0;var _0x3917e2=_0x2ef3[_0x5c2768];return _0x3917e2;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 9ffb122..88d5c3c 100644 --- a/server/api/voiceCallReport/voiceCallReport.model.js +++ b/server/api/voiceCallReport/voiceCallReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9f9=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf9f9,0x15b));var _0x9f9f=function(_0x2e32dc,_0x15998e){_0x2e32dc=_0x2e32dc-0x0;var _0x311e74=_0xf9f9[_0x2e32dc];return _0x311e74;};'use strict';var _=require(_0x9f9f('0x0'));var util=require('util');var logger=require(_0x9f9f('0x1'))(_0x9f9f('0x2'));var moment=require(_0x9f9f('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f9f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f9f('0x5'));var config=require(_0x9f9f('0x6'));var attributes=require(_0x9f9f('0x7'));module[_0x9f9f('0x8')]=function(_0x42f74b,_0x51010f){return _0x42f74b['define'](_0x9f9f('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x9f9f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0xb458,0x10a));var _0x8b45=function(_0x36ca99,_0x1416c6){_0x36ca99=_0x36ca99-0x0;var _0x1d7cba=_0xb458[_0x36ca99];return _0x1d7cba;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))(_0x8b45('0x3'));var moment=require(_0x8b45('0x4'));var BPromise=require(_0x8b45('0x5'));var rp=require(_0x8b45('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b45('0x7'));var attributes=require(_0x8b45('0x8'));module[_0x8b45('0x9')]=function(_0xbe2a58,_0x5cebbf){return _0xbe2a58[_0x8b45('0xa')](_0x8b45('0xb'),attributes,{'tableName':_0x8b45('0xc'),'paranoid':![],'indexes':[{'fields':[_0x8b45('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 154fdb3..3c0b101 100644 --- a/server/api/voiceCallReport/voiceCallReport.rpc.js +++ b/server/api/voiceCallReport/voiceCallReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2919=['debug','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','include','map','model','CreateVoiceCallReport','create','body','raw','stringify','update','limit','UpdateVoiceCallReport','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent'];(function(_0x24e975,_0x21b458){var _0x307a11=function(_0x5bda93){while(--_0x5bda93){_0x24e975['push'](_0x24e975['shift']());}};_0x307a11(++_0x21b458);}(_0x2919,0x119));var _0x9291=function(_0x5a259e,_0x1fb3d2){_0x5a259e=_0x5a259e-0x0;var _0x29bbae=_0x2919[_0x5a259e];return _0x29bbae;};'use strict';var _=require(_0x9291('0x0'));var util=require(_0x9291('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9291('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9291('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9291('0x4'))(_0x9291('0x5'));var config=require(_0x9291('0x6'));var jayson=require(_0x9291('0x7'));var client=jayson[_0x9291('0x8')][_0x9291('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29d4a2,_0xa54c4b,_0x28a6d3){return new BPromise(function(_0x2cccce,_0x1a933d){return client[_0x9291('0xa')](_0x29d4a2,_0x28a6d3)[_0x9291('0xb')](function(_0x13f0fa){logger[_0x9291('0xc')](_0x9291('0xd'),_0xa54c4b,_0x9291('0xe'));logger[_0x9291('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0xa54c4b,_0x9291('0xe'),JSON['stringify'](_0x13f0fa));if(_0x13f0fa[_0x9291('0x10')]){if(_0x13f0fa['error'][_0x9291('0x11')]===0x1f4){logger['error'](_0x9291('0xd'),_0xa54c4b,_0x13f0fa[_0x9291('0x10')][_0x9291('0x12')]);return _0x1a933d(_0x13f0fa[_0x9291('0x10')][_0x9291('0x12')]);}logger[_0x9291('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0xa54c4b,_0x13f0fa[_0x9291('0x10')]['message']);return _0x2cccce(_0x13f0fa[_0x9291('0x10')][_0x9291('0x12')]);}else{logger['info'](_0x9291('0xd'),_0xa54c4b,_0x9291('0xe'));_0x2cccce(_0x13f0fa['result'][_0x9291('0x12')]);}})[_0x9291('0x13')](function(_0x2716ec){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0xa54c4b,_0x2716ec);_0x1a933d(_0x2716ec);});});}exports[_0x9291('0x14')]=function(_0xd7f5f1){var _0x340e1f=this;return new Promise(function(_0x5f1d21,_0x158b03){return db[_0x9291('0x15')][_0x9291('0x16')]({'raw':_0xd7f5f1['options']?_0xd7f5f1[_0x9291('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd7f5f1[_0x9291('0x17')]?_0xd7f5f1[_0x9291('0x17')][_0x9291('0x18')]||null:null,'attributes':_0xd7f5f1[_0x9291('0x17')]?_0xd7f5f1['options'][_0x9291('0x19')]||null:null,'limit':_0xd7f5f1[_0x9291('0x17')]?_0xd7f5f1[_0x9291('0x17')]['limit']||null:null,'include':_0xd7f5f1[_0x9291('0x17')]?_0xd7f5f1['options'][_0x9291('0x1a')]?_[_0x9291('0x1b')](_0xd7f5f1[_0x9291('0x17')][_0x9291('0x1a')],function(_0x523748){return{'model':db[_0x523748[_0x9291('0x1c')]],'as':_0x523748['as'],'attributes':_0x523748[_0x9291('0x19')],'include':_0x523748[_0x9291('0x1a')]?_[_0x9291('0x1b')](_0x523748[_0x9291('0x1a')],function(_0x45def2){return{'model':db[_0x45def2[_0x9291('0x1c')]],'as':_0x45def2['as'],'attributes':_0x45def2[_0x9291('0x19')],'include':_0x45def2[_0x9291('0x1a')]?_[_0x9291('0x1b')](_0x45def2[_0x9291('0x1a')],function(_0x3c9880){return{'model':db[_0x3c9880['model']],'as':_0x3c9880['as'],'attributes':_0x3c9880[_0x9291('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9291('0xb')](function(_0x1d8199){logger['info'](_0x9291('0x14'),_0xd7f5f1);logger['debug'](_0x9291('0x14'),_0xd7f5f1,JSON['stringify'](_0x1d8199));_0x5f1d21(_0x1d8199);})[_0x9291('0x13')](function(_0x21688f){logger[_0x9291('0x10')](_0x9291('0x14'),_0x21688f[_0x9291('0x12')],_0xd7f5f1);_0x158b03(_0x340e1f['error'](0x1f4,_0x21688f[_0x9291('0x12')]));});});};exports[_0x9291('0x1d')]=function(_0x1177f5){var _0x5f2b05=this;return new Promise(function(_0x35dd67,_0x398ccb){return db[_0x9291('0x15')][_0x9291('0x1e')](_0x1177f5[_0x9291('0x1f')],{'raw':_0x1177f5['options']?_0x1177f5['options'][_0x9291('0x20')]===undefined?!![]:![]:!![]})[_0x9291('0xb')](function(_0x261d56){logger[_0x9291('0xc')](_0x9291('0x1d'),_0x1177f5);logger[_0x9291('0xf')](_0x9291('0x1d'),_0x1177f5,JSON[_0x9291('0x21')](_0x261d56));_0x35dd67(_0x261d56);})['catch'](function(_0x516995){logger['error'](_0x9291('0x1d'),_0x516995[_0x9291('0x12')],_0x1177f5);_0x398ccb(_0x5f2b05[_0x9291('0x10')](0x1f4,_0x516995[_0x9291('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x4aeeff){var _0x2780a8=this;return new Promise(function(_0x2761f0,_0x5a6ce4){return db[_0x9291('0x15')][_0x9291('0x22')](_0x4aeeff[_0x9291('0x1f')],{'raw':_0x4aeeff[_0x9291('0x17')]?_0x4aeeff[_0x9291('0x17')][_0x9291('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aeeff[_0x9291('0x17')]?_0x4aeeff[_0x9291('0x17')]['where']||null:null,'attributes':_0x4aeeff['options']?_0x4aeeff[_0x9291('0x17')][_0x9291('0x19')]||null:null,'limit':_0x4aeeff[_0x9291('0x17')]?_0x4aeeff['options'][_0x9291('0x23')]||null:null})['then'](function(_0x198233){logger['info']('UpdateVoiceCallReport',_0x4aeeff);logger[_0x9291('0xf')](_0x9291('0x24'),_0x4aeeff,JSON['stringify'](_0x198233));_0x2761f0(_0x198233);})[_0x9291('0x13')](function(_0x1bce8e){logger[_0x9291('0x10')](_0x9291('0x24'),_0x1bce8e[_0x9291('0x12')],_0x4aeeff);_0x5a6ce4(_0x2780a8['error'](0x1f4,_0x1bce8e['message']));});});}; \ No newline at end of file +var _0x4dfc=['update','where','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','then','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport'];(function(_0x36c6cd,_0x2fafd1){var _0x1329db=function(_0x12b477){while(--_0x12b477){_0x36c6cd['push'](_0x36c6cd['shift']());}};_0x1329db(++_0x2fafd1);}(_0x4dfc,0xe0));var _0xc4df=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x4dfc[_0x1ae4a9];return _0x54d0b0;};'use strict';var _=require(_0xc4df('0x0'));var util=require(_0xc4df('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc4df('0x2'));var logger=require(_0xc4df('0x3'))(_0xc4df('0x4'));var config=require(_0xc4df('0x5'));var jayson=require(_0xc4df('0x6'));var client=jayson[_0xc4df('0x7')][_0xc4df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x253b64,_0x42ab78,_0x12fde5){return new BPromise(function(_0x1e2f5b,_0x1ffad8){return client[_0xc4df('0x9')](_0x253b64,_0x12fde5)['then'](function(_0x29b92b){logger[_0xc4df('0xa')](_0xc4df('0xb'),_0x42ab78,_0xc4df('0xc'));logger[_0xc4df('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x42ab78,_0xc4df('0xc'),JSON[_0xc4df('0xe')](_0x29b92b));if(_0x29b92b[_0xc4df('0xf')]){if(_0x29b92b['error'][_0xc4df('0x10')]===0x1f4){logger[_0xc4df('0xf')](_0xc4df('0xb'),_0x42ab78,_0x29b92b['error'][_0xc4df('0x11')]);return _0x1ffad8(_0x29b92b['error'][_0xc4df('0x11')]);}logger[_0xc4df('0xf')](_0xc4df('0xb'),_0x42ab78,_0x29b92b['error'][_0xc4df('0x11')]);return _0x1e2f5b(_0x29b92b[_0xc4df('0xf')][_0xc4df('0x11')]);}else{logger['info'](_0xc4df('0xb'),_0x42ab78,_0xc4df('0xc'));_0x1e2f5b(_0x29b92b[_0xc4df('0x12')]['message']);}})[_0xc4df('0x13')](function(_0xef0c97){logger[_0xc4df('0xf')](_0xc4df('0xb'),_0x42ab78,_0xef0c97);_0x1ffad8(_0xef0c97);});});}exports['GetVoiceCallReport']=function(_0x569f37){var _0x204d23=this;return new Promise(function(_0x438cfe,_0x3316b6){return db[_0xc4df('0x14')][_0xc4df('0x15')]({'raw':_0x569f37[_0xc4df('0x16')]?_0x569f37['options'][_0xc4df('0x17')]===undefined?!![]:![]:!![],'where':_0x569f37[_0xc4df('0x16')]?_0x569f37[_0xc4df('0x16')]['where']||null:null,'attributes':_0x569f37['options']?_0x569f37[_0xc4df('0x16')][_0xc4df('0x18')]||null:null,'limit':_0x569f37[_0xc4df('0x16')]?_0x569f37['options'][_0xc4df('0x19')]||null:null,'include':_0x569f37['options']?_0x569f37[_0xc4df('0x16')][_0xc4df('0x1a')]?_[_0xc4df('0x1b')](_0x569f37[_0xc4df('0x16')][_0xc4df('0x1a')],function(_0x183676){return{'model':db[_0x183676[_0xc4df('0x1c')]],'as':_0x183676['as'],'attributes':_0x183676[_0xc4df('0x18')],'include':_0x183676[_0xc4df('0x1a')]?_[_0xc4df('0x1b')](_0x183676[_0xc4df('0x1a')],function(_0x2e7a62){return{'model':db[_0x2e7a62[_0xc4df('0x1c')]],'as':_0x2e7a62['as'],'attributes':_0x2e7a62[_0xc4df('0x18')],'include':_0x2e7a62[_0xc4df('0x1a')]?_[_0xc4df('0x1b')](_0x2e7a62[_0xc4df('0x1a')],function(_0x1c182b){return{'model':db[_0x1c182b[_0xc4df('0x1c')]],'as':_0x1c182b['as'],'attributes':_0x1c182b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc4df('0x1d')](function(_0x1283dd){logger[_0xc4df('0xa')](_0xc4df('0x1e'),_0x569f37);logger[_0xc4df('0xd')](_0xc4df('0x1e'),_0x569f37,JSON['stringify'](_0x1283dd));_0x438cfe(_0x1283dd);})['catch'](function(_0x1b54de){logger[_0xc4df('0xf')](_0xc4df('0x1e'),_0x1b54de['message'],_0x569f37);_0x3316b6(_0x204d23[_0xc4df('0xf')](0x1f4,_0x1b54de[_0xc4df('0x11')]));});});};exports[_0xc4df('0x1f')]=function(_0x1c47aa){var _0x51f083=this;return new Promise(function(_0xf42600,_0x3e69a0){return db['VoiceCallReport'][_0xc4df('0x20')](_0x1c47aa[_0xc4df('0x21')],{'raw':_0x1c47aa[_0xc4df('0x16')]?_0x1c47aa['options'][_0xc4df('0x17')]===undefined?!![]:![]:!![]})[_0xc4df('0x1d')](function(_0x293b3e){logger[_0xc4df('0xa')](_0xc4df('0x1f'),_0x1c47aa);logger[_0xc4df('0xd')](_0xc4df('0x1f'),_0x1c47aa,JSON[_0xc4df('0xe')](_0x293b3e));_0xf42600(_0x293b3e);})['catch'](function(_0xe1ee97){logger['error']('CreateVoiceCallReport',_0xe1ee97['message'],_0x1c47aa);_0x3e69a0(_0x51f083[_0xc4df('0xf')](0x1f4,_0xe1ee97[_0xc4df('0x11')]));});});};exports[_0xc4df('0x22')]=function(_0x8084b7){var _0x4bca22=this;return new Promise(function(_0xb00a18,_0x5768e8){return db[_0xc4df('0x14')][_0xc4df('0x23')](_0x8084b7[_0xc4df('0x21')],{'raw':_0x8084b7['options']?_0x8084b7[_0xc4df('0x16')][_0xc4df('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8084b7[_0xc4df('0x16')]?_0x8084b7[_0xc4df('0x16')][_0xc4df('0x24')]||null:null,'attributes':_0x8084b7['options']?_0x8084b7[_0xc4df('0x16')][_0xc4df('0x18')]||null:null,'limit':_0x8084b7['options']?_0x8084b7[_0xc4df('0x16')][_0xc4df('0x19')]||null:null})[_0xc4df('0x1d')](function(_0x500d27){logger[_0xc4df('0xa')](_0xc4df('0x22'),_0x8084b7);logger['debug']('UpdateVoiceCallReport',_0x8084b7,JSON[_0xc4df('0xe')](_0x500d27));_0xb00a18(_0x500d27);})[_0xc4df('0x13')](function(_0x506c60){logger['error'](_0xc4df('0x22'),_0x506c60['message'],_0x8084b7);_0x5768e8(_0x4bca22[_0xc4df('0xf')](0x1f4,_0x506c60['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a0594ff..888b1b9 100644 --- a/server/api/voiceChanSpy/index.js +++ b/server/api/voiceChanSpy/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9404=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x827aa3,_0x27fb44){var _0x38c625=function(_0x38154f){while(--_0x38154f){_0x827aa3['push'](_0x827aa3['shift']());}};_0x38c625(++_0x27fb44);}(_0x9404,0x1e6));var _0x4940=function(_0x3087b2,_0x3310bf){_0x3087b2=_0x3087b2-0x0;var _0x47dcb8=_0x9404[_0x3087b2];return _0x47dcb8;};'use strict';var multer=require(_0x4940('0x0'));var util=require(_0x4940('0x1'));var path=require(_0x4940('0x2'));var timeout=require(_0x4940('0x3'));var express=require(_0x4940('0x4'));var router=express[_0x4940('0x5')]();var fs_extra=require(_0x4940('0x6'));var auth=require(_0x4940('0x7'));var interaction=require(_0x4940('0x8'));var config=require(_0x4940('0x9'));var controller=require(_0x4940('0xa'));router[_0x4940('0xb')]('/',auth[_0x4940('0xc')](),controller['index']);router[_0x4940('0xb')](_0x4940('0xd'),auth[_0x4940('0xc')](),controller[_0x4940('0xe')]);router[_0x4940('0xf')]('/',auth[_0x4940('0xc')](),controller['create']);router[_0x4940('0x10')](_0x4940('0xd'),auth[_0x4940('0xc')](),controller[_0x4940('0x11')]);router[_0x4940('0x12')](_0x4940('0xd'),auth[_0x4940('0xc')](),controller[_0x4940('0x13')]);module[_0x4940('0x14')]=router; \ No newline at end of file +var _0xbb57=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x29f1b5,_0x19ac42){var _0x5bcfbd=function(_0x126629){while(--_0x126629){_0x29f1b5['push'](_0x29f1b5['shift']());}};_0x5bcfbd(++_0x19ac42);}(_0xbb57,0x1cd));var _0x7bb5=function(_0x653c97,_0x22d211){_0x653c97=_0x653c97-0x0;var _0x25e178=_0xbb57[_0x653c97];return _0x25e178;};'use strict';var multer=require(_0x7bb5('0x0'));var util=require(_0x7bb5('0x1'));var path=require(_0x7bb5('0x2'));var timeout=require(_0x7bb5('0x3'));var express=require('express');var router=express[_0x7bb5('0x4')]();var fs_extra=require(_0x7bb5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7bb5('0x6'));var controller=require(_0x7bb5('0x7'));router[_0x7bb5('0x8')]('/',auth[_0x7bb5('0x9')](),controller[_0x7bb5('0xa')]);router[_0x7bb5('0x8')](_0x7bb5('0xb'),auth[_0x7bb5('0x9')](),controller[_0x7bb5('0xc')]);router['post']('/',auth[_0x7bb5('0x9')](),controller[_0x7bb5('0xd')]);router['put']('/:id',auth[_0x7bb5('0x9')](),controller[_0x7bb5('0xe')]);router[_0x7bb5('0xf')](_0x7bb5('0xb'),auth['isAuthenticated'](),controller[_0x7bb5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 04f62f6..00fd79f 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.attributes.js +++ b/server/api/voiceChanSpy/voiceChanSpy.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02e4=['split','BOOLEAN','exports','STRING','name','options','join','getDataValue'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x02e4,0xca));var _0x402e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x02e4[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x402e('0x0')]={'name':{'type':Sequelize[_0x402e('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x402e('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x402e('0x1')],'set':function(_0x497bf5){this['setDataValue'](_0x402e('0x3'),_0x497bf5?_0x497bf5[_0x402e('0x4')](''):[]);},'get':function(){return this[_0x402e('0x5')](_0x402e('0x3'))?this[_0x402e('0x5')](_0x402e('0x3'))[_0x402e('0x6')](''):[];}},'auth':{'type':Sequelize[_0x402e('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x402e('0x1')]},'record':{'type':Sequelize[_0x402e('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x402e('0x1')]},'description':{'type':Sequelize[_0x402e('0x1')]}}; \ No newline at end of file +var _0xd876=['BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue','split'];(function(_0x2b9639,_0x51b16e){var _0xe948a1=function(_0x16a64e){while(--_0x16a64e){_0x2b9639['push'](_0x2b9639['shift']());}};_0xe948a1(++_0x51b16e);}(_0xd876,0x17b));var _0x6d87=function(_0x58261a,_0x8bc48){_0x58261a=_0x58261a-0x0;var _0x32c65e=_0xd876[_0x58261a];return _0x32c65e;};'use strict';var Sequelize=require(_0x6d87('0x0'));module[_0x6d87('0x1')]={'name':{'type':Sequelize[_0x6d87('0x2')]},'prefix':{'type':Sequelize[_0x6d87('0x2')],'unique':_0x6d87('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6d87('0x2')],'set':function(_0x460151){this['setDataValue'](_0x6d87('0x4'),_0x460151?_0x460151[_0x6d87('0x5')](''):[]);},'get':function(){return this[_0x6d87('0x6')](_0x6d87('0x4'))?this['getDataValue']('options')[_0x6d87('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6d87('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6d87('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d87('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index c45a223..fc0e843 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.controller.js +++ b/server/api/voiceChanSpy/voiceChanSpy.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x402f=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','map','VoiceChanSpy','rawAttributes','type','key','model','query'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x402f,0x6f));var _0xf402=function(_0x17c53a,_0x2d876c){_0x17c53a=_0x17c53a-0x0;var _0x4d3b39=_0x402f[_0x17c53a];return _0x4d3b39;};'use strict';var emlformat=require(_0xf402('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf402('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf402('0x2'));var BPromise=require(_0xf402('0x3'));var Mustache=require(_0xf402('0x4'));var util=require('util');var path=require(_0xf402('0x5'));var sox=require('sox');var csv=require(_0xf402('0x6'));var ejs=require(_0xf402('0x7'));var fs=require('fs');var fs_extra=require(_0xf402('0x8'));var _=require(_0xf402('0x9'));var squel=require(_0xf402('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf402('0xb'));var toCsv=require(_0xf402('0x6'));var querystring=require(_0xf402('0xc'));var Papa=require(_0xf402('0xd'));var Redis=require(_0xf402('0xe'));var authService=require(_0xf402('0xf'));var qs=require(_0xf402('0x10'));var as=require(_0xf402('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf402('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46758d,_0x4f8073){_0x4f8073=_0x4f8073||0xcc;return function(_0x5c127f){if(_0x5c127f){return _0x46758d['sendStatus'](_0x4f8073);}return _0x46758d[_0xf402('0x13')](_0x4f8073)['end']();};}function respondWithResult(_0x2ff50e,_0xb3deb6){_0xb3deb6=_0xb3deb6||0xc8;return function(_0x1ce72a){if(_0x1ce72a){return _0x2ff50e[_0xf402('0x13')](_0xb3deb6)['json'](_0x1ce72a);}};}function respondWithFilteredResult(_0x16767b,_0x4baaec){return function(_0x3af9e3){if(_0x3af9e3){var _0x5e38d8=typeof _0x4baaec['offset']==='undefined'&&typeof _0x4baaec[_0xf402('0x14')]===_0xf402('0x15');var _0xd406bf=_0x3af9e3[_0xf402('0x16')];var _0x2fbe36=_0x5e38d8?0x0:_0x4baaec[_0xf402('0x17')];var _0x3ed3eb=_0x5e38d8?_0x3af9e3[_0xf402('0x16')]:_0x4baaec[_0xf402('0x17')]+_0x4baaec[_0xf402('0x14')];var _0x5bb928;if(_0x3ed3eb>=_0xd406bf){_0x3ed3eb=_0xd406bf;_0x5bb928=0xc8;}else{_0x5bb928=0xce;}_0x16767b[_0xf402('0x13')](_0x5bb928);return _0x16767b[_0xf402('0x18')](_0xf402('0x19'),_0x2fbe36+'-'+_0x3ed3eb+'/'+_0xd406bf)[_0xf402('0x1a')](_0x3af9e3);}return null;};}function patchUpdates(_0x3d3ed4){return function(_0x30f661){try{jsonpatch[_0xf402('0x1b')](_0x30f661,_0x3d3ed4,!![]);}catch(_0xf52248){return BPromise[_0xf402('0x1c')](_0xf52248);}return _0x30f661['save']();};}function saveUpdates(_0x3cfe38,_0x4ffe46){return function(_0x297a68){if(_0x297a68){return _0x297a68[_0xf402('0x1d')](_0x3cfe38)[_0xf402('0x1e')](function(_0x477709){return _0x477709;});}return null;};}function removeEntity(_0x20dca1,_0x9cbd83){return function(_0x1b8064){if(_0x1b8064){return _0x1b8064[_0xf402('0x1f')]()[_0xf402('0x1e')](function(){var _0x427173=_0x1b8064[_0xf402('0x20')]({'plain':!![]});var _0xfad629='ChanSpies';return db[_0xf402('0x21')][_0xf402('0x1f')]({'where':{'type':_0xfad629,'resourceId':_0x427173['id']}})[_0xf402('0x1e')](function(){return _0x1b8064;});})[_0xf402('0x1e')](function(){_0x20dca1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e26d3,_0x3f837e){return function(_0x3a6a8d){if(!_0x3a6a8d){_0x3e26d3[_0xf402('0x22')](0x194);}return _0x3a6a8d;};}function handleError(_0x32f1dc,_0x496d66){_0x496d66=_0x496d66||0x1f4;return function(_0x39a38a){logger['error'](_0x39a38a[_0xf402('0x23')]);if(_0x39a38a[_0xf402('0x24')]){delete _0x39a38a[_0xf402('0x24')];}_0x32f1dc[_0xf402('0x13')](_0x496d66)[_0xf402('0x25')](_0x39a38a);};}exports['index']=function(_0xaeda0f,_0x3720c6){var _0x10f130={},_0x5bb711={},_0x4d86bd={'count':0x0,'rows':[]};var _0x3ffab6=_[_0xf402('0x26')](db[_0xf402('0x27')][_0xf402('0x28')],function(_0x162cce){return{'name':_0x162cce['fieldName'],'type':_0x162cce[_0xf402('0x29')][_0xf402('0x2a')]};});_0x5bb711[_0xf402('0x2b')]=_[_0xf402('0x26')](_0x3ffab6,_0xf402('0x24'));_0x5bb711[_0xf402('0x2c')]=_['keys'](_0xaeda0f[_0xf402('0x2c')]);_0x5bb711[_0xf402('0x2d')]=_[_0xf402('0x2e')](_0x5bb711['model'],_0x5bb711['query']);_0x10f130[_0xf402('0x2f')]=_[_0xf402('0x2e')](_0x5bb711[_0xf402('0x2b')],qs['fields'](_0xaeda0f[_0xf402('0x2c')][_0xf402('0x30')]));_0x10f130[_0xf402('0x2f')]=_0x10f130[_0xf402('0x2f')][_0xf402('0x31')]?_0x10f130[_0xf402('0x2f')]:_0x5bb711['model'];if(!_0xaeda0f[_0xf402('0x2c')][_0xf402('0x32')](_0xf402('0x33'))){_0x10f130[_0xf402('0x14')]=qs[_0xf402('0x14')](_0xaeda0f['query'][_0xf402('0x14')]);_0x10f130[_0xf402('0x17')]=qs[_0xf402('0x17')](_0xaeda0f['query']['offset']);}_0x10f130[_0xf402('0x34')]=qs['sort'](_0xaeda0f[_0xf402('0x2c')][_0xf402('0x35')]);_0x10f130['where']=qs[_0xf402('0x2d')](_[_0xf402('0x36')](_0xaeda0f[_0xf402('0x2c')],_0x5bb711[_0xf402('0x2d')]),_0x3ffab6);if(_0xaeda0f[_0xf402('0x2c')][_0xf402('0x37')]){_0x10f130[_0xf402('0x38')]=_[_0xf402('0x39')](_0x10f130['where'],{'$or':_[_0xf402('0x26')](_0x3ffab6,function(_0x7301bf){if(_0x7301bf[_0xf402('0x29')]!==_0xf402('0x3a')){var _0x2fb923={};_0x2fb923[_0x7301bf['name']]={'$like':'%'+_0xaeda0f[_0xf402('0x2c')]['filter']+'%'};return _0x2fb923;}})});}_0x10f130=_[_0xf402('0x39')]({},_0x10f130,_0xaeda0f[_0xf402('0x3b')]);var _0x46b57f={'where':_0x10f130[_0xf402('0x38')]};return db[_0xf402('0x27')][_0xf402('0x16')](_0x46b57f)[_0xf402('0x1e')](function(_0x5d8a26){_0x4d86bd['count']=_0x5d8a26;if(_0xaeda0f[_0xf402('0x2c')][_0xf402('0x3c')]){_0x10f130[_0xf402('0x3d')]=[{'all':!![]}];}return db[_0xf402('0x27')][_0xf402('0x3e')](_0x10f130);})[_0xf402('0x1e')](function(_0x488587){_0x4d86bd[_0xf402('0x3f')]=_0x488587;return _0x4d86bd;})[_0xf402('0x1e')](respondWithFilteredResult(_0x3720c6,_0x10f130))[_0xf402('0x40')](handleError(_0x3720c6,null));};exports[_0xf402('0x41')]=function(_0x50c439,_0x16263b){var _0x1f0b26={'raw':![],'where':{'id':_0x50c439[_0xf402('0x42')]['id']}},_0x299af2={};_0x299af2[_0xf402('0x2b')]=_[_0xf402('0x43')](db['VoiceChanSpy'][_0xf402('0x28')]);_0x299af2[_0xf402('0x2c')]=_['keys'](_0x50c439['query']);_0x299af2[_0xf402('0x2d')]=_[_0xf402('0x2e')](_0x299af2['model'],_0x299af2[_0xf402('0x2c')]);_0x1f0b26[_0xf402('0x2f')]=_[_0xf402('0x2e')](_0x299af2['model'],qs[_0xf402('0x30')](_0x50c439['query'][_0xf402('0x30')]));_0x1f0b26['attributes']=_0x1f0b26[_0xf402('0x2f')][_0xf402('0x31')]?_0x1f0b26['attributes']:_0x299af2['model'];if(_0x50c439[_0xf402('0x2c')][_0xf402('0x3c')]){_0x1f0b26['include']=[{'all':!![]}];}_0x1f0b26=_['merge']({},_0x1f0b26,_0x50c439[_0xf402('0x3b')]);return db[_0xf402('0x27')][_0xf402('0x44')](_0x1f0b26)[_0xf402('0x1e')](handleEntityNotFound(_0x16263b,null))[_0xf402('0x1e')](respondWithResult(_0x16263b,null))[_0xf402('0x40')](handleError(_0x16263b,null));};exports[_0xf402('0x45')]=function(_0xf91b26,_0x48dc6){return db['VoiceChanSpy'][_0xf402('0x45')](_0xf91b26[_0xf402('0x46')],{})[_0xf402('0x1e')](function(_0x5c2926){var _0x2e1b55=_0xf91b26[_0xf402('0x47')][_0xf402('0x20')]({'plain':!![]});if(!_0x2e1b55)throw new Error(_0xf402('0x48'));if(_0x2e1b55['role']===_0xf402('0x47')){var _0x411fa3=_0x5c2926[_0xf402('0x20')]({'plain':!![]});var _0x3e089e=_0xf402('0x49');return db[_0xf402('0x4a')][_0xf402('0x44')]({'where':{'name':_0x3e089e,'userProfileId':_0x2e1b55[_0xf402('0x4b')]},'raw':!![]})[_0xf402('0x1e')](function(_0x17ea91){if(_0x17ea91&&_0x17ea91[_0xf402('0x4c')]===0x0){return db[_0xf402('0x21')][_0xf402('0x45')]({'name':_0x411fa3['name'],'resourceId':_0x411fa3['id'],'type':_0x17ea91['name'],'sectionId':_0x17ea91['id']},{})[_0xf402('0x1e')](function(){return _0x5c2926;});}else{return _0x5c2926;}})['catch'](function(_0x5876da){logger['error'](_0xf402('0x4d'),_0x5876da);throw _0x5876da;});}return _0x5c2926;})[_0xf402('0x1e')](respondWithResult(_0x48dc6,0xc9))['catch'](handleError(_0x48dc6,null));};exports[_0xf402('0x1d')]=function(_0x30c78f,_0x12e61e){if(_0x30c78f[_0xf402('0x46')]['id']){delete _0x30c78f[_0xf402('0x46')]['id'];}return db[_0xf402('0x27')][_0xf402('0x44')]({'where':{'id':_0x30c78f[_0xf402('0x42')]['id']}})['then'](handleEntityNotFound(_0x12e61e,null))['then'](saveUpdates(_0x30c78f[_0xf402('0x46')],null))[_0xf402('0x1e')](respondWithResult(_0x12e61e,null))['catch'](handleError(_0x12e61e,null));};exports[_0xf402('0x1f')]=function(_0x2ee779,_0x49b1d6){return db['VoiceChanSpy'][_0xf402('0x44')]({'where':{'id':_0x2ee779['params']['id']}})[_0xf402('0x1e')](handleEntityNotFound(_0x49b1d6,null))['then'](removeEntity(_0x49b1d6,null))[_0xf402('0x40')](handleError(_0x49b1d6,null));}; \ No newline at end of file +var _0x1782=['end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','name','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','filters','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x653d7f,_0x4b9913){var _0x161752=function(_0x1a48f8){while(--_0x1a48f8){_0x653d7f['push'](_0x653d7f['shift']());}};_0x161752(++_0x4b9913);}(_0x1782,0x13e));var _0x2178=function(_0x1b1997,_0x3f15de){_0x1b1997=_0x1b1997-0x0;var _0x456aa0=_0x1782[_0x1b1997];return _0x456aa0;};'use strict';var emlformat=require(_0x2178('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2178('0x1'));var jsonpatch=require(_0x2178('0x2'));var rp=require(_0x2178('0x3'));var moment=require(_0x2178('0x4'));var BPromise=require(_0x2178('0x5'));var Mustache=require('mustache');var util=require(_0x2178('0x6'));var path=require(_0x2178('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2178('0x8'));var fs=require('fs');var fs_extra=require(_0x2178('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2178('0xa'));var deskjs=require(_0x2178('0xb'));var toCsv=require(_0x2178('0xc'));var querystring=require(_0x2178('0xd'));var Papa=require(_0x2178('0xe'));var Redis=require(_0x2178('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2178('0x10'));var as=require(_0x2178('0x11'));var hardwareService=require(_0x2178('0x12'));var logger=require(_0x2178('0x13'))(_0x2178('0x14'));var utils=require(_0x2178('0x15'));var config=require(_0x2178('0x16'));var licenseUtil=require(_0x2178('0x17'));var db=require(_0x2178('0x18'))['db'];function respondWithStatusCode(_0xd7dd49,_0x5f1d29){_0x5f1d29=_0x5f1d29||0xcc;return function(_0x197ce9){if(_0x197ce9){return _0xd7dd49[_0x2178('0x19')](_0x5f1d29);}return _0xd7dd49['status'](_0x5f1d29)[_0x2178('0x1a')]();};}function respondWithResult(_0x3fd74c,_0x32f65c){_0x32f65c=_0x32f65c||0xc8;return function(_0x21d6e3){if(_0x21d6e3){return _0x3fd74c[_0x2178('0x1b')](_0x32f65c)['json'](_0x21d6e3);}};}function respondWithFilteredResult(_0x5921cc,_0x535e82){return function(_0x47aac0){if(_0x47aac0){var _0x4d8f39=typeof _0x535e82[_0x2178('0x1c')]===_0x2178('0x1d')&&typeof _0x535e82['limit']==='undefined';var _0x2cbbfe=_0x47aac0[_0x2178('0x1e')];var _0x561990=_0x4d8f39?0x0:_0x535e82[_0x2178('0x1c')];var _0x39dd60=_0x4d8f39?_0x47aac0[_0x2178('0x1e')]:_0x535e82[_0x2178('0x1c')]+_0x535e82[_0x2178('0x1f')];var _0x443b2a;if(_0x39dd60>=_0x2cbbfe){_0x39dd60=_0x2cbbfe;_0x443b2a=0xc8;}else{_0x443b2a=0xce;}_0x5921cc[_0x2178('0x1b')](_0x443b2a);return _0x5921cc[_0x2178('0x20')](_0x2178('0x21'),_0x561990+'-'+_0x39dd60+'/'+_0x2cbbfe)[_0x2178('0x22')](_0x47aac0);}return null;};}function patchUpdates(_0x1d2dd5){return function(_0x45999f){try{jsonpatch['apply'](_0x45999f,_0x1d2dd5,!![]);}catch(_0x3dd119){return BPromise[_0x2178('0x23')](_0x3dd119);}return _0x45999f[_0x2178('0x24')]();};}function saveUpdates(_0x27a745,_0x4335f2){return function(_0x6f21d4){if(_0x6f21d4){return _0x6f21d4[_0x2178('0x25')](_0x27a745)[_0x2178('0x26')](function(_0x383894){return _0x383894;});}return null;};}function removeEntity(_0x2fa395,_0x3c03f7){return function(_0x1506ec){if(_0x1506ec){return _0x1506ec[_0x2178('0x27')]()[_0x2178('0x26')](function(){var _0x35dcb9=_0x1506ec[_0x2178('0x28')]({'plain':!![]});var _0x393f67=_0x2178('0x29');return db[_0x2178('0x2a')][_0x2178('0x27')]({'where':{'type':_0x393f67,'resourceId':_0x35dcb9['id']}})[_0x2178('0x26')](function(){return _0x1506ec;});})[_0x2178('0x26')](function(){_0x2fa395[_0x2178('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x403087,_0x3ce806){return function(_0x50804b){if(!_0x50804b){_0x403087['sendStatus'](0x194);}return _0x50804b;};}function handleError(_0x30fbad,_0x51c88c){_0x51c88c=_0x51c88c||0x1f4;return function(_0xffcd00){logger[_0x2178('0x2b')](_0xffcd00[_0x2178('0x2c')]);if(_0xffcd00['name']){delete _0xffcd00['name'];}_0x30fbad[_0x2178('0x1b')](_0x51c88c)[_0x2178('0x2d')](_0xffcd00);};}exports[_0x2178('0x2e')]=function(_0x505cc3,_0x4baf93){var _0x2a14d7={},_0x22df8a={},_0x4020b1={'count':0x0,'rows':[]};var _0x3e3ddf=_[_0x2178('0x2f')](db[_0x2178('0x30')][_0x2178('0x31')],function(_0x4b4875){return{'name':_0x4b4875[_0x2178('0x32')],'type':_0x4b4875[_0x2178('0x33')]['key']};});_0x22df8a[_0x2178('0x34')]=_[_0x2178('0x2f')](_0x3e3ddf,_0x2178('0x35'));_0x22df8a[_0x2178('0x36')]=_['keys'](_0x505cc3[_0x2178('0x36')]);_0x22df8a['filters']=_['intersection'](_0x22df8a[_0x2178('0x34')],_0x22df8a[_0x2178('0x36')]);_0x2a14d7[_0x2178('0x37')]=_[_0x2178('0x38')](_0x22df8a[_0x2178('0x34')],qs[_0x2178('0x39')](_0x505cc3[_0x2178('0x36')]['fields']));_0x2a14d7[_0x2178('0x37')]=_0x2a14d7['attributes'][_0x2178('0x3a')]?_0x2a14d7[_0x2178('0x37')]:_0x22df8a['model'];if(!_0x505cc3[_0x2178('0x36')][_0x2178('0x3b')](_0x2178('0x3c'))){_0x2a14d7[_0x2178('0x1f')]=qs[_0x2178('0x1f')](_0x505cc3[_0x2178('0x36')][_0x2178('0x1f')]);_0x2a14d7['offset']=qs['offset'](_0x505cc3['query']['offset']);}_0x2a14d7[_0x2178('0x3d')]=qs[_0x2178('0x3e')](_0x505cc3[_0x2178('0x36')][_0x2178('0x3e')]);_0x2a14d7[_0x2178('0x3f')]=qs['filters'](_['pick'](_0x505cc3['query'],_0x22df8a['filters']),_0x3e3ddf);if(_0x505cc3[_0x2178('0x36')][_0x2178('0x40')]){_0x2a14d7[_0x2178('0x3f')]=_['merge'](_0x2a14d7[_0x2178('0x3f')],{'$or':_[_0x2178('0x2f')](_0x3e3ddf,function(_0x20dd66){if(_0x20dd66[_0x2178('0x33')]!==_0x2178('0x41')){var _0xa6b7d2={};_0xa6b7d2[_0x20dd66[_0x2178('0x35')]]={'$like':'%'+_0x505cc3[_0x2178('0x36')][_0x2178('0x40')]+'%'};return _0xa6b7d2;}})});}_0x2a14d7=_[_0x2178('0x42')]({},_0x2a14d7,_0x505cc3[_0x2178('0x43')]);var _0x59b012={'where':_0x2a14d7[_0x2178('0x3f')]};return db[_0x2178('0x30')][_0x2178('0x1e')](_0x59b012)[_0x2178('0x26')](function(_0x5348fe){_0x4020b1['count']=_0x5348fe;if(_0x505cc3[_0x2178('0x36')][_0x2178('0x44')]){_0x2a14d7[_0x2178('0x45')]=[{'all':!![]}];}return db[_0x2178('0x30')][_0x2178('0x46')](_0x2a14d7);})[_0x2178('0x26')](function(_0x2fa43d){_0x4020b1[_0x2178('0x47')]=_0x2fa43d;return _0x4020b1;})[_0x2178('0x26')](respondWithFilteredResult(_0x4baf93,_0x2a14d7))[_0x2178('0x48')](handleError(_0x4baf93,null));};exports[_0x2178('0x49')]=function(_0x52fd9a,_0xa86e8f){var _0x547c6a={'raw':![],'where':{'id':_0x52fd9a[_0x2178('0x4a')]['id']}},_0x3aef13={};_0x3aef13[_0x2178('0x34')]=_[_0x2178('0x4b')](db[_0x2178('0x30')][_0x2178('0x31')]);_0x3aef13[_0x2178('0x36')]=_[_0x2178('0x4b')](_0x52fd9a['query']);_0x3aef13[_0x2178('0x4c')]=_[_0x2178('0x38')](_0x3aef13[_0x2178('0x34')],_0x3aef13[_0x2178('0x36')]);_0x547c6a[_0x2178('0x37')]=_[_0x2178('0x38')](_0x3aef13[_0x2178('0x34')],qs[_0x2178('0x39')](_0x52fd9a[_0x2178('0x36')][_0x2178('0x39')]));_0x547c6a[_0x2178('0x37')]=_0x547c6a[_0x2178('0x37')][_0x2178('0x3a')]?_0x547c6a[_0x2178('0x37')]:_0x3aef13[_0x2178('0x34')];if(_0x52fd9a['query'][_0x2178('0x44')]){_0x547c6a['include']=[{'all':!![]}];}_0x547c6a=_[_0x2178('0x42')]({},_0x547c6a,_0x52fd9a[_0x2178('0x43')]);return db[_0x2178('0x30')]['find'](_0x547c6a)[_0x2178('0x26')](handleEntityNotFound(_0xa86e8f,null))[_0x2178('0x26')](respondWithResult(_0xa86e8f,null))[_0x2178('0x48')](handleError(_0xa86e8f,null));};exports[_0x2178('0x4d')]=function(_0x29c161,_0x5f150d){return db[_0x2178('0x30')][_0x2178('0x4d')](_0x29c161[_0x2178('0x4e')],{})[_0x2178('0x26')](function(_0x1a5a9d){var _0x5058d9=_0x29c161['user'][_0x2178('0x28')]({'plain':!![]});if(!_0x5058d9)throw new Error(_0x2178('0x4f'));if(_0x5058d9[_0x2178('0x50')]===_0x2178('0x51')){var _0x52d35e=_0x1a5a9d['get']({'plain':!![]});var _0x510d84=_0x2178('0x29');return db[_0x2178('0x52')][_0x2178('0x53')]({'where':{'name':_0x510d84,'userProfileId':_0x5058d9[_0x2178('0x54')]},'raw':!![]})[_0x2178('0x26')](function(_0x312c5d){if(_0x312c5d&&_0x312c5d['autoAssociation']===0x0){return db['UserProfileResource'][_0x2178('0x4d')]({'name':_0x52d35e[_0x2178('0x35')],'resourceId':_0x52d35e['id'],'type':_0x312c5d['name'],'sectionId':_0x312c5d['id']},{})['then'](function(){return _0x1a5a9d;});}else{return _0x1a5a9d;}})['catch'](function(_0x299b82){logger[_0x2178('0x2b')](_0x2178('0x55'),_0x299b82);throw _0x299b82;});}return _0x1a5a9d;})[_0x2178('0x26')](respondWithResult(_0x5f150d,0xc9))['catch'](handleError(_0x5f150d,null));};exports['update']=function(_0x198a04,_0x1f6a69){if(_0x198a04[_0x2178('0x4e')]['id']){delete _0x198a04[_0x2178('0x4e')]['id'];}return db[_0x2178('0x30')][_0x2178('0x53')]({'where':{'id':_0x198a04['params']['id']}})[_0x2178('0x26')](handleEntityNotFound(_0x1f6a69,null))['then'](saveUpdates(_0x198a04['body'],null))['then'](respondWithResult(_0x1f6a69,null))['catch'](handleError(_0x1f6a69,null));};exports[_0x2178('0x27')]=function(_0x59a989,_0x321275){return db[_0x2178('0x30')][_0x2178('0x53')]({'where':{'id':_0x59a989[_0x2178('0x4a')]['id']}})[_0x2178('0x26')](handleEntityNotFound(_0x321275,null))[_0x2178('0x26')](removeEntity(_0x321275,null))[_0x2178('0x48')](handleError(_0x321275,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a1c2061..dbe4d66 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x083c=['VoiceExtension','destroy','lodash','util','bluebird','format','%s%s','system','push','CDR(type)=%s','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','exports','models','voice_chanspy','bulkCreate','catch'];(function(_0x5b2667,_0x5edc78){var _0x28dae0=function(_0x2f8e92){while(--_0x2f8e92){_0x5b2667['push'](_0x5b2667['shift']());}};_0x28dae0(++_0x5edc78);}(_0x083c,0x178));var _0xc083=function(_0x36284b,_0x2b7436){_0x36284b=_0x36284b-0x0;var _0x23c34a=_0x083c[_0x36284b];return _0x23c34a;};'use strict';var _=require(_0xc083('0x0'));var util=require(_0xc083('0x1'));var BPromise=require(_0xc083('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4ffd29,_0x17f0b8,_0x3d4851){var _0x192a55=0x1;var _0x2f9331=[];var _0x1f120a={'context':_0x17f0b8['context']||'from-sip','exten':util[_0xc083('0x3')](_0xc083('0x4'),_0x4ffd29['prefix'],_0x3d4851),'type':_0xc083('0x5'),'isApp':![],'ChanSpyId':_0x4ffd29['id'],'UserId':_0x17f0b8['id']};_0x2f9331[_0xc083('0x6')](_['merge']({'app':'Set','appdata':util[_0xc083('0x3')](_0xc083('0x7'),'chanspy'),'priority':_0x192a55++},_0x1f120a));if(_0x4ffd29[_0xc083('0x8')]){_0x2f9331[_0xc083('0x6')](_[_0xc083('0x9')]({'app':_0xc083('0xa'),'appdata':util[_0xc083('0x3')](_0xc083('0xb'),_0x4ffd29[_0xc083('0xc')]),'priority':_0x192a55++},_0x1f120a));}if(_0x4ffd29[_0xc083('0xd')]){_0x2f9331[_0xc083('0x6')](_[_0xc083('0x9')]({'app':_0xc083('0xe'),'appdata':_0x4ffd29['password'],'priority':_0x192a55++},_0x1f120a));}_0x2f9331[_0xc083('0x6')](_['merge']({'app':_0xc083('0xf'),'appdata':util['format'](_0xc083('0x10'),_0x17f0b8[_0xc083('0x11')],_0x4ffd29['options']?_0x4ffd29[_0xc083('0x12')][_0xc083('0x13')](''):''),'priority':_0x192a55++},_0x1f120a));if(_0x4ffd29['record']){_0x2f9331['push'](_[_0xc083('0x9')]({'app':'StopMixMonitor','priority':_0x192a55++},_0x1f120a));}return _0x2f9331;};var getChanSpyApplications=function(_0xa174eb,_0x2f6935){var _0x2a1036=[];for(var _0x961c5=0x0,_0x2aa651=0x1;_0x961c5<_0x2f6935[_0xc083('0x14')];_0x961c5++,_0x2aa651=0x1){_0x2a1036=_0x2a1036[_0xc083('0x15')](getUserApplications(_0xa174eb,_0x2f6935[_0x961c5],_0x2f6935[_0x961c5][_0xc083('0x16')]));if(_0x2f6935[_0x961c5]['internal']!=_0x2f6935[_0x961c5][_0xc083('0x11')]){_0x2a1036=_0x2a1036[_0xc083('0x15')](getUserApplications(_0xa174eb,_0x2f6935[_0x961c5],_0x2f6935[_0x961c5][_0xc083('0x11')]));}}return _0x2a1036;};var getChanSpyPromise=function(_0x167541,_0x5c97cf){return new BPromise(function(_0x2a3336,_0x392cd4){return _0x167541[_0xc083('0x17')][_0xc083('0x18')]({'attributes':['id',_0xc083('0x11'),_0xc083('0x16')],'where':{'role':_0xc083('0x19'),'chanspy':!![]},'raw':!![]})[_0xc083('0x1a')](function(_0x3e408e){if(_0x3e408e){return _0x2a3336(getChanSpyApplications(_0x5c97cf,_0x3e408e));}return _0x2a3336([]);})['catch'](function(_0x15a170){_0x392cd4(_0x15a170);});});};module[_0xc083('0x1b')]=function(_0x134e78,_0x7823b9){var _0x2f11b6=_0x134e78[_0xc083('0x1c')];return _0x134e78['define']('VoiceChanSpy',attributes,{'tableName':_0xc083('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d8ed5,_0x534b12,_0x35077c){return getChanSpyPromise(_0x2f11b6,_0x4d8ed5)[_0xc083('0x1a')](function(_0x47cd57){if(_0x47cd57&&_0x47cd57[_0xc083('0x14')]){return _0x2f11b6['VoiceExtension'][_0xc083('0x1e')](_0x47cd57);}})[_0xc083('0x1a')](function(){_0x35077c();})[_0xc083('0x1f')](function(_0x5dbb23){_0x35077c(_0x5dbb23);});},'afterUpdate':function(_0x4b85de,_0x2a8d89,_0x3d8d86){return _0x2f11b6[_0xc083('0x20')][_0xc083('0x21')]({'where':{'ChanSpyId':_0x4b85de['id']}})[_0xc083('0x1a')](function(){return getChanSpyPromise(_0x2f11b6,_0x4b85de);})['then'](function(_0x2a24a6){if(_0x2a24a6&&_0x2a24a6[_0xc083('0x14')]){return _0x2f11b6[_0xc083('0x20')][_0xc083('0x1e')](_0x2a24a6);}})[_0xc083('0x1a')](function(){_0x3d8d86();})[_0xc083('0x1f')](function(_0x53dc60){_0x3d8d86(_0x53dc60);});},'afterDestroy':function(_0x2c8408,_0x174cc8,_0x39ce09){return _0x2f11b6[_0xc083('0x20')][_0xc083('0x21')]({'where':{'ChanSpyId':_0x2c8408['id']}})[_0xc083('0x1a')](function(){_0x39ce09();})[_0xc083('0x1f')](function(_0x13f45c){_0x39ce09(_0x13f45c);});}}});}; \ No newline at end of file +var _0xf631=['Set','format','chanspy','record','push','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','agent','catch','models','define','VoiceChanSpy','then','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system'];(function(_0x54bbd9,_0x3e8c80){var _0x111494=function(_0x3345fe){while(--_0x3345fe){_0x54bbd9['push'](_0x54bbd9['shift']());}};_0x111494(++_0x3e8c80);}(_0xf631,0x183));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1f63('0x0'));var util=require(_0x1f63('0x1'));var BPromise=require(_0x1f63('0x2'));var attributes=require(_0x1f63('0x3'));var getUserApplications=function(_0x4e12c8,_0x4f5a78,_0xdfec83){var _0x452b4e=0x1;var _0x189ccb=[];var _0x37d6a3={'context':_0x4f5a78[_0x1f63('0x4')]||_0x1f63('0x5'),'exten':util['format'](_0x1f63('0x6'),_0x4e12c8[_0x1f63('0x7')],_0xdfec83),'type':_0x1f63('0x8'),'isApp':![],'ChanSpyId':_0x4e12c8['id'],'UserId':_0x4f5a78['id']};_0x189ccb['push'](_['merge']({'app':_0x1f63('0x9'),'appdata':util[_0x1f63('0xa')]('CDR(type)=%s',_0x1f63('0xb')),'priority':_0x452b4e++},_0x37d6a3));if(_0x4e12c8[_0x1f63('0xc')]){_0x189ccb[_0x1f63('0xd')](_[_0x1f63('0xe')]({'app':_0x1f63('0xf'),'appdata':util['format'](_0x1f63('0x10'),_0x4e12c8[_0x1f63('0x11')]),'priority':_0x452b4e++},_0x37d6a3));}if(_0x4e12c8[_0x1f63('0x12')]){_0x189ccb[_0x1f63('0xd')](_[_0x1f63('0xe')]({'app':'Authenticate','appdata':_0x4e12c8['password'],'priority':_0x452b4e++},_0x37d6a3));}_0x189ccb[_0x1f63('0xd')](_[_0x1f63('0xe')]({'app':'ChanSpy','appdata':util[_0x1f63('0xa')](_0x1f63('0x13'),_0x4f5a78['name'],_0x4e12c8[_0x1f63('0x14')]?_0x4e12c8[_0x1f63('0x14')][_0x1f63('0x15')](''):''),'priority':_0x452b4e++},_0x37d6a3));if(_0x4e12c8[_0x1f63('0xc')]){_0x189ccb[_0x1f63('0xd')](_[_0x1f63('0xe')]({'app':_0x1f63('0x16'),'priority':_0x452b4e++},_0x37d6a3));}return _0x189ccb;};var getChanSpyApplications=function(_0xd73841,_0x4f1fb4){var _0x5a39e6=[];for(var _0xa515bd=0x0,_0x329af3=0x1;_0xa515bd<_0x4f1fb4[_0x1f63('0x17')];_0xa515bd++,_0x329af3=0x1){_0x5a39e6=_0x5a39e6[_0x1f63('0x18')](getUserApplications(_0xd73841,_0x4f1fb4[_0xa515bd],_0x4f1fb4[_0xa515bd][_0x1f63('0x19')]));if(_0x4f1fb4[_0xa515bd]['internal']!=_0x4f1fb4[_0xa515bd][_0x1f63('0x1a')]){_0x5a39e6=_0x5a39e6['concat'](getUserApplications(_0xd73841,_0x4f1fb4[_0xa515bd],_0x4f1fb4[_0xa515bd][_0x1f63('0x1a')]));}}return _0x5a39e6;};var getChanSpyPromise=function(_0x803b2d,_0x4e252c){return new BPromise(function(_0x2e50eb,_0x4bfb25){return _0x803b2d[_0x1f63('0x1b')]['findAll']({'attributes':['id',_0x1f63('0x1a'),_0x1f63('0x19')],'where':{'role':_0x1f63('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2304ef){if(_0x2304ef){return _0x2e50eb(getChanSpyApplications(_0x4e252c,_0x2304ef));}return _0x2e50eb([]);})[_0x1f63('0x1d')](function(_0x89a520){_0x4bfb25(_0x89a520);});});};module['exports']=function(_0x5b7ca8,_0x18d773){var _0x3945fd=_0x5b7ca8[_0x1f63('0x1e')];return _0x5b7ca8[_0x1f63('0x1f')](_0x1f63('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x20eeb1,_0x598e87,_0x5e7ed5){return getChanSpyPromise(_0x3945fd,_0x20eeb1)[_0x1f63('0x21')](function(_0x2f2b1b){if(_0x2f2b1b&&_0x2f2b1b[_0x1f63('0x17')]){return _0x3945fd[_0x1f63('0x22')]['bulkCreate'](_0x2f2b1b);}})[_0x1f63('0x21')](function(){_0x5e7ed5();})[_0x1f63('0x1d')](function(_0x4823c6){_0x5e7ed5(_0x4823c6);});},'afterUpdate':function(_0x232392,_0x574645,_0x51ac3b){return _0x3945fd['VoiceExtension'][_0x1f63('0x23')]({'where':{'ChanSpyId':_0x232392['id']}})[_0x1f63('0x21')](function(){return getChanSpyPromise(_0x3945fd,_0x232392);})[_0x1f63('0x21')](function(_0x223eb9){if(_0x223eb9&&_0x223eb9['length']){return _0x3945fd[_0x1f63('0x22')]['bulkCreate'](_0x223eb9);}})[_0x1f63('0x21')](function(){_0x51ac3b();})[_0x1f63('0x1d')](function(_0x16e98f){_0x51ac3b(_0x16e98f);});},'afterDestroy':function(_0x456a8b,_0x1241ef,_0x36652f){return _0x3945fd[_0x1f63('0x22')][_0x1f63('0x23')]({'where':{'ChanSpyId':_0x456a8b['id']}})[_0x1f63('0x21')](function(){_0x36652f();})['catch'](function(_0x5c5848){_0x36652f(_0x5c5848);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2915626..acd234b 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3fe=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xc3fe,0xff));var _0xec3f=function(_0x3f73c0,_0x56deaa){_0x3f73c0=_0x3f73c0-0x0;var _0xe16258=_0xc3fe[_0x3f73c0];return _0xe16258;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var moment=require(_0xec3f('0x2'));var BPromise=require('bluebird');var rs=require(_0xec3f('0x3'));var fs=require('fs');var Redis=require(_0xec3f('0x4'));var db=require(_0xec3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec3f('0x6'))(_0xec3f('0x7'));var config=require(_0xec3f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b0b84,_0x526183,_0x503775){return new BPromise(function(_0xcb8557,_0x5df7fc){return client[_0xec3f('0xa')](_0x3b0b84,_0x503775)[_0xec3f('0xb')](function(_0x12a7c5){logger[_0xec3f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));logger[_0xec3f('0xe')](_0xec3f('0xf'),_0x526183,_0xec3f('0xd'),JSON[_0xec3f('0x10')](_0x12a7c5));if(_0x12a7c5[_0xec3f('0x11')]){if(_0x12a7c5['error'][_0xec3f('0x12')]===0x1f4){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0x12a7c5['error']['message']);return _0x5df7fc(_0x12a7c5[_0xec3f('0x11')]['message']);}logger['error'](_0xec3f('0x13'),_0x526183,_0x12a7c5[_0xec3f('0x11')][_0xec3f('0x14')]);return _0xcb8557(_0x12a7c5['error']['message']);}else{logger[_0xec3f('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x526183,_0xec3f('0xd'));_0xcb8557(_0x12a7c5[_0xec3f('0x15')]['message']);}})[_0xec3f('0x16')](function(_0xb8ee6f){logger[_0xec3f('0x11')](_0xec3f('0x13'),_0x526183,_0xb8ee6f);_0x5df7fc(_0xb8ee6f);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xda3f,0xec));var _0xfda3=function(_0x396cec,_0x3dddca){_0x396cec=_0x396cec-0x0;var _0x441c6d=_0xda3f[_0x396cec];return _0x441c6d;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3cccfb0..6379279 100644 --- a/server/api/voiceContext/index.js +++ b/server/api/voiceContext/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9690=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','create','put','update','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x9690,0xcb));var _0x0969=function(_0x41d702,_0x1c2cf6){_0x41d702=_0x41d702-0x0;var _0x397b09=_0x9690[_0x41d702];return _0x397b09;};'use strict';var multer=require(_0x0969('0x0'));var util=require('util');var path=require(_0x0969('0x1'));var timeout=require(_0x0969('0x2'));var express=require('express');var router=express[_0x0969('0x3')]();var fs_extra=require(_0x0969('0x4'));var auth=require(_0x0969('0x5'));var interaction=require(_0x0969('0x6'));var config=require(_0x0969('0x7'));var controller=require(_0x0969('0x8'));router[_0x0969('0x9')]('/',auth[_0x0969('0xa')](),controller['index']);router[_0x0969('0x9')](_0x0969('0xb'),auth[_0x0969('0xa')](),controller['show']);router['post']('/',auth[_0x0969('0xa')](),controller[_0x0969('0xc')]);router[_0x0969('0xd')](_0x0969('0xb'),auth[_0x0969('0xa')](),controller[_0x0969('0xe')]);router['delete'](_0x0969('0xb'),auth[_0x0969('0xa')](),controller['destroy']);module[_0x0969('0xf')]=router; \ No newline at end of file +var _0x02cd=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create'];(function(_0x40667e,_0x4dde45){var _0x4e581b=function(_0x31e226){while(--_0x31e226){_0x40667e['push'](_0x40667e['shift']());}};_0x4e581b(++_0x4dde45);}(_0x02cd,0x167));var _0xd02c=function(_0x4c4a18,_0x35be2c){_0x4c4a18=_0x4c4a18-0x0;var _0x51a123=_0x02cd[_0x4c4a18];return _0x51a123;};'use strict';var multer=require(_0xd02c('0x0'));var util=require('util');var path=require(_0xd02c('0x1'));var timeout=require(_0xd02c('0x2'));var express=require(_0xd02c('0x3'));var router=express[_0xd02c('0x4')]();var fs_extra=require(_0xd02c('0x5'));var auth=require(_0xd02c('0x6'));var interaction=require(_0xd02c('0x7'));var config=require(_0xd02c('0x8'));var controller=require('./voiceContext.controller');router[_0xd02c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd02c('0x9')](_0xd02c('0xa'),auth[_0xd02c('0xb')](),controller[_0xd02c('0xc')]);router[_0xd02c('0xd')]('/',auth[_0xd02c('0xb')](),controller[_0xd02c('0xe')]);router['put'](_0xd02c('0xa'),auth[_0xd02c('0xb')](),controller['update']);router[_0xd02c('0xf')]('/:id',auth[_0xd02c('0xb')](),controller['destroy']);module[_0xd02c('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fef2658..b4cfff7 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf2a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x501dbc,_0x112a28){var _0x304d18=function(_0x5260b0){while(--_0x5260b0){_0x501dbc['push'](_0x501dbc['shift']());}};_0x304d18(++_0x112a28);}(_0xcf2a,0x7d));var _0xacf2=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xcf2a[_0x2fee96];return _0x2e6ad1;};'use strict';var Sequelize=require(_0xacf2('0x0'));module[_0xacf2('0x1')]={'name':{'type':Sequelize[_0xacf2('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xacf2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xacf2('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x37de=['BOOLEAN','exports','STRING','name'];(function(_0x4b8edd,_0x2f6d75){var _0x36cb06=function(_0x24d0fd){while(--_0x24d0fd){_0x4b8edd['push'](_0x4b8edd['shift']());}};_0x36cb06(++_0x2f6d75);}(_0x37de,0xad));var _0xe37d=function(_0x2cfc63,_0x2f2d2f){_0x2cfc63=_0x2cfc63-0x0;var _0x1cef43=_0x37de[_0x2cfc63];return _0x1cef43;};'use strict';var Sequelize=require('sequelize');module[_0xe37d('0x0')]={'name':{'type':Sequelize[_0xe37d('0x1')],'unique':_0xe37d('0x2')},'description':{'type':Sequelize[_0xe37d('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe37d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 65920b2..27ed395 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd09b=['message','info','result','catch','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','get','Contexts','then','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','show','params','merge','find','create','readFileSync','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','body','findAll','join','chan_sip.so','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x495e20,_0x3e0a88){var _0x1f63c6=function(_0x487b81){while(--_0x487b81){_0x495e20['push'](_0x495e20['shift']());}};_0x1f63c6(++_0x3e0a88);}(_0xd09b,0xab));var _0xbd09=function(_0x4bb546,_0x356525){_0x4bb546=_0x4bb546-0x0;var _0x281e8b=_0xd09b[_0x4bb546];return _0x281e8b;};'use strict';var emlformat=require(_0xbd09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd09('0x1'));var jsonpatch=require(_0xbd09('0x2'));var rp=require(_0xbd09('0x3'));var moment=require(_0xbd09('0x4'));var BPromise=require(_0xbd09('0x5'));var Mustache=require(_0xbd09('0x6'));var util=require(_0xbd09('0x7'));var path=require(_0xbd09('0x8'));var sox=require(_0xbd09('0x9'));var csv=require(_0xbd09('0xa'));var ejs=require(_0xbd09('0xb'));var fs=require('fs');var fs_extra=require(_0xbd09('0xc'));var _=require(_0xbd09('0xd'));var squel=require(_0xbd09('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbd09('0xf'));var toCsv=require(_0xbd09('0xa'));var querystring=require(_0xbd09('0x10'));var Papa=require(_0xbd09('0x11'));var Redis=require(_0xbd09('0x12'));var authService=require(_0xbd09('0x13'));var qs=require(_0xbd09('0x14'));var as=require(_0xbd09('0x15'));var hardwareService=require(_0xbd09('0x16'));var logger=require('../../config/logger')(_0xbd09('0x17'));var utils=require(_0xbd09('0x18'));var config=require(_0xbd09('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd09('0x1a'))['db'];var jayson=require(_0xbd09('0x1b'));var client=jayson['client'][_0xbd09('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x482eea,_0x25354f,_0x25c5cd,_0x3e6fa7){return new BPromise(function(_0x2f2eab,_0x2238c5){var _0x533cef=_0x3e6fa7||client;return _0x533cef[_0xbd09('0x1d')](_0x482eea,_0x25c5cd)['then'](function(_0x26325d){logger['info'](_0xbd09('0x1e'),_0x25354f,_0xbd09('0x1f'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x25354f,_0xbd09('0x1f'),JSON[_0xbd09('0x20')](_0x26325d));if(_0x26325d[_0xbd09('0x21')]){if(_0x26325d['error'][_0xbd09('0x22')]===0x1f4){logger['error'](_0xbd09('0x1e'),_0x25354f,_0x26325d['error'][_0xbd09('0x23')]);return _0x2238c5(_0x26325d['error'][_0xbd09('0x23')]);}logger[_0xbd09('0x21')](_0xbd09('0x1e'),_0x25354f,_0x26325d[_0xbd09('0x21')][_0xbd09('0x23')]);return _0x2f2eab(_0x26325d[_0xbd09('0x21')]['message']);}else{logger[_0xbd09('0x24')](_0xbd09('0x1e'),_0x25354f,_0xbd09('0x1f'));_0x2f2eab(_0x26325d[_0xbd09('0x25')][_0xbd09('0x23')]);}})[_0xbd09('0x26')](function(_0x21ea88){logger[_0xbd09('0x21')](_0xbd09('0x1e'),_0x25354f,_0x21ea88);_0x2238c5(_0x21ea88);});});}function respondWithStatusCode(_0x4d92b4,_0x2df567){_0x2df567=_0x2df567||0xcc;return function(_0x384753){if(_0x384753){return _0x4d92b4['sendStatus'](_0x2df567);}return _0x4d92b4[_0xbd09('0x27')](_0x2df567)[_0xbd09('0x28')]();};}function respondWithResult(_0x156746,_0x5a4938){_0x5a4938=_0x5a4938||0xc8;return function(_0x30740e){if(_0x30740e){return _0x156746[_0xbd09('0x27')](_0x5a4938)[_0xbd09('0x29')](_0x30740e);}};}function respondWithFilteredResult(_0x3686c0,_0x5e8cf8){return function(_0x378038){if(_0x378038){var _0x2b536b=typeof _0x5e8cf8[_0xbd09('0x2a')]==='undefined'&&typeof _0x5e8cf8[_0xbd09('0x2b')]==='undefined';var _0x21063b=_0x378038['count'];var _0x5d566a=_0x2b536b?0x0:_0x5e8cf8[_0xbd09('0x2a')];var _0x14fedd=_0x2b536b?_0x378038['count']:_0x5e8cf8[_0xbd09('0x2a')]+_0x5e8cf8[_0xbd09('0x2b')];var _0x444c30;if(_0x14fedd>=_0x21063b){_0x14fedd=_0x21063b;_0x444c30=0xc8;}else{_0x444c30=0xce;}_0x3686c0['status'](_0x444c30);return _0x3686c0[_0xbd09('0x2c')](_0xbd09('0x2d'),_0x5d566a+'-'+_0x14fedd+'/'+_0x21063b)[_0xbd09('0x29')](_0x378038);}return null;};}function patchUpdates(_0x409e34){return function(_0x2ac6c6){try{jsonpatch['apply'](_0x2ac6c6,_0x409e34,!![]);}catch(_0x102f29){return BPromise[_0xbd09('0x2e')](_0x102f29);}return _0x2ac6c6['save']();};}function saveUpdates(_0x3b68fe,_0x319800){return function(_0x795ad8){if(_0x795ad8){return _0x795ad8[_0xbd09('0x2f')](_0x3b68fe)['then'](function(_0x5436c7){return _0x5436c7;});}return null;};}function removeEntity(_0x56a0a9,_0x325568){return function(_0x4b58c1){if(_0x4b58c1){return _0x4b58c1[_0xbd09('0x30')]()['then'](function(){var _0x13c3b2=_0x4b58c1[_0xbd09('0x31')]({'plain':!![]});var _0x7a8c3a=_0xbd09('0x32');return db['UserProfileResource'][_0xbd09('0x30')]({'where':{'type':_0x7a8c3a,'resourceId':_0x13c3b2['id']}})[_0xbd09('0x33')](function(){return _0x4b58c1;});})[_0xbd09('0x33')](function(){_0x56a0a9['status'](0xcc)[_0xbd09('0x28')]();});}};}function handleEntityNotFound(_0x3078cf,_0x153372){return function(_0x151459){if(!_0x151459){_0x3078cf[_0xbd09('0x34')](0x194);}return _0x151459;};}function handleError(_0xdd16b0,_0x16e6e1){_0x16e6e1=_0x16e6e1||0x1f4;return function(_0x5af498){logger['error'](_0x5af498[_0xbd09('0x35')]);if(_0x5af498[_0xbd09('0x36')]){delete _0x5af498['name'];}_0xdd16b0['status'](_0x16e6e1)[_0xbd09('0x37')](_0x5af498);};}exports[_0xbd09('0x38')]=function(_0x41f108,_0x4d8678){var _0x4482e8={},_0xcbed36={},_0x1f655a={'count':0x0,'rows':[]};var _0x2ef4a8=_[_0xbd09('0x39')](db[_0xbd09('0x3a')][_0xbd09('0x3b')],function(_0xd0e4e7){return{'name':_0xd0e4e7[_0xbd09('0x3c')],'type':_0xd0e4e7[_0xbd09('0x3d')][_0xbd09('0x3e')]};});_0xcbed36['model']=_[_0xbd09('0x39')](_0x2ef4a8,_0xbd09('0x36'));_0xcbed36['query']=_[_0xbd09('0x3f')](_0x41f108[_0xbd09('0x40')]);_0xcbed36[_0xbd09('0x41')]=_[_0xbd09('0x42')](_0xcbed36[_0xbd09('0x43')],_0xcbed36[_0xbd09('0x40')]);_0x4482e8[_0xbd09('0x44')]=_[_0xbd09('0x42')](_0xcbed36[_0xbd09('0x43')],qs[_0xbd09('0x45')](_0x41f108[_0xbd09('0x40')][_0xbd09('0x45')]));_0x4482e8['attributes']=_0x4482e8[_0xbd09('0x44')][_0xbd09('0x46')]?_0x4482e8['attributes']:_0xcbed36[_0xbd09('0x43')];if(!_0x41f108[_0xbd09('0x40')]['hasOwnProperty']('nolimit')){_0x4482e8['limit']=qs[_0xbd09('0x2b')](_0x41f108[_0xbd09('0x40')][_0xbd09('0x2b')]);_0x4482e8['offset']=qs[_0xbd09('0x2a')](_0x41f108['query'][_0xbd09('0x2a')]);}_0x4482e8[_0xbd09('0x47')]=qs[_0xbd09('0x48')](_0x41f108[_0xbd09('0x40')][_0xbd09('0x48')]);_0x4482e8[_0xbd09('0x49')]=qs[_0xbd09('0x41')](_[_0xbd09('0x4a')](_0x41f108[_0xbd09('0x40')],_0xcbed36[_0xbd09('0x41')]),_0x2ef4a8);if(_0x41f108[_0xbd09('0x40')]['filter']){_0x4482e8['where']=_['merge'](_0x4482e8[_0xbd09('0x49')],{'$or':_['map'](_0x2ef4a8,function(_0x1ccbc6){if(_0x1ccbc6['type']!==_0xbd09('0x4b')){var _0x22b916={};_0x22b916[_0x1ccbc6[_0xbd09('0x36')]]={'$like':'%'+_0x41f108[_0xbd09('0x40')][_0xbd09('0x4c')]+'%'};return _0x22b916;}})});}_0x4482e8=_['merge']({},_0x4482e8,_0x41f108[_0xbd09('0x4d')]);var _0xd13300={'where':_0x4482e8[_0xbd09('0x49')]};return db['VoiceContext'][_0xbd09('0x4e')](_0xd13300)[_0xbd09('0x33')](function(_0x4a6179){_0x1f655a[_0xbd09('0x4e')]=_0x4a6179;if(_0x41f108[_0xbd09('0x40')][_0xbd09('0x4f')]){_0x4482e8[_0xbd09('0x50')]=[{'all':!![]}];}return db[_0xbd09('0x3a')]['findAll'](_0x4482e8);})['then'](function(_0x364724){_0x1f655a['rows']=_0x364724;return _0x1f655a;})['then'](respondWithFilteredResult(_0x4d8678,_0x4482e8))[_0xbd09('0x26')](handleError(_0x4d8678,null));};exports[_0xbd09('0x51')]=function(_0x56cfad,_0x566241){var _0x338ecd={'raw':![],'where':{'id':_0x56cfad[_0xbd09('0x52')]['id']}},_0x45d6e4={};_0x45d6e4[_0xbd09('0x43')]=_['keys'](db[_0xbd09('0x3a')][_0xbd09('0x3b')]);_0x45d6e4[_0xbd09('0x40')]=_[_0xbd09('0x3f')](_0x56cfad['query']);_0x45d6e4['filters']=_[_0xbd09('0x42')](_0x45d6e4['model'],_0x45d6e4[_0xbd09('0x40')]);_0x338ecd[_0xbd09('0x44')]=_[_0xbd09('0x42')](_0x45d6e4['model'],qs[_0xbd09('0x45')](_0x56cfad[_0xbd09('0x40')][_0xbd09('0x45')]));_0x338ecd[_0xbd09('0x44')]=_0x338ecd['attributes'][_0xbd09('0x46')]?_0x338ecd[_0xbd09('0x44')]:_0x45d6e4['model'];if(_0x56cfad[_0xbd09('0x40')][_0xbd09('0x4f')]){_0x338ecd[_0xbd09('0x50')]=[{'all':!![]}];}_0x338ecd=_[_0xbd09('0x53')]({},_0x338ecd,_0x56cfad['options']);return db[_0xbd09('0x3a')][_0xbd09('0x54')](_0x338ecd)[_0xbd09('0x33')](handleEntityNotFound(_0x566241,null))[_0xbd09('0x33')](respondWithResult(_0x566241,null))[_0xbd09('0x26')](handleError(_0x566241,null));};exports[_0xbd09('0x55')]=function(_0x213a53,_0x1c4ece,_0x348a54){var _0x423446;return db[_0xbd09('0x3a')][_0xbd09('0x55')](_0x213a53['body'],{'raw':!![]})[_0xbd09('0x33')](function(_0x15c928){_0x423446=_0x15c928;return db[_0xbd09('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x9f1360){var _0x20273d=fs[_0xbd09('0x56')](path['join'](config[_0xbd09('0x57')],_0xbd09('0x58')),_0xbd09('0x59'));var _0x413d6e=ejs[_0xbd09('0x5a')](_0x20273d,{'contexts':_0x9f1360||[]});fs[_0xbd09('0x5b')](_0xbd09('0x5c'),_0x413d6e);})[_0xbd09('0x33')](function(){return respondWithRpcPromise(_0xbd09('0x5d'),_0xbd09('0x55'),{'module':'chan_sip.so'});})['then'](function(){var _0x5cf3ec=_0x213a53[_0xbd09('0x5e')][_0xbd09('0x31')]({'plain':!![]});if(!_0x5cf3ec)throw new Error(_0xbd09('0x5f'));if(_0x5cf3ec['role']===_0xbd09('0x5e')){var _0x3fbce4=_0x423446['get']({'plain':!![]});return db[_0xbd09('0x60')][_0xbd09('0x54')]({'where':{'name':_0xbd09('0x32'),'userProfileId':_0x5cf3ec[_0xbd09('0x61')]},'raw':!![]})[_0xbd09('0x33')](function(_0x4289c5){if(_0x4289c5&&_0x4289c5['autoAssociation']===0x0){return db[_0xbd09('0x62')]['create']({'name':_0x3fbce4['name'],'resourceId':_0x3fbce4['id'],'type':_0x4289c5[_0xbd09('0x36')],'sectionId':_0x4289c5['id']},{})[_0xbd09('0x33')](function(){return _0x423446;});}else{return _0x423446;}})[_0xbd09('0x26')](function(_0x339635){logger[_0xbd09('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x339635);throw _0x339635;});}return _0x423446;})[_0xbd09('0x33')](respondWithResult(_0x1c4ece,0xc9))[_0xbd09('0x26')](handleError(_0x1c4ece,null));};exports['update']=function(_0x216eca,_0x18fbdf,_0x2227ee){var _0x3d2f4f;return db[_0xbd09('0x3a')]['find']({'where':{'id':_0x216eca[_0xbd09('0x52')]['id']}})[_0xbd09('0x33')](handleEntityNotFound(_0x18fbdf,null))[_0xbd09('0x33')](saveUpdates(_0x216eca[_0xbd09('0x63')],null))[_0xbd09('0x33')](function(_0x404ff2){if(_0x404ff2){_0x3d2f4f=_0x404ff2;return db[_0xbd09('0x3a')][_0xbd09('0x64')]({'raw':!![]});}})[_0xbd09('0x33')](function(_0x425653){var _0x299b09=fs[_0xbd09('0x56')](path[_0xbd09('0x65')](config[_0xbd09('0x57')],_0xbd09('0x58')),_0xbd09('0x59'));var _0x29f884=ejs[_0xbd09('0x5a')](_0x299b09,{'contexts':_0x425653||[]});fs['writeFileSync'](_0xbd09('0x5c'),_0x29f884);})[_0xbd09('0x33')](function(){return respondWithRpcPromise(_0xbd09('0x5d'),_0xbd09('0x2f'),{'module':_0xbd09('0x66')});})['then'](function(){return _0x3d2f4f;})['then'](respondWithResult(_0x18fbdf,null))[_0xbd09('0x26')](handleError(_0x18fbdf,null));};exports[_0xbd09('0x30')]=function(_0x4e0a88,_0x999a0f,_0x1c6285){var _0x350c6e;return db[_0xbd09('0x3a')]['find']({'where':{'id':_0x4e0a88[_0xbd09('0x52')]['id']}})[_0xbd09('0x33')](handleEntityNotFound(_0x999a0f,null))[_0xbd09('0x33')](removeEntity(_0x999a0f,null))[_0xbd09('0x33')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xbd09('0x33')](function(_0x1a3058){var _0x29223b=fs[_0xbd09('0x56')](path['join'](config[_0xbd09('0x57')],_0xbd09('0x58')),_0xbd09('0x59'));var _0x1c6be0=ejs[_0xbd09('0x5a')](_0x29223b,{'contexts':_0x1a3058});fs[_0xbd09('0x5b')](_0xbd09('0x5c'),_0x1c6be0);return respondWithRpcPromise(_0xbd09('0x5d'),_0xbd09('0x30'),{'module':'chan_sip.so'});})[_0xbd09('0x26')](handleError(_0x999a0f,null));}; \ No newline at end of file +var _0x01b4=['VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','set','save','update','destroy','Contexts','UserProfileResource','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','include','VoiceContext','rows','show','params','includeAll','options','create','body','findAll','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','readFileSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','VoiceContext,\x20%s,\x20%s','debug'];(function(_0x16b940,_0x221680){var _0x12825b=function(_0x1d991e){while(--_0x1d991e){_0x16b940['push'](_0x16b940['shift']());}};_0x12825b(++_0x221680);}(_0x01b4,0x1ef));var _0x401b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01b4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x401b('0x0'));var zipdir=require(_0x401b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x401b('0x2'));var moment=require(_0x401b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x401b('0x4'));var util=require(_0x401b('0x5'));var path=require(_0x401b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x401b('0x7'));var fs=require('fs');var fs_extra=require(_0x401b('0x8'));var _=require(_0x401b('0x9'));var squel=require(_0x401b('0xa'));var crypto=require(_0x401b('0xb'));var jsforce=require(_0x401b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x401b('0xd'));var querystring=require('querystring');var Papa=require(_0x401b('0xe'));var Redis=require(_0x401b('0xf'));var authService=require(_0x401b('0x10'));var qs=require(_0x401b('0x11'));var as=require(_0x401b('0x12'));var hardwareService=require(_0x401b('0x13'));var logger=require(_0x401b('0x14'))('api');var utils=require(_0x401b('0x15'));var config=require(_0x401b('0x16'));var licenseUtil=require(_0x401b('0x17'));var db=require(_0x401b('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x401b('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f1f87,_0x513531,_0x32103e,_0x121b61){return new BPromise(function(_0x433765,_0x5644a3){var _0x46255d=_0x121b61||client;return _0x46255d[_0x401b('0x1a')](_0x3f1f87,_0x32103e)[_0x401b('0x1b')](function(_0x55d83e){logger['info'](_0x401b('0x1c'),_0x513531,'request\x20sent');logger[_0x401b('0x1d')](_0x401b('0x1e'),_0x513531,_0x401b('0x1f'),JSON[_0x401b('0x20')](_0x55d83e));if(_0x55d83e[_0x401b('0x21')]){if(_0x55d83e[_0x401b('0x21')][_0x401b('0x22')]===0x1f4){logger[_0x401b('0x21')](_0x401b('0x1c'),_0x513531,_0x55d83e[_0x401b('0x21')][_0x401b('0x23')]);return _0x5644a3(_0x55d83e[_0x401b('0x21')][_0x401b('0x23')]);}logger[_0x401b('0x21')](_0x401b('0x1c'),_0x513531,_0x55d83e['error'][_0x401b('0x23')]);return _0x433765(_0x55d83e[_0x401b('0x21')][_0x401b('0x23')]);}else{logger['info'](_0x401b('0x1c'),_0x513531,'request\x20sent');_0x433765(_0x55d83e[_0x401b('0x24')][_0x401b('0x23')]);}})[_0x401b('0x25')](function(_0x2d3936){logger['error'](_0x401b('0x1c'),_0x513531,_0x2d3936);_0x5644a3(_0x2d3936);});});}function respondWithStatusCode(_0x4cb30b,_0x4c9f8f){_0x4c9f8f=_0x4c9f8f||0xcc;return function(_0x4e4f39){if(_0x4e4f39){return _0x4cb30b['sendStatus'](_0x4c9f8f);}return _0x4cb30b[_0x401b('0x26')](_0x4c9f8f)[_0x401b('0x27')]();};}function respondWithResult(_0x1c5fb3,_0xf94d23){_0xf94d23=_0xf94d23||0xc8;return function(_0x568b64){if(_0x568b64){return _0x1c5fb3['status'](_0xf94d23)[_0x401b('0x28')](_0x568b64);}};}function respondWithFilteredResult(_0xe3bd11,_0x25ccd0){return function(_0x4b2aa1){if(_0x4b2aa1){var _0x3167fd=typeof _0x25ccd0['offset']===_0x401b('0x29')&&typeof _0x25ccd0[_0x401b('0x2a')]==='undefined';var _0x3bd923=_0x4b2aa1[_0x401b('0x2b')];var _0x21eb1f=_0x3167fd?0x0:_0x25ccd0['offset'];var _0x5c5b8f=_0x3167fd?_0x4b2aa1[_0x401b('0x2b')]:_0x25ccd0['offset']+_0x25ccd0['limit'];var _0x107b5d;if(_0x5c5b8f>=_0x3bd923){_0x5c5b8f=_0x3bd923;_0x107b5d=0xc8;}else{_0x107b5d=0xce;}_0xe3bd11['status'](_0x107b5d);return _0xe3bd11[_0x401b('0x2c')]('Content-Range',_0x21eb1f+'-'+_0x5c5b8f+'/'+_0x3bd923)[_0x401b('0x28')](_0x4b2aa1);}return null;};}function patchUpdates(_0x51ab77){return function(_0x3a5063){try{jsonpatch['apply'](_0x3a5063,_0x51ab77,!![]);}catch(_0x71ced5){return BPromise['reject'](_0x71ced5);}return _0x3a5063[_0x401b('0x2d')]();};}function saveUpdates(_0x2e1a9e,_0xfaeaea){return function(_0x127e69){if(_0x127e69){return _0x127e69[_0x401b('0x2e')](_0x2e1a9e)['then'](function(_0x44597c){return _0x44597c;});}return null;};}function removeEntity(_0x5f3807,_0x300fc){return function(_0x3538d){if(_0x3538d){return _0x3538d[_0x401b('0x2f')]()[_0x401b('0x1b')](function(){var _0x113ce9=_0x3538d['get']({'plain':!![]});var _0x51007e=_0x401b('0x30');return db[_0x401b('0x31')]['destroy']({'where':{'type':_0x51007e,'resourceId':_0x113ce9['id']}})[_0x401b('0x1b')](function(){return _0x3538d;});})[_0x401b('0x1b')](function(){_0x5f3807['status'](0xcc)[_0x401b('0x27')]();});}};}function handleEntityNotFound(_0x170ccd,_0xd760e5){return function(_0x47ec61){if(!_0x47ec61){_0x170ccd[_0x401b('0x32')](0x194);}return _0x47ec61;};}function handleError(_0x541546,_0x461a3b){_0x461a3b=_0x461a3b||0x1f4;return function(_0x4d9d87){logger[_0x401b('0x21')](_0x4d9d87['stack']);if(_0x4d9d87[_0x401b('0x33')]){delete _0x4d9d87[_0x401b('0x33')];}_0x541546[_0x401b('0x26')](_0x461a3b)[_0x401b('0x34')](_0x4d9d87);};}exports[_0x401b('0x35')]=function(_0x342442,_0x2ed5f4){var _0x50d744={},_0x134e3b={},_0x482a46={'count':0x0,'rows':[]};var _0xc0029d=_['map'](db['VoiceContext'][_0x401b('0x36')],function(_0x28445c){return{'name':_0x28445c[_0x401b('0x37')],'type':_0x28445c[_0x401b('0x38')][_0x401b('0x39')]};});_0x134e3b[_0x401b('0x3a')]=_[_0x401b('0x3b')](_0xc0029d,'name');_0x134e3b[_0x401b('0x3c')]=_[_0x401b('0x3d')](_0x342442[_0x401b('0x3c')]);_0x134e3b[_0x401b('0x3e')]=_[_0x401b('0x3f')](_0x134e3b['model'],_0x134e3b[_0x401b('0x3c')]);_0x50d744[_0x401b('0x40')]=_[_0x401b('0x3f')](_0x134e3b[_0x401b('0x3a')],qs['fields'](_0x342442[_0x401b('0x3c')][_0x401b('0x41')]));_0x50d744[_0x401b('0x40')]=_0x50d744[_0x401b('0x40')][_0x401b('0x42')]?_0x50d744[_0x401b('0x40')]:_0x134e3b[_0x401b('0x3a')];if(!_0x342442[_0x401b('0x3c')][_0x401b('0x43')](_0x401b('0x44'))){_0x50d744[_0x401b('0x2a')]=qs[_0x401b('0x2a')](_0x342442[_0x401b('0x3c')][_0x401b('0x2a')]);_0x50d744[_0x401b('0x45')]=qs[_0x401b('0x45')](_0x342442['query']['offset']);}_0x50d744[_0x401b('0x46')]=qs[_0x401b('0x47')](_0x342442[_0x401b('0x3c')][_0x401b('0x47')]);_0x50d744[_0x401b('0x48')]=qs[_0x401b('0x3e')](_[_0x401b('0x49')](_0x342442['query'],_0x134e3b[_0x401b('0x3e')]),_0xc0029d);if(_0x342442[_0x401b('0x3c')][_0x401b('0x4a')]){_0x50d744[_0x401b('0x48')]=_['merge'](_0x50d744[_0x401b('0x48')],{'$or':_['map'](_0xc0029d,function(_0x339be1){if(_0x339be1[_0x401b('0x38')]!==_0x401b('0x4b')){var _0x4f3a39={};_0x4f3a39[_0x339be1[_0x401b('0x33')]]={'$like':'%'+_0x342442[_0x401b('0x3c')]['filter']+'%'};return _0x4f3a39;}})});}_0x50d744=_['merge']({},_0x50d744,_0x342442['options']);var _0x4d92d0={'where':_0x50d744[_0x401b('0x48')]};return db['VoiceContext'][_0x401b('0x2b')](_0x4d92d0)['then'](function(_0x4d02a3){_0x482a46[_0x401b('0x2b')]=_0x4d02a3;if(_0x342442[_0x401b('0x3c')]['includeAll']){_0x50d744[_0x401b('0x4c')]=[{'all':!![]}];}return db[_0x401b('0x4d')]['findAll'](_0x50d744);})[_0x401b('0x1b')](function(_0xc0f363){_0x482a46[_0x401b('0x4e')]=_0xc0f363;return _0x482a46;})[_0x401b('0x1b')](respondWithFilteredResult(_0x2ed5f4,_0x50d744))['catch'](handleError(_0x2ed5f4,null));};exports[_0x401b('0x4f')]=function(_0x5e3d9d,_0x1b1ffc){var _0x8f068a={'raw':![],'where':{'id':_0x5e3d9d[_0x401b('0x50')]['id']}},_0x1bfc36={};_0x1bfc36[_0x401b('0x3a')]=_[_0x401b('0x3d')](db[_0x401b('0x4d')][_0x401b('0x36')]);_0x1bfc36['query']=_[_0x401b('0x3d')](_0x5e3d9d[_0x401b('0x3c')]);_0x1bfc36[_0x401b('0x3e')]=_['intersection'](_0x1bfc36[_0x401b('0x3a')],_0x1bfc36[_0x401b('0x3c')]);_0x8f068a['attributes']=_[_0x401b('0x3f')](_0x1bfc36[_0x401b('0x3a')],qs[_0x401b('0x41')](_0x5e3d9d[_0x401b('0x3c')][_0x401b('0x41')]));_0x8f068a[_0x401b('0x40')]=_0x8f068a[_0x401b('0x40')][_0x401b('0x42')]?_0x8f068a['attributes']:_0x1bfc36[_0x401b('0x3a')];if(_0x5e3d9d[_0x401b('0x3c')][_0x401b('0x51')]){_0x8f068a[_0x401b('0x4c')]=[{'all':!![]}];}_0x8f068a=_['merge']({},_0x8f068a,_0x5e3d9d[_0x401b('0x52')]);return db[_0x401b('0x4d')]['find'](_0x8f068a)['then'](handleEntityNotFound(_0x1b1ffc,null))['then'](respondWithResult(_0x1b1ffc,null))[_0x401b('0x25')](handleError(_0x1b1ffc,null));};exports['create']=function(_0xf58ec4,_0x2c65a5,_0xe8106f){var _0x49a081;return db[_0x401b('0x4d')][_0x401b('0x53')](_0xf58ec4[_0x401b('0x54')],{'raw':!![]})[_0x401b('0x1b')](function(_0x4001de){_0x49a081=_0x4001de;return db[_0x401b('0x4d')][_0x401b('0x55')]({'raw':!![]});})[_0x401b('0x1b')](function(_0x4ca2fe){var _0xeaa256=fs['readFileSync'](path['join'](config[_0x401b('0x56')],_0x401b('0x57')),_0x401b('0x58'));var _0x4d50fd=ejs[_0x401b('0x59')](_0xeaa256,{'contexts':_0x4ca2fe||[]});fs[_0x401b('0x5a')](_0x401b('0x5b'),_0x4d50fd);})[_0x401b('0x1b')](function(){return respondWithRpcPromise(_0x401b('0x5c'),_0x401b('0x53'),{'module':_0x401b('0x5d')});})['then'](function(){var _0x164cdc=_0xf58ec4[_0x401b('0x5e')]['get']({'plain':!![]});if(!_0x164cdc)throw new Error(_0x401b('0x5f'));if(_0x164cdc[_0x401b('0x60')]===_0x401b('0x5e')){var _0x494a78=_0x49a081[_0x401b('0x61')]({'plain':!![]});return db[_0x401b('0x62')][_0x401b('0x63')]({'where':{'name':_0x401b('0x30'),'userProfileId':_0x164cdc[_0x401b('0x64')]},'raw':!![]})[_0x401b('0x1b')](function(_0x16e527){if(_0x16e527&&_0x16e527[_0x401b('0x65')]===0x0){return db[_0x401b('0x31')][_0x401b('0x53')]({'name':_0x494a78[_0x401b('0x33')],'resourceId':_0x494a78['id'],'type':_0x16e527[_0x401b('0x33')],'sectionId':_0x16e527['id']},{})[_0x401b('0x1b')](function(){return _0x49a081;});}else{return _0x49a081;}})[_0x401b('0x25')](function(_0x4a76ad){logger['error'](_0x401b('0x66'),_0x4a76ad);throw _0x4a76ad;});}return _0x49a081;})['then'](respondWithResult(_0x2c65a5,0xc9))[_0x401b('0x25')](handleError(_0x2c65a5,null));};exports[_0x401b('0x2e')]=function(_0x2ab53d,_0x393178,_0x17d38f){var _0x5a10f8;return db['VoiceContext']['find']({'where':{'id':_0x2ab53d[_0x401b('0x50')]['id']}})[_0x401b('0x1b')](handleEntityNotFound(_0x393178,null))[_0x401b('0x1b')](saveUpdates(_0x2ab53d['body'],null))[_0x401b('0x1b')](function(_0x357e1d){if(_0x357e1d){_0x5a10f8=_0x357e1d;return db['VoiceContext'][_0x401b('0x55')]({'raw':!![]});}})['then'](function(_0x1ba11d){var _0x1dcd49=fs['readFileSync'](path[_0x401b('0x67')](config['root'],_0x401b('0x57')),_0x401b('0x58'));var _0x178a4f=ejs[_0x401b('0x59')](_0x1dcd49,{'contexts':_0x1ba11d||[]});fs[_0x401b('0x5a')](_0x401b('0x5b'),_0x178a4f);})[_0x401b('0x1b')](function(){return respondWithRpcPromise(_0x401b('0x5c'),_0x401b('0x2e'),{'module':_0x401b('0x5d')});})[_0x401b('0x1b')](function(){return _0x5a10f8;})[_0x401b('0x1b')](respondWithResult(_0x393178,null))[_0x401b('0x25')](handleError(_0x393178,null));};exports[_0x401b('0x2f')]=function(_0x33de83,_0x474edb,_0x3e857e){var _0x36f14d;return db['VoiceContext'][_0x401b('0x63')]({'where':{'id':_0x33de83[_0x401b('0x50')]['id']}})['then'](handleEntityNotFound(_0x474edb,null))[_0x401b('0x1b')](removeEntity(_0x474edb,null))[_0x401b('0x1b')](function(){return db['VoiceContext'][_0x401b('0x55')]({'raw':!![]});})[_0x401b('0x1b')](function(_0x25eb5c){var _0xfe9930=fs[_0x401b('0x68')](path[_0x401b('0x67')](config[_0x401b('0x56')],'server/files/templates/context.ejs'),_0x401b('0x58'));var _0x2e1874=ejs['render'](_0xfe9930,{'contexts':_0x25eb5c});fs[_0x401b('0x5a')](_0x401b('0x5b'),_0x2e1874);return respondWithRpcPromise('Reload','destroy',{'module':_0x401b('0x5d')});})['catch'](handleError(_0x474edb,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 5799717..3b5d06d 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3b7=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xf9b1e3,_0x3d80cd){var _0x5c4c19=function(_0x3ba189){while(--_0x3ba189){_0xf9b1e3['push'](_0xf9b1e3['shift']());}};_0x5c4c19(++_0x3d80cd);}(_0xc3b7,0x1b6));var _0x7c3b=function(_0x415422,_0x1b7b1c){_0x415422=_0x415422-0x0;var _0x4754e7=_0xc3b7[_0x415422];return _0x4754e7;};'use strict';var _=require('lodash');var util=require(_0x7c3b('0x0'));var logger=require(_0x7c3b('0x1'))('api');var moment=require(_0x7c3b('0x2'));var BPromise=require(_0x7c3b('0x3'));var rp=require(_0x7c3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c3b('0x5'));var config=require(_0x7c3b('0x6'));var attributes=require(_0x7c3b('0x7'));module[_0x7c3b('0x8')]=function(_0x2335d3,_0x43c6a4){return _0x2335d3[_0x7c3b('0x9')](_0x7c3b('0xa'),attributes,{'tableName':_0x7c3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfca=['exports','define','VoiceContext','voice_contexts','util','api','moment','request-promise','path','rimraf'];(function(_0x2d45e5,_0x2cea38){var _0x198e08=function(_0x37d568){while(--_0x37d568){_0x2d45e5['push'](_0x2d45e5['shift']());}};_0x198e08(++_0x2cea38);}(_0xcfca,0x90));var _0xacfc=function(_0x6f85de,_0x2c21f5){_0x6f85de=_0x6f85de-0x0;var _0xde330b=_0xcfca[_0x6f85de];return _0xde330b;};'use strict';var _=require('lodash');var util=require(_0xacfc('0x0'));var logger=require('../../config/logger')(_0xacfc('0x1'));var moment=require(_0xacfc('0x2'));var BPromise=require('bluebird');var rp=require(_0xacfc('0x3'));var fs=require('fs');var path=require(_0xacfc('0x4'));var rimraf=require(_0xacfc('0x5'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xacfc('0x6')]=function(_0x3f1bde,_0x5b03e0){return _0x3f1bde[_0xacfc('0x7')](_0xacfc('0x8'),attributes,{'tableName':_0xacfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 3eed23c..befae5c 100644 --- a/server/api/voiceContext/voiceContext.rpc.js +++ b/server/api/voiceContext/voiceContext.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x281d=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x33dbe6,_0x30a1de){var _0x3480ae=function(_0x182a1d){while(--_0x182a1d){_0x33dbe6['push'](_0x33dbe6['shift']());}};_0x3480ae(++_0x30a1de);}(_0x281d,0x195));var _0xd281=function(_0x43370a,_0xc7a2a2){_0x43370a=_0x43370a-0x0;var _0x9a58d4=_0x281d[_0x43370a];return _0x9a58d4;};'use strict';var _=require(_0xd281('0x0'));var util=require(_0xd281('0x1'));var moment=require('moment');var BPromise=require(_0xd281('0x2'));var rs=require(_0xd281('0x3'));var fs=require('fs');var Redis=require(_0xd281('0x4'));var db=require(_0xd281('0x5'))['db'];var utils=require(_0xd281('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd281('0x7'));var jayson=require(_0xd281('0x8'));var client=jayson[_0xd281('0x9')][_0xd281('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x519785,_0x3134f0,_0x529f19){return new BPromise(function(_0xe901ac,_0x27662a){return client[_0xd281('0xb')](_0x519785,_0x529f19)[_0xd281('0xc')](function(_0x3da53b){logger[_0xd281('0xd')]('VoiceContext,\x20%s,\x20%s',_0x3134f0,_0xd281('0xe'));logger[_0xd281('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3134f0,_0xd281('0xe'),JSON[_0xd281('0x10')](_0x3da53b));if(_0x3da53b[_0xd281('0x11')]){if(_0x3da53b[_0xd281('0x11')][_0xd281('0x12')]===0x1f4){logger['error'](_0xd281('0x13'),_0x3134f0,_0x3da53b[_0xd281('0x11')][_0xd281('0x14')]);return _0x27662a(_0x3da53b['error'][_0xd281('0x14')]);}logger[_0xd281('0x11')](_0xd281('0x13'),_0x3134f0,_0x3da53b[_0xd281('0x11')]['message']);return _0xe901ac(_0x3da53b[_0xd281('0x11')][_0xd281('0x14')]);}else{logger[_0xd281('0xd')](_0xd281('0x13'),_0x3134f0,_0xd281('0xe'));_0xe901ac(_0x3da53b[_0xd281('0x15')][_0xd281('0x14')]);}})[_0xd281('0x16')](function(_0x2a94fa){logger[_0xd281('0x11')]('VoiceContext,\x20%s,\x20%s',_0x3134f0,_0x2a94fa);_0x27662a(_0x2a94fa);});});} \ No newline at end of file +var _0x2b84=['jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x42cc1f,_0xe9eb20){var _0x175df5=function(_0x2f3e22){while(--_0x2f3e22){_0x42cc1f['push'](_0x42cc1f['shift']());}};_0x175df5(++_0xe9eb20);}(_0x2b84,0x1ed));var _0x42b8=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x2b84[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x42b8('0x0'));var util=require(_0x42b8('0x1'));var moment=require('moment');var BPromise=require(_0x42b8('0x2'));var rs=require(_0x42b8('0x3'));var fs=require('fs');var Redis=require(_0x42b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42b8('0x5'));var logger=require('../../config/logger')(_0x42b8('0x6'));var config=require('../../config/environment');var jayson=require(_0x42b8('0x7'));var client=jayson[_0x42b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a040d,_0x399f8e,_0x23459e){return new BPromise(function(_0x1c6323,_0x38de8a){return client[_0x42b8('0x9')](_0x4a040d,_0x23459e)['then'](function(_0x381f1a){logger[_0x42b8('0xa')](_0x42b8('0xb'),_0x399f8e,_0x42b8('0xc'));logger[_0x42b8('0xd')](_0x42b8('0xe'),_0x399f8e,_0x42b8('0xc'),JSON[_0x42b8('0xf')](_0x381f1a));if(_0x381f1a['error']){if(_0x381f1a['error'][_0x42b8('0x10')]===0x1f4){logger[_0x42b8('0x11')]('VoiceContext,\x20%s,\x20%s',_0x399f8e,_0x381f1a[_0x42b8('0x11')]['message']);return _0x38de8a(_0x381f1a['error'][_0x42b8('0x12')]);}logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x381f1a[_0x42b8('0x11')][_0x42b8('0x12')]);return _0x1c6323(_0x381f1a['error'][_0x42b8('0x12')]);}else{logger['info'](_0x42b8('0xb'),_0x399f8e,'request\x20sent');_0x1c6323(_0x381f1a['result'][_0x42b8('0x12')]);}})[_0x42b8('0x13')](function(_0x2d1706){logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x2d1706);_0x38de8a(_0x2d1706);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c5eaefa..5fe355a 100644 --- a/server/api/voiceDialReport/index.js +++ b/server/api/voiceDialReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7088=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','multer'];(function(_0x1a75c5,_0xa8d923){var _0x21c259=function(_0x128b6d){while(--_0x128b6d){_0x1a75c5['push'](_0x1a75c5['shift']());}};_0x21c259(++_0xa8d923);}(_0x7088,0x7d));var _0x8708=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7088[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0x8708('0x0'));var util=require(_0x8708('0x1'));var path=require(_0x8708('0x2'));var timeout=require(_0x8708('0x3'));var express=require(_0x8708('0x4'));var router=express[_0x8708('0x5')]();var fs_extra=require(_0x8708('0x6'));var auth=require(_0x8708('0x7'));var interaction=require(_0x8708('0x8'));var config=require(_0x8708('0x9'));var controller=require('./voiceDialReport.controller');router[_0x8708('0xa')]('/',auth[_0x8708('0xb')](),controller[_0x8708('0xc')]);router[_0x8708('0xa')](_0x8708('0xd'),auth[_0x8708('0xb')](),controller[_0x8708('0xe')]);router[_0x8708('0xa')](_0x8708('0xf'),auth[_0x8708('0xb')](),controller[_0x8708('0x10')]);router['post']('/',auth[_0x8708('0xb')](),controller['create']);router[_0x8708('0x11')](_0x8708('0xf'),auth[_0x8708('0xb')](),controller[_0x8708('0x12')]);router[_0x8708('0x13')](_0x8708('0xf'),auth[_0x8708('0xb')](),controller[_0x8708('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb4e0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','create','put','update','delete','destroy','multer','util','path'];(function(_0x55ecda,_0x10dd24){var _0x1f5748=function(_0x45cd41){while(--_0x45cd41){_0x55ecda['push'](_0x55ecda['shift']());}};_0x1f5748(++_0x10dd24);}(_0xb4e0,0x10b));var _0x0b4e=function(_0x481b2c,_0x293b7a){_0x481b2c=_0x481b2c-0x0;var _0x676fa5=_0xb4e0[_0x481b2c];return _0x676fa5;};'use strict';var multer=require(_0x0b4e('0x0'));var util=require(_0x0b4e('0x1'));var path=require(_0x0b4e('0x2'));var timeout=require(_0x0b4e('0x3'));var express=require(_0x0b4e('0x4'));var router=express[_0x0b4e('0x5')]();var fs_extra=require(_0x0b4e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0b4e('0x7'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0x0b4e('0x8')]('/',auth[_0x0b4e('0x9')](),controller[_0x0b4e('0xa')]);router[_0x0b4e('0x8')]('/describe',auth[_0x0b4e('0x9')](),controller[_0x0b4e('0xb')]);router['get'](_0x0b4e('0xc'),auth[_0x0b4e('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0b4e('0xd')]);router[_0x0b4e('0xe')](_0x0b4e('0xc'),auth[_0x0b4e('0x9')](),controller[_0x0b4e('0xf')]);router[_0x0b4e('0x10')]('/:id',auth[_0x0b4e('0x9')](),controller[_0x0b4e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a2987a7..d753c8c 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x50d832,_0x430313){var _0x4152eb=function(_0x141ade){while(--_0x141ade){_0x50d832['push'](_0x50d832['shift']());}};_0x4152eb(++_0x430313);}(_0x55ca,0x126));var _0xa55c=function(_0x21bef5,_0x27b94a){_0x21bef5=_0x21bef5-0x0;var _0x524300=_0x55ca[_0x21bef5];return _0x524300;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x25fc01,_0x272720){var _0x4c71b0=function(_0x4579be){while(--_0x4579be){_0x25fc01['push'](_0x25fc01['shift']());}};_0x4c71b0(++_0x272720);}(_0x55ca,0x126));var _0xa55c=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x55ca[_0x2468b5];return _0x1056e4;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f8e5507..27166ab 100644 --- a/server/api/voiceDialReport/voiceDialReport.controller.js +++ b/server/api/voiceDialReport/voiceDialReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1540=['query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VoiceDialReport','includeAll','include','catch','params','keys','options','find','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','update','then','destroy','end','name','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x4b2308,_0x5568fb){var _0x35d134=function(_0x17ef2f){while(--_0x17ef2f){_0x4b2308['push'](_0x4b2308['shift']());}};_0x35d134(++_0x5568fb);}(_0x1540,0xa5));var _0x0154=function(_0x156cc7,_0x164992){_0x156cc7=_0x156cc7-0x0;var _0x255d50=_0x1540[_0x156cc7];return _0x255d50;};'use strict';var emlformat=require(_0x0154('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0154('0x1'));var jsonpatch=require(_0x0154('0x2'));var rp=require('request-promise');var moment=require(_0x0154('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0154('0x4'));var util=require(_0x0154('0x5'));var path=require(_0x0154('0x6'));var sox=require(_0x0154('0x7'));var csv=require(_0x0154('0x8'));var ejs=require(_0x0154('0x9'));var fs=require('fs');var fs_extra=require(_0x0154('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0154('0xb'));var jsforce=require(_0x0154('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0154('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0154('0xd'));var authService=require(_0x0154('0xe'));var qs=require(_0x0154('0xf'));var as=require(_0x0154('0x10'));var hardwareService=require(_0x0154('0x11'));var logger=require(_0x0154('0x12'))(_0x0154('0x13'));var utils=require(_0x0154('0x14'));var config=require(_0x0154('0x15'));var licenseUtil=require(_0x0154('0x16'));var db=require(_0x0154('0x17'))['db'];function respondWithStatusCode(_0x2f5bbc,_0x37fc68){_0x37fc68=_0x37fc68||0xcc;return function(_0x4273f9){if(_0x4273f9){return _0x2f5bbc[_0x0154('0x18')](_0x37fc68);}return _0x2f5bbc['status'](_0x37fc68)['end']();};}function respondWithResult(_0x1c6f18,_0x4ebbe8){_0x4ebbe8=_0x4ebbe8||0xc8;return function(_0x5d58b1){if(_0x5d58b1){return _0x1c6f18[_0x0154('0x19')](_0x4ebbe8)['json'](_0x5d58b1);}};}function respondWithFilteredResult(_0x255a3d,_0x272258){return function(_0x269fce){if(_0x269fce){var _0x49f9e0=typeof _0x272258[_0x0154('0x1a')]===_0x0154('0x1b')&&typeof _0x272258['limit']===_0x0154('0x1b');var _0x35a544=_0x269fce[_0x0154('0x1c')];var _0x1bc1b0=_0x49f9e0?0x0:_0x272258['offset'];var _0x3a8b5e=_0x49f9e0?_0x269fce[_0x0154('0x1c')]:_0x272258[_0x0154('0x1a')]+_0x272258['limit'];var _0x426224;if(_0x3a8b5e>=_0x35a544){_0x3a8b5e=_0x35a544;_0x426224=0xc8;}else{_0x426224=0xce;}_0x255a3d[_0x0154('0x19')](_0x426224);return _0x255a3d[_0x0154('0x1d')](_0x0154('0x1e'),_0x1bc1b0+'-'+_0x3a8b5e+'/'+_0x35a544)[_0x0154('0x1f')](_0x269fce);}return null;};}function patchUpdates(_0x13b366){return function(_0x964262){try{jsonpatch[_0x0154('0x20')](_0x964262,_0x13b366,!![]);}catch(_0x120e97){return BPromise['reject'](_0x120e97);}return _0x964262['save']();};}function saveUpdates(_0x298003,_0x276a5b){return function(_0x1e1a62){if(_0x1e1a62){return _0x1e1a62[_0x0154('0x21')](_0x298003)[_0x0154('0x22')](function(_0x505b6a){return _0x505b6a;});}return null;};}function removeEntity(_0x54e698,_0xb627d1){return function(_0xa8065){if(_0xa8065){return _0xa8065[_0x0154('0x23')]()[_0x0154('0x22')](function(){_0x54e698['status'](0xcc)[_0x0154('0x24')]();});}};}function handleEntityNotFound(_0x105ded,_0x27356f){return function(_0x360c3e){if(!_0x360c3e){_0x105ded[_0x0154('0x18')](0x194);}return _0x360c3e;};}function handleError(_0x97fe4e,_0x7ae0f){_0x7ae0f=_0x7ae0f||0x1f4;return function(_0x52112b){logger['error'](_0x52112b['stack']);if(_0x52112b[_0x0154('0x25')]){delete _0x52112b[_0x0154('0x25')];}_0x97fe4e[_0x0154('0x19')](_0x7ae0f)['send'](_0x52112b);};}exports[_0x0154('0x26')]=function(_0x232d85,_0x1f8312){var _0x5aac1f={},_0x1adb38={},_0x2236b9={'count':0x0,'rows':[]};var _0x290362=_[_0x0154('0x27')](db['VoiceDialReport'][_0x0154('0x28')],function(_0x391f0b){return{'name':_0x391f0b[_0x0154('0x29')],'type':_0x391f0b[_0x0154('0x2a')][_0x0154('0x2b')]};});_0x1adb38[_0x0154('0x2c')]=_[_0x0154('0x27')](_0x290362,'name');_0x1adb38[_0x0154('0x2d')]=_['keys'](_0x232d85[_0x0154('0x2d')]);_0x1adb38['filters']=_[_0x0154('0x2e')](_0x1adb38[_0x0154('0x2c')],_0x1adb38['query']);_0x5aac1f['attributes']=_[_0x0154('0x2e')](_0x1adb38[_0x0154('0x2c')],qs['fields'](_0x232d85[_0x0154('0x2d')][_0x0154('0x2f')]));_0x5aac1f['attributes']=_0x5aac1f[_0x0154('0x30')][_0x0154('0x31')]?_0x5aac1f[_0x0154('0x30')]:_0x1adb38[_0x0154('0x2c')];if(!_0x232d85[_0x0154('0x2d')][_0x0154('0x32')](_0x0154('0x33'))){_0x5aac1f['limit']=qs[_0x0154('0x34')](_0x232d85[_0x0154('0x2d')][_0x0154('0x34')]);_0x5aac1f[_0x0154('0x1a')]=qs[_0x0154('0x1a')](_0x232d85[_0x0154('0x2d')][_0x0154('0x1a')]);}_0x5aac1f[_0x0154('0x35')]=qs[_0x0154('0x36')](_0x232d85['query']['sort']);_0x5aac1f[_0x0154('0x37')]=qs[_0x0154('0x38')](_[_0x0154('0x39')](_0x232d85[_0x0154('0x2d')],_0x1adb38[_0x0154('0x38')]),_0x290362);if(_0x232d85[_0x0154('0x2d')][_0x0154('0x3a')]){_0x5aac1f[_0x0154('0x37')]=_[_0x0154('0x3b')](_0x5aac1f['where'],{'$or':_[_0x0154('0x27')](_0x290362,function(_0x30d758){if(_0x30d758[_0x0154('0x2a')]!=='VIRTUAL'){var _0x48c01e={};_0x48c01e[_0x30d758[_0x0154('0x25')]]={'$like':'%'+_0x232d85['query'][_0x0154('0x3a')]+'%'};return _0x48c01e;}})});}_0x5aac1f=_[_0x0154('0x3b')]({},_0x5aac1f,_0x232d85['options']);var _0x4c97af={'where':_0x5aac1f[_0x0154('0x37')]};return db[_0x0154('0x3c')][_0x0154('0x1c')](_0x4c97af)[_0x0154('0x22')](function(_0x3509a5){_0x2236b9[_0x0154('0x1c')]=_0x3509a5;if(_0x232d85[_0x0154('0x2d')][_0x0154('0x3d')]){_0x5aac1f[_0x0154('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x5aac1f);})[_0x0154('0x22')](function(_0x5bc292){_0x2236b9['rows']=_0x5bc292;return _0x2236b9;})[_0x0154('0x22')](respondWithFilteredResult(_0x1f8312,_0x5aac1f))[_0x0154('0x3f')](handleError(_0x1f8312,null));};exports['show']=function(_0x196815,_0x2d9b78){var _0x3c8102={'raw':!![],'where':{'id':_0x196815[_0x0154('0x40')]['id']}},_0x2ba009={};_0x2ba009[_0x0154('0x2c')]=_[_0x0154('0x41')](db[_0x0154('0x3c')]['rawAttributes']);_0x2ba009[_0x0154('0x2d')]=_[_0x0154('0x41')](_0x196815[_0x0154('0x2d')]);_0x2ba009[_0x0154('0x38')]=_['intersection'](_0x2ba009['model'],_0x2ba009[_0x0154('0x2d')]);_0x3c8102[_0x0154('0x30')]=_[_0x0154('0x2e')](_0x2ba009[_0x0154('0x2c')],qs[_0x0154('0x2f')](_0x196815[_0x0154('0x2d')][_0x0154('0x2f')]));_0x3c8102['attributes']=_0x3c8102['attributes']['length']?_0x3c8102[_0x0154('0x30')]:_0x2ba009[_0x0154('0x2c')];if(_0x196815[_0x0154('0x2d')]['includeAll']){_0x3c8102[_0x0154('0x3e')]=[{'all':!![]}];}_0x3c8102=_['merge']({},_0x3c8102,_0x196815[_0x0154('0x42')]);return db['VoiceDialReport'][_0x0154('0x43')](_0x3c8102)[_0x0154('0x22')](handleEntityNotFound(_0x2d9b78,null))['then'](respondWithResult(_0x2d9b78,null))[_0x0154('0x3f')](handleError(_0x2d9b78,null));};exports[_0x0154('0x44')]=function(_0xbe3b4a,_0x2153c8){return db['VoiceDialReport'][_0x0154('0x44')](_0xbe3b4a[_0x0154('0x45')],{})[_0x0154('0x22')](respondWithResult(_0x2153c8,0xc9))[_0x0154('0x3f')](handleError(_0x2153c8,null));};exports['update']=function(_0x5df290,_0x142f99){if(_0x5df290[_0x0154('0x45')]['id']){delete _0x5df290[_0x0154('0x45')]['id'];}return db['VoiceDialReport'][_0x0154('0x43')]({'where':{'id':_0x5df290[_0x0154('0x40')]['id']}})[_0x0154('0x22')](handleEntityNotFound(_0x142f99,null))['then'](saveUpdates(_0x5df290[_0x0154('0x45')],null))[_0x0154('0x22')](respondWithResult(_0x142f99,null))[_0x0154('0x3f')](handleError(_0x142f99,null));};exports[_0x0154('0x23')]=function(_0x51c69d,_0x4e68a7){return db[_0x0154('0x3c')][_0x0154('0x43')]({'where':{'id':_0x51c69d['params']['id']}})[_0x0154('0x22')](handleEntityNotFound(_0x4e68a7,null))[_0x0154('0x22')](removeEntity(_0x4e68a7,null))[_0x0154('0x3f')](handleError(_0x4e68a7,null));};exports['describe']=function(_0x195e56,_0x319b60){return db[_0x0154('0x3c')]['describe']()['then'](respondWithResult(_0x319b60,null))[_0x0154('0x3f')](handleError(_0x319b60,null));}; \ No newline at end of file +var _0x720c=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3cd7f6,_0x450dab){var _0x5efe01=function(_0x51233b){while(--_0x51233b){_0x3cd7f6['push'](_0x3cd7f6['shift']());}};_0x5efe01(++_0x450dab);}(_0x720c,0x12d));var _0xc720=function(_0x3386fd,_0x8596f4){_0x3386fd=_0x3386fd-0x0;var _0x19e6f6=_0x720c[_0x3386fd];return _0x19e6f6;};'use strict';var emlformat=require(_0xc720('0x0'));var rimraf=require(_0xc720('0x1'));var zipdir=require(_0xc720('0x2'));var jsonpatch=require(_0xc720('0x3'));var rp=require(_0xc720('0x4'));var moment=require(_0xc720('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc720('0x6'));var util=require('util');var path=require(_0xc720('0x7'));var sox=require(_0xc720('0x8'));var csv=require(_0xc720('0x9'));var ejs=require(_0xc720('0xa'));var fs=require('fs');var fs_extra=require(_0xc720('0xb'));var _=require(_0xc720('0xc'));var squel=require('squel');var crypto=require(_0xc720('0xd'));var jsforce=require(_0xc720('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc720('0xf'));var Papa=require(_0xc720('0x10'));var Redis=require(_0xc720('0x11'));var authService=require(_0xc720('0x12'));var qs=require(_0xc720('0x13'));var as=require(_0xc720('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc720('0x15'))(_0xc720('0x16'));var utils=require(_0xc720('0x17'));var config=require(_0xc720('0x18'));var licenseUtil=require(_0xc720('0x19'));var db=require(_0xc720('0x1a'))['db'];function respondWithStatusCode(_0x28a733,_0x54f5e0){_0x54f5e0=_0x54f5e0||0xcc;return function(_0x5d48c9){if(_0x5d48c9){return _0x28a733[_0xc720('0x1b')](_0x54f5e0);}return _0x28a733[_0xc720('0x1c')](_0x54f5e0)['end']();};}function respondWithResult(_0x318c12,_0x132c70){_0x132c70=_0x132c70||0xc8;return function(_0x143a0f){if(_0x143a0f){return _0x318c12[_0xc720('0x1c')](_0x132c70)[_0xc720('0x1d')](_0x143a0f);}};}function respondWithFilteredResult(_0x3fb79c,_0x21ed05){return function(_0x39f2f3){if(_0x39f2f3){var _0x3d7a32=typeof _0x21ed05[_0xc720('0x1e')]===_0xc720('0x1f')&&typeof _0x21ed05[_0xc720('0x20')]===_0xc720('0x1f');var _0x3c68bd=_0x39f2f3[_0xc720('0x21')];var _0x120f8d=_0x3d7a32?0x0:_0x21ed05['offset'];var _0x594098=_0x3d7a32?_0x39f2f3[_0xc720('0x21')]:_0x21ed05['offset']+_0x21ed05[_0xc720('0x20')];var _0x33fe3f;if(_0x594098>=_0x3c68bd){_0x594098=_0x3c68bd;_0x33fe3f=0xc8;}else{_0x33fe3f=0xce;}_0x3fb79c[_0xc720('0x1c')](_0x33fe3f);return _0x3fb79c['set'](_0xc720('0x22'),_0x120f8d+'-'+_0x594098+'/'+_0x3c68bd)['json'](_0x39f2f3);}return null;};}function patchUpdates(_0x4581a7){return function(_0x4afb7b){try{jsonpatch['apply'](_0x4afb7b,_0x4581a7,!![]);}catch(_0x570a9e){return BPromise[_0xc720('0x23')](_0x570a9e);}return _0x4afb7b[_0xc720('0x24')]();};}function saveUpdates(_0x1b6b8e,_0x526861){return function(_0x5a4518){if(_0x5a4518){return _0x5a4518['update'](_0x1b6b8e)[_0xc720('0x25')](function(_0x81cfa7){return _0x81cfa7;});}return null;};}function removeEntity(_0xff387e,_0x1603ac){return function(_0x26f379){if(_0x26f379){return _0x26f379[_0xc720('0x26')]()[_0xc720('0x25')](function(){_0xff387e[_0xc720('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36e636,_0x11b4ec){return function(_0x1b076b){if(!_0x1b076b){_0x36e636['sendStatus'](0x194);}return _0x1b076b;};}function handleError(_0x24a576,_0x3a20bd){_0x3a20bd=_0x3a20bd||0x1f4;return function(_0x53aa58){logger[_0xc720('0x27')](_0x53aa58[_0xc720('0x28')]);if(_0x53aa58['name']){delete _0x53aa58[_0xc720('0x29')];}_0x24a576['status'](_0x3a20bd)[_0xc720('0x2a')](_0x53aa58);};}exports[_0xc720('0x2b')]=function(_0x380ba0,_0x2d9aee){var _0x1e906e={},_0x1dfd0c={},_0x25f1ea={'count':0x0,'rows':[]};var _0x130d07=_[_0xc720('0x2c')](db[_0xc720('0x2d')]['rawAttributes'],function(_0x474e6d){return{'name':_0x474e6d['fieldName'],'type':_0x474e6d[_0xc720('0x2e')][_0xc720('0x2f')]};});_0x1dfd0c[_0xc720('0x30')]=_[_0xc720('0x2c')](_0x130d07,_0xc720('0x29'));_0x1dfd0c[_0xc720('0x31')]=_[_0xc720('0x32')](_0x380ba0[_0xc720('0x31')]);_0x1dfd0c[_0xc720('0x33')]=_['intersection'](_0x1dfd0c[_0xc720('0x30')],_0x1dfd0c['query']);_0x1e906e[_0xc720('0x34')]=_[_0xc720('0x35')](_0x1dfd0c[_0xc720('0x30')],qs[_0xc720('0x36')](_0x380ba0['query'][_0xc720('0x36')]));_0x1e906e[_0xc720('0x34')]=_0x1e906e[_0xc720('0x34')][_0xc720('0x37')]?_0x1e906e[_0xc720('0x34')]:_0x1dfd0c[_0xc720('0x30')];if(!_0x380ba0[_0xc720('0x31')]['hasOwnProperty'](_0xc720('0x38'))){_0x1e906e[_0xc720('0x20')]=qs[_0xc720('0x20')](_0x380ba0[_0xc720('0x31')][_0xc720('0x20')]);_0x1e906e[_0xc720('0x1e')]=qs[_0xc720('0x1e')](_0x380ba0['query'][_0xc720('0x1e')]);}_0x1e906e[_0xc720('0x39')]=qs[_0xc720('0x3a')](_0x380ba0[_0xc720('0x31')][_0xc720('0x3a')]);_0x1e906e[_0xc720('0x3b')]=qs['filters'](_[_0xc720('0x3c')](_0x380ba0[_0xc720('0x31')],_0x1dfd0c[_0xc720('0x33')]),_0x130d07);if(_0x380ba0['query'][_0xc720('0x3d')]){_0x1e906e[_0xc720('0x3b')]=_[_0xc720('0x3e')](_0x1e906e['where'],{'$or':_['map'](_0x130d07,function(_0x48a79f){if(_0x48a79f[_0xc720('0x2e')]!==_0xc720('0x3f')){var _0x22f6ea={};_0x22f6ea[_0x48a79f[_0xc720('0x29')]]={'$like':'%'+_0x380ba0[_0xc720('0x31')][_0xc720('0x3d')]+'%'};return _0x22f6ea;}})});}_0x1e906e=_[_0xc720('0x3e')]({},_0x1e906e,_0x380ba0[_0xc720('0x40')]);var _0x5120a3={'where':_0x1e906e[_0xc720('0x3b')]};return db[_0xc720('0x2d')][_0xc720('0x21')](_0x5120a3)[_0xc720('0x25')](function(_0x6a067b){_0x25f1ea[_0xc720('0x21')]=_0x6a067b;if(_0x380ba0['query'][_0xc720('0x41')]){_0x1e906e['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0xc720('0x42')](_0x1e906e);})[_0xc720('0x25')](function(_0x17e8fd){_0x25f1ea[_0xc720('0x43')]=_0x17e8fd;return _0x25f1ea;})[_0xc720('0x25')](respondWithFilteredResult(_0x2d9aee,_0x1e906e))[_0xc720('0x44')](handleError(_0x2d9aee,null));};exports[_0xc720('0x45')]=function(_0x261955,_0x57c304){var _0x3dea64={'raw':!![],'where':{'id':_0x261955[_0xc720('0x46')]['id']}},_0x416af4={};_0x416af4[_0xc720('0x30')]=_[_0xc720('0x32')](db['VoiceDialReport'][_0xc720('0x47')]);_0x416af4[_0xc720('0x31')]=_[_0xc720('0x32')](_0x261955['query']);_0x416af4[_0xc720('0x33')]=_[_0xc720('0x35')](_0x416af4['model'],_0x416af4[_0xc720('0x31')]);_0x3dea64[_0xc720('0x34')]=_['intersection'](_0x416af4[_0xc720('0x30')],qs['fields'](_0x261955[_0xc720('0x31')][_0xc720('0x36')]));_0x3dea64[_0xc720('0x34')]=_0x3dea64[_0xc720('0x34')][_0xc720('0x37')]?_0x3dea64['attributes']:_0x416af4['model'];if(_0x261955[_0xc720('0x31')]['includeAll']){_0x3dea64[_0xc720('0x48')]=[{'all':!![]}];}_0x3dea64=_[_0xc720('0x3e')]({},_0x3dea64,_0x261955[_0xc720('0x40')]);return db[_0xc720('0x2d')][_0xc720('0x49')](_0x3dea64)['then'](handleEntityNotFound(_0x57c304,null))[_0xc720('0x25')](respondWithResult(_0x57c304,null))[_0xc720('0x44')](handleError(_0x57c304,null));};exports[_0xc720('0x4a')]=function(_0x266365,_0x6d97d3){return db['VoiceDialReport'][_0xc720('0x4a')](_0x266365[_0xc720('0x4b')],{})[_0xc720('0x25')](respondWithResult(_0x6d97d3,0xc9))[_0xc720('0x44')](handleError(_0x6d97d3,null));};exports['update']=function(_0x36dde6,_0x31b708){if(_0x36dde6[_0xc720('0x4b')]['id']){delete _0x36dde6[_0xc720('0x4b')]['id'];}return db[_0xc720('0x2d')][_0xc720('0x49')]({'where':{'id':_0x36dde6[_0xc720('0x46')]['id']}})['then'](handleEntityNotFound(_0x31b708,null))[_0xc720('0x25')](saveUpdates(_0x36dde6[_0xc720('0x4b')],null))['then'](respondWithResult(_0x31b708,null))[_0xc720('0x44')](handleError(_0x31b708,null));};exports[_0xc720('0x26')]=function(_0x590852,_0x2682cc){return db[_0xc720('0x2d')]['find']({'where':{'id':_0x590852[_0xc720('0x46')]['id']}})[_0xc720('0x25')](handleEntityNotFound(_0x2682cc,null))[_0xc720('0x25')](removeEntity(_0x2682cc,null))['catch'](handleError(_0x2682cc,null));};exports[_0xc720('0x4c')]=function(_0x134bb6,_0x3e0cd1){return db[_0xc720('0x2d')][_0xc720('0x4c')]()['then'](respondWithResult(_0x3e0cd1,null))[_0xc720('0x44')](handleError(_0x3e0cd1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 6cfd36b..c7998d2 100644 --- a/server/api/voiceDialReport/voiceDialReport.model.js +++ b/server/api/voiceDialReport/voiceDialReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2629=['exports','define','report_dial','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbbc905,_0x4b6103){var _0x29731c=function(_0x5d6c6c){while(--_0x5d6c6c){_0xbbc905['push'](_0xbbc905['shift']());}};_0x29731c(++_0x4b6103);}(_0x2629,0x1c7));var _0x9262=function(_0x123da7,_0x1da803){_0x123da7=_0x123da7-0x0;var _0x48b201=_0x2629[_0x123da7];return _0x48b201;};'use strict';var _=require(_0x9262('0x0'));var util=require(_0x9262('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9262('0x2'));var rp=require(_0x9262('0x3'));var fs=require('fs');var path=require(_0x9262('0x4'));var rimraf=require(_0x9262('0x5'));var config=require(_0x9262('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x9262('0x7')]=function(_0x462edb,_0x500bde){return _0x462edb[_0x9262('0x8')]('VoiceDialReport',attributes,{'tableName':_0x9262('0x9'),'paranoid':![],'indexes':[{'fields':[_0x9262('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1b6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x29ed9b,_0x565d42){var _0x2a8159=function(_0x4eb7ad){while(--_0x4eb7ad){_0x29ed9b['push'](_0x29ed9b['shift']());}};_0x2a8159(++_0x565d42);}(_0xc1b6,0xfb));var _0x6c1b=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xc1b6[_0x39772f];return _0xc9edbf;};'use strict';var _=require(_0x6c1b('0x0'));var util=require(_0x6c1b('0x1'));var logger=require(_0x6c1b('0x2'))(_0x6c1b('0x3'));var moment=require(_0x6c1b('0x4'));var BPromise=require(_0x6c1b('0x5'));var rp=require(_0x6c1b('0x6'));var fs=require('fs');var path=require(_0x6c1b('0x7'));var rimraf=require(_0x6c1b('0x8'));var config=require(_0x6c1b('0x9'));var attributes=require('./voiceDialReport.attributes');module[_0x6c1b('0xa')]=function(_0x41edb2,_0x1b942a){return _0x41edb2[_0x6c1b('0xb')](_0x6c1b('0xc'),attributes,{'tableName':_0x6c1b('0xd'),'paranoid':![],'indexes':[{'fields':[_0x6c1b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8143742..332c3bf 100644 --- a/server/api/voiceDialReport/voiceDialReport.rpc.js +++ b/server/api/voiceDialReport/voiceDialReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe294=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','CreateVoiceDialReport','VoiceDialReport','body','options','catch','UpdateVoiceDialReport','update','where','attributes','limit','then'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xe294,0x7c));var _0x4e29=function(_0x140e29,_0x3284b8){_0x140e29=_0x140e29-0x0;var _0x8f54e0=_0xe294[_0x140e29];return _0x8f54e0;};'use strict';var _=require(_0x4e29('0x0'));var util=require(_0x4e29('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4e29('0x2'));var fs=require('fs');var Redis=require(_0x4e29('0x3'));var db=require(_0x4e29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e29('0x5'))(_0x4e29('0x6'));var config=require(_0x4e29('0x7'));var jayson=require(_0x4e29('0x8'));var client=jayson[_0x4e29('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x572743,_0x423a68,_0x57c3d2){return new BPromise(function(_0x2e0eb2,_0x225fd0){return client[_0x4e29('0xa')](_0x572743,_0x57c3d2)['then'](function(_0x96d97e){logger[_0x4e29('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x423a68,'request\x20sent');logger[_0x4e29('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x423a68,_0x4e29('0xd'),JSON[_0x4e29('0xe')](_0x96d97e));if(_0x96d97e[_0x4e29('0xf')]){if(_0x96d97e['error'][_0x4e29('0x10')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x423a68,_0x96d97e['error'][_0x4e29('0x11')]);return _0x225fd0(_0x96d97e[_0x4e29('0xf')][_0x4e29('0x11')]);}logger[_0x4e29('0xf')](_0x4e29('0x12'),_0x423a68,_0x96d97e[_0x4e29('0xf')][_0x4e29('0x11')]);return _0x2e0eb2(_0x96d97e[_0x4e29('0xf')]['message']);}else{logger[_0x4e29('0xb')](_0x4e29('0x12'),_0x423a68,_0x4e29('0xd'));_0x2e0eb2(_0x96d97e[_0x4e29('0x13')]['message']);}})['catch'](function(_0x13f95d){logger['error'](_0x4e29('0x12'),_0x423a68,_0x13f95d);_0x225fd0(_0x13f95d);});});}exports[_0x4e29('0x14')]=function(_0x145038){var _0x504f30=this;return new Promise(function(_0x4e1f61,_0x234576){return db[_0x4e29('0x15')]['create'](_0x145038[_0x4e29('0x16')],{'raw':_0x145038[_0x4e29('0x17')]?_0x145038[_0x4e29('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xe4d2cd){logger[_0x4e29('0xb')](_0x4e29('0x14'),_0x145038);logger[_0x4e29('0xc')](_0x4e29('0x14'),_0x145038,JSON['stringify'](_0xe4d2cd));_0x4e1f61(_0xe4d2cd);})[_0x4e29('0x18')](function(_0x5a9254){logger[_0x4e29('0xf')](_0x4e29('0x14'),_0x5a9254['message'],_0x145038);_0x234576(_0x504f30[_0x4e29('0xf')](0x1f4,_0x5a9254[_0x4e29('0x11')]));});});};exports[_0x4e29('0x19')]=function(_0x81565d){var _0x536cff=this;return new Promise(function(_0x5af7a9,_0x1590e0){return db[_0x4e29('0x15')][_0x4e29('0x1a')](_0x81565d[_0x4e29('0x16')],{'raw':_0x81565d[_0x4e29('0x17')]?_0x81565d[_0x4e29('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x81565d[_0x4e29('0x17')]?_0x81565d[_0x4e29('0x17')][_0x4e29('0x1b')]||null:null,'attributes':_0x81565d[_0x4e29('0x17')]?_0x81565d[_0x4e29('0x17')][_0x4e29('0x1c')]||null:null,'limit':_0x81565d[_0x4e29('0x17')]?_0x81565d[_0x4e29('0x17')][_0x4e29('0x1d')]||null:null})[_0x4e29('0x1e')](function(_0x21fb52){logger[_0x4e29('0xb')](_0x4e29('0x19'),_0x81565d);logger[_0x4e29('0xc')](_0x4e29('0x19'),_0x81565d,JSON[_0x4e29('0xe')](_0x21fb52));_0x5af7a9(_0x21fb52);})[_0x4e29('0x18')](function(_0x3373b6){logger[_0x4e29('0xf')](_0x4e29('0x19'),_0x3373b6[_0x4e29('0x11')],_0x81565d);_0x1590e0(_0x536cff['error'](0x1f4,_0x3373b6['message']));});});}; \ No newline at end of file +var _0x393f=['debug','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create','options','then','UpdateVoiceDialReport','body','raw','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0xcfaafe,_0x1c2685){var _0x3b2f30=function(_0x4c06ef){while(--_0x4c06ef){_0xcfaafe['push'](_0xcfaafe['shift']());}};_0x3b2f30(++_0x1c2685);}(_0x393f,0x102));var _0xf393=function(_0x18acc2,_0x27c98c){_0x18acc2=_0x18acc2-0x0;var _0x4c8c20=_0x393f[_0x18acc2];return _0x4c8c20;};'use strict';var _=require(_0xf393('0x0'));var util=require(_0xf393('0x1'));var moment=require(_0xf393('0x2'));var BPromise=require(_0xf393('0x3'));var rs=require(_0xf393('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf393('0x5'))['db'];var utils=require(_0xf393('0x6'));var logger=require(_0xf393('0x7'))(_0xf393('0x8'));var config=require(_0xf393('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf393('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32ed5a,_0x3ccd7b,_0x207c41){return new BPromise(function(_0x32c86c,_0x18dfb8){return client[_0xf393('0xb')](_0x32ed5a,_0x207c41)['then'](function(_0x5d3296){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x3ccd7b,'request\x20sent');logger[_0xf393('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3ccd7b,_0xf393('0xd'),JSON[_0xf393('0xe')](_0x5d3296));if(_0x5d3296[_0xf393('0xf')]){if(_0x5d3296[_0xf393('0xf')][_0xf393('0x10')]===0x1f4){logger['error'](_0xf393('0x11'),_0x3ccd7b,_0x5d3296[_0xf393('0xf')]['message']);return _0x18dfb8(_0x5d3296[_0xf393('0xf')][_0xf393('0x12')]);}logger[_0xf393('0xf')](_0xf393('0x11'),_0x3ccd7b,_0x5d3296[_0xf393('0xf')][_0xf393('0x12')]);return _0x32c86c(_0x5d3296['error'][_0xf393('0x12')]);}else{logger[_0xf393('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x3ccd7b,_0xf393('0xd'));_0x32c86c(_0x5d3296['result'][_0xf393('0x12')]);}})[_0xf393('0x14')](function(_0x4850bb){logger['error'](_0xf393('0x11'),_0x3ccd7b,_0x4850bb);_0x18dfb8(_0x4850bb);});});}exports[_0xf393('0x15')]=function(_0x1b62c3){var _0x5cdbde=this;return new Promise(function(_0x311a4b,_0x1bc0f0){return db[_0xf393('0x16')][_0xf393('0x17')](_0x1b62c3['body'],{'raw':_0x1b62c3[_0xf393('0x18')]?_0x1b62c3[_0xf393('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf393('0x19')](function(_0x203923){logger[_0xf393('0x13')](_0xf393('0x15'),_0x1b62c3);logger[_0xf393('0xc')]('CreateVoiceDialReport',_0x1b62c3,JSON[_0xf393('0xe')](_0x203923));_0x311a4b(_0x203923);})[_0xf393('0x14')](function(_0x5b5919){logger['error'](_0xf393('0x15'),_0x5b5919[_0xf393('0x12')],_0x1b62c3);_0x1bc0f0(_0x5cdbde[_0xf393('0xf')](0x1f4,_0x5b5919[_0xf393('0x12')]));});});};exports[_0xf393('0x1a')]=function(_0x41f3ed){var _0x3d37b6=this;return new Promise(function(_0x1a469d,_0x137e4d){return db[_0xf393('0x16')]['update'](_0x41f3ed[_0xf393('0x1b')],{'raw':_0x41f3ed[_0xf393('0x18')]?_0x41f3ed[_0xf393('0x18')][_0xf393('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41f3ed[_0xf393('0x18')]?_0x41f3ed[_0xf393('0x18')]['where']||null:null,'attributes':_0x41f3ed[_0xf393('0x18')]?_0x41f3ed['options']['attributes']||null:null,'limit':_0x41f3ed[_0xf393('0x18')]?_0x41f3ed['options'][_0xf393('0x1d')]||null:null})[_0xf393('0x19')](function(_0x248d6e){logger[_0xf393('0x13')]('UpdateVoiceDialReport',_0x41f3ed);logger[_0xf393('0xc')](_0xf393('0x1a'),_0x41f3ed,JSON[_0xf393('0xe')](_0x248d6e));_0x1a469d(_0x248d6e);})['catch'](function(_0x52c5f9){logger[_0xf393('0xf')](_0xf393('0x1a'),_0x52c5f9[_0xf393('0x12')],_0x41f3ed);_0x137e4d(_0x3d37b6[_0xf393('0xf')](0x1f4,_0x52c5f9[_0xf393('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a174566..6560854 100644 --- a/server/api/voiceExtension/index.js +++ b/server/api/voiceExtension/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8019=['create','/:id/applications','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post'];(function(_0x1c908d,_0x502994){var _0x1abd78=function(_0x540add){while(--_0x540add){_0x1c908d['push'](_0x1c908d['shift']());}};_0x1abd78(++_0x502994);}(_0x8019,0x157));var _0x9801=function(_0x1c310a,_0x2dede8){_0x1c310a=_0x1c310a-0x0;var _0x5ea9d9=_0x8019[_0x1c310a];return _0x5ea9d9;};'use strict';var multer=require('multer');var util=require(_0x9801('0x0'));var path=require(_0x9801('0x1'));var timeout=require(_0x9801('0x2'));var express=require(_0x9801('0x3'));var router=express[_0x9801('0x4')]();var fs_extra=require(_0x9801('0x5'));var auth=require(_0x9801('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9801('0x7'));var controller=require(_0x9801('0x8'));router[_0x9801('0x9')]('/',auth[_0x9801('0xa')](),controller[_0x9801('0xb')]);router[_0x9801('0x9')]('/:id',auth[_0x9801('0xa')](),controller[_0x9801('0xc')]);router[_0x9801('0xd')]('/',auth['isAuthenticated'](),controller[_0x9801('0xe')]);router[_0x9801('0xd')](_0x9801('0xf'),auth[_0x9801('0xa')](),controller['addApplications']);router[_0x9801('0x10')](_0x9801('0x11'),auth[_0x9801('0xa')](),controller[_0x9801('0x12')]);router[_0x9801('0x13')](_0x9801('0x11'),auth[_0x9801('0xa')](),controller[_0x9801('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe52c=['create','/:id/applications','addApplications','put','update','delete','/:id','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','show','post'];(function(_0x47069d,_0x5be5a9){var _0x80fafd=function(_0x58e7fa){while(--_0x58e7fa){_0x47069d['push'](_0x47069d['shift']());}};_0x80fafd(++_0x5be5a9);}(_0xe52c,0x10c));var _0xce52=function(_0x4c5f40,_0xee8e5b){_0x4c5f40=_0x4c5f40-0x0;var _0x450b41=_0xe52c[_0x4c5f40];return _0x450b41;};'use strict';var multer=require(_0xce52('0x0'));var util=require('util');var path=require(_0xce52('0x1'));var timeout=require(_0xce52('0x2'));var express=require('express');var router=express[_0xce52('0x3')]();var fs_extra=require(_0xce52('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xce52('0x5'));var config=require('../../config/environment');var controller=require(_0xce52('0x6'));router[_0xce52('0x7')]('/',auth[_0xce52('0x8')](),controller[_0xce52('0x9')]);router[_0xce52('0x7')]('/:id',auth[_0xce52('0x8')](),controller[_0xce52('0xa')]);router[_0xce52('0xb')]('/',auth[_0xce52('0x8')](),controller[_0xce52('0xc')]);router['post'](_0xce52('0xd'),auth[_0xce52('0x8')](),controller[_0xce52('0xe')]);router[_0xce52('0xf')]('/:id',auth[_0xce52('0x8')](),controller[_0xce52('0x10')]);router[_0xce52('0x11')](_0xce52('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xce52('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 11488f9..b1f6e8f 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b6d=['BOOLEAN','VIRTUAL','getDataValue','sequelize','exports','STRING','NoOp','ENUM','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x1a787c,_0x4e81ea){var _0x3e3a2b=function(_0x47df26){while(--_0x47df26){_0x1a787c['push'](_0x1a787c['shift']());}};_0x3e3a2b(++_0x4e81ea);}(_0x6b6d,0xc3));var _0xd6b6=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x6b6d[_0x3aaf0a];return _0x33e6bc;};'use strict';var Sequelize=require(_0xd6b6('0x0'));module[_0xd6b6('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd6b6('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xd6b6('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd6b6('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd6b6('0x2')],'allowNull':![],'defaultValue':_0xd6b6('0x3')},'appdata':{'type':Sequelize[_0xd6b6('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd6b6('0x4')](_0xd6b6('0x5'),_0xd6b6('0x6'),_0xd6b6('0x7'),'inbound-fax',_0xd6b6('0x8'),_0xd6b6('0x9'),_0xd6b6('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xd6b6('0x2')]},'interval':{'type':Sequelize[_0xd6b6('0x2')],'allowNull':![],'defaultValue':_0xd6b6('0xb')},'IntervalId':{'type':Sequelize[_0xd6b6('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd6b6('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd6b6('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd6b6('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd6b6('0xc')]},'recordingFormat':{'type':Sequelize[_0xd6b6('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xd6b6('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd6b6('0xe')],'get':function(_0x256e95){return this[_0xd6b6('0xf')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x5293=['compositeIndex','ENUM','inbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exports','STRING'];(function(_0x4b558a,_0x982838){var _0x14a656=function(_0x458fb9){while(--_0x458fb9){_0x4b558a['push'](_0x4b558a['shift']());}};_0x14a656(++_0x982838);}(_0x5293,0xb2));var _0x3529=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x5293[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require('sequelize');module[_0x3529('0x0')]={'context':{'type':Sequelize[_0x3529('0x1')],'allowNull':![],'unique':_0x3529('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3529('0x1')],'allowNull':![],'unique':_0x3529('0x2')},'priority':{'type':Sequelize[_0x3529('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x3529('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3529('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3529('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3529('0x3')](_0x3529('0x4'),'outbound',_0x3529('0x5'),_0x3529('0x6'),_0x3529('0x7'),'system',_0x3529('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x3529('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3529('0x9')},'IntervalId':{'type':Sequelize[_0x3529('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3529('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x3529('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3529('0xa')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x3529('0xc')},'answer':{'type':Sequelize[_0x3529('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3529('0xd')],'get':function(_0x2d8b27){return this[_0x3529('0xe')]('exten');}},'alias':{'type':Sequelize[_0x3529('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f9ae372..aeb94c3 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9474=['ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','then','end','stack','send','index','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','includeAll','include','VoiceExtension','findAll','rows','catch','show','params','options','create','body','startsWith','exten','user','role','OutboundRoutes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9474,0x69));var _0x4947=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x9474[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x4947('0x0'));var Redis=require(_0x4947('0x1'));var qs=require(_0x4947('0x2'));var logger=require(_0x4947('0x3'))(_0x4947('0x4'));var config=require(_0x4947('0x5'));var db=require(_0x4947('0x6'))['db'];config[_0x4947('0x7')]=_[_0x4947('0x8')](config[_0x4947('0x7')],{'host':_0x4947('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4947('0xa'))[_0x4947('0xb')](socket);function respondWithStatusCode(_0x78a9ae,_0x2901ba){_0x2901ba=_0x2901ba||0xcc;return function(_0x242404){if(_0x242404){return _0x78a9ae[_0x4947('0xc')](_0x2901ba);}return _0x78a9ae[_0x4947('0xd')](_0x2901ba)['end']();};}function respondWithResult(_0x5cdd5c,_0x3294ff){_0x3294ff=_0x3294ff||0xc8;return function(_0x333a83){if(_0x333a83){return _0x5cdd5c[_0x4947('0xd')](_0x3294ff)[_0x4947('0xe')](_0x333a83);}};}function respondWithFilteredResult(_0x55fbb4,_0x42ae63){return function(_0x52390e){if(_0x52390e){var _0x4606b4=typeof _0x42ae63[_0x4947('0xf')]===_0x4947('0x10')&&typeof _0x42ae63['limit']===_0x4947('0x10');var _0x28c3cf=_0x52390e[_0x4947('0x11')];var _0x5f009f=_0x4606b4?0x0:_0x42ae63[_0x4947('0xf')];var _0x429ce3=_0x4606b4?_0x52390e[_0x4947('0x11')]:_0x42ae63['offset']+_0x42ae63['limit'];var _0xf0569a;if(_0x429ce3>=_0x28c3cf){_0x429ce3=_0x28c3cf;_0xf0569a=0xc8;}else{_0xf0569a=0xce;}_0x55fbb4['status'](_0xf0569a);return _0x55fbb4[_0x4947('0x12')](_0x4947('0x13'),_0x5f009f+'-'+_0x429ce3+'/'+_0x28c3cf)[_0x4947('0xe')](_0x52390e);}return null;};}function removeEntity(_0x5b29c9){return function(_0x5c4478){if(_0x5c4478){return _0x5c4478[_0x4947('0x14')]()['then'](function(){var _0x424c5f=_0x5c4478[_0x4947('0x15')]({'plain':!![]});var _0x465c15=[{'name':_0x4947('0x16'),'value':_0x4947('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0x4947('0x18'),'ignore':![]},{'name':_0x4947('0x19'),'value':_0x4947('0x1a'),'ignore':![]}];var _0x4e4548=_(_0x465c15)[_0x4947('0x1b')](_0x4947('0x1c'))[_0x4947('0x1d')](_0x4947('0x1e'))[_0x4947('0x1e')]();if(_['includes'](_0x4e4548,_0x424c5f[_0x4947('0x1f')])){return;}var _0x14782e=_[_0x4947('0x20')](_0x465c15,[_0x4947('0x1e'),_0x424c5f['type']])[_0x4947('0x21')];return db[_0x4947('0x22')]['destroy']({'where':{'type':_0x14782e,'resourceId':_0x424c5f['id']}})[_0x4947('0x23')](function(){return _0x5c4478;});})['then'](function(){_0x5b29c9['status'](0xcc)[_0x4947('0x24')]();});}};}function handleEntityNotFound(_0x30d76b){return function(_0x27a75b){if(!_0x27a75b){_0x30d76b[_0x4947('0xc')](0x194);}return _0x27a75b;};}function handleError(_0x292c0d,_0x463601){_0x463601=_0x463601||0x1f4;return function(_0xb40305){logger['error'](_0xb40305[_0x4947('0x25')]);if(_0xb40305['name']){delete _0xb40305[_0x4947('0x21')];}_0x292c0d['status'](_0x463601)[_0x4947('0x26')](_0xb40305);};}exports[_0x4947('0x27')]=function(_0x4d41a3,_0x27a6f9){var _0x29f02f={},_0x19a237={},_0x716a1={'count':0x0,'rows':[]};var _0x3e7790=_['map'](db['VoiceExtension'][_0x4947('0x28')],function(_0x29d7cd){return{'name':_0x29d7cd[_0x4947('0x29')],'type':_0x29d7cd[_0x4947('0x1f')]['key']};});_0x19a237[_0x4947('0x2a')]=_['map'](_0x3e7790,_0x4947('0x21'));_0x19a237[_0x4947('0x2b')]=_[_0x4947('0x2c')](_0x4d41a3['query']);_0x19a237[_0x4947('0x2d')]=_[_0x4947('0x2e')](_0x19a237[_0x4947('0x2a')],_0x19a237[_0x4947('0x2b')]);_0x29f02f['attributes']=_[_0x4947('0x2e')](_0x19a237[_0x4947('0x2a')],qs[_0x4947('0x2f')](_0x4d41a3[_0x4947('0x2b')][_0x4947('0x2f')]));_0x29f02f[_0x4947('0x30')]=_0x29f02f[_0x4947('0x30')][_0x4947('0x31')]?_0x29f02f['attributes']:_0x19a237[_0x4947('0x2a')];if(!_0x4d41a3[_0x4947('0x2b')]['hasOwnProperty'](_0x4947('0x32'))){_0x29f02f[_0x4947('0x33')]=qs['limit'](_0x4d41a3[_0x4947('0x2b')]['limit']);_0x29f02f[_0x4947('0xf')]=qs[_0x4947('0xf')](_0x4d41a3[_0x4947('0x2b')][_0x4947('0xf')]);}_0x29f02f[_0x4947('0x34')]=qs['sort'](_0x4d41a3[_0x4947('0x2b')][_0x4947('0x35')]);_0x29f02f['where']=qs[_0x4947('0x2d')](_[_0x4947('0x36')](_0x4d41a3[_0x4947('0x2b')],_0x19a237[_0x4947('0x2d')]),_0x3e7790);if(_0x4d41a3['query']['filter']){_0x29f02f[_0x4947('0x37')]=_['merge'](_0x29f02f['where'],{'$or':_[_0x4947('0x1d')](_0x3e7790,function(_0x45f7f3){if(_0x45f7f3[_0x4947('0x1f')]!==_0x4947('0x38')){var _0x11d57f={};_0x11d57f[_0x45f7f3[_0x4947('0x21')]]={'$like':'%'+_0x4d41a3['query']['filter']+'%'};return _0x11d57f;}})});}_0x29f02f=_[_0x4947('0x39')]({},_0x29f02f,_0x4d41a3['options']);var _0x1eb19c={'where':_0x29f02f[_0x4947('0x37')]};return db['VoiceExtension']['count'](_0x1eb19c)[_0x4947('0x23')](function(_0x331163){_0x716a1[_0x4947('0x11')]=_0x331163;if(_0x4d41a3[_0x4947('0x2b')][_0x4947('0x3a')]){_0x29f02f[_0x4947('0x3b')]=[{'all':!![]}];}return db[_0x4947('0x3c')][_0x4947('0x3d')](_0x29f02f);})[_0x4947('0x23')](function(_0xfaafa6){_0x716a1[_0x4947('0x3e')]=_0xfaafa6;return _0x716a1;})['then'](respondWithFilteredResult(_0x27a6f9,_0x29f02f))[_0x4947('0x3f')](handleError(_0x27a6f9,null));};exports[_0x4947('0x40')]=function(_0x57532f,_0x2a122e){var _0x52a135={'raw':![],'where':{'id':_0x57532f[_0x4947('0x41')]['id']}},_0x34079b={};_0x34079b[_0x4947('0x2a')]=_[_0x4947('0x2c')](db[_0x4947('0x3c')][_0x4947('0x28')]);_0x34079b[_0x4947('0x2b')]=_[_0x4947('0x2c')](_0x57532f['query']);_0x34079b[_0x4947('0x2d')]=_[_0x4947('0x2e')](_0x34079b[_0x4947('0x2a')],_0x34079b[_0x4947('0x2b')]);_0x52a135[_0x4947('0x30')]=_['intersection'](_0x34079b[_0x4947('0x2a')],qs[_0x4947('0x2f')](_0x57532f['query'][_0x4947('0x2f')]));_0x52a135['attributes']=_0x52a135[_0x4947('0x30')][_0x4947('0x31')]?_0x52a135[_0x4947('0x30')]:_0x34079b[_0x4947('0x2a')];if(_0x57532f[_0x4947('0x2b')][_0x4947('0x3a')]){_0x52a135[_0x4947('0x3b')]=[{'all':!![]}];}_0x52a135=_[_0x4947('0x39')]({},_0x52a135,_0x57532f[_0x4947('0x42')]);return db['VoiceExtension'][_0x4947('0x20')](_0x52a135)['then'](handleEntityNotFound(_0x2a122e,null))['then'](respondWithResult(_0x2a122e,null))[_0x4947('0x3f')](handleError(_0x2a122e,null));};exports[_0x4947('0x14')]=function(_0x27133c,_0x3e5359){return db[_0x4947('0x3c')][_0x4947('0x20')]({'where':{'id':_0x27133c[_0x4947('0x41')]['id']}})[_0x4947('0x23')](handleEntityNotFound(_0x3e5359,null))[_0x4947('0x23')](removeEntity(_0x3e5359,null))[_0x4947('0x3f')](handleError(_0x3e5359,null));};exports[_0x4947('0x43')]=function(_0x507468,_0xf1088){if(_0x507468[_0x4947('0x44')][_0x4947('0x1f')]===_0x4947('0x18')&&!_[_0x4947('0x45')](_0x507468['body'][_0x4947('0x46')],'_')){_0x507468['body'][_0x4947('0x46')]='_'['concat'](_0x507468[_0x4947('0x44')][_0x4947('0x46')]);}return db[_0x4947('0x3c')][_0x4947('0x43')](_0x507468['body'],{'raw':![]})['then'](function(_0x5da663){var _0x3f9842=_0x507468[_0x4947('0x47')][_0x4947('0x15')]({'plain':!![]});if(!_0x3f9842)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f9842[_0x4947('0x48')]===_0x4947('0x47')){var _0x225234=_0x5da663['get']({'plain':!![]});var _0x6e62e7=[{'name':_0x4947('0x16'),'value':_0x4947('0x17')},{'name':_0x4947('0x49'),'value':'outbound'},{'name':'InternalRoutes','value':_0x4947('0x1a')}];var _0x3ec6ac=_[_0x4947('0x20')](_0x6e62e7,[_0x4947('0x1e'),_0x225234['type']])[_0x4947('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec6ac,'userProfileId':_0x3f9842[_0x4947('0x4a')]},'raw':!![]})[_0x4947('0x23')](function(_0x3d83ef){if(_0x3d83ef&&_0x3d83ef[_0x4947('0x4b')]===0x0){return db[_0x4947('0x22')]['create']({'name':_0x225234[_0x4947('0x21')],'resourceId':_0x225234['id'],'type':_0x3d83ef['name'],'sectionId':_0x3d83ef['id']},{})[_0x4947('0x23')](function(){return _0x5da663;});}else{return _0x5da663;}})[_0x4947('0x3f')](function(_0x2f287c){logger[_0x4947('0x4c')](_0x4947('0x4d'),_0x2f287c);throw _0x2f287c;});}return _0x5da663;})[_0x4947('0x23')](respondWithResult(_0xf1088,0xc9))[_0x4947('0x3f')](handleError(_0xf1088,null));};exports['update']=function(_0x425ae6,_0x1912a9){if(_0x425ae6[_0x4947('0x44')]['id']){delete _0x425ae6[_0x4947('0x44')]['id'];}return db[_0x4947('0x3c')]['find']({'where':{'id':_0x425ae6[_0x4947('0x41')]['id']}})[_0x4947('0x23')](handleEntityNotFound(_0x1912a9,null))[_0x4947('0x23')](function(_0x3e35ff){if(_0x3e35ff){return db[_0x4947('0x3c')][_0x4947('0x4e')](_['pick'](_0x425ae6[_0x4947('0x44')],[_0x4947('0x46'),'context',_0x4947('0x4f'),_0x4947('0x50'),_0x4947('0x51'),_0x4947('0x52'),_0x4947('0x53')]),{'where':{'context':_0x3e35ff[_0x4947('0x54')],'exten':_0x3e35ff['exten']},'individualHooks':!![]})[_0x4947('0x23')](function(_0x340bac){return _0x340bac;});}return null;})[_0x4947('0x23')](respondWithStatusCode(_0x1912a9,null))[_0x4947('0x3f')](handleError(_0x1912a9,null));};exports[_0x4947('0x55')]=function(_0x55467f,_0x56e171){var _0x18ffbd=_0x55467f[_0x4947('0x41')]['id'];var _0xd901bc=_0x55467f['body'];var _0x2f9b0f=0xc8;var _0x268c71=null;return db[_0x4947('0x56')][_0x4947('0x57')]({'isolationLevel':db[_0x4947('0x56')][_0x4947('0x58')][_0x4947('0x59')][_0x4947('0x5a')]},function(_0x28c8b3){return db[_0x4947('0x3c')][_0x4947('0x5b')]({'where':{'id':_0x18ffbd},'transaction':_0x28c8b3})[_0x4947('0x23')](function(_0x5a2b9a){if(_0x5a2b9a){return db['VoiceExtension'][_0x4947('0x14')]({'where':{'VoiceExtensionId':_0x18ffbd},'transaction':_0x28c8b3})['then'](function(){var _0x2a2a5e=_[_0x4947('0x1d')](_0xd901bc,function(_0x1f39e5){_0x1f39e5[_0x4947('0x5c')]=_0x18ffbd;_0x1f39e5[_0x4947('0x5d')]=!![];return _0x1f39e5;});return _0x5a2b9a[_0x4947('0x5e')](_0x2a2a5e);})[_0x4947('0x23')](function(_0x44af4a){return db[_0x4947('0x3c')][_0x4947('0x5f')](_0x44af4a,{'transaction':_0x28c8b3});});}else{_0x2f9b0f=0x194;_0x268c71=[];}});})[_0x4947('0x23')](function(){if(_0x2f9b0f!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x18ffbd},'order':_0x4947('0x60')})[_0x4947('0x23')](function(_0x2f6daa){_0x268c71=_0x2f6daa;});}})[_0x4947('0x3f')](function(_0x1abf05){_0x2f9b0f=0x1f4;logger['error'](_0x1abf05[_0x4947('0x25')]);if(_0x1abf05[_0x4947('0x21')]){delete _0x1abf05[_0x4947('0x21')];}_0x268c71=_0x1abf05;})['finally'](function(){if(_0x268c71===null){_0x56e171['sendStatus'](_0x2f9b0f);}else{if(_0x2f9b0f===0x1f4){_0x56e171[_0x4947('0xd')](_0x2f9b0f)['send'](_0x268c71);}else{_0x56e171['status'](_0x2f9b0f)[_0x4947('0xe')](_0x268c71);}}});}; \ No newline at end of file +var _0xded1=['rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filters','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','create','body','outbound','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','update','context','recordingFormat','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','destroy','get','InboundRoutes','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','then','stack','send','index','VoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xded1,0x8f));var _0x1ded=function(_0x456011,_0x5a8d20){_0x456011=_0x456011-0x0;var _0x27935a=_0xded1[_0x456011];return _0x27935a;};'use strict';var _=require(_0x1ded('0x0'));var Redis=require('ioredis');var qs=require(_0x1ded('0x1'));var logger=require(_0x1ded('0x2'))(_0x1ded('0x3'));var config=require(_0x1ded('0x4'));var db=require(_0x1ded('0x5'))['db'];config[_0x1ded('0x6')]=_[_0x1ded('0x7')](config['redis'],{'host':_0x1ded('0x8'),'port':0x18eb});var socket=require(_0x1ded('0x9'))(new Redis(config[_0x1ded('0x6')]));require(_0x1ded('0xa'))[_0x1ded('0xb')](socket);function respondWithStatusCode(_0x1c4cfb,_0x5b253d){_0x5b253d=_0x5b253d||0xcc;return function(_0x4b97a2){if(_0x4b97a2){return _0x1c4cfb[_0x1ded('0xc')](_0x5b253d);}return _0x1c4cfb[_0x1ded('0xd')](_0x5b253d)[_0x1ded('0xe')]();};}function respondWithResult(_0x5214e0,_0x2ad572){_0x2ad572=_0x2ad572||0xc8;return function(_0x22f5ed){if(_0x22f5ed){return _0x5214e0[_0x1ded('0xd')](_0x2ad572)['json'](_0x22f5ed);}};}function respondWithFilteredResult(_0x5b5348,_0x380219){return function(_0x29b27d){if(_0x29b27d){var _0x278920=typeof _0x380219[_0x1ded('0xf')]===_0x1ded('0x10')&&typeof _0x380219[_0x1ded('0x11')]===_0x1ded('0x10');var _0x1b9b7e=_0x29b27d['count'];var _0x21f81b=_0x278920?0x0:_0x380219[_0x1ded('0xf')];var _0x204b00=_0x278920?_0x29b27d[_0x1ded('0x12')]:_0x380219['offset']+_0x380219[_0x1ded('0x11')];var _0x13a2ce;if(_0x204b00>=_0x1b9b7e){_0x204b00=_0x1b9b7e;_0x13a2ce=0xc8;}else{_0x13a2ce=0xce;}_0x5b5348[_0x1ded('0xd')](_0x13a2ce);return _0x5b5348['set'](_0x1ded('0x13'),_0x21f81b+'-'+_0x204b00+'/'+_0x1b9b7e)['json'](_0x29b27d);}return null;};}function removeEntity(_0x556858){return function(_0x455f95){if(_0x455f95){return _0x455f95[_0x1ded('0x14')]()['then'](function(){var _0x1fea58=_0x455f95[_0x1ded('0x15')]({'plain':!![]});var _0x2d948b=[{'name':_0x1ded('0x16'),'value':'inbound','ignore':![]},{'name':_0x1ded('0x17'),'value':'outbound','ignore':![]},{'name':_0x1ded('0x18'),'value':_0x1ded('0x19'),'ignore':![]}];var _0x6fb879=_(_0x2d948b)[_0x1ded('0x1a')](_0x1ded('0x1b'))[_0x1ded('0x1c')](_0x1ded('0x1d'))['value']();if(_[_0x1ded('0x1e')](_0x6fb879,_0x1fea58[_0x1ded('0x1f')])){return;}var _0x2b1692=_[_0x1ded('0x20')](_0x2d948b,[_0x1ded('0x1d'),_0x1fea58[_0x1ded('0x1f')]])[_0x1ded('0x21')];return db['UserProfileResource'][_0x1ded('0x14')]({'where':{'type':_0x2b1692,'resourceId':_0x1fea58['id']}})['then'](function(){return _0x455f95;});})[_0x1ded('0x22')](function(){_0x556858['status'](0xcc)[_0x1ded('0xe')]();});}};}function handleEntityNotFound(_0x25bcde){return function(_0x7a5e54){if(!_0x7a5e54){_0x25bcde['sendStatus'](0x194);}return _0x7a5e54;};}function handleError(_0x4a58e2,_0x17f3ac){_0x17f3ac=_0x17f3ac||0x1f4;return function(_0x3ee095){logger['error'](_0x3ee095[_0x1ded('0x23')]);if(_0x3ee095[_0x1ded('0x21')]){delete _0x3ee095[_0x1ded('0x21')];}_0x4a58e2[_0x1ded('0xd')](_0x17f3ac)[_0x1ded('0x24')](_0x3ee095);};}exports[_0x1ded('0x25')]=function(_0x5d9727,_0xf0a31c){var _0xec71a4={},_0xb50986={},_0x173c68={'count':0x0,'rows':[]};var _0x3d5c54=_[_0x1ded('0x1c')](db[_0x1ded('0x26')][_0x1ded('0x27')],function(_0x4c47b0){return{'name':_0x4c47b0[_0x1ded('0x28')],'type':_0x4c47b0[_0x1ded('0x1f')][_0x1ded('0x29')]};});_0xb50986[_0x1ded('0x2a')]=_[_0x1ded('0x1c')](_0x3d5c54,_0x1ded('0x21'));_0xb50986[_0x1ded('0x2b')]=_['keys'](_0x5d9727[_0x1ded('0x2b')]);_0xb50986['filters']=_[_0x1ded('0x2c')](_0xb50986[_0x1ded('0x2a')],_0xb50986[_0x1ded('0x2b')]);_0xec71a4['attributes']=_['intersection'](_0xb50986[_0x1ded('0x2a')],qs['fields'](_0x5d9727[_0x1ded('0x2b')][_0x1ded('0x2d')]));_0xec71a4[_0x1ded('0x2e')]=_0xec71a4[_0x1ded('0x2e')]['length']?_0xec71a4[_0x1ded('0x2e')]:_0xb50986[_0x1ded('0x2a')];if(!_0x5d9727[_0x1ded('0x2b')][_0x1ded('0x2f')]('nolimit')){_0xec71a4[_0x1ded('0x11')]=qs[_0x1ded('0x11')](_0x5d9727[_0x1ded('0x2b')][_0x1ded('0x11')]);_0xec71a4['offset']=qs[_0x1ded('0xf')](_0x5d9727['query']['offset']);}_0xec71a4[_0x1ded('0x30')]=qs['sort'](_0x5d9727[_0x1ded('0x2b')][_0x1ded('0x31')]);_0xec71a4['where']=qs['filters'](_[_0x1ded('0x32')](_0x5d9727['query'],_0xb50986[_0x1ded('0x33')]),_0x3d5c54);if(_0x5d9727[_0x1ded('0x2b')][_0x1ded('0x1a')]){_0xec71a4[_0x1ded('0x34')]=_[_0x1ded('0x35')](_0xec71a4[_0x1ded('0x34')],{'$or':_['map'](_0x3d5c54,function(_0x21fe3f){if(_0x21fe3f[_0x1ded('0x1f')]!==_0x1ded('0x36')){var _0x46e8f6={};_0x46e8f6[_0x21fe3f[_0x1ded('0x21')]]={'$like':'%'+_0x5d9727[_0x1ded('0x2b')][_0x1ded('0x1a')]+'%'};return _0x46e8f6;}})});}_0xec71a4=_[_0x1ded('0x35')]({},_0xec71a4,_0x5d9727[_0x1ded('0x37')]);var _0x5272e1={'where':_0xec71a4[_0x1ded('0x34')]};return db[_0x1ded('0x26')][_0x1ded('0x12')](_0x5272e1)[_0x1ded('0x22')](function(_0x411849){_0x173c68[_0x1ded('0x12')]=_0x411849;if(_0x5d9727[_0x1ded('0x2b')][_0x1ded('0x38')]){_0xec71a4[_0x1ded('0x39')]=[{'all':!![]}];}return db[_0x1ded('0x26')][_0x1ded('0x3a')](_0xec71a4);})[_0x1ded('0x22')](function(_0x29b057){_0x173c68['rows']=_0x29b057;return _0x173c68;})[_0x1ded('0x22')](respondWithFilteredResult(_0xf0a31c,_0xec71a4))[_0x1ded('0x3b')](handleError(_0xf0a31c,null));};exports[_0x1ded('0x3c')]=function(_0x1aff41,_0x76a535){var _0xdbaba0={'raw':![],'where':{'id':_0x1aff41['params']['id']}},_0x610dc6={};_0x610dc6[_0x1ded('0x2a')]=_['keys'](db[_0x1ded('0x26')][_0x1ded('0x27')]);_0x610dc6[_0x1ded('0x2b')]=_['keys'](_0x1aff41[_0x1ded('0x2b')]);_0x610dc6['filters']=_[_0x1ded('0x2c')](_0x610dc6['model'],_0x610dc6[_0x1ded('0x2b')]);_0xdbaba0['attributes']=_['intersection'](_0x610dc6['model'],qs[_0x1ded('0x2d')](_0x1aff41[_0x1ded('0x2b')][_0x1ded('0x2d')]));_0xdbaba0[_0x1ded('0x2e')]=_0xdbaba0[_0x1ded('0x2e')][_0x1ded('0x3d')]?_0xdbaba0[_0x1ded('0x2e')]:_0x610dc6[_0x1ded('0x2a')];if(_0x1aff41[_0x1ded('0x2b')][_0x1ded('0x38')]){_0xdbaba0[_0x1ded('0x39')]=[{'all':!![]}];}_0xdbaba0=_[_0x1ded('0x35')]({},_0xdbaba0,_0x1aff41[_0x1ded('0x37')]);return db[_0x1ded('0x26')][_0x1ded('0x20')](_0xdbaba0)[_0x1ded('0x22')](handleEntityNotFound(_0x76a535,null))['then'](respondWithResult(_0x76a535,null))[_0x1ded('0x3b')](handleError(_0x76a535,null));};exports['destroy']=function(_0x16ad20,_0x5b8c7a){return db[_0x1ded('0x26')][_0x1ded('0x20')]({'where':{'id':_0x16ad20['params']['id']}})[_0x1ded('0x22')](handleEntityNotFound(_0x5b8c7a,null))[_0x1ded('0x22')](removeEntity(_0x5b8c7a,null))[_0x1ded('0x3b')](handleError(_0x5b8c7a,null));};exports[_0x1ded('0x3e')]=function(_0x3e9b91,_0x24631c){if(_0x3e9b91[_0x1ded('0x3f')][_0x1ded('0x1f')]===_0x1ded('0x40')&&!_[_0x1ded('0x41')](_0x3e9b91[_0x1ded('0x3f')][_0x1ded('0x42')],'_')){_0x3e9b91[_0x1ded('0x3f')][_0x1ded('0x42')]='_'['concat'](_0x3e9b91[_0x1ded('0x3f')]['exten']);}return db[_0x1ded('0x26')][_0x1ded('0x3e')](_0x3e9b91['body'],{'raw':![]})[_0x1ded('0x22')](function(_0x5ad2fc){var _0x41b5c0=_0x3e9b91[_0x1ded('0x43')]['get']({'plain':!![]});if(!_0x41b5c0)throw new Error(_0x1ded('0x44'));if(_0x41b5c0[_0x1ded('0x45')]===_0x1ded('0x43')){var _0x12ea8d=_0x5ad2fc['get']({'plain':!![]});var _0x151463=[{'name':_0x1ded('0x16'),'value':_0x1ded('0x46')},{'name':_0x1ded('0x17'),'value':_0x1ded('0x40')},{'name':_0x1ded('0x18'),'value':_0x1ded('0x19')}];var _0x31deaf=_[_0x1ded('0x20')](_0x151463,[_0x1ded('0x1d'),_0x12ea8d['type']])[_0x1ded('0x21')];return db[_0x1ded('0x47')][_0x1ded('0x20')]({'where':{'name':_0x31deaf,'userProfileId':_0x41b5c0[_0x1ded('0x48')]},'raw':!![]})[_0x1ded('0x22')](function(_0x3f82d5){if(_0x3f82d5&&_0x3f82d5[_0x1ded('0x49')]===0x0){return db[_0x1ded('0x4a')]['create']({'name':_0x12ea8d[_0x1ded('0x21')],'resourceId':_0x12ea8d['id'],'type':_0x3f82d5[_0x1ded('0x21')],'sectionId':_0x3f82d5['id']},{})['then'](function(){return _0x5ad2fc;});}else{return _0x5ad2fc;}})['catch'](function(_0x2fb89b){logger[_0x1ded('0x4b')](_0x1ded('0x4c'),_0x2fb89b);throw _0x2fb89b;});}return _0x5ad2fc;})[_0x1ded('0x22')](respondWithResult(_0x24631c,0xc9))[_0x1ded('0x3b')](handleError(_0x24631c,null));};exports['update']=function(_0x19a792,_0x21689a){if(_0x19a792['body']['id']){delete _0x19a792[_0x1ded('0x3f')]['id'];}return db[_0x1ded('0x26')][_0x1ded('0x20')]({'where':{'id':_0x19a792[_0x1ded('0x4d')]['id']}})['then'](handleEntityNotFound(_0x21689a,null))['then'](function(_0x5b6ea2){if(_0x5b6ea2){return db[_0x1ded('0x26')][_0x1ded('0x4e')](_['pick'](_0x19a792[_0x1ded('0x3f')],[_0x1ded('0x42'),_0x1ded('0x4f'),'description',_0x1ded('0x50'),'cutdigits','mandatoryDisposition',_0x1ded('0x51')]),{'where':{'context':_0x5b6ea2['context'],'exten':_0x5b6ea2['exten']},'individualHooks':!![]})['then'](function(_0x2f89c5){return _0x2f89c5;});}return null;})[_0x1ded('0x22')](respondWithStatusCode(_0x21689a,null))[_0x1ded('0x3b')](handleError(_0x21689a,null));};exports[_0x1ded('0x52')]=function(_0x5a7a81,_0x51b17d){var _0x2da1bc=_0x5a7a81[_0x1ded('0x4d')]['id'];var _0x4385b6=_0x5a7a81['body'];var _0x44b4a9=0xc8;var _0x583198=null;return db[_0x1ded('0x53')]['transaction']({'isolationLevel':db['sequelize'][_0x1ded('0x54')][_0x1ded('0x55')]['READ_COMMITTED']},function(_0x3a0d8a){return db['VoiceExtension'][_0x1ded('0x56')]({'where':{'id':_0x2da1bc},'transaction':_0x3a0d8a})['then'](function(_0x5a0f69){if(_0x5a0f69){return db[_0x1ded('0x26')][_0x1ded('0x14')]({'where':{'VoiceExtensionId':_0x2da1bc},'transaction':_0x3a0d8a})[_0x1ded('0x22')](function(){var _0x538af0=_[_0x1ded('0x1c')](_0x4385b6,function(_0x594232){_0x594232[_0x1ded('0x57')]=_0x2da1bc;_0x594232['isApp']=!![];return _0x594232;});return _0x5a0f69['createRouting'](_0x538af0);})[_0x1ded('0x22')](function(_0x3f3389){return db['VoiceExtension'][_0x1ded('0x58')](_0x3f3389,{'transaction':_0x3a0d8a});});}else{_0x44b4a9=0x194;_0x583198=[];}});})[_0x1ded('0x22')](function(){if(_0x44b4a9!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2da1bc},'order':_0x1ded('0x59')})[_0x1ded('0x22')](function(_0x45fe55){_0x583198=_0x45fe55;});}})[_0x1ded('0x3b')](function(_0x227da7){_0x44b4a9=0x1f4;logger[_0x1ded('0x4b')](_0x227da7[_0x1ded('0x23')]);if(_0x227da7[_0x1ded('0x21')]){delete _0x227da7[_0x1ded('0x21')];}_0x583198=_0x227da7;})[_0x1ded('0x5a')](function(){if(_0x583198===null){_0x51b17d['sendStatus'](_0x44b4a9);}else{if(_0x44b4a9===0x1f4){_0x51b17d[_0x1ded('0xd')](_0x44b4a9)[_0x1ded('0x24')](_0x583198);}else{_0x51b17d['status'](_0x44b4a9)['json'](_0x583198);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 578836c..1638cda 100644 --- a/server/api/voiceExtension/voiceExtension.events.js +++ b/server/api/voiceExtension/voiceExtension.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa15=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x31d6d7,_0x32bdad){var _0x537169=function(_0x42aac5){while(--_0x42aac5){_0x31d6d7['push'](_0x31d6d7['shift']());}};_0x537169(++_0x32bdad);}(_0xfa15,0xf1));var _0x5fa1=function(_0x384599,_0x54e769){_0x384599=_0x384599-0x0;var _0x3becd6=_0xfa15[_0x384599];return _0x3becd6;};'use strict';var EventEmitter=require(_0x5fa1('0x0'));var VoiceExtension=require(_0x5fa1('0x1'))['db'][_0x5fa1('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5fa1('0x3')](0x0);var events={'afterCreate':_0x5fa1('0x4'),'afterUpdate':_0x5fa1('0x5'),'afterDestroy':_0x5fa1('0x6')};function emitEvent(_0x261eaa){return function(_0x3aadd0,_0xc83d2a,_0x226adb){VoiceExtensionEvents[_0x5fa1('0x7')](_0x261eaa+':'+_0x3aadd0['id'],_0x3aadd0);VoiceExtensionEvents[_0x5fa1('0x7')](_0x261eaa,_0x3aadd0);_0x226adb(null);};}for(var e in events){if(events[_0x5fa1('0x8')](e)){var event=events[e];VoiceExtension[_0x5fa1('0x9')](e,emitEvent(event));}}module[_0x5fa1('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0x1943=['emit','hasOwnProperty','hook','exports','events','save'];(function(_0x3dae99,_0x42a982){var _0x235bf0=function(_0x5ca1a3){while(--_0x5ca1a3){_0x3dae99['push'](_0x3dae99['shift']());}};_0x235bf0(++_0x42a982);}(_0x1943,0xe2));var _0x3194=function(_0x5e4740,_0x2e4ed7){_0x5e4740=_0x5e4740-0x0;var _0x314894=_0x1943[_0x5e4740];return _0x314894;};'use strict';var EventEmitter=require(_0x3194('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3194('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ec6a2){return function(_0x13fc85,_0x1f8377,_0x1e4f29){VoiceExtensionEvents[_0x3194('0x2')](_0x5ec6a2+':'+_0x13fc85['id'],_0x13fc85);VoiceExtensionEvents[_0x3194('0x2')](_0x5ec6a2,_0x13fc85);_0x1e4f29(null);};}for(var e in events){if(events[_0x3194('0x3')](e)){var event=events[e];VoiceExtension[_0x3194('0x4')](e,emitEvent(event));}}module[_0x3194('0x5')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index ff6137c..3e36e41 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16a7=['VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','name','phone','prefix','SIP','join','param','U(xcally-mixmonitor-context)','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','hasOwnProperty','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','appdata','last','priority','concat','catch'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x16a7,0xa5));var _0x716a=function(_0x4aa888,_0x27a956){_0x4aa888=_0x4aa888-0x0;var _0x1c8024=_0x16a7[_0x4aa888];return _0x1c8024;};'use strict';var _=require(_0x716a('0x0'));var attributes=require(_0x716a('0x1'));module[_0x716a('0x2')]=function(_0x2018f2){var _0x4aa23e=_0x2018f2['models'];function _0x437ff8(_0x30d924){var _0x56d122=0x2;var _0x128002=[{'type':_0x30d924[_0x716a('0x3')],'app':_0x716a('0x4'),'appdata':_0x716a('0x5')+_0x30d924[_0x716a('0x3')],'context':_0x30d924['context'],'exten':_0x30d924[_0x716a('0x6')],'priority':_0x56d122++,'VoiceExtensionId':_0x30d924['id']},{'type':_0x30d924[_0x716a('0x3')],'app':_0x30d924[_0x716a('0x7')]?_0x716a('0x4'):'NoOp','appdata':_0x30d924[_0x716a('0x7')]?_0x716a('0x8')+_0x30d924[_0x716a('0x7')]:_0x716a('0x9'),'context':_0x30d924[_0x716a('0xa')],'exten':_0x30d924[_0x716a('0x6')],'priority':_0x56d122++,'VoiceExtensionId':_0x30d924['id']}];if(_0x30d924['type']===_0x716a('0xb')){_0x128002[_0x716a('0xc')]({'type':_0x716a('0xb'),'app':_0x716a('0x4'),'appdata':_0x716a('0xd')+_0x30d924['id'],'context':_0x30d924[_0x716a('0xa')],'exten':_0x30d924[_0x716a('0x6')],'priority':_0x56d122++,'VoiceExtensionId':_0x30d924['id']});}_0x128002['push']({'type':_0x30d924[_0x716a('0x3')],'app':_0x716a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x30d924[_0x716a('0xa')],'exten':_0x30d924['exten'],'priority':_0x56d122++,'VoiceExtensionId':_0x30d924['id']},{'type':_0x30d924[_0x716a('0x3')],'app':_0x716a('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x30d924[_0x716a('0xa')],'exten':_0x30d924[_0x716a('0x6')],'priority':_0x56d122++,'VoiceExtensionId':_0x30d924['id']},{'type':_0x30d924[_0x716a('0x3')],'app':_0x716a('0x4'),'appdata':_0x716a('0xe'),'context':_0x30d924[_0x716a('0xa')],'exten':_0x30d924[_0x716a('0x6')],'priority':_0x56d122++,'VoiceExtensionId':_0x30d924['id']});return _0x128002;}function _0x5c5ee0(_0x3bdf4d){var _0x2ad622=0x2;var _0x5eb129=[{'type':_0x716a('0xf'),'app':'Set','appdata':_0x716a('0x10'),'context':_0x3bdf4d['context'],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':_0x3bdf4d['alias']?_0x716a('0x4'):'NoOp','appdata':_0x3bdf4d[_0x716a('0x7')]?_0x716a('0x8')+_0x3bdf4d[_0x716a('0x7')]:_0x716a('0x9'),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':_0x716a('0x4'),'appdata':_0x716a('0x11')+(_0x3bdf4d[_0x716a('0x12')]?_0x716a('0x13')+_0x3bdf4d[_0x716a('0x12')]+'}':_0x716a('0x14')),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':_0x716a('0x4'),'appdata':_0x716a('0xd')+_0x3bdf4d['id'],'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':_0x716a('0x15'),'appdata':_0x716a('0x16')+(_0x2ad622+0x2)+_0x716a('0x17')+(_0x2ad622+0x1)+')','context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d['exten'],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':_0x716a('0x4'),'appdata':_0x3bdf4d[_0x716a('0x12')]?_0x716a('0x18')+_0x3bdf4d[_0x716a('0x12')]+'}':_0x716a('0x19'),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d['exten'],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':_0x716a('0x4'),'appdata':_0x716a('0x1a'),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':'outbound','app':_0x716a('0x4'),'appdata':_0x716a('0x1b'),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':_0x716a('0x4'),'appdata':_0x716a('0xe'),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':_0x716a('0xf'),'app':'Set','appdata':_0x716a('0x1c')+_0x3bdf4d['id'],'context':_0x3bdf4d['context'],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']}];if(_0x3bdf4d['hasOwnProperty'](_0x716a('0x1d'))&&_0x3bdf4d[_0x716a('0x1d')]!==_0x716a('0x1e')){_0x5eb129['push']({'type':'outbound','app':_0x716a('0x4'),'appdata':_0x716a('0x1f'),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']},{'type':'outbound','app':_0x716a('0x4'),'appdata':_0x716a('0x20')+_0x3bdf4d[_0x716a('0x1d')]||_0x716a('0x21'),'context':_0x3bdf4d[_0x716a('0xa')],'exten':_0x3bdf4d[_0x716a('0x6')],'priority':_0x2ad622++,'VoiceExtensionId':_0x3bdf4d['id']});}return _0x5eb129;}function _0x3a0eae(_0x12d6e2,_0x2a6d41){var _0x28e72a=[{'name':_0x716a('0x22'),'param':0x0},{'name':_0x716a('0x23'),'param':0x1},{'name':_0x716a('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x1eb641={};var _0x378923=_0x2a6d41[_0x716a('0x25')](',');var _0xc56d4b=[];for(var _0x19be55=0x0;_0x19be55<_0x28e72a['length'];_0x19be55++){switch(_0x28e72a[_0x19be55][_0x716a('0x26')]){case _0x716a('0x22'):_0x1eb641['trunk']=_0x378923[_0x28e72a[_0x19be55]['param']][_0x716a('0x25')]('/')[0x1];_0x1eb641[_0x716a('0x27')]=_0x378923[_0x28e72a[_0x19be55]['param']][_0x716a('0x25')]('/')[0x2];_0x1eb641['prefix']=_0x1eb641[_0x716a('0x27')]?_0x1eb641['phone'][_0x716a('0x25')]('$')[0x0]:undefined;_0x1eb641['phone']=_0x12d6e2[_0x716a('0x12')]?(_0x1eb641['prefix']||'')+_0x716a('0x13')+_0x12d6e2[_0x716a('0x12')]+'}':(_0x1eb641[_0x716a('0x28')]||'')+_0x716a('0x14');_0xc56d4b[_0x28e72a[_0x19be55]['param']]=[_0x716a('0x29'),_0x1eb641[_0x716a('0x22')],_0x1eb641['phone']][_0x716a('0x2a')]('/');break;case'options':_0x1eb641[_0x716a('0x24')]=_0x378923[_0x28e72a[_0x19be55][_0x716a('0x2b')]];if(_0x12d6e2['recordingFormat']!==_0x716a('0x1e')){if(_0x1eb641[_0x716a('0x24')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x1eb641[_0x716a('0x24')]+=_0x716a('0x2c');}}else{_0x1eb641[_0x716a('0x24')]=_0x1eb641[_0x716a('0x24')]['replace'](_0x716a('0x2c'),'');}_0xc56d4b[_0x28e72a[_0x19be55][_0x716a('0x2b')]]=_0x1eb641[_0x716a('0x24')];break;default:_0xc56d4b[_0x28e72a[_0x19be55]['param']]=_0x378923[_0x28e72a[_0x19be55][_0x716a('0x2b')]];}}return _0xc56d4b['join'](',');}function _0x1939a2(_0x518c11,_0x92b5f4,_0x45dd65){return new Promise(function(_0x28eddb,_0x592aca){var _0x2d5f96=[];if(_['isEmpty'](_0x92b5f4))return _0x28eddb(_0x2d5f96);_0x4aa23e['Interval'][_0x716a('0x2d')]({'attributes':['id',_0x716a('0x2e'),_0x716a('0x2f')],'raw':!![]})[_0x716a('0x30')](function(_0x5b5253){for(var _0x396c2f=0x0,_0x552c2e=0x0;_0x396c2f<_0x92b5f4[_0x716a('0x31')];_0x396c2f++,_0x552c2e=0x0){var _0x5cfae2=_0x92b5f4[_0x396c2f];var _0x18f956=[];var _0x28fc46=[];delete _0x5cfae2['id'];if(_0x5cfae2[_0x716a('0x2e')]!==_0x716a('0x32')){_0x5cfae2['intervals']=[_0x5cfae2[_0x716a('0x2e')]];}else{_0x5cfae2[_0x716a('0x33')]=_0x5cfae2[_0x716a('0x2f')]?_[_0x716a('0x34')](_[_0x716a('0x35')](_0x5b5253,{'IntervalId':_0x5cfae2[_0x716a('0x2f')]}),_0x716a('0x2e')):[];}_0x5cfae2['context']=_0x518c11[_0x716a('0xa')];_0x5cfae2[_0x716a('0x6')]=_0x518c11['exten'];if(_0x5cfae2['type'])_0x5cfae2[_0x716a('0x3')]=_0x5cfae2[_0x716a('0x3')]['toLowerCase']();if(_0x518c11[_0x716a('0x3')]==='outbound'){if(_0x5cfae2[_0x716a('0x36')]('tag')&&_0x5cfae2[_0x716a('0x37')]&&_0x5cfae2['tag']!=='--'){_0x18f956['push']({'type':_0x5cfae2[_0x716a('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x716a('0x38')+_0x5cfae2[_0x716a('0x37')],'context':_0x518c11[_0x716a('0xa')],'exten':_0x518c11[_0x716a('0x6')],'priority':_0x5cfae2[_0x716a('0x33')][_0x716a('0x31')]+_0x45dd65+_0x552c2e++,'VoiceExtensionId':_0x518c11['id']});}_0x18f956['push']({'type':_0x5cfae2[_0x716a('0x3')][_0x716a('0x39')](),'app':_0x716a('0x15'),'appdata':_0x716a('0x3a')+(_0x5cfae2[_0x716a('0x3b')]?_0x716a('0x3c')+_0x5cfae2['callerID']+')':_0x716a('0x3d')),'context':_0x518c11[_0x716a('0xa')],'exten':_0x518c11[_0x716a('0x6')],'priority':_0x5cfae2['intervals'][_0x716a('0x31')]+_0x45dd65+_0x552c2e++,'VoiceExtensionId':_0x518c11['id']});}else{if(_0x5cfae2[_0x716a('0x36')](_0x716a('0x3e'))){if([_0x716a('0x3f'),_0x716a('0x40')][_0x716a('0x41')](_0x5cfae2[_0x716a('0x42')][_0x716a('0x39')]())&&_0x5cfae2['appType']!==_0x716a('0x43')){if(_0x5cfae2['answer']){_0x18f956[_0x716a('0xc')]({'type':_0x5cfae2[_0x716a('0x3')][_0x716a('0x39')](),'app':_0x716a('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x518c11[_0x716a('0xa')],'exten':_0x518c11[_0x716a('0x6')],'priority':_0x5cfae2[_0x716a('0x33')][_0x716a('0x31')]+_0x45dd65+_0x552c2e++,'VoiceExtensionId':_0x518c11['id']});_0x18f956[_0x716a('0xc')]({'type':_0x5cfae2[_0x716a('0x3')]['toLowerCase'](),'app':_0x716a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x518c11['context'],'exten':_0x518c11['exten'],'priority':_0x5cfae2[_0x716a('0x33')][_0x716a('0x31')]+_0x45dd65+_0x552c2e++,'VoiceExtensionId':_0x518c11['id']});}else{_0x18f956[_0x716a('0xc')]({'type':_0x5cfae2[_0x716a('0x3')][_0x716a('0x39')](),'app':'ExecIf','appdata':_0x716a('0x44'),'context':_0x518c11['context'],'exten':_0x518c11[_0x716a('0x6')],'priority':_0x5cfae2[_0x716a('0x33')][_0x716a('0x31')]+_0x45dd65+_0x552c2e++,'VoiceExtensionId':_0x518c11['id']});_0x18f956['push']({'type':_0x5cfae2[_0x716a('0x3')][_0x716a('0x39')](),'app':_0x716a('0x4'),'appdata':_0x716a('0x45'),'context':_0x518c11[_0x716a('0xa')],'exten':_0x518c11[_0x716a('0x6')],'priority':_0x5cfae2[_0x716a('0x33')][_0x716a('0x31')]+_0x45dd65+_0x552c2e++,'VoiceExtensionId':_0x518c11['id']});}}}}for(var _0x4cafd4=0x0;_0x4cafd4<_0x5cfae2[_0x716a('0x33')][_0x716a('0x31')];_0x4cafd4++){var _0x37ec68=_0x45dd65+_0x5cfae2[_0x716a('0x33')][_0x716a('0x31')];var _0x43007c=_0x4cafd4===_0x5cfae2['intervals']['length']-0x1?_0x45dd65+_0x18f956[_0x716a('0x31')]+_0x28fc46[_0x716a('0x31')]+0x2:_0x45dd65+_0x4cafd4+0x1;_0x18f956['splice'](_0x4cafd4,0x0,{'type':_0x518c11[_0x716a('0x3')],'app':_0x716a('0x46'),'appdata':_0x5cfae2[_0x716a('0x33')][_0x4cafd4]+'?'+_0x518c11[_0x716a('0xa')]+_0x716a('0x47')+_0x37ec68+':'+_0x518c11['context']+_0x716a('0x47')+_0x43007c,'exten':_0x518c11[_0x716a('0x6')],'context':_0x518c11[_0x716a('0xa')],'priority':_0x45dd65+_0x4cafd4,'VoiceExtensionId':_0x518c11['id']});}if(_0x5cfae2[_0x716a('0x48')]==='outboundDial')_0x5cfae2[_0x716a('0x49')]=_0x3a0eae(_0x518c11,_0x5cfae2['appdata']);_0x5cfae2['priority']=_0x18f956[_0x716a('0x31')]?_[_0x716a('0x4a')](_0x18f956)[_0x716a('0x4b')]+0x1:_0x45dd65;_0x2d5f96=_[_0x716a('0x4c')](_0x2d5f96,_0x18f956,[_0x5cfae2],_0x28fc46);_0x45dd65=_[_0x716a('0x4a')](_0x2d5f96)[_0x716a('0x4b')]+0x1;}return _0x28eddb(_0x2d5f96);})[_0x716a('0x4d')](function(_0x181df8){_0x592aca(_0x181df8);});});}return _0x2018f2['define'](_0x716a('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x45ad8b){var _0x24fb67=this[_0x716a('0x4f')]({'plain':!![]});var _0x8f35a1=_0x24fb67['type']==='outbound'?_0x5c5ee0(_0x24fb67):_0x437ff8(_0x24fb67);return _0x1939a2(_0x24fb67,_0x45ad8b,_['last'](_0x8f35a1)[_0x716a('0x4b')]+0x1)[_0x716a('0x30')](function(_0x11caef){var _0x2b47da=_[_0x716a('0x4c')](_0x8f35a1,_0x11caef);_0x2b47da[_0x716a('0xc')]({'type':_0x24fb67[_0x716a('0x3')],'app':_0x716a('0x50'),'exten':_0x24fb67['exten'],'context':_0x24fb67[_0x716a('0xa')],'priority':_[_0x716a('0x4a')](_0x2b47da)[_0x716a('0x4b')]+0x1,'VoiceExtensionId':_0x24fb67['id']});return _0x2b47da;});}}});}; \ No newline at end of file +var _0x1f22=['CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','context','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','split','length','name','param','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','push','CDR(tag)=','Set(CALLERID(all)=','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','NoOp'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0x1f22,0x136));var _0x21f2=function(_0x4bc494,_0x5edcab){_0x4bc494=_0x4bc494-0x0;var _0x14fa09=_0x1f22[_0x4bc494];return _0x14fa09;};'use strict';var _=require(_0x21f2('0x0'));var attributes=require(_0x21f2('0x1'));module[_0x21f2('0x2')]=function(_0x40f587){var _0x1ba983=_0x40f587[_0x21f2('0x3')];function _0x1b58c6(_0x3e5e41){var _0x209dbf=0x2;var _0x582443=[{'type':_0x3e5e41[_0x21f2('0x4')],'app':_0x21f2('0x5'),'appdata':_0x21f2('0x6')+_0x3e5e41[_0x21f2('0x4')],'context':_0x3e5e41['context'],'exten':_0x3e5e41[_0x21f2('0x7')],'priority':_0x209dbf++,'VoiceExtensionId':_0x3e5e41['id']},{'type':_0x3e5e41['type'],'app':_0x3e5e41[_0x21f2('0x8')]?_0x21f2('0x5'):_0x21f2('0x9'),'appdata':_0x3e5e41[_0x21f2('0x8')]?_0x21f2('0xa')+_0x3e5e41[_0x21f2('0x8')]:_0x21f2('0xb'),'context':_0x3e5e41['context'],'exten':_0x3e5e41[_0x21f2('0x7')],'priority':_0x209dbf++,'VoiceExtensionId':_0x3e5e41['id']}];if(_0x3e5e41['type']===_0x21f2('0xc')){_0x582443['push']({'type':_0x21f2('0xc'),'app':'Set','appdata':_0x21f2('0xd')+_0x3e5e41['id'],'context':_0x3e5e41['context'],'exten':_0x3e5e41[_0x21f2('0x7')],'priority':_0x209dbf++,'VoiceExtensionId':_0x3e5e41['id']});}_0x582443['push']({'type':_0x3e5e41['type'],'app':_0x21f2('0x5'),'appdata':_0x21f2('0xe'),'context':_0x3e5e41['context'],'exten':_0x3e5e41['exten'],'priority':_0x209dbf++,'VoiceExtensionId':_0x3e5e41['id']},{'type':_0x3e5e41[_0x21f2('0x4')],'app':_0x21f2('0x5'),'appdata':_0x21f2('0xf'),'context':_0x3e5e41[_0x21f2('0x10')],'exten':_0x3e5e41[_0x21f2('0x7')],'priority':_0x209dbf++,'VoiceExtensionId':_0x3e5e41['id']},{'type':_0x3e5e41[_0x21f2('0x4')],'app':_0x21f2('0x5'),'appdata':_0x21f2('0x11'),'context':_0x3e5e41[_0x21f2('0x10')],'exten':_0x3e5e41[_0x21f2('0x7')],'priority':_0x209dbf++,'VoiceExtensionId':_0x3e5e41['id']});return _0x582443;}function _0x300918(_0x1f20e9){var _0x2d303f=0x2;var _0x40b07b=[{'type':'outbound','app':_0x21f2('0x5'),'appdata':_0x21f2('0x12'),'context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':_0x1f20e9[_0x21f2('0x8')]?_0x21f2('0x5'):_0x21f2('0x9'),'appdata':_0x1f20e9[_0x21f2('0x8')]?_0x21f2('0xa')+_0x1f20e9[_0x21f2('0x8')]:'No\x20alias\x20set','context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':'outbound','app':_0x21f2('0x5'),'appdata':_0x21f2('0x14')+(_0x1f20e9['cutdigits']?_0x21f2('0x15')+_0x1f20e9[_0x21f2('0x16')]+'}':_0x21f2('0x17')),'context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':_0x21f2('0x5'),'appdata':'CDR(routeid)='+_0x1f20e9['id'],'context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':_0x21f2('0x18'),'appdata':_0x21f2('0x19')+(_0x2d303f+0x2)+'):Goto('+(_0x2d303f+0x1)+')','context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':'Set','appdata':_0x1f20e9[_0x21f2('0x16')]?_0x21f2('0x1a')+_0x1f20e9[_0x21f2('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':_0x21f2('0x5'),'appdata':_0x21f2('0xe'),'context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9['exten'],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':'outbound','app':_0x21f2('0x5'),'appdata':_0x21f2('0xf'),'context':_0x1f20e9['context'],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':'Set','appdata':_0x21f2('0x11'),'context':_0x1f20e9[_0x21f2('0x10')],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':_0x21f2('0x5'),'appdata':'outboundrouteid='+_0x1f20e9['id'],'context':_0x1f20e9['context'],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']}];if(_0x1f20e9[_0x21f2('0x1b')]('recordingFormat')&&_0x1f20e9[_0x21f2('0x1c')]!==_0x21f2('0x1d')){_0x40b07b['push']({'type':'outbound','app':_0x21f2('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1f20e9['context'],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']},{'type':_0x21f2('0x13'),'app':_0x21f2('0x5'),'appdata':_0x21f2('0x1e')+_0x1f20e9[_0x21f2('0x1c')]||_0x21f2('0x1f'),'context':_0x1f20e9['context'],'exten':_0x1f20e9[_0x21f2('0x7')],'priority':_0x2d303f++,'VoiceExtensionId':_0x1f20e9['id']});}return _0x40b07b;}function _0x25796e(_0x3e00a6,_0x3b535f){var _0x342295=[{'name':_0x21f2('0x20'),'param':0x0},{'name':_0x21f2('0x21'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x1e5894={};var _0x4fc1ec=_0x3b535f[_0x21f2('0x22')](',');var _0x160724=[];for(var _0xb572ae=0x0;_0xb572ae<_0x342295[_0x21f2('0x23')];_0xb572ae++){switch(_0x342295[_0xb572ae][_0x21f2('0x24')]){case _0x21f2('0x20'):_0x1e5894[_0x21f2('0x20')]=_0x4fc1ec[_0x342295[_0xb572ae][_0x21f2('0x25')]][_0x21f2('0x22')]('/')[0x1];_0x1e5894['phone']=_0x4fc1ec[_0x342295[_0xb572ae][_0x21f2('0x25')]][_0x21f2('0x22')]('/')[0x2];_0x1e5894['prefix']=_0x1e5894['phone']?_0x1e5894[_0x21f2('0x26')]['split']('$')[0x0]:undefined;_0x1e5894[_0x21f2('0x26')]=_0x3e00a6['cutdigits']?(_0x1e5894[_0x21f2('0x27')]||'')+_0x21f2('0x15')+_0x3e00a6[_0x21f2('0x16')]+'}':(_0x1e5894[_0x21f2('0x27')]||'')+_0x21f2('0x17');_0x160724[_0x342295[_0xb572ae][_0x21f2('0x25')]]=[_0x21f2('0x28'),_0x1e5894['trunk'],_0x1e5894[_0x21f2('0x26')]][_0x21f2('0x29')]('/');break;case'options':_0x1e5894[_0x21f2('0x2a')]=_0x4fc1ec[_0x342295[_0xb572ae][_0x21f2('0x25')]];if(_0x3e00a6[_0x21f2('0x1c')]!=='none'){if(_0x1e5894['options'][_0x21f2('0x2b')](_0x21f2('0x2c'))<0x0){_0x1e5894['options']+='U(xcally-mixmonitor-context)';}}else{_0x1e5894[_0x21f2('0x2a')]=_0x1e5894[_0x21f2('0x2a')][_0x21f2('0x2d')]('U(xcally-mixmonitor-context)','');}_0x160724[_0x342295[_0xb572ae]['param']]=_0x1e5894[_0x21f2('0x2a')];break;default:_0x160724[_0x342295[_0xb572ae][_0x21f2('0x25')]]=_0x4fc1ec[_0x342295[_0xb572ae][_0x21f2('0x25')]];}}return _0x160724[_0x21f2('0x29')](',');}function _0x45d62a(_0x495876,_0x32e512,_0x34e611){return new Promise(function(_0x47f0ed,_0x59a1aa){var _0x29b68f=[];if(_[_0x21f2('0x2e')](_0x32e512))return _0x47f0ed(_0x29b68f);_0x1ba983['Interval'][_0x21f2('0x2f')]({'attributes':['id','interval',_0x21f2('0x30')],'raw':!![]})[_0x21f2('0x31')](function(_0xed7f34){for(var _0x121523=0x0,_0x5104c6=0x0;_0x121523<_0x32e512['length'];_0x121523++,_0x5104c6=0x0){var _0xc3951c=_0x32e512[_0x121523];var _0x5d608c=[];var _0x3ea024=[];delete _0xc3951c['id'];if(_0xc3951c[_0x21f2('0x32')]!==_0x21f2('0x33')){_0xc3951c['intervals']=[_0xc3951c[_0x21f2('0x32')]];}else{_0xc3951c[_0x21f2('0x34')]=_0xc3951c[_0x21f2('0x30')]?_[_0x21f2('0x35')](_[_0x21f2('0x36')](_0xed7f34,{'IntervalId':_0xc3951c['IntervalId']}),'interval'):[];}_0xc3951c[_0x21f2('0x10')]=_0x495876[_0x21f2('0x10')];_0xc3951c[_0x21f2('0x7')]=_0x495876[_0x21f2('0x7')];if(_0xc3951c[_0x21f2('0x4')])_0xc3951c[_0x21f2('0x4')]=_0xc3951c[_0x21f2('0x4')][_0x21f2('0x37')]();if(_0x495876['type']===_0x21f2('0x13')){if(_0xc3951c[_0x21f2('0x1b')](_0x21f2('0x38'))&&_0xc3951c['tag']&&_0xc3951c[_0x21f2('0x38')]!=='--'){_0x5d608c[_0x21f2('0x39')]({'type':_0xc3951c[_0x21f2('0x4')][_0x21f2('0x37')](),'app':'Set','appdata':_0x21f2('0x3a')+_0xc3951c[_0x21f2('0x38')],'context':_0x495876[_0x21f2('0x10')],'exten':_0x495876['exten'],'priority':_0xc3951c[_0x21f2('0x34')][_0x21f2('0x23')]+_0x34e611+_0x5104c6++,'VoiceExtensionId':_0x495876['id']});}_0x5d608c[_0x21f2('0x39')]({'type':_0xc3951c[_0x21f2('0x4')][_0x21f2('0x37')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xc3951c['callerID']?_0x21f2('0x3b')+_0xc3951c['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x495876[_0x21f2('0x10')],'exten':_0x495876[_0x21f2('0x7')],'priority':_0xc3951c[_0x21f2('0x34')][_0x21f2('0x23')]+_0x34e611+_0x5104c6++,'VoiceExtensionId':_0x495876['id']});}else{if(_0xc3951c[_0x21f2('0x1b')](_0x21f2('0x3c'))){if([_0x21f2('0x3d'),'playback'][_0x21f2('0x3e')](_0xc3951c[_0x21f2('0x3f')][_0x21f2('0x37')]())&&_0xc3951c[_0x21f2('0x40')]!==_0x21f2('0x41')){if(_0xc3951c[_0x21f2('0x3c')]){_0x5d608c['push']({'type':_0xc3951c[_0x21f2('0x4')][_0x21f2('0x37')](),'app':_0x21f2('0x18'),'appdata':_0x21f2('0x42'),'context':_0x495876[_0x21f2('0x10')],'exten':_0x495876[_0x21f2('0x7')],'priority':_0xc3951c['intervals'][_0x21f2('0x23')]+_0x34e611+_0x5104c6++,'VoiceExtensionId':_0x495876['id']});_0x5d608c['push']({'type':_0xc3951c[_0x21f2('0x4')][_0x21f2('0x37')](),'app':'Set','appdata':_0x21f2('0x43'),'context':_0x495876['context'],'exten':_0x495876[_0x21f2('0x7')],'priority':_0xc3951c[_0x21f2('0x34')][_0x21f2('0x23')]+_0x34e611+_0x5104c6++,'VoiceExtensionId':_0x495876['id']});}else{_0x5d608c['push']({'type':_0xc3951c[_0x21f2('0x4')][_0x21f2('0x37')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x495876[_0x21f2('0x10')],'exten':_0x495876[_0x21f2('0x7')],'priority':_0xc3951c[_0x21f2('0x34')][_0x21f2('0x23')]+_0x34e611+_0x5104c6++,'VoiceExtensionId':_0x495876['id']});_0x5d608c[_0x21f2('0x39')]({'type':_0xc3951c[_0x21f2('0x4')][_0x21f2('0x37')](),'app':_0x21f2('0x5'),'appdata':_0x21f2('0x44'),'context':_0x495876[_0x21f2('0x10')],'exten':_0x495876[_0x21f2('0x7')],'priority':_0xc3951c[_0x21f2('0x34')][_0x21f2('0x23')]+_0x34e611+_0x5104c6++,'VoiceExtensionId':_0x495876['id']});}}}}for(var _0x119116=0x0;_0x119116<_0xc3951c['intervals'][_0x21f2('0x23')];_0x119116++){var _0x49aa20=_0x34e611+_0xc3951c[_0x21f2('0x34')][_0x21f2('0x23')];var _0x25b034=_0x119116===_0xc3951c[_0x21f2('0x34')][_0x21f2('0x23')]-0x1?_0x34e611+_0x5d608c['length']+_0x3ea024[_0x21f2('0x23')]+0x2:_0x34e611+_0x119116+0x1;_0x5d608c['splice'](_0x119116,0x0,{'type':_0x495876[_0x21f2('0x4')],'app':_0x21f2('0x45'),'appdata':_0xc3951c[_0x21f2('0x34')][_0x119116]+'?'+_0x495876[_0x21f2('0x10')]+_0x21f2('0x46')+_0x49aa20+':'+_0x495876[_0x21f2('0x10')]+_0x21f2('0x46')+_0x25b034,'exten':_0x495876[_0x21f2('0x7')],'context':_0x495876[_0x21f2('0x10')],'priority':_0x34e611+_0x119116,'VoiceExtensionId':_0x495876['id']});}if(_0xc3951c[_0x21f2('0x40')]===_0x21f2('0x47'))_0xc3951c[_0x21f2('0x48')]=_0x25796e(_0x495876,_0xc3951c['appdata']);_0xc3951c['priority']=_0x5d608c[_0x21f2('0x23')]?_[_0x21f2('0x49')](_0x5d608c)[_0x21f2('0x4a')]+0x1:_0x34e611;_0x29b68f=_[_0x21f2('0x4b')](_0x29b68f,_0x5d608c,[_0xc3951c],_0x3ea024);_0x34e611=_[_0x21f2('0x49')](_0x29b68f)[_0x21f2('0x4a')]+0x1;}return _0x47f0ed(_0x29b68f);})[_0x21f2('0x4c')](function(_0x34bea0){_0x59a1aa(_0x34bea0);});});}return _0x40f587[_0x21f2('0x4d')](_0x21f2('0x4e'),attributes,{'tableName':_0x21f2('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b4921){var _0x2a171d=this['get']({'plain':!![]});var _0x2dcfc2=_0x2a171d[_0x21f2('0x4')]===_0x21f2('0x13')?_0x300918(_0x2a171d):_0x1b58c6(_0x2a171d);return _0x45d62a(_0x2a171d,_0x5b4921,_[_0x21f2('0x49')](_0x2dcfc2)[_0x21f2('0x4a')]+0x1)[_0x21f2('0x31')](function(_0x3e6b33){var _0x117072=_['concat'](_0x2dcfc2,_0x3e6b33);_0x117072['push']({'type':_0x2a171d[_0x21f2('0x4')],'app':'Hangup','exten':_0x2a171d[_0x21f2('0x7')],'context':_0x2a171d[_0x21f2('0x10')],'priority':_['last'](_0x117072)[_0x21f2('0x4a')]+0x1,'VoiceExtensionId':_0x2a171d['id']});return _0x117072;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9c1e2b0..7614370 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d76=['GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','request\x20sent','debug','stringify','error','code','message','info','VoiceExtension,\x20%s,\x20%s','result','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','catch'];(function(_0x16020e,_0x502e11){var _0x268550=function(_0x5c3c2c){while(--_0x5c3c2c){_0x16020e['push'](_0x16020e['shift']());}};_0x268550(++_0x502e11);}(_0x9d76,0x76));var _0x69d7=function(_0x1afc39,_0x33c9f4){_0x1afc39=_0x1afc39-0x0;var _0x4503c0=_0x9d76[_0x1afc39];return _0x4503c0;};'use strict';var _=require(_0x69d7('0x0'));var util=require('util');var moment=require(_0x69d7('0x1'));var BPromise=require(_0x69d7('0x2'));var rs=require(_0x69d7('0x3'));var fs=require('fs');var Redis=require(_0x69d7('0x4'));var db=require(_0x69d7('0x5'))['db'];var utils=require(_0x69d7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x69d7('0x7'));var jayson=require(_0x69d7('0x8'));var client=jayson[_0x69d7('0x9')][_0x69d7('0xa')]({'port':0x232a});config['redis']=_[_0x69d7('0xb')](config[_0x69d7('0xc')],{'host':_0x69d7('0xd'),'port':0x18eb});var socket=require(_0x69d7('0xe'))(new Redis(config[_0x69d7('0xc')]));require(_0x69d7('0xf'))[_0x69d7('0x10')](socket);function respondWithRpcPromise(_0x43b7d2,_0x514e07,_0x3d45b0){return new BPromise(function(_0x3061f3,_0x2617eb){return client[_0x69d7('0x11')](_0x43b7d2,_0x3d45b0)[_0x69d7('0x12')](function(_0x3b6bb9){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x514e07,_0x69d7('0x13'));logger[_0x69d7('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x514e07,_0x69d7('0x13'),JSON[_0x69d7('0x15')](_0x3b6bb9));if(_0x3b6bb9[_0x69d7('0x16')]){if(_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x17')]===0x1f4){logger[_0x69d7('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x514e07,_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);return _0x2617eb(_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x514e07,_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);return _0x3061f3(_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);}else{logger[_0x69d7('0x19')](_0x69d7('0x1a'),_0x514e07,_0x69d7('0x13'));_0x3061f3(_0x3b6bb9[_0x69d7('0x1b')][_0x69d7('0x18')]);}})['catch'](function(_0x208b66){logger[_0x69d7('0x16')](_0x69d7('0x1a'),_0x514e07,_0x208b66);_0x2617eb(_0x208b66);});});}exports['GetVoiceExtension']=function(_0x46d908){var _0x2f8f5a=this;return new Promise(function(_0x5832d6,_0x5ad0e4){return db[_0x69d7('0x1c')][_0x69d7('0x1d')]({'raw':_0x46d908[_0x69d7('0x1e')]?_0x46d908[_0x69d7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x46d908[_0x69d7('0x1e')]?_0x46d908[_0x69d7('0x1e')][_0x69d7('0x1f')]||null:null,'attributes':_0x46d908[_0x69d7('0x1e')]?_0x46d908[_0x69d7('0x1e')][_0x69d7('0x20')]||null:null,'limit':_0x46d908[_0x69d7('0x1e')]?_0x46d908[_0x69d7('0x1e')][_0x69d7('0x21')]||null:null,'include':_0x46d908['options']?_0x46d908[_0x69d7('0x1e')][_0x69d7('0x22')]?_[_0x69d7('0x23')](_0x46d908['options'][_0x69d7('0x22')],function(_0x52435a){return{'model':db[_0x52435a[_0x69d7('0x24')]],'as':_0x52435a['as'],'attributes':_0x52435a[_0x69d7('0x20')],'include':_0x52435a[_0x69d7('0x22')]?_['map'](_0x52435a[_0x69d7('0x22')],function(_0x2b44d9){return{'model':db[_0x2b44d9[_0x69d7('0x24')]],'as':_0x2b44d9['as'],'attributes':_0x2b44d9[_0x69d7('0x20')],'include':_0x2b44d9[_0x69d7('0x22')]?_[_0x69d7('0x23')](_0x2b44d9[_0x69d7('0x22')],function(_0x285922){return{'model':db[_0x285922[_0x69d7('0x24')]],'as':_0x285922['as'],'attributes':_0x285922[_0x69d7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x69d7('0x12')](function(_0x5114f7){logger['info']('GetVoiceExtension',_0x46d908);logger[_0x69d7('0x14')]('GetVoiceExtension',_0x46d908,JSON[_0x69d7('0x15')](_0x5114f7));_0x5832d6(_0x5114f7);})[_0x69d7('0x25')](function(_0x5d9ae0){logger[_0x69d7('0x16')](_0x69d7('0x26'),_0x5d9ae0['message'],_0x46d908);_0x5ad0e4(_0x2f8f5a[_0x69d7('0x16')](0x1f4,_0x5d9ae0[_0x69d7('0x18')]));});});}; \ No newline at end of file +var _0xa6bb=['rpc','../../config/environment','jayson/promise','redis','defaults','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','attributes','map','include','model','then','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xa6bb,0x12c));var _0xba6b=function(_0x3613b9,_0x47f660){_0x3613b9=_0x3613b9-0x0;var _0x8edf6=_0xa6bb[_0x3613b9];return _0x8edf6;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var moment=require(_0xba6b('0x1'));var BPromise=require(_0xba6b('0x2'));var rs=require(_0xba6b('0x3'));var fs=require('fs');var Redis=require(_0xba6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba6b('0x5'))(_0xba6b('0x6'));var config=require(_0xba6b('0x7'));var jayson=require(_0xba6b('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xba6b('0x9')]=_[_0xba6b('0xa')](config[_0xba6b('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba6b('0x9')]));require(_0xba6b('0xb'))[_0xba6b('0xc')](socket);function respondWithRpcPromise(_0x69d48a,_0x432548,_0x534849){return new BPromise(function(_0x17e6c8,_0x297f02){return client[_0xba6b('0xd')](_0x69d48a,_0x534849)['then'](function(_0x16fd15){logger[_0xba6b('0xe')](_0xba6b('0xf'),_0x432548,_0xba6b('0x10'));logger['debug'](_0xba6b('0x11'),_0x432548,'request\x20sent',JSON[_0xba6b('0x12')](_0x16fd15));if(_0x16fd15[_0xba6b('0x13')]){if(_0x16fd15[_0xba6b('0x13')][_0xba6b('0x14')]===0x1f4){logger[_0xba6b('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x432548,_0x16fd15[_0xba6b('0x13')][_0xba6b('0x15')]);return _0x297f02(_0x16fd15['error'][_0xba6b('0x15')]);}logger[_0xba6b('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x432548,_0x16fd15['error'][_0xba6b('0x15')]);return _0x17e6c8(_0x16fd15['error']['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x432548,'request\x20sent');_0x17e6c8(_0x16fd15[_0xba6b('0x16')][_0xba6b('0x15')]);}})[_0xba6b('0x17')](function(_0x67a2f8){logger[_0xba6b('0x13')](_0xba6b('0xf'),_0x432548,_0x67a2f8);_0x297f02(_0x67a2f8);});});}exports[_0xba6b('0x18')]=function(_0x5697f8){var _0xac250e=this;return new Promise(function(_0x4d1375,_0x54a392){return db[_0xba6b('0x19')][_0xba6b('0x1a')]({'raw':_0x5697f8[_0xba6b('0x1b')]?_0x5697f8[_0xba6b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5697f8[_0xba6b('0x1b')]?_0x5697f8[_0xba6b('0x1b')]['where']||null:null,'attributes':_0x5697f8[_0xba6b('0x1b')]?_0x5697f8[_0xba6b('0x1b')][_0xba6b('0x1c')]||null:null,'limit':_0x5697f8[_0xba6b('0x1b')]?_0x5697f8[_0xba6b('0x1b')]['limit']||null:null,'include':_0x5697f8['options']?_0x5697f8['options']['include']?_[_0xba6b('0x1d')](_0x5697f8[_0xba6b('0x1b')][_0xba6b('0x1e')],function(_0x39f052){return{'model':db[_0x39f052[_0xba6b('0x1f')]],'as':_0x39f052['as'],'attributes':_0x39f052[_0xba6b('0x1c')],'include':_0x39f052['include']?_[_0xba6b('0x1d')](_0x39f052[_0xba6b('0x1e')],function(_0x11785e){return{'model':db[_0x11785e['model']],'as':_0x11785e['as'],'attributes':_0x11785e[_0xba6b('0x1c')],'include':_0x11785e[_0xba6b('0x1e')]?_['map'](_0x11785e[_0xba6b('0x1e')],function(_0x25d5e6){return{'model':db[_0x25d5e6[_0xba6b('0x1f')]],'as':_0x25d5e6['as'],'attributes':_0x25d5e6[_0xba6b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xba6b('0x20')](function(_0x506447){logger[_0xba6b('0xe')]('GetVoiceExtension',_0x5697f8);logger[_0xba6b('0x21')]('GetVoiceExtension',_0x5697f8,JSON[_0xba6b('0x12')](_0x506447));_0x4d1375(_0x506447);})['catch'](function(_0x429954){logger['error'](_0xba6b('0x18'),_0x429954[_0xba6b('0x15')],_0x5697f8);_0x54a392(_0xac250e[_0xba6b('0x13')](0x1f4,_0x429954[_0xba6b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 26e92b1..96e3f94 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x58469f,_0x1d8a1f){var _0xaca0e7=function(_0x1ca778){while(--_0x1ca778){_0x58469f['push'](_0x58469f['shift']());}};_0xaca0e7(++_0x1d8a1f);}(_0x2ef3,0xba));var _0x32ef=function(_0x45481a,_0x2d84d1){_0x45481a=_0x45481a-0x0;var _0x3edd63=_0x2ef3[_0x45481a];return _0x3edd63;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x5c8dca,_0x2233d4){var _0x2a5823=function(_0x1a6216){while(--_0x1a6216){_0x5c8dca['push'](_0x5c8dca['shift']());}};_0x2a5823(++_0x2233d4);}(_0x4975,0x86));var _0x5497=function(_0x56c029,_0x207315){_0x56c029=_0x56c029-0x0;var _0x5965ed=_0x4975[_0x56c029];return _0x5965ed;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 47c78a9..0e25b4c 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f9d=['/:id/messages','getMessages','create','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x8f9d,0x93));var _0xd8f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8f9d[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['show']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);router[_0xd8f9('0x12')](_0xd8f9('0xc'),auth['isAuthenticated'](),controller[_0xd8f9('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','show','getMessages','post','isAuthenticated','put','delete','exports'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4e87df,_0x37a6e7){_0x4e87df=_0x4e87df-0x0;var _0x1c7703=_0xd8fb[_0x4e87df];return _0x1c7703;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0xc')]('/',auth[_0xbd8f('0xd')](),controller['create']);router[_0xbd8f('0xe')](_0xbd8f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xbd8f('0xf')](_0xbd8f('0x9'),auth[_0xbd8f('0xd')](),controller['destroy']);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0b5397a..650c1b0 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab41=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xab41,0x84));var _0x1ab4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xab41[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x1ab4('0x0')]},'context':{'type':Sequelize[_0x1ab4('0x0')],'defaultValue':_0x1ab4('0x1'),'unique':_0x1ab4('0x2')},'mailbox':{'type':Sequelize[_0x1ab4('0x0')],'defaultValue':'','allowNull':![],'unique':_0x1ab4('0x2')},'password':{'type':Sequelize[_0x1ab4('0x0')]},'fullname':{'type':Sequelize[_0x1ab4('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x18b6b8){this[_0x1ab4('0x3')]('email',typeof _0x18b6b8===_0x1ab4('0x4')&&_0x18b6b8[_0x1ab4('0x5')]()?_0x18b6b8[_0x1ab4('0x5')]():null);}},'pager':{'type':Sequelize[_0x1ab4('0x0')]},'tz':{'type':Sequelize[_0x1ab4('0x0')],'defaultValue':_0x1ab4('0x6')},'attach':{'type':Sequelize[_0x1ab4('0x7')](_0x1ab4('0x8'),'no'),'defaultValue':_0x1ab4('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1ab4('0x7')](_0x1ab4('0x8'),'no'),'defaultValue':_0x1ab4('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1ab4('0x0')]},'callback':{'type':Sequelize[_0x1ab4('0x0')]},'review':{'type':Sequelize[_0x1ab4('0x7')](_0x1ab4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x1ab4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x1ab4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1ab4('0x7')](_0x1ab4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1ab4('0x7')](_0x1ab4('0x8'),'no'),'defaultValue':_0x1ab4('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x1ab4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1ab4('0x7')](_0x1ab4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x1ab4('0x8'),'no'),'defaultValue':_0x1ab4('0x8'),'allowNull':![]},'stamp':{'type':_0x1ab4('0x9')},'emailsubject':{'type':Sequelize[_0x1ab4('0x0')]},'emailbody':{'type':Sequelize[_0x1ab4('0x0')]},'maxsecs':{'type':Sequelize[_0x1ab4('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1ab4('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1ab4('0xb')],'get':function(){return this['getDataValue']('fullname')+'\x20-\x20'+this[_0x1ab4('0xc')](_0x1ab4('0xd'));}}}; \ No newline at end of file +var _0xa1ca=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','mailbox','STRING','from-voicemail','contest_mailbox','email','string','trim','central'];(function(_0x142b77,_0x54ca13){var _0x586e7f=function(_0x20c8ea){while(--_0x20c8ea){_0x142b77['push'](_0x142b77['shift']());}};_0x586e7f(++_0x54ca13);}(_0xa1ca,0x125));var _0xaa1c=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0xa1ca[_0x1655bb];return _0x5e2020;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xaa1c('0x0')]},'context':{'type':Sequelize[_0xaa1c('0x0')],'defaultValue':_0xaa1c('0x1'),'unique':_0xaa1c('0x2')},'mailbox':{'type':Sequelize[_0xaa1c('0x0')],'defaultValue':'','allowNull':![],'unique':_0xaa1c('0x2')},'password':{'type':Sequelize[_0xaa1c('0x0')]},'fullname':{'type':Sequelize[_0xaa1c('0x0')]},'email':{'type':Sequelize[_0xaa1c('0x0')],'validate':{'isEmail':!![]},'set':function(_0x445827){this['setDataValue'](_0xaa1c('0x3'),typeof _0x445827===_0xaa1c('0x4')&&_0x445827[_0xaa1c('0x5')]()?_0x445827[_0xaa1c('0x5')]():null);}},'pager':{'type':Sequelize[_0xaa1c('0x0')]},'tz':{'type':Sequelize[_0xaa1c('0x0')],'defaultValue':_0xaa1c('0x6')},'attach':{'type':Sequelize[_0xaa1c('0x7')](_0xaa1c('0x8'),'no'),'defaultValue':_0xaa1c('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xaa1c('0x8'),'no'),'defaultValue':_0xaa1c('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaa1c('0x0')]},'callback':{'type':Sequelize[_0xaa1c('0x0')]},'review':{'type':Sequelize['ENUM'](_0xaa1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaa1c('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaa1c('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xaa1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaa1c('0x7')](_0xaa1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xaa1c('0x8'),'no'),'defaultValue':_0xaa1c('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaa1c('0x7')](_0xaa1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xaa1c('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaa1c('0x7')](_0xaa1c('0x8'),'no'),'defaultValue':_0xaa1c('0x8'),'allowNull':![]},'stamp':{'type':_0xaa1c('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xaa1c('0x0')]},'maxsecs':{'type':Sequelize[_0xaa1c('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaa1c('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xaa1c('0xc')](_0xaa1c('0xd'))+'\x20-\x20'+this[_0xaa1c('0xc')](_0xaa1c('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aa9a35c..5177128 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13f6=['destroy','Voicemails','error','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x1aa578,_0x4e0146){var _0x579228=function(_0x5efb17){while(--_0x5efb17){_0x1aa578['push'](_0x1aa578['shift']());}};_0x579228(++_0x4e0146);}(_0x13f6,0x124));var _0x613f=function(_0xd0fab0,_0x8e171f){_0xd0fab0=_0xd0fab0-0x0;var _0x2a76a3=_0x13f6[_0xd0fab0];return _0x2a76a3;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':!![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['update']=function(_0x387913,_0x52c2a6){if(_0x387913[_0x613f('0x47')]['id']){delete _0x387913['body']['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x387913[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x52c2a6,null))[_0x613f('0x23')](saveUpdates(_0x387913[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0x52c2a6,null))['catch'](handleError(_0x52c2a6,null));};exports[_0x613f('0x24')]=function(_0x4ff3ad,_0x3ce3dd){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x4ff3ad[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x3ce3dd,null))[_0x613f('0x23')](removeEntity(_0x3ce3dd,null))[_0x613f('0x40')](handleError(_0x3ce3dd,null));};exports[_0x613f('0x4d')]=function(_0x214d01,_0x49637d,_0x2ebce1){return db[_0x613f('0x2a')][_0x613f('0x4e')]({'where':{'id':_0x214d01['params']['id']}})['then'](handleEntityNotFound(_0x49637d,null))[_0x613f('0x23')](function(_0x4b6eb3){var _0xcb1c9d;var _0x3c3cd7={},_0x42a72b={};_0x42a72b[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x4f')][_0x613f('0x2b')]);_0x42a72b[_0x613f('0x33')]=_[_0x613f('0x30')](_0x214d01[_0x613f('0x33')]);_0x42a72b[_0x613f('0x31')]=_['intersection'](_0x42a72b[_0x613f('0x2e')],_0x42a72b[_0x613f('0x33')]);_0x3c3cd7[_0x613f('0x34')]=_[_0x613f('0x32')](_0x42a72b['model'],qs[_0x613f('0x35')](_0x214d01[_0x613f('0x33')]['fields']));_0x3c3cd7['attributes']=_0x3c3cd7[_0x613f('0x34')]['length']?_0x3c3cd7['attributes']:_0x42a72b['model'];if(!_0x214d01[_0x613f('0x33')]['hasOwnProperty']('nolimit')){_0x3c3cd7['limit']=qs[_0x613f('0x1a')](_0x214d01[_0x613f('0x33')]['limit']);_0x3c3cd7[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x214d01[_0x613f('0x33')][_0x613f('0x1d')]);}_0x3c3cd7['order']=qs[_0x613f('0x38')](_0x214d01[_0x613f('0x33')]['sort']);_0x3c3cd7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x50')](_0x214d01[_0x613f('0x33')],_0x42a72b[_0x613f('0x31')]));if(_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]){_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x3c3cd7[_0x613f('0x34')],function(_0x50d7ca){var _0x1c4e48={};_0x1c4e48[_0x50d7ca]={'$like':'%'+_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x1c4e48;})});}_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'mailboxuser':_0x4b6eb3['mailbox']});_0x3c3cd7=_[_0x613f('0x3b')]({},_0x3c3cd7,_0x214d01[_0x613f('0x3c')]);return db[_0x613f('0x4f')][_0x613f('0x51')](_0x3c3cd7)[_0x613f('0x23')](respondWithFilteredResult(_0x49637d,_0x3c3cd7));})[_0x613f('0x40')](handleError(_0x49637d,null));}; \ No newline at end of file +var _0x9354=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','map','VIRTUAL','filter','merge','options','VoiceMail','include','findAll','catch','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x3e05cc,_0x2b098c){var _0x33d724=function(_0x154c02){while(--_0x154c02){_0x3e05cc['push'](_0x3e05cc['shift']());}};_0x33d724(++_0x2b098c);}(_0x9354,0x96));var _0x4935=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x9354[_0x4456a2];return _0xf36b56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){var _0x3786ff=_0x4dc1f5[_0x4935('0x24')]({'plain':!![]});var _0x344e51=_0x4935('0x25');return db[_0x4935('0x26')][_0x4935('0x23')]({'where':{'type':_0x344e51,'resourceId':_0x3786ff['id']}})[_0x4935('0x22')](function(){return _0x4dc1f5;});})[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x2c47ab,_0xbb00d6){return function(_0x359522){if(!_0x359522){_0x2c47ab['sendStatus'](0x194);}return _0x359522;};}function handleError(_0x5c3aaa,_0x5cec4d){_0x5cec4d=_0x5cec4d||0x1f4;return function(_0x1fc218){logger[_0x4935('0x27')](_0x1fc218['stack']);if(_0x1fc218[_0x4935('0x28')]){delete _0x1fc218[_0x4935('0x28')];}_0x5c3aaa[_0x4935('0x18')](_0x5cec4d)[_0x4935('0x29')](_0x1fc218);};}exports[_0x4935('0x2a')]=function(_0x24262e,_0x28afc2){var _0x2fe6da={},_0x5b3c8e={},_0xb7fe2a={'count':0x0,'rows':[]};var _0x2dcb0b=_['map'](db['VoiceMail'][_0x4935('0x2b')],function(_0x479d28){return{'name':_0x479d28[_0x4935('0x2c')],'type':_0x479d28[_0x4935('0x2d')][_0x4935('0x2e')]};});_0x5b3c8e['model']=_['map'](_0x2dcb0b,_0x4935('0x28'));_0x5b3c8e[_0x4935('0x2f')]=_['keys'](_0x24262e[_0x4935('0x2f')]);_0x5b3c8e[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5b3c8e[_0x4935('0x32')],_0x5b3c8e[_0x4935('0x2f')]);_0x2fe6da['attributes']=_['intersection'](_0x5b3c8e[_0x4935('0x32')],qs[_0x4935('0x33')](_0x24262e['query']['fields']));_0x2fe6da[_0x4935('0x34')]=_0x2fe6da['attributes'][_0x4935('0x35')]?_0x2fe6da[_0x4935('0x34')]:_0x5b3c8e[_0x4935('0x32')];if(!_0x24262e[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x2fe6da['limit']=qs[_0x4935('0x1c')](_0x24262e['query'][_0x4935('0x1c')]);_0x2fe6da['offset']=qs[_0x4935('0x38')](_0x24262e['query'][_0x4935('0x38')]);}_0x2fe6da[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24262e[_0x4935('0x2f')][_0x4935('0x3a')]);_0x2fe6da[_0x4935('0x3b')]=qs[_0x4935('0x30')](_['pick'](_0x24262e['query'],_0x5b3c8e[_0x4935('0x30')]),_0x2dcb0b);if(_0x24262e['query']['filter']){_0x2fe6da[_0x4935('0x3b')]=_['merge'](_0x2fe6da[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x2dcb0b,function(_0x2d67e3){if(_0x2d67e3[_0x4935('0x2d')]!==_0x4935('0x3d')){var _0x53aac5={};_0x53aac5[_0x2d67e3['name']]={'$like':'%'+_0x24262e[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x53aac5;}})});}_0x2fe6da=_[_0x4935('0x3f')]({},_0x2fe6da,_0x24262e[_0x4935('0x40')]);var _0x4d9436={'where':_0x2fe6da[_0x4935('0x3b')]};return db[_0x4935('0x41')][_0x4935('0x1d')](_0x4d9436)['then'](function(_0x4e94f6){_0xb7fe2a[_0x4935('0x1d')]=_0x4e94f6;if(_0x24262e[_0x4935('0x2f')]['includeAll']){_0x2fe6da[_0x4935('0x42')]=[{'all':!![]}];}return db[_0x4935('0x41')][_0x4935('0x43')](_0x2fe6da);})[_0x4935('0x22')](function(_0x52ab0c){_0xb7fe2a['rows']=_0x52ab0c;return _0xb7fe2a;})[_0x4935('0x22')](respondWithFilteredResult(_0x28afc2,_0x2fe6da))[_0x4935('0x44')](handleError(_0x28afc2,null));};exports['show']=function(_0x1eaa47,_0x40f5ff){var _0x2195da={'raw':!![],'where':{'id':_0x1eaa47[_0x4935('0x45')]['id']}},_0x5135fd={};_0x5135fd[_0x4935('0x32')]=_[_0x4935('0x46')](db[_0x4935('0x41')][_0x4935('0x2b')]);_0x5135fd[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x1eaa47[_0x4935('0x2f')]);_0x5135fd[_0x4935('0x30')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],_0x5135fd[_0x4935('0x2f')]);_0x2195da[_0x4935('0x34')]=_[_0x4935('0x31')](_0x5135fd[_0x4935('0x32')],qs[_0x4935('0x33')](_0x1eaa47[_0x4935('0x2f')][_0x4935('0x33')]));_0x2195da['attributes']=_0x2195da[_0x4935('0x34')]['length']?_0x2195da[_0x4935('0x34')]:_0x5135fd[_0x4935('0x32')];if(_0x1eaa47[_0x4935('0x2f')][_0x4935('0x47')]){_0x2195da['include']=[{'all':!![]}];}_0x2195da=_[_0x4935('0x3f')]({},_0x2195da,_0x1eaa47[_0x4935('0x40')]);return db[_0x4935('0x41')][_0x4935('0x48')](_0x2195da)[_0x4935('0x22')](handleEntityNotFound(_0x40f5ff,null))[_0x4935('0x22')](respondWithResult(_0x40f5ff,null))[_0x4935('0x44')](handleError(_0x40f5ff,null));};exports[_0x4935('0x49')]=function(_0x29b932,_0x392cba){return db['VoiceMail'][_0x4935('0x49')](_0x29b932[_0x4935('0x4a')],{})['then'](function(_0x447a64){var _0x2636f4=_0x29b932[_0x4935('0x4b')][_0x4935('0x24')]({'plain':!![]});if(!_0x2636f4)throw new Error(_0x4935('0x4c'));if(_0x2636f4[_0x4935('0x4d')]===_0x4935('0x4b')){var _0x471fb1=_0x447a64['get']({'plain':!![]});var _0x57d0d9='Voicemails';return db['UserProfileSection'][_0x4935('0x48')]({'where':{'name':_0x57d0d9,'userProfileId':_0x2636f4[_0x4935('0x4e')]},'raw':!![]})[_0x4935('0x22')](function(_0x2072df){if(_0x2072df&&_0x2072df[_0x4935('0x4f')]===0x0){return db['UserProfileResource'][_0x4935('0x49')]({'name':_0x471fb1[_0x4935('0x28')],'resourceId':_0x471fb1['id'],'type':_0x2072df[_0x4935('0x28')],'sectionId':_0x2072df['id']},{})[_0x4935('0x22')](function(){return _0x447a64;});}else{return _0x447a64;}})[_0x4935('0x44')](function(_0x8196b4){logger[_0x4935('0x27')](_0x4935('0x50'),_0x8196b4);throw _0x8196b4;});}return _0x447a64;})[_0x4935('0x22')](respondWithResult(_0x392cba,0xc9))[_0x4935('0x44')](handleError(_0x392cba,null));};exports['update']=function(_0x24b83b,_0x4e99bb){if(_0x24b83b[_0x4935('0x4a')]['id']){delete _0x24b83b[_0x4935('0x4a')]['id'];}return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0x24b83b['params']['id']}})['then'](handleEntityNotFound(_0x4e99bb,null))['then'](saveUpdates(_0x24b83b[_0x4935('0x4a')],null))[_0x4935('0x22')](respondWithResult(_0x4e99bb,null))[_0x4935('0x44')](handleError(_0x4e99bb,null));};exports[_0x4935('0x23')]=function(_0xd5a489,_0x56db7f){return db['VoiceMail'][_0x4935('0x48')]({'where':{'id':_0xd5a489[_0x4935('0x45')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x56db7f,null))['then'](removeEntity(_0x56db7f,null))[_0x4935('0x44')](handleError(_0x56db7f,null));};exports[_0x4935('0x51')]=function(_0x24141a,_0xc92288,_0x5009c9){return db[_0x4935('0x41')]['findOne']({'where':{'id':_0x24141a['params']['id']}})['then'](handleEntityNotFound(_0xc92288,null))[_0x4935('0x22')](function(_0x10cd78){var _0x47e73d;var _0x3190d2={},_0x395eba={};_0x395eba['model']=_[_0x4935('0x46')](db[_0x4935('0x52')][_0x4935('0x2b')]);_0x395eba[_0x4935('0x2f')]=_[_0x4935('0x46')](_0x24141a[_0x4935('0x2f')]);_0x395eba[_0x4935('0x30')]=_['intersection'](_0x395eba[_0x4935('0x32')],_0x395eba['query']);_0x3190d2['attributes']=_[_0x4935('0x31')](_0x395eba[_0x4935('0x32')],qs['fields'](_0x24141a['query'][_0x4935('0x33')]));_0x3190d2[_0x4935('0x34')]=_0x3190d2[_0x4935('0x34')]['length']?_0x3190d2[_0x4935('0x34')]:_0x395eba['model'];if(!_0x24141a[_0x4935('0x2f')][_0x4935('0x36')](_0x4935('0x37'))){_0x3190d2[_0x4935('0x1c')]=qs[_0x4935('0x1c')](_0x24141a['query'][_0x4935('0x1c')]);_0x3190d2[_0x4935('0x38')]=qs['offset'](_0x24141a[_0x4935('0x2f')][_0x4935('0x38')]);}_0x3190d2[_0x4935('0x39')]=qs[_0x4935('0x3a')](_0x24141a[_0x4935('0x2f')][_0x4935('0x3a')]);_0x3190d2[_0x4935('0x3b')]=qs[_0x4935('0x30')](_[_0x4935('0x53')](_0x24141a[_0x4935('0x2f')],_0x395eba[_0x4935('0x30')]));if(_0x24141a['query'][_0x4935('0x3e')]){_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'$or':_[_0x4935('0x3c')](_0x3190d2[_0x4935('0x34')],function(_0x2c06f5){var _0x9023e={};_0x9023e[_0x2c06f5]={'$like':'%'+_0x24141a[_0x4935('0x2f')][_0x4935('0x3e')]+'%'};return _0x9023e;})});}_0x3190d2[_0x4935('0x3b')]=_[_0x4935('0x3f')](_0x3190d2[_0x4935('0x3b')],{'mailboxuser':_0x10cd78['mailbox']});_0x3190d2=_['merge']({},_0x3190d2,_0x24141a[_0x4935('0x40')]);return db[_0x4935('0x52')]['findAndCountAll'](_0x3190d2)[_0x4935('0x22')](respondWithFilteredResult(_0xc92288,_0x3190d2));})[_0x4935('0x44')](handleError(_0xc92288,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 349b35e..9017ad4 100644 --- a/server/api/voiceMail/voiceMail.model.js +++ b/server/api/voiceMail/voiceMail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc157=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x245ca3,_0x1d6ac8){var _0x3688b5=function(_0x2eab0e){while(--_0x2eab0e){_0x245ca3['push'](_0x245ca3['shift']());}};_0x3688b5(++_0x1d6ac8);}(_0xc157,0x1e8));var _0x7c15=function(_0x16803d,_0x2d35fa){_0x16803d=_0x16803d-0x0;var _0x47bd54=_0xc157[_0x16803d];return _0x47bd54;};'use strict';var _=require('lodash');var util=require(_0x7c15('0x0'));var logger=require(_0x7c15('0x1'))(_0x7c15('0x2'));var moment=require(_0x7c15('0x3'));var BPromise=require(_0x7c15('0x4'));var rp=require(_0x7c15('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c15('0x6'));var config=require(_0x7c15('0x7'));var attributes=require(_0x7c15('0x8'));module[_0x7c15('0x9')]=function(_0x550d4d,_0x31f1e7){return _0x550d4d[_0x7c15('0xa')](_0x7c15('0xb'),attributes,{'tableName':_0x7c15('0xc'),'paranoid':![],'indexes':[{'name':_0x7c15('0xd'),'fields':['mailbox',_0x7c15('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xecfa=['bluebird','request-promise','path','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment'];(function(_0x46f267,_0x4ccb5d){var _0x58e5ca=function(_0x3c9c0a){while(--_0x3c9c0a){_0x46f267['push'](_0x46f267['shift']());}};_0x58e5ca(++_0x4ccb5d);}(_0xecfa,0x163));var _0xaecf=function(_0x36155,_0x26832c){_0x36155=_0x36155-0x0;var _0x5cc1bf=_0xecfa[_0x36155];return _0x5cc1bf;};'use strict';var _=require(_0xaecf('0x0'));var util=require(_0xaecf('0x1'));var logger=require(_0xaecf('0x2'))(_0xaecf('0x3'));var moment=require(_0xaecf('0x4'));var BPromise=require(_0xaecf('0x5'));var rp=require(_0xaecf('0x6'));var fs=require('fs');var path=require(_0xaecf('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaecf('0x8'));module[_0xaecf('0x9')]=function(_0x551e47,_0x1474b9){return _0x551e47[_0xaecf('0xa')](_0xaecf('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xaecf('0xc'),'fields':[_0xaecf('0xd'),_0xaecf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 62de0c6..34e2ed0 100644 --- a/server/api/voiceMail/voiceMail.rpc.js +++ b/server/api/voiceMail/voiceMail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea6=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ea6,0x82));var _0x64ea=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x4ea6[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0x64ea('0x0'));var util=require(_0x64ea('0x1'));var moment=require(_0x64ea('0x2'));var BPromise=require(_0x64ea('0x3'));var rs=require(_0x64ea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x64ea('0x5'));var logger=require('../../config/logger')(_0x64ea('0x6'));var config=require(_0x64ea('0x7'));var jayson=require(_0x64ea('0x8'));var client=jayson[_0x64ea('0x9')][_0x64ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cbdb3,_0xb241cd,_0x3ae773){return new BPromise(function(_0x56592a,_0x2662fc){return client[_0x64ea('0xb')](_0x3cbdb3,_0x3ae773)[_0x64ea('0xc')](function(_0x3bb720){logger[_0x64ea('0xd')](_0x64ea('0xe'),_0xb241cd,'request\x20sent');logger[_0x64ea('0xf')](_0x64ea('0x10'),_0xb241cd,_0x64ea('0x11'),JSON[_0x64ea('0x12')](_0x3bb720));if(_0x3bb720['error']){if(_0x3bb720[_0x64ea('0x13')][_0x64ea('0x14')]===0x1f4){logger['error'](_0x64ea('0xe'),_0xb241cd,_0x3bb720[_0x64ea('0x13')][_0x64ea('0x15')]);return _0x2662fc(_0x3bb720[_0x64ea('0x13')][_0x64ea('0x15')]);}logger[_0x64ea('0x13')](_0x64ea('0xe'),_0xb241cd,_0x3bb720[_0x64ea('0x13')][_0x64ea('0x15')]);return _0x56592a(_0x3bb720[_0x64ea('0x13')][_0x64ea('0x15')]);}else{logger['info'](_0x64ea('0xe'),_0xb241cd,_0x64ea('0x11'));_0x56592a(_0x3bb720['result'][_0x64ea('0x15')]);}})['catch'](function(_0xfb69f9){logger[_0x64ea('0x13')]('VoiceMail,\x20%s,\x20%s',_0xb241cd,_0xfb69f9);_0x2662fc(_0xfb69f9);});});} \ No newline at end of file +var _0x953b=['debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0x8c3a81,_0x288a96){var _0x2b8b1f=function(_0xe7a01e){while(--_0xe7a01e){_0x8c3a81['push'](_0x8c3a81['shift']());}};_0x2b8b1f(++_0x288a96);}(_0x953b,0x180));var _0xb953=function(_0x1949d3,_0x567dc7){_0x1949d3=_0x1949d3-0x0;var _0x24bd6f=_0x953b[_0x1949d3];return _0x24bd6f;};'use strict';var _=require(_0xb953('0x0'));var util=require(_0xb953('0x1'));var moment=require(_0xb953('0x2'));var BPromise=require(_0xb953('0x3'));var rs=require(_0xb953('0x4'));var fs=require('fs');var Redis=require(_0xb953('0x5'));var db=require(_0xb953('0x6'))['db'];var utils=require(_0xb953('0x7'));var logger=require('../../config/logger')(_0xb953('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb953('0x9')][_0xb953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55674b,_0x5a40eb,_0x480a7e){return new BPromise(function(_0x22e7d6,_0x4bae2f){return client[_0xb953('0xb')](_0x55674b,_0x480a7e)[_0xb953('0xc')](function(_0x342fab){logger[_0xb953('0xd')](_0xb953('0xe'),_0x5a40eb,'request\x20sent');logger[_0xb953('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5a40eb,_0xb953('0x10'),JSON['stringify'](_0x342fab));if(_0x342fab[_0xb953('0x11')]){if(_0x342fab['error'][_0xb953('0x12')]===0x1f4){logger[_0xb953('0x11')](_0xb953('0xe'),_0x5a40eb,_0x342fab[_0xb953('0x11')][_0xb953('0x13')]);return _0x4bae2f(_0x342fab[_0xb953('0x11')][_0xb953('0x13')]);}logger[_0xb953('0x11')](_0xb953('0xe'),_0x5a40eb,_0x342fab[_0xb953('0x11')][_0xb953('0x13')]);return _0x22e7d6(_0x342fab[_0xb953('0x11')][_0xb953('0x13')]);}else{logger[_0xb953('0xd')](_0xb953('0xe'),_0x5a40eb,_0xb953('0x10'));_0x22e7d6(_0x342fab[_0xb953('0x14')][_0xb953('0x13')]);}})['catch'](function(_0x47ccac){logger['error'](_0xb953('0xe'),_0x5a40eb,_0x47ccac);_0x4bae2f(_0x47ccac);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d139d1d..a112344 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated','download','post','put','destroy','exports','multer','util','express'];(function(_0x505e76,_0x2b4ddc){var _0x1b8026=function(_0x1de3c4){while(--_0x1de3c4){_0x505e76['push'](_0x505e76['shift']());}};_0x1b8026(++_0x2b4ddc);}(_0x4024,0xed));var _0x4402=function(_0x666623,_0x4275dd){_0x666623=_0x666623-0x0;var _0x3740e5=_0x4024[_0x666623];return _0x3740e5;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4402('0x2'));var router=express[_0x4402('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4402('0x4'));var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require(_0x4402('0x7'));router[_0x4402('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4402('0x8')](_0x4402('0x9'),auth[_0x4402('0xa')](),controller['show']);router[_0x4402('0x8')]('/:id/download',auth[_0x4402('0xa')](),controller[_0x4402('0xb')]);router[_0x4402('0xc')]('/',auth[_0x4402('0xa')](),controller['create']);router[_0x4402('0xd')](_0x4402('0x9'),auth[_0x4402('0xa')](),controller['update']);router['delete'](_0x4402('0x9'),auth[_0x4402('0xa')](),controller[_0x4402('0xe')]);module[_0x4402('0xf')]=router; \ No newline at end of file +var _0x2cd3=['download','post','create','/:id','update','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','get','show','/:id/download'];(function(_0xec625b,_0x31d6f9){var _0x58c103=function(_0x476793){while(--_0x476793){_0xec625b['push'](_0xec625b['shift']());}};_0x58c103(++_0x31d6f9);}(_0x2cd3,0xd2));var _0x32cd=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0x2cd3[_0x2d2258];return _0x18e155;};'use strict';var multer=require(_0x32cd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x32cd('0x1'));var router=express[_0x32cd('0x2')]();var fs_extra=require(_0x32cd('0x3'));var auth=require(_0x32cd('0x4'));var interaction=require(_0x32cd('0x5'));var config=require('../../config/environment');var controller=require(_0x32cd('0x6'));router['get']('/',auth[_0x32cd('0x7')](),controller['index']);router[_0x32cd('0x8')]('/:id',auth[_0x32cd('0x7')](),controller[_0x32cd('0x9')]);router[_0x32cd('0x8')](_0x32cd('0xa'),auth['isAuthenticated'](),controller[_0x32cd('0xb')]);router[_0x32cd('0xc')]('/',auth[_0x32cd('0x7')](),controller[_0x32cd('0xd')]);router['put'](_0x32cd('0xe'),auth[_0x32cd('0x7')](),controller[_0x32cd('0xf')]);router['delete'](_0x32cd('0xe'),auth[_0x32cd('0x7')](),controller[_0x32cd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 35386fa..59d7897 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.attributes.js +++ b/server/api/voiceMailMessage/voiceMailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4500=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2e5018,_0xbf6555){var _0x2f5d60=function(_0x430a84){while(--_0x430a84){_0x2e5018['push'](_0x2e5018['shift']());}};_0x2f5d60(++_0xbf6555);}(_0x4500,0x16c));var _0x0450=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x4500[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0x0450('0x0'));module[_0x0450('0x1')]={'name':{'type':Sequelize[_0x0450('0x2')],'get':function(_0x223f67){return this[_0x0450('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x0450('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0450('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x0450('0x6'))}}; \ No newline at end of file +var _0x1179=['TIMESTAMP','literal','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB','long'];(function(_0x1e8c3d,_0x378458){var _0x5e29bd=function(_0x1b86cb){while(--_0x1b86cb){_0x1e8c3d['push'](_0x1e8c3d['shift']());}};_0x5e29bd(++_0x378458);}(_0x1179,0x110));var _0x9117=function(_0x10ab62,_0x21d1da){_0x10ab62=_0x10ab62-0x0;var _0x3b325b=_0x1179[_0x10ab62];return _0x3b325b;};'use strict';var Sequelize=require(_0x9117('0x0'));module[_0x9117('0x1')]={'name':{'type':Sequelize[_0x9117('0x2')],'get':function(_0x4a0fde){return this[_0x9117('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x9117('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9117('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x9117('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x9117('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x9117('0x5')](_0x9117('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x9117('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x9117('0x7'),'defaultValue':Sequelize[_0x9117('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d34e654..25aa4f3 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.controller.js +++ b/server/api/voiceMailMessage/voiceMailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebed=['send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','stack','name'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xebed,0xcb));var _0xdebe=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0xebed[_0xc87d08];return _0x30a714;};'use strict';var emlformat=require(_0xdebe('0x0'));var rimraf=require(_0xdebe('0x1'));var zipdir=require(_0xdebe('0x2'));var jsonpatch=require(_0xdebe('0x3'));var rp=require('request-promise');var moment=require(_0xdebe('0x4'));var BPromise=require(_0xdebe('0x5'));var Mustache=require(_0xdebe('0x6'));var util=require(_0xdebe('0x7'));var path=require(_0xdebe('0x8'));var sox=require('sox');var csv=require(_0xdebe('0x9'));var ejs=require(_0xdebe('0xa'));var fs=require('fs');var fs_extra=require(_0xdebe('0xb'));var _=require(_0xdebe('0xc'));var squel=require('squel');var crypto=require(_0xdebe('0xd'));var jsforce=require(_0xdebe('0xe'));var deskjs=require(_0xdebe('0xf'));var toCsv=require(_0xdebe('0x9'));var querystring=require('querystring');var Papa=require(_0xdebe('0x10'));var Redis=require(_0xdebe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdebe('0x12'));var as=require(_0xdebe('0x13'));var hardwareService=require(_0xdebe('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xdebe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdebe('0x16'));var db=require(_0xdebe('0x17'))['db'];function respondWithStatusCode(_0x5560a9,_0x46a5b4){_0x46a5b4=_0x46a5b4||0xcc;return function(_0x5e2737){if(_0x5e2737){return _0x5560a9[_0xdebe('0x18')](_0x46a5b4);}return _0x5560a9[_0xdebe('0x19')](_0x46a5b4)[_0xdebe('0x1a')]();};}function respondWithResult(_0xe804ab,_0x3c1e53){_0x3c1e53=_0x3c1e53||0xc8;return function(_0xd693ac){if(_0xd693ac){return _0xe804ab[_0xdebe('0x19')](_0x3c1e53)['json'](_0xd693ac);}};}function respondWithFilteredResult(_0x2b7708,_0x3a5bb1){return function(_0x30e6fc){if(_0x30e6fc){var _0x33b2a0=typeof _0x3a5bb1['offset']===_0xdebe('0x1b')&&typeof _0x3a5bb1['limit']===_0xdebe('0x1b');var _0x3e1189=_0x30e6fc[_0xdebe('0x1c')];var _0x85b42f=_0x33b2a0?0x0:_0x3a5bb1['offset'];var _0xb994ea=_0x33b2a0?_0x30e6fc[_0xdebe('0x1c')]:_0x3a5bb1[_0xdebe('0x1d')]+_0x3a5bb1[_0xdebe('0x1e')];var _0x26ba98;if(_0xb994ea>=_0x3e1189){_0xb994ea=_0x3e1189;_0x26ba98=0xc8;}else{_0x26ba98=0xce;}_0x2b7708['status'](_0x26ba98);return _0x2b7708['set'](_0xdebe('0x1f'),_0x85b42f+'-'+_0xb994ea+'/'+_0x3e1189)[_0xdebe('0x20')](_0x30e6fc);}return null;};}function patchUpdates(_0x554250){return function(_0x2f0fe1){try{jsonpatch[_0xdebe('0x21')](_0x2f0fe1,_0x554250,!![]);}catch(_0x237ab7){return BPromise['reject'](_0x237ab7);}return _0x2f0fe1[_0xdebe('0x22')]();};}function saveUpdates(_0x293cc3,_0xb5d62b){return function(_0x3f6955){if(_0x3f6955){return _0x3f6955[_0xdebe('0x23')](_0x293cc3)[_0xdebe('0x24')](function(_0x48dbc6){return _0x48dbc6;});}return null;};}function removeEntity(_0x36df15,_0x3f99d5){return function(_0x50e2a6){if(_0x50e2a6){return _0x50e2a6[_0xdebe('0x25')]()[_0xdebe('0x24')](function(){_0x36df15[_0xdebe('0x19')](0xcc)[_0xdebe('0x1a')]();});}};}function handleEntityNotFound(_0x5c5c6e,_0x1a4759){return function(_0x318b77){if(!_0x318b77){_0x5c5c6e[_0xdebe('0x18')](0x194);}return _0x318b77;};}function handleError(_0x12924d,_0x2584ab){_0x2584ab=_0x2584ab||0x1f4;return function(_0x37a622){logger['error'](_0x37a622[_0xdebe('0x26')]);if(_0x37a622[_0xdebe('0x27')]){delete _0x37a622[_0xdebe('0x27')];}_0x12924d[_0xdebe('0x19')](_0x2584ab)[_0xdebe('0x28')](_0x37a622);};}exports[_0xdebe('0x29')]=function(_0x1b4804,_0x4ba90f){var _0x417531={},_0x112680={},_0x27445c={'count':0x0,'rows':[]};var _0x39cd37=_[_0xdebe('0x2a')](db[_0xdebe('0x2b')][_0xdebe('0x2c')],function(_0x55250d){return{'name':_0x55250d[_0xdebe('0x2d')],'type':_0x55250d['type'][_0xdebe('0x2e')]};});_0x112680['model']=_['differenceBy'](_['map'](_0x39cd37,'name'),['name']);_0x112680['query']=_['keys'](_0x1b4804[_0xdebe('0x2f')]);_0x112680['filters']=_['intersection'](_0x112680[_0xdebe('0x30')],_0x112680[_0xdebe('0x2f')]);_0x417531['attributes']=_[_0xdebe('0x31')](_0x112680[_0xdebe('0x30')],qs[_0xdebe('0x32')](_0x1b4804['query']['fields']));_0x417531[_0xdebe('0x33')]=_0x417531[_0xdebe('0x33')][_0xdebe('0x34')]?_0x417531[_0xdebe('0x33')]:_0x112680[_0xdebe('0x30')];if(!_0x1b4804[_0xdebe('0x2f')][_0xdebe('0x35')](_0xdebe('0x36'))){_0x417531[_0xdebe('0x1e')]=qs[_0xdebe('0x1e')](_0x1b4804[_0xdebe('0x2f')]['limit']);_0x417531[_0xdebe('0x1d')]=qs['offset'](_0x1b4804[_0xdebe('0x2f')][_0xdebe('0x1d')]);}_0x417531[_0xdebe('0x37')]=qs['sort'](_0x1b4804[_0xdebe('0x2f')][_0xdebe('0x38')]);_0x417531[_0xdebe('0x39')]=qs['filters'](_[_0xdebe('0x3a')](_0x1b4804[_0xdebe('0x2f')],_0x112680[_0xdebe('0x3b')]),_0x39cd37);if(_0x1b4804['query']['filter']){_0x417531[_0xdebe('0x39')]=_[_0xdebe('0x3c')](_0x417531[_0xdebe('0x39')],{'$or':_[_0xdebe('0x2a')](_0x39cd37,function(_0x4887bf){if(_0x4887bf[_0xdebe('0x3d')]!==_0xdebe('0x3e')){var _0x33f20e={};_0x33f20e[_0x4887bf[_0xdebe('0x27')]]={'$like':'%'+_0x1b4804[_0xdebe('0x2f')]['filter']+'%'};return _0x33f20e;}})});}_0x417531=_[_0xdebe('0x3c')]({},_0x417531,_0x1b4804[_0xdebe('0x3f')]);var _0x5a2a7e={'where':_0x417531[_0xdebe('0x39')]};return db[_0xdebe('0x2b')][_0xdebe('0x1c')](_0x5a2a7e)[_0xdebe('0x24')](function(_0x5826d7){_0x27445c[_0xdebe('0x1c')]=_0x5826d7;if(_0x1b4804[_0xdebe('0x2f')][_0xdebe('0x40')]){_0x417531['include']=[{'all':!![]}];}return db[_0xdebe('0x2b')]['findAll'](_0x417531);})[_0xdebe('0x24')](function(_0xf22a43){_0x27445c[_0xdebe('0x41')]=_0xf22a43;return _0x27445c;})['then'](respondWithFilteredResult(_0x4ba90f,_0x417531))[_0xdebe('0x42')](handleError(_0x4ba90f,null));};exports['show']=function(_0x4e2e90,_0x5286e9){var _0x90c4cf={'raw':!![],'where':{'id':_0x4e2e90[_0xdebe('0x43')]['id']}},_0x480c3a={};_0x480c3a['model']=_[_0xdebe('0x44')](db[_0xdebe('0x2b')][_0xdebe('0x2c')]);_0x480c3a[_0xdebe('0x2f')]=_[_0xdebe('0x44')](_0x4e2e90['query']);_0x480c3a['filters']=_[_0xdebe('0x31')](_0x480c3a[_0xdebe('0x30')],_0x480c3a[_0xdebe('0x2f')]);_0x90c4cf[_0xdebe('0x33')]=_[_0xdebe('0x31')](_0x480c3a['model'],qs[_0xdebe('0x32')](_0x4e2e90['query'][_0xdebe('0x32')]));_0x90c4cf['attributes']=_0x90c4cf[_0xdebe('0x33')][_0xdebe('0x34')]?_0x90c4cf['attributes']:_0x480c3a[_0xdebe('0x30')];if(_0x4e2e90[_0xdebe('0x2f')]['includeAll']){_0x90c4cf[_0xdebe('0x45')]=[{'all':!![]}];}_0x90c4cf=_[_0xdebe('0x3c')]({},_0x90c4cf,_0x4e2e90[_0xdebe('0x3f')]);return db['VoiceMailMessage'][_0xdebe('0x46')](_0x90c4cf)['then'](handleEntityNotFound(_0x5286e9,null))[_0xdebe('0x24')](respondWithResult(_0x5286e9,null))[_0xdebe('0x42')](handleError(_0x5286e9,null));};exports['create']=function(_0x43ad7b,_0x29b13c){return db[_0xdebe('0x2b')]['create'](_0x43ad7b['body'],{})['then'](respondWithResult(_0x29b13c,0xc9))[_0xdebe('0x42')](handleError(_0x29b13c,null));};exports[_0xdebe('0x23')]=function(_0x5dc44e,_0x8e03aa){if(_0x5dc44e[_0xdebe('0x47')]['id']){delete _0x5dc44e[_0xdebe('0x47')]['id'];}return db[_0xdebe('0x2b')][_0xdebe('0x46')]({'where':{'id':_0x5dc44e[_0xdebe('0x43')]['id']}})[_0xdebe('0x24')](handleEntityNotFound(_0x8e03aa,null))[_0xdebe('0x24')](saveUpdates(_0x5dc44e[_0xdebe('0x47')],null))[_0xdebe('0x24')](respondWithResult(_0x8e03aa,null))[_0xdebe('0x42')](handleError(_0x8e03aa,null));};exports['destroy']=function(_0x5aef05,_0x2bab6b){return db[_0xdebe('0x2b')][_0xdebe('0x46')]({'where':{'id':_0x5aef05[_0xdebe('0x43')]['id']}})[_0xdebe('0x24')](handleEntityNotFound(_0x2bab6b,null))[_0xdebe('0x24')](removeEntity(_0x2bab6b,null))[_0xdebe('0x42')](handleError(_0x2bab6b,null));};exports[_0xdebe('0x48')]=function(_0x31951a,_0x2fff36,_0x4f7216){return db[_0xdebe('0x2b')]['find']({'where':{'id':_0x31951a[_0xdebe('0x43')]['id']},'attributes':['id',_0xdebe('0x49'),_0xdebe('0x4a')]})[_0xdebe('0x24')](handleEntityNotFound(_0x2fff36,null))[_0xdebe('0x24')](function(_0x4bcee6){if(_0x4bcee6){if(!_0x4bcee6[_0xdebe('0x49')]){throw new db[(_0xdebe('0x4b'))]['ValidationError'](_0xdebe('0x4c'));}var _0xe5aacd={'Content-Type':_0xdebe('0x4d'),'Content-Disposition':_0xdebe('0x4e')};if(_0x4bcee6[_0xdebe('0x4a')]){_0xe5aacd['Content-Disposition']='attachment;\x20filename=\x22'+_0x4bcee6[_0xdebe('0x4a')]+_0xdebe('0x4f');}_0x2fff36[_0xdebe('0x50')](_0xe5aacd);return _0x2fff36[_0xdebe('0x28')](new Buffer(_0x4bcee6[_0xdebe('0x49')]));}})['catch'](handleError(_0x2fff36,null));}; \ No newline at end of file +var _0x15fc=['order','sort','pick','filter','where','merge','VIRTUAL','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','download','recording','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1b3720,_0x1e93d8){var _0x239371=function(_0x365c12){while(--_0x365c12){_0x1b3720['push'](_0x1b3720['shift']());}};_0x239371(++_0x1e93d8);}(_0x15fc,0x11e));var _0xc15f=function(_0x2e746d,_0xadce30){_0x2e746d=_0x2e746d-0x0;var _0x126d2d=_0x15fc[_0x2e746d];return _0x126d2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc15f('0x0'));var zipdir=require(_0xc15f('0x1'));var jsonpatch=require(_0xc15f('0x2'));var rp=require(_0xc15f('0x3'));var moment=require(_0xc15f('0x4'));var BPromise=require(_0xc15f('0x5'));var Mustache=require('mustache');var util=require(_0xc15f('0x6'));var path=require(_0xc15f('0x7'));var sox=require(_0xc15f('0x8'));var csv=require(_0xc15f('0x9'));var ejs=require(_0xc15f('0xa'));var fs=require('fs');var fs_extra=require(_0xc15f('0xb'));var _=require(_0xc15f('0xc'));var squel=require('squel');var crypto=require(_0xc15f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc15f('0xe'));var toCsv=require(_0xc15f('0x9'));var querystring=require(_0xc15f('0xf'));var Papa=require(_0xc15f('0x10'));var Redis=require('ioredis');var authService=require(_0xc15f('0x11'));var qs=require(_0xc15f('0x12'));var as=require(_0xc15f('0x13'));var hardwareService=require(_0xc15f('0x14'));var logger=require(_0xc15f('0x15'))(_0xc15f('0x16'));var utils=require(_0xc15f('0x17'));var config=require(_0xc15f('0x18'));var licenseUtil=require(_0xc15f('0x19'));var db=require(_0xc15f('0x1a'))['db'];function respondWithStatusCode(_0x97bff,_0xe60652){_0xe60652=_0xe60652||0xcc;return function(_0x438387){if(_0x438387){return _0x97bff[_0xc15f('0x1b')](_0xe60652);}return _0x97bff[_0xc15f('0x1c')](_0xe60652)[_0xc15f('0x1d')]();};}function respondWithResult(_0x431892,_0x9dfcae){_0x9dfcae=_0x9dfcae||0xc8;return function(_0xefa74d){if(_0xefa74d){return _0x431892[_0xc15f('0x1c')](_0x9dfcae)[_0xc15f('0x1e')](_0xefa74d);}};}function respondWithFilteredResult(_0x963eef,_0x29734e){return function(_0x591a24){if(_0x591a24){var _0x3e9e88=typeof _0x29734e[_0xc15f('0x1f')]===_0xc15f('0x20')&&typeof _0x29734e[_0xc15f('0x21')]==='undefined';var _0x3d17ba=_0x591a24['count'];var _0x1332d8=_0x3e9e88?0x0:_0x29734e['offset'];var _0x46cedb=_0x3e9e88?_0x591a24[_0xc15f('0x22')]:_0x29734e['offset']+_0x29734e['limit'];var _0x2ae0f6;if(_0x46cedb>=_0x3d17ba){_0x46cedb=_0x3d17ba;_0x2ae0f6=0xc8;}else{_0x2ae0f6=0xce;}_0x963eef['status'](_0x2ae0f6);return _0x963eef[_0xc15f('0x23')]('Content-Range',_0x1332d8+'-'+_0x46cedb+'/'+_0x3d17ba)['json'](_0x591a24);}return null;};}function patchUpdates(_0x1e85c7){return function(_0x3f88e8){try{jsonpatch[_0xc15f('0x24')](_0x3f88e8,_0x1e85c7,!![]);}catch(_0x32a5bf){return BPromise[_0xc15f('0x25')](_0x32a5bf);}return _0x3f88e8[_0xc15f('0x26')]();};}function saveUpdates(_0xbd0cdc,_0x1fa4ae){return function(_0xa85700){if(_0xa85700){return _0xa85700[_0xc15f('0x27')](_0xbd0cdc)['then'](function(_0x402e30){return _0x402e30;});}return null;};}function removeEntity(_0x3aad16,_0x3ad9fb){return function(_0x2e8370){if(_0x2e8370){return _0x2e8370[_0xc15f('0x28')]()[_0xc15f('0x29')](function(){_0x3aad16['status'](0xcc)[_0xc15f('0x1d')]();});}};}function handleEntityNotFound(_0x5b217a,_0x4812e3){return function(_0x478152){if(!_0x478152){_0x5b217a[_0xc15f('0x1b')](0x194);}return _0x478152;};}function handleError(_0x5e5686,_0x5eb667){_0x5eb667=_0x5eb667||0x1f4;return function(_0x18b331){logger[_0xc15f('0x2a')](_0x18b331[_0xc15f('0x2b')]);if(_0x18b331[_0xc15f('0x2c')]){delete _0x18b331[_0xc15f('0x2c')];}_0x5e5686[_0xc15f('0x1c')](_0x5eb667)[_0xc15f('0x2d')](_0x18b331);};}exports[_0xc15f('0x2e')]=function(_0x1a4879,_0xcfc09c){var _0x888e98={},_0x22298f={},_0x22c8dd={'count':0x0,'rows':[]};var _0x3de5c9=_[_0xc15f('0x2f')](db['VoiceMailMessage'][_0xc15f('0x30')],function(_0x3fe764){return{'name':_0x3fe764[_0xc15f('0x31')],'type':_0x3fe764[_0xc15f('0x32')][_0xc15f('0x33')]};});_0x22298f[_0xc15f('0x34')]=_[_0xc15f('0x35')](_[_0xc15f('0x2f')](_0x3de5c9,_0xc15f('0x2c')),['name']);_0x22298f[_0xc15f('0x36')]=_[_0xc15f('0x37')](_0x1a4879[_0xc15f('0x36')]);_0x22298f[_0xc15f('0x38')]=_[_0xc15f('0x39')](_0x22298f['model'],_0x22298f['query']);_0x888e98[_0xc15f('0x3a')]=_[_0xc15f('0x39')](_0x22298f[_0xc15f('0x34')],qs[_0xc15f('0x3b')](_0x1a4879['query'][_0xc15f('0x3b')]));_0x888e98['attributes']=_0x888e98['attributes'][_0xc15f('0x3c')]?_0x888e98[_0xc15f('0x3a')]:_0x22298f[_0xc15f('0x34')];if(!_0x1a4879[_0xc15f('0x36')]['hasOwnProperty'](_0xc15f('0x3d'))){_0x888e98[_0xc15f('0x21')]=qs['limit'](_0x1a4879[_0xc15f('0x36')][_0xc15f('0x21')]);_0x888e98[_0xc15f('0x1f')]=qs['offset'](_0x1a4879[_0xc15f('0x36')]['offset']);}_0x888e98[_0xc15f('0x3e')]=qs[_0xc15f('0x3f')](_0x1a4879[_0xc15f('0x36')][_0xc15f('0x3f')]);_0x888e98['where']=qs[_0xc15f('0x38')](_[_0xc15f('0x40')](_0x1a4879[_0xc15f('0x36')],_0x22298f[_0xc15f('0x38')]),_0x3de5c9);if(_0x1a4879['query'][_0xc15f('0x41')]){_0x888e98[_0xc15f('0x42')]=_[_0xc15f('0x43')](_0x888e98[_0xc15f('0x42')],{'$or':_[_0xc15f('0x2f')](_0x3de5c9,function(_0x45a8e4){if(_0x45a8e4[_0xc15f('0x32')]!==_0xc15f('0x44')){var _0x47d89e={};_0x47d89e[_0x45a8e4[_0xc15f('0x2c')]]={'$like':'%'+_0x1a4879[_0xc15f('0x36')]['filter']+'%'};return _0x47d89e;}})});}_0x888e98=_['merge']({},_0x888e98,_0x1a4879['options']);var _0x2d2c3a={'where':_0x888e98['where']};return db[_0xc15f('0x45')][_0xc15f('0x22')](_0x2d2c3a)[_0xc15f('0x29')](function(_0x371db0){_0x22c8dd['count']=_0x371db0;if(_0x1a4879[_0xc15f('0x36')][_0xc15f('0x46')]){_0x888e98[_0xc15f('0x47')]=[{'all':!![]}];}return db[_0xc15f('0x45')][_0xc15f('0x48')](_0x888e98);})[_0xc15f('0x29')](function(_0x1101de){_0x22c8dd[_0xc15f('0x49')]=_0x1101de;return _0x22c8dd;})[_0xc15f('0x29')](respondWithFilteredResult(_0xcfc09c,_0x888e98))[_0xc15f('0x4a')](handleError(_0xcfc09c,null));};exports[_0xc15f('0x4b')]=function(_0x33b60d,_0x564f2a){var _0x246247={'raw':!![],'where':{'id':_0x33b60d[_0xc15f('0x4c')]['id']}},_0x102a20={};_0x102a20['model']=_[_0xc15f('0x37')](db[_0xc15f('0x45')]['rawAttributes']);_0x102a20[_0xc15f('0x36')]=_[_0xc15f('0x37')](_0x33b60d[_0xc15f('0x36')]);_0x102a20[_0xc15f('0x38')]=_[_0xc15f('0x39')](_0x102a20['model'],_0x102a20['query']);_0x246247[_0xc15f('0x3a')]=_[_0xc15f('0x39')](_0x102a20[_0xc15f('0x34')],qs[_0xc15f('0x3b')](_0x33b60d['query'][_0xc15f('0x3b')]));_0x246247[_0xc15f('0x3a')]=_0x246247['attributes'][_0xc15f('0x3c')]?_0x246247[_0xc15f('0x3a')]:_0x102a20['model'];if(_0x33b60d['query'][_0xc15f('0x46')]){_0x246247['include']=[{'all':!![]}];}_0x246247=_['merge']({},_0x246247,_0x33b60d[_0xc15f('0x4d')]);return db[_0xc15f('0x45')][_0xc15f('0x4e')](_0x246247)[_0xc15f('0x29')](handleEntityNotFound(_0x564f2a,null))[_0xc15f('0x29')](respondWithResult(_0x564f2a,null))[_0xc15f('0x4a')](handleError(_0x564f2a,null));};exports[_0xc15f('0x4f')]=function(_0x2fa035,_0x3087c0){return db[_0xc15f('0x45')]['create'](_0x2fa035[_0xc15f('0x50')],{})[_0xc15f('0x29')](respondWithResult(_0x3087c0,0xc9))[_0xc15f('0x4a')](handleError(_0x3087c0,null));};exports[_0xc15f('0x27')]=function(_0x47d2d2,_0x3619e4){if(_0x47d2d2[_0xc15f('0x50')]['id']){delete _0x47d2d2[_0xc15f('0x50')]['id'];}return db['VoiceMailMessage'][_0xc15f('0x4e')]({'where':{'id':_0x47d2d2[_0xc15f('0x4c')]['id']}})[_0xc15f('0x29')](handleEntityNotFound(_0x3619e4,null))[_0xc15f('0x29')](saveUpdates(_0x47d2d2[_0xc15f('0x50')],null))[_0xc15f('0x29')](respondWithResult(_0x3619e4,null))[_0xc15f('0x4a')](handleError(_0x3619e4,null));};exports[_0xc15f('0x28')]=function(_0x16f173,_0x151f30){return db[_0xc15f('0x45')][_0xc15f('0x4e')]({'where':{'id':_0x16f173['params']['id']}})[_0xc15f('0x29')](handleEntityNotFound(_0x151f30,null))[_0xc15f('0x29')](removeEntity(_0x151f30,null))[_0xc15f('0x4a')](handleError(_0x151f30,null));};exports[_0xc15f('0x51')]=function(_0x2fd4b5,_0x52c892,_0x5dd29e){return db[_0xc15f('0x45')][_0xc15f('0x4e')]({'where':{'id':_0x2fd4b5[_0xc15f('0x4c')]['id']},'attributes':['id',_0xc15f('0x52'),'msg_id']})[_0xc15f('0x29')](handleEntityNotFound(_0x52c892,null))['then'](function(_0x229e71){if(_0x229e71){if(!_0x229e71[_0xc15f('0x52')]){throw new db['Sequelize']['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x151afe={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x229e71[_0xc15f('0x53')]){_0x151afe[_0xc15f('0x54')]=_0xc15f('0x55')+_0x229e71[_0xc15f('0x53')]+_0xc15f('0x56');}_0x52c892[_0xc15f('0x23')](_0x151afe);return _0x52c892[_0xc15f('0x2d')](new Buffer(_0x229e71[_0xc15f('0x52')]));}})[_0xc15f('0x4a')](handleError(_0x52c892,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index d348c1d..5566c85 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.model.js +++ b/server/api/voiceMailMessage/voiceMailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9411=['path','rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xeffaba,_0x4295af){var _0x3c3085=function(_0x1fecc9){while(--_0x1fecc9){_0xeffaba['push'](_0xeffaba['shift']());}};_0x3c3085(++_0x4295af);}(_0x9411,0x149));var _0x1941=function(_0x2e4c7e,_0x5a1fac){_0x2e4c7e=_0x2e4c7e-0x0;var _0x45b52c=_0x9411[_0x2e4c7e];return _0x45b52c;};'use strict';var _=require(_0x1941('0x0'));var util=require(_0x1941('0x1'));var logger=require(_0x1941('0x2'))(_0x1941('0x3'));var moment=require(_0x1941('0x4'));var BPromise=require(_0x1941('0x5'));var rp=require(_0x1941('0x6'));var fs=require('fs');var path=require(_0x1941('0x7'));var rimraf=require(_0x1941('0x8'));var config=require('../../config/environment');var attributes=require(_0x1941('0x9'));module[_0x1941('0xa')]=function(_0xffd2d2,_0x4d0836){return _0xffd2d2[_0x1941('0xb')]('VoiceMailMessage',attributes,{'tableName':_0x1941('0xc'),'paranoid':![],'indexes':[{'name':_0x1941('0xd'),'fields':[_0x1941('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x04a7=['bluebird','path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment'];(function(_0x28c062,_0x4185a9){var _0x3988f2=function(_0x5f1b20){while(--_0x5f1b20){_0x28c062['push'](_0x28c062['shift']());}};_0x3988f2(++_0x4185a9);}(_0x04a7,0xbf));var _0x704a=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x04a7[_0x4715d2];return _0x141811;};'use strict';var _=require(_0x704a('0x0'));var util=require(_0x704a('0x1'));var logger=require(_0x704a('0x2'))('api');var moment=require(_0x704a('0x3'));var BPromise=require(_0x704a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x704a('0x5'));var rimraf=require(_0x704a('0x6'));var config=require('../../config/environment');var attributes=require(_0x704a('0x7'));module[_0x704a('0x8')]=function(_0x51f240,_0x535b15){return _0x51f240[_0x704a('0x9')](_0x704a('0xa'),attributes,{'tableName':_0x704a('0xb'),'paranoid':![],'indexes':[{'name':_0x704a('0xc'),'fields':[_0x704a('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c59e47e..5133fa3 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0769=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x395739,_0x39a094){var _0x3c244e=function(_0x139b82){while(--_0x139b82){_0x395739['push'](_0x395739['shift']());}};_0x3c244e(++_0x39a094);}(_0x0769,0xd8));var _0x9076=function(_0x3bd87,_0xa47434){_0x3bd87=_0x3bd87-0x0;var _0x21329b=_0x0769[_0x3bd87];return _0x21329b;};'use strict';var _=require(_0x9076('0x0'));var util=require(_0x9076('0x1'));var moment=require(_0x9076('0x2'));var BPromise=require(_0x9076('0x3'));var rs=require(_0x9076('0x4'));var fs=require('fs');var Redis=require(_0x9076('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9076('0x6'));var logger=require(_0x9076('0x7'))(_0x9076('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9076('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53e24d,_0x5776f6,_0x2ec034){return new BPromise(function(_0x1e69c7,_0x30fe28){return client[_0x9076('0xa')](_0x53e24d,_0x2ec034)[_0x9076('0xb')](function(_0x413f40){logger[_0x9076('0xc')](_0x9076('0xd'),_0x5776f6,_0x9076('0xe'));logger[_0x9076('0xf')](_0x9076('0x10'),_0x5776f6,_0x9076('0xe'),JSON[_0x9076('0x11')](_0x413f40));if(_0x413f40[_0x9076('0x12')]){if(_0x413f40['error']['code']===0x1f4){logger[_0x9076('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x5776f6,_0x413f40[_0x9076('0x12')][_0x9076('0x13')]);return _0x30fe28(_0x413f40['error'][_0x9076('0x13')]);}logger[_0x9076('0x12')](_0x9076('0xd'),_0x5776f6,_0x413f40[_0x9076('0x12')][_0x9076('0x13')]);return _0x1e69c7(_0x413f40[_0x9076('0x12')]['message']);}else{logger[_0x9076('0xc')](_0x9076('0xd'),_0x5776f6,'request\x20sent');_0x1e69c7(_0x413f40[_0x9076('0x14')][_0x9076('0x13')]);}})[_0x9076('0x15')](function(_0x445c7d){logger[_0x9076('0x12')](_0x9076('0xd'),_0x5776f6,_0x445c7d);_0x30fe28(_0x445c7d);});});} \ No newline at end of file +var _0xf5b5=['debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x385359,_0x325c57){var _0x2ea4dd=function(_0x1bcf4f){while(--_0x1bcf4f){_0x385359['push'](_0x385359['shift']());}};_0x2ea4dd(++_0x325c57);}(_0xf5b5,0x68));var _0x5f5b=function(_0x16a1f8,_0xd57bbd){_0x16a1f8=_0x16a1f8-0x0;var _0x207a17=_0xf5b5[_0x16a1f8];return _0x207a17;};'use strict';var _=require(_0x5f5b('0x0'));var util=require(_0x5f5b('0x1'));var moment=require(_0x5f5b('0x2'));var BPromise=require(_0x5f5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f5b('0x4'));var db=require(_0x5f5b('0x5'))['db'];var utils=require(_0x5f5b('0x6'));var logger=require(_0x5f5b('0x7'))(_0x5f5b('0x8'));var config=require(_0x5f5b('0x9'));var jayson=require(_0x5f5b('0xa'));var client=jayson[_0x5f5b('0xb')][_0x5f5b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x467b3a,_0xd1b8ce,_0x54de05){return new BPromise(function(_0x34d827,_0x3e19da){return client['request'](_0x467b3a,_0x54de05)[_0x5f5b('0xd')](function(_0x1798ec){logger[_0x5f5b('0xe')](_0x5f5b('0xf'),_0xd1b8ce,'request\x20sent');logger[_0x5f5b('0x10')](_0x5f5b('0x11'),_0xd1b8ce,_0x5f5b('0x12'),JSON[_0x5f5b('0x13')](_0x1798ec));if(_0x1798ec['error']){if(_0x1798ec[_0x5f5b('0x14')]['code']===0x1f4){logger['error'](_0x5f5b('0xf'),_0xd1b8ce,_0x1798ec[_0x5f5b('0x14')]['message']);return _0x3e19da(_0x1798ec['error'][_0x5f5b('0x15')]);}logger['error'](_0x5f5b('0xf'),_0xd1b8ce,_0x1798ec[_0x5f5b('0x14')][_0x5f5b('0x15')]);return _0x34d827(_0x1798ec[_0x5f5b('0x14')]['message']);}else{logger[_0x5f5b('0xe')](_0x5f5b('0xf'),_0xd1b8ce,_0x5f5b('0x12'));_0x34d827(_0x1798ec[_0x5f5b('0x16')][_0x5f5b('0x15')]);}})[_0x5f5b('0x17')](function(_0x40d9f6){logger[_0x5f5b('0x14')](_0x5f5b('0xf'),_0xd1b8ce,_0x40d9f6);_0x3e19da(_0x40d9f6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 496685c..46475d8 100644 --- a/server/api/voiceMusicOnHold/index.js +++ b/server/api/voiceMusicOnHold/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c20=['./voiceMusicOnHold.controller','isAuthenticated','get','/:id','getSounds','post','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd34c38,_0x455c59){var _0xd180d6=function(_0x4a9cd4){while(--_0x4a9cd4){_0xd34c38['push'](_0xd34c38['shift']());}};_0xd180d6(++_0x455c59);}(_0x4c20,0x14c));var _0x04c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c20[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x04c2('0x0'));var timeout=require(_0x04c2('0x1'));var express=require(_0x04c2('0x2'));var router=express[_0x04c2('0x3')]();var fs_extra=require(_0x04c2('0x4'));var auth=require(_0x04c2('0x5'));var interaction=require(_0x04c2('0x6'));var config=require(_0x04c2('0x7'));var controller=require(_0x04c2('0x8'));router['get']('/',auth[_0x04c2('0x9')](),controller['index']);router[_0x04c2('0xa')](_0x04c2('0xb'),auth[_0x04c2('0x9')](),controller['show']);router[_0x04c2('0xa')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x04c2('0xc')]);router[_0x04c2('0xd')]('/',auth[_0x04c2('0x9')](),controller['create']);router['post']('/:id/sounds',auth[_0x04c2('0x9')](),controller['addSound']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x04c2('0xe')]);router[_0x04c2('0xf')]('/:id',auth[_0x04c2('0x9')](),controller[_0x04c2('0x10')]);router[_0x04c2('0xf')](_0x04c2('0x11'),auth[_0x04c2('0x9')](),controller[_0x04c2('0x12')]);module[_0x04c2('0x13')]=router; \ No newline at end of file +var _0x79e5=['getSounds','post','create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x79e5,0x9c));var _0x579e=function(_0x37e7d6,_0x5078b4){_0x37e7d6=_0x37e7d6-0x0;var _0x200919=_0x79e5[_0x37e7d6];return _0x200919;};'use strict';var multer=require(_0x579e('0x0'));var util=require(_0x579e('0x1'));var path=require('path');var timeout=require(_0x579e('0x2'));var express=require(_0x579e('0x3'));var router=express[_0x579e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x579e('0x5'));var config=require(_0x579e('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x579e('0x7')]('/',auth[_0x579e('0x8')](),controller[_0x579e('0x9')]);router[_0x579e('0x7')](_0x579e('0xa'),auth['isAuthenticated'](),controller[_0x579e('0xb')]);router[_0x579e('0x7')]('/:id/sounds',auth[_0x579e('0x8')](),controller[_0x579e('0xc')]);router[_0x579e('0xd')]('/',auth[_0x579e('0x8')](),controller[_0x579e('0xe')]);router[_0x579e('0xd')](_0x579e('0xf'),auth[_0x579e('0x8')](),controller[_0x579e('0x10')]);router[_0x579e('0x11')](_0x579e('0xa'),auth[_0x579e('0x8')](),controller[_0x579e('0x12')]);router[_0x579e('0x13')](_0x579e('0xa'),auth['isAuthenticated'](),controller[_0x579e('0x14')]);router['delete'](_0x579e('0x15'),auth[_0x579e('0x8')](),controller[_0x579e('0x16')]);module[_0x579e('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index fd4d8a6..bc5b8a1 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c5e=['exports','name','custom','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','sequelize'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x6c5e,0x149));var _0xe6c5=function(_0x21e71a,_0xf0b818){_0x21e71a=_0x21e71a-0x0;var _0x174f46=_0x6c5e[_0x21e71a];return _0x174f46;};'use strict';var Sequelize=require(_0xe6c5('0x0'));module[_0xe6c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe6c5('0x2')},'mode':{'type':Sequelize['ENUM'](_0xe6c5('0x3'),_0xe6c5('0x4'),_0xe6c5('0x5'),'quietmp3nb',_0xe6c5('0x6'),_0xe6c5('0x7')),'allowNull':!![],'defaultValue':_0xe6c5('0x4')},'directory':{'type':Sequelize[_0xe6c5('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xe6c5('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe6c5('0x8')],'allowNull':!![],'defaultValue':_0xe6c5('0x9')},'format':{'type':Sequelize[_0xe6c5('0x8')],'allowNull':!![]},'stamp':{'type':_0xe6c5('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x22a4=['mp3','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x22a4,0xd3));var _0x422a=function(_0x199b59,_0x25a5bc){_0x199b59=_0x199b59-0x0;var _0x179e10=_0x22a4[_0x199b59];return _0x179e10;};'use strict';var Sequelize=require(_0x422a('0x0'));module[_0x422a('0x1')]={'name':{'type':Sequelize[_0x422a('0x2')],'allowNull':![],'unique':_0x422a('0x3')},'mode':{'type':Sequelize[_0x422a('0x4')](_0x422a('0x5'),_0x422a('0x6'),_0x422a('0x7'),'quietmp3nb',_0x422a('0x8'),_0x422a('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x422a('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x422a('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x422a('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x422a('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index a582c33..10c7673 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe213=['directory','join','root','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','unlinkSync','Sequelize','ValidationError','addSound','sequelize','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','message','removeSound','id2','order','pick','options','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','MusicOnHolds','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','VoiceMusicOnHold','includeAll','findAll','rows','catch','fields','include','merge','body','find','params','create','transaction','mode','files'];(function(_0xf662fb,_0x27067f){var _0x35a3c4=function(_0x5d2259){while(--_0x5d2259){_0xf662fb['push'](_0xf662fb['shift']());}};_0x35a3c4(++_0x27067f);}(_0xe213,0x96));var _0x3e21=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xe213[_0x474bc0];return _0x4b24cf;};'use strict';var emlformat=require(_0x3e21('0x0'));var rimraf=require(_0x3e21('0x1'));var zipdir=require(_0x3e21('0x2'));var jsonpatch=require(_0x3e21('0x3'));var rp=require(_0x3e21('0x4'));var moment=require(_0x3e21('0x5'));var BPromise=require(_0x3e21('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e21('0x7'));var sox=require(_0x3e21('0x8'));var csv=require(_0x3e21('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e21('0xa'));var _=require(_0x3e21('0xb'));var squel=require(_0x3e21('0xc'));var crypto=require(_0x3e21('0xd'));var jsforce=require(_0x3e21('0xe'));var deskjs=require(_0x3e21('0xf'));var toCsv=require(_0x3e21('0x9'));var querystring=require(_0x3e21('0x10'));var Papa=require(_0x3e21('0x11'));var Redis=require(_0x3e21('0x12'));var authService=require(_0x3e21('0x13'));var qs=require(_0x3e21('0x14'));var as=require(_0x3e21('0x15'));var hardwareService=require(_0x3e21('0x16'));var logger=require(_0x3e21('0x17'))('api');var utils=require(_0x3e21('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3e21('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c5fc4,_0x4bb0e1){_0x4bb0e1=_0x4bb0e1||0xcc;return function(_0x45e94f){if(_0x45e94f){return _0x5c5fc4['sendStatus'](_0x4bb0e1);}return _0x5c5fc4['status'](_0x4bb0e1)[_0x3e21('0x1a')]();};}function respondWithResult(_0x54833d,_0x40013f){_0x40013f=_0x40013f||0xc8;return function(_0x216bc5){if(_0x216bc5){return _0x54833d[_0x3e21('0x1b')](_0x40013f)[_0x3e21('0x1c')](_0x216bc5);}};}function respondWithFilteredResult(_0x2935aa,_0x318548){return function(_0x58c0a6){if(_0x58c0a6){var _0x12dcdb=typeof _0x318548['offset']==='undefined'&&typeof _0x318548['limit']===_0x3e21('0x1d');var _0x28dcc0=_0x58c0a6[_0x3e21('0x1e')];var _0x3a40a0=_0x12dcdb?0x0:_0x318548[_0x3e21('0x1f')];var _0x2f14f8=_0x12dcdb?_0x58c0a6[_0x3e21('0x1e')]:_0x318548[_0x3e21('0x1f')]+_0x318548[_0x3e21('0x20')];var _0x3a15a8;if(_0x2f14f8>=_0x28dcc0){_0x2f14f8=_0x28dcc0;_0x3a15a8=0xc8;}else{_0x3a15a8=0xce;}_0x2935aa['status'](_0x3a15a8);return _0x2935aa[_0x3e21('0x21')]('Content-Range',_0x3a40a0+'-'+_0x2f14f8+'/'+_0x28dcc0)[_0x3e21('0x1c')](_0x58c0a6);}return null;};}function patchUpdates(_0x1edc82){return function(_0x15e44b){try{jsonpatch[_0x3e21('0x22')](_0x15e44b,_0x1edc82,!![]);}catch(_0x109da9){return BPromise[_0x3e21('0x23')](_0x109da9);}return _0x15e44b[_0x3e21('0x24')]();};}function saveUpdates(_0x232fd7,_0x44d1d2){return function(_0x2d3c22){if(_0x2d3c22){return _0x2d3c22[_0x3e21('0x25')](_0x232fd7)[_0x3e21('0x26')](function(_0x337c65){return _0x337c65;});}return null;};}function removeEntity(_0x267987,_0x20ca57){return function(_0x2b5cdb){if(_0x2b5cdb){return _0x2b5cdb['destroy']()[_0x3e21('0x26')](function(){var _0x160dbc=_0x2b5cdb['get']({'plain':!![]});var _0x2155c2=_0x3e21('0x27');return db[_0x3e21('0x28')][_0x3e21('0x29')]({'where':{'type':_0x2155c2,'resourceId':_0x160dbc['id']}})[_0x3e21('0x26')](function(){return _0x2b5cdb;});})[_0x3e21('0x26')](function(){_0x267987[_0x3e21('0x1b')](0xcc)[_0x3e21('0x1a')]();});}};}function handleEntityNotFound(_0xcbc039,_0x3698c7){return function(_0x155e17){if(!_0x155e17){_0xcbc039[_0x3e21('0x2a')](0x194);}return _0x155e17;};}function handleError(_0x34ffd3,_0x2f76ce){_0x2f76ce=_0x2f76ce||0x1f4;return function(_0x542865){logger[_0x3e21('0x2b')](_0x542865[_0x3e21('0x2c')]);if(_0x542865['name']){delete _0x542865[_0x3e21('0x2d')];}_0x34ffd3[_0x3e21('0x1b')](_0x2f76ce)[_0x3e21('0x2e')](_0x542865);};}exports[_0x3e21('0x2f')]=function(_0x4b6069,_0x36a89b){var _0x26e206={},_0x4207ab={},_0x1251f0={'count':0x0,'rows':[]};var _0x3f01e2=_[_0x3e21('0x30')](db['VoiceMusicOnHold'][_0x3e21('0x31')],function(_0x36877f){return{'name':_0x36877f['fieldName'],'type':_0x36877f['type'][_0x3e21('0x32')]};});_0x4207ab[_0x3e21('0x33')]=_[_0x3e21('0x30')](_0x3f01e2,_0x3e21('0x2d'));_0x4207ab['query']=_[_0x3e21('0x34')](_0x4b6069['query']);_0x4207ab[_0x3e21('0x35')]=_[_0x3e21('0x36')](_0x4207ab[_0x3e21('0x33')],_0x4207ab[_0x3e21('0x37')]);_0x26e206[_0x3e21('0x38')]=_[_0x3e21('0x36')](_0x4207ab['model'],qs['fields'](_0x4b6069[_0x3e21('0x37')]['fields']));_0x26e206[_0x3e21('0x38')]=_0x26e206['attributes'][_0x3e21('0x39')]?_0x26e206[_0x3e21('0x38')]:_0x4207ab['model'];if(!_0x4b6069[_0x3e21('0x37')][_0x3e21('0x3a')](_0x3e21('0x3b'))){_0x26e206[_0x3e21('0x20')]=qs['limit'](_0x4b6069['query']['limit']);_0x26e206[_0x3e21('0x1f')]=qs[_0x3e21('0x1f')](_0x4b6069[_0x3e21('0x37')][_0x3e21('0x1f')]);}_0x26e206['order']=qs[_0x3e21('0x3c')](_0x4b6069[_0x3e21('0x37')][_0x3e21('0x3c')]);delete _0x4b6069['query'][_0x3e21('0x3c')];_0x26e206[_0x3e21('0x3d')]=qs[_0x3e21('0x35')](_['pick'](_0x4b6069['query'],_0x4207ab[_0x3e21('0x35')]),_0x3f01e2);if(_0x4b6069[_0x3e21('0x37')][_0x3e21('0x3e')]){_0x26e206[_0x3e21('0x3d')]=_['merge'](_0x26e206[_0x3e21('0x3d')],{'$or':_[_0x3e21('0x30')](_0x3f01e2,function(_0x5aacfa){if(_0x5aacfa[_0x3e21('0x3f')]!==_0x3e21('0x40')){var _0x4d0e8f={};_0x4d0e8f[_0x5aacfa[_0x3e21('0x2d')]]={'$like':'%'+_0x4b6069[_0x3e21('0x37')][_0x3e21('0x3e')]+'%'};return _0x4d0e8f;}})});}_0x26e206=_['merge']({},_0x26e206,_0x4b6069['options']);var _0x325ec7={'where':_0x26e206[_0x3e21('0x3d')]};return db[_0x3e21('0x41')][_0x3e21('0x1e')](_0x325ec7)[_0x3e21('0x26')](function(_0x15d33a){_0x1251f0[_0x3e21('0x1e')]=_0x15d33a;if(_0x4b6069[_0x3e21('0x37')][_0x3e21('0x42')]){_0x26e206['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x3e21('0x43')](_0x26e206);})[_0x3e21('0x26')](function(_0x363e5b){_0x1251f0[_0x3e21('0x44')]=_0x363e5b;return _0x1251f0;})[_0x3e21('0x26')](respondWithFilteredResult(_0x36a89b,_0x26e206))[_0x3e21('0x45')](handleError(_0x36a89b,null));};exports['show']=function(_0x12fa3b,_0x30b9a6){var _0x93c201={'raw':![],'where':{'id':_0x12fa3b['params']['id']}},_0x473cca={};_0x473cca[_0x3e21('0x33')]=_[_0x3e21('0x34')](db[_0x3e21('0x41')][_0x3e21('0x31')]);_0x473cca['query']=_[_0x3e21('0x34')](_0x12fa3b[_0x3e21('0x37')]);_0x473cca['filters']=_[_0x3e21('0x36')](_0x473cca['model'],_0x473cca['query']);_0x93c201[_0x3e21('0x38')]=_[_0x3e21('0x36')](_0x473cca[_0x3e21('0x33')],qs[_0x3e21('0x46')](_0x12fa3b[_0x3e21('0x37')][_0x3e21('0x46')]));_0x93c201[_0x3e21('0x38')]=_0x93c201[_0x3e21('0x38')][_0x3e21('0x39')]?_0x93c201[_0x3e21('0x38')]:_0x473cca[_0x3e21('0x33')];if(_0x12fa3b[_0x3e21('0x37')]['includeAll']){_0x93c201[_0x3e21('0x47')]=[{'all':!![]}];}_0x93c201=_[_0x3e21('0x48')]({},_0x93c201,_0x12fa3b['options']);return db[_0x3e21('0x41')]['find'](_0x93c201)[_0x3e21('0x26')](handleEntityNotFound(_0x30b9a6,null))[_0x3e21('0x26')](respondWithResult(_0x30b9a6,null))[_0x3e21('0x45')](handleError(_0x30b9a6,null));};exports[_0x3e21('0x25')]=function(_0x2ff4d8,_0x35be62){if(_0x2ff4d8[_0x3e21('0x49')]['id']){delete _0x2ff4d8[_0x3e21('0x49')]['id'];}return db['VoiceMusicOnHold'][_0x3e21('0x4a')]({'where':{'id':_0x2ff4d8[_0x3e21('0x4b')]['id']}})[_0x3e21('0x26')](handleEntityNotFound(_0x35be62,null))[_0x3e21('0x26')](saveUpdates(_0x2ff4d8['body'],null))['then'](respondWithResult(_0x35be62,null))[_0x3e21('0x45')](handleError(_0x35be62,null));};exports[_0x3e21('0x4c')]=function(_0x3ade6d,_0x2eab76,_0x5354b9){return db['sequelize'][_0x3e21('0x4d')](function(_0x10ca8a){if(_0x3ade6d[_0x3e21('0x49')][_0x3e21('0x4e')]===_0x3e21('0x4f')){_0x3ade6d[_0x3e21('0x49')][_0x3e21('0x50')]=path[_0x3e21('0x51')](config[_0x3e21('0x52')],_0x3e21('0x53'),_0x3ade6d['body'][_0x3e21('0x2d')]);}return db['VoiceMusicOnHold'][_0x3e21('0x4c')](_0x3ade6d['body'],{'transaction':_0x10ca8a})[_0x3e21('0x26')](function(_0x3dc1d6){if(_0x3ade6d[_0x3e21('0x49')][_0x3e21('0x4e')]==='files'){fs[_0x3e21('0x54')](_0x3dc1d6['directory'],parseInt(_0x3e21('0x55'),0x8));}var _0x18eb63=_0x3ade6d[_0x3e21('0x56')][_0x3e21('0x57')]({'plain':!![]});if(!_0x18eb63)throw new Error(_0x3e21('0x58'));if(_0x18eb63[_0x3e21('0x59')]===_0x3e21('0x56')){var _0x231a05=_0x3dc1d6[_0x3e21('0x57')]({'plain':!![]});return db[_0x3e21('0x5a')][_0x3e21('0x4a')]({'where':{'name':_0x3e21('0x27'),'userProfileId':_0x18eb63[_0x3e21('0x5b')]},'raw':!![]})[_0x3e21('0x26')](function(_0x18e38e){if(_0x18e38e&&_0x18e38e[_0x3e21('0x5c')]===0x0){return db[_0x3e21('0x28')]['create']({'name':_0x231a05[_0x3e21('0x2d')],'resourceId':_0x231a05['id'],'type':_0x18e38e[_0x3e21('0x2d')],'sectionId':_0x18e38e['id']},{})[_0x3e21('0x26')](function(){return _0x3dc1d6;});}else{return _0x3dc1d6;}})[_0x3e21('0x45')](function(_0x5e84c6){logger[_0x3e21('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e84c6);});}return _0x3dc1d6;});})[_0x3e21('0x26')](respondWithResult(_0x2eab76,0xc9))[_0x3e21('0x45')](handleError(_0x2eab76,null));};exports['destroy']=function(_0x441474,_0x36fed7,_0x43f4cd){var _0x43deaf;return db[_0x3e21('0x41')][_0x3e21('0x4a')]({'where':{'id':_0x441474[_0x3e21('0x4b')]['id']}})[_0x3e21('0x26')](function(_0x56b6d2){if(_0x56b6d2){return db['sequelize']['transaction'](function(_0x5a2cac){return _0x56b6d2[_0x3e21('0x29')]({'transaction':_0x5a2cac,'raw':!![]})[_0x3e21('0x26')](function(_0x520fdf){if(_0x520fdf[_0x3e21('0x50')]){fs['readdirSync'](_0x520fdf[_0x3e21('0x50')])['forEach'](function(_0x41b361){fs[_0x3e21('0x5d')](path[_0x3e21('0x51')](_0x520fdf[_0x3e21('0x50')],_0x41b361));});fs['rmdirSync'](_0x520fdf[_0x3e21('0x50')]);}return _0x520fdf;});})[_0x3e21('0x45')](function(_0x222713){throw new db[(_0x3e21('0x5e'))][(_0x3e21('0x5f'))](_0x222713['message']);});}})[_0x3e21('0x26')](handleEntityNotFound(_0x36fed7,null))['then'](removeEntity(_0x36fed7,null))[_0x3e21('0x45')](handleError(_0x36fed7,null));};exports[_0x3e21('0x60')]=function(_0x3ed997,_0x51ce96,_0x46b7df){return db[_0x3e21('0x61')]['transaction'](function(_0x38372c){var _0xc9512d;return db[_0x3e21('0x41')][_0x3e21('0x4a')]({'where':{'id':_0x3ed997[_0x3e21('0x4b')]['id']}})[_0x3e21('0x26')](function(_0x2c1d58){if(_0x2c1d58){_0xc9512d=_0x2c1d58;return _0x2c1d58['addSound'](_0x3ed997[_0x3e21('0x49')]['id'],{'transaction':_0x38372c});}})[_0x3e21('0x26')](function(_0x8189c5){if(_0x8189c5){return db[_0x3e21('0x62')][_0x3e21('0x63')]({'where':{'id':_0x3ed997[_0x3e21('0x49')]['id']},'attributes':['id','name',_0x3e21('0x64'),'converted_format',_0x3e21('0x65')],'raw':!![]});}})[_0x3e21('0x26')](function(_0x34dd55){if(_0x34dd55){var _0x5c0bbd=path['join'](config[_0x3e21('0x52')],_0x3e21('0x66'),util[_0x3e21('0x67')](_0x3e21('0x68'),path[_0x3e21('0x69')](_0x34dd55[_0x3e21('0x64')],path['extname'](_0x34dd55[_0x3e21('0x64')])),_0x34dd55[_0x3e21('0x6a')]));var _0x357ea5=path['join'](config[_0x3e21('0x52')],'server/files/moh',_0xc9512d['name'],util['format']('%s.%s',_0x34dd55[_0x3e21('0x2d')],_0x34dd55['converted_format']));fs[_0x3e21('0x6b')](_0x5c0bbd,_0x357ea5);return _0x34dd55;}})[_0x3e21('0x45')](function(_0x23be08){throw new db[(_0x3e21('0x5e'))][(_0x3e21('0x5f'))](_0x23be08[_0x3e21('0x6c')]);});})[_0x3e21('0x26')](handleEntityNotFound(_0x51ce96,null))[_0x3e21('0x26')](respondWithResult(_0x51ce96,0xc9))[_0x3e21('0x45')](handleError(_0x51ce96,null));};exports[_0x3e21('0x6d')]=function(_0x357cc2,_0x326935,_0x40397d){return db[_0x3e21('0x61')]['transaction'](function(_0x2f19bb){var _0x1e5c12;return db[_0x3e21('0x41')][_0x3e21('0x63')]({'where':{'id':_0x357cc2[_0x3e21('0x4b')]['id']}})[_0x3e21('0x26')](handleEntityNotFound(_0x326935,null))[_0x3e21('0x26')](function(_0x36aa9d){if(_0x36aa9d){_0x1e5c12=_0x36aa9d;return _0x36aa9d[_0x3e21('0x6d')](_0x357cc2['params'][_0x3e21('0x6e')]);}})[_0x3e21('0x26')](function(_0x37569a){if(_0x37569a){return db[_0x3e21('0x62')][_0x3e21('0x63')]({'where':{'id':_0x357cc2['params'][_0x3e21('0x6e')]},'attributes':['id',_0x3e21('0x2d'),_0x3e21('0x64'),_0x3e21('0x6a'),_0x3e21('0x65')],'raw':!![]});}})[_0x3e21('0x26')](function(_0x2d78ef){if(_0x2d78ef){fs[_0x3e21('0x5d')](path[_0x3e21('0x51')](_0x1e5c12[_0x3e21('0x50')],util[_0x3e21('0x67')]('%s.%s',_0x2d78ef[_0x3e21('0x2d')],_0x2d78ef[_0x3e21('0x6a')])));return _0x2d78ef;}})[_0x3e21('0x45')](function(_0x44d926){throw new db[(_0x3e21('0x5e'))][(_0x3e21('0x5f'))](_0x44d926[_0x3e21('0x6c')]);});})['then'](handleEntityNotFound(_0x326935,null))[_0x3e21('0x26')](respondWithStatusCode(_0x326935,0xcc))[_0x3e21('0x45')](handleError(_0x326935,null));};exports['getSounds']=function(_0x510dae,_0x1c9a0b,_0xc17a21){var _0x526305={};var _0x5aea43={};var _0x2ad643;var _0x5f19a8;return db[_0x3e21('0x41')]['findOne']({'where':{'id':_0x510dae[_0x3e21('0x4b')]['id']}})[_0x3e21('0x26')](handleEntityNotFound(_0x1c9a0b,null))[_0x3e21('0x26')](function(_0x363144){if(_0x363144){_0x2ad643=_0x363144;_0x5aea43[_0x3e21('0x33')]=_[_0x3e21('0x34')](db[_0x3e21('0x62')][_0x3e21('0x31')]);_0x5aea43['query']=_[_0x3e21('0x34')](_0x510dae[_0x3e21('0x37')]);_0x5aea43[_0x3e21('0x35')]=_[_0x3e21('0x36')](_0x5aea43[_0x3e21('0x33')],_0x5aea43[_0x3e21('0x37')]);_0x526305[_0x3e21('0x38')]=_[_0x3e21('0x36')](_0x5aea43[_0x3e21('0x33')],qs[_0x3e21('0x46')](_0x510dae['query'][_0x3e21('0x46')]));_0x526305[_0x3e21('0x38')]=_0x526305[_0x3e21('0x38')][_0x3e21('0x39')]?_0x526305[_0x3e21('0x38')]:_0x5aea43[_0x3e21('0x33')];_0x526305[_0x3e21('0x6f')]=qs[_0x3e21('0x3c')](_0x510dae[_0x3e21('0x37')]['sort']);_0x526305[_0x3e21('0x3d')]=qs[_0x3e21('0x35')](_[_0x3e21('0x70')](_0x510dae[_0x3e21('0x37')],_0x5aea43[_0x3e21('0x35')]));if(_0x510dae['query'][_0x3e21('0x3e')]){_0x526305['where']=_[_0x3e21('0x48')](_0x526305[_0x3e21('0x3d')],{'$or':_[_0x3e21('0x30')](_0x526305['attributes'],function(_0x533da1){var _0x56a46a={};_0x56a46a[_0x533da1]={'$like':'%'+_0x510dae[_0x3e21('0x37')][_0x3e21('0x3e')]+'%'};return _0x56a46a;})});}_0x526305=_[_0x3e21('0x48')]({},_0x526305,_0x510dae[_0x3e21('0x71')]);return _0x2ad643[_0x3e21('0x72')](_0x526305);}})[_0x3e21('0x26')](function(_0x16c1cc){if(_0x16c1cc){_0x5f19a8=_0x16c1cc[_0x3e21('0x39')];if(!_0x510dae[_0x3e21('0x37')][_0x3e21('0x3a')](_0x3e21('0x3b'))){_0x526305[_0x3e21('0x20')]=qs[_0x3e21('0x20')](_0x510dae[_0x3e21('0x37')][_0x3e21('0x20')]);_0x526305[_0x3e21('0x1f')]=qs[_0x3e21('0x1f')](_0x510dae[_0x3e21('0x37')][_0x3e21('0x1f')]);}return _0x2ad643['getSounds'](_0x526305);}})[_0x3e21('0x26')](function(_0x2941d4){if(_0x2941d4){return _0x2941d4?{'count':_0x5f19a8,'rows':_0x2941d4}:null;}})['then'](respondWithResult(_0x1c9a0b,null))[_0x3e21('0x45')](handleError(_0x1c9a0b,null));}; \ No newline at end of file +var _0x196f=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','index','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','findOne','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0xd2dc39,_0x5e77f7){var _0x4429a8=function(_0x75955f){while(--_0x75955f){_0xd2dc39['push'](_0xd2dc39['shift']());}};_0x4429a8(++_0x5e77f7);}(_0x196f,0x159));var _0xf196=function(_0x2bf44b,_0x369d15){_0x2bf44b=_0x2bf44b-0x0;var _0x1da5c3=_0x196f[_0x2bf44b];return _0x1da5c3;};'use strict';var emlformat=require(_0xf196('0x0'));var rimraf=require(_0xf196('0x1'));var zipdir=require(_0xf196('0x2'));var jsonpatch=require(_0xf196('0x3'));var rp=require(_0xf196('0x4'));var moment=require(_0xf196('0x5'));var BPromise=require(_0xf196('0x6'));var Mustache=require(_0xf196('0x7'));var util=require(_0xf196('0x8'));var path=require(_0xf196('0x9'));var sox=require(_0xf196('0xa'));var csv=require(_0xf196('0xb'));var ejs=require(_0xf196('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf196('0xd'));var squel=require('squel');var crypto=require(_0xf196('0xe'));var jsforce=require(_0xf196('0xf'));var deskjs=require(_0xf196('0x10'));var toCsv=require(_0xf196('0xb'));var querystring=require(_0xf196('0x11'));var Papa=require('papaparse');var Redis=require(_0xf196('0x12'));var authService=require(_0xf196('0x13'));var qs=require(_0xf196('0x14'));var as=require(_0xf196('0x15'));var hardwareService=require(_0xf196('0x16'));var logger=require(_0xf196('0x17'))(_0xf196('0x18'));var utils=require('../../config/utils');var config=require(_0xf196('0x19'));var licenseUtil=require(_0xf196('0x1a'));var db=require(_0xf196('0x1b'))['db'];function respondWithStatusCode(_0x24fd81,_0x519a3d){_0x519a3d=_0x519a3d||0xcc;return function(_0x3e43d7){if(_0x3e43d7){return _0x24fd81[_0xf196('0x1c')](_0x519a3d);}return _0x24fd81[_0xf196('0x1d')](_0x519a3d)[_0xf196('0x1e')]();};}function respondWithResult(_0x753bca,_0x217fdb){_0x217fdb=_0x217fdb||0xc8;return function(_0x4be3d2){if(_0x4be3d2){return _0x753bca[_0xf196('0x1d')](_0x217fdb)[_0xf196('0x1f')](_0x4be3d2);}};}function respondWithFilteredResult(_0x1a7ebb,_0x1e1ef4){return function(_0x1a18b9){if(_0x1a18b9){var _0x25ac5e=typeof _0x1e1ef4[_0xf196('0x20')]===_0xf196('0x21')&&typeof _0x1e1ef4['limit']===_0xf196('0x21');var _0x316fe1=_0x1a18b9['count'];var _0x4140ba=_0x25ac5e?0x0:_0x1e1ef4[_0xf196('0x20')];var _0x39cb8f=_0x25ac5e?_0x1a18b9[_0xf196('0x22')]:_0x1e1ef4[_0xf196('0x20')]+_0x1e1ef4[_0xf196('0x23')];var _0x46b867;if(_0x39cb8f>=_0x316fe1){_0x39cb8f=_0x316fe1;_0x46b867=0xc8;}else{_0x46b867=0xce;}_0x1a7ebb['status'](_0x46b867);return _0x1a7ebb[_0xf196('0x24')]('Content-Range',_0x4140ba+'-'+_0x39cb8f+'/'+_0x316fe1)[_0xf196('0x1f')](_0x1a18b9);}return null;};}function patchUpdates(_0x118ab8){return function(_0x28fc90){try{jsonpatch[_0xf196('0x25')](_0x28fc90,_0x118ab8,!![]);}catch(_0x1bd0b6){return BPromise[_0xf196('0x26')](_0x1bd0b6);}return _0x28fc90[_0xf196('0x27')]();};}function saveUpdates(_0x36a64c,_0x5f46f9){return function(_0x222c26){if(_0x222c26){return _0x222c26[_0xf196('0x28')](_0x36a64c)[_0xf196('0x29')](function(_0x319177){return _0x319177;});}return null;};}function removeEntity(_0x2376ab,_0x36b8b0){return function(_0x37cca8){if(_0x37cca8){return _0x37cca8[_0xf196('0x2a')]()[_0xf196('0x29')](function(){var _0x266b67=_0x37cca8[_0xf196('0x2b')]({'plain':!![]});var _0x9560c2=_0xf196('0x2c');return db[_0xf196('0x2d')][_0xf196('0x2a')]({'where':{'type':_0x9560c2,'resourceId':_0x266b67['id']}})[_0xf196('0x29')](function(){return _0x37cca8;});})[_0xf196('0x29')](function(){_0x2376ab[_0xf196('0x1d')](0xcc)[_0xf196('0x1e')]();});}};}function handleEntityNotFound(_0x240080,_0x4e4d13){return function(_0x556ca6){if(!_0x556ca6){_0x240080[_0xf196('0x1c')](0x194);}return _0x556ca6;};}function handleError(_0x329b02,_0x3e7464){_0x3e7464=_0x3e7464||0x1f4;return function(_0x1a0df0){logger[_0xf196('0x2e')](_0x1a0df0[_0xf196('0x2f')]);if(_0x1a0df0[_0xf196('0x30')]){delete _0x1a0df0[_0xf196('0x30')];}_0x329b02['status'](_0x3e7464)['send'](_0x1a0df0);};}exports[_0xf196('0x31')]=function(_0x7ae428,_0x5e7b2d){var _0x23bc7f={},_0x45863a={},_0x484264={'count':0x0,'rows':[]};var _0x2c9fbb=_['map'](db['VoiceMusicOnHold']['rawAttributes'],function(_0x3330ab){return{'name':_0x3330ab[_0xf196('0x32')],'type':_0x3330ab[_0xf196('0x33')][_0xf196('0x34')]};});_0x45863a[_0xf196('0x35')]=_['map'](_0x2c9fbb,_0xf196('0x30'));_0x45863a['query']=_[_0xf196('0x36')](_0x7ae428[_0xf196('0x37')]);_0x45863a[_0xf196('0x38')]=_[_0xf196('0x39')](_0x45863a['model'],_0x45863a[_0xf196('0x37')]);_0x23bc7f[_0xf196('0x3a')]=_[_0xf196('0x39')](_0x45863a[_0xf196('0x35')],qs[_0xf196('0x3b')](_0x7ae428[_0xf196('0x37')]['fields']));_0x23bc7f[_0xf196('0x3a')]=_0x23bc7f[_0xf196('0x3a')][_0xf196('0x3c')]?_0x23bc7f[_0xf196('0x3a')]:_0x45863a[_0xf196('0x35')];if(!_0x7ae428[_0xf196('0x37')][_0xf196('0x3d')](_0xf196('0x3e'))){_0x23bc7f[_0xf196('0x23')]=qs['limit'](_0x7ae428[_0xf196('0x37')][_0xf196('0x23')]);_0x23bc7f[_0xf196('0x20')]=qs['offset'](_0x7ae428['query'][_0xf196('0x20')]);}_0x23bc7f[_0xf196('0x3f')]=qs['sort'](_0x7ae428['query'][_0xf196('0x40')]);delete _0x7ae428['query'][_0xf196('0x40')];_0x23bc7f[_0xf196('0x41')]=qs[_0xf196('0x38')](_[_0xf196('0x42')](_0x7ae428[_0xf196('0x37')],_0x45863a[_0xf196('0x38')]),_0x2c9fbb);if(_0x7ae428[_0xf196('0x37')]['filter']){_0x23bc7f[_0xf196('0x41')]=_[_0xf196('0x43')](_0x23bc7f[_0xf196('0x41')],{'$or':_[_0xf196('0x44')](_0x2c9fbb,function(_0x4414ec){if(_0x4414ec[_0xf196('0x33')]!==_0xf196('0x45')){var _0x11809f={};_0x11809f[_0x4414ec[_0xf196('0x30')]]={'$like':'%'+_0x7ae428[_0xf196('0x37')][_0xf196('0x46')]+'%'};return _0x11809f;}})});}_0x23bc7f=_['merge']({},_0x23bc7f,_0x7ae428[_0xf196('0x47')]);var _0x3eaf34={'where':_0x23bc7f[_0xf196('0x41')]};return db[_0xf196('0x48')][_0xf196('0x22')](_0x3eaf34)[_0xf196('0x29')](function(_0x7e6126){_0x484264[_0xf196('0x22')]=_0x7e6126;if(_0x7ae428['query'][_0xf196('0x49')]){_0x23bc7f[_0xf196('0x4a')]=[{'all':!![]}];}return db[_0xf196('0x48')][_0xf196('0x4b')](_0x23bc7f);})[_0xf196('0x29')](function(_0x359ffb){_0x484264[_0xf196('0x4c')]=_0x359ffb;return _0x484264;})['then'](respondWithFilteredResult(_0x5e7b2d,_0x23bc7f))[_0xf196('0x4d')](handleError(_0x5e7b2d,null));};exports[_0xf196('0x4e')]=function(_0x47a48b,_0x37cc1c){var _0x943474={'raw':![],'where':{'id':_0x47a48b[_0xf196('0x4f')]['id']}},_0x529969={};_0x529969[_0xf196('0x35')]=_[_0xf196('0x36')](db[_0xf196('0x48')][_0xf196('0x50')]);_0x529969[_0xf196('0x37')]=_[_0xf196('0x36')](_0x47a48b[_0xf196('0x37')]);_0x529969[_0xf196('0x38')]=_[_0xf196('0x39')](_0x529969[_0xf196('0x35')],_0x529969['query']);_0x943474['attributes']=_[_0xf196('0x39')](_0x529969[_0xf196('0x35')],qs[_0xf196('0x3b')](_0x47a48b[_0xf196('0x37')]['fields']));_0x943474[_0xf196('0x3a')]=_0x943474[_0xf196('0x3a')]['length']?_0x943474['attributes']:_0x529969['model'];if(_0x47a48b[_0xf196('0x37')][_0xf196('0x49')]){_0x943474[_0xf196('0x4a')]=[{'all':!![]}];}_0x943474=_[_0xf196('0x43')]({},_0x943474,_0x47a48b['options']);return db[_0xf196('0x48')][_0xf196('0x51')](_0x943474)['then'](handleEntityNotFound(_0x37cc1c,null))[_0xf196('0x29')](respondWithResult(_0x37cc1c,null))[_0xf196('0x4d')](handleError(_0x37cc1c,null));};exports[_0xf196('0x28')]=function(_0x3649f4,_0x46f369){if(_0x3649f4[_0xf196('0x52')]['id']){delete _0x3649f4['body']['id'];}return db[_0xf196('0x48')]['find']({'where':{'id':_0x3649f4[_0xf196('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46f369,null))[_0xf196('0x29')](saveUpdates(_0x3649f4['body'],null))[_0xf196('0x29')](respondWithResult(_0x46f369,null))['catch'](handleError(_0x46f369,null));};exports[_0xf196('0x53')]=function(_0x49cb43,_0x392ecb,_0x5328a0){return db['sequelize'][_0xf196('0x54')](function(_0x5cafb2){if(_0x49cb43[_0xf196('0x52')]['mode']===_0xf196('0x55')){_0x49cb43[_0xf196('0x52')][_0xf196('0x56')]=path[_0xf196('0x57')](config[_0xf196('0x58')],_0xf196('0x59'),_0x49cb43['body'][_0xf196('0x30')]);}return db['VoiceMusicOnHold'][_0xf196('0x53')](_0x49cb43['body'],{'transaction':_0x5cafb2})[_0xf196('0x29')](function(_0x207aed){if(_0x49cb43[_0xf196('0x52')][_0xf196('0x5a')]===_0xf196('0x55')){fs[_0xf196('0x5b')](_0x207aed['directory'],parseInt(_0xf196('0x5c'),0x8));}var _0xc92784=_0x49cb43[_0xf196('0x5d')][_0xf196('0x2b')]({'plain':!![]});if(!_0xc92784)throw new Error(_0xf196('0x5e'));if(_0xc92784[_0xf196('0x5f')]===_0xf196('0x5d')){var _0x47a1a2=_0x207aed[_0xf196('0x2b')]({'plain':!![]});return db[_0xf196('0x60')][_0xf196('0x51')]({'where':{'name':'MusicOnHolds','userProfileId':_0xc92784[_0xf196('0x61')]},'raw':!![]})['then'](function(_0x5e5a28){if(_0x5e5a28&&_0x5e5a28['autoAssociation']===0x0){return db[_0xf196('0x2d')][_0xf196('0x53')]({'name':_0x47a1a2[_0xf196('0x30')],'resourceId':_0x47a1a2['id'],'type':_0x5e5a28['name'],'sectionId':_0x5e5a28['id']},{})['then'](function(){return _0x207aed;});}else{return _0x207aed;}})[_0xf196('0x4d')](function(_0x3b8dec){logger[_0xf196('0x2e')](_0xf196('0x62'),_0x3b8dec);});}return _0x207aed;});})['then'](respondWithResult(_0x392ecb,0xc9))[_0xf196('0x4d')](handleError(_0x392ecb,null));};exports['destroy']=function(_0x283427,_0x5a94d0,_0x5b06c4){var _0x48435c;return db['VoiceMusicOnHold'][_0xf196('0x51')]({'where':{'id':_0x283427[_0xf196('0x4f')]['id']}})['then'](function(_0x5ec253){if(_0x5ec253){return db[_0xf196('0x63')][_0xf196('0x54')](function(_0x57ea62){return _0x5ec253[_0xf196('0x2a')]({'transaction':_0x57ea62,'raw':!![]})[_0xf196('0x29')](function(_0x3ea001){if(_0x3ea001[_0xf196('0x56')]){fs[_0xf196('0x64')](_0x3ea001[_0xf196('0x56')])[_0xf196('0x65')](function(_0x12ab8c){fs[_0xf196('0x66')](path[_0xf196('0x57')](_0x3ea001[_0xf196('0x56')],_0x12ab8c));});fs[_0xf196('0x67')](_0x3ea001[_0xf196('0x56')]);}return _0x3ea001;});})[_0xf196('0x4d')](function(_0x404566){throw new db[(_0xf196('0x68'))][(_0xf196('0x69'))](_0x404566[_0xf196('0x6a')]);});}})[_0xf196('0x29')](handleEntityNotFound(_0x5a94d0,null))[_0xf196('0x29')](removeEntity(_0x5a94d0,null))['catch'](handleError(_0x5a94d0,null));};exports[_0xf196('0x6b')]=function(_0x4a280b,_0x1eb396,_0x3ac0ac){return db[_0xf196('0x63')][_0xf196('0x54')](function(_0x42dfd7){var _0x33f03f;return db[_0xf196('0x48')][_0xf196('0x51')]({'where':{'id':_0x4a280b[_0xf196('0x4f')]['id']}})[_0xf196('0x29')](function(_0x37f5a1){if(_0x37f5a1){_0x33f03f=_0x37f5a1;return _0x37f5a1[_0xf196('0x6b')](_0x4a280b['body']['id'],{'transaction':_0x42dfd7});}})[_0xf196('0x29')](function(_0x2c9dc3){if(_0x2c9dc3){return db[_0xf196('0x6c')]['findOne']({'where':{'id':_0x4a280b[_0xf196('0x52')]['id']},'attributes':['id',_0xf196('0x30'),'save_name',_0xf196('0x6d'),_0xf196('0x6e')],'raw':!![]});}})[_0xf196('0x29')](function(_0x1f0676){if(_0x1f0676){var _0x5ed9ad=path[_0xf196('0x57')](config[_0xf196('0x58')],_0xf196('0x6f'),util[_0xf196('0x70')](_0xf196('0x71'),path['basename'](_0x1f0676['save_name'],path[_0xf196('0x72')](_0x1f0676[_0xf196('0x73')])),_0x1f0676['converted_format']));var _0x2fd47b=path['join'](config[_0xf196('0x58')],'server/files/moh',_0x33f03f[_0xf196('0x30')],util[_0xf196('0x70')]('%s.%s',_0x1f0676[_0xf196('0x30')],_0x1f0676[_0xf196('0x6d')]));fs[_0xf196('0x74')](_0x5ed9ad,_0x2fd47b);return _0x1f0676;}})[_0xf196('0x4d')](function(_0x1905dc){throw new db[(_0xf196('0x68'))][(_0xf196('0x69'))](_0x1905dc[_0xf196('0x6a')]);});})[_0xf196('0x29')](handleEntityNotFound(_0x1eb396,null))[_0xf196('0x29')](respondWithResult(_0x1eb396,0xc9))['catch'](handleError(_0x1eb396,null));};exports['removeSound']=function(_0x4fa9ff,_0x2a81ee,_0x4b2e30){return db['sequelize'][_0xf196('0x54')](function(_0x3571f9){var _0x3da0c7;return db[_0xf196('0x48')][_0xf196('0x75')]({'where':{'id':_0x4fa9ff[_0xf196('0x4f')]['id']}})[_0xf196('0x29')](handleEntityNotFound(_0x2a81ee,null))[_0xf196('0x29')](function(_0x1ae2ec){if(_0x1ae2ec){_0x3da0c7=_0x1ae2ec;return _0x1ae2ec['removeSound'](_0x4fa9ff[_0xf196('0x4f')]['id2']);}})[_0xf196('0x29')](function(_0x38042f){if(_0x38042f){return db[_0xf196('0x6c')]['findOne']({'where':{'id':_0x4fa9ff[_0xf196('0x4f')][_0xf196('0x76')]},'attributes':['id',_0xf196('0x30'),_0xf196('0x73'),_0xf196('0x6d'),_0xf196('0x6e')],'raw':!![]});}})['then'](function(_0x38dc33){if(_0x38dc33){fs['unlinkSync'](path[_0xf196('0x57')](_0x3da0c7[_0xf196('0x56')],util['format'](_0xf196('0x71'),_0x38dc33[_0xf196('0x30')],_0x38dc33[_0xf196('0x6d')])));return _0x38dc33;}})[_0xf196('0x4d')](function(_0x3bc997){throw new db[(_0xf196('0x68'))][(_0xf196('0x69'))](_0x3bc997[_0xf196('0x6a')]);});})[_0xf196('0x29')](handleEntityNotFound(_0x2a81ee,null))['then'](respondWithStatusCode(_0x2a81ee,0xcc))[_0xf196('0x4d')](handleError(_0x2a81ee,null));};exports['getSounds']=function(_0x46ed62,_0x110b37,_0x2d8f9c){var _0x36c836={};var _0x293e6d={};var _0x4ddb50;var _0x2694f8;return db[_0xf196('0x48')][_0xf196('0x75')]({'where':{'id':_0x46ed62['params']['id']}})[_0xf196('0x29')](handleEntityNotFound(_0x110b37,null))['then'](function(_0x98b355){if(_0x98b355){_0x4ddb50=_0x98b355;_0x293e6d[_0xf196('0x35')]=_[_0xf196('0x36')](db[_0xf196('0x6c')]['rawAttributes']);_0x293e6d['query']=_[_0xf196('0x36')](_0x46ed62[_0xf196('0x37')]);_0x293e6d['filters']=_[_0xf196('0x39')](_0x293e6d[_0xf196('0x35')],_0x293e6d[_0xf196('0x37')]);_0x36c836['attributes']=_[_0xf196('0x39')](_0x293e6d[_0xf196('0x35')],qs[_0xf196('0x3b')](_0x46ed62['query'][_0xf196('0x3b')]));_0x36c836[_0xf196('0x3a')]=_0x36c836[_0xf196('0x3a')]['length']?_0x36c836[_0xf196('0x3a')]:_0x293e6d[_0xf196('0x35')];_0x36c836[_0xf196('0x3f')]=qs[_0xf196('0x40')](_0x46ed62['query'][_0xf196('0x40')]);_0x36c836[_0xf196('0x41')]=qs[_0xf196('0x38')](_[_0xf196('0x42')](_0x46ed62['query'],_0x293e6d[_0xf196('0x38')]));if(_0x46ed62['query']['filter']){_0x36c836[_0xf196('0x41')]=_['merge'](_0x36c836[_0xf196('0x41')],{'$or':_[_0xf196('0x44')](_0x36c836['attributes'],function(_0x23bee9){var _0x178cf2={};_0x178cf2[_0x23bee9]={'$like':'%'+_0x46ed62[_0xf196('0x37')][_0xf196('0x46')]+'%'};return _0x178cf2;})});}_0x36c836=_['merge']({},_0x36c836,_0x46ed62[_0xf196('0x47')]);return _0x4ddb50[_0xf196('0x77')](_0x36c836);}})[_0xf196('0x29')](function(_0x5d8fc0){if(_0x5d8fc0){_0x2694f8=_0x5d8fc0[_0xf196('0x3c')];if(!_0x46ed62[_0xf196('0x37')]['hasOwnProperty'](_0xf196('0x3e'))){_0x36c836['limit']=qs['limit'](_0x46ed62[_0xf196('0x37')][_0xf196('0x23')]);_0x36c836[_0xf196('0x20')]=qs[_0xf196('0x20')](_0x46ed62[_0xf196('0x37')][_0xf196('0x20')]);}return _0x4ddb50[_0xf196('0x77')](_0x36c836);}})[_0xf196('0x29')](function(_0x117f9e){if(_0x117f9e){return _0x117f9e?{'count':_0x2694f8,'rows':_0x117f9e}:null;}})[_0xf196('0x29')](respondWithResult(_0x110b37,null))[_0xf196('0x4d')](handleError(_0x110b37,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 085729c..5396786 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0829=['../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1da020,_0x362b6c){var _0x204b2c=function(_0x4bbdb4){while(--_0x4bbdb4){_0x1da020['push'](_0x1da020['shift']());}};_0x204b2c(++_0x362b6c);}(_0x0829,0x7a));var _0x9082=function(_0x2a61a2,_0x21da26){_0x2a61a2=_0x2a61a2-0x0;var _0x1d27eb=_0x0829[_0x2a61a2];return _0x1d27eb;};'use strict';var _=require(_0x9082('0x0'));var util=require(_0x9082('0x1'));var logger=require(_0x9082('0x2'))('api');var moment=require(_0x9082('0x3'));var BPromise=require(_0x9082('0x4'));var rp=require(_0x9082('0x5'));var fs=require('fs');var path=require(_0x9082('0x6'));var rimraf=require(_0x9082('0x7'));var config=require(_0x9082('0x8'));var attributes=require(_0x9082('0x9'));module['exports']=function(_0x36a8d1,_0x543346){return _0x36a8d1[_0x9082('0xa')](_0x9082('0xb'),attributes,{'tableName':_0x9082('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b3b=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util','../../config/logger','api','moment'];(function(_0x182ac4,_0x1c105d){var _0xbeda58=function(_0x37474e){while(--_0x37474e){_0x182ac4['push'](_0x182ac4['shift']());}};_0xbeda58(++_0x1c105d);}(_0x2b3b,0x11a));var _0xb2b3=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x2b3b[_0x163040];return _0x364667;};'use strict';var _=require('lodash');var util=require(_0xb2b3('0x0'));var logger=require(_0xb2b3('0x1'))(_0xb2b3('0x2'));var moment=require(_0xb2b3('0x3'));var BPromise=require(_0xb2b3('0x4'));var rp=require(_0xb2b3('0x5'));var fs=require('fs');var path=require(_0xb2b3('0x6'));var rimraf=require(_0xb2b3('0x7'));var config=require(_0xb2b3('0x8'));var attributes=require(_0xb2b3('0x9'));module[_0xb2b3('0xa')]=function(_0x33388f,_0x496585){return _0x33388f[_0xb2b3('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0xb2b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index f374c54..ec4e203 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x38869d,_0x4fc053){var _0x3a8bac=function(_0x1c8159){while(--_0x1c8159){_0x38869d['push'](_0x38869d['shift']());}};_0x3a8bac(++_0x4fc053);}(_0xe706,0xa3));var _0x6e70=function(_0x2a2e72,_0x1de962){_0x2a2e72=_0x2a2e72-0x0;var _0x3cfb4a=_0xe706[_0x2a2e72];return _0x3cfb4a;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1464fa,_0xd96b2){var _0x47652d=function(_0x10852a){while(--_0x10852a){_0x1464fa['push'](_0x1464fa['shift']());}};_0x47652d(++_0xd96b2);}(_0x34e8,0x12c));var _0x834e=function(_0x35a0d5,_0xbf906e){_0x35a0d5=_0x35a0d5-0x0;var _0x25d5ea=_0x34e8[_0x35a0d5];return _0x25d5ea;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c225eef..45bd6ca 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3663=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','isAuthenticated','describe','show','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','put','update','delete','/:id','removeAgents','exports','multer','util','path','express','Router'];(function(_0x904c45,_0x2cba2e){var _0x4cb3ea=function(_0x36c65f){while(--_0x36c65f){_0x904c45['push'](_0x904c45['shift']());}};_0x4cb3ea(++_0x2cba2e);}(_0x3663,0x1cf));var _0x3366=function(_0x10b1bb,_0x2a5815){_0x10b1bb=_0x10b1bb-0x0;var _0x2d4e05=_0x3663[_0x10b1bb];return _0x2d4e05;};'use strict';var multer=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var path=require(_0x3366('0x2'));var timeout=require('connect-timeout');var express=require(_0x3366('0x3'));var router=express[_0x3366('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3366('0x5'));var interaction=require(_0x3366('0x6'));var config=require(_0x3366('0x7'));var controller=require(_0x3366('0x8'));router[_0x3366('0x9')]('/',auth['isAuthenticated'](),controller[_0x3366('0xa')]);router[_0x3366('0x9')]('/describe',auth[_0x3366('0xb')](),controller[_0x3366('0xc')]);router[_0x3366('0x9')]('/:id',auth[_0x3366('0xb')](),controller[_0x3366('0xd')]);router[_0x3366('0x9')]('/:id/users',auth[_0x3366('0xb')](),controller[_0x3366('0xe')]);router[_0x3366('0x9')](_0x3366('0xf'),auth[_0x3366('0xb')](),controller[_0x3366('0x10')]);router[_0x3366('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3366('0x11')](_0x3366('0x12'),auth[_0x3366('0xb')](),controller[_0x3366('0x13')]);router[_0x3366('0x11')](_0x3366('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3366('0x14')]('/:id',auth[_0x3366('0xb')](),controller[_0x3366('0x15')]);router[_0x3366('0x16')](_0x3366('0x17'),auth[_0x3366('0xb')](),controller['destroy']);router[_0x3366('0x16')](_0x3366('0x12'),auth[_0x3366('0xb')](),controller[_0x3366('0x18')]);router[_0x3366('0x16')](_0x3366('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x3366('0x19')]=router; \ No newline at end of file +var _0x6e6f=['update','delete','destroy','/:id/users','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getAgents','/:id/teams','getTeams','post','addAgents','addTeams'];(function(_0x566854,_0x38922a){var _0x3b3476=function(_0x3fce6e){while(--_0x3fce6e){_0x566854['push'](_0x566854['shift']());}};_0x3b3476(++_0x38922a);}(_0x6e6f,0x76));var _0xf6e6=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0x6e6f[_0x27a3cb];return _0x54ff38;};'use strict';var multer=require('multer');var util=require(_0xf6e6('0x0'));var path=require(_0xf6e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6e6('0x2'));var router=express[_0xf6e6('0x3')]();var fs_extra=require(_0xf6e6('0x4'));var auth=require(_0xf6e6('0x5'));var interaction=require(_0xf6e6('0x6'));var config=require(_0xf6e6('0x7'));var controller=require(_0xf6e6('0x8'));router['get']('/',auth[_0xf6e6('0x9')](),controller[_0xf6e6('0xa')]);router[_0xf6e6('0xb')](_0xf6e6('0xc'),auth[_0xf6e6('0x9')](),controller[_0xf6e6('0xd')]);router[_0xf6e6('0xb')](_0xf6e6('0xe'),auth['isAuthenticated'](),controller[_0xf6e6('0xf')]);router[_0xf6e6('0xb')]('/:id/users',auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x10')]);router[_0xf6e6('0xb')](_0xf6e6('0x11'),auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x12')]);router['post']('/',auth[_0xf6e6('0x9')](),controller['create']);router[_0xf6e6('0x13')]('/:id/users',auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x14')]);router[_0xf6e6('0x13')](_0xf6e6('0x11'),auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x15')]);router['put']('/:id',auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x16')]);router[_0xf6e6('0x17')](_0xf6e6('0xe'),auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x18')]);router[_0xf6e6('0x17')](_0xf6e6('0x19'),auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x1a')]);router[_0xf6e6('0x17')](_0xf6e6('0x11'),auth[_0xf6e6('0x9')](),controller['removeTeams']);module[_0xf6e6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 2a2bc0c..e10e6fc 100644 --- a/server/api/voicePrefix/voicePrefix.attributes.js +++ b/server/api/voicePrefix/voicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44bb=['name','getDataValue','INTEGER','sequelize','exports'];(function(_0x455953,_0x2ee57d){var _0x2d7d6b=function(_0x1453b7){while(--_0x1453b7){_0x455953['push'](_0x455953['shift']());}};_0x2d7d6b(++_0x2ee57d);}(_0x44bb,0xc1));var _0xb44b=function(_0x4e6ba2,_0x34216e){_0x4e6ba2=_0x4e6ba2-0x0;var _0x149713=_0x44bb[_0x4e6ba2];return _0x149713;};'use strict';var Sequelize=require(_0xb44b('0x0'));module[_0xb44b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb44b('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x8258d1){return'system-'+this[_0xb44b('0x3')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xb44b('0x4')]}}; \ No newline at end of file +var _0x3699=['sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER'];(function(_0x526a2d,_0xea2ac){var _0x2511a3=function(_0xc4edd5){while(--_0xc4edd5){_0x526a2d['push'](_0x526a2d['shift']());}};_0x2511a3(++_0xea2ac);}(_0x3699,0x68));var _0x9369=function(_0x20f1e1,_0x70c4ec){_0x20f1e1=_0x20f1e1-0x0;var _0x15dc80=_0x3699[_0x20f1e1];return _0x15dc80;};'use strict';var Sequelize=require(_0x9369('0x0'));module[_0x9369('0x1')]={'name':{'type':Sequelize[_0x9369('0x2')],'allowNull':![],'unique':_0x9369('0x3')},'prefix':{'type':Sequelize[_0x9369('0x4')],'get':function(_0x2149b2){return _0x9369('0x5')+this[_0x9369('0x6')](_0x9369('0x3'))+'-';}},'description':{'type':Sequelize[_0x9369('0x2')]},'callerIdAll':{'type':Sequelize[_0x9369('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x9369('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4eb9b41..61d5665 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['length','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','params','find','describe','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','prefix','push','Set','CDR(prefix)=','callerIdAll','goto','charAt','findById','addAgents','omit','ids','spread','emit','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','json','undefined','offset','limit','status','set','apply','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2ba09b,_0x176c57){var _0x42168f=function(_0xc9182a){while(--_0xc9182a){_0x2ba09b['push'](_0x2ba09b['shift']());}};_0x42168f(++_0x176c57);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x0b0e[_0x1dbaf7];return _0x593f05;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];config[_0xe0b0('0x18')]=_[_0xe0b0('0x19')](config[_0xe0b0('0x18')],{'host':_0xe0b0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe0b0('0x18')]));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);function respondWithStatusCode(_0x24babd,_0x177c24){_0x177c24=_0x177c24||0xcc;return function(_0x55d884){if(_0x55d884){return _0x24babd[_0xe0b0('0x1d')](_0x177c24);}return _0x24babd['status'](_0x177c24)[_0xe0b0('0x1e')]();};}function respondWithResult(_0xadee6e,_0x519ae8){_0x519ae8=_0x519ae8||0xc8;return function(_0x11fdca){if(_0x11fdca){return _0xadee6e['status'](_0x519ae8)[_0xe0b0('0x1f')](_0x11fdca);}};}function respondWithFilteredResult(_0x100204,_0x56bcc7){return function(_0x54a3eb){if(_0x54a3eb){var _0x46bb44=typeof _0x56bcc7['offset']==='undefined'&&typeof _0x56bcc7['limit']===_0xe0b0('0x20');var _0x50fa4a=_0x54a3eb['count'];var _0x10cde1=_0x46bb44?0x0:_0x56bcc7['offset'];var _0x472286=_0x46bb44?_0x54a3eb['count']:_0x56bcc7[_0xe0b0('0x21')]+_0x56bcc7[_0xe0b0('0x22')];var _0x3e10b3;if(_0x472286>=_0x50fa4a){_0x472286=_0x50fa4a;_0x3e10b3=0xc8;}else{_0x3e10b3=0xce;}_0x100204[_0xe0b0('0x23')](_0x3e10b3);return _0x100204[_0xe0b0('0x24')]('Content-Range',_0x10cde1+'-'+_0x472286+'/'+_0x50fa4a)['json'](_0x54a3eb);}return null;};}function patchUpdates(_0x2fa820){return function(_0x5512bb){try{jsonpatch[_0xe0b0('0x25')](_0x5512bb,_0x2fa820,!![]);}catch(_0x31b5f8){return BPromise['reject'](_0x31b5f8);}return _0x5512bb[_0xe0b0('0x26')]();};}function saveUpdates(_0x503883,_0x2208d0){return function(_0x49a727){if(_0x49a727){return _0x49a727[_0xe0b0('0x27')](_0x503883)['then'](function(_0x3e5c88){return _0x3e5c88;});}return null;};}function removeEntity(_0x4de537,_0x4700cc){return function(_0x4aafbe){if(_0x4aafbe){return _0x4aafbe[_0xe0b0('0x28')]()['then'](function(){var _0x362aba=_0x4aafbe[_0xe0b0('0x29')]({'plain':!![]});var _0x1f1ebd=_0xe0b0('0x2a');return db[_0xe0b0('0x2b')][_0xe0b0('0x28')]({'where':{'type':_0x1f1ebd,'resourceId':_0x362aba['id']}})['then'](function(){return _0x4aafbe;});})[_0xe0b0('0x2c')](function(){_0x4de537[_0xe0b0('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e13b,_0x419b1f){return function(_0x36d137){if(!_0x36d137){_0x15e13b[_0xe0b0('0x1d')](0x194);}return _0x36d137;};}function handleError(_0x3cdbd5,_0x254cad){_0x254cad=_0x254cad||0x1f4;return function(_0x136bd4){logger['error'](_0x136bd4[_0xe0b0('0x2d')]);if(_0x136bd4[_0xe0b0('0x2e')]){delete _0x136bd4['name'];}_0x3cdbd5['status'](_0x254cad)[_0xe0b0('0x2f')](_0x136bd4);};}exports[_0xe0b0('0x30')]=function(_0x422575,_0x3f81d5){var _0x2ab1b1={},_0x5866e5={},_0x32acfe={'count':0x0,'rows':[]};var _0x3231fc=_[_0xe0b0('0x31')](db[_0xe0b0('0x32')][_0xe0b0('0x33')],function(_0x4fe835){return{'name':_0x4fe835[_0xe0b0('0x34')],'type':_0x4fe835[_0xe0b0('0x35')][_0xe0b0('0x36')]};});_0x5866e5[_0xe0b0('0x37')]=_[_0xe0b0('0x31')](_0x3231fc,_0xe0b0('0x2e'));_0x5866e5[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x422575[_0xe0b0('0x38')]);_0x5866e5[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x5866e5[_0xe0b0('0x37')],_0x5866e5[_0xe0b0('0x38')]);_0x2ab1b1[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x5866e5['model'],qs[_0xe0b0('0x3d')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x2ab1b1[_0xe0b0('0x3c')]=_0x2ab1b1[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x2ab1b1[_0xe0b0('0x3c')]:_0x5866e5['model'];if(!_0x422575['query']['hasOwnProperty']('nolimit')){_0x2ab1b1[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x422575[_0xe0b0('0x38')]['limit']);_0x2ab1b1[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x21')]);}_0x2ab1b1['order']=qs[_0xe0b0('0x3f')](_0x422575[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x2ab1b1[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x422575[_0xe0b0('0x38')],_0x5866e5[_0xe0b0('0x3a')]),_0x3231fc);if(_0x422575[_0xe0b0('0x38')]['filter']){_0x2ab1b1[_0xe0b0('0x40')]=_['merge'](_0x2ab1b1[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x3231fc,function(_0x46c4ea){if(_0x46c4ea[_0xe0b0('0x35')]!=='VIRTUAL'){var _0x3e1b6b={};_0x3e1b6b[_0x46c4ea[_0xe0b0('0x2e')]]={'$like':'%'+_0x422575[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x3e1b6b;}})});}_0x2ab1b1=_[_0xe0b0('0x43')]({},_0x2ab1b1,_0x422575[_0xe0b0('0x44')]);var _0x3ad564={'where':_0x2ab1b1[_0xe0b0('0x40')]};return db['VoicePrefix'][_0xe0b0('0x45')](_0x3ad564)[_0xe0b0('0x2c')](function(_0x528818){_0x32acfe['count']=_0x528818;if(_0x422575[_0xe0b0('0x38')][_0xe0b0('0x46')]){_0x2ab1b1['include']=[{'all':!![]}];}return db[_0xe0b0('0x32')][_0xe0b0('0x47')](_0x2ab1b1);})[_0xe0b0('0x2c')](function(_0x1c869d){_0x32acfe[_0xe0b0('0x48')]=_0x1c869d;return _0x32acfe;})['then'](respondWithFilteredResult(_0x3f81d5,_0x2ab1b1))['catch'](handleError(_0x3f81d5,null));};exports['show']=function(_0xc3235b,_0x38e715){var _0x5c2f3b={'raw':![],'where':{'id':_0xc3235b[_0xe0b0('0x49')]['id']}},_0x9f7459={};_0x9f7459[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x32')]['rawAttributes']);_0x9f7459['query']=_[_0xe0b0('0x39')](_0xc3235b[_0xe0b0('0x38')]);_0x9f7459[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x9f7459[_0xe0b0('0x37')],_0x9f7459['query']);_0x5c2f3b[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x9f7459['model'],qs['fields'](_0xc3235b['query'][_0xe0b0('0x3d')]));_0x5c2f3b[_0xe0b0('0x3c')]=_0x5c2f3b[_0xe0b0('0x3c')][_0xe0b0('0x3e')]?_0x5c2f3b['attributes']:_0x9f7459[_0xe0b0('0x37')];if(_0xc3235b[_0xe0b0('0x38')]['includeAll']){_0x5c2f3b['include']=[{'all':!![]}];}_0x5c2f3b=_[_0xe0b0('0x43')]({},_0x5c2f3b,_0xc3235b[_0xe0b0('0x44')]);return db['VoicePrefix'][_0xe0b0('0x4a')](_0x5c2f3b)[_0xe0b0('0x2c')](handleEntityNotFound(_0x38e715,null))['then'](respondWithResult(_0x38e715,null))['catch'](handleError(_0x38e715,null));};exports[_0xe0b0('0x28')]=function(_0x511679,_0x165dc8){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x511679[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0x165dc8,null))[_0xe0b0('0x2c')](removeEntity(_0x165dc8,null))['catch'](handleError(_0x165dc8,null));};exports['describe']=function(_0x2ef908,_0x5d380a){return db['VoicePrefix'][_0xe0b0('0x4b')]()[_0xe0b0('0x2c')](respondWithResult(_0x5d380a,null))['catch'](handleError(_0x5d380a,null));};exports['create']=function(_0x13adfb,_0x10b5a6){var _0x17b09f;return db[_0xe0b0('0x4c')][_0xe0b0('0x4d')](function(_0x24115f){return db[_0xe0b0('0x32')]['create'](_0x13adfb[_0xe0b0('0x4e')],{'transaction':_0x24115f})['then'](function(_0x17b3d4){_0x17b09f=_0x17b3d4['get']({'plain':!![]});return db['VoiceExtension'][_0xe0b0('0x4a')]({'where':{'id':_0x17b09f[_0xe0b0('0x4f')]},'raw':!![]})[_0xe0b0('0x2c')](function(_0x2f1712){return createVoicePrefixExtensions(_0x17b09f,_0x2f1712,_0x24115f);});});})[_0xe0b0('0x2c')](function(){var _0x2a588d=_0x13adfb[_0xe0b0('0x50')][_0xe0b0('0x29')]({'plain':!![]});if(!_0x2a588d)throw new Error(_0xe0b0('0x51'));if(_0x2a588d['role']===_0xe0b0('0x50')){var _0x57ccc9=_0x17b09f;return db[_0xe0b0('0x52')][_0xe0b0('0x4a')]({'where':{'name':_0xe0b0('0x2a'),'userProfileId':_0x2a588d[_0xe0b0('0x53')]},'raw':!![]})[_0xe0b0('0x2c')](function(_0x3bdb25){if(_0x3bdb25&&_0x3bdb25['autoAssociation']===0x0){return db[_0xe0b0('0x2b')][_0xe0b0('0x54')]({'name':_0x57ccc9[_0xe0b0('0x2e')],'resourceId':_0x57ccc9['id'],'type':_0x3bdb25[_0xe0b0('0x2e')],'sectionId':_0x3bdb25['id']},{})[_0xe0b0('0x2c')](function(){return _0x17b09f;});}else{return _0x17b09f;}})[_0xe0b0('0x55')](function(_0x234cb7){logger[_0xe0b0('0x56')](_0xe0b0('0x57'),_0x234cb7);throw _0x234cb7;});}return _0x17b09f;})[_0xe0b0('0x2c')](respondWithResult(_0x10b5a6,null))[_0xe0b0('0x55')](handleError(_0x10b5a6,null));};function Extension(_0x18ab99,_0xc719d2,_0x10eb99,_0xcdf97){this[_0xe0b0('0x58')]=_0xe0b0('0x59');this[_0xe0b0('0x5a')]=_0x18ab99;this['app']=_0x10eb99;this[_0xe0b0('0x35')]=_0xe0b0('0x5b');this[_0xe0b0('0x5c')]=_0xe0b0('0x5d');this[_0xe0b0('0x5e')]=_0xc719d2;this[_0xe0b0('0x5f')]=_0xcdf97;}function createVoicePrefixExtensions(_0x2bdb59,_0x4f818b,_0x47dcc4){return new BPromise(function(_0x139014,_0x2a0415){var _0x157556=new Extension(formatPrefixName(_0x2bdb59['prefix']),0x1,_0xe0b0('0x60'),_0xe0b0('0x61'));_0x157556[_0xe0b0('0x62')]=_0x2bdb59['id'];return db[_0xe0b0('0x63')][_0xe0b0('0x54')](_0x157556,{'transaction':_0x47dcc4})['then'](function(_0x370f8c){var _0x242120=_0x370f8c[_0xe0b0('0x29')]({'plain':!![]});var _0x54b5d6=_[_0xe0b0('0x31')](addVoicePrefixExtensions(_0x2bdb59,_0x4f818b),function(_0x30b3ae){_0x30b3ae['VoiceExtensionId']=_0x242120['id'];_0x30b3ae[_0xe0b0('0x62')]=_0x2bdb59['id'];return _0x30b3ae;});return db['VoiceExtension']['bulkCreate'](_0x54b5d6,{'transaction':_0x47dcc4})[_0xe0b0('0x2c')](function(_0x57b51e){if(!_0x57b51e){return _0x2a0415('Extensions\x20creation\x20failed');}else{return _0x139014(_0x57b51e);}})[_0xe0b0('0x55')](function(_0xd750b4){return _0x2a0415(_0xd750b4);});});;});};function addVoicePrefixExtensions(_0x2d91f1,_0x1a4fad){var _0x5a7913=[];var _0x3679e0=formatPrefixName(_0x2d91f1[_0xe0b0('0x64')]);_0x5a7913[_0xe0b0('0x65')](new Extension(_0x3679e0,0x2,_0xe0b0('0x66'),_0xe0b0('0x67')+_0x2d91f1[_0xe0b0('0x2e')]));if(_0x2d91f1[_0xe0b0('0x68')]){_0x5a7913[_0xe0b0('0x65')](new Extension(_0x3679e0,0x3,'Set','PREFIX-CALLERIDALL='+_0x2d91f1[_0xe0b0('0x68')]));}else{_0x5a7913[_0xe0b0('0x65')](new Extension(_0x3679e0,0x3,_0xe0b0('0x60'),'No\x20callerid\x20available'));}_0x5a7913['push'](new Extension(_0x3679e0,0x4,_0xe0b0('0x69'),_0x1a4fad[_0xe0b0('0x58')]+','+'${EXTEN:'+(0x8+_0x2d91f1['name'][_0xe0b0('0x3e')])+'}'+','+0x1));return _0x5a7913;}function formatPrefixName(_0x42b2d3){var _0x38eb8e='_';for(var _0x29175a=0x0;_0x29175a<_0x42b2d3[_0xe0b0('0x3e')];_0x29175a++){if(_0x42b2d3[_0xe0b0('0x6a')](_0x29175a)=='-'){_0x38eb8e+=_0x42b2d3[_0xe0b0('0x6a')](_0x29175a);}else{_0x38eb8e+='['+_0x42b2d3[_0xe0b0('0x6a')](_0x29175a)+']';}}_0x38eb8e+='.';return _0x38eb8e;}exports['update']=function(_0x1daff7,_0x12e245,_0x1673bc){var _0x494420=_0x1daff7['body'];_0x494420['prefix']='system-'+_0x494420['name']+'-';return db['sequelize'][_0xe0b0('0x4d')](function(_0x51b492){return db['VoicePrefix'][_0xe0b0('0x27')](_0x494420,{'where':{'id':_0x494420['id']},'transaction':_0x51b492})[_0xe0b0('0x2c')](function(){return db[_0xe0b0('0x63')][_0xe0b0('0x28')]({'where':{'VoicePrefixId':_0x494420['id']},'transaction':_0x51b492})[_0xe0b0('0x2c')](function(){return db[_0xe0b0('0x63')][_0xe0b0('0x4a')]({'where':{'id':_0x494420[_0xe0b0('0x4f')]},'raw':!![]})['then'](function(_0x3097fb){return createVoicePrefixExtensions(_0x494420,_0x3097fb,_0x51b492);});});});})[_0xe0b0('0x2c')](function(){return db[_0xe0b0('0x32')][_0xe0b0('0x6b')](_0x494420['id']);})[_0xe0b0('0x2c')](respondWithResult(_0x12e245,null))[_0xe0b0('0x55')](handleError(_0x12e245,null));};exports[_0xe0b0('0x6c')]=function(_0x5e3e28,_0xaf2607,_0x5981a3){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x5e3e28[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0xaf2607,null))['then'](function(_0x311f79){if(_0x311f79){return _0x311f79[_0xe0b0('0x6c')](_0x5e3e28['body']['ids'],_[_0xe0b0('0x6d')](_0x5e3e28[_0xe0b0('0x4e')],[_0xe0b0('0x6e'),'id'])||{})[_0xe0b0('0x6f')](function(_0x8b1390){for(var _0x31dd21=0x0;_0x31dd21<_0x5e3e28[_0xe0b0('0x4e')][_0xe0b0('0x6e')][_0xe0b0('0x3e')];_0x31dd21+=0x1){socket[_0xe0b0('0x70')]('userVoicePrefix:save',{'UserId':Number(_0x5e3e28['body'][_0xe0b0('0x6e')][_0x31dd21]),'VoicePrefixId':Number(_0x5e3e28['params']['id'])});}return _0x8b1390;});}})['then'](respondWithResult(_0xaf2607,null))['catch'](handleError(_0xaf2607,null));};exports['removeAgents']=function(_0x55f064,_0x584350,_0x654d2b){return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x55f064[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x584350,null))[_0xe0b0('0x2c')](function(_0x948708){if(_0x948708){return _0x948708['removeAgents'](_0x55f064[_0xe0b0('0x38')][_0xe0b0('0x6e')])[_0xe0b0('0x2c')](function(){if(_[_0xe0b0('0x71')](_0x55f064[_0xe0b0('0x38')]['ids'])){for(var _0x55d3f8=0x0;_0x55d3f8<_0x55f064['query']['ids']['length'];_0x55d3f8+=0x1){socket[_0xe0b0('0x70')]('userVoicePrefix:remove',{'UserId':Number(_0x55f064[_0xe0b0('0x38')]['ids'][_0x55d3f8]),'VoicePrefixId':Number(_0x55f064[_0xe0b0('0x49')]['id'])});}}else{socket[_0xe0b0('0x70')](_0xe0b0('0x72'),{'UserId':Number(_0x55f064[_0xe0b0('0x38')][_0xe0b0('0x6e')]),'VoicePrefixId':Number(_0x55f064[_0xe0b0('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x584350,null))['catch'](handleError(_0x584350,null));};exports['getAgents']=function(_0x58e0e3,_0xc1919f,_0x261381){var _0x264363={};var _0x4377f7={};var _0x2c1149;var _0x534881;return db[_0xe0b0('0x32')][_0xe0b0('0x73')]({'where':{'id':_0x58e0e3[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](handleEntityNotFound(_0xc1919f,null))[_0xe0b0('0x2c')](function(_0x2a5082){if(_0x2a5082){_0x2c1149=_0x2a5082;_0x4377f7[_0xe0b0('0x37')]=_[_0xe0b0('0x39')](db[_0xe0b0('0x74')]['rawAttributes']);_0x4377f7['query']=_[_0xe0b0('0x39')](_0x58e0e3[_0xe0b0('0x38')]);_0x4377f7['filters']=_[_0xe0b0('0x3b')](_0x4377f7[_0xe0b0('0x37')],_0x4377f7[_0xe0b0('0x38')]);_0x264363[_0xe0b0('0x3c')]=_[_0xe0b0('0x3b')](_0x4377f7[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x58e0e3[_0xe0b0('0x38')]['fields']));_0x264363['attributes']=_0x264363['attributes'][_0xe0b0('0x3e')]?_0x264363[_0xe0b0('0x3c')]:_0x4377f7['model'];_0x264363[_0xe0b0('0x75')]=qs[_0xe0b0('0x3f')](_0x58e0e3[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x264363['where']=qs['filters'](_['pick'](_0x58e0e3[_0xe0b0('0x38')],_0x4377f7[_0xe0b0('0x3a')]));if(_0x58e0e3['query'][_0xe0b0('0x42')]){_0x264363[_0xe0b0('0x40')]=_['merge'](_0x264363['where'],{'$or':_[_0xe0b0('0x31')](_0x264363['attributes'],function(_0x251195){var _0x5f06c0={};_0x5f06c0[_0x251195]={'$like':'%'+_0x58e0e3[_0xe0b0('0x38')][_0xe0b0('0x42')]+'%'};return _0x5f06c0;})});}_0x264363=_[_0xe0b0('0x43')]({},_0x264363,_0x58e0e3[_0xe0b0('0x44')]);return _0x2c1149[_0xe0b0('0x76')](_0x264363);}})[_0xe0b0('0x2c')](function(_0x434dfa){if(_0x434dfa){_0x534881=_0x434dfa[_0xe0b0('0x3e')];if(!_0x58e0e3[_0xe0b0('0x38')]['hasOwnProperty'](_0xe0b0('0x77'))){_0x264363[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x58e0e3['query'][_0xe0b0('0x22')]);_0x264363['offset']=qs[_0xe0b0('0x21')](_0x58e0e3[_0xe0b0('0x38')]['offset']);}return _0x2c1149[_0xe0b0('0x76')](_0x264363);}})['then'](function(_0x528932){if(_0x528932){return _0x528932?{'count':_0x534881,'rows':_0x528932}:null;}})[_0xe0b0('0x2c')](respondWithResult(_0xc1919f,null))['catch'](handleError(_0xc1919f,null));};exports['getTeams']=function(_0x4f027c,_0x1e4bfb,_0x238979){var _0x9e8b9c={};var _0x42b591={};var _0x3da0ce;var _0x4e0429;return db[_0xe0b0('0x32')][_0xe0b0('0x73')]({'where':{'id':_0x4f027c[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e4bfb,null))[_0xe0b0('0x2c')](function(_0x447641){if(_0x447641){_0x3da0ce=_0x447641;_0x42b591['model']=_['keys'](db[_0xe0b0('0x78')]['rawAttributes']);_0x42b591[_0xe0b0('0x38')]=_[_0xe0b0('0x39')](_0x4f027c[_0xe0b0('0x38')]);_0x42b591[_0xe0b0('0x3a')]=_[_0xe0b0('0x3b')](_0x42b591[_0xe0b0('0x37')],_0x42b591[_0xe0b0('0x38')]);_0x9e8b9c['attributes']=_[_0xe0b0('0x3b')](_0x42b591[_0xe0b0('0x37')],qs[_0xe0b0('0x3d')](_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x3d')]));_0x9e8b9c['attributes']=_0x9e8b9c['attributes'][_0xe0b0('0x3e')]?_0x9e8b9c[_0xe0b0('0x3c')]:_0x42b591[_0xe0b0('0x37')];_0x9e8b9c[_0xe0b0('0x75')]=qs[_0xe0b0('0x3f')](_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x3f')]);_0x9e8b9c[_0xe0b0('0x40')]=qs[_0xe0b0('0x3a')](_[_0xe0b0('0x41')](_0x4f027c['query'],_0x42b591[_0xe0b0('0x3a')]));if(_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x42')]){_0x9e8b9c[_0xe0b0('0x40')]=_['merge'](_0x9e8b9c[_0xe0b0('0x40')],{'$or':_[_0xe0b0('0x31')](_0x9e8b9c[_0xe0b0('0x3c')],function(_0x116c16){var _0x476763={};_0x476763[_0x116c16]={'$like':'%'+_0x4f027c['query'][_0xe0b0('0x42')]+'%'};return _0x476763;})});}_0x9e8b9c=_['merge']({},_0x9e8b9c,_0x4f027c[_0xe0b0('0x44')]);return _0x3da0ce[_0xe0b0('0x79')](_0x9e8b9c);}})[_0xe0b0('0x2c')](function(_0x23c448){if(_0x23c448){_0x4e0429=_0x23c448[_0xe0b0('0x3e')];if(!_0x4f027c['query']['hasOwnProperty'](_0xe0b0('0x77'))){_0x9e8b9c['limit']=qs[_0xe0b0('0x22')](_0x4f027c['query'][_0xe0b0('0x22')]);_0x9e8b9c[_0xe0b0('0x21')]=qs[_0xe0b0('0x21')](_0x4f027c[_0xe0b0('0x38')][_0xe0b0('0x21')]);}return _0x3da0ce[_0xe0b0('0x79')](_0x9e8b9c);}})[_0xe0b0('0x2c')](function(_0x5d7cee){if(_0x5d7cee){return _0x5d7cee?{'count':_0x4e0429,'rows':_0x5d7cee}:null;}})['then'](respondWithResult(_0x1e4bfb,null))[_0xe0b0('0x55')](handleError(_0x1e4bfb,null));};exports[_0xe0b0('0x7a')]=function(_0x184938,_0x20d6bd,_0xd83992){var _0x2b4d49=_0x184938[_0xe0b0('0x4e')][_0xe0b0('0x6e')];var _0x1bbb0d;return db[_0xe0b0('0x78')]['findAll']({'where':{'id':_0x2b4d49},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x7b'),'attributes':['id',_0xe0b0('0x2e'),_0xe0b0('0x7c'),_0xe0b0('0x7d'),_0xe0b0('0x7e')],'raw':!![]}]})[_0xe0b0('0x2c')](function(_0x33b67a){if(_0x33b67a){_0x1bbb0d=_0x33b67a;var _0x51995b=_['flatMap'](_0x33b67a,function(_0x302f9f){var _0x1ea4d5=_0x302f9f[_0xe0b0('0x29')]({'plain':!![]});return _0x1ea4d5[_0xe0b0('0x7b')];});return db[_0xe0b0('0x32')][_0xe0b0('0x4a')]({'where':{'id':_0x184938[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](function(_0x6ef3b2){return db[_0xe0b0('0x4c')]['transaction'](function(_0x46b247){return _0x6ef3b2[_0xe0b0('0x7a')](_0x2b4d49,{'transaction':_0x46b247})['then'](function(){return BPromise[_0xe0b0('0x7f')](_0x1bbb0d,function(_0x4250f4){return db[_0xe0b0('0x80')][_0xe0b0('0x81')]({'TeamId':_0x4250f4['id'],'VoicePrefixId':_0x184938[_0xe0b0('0x49')]['id']},{'transaction':_0x46b247});});})['then'](function(){return BPromise[_0xe0b0('0x7f')](_0x51995b,function(_0x38f9af){return db[_0xe0b0('0x82')][_0xe0b0('0x83')]({'where':{'UserId':_0x38f9af['id'],'VoicePrefixId':_0x184938[_0xe0b0('0x49')]['id']},'transaction':_0x46b247});});})['then'](function(){_0x51995b[_0xe0b0('0x84')](function(_0x58d61b){socket[_0xe0b0('0x70')](_0xe0b0('0x85'),{'UserId':_0x58d61b['id'],'VoicePrefixId':_0x6ef3b2['id']});});});});});}})[_0xe0b0('0x2c')](respondWithStatusCode(_0x20d6bd,null))['catch'](handleError(_0x20d6bd,null));};exports['removeTeams']=function(_0x45ae1a,_0x2349df,_0x619226){return db['Team']['findAll']({'where':{'id':_0x45ae1a['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe0b0('0x2c')](handleEntityNotFound(_0x2349df,null))[_0xe0b0('0x2c')](function(_0x5ac132){var _0x121257=_[_0xe0b0('0x31')](_0x5ac132,'id');var _0xfd746a=[];var _0xd73b8a=[];var _0x437588=squel['select']();_0x437588['field'](_0xe0b0('0x86'))[_0xe0b0('0x87')](_0xe0b0('0x88'),'tq')['join'](_0xe0b0('0x89'),'ut',_0xe0b0('0x8a'))[_0xe0b0('0x40')](_0xe0b0('0x8b'),_0x45ae1a[_0xe0b0('0x49')]['id']);for(var _0x1b8d4a=0x0;_0x1b8d4a<_0x5ac132['length'];_0x1b8d4a+=0x1){let _0x581848=_0x5ac132[_0x1b8d4a];for(var _0x495635=0x0;_0x495635<_0x581848[_0xe0b0('0x7b')][_0xe0b0('0x3e')];_0x495635+=0x1){let _0x9f9d8d=_0x581848[_0xe0b0('0x7b')][_0x495635];var _0x266cb5=_0x437588[_0xe0b0('0x8c')]();_0x266cb5[_0xe0b0('0x40')](_0xe0b0('0x8d'),_0x9f9d8d['id']);_0xd73b8a['push'](db['sequelize'][_0xe0b0('0x38')](_0x266cb5[_0xe0b0('0x8e')](),{'type':db[_0xe0b0('0x4c')]['QueryTypes'][_0xe0b0('0x8f')]})[_0xe0b0('0x2c')](function(_0x9f1fb){if(_0x9f1fb['length']===0x1){return _0x9f9d8d['id'];}else{var _0x36fa1f=_['every'](_[_0xe0b0('0x31')](_0x9f1fb,_0xe0b0('0x90')),function(_0x1e74a0){return _[_0xe0b0('0x91')](_0x121257,_0x1e74a0);});if(_0x36fa1f){return _0x9f9d8d['id'];}}}));}}return BPromise[_0xe0b0('0x92')](_0xd73b8a)[_0xe0b0('0x2c')](function(_0x12e46f){_0xfd746a=_(_0xfd746a)['union'](_0x12e46f)[_0xe0b0('0x93')]()[_0xe0b0('0x94')]();return db['VoicePrefix'][_0xe0b0('0x4a')]({'where':{'id':_0x45ae1a[_0xe0b0('0x49')]['id']}})[_0xe0b0('0x2c')](function(_0x4dbb7b){return db[_0xe0b0('0x4c')][_0xe0b0('0x4d')](function(_0x221e96){return _0x4dbb7b['removeTeams'](_0x45ae1a[_0xe0b0('0x38')][_0xe0b0('0x6e')],{'transaction':_0x221e96})[_0xe0b0('0x2c')](function(){if(!_[_0xe0b0('0x95')](_0xfd746a)){return _0x4dbb7b[_0xe0b0('0x96')](_0xfd746a,{'transaction':_0x221e96});}})[_0xe0b0('0x2c')](function(){_0xfd746a['forEach'](function(_0x44da91){socket[_0xe0b0('0x70')](_0xe0b0('0x72'),{'UserId':_0x44da91,'VoicePrefixId':_0x4dbb7b['id']});});});});});});})[_0xe0b0('0x2c')](respondWithStatusCode(_0x2349df,null))[_0xe0b0('0x55')](handleError(_0x2349df,null));}; \ No newline at end of file +var _0xb62e=['all','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','describe','create','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','nolimit','getTeams','Team','addTeams','Agents','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','SELECT','every','TeamId','includes'];(function(_0x24b057,_0x28073b){var _0x464f68=function(_0x35b1b9){while(--_0x35b1b9){_0x24b057['push'](_0x24b057['shift']());}};_0x464f68(++_0x28073b);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];config[_0xeb62('0x1b')]=_[_0xeb62('0x1c')](config[_0xeb62('0x1b')],{'host':_0xeb62('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb62('0x1b')]));require(_0xeb62('0x1e'))[_0xeb62('0x1f')](socket);function respondWithStatusCode(_0x4da178,_0x26c3fd){_0x26c3fd=_0x26c3fd||0xcc;return function(_0x195837){if(_0x195837){return _0x4da178[_0xeb62('0x20')](_0x26c3fd);}return _0x4da178['status'](_0x26c3fd)[_0xeb62('0x21')]();};}function respondWithResult(_0x15b3e8,_0x184106){_0x184106=_0x184106||0xc8;return function(_0x353e2c){if(_0x353e2c){return _0x15b3e8[_0xeb62('0x22')](_0x184106)[_0xeb62('0x23')](_0x353e2c);}};}function respondWithFilteredResult(_0x1fb460,_0x1324d7){return function(_0x39b138){if(_0x39b138){var _0x27fd84=typeof _0x1324d7[_0xeb62('0x24')]===_0xeb62('0x25')&&typeof _0x1324d7[_0xeb62('0x26')]==='undefined';var _0x38c5e4=_0x39b138[_0xeb62('0x27')];var _0x332396=_0x27fd84?0x0:_0x1324d7[_0xeb62('0x24')];var _0x425817=_0x27fd84?_0x39b138[_0xeb62('0x27')]:_0x1324d7[_0xeb62('0x24')]+_0x1324d7['limit'];var _0x599d0b;if(_0x425817>=_0x38c5e4){_0x425817=_0x38c5e4;_0x599d0b=0xc8;}else{_0x599d0b=0xce;}_0x1fb460[_0xeb62('0x22')](_0x599d0b);return _0x1fb460[_0xeb62('0x28')](_0xeb62('0x29'),_0x332396+'-'+_0x425817+'/'+_0x38c5e4)[_0xeb62('0x23')](_0x39b138);}return null;};}function patchUpdates(_0x122b15){return function(_0x4cafcf){try{jsonpatch['apply'](_0x4cafcf,_0x122b15,!![]);}catch(_0x4664ce){return BPromise[_0xeb62('0x2a')](_0x4664ce);}return _0x4cafcf[_0xeb62('0x2b')]();};}function saveUpdates(_0x395b70,_0x55a169){return function(_0x4e92f5){if(_0x4e92f5){return _0x4e92f5[_0xeb62('0x2c')](_0x395b70)['then'](function(_0x448327){return _0x448327;});}return null;};}function removeEntity(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(_0x516a72){return _0x516a72[_0xeb62('0x2d')]()[_0xeb62('0x2e')](function(){var _0x46d1bb=_0x516a72['get']({'plain':!![]});var _0x3ef784=_0xeb62('0x2f');return db[_0xeb62('0x30')][_0xeb62('0x2d')]({'where':{'type':_0x3ef784,'resourceId':_0x46d1bb['id']}})[_0xeb62('0x2e')](function(){return _0x516a72;});})[_0xeb62('0x2e')](function(){_0x4b0f46['status'](0xcc)[_0xeb62('0x21')]();});}};}function handleEntityNotFound(_0x1616ee,_0x57169a){return function(_0x157474){if(!_0x157474){_0x1616ee[_0xeb62('0x20')](0x194);}return _0x157474;};}function handleError(_0x2c967c,_0x2c308c){_0x2c308c=_0x2c308c||0x1f4;return function(_0x235448){logger['error'](_0x235448['stack']);if(_0x235448[_0xeb62('0x31')]){delete _0x235448[_0xeb62('0x31')];}_0x2c967c[_0xeb62('0x22')](_0x2c308c)[_0xeb62('0x32')](_0x235448);};}exports[_0xeb62('0x33')]=function(_0x2ad3ec,_0x1ae51e){var _0x4be25d={},_0x411062={},_0x47a94b={'count':0x0,'rows':[]};var _0x555db1=_[_0xeb62('0x34')](db[_0xeb62('0x35')]['rawAttributes'],function(_0x1ade38){return{'name':_0x1ade38['fieldName'],'type':_0x1ade38[_0xeb62('0x36')][_0xeb62('0x37')]};});_0x411062['model']=_[_0xeb62('0x34')](_0x555db1,_0xeb62('0x31'));_0x411062['query']=_[_0xeb62('0x38')](_0x2ad3ec[_0xeb62('0x39')]);_0x411062[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x411062['model'],_0x411062[_0xeb62('0x39')]);_0x4be25d[_0xeb62('0x3c')]=_['intersection'](_0x411062['model'],qs[_0xeb62('0x3d')](_0x2ad3ec[_0xeb62('0x39')]['fields']));_0x4be25d[_0xeb62('0x3c')]=_0x4be25d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x4be25d[_0xeb62('0x3c')]:_0x411062[_0xeb62('0x3f')];if(!_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x40')]('nolimit')){_0x4be25d['limit']=qs[_0xeb62('0x26')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x26')]);_0x4be25d[_0xeb62('0x24')]=qs['offset'](_0x2ad3ec[_0xeb62('0x39')]['offset']);}_0x4be25d[_0xeb62('0x41')]=qs[_0xeb62('0x42')](_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x42')]);_0x4be25d[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x2ad3ec[_0xeb62('0x39')],_0x411062['filters']),_0x555db1);if(_0x2ad3ec[_0xeb62('0x39')][_0xeb62('0x45')]){_0x4be25d[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0x4be25d['where'],{'$or':_['map'](_0x555db1,function(_0x46a560){if(_0x46a560[_0xeb62('0x36')]!=='VIRTUAL'){var _0x1f7036={};_0x1f7036[_0x46a560[_0xeb62('0x31')]]={'$like':'%'+_0x2ad3ec['query'][_0xeb62('0x45')]+'%'};return _0x1f7036;}})});}_0x4be25d=_['merge']({},_0x4be25d,_0x2ad3ec[_0xeb62('0x47')]);var _0x47b815={'where':_0x4be25d[_0xeb62('0x43')]};return db['VoicePrefix'][_0xeb62('0x27')](_0x47b815)[_0xeb62('0x2e')](function(_0x317f50){_0x47a94b['count']=_0x317f50;if(_0x2ad3ec['query'][_0xeb62('0x48')]){_0x4be25d[_0xeb62('0x49')]=[{'all':!![]}];}return db[_0xeb62('0x35')][_0xeb62('0x4a')](_0x4be25d);})[_0xeb62('0x2e')](function(_0x4afd5e){_0x47a94b[_0xeb62('0x4b')]=_0x4afd5e;return _0x47a94b;})['then'](respondWithFilteredResult(_0x1ae51e,_0x4be25d))[_0xeb62('0x4c')](handleError(_0x1ae51e,null));};exports['show']=function(_0xeeced2,_0x4d2f80){var _0x26c77d={'raw':![],'where':{'id':_0xeeced2[_0xeb62('0x4d')]['id']}},_0x4dbcac={};_0x4dbcac[_0xeb62('0x3f')]=_[_0xeb62('0x38')](db[_0xeb62('0x35')][_0xeb62('0x4e')]);_0x4dbcac[_0xeb62('0x39')]=_['keys'](_0xeeced2[_0xeb62('0x39')]);_0x4dbcac[_0xeb62('0x3a')]=_['intersection'](_0x4dbcac['model'],_0x4dbcac['query']);_0x26c77d['attributes']=_[_0xeb62('0x3b')](_0x4dbcac[_0xeb62('0x3f')],qs['fields'](_0xeeced2[_0xeb62('0x39')][_0xeb62('0x3d')]));_0x26c77d[_0xeb62('0x3c')]=_0x26c77d[_0xeb62('0x3c')][_0xeb62('0x3e')]?_0x26c77d['attributes']:_0x4dbcac[_0xeb62('0x3f')];if(_0xeeced2['query'][_0xeb62('0x48')]){_0x26c77d[_0xeb62('0x49')]=[{'all':!![]}];}_0x26c77d=_[_0xeb62('0x46')]({},_0x26c77d,_0xeeced2[_0xeb62('0x47')]);return db[_0xeb62('0x35')][_0xeb62('0x4f')](_0x26c77d)[_0xeb62('0x2e')](handleEntityNotFound(_0x4d2f80,null))[_0xeb62('0x2e')](respondWithResult(_0x4d2f80,null))[_0xeb62('0x4c')](handleError(_0x4d2f80,null));};exports[_0xeb62('0x2d')]=function(_0xe13846,_0x13e102){return db['VoicePrefix'][_0xeb62('0x4f')]({'where':{'id':_0xe13846['params']['id']}})['then'](handleEntityNotFound(_0x13e102,null))[_0xeb62('0x2e')](removeEntity(_0x13e102,null))[_0xeb62('0x4c')](handleError(_0x13e102,null));};exports['describe']=function(_0x373505,_0x462760){return db['VoicePrefix'][_0xeb62('0x50')]()[_0xeb62('0x2e')](respondWithResult(_0x462760,null))[_0xeb62('0x4c')](handleError(_0x462760,null));};exports[_0xeb62('0x51')]=function(_0xe71e83,_0x1e6238){var _0x351027;return db[_0xeb62('0x52')]['transaction'](function(_0x3e2be9){return db['VoicePrefix'][_0xeb62('0x51')](_0xe71e83[_0xeb62('0x53')],{'transaction':_0x3e2be9})[_0xeb62('0x2e')](function(_0x289af0){_0x351027=_0x289af0[_0xeb62('0x54')]({'plain':!![]});return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x351027[_0xeb62('0x56')]},'raw':!![]})['then'](function(_0x4d31a1){return createVoicePrefixExtensions(_0x351027,_0x4d31a1,_0x3e2be9);});});})['then'](function(){var _0x5033eb=_0xe71e83[_0xeb62('0x57')]['get']({'plain':!![]});if(!_0x5033eb)throw new Error(_0xeb62('0x58'));if(_0x5033eb['role']===_0xeb62('0x57')){var _0x342768=_0x351027;return db[_0xeb62('0x59')]['find']({'where':{'name':_0xeb62('0x2f'),'userProfileId':_0x5033eb[_0xeb62('0x5a')]},'raw':!![]})['then'](function(_0x35982a){if(_0x35982a&&_0x35982a[_0xeb62('0x5b')]===0x0){return db[_0xeb62('0x30')][_0xeb62('0x51')]({'name':_0x342768['name'],'resourceId':_0x342768['id'],'type':_0x35982a[_0xeb62('0x31')],'sectionId':_0x35982a['id']},{})[_0xeb62('0x2e')](function(){return _0x351027;});}else{return _0x351027;}})['catch'](function(_0x2eba52){logger[_0xeb62('0x5c')](_0xeb62('0x5d'),_0x2eba52);throw _0x2eba52;});}return _0x351027;})[_0xeb62('0x2e')](respondWithResult(_0x1e6238,null))[_0xeb62('0x4c')](handleError(_0x1e6238,null));};function Extension(_0x46da69,_0x3e55bf,_0x1b354d,_0x222d0c){this[_0xeb62('0x5e')]=_0xeb62('0x5f');this[_0xeb62('0x60')]=_0x46da69;this[_0xeb62('0x61')]=_0x1b354d;this[_0xeb62('0x36')]=_0xeb62('0x62');this[_0xeb62('0x63')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3e55bf;this['appdata']=_0x222d0c;}function createVoicePrefixExtensions(_0x5b28ec,_0x279b83,_0x5f363d){return new BPromise(function(_0x10cc40,_0x136d81){var _0x5b8c4=new Extension(formatPrefixName(_0x5b28ec[_0xeb62('0x64')]),0x1,_0xeb62('0x65'),_0xeb62('0x66'));_0x5b8c4[_0xeb62('0x67')]=_0x5b28ec['id'];return db[_0xeb62('0x55')][_0xeb62('0x51')](_0x5b8c4,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x52dfbd){var _0x113302=_0x52dfbd[_0xeb62('0x54')]({'plain':!![]});var _0x42e992=_[_0xeb62('0x34')](addVoicePrefixExtensions(_0x5b28ec,_0x279b83),function(_0x4aba1f){_0x4aba1f[_0xeb62('0x56')]=_0x113302['id'];_0x4aba1f[_0xeb62('0x67')]=_0x5b28ec['id'];return _0x4aba1f;});return db[_0xeb62('0x55')][_0xeb62('0x68')](_0x42e992,{'transaction':_0x5f363d})[_0xeb62('0x2e')](function(_0x1679a7){if(!_0x1679a7){return _0x136d81(_0xeb62('0x69'));}else{return _0x10cc40(_0x1679a7);}})[_0xeb62('0x4c')](function(_0x2e1fb8){return _0x136d81(_0x2e1fb8);});});;});};function addVoicePrefixExtensions(_0x2b788e,_0x1d8675){var _0x510275=[];var _0x110224=formatPrefixName(_0x2b788e[_0xeb62('0x64')]);_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x2,_0xeb62('0x6b'),_0xeb62('0x6c')+_0x2b788e[_0xeb62('0x31')]));if(_0x2b788e[_0xeb62('0x6d')]){_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x6b'),_0xeb62('0x6e')+_0x2b788e['callerIdAll']));}else{_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x3,_0xeb62('0x65'),_0xeb62('0x6f')));}_0x510275[_0xeb62('0x6a')](new Extension(_0x110224,0x4,'goto',_0x1d8675[_0xeb62('0x5e')]+','+_0xeb62('0x70')+(0x8+_0x2b788e[_0xeb62('0x31')][_0xeb62('0x3e')])+'}'+','+0x1));return _0x510275;}function formatPrefixName(_0xc81d4c){var _0x32642f='_';for(var _0x48488c=0x0;_0x48488c<_0xc81d4c[_0xeb62('0x3e')];_0x48488c++){if(_0xc81d4c[_0xeb62('0x71')](_0x48488c)=='-'){_0x32642f+=_0xc81d4c[_0xeb62('0x71')](_0x48488c);}else{_0x32642f+='['+_0xc81d4c[_0xeb62('0x71')](_0x48488c)+']';}}_0x32642f+='.';return _0x32642f;}exports[_0xeb62('0x2c')]=function(_0x28d0ff,_0x2e4502,_0x313d33){var _0x233715=_0x28d0ff[_0xeb62('0x53')];_0x233715[_0xeb62('0x64')]=_0xeb62('0x72')+_0x233715[_0xeb62('0x31')]+'-';return db[_0xeb62('0x52')][_0xeb62('0x73')](function(_0x2bbbff){return db['VoicePrefix'][_0xeb62('0x2c')](_0x233715,{'where':{'id':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x2d')]({'where':{'VoicePrefixId':_0x233715['id']},'transaction':_0x2bbbff})['then'](function(){return db[_0xeb62('0x55')][_0xeb62('0x4f')]({'where':{'id':_0x233715[_0xeb62('0x56')]},'raw':!![]})[_0xeb62('0x2e')](function(_0x206e77){return createVoicePrefixExtensions(_0x233715,_0x206e77,_0x2bbbff);});});});})[_0xeb62('0x2e')](function(){return db[_0xeb62('0x35')][_0xeb62('0x74')](_0x233715['id']);})[_0xeb62('0x2e')](respondWithResult(_0x2e4502,null))[_0xeb62('0x4c')](handleError(_0x2e4502,null));};exports[_0xeb62('0x75')]=function(_0x146174,_0x910940,_0x4c6b69){return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146174['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x910940,null))['then'](function(_0x32679a){if(_0x32679a){return _0x32679a[_0xeb62('0x75')](_0x146174[_0xeb62('0x53')][_0xeb62('0x76')],_[_0xeb62('0x77')](_0x146174[_0xeb62('0x53')],['ids','id'])||{})[_0xeb62('0x78')](function(_0x4fc07f){for(var _0x42ee4d=0x0;_0x42ee4d<_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x42ee4d+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':Number(_0x146174[_0xeb62('0x53')][_0xeb62('0x76')][_0x42ee4d]),'VoicePrefixId':Number(_0x146174[_0xeb62('0x4d')]['id'])});}return _0x4fc07f;});}})['then'](respondWithResult(_0x910940,null))[_0xeb62('0x4c')](handleError(_0x910940,null));};exports[_0xeb62('0x7a')]=function(_0x8a8ef3,_0x7ca547,_0x16c28d){return db[_0xeb62('0x35')]['find']({'where':{'id':_0x8a8ef3['params']['id']}})['then'](handleEntityNotFound(_0x7ca547,null))['then'](function(_0x5bf6f6){if(_0x5bf6f6){return _0x5bf6f6[_0xeb62('0x7a')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])[_0xeb62('0x2e')](function(){if(_[_0xeb62('0x7b')](_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')])){for(var _0x1c01ae=0x0;_0x1c01ae<_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0xeb62('0x3e')];_0x1c01ae+=0x1){socket[_0xeb62('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')][_0x1c01ae]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}}else{socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':Number(_0x8a8ef3[_0xeb62('0x39')][_0xeb62('0x76')]),'VoicePrefixId':Number(_0x8a8ef3[_0xeb62('0x4d')]['id'])});}});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x7ca547,null))[_0xeb62('0x4c')](handleError(_0x7ca547,null));};exports[_0xeb62('0x7d')]=function(_0x17beef,_0x45b2a3,_0x42c384){var _0xfff29b={};var _0x1cbfab={};var _0x29648f;var _0x2f5f2f;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x17beef['params']['id']}})[_0xeb62('0x2e')](handleEntityNotFound(_0x45b2a3,null))[_0xeb62('0x2e')](function(_0x48dcf6){if(_0x48dcf6){_0x29648f=_0x48dcf6;_0x1cbfab[_0xeb62('0x3f')]=_['keys'](db['User'][_0xeb62('0x4e')]);_0x1cbfab[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x17beef[_0xeb62('0x39')]);_0x1cbfab['filters']=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],_0x1cbfab['query']);_0xfff29b[_0xeb62('0x3c')]=_[_0xeb62('0x3b')](_0x1cbfab[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x17beef[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xfff29b[_0xeb62('0x3c')]=_0xfff29b[_0xeb62('0x3c')]['length']?_0xfff29b[_0xeb62('0x3c')]:_0x1cbfab[_0xeb62('0x3f')];_0xfff29b['order']=qs[_0xeb62('0x42')](_0x17beef['query']['sort']);_0xfff29b[_0xeb62('0x43')]=qs[_0xeb62('0x3a')](_[_0xeb62('0x44')](_0x17beef[_0xeb62('0x39')],_0x1cbfab[_0xeb62('0x3a')]));if(_0x17beef['query'][_0xeb62('0x45')]){_0xfff29b[_0xeb62('0x43')]=_[_0xeb62('0x46')](_0xfff29b[_0xeb62('0x43')],{'$or':_[_0xeb62('0x34')](_0xfff29b[_0xeb62('0x3c')],function(_0x401ad1){var _0x50170b={};_0x50170b[_0x401ad1]={'$like':'%'+_0x17beef['query']['filter']+'%'};return _0x50170b;})});}_0xfff29b=_[_0xeb62('0x46')]({},_0xfff29b,_0x17beef[_0xeb62('0x47')]);return _0x29648f[_0xeb62('0x7d')](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x599418){if(_0x599418){_0x2f5f2f=_0x599418[_0xeb62('0x3e')];if(!_0x17beef['query']['hasOwnProperty'](_0xeb62('0x7f'))){_0xfff29b[_0xeb62('0x26')]=qs['limit'](_0x17beef[_0xeb62('0x39')]['limit']);_0xfff29b[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x17beef[_0xeb62('0x39')]['offset']);}return _0x29648f['getAgents'](_0xfff29b);}})[_0xeb62('0x2e')](function(_0x276e06){if(_0x276e06){return _0x276e06?{'count':_0x2f5f2f,'rows':_0x276e06}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x45b2a3,null))['catch'](handleError(_0x45b2a3,null));};exports[_0xeb62('0x80')]=function(_0x162993,_0x3f5c93,_0x3b15ec){var _0xca3f0e={};var _0x2e4d99={};var _0x518655;var _0x4cd599;return db['VoicePrefix'][_0xeb62('0x7e')]({'where':{'id':_0x162993['params']['id']}})['then'](handleEntityNotFound(_0x3f5c93,null))[_0xeb62('0x2e')](function(_0x49d2c7){if(_0x49d2c7){_0x518655=_0x49d2c7;_0x2e4d99['model']=_['keys'](db[_0xeb62('0x81')]['rawAttributes']);_0x2e4d99[_0xeb62('0x39')]=_[_0xeb62('0x38')](_0x162993[_0xeb62('0x39')]);_0x2e4d99[_0xeb62('0x3a')]=_[_0xeb62('0x3b')](_0x2e4d99[_0xeb62('0x3f')],_0x2e4d99[_0xeb62('0x39')]);_0xca3f0e['attributes']=_['intersection'](_0x2e4d99[_0xeb62('0x3f')],qs[_0xeb62('0x3d')](_0x162993[_0xeb62('0x39')][_0xeb62('0x3d')]));_0xca3f0e[_0xeb62('0x3c')]=_0xca3f0e['attributes'][_0xeb62('0x3e')]?_0xca3f0e[_0xeb62('0x3c')]:_0x2e4d99[_0xeb62('0x3f')];_0xca3f0e['order']=qs[_0xeb62('0x42')](_0x162993['query'][_0xeb62('0x42')]);_0xca3f0e[_0xeb62('0x43')]=qs['filters'](_['pick'](_0x162993[_0xeb62('0x39')],_0x2e4d99[_0xeb62('0x3a')]));if(_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]){_0xca3f0e['where']=_[_0xeb62('0x46')](_0xca3f0e[_0xeb62('0x43')],{'$or':_['map'](_0xca3f0e['attributes'],function(_0x12adf6){var _0x1b9569={};_0x1b9569[_0x12adf6]={'$like':'%'+_0x162993[_0xeb62('0x39')][_0xeb62('0x45')]+'%'};return _0x1b9569;})});}_0xca3f0e=_[_0xeb62('0x46')]({},_0xca3f0e,_0x162993[_0xeb62('0x47')]);return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})[_0xeb62('0x2e')](function(_0x144bc8){if(_0x144bc8){_0x4cd599=_0x144bc8[_0xeb62('0x3e')];if(!_0x162993[_0xeb62('0x39')][_0xeb62('0x40')](_0xeb62('0x7f'))){_0xca3f0e[_0xeb62('0x26')]=qs[_0xeb62('0x26')](_0x162993[_0xeb62('0x39')]['limit']);_0xca3f0e[_0xeb62('0x24')]=qs[_0xeb62('0x24')](_0x162993[_0xeb62('0x39')][_0xeb62('0x24')]);}return _0x518655[_0xeb62('0x80')](_0xca3f0e);}})['then'](function(_0x54984f){if(_0x54984f){return _0x54984f?{'count':_0x4cd599,'rows':_0x54984f}:null;}})[_0xeb62('0x2e')](respondWithResult(_0x3f5c93,null))[_0xeb62('0x4c')](handleError(_0x3f5c93,null));};exports[_0xeb62('0x82')]=function(_0x3d957d,_0x5af4d7,_0x3a0b12){var _0x5f2c1e=_0x3d957d[_0xeb62('0x53')][_0xeb62('0x76')];var _0x3409db;return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x5f2c1e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb62('0x83'),'attributes':['id',_0xeb62('0x31'),'online',_0xeb62('0x84'),'interface'],'raw':!![]}]})[_0xeb62('0x2e')](function(_0x43107d){if(_0x43107d){_0x3409db=_0x43107d;var _0x2e503b=_[_0xeb62('0x85')](_0x43107d,function(_0x45a197){var _0x3394e6=_0x45a197['get']({'plain':!![]});return _0x3394e6['Agents'];});return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x3d957d[_0xeb62('0x4d')]['id']}})[_0xeb62('0x2e')](function(_0x582217){return db['sequelize'][_0xeb62('0x73')](function(_0x527de3){return _0x582217[_0xeb62('0x82')](_0x5f2c1e,{'transaction':_0x527de3})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x3409db,function(_0x5e43f0){return db[_0xeb62('0x87')][_0xeb62('0x88')]({'TeamId':_0x5e43f0['id'],'VoicePrefixId':_0x3d957d[_0xeb62('0x4d')]['id']},{'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){return BPromise[_0xeb62('0x86')](_0x2e503b,function(_0x10731b){return db[_0xeb62('0x89')][_0xeb62('0x8a')]({'where':{'UserId':_0x10731b['id'],'VoicePrefixId':_0x3d957d['params']['id']},'transaction':_0x527de3});});})[_0xeb62('0x2e')](function(){_0x2e503b[_0xeb62('0x8b')](function(_0x35d372){socket[_0xeb62('0x79')]('userVoicePrefix:save',{'UserId':_0x35d372['id'],'VoicePrefixId':_0x582217['id']});});});});});}})[_0xeb62('0x2e')](respondWithStatusCode(_0x5af4d7,null))[_0xeb62('0x4c')](handleError(_0x5af4d7,null));};exports[_0xeb62('0x8c')]=function(_0x146c7e,_0x24c285,_0x59bb00){return db[_0xeb62('0x81')][_0xeb62('0x4a')]({'where':{'id':_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')]},'attributes':['id'],'include':[{'model':db[_0xeb62('0x8d')],'as':_0xeb62('0x83'),'attributes':['id'],'raw':!![]}]})[_0xeb62('0x2e')](handleEntityNotFound(_0x24c285,null))[_0xeb62('0x2e')](function(_0x30625f){var _0x94d0c9=_['map'](_0x30625f,'id');var _0x3ae667=[];var _0x3338ba=[];var _0x50cf9b=squel['select']();_0x50cf9b[_0xeb62('0x8e')](_0xeb62('0x8f'))[_0xeb62('0x90')](_0xeb62('0x91'),'tq')[_0xeb62('0x92')](_0xeb62('0x93'),'ut',_0xeb62('0x94'))[_0xeb62('0x43')](_0xeb62('0x95'),_0x146c7e['params']['id']);for(var _0x535e7a=0x0;_0x535e7a<_0x30625f[_0xeb62('0x3e')];_0x535e7a+=0x1){let _0x43daef=_0x30625f[_0x535e7a];for(var _0x58ffb2=0x0;_0x58ffb2<_0x43daef['Agents'][_0xeb62('0x3e')];_0x58ffb2+=0x1){let _0x341bd8=_0x43daef[_0xeb62('0x83')][_0x58ffb2];var _0x55ef9d=_0x50cf9b['clone']();_0x55ef9d[_0xeb62('0x43')]('ut.UserId\x20=\x20?',_0x341bd8['id']);_0x3338ba[_0xeb62('0x6a')](db[_0xeb62('0x52')][_0xeb62('0x39')](_0x55ef9d['toString'](),{'type':db['sequelize']['QueryTypes'][_0xeb62('0x96')]})[_0xeb62('0x2e')](function(_0x3517db){if(_0x3517db[_0xeb62('0x3e')]===0x1){return _0x341bd8['id'];}else{var _0x5bd3b6=_[_0xeb62('0x97')](_[_0xeb62('0x34')](_0x3517db,_0xeb62('0x98')),function(_0x22eb23){return _[_0xeb62('0x99')](_0x94d0c9,_0x22eb23);});if(_0x5bd3b6){return _0x341bd8['id'];}}}));}}return BPromise[_0xeb62('0x9a')](_0x3338ba)[_0xeb62('0x2e')](function(_0x394573){_0x3ae667=_(_0x3ae667)['union'](_0x394573)[_0xeb62('0x9b')]()[_0xeb62('0x9c')]();return db[_0xeb62('0x35')][_0xeb62('0x4f')]({'where':{'id':_0x146c7e['params']['id']}})[_0xeb62('0x2e')](function(_0x1f84f0){return db['sequelize'][_0xeb62('0x73')](function(_0x26b456){return _0x1f84f0[_0xeb62('0x8c')](_0x146c7e[_0xeb62('0x39')][_0xeb62('0x76')],{'transaction':_0x26b456})[_0xeb62('0x2e')](function(){if(!_[_0xeb62('0x9d')](_0x3ae667)){return _0x1f84f0['removeAgents'](_0x3ae667,{'transaction':_0x26b456});}})[_0xeb62('0x2e')](function(){_0x3ae667['forEach'](function(_0x3578a9){socket[_0xeb62('0x79')](_0xeb62('0x7c'),{'UserId':_0x3578a9,'VoicePrefixId':_0x1f84f0['id']});});});});});});})['then'](respondWithStatusCode(_0x24c285,null))['catch'](handleError(_0x24c285,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 82343a7..5ef8de6 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b39=['save','update','remove','emit','events','../../mysqldb','setMaxListeners'];(function(_0x4d08a2,_0x4364f0){var _0x19f095=function(_0x223565){while(--_0x223565){_0x4d08a2['push'](_0x4d08a2['shift']());}};_0x19f095(++_0x4364f0);}(_0x8b39,0x6d));var _0x98b3=function(_0x306877,_0x52bebc){_0x306877=_0x306877-0x0;var _0x3df112=_0x8b39[_0x306877];return _0x3df112;};'use strict';var EventEmitter=require(_0x98b3('0x0'));var VoicePrefix=require(_0x98b3('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x98b3('0x2')](0x0);var events={'afterCreate':_0x98b3('0x3'),'afterUpdate':_0x98b3('0x4'),'afterDestroy':_0x98b3('0x5')};function emitEvent(_0x191fbd){return function(_0x47e6a1,_0x540fc1,_0x35ec96){VoicePrefixEvents[_0x98b3('0x6')](_0x191fbd+':'+_0x47e6a1['id'],_0x47e6a1);VoicePrefixEvents[_0x98b3('0x6')](_0x191fbd,_0x47e6a1);_0x35ec96(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xa3e8=['hook','exports','events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty'];(function(_0x4ace0e,_0x7f30a8){var _0x376e23=function(_0x3801a3){while(--_0x3801a3){_0x4ace0e['push'](_0x4ace0e['shift']());}};_0x376e23(++_0x7f30a8);}(_0xa3e8,0xd4));var _0x8a3e=function(_0x52ba2a,_0x1583b9){_0x52ba2a=_0x52ba2a-0x0;var _0x1e2b30=_0xa3e8[_0x52ba2a];return _0x1e2b30;};'use strict';var EventEmitter=require(_0x8a3e('0x0'));var VoicePrefix=require(_0x8a3e('0x1'))['db'][_0x8a3e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a3e('0x3'),'afterUpdate':_0x8a3e('0x4'),'afterDestroy':_0x8a3e('0x5')};function emitEvent(_0x20ed95){return function(_0x338fb1,_0x5aeacf,_0x1c1e6c){VoicePrefixEvents[_0x8a3e('0x6')](_0x20ed95+':'+_0x338fb1['id'],_0x338fb1);VoicePrefixEvents[_0x8a3e('0x6')](_0x20ed95,_0x338fb1);_0x1c1e6c(null);};}for(var e in events){if(events[_0x8a3e('0x7')](e)){var event=events[e];VoicePrefix[_0x8a3e('0x8')](e,emitEvent(event));}}module[_0x8a3e('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7e34fe1..2c84141 100644 --- a/server/api/voicePrefix/voicePrefix.model.js +++ b/server/api/voicePrefix/voicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb72f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes','lodash'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xb72f,0x143));var _0xfb72=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0xb72f[_0x189c9e];return _0x3f38ca;};'use strict';var _=require(_0xfb72('0x0'));var util=require(_0xfb72('0x1'));var logger=require('../../config/logger')(_0xfb72('0x2'));var moment=require(_0xfb72('0x3'));var BPromise=require(_0xfb72('0x4'));var rp=require(_0xfb72('0x5'));var fs=require('fs');var path=require(_0xfb72('0x6'));var rimraf=require(_0xfb72('0x7'));var config=require(_0xfb72('0x8'));var attributes=require('./voicePrefix.attributes');module[_0xfb72('0x9')]=function(_0x4e73ce,_0x3a0653){return _0x4e73ce['define'](_0xfb72('0xa'),attributes,{'tableName':_0xfb72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd97=['path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','util','api','moment'];(function(_0x1c1741,_0x3982dc){var _0x5234c9=function(_0x10e143){while(--_0x10e143){_0x1c1741['push'](_0x1c1741['shift']());}};_0x5234c9(++_0x3982dc);}(_0xfd97,0x6a));var _0x7fd9=function(_0x2db2e4,_0x49130e){_0x2db2e4=_0x2db2e4-0x0;var _0x2ef52d=_0xfd97[_0x2db2e4];return _0x2ef52d;};'use strict';var _=require(_0x7fd9('0x0'));var util=require(_0x7fd9('0x1'));var logger=require('../../config/logger')(_0x7fd9('0x2'));var moment=require(_0x7fd9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fd9('0x4'));var rimraf=require(_0x7fd9('0x5'));var config=require(_0x7fd9('0x6'));var attributes=require(_0x7fd9('0x7'));module['exports']=function(_0x2b7e4e,_0x8de7e0){return _0x2b7e4e[_0x7fd9('0x8')](_0x7fd9('0x9'),attributes,{'tableName':_0x7fd9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 0c94fbf..c6f6aac 100644 --- a/server/api/voicePrefix/voicePrefix.rpc.js +++ b/server/api/voicePrefix/voicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8277=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x68f830,_0x48f032){var _0x445463=function(_0x17341d){while(--_0x17341d){_0x68f830['push'](_0x68f830['shift']());}};_0x445463(++_0x48f032);}(_0x8277,0xcf));var _0x7827=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x8277[_0x525af9];return _0x129fbf;};'use strict';var _=require('lodash');var util=require(_0x7827('0x0'));var moment=require(_0x7827('0x1'));var BPromise=require('bluebird');var rs=require(_0x7827('0x2'));var fs=require('fs');var Redis=require(_0x7827('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7827('0x4'));var logger=require(_0x7827('0x5'))('rpc');var config=require(_0x7827('0x6'));var jayson=require(_0x7827('0x7'));var client=jayson[_0x7827('0x8')]['http']({'port':0x232a});config[_0x7827('0x9')]=_[_0x7827('0xa')](config[_0x7827('0x9')],{'host':_0x7827('0xb'),'port':0x18eb});var socket=require(_0x7827('0xc'))(new Redis(config[_0x7827('0x9')]));require(_0x7827('0xd'))[_0x7827('0xe')](socket);function respondWithRpcPromise(_0xfd2a88,_0x2392d8,_0x2abc26){return new BPromise(function(_0x4472b2,_0x21f5d5){return client[_0x7827('0xf')](_0xfd2a88,_0x2abc26)['then'](function(_0x457717){logger[_0x7827('0x10')](_0x7827('0x11'),_0x2392d8,_0x7827('0x12'));logger['debug'](_0x7827('0x13'),_0x2392d8,_0x7827('0x12'),JSON[_0x7827('0x14')](_0x457717));if(_0x457717[_0x7827('0x15')]){if(_0x457717[_0x7827('0x15')][_0x7827('0x16')]===0x1f4){logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x457717[_0x7827('0x15')][_0x7827('0x17')]);return _0x21f5d5(_0x457717[_0x7827('0x15')][_0x7827('0x17')]);}logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x457717[_0x7827('0x15')]['message']);return _0x4472b2(_0x457717[_0x7827('0x15')][_0x7827('0x17')]);}else{logger[_0x7827('0x10')](_0x7827('0x11'),_0x2392d8,_0x7827('0x12'));_0x4472b2(_0x457717[_0x7827('0x18')][_0x7827('0x17')]);}})[_0x7827('0x19')](function(_0x4f6500){logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x4f6500);_0x21f5d5(_0x4f6500);});});} \ No newline at end of file +var _0x07e8=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','register','request'];(function(_0x3d88c7,_0xd11bba){var _0x3af2b0=function(_0x4d054e){while(--_0x4d054e){_0x3d88c7['push'](_0x3d88c7['shift']());}};_0x3af2b0(++_0xd11bba);}(_0x07e8,0x10f));var _0x807e=function(_0x55e5b9,_0x1be20e){_0x55e5b9=_0x55e5b9-0x0;var _0x58d1e7=_0x07e8[_0x55e5b9];return _0x58d1e7;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});config[_0x807e('0x9')]=_[_0x807e('0xa')](config[_0x807e('0x9')],{'host':_0x807e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x807e('0x9')]));require(_0x807e('0xc'))[_0x807e('0xd')](socket);function respondWithRpcPromise(_0x3c6c7a,_0x1c2fdd,_0x45e953){return new BPromise(function(_0x382931,_0x2f44db){return client[_0x807e('0xe')](_0x3c6c7a,_0x45e953)[_0x807e('0xf')](function(_0x2ca6f0){logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,_0x807e('0x12'));logger['debug'](_0x807e('0x13'),_0x1c2fdd,_0x807e('0x12'),JSON[_0x807e('0x14')](_0x2ca6f0));if(_0x2ca6f0[_0x807e('0x15')]){if(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x16')]===0x1f4){logger[_0x807e('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0['error'][_0x807e('0x17')]);return _0x2f44db(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}logger[_0x807e('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);return _0x382931(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}else{logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,'request\x20sent');_0x382931(_0x2ca6f0[_0x807e('0x18')]['message']);}})[_0x807e('0x19')](function(_0x328290){logger[_0x807e('0x15')](_0x807e('0x11'),_0x1c2fdd,_0x328290);_0x2f44db(_0x328290);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 51f28c6..123c38d 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6822=['removeListener','register','length','voicePrefix:','save','remove','update','emit'];(function(_0x19f8c3,_0x3c0929){var _0x7fbf45=function(_0x3bf477){while(--_0x3bf477){_0x19f8c3['push'](_0x19f8c3['shift']());}};_0x7fbf45(++_0x3c0929);}(_0x6822,0x18c));var _0x2682=function(_0x5261a3,_0x32396e){_0x5261a3=_0x5261a3-0x0;var _0x215439=_0x6822[_0x5261a3];return _0x215439;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x2682('0x0'),_0x2682('0x1'),_0x2682('0x2')];function createListener(_0x3d51df,_0x5ccdb9){return function(_0x2ac70f){_0x5ccdb9[_0x2682('0x3')](_0x3d51df,_0x2ac70f);};}function removeListener(_0x451ea4,_0x355645){return function(){VoicePrefixEvents[_0x2682('0x4')](_0x451ea4,_0x355645);};}exports[_0x2682('0x5')]=function(_0x15040a){for(var _0x24978b=0x0,_0x35f55b=events[_0x2682('0x6')];_0x24978b<_0x35f55b;_0x24978b++){var _0x4242c5=events[_0x24978b];var _0x1a1307=createListener(_0x2682('0x7')+_0x4242c5,_0x15040a);VoicePrefixEvents['on'](_0x4242c5,_0x1a1307);}}; \ No newline at end of file +var _0x983c=['removeListener','register','length','./voicePrefix.events','save','remove','update','emit'];(function(_0x22652c,_0x277c63){var _0x4070b8=function(_0x533a70){while(--_0x533a70){_0x22652c['push'](_0x22652c['shift']());}};_0x4070b8(++_0x277c63);}(_0x983c,0xf3));var _0xc983=function(_0x4ece58,_0x50922a){_0x4ece58=_0x4ece58-0x0;var _0x20d209=_0x983c[_0x4ece58];return _0x20d209;};'use strict';var VoicePrefixEvents=require(_0xc983('0x0'));var events=[_0xc983('0x1'),_0xc983('0x2'),_0xc983('0x3')];function createListener(_0x27efe2,_0x59dc7d){return function(_0xaa635b){_0x59dc7d[_0xc983('0x4')](_0x27efe2,_0xaa635b);};}function removeListener(_0x14b999,_0x2e8c5d){return function(){VoicePrefixEvents[_0xc983('0x5')](_0x14b999,_0x2e8c5d);};}exports[_0xc983('0x6')]=function(_0x3897b9){for(var _0x541e6f=0x0,_0x346933=events[_0xc983('0x7')];_0x541e6f<_0x346933;_0x541e6f++){var _0x141900=events[_0x541e6f];var _0x11cd44=createListener('voicePrefix:'+_0x141900,_0x3897b9);VoicePrefixEvents['on'](_0x141900,_0x11cd44);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8382fad..60a53f2 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3d2438,_0x2e7922){var _0xd18de5=function(_0xe8a130){while(--_0xe8a130){_0x3d2438['push'](_0x3d2438['shift']());}};_0xd18de5(++_0x2e7922);}(_0xb10b,0x12a));var _0xbb10=function(_0xc2dccb,_0x5957f2){_0xc2dccb=_0xc2dccb-0x0;var _0x3239b3=_0xb10b[_0xc2dccb];return _0x3239b3;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x5a35b8,_0x3392ac){var _0xd2709b=function(_0x220512){while(--_0x220512){_0x5a35b8['push'](_0x5a35b8['shift']());}};_0xd2709b(++_0x3392ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 56e8ce3..ffc6806 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1da=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','INTEGER','yes','all','TEXT','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x388791,_0x535534){var _0xafcd24=function(_0x6a9595){while(--_0x6a9595){_0x388791['push'](_0x388791['shift']());}};_0xafcd24(++_0x535534);}(_0xf1da,0x10d));var _0xaf1d=function(_0x6bec06,_0x30b172){_0x6bec06=_0x6bec06-0x0;var _0x30e317=_0xf1da[_0x6bec06];return _0x30e317;};'use strict';var Sequelize=require(_0xaf1d('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf1d('0x1')],'allowNull':![],'unique':_0xaf1d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':_0xaf1d('0x5')},'announce':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xaf1d('0x6'),_0xaf1d('0x7'),_0xaf1d('0x8'),_0xaf1d('0x9'),_0xaf1d('0xa'),_0xaf1d('0xb'),_0xaf1d('0xc'),_0xaf1d('0xd')),'allowNull':![],'defaultValue':_0xaf1d('0x6'),'set':function(_0x270ac9){this[_0xaf1d('0xe')](_0xaf1d('0xf'),_0x270ac9?_0x270ac9:_0xaf1d('0xa'));},'get':function(){var _0x2ac5c5=this[_0xaf1d('0x10')](_0xaf1d('0x11'));var _0x4c483c=this[_0xaf1d('0x10')](_0xaf1d('0x12'));var _0x35976a=this[_0xaf1d('0x10')]('strategy');if(_0x2ac5c5==='outbound'){if(_0x4c483c===_0xaf1d('0x13')){return null;}if(_0x4c483c===_0xaf1d('0x14')&&!['rrmemory',_0xaf1d('0x15')]['includes'](_0x35976a)){this[_0xaf1d('0xe')](_0xaf1d('0xf'),_0xaf1d('0xa'));}}return _0x35976a;}},'servicelevel':{'type':Sequelize[_0xaf1d('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xaf1d('0x16')](0xb)},'timeout':{'type':Sequelize[_0xaf1d('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xaf1d('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xaf1d('0x1')]},'weight':{'type':Sequelize[_0xaf1d('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no'),'defaultValue':_0xaf1d('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xaf1d('0x17'),'no',_0xaf1d('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xaf1d('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xaf1d('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xaf1d('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xaf1d('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xaf1d('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xaf1d('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xaf1d('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xaf1d('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xaf1d('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xaf1d('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xaf1d('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xaf1d('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xaf1d('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xaf1d('0x1')]},'queue_less_than':{'type':Sequelize[_0xaf1d('0x1')]},'periodic_announce':{'type':Sequelize[_0xaf1d('0x19')],'set':function(_0x3f3325){this[_0xaf1d('0xe')]('periodic_announce',_0x3f3325?_0x3f3325['join'](','):[]);},'get':function(){return this[_0xaf1d('0x10')](_0xaf1d('0x1a'))?this[_0xaf1d('0x10')](_0xaf1d('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':_0xaf1d('0x17'),'set':function(_0x36fd3c){this[_0xaf1d('0xe')](_0xaf1d('0x1b'),_0x36fd3c?_0x36fd3c[_0xaf1d('0x1c')](','):undefined);},'get':function(){return this[_0xaf1d('0x10')](_0xaf1d('0x1b'))?this['getDataValue'](_0xaf1d('0x1b'))[_0xaf1d('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':'no','set':function(_0x38a3e0){this[_0xaf1d('0xe')](_0xaf1d('0x1e'),_0x38a3e0?_0x38a3e0[_0xaf1d('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xaf1d('0x1e'))?this[_0xaf1d('0x10')](_0xaf1d('0x1e'))[_0xaf1d('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xaf1d('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xaf1d('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xaf1d('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf1d('0x1')]},'acw':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':0x0,'set':function(_0x3633f7){this[_0xaf1d('0xe')](_0xaf1d('0x20'),_0x3633f7);if(_0x3633f7){if(this[_0xaf1d('0x10')](_0xaf1d('0x21'))<0x2){this[_0xaf1d('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xaf1d('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':0x0,'comment':_0xaf1d('0x22')},'dialMethod':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x13'),_0xaf1d('0x23'),_0xaf1d('0x24'),_0xaf1d('0x25'),_0xaf1d('0x14')),'defaultValue':_0xaf1d('0x23'),'comment':_0xaf1d('0x26')},'dialLimitChannel':{'type':Sequelize[_0xaf1d('0x16')](0x4)[_0xaf1d('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf1d('0x28')},'dialLimitQueue':{'type':Sequelize[_0xaf1d('0x16')](0x4)[_0xaf1d('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf1d('0x29')},'dialPowerLevel':{'type':Sequelize[_0xaf1d('0x2a')](0x2)[_0xaf1d('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xaf1d('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x2c'),_0xaf1d('0x2d')),'defaultValue':'dropRate','comment':_0xaf1d('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xaf1d('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0xaf1d('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xaf1d('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0xaf1d('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaf1d('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x31')},'dialQueueOptions':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':_0xaf1d('0x32'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x33')},'dialQueueProject':{'type':Sequelize[_0xaf1d('0x1')],'comment':_0xaf1d('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf1d('0x36')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x37')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaf1d('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xaf1d('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaf1d('0x39')},'dialTimezone':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':_0xaf1d('0x3a')},'dialPrefix':{'type':Sequelize[_0xaf1d('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xaf1d('0x3')]('always',_0xaf1d('0x3b'),_0xaf1d('0x3c')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xaf1d('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0xaf1d('0x16')](0x9)[_0xaf1d('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaf1d('0x3e')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xaf1d('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaf1d('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaf1d('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaf1d('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaf1d('0x16')](0x9)[_0xaf1d('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf1d('0x41')},'dialAMDMinWordLength':{'type':Sequelize[_0xaf1d('0x16')](0x9)[_0xaf1d('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xaf1d('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaf1d('0x16')](0x9)[_0xaf1d('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xaf1d('0x43')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaf1d('0x16')](0x9)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaf1d('0x44')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaf1d('0x45')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaf1d('0x16')](0x9)[_0xaf1d('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf1d('0x46')},'dialRecallMeTimeout':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xaf1d('0x47')},'dialRecallInQueue':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':0x0,'comment':_0xaf1d('0x48')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaf1d('0x3')](_0xaf1d('0x49'),'ASC'),'defaultValue':_0xaf1d('0x49')},'dialQueueProject2':{'type':Sequelize[_0xaf1d('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xaf1d('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf1d('0x4a')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf1d('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x4d')},'dialDropRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x4f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf1d('0x50')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf1d('0x51')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaf1d('0x16')](0x5)[_0xaf1d('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf1d('0x52')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaf1d('0x16')],'allowNull':!![],'comment':_0xaf1d('0x53')},'mandatoryDisposition':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':![],'comment':_0xaf1d('0x54'),'set':function(_0x52542b){if(!_0x52542b)this[_0xaf1d('0xe')](_0xaf1d('0x55'),null);this[_0xaf1d('0xe')](_0xaf1d('0x56'),_0x52542b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xaf1d('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xaf1d('0x16')](0x3)[_0xaf1d('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xaf1d('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xaf1d('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x25a6=['wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','ringall','random','rrmemory','linear','rrordered','setDataValue','getDataValue','type','preview','booked','roundrobin','includes','strategy','INTEGER','ENUM','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','acw'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x25a6,0x1c1));var _0x625a=function(_0x17bdad,_0x56d508){_0x17bdad=_0x17bdad-0x0;var _0x5b188a=_0x25a6[_0x17bdad];return _0x5b188a;};'use strict';var Sequelize=require(_0x625a('0x0'));module[_0x625a('0x1')]={'name':{'type':Sequelize[_0x625a('0x2')],'allowNull':![],'unique':_0x625a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x625a('0x4'),_0x625a('0x5')),'allowNull':![],'defaultValue':_0x625a('0x4')},'musiconhold':{'type':Sequelize[_0x625a('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x625a('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x625a('0x6'),'leastrecent','fewestcalls',_0x625a('0x7'),_0x625a('0x8'),_0x625a('0x9'),'wrandom',_0x625a('0xa')),'allowNull':![],'defaultValue':_0x625a('0x6'),'set':function(_0x5403bf){this[_0x625a('0xb')]('strategy',_0x5403bf?_0x5403bf:_0x625a('0x8'));},'get':function(){var _0x588235=this[_0x625a('0xc')](_0x625a('0xd'));var _0x3b12c6=this[_0x625a('0xc')]('dialMethod');var _0x305b7b=this[_0x625a('0xc')]('strategy');if(_0x588235==='outbound'){if(_0x3b12c6===_0x625a('0xe')){return null;}if(_0x3b12c6===_0x625a('0xf')&&![_0x625a('0x8'),_0x625a('0x10')][_0x625a('0x11')](_0x305b7b)){this[_0x625a('0xb')](_0x625a('0x12'),'rrmemory');}}return _0x305b7b;}},'servicelevel':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x625a('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x625a('0x13')](0xb)},'timeout':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x625a('0x2')]},'weight':{'type':Sequelize[_0x625a('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defaultValue':_0x625a('0x15')},'autopause':{'type':Sequelize['ENUM'](_0x625a('0x15'),'no',_0x625a('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x625a('0x13')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x625a('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x625a('0x14')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x625a('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x625a('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x625a('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defaultValue':_0x625a('0x15')},'announce_holdtime':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no',_0x625a('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x625a('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x625a('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x625a('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x625a('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x625a('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x625a('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x625a('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x625a('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x625a('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x625a('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x625a('0x2')]},'queue_quantity1':{'type':Sequelize[_0x625a('0x2')]},'queue_quantity2':{'type':Sequelize[_0x625a('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x625a('0x18')],'set':function(_0x16b106){this[_0x625a('0xb')](_0x625a('0x19'),_0x16b106?_0x16b106[_0x625a('0x1a')](','):[]);},'get':function(){return this[_0x625a('0xc')]('periodic_announce')?this[_0x625a('0xc')](_0x625a('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x625a('0x2')],'defaultValue':_0x625a('0x15'),'set':function(_0x3d7dde){this[_0x625a('0xb')](_0x625a('0x1b'),_0x3d7dde?_0x3d7dde[_0x625a('0x1a')](','):undefined);},'get':function(){return this[_0x625a('0xc')](_0x625a('0x1b'))?this['getDataValue']('joinempty')[_0x625a('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1b1684){this[_0x625a('0xb')](_0x625a('0x1d'),_0x1b1684?_0x1b1684[_0x625a('0x1a')](','):undefined);},'get':function(){return this[_0x625a('0xc')]('leavewhenempty')?this[_0x625a('0xc')]('leavewhenempty')[_0x625a('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x625a('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x135905){this[_0x625a('0xb')](_0x625a('0x1e'),_0x135905);if(_0x135905){if(this['getDataValue'](_0x625a('0x1f'))<0x2){this['setDataValue'](_0x625a('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x625a('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x625a('0x20')],'defaultValue':0x0,'comment':_0x625a('0x21')},'dialMethod':{'type':Sequelize[_0x625a('0x14')]('preview',_0x625a('0x22'),_0x625a('0x23'),'predictive',_0x625a('0xf')),'defaultValue':_0x625a('0x22'),'comment':_0x625a('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x625a('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x625a('0x13')](0x4)[_0x625a('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x625a('0x26')},'dialPowerLevel':{'type':Sequelize[_0x625a('0x27')](0x2)[_0x625a('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x625a('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x625a('0x14')](_0x625a('0x29'),'dropRate'),'defaultValue':_0x625a('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x625a('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x625a('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x625a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x625a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x625a('0x2')],'defaultValue':'tTxX','comment':_0x625a('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x2e')},'dialQueueProject':{'type':Sequelize[_0x625a('0x2')],'comment':_0x625a('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x625a('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x625a('0x13')](0x5)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x625a('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x3,'comment':_0x625a('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x625a('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x625a('0x35')},'dialTimezone':{'type':Sequelize[_0x625a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x625a('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x625a('0x14')]('always',_0x625a('0x37'),'onlyIfOpen'),'defaultValue':_0x625a('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x625a('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x625a('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x625a('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x625a('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x625a('0x13')](0x9)[_0x625a('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x625a('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x625a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x625a('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x625a('0x13')](0x9)[_0x625a('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x625a('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x625a('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x625a('0x13')](0x9)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x625a('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x625a('0x13')](0x9)[_0x625a('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x625a('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x625a('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x625a('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x625a('0x41'),_0x625a('0x42')),'defaultValue':_0x625a('0x41')},'dialQueueProject2':{'type':Sequelize[_0x625a('0x2')],'comment':_0x625a('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x625a('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x625a('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x625a('0x43')},'dialCutDigit':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x625a('0x13')](0x5)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x625a('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x625a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x625a('0x13')](0x5)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x625a('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x625a('0x13')](0x5)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x625a('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x625a('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x625a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x625a('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x625a('0x13')](0x5)[_0x625a('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x625a('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x625a('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x625a('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b1b60){if(!_0x1b1b60)this['setDataValue'](_0x625a('0x4e'),null);this[_0x625a('0xb')](_0x625a('0x4f'),_0x1b1b60);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x625a('0x13')](0x3)[_0x625a('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x625a('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x625a('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x625a('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 94f617f..578224c 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4300=['always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','scheduledAt','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','find','type','error','stack','name','send','index','VoiceQueue','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','include','omit','createdAt','updatedAt','role','UserProfileSection','userProfileId','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','transaction','addAgents','spread','isNil','format','removeAgents','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType'];(function(_0x46b29b,_0x556274){var _0x23c7f7=function(_0x522d07){while(--_0x522d07){_0x46b29b['push'](_0x46b29b['shift']());}};_0x23c7f7(++_0x556274);}(_0x4300,0x1a6));var _0x0430=function(_0x1ffd3f,_0x1ebdce){_0x1ffd3f=_0x1ffd3f-0x0;var _0x519f9f=_0x4300[_0x1ffd3f];return _0x519f9f;};'use strict';var emlformat=require(_0x0430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0430('0x1'));var BPromise=require(_0x0430('0x2'));var Mustache=require(_0x0430('0x3'));var util=require(_0x0430('0x4'));var path=require(_0x0430('0x5'));var sox=require('sox');var csv=require(_0x0430('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0430('0x7'));var _=require('lodash');var squel=require(_0x0430('0x8'));var crypto=require(_0x0430('0x9'));var jsforce=require(_0x0430('0xa'));var deskjs=require(_0x0430('0xb'));var toCsv=require(_0x0430('0x6'));var querystring=require(_0x0430('0xc'));var Papa=require(_0x0430('0xd'));var Redis=require(_0x0430('0xe'));var authService=require(_0x0430('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0430('0x10'));var hardwareService=require(_0x0430('0x11'));var logger=require(_0x0430('0x12'))(_0x0430('0x13'));var utils=require(_0x0430('0x14'));var config=require(_0x0430('0x15'));var licenseUtil=require(_0x0430('0x16'));var db=require(_0x0430('0x17'))['db'];config['redis']=_['defaults'](config[_0x0430('0x18')],{'host':_0x0430('0x19'),'port':0x18eb});var socket=require(_0x0430('0x1a'))(new Redis(config[_0x0430('0x18')]));require(_0x0430('0x1b'))[_0x0430('0x1c')](socket);function respondWithStatusCode(_0x182e2c,_0x54e15c){_0x54e15c=_0x54e15c||0xcc;return function(_0xb34f43){if(_0xb34f43){return _0x182e2c[_0x0430('0x1d')](_0x54e15c);}return _0x182e2c[_0x0430('0x1e')](_0x54e15c)[_0x0430('0x1f')]();};}function respondWithResult(_0x5c98c9,_0x57b648){_0x57b648=_0x57b648||0xc8;return function(_0x48568a){if(_0x48568a){return _0x5c98c9[_0x0430('0x1e')](_0x57b648)['json'](_0x48568a);}};}function respondWithFilteredResult(_0x495094,_0x1a3239){return function(_0x2f23b9){if(_0x2f23b9){var _0x391791=typeof _0x1a3239[_0x0430('0x20')]===_0x0430('0x21')&&typeof _0x1a3239['limit']==='undefined';var _0xf11cda=_0x2f23b9[_0x0430('0x22')];var _0x35ffdb=_0x391791?0x0:_0x1a3239[_0x0430('0x20')];var _0x5f3c68=_0x391791?_0x2f23b9['count']:_0x1a3239[_0x0430('0x20')]+_0x1a3239[_0x0430('0x23')];var _0x301992;if(_0x5f3c68>=_0xf11cda){_0x5f3c68=_0xf11cda;_0x301992=0xc8;}else{_0x301992=0xce;}_0x495094[_0x0430('0x1e')](_0x301992);return _0x495094[_0x0430('0x24')](_0x0430('0x25'),_0x35ffdb+'-'+_0x5f3c68+'/'+_0xf11cda)['json'](_0x2f23b9);}return null;};}function patchUpdates(_0x11160f){return function(_0x350766){try{jsonpatch[_0x0430('0x26')](_0x350766,_0x11160f,!![]);}catch(_0x1d5b51){return BPromise['reject'](_0x1d5b51);}return _0x350766[_0x0430('0x27')]();};}function saveUpdates(_0x28faa2,_0x3c4ba8){return function(_0x2a8c5b){if(_0x2a8c5b){return _0x2a8c5b[_0x0430('0x28')](_0x28faa2)[_0x0430('0x29')](function(_0x345b8c){return _0x345b8c;});}return null;};}function removeEntity(_0x3e74d8,_0x36ff02){return function(_0x58b343){if(_0x58b343){return _0x58b343[_0x0430('0x2a')]()['then'](function(){var _0x5a79d6=_0x58b343[_0x0430('0x2b')]({'plain':!![]});var _0x460819=[{'name':'VoiceQueues','value':_0x0430('0x2c'),'ignore':![]},{'name':_0x0430('0x2d'),'value':_0x0430('0x2e'),'ignore':![]}];var _0x3b20d1=_(_0x460819)[_0x0430('0x2f')](_0x0430('0x30'))[_0x0430('0x31')](_0x0430('0x32'))[_0x0430('0x32')]();if(_['includes'](_0x3b20d1,_0x5a79d6['type'])){return;}var _0x5960d2=_[_0x0430('0x33')](_0x460819,['value',_0x5a79d6[_0x0430('0x34')]])['name'];return db['UserProfileResource'][_0x0430('0x2a')]({'where':{'type':_0x5960d2,'resourceId':_0x5a79d6['id']}})[_0x0430('0x29')](function(){return _0x58b343;});})[_0x0430('0x29')](function(){_0x3e74d8[_0x0430('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8311,_0x1b2b7c){return function(_0x402843){if(!_0x402843){_0x4b8311['sendStatus'](0x194);}return _0x402843;};}function handleError(_0x582eec,_0x3300ac){_0x3300ac=_0x3300ac||0x1f4;return function(_0x2010fd){logger[_0x0430('0x35')](_0x2010fd[_0x0430('0x36')]);if(_0x2010fd[_0x0430('0x37')]){delete _0x2010fd[_0x0430('0x37')];}_0x582eec[_0x0430('0x1e')](_0x3300ac)[_0x0430('0x38')](_0x2010fd);};}exports[_0x0430('0x39')]=function(_0x57a621,_0x548071){var _0xcfe157={},_0x472f54={},_0x5b9f6c={'count':0x0,'rows':[]};var _0x3bd146=_['map'](db[_0x0430('0x3a')]['rawAttributes'],function(_0x48f2b7){return{'name':_0x48f2b7[_0x0430('0x3b')],'type':_0x48f2b7[_0x0430('0x34')][_0x0430('0x3c')]};});_0x472f54[_0x0430('0x3d')]=_[_0x0430('0x31')](_0x3bd146,_0x0430('0x37'));_0x472f54['query']=_[_0x0430('0x3e')](_0x57a621[_0x0430('0x3f')]);_0x472f54[_0x0430('0x40')]=_[_0x0430('0x41')](_0x472f54[_0x0430('0x3d')],_0x472f54[_0x0430('0x3f')]);_0xcfe157[_0x0430('0x42')]=_[_0x0430('0x41')](_0x472f54[_0x0430('0x3d')],qs[_0x0430('0x43')](_0x57a621['query'][_0x0430('0x43')]));_0xcfe157[_0x0430('0x42')]=_0xcfe157[_0x0430('0x42')][_0x0430('0x44')]?_0xcfe157[_0x0430('0x42')]:_0x472f54[_0x0430('0x3d')];if(!_0x57a621['query'][_0x0430('0x45')](_0x0430('0x46'))){_0xcfe157['limit']=qs[_0x0430('0x23')](_0x57a621[_0x0430('0x3f')][_0x0430('0x23')]);_0xcfe157[_0x0430('0x20')]=qs[_0x0430('0x20')](_0x57a621[_0x0430('0x3f')][_0x0430('0x20')]);}_0xcfe157[_0x0430('0x47')]=qs[_0x0430('0x48')](_0x57a621['query'][_0x0430('0x48')]);_0xcfe157[_0x0430('0x49')]=qs[_0x0430('0x40')](_[_0x0430('0x4a')](_0x57a621['query'],_0x472f54[_0x0430('0x40')]),_0x3bd146);if(_0x57a621[_0x0430('0x3f')][_0x0430('0x2f')]){_0xcfe157[_0x0430('0x49')]=_[_0x0430('0x4b')](_0xcfe157[_0x0430('0x49')],{'$or':_[_0x0430('0x31')](_0x3bd146,function(_0x399c48){if(_0x399c48[_0x0430('0x34')]!==_0x0430('0x4c')){var _0x1d814d={};_0x1d814d[_0x399c48['name']]={'$like':'%'+_0x57a621[_0x0430('0x3f')]['filter']+'%'};return _0x1d814d;}})});}_0xcfe157=_['merge']({},_0xcfe157,_0x57a621[_0x0430('0x4d')]);var _0x522051={'where':_0xcfe157['where']};return db[_0x0430('0x3a')]['count'](_0x522051)['then'](function(_0x424e40){_0x5b9f6c['count']=_0x424e40;if(_0x57a621['query'][_0x0430('0x4e')]){_0xcfe157['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x0430('0x4f')](_0xcfe157);})[_0x0430('0x29')](function(_0x129f61){_0x5b9f6c['rows']=_0x129f61;return _0x5b9f6c;})[_0x0430('0x29')](respondWithFilteredResult(_0x548071,_0xcfe157))[_0x0430('0x50')](handleError(_0x548071,null));};exports[_0x0430('0x51')]=function(_0x5d8863,_0x4a6148){var _0x18caed={'raw':![],'where':{'id':_0x5d8863[_0x0430('0x52')]['id']}},_0x238181={};_0x238181[_0x0430('0x3d')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x238181[_0x0430('0x3f')]=_[_0x0430('0x3e')](_0x5d8863[_0x0430('0x3f')]);_0x238181[_0x0430('0x40')]=_[_0x0430('0x41')](_0x238181[_0x0430('0x3d')],_0x238181['query']);_0x18caed['attributes']=_[_0x0430('0x41')](_0x238181[_0x0430('0x3d')],qs[_0x0430('0x43')](_0x5d8863[_0x0430('0x3f')][_0x0430('0x43')]));_0x18caed[_0x0430('0x42')]=_0x18caed[_0x0430('0x42')][_0x0430('0x44')]?_0x18caed[_0x0430('0x42')]:_0x238181[_0x0430('0x3d')];if(_0x5d8863[_0x0430('0x3f')][_0x0430('0x4e')]){_0x18caed['include']=[{'all':!![]}];}_0x18caed=_['merge']({},_0x18caed,_0x5d8863[_0x0430('0x4d')]);return db[_0x0430('0x3a')][_0x0430('0x33')](_0x18caed)[_0x0430('0x29')](handleEntityNotFound(_0x4a6148,null))[_0x0430('0x29')](respondWithResult(_0x4a6148,null))[_0x0430('0x50')](handleError(_0x4a6148,null));};exports[_0x0430('0x53')]=function(_0x34e9ce,_0x261c6f){return db[_0x0430('0x3a')][_0x0430('0x53')](_0x34e9ce[_0x0430('0x54')],{})[_0x0430('0x29')](function(_0x530744){var _0x291bd0=_0x34e9ce[_0x0430('0x55')][_0x0430('0x2b')]({'plain':!![]});if(!_0x291bd0)throw new Error(_0x0430('0x56'));if(_0x291bd0['role']===_0x0430('0x55')){var _0x3d692b=_0x530744[_0x0430('0x2b')]({'plain':!![]});var _0x3dfb63=[{'name':_0x0430('0x57'),'value':_0x0430('0x2c')},{'name':_0x0430('0x2d'),'value':_0x0430('0x2e')}];var _0x3f282a=_['find'](_0x3dfb63,[_0x0430('0x32'),_0x3d692b[_0x0430('0x34')]])[_0x0430('0x37')];return db['UserProfileSection'][_0x0430('0x33')]({'where':{'name':_0x3f282a,'userProfileId':_0x291bd0['userProfileId']},'raw':!![]})[_0x0430('0x29')](function(_0x3da078){if(_0x3da078&&_0x3da078[_0x0430('0x58')]===0x0){return db[_0x0430('0x59')][_0x0430('0x53')]({'name':_0x3d692b[_0x0430('0x37')],'resourceId':_0x3d692b['id'],'type':_0x3da078['name'],'sectionId':_0x3da078['id']},{})[_0x0430('0x29')](function(){return _0x530744;});}else{return _0x530744;}})[_0x0430('0x50')](function(_0x2fd7aa){logger[_0x0430('0x35')](_0x0430('0x5a'),_0x2fd7aa);throw _0x2fd7aa;});}return _0x530744;})[_0x0430('0x29')](respondWithResult(_0x261c6f,0xc9))[_0x0430('0x50')](handleError(_0x261c6f,null));};exports[_0x0430('0x5b')]=function(_0x1e40a8,_0x31f941){var _0x25ac20={'where':{'id':_0x1e40a8['params']['id']}},_0x150718={};_0x150718[_0x0430('0x3d')]=_[_0x0430('0x3e')](db[_0x0430('0x3a')][_0x0430('0x5c')]);_0x25ac20[_0x0430('0x42')]=_[_0x0430('0x41')](_0x150718[_0x0430('0x3d')],qs[_0x0430('0x43')](_0x1e40a8[_0x0430('0x3f')]['fields']));_0x25ac20[_0x0430('0x42')]=_0x25ac20[_0x0430('0x42')][_0x0430('0x44')]?_0x25ac20[_0x0430('0x42')]:_0x150718[_0x0430('0x3d')];if(_0x1e40a8[_0x0430('0x3f')][_0x0430('0x4e')]){_0x25ac20[_0x0430('0x5d')]=[{'all':!![]}];}_0x25ac20=_[_0x0430('0x4b')]({},_0x25ac20,_0x1e40a8[_0x0430('0x4d')]);return db[_0x0430('0x3a')][_0x0430('0x33')](_0x25ac20)[_0x0430('0x29')](handleEntityNotFound(_0x31f941,null))[_0x0430('0x29')](function(_0x5f52ca){if(_0x5f52ca){var _0x1d0503=_0x5f52ca[_0x0430('0x2b')]({'plain':!![]});_0x1d0503=qs[_0x0430('0x5e')](_0x1d0503,['id',_0x0430('0x5f'),_0x0430('0x60')]);_0x1e40a8['body']=_['omit'](_0x1e40a8[_0x0430('0x54')],['id',_0x0430('0x5f'),_0x0430('0x60')]);return db[_0x0430('0x3a')][_0x0430('0x53')](_['merge'](_0x1d0503,_0x1e40a8[_0x0430('0x54')]),{'include':_0x1e40a8[_0x0430('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0x0430('0x29')](function(_0x3c6a59){var _0x31cdd6=_0x1e40a8['user'][_0x0430('0x2b')]({'plain':!![]});if(!_0x31cdd6)throw new Error(_0x0430('0x56'));if(_0x31cdd6[_0x0430('0x61')]===_0x0430('0x55')){var _0x1e09c4=_0x3c6a59[_0x0430('0x2b')]({'plain':!![]});var _0x38a69f=[{'name':_0x0430('0x57'),'value':_0x0430('0x2c')},{'name':_0x0430('0x2d'),'value':_0x0430('0x2e')}];var _0x592632=_[_0x0430('0x33')](_0x38a69f,[_0x0430('0x32'),_0x1e09c4[_0x0430('0x34')]])['name'];return db[_0x0430('0x62')][_0x0430('0x33')]({'where':{'name':_0x592632,'userProfileId':_0x31cdd6[_0x0430('0x63')]},'raw':!![]})[_0x0430('0x29')](function(_0x3d637a){if(_0x3d637a&&_0x3d637a[_0x0430('0x58')]===0x0){return db[_0x0430('0x59')][_0x0430('0x53')]({'name':_0x1e09c4[_0x0430('0x37')],'resourceId':_0x1e09c4['id'],'type':_0x3d637a[_0x0430('0x37')],'sectionId':_0x3d637a['id']},{})[_0x0430('0x29')](function(){return _0x3c6a59;});}else{return _0x3c6a59;}})[_0x0430('0x50')](function(_0x2f8c11){logger[_0x0430('0x35')](_0x0430('0x5a'),_0x2f8c11);throw _0x2f8c11;});}return _0x3c6a59;});}})[_0x0430('0x29')](respondWithResult(_0x31f941,0xc9))['catch'](handleError(_0x31f941,null));};exports['update']=function(_0x1ad757,_0x106750){if(_0x1ad757[_0x0430('0x54')]['id']){delete _0x1ad757['body']['id'];}return db[_0x0430('0x3a')]['find']({'where':{'id':_0x1ad757[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x106750,null))[_0x0430('0x29')](saveUpdates(_0x1ad757[_0x0430('0x54')],null))['then'](respondWithResult(_0x106750,null))[_0x0430('0x50')](handleError(_0x106750,null));};exports['destroy']=function(_0x13197a,_0xc9d2a){return db[_0x0430('0x3a')][_0x0430('0x33')]({'where':{'id':_0x13197a[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0xc9d2a,null))[_0x0430('0x29')](removeEntity(_0xc9d2a,null))['catch'](handleError(_0xc9d2a,null));};exports['getHoppers']=function(_0x41691a,_0x129898,_0x6f80ae){var _0xaa3495={'raw':![],'where':{}};var _0x57899b={};var _0x9f7f5b={'count':0x0,'rows':[]};return db[_0x0430('0x3a')][_0x0430('0x64')]({'where':{'id':_0x41691a['params']['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x129898,null))[_0x0430('0x29')](function(_0x5a2383){if(_0x5a2383){_0x57899b['model']=_['keys'](db[_0x0430('0x65')][_0x0430('0x5c')]);_0x57899b[_0x0430('0x3f')]=_[_0x0430('0x3e')](_0x41691a[_0x0430('0x3f')]);_0x57899b[_0x0430('0x40')]=_[_0x0430('0x41')](_0x57899b[_0x0430('0x3d')],_0x57899b[_0x0430('0x3f')]);_0xaa3495['attributes']=_['intersection'](_0x57899b[_0x0430('0x3d')],qs[_0x0430('0x43')](_0x41691a[_0x0430('0x3f')][_0x0430('0x43')]));_0xaa3495['attributes']=_0xaa3495[_0x0430('0x42')][_0x0430('0x44')]?_0xaa3495[_0x0430('0x42')]:_0x57899b['model'];if(!_0x41691a['query'][_0x0430('0x45')](_0x0430('0x46'))){_0xaa3495[_0x0430('0x23')]=qs[_0x0430('0x23')](_0x41691a[_0x0430('0x3f')][_0x0430('0x23')]);_0xaa3495['offset']=qs[_0x0430('0x20')](_0x41691a[_0x0430('0x3f')][_0x0430('0x20')]);}_0xaa3495[_0x0430('0x47')]=qs[_0x0430('0x48')](_0x41691a['query']['sort']);_0xaa3495[_0x0430('0x49')]=qs[_0x0430('0x40')](_['pick'](_0x41691a[_0x0430('0x3f')],_0x57899b['filters']));_0xaa3495[_0x0430('0x49')][_0x0430('0x66')]=_0x5a2383['id'];if(_0x41691a[_0x0430('0x3f')][_0x0430('0x2f')]){_0xaa3495[_0x0430('0x49')]=_['merge'](_0xaa3495['where'],{'$or':_[_0x0430('0x31')](_0xaa3495['attributes'],function(_0x16dfdb){var _0x177987={};_0x177987[_0x16dfdb]={'$like':'%'+_0x41691a[_0x0430('0x3f')][_0x0430('0x2f')]+'%'};return _0x177987;})});}_0xaa3495=_[_0x0430('0x4b')]({},_0xaa3495,_0x41691a[_0x0430('0x4d')]);return db[_0x0430('0x65')][_0x0430('0x22')]({'where':_0xaa3495['where']})[_0x0430('0x29')](function(_0x1bb341){_0x9f7f5b['count']=_0x1bb341;if(_0x41691a[_0x0430('0x3f')][_0x0430('0x4e')]){_0xaa3495[_0x0430('0x5d')]=[{'all':!![]}];}return db[_0x0430('0x65')][_0x0430('0x4f')](_0xaa3495);})[_0x0430('0x29')](function(_0x43cb2a){_0x9f7f5b[_0x0430('0x67')]=_0x43cb2a;return _0x9f7f5b;});}})[_0x0430('0x29')](respondWithFilteredResult(_0x129898,_0xaa3495))['catch'](handleError(_0x129898,null));};exports[_0x0430('0x68')]=function(_0xe6fa29,_0x40c745,_0xcdba62){var _0x177dff={'raw':!![],'where':{}};var _0xd974ef={};var _0x4c7b9e={'count':0x0,'rows':[]};return db[_0x0430('0x3a')]['findOne']({'where':{'id':_0xe6fa29[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x40c745,null))['then'](function(_0x546e09){if(_0x546e09){_0xd974ef['model']=_[_0x0430('0x3e')](db[_0x0430('0x69')]['rawAttributes']);_0xd974ef[_0x0430('0x3f')]=_[_0x0430('0x3e')](_0xe6fa29[_0x0430('0x3f')]);_0xd974ef[_0x0430('0x40')]=_[_0x0430('0x41')](_0xd974ef['model'],_0xd974ef[_0x0430('0x3f')]);_0x177dff['attributes']=_[_0x0430('0x41')](_0xd974ef[_0x0430('0x3d')],qs['fields'](_0xe6fa29['query'][_0x0430('0x43')]));_0x177dff[_0x0430('0x42')]=_0x177dff[_0x0430('0x42')][_0x0430('0x44')]?_0x177dff[_0x0430('0x42')]:_0xd974ef[_0x0430('0x3d')];if(!_0xe6fa29[_0x0430('0x3f')][_0x0430('0x45')]('nolimit')){_0x177dff[_0x0430('0x23')]=qs[_0x0430('0x23')](_0xe6fa29[_0x0430('0x3f')]['limit']);_0x177dff[_0x0430('0x20')]=qs[_0x0430('0x20')](_0xe6fa29[_0x0430('0x3f')][_0x0430('0x20')]);}_0x177dff[_0x0430('0x47')]=qs[_0x0430('0x48')](_0xe6fa29[_0x0430('0x3f')][_0x0430('0x48')]);_0x177dff[_0x0430('0x49')]=qs[_0x0430('0x40')](_[_0x0430('0x4a')](_0xe6fa29[_0x0430('0x3f')],_0xd974ef[_0x0430('0x40')]));_0x177dff['where'][_0x0430('0x66')]=_0x546e09['id'];if(_0xe6fa29[_0x0430('0x3f')][_0x0430('0x2f')]){_0x177dff['where']=_['merge'](_0x177dff[_0x0430('0x49')],{'$or':_[_0x0430('0x31')](_0x177dff['attributes'],function(_0x5a853a){var _0x17f1ab={};_0x17f1ab[_0x5a853a]={'$like':'%'+_0xe6fa29[_0x0430('0x3f')][_0x0430('0x2f')]+'%'};return _0x17f1ab;})});}_0x177dff=_[_0x0430('0x4b')]({},_0x177dff,_0xe6fa29[_0x0430('0x4d')]);return db['CmHopperHistory'][_0x0430('0x22')]({'where':_0x177dff[_0x0430('0x49')]})[_0x0430('0x29')](function(_0xb066d7){_0x4c7b9e[_0x0430('0x22')]=_0xb066d7;if(_0xe6fa29[_0x0430('0x3f')][_0x0430('0x4e')]){_0x177dff[_0x0430('0x5d')]=[{'all':!![]}];}return db[_0x0430('0x69')][_0x0430('0x4f')](_0x177dff);})[_0x0430('0x29')](function(_0x1ff5ba){_0x4c7b9e['rows']=_0x1ff5ba;return _0x4c7b9e;});}})[_0x0430('0x29')](respondWithFilteredResult(_0x40c745,_0x177dff))[_0x0430('0x50')](handleError(_0x40c745,null));};exports[_0x0430('0x6a')]=function(_0xdb9616,_0x47f160,_0x2cb1d7){var _0x2bcce8={'raw':!![],'where':{}};var _0x1130dc={};var _0x5be3e2={'count':0x0,'rows':[]};return db[_0x0430('0x3a')][_0x0430('0x64')]({'where':{'id':_0xdb9616['params']['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x47f160,null))[_0x0430('0x29')](function(_0x4a5734){if(_0x4a5734){_0x1130dc[_0x0430('0x3d')]=_[_0x0430('0x3e')](db[_0x0430('0x6b')][_0x0430('0x5c')]);_0x1130dc[_0x0430('0x3f')]=_[_0x0430('0x3e')](_0xdb9616['query']);_0x1130dc['filters']=_['intersection'](_0x1130dc[_0x0430('0x3d')],_0x1130dc['query']);_0x2bcce8['attributes']=_['intersection'](_0x1130dc[_0x0430('0x3d')],qs[_0x0430('0x43')](_0xdb9616[_0x0430('0x3f')]['fields']));_0x2bcce8[_0x0430('0x42')]=_0x2bcce8['attributes'][_0x0430('0x44')]?_0x2bcce8['attributes']:_0x1130dc[_0x0430('0x3d')];if(!_0xdb9616['query'][_0x0430('0x45')](_0x0430('0x46'))){_0x2bcce8['limit']=qs[_0x0430('0x23')](_0xdb9616[_0x0430('0x3f')]['limit']);_0x2bcce8[_0x0430('0x20')]=qs['offset'](_0xdb9616[_0x0430('0x3f')][_0x0430('0x20')]);}_0x2bcce8[_0x0430('0x47')]=qs[_0x0430('0x48')](_0xdb9616[_0x0430('0x3f')][_0x0430('0x48')]);_0x2bcce8['where']=qs['filters'](_[_0x0430('0x4a')](_0xdb9616[_0x0430('0x3f')],_0x1130dc[_0x0430('0x40')]));_0x2bcce8[_0x0430('0x49')][_0x0430('0x66')]=_0x4a5734['id'];if(_0xdb9616[_0x0430('0x3f')][_0x0430('0x2f')]){_0x2bcce8['where']=_[_0x0430('0x4b')](_0x2bcce8['where'],{'$or':_[_0x0430('0x31')](_0x2bcce8[_0x0430('0x42')],function(_0x31a382){var _0x4bdab5={};_0x4bdab5[_0x31a382]={'$like':'%'+_0xdb9616['query'][_0x0430('0x2f')]+'%'};return _0x4bdab5;})});}_0x2bcce8=_[_0x0430('0x4b')]({},_0x2bcce8,_0xdb9616[_0x0430('0x4d')]);return db[_0x0430('0x6b')][_0x0430('0x22')]({'where':_0x2bcce8['where']})['then'](function(_0x5c9e22){_0x5be3e2[_0x0430('0x22')]=_0x5c9e22;if(_0xdb9616[_0x0430('0x3f')][_0x0430('0x4e')]){_0x2bcce8[_0x0430('0x5d')]=[{'all':!![]}];}return db[_0x0430('0x6b')]['findAll'](_0x2bcce8);})['then'](function(_0x263a4e){_0x5be3e2[_0x0430('0x67')]=_0x263a4e;return _0x5be3e2;});}})[_0x0430('0x29')](respondWithFilteredResult(_0x47f160,_0x2bcce8))['catch'](handleError(_0x47f160,null));};exports[_0x0430('0x6c')]=function(_0xdf9ff5,_0x56ffab,_0x467742){var _0x301740={'raw':!![],'where':{}};var _0x5015f2={};var _0x40e711={'count':0x0,'rows':[]};return db[_0x0430('0x3a')][_0x0430('0x64')]({'where':{'id':_0xdf9ff5['params']['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x56ffab,null))[_0x0430('0x29')](function(_0x21d872){if(_0x21d872){_0x5015f2[_0x0430('0x3d')]=_[_0x0430('0x3e')](db['CmHopperBlack'][_0x0430('0x5c')]);_0x5015f2[_0x0430('0x3f')]=_['keys'](_0xdf9ff5[_0x0430('0x3f')]);_0x5015f2[_0x0430('0x40')]=_[_0x0430('0x41')](_0x5015f2[_0x0430('0x3d')],_0x5015f2['query']);_0x301740['attributes']=_[_0x0430('0x41')](_0x5015f2[_0x0430('0x3d')],qs[_0x0430('0x43')](_0xdf9ff5[_0x0430('0x3f')]['fields']));_0x301740[_0x0430('0x42')]=_0x301740[_0x0430('0x42')][_0x0430('0x44')]?_0x301740[_0x0430('0x42')]:_0x5015f2[_0x0430('0x3d')];if(!_0xdf9ff5[_0x0430('0x3f')][_0x0430('0x45')](_0x0430('0x46'))){_0x301740[_0x0430('0x23')]=qs[_0x0430('0x23')](_0xdf9ff5['query'][_0x0430('0x23')]);_0x301740[_0x0430('0x20')]=qs[_0x0430('0x20')](_0xdf9ff5[_0x0430('0x3f')][_0x0430('0x20')]);}_0x301740[_0x0430('0x47')]=qs[_0x0430('0x48')](_0xdf9ff5[_0x0430('0x3f')][_0x0430('0x48')]);_0x301740[_0x0430('0x49')]=qs[_0x0430('0x40')](_['pick'](_0xdf9ff5['query'],_0x5015f2[_0x0430('0x40')]));_0x301740[_0x0430('0x49')]['VoiceQueueId']=_0x21d872['id'];if(_0xdf9ff5[_0x0430('0x3f')][_0x0430('0x2f')]){_0x301740[_0x0430('0x49')]=_[_0x0430('0x4b')](_0x301740[_0x0430('0x49')],{'$or':_[_0x0430('0x31')](_0x301740[_0x0430('0x42')],function(_0x19f9f5){var _0x4dd90a={};_0x4dd90a[_0x19f9f5]={'$like':'%'+_0xdf9ff5[_0x0430('0x3f')][_0x0430('0x2f')]+'%'};return _0x4dd90a;})});}_0x301740=_[_0x0430('0x4b')]({},_0x301740,_0xdf9ff5[_0x0430('0x4d')]);return db['CmHopperBlack'][_0x0430('0x22')]({'where':_0x301740[_0x0430('0x49')]})[_0x0430('0x29')](function(_0x1f7b5a){_0x40e711[_0x0430('0x22')]=_0x1f7b5a;if(_0xdf9ff5[_0x0430('0x3f')][_0x0430('0x4e')]){_0x301740[_0x0430('0x5d')]=[{'all':!![]}];}return db[_0x0430('0x6d')][_0x0430('0x4f')](_0x301740);})[_0x0430('0x29')](function(_0xd1d1c9){_0x40e711['rows']=_0xd1d1c9;return _0x40e711;});}})[_0x0430('0x29')](respondWithFilteredResult(_0x56ffab,_0x301740))[_0x0430('0x50')](handleError(_0x56ffab,null));};exports[_0x0430('0x6e')]=function(_0x461a38,_0x4042fe,_0x3b31b0){var _0x4ec264={};var _0x4c7fe3={};var _0x194cd7;var _0x3db802;return db['VoiceQueue'][_0x0430('0x64')]({'where':{'id':_0x461a38[_0x0430('0x52')]['id']}})['then'](handleEntityNotFound(_0x4042fe,null))['then'](function(_0xffe975){if(_0xffe975){_0x194cd7=_0xffe975;_0x4c7fe3[_0x0430('0x3d')]=_['keys'](db['Team'][_0x0430('0x5c')]);_0x4c7fe3[_0x0430('0x3f')]=_['keys'](_0x461a38[_0x0430('0x3f')]);_0x4c7fe3[_0x0430('0x40')]=_[_0x0430('0x41')](_0x4c7fe3[_0x0430('0x3d')],_0x4c7fe3[_0x0430('0x3f')]);_0x4ec264[_0x0430('0x42')]=_[_0x0430('0x41')](_0x4c7fe3[_0x0430('0x3d')],qs['fields'](_0x461a38[_0x0430('0x3f')]['fields']));_0x4ec264['attributes']=_0x4ec264[_0x0430('0x42')][_0x0430('0x44')]?_0x4ec264[_0x0430('0x42')]:_0x4c7fe3[_0x0430('0x3d')];_0x4ec264[_0x0430('0x47')]=qs[_0x0430('0x48')](_0x461a38[_0x0430('0x3f')][_0x0430('0x48')]);_0x4ec264['where']=qs[_0x0430('0x40')](_[_0x0430('0x4a')](_0x461a38[_0x0430('0x3f')],_0x4c7fe3[_0x0430('0x40')]));if(_0x461a38['query'][_0x0430('0x2f')]){_0x4ec264[_0x0430('0x49')]=_[_0x0430('0x4b')](_0x4ec264['where'],{'$or':_[_0x0430('0x31')](_0x4ec264['attributes'],function(_0x4176b1){var _0xe9187c={};_0xe9187c[_0x4176b1]={'$like':'%'+_0x461a38[_0x0430('0x3f')][_0x0430('0x2f')]+'%'};return _0xe9187c;})});}_0x4ec264=_[_0x0430('0x4b')]({},_0x4ec264,_0x461a38[_0x0430('0x4d')]);return _0x194cd7['getTeams'](_0x4ec264);}})[_0x0430('0x29')](function(_0x4ac9b3){if(_0x4ac9b3){_0x3db802=_0x4ac9b3[_0x0430('0x44')];if(!_0x461a38[_0x0430('0x3f')][_0x0430('0x45')](_0x0430('0x46'))){_0x4ec264['limit']=qs[_0x0430('0x23')](_0x461a38[_0x0430('0x3f')][_0x0430('0x23')]);_0x4ec264[_0x0430('0x20')]=qs['offset'](_0x461a38['query'][_0x0430('0x20')]);}return _0x194cd7[_0x0430('0x6e')](_0x4ec264);}})[_0x0430('0x29')](function(_0x3919d6){if(_0x3919d6){return _0x3919d6?{'count':_0x3db802,'rows':_0x3919d6}:null;}})[_0x0430('0x29')](respondWithResult(_0x4042fe,null))[_0x0430('0x50')](handleError(_0x4042fe,null));};exports['addTeams']=function(_0x1ace19,_0x178884,_0x145e69){var _0x44eef1=_0x1ace19[_0x0430('0x54')][_0x0430('0x6f')];var _0x146557=_[_0x0430('0x31')](_0x44eef1,'id');return db[_0x0430('0x70')][_0x0430('0x4f')]({'where':{'id':_0x146557},'attributes':['id'],'include':[{'model':db[_0x0430('0x71')],'as':_0x0430('0x72'),'attributes':['id',_0x0430('0x37'),_0x0430('0x73'),_0x0430('0x74'),_0x0430('0x75')],'raw':!![]}]})['then'](function(_0x42630d){if(_0x42630d){var _0x1ba975=_[_0x0430('0x76')](_0x42630d,function(_0x46ddb2){var _0x578957=_0x46ddb2[_0x0430('0x2b')]({'plain':!![]});_0x578957[_0x0430('0x72')][_0x0430('0x77')](function(_0x33aa5b){_0x33aa5b[_0x0430('0x78')]=_[_0x0430('0x33')](_0x44eef1,{'id':_0x578957['id']})['penalty'];});return _0x578957[_0x0430('0x72')];});return db['VoiceQueue']['find']({'where':{'id':_0x1ace19[_0x0430('0x52')]['id']}})['then'](function(_0x58afcf){return db[_0x0430('0x79')]['transaction'](function(_0x464545){return _0x58afcf[_0x0430('0x7a')](_0x146557,{'transaction':_0x464545})[_0x0430('0x29')](function(){return BPromise[_0x0430('0x7b')](_0x44eef1,function(_0x3103c9){return db['TeamVoiceQueue'][_0x0430('0x7c')]({'TeamId':_0x3103c9['id'],'VoiceQueueId':_0x1ace19['params']['id'],'penalty':_0x3103c9[_0x0430('0x78')]},{'transaction':_0x464545});});})[_0x0430('0x29')](function(){return BPromise[_0x0430('0x7b')](_0x1ba975,function(_0x3473a5){return db[_0x0430('0x7d')][_0x0430('0x7e')]({'where':{'UserId':_0x3473a5['id'],'VoiceQueueId':_0x1ace19[_0x0430('0x52')]['id']},'defaults':{'penalty':_0x3473a5['penalty']},'transaction':_0x464545});});})[_0x0430('0x29')](function(){return BPromise[_0x0430('0x7b')](_['filter'](_0x1ba975,{'online':!![]}),function(_0x37e0fa){return db[_0x0430('0x7f')]['upsert']({'membername':_0x37e0fa[_0x0430('0x37')],'UserId':_0x37e0fa['id'],'queue_name':_0x58afcf['name'],'VoiceQueueId':_0x58afcf['id'],'interface':_['isNil'](_0x37e0fa['interface'])?util['format'](_0x0430('0x80'),_0x37e0fa[_0x0430('0x37')]):_0x37e0fa['interface'],'paused':_0x37e0fa[_0x0430('0x74')]||![],'penalty':_0x37e0fa[_0x0430('0x78')]},{'transaction':_0x464545});});})[_0x0430('0x29')](function(){_0x1ba975[_0x0430('0x77')](function(_0x2d19e5){socket[_0x0430('0x81')](_0x0430('0x82'),{'UserId':_0x2d19e5['id'],'VoiceQueueId':_0x58afcf['id']});});});});});}})[_0x0430('0x29')](respondWithStatusCode(_0x178884,null))['catch'](handleError(_0x178884,null));};exports[_0x0430('0x83')]=function(_0x5b1ded,_0xf310ee,_0x5c5ff2){return db[_0x0430('0x70')]['findAll']({'where':{'id':_0x5b1ded[_0x0430('0x3f')][_0x0430('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0430('0x72'),'attributes':['id'],'raw':!![]}]})[_0x0430('0x29')](handleEntityNotFound(_0xf310ee,null))['then'](function(_0x158405){var _0x74890b=_[_0x0430('0x31')](_0x158405,'id');var _0x349ad3=[];var _0x3fe57f=[];var _0x320a1a=squel[_0x0430('0x85')]();_0x320a1a[_0x0430('0x86')]('tq.TeamId')[_0x0430('0x87')](_0x0430('0x88'),'tq')[_0x0430('0x89')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0430('0x49')](_0x0430('0x8a'),_0x5b1ded[_0x0430('0x52')]['id']);for(var _0x5ff924=0x0;_0x5ff924<_0x158405[_0x0430('0x44')];_0x5ff924+=0x1){let _0x2a4840=_0x158405[_0x5ff924];for(var _0x4eb78c=0x0;_0x4eb78c<_0x2a4840[_0x0430('0x72')]['length'];_0x4eb78c+=0x1){let _0x520fe7=_0x2a4840[_0x0430('0x72')][_0x4eb78c];var _0x40f28b=_0x320a1a[_0x0430('0x5b')]();_0x40f28b['where']('ut.UserId\x20=\x20?',_0x520fe7['id']);_0x3fe57f[_0x0430('0x8b')](db[_0x0430('0x79')][_0x0430('0x3f')](_0x40f28b['toString'](),{'type':db[_0x0430('0x79')][_0x0430('0x8c')][_0x0430('0x8d')]})[_0x0430('0x29')](function(_0xfcc6ac){if(_0xfcc6ac['length']===0x1){return _0x520fe7['id'];}else{var _0xb5b77=_[_0x0430('0x8e')](_[_0x0430('0x31')](_0xfcc6ac,_0x0430('0x8f')),function(_0x22f7c9){return _[_0x0430('0x90')](_0x74890b,_0x22f7c9);});if(_0xb5b77){return _0x520fe7['id'];}}}));}}return BPromise[_0x0430('0x91')](_0x3fe57f)[_0x0430('0x29')](function(_0x513b9c){_0x349ad3=_(_0x349ad3)['union'](_0x513b9c)[_0x0430('0x92')]()['value']();return db[_0x0430('0x3a')][_0x0430('0x33')]({'where':{'id':_0x5b1ded['params']['id']}})[_0x0430('0x29')](function(_0x5d7ca){return db[_0x0430('0x79')][_0x0430('0x93')](function(_0x3aec18){return _0x5d7ca[_0x0430('0x83')](_0x5b1ded['query'][_0x0430('0x84')],{'transaction':_0x3aec18})[_0x0430('0x29')](function(){if(!_['isEmpty'](_0x349ad3)){return _0x5d7ca['removeAgents'](_0x349ad3,{'transaction':_0x3aec18})['then'](function(){return db[_0x0430('0x7f')]['destroy']({'where':{'VoiceQueueId':_0x5b1ded['params']['id'],'UserId':_0x349ad3},'transaction':_0x3aec18});});}})['then'](function(){_0x349ad3[_0x0430('0x77')](function(_0x3404a4){socket[_0x0430('0x81')]('userVoiceQueue:remove',{'UserId':_0x3404a4,'VoiceQueueId':_0x5d7ca['id']});});});});});});})['then'](respondWithStatusCode(_0xf310ee,null))[_0x0430('0x50')](handleError(_0xf310ee,null));};exports[_0x0430('0x94')]=function(_0x41fa5f,_0x2f2a4c,_0x224fd3){var _0x2aa73a,_0x431352;return db['VoiceQueue'][_0x0430('0x33')]({'where':{'id':_0x41fa5f[_0x0430('0x52')]['id']}})['then'](handleEntityNotFound(_0x2f2a4c,null))[_0x0430('0x29')](function(_0x1ca260){if(_0x1ca260){_0x431352=_0x1ca260;return _0x1ca260[_0x0430('0x94')](_0x41fa5f[_0x0430('0x54')]['ids'],_[_0x0430('0x5e')](_0x41fa5f[_0x0430('0x54')],[_0x0430('0x84'),'id'])||{})[_0x0430('0x95')](function(_0xe300f2){for(var _0x512da6=0x0;_0x512da6<_0x41fa5f[_0x0430('0x54')]['ids'][_0x0430('0x44')];_0x512da6+=0x1){socket[_0x0430('0x81')]('userVoiceQueue:save',{'UserId':Number(_0x41fa5f[_0x0430('0x54')][_0x0430('0x84')][_0x512da6]),'VoiceQueueId':Number(_0x41fa5f['params']['id'])});}return _0xe300f2;});}})[_0x0430('0x29')](function(_0x55e2b5){_0x2aa73a=_0x55e2b5||[];if(_0x431352){return db[_0x0430('0x71')][_0x0430('0x4f')]({'where':{'id':_0x41fa5f[_0x0430('0x54')][_0x0430('0x84')]},'attributes':['id',_0x0430('0x37'),_0x0430('0x73'),_0x0430('0x74'),'interface'],'raw':!![]});}})[_0x0430('0x29')](function(_0x443383){if(!_['isEmpty'](_0x443383)){var _0x3a8a4c=[];for(var _0x3c23dd=0x0;_0x3c23dd<_0x443383['length'];_0x3c23dd++){if(_0x443383[_0x3c23dd]['online']){_0x3a8a4c[_0x0430('0x8b')](db[_0x0430('0x7f')][_0x0430('0x7c')]({'membername':_0x443383[_0x3c23dd][_0x0430('0x37')],'UserId':_0x443383[_0x3c23dd]['id'],'queue_name':_0x431352[_0x0430('0x37')],'VoiceQueueId':_0x431352['id'],'interface':_[_0x0430('0x96')](_0x443383[_0x3c23dd][_0x0430('0x75')])?util[_0x0430('0x97')]('SIP/%s',_0x443383[_0x3c23dd][_0x0430('0x37')]):_0x443383[_0x3c23dd][_0x0430('0x75')],'paused':_0x443383[_0x3c23dd]['voicePause']||![],'penalty':_0x41fa5f[_0x0430('0x54')]['penalty']||0x0}));}}return BPromise[_0x0430('0x91')](_0x3a8a4c);}})[_0x0430('0x29')](function(){return _0x2aa73a;})[_0x0430('0x29')](respondWithResult(_0x2f2a4c,null))['catch'](handleError(_0x2f2a4c,null));};exports[_0x0430('0x98')]=function(_0x2855c3,_0x19504d,_0x6542fc){return db[_0x0430('0x3a')][_0x0430('0x33')]({'where':{'id':_0x2855c3[_0x0430('0x52')]['id']}})['then'](handleEntityNotFound(_0x19504d,null))[_0x0430('0x29')](function(_0x1ff496){if(_0x1ff496){return _0x1ff496[_0x0430('0x98')](_0x2855c3[_0x0430('0x3f')][_0x0430('0x84')])['then'](function(){if(_['isArray'](_0x2855c3[_0x0430('0x3f')][_0x0430('0x84')])){for(var _0x54b9dc=0x0;_0x54b9dc<_0x2855c3[_0x0430('0x3f')][_0x0430('0x84')][_0x0430('0x44')];_0x54b9dc+=0x1){socket[_0x0430('0x81')](_0x0430('0x99'),{'UserId':Number(_0x2855c3[_0x0430('0x3f')][_0x0430('0x84')][_0x54b9dc]),'VoiceQueueId':Number(_0x2855c3[_0x0430('0x52')]['id'])});}}else{socket[_0x0430('0x81')](_0x0430('0x99'),{'UserId':Number(_0x2855c3[_0x0430('0x3f')]['ids']),'VoiceQueueId':Number(_0x2855c3[_0x0430('0x52')]['id'])});}});}})[_0x0430('0x29')](function(_0x5312c2){return db['UserVoiceQueueRt'][_0x0430('0x2a')]({'where':{'VoiceQueueId':_0x2855c3[_0x0430('0x52')]['id'],'UserId':_0x2855c3[_0x0430('0x3f')]['ids']}})[_0x0430('0x29')](function(){return _0x5312c2;});})[_0x0430('0x29')](respondWithStatusCode(_0x19504d,null))['catch'](handleError(_0x19504d,null));};exports[_0x0430('0x9a')]=function(_0x102caf,_0xea21ce,_0x2ac1ba){var _0x3c2009={};var _0x206af5={};var _0x430e2e;var _0x2f898b;return db[_0x0430('0x3a')][_0x0430('0x64')]({'where':{'id':_0x102caf['params']['id']}})[_0x0430('0x29')](handleEntityNotFound(_0xea21ce,null))[_0x0430('0x29')](function(_0x3f630a){if(_0x3f630a){_0x430e2e=_0x3f630a;_0x206af5['model']=_[_0x0430('0x3e')](db['User'][_0x0430('0x5c')]);_0x206af5['query']=_[_0x0430('0x3e')](_0x102caf['query']);_0x206af5[_0x0430('0x40')]=_[_0x0430('0x41')](_0x206af5['model'],_0x206af5[_0x0430('0x3f')]);_0x3c2009[_0x0430('0x42')]=_['intersection'](_0x206af5[_0x0430('0x3d')],qs[_0x0430('0x43')](_0x102caf[_0x0430('0x3f')][_0x0430('0x43')]));_0x3c2009[_0x0430('0x42')]=_0x3c2009[_0x0430('0x42')][_0x0430('0x44')]?_0x3c2009['attributes']:_0x206af5[_0x0430('0x3d')];_0x3c2009['order']=qs[_0x0430('0x48')](_0x102caf[_0x0430('0x3f')][_0x0430('0x48')]);_0x3c2009[_0x0430('0x49')]=qs[_0x0430('0x40')](_['pick'](_0x102caf[_0x0430('0x3f')],_0x206af5['filters']));if(_0x102caf[_0x0430('0x3f')][_0x0430('0x2f')]){_0x3c2009[_0x0430('0x49')]=_[_0x0430('0x4b')](_0x3c2009[_0x0430('0x49')],{'$or':_[_0x0430('0x31')](_0x3c2009[_0x0430('0x42')],function(_0x1d050c){var _0x568bf3={};_0x568bf3[_0x1d050c]={'$like':'%'+_0x102caf[_0x0430('0x3f')][_0x0430('0x2f')]+'%'};return _0x568bf3;})});}_0x3c2009=_[_0x0430('0x4b')]({},_0x3c2009,_0x102caf[_0x0430('0x4d')]);return _0x430e2e[_0x0430('0x9a')](_0x3c2009);}})['then'](function(_0x3eb28e){if(_0x3eb28e){_0x2f898b=_0x3eb28e[_0x0430('0x44')];if(!_0x102caf[_0x0430('0x3f')][_0x0430('0x45')](_0x0430('0x46'))){_0x3c2009[_0x0430('0x23')]=qs['limit'](_0x102caf['query'][_0x0430('0x23')]);_0x3c2009[_0x0430('0x20')]=qs[_0x0430('0x20')](_0x102caf[_0x0430('0x3f')][_0x0430('0x20')]);}return _0x430e2e[_0x0430('0x9a')](_0x3c2009);}})['then'](function(_0x279f7a){if(_0x279f7a){return _0x279f7a?{'count':_0x2f898b,'rows':_0x279f7a}:null;}})[_0x0430('0x29')](respondWithResult(_0xea21ce,null))[_0x0430('0x50')](handleError(_0xea21ce,null));};exports[_0x0430('0x9b')]=function(_0x6e7d19,_0x8e3603,_0x753fda){var _0x15c4ec={};var _0xdb19ad={};var _0x1ead56;var _0x1e1d15;return db[_0x0430('0x3a')][_0x0430('0x64')]({'where':{'id':_0x6e7d19[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x8e3603,null))[_0x0430('0x29')](function(_0x5a4a65){if(_0x5a4a65){_0x1ead56=_0x5a4a65;_0xdb19ad[_0x0430('0x3d')]=_['keys'](db[_0x0430('0x7f')][_0x0430('0x5c')]);_0xdb19ad[_0x0430('0x3f')]=_[_0x0430('0x3e')](_0x6e7d19[_0x0430('0x3f')]);_0xdb19ad[_0x0430('0x40')]=_[_0x0430('0x41')](_0xdb19ad[_0x0430('0x3d')],_0xdb19ad[_0x0430('0x3f')]);_0x15c4ec['attributes']=_[_0x0430('0x41')](_0xdb19ad['model'],qs[_0x0430('0x43')](_0x6e7d19['query'][_0x0430('0x43')]));_0x15c4ec[_0x0430('0x42')]=_0x15c4ec['attributes'][_0x0430('0x44')]?_0x15c4ec[_0x0430('0x42')]:_0xdb19ad[_0x0430('0x3d')];_0x15c4ec[_0x0430('0x47')]=qs[_0x0430('0x48')](_0x6e7d19['query'][_0x0430('0x48')]);_0x15c4ec[_0x0430('0x49')]=qs[_0x0430('0x40')](_[_0x0430('0x4a')](_0x6e7d19[_0x0430('0x3f')],_0xdb19ad['filters']));if(_0x6e7d19[_0x0430('0x3f')][_0x0430('0x2f')]){_0x15c4ec[_0x0430('0x49')]=_[_0x0430('0x4b')](_0x15c4ec[_0x0430('0x49')],{'$or':_[_0x0430('0x31')](_0x15c4ec[_0x0430('0x42')],function(_0xacb9f5){var _0xed1262={};_0xed1262[_0xacb9f5]={'$like':'%'+_0x6e7d19[_0x0430('0x3f')][_0x0430('0x2f')]+'%'};return _0xed1262;})});}_0x15c4ec=_[_0x0430('0x4b')]({},_0x15c4ec,_0x6e7d19[_0x0430('0x4d')]);return _0x1ead56[_0x0430('0x9b')](_0x15c4ec);}})[_0x0430('0x29')](function(_0x3456ae){if(_0x3456ae){_0x1e1d15=_0x3456ae[_0x0430('0x44')];if(!_0x6e7d19[_0x0430('0x3f')]['hasOwnProperty'](_0x0430('0x46'))){_0x15c4ec['limit']=qs[_0x0430('0x23')](_0x6e7d19[_0x0430('0x3f')][_0x0430('0x23')]);_0x15c4ec[_0x0430('0x20')]=qs[_0x0430('0x20')](_0x6e7d19[_0x0430('0x3f')][_0x0430('0x20')]);}return _0x1ead56[_0x0430('0x9b')](_0x15c4ec);}})[_0x0430('0x29')](function(_0x138c69){return _0x138c69?{'count':_0x1e1d15,'rows':_0x138c69}:null;})['then'](respondWithResult(_0x8e3603,null))[_0x0430('0x50')](handleError(_0x8e3603,null));};exports['getLists']=function(_0x50021c,_0x18cd3d,_0x2cfbba){var _0x45e219={};var _0x3dee61={};var _0x1dd333;var _0x599096;return db[_0x0430('0x3a')][_0x0430('0x64')]({'where':{'id':_0x50021c[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x18cd3d,null))[_0x0430('0x29')](function(_0x11fc67){if(_0x11fc67){_0x1dd333=_0x11fc67;_0x3dee61[_0x0430('0x3d')]=_[_0x0430('0x3e')](db[_0x0430('0x9c')][_0x0430('0x5c')]);_0x3dee61[_0x0430('0x3f')]=_['keys'](_0x50021c[_0x0430('0x3f')]);_0x3dee61[_0x0430('0x40')]=_['intersection'](_0x3dee61[_0x0430('0x3d')],_0x3dee61['query']);_0x45e219[_0x0430('0x42')]=_[_0x0430('0x41')](_0x3dee61[_0x0430('0x3d')],qs[_0x0430('0x43')](_0x50021c[_0x0430('0x3f')]['fields']));_0x45e219[_0x0430('0x42')]=_0x45e219['attributes'][_0x0430('0x44')]?_0x45e219[_0x0430('0x42')]:_0x3dee61[_0x0430('0x3d')];_0x45e219[_0x0430('0x47')]=qs['sort'](_0x50021c['query'][_0x0430('0x48')]);_0x45e219[_0x0430('0x49')]=qs[_0x0430('0x40')](_[_0x0430('0x4a')](_0x50021c[_0x0430('0x3f')],_0x3dee61[_0x0430('0x40')]));if(_0x50021c[_0x0430('0x3f')]['filter']){_0x45e219['where']=_[_0x0430('0x4b')](_0x45e219['where'],{'$or':_[_0x0430('0x31')](_0x45e219[_0x0430('0x42')],function(_0x8ed904){var _0x1f4784={};_0x1f4784[_0x8ed904]={'$like':'%'+_0x50021c[_0x0430('0x3f')]['filter']+'%'};return _0x1f4784;})});}_0x45e219=_[_0x0430('0x4b')]({},_0x45e219,_0x50021c['options']);return _0x1dd333['getLists'](_0x45e219);}})[_0x0430('0x29')](function(_0x1454a3){if(_0x1454a3){_0x599096=_0x1454a3[_0x0430('0x44')];if(!_0x50021c[_0x0430('0x3f')][_0x0430('0x45')](_0x0430('0x46'))){_0x45e219[_0x0430('0x23')]=qs[_0x0430('0x23')](_0x50021c[_0x0430('0x3f')][_0x0430('0x23')]);_0x45e219[_0x0430('0x20')]=qs['offset'](_0x50021c['query'][_0x0430('0x20')]);}return _0x1dd333[_0x0430('0x9d')](_0x45e219);}})[_0x0430('0x29')](function(_0x4d5ebd){if(_0x4d5ebd){return _0x4d5ebd?{'count':_0x599096,'rows':_0x4d5ebd}:null;}})[_0x0430('0x29')](respondWithResult(_0x18cd3d,null))[_0x0430('0x50')](handleError(_0x18cd3d,null));};exports['addLists']=function(_0x6b76be,_0xe2fdfe,_0x3eec8f){var _0x44632d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4ffe52,_0x423869;return db['VoiceQueue'][_0x0430('0x33')]({'where':{'id':_0x6b76be[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0xe2fdfe,null))[_0x0430('0x29')](function(_0x4a1d21){if(_0x4a1d21){_0x423869=_0x4a1d21;return _0x4a1d21[_0x0430('0x9e')](_0x6b76be['body']['ids'],_[_0x0430('0x5e')](_0x6b76be[_0x0430('0x54')],[_0x0430('0x84'),'id'])||{});}return null;})[_0x0430('0x95')](function(_0x5dbaaa){var _0x436ecd;_0x4ffe52=_0x5dbaaa||[];var _0x1281f5=[];if(_0x5dbaaa){for(var _0x34fcac=0x0;_0x34fcac<_0x5dbaaa[_0x0430('0x44')];_0x34fcac+=0x1){var _0xcdd830=_0x5dbaaa[_0x34fcac][_0x0430('0x2b')]({'plain':!![]});_0x423869[_0x0430('0x9f')]=_0x6b76be[_0x0430('0x54')][_0x0430('0x9f')]?_0x6b76be['body'][_0x0430('0x9f')]:_0x423869['dialCheckDuplicateType'];switch(_0x423869[_0x0430('0x9f')]){case _0x0430('0xa0'):_0x436ecd=squel[_0x0430('0xa1')]()[_0x0430('0xa2')](_0x0430('0xa3'))[_0x0430('0xa4')]([_0x0430('0xa5'),'scheduledAt',_0x0430('0xa6'),_0x0430('0xa7'),_0x0430('0x66'),'createdAt',_0x0430('0x60')],squel[_0x0430('0x85')]()[_0x0430('0x86')](_0x0430('0xa5'),_0x0430('0xa5'))[_0x0430('0x86')]('\x27'+_0x44632d+'\x27',_0x0430('0xa8'))[_0x0430('0x86')]('id',_0x0430('0xa6'))[_0x0430('0x86')](_0xcdd830[_0x0430('0xa9')][_0x0430('0xaa')](),_0x0430('0xa7'))['field'](_0x6b76be['params']['id'][_0x0430('0xaa')](),_0x0430('0x66'))['field']('\x27'+_0x44632d+'\x27',_0x0430('0x5f'))['field']('\x27'+_0x44632d+'\x27',_0x0430('0x60'))[_0x0430('0x87')](_0x0430('0xab'))[_0x0430('0x49')](_0x0430('0xac'))[_0x0430('0x49')](_0x0430('0xad'),_0xcdd830[_0x0430('0xa9')][_0x0430('0xaa')]())[_0x0430('0x49')](_0x0430('0xae'))[_0x0430('0x49')](_0x0430('0xaf'),squel[_0x0430('0x85')]()[_0x0430('0x86')](_0x0430('0xb0'))[_0x0430('0x87')](_0x0430('0xb1'))['where'](_0x0430('0x8a'),_0x6b76be[_0x0430('0x52')]['id']['toString']()))[_0x0430('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0430('0x85')]()[_0x0430('0x86')](_0x0430('0xb2'))[_0x0430('0x87')](_0x0430('0xa3'))['where']('VoiceQueueId\x20=\x20?',_0x6b76be[_0x0430('0x52')]['id'][_0x0430('0xaa')]())))['toString']();break;case _0x0430('0xb3'):_0x436ecd=squel['insert']()[_0x0430('0xa2')]('cm_hopper')[_0x0430('0xa4')]([_0x0430('0xa5'),_0x0430('0xa8'),_0x0430('0xa6'),_0x0430('0xa7'),_0x0430('0x66'),_0x0430('0x5f'),_0x0430('0x60')],squel[_0x0430('0x85')]()[_0x0430('0x86')](_0x0430('0xa5'),_0x0430('0xa5'))[_0x0430('0x86')]('\x27'+_0x44632d+'\x27','scheduledAt')[_0x0430('0x86')]('id',_0x0430('0xa6'))[_0x0430('0x86')](_0xcdd830[_0x0430('0xa9')]['toString'](),_0x0430('0xa7'))['field'](_0x6b76be[_0x0430('0x52')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x44632d+'\x27',_0x0430('0x5f'))[_0x0430('0x86')]('\x27'+_0x44632d+'\x27',_0x0430('0x60'))['from'](_0x0430('0xab'))['where'](_0x0430('0xac'))[_0x0430('0x49')](_0x0430('0xad'),_0xcdd830[_0x0430('0xa9')][_0x0430('0xaa')]())[_0x0430('0x49')](_0x0430('0xae'))[_0x0430('0x49')](_0x0430('0xaf'),squel[_0x0430('0x85')]()[_0x0430('0x86')](_0x0430('0xb2'))[_0x0430('0x87')](_0x0430('0xa3'))[_0x0430('0x49')]('VoiceQueueId\x20=\x20?',_0x6b76be[_0x0430('0x52')]['id']['toString']())))[_0x0430('0xaa')]();break;default:_0x436ecd=squel[_0x0430('0xa1')]()[_0x0430('0xa2')](_0x0430('0xa3'))[_0x0430('0xa4')]([_0x0430('0xa5'),_0x0430('0xa8'),'ContactId',_0x0430('0xa7'),_0x0430('0x66'),_0x0430('0x5f'),_0x0430('0x60')],squel[_0x0430('0x85')]()[_0x0430('0x86')](_0x0430('0xa5'),'phone')[_0x0430('0x86')]('\x27'+_0x44632d+'\x27',_0x0430('0xa8'))['field']('id',_0x0430('0xa6'))['field'](_0xcdd830[_0x0430('0xa9')][_0x0430('0xaa')](),'ListId')[_0x0430('0x86')](_0x6b76be[_0x0430('0x52')]['id'][_0x0430('0xaa')](),_0x0430('0x66'))[_0x0430('0x86')]('\x27'+_0x44632d+'\x27','createdAt')[_0x0430('0x86')]('\x27'+_0x44632d+'\x27',_0x0430('0x60'))['from'](_0x0430('0xab'))[_0x0430('0x49')]('deletedAt\x20IS\x20NULL')[_0x0430('0x49')](_0x0430('0xad'),_0xcdd830['CmListId'][_0x0430('0xaa')]())[_0x0430('0x49')](_0x0430('0xae')))[_0x0430('0xaa')]();}_0x1281f5[_0x0430('0x8b')](db[_0x0430('0x79')][_0x0430('0x3f')](_0x436ecd));}return BPromise[_0x0430('0x91')](_0x1281f5);}})['then'](function(){var _0x442c37=[];var _0x4c82c2=squel['insert']()['into']('cm_hopper_additional_phones')[_0x0430('0xa4')](['CmHopperId','phone',_0x0430('0xb4'),_0x0430('0x5f'),'updatedAt'],squel['select']()[_0x0430('0x86')](_0x0430('0xb5'))[_0x0430('0x86')](_0x0430('0xb6'))[_0x0430('0x86')](_0x0430('0xb7'))['field']('\x27'+_0x44632d+'\x27',_0x0430('0x5f'))['field']('\x27'+_0x44632d+'\x27',_0x0430('0x60'))[_0x0430('0x87')](_0x0430('0xb8'),'ci')[_0x0430('0x89')]('cm_hopper','h',_0x0430('0xb9'))[_0x0430('0x49')]('h.scheduledat=?',_0x44632d)[_0x0430('0x49')](_0x0430('0xba'),_0x0430('0xbb')))['toString']();_0x442c37[_0x0430('0x8b')](db['sequelize'][_0x0430('0x3f')](_0x4c82c2));return BPromise[_0x0430('0x91')](_0x442c37);})['then'](function(){return _0x4ffe52;})[_0x0430('0x29')](respondWithResult(_0xe2fdfe,null))['catch'](handleError(_0xe2fdfe,null));};exports[_0x0430('0xbc')]=function(_0x19804f,_0x5c9535,_0x3a83ee){return db[_0x0430('0x3a')][_0x0430('0x33')]({'where':{'id':_0x19804f[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x5c9535,null))['then'](function(_0x332f55){if(_0x332f55){return _0x332f55[_0x0430('0xbc')](_0x19804f[_0x0430('0x3f')][_0x0430('0x84')]);}})['then'](function(_0x4e6c35){if(_0x4e6c35){return db[_0x0430('0x65')][_0x0430('0x2a')]({'where':{'ListId':_0x19804f[_0x0430('0x3f')][_0x0430('0x84')],'VoiceQueueId':_0x19804f[_0x0430('0x52')]['id']}})['then'](function(){return _0x4e6c35;});}})[_0x0430('0x29')](respondWithStatusCode(_0x5c9535,null))['catch'](handleError(_0x5c9535,null));};exports[_0x0430('0xbd')]=function(_0x532e31,_0x5c2c20,_0x2a6995){var _0x20988c={};var _0x12ca59={};var _0x5a503d;var _0x386a98;return db['VoiceQueue'][_0x0430('0x64')]({'where':{'id':_0x532e31[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x5c2c20,null))[_0x0430('0x29')](function(_0x37d782){if(_0x37d782){_0x5a503d=_0x37d782;_0x12ca59[_0x0430('0x3d')]=_[_0x0430('0x3e')](db[_0x0430('0x9c')][_0x0430('0x5c')]);_0x12ca59[_0x0430('0x3f')]=_['keys'](_0x532e31[_0x0430('0x3f')]);_0x12ca59[_0x0430('0x40')]=_['intersection'](_0x12ca59[_0x0430('0x3d')],_0x12ca59[_0x0430('0x3f')]);_0x20988c[_0x0430('0x42')]=_[_0x0430('0x41')](_0x12ca59[_0x0430('0x3d')],qs[_0x0430('0x43')](_0x532e31[_0x0430('0x3f')][_0x0430('0x43')]));_0x20988c[_0x0430('0x42')]=_0x20988c[_0x0430('0x42')][_0x0430('0x44')]?_0x20988c[_0x0430('0x42')]:_0x12ca59[_0x0430('0x3d')];_0x20988c[_0x0430('0x47')]=qs[_0x0430('0x48')](_0x532e31['query']['sort']);_0x20988c[_0x0430('0x49')]=qs[_0x0430('0x40')](_['pick'](_0x532e31[_0x0430('0x3f')],_0x12ca59['filters']));if(_0x532e31[_0x0430('0x3f')]['filter']){_0x20988c[_0x0430('0x49')]=_[_0x0430('0x4b')](_0x20988c['where'],{'$or':_[_0x0430('0x31')](_0x20988c[_0x0430('0x42')],function(_0x2de582){var _0x50f175={};_0x50f175[_0x2de582]={'$like':'%'+_0x532e31[_0x0430('0x3f')]['filter']+'%'};return _0x50f175;})});}_0x20988c=_[_0x0430('0x4b')]({},_0x20988c,_0x532e31['options']);return _0x5a503d[_0x0430('0xbd')](_0x20988c);}})[_0x0430('0x29')](function(_0x5ded95){if(_0x5ded95){_0x386a98=_0x5ded95['length'];if(!_0x532e31[_0x0430('0x3f')][_0x0430('0x45')]('nolimit')){_0x20988c[_0x0430('0x23')]=qs[_0x0430('0x23')](_0x532e31['query']['limit']);_0x20988c[_0x0430('0x20')]=qs[_0x0430('0x20')](_0x532e31[_0x0430('0x3f')]['offset']);}return _0x5a503d[_0x0430('0xbd')](_0x20988c);}})[_0x0430('0x29')](function(_0x39898c){if(_0x39898c){return _0x39898c?{'count':_0x386a98,'rows':_0x39898c}:null;}})[_0x0430('0x29')](respondWithResult(_0x5c2c20,null))[_0x0430('0x50')](handleError(_0x5c2c20,null));};exports[_0x0430('0xbe')]=function(_0x471560,_0x3ab23c,_0x3364db){var _0x5afd8a,_0x4dbbaa;return db['VoiceQueue'][_0x0430('0x33')]({'where':{'id':_0x471560[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x3ab23c,null))[_0x0430('0x29')](function(_0x339e63){if(_0x339e63){_0x4dbbaa=_0x339e63;return _0x339e63[_0x0430('0xbe')](_0x471560['body'][_0x0430('0x84')],_[_0x0430('0x5e')](_0x471560[_0x0430('0x54')],[_0x0430('0x84'),'id'])||{});}return null;})[_0x0430('0x95')](function(_0x4311dd){var _0x3a96b4;_0x5afd8a=_0x4311dd||[];var _0x52aeb0=[];if(_0x4311dd){for(var _0x32760b=0x0;_0x32760b<_0x4311dd['length'];_0x32760b+=0x1){var _0x232a5e=_0x4311dd[_0x32760b][_0x0430('0x2b')]({'plain':!![]});_0x3a96b4=squel['insert']()['into'](_0x0430('0xbf'))[_0x0430('0xa4')]([_0x0430('0xa5'),_0x0430('0xa6'),'ListId',_0x0430('0x66'),_0x0430('0x5f'),_0x0430('0x60')],squel[_0x0430('0x85')]()[_0x0430('0x86')](_0x0430('0xa5'),_0x0430('0xa5'))['field']('id',_0x0430('0xa6'))[_0x0430('0x86')](_0x232a5e[_0x0430('0xa9')][_0x0430('0xaa')](),_0x0430('0xa7'))[_0x0430('0x86')](_0x471560[_0x0430('0x52')]['id'][_0x0430('0xaa')](),_0x0430('0x66'))['field'](_0x0430('0xc0'),'createdAt')['field']('NOW()','updatedAt')[_0x0430('0x87')](_0x0430('0xab'))[_0x0430('0x49')](_0x0430('0xac'))[_0x0430('0x49')](_0x0430('0xad'),_0x232a5e[_0x0430('0xa9')][_0x0430('0xaa')]())[_0x0430('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0x0430('0xaa')]();_0x52aeb0['push'](db['sequelize']['query'](_0x3a96b4));}return BPromise['all'](_0x52aeb0);}})[_0x0430('0x29')](function(){return _0x5afd8a;})[_0x0430('0x29')](respondWithResult(_0x3ab23c,null))[_0x0430('0x50')](handleError(_0x3ab23c,null));};exports['removeBlackLists']=function(_0x47275d,_0x251307,_0x85df42){return db[_0x0430('0x3a')][_0x0430('0x33')]({'where':{'id':_0x47275d[_0x0430('0x52')]['id']}})[_0x0430('0x29')](handleEntityNotFound(_0x251307,null))['then'](function(_0x34bab7){if(_0x34bab7){return _0x34bab7[_0x0430('0xc1')](_0x47275d[_0x0430('0x3f')]['ids']);}})[_0x0430('0x29')](function(_0x298c4d){if(_0x298c4d){return db[_0x0430('0x6d')][_0x0430('0x2a')]({'where':{'ListId':_0x47275d['query'][_0x0430('0x84')],'VoiceQueueId':_0x47275d[_0x0430('0x52')]['id']}})[_0x0430('0x29')](function(){return _0x298c4d;});}})[_0x0430('0x29')](respondWithStatusCode(_0x251307,null))['catch'](handleError(_0x251307,null));}; \ No newline at end of file +var _0x8f9d=['save','then','destroy','VoiceQueues','inbound','filter','ignore','value','type','find','UserProfileResource','error','send','index','map','rawAttributes','fieldName','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','VoiceQueue','findAll','rows','catch','show','params','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','updatedAt','createdAt','autoAssociation','update','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','order','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','voicePause','interface','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','emit','userVoiceQueue:save','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','union','compact','userVoiceQueue:remove','addAgents','ids','online','isEmpty','all','removeAgents','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','insert','into','fromQuery','scheduledAt','ContactId','select','phone','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper','onlyIfOpen','CmListId','COALESCE(phone,\x27\x27)','cm_contacts','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject'];(function(_0x2a1899,_0x5a9c64){var _0x594109=function(_0x16ba84){while(--_0x16ba84){_0x2a1899['push'](_0x2a1899['shift']());}};_0x594109(++_0x5a9c64);}(_0x8f9d,0x93));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xd8f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8f9('0x2'));var moment=require(_0xd8f9('0x3'));var BPromise=require(_0xd8f9('0x4'));var Mustache=require(_0xd8f9('0x5'));var util=require(_0xd8f9('0x6'));var path=require(_0xd8f9('0x7'));var sox=require(_0xd8f9('0x8'));var csv=require('to-csv');var ejs=require(_0xd8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xd8f9('0xa'));var _=require(_0xd8f9('0xb'));var squel=require(_0xd8f9('0xc'));var crypto=require(_0xd8f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd8f9('0xe'));var toCsv=require(_0xd8f9('0xf'));var querystring=require('querystring');var Papa=require(_0xd8f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd8f9('0x11'));var as=require(_0xd8f9('0x12'));var hardwareService=require(_0xd8f9('0x13'));var logger=require(_0xd8f9('0x14'))(_0xd8f9('0x15'));var utils=require(_0xd8f9('0x16'));var config=require(_0xd8f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8f9('0x18'))['db'];config['redis']=_[_0xd8f9('0x19')](config[_0xd8f9('0x1a')],{'host':_0xd8f9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8f9('0x1a')]));require(_0xd8f9('0x1c'))[_0xd8f9('0x1d')](socket);function respondWithStatusCode(_0x223f10,_0x4c11f2){_0x4c11f2=_0x4c11f2||0xcc;return function(_0x3529e9){if(_0x3529e9){return _0x223f10[_0xd8f9('0x1e')](_0x4c11f2);}return _0x223f10[_0xd8f9('0x1f')](_0x4c11f2)[_0xd8f9('0x20')]();};}function respondWithResult(_0x3a3a41,_0x19603a){_0x19603a=_0x19603a||0xc8;return function(_0x566448){if(_0x566448){return _0x3a3a41['status'](_0x19603a)['json'](_0x566448);}};}function respondWithFilteredResult(_0x284a1a,_0xc6a825){return function(_0x4d5b8d){if(_0x4d5b8d){var _0x35943f=typeof _0xc6a825['offset']===_0xd8f9('0x21')&&typeof _0xc6a825['limit']==='undefined';var _0x58956e=_0x4d5b8d[_0xd8f9('0x22')];var _0x5d094d=_0x35943f?0x0:_0xc6a825[_0xd8f9('0x23')];var _0xef802d=_0x35943f?_0x4d5b8d[_0xd8f9('0x22')]:_0xc6a825[_0xd8f9('0x23')]+_0xc6a825[_0xd8f9('0x24')];var _0x45b2e3;if(_0xef802d>=_0x58956e){_0xef802d=_0x58956e;_0x45b2e3=0xc8;}else{_0x45b2e3=0xce;}_0x284a1a['status'](_0x45b2e3);return _0x284a1a[_0xd8f9('0x25')](_0xd8f9('0x26'),_0x5d094d+'-'+_0xef802d+'/'+_0x58956e)[_0xd8f9('0x27')](_0x4d5b8d);}return null;};}function patchUpdates(_0x36d740){return function(_0x1bf210){try{jsonpatch[_0xd8f9('0x28')](_0x1bf210,_0x36d740,!![]);}catch(_0x4c5808){return BPromise[_0xd8f9('0x29')](_0x4c5808);}return _0x1bf210[_0xd8f9('0x2a')]();};}function saveUpdates(_0x1fcd45,_0x956cc3){return function(_0x290553){if(_0x290553){return _0x290553['update'](_0x1fcd45)[_0xd8f9('0x2b')](function(_0x1d6796){return _0x1d6796;});}return null;};}function removeEntity(_0x28854a,_0xd15475){return function(_0x3e68dc){if(_0x3e68dc){return _0x3e68dc[_0xd8f9('0x2c')]()[_0xd8f9('0x2b')](function(){var _0x461880=_0x3e68dc['get']({'plain':!![]});var _0x464a6a=[{'name':_0xd8f9('0x2d'),'value':_0xd8f9('0x2e'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x4c08b0=_(_0x464a6a)[_0xd8f9('0x2f')](_0xd8f9('0x30'))['map'](_0xd8f9('0x31'))[_0xd8f9('0x31')]();if(_['includes'](_0x4c08b0,_0x461880[_0xd8f9('0x32')])){return;}var _0x13fa4b=_[_0xd8f9('0x33')](_0x464a6a,['value',_0x461880[_0xd8f9('0x32')]])['name'];return db[_0xd8f9('0x34')][_0xd8f9('0x2c')]({'where':{'type':_0x13fa4b,'resourceId':_0x461880['id']}})['then'](function(){return _0x3e68dc;});})[_0xd8f9('0x2b')](function(){_0x28854a['status'](0xcc)[_0xd8f9('0x20')]();});}};}function handleEntityNotFound(_0x45f8bf,_0x26b7ff){return function(_0x394399){if(!_0x394399){_0x45f8bf[_0xd8f9('0x1e')](0x194);}return _0x394399;};}function handleError(_0x105f00,_0xcfd867){_0xcfd867=_0xcfd867||0x1f4;return function(_0x5211c2){logger[_0xd8f9('0x35')](_0x5211c2['stack']);if(_0x5211c2['name']){delete _0x5211c2['name'];}_0x105f00['status'](_0xcfd867)[_0xd8f9('0x36')](_0x5211c2);};}exports[_0xd8f9('0x37')]=function(_0x1ee3f0,_0x1ec068){var _0x36b8fa={},_0x5b197a={},_0x4e7265={'count':0x0,'rows':[]};var _0x1d5c7d=_[_0xd8f9('0x38')](db['VoiceQueue'][_0xd8f9('0x39')],function(_0x204ead){return{'name':_0x204ead[_0xd8f9('0x3a')],'type':_0x204ead['type']['key']};});_0x5b197a['model']=_['map'](_0x1d5c7d,_0xd8f9('0x3b'));_0x5b197a[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x1ee3f0[_0xd8f9('0x3c')]);_0x5b197a[_0xd8f9('0x3e')]=_['intersection'](_0x5b197a[_0xd8f9('0x3f')],_0x5b197a[_0xd8f9('0x3c')]);_0x36b8fa[_0xd8f9('0x40')]=_[_0xd8f9('0x41')](_0x5b197a[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x1ee3f0[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x36b8fa[_0xd8f9('0x40')]=_0x36b8fa[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x36b8fa['attributes']:_0x5b197a[_0xd8f9('0x3f')];if(!_0x1ee3f0[_0xd8f9('0x3c')][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x36b8fa['limit']=qs[_0xd8f9('0x24')](_0x1ee3f0[_0xd8f9('0x3c')][_0xd8f9('0x24')]);_0x36b8fa[_0xd8f9('0x23')]=qs[_0xd8f9('0x23')](_0x1ee3f0[_0xd8f9('0x3c')]['offset']);}_0x36b8fa['order']=qs['sort'](_0x1ee3f0[_0xd8f9('0x3c')][_0xd8f9('0x46')]);_0x36b8fa[_0xd8f9('0x47')]=qs[_0xd8f9('0x3e')](_[_0xd8f9('0x48')](_0x1ee3f0[_0xd8f9('0x3c')],_0x5b197a[_0xd8f9('0x3e')]),_0x1d5c7d);if(_0x1ee3f0[_0xd8f9('0x3c')][_0xd8f9('0x2f')]){_0x36b8fa['where']=_['merge'](_0x36b8fa[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x1d5c7d,function(_0x2993a2){if(_0x2993a2['type']!=='VIRTUAL'){var _0x32c300={};_0x32c300[_0x2993a2[_0xd8f9('0x3b')]]={'$like':'%'+_0x1ee3f0[_0xd8f9('0x3c')]['filter']+'%'};return _0x32c300;}})});}_0x36b8fa=_[_0xd8f9('0x49')]({},_0x36b8fa,_0x1ee3f0[_0xd8f9('0x4a')]);var _0x153260={'where':_0x36b8fa[_0xd8f9('0x47')]};return db[_0xd8f9('0x4b')][_0xd8f9('0x22')](_0x153260)[_0xd8f9('0x2b')](function(_0x188d3a){_0x4e7265[_0xd8f9('0x22')]=_0x188d3a;if(_0x1ee3f0['query']['includeAll']){_0x36b8fa['include']=[{'all':!![]}];}return db[_0xd8f9('0x4b')][_0xd8f9('0x4c')](_0x36b8fa);})[_0xd8f9('0x2b')](function(_0x256e8a){_0x4e7265[_0xd8f9('0x4d')]=_0x256e8a;return _0x4e7265;})[_0xd8f9('0x2b')](respondWithFilteredResult(_0x1ec068,_0x36b8fa))[_0xd8f9('0x4e')](handleError(_0x1ec068,null));};exports[_0xd8f9('0x4f')]=function(_0x26527c,_0x521b07){var _0x35f7a6={'raw':![],'where':{'id':_0x26527c[_0xd8f9('0x50')]['id']}},_0xd5bb17={};_0xd5bb17['model']=_[_0xd8f9('0x3d')](db[_0xd8f9('0x4b')][_0xd8f9('0x39')]);_0xd5bb17[_0xd8f9('0x3c')]=_['keys'](_0x26527c[_0xd8f9('0x3c')]);_0xd5bb17['filters']=_['intersection'](_0xd5bb17[_0xd8f9('0x3f')],_0xd5bb17[_0xd8f9('0x3c')]);_0x35f7a6[_0xd8f9('0x40')]=_[_0xd8f9('0x41')](_0xd5bb17[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x26527c[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x35f7a6[_0xd8f9('0x40')]=_0x35f7a6[_0xd8f9('0x40')]['length']?_0x35f7a6['attributes']:_0xd5bb17['model'];if(_0x26527c[_0xd8f9('0x3c')][_0xd8f9('0x51')]){_0x35f7a6['include']=[{'all':!![]}];}_0x35f7a6=_[_0xd8f9('0x49')]({},_0x35f7a6,_0x26527c[_0xd8f9('0x4a')]);return db[_0xd8f9('0x4b')][_0xd8f9('0x33')](_0x35f7a6)[_0xd8f9('0x2b')](handleEntityNotFound(_0x521b07,null))[_0xd8f9('0x2b')](respondWithResult(_0x521b07,null))[_0xd8f9('0x4e')](handleError(_0x521b07,null));};exports[_0xd8f9('0x52')]=function(_0x50efce,_0x34f14e){return db[_0xd8f9('0x4b')][_0xd8f9('0x52')](_0x50efce[_0xd8f9('0x53')],{})[_0xd8f9('0x2b')](function(_0x3b489d){var _0x51a978=_0x50efce[_0xd8f9('0x54')][_0xd8f9('0x55')]({'plain':!![]});if(!_0x51a978)throw new Error(_0xd8f9('0x56'));if(_0x51a978[_0xd8f9('0x57')]==='user'){var _0x21555c=_0x3b489d[_0xd8f9('0x55')]({'plain':!![]});var _0x181ad7=[{'name':_0xd8f9('0x2d'),'value':'inbound'},{'name':_0xd8f9('0x58'),'value':_0xd8f9('0x59')}];var _0x3ac9f6=_['find'](_0x181ad7,[_0xd8f9('0x31'),_0x21555c[_0xd8f9('0x32')]])[_0xd8f9('0x3b')];return db[_0xd8f9('0x5a')]['find']({'where':{'name':_0x3ac9f6,'userProfileId':_0x51a978[_0xd8f9('0x5b')]},'raw':!![]})[_0xd8f9('0x2b')](function(_0x5c0ff9){if(_0x5c0ff9&&_0x5c0ff9['autoAssociation']===0x0){return db[_0xd8f9('0x34')][_0xd8f9('0x52')]({'name':_0x21555c[_0xd8f9('0x3b')],'resourceId':_0x21555c['id'],'type':_0x5c0ff9['name'],'sectionId':_0x5c0ff9['id']},{})[_0xd8f9('0x2b')](function(){return _0x3b489d;});}else{return _0x3b489d;}})['catch'](function(_0x1a45a8){logger['error'](_0xd8f9('0x5c'),_0x1a45a8);throw _0x1a45a8;});}return _0x3b489d;})[_0xd8f9('0x2b')](respondWithResult(_0x34f14e,0xc9))[_0xd8f9('0x4e')](handleError(_0x34f14e,null));};exports[_0xd8f9('0x5d')]=function(_0x5d3dec,_0x30748c){var _0x2b12be={'where':{'id':_0x5d3dec[_0xd8f9('0x50')]['id']}},_0x10aa0a={};_0x10aa0a[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db[_0xd8f9('0x4b')][_0xd8f9('0x39')]);_0x2b12be['attributes']=_[_0xd8f9('0x41')](_0x10aa0a[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x5d3dec[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x2b12be['attributes']=_0x2b12be['attributes']['length']?_0x2b12be[_0xd8f9('0x40')]:_0x10aa0a[_0xd8f9('0x3f')];if(_0x5d3dec['query']['includeAll']){_0x2b12be[_0xd8f9('0x5e')]=[{'all':!![]}];}_0x2b12be=_[_0xd8f9('0x49')]({},_0x2b12be,_0x5d3dec[_0xd8f9('0x4a')]);return db[_0xd8f9('0x4b')][_0xd8f9('0x33')](_0x2b12be)[_0xd8f9('0x2b')](handleEntityNotFound(_0x30748c,null))['then'](function(_0x2855a1){if(_0x2855a1){var _0x452079=_0x2855a1[_0xd8f9('0x55')]({'plain':!![]});_0x452079=qs[_0xd8f9('0x5f')](_0x452079,['id','createdAt',_0xd8f9('0x60')]);_0x5d3dec[_0xd8f9('0x53')]=_[_0xd8f9('0x5f')](_0x5d3dec[_0xd8f9('0x53')],['id',_0xd8f9('0x61'),_0xd8f9('0x60')]);return db[_0xd8f9('0x4b')][_0xd8f9('0x52')](_[_0xd8f9('0x49')](_0x452079,_0x5d3dec['body']),{'include':_0x5d3dec['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd8f9('0x2b')](function(_0x100eec){var _0x2a8815=_0x5d3dec[_0xd8f9('0x54')][_0xd8f9('0x55')]({'plain':!![]});if(!_0x2a8815)throw new Error(_0xd8f9('0x56'));if(_0x2a8815[_0xd8f9('0x57')]===_0xd8f9('0x54')){var _0x5865ec=_0x100eec[_0xd8f9('0x55')]({'plain':!![]});var _0x5a329a=[{'name':_0xd8f9('0x2d'),'value':_0xd8f9('0x2e')},{'name':_0xd8f9('0x58'),'value':_0xd8f9('0x59')}];var _0x28f06f=_[_0xd8f9('0x33')](_0x5a329a,[_0xd8f9('0x31'),_0x5865ec[_0xd8f9('0x32')]])['name'];return db[_0xd8f9('0x5a')]['find']({'where':{'name':_0x28f06f,'userProfileId':_0x2a8815[_0xd8f9('0x5b')]},'raw':!![]})['then'](function(_0x536a9f){if(_0x536a9f&&_0x536a9f[_0xd8f9('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5865ec[_0xd8f9('0x3b')],'resourceId':_0x5865ec['id'],'type':_0x536a9f[_0xd8f9('0x3b')],'sectionId':_0x536a9f['id']},{})[_0xd8f9('0x2b')](function(){return _0x100eec;});}else{return _0x100eec;}})[_0xd8f9('0x4e')](function(_0x371056){logger['error'](_0xd8f9('0x5c'),_0x371056);throw _0x371056;});}return _0x100eec;});}})[_0xd8f9('0x2b')](respondWithResult(_0x30748c,0xc9))['catch'](handleError(_0x30748c,null));};exports[_0xd8f9('0x63')]=function(_0x1ca6a9,_0x2230af){if(_0x1ca6a9[_0xd8f9('0x53')]['id']){delete _0x1ca6a9['body']['id'];}return db[_0xd8f9('0x4b')]['find']({'where':{'id':_0x1ca6a9[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x2230af,null))[_0xd8f9('0x2b')](saveUpdates(_0x1ca6a9[_0xd8f9('0x53')],null))[_0xd8f9('0x2b')](respondWithResult(_0x2230af,null))[_0xd8f9('0x4e')](handleError(_0x2230af,null));};exports[_0xd8f9('0x2c')]=function(_0x11c577,_0x24129d){return db[_0xd8f9('0x4b')][_0xd8f9('0x33')]({'where':{'id':_0x11c577[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x24129d,null))[_0xd8f9('0x2b')](removeEntity(_0x24129d,null))[_0xd8f9('0x4e')](handleError(_0x24129d,null));};exports[_0xd8f9('0x64')]=function(_0x315575,_0x260185,_0x5e8548){var _0x3fb837={'raw':![],'where':{}};var _0x3206f7={};var _0x516957={'count':0x0,'rows':[]};return db[_0xd8f9('0x4b')][_0xd8f9('0x65')]({'where':{'id':_0x315575[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x260185,null))[_0xd8f9('0x2b')](function(_0x5eb7e8){if(_0x5eb7e8){_0x3206f7[_0xd8f9('0x3f')]=_['keys'](db[_0xd8f9('0x66')]['rawAttributes']);_0x3206f7[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x315575['query']);_0x3206f7[_0xd8f9('0x3e')]=_['intersection'](_0x3206f7['model'],_0x3206f7[_0xd8f9('0x3c')]);_0x3fb837['attributes']=_['intersection'](_0x3206f7[_0xd8f9('0x3f')],qs['fields'](_0x315575[_0xd8f9('0x3c')]['fields']));_0x3fb837[_0xd8f9('0x40')]=_0x3fb837[_0xd8f9('0x40')]['length']?_0x3fb837[_0xd8f9('0x40')]:_0x3206f7[_0xd8f9('0x3f')];if(!_0x315575[_0xd8f9('0x3c')][_0xd8f9('0x44')]('nolimit')){_0x3fb837[_0xd8f9('0x24')]=qs[_0xd8f9('0x24')](_0x315575[_0xd8f9('0x3c')][_0xd8f9('0x24')]);_0x3fb837[_0xd8f9('0x23')]=qs[_0xd8f9('0x23')](_0x315575[_0xd8f9('0x3c')][_0xd8f9('0x23')]);}_0x3fb837['order']=qs[_0xd8f9('0x46')](_0x315575[_0xd8f9('0x3c')]['sort']);_0x3fb837['where']=qs['filters'](_[_0xd8f9('0x48')](_0x315575[_0xd8f9('0x3c')],_0x3206f7[_0xd8f9('0x3e')]));_0x3fb837[_0xd8f9('0x47')][_0xd8f9('0x67')]=_0x5eb7e8['id'];if(_0x315575['query'][_0xd8f9('0x2f')]){_0x3fb837[_0xd8f9('0x47')]=_[_0xd8f9('0x49')](_0x3fb837[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x3fb837['attributes'],function(_0x1959b1){var _0x5cdd2b={};_0x5cdd2b[_0x1959b1]={'$like':'%'+_0x315575[_0xd8f9('0x3c')]['filter']+'%'};return _0x5cdd2b;})});}_0x3fb837=_[_0xd8f9('0x49')]({},_0x3fb837,_0x315575['options']);return db[_0xd8f9('0x66')][_0xd8f9('0x22')]({'where':_0x3fb837[_0xd8f9('0x47')]})['then'](function(_0x1a9d4f){_0x516957['count']=_0x1a9d4f;if(_0x315575[_0xd8f9('0x3c')][_0xd8f9('0x51')]){_0x3fb837[_0xd8f9('0x5e')]=[{'all':!![]}];}return db[_0xd8f9('0x66')][_0xd8f9('0x4c')](_0x3fb837);})[_0xd8f9('0x2b')](function(_0x5abbba){_0x516957[_0xd8f9('0x4d')]=_0x5abbba;return _0x516957;});}})[_0xd8f9('0x2b')](respondWithFilteredResult(_0x260185,_0x3fb837))[_0xd8f9('0x4e')](handleError(_0x260185,null));};exports[_0xd8f9('0x68')]=function(_0x3db156,_0x2407dc,_0x3feace){var _0x54bf5f={'raw':!![],'where':{}};var _0x161e91={};var _0x5b452d={'count':0x0,'rows':[]};return db[_0xd8f9('0x4b')][_0xd8f9('0x65')]({'where':{'id':_0x3db156[_0xd8f9('0x50')]['id']}})['then'](handleEntityNotFound(_0x2407dc,null))['then'](function(_0x430c13){if(_0x430c13){_0x161e91[_0xd8f9('0x3f')]=_['keys'](db['CmHopperHistory'][_0xd8f9('0x39')]);_0x161e91[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x3db156[_0xd8f9('0x3c')]);_0x161e91[_0xd8f9('0x3e')]=_[_0xd8f9('0x41')](_0x161e91['model'],_0x161e91[_0xd8f9('0x3c')]);_0x54bf5f['attributes']=_[_0xd8f9('0x41')](_0x161e91[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x3db156['query'][_0xd8f9('0x42')]));_0x54bf5f['attributes']=_0x54bf5f[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x54bf5f[_0xd8f9('0x40')]:_0x161e91['model'];if(!_0x3db156[_0xd8f9('0x3c')][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x54bf5f[_0xd8f9('0x24')]=qs[_0xd8f9('0x24')](_0x3db156[_0xd8f9('0x3c')][_0xd8f9('0x24')]);_0x54bf5f[_0xd8f9('0x23')]=qs[_0xd8f9('0x23')](_0x3db156[_0xd8f9('0x3c')]['offset']);}_0x54bf5f[_0xd8f9('0x69')]=qs[_0xd8f9('0x46')](_0x3db156['query'][_0xd8f9('0x46')]);_0x54bf5f['where']=qs[_0xd8f9('0x3e')](_[_0xd8f9('0x48')](_0x3db156[_0xd8f9('0x3c')],_0x161e91[_0xd8f9('0x3e')]));_0x54bf5f[_0xd8f9('0x47')]['VoiceQueueId']=_0x430c13['id'];if(_0x3db156[_0xd8f9('0x3c')][_0xd8f9('0x2f')]){_0x54bf5f[_0xd8f9('0x47')]=_[_0xd8f9('0x49')](_0x54bf5f[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x54bf5f[_0xd8f9('0x40')],function(_0xfd1c36){var _0xf61375={};_0xf61375[_0xfd1c36]={'$like':'%'+_0x3db156[_0xd8f9('0x3c')][_0xd8f9('0x2f')]+'%'};return _0xf61375;})});}_0x54bf5f=_[_0xd8f9('0x49')]({},_0x54bf5f,_0x3db156[_0xd8f9('0x4a')]);return db[_0xd8f9('0x6a')][_0xd8f9('0x22')]({'where':_0x54bf5f[_0xd8f9('0x47')]})[_0xd8f9('0x2b')](function(_0x3db014){_0x5b452d['count']=_0x3db014;if(_0x3db156[_0xd8f9('0x3c')][_0xd8f9('0x51')]){_0x54bf5f[_0xd8f9('0x5e')]=[{'all':!![]}];}return db[_0xd8f9('0x6a')][_0xd8f9('0x4c')](_0x54bf5f);})[_0xd8f9('0x2b')](function(_0xec7fcc){_0x5b452d['rows']=_0xec7fcc;return _0x5b452d;});}})['then'](respondWithFilteredResult(_0x2407dc,_0x54bf5f))[_0xd8f9('0x4e')](handleError(_0x2407dc,null));};exports['getHopperFinals']=function(_0x5a19b5,_0x3ed6ad,_0x54a7b1){var _0x426179={'raw':!![],'where':{}};var _0x15eebe={};var _0x3859c7={'count':0x0,'rows':[]};return db[_0xd8f9('0x4b')][_0xd8f9('0x65')]({'where':{'id':_0x5a19b5[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x3ed6ad,null))['then'](function(_0x22bd60){if(_0x22bd60){_0x15eebe[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db['CmHopperFinal']['rawAttributes']);_0x15eebe[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x5a19b5[_0xd8f9('0x3c')]);_0x15eebe['filters']=_['intersection'](_0x15eebe['model'],_0x15eebe[_0xd8f9('0x3c')]);_0x426179[_0xd8f9('0x40')]=_['intersection'](_0x15eebe[_0xd8f9('0x3f')],qs['fields'](_0x5a19b5['query'][_0xd8f9('0x42')]));_0x426179[_0xd8f9('0x40')]=_0x426179[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x426179['attributes']:_0x15eebe[_0xd8f9('0x3f')];if(!_0x5a19b5[_0xd8f9('0x3c')][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x426179[_0xd8f9('0x24')]=qs[_0xd8f9('0x24')](_0x5a19b5[_0xd8f9('0x3c')]['limit']);_0x426179[_0xd8f9('0x23')]=qs[_0xd8f9('0x23')](_0x5a19b5['query']['offset']);}_0x426179[_0xd8f9('0x69')]=qs[_0xd8f9('0x46')](_0x5a19b5[_0xd8f9('0x3c')][_0xd8f9('0x46')]);_0x426179[_0xd8f9('0x47')]=qs[_0xd8f9('0x3e')](_[_0xd8f9('0x48')](_0x5a19b5[_0xd8f9('0x3c')],_0x15eebe['filters']));_0x426179[_0xd8f9('0x47')][_0xd8f9('0x67')]=_0x22bd60['id'];if(_0x5a19b5['query'][_0xd8f9('0x2f')]){_0x426179[_0xd8f9('0x47')]=_['merge'](_0x426179[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x426179['attributes'],function(_0x28a115){var _0x34f02c={};_0x34f02c[_0x28a115]={'$like':'%'+_0x5a19b5[_0xd8f9('0x3c')][_0xd8f9('0x2f')]+'%'};return _0x34f02c;})});}_0x426179=_['merge']({},_0x426179,_0x5a19b5[_0xd8f9('0x4a')]);return db[_0xd8f9('0x6b')][_0xd8f9('0x22')]({'where':_0x426179[_0xd8f9('0x47')]})[_0xd8f9('0x2b')](function(_0x47648c){_0x3859c7[_0xd8f9('0x22')]=_0x47648c;if(_0x5a19b5['query'][_0xd8f9('0x51')]){_0x426179[_0xd8f9('0x5e')]=[{'all':!![]}];}return db[_0xd8f9('0x6b')][_0xd8f9('0x4c')](_0x426179);})[_0xd8f9('0x2b')](function(_0x371724){_0x3859c7[_0xd8f9('0x4d')]=_0x371724;return _0x3859c7;});}})['then'](respondWithFilteredResult(_0x3ed6ad,_0x426179))[_0xd8f9('0x4e')](handleError(_0x3ed6ad,null));};exports[_0xd8f9('0x6c')]=function(_0x2ab7ec,_0x33fe44,_0x327805){var _0x205191={'raw':!![],'where':{}};var _0x4c80b4={};var _0x78bac0={'count':0x0,'rows':[]};return db[_0xd8f9('0x4b')]['findOne']({'where':{'id':_0x2ab7ec['params']['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x33fe44,null))[_0xd8f9('0x2b')](function(_0x4e2305){if(_0x4e2305){_0x4c80b4[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db[_0xd8f9('0x6d')]['rawAttributes']);_0x4c80b4[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x2ab7ec['query']);_0x4c80b4[_0xd8f9('0x3e')]=_['intersection'](_0x4c80b4[_0xd8f9('0x3f')],_0x4c80b4[_0xd8f9('0x3c')]);_0x205191[_0xd8f9('0x40')]=_['intersection'](_0x4c80b4[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x2ab7ec[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x205191[_0xd8f9('0x40')]=_0x205191[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x205191['attributes']:_0x4c80b4[_0xd8f9('0x3f')];if(!_0x2ab7ec['query'][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x205191[_0xd8f9('0x24')]=qs[_0xd8f9('0x24')](_0x2ab7ec[_0xd8f9('0x3c')][_0xd8f9('0x24')]);_0x205191[_0xd8f9('0x23')]=qs['offset'](_0x2ab7ec[_0xd8f9('0x3c')][_0xd8f9('0x23')]);}_0x205191[_0xd8f9('0x69')]=qs['sort'](_0x2ab7ec['query']['sort']);_0x205191[_0xd8f9('0x47')]=qs[_0xd8f9('0x3e')](_[_0xd8f9('0x48')](_0x2ab7ec[_0xd8f9('0x3c')],_0x4c80b4[_0xd8f9('0x3e')]));_0x205191['where']['VoiceQueueId']=_0x4e2305['id'];if(_0x2ab7ec[_0xd8f9('0x3c')][_0xd8f9('0x2f')]){_0x205191[_0xd8f9('0x47')]=_[_0xd8f9('0x49')](_0x205191[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x205191['attributes'],function(_0x35ab12){var _0xdd45ab={};_0xdd45ab[_0x35ab12]={'$like':'%'+_0x2ab7ec[_0xd8f9('0x3c')]['filter']+'%'};return _0xdd45ab;})});}_0x205191=_[_0xd8f9('0x49')]({},_0x205191,_0x2ab7ec[_0xd8f9('0x4a')]);return db[_0xd8f9('0x6d')][_0xd8f9('0x22')]({'where':_0x205191[_0xd8f9('0x47')]})['then'](function(_0x1543e5){_0x78bac0['count']=_0x1543e5;if(_0x2ab7ec[_0xd8f9('0x3c')]['includeAll']){_0x205191['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x205191);})[_0xd8f9('0x2b')](function(_0x30c5b7){_0x78bac0['rows']=_0x30c5b7;return _0x78bac0;});}})[_0xd8f9('0x2b')](respondWithFilteredResult(_0x33fe44,_0x205191))['catch'](handleError(_0x33fe44,null));};exports[_0xd8f9('0x6e')]=function(_0x3297df,_0x3e4b1b,_0x5c302a){var _0x29739f={};var _0xf6273e={};var _0x38ed44;var _0x328bd7;return db['VoiceQueue'][_0xd8f9('0x65')]({'where':{'id':_0x3297df[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x3e4b1b,null))['then'](function(_0x455deb){if(_0x455deb){_0x38ed44=_0x455deb;_0xf6273e[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db['Team'][_0xd8f9('0x39')]);_0xf6273e['query']=_['keys'](_0x3297df['query']);_0xf6273e['filters']=_[_0xd8f9('0x41')](_0xf6273e['model'],_0xf6273e[_0xd8f9('0x3c')]);_0x29739f[_0xd8f9('0x40')]=_[_0xd8f9('0x41')](_0xf6273e[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x3297df[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x29739f[_0xd8f9('0x40')]=_0x29739f[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x29739f[_0xd8f9('0x40')]:_0xf6273e[_0xd8f9('0x3f')];_0x29739f[_0xd8f9('0x69')]=qs[_0xd8f9('0x46')](_0x3297df[_0xd8f9('0x3c')][_0xd8f9('0x46')]);_0x29739f[_0xd8f9('0x47')]=qs[_0xd8f9('0x3e')](_[_0xd8f9('0x48')](_0x3297df['query'],_0xf6273e[_0xd8f9('0x3e')]));if(_0x3297df['query'][_0xd8f9('0x2f')]){_0x29739f[_0xd8f9('0x47')]=_[_0xd8f9('0x49')](_0x29739f[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x29739f[_0xd8f9('0x40')],function(_0x56fcb0){var _0x4d84a6={};_0x4d84a6[_0x56fcb0]={'$like':'%'+_0x3297df[_0xd8f9('0x3c')][_0xd8f9('0x2f')]+'%'};return _0x4d84a6;})});}_0x29739f=_['merge']({},_0x29739f,_0x3297df[_0xd8f9('0x4a')]);return _0x38ed44['getTeams'](_0x29739f);}})['then'](function(_0x583d3d){if(_0x583d3d){_0x328bd7=_0x583d3d['length'];if(!_0x3297df[_0xd8f9('0x3c')][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x29739f[_0xd8f9('0x24')]=qs[_0xd8f9('0x24')](_0x3297df[_0xd8f9('0x3c')][_0xd8f9('0x24')]);_0x29739f['offset']=qs[_0xd8f9('0x23')](_0x3297df[_0xd8f9('0x3c')][_0xd8f9('0x23')]);}return _0x38ed44[_0xd8f9('0x6e')](_0x29739f);}})['then'](function(_0x9c96e9){if(_0x9c96e9){return _0x9c96e9?{'count':_0x328bd7,'rows':_0x9c96e9}:null;}})[_0xd8f9('0x2b')](respondWithResult(_0x3e4b1b,null))['catch'](handleError(_0x3e4b1b,null));};exports[_0xd8f9('0x6f')]=function(_0x68a6b5,_0x530440,_0x80ed48){var _0x4edf1d=_0x68a6b5['body'][_0xd8f9('0x70')];var _0x1b6355=_[_0xd8f9('0x38')](_0x4edf1d,'id');return db['Team'][_0xd8f9('0x4c')]({'where':{'id':_0x1b6355},'attributes':['id'],'include':[{'model':db[_0xd8f9('0x71')],'as':'Agents','attributes':['id',_0xd8f9('0x3b'),'online',_0xd8f9('0x72'),_0xd8f9('0x73')],'raw':!![]}]})[_0xd8f9('0x2b')](function(_0x1698b4){if(_0x1698b4){var _0x3117d0=_['flatMap'](_0x1698b4,function(_0x2cd3f3){var _0x21864a=_0x2cd3f3['get']({'plain':!![]});_0x21864a[_0xd8f9('0x74')]['forEach'](function(_0x193da1){_0x193da1[_0xd8f9('0x75')]=_[_0xd8f9('0x33')](_0x4edf1d,{'id':_0x21864a['id']})[_0xd8f9('0x75')];});return _0x21864a[_0xd8f9('0x74')];});return db[_0xd8f9('0x4b')]['find']({'where':{'id':_0x68a6b5['params']['id']}})[_0xd8f9('0x2b')](function(_0x2f85a9){return db[_0xd8f9('0x76')][_0xd8f9('0x77')](function(_0x5464e1){return _0x2f85a9['addTeams'](_0x1b6355,{'transaction':_0x5464e1})[_0xd8f9('0x2b')](function(){return BPromise[_0xd8f9('0x78')](_0x4edf1d,function(_0x77d89d){return db[_0xd8f9('0x79')][_0xd8f9('0x7a')]({'TeamId':_0x77d89d['id'],'VoiceQueueId':_0x68a6b5[_0xd8f9('0x50')]['id'],'penalty':_0x77d89d[_0xd8f9('0x75')]},{'transaction':_0x5464e1});});})[_0xd8f9('0x2b')](function(){return BPromise[_0xd8f9('0x78')](_0x3117d0,function(_0x4c7bcf){return db['UserVoiceQueue'][_0xd8f9('0x7b')]({'where':{'UserId':_0x4c7bcf['id'],'VoiceQueueId':_0x68a6b5[_0xd8f9('0x50')]['id']},'defaults':{'penalty':_0x4c7bcf[_0xd8f9('0x75')]},'transaction':_0x5464e1});});})['then'](function(){return BPromise[_0xd8f9('0x78')](_[_0xd8f9('0x2f')](_0x3117d0,{'online':!![]}),function(_0x458603){return db[_0xd8f9('0x7c')][_0xd8f9('0x7a')]({'membername':_0x458603['name'],'UserId':_0x458603['id'],'queue_name':_0x2f85a9[_0xd8f9('0x3b')],'VoiceQueueId':_0x2f85a9['id'],'interface':_[_0xd8f9('0x7d')](_0x458603[_0xd8f9('0x73')])?util[_0xd8f9('0x7e')](_0xd8f9('0x7f'),_0x458603[_0xd8f9('0x3b')]):_0x458603[_0xd8f9('0x73')],'paused':_0x458603[_0xd8f9('0x72')]||![],'penalty':_0x458603[_0xd8f9('0x75')]},{'transaction':_0x5464e1});});})[_0xd8f9('0x2b')](function(){_0x3117d0[_0xd8f9('0x80')](function(_0x1ef145){socket[_0xd8f9('0x81')](_0xd8f9('0x82'),{'UserId':_0x1ef145['id'],'VoiceQueueId':_0x2f85a9['id']});});});});});}})[_0xd8f9('0x2b')](respondWithStatusCode(_0x530440,null))[_0xd8f9('0x4e')](handleError(_0x530440,null));};exports['removeTeams']=function(_0x1cc3c4,_0xd833ef,_0x531113){return db['Team'][_0xd8f9('0x4c')]({'where':{'id':_0x1cc3c4['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xd8f9('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xd833ef,null))[_0xd8f9('0x2b')](function(_0x2c1c09){var _0x3cfc98=_[_0xd8f9('0x38')](_0x2c1c09,'id');var _0x269fd5=[];var _0x328e42=[];var _0x29df3a=squel['select']();_0x29df3a[_0xd8f9('0x83')]('tq.TeamId')[_0xd8f9('0x84')]('team_has_voice_queues','tq')[_0xd8f9('0x85')](_0xd8f9('0x86'),'ut',_0xd8f9('0x87'))[_0xd8f9('0x47')](_0xd8f9('0x88'),_0x1cc3c4['params']['id']);for(var _0x23ff0b=0x0;_0x23ff0b<_0x2c1c09[_0xd8f9('0x43')];_0x23ff0b+=0x1){let _0x87ed3e=_0x2c1c09[_0x23ff0b];for(var _0x209380=0x0;_0x209380<_0x87ed3e[_0xd8f9('0x74')][_0xd8f9('0x43')];_0x209380+=0x1){let _0x57880d=_0x87ed3e['Agents'][_0x209380];var _0x4a5c3a=_0x29df3a['clone']();_0x4a5c3a[_0xd8f9('0x47')](_0xd8f9('0x89'),_0x57880d['id']);_0x328e42[_0xd8f9('0x8a')](db[_0xd8f9('0x76')][_0xd8f9('0x3c')](_0x4a5c3a[_0xd8f9('0x8b')](),{'type':db[_0xd8f9('0x76')][_0xd8f9('0x8c')]['SELECT']})['then'](function(_0x59bc93){if(_0x59bc93[_0xd8f9('0x43')]===0x1){return _0x57880d['id'];}else{var _0x5882ec=_[_0xd8f9('0x8d')](_[_0xd8f9('0x38')](_0x59bc93,'TeamId'),function(_0x450645){return _['includes'](_0x3cfc98,_0x450645);});if(_0x5882ec){return _0x57880d['id'];}}}));}}return BPromise['all'](_0x328e42)[_0xd8f9('0x2b')](function(_0x1ef396){_0x269fd5=_(_0x269fd5)[_0xd8f9('0x8e')](_0x1ef396)[_0xd8f9('0x8f')]()['value']();return db[_0xd8f9('0x4b')][_0xd8f9('0x33')]({'where':{'id':_0x1cc3c4[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](function(_0x2138f7){return db[_0xd8f9('0x76')][_0xd8f9('0x77')](function(_0x23c851){return _0x2138f7['removeTeams'](_0x1cc3c4['query']['ids'],{'transaction':_0x23c851})[_0xd8f9('0x2b')](function(){if(!_['isEmpty'](_0x269fd5)){return _0x2138f7['removeAgents'](_0x269fd5,{'transaction':_0x23c851})[_0xd8f9('0x2b')](function(){return db[_0xd8f9('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x1cc3c4[_0xd8f9('0x50')]['id'],'UserId':_0x269fd5},'transaction':_0x23c851});});}})[_0xd8f9('0x2b')](function(){_0x269fd5['forEach'](function(_0x51a833){socket[_0xd8f9('0x81')](_0xd8f9('0x90'),{'UserId':_0x51a833,'VoiceQueueId':_0x2138f7['id']});});});});});});})[_0xd8f9('0x2b')](respondWithStatusCode(_0xd833ef,null))[_0xd8f9('0x4e')](handleError(_0xd833ef,null));};exports[_0xd8f9('0x91')]=function(_0x138828,_0x3fa514,_0x5be90c){var _0x35a6a4,_0xaff5ac;return db[_0xd8f9('0x4b')][_0xd8f9('0x33')]({'where':{'id':_0x138828[_0xd8f9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3fa514,null))[_0xd8f9('0x2b')](function(_0x29e663){if(_0x29e663){_0xaff5ac=_0x29e663;return _0x29e663['addAgents'](_0x138828[_0xd8f9('0x53')][_0xd8f9('0x92')],_['omit'](_0x138828[_0xd8f9('0x53')],[_0xd8f9('0x92'),'id'])||{})['spread'](function(_0x1b8f7e){for(var _0x5e69f2=0x0;_0x5e69f2<_0x138828[_0xd8f9('0x53')][_0xd8f9('0x92')][_0xd8f9('0x43')];_0x5e69f2+=0x1){socket[_0xd8f9('0x81')](_0xd8f9('0x82'),{'UserId':Number(_0x138828[_0xd8f9('0x53')][_0xd8f9('0x92')][_0x5e69f2]),'VoiceQueueId':Number(_0x138828[_0xd8f9('0x50')]['id'])});}return _0x1b8f7e;});}})['then'](function(_0x47d783){_0x35a6a4=_0x47d783||[];if(_0xaff5ac){return db[_0xd8f9('0x71')][_0xd8f9('0x4c')]({'where':{'id':_0x138828[_0xd8f9('0x53')]['ids']},'attributes':['id',_0xd8f9('0x3b'),_0xd8f9('0x93'),_0xd8f9('0x72'),_0xd8f9('0x73')],'raw':!![]});}})[_0xd8f9('0x2b')](function(_0x5c2a0a){if(!_[_0xd8f9('0x94')](_0x5c2a0a)){var _0x2be637=[];for(var _0x1712e8=0x0;_0x1712e8<_0x5c2a0a[_0xd8f9('0x43')];_0x1712e8++){if(_0x5c2a0a[_0x1712e8]['online']){_0x2be637[_0xd8f9('0x8a')](db[_0xd8f9('0x7c')]['upsert']({'membername':_0x5c2a0a[_0x1712e8][_0xd8f9('0x3b')],'UserId':_0x5c2a0a[_0x1712e8]['id'],'queue_name':_0xaff5ac[_0xd8f9('0x3b')],'VoiceQueueId':_0xaff5ac['id'],'interface':_['isNil'](_0x5c2a0a[_0x1712e8]['interface'])?util[_0xd8f9('0x7e')]('SIP/%s',_0x5c2a0a[_0x1712e8][_0xd8f9('0x3b')]):_0x5c2a0a[_0x1712e8]['interface'],'paused':_0x5c2a0a[_0x1712e8][_0xd8f9('0x72')]||![],'penalty':_0x138828[_0xd8f9('0x53')][_0xd8f9('0x75')]||0x0}));}}return BPromise[_0xd8f9('0x95')](_0x2be637);}})[_0xd8f9('0x2b')](function(){return _0x35a6a4;})[_0xd8f9('0x2b')](respondWithResult(_0x3fa514,null))[_0xd8f9('0x4e')](handleError(_0x3fa514,null));};exports[_0xd8f9('0x96')]=function(_0x4f7d39,_0x30a6ca,_0x5d8ede){return db[_0xd8f9('0x4b')]['find']({'where':{'id':_0x4f7d39['params']['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x30a6ca,null))[_0xd8f9('0x2b')](function(_0x5b711e){if(_0x5b711e){return _0x5b711e[_0xd8f9('0x96')](_0x4f7d39[_0xd8f9('0x3c')][_0xd8f9('0x92')])[_0xd8f9('0x2b')](function(){if(_['isArray'](_0x4f7d39[_0xd8f9('0x3c')][_0xd8f9('0x92')])){for(var _0x20ab60=0x0;_0x20ab60<_0x4f7d39[_0xd8f9('0x3c')][_0xd8f9('0x92')][_0xd8f9('0x43')];_0x20ab60+=0x1){socket['emit'](_0xd8f9('0x90'),{'UserId':Number(_0x4f7d39[_0xd8f9('0x3c')]['ids'][_0x20ab60]),'VoiceQueueId':Number(_0x4f7d39[_0xd8f9('0x50')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x4f7d39[_0xd8f9('0x3c')]['ids']),'VoiceQueueId':Number(_0x4f7d39[_0xd8f9('0x50')]['id'])});}});}})['then'](function(_0x2b7e94){return db[_0xd8f9('0x7c')][_0xd8f9('0x2c')]({'where':{'VoiceQueueId':_0x4f7d39[_0xd8f9('0x50')]['id'],'UserId':_0x4f7d39['query']['ids']}})[_0xd8f9('0x2b')](function(){return _0x2b7e94;});})[_0xd8f9('0x2b')](respondWithStatusCode(_0x30a6ca,null))[_0xd8f9('0x4e')](handleError(_0x30a6ca,null));};exports['getAgents']=function(_0x168556,_0xe6d92d,_0x3643ed){var _0x26a6bd={};var _0x380e9e={};var _0x5ee187;var _0x3bf1e3;return db[_0xd8f9('0x4b')]['findOne']({'where':{'id':_0x168556['params']['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0xe6d92d,null))['then'](function(_0x42db4e){if(_0x42db4e){_0x5ee187=_0x42db4e;_0x380e9e[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db['User'][_0xd8f9('0x39')]);_0x380e9e[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x168556['query']);_0x380e9e[_0xd8f9('0x3e')]=_[_0xd8f9('0x41')](_0x380e9e['model'],_0x380e9e[_0xd8f9('0x3c')]);_0x26a6bd[_0xd8f9('0x40')]=_[_0xd8f9('0x41')](_0x380e9e[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x168556[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x26a6bd[_0xd8f9('0x40')]=_0x26a6bd['attributes'][_0xd8f9('0x43')]?_0x26a6bd[_0xd8f9('0x40')]:_0x380e9e[_0xd8f9('0x3f')];_0x26a6bd[_0xd8f9('0x69')]=qs[_0xd8f9('0x46')](_0x168556[_0xd8f9('0x3c')][_0xd8f9('0x46')]);_0x26a6bd[_0xd8f9('0x47')]=qs[_0xd8f9('0x3e')](_['pick'](_0x168556['query'],_0x380e9e['filters']));if(_0x168556[_0xd8f9('0x3c')]['filter']){_0x26a6bd[_0xd8f9('0x47')]=_[_0xd8f9('0x49')](_0x26a6bd['where'],{'$or':_['map'](_0x26a6bd['attributes'],function(_0x5eb726){var _0x581197={};_0x581197[_0x5eb726]={'$like':'%'+_0x168556[_0xd8f9('0x3c')][_0xd8f9('0x2f')]+'%'};return _0x581197;})});}_0x26a6bd=_[_0xd8f9('0x49')]({},_0x26a6bd,_0x168556['options']);return _0x5ee187['getAgents'](_0x26a6bd);}})[_0xd8f9('0x2b')](function(_0xef06c7){if(_0xef06c7){_0x3bf1e3=_0xef06c7[_0xd8f9('0x43')];if(!_0x168556['query'][_0xd8f9('0x44')]('nolimit')){_0x26a6bd[_0xd8f9('0x24')]=qs[_0xd8f9('0x24')](_0x168556['query'][_0xd8f9('0x24')]);_0x26a6bd['offset']=qs['offset'](_0x168556[_0xd8f9('0x3c')]['offset']);}return _0x5ee187[_0xd8f9('0x97')](_0x26a6bd);}})[_0xd8f9('0x2b')](function(_0x2e2bd1){if(_0x2e2bd1){return _0x2e2bd1?{'count':_0x3bf1e3,'rows':_0x2e2bd1}:null;}})['then'](respondWithResult(_0xe6d92d,null))[_0xd8f9('0x4e')](handleError(_0xe6d92d,null));};exports['getMembers']=function(_0xcdfdf2,_0xea02a8,_0x1edb43){var _0x336df2={};var _0x54911b={};var _0x5001c6;var _0x38f869;return db[_0xd8f9('0x4b')][_0xd8f9('0x65')]({'where':{'id':_0xcdfdf2['params']['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0xea02a8,null))[_0xd8f9('0x2b')](function(_0x1ce7e5){if(_0x1ce7e5){_0x5001c6=_0x1ce7e5;_0x54911b[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db[_0xd8f9('0x7c')]['rawAttributes']);_0x54911b[_0xd8f9('0x3c')]=_['keys'](_0xcdfdf2['query']);_0x54911b[_0xd8f9('0x3e')]=_['intersection'](_0x54911b[_0xd8f9('0x3f')],_0x54911b[_0xd8f9('0x3c')]);_0x336df2[_0xd8f9('0x40')]=_[_0xd8f9('0x41')](_0x54911b['model'],qs[_0xd8f9('0x42')](_0xcdfdf2[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x336df2['attributes']=_0x336df2[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x336df2[_0xd8f9('0x40')]:_0x54911b[_0xd8f9('0x3f')];_0x336df2[_0xd8f9('0x69')]=qs['sort'](_0xcdfdf2[_0xd8f9('0x3c')][_0xd8f9('0x46')]);_0x336df2[_0xd8f9('0x47')]=qs['filters'](_[_0xd8f9('0x48')](_0xcdfdf2[_0xd8f9('0x3c')],_0x54911b[_0xd8f9('0x3e')]));if(_0xcdfdf2['query'][_0xd8f9('0x2f')]){_0x336df2['where']=_['merge'](_0x336df2[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x336df2[_0xd8f9('0x40')],function(_0x487e0f){var _0x108f70={};_0x108f70[_0x487e0f]={'$like':'%'+_0xcdfdf2[_0xd8f9('0x3c')][_0xd8f9('0x2f')]+'%'};return _0x108f70;})});}_0x336df2=_[_0xd8f9('0x49')]({},_0x336df2,_0xcdfdf2[_0xd8f9('0x4a')]);return _0x5001c6[_0xd8f9('0x98')](_0x336df2);}})[_0xd8f9('0x2b')](function(_0x54bdfb){if(_0x54bdfb){_0x38f869=_0x54bdfb[_0xd8f9('0x43')];if(!_0xcdfdf2[_0xd8f9('0x3c')][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x336df2[_0xd8f9('0x24')]=qs['limit'](_0xcdfdf2[_0xd8f9('0x3c')]['limit']);_0x336df2['offset']=qs[_0xd8f9('0x23')](_0xcdfdf2['query'][_0xd8f9('0x23')]);}return _0x5001c6['getMembers'](_0x336df2);}})['then'](function(_0x20908d){return _0x20908d?{'count':_0x38f869,'rows':_0x20908d}:null;})[_0xd8f9('0x2b')](respondWithResult(_0xea02a8,null))[_0xd8f9('0x4e')](handleError(_0xea02a8,null));};exports['getLists']=function(_0x4c7ae5,_0x110495,_0x40c720){var _0x9fa2fa={};var _0x11c1f3={};var _0x2bbfac;var _0x166157;return db['VoiceQueue']['findOne']({'where':{'id':_0x4c7ae5[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x110495,null))[_0xd8f9('0x2b')](function(_0xc128b2){if(_0xc128b2){_0x2bbfac=_0xc128b2;_0x11c1f3[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db[_0xd8f9('0x99')][_0xd8f9('0x39')]);_0x11c1f3[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x4c7ae5['query']);_0x11c1f3['filters']=_[_0xd8f9('0x41')](_0x11c1f3[_0xd8f9('0x3f')],_0x11c1f3[_0xd8f9('0x3c')]);_0x9fa2fa[_0xd8f9('0x40')]=_[_0xd8f9('0x41')](_0x11c1f3[_0xd8f9('0x3f')],qs[_0xd8f9('0x42')](_0x4c7ae5[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x9fa2fa['attributes']=_0x9fa2fa[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x9fa2fa[_0xd8f9('0x40')]:_0x11c1f3[_0xd8f9('0x3f')];_0x9fa2fa[_0xd8f9('0x69')]=qs['sort'](_0x4c7ae5[_0xd8f9('0x3c')]['sort']);_0x9fa2fa[_0xd8f9('0x47')]=qs['filters'](_[_0xd8f9('0x48')](_0x4c7ae5[_0xd8f9('0x3c')],_0x11c1f3['filters']));if(_0x4c7ae5[_0xd8f9('0x3c')][_0xd8f9('0x2f')]){_0x9fa2fa[_0xd8f9('0x47')]=_[_0xd8f9('0x49')](_0x9fa2fa[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x9fa2fa[_0xd8f9('0x40')],function(_0x581532){var _0x471e81={};_0x471e81[_0x581532]={'$like':'%'+_0x4c7ae5['query'][_0xd8f9('0x2f')]+'%'};return _0x471e81;})});}_0x9fa2fa=_[_0xd8f9('0x49')]({},_0x9fa2fa,_0x4c7ae5[_0xd8f9('0x4a')]);return _0x2bbfac[_0xd8f9('0x9a')](_0x9fa2fa);}})[_0xd8f9('0x2b')](function(_0x58e95d){if(_0x58e95d){_0x166157=_0x58e95d[_0xd8f9('0x43')];if(!_0x4c7ae5[_0xd8f9('0x3c')][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x9fa2fa['limit']=qs[_0xd8f9('0x24')](_0x4c7ae5[_0xd8f9('0x3c')][_0xd8f9('0x24')]);_0x9fa2fa[_0xd8f9('0x23')]=qs['offset'](_0x4c7ae5[_0xd8f9('0x3c')][_0xd8f9('0x23')]);}return _0x2bbfac[_0xd8f9('0x9a')](_0x9fa2fa);}})[_0xd8f9('0x2b')](function(_0x2cd6ee){if(_0x2cd6ee){return _0x2cd6ee?{'count':_0x166157,'rows':_0x2cd6ee}:null;}})[_0xd8f9('0x2b')](respondWithResult(_0x110495,null))['catch'](handleError(_0x110495,null));};exports[_0xd8f9('0x9b')]=function(_0x5d7f97,_0x13f217,_0x4308ab){var _0x474dfd=moment()['format'](_0xd8f9('0x9c'));var _0x5b1088,_0x12e678;return db['VoiceQueue'][_0xd8f9('0x33')]({'where':{'id':_0x5d7f97[_0xd8f9('0x50')]['id']}})['then'](handleEntityNotFound(_0x13f217,null))['then'](function(_0x5ec958){if(_0x5ec958){_0x12e678=_0x5ec958;return _0x5ec958[_0xd8f9('0x9b')](_0x5d7f97[_0xd8f9('0x53')][_0xd8f9('0x92')],_[_0xd8f9('0x5f')](_0x5d7f97[_0xd8f9('0x53')],[_0xd8f9('0x92'),'id'])||{});}return null;})[_0xd8f9('0x9d')](function(_0x1ee954){var _0x4c6ac8;_0x5b1088=_0x1ee954||[];var _0xb7c973=[];if(_0x1ee954){for(var _0x51e587=0x0;_0x51e587<_0x1ee954[_0xd8f9('0x43')];_0x51e587+=0x1){var _0x4a0724=_0x1ee954[_0x51e587][_0xd8f9('0x55')]({'plain':!![]});_0x12e678[_0xd8f9('0x9e')]=_0x5d7f97[_0xd8f9('0x53')][_0xd8f9('0x9e')]?_0x5d7f97[_0xd8f9('0x53')][_0xd8f9('0x9e')]:_0x12e678[_0xd8f9('0x9e')];switch(_0x12e678['dialCheckDuplicateType']){case'always':_0x4c6ac8=squel[_0xd8f9('0x9f')]()[_0xd8f9('0xa0')]('cm_hopper')[_0xd8f9('0xa1')](['phone',_0xd8f9('0xa2'),_0xd8f9('0xa3'),'ListId',_0xd8f9('0x67'),_0xd8f9('0x61'),'updatedAt'],squel[_0xd8f9('0xa4')]()[_0xd8f9('0x83')](_0xd8f9('0xa5'),_0xd8f9('0xa5'))[_0xd8f9('0x83')]('\x27'+_0x474dfd+'\x27','scheduledAt')[_0xd8f9('0x83')]('id','ContactId')[_0xd8f9('0x83')](_0x4a0724['CmListId']['toString'](),_0xd8f9('0xa6'))[_0xd8f9('0x83')](_0x5d7f97[_0xd8f9('0x50')]['id'][_0xd8f9('0x8b')](),_0xd8f9('0x67'))['field']('\x27'+_0x474dfd+'\x27',_0xd8f9('0x61'))['field']('\x27'+_0x474dfd+'\x27',_0xd8f9('0x60'))['from']('cm_contacts')[_0xd8f9('0x47')](_0xd8f9('0xa7'))[_0xd8f9('0x47')](_0xd8f9('0xa8'),_0x4a0724['CmListId']['toString']())[_0xd8f9('0x47')](_0xd8f9('0xa9'))[_0xd8f9('0x47')](_0xd8f9('0xaa'),squel[_0xd8f9('0xa4')]()[_0xd8f9('0x83')](_0xd8f9('0xab'))[_0xd8f9('0x84')]('cm_hopper_final')[_0xd8f9('0x47')](_0xd8f9('0x88'),_0x5d7f97[_0xd8f9('0x50')]['id'][_0xd8f9('0x8b')]()))[_0xd8f9('0x47')](_0xd8f9('0xaa'),squel[_0xd8f9('0xa4')]()[_0xd8f9('0x83')]('COALESCE(phone,\x27\x27)')['from'](_0xd8f9('0xac'))[_0xd8f9('0x47')](_0xd8f9('0x88'),_0x5d7f97[_0xd8f9('0x50')]['id'][_0xd8f9('0x8b')]())))[_0xd8f9('0x8b')]();break;case _0xd8f9('0xad'):_0x4c6ac8=squel[_0xd8f9('0x9f')]()[_0xd8f9('0xa0')](_0xd8f9('0xac'))[_0xd8f9('0xa1')]([_0xd8f9('0xa5'),'scheduledAt','ContactId','ListId',_0xd8f9('0x67'),_0xd8f9('0x61'),_0xd8f9('0x60')],squel[_0xd8f9('0xa4')]()[_0xd8f9('0x83')](_0xd8f9('0xa5'),_0xd8f9('0xa5'))[_0xd8f9('0x83')]('\x27'+_0x474dfd+'\x27',_0xd8f9('0xa2'))[_0xd8f9('0x83')]('id','ContactId')[_0xd8f9('0x83')](_0x4a0724[_0xd8f9('0xae')]['toString'](),_0xd8f9('0xa6'))[_0xd8f9('0x83')](_0x5d7f97[_0xd8f9('0x50')]['id'][_0xd8f9('0x8b')](),'VoiceQueueId')['field']('\x27'+_0x474dfd+'\x27',_0xd8f9('0x61'))[_0xd8f9('0x83')]('\x27'+_0x474dfd+'\x27',_0xd8f9('0x60'))[_0xd8f9('0x84')]('cm_contacts')[_0xd8f9('0x47')](_0xd8f9('0xa7'))[_0xd8f9('0x47')](_0xd8f9('0xa8'),_0x4a0724['CmListId'][_0xd8f9('0x8b')]())['where'](_0xd8f9('0xa9'))['where'](_0xd8f9('0xaa'),squel[_0xd8f9('0xa4')]()[_0xd8f9('0x83')](_0xd8f9('0xaf'))['from'](_0xd8f9('0xac'))[_0xd8f9('0x47')](_0xd8f9('0x88'),_0x5d7f97[_0xd8f9('0x50')]['id'][_0xd8f9('0x8b')]())))[_0xd8f9('0x8b')]();break;default:_0x4c6ac8=squel['insert']()[_0xd8f9('0xa0')](_0xd8f9('0xac'))['fromQuery']([_0xd8f9('0xa5'),_0xd8f9('0xa2'),_0xd8f9('0xa3'),_0xd8f9('0xa6'),_0xd8f9('0x67'),_0xd8f9('0x61'),_0xd8f9('0x60')],squel[_0xd8f9('0xa4')]()['field'](_0xd8f9('0xa5'),'phone')[_0xd8f9('0x83')]('\x27'+_0x474dfd+'\x27',_0xd8f9('0xa2'))['field']('id',_0xd8f9('0xa3'))[_0xd8f9('0x83')](_0x4a0724[_0xd8f9('0xae')][_0xd8f9('0x8b')](),'ListId')['field'](_0x5d7f97['params']['id'][_0xd8f9('0x8b')](),'VoiceQueueId')['field']('\x27'+_0x474dfd+'\x27','createdAt')['field']('\x27'+_0x474dfd+'\x27',_0xd8f9('0x60'))['from'](_0xd8f9('0xb0'))[_0xd8f9('0x47')](_0xd8f9('0xa7'))[_0xd8f9('0x47')](_0xd8f9('0xa8'),_0x4a0724[_0xd8f9('0xae')]['toString']())[_0xd8f9('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0xb7c973[_0xd8f9('0x8a')](db[_0xd8f9('0x76')][_0xd8f9('0x3c')](_0x4c6ac8));}return BPromise[_0xd8f9('0x95')](_0xb7c973);}})['then'](function(){var _0x24b3f3=[];var _0x4ac986=squel[_0xd8f9('0x9f')]()[_0xd8f9('0xa0')]('cm_hopper_additional_phones')[_0xd8f9('0xa1')](['CmHopperId',_0xd8f9('0xa5'),_0xd8f9('0xb1'),_0xd8f9('0x61'),_0xd8f9('0x60')],squel[_0xd8f9('0xa4')]()[_0xd8f9('0x83')](_0xd8f9('0xb2'))[_0xd8f9('0x83')](_0xd8f9('0xb3'))[_0xd8f9('0x83')](_0xd8f9('0xb4'))[_0xd8f9('0x83')]('\x27'+_0x474dfd+'\x27',_0xd8f9('0x61'))[_0xd8f9('0x83')]('\x27'+_0x474dfd+'\x27',_0xd8f9('0x60'))[_0xd8f9('0x84')](_0xd8f9('0xb5'),'ci')['join'](_0xd8f9('0xac'),'h',_0xd8f9('0xb6'))[_0xd8f9('0x47')](_0xd8f9('0xb7'),_0x474dfd)[_0xd8f9('0x47')]('ci.ItemClass=?','PHONE'))['toString']();_0x24b3f3[_0xd8f9('0x8a')](db['sequelize'][_0xd8f9('0x3c')](_0x4ac986));return BPromise[_0xd8f9('0x95')](_0x24b3f3);})[_0xd8f9('0x2b')](function(){return _0x5b1088;})[_0xd8f9('0x2b')](respondWithResult(_0x13f217,null))[_0xd8f9('0x4e')](handleError(_0x13f217,null));};exports['removeLists']=function(_0x44e503,_0x176844,_0x2bc2be){return db[_0xd8f9('0x4b')][_0xd8f9('0x33')]({'where':{'id':_0x44e503[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x176844,null))['then'](function(_0x492732){if(_0x492732){return _0x492732['removeLists'](_0x44e503[_0xd8f9('0x3c')]['ids']);}})['then'](function(_0x5dc638){if(_0x5dc638){return db[_0xd8f9('0x66')][_0xd8f9('0x2c')]({'where':{'ListId':_0x44e503['query'][_0xd8f9('0x92')],'VoiceQueueId':_0x44e503[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](function(){return _0x5dc638;});}})[_0xd8f9('0x2b')](respondWithStatusCode(_0x176844,null))['catch'](handleError(_0x176844,null));};exports[_0xd8f9('0xb8')]=function(_0x4c49cb,_0x3b57cb,_0x521252){var _0x1379b7={};var _0x1839d6={};var _0x47dcc9;var _0x6e41c9;return db[_0xd8f9('0x4b')]['findOne']({'where':{'id':_0x4c49cb[_0xd8f9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3b57cb,null))[_0xd8f9('0x2b')](function(_0x4566f6){if(_0x4566f6){_0x47dcc9=_0x4566f6;_0x1839d6[_0xd8f9('0x3f')]=_[_0xd8f9('0x3d')](db[_0xd8f9('0x99')]['rawAttributes']);_0x1839d6[_0xd8f9('0x3c')]=_[_0xd8f9('0x3d')](_0x4c49cb['query']);_0x1839d6['filters']=_[_0xd8f9('0x41')](_0x1839d6[_0xd8f9('0x3f')],_0x1839d6[_0xd8f9('0x3c')]);_0x1379b7[_0xd8f9('0x40')]=_[_0xd8f9('0x41')](_0x1839d6[_0xd8f9('0x3f')],qs['fields'](_0x4c49cb[_0xd8f9('0x3c')][_0xd8f9('0x42')]));_0x1379b7['attributes']=_0x1379b7[_0xd8f9('0x40')][_0xd8f9('0x43')]?_0x1379b7['attributes']:_0x1839d6['model'];_0x1379b7[_0xd8f9('0x69')]=qs[_0xd8f9('0x46')](_0x4c49cb[_0xd8f9('0x3c')][_0xd8f9('0x46')]);_0x1379b7[_0xd8f9('0x47')]=qs[_0xd8f9('0x3e')](_['pick'](_0x4c49cb[_0xd8f9('0x3c')],_0x1839d6[_0xd8f9('0x3e')]));if(_0x4c49cb[_0xd8f9('0x3c')][_0xd8f9('0x2f')]){_0x1379b7[_0xd8f9('0x47')]=_[_0xd8f9('0x49')](_0x1379b7[_0xd8f9('0x47')],{'$or':_[_0xd8f9('0x38')](_0x1379b7[_0xd8f9('0x40')],function(_0x4dea70){var _0x1ac258={};_0x1ac258[_0x4dea70]={'$like':'%'+_0x4c49cb[_0xd8f9('0x3c')][_0xd8f9('0x2f')]+'%'};return _0x1ac258;})});}_0x1379b7=_[_0xd8f9('0x49')]({},_0x1379b7,_0x4c49cb['options']);return _0x47dcc9[_0xd8f9('0xb8')](_0x1379b7);}})[_0xd8f9('0x2b')](function(_0x409ecb){if(_0x409ecb){_0x6e41c9=_0x409ecb['length'];if(!_0x4c49cb[_0xd8f9('0x3c')][_0xd8f9('0x44')](_0xd8f9('0x45'))){_0x1379b7[_0xd8f9('0x24')]=qs[_0xd8f9('0x24')](_0x4c49cb['query'][_0xd8f9('0x24')]);_0x1379b7[_0xd8f9('0x23')]=qs[_0xd8f9('0x23')](_0x4c49cb[_0xd8f9('0x3c')][_0xd8f9('0x23')]);}return _0x47dcc9['getBlackLists'](_0x1379b7);}})[_0xd8f9('0x2b')](function(_0xc82ca2){if(_0xc82ca2){return _0xc82ca2?{'count':_0x6e41c9,'rows':_0xc82ca2}:null;}})[_0xd8f9('0x2b')](respondWithResult(_0x3b57cb,null))[_0xd8f9('0x4e')](handleError(_0x3b57cb,null));};exports['addBlackLists']=function(_0x2ab55a,_0x18b54e,_0x513bef){var _0x4c9b7e,_0x4b8385;return db[_0xd8f9('0x4b')][_0xd8f9('0x33')]({'where':{'id':_0x2ab55a[_0xd8f9('0x50')]['id']}})[_0xd8f9('0x2b')](handleEntityNotFound(_0x18b54e,null))[_0xd8f9('0x2b')](function(_0x1ac781){if(_0x1ac781){_0x4b8385=_0x1ac781;return _0x1ac781[_0xd8f9('0xb9')](_0x2ab55a[_0xd8f9('0x53')]['ids'],_[_0xd8f9('0x5f')](_0x2ab55a[_0xd8f9('0x53')],[_0xd8f9('0x92'),'id'])||{});}return null;})[_0xd8f9('0x9d')](function(_0x5b2a19){var _0x127312;_0x4c9b7e=_0x5b2a19||[];var _0x29b17f=[];if(_0x5b2a19){for(var _0x3234e3=0x0;_0x3234e3<_0x5b2a19[_0xd8f9('0x43')];_0x3234e3+=0x1){var _0x34d036=_0x5b2a19[_0x3234e3][_0xd8f9('0x55')]({'plain':!![]});_0x127312=squel['insert']()[_0xd8f9('0xa0')](_0xd8f9('0xba'))[_0xd8f9('0xa1')]([_0xd8f9('0xa5'),'ContactId',_0xd8f9('0xa6'),_0xd8f9('0x67'),_0xd8f9('0x61'),_0xd8f9('0x60')],squel[_0xd8f9('0xa4')]()['field'](_0xd8f9('0xa5'),_0xd8f9('0xa5'))['field']('id',_0xd8f9('0xa3'))[_0xd8f9('0x83')](_0x34d036[_0xd8f9('0xae')][_0xd8f9('0x8b')](),_0xd8f9('0xa6'))[_0xd8f9('0x83')](_0x2ab55a[_0xd8f9('0x50')]['id'][_0xd8f9('0x8b')](),_0xd8f9('0x67'))['field'](_0xd8f9('0xbb'),_0xd8f9('0x61'))[_0xd8f9('0x83')](_0xd8f9('0xbb'),_0xd8f9('0x60'))['from']('cm_contacts')[_0xd8f9('0x47')](_0xd8f9('0xa7'))['where'](_0xd8f9('0xa8'),_0x34d036[_0xd8f9('0xae')][_0xd8f9('0x8b')]())[_0xd8f9('0x47')](_0xd8f9('0xa9')))[_0xd8f9('0x8b')]();_0x29b17f['push'](db[_0xd8f9('0x76')][_0xd8f9('0x3c')](_0x127312));}return BPromise[_0xd8f9('0x95')](_0x29b17f);}})[_0xd8f9('0x2b')](function(){return _0x4c9b7e;})[_0xd8f9('0x2b')](respondWithResult(_0x18b54e,null))['catch'](handleError(_0x18b54e,null));};exports[_0xd8f9('0xbc')]=function(_0x38c869,_0x1a1ff2,_0x3e249b){return db[_0xd8f9('0x4b')]['find']({'where':{'id':_0x38c869['params']['id']}})['then'](handleEntityNotFound(_0x1a1ff2,null))['then'](function(_0x4f4b76){if(_0x4f4b76){return _0x4f4b76[_0xd8f9('0xbc')](_0x38c869[_0xd8f9('0x3c')]['ids']);}})[_0xd8f9('0x2b')](function(_0x1d4f37){if(_0x1d4f37){return db[_0xd8f9('0x6d')]['destroy']({'where':{'ListId':_0x38c869[_0xd8f9('0x3c')][_0xd8f9('0x92')],'VoiceQueueId':_0x38c869['params']['id']}})[_0xd8f9('0x2b')](function(){return _0x1d4f37;});}})[_0xd8f9('0x2b')](respondWithStatusCode(_0x1a1ff2,null))[_0xd8f9('0x4e')](handleError(_0x1a1ff2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5827f29..da91120 100644 --- a/server/api/voiceQueue/voiceQueue.events.js +++ b/server/api/voiceQueue/voiceQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bb3=['update','emit','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x5bb3,0x171));var _0x35bb=function(_0x22ddd0,_0x39b3e0){_0x22ddd0=_0x22ddd0-0x0;var _0x138589=_0x5bb3[_0x22ddd0];return _0x138589;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x35bb('0x0')](0x0);var events={'afterCreate':_0x35bb('0x1'),'afterUpdate':_0x35bb('0x2'),'afterDestroy':'remove'};function emitEvent(_0x11b753){return function(_0x238b08,_0x4cf642,_0x2997fd){VoiceQueueEvents[_0x35bb('0x3')](_0x11b753+':'+_0x238b08['id'],_0x238b08);VoiceQueueEvents['emit'](_0x11b753,_0x238b08);_0x2997fd(null);};}for(var e in events){if(events[_0x35bb('0x4')](e)){var event=events[e];VoiceQueue[_0x35bb('0x5')](e,emitEvent(event));}}module[_0x35bb('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0x5fc9=['hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit'];(function(_0x158166,_0x345a77){var _0x309a38=function(_0x49e7b4){while(--_0x49e7b4){_0x158166['push'](_0x158166['shift']());}};_0x309a38(++_0x345a77);}(_0x5fc9,0x1f1));var _0x95fc=function(_0x1c7efb,_0x3d864b){_0x1c7efb=_0x1c7efb-0x0;var _0x2d183d=_0x5fc9[_0x1c7efb];return _0x2d183d;};'use strict';var EventEmitter=require(_0x95fc('0x0'));var VoiceQueue=require(_0x95fc('0x1'))['db'][_0x95fc('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x95fc('0x3')](0x0);var events={'afterCreate':_0x95fc('0x4'),'afterUpdate':'update','afterDestroy':_0x95fc('0x5')};function emitEvent(_0x35e871){return function(_0x507b24,_0x512e50,_0x4e3912){VoiceQueueEvents[_0x95fc('0x6')](_0x35e871+':'+_0x507b24['id'],_0x507b24);VoiceQueueEvents[_0x95fc('0x6')](_0x35e871,_0x507b24);_0x4e3912(null);};}for(var e in events){if(events[_0x95fc('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x95fc('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4990b20..d02fe0a 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x842858,_0x3a3ca0){var _0x46c2a2=function(_0x47f795){while(--_0x47f795){_0x842858['push'](_0x842858['shift']());}};_0x46c2a2(++_0x3a3ca0);}(_0x008c,0x188));var _0xc008=function(_0x15d913,_0x51cf7a){_0x15d913=_0x15d913-0x0;var _0x4ae65e=_0x008c[_0x15d913];return _0x4ae65e;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x1178ef,_0x105156){var _0x3f434c=function(_0x4be603){while(--_0x4be603){_0x1178ef['push'](_0x1178ef['shift']());}};_0x3f434c(++_0x105156);}(_0x34e8,0x12c));var _0x834e=function(_0x5b4f0b,_0x18e411){_0x5b4f0b=_0x5b4f0b-0x0;var _0x35c9a5=_0x34e8[_0x5b4f0b];return _0x35c9a5;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 6e9eda0..195b915 100644 --- a/server/api/voiceQueue/voiceQueue.rpc.js +++ b/server/api/voiceQueue/voiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dcd=['error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','VoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c409c,_0x374c9b){var _0x1dc574=function(_0x21d111){while(--_0x21d111){_0x4c409c['push'](_0x4c409c['shift']());}};_0x1dc574(++_0x374c9b);}(_0x6dcd,0x108));var _0xd6dc=function(_0x25fd6b,_0x4e2bc1){_0x25fd6b=_0x25fd6b-0x0;var _0x1ad459=_0x6dcd[_0x25fd6b];return _0x1ad459;};'use strict';var _=require(_0xd6dc('0x0'));var util=require(_0xd6dc('0x1'));var moment=require(_0xd6dc('0x2'));var BPromise=require(_0xd6dc('0x3'));var rs=require(_0xd6dc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6dc('0x5'))['db'];var utils=require(_0xd6dc('0x6'));var logger=require(_0xd6dc('0x7'))('rpc');var config=require(_0xd6dc('0x8'));var jayson=require(_0xd6dc('0x9'));var client=jayson['client'][_0xd6dc('0xa')]({'port':0x232a});config[_0xd6dc('0xb')]=_[_0xd6dc('0xc')](config[_0xd6dc('0xb')],{'host':_0xd6dc('0xd'),'port':0x18eb});var socket=require(_0xd6dc('0xe'))(new Redis(config['redis']));require(_0xd6dc('0xf'))[_0xd6dc('0x10')](socket);function respondWithRpcPromise(_0x5992e3,_0x26e39c,_0x29c625){return new BPromise(function(_0x149cf2,_0x127f71){return client[_0xd6dc('0x11')](_0x5992e3,_0x29c625)[_0xd6dc('0x12')](function(_0x34ec5a){logger[_0xd6dc('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x26e39c,_0xd6dc('0x14'));logger['debug'](_0xd6dc('0x15'),_0x26e39c,_0xd6dc('0x14'),JSON[_0xd6dc('0x16')](_0x34ec5a));if(_0x34ec5a[_0xd6dc('0x17')]){if(_0x34ec5a['error'][_0xd6dc('0x18')]===0x1f4){logger['error'](_0xd6dc('0x19'),_0x26e39c,_0x34ec5a[_0xd6dc('0x17')][_0xd6dc('0x1a')]);return _0x127f71(_0x34ec5a[_0xd6dc('0x17')][_0xd6dc('0x1a')]);}logger['error'](_0xd6dc('0x19'),_0x26e39c,_0x34ec5a[_0xd6dc('0x17')][_0xd6dc('0x1a')]);return _0x149cf2(_0x34ec5a['error'][_0xd6dc('0x1a')]);}else{logger[_0xd6dc('0x13')](_0xd6dc('0x19'),_0x26e39c,_0xd6dc('0x14'));_0x149cf2(_0x34ec5a[_0xd6dc('0x1b')][_0xd6dc('0x1a')]);}})[_0xd6dc('0x1c')](function(_0x8dc703){logger[_0xd6dc('0x17')](_0xd6dc('0x19'),_0x26e39c,_0x8dc703);_0x127f71(_0x8dc703);});});}exports[_0xd6dc('0x1d')]=function(_0x1fb8f0){var _0x327c3a=this;return new Promise(function(_0x52d1bc,_0x439a0b){return db['VoiceQueue']['findAll']({'raw':_0x1fb8f0[_0xd6dc('0x1e')]?_0x1fb8f0['options'][_0xd6dc('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fb8f0[_0xd6dc('0x1e')]?_0x1fb8f0['options'][_0xd6dc('0x20')]||null:null,'attributes':_0x1fb8f0['options']?_0x1fb8f0[_0xd6dc('0x1e')][_0xd6dc('0x21')]||null:null,'limit':_0x1fb8f0[_0xd6dc('0x1e')]?_0x1fb8f0[_0xd6dc('0x1e')][_0xd6dc('0x22')]||null:null,'include':_0x1fb8f0[_0xd6dc('0x1e')]?_0x1fb8f0[_0xd6dc('0x1e')][_0xd6dc('0x23')]?_[_0xd6dc('0x24')](_0x1fb8f0[_0xd6dc('0x1e')][_0xd6dc('0x23')],function(_0x393859){return{'model':db[_0x393859['model']],'as':_0x393859['as'],'attributes':_0x393859[_0xd6dc('0x21')],'include':_0x393859[_0xd6dc('0x23')]?_[_0xd6dc('0x24')](_0x393859['include'],function(_0x23e453){return{'model':db[_0x23e453[_0xd6dc('0x25')]],'as':_0x23e453['as'],'attributes':_0x23e453[_0xd6dc('0x21')],'include':_0x23e453['include']?_[_0xd6dc('0x24')](_0x23e453['include'],function(_0x1cd068){return{'model':db[_0x1cd068['model']],'as':_0x1cd068['as'],'attributes':_0x1cd068[_0xd6dc('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12d6d5){logger[_0xd6dc('0x13')]('GetVoiceQueue',_0x1fb8f0);logger[_0xd6dc('0x26')](_0xd6dc('0x1d'),_0x1fb8f0,JSON[_0xd6dc('0x16')](_0x12d6d5));_0x52d1bc(_0x12d6d5);})[_0xd6dc('0x1c')](function(_0x4f5600){logger[_0xd6dc('0x17')](_0xd6dc('0x1d'),_0x4f5600[_0xd6dc('0x1a')],_0x1fb8f0);_0x439a0b(_0x327c3a[_0xd6dc('0x17')](0x1f4,_0x4f5600[_0xd6dc('0x1a')]));});});};exports[_0xd6dc('0x27')]=function(_0x2f9f8b){var _0x5a5e09=this;return new Promise(function(_0x2724b3,_0x15192f){return db[_0xd6dc('0x28')]['find']({'raw':_0x2f9f8b[_0xd6dc('0x1e')]?_0x2f9f8b['options'][_0xd6dc('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f9f8b[_0xd6dc('0x1e')]?_0x2f9f8b[_0xd6dc('0x1e')]['where']||null:null,'attributes':_0x2f9f8b['options']?_0x2f9f8b[_0xd6dc('0x1e')][_0xd6dc('0x21')]||null:null,'include':_0x2f9f8b['options']?_0x2f9f8b[_0xd6dc('0x1e')][_0xd6dc('0x23')]?_[_0xd6dc('0x24')](_0x2f9f8b[_0xd6dc('0x1e')][_0xd6dc('0x23')],function(_0x4a836e){return{'model':db[_0x4a836e[_0xd6dc('0x25')]],'as':_0x4a836e['as'],'attributes':_0x4a836e[_0xd6dc('0x21')],'include':_0x4a836e[_0xd6dc('0x23')]?_[_0xd6dc('0x24')](_0x4a836e['include'],function(_0x33b385){return{'model':db[_0x33b385[_0xd6dc('0x25')]],'as':_0x33b385['as'],'attributes':_0x33b385[_0xd6dc('0x21')],'include':_0x33b385[_0xd6dc('0x23')]?_['map'](_0x33b385[_0xd6dc('0x23')],function(_0x5b5c0c){return{'model':db[_0x5b5c0c[_0xd6dc('0x25')]],'as':_0x5b5c0c['as'],'attributes':_0x5b5c0c[_0xd6dc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd6dc('0x12')](function(_0x56ce6c){logger['info'](_0xd6dc('0x27'),_0x2f9f8b);logger['debug']('ShowVoiceQueue',_0x2f9f8b,JSON[_0xd6dc('0x16')](_0x56ce6c));_0x2724b3(_0x56ce6c);})[_0xd6dc('0x1c')](function(_0x2e0c3b){logger[_0xd6dc('0x17')](_0xd6dc('0x27'),_0x2e0c3b[_0xd6dc('0x1a')],_0x2f9f8b);_0x15192f(_0x5a5e09['error'](0x1f4,_0x2e0c3b[_0xd6dc('0x1a')]));});});}; \ No newline at end of file +var _0xaaad=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVoiceQueue','debug'];(function(_0x34fe63,_0x37fa4b){var _0x2b2617=function(_0x42f34b){while(--_0x42f34b){_0x34fe63['push'](_0x34fe63['shift']());}};_0x2b2617(++_0x37fa4b);}(_0xaaad,0x1c3));var _0xdaaa=function(_0x1ff130,_0x58f024){_0x1ff130=_0x1ff130-0x0;var _0x42ce88=_0xaaad[_0x1ff130];return _0x42ce88;};'use strict';var _=require(_0xdaaa('0x0'));var util=require(_0xdaaa('0x1'));var moment=require(_0xdaaa('0x2'));var BPromise=require(_0xdaaa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaaa('0x4'));var db=require(_0xdaaa('0x5'))['db'];var utils=require(_0xdaaa('0x6'));var logger=require(_0xdaaa('0x7'))(_0xdaaa('0x8'));var config=require(_0xdaaa('0x9'));var jayson=require(_0xdaaa('0xa'));var client=jayson[_0xdaaa('0xb')]['http']({'port':0x232a});config[_0xdaaa('0xc')]=_[_0xdaaa('0xd')](config[_0xdaaa('0xc')],{'host':_0xdaaa('0xe'),'port':0x18eb});var socket=require(_0xdaaa('0xf'))(new Redis(config[_0xdaaa('0xc')]));require('./voiceQueue.socket')[_0xdaaa('0x10')](socket);function respondWithRpcPromise(_0x1442c3,_0x472207,_0x185523){return new BPromise(function(_0x14108f,_0x388602){return client['request'](_0x1442c3,_0x185523)[_0xdaaa('0x11')](function(_0x55c267){logger[_0xdaaa('0x12')](_0xdaaa('0x13'),_0x472207,_0xdaaa('0x14'));logger['debug'](_0xdaaa('0x15'),_0x472207,_0xdaaa('0x14'),JSON['stringify'](_0x55c267));if(_0x55c267[_0xdaaa('0x16')]){if(_0x55c267[_0xdaaa('0x16')][_0xdaaa('0x17')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x472207,_0x55c267[_0xdaaa('0x16')][_0xdaaa('0x18')]);return _0x388602(_0x55c267[_0xdaaa('0x16')]['message']);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x472207,_0x55c267['error']['message']);return _0x14108f(_0x55c267['error']['message']);}else{logger[_0xdaaa('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x472207,_0xdaaa('0x14'));_0x14108f(_0x55c267[_0xdaaa('0x19')][_0xdaaa('0x18')]);}})[_0xdaaa('0x1a')](function(_0x4c6479){logger[_0xdaaa('0x16')](_0xdaaa('0x13'),_0x472207,_0x4c6479);_0x388602(_0x4c6479);});});}exports[_0xdaaa('0x1b')]=function(_0x390b65){var _0x55b975=this;return new Promise(function(_0x5640ef,_0x86c913){return db[_0xdaaa('0x1c')][_0xdaaa('0x1d')]({'raw':_0x390b65[_0xdaaa('0x1e')]?_0x390b65[_0xdaaa('0x1e')][_0xdaaa('0x1f')]===undefined?!![]:![]:!![],'where':_0x390b65[_0xdaaa('0x1e')]?_0x390b65[_0xdaaa('0x1e')][_0xdaaa('0x20')]||null:null,'attributes':_0x390b65['options']?_0x390b65[_0xdaaa('0x1e')][_0xdaaa('0x21')]||null:null,'limit':_0x390b65[_0xdaaa('0x1e')]?_0x390b65[_0xdaaa('0x1e')][_0xdaaa('0x22')]||null:null,'include':_0x390b65[_0xdaaa('0x1e')]?_0x390b65[_0xdaaa('0x1e')]['include']?_['map'](_0x390b65[_0xdaaa('0x1e')][_0xdaaa('0x23')],function(_0x3cb8dc){return{'model':db[_0x3cb8dc[_0xdaaa('0x24')]],'as':_0x3cb8dc['as'],'attributes':_0x3cb8dc[_0xdaaa('0x21')],'include':_0x3cb8dc[_0xdaaa('0x23')]?_[_0xdaaa('0x25')](_0x3cb8dc[_0xdaaa('0x23')],function(_0x1168b6){return{'model':db[_0x1168b6[_0xdaaa('0x24')]],'as':_0x1168b6['as'],'attributes':_0x1168b6['attributes'],'include':_0x1168b6[_0xdaaa('0x23')]?_[_0xdaaa('0x25')](_0x1168b6[_0xdaaa('0x23')],function(_0x4c496){return{'model':db[_0x4c496[_0xdaaa('0x24')]],'as':_0x4c496['as'],'attributes':_0x4c496[_0xdaaa('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdaaa('0x11')](function(_0x80ba54){logger[_0xdaaa('0x12')](_0xdaaa('0x1b'),_0x390b65);logger['debug']('GetVoiceQueue',_0x390b65,JSON[_0xdaaa('0x26')](_0x80ba54));_0x5640ef(_0x80ba54);})[_0xdaaa('0x1a')](function(_0x15ddea){logger[_0xdaaa('0x16')](_0xdaaa('0x1b'),_0x15ddea[_0xdaaa('0x18')],_0x390b65);_0x86c913(_0x55b975['error'](0x1f4,_0x15ddea[_0xdaaa('0x18')]));});});};exports[_0xdaaa('0x27')]=function(_0x148c0f){var _0x2ec87b=this;return new Promise(function(_0x16c73d,_0x526901){return db[_0xdaaa('0x1c')]['find']({'raw':_0x148c0f[_0xdaaa('0x1e')]?_0x148c0f[_0xdaaa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x148c0f[_0xdaaa('0x1e')]?_0x148c0f['options'][_0xdaaa('0x20')]||null:null,'attributes':_0x148c0f[_0xdaaa('0x1e')]?_0x148c0f[_0xdaaa('0x1e')]['attributes']||null:null,'include':_0x148c0f['options']?_0x148c0f[_0xdaaa('0x1e')][_0xdaaa('0x23')]?_['map'](_0x148c0f[_0xdaaa('0x1e')]['include'],function(_0x39ec01){return{'model':db[_0x39ec01[_0xdaaa('0x24')]],'as':_0x39ec01['as'],'attributes':_0x39ec01[_0xdaaa('0x21')],'include':_0x39ec01[_0xdaaa('0x23')]?_[_0xdaaa('0x25')](_0x39ec01['include'],function(_0x4120e7){return{'model':db[_0x4120e7['model']],'as':_0x4120e7['as'],'attributes':_0x4120e7['attributes'],'include':_0x4120e7[_0xdaaa('0x23')]?_['map'](_0x4120e7[_0xdaaa('0x23')],function(_0x487d59){return{'model':db[_0x487d59['model']],'as':_0x487d59['as'],'attributes':_0x487d59[_0xdaaa('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdaaa('0x11')](function(_0x236e9d){logger[_0xdaaa('0x12')](_0xdaaa('0x27'),_0x148c0f);logger[_0xdaaa('0x28')]('ShowVoiceQueue',_0x148c0f,JSON[_0xdaaa('0x26')](_0x236e9d));_0x16c73d(_0x236e9d);})[_0xdaaa('0x1a')](function(_0x3704fb){logger[_0xdaaa('0x16')](_0xdaaa('0x27'),_0x3704fb[_0xdaaa('0x18')],_0x148c0f);_0x526901(_0x2ec87b[_0xdaaa('0x16')](0x1f4,_0x3704fb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2cede27..99ffe49 100644 --- a/server/api/voiceQueue/voiceQueue.socket.js +++ b/server/api/voiceQueue/voiceQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3da=['voiceQueue:','./voiceQueue.events','save','update','emit','register','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd3da,0x158));var _0xad3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3da[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require(_0xad3d('0x0'));var events=[_0xad3d('0x1'),'remove',_0xad3d('0x2')];function createListener(_0x5ed2b6,_0x52a158){return function(_0x1f7b56){_0x52a158[_0xad3d('0x3')](_0x5ed2b6,_0x1f7b56);};}function removeListener(_0x37b4c8,_0x1fcf0b){return function(){VoiceQueueEvents['removeListener'](_0x37b4c8,_0x1fcf0b);};}exports[_0xad3d('0x4')]=function(_0x3c93c1){for(var _0x52370b=0x0,_0x3d3caf=events[_0xad3d('0x5')];_0x52370b<_0x3d3caf;_0x52370b++){var _0x3df15f=events[_0x52370b];var _0x174fb4=createListener(_0xad3d('0x6')+_0x3df15f,_0x3c93c1);VoiceQueueEvents['on'](_0x3df15f,_0x174fb4);}}; \ No newline at end of file +var _0xac50=['removeListener','voiceQueue:','./voiceQueue.events','save','emit'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0xac50,0x1a1));var _0x0ac5=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xac50[_0x9c2427];return _0x51984f;};'use strict';var VoiceQueueEvents=require(_0x0ac5('0x0'));var events=[_0x0ac5('0x1'),'remove','update'];function createListener(_0x213eba,_0x1020dd){return function(_0x141484){_0x1020dd[_0x0ac5('0x2')](_0x213eba,_0x141484);};}function removeListener(_0x31c717,_0x3bc214){return function(){VoiceQueueEvents[_0x0ac5('0x3')](_0x31c717,_0x3bc214);};}exports['register']=function(_0x17fd85){for(var _0x4a1f46=0x0,_0x48642a=events['length'];_0x4a1f46<_0x48642a;_0x4a1f46++){var _0x149d2c=events[_0x4a1f46];var _0x48bd50=createListener(_0x0ac5('0x4')+_0x149d2c,_0x17fd85);VoiceQueueEvents['on'](_0x149d2c,_0x48bd50);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 01a377e..6e0a269 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbd0=['describe','get','getVoiceQueuesReport','show','create','put','/:id','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x2222eb,_0x14468e){var _0x37163d=function(_0x4c86f1){while(--_0x4c86f1){_0x2222eb['push'](_0x2222eb['shift']());}};_0x37163d(++_0x14468e);}(_0xfbd0,0x12f));var _0x0fbd=function(_0x15b1cd,_0x2db0c5){_0x15b1cd=_0x15b1cd-0x0;var _0x73f160=_0xfbd0[_0x15b1cd];return _0x73f160;};'use strict';var multer=require('multer');var util=require(_0x0fbd('0x0'));var path=require(_0x0fbd('0x1'));var timeout=require(_0x0fbd('0x2'));var express=require(_0x0fbd('0x3'));var router=express[_0x0fbd('0x4')]();var fs_extra=require(_0x0fbd('0x5'));var auth=require(_0x0fbd('0x6'));var interaction=require(_0x0fbd('0x7'));var config=require(_0x0fbd('0x8'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x0fbd('0x9')](),controller[_0x0fbd('0xa')]);router['get'](_0x0fbd('0xb'),auth[_0x0fbd('0x9')](),controller[_0x0fbd('0xc')]);router[_0x0fbd('0xd')]('/index',auth[_0x0fbd('0x9')](),controller[_0x0fbd('0xe')]);router[_0x0fbd('0xd')]('/:id',auth[_0x0fbd('0x9')](),controller[_0x0fbd('0xf')]);router['post']('/',auth[_0x0fbd('0x9')](),controller[_0x0fbd('0x10')]);router[_0x0fbd('0x11')](_0x0fbd('0x12'),auth[_0x0fbd('0x9')](),controller['update']);router[_0x0fbd('0x13')]('/:id',auth[_0x0fbd('0x9')](),controller[_0x0fbd('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1ba0=['getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x5ca696,_0x247d92){var _0x18b792=function(_0x4e83b8){while(--_0x4e83b8){_0x5ca696['push'](_0x5ca696['shift']());}};_0x18b792(++_0x247d92);}(_0x1ba0,0xa4));var _0x01ba=function(_0x45bf61,_0x10eb66){_0x45bf61=_0x45bf61-0x0;var _0x2ad827=_0x1ba0[_0x45bf61];return _0x2ad827;};'use strict';var multer=require(_0x01ba('0x0'));var util=require(_0x01ba('0x1'));var path=require(_0x01ba('0x2'));var timeout=require(_0x01ba('0x3'));var express=require(_0x01ba('0x4'));var router=express[_0x01ba('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x01ba('0x6'));var config=require('../../config/environment');var controller=require(_0x01ba('0x7'));router['get']('/',auth[_0x01ba('0x8')](),controller[_0x01ba('0x9')]);router[_0x01ba('0xa')](_0x01ba('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x01ba('0xa')]('/index',auth['isAuthenticated'](),controller[_0x01ba('0xc')]);router['get'](_0x01ba('0xd'),auth[_0x01ba('0x8')](),controller[_0x01ba('0xe')]);router[_0x01ba('0xf')]('/',auth[_0x01ba('0x8')](),controller[_0x01ba('0x10')]);router[_0x01ba('0x11')](_0x01ba('0xd'),auth[_0x01ba('0x8')](),controller[_0x01ba('0x12')]);router[_0x01ba('0x13')](_0x01ba('0xd'),auth[_0x01ba('0x8')](),controller[_0x01ba('0x14')]);module[_0x01ba('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index fd6d956..e77d997 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3365=['seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4d049c,_0x495924){var _0x1ff450=function(_0x9b090){while(--_0x9b090){_0x4d049c['push'](_0x4d049c['shift']());}};_0x1ff450(++_0x495924);}(_0x3365,0x13f));var _0x5336=function(_0x8a74d1,_0x4abf13){_0x8a74d1=_0x8a74d1-0x0;var _0x53775a=_0x3365[_0x8a74d1];return _0x53775a;};'use strict';var Sequelize=require(_0x5336('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x5336('0x1')]},'uniqueid':{'type':Sequelize[_0x5336('0x1')]},'calleridnum':{'type':Sequelize[_0x5336('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5336('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x5336('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x20f644){var _0x1260a7=moment(_0x20f644);var _0x43e38f=moment(this[_0x5336('0x3')]('queuecallerjoinAt'))[_0x5336('0x4')](_0x5336('0x5'));var _0xb05700=_0x1260a7['diff'](_0x43e38f,_0x5336('0x6'));this[_0x5336('0x7')]('queuecallerleaveAt',_0x20f644);this[_0x5336('0x7')](_0x5336('0x8'),_0xb05700||null);}},'position':{'type':Sequelize[_0x5336('0x9')]},'count':{'type':Sequelize[_0x5336('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x5336('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5336('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x5336('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5336('0x2')]},'queuecallerexit':{'type':Sequelize[_0x5336('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5336('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x5336('0x1')],'comment':_0x5336('0xb')},'originalposition':{'type':Sequelize[_0x5336('0x9')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5336('0x1')]},'connectedlinename':{'type':Sequelize[_0x5336('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5336('0x1')]},'exten':{'type':Sequelize[_0x5336('0x1')]},'priority':{'type':Sequelize[_0x5336('0x1')]},'holdtime':{'type':Sequelize[_0x5336('0x9')]},'mohtime':{'type':Sequelize[_0x5336('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5336('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5336('0x1')]},'transfer':{'type':Sequelize[_0x5336('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x5336('0xc')},'transferexten':{'type':Sequelize[_0x5336('0x1')]},'transferuniqueid':{'type':Sequelize[_0x5336('0x1')]},'disposition':{'type':Sequelize[_0x5336('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5336('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x5336('0x9')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x67ab=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','queuecallerleaveAt','setDataValue'];(function(_0x44fede,_0x386a68){var _0x3c478f=function(_0x4325d5){while(--_0x4325d5){_0x44fede['push'](_0x44fede['shift']());}};_0x3c478f(++_0x386a68);}(_0x67ab,0xb5));var _0xb67a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x67ab[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb67a('0x0'));module[_0xb67a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb67a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb67a('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb67a('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3a94b1){var _0x31324e=moment(_0x3a94b1);var _0x599327=moment(this[_0xb67a('0x4')](_0xb67a('0x5')))[_0xb67a('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x302cd8=_0x31324e[_0xb67a('0x7')](_0x599327,_0xb67a('0x8'));this['setDataValue'](_0xb67a('0x9'),_0x3a94b1);this[_0xb67a('0xa')](_0xb67a('0xb'),_0x302cd8||null);}},'position':{'type':Sequelize[_0xb67a('0xc')]},'count':{'type':Sequelize[_0xb67a('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xb67a('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb67a('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xb67a('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb67a('0x3')]},'queuecallerexit':{'type':Sequelize[_0xb67a('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb67a('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xb67a('0xe')},'originalposition':{'type':Sequelize[_0xb67a('0xc')]},'channel':{'type':Sequelize[_0xb67a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb67a('0x2')]},'context':{'type':Sequelize[_0xb67a('0x2')]},'exten':{'type':Sequelize[_0xb67a('0x2')]},'priority':{'type':Sequelize[_0xb67a('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xb67a('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb67a('0x2')]},'transfer':{'type':Sequelize[_0xb67a('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb67a('0x2')],'comment':_0xb67a('0xf')},'transferexten':{'type':Sequelize[_0xb67a('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb67a('0x2')]},'disposition':{'type':Sequelize[_0xb67a('0x2')]},'secondDisposition':{'type':Sequelize[_0xb67a('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb67a('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 082d6cd..3bae826 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e2f=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','getVoiceQueuesReport','nolimit','order','options','rows','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x229fa7,_0xcf12a5){var _0x26ee05=function(_0x4924db){while(--_0x4924db){_0x229fa7['push'](_0x229fa7['shift']());}};_0x26ee05(++_0xcf12a5);}(_0x0e2f,0x1eb));var _0xf0e2=function(_0x344e52,_0x128253){_0x344e52=_0x344e52-0x0;var _0x37465e=_0x0e2f[_0x344e52];return _0x37465e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0e2('0x0'));var jsonpatch=require(_0xf0e2('0x1'));var rp=require(_0xf0e2('0x2'));var moment=require('moment');var BPromise=require(_0xf0e2('0x3'));var Mustache=require(_0xf0e2('0x4'));var util=require(_0xf0e2('0x5'));var path=require(_0xf0e2('0x6'));var sox=require(_0xf0e2('0x7'));var csv=require(_0xf0e2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0e2('0x9'));var squel=require(_0xf0e2('0xa'));var crypto=require(_0xf0e2('0xb'));var jsforce=require(_0xf0e2('0xc'));var deskjs=require(_0xf0e2('0xd'));var toCsv=require(_0xf0e2('0x8'));var querystring=require(_0xf0e2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0e2('0xf'));var qs=require(_0xf0e2('0x10'));var as=require(_0xf0e2('0x11'));var hardwareService=require(_0xf0e2('0x12'));var logger=require(_0xf0e2('0x13'))(_0xf0e2('0x14'));var utils=require(_0xf0e2('0x15'));var config=require(_0xf0e2('0x16'));var licenseUtil=require(_0xf0e2('0x17'));var db=require(_0xf0e2('0x18'))['db'];config[_0xf0e2('0x19')]=_[_0xf0e2('0x1a')](config[_0xf0e2('0x19')],{'host':_0xf0e2('0x1b'),'port':0x18eb});var socket=require(_0xf0e2('0x1c'))(new Redis(config[_0xf0e2('0x19')]));require(_0xf0e2('0x1d'))['register'](socket);function respondWithStatusCode(_0x141739,_0xf6c9f1){_0xf6c9f1=_0xf6c9f1||0xcc;return function(_0x2b32fe){if(_0x2b32fe){return _0x141739[_0xf0e2('0x1e')](_0xf6c9f1);}return _0x141739[_0xf0e2('0x1f')](_0xf6c9f1)[_0xf0e2('0x20')]();};}function respondWithResult(_0x46ce70,_0x50e461){_0x50e461=_0x50e461||0xc8;return function(_0x43a318){if(_0x43a318){return _0x46ce70[_0xf0e2('0x1f')](_0x50e461)[_0xf0e2('0x21')](_0x43a318);}};}function respondWithFilteredResult(_0x46ebf3,_0x528b76){return function(_0x49cfb3){if(_0x49cfb3){var _0x3ea03b=typeof _0x528b76[_0xf0e2('0x22')]===_0xf0e2('0x23')&&typeof _0x528b76[_0xf0e2('0x24')]===_0xf0e2('0x23');var _0x498ec5=_0x49cfb3[_0xf0e2('0x25')];var _0x5f38c1=_0x3ea03b?0x0:_0x528b76[_0xf0e2('0x22')];var _0x199782=_0x3ea03b?_0x49cfb3['count']:_0x528b76[_0xf0e2('0x22')]+_0x528b76[_0xf0e2('0x24')];var _0x2914a6;if(_0x199782>=_0x498ec5){_0x199782=_0x498ec5;_0x2914a6=0xc8;}else{_0x2914a6=0xce;}_0x46ebf3[_0xf0e2('0x1f')](_0x2914a6);return _0x46ebf3['set'](_0xf0e2('0x26'),_0x5f38c1+'-'+_0x199782+'/'+_0x498ec5)[_0xf0e2('0x21')](_0x49cfb3);}return null;};}function patchUpdates(_0x504944){return function(_0x592ef8){try{jsonpatch['apply'](_0x592ef8,_0x504944,!![]);}catch(_0x3b1159){return BPromise['reject'](_0x3b1159);}return _0x592ef8[_0xf0e2('0x27')]();};}function saveUpdates(_0x1e7820,_0x2b60a5){return function(_0x5e8b53){if(_0x5e8b53){return _0x5e8b53[_0xf0e2('0x28')](_0x1e7820)[_0xf0e2('0x29')](function(_0x3e4ffb){return _0x3e4ffb;});}return null;};}function removeEntity(_0x1074a1,_0x5d6338){return function(_0x3132fb){if(_0x3132fb){return _0x3132fb[_0xf0e2('0x2a')]()[_0xf0e2('0x29')](function(){_0x1074a1[_0xf0e2('0x1f')](0xcc)[_0xf0e2('0x20')]();});}};}function handleEntityNotFound(_0x5749d0,_0x34e16a){return function(_0x5e64f5){if(!_0x5e64f5){_0x5749d0['sendStatus'](0x194);}return _0x5e64f5;};}function handleError(_0x14531f,_0x1b5e41){_0x1b5e41=_0x1b5e41||0x1f4;return function(_0x1c78f6){logger[_0xf0e2('0x2b')](_0x1c78f6[_0xf0e2('0x2c')]);if(_0x1c78f6[_0xf0e2('0x2d')]){delete _0x1c78f6[_0xf0e2('0x2d')];}_0x14531f['status'](_0x1b5e41)[_0xf0e2('0x2e')](_0x1c78f6);};}exports['index']=function(_0x6f69f,_0x282d64){var _0x15c1fe={},_0x3d9815={},_0x28f110={'count':0x0,'rows':[]};var _0x4630c6=_[_0xf0e2('0x2f')](db[_0xf0e2('0x30')][_0xf0e2('0x31')],function(_0x35a2d3){return{'name':_0x35a2d3[_0xf0e2('0x32')],'type':_0x35a2d3[_0xf0e2('0x33')][_0xf0e2('0x34')]};});_0x3d9815[_0xf0e2('0x35')]=_[_0xf0e2('0x2f')](_0x4630c6,_0xf0e2('0x2d'));_0x3d9815[_0xf0e2('0x36')]=_['keys'](_0x6f69f[_0xf0e2('0x36')]);_0x3d9815['filters']=_[_0xf0e2('0x37')](_0x3d9815['model'],_0x3d9815[_0xf0e2('0x36')]);_0x15c1fe[_0xf0e2('0x38')]=_[_0xf0e2('0x37')](_0x3d9815[_0xf0e2('0x35')],qs['fields'](_0x6f69f[_0xf0e2('0x36')][_0xf0e2('0x39')]));_0x15c1fe[_0xf0e2('0x38')]=_0x15c1fe['attributes'][_0xf0e2('0x3a')]?_0x15c1fe['attributes']:_0x3d9815[_0xf0e2('0x35')];if(!_0x6f69f['query'][_0xf0e2('0x3b')]('nolimit')){_0x15c1fe[_0xf0e2('0x24')]=qs['limit'](_0x6f69f['query'][_0xf0e2('0x24')]);_0x15c1fe[_0xf0e2('0x22')]=qs['offset'](_0x6f69f[_0xf0e2('0x36')][_0xf0e2('0x22')]);}_0x15c1fe['order']=qs[_0xf0e2('0x3c')](_0x6f69f[_0xf0e2('0x36')][_0xf0e2('0x3c')]);_0x15c1fe[_0xf0e2('0x3d')]=qs[_0xf0e2('0x3e')](_[_0xf0e2('0x3f')](_0x6f69f[_0xf0e2('0x36')],_0x3d9815[_0xf0e2('0x3e')]),_0x4630c6);if(_0x6f69f[_0xf0e2('0x36')][_0xf0e2('0x40')]){_0x15c1fe['where']=_[_0xf0e2('0x41')](_0x15c1fe[_0xf0e2('0x3d')],{'$or':_['map'](_0x4630c6,function(_0x368060){if(_0x368060['type']!==_0xf0e2('0x42')){var _0x5eeeae={};_0x5eeeae[_0x368060['name']]={'$like':'%'+_0x6f69f[_0xf0e2('0x36')][_0xf0e2('0x40')]+'%'};return _0x5eeeae;}})});}_0x15c1fe=_[_0xf0e2('0x41')]({},_0x15c1fe,_0x6f69f['options']);var _0x473eb4={'where':_0x15c1fe[_0xf0e2('0x3d')]};return db[_0xf0e2('0x30')][_0xf0e2('0x25')](_0x473eb4)[_0xf0e2('0x29')](function(_0x5e6fe5){_0x28f110['count']=_0x5e6fe5;if(_0x6f69f[_0xf0e2('0x36')][_0xf0e2('0x43')]){_0x15c1fe[_0xf0e2('0x44')]=[{'all':!![]}];}return db[_0xf0e2('0x30')][_0xf0e2('0x45')](_0x15c1fe);})[_0xf0e2('0x29')](function(_0xd7466f){_0x28f110['rows']=_0xd7466f;return _0x28f110;})[_0xf0e2('0x29')](respondWithFilteredResult(_0x282d64,_0x15c1fe))[_0xf0e2('0x46')](handleError(_0x282d64,null));};exports[_0xf0e2('0x47')]=function(_0x5ceefb,_0xca4c35){var _0x4325a8={'raw':![],'where':{'id':_0x5ceefb[_0xf0e2('0x48')]['id']}},_0x45d7ff={};_0x45d7ff[_0xf0e2('0x35')]=_[_0xf0e2('0x49')](db[_0xf0e2('0x30')]['rawAttributes']);_0x45d7ff['query']=_[_0xf0e2('0x49')](_0x5ceefb[_0xf0e2('0x36')]);_0x45d7ff[_0xf0e2('0x3e')]=_[_0xf0e2('0x37')](_0x45d7ff[_0xf0e2('0x35')],_0x45d7ff[_0xf0e2('0x36')]);_0x4325a8[_0xf0e2('0x38')]=_[_0xf0e2('0x37')](_0x45d7ff[_0xf0e2('0x35')],qs[_0xf0e2('0x39')](_0x5ceefb['query'][_0xf0e2('0x39')]));_0x4325a8[_0xf0e2('0x38')]=_0x4325a8[_0xf0e2('0x38')]['length']?_0x4325a8['attributes']:_0x45d7ff[_0xf0e2('0x35')];if(_0x5ceefb[_0xf0e2('0x36')]['includeAll']){_0x4325a8[_0xf0e2('0x44')]=[{'all':!![]}];}_0x4325a8=_['merge']({},_0x4325a8,_0x5ceefb['options']);return db['VoiceQueueReport'][_0xf0e2('0x4a')](_0x4325a8)[_0xf0e2('0x29')](handleEntityNotFound(_0xca4c35,null))[_0xf0e2('0x29')](respondWithResult(_0xca4c35,null))['catch'](handleError(_0xca4c35,null));};exports[_0xf0e2('0x4b')]=function(_0x1af702,_0x4a72d9){return db[_0xf0e2('0x30')][_0xf0e2('0x4b')](_0x1af702[_0xf0e2('0x4c')],{})[_0xf0e2('0x29')](respondWithResult(_0x4a72d9,0xc9))[_0xf0e2('0x46')](handleError(_0x4a72d9,null));};exports['update']=function(_0x3ce26c,_0x157c76){if(_0x3ce26c[_0xf0e2('0x4c')]['id']){delete _0x3ce26c['body']['id'];}return db[_0xf0e2('0x30')][_0xf0e2('0x4a')]({'where':{'id':_0x3ce26c['params']['id']}})[_0xf0e2('0x29')](handleEntityNotFound(_0x157c76,null))[_0xf0e2('0x29')](saveUpdates(_0x3ce26c[_0xf0e2('0x4c')],null))['then'](respondWithResult(_0x157c76,null))[_0xf0e2('0x46')](handleError(_0x157c76,null));};exports[_0xf0e2('0x2a')]=function(_0x10bb68,_0x312135){return db['VoiceQueueReport'][_0xf0e2('0x4a')]({'where':{'id':_0x10bb68[_0xf0e2('0x48')]['id']}})[_0xf0e2('0x29')](handleEntityNotFound(_0x312135,null))[_0xf0e2('0x29')](removeEntity(_0x312135,null))[_0xf0e2('0x46')](handleError(_0x312135,null));};exports['describe']=function(_0x135bb6,_0x16612c){return db[_0xf0e2('0x30')][_0xf0e2('0x4d')]()[_0xf0e2('0x29')](respondWithResult(_0x16612c,null))['catch'](handleError(_0x16612c,null));};exports[_0xf0e2('0x4e')]=function(_0x17992a,_0x2e0ed0){var _0x3bf9d4={},_0x555588={},_0x56d25c={'count':0x0,'rows':[]};_0x555588[_0xf0e2('0x35')]=_[_0xf0e2('0x49')](db[_0xf0e2('0x30')]['rawAttributes']);_0x555588['query']=_['keys'](_0x17992a[_0xf0e2('0x36')]);_0x555588['filters']=_['intersection'](_0x555588[_0xf0e2('0x35')],_0x555588[_0xf0e2('0x36')]);_0x3bf9d4[_0xf0e2('0x38')]=_[_0xf0e2('0x37')](_0x555588[_0xf0e2('0x35')],qs[_0xf0e2('0x39')](_0x17992a[_0xf0e2('0x36')][_0xf0e2('0x39')]));_0x3bf9d4['attributes']=_0x3bf9d4[_0xf0e2('0x38')]['length']?_0x3bf9d4[_0xf0e2('0x38')]:_0x555588[_0xf0e2('0x35')];if(!_0x17992a[_0xf0e2('0x36')]['hasOwnProperty'](_0xf0e2('0x4f'))){_0x3bf9d4[_0xf0e2('0x24')]=qs[_0xf0e2('0x24')](_0x17992a['query'][_0xf0e2('0x24')]);_0x3bf9d4[_0xf0e2('0x22')]=qs[_0xf0e2('0x22')](_0x17992a[_0xf0e2('0x36')]['offset']);}_0x3bf9d4[_0xf0e2('0x50')]=qs['sort'](_0x17992a[_0xf0e2('0x36')]['sort']);_0x3bf9d4['where']=qs[_0xf0e2('0x3e')](_[_0xf0e2('0x3f')](_0x17992a['query'],_0x555588[_0xf0e2('0x3e')]));if(_0x17992a[_0xf0e2('0x36')][_0xf0e2('0x40')]){_0x3bf9d4[_0xf0e2('0x3d')]=_[_0xf0e2('0x41')](_0x3bf9d4['where'],{'$or':_['map'](_0x3bf9d4[_0xf0e2('0x38')],function(_0x446174){var _0x231088={};_0x231088[_0x446174]={'$like':'%'+_0x17992a[_0xf0e2('0x36')]['filter']+'%'};return _0x231088;})});}_0x3bf9d4=_['merge']({},_0x3bf9d4,_0x17992a[_0xf0e2('0x51')]);var _0x1ec075={'where':_0x3bf9d4['where']};return db[_0xf0e2('0x30')][_0xf0e2('0x25')](_0x1ec075)[_0xf0e2('0x29')](function(_0x15b0be){_0x56d25c[_0xf0e2('0x25')]=_0x15b0be;if(_0x17992a[_0xf0e2('0x36')][_0xf0e2('0x43')]){_0x3bf9d4['include']=[{'all':!![]}];}return db[_0xf0e2('0x30')]['findAll'](_0x3bf9d4);})[_0xf0e2('0x29')](function(_0x3f2a60){_0x56d25c[_0xf0e2('0x52')]=_0x3f2a60;return _0x56d25c;})[_0xf0e2('0x29')](respondWithFilteredResult(_0x2e0ed0,_0x3bf9d4,_0xf0e2('0x4e')))['catch'](handleError(_0x2e0ed0,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xe271=['destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','VoiceQueueReport','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','getVoiceQueuesReport','nolimit','options','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then'];(function(_0x5a18fe,_0x2d5af2){var _0x209fa7=function(_0x544d92){while(--_0x544d92){_0x5a18fe['push'](_0x5a18fe['shift']());}};_0x209fa7(++_0x2d5af2);}(_0xe271,0x157));var _0x1e27=function(_0x12199c,_0x2def59){_0x12199c=_0x12199c-0x0;var _0x4ad6a5=_0xe271[_0x12199c];return _0x4ad6a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e27('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e27('0x1'));var rp=require(_0x1e27('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1e27('0x3'));var path=require(_0x1e27('0x4'));var sox=require(_0x1e27('0x5'));var csv=require(_0x1e27('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e27('0x7'));var _=require('lodash');var squel=require(_0x1e27('0x8'));var crypto=require('crypto');var jsforce=require(_0x1e27('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e27('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e27('0xb'));var qs=require(_0x1e27('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e27('0xd'));var utils=require('../../config/utils');var config=require(_0x1e27('0xe'));var licenseUtil=require(_0x1e27('0xf'));var db=require(_0x1e27('0x10'))['db'];config[_0x1e27('0x11')]=_[_0x1e27('0x12')](config[_0x1e27('0x11')],{'host':_0x1e27('0x13'),'port':0x18eb});var socket=require(_0x1e27('0x14'))(new Redis(config[_0x1e27('0x11')]));require(_0x1e27('0x15'))[_0x1e27('0x16')](socket);function respondWithStatusCode(_0x43e8c0,_0x43c830){_0x43c830=_0x43c830||0xcc;return function(_0x3460f1){if(_0x3460f1){return _0x43e8c0[_0x1e27('0x17')](_0x43c830);}return _0x43e8c0[_0x1e27('0x18')](_0x43c830)[_0x1e27('0x19')]();};}function respondWithResult(_0x998b9b,_0x16e57b){_0x16e57b=_0x16e57b||0xc8;return function(_0xd05085){if(_0xd05085){return _0x998b9b['status'](_0x16e57b)[_0x1e27('0x1a')](_0xd05085);}};}function respondWithFilteredResult(_0xc64a6b,_0x302699){return function(_0x253a65){if(_0x253a65){var _0x3a66d9=typeof _0x302699[_0x1e27('0x1b')]===_0x1e27('0x1c')&&typeof _0x302699[_0x1e27('0x1d')]===_0x1e27('0x1c');var _0x2473ba=_0x253a65[_0x1e27('0x1e')];var _0x5e4805=_0x3a66d9?0x0:_0x302699[_0x1e27('0x1b')];var _0x36b6e2=_0x3a66d9?_0x253a65[_0x1e27('0x1e')]:_0x302699[_0x1e27('0x1b')]+_0x302699[_0x1e27('0x1d')];var _0x4f84ac;if(_0x36b6e2>=_0x2473ba){_0x36b6e2=_0x2473ba;_0x4f84ac=0xc8;}else{_0x4f84ac=0xce;}_0xc64a6b['status'](_0x4f84ac);return _0xc64a6b[_0x1e27('0x1f')]('Content-Range',_0x5e4805+'-'+_0x36b6e2+'/'+_0x2473ba)[_0x1e27('0x1a')](_0x253a65);}return null;};}function patchUpdates(_0x1e023f){return function(_0x48ae59){try{jsonpatch[_0x1e27('0x20')](_0x48ae59,_0x1e023f,!![]);}catch(_0x3b5deb){return BPromise[_0x1e27('0x21')](_0x3b5deb);}return _0x48ae59[_0x1e27('0x22')]();};}function saveUpdates(_0x4e8532,_0x5ba6e){return function(_0x5c6127){if(_0x5c6127){return _0x5c6127[_0x1e27('0x23')](_0x4e8532)[_0x1e27('0x24')](function(_0x1d9b69){return _0x1d9b69;});}return null;};}function removeEntity(_0x3a7913,_0x5c5847){return function(_0x40a4fa){if(_0x40a4fa){return _0x40a4fa[_0x1e27('0x25')]()['then'](function(){_0x3a7913[_0x1e27('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5860e0,_0x14b840){return function(_0xe72187){if(!_0xe72187){_0x5860e0[_0x1e27('0x17')](0x194);}return _0xe72187;};}function handleError(_0xdd0cfe,_0x1aedf7){_0x1aedf7=_0x1aedf7||0x1f4;return function(_0x3ba8f8){logger['error'](_0x3ba8f8[_0x1e27('0x26')]);if(_0x3ba8f8['name']){delete _0x3ba8f8[_0x1e27('0x27')];}_0xdd0cfe['status'](_0x1aedf7)['send'](_0x3ba8f8);};}exports[_0x1e27('0x28')]=function(_0x5b0e1b,_0x5b1c09){var _0x591b57={},_0xb72394={},_0xa80430={'count':0x0,'rows':[]};var _0x410196=_[_0x1e27('0x29')](db['VoiceQueueReport'][_0x1e27('0x2a')],function(_0x220733){return{'name':_0x220733[_0x1e27('0x2b')],'type':_0x220733[_0x1e27('0x2c')]['key']};});_0xb72394[_0x1e27('0x2d')]=_[_0x1e27('0x29')](_0x410196,_0x1e27('0x27'));_0xb72394[_0x1e27('0x2e')]=_['keys'](_0x5b0e1b['query']);_0xb72394[_0x1e27('0x2f')]=_[_0x1e27('0x30')](_0xb72394['model'],_0xb72394['query']);_0x591b57[_0x1e27('0x31')]=_['intersection'](_0xb72394[_0x1e27('0x2d')],qs[_0x1e27('0x32')](_0x5b0e1b['query'][_0x1e27('0x32')]));_0x591b57[_0x1e27('0x31')]=_0x591b57['attributes'][_0x1e27('0x33')]?_0x591b57[_0x1e27('0x31')]:_0xb72394[_0x1e27('0x2d')];if(!_0x5b0e1b['query'][_0x1e27('0x34')]('nolimit')){_0x591b57[_0x1e27('0x1d')]=qs[_0x1e27('0x1d')](_0x5b0e1b['query'][_0x1e27('0x1d')]);_0x591b57[_0x1e27('0x1b')]=qs[_0x1e27('0x1b')](_0x5b0e1b[_0x1e27('0x2e')][_0x1e27('0x1b')]);}_0x591b57[_0x1e27('0x35')]=qs['sort'](_0x5b0e1b['query'][_0x1e27('0x36')]);_0x591b57['where']=qs[_0x1e27('0x2f')](_[_0x1e27('0x37')](_0x5b0e1b['query'],_0xb72394['filters']),_0x410196);if(_0x5b0e1b['query'][_0x1e27('0x38')]){_0x591b57[_0x1e27('0x39')]=_[_0x1e27('0x3a')](_0x591b57[_0x1e27('0x39')],{'$or':_[_0x1e27('0x29')](_0x410196,function(_0x162197){if(_0x162197[_0x1e27('0x2c')]!==_0x1e27('0x3b')){var _0x1b7631={};_0x1b7631[_0x162197[_0x1e27('0x27')]]={'$like':'%'+_0x5b0e1b[_0x1e27('0x2e')][_0x1e27('0x38')]+'%'};return _0x1b7631;}})});}_0x591b57=_[_0x1e27('0x3a')]({},_0x591b57,_0x5b0e1b['options']);var _0x37fff1={'where':_0x591b57[_0x1e27('0x39')]};return db['VoiceQueueReport']['count'](_0x37fff1)[_0x1e27('0x24')](function(_0x1097d4){_0xa80430[_0x1e27('0x1e')]=_0x1097d4;if(_0x5b0e1b[_0x1e27('0x2e')]['includeAll']){_0x591b57[_0x1e27('0x3c')]=[{'all':!![]}];}return db[_0x1e27('0x3d')][_0x1e27('0x3e')](_0x591b57);})[_0x1e27('0x24')](function(_0x3112f3){_0xa80430[_0x1e27('0x3f')]=_0x3112f3;return _0xa80430;})[_0x1e27('0x24')](respondWithFilteredResult(_0x5b1c09,_0x591b57))[_0x1e27('0x40')](handleError(_0x5b1c09,null));};exports[_0x1e27('0x41')]=function(_0x5345cd,_0x176202){var _0x33c620={'raw':![],'where':{'id':_0x5345cd[_0x1e27('0x42')]['id']}},_0x4a7891={};_0x4a7891['model']=_[_0x1e27('0x43')](db['VoiceQueueReport'][_0x1e27('0x2a')]);_0x4a7891[_0x1e27('0x2e')]=_['keys'](_0x5345cd[_0x1e27('0x2e')]);_0x4a7891[_0x1e27('0x2f')]=_['intersection'](_0x4a7891[_0x1e27('0x2d')],_0x4a7891['query']);_0x33c620['attributes']=_['intersection'](_0x4a7891[_0x1e27('0x2d')],qs[_0x1e27('0x32')](_0x5345cd[_0x1e27('0x2e')][_0x1e27('0x32')]));_0x33c620[_0x1e27('0x31')]=_0x33c620[_0x1e27('0x31')][_0x1e27('0x33')]?_0x33c620[_0x1e27('0x31')]:_0x4a7891[_0x1e27('0x2d')];if(_0x5345cd['query'][_0x1e27('0x44')]){_0x33c620['include']=[{'all':!![]}];}_0x33c620=_[_0x1e27('0x3a')]({},_0x33c620,_0x5345cd['options']);return db[_0x1e27('0x3d')][_0x1e27('0x45')](_0x33c620)[_0x1e27('0x24')](handleEntityNotFound(_0x176202,null))[_0x1e27('0x24')](respondWithResult(_0x176202,null))[_0x1e27('0x40')](handleError(_0x176202,null));};exports['create']=function(_0x1db225,_0x26dd18){return db[_0x1e27('0x3d')][_0x1e27('0x46')](_0x1db225[_0x1e27('0x47')],{})[_0x1e27('0x24')](respondWithResult(_0x26dd18,0xc9))[_0x1e27('0x40')](handleError(_0x26dd18,null));};exports[_0x1e27('0x23')]=function(_0xa269fe,_0x477760){if(_0xa269fe[_0x1e27('0x47')]['id']){delete _0xa269fe[_0x1e27('0x47')]['id'];}return db[_0x1e27('0x3d')][_0x1e27('0x45')]({'where':{'id':_0xa269fe[_0x1e27('0x42')]['id']}})[_0x1e27('0x24')](handleEntityNotFound(_0x477760,null))[_0x1e27('0x24')](saveUpdates(_0xa269fe['body'],null))[_0x1e27('0x24')](respondWithResult(_0x477760,null))[_0x1e27('0x40')](handleError(_0x477760,null));};exports[_0x1e27('0x25')]=function(_0x54fc62,_0x48b832){return db['VoiceQueueReport']['find']({'where':{'id':_0x54fc62['params']['id']}})[_0x1e27('0x24')](handleEntityNotFound(_0x48b832,null))['then'](removeEntity(_0x48b832,null))[_0x1e27('0x40')](handleError(_0x48b832,null));};exports[_0x1e27('0x48')]=function(_0x37fcc3,_0x3bc071){return db[_0x1e27('0x3d')][_0x1e27('0x48')]()[_0x1e27('0x24')](respondWithResult(_0x3bc071,null))[_0x1e27('0x40')](handleError(_0x3bc071,null));};exports[_0x1e27('0x49')]=function(_0x489fac,_0xb296ef){var _0x39334c={},_0x641fbf={},_0x3e75ac={'count':0x0,'rows':[]};_0x641fbf['model']=_[_0x1e27('0x43')](db[_0x1e27('0x3d')]['rawAttributes']);_0x641fbf[_0x1e27('0x2e')]=_['keys'](_0x489fac[_0x1e27('0x2e')]);_0x641fbf[_0x1e27('0x2f')]=_['intersection'](_0x641fbf[_0x1e27('0x2d')],_0x641fbf[_0x1e27('0x2e')]);_0x39334c[_0x1e27('0x31')]=_[_0x1e27('0x30')](_0x641fbf[_0x1e27('0x2d')],qs['fields'](_0x489fac[_0x1e27('0x2e')][_0x1e27('0x32')]));_0x39334c['attributes']=_0x39334c[_0x1e27('0x31')][_0x1e27('0x33')]?_0x39334c[_0x1e27('0x31')]:_0x641fbf[_0x1e27('0x2d')];if(!_0x489fac['query'][_0x1e27('0x34')](_0x1e27('0x4a'))){_0x39334c['limit']=qs[_0x1e27('0x1d')](_0x489fac['query'][_0x1e27('0x1d')]);_0x39334c[_0x1e27('0x1b')]=qs[_0x1e27('0x1b')](_0x489fac['query'][_0x1e27('0x1b')]);}_0x39334c[_0x1e27('0x35')]=qs['sort'](_0x489fac['query']['sort']);_0x39334c[_0x1e27('0x39')]=qs[_0x1e27('0x2f')](_[_0x1e27('0x37')](_0x489fac[_0x1e27('0x2e')],_0x641fbf[_0x1e27('0x2f')]));if(_0x489fac[_0x1e27('0x2e')]['filter']){_0x39334c[_0x1e27('0x39')]=_[_0x1e27('0x3a')](_0x39334c[_0x1e27('0x39')],{'$or':_[_0x1e27('0x29')](_0x39334c[_0x1e27('0x31')],function(_0x3257d4){var _0x5ca4d6={};_0x5ca4d6[_0x3257d4]={'$like':'%'+_0x489fac['query'][_0x1e27('0x38')]+'%'};return _0x5ca4d6;})});}_0x39334c=_[_0x1e27('0x3a')]({},_0x39334c,_0x489fac[_0x1e27('0x4b')]);var _0x4c555e={'where':_0x39334c[_0x1e27('0x39')]};return db[_0x1e27('0x3d')][_0x1e27('0x1e')](_0x4c555e)['then'](function(_0xc3b34a){_0x3e75ac['count']=_0xc3b34a;if(_0x489fac[_0x1e27('0x2e')]['includeAll']){_0x39334c[_0x1e27('0x3c')]=[{'all':!![]}];}return db[_0x1e27('0x3d')][_0x1e27('0x3e')](_0x39334c);})['then'](function(_0x46f955){_0x3e75ac[_0x1e27('0x3f')]=_0x46f955;return _0x3e75ac;})[_0x1e27('0x24')](respondWithFilteredResult(_0xb296ef,_0x39334c,_0x1e27('0x49')))[_0x1e27('0x40')](handleError(_0xb296ef,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e34e10b..eacf1e2 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.events.js +++ b/server/api/voiceQueueReport/voiceQueueReport.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4efa=['VoiceQueueReport','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x4efa,0x166));var _0xa4ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4efa[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa4ef('0x0'));var VoiceQueueReport=require(_0xa4ef('0x1'))['db'][_0xa4ef('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa4ef('0x3'),'afterUpdate':_0xa4ef('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3ac3f7){return function(_0x57ef34,_0x454a8e,_0x404f9f){VoiceQueueReportEvents[_0xa4ef('0x5')](_0x3ac3f7+':'+_0x57ef34['id'],_0x57ef34);VoiceQueueReportEvents[_0xa4ef('0x5')](_0x3ac3f7,_0x57ef34);_0x404f9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xa4ef('0x6')](e,emitEvent(event));}}module[_0xa4ef('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x767d=['events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x33039d,_0x32f444){var _0x182843=function(_0x2e4b31){while(--_0x2e4b31){_0x33039d['push'](_0x33039d['shift']());}};_0x182843(++_0x32f444);}(_0x767d,0xcf));var _0xd767=function(_0x553650,_0x1e04ab){_0x553650=_0x553650-0x0;var _0x2098fc=_0x767d[_0x553650];return _0x2098fc;};'use strict';var EventEmitter=require(_0xd767('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xd767('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd767('0x2')](0x0);var events={'afterCreate':_0xd767('0x3'),'afterUpdate':_0xd767('0x4'),'afterDestroy':_0xd767('0x5')};function emitEvent(_0x2ed45c){return function(_0x1efed2,_0x144a15,_0xd9df75){VoiceQueueReportEvents[_0xd767('0x6')](_0x2ed45c+':'+_0x1efed2['id'],_0x1efed2);VoiceQueueReportEvents['emit'](_0x2ed45c,_0x1efed2);_0xd9df75(null);};}for(var e in events){if(events[_0xd767('0x7')](e)){var event=events[e];VoiceQueueReport[_0xd767('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 95f9814..efe72c4 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8f7=['uniqueid','calleridnum','util','api','bluebird','path','rimraf','exports','define','VoiceQueueReport','report_queue'];(function(_0x50c878,_0x1cddab){var _0x19994e=function(_0x26e090){while(--_0x26e090){_0x50c878['push'](_0x50c878['shift']());}};_0x19994e(++_0x1cddab);}(_0xf8f7,0x91));var _0x7f8f=function(_0x417d20,_0x1c497c){_0x417d20=_0x417d20-0x0;var _0x25d7f8=_0xf8f7[_0x417d20];return _0x25d7f8;};'use strict';var _=require('lodash');var util=require(_0x7f8f('0x0'));var logger=require('../../config/logger')(_0x7f8f('0x1'));var moment=require('moment');var BPromise=require(_0x7f8f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f8f('0x3'));var rimraf=require(_0x7f8f('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x7f8f('0x5')]=function(_0x1fb21c,_0x37b8b0){return _0x1fb21c[_0x7f8f('0x6')](_0x7f8f('0x7'),attributes,{'tableName':_0x7f8f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x7f8f('0x9')]},{'fields':[_0x7f8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44f6=['path','rimraf','../../config/environment','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','request-promise'];(function(_0x4785ba,_0x5ddc89){var _0x521836=function(_0x21ceb2){while(--_0x21ceb2){_0x4785ba['push'](_0x4785ba['shift']());}};_0x521836(++_0x5ddc89);}(_0x44f6,0xa4));var _0x644f=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0x44f6[_0x334599];return _0x4cdff2;};'use strict';var _=require(_0x644f('0x0'));var util=require(_0x644f('0x1'));var logger=require(_0x644f('0x2'))(_0x644f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x644f('0x4'));var fs=require('fs');var path=require(_0x644f('0x5'));var rimraf=require(_0x644f('0x6'));var config=require(_0x644f('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x1839b8,_0xb6b9b5){return _0x1839b8[_0x644f('0x8')](_0x644f('0x9'),attributes,{'tableName':_0x644f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x644f('0xb')]},{'fields':[_0x644f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 1fa1f29..4b203a3 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.rpc.js +++ b/server/api/voiceQueueReport/voiceQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb70=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceQueueReport','options','attributes','limit','map','include','model','GetVoiceQueueReport','debug','CreateVoiceQueueReport','create','body','raw','update','where','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0xf1402a,_0x187f5c){var _0x4f7ead=function(_0x57dfd9){while(--_0x57dfd9){_0xf1402a['push'](_0xf1402a['shift']());}};_0x4f7ead(++_0x187f5c);}(_0xdb70,0x126));var _0x0db7=function(_0x221d8a,_0x40b3){_0x221d8a=_0x221d8a-0x0;var _0x2425db=_0xdb70[_0x221d8a];return _0x2425db;};'use strict';var _=require(_0x0db7('0x0'));var util=require(_0x0db7('0x1'));var moment=require('moment');var BPromise=require(_0x0db7('0x2'));var rs=require(_0x0db7('0x3'));var fs=require('fs');var Redis=require(_0x0db7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0db7('0x5'));var logger=require('../../config/logger')(_0x0db7('0x6'));var config=require(_0x0db7('0x7'));var jayson=require(_0x0db7('0x8'));var client=jayson[_0x0db7('0x9')][_0x0db7('0xa')]({'port':0x232a});config[_0x0db7('0xb')]=_[_0x0db7('0xc')](config[_0x0db7('0xb')],{'host':_0x0db7('0xd'),'port':0x18eb});var socket=require(_0x0db7('0xe'))(new Redis(config['redis']));require(_0x0db7('0xf'))[_0x0db7('0x10')](socket);function respondWithRpcPromise(_0x6d357c,_0x4ed9b7,_0x53eaba){return new BPromise(function(_0x443e08,_0x2b238b){return client[_0x0db7('0x11')](_0x6d357c,_0x53eaba)[_0x0db7('0x12')](function(_0xf65f29){logger['info'](_0x0db7('0x13'),_0x4ed9b7,_0x0db7('0x14'));logger['debug'](_0x0db7('0x15'),_0x4ed9b7,_0x0db7('0x14'),JSON[_0x0db7('0x16')](_0xf65f29));if(_0xf65f29[_0x0db7('0x17')]){if(_0xf65f29[_0x0db7('0x17')][_0x0db7('0x18')]===0x1f4){logger[_0x0db7('0x17')](_0x0db7('0x13'),_0x4ed9b7,_0xf65f29[_0x0db7('0x17')][_0x0db7('0x19')]);return _0x2b238b(_0xf65f29[_0x0db7('0x17')][_0x0db7('0x19')]);}logger[_0x0db7('0x17')](_0x0db7('0x13'),_0x4ed9b7,_0xf65f29['error']['message']);return _0x443e08(_0xf65f29['error']['message']);}else{logger[_0x0db7('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x4ed9b7,_0x0db7('0x14'));_0x443e08(_0xf65f29[_0x0db7('0x1b')]['message']);}})[_0x0db7('0x1c')](function(_0xeb3840){logger['error'](_0x0db7('0x13'),_0x4ed9b7,_0xeb3840);_0x2b238b(_0xeb3840);});});}exports['GetVoiceQueueReport']=function(_0xf34681){var _0x560bf5=this;return new Promise(function(_0x24b44a,_0xc66665){return db[_0x0db7('0x1d')]['findAll']({'raw':_0xf34681[_0x0db7('0x1e')]?_0xf34681[_0x0db7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xf34681['options']?_0xf34681[_0x0db7('0x1e')]['where']||null:null,'attributes':_0xf34681['options']?_0xf34681[_0x0db7('0x1e')][_0x0db7('0x1f')]||null:null,'limit':_0xf34681[_0x0db7('0x1e')]?_0xf34681[_0x0db7('0x1e')][_0x0db7('0x20')]||null:null,'include':_0xf34681[_0x0db7('0x1e')]?_0xf34681['options']['include']?_[_0x0db7('0x21')](_0xf34681[_0x0db7('0x1e')][_0x0db7('0x22')],function(_0x58ec3d){return{'model':db[_0x58ec3d[_0x0db7('0x23')]],'as':_0x58ec3d['as'],'attributes':_0x58ec3d[_0x0db7('0x1f')],'include':_0x58ec3d['include']?_[_0x0db7('0x21')](_0x58ec3d[_0x0db7('0x22')],function(_0x1efada){return{'model':db[_0x1efada[_0x0db7('0x23')]],'as':_0x1efada['as'],'attributes':_0x1efada[_0x0db7('0x1f')],'include':_0x1efada[_0x0db7('0x22')]?_[_0x0db7('0x21')](_0x1efada['include'],function(_0x2b99b5){return{'model':db[_0x2b99b5[_0x0db7('0x23')]],'as':_0x2b99b5['as'],'attributes':_0x2b99b5[_0x0db7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0db7('0x12')](function(_0x29c7a3){logger[_0x0db7('0x1a')](_0x0db7('0x24'),_0xf34681);logger[_0x0db7('0x25')](_0x0db7('0x24'),_0xf34681,JSON[_0x0db7('0x16')](_0x29c7a3));_0x24b44a(_0x29c7a3);})['catch'](function(_0x1f552d){logger[_0x0db7('0x17')](_0x0db7('0x24'),_0x1f552d[_0x0db7('0x19')],_0xf34681);_0xc66665(_0x560bf5[_0x0db7('0x17')](0x1f4,_0x1f552d[_0x0db7('0x19')]));});});};exports[_0x0db7('0x26')]=function(_0x555e2a){var _0x53a346=this;return new Promise(function(_0x20b59e,_0x410a46){return db['VoiceQueueReport'][_0x0db7('0x27')](_0x555e2a[_0x0db7('0x28')],{'raw':_0x555e2a[_0x0db7('0x1e')]?_0x555e2a[_0x0db7('0x1e')][_0x0db7('0x29')]===undefined?!![]:![]:!![]})[_0x0db7('0x12')](function(_0x25f471){logger['info'](_0x0db7('0x26'),_0x555e2a);logger['debug'](_0x0db7('0x26'),_0x555e2a,JSON[_0x0db7('0x16')](_0x25f471));_0x20b59e(_0x25f471);})[_0x0db7('0x1c')](function(_0x196833){logger[_0x0db7('0x17')](_0x0db7('0x26'),_0x196833[_0x0db7('0x19')],_0x555e2a);_0x410a46(_0x53a346['error'](0x1f4,_0x196833[_0x0db7('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0xff1543){var _0x5a41e4=this;return new Promise(function(_0x594f3d,_0x1cea5c){return db[_0x0db7('0x1d')][_0x0db7('0x2a')](_0xff1543[_0x0db7('0x28')],{'raw':_0xff1543[_0x0db7('0x1e')]?_0xff1543[_0x0db7('0x1e')][_0x0db7('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xff1543[_0x0db7('0x1e')]?_0xff1543[_0x0db7('0x1e')][_0x0db7('0x2b')]||null:null,'attributes':_0xff1543[_0x0db7('0x1e')]?_0xff1543['options'][_0x0db7('0x1f')]||null:null,'limit':_0xff1543[_0x0db7('0x1e')]?_0xff1543['options'][_0x0db7('0x20')]||null:null})[_0x0db7('0x12')](function(_0x51da3c){logger[_0x0db7('0x1a')](_0x0db7('0x2c'),_0xff1543);logger[_0x0db7('0x25')](_0x0db7('0x2c'),_0xff1543,JSON[_0x0db7('0x16')](_0x51da3c));_0x594f3d(_0x51da3c);})[_0x0db7('0x1c')](function(_0x12b035){logger['error'](_0x0db7('0x2c'),_0x12b035[_0x0db7('0x19')],_0xff1543);_0x1cea5c(_0x5a41e4[_0x0db7('0x17')](0x1f4,_0x12b035[_0x0db7('0x19')]));});});}; \ No newline at end of file +var _0x6e98=['where','attributes','limit','include','map','model','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x6e98,0x163));var _0x86e9=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x6e98[_0x3ebb69];return _0x421e59;};'use strict';var _=require(_0x86e9('0x0'));var util=require(_0x86e9('0x1'));var moment=require('moment');var BPromise=require(_0x86e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x86e9('0x4'));var logger=require(_0x86e9('0x5'))(_0x86e9('0x6'));var config=require(_0x86e9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x86e9('0x8')][_0x86e9('0x9')]({'port':0x232a});config[_0x86e9('0xa')]=_[_0x86e9('0xb')](config[_0x86e9('0xa')],{'host':_0x86e9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x86e9('0xd'))[_0x86e9('0xe')](socket);function respondWithRpcPromise(_0x5b1777,_0x3ad394,_0x3af0d9){return new BPromise(function(_0x5275cd,_0x4894bd){return client[_0x86e9('0xf')](_0x5b1777,_0x3af0d9)[_0x86e9('0x10')](function(_0x383498){logger[_0x86e9('0x11')](_0x86e9('0x12'),_0x3ad394,'request\x20sent');logger[_0x86e9('0x13')](_0x86e9('0x14'),_0x3ad394,_0x86e9('0x15'),JSON[_0x86e9('0x16')](_0x383498));if(_0x383498['error']){if(_0x383498[_0x86e9('0x17')][_0x86e9('0x18')]===0x1f4){logger[_0x86e9('0x17')](_0x86e9('0x12'),_0x3ad394,_0x383498[_0x86e9('0x17')][_0x86e9('0x19')]);return _0x4894bd(_0x383498[_0x86e9('0x17')][_0x86e9('0x19')]);}logger[_0x86e9('0x17')](_0x86e9('0x12'),_0x3ad394,_0x383498[_0x86e9('0x17')][_0x86e9('0x19')]);return _0x5275cd(_0x383498['error']['message']);}else{logger[_0x86e9('0x11')](_0x86e9('0x12'),_0x3ad394,_0x86e9('0x15'));_0x5275cd(_0x383498[_0x86e9('0x1a')][_0x86e9('0x19')]);}})['catch'](function(_0x564aa3){logger[_0x86e9('0x17')](_0x86e9('0x12'),_0x3ad394,_0x564aa3);_0x4894bd(_0x564aa3);});});}exports[_0x86e9('0x1b')]=function(_0xd670db){var _0x242a60=this;return new Promise(function(_0x2030d4,_0x289a5e){return db[_0x86e9('0x1c')][_0x86e9('0x1d')]({'raw':_0xd670db[_0x86e9('0x1e')]?_0xd670db[_0x86e9('0x1e')][_0x86e9('0x1f')]===undefined?!![]:![]:!![],'where':_0xd670db[_0x86e9('0x1e')]?_0xd670db['options'][_0x86e9('0x20')]||null:null,'attributes':_0xd670db['options']?_0xd670db[_0x86e9('0x1e')][_0x86e9('0x21')]||null:null,'limit':_0xd670db[_0x86e9('0x1e')]?_0xd670db[_0x86e9('0x1e')][_0x86e9('0x22')]||null:null,'include':_0xd670db[_0x86e9('0x1e')]?_0xd670db[_0x86e9('0x1e')][_0x86e9('0x23')]?_[_0x86e9('0x24')](_0xd670db['options'][_0x86e9('0x23')],function(_0x79d3e){return{'model':db[_0x79d3e[_0x86e9('0x25')]],'as':_0x79d3e['as'],'attributes':_0x79d3e['attributes'],'include':_0x79d3e['include']?_['map'](_0x79d3e['include'],function(_0x1219a2){return{'model':db[_0x1219a2['model']],'as':_0x1219a2['as'],'attributes':_0x1219a2[_0x86e9('0x21')],'include':_0x1219a2[_0x86e9('0x23')]?_[_0x86e9('0x24')](_0x1219a2[_0x86e9('0x23')],function(_0x5e9152){return{'model':db[_0x5e9152[_0x86e9('0x25')]],'as':_0x5e9152['as'],'attributes':_0x5e9152[_0x86e9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x86e9('0x10')](function(_0xfb207f){logger[_0x86e9('0x11')](_0x86e9('0x1b'),_0xd670db);logger['debug'](_0x86e9('0x1b'),_0xd670db,JSON['stringify'](_0xfb207f));_0x2030d4(_0xfb207f);})[_0x86e9('0x26')](function(_0x5372d8){logger[_0x86e9('0x17')](_0x86e9('0x1b'),_0x5372d8[_0x86e9('0x19')],_0xd670db);_0x289a5e(_0x242a60[_0x86e9('0x17')](0x1f4,_0x5372d8['message']));});});};exports[_0x86e9('0x27')]=function(_0x125e72){var _0x4cec3c=this;return new Promise(function(_0x56f7e3,_0x4a05ab){return db[_0x86e9('0x1c')][_0x86e9('0x28')](_0x125e72[_0x86e9('0x29')],{'raw':_0x125e72[_0x86e9('0x1e')]?_0x125e72[_0x86e9('0x1e')][_0x86e9('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x85cb0f){logger[_0x86e9('0x11')]('CreateVoiceQueueReport',_0x125e72);logger['debug'](_0x86e9('0x27'),_0x125e72,JSON['stringify'](_0x85cb0f));_0x56f7e3(_0x85cb0f);})[_0x86e9('0x26')](function(_0x1bc656){logger['error'](_0x86e9('0x27'),_0x1bc656[_0x86e9('0x19')],_0x125e72);_0x4a05ab(_0x4cec3c[_0x86e9('0x17')](0x1f4,_0x1bc656[_0x86e9('0x19')]));});});};exports[_0x86e9('0x2a')]=function(_0x4789c0){var _0x4dd7c1=this;return new Promise(function(_0x290d7e,_0x3918d8){return db[_0x86e9('0x1c')]['update'](_0x4789c0[_0x86e9('0x29')],{'raw':_0x4789c0[_0x86e9('0x1e')]?_0x4789c0[_0x86e9('0x1e')][_0x86e9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4789c0[_0x86e9('0x1e')]?_0x4789c0['options'][_0x86e9('0x20')]||null:null,'attributes':_0x4789c0[_0x86e9('0x1e')]?_0x4789c0[_0x86e9('0x1e')][_0x86e9('0x21')]||null:null,'limit':_0x4789c0[_0x86e9('0x1e')]?_0x4789c0['options'][_0x86e9('0x22')]||null:null})[_0x86e9('0x10')](function(_0x329536){logger['info'](_0x86e9('0x2a'),_0x4789c0);logger[_0x86e9('0x13')](_0x86e9('0x2a'),_0x4789c0,JSON[_0x86e9('0x16')](_0x329536));_0x290d7e(_0x329536);})[_0x86e9('0x26')](function(_0x28e6d2){logger[_0x86e9('0x17')](_0x86e9('0x2a'),_0x28e6d2[_0x86e9('0x19')],_0x4789c0);_0x3918d8(_0x4dd7c1[_0x86e9('0x17')](0x1f4,_0x28e6d2[_0x86e9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index e9cfd2f..fd5c116 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe002=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','removeListener','register'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xe002,0xf7));var _0x2e00=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xe002[_0x274638];return _0x5755df;};'use strict';var VoiceQueueReportEvents=require(_0x2e00('0x0'));var events=[_0x2e00('0x1'),_0x2e00('0x2'),'update'];function createListener(_0xbe48a1,_0x125b19){return function(_0xa53610){_0x125b19['emit'](_0xbe48a1,_0xa53610);};}function removeListener(_0x34f964,_0xba44f2){return function(){VoiceQueueReportEvents[_0x2e00('0x3')](_0x34f964,_0xba44f2);};}exports[_0x2e00('0x4')]=function(_0x3cd8e8){for(var _0x120155=0x0,_0x351729=events[_0x2e00('0x5')];_0x120155<_0x351729;_0x120155++){var _0x52b046=events[_0x120155];var _0x36a23a=createListener(_0x2e00('0x6')+_0x52b046,_0x3cd8e8);VoiceQueueReportEvents['on'](_0x52b046,_0x36a23a);}}; \ No newline at end of file +var _0xc92f=['update','emit','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3c356c,_0xdac291){var _0x238da4=function(_0x1ebdec){while(--_0x1ebdec){_0x3c356c['push'](_0x3c356c['shift']());}};_0x238da4(++_0xdac291);}(_0xc92f,0xf3));var _0xfc92=function(_0x22dca2,_0x2282b2){_0x22dca2=_0x22dca2-0x0;var _0x1ae6a1=_0xc92f[_0x22dca2];return _0x1ae6a1;};'use strict';var VoiceQueueReportEvents=require(_0xfc92('0x0'));var events=[_0xfc92('0x1'),'remove',_0xfc92('0x2')];function createListener(_0x19f2d4,_0x355614){return function(_0x4a76e2){_0x355614[_0xfc92('0x3')](_0x19f2d4,_0x4a76e2);};}function removeListener(_0x21f567,_0x35780b){return function(){VoiceQueueReportEvents['removeListener'](_0x21f567,_0x35780b);};}exports['register']=function(_0x930bab){for(var _0x47abee=0x0,_0x394026=events['length'];_0x47abee<_0x394026;_0x47abee++){var _0xd80968=events[_0x47abee];var _0x49db29=createListener(_0xfc92('0x4')+_0xd80968,_0x930bab);VoiceQueueReportEvents['on'](_0xd80968,_0x49db29);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index c5d6b9a..13c2161 100644 --- a/server/api/voiceQueuesLog/index.js +++ b/server/api/voiceQueuesLog/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cb4=['fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0xb60643,_0x5a28f0){var _0x2375d3=function(_0x5d98a9){while(--_0x5d98a9){_0xb60643['push'](_0xb60643['shift']());}};_0x2375d3(++_0x5a28f0);}(_0x2cb4,0x13e));var _0x42cb=function(_0x1e79b9,_0x223ef3){_0x1e79b9=_0x1e79b9-0x0;var _0x2c2d29=_0x2cb4[_0x1e79b9];return _0x2c2d29;};'use strict';var multer=require(_0x42cb('0x0'));var util=require(_0x42cb('0x1'));var path=require(_0x42cb('0x2'));var timeout=require(_0x42cb('0x3'));var express=require(_0x42cb('0x4'));var router=express[_0x42cb('0x5')]();var fs_extra=require(_0x42cb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x42cb('0x7'));var config=require(_0x42cb('0x8'));var controller=require(_0x42cb('0x9'));router[_0x42cb('0xa')]('/',auth[_0x42cb('0xb')](),controller['index']);router[_0x42cb('0xa')](_0x42cb('0xc'),auth[_0x42cb('0xb')](),controller[_0x42cb('0xd')]);router['post']('/',auth[_0x42cb('0xb')](),controller[_0x42cb('0xe')]);router[_0x42cb('0xf')](_0x42cb('0xc'),auth[_0x42cb('0xb')](),controller[_0x42cb('0x10')]);router[_0x42cb('0x11')](_0x42cb('0xc'),auth[_0x42cb('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x41d2=['isAuthenticated','index','/:id','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x13aec6,_0x3d5bff){var _0x2b4915=function(_0x40b53a){while(--_0x40b53a){_0x13aec6['push'](_0x13aec6['shift']());}};_0x2b4915(++_0x3d5bff);}(_0x41d2,0x138));var _0x241d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x41d2[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x241d('0x0'));var util=require(_0x241d('0x1'));var path=require(_0x241d('0x2'));var timeout=require(_0x241d('0x3'));var express=require(_0x241d('0x4'));var router=express[_0x241d('0x5')]();var fs_extra=require(_0x241d('0x6'));var auth=require(_0x241d('0x7'));var interaction=require(_0x241d('0x8'));var config=require(_0x241d('0x9'));var controller=require('./voiceQueuesLog.controller');router[_0x241d('0xa')]('/',auth[_0x241d('0xb')](),controller[_0x241d('0xc')]);router['get'](_0x241d('0xd'),auth[_0x241d('0xb')](),controller['show']);router[_0x241d('0xe')]('/',auth[_0x241d('0xb')](),controller[_0x241d('0xf')]);router['put'](_0x241d('0xd'),auth[_0x241d('0xb')](),controller[_0x241d('0x10')]);router[_0x241d('0x11')](_0x241d('0xd'),auth[_0x241d('0xb')](),controller['destroy']);module[_0x241d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 41fcd2e..e216a1c 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x354e=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING'];(function(_0x97ee8a,_0x4d01a2){var _0x323ae3=function(_0x34cc36){while(--_0x34cc36){_0x97ee8a['push'](_0x97ee8a['shift']());}};_0x323ae3(++_0x4d01a2);}(_0x354e,0x179));var _0xe354=function(_0x11571d,_0x48a03e){_0x11571d=_0x11571d-0x0;var _0x388836=_0x354e[_0x11571d];return _0x388836;};'use strict';var Sequelize=require(_0xe354('0x0'));var moment=require('moment');module[_0xe354('0x1')]={'time':{'type':Sequelize[_0xe354('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe354('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe354('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xe354('0x4'))}}; \ No newline at end of file +var _0x33d6=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x5bf18d,_0x264c55){var _0x1d6cc0=function(_0x2d69d9){while(--_0x2d69d9){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x1d6cc0(++_0x264c55);}(_0x33d6,0xad));var _0x633d=function(_0x2cffaf,_0x1d18f2){_0x2cffaf=_0x2cffaf-0x0;var _0x26d6be=_0x33d6[_0x2cffaf];return _0x26d6be;};'use strict';var Sequelize=require(_0x633d('0x0'));var moment=require(_0x633d('0x1'));module[_0x633d('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x633d('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x633d('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x633d('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 075271e..b85fafa 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddcd=['stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','includeAll','include','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','apply','save','update','destroy','then','error'];(function(_0x5684cf,_0x53fe7c){var _0x2de09d=function(_0x465c7b){while(--_0x465c7b){_0x5684cf['push'](_0x5684cf['shift']());}};_0x2de09d(++_0x53fe7c);}(_0xddcd,0x102));var _0xdddc=function(_0x4beb49,_0xc2942f){_0x4beb49=_0x4beb49-0x0;var _0x604b33=_0xddcd[_0x4beb49];return _0x604b33;};'use strict';var emlformat=require(_0xdddc('0x0'));var rimraf=require(_0xdddc('0x1'));var zipdir=require(_0xdddc('0x2'));var jsonpatch=require(_0xdddc('0x3'));var rp=require(_0xdddc('0x4'));var moment=require(_0xdddc('0x5'));var BPromise=require(_0xdddc('0x6'));var Mustache=require(_0xdddc('0x7'));var util=require('util');var path=require(_0xdddc('0x8'));var sox=require(_0xdddc('0x9'));var csv=require('to-csv');var ejs=require(_0xdddc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdddc('0xb'));var squel=require(_0xdddc('0xc'));var crypto=require(_0xdddc('0xd'));var jsforce=require(_0xdddc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdddc('0xf'));var querystring=require(_0xdddc('0x10'));var Papa=require(_0xdddc('0x11'));var Redis=require(_0xdddc('0x12'));var authService=require(_0xdddc('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdddc('0x14'))(_0xdddc('0x15'));var utils=require(_0xdddc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdddc('0x17'));var db=require(_0xdddc('0x18'))['db'];function respondWithStatusCode(_0x36493c,_0xef4966){_0xef4966=_0xef4966||0xcc;return function(_0x5ad01e){if(_0x5ad01e){return _0x36493c[_0xdddc('0x19')](_0xef4966);}return _0x36493c['status'](_0xef4966)[_0xdddc('0x1a')]();};}function respondWithResult(_0x330709,_0x5897aa){_0x5897aa=_0x5897aa||0xc8;return function(_0xb3d659){if(_0xb3d659){return _0x330709[_0xdddc('0x1b')](_0x5897aa)[_0xdddc('0x1c')](_0xb3d659);}};}function respondWithFilteredResult(_0x233e62,_0x7208c){return function(_0x30c90f){if(_0x30c90f){var _0x3b910b=typeof _0x7208c[_0xdddc('0x1d')]===_0xdddc('0x1e')&&typeof _0x7208c[_0xdddc('0x1f')]==='undefined';var _0x31c1c2=_0x30c90f['count'];var _0x4f238d=_0x3b910b?0x0:_0x7208c[_0xdddc('0x1d')];var _0x2e596e=_0x3b910b?_0x30c90f['count']:_0x7208c[_0xdddc('0x1d')]+_0x7208c[_0xdddc('0x1f')];var _0x7beec;if(_0x2e596e>=_0x31c1c2){_0x2e596e=_0x31c1c2;_0x7beec=0xc8;}else{_0x7beec=0xce;}_0x233e62[_0xdddc('0x1b')](_0x7beec);return _0x233e62['set']('Content-Range',_0x4f238d+'-'+_0x2e596e+'/'+_0x31c1c2)[_0xdddc('0x1c')](_0x30c90f);}return null;};}function patchUpdates(_0x298e09){return function(_0x2c12b6){try{jsonpatch[_0xdddc('0x20')](_0x2c12b6,_0x298e09,!![]);}catch(_0x4ea69e){return BPromise['reject'](_0x4ea69e);}return _0x2c12b6[_0xdddc('0x21')]();};}function saveUpdates(_0x4b3d7a,_0x3b9f73){return function(_0x146886){if(_0x146886){return _0x146886[_0xdddc('0x22')](_0x4b3d7a)['then'](function(_0x20a3a0){return _0x20a3a0;});}return null;};}function removeEntity(_0x18094e,_0x46e2d4){return function(_0x22a4c9){if(_0x22a4c9){return _0x22a4c9[_0xdddc('0x23')]()[_0xdddc('0x24')](function(){_0x18094e[_0xdddc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x265c6d,_0x5f257c){return function(_0x4843de){if(!_0x4843de){_0x265c6d[_0xdddc('0x19')](0x194);}return _0x4843de;};}function handleError(_0x1ff5a2,_0xb4ed87){_0xb4ed87=_0xb4ed87||0x1f4;return function(_0x33c63b){logger[_0xdddc('0x25')](_0x33c63b[_0xdddc('0x26')]);if(_0x33c63b[_0xdddc('0x27')]){delete _0x33c63b[_0xdddc('0x27')];}_0x1ff5a2[_0xdddc('0x1b')](_0xb4ed87)[_0xdddc('0x28')](_0x33c63b);};}exports[_0xdddc('0x29')]=function(_0x1ddfc9,_0x247f2d){var _0x22e3dc={},_0x42bdbd={},_0x41f61e={'count':0x0,'rows':[]};var _0x519f94=_[_0xdddc('0x2a')](db[_0xdddc('0x2b')][_0xdddc('0x2c')],function(_0xdc12ba){return{'name':_0xdc12ba[_0xdddc('0x2d')],'type':_0xdc12ba[_0xdddc('0x2e')]['key']};});_0x42bdbd[_0xdddc('0x2f')]=_[_0xdddc('0x2a')](_0x519f94,'name');_0x42bdbd[_0xdddc('0x30')]=_[_0xdddc('0x31')](_0x1ddfc9[_0xdddc('0x30')]);_0x42bdbd['filters']=_['intersection'](_0x42bdbd['model'],_0x42bdbd[_0xdddc('0x30')]);_0x22e3dc[_0xdddc('0x32')]=_[_0xdddc('0x33')](_0x42bdbd[_0xdddc('0x2f')],qs[_0xdddc('0x34')](_0x1ddfc9[_0xdddc('0x30')][_0xdddc('0x34')]));_0x22e3dc[_0xdddc('0x32')]=_0x22e3dc[_0xdddc('0x32')][_0xdddc('0x35')]?_0x22e3dc['attributes']:_0x42bdbd['model'];if(!_0x1ddfc9['query']['hasOwnProperty'](_0xdddc('0x36'))){_0x22e3dc[_0xdddc('0x1f')]=qs['limit'](_0x1ddfc9[_0xdddc('0x30')][_0xdddc('0x1f')]);_0x22e3dc[_0xdddc('0x1d')]=qs[_0xdddc('0x1d')](_0x1ddfc9[_0xdddc('0x30')][_0xdddc('0x1d')]);}_0x22e3dc[_0xdddc('0x37')]=qs['sort'](_0x1ddfc9[_0xdddc('0x30')][_0xdddc('0x38')]);_0x22e3dc[_0xdddc('0x39')]=qs[_0xdddc('0x3a')](_[_0xdddc('0x3b')](_0x1ddfc9[_0xdddc('0x30')],_0x42bdbd[_0xdddc('0x3a')]),_0x519f94);if(_0x1ddfc9[_0xdddc('0x30')]['filter']){_0x22e3dc[_0xdddc('0x39')]=_['merge'](_0x22e3dc[_0xdddc('0x39')],{'$or':_[_0xdddc('0x2a')](_0x519f94,function(_0x432757){if(_0x432757[_0xdddc('0x2e')]!==_0xdddc('0x3c')){var _0x598a92={};_0x598a92[_0x432757['name']]={'$like':'%'+_0x1ddfc9[_0xdddc('0x30')][_0xdddc('0x3d')]+'%'};return _0x598a92;}})});}_0x22e3dc=_[_0xdddc('0x3e')]({},_0x22e3dc,_0x1ddfc9[_0xdddc('0x3f')]);var _0x4c2c72={'where':_0x22e3dc[_0xdddc('0x39')]};return db[_0xdddc('0x2b')][_0xdddc('0x40')](_0x4c2c72)[_0xdddc('0x24')](function(_0x5d53e0){_0x41f61e[_0xdddc('0x40')]=_0x5d53e0;if(_0x1ddfc9[_0xdddc('0x30')][_0xdddc('0x41')]){_0x22e3dc[_0xdddc('0x42')]=[{'all':!![]}];}return db[_0xdddc('0x2b')]['findAll'](_0x22e3dc);})[_0xdddc('0x24')](function(_0x4ab1d5){_0x41f61e[_0xdddc('0x43')]=_0x4ab1d5;return _0x41f61e;})[_0xdddc('0x24')](respondWithFilteredResult(_0x247f2d,_0x22e3dc))[_0xdddc('0x44')](handleError(_0x247f2d,null));};exports[_0xdddc('0x45')]=function(_0xf70b8b,_0x5f21ef){var _0x33fb50={'raw':!![],'where':{'id':_0xf70b8b[_0xdddc('0x46')]['id']}},_0x2d803b={};_0x2d803b['model']=_[_0xdddc('0x31')](db[_0xdddc('0x2b')]['rawAttributes']);_0x2d803b[_0xdddc('0x30')]=_[_0xdddc('0x31')](_0xf70b8b['query']);_0x2d803b[_0xdddc('0x3a')]=_[_0xdddc('0x33')](_0x2d803b[_0xdddc('0x2f')],_0x2d803b['query']);_0x33fb50[_0xdddc('0x32')]=_['intersection'](_0x2d803b['model'],qs[_0xdddc('0x34')](_0xf70b8b[_0xdddc('0x30')][_0xdddc('0x34')]));_0x33fb50[_0xdddc('0x32')]=_0x33fb50['attributes']['length']?_0x33fb50['attributes']:_0x2d803b[_0xdddc('0x2f')];if(_0xf70b8b[_0xdddc('0x30')][_0xdddc('0x41')]){_0x33fb50[_0xdddc('0x42')]=[{'all':!![]}];}_0x33fb50=_[_0xdddc('0x3e')]({},_0x33fb50,_0xf70b8b['options']);return db[_0xdddc('0x2b')]['find'](_0x33fb50)[_0xdddc('0x24')](handleEntityNotFound(_0x5f21ef,null))[_0xdddc('0x24')](respondWithResult(_0x5f21ef,null))[_0xdddc('0x44')](handleError(_0x5f21ef,null));};exports[_0xdddc('0x47')]=function(_0x3bad41,_0x16c947){return db['VoiceQueuesLog']['create'](_0x3bad41[_0xdddc('0x48')],{})[_0xdddc('0x24')](respondWithResult(_0x16c947,0xc9))[_0xdddc('0x44')](handleError(_0x16c947,null));};exports[_0xdddc('0x22')]=function(_0x3f15f3,_0x3d07ac){if(_0x3f15f3[_0xdddc('0x48')]['id']){delete _0x3f15f3[_0xdddc('0x48')]['id'];}return db['VoiceQueuesLog'][_0xdddc('0x49')]({'where':{'id':_0x3f15f3[_0xdddc('0x46')]['id']}})[_0xdddc('0x24')](handleEntityNotFound(_0x3d07ac,null))[_0xdddc('0x24')](saveUpdates(_0x3f15f3[_0xdddc('0x48')],null))[_0xdddc('0x24')](respondWithResult(_0x3d07ac,null))['catch'](handleError(_0x3d07ac,null));};exports['destroy']=function(_0x2d3fa0,_0x155da9){return db['VoiceQueuesLog']['find']({'where':{'id':_0x2d3fa0[_0xdddc('0x46')]['id']}})['then'](handleEntityNotFound(_0x155da9,null))[_0xdddc('0x24')](removeEntity(_0x155da9,null))['catch'](handleError(_0x155da9,null));}; \ No newline at end of file +var _0xb197=['error','stack','name','send','map','VoiceQueuesLog','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','catch','show','params','options','find','body','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','destroy'];(function(_0x1ab554,_0x3f744a){var _0x166eea=function(_0x538f49){while(--_0x538f49){_0x1ab554['push'](_0x1ab554['shift']());}};_0x166eea(++_0x3f744a);}(_0xb197,0x13a));var _0x7b19=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0xb197[_0x337a10];return _0x575f98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b19('0x0'));var zipdir=require(_0x7b19('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b19('0x2'));var moment=require(_0x7b19('0x3'));var BPromise=require(_0x7b19('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7b19('0x5'));var sox=require(_0x7b19('0x6'));var csv=require(_0x7b19('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b19('0x8'));var squel=require(_0x7b19('0x9'));var crypto=require(_0x7b19('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7b19('0xb'));var toCsv=require(_0x7b19('0x7'));var querystring=require(_0x7b19('0xc'));var Papa=require(_0x7b19('0xd'));var Redis=require('ioredis');var authService=require(_0x7b19('0xe'));var qs=require(_0x7b19('0xf'));var as=require(_0x7b19('0x10'));var hardwareService=require(_0x7b19('0x11'));var logger=require('../../config/logger')(_0x7b19('0x12'));var utils=require(_0x7b19('0x13'));var config=require(_0x7b19('0x14'));var licenseUtil=require(_0x7b19('0x15'));var db=require(_0x7b19('0x16'))['db'];function respondWithStatusCode(_0x1838d6,_0x83ba00){_0x83ba00=_0x83ba00||0xcc;return function(_0xb43320){if(_0xb43320){return _0x1838d6[_0x7b19('0x17')](_0x83ba00);}return _0x1838d6[_0x7b19('0x18')](_0x83ba00)[_0x7b19('0x19')]();};}function respondWithResult(_0x412b5a,_0x4578de){_0x4578de=_0x4578de||0xc8;return function(_0x5541e3){if(_0x5541e3){return _0x412b5a[_0x7b19('0x18')](_0x4578de)[_0x7b19('0x1a')](_0x5541e3);}};}function respondWithFilteredResult(_0x284637,_0xe97041){return function(_0x3f5745){if(_0x3f5745){var _0x5b84c8=typeof _0xe97041[_0x7b19('0x1b')]==='undefined'&&typeof _0xe97041[_0x7b19('0x1c')]===_0x7b19('0x1d');var _0x3cd948=_0x3f5745['count'];var _0x20d6ee=_0x5b84c8?0x0:_0xe97041[_0x7b19('0x1b')];var _0x30f1e0=_0x5b84c8?_0x3f5745[_0x7b19('0x1e')]:_0xe97041[_0x7b19('0x1b')]+_0xe97041[_0x7b19('0x1c')];var _0x2f7737;if(_0x30f1e0>=_0x3cd948){_0x30f1e0=_0x3cd948;_0x2f7737=0xc8;}else{_0x2f7737=0xce;}_0x284637[_0x7b19('0x18')](_0x2f7737);return _0x284637[_0x7b19('0x1f')]('Content-Range',_0x20d6ee+'-'+_0x30f1e0+'/'+_0x3cd948)[_0x7b19('0x1a')](_0x3f5745);}return null;};}function patchUpdates(_0x52a275){return function(_0x11d7c0){try{jsonpatch[_0x7b19('0x20')](_0x11d7c0,_0x52a275,!![]);}catch(_0xd02c0d){return BPromise['reject'](_0xd02c0d);}return _0x11d7c0[_0x7b19('0x21')]();};}function saveUpdates(_0x54b5ae,_0x4e5801){return function(_0x3b5590){if(_0x3b5590){return _0x3b5590[_0x7b19('0x22')](_0x54b5ae)['then'](function(_0x2fc64c){return _0x2fc64c;});}return null;};}function removeEntity(_0x71559a,_0x60f320){return function(_0x414c88){if(_0x414c88){return _0x414c88[_0x7b19('0x23')]()['then'](function(){_0x71559a[_0x7b19('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2120b6,_0x20acdc){return function(_0x3a9c03){if(!_0x3a9c03){_0x2120b6[_0x7b19('0x17')](0x194);}return _0x3a9c03;};}function handleError(_0xbe0f92,_0x2facb1){_0x2facb1=_0x2facb1||0x1f4;return function(_0x57b039){logger[_0x7b19('0x24')](_0x57b039[_0x7b19('0x25')]);if(_0x57b039[_0x7b19('0x26')]){delete _0x57b039[_0x7b19('0x26')];}_0xbe0f92[_0x7b19('0x18')](_0x2facb1)[_0x7b19('0x27')](_0x57b039);};}exports['index']=function(_0x12f1a6,_0x5e0d8e){var _0x55412a={},_0x14c7da={},_0x579339={'count':0x0,'rows':[]};var _0x3c8c11=_[_0x7b19('0x28')](db[_0x7b19('0x29')][_0x7b19('0x2a')],function(_0x5db7eb){return{'name':_0x5db7eb['fieldName'],'type':_0x5db7eb[_0x7b19('0x2b')]['key']};});_0x14c7da['model']=_['map'](_0x3c8c11,'name');_0x14c7da[_0x7b19('0x2c')]=_[_0x7b19('0x2d')](_0x12f1a6[_0x7b19('0x2c')]);_0x14c7da[_0x7b19('0x2e')]=_[_0x7b19('0x2f')](_0x14c7da['model'],_0x14c7da[_0x7b19('0x2c')]);_0x55412a[_0x7b19('0x30')]=_[_0x7b19('0x2f')](_0x14c7da[_0x7b19('0x31')],qs[_0x7b19('0x32')](_0x12f1a6[_0x7b19('0x2c')][_0x7b19('0x32')]));_0x55412a[_0x7b19('0x30')]=_0x55412a[_0x7b19('0x30')][_0x7b19('0x33')]?_0x55412a['attributes']:_0x14c7da[_0x7b19('0x31')];if(!_0x12f1a6[_0x7b19('0x2c')][_0x7b19('0x34')](_0x7b19('0x35'))){_0x55412a[_0x7b19('0x1c')]=qs['limit'](_0x12f1a6[_0x7b19('0x2c')]['limit']);_0x55412a[_0x7b19('0x1b')]=qs[_0x7b19('0x1b')](_0x12f1a6['query']['offset']);}_0x55412a['order']=qs['sort'](_0x12f1a6[_0x7b19('0x2c')][_0x7b19('0x36')]);_0x55412a[_0x7b19('0x37')]=qs[_0x7b19('0x2e')](_[_0x7b19('0x38')](_0x12f1a6[_0x7b19('0x2c')],_0x14c7da['filters']),_0x3c8c11);if(_0x12f1a6[_0x7b19('0x2c')][_0x7b19('0x39')]){_0x55412a[_0x7b19('0x37')]=_[_0x7b19('0x3a')](_0x55412a[_0x7b19('0x37')],{'$or':_[_0x7b19('0x28')](_0x3c8c11,function(_0x2542c4){if(_0x2542c4['type']!==_0x7b19('0x3b')){var _0x355060={};_0x355060[_0x2542c4[_0x7b19('0x26')]]={'$like':'%'+_0x12f1a6[_0x7b19('0x2c')][_0x7b19('0x39')]+'%'};return _0x355060;}})});}_0x55412a=_[_0x7b19('0x3a')]({},_0x55412a,_0x12f1a6['options']);var _0x531ee9={'where':_0x55412a[_0x7b19('0x37')]};return db[_0x7b19('0x29')][_0x7b19('0x1e')](_0x531ee9)[_0x7b19('0x3c')](function(_0x2ea39c){_0x579339['count']=_0x2ea39c;if(_0x12f1a6[_0x7b19('0x2c')][_0x7b19('0x3d')]){_0x55412a[_0x7b19('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x7b19('0x3f')](_0x55412a);})[_0x7b19('0x3c')](function(_0x184345){_0x579339['rows']=_0x184345;return _0x579339;})[_0x7b19('0x3c')](respondWithFilteredResult(_0x5e0d8e,_0x55412a))[_0x7b19('0x40')](handleError(_0x5e0d8e,null));};exports[_0x7b19('0x41')]=function(_0x44a810,_0x4158ec){var _0x488a93={'raw':!![],'where':{'id':_0x44a810[_0x7b19('0x42')]['id']}},_0x155e90={};_0x155e90[_0x7b19('0x31')]=_[_0x7b19('0x2d')](db['VoiceQueuesLog'][_0x7b19('0x2a')]);_0x155e90[_0x7b19('0x2c')]=_[_0x7b19('0x2d')](_0x44a810[_0x7b19('0x2c')]);_0x155e90[_0x7b19('0x2e')]=_[_0x7b19('0x2f')](_0x155e90[_0x7b19('0x31')],_0x155e90[_0x7b19('0x2c')]);_0x488a93['attributes']=_[_0x7b19('0x2f')](_0x155e90[_0x7b19('0x31')],qs['fields'](_0x44a810[_0x7b19('0x2c')]['fields']));_0x488a93[_0x7b19('0x30')]=_0x488a93['attributes'][_0x7b19('0x33')]?_0x488a93[_0x7b19('0x30')]:_0x155e90[_0x7b19('0x31')];if(_0x44a810[_0x7b19('0x2c')]['includeAll']){_0x488a93[_0x7b19('0x3e')]=[{'all':!![]}];}_0x488a93=_[_0x7b19('0x3a')]({},_0x488a93,_0x44a810[_0x7b19('0x43')]);return db[_0x7b19('0x29')][_0x7b19('0x44')](_0x488a93)['then'](handleEntityNotFound(_0x4158ec,null))[_0x7b19('0x3c')](respondWithResult(_0x4158ec,null))[_0x7b19('0x40')](handleError(_0x4158ec,null));};exports['create']=function(_0x479885,_0x1c1b0a){return db[_0x7b19('0x29')]['create'](_0x479885[_0x7b19('0x45')],{})[_0x7b19('0x3c')](respondWithResult(_0x1c1b0a,0xc9))[_0x7b19('0x40')](handleError(_0x1c1b0a,null));};exports[_0x7b19('0x22')]=function(_0x59fa6c,_0x404355){if(_0x59fa6c[_0x7b19('0x45')]['id']){delete _0x59fa6c['body']['id'];}return db[_0x7b19('0x29')][_0x7b19('0x44')]({'where':{'id':_0x59fa6c['params']['id']}})[_0x7b19('0x3c')](handleEntityNotFound(_0x404355,null))[_0x7b19('0x3c')](saveUpdates(_0x59fa6c[_0x7b19('0x45')],null))[_0x7b19('0x3c')](respondWithResult(_0x404355,null))[_0x7b19('0x40')](handleError(_0x404355,null));};exports[_0x7b19('0x23')]=function(_0x5f44fe,_0x4a45b3){return db[_0x7b19('0x29')][_0x7b19('0x44')]({'where':{'id':_0x5f44fe[_0x7b19('0x42')]['id']}})[_0x7b19('0x3c')](handleEntityNotFound(_0x4a45b3,null))['then'](removeEntity(_0x4a45b3,null))[_0x7b19('0x40')](handleError(_0x4a45b3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b9c63ff..77184f8 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x195d=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0x4de7fe,_0x4181fa){var _0x3d80be=function(_0x2d4a74){while(--_0x2d4a74){_0x4de7fe['push'](_0x4de7fe['shift']());}};_0x3d80be(++_0x4181fa);}(_0x195d,0x100));var _0xd195=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x195d[_0x14d896];return _0x28679a;};'use strict';var _=require(_0xd195('0x0'));var util=require(_0xd195('0x1'));var logger=require('../../config/logger')(_0xd195('0x2'));var moment=require(_0xd195('0x3'));var BPromise=require(_0xd195('0x4'));var rp=require(_0xd195('0x5'));var fs=require('fs');var path=require(_0xd195('0x6'));var rimraf=require(_0xd195('0x7'));var config=require(_0xd195('0x8'));var attributes=require(_0xd195('0x9'));module['exports']=function(_0x289270,_0x437b8d){return _0x289270[_0xd195('0xa')](_0xd195('0xb'),attributes,{'tableName':_0xd195('0xc'),'paranoid':![],'indexes':[{'name':_0xd195('0xd'),'fields':[_0xd195('0xe'),_0xd195('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3fb2=['dtm','util','../../config/logger','moment','bluebird','path','rimraf','./voiceQueuesLog.attributes','exports','define','event'];(function(_0x5843c1,_0x372d51){var _0x56fbcd=function(_0x4dfc2a){while(--_0x4dfc2a){_0x5843c1['push'](_0x5843c1['shift']());}};_0x56fbcd(++_0x372d51);}(_0x3fb2,0x12a));var _0x23fb=function(_0x5ba2ad,_0x425d52){_0x5ba2ad=_0x5ba2ad-0x0;var _0x2de721=_0x3fb2[_0x5ba2ad];return _0x2de721;};'use strict';var _=require('lodash');var util=require(_0x23fb('0x0'));var logger=require(_0x23fb('0x1'))('api');var moment=require(_0x23fb('0x2'));var BPromise=require(_0x23fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23fb('0x4'));var rimraf=require(_0x23fb('0x5'));var config=require('../../config/environment');var attributes=require(_0x23fb('0x6'));module[_0x23fb('0x7')]=function(_0x2cd7fc,_0x5e516c){return _0x2cd7fc[_0x23fb('0x8')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x23fb('0x9'),_0x23fb('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0b6b623..a423cb8 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe27e=['rpc','jayson/promise','client','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x61311d,_0x11de37){var _0x287e67=function(_0x7e7fc5){while(--_0x7e7fc5){_0x61311d['push'](_0x61311d['shift']());}};_0x287e67(++_0x11de37);}(_0xe27e,0xa8));var _0xee27=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0xe27e[_0xc5a279];return _0xc755d3;};'use strict';var _=require(_0xee27('0x0'));var util=require('util');var moment=require(_0xee27('0x1'));var BPromise=require(_0xee27('0x2'));var rs=require(_0xee27('0x3'));var fs=require('fs');var Redis=require(_0xee27('0x4'));var db=require(_0xee27('0x5'))['db'];var utils=require(_0xee27('0x6'));var logger=require(_0xee27('0x7'))(_0xee27('0x8'));var config=require('../../config/environment');var jayson=require(_0xee27('0x9'));var client=jayson[_0xee27('0xa')][_0xee27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x199a2e,_0x4d16d6,_0x4df68b){return new BPromise(function(_0x5b97db,_0x472274){return client['request'](_0x199a2e,_0x4df68b)['then'](function(_0x4f0174){logger[_0xee27('0xc')](_0xee27('0xd'),_0x4d16d6,_0xee27('0xe'));logger[_0xee27('0xf')](_0xee27('0x10'),_0x4d16d6,_0xee27('0xe'),JSON['stringify'](_0x4f0174));if(_0x4f0174[_0xee27('0x11')]){if(_0x4f0174['error'][_0xee27('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4d16d6,_0x4f0174[_0xee27('0x11')][_0xee27('0x13')]);return _0x472274(_0x4f0174[_0xee27('0x11')][_0xee27('0x13')]);}logger[_0xee27('0x11')](_0xee27('0xd'),_0x4d16d6,_0x4f0174[_0xee27('0x11')]['message']);return _0x5b97db(_0x4f0174[_0xee27('0x11')][_0xee27('0x13')]);}else{logger[_0xee27('0xc')](_0xee27('0xd'),_0x4d16d6,_0xee27('0xe'));_0x5b97db(_0x4f0174[_0xee27('0x14')][_0xee27('0x13')]);}})[_0xee27('0x15')](function(_0x218725){logger[_0xee27('0x11')](_0xee27('0xd'),_0x4d16d6,_0x218725);_0x472274(_0x218725);});});} \ No newline at end of file +var _0xbdeb=['stringify','error','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0xbdeb,0x6f));var _0xbbde=function(_0x272282,_0x2e94a0){_0x272282=_0x272282-0x0;var _0xedf511=_0xbdeb[_0x272282];return _0xedf511;};'use strict';var _=require('lodash');var util=require(_0xbbde('0x0'));var moment=require('moment');var BPromise=require(_0xbbde('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbde('0x2'));var db=require(_0xbbde('0x3'))['db'];var utils=require(_0xbbde('0x4'));var logger=require(_0xbbde('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbbde('0x6'));var client=jayson[_0xbbde('0x7')][_0xbbde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a8482,_0x5e6273,_0x49966c){return new BPromise(function(_0x3215c9,_0x17df59){return client['request'](_0x1a8482,_0x49966c)[_0xbbde('0x9')](function(_0xec50fa){logger[_0xbbde('0xa')](_0xbbde('0xb'),_0x5e6273,_0xbbde('0xc'));logger[_0xbbde('0xd')](_0xbbde('0xe'),_0x5e6273,_0xbbde('0xc'),JSON[_0xbbde('0xf')](_0xec50fa));if(_0xec50fa[_0xbbde('0x10')]){if(_0xec50fa['error']['code']===0x1f4){logger[_0xbbde('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5e6273,_0xec50fa[_0xbbde('0x10')]['message']);return _0x17df59(_0xec50fa[_0xbbde('0x10')][_0xbbde('0x11')]);}logger[_0xbbde('0x10')](_0xbbde('0xb'),_0x5e6273,_0xec50fa[_0xbbde('0x10')][_0xbbde('0x11')]);return _0x3215c9(_0xec50fa[_0xbbde('0x10')]['message']);}else{logger[_0xbbde('0xa')](_0xbbde('0xb'),_0x5e6273,'request\x20sent');_0x3215c9(_0xec50fa['result'][_0xbbde('0x11')]);}})['catch'](function(_0x88e8a5){logger['error'](_0xbbde('0xb'),_0x5e6273,_0x88e8a5);_0x17df59(_0x88e8a5);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e0047e6..99590c9 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe079=['/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','runTranscribe','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','get','/:id'];(function(_0x3492e0,_0x8bf36f){var _0x4b2285=function(_0x4e892b){while(--_0x4e892b){_0x3492e0['push'](_0x3492e0['shift']());}};_0x4b2285(++_0x8bf36f);}(_0xe079,0x6b));var _0x9e07=function(_0x53d532,_0x5aaabb){_0x53d532=_0x53d532-0x0;var _0x479325=_0xe079[_0x53d532];return _0x479325;};'use strict';var multer=require('multer');var util=require(_0x9e07('0x0'));var path=require('path');var timeout=require(_0x9e07('0x1'));var express=require(_0x9e07('0x2'));var router=express[_0x9e07('0x3')]();var fs_extra=require(_0x9e07('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9e07('0x5'));var config=require(_0x9e07('0x6'));var controller=require(_0x9e07('0x7'));router['get']('/',auth[_0x9e07('0x8')](),controller[_0x9e07('0x9')]);router['get'](_0x9e07('0xa'),auth[_0x9e07('0x8')](),controller['describe']);router[_0x9e07('0xb')](_0x9e07('0xc'),auth[_0x9e07('0x8')](),controller['show']);router[_0x9e07('0xb')](_0x9e07('0xd'),auth[_0x9e07('0x8')](),controller[_0x9e07('0xe')]);router[_0x9e07('0xb')](_0x9e07('0xf'),controller[_0x9e07('0x10')]);router[_0x9e07('0xb')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x9e07('0x11')]);router[_0x9e07('0x12')]('/',auth['isAuthenticated'](),controller[_0x9e07('0x13')]);router[_0x9e07('0x12')]('/:id/transcribe',auth[_0x9e07('0x8')](),controller[_0x9e07('0x14')]);router[_0x9e07('0x15')](_0x9e07('0xc'),auth['isAuthenticated'](),controller[_0x9e07('0x16')]);router['delete']('/:id',auth[_0x9e07('0x8')](),controller['destroy']);module[_0x9e07('0x17')]=router; \ No newline at end of file +var _0x43df=['get','/describe','describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0xc6b6a5,_0x2ccb2e){var _0x55d8fc=function(_0x51c3e7){while(--_0x51c3e7){_0xc6b6a5['push'](_0xc6b6a5['shift']());}};_0x55d8fc(++_0x2ccb2e);}(_0x43df,0x1e3));var _0xf43d=function(_0x34d88d,_0x4e2e6a){_0x34d88d=_0x34d88d-0x0;var _0x2df296=_0x43df[_0x34d88d];return _0x2df296;};'use strict';var multer=require(_0xf43d('0x0'));var util=require(_0xf43d('0x1'));var path=require('path');var timeout=require(_0xf43d('0x2'));var express=require(_0xf43d('0x3'));var router=express['Router']();var fs_extra=require(_0xf43d('0x4'));var auth=require(_0xf43d('0x5'));var interaction=require(_0xf43d('0x6'));var config=require(_0xf43d('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0xf43d('0x8')](),controller[_0xf43d('0x9')]);router[_0xf43d('0xa')](_0xf43d('0xb'),auth['isAuthenticated'](),controller[_0xf43d('0xc')]);router['get']('/:id',auth[_0xf43d('0x8')](),controller[_0xf43d('0xd')]);router[_0xf43d('0xa')](_0xf43d('0xe'),auth[_0xf43d('0x8')](),controller[_0xf43d('0xf')]);router[_0xf43d('0xa')](_0xf43d('0x10'),controller[_0xf43d('0x11')]);router[_0xf43d('0xa')](_0xf43d('0x12'),auth[_0xf43d('0x8')](),controller[_0xf43d('0x13')]);router[_0xf43d('0x14')]('/',auth[_0xf43d('0x8')](),controller[_0xf43d('0x15')]);router[_0xf43d('0x14')](_0xf43d('0x12'),auth[_0xf43d('0x8')](),controller[_0xf43d('0x16')]);router[_0xf43d('0x17')](_0xf43d('0x18'),auth[_0xf43d('0x8')](),controller[_0xf43d('0x19')]);router[_0xf43d('0x1a')](_0xf43d('0x18'),auth[_0xf43d('0x8')](),controller[_0xf43d('0x1b')]);module[_0xf43d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index dcaae25..5df0a89 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 930c4ef..a661710 100644 --- a/server/api/voiceRecording/voiceRecording.controller.js +++ b/server/api/voiceRecording/voiceRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28b8=['.cypher','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','bucket','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','VoiceRecording','type','key','model','format','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','length','create','body','find','describe','download','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','$and','push','decryptFile','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28b8,0xbe));var _0x828b=function(_0x52339f,_0x1eb1b8){_0x52339f=_0x52339f-0x0;var _0x8b970f=_0x28b8[_0x52339f];return _0x8b970f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x828b('0x0'));var zipdir=require(_0x828b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x828b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x828b('0x3'));var sox=require(_0x828b('0x4'));var csv=require(_0x828b('0x5'));var ejs=require(_0x828b('0x6'));var fs=require('fs');var fs_extra=require(_0x828b('0x7'));var _=require(_0x828b('0x8'));var squel=require(_0x828b('0x9'));var crypto=require(_0x828b('0xa'));var jsforce=require(_0x828b('0xb'));var deskjs=require(_0x828b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x828b('0xd'));var Papa=require(_0x828b('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x828b('0xf'));var Redis=require(_0x828b('0x10'));var authService=require(_0x828b('0x11'));var qs=require(_0x828b('0x12'));var as=require(_0x828b('0x13'));var hardwareService=require(_0x828b('0x14'));var logger=require(_0x828b('0x15'))(_0x828b('0x16'));var utils=require(_0x828b('0x17'));var config=require(_0x828b('0x18'));var licenseUtil=require(_0x828b('0x19'));var db=require(_0x828b('0x1a'))['db'];function respondWithStatusCode(_0x165e59,_0x4f2dd0){_0x4f2dd0=_0x4f2dd0||0xcc;return function(_0x1bbf53){if(_0x1bbf53){return _0x165e59[_0x828b('0x1b')](_0x4f2dd0);}return _0x165e59[_0x828b('0x1c')](_0x4f2dd0)[_0x828b('0x1d')]();};}function respondWithResult(_0xc7adf4,_0x9e883c){_0x9e883c=_0x9e883c||0xc8;return function(_0x2ef1dc){if(_0x2ef1dc){return _0xc7adf4[_0x828b('0x1c')](_0x9e883c)[_0x828b('0x1e')](_0x2ef1dc);}};}function respondWithFilteredResult(_0x45f8ed,_0x27a34f){return function(_0x39aa7b){if(_0x39aa7b){var _0x3a5f37=typeof _0x27a34f[_0x828b('0x1f')]===_0x828b('0x20')&&typeof _0x27a34f[_0x828b('0x21')]===_0x828b('0x20');var _0x291531=_0x39aa7b[_0x828b('0x22')];var _0xaf35c7=_0x3a5f37?0x0:_0x27a34f['offset'];var _0xbdb5db=_0x3a5f37?_0x39aa7b[_0x828b('0x22')]:_0x27a34f['offset']+_0x27a34f['limit'];var _0x3d36ff;if(_0xbdb5db>=_0x291531){_0xbdb5db=_0x291531;_0x3d36ff=0xc8;}else{_0x3d36ff=0xce;}_0x45f8ed[_0x828b('0x1c')](_0x3d36ff);return _0x45f8ed[_0x828b('0x23')](_0x828b('0x24'),_0xaf35c7+'-'+_0xbdb5db+'/'+_0x291531)['json'](_0x39aa7b);}return null;};}function patchUpdates(_0x499cbf){return function(_0x516c41){try{jsonpatch[_0x828b('0x25')](_0x516c41,_0x499cbf,!![]);}catch(_0x33f487){return BPromise[_0x828b('0x26')](_0x33f487);}return _0x516c41[_0x828b('0x27')]();};}function saveUpdates(_0x700e5d,_0x2e0b26){return function(_0x31033b){if(_0x31033b){return _0x31033b['update'](_0x700e5d)['then'](function(_0x14cd35){return _0x14cd35;});}return null;};}function removeEntity(_0x45016f,_0x2aa241){return function(_0x316ddb){if(_0x316ddb){return _0x316ddb[_0x828b('0x28')]()[_0x828b('0x29')](function(){_0x45016f[_0x828b('0x1c')](0xcc)[_0x828b('0x1d')]();});}};}function handleEntityNotFound(_0x5e17dc,_0x1c1c49){return function(_0x91a15d){if(!_0x91a15d){_0x5e17dc[_0x828b('0x1b')](0x194);}return _0x91a15d;};}function handleError(_0x455cbb,_0x5dc73e){_0x5dc73e=_0x5dc73e||0x1f4;return function(_0x2aca78){logger[_0x828b('0x2a')](_0x2aca78[_0x828b('0x2b')]);if(_0x2aca78[_0x828b('0x2c')]){delete _0x2aca78[_0x828b('0x2c')];}_0x455cbb[_0x828b('0x1c')](_0x5dc73e)[_0x828b('0x2d')](_0x2aca78);};}exports['index']=function(_0x54d532,_0x4ca901){var _0x3fa34d={},_0x578bc2={},_0x2b0ca6={'count':0x0,'rows':[]};var _0x11ab52=_[_0x828b('0x2e')](db[_0x828b('0x2f')]['rawAttributes'],function(_0x419ad1){return{'name':_0x419ad1['fieldName'],'type':_0x419ad1[_0x828b('0x30')][_0x828b('0x31')]};});_0x578bc2[_0x828b('0x32')]=_['differenceBy'](_[_0x828b('0x2e')](_0x11ab52,_0x828b('0x2c')),[_0x828b('0x33')]);_0x578bc2[_0x828b('0x34')]=_['keys'](_0x54d532['query']);_0x578bc2['filters']=_[_0x828b('0x35')](_0x578bc2[_0x828b('0x32')],_0x578bc2[_0x828b('0x34')]);_0x3fa34d[_0x828b('0x36')]=_[_0x828b('0x35')](_0x578bc2[_0x828b('0x32')],qs[_0x828b('0x37')](_0x54d532['query'][_0x828b('0x37')]));_0x3fa34d[_0x828b('0x36')]=_0x3fa34d[_0x828b('0x36')]['length']?_0x3fa34d[_0x828b('0x36')]:_0x578bc2[_0x828b('0x32')];if(!_0x54d532[_0x828b('0x34')][_0x828b('0x38')](_0x828b('0x39'))){_0x3fa34d[_0x828b('0x21')]=qs[_0x828b('0x21')](_0x54d532[_0x828b('0x34')][_0x828b('0x21')]);_0x3fa34d[_0x828b('0x1f')]=qs[_0x828b('0x1f')](_0x54d532[_0x828b('0x34')][_0x828b('0x1f')]);}_0x3fa34d['order']=qs[_0x828b('0x3a')](_0x54d532[_0x828b('0x34')][_0x828b('0x3a')]);_0x3fa34d[_0x828b('0x3b')]=qs[_0x828b('0x3c')](_['pick'](_0x54d532[_0x828b('0x34')],_0x578bc2[_0x828b('0x3c')]),_0x11ab52);if(_0x54d532[_0x828b('0x34')][_0x828b('0x3d')]){_0x3fa34d[_0x828b('0x3b')]=_['merge'](_0x3fa34d[_0x828b('0x3b')],{'$or':_[_0x828b('0x2e')](_0x11ab52,function(_0x53270a){if(_0x53270a[_0x828b('0x30')]!==_0x828b('0x3e')){var _0xdff0b4={};_0xdff0b4[_0x53270a[_0x828b('0x2c')]]={'$like':'%'+_0x54d532[_0x828b('0x34')][_0x828b('0x3d')]+'%'};return _0xdff0b4;}})});}_0x3fa34d=_[_0x828b('0x3f')]({},_0x3fa34d,_0x54d532[_0x828b('0x40')]);var _0xdb564e={'where':_0x3fa34d[_0x828b('0x3b')]};return db[_0x828b('0x2f')]['count'](_0xdb564e)[_0x828b('0x29')](function(_0x1aac68){_0x2b0ca6[_0x828b('0x22')]=_0x1aac68;if(_0x54d532[_0x828b('0x34')]['includeAll']){_0x3fa34d[_0x828b('0x41')]=[{'all':!![]}];}return db['VoiceRecording'][_0x828b('0x42')](_0x3fa34d);})[_0x828b('0x29')](function(_0xe23afe){_0x2b0ca6[_0x828b('0x43')]=_0xe23afe;return _0x2b0ca6;})[_0x828b('0x29')](respondWithFilteredResult(_0x4ca901,_0x3fa34d))[_0x828b('0x44')](handleError(_0x4ca901,null));};exports[_0x828b('0x45')]=function(_0x5ef14e,_0x45273a){var _0x3229a8={'raw':![],'where':{'id':_0x5ef14e[_0x828b('0x46')]['id']}},_0x2ac872={};_0x2ac872['model']=_[_0x828b('0x47')](db['VoiceRecording'][_0x828b('0x48')]);_0x2ac872[_0x828b('0x34')]=_['keys'](_0x5ef14e[_0x828b('0x34')]);_0x2ac872['filters']=_[_0x828b('0x35')](_0x2ac872['model'],_0x2ac872['query']);_0x3229a8[_0x828b('0x36')]=_[_0x828b('0x35')](_0x2ac872[_0x828b('0x32')],qs[_0x828b('0x37')](_0x5ef14e[_0x828b('0x34')][_0x828b('0x37')]));_0x3229a8['attributes']=_0x3229a8['attributes'][_0x828b('0x49')]?_0x3229a8[_0x828b('0x36')]:_0x2ac872[_0x828b('0x32')];if(_0x5ef14e['query']['includeAll']){_0x3229a8[_0x828b('0x41')]=[{'all':!![]}];}_0x3229a8=_[_0x828b('0x3f')]({},_0x3229a8,_0x5ef14e[_0x828b('0x40')]);return db[_0x828b('0x2f')]['find'](_0x3229a8)[_0x828b('0x29')](handleEntityNotFound(_0x45273a,null))['then'](respondWithResult(_0x45273a,null))['catch'](handleError(_0x45273a,null));};exports['create']=function(_0xa9813a,_0x23020a){return db['VoiceRecording'][_0x828b('0x4a')](_0xa9813a[_0x828b('0x4b')],{})[_0x828b('0x29')](respondWithResult(_0x23020a,0xc9))[_0x828b('0x44')](handleError(_0x23020a,null));};exports['update']=function(_0x3ad12b,_0x26589a){if(_0x3ad12b[_0x828b('0x4b')]['id']){delete _0x3ad12b['body']['id'];}return db['VoiceRecording'][_0x828b('0x4c')]({'where':{'id':_0x3ad12b[_0x828b('0x46')]['id']}})[_0x828b('0x29')](handleEntityNotFound(_0x26589a,null))['then'](saveUpdates(_0x3ad12b['body'],null))['then'](respondWithResult(_0x26589a,null))[_0x828b('0x44')](handleError(_0x26589a,null));};exports[_0x828b('0x4d')]=function(_0x5400d9,_0x254d83){return db[_0x828b('0x2f')][_0x828b('0x4d')]()['then'](respondWithResult(_0x254d83,null))[_0x828b('0x44')](handleError(_0x254d83,null));};exports[_0x828b('0x4e')]=function(_0x1ad499,_0x5f307a,_0x3ef4d7){var _0x1d8520=require('../../components/encryptor');var _0x5f1bb8=![];var _0x36483a={};if(_0x1ad499[_0x828b('0x34')]['type']&&_0x1ad499[_0x828b('0x34')][_0x828b('0x30')]==='uniqueid'){_0x36483a[_0x828b('0x4f')]=_0x1ad499['params']['id'];}else{_0x36483a['id']=_0x1ad499[_0x828b('0x46')]['id'];}return db[_0x828b('0x2f')][_0x828b('0x4c')]({'where':_0x36483a,'attributes':['id',_0x828b('0x50')],'raw':!![]})[_0x828b('0x29')](handleEntityNotFound(_0x5f307a,null))['then'](function(_0x2c2304){if(_0x2c2304){var _0x2c83d4=_0x2c2304[_0x828b('0x50')];var _0x340e9c=util[_0x828b('0x33')](_0x828b('0x51'),_0x2c83d4);if(fs[_0x828b('0x52')](_0x340e9c)){_0x5f1bb8=!![];return _0x1d8520['decryptFile'](_0x340e9c,_0x2c83d4,config[_0x828b('0x53')][_0x828b('0x54')])[_0x828b('0x29')](function(){return _0x2c2304;});}return _0x2c2304;}})[_0x828b('0x29')](function(_0x5805f1){if(_0x5805f1){var _0x4b8c83=_0x5805f1['value'];if(!fs[_0x828b('0x52')](_0x4b8c83)){throw new db[(_0x828b('0x55'))][(_0x828b('0x56'))](_0x828b('0x57'));}if(_0x5805f1[_0x828b('0x58')]){return _0x5f307a[_0x828b('0x4e')](_0x4b8c83,_0x5805f1['filename']+path['extname'](_0x4b8c83),function(){if(_0x5f1bb8){fs[_0x828b('0x59')](_0x4b8c83);}});}else{return _0x5f307a[_0x828b('0x4e')](_0x4b8c83,function(_0x57fc86){if(_0x5f1bb8){fs['unlink'](_0x4b8c83);}});}}})[_0x828b('0x44')](function(_0x335ce6){if(_0x335ce6[_0x828b('0x5a')]===_0x828b('0x57')){_0x5f307a[_0x828b('0x1c')](0x194)[_0x828b('0x2d')](_0x828b('0x5b'));}else{return handleError(_0x5f307a,null);}});};exports['downloads']=function(_0x1dfab7,_0x1ab22d,_0x324882){var _0x5e26b3=require('../../components/encryptor');var _0x32cb82=![];var _0x1a1efd={'$and':[db[_0x828b('0x5c')][_0x828b('0x3b')](db[_0x828b('0x5c')]['fn'](_0x828b('0x5d'),db['sequelize']['col'](_0x828b('0x4f'))),_0x1dfab7[_0x828b('0x34')]['token'])]};if(_0x1dfab7['query']['type']&&_0x1dfab7[_0x828b('0x34')][_0x828b('0x30')]==='uniqueid'){_0x1a1efd[_0x828b('0x5e')][_0x828b('0x5f')]({'uniqueid':_0x1dfab7[_0x828b('0x46')]['id']});}else{_0x1a1efd[_0x828b('0x5e')][_0x828b('0x5f')]({'id':_0x1dfab7[_0x828b('0x46')]['id']});}return db[_0x828b('0x2f')][_0x828b('0x4c')]({'where':_0x1a1efd,'attributes':['id',_0x828b('0x50')],'raw':!![]})[_0x828b('0x29')](handleEntityNotFound(_0x1ab22d,null))[_0x828b('0x29')](function(_0x5a4c45){if(_0x5a4c45){var _0x4c93f9=util['format'](_0x828b('0x51'),_0x5a4c45[_0x828b('0x50')]);if(fs[_0x828b('0x52')](_0x4c93f9)){_0x32cb82=!![];return _0x5e26b3[_0x828b('0x60')](_0x4c93f9,_0x5a4c45[_0x828b('0x50')],config[_0x828b('0x53')][_0x828b('0x54')])[_0x828b('0x29')](function(){return _0x5a4c45;});}return _0x5a4c45;}})[_0x828b('0x29')](function(_0x2cf3b6){if(_0x2cf3b6){if(!fs['existsSync'](_0x2cf3b6['value'])){throw new db[(_0x828b('0x55'))][(_0x828b('0x56'))](_0x828b('0x57'));}if(_0x2cf3b6[_0x828b('0x58')]){return _0x1ab22d['download'](_0x2cf3b6['value'],_0x2cf3b6['filename']+path['extname'](_0x2cf3b6[_0x828b('0x50')]),function(){if(_0x32cb82){fs['unlink'](_0x2cf3b6[_0x828b('0x50')]);}});}else{return _0x1ab22d[_0x828b('0x4e')](_0x2cf3b6['value'],function(_0x124e38){if(_0x32cb82){fs[_0x828b('0x59')](_0x2cf3b6[_0x828b('0x50')]);}});}}})[_0x828b('0x44')](handleError(_0x1ab22d,null));};exports['destroy']=function(_0x2bf112,_0xdba54d){return db[_0x828b('0x2f')][_0x828b('0x4c')]({'where':{'id':_0x2bf112[_0x828b('0x46')]['id']}})['then'](function(_0x59963b){if(_[_0x828b('0x61')](_0x59963b)){throw new ReferenceError(_0x828b('0x62'));}return _0x59963b;})[_0x828b('0x29')](function(_0x23d784){var _0x4facf6=_0x23d784[_0x828b('0x50')];logger['info'](_0x828b('0x63'),_0x4facf6);if(!_['isNil'](_0x23d784[_0x828b('0x50')])&&fs[_0x828b('0x52')](_0x4facf6)){logger[_0x828b('0x64')](_0x828b('0x65')+_0x4facf6+_0x828b('0x66'));fs[_0x828b('0x67')](_0x4facf6);}_0x4facf6=_0x4facf6+_0x828b('0x68');if(!_['isNil'](_0x23d784[_0x828b('0x50')])&&fs[_0x828b('0x52')](_0x4facf6)){logger['info'](_0x828b('0x65')+_0x4facf6+_0x828b('0x66'));fs['unlinkSync'](_0x4facf6);}return _0x23d784;})[_0x828b('0x29')](function(_0x51e458){if(!_0x51e458)throw new InternalError();return _0x51e458[_0x828b('0x28')]();})[_0x828b('0x29')](function(){_0xdba54d[_0x828b('0x1c')](0xcc)[_0x828b('0x1d')]();})[_0x828b('0x44')](handleError(_0xdba54d,null));};function getBucketslist(_0x48f980,_0x5737ff,_0x5f9c99){return new Promise(function(_0x164a86,_0x2ec937){var _0x151155=new AWS['S3']({'accessKeyId':_0x5737ff,'secretAccessKey':_0x48f980,'region':_0x5f9c99});_0x151155[_0x828b('0x69')]({},function(_0x30e7a7,_0x95daab){if(_0x30e7a7){return _0x2ec937(_0x30e7a7);}else{return _0x164a86(_0x95daab);}});});}function createBucket(_0x2bd5f7,_0x2db207,_0x106c72,_0x946148){return new Promise(function(_0x40d354,_0x445cfa){var _0x73691=new AWS['S3']({'accessKeyId':_0x2db207,'secretAccessKey':_0x2bd5f7,'region':_0x106c72});_0x73691[_0x828b('0x6a')]({'Bucket':_0x946148},function(_0x49a8fe,_0x11a6da){if(_0x49a8fe){return _0x445cfa(_0x49a8fe);}else{return _0x40d354(_0x11a6da);}});});}function uploadFile(_0x327dfd,_0x2b9a05,_0x14981c,_0x28b42d,_0x25c245,_0x4de1a5){return new Promise(function(_0x3db6f1,_0xd87f0a){var _0x180985=new AWS['S3']({'accessKeyId':_0x2b9a05,'secretAccessKey':_0x327dfd,'region':_0x14981c});_0x180985[_0x828b('0x6b')]({'Bucket':_0x28b42d,'Key':_0x25c245,'Body':_0x4de1a5},function(_0x400fb2,_0x577464){if(_0x400fb2){return _0xd87f0a(_0x400fb2);}else{return _0x3db6f1(_0x577464);}});});}function startTranscribe(_0x5762a9,_0x518f5c,_0x17f07d,_0x4ce551,_0x2890a4,_0x28c870){return new Promise(function(_0x2bdb1d,_0x2e5eda){var _0x5d96d3=new AWS[(_0x828b('0x6c'))]({'accessKeyId':_0x518f5c,'secretAccessKey':_0x5762a9,'region':_0x17f07d});_0x5d96d3['startTranscriptionJob']({'TranscriptionJobName':_0x4ce551,'LanguageCode':_0x2890a4,'Media':{'MediaFileUri':_0x28c870}},function(_0x340930,_0x4092dd){if(_0x340930){return _0x2e5eda(_0x340930);}else{return _0x2bdb1d(_0x4092dd);}});});}function transcribe(_0x57c15b,_0x28922e,_0x48dcc9,_0xc911a5,_0x4636d1,_0x458317,_0x2037fc){return new Promise(function(_0x18d32a,_0x673e9b){var _0x350607={};logger['info'](util[_0x828b('0x33')](_0x828b('0x6d'),_0x57c15b,_0x4636d1));return uploadFile(_0x28922e,_0x48dcc9,_0xc911a5,_0x4636d1,path[_0x828b('0x6e')](_0x458317),fs['readFileSync'](_0x458317))[_0x828b('0x29')](function(_0x28ddae){logger[_0x828b('0x64')](util['format'](_0x828b('0x6f'),_0x57c15b,_0x4636d1,_0x28ddae[_0x828b('0x70')]));_0x350607['bucket']=_0x28ddae[_0x828b('0x71')];_0x350607[_0x828b('0x72')]=_0x28ddae[_0x828b('0x70')];logger[_0x828b('0x64')](util[_0x828b('0x33')](_0x828b('0x73'),_0x57c15b));return startTranscribe(_0x28922e,_0x48dcc9,_0xc911a5,uuidv4(),_0x2037fc,_0x28ddae[_0x828b('0x70')]);})[_0x828b('0x29')](function(_0xafa524){logger[_0x828b('0x64')](util[_0x828b('0x33')](_0x828b('0x74'),_0x57c15b,_0xafa524[_0x828b('0x75')]['TranscriptionJobName']));_0x350607['transcribeName']=_0xafa524[_0x828b('0x75')][_0x828b('0x76')];_0x350607['transcribeStatus']=_0xafa524[_0x828b('0x75')][_0x828b('0x77')];return _0x18d32a(_0x350607);})[_0x828b('0x44')](function(_0x29db50){return _0x673e9b(_0x29db50);});});}exports[_0x828b('0x78')]=function(_0x960770,_0x4e4bb1,_0x45e822){var _0x5d98e8;var _0xff73ba;var _0x5d2b3f;var _0x219da2=require(_0x828b('0x79'));return db['VoiceRecording'][_0x828b('0x7a')]({'where':{'id':_0x960770[_0x828b('0x46')]['id']}})[_0x828b('0x29')](function(_0x571b32){if(_0x571b32){var _0x56bab3=util[_0x828b('0x33')](_0x828b('0x51'),_0x571b32['value']);if(fs[_0x828b('0x52')](_0x56bab3)){cypher=!![];return _0x219da2['decryptFile'](_0x56bab3,_0x571b32[_0x828b('0x50')],config[_0x828b('0x53')]['recording'])[_0x828b('0x29')](function(){return _0x571b32;});}return _0x571b32;}})[_0x828b('0x29')](function(_0x59baf3){if(!_0x59baf3){throw new db['Sequelize'][(_0x828b('0x56'))](_0x828b('0x7b'));}_0xff73ba=_0x59baf3;return db[_0x828b('0x7c')][_0x828b('0x7a')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4e4bb1,null))[_0x828b('0x29')](function(_0x3f401d){if(_0x3f401d){_0x5d98e8=_0x3f401d;if(!_0x5d98e8[_0x828b('0x7d')]||!_0x5d98e8['transcribeAccountId']||!_0x5d98e8[_0x828b('0x7e')]||!_0x5d98e8[_0x828b('0x7f')]||!_0x5d98e8[_0x828b('0x80')]){throw new db[(_0x828b('0x55'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x960770[_0x828b('0x4b')][_0x828b('0x81')]&&(!_0x5d98e8['sentiment']||!_0x5d98e8[_0x828b('0x82')]||!_0x5d98e8['sentimentRegion']||!_0x5d98e8['language']||!_0x5d98e8[_0x828b('0x80')])){throw new db[(_0x828b('0x55'))][(_0x828b('0x56'))](_0x828b('0x83'));}return db['CloudProvider'][_0x828b('0x7a')]({'where':{'id':_0x5d98e8['transcribeAccountId']}});}})['then'](function(_0x188063){if(!_0x188063){throw new db['Sequelize'][(_0x828b('0x56'))](_0x828b('0x84'));}if(!_0x188063[_0x828b('0x85')]||!_0x188063['data2']){throw new db[(_0x828b('0x55'))]['ValidationError'](_0x828b('0x86'));}_0x5d2b3f=_0x188063;return getBucketslist(_0x5d2b3f[_0x828b('0x85')],_0x5d2b3f[_0x828b('0x87')],_0x5d98e8[_0x828b('0x7e')]);})[_0x828b('0x29')](function(_0x5069de){if(_0x5069de&&_0x5069de[_0x828b('0x88')]){var _0x15dd28=_[_0x828b('0x4c')](_0x5069de[_0x828b('0x88')],function(_0x3f7412){return _0x3f7412[_0x828b('0x89')]===_0x5d98e8[_0x828b('0x80')];});if(!_0x15dd28){logger[_0x828b('0x64')](util[_0x828b('0x33')](_0x828b('0x8a'),_0x960770['params']['id'],_0x5d98e8[_0x828b('0x80')]));return createBucket(_0x5d2b3f['data1'],_0x5d2b3f[_0x828b('0x87')],_0x5d98e8[_0x828b('0x7e')],_0x5d98e8[_0x828b('0x80')]);}logger[_0x828b('0x64')](util[_0x828b('0x33')](_0x828b('0x8b'),_0x960770[_0x828b('0x46')]['id'],_0x5d98e8[_0x828b('0x80')]));return;}})[_0x828b('0x29')](function(_0xc8269b){if(_0xff73ba['transcribeStatus']==='NEW'){return transcribe(_0x960770[_0x828b('0x46')]['id'],_0x5d2b3f['data1'],_0x5d2b3f['data2'],_0x5d98e8[_0x828b('0x7e')],_0x5d98e8[_0x828b('0x80')],_0xff73ba[_0x828b('0x50')],_0x5d98e8[_0x828b('0x7f')]);}else{logger[_0x828b('0x64')](util[_0x828b('0x33')](_0x828b('0x8c'),_0x960770[_0x828b('0x46')]['id']));return{'transcribeStatus':_0x828b('0x8d')};}})['then'](function(_0x8dfa3e){if(_0x8dfa3e){_0x8dfa3e[_0x828b('0x8e')]=_0x960770[_0x828b('0x4b')][_0x828b('0x81')];return _0xff73ba['updateAttributes'](_0x8dfa3e);}})[_0x828b('0x29')](respondWithResult(_0x4e4bb1,null))[_0x828b('0x44')](handleError(_0x4e4bb1,null));};function writeFile(_0x3b1b37,_0x37e6c6){return new Promise(function(_0x4ff7b9,_0x520530){fs[_0x828b('0x8f')](_0x37e6c6,_0x3b1b37,function(_0x369f93,_0x366e0d){if(_0x369f93){return _0x520530(_0x369f93);}else{return _0x4ff7b9(_0x366e0d);}});});}exports[_0x828b('0x90')]=function(_0x486d01,_0x173127,_0x4fce12){return db['VoiceRecording'][_0x828b('0x7a')]({'where':{'id':_0x486d01[_0x828b('0x46')]['id']}})['then'](handleEntityNotFound(_0x173127))[_0x828b('0x29')](function(_0x4bb750){if(_0x4bb750&&_0x4bb750[_0x828b('0x91')]){var _0x24c24e=_0x4bb750[_0x828b('0x91')];var _0x4fc739=config['root']+_0x828b('0x92')+_0x4bb750['id']+'.txt';if(fs[_0x828b('0x52')](_0x4fc739)){return _0x4fc739;}return writeFile(_0x24c24e,_0x4fc739)[_0x828b('0x29')](function(){return _0x4fc739;});}else{throw new db['Sequelize'][(_0x828b('0x56'))]('Transcript\x20not\x20available');}})[_0x828b('0x29')](function(_0x165802){return _0x173127[_0x828b('0x4e')](_0x165802);})[_0x828b('0x44')](handleError(_0x173127));}; \ No newline at end of file +var _0x4189=['length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','options','includeAll','include','findAll','rows','keys','merge','find','create','body','params','catch','describe','../../components/encryptor','uniqueid','value','existsSync','recording','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','Sequelize','download','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','bucket','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','sendStatus','stack','name','send','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','map','format','query','intersection','attributes','fields'];(function(_0x581940,_0x482585){var _0x498dac=function(_0x545483){while(--_0x545483){_0x581940['push'](_0x581940['shift']());}};_0x498dac(++_0x482585);}(_0x4189,0x188));var _0x9418=function(_0x3011a1,_0xa8003c){_0x3011a1=_0x3011a1-0x0;var _0x19a4e7=_0x4189[_0x3011a1];return _0x19a4e7;};'use strict';var emlformat=require(_0x9418('0x0'));var rimraf=require(_0x9418('0x1'));var zipdir=require(_0x9418('0x2'));var jsonpatch=require(_0x9418('0x3'));var rp=require(_0x9418('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9418('0x5'));var path=require(_0x9418('0x6'));var sox=require('sox');var csv=require(_0x9418('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9418('0x8'));var _=require(_0x9418('0x9'));var squel=require(_0x9418('0xa'));var crypto=require(_0x9418('0xb'));var jsforce=require(_0x9418('0xc'));var deskjs=require(_0x9418('0xd'));var toCsv=require(_0x9418('0x7'));var querystring=require('querystring');var Papa=require(_0x9418('0xe'));var AWS=require(_0x9418('0xf'));var uuidv4=require(_0x9418('0x10'));var Redis=require(_0x9418('0x11'));var authService=require(_0x9418('0x12'));var qs=require(_0x9418('0x13'));var as=require(_0x9418('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9418('0x15'));var utils=require(_0x9418('0x16'));var config=require(_0x9418('0x17'));var licenseUtil=require(_0x9418('0x18'));var db=require(_0x9418('0x19'))['db'];function respondWithStatusCode(_0xc829e,_0x45e195){_0x45e195=_0x45e195||0xcc;return function(_0x41f931){if(_0x41f931){return _0xc829e['sendStatus'](_0x45e195);}return _0xc829e[_0x9418('0x1a')](_0x45e195)[_0x9418('0x1b')]();};}function respondWithResult(_0x43b411,_0x4a8799){_0x4a8799=_0x4a8799||0xc8;return function(_0x29f402){if(_0x29f402){return _0x43b411[_0x9418('0x1a')](_0x4a8799)[_0x9418('0x1c')](_0x29f402);}};}function respondWithFilteredResult(_0x5abd39,_0xf1a193){return function(_0x35596b){if(_0x35596b){var _0x4944e8=typeof _0xf1a193[_0x9418('0x1d')]===_0x9418('0x1e')&&typeof _0xf1a193[_0x9418('0x1f')]===_0x9418('0x1e');var _0x59ca93=_0x35596b[_0x9418('0x20')];var _0x475a21=_0x4944e8?0x0:_0xf1a193[_0x9418('0x1d')];var _0x4591af=_0x4944e8?_0x35596b[_0x9418('0x20')]:_0xf1a193[_0x9418('0x1d')]+_0xf1a193[_0x9418('0x1f')];var _0x3519d3;if(_0x4591af>=_0x59ca93){_0x4591af=_0x59ca93;_0x3519d3=0xc8;}else{_0x3519d3=0xce;}_0x5abd39[_0x9418('0x1a')](_0x3519d3);return _0x5abd39[_0x9418('0x21')]('Content-Range',_0x475a21+'-'+_0x4591af+'/'+_0x59ca93)[_0x9418('0x1c')](_0x35596b);}return null;};}function patchUpdates(_0x35e7e0){return function(_0x28d676){try{jsonpatch[_0x9418('0x22')](_0x28d676,_0x35e7e0,!![]);}catch(_0x42552a){return BPromise[_0x9418('0x23')](_0x42552a);}return _0x28d676[_0x9418('0x24')]();};}function saveUpdates(_0x218aa1,_0x326c83){return function(_0x2eb054){if(_0x2eb054){return _0x2eb054['update'](_0x218aa1)['then'](function(_0x576981){return _0x576981;});}return null;};}function removeEntity(_0x42f7c1,_0x303202){return function(_0x1a813e){if(_0x1a813e){return _0x1a813e[_0x9418('0x25')]()[_0x9418('0x26')](function(){_0x42f7c1[_0x9418('0x1a')](0xcc)[_0x9418('0x1b')]();});}};}function handleEntityNotFound(_0x488db6,_0x316bca){return function(_0x597875){if(!_0x597875){_0x488db6[_0x9418('0x27')](0x194);}return _0x597875;};}function handleError(_0x41ca71,_0x2f75b7){_0x2f75b7=_0x2f75b7||0x1f4;return function(_0x262d89){logger['error'](_0x262d89[_0x9418('0x28')]);if(_0x262d89[_0x9418('0x29')]){delete _0x262d89[_0x9418('0x29')];}_0x41ca71['status'](_0x2f75b7)[_0x9418('0x2a')](_0x262d89);};}exports['index']=function(_0xb9ebe1,_0x33f4e1){var _0x2d620b={},_0x4bdedf={},_0x1aeb31={'count':0x0,'rows':[]};var _0x3d27ae=_['map'](db[_0x9418('0x2b')][_0x9418('0x2c')],function(_0x43b9cd){return{'name':_0x43b9cd[_0x9418('0x2d')],'type':_0x43b9cd[_0x9418('0x2e')]['key']};});_0x4bdedf[_0x9418('0x2f')]=_[_0x9418('0x30')](_[_0x9418('0x31')](_0x3d27ae,'name'),[_0x9418('0x32')]);_0x4bdedf[_0x9418('0x33')]=_['keys'](_0xb9ebe1['query']);_0x4bdedf['filters']=_[_0x9418('0x34')](_0x4bdedf[_0x9418('0x2f')],_0x4bdedf[_0x9418('0x33')]);_0x2d620b[_0x9418('0x35')]=_['intersection'](_0x4bdedf[_0x9418('0x2f')],qs['fields'](_0xb9ebe1[_0x9418('0x33')][_0x9418('0x36')]));_0x2d620b[_0x9418('0x35')]=_0x2d620b[_0x9418('0x35')][_0x9418('0x37')]?_0x2d620b[_0x9418('0x35')]:_0x4bdedf[_0x9418('0x2f')];if(!_0xb9ebe1[_0x9418('0x33')][_0x9418('0x38')](_0x9418('0x39'))){_0x2d620b[_0x9418('0x1f')]=qs['limit'](_0xb9ebe1[_0x9418('0x33')][_0x9418('0x1f')]);_0x2d620b[_0x9418('0x1d')]=qs[_0x9418('0x1d')](_0xb9ebe1[_0x9418('0x33')][_0x9418('0x1d')]);}_0x2d620b[_0x9418('0x3a')]=qs[_0x9418('0x3b')](_0xb9ebe1['query'][_0x9418('0x3b')]);_0x2d620b['where']=qs[_0x9418('0x3c')](_[_0x9418('0x3d')](_0xb9ebe1[_0x9418('0x33')],_0x4bdedf[_0x9418('0x3c')]),_0x3d27ae);if(_0xb9ebe1[_0x9418('0x33')][_0x9418('0x3e')]){_0x2d620b[_0x9418('0x3f')]=_['merge'](_0x2d620b[_0x9418('0x3f')],{'$or':_['map'](_0x3d27ae,function(_0x41ac97){if(_0x41ac97[_0x9418('0x2e')]!=='VIRTUAL'){var _0x4213a8={};_0x4213a8[_0x41ac97[_0x9418('0x29')]]={'$like':'%'+_0xb9ebe1[_0x9418('0x33')][_0x9418('0x3e')]+'%'};return _0x4213a8;}})});}_0x2d620b=_['merge']({},_0x2d620b,_0xb9ebe1[_0x9418('0x40')]);var _0x519fc9={'where':_0x2d620b[_0x9418('0x3f')]};return db[_0x9418('0x2b')]['count'](_0x519fc9)[_0x9418('0x26')](function(_0x4912eb){_0x1aeb31[_0x9418('0x20')]=_0x4912eb;if(_0xb9ebe1['query'][_0x9418('0x41')]){_0x2d620b[_0x9418('0x42')]=[{'all':!![]}];}return db[_0x9418('0x2b')][_0x9418('0x43')](_0x2d620b);})[_0x9418('0x26')](function(_0x4cc8f2){_0x1aeb31[_0x9418('0x44')]=_0x4cc8f2;return _0x1aeb31;})[_0x9418('0x26')](respondWithFilteredResult(_0x33f4e1,_0x2d620b))['catch'](handleError(_0x33f4e1,null));};exports['show']=function(_0x3b9067,_0x5a4605){var _0x4c1c53={'raw':![],'where':{'id':_0x3b9067['params']['id']}},_0x46d11d={};_0x46d11d[_0x9418('0x2f')]=_['keys'](db[_0x9418('0x2b')][_0x9418('0x2c')]);_0x46d11d[_0x9418('0x33')]=_[_0x9418('0x45')](_0x3b9067[_0x9418('0x33')]);_0x46d11d['filters']=_[_0x9418('0x34')](_0x46d11d[_0x9418('0x2f')],_0x46d11d['query']);_0x4c1c53['attributes']=_[_0x9418('0x34')](_0x46d11d[_0x9418('0x2f')],qs[_0x9418('0x36')](_0x3b9067[_0x9418('0x33')][_0x9418('0x36')]));_0x4c1c53[_0x9418('0x35')]=_0x4c1c53['attributes'][_0x9418('0x37')]?_0x4c1c53[_0x9418('0x35')]:_0x46d11d[_0x9418('0x2f')];if(_0x3b9067['query']['includeAll']){_0x4c1c53[_0x9418('0x42')]=[{'all':!![]}];}_0x4c1c53=_[_0x9418('0x46')]({},_0x4c1c53,_0x3b9067[_0x9418('0x40')]);return db['VoiceRecording'][_0x9418('0x47')](_0x4c1c53)[_0x9418('0x26')](handleEntityNotFound(_0x5a4605,null))[_0x9418('0x26')](respondWithResult(_0x5a4605,null))['catch'](handleError(_0x5a4605,null));};exports['create']=function(_0xb86c3,_0x5dfb2f){return db[_0x9418('0x2b')][_0x9418('0x48')](_0xb86c3['body'],{})[_0x9418('0x26')](respondWithResult(_0x5dfb2f,0xc9))['catch'](handleError(_0x5dfb2f,null));};exports['update']=function(_0x258f77,_0x18cd3d){if(_0x258f77[_0x9418('0x49')]['id']){delete _0x258f77[_0x9418('0x49')]['id'];}return db[_0x9418('0x2b')]['find']({'where':{'id':_0x258f77[_0x9418('0x4a')]['id']}})[_0x9418('0x26')](handleEntityNotFound(_0x18cd3d,null))['then'](saveUpdates(_0x258f77[_0x9418('0x49')],null))[_0x9418('0x26')](respondWithResult(_0x18cd3d,null))[_0x9418('0x4b')](handleError(_0x18cd3d,null));};exports[_0x9418('0x4c')]=function(_0x249535,_0x4d76df){return db[_0x9418('0x2b')][_0x9418('0x4c')]()[_0x9418('0x26')](respondWithResult(_0x4d76df,null))['catch'](handleError(_0x4d76df,null));};exports['download']=function(_0x58e10c,_0x42cdd2,_0x2973fc){var _0x1ce5d8=require(_0x9418('0x4d'));var _0x5ef9f5=![];var _0x76869d={};if(_0x58e10c[_0x9418('0x33')][_0x9418('0x2e')]&&_0x58e10c[_0x9418('0x33')][_0x9418('0x2e')]==='uniqueid'){_0x76869d[_0x9418('0x4e')]=_0x58e10c[_0x9418('0x4a')]['id'];}else{_0x76869d['id']=_0x58e10c[_0x9418('0x4a')]['id'];}return db[_0x9418('0x2b')][_0x9418('0x47')]({'where':_0x76869d,'attributes':['id',_0x9418('0x4f')],'raw':!![]})[_0x9418('0x26')](handleEntityNotFound(_0x42cdd2,null))[_0x9418('0x26')](function(_0x71d1a5){if(_0x71d1a5){var _0x369084=_0x71d1a5[_0x9418('0x4f')];var _0x536582=util[_0x9418('0x32')]('%s.cypher',_0x369084);if(fs[_0x9418('0x50')](_0x536582)){_0x5ef9f5=!![];return _0x1ce5d8['decryptFile'](_0x536582,_0x369084,config['secrets'][_0x9418('0x51')])[_0x9418('0x26')](function(){return _0x71d1a5;});}return _0x71d1a5;}})[_0x9418('0x26')](function(_0x2452ee){if(_0x2452ee){var _0xbe41f1=_0x2452ee[_0x9418('0x4f')];if(!fs['existsSync'](_0xbe41f1)){throw new db['Sequelize'][(_0x9418('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x2452ee[_0x9418('0x53')]){return _0x42cdd2['download'](_0xbe41f1,_0x2452ee['filename']+path[_0x9418('0x54')](_0xbe41f1),function(){if(_0x5ef9f5){fs[_0x9418('0x55')](_0xbe41f1);}});}else{return _0x42cdd2['download'](_0xbe41f1,function(_0x3e088d){if(_0x5ef9f5){fs[_0x9418('0x55')](_0xbe41f1);}});}}})['catch'](function(_0x36f900){if(_0x36f900[_0x9418('0x56')]===_0x9418('0x57')){_0x42cdd2[_0x9418('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x42cdd2,null);}});};exports[_0x9418('0x58')]=function(_0x2abcd2,_0x4bc7e7,_0x292451){var _0x445fc1=require(_0x9418('0x4d'));var _0x3dcbcf=![];var _0x1fed67={'$and':[db[_0x9418('0x59')]['where'](db[_0x9418('0x59')]['fn'](_0x9418('0x5a'),db['sequelize'][_0x9418('0x5b')]('uniqueid')),_0x2abcd2[_0x9418('0x33')][_0x9418('0x5c')])]};if(_0x2abcd2[_0x9418('0x33')]['type']&&_0x2abcd2[_0x9418('0x33')][_0x9418('0x2e')]===_0x9418('0x4e')){_0x1fed67[_0x9418('0x5d')]['push']({'uniqueid':_0x2abcd2[_0x9418('0x4a')]['id']});}else{_0x1fed67[_0x9418('0x5d')][_0x9418('0x5e')]({'id':_0x2abcd2['params']['id']});}return db[_0x9418('0x2b')][_0x9418('0x47')]({'where':_0x1fed67,'attributes':['id',_0x9418('0x4f')],'raw':!![]})[_0x9418('0x26')](handleEntityNotFound(_0x4bc7e7,null))[_0x9418('0x26')](function(_0xef2400){if(_0xef2400){var _0x317213=util['format']('%s.cypher',_0xef2400[_0x9418('0x4f')]);if(fs[_0x9418('0x50')](_0x317213)){_0x3dcbcf=!![];return _0x445fc1[_0x9418('0x5f')](_0x317213,_0xef2400[_0x9418('0x4f')],config['secrets'][_0x9418('0x51')])[_0x9418('0x26')](function(){return _0xef2400;});}return _0xef2400;}})[_0x9418('0x26')](function(_0x38163d){if(_0x38163d){if(!fs[_0x9418('0x50')](_0x38163d['value'])){throw new db[(_0x9418('0x60'))][(_0x9418('0x52'))](_0x9418('0x57'));}if(_0x38163d[_0x9418('0x53')]){return _0x4bc7e7[_0x9418('0x61')](_0x38163d[_0x9418('0x4f')],_0x38163d[_0x9418('0x53')]+path['extname'](_0x38163d[_0x9418('0x4f')]),function(){if(_0x3dcbcf){fs[_0x9418('0x55')](_0x38163d['value']);}});}else{return _0x4bc7e7[_0x9418('0x61')](_0x38163d[_0x9418('0x4f')],function(_0x17a476){if(_0x3dcbcf){fs[_0x9418('0x55')](_0x38163d['value']);}});}}})[_0x9418('0x4b')](handleError(_0x4bc7e7,null));};exports[_0x9418('0x25')]=function(_0x3c743,_0x39e9df){return db[_0x9418('0x2b')]['find']({'where':{'id':_0x3c743[_0x9418('0x4a')]['id']}})[_0x9418('0x26')](function(_0x32879b){if(_[_0x9418('0x62')](_0x32879b)){throw new ReferenceError(_0x9418('0x63'));}return _0x32879b;})[_0x9418('0x26')](function(_0x4e3322){var _0x166187=_0x4e3322[_0x9418('0x4f')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x166187);if(!_[_0x9418('0x62')](_0x4e3322[_0x9418('0x4f')])&&fs[_0x9418('0x50')](_0x166187)){logger[_0x9418('0x64')](_0x9418('0x65')+_0x166187+_0x9418('0x66'));fs[_0x9418('0x67')](_0x166187);}_0x166187=_0x166187+_0x9418('0x68');if(!_[_0x9418('0x62')](_0x4e3322[_0x9418('0x4f')])&&fs['existsSync'](_0x166187)){logger[_0x9418('0x64')](_0x9418('0x65')+_0x166187+_0x9418('0x66'));fs['unlinkSync'](_0x166187);}return _0x4e3322;})[_0x9418('0x26')](function(_0x208ed3){if(!_0x208ed3)throw new InternalError();return _0x208ed3['destroy']();})[_0x9418('0x26')](function(){_0x39e9df['status'](0xcc)['end']();})[_0x9418('0x4b')](handleError(_0x39e9df,null));};function getBucketslist(_0x318d83,_0x49a848,_0x327032){return new Promise(function(_0x54cc52,_0x38518b){var _0x458adf=new AWS['S3']({'accessKeyId':_0x49a848,'secretAccessKey':_0x318d83,'region':_0x327032});_0x458adf['listBuckets']({},function(_0x4ee689,_0x398d9f){if(_0x4ee689){return _0x38518b(_0x4ee689);}else{return _0x54cc52(_0x398d9f);}});});}function createBucket(_0x21adb5,_0x2cd5a4,_0x2a0fdd,_0x112659){return new Promise(function(_0x12d86f,_0x44612a){var _0x5deed4=new AWS['S3']({'accessKeyId':_0x2cd5a4,'secretAccessKey':_0x21adb5,'region':_0x2a0fdd});_0x5deed4[_0x9418('0x69')]({'Bucket':_0x112659},function(_0xa4dba7,_0x12a77b){if(_0xa4dba7){return _0x44612a(_0xa4dba7);}else{return _0x12d86f(_0x12a77b);}});});}function uploadFile(_0xd1b641,_0x272566,_0x40e5b4,_0x3a7c31,_0x524727,_0x35f5d8){return new Promise(function(_0x399ffe,_0x1d989e){var _0x596961=new AWS['S3']({'accessKeyId':_0x272566,'secretAccessKey':_0xd1b641,'region':_0x40e5b4});_0x596961[_0x9418('0x6a')]({'Bucket':_0x3a7c31,'Key':_0x524727,'Body':_0x35f5d8},function(_0x2c9db2,_0x162fc6){if(_0x2c9db2){return _0x1d989e(_0x2c9db2);}else{return _0x399ffe(_0x162fc6);}});});}function startTranscribe(_0x5e022d,_0x186b4d,_0x214edd,_0x4b1e87,_0xbde36c,_0x57805e){return new Promise(function(_0x1b650c,_0x5c16ad){var _0x39eeb0=new AWS[(_0x9418('0x6b'))]({'accessKeyId':_0x186b4d,'secretAccessKey':_0x5e022d,'region':_0x214edd});_0x39eeb0[_0x9418('0x6c')]({'TranscriptionJobName':_0x4b1e87,'LanguageCode':_0xbde36c,'Media':{'MediaFileUri':_0x57805e}},function(_0x51de62,_0x1b0acf){if(_0x51de62){return _0x5c16ad(_0x51de62);}else{return _0x1b650c(_0x1b0acf);}});});}function transcribe(_0x30f1dc,_0x3d1e23,_0x41cc9d,_0x1bee8d,_0x32f6e9,_0x864566,_0x30c0b8){return new Promise(function(_0x27fe4a,_0x4d691e){var _0x5d840b={};logger['info'](util[_0x9418('0x32')](_0x9418('0x6d'),_0x30f1dc,_0x32f6e9));return uploadFile(_0x3d1e23,_0x41cc9d,_0x1bee8d,_0x32f6e9,path['basename'](_0x864566),fs[_0x9418('0x6e')](_0x864566))[_0x9418('0x26')](function(_0x32ad48){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x30f1dc,_0x32f6e9,_0x32ad48['Location']));_0x5d840b[_0x9418('0x6f')]=_0x32ad48['Bucket'];_0x5d840b['location']=_0x32ad48[_0x9418('0x70')];logger['info'](util[_0x9418('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x30f1dc));return startTranscribe(_0x3d1e23,_0x41cc9d,_0x1bee8d,uuidv4(),_0x30c0b8,_0x32ad48[_0x9418('0x70')]);})[_0x9418('0x26')](function(_0x4723be){logger[_0x9418('0x64')](util[_0x9418('0x32')](_0x9418('0x71'),_0x30f1dc,_0x4723be['TranscriptionJob'][_0x9418('0x72')]));_0x5d840b[_0x9418('0x73')]=_0x4723be['TranscriptionJob']['TranscriptionJobName'];_0x5d840b[_0x9418('0x74')]=_0x4723be['TranscriptionJob'][_0x9418('0x75')];return _0x27fe4a(_0x5d840b);})[_0x9418('0x4b')](function(_0x4bc159){return _0x4d691e(_0x4bc159);});});}exports['runTranscribe']=function(_0x1b41ea,_0x24b0f0,_0x161411){var _0x17b88d;var _0x559b39;var _0x327579;var _0xecdd6a=require(_0x9418('0x4d'));return db['VoiceRecording'][_0x9418('0x76')]({'where':{'id':_0x1b41ea[_0x9418('0x4a')]['id']}})[_0x9418('0x26')](function(_0x1c7c39){if(_0x1c7c39){var _0xa6b27e=util[_0x9418('0x32')](_0x9418('0x77'),_0x1c7c39[_0x9418('0x4f')]);if(fs[_0x9418('0x50')](_0xa6b27e)){cypher=!![];return _0xecdd6a[_0x9418('0x5f')](_0xa6b27e,_0x1c7c39[_0x9418('0x4f')],config['secrets'][_0x9418('0x51')])[_0x9418('0x26')](function(){return _0x1c7c39;});}return _0x1c7c39;}})[_0x9418('0x26')](function(_0x31e4d7){if(!_0x31e4d7){throw new db['Sequelize'][(_0x9418('0x52'))](_0x9418('0x78'));}_0x559b39=_0x31e4d7;return db[_0x9418('0x79')][_0x9418('0x76')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x24b0f0,null))['then'](function(_0x49867d){if(_0x49867d){_0x17b88d=_0x49867d;if(!_0x17b88d[_0x9418('0x7a')]||!_0x17b88d[_0x9418('0x7b')]||!_0x17b88d[_0x9418('0x7c')]||!_0x17b88d[_0x9418('0x7d')]||!_0x17b88d[_0x9418('0x6f')]){throw new db[(_0x9418('0x60'))]['ValidationError'](_0x9418('0x7e'));}if(_0x1b41ea[_0x9418('0x49')][_0x9418('0x7f')]&&(!_0x17b88d[_0x9418('0x80')]||!_0x17b88d[_0x9418('0x81')]||!_0x17b88d[_0x9418('0x82')]||!_0x17b88d[_0x9418('0x7d')]||!_0x17b88d['bucket'])){throw new db[(_0x9418('0x60'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x9418('0x83')][_0x9418('0x76')]({'where':{'id':_0x17b88d['transcribeAccountId']}});}})[_0x9418('0x26')](function(_0x52aed5){if(!_0x52aed5){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x52aed5['data1']||!_0x52aed5[_0x9418('0x84')]){throw new db[(_0x9418('0x60'))][(_0x9418('0x52'))](_0x9418('0x85'));}_0x327579=_0x52aed5;return getBucketslist(_0x327579[_0x9418('0x86')],_0x327579[_0x9418('0x84')],_0x17b88d[_0x9418('0x7c')]);})[_0x9418('0x26')](function(_0x209f20){if(_0x209f20&&_0x209f20[_0x9418('0x87')]){var _0x5b74f2=_[_0x9418('0x47')](_0x209f20[_0x9418('0x87')],function(_0x193d3e){return _0x193d3e[_0x9418('0x88')]===_0x17b88d[_0x9418('0x6f')];});if(!_0x5b74f2){logger[_0x9418('0x64')](util[_0x9418('0x32')](_0x9418('0x89'),_0x1b41ea[_0x9418('0x4a')]['id'],_0x17b88d[_0x9418('0x6f')]));return createBucket(_0x327579['data1'],_0x327579[_0x9418('0x84')],_0x17b88d[_0x9418('0x7c')],_0x17b88d[_0x9418('0x6f')]);}logger['info'](util[_0x9418('0x32')](_0x9418('0x8a'),_0x1b41ea['params']['id'],_0x17b88d[_0x9418('0x6f')]));return;}})['then'](function(_0x46c4db){if(_0x559b39[_0x9418('0x74')]===_0x9418('0x8b')){return transcribe(_0x1b41ea['params']['id'],_0x327579[_0x9418('0x86')],_0x327579[_0x9418('0x84')],_0x17b88d['transcribeRegion'],_0x17b88d[_0x9418('0x6f')],_0x559b39['value'],_0x17b88d['language']);}else{logger['info'](util[_0x9418('0x32')](_0x9418('0x8c'),_0x1b41ea[_0x9418('0x4a')]['id']));return{'transcribeStatus':_0x9418('0x8d')};}})[_0x9418('0x26')](function(_0x7e5862){if(_0x7e5862){_0x7e5862[_0x9418('0x8e')]=_0x1b41ea['body'][_0x9418('0x7f')];return _0x559b39['updateAttributes'](_0x7e5862);}})['then'](respondWithResult(_0x24b0f0,null))[_0x9418('0x4b')](handleError(_0x24b0f0,null));};function writeFile(_0x1b15c5,_0x1adfc9){return new Promise(function(_0x2a8b47,_0x11a9e6){fs[_0x9418('0x8f')](_0x1adfc9,_0x1b15c5,function(_0xb8e682,_0x28f14c){if(_0xb8e682){return _0x11a9e6(_0xb8e682);}else{return _0x2a8b47(_0x28f14c);}});});}exports[_0x9418('0x90')]=function(_0x276967,_0x5926e1,_0x480479){return db[_0x9418('0x2b')][_0x9418('0x76')]({'where':{'id':_0x276967[_0x9418('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5926e1))[_0x9418('0x26')](function(_0x1bc714){if(_0x1bc714&&_0x1bc714[_0x9418('0x91')]){var _0x3076ae=_0x1bc714['fileText'];var _0x5f0cea=config[_0x9418('0x92')]+_0x9418('0x93')+_0x1bc714['id']+_0x9418('0x94');if(fs['existsSync'](_0x5f0cea)){return _0x5f0cea;}return writeFile(_0x3076ae,_0x5f0cea)[_0x9418('0x26')](function(){return _0x5f0cea;});}else{throw new db[(_0x9418('0x60'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x9418('0x26')](function(_0x6842f7){return _0x5926e1[_0x9418('0x61')](_0x6842f7);})['catch'](handleError(_0x5926e1));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index e2d13b0..06b4bbf 100644 --- a/server/api/voiceRecording/voiceRecording.model.js +++ b/server/api/voiceRecording/voiceRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99e9=['exports','define','voice_recordings','uniqueid','transcribeStatus'];(function(_0x3e3955,_0x2a97dc){var _0x2d9397=function(_0x5eaa0e){while(--_0x5eaa0e){_0x3e3955['push'](_0x3e3955['shift']());}};_0x2d9397(++_0x2a97dc);}(_0x99e9,0xb4));var _0x999e=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0x99e9[_0x5ca353];return _0x4f2fe5;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x999e('0x0')]=function(_0x783676,_0x36812b){return _0x783676[_0x999e('0x1')]('VoiceRecording',attributes,{'tableName':_0x999e('0x2'),'paranoid':![],'indexes':[{'name':_0x999e('0x3'),'fields':[_0x999e('0x3')]},{'name':'transcribeStatus','fields':[_0x999e('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62da=['uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording'];(function(_0x1f2b28,_0x4e83d0){var _0x503427=function(_0xe8b2a7){while(--_0xe8b2a7){_0x1f2b28['push'](_0x1f2b28['shift']());}};_0x503427(++_0x4e83d0);}(_0x62da,0xc0));var _0xa62d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62da[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0xa62d('0x0'));module['exports']=function(_0x377e56,_0x31a9bf){return _0x377e56[_0xa62d('0x1')](_0xa62d('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xa62d('0x3'),'fields':[_0xa62d('0x3')]},{'name':_0xa62d('0x4'),'fields':[_0xa62d('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 76b56cb..e2f6756 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbff5=['catch','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','%s.cypher','encryptFile','value','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','options','raw','where','attributes','then','UpdateVoiceRecording','debug'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0xbff5,0x1bc));var _0x5bff=function(_0x53c68f,_0x44e782){_0x53c68f=_0x53c68f-0x0;var _0x1d6c3d=_0xbff5[_0x53c68f];return _0x1d6c3d;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['UpdateVoiceRecording']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['VoiceRecording'][_0x5bff('0x15')](_0xc9fbc3['body'],{'raw':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3['options'][_0x5bff('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')]['limit']||null:null})[_0x5bff('0x1a')](function(_0x263cf5){logger[_0x5bff('0x13')](_0x5bff('0x1b'),_0xc9fbc3);logger[_0x5bff('0x1c')](_0x5bff('0x1b'),_0xc9fbc3,JSON[_0x5bff('0xf')](_0x263cf5));_0x36653b(_0x263cf5);})[_0x5bff('0x1d')](function(_0x5e2ae8){logger['error'](_0x5bff('0x1b'),_0x5e2ae8['message'],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x5e2ae8[_0x5bff('0x12')]));});});};exports[_0x5bff('0x1e')]=function(_0x6f18f1){var _0xfa361d=this;return new Promise(function(_0x1140eb,_0x271f3c){var _0xedba9d=require('../../components/encryptor');var _0x4df57a;return db[_0x5bff('0x1f')][_0x5bff('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5bff('0x1a')](function(_0x588078){_0x4df57a=_0x588078;return db['VoiceRecording'][_0x5bff('0x21')](_0x6f18f1['body']);})[_0x5bff('0x1a')](function(_0x64e22){if(_0x4df57a[_0x5bff('0x22')]&&fs[_0x5bff('0x23')](_0x64e22['value'])){var _0x71783=util['format'](_0x5bff('0x24'),_0x64e22['value']);return _0xedba9d[_0x5bff('0x25')](_0x64e22[_0x5bff('0x26')],_0x71783,config[_0x5bff('0x27')][_0x5bff('0x28')])[_0x5bff('0x1a')](function(){fs[_0x5bff('0x29')](_0x64e22['value']);logger[_0x5bff('0x13')](_0x5bff('0x2a'));return _0x64e22;});}return _0x64e22;})[_0x5bff('0x1a')](function(_0x42fe4a){logger[_0x5bff('0x13')](_0x5bff('0x1e'),_0x6f18f1);logger[_0x5bff('0x1c')](_0x5bff('0x1e'),_0x6f18f1,JSON['stringify'](_0x42fe4a));_0x1140eb(_0x42fe4a);})[_0x5bff('0x1d')](function(_0x16042d){logger[_0x5bff('0x10')](_0x5bff('0x1e'),_0x16042d['message'],_0x6f18f1);_0x271f3c(_0xfa361d[_0x5bff('0x10')](0x1f4,_0x16042d[_0x5bff('0x12')]));});});}; \ No newline at end of file +var _0x9f0e=['format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','limit','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x9f0e,0x116));var _0xe9f0=function(_0x111a49,_0x5927cc){_0x111a49=_0x111a49-0x0;var _0x3c1fcf=_0x9f0e[_0x111a49];return _0x3c1fcf;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});}exports[_0xe9f0('0x16')]=function(_0x2ab12b){var _0x3da237=this;return new Promise(function(_0x59bf5a,_0x15a33b){return db[_0xe9f0('0x17')][_0xe9f0('0x18')](_0x2ab12b['body'],{'raw':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b['options'][_0xe9f0('0x1b')]||null:null,'attributes':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b['options']['attributes']||null:null,'limit':_0x2ab12b['options']?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1c')]||null:null})[_0xe9f0('0xb')](function(_0x316cdf){logger[_0xe9f0('0xc')]('UpdateVoiceRecording',_0x2ab12b);logger[_0xe9f0('0xf')](_0xe9f0('0x16'),_0x2ab12b,JSON[_0xe9f0('0x11')](_0x316cdf));_0x59bf5a(_0x316cdf);})[_0xe9f0('0x15')](function(_0x3ca991){logger[_0xe9f0('0x12')](_0xe9f0('0x16'),_0x3ca991[_0xe9f0('0x13')],_0x2ab12b);_0x15a33b(_0x3da237[_0xe9f0('0x12')](0x1f4,_0x3ca991[_0xe9f0('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x371095){var _0x27541f=this;return new Promise(function(_0x2ddfba,_0x1a8478){var _0x4cf1b1=require(_0xe9f0('0x1d'));var _0x2613fd;return db[_0xe9f0('0x1e')][_0xe9f0('0x1f')]({'attributes':['id',_0xe9f0('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x130f96){_0x2613fd=_0x130f96;return db[_0xe9f0('0x17')][_0xe9f0('0x21')](_0x371095[_0xe9f0('0x22')]);})[_0xe9f0('0xb')](function(_0xd19788){if(_0x2613fd[_0xe9f0('0x20')]&&fs[_0xe9f0('0x23')](_0xd19788[_0xe9f0('0x24')])){var _0x3dbe49=util[_0xe9f0('0x25')](_0xe9f0('0x26'),_0xd19788[_0xe9f0('0x24')]);return _0x4cf1b1[_0xe9f0('0x27')](_0xd19788[_0xe9f0('0x24')],_0x3dbe49,config[_0xe9f0('0x28')][_0xe9f0('0x29')])[_0xe9f0('0xb')](function(){fs[_0xe9f0('0x2a')](_0xd19788[_0xe9f0('0x24')]);logger[_0xe9f0('0xc')](_0xe9f0('0x2b'));return _0xd19788;});}return _0xd19788;})[_0xe9f0('0xb')](function(_0x3611c0){logger['info']('CreateVoiceRecording',_0x371095);logger['debug'](_0xe9f0('0x2c'),_0x371095,JSON['stringify'](_0x3611c0));_0x2ddfba(_0x3611c0);})[_0xe9f0('0x15')](function(_0xc5fa13){logger['error'](_0xe9f0('0x2c'),_0xc5fa13['message'],_0x371095);_0x1a8478(_0x27541f['error'](0x1f4,_0xc5fa13['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8fc5d4f..f39b905 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15be=['isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x43c01f,_0x31a879){var _0x12c1f3=function(_0x2b4b63){while(--_0x2b4b63){_0x43c01f['push'](_0x43c01f['shift']());}};_0x12c1f3(++_0x31a879);}(_0x15be,0x83));var _0xe15b=function(_0xfbf700,_0x23cabc){_0xfbf700=_0xfbf700-0x0;var _0x99d565=_0x15be[_0xfbf700];return _0x99d565;};'use strict';var multer=require('multer');var util=require(_0xe15b('0x0'));var path=require('path');var timeout=require(_0xe15b('0x1'));var express=require(_0xe15b('0x2'));var router=express['Router']();var fs_extra=require(_0xe15b('0x3'));var auth=require(_0xe15b('0x4'));var interaction=require(_0xe15b('0x5'));var config=require(_0xe15b('0x6'));var controller=require(_0xe15b('0x7'));router[_0xe15b('0x8')]('/',auth[_0xe15b('0x9')](),controller[_0xe15b('0xa')]);router['get'](_0xe15b('0xb'),auth[_0xe15b('0x9')](),controller[_0xe15b('0xc')]);router[_0xe15b('0x8')](_0xe15b('0xd'),auth[_0xe15b('0x9')](),controller['show']);router[_0xe15b('0xe')]('/',auth[_0xe15b('0x9')](),controller['create']);router[_0xe15b('0xf')]('/:id',auth[_0xe15b('0x9')](),controller[_0xe15b('0x10')]);router[_0xe15b('0x11')]('/:id',auth[_0xe15b('0x9')](),controller[_0xe15b('0x12')]);module[_0xe15b('0x13')]=router; \ No newline at end of file +var _0xf945=['/describe','describe','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x59dbc3,_0xfc1f22){var _0x1ba735=function(_0x5bc380){while(--_0x5bc380){_0x59dbc3['push'](_0x59dbc3['shift']());}};_0x1ba735(++_0xfc1f22);}(_0xf945,0xdc));var _0x5f94=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf945[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x5f94('0x0'));var util=require(_0x5f94('0x1'));var path=require('path');var timeout=require(_0x5f94('0x2'));var express=require(_0x5f94('0x3'));var router=express[_0x5f94('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5f94('0x5'));var controller=require(_0x5f94('0x6'));router[_0x5f94('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5f94('0x7')](_0x5f94('0x8'),auth['isAuthenticated'](),controller[_0x5f94('0x9')]);router[_0x5f94('0x7')]('/:id',auth[_0x5f94('0xa')](),controller[_0x5f94('0xb')]);router['post']('/',auth[_0x5f94('0xa')](),controller[_0x5f94('0xc')]);router[_0x5f94('0xd')](_0x5f94('0xe'),auth[_0x5f94('0xa')](),controller[_0x5f94('0xf')]);router[_0x5f94('0x10')](_0x5f94('0xe'),auth[_0x5f94('0xa')](),controller[_0x5f94('0x11')]);module[_0x5f94('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index bf2bc87..6919302 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.attributes.js +++ b/server/api/voiceTransferReport/voiceTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc72a=['STRING','sequelize','moment','exports','ENUM','attended'];(function(_0x47c3cf,_0x42eaa0){var _0x3be2ee=function(_0x31c1b5){while(--_0x31c1b5){_0x47c3cf['push'](_0x47c3cf['shift']());}};_0x3be2ee(++_0x42eaa0);}(_0xc72a,0xd3));var _0xac72=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0xc72a[_0x5d61b4];return _0x183fc5;};'use strict';var Sequelize=require(_0xac72('0x0'));var moment=require(_0xac72('0x1'));module[_0xac72('0x2')]={'type':{'type':Sequelize[_0xac72('0x3')]('blind',_0xac72('0x4'))},'result':{'type':Sequelize[_0xac72('0x5')]},'transfererchannel':{'type':Sequelize[_0xac72('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xac72('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xac72('0x5')]},'transferercontext':{'type':Sequelize[_0xac72('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xac72('0x5')]},'transfereechannel':{'type':Sequelize[_0xac72('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xac72('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xac72('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xac72('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xac72('0x5')]},'transfereecontext':{'type':Sequelize[_0xac72('0x5')]},'transfereeexten':{'type':Sequelize[_0xac72('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xac72('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xac72('0x5')]},'extension':{'type':Sequelize[_0xac72('0x5')]}}; \ No newline at end of file +var _0x143d=['STRING','Yes','sequelize','exports','ENUM','blind'];(function(_0x290c16,_0x1f8c5e){var _0x1d3233=function(_0x40669b){while(--_0x40669b){_0x290c16['push'](_0x290c16['shift']());}};_0x1d3233(++_0x1f8c5e);}(_0x143d,0x134));var _0xd143=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0x143d[_0x50d84b];return _0x6d4270;};'use strict';var Sequelize=require(_0xd143('0x0'));var moment=require('moment');module[_0xd143('0x1')]={'type':{'type':Sequelize[_0xd143('0x2')](_0xd143('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xd143('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xd143('0x4')]},'transferercalleridname':{'type':Sequelize[_0xd143('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd143('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xd143('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xd143('0x4')]},'transferercontext':{'type':Sequelize[_0xd143('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xd143('0x4')]},'transfereechannel':{'type':Sequelize[_0xd143('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xd143('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xd143('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xd143('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xd143('0x4')]},'transfereecontext':{'type':Sequelize[_0xd143('0x4')]},'transfereeexten':{'type':Sequelize[_0xd143('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xd143('0x4')]},'isexternal':{'type':Sequelize[_0xd143('0x2')](_0xd143('0x5'),'No')},'context':{'type':Sequelize[_0xd143('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1948cf9..6364084 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.controller.js +++ b/server/api/voiceTransferReport/voiceTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa01c=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','map','VoiceTransferReport','rawAttributes','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x20f7fa,_0x42290e){var _0x428923=function(_0x169de7){while(--_0x169de7){_0x20f7fa['push'](_0x20f7fa['shift']());}};_0x428923(++_0x42290e);}(_0xa01c,0xf8));var _0xca01=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa01c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca01('0x0'));var zipdir=require(_0xca01('0x1'));var jsonpatch=require(_0xca01('0x2'));var rp=require(_0xca01('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xca01('0x4'));var util=require(_0xca01('0x5'));var path=require(_0xca01('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca01('0x7'));var fs=require('fs');var fs_extra=require(_0xca01('0x8'));var _=require('lodash');var squel=require(_0xca01('0x9'));var crypto=require('crypto');var jsforce=require(_0xca01('0xa'));var deskjs=require(_0xca01('0xb'));var toCsv=require('to-csv');var querystring=require(_0xca01('0xc'));var Papa=require(_0xca01('0xd'));var Redis=require('ioredis');var authService=require(_0xca01('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xca01('0xf'));var hardwareService=require(_0xca01('0x10'));var logger=require(_0xca01('0x11'))('api');var utils=require(_0xca01('0x12'));var config=require(_0xca01('0x13'));var licenseUtil=require(_0xca01('0x14'));var db=require(_0xca01('0x15'))['db'];function respondWithStatusCode(_0x4e79e4,_0x287746){_0x287746=_0x287746||0xcc;return function(_0xb56653){if(_0xb56653){return _0x4e79e4[_0xca01('0x16')](_0x287746);}return _0x4e79e4[_0xca01('0x17')](_0x287746)[_0xca01('0x18')]();};}function respondWithResult(_0x106e8e,_0x34a88c){_0x34a88c=_0x34a88c||0xc8;return function(_0x55c3fd){if(_0x55c3fd){return _0x106e8e[_0xca01('0x17')](_0x34a88c)['json'](_0x55c3fd);}};}function respondWithFilteredResult(_0x524650,_0x297eb3){return function(_0x4d2720){if(_0x4d2720){var _0x24d197=typeof _0x297eb3[_0xca01('0x19')]===_0xca01('0x1a')&&typeof _0x297eb3[_0xca01('0x1b')]==='undefined';var _0x545d5f=_0x4d2720[_0xca01('0x1c')];var _0x5d335c=_0x24d197?0x0:_0x297eb3['offset'];var _0x170e3e=_0x24d197?_0x4d2720['count']:_0x297eb3['offset']+_0x297eb3[_0xca01('0x1b')];var _0x485d75;if(_0x170e3e>=_0x545d5f){_0x170e3e=_0x545d5f;_0x485d75=0xc8;}else{_0x485d75=0xce;}_0x524650['status'](_0x485d75);return _0x524650['set'](_0xca01('0x1d'),_0x5d335c+'-'+_0x170e3e+'/'+_0x545d5f)['json'](_0x4d2720);}return null;};}function patchUpdates(_0x5bd14a){return function(_0x232cd9){try{jsonpatch['apply'](_0x232cd9,_0x5bd14a,!![]);}catch(_0x29f91c){return BPromise[_0xca01('0x1e')](_0x29f91c);}return _0x232cd9['save']();};}function saveUpdates(_0x3e4154,_0x138149){return function(_0x198a07){if(_0x198a07){return _0x198a07[_0xca01('0x1f')](_0x3e4154)[_0xca01('0x20')](function(_0x8961ef){return _0x8961ef;});}return null;};}function removeEntity(_0x18815e,_0x36c1c2){return function(_0x106c3d){if(_0x106c3d){return _0x106c3d[_0xca01('0x21')]()['then'](function(){_0x18815e[_0xca01('0x17')](0xcc)[_0xca01('0x18')]();});}};}function handleEntityNotFound(_0x3ab0c2,_0x1d8e3a){return function(_0x2bd5e8){if(!_0x2bd5e8){_0x3ab0c2[_0xca01('0x16')](0x194);}return _0x2bd5e8;};}function handleError(_0x3a1939,_0x1948e5){_0x1948e5=_0x1948e5||0x1f4;return function(_0x20cb30){logger[_0xca01('0x22')](_0x20cb30[_0xca01('0x23')]);if(_0x20cb30[_0xca01('0x24')]){delete _0x20cb30[_0xca01('0x24')];}_0x3a1939[_0xca01('0x17')](_0x1948e5)['send'](_0x20cb30);};}exports['index']=function(_0x52d932,_0x4e7eaf){var _0x57c103={},_0x4c15bd={},_0x4154b2={'count':0x0,'rows':[]};var _0x3792fb=_[_0xca01('0x25')](db[_0xca01('0x26')][_0xca01('0x27')],function(_0x369130){return{'name':_0x369130['fieldName'],'type':_0x369130['type'][_0xca01('0x28')]};});_0x4c15bd['model']=_[_0xca01('0x25')](_0x3792fb,'name');_0x4c15bd['query']=_[_0xca01('0x29')](_0x52d932[_0xca01('0x2a')]);_0x4c15bd[_0xca01('0x2b')]=_['intersection'](_0x4c15bd['model'],_0x4c15bd[_0xca01('0x2a')]);_0x57c103[_0xca01('0x2c')]=_[_0xca01('0x2d')](_0x4c15bd[_0xca01('0x2e')],qs[_0xca01('0x2f')](_0x52d932['query'][_0xca01('0x2f')]));_0x57c103[_0xca01('0x2c')]=_0x57c103[_0xca01('0x2c')]['length']?_0x57c103[_0xca01('0x2c')]:_0x4c15bd[_0xca01('0x2e')];if(!_0x52d932['query'][_0xca01('0x30')](_0xca01('0x31'))){_0x57c103['limit']=qs[_0xca01('0x1b')](_0x52d932[_0xca01('0x2a')]['limit']);_0x57c103[_0xca01('0x19')]=qs[_0xca01('0x19')](_0x52d932[_0xca01('0x2a')][_0xca01('0x19')]);}_0x57c103['order']=qs[_0xca01('0x32')](_0x52d932[_0xca01('0x2a')][_0xca01('0x32')]);_0x57c103[_0xca01('0x33')]=qs[_0xca01('0x2b')](_['pick'](_0x52d932[_0xca01('0x2a')],_0x4c15bd['filters']),_0x3792fb);if(_0x52d932[_0xca01('0x2a')]['filter']){_0x57c103[_0xca01('0x33')]=_['merge'](_0x57c103[_0xca01('0x33')],{'$or':_['map'](_0x3792fb,function(_0x1b9c25){if(_0x1b9c25[_0xca01('0x34')]!==_0xca01('0x35')){var _0x7cdff5={};_0x7cdff5[_0x1b9c25[_0xca01('0x24')]]={'$like':'%'+_0x52d932['query']['filter']+'%'};return _0x7cdff5;}})});}_0x57c103=_['merge']({},_0x57c103,_0x52d932[_0xca01('0x36')]);var _0x32e164={'where':_0x57c103['where']};return db['VoiceTransferReport'][_0xca01('0x1c')](_0x32e164)[_0xca01('0x20')](function(_0x4873e8){_0x4154b2[_0xca01('0x1c')]=_0x4873e8;if(_0x52d932[_0xca01('0x2a')][_0xca01('0x37')]){_0x57c103['include']=[{'all':!![]}];}return db[_0xca01('0x26')][_0xca01('0x38')](_0x57c103);})[_0xca01('0x20')](function(_0x3c7361){_0x4154b2[_0xca01('0x39')]=_0x3c7361;return _0x4154b2;})[_0xca01('0x20')](respondWithFilteredResult(_0x4e7eaf,_0x57c103))[_0xca01('0x3a')](handleError(_0x4e7eaf,null));};exports[_0xca01('0x3b')]=function(_0x53ebc7,_0x202842){var _0x8d2c00={'raw':!![],'where':{'id':_0x53ebc7[_0xca01('0x3c')]['id']}},_0x3f2e39={};_0x3f2e39[_0xca01('0x2e')]=_['keys'](db[_0xca01('0x26')][_0xca01('0x27')]);_0x3f2e39[_0xca01('0x2a')]=_[_0xca01('0x29')](_0x53ebc7[_0xca01('0x2a')]);_0x3f2e39[_0xca01('0x2b')]=_[_0xca01('0x2d')](_0x3f2e39[_0xca01('0x2e')],_0x3f2e39[_0xca01('0x2a')]);_0x8d2c00['attributes']=_[_0xca01('0x2d')](_0x3f2e39['model'],qs[_0xca01('0x2f')](_0x53ebc7[_0xca01('0x2a')][_0xca01('0x2f')]));_0x8d2c00['attributes']=_0x8d2c00[_0xca01('0x2c')]['length']?_0x8d2c00['attributes']:_0x3f2e39[_0xca01('0x2e')];if(_0x53ebc7['query'][_0xca01('0x37')]){_0x8d2c00['include']=[{'all':!![]}];}_0x8d2c00=_[_0xca01('0x3d')]({},_0x8d2c00,_0x53ebc7['options']);return db[_0xca01('0x26')][_0xca01('0x3e')](_0x8d2c00)[_0xca01('0x20')](handleEntityNotFound(_0x202842,null))['then'](respondWithResult(_0x202842,null))['catch'](handleError(_0x202842,null));};exports[_0xca01('0x3f')]=function(_0x17cdf5,_0x23fa79){return db[_0xca01('0x26')][_0xca01('0x3f')](_0x17cdf5[_0xca01('0x40')],{})[_0xca01('0x20')](respondWithResult(_0x23fa79,0xc9))['catch'](handleError(_0x23fa79,null));};exports[_0xca01('0x1f')]=function(_0x1eb113,_0x912b84){if(_0x1eb113['body']['id']){delete _0x1eb113[_0xca01('0x40')]['id'];}return db[_0xca01('0x26')]['find']({'where':{'id':_0x1eb113['params']['id']}})[_0xca01('0x20')](handleEntityNotFound(_0x912b84,null))[_0xca01('0x20')](saveUpdates(_0x1eb113[_0xca01('0x40')],null))[_0xca01('0x20')](respondWithResult(_0x912b84,null))[_0xca01('0x3a')](handleError(_0x912b84,null));};exports[_0xca01('0x21')]=function(_0x4576ba,_0x5cbf0b){return db[_0xca01('0x26')][_0xca01('0x3e')]({'where':{'id':_0x4576ba[_0xca01('0x3c')]['id']}})[_0xca01('0x20')](handleEntityNotFound(_0x5cbf0b,null))[_0xca01('0x20')](removeEntity(_0x5cbf0b,null))[_0xca01('0x3a')](handleError(_0x5cbf0b,null));};exports[_0xca01('0x41')]=function(_0x4d16c2,_0x593b7){return db[_0xca01('0x26')]['describe']()['then'](respondWithResult(_0x593b7,null))['catch'](handleError(_0x593b7,null));}; \ No newline at end of file +var _0x28ff=['update','then','destroy','end','error','stack','name','index','VoiceTransferReport','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x28ff,0x160));var _0xf28f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x28ff[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xf28f('0x0'));var rimraf=require(_0xf28f('0x1'));var zipdir=require(_0xf28f('0x2'));var jsonpatch=require(_0xf28f('0x3'));var rp=require('request-promise');var moment=require(_0xf28f('0x4'));var BPromise=require(_0xf28f('0x5'));var Mustache=require(_0xf28f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf28f('0x7'));var csv=require(_0xf28f('0x8'));var ejs=require(_0xf28f('0x9'));var fs=require('fs');var fs_extra=require(_0xf28f('0xa'));var _=require(_0xf28f('0xb'));var squel=require(_0xf28f('0xc'));var crypto=require(_0xf28f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf28f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf28f('0xf'));var Redis=require(_0xf28f('0x10'));var authService=require(_0xf28f('0x11'));var qs=require(_0xf28f('0x12'));var as=require(_0xf28f('0x13'));var hardwareService=require(_0xf28f('0x14'));var logger=require(_0xf28f('0x15'))(_0xf28f('0x16'));var utils=require(_0xf28f('0x17'));var config=require(_0xf28f('0x18'));var licenseUtil=require(_0xf28f('0x19'));var db=require(_0xf28f('0x1a'))['db'];function respondWithStatusCode(_0x478864,_0x2bcffc){_0x2bcffc=_0x2bcffc||0xcc;return function(_0x31a98d){if(_0x31a98d){return _0x478864[_0xf28f('0x1b')](_0x2bcffc);}return _0x478864[_0xf28f('0x1c')](_0x2bcffc)['end']();};}function respondWithResult(_0x140f2c,_0x454eda){_0x454eda=_0x454eda||0xc8;return function(_0x4f9840){if(_0x4f9840){return _0x140f2c[_0xf28f('0x1c')](_0x454eda)[_0xf28f('0x1d')](_0x4f9840);}};}function respondWithFilteredResult(_0x440761,_0x405286){return function(_0x35f716){if(_0x35f716){var _0x5b0ff5=typeof _0x405286[_0xf28f('0x1e')]===_0xf28f('0x1f')&&typeof _0x405286[_0xf28f('0x20')]===_0xf28f('0x1f');var _0x2eaf7d=_0x35f716[_0xf28f('0x21')];var _0x3143c2=_0x5b0ff5?0x0:_0x405286[_0xf28f('0x1e')];var _0x4d4890=_0x5b0ff5?_0x35f716['count']:_0x405286[_0xf28f('0x1e')]+_0x405286[_0xf28f('0x20')];var _0x579c74;if(_0x4d4890>=_0x2eaf7d){_0x4d4890=_0x2eaf7d;_0x579c74=0xc8;}else{_0x579c74=0xce;}_0x440761[_0xf28f('0x1c')](_0x579c74);return _0x440761['set'](_0xf28f('0x22'),_0x3143c2+'-'+_0x4d4890+'/'+_0x2eaf7d)[_0xf28f('0x1d')](_0x35f716);}return null;};}function patchUpdates(_0x2e72a2){return function(_0x59d570){try{jsonpatch[_0xf28f('0x23')](_0x59d570,_0x2e72a2,!![]);}catch(_0x136405){return BPromise[_0xf28f('0x24')](_0x136405);}return _0x59d570[_0xf28f('0x25')]();};}function saveUpdates(_0x14e7ca,_0x4d6f99){return function(_0x4161f3){if(_0x4161f3){return _0x4161f3[_0xf28f('0x26')](_0x14e7ca)[_0xf28f('0x27')](function(_0x1f1c5d){return _0x1f1c5d;});}return null;};}function removeEntity(_0x513873,_0x4867d0){return function(_0x4d29af){if(_0x4d29af){return _0x4d29af[_0xf28f('0x28')]()['then'](function(){_0x513873[_0xf28f('0x1c')](0xcc)[_0xf28f('0x29')]();});}};}function handleEntityNotFound(_0x20d66c,_0x26b5a4){return function(_0x511fe4){if(!_0x511fe4){_0x20d66c[_0xf28f('0x1b')](0x194);}return _0x511fe4;};}function handleError(_0x3f2cd8,_0x483ec5){_0x483ec5=_0x483ec5||0x1f4;return function(_0x3cb6e2){logger[_0xf28f('0x2a')](_0x3cb6e2[_0xf28f('0x2b')]);if(_0x3cb6e2['name']){delete _0x3cb6e2[_0xf28f('0x2c')];}_0x3f2cd8[_0xf28f('0x1c')](_0x483ec5)['send'](_0x3cb6e2);};}exports[_0xf28f('0x2d')]=function(_0x11de17,_0x54a83f){var _0x5432b5={},_0x3ec75f={},_0x30e10c={'count':0x0,'rows':[]};var _0x198d19=_['map'](db[_0xf28f('0x2e')][_0xf28f('0x2f')],function(_0x1964de){return{'name':_0x1964de[_0xf28f('0x30')],'type':_0x1964de['type']['key']};});_0x3ec75f['model']=_['map'](_0x198d19,'name');_0x3ec75f[_0xf28f('0x31')]=_[_0xf28f('0x32')](_0x11de17[_0xf28f('0x31')]);_0x3ec75f['filters']=_[_0xf28f('0x33')](_0x3ec75f[_0xf28f('0x34')],_0x3ec75f['query']);_0x5432b5[_0xf28f('0x35')]=_[_0xf28f('0x33')](_0x3ec75f[_0xf28f('0x34')],qs[_0xf28f('0x36')](_0x11de17[_0xf28f('0x31')][_0xf28f('0x36')]));_0x5432b5['attributes']=_0x5432b5[_0xf28f('0x35')][_0xf28f('0x37')]?_0x5432b5['attributes']:_0x3ec75f[_0xf28f('0x34')];if(!_0x11de17[_0xf28f('0x31')][_0xf28f('0x38')]('nolimit')){_0x5432b5['limit']=qs[_0xf28f('0x20')](_0x11de17['query'][_0xf28f('0x20')]);_0x5432b5[_0xf28f('0x1e')]=qs[_0xf28f('0x1e')](_0x11de17[_0xf28f('0x31')][_0xf28f('0x1e')]);}_0x5432b5[_0xf28f('0x39')]=qs['sort'](_0x11de17['query'][_0xf28f('0x3a')]);_0x5432b5[_0xf28f('0x3b')]=qs[_0xf28f('0x3c')](_[_0xf28f('0x3d')](_0x11de17[_0xf28f('0x31')],_0x3ec75f[_0xf28f('0x3c')]),_0x198d19);if(_0x11de17[_0xf28f('0x31')][_0xf28f('0x3e')]){_0x5432b5[_0xf28f('0x3b')]=_[_0xf28f('0x3f')](_0x5432b5[_0xf28f('0x3b')],{'$or':_[_0xf28f('0x40')](_0x198d19,function(_0x4a4d4f){if(_0x4a4d4f[_0xf28f('0x41')]!==_0xf28f('0x42')){var _0x5216bf={};_0x5216bf[_0x4a4d4f[_0xf28f('0x2c')]]={'$like':'%'+_0x11de17[_0xf28f('0x31')][_0xf28f('0x3e')]+'%'};return _0x5216bf;}})});}_0x5432b5=_[_0xf28f('0x3f')]({},_0x5432b5,_0x11de17['options']);var _0x51a43a={'where':_0x5432b5[_0xf28f('0x3b')]};return db[_0xf28f('0x2e')][_0xf28f('0x21')](_0x51a43a)[_0xf28f('0x27')](function(_0x1e6469){_0x30e10c[_0xf28f('0x21')]=_0x1e6469;if(_0x11de17[_0xf28f('0x31')]['includeAll']){_0x5432b5[_0xf28f('0x43')]=[{'all':!![]}];}return db[_0xf28f('0x2e')][_0xf28f('0x44')](_0x5432b5);})[_0xf28f('0x27')](function(_0x22f0b3){_0x30e10c[_0xf28f('0x45')]=_0x22f0b3;return _0x30e10c;})[_0xf28f('0x27')](respondWithFilteredResult(_0x54a83f,_0x5432b5))[_0xf28f('0x46')](handleError(_0x54a83f,null));};exports['show']=function(_0x3b1310,_0x12bfdd){var _0xca86c4={'raw':!![],'where':{'id':_0x3b1310[_0xf28f('0x47')]['id']}},_0x11af0a={};_0x11af0a[_0xf28f('0x34')]=_[_0xf28f('0x32')](db['VoiceTransferReport'][_0xf28f('0x2f')]);_0x11af0a[_0xf28f('0x31')]=_[_0xf28f('0x32')](_0x3b1310[_0xf28f('0x31')]);_0x11af0a[_0xf28f('0x3c')]=_[_0xf28f('0x33')](_0x11af0a[_0xf28f('0x34')],_0x11af0a[_0xf28f('0x31')]);_0xca86c4[_0xf28f('0x35')]=_['intersection'](_0x11af0a[_0xf28f('0x34')],qs[_0xf28f('0x36')](_0x3b1310['query'][_0xf28f('0x36')]));_0xca86c4['attributes']=_0xca86c4[_0xf28f('0x35')][_0xf28f('0x37')]?_0xca86c4[_0xf28f('0x35')]:_0x11af0a[_0xf28f('0x34')];if(_0x3b1310[_0xf28f('0x31')][_0xf28f('0x48')]){_0xca86c4[_0xf28f('0x43')]=[{'all':!![]}];}_0xca86c4=_[_0xf28f('0x3f')]({},_0xca86c4,_0x3b1310[_0xf28f('0x49')]);return db['VoiceTransferReport'][_0xf28f('0x4a')](_0xca86c4)[_0xf28f('0x27')](handleEntityNotFound(_0x12bfdd,null))['then'](respondWithResult(_0x12bfdd,null))[_0xf28f('0x46')](handleError(_0x12bfdd,null));};exports[_0xf28f('0x4b')]=function(_0x3739fd,_0x2b5f2d){return db['VoiceTransferReport'][_0xf28f('0x4b')](_0x3739fd[_0xf28f('0x4c')],{})[_0xf28f('0x27')](respondWithResult(_0x2b5f2d,0xc9))[_0xf28f('0x46')](handleError(_0x2b5f2d,null));};exports[_0xf28f('0x26')]=function(_0x4923dd,_0x87acf0){if(_0x4923dd[_0xf28f('0x4c')]['id']){delete _0x4923dd[_0xf28f('0x4c')]['id'];}return db[_0xf28f('0x2e')][_0xf28f('0x4a')]({'where':{'id':_0x4923dd[_0xf28f('0x47')]['id']}})[_0xf28f('0x27')](handleEntityNotFound(_0x87acf0,null))[_0xf28f('0x27')](saveUpdates(_0x4923dd['body'],null))[_0xf28f('0x27')](respondWithResult(_0x87acf0,null))['catch'](handleError(_0x87acf0,null));};exports[_0xf28f('0x28')]=function(_0x236a9e,_0x528931){return db[_0xf28f('0x2e')]['find']({'where':{'id':_0x236a9e['params']['id']}})[_0xf28f('0x27')](handleEntityNotFound(_0x528931,null))[_0xf28f('0x27')](removeEntity(_0x528931,null))['catch'](handleError(_0x528931,null));};exports[_0xf28f('0x4d')]=function(_0x3a0fd1,_0x378a6e){return db[_0xf28f('0x2e')]['describe']()[_0xf28f('0x27')](respondWithResult(_0x378a6e,null))['catch'](handleError(_0x378a6e,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 0d73f1b..a806523 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.model.js +++ b/server/api/voiceTransferReport/voiceTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4180=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x29f574,_0x4e27dd){var _0xbc2316=function(_0x5309f4){while(--_0x5309f4){_0x29f574['push'](_0x29f574['shift']());}};_0xbc2316(++_0x4e27dd);}(_0x4180,0x14d));var _0x0418=function(_0x152dd9,_0x42b68e){_0x152dd9=_0x152dd9-0x0;var _0x216bf4=_0x4180[_0x152dd9];return _0x216bf4;};'use strict';var _=require(_0x0418('0x0'));var util=require(_0x0418('0x1'));var logger=require(_0x0418('0x2'))(_0x0418('0x3'));var moment=require(_0x0418('0x4'));var BPromise=require('bluebird');var rp=require(_0x0418('0x5'));var fs=require('fs');var path=require(_0x0418('0x6'));var rimraf=require(_0x0418('0x7'));var config=require(_0x0418('0x8'));var attributes=require(_0x0418('0x9'));module[_0x0418('0xa')]=function(_0x4c4188,_0x452c60){return _0x4c4188[_0x0418('0xb')](_0x0418('0xc'),attributes,{'tableName':_0x0418('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f3c=['path','rimraf','./voiceTransferReport.attributes','define','VoiceTransferReport','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1df7bb,_0x42a9df){var _0x3549d4=function(_0x220016){while(--_0x220016){_0x1df7bb['push'](_0x1df7bb['shift']());}};_0x3549d4(++_0x42a9df);}(_0x2f3c,0xeb));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc2f3('0x0'))(_0xc2f3('0x1'));var moment=require(_0xc2f3('0x2'));var BPromise=require(_0xc2f3('0x3'));var rp=require(_0xc2f3('0x4'));var fs=require('fs');var path=require(_0xc2f3('0x5'));var rimraf=require(_0xc2f3('0x6'));var config=require('../../config/environment');var attributes=require(_0xc2f3('0x7'));module['exports']=function(_0x49728c,_0x56cd59){return _0x49728c[_0xc2f3('0x8')](_0xc2f3('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 9f2230f..e1eb614 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.rpc.js +++ b/server/api/voiceTransferReport/voiceTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc959=['stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x3140d8,_0x9aabed){var _0x5a39e2=function(_0x4ecec1){while(--_0x4ecec1){_0x3140d8['push'](_0x3140d8['shift']());}};_0x5a39e2(++_0x9aabed);}(_0xc959,0x169));var _0x9c95=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc959[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x9c95('0x0'));var util=require(_0x9c95('0x1'));var moment=require(_0x9c95('0x2'));var BPromise=require(_0x9c95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c95('0x4'));var db=require(_0x9c95('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9c95('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c95('0x7'));var client=jayson[_0x9c95('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23ce7f,_0xde50b8,_0x50222a){return new BPromise(function(_0x446bc6,_0xab6ce3){return client[_0x9c95('0x9')](_0x23ce7f,_0x50222a)[_0x9c95('0xa')](function(_0x47fca8){logger[_0x9c95('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0xde50b8,_0x9c95('0xc'));logger[_0x9c95('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0xde50b8,_0x9c95('0xc'),JSON[_0x9c95('0xe')](_0x47fca8));if(_0x47fca8[_0x9c95('0xf')]){if(_0x47fca8[_0x9c95('0xf')]['code']===0x1f4){logger[_0x9c95('0xf')](_0x9c95('0x10'),_0xde50b8,_0x47fca8['error'][_0x9c95('0x11')]);return _0xab6ce3(_0x47fca8[_0x9c95('0xf')]['message']);}logger[_0x9c95('0xf')](_0x9c95('0x10'),_0xde50b8,_0x47fca8[_0x9c95('0xf')]['message']);return _0x446bc6(_0x47fca8['error'][_0x9c95('0x11')]);}else{logger[_0x9c95('0xb')](_0x9c95('0x10'),_0xde50b8,_0x9c95('0xc'));_0x446bc6(_0x47fca8[_0x9c95('0x12')][_0x9c95('0x11')]);}})[_0x9c95('0x13')](function(_0x56ce2a){logger[_0x9c95('0xf')](_0x9c95('0x10'),_0xde50b8,_0x56ce2a);_0xab6ce3(_0x56ce2a);});});}exports[_0x9c95('0x14')]=function(_0x3e88db){var _0x20ca83=this;return new Promise(function(_0x40710f,_0x166713){return db['VoiceTransferReport'][_0x9c95('0x15')](_0x3e88db[_0x9c95('0x16')],{'raw':_0x3e88db[_0x9c95('0x17')]?_0x3e88db[_0x9c95('0x17')][_0x9c95('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x41c69d){logger['info'](_0x9c95('0x14'),_0x3e88db);logger['debug'](_0x9c95('0x14'),_0x3e88db,JSON[_0x9c95('0xe')](_0x41c69d));_0x40710f(_0x41c69d);})[_0x9c95('0x13')](function(_0xc094f9){logger['error'](_0x9c95('0x14'),_0xc094f9[_0x9c95('0x11')],_0x3e88db);_0x166713(_0x20ca83[_0x9c95('0xf')](0x1f4,_0xc094f9[_0x9c95('0x11')]));});});}; \ No newline at end of file +var _0x1989=['jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateVoiceTransferReport','VoiceTransferReport','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0x1989,0x12f));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9198('0x0'));var util=require(_0x9198('0x1'));var moment=require(_0x9198('0x2'));var BPromise=require(_0x9198('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9198('0x4'));var db=require(_0x9198('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9198('0x6'))(_0x9198('0x7'));var config=require(_0x9198('0x8'));var jayson=require(_0x9198('0x9'));var client=jayson[_0x9198('0xa')][_0x9198('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ec365,_0xb4eaa7,_0x12f550){return new BPromise(function(_0x6b79d6,_0x5622e1){return client[_0x9198('0xc')](_0x1ec365,_0x12f550)['then'](function(_0x490321){logger[_0x9198('0xd')](_0x9198('0xe'),_0xb4eaa7,'request\x20sent');logger[_0x9198('0xf')](_0x9198('0x10'),_0xb4eaa7,_0x9198('0x11'),JSON[_0x9198('0x12')](_0x490321));if(_0x490321['error']){if(_0x490321[_0x9198('0x13')]['code']===0x1f4){logger[_0x9198('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0xb4eaa7,_0x490321[_0x9198('0x13')][_0x9198('0x14')]);return _0x5622e1(_0x490321['error'][_0x9198('0x14')]);}logger[_0x9198('0x13')](_0x9198('0xe'),_0xb4eaa7,_0x490321[_0x9198('0x13')]['message']);return _0x6b79d6(_0x490321['error'][_0x9198('0x14')]);}else{logger[_0x9198('0xd')](_0x9198('0xe'),_0xb4eaa7,_0x9198('0x11'));_0x6b79d6(_0x490321[_0x9198('0x15')][_0x9198('0x14')]);}})['catch'](function(_0x38ad3d){logger[_0x9198('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0xb4eaa7,_0x38ad3d);_0x5622e1(_0x38ad3d);});});}exports[_0x9198('0x16')]=function(_0x4db4fa){var _0x870959=this;return new Promise(function(_0x59d287,_0x16ee02){return db[_0x9198('0x17')]['create'](_0x4db4fa['body'],{'raw':_0x4db4fa[_0x9198('0x18')]?_0x4db4fa[_0x9198('0x18')][_0x9198('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1d3bdf){logger[_0x9198('0xd')](_0x9198('0x16'),_0x4db4fa);logger[_0x9198('0xf')]('CreateVoiceTransferReport',_0x4db4fa,JSON['stringify'](_0x1d3bdf));_0x59d287(_0x1d3bdf);})['catch'](function(_0x34f456){logger[_0x9198('0x13')](_0x9198('0x16'),_0x34f456[_0x9198('0x14')],_0x4db4fa);_0x16ee02(_0x870959[_0x9198('0x13')](0x1f4,_0x34f456[_0x9198('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 24e2cc7..d25e504 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x36feba,_0x541932){var _0x358e41=function(_0x3dc247){while(--_0x3dc247){_0x36feba['push'](_0x36feba['shift']());}};_0x358e41(++_0x541932);}(_0x9bde,0xe1));var _0xe9bd=function(_0xb200ba,_0x2c38a9){_0xb200ba=_0xb200ba-0x0;var _0x31fd46=_0x9bde[_0xb200ba];return _0x31fd46;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x22f75e,_0x4a9e06){var _0x1f6ab3=function(_0x1479d4){while(--_0x1479d4){_0x22f75e['push'](_0x22f75e['shift']());}};_0x1f6ab3(++_0x4a9e06);}(_0x34e8,0x12c));var _0x834e=function(_0x528f04,_0x42a1ba){_0x528f04=_0x528f04-0x0;var _0x48e4dc=_0x34e8[_0x528f04];return _0x48e4dc;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1700afc..1c44d14 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','name','status','send','NotFound','request','then','error','message','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','\x20not\x20found!','body','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','sessionId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls'];(function(_0x45d926,_0x2b6cb0){var _0x3c32ba=function(_0x209f10){while(--_0x209f10){_0x45d926['push'](_0x45d926['shift']());}};_0x3c32ba(++_0x2b6cb0);}(_0xe706,0xa3));var _0x6e70=function(_0x159eab,_0x22d972){_0x159eab=_0x159eab-0x0;var _0x47e933=_0xe706[_0x159eab];return _0x47e933;};'use strict';var path=require(_0x6e70('0x0'));var fs=require('fs');var _=require(_0x6e70('0x1'));var db=require(_0x6e70('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var jayson=require(_0x6e70('0x5'));var amiClient=jayson[_0x6e70('0x6')][_0x6e70('0x7')]({'port':0x232a});var logger=require(_0x6e70('0x8'))(_0x6e70('0x9'));var Redis=require(_0x6e70('0xa'));config[_0x6e70('0xb')]=_[_0x6e70('0xc')](config[_0x6e70('0xb')],{'host':_0x6e70('0xd'),'port':0x18eb});var io=require(_0x6e70('0xe'))(new Redis(config[_0x6e70('0xb')]));var Schema=require(_0x6e70('0xf'));var originateValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],_0x6e70('0x11')]},'callNumber':{'type':_0x6e70('0x12'),'required':[!![],_0x6e70('0x13')]},'callerId':{'type':_0x6e70('0x12')},'callbackUrl':{'type':_0x6e70('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],_0x6e70('0x11')]},'sessionId':{'type':_0x6e70('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6e70('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],_0x6e70('0x11')]},'sessionId':{'type':_0x6e70('0x12'),'required':[!![],_0x6e70('0x14')]},'transferNumber':{'type':_0x6e70('0x12'),'required':[!![],_0x6e70('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6e70('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6e70('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x6e70('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x24f3ac,_0x5c3fe7,_0x2efc0f){logger[_0x6e70('0x16')](_0x24f3ac,_0x5c3fe7,JSON['stringify'](_0x2efc0f));io['to'](_0x24f3ac)['emit'](_0x5c3fe7,_0x2efc0f);}function handleError(_0x3bd572){return function(_0x5ea7a5){console[_0x6e70('0x17')](_0x6e70('0x18'),_0x5ea7a5,_0x5ea7a5 instanceof RangeError);logger['error'](_0x5ea7a5['stack']);if(_0x5ea7a5 instanceof RangeError){if(_0x5ea7a5[_0x6e70('0x19')]){delete _0x5ea7a5[_0x6e70('0x19')];}_0x3bd572[_0x6e70('0x1a')](0x194)[_0x6e70('0x1b')](_0x5ea7a5);}else{if(_0x5ea7a5[_0x6e70('0x19')]){delete _0x5ea7a5[_0x6e70('0x19')];}_0x3bd572[_0x6e70('0x1a')](0x1f4)[_0x6e70('0x1b')](_0x5ea7a5);}};}function checkError(){return function(_0x29326f){if(!_0x29326f){throw new RangeError(_0x6e70('0x1c'));}return _0x29326f;};}function respondWithRpcPromise(_0x4a0cfe,_0x228350){return new BPromise(function(_0x344b65,_0x27b294){var _0x502b2d=amiClient;return _0x502b2d[_0x6e70('0x1d')](_0x4a0cfe,_0x228350)[_0x6e70('0x1e')](function(_0x3337a6){if(_0x3337a6['error']){if(_0x3337a6[_0x6e70('0x1f')]['code']===0x1f4){return _0x27b294(_0x3337a6['error']['message']);}return _0x344b65(_0x3337a6[_0x6e70('0x1f')][_0x6e70('0x20')]);}else{_0x344b65(_0x3337a6['result']);}})[_0x6e70('0x21')](function(_0x1196ed){_0x27b294(_0x1196ed);});});}function getAgent(_0x5f268f){return db[_0x6e70('0x22')][_0x6e70('0x23')]({'where':{'id':_0x5f268f,'role':_0x6e70('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x54a5fe,_0x2c4d37){return new BPromise(function(_0x3af17f,_0x83c836){var _0x114344=respondWithRpcPromise(_0x6e70('0x25'));var _0x5d772a=getAgent(_0x54a5fe);Promise[_0x6e70('0x26')]([_0x114344,_0x5d772a])[_0x6e70('0x1e')](function(_0xecf336){var _0x2864a0=_0xecf336[0x0];var _0x396a67=_0xecf336[0x1];var _0x20a225=_[_0x6e70('0x27')](_0x2864a0[_0x6e70('0x28')],function(_0x3a0821){return _0x3a0821[_0x6e70('0x29')]==_0x396a67['id']&&_0x3a0821['sessionId']==_0x2c4d37;});if(_0x20a225[_0x6e70('0x2a')]==0x1){_0x3af17f(_0x396a67);}else{_0x83c836(new RangeError('sessionId\x20'+_0x2c4d37+_0x6e70('0x2b')));}});});}exports['originate']=function(_0xdd7cc1,_0x2722e8){logger[_0x6e70('0x16')]('originate\x20fired:',_0xdd7cc1[_0x6e70('0x2c')]);var _0x42b094=originateValidation['validate'](_0xdd7cc1[_0x6e70('0x2c')]);if(_0x42b094[_0x6e70('0x2a')]>0x0){return _0x2722e8['status'](0x190)[_0x6e70('0x2d')](_0x42b094);}var _0x3665a1=_0xdd7cc1[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0x3b4a13=_0xdd7cc1[_0x6e70('0x2c')][_0x6e70('0x2f')];var _0x3f42bd=_0xdd7cc1[_0x6e70('0x2c')][_0x6e70('0x30')];var _0x4d32d8=_0xdd7cc1[_0x6e70('0x2c')]['callbackUrl'];return getAgent(_0x3665a1)[_0x6e70('0x1e')](function(_0x3222a2){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x3222a2[_0x6e70('0x19')]),_0x6e70('0x34'),{'callNumber':_0x3b4a13,'callerId':_0x3f42bd,'callbackUrl':_0x4d32d8});return _0x2722e8[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x35')});})[_0x6e70('0x21')](handleError(_0x2722e8));};exports['hangup']=function(_0x5446a2,_0x5424eb){logger[_0x6e70('0x16')](_0x6e70('0x36'),_0x5446a2[_0x6e70('0x2c')]);var _0x1f6955=hangupValidation[_0x6e70('0xf')](_0x5446a2[_0x6e70('0x2c')]);if(_0x1f6955['length']>0x0){return _0x5424eb[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x1f6955);}var _0x1c5cde=_0x5446a2[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0x37bf46=_0x5446a2[_0x6e70('0x2c')][_0x6e70('0x37')];return getAgent(_0x1c5cde)['then'](function(_0x2c0bd1){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x2c0bd1[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x2c0bd1[_0x6e70('0x19')]),'webbar:hangup',{'sessionId':_0x37bf46});return _0x5424eb['status'](0xc8)['json']({'error':![],'message':_0x6e70('0x38')});})[_0x6e70('0x21')](handleError(_0x5424eb));};exports[_0x6e70('0x39')]=function(_0x64ff8e,_0x45c83a){logger['info'](_0x6e70('0x3a'),_0x64ff8e[_0x6e70('0x2c')]);var _0x2a2aca=answerValidation['validate'](_0x64ff8e['body']);if(_0x2a2aca['length']>0x0){return _0x45c83a[_0x6e70('0x1a')](0x190)['json'](_0x2a2aca);}var _0x42f49a=_0x64ff8e[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0x75a90d=_0x64ff8e['body'][_0x6e70('0x37')];return getAgent(_0x42f49a)['then'](function(_0x9f5b94){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x9f5b94[_0x6e70('0x19')]);emit(util['format'](_0x6e70('0x33'),_0x9f5b94[_0x6e70('0x19')]),_0x6e70('0x3b'),{'sessionId':_0x75a90d});return _0x45c83a[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x3c')});})[_0x6e70('0x21')](handleError(_0x45c83a));};exports['hold']=function(_0x5f1c92,_0x3884a4){logger[_0x6e70('0x16')](_0x6e70('0x3d'),_0x5f1c92[_0x6e70('0x2c')]);var _0x172e8a=holdValidation[_0x6e70('0xf')](_0x5f1c92['body']);if(_0x172e8a[_0x6e70('0x2a')]>0x0){return _0x3884a4['status'](0x190)[_0x6e70('0x2d')](_0x172e8a);}var _0x3836e4=_0x5f1c92['body']['userId'];var _0x333abd=_0x5f1c92[_0x6e70('0x2c')][_0x6e70('0x37')];return getAgent(_0x3836e4)['then'](function(_0x4af9b1){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x4af9b1[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x4af9b1[_0x6e70('0x19')]),'webbar:hold',{'sessionId':_0x333abd});return _0x3884a4[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x3e')});})[_0x6e70('0x21')](handleError(_0x3884a4));};exports[_0x6e70('0x3f')]=function(_0x4b354e,_0x4ae901){logger[_0x6e70('0x16')](_0x6e70('0x40'),_0x4b354e[_0x6e70('0x2c')]);var _0x15f994=unholdValidation[_0x6e70('0xf')](_0x4b354e['body']);if(_0x15f994[_0x6e70('0x2a')]>0x0){return _0x4ae901[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x15f994);}var _0x23ebfb=_0x4b354e[_0x6e70('0x2c')]['userId'];var _0x1142cd=_0x4b354e[_0x6e70('0x2c')][_0x6e70('0x37')];return getAgent(_0x23ebfb)[_0x6e70('0x1e')](function(_0x8ef4f7){logger[_0x6e70('0x16')]('entityFound:',_0x8ef4f7[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')]('user:%s',_0x8ef4f7[_0x6e70('0x19')]),_0x6e70('0x41'),{'sessionId':_0x1142cd});return _0x4ae901['status'](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x42')});})[_0x6e70('0x21')](handleError(_0x4ae901));};exports[_0x6e70('0x43')]=function(_0xfcadfe,_0x53f8fc){logger[_0x6e70('0x16')](_0x6e70('0x44'),_0x53f8fc[_0x6e70('0x2c')]);var _0x13be81=callsValidation[_0x6e70('0xf')](_0xfcadfe[_0x6e70('0x2c')]);if(_0x13be81[_0x6e70('0x2a')]>0x0){return _0x53f8fc[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x13be81);}var _0x344676=_0xfcadfe[_0x6e70('0x2c')][_0x6e70('0x2e')];var _0xb8f78=respondWithRpcPromise(_0x6e70('0x25'));var _0x2a9173=getAgent(_0x344676);return Promise[_0x6e70('0x26')]([_0xb8f78,_0x2a9173])[_0x6e70('0x1e')](function(_0x4329a6){var _0x2a8627=_0x4329a6[0x0];var _0x1c7dca=_0x4329a6[0x1];var _0x4c6aab=_[_0x6e70('0x27')](_0x2a8627[_0x6e70('0x28')],function(_0x180a13){return _0x180a13[_0x6e70('0x29')]==_0x1c7dca['id'];});return _0x53f8fc[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'count':_0x4c6aab['length'],'rows':_0x4c6aab});})[_0x6e70('0x21')](handleError(_0x53f8fc));};exports[_0x6e70('0x45')]=function(_0x4f813a,_0x246ea2){logger[_0x6e70('0x16')](_0x6e70('0x46'),_0x4f813a['body']);var _0x51f268=conferenceValidation[_0x6e70('0xf')](_0x4f813a[_0x6e70('0x2c')]);if(_0x51f268[_0x6e70('0x2a')]>0x0){return _0x246ea2[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x51f268);}var _0x739946=_0x4f813a[_0x6e70('0x2c')]['userId'];return getAgent(_0x739946)['then'](function(_0x2c8dc6){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x2c8dc6[_0x6e70('0x19')]);emit(util['format']('user:%s',_0x2c8dc6[_0x6e70('0x19')]),_0x6e70('0x47'));return _0x246ea2['status'](0xc8)['json']({'error':![],'message':_0x6e70('0x48')});})['catch'](handleError(_0x246ea2));};exports[_0x6e70('0x49')]=function(_0x23900b,_0x3b4da0){logger[_0x6e70('0x16')](_0x6e70('0x4a'),_0x23900b[_0x6e70('0x2c')]);var _0x2a9876=transferValidation[_0x6e70('0xf')](_0x23900b['body']);if(_0x2a9876[_0x6e70('0x2a')]>0x0){return _0x3b4da0[_0x6e70('0x1a')](0x190)[_0x6e70('0x2d')](_0x2a9876);}var _0x346c79=_0x23900b[_0x6e70('0x2c')]['userId'];var _0x5f5b02=_0x23900b['body'][_0x6e70('0x37')];var _0xd91b9=_0x23900b[_0x6e70('0x2c')]['transferNumber'];return getAgent(_0x346c79)['then'](function(_0x2fc2a2){logger[_0x6e70('0x16')](_0x6e70('0x31'),_0x2fc2a2[_0x6e70('0x19')]);emit(util[_0x6e70('0x32')](_0x6e70('0x33'),_0x2fc2a2['name']),_0x6e70('0x4b'),{'sessionId':_0x5f5b02,'transferNumber':_0xd91b9});return _0x3b4da0[_0x6e70('0x1a')](0xc8)[_0x6e70('0x2d')]({'error':![],'message':_0x6e70('0x4c')});})['catch'](handleError(_0x3b4da0));}; \ No newline at end of file +var _0x9f62=['user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','validate','webbar:answer','answer\x20executed!','hold','entityFound:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','callNumber\x20is\x20required','string','userId\x20is\x20required','transferNumber\x20is\x20required','number','info','stringify','log','handleError:','stack','name','status','send','NotFound','request','error','code','message','result','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','format'];(function(_0x4ff521,_0x44efaa){var _0x8313e1=function(_0x4b4b4d){while(--_0x4b4b4d){_0x4ff521['push'](_0x4ff521['shift']());}};_0x8313e1(++_0x44efaa);}(_0x9f62,0x154));var _0x29f6=function(_0x3d743f,_0xf96b6){_0x3d743f=_0x3d743f-0x0;var _0x14f749=_0x9f62[_0x3d743f];return _0x14f749;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x29f6('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x29f6('0x1'));var util=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x29f6('0x4')]({'port':0x232a});var logger=require(_0x29f6('0x5'))(_0x29f6('0x6'));var Redis=require(_0x29f6('0x7'));config['redis']=_[_0x29f6('0x8')](config[_0x29f6('0x9')],{'host':_0x29f6('0xa'),'port':0x18eb});var io=require(_0x29f6('0xb'))(new Redis(config[_0x29f6('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x29f6('0xc')]},'callerId':{'type':_0x29f6('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x29f6('0xd'),'required':[!![],_0x29f6('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]},'sessionId':{'type':_0x29f6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x29f6('0x10'),'required':[!![],_0x29f6('0xe')]}});function emit(_0x1dde97,_0x3a75d0,_0x25e5a2){logger[_0x29f6('0x11')](_0x1dde97,_0x3a75d0,JSON[_0x29f6('0x12')](_0x25e5a2));io['to'](_0x1dde97)['emit'](_0x3a75d0,_0x25e5a2);}function handleError(_0x51c92f){return function(_0x2e66d3){console[_0x29f6('0x13')](_0x29f6('0x14'),_0x2e66d3,_0x2e66d3 instanceof RangeError);logger['error'](_0x2e66d3[_0x29f6('0x15')]);if(_0x2e66d3 instanceof RangeError){if(_0x2e66d3[_0x29f6('0x16')]){delete _0x2e66d3['name'];}_0x51c92f[_0x29f6('0x17')](0x194)[_0x29f6('0x18')](_0x2e66d3);}else{if(_0x2e66d3[_0x29f6('0x16')]){delete _0x2e66d3[_0x29f6('0x16')];}_0x51c92f[_0x29f6('0x17')](0x1f4)[_0x29f6('0x18')](_0x2e66d3);}};}function checkError(){return function(_0x5673c8){if(!_0x5673c8){throw new RangeError(_0x29f6('0x19'));}return _0x5673c8;};}function respondWithRpcPromise(_0x59def4,_0x4acb15){return new BPromise(function(_0x470019,_0x1fa159){var _0x39c6b3=amiClient;return _0x39c6b3[_0x29f6('0x1a')](_0x59def4,_0x4acb15)['then'](function(_0x2c672e){if(_0x2c672e['error']){if(_0x2c672e[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){return _0x1fa159(_0x2c672e[_0x29f6('0x1b')][_0x29f6('0x1d')]);}return _0x470019(_0x2c672e['error'][_0x29f6('0x1d')]);}else{_0x470019(_0x2c672e[_0x29f6('0x1e')]);}})['catch'](function(_0x1401fb){_0x1fa159(_0x1401fb);});});}function getAgent(_0x45f792){return db[_0x29f6('0x1f')][_0x29f6('0x20')]({'where':{'id':_0x45f792,'role':_0x29f6('0x21')}})[_0x29f6('0x22')](checkError());}function getAgentCheckSession(_0x23c630,_0x50cdd2){return new BPromise(function(_0x2183b7,_0x454a4a){var _0x1ab8d8=respondWithRpcPromise(_0x29f6('0x23'));var _0xda0a63=getAgent(_0x23c630);Promise[_0x29f6('0x24')]([_0x1ab8d8,_0xda0a63])[_0x29f6('0x22')](function(_0x17b2f2){var _0x3d88db=_0x17b2f2[0x0];var _0x13a3a2=_0x17b2f2[0x1];var _0x2915bc=_[_0x29f6('0x25')](_0x3d88db[_0x29f6('0x26')],function(_0x304c28){return _0x304c28[_0x29f6('0x27')]==_0x13a3a2['id']&&_0x304c28[_0x29f6('0x28')]==_0x50cdd2;});if(_0x2915bc[_0x29f6('0x29')]==0x1){_0x2183b7(_0x13a3a2);}else{_0x454a4a(new RangeError('sessionId\x20'+_0x50cdd2+'\x20not\x20found!'));}});});}exports[_0x29f6('0x2a')]=function(_0x489897,_0x341071){logger[_0x29f6('0x11')](_0x29f6('0x2b'),_0x489897[_0x29f6('0x2c')]);var _0x5e5d89=originateValidation['validate'](_0x489897[_0x29f6('0x2c')]);if(_0x5e5d89[_0x29f6('0x29')]>0x0){return _0x341071[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x5e5d89);}var _0x3a223b=_0x489897[_0x29f6('0x2c')][_0x29f6('0x2e')];var _0x1c3f0f=_0x489897[_0x29f6('0x2c')][_0x29f6('0x2f')];var _0x46d0d0=_0x489897[_0x29f6('0x2c')][_0x29f6('0x30')];var _0x23ad1a=_0x489897['body']['callbackUrl'];return getAgent(_0x3a223b)[_0x29f6('0x22')](function(_0x44cf19){logger[_0x29f6('0x11')]('entityFound:',_0x44cf19[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x44cf19[_0x29f6('0x16')]),_0x29f6('0x33'),{'callNumber':_0x1c3f0f,'callerId':_0x46d0d0,'callbackUrl':_0x23ad1a});return _0x341071['status'](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x34')});})[_0x29f6('0x35')](handleError(_0x341071));};exports[_0x29f6('0x36')]=function(_0x4f5fe1,_0x30d747){logger[_0x29f6('0x11')](_0x29f6('0x37'),_0x4f5fe1[_0x29f6('0x2c')]);var _0x5ddc09=hangupValidation['validate'](_0x4f5fe1[_0x29f6('0x2c')]);if(_0x5ddc09['length']>0x0){return _0x30d747[_0x29f6('0x17')](0x190)['json'](_0x5ddc09);}var _0x3a1a75=_0x4f5fe1['body'][_0x29f6('0x2e')];var _0x11fb2d=_0x4f5fe1['body'][_0x29f6('0x28')];return getAgent(_0x3a1a75)['then'](function(_0x3f3475){logger[_0x29f6('0x11')]('entityFound:',_0x3f3475[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x3f3475[_0x29f6('0x16')]),'webbar:hangup',{'sessionId':_0x11fb2d});return _0x30d747[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x38')});})[_0x29f6('0x35')](handleError(_0x30d747));};exports[_0x29f6('0x39')]=function(_0x4d4189,_0xb5f2b1){logger['info'](_0x29f6('0x3a'),_0x4d4189['body']);var _0xbfe671=answerValidation[_0x29f6('0x3b')](_0x4d4189['body']);if(_0xbfe671[_0x29f6('0x29')]>0x0){return _0xb5f2b1[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0xbfe671);}var _0x27d655=_0x4d4189['body'][_0x29f6('0x2e')];var _0x2a83b7=_0x4d4189[_0x29f6('0x2c')]['sessionId'];return getAgent(_0x27d655)[_0x29f6('0x22')](function(_0x4a5f35){logger[_0x29f6('0x11')]('entityFound:',_0x4a5f35['name']);emit(util['format'](_0x29f6('0x32'),_0x4a5f35[_0x29f6('0x16')]),_0x29f6('0x3c'),{'sessionId':_0x2a83b7});return _0xb5f2b1[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x3d')});})[_0x29f6('0x35')](handleError(_0xb5f2b1));};exports[_0x29f6('0x3e')]=function(_0x352119,_0x1bde93){logger['info']('hold\x20fired:',_0x352119[_0x29f6('0x2c')]);var _0x450e76=holdValidation[_0x29f6('0x3b')](_0x352119[_0x29f6('0x2c')]);if(_0x450e76['length']>0x0){return _0x1bde93[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x450e76);}var _0x532df5=_0x352119[_0x29f6('0x2c')][_0x29f6('0x2e')];var _0x123e2f=_0x352119[_0x29f6('0x2c')][_0x29f6('0x28')];return getAgent(_0x532df5)[_0x29f6('0x22')](function(_0x320b5e){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x320b5e[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x320b5e['name']),_0x29f6('0x40'),{'sessionId':_0x123e2f});return _0x1bde93[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x41')});})[_0x29f6('0x35')](handleError(_0x1bde93));};exports['unhold']=function(_0x2e29e3,_0x52be22){logger['info'](_0x29f6('0x42'),_0x2e29e3[_0x29f6('0x2c')]);var _0x3194fa=unholdValidation[_0x29f6('0x3b')](_0x2e29e3[_0x29f6('0x2c')]);if(_0x3194fa['length']>0x0){return _0x52be22[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x3194fa);}var _0x5f42f3=_0x2e29e3[_0x29f6('0x2c')]['userId'];var _0x288cf2=_0x2e29e3[_0x29f6('0x2c')][_0x29f6('0x28')];return getAgent(_0x5f42f3)[_0x29f6('0x22')](function(_0x5c9113){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x5c9113[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x5c9113[_0x29f6('0x16')]),_0x29f6('0x43'),{'sessionId':_0x288cf2});return _0x52be22['status'](0xc8)[_0x29f6('0x2d')]({'error':![],'message':_0x29f6('0x44')});})[_0x29f6('0x35')](handleError(_0x52be22));};exports[_0x29f6('0x45')]=function(_0x36e52c,_0x1ac20d){logger[_0x29f6('0x11')](_0x29f6('0x46'),_0x1ac20d[_0x29f6('0x2c')]);var _0x3dbd19=callsValidation['validate'](_0x36e52c['body']);if(_0x3dbd19[_0x29f6('0x29')]>0x0){return _0x1ac20d[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x3dbd19);}var _0x5ab84e=_0x36e52c[_0x29f6('0x2c')]['userId'];var _0x550190=respondWithRpcPromise(_0x29f6('0x23'));var _0x234d30=getAgent(_0x5ab84e);return Promise['all']([_0x550190,_0x234d30])['then'](function(_0x3e22f8){var _0x46998c=_0x3e22f8[0x0];var _0x439c0b=_0x3e22f8[0x1];var _0x58694e=_[_0x29f6('0x25')](_0x46998c[_0x29f6('0x26')],function(_0x4284fd){return _0x4284fd[_0x29f6('0x27')]==_0x439c0b['id'];});return _0x1ac20d[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'count':_0x58694e[_0x29f6('0x29')],'rows':_0x58694e});})[_0x29f6('0x35')](handleError(_0x1ac20d));};exports[_0x29f6('0x47')]=function(_0x192525,_0x2d4c8d){logger[_0x29f6('0x11')](_0x29f6('0x48'),_0x192525['body']);var _0x5e25c0=conferenceValidation[_0x29f6('0x3b')](_0x192525['body']);if(_0x5e25c0[_0x29f6('0x29')]>0x0){return _0x2d4c8d[_0x29f6('0x17')](0x190)[_0x29f6('0x2d')](_0x5e25c0);}var _0x40b4d7=_0x192525[_0x29f6('0x2c')]['userId'];return getAgent(_0x40b4d7)[_0x29f6('0x22')](function(_0x38d684){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x38d684[_0x29f6('0x16')]);emit(util['format'](_0x29f6('0x32'),_0x38d684['name']),'webbar:conference');return _0x2d4c8d[_0x29f6('0x17')](0xc8)[_0x29f6('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0x29f6('0x35')](handleError(_0x2d4c8d));};exports[_0x29f6('0x49')]=function(_0x58bdf4,_0x44b3ee){logger[_0x29f6('0x11')](_0x29f6('0x4a'),_0x58bdf4[_0x29f6('0x2c')]);var _0xf3c5f1=transferValidation[_0x29f6('0x3b')](_0x58bdf4[_0x29f6('0x2c')]);if(_0xf3c5f1['length']>0x0){return _0x44b3ee[_0x29f6('0x17')](0x190)['json'](_0xf3c5f1);}var _0x37162d=_0x58bdf4['body']['userId'];var _0x1a3357=_0x58bdf4[_0x29f6('0x2c')][_0x29f6('0x28')];var _0x536b0c=_0x58bdf4[_0x29f6('0x2c')][_0x29f6('0x4b')];return getAgent(_0x37162d)[_0x29f6('0x22')](function(_0x5625b1){logger[_0x29f6('0x11')](_0x29f6('0x3f'),_0x5625b1[_0x29f6('0x16')]);emit(util[_0x29f6('0x31')](_0x29f6('0x32'),_0x5625b1[_0x29f6('0x16')]),_0x29f6('0x4c'),{'sessionId':_0x1a3357,'transferNumber':_0x536b0c});return _0x44b3ee[_0x29f6('0x17')](0xc8)['json']({'error':![],'message':_0x29f6('0x4d')});})[_0x29f6('0x35')](handleError(_0x44b3ee));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 976a494..b429d03 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6343=['/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeAnswers','removeAgents','exports','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0x3aac82,_0x116e4c){var _0x4d2147=function(_0x43e4dc){while(--_0x43e4dc){_0x3aac82['push'](_0x3aac82['shift']());}};_0x4d2147(++_0x116e4c);}(_0x6343,0x168));var _0x3634=function(_0x1104c5,_0x2255b3){_0x1104c5=_0x1104c5-0x0;var _0x237c67=_0x6343[_0x1104c5];return _0x237c67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3634('0x0'));var timeout=require(_0x3634('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var controller=require('./whatsappAccount.controller');router[_0x3634('0x4')]('/',auth[_0x3634('0x5')](),controller['index']);router[_0x3634('0x4')](_0x3634('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x3634('0x4')](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x8')]);router[_0x3634('0x4')](_0x3634('0x9'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x3634('0x4')](_0x3634('0xa'),auth['isAuthenticated'](),controller[_0x3634('0xb')]);router[_0x3634('0x4')](_0x3634('0xc'),auth[_0x3634('0x5')](),controller[_0x3634('0xd')]);router[_0x3634('0x4')](_0x3634('0xe'),auth[_0x3634('0x5')](),controller[_0x3634('0xf')]);router[_0x3634('0x10')]('/',auth[_0x3634('0x5')](),controller[_0x3634('0x11')]);router[_0x3634('0x10')](_0x3634('0x9'),auth['isAuthenticated'](),controller[_0x3634('0x12')]);router['post'](_0x3634('0xa'),auth[_0x3634('0x5')](),controller[_0x3634('0x13')]);router[_0x3634('0x10')](_0x3634('0xc'),auth['isAuthenticated'](),controller[_0x3634('0x14')]);router['post']('/:id/applications',auth[_0x3634('0x5')](),controller['addApplications']);router[_0x3634('0x10')](_0x3634('0x15'),controller[_0x3634('0x16')]);router['post'](_0x3634('0x17'),auth[_0x3634('0x5')](),controller['send']);router[_0x3634('0x18')]('/:id',auth[_0x3634('0x5')](),controller[_0x3634('0x19')]);router['delete'](_0x3634('0x7'),auth[_0x3634('0x5')](),controller[_0x3634('0x1a')]);router['delete'](_0x3634('0x9'),auth[_0x3634('0x5')](),controller['removeDispositions']);router[_0x3634('0x1b')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3634('0x1c')]);router[_0x3634('0x1b')]('/:id/users',auth[_0x3634('0x5')](),controller[_0x3634('0x1d')]);module[_0x3634('0x1e')]=router; \ No newline at end of file +var _0xef0f=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeAnswers','exports'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xef0f,0x168));var _0xfef0=function(_0x1c670d,_0x3510b0){_0x1c670d=_0x1c670d-0x0;var _0x1605ad=_0xef0f[_0x1c670d];return _0x1605ad;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x8')](_0xfef0('0xf'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x8')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x8')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller['getAgents']);router[_0xfef0('0x8')](_0xfef0('0x14'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x15')]);router[_0xfef0('0x16')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x17')]);router['post'](_0xfef0('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x18')]);router[_0xfef0('0x16')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x19')]);router[_0xfef0('0x16')]('/:id/applications',auth[_0xfef0('0x9')](),controller[_0xfef0('0x1a')]);router[_0xfef0('0x16')](_0xfef0('0x1b'),controller[_0xfef0('0x1c')]);router['post'](_0xfef0('0x1d'),auth['isAuthenticated'](),controller[_0xfef0('0x1e')]);router[_0xfef0('0x1f')](_0xfef0('0xd'),auth['isAuthenticated'](),controller[_0xfef0('0x20')]);router['delete'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xfef0('0x9')](),controller['removeDispositions']);router[_0xfef0('0x21')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x22')]);router[_0xfef0('0x21')](_0xfef0('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfef0('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 02a0231..ecae054 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe593=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','twilio','sinch'];(function(_0x13af04,_0x34696c){var _0xd04e49=function(_0x3e5475){while(--_0x3e5475){_0x13af04['push'](_0x13af04['shift']());}};_0xd04e49(++_0x34696c);}(_0xe593,0xb8));var _0x3e59=function(_0x4f7fd5,_0x25d0b3){_0x4f7fd5=_0x4f7fd5-0x0;var _0x41e387=_0xe593[_0x4f7fd5];return _0x41e387;};'use strict';var Sequelize=require(_0x3e59('0x0'));var rs=require(_0x3e59('0x1'));module[_0x3e59('0x2')]={'name':{'type':Sequelize[_0x3e59('0x3')],'unique':_0x3e59('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x3e59('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3e59('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x3e59('0x3')]},'type':{'type':Sequelize[_0x3e59('0x5')](_0x3e59('0x6'),_0x3e59('0x7'))},'accountSid':{'type':Sequelize[_0x3e59('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3e59('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3e59('0x8')],'defaultValue':function(){return _0x3e59('0x9');}},'notificationSound':{'type':Sequelize[_0x3e59('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3e59('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e59('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3e59('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3e59('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3e59('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3e59('0xb')],'comment':_0x3e59('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3e59('0xd'),'set':function(_0x15e595){if(!_0x15e595){this[_0x3e59('0xe')](_0x3e59('0xf'),null);}this['setDataValue']('mandatoryDisposition',_0x15e595);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9dca=['sequelize','randomstring','exports','STRING','name','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5059f0,_0x36a2f2){var _0x56a468=function(_0x151662){while(--_0x151662){_0x5059f0['push'](_0x5059f0['shift']());}};_0x56a468(++_0x36a2f2);}(_0x9dca,0x1a9));var _0xa9dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9dca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa9dc('0x0'));var rs=require(_0xa9dc('0x1'));module[_0xa9dc('0x2')]={'name':{'type':Sequelize[_0xa9dc('0x3')],'unique':_0xa9dc('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa9dc('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa9dc('0x3')],'defaultValue':function(){return rs[_0xa9dc('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xa9dc('0x6'),_0xa9dc('0x7'))},'accountSid':{'type':Sequelize[_0xa9dc('0x3')]},'baseUrl':{'type':Sequelize[_0xa9dc('0x3')]},'authToken':{'type':Sequelize[_0xa9dc('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa9dc('0x8')],'defaultValue':function(){return _0xa9dc('0x9');}},'notificationSound':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa9dc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9dc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9dc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9dc('0xb')],'comment':_0xa9dc('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xa9dc('0xa')],'defaultValue':![],'comment':_0xa9dc('0xd'),'set':function(_0x3e20d4){if(!_0x3e20d4){this[_0xa9dc('0xe')](_0xa9dc('0xf'),null);}this['setDataValue'](_0xa9dc('0x10'),_0x3e20d4);}},'description':{'type':Sequelize[_0xa9dc('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 537adb1..f0063ea 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7098=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','then','destroy','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','filter','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','User','getAgents','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','CmContact','contact','interaction','get','created','autoclose','push','unmanaged','ContactId','UserId','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x911353,_0x1648ed){var _0x2f05fa=function(_0x4a00a4){while(--_0x4a00a4){_0x911353['push'](_0x911353['shift']());}};_0x2f05fa(++_0x1648ed);}(_0x7098,0xa7));var _0x8709=function(_0xdac101,_0x301f34){_0xdac101=_0xdac101-0x0;var _0x1d5880=_0x7098[_0xdac101];return _0x1d5880;};'use strict';var emlformat=require(_0x8709('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8709('0x1'));var rp=require(_0x8709('0x2'));var moment=require(_0x8709('0x3'));var BPromise=require(_0x8709('0x4'));var Mustache=require(_0x8709('0x5'));var util=require('util');var path=require(_0x8709('0x6'));var sox=require(_0x8709('0x7'));var csv=require('to-csv');var ejs=require(_0x8709('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8709('0x9'));var squel=require(_0x8709('0xa'));var crypto=require(_0x8709('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8709('0xc'));var toCsv=require(_0x8709('0xd'));var querystring=require(_0x8709('0xe'));var Papa=require(_0x8709('0xf'));var Redis=require('ioredis');var authService=require(_0x8709('0x10'));var qs=require(_0x8709('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8709('0x12'));var logger=require(_0x8709('0x13'))(_0x8709('0x14'));var utils=require('../../config/utils');var config=require(_0x8709('0x15'));var licenseUtil=require(_0x8709('0x16'));var db=require(_0x8709('0x17'))['db'];config[_0x8709('0x18')]=_[_0x8709('0x19')](config[_0x8709('0x18')],{'host':_0x8709('0x1a'),'port':0x18eb});var socket=require(_0x8709('0x1b'))(new Redis(config['redis']));require(_0x8709('0x1c'))['register'](socket);var jayson=require(_0x8709('0x1d'));var client=jayson[_0x8709('0x1e')][_0x8709('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x3ed698,_0x3ca376,_0x41f7cd,_0x3fcb01){return new BPromise(function(_0x310e45,_0x88baf7){var _0x2e319f=_0x3fcb01||client;return _0x2e319f['request'](_0x3ed698,_0x41f7cd)['then'](function(_0x112aab){logger['info'](_0x8709('0x20'),_0x3ca376,_0x8709('0x21'));logger[_0x8709('0x22')](_0x8709('0x23'),_0x3ca376,_0x8709('0x21'),JSON['stringify'](_0x112aab));if(_0x112aab[_0x8709('0x24')]){if(_0x112aab[_0x8709('0x24')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3ca376,_0x112aab[_0x8709('0x24')]['message']);return _0x88baf7(_0x112aab[_0x8709('0x24')][_0x8709('0x25')]);}logger[_0x8709('0x24')](_0x8709('0x20'),_0x3ca376,_0x112aab[_0x8709('0x24')][_0x8709('0x25')]);return _0x310e45(_0x112aab[_0x8709('0x24')][_0x8709('0x25')]);}else{logger[_0x8709('0x26')](_0x8709('0x20'),_0x3ca376,_0x8709('0x21'));_0x310e45(_0x112aab[_0x8709('0x27')][_0x8709('0x25')]);}})[_0x8709('0x28')](function(_0xdf9b8b){logger[_0x8709('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x3ca376,_0xdf9b8b);_0x88baf7(_0xdf9b8b);});});}function respondWithStatusCode(_0x4ba9e5,_0x304a8f){_0x304a8f=_0x304a8f||0xcc;return function(_0x5e3d9d){if(_0x5e3d9d){return _0x4ba9e5[_0x8709('0x29')](_0x304a8f);}return _0x4ba9e5[_0x8709('0x2a')](_0x304a8f)[_0x8709('0x2b')]();};}function respondWithResult(_0x104f5b,_0x12fb50){_0x12fb50=_0x12fb50||0xc8;return function(_0x118b96){if(_0x118b96){return _0x104f5b['status'](_0x12fb50)[_0x8709('0x2c')](_0x118b96);}};}function respondWithFilteredResult(_0x504296,_0x154b68){return function(_0x10d362){if(_0x10d362){var _0x1511f6=typeof _0x154b68[_0x8709('0x2d')]==='undefined'&&typeof _0x154b68[_0x8709('0x2e')]===_0x8709('0x2f');var _0x45a431=_0x10d362['count'];var _0x5c973a=_0x1511f6?0x0:_0x154b68[_0x8709('0x2d')];var _0x93ba0b=_0x1511f6?_0x10d362[_0x8709('0x30')]:_0x154b68[_0x8709('0x2d')]+_0x154b68[_0x8709('0x2e')];var _0x238c5e;if(_0x93ba0b>=_0x45a431){_0x93ba0b=_0x45a431;_0x238c5e=0xc8;}else{_0x238c5e=0xce;}_0x504296[_0x8709('0x2a')](_0x238c5e);return _0x504296['set'](_0x8709('0x31'),_0x5c973a+'-'+_0x93ba0b+'/'+_0x45a431)[_0x8709('0x2c')](_0x10d362);}return null;};}function patchUpdates(_0x3fd16f){return function(_0x53a18f){try{jsonpatch[_0x8709('0x32')](_0x53a18f,_0x3fd16f,!![]);}catch(_0x7ad6cb){return BPromise['reject'](_0x7ad6cb);}return _0x53a18f['save']();};}function saveUpdates(_0x25a7ed,_0x17e0b6){return function(_0x139fe9){if(_0x139fe9){return _0x139fe9['update'](_0x25a7ed)[_0x8709('0x33')](function(_0x191c97){return _0x191c97;});}return null;};}function removeEntity(_0x546226,_0x371ce9){return function(_0x461509){if(_0x461509){return _0x461509[_0x8709('0x34')]()[_0x8709('0x33')](function(){var _0x527da5=_0x461509['get']({'plain':!![]});var _0xb1705=_0x8709('0x35');return db[_0x8709('0x36')][_0x8709('0x34')]({'where':{'type':_0xb1705,'resourceId':_0x527da5['id']}})['then'](function(){return _0x461509;});})['then'](function(){_0x546226[_0x8709('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2247fc,_0x1819e6){return function(_0x14d067){if(!_0x14d067){_0x2247fc[_0x8709('0x29')](0x194);}return _0x14d067;};}function handleError(_0x215c5a,_0x20407b){_0x20407b=_0x20407b||0x1f4;return function(_0x7e6c95){logger[_0x8709('0x24')](_0x7e6c95[_0x8709('0x37')]);if(_0x7e6c95[_0x8709('0x38')]){delete _0x7e6c95[_0x8709('0x38')];}_0x215c5a[_0x8709('0x2a')](_0x20407b)['send'](_0x7e6c95);};}exports[_0x8709('0x39')]=function(_0x572027,_0x15ce26){var _0x1e3ab1={'include':[{'model':db[_0x8709('0x3a')],'as':_0x8709('0x3b')}]},_0x53aa02={},_0x1872d7={'count':0x0,'rows':[]};var _0x3c7b6c=_[_0x8709('0x3c')](db[_0x8709('0x3d')][_0x8709('0x3e')],function(_0x334538){return{'name':_0x334538[_0x8709('0x3f')],'type':_0x334538['type'][_0x8709('0x40')]};});_0x53aa02['model']=_[_0x8709('0x3c')](_0x3c7b6c,_0x8709('0x38'));_0x53aa02[_0x8709('0x41')]=_['keys'](_0x572027[_0x8709('0x41')]);_0x53aa02[_0x8709('0x42')]=_[_0x8709('0x43')](_0x53aa02[_0x8709('0x44')],_0x53aa02['query']);_0x1e3ab1[_0x8709('0x45')]=_[_0x8709('0x43')](_0x53aa02[_0x8709('0x44')],qs[_0x8709('0x46')](_0x572027[_0x8709('0x41')]['fields']));_0x1e3ab1['attributes']=_0x1e3ab1['attributes']['length']?_0x1e3ab1['attributes']:_0x53aa02['model'];if(!_0x572027[_0x8709('0x41')]['hasOwnProperty'](_0x8709('0x47'))){_0x1e3ab1[_0x8709('0x2e')]=qs[_0x8709('0x2e')](_0x572027[_0x8709('0x41')][_0x8709('0x2e')]);_0x1e3ab1[_0x8709('0x2d')]=qs[_0x8709('0x2d')](_0x572027['query'][_0x8709('0x2d')]);}_0x1e3ab1[_0x8709('0x48')]=qs[_0x8709('0x49')](_0x572027[_0x8709('0x41')][_0x8709('0x49')]);_0x1e3ab1[_0x8709('0x4a')]=qs[_0x8709('0x42')](_[_0x8709('0x4b')](_0x572027[_0x8709('0x41')],_0x53aa02[_0x8709('0x42')]),_0x3c7b6c);if(_0x572027['query']['filter']){_0x1e3ab1[_0x8709('0x4a')]=_[_0x8709('0x4c')](_0x1e3ab1['where'],{'$or':_['map'](_0x3c7b6c,function(_0x1816dc){if(_0x1816dc[_0x8709('0x4d')]!==_0x8709('0x4e')){var _0x162ec5={};_0x162ec5[_0x1816dc[_0x8709('0x38')]]={'$like':'%'+_0x572027[_0x8709('0x41')]['filter']+'%'};return _0x162ec5;}})});}_0x1e3ab1=_[_0x8709('0x4c')]({},_0x1e3ab1,_0x572027[_0x8709('0x4f')]);var _0x44bbd6={'where':_0x1e3ab1[_0x8709('0x4a')]};return db[_0x8709('0x3d')]['count'](_0x44bbd6)['then'](function(_0x31e9a7){_0x1872d7[_0x8709('0x30')]=_0x31e9a7;if(_0x572027[_0x8709('0x41')][_0x8709('0x50')]){_0x1e3ab1[_0x8709('0x51')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x8709('0x52')](_0x1e3ab1);})['then'](function(_0x1faa04){_0x1872d7[_0x8709('0x53')]=_0x1faa04;return _0x1872d7;})[_0x8709('0x33')](respondWithFilteredResult(_0x15ce26,_0x1e3ab1))['catch'](handleError(_0x15ce26,null));};exports[_0x8709('0x54')]=function(_0x2d3840,_0x57de01){var _0x2b29ad={'raw':![],'where':{'id':_0x2d3840[_0x8709('0x55')]['id']},'include':[{'model':db[_0x8709('0x3a')],'as':_0x8709('0x3b')}]},_0x4481f9={};_0x4481f9['model']=_[_0x8709('0x56')](db[_0x8709('0x3d')]['rawAttributes']);_0x4481f9[_0x8709('0x41')]=_[_0x8709('0x56')](_0x2d3840[_0x8709('0x41')]);_0x4481f9[_0x8709('0x42')]=_[_0x8709('0x43')](_0x4481f9[_0x8709('0x44')],_0x4481f9[_0x8709('0x41')]);_0x2b29ad[_0x8709('0x45')]=_[_0x8709('0x43')](_0x4481f9[_0x8709('0x44')],qs[_0x8709('0x46')](_0x2d3840['query'][_0x8709('0x46')]));_0x2b29ad[_0x8709('0x45')]=_0x2b29ad[_0x8709('0x45')][_0x8709('0x57')]?_0x2b29ad['attributes']:_0x4481f9['model'];if(_0x2d3840[_0x8709('0x41')][_0x8709('0x50')]){_0x2b29ad[_0x8709('0x51')]=[{'all':!![]}];}_0x2b29ad=_[_0x8709('0x4c')]({},_0x2b29ad,_0x2d3840[_0x8709('0x4f')]);return db[_0x8709('0x3d')][_0x8709('0x58')](_0x2b29ad)['then'](handleEntityNotFound(_0x57de01,null))['then'](respondWithResult(_0x57de01,null))[_0x8709('0x28')](handleError(_0x57de01,null));};exports[_0x8709('0x59')]=function(_0x19c3b7,_0x4d2fe4){return db[_0x8709('0x3d')][_0x8709('0x59')](_0x19c3b7['body'],{})['then'](function(_0x421667){var _0x18bf4a=_0x19c3b7[_0x8709('0x5a')]['get']({'plain':!![]});if(!_0x18bf4a)throw new Error(_0x8709('0x5b'));if(_0x18bf4a['role']===_0x8709('0x5a')){var _0x2f7f57=_0x421667['get']({'plain':!![]});var _0x138cba=_0x8709('0x35');return db[_0x8709('0x5c')]['find']({'where':{'name':_0x138cba,'userProfileId':_0x18bf4a[_0x8709('0x5d')]},'raw':!![]})[_0x8709('0x33')](function(_0x9cb96d){if(_0x9cb96d&&_0x9cb96d['autoAssociation']===0x0){return db[_0x8709('0x36')][_0x8709('0x59')]({'name':_0x2f7f57[_0x8709('0x38')],'resourceId':_0x2f7f57['id'],'type':_0x9cb96d[_0x8709('0x38')],'sectionId':_0x9cb96d['id']},{})['then'](function(){return _0x421667;});}else{return _0x421667;}})[_0x8709('0x28')](function(_0x290102){logger[_0x8709('0x24')](_0x8709('0x5e'),_0x290102);throw _0x290102;});}return _0x421667;})[_0x8709('0x33')](respondWithResult(_0x4d2fe4,0xc9))[_0x8709('0x28')](handleError(_0x4d2fe4,null));};exports[_0x8709('0x5f')]=function(_0x4369e0,_0x2180ca){if(_0x4369e0[_0x8709('0x60')]['id']){delete _0x4369e0[_0x8709('0x60')]['id'];}return db[_0x8709('0x3d')][_0x8709('0x58')]({'where':{'id':_0x4369e0[_0x8709('0x55')]['id']},'include':[{'model':db[_0x8709('0x3a')],'as':_0x8709('0x3b')}]})[_0x8709('0x33')](handleEntityNotFound(_0x2180ca,null))[_0x8709('0x33')](saveUpdates(_0x4369e0[_0x8709('0x60')],null))['then'](respondWithResult(_0x2180ca,null))[_0x8709('0x28')](handleError(_0x2180ca,null));};exports[_0x8709('0x34')]=function(_0x5577e4,_0x41527c){return db[_0x8709('0x3d')]['find']({'where':{'id':_0x5577e4[_0x8709('0x55')]['id']}})['then'](handleEntityNotFound(_0x41527c,null))[_0x8709('0x33')](removeEntity(_0x41527c,null))[_0x8709('0x28')](handleError(_0x41527c,null));};exports[_0x8709('0x61')]=function(_0x771377,_0x8e6cbd){return db['WhatsappAccount']['describe']()[_0x8709('0x33')](respondWithResult(_0x8e6cbd,null))[_0x8709('0x28')](handleError(_0x8e6cbd,null));};exports[_0x8709('0x62')]=function(_0x583fa8,_0x2f22eb,_0x3d2815){if(_0x583fa8[_0x8709('0x60')]['id']){delete _0x583fa8[_0x8709('0x60')]['id'];}return db[_0x8709('0x3d')][_0x8709('0x58')]({'where':{'id':_0x583fa8['params']['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x2f22eb,null))['then'](function(_0x228003){if(_0x228003){_0x583fa8[_0x8709('0x60')][_0x8709('0x63')]=_0x228003['id'];return db[_0x8709('0x64')][_0x8709('0x59')](_0x583fa8[_0x8709('0x60')]);}})[_0x8709('0x33')](respondWithResult(_0x2f22eb,null))['catch'](handleError(_0x2f22eb,null));};exports[_0x8709('0x65')]=function(_0xb34439,_0x400e82,_0x45d413){var _0x400789={'raw':![],'where':{}};var _0x25ffeb={};var _0x5a3bb4={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0xb34439[_0x8709('0x55')]['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x400e82,null))[_0x8709('0x33')](function(_0x161238){if(_0x161238){_0x25ffeb['model']=_[_0x8709('0x56')](db[_0x8709('0x64')]['rawAttributes']);_0x25ffeb[_0x8709('0x41')]=_[_0x8709('0x56')](_0xb34439[_0x8709('0x41')]);_0x25ffeb[_0x8709('0x42')]=_['intersection'](_0x25ffeb[_0x8709('0x44')],_0x25ffeb[_0x8709('0x41')]);_0x400789[_0x8709('0x45')]=_['intersection'](_0x25ffeb[_0x8709('0x44')],qs[_0x8709('0x46')](_0xb34439[_0x8709('0x41')]['fields']));_0x400789[_0x8709('0x45')]=_0x400789['attributes'][_0x8709('0x57')]?_0x400789[_0x8709('0x45')]:_0x25ffeb[_0x8709('0x44')];if(!_0xb34439[_0x8709('0x41')][_0x8709('0x66')](_0x8709('0x47'))){_0x400789[_0x8709('0x2e')]=qs[_0x8709('0x2e')](_0xb34439[_0x8709('0x41')][_0x8709('0x2e')]);_0x400789[_0x8709('0x2d')]=qs[_0x8709('0x2d')](_0xb34439[_0x8709('0x41')][_0x8709('0x2d')]);}_0x400789[_0x8709('0x48')]=qs[_0x8709('0x49')](_0xb34439[_0x8709('0x41')][_0x8709('0x49')]);_0x400789['where']=qs[_0x8709('0x42')](_[_0x8709('0x4b')](_0xb34439[_0x8709('0x41')],_0x25ffeb['filters']));_0x400789[_0x8709('0x4a')][_0x8709('0x63')]=_0x161238['id'];if(_0xb34439[_0x8709('0x41')][_0x8709('0x67')]){_0x400789[_0x8709('0x4a')]=_[_0x8709('0x4c')](_0x400789[_0x8709('0x4a')],{'$or':_[_0x8709('0x3c')](_0x400789[_0x8709('0x45')],function(_0x2952ed){var _0x387dbe={};_0x387dbe[_0x2952ed]={'$like':'%'+_0xb34439[_0x8709('0x41')][_0x8709('0x67')]+'%'};return _0x387dbe;})});}_0x400789=_[_0x8709('0x4c')]({},_0x400789,_0xb34439[_0x8709('0x4f')]);return db[_0x8709('0x64')][_0x8709('0x30')]({'where':_0x400789['where']})['then'](function(_0x177009){_0x5a3bb4[_0x8709('0x30')]=_0x177009;if(_0xb34439[_0x8709('0x41')][_0x8709('0x50')]){_0x400789[_0x8709('0x51')]=[{'all':!![]}];}return db[_0x8709('0x64')][_0x8709('0x52')](_0x400789);})[_0x8709('0x33')](function(_0x39c2c3){_0x5a3bb4[_0x8709('0x53')]=_0x39c2c3;return _0x5a3bb4;});}})[_0x8709('0x33')](respondWithFilteredResult(_0x400e82,_0x400789))[_0x8709('0x28')](handleError(_0x400e82,null));};exports[_0x8709('0x68')]=function(_0x1837a5,_0x45eb12,_0x3e1f86){return db['WhatsappAccount'][_0x8709('0x58')]({'where':{'id':_0x1837a5[_0x8709('0x55')]['id']}})['then'](handleEntityNotFound(_0x45eb12,null))[_0x8709('0x33')](function(_0xc35289){if(_0xc35289){return _0xc35289[_0x8709('0x68')](_0x1837a5[_0x8709('0x41')][_0x8709('0x69')]);}})[_0x8709('0x33')](respondWithStatusCode(_0x45eb12,null))[_0x8709('0x28')](handleError(_0x45eb12,null));};exports[_0x8709('0x6a')]=function(_0x169d8a,_0x34baeb,_0x5375a8){if(_0x169d8a[_0x8709('0x60')]['id']){delete _0x169d8a['body']['id'];}return db[_0x8709('0x3d')][_0x8709('0x58')]({'where':{'id':_0x169d8a[_0x8709('0x55')]['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x34baeb,null))[_0x8709('0x33')](function(_0x362955){if(_0x362955){_0x169d8a[_0x8709('0x60')]['WhatsappAccountId']=_0x362955['id'];return db[_0x8709('0x6b')][_0x8709('0x59')](_0x169d8a[_0x8709('0x60')]);}})[_0x8709('0x33')](respondWithResult(_0x34baeb,null))[_0x8709('0x28')](handleError(_0x34baeb,null));};exports['getAnswers']=function(_0x3e1dcb,_0x53a257,_0x5c3adb){var _0x47d21a={'raw':![],'where':{}};var _0x269ad3={};var _0x34655f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8709('0x6c')]({'where':{'id':_0x3e1dcb['params']['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x53a257,null))[_0x8709('0x33')](function(_0x2c9861){if(_0x2c9861){_0x269ad3[_0x8709('0x44')]=_[_0x8709('0x56')](db[_0x8709('0x6b')][_0x8709('0x3e')]);_0x269ad3[_0x8709('0x41')]=_[_0x8709('0x56')](_0x3e1dcb[_0x8709('0x41')]);_0x269ad3[_0x8709('0x42')]=_[_0x8709('0x43')](_0x269ad3['model'],_0x269ad3['query']);_0x47d21a['attributes']=_[_0x8709('0x43')](_0x269ad3['model'],qs[_0x8709('0x46')](_0x3e1dcb[_0x8709('0x41')][_0x8709('0x46')]));_0x47d21a[_0x8709('0x45')]=_0x47d21a[_0x8709('0x45')][_0x8709('0x57')]?_0x47d21a['attributes']:_0x269ad3['model'];if(!_0x3e1dcb[_0x8709('0x41')][_0x8709('0x66')]('nolimit')){_0x47d21a[_0x8709('0x2e')]=qs[_0x8709('0x2e')](_0x3e1dcb[_0x8709('0x41')][_0x8709('0x2e')]);_0x47d21a[_0x8709('0x2d')]=qs[_0x8709('0x2d')](_0x3e1dcb['query'][_0x8709('0x2d')]);}_0x47d21a[_0x8709('0x48')]=qs[_0x8709('0x49')](_0x3e1dcb[_0x8709('0x41')][_0x8709('0x49')]);_0x47d21a[_0x8709('0x4a')]=qs[_0x8709('0x42')](_['pick'](_0x3e1dcb[_0x8709('0x41')],_0x269ad3['filters']));_0x47d21a['where'][_0x8709('0x63')]=_0x2c9861['id'];if(_0x3e1dcb[_0x8709('0x41')]['filter']){_0x47d21a[_0x8709('0x4a')]=_['merge'](_0x47d21a['where'],{'$or':_[_0x8709('0x3c')](_0x47d21a['attributes'],function(_0x12d5ab){var _0x1039e2={};_0x1039e2[_0x12d5ab]={'$like':'%'+_0x3e1dcb['query']['filter']+'%'};return _0x1039e2;})});}_0x47d21a=_[_0x8709('0x4c')]({},_0x47d21a,_0x3e1dcb[_0x8709('0x4f')]);return db[_0x8709('0x6b')][_0x8709('0x30')]({'where':_0x47d21a[_0x8709('0x4a')]})[_0x8709('0x33')](function(_0x22736c){_0x34655f[_0x8709('0x30')]=_0x22736c;if(_0x3e1dcb[_0x8709('0x41')]['includeAll']){_0x47d21a[_0x8709('0x51')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x47d21a);})[_0x8709('0x33')](function(_0x472708){_0x34655f[_0x8709('0x53')]=_0x472708;return _0x34655f;});}})[_0x8709('0x33')](respondWithFilteredResult(_0x53a257,_0x47d21a))[_0x8709('0x28')](handleError(_0x53a257,null));};exports[_0x8709('0x6d')]=function(_0x5904d3,_0x4ad70f,_0x136611){return db['WhatsappAccount']['find']({'where':{'id':_0x5904d3['params']['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x4ad70f,null))['then'](function(_0x3ee32f){if(_0x3ee32f){return _0x3ee32f[_0x8709('0x6d')](_0x5904d3[_0x8709('0x41')]['ids']);}})[_0x8709('0x33')](respondWithStatusCode(_0x4ad70f,null))[_0x8709('0x28')](handleError(_0x4ad70f,null));};exports[_0x8709('0x6e')]=function(_0x34e819,_0x54d3a1,_0x4c6425){return db['WhatsappAccount'][_0x8709('0x58')]({'where':{'id':_0x34e819['params']['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x54d3a1,null))[_0x8709('0x33')](function(_0x3164b3){if(_0x3164b3){return _0x3164b3[_0x8709('0x6e')](_0x34e819[_0x8709('0x60')]['ids'],_[_0x8709('0x6f')](_0x34e819['body'],[_0x8709('0x69'),'id'])||{})[_0x8709('0x70')](function(_0x3be820){for(var _0x4c2df0=0x0;_0x4c2df0<_0x34e819[_0x8709('0x60')][_0x8709('0x69')][_0x8709('0x57')];_0x4c2df0+=0x1){socket[_0x8709('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x34e819['body'][_0x8709('0x69')][_0x4c2df0]),'WhatsappAccountId':Number(_0x34e819[_0x8709('0x55')]['id'])});}return _0x3be820;});}})[_0x8709('0x33')](respondWithResult(_0x54d3a1,null))[_0x8709('0x28')](handleError(_0x54d3a1,null));};exports[_0x8709('0x72')]=function(_0x471624,_0x581163,_0x215379){return db[_0x8709('0x3d')][_0x8709('0x58')]({'where':{'id':_0x471624[_0x8709('0x55')]['id']}})['then'](handleEntityNotFound(_0x581163,null))[_0x8709('0x33')](function(_0x34f12e){if(_0x34f12e){return _0x34f12e[_0x8709('0x72')](_0x471624[_0x8709('0x41')][_0x8709('0x69')])[_0x8709('0x33')](function(){if(_[_0x8709('0x73')](_0x471624[_0x8709('0x41')]['ids'])){for(var _0x39cf18=0x0;_0x39cf18<_0x471624['query']['ids'][_0x8709('0x57')];_0x39cf18+=0x1){socket[_0x8709('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x471624[_0x8709('0x41')][_0x8709('0x69')][_0x39cf18]),'WhatsappAccountId':Number(_0x471624['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x471624[_0x8709('0x41')][_0x8709('0x69')]),'WhatsappAccountId':Number(_0x471624[_0x8709('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x581163,null))[_0x8709('0x28')](handleError(_0x581163,null));};exports['getAgents']=function(_0xcadc5f,_0x6319fb,_0xaa48aa){var _0x230cfd={};var _0x1bc5d0={};var _0x45e9a3;var _0x4e5a73;return db[_0x8709('0x3d')]['findOne']({'where':{'id':_0xcadc5f[_0x8709('0x55')]['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x6319fb,null))[_0x8709('0x33')](function(_0x4b7f77){if(_0x4b7f77){_0x45e9a3=_0x4b7f77;_0x1bc5d0[_0x8709('0x44')]=_['keys'](db[_0x8709('0x74')][_0x8709('0x3e')]);_0x1bc5d0[_0x8709('0x41')]=_[_0x8709('0x56')](_0xcadc5f[_0x8709('0x41')]);_0x1bc5d0[_0x8709('0x42')]=_[_0x8709('0x43')](_0x1bc5d0[_0x8709('0x44')],_0x1bc5d0[_0x8709('0x41')]);_0x230cfd['attributes']=_[_0x8709('0x43')](_0x1bc5d0[_0x8709('0x44')],qs[_0x8709('0x46')](_0xcadc5f['query'][_0x8709('0x46')]));_0x230cfd[_0x8709('0x45')]=_0x230cfd['attributes']['length']?_0x230cfd['attributes']:_0x1bc5d0[_0x8709('0x44')];_0x230cfd[_0x8709('0x48')]=qs['sort'](_0xcadc5f['query'][_0x8709('0x49')]);_0x230cfd[_0x8709('0x4a')]=qs[_0x8709('0x42')](_[_0x8709('0x4b')](_0xcadc5f[_0x8709('0x41')],_0x1bc5d0[_0x8709('0x42')]));if(_0xcadc5f[_0x8709('0x41')]['filter']){_0x230cfd[_0x8709('0x4a')]=_[_0x8709('0x4c')](_0x230cfd[_0x8709('0x4a')],{'$or':_[_0x8709('0x3c')](_0x230cfd[_0x8709('0x45')],function(_0x686220){var _0x96e2fd={};_0x96e2fd[_0x686220]={'$like':'%'+_0xcadc5f[_0x8709('0x41')][_0x8709('0x67')]+'%'};return _0x96e2fd;})});}_0x230cfd=_[_0x8709('0x4c')]({},_0x230cfd,_0xcadc5f[_0x8709('0x4f')]);return _0x45e9a3[_0x8709('0x75')](_0x230cfd);}})[_0x8709('0x33')](function(_0x54708d){if(_0x54708d){_0x4e5a73=_0x54708d[_0x8709('0x57')];if(!_0xcadc5f[_0x8709('0x41')][_0x8709('0x66')](_0x8709('0x47'))){_0x230cfd['limit']=qs[_0x8709('0x2e')](_0xcadc5f['query'][_0x8709('0x2e')]);_0x230cfd['offset']=qs['offset'](_0xcadc5f[_0x8709('0x41')]['offset']);}return _0x45e9a3[_0x8709('0x75')](_0x230cfd);}})[_0x8709('0x33')](function(_0x5d6f79){if(_0x5d6f79){return _0x5d6f79?{'count':_0x4e5a73,'rows':_0x5d6f79}:null;}})[_0x8709('0x33')](respondWithResult(_0x6319fb,null))[_0x8709('0x28')](handleError(_0x6319fb,null));};exports[_0x8709('0x76')]=function(_0xfa3474,_0x2fb49b){var _0x61dd07=_0xfa3474[_0x8709('0x55')]['id'];var _0x424169=_0xfa3474[_0x8709('0x60')];var _0x4abe14=0xc8;var _0x3c1b38=null;return db[_0x8709('0x77')]['transaction']({'isolationLevel':db[_0x8709('0x77')]['Transaction'][_0x8709('0x78')][_0x8709('0x79')]},function(_0x28c2ee){return db['WhatsappAccount'][_0x8709('0x6c')]({'where':{'id':_0x61dd07},'transaction':_0x28c2ee})[_0x8709('0x33')](function(_0x63eaf5){if(_0x63eaf5){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x61dd07},'transaction':_0x28c2ee})[_0x8709('0x33')](function(){var _0x5e7b35=_['map'](_0x424169,function(_0x33caa2){_0x33caa2['WhatsappAccountId']=_0x61dd07;return _0x33caa2;});return db['WhatsappApplication'][_0x8709('0x7a')](_0x5e7b35,{'transaction':_0x28c2ee});});}else{_0x4abe14=0x194;_0x3c1b38=[];}});})[_0x8709('0x33')](function(){if(_0x4abe14!==0x194){return db[_0x8709('0x7b')][_0x8709('0x7c')]({'where':{'WhatsappAccountId':_0x61dd07},'order':_0x8709('0x7d')})[_0x8709('0x33')](function(_0x3e3415){_0x3c1b38=_0x3e3415;});}})['catch'](function(_0x55381b){_0x4abe14=0x1f4;logger[_0x8709('0x24')](_0x55381b[_0x8709('0x37')]);if(_0x55381b[_0x8709('0x38')]){delete _0x55381b[_0x8709('0x38')];}_0x3c1b38=_0x55381b;})[_0x8709('0x7e')](function(){if(_0x3c1b38===null){_0x2fb49b[_0x8709('0x29')](_0x4abe14);}else{if(_0x4abe14===0x1f4){_0x2fb49b[_0x8709('0x2a')](_0x4abe14)[_0x8709('0x7f')](_0x3c1b38);}else{_0x2fb49b[_0x8709('0x2a')](_0x4abe14)[_0x8709('0x2c')](_0x3c1b38);}}});};exports[_0x8709('0x80')]=function(_0x51deed,_0x318e51,_0x32fc91){var _0x227375={};var _0x57485a={};var _0x473b19;var _0x5232e8;return db[_0x8709('0x3d')][_0x8709('0x6c')]({'where':{'id':_0x51deed[_0x8709('0x55')]['id']}})[_0x8709('0x33')](handleEntityNotFound(_0x318e51,null))[_0x8709('0x33')](function(_0x574789){if(_0x574789){_0x473b19=_0x574789;_0x57485a[_0x8709('0x44')]=_[_0x8709('0x56')](db[_0x8709('0x7b')][_0x8709('0x3e')]);_0x57485a[_0x8709('0x41')]=_[_0x8709('0x56')](_0x51deed[_0x8709('0x41')]);_0x57485a[_0x8709('0x42')]=_['intersection'](_0x57485a[_0x8709('0x44')],_0x57485a[_0x8709('0x41')]);_0x227375['attributes']=_['intersection'](_0x57485a[_0x8709('0x44')],qs[_0x8709('0x46')](_0x51deed[_0x8709('0x41')]['fields']));_0x227375[_0x8709('0x45')]=_0x227375['attributes'][_0x8709('0x57')]?_0x227375[_0x8709('0x45')]:_0x57485a[_0x8709('0x44')];_0x227375[_0x8709('0x48')]=qs[_0x8709('0x49')](_0x51deed[_0x8709('0x41')]['sort']);_0x227375['where']=qs[_0x8709('0x42')](_['pick'](_0x51deed[_0x8709('0x41')],_0x57485a[_0x8709('0x42')]));if(_0x51deed['query']['filter']){_0x227375[_0x8709('0x4a')]=_['merge'](_0x227375['where'],{'$or':_[_0x8709('0x3c')](_0x227375[_0x8709('0x45')],function(_0x54d289){var _0x2e8bd4={};_0x2e8bd4[_0x54d289]={'$like':'%'+_0x51deed[_0x8709('0x41')][_0x8709('0x67')]+'%'};return _0x2e8bd4;})});}_0x227375=_[_0x8709('0x4c')]({},_0x227375,_0x51deed['options']);return _0x473b19[_0x8709('0x80')](_0x227375);}})[_0x8709('0x33')](function(_0x581db3){if(_0x581db3){_0x5232e8=_0x581db3[_0x8709('0x57')];if(!_0x51deed['query']['hasOwnProperty']('nolimit')){_0x227375[_0x8709('0x2e')]=qs[_0x8709('0x2e')](_0x51deed[_0x8709('0x41')][_0x8709('0x2e')]);_0x227375[_0x8709('0x2d')]=qs[_0x8709('0x2d')](_0x51deed['query']['offset']);}return _0x473b19[_0x8709('0x80')](_0x227375);}})['then'](function(_0x3b1194){if(_0x3b1194){return _0x3b1194?{'count':_0x5232e8,'rows':_0x3b1194}:null;}})[_0x8709('0x33')](respondWithResult(_0x318e51,null))[_0x8709('0x28')](handleError(_0x318e51,null));};exports[_0x8709('0x81')]=function(_0xecdf29,_0x4de942,_0xcd8bf1){var _0x3044dd={'channel':_0x8709('0x82')};var _0x4d8aad=[];var _0x4e282f=[];var _0x4b7b79={};return db[_0x8709('0x3d')][_0x8709('0x58')]({'where':{'id':_0xecdf29[_0x8709('0x55')]['id']},'include':[{'model':db[_0x8709('0x7b')],'as':_0x8709('0x83')}]})[_0x8709('0x33')](handleEntityNotFound(_0x4de942,null))[_0x8709('0x33')](function(_0x3e917d){_0x3044dd['account']=_0x3e917d;if(_0x3044dd[_0x8709('0x84')]&&_0x3044dd[_0x8709('0x84')]['type']===_0x8709('0x85')&&_0xecdf29[_0x8709('0x60')]['statuses']){if(_0xecdf29['body']['statuses'][_0x8709('0x57')]===0x0)return;if(_0xecdf29[_0x8709('0x60')][_0x8709('0x86')][0x0][_0x8709('0x87')]!==_0x8709('0x88'))return;return db[_0x8709('0x89')][_0x8709('0x5f')]({'read':!![],'readAt':_0xecdf29[_0x8709('0x60')][_0x8709('0x86')][0x0]['timestamp']},{'where':{'messageId':_0xecdf29[_0x8709('0x60')]['statuses'][0x0][_0x8709('0x8a')]},'individualHooks':!![]})[_0x8709('0x33')](function(_0x53a697){return _0x4de942[_0x8709('0x2a')](0xc8)[_0x8709('0x2c')](_0x53a697);});}_0x3044dd[_0x8709('0x8b')]=_['orderBy'](_0x3e917d[_0x8709('0x83')],[_0x8709('0x7d')],[_0x8709('0x8c')]);if(_0x3044dd[_0x8709('0x84')][_0x8709('0x83')]){delete _0x3044dd[_0x8709('0x84')][_0x8709('0x83')];}return db['CmContact'][_0x8709('0x61')]()[_0x8709('0x33')](function(_0x3b59aa){if(!_0x3b59aa){throw new db[(_0x8709('0x8d'))][(_0x8709('0x8e'))](_0x8709('0x8f'));}_0x4d8aad=_[_0x8709('0x90')](_[_0x8709('0x56')](_0x3b59aa),[_0x8709('0x91'),_0x8709('0x92')]);_0x4e282f=_[_0x8709('0x90')](_[_0x8709('0x56')](_0x3b59aa),[_0x8709('0x91'),'updatedAt','CompanyId',_0x8709('0x93')]);_0x3044dd[_0x8709('0x60')]={'mapKey':'mobile'};if(_0x3044dd['account']&&_0x3044dd['account'][_0x8709('0x4d')]===_0x8709('0x94')){_0x3044dd['body'][_0x8709('0x95')]=_0xecdf29['body']['From']['replace'](_0x8709('0x96'),'');_0x3044dd[_0x8709('0x60')][_0x8709('0x60')]=_0xecdf29[_0x8709('0x60')][_0x8709('0x97')];_0x3044dd[_0x8709('0x60')][_0x8709('0x98')]=_0xecdf29['body'][_0x8709('0x99')];}if(_0x3044dd[_0x8709('0x84')]&&_0x3044dd[_0x8709('0x84')][_0x8709('0x4d')]==='sinch'){_0x3044dd[_0x8709('0x60')]['from']=_0xecdf29['body'][_0x8709('0x9a')][0x0][_0x8709('0x95')];_0x3044dd[_0x8709('0x60')][_0x8709('0x60')]=_0xecdf29['body'][_0x8709('0x9a')][0x0][_0x8709('0x25')][_0x8709('0x60')];_0x3044dd['body'][_0x8709('0x98')]=_0xecdf29['body'][_0x8709('0x9a')][0x0][_0x8709('0x8a')];}if(_0x3044dd[_0x8709('0x60')]['id']){delete _0x3044dd[_0x8709('0x60')]['id'];}if(_[_0x8709('0x9b')](_0x3044dd[_0x8709('0x60')][_0x8709('0x95')])){throw new db[(_0x8709('0x8d'))][(_0x8709('0x8e'))](_0x8709('0x9c'));}if(_[_0x8709('0x9b')](_0x3044dd[_0x8709('0x60')][_0x8709('0x60')])||_0x3044dd[_0x8709('0x60')]['body']===''){throw new db[(_0x8709('0x8d'))][(_0x8709('0x8e'))](_0x8709('0x9d'));}if(_[_0x8709('0x9b')](_0x3044dd[_0x8709('0x60')][_0x8709('0x9e')])){throw new db[(_0x8709('0x8d'))][(_0x8709('0x8e'))](_0x8709('0x9f')+_0x4e282f);}if(!_['includes'](_0x4e282f,_0x3044dd[_0x8709('0x60')]['mapKey'])){throw new db[(_0x8709('0x8d'))][(_0x8709('0x8e'))](_0x8709('0xa0')+_0x4e282f);}_0x4b7b79[_0x3044dd[_0x8709('0x60')][_0x8709('0x9e')]]=_0x3044dd['body'][_0x8709('0x95')];return db[_0x8709('0xa1')][_0x8709('0x58')]({'where':{'id':_0x3044dd[_0x8709('0x84')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4b7b79,'limit':0x1,'order':[['updatedAt',_0x8709('0xa2')]]}]});})[_0x8709('0x33')](handleEntityNotFound(_0x4de942,null))[_0x8709('0x33')](function(_0x4d59f8){if(_0x4d59f8){_0x3044dd['list']=_[_0x8709('0x6f')](_0x4d59f8,['Contacts']);if(_0x4d59f8[_0x8709('0xa3')]['length']){return _0x4d59f8[_0x8709('0xa3')][0x0];}var _0x47f77a=_[_0x8709('0x19')](_0x3044dd[_0x8709('0x60')],{'firstName':_0x3044dd['body'][_0x8709('0x95')],'ListId':_0x4d59f8['id']});_0x47f77a[_0x3044dd[_0x8709('0x60')][_0x8709('0x9e')]]=_0x3044dd[_0x8709('0x60')][_0x8709('0x95')];return db[_0x8709('0xa4')]['create'](_0x47f77a,{'fields':_0x4d8aad,'raw':!![]});}})[_0x8709('0x33')](handleEntityNotFound(_0x4de942,null))[_0x8709('0x33')](function(_0x2f6c17){if(_0x2f6c17){_0x3044dd[_0x8709('0xa5')]=_0x2f6c17;var _0x5aee16={'ContactId':_0x2f6c17['id'],'phone':_0x3044dd[_0x8709('0x60')][_0x8709('0x95')],'WhatsappAccountId':_0xecdf29[_0x8709('0x55')]['id']};var _0x4d3229={'ContactId':_0x2f6c17['id'],'WhatsappAccountId':_0xecdf29[_0x8709('0x55')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x4d3229})[_0x8709('0x33')](function(_0x404249){if(_0x404249){return[_0x404249,![]];}return db['WhatsappInteraction'][_0x8709('0x59')](_0x5aee16)[_0x8709('0x33')](function(_0x5ea9c4){return[_0x5ea9c4,!![]];});});}})['spread'](function(_0x21e9c1,_0x4d257c){_0x3044dd[_0x8709('0xa6')]=_0x21e9c1[_0x8709('0xa7')]({'plain':!![]});_0x3044dd[_0x8709('0xa6')][_0x8709('0xa8')]=![];if(_0x4d257c){if(_0x3044dd[_0x8709('0x84')][_0x8709('0xa9')]){_0x3044dd['applications'][_0x8709('0xaa')]({'id':0x0,'priority':_0x3044dd[_0x8709('0x8b')][_0x8709('0x57')]+0x1,'app':'close','appdata':_0x8709('0xab'),'interval':'*,*,*,*'});}_0x3044dd[_0x8709('0xa6')][_0x8709('0xa8')]=!![];}return db['WhatsappMessage'][_0x8709('0x59')]({'phone':_0x3044dd[_0x8709('0x60')]['from'],'messageId':_0x3044dd['body']['messageId'],'body':_0x3044dd[_0x8709('0x60')][_0x8709('0x60')],'WhatsappAccountId':_0xecdf29[_0x8709('0x55')]['id'],'WhatsappInteractionId':_0x21e9c1['id'],'direction':'in','ContactId':_0x21e9c1[_0x8709('0xac')],'AttachmentId':_0x3044dd[_0x8709('0x60')]['AttachmentId']});})['then'](function(_0x52a7ef){_0x3044dd[_0x8709('0x25')]=_0x52a7ef;if(_0x3044dd['interaction'][_0x8709('0xad')]){return db[_0x8709('0x74')]['find']({'attributes':['id',_0x8709('0x38')],'where':{'id':_0x3044dd[_0x8709('0xa6')][_0x8709('0xad')]}})['then'](function(_0x1354e6){if(_0x1354e6){_0x3044dd['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1354e6[_0x8709('0x38')]+','+(_0x3044dd[_0x8709('0x84')]['waitForTheAssignedAgent']||0xa),'interval':_0x8709('0xae')});}return respondWithRpcPromise(_0x8709('0xaf'),_0x8709('0xb0'),_0x3044dd);});}return respondWithRpcPromise(_0x8709('0xaf'),'startRouting',_0x3044dd);})['then'](function(_0x353855){if(_0x353855){var _0x5bed14=0xc8;var _0x53d492=_0x8709('0xb1');logger[_0x8709('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x53d492,_0x5bed14,'entity\x20found');logger[_0x8709('0x22')](_0x8709('0xb2'),_0x53d492,_0x5bed14,'entity\x20found',JSON[_0x8709('0xb3')](_0x353855));if(_0x3044dd[_0x8709('0x84')][_0x8709('0x4d')]===_0x8709('0x94')){return _0x4de942[_0x8709('0x2a')](_0x5bed14)[_0x8709('0xb4')](_0x8709('0xb5'),'text/xml')[_0x8709('0x7f')](_0x8709('0xb6'));}else{return _0x4de942[_0x8709('0x2a')](_0x5bed14)[_0x8709('0x2c')](_0x353855);}}});})[_0x8709('0x28')](handleError(_0x4de942,null));};exports[_0x8709('0x7f')]=function(_0x4e772b,_0xfe6ac5,_0x3eef73){var _0x4a89c6,_0x1c5f71,_0x3ec7bc;if(_[_0x8709('0x9b')](_0x4e772b[_0x8709('0x60')][_0x8709('0x60')])||_0x4e772b[_0x8709('0x60')][_0x8709('0x60')]===''){throw new db[(_0x8709('0x8d'))][(_0x8709('0x8e'))](_0x8709('0x9d'));}if(_[_0x8709('0x9b')](_0x4e772b[_0x8709('0x60')]['to'])){throw new db[(_0x8709('0x8d'))][(_0x8709('0x8e'))](_0x8709('0xb7'));}_0x4a89c6=_0x4e772b[_0x8709('0x60')]['to'];return db[_0x8709('0x3d')][_0x8709('0x58')]({'where':{'id':_0x4e772b[_0x8709('0x55')]['id']},'include':[{'model':db[_0x8709('0xa1')],'as':_0x8709('0xb8'),'include':[{'model':db[_0x8709('0xa4')],'as':'Contacts','where':{'mobile':_0x4a89c6},'limit':0x1,'order':[[_0x8709('0x92'),_0x8709('0xa2')]]}]}]})['then'](handleEntityNotFound(_0xfe6ac5,null))['then'](function(_0x2d987a){if(_0x2d987a&&_0x2d987a[_0x8709('0xb8')]){_0x1c5f71=_0x2d987a['get']({'plain':!![]});if(_0x1c5f71['List']&&_0x1c5f71[_0x8709('0xb8')]['Contacts'][_0x8709('0x57')]){return _0x1c5f71['List'][_0x8709('0xa3')][0x0];}return db['CmContact'][_0x8709('0x59')](_[_0x8709('0x19')](_0x4e772b[_0x8709('0x60')],{'firstName':_0x4a89c6,'mobile':_0x4a89c6,'phone':_0x4a89c6,'ListId':_0x1c5f71['ListId']}));}})['then'](handleEntityNotFound(_0xfe6ac5,null))[_0x8709('0x33')](function(_0x2ee246){if(_0x2ee246){_0x3ec7bc=_0x2ee246;return db[_0x8709('0xb9')][_0x8709('0x58')]({'where':{'ContactId':_0x3ec7bc['id'],'closed':![],'WhatsappAccountId':_0x1c5f71['id']}})[_0x8709('0x33')](function(_0x56ef99){if(_0x56ef99){return[_0x56ef99,![]];}return db[_0x8709('0xb9')]['create']({'UserId':_0x4e772b[_0x8709('0x5a')]['id'],'ContactId':_0x3ec7bc['id'],'WhatsappAccountId':_0x1c5f71['id'],'phone':_0x4a89c6,'firstMsgDirection':_0x8709('0xba'),'Messages':[_['merge'](_0x4e772b[_0x8709('0x60')],{'read':![],'body':_0x4e772b[_0x8709('0x60')][_0x8709('0x60')],'phone':_0x4a89c6,'WhatsappAccountId':_0x1c5f71['id'],'UserId':_0x4e772b['user']['id'],'ContactId':_0x3ec7bc['id']})]},{'include':[{'model':db[_0x8709('0x89')],'as':_0x8709('0xbb')}]})[_0x8709('0x33')](function(_0x176e9b){return[_0x176e9b,!![]];});});}})[_0x8709('0x70')](function(_0x53ab51,_0x13fabe){if(_0x13fabe){return _0x53ab51;}return db['WhatsappMessage'][_0x8709('0x59')](_[_0x8709('0x4c')](_0x4e772b[_0x8709('0x60')],{'read':![],'body':_0x4e772b[_0x8709('0x60')][_0x8709('0x60')],'phone':_0x4a89c6,'WhatsappAccountId':_0x1c5f71['id'],'WhatsappInteractionId':_0x53ab51['id'],'UserId':_0x4e772b['user']['id'],'ContactId':_0x3ec7bc['id']}))['then'](function(_0x38f406){_0x53ab51[_0x8709('0xbc')][_0x8709('0xbb')]=[];_0x53ab51[_0x8709('0xbc')][_0x8709('0xbb')][_0x8709('0xaa')](_0x38f406[_0x8709('0xbc')]);return _0x53ab51;});})[_0x8709('0x33')](respondWithResult(_0xfe6ac5,null))[_0x8709('0x28')](handleError(_0xfe6ac5,null));}; \ No newline at end of file +var _0x03bf=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','http','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','then','destroy','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappAccount','count','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','CannedAnswer','findAll','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','Transaction','READ_COMMITTED','findOne','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','From','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','send','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x1c2dd0,_0x5d6be9){var _0x2a9f6c=function(_0x25dda2){while(--_0x25dda2){_0x1c2dd0['push'](_0x1c2dd0['shift']());}};_0x2a9f6c(++_0x5d6be9);}(_0x03bf,0x162));var _0xf03b=function(_0x2b7ae0,_0x517329){_0x2b7ae0=_0x2b7ae0-0x0;var _0x365513=_0x03bf[_0x2b7ae0];return _0x365513;};'use strict';var emlformat=require(_0xf03b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf03b('0x1'));var moment=require(_0xf03b('0x2'));var BPromise=require(_0xf03b('0x3'));var Mustache=require('mustache');var util=require(_0xf03b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xf03b('0x5'));var ejs=require(_0xf03b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf03b('0x7'));var squel=require(_0xf03b('0x8'));var crypto=require(_0xf03b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf03b('0xa'));var Papa=require(_0xf03b('0xb'));var Redis=require(_0xf03b('0xc'));var authService=require(_0xf03b('0xd'));var qs=require(_0xf03b('0xe'));var as=require(_0xf03b('0xf'));var hardwareService=require(_0xf03b('0x10'));var logger=require(_0xf03b('0x11'))(_0xf03b('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf03b('0x13'));var db=require(_0xf03b('0x14'))['db'];config['redis']=_[_0xf03b('0x15')](config['redis'],{'host':_0xf03b('0x16'),'port':0x18eb});var socket=require(_0xf03b('0x17'))(new Redis(config[_0xf03b('0x18')]));require('./whatsappAccount.socket')[_0xf03b('0x19')](socket);var jayson=require(_0xf03b('0x1a'));var client=jayson['client'][_0xf03b('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x595e07,_0x3f6a01,_0x2887da,_0x4404b8){return new BPromise(function(_0x23df7d,_0x52923d){var _0x36a885=_0x4404b8||client;return _0x36a885['request'](_0x595e07,_0x2887da)['then'](function(_0x102aa9){logger['info'](_0xf03b('0x1c'),_0x3f6a01,_0xf03b('0x1d'));logger[_0xf03b('0x1e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3f6a01,_0xf03b('0x1d'),JSON[_0xf03b('0x1f')](_0x102aa9));if(_0x102aa9[_0xf03b('0x20')]){if(_0x102aa9[_0xf03b('0x20')][_0xf03b('0x21')]===0x1f4){logger[_0xf03b('0x20')](_0xf03b('0x1c'),_0x3f6a01,_0x102aa9['error'][_0xf03b('0x22')]);return _0x52923d(_0x102aa9[_0xf03b('0x20')][_0xf03b('0x22')]);}logger[_0xf03b('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x3f6a01,_0x102aa9[_0xf03b('0x20')][_0xf03b('0x22')]);return _0x23df7d(_0x102aa9['error'][_0xf03b('0x22')]);}else{logger['info'](_0xf03b('0x1c'),_0x3f6a01,'request\x20sent');_0x23df7d(_0x102aa9[_0xf03b('0x23')][_0xf03b('0x22')]);}})['catch'](function(_0x56c6f2){logger[_0xf03b('0x20')](_0xf03b('0x1c'),_0x3f6a01,_0x56c6f2);_0x52923d(_0x56c6f2);});});}function respondWithStatusCode(_0x1bf4bf,_0x3e377a){_0x3e377a=_0x3e377a||0xcc;return function(_0x1fdffb){if(_0x1fdffb){return _0x1bf4bf[_0xf03b('0x24')](_0x3e377a);}return _0x1bf4bf[_0xf03b('0x25')](_0x3e377a)[_0xf03b('0x26')]();};}function respondWithResult(_0x42662b,_0x4bf0fe){_0x4bf0fe=_0x4bf0fe||0xc8;return function(_0xbae20e){if(_0xbae20e){return _0x42662b[_0xf03b('0x25')](_0x4bf0fe)[_0xf03b('0x27')](_0xbae20e);}};}function respondWithFilteredResult(_0x2152fb,_0x27ea6a){return function(_0x153648){if(_0x153648){var _0x3c8f88=typeof _0x27ea6a['offset']===_0xf03b('0x28')&&typeof _0x27ea6a[_0xf03b('0x29')]===_0xf03b('0x28');var _0x307305=_0x153648['count'];var _0x5c6c36=_0x3c8f88?0x0:_0x27ea6a['offset'];var _0x51c863=_0x3c8f88?_0x153648['count']:_0x27ea6a[_0xf03b('0x2a')]+_0x27ea6a['limit'];var _0x3f4266;if(_0x51c863>=_0x307305){_0x51c863=_0x307305;_0x3f4266=0xc8;}else{_0x3f4266=0xce;}_0x2152fb[_0xf03b('0x25')](_0x3f4266);return _0x2152fb[_0xf03b('0x2b')](_0xf03b('0x2c'),_0x5c6c36+'-'+_0x51c863+'/'+_0x307305)[_0xf03b('0x27')](_0x153648);}return null;};}function patchUpdates(_0x33c012){return function(_0xdb5aed){try{jsonpatch[_0xf03b('0x2d')](_0xdb5aed,_0x33c012,!![]);}catch(_0x1280e2){return BPromise[_0xf03b('0x2e')](_0x1280e2);}return _0xdb5aed['save']();};}function saveUpdates(_0x3a8fb6,_0x39a661){return function(_0x35e525){if(_0x35e525){return _0x35e525['update'](_0x3a8fb6)[_0xf03b('0x2f')](function(_0x560fc6){return _0x560fc6;});}return null;};}function removeEntity(_0x388ac3,_0x2ea2ab){return function(_0x5ceaec){if(_0x5ceaec){return _0x5ceaec[_0xf03b('0x30')]()[_0xf03b('0x2f')](function(){var _0x39ec74=_0x5ceaec['get']({'plain':!![]});var _0x1e14e0=_0xf03b('0x31');return db[_0xf03b('0x32')][_0xf03b('0x30')]({'where':{'type':_0x1e14e0,'resourceId':_0x39ec74['id']}})[_0xf03b('0x2f')](function(){return _0x5ceaec;});})[_0xf03b('0x2f')](function(){_0x388ac3[_0xf03b('0x25')](0xcc)[_0xf03b('0x26')]();});}};}function handleEntityNotFound(_0x1c2e7f,_0xba2cb0){return function(_0x2690e0){if(!_0x2690e0){_0x1c2e7f['sendStatus'](0x194);}return _0x2690e0;};}function handleError(_0x193aed,_0x3775e6){_0x3775e6=_0x3775e6||0x1f4;return function(_0x32920b){logger['error'](_0x32920b[_0xf03b('0x33')]);if(_0x32920b[_0xf03b('0x34')]){delete _0x32920b[_0xf03b('0x34')];}_0x193aed[_0xf03b('0x25')](_0x3775e6)['send'](_0x32920b);};}exports[_0xf03b('0x35')]=function(_0x453074,_0xe89415){var _0x22d29a={'include':[{'model':db[_0xf03b('0x36')],'as':_0xf03b('0x37')}]},_0x5d92c7={},_0x100ecf={'count':0x0,'rows':[]};var _0x1e1d18=_['map'](db['WhatsappAccount'][_0xf03b('0x38')],function(_0x252d06){return{'name':_0x252d06[_0xf03b('0x39')],'type':_0x252d06[_0xf03b('0x3a')][_0xf03b('0x3b')]};});_0x5d92c7[_0xf03b('0x3c')]=_[_0xf03b('0x3d')](_0x1e1d18,'name');_0x5d92c7[_0xf03b('0x3e')]=_[_0xf03b('0x3f')](_0x453074[_0xf03b('0x3e')]);_0x5d92c7[_0xf03b('0x40')]=_['intersection'](_0x5d92c7['model'],_0x5d92c7['query']);_0x22d29a[_0xf03b('0x41')]=_[_0xf03b('0x42')](_0x5d92c7['model'],qs[_0xf03b('0x43')](_0x453074[_0xf03b('0x3e')][_0xf03b('0x43')]));_0x22d29a[_0xf03b('0x41')]=_0x22d29a[_0xf03b('0x41')][_0xf03b('0x44')]?_0x22d29a[_0xf03b('0x41')]:_0x5d92c7['model'];if(!_0x453074[_0xf03b('0x3e')][_0xf03b('0x45')](_0xf03b('0x46'))){_0x22d29a['limit']=qs[_0xf03b('0x29')](_0x453074[_0xf03b('0x3e')][_0xf03b('0x29')]);_0x22d29a[_0xf03b('0x2a')]=qs[_0xf03b('0x2a')](_0x453074[_0xf03b('0x3e')][_0xf03b('0x2a')]);}_0x22d29a[_0xf03b('0x47')]=qs[_0xf03b('0x48')](_0x453074[_0xf03b('0x3e')]['sort']);_0x22d29a['where']=qs[_0xf03b('0x40')](_[_0xf03b('0x49')](_0x453074[_0xf03b('0x3e')],_0x5d92c7[_0xf03b('0x40')]),_0x1e1d18);if(_0x453074['query'][_0xf03b('0x4a')]){_0x22d29a[_0xf03b('0x4b')]=_[_0xf03b('0x4c')](_0x22d29a[_0xf03b('0x4b')],{'$or':_['map'](_0x1e1d18,function(_0x1c6692){if(_0x1c6692[_0xf03b('0x3a')]!==_0xf03b('0x4d')){var _0x453be3={};_0x453be3[_0x1c6692[_0xf03b('0x34')]]={'$like':'%'+_0x453074[_0xf03b('0x3e')]['filter']+'%'};return _0x453be3;}})});}_0x22d29a=_['merge']({},_0x22d29a,_0x453074[_0xf03b('0x4e')]);var _0x2ddf6b={'where':_0x22d29a[_0xf03b('0x4b')]};return db[_0xf03b('0x4f')]['count'](_0x2ddf6b)[_0xf03b('0x2f')](function(_0x31de12){_0x100ecf[_0xf03b('0x50')]=_0x31de12;if(_0x453074[_0xf03b('0x3e')][_0xf03b('0x51')]){_0x22d29a[_0xf03b('0x52')]=[{'all':!![]}];}return db[_0xf03b('0x4f')]['findAll'](_0x22d29a);})[_0xf03b('0x2f')](function(_0x3a7368){_0x100ecf[_0xf03b('0x53')]=_0x3a7368;return _0x100ecf;})[_0xf03b('0x2f')](respondWithFilteredResult(_0xe89415,_0x22d29a))[_0xf03b('0x54')](handleError(_0xe89415,null));};exports[_0xf03b('0x55')]=function(_0x4f8d2d,_0x5f0ab5){var _0x34bec1={'raw':![],'where':{'id':_0x4f8d2d[_0xf03b('0x56')]['id']},'include':[{'model':db[_0xf03b('0x36')],'as':_0xf03b('0x37')}]},_0x3cf965={};_0x3cf965[_0xf03b('0x3c')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x3cf965[_0xf03b('0x3e')]=_[_0xf03b('0x3f')](_0x4f8d2d[_0xf03b('0x3e')]);_0x3cf965['filters']=_[_0xf03b('0x42')](_0x3cf965[_0xf03b('0x3c')],_0x3cf965[_0xf03b('0x3e')]);_0x34bec1[_0xf03b('0x41')]=_[_0xf03b('0x42')](_0x3cf965['model'],qs[_0xf03b('0x43')](_0x4f8d2d[_0xf03b('0x3e')][_0xf03b('0x43')]));_0x34bec1[_0xf03b('0x41')]=_0x34bec1[_0xf03b('0x41')]['length']?_0x34bec1[_0xf03b('0x41')]:_0x3cf965[_0xf03b('0x3c')];if(_0x4f8d2d[_0xf03b('0x3e')][_0xf03b('0x51')]){_0x34bec1[_0xf03b('0x52')]=[{'all':!![]}];}_0x34bec1=_[_0xf03b('0x4c')]({},_0x34bec1,_0x4f8d2d[_0xf03b('0x4e')]);return db[_0xf03b('0x4f')][_0xf03b('0x57')](_0x34bec1)['then'](handleEntityNotFound(_0x5f0ab5,null))[_0xf03b('0x2f')](respondWithResult(_0x5f0ab5,null))[_0xf03b('0x54')](handleError(_0x5f0ab5,null));};exports['create']=function(_0x5a7de4,_0x33c55a){return db[_0xf03b('0x4f')][_0xf03b('0x58')](_0x5a7de4[_0xf03b('0x59')],{})[_0xf03b('0x2f')](function(_0x320923){var _0x2fe238=_0x5a7de4[_0xf03b('0x5a')][_0xf03b('0x5b')]({'plain':!![]});if(!_0x2fe238)throw new Error(_0xf03b('0x5c'));if(_0x2fe238['role']===_0xf03b('0x5a')){var _0x2c870d=_0x320923[_0xf03b('0x5b')]({'plain':!![]});var _0x326357=_0xf03b('0x31');return db[_0xf03b('0x5d')][_0xf03b('0x57')]({'where':{'name':_0x326357,'userProfileId':_0x2fe238[_0xf03b('0x5e')]},'raw':!![]})[_0xf03b('0x2f')](function(_0x28b7a1){if(_0x28b7a1&&_0x28b7a1['autoAssociation']===0x0){return db[_0xf03b('0x32')][_0xf03b('0x58')]({'name':_0x2c870d[_0xf03b('0x34')],'resourceId':_0x2c870d['id'],'type':_0x28b7a1[_0xf03b('0x34')],'sectionId':_0x28b7a1['id']},{})['then'](function(){return _0x320923;});}else{return _0x320923;}})[_0xf03b('0x54')](function(_0xa1c674){logger[_0xf03b('0x20')](_0xf03b('0x5f'),_0xa1c674);throw _0xa1c674;});}return _0x320923;})['then'](respondWithResult(_0x33c55a,0xc9))[_0xf03b('0x54')](handleError(_0x33c55a,null));};exports[_0xf03b('0x60')]=function(_0x4464d2,_0x1f33cc){if(_0x4464d2[_0xf03b('0x59')]['id']){delete _0x4464d2[_0xf03b('0x59')]['id'];}return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x4464d2[_0xf03b('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xf03b('0x37')}]})[_0xf03b('0x2f')](handleEntityNotFound(_0x1f33cc,null))[_0xf03b('0x2f')](saveUpdates(_0x4464d2['body'],null))[_0xf03b('0x2f')](respondWithResult(_0x1f33cc,null))[_0xf03b('0x54')](handleError(_0x1f33cc,null));};exports[_0xf03b('0x30')]=function(_0x4d54ad,_0x7b6e16){return db[_0xf03b('0x4f')]['find']({'where':{'id':_0x4d54ad[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x7b6e16,null))[_0xf03b('0x2f')](removeEntity(_0x7b6e16,null))[_0xf03b('0x54')](handleError(_0x7b6e16,null));};exports['describe']=function(_0x432131,_0x258510){return db[_0xf03b('0x4f')][_0xf03b('0x61')]()['then'](respondWithResult(_0x258510,null))[_0xf03b('0x54')](handleError(_0x258510,null));};exports[_0xf03b('0x62')]=function(_0x308ad4,_0x5b8665,_0xebfb95){if(_0x308ad4[_0xf03b('0x59')]['id']){delete _0x308ad4[_0xf03b('0x59')]['id'];}return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x308ad4[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x5b8665,null))[_0xf03b('0x2f')](function(_0x17cfef){if(_0x17cfef){_0x308ad4[_0xf03b('0x59')][_0xf03b('0x63')]=_0x17cfef['id'];return db[_0xf03b('0x64')][_0xf03b('0x58')](_0x308ad4[_0xf03b('0x59')]);}})['then'](respondWithResult(_0x5b8665,null))[_0xf03b('0x54')](handleError(_0x5b8665,null));};exports[_0xf03b('0x65')]=function(_0x536f1b,_0x3872cb,_0x1723c0){var _0x3aba56={'raw':![],'where':{}};var _0x1e4591={};var _0x1bf6b={'count':0x0,'rows':[]};return db[_0xf03b('0x4f')]['findOne']({'where':{'id':_0x536f1b[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x3872cb,null))[_0xf03b('0x2f')](function(_0x2c471c){if(_0x2c471c){_0x1e4591[_0xf03b('0x3c')]=_[_0xf03b('0x3f')](db['Disposition'][_0xf03b('0x38')]);_0x1e4591[_0xf03b('0x3e')]=_[_0xf03b('0x3f')](_0x536f1b[_0xf03b('0x3e')]);_0x1e4591[_0xf03b('0x40')]=_['intersection'](_0x1e4591[_0xf03b('0x3c')],_0x1e4591[_0xf03b('0x3e')]);_0x3aba56[_0xf03b('0x41')]=_[_0xf03b('0x42')](_0x1e4591[_0xf03b('0x3c')],qs[_0xf03b('0x43')](_0x536f1b['query']['fields']));_0x3aba56[_0xf03b('0x41')]=_0x3aba56[_0xf03b('0x41')][_0xf03b('0x44')]?_0x3aba56[_0xf03b('0x41')]:_0x1e4591[_0xf03b('0x3c')];if(!_0x536f1b[_0xf03b('0x3e')]['hasOwnProperty']('nolimit')){_0x3aba56[_0xf03b('0x29')]=qs['limit'](_0x536f1b[_0xf03b('0x3e')][_0xf03b('0x29')]);_0x3aba56[_0xf03b('0x2a')]=qs[_0xf03b('0x2a')](_0x536f1b[_0xf03b('0x3e')][_0xf03b('0x2a')]);}_0x3aba56[_0xf03b('0x47')]=qs[_0xf03b('0x48')](_0x536f1b[_0xf03b('0x3e')][_0xf03b('0x48')]);_0x3aba56[_0xf03b('0x4b')]=qs[_0xf03b('0x40')](_[_0xf03b('0x49')](_0x536f1b[_0xf03b('0x3e')],_0x1e4591['filters']));_0x3aba56[_0xf03b('0x4b')][_0xf03b('0x63')]=_0x2c471c['id'];if(_0x536f1b[_0xf03b('0x3e')]['filter']){_0x3aba56['where']=_[_0xf03b('0x4c')](_0x3aba56['where'],{'$or':_[_0xf03b('0x3d')](_0x3aba56[_0xf03b('0x41')],function(_0x660161){var _0x158abe={};_0x158abe[_0x660161]={'$like':'%'+_0x536f1b[_0xf03b('0x3e')]['filter']+'%'};return _0x158abe;})});}_0x3aba56=_[_0xf03b('0x4c')]({},_0x3aba56,_0x536f1b[_0xf03b('0x4e')]);return db[_0xf03b('0x64')]['count']({'where':_0x3aba56[_0xf03b('0x4b')]})[_0xf03b('0x2f')](function(_0x1cd07c){_0x1bf6b['count']=_0x1cd07c;if(_0x536f1b[_0xf03b('0x3e')][_0xf03b('0x51')]){_0x3aba56[_0xf03b('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3aba56);})[_0xf03b('0x2f')](function(_0x369249){_0x1bf6b['rows']=_0x369249;return _0x1bf6b;});}})[_0xf03b('0x2f')](respondWithFilteredResult(_0x3872cb,_0x3aba56))[_0xf03b('0x54')](handleError(_0x3872cb,null));};exports['removeDispositions']=function(_0x6c875c,_0x3afbbf,_0x3de70b){return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x6c875c[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x3afbbf,null))['then'](function(_0x419dbf){if(_0x419dbf){return _0x419dbf[_0xf03b('0x66')](_0x6c875c[_0xf03b('0x3e')][_0xf03b('0x67')]);}})['then'](respondWithStatusCode(_0x3afbbf,null))[_0xf03b('0x54')](handleError(_0x3afbbf,null));};exports['addAnswer']=function(_0x2c1af7,_0x1aeb22,_0x2a59e2){if(_0x2c1af7['body']['id']){delete _0x2c1af7[_0xf03b('0x59')]['id'];}return db['WhatsappAccount'][_0xf03b('0x57')]({'where':{'id':_0x2c1af7[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x1aeb22,null))[_0xf03b('0x2f')](function(_0xf26505){if(_0xf26505){_0x2c1af7[_0xf03b('0x59')][_0xf03b('0x63')]=_0xf26505['id'];return db[_0xf03b('0x68')][_0xf03b('0x58')](_0x2c1af7[_0xf03b('0x59')]);}})[_0xf03b('0x2f')](respondWithResult(_0x1aeb22,null))['catch'](handleError(_0x1aeb22,null));};exports['getAnswers']=function(_0x2dfbc5,_0x34a230,_0x532e89){var _0x4392dc={'raw':![],'where':{}};var _0x154186={};var _0x19ada8={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2dfbc5[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x34a230,null))[_0xf03b('0x2f')](function(_0x503e7a){if(_0x503e7a){_0x154186[_0xf03b('0x3c')]=_[_0xf03b('0x3f')](db[_0xf03b('0x68')][_0xf03b('0x38')]);_0x154186['query']=_[_0xf03b('0x3f')](_0x2dfbc5[_0xf03b('0x3e')]);_0x154186[_0xf03b('0x40')]=_[_0xf03b('0x42')](_0x154186[_0xf03b('0x3c')],_0x154186['query']);_0x4392dc[_0xf03b('0x41')]=_[_0xf03b('0x42')](_0x154186['model'],qs[_0xf03b('0x43')](_0x2dfbc5[_0xf03b('0x3e')]['fields']));_0x4392dc[_0xf03b('0x41')]=_0x4392dc['attributes']['length']?_0x4392dc[_0xf03b('0x41')]:_0x154186['model'];if(!_0x2dfbc5['query']['hasOwnProperty']('nolimit')){_0x4392dc[_0xf03b('0x29')]=qs['limit'](_0x2dfbc5[_0xf03b('0x3e')][_0xf03b('0x29')]);_0x4392dc['offset']=qs['offset'](_0x2dfbc5[_0xf03b('0x3e')][_0xf03b('0x2a')]);}_0x4392dc[_0xf03b('0x47')]=qs[_0xf03b('0x48')](_0x2dfbc5[_0xf03b('0x3e')][_0xf03b('0x48')]);_0x4392dc[_0xf03b('0x4b')]=qs[_0xf03b('0x40')](_[_0xf03b('0x49')](_0x2dfbc5[_0xf03b('0x3e')],_0x154186[_0xf03b('0x40')]));_0x4392dc[_0xf03b('0x4b')][_0xf03b('0x63')]=_0x503e7a['id'];if(_0x2dfbc5[_0xf03b('0x3e')][_0xf03b('0x4a')]){_0x4392dc['where']=_['merge'](_0x4392dc[_0xf03b('0x4b')],{'$or':_[_0xf03b('0x3d')](_0x4392dc[_0xf03b('0x41')],function(_0x4a7c7f){var _0x13981b={};_0x13981b[_0x4a7c7f]={'$like':'%'+_0x2dfbc5['query'][_0xf03b('0x4a')]+'%'};return _0x13981b;})});}_0x4392dc=_['merge']({},_0x4392dc,_0x2dfbc5['options']);return db[_0xf03b('0x68')][_0xf03b('0x50')]({'where':_0x4392dc[_0xf03b('0x4b')]})[_0xf03b('0x2f')](function(_0x29139a){_0x19ada8[_0xf03b('0x50')]=_0x29139a;if(_0x2dfbc5['query'][_0xf03b('0x51')]){_0x4392dc[_0xf03b('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf03b('0x69')](_0x4392dc);})['then'](function(_0x1c781c){_0x19ada8['rows']=_0x1c781c;return _0x19ada8;});}})[_0xf03b('0x2f')](respondWithFilteredResult(_0x34a230,_0x4392dc))[_0xf03b('0x54')](handleError(_0x34a230,null));};exports[_0xf03b('0x6a')]=function(_0x484a0c,_0x10767f,_0x5ca4f1){return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x484a0c[_0xf03b('0x56')]['id']}})['then'](handleEntityNotFound(_0x10767f,null))[_0xf03b('0x2f')](function(_0xece953){if(_0xece953){return _0xece953[_0xf03b('0x6a')](_0x484a0c[_0xf03b('0x3e')][_0xf03b('0x67')]);}})[_0xf03b('0x2f')](respondWithStatusCode(_0x10767f,null))[_0xf03b('0x54')](handleError(_0x10767f,null));};exports[_0xf03b('0x6b')]=function(_0x3a6de3,_0xe9682c,_0x14cf5a){return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x3a6de3[_0xf03b('0x56')]['id']}})['then'](handleEntityNotFound(_0xe9682c,null))[_0xf03b('0x2f')](function(_0x2626b0){if(_0x2626b0){return _0x2626b0[_0xf03b('0x6b')](_0x3a6de3['body'][_0xf03b('0x67')],_[_0xf03b('0x6c')](_0x3a6de3[_0xf03b('0x59')],['ids','id'])||{})['spread'](function(_0x56417a){for(var _0xc1fa75=0x0;_0xc1fa75<_0x3a6de3[_0xf03b('0x59')][_0xf03b('0x67')][_0xf03b('0x44')];_0xc1fa75+=0x1){socket[_0xf03b('0x6d')]('userWhatsappAccount:save',{'UserId':Number(_0x3a6de3[_0xf03b('0x59')][_0xf03b('0x67')][_0xc1fa75]),'WhatsappAccountId':Number(_0x3a6de3[_0xf03b('0x56')]['id'])});}return _0x56417a;});}})[_0xf03b('0x2f')](respondWithResult(_0xe9682c,null))[_0xf03b('0x54')](handleError(_0xe9682c,null));};exports[_0xf03b('0x6e')]=function(_0x1d161a,_0x281690,_0xe9651d){return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x1d161a[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x281690,null))[_0xf03b('0x2f')](function(_0x71d1b8){if(_0x71d1b8){return _0x71d1b8['removeAgents'](_0x1d161a[_0xf03b('0x3e')][_0xf03b('0x67')])['then'](function(){if(_[_0xf03b('0x6f')](_0x1d161a[_0xf03b('0x3e')][_0xf03b('0x67')])){for(var _0x36f65c=0x0;_0x36f65c<_0x1d161a[_0xf03b('0x3e')][_0xf03b('0x67')][_0xf03b('0x44')];_0x36f65c+=0x1){socket[_0xf03b('0x6d')]('userWhatsappAccount:remove',{'UserId':Number(_0x1d161a[_0xf03b('0x3e')][_0xf03b('0x67')][_0x36f65c]),'WhatsappAccountId':Number(_0x1d161a['params']['id'])});}}else{socket[_0xf03b('0x6d')](_0xf03b('0x70'),{'UserId':Number(_0x1d161a[_0xf03b('0x3e')][_0xf03b('0x67')]),'WhatsappAccountId':Number(_0x1d161a['params']['id'])});}});}})[_0xf03b('0x2f')](respondWithStatusCode(_0x281690,null))[_0xf03b('0x54')](handleError(_0x281690,null));};exports[_0xf03b('0x71')]=function(_0x5a5280,_0x19d34c,_0x3d3c0f){var _0x3d657f={};var _0x5a5183={};var _0x2ed6f7;var _0x3521aa;return db[_0xf03b('0x4f')]['findOne']({'where':{'id':_0x5a5280['params']['id']}})['then'](handleEntityNotFound(_0x19d34c,null))[_0xf03b('0x2f')](function(_0x4a5927){if(_0x4a5927){_0x2ed6f7=_0x4a5927;_0x5a5183[_0xf03b('0x3c')]=_[_0xf03b('0x3f')](db['User'][_0xf03b('0x38')]);_0x5a5183['query']=_[_0xf03b('0x3f')](_0x5a5280['query']);_0x5a5183[_0xf03b('0x40')]=_[_0xf03b('0x42')](_0x5a5183['model'],_0x5a5183[_0xf03b('0x3e')]);_0x3d657f[_0xf03b('0x41')]=_[_0xf03b('0x42')](_0x5a5183['model'],qs[_0xf03b('0x43')](_0x5a5280['query'][_0xf03b('0x43')]));_0x3d657f[_0xf03b('0x41')]=_0x3d657f[_0xf03b('0x41')][_0xf03b('0x44')]?_0x3d657f[_0xf03b('0x41')]:_0x5a5183[_0xf03b('0x3c')];_0x3d657f[_0xf03b('0x47')]=qs['sort'](_0x5a5280[_0xf03b('0x3e')][_0xf03b('0x48')]);_0x3d657f[_0xf03b('0x4b')]=qs[_0xf03b('0x40')](_['pick'](_0x5a5280[_0xf03b('0x3e')],_0x5a5183[_0xf03b('0x40')]));if(_0x5a5280[_0xf03b('0x3e')][_0xf03b('0x4a')]){_0x3d657f[_0xf03b('0x4b')]=_[_0xf03b('0x4c')](_0x3d657f[_0xf03b('0x4b')],{'$or':_[_0xf03b('0x3d')](_0x3d657f[_0xf03b('0x41')],function(_0x5a6f61){var _0x1e9d9c={};_0x1e9d9c[_0x5a6f61]={'$like':'%'+_0x5a5280[_0xf03b('0x3e')][_0xf03b('0x4a')]+'%'};return _0x1e9d9c;})});}_0x3d657f=_[_0xf03b('0x4c')]({},_0x3d657f,_0x5a5280['options']);return _0x2ed6f7[_0xf03b('0x71')](_0x3d657f);}})['then'](function(_0x879f44){if(_0x879f44){_0x3521aa=_0x879f44[_0xf03b('0x44')];if(!_0x5a5280[_0xf03b('0x3e')][_0xf03b('0x45')](_0xf03b('0x46'))){_0x3d657f[_0xf03b('0x29')]=qs[_0xf03b('0x29')](_0x5a5280[_0xf03b('0x3e')][_0xf03b('0x29')]);_0x3d657f[_0xf03b('0x2a')]=qs['offset'](_0x5a5280[_0xf03b('0x3e')][_0xf03b('0x2a')]);}return _0x2ed6f7[_0xf03b('0x71')](_0x3d657f);}})['then'](function(_0x2d83c0){if(_0x2d83c0){return _0x2d83c0?{'count':_0x3521aa,'rows':_0x2d83c0}:null;}})[_0xf03b('0x2f')](respondWithResult(_0x19d34c,null))[_0xf03b('0x54')](handleError(_0x19d34c,null));};exports['addApplications']=function(_0x54a0c3,_0x414650){var _0x149537=_0x54a0c3['params']['id'];var _0xdb0b18=_0x54a0c3['body'];var _0x3c54f8=0xc8;var _0x25d48c=null;return db[_0xf03b('0x72')]['transaction']({'isolationLevel':db[_0xf03b('0x72')][_0xf03b('0x73')]['ISOLATION_LEVELS'][_0xf03b('0x74')]},function(_0x2f9654){return db[_0xf03b('0x4f')][_0xf03b('0x75')]({'where':{'id':_0x149537},'transaction':_0x2f9654})[_0xf03b('0x2f')](function(_0xbef6f3){if(_0xbef6f3){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x149537},'transaction':_0x2f9654})['then'](function(){var _0x58184a=_['map'](_0xdb0b18,function(_0x5e6b72){_0x5e6b72['WhatsappAccountId']=_0x149537;return _0x5e6b72;});return db[_0xf03b('0x76')]['bulkCreate'](_0x58184a,{'transaction':_0x2f9654});});}else{_0x3c54f8=0x194;_0x25d48c=[];}});})[_0xf03b('0x2f')](function(){if(_0x3c54f8!==0x194){return db[_0xf03b('0x76')][_0xf03b('0x77')]({'where':{'WhatsappAccountId':_0x149537},'order':_0xf03b('0x78')})[_0xf03b('0x2f')](function(_0x3fe7a1){_0x25d48c=_0x3fe7a1;});}})[_0xf03b('0x54')](function(_0x5b0375){_0x3c54f8=0x1f4;logger[_0xf03b('0x20')](_0x5b0375[_0xf03b('0x33')]);if(_0x5b0375['name']){delete _0x5b0375[_0xf03b('0x34')];}_0x25d48c=_0x5b0375;})[_0xf03b('0x79')](function(){if(_0x25d48c===null){_0x414650[_0xf03b('0x24')](_0x3c54f8);}else{if(_0x3c54f8===0x1f4){_0x414650[_0xf03b('0x25')](_0x3c54f8)['send'](_0x25d48c);}else{_0x414650[_0xf03b('0x25')](_0x3c54f8)[_0xf03b('0x27')](_0x25d48c);}}});};exports[_0xf03b('0x7a')]=function(_0x45bd9b,_0x4de699,_0x456a09){var _0x2de473={};var _0x1ac0c6={};var _0x27ec2f;var _0x29e770;return db[_0xf03b('0x4f')][_0xf03b('0x75')]({'where':{'id':_0x45bd9b[_0xf03b('0x56')]['id']}})[_0xf03b('0x2f')](handleEntityNotFound(_0x4de699,null))['then'](function(_0x2acc74){if(_0x2acc74){_0x27ec2f=_0x2acc74;_0x1ac0c6[_0xf03b('0x3c')]=_[_0xf03b('0x3f')](db[_0xf03b('0x76')][_0xf03b('0x38')]);_0x1ac0c6['query']=_[_0xf03b('0x3f')](_0x45bd9b[_0xf03b('0x3e')]);_0x1ac0c6[_0xf03b('0x40')]=_['intersection'](_0x1ac0c6['model'],_0x1ac0c6[_0xf03b('0x3e')]);_0x2de473[_0xf03b('0x41')]=_['intersection'](_0x1ac0c6['model'],qs[_0xf03b('0x43')](_0x45bd9b[_0xf03b('0x3e')][_0xf03b('0x43')]));_0x2de473[_0xf03b('0x41')]=_0x2de473[_0xf03b('0x41')][_0xf03b('0x44')]?_0x2de473[_0xf03b('0x41')]:_0x1ac0c6[_0xf03b('0x3c')];_0x2de473[_0xf03b('0x47')]=qs[_0xf03b('0x48')](_0x45bd9b[_0xf03b('0x3e')][_0xf03b('0x48')]);_0x2de473[_0xf03b('0x4b')]=qs[_0xf03b('0x40')](_[_0xf03b('0x49')](_0x45bd9b[_0xf03b('0x3e')],_0x1ac0c6[_0xf03b('0x40')]));if(_0x45bd9b[_0xf03b('0x3e')][_0xf03b('0x4a')]){_0x2de473[_0xf03b('0x4b')]=_[_0xf03b('0x4c')](_0x2de473['where'],{'$or':_[_0xf03b('0x3d')](_0x2de473[_0xf03b('0x41')],function(_0x2a1589){var _0x59eef9={};_0x59eef9[_0x2a1589]={'$like':'%'+_0x45bd9b[_0xf03b('0x3e')][_0xf03b('0x4a')]+'%'};return _0x59eef9;})});}_0x2de473=_[_0xf03b('0x4c')]({},_0x2de473,_0x45bd9b[_0xf03b('0x4e')]);return _0x27ec2f[_0xf03b('0x7a')](_0x2de473);}})[_0xf03b('0x2f')](function(_0x171388){if(_0x171388){_0x29e770=_0x171388['length'];if(!_0x45bd9b[_0xf03b('0x3e')][_0xf03b('0x45')](_0xf03b('0x46'))){_0x2de473[_0xf03b('0x29')]=qs[_0xf03b('0x29')](_0x45bd9b[_0xf03b('0x3e')][_0xf03b('0x29')]);_0x2de473['offset']=qs[_0xf03b('0x2a')](_0x45bd9b['query'][_0xf03b('0x2a')]);}return _0x27ec2f[_0xf03b('0x7a')](_0x2de473);}})[_0xf03b('0x2f')](function(_0x1a9c8f){if(_0x1a9c8f){return _0x1a9c8f?{'count':_0x29e770,'rows':_0x1a9c8f}:null;}})[_0xf03b('0x2f')](respondWithResult(_0x4de699,null))[_0xf03b('0x54')](handleError(_0x4de699,null));};exports[_0xf03b('0x7b')]=function(_0x81b49b,_0xc0c691,_0xd0ac60){var _0x1ad903={'channel':'whatsapp'};var _0x386d4b=[];var _0x1b0dbb=[];var _0x3716a6={};return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x81b49b[_0xf03b('0x56')]['id']},'include':[{'model':db[_0xf03b('0x76')],'as':_0xf03b('0x7c')}]})[_0xf03b('0x2f')](handleEntityNotFound(_0xc0c691,null))[_0xf03b('0x2f')](function(_0x153c6b){_0x1ad903['account']=_0x153c6b;if(_0x1ad903[_0xf03b('0x7d')]&&_0x1ad903[_0xf03b('0x7d')][_0xf03b('0x3a')]===_0xf03b('0x7e')&&_0x81b49b['body'][_0xf03b('0x7f')]){if(_0x81b49b[_0xf03b('0x59')][_0xf03b('0x7f')][_0xf03b('0x44')]===0x0)return;if(_0x81b49b['body'][_0xf03b('0x7f')][0x0][_0xf03b('0x80')]!=='read')return;return db['WhatsappMessage'][_0xf03b('0x60')]({'read':!![],'readAt':_0x81b49b[_0xf03b('0x59')][_0xf03b('0x7f')][0x0][_0xf03b('0x81')]},{'where':{'messageId':_0x81b49b['body'][_0xf03b('0x7f')][0x0][_0xf03b('0x82')]},'individualHooks':!![]})[_0xf03b('0x2f')](function(_0x368da0){return _0xc0c691[_0xf03b('0x25')](0xc8)[_0xf03b('0x27')](_0x368da0);});}_0x1ad903[_0xf03b('0x83')]=_[_0xf03b('0x84')](_0x153c6b['Applications'],[_0xf03b('0x78')],[_0xf03b('0x85')]);if(_0x1ad903[_0xf03b('0x7d')][_0xf03b('0x7c')]){delete _0x1ad903[_0xf03b('0x7d')][_0xf03b('0x7c')];}return db[_0xf03b('0x86')][_0xf03b('0x61')]()['then'](function(_0x306674){if(!_0x306674){throw new db[(_0xf03b('0x87'))][(_0xf03b('0x88'))](_0xf03b('0x89'));}_0x386d4b=_[_0xf03b('0x8a')](_[_0xf03b('0x3f')](_0x306674),[_0xf03b('0x8b'),_0xf03b('0x8c')]);_0x1b0dbb=_[_0xf03b('0x8a')](_[_0xf03b('0x3f')](_0x306674),[_0xf03b('0x8b'),'updatedAt','CompanyId','ListId']);_0x1ad903[_0xf03b('0x59')]={'mapKey':'mobile'};if(_0x1ad903[_0xf03b('0x7d')]&&_0x1ad903[_0xf03b('0x7d')][_0xf03b('0x3a')]==='twilio'){_0x1ad903[_0xf03b('0x59')][_0xf03b('0x8d')]=_0x81b49b[_0xf03b('0x59')][_0xf03b('0x8e')]['replace']('whatsapp:','');_0x1ad903['body'][_0xf03b('0x59')]=_0x81b49b[_0xf03b('0x59')]['Body'];_0x1ad903[_0xf03b('0x59')][_0xf03b('0x8f')]=_0x81b49b['body'][_0xf03b('0x90')];}if(_0x1ad903['account']&&_0x1ad903[_0xf03b('0x7d')]['type']===_0xf03b('0x7e')){_0x1ad903[_0xf03b('0x59')]['from']=_0x81b49b[_0xf03b('0x59')][_0xf03b('0x91')][0x0][_0xf03b('0x8d')];_0x1ad903[_0xf03b('0x59')][_0xf03b('0x59')]=_0x81b49b['body'][_0xf03b('0x91')][0x0][_0xf03b('0x22')]['body'];_0x1ad903[_0xf03b('0x59')][_0xf03b('0x8f')]=_0x81b49b['body']['notifications'][0x0]['message_id'];}if(_0x1ad903[_0xf03b('0x59')]['id']){delete _0x1ad903[_0xf03b('0x59')]['id'];}if(_[_0xf03b('0x92')](_0x1ad903[_0xf03b('0x59')]['from'])){throw new db['Sequelize'][(_0xf03b('0x88'))](_0xf03b('0x93'));}if(_['isNil'](_0x1ad903[_0xf03b('0x59')][_0xf03b('0x59')])||_0x1ad903[_0xf03b('0x59')][_0xf03b('0x59')]===''){throw new db[(_0xf03b('0x87'))][(_0xf03b('0x88'))](_0xf03b('0x94'));}if(_[_0xf03b('0x92')](_0x1ad903['body']['mapKey'])){throw new db[(_0xf03b('0x87'))][(_0xf03b('0x88'))](_0xf03b('0x95')+_0x1b0dbb);}if(!_[_0xf03b('0x96')](_0x1b0dbb,_0x1ad903[_0xf03b('0x59')][_0xf03b('0x97')])){throw new db[(_0xf03b('0x87'))][(_0xf03b('0x88'))](_0xf03b('0x98')+_0x1b0dbb);}_0x3716a6[_0x1ad903[_0xf03b('0x59')][_0xf03b('0x97')]]=_0x1ad903[_0xf03b('0x59')][_0xf03b('0x8d')];return db['CmList'][_0xf03b('0x57')]({'where':{'id':_0x1ad903[_0xf03b('0x7d')][_0xf03b('0x99')]},'include':[{'model':db[_0xf03b('0x86')],'as':_0xf03b('0x9a'),'where':_0x3716a6,'limit':0x1,'order':[['updatedAt',_0xf03b('0x9b')]]}]});})[_0xf03b('0x2f')](handleEntityNotFound(_0xc0c691,null))['then'](function(_0x1ab503){if(_0x1ab503){_0x1ad903['list']=_[_0xf03b('0x6c')](_0x1ab503,[_0xf03b('0x9a')]);if(_0x1ab503[_0xf03b('0x9a')][_0xf03b('0x44')]){return _0x1ab503['Contacts'][0x0];}var _0x598489=_[_0xf03b('0x15')](_0x1ad903[_0xf03b('0x59')],{'firstName':_0x1ad903[_0xf03b('0x59')][_0xf03b('0x8d')],'ListId':_0x1ab503['id']});_0x598489[_0x1ad903[_0xf03b('0x59')][_0xf03b('0x97')]]=_0x1ad903[_0xf03b('0x59')]['from'];return db[_0xf03b('0x86')]['create'](_0x598489,{'fields':_0x386d4b,'raw':!![]});}})[_0xf03b('0x2f')](handleEntityNotFound(_0xc0c691,null))['then'](function(_0xdbf513){if(_0xdbf513){_0x1ad903[_0xf03b('0x9c')]=_0xdbf513;var _0x5725f3={'ContactId':_0xdbf513['id'],'phone':_0x1ad903['body'][_0xf03b('0x8d')],'WhatsappAccountId':_0x81b49b[_0xf03b('0x56')]['id']};var _0x78c3aa={'ContactId':_0xdbf513['id'],'WhatsappAccountId':_0x81b49b['params']['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x78c3aa})[_0xf03b('0x2f')](function(_0x30b2dd){if(_0x30b2dd){return[_0x30b2dd,![]];}return db[_0xf03b('0x9d')][_0xf03b('0x58')](_0x5725f3)[_0xf03b('0x2f')](function(_0x3d801c){return[_0x3d801c,!![]];});});}})['spread'](function(_0xc043ff,_0xbd980d){_0x1ad903[_0xf03b('0x9e')]=_0xc043ff['get']({'plain':!![]});_0x1ad903[_0xf03b('0x9e')]['created']=![];if(_0xbd980d){if(_0x1ad903[_0xf03b('0x7d')][_0xf03b('0x9f')]){_0x1ad903[_0xf03b('0x83')]['push']({'id':0x0,'priority':_0x1ad903['applications'][_0xf03b('0x44')]+0x1,'app':_0xf03b('0xa0'),'appdata':_0xf03b('0xa1'),'interval':_0xf03b('0xa2')});}_0x1ad903[_0xf03b('0x9e')][_0xf03b('0xa3')]=!![];}return db[_0xf03b('0xa4')]['create']({'phone':_0x1ad903[_0xf03b('0x59')][_0xf03b('0x8d')],'messageId':_0x1ad903[_0xf03b('0x59')][_0xf03b('0x8f')],'body':_0x1ad903[_0xf03b('0x59')][_0xf03b('0x59')],'WhatsappAccountId':_0x81b49b[_0xf03b('0x56')]['id'],'WhatsappInteractionId':_0xc043ff['id'],'direction':'in','ContactId':_0xc043ff[_0xf03b('0xa5')],'AttachmentId':_0x1ad903[_0xf03b('0x59')][_0xf03b('0xa6')]});})[_0xf03b('0x2f')](function(_0x4290a9){_0x1ad903[_0xf03b('0x22')]=_0x4290a9;if(_0x1ad903[_0xf03b('0x9e')][_0xf03b('0xa7')]){return db[_0xf03b('0xa8')][_0xf03b('0x57')]({'attributes':['id',_0xf03b('0x34')],'where':{'id':_0x1ad903['interaction'][_0xf03b('0xa7')]}})[_0xf03b('0x2f')](function(_0x1bfcf7){if(_0x1bfcf7){_0x1ad903['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1bfcf7['name']+','+(_0x1ad903[_0xf03b('0x7d')][_0xf03b('0xa9')]||0xa),'interval':_0xf03b('0xa2')});}return respondWithRpcPromise(_0xf03b('0xaa'),_0xf03b('0xab'),_0x1ad903);});}return respondWithRpcPromise(_0xf03b('0xaa'),'startRouting',_0x1ad903);})['then'](function(_0xa65832){if(_0xa65832){var _0x401d75=0xc8;var _0x3ea8cd=_0xf03b('0xac');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3ea8cd,_0x401d75,_0xf03b('0xad'));logger[_0xf03b('0x1e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3ea8cd,_0x401d75,_0xf03b('0xad'),JSON[_0xf03b('0x1f')](_0xa65832));if(_0x1ad903[_0xf03b('0x7d')][_0xf03b('0x3a')]==='twilio'){return _0xc0c691[_0xf03b('0x25')](_0x401d75)['set'](_0xf03b('0xae'),'text/xml')[_0xf03b('0xaf')](_0xf03b('0xb0'));}else{return _0xc0c691[_0xf03b('0x25')](_0x401d75)[_0xf03b('0x27')](_0xa65832);}}});})[_0xf03b('0x54')](handleError(_0xc0c691,null));};exports[_0xf03b('0xaf')]=function(_0x3768ba,_0x384108,_0x4887cf){var _0x7eea52,_0x5caff8,_0x129da4;if(_['isNil'](_0x3768ba[_0xf03b('0x59')][_0xf03b('0x59')])||_0x3768ba['body'][_0xf03b('0x59')]===''){throw new db['Sequelize']['ValidationError'](_0xf03b('0x94'));}if(_[_0xf03b('0x92')](_0x3768ba['body']['to'])){throw new db['Sequelize'][(_0xf03b('0x88'))](_0xf03b('0xb1'));}_0x7eea52=_0x3768ba[_0xf03b('0x59')]['to'];return db[_0xf03b('0x4f')][_0xf03b('0x57')]({'where':{'id':_0x3768ba[_0xf03b('0x56')]['id']},'include':[{'model':db[_0xf03b('0xb2')],'as':_0xf03b('0xb3'),'include':[{'model':db['CmContact'],'as':_0xf03b('0x9a'),'where':{'mobile':_0x7eea52},'limit':0x1,'order':[[_0xf03b('0x8c'),'DESC']]}]}]})[_0xf03b('0x2f')](handleEntityNotFound(_0x384108,null))[_0xf03b('0x2f')](function(_0x5b5b69){if(_0x5b5b69&&_0x5b5b69[_0xf03b('0xb3')]){_0x5caff8=_0x5b5b69[_0xf03b('0x5b')]({'plain':!![]});if(_0x5caff8[_0xf03b('0xb3')]&&_0x5caff8['List'][_0xf03b('0x9a')][_0xf03b('0x44')]){return _0x5caff8['List']['Contacts'][0x0];}return db['CmContact'][_0xf03b('0x58')](_[_0xf03b('0x15')](_0x3768ba[_0xf03b('0x59')],{'firstName':_0x7eea52,'mobile':_0x7eea52,'phone':_0x7eea52,'ListId':_0x5caff8[_0xf03b('0x99')]}));}})[_0xf03b('0x2f')](handleEntityNotFound(_0x384108,null))[_0xf03b('0x2f')](function(_0x8bb96f){if(_0x8bb96f){_0x129da4=_0x8bb96f;return db[_0xf03b('0x9d')]['find']({'where':{'ContactId':_0x129da4['id'],'closed':![],'WhatsappAccountId':_0x5caff8['id']}})[_0xf03b('0x2f')](function(_0x579339){if(_0x579339){return[_0x579339,![]];}return db[_0xf03b('0x9d')]['create']({'UserId':_0x3768ba[_0xf03b('0x5a')]['id'],'ContactId':_0x129da4['id'],'WhatsappAccountId':_0x5caff8['id'],'phone':_0x7eea52,'firstMsgDirection':_0xf03b('0xb4'),'Messages':[_[_0xf03b('0x4c')](_0x3768ba[_0xf03b('0x59')],{'read':![],'body':_0x3768ba['body']['body'],'phone':_0x7eea52,'WhatsappAccountId':_0x5caff8['id'],'UserId':_0x3768ba[_0xf03b('0x5a')]['id'],'ContactId':_0x129da4['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xf03b('0xb5')}]})[_0xf03b('0x2f')](function(_0x2c54b0){return[_0x2c54b0,!![]];});});}})['spread'](function(_0x281291,_0x5cb376){if(_0x5cb376){return _0x281291;}return db['WhatsappMessage']['create'](_[_0xf03b('0x4c')](_0x3768ba[_0xf03b('0x59')],{'read':![],'body':_0x3768ba[_0xf03b('0x59')]['body'],'phone':_0x7eea52,'WhatsappAccountId':_0x5caff8['id'],'WhatsappInteractionId':_0x281291['id'],'UserId':_0x3768ba[_0xf03b('0x5a')]['id'],'ContactId':_0x129da4['id']}))[_0xf03b('0x2f')](function(_0x386bc9){_0x281291[_0xf03b('0xb6')][_0xf03b('0xb5')]=[];_0x281291[_0xf03b('0xb6')][_0xf03b('0xb5')]['push'](_0x386bc9[_0xf03b('0xb6')]);return _0x281291;});})[_0xf03b('0x2f')](respondWithResult(_0x384108,null))[_0xf03b('0x54')](handleError(_0x384108,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 7291d40..fb86d63 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x392d=['hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','update','emit'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x392d,0xc2));var _0xd392=function(_0x2b113a,_0xdba2bf){_0x2b113a=_0x2b113a-0x0;var _0x258924=_0x392d[_0x2b113a];return _0x258924;};'use strict';var EventEmitter=require(_0xd392('0x0'));var WhatsappAccount=require(_0xd392('0x1'))['db'][_0xd392('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd392('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd392('0x4'),'afterDestroy':'remove'};function emitEvent(_0x182bb3){return function(_0x2e19c9,_0x46c995,_0x261084){WhatsappAccountEvents['emit'](_0x182bb3+':'+_0x2e19c9['id'],_0x2e19c9);WhatsappAccountEvents[_0xd392('0x5')](_0x182bb3,_0x2e19c9);_0x261084(null);};}for(var e in events){if(events[_0xd392('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xd392('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd419=['hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','emit','hasOwnProperty'];(function(_0xaddb76,_0x351ac){var _0xc4a4a=function(_0x308ab1){while(--_0x308ab1){_0xaddb76['push'](_0xaddb76['shift']());}};_0xc4a4a(++_0x351ac);}(_0xd419,0x6e));var _0x9d41=function(_0x3fab56,_0x376d0b){_0x3fab56=_0x3fab56-0x0;var _0x452ba1=_0xd419[_0x3fab56];return _0x452ba1;};'use strict';var EventEmitter=require(_0x9d41('0x0'));var WhatsappAccount=require(_0x9d41('0x1'))['db'][_0x9d41('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9d41('0x3')](0x0);var events={'afterCreate':_0x9d41('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x54e75a){return function(_0x2d5979,_0x121332,_0x4ccc6b){WhatsappAccountEvents['emit'](_0x54e75a+':'+_0x2d5979['id'],_0x2d5979);WhatsappAccountEvents[_0x9d41('0x5')](_0x54e75a,_0x2d5979);_0x4ccc6b(null);};}for(var e in events){if(events[_0x9d41('0x6')](e)){var event=events[e];WhatsappAccount[_0x9d41('0x7')](e,emitEvent(event));}}module[_0x9d41('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2a75165..174765b 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3a7=['request-promise','path','./whatsappAccount.attributes','exports','define','util','../../config/logger','api','moment','bluebird'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xb3a7,0x91));var _0x7b3a=function(_0x6ace29,_0x214760){_0x6ace29=_0x6ace29-0x0;var _0x288e95=_0xb3a7[_0x6ace29];return _0x288e95;};'use strict';var _=require('lodash');var util=require(_0x7b3a('0x0'));var logger=require(_0x7b3a('0x1'))(_0x7b3a('0x2'));var moment=require(_0x7b3a('0x3'));var BPromise=require(_0x7b3a('0x4'));var rp=require(_0x7b3a('0x5'));var fs=require('fs');var path=require(_0x7b3a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7b3a('0x7'));module[_0x7b3a('0x8')]=function(_0x59beac,_0x4554d3){return _0x59beac[_0x7b3a('0x9')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6746=['WhatsappAccount','whatsapp_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x44d363,_0x5f130f){var _0x1b495=function(_0x341919){while(--_0x341919){_0x44d363['push'](_0x44d363['shift']());}};_0x1b495(++_0x5f130f);}(_0x6746,0xce));var _0x6674=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x6746[_0x149083];return _0x4dc74e;};'use strict';var _=require('lodash');var util=require(_0x6674('0x0'));var logger=require('../../config/logger')(_0x6674('0x1'));var moment=require(_0x6674('0x2'));var BPromise=require(_0x6674('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6674('0x4'));var rimraf=require(_0x6674('0x5'));var config=require(_0x6674('0x6'));var attributes=require(_0x6674('0x7'));module[_0x6674('0x8')]=function(_0x431a89,_0x56db2a){return _0x431a89[_0x6674('0x9')](_0x6674('0xa'),attributes,{'tableName':_0x6674('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 378f46e..d254dae 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc99=['ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','model','attributes','map','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x339f76,_0x10e87b){var _0x6f1b49=function(_0x273bf7){while(--_0x273bf7){_0x339f76['push'](_0x339f76['shift']());}};_0x6f1b49(++_0x10e87b);}(_0xcc99,0x168));var _0x9cc9=function(_0x4c403d,_0x5ef49f){_0x4c403d=_0x4c403d-0x0;var _0x5a0c35=_0xcc99[_0x4c403d];return _0x5a0c35;};'use strict';var _=require(_0x9cc9('0x0'));var util=require(_0x9cc9('0x1'));var moment=require('moment');var BPromise=require(_0x9cc9('0x2'));var rs=require(_0x9cc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cc9('0x4'))['db'];var utils=require(_0x9cc9('0x5'));var logger=require(_0x9cc9('0x6'))(_0x9cc9('0x7'));var config=require('../../config/environment');var jayson=require(_0x9cc9('0x8'));var client=jayson[_0x9cc9('0x9')][_0x9cc9('0xa')]({'port':0x232a});config[_0x9cc9('0xb')]=_[_0x9cc9('0xc')](config[_0x9cc9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9cc9('0xd'))(new Redis(config[_0x9cc9('0xb')]));require('./whatsappAccount.socket')[_0x9cc9('0xe')](socket);function respondWithRpcPromise(_0x31d40a,_0x4c8c72,_0x50e5f3){return new BPromise(function(_0x2efb52,_0x416240){return client['request'](_0x31d40a,_0x50e5f3)[_0x9cc9('0xf')](function(_0x12c89f){logger[_0x9cc9('0x10')](_0x9cc9('0x11'),_0x4c8c72,'request\x20sent');logger['debug'](_0x9cc9('0x12'),_0x4c8c72,_0x9cc9('0x13'),JSON[_0x9cc9('0x14')](_0x12c89f));if(_0x12c89f[_0x9cc9('0x15')]){if(_0x12c89f['error'][_0x9cc9('0x16')]===0x1f4){logger[_0x9cc9('0x15')](_0x9cc9('0x11'),_0x4c8c72,_0x12c89f['error'][_0x9cc9('0x17')]);return _0x416240(_0x12c89f[_0x9cc9('0x15')]['message']);}logger[_0x9cc9('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x4c8c72,_0x12c89f[_0x9cc9('0x15')]['message']);return _0x2efb52(_0x12c89f[_0x9cc9('0x15')][_0x9cc9('0x17')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4c8c72,_0x9cc9('0x13'));_0x2efb52(_0x12c89f['result'][_0x9cc9('0x17')]);}})[_0x9cc9('0x18')](function(_0x29ac86){logger[_0x9cc9('0x15')](_0x9cc9('0x11'),_0x4c8c72,_0x29ac86);_0x416240(_0x29ac86);});});}exports[_0x9cc9('0x19')]=function(_0x342d88){var _0x4e3510=this;return new Promise(function(_0x30b86e,_0x5b3405){return db[_0x9cc9('0x1a')]['find']({'raw':_0x342d88[_0x9cc9('0x1b')]?_0x342d88[_0x9cc9('0x1b')][_0x9cc9('0x1c')]===undefined?!![]:![]:!![],'where':_0x342d88['options']?_0x342d88[_0x9cc9('0x1b')][_0x9cc9('0x1d')]||null:null,'attributes':_0x342d88[_0x9cc9('0x1b')]?_0x342d88[_0x9cc9('0x1b')]['attributes']||null:null,'include':_0x342d88[_0x9cc9('0x1b')]?_0x342d88['options'][_0x9cc9('0x1e')]?_['map'](_0x342d88[_0x9cc9('0x1b')][_0x9cc9('0x1e')],function(_0x45dc6d){return{'model':db[_0x45dc6d[_0x9cc9('0x1f')]],'as':_0x45dc6d['as'],'attributes':_0x45dc6d[_0x9cc9('0x20')],'include':_0x45dc6d[_0x9cc9('0x1e')]?_[_0x9cc9('0x21')](_0x45dc6d[_0x9cc9('0x1e')],function(_0x23a6f9){return{'model':db[_0x23a6f9['model']],'as':_0x23a6f9['as'],'attributes':_0x23a6f9[_0x9cc9('0x20')],'include':_0x23a6f9[_0x9cc9('0x1e')]?_[_0x9cc9('0x21')](_0x23a6f9[_0x9cc9('0x1e')],function(_0x4c2ef0){return{'model':db[_0x4c2ef0['model']],'as':_0x4c2ef0['as'],'attributes':_0x4c2ef0['attributes']};}):[]};}):[]};}):[]:[]})[_0x9cc9('0xf')](function(_0x48cf39){logger['info']('ShowWhatsappAccount',_0x342d88);logger[_0x9cc9('0x22')]('ShowWhatsappAccount',_0x342d88,JSON[_0x9cc9('0x14')](_0x48cf39));_0x30b86e(_0x48cf39);})[_0x9cc9('0x18')](function(_0x2388c6){logger[_0x9cc9('0x15')]('ShowWhatsappAccount',_0x2388c6['message'],_0x342d88);_0x5b3405(_0x4e3510[_0x9cc9('0x15')](0x1f4,_0x2388c6[_0x9cc9('0x17')]));});});}; \ No newline at end of file +var _0x500b=['register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','WhatsappAccount','find','options','raw','where','include','map','model','attributes','ShowWhatsappAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter'];(function(_0x1acc49,_0x1368fe){var _0x358afc=function(_0x544a44){while(--_0x544a44){_0x1acc49['push'](_0x1acc49['shift']());}};_0x358afc(++_0x1368fe);}(_0x500b,0x8c));var _0xb500=function(_0xba37ef,_0x555be8){_0xba37ef=_0xba37ef-0x0;var _0x4440c2=_0x500b[_0xba37ef];return _0x4440c2;};'use strict';var _=require(_0xb500('0x0'));var util=require(_0xb500('0x1'));var moment=require(_0xb500('0x2'));var BPromise=require(_0xb500('0x3'));var rs=require(_0xb500('0x4'));var fs=require('fs');var Redis=require(_0xb500('0x5'));var db=require(_0xb500('0x6'))['db'];var utils=require(_0xb500('0x7'));var logger=require(_0xb500('0x8'))(_0xb500('0x9'));var config=require(_0xb500('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb500('0xb')][_0xb500('0xc')]({'port':0x232a});config[_0xb500('0xd')]=_[_0xb500('0xe')](config[_0xb500('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb500('0xf'))(new Redis(config[_0xb500('0xd')]));require('./whatsappAccount.socket')[_0xb500('0x10')](socket);function respondWithRpcPromise(_0x1ec767,_0x4e8f42,_0x5885f1){return new BPromise(function(_0x53e442,_0x23718a){return client[_0xb500('0x11')](_0x1ec767,_0x5885f1)[_0xb500('0x12')](function(_0x3d9d28){logger[_0xb500('0x13')](_0xb500('0x14'),_0x4e8f42,_0xb500('0x15'));logger['debug'](_0xb500('0x16'),_0x4e8f42,_0xb500('0x15'),JSON['stringify'](_0x3d9d28));if(_0x3d9d28['error']){if(_0x3d9d28['error'][_0xb500('0x17')]===0x1f4){logger[_0xb500('0x18')](_0xb500('0x14'),_0x4e8f42,_0x3d9d28[_0xb500('0x18')]['message']);return _0x23718a(_0x3d9d28['error'][_0xb500('0x19')]);}logger['error'](_0xb500('0x14'),_0x4e8f42,_0x3d9d28['error'][_0xb500('0x19')]);return _0x53e442(_0x3d9d28[_0xb500('0x18')][_0xb500('0x19')]);}else{logger[_0xb500('0x13')](_0xb500('0x14'),_0x4e8f42,'request\x20sent');_0x53e442(_0x3d9d28[_0xb500('0x1a')][_0xb500('0x19')]);}})[_0xb500('0x1b')](function(_0x1f4c3e){logger[_0xb500('0x18')](_0xb500('0x14'),_0x4e8f42,_0x1f4c3e);_0x23718a(_0x1f4c3e);});});}exports['ShowWhatsappAccount']=function(_0x557d1f){var _0x4824b6=this;return new Promise(function(_0x2de6e9,_0x118626){return db[_0xb500('0x1c')][_0xb500('0x1d')]({'raw':_0x557d1f[_0xb500('0x1e')]?_0x557d1f[_0xb500('0x1e')][_0xb500('0x1f')]===undefined?!![]:![]:!![],'where':_0x557d1f[_0xb500('0x1e')]?_0x557d1f[_0xb500('0x1e')][_0xb500('0x20')]||null:null,'attributes':_0x557d1f[_0xb500('0x1e')]?_0x557d1f['options']['attributes']||null:null,'include':_0x557d1f['options']?_0x557d1f[_0xb500('0x1e')][_0xb500('0x21')]?_[_0xb500('0x22')](_0x557d1f[_0xb500('0x1e')][_0xb500('0x21')],function(_0x40a9b9){return{'model':db[_0x40a9b9[_0xb500('0x23')]],'as':_0x40a9b9['as'],'attributes':_0x40a9b9[_0xb500('0x24')],'include':_0x40a9b9[_0xb500('0x21')]?_[_0xb500('0x22')](_0x40a9b9[_0xb500('0x21')],function(_0x38fe56){return{'model':db[_0x38fe56[_0xb500('0x23')]],'as':_0x38fe56['as'],'attributes':_0x38fe56[_0xb500('0x24')],'include':_0x38fe56['include']?_['map'](_0x38fe56[_0xb500('0x21')],function(_0x45add2){return{'model':db[_0x45add2[_0xb500('0x23')]],'as':_0x45add2['as'],'attributes':_0x45add2[_0xb500('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb500('0x12')](function(_0x2bd499){logger['info'](_0xb500('0x25'),_0x557d1f);logger['debug']('ShowWhatsappAccount',_0x557d1f,JSON[_0xb500('0x26')](_0x2bd499));_0x2de6e9(_0x2bd499);})['catch'](function(_0xc65932){logger[_0xb500('0x18')]('ShowWhatsappAccount',_0xc65932[_0xb500('0x19')],_0x557d1f);_0x118626(_0x4824b6[_0xb500('0x18')](0x1f4,_0xc65932['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 21c59e6..f363e1d 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e9f=['update','emit','removeListener','length','./whatsappAccount.events','save'];(function(_0x26842d,_0x5deb11){var _0x491be0=function(_0x11877e){while(--_0x11877e){_0x26842d['push'](_0x26842d['shift']());}};_0x491be0(++_0x5deb11);}(_0x2e9f,0x7c));var _0xf2e9=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2e9f[_0x4b055c];return _0x4b62bb;};'use strict';var WhatsappAccountEvents=require(_0xf2e9('0x0'));var events=[_0xf2e9('0x1'),'remove',_0xf2e9('0x2')];function createListener(_0x49630c,_0x598f46){return function(_0x12fab8){_0x598f46[_0xf2e9('0x3')](_0x49630c,_0x12fab8);};}function removeListener(_0x1865b1,_0x35915c){return function(){WhatsappAccountEvents[_0xf2e9('0x4')](_0x1865b1,_0x35915c);};}exports['register']=function(_0x409f6f){for(var _0x3eab55=0x0,_0x3c95f3=events[_0xf2e9('0x5')];_0x3eab55<_0x3c95f3;_0x3eab55++){var _0x35b62a=events[_0x3eab55];var _0x59aeaa=createListener('whatsappAccount:'+_0x35b62a,_0x409f6f);WhatsappAccountEvents['on'](_0x35b62a,_0x59aeaa);}}; \ No newline at end of file +var _0x9809=['save','remove','update','emit','length'];(function(_0x402081,_0x529eef){var _0x39b8d6=function(_0x1855f2){while(--_0x1855f2){_0x402081['push'](_0x402081['shift']());}};_0x39b8d6(++_0x529eef);}(_0x9809,0x181));var _0x9980=function(_0x29804b,_0x11f417){_0x29804b=_0x29804b-0x0;var _0x4fee51=_0x9809[_0x29804b];return _0x4fee51;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x9980('0x0'),_0x9980('0x1'),_0x9980('0x2')];function createListener(_0x2755c2,_0x4e1bc6){return function(_0xda4a01){_0x4e1bc6[_0x9980('0x3')](_0x2755c2,_0xda4a01);};}function removeListener(_0x3e51d2,_0x14d797){return function(){WhatsappAccountEvents['removeListener'](_0x3e51d2,_0x14d797);};}exports['register']=function(_0x38e86d){for(var _0x59e9b3=0x0,_0x5474e3=events[_0x9980('0x4')];_0x59e9b3<_0x5474e3;_0x59e9b3++){var _0x326ddb=events[_0x59e9b3];var _0x58f2c0=createListener('whatsappAccount:'+_0x326ddb,_0x38e86d);WhatsappAccountEvents['on'](_0x326ddb,_0x58f2c0);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0fb3225..c10b14e 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec81=['delete','destroy','multer','path','express','Router','./whatsappApplication.controller','get','/:id','isAuthenticated','create','update'];(function(_0x584b3e,_0x401737){var _0x5ac470=function(_0x4e4dea){while(--_0x4e4dea){_0x584b3e['push'](_0x584b3e['shift']());}};_0x5ac470(++_0x401737);}(_0xec81,0xfe));var _0x1ec8=function(_0x30fe57,_0x50f3da){_0x30fe57=_0x30fe57-0x0;var _0x988f93=_0xec81[_0x30fe57];return _0x988f93;};'use strict';var multer=require(_0x1ec8('0x0'));var util=require('util');var path=require(_0x1ec8('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ec8('0x2'));var router=express[_0x1ec8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1ec8('0x4'));router[_0x1ec8('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ec8('0x5')](_0x1ec8('0x6'),auth[_0x1ec8('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1ec8('0x8')]);router['put'](_0x1ec8('0x6'),auth['isAuthenticated'](),controller[_0x1ec8('0x9')]);router[_0x1ec8('0xa')](_0x1ec8('0x6'),auth['isAuthenticated'](),controller[_0x1ec8('0xb')]);module['exports']=router; \ No newline at end of file +var _0x422c=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0xf48efb,_0x307c7f){var _0x179636=function(_0xfcbe59){while(--_0xfcbe59){_0xf48efb['push'](_0xf48efb['shift']());}};_0x179636(++_0x307c7f);}(_0x422c,0x153));var _0xc422=function(_0x2bfb62,_0xa7ea70){_0x2bfb62=_0x2bfb62-0x0;var _0x342e9f=_0x422c[_0x2bfb62];return _0x342e9f;};'use strict';var multer=require(_0xc422('0x0'));var util=require(_0xc422('0x1'));var path=require('path');var timeout=require(_0xc422('0x2'));var express=require(_0xc422('0x3'));var router=express[_0xc422('0x4')]();var fs_extra=require(_0xc422('0x5'));var auth=require(_0xc422('0x6'));var interaction=require(_0xc422('0x7'));var config=require(_0xc422('0x8'));var controller=require(_0xc422('0x9'));router[_0xc422('0xa')]('/',auth[_0xc422('0xb')](),controller[_0xc422('0xc')]);router[_0xc422('0xa')](_0xc422('0xd'),auth[_0xc422('0xb')](),controller[_0xc422('0xe')]);router[_0xc422('0xf')]('/',auth['isAuthenticated'](),controller[_0xc422('0x10')]);router[_0xc422('0x11')](_0xc422('0xd'),auth['isAuthenticated'](),controller[_0xc422('0x12')]);router[_0xc422('0x13')](_0xc422('0xd'),auth[_0xc422('0xb')](),controller['destroy']);module[_0xc422('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index abbcf9b..7319f44 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf127=['sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x475e33,_0x42824a){var _0x318871=function(_0x54394c){while(--_0x54394c){_0x475e33['push'](_0x475e33['shift']());}};_0x318871(++_0x42824a);}(_0xf127,0x1ea));var _0x7f12=function(_0x553538,_0x1eaf54){_0x553538=_0x553538-0x0;var _0x2b8816=_0xf127[_0x553538];return _0x2b8816;};'use strict';var Sequelize=require(_0x7f12('0x0'));module[_0x7f12('0x1')]={'priority':{'type':Sequelize[_0x7f12('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7f12('0x3')]()},'description':{'type':Sequelize[_0x7f12('0x4')]},'interval':{'type':Sequelize[_0x7f12('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0e68=['sequelize','INTEGER','STRING','noop'];(function(_0x21828c,_0x37a022){var _0x39ff53=function(_0xd120a9){while(--_0xd120a9){_0x21828c['push'](_0x21828c['shift']());}};_0x39ff53(++_0x37a022);}(_0x0e68,0xf8));var _0x80e6=function(_0x40eda6,_0x15d7a5){_0x40eda6=_0x40eda6-0x0;var _0xa3d837=_0x0e68[_0x40eda6];return _0xa3d837;};'use strict';var Sequelize=require(_0x80e6('0x0'));module['exports']={'priority':{'type':Sequelize[_0x80e6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x80e6('0x2')],'allowNull':![],'defaultValue':_0x80e6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x80e6('0x2')]},'interval':{'type':Sequelize[_0x80e6('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 158d39e..bc0baa2 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c91=['sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path'];(function(_0x32eae8,_0x51ad77){var _0x1d4367=function(_0x525315){while(--_0x525315){_0x32eae8['push'](_0x32eae8['shift']());}};_0x1d4367(++_0x51ad77);}(_0x3c91,0x1af));var _0x13c9=function(_0xd561,_0x92899f){_0xd561=_0xd561-0x0;var _0x2912c2=_0x3c91[_0xd561];return _0x2912c2;};'use strict';var emlformat=require(_0x13c9('0x0'));var rimraf=require(_0x13c9('0x1'));var zipdir=require(_0x13c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x13c9('0x3'));var BPromise=require(_0x13c9('0x4'));var Mustache=require(_0x13c9('0x5'));var util=require('util');var path=require(_0x13c9('0x6'));var sox=require(_0x13c9('0x7'));var csv=require(_0x13c9('0x8'));var ejs=require(_0x13c9('0x9'));var fs=require('fs');var fs_extra=require(_0x13c9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13c9('0xb'));var jsforce=require(_0x13c9('0xc'));var deskjs=require(_0x13c9('0xd'));var toCsv=require(_0x13c9('0x8'));var querystring=require(_0x13c9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x13c9('0xf'));var qs=require(_0x13c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13c9('0x11'))(_0x13c9('0x12'));var utils=require(_0x13c9('0x13'));var config=require(_0x13c9('0x14'));var licenseUtil=require(_0x13c9('0x15'));var db=require(_0x13c9('0x16'))['db'];function respondWithStatusCode(_0x1f63b8,_0x4a5f84){_0x4a5f84=_0x4a5f84||0xcc;return function(_0x34cb15){if(_0x34cb15){return _0x1f63b8['sendStatus'](_0x4a5f84);}return _0x1f63b8['status'](_0x4a5f84)['end']();};}function respondWithResult(_0x4b528e,_0x5c1814){_0x5c1814=_0x5c1814||0xc8;return function(_0x5351f6){if(_0x5351f6){return _0x4b528e[_0x13c9('0x17')](_0x5c1814)['json'](_0x5351f6);}};}function respondWithFilteredResult(_0x4f46c1,_0x3daab9){return function(_0xa59ee9){if(_0xa59ee9){var _0x1c9601=typeof _0x3daab9[_0x13c9('0x18')]===_0x13c9('0x19')&&typeof _0x3daab9[_0x13c9('0x1a')]==='undefined';var _0x51c4fb=_0xa59ee9['count'];var _0xd08fc0=_0x1c9601?0x0:_0x3daab9[_0x13c9('0x18')];var _0x1dcaf7=_0x1c9601?_0xa59ee9[_0x13c9('0x1b')]:_0x3daab9[_0x13c9('0x18')]+_0x3daab9['limit'];var _0x1d5167;if(_0x1dcaf7>=_0x51c4fb){_0x1dcaf7=_0x51c4fb;_0x1d5167=0xc8;}else{_0x1d5167=0xce;}_0x4f46c1[_0x13c9('0x17')](_0x1d5167);return _0x4f46c1[_0x13c9('0x1c')](_0x13c9('0x1d'),_0xd08fc0+'-'+_0x1dcaf7+'/'+_0x51c4fb)[_0x13c9('0x1e')](_0xa59ee9);}return null;};}function patchUpdates(_0x329c69){return function(_0x3e5d04){try{jsonpatch['apply'](_0x3e5d04,_0x329c69,!![]);}catch(_0x283c5e){return BPromise[_0x13c9('0x1f')](_0x283c5e);}return _0x3e5d04[_0x13c9('0x20')]();};}function saveUpdates(_0x254636,_0x27ebb6){return function(_0x184912){if(_0x184912){return _0x184912[_0x13c9('0x21')](_0x254636)[_0x13c9('0x22')](function(_0x3aa102){return _0x3aa102;});}return null;};}function removeEntity(_0x3c3366,_0x5dfd9d){return function(_0x63df88){if(_0x63df88){return _0x63df88[_0x13c9('0x23')]()[_0x13c9('0x22')](function(){_0x3c3366[_0x13c9('0x17')](0xcc)[_0x13c9('0x24')]();});}};}function handleEntityNotFound(_0x55b3d9,_0x4e1236){return function(_0x53b62f){if(!_0x53b62f){_0x55b3d9['sendStatus'](0x194);}return _0x53b62f;};}function handleError(_0x4507a0,_0x31c4eb){_0x31c4eb=_0x31c4eb||0x1f4;return function(_0x3ca92a){logger[_0x13c9('0x25')](_0x3ca92a[_0x13c9('0x26')]);if(_0x3ca92a[_0x13c9('0x27')]){delete _0x3ca92a[_0x13c9('0x27')];}_0x4507a0[_0x13c9('0x17')](_0x31c4eb)[_0x13c9('0x28')](_0x3ca92a);};}exports[_0x13c9('0x29')]=function(_0x4ec9ff,_0x22b8f5){var _0x21dbac={},_0x5d8997={},_0x43519b={'count':0x0,'rows':[]};var _0x41129d=_[_0x13c9('0x2a')](db['WhatsappApplication']['rawAttributes'],function(_0x390073){return{'name':_0x390073[_0x13c9('0x2b')],'type':_0x390073[_0x13c9('0x2c')]['key']};});_0x5d8997[_0x13c9('0x2d')]=_[_0x13c9('0x2a')](_0x41129d,_0x13c9('0x27'));_0x5d8997[_0x13c9('0x2e')]=_[_0x13c9('0x2f')](_0x4ec9ff['query']);_0x5d8997[_0x13c9('0x30')]=_[_0x13c9('0x31')](_0x5d8997[_0x13c9('0x2d')],_0x5d8997[_0x13c9('0x2e')]);_0x21dbac[_0x13c9('0x32')]=_[_0x13c9('0x31')](_0x5d8997[_0x13c9('0x2d')],qs['fields'](_0x4ec9ff[_0x13c9('0x2e')][_0x13c9('0x33')]));_0x21dbac['attributes']=_0x21dbac[_0x13c9('0x32')][_0x13c9('0x34')]?_0x21dbac[_0x13c9('0x32')]:_0x5d8997[_0x13c9('0x2d')];if(!_0x4ec9ff[_0x13c9('0x2e')][_0x13c9('0x35')]('nolimit')){_0x21dbac['limit']=qs[_0x13c9('0x1a')](_0x4ec9ff[_0x13c9('0x2e')][_0x13c9('0x1a')]);_0x21dbac[_0x13c9('0x18')]=qs['offset'](_0x4ec9ff[_0x13c9('0x2e')][_0x13c9('0x18')]);}_0x21dbac['order']=qs[_0x13c9('0x36')](_0x4ec9ff[_0x13c9('0x2e')][_0x13c9('0x36')]);_0x21dbac['where']=qs[_0x13c9('0x30')](_[_0x13c9('0x37')](_0x4ec9ff[_0x13c9('0x2e')],_0x5d8997[_0x13c9('0x30')]),_0x41129d);if(_0x4ec9ff['query']['filter']){_0x21dbac[_0x13c9('0x38')]=_[_0x13c9('0x39')](_0x21dbac['where'],{'$or':_[_0x13c9('0x2a')](_0x41129d,function(_0x412bfb){if(_0x412bfb[_0x13c9('0x2c')]!==_0x13c9('0x3a')){var _0x8d49ab={};_0x8d49ab[_0x412bfb[_0x13c9('0x27')]]={'$like':'%'+_0x4ec9ff[_0x13c9('0x2e')][_0x13c9('0x3b')]+'%'};return _0x8d49ab;}})});}_0x21dbac=_['merge']({},_0x21dbac,_0x4ec9ff['options']);var _0x397c6d={'where':_0x21dbac[_0x13c9('0x38')]};return db[_0x13c9('0x3c')][_0x13c9('0x1b')](_0x397c6d)[_0x13c9('0x22')](function(_0x3d0712){_0x43519b['count']=_0x3d0712;if(_0x4ec9ff[_0x13c9('0x2e')][_0x13c9('0x3d')]){_0x21dbac[_0x13c9('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x13c9('0x3f')](_0x21dbac);})[_0x13c9('0x22')](function(_0x1269da){_0x43519b[_0x13c9('0x40')]=_0x1269da;return _0x43519b;})['then'](respondWithFilteredResult(_0x22b8f5,_0x21dbac))[_0x13c9('0x41')](handleError(_0x22b8f5,null));};exports[_0x13c9('0x42')]=function(_0x5943ef,_0x10e570){var _0x52e0e3={'raw':!![],'where':{'id':_0x5943ef[_0x13c9('0x43')]['id']}},_0x578a66={};_0x578a66[_0x13c9('0x2d')]=_[_0x13c9('0x2f')](db[_0x13c9('0x3c')][_0x13c9('0x44')]);_0x578a66['query']=_[_0x13c9('0x2f')](_0x5943ef[_0x13c9('0x2e')]);_0x578a66[_0x13c9('0x30')]=_[_0x13c9('0x31')](_0x578a66[_0x13c9('0x2d')],_0x578a66[_0x13c9('0x2e')]);_0x52e0e3[_0x13c9('0x32')]=_[_0x13c9('0x31')](_0x578a66[_0x13c9('0x2d')],qs[_0x13c9('0x33')](_0x5943ef[_0x13c9('0x2e')][_0x13c9('0x33')]));_0x52e0e3['attributes']=_0x52e0e3[_0x13c9('0x32')][_0x13c9('0x34')]?_0x52e0e3[_0x13c9('0x32')]:_0x578a66['model'];if(_0x5943ef['query'][_0x13c9('0x3d')]){_0x52e0e3[_0x13c9('0x3e')]=[{'all':!![]}];}_0x52e0e3=_[_0x13c9('0x39')]({},_0x52e0e3,_0x5943ef[_0x13c9('0x45')]);return db['WhatsappApplication'][_0x13c9('0x46')](_0x52e0e3)[_0x13c9('0x22')](handleEntityNotFound(_0x10e570,null))['then'](respondWithResult(_0x10e570,null))[_0x13c9('0x41')](handleError(_0x10e570,null));};exports[_0x13c9('0x47')]=function(_0x4017ef,_0xab9108){return db[_0x13c9('0x3c')]['create'](_0x4017ef[_0x13c9('0x48')],{})['then'](respondWithResult(_0xab9108,0xc9))[_0x13c9('0x41')](handleError(_0xab9108,null));};exports[_0x13c9('0x21')]=function(_0x4f0915,_0x2bc31a){if(_0x4f0915[_0x13c9('0x48')]['id']){delete _0x4f0915[_0x13c9('0x48')]['id'];}return db[_0x13c9('0x3c')][_0x13c9('0x46')]({'where':{'id':_0x4f0915[_0x13c9('0x43')]['id']}})[_0x13c9('0x22')](handleEntityNotFound(_0x2bc31a,null))[_0x13c9('0x22')](saveUpdates(_0x4f0915[_0x13c9('0x48')],null))[_0x13c9('0x22')](respondWithResult(_0x2bc31a,null))['catch'](handleError(_0x2bc31a,null));};exports[_0x13c9('0x23')]=function(_0x347a08,_0x1bcac9){return db['WhatsappApplication'][_0x13c9('0x46')]({'where':{'id':_0x347a08['params']['id']}})[_0x13c9('0x22')](handleEntityNotFound(_0x1bcac9,null))['then'](removeEntity(_0x1bcac9,null))[_0x13c9('0x41')](handleError(_0x1bcac9,null));}; \ No newline at end of file +var _0x5458=['findAll','rows','catch','show','params','length','includeAll','options','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','include'];(function(_0x4bc612,_0x4ed577){var _0x5e864d=function(_0x3bc846){while(--_0x3bc846){_0x4bc612['push'](_0x4bc612['shift']());}};_0x5e864d(++_0x4ed577);}(_0x5458,0x1c7));var _0x8545=function(_0x4c6647,_0x23685b){_0x4c6647=_0x4c6647-0x0;var _0x13a86d=_0x5458[_0x4c6647];return _0x13a86d;};'use strict';var emlformat=require(_0x8545('0x0'));var rimraf=require(_0x8545('0x1'));var zipdir=require(_0x8545('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8545('0x3'));var moment=require(_0x8545('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8545('0x5'));var util=require(_0x8545('0x6'));var path=require(_0x8545('0x7'));var sox=require('sox');var csv=require(_0x8545('0x8'));var ejs=require(_0x8545('0x9'));var fs=require('fs');var fs_extra=require(_0x8545('0xa'));var _=require(_0x8545('0xb'));var squel=require('squel');var crypto=require(_0x8545('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8545('0xd'));var toCsv=require(_0x8545('0x8'));var querystring=require(_0x8545('0xe'));var Papa=require(_0x8545('0xf'));var Redis=require(_0x8545('0x10'));var authService=require(_0x8545('0x11'));var qs=require(_0x8545('0x12'));var as=require(_0x8545('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8545('0x14'))(_0x8545('0x15'));var utils=require(_0x8545('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8545('0x17'));var db=require(_0x8545('0x18'))['db'];function respondWithStatusCode(_0x39ac5a,_0x19bb15){_0x19bb15=_0x19bb15||0xcc;return function(_0x885792){if(_0x885792){return _0x39ac5a[_0x8545('0x19')](_0x19bb15);}return _0x39ac5a[_0x8545('0x1a')](_0x19bb15)[_0x8545('0x1b')]();};}function respondWithResult(_0x37d18e,_0x4d8115){_0x4d8115=_0x4d8115||0xc8;return function(_0x1d2035){if(_0x1d2035){return _0x37d18e[_0x8545('0x1a')](_0x4d8115)['json'](_0x1d2035);}};}function respondWithFilteredResult(_0x33d8a5,_0x11f032){return function(_0x1dae89){if(_0x1dae89){var _0x4a2939=typeof _0x11f032[_0x8545('0x1c')]===_0x8545('0x1d')&&typeof _0x11f032[_0x8545('0x1e')]==='undefined';var _0x4ca715=_0x1dae89[_0x8545('0x1f')];var _0x122a4c=_0x4a2939?0x0:_0x11f032['offset'];var _0x50e621=_0x4a2939?_0x1dae89['count']:_0x11f032[_0x8545('0x1c')]+_0x11f032[_0x8545('0x1e')];var _0x329100;if(_0x50e621>=_0x4ca715){_0x50e621=_0x4ca715;_0x329100=0xc8;}else{_0x329100=0xce;}_0x33d8a5[_0x8545('0x1a')](_0x329100);return _0x33d8a5[_0x8545('0x20')](_0x8545('0x21'),_0x122a4c+'-'+_0x50e621+'/'+_0x4ca715)[_0x8545('0x22')](_0x1dae89);}return null;};}function patchUpdates(_0x5b62ef){return function(_0x58aa23){try{jsonpatch[_0x8545('0x23')](_0x58aa23,_0x5b62ef,!![]);}catch(_0x237d5f){return BPromise[_0x8545('0x24')](_0x237d5f);}return _0x58aa23[_0x8545('0x25')]();};}function saveUpdates(_0x174ed3,_0xc6c75a){return function(_0x57b3d7){if(_0x57b3d7){return _0x57b3d7[_0x8545('0x26')](_0x174ed3)['then'](function(_0x4981ee){return _0x4981ee;});}return null;};}function removeEntity(_0x23c5d2,_0x20d2d9){return function(_0x30f730){if(_0x30f730){return _0x30f730['destroy']()[_0x8545('0x27')](function(){_0x23c5d2[_0x8545('0x1a')](0xcc)[_0x8545('0x1b')]();});}};}function handleEntityNotFound(_0x178ff8,_0x513671){return function(_0x3a9cee){if(!_0x3a9cee){_0x178ff8[_0x8545('0x19')](0x194);}return _0x3a9cee;};}function handleError(_0x2ad4d7,_0xe1ce7b){_0xe1ce7b=_0xe1ce7b||0x1f4;return function(_0x4bd30a){logger['error'](_0x4bd30a['stack']);if(_0x4bd30a[_0x8545('0x28')]){delete _0x4bd30a[_0x8545('0x28')];}_0x2ad4d7[_0x8545('0x1a')](_0xe1ce7b)['send'](_0x4bd30a);};}exports['index']=function(_0xd8a7d0,_0x38e877){var _0x3e6bb1={},_0x2ec6d6={},_0x310e57={'count':0x0,'rows':[]};var _0x31bb13=_[_0x8545('0x29')](db[_0x8545('0x2a')][_0x8545('0x2b')],function(_0x4730a1){return{'name':_0x4730a1[_0x8545('0x2c')],'type':_0x4730a1[_0x8545('0x2d')][_0x8545('0x2e')]};});_0x2ec6d6[_0x8545('0x2f')]=_['map'](_0x31bb13,'name');_0x2ec6d6[_0x8545('0x30')]=_[_0x8545('0x31')](_0xd8a7d0[_0x8545('0x30')]);_0x2ec6d6[_0x8545('0x32')]=_[_0x8545('0x33')](_0x2ec6d6[_0x8545('0x2f')],_0x2ec6d6[_0x8545('0x30')]);_0x3e6bb1[_0x8545('0x34')]=_[_0x8545('0x33')](_0x2ec6d6[_0x8545('0x2f')],qs[_0x8545('0x35')](_0xd8a7d0[_0x8545('0x30')][_0x8545('0x35')]));_0x3e6bb1[_0x8545('0x34')]=_0x3e6bb1[_0x8545('0x34')]['length']?_0x3e6bb1[_0x8545('0x34')]:_0x2ec6d6['model'];if(!_0xd8a7d0['query'][_0x8545('0x36')]('nolimit')){_0x3e6bb1[_0x8545('0x1e')]=qs['limit'](_0xd8a7d0[_0x8545('0x30')][_0x8545('0x1e')]);_0x3e6bb1['offset']=qs[_0x8545('0x1c')](_0xd8a7d0['query']['offset']);}_0x3e6bb1[_0x8545('0x37')]=qs[_0x8545('0x38')](_0xd8a7d0[_0x8545('0x30')]['sort']);_0x3e6bb1[_0x8545('0x39')]=qs[_0x8545('0x32')](_[_0x8545('0x3a')](_0xd8a7d0['query'],_0x2ec6d6[_0x8545('0x32')]),_0x31bb13);if(_0xd8a7d0[_0x8545('0x30')][_0x8545('0x3b')]){_0x3e6bb1[_0x8545('0x39')]=_['merge'](_0x3e6bb1[_0x8545('0x39')],{'$or':_[_0x8545('0x29')](_0x31bb13,function(_0x1e3220){if(_0x1e3220[_0x8545('0x2d')]!==_0x8545('0x3c')){var _0x321232={};_0x321232[_0x1e3220[_0x8545('0x28')]]={'$like':'%'+_0xd8a7d0['query'][_0x8545('0x3b')]+'%'};return _0x321232;}})});}_0x3e6bb1=_[_0x8545('0x3d')]({},_0x3e6bb1,_0xd8a7d0['options']);var _0x22355d={'where':_0x3e6bb1['where']};return db['WhatsappApplication'][_0x8545('0x1f')](_0x22355d)[_0x8545('0x27')](function(_0x5d37ab){_0x310e57[_0x8545('0x1f')]=_0x5d37ab;if(_0xd8a7d0[_0x8545('0x30')]['includeAll']){_0x3e6bb1[_0x8545('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x8545('0x3f')](_0x3e6bb1);})[_0x8545('0x27')](function(_0x1028a2){_0x310e57[_0x8545('0x40')]=_0x1028a2;return _0x310e57;})['then'](respondWithFilteredResult(_0x38e877,_0x3e6bb1))[_0x8545('0x41')](handleError(_0x38e877,null));};exports[_0x8545('0x42')]=function(_0x1d4316,_0x2d8442){var _0x2bbecb={'raw':!![],'where':{'id':_0x1d4316[_0x8545('0x43')]['id']}},_0x8fd304={};_0x8fd304[_0x8545('0x2f')]=_[_0x8545('0x31')](db[_0x8545('0x2a')][_0x8545('0x2b')]);_0x8fd304[_0x8545('0x30')]=_[_0x8545('0x31')](_0x1d4316[_0x8545('0x30')]);_0x8fd304[_0x8545('0x32')]=_['intersection'](_0x8fd304['model'],_0x8fd304[_0x8545('0x30')]);_0x2bbecb[_0x8545('0x34')]=_['intersection'](_0x8fd304[_0x8545('0x2f')],qs[_0x8545('0x35')](_0x1d4316[_0x8545('0x30')][_0x8545('0x35')]));_0x2bbecb['attributes']=_0x2bbecb[_0x8545('0x34')][_0x8545('0x44')]?_0x2bbecb[_0x8545('0x34')]:_0x8fd304[_0x8545('0x2f')];if(_0x1d4316['query'][_0x8545('0x45')]){_0x2bbecb[_0x8545('0x3e')]=[{'all':!![]}];}_0x2bbecb=_[_0x8545('0x3d')]({},_0x2bbecb,_0x1d4316[_0x8545('0x46')]);return db['WhatsappApplication']['find'](_0x2bbecb)[_0x8545('0x27')](handleEntityNotFound(_0x2d8442,null))['then'](respondWithResult(_0x2d8442,null))[_0x8545('0x41')](handleError(_0x2d8442,null));};exports[_0x8545('0x47')]=function(_0x39ccbb,_0x3eb183){return db[_0x8545('0x2a')][_0x8545('0x47')](_0x39ccbb[_0x8545('0x48')],{})[_0x8545('0x27')](respondWithResult(_0x3eb183,0xc9))[_0x8545('0x41')](handleError(_0x3eb183,null));};exports[_0x8545('0x26')]=function(_0x266a8e,_0x41af90){if(_0x266a8e[_0x8545('0x48')]['id']){delete _0x266a8e[_0x8545('0x48')]['id'];}return db[_0x8545('0x2a')]['find']({'where':{'id':_0x266a8e[_0x8545('0x43')]['id']}})[_0x8545('0x27')](handleEntityNotFound(_0x41af90,null))[_0x8545('0x27')](saveUpdates(_0x266a8e[_0x8545('0x48')],null))['then'](respondWithResult(_0x41af90,null))[_0x8545('0x41')](handleError(_0x41af90,null));};exports[_0x8545('0x49')]=function(_0x4d9e49,_0x2cd362){return db[_0x8545('0x2a')]['find']({'where':{'id':_0x4d9e49[_0x8545('0x43')]['id']}})[_0x8545('0x27')](handleEntityNotFound(_0x2cd362,null))[_0x8545('0x27')](removeEntity(_0x2cd362,null))[_0x8545('0x41')](handleError(_0x2cd362,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b1bc810..a0d9950 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca8d=['whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x19cfe3,_0x5bbb6b){var _0x591042=function(_0x2e581){while(--_0x2e581){_0x19cfe3['push'](_0x19cfe3['shift']());}};_0x591042(++_0x5bbb6b);}(_0xca8d,0x172));var _0xdca8=function(_0x2fd56e,_0x168395){_0x2fd56e=_0x2fd56e-0x0;var _0x8562e8=_0xca8d[_0x2fd56e];return _0x8562e8;};'use strict';var _=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var logger=require(_0xdca8('0x2'))(_0xdca8('0x3'));var moment=require(_0xdca8('0x4'));var BPromise=require(_0xdca8('0x5'));var rp=require(_0xdca8('0x6'));var fs=require('fs');var path=require(_0xdca8('0x7'));var rimraf=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var attributes=require(_0xdca8('0xa'));module[_0xdca8('0xb')]=function(_0x4d6383,_0x3366d5){return _0x4d6383[_0xdca8('0xc')](_0xdca8('0xd'),attributes,{'tableName':_0xdca8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdca8('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc090=['define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports'];(function(_0x195c6b,_0x558639){var _0x239123=function(_0x31b683){while(--_0x31b683){_0x195c6b['push'](_0x195c6b['shift']());}};_0x239123(++_0x558639);}(_0xc090,0x112));var _0x0c09=function(_0x4ed907,_0x340ccb){_0x4ed907=_0x4ed907-0x0;var _0x41a2fb=_0xc090[_0x4ed907];return _0x41a2fb;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var logger=require(_0x0c09('0x2'))(_0x0c09('0x3'));var moment=require(_0x0c09('0x4'));var BPromise=require(_0x0c09('0x5'));var rp=require(_0x0c09('0x6'));var fs=require('fs');var path=require(_0x0c09('0x7'));var rimraf=require(_0x0c09('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c09('0x9'));module[_0x0c09('0xa')]=function(_0x4f3f48,_0x49a403){return _0x4f3f48[_0x0c09('0xb')]('WhatsappApplication',attributes,{'tableName':_0x0c09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0c09('0xd'),'collate':_0x0c09('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7c1040f..a30d8ef 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x5a73a0,_0x4f9df5){var _0x379bbf=function(_0x6b2d9e){while(--_0x6b2d9e){_0x5a73a0['push'](_0x5a73a0['shift']());}};_0x379bbf(++_0x4f9df5);}(_0x207c,0x1e8));var _0xc207=function(_0x5384ae,_0x32e603){_0x5384ae=_0x5384ae-0x0;var _0x4bcf2d=_0x207c[_0x5384ae];return _0x4bcf2d;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x281e76,_0x8bde50){var _0x5ecce5=function(_0x2382bc){while(--_0x2382bc){_0x281e76['push'](_0x281e76['shift']());}};_0x5ecce5(++_0x8bde50);}(_0xda55,0x6d));var _0x5da5=function(_0x1d5270,_0x461f18){_0x1d5270=_0x1d5270-0x0;var _0x3fbe67=_0xda55[_0x1d5270];return _0x3fbe67;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2d70d5a..560a948 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe626=['whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id','show','post','create','/:id/messages','addMessage','tracked','whatsappinteraction:addtags','addTags','put'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xe626,0x9d));var _0x6e62=function(_0xaaf2d4,_0x411523){_0xaaf2d4=_0xaaf2d4-0x0;var _0x1258c1=_0xe626[_0xaaf2d4];return _0x1258c1;};'use strict';var multer=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var path=require(_0x6e62('0x2'));var timeout=require(_0x6e62('0x3'));var express=require('express');var router=express[_0x6e62('0x4')]();var fs_extra=require(_0x6e62('0x5'));var auth=require(_0x6e62('0x6'));var interaction=require(_0x6e62('0x7'));var config=require(_0x6e62('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6e62('0x9')]);router[_0x6e62('0xa')]('/describe',auth[_0x6e62('0xb')](),controller[_0x6e62('0xc')]);router[_0x6e62('0xa')](_0x6e62('0xd'),auth['isAuthenticated'](),controller[_0x6e62('0xe')]);router[_0x6e62('0xa')]('/:id/messages',auth[_0x6e62('0xb')](),controller['getMessages']);router[_0x6e62('0xa')]('/:id/download',auth[_0x6e62('0xb')](),controller['download']);router[_0x6e62('0xf')]('/',auth[_0x6e62('0xb')](),controller[_0x6e62('0x10')]);router[_0x6e62('0xf')](_0x6e62('0x11'),auth[_0x6e62('0xb')](),controller[_0x6e62('0x12')]);router['post']('/:id/tags',auth[_0x6e62('0xb')](),interaction[_0x6e62('0x13')]('whatsapp',_0x6e62('0x14')),controller[_0x6e62('0x15')]);router[_0x6e62('0x16')](_0x6e62('0xd'),auth['isAuthenticated'](),interaction[_0x6e62('0x13')](_0x6e62('0x17'),_0x6e62('0x18')),controller[_0x6e62('0x19')]);router[_0x6e62('0x1a')](_0x6e62('0xd'),auth[_0x6e62('0xb')](),interaction[_0x6e62('0x13')](_0x6e62('0x17'),_0x6e62('0x1b')),controller['destroy']);router[_0x6e62('0x1a')](_0x6e62('0x1c'),auth['isAuthenticated'](),controller[_0x6e62('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x7ee1=['whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','/:id','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7ee1,0x8d));var _0x17ee=function(_0x381d87,_0x45958c){_0x381d87=_0x381d87-0x0;var _0x2223c5=_0x7ee1[_0x381d87];return _0x2223c5;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/describe',auth[_0x17ee('0x9')](),controller['describe']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0x17ee('0x9')](),controller['getMessages']);router[_0x17ee('0x7')](_0x17ee('0xb'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);router['post']('/',auth[_0x17ee('0x9')](),controller['create']);router[_0x17ee('0xd')](_0x17ee('0xe'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xf')]);router[_0x17ee('0xd')](_0x17ee('0x10'),auth[_0x17ee('0x9')](),interaction[_0x17ee('0x11')](_0x17ee('0x12'),_0x17ee('0x13')),controller[_0x17ee('0x14')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x17ee('0x12'),_0x17ee('0x15')),controller[_0x17ee('0x16')]);router[_0x17ee('0x17')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),interaction[_0x17ee('0x11')]('whatsapp',_0x17ee('0x18')),controller[_0x17ee('0x19')]);router[_0x17ee('0x17')](_0x17ee('0x10'),auth[_0x17ee('0x9')](),controller['removeTags']);module[_0x17ee('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c3fe0c1..b4b5ad0 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x891b=['DATE','ENUM','exports','BOOLEAN','STRING'];(function(_0x4a9e4a,_0x585df1){var _0xaa903e=function(_0x4190dd){while(--_0x4190dd){_0x4a9e4a['push'](_0x4a9e4a['shift']());}};_0xaa903e(++_0x585df1);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xb891('0x0')]={'closed':{'type':Sequelize[_0xb891('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb891('0x2')]},'secondDisposition':{'type':Sequelize[_0xb891('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb891('0x2')]},'note':{'type':Sequelize[_0xb891('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb891('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb891('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb891('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0f89=['BOOLEAN','sequelize','moment','exports','DATE','STRING','out','ENUM'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x0f89,0x111));var _0x90f8=function(_0xb9a59e,_0x1bf6cb){_0xb9a59e=_0xb9a59e-0x0;var _0x5b37af=_0x0f89[_0xb9a59e];return _0x5b37af;};'use strict';var Sequelize=require(_0x90f8('0x0'));var moment=require(_0x90f8('0x1'));module[_0x90f8('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x90f8('0x3')]},'disposition':{'type':Sequelize[_0x90f8('0x4')]},'secondDisposition':{'type':Sequelize[_0x90f8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x90f8('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x90f8('0x4')]},'read1stAt':{'type':Sequelize[_0x90f8('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x90f8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x90f8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x90f8('0x6')]('in',_0x90f8('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x90f8('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 695adc9..a874c9c 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e83=['err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','end','offset','limit','undefined','count','status','set','update','then','destroy','error','name','send','index','map','WhatsappInteraction','rawAttributes','type','getOptions','findAll','whatsapp','query','user','params','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','read','Account','Owner','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createReadStream','direction','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download'];(function(_0x387290,_0x2399b4){var _0xe1cb1=function(_0x2a0b17){while(--_0x2a0b17){_0x387290['push'](_0x387290['shift']());}};_0xe1cb1(++_0x2399b4);}(_0x7e83,0x7c));var _0x37e8=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x7e83[_0x10df18];return _0x1f9a1d;};'use strict';var rimraf=require(_0x37e8('0x0'));var zipdir=require(_0x37e8('0x1'));var moment=require(_0x37e8('0x2'));var BPromise=require(_0x37e8('0x3'));var util=require(_0x37e8('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x37e8('0x5'));var Redis=require(_0x37e8('0x6'));var interaction=require(_0x37e8('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x37e8('0x8'));var logger=require(_0x37e8('0x9'))('api');var config=require(_0x37e8('0xa'));var db=require(_0x37e8('0xb'))['db'];config['redis']=_[_0x37e8('0xc')](config[_0x37e8('0xd')],{'host':_0x37e8('0xe'),'port':0x18eb});var socket=require(_0x37e8('0xf'))(new Redis(config['redis']));require(_0x37e8('0x10'))['register'](socket);function respondWithStatusCode(_0x2f8ecc,_0x429757){_0x429757=_0x429757||0xcc;return function(_0xb76d65){if(_0xb76d65){return _0x2f8ecc[_0x37e8('0x11')](_0x429757);}return _0x2f8ecc['status'](_0x429757)[_0x37e8('0x12')]();};}function respondWithResult(_0x1af4f2,_0x4a93b6){_0x4a93b6=_0x4a93b6||0xc8;return function(_0x8fb709){if(_0x8fb709){return _0x1af4f2['status'](_0x4a93b6)['json'](_0x8fb709);}};}function respondWithFilteredResult(_0x44771d,_0x22e3a8){return function(_0x1a43a7){if(_0x1a43a7){var _0x1305d4=typeof _0x22e3a8[_0x37e8('0x13')]==='undefined'&&typeof _0x22e3a8[_0x37e8('0x14')]===_0x37e8('0x15');var _0x5d3bb5=_0x1a43a7['count'];var _0xaa739a=_0x1305d4?0x0:_0x22e3a8[_0x37e8('0x13')];var _0x28c189=_0x1305d4?_0x1a43a7[_0x37e8('0x16')]:_0x22e3a8[_0x37e8('0x13')]+_0x22e3a8[_0x37e8('0x14')];var _0xe8fd43;if(_0x28c189>=_0x5d3bb5){_0x28c189=_0x5d3bb5;_0xe8fd43=0xc8;}else{_0xe8fd43=0xce;}_0x44771d[_0x37e8('0x17')](_0xe8fd43);return _0x44771d[_0x37e8('0x18')]('Content-Range',_0xaa739a+'-'+_0x28c189+'/'+_0x5d3bb5)['json'](_0x1a43a7);}return null;};}function saveUpdates(_0x34ca87){return function(_0x1f8500){if(_0x1f8500){return _0x1f8500[_0x37e8('0x19')](_0x34ca87)[_0x37e8('0x1a')](function(_0x157fea){return _0x157fea;});}return null;};}function removeEntity(_0x211034){return function(_0x2a42ac){if(_0x2a42ac){return _0x2a42ac[_0x37e8('0x1b')]()[_0x37e8('0x1a')](function(){_0x211034[_0x37e8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51dc0c){return function(_0x24d570){if(!_0x24d570){_0x51dc0c[_0x37e8('0x11')](0x194);}return _0x24d570;};}function handleError(_0x23e5fb,_0x21814b){_0x21814b=_0x21814b||0x1f4;return function(_0x101dde){logger[_0x37e8('0x1c')](_0x101dde['stack']);if(_0x101dde[_0x37e8('0x1d')]){delete _0x101dde[_0x37e8('0x1d')];}_0x23e5fb[_0x37e8('0x17')](_0x21814b)[_0x37e8('0x1e')](_0x101dde);};}exports[_0x37e8('0x1f')]=function(_0x2991fa,_0x429d65){var _0x3cc5ae={};var _0x5271cf=_[_0x37e8('0x20')](db[_0x37e8('0x21')][_0x37e8('0x22')],function(_0x448d8a){return{'name':_0x448d8a['fieldName'],'type':_0x448d8a[_0x37e8('0x23')]['key']};});_0x3cc5ae=qs[_0x37e8('0x24')](_0x5271cf,_0x2991fa);return interaction[_0x37e8('0x25')](_0x37e8('0x26'),_0x2991fa[_0x37e8('0x27')],_0x2991fa[_0x37e8('0x28')],_0x3cc5ae,_0x5271cf)[_0x37e8('0x1a')](respondWithFilteredResult(_0x429d65,_0x3cc5ae))['catch'](handleError(_0x429d65,null));};exports['show']=function(_0x151e6d,_0x3b6c2c){var _0x432e1e={'raw':![],'where':{'id':_0x151e6d[_0x37e8('0x29')]['id']}},_0x2445f2={};_0x2445f2['model']=_[_0x37e8('0x2a')](db[_0x37e8('0x21')][_0x37e8('0x22')]);_0x2445f2['query']=_[_0x37e8('0x2a')](_0x151e6d['query']);_0x2445f2[_0x37e8('0x2b')]=_[_0x37e8('0x2c')](_0x2445f2[_0x37e8('0x2d')],_0x2445f2[_0x37e8('0x27')]);_0x432e1e[_0x37e8('0x2e')]=_[_0x37e8('0x2c')](_0x2445f2[_0x37e8('0x2d')],qs[_0x37e8('0x2f')](_0x151e6d[_0x37e8('0x27')]['fields']));_0x432e1e[_0x37e8('0x2e')]=_0x432e1e[_0x37e8('0x2e')]['length']?_0x432e1e[_0x37e8('0x2e')]:_0x2445f2[_0x37e8('0x2d')];if(_0x151e6d['query'][_0x37e8('0x30')]){_0x432e1e[_0x37e8('0x31')]=[{'all':!![]}];}_0x432e1e=_[_0x37e8('0x32')]({},_0x432e1e,_0x151e6d[_0x37e8('0x33')]);return db['WhatsappInteraction'][_0x37e8('0x34')](_0x432e1e)['then'](handleEntityNotFound(_0x3b6c2c,null))[_0x37e8('0x1a')](respondWithResult(_0x3b6c2c,null))[_0x37e8('0x35')](handleError(_0x3b6c2c,null));};exports[_0x37e8('0x36')]=function(_0x287e1e,_0x219e09){return db[_0x37e8('0x21')]['create'](_0x287e1e[_0x37e8('0x37')],{})[_0x37e8('0x1a')](respondWithResult(_0x219e09,0xc9))['catch'](handleError(_0x219e09,null));};exports['update']=function(_0xa83a08,_0x2616fd){if(_0xa83a08[_0x37e8('0x37')]['id']){delete _0xa83a08[_0x37e8('0x37')]['id'];}return db['WhatsappInteraction'][_0x37e8('0x34')]({'where':{'id':_0xa83a08['params']['id']}})[_0x37e8('0x1a')](handleEntityNotFound(_0x2616fd,null))[_0x37e8('0x1a')](saveUpdates(_0xa83a08[_0x37e8('0x37')],null))[_0x37e8('0x1a')](respondWithResult(_0x2616fd,null))[_0x37e8('0x35')](handleError(_0x2616fd,null));};exports[_0x37e8('0x1b')]=function(_0x158346,_0x563423){return db['WhatsappInteraction'][_0x37e8('0x34')]({'where':{'id':_0x158346[_0x37e8('0x29')]['id']}})['then'](handleEntityNotFound(_0x563423,null))[_0x37e8('0x1a')](removeEntity(_0x563423,null))[_0x37e8('0x35')](handleError(_0x563423,null));};exports[_0x37e8('0x38')]=function(_0x5311f5,_0x112be6){return db[_0x37e8('0x21')][_0x37e8('0x38')]()['then'](respondWithResult(_0x112be6,null))[_0x37e8('0x35')](handleError(_0x112be6,null));};exports[_0x37e8('0x39')]=function(_0x20aa35,_0x3e98a8){return db[_0x37e8('0x3a')][_0x37e8('0x34')]({'where':{'id':_0x20aa35['params']['id']}})[_0x37e8('0x1a')](handleEntityNotFound(_0x3e98a8,null))[_0x37e8('0x1a')](function(_0x55e5ba){if(_0x55e5ba){return _0x55e5ba['addMessage'](_0x20aa35[_0x37e8('0x37')][_0x37e8('0x3b')],_[_0x37e8('0x3c')](_0x20aa35[_0x37e8('0x37')],[_0x37e8('0x3b'),'id'])||{});}})[_0x37e8('0x1a')](respondWithResult(_0x3e98a8,null))[_0x37e8('0x35')](handleError(_0x3e98a8,null));};exports[_0x37e8('0x3d')]=function(_0x141c28,_0x94f696){var _0x15deb9={'raw':![],'where':{}};var _0x23b4ba={};var _0x55b816={'count':0x0,'rows':[]};return db[_0x37e8('0x21')]['findOne']({'where':{'id':_0x141c28[_0x37e8('0x29')]['id']}})['then'](handleEntityNotFound(_0x94f696,null))[_0x37e8('0x1a')](function(_0x15d304){if(_0x15d304){_0x23b4ba['model']=_['keys'](db[_0x37e8('0x3a')][_0x37e8('0x22')]);_0x23b4ba[_0x37e8('0x27')]=_['keys'](_0x141c28[_0x37e8('0x27')]);_0x23b4ba['filters']=_[_0x37e8('0x2c')](_0x23b4ba['model'],_0x23b4ba['query']);_0x15deb9[_0x37e8('0x2e')]=_['intersection'](_0x23b4ba[_0x37e8('0x2d')],qs[_0x37e8('0x2f')](_0x141c28['query']['fields']));_0x15deb9[_0x37e8('0x2e')]=_0x15deb9[_0x37e8('0x2e')][_0x37e8('0x3e')]?_0x15deb9[_0x37e8('0x2e')]:_0x23b4ba['model'];if(!_0x141c28[_0x37e8('0x27')][_0x37e8('0x3f')](_0x37e8('0x40'))){_0x15deb9[_0x37e8('0x14')]=qs[_0x37e8('0x14')](_0x141c28['query']['limit']);_0x15deb9[_0x37e8('0x13')]=qs[_0x37e8('0x13')](_0x141c28[_0x37e8('0x27')][_0x37e8('0x13')]);}_0x15deb9['order']=qs[_0x37e8('0x41')](_0x141c28['query'][_0x37e8('0x41')]);_0x15deb9['where']=qs[_0x37e8('0x2b')](_[_0x37e8('0x42')](_0x141c28['query'],_0x23b4ba[_0x37e8('0x2b')]));_0x15deb9[_0x37e8('0x43')][_0x37e8('0x44')]=_0x15d304['id'];if(_0x141c28['query']['filter']){_0x15deb9[_0x37e8('0x43')]=_[_0x37e8('0x32')](_0x15deb9['where'],{'$or':_[_0x37e8('0x20')](_0x15deb9['attributes'],function(_0x1da581){var _0x1998b9={};_0x1998b9[_0x1da581]={'$like':'%'+_0x141c28[_0x37e8('0x27')][_0x37e8('0x45')]+'%'};return _0x1998b9;})});}if(_0x141c28[_0x37e8('0x27')][_0x37e8('0x46')]){var _0x22d327=_0x141c28[_0x37e8('0x27')]['$gte'][_0x37e8('0x47')](',');var _0x10107d={};_0x10107d[_0x22d327[0x0]]={'$gte':moment(_0x22d327[0x1])[_0x37e8('0x48')](_0x37e8('0x49'))};_0x15deb9[_0x37e8('0x43')]=_[_0x37e8('0x32')](_0x15deb9[_0x37e8('0x43')],_0x10107d);}_0x15deb9=_[_0x37e8('0x32')]({},_0x15deb9,_0x141c28[_0x37e8('0x33')]);return db[_0x37e8('0x3a')][_0x37e8('0x16')]({'where':_0x15deb9[_0x37e8('0x43')]})[_0x37e8('0x1a')](function(_0x2536a0){_0x55b816[_0x37e8('0x16')]=_0x2536a0;if(_0x141c28[_0x37e8('0x27')]['includeAll']){_0x15deb9['include']=[{'all':!![]}];}return db[_0x37e8('0x3a')][_0x37e8('0x25')](_0x15deb9);})[_0x37e8('0x1a')](function(_0x538863){_0x55b816[_0x37e8('0x4a')]=_0x538863;return _0x55b816;});}})['then'](respondWithFilteredResult(_0x94f696,_0x15deb9))[_0x37e8('0x35')](handleError(_0x94f696,null));};exports[_0x37e8('0x4b')]=function(_0xd254b5,_0x79974){return db['WhatsappInteraction']['find']({'where':{'id':_0xd254b5[_0x37e8('0x29')]['id']}})[_0x37e8('0x1a')](handleEntityNotFound(_0x79974,null))[_0x37e8('0x1a')](function(_0x16694a){if(_0x16694a){return _0x16694a[_0x37e8('0x4c')](_0xd254b5[_0x37e8('0x37')][_0x37e8('0x3b')],_[_0x37e8('0x3c')](_0xd254b5[_0x37e8('0x37')],[_0x37e8('0x3b'),'id'])||{})['spread'](function(){return db[_0x37e8('0x4d')]['findAll']({'attributes':['id',_0x37e8('0x1d'),_0x37e8('0x4e')],'where':{'id':_0xd254b5['body']['ids']}});})[_0x37e8('0x1a')](function(_0x87aac2){socket[_0x37e8('0x4f')]('whatsappInteractionTags:save',{'id':Number(_0xd254b5[_0x37e8('0x29')]['id']),'tags':_0x87aac2||[]});return{'id':Number(_0xd254b5[_0x37e8('0x29')]['id']),'tags':_0x87aac2||[]};});}})[_0x37e8('0x1a')](respondWithResult(_0x79974,null))['catch'](handleError(_0x79974,null));};exports['removeTags']=function(_0x49f3b5,_0x189704){return db[_0x37e8('0x21')][_0x37e8('0x34')]({'where':{'id':_0x49f3b5[_0x37e8('0x29')]['id']}})[_0x37e8('0x1a')](handleEntityNotFound(_0x189704,null))['then'](function(_0x197b39){if(_0x197b39){return _0x197b39['removeTags'](_0x49f3b5[_0x37e8('0x27')]['ids']);}})[_0x37e8('0x1a')](respondWithStatusCode(_0x189704,null))[_0x37e8('0x35')](handleError(_0x189704,null));};exports['download']=function(_0x1b7d9a,_0x59ada6){var _0x539619=moment()[_0x37e8('0x50')]()[_0x37e8('0x51')]();var _0x389ba5=path[_0x37e8('0x52')](config[_0x37e8('0x53')],_0x37e8('0x54'),_0x37e8('0x55'),_0x37e8('0x56'));var _0x4a5256=path[_0x37e8('0x52')](config['root'],'server',_0x37e8('0x55'),_0x37e8('0x57'));var _0xc42f07=path[_0x37e8('0x52')](_0x389ba5,_0x539619);var _0x4cb8f0=util['format'](_0x37e8('0x58'),_0x1b7d9a[_0x37e8('0x29')]['id'],_0x539619);var _0x7d9b45=path[_0x37e8('0x52')](_0x389ba5,_0x4cb8f0);var _0x180ab6=[];_0x180ab6[_0x37e8('0x59')]({'model':db[_0x37e8('0x5a')],'as':_0x37e8('0x5a'),'attributes':['id',_0x37e8('0x5b')],'raw':!![]});_0x180ab6[_0x37e8('0x59')]({'model':db[_0x37e8('0x5c')],'as':_0x37e8('0x5d'),'attributes':['id','firstName',_0x37e8('0x5e')],'raw':!![]});if(_0x1b7d9a[_0x37e8('0x27')][_0x37e8('0x57')]){_0x180ab6[_0x37e8('0x59')]({'model':db[_0x37e8('0x5f')],'as':_0x37e8('0x5f'),'raw':!![]});}var _0x32492e=[{'model':db[_0x37e8('0x3a')],'as':_0x37e8('0x60'),'attributes':['id',_0x37e8('0x37'),_0x37e8('0x61'),'direction','secret',_0x37e8('0x62')],'include':_0x180ab6}];_0x32492e[_0x37e8('0x59')]({'model':db['WhatsappAccount'],'as':_0x37e8('0x63'),'attributes':['id','name']});_0x32492e[_0x37e8('0x59')]({'model':db['User'],'as':_0x37e8('0x64'),'attributes':['id',_0x37e8('0x5b')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1b7d9a[_0x37e8('0x29')]['id']},'include':_0x32492e})[_0x37e8('0x1a')](handleEntityNotFound(_0x59ada6,null))[_0x37e8('0x1a')](function(_0x3d682c){if(_0x3d682c){var _0x40da5c=_0x3d682c['get']({'plain':!![]});fs[_0x37e8('0x65')](_0xc42f07);var _0x4ab241={'channel':_0x37e8('0x66'),'account':_0x40da5c[_0x37e8('0x63')][_0x37e8('0x1d')],'agent':_0x40da5c[_0x37e8('0x64')]?_0x40da5c['Owner'][_0x37e8('0x5b')]:_0x37e8('0x67'),'createdAt':moment(_0x40da5c['createdAt'])[_0x37e8('0x48')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x40da5c['closed']?moment(_0x40da5c[_0x37e8('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x37e8('0x51')]():'','disposition':_0x40da5c[_0x37e8('0x69')],'messages':_(_0x40da5c['Messages'])[_0x37e8('0x45')]({'secret':![]})['map'](function(_0x47f57e){if(_0x47f57e[_0x37e8('0x5f')]){var _0xba3b18=path[_0x37e8('0x52')](_0x4a5256,_0x47f57e[_0x37e8('0x5f')][_0x37e8('0x6a')]);if(fs[_0x37e8('0x6b')](_0xba3b18)){fs[_0x37e8('0x6c')](_0xba3b18)['pipe'](fs['createWriteStream'](path[_0x37e8('0x52')](_0xc42f07,_0x47f57e[_0x37e8('0x5f')]['basename'])));}}return{'date':moment(_0x47f57e['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x37e8('0x51')](),'sender':_0x47f57e[_0x37e8('0x6d')]===_0x37e8('0x6e')?_0x47f57e[_0x37e8('0x5a')]?_0x47f57e[_0x37e8('0x5a')][_0x37e8('0x5b')]:_0x37e8('0x6f'):_0x47f57e['Contact'][_0x37e8('0x70')]+(_0x47f57e[_0x37e8('0x5d')]['lastName']?'\x20'+_0x47f57e[_0x37e8('0x5d')][_0x37e8('0x5e')]:''),'body':_0x47f57e['Attachment']?_0x47f57e[_0x37e8('0x5f')][_0x37e8('0x6a')]:_0x47f57e[_0x37e8('0x37')],'direction':_0x47f57e[_0x37e8('0x6d')]===_0x37e8('0x6e')?'A':'C','secret':_0x47f57e['secret'],'read':_0x47f57e['read'],'attachment':_0x47f57e[_0x37e8('0x5f')]};})[_0x37e8('0x71')]()};return ejs[_0x37e8('0x72')](path[_0x37e8('0x52')](config[_0x37e8('0x53')],_0x37e8('0x54'),_0x37e8('0x73'),_0x37e8('0x74')),{'interaction':_0x4ab241})[_0x37e8('0x1a')](function(_0x203d9b){var _0xc09c5e=path['join'](_0xc42f07,_0x37e8('0x75')+_0x40da5c['id']+'-'+_0x539619+'.pdf');var _0x45a5ce={'path':_0xc09c5e,'channel':_0x37e8('0x66'),'interactionId':_0x40da5c['id']};return pdf[_0x37e8('0x76')](_0x203d9b,_0x45a5ce);})[_0x37e8('0x1a')](function(){return new BPromise(function(_0x5462db,_0x47a2f3){zipdir(_0xc42f07,{'saveTo':_0x7d9b45},function(_0x5a5a55,_0x38b25c){if(_0x5a5a55)return _0x47a2f3(_0x5a5a55);return _0x5462db(_0x38b25c);});})[_0x37e8('0x1a')](function(){return new BPromise(function(_0x40135b,_0x59479a){rimraf(_0xc42f07,function(_0x364fcb){if(_0x364fcb)_0x59479a(_0x364fcb);return _0x40135b();});});})[_0x37e8('0x1a')](function(){return _0x59ada6[_0x37e8('0x77')](_0x7d9b45,_0x4cb8f0,function(_0x489ed8){if(_0x489ed8){console['log'](_0x37e8('0x78'),_0x489ed8);}else{fs[_0x37e8('0x79')](_0x7d9b45);}});});});}else{return _0x59ada6['sendStatus'](0xc8);}})[_0x37e8('0x35')](handleError(_0x59ada6,null));}; \ No newline at end of file +var _0x855d=['includeAll','merge','options','find','create','body','params','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','color','whatsappInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','root','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','attachments','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','existsSync','createReadStream','createWriteStream','basename','direction','out','firstName','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x855d,0x1d2));var _0xd855=function(_0x4b49cd,_0x3e61fe){_0x4b49cd=_0x4b49cd-0x0;var _0x44035c=_0x855d[_0x4b49cd];return _0x44035c;};'use strict';var rimraf=require(_0xd855('0x0'));var zipdir=require(_0xd855('0x1'));var moment=require('moment');var BPromise=require(_0xd855('0x2'));var util=require(_0xd855('0x3'));var path=require(_0xd855('0x4'));var ejs=require(_0xd855('0x5'));var fs=require('fs');var _=require(_0xd855('0x6'));var Redis=require(_0xd855('0x7'));var interaction=require(_0xd855('0x8'));var qs=require(_0xd855('0x9'));var pdf=require(_0xd855('0xa'));var logger=require(_0xd855('0xb'))(_0xd855('0xc'));var config=require('../../config/environment');var db=require(_0xd855('0xd'))['db'];config[_0xd855('0xe')]=_[_0xd855('0xf')](config[_0xd855('0xe')],{'host':_0xd855('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd855('0xe')]));require('./whatsappInteraction.socket')[_0xd855('0x11')](socket);function respondWithStatusCode(_0x30181f,_0x55d214){_0x55d214=_0x55d214||0xcc;return function(_0x384529){if(_0x384529){return _0x30181f[_0xd855('0x12')](_0x55d214);}return _0x30181f[_0xd855('0x13')](_0x55d214)[_0xd855('0x14')]();};}function respondWithResult(_0x3f42b8,_0x2cd5fe){_0x2cd5fe=_0x2cd5fe||0xc8;return function(_0x181633){if(_0x181633){return _0x3f42b8[_0xd855('0x13')](_0x2cd5fe)['json'](_0x181633);}};}function respondWithFilteredResult(_0x318c2e,_0x3a27b8){return function(_0x3a9979){if(_0x3a9979){var _0x2b0dd2=typeof _0x3a27b8[_0xd855('0x15')]===_0xd855('0x16')&&typeof _0x3a27b8[_0xd855('0x17')]===_0xd855('0x16');var _0x1536b2=_0x3a9979[_0xd855('0x18')];var _0x49b683=_0x2b0dd2?0x0:_0x3a27b8[_0xd855('0x15')];var _0x2a0929=_0x2b0dd2?_0x3a9979['count']:_0x3a27b8[_0xd855('0x15')]+_0x3a27b8['limit'];var _0x5e0cc9;if(_0x2a0929>=_0x1536b2){_0x2a0929=_0x1536b2;_0x5e0cc9=0xc8;}else{_0x5e0cc9=0xce;}_0x318c2e['status'](_0x5e0cc9);return _0x318c2e[_0xd855('0x19')](_0xd855('0x1a'),_0x49b683+'-'+_0x2a0929+'/'+_0x1536b2)[_0xd855('0x1b')](_0x3a9979);}return null;};}function saveUpdates(_0x270ecb){return function(_0xa5fed9){if(_0xa5fed9){return _0xa5fed9[_0xd855('0x1c')](_0x270ecb)[_0xd855('0x1d')](function(_0x52c0a6){return _0x52c0a6;});}return null;};}function removeEntity(_0x31f75c){return function(_0x4d8770){if(_0x4d8770){return _0x4d8770[_0xd855('0x1e')]()[_0xd855('0x1d')](function(){_0x31f75c[_0xd855('0x13')](0xcc)[_0xd855('0x14')]();});}};}function handleEntityNotFound(_0x30746c){return function(_0x5eb990){if(!_0x5eb990){_0x30746c[_0xd855('0x12')](0x194);}return _0x5eb990;};}function handleError(_0x27547b,_0x3eb9f1){_0x3eb9f1=_0x3eb9f1||0x1f4;return function(_0x24e6fa){logger[_0xd855('0x1f')](_0x24e6fa[_0xd855('0x20')]);if(_0x24e6fa[_0xd855('0x21')]){delete _0x24e6fa['name'];}_0x27547b[_0xd855('0x13')](_0x3eb9f1)['send'](_0x24e6fa);};}exports[_0xd855('0x22')]=function(_0x5492ea,_0x2cf36a){var _0xb8d52={};var _0x5b7473=_['map'](db[_0xd855('0x23')][_0xd855('0x24')],function(_0x52f1a3){return{'name':_0x52f1a3[_0xd855('0x25')],'type':_0x52f1a3[_0xd855('0x26')][_0xd855('0x27')]};});_0xb8d52=qs[_0xd855('0x28')](_0x5b7473,_0x5492ea);return interaction[_0xd855('0x29')](_0xd855('0x2a'),_0x5492ea[_0xd855('0x2b')],_0x5492ea[_0xd855('0x2c')],_0xb8d52,_0x5b7473)['then'](respondWithFilteredResult(_0x2cf36a,_0xb8d52))[_0xd855('0x2d')](handleError(_0x2cf36a,null));};exports[_0xd855('0x2e')]=function(_0x276981,_0x1a7a84){var _0x1882f1={'raw':![],'where':{'id':_0x276981['params']['id']}},_0x1a82f7={};_0x1a82f7[_0xd855('0x2f')]=_[_0xd855('0x30')](db[_0xd855('0x23')][_0xd855('0x24')]);_0x1a82f7[_0xd855('0x2b')]=_[_0xd855('0x30')](_0x276981[_0xd855('0x2b')]);_0x1a82f7[_0xd855('0x31')]=_[_0xd855('0x32')](_0x1a82f7['model'],_0x1a82f7[_0xd855('0x2b')]);_0x1882f1[_0xd855('0x33')]=_[_0xd855('0x32')](_0x1a82f7[_0xd855('0x2f')],qs[_0xd855('0x34')](_0x276981['query']['fields']));_0x1882f1[_0xd855('0x33')]=_0x1882f1[_0xd855('0x33')][_0xd855('0x35')]?_0x1882f1[_0xd855('0x33')]:_0x1a82f7[_0xd855('0x2f')];if(_0x276981[_0xd855('0x2b')][_0xd855('0x36')]){_0x1882f1['include']=[{'all':!![]}];}_0x1882f1=_[_0xd855('0x37')]({},_0x1882f1,_0x276981[_0xd855('0x38')]);return db[_0xd855('0x23')][_0xd855('0x39')](_0x1882f1)['then'](handleEntityNotFound(_0x1a7a84,null))[_0xd855('0x1d')](respondWithResult(_0x1a7a84,null))['catch'](handleError(_0x1a7a84,null));};exports[_0xd855('0x3a')]=function(_0x4e9846,_0x1b6e2b){return db[_0xd855('0x23')]['create'](_0x4e9846[_0xd855('0x3b')],{})[_0xd855('0x1d')](respondWithResult(_0x1b6e2b,0xc9))[_0xd855('0x2d')](handleError(_0x1b6e2b,null));};exports['update']=function(_0x133533,_0xe50ff){if(_0x133533[_0xd855('0x3b')]['id']){delete _0x133533[_0xd855('0x3b')]['id'];}return db['WhatsappInteraction'][_0xd855('0x39')]({'where':{'id':_0x133533[_0xd855('0x3c')]['id']}})[_0xd855('0x1d')](handleEntityNotFound(_0xe50ff,null))[_0xd855('0x1d')](saveUpdates(_0x133533['body'],null))[_0xd855('0x1d')](respondWithResult(_0xe50ff,null))['catch'](handleError(_0xe50ff,null));};exports[_0xd855('0x1e')]=function(_0x50d0ae,_0x1b84ec){return db['WhatsappInteraction'][_0xd855('0x39')]({'where':{'id':_0x50d0ae[_0xd855('0x3c')]['id']}})[_0xd855('0x1d')](handleEntityNotFound(_0x1b84ec,null))[_0xd855('0x1d')](removeEntity(_0x1b84ec,null))[_0xd855('0x2d')](handleError(_0x1b84ec,null));};exports[_0xd855('0x3d')]=function(_0x476b45,_0x257d6b){return db['WhatsappInteraction'][_0xd855('0x3d')]()[_0xd855('0x1d')](respondWithResult(_0x257d6b,null))[_0xd855('0x2d')](handleError(_0x257d6b,null));};exports['addMessage']=function(_0x5c57e5,_0x378f7f){return db[_0xd855('0x3e')][_0xd855('0x39')]({'where':{'id':_0x5c57e5[_0xd855('0x3c')]['id']}})[_0xd855('0x1d')](handleEntityNotFound(_0x378f7f,null))[_0xd855('0x1d')](function(_0x5930db){if(_0x5930db){return _0x5930db[_0xd855('0x3f')](_0x5c57e5[_0xd855('0x3b')][_0xd855('0x40')],_[_0xd855('0x41')](_0x5c57e5[_0xd855('0x3b')],['ids','id'])||{});}})[_0xd855('0x1d')](respondWithResult(_0x378f7f,null))[_0xd855('0x2d')](handleError(_0x378f7f,null));};exports[_0xd855('0x42')]=function(_0x20d348,_0x44e7cf){var _0xaefa05={'raw':![],'where':{}};var _0x260005={};var _0x40434a={'count':0x0,'rows':[]};return db[_0xd855('0x23')][_0xd855('0x43')]({'where':{'id':_0x20d348[_0xd855('0x3c')]['id']}})[_0xd855('0x1d')](handleEntityNotFound(_0x44e7cf,null))['then'](function(_0x5d6f28){if(_0x5d6f28){_0x260005[_0xd855('0x2f')]=_['keys'](db[_0xd855('0x3e')][_0xd855('0x24')]);_0x260005[_0xd855('0x2b')]=_[_0xd855('0x30')](_0x20d348[_0xd855('0x2b')]);_0x260005[_0xd855('0x31')]=_[_0xd855('0x32')](_0x260005[_0xd855('0x2f')],_0x260005[_0xd855('0x2b')]);_0xaefa05[_0xd855('0x33')]=_[_0xd855('0x32')](_0x260005[_0xd855('0x2f')],qs[_0xd855('0x34')](_0x20d348[_0xd855('0x2b')]['fields']));_0xaefa05[_0xd855('0x33')]=_0xaefa05[_0xd855('0x33')][_0xd855('0x35')]?_0xaefa05['attributes']:_0x260005[_0xd855('0x2f')];if(!_0x20d348[_0xd855('0x2b')]['hasOwnProperty'](_0xd855('0x44'))){_0xaefa05[_0xd855('0x17')]=qs[_0xd855('0x17')](_0x20d348[_0xd855('0x2b')][_0xd855('0x17')]);_0xaefa05[_0xd855('0x15')]=qs['offset'](_0x20d348[_0xd855('0x2b')][_0xd855('0x15')]);}_0xaefa05[_0xd855('0x45')]=qs[_0xd855('0x46')](_0x20d348[_0xd855('0x2b')][_0xd855('0x46')]);_0xaefa05[_0xd855('0x47')]=qs[_0xd855('0x31')](_['pick'](_0x20d348[_0xd855('0x2b')],_0x260005['filters']));_0xaefa05[_0xd855('0x47')][_0xd855('0x48')]=_0x5d6f28['id'];if(_0x20d348[_0xd855('0x2b')][_0xd855('0x49')]){_0xaefa05['where']=_[_0xd855('0x37')](_0xaefa05['where'],{'$or':_[_0xd855('0x4a')](_0xaefa05[_0xd855('0x33')],function(_0x872a5f){var _0x1b3a59={};_0x1b3a59[_0x872a5f]={'$like':'%'+_0x20d348[_0xd855('0x2b')][_0xd855('0x49')]+'%'};return _0x1b3a59;})});}if(_0x20d348[_0xd855('0x2b')][_0xd855('0x4b')]){var _0xd26c1=_0x20d348[_0xd855('0x2b')][_0xd855('0x4b')][_0xd855('0x4c')](',');var _0x3a4496={};_0x3a4496[_0xd26c1[0x0]]={'$gte':moment(_0xd26c1[0x1])[_0xd855('0x4d')](_0xd855('0x4e'))};_0xaefa05[_0xd855('0x47')]=_[_0xd855('0x37')](_0xaefa05['where'],_0x3a4496);}_0xaefa05=_[_0xd855('0x37')]({},_0xaefa05,_0x20d348[_0xd855('0x38')]);return db[_0xd855('0x3e')][_0xd855('0x18')]({'where':_0xaefa05[_0xd855('0x47')]})[_0xd855('0x1d')](function(_0x2d3785){_0x40434a[_0xd855('0x18')]=_0x2d3785;if(_0x20d348['query'][_0xd855('0x36')]){_0xaefa05['include']=[{'all':!![]}];}return db[_0xd855('0x3e')][_0xd855('0x29')](_0xaefa05);})[_0xd855('0x1d')](function(_0x4ac4d6){_0x40434a['rows']=_0x4ac4d6;return _0x40434a;});}})[_0xd855('0x1d')](respondWithFilteredResult(_0x44e7cf,_0xaefa05))['catch'](handleError(_0x44e7cf,null));};exports['addTags']=function(_0x2020ce,_0x1e132a){return db[_0xd855('0x23')]['find']({'where':{'id':_0x2020ce[_0xd855('0x3c')]['id']}})[_0xd855('0x1d')](handleEntityNotFound(_0x1e132a,null))['then'](function(_0x1dcc25){if(_0x1dcc25){return _0x1dcc25[_0xd855('0x4f')](_0x2020ce[_0xd855('0x3b')][_0xd855('0x40')],_[_0xd855('0x41')](_0x2020ce[_0xd855('0x3b')],[_0xd855('0x40'),'id'])||{})[_0xd855('0x50')](function(){return db['Tag'][_0xd855('0x29')]({'attributes':['id',_0xd855('0x21'),_0xd855('0x51')],'where':{'id':_0x2020ce[_0xd855('0x3b')][_0xd855('0x40')]}});})[_0xd855('0x1d')](function(_0x5fd40c){socket['emit'](_0xd855('0x52'),{'id':Number(_0x2020ce['params']['id']),'tags':_0x5fd40c||[]});return{'id':Number(_0x2020ce['params']['id']),'tags':_0x5fd40c||[]};});}})[_0xd855('0x1d')](respondWithResult(_0x1e132a,null))[_0xd855('0x2d')](handleError(_0x1e132a,null));};exports[_0xd855('0x53')]=function(_0xfdc626,_0x483eb1){return db[_0xd855('0x23')][_0xd855('0x39')]({'where':{'id':_0xfdc626[_0xd855('0x3c')]['id']}})[_0xd855('0x1d')](handleEntityNotFound(_0x483eb1,null))['then'](function(_0x3f638d){if(_0x3f638d){return _0x3f638d['removeTags'](_0xfdc626[_0xd855('0x2b')][_0xd855('0x40')]);}})['then'](respondWithStatusCode(_0x483eb1,null))[_0xd855('0x2d')](handleError(_0x483eb1,null));};exports[_0xd855('0x54')]=function(_0x5e46d9,_0x3e5d32){var _0x339895=moment()[_0xd855('0x55')]()[_0xd855('0x56')]();var _0x3830ad=path['join'](config['root'],_0xd855('0x57'),_0xd855('0x58'),_0xd855('0x59'));var _0x17d8db=path[_0xd855('0x5a')](config[_0xd855('0x5b')],'server','files','attachments');var _0x59498d=path['join'](_0x3830ad,_0x339895);var _0x347a99=util[_0xd855('0x4d')](_0xd855('0x5c'),_0x5e46d9[_0xd855('0x3c')]['id'],_0x339895);var _0x441e3a=path['join'](_0x3830ad,_0x347a99);var _0x1c4466=[];_0x1c4466[_0xd855('0x5d')]({'model':db[_0xd855('0x5e')],'as':_0xd855('0x5e'),'attributes':['id',_0xd855('0x5f')],'raw':!![]});_0x1c4466['push']({'model':db[_0xd855('0x60')],'as':_0xd855('0x61'),'attributes':['id','firstName',_0xd855('0x62')],'raw':!![]});if(_0x5e46d9['query'][_0xd855('0x63')]){_0x1c4466['push']({'model':db[_0xd855('0x64')],'as':_0xd855('0x64'),'raw':!![]});}var _0x41d2d4=[{'model':db[_0xd855('0x3e')],'as':_0xd855('0x65'),'attributes':['id',_0xd855('0x3b'),_0xd855('0x66'),'direction',_0xd855('0x67'),_0xd855('0x68')],'include':_0x1c4466}];_0x41d2d4['push']({'model':db[_0xd855('0x69')],'as':_0xd855('0x6a'),'attributes':['id',_0xd855('0x21')]});_0x41d2d4[_0xd855('0x5d')]({'model':db[_0xd855('0x5e')],'as':_0xd855('0x6b'),'attributes':['id','fullname']});return db[_0xd855('0x23')][_0xd855('0x39')]({'where':{'id':_0x5e46d9[_0xd855('0x3c')]['id']},'include':_0x41d2d4})[_0xd855('0x1d')](handleEntityNotFound(_0x3e5d32,null))[_0xd855('0x1d')](function(_0xef45b3){if(_0xef45b3){var _0x40f451=_0xef45b3[_0xd855('0x6c')]({'plain':!![]});fs[_0xd855('0x6d')](_0x59498d);var _0x232223={'channel':'Whatsapp','account':_0x40f451[_0xd855('0x6a')][_0xd855('0x21')],'agent':_0x40f451[_0xd855('0x6b')]?_0x40f451[_0xd855('0x6b')][_0xd855('0x5f')]:_0xd855('0x6e'),'createdAt':moment(_0x40f451[_0xd855('0x66')])['format'](_0xd855('0x4e'))[_0xd855('0x56')](),'closedAt':_0x40f451[_0xd855('0x6f')]?moment(_0x40f451[_0xd855('0x70')])[_0xd855('0x4d')](_0xd855('0x4e'))[_0xd855('0x56')]():'','disposition':_0x40f451[_0xd855('0x71')],'messages':_(_0x40f451[_0xd855('0x65')])[_0xd855('0x49')]({'secret':![]})[_0xd855('0x4a')](function(_0xe6e8b8){if(_0xe6e8b8[_0xd855('0x64')]){var _0x57d9a=path['join'](_0x17d8db,_0xe6e8b8['Attachment']['basename']);if(fs[_0xd855('0x72')](_0x57d9a)){fs[_0xd855('0x73')](_0x57d9a)['pipe'](fs[_0xd855('0x74')](path[_0xd855('0x5a')](_0x59498d,_0xe6e8b8[_0xd855('0x64')][_0xd855('0x75')])));}}return{'date':moment(_0xe6e8b8[_0xd855('0x66')])[_0xd855('0x4d')](_0xd855('0x4e'))[_0xd855('0x56')](),'sender':_0xe6e8b8[_0xd855('0x76')]===_0xd855('0x77')?_0xe6e8b8['User']?_0xe6e8b8['User'][_0xd855('0x5f')]:'System':_0xe6e8b8[_0xd855('0x61')][_0xd855('0x78')]+(_0xe6e8b8[_0xd855('0x61')][_0xd855('0x62')]?'\x20'+_0xe6e8b8['Contact'][_0xd855('0x62')]:''),'body':_0xe6e8b8['Attachment']?_0xe6e8b8[_0xd855('0x64')]['basename']:_0xe6e8b8[_0xd855('0x3b')],'direction':_0xe6e8b8['direction']===_0xd855('0x77')?'A':'C','secret':_0xe6e8b8[_0xd855('0x67')],'read':_0xe6e8b8[_0xd855('0x68')],'attachment':_0xe6e8b8[_0xd855('0x64')]};})['value']()};return ejs[_0xd855('0x79')](path['join'](config[_0xd855('0x5b')],_0xd855('0x57'),_0xd855('0x7a'),_0xd855('0x7b')),{'interaction':_0x232223})[_0xd855('0x1d')](function(_0x2b5c06){var _0x209739=path[_0xd855('0x5a')](_0x59498d,'transcript-'+_0x40f451['id']+'-'+_0x339895+_0xd855('0x7c'));var _0x1ae6af={'path':_0x209739,'channel':_0xd855('0x7d'),'interactionId':_0x40f451['id']};return pdf[_0xd855('0x7e')](_0x2b5c06,_0x1ae6af);})['then'](function(){return new BPromise(function(_0x1ea349,_0x449e67){zipdir(_0x59498d,{'saveTo':_0x441e3a},function(_0x13dab3,_0x19747e){if(_0x13dab3)return _0x449e67(_0x13dab3);return _0x1ea349(_0x19747e);});})[_0xd855('0x1d')](function(){return new BPromise(function(_0x2b1cca,_0x42f76f){rimraf(_0x59498d,function(_0x3c3e0c){if(_0x3c3e0c)_0x42f76f(_0x3c3e0c);return _0x2b1cca();});});})[_0xd855('0x1d')](function(){return _0x3e5d32[_0xd855('0x54')](_0x441e3a,_0x347a99,function(_0x367fc8){if(_0x367fc8){console[_0xd855('0x7f')](_0xd855('0x80'),_0x367fc8);}else{fs[_0xd855('0x81')](_0x441e3a);}});});});}else{return _0x3e5d32[_0xd855('0x12')](0xc8);}})[_0xd855('0x2d')](handleError(_0x3e5d32,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e1869de..8d0c9c3 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1b9=['remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x5179fd,_0x1bed8c){var _0x20f373=function(_0x515334){while(--_0x515334){_0x5179fd['push'](_0x5179fd['shift']());}};_0x20f373(++_0x1bed8c);}(_0xa1b9,0x71));var _0x9a1b=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa1b9[_0x34bf97];return _0x292719;};'use strict';var EventEmitter=require(_0x9a1b('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x9a1b('0x1')];var WhatsappMessage=require(_0x9a1b('0x2'))['db'][_0x9a1b('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9a1b('0x4')](0x0);var events={'afterCreate':_0x9a1b('0x5'),'afterUpdate':_0x9a1b('0x6'),'afterDestroy':_0x9a1b('0x7')};function emitEvent(_0x59f846){return function(_0x269747,_0x3c2d2b,_0x36712b){_0x269747[_0x9a1b('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x185401){_0x269747['setDataValue'](_0x9a1b('0x9'),_0x185401[_0x9a1b('0xa')](function(_0x3c0842){return{'id':_0x3c0842['id']};}));return WhatsappMessage[_0x9a1b('0xb')]({'where':{'WhatsappInteractionId':_0x269747['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9a1b('0xc')](function(_0x497e8c){_0x269747[_0x9a1b('0xd')](_0x9a1b('0xe'),_0x497e8c[_0x9a1b('0xf')]);WhatsappInteractionEvents[_0x9a1b('0x10')](_0x59f846+':'+_0x269747['id'],_0x269747);WhatsappInteractionEvents[_0x9a1b('0x10')](_0x59f846,_0x269747);_0x36712b(null);})[_0x9a1b('0x11')](_0x36712b(null));};}for(var e in events){if(events[_0x9a1b('0x12')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x9a1b('0x13')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd87e=['../../mysqldb','WhatsappMessage','setMaxListeners','update','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x1f86ed,_0x2ac78c){var _0xf0bf77=function(_0x94fe3a){while(--_0x94fe3a){_0x1f86ed['push'](_0x1f86ed['shift']());}};_0xf0bf77(++_0x2ac78c);}(_0xd87e,0x1bf));var _0xed87=function(_0x5bb149,_0x456cdc){_0x5bb149=_0x5bb149-0x0;var _0x1c85f5=_0xd87e[_0x5bb149];return _0x1c85f5;};'use strict';var EventEmitter=require(_0xed87('0x0'));var WhatsappInteraction=require(_0xed87('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xed87('0x1'))['db'][_0xed87('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xed87('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed87('0x4'),'afterDestroy':'remove'};function emitEvent(_0x11a5d9){return function(_0x41ca7c,_0x5c9f03,_0x17adfe){_0x41ca7c['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xa33c67){_0x41ca7c[_0xed87('0x5')](_0xed87('0x6'),_0xa33c67[_0xed87('0x7')](function(_0x569d66){return{'id':_0x569d66['id']};}));return WhatsappMessage[_0xed87('0x8')]({'where':{'WhatsappInteractionId':_0x41ca7c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xed87('0x9')](function(_0x21d399){_0x41ca7c[_0xed87('0x5')](_0xed87('0xa'),_0x21d399[_0xed87('0xb')]);WhatsappInteractionEvents[_0xed87('0xc')](_0x11a5d9+':'+_0x41ca7c['id'],_0x41ca7c);WhatsappInteractionEvents['emit'](_0x11a5d9,_0x41ca7c);_0x17adfe(null);})[_0xed87('0xd')](_0x17adfe(null));};}for(var e in events){if(events[_0xed87('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xed87('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 1fa4aec..45b0752 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x328a=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','closed','closedAt'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x328a,0x1ec));var _0xa328=function(_0x524689,_0x52a679){_0x524689=_0x524689-0x0;var _0x5a6eeb=_0x328a[_0x524689];return _0x5a6eeb;};'use strict';var _=require('lodash');var util=require(_0xa328('0x0'));var logger=require(_0xa328('0x1'))(_0xa328('0x2'));var moment=require(_0xa328('0x3'));var BPromise=require('bluebird');var rp=require(_0xa328('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa328('0x5'));var config=require(_0xa328('0x6'));var attributes=require(_0xa328('0x7'));module['exports']=function(_0x18c22d,_0x193a6c){return _0x18c22d[_0xa328('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xa328('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47825e,_0x189441,_0xf2bdff){if(_0x47825e['changed'](_0xa328('0xa'))){_0x47825e[_0xa328('0xb')]=moment()[_0xa328('0xc')](_0xa328('0xd'));}_0xf2bdff(null,_0x47825e);}}});}; \ No newline at end of file +var _0x8b35=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','changed'];(function(_0x31c6b6,_0xdd33b7){var _0x32b27b=function(_0x32f195){while(--_0x32f195){_0x31c6b6['push'](_0x31c6b6['shift']());}};_0x32b27b(++_0xdd33b7);}(_0x8b35,0x17a));var _0x58b3=function(_0x2c2c68,_0x39cd29){_0x2c2c68=_0x2c2c68-0x0;var _0x213f7f=_0x8b35[_0x2c2c68];return _0x213f7f;};'use strict';var _=require(_0x58b3('0x0'));var util=require(_0x58b3('0x1'));var logger=require(_0x58b3('0x2'))(_0x58b3('0x3'));var moment=require(_0x58b3('0x4'));var BPromise=require('bluebird');var rp=require(_0x58b3('0x5'));var fs=require('fs');var path=require(_0x58b3('0x6'));var rimraf=require(_0x58b3('0x7'));var config=require(_0x58b3('0x8'));var attributes=require(_0x58b3('0x9'));module['exports']=function(_0x40ada0,_0x5ef00a){return _0x40ada0[_0x58b3('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x126232,_0x46fda3,_0x1f2388){if(_0x126232[_0x58b3('0xb')](_0x58b3('0xc'))){_0x126232[_0x58b3('0xd')]=moment()['format'](_0x58b3('0xe'));}_0x1f2388(null,_0x126232);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e65a857..9b3be57 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99c6=['limit','UpdateWhatsappInteraction','stringify','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','attributes'];(function(_0x3e7034,_0x2d3cc9){var _0x209eda=function(_0x1536f6){while(--_0x1536f6){_0x3e7034['push'](_0x3e7034['shift']());}};_0x209eda(++_0x2d3cc9);}(_0x99c6,0x182));var _0x699c=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x99c6[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x699c('0x0'));var util=require('util');var moment=require(_0x699c('0x1'));var BPromise=require(_0x699c('0x2'));var rs=require(_0x699c('0x3'));var fs=require('fs');var Redis=require(_0x699c('0x4'));var db=require(_0x699c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x699c('0x6'))('rpc');var config=require(_0x699c('0x7'));var jayson=require(_0x699c('0x8'));var client=jayson[_0x699c('0x9')][_0x699c('0xa')]({'port':0x232a});config[_0x699c('0xb')]=_['defaults'](config[_0x699c('0xb')],{'host':_0x699c('0xc'),'port':0x18eb});var socket=require(_0x699c('0xd'))(new Redis(config[_0x699c('0xb')]));require(_0x699c('0xe'))[_0x699c('0xf')](socket);function respondWithRpcPromise(_0x2a5179,_0x248b34,_0x51ea7e){return new BPromise(function(_0x1753ac,_0x382407){return client[_0x699c('0x10')](_0x2a5179,_0x51ea7e)[_0x699c('0x11')](function(_0x8dc64e){logger[_0x699c('0x12')](_0x699c('0x13'),_0x248b34,_0x699c('0x14'));logger[_0x699c('0x15')](_0x699c('0x16'),_0x248b34,_0x699c('0x14'),JSON['stringify'](_0x8dc64e));if(_0x8dc64e[_0x699c('0x17')]){if(_0x8dc64e['error'][_0x699c('0x18')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x248b34,_0x8dc64e[_0x699c('0x17')][_0x699c('0x19')]);return _0x382407(_0x8dc64e[_0x699c('0x17')][_0x699c('0x19')]);}logger['error'](_0x699c('0x13'),_0x248b34,_0x8dc64e[_0x699c('0x17')][_0x699c('0x19')]);return _0x1753ac(_0x8dc64e[_0x699c('0x17')]['message']);}else{logger['info'](_0x699c('0x13'),_0x248b34,_0x699c('0x14'));_0x1753ac(_0x8dc64e[_0x699c('0x1a')]['message']);}})[_0x699c('0x1b')](function(_0x2a6b16){logger[_0x699c('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x248b34,_0x2a6b16);_0x382407(_0x2a6b16);});});}exports['UpdateWhatsappInteraction']=function(_0x30d425){var _0x336987=this;return new Promise(function(_0x43fa27,_0x18c117){return db[_0x699c('0x1c')][_0x699c('0x1d')](_0x30d425[_0x699c('0x1e')],{'raw':_0x30d425[_0x699c('0x1f')]?_0x30d425[_0x699c('0x1f')][_0x699c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30d425[_0x699c('0x1f')]?_0x30d425[_0x699c('0x1f')]['where']||null:null,'attributes':_0x30d425[_0x699c('0x1f')]?_0x30d425[_0x699c('0x1f')][_0x699c('0x21')]||null:null,'limit':_0x30d425[_0x699c('0x1f')]?_0x30d425['options'][_0x699c('0x22')]||null:null})['then'](function(_0x506e28){logger[_0x699c('0x12')](_0x699c('0x23'),_0x30d425);logger[_0x699c('0x15')](_0x699c('0x23'),_0x30d425,JSON[_0x699c('0x24')](_0x506e28));_0x43fa27(_0x506e28);})['catch'](function(_0x120696){logger[_0x699c('0x17')]('UpdateWhatsappInteraction',_0x120696[_0x699c('0x19')],_0x30d425);_0x18c117(_0x336987['error'](0x1f4,_0x120696[_0x699c('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x56ec79){return new Promise(function(_0x31248b,_0x1e3ca5){return db['WhatsappInteraction']['find']({'where':_0x56ec79[_0x699c('0x1f')]?_0x56ec79['options']['where']||null:null})['then'](function(_0x1b492f){if(_0x1b492f){return _0x1b492f[_0x699c('0x25')](_0x56ec79[_0x699c('0x1e')]['ids'],_[_0x699c('0x26')](_0x56ec79[_0x699c('0x1e')],[_0x699c('0x27'),'id'])||{});}})[_0x699c('0x28')](function(_0x6720d0){logger[_0x699c('0x12')]('AddTags',_0x56ec79);logger[_0x699c('0x15')](_0x699c('0x29'),_0x56ec79,JSON['stringify'](_0x6720d0));_0x31248b(_0x6720d0);})[_0x699c('0x1b')](function(_0xf1c66a){logger[_0x699c('0x17')]('AddTags',_0xf1c66a[_0x699c('0x19')],_0x56ec79);_0x1e3ca5(_this['error'](0x1f4,_0xf1c66a[_0x699c('0x19')]));});});}; \ No newline at end of file +var _0x4a00=['spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','WhatsappInteraction','update','options','raw','where','attributes','limit','then','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','find','addTags','body','omit','ids'];(function(_0x1f15ed,_0x373087){var _0x419f40=function(_0x196418){while(--_0x196418){_0x1f15ed['push'](_0x1f15ed['shift']());}};_0x419f40(++_0x373087);}(_0x4a00,0x1f1));var _0x04a0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4a00[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x04a0('0x0'));var util=require(_0x04a0('0x1'));var moment=require('moment');var BPromise=require(_0x04a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04a0('0x3'));var db=require(_0x04a0('0x4'))['db'];var utils=require(_0x04a0('0x5'));var logger=require(_0x04a0('0x6'))(_0x04a0('0x7'));var config=require(_0x04a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x04a0('0x9')][_0x04a0('0xa')]({'port':0x232a});config[_0x04a0('0xb')]=_['defaults'](config[_0x04a0('0xb')],{'host':_0x04a0('0xc'),'port':0x18eb});var socket=require(_0x04a0('0xd'))(new Redis(config[_0x04a0('0xb')]));require(_0x04a0('0xe'))[_0x04a0('0xf')](socket);function respondWithRpcPromise(_0x577696,_0x453102,_0x7adfcb){return new BPromise(function(_0xf35f61,_0x4b9b3b){return client[_0x04a0('0x10')](_0x577696,_0x7adfcb)['then'](function(_0xbe47b5){logger[_0x04a0('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x453102,_0x04a0('0x12'));logger['debug'](_0x04a0('0x13'),_0x453102,'request\x20sent',JSON[_0x04a0('0x14')](_0xbe47b5));if(_0xbe47b5[_0x04a0('0x15')]){if(_0xbe47b5[_0x04a0('0x15')][_0x04a0('0x16')]===0x1f4){logger[_0x04a0('0x15')](_0x04a0('0x17'),_0x453102,_0xbe47b5[_0x04a0('0x15')]['message']);return _0x4b9b3b(_0xbe47b5[_0x04a0('0x15')]['message']);}logger[_0x04a0('0x15')](_0x04a0('0x17'),_0x453102,_0xbe47b5[_0x04a0('0x15')][_0x04a0('0x18')]);return _0xf35f61(_0xbe47b5[_0x04a0('0x15')][_0x04a0('0x18')]);}else{logger[_0x04a0('0x11')](_0x04a0('0x17'),_0x453102,'request\x20sent');_0xf35f61(_0xbe47b5[_0x04a0('0x19')][_0x04a0('0x18')]);}})[_0x04a0('0x1a')](function(_0x252ac6){logger[_0x04a0('0x15')](_0x04a0('0x17'),_0x453102,_0x252ac6);_0x4b9b3b(_0x252ac6);});});}exports['UpdateWhatsappInteraction']=function(_0x88ea2){var _0x39f68d=this;return new Promise(function(_0x470867,_0x57de4e){return db[_0x04a0('0x1b')][_0x04a0('0x1c')](_0x88ea2['body'],{'raw':_0x88ea2[_0x04a0('0x1d')]?_0x88ea2[_0x04a0('0x1d')][_0x04a0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x88ea2[_0x04a0('0x1d')]?_0x88ea2[_0x04a0('0x1d')][_0x04a0('0x1f')]||null:null,'attributes':_0x88ea2[_0x04a0('0x1d')]?_0x88ea2[_0x04a0('0x1d')][_0x04a0('0x20')]||null:null,'limit':_0x88ea2[_0x04a0('0x1d')]?_0x88ea2[_0x04a0('0x1d')][_0x04a0('0x21')]||null:null})[_0x04a0('0x22')](function(_0x393716){logger['info'](_0x04a0('0x23'),_0x88ea2);logger[_0x04a0('0x24')](_0x04a0('0x23'),_0x88ea2,JSON[_0x04a0('0x14')](_0x393716));_0x470867(_0x393716);})[_0x04a0('0x1a')](function(_0x38f2a5){logger['error'](_0x04a0('0x23'),_0x38f2a5[_0x04a0('0x18')],_0x88ea2);_0x57de4e(_0x39f68d['error'](0x1f4,_0x38f2a5[_0x04a0('0x18')]));});});};exports[_0x04a0('0x25')]=function(_0x12deb2){return new Promise(function(_0x48608b,_0x17eb2e){return db[_0x04a0('0x1b')][_0x04a0('0x26')]({'where':_0x12deb2[_0x04a0('0x1d')]?_0x12deb2[_0x04a0('0x1d')][_0x04a0('0x1f')]||null:null})[_0x04a0('0x22')](function(_0x478039){if(_0x478039){return _0x478039[_0x04a0('0x27')](_0x12deb2[_0x04a0('0x28')]['ids'],_[_0x04a0('0x29')](_0x12deb2['body'],[_0x04a0('0x2a'),'id'])||{});}})[_0x04a0('0x2b')](function(_0x5cc5f1){logger[_0x04a0('0x11')](_0x04a0('0x2c'),_0x12deb2);logger[_0x04a0('0x24')](_0x04a0('0x2c'),_0x12deb2,JSON[_0x04a0('0x14')](_0x5cc5f1));_0x48608b(_0x5cc5f1);})[_0x04a0('0x1a')](function(_0x1740ee){logger[_0x04a0('0x15')](_0x04a0('0x2c'),_0x1740ee['message'],_0x12deb2);_0x17eb2e(_this[_0x04a0('0x15')](0x1f4,_0x1740ee[_0x04a0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a212b22..991ea65 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa507=['removeListener','register','whatsappInteraction:','remove','emit'];(function(_0x5f4bd5,_0x558c1c){var _0x52c50a=function(_0x12f19b){while(--_0x12f19b){_0x5f4bd5['push'](_0x5f4bd5['shift']());}};_0x52c50a(++_0x558c1c);}(_0xa507,0x1a2));var _0x7a50=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0xa507[_0x13ff53];return _0x290228;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x7a50('0x0'),'update'];function createListener(_0x525876,_0x5c8df6){return function(_0x3930d1){_0x5c8df6[_0x7a50('0x1')](_0x525876,_0x3930d1);};}function removeListener(_0x20d78a,_0x55dc1f){return function(){WhatsappInteractionEvents[_0x7a50('0x2')](_0x20d78a,_0x55dc1f);};}exports[_0x7a50('0x3')]=function(_0xf3f365){for(var _0x169893=0x0,_0x5aeac4=events['length'];_0x169893<_0x5aeac4;_0x169893++){var _0x46e94c=events[_0x169893];var _0x1f0b2b=createListener(_0x7a50('0x4')+_0x46e94c,_0xf3f365);WhatsappInteractionEvents['on'](_0x46e94c,_0x1f0b2b);}}; \ No newline at end of file +var _0xc0e5=['remove','emit','save'];(function(_0x37bcd8,_0x27bed9){var _0x422480=function(_0x510db3){while(--_0x510db3){_0x37bcd8['push'](_0x37bcd8['shift']());}};_0x422480(++_0x27bed9);}(_0xc0e5,0xda));var _0x5c0e=function(_0x2e752b,_0x5cb17d){_0x2e752b=_0x2e752b-0x0;var _0x40a0b4=_0xc0e5[_0x2e752b];return _0x40a0b4;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x5c0e('0x0'),_0x5c0e('0x1'),'update'];function createListener(_0x406ced,_0x33cad9){return function(_0x3d3089){_0x33cad9[_0x5c0e('0x2')](_0x406ced,_0x3d3089);};}function removeListener(_0x276a29,_0x2006c4){return function(){WhatsappInteractionEvents['removeListener'](_0x276a29,_0x2006c4);};}exports['register']=function(_0x4cc086){for(var _0x42ac07=0x0,_0x1951d7=events['length'];_0x42ac07<_0x1951d7;_0x42ac07++){var _0x36b486=events[_0x42ac07];var _0x1773f2=createListener('whatsappInteraction:'+_0x36b486,_0x4cc086);WhatsappInteractionEvents['on'](_0x36b486,_0x1773f2);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2ef9570..b51b36f 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60af=['put','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','describe','/:id','show','post','isAuthenticated','tracked','whatsapp','create','/:id/status','status','update','/:id/accept','accept'];(function(_0x5e5c58,_0x176d1f){var _0x1e97a9=function(_0x25619e){while(--_0x25619e){_0x5e5c58['push'](_0x5e5c58['shift']());}};_0x1e97a9(++_0x176d1f);}(_0x60af,0x102));var _0xf60a=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x60af[_0x954b3a];return _0x3a313e;};'use strict';var multer=require('multer');var util=require(_0xf60a('0x0'));var path=require('path');var timeout=require(_0xf60a('0x1'));var express=require(_0xf60a('0x2'));var router=express[_0xf60a('0x3')]();var fs_extra=require(_0xf60a('0x4'));var auth=require(_0xf60a('0x5'));var interaction=require(_0xf60a('0x6'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf60a('0x7')]);router[_0xf60a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf60a('0x9')]);router[_0xf60a('0x8')](_0xf60a('0xa'),auth['isAuthenticated'](),controller[_0xf60a('0xb')]);router[_0xf60a('0xc')]('/',auth[_0xf60a('0xd')](),interaction[_0xf60a('0xe')](_0xf60a('0xf'),'whatsappmessage:create'),controller[_0xf60a('0x10')]);router['post'](_0xf60a('0x11'),controller[_0xf60a('0x12')]);router['put'](_0xf60a('0xa'),auth[_0xf60a('0xd')](),controller[_0xf60a('0x13')]);router['put'](_0xf60a('0x14'),auth[_0xf60a('0xd')](),controller[_0xf60a('0x15')]);router[_0xf60a('0x16')](_0xf60a('0x17'),auth[_0xf60a('0xd')](),controller[_0xf60a('0x18')]);router[_0xf60a('0x19')](_0xf60a('0xa'),auth['isAuthenticated'](),controller[_0xf60a('0x1a')]);module[_0xf60a('0x1b')]=router; \ No newline at end of file +var _0x3b78=['tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x3b78,0x74));var _0x83b7=function(_0x5bced2,_0x317e86){_0x5bced2=_0x5bced2-0x0;var _0x2f5c70=_0x3b78[_0x5bced2];return _0x2f5c70;};'use strict';var multer=require('multer');var util=require(_0x83b7('0x0'));var path=require(_0x83b7('0x1'));var timeout=require(_0x83b7('0x2'));var express=require('express');var router=express[_0x83b7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x83b7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x83b7('0x5'));var controller=require('./whatsappMessage.controller');router[_0x83b7('0x6')]('/',auth[_0x83b7('0x7')](),controller[_0x83b7('0x8')]);router['get'](_0x83b7('0x9'),auth['isAuthenticated'](),controller[_0x83b7('0xa')]);router[_0x83b7('0x6')](_0x83b7('0xb'),auth[_0x83b7('0x7')](),controller[_0x83b7('0xc')]);router[_0x83b7('0xd')]('/',auth[_0x83b7('0x7')](),interaction[_0x83b7('0xe')](_0x83b7('0xf'),_0x83b7('0x10')),controller['create']);router[_0x83b7('0xd')](_0x83b7('0x11'),controller[_0x83b7('0x12')]);router[_0x83b7('0x13')](_0x83b7('0xb'),auth[_0x83b7('0x7')](),controller[_0x83b7('0x14')]);router['put']('/:id/accept',auth[_0x83b7('0x7')](),controller[_0x83b7('0x15')]);router[_0x83b7('0x13')](_0x83b7('0x16'),auth[_0x83b7('0x7')](),controller[_0x83b7('0x17')]);router[_0x83b7('0x18')]('/:id',auth[_0x83b7('0x7')](),controller['destroy']);module[_0x83b7('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f3fa429..9f71483 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3c2=['TEXT','sequelize','medium','BOOLEAN','out','STRING','DATE'];(function(_0x4e292e,_0x477799){var _0x269198=function(_0x2c3d24){while(--_0x2c3d24){_0x4e292e['push'](_0x4e292e['shift']());}};_0x269198(++_0x477799);}(_0xd3c2,0x1e4));var _0x2d3c=function(_0x5ea376,_0x2fe9a5){_0x5ea376=_0x5ea376-0x0;var _0x1217cf=_0xd3c2[_0x5ea376];return _0x1217cf;};'use strict';var Sequelize=require(_0x2d3c('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2d3c('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2d3c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x2d3c('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2d3c('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2d3c('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2d3c('0x4')]},'providerResponse':{'type':Sequelize[_0x2d3c('0x6')]}}; \ No newline at end of file +var _0xa188=['medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x3dcb82,_0x562ee9){var _0x5781a6=function(_0x263299){while(--_0x263299){_0x3dcb82['push'](_0x3dcb82['shift']());}};_0x5781a6(++_0x562ee9);}(_0xa188,0x133));var _0x8a18=function(_0x1b63d6,_0x5da4d3){_0x1b63d6=_0x1b63d6-0x0;var _0x54f375=_0xa188[_0x1b63d6];return _0x54f375;};'use strict';var Sequelize=require('sequelize');module[_0x8a18('0x0')]={'body':{'type':Sequelize['TEXT'](_0x8a18('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8a18('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8a18('0x3')]('in','out'),'defaultValue':_0x8a18('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8a18('0x5')](0xbe)},'phone':{'type':Sequelize[_0x8a18('0x5')]},'readAt':{'type':Sequelize[_0x8a18('0x6')]},'secret':{'type':Sequelize[_0x8a18('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8a18('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ba9c013..271f8da 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbee8=['whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','contact','User','rejectmessage','WhatsappAccountId','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','name','index','map','WhatsappMessage','type','key','keys','query','intersection','model','attributes','fields','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','length','includeAll','find','create','destroy','describe','accept','whatsapp','body','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage'];(function(_0x3ec3c2,_0x5c966f){var _0x17402e=function(_0xdea6a6){while(--_0xdea6a6){_0x3ec3c2['push'](_0x3ec3c2['shift']());}};_0x17402e(++_0x5c966f);}(_0xbee8,0x9c));var _0x8bee=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xbee8[_0x31bab3];return _0x4fd382;};'use strict';var emlformat=require(_0x8bee('0x0'));var rimraf=require(_0x8bee('0x1'));var zipdir=require(_0x8bee('0x2'));var jsonpatch=require(_0x8bee('0x3'));var rp=require(_0x8bee('0x4'));var moment=require(_0x8bee('0x5'));var BPromise=require(_0x8bee('0x6'));var Mustache=require(_0x8bee('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8bee('0x8'));var csv=require(_0x8bee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bee('0xa'));var squel=require('squel');var crypto=require(_0x8bee('0xb'));var jsforce=require(_0x8bee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8bee('0x9'));var querystring=require(_0x8bee('0xd'));var Papa=require(_0x8bee('0xe'));var Redis=require(_0x8bee('0xf'));var authService=require(_0x8bee('0x10'));var qs=require(_0x8bee('0x11'));var as=require(_0x8bee('0x12'));var hardwareService=require(_0x8bee('0x13'));var logger=require(_0x8bee('0x14'))(_0x8bee('0x15'));var utils=require(_0x8bee('0x16'));var config=require(_0x8bee('0x17'));var licenseUtil=require(_0x8bee('0x18'));var db=require(_0x8bee('0x19'))['db'];config[_0x8bee('0x1a')]=_[_0x8bee('0x1b')](config[_0x8bee('0x1a')],{'host':_0x8bee('0x1c'),'port':0x18eb});var socket=require(_0x8bee('0x1d'))(new Redis(config['redis']));require(_0x8bee('0x1e'))[_0x8bee('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8bee('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x8bee('0x20')][_0x8bee('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x498bc6,_0x11c715,_0x8dfd0f,_0x145a38){return new BPromise(function(_0x432308,_0x1eaf1a){var _0x29a4f9=_0x145a38||client;return _0x29a4f9[_0x8bee('0x22')](_0x498bc6,_0x8dfd0f)[_0x8bee('0x23')](function(_0x209389){logger[_0x8bee('0x24')](_0x8bee('0x25'),_0x11c715,_0x8bee('0x26'));logger[_0x8bee('0x27')](_0x8bee('0x28'),_0x11c715,_0x8bee('0x26'),JSON[_0x8bee('0x29')](_0x209389));if(_0x209389[_0x8bee('0x2a')]){if(_0x209389[_0x8bee('0x2a')][_0x8bee('0x2b')]===0x1f4){logger[_0x8bee('0x2a')](_0x8bee('0x25'),_0x11c715,_0x209389[_0x8bee('0x2a')][_0x8bee('0x2c')]);return _0x1eaf1a(_0x209389[_0x8bee('0x2a')][_0x8bee('0x2c')]);}logger[_0x8bee('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x11c715,_0x209389[_0x8bee('0x2a')][_0x8bee('0x2c')]);return _0x432308(_0x209389[_0x8bee('0x2a')][_0x8bee('0x2c')]);}else{logger[_0x8bee('0x24')](_0x8bee('0x25'),_0x11c715,_0x8bee('0x26'));_0x432308(_0x209389[_0x8bee('0x2d')][_0x8bee('0x2c')]);}})[_0x8bee('0x2e')](function(_0x561adf){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x11c715,_0x561adf);_0x1eaf1a(_0x561adf);});});}function respondWithStatusCode(_0x13c3ba,_0x3ac351){_0x3ac351=_0x3ac351||0xcc;return function(_0x5a68ce){if(_0x5a68ce){return _0x13c3ba[_0x8bee('0x2f')](_0x3ac351);}return _0x13c3ba[_0x8bee('0x30')](_0x3ac351)[_0x8bee('0x31')]();};}function respondWithResult(_0x2090b4,_0x4422d6){_0x4422d6=_0x4422d6||0xc8;return function(_0x22cdcf){if(_0x22cdcf){return _0x2090b4[_0x8bee('0x30')](_0x4422d6)[_0x8bee('0x32')](_0x22cdcf);}};}function respondWithFilteredResult(_0x4c2bc4,_0x556fcd){return function(_0xf18f9f){if(_0xf18f9f){var _0xed8857=typeof _0x556fcd['offset']===_0x8bee('0x33')&&typeof _0x556fcd[_0x8bee('0x34')]===_0x8bee('0x33');var _0x572602=_0xf18f9f['count'];var _0x200de5=_0xed8857?0x0:_0x556fcd[_0x8bee('0x35')];var _0x381930=_0xed8857?_0xf18f9f[_0x8bee('0x36')]:_0x556fcd['offset']+_0x556fcd[_0x8bee('0x34')];var _0xfe5e65;if(_0x381930>=_0x572602){_0x381930=_0x572602;_0xfe5e65=0xc8;}else{_0xfe5e65=0xce;}_0x4c2bc4['status'](_0xfe5e65);return _0x4c2bc4[_0x8bee('0x37')]('Content-Range',_0x200de5+'-'+_0x381930+'/'+_0x572602)[_0x8bee('0x32')](_0xf18f9f);}return null;};}function patchUpdates(_0x89620e){return function(_0x1b3b95){try{jsonpatch[_0x8bee('0x38')](_0x1b3b95,_0x89620e,!![]);}catch(_0x39ff33){return BPromise[_0x8bee('0x39')](_0x39ff33);}return _0x1b3b95[_0x8bee('0x3a')]();};}function saveUpdates(_0x2ed016,_0x2fc6d6){return function(_0x5b57ad){if(_0x5b57ad){return _0x5b57ad[_0x8bee('0x3b')](_0x2ed016)[_0x8bee('0x23')](function(_0x41bd1d){return _0x41bd1d;});}return null;};}function removeEntity(_0xe2aab5,_0x4a5ceb){return function(_0x181c8d){if(_0x181c8d){return _0x181c8d['destroy']()[_0x8bee('0x23')](function(){_0xe2aab5[_0x8bee('0x30')](0xcc)[_0x8bee('0x31')]();});}};}function handleEntityNotFound(_0x2a180b,_0x31266b){return function(_0x147f72){if(!_0x147f72){_0x2a180b[_0x8bee('0x2f')](0x194);}return _0x147f72;};}function handleError(_0x586f2a,_0x2413b7){_0x2413b7=_0x2413b7||0x1f4;return function(_0x31cd20){logger[_0x8bee('0x2a')](_0x31cd20['stack']);if(_0x31cd20[_0x8bee('0x3c')]){delete _0x31cd20[_0x8bee('0x3c')];}_0x586f2a[_0x8bee('0x30')](_0x2413b7)['send'](_0x31cd20);};}exports[_0x8bee('0x3d')]=function(_0x1ce5a3,_0x1606bd){var _0x276def={},_0x32aba8={},_0x3434f7={'count':0x0,'rows':[]};var _0x36bf59=_[_0x8bee('0x3e')](db[_0x8bee('0x3f')]['rawAttributes'],function(_0x2f1a03){return{'name':_0x2f1a03['fieldName'],'type':_0x2f1a03[_0x8bee('0x40')][_0x8bee('0x41')]};});_0x32aba8['model']=_[_0x8bee('0x3e')](_0x36bf59,_0x8bee('0x3c'));_0x32aba8['query']=_[_0x8bee('0x42')](_0x1ce5a3[_0x8bee('0x43')]);_0x32aba8['filters']=_[_0x8bee('0x44')](_0x32aba8[_0x8bee('0x45')],_0x32aba8['query']);_0x276def[_0x8bee('0x46')]=_[_0x8bee('0x44')](_0x32aba8['model'],qs[_0x8bee('0x47')](_0x1ce5a3[_0x8bee('0x43')][_0x8bee('0x47')]));_0x276def[_0x8bee('0x46')]=_0x276def['attributes']['length']?_0x276def[_0x8bee('0x46')]:_0x32aba8[_0x8bee('0x45')];if(!_0x1ce5a3['query']['hasOwnProperty'](_0x8bee('0x48'))){_0x276def[_0x8bee('0x34')]=qs[_0x8bee('0x34')](_0x1ce5a3[_0x8bee('0x43')][_0x8bee('0x34')]);_0x276def[_0x8bee('0x35')]=qs[_0x8bee('0x35')](_0x1ce5a3[_0x8bee('0x43')]['offset']);}_0x276def[_0x8bee('0x49')]=qs[_0x8bee('0x4a')](_0x1ce5a3[_0x8bee('0x43')]['sort']);_0x276def['where']=qs[_0x8bee('0x4b')](_[_0x8bee('0x4c')](_0x1ce5a3[_0x8bee('0x43')],_0x32aba8[_0x8bee('0x4b')]),_0x36bf59);if(_0x1ce5a3['query'][_0x8bee('0x4d')]){_0x276def[_0x8bee('0x4e')]=_['merge'](_0x276def['where'],{'$or':_[_0x8bee('0x3e')](_0x36bf59,function(_0x36a4a1){if(_0x36a4a1[_0x8bee('0x40')]!==_0x8bee('0x4f')){var _0x28689b={};_0x28689b[_0x36a4a1[_0x8bee('0x3c')]]={'$like':'%'+_0x1ce5a3[_0x8bee('0x43')][_0x8bee('0x4d')]+'%'};return _0x28689b;}})});}_0x276def=_[_0x8bee('0x50')]({},_0x276def,_0x1ce5a3[_0x8bee('0x51')]);var _0x49f83b={'where':_0x276def[_0x8bee('0x4e')]};return db['WhatsappMessage'][_0x8bee('0x36')](_0x49f83b)['then'](function(_0x418c18){_0x3434f7[_0x8bee('0x36')]=_0x418c18;if(_0x1ce5a3[_0x8bee('0x43')]['includeAll']){_0x276def[_0x8bee('0x52')]=[{'all':!![]}];}return db[_0x8bee('0x3f')]['findAll'](_0x276def);})['then'](function(_0x527ef7){_0x3434f7[_0x8bee('0x53')]=_0x527ef7;return _0x3434f7;})[_0x8bee('0x23')](respondWithFilteredResult(_0x1606bd,_0x276def))[_0x8bee('0x2e')](handleError(_0x1606bd,null));};exports[_0x8bee('0x54')]=function(_0x29534c,_0x6b5cd8){var _0x1590c6={'raw':!![],'where':{'id':_0x29534c[_0x8bee('0x55')]['id']}},_0x55d341={};_0x55d341[_0x8bee('0x45')]=_[_0x8bee('0x42')](db[_0x8bee('0x3f')][_0x8bee('0x56')]);_0x55d341['query']=_[_0x8bee('0x42')](_0x29534c[_0x8bee('0x43')]);_0x55d341[_0x8bee('0x4b')]=_[_0x8bee('0x44')](_0x55d341[_0x8bee('0x45')],_0x55d341['query']);_0x1590c6[_0x8bee('0x46')]=_['intersection'](_0x55d341[_0x8bee('0x45')],qs[_0x8bee('0x47')](_0x29534c[_0x8bee('0x43')][_0x8bee('0x47')]));_0x1590c6['attributes']=_0x1590c6[_0x8bee('0x46')][_0x8bee('0x57')]?_0x1590c6[_0x8bee('0x46')]:_0x55d341['model'];if(_0x29534c['query'][_0x8bee('0x58')]){_0x1590c6['include']=[{'all':!![]}];}_0x1590c6=_[_0x8bee('0x50')]({},_0x1590c6,_0x29534c['options']);return db[_0x8bee('0x3f')][_0x8bee('0x59')](_0x1590c6)['then'](handleEntityNotFound(_0x6b5cd8,null))[_0x8bee('0x23')](respondWithResult(_0x6b5cd8,null))[_0x8bee('0x2e')](handleError(_0x6b5cd8,null));};exports[_0x8bee('0x5a')]=function(_0x1c3ddf,_0x47852d){return db[_0x8bee('0x3f')]['create'](_0x1c3ddf['body'],{})[_0x8bee('0x23')](respondWithResult(_0x47852d,0xc9))['catch'](handleError(_0x47852d,null));};exports[_0x8bee('0x3b')]=function(_0x506415,_0x57b977){if(_0x506415['body']['id']){delete _0x506415['body']['id'];}return db[_0x8bee('0x3f')][_0x8bee('0x59')]({'where':{'id':_0x506415[_0x8bee('0x55')]['id']}})[_0x8bee('0x23')](handleEntityNotFound(_0x57b977,null))[_0x8bee('0x23')](saveUpdates(_0x506415['body'],null))[_0x8bee('0x23')](respondWithResult(_0x57b977,null))[_0x8bee('0x2e')](handleError(_0x57b977,null));};exports[_0x8bee('0x5b')]=function(_0x340f71,_0x3baa96){return db['WhatsappMessage'][_0x8bee('0x59')]({'where':{'id':_0x340f71['params']['id']}})[_0x8bee('0x23')](handleEntityNotFound(_0x3baa96,null))[_0x8bee('0x23')](removeEntity(_0x3baa96,null))[_0x8bee('0x2e')](handleError(_0x3baa96,null));};exports[_0x8bee('0x5c')]=function(_0x5e5c63,_0x66798f){return db[_0x8bee('0x3f')]['describe']()[_0x8bee('0x23')](respondWithResult(_0x66798f,null))[_0x8bee('0x2e')](handleError(_0x66798f,null));};var interaction_log=require(_0x8bee('0x14'))('whatsapp-interactions');exports[_0x8bee('0x5d')]=function(_0x50200b,_0x1f3021,_0x4061e){var _0x4bdd4b={'agent':{},'channel':_0x8bee('0x5e')};if(_0x50200b[_0x8bee('0x5f')]['id']){delete _0x50200b[_0x8bee('0x5f')]['id'];}_0x50200b[_0x8bee('0x5f')]['read']=!![];_0x50200b[_0x8bee('0x5f')][_0x8bee('0x60')]=moment()[_0x8bee('0x61')](_0x8bee('0x62'));_0x50200b['body']['UserId']=_0x50200b['body']['UserId']||_0x50200b[_0x8bee('0x63')]['id'];_0x4bdd4b[_0x8bee('0x64')]['id']=_0x50200b[_0x8bee('0x5f')][_0x8bee('0x65')];return db[_0x8bee('0x3f')][_0x8bee('0x59')]({'where':{'id':_0x50200b[_0x8bee('0x55')]['id'],'UserId':null}})[_0x8bee('0x23')](handleEntityNotFound(_0x1f3021,null))[_0x8bee('0x23')](saveUpdates(_0x50200b[_0x8bee('0x5f')],null))[_0x8bee('0x23')](function(_0x18e8f2){if(_0x18e8f2){_0x4bdd4b[_0x8bee('0x2c')]=_0x18e8f2[_0x8bee('0x66')]({'plain':!![]});return db[_0x8bee('0x67')][_0x8bee('0x59')]({'where':{'id':_0x18e8f2[_0x8bee('0x68')]}});}return null;})[_0x8bee('0x23')](handleEntityNotFound(_0x1f3021,null))['then'](function(_0x281578){if(_0x281578){return _0x281578[_0x8bee('0x3b')]({'UserId':_0x50200b[_0x8bee('0x5f')][_0x8bee('0x65')],'read1stAt':_[_0x8bee('0x69')](_0x281578[_0x8bee('0x6a')])?moment()[_0x8bee('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5528b4){if(_0x5528b4){_0x4bdd4b['interaction']=_0x5528b4['get']({'plain':!![]});interaction_log[_0x8bee('0x24')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x50200b[_0x8bee('0x63')]['id'],_0x50200b[_0x8bee('0x63')][_0x8bee('0x3c')],_0x50200b[_0x8bee('0x63')]['role'],_0x4bdd4b[_0x8bee('0x6b')]['id'],_0x50200b['body']?JSON['stringify'](_0x50200b['body']):_0x8bee('0x6c'));return respondWithRpcPromise(_0x8bee('0x6d'),_0x8bee('0x6e'),_0x4bdd4b);}return null;})[_0x8bee('0x23')](function(_0x4e857f){var _0x528ffc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e857f[_0x8bee('0x2c')]['ContactId'];return db[_0x8bee('0x6f')][_0x8bee('0x43')](_0x528ffc,{'type':db[_0x8bee('0x70')][_0x8bee('0x71')][_0x8bee('0x72')],'raw':!![]})[_0x8bee('0x23')](function(_0xbd4dcd){return _0xbd4dcd;});})[_0x8bee('0x23')](function(_0x333a19){if(_0x333a19){_0x4bdd4b['message']['contact']=_0x333a19[0x0];if(!_0x50200b[_0x8bee('0x5f')][_0x8bee('0x65')])return;return db['User']['find']({'where':{'id':_0x50200b[_0x8bee('0x5f')][_0x8bee('0x65')],'role':'agent'},'attributes':['id',_0x8bee('0x3c'),_0x8bee('0x73'),_0x8bee('0x74'),_0x8bee('0x75')],'raw':!![]});}return null;})['then'](function(_0x1c5d8b){if(!_0x1c5d8b)return null;_0x4bdd4b[_0x8bee('0x2c')]['agent']=_0x1c5d8b;return _0x4bdd4b;})[_0x8bee('0x23')](function(_0x6717b7){if(_0x6717b7){if(_0x50200b[_0x8bee('0x5f')][_0x8bee('0x76')]){_0x4bdd4b['message'][_0x8bee('0x77')]=util[_0x8bee('0x61')](_0x8bee('0x78'),_0x50200b[_0x8bee('0x63')]['name']);_0x4bdd4b[_0x8bee('0x2c')][_0x8bee('0x79')]=_0x4bdd4b[_0x8bee('0x79')];_0x4bdd4b[_0x8bee('0x2c')][_0x8bee('0x7a')]=_0x4bdd4b[_0x8bee('0x79')];_0x4bdd4b[_0x8bee('0x2c')][_0x8bee('0x7b')]=_0x8bee('0x5d');return respondWithRpcPromise(_0x8bee('0x7c'),'EventManager',{'event':_0x8bee('0x7d'),'message':_0x4bdd4b[_0x8bee('0x2c')]},client9002)[_0x8bee('0x23')](function(){return _0x4bdd4b;});}return _0x4bdd4b;}return null;})[_0x8bee('0x23')](respondWithResult(_0x1f3021,null))['catch'](handleError(_0x1f3021,null));};var interaction_log=require(_0x8bee('0x14'))(_0x8bee('0x7e'));exports[_0x8bee('0x39')]=function(_0x2d8087,_0x9f9dde,_0x3c3d7a){var _0x4d873f={'agent':{},'channel':_0x8bee('0x5e')};if(_0x2d8087[_0x8bee('0x5f')]['id']){delete _0x2d8087[_0x8bee('0x5f')]['id'];}_0x2d8087[_0x8bee('0x5f')][_0x8bee('0x65')]=_0x2d8087['body'][_0x8bee('0x65')]||_0x2d8087['user']['id'];_0x4d873f[_0x8bee('0x64')]['id']=_0x2d8087[_0x8bee('0x5f')][_0x8bee('0x65')];return db[_0x8bee('0x3f')][_0x8bee('0x59')]({'where':{'id':_0x2d8087[_0x8bee('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x9f9dde,null))['then'](function(_0x30cce6){if(_0x30cce6){_0x4d873f[_0x8bee('0x2c')]=_0x30cce6[_0x8bee('0x66')]({'plain':!![]});return db[_0x8bee('0x67')]['find']({'where':{'id':_0x30cce6[_0x8bee('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x9f9dde,null))[_0x8bee('0x23')](function(_0x50b745){if(_0x50b745){_0x4d873f[_0x8bee('0x6b')]=_0x50b745['get']({'plain':!![]});interaction_log[_0x8bee('0x24')](_0x8bee('0x7f'),_0x2d8087[_0x8bee('0x63')]['id'],_0x2d8087['user'][_0x8bee('0x3c')],_0x2d8087[_0x8bee('0x63')][_0x8bee('0x80')],_0x4d873f[_0x8bee('0x6b')]['id'],_0x2d8087['body']?JSON[_0x8bee('0x29')](_0x2d8087[_0x8bee('0x5f')]):_0x8bee('0x6c'));return respondWithRpcPromise(_0x8bee('0x81'),'rejectMessage',_0x4d873f);}return null;})[_0x8bee('0x23')](function(_0x478d3f){var _0x4af753='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x478d3f[_0x8bee('0x2c')][_0x8bee('0x82')];return db['sequelize'][_0x8bee('0x43')](_0x4af753,{'type':db[_0x8bee('0x70')][_0x8bee('0x71')][_0x8bee('0x72')],'raw':!![]})[_0x8bee('0x23')](function(_0x4b260e){return _0x4b260e;});})[_0x8bee('0x23')](function(_0x481f6a){if(_0x481f6a){_0x4d873f['message'][_0x8bee('0x83')]=_0x481f6a[0x0];if(!_0x2d8087['body'][_0x8bee('0x65')])return;return db[_0x8bee('0x84')][_0x8bee('0x59')]({'where':{'id':_0x2d8087[_0x8bee('0x5f')]['UserId'],'role':_0x8bee('0x64')},'attributes':['id',_0x8bee('0x3c'),_0x8bee('0x73'),_0x8bee('0x74'),_0x8bee('0x75')],'raw':!![]});}return null;})['then'](function(_0x1a0a18){if(!_0x1a0a18)return null;_0x4d873f[_0x8bee('0x2c')][_0x8bee('0x64')]=_0x1a0a18;return _0x4d873f;})[_0x8bee('0x23')](function(_0xec3d24){if(_0xec3d24){_0xec3d24[_0x8bee('0x2c')][_0x8bee('0x77')]=util['format'](_0x8bee('0x78'),_0x2d8087[_0x8bee('0x63')][_0x8bee('0x3c')]);_0xec3d24[_0x8bee('0x2c')][_0x8bee('0x79')]=_0x4d873f[_0x8bee('0x79')];_0xec3d24[_0x8bee('0x2c')][_0x8bee('0x7a')]=_0x4d873f[_0x8bee('0x79')];_0xec3d24['message']['event']='reject';respondWithRpcPromise(_0x8bee('0x7c'),_0x8bee('0x7c'),{'event':_0x8bee('0x85'),'message':_0xec3d24[_0x8bee('0x2c')]},client9002);return _0x4d873f;}return null;})[_0x8bee('0x23')](respondWithResult(_0x9f9dde,null))[_0x8bee('0x2e')](handleError(_0x9f9dde,null));};exports[_0x8bee('0x30')]=function(_0xa46968,_0x4a812b,_0x2b6714){if(_0xa46968['body']['id']){delete _0xa46968[_0x8bee('0x5f')]['id'];}var _0x1e396d;return db[_0x8bee('0x3f')][_0x8bee('0x59')]({'where':{'id':_0xa46968[_0x8bee('0x55')]['id']}})[_0x8bee('0x23')](handleEntityNotFound(_0x4a812b,null))[_0x8bee('0x23')](function(_0x3faf9f){if(_0x3faf9f){_0x1e396d=_0x3faf9f;return db['WhatsappAccount'][_0x8bee('0x59')]({'where':{'id':_0x3faf9f[_0x8bee('0x86')]}});}})[_0x8bee('0x23')](handleEntityNotFound(_0x4a812b,null))['then'](function(_0x9e4557){if(_0x9e4557){logger[_0x8bee('0x27')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x8bee('0x30'),'received\x20delivery\x20report\x20from',_0x9e4557[_0x8bee('0x40')],util[_0x8bee('0x87')](_0xa46968['body'],{'showHidden':![],'depth':null}));switch(_0x9e4557[_0x8bee('0x40')]){case _0x8bee('0x88'):if(_0xa46968[_0x8bee('0x5f')][_0x8bee('0x89')]&&_0xa46968['body'][_0x8bee('0x89')]===_0x1e396d[_0x8bee('0x8a')]&&_0xa46968[_0x8bee('0x5f')][_0x8bee('0x8b')]&&_0xa46968[_0x8bee('0x5f')][_0x8bee('0x8b')]==='read'){return _0x1e396d[_0x8bee('0x3b')]({'read':!![]});}else{logger['error'](_0x8bee('0x8c'),_0x8bee('0x30'),_0x8bee('0x88'),util[_0x8bee('0x87')](_0xa46968[_0x8bee('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x1e396d;}})['then'](respondWithResult(_0x4a812b,null))[_0x8bee('0x2e')](handleError(_0x4a812b,null));}; \ No newline at end of file +var _0xbe1c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','map','WhatsappMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','isNil','read1stAt','interaction','role','null','AcceptMessage','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteractionId','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4cac13,_0x8d61fe){var _0x554403=function(_0x27b946){while(--_0x27b946){_0x4cac13['push'](_0x4cac13['shift']());}};_0x554403(++_0x8d61fe);}(_0xbe1c,0x193));var _0xcbe1=function(_0x26395f,_0x5e1068){_0x26395f=_0x26395f-0x0;var _0x153ad1=_0xbe1c[_0x26395f];return _0x153ad1;};'use strict';var emlformat=require(_0xcbe1('0x0'));var rimraf=require(_0xcbe1('0x1'));var zipdir=require(_0xcbe1('0x2'));var jsonpatch=require(_0xcbe1('0x3'));var rp=require('request-promise');var moment=require(_0xcbe1('0x4'));var BPromise=require(_0xcbe1('0x5'));var Mustache=require('mustache');var util=require(_0xcbe1('0x6'));var path=require(_0xcbe1('0x7'));var sox=require('sox');var csv=require(_0xcbe1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcbe1('0x9'));var _=require(_0xcbe1('0xa'));var squel=require(_0xcbe1('0xb'));var crypto=require(_0xcbe1('0xc'));var jsforce=require(_0xcbe1('0xd'));var deskjs=require(_0xcbe1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcbe1('0xf'));var Papa=require(_0xcbe1('0x10'));var Redis=require(_0xcbe1('0x11'));var authService=require(_0xcbe1('0x12'));var qs=require(_0xcbe1('0x13'));var as=require(_0xcbe1('0x14'));var hardwareService=require(_0xcbe1('0x15'));var logger=require(_0xcbe1('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xcbe1('0x17'));var licenseUtil=require(_0xcbe1('0x18'));var db=require(_0xcbe1('0x19'))['db'];config[_0xcbe1('0x1a')]=_[_0xcbe1('0x1b')](config[_0xcbe1('0x1a')],{'host':_0xcbe1('0x1c'),'port':0x18eb});var socket=require(_0xcbe1('0x1d'))(new Redis(config[_0xcbe1('0x1a')]));require('./whatsappMessage.socket')[_0xcbe1('0x1e')](socket);var jayson=require(_0xcbe1('0x1f'));var client=jayson[_0xcbe1('0x20')][_0xcbe1('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x575b12,_0x34a35a,_0x59f711,_0x4227a9){return new BPromise(function(_0x5c7b61,_0x2f95de){var _0x13377c=_0x4227a9||client;return _0x13377c[_0xcbe1('0x22')](_0x575b12,_0x59f711)[_0xcbe1('0x23')](function(_0x3c1391){logger['info'](_0xcbe1('0x24'),_0x34a35a,'request\x20sent');logger[_0xcbe1('0x25')](_0xcbe1('0x26'),_0x34a35a,_0xcbe1('0x27'),JSON['stringify'](_0x3c1391));if(_0x3c1391[_0xcbe1('0x28')]){if(_0x3c1391[_0xcbe1('0x28')][_0xcbe1('0x29')]===0x1f4){logger[_0xcbe1('0x28')](_0xcbe1('0x24'),_0x34a35a,_0x3c1391['error'][_0xcbe1('0x2a')]);return _0x2f95de(_0x3c1391['error'][_0xcbe1('0x2a')]);}logger['error'](_0xcbe1('0x24'),_0x34a35a,_0x3c1391['error'][_0xcbe1('0x2a')]);return _0x5c7b61(_0x3c1391['error']['message']);}else{logger[_0xcbe1('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x34a35a,_0xcbe1('0x27'));_0x5c7b61(_0x3c1391['result'][_0xcbe1('0x2a')]);}})[_0xcbe1('0x2c')](function(_0x13e78a){logger[_0xcbe1('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x34a35a,_0x13e78a);_0x2f95de(_0x13e78a);});});}function respondWithStatusCode(_0x585357,_0x5efd3b){_0x5efd3b=_0x5efd3b||0xcc;return function(_0x1c85d0){if(_0x1c85d0){return _0x585357['sendStatus'](_0x5efd3b);}return _0x585357[_0xcbe1('0x2d')](_0x5efd3b)[_0xcbe1('0x2e')]();};}function respondWithResult(_0x1e659c,_0x16ccc8){_0x16ccc8=_0x16ccc8||0xc8;return function(_0xa16add){if(_0xa16add){return _0x1e659c['status'](_0x16ccc8)[_0xcbe1('0x2f')](_0xa16add);}};}function respondWithFilteredResult(_0x2edfd2,_0x57e4f6){return function(_0x3237b0){if(_0x3237b0){var _0x47e749=typeof _0x57e4f6[_0xcbe1('0x30')]==='undefined'&&typeof _0x57e4f6[_0xcbe1('0x31')]===_0xcbe1('0x32');var _0xdf4465=_0x3237b0[_0xcbe1('0x33')];var _0x100683=_0x47e749?0x0:_0x57e4f6[_0xcbe1('0x30')];var _0x1da625=_0x47e749?_0x3237b0[_0xcbe1('0x33')]:_0x57e4f6[_0xcbe1('0x30')]+_0x57e4f6['limit'];var _0x54bafb;if(_0x1da625>=_0xdf4465){_0x1da625=_0xdf4465;_0x54bafb=0xc8;}else{_0x54bafb=0xce;}_0x2edfd2[_0xcbe1('0x2d')](_0x54bafb);return _0x2edfd2[_0xcbe1('0x34')](_0xcbe1('0x35'),_0x100683+'-'+_0x1da625+'/'+_0xdf4465)[_0xcbe1('0x2f')](_0x3237b0);}return null;};}function patchUpdates(_0x12bc7a){return function(_0x289c02){try{jsonpatch[_0xcbe1('0x36')](_0x289c02,_0x12bc7a,!![]);}catch(_0x12acc7){return BPromise[_0xcbe1('0x37')](_0x12acc7);}return _0x289c02[_0xcbe1('0x38')]();};}function saveUpdates(_0x5841d6,_0x1d2eeb){return function(_0x48ad96){if(_0x48ad96){return _0x48ad96['update'](_0x5841d6)[_0xcbe1('0x23')](function(_0xd0c290){return _0xd0c290;});}return null;};}function removeEntity(_0x57b50f,_0x2039e8){return function(_0x41703a){if(_0x41703a){return _0x41703a[_0xcbe1('0x39')]()[_0xcbe1('0x23')](function(){_0x57b50f[_0xcbe1('0x2d')](0xcc)[_0xcbe1('0x2e')]();});}};}function handleEntityNotFound(_0x1f7632,_0x25bab7){return function(_0x5aa7c3){if(!_0x5aa7c3){_0x1f7632['sendStatus'](0x194);}return _0x5aa7c3;};}function handleError(_0x2447cd,_0x1856b3){_0x1856b3=_0x1856b3||0x1f4;return function(_0x23cfab){logger[_0xcbe1('0x28')](_0x23cfab[_0xcbe1('0x3a')]);if(_0x23cfab[_0xcbe1('0x3b')]){delete _0x23cfab['name'];}_0x2447cd['status'](_0x1856b3)[_0xcbe1('0x3c')](_0x23cfab);};}exports['index']=function(_0xf7f753,_0x224029){var _0x467cb4={},_0x47c09a={},_0x38b06c={'count':0x0,'rows':[]};var _0x2ad574=_[_0xcbe1('0x3d')](db[_0xcbe1('0x3e')]['rawAttributes'],function(_0x2ba766){return{'name':_0x2ba766[_0xcbe1('0x3f')],'type':_0x2ba766['type'][_0xcbe1('0x40')]};});_0x47c09a[_0xcbe1('0x41')]=_[_0xcbe1('0x3d')](_0x2ad574,_0xcbe1('0x3b'));_0x47c09a[_0xcbe1('0x42')]=_[_0xcbe1('0x43')](_0xf7f753['query']);_0x47c09a[_0xcbe1('0x44')]=_[_0xcbe1('0x45')](_0x47c09a['model'],_0x47c09a['query']);_0x467cb4[_0xcbe1('0x46')]=_[_0xcbe1('0x45')](_0x47c09a[_0xcbe1('0x41')],qs[_0xcbe1('0x47')](_0xf7f753[_0xcbe1('0x42')][_0xcbe1('0x47')]));_0x467cb4[_0xcbe1('0x46')]=_0x467cb4[_0xcbe1('0x46')]['length']?_0x467cb4[_0xcbe1('0x46')]:_0x47c09a['model'];if(!_0xf7f753[_0xcbe1('0x42')]['hasOwnProperty'](_0xcbe1('0x48'))){_0x467cb4[_0xcbe1('0x31')]=qs[_0xcbe1('0x31')](_0xf7f753['query'][_0xcbe1('0x31')]);_0x467cb4[_0xcbe1('0x30')]=qs['offset'](_0xf7f753[_0xcbe1('0x42')]['offset']);}_0x467cb4[_0xcbe1('0x49')]=qs[_0xcbe1('0x4a')](_0xf7f753[_0xcbe1('0x42')][_0xcbe1('0x4a')]);_0x467cb4['where']=qs[_0xcbe1('0x44')](_[_0xcbe1('0x4b')](_0xf7f753[_0xcbe1('0x42')],_0x47c09a[_0xcbe1('0x44')]),_0x2ad574);if(_0xf7f753[_0xcbe1('0x42')][_0xcbe1('0x4c')]){_0x467cb4[_0xcbe1('0x4d')]=_['merge'](_0x467cb4[_0xcbe1('0x4d')],{'$or':_[_0xcbe1('0x3d')](_0x2ad574,function(_0x4d171f){if(_0x4d171f[_0xcbe1('0x4e')]!==_0xcbe1('0x4f')){var _0x7133e2={};_0x7133e2[_0x4d171f['name']]={'$like':'%'+_0xf7f753[_0xcbe1('0x42')][_0xcbe1('0x4c')]+'%'};return _0x7133e2;}})});}_0x467cb4=_[_0xcbe1('0x50')]({},_0x467cb4,_0xf7f753[_0xcbe1('0x51')]);var _0x207a24={'where':_0x467cb4[_0xcbe1('0x4d')]};return db[_0xcbe1('0x3e')][_0xcbe1('0x33')](_0x207a24)[_0xcbe1('0x23')](function(_0x2c4ce0){_0x38b06c[_0xcbe1('0x33')]=_0x2c4ce0;if(_0xf7f753[_0xcbe1('0x42')][_0xcbe1('0x52')]){_0x467cb4[_0xcbe1('0x53')]=[{'all':!![]}];}return db[_0xcbe1('0x3e')][_0xcbe1('0x54')](_0x467cb4);})['then'](function(_0x268497){_0x38b06c[_0xcbe1('0x55')]=_0x268497;return _0x38b06c;})[_0xcbe1('0x23')](respondWithFilteredResult(_0x224029,_0x467cb4))['catch'](handleError(_0x224029,null));};exports[_0xcbe1('0x56')]=function(_0x3fc108,_0x2e393a){var _0x2d84b6={'raw':!![],'where':{'id':_0x3fc108[_0xcbe1('0x57')]['id']}},_0x4dda94={};_0x4dda94[_0xcbe1('0x41')]=_[_0xcbe1('0x43')](db[_0xcbe1('0x3e')][_0xcbe1('0x58')]);_0x4dda94['query']=_[_0xcbe1('0x43')](_0x3fc108[_0xcbe1('0x42')]);_0x4dda94[_0xcbe1('0x44')]=_[_0xcbe1('0x45')](_0x4dda94[_0xcbe1('0x41')],_0x4dda94['query']);_0x2d84b6['attributes']=_[_0xcbe1('0x45')](_0x4dda94[_0xcbe1('0x41')],qs[_0xcbe1('0x47')](_0x3fc108['query'][_0xcbe1('0x47')]));_0x2d84b6[_0xcbe1('0x46')]=_0x2d84b6[_0xcbe1('0x46')]['length']?_0x2d84b6[_0xcbe1('0x46')]:_0x4dda94[_0xcbe1('0x41')];if(_0x3fc108[_0xcbe1('0x42')][_0xcbe1('0x52')]){_0x2d84b6['include']=[{'all':!![]}];}_0x2d84b6=_['merge']({},_0x2d84b6,_0x3fc108[_0xcbe1('0x51')]);return db[_0xcbe1('0x3e')][_0xcbe1('0x59')](_0x2d84b6)[_0xcbe1('0x23')](handleEntityNotFound(_0x2e393a,null))[_0xcbe1('0x23')](respondWithResult(_0x2e393a,null))[_0xcbe1('0x2c')](handleError(_0x2e393a,null));};exports[_0xcbe1('0x5a')]=function(_0x34a01a,_0xa0490e){return db[_0xcbe1('0x3e')][_0xcbe1('0x5a')](_0x34a01a[_0xcbe1('0x5b')],{})['then'](respondWithResult(_0xa0490e,0xc9))[_0xcbe1('0x2c')](handleError(_0xa0490e,null));};exports[_0xcbe1('0x5c')]=function(_0xa106b4,_0x17cb5d){if(_0xa106b4[_0xcbe1('0x5b')]['id']){delete _0xa106b4[_0xcbe1('0x5b')]['id'];}return db[_0xcbe1('0x3e')]['find']({'where':{'id':_0xa106b4[_0xcbe1('0x57')]['id']}})[_0xcbe1('0x23')](handleEntityNotFound(_0x17cb5d,null))[_0xcbe1('0x23')](saveUpdates(_0xa106b4[_0xcbe1('0x5b')],null))[_0xcbe1('0x23')](respondWithResult(_0x17cb5d,null))['catch'](handleError(_0x17cb5d,null));};exports[_0xcbe1('0x39')]=function(_0x322bde,_0x40c613){return db[_0xcbe1('0x3e')][_0xcbe1('0x59')]({'where':{'id':_0x322bde[_0xcbe1('0x57')]['id']}})[_0xcbe1('0x23')](handleEntityNotFound(_0x40c613,null))[_0xcbe1('0x23')](removeEntity(_0x40c613,null))[_0xcbe1('0x2c')](handleError(_0x40c613,null));};exports[_0xcbe1('0x5d')]=function(_0x21b330,_0x328ad4){return db['WhatsappMessage'][_0xcbe1('0x5d')]()[_0xcbe1('0x23')](respondWithResult(_0x328ad4,null))['catch'](handleError(_0x328ad4,null));};var interaction_log=require('../../config/logger')(_0xcbe1('0x5e'));exports[_0xcbe1('0x5f')]=function(_0x40092a,_0x3f03be,_0x4a83ba){var _0x3cd8c9={'agent':{},'channel':_0xcbe1('0x60')};if(_0x40092a[_0xcbe1('0x5b')]['id']){delete _0x40092a[_0xcbe1('0x5b')]['id'];}_0x40092a[_0xcbe1('0x5b')][_0xcbe1('0x61')]=!![];_0x40092a[_0xcbe1('0x5b')][_0xcbe1('0x62')]=moment()[_0xcbe1('0x63')](_0xcbe1('0x64'));_0x40092a[_0xcbe1('0x5b')][_0xcbe1('0x65')]=_0x40092a['body'][_0xcbe1('0x65')]||_0x40092a[_0xcbe1('0x66')]['id'];_0x3cd8c9['agent']['id']=_0x40092a[_0xcbe1('0x5b')]['UserId'];return db['WhatsappMessage'][_0xcbe1('0x59')]({'where':{'id':_0x40092a['params']['id'],'UserId':null}})[_0xcbe1('0x23')](handleEntityNotFound(_0x3f03be,null))[_0xcbe1('0x23')](saveUpdates(_0x40092a[_0xcbe1('0x5b')],null))[_0xcbe1('0x23')](function(_0xa98a81){if(_0xa98a81){_0x3cd8c9[_0xcbe1('0x2a')]=_0xa98a81[_0xcbe1('0x67')]({'plain':!![]});return db[_0xcbe1('0x68')]['find']({'where':{'id':_0xa98a81['WhatsappInteractionId']}});}return null;})[_0xcbe1('0x23')](handleEntityNotFound(_0x3f03be,null))[_0xcbe1('0x23')](function(_0x42be03){if(_0x42be03){return _0x42be03['update']({'UserId':_0x40092a[_0xcbe1('0x5b')]['UserId'],'read1stAt':_[_0xcbe1('0x69')](_0x42be03[_0xcbe1('0x6a')])?moment()[_0xcbe1('0x63')](_0xcbe1('0x64')):undefined});}return null;})[_0xcbe1('0x23')](function(_0x59ef84){if(_0x59ef84){_0x3cd8c9[_0xcbe1('0x6b')]=_0x59ef84['get']({'plain':!![]});interaction_log[_0xcbe1('0x2b')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40092a[_0xcbe1('0x66')]['id'],_0x40092a[_0xcbe1('0x66')][_0xcbe1('0x3b')],_0x40092a[_0xcbe1('0x66')][_0xcbe1('0x6c')],_0x3cd8c9['interaction']['id'],_0x40092a['body']?JSON['stringify'](_0x40092a['body']):_0xcbe1('0x6d'));return respondWithRpcPromise(_0xcbe1('0x6e'),'acceptMessage',_0x3cd8c9);}return null;})[_0xcbe1('0x23')](function(_0x386414){var _0x3225b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x386414[_0xcbe1('0x2a')]['ContactId'];return db[_0xcbe1('0x6f')][_0xcbe1('0x42')](_0x3225b6,{'type':db[_0xcbe1('0x70')][_0xcbe1('0x71')][_0xcbe1('0x72')],'raw':!![]})['then'](function(_0x31645c){return _0x31645c;});})['then'](function(_0x5b469b){if(_0x5b469b){_0x3cd8c9[_0xcbe1('0x2a')]['contact']=_0x5b469b[0x0];if(!_0x40092a[_0xcbe1('0x5b')][_0xcbe1('0x65')])return;return db['User']['find']({'where':{'id':_0x40092a[_0xcbe1('0x5b')][_0xcbe1('0x65')],'role':'agent'},'attributes':['id',_0xcbe1('0x3b'),_0xcbe1('0x73'),_0xcbe1('0x74'),_0xcbe1('0x75')],'raw':!![]});}return null;})[_0xcbe1('0x23')](function(_0xad741){if(!_0xad741)return null;_0x3cd8c9[_0xcbe1('0x2a')][_0xcbe1('0x76')]=_0xad741;return _0x3cd8c9;})[_0xcbe1('0x23')](function(_0x38361d){if(_0x38361d){if(_0x40092a[_0xcbe1('0x5b')][_0xcbe1('0x77')]){_0x3cd8c9[_0xcbe1('0x2a')][_0xcbe1('0x78')]=util[_0xcbe1('0x63')](_0xcbe1('0x79'),_0x40092a[_0xcbe1('0x66')][_0xcbe1('0x3b')]);_0x3cd8c9[_0xcbe1('0x2a')][_0xcbe1('0x7a')]=_0x3cd8c9[_0xcbe1('0x7a')];_0x3cd8c9['message'][_0xcbe1('0x7b')]=_0x3cd8c9[_0xcbe1('0x7a')];_0x3cd8c9[_0xcbe1('0x2a')][_0xcbe1('0x7c')]=_0xcbe1('0x5f');return respondWithRpcPromise('EventManager',_0xcbe1('0x7d'),{'event':_0xcbe1('0x7e'),'message':_0x3cd8c9['message']},client9002)['then'](function(){return _0x3cd8c9;});}return _0x3cd8c9;}return null;})['then'](respondWithResult(_0x3f03be,null))[_0xcbe1('0x2c')](handleError(_0x3f03be,null));};var interaction_log=require(_0xcbe1('0x16'))('whatsapp-interactions');exports[_0xcbe1('0x37')]=function(_0x32316b,_0x40a1fe,_0x54335a){var _0x407308={'agent':{},'channel':'whatsapp'};if(_0x32316b[_0xcbe1('0x5b')]['id']){delete _0x32316b[_0xcbe1('0x5b')]['id'];}_0x32316b['body']['UserId']=_0x32316b[_0xcbe1('0x5b')]['UserId']||_0x32316b['user']['id'];_0x407308[_0xcbe1('0x76')]['id']=_0x32316b['body'][_0xcbe1('0x65')];return db[_0xcbe1('0x3e')]['find']({'where':{'id':_0x32316b[_0xcbe1('0x57')]['id'],'UserId':null}})[_0xcbe1('0x23')](handleEntityNotFound(_0x40a1fe,null))[_0xcbe1('0x23')](function(_0x2dc2bd){if(_0x2dc2bd){_0x407308[_0xcbe1('0x2a')]=_0x2dc2bd[_0xcbe1('0x67')]({'plain':!![]});return db[_0xcbe1('0x68')][_0xcbe1('0x59')]({'where':{'id':_0x2dc2bd[_0xcbe1('0x7f')]}});}return null;})[_0xcbe1('0x23')](handleEntityNotFound(_0x40a1fe,null))[_0xcbe1('0x23')](function(_0x3e1dd3){if(_0x3e1dd3){_0x407308['interaction']=_0x3e1dd3[_0xcbe1('0x67')]({'plain':!![]});interaction_log[_0xcbe1('0x2b')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x32316b[_0xcbe1('0x66')]['id'],_0x32316b['user'][_0xcbe1('0x3b')],_0x32316b['user'][_0xcbe1('0x6c')],_0x407308[_0xcbe1('0x6b')]['id'],_0x32316b[_0xcbe1('0x5b')]?JSON[_0xcbe1('0x80')](_0x32316b[_0xcbe1('0x5b')]):_0xcbe1('0x6d'));return respondWithRpcPromise('RejectMessage',_0xcbe1('0x81'),_0x407308);}return null;})[_0xcbe1('0x23')](function(_0x1d28e7){var _0xb9d48f=_0xcbe1('0x82')+_0x1d28e7[_0xcbe1('0x2a')]['ContactId'];return db[_0xcbe1('0x6f')][_0xcbe1('0x42')](_0xb9d48f,{'type':db[_0xcbe1('0x70')][_0xcbe1('0x71')][_0xcbe1('0x72')],'raw':!![]})[_0xcbe1('0x23')](function(_0x5f371a){return _0x5f371a;});})[_0xcbe1('0x23')](function(_0x341511){if(_0x341511){_0x407308[_0xcbe1('0x2a')][_0xcbe1('0x83')]=_0x341511[0x0];if(!_0x32316b['body'][_0xcbe1('0x65')])return;return db[_0xcbe1('0x84')]['find']({'where':{'id':_0x32316b[_0xcbe1('0x5b')]['UserId'],'role':_0xcbe1('0x76')},'attributes':['id',_0xcbe1('0x3b'),_0xcbe1('0x73'),_0xcbe1('0x74'),_0xcbe1('0x75')],'raw':!![]});}return null;})[_0xcbe1('0x23')](function(_0x5af333){if(!_0x5af333)return null;_0x407308[_0xcbe1('0x2a')]['agent']=_0x5af333;return _0x407308;})['then'](function(_0x3c4b63){if(_0x3c4b63){_0x3c4b63[_0xcbe1('0x2a')][_0xcbe1('0x78')]=util[_0xcbe1('0x63')]('SIP/%s',_0x32316b[_0xcbe1('0x66')][_0xcbe1('0x3b')]);_0x3c4b63['message'][_0xcbe1('0x7a')]=_0x407308[_0xcbe1('0x7a')];_0x3c4b63[_0xcbe1('0x2a')][_0xcbe1('0x7b')]=_0x407308['channel'];_0x3c4b63[_0xcbe1('0x2a')]['event']=_0xcbe1('0x37');respondWithRpcPromise(_0xcbe1('0x7d'),_0xcbe1('0x7d'),{'event':_0xcbe1('0x85'),'message':_0x3c4b63[_0xcbe1('0x2a')]},client9002);return _0x407308;}return null;})[_0xcbe1('0x23')](respondWithResult(_0x40a1fe,null))[_0xcbe1('0x2c')](handleError(_0x40a1fe,null));};exports[_0xcbe1('0x2d')]=function(_0x40aace,_0x3a4e1f,_0x373785){if(_0x40aace[_0xcbe1('0x5b')]['id']){delete _0x40aace['body']['id'];}var _0x365eb2;return db[_0xcbe1('0x3e')]['find']({'where':{'id':_0x40aace[_0xcbe1('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a4e1f,null))['then'](function(_0x4a5841){if(_0x4a5841){_0x365eb2=_0x4a5841;return db[_0xcbe1('0x86')][_0xcbe1('0x59')]({'where':{'id':_0x4a5841[_0xcbe1('0x87')]}});}})[_0xcbe1('0x23')](handleEntityNotFound(_0x3a4e1f,null))['then'](function(_0x5b59b2){if(_0x5b59b2){logger[_0xcbe1('0x25')](_0xcbe1('0x88'),_0xcbe1('0x2d'),'received\x20delivery\x20report\x20from',_0x5b59b2[_0xcbe1('0x4e')],util[_0xcbe1('0x89')](_0x40aace[_0xcbe1('0x5b')],{'showHidden':![],'depth':null}));switch(_0x5b59b2[_0xcbe1('0x4e')]){case _0xcbe1('0x8a'):if(_0x40aace['body'][_0xcbe1('0x8b')]&&_0x40aace[_0xcbe1('0x5b')][_0xcbe1('0x8b')]===_0x365eb2['messageId']&&_0x40aace[_0xcbe1('0x5b')][_0xcbe1('0x8c')]&&_0x40aace[_0xcbe1('0x5b')]['MessageStatus']==='read'){return _0x365eb2[_0xcbe1('0x5c')]({'read':!![]});}else{logger[_0xcbe1('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xcbe1('0x2d'),_0xcbe1('0x8a'),util['inspect'](_0x40aace[_0xcbe1('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x365eb2;}})[_0xcbe1('0x23')](respondWithResult(_0x3a4e1f,null))[_0xcbe1('0x2c')](handleError(_0x3a4e1f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 38fba28..91b8ac8 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4058=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2dea58,_0x59d6f0){var _0x2b23c2=function(_0x3e5c44){while(--_0x3e5c44){_0x2dea58['push'](_0x2dea58['shift']());}};_0x2b23c2(++_0x59d6f0);}(_0x4058,0x129));var _0x8405=function(_0x4fda88,_0x27c393){_0x4fda88=_0x4fda88-0x0;var _0x51309f=_0x4058[_0x4fda88];return _0x51309f;};'use strict';var EventEmitter=require(_0x8405('0x0'));var WhatsappMessage=require(_0x8405('0x1'))['db'][_0x8405('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8405('0x3')](0x0);var events={'afterCreate':_0x8405('0x4'),'afterUpdate':_0x8405('0x5'),'afterDestroy':_0x8405('0x6')};function emitEvent(_0x1f6e6e){return function(_0xf8c24c,_0x4948b2,_0x5ebf0e){WhatsappMessageEvents['emit'](_0x1f6e6e+':'+_0xf8c24c['id'],_0xf8c24c);WhatsappMessageEvents[_0x8405('0x7')](_0x1f6e6e,_0xf8c24c);_0x5ebf0e(null);};}for(var e in events){if(events[_0x8405('0x8')](e)){var event=events[e];WhatsappMessage[_0x8405('0x9')](e,emitEvent(event));}}module[_0x8405('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x34b7=['exports','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x319fc1,_0x29179b){var _0xb768af=function(_0x3509ac){while(--_0x3509ac){_0x319fc1['push'](_0x319fc1['shift']());}};_0xb768af(++_0x29179b);}(_0x34b7,0x196));var _0x734b=function(_0x416586,_0xbdf0b1){_0x416586=_0x416586-0x0;var _0x5cbb10=_0x34b7[_0x416586];return _0x5cbb10;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x734b('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x734b('0x1')](0x0);var events={'afterCreate':_0x734b('0x2'),'afterUpdate':_0x734b('0x3'),'afterDestroy':_0x734b('0x4')};function emitEvent(_0x2993c6){return function(_0x5de1ae,_0x547652,_0x303067){WhatsappMessageEvents[_0x734b('0x5')](_0x2993c6+':'+_0x5de1ae['id'],_0x5de1ae);WhatsappMessageEvents[_0x734b('0x5')](_0x2993c6,_0x5de1ae);_0x303067(null);};}for(var e in events){if(events[_0x734b('0x6')](e)){var event=events[e];WhatsappMessage[_0x734b('0x7')](e,emitEvent(event));}}module[_0x734b('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 1b8dc6f..b560f99 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a25=['node-fetch','rimraf','../../config/environment','define','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','catch','error','out','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0a25,0x1bc));var _0x50a2=function(_0xb9e2bc,_0x1bb304){_0xb9e2bc=_0xb9e2bc-0x0;var _0x5cddae=_0x0a25[_0xb9e2bc];return _0x5cddae;};'use strict';var _=require(_0x50a2('0x0'));var util=require('util');var logger=require(_0x50a2('0x1'))('api');var moment=require(_0x50a2('0x2'));var BPromise=require(_0x50a2('0x3'));var rp=require('request-promise');var fetch=require(_0x50a2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50a2('0x5'));var config=require(_0x50a2('0x6'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x125a8b,_0x3a6323){return _0x125a8b[_0x50a2('0x7')](_0x50a2('0x8'),attributes,{'tableName':_0x50a2('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x50a2('0xa'),'fields':[_0x50a2('0xb')],'type':_0x50a2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x171751,_0x272da8,_0x49c172){var _0x48e93b=_0x125a8b[_0x50a2('0xd')];var _0x18b9fe=_0x171751['get']({'plain':!![]});if(_0x18b9fe[_0x50a2('0xe')][_0x50a2('0xf')]()==='in'||_0x18b9fe[_0x50a2('0xe')][_0x50a2('0xf')]()==='out'&&!_0x18b9fe[_0x50a2('0x10')]&&!_[_0x50a2('0x11')](_0x18b9fe['UserId'])){_0x48e93b[_0x50a2('0x12')][_0x50a2('0x13')]({'where':{'id':_0x18b9fe['WhatsappInteractionId']}})[_0x50a2('0x14')](function(_0x375cb5){if(_0x375cb5){_0x375cb5[_0x50a2('0x15')]({'lastMsgAt':_0x18b9fe[_0x50a2('0x16')],'lastMsgDirection':_0x18b9fe[_0x50a2('0xe')][_0x50a2('0xf')]()});}})[_0x50a2('0x17')](function(_0x4c4d7d){console[_0x50a2('0x18')](_0x4c4d7d);});}if(_0x18b9fe[_0x50a2('0xe')]===_0x50a2('0x19')&&!_0x18b9fe[_0x50a2('0x10')]){var _0x4a7fbb;_0x48e93b['WhatsappAccount'][_0x50a2('0x1a')]({'where':{'id':_0x18b9fe[_0x50a2('0x1b')]},'raw':!![]})[_0x50a2('0x14')](function(_0x15bf22){_0x4a7fbb=_0x15bf22;if(_0x4a7fbb&&_0x4a7fbb[_0x50a2('0x1c')]){switch(_0x4a7fbb['type']){case _0x50a2('0x1d'):var _0x56257c=require('twilio');if(_0x4a7fbb[_0x50a2('0x1e')]&&_0x4a7fbb[_0x50a2('0x1f')]&&_0x4a7fbb['phone']){var _0x41f4a5=new _0x56257c(_0x4a7fbb[_0x50a2('0x1e')],_0x4a7fbb[_0x50a2('0x1f')]);_0x41f4a5[_0x50a2('0x20')]['create']({'body':_0x18b9fe['body'],'to':_0x50a2('0x21')+_0x18b9fe[_0x50a2('0x22')],'from':_0x50a2('0x21')+_0x4a7fbb[_0x50a2('0x22')],'statusCallback':_0x4a7fbb[_0x50a2('0x23')]+_0x50a2('0x24')+_0x18b9fe['id']+'/status?token='+_0x4a7fbb[_0x50a2('0x25')]})['then'](function(_0x57af1c){if(_0x57af1c['sid']){return _0x171751[_0x50a2('0x15')]({'messageId':_0x57af1c[_0x50a2('0x26')]});}})[_0x50a2('0x17')](function(_0x4efc33){logger[_0x50a2('0x18')](_0x50a2('0x27'),'afterCreate',_0x50a2('0x1d'),util[_0x50a2('0x28')](_0x4efc33,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x50a2('0x27'),_0x50a2('0x29'),_0x50a2('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x50a2('0x2a'):var _0xb68e8b=_0x4a7fbb[_0x50a2('0x1e')];var _0x4d8b13=_0x4a7fbb[_0x50a2('0x1f')];var _0x5b97b7=_0x4a7fbb[_0x50a2('0x2b')]+_0x50a2('0x2c')+_0xb68e8b+_0x50a2('0x2d');var _0x5778ae={'to':[_0x18b9fe[_0x50a2('0x22')]],'message':{'type':_0x50a2('0x2e'),'text':_0x18b9fe[_0x50a2('0xb')]}};var _0x5bac70={'method':_0x50a2('0x2f'),'uri':_0x5b97b7,'headers':{'Authorization':_0x50a2('0x30')+_0x4d8b13,'Content-Type':_0x50a2('0x31')},'body':_0x5778ae,'json':!![]};rp(_0x5bac70)[_0x50a2('0x14')](function(_0x587c54){if(_0x587c54[_0x50a2('0x32')][0x0]['message_id']){return _0x171751[_0x50a2('0x15')]({'messageId':_0x587c54['statuses'][0x0][_0x50a2('0x33')]});}})[_0x50a2('0x17')](function(_0x4cb44e){logger[_0x50a2('0x34')]('WhatsappMessage,\x20%s',_0x4cb44e);});break;}}})[_0x50a2('0x35')](function(){_0x49c172();});}else{_0x49c172();}}},'charset':_0x50a2('0x36'),'collate':_0x50a2('0x37')});}; \ No newline at end of file +var _0xa2fe=['moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','text','Bearer\x20','application/json','statuses','message_id','catch','err','WhatsappMessage,\x20%s','util','../../config/logger','api'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xa2fe,0x153));var _0xea2f=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xa2fe[_0x456fb1];return _0x4083d6;};'use strict';var _=require('lodash');var util=require(_0xea2f('0x0'));var logger=require(_0xea2f('0x1'))(_0xea2f('0x2'));var moment=require(_0xea2f('0x3'));var BPromise=require(_0xea2f('0x4'));var rp=require(_0xea2f('0x5'));var fetch=require(_0xea2f('0x6'));var fs=require('fs');var path=require(_0xea2f('0x7'));var rimraf=require(_0xea2f('0x8'));var config=require(_0xea2f('0x9'));var attributes=require(_0xea2f('0xa'));module[_0xea2f('0xb')]=function(_0x3fbbe9,_0x30ada6){return _0x3fbbe9[_0xea2f('0xc')](_0xea2f('0xd'),attributes,{'tableName':_0xea2f('0xe'),'paranoid':![],'indexes':[{'name':_0xea2f('0xf'),'fields':[_0xea2f('0xf')]},{'name':'fti_whatsapp_messages','fields':[_0xea2f('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x395be4,_0x493835,_0x20708c){var _0x2f9237=_0x3fbbe9[_0xea2f('0x11')];var _0x5b1b8f=_0x395be4['get']({'plain':!![]});if(_0x5b1b8f[_0xea2f('0x12')][_0xea2f('0x13')]()==='in'||_0x5b1b8f[_0xea2f('0x12')][_0xea2f('0x13')]()===_0xea2f('0x14')&&!_0x5b1b8f[_0xea2f('0x15')]&&!_[_0xea2f('0x16')](_0x5b1b8f[_0xea2f('0x17')])){_0x2f9237[_0xea2f('0x18')][_0xea2f('0x19')]({'where':{'id':_0x5b1b8f['WhatsappInteractionId']}})[_0xea2f('0x1a')](function(_0x3ce7dd){if(_0x3ce7dd){_0x3ce7dd[_0xea2f('0x1b')]({'lastMsgAt':_0x5b1b8f[_0xea2f('0x1c')],'lastMsgDirection':_0x5b1b8f[_0xea2f('0x12')][_0xea2f('0x13')]()});}})['catch'](function(_0x1271f4){console[_0xea2f('0x1d')](_0x1271f4);});}if(_0x5b1b8f['direction']===_0xea2f('0x14')&&!_0x5b1b8f[_0xea2f('0x15')]){var _0x28085d;_0x2f9237[_0xea2f('0x1e')][_0xea2f('0x1f')]({'where':{'id':_0x5b1b8f[_0xea2f('0x20')]},'raw':!![]})[_0xea2f('0x1a')](function(_0x36d184){_0x28085d=_0x36d184;if(_0x28085d&&_0x28085d[_0xea2f('0x21')]){switch(_0x28085d['type']){case _0xea2f('0x22'):var _0x35d316=require('twilio');if(_0x28085d[_0xea2f('0x23')]&&_0x28085d[_0xea2f('0x24')]&&_0x28085d['phone']){var _0x16ea46=new _0x35d316(_0x28085d['accountSid'],_0x28085d[_0xea2f('0x24')]);_0x16ea46['messages'][_0xea2f('0x25')]({'body':_0x5b1b8f[_0xea2f('0x10')],'to':_0xea2f('0x26')+_0x5b1b8f[_0xea2f('0x27')],'from':'whatsapp:'+_0x28085d['phone'],'statusCallback':_0x28085d[_0xea2f('0x28')]+_0xea2f('0x29')+_0x5b1b8f['id']+'/status?token='+_0x28085d['token']})[_0xea2f('0x1a')](function(_0x3eae96){if(_0x3eae96[_0xea2f('0x2a')]){return _0x395be4[_0xea2f('0x1b')]({'messageId':_0x3eae96['sid']});}})['catch'](function(_0x458a11){logger[_0xea2f('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xea2f('0x2b'),'twilio',util[_0xea2f('0x2c')](_0x458a11,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xea2f('0x2d'),_0xea2f('0x2b'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xea2f('0x2e'):var _0x2bd14d=_0x28085d[_0xea2f('0x23')];var _0x18e509=_0x28085d[_0xea2f('0x24')];var _0x281cf3=_0x28085d[_0xea2f('0x2f')]+_0xea2f('0x30')+_0x2bd14d+'/messages/';var _0x574e4c={'to':[_0x5b1b8f['phone']],'message':{'type':_0xea2f('0x31'),'text':_0x5b1b8f['body']}};var _0x304138={'method':'POST','uri':_0x281cf3,'headers':{'Authorization':_0xea2f('0x32')+_0x18e509,'Content-Type':_0xea2f('0x33')},'body':_0x574e4c,'json':!![]};rp(_0x304138)[_0xea2f('0x1a')](function(_0xe826ce){if(_0xe826ce[_0xea2f('0x34')][0x0][_0xea2f('0x35')]){return _0x395be4[_0xea2f('0x1b')]({'messageId':_0xe826ce[_0xea2f('0x34')][0x0]['message_id']});}})[_0xea2f('0x36')](function(_0x132f53){logger[_0xea2f('0x37')](_0xea2f('0x38'),_0x132f53);});break;}}})['finally'](function(){_0x20708c();});}else{_0x20708c();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c0d789a..e1d581f 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa37=['then','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw'];(function(_0x30d7e9,_0x56d782){var _0xf85aa=function(_0x44e895){while(--_0x44e895){_0x30d7e9['push'](_0x30d7e9['shift']());}};_0xf85aa(++_0x56d782);}(_0xfa37,0x1c3));var _0x7fa3=function(_0x18dccb,_0x53c2c6){_0x18dccb=_0x18dccb-0x0;var _0x10d77c=_0xfa37[_0x18dccb];return _0x10d77c;};'use strict';var _=require(_0x7fa3('0x0'));var util=require(_0x7fa3('0x1'));var moment=require(_0x7fa3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fa3('0x3'));var db=require(_0x7fa3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fa3('0x5'))(_0x7fa3('0x6'));var config=require('../../config/environment');var jayson=require(_0x7fa3('0x7'));var client=jayson[_0x7fa3('0x8')][_0x7fa3('0x9')]({'port':0x232a});config[_0x7fa3('0xa')]=_['defaults'](config[_0x7fa3('0xa')],{'host':_0x7fa3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fa3('0xa')]));require('./whatsappMessage.socket')[_0x7fa3('0xc')](socket);function respondWithRpcPromise(_0x46bc22,_0x194950,_0x3d4f42){return new BPromise(function(_0x104a9d,_0x484de3){return client[_0x7fa3('0xd')](_0x46bc22,_0x3d4f42)['then'](function(_0x2b18db){logger[_0x7fa3('0xe')](_0x7fa3('0xf'),_0x194950,_0x7fa3('0x10'));logger[_0x7fa3('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x194950,_0x7fa3('0x10'),JSON[_0x7fa3('0x12')](_0x2b18db));if(_0x2b18db[_0x7fa3('0x13')]){if(_0x2b18db[_0x7fa3('0x13')][_0x7fa3('0x14')]===0x1f4){logger[_0x7fa3('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x194950,_0x2b18db[_0x7fa3('0x13')][_0x7fa3('0x15')]);return _0x484de3(_0x2b18db['error'][_0x7fa3('0x15')]);}logger[_0x7fa3('0x13')](_0x7fa3('0xf'),_0x194950,_0x2b18db[_0x7fa3('0x13')][_0x7fa3('0x15')]);return _0x104a9d(_0x2b18db[_0x7fa3('0x13')][_0x7fa3('0x15')]);}else{logger[_0x7fa3('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x194950,_0x7fa3('0x10'));_0x104a9d(_0x2b18db['result']['message']);}})[_0x7fa3('0x16')](function(_0x17d6ff){logger['error'](_0x7fa3('0xf'),_0x194950,_0x17d6ff);_0x484de3(_0x17d6ff);});});}exports[_0x7fa3('0x17')]=function(_0x3a57a6){var _0x5a83ff=this;return new Promise(function(_0x558cbe,_0x5ee8f0){return db[_0x7fa3('0x18')][_0x7fa3('0x19')](_0x3a57a6[_0x7fa3('0x1a')],{'raw':_0x3a57a6[_0x7fa3('0x1b')]?_0x3a57a6['options'][_0x7fa3('0x1c')]===undefined?!![]:![]:!![]})[_0x7fa3('0x1d')](function(_0xbdafb){logger['info'](_0x7fa3('0x17'),_0x3a57a6);logger[_0x7fa3('0x11')](_0x7fa3('0x17'),_0x3a57a6,JSON[_0x7fa3('0x12')](_0xbdafb));_0x558cbe(_0xbdafb);})[_0x7fa3('0x16')](function(_0x4a910d){logger[_0x7fa3('0x13')](_0x7fa3('0x17'),_0x4a910d['message'],_0x3a57a6);_0x5ee8f0(_0x5a83ff[_0x7fa3('0x13')](0x1f4,_0x4a910d[_0x7fa3('0x15')]));});});}; \ No newline at end of file +var _0x80fc=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','info','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x16920a,_0x509068){var _0x421782=function(_0x52dcdb){while(--_0x52dcdb){_0x16920a['push'](_0x16920a['shift']());}};_0x421782(++_0x509068);}(_0x80fc,0xd6));var _0xc80f=function(_0xcec6f7,_0x2fab66){_0xcec6f7=_0xcec6f7-0x0;var _0x5efd71=_0x80fc[_0xcec6f7];return _0x5efd71;};'use strict';var _=require('lodash');var util=require(_0xc80f('0x0'));var moment=require(_0xc80f('0x1'));var BPromise=require(_0xc80f('0x2'));var rs=require(_0xc80f('0x3'));var fs=require('fs');var Redis=require(_0xc80f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc80f('0x5'))(_0xc80f('0x6'));var config=require(_0xc80f('0x7'));var jayson=require(_0xc80f('0x8'));var client=jayson[_0xc80f('0x9')][_0xc80f('0xa')]({'port':0x232a});config[_0xc80f('0xb')]=_[_0xc80f('0xc')](config[_0xc80f('0xb')],{'host':_0xc80f('0xd'),'port':0x18eb});var socket=require(_0xc80f('0xe'))(new Redis(config[_0xc80f('0xb')]));require('./whatsappMessage.socket')[_0xc80f('0xf')](socket);function respondWithRpcPromise(_0x1baf35,_0xf25b65,_0x5e0b94){return new BPromise(function(_0x24913e,_0x1bd346){return client['request'](_0x1baf35,_0x5e0b94)[_0xc80f('0x10')](function(_0x3656d6){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xf25b65,_0xc80f('0x11'));logger[_0xc80f('0x12')](_0xc80f('0x13'),_0xf25b65,_0xc80f('0x11'),JSON[_0xc80f('0x14')](_0x3656d6));if(_0x3656d6[_0xc80f('0x15')]){if(_0x3656d6[_0xc80f('0x15')][_0xc80f('0x16')]===0x1f4){logger[_0xc80f('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0xf25b65,_0x3656d6[_0xc80f('0x15')][_0xc80f('0x17')]);return _0x1bd346(_0x3656d6[_0xc80f('0x15')]['message']);}logger[_0xc80f('0x15')](_0xc80f('0x18'),_0xf25b65,_0x3656d6['error'][_0xc80f('0x17')]);return _0x24913e(_0x3656d6[_0xc80f('0x15')]['message']);}else{logger[_0xc80f('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0xf25b65,_0xc80f('0x11'));_0x24913e(_0x3656d6[_0xc80f('0x1a')][_0xc80f('0x17')]);}})[_0xc80f('0x1b')](function(_0x2fe067){logger[_0xc80f('0x15')](_0xc80f('0x18'),_0xf25b65,_0x2fe067);_0x1bd346(_0x2fe067);});});}exports[_0xc80f('0x1c')]=function(_0x4819b3){var _0x3f4c04=this;return new Promise(function(_0x5bc6f3,_0x309037){return db[_0xc80f('0x1d')]['create'](_0x4819b3[_0xc80f('0x1e')],{'raw':_0x4819b3[_0xc80f('0x1f')]?_0x4819b3[_0xc80f('0x1f')][_0xc80f('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x12f5b5){logger['info'](_0xc80f('0x1c'),_0x4819b3);logger['debug'](_0xc80f('0x1c'),_0x4819b3,JSON[_0xc80f('0x14')](_0x12f5b5));_0x5bc6f3(_0x12f5b5);})[_0xc80f('0x1b')](function(_0x1bad2c){logger[_0xc80f('0x15')](_0xc80f('0x1c'),_0x1bad2c[_0xc80f('0x17')],_0x4819b3);_0x309037(_0x3f4c04[_0xc80f('0x15')](0x1f4,_0x1bad2c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 244c36b..27040b7 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd72d=['whatsappMessage:','save','remove','emit','removeListener','register','length'];(function(_0x193c7c,_0x1a7bf0){var _0x335886=function(_0xe04be1){while(--_0xe04be1){_0x193c7c['push'](_0x193c7c['shift']());}};_0x335886(++_0x1a7bf0);}(_0xd72d,0x190));var _0xdd72=function(_0x116663,_0x3b88fb){_0x116663=_0x116663-0x0;var _0x56832c=_0xd72d[_0x116663];return _0x56832c;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xdd72('0x0'),_0xdd72('0x1'),'update'];function createListener(_0x55038d,_0xc2e90){return function(_0x3e6654){_0xc2e90[_0xdd72('0x2')](_0x55038d,_0x3e6654);};}function removeListener(_0x2e380e,_0x390ae1){return function(){WhatsappMessageEvents[_0xdd72('0x3')](_0x2e380e,_0x390ae1);};}exports[_0xdd72('0x4')]=function(_0x2c132f){for(var _0x1fd5dc=0x0,_0x3f4c86=events[_0xdd72('0x5')];_0x1fd5dc<_0x3f4c86;_0x1fd5dc++){var _0x1a07f5=events[_0x1fd5dc];var _0x35de0f=createListener(_0xdd72('0x6')+_0x1a07f5,_0x2c132f);WhatsappMessageEvents['on'](_0x1a07f5,_0x35de0f);}}; \ No newline at end of file +var _0x484b=['update','emit','removeListener','length','./whatsappMessage.events','save','remove'];(function(_0x5737dd,_0x4ae8ac){var _0x44a10e=function(_0x10760a){while(--_0x10760a){_0x5737dd['push'](_0x5737dd['shift']());}};_0x44a10e(++_0x4ae8ac);}(_0x484b,0xf2));var _0xb484=function(_0x29eef6,_0x4923a7){_0x29eef6=_0x29eef6-0x0;var _0x57e2e8=_0x484b[_0x29eef6];return _0x57e2e8;};'use strict';var WhatsappMessageEvents=require(_0xb484('0x0'));var events=[_0xb484('0x1'),_0xb484('0x2'),_0xb484('0x3')];function createListener(_0x279b40,_0x3f644a){return function(_0xf19095){_0x3f644a[_0xb484('0x4')](_0x279b40,_0xf19095);};}function removeListener(_0xdb03c9,_0x53eea6){return function(){WhatsappMessageEvents[_0xb484('0x5')](_0xdb03c9,_0x53eea6);};}exports['register']=function(_0x4f4dc5){for(var _0x1b6ce2=0x0,_0x3f7926=events[_0xb484('0x6')];_0x1b6ce2<_0x3f7926;_0x1b6ce2++){var _0x410638=events[_0x1b6ce2];var _0xfa56cf=createListener('whatsappMessage:'+_0x410638,_0x4f4dc5);WhatsappMessageEvents['on'](_0x410638,_0xfa56cf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 2b5145f..d8d014b 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90d9=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','util'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x90d9,0x1e5));var _0x990d=function(_0x47cdf8,_0x507317){_0x47cdf8=_0x47cdf8-0x0;var _0x1bd3d5=_0x90d9[_0x47cdf8];return _0x1bd3d5;};'use strict';var multer=require('multer');var util=require(_0x990d('0x0'));var path=require(_0x990d('0x1'));var timeout=require(_0x990d('0x2'));var express=require('express');var router=express[_0x990d('0x3')]();var fs_extra=require(_0x990d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x990d('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x990d('0x6')]('/',auth[_0x990d('0x7')](),controller[_0x990d('0x8')]);router[_0x990d('0x6')](_0x990d('0x9'),auth['isAuthenticated'](),controller[_0x990d('0xa')]);router[_0x990d('0x6')](_0x990d('0xb'),auth[_0x990d('0x7')](),controller[_0x990d('0xc')]);router['get'](_0x990d('0xd'),auth[_0x990d('0x7')](),controller['getMembers']);router[_0x990d('0x6')](_0x990d('0xe'),auth[_0x990d('0x7')](),controller[_0x990d('0xf')]);router[_0x990d('0x6')](_0x990d('0x10'),auth[_0x990d('0x7')](),controller['getAgents']);router[_0x990d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x990d('0x11')](_0x990d('0xe'),auth[_0x990d('0x7')](),controller[_0x990d('0x12')]);router[_0x990d('0x11')](_0x990d('0x10'),auth['isAuthenticated'](),controller[_0x990d('0x13')]);router[_0x990d('0x14')](_0x990d('0xb'),auth['isAuthenticated'](),controller[_0x990d('0x15')]);router['delete'](_0x990d('0xb'),auth[_0x990d('0x7')](),controller[_0x990d('0x16')]);router['delete'](_0x990d('0xe'),auth[_0x990d('0x7')](),controller[_0x990d('0x17')]);router[_0x990d('0x18')](_0x990d('0x10'),auth['isAuthenticated'](),controller[_0x990d('0x19')]);module[_0x990d('0x1a')]=router; \ No newline at end of file +var _0xe49d=['/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x470ba4,_0x240c5e){var _0x3dac5a=function(_0x4ca5ee){while(--_0x4ca5ee){_0x470ba4['push'](_0x470ba4['shift']());}};_0x3dac5a(++_0x240c5e);}(_0xe49d,0xf0));var _0xde49=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe49d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde49('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xde49('0x1')]();var fs_extra=require(_0xde49('0x2'));var auth=require(_0xde49('0x3'));var interaction=require(_0xde49('0x4'));var config=require(_0xde49('0x5'));var controller=require(_0xde49('0x6'));router[_0xde49('0x7')]('/',auth[_0xde49('0x8')](),controller[_0xde49('0x9')]);router[_0xde49('0x7')](_0xde49('0xa'),auth['isAuthenticated'](),controller[_0xde49('0xb')]);router['get'](_0xde49('0xc'),auth[_0xde49('0x8')](),controller[_0xde49('0xd')]);router[_0xde49('0x7')](_0xde49('0xe'),auth[_0xde49('0x8')](),controller[_0xde49('0xf')]);router[_0xde49('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0xde49('0x10')]);router[_0xde49('0x7')](_0xde49('0x11'),auth[_0xde49('0x8')](),controller[_0xde49('0x12')]);router[_0xde49('0x13')]('/',auth[_0xde49('0x8')](),controller['create']);router[_0xde49('0x13')](_0xde49('0x14'),auth['isAuthenticated'](),controller[_0xde49('0x15')]);router[_0xde49('0x13')](_0xde49('0x11'),auth[_0xde49('0x8')](),controller[_0xde49('0x16')]);router['put'](_0xde49('0xc'),auth[_0xde49('0x8')](),controller[_0xde49('0x17')]);router[_0xde49('0x18')](_0xde49('0xc'),auth[_0xde49('0x8')](),controller[_0xde49('0x19')]);router['delete'](_0xde49('0x14'),auth['isAuthenticated'](),controller[_0xde49('0x1a')]);router['delete'](_0xde49('0x11'),auth[_0xde49('0x8')](),controller[_0xde49('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6f5d747..3d03cc7 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1b9=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5821cb,_0xfdc204){var _0x418194=function(_0x27b0f9){while(--_0x27b0f9){_0x5821cb['push'](_0x5821cb['shift']());}};_0x418194(++_0xfdc204);}(_0xa1b9,0x71));var _0x9a1b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa1b9[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x9a1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a1b('0x1')],'unique':_0x9a1b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9a1b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a1b('0x4')](_0x9a1b('0x5'),_0x9a1b('0x6'),_0x9a1b('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5fc7=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x2a5042,_0x307d04){var _0x4bc22f=function(_0x2ef928){while(--_0x2ef928){_0x2a5042['push'](_0x2a5042['shift']());}};_0x4bc22f(++_0x307d04);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x5fc7[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require(_0x75fc('0x0'));module[_0x75fc('0x1')]={'name':{'type':Sequelize[_0x75fc('0x2')],'unique':_0x75fc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x75fc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x75fc('0x5')](_0x75fc('0x6'),_0x75fc('0x7'),_0x75fc('0x8'))},'description':{'type':Sequelize[_0x75fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 39735b5..ad7785f 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22e2=['removeAgents','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAll','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','forEach','addAgents','omit','spread'];(function(_0x358bf3,_0x40ec1f){var _0x248106=function(_0x2eb1f3){while(--_0x2eb1f3){_0x358bf3['push'](_0x358bf3['shift']());}};_0x248106(++_0x40ec1f);}(_0x22e2,0x1b3));var _0x222e=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x22e2[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x222e('0x0'));var rimraf=require(_0x222e('0x1'));var zipdir=require(_0x222e('0x2'));var jsonpatch=require(_0x222e('0x3'));var rp=require('request-promise');var moment=require(_0x222e('0x4'));var BPromise=require(_0x222e('0x5'));var Mustache=require(_0x222e('0x6'));var util=require(_0x222e('0x7'));var path=require(_0x222e('0x8'));var sox=require(_0x222e('0x9'));var csv=require(_0x222e('0xa'));var ejs=require(_0x222e('0xb'));var fs=require('fs');var fs_extra=require(_0x222e('0xc'));var _=require('lodash');var squel=require(_0x222e('0xd'));var crypto=require('crypto');var jsforce=require(_0x222e('0xe'));var deskjs=require(_0x222e('0xf'));var toCsv=require(_0x222e('0xa'));var querystring=require(_0x222e('0x10'));var Papa=require(_0x222e('0x11'));var Redis=require(_0x222e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x222e('0x13'));var as=require(_0x222e('0x14'));var hardwareService=require(_0x222e('0x15'));var logger=require(_0x222e('0x16'))(_0x222e('0x17'));var utils=require(_0x222e('0x18'));var config=require(_0x222e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x222e('0x1a'))['db'];config['redis']=_[_0x222e('0x1b')](config[_0x222e('0x1c')],{'host':_0x222e('0x1d'),'port':0x18eb});var socket=require(_0x222e('0x1e'))(new Redis(config[_0x222e('0x1c')]));require(_0x222e('0x1f'))[_0x222e('0x20')](socket);function respondWithStatusCode(_0x1bd8cd,_0x2b5749){_0x2b5749=_0x2b5749||0xcc;return function(_0x3ba231){if(_0x3ba231){return _0x1bd8cd[_0x222e('0x21')](_0x2b5749);}return _0x1bd8cd['status'](_0x2b5749)[_0x222e('0x22')]();};}function respondWithResult(_0x51e342,_0x148184){_0x148184=_0x148184||0xc8;return function(_0xa57e16){if(_0xa57e16){return _0x51e342[_0x222e('0x23')](_0x148184)['json'](_0xa57e16);}};}function respondWithFilteredResult(_0x223547,_0x1ea34b){return function(_0xfb2cba){if(_0xfb2cba){var _0x4902d3=typeof _0x1ea34b[_0x222e('0x24')]===_0x222e('0x25')&&typeof _0x1ea34b[_0x222e('0x26')]==='undefined';var _0x24cf78=_0xfb2cba[_0x222e('0x27')];var _0x3a8934=_0x4902d3?0x0:_0x1ea34b[_0x222e('0x24')];var _0x25416b=_0x4902d3?_0xfb2cba['count']:_0x1ea34b[_0x222e('0x24')]+_0x1ea34b[_0x222e('0x26')];var _0x5df846;if(_0x25416b>=_0x24cf78){_0x25416b=_0x24cf78;_0x5df846=0xc8;}else{_0x5df846=0xce;}_0x223547[_0x222e('0x23')](_0x5df846);return _0x223547[_0x222e('0x28')](_0x222e('0x29'),_0x3a8934+'-'+_0x25416b+'/'+_0x24cf78)[_0x222e('0x2a')](_0xfb2cba);}return null;};}function patchUpdates(_0x36a65a){return function(_0xc4549f){try{jsonpatch[_0x222e('0x2b')](_0xc4549f,_0x36a65a,!![]);}catch(_0x512b82){return BPromise[_0x222e('0x2c')](_0x512b82);}return _0xc4549f['save']();};}function saveUpdates(_0x4910ae,_0x40f1e){return function(_0x167ce5){if(_0x167ce5){return _0x167ce5[_0x222e('0x2d')](_0x4910ae)[_0x222e('0x2e')](function(_0x4661ba){return _0x4661ba;});}return null;};}function removeEntity(_0x5748fb,_0x2094b8){return function(_0x3ac1fc){if(_0x3ac1fc){return _0x3ac1fc[_0x222e('0x2f')]()[_0x222e('0x2e')](function(){var _0x3b1510=_0x3ac1fc['get']({'plain':!![]});var _0x2d36e9=_0x222e('0x30');return db[_0x222e('0x31')][_0x222e('0x2f')]({'where':{'type':_0x2d36e9,'resourceId':_0x3b1510['id']}})[_0x222e('0x2e')](function(){return _0x3ac1fc;});})[_0x222e('0x2e')](function(){_0x5748fb[_0x222e('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c6f4,_0x21c931){return function(_0x41aafb){if(!_0x41aafb){_0x48c6f4[_0x222e('0x21')](0x194);}return _0x41aafb;};}function handleError(_0x154d37,_0x3d4125){_0x3d4125=_0x3d4125||0x1f4;return function(_0xb13884){logger['error'](_0xb13884[_0x222e('0x32')]);if(_0xb13884[_0x222e('0x33')]){delete _0xb13884[_0x222e('0x33')];}_0x154d37[_0x222e('0x23')](_0x3d4125)[_0x222e('0x34')](_0xb13884);};}exports[_0x222e('0x35')]=function(_0x382692,_0x59ee69){var _0xe3151a={},_0x1da0fd={},_0x17d302={'count':0x0,'rows':[]};var _0xb31c3d=_[_0x222e('0x36')](db[_0x222e('0x37')][_0x222e('0x38')],function(_0xe357c8){return{'name':_0xe357c8['fieldName'],'type':_0xe357c8['type']['key']};});_0x1da0fd[_0x222e('0x39')]=_['map'](_0xb31c3d,_0x222e('0x33'));_0x1da0fd[_0x222e('0x3a')]=_['keys'](_0x382692[_0x222e('0x3a')]);_0x1da0fd[_0x222e('0x3b')]=_[_0x222e('0x3c')](_0x1da0fd[_0x222e('0x39')],_0x1da0fd[_0x222e('0x3a')]);_0xe3151a[_0x222e('0x3d')]=_[_0x222e('0x3c')](_0x1da0fd[_0x222e('0x39')],qs[_0x222e('0x3e')](_0x382692[_0x222e('0x3a')][_0x222e('0x3e')]));_0xe3151a[_0x222e('0x3d')]=_0xe3151a[_0x222e('0x3d')][_0x222e('0x3f')]?_0xe3151a['attributes']:_0x1da0fd[_0x222e('0x39')];if(!_0x382692[_0x222e('0x3a')][_0x222e('0x40')](_0x222e('0x41'))){_0xe3151a[_0x222e('0x26')]=qs['limit'](_0x382692[_0x222e('0x3a')][_0x222e('0x26')]);_0xe3151a[_0x222e('0x24')]=qs[_0x222e('0x24')](_0x382692[_0x222e('0x3a')][_0x222e('0x24')]);}_0xe3151a[_0x222e('0x42')]=qs[_0x222e('0x43')](_0x382692[_0x222e('0x3a')][_0x222e('0x43')]);_0xe3151a[_0x222e('0x44')]=qs[_0x222e('0x3b')](_[_0x222e('0x45')](_0x382692[_0x222e('0x3a')],_0x1da0fd[_0x222e('0x3b')]),_0xb31c3d);if(_0x382692[_0x222e('0x3a')][_0x222e('0x46')]){_0xe3151a[_0x222e('0x44')]=_[_0x222e('0x47')](_0xe3151a[_0x222e('0x44')],{'$or':_[_0x222e('0x36')](_0xb31c3d,function(_0x4624eb){if(_0x4624eb['type']!==_0x222e('0x48')){var _0x40e89f={};_0x40e89f[_0x4624eb[_0x222e('0x33')]]={'$like':'%'+_0x382692['query']['filter']+'%'};return _0x40e89f;}})});}_0xe3151a=_['merge']({},_0xe3151a,_0x382692[_0x222e('0x49')]);var _0xde4e57={'where':_0xe3151a['where']};return db[_0x222e('0x37')]['count'](_0xde4e57)[_0x222e('0x2e')](function(_0x4093db){_0x17d302[_0x222e('0x27')]=_0x4093db;if(_0x382692[_0x222e('0x3a')][_0x222e('0x4a')]){_0xe3151a[_0x222e('0x4b')]=[{'all':!![]}];}return db[_0x222e('0x37')]['findAll'](_0xe3151a);})[_0x222e('0x2e')](function(_0xae114a){_0x17d302[_0x222e('0x4c')]=_0xae114a;return _0x17d302;})['then'](respondWithFilteredResult(_0x59ee69,_0xe3151a))[_0x222e('0x4d')](handleError(_0x59ee69,null));};exports[_0x222e('0x4e')]=function(_0x564fe1,_0x4f28dc){var _0x95376f={'raw':!![],'where':{'id':_0x564fe1[_0x222e('0x4f')]['id']}},_0x5787c2={};_0x5787c2[_0x222e('0x39')]=_[_0x222e('0x50')](db[_0x222e('0x37')][_0x222e('0x38')]);_0x5787c2[_0x222e('0x3a')]=_['keys'](_0x564fe1[_0x222e('0x3a')]);_0x5787c2[_0x222e('0x3b')]=_[_0x222e('0x3c')](_0x5787c2[_0x222e('0x39')],_0x5787c2[_0x222e('0x3a')]);_0x95376f[_0x222e('0x3d')]=_[_0x222e('0x3c')](_0x5787c2[_0x222e('0x39')],qs[_0x222e('0x3e')](_0x564fe1[_0x222e('0x3a')][_0x222e('0x3e')]));_0x95376f[_0x222e('0x3d')]=_0x95376f[_0x222e('0x3d')][_0x222e('0x3f')]?_0x95376f[_0x222e('0x3d')]:_0x5787c2[_0x222e('0x39')];if(_0x564fe1[_0x222e('0x3a')][_0x222e('0x4a')]){_0x95376f['include']=[{'all':!![]}];}_0x95376f=_[_0x222e('0x47')]({},_0x95376f,_0x564fe1[_0x222e('0x49')]);return db[_0x222e('0x37')][_0x222e('0x51')](_0x95376f)[_0x222e('0x2e')](handleEntityNotFound(_0x4f28dc,null))[_0x222e('0x2e')](respondWithResult(_0x4f28dc,null))['catch'](handleError(_0x4f28dc,null));};exports[_0x222e('0x52')]=function(_0x4fd23d,_0x1967fa){return db['WhatsappQueue'][_0x222e('0x52')](_0x4fd23d[_0x222e('0x53')],{})[_0x222e('0x2e')](function(_0x380ea1){var _0x20db9b=_0x4fd23d['user'][_0x222e('0x54')]({'plain':!![]});if(!_0x20db9b)throw new Error(_0x222e('0x55'));if(_0x20db9b['role']==='user'){var _0x5309f8=_0x380ea1['get']({'plain':!![]});var _0x31c1b9=_0x222e('0x30');return db['UserProfileSection'][_0x222e('0x51')]({'where':{'name':_0x31c1b9,'userProfileId':_0x20db9b[_0x222e('0x56')]},'raw':!![]})[_0x222e('0x2e')](function(_0x24ba76){if(_0x24ba76&&_0x24ba76[_0x222e('0x57')]===0x0){return db[_0x222e('0x31')][_0x222e('0x52')]({'name':_0x5309f8[_0x222e('0x33')],'resourceId':_0x5309f8['id'],'type':_0x24ba76['name'],'sectionId':_0x24ba76['id']},{})[_0x222e('0x2e')](function(){return _0x380ea1;});}else{return _0x380ea1;}})[_0x222e('0x4d')](function(_0xc7ca37){logger[_0x222e('0x58')](_0x222e('0x59'),_0xc7ca37);throw _0xc7ca37;});}return _0x380ea1;})[_0x222e('0x2e')](respondWithResult(_0x1967fa,0xc9))['catch'](handleError(_0x1967fa,null));};exports[_0x222e('0x2d')]=function(_0x349b17,_0x260ea4){if(_0x349b17['body']['id']){delete _0x349b17[_0x222e('0x53')]['id'];}return db[_0x222e('0x37')][_0x222e('0x51')]({'where':{'id':_0x349b17[_0x222e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x260ea4,null))[_0x222e('0x2e')](saveUpdates(_0x349b17[_0x222e('0x53')],null))[_0x222e('0x2e')](respondWithResult(_0x260ea4,null))[_0x222e('0x4d')](handleError(_0x260ea4,null));};exports[_0x222e('0x2f')]=function(_0x3908ff,_0x134775){return db[_0x222e('0x37')][_0x222e('0x51')]({'where':{'id':_0x3908ff[_0x222e('0x4f')]['id']}})[_0x222e('0x2e')](handleEntityNotFound(_0x134775,null))[_0x222e('0x2e')](removeEntity(_0x134775,null))['catch'](handleError(_0x134775,null));};exports[_0x222e('0x5a')]=function(_0xc2e47e,_0x2369e0){return db['WhatsappQueue'][_0x222e('0x5a')]()['then'](respondWithResult(_0x2369e0,null))['catch'](handleError(_0x2369e0,null));};exports[_0x222e('0x5b')]=function(_0x3990e6,_0x4e146c,_0x2f5272){var _0x2ad4d9={'raw':!![],'where':{}},_0x13e3e5={},_0x41cdd0;return db[_0x222e('0x37')][_0x222e('0x5c')]({'where':{'id':_0x3990e6[_0x222e('0x4f')]['id']}})[_0x222e('0x2e')](handleEntityNotFound(_0x4e146c,null))['then'](function(_0x3fa46e){if(_0x3fa46e){_0x41cdd0=_0x3fa46e['get']({'plain':!![]});_0x13e3e5[_0x222e('0x39')]=_[_0x222e('0x50')](db[_0x222e('0x5d')]['rawAttributes']);_0x13e3e5[_0x222e('0x3a')]=_[_0x222e('0x50')](_0x3990e6[_0x222e('0x3a')]);_0x13e3e5[_0x222e('0x3b')]=_[_0x222e('0x3c')](_0x13e3e5[_0x222e('0x39')],_0x13e3e5[_0x222e('0x3a')]);_0x2ad4d9['attributes']=_[_0x222e('0x3c')](_0x13e3e5[_0x222e('0x39')],qs[_0x222e('0x3e')](_0x3990e6['query']['fields']));_0x2ad4d9[_0x222e('0x3d')]=_0x2ad4d9[_0x222e('0x3d')][_0x222e('0x3f')]?_0x2ad4d9[_0x222e('0x3d')]:_0x13e3e5[_0x222e('0x39')];if(!_0x3990e6['query'][_0x222e('0x40')](_0x222e('0x41'))){_0x2ad4d9[_0x222e('0x26')]=qs[_0x222e('0x26')](_0x3990e6[_0x222e('0x3a')][_0x222e('0x26')]);_0x2ad4d9[_0x222e('0x24')]=qs[_0x222e('0x24')](_0x3990e6['query']['offset']);}_0x2ad4d9[_0x222e('0x42')]=qs[_0x222e('0x43')](_0x3990e6[_0x222e('0x3a')]['sort']);_0x2ad4d9[_0x222e('0x44')]=qs[_0x222e('0x3b')](_[_0x222e('0x45')](_0x3990e6[_0x222e('0x3a')],_0x13e3e5['filters']));_0x2ad4d9[_0x222e('0x44')][_0x222e('0x5e')]=_0x3fa46e['id'];if(_0x3990e6[_0x222e('0x3a')][_0x222e('0x46')]){_0x2ad4d9[_0x222e('0x44')]=_['merge'](_0x2ad4d9[_0x222e('0x44')],{'$or':_[_0x222e('0x36')](_0x2ad4d9[_0x222e('0x3d')],function(_0x2738fa){var _0x3ddf52={};_0x3ddf52[_0x2738fa]={'$like':'%'+_0x3990e6[_0x222e('0x3a')]['filter']+'%'};return _0x3ddf52;})});}_0x2ad4d9=_['merge']({},_0x2ad4d9,_0x3990e6['options']);return db[_0x222e('0x5d')][_0x222e('0x5f')](_0x2ad4d9);}})[_0x222e('0x2e')](function(_0x421a65){if(_0x421a65){return db[_0x222e('0x60')][_0x222e('0x61')]({'where':{'id':_[_0x222e('0x36')](_0x421a65,'UserId'),'role':_0x222e('0x62')},'attributes':['id','name',_0x222e('0x63'),_0x222e('0x64'),_0x222e('0x65')]});}})['then'](function(_0x39875e){if(_0x39875e){return{'count':_0x39875e[_0x222e('0x27')],'rows':_[_0x222e('0x36')](_0x39875e['rows'],function(_0x1e398e){return{'membername':_0x1e398e[_0x222e('0x33')],'UserId':_0x1e398e['id'],'queue_name':_0x41cdd0['name'],'WhatsappQueueId':_0x41cdd0['id'],'interface':util[_0x222e('0x66')](_0x222e('0x67'),_0x222e('0x68'),_0x1e398e[_0x222e('0x33')]),'penalty':0x0,'paused':_0x1e398e[_0x222e('0x63')],'createdAt':_0x1e398e[_0x222e('0x65')],'updatedAt':_0x1e398e[_0x222e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x222e('0x2e')](respondWithFilteredResult(_0x4e146c,_0x2ad4d9))[_0x222e('0x4d')](handleError(_0x4e146c,null));};exports[_0x222e('0x69')]=function(_0x3134c8,_0x52a1e6,_0x242b4e){var _0x166b42={};var _0x200e75={};var _0xf7b304;var _0x16fb16;return db[_0x222e('0x37')][_0x222e('0x5c')]({'where':{'id':_0x3134c8[_0x222e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52a1e6,null))[_0x222e('0x2e')](function(_0x3d828d){if(_0x3d828d){_0xf7b304=_0x3d828d;_0x200e75[_0x222e('0x39')]=_[_0x222e('0x50')](db[_0x222e('0x6a')]['rawAttributes']);_0x200e75[_0x222e('0x3a')]=_[_0x222e('0x50')](_0x3134c8[_0x222e('0x3a')]);_0x200e75[_0x222e('0x3b')]=_[_0x222e('0x3c')](_0x200e75[_0x222e('0x39')],_0x200e75[_0x222e('0x3a')]);_0x166b42[_0x222e('0x3d')]=_[_0x222e('0x3c')](_0x200e75['model'],qs[_0x222e('0x3e')](_0x3134c8['query'][_0x222e('0x3e')]));_0x166b42['attributes']=_0x166b42[_0x222e('0x3d')]['length']?_0x166b42[_0x222e('0x3d')]:_0x200e75[_0x222e('0x39')];_0x166b42[_0x222e('0x42')]=qs[_0x222e('0x43')](_0x3134c8[_0x222e('0x3a')]['sort']);_0x166b42['where']=qs[_0x222e('0x3b')](_[_0x222e('0x45')](_0x3134c8[_0x222e('0x3a')],_0x200e75['filters']));if(_0x3134c8[_0x222e('0x3a')][_0x222e('0x46')]){_0x166b42[_0x222e('0x44')]=_[_0x222e('0x47')](_0x166b42['where'],{'$or':_['map'](_0x166b42[_0x222e('0x3d')],function(_0x4fd757){var _0x5b1bea={};_0x5b1bea[_0x4fd757]={'$like':'%'+_0x3134c8[_0x222e('0x3a')][_0x222e('0x46')]+'%'};return _0x5b1bea;})});}_0x166b42=_[_0x222e('0x47')]({},_0x166b42,_0x3134c8[_0x222e('0x49')]);return _0xf7b304[_0x222e('0x69')](_0x166b42);}})[_0x222e('0x2e')](function(_0xab973c){if(_0xab973c){_0x16fb16=_0xab973c[_0x222e('0x3f')];if(!_0x3134c8[_0x222e('0x3a')][_0x222e('0x40')]('nolimit')){_0x166b42[_0x222e('0x26')]=qs['limit'](_0x3134c8[_0x222e('0x3a')][_0x222e('0x26')]);_0x166b42[_0x222e('0x24')]=qs['offset'](_0x3134c8[_0x222e('0x3a')][_0x222e('0x24')]);}return _0xf7b304[_0x222e('0x69')](_0x166b42);}})[_0x222e('0x2e')](function(_0xdd742d){if(_0xdd742d){return _0xdd742d?{'count':_0x16fb16,'rows':_0xdd742d}:null;}})[_0x222e('0x2e')](respondWithResult(_0x52a1e6,null))[_0x222e('0x4d')](handleError(_0x52a1e6,null));};exports['addTeams']=function(_0x1f3f6e,_0x568b40,_0x12a798){var _0x362706=_0x1f3f6e[_0x222e('0x53')][_0x222e('0x6b')];return db['Team']['findAll']({'where':{'id':_0x362706},'attributes':['id'],'include':[{'model':db['User'],'as':_0x222e('0x6c'),'attributes':['id','name',_0x222e('0x6d'),_0x222e('0x6e'),_0x222e('0x6f')],'raw':!![]}]})[_0x222e('0x2e')](function(_0x2bf401){if(_0x2bf401){var _0xbd4ac0=_['flatMap'](_0x2bf401,function(_0x3d01df){var _0x495a79=_0x3d01df[_0x222e('0x54')]({'plain':!![]});return _0x495a79[_0x222e('0x6c')];});return db[_0x222e('0x37')][_0x222e('0x51')]({'where':{'id':_0x1f3f6e['params']['id']}})[_0x222e('0x2e')](function(_0x472b9f){return db[_0x222e('0x70')][_0x222e('0x71')](function(_0x212e0f){return _0x472b9f[_0x222e('0x72')](_0x362706,{'transaction':_0x212e0f})[_0x222e('0x2e')](function(){return BPromise[_0x222e('0x73')](_0xbd4ac0,function(_0x2f936f){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x2f936f['id'],'WhatsappQueueId':_0x1f3f6e[_0x222e('0x4f')]['id']},'transaction':_0x212e0f});});})['then'](function(){_0xbd4ac0['forEach'](function(_0x5cde86){socket[_0x222e('0x74')](_0x222e('0x75'),{'UserId':_0x5cde86['id'],'WhatsappQueueId':_0x472b9f['id']});});});});});}})['then'](respondWithStatusCode(_0x568b40,null))[_0x222e('0x4d')](handleError(_0x568b40,null));};exports[_0x222e('0x76')]=function(_0x3e25ae,_0xe3ac16,_0x2eea38){return db[_0x222e('0x6a')]['findAll']({'where':{'id':_0x3e25ae['query'][_0x222e('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x222e('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe3ac16,null))['then'](function(_0x34237d){var _0x216450=_['map'](_0x34237d,'id');var _0x14870e=[];var _0x262972=[];var _0x4eeade=squel['select']();_0x4eeade[_0x222e('0x77')](_0x222e('0x78'))[_0x222e('0x79')](_0x222e('0x7a'),'tq')[_0x222e('0x7b')](_0x222e('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x222e('0x44')]('WhatsappQueueId\x20=\x20?',_0x3e25ae[_0x222e('0x4f')]['id']);for(var _0x4261e7=0x0;_0x4261e7<_0x34237d[_0x222e('0x3f')];_0x4261e7+=0x1){let _0x5f261b=_0x34237d[_0x4261e7];for(var _0x37534c=0x0;_0x37534c<_0x5f261b[_0x222e('0x6c')][_0x222e('0x3f')];_0x37534c+=0x1){let _0x29f4a1=_0x5f261b[_0x222e('0x6c')][_0x37534c];var _0x51a375=_0x4eeade[_0x222e('0x7d')]();_0x51a375[_0x222e('0x44')](_0x222e('0x7e'),_0x29f4a1['id']);_0x262972['push'](db[_0x222e('0x70')][_0x222e('0x3a')](_0x51a375[_0x222e('0x7f')](),{'type':db[_0x222e('0x70')][_0x222e('0x80')][_0x222e('0x81')]})['then'](function(_0x25b9e9){if(_0x25b9e9[_0x222e('0x3f')]===0x1){return _0x29f4a1['id'];}else{var _0xa53c97=_[_0x222e('0x82')](_[_0x222e('0x36')](_0x25b9e9,_0x222e('0x83')),function(_0xe20e8){return _[_0x222e('0x84')](_0x216450,_0xe20e8);});if(_0xa53c97){return _0x29f4a1['id'];}}}));}}return BPromise[_0x222e('0x85')](_0x262972)['then'](function(_0x47ee71){_0x14870e=_(_0x14870e)[_0x222e('0x86')](_0x47ee71)[_0x222e('0x87')]()['value']();return db[_0x222e('0x37')][_0x222e('0x51')]({'where':{'id':_0x3e25ae[_0x222e('0x4f')]['id']}})['then'](function(_0x2298a1){return db[_0x222e('0x70')][_0x222e('0x71')](function(_0x4554c9){return _0x2298a1['removeTeams'](_0x3e25ae[_0x222e('0x3a')][_0x222e('0x6b')],{'transaction':_0x4554c9})[_0x222e('0x2e')](function(){if(!_[_0x222e('0x88')](_0x14870e)){return _0x2298a1['removeAgents'](_0x14870e,{'transaction':_0x4554c9});}})[_0x222e('0x2e')](function(){_0x14870e[_0x222e('0x89')](function(_0x4962d8){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x4962d8,'WhatsappQueueId':_0x2298a1['id']});});});});});});})[_0x222e('0x2e')](respondWithStatusCode(_0xe3ac16,null))['catch'](handleError(_0xe3ac16,null));};exports[_0x222e('0x8a')]=function(_0x17bb1c,_0x40dead,_0x267d0f){return db['WhatsappQueue'][_0x222e('0x51')]({'where':{'id':_0x17bb1c[_0x222e('0x4f')]['id']}})[_0x222e('0x2e')](handleEntityNotFound(_0x40dead,null))['then'](function(_0x5eca42){if(_0x5eca42){return _0x5eca42['addAgents'](_0x17bb1c[_0x222e('0x53')]['ids'],_[_0x222e('0x8b')](_0x17bb1c[_0x222e('0x53')],[_0x222e('0x6b'),'id'])||{})[_0x222e('0x8c')](function(_0x2ea247){for(var _0x168f43=0x0;_0x168f43<_0x17bb1c['body'][_0x222e('0x6b')]['length'];_0x168f43+=0x1){socket[_0x222e('0x74')](_0x222e('0x75'),{'UserId':Number(_0x17bb1c[_0x222e('0x53')][_0x222e('0x6b')][_0x168f43]),'WhatsappQueueId':Number(_0x17bb1c['params']['id'])});}return _0x2ea247;});}})[_0x222e('0x2e')](respondWithResult(_0x40dead,null))['catch'](handleError(_0x40dead,null));};exports[_0x222e('0x8d')]=function(_0x5e2c17,_0x3a38ba,_0x14da76){return db['WhatsappQueue'][_0x222e('0x51')]({'where':{'id':_0x5e2c17[_0x222e('0x4f')]['id']}})[_0x222e('0x2e')](handleEntityNotFound(_0x3a38ba,null))['then'](function(_0x3fbbe3){if(_0x3fbbe3){return _0x3fbbe3[_0x222e('0x8d')](_0x5e2c17['query'][_0x222e('0x6b')])[_0x222e('0x2e')](function(){if(_['isArray'](_0x5e2c17[_0x222e('0x3a')][_0x222e('0x6b')])){for(var _0x4cdd8f=0x0;_0x4cdd8f<_0x5e2c17[_0x222e('0x3a')]['ids'][_0x222e('0x3f')];_0x4cdd8f+=0x1){socket[_0x222e('0x74')](_0x222e('0x8e'),{'UserId':Number(_0x5e2c17[_0x222e('0x3a')]['ids'][_0x4cdd8f]),'WhatsappQueueId':Number(_0x5e2c17['params']['id'])});}}else{socket[_0x222e('0x74')](_0x222e('0x8e'),{'UserId':Number(_0x5e2c17[_0x222e('0x3a')][_0x222e('0x6b')]),'WhatsappQueueId':Number(_0x5e2c17[_0x222e('0x4f')]['id'])});}});}})[_0x222e('0x2e')](respondWithStatusCode(_0x3a38ba,null))[_0x222e('0x4d')](handleError(_0x3a38ba,null));};exports['getAgents']=function(_0x2737c3,_0x347dc3,_0x5568fc){var _0x362a9e={};var _0x19afbd={};var _0x5289b7;var _0xc09d39;return db[_0x222e('0x37')][_0x222e('0x5c')]({'where':{'id':_0x2737c3[_0x222e('0x4f')]['id']}})[_0x222e('0x2e')](handleEntityNotFound(_0x347dc3,null))[_0x222e('0x2e')](function(_0x4cd529){if(_0x4cd529){_0x5289b7=_0x4cd529;_0x19afbd[_0x222e('0x39')]=_['keys'](db[_0x222e('0x60')][_0x222e('0x38')]);_0x19afbd['query']=_[_0x222e('0x50')](_0x2737c3['query']);_0x19afbd[_0x222e('0x3b')]=_[_0x222e('0x3c')](_0x19afbd[_0x222e('0x39')],_0x19afbd[_0x222e('0x3a')]);_0x362a9e['attributes']=_[_0x222e('0x3c')](_0x19afbd[_0x222e('0x39')],qs[_0x222e('0x3e')](_0x2737c3['query'][_0x222e('0x3e')]));_0x362a9e[_0x222e('0x3d')]=_0x362a9e['attributes'][_0x222e('0x3f')]?_0x362a9e[_0x222e('0x3d')]:_0x19afbd[_0x222e('0x39')];_0x362a9e[_0x222e('0x42')]=qs[_0x222e('0x43')](_0x2737c3[_0x222e('0x3a')][_0x222e('0x43')]);_0x362a9e[_0x222e('0x44')]=qs[_0x222e('0x3b')](_[_0x222e('0x45')](_0x2737c3[_0x222e('0x3a')],_0x19afbd[_0x222e('0x3b')]));if(_0x2737c3[_0x222e('0x3a')][_0x222e('0x46')]){_0x362a9e[_0x222e('0x44')]=_[_0x222e('0x47')](_0x362a9e['where'],{'$or':_[_0x222e('0x36')](_0x362a9e[_0x222e('0x3d')],function(_0x38f3a2){var _0xae299f={};_0xae299f[_0x38f3a2]={'$like':'%'+_0x2737c3[_0x222e('0x3a')][_0x222e('0x46')]+'%'};return _0xae299f;})});}_0x362a9e=_[_0x222e('0x47')]({},_0x362a9e,_0x2737c3[_0x222e('0x49')]);return _0x5289b7['getAgents'](_0x362a9e);}})[_0x222e('0x2e')](function(_0x392354){if(_0x392354){_0xc09d39=_0x392354[_0x222e('0x3f')];if(!_0x2737c3[_0x222e('0x3a')]['hasOwnProperty'](_0x222e('0x41'))){_0x362a9e[_0x222e('0x26')]=qs[_0x222e('0x26')](_0x2737c3[_0x222e('0x3a')][_0x222e('0x26')]);_0x362a9e[_0x222e('0x24')]=qs[_0x222e('0x24')](_0x2737c3[_0x222e('0x3a')][_0x222e('0x24')]);}return _0x5289b7[_0x222e('0x8f')](_0x362a9e);}})[_0x222e('0x2e')](function(_0x524a82){if(_0x524a82){return _0x524a82?{'count':_0xc09d39,'rows':_0x524a82}:null;}})[_0x222e('0x2e')](respondWithResult(_0x347dc3,null))[_0x222e('0x4d')](handleError(_0x347dc3,null));}; \ No newline at end of file +var _0xd603=['set','Content-Range','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','length','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserWhatsappQueue','hasOwnProperty','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','findOne','Team','getTeams','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x616fb8,_0x177e11){var _0x739e20=function(_0xfe27e9){while(--_0xfe27e9){_0x616fb8['push'](_0x616fb8['shift']());}};_0x739e20(++_0x177e11);}(_0xd603,0x6d));var _0x3d60=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xd603[_0x2fbcf6];return _0x3e7265;};'use strict';var emlformat=require(_0x3d60('0x0'));var rimraf=require(_0x3d60('0x1'));var zipdir=require(_0x3d60('0x2'));var jsonpatch=require(_0x3d60('0x3'));var rp=require(_0x3d60('0x4'));var moment=require(_0x3d60('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3d60('0x6'));var csv=require(_0x3d60('0x7'));var ejs=require(_0x3d60('0x8'));var fs=require('fs');var fs_extra=require(_0x3d60('0x9'));var _=require(_0x3d60('0xa'));var squel=require(_0x3d60('0xb'));var crypto=require(_0x3d60('0xc'));var jsforce=require(_0x3d60('0xd'));var deskjs=require(_0x3d60('0xe'));var toCsv=require(_0x3d60('0x7'));var querystring=require(_0x3d60('0xf'));var Papa=require(_0x3d60('0x10'));var Redis=require(_0x3d60('0x11'));var authService=require(_0x3d60('0x12'));var qs=require(_0x3d60('0x13'));var as=require(_0x3d60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d60('0x15'))(_0x3d60('0x16'));var utils=require(_0x3d60('0x17'));var config=require(_0x3d60('0x18'));var licenseUtil=require(_0x3d60('0x19'));var db=require('../../mysqldb')['db'];config[_0x3d60('0x1a')]=_[_0x3d60('0x1b')](config['redis'],{'host':_0x3d60('0x1c'),'port':0x18eb});var socket=require(_0x3d60('0x1d'))(new Redis(config[_0x3d60('0x1a')]));require('./whatsappQueue.socket')[_0x3d60('0x1e')](socket);function respondWithStatusCode(_0x2b6c06,_0x81c9d4){_0x81c9d4=_0x81c9d4||0xcc;return function(_0x16803c){if(_0x16803c){return _0x2b6c06[_0x3d60('0x1f')](_0x81c9d4);}return _0x2b6c06[_0x3d60('0x20')](_0x81c9d4)[_0x3d60('0x21')]();};}function respondWithResult(_0x4377a0,_0x1490c4){_0x1490c4=_0x1490c4||0xc8;return function(_0x205303){if(_0x205303){return _0x4377a0[_0x3d60('0x20')](_0x1490c4)[_0x3d60('0x22')](_0x205303);}};}function respondWithFilteredResult(_0x41343a,_0x32a04b){return function(_0x3c8196){if(_0x3c8196){var _0x45997f=typeof _0x32a04b[_0x3d60('0x23')]===_0x3d60('0x24')&&typeof _0x32a04b[_0x3d60('0x25')]===_0x3d60('0x24');var _0xff166d=_0x3c8196['count'];var _0x31f693=_0x45997f?0x0:_0x32a04b['offset'];var _0x230951=_0x45997f?_0x3c8196['count']:_0x32a04b['offset']+_0x32a04b['limit'];var _0x22d256;if(_0x230951>=_0xff166d){_0x230951=_0xff166d;_0x22d256=0xc8;}else{_0x22d256=0xce;}_0x41343a['status'](_0x22d256);return _0x41343a[_0x3d60('0x26')](_0x3d60('0x27'),_0x31f693+'-'+_0x230951+'/'+_0xff166d)[_0x3d60('0x22')](_0x3c8196);}return null;};}function patchUpdates(_0x4cce05){return function(_0x2f16ab){try{jsonpatch['apply'](_0x2f16ab,_0x4cce05,!![]);}catch(_0x2d1e90){return BPromise[_0x3d60('0x28')](_0x2d1e90);}return _0x2f16ab['save']();};}function saveUpdates(_0x164801,_0x3bd5d7){return function(_0xb70e5d){if(_0xb70e5d){return _0xb70e5d[_0x3d60('0x29')](_0x164801)[_0x3d60('0x2a')](function(_0x353fa0){return _0x353fa0;});}return null;};}function removeEntity(_0x1ee120,_0xd0044c){return function(_0x29c45f){if(_0x29c45f){return _0x29c45f['destroy']()[_0x3d60('0x2a')](function(){var _0x52c302=_0x29c45f[_0x3d60('0x2b')]({'plain':!![]});var _0x4fbf7e=_0x3d60('0x2c');return db[_0x3d60('0x2d')][_0x3d60('0x2e')]({'where':{'type':_0x4fbf7e,'resourceId':_0x52c302['id']}})[_0x3d60('0x2a')](function(){return _0x29c45f;});})[_0x3d60('0x2a')](function(){_0x1ee120[_0x3d60('0x20')](0xcc)[_0x3d60('0x21')]();});}};}function handleEntityNotFound(_0xc57ebd,_0x590c1f){return function(_0x466108){if(!_0x466108){_0xc57ebd[_0x3d60('0x1f')](0x194);}return _0x466108;};}function handleError(_0x4dabfd,_0x2299cc){_0x2299cc=_0x2299cc||0x1f4;return function(_0x2c4bcb){logger[_0x3d60('0x2f')](_0x2c4bcb[_0x3d60('0x30')]);if(_0x2c4bcb['name']){delete _0x2c4bcb[_0x3d60('0x31')];}_0x4dabfd[_0x3d60('0x20')](_0x2299cc)[_0x3d60('0x32')](_0x2c4bcb);};}exports[_0x3d60('0x33')]=function(_0x31582f,_0x7c4c39){var _0x5d5d23={},_0x5f476b={},_0x484824={'count':0x0,'rows':[]};var _0x12cf36=_[_0x3d60('0x34')](db[_0x3d60('0x35')][_0x3d60('0x36')],function(_0x501ada){return{'name':_0x501ada[_0x3d60('0x37')],'type':_0x501ada[_0x3d60('0x38')][_0x3d60('0x39')]};});_0x5f476b['model']=_['map'](_0x12cf36,'name');_0x5f476b[_0x3d60('0x3a')]=_[_0x3d60('0x3b')](_0x31582f['query']);_0x5f476b[_0x3d60('0x3c')]=_['intersection'](_0x5f476b[_0x3d60('0x3d')],_0x5f476b['query']);_0x5d5d23['attributes']=_[_0x3d60('0x3e')](_0x5f476b[_0x3d60('0x3d')],qs[_0x3d60('0x3f')](_0x31582f['query']['fields']));_0x5d5d23['attributes']=_0x5d5d23['attributes'][_0x3d60('0x40')]?_0x5d5d23[_0x3d60('0x41')]:_0x5f476b[_0x3d60('0x3d')];if(!_0x31582f[_0x3d60('0x3a')]['hasOwnProperty'](_0x3d60('0x42'))){_0x5d5d23[_0x3d60('0x25')]=qs[_0x3d60('0x25')](_0x31582f['query']['limit']);_0x5d5d23['offset']=qs[_0x3d60('0x23')](_0x31582f[_0x3d60('0x3a')][_0x3d60('0x23')]);}_0x5d5d23[_0x3d60('0x43')]=qs[_0x3d60('0x44')](_0x31582f['query']['sort']);_0x5d5d23['where']=qs['filters'](_[_0x3d60('0x45')](_0x31582f[_0x3d60('0x3a')],_0x5f476b[_0x3d60('0x3c')]),_0x12cf36);if(_0x31582f[_0x3d60('0x3a')][_0x3d60('0x46')]){_0x5d5d23[_0x3d60('0x47')]=_[_0x3d60('0x48')](_0x5d5d23[_0x3d60('0x47')],{'$or':_[_0x3d60('0x34')](_0x12cf36,function(_0x41145b){if(_0x41145b[_0x3d60('0x38')]!==_0x3d60('0x49')){var _0x270a5a={};_0x270a5a[_0x41145b[_0x3d60('0x31')]]={'$like':'%'+_0x31582f[_0x3d60('0x3a')][_0x3d60('0x46')]+'%'};return _0x270a5a;}})});}_0x5d5d23=_[_0x3d60('0x48')]({},_0x5d5d23,_0x31582f[_0x3d60('0x4a')]);var _0x3fd1ca={'where':_0x5d5d23[_0x3d60('0x47')]};return db['WhatsappQueue'][_0x3d60('0x4b')](_0x3fd1ca)[_0x3d60('0x2a')](function(_0x2a7c68){_0x484824[_0x3d60('0x4b')]=_0x2a7c68;if(_0x31582f[_0x3d60('0x3a')][_0x3d60('0x4c')]){_0x5d5d23[_0x3d60('0x4d')]=[{'all':!![]}];}return db[_0x3d60('0x35')][_0x3d60('0x4e')](_0x5d5d23);})[_0x3d60('0x2a')](function(_0xb77046){_0x484824[_0x3d60('0x4f')]=_0xb77046;return _0x484824;})['then'](respondWithFilteredResult(_0x7c4c39,_0x5d5d23))[_0x3d60('0x50')](handleError(_0x7c4c39,null));};exports['show']=function(_0x10998a,_0x33c432){var _0x3ada7b={'raw':!![],'where':{'id':_0x10998a[_0x3d60('0x51')]['id']}},_0x5c188a={};_0x5c188a['model']=_['keys'](db['WhatsappQueue'][_0x3d60('0x36')]);_0x5c188a[_0x3d60('0x3a')]=_[_0x3d60('0x3b')](_0x10998a[_0x3d60('0x3a')]);_0x5c188a[_0x3d60('0x3c')]=_[_0x3d60('0x3e')](_0x5c188a['model'],_0x5c188a[_0x3d60('0x3a')]);_0x3ada7b[_0x3d60('0x41')]=_['intersection'](_0x5c188a[_0x3d60('0x3d')],qs['fields'](_0x10998a[_0x3d60('0x3a')][_0x3d60('0x3f')]));_0x3ada7b[_0x3d60('0x41')]=_0x3ada7b[_0x3d60('0x41')]['length']?_0x3ada7b[_0x3d60('0x41')]:_0x5c188a[_0x3d60('0x3d')];if(_0x10998a['query'][_0x3d60('0x4c')]){_0x3ada7b[_0x3d60('0x4d')]=[{'all':!![]}];}_0x3ada7b=_[_0x3d60('0x48')]({},_0x3ada7b,_0x10998a[_0x3d60('0x4a')]);return db[_0x3d60('0x35')]['find'](_0x3ada7b)['then'](handleEntityNotFound(_0x33c432,null))[_0x3d60('0x2a')](respondWithResult(_0x33c432,null))[_0x3d60('0x50')](handleError(_0x33c432,null));};exports[_0x3d60('0x52')]=function(_0xde9e38,_0x3dde8b){return db[_0x3d60('0x35')][_0x3d60('0x52')](_0xde9e38['body'],{})['then'](function(_0x4a6bde){var _0x460b96=_0xde9e38['user'][_0x3d60('0x2b')]({'plain':!![]});if(!_0x460b96)throw new Error(_0x3d60('0x53'));if(_0x460b96[_0x3d60('0x54')]===_0x3d60('0x55')){var _0x37441f=_0x4a6bde[_0x3d60('0x2b')]({'plain':!![]});var _0x453415=_0x3d60('0x2c');return db[_0x3d60('0x56')][_0x3d60('0x57')]({'where':{'name':_0x453415,'userProfileId':_0x460b96[_0x3d60('0x58')]},'raw':!![]})[_0x3d60('0x2a')](function(_0x15914b){if(_0x15914b&&_0x15914b[_0x3d60('0x59')]===0x0){return db[_0x3d60('0x2d')]['create']({'name':_0x37441f[_0x3d60('0x31')],'resourceId':_0x37441f['id'],'type':_0x15914b[_0x3d60('0x31')],'sectionId':_0x15914b['id']},{})[_0x3d60('0x2a')](function(){return _0x4a6bde;});}else{return _0x4a6bde;}})['catch'](function(_0x1f392e){logger['error'](_0x3d60('0x5a'),_0x1f392e);throw _0x1f392e;});}return _0x4a6bde;})[_0x3d60('0x2a')](respondWithResult(_0x3dde8b,0xc9))[_0x3d60('0x50')](handleError(_0x3dde8b,null));};exports[_0x3d60('0x29')]=function(_0x1ad4d0,_0x252fb2){if(_0x1ad4d0[_0x3d60('0x5b')]['id']){delete _0x1ad4d0['body']['id'];}return db[_0x3d60('0x35')][_0x3d60('0x57')]({'where':{'id':_0x1ad4d0[_0x3d60('0x51')]['id']}})[_0x3d60('0x2a')](handleEntityNotFound(_0x252fb2,null))['then'](saveUpdates(_0x1ad4d0[_0x3d60('0x5b')],null))[_0x3d60('0x2a')](respondWithResult(_0x252fb2,null))[_0x3d60('0x50')](handleError(_0x252fb2,null));};exports[_0x3d60('0x2e')]=function(_0x10725c,_0x199321){return db['WhatsappQueue'][_0x3d60('0x57')]({'where':{'id':_0x10725c['params']['id']}})[_0x3d60('0x2a')](handleEntityNotFound(_0x199321,null))['then'](removeEntity(_0x199321,null))[_0x3d60('0x50')](handleError(_0x199321,null));};exports[_0x3d60('0x5c')]=function(_0x5e1c01,_0x1ddff6){return db['WhatsappQueue'][_0x3d60('0x5c')]()[_0x3d60('0x2a')](respondWithResult(_0x1ddff6,null))[_0x3d60('0x50')](handleError(_0x1ddff6,null));};exports[_0x3d60('0x5d')]=function(_0x2e24a6,_0xa3f20e,_0x541e89){var _0x3cc142={'raw':!![],'where':{}},_0x537173={},_0x366afc;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2e24a6[_0x3d60('0x51')]['id']}})[_0x3d60('0x2a')](handleEntityNotFound(_0xa3f20e,null))['then'](function(_0x244b5a){if(_0x244b5a){_0x366afc=_0x244b5a[_0x3d60('0x2b')]({'plain':!![]});_0x537173[_0x3d60('0x3d')]=_[_0x3d60('0x3b')](db[_0x3d60('0x5e')]['rawAttributes']);_0x537173[_0x3d60('0x3a')]=_[_0x3d60('0x3b')](_0x2e24a6[_0x3d60('0x3a')]);_0x537173[_0x3d60('0x3c')]=_[_0x3d60('0x3e')](_0x537173[_0x3d60('0x3d')],_0x537173['query']);_0x3cc142[_0x3d60('0x41')]=_[_0x3d60('0x3e')](_0x537173[_0x3d60('0x3d')],qs[_0x3d60('0x3f')](_0x2e24a6[_0x3d60('0x3a')][_0x3d60('0x3f')]));_0x3cc142['attributes']=_0x3cc142[_0x3d60('0x41')][_0x3d60('0x40')]?_0x3cc142[_0x3d60('0x41')]:_0x537173['model'];if(!_0x2e24a6[_0x3d60('0x3a')][_0x3d60('0x5f')](_0x3d60('0x42'))){_0x3cc142['limit']=qs[_0x3d60('0x25')](_0x2e24a6[_0x3d60('0x3a')][_0x3d60('0x25')]);_0x3cc142[_0x3d60('0x23')]=qs[_0x3d60('0x23')](_0x2e24a6[_0x3d60('0x3a')][_0x3d60('0x23')]);}_0x3cc142['order']=qs[_0x3d60('0x44')](_0x2e24a6[_0x3d60('0x3a')][_0x3d60('0x44')]);_0x3cc142[_0x3d60('0x47')]=qs[_0x3d60('0x3c')](_[_0x3d60('0x45')](_0x2e24a6['query'],_0x537173[_0x3d60('0x3c')]));_0x3cc142[_0x3d60('0x47')]['WhatsappQueueId']=_0x244b5a['id'];if(_0x2e24a6[_0x3d60('0x3a')]['filter']){_0x3cc142['where']=_[_0x3d60('0x48')](_0x3cc142['where'],{'$or':_[_0x3d60('0x34')](_0x3cc142[_0x3d60('0x41')],function(_0x49428d){var _0x1159fc={};_0x1159fc[_0x49428d]={'$like':'%'+_0x2e24a6[_0x3d60('0x3a')][_0x3d60('0x46')]+'%'};return _0x1159fc;})});}_0x3cc142=_[_0x3d60('0x48')]({},_0x3cc142,_0x2e24a6[_0x3d60('0x4a')]);return db[_0x3d60('0x5e')][_0x3d60('0x4e')](_0x3cc142);}})[_0x3d60('0x2a')](function(_0x4992ba){if(_0x4992ba){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x4992ba,_0x3d60('0x60')),'role':_0x3d60('0x61')},'attributes':['id',_0x3d60('0x31'),_0x3d60('0x62'),_0x3d60('0x63'),_0x3d60('0x64')]});}})[_0x3d60('0x2a')](function(_0x55cf36){if(_0x55cf36){return{'count':_0x55cf36[_0x3d60('0x4b')],'rows':_['map'](_0x55cf36[_0x3d60('0x4f')],function(_0x13836b){return{'membername':_0x13836b['name'],'UserId':_0x13836b['id'],'queue_name':_0x366afc['name'],'WhatsappQueueId':_0x366afc['id'],'interface':util[_0x3d60('0x65')](_0x3d60('0x66'),'SIP',_0x13836b[_0x3d60('0x31')]),'penalty':0x0,'paused':_0x13836b[_0x3d60('0x62')],'createdAt':_0x13836b[_0x3d60('0x64')],'updatedAt':_0x13836b[_0x3d60('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3d60('0x2a')](respondWithFilteredResult(_0xa3f20e,_0x3cc142))[_0x3d60('0x50')](handleError(_0xa3f20e,null));};exports['getTeams']=function(_0x2de202,_0x96f68b,_0x4758cc){var _0x4d3c2b={};var _0x2d3724={};var _0x18b74f;var _0x22955a;return db['WhatsappQueue'][_0x3d60('0x67')]({'where':{'id':_0x2de202[_0x3d60('0x51')]['id']}})[_0x3d60('0x2a')](handleEntityNotFound(_0x96f68b,null))[_0x3d60('0x2a')](function(_0x1a549c){if(_0x1a549c){_0x18b74f=_0x1a549c;_0x2d3724[_0x3d60('0x3d')]=_[_0x3d60('0x3b')](db[_0x3d60('0x68')][_0x3d60('0x36')]);_0x2d3724['query']=_[_0x3d60('0x3b')](_0x2de202[_0x3d60('0x3a')]);_0x2d3724['filters']=_['intersection'](_0x2d3724[_0x3d60('0x3d')],_0x2d3724[_0x3d60('0x3a')]);_0x4d3c2b[_0x3d60('0x41')]=_[_0x3d60('0x3e')](_0x2d3724[_0x3d60('0x3d')],qs['fields'](_0x2de202['query'][_0x3d60('0x3f')]));_0x4d3c2b['attributes']=_0x4d3c2b[_0x3d60('0x41')][_0x3d60('0x40')]?_0x4d3c2b[_0x3d60('0x41')]:_0x2d3724[_0x3d60('0x3d')];_0x4d3c2b[_0x3d60('0x43')]=qs[_0x3d60('0x44')](_0x2de202[_0x3d60('0x3a')]['sort']);_0x4d3c2b[_0x3d60('0x47')]=qs['filters'](_[_0x3d60('0x45')](_0x2de202[_0x3d60('0x3a')],_0x2d3724[_0x3d60('0x3c')]));if(_0x2de202['query'][_0x3d60('0x46')]){_0x4d3c2b['where']=_[_0x3d60('0x48')](_0x4d3c2b['where'],{'$or':_['map'](_0x4d3c2b['attributes'],function(_0x88b9b1){var _0x14e717={};_0x14e717[_0x88b9b1]={'$like':'%'+_0x2de202[_0x3d60('0x3a')]['filter']+'%'};return _0x14e717;})});}_0x4d3c2b=_['merge']({},_0x4d3c2b,_0x2de202[_0x3d60('0x4a')]);return _0x18b74f[_0x3d60('0x69')](_0x4d3c2b);}})['then'](function(_0x21494e){if(_0x21494e){_0x22955a=_0x21494e[_0x3d60('0x40')];if(!_0x2de202['query']['hasOwnProperty']('nolimit')){_0x4d3c2b[_0x3d60('0x25')]=qs[_0x3d60('0x25')](_0x2de202[_0x3d60('0x3a')]['limit']);_0x4d3c2b[_0x3d60('0x23')]=qs[_0x3d60('0x23')](_0x2de202[_0x3d60('0x3a')][_0x3d60('0x23')]);}return _0x18b74f['getTeams'](_0x4d3c2b);}})[_0x3d60('0x2a')](function(_0x51e33a){if(_0x51e33a){return _0x51e33a?{'count':_0x22955a,'rows':_0x51e33a}:null;}})[_0x3d60('0x2a')](respondWithResult(_0x96f68b,null))[_0x3d60('0x50')](handleError(_0x96f68b,null));};exports[_0x3d60('0x6a')]=function(_0xb9d090,_0x31e797,_0x4fc7b3){var _0x263896=_0xb9d090[_0x3d60('0x5b')][_0x3d60('0x6b')];return db[_0x3d60('0x68')][_0x3d60('0x4e')]({'where':{'id':_0x263896},'attributes':['id'],'include':[{'model':db[_0x3d60('0x6c')],'as':_0x3d60('0x6d'),'attributes':['id',_0x3d60('0x31'),'online',_0x3d60('0x6e'),_0x3d60('0x6f')],'raw':!![]}]})[_0x3d60('0x2a')](function(_0x26a0a9){if(_0x26a0a9){var _0x7885a2=_[_0x3d60('0x70')](_0x26a0a9,function(_0x249ebe){var _0x5efa40=_0x249ebe[_0x3d60('0x2b')]({'plain':!![]});return _0x5efa40[_0x3d60('0x6d')];});return db[_0x3d60('0x35')][_0x3d60('0x57')]({'where':{'id':_0xb9d090[_0x3d60('0x51')]['id']}})[_0x3d60('0x2a')](function(_0x189170){return db[_0x3d60('0x71')][_0x3d60('0x72')](function(_0x52052e){return _0x189170[_0x3d60('0x6a')](_0x263896,{'transaction':_0x52052e})[_0x3d60('0x2a')](function(){return BPromise[_0x3d60('0x73')](_0x7885a2,function(_0x488850){return db[_0x3d60('0x5e')][_0x3d60('0x74')]({'where':{'UserId':_0x488850['id'],'WhatsappQueueId':_0xb9d090[_0x3d60('0x51')]['id']},'transaction':_0x52052e});});})[_0x3d60('0x2a')](function(){_0x7885a2[_0x3d60('0x75')](function(_0xc12041){socket[_0x3d60('0x76')]('userWhatsappQueue:save',{'UserId':_0xc12041['id'],'WhatsappQueueId':_0x189170['id']});});});});});}})[_0x3d60('0x2a')](respondWithStatusCode(_0x31e797,null))[_0x3d60('0x50')](handleError(_0x31e797,null));};exports[_0x3d60('0x77')]=function(_0x59bb28,_0x68d3f4,_0x36ae6a){return db[_0x3d60('0x68')]['findAll']({'where':{'id':_0x59bb28[_0x3d60('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3d60('0x6c')],'as':_0x3d60('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x3d60('0x2a')](handleEntityNotFound(_0x68d3f4,null))[_0x3d60('0x2a')](function(_0x1ae187){var _0x3c2502=_[_0x3d60('0x34')](_0x1ae187,'id');var _0x1900e9=[];var _0x54896e=[];var _0x1058ff=squel[_0x3d60('0x78')]();_0x1058ff[_0x3d60('0x79')]('tq.TeamId')[_0x3d60('0x7a')]('team_has_whatsapp_queues','tq')[_0x3d60('0x7b')](_0x3d60('0x7c'),'ut',_0x3d60('0x7d'))[_0x3d60('0x47')](_0x3d60('0x7e'),_0x59bb28[_0x3d60('0x51')]['id']);for(var _0x191eb4=0x0;_0x191eb4<_0x1ae187[_0x3d60('0x40')];_0x191eb4+=0x1){let _0x42c694=_0x1ae187[_0x191eb4];for(var _0x14d0b5=0x0;_0x14d0b5<_0x42c694[_0x3d60('0x6d')]['length'];_0x14d0b5+=0x1){let _0x303aff=_0x42c694[_0x3d60('0x6d')][_0x14d0b5];var _0x573d54=_0x1058ff[_0x3d60('0x7f')]();_0x573d54[_0x3d60('0x47')](_0x3d60('0x80'),_0x303aff['id']);_0x54896e[_0x3d60('0x81')](db[_0x3d60('0x71')][_0x3d60('0x3a')](_0x573d54[_0x3d60('0x82')](),{'type':db[_0x3d60('0x71')][_0x3d60('0x83')][_0x3d60('0x84')]})[_0x3d60('0x2a')](function(_0x3f36f9){if(_0x3f36f9[_0x3d60('0x40')]===0x1){return _0x303aff['id'];}else{var _0x81a5fe=_[_0x3d60('0x85')](_['map'](_0x3f36f9,_0x3d60('0x86')),function(_0x4f6427){return _[_0x3d60('0x87')](_0x3c2502,_0x4f6427);});if(_0x81a5fe){return _0x303aff['id'];}}}));}}return BPromise[_0x3d60('0x88')](_0x54896e)[_0x3d60('0x2a')](function(_0x2dd422){_0x1900e9=_(_0x1900e9)[_0x3d60('0x89')](_0x2dd422)[_0x3d60('0x8a')]()[_0x3d60('0x8b')]();return db['WhatsappQueue'][_0x3d60('0x57')]({'where':{'id':_0x59bb28[_0x3d60('0x51')]['id']}})[_0x3d60('0x2a')](function(_0x31bc21){return db[_0x3d60('0x71')][_0x3d60('0x72')](function(_0x3b8359){return _0x31bc21[_0x3d60('0x77')](_0x59bb28[_0x3d60('0x3a')][_0x3d60('0x6b')],{'transaction':_0x3b8359})[_0x3d60('0x2a')](function(){if(!_[_0x3d60('0x8c')](_0x1900e9)){return _0x31bc21['removeAgents'](_0x1900e9,{'transaction':_0x3b8359});}})['then'](function(){_0x1900e9[_0x3d60('0x75')](function(_0x2afda4){socket['emit'](_0x3d60('0x8d'),{'UserId':_0x2afda4,'WhatsappQueueId':_0x31bc21['id']});});});});});});})['then'](respondWithStatusCode(_0x68d3f4,null))['catch'](handleError(_0x68d3f4,null));};exports['addAgents']=function(_0x2ce3c8,_0x5857df,_0x4fe8f8){return db[_0x3d60('0x35')][_0x3d60('0x57')]({'where':{'id':_0x2ce3c8[_0x3d60('0x51')]['id']}})['then'](handleEntityNotFound(_0x5857df,null))[_0x3d60('0x2a')](function(_0x4bb110){if(_0x4bb110){return _0x4bb110[_0x3d60('0x8e')](_0x2ce3c8[_0x3d60('0x5b')][_0x3d60('0x6b')],_[_0x3d60('0x8f')](_0x2ce3c8[_0x3d60('0x5b')],[_0x3d60('0x6b'),'id'])||{})['spread'](function(_0x39f397){for(var _0x28643d=0x0;_0x28643d<_0x2ce3c8['body']['ids'][_0x3d60('0x40')];_0x28643d+=0x1){socket[_0x3d60('0x76')](_0x3d60('0x90'),{'UserId':Number(_0x2ce3c8[_0x3d60('0x5b')][_0x3d60('0x6b')][_0x28643d]),'WhatsappQueueId':Number(_0x2ce3c8[_0x3d60('0x51')]['id'])});}return _0x39f397;});}})[_0x3d60('0x2a')](respondWithResult(_0x5857df,null))[_0x3d60('0x50')](handleError(_0x5857df,null));};exports[_0x3d60('0x91')]=function(_0x508523,_0x1b8662,_0x4a98cf){return db[_0x3d60('0x35')][_0x3d60('0x57')]({'where':{'id':_0x508523[_0x3d60('0x51')]['id']}})['then'](handleEntityNotFound(_0x1b8662,null))[_0x3d60('0x2a')](function(_0x4ae5f9){if(_0x4ae5f9){return _0x4ae5f9['removeAgents'](_0x508523[_0x3d60('0x3a')][_0x3d60('0x6b')])['then'](function(){if(_['isArray'](_0x508523[_0x3d60('0x3a')][_0x3d60('0x6b')])){for(var _0x50ae06=0x0;_0x50ae06<_0x508523[_0x3d60('0x3a')][_0x3d60('0x6b')]['length'];_0x50ae06+=0x1){socket[_0x3d60('0x76')](_0x3d60('0x8d'),{'UserId':Number(_0x508523[_0x3d60('0x3a')][_0x3d60('0x6b')][_0x50ae06]),'WhatsappQueueId':Number(_0x508523[_0x3d60('0x51')]['id'])});}}else{socket[_0x3d60('0x76')](_0x3d60('0x8d'),{'UserId':Number(_0x508523[_0x3d60('0x3a')]['ids']),'WhatsappQueueId':Number(_0x508523[_0x3d60('0x51')]['id'])});}});}})[_0x3d60('0x2a')](respondWithStatusCode(_0x1b8662,null))[_0x3d60('0x50')](handleError(_0x1b8662,null));};exports[_0x3d60('0x92')]=function(_0x45be06,_0x5c59ff,_0x486c42){var _0xaee85d={};var _0x3df420={};var _0x1709ff;var _0xb940b3;return db[_0x3d60('0x35')]['findOne']({'where':{'id':_0x45be06[_0x3d60('0x51')]['id']}})['then'](handleEntityNotFound(_0x5c59ff,null))[_0x3d60('0x2a')](function(_0x196743){if(_0x196743){_0x1709ff=_0x196743;_0x3df420['model']=_[_0x3d60('0x3b')](db['User'][_0x3d60('0x36')]);_0x3df420['query']=_[_0x3d60('0x3b')](_0x45be06['query']);_0x3df420[_0x3d60('0x3c')]=_[_0x3d60('0x3e')](_0x3df420[_0x3d60('0x3d')],_0x3df420[_0x3d60('0x3a')]);_0xaee85d['attributes']=_['intersection'](_0x3df420[_0x3d60('0x3d')],qs[_0x3d60('0x3f')](_0x45be06['query']['fields']));_0xaee85d[_0x3d60('0x41')]=_0xaee85d['attributes'][_0x3d60('0x40')]?_0xaee85d[_0x3d60('0x41')]:_0x3df420[_0x3d60('0x3d')];_0xaee85d[_0x3d60('0x43')]=qs['sort'](_0x45be06['query']['sort']);_0xaee85d[_0x3d60('0x47')]=qs[_0x3d60('0x3c')](_[_0x3d60('0x45')](_0x45be06[_0x3d60('0x3a')],_0x3df420[_0x3d60('0x3c')]));if(_0x45be06[_0x3d60('0x3a')]['filter']){_0xaee85d[_0x3d60('0x47')]=_['merge'](_0xaee85d[_0x3d60('0x47')],{'$or':_[_0x3d60('0x34')](_0xaee85d[_0x3d60('0x41')],function(_0x2cfa8a){var _0x2b36ee={};_0x2b36ee[_0x2cfa8a]={'$like':'%'+_0x45be06['query']['filter']+'%'};return _0x2b36ee;})});}_0xaee85d=_[_0x3d60('0x48')]({},_0xaee85d,_0x45be06[_0x3d60('0x4a')]);return _0x1709ff[_0x3d60('0x92')](_0xaee85d);}})[_0x3d60('0x2a')](function(_0x543484){if(_0x543484){_0xb940b3=_0x543484[_0x3d60('0x40')];if(!_0x45be06[_0x3d60('0x3a')][_0x3d60('0x5f')](_0x3d60('0x42'))){_0xaee85d[_0x3d60('0x25')]=qs[_0x3d60('0x25')](_0x45be06['query']['limit']);_0xaee85d[_0x3d60('0x23')]=qs[_0x3d60('0x23')](_0x45be06[_0x3d60('0x3a')][_0x3d60('0x23')]);}return _0x1709ff[_0x3d60('0x92')](_0xaee85d);}})['then'](function(_0x46655e){if(_0x46655e){return _0x46655e?{'count':_0xb940b3,'rows':_0x46655e}:null;}})[_0x3d60('0x2a')](respondWithResult(_0x5c59ff,null))[_0x3d60('0x50')](handleError(_0x5c59ff,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 486f94e..e08bfc9 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb18f=['exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0xb18f,0xa1));var _0xfb18=function(_0x12576c,_0x5cb23e){_0x12576c=_0x12576c-0x0;var _0x332f21=_0xb18f[_0x12576c];return _0x332f21;};'use strict';var EventEmitter=require(_0xfb18('0x0'));var WhatsappQueue=require(_0xfb18('0x1'))['db'][_0xfb18('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfb18('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfb18('0x4')};function emitEvent(_0x3b5919){return function(_0x2d65f7,_0x1dd0e0,_0x200972){WhatsappQueueEvents[_0xfb18('0x5')](_0x3b5919+':'+_0x2d65f7['id'],_0x2d65f7);WhatsappQueueEvents[_0xfb18('0x5')](_0x3b5919,_0x2d65f7);_0x200972(null);};}for(var e in events){if(events[_0xfb18('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xfb18('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xd855=['hasOwnProperty','hook','exports','events','../../mysqldb','remove','emit'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xd855,0x161));var _0x5d85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd855[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x5d85('0x0'));var WhatsappQueue=require(_0x5d85('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5d85('0x2')};function emitEvent(_0x1812b1){return function(_0x4dc245,_0x5e033c,_0x14f5d0){WhatsappQueueEvents[_0x5d85('0x3')](_0x1812b1+':'+_0x4dc245['id'],_0x4dc245);WhatsappQueueEvents[_0x5d85('0x3')](_0x1812b1,_0x4dc245);_0x14f5d0(null);};}for(var e in events){if(events[_0x5d85('0x4')](e)){var event=events[e];WhatsappQueue[_0x5d85('0x5')](e,emitEvent(event));}}module[_0x5d85('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d41089f..efcc629 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe590=['define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x571339,_0x5bcafb){var _0x5af8a6=function(_0x389251){while(--_0x389251){_0x571339['push'](_0x571339['shift']());}};_0x5af8a6(++_0x5bcafb);}(_0xe590,0x177));var _0x0e59=function(_0x5cc702,_0x4c0579){_0x5cc702=_0x5cc702-0x0;var _0x2b38b4=_0xe590[_0x5cc702];return _0x2b38b4;};'use strict';var _=require('lodash');var util=require(_0x0e59('0x0'));var logger=require(_0x0e59('0x1'))(_0x0e59('0x2'));var moment=require('moment');var BPromise=require(_0x0e59('0x3'));var rp=require(_0x0e59('0x4'));var fs=require('fs');var path=require(_0x0e59('0x5'));var rimraf=require(_0x0e59('0x6'));var config=require(_0x0e59('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x0e59('0x8')]=function(_0x409548,_0x3a371b){return _0x409548[_0x0e59('0x9')](_0x0e59('0xa'),attributes,{'tableName':_0x0e59('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff14=['WhatsappQueue','whatsapp_queues','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x56b04c,_0x3a6488){var _0x50209a=function(_0x317091){while(--_0x317091){_0x56b04c['push'](_0x56b04c['shift']());}};_0x50209a(++_0x3a6488);}(_0xff14,0xba));var _0x4ff1=function(_0x3a5105,_0x11f35c){_0x3a5105=_0x3a5105-0x0;var _0x53633f=_0xff14[_0x3a5105];return _0x53633f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4ff1('0x0'));var moment=require(_0x4ff1('0x1'));var BPromise=require(_0x4ff1('0x2'));var rp=require(_0x4ff1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ff1('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x4ff1('0x5')]=function(_0x5667ff,_0x4b4411){return _0x5667ff['define'](_0x4ff1('0x6'),attributes,{'tableName':_0x4ff1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 675230d..46d90c3 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa42d=['WhatsappQueue','findAll','options','where','attributes','limit','map','model','include','GetWhatsappQueue','stringify','find','raw','ShowWhatsappQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xa42d,0x194));var _0xda42=function(_0xc5c730,_0x7c2119){_0xc5c730=_0xc5c730-0x0;var _0x7b1d6=_0xa42d[_0xc5c730];return _0x7b1d6;};'use strict';var _=require('lodash');var util=require(_0xda42('0x0'));var moment=require(_0xda42('0x1'));var BPromise=require(_0xda42('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda42('0x3'));var db=require(_0xda42('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda42('0x5'))(_0xda42('0x6'));var config=require(_0xda42('0x7'));var jayson=require(_0xda42('0x8'));var client=jayson['client'][_0xda42('0x9')]({'port':0x232a});config[_0xda42('0xa')]=_['defaults'](config[_0xda42('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xda42('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xda42('0xc')](socket);function respondWithRpcPromise(_0x280e9c,_0x503e93,_0x478d9a){return new BPromise(function(_0x57b197,_0x5a31d2){return client[_0xda42('0xd')](_0x280e9c,_0x478d9a)[_0xda42('0xe')](function(_0x455d4f){logger['info'](_0xda42('0xf'),_0x503e93,_0xda42('0x10'));logger[_0xda42('0x11')](_0xda42('0x12'),_0x503e93,'request\x20sent',JSON['stringify'](_0x455d4f));if(_0x455d4f[_0xda42('0x13')]){if(_0x455d4f[_0xda42('0x13')][_0xda42('0x14')]===0x1f4){logger[_0xda42('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x503e93,_0x455d4f[_0xda42('0x13')][_0xda42('0x15')]);return _0x5a31d2(_0x455d4f[_0xda42('0x13')][_0xda42('0x15')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x503e93,_0x455d4f['error'][_0xda42('0x15')]);return _0x57b197(_0x455d4f[_0xda42('0x13')][_0xda42('0x15')]);}else{logger[_0xda42('0x16')](_0xda42('0xf'),_0x503e93,_0xda42('0x10'));_0x57b197(_0x455d4f[_0xda42('0x17')][_0xda42('0x15')]);}})[_0xda42('0x18')](function(_0x101ab4){logger[_0xda42('0x13')](_0xda42('0xf'),_0x503e93,_0x101ab4);_0x5a31d2(_0x101ab4);});});}exports['GetWhatsappQueue']=function(_0x176be5){var _0xa8913=this;return new Promise(function(_0x1b1298,_0x501c57){return db[_0xda42('0x19')][_0xda42('0x1a')]({'raw':_0x176be5['options']?_0x176be5[_0xda42('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x176be5['options']?_0x176be5[_0xda42('0x1b')][_0xda42('0x1c')]||null:null,'attributes':_0x176be5[_0xda42('0x1b')]?_0x176be5['options'][_0xda42('0x1d')]||null:null,'limit':_0x176be5[_0xda42('0x1b')]?_0x176be5[_0xda42('0x1b')][_0xda42('0x1e')]||null:null,'include':_0x176be5[_0xda42('0x1b')]?_0x176be5[_0xda42('0x1b')]['include']?_[_0xda42('0x1f')](_0x176be5[_0xda42('0x1b')]['include'],function(_0x46e834){return{'model':db[_0x46e834[_0xda42('0x20')]],'as':_0x46e834['as'],'attributes':_0x46e834[_0xda42('0x1d')],'include':_0x46e834[_0xda42('0x21')]?_[_0xda42('0x1f')](_0x46e834[_0xda42('0x21')],function(_0x4a819f){return{'model':db[_0x4a819f[_0xda42('0x20')]],'as':_0x4a819f['as'],'attributes':_0x4a819f[_0xda42('0x1d')],'include':_0x4a819f[_0xda42('0x21')]?_[_0xda42('0x1f')](_0x4a819f[_0xda42('0x21')],function(_0x514cb1){return{'model':db[_0x514cb1['model']],'as':_0x514cb1['as'],'attributes':_0x514cb1[_0xda42('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xda42('0xe')](function(_0x22a5d6){logger[_0xda42('0x16')](_0xda42('0x22'),_0x176be5);logger[_0xda42('0x11')](_0xda42('0x22'),_0x176be5,JSON[_0xda42('0x23')](_0x22a5d6));_0x1b1298(_0x22a5d6);})[_0xda42('0x18')](function(_0x5582cd){logger[_0xda42('0x13')]('GetWhatsappQueue',_0x5582cd[_0xda42('0x15')],_0x176be5);_0x501c57(_0xa8913[_0xda42('0x13')](0x1f4,_0x5582cd['message']));});});};exports['ShowWhatsappQueue']=function(_0x4558fd){var _0x771f2c=this;return new Promise(function(_0x24fd99,_0x1fa3ff){return db[_0xda42('0x19')][_0xda42('0x24')]({'raw':_0x4558fd['options']?_0x4558fd[_0xda42('0x1b')][_0xda42('0x25')]===undefined?!![]:![]:!![],'where':_0x4558fd[_0xda42('0x1b')]?_0x4558fd['options']['where']||null:null,'attributes':_0x4558fd[_0xda42('0x1b')]?_0x4558fd[_0xda42('0x1b')][_0xda42('0x1d')]||null:null,'include':_0x4558fd[_0xda42('0x1b')]?_0x4558fd[_0xda42('0x1b')][_0xda42('0x21')]?_['map'](_0x4558fd[_0xda42('0x1b')][_0xda42('0x21')],function(_0x5727bd){return{'model':db[_0x5727bd[_0xda42('0x20')]],'as':_0x5727bd['as'],'attributes':_0x5727bd['attributes'],'include':_0x5727bd[_0xda42('0x21')]?_['map'](_0x5727bd[_0xda42('0x21')],function(_0xde340d){return{'model':db[_0xde340d['model']],'as':_0xde340d['as'],'attributes':_0xde340d[_0xda42('0x1d')],'include':_0xde340d['include']?_['map'](_0xde340d[_0xda42('0x21')],function(_0x384ed8){return{'model':db[_0x384ed8['model']],'as':_0x384ed8['as'],'attributes':_0x384ed8['attributes']};}):[]};}):[]};}):[]:[]})[_0xda42('0xe')](function(_0x4371d9){logger[_0xda42('0x16')]('ShowWhatsappQueue',_0x4558fd);logger[_0xda42('0x11')](_0xda42('0x26'),_0x4558fd,JSON['stringify'](_0x4371d9));_0x24fd99(_0x4371d9);})['catch'](function(_0x202bd6){logger[_0xda42('0x13')](_0xda42('0x26'),_0x202bd6[_0xda42('0x15')],_0x4558fd);_0x1fa3ff(_0x771f2c['error'](0x1f4,_0x202bd6[_0xda42('0x15')]));});});}; \ No newline at end of file +var _0x92ce=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','model','attributes','map','stringify','ShowWhatsappQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','./whatsappQueue.socket','register','request','then'];(function(_0x526252,_0x2ef977){var _0x316c4c=function(_0x2d6aa5){while(--_0x2d6aa5){_0x526252['push'](_0x526252['shift']());}};_0x316c4c(++_0x2ef977);}(_0x92ce,0x118));var _0xe92c=function(_0xdcd62e,_0x467a90){_0xdcd62e=_0xdcd62e-0x0;var _0x5677bf=_0x92ce[_0xdcd62e];return _0x5677bf;};'use strict';var _=require(_0xe92c('0x0'));var util=require('util');var moment=require(_0xe92c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe92c('0x2'));var fs=require('fs');var Redis=require(_0xe92c('0x3'));var db=require(_0xe92c('0x4'))['db'];var utils=require(_0xe92c('0x5'));var logger=require('../../config/logger')(_0xe92c('0x6'));var config=require(_0xe92c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe92c('0x8')]['http']({'port':0x232a});config[_0xe92c('0x9')]=_[_0xe92c('0xa')](config[_0xe92c('0x9')],{'host':_0xe92c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe92c('0x9')]));require(_0xe92c('0xc'))[_0xe92c('0xd')](socket);function respondWithRpcPromise(_0x3023c3,_0x2f3a0a,_0x51a95e){return new BPromise(function(_0x43c66a,_0x4e4fcd){return client[_0xe92c('0xe')](_0x3023c3,_0x51a95e)[_0xe92c('0xf')](function(_0x1d5a00){logger['info'](_0xe92c('0x10'),_0x2f3a0a,_0xe92c('0x11'));logger[_0xe92c('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2f3a0a,_0xe92c('0x11'),JSON['stringify'](_0x1d5a00));if(_0x1d5a00['error']){if(_0x1d5a00['error'][_0xe92c('0x13')]===0x1f4){logger[_0xe92c('0x14')](_0xe92c('0x10'),_0x2f3a0a,_0x1d5a00[_0xe92c('0x14')][_0xe92c('0x15')]);return _0x4e4fcd(_0x1d5a00[_0xe92c('0x14')][_0xe92c('0x15')]);}logger[_0xe92c('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x2f3a0a,_0x1d5a00[_0xe92c('0x14')][_0xe92c('0x15')]);return _0x43c66a(_0x1d5a00[_0xe92c('0x14')][_0xe92c('0x15')]);}else{logger[_0xe92c('0x16')](_0xe92c('0x10'),_0x2f3a0a,_0xe92c('0x11'));_0x43c66a(_0x1d5a00[_0xe92c('0x17')][_0xe92c('0x15')]);}})[_0xe92c('0x18')](function(_0x51d992){logger[_0xe92c('0x14')](_0xe92c('0x10'),_0x2f3a0a,_0x51d992);_0x4e4fcd(_0x51d992);});});}exports[_0xe92c('0x19')]=function(_0x8332fe){var _0x4229a2=this;return new Promise(function(_0x36c99e,_0x17a818){return db[_0xe92c('0x1a')][_0xe92c('0x1b')]({'raw':_0x8332fe[_0xe92c('0x1c')]?_0x8332fe[_0xe92c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x8332fe[_0xe92c('0x1c')]?_0x8332fe[_0xe92c('0x1c')][_0xe92c('0x1d')]||null:null,'attributes':_0x8332fe[_0xe92c('0x1c')]?_0x8332fe[_0xe92c('0x1c')]['attributes']||null:null,'limit':_0x8332fe[_0xe92c('0x1c')]?_0x8332fe[_0xe92c('0x1c')][_0xe92c('0x1e')]||null:null,'include':_0x8332fe[_0xe92c('0x1c')]?_0x8332fe[_0xe92c('0x1c')]['include']?_['map'](_0x8332fe['options'][_0xe92c('0x1f')],function(_0x2357f0){return{'model':db[_0x2357f0[_0xe92c('0x20')]],'as':_0x2357f0['as'],'attributes':_0x2357f0[_0xe92c('0x21')],'include':_0x2357f0[_0xe92c('0x1f')]?_[_0xe92c('0x22')](_0x2357f0['include'],function(_0x8dfe47){return{'model':db[_0x8dfe47[_0xe92c('0x20')]],'as':_0x8dfe47['as'],'attributes':_0x8dfe47[_0xe92c('0x21')],'include':_0x8dfe47[_0xe92c('0x1f')]?_[_0xe92c('0x22')](_0x8dfe47[_0xe92c('0x1f')],function(_0x21af64){return{'model':db[_0x21af64[_0xe92c('0x20')]],'as':_0x21af64['as'],'attributes':_0x21af64[_0xe92c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe92c('0xf')](function(_0x32b36d){logger[_0xe92c('0x16')](_0xe92c('0x19'),_0x8332fe);logger[_0xe92c('0x12')](_0xe92c('0x19'),_0x8332fe,JSON[_0xe92c('0x23')](_0x32b36d));_0x36c99e(_0x32b36d);})['catch'](function(_0x29bb8d){logger[_0xe92c('0x14')](_0xe92c('0x19'),_0x29bb8d['message'],_0x8332fe);_0x17a818(_0x4229a2[_0xe92c('0x14')](0x1f4,_0x29bb8d[_0xe92c('0x15')]));});});};exports[_0xe92c('0x24')]=function(_0x55fe8b){var _0xcdc383=this;return new Promise(function(_0x7d1aad,_0x1f7df3){return db['WhatsappQueue']['find']({'raw':_0x55fe8b['options']?_0x55fe8b[_0xe92c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x55fe8b[_0xe92c('0x1c')]?_0x55fe8b[_0xe92c('0x1c')][_0xe92c('0x1d')]||null:null,'attributes':_0x55fe8b['options']?_0x55fe8b[_0xe92c('0x1c')]['attributes']||null:null,'include':_0x55fe8b[_0xe92c('0x1c')]?_0x55fe8b[_0xe92c('0x1c')][_0xe92c('0x1f')]?_[_0xe92c('0x22')](_0x55fe8b[_0xe92c('0x1c')][_0xe92c('0x1f')],function(_0x129065){return{'model':db[_0x129065['model']],'as':_0x129065['as'],'attributes':_0x129065[_0xe92c('0x21')],'include':_0x129065['include']?_[_0xe92c('0x22')](_0x129065[_0xe92c('0x1f')],function(_0x2857a9){return{'model':db[_0x2857a9[_0xe92c('0x20')]],'as':_0x2857a9['as'],'attributes':_0x2857a9[_0xe92c('0x21')],'include':_0x2857a9[_0xe92c('0x1f')]?_[_0xe92c('0x22')](_0x2857a9[_0xe92c('0x1f')],function(_0x530e67){return{'model':db[_0x530e67[_0xe92c('0x20')]],'as':_0x530e67['as'],'attributes':_0x530e67[_0xe92c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe92c('0xf')](function(_0x235ccc){logger['info'](_0xe92c('0x24'),_0x55fe8b);logger[_0xe92c('0x12')](_0xe92c('0x24'),_0x55fe8b,JSON[_0xe92c('0x23')](_0x235ccc));_0x7d1aad(_0x235ccc);})[_0xe92c('0x18')](function(_0x4bcfd9){logger[_0xe92c('0x14')](_0xe92c('0x24'),_0x4bcfd9[_0xe92c('0x15')],_0x55fe8b);_0x1f7df3(_0xcdc383[_0xe92c('0x14')](0x1f4,_0x4bcfd9['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 124fb7e..01dce14 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb17=['update','emit','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x57671f,_0x4da2b2){var _0x1f80c4=function(_0x168cd0){while(--_0x168cd0){_0x57671f['push'](_0x57671f['shift']());}};_0x1f80c4(++_0x4da2b2);}(_0xeb17,0x135));var _0x7eb1=function(_0x4824de,_0x5b7e0f){_0x4824de=_0x4824de-0x0;var _0x4b6771=_0xeb17[_0x4824de];return _0x4b6771;};'use strict';var WhatsappQueueEvents=require(_0x7eb1('0x0'));var events=['save','remove',_0x7eb1('0x1')];function createListener(_0x5ddf36,_0x10ef11){return function(_0xcb6a0f){_0x10ef11[_0x7eb1('0x2')](_0x5ddf36,_0xcb6a0f);};}function removeListener(_0x2bf5be,_0x16bcac){return function(){WhatsappQueueEvents['removeListener'](_0x2bf5be,_0x16bcac);};}exports[_0x7eb1('0x3')]=function(_0x144114){for(var _0x1c4f76=0x0,_0x49c442=events['length'];_0x1c4f76<_0x49c442;_0x1c4f76++){var _0x5584c1=events[_0x1c4f76];var _0x526538=createListener(_0x7eb1('0x4')+_0x5584c1,_0x144114);WhatsappQueueEvents['on'](_0x5584c1,_0x526538);}}; \ No newline at end of file +var _0x2ad5=['whatsappQueue:','save','remove','emit','removeListener','register','length'];(function(_0x426e0d,_0x475b54){var _0x53e0e2=function(_0xc7f51a){while(--_0xc7f51a){_0x426e0d['push'](_0x426e0d['shift']());}};_0x53e0e2(++_0x475b54);}(_0x2ad5,0x7f));var _0x52ad=function(_0x256874,_0x3ca7db){_0x256874=_0x256874-0x0;var _0x1263db=_0x2ad5[_0x256874];return _0x1263db;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x52ad('0x0'),_0x52ad('0x1'),'update'];function createListener(_0x1b26d0,_0x26970e){return function(_0x5ed063){_0x26970e[_0x52ad('0x2')](_0x1b26d0,_0x5ed063);};}function removeListener(_0x4904ae,_0x19f08a){return function(){WhatsappQueueEvents[_0x52ad('0x3')](_0x4904ae,_0x19f08a);};}exports[_0x52ad('0x4')]=function(_0x4d8f62){for(var _0x59ab8c=0x0,_0xd169f9=events[_0x52ad('0x5')];_0x59ab8c<_0xd169f9;_0x59ab8c++){var _0xa6ea30=events[_0x59ab8c];var _0x4ce1ee=createListener(_0x52ad('0x6')+_0xa6ea30,_0x4d8f62);WhatsappQueueEvents['on'](_0xa6ea30,_0x4ce1ee);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 52719af..8a703ce 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7306=['fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4e93f2,_0xf9bbc4){var _0x4e446a=function(_0x2a3b23){while(--_0x2a3b23){_0x4e93f2['push'](_0x4e93f2['shift']());}};_0x4e446a(++_0xf9bbc4);}(_0x7306,0xb7));var _0x6730=function(_0x1a2092,_0x428e13){_0x1a2092=_0x1a2092-0x0;var _0x3a2d17=_0x7306[_0x1a2092];return _0x3a2d17;};'use strict';var multer=require(_0x6730('0x0'));var util=require(_0x6730('0x1'));var path=require(_0x6730('0x2'));var timeout=require(_0x6730('0x3'));var express=require(_0x6730('0x4'));var router=express[_0x6730('0x5')]();var fs_extra=require(_0x6730('0x6'));var auth=require(_0x6730('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6730('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x6730('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6730('0xa'),auth[_0x6730('0xb')](),controller[_0x6730('0xc')]);router['get'](_0x6730('0xd'),auth[_0x6730('0xb')](),controller[_0x6730('0xe')]);router[_0x6730('0xf')]('/',auth[_0x6730('0xb')](),controller[_0x6730('0x10')]);router[_0x6730('0x11')](_0x6730('0xd'),auth[_0x6730('0xb')](),controller['update']);router[_0x6730('0x12')](_0x6730('0xd'),auth['isAuthenticated'](),controller[_0x6730('0x13')]);module[_0x6730('0x14')]=router; \ No newline at end of file +var _0x9545=['index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','isAuthenticated'];(function(_0x44488f,_0x21e3dc){var _0x4d608c=function(_0x426c0a){while(--_0x426c0a){_0x44488f['push'](_0x44488f['shift']());}};_0x4d608c(++_0x21e3dc);}(_0x9545,0x141));var _0x5954=function(_0x15d60e,_0x4e846d){_0x15d60e=_0x15d60e-0x0;var _0x5c6452=_0x9545[_0x15d60e];return _0x5c6452;};'use strict';var multer=require('multer');var util=require(_0x5954('0x0'));var path=require(_0x5954('0x1'));var timeout=require(_0x5954('0x2'));var express=require(_0x5954('0x3'));var router=express[_0x5954('0x4')]();var fs_extra=require(_0x5954('0x5'));var auth=require(_0x5954('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5954('0x7'));router['get']('/',auth[_0x5954('0x8')](),controller[_0x5954('0x9')]);router[_0x5954('0xa')](_0x5954('0xb'),auth['isAuthenticated'](),controller[_0x5954('0xc')]);router[_0x5954('0xa')](_0x5954('0xd'),auth[_0x5954('0x8')](),controller[_0x5954('0xe')]);router[_0x5954('0xf')]('/',auth[_0x5954('0x8')](),controller[_0x5954('0x10')]);router[_0x5954('0x11')](_0x5954('0xd'),auth[_0x5954('0x8')](),controller[_0x5954('0x12')]);router[_0x5954('0x13')](_0x5954('0xd'),auth[_0x5954('0x8')](),controller[_0x5954('0x14')]);module[_0x5954('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5bb4f6e..8e94829 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x226f1c,_0xc5d333){var _0x1254b9=function(_0x13c7b1){while(--_0x13c7b1){_0x226f1c['push'](_0x226f1c['shift']());}};_0x1254b9(++_0xc5d333);}(_0x7a54,0x106));var _0x47a5=function(_0x549a72,_0x32b8bb){_0x549a72=_0x549a72-0x0;var _0x2674a8=_0x7a54[_0x549a72];return _0x2674a8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x57e61f,_0x56f220){var _0x31792c=function(_0xf566a4){while(--_0xf566a4){_0x57e61f['push'](_0x57e61f['shift']());}};_0x31792c(++_0x56f220);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 58193ea..d9b8cb6 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x4024,0x89));var _0x4402=function(_0x2d16c4,_0xbdeeac){_0x2d16c4=_0x2d16c4-0x0;var _0x332f4e=_0x4024[_0x2d16c4];return _0x332f4e;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){_0x258d10['status'](0xcc)[_0x4402('0x15')]();});}};}function handleEntityNotFound(_0x4e1c04,_0x3733cd){return function(_0x5ab28d){if(!_0x5ab28d){_0x4e1c04[_0x4402('0x13')](0x194);}return _0x5ab28d;};}function handleError(_0x211424,_0x5a43d0){_0x5a43d0=_0x5a43d0||0x1f4;return function(_0x15c19f){logger['error'](_0x15c19f['stack']);if(_0x15c19f[_0x4402('0x21')]){delete _0x15c19f[_0x4402('0x21')];}_0x211424[_0x4402('0x14')](_0x5a43d0)[_0x4402('0x22')](_0x15c19f);};}exports[_0x4402('0x23')]=function(_0x514e41,_0x41de44){var _0x52e625={},_0x71da2f={},_0x1e2340={'count':0x0,'rows':[]};var _0x42dd32=_['map'](db[_0x4402('0x24')][_0x4402('0x25')],function(_0x316239){return{'name':_0x316239[_0x4402('0x26')],'type':_0x316239[_0x4402('0x27')][_0x4402('0x28')]};});_0x71da2f[_0x4402('0x29')]=_[_0x4402('0x2a')](_0x42dd32,_0x4402('0x21'));_0x71da2f[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x514e41['query']);_0x71da2f[_0x4402('0x2d')]=_['intersection'](_0x71da2f[_0x4402('0x29')],_0x71da2f['query']);_0x52e625[_0x4402('0x2e')]=_[_0x4402('0x2f')](_0x71da2f[_0x4402('0x29')],qs[_0x4402('0x30')](_0x514e41[_0x4402('0x2b')]['fields']));_0x52e625[_0x4402('0x2e')]=_0x52e625[_0x4402('0x2e')][_0x4402('0x31')]?_0x52e625['attributes']:_0x71da2f[_0x4402('0x29')];if(!_0x514e41[_0x4402('0x2b')]['hasOwnProperty'](_0x4402('0x32'))){_0x52e625[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x514e41[_0x4402('0x2b')][_0x4402('0x19')]);_0x52e625[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x514e41[_0x4402('0x2b')][_0x4402('0x17')]);}_0x52e625['order']=qs[_0x4402('0x33')](_0x514e41[_0x4402('0x2b')][_0x4402('0x33')]);_0x52e625['where']=qs[_0x4402('0x2d')](_[_0x4402('0x34')](_0x514e41['query'],_0x71da2f['filters']),_0x42dd32);if(_0x514e41[_0x4402('0x2b')][_0x4402('0x35')]){_0x52e625[_0x4402('0x36')]=_[_0x4402('0x37')](_0x52e625['where'],{'$or':_['map'](_0x42dd32,function(_0x4b0672){if(_0x4b0672[_0x4402('0x27')]!==_0x4402('0x38')){var _0xcbfa06={};_0xcbfa06[_0x4b0672[_0x4402('0x21')]]={'$like':'%'+_0x514e41['query'][_0x4402('0x35')]+'%'};return _0xcbfa06;}})});}_0x52e625=_[_0x4402('0x37')]({},_0x52e625,_0x514e41[_0x4402('0x39')]);var _0x57843d={'where':_0x52e625[_0x4402('0x36')]};return db['WhatsappQueueReport'][_0x4402('0x1a')](_0x57843d)[_0x4402('0x1f')](function(_0x5c74b1){_0x1e2340[_0x4402('0x1a')]=_0x5c74b1;if(_0x514e41['query'][_0x4402('0x3a')]){_0x52e625[_0x4402('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x4402('0x3c')](_0x52e625);})[_0x4402('0x1f')](function(_0x250f09){_0x1e2340[_0x4402('0x3d')]=_0x250f09;return _0x1e2340;})['then'](respondWithFilteredResult(_0x41de44,_0x52e625))['catch'](handleError(_0x41de44,null));};exports[_0x4402('0x3e')]=function(_0x47a3a3,_0x3a589b){var _0x2a6d78={'raw':!![],'where':{'id':_0x47a3a3[_0x4402('0x3f')]['id']}},_0xb9cf85={};_0xb9cf85[_0x4402('0x29')]=_[_0x4402('0x2c')](db[_0x4402('0x24')][_0x4402('0x25')]);_0xb9cf85[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x47a3a3['query']);_0xb9cf85[_0x4402('0x2d')]=_[_0x4402('0x2f')](_0xb9cf85['model'],_0xb9cf85[_0x4402('0x2b')]);_0x2a6d78[_0x4402('0x2e')]=_['intersection'](_0xb9cf85[_0x4402('0x29')],qs[_0x4402('0x30')](_0x47a3a3[_0x4402('0x2b')][_0x4402('0x30')]));_0x2a6d78[_0x4402('0x2e')]=_0x2a6d78['attributes'][_0x4402('0x31')]?_0x2a6d78[_0x4402('0x2e')]:_0xb9cf85[_0x4402('0x29')];if(_0x47a3a3[_0x4402('0x2b')][_0x4402('0x3a')]){_0x2a6d78[_0x4402('0x3b')]=[{'all':!![]}];}_0x2a6d78=_[_0x4402('0x37')]({},_0x2a6d78,_0x47a3a3[_0x4402('0x39')]);return db[_0x4402('0x24')][_0x4402('0x40')](_0x2a6d78)[_0x4402('0x1f')](handleEntityNotFound(_0x3a589b,null))['then'](respondWithResult(_0x3a589b,null))[_0x4402('0x41')](handleError(_0x3a589b,null));};exports['create']=function(_0xc45af6,_0x34ce00){return db['WhatsappQueueReport'][_0x4402('0x42')](_0xc45af6[_0x4402('0x43')],{})[_0x4402('0x1f')](respondWithResult(_0x34ce00,0xc9))[_0x4402('0x41')](handleError(_0x34ce00,null));};exports[_0x4402('0x1e')]=function(_0x2503eb,_0x5b094b){if(_0x2503eb[_0x4402('0x43')]['id']){delete _0x2503eb[_0x4402('0x43')]['id'];}return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x2503eb[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x5b094b,null))[_0x4402('0x1f')](saveUpdates(_0x2503eb[_0x4402('0x43')],null))[_0x4402('0x1f')](respondWithResult(_0x5b094b,null))['catch'](handleError(_0x5b094b,null));};exports['destroy']=function(_0x5ab12b,_0x4c2d2e){return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x5ab12b[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4c2d2e,null))['then'](removeEntity(_0x4c2d2e,null))[_0x4402('0x41')](handleError(_0x4c2d2e,null));};exports[_0x4402('0x44')]=function(_0x203b33,_0x2a4ea7){return db[_0x4402('0x24')][_0x4402('0x44')]()[_0x4402('0x1f')](respondWithResult(_0x2a4ea7,null))['catch'](handleError(_0x2a4ea7,null));}; \ No newline at end of file +var _0x4024=['rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x4024,0x89));var _0x4402=function(_0x14df77,_0x46aedb){_0x14df77=_0x14df77-0x0;var _0x3a9e30=_0x4024[_0x14df77];return _0x3a9e30;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){_0x258d10['status'](0xcc)[_0x4402('0x15')]();});}};}function handleEntityNotFound(_0x4e1c04,_0x3733cd){return function(_0x5ab28d){if(!_0x5ab28d){_0x4e1c04[_0x4402('0x13')](0x194);}return _0x5ab28d;};}function handleError(_0x211424,_0x5a43d0){_0x5a43d0=_0x5a43d0||0x1f4;return function(_0x15c19f){logger['error'](_0x15c19f['stack']);if(_0x15c19f[_0x4402('0x21')]){delete _0x15c19f[_0x4402('0x21')];}_0x211424[_0x4402('0x14')](_0x5a43d0)[_0x4402('0x22')](_0x15c19f);};}exports[_0x4402('0x23')]=function(_0x514e41,_0x41de44){var _0x52e625={},_0x71da2f={},_0x1e2340={'count':0x0,'rows':[]};var _0x42dd32=_['map'](db[_0x4402('0x24')][_0x4402('0x25')],function(_0x316239){return{'name':_0x316239[_0x4402('0x26')],'type':_0x316239[_0x4402('0x27')][_0x4402('0x28')]};});_0x71da2f[_0x4402('0x29')]=_[_0x4402('0x2a')](_0x42dd32,_0x4402('0x21'));_0x71da2f[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x514e41['query']);_0x71da2f[_0x4402('0x2d')]=_['intersection'](_0x71da2f[_0x4402('0x29')],_0x71da2f['query']);_0x52e625[_0x4402('0x2e')]=_[_0x4402('0x2f')](_0x71da2f[_0x4402('0x29')],qs[_0x4402('0x30')](_0x514e41[_0x4402('0x2b')]['fields']));_0x52e625[_0x4402('0x2e')]=_0x52e625[_0x4402('0x2e')][_0x4402('0x31')]?_0x52e625['attributes']:_0x71da2f[_0x4402('0x29')];if(!_0x514e41[_0x4402('0x2b')]['hasOwnProperty'](_0x4402('0x32'))){_0x52e625[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x514e41[_0x4402('0x2b')][_0x4402('0x19')]);_0x52e625[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x514e41[_0x4402('0x2b')][_0x4402('0x17')]);}_0x52e625['order']=qs[_0x4402('0x33')](_0x514e41[_0x4402('0x2b')][_0x4402('0x33')]);_0x52e625['where']=qs[_0x4402('0x2d')](_[_0x4402('0x34')](_0x514e41['query'],_0x71da2f['filters']),_0x42dd32);if(_0x514e41[_0x4402('0x2b')][_0x4402('0x35')]){_0x52e625[_0x4402('0x36')]=_[_0x4402('0x37')](_0x52e625['where'],{'$or':_['map'](_0x42dd32,function(_0x4b0672){if(_0x4b0672[_0x4402('0x27')]!==_0x4402('0x38')){var _0xcbfa06={};_0xcbfa06[_0x4b0672[_0x4402('0x21')]]={'$like':'%'+_0x514e41['query'][_0x4402('0x35')]+'%'};return _0xcbfa06;}})});}_0x52e625=_[_0x4402('0x37')]({},_0x52e625,_0x514e41[_0x4402('0x39')]);var _0x57843d={'where':_0x52e625[_0x4402('0x36')]};return db['WhatsappQueueReport'][_0x4402('0x1a')](_0x57843d)[_0x4402('0x1f')](function(_0x5c74b1){_0x1e2340[_0x4402('0x1a')]=_0x5c74b1;if(_0x514e41['query'][_0x4402('0x3a')]){_0x52e625[_0x4402('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x4402('0x3c')](_0x52e625);})[_0x4402('0x1f')](function(_0x250f09){_0x1e2340[_0x4402('0x3d')]=_0x250f09;return _0x1e2340;})['then'](respondWithFilteredResult(_0x41de44,_0x52e625))['catch'](handleError(_0x41de44,null));};exports[_0x4402('0x3e')]=function(_0x47a3a3,_0x3a589b){var _0x2a6d78={'raw':!![],'where':{'id':_0x47a3a3[_0x4402('0x3f')]['id']}},_0xb9cf85={};_0xb9cf85[_0x4402('0x29')]=_[_0x4402('0x2c')](db[_0x4402('0x24')][_0x4402('0x25')]);_0xb9cf85[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x47a3a3['query']);_0xb9cf85[_0x4402('0x2d')]=_[_0x4402('0x2f')](_0xb9cf85['model'],_0xb9cf85[_0x4402('0x2b')]);_0x2a6d78[_0x4402('0x2e')]=_['intersection'](_0xb9cf85[_0x4402('0x29')],qs[_0x4402('0x30')](_0x47a3a3[_0x4402('0x2b')][_0x4402('0x30')]));_0x2a6d78[_0x4402('0x2e')]=_0x2a6d78['attributes'][_0x4402('0x31')]?_0x2a6d78[_0x4402('0x2e')]:_0xb9cf85[_0x4402('0x29')];if(_0x47a3a3[_0x4402('0x2b')][_0x4402('0x3a')]){_0x2a6d78[_0x4402('0x3b')]=[{'all':!![]}];}_0x2a6d78=_[_0x4402('0x37')]({},_0x2a6d78,_0x47a3a3[_0x4402('0x39')]);return db[_0x4402('0x24')][_0x4402('0x40')](_0x2a6d78)[_0x4402('0x1f')](handleEntityNotFound(_0x3a589b,null))['then'](respondWithResult(_0x3a589b,null))[_0x4402('0x41')](handleError(_0x3a589b,null));};exports['create']=function(_0xc45af6,_0x34ce00){return db['WhatsappQueueReport'][_0x4402('0x42')](_0xc45af6[_0x4402('0x43')],{})[_0x4402('0x1f')](respondWithResult(_0x34ce00,0xc9))[_0x4402('0x41')](handleError(_0x34ce00,null));};exports[_0x4402('0x1e')]=function(_0x2503eb,_0x5b094b){if(_0x2503eb[_0x4402('0x43')]['id']){delete _0x2503eb[_0x4402('0x43')]['id'];}return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x2503eb[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x5b094b,null))[_0x4402('0x1f')](saveUpdates(_0x2503eb[_0x4402('0x43')],null))[_0x4402('0x1f')](respondWithResult(_0x5b094b,null))['catch'](handleError(_0x5b094b,null));};exports['destroy']=function(_0x5ab12b,_0x4c2d2e){return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x5ab12b[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4c2d2e,null))['then'](removeEntity(_0x4c2d2e,null))[_0x4402('0x41')](handleError(_0x4c2d2e,null));};exports[_0x4402('0x44')]=function(_0x203b33,_0x2a4ea7){return db[_0x4402('0x24')][_0x4402('0x44')]()[_0x4402('0x1f')](respondWithResult(_0x2a4ea7,null))['catch'](handleError(_0x2a4ea7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8704e07..20efb70 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa446=['exports','define','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51b1a5,_0x285a4f){var _0x15c738=function(_0x5c94d7){while(--_0x5c94d7){_0x51b1a5['push'](_0x51b1a5['shift']());}};_0x15c738(++_0x285a4f);}(_0xa446,0x163));var _0x6a44=function(_0x3deea0,_0x57f3c2){_0x3deea0=_0x3deea0-0x0;var _0x323230=_0xa446[_0x3deea0];return _0x323230;};'use strict';var _=require(_0x6a44('0x0'));var util=require(_0x6a44('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6a44('0x2'));var BPromise=require(_0x6a44('0x3'));var rp=require(_0x6a44('0x4'));var fs=require('fs');var path=require(_0x6a44('0x5'));var rimraf=require(_0x6a44('0x6'));var config=require(_0x6a44('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x6a44('0x8')]=function(_0x39edd1,_0x12f3de){return _0x39edd1[_0x6a44('0x9')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x6a44('0xa'),'fields':[_0x6a44('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa3a=['api','moment','bluebird','path','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','../../config/logger'];(function(_0x187d35,_0x57385c){var _0x5903f0=function(_0x3e93f2){while(--_0x3e93f2){_0x187d35['push'](_0x187d35['shift']());}};_0x5903f0(++_0x57385c);}(_0xaa3a,0x1cb));var _0xaaa3=function(_0x177b3a,_0x4f450b){_0x177b3a=_0x177b3a-0x0;var _0x3d0bfa=_0xaa3a[_0x177b3a];return _0x3d0bfa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaaa3('0x0'))(_0xaaa3('0x1'));var moment=require(_0xaaa3('0x2'));var BPromise=require(_0xaaa3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaaa3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaaa3('0x5'));module[_0xaaa3('0x6')]=function(_0x550cd3,_0x1a3523){return _0x550cd3[_0xaaa3('0x7')](_0xaaa3('0x8'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xaaa3('0x9'),'fields':[_0xaaa3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7017719..c24f8e7 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ff5=['catch','body','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','then','debug'];(function(_0x38fd45,_0x165051){var _0xc63717=function(_0xfef455){while(--_0xfef455){_0x38fd45['push'](_0x38fd45['shift']());}};_0xc63717(++_0x165051);}(_0x7ff5,0x17c));var _0x57ff=function(_0x36e4dc,_0x4cc695){_0x36e4dc=_0x36e4dc-0x0;var _0x303297=_0x7ff5[_0x36e4dc];return _0x303297;};'use strict';var _=require(_0x57ff('0x0'));var util=require(_0x57ff('0x1'));var moment=require(_0x57ff('0x2'));var BPromise=require(_0x57ff('0x3'));var rs=require(_0x57ff('0x4'));var fs=require('fs');var Redis=require(_0x57ff('0x5'));var db=require(_0x57ff('0x6'))['db'];var utils=require(_0x57ff('0x7'));var logger=require(_0x57ff('0x8'))(_0x57ff('0x9'));var config=require(_0x57ff('0xa'));var jayson=require(_0x57ff('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x111c51,_0x5d1e02,_0x51f824){return new BPromise(function(_0x2ef5cd,_0x8f99ed){return client[_0x57ff('0xc')](_0x111c51,_0x51f824)['then'](function(_0x2eea0d){logger[_0x57ff('0xd')](_0x57ff('0xe'),_0x5d1e02,_0x57ff('0xf'));logger['debug'](_0x57ff('0x10'),_0x5d1e02,_0x57ff('0xf'),JSON[_0x57ff('0x11')](_0x2eea0d));if(_0x2eea0d[_0x57ff('0x12')]){if(_0x2eea0d[_0x57ff('0x12')]['code']===0x1f4){logger[_0x57ff('0x12')](_0x57ff('0xe'),_0x5d1e02,_0x2eea0d[_0x57ff('0x12')][_0x57ff('0x13')]);return _0x8f99ed(_0x2eea0d[_0x57ff('0x12')][_0x57ff('0x13')]);}logger[_0x57ff('0x12')](_0x57ff('0xe'),_0x5d1e02,_0x2eea0d[_0x57ff('0x12')][_0x57ff('0x13')]);return _0x2ef5cd(_0x2eea0d[_0x57ff('0x12')][_0x57ff('0x13')]);}else{logger[_0x57ff('0xd')](_0x57ff('0xe'),_0x5d1e02,'request\x20sent');_0x2ef5cd(_0x2eea0d[_0x57ff('0x14')][_0x57ff('0x13')]);}})['catch'](function(_0x4244e9){logger['error'](_0x57ff('0xe'),_0x5d1e02,_0x4244e9);_0x8f99ed(_0x4244e9);});});}exports[_0x57ff('0x15')]=function(_0x579158){var _0x14a9f4=this;return new Promise(function(_0x2b6785,_0x5c65be){return db[_0x57ff('0x16')][_0x57ff('0x17')](_0x579158['body'],{'raw':_0x579158[_0x57ff('0x18')]?_0x579158['options'][_0x57ff('0x19')]===undefined?!![]:![]:!![]})[_0x57ff('0x1a')](function(_0x21db27){logger[_0x57ff('0xd')](_0x57ff('0x15'),_0x579158);logger[_0x57ff('0x1b')](_0x57ff('0x15'),_0x579158,JSON[_0x57ff('0x11')](_0x21db27));_0x2b6785(_0x21db27);})[_0x57ff('0x1c')](function(_0x52e7d5){logger['error'](_0x57ff('0x15'),_0x52e7d5['message'],_0x579158);_0x5c65be(_0x14a9f4['error'](0x1f4,_0x52e7d5[_0x57ff('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x319186){var _0x1d8ce1=this;return new Promise(function(_0x4c353c,_0x4510bb){return db[_0x57ff('0x16')]['update'](_0x319186[_0x57ff('0x1d')],{'raw':_0x319186[_0x57ff('0x18')]?_0x319186[_0x57ff('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319186[_0x57ff('0x18')]?_0x319186[_0x57ff('0x18')][_0x57ff('0x1e')]||null:null,'attributes':_0x319186[_0x57ff('0x18')]?_0x319186['options'][_0x57ff('0x1f')]||null:null,'limit':_0x319186[_0x57ff('0x18')]?_0x319186[_0x57ff('0x18')][_0x57ff('0x20')]||null:null})[_0x57ff('0x1a')](function(_0xbde8ac){logger[_0x57ff('0xd')](_0x57ff('0x21'),_0x319186);logger[_0x57ff('0x1b')](_0x57ff('0x21'),_0x319186,JSON['stringify'](_0xbde8ac));_0x4c353c(_0xbde8ac);})[_0x57ff('0x1c')](function(_0x4ff39d){logger[_0x57ff('0x12')](_0x57ff('0x21'),_0x4ff39d[_0x57ff('0x13')],_0x319186);_0x4510bb(_0x1d8ce1['error'](0x1f4,_0x4ff39d['message']));});});}; \ No newline at end of file +var _0x0dbe=['options','raw','UpdateWhatsappQueueReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x5e656c,_0x12f9c0){var _0x283fff=function(_0xb745c6){while(--_0xb745c6){_0x5e656c['push'](_0x5e656c['shift']());}};_0x283fff(++_0x12f9c0);}(_0x0dbe,0x64));var _0xe0db=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x0dbe[_0x599e60];return _0x468e19;};'use strict';var _=require(_0xe0db('0x0'));var util=require(_0xe0db('0x1'));var moment=require(_0xe0db('0x2'));var BPromise=require('bluebird');var rs=require(_0xe0db('0x3'));var fs=require('fs');var Redis=require(_0xe0db('0x4'));var db=require(_0xe0db('0x5'))['db'];var utils=require(_0xe0db('0x6'));var logger=require('../../config/logger')(_0xe0db('0x7'));var config=require(_0xe0db('0x8'));var jayson=require(_0xe0db('0x9'));var client=jayson[_0xe0db('0xa')][_0xe0db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35e606,_0x29b0ce,_0x2ede69){return new BPromise(function(_0x19ae0d,_0x3e7301){return client[_0xe0db('0xc')](_0x35e606,_0x2ede69)[_0xe0db('0xd')](function(_0x502845){logger['info'](_0xe0db('0xe'),_0x29b0ce,_0xe0db('0xf'));logger[_0xe0db('0x10')](_0xe0db('0x11'),_0x29b0ce,'request\x20sent',JSON[_0xe0db('0x12')](_0x502845));if(_0x502845['error']){if(_0x502845[_0xe0db('0x13')][_0xe0db('0x14')]===0x1f4){logger[_0xe0db('0x13')](_0xe0db('0xe'),_0x29b0ce,_0x502845[_0xe0db('0x13')][_0xe0db('0x15')]);return _0x3e7301(_0x502845[_0xe0db('0x13')][_0xe0db('0x15')]);}logger[_0xe0db('0x13')](_0xe0db('0xe'),_0x29b0ce,_0x502845[_0xe0db('0x13')][_0xe0db('0x15')]);return _0x19ae0d(_0x502845[_0xe0db('0x13')][_0xe0db('0x15')]);}else{logger[_0xe0db('0x16')](_0xe0db('0xe'),_0x29b0ce,_0xe0db('0xf'));_0x19ae0d(_0x502845[_0xe0db('0x17')][_0xe0db('0x15')]);}})[_0xe0db('0x18')](function(_0x2febfd){logger[_0xe0db('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29b0ce,_0x2febfd);_0x3e7301(_0x2febfd);});});}exports[_0xe0db('0x19')]=function(_0xc6425a){var _0x39144c=this;return new Promise(function(_0x17e72d,_0x567a15){return db[_0xe0db('0x1a')][_0xe0db('0x1b')](_0xc6425a['body'],{'raw':_0xc6425a[_0xe0db('0x1c')]?_0xc6425a['options'][_0xe0db('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x25b037){logger[_0xe0db('0x16')]('CreateWhatsappQueueReport',_0xc6425a);logger['debug']('CreateWhatsappQueueReport',_0xc6425a,JSON[_0xe0db('0x12')](_0x25b037));_0x17e72d(_0x25b037);})[_0xe0db('0x18')](function(_0x161aac){logger['error']('CreateWhatsappQueueReport',_0x161aac[_0xe0db('0x15')],_0xc6425a);_0x567a15(_0x39144c[_0xe0db('0x13')](0x1f4,_0x161aac[_0xe0db('0x15')]));});});};exports[_0xe0db('0x1e')]=function(_0x4592c2){var _0x163604=this;return new Promise(function(_0x47e149,_0x38f4e5){return db[_0xe0db('0x1a')][_0xe0db('0x1f')](_0x4592c2['body'],{'raw':_0x4592c2[_0xe0db('0x1c')]?_0x4592c2[_0xe0db('0x1c')][_0xe0db('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4592c2[_0xe0db('0x1c')]?_0x4592c2['options']['where']||null:null,'attributes':_0x4592c2[_0xe0db('0x1c')]?_0x4592c2[_0xe0db('0x1c')]['attributes']||null:null,'limit':_0x4592c2[_0xe0db('0x1c')]?_0x4592c2[_0xe0db('0x1c')]['limit']||null:null})[_0xe0db('0xd')](function(_0x1edc76){logger['info']('UpdateWhatsappQueueReport',_0x4592c2);logger[_0xe0db('0x10')](_0xe0db('0x1e'),_0x4592c2,JSON[_0xe0db('0x12')](_0x1edc76));_0x47e149(_0x1edc76);})[_0xe0db('0x18')](function(_0x31a723){logger[_0xe0db('0x13')](_0xe0db('0x1e'),_0x31a723[_0xe0db('0x15')],_0x4592c2);_0x38f4e5(_0x163604[_0xe0db('0x13')](0x1f4,_0x31a723[_0xe0db('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 70df24e..a9b0abb 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeab=['../../config/environment','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x25e379,_0x5bb5af){var _0x301d00=function(_0x334560){while(--_0x334560){_0x25e379['push'](_0x25e379['shift']());}};_0x301d00(++_0x5bb5af);}(_0xdeab,0x198));var _0xbdea=function(_0xa6941e,_0x21ce55){_0xa6941e=_0xa6941e-0x0;var _0x1d7acd=_0xdeab[_0xa6941e];return _0x1d7acd;};'use strict';var multer=require(_0xbdea('0x0'));var util=require('util');var path=require(_0xbdea('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbdea('0x2')]();var fs_extra=require(_0xbdea('0x3'));var auth=require(_0xbdea('0x4'));var interaction=require(_0xbdea('0x5'));var config=require(_0xbdea('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xbdea('0x7')]('/',auth[_0xbdea('0x8')](),controller[_0xbdea('0x9')]);router[_0xbdea('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xbdea('0xa')]);router[_0xbdea('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xbdea('0xb')]);router[_0xbdea('0xc')]('/',auth[_0xbdea('0x8')](),controller[_0xbdea('0xd')]);router[_0xbdea('0xe')](_0xbdea('0xf'),auth[_0xbdea('0x8')](),controller[_0xbdea('0x10')]);router['delete'](_0xbdea('0xf'),auth[_0xbdea('0x8')](),controller['destroy']);module[_0xbdea('0x11')]=router; \ No newline at end of file +var _0x6984=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x5b39b6,_0x436dfe){var _0x5e83aa=function(_0x3f1f19){while(--_0x3f1f19){_0x5b39b6['push'](_0x5b39b6['shift']());}};_0x5e83aa(++_0x436dfe);}(_0x6984,0x136));var _0x4698=function(_0x136aed,_0x520312){_0x136aed=_0x136aed-0x0;var _0x257b2a=_0x6984[_0x136aed];return _0x257b2a;};'use strict';var multer=require(_0x4698('0x0'));var util=require(_0x4698('0x1'));var path=require(_0x4698('0x2'));var timeout=require(_0x4698('0x3'));var express=require(_0x4698('0x4'));var router=express['Router']();var fs_extra=require(_0x4698('0x5'));var auth=require(_0x4698('0x6'));var interaction=require(_0x4698('0x7'));var config=require(_0x4698('0x8'));var controller=require(_0x4698('0x9'));router[_0x4698('0xa')]('/',auth[_0x4698('0xb')](),controller[_0x4698('0xc')]);router[_0x4698('0xa')](_0x4698('0xd'),auth[_0x4698('0xb')](),controller[_0x4698('0xe')]);router[_0x4698('0xa')](_0x4698('0xf'),auth['isAuthenticated'](),controller[_0x4698('0x10')]);router[_0x4698('0x11')]('/',auth[_0x4698('0xb')](),controller[_0x4698('0x12')]);router[_0x4698('0x13')](_0x4698('0xf'),auth[_0x4698('0xb')](),controller[_0x4698('0x14')]);router[_0x4698('0x15')](_0x4698('0xf'),auth[_0x4698('0xb')](),controller[_0x4698('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d7b363a..c38b144 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefe3=['sequelize','account','agent','queue','DATE'];(function(_0x1c4e07,_0x56e8a4){var _0x344614=function(_0xfe9ecd){while(--_0xfe9ecd){_0x1c4e07['push'](_0x1c4e07['shift']());}};_0x344614(++_0x56e8a4);}(_0xefe3,0xf5));var _0x3efe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xefe3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3efe('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3efe('0x1'),_0x3efe('0x2'),_0x3efe('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x3efe('0x4')]}}; \ No newline at end of file +var _0x751c=['sequelize','exports','STRING','account','queue'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x751c,0x69));var _0xc751=function(_0x37e143,_0x728888){_0x37e143=_0x37e143-0x0;var _0x7d140d=_0x751c[_0x37e143];return _0x7d140d;};'use strict';var Sequelize=require(_0xc751('0x0'));module[_0xc751('0x1')]={'uniqueid':{'type':Sequelize[_0xc751('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc751('0x3'),'agent',_0xc751('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 202e984..b2697b0 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb38=['order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0xeb38,0x15b));var _0x8eb3=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xeb38[_0x368fb9];return _0x4892fb;};'use strict';var emlformat=require(_0x8eb3('0x0'));var rimraf=require(_0x8eb3('0x1'));var zipdir=require(_0x8eb3('0x2'));var jsonpatch=require(_0x8eb3('0x3'));var rp=require(_0x8eb3('0x4'));var moment=require(_0x8eb3('0x5'));var BPromise=require(_0x8eb3('0x6'));var Mustache=require(_0x8eb3('0x7'));var util=require(_0x8eb3('0x8'));var path=require(_0x8eb3('0x9'));var sox=require(_0x8eb3('0xa'));var csv=require(_0x8eb3('0xb'));var ejs=require(_0x8eb3('0xc'));var fs=require('fs');var fs_extra=require(_0x8eb3('0xd'));var _=require(_0x8eb3('0xe'));var squel=require('squel');var crypto=require(_0x8eb3('0xf'));var jsforce=require(_0x8eb3('0x10'));var deskjs=require(_0x8eb3('0x11'));var toCsv=require(_0x8eb3('0xb'));var querystring=require(_0x8eb3('0x12'));var Papa=require(_0x8eb3('0x13'));var Redis=require(_0x8eb3('0x14'));var authService=require(_0x8eb3('0x15'));var qs=require(_0x8eb3('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eb3('0x17'));var logger=require('../../config/logger')(_0x8eb3('0x18'));var utils=require(_0x8eb3('0x19'));var config=require(_0x8eb3('0x1a'));var licenseUtil=require(_0x8eb3('0x1b'));var db=require(_0x8eb3('0x1c'))['db'];function respondWithStatusCode(_0x2da726,_0x42499c){_0x42499c=_0x42499c||0xcc;return function(_0x35cee4){if(_0x35cee4){return _0x2da726[_0x8eb3('0x1d')](_0x42499c);}return _0x2da726[_0x8eb3('0x1e')](_0x42499c)['end']();};}function respondWithResult(_0x13e972,_0xee19fb){_0xee19fb=_0xee19fb||0xc8;return function(_0x5bf5f7){if(_0x5bf5f7){return _0x13e972[_0x8eb3('0x1e')](_0xee19fb)[_0x8eb3('0x1f')](_0x5bf5f7);}};}function respondWithFilteredResult(_0x4fc288,_0x195c2b){return function(_0x27aa4d){if(_0x27aa4d){var _0xdb630e=typeof _0x195c2b[_0x8eb3('0x20')]===_0x8eb3('0x21')&&typeof _0x195c2b[_0x8eb3('0x22')]==='undefined';var _0xa3f853=_0x27aa4d[_0x8eb3('0x23')];var _0x5b04af=_0xdb630e?0x0:_0x195c2b['offset'];var _0x3bbb4c=_0xdb630e?_0x27aa4d['count']:_0x195c2b[_0x8eb3('0x20')]+_0x195c2b['limit'];var _0x1753a2;if(_0x3bbb4c>=_0xa3f853){_0x3bbb4c=_0xa3f853;_0x1753a2=0xc8;}else{_0x1753a2=0xce;}_0x4fc288[_0x8eb3('0x1e')](_0x1753a2);return _0x4fc288[_0x8eb3('0x24')](_0x8eb3('0x25'),_0x5b04af+'-'+_0x3bbb4c+'/'+_0xa3f853)['json'](_0x27aa4d);}return null;};}function patchUpdates(_0x205e4f){return function(_0xd65370){try{jsonpatch[_0x8eb3('0x26')](_0xd65370,_0x205e4f,!![]);}catch(_0x15f8cf){return BPromise[_0x8eb3('0x27')](_0x15f8cf);}return _0xd65370[_0x8eb3('0x28')]();};}function saveUpdates(_0x81825b,_0x25a175){return function(_0x31a9d4){if(_0x31a9d4){return _0x31a9d4[_0x8eb3('0x29')](_0x81825b)[_0x8eb3('0x2a')](function(_0x1ab62e){return _0x1ab62e;});}return null;};}function removeEntity(_0xb8c076,_0x30ae7b){return function(_0x1b3273){if(_0x1b3273){return _0x1b3273[_0x8eb3('0x2b')]()[_0x8eb3('0x2a')](function(){_0xb8c076['status'](0xcc)[_0x8eb3('0x2c')]();});}};}function handleEntityNotFound(_0x3f6c3f,_0x132d49){return function(_0x340097){if(!_0x340097){_0x3f6c3f[_0x8eb3('0x1d')](0x194);}return _0x340097;};}function handleError(_0x14bf6b,_0x26786f){_0x26786f=_0x26786f||0x1f4;return function(_0x2a0408){logger[_0x8eb3('0x2d')](_0x2a0408[_0x8eb3('0x2e')]);if(_0x2a0408[_0x8eb3('0x2f')]){delete _0x2a0408[_0x8eb3('0x2f')];}_0x14bf6b[_0x8eb3('0x1e')](_0x26786f)[_0x8eb3('0x30')](_0x2a0408);};}exports[_0x8eb3('0x31')]=function(_0x376e5f,_0x97d439){var _0x178fb6={},_0x2d29eb={},_0x4f7a72={'count':0x0,'rows':[]};var _0x574411=_[_0x8eb3('0x32')](db[_0x8eb3('0x33')]['rawAttributes'],function(_0x56de0f){return{'name':_0x56de0f[_0x8eb3('0x34')],'type':_0x56de0f['type'][_0x8eb3('0x35')]};});_0x2d29eb[_0x8eb3('0x36')]=_[_0x8eb3('0x32')](_0x574411,'name');_0x2d29eb[_0x8eb3('0x37')]=_[_0x8eb3('0x38')](_0x376e5f[_0x8eb3('0x37')]);_0x2d29eb[_0x8eb3('0x39')]=_[_0x8eb3('0x3a')](_0x2d29eb['model'],_0x2d29eb[_0x8eb3('0x37')]);_0x178fb6[_0x8eb3('0x3b')]=_[_0x8eb3('0x3a')](_0x2d29eb[_0x8eb3('0x36')],qs['fields'](_0x376e5f[_0x8eb3('0x37')][_0x8eb3('0x3c')]));_0x178fb6['attributes']=_0x178fb6[_0x8eb3('0x3b')][_0x8eb3('0x3d')]?_0x178fb6[_0x8eb3('0x3b')]:_0x2d29eb['model'];if(!_0x376e5f[_0x8eb3('0x37')][_0x8eb3('0x3e')]('nolimit')){_0x178fb6[_0x8eb3('0x22')]=qs[_0x8eb3('0x22')](_0x376e5f[_0x8eb3('0x37')][_0x8eb3('0x22')]);_0x178fb6['offset']=qs[_0x8eb3('0x20')](_0x376e5f[_0x8eb3('0x37')][_0x8eb3('0x20')]);}_0x178fb6[_0x8eb3('0x3f')]=qs['sort'](_0x376e5f[_0x8eb3('0x37')]['sort']);_0x178fb6[_0x8eb3('0x40')]=qs[_0x8eb3('0x39')](_[_0x8eb3('0x41')](_0x376e5f[_0x8eb3('0x37')],_0x2d29eb[_0x8eb3('0x39')]),_0x574411);if(_0x376e5f[_0x8eb3('0x37')][_0x8eb3('0x42')]){_0x178fb6['where']=_['merge'](_0x178fb6['where'],{'$or':_[_0x8eb3('0x32')](_0x574411,function(_0x5c1ee2){if(_0x5c1ee2['type']!==_0x8eb3('0x43')){var _0x761452={};_0x761452[_0x5c1ee2[_0x8eb3('0x2f')]]={'$like':'%'+_0x376e5f[_0x8eb3('0x37')][_0x8eb3('0x42')]+'%'};return _0x761452;}})});}_0x178fb6=_[_0x8eb3('0x44')]({},_0x178fb6,_0x376e5f[_0x8eb3('0x45')]);var _0x26bfa8={'where':_0x178fb6[_0x8eb3('0x40')]};return db['WhatsappTransferReport'][_0x8eb3('0x23')](_0x26bfa8)[_0x8eb3('0x2a')](function(_0xc8e14){_0x4f7a72[_0x8eb3('0x23')]=_0xc8e14;if(_0x376e5f[_0x8eb3('0x37')][_0x8eb3('0x46')]){_0x178fb6[_0x8eb3('0x47')]=[{'all':!![]}];}return db[_0x8eb3('0x33')][_0x8eb3('0x48')](_0x178fb6);})[_0x8eb3('0x2a')](function(_0x367d62){_0x4f7a72[_0x8eb3('0x49')]=_0x367d62;return _0x4f7a72;})[_0x8eb3('0x2a')](respondWithFilteredResult(_0x97d439,_0x178fb6))[_0x8eb3('0x4a')](handleError(_0x97d439,null));};exports[_0x8eb3('0x4b')]=function(_0x4ded9b,_0xda51dc){var _0x5c2b66={'raw':!![],'where':{'id':_0x4ded9b[_0x8eb3('0x4c')]['id']}},_0x4a27d3={};_0x4a27d3[_0x8eb3('0x36')]=_[_0x8eb3('0x38')](db[_0x8eb3('0x33')][_0x8eb3('0x4d')]);_0x4a27d3[_0x8eb3('0x37')]=_[_0x8eb3('0x38')](_0x4ded9b['query']);_0x4a27d3[_0x8eb3('0x39')]=_['intersection'](_0x4a27d3[_0x8eb3('0x36')],_0x4a27d3[_0x8eb3('0x37')]);_0x5c2b66[_0x8eb3('0x3b')]=_['intersection'](_0x4a27d3[_0x8eb3('0x36')],qs[_0x8eb3('0x3c')](_0x4ded9b[_0x8eb3('0x37')]['fields']));_0x5c2b66[_0x8eb3('0x3b')]=_0x5c2b66[_0x8eb3('0x3b')][_0x8eb3('0x3d')]?_0x5c2b66[_0x8eb3('0x3b')]:_0x4a27d3[_0x8eb3('0x36')];if(_0x4ded9b[_0x8eb3('0x37')][_0x8eb3('0x46')]){_0x5c2b66[_0x8eb3('0x47')]=[{'all':!![]}];}_0x5c2b66=_[_0x8eb3('0x44')]({},_0x5c2b66,_0x4ded9b[_0x8eb3('0x45')]);return db[_0x8eb3('0x33')][_0x8eb3('0x4e')](_0x5c2b66)['then'](handleEntityNotFound(_0xda51dc,null))[_0x8eb3('0x2a')](respondWithResult(_0xda51dc,null))[_0x8eb3('0x4a')](handleError(_0xda51dc,null));};exports['create']=function(_0x3c5293,_0xd8723a){return db['WhatsappTransferReport'][_0x8eb3('0x4f')](_0x3c5293['body'],{})[_0x8eb3('0x2a')](respondWithResult(_0xd8723a,0xc9))['catch'](handleError(_0xd8723a,null));};exports[_0x8eb3('0x29')]=function(_0x3f55d1,_0x43b009){if(_0x3f55d1[_0x8eb3('0x50')]['id']){delete _0x3f55d1[_0x8eb3('0x50')]['id'];}return db[_0x8eb3('0x33')][_0x8eb3('0x4e')]({'where':{'id':_0x3f55d1['params']['id']}})[_0x8eb3('0x2a')](handleEntityNotFound(_0x43b009,null))[_0x8eb3('0x2a')](saveUpdates(_0x3f55d1['body'],null))[_0x8eb3('0x2a')](respondWithResult(_0x43b009,null))[_0x8eb3('0x4a')](handleError(_0x43b009,null));};exports['destroy']=function(_0x25596b,_0x3419f7){return db[_0x8eb3('0x33')][_0x8eb3('0x4e')]({'where':{'id':_0x25596b['params']['id']}})[_0x8eb3('0x2a')](handleEntityNotFound(_0x3419f7,null))['then'](removeEntity(_0x3419f7,null))[_0x8eb3('0x4a')](handleError(_0x3419f7,null));};exports['describe']=function(_0x22d433,_0x401387){return db['WhatsappTransferReport'][_0x8eb3('0x51')]()[_0x8eb3('0x2a')](respondWithResult(_0x401387,null))[_0x8eb3('0x4a')](handleError(_0x401387,null));}; \ No newline at end of file +var _0x3330=['name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','error','stack'];(function(_0x48f3b7,_0x4de6a1){var _0x43bbf0=function(_0x9b17fc){while(--_0x9b17fc){_0x48f3b7['push'](_0x48f3b7['shift']());}};_0x43bbf0(++_0x4de6a1);}(_0x3330,0x1b5));var _0x0333=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x3330[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x0333('0x0'));var rimraf=require(_0x0333('0x1'));var zipdir=require(_0x0333('0x2'));var jsonpatch=require(_0x0333('0x3'));var rp=require(_0x0333('0x4'));var moment=require(_0x0333('0x5'));var BPromise=require(_0x0333('0x6'));var Mustache=require(_0x0333('0x7'));var util=require(_0x0333('0x8'));var path=require(_0x0333('0x9'));var sox=require(_0x0333('0xa'));var csv=require(_0x0333('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0333('0xc'));var squel=require(_0x0333('0xd'));var crypto=require(_0x0333('0xe'));var jsforce=require(_0x0333('0xf'));var deskjs=require(_0x0333('0x10'));var toCsv=require(_0x0333('0xb'));var querystring=require(_0x0333('0x11'));var Papa=require(_0x0333('0x12'));var Redis=require(_0x0333('0x13'));var authService=require(_0x0333('0x14'));var qs=require(_0x0333('0x15'));var as=require(_0x0333('0x16'));var hardwareService=require(_0x0333('0x17'));var logger=require(_0x0333('0x18'))(_0x0333('0x19'));var utils=require('../../config/utils');var config=require(_0x0333('0x1a'));var licenseUtil=require(_0x0333('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbc2899,_0x5e046d){_0x5e046d=_0x5e046d||0xcc;return function(_0x550df8){if(_0x550df8){return _0xbc2899[_0x0333('0x1c')](_0x5e046d);}return _0xbc2899[_0x0333('0x1d')](_0x5e046d)[_0x0333('0x1e')]();};}function respondWithResult(_0xd9a50b,_0x2eb87f){_0x2eb87f=_0x2eb87f||0xc8;return function(_0x5b0749){if(_0x5b0749){return _0xd9a50b['status'](_0x2eb87f)[_0x0333('0x1f')](_0x5b0749);}};}function respondWithFilteredResult(_0x4c58bb,_0x573ee1){return function(_0x41fd75){if(_0x41fd75){var _0x41f53a=typeof _0x573ee1[_0x0333('0x20')]==='undefined'&&typeof _0x573ee1[_0x0333('0x21')]===_0x0333('0x22');var _0x127c5d=_0x41fd75[_0x0333('0x23')];var _0x1974c7=_0x41f53a?0x0:_0x573ee1[_0x0333('0x20')];var _0x1a8454=_0x41f53a?_0x41fd75[_0x0333('0x23')]:_0x573ee1[_0x0333('0x20')]+_0x573ee1[_0x0333('0x21')];var _0x4ec516;if(_0x1a8454>=_0x127c5d){_0x1a8454=_0x127c5d;_0x4ec516=0xc8;}else{_0x4ec516=0xce;}_0x4c58bb[_0x0333('0x1d')](_0x4ec516);return _0x4c58bb[_0x0333('0x24')](_0x0333('0x25'),_0x1974c7+'-'+_0x1a8454+'/'+_0x127c5d)['json'](_0x41fd75);}return null;};}function patchUpdates(_0x1de113){return function(_0x1f43bb){try{jsonpatch['apply'](_0x1f43bb,_0x1de113,!![]);}catch(_0x1118de){return BPromise['reject'](_0x1118de);}return _0x1f43bb[_0x0333('0x26')]();};}function saveUpdates(_0x1ae7f2,_0x442dc9){return function(_0x14480d){if(_0x14480d){return _0x14480d[_0x0333('0x27')](_0x1ae7f2)['then'](function(_0xd90ea7){return _0xd90ea7;});}return null;};}function removeEntity(_0x56164e,_0x471069){return function(_0x4209d2){if(_0x4209d2){return _0x4209d2['destroy']()[_0x0333('0x28')](function(){_0x56164e[_0x0333('0x1d')](0xcc)[_0x0333('0x1e')]();});}};}function handleEntityNotFound(_0x311c5a,_0x26cdc3){return function(_0x42af23){if(!_0x42af23){_0x311c5a[_0x0333('0x1c')](0x194);}return _0x42af23;};}function handleError(_0x321b1f,_0x730603){_0x730603=_0x730603||0x1f4;return function(_0x3eb769){logger[_0x0333('0x29')](_0x3eb769[_0x0333('0x2a')]);if(_0x3eb769[_0x0333('0x2b')]){delete _0x3eb769[_0x0333('0x2b')];}_0x321b1f['status'](_0x730603)['send'](_0x3eb769);};}exports[_0x0333('0x2c')]=function(_0x55a873,_0xd9e41d){var _0x2cefa7={},_0x75c927={},_0x5ba095={'count':0x0,'rows':[]};var _0x5d2b4b=_[_0x0333('0x2d')](db[_0x0333('0x2e')][_0x0333('0x2f')],function(_0x260eb8){return{'name':_0x260eb8[_0x0333('0x30')],'type':_0x260eb8[_0x0333('0x31')][_0x0333('0x32')]};});_0x75c927[_0x0333('0x33')]=_[_0x0333('0x2d')](_0x5d2b4b,'name');_0x75c927[_0x0333('0x34')]=_[_0x0333('0x35')](_0x55a873[_0x0333('0x34')]);_0x75c927['filters']=_['intersection'](_0x75c927['model'],_0x75c927[_0x0333('0x34')]);_0x2cefa7[_0x0333('0x36')]=_[_0x0333('0x37')](_0x75c927[_0x0333('0x33')],qs[_0x0333('0x38')](_0x55a873[_0x0333('0x34')]['fields']));_0x2cefa7[_0x0333('0x36')]=_0x2cefa7[_0x0333('0x36')]['length']?_0x2cefa7[_0x0333('0x36')]:_0x75c927[_0x0333('0x33')];if(!_0x55a873[_0x0333('0x34')][_0x0333('0x39')](_0x0333('0x3a'))){_0x2cefa7[_0x0333('0x21')]=qs[_0x0333('0x21')](_0x55a873[_0x0333('0x34')][_0x0333('0x21')]);_0x2cefa7[_0x0333('0x20')]=qs[_0x0333('0x20')](_0x55a873[_0x0333('0x34')][_0x0333('0x20')]);}_0x2cefa7[_0x0333('0x3b')]=qs['sort'](_0x55a873['query']['sort']);_0x2cefa7['where']=qs[_0x0333('0x3c')](_[_0x0333('0x3d')](_0x55a873[_0x0333('0x34')],_0x75c927[_0x0333('0x3c')]),_0x5d2b4b);if(_0x55a873[_0x0333('0x34')][_0x0333('0x3e')]){_0x2cefa7[_0x0333('0x3f')]=_[_0x0333('0x40')](_0x2cefa7[_0x0333('0x3f')],{'$or':_[_0x0333('0x2d')](_0x5d2b4b,function(_0x4a60b2){if(_0x4a60b2[_0x0333('0x31')]!==_0x0333('0x41')){var _0x403d66={};_0x403d66[_0x4a60b2[_0x0333('0x2b')]]={'$like':'%'+_0x55a873[_0x0333('0x34')][_0x0333('0x3e')]+'%'};return _0x403d66;}})});}_0x2cefa7=_[_0x0333('0x40')]({},_0x2cefa7,_0x55a873[_0x0333('0x42')]);var _0x590a16={'where':_0x2cefa7[_0x0333('0x3f')]};return db[_0x0333('0x2e')]['count'](_0x590a16)[_0x0333('0x28')](function(_0x32b99c){_0x5ba095['count']=_0x32b99c;if(_0x55a873[_0x0333('0x34')][_0x0333('0x43')]){_0x2cefa7[_0x0333('0x44')]=[{'all':!![]}];}return db[_0x0333('0x2e')][_0x0333('0x45')](_0x2cefa7);})[_0x0333('0x28')](function(_0x4e84f8){_0x5ba095[_0x0333('0x46')]=_0x4e84f8;return _0x5ba095;})[_0x0333('0x28')](respondWithFilteredResult(_0xd9e41d,_0x2cefa7))['catch'](handleError(_0xd9e41d,null));};exports[_0x0333('0x47')]=function(_0xefa4fc,_0x503359){var _0x2fc279={'raw':!![],'where':{'id':_0xefa4fc[_0x0333('0x48')]['id']}},_0x3af90a={};_0x3af90a[_0x0333('0x33')]=_[_0x0333('0x35')](db[_0x0333('0x2e')]['rawAttributes']);_0x3af90a[_0x0333('0x34')]=_['keys'](_0xefa4fc['query']);_0x3af90a[_0x0333('0x3c')]=_[_0x0333('0x37')](_0x3af90a['model'],_0x3af90a[_0x0333('0x34')]);_0x2fc279[_0x0333('0x36')]=_[_0x0333('0x37')](_0x3af90a['model'],qs[_0x0333('0x38')](_0xefa4fc[_0x0333('0x34')]['fields']));_0x2fc279[_0x0333('0x36')]=_0x2fc279[_0x0333('0x36')][_0x0333('0x49')]?_0x2fc279['attributes']:_0x3af90a['model'];if(_0xefa4fc[_0x0333('0x34')][_0x0333('0x43')]){_0x2fc279['include']=[{'all':!![]}];}_0x2fc279=_[_0x0333('0x40')]({},_0x2fc279,_0xefa4fc[_0x0333('0x42')]);return db[_0x0333('0x2e')][_0x0333('0x4a')](_0x2fc279)['then'](handleEntityNotFound(_0x503359,null))['then'](respondWithResult(_0x503359,null))['catch'](handleError(_0x503359,null));};exports['create']=function(_0x1b4f60,_0x3a308d){return db[_0x0333('0x2e')][_0x0333('0x4b')](_0x1b4f60[_0x0333('0x4c')],{})[_0x0333('0x28')](respondWithResult(_0x3a308d,0xc9))[_0x0333('0x4d')](handleError(_0x3a308d,null));};exports[_0x0333('0x27')]=function(_0x2741fd,_0x1c7bf0){if(_0x2741fd[_0x0333('0x4c')]['id']){delete _0x2741fd[_0x0333('0x4c')]['id'];}return db['WhatsappTransferReport'][_0x0333('0x4a')]({'where':{'id':_0x2741fd['params']['id']}})['then'](handleEntityNotFound(_0x1c7bf0,null))[_0x0333('0x28')](saveUpdates(_0x2741fd[_0x0333('0x4c')],null))[_0x0333('0x28')](respondWithResult(_0x1c7bf0,null))[_0x0333('0x4d')](handleError(_0x1c7bf0,null));};exports[_0x0333('0x4e')]=function(_0x39946e,_0x440f58){return db[_0x0333('0x2e')][_0x0333('0x4a')]({'where':{'id':_0x39946e['params']['id']}})[_0x0333('0x28')](handleEntityNotFound(_0x440f58,null))[_0x0333('0x28')](removeEntity(_0x440f58,null))[_0x0333('0x4d')](handleError(_0x440f58,null));};exports[_0x0333('0x4f')]=function(_0x66bcb9,_0x2aa41d){return db['WhatsappTransferReport'][_0x0333('0x4f')]()[_0x0333('0x28')](respondWithResult(_0x2aa41d,null))[_0x0333('0x4d')](handleError(_0x2aa41d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index c6f5616..772ba4f 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8f0=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','api','moment','request-promise','exports'];(function(_0x41f429,_0x5e8560){var _0x122a59=function(_0x453a89){while(--_0x453a89){_0x41f429['push'](_0x41f429['shift']());}};_0x122a59(++_0x5e8560);}(_0xa8f0,0x13c));var _0x0a8f=function(_0x10d8c7,_0xa80d12){_0x10d8c7=_0x10d8c7-0x0;var _0x4105b9=_0xa8f0[_0x10d8c7];return _0x4105b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0a8f('0x0'));var moment=require(_0x0a8f('0x1'));var BPromise=require('bluebird');var rp=require(_0x0a8f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x0a8f('0x3')]=function(_0x293cdd,_0xa39bcc){return _0x293cdd[_0x0a8f('0x4')](_0x0a8f('0x5'),attributes,{'tableName':_0x0a8f('0x6'),'paranoid':![],'indexes':[{'name':_0x0a8f('0x7'),'fields':[_0x0a8f('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5259=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x35bf6b,_0x3dd3bc){var _0x4b80ce=function(_0x840014){while(--_0x840014){_0x35bf6b['push'](_0x35bf6b['shift']());}};_0x4b80ce(++_0x3dd3bc);}(_0x5259,0x161));var _0x9525=function(_0x4311fc,_0x507cac){_0x4311fc=_0x4311fc-0x0;var _0x4672ef=_0x5259[_0x4311fc];return _0x4672ef;};'use strict';var _=require('lodash');var util=require(_0x9525('0x0'));var logger=require(_0x9525('0x1'))('api');var moment=require(_0x9525('0x2'));var BPromise=require('bluebird');var rp=require(_0x9525('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9525('0x4'));var config=require(_0x9525('0x5'));var attributes=require(_0x9525('0x6'));module[_0x9525('0x7')]=function(_0x29ac98,_0x4232db){return _0x29ac98[_0x9525('0x8')](_0x9525('0x9'),attributes,{'tableName':_0x9525('0xa'),'paranoid':![],'indexes':[{'name':_0x9525('0xb'),'fields':[_0x9525('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 3732c92..cf63a50 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6876=['jayson/promise','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6876,0x13a));var _0x6687=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x6876[_0x79cd47];return _0x3b9484;};'use strict';var _=require(_0x6687('0x0'));var util=require(_0x6687('0x1'));var moment=require('moment');var BPromise=require(_0x6687('0x2'));var rs=require(_0x6687('0x3'));var fs=require('fs');var Redis=require(_0x6687('0x4'));var db=require(_0x6687('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6687('0x6'))('rpc');var config=require(_0x6687('0x7'));var jayson=require(_0x6687('0x8'));var client=jayson['client'][_0x6687('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49b00c,_0x4a817c,_0x4af142){return new BPromise(function(_0x1f8f96,_0x132d0a){return client[_0x6687('0xa')](_0x49b00c,_0x4af142)[_0x6687('0xb')](function(_0x18ef59){logger[_0x6687('0xc')](_0x6687('0xd'),_0x4a817c,'request\x20sent');logger[_0x6687('0xe')](_0x6687('0xf'),_0x4a817c,_0x6687('0x10'),JSON[_0x6687('0x11')](_0x18ef59));if(_0x18ef59[_0x6687('0x12')]){if(_0x18ef59[_0x6687('0x12')][_0x6687('0x13')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x4a817c,_0x18ef59['error'][_0x6687('0x14')]);return _0x132d0a(_0x18ef59[_0x6687('0x12')][_0x6687('0x14')]);}logger[_0x6687('0x12')](_0x6687('0xd'),_0x4a817c,_0x18ef59[_0x6687('0x12')][_0x6687('0x14')]);return _0x1f8f96(_0x18ef59[_0x6687('0x12')][_0x6687('0x14')]);}else{logger[_0x6687('0xc')](_0x6687('0xd'),_0x4a817c,_0x6687('0x10'));_0x1f8f96(_0x18ef59[_0x6687('0x15')][_0x6687('0x14')]);}})[_0x6687('0x16')](function(_0x46af0c){logger[_0x6687('0x12')](_0x6687('0xd'),_0x4a817c,_0x46af0c);_0x132d0a(_0x46af0c);});});} \ No newline at end of file +var _0x2863=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x262972,_0xc36bc7){var _0x518c1c=function(_0x3b65e8){while(--_0x3b65e8){_0x262972['push'](_0x262972['shift']());}};_0x518c1c(++_0xc36bc7);}(_0x2863,0xd2));var _0x3286=function(_0x1d4430,_0x12d380){_0x1d4430=_0x1d4430-0x0;var _0x596793=_0x2863[_0x1d4430];return _0x596793;};'use strict';var _=require(_0x3286('0x0'));var util=require(_0x3286('0x1'));var moment=require(_0x3286('0x2'));var BPromise=require(_0x3286('0x3'));var rs=require(_0x3286('0x4'));var fs=require('fs');var Redis=require(_0x3286('0x5'));var db=require(_0x3286('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3286('0x7'))(_0x3286('0x8'));var config=require(_0x3286('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3286('0xa')][_0x3286('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c74da,_0x502d84,_0x2a8721){return new BPromise(function(_0x1aca73,_0x38b92b){return client['request'](_0x6c74da,_0x2a8721)[_0x3286('0xc')](function(_0x1b1aeb){logger[_0x3286('0xd')](_0x3286('0xe'),_0x502d84,'request\x20sent');logger[_0x3286('0xf')](_0x3286('0x10'),_0x502d84,_0x3286('0x11'),JSON[_0x3286('0x12')](_0x1b1aeb));if(_0x1b1aeb[_0x3286('0x13')]){if(_0x1b1aeb[_0x3286('0x13')][_0x3286('0x14')]===0x1f4){logger['error'](_0x3286('0xe'),_0x502d84,_0x1b1aeb[_0x3286('0x13')]['message']);return _0x38b92b(_0x1b1aeb[_0x3286('0x13')][_0x3286('0x15')]);}logger['error'](_0x3286('0xe'),_0x502d84,_0x1b1aeb['error'][_0x3286('0x15')]);return _0x1aca73(_0x1b1aeb['error']['message']);}else{logger[_0x3286('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x502d84,_0x3286('0x11'));_0x1aca73(_0x1b1aeb[_0x3286('0x16')][_0x3286('0x15')]);}})[_0x3286('0x17')](function(_0x2c8b86){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x502d84,_0x2c8b86);_0x38b92b(_0x2c8b86);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e0165b4..5a86728 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e17=['Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','map','pm2_env','Online\x20apps:','online','name','Offline\x20apps:','join','None','log'];(function(_0x323d57,_0xf54d07){var _0x4271c2=function(_0x162f4e){while(--_0x162f4e){_0x323d57['push'](_0x323d57['shift']());}};_0x4271c2(++_0xf54d07);}(_0x5e17,0x17a));var _0x75e1=function(_0x186fed,_0x3e1f20){_0x186fed=_0x186fed-0x0;var _0x258e7b=_0x5e17[_0x186fed];return _0x258e7b;};'use strict';var _=require(_0x75e1('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0x75e1('0x1'))(_0x75e1('0x2'));var pm2=require(_0x75e1('0x3'));var pm2Config=require(_0x75e1('0x4'));var schedule=require(_0x75e1('0x5'));var chat=require(_0x75e1('0x6'));var whatsapp=require(_0x75e1('0x7'));var transcribe=require(_0x75e1('0x8'));var provider=require(_0x75e1('0x9'));function main(){return db[_0x75e1('0xa')][_0x75e1('0xb')]()[_0x75e1('0xc')](function(){if(config[_0x75e1('0xd')]){return seedDb[_0x75e1('0xe')]();}})[_0x75e1('0xc')](function(){return checkLicense['default']();})[_0x75e1('0xc')](function(){return rpc['listen']();})['then'](function(_0x9a257e){logger[_0x75e1('0xf')](_0x9a257e);return chat[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(){return whatsapp[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(){return schedule[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(){return transcribe['start']();})[_0x75e1('0xc')](function(){return provider[_0x75e1('0x10')]();})[_0x75e1('0xc')](function(_0x5376e0){logger[_0x75e1('0xf')](_0x5376e0);return pm2[_0x75e1('0x10')](pm2Config);})[_0x75e1('0xc')](function(_0x260f06){var _0x582b54=_0x260f06[_0x75e1('0x11')](function(_0x262ac4){return typeof _0x262ac4[_0x75e1('0x12')]===_0x75e1('0x13')&&_0x262ac4[_0x75e1('0x12')]>=0x0;});if(_0x582b54[_0x75e1('0x14')]>0x0){throw new Error(_0x582b54[_0x75e1('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x75e1('0x15')](_0x582b54,function(_0x14dc9d){return'\x22'+_0x14dc9d[_0x75e1('0x16')]['name']+'\x22';}));}logger[_0x75e1('0xf')](_0x75e1('0x17'),_['map'](_[_0x75e1('0x11')](_0x260f06,{'status':_0x75e1('0x18')}),_0x75e1('0x19'))['join']());logger[_0x75e1('0xf')](_0x75e1('0x1a'),_[_0x75e1('0x15')](_[_0x75e1('0x11')](_0x260f06,function(_0x1ae04e){return _0x1ae04e['status']!==_0x75e1('0x18');}),'name')[_0x75e1('0x1b')]()||_0x75e1('0x1c'));console[_0x75e1('0x1d')]('App\x20Ready!');})['catch'](function(_0x266715){console[_0x75e1('0x1d')](_0x75e1('0x1e'),_0x266715);logger[_0x75e1('0x1f')](_0x75e1('0x20'),_0x266715);process[_0x75e1('0x21')](0x1);});}main(); \ No newline at end of file +var _0x0f80=['pm2_env','name','Online\x20apps:','Offline\x20apps:','status','online','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','filter','number','exitCode','length','map'];(function(_0x3496dc,_0x9c4bbd){var _0x1bface=function(_0x2fa18d){while(--_0x2fa18d){_0x3496dc['push'](_0x3496dc['shift']());}};_0x1bface(++_0x9c4bbd);}(_0x0f80,0x108));var _0x00f8=function(_0x332514,_0x5a8763){_0x332514=_0x332514-0x0;var _0x2b267c=_0x0f80[_0x332514];return _0x2b267c;};'use strict';var _=require('lodash');var db=require(_0x00f8('0x0'))['db'];var seedDb=require(_0x00f8('0x1'));var checkLicense=require(_0x00f8('0x2'));var rpc=require(_0x00f8('0x3'));var config=require(_0x00f8('0x4'));var logger=require('./config/logger')(_0x00f8('0x5'));var pm2=require(_0x00f8('0x6'));var pm2Config=require(_0x00f8('0x7'));var schedule=require('./config/schedule');var chat=require(_0x00f8('0x8'));var whatsapp=require(_0x00f8('0x9'));var transcribe=require(_0x00f8('0xa'));var provider=require(_0x00f8('0xb'));function main(){return db[_0x00f8('0xc')][_0x00f8('0xd')]()[_0x00f8('0xe')](function(){if(config['seedDB']){return seedDb[_0x00f8('0xf')]();}})[_0x00f8('0xe')](function(){return checkLicense[_0x00f8('0xf')]();})['then'](function(){return rpc[_0x00f8('0x10')]();})[_0x00f8('0xe')](function(_0x2b2794){logger[_0x00f8('0x11')](_0x2b2794);return chat[_0x00f8('0x12')]();})['then'](function(){return whatsapp['start']();})[_0x00f8('0xe')](function(){return schedule['start']();})['then'](function(){return transcribe[_0x00f8('0x12')]();})['then'](function(){return provider[_0x00f8('0x12')]();})[_0x00f8('0xe')](function(_0x4e10cf){logger[_0x00f8('0x11')](_0x4e10cf);return pm2['start'](pm2Config);})['then'](function(_0x371b6a){var _0x31cdee=_0x371b6a[_0x00f8('0x13')](function(_0x3e2bea){return typeof _0x3e2bea['exitCode']===_0x00f8('0x14')&&_0x3e2bea[_0x00f8('0x15')]>=0x0;});if(_0x31cdee[_0x00f8('0x16')]>0x0){throw new Error(_0x31cdee[_0x00f8('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x00f8('0x17')](_0x31cdee,function(_0x22003e){return'\x22'+_0x22003e[_0x00f8('0x18')][_0x00f8('0x19')]+'\x22';}));}logger[_0x00f8('0x11')](_0x00f8('0x1a'),_[_0x00f8('0x17')](_['filter'](_0x371b6a,{'status':'online'}),_0x00f8('0x19'))['join']());logger[_0x00f8('0x11')](_0x00f8('0x1b'),_['map'](_[_0x00f8('0x13')](_0x371b6a,function(_0x1f9599){return _0x1f9599[_0x00f8('0x1c')]!==_0x00f8('0x1d');}),_0x00f8('0x19'))[_0x00f8('0x1e')]()||_0x00f8('0x1f'));console[_0x00f8('0x20')](_0x00f8('0x21'));})[_0x00f8('0x22')](function(_0x254615){console[_0x00f8('0x20')](_0x00f8('0x23'),_0x254615);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x254615);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e48a037..ed13cb2 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x5cabc2,_0x40a796){var _0x228011=function(_0xac33d7){while(--_0xac33d7){_0x5cabc2['push'](_0x5cabc2['shift']());}};_0x228011(++_0x40a796);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x41dfac,_0x278319){_0x41dfac=_0x41dfac-0x0;var _0x12900b=_0xf3cd[_0x41dfac];return _0x12900b;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file +var _0xb43b=['headers','then','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','startsWith'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4f7bd8,_0x484c81){_0x4f7bd8=_0x4f7bd8-0x0;var _0xddbd32=_0xb43b[_0x4f7bd8];return _0xddbd32;};'use strict';var db=require(_0xbb43('0x0'))['db'];var config=require(_0xbb43('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xbb43('0x2'));var encryptor=require(_0xbb43('0x3'));var _=require(_0xbb43('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xbb43('0x5'));var compose=require(_0xbb43('0x6'));var basicAuth=require(_0xbb43('0x7'));var crypto=require(_0xbb43('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xbb43('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xbb43('0xa')]});var userAttributes=['id',_0xbb43('0xb'),_0xbb43('0xc'),_0xbb43('0xd'),_0xbb43('0xe'),'email',_0xbb43('0xf'),_0xbb43('0x10'),'md5secret',_0xbb43('0x11'),_0xbb43('0x12'),_0xbb43('0x13'),_0xbb43('0x14'),_0xbb43('0x15'),_0xbb43('0x16'),'pauseType',_0xbb43('0x17'),_0xbb43('0x18'),'lastPauseAt','crudPermissions',_0xbb43('0x19'),'passwordResetAt','alias',_0xbb43('0x1a'),'phoneBarAutoAnswerDelay',_0xbb43('0x1b'),_0xbb43('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0xbb43('0x1d'),_0xbb43('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xbb43('0x1f'),'userProfileId','privacyEnabled',_0xbb43('0x20'),_0xbb43('0x21'),_0xbb43('0x22'),'downloadOmnichannelInteractions',_0xbb43('0x23'),'ignorePauseForPreviewCalls',_0xbb43('0x24'),_0xbb43('0x25'),'chatAutoanswerDelay','emailAutoanswer',_0xbb43('0x26'),_0xbb43('0x27'),_0xbb43('0x28'),_0xbb43('0x29'),'openchannelAutoanswerDelay',_0xbb43('0x2a'),'faxAutoanswerDelay',_0xbb43('0x2b'),'whatsappAutoanswerDelay'];exports[_0xbb43('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xbb43('0x2d')](function(_0x451cbd,_0x577ddd,_0x1d0768){if(_0x451cbd['user']){_0x1d0768();}else{return db[_0xbb43('0x2e')][_0xbb43('0x2f')]({'where':{'id':_0x451cbd[_0xbb43('0x30')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x269ca5){if(_0x269ca5&&_0x269ca5[_0xbb43('0x31')]){return _0x577ddd['status'](_0x269ca5[_0xbb43('0x32')]===_0xbb43('0x33')?0x195:0x193)[_0xbb43('0x34')]({'message':_0x269ca5[_0xbb43('0x32')]==='unmanaged'?'Unmanaged.':_0xbb43('0x35')});}else{_0x1d0768();}})[_0xbb43('0x36')](function(_0xa88db0){_0x1d0768(_0xa88db0);});}});};exports[_0xbb43('0x37')]=function isAuthenticated(_0x510b05){return compose()[_0xbb43('0x2d')](function(_0x21d386,_0x473828,_0x539730){var _0x2ad6da;if(_0x21d386['headers'][_0xbb43('0x38')]){if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],'Basic')){var _0x157d62=basicAuth(_0x21d386);db['User']['find']({'where':{'name':_0x157d62['name']}})[_0xbb43('0x3b')](function(_0x573a05){if(!_0x573a05||!_0x573a05[_0xbb43('0x3c')](_0x157d62[_0xbb43('0x3d')])){return _0x473828[_0xbb43('0x3e')](0x191)['json']({'message':_0xbb43('0x3f')});}_0x21d386[_0xbb43('0x40')]={'id':_0x573a05['id']};_0x539730();})[_0xbb43('0x36')](function(_0xd987fa){_0x539730(_0xd987fa);});}else if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],_0xbb43('0x41'))){validateJwt(_0x21d386,_0x473828,_0x539730);}else{if(_0x510b05){_0x539730();}else{return _0x473828['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}}}else if(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')]){try{var _0x4015ec={'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf[_0xbb43('0x45')]()};verifyJwt(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')],_0x4015ec)[_0xbb43('0x3b')](function(_0x21346a){return db[_0xbb43('0x46')][_0xbb43('0x47')]({'where':{'id':_0x21346a[_0xbb43('0x48')]}})[_0xbb43('0x3b')](function(_0x405f36){_0x2ad6da=_0x405f36;return db['Setting'][_0xbb43('0x2f')]({'where':{'id':0x1},'attributes':[_0xbb43('0x49'),'blockDuration'],'raw':!![]});})[_0xbb43('0x3b')](function(_0x2c9a7c){if(!_0x2ad6da||!_[_0xbb43('0x4a')](_0x2ad6da['apiKeyNonce'],_0x21346a['nonce'])){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4b')});}if(_0x2ad6da['disabled']){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}if(_0x2ad6da[_0xbb43('0x4d')]){if(_0x2c9a7c[_0xbb43('0x4e')]>0x0){if(moment(_0x2ad6da[_0xbb43('0x4f')])['add'](_0x2c9a7c[_0xbb43('0x4e')],_0xbb43('0x50'))>moment()){return _0x473828[_0xbb43('0x3e')](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}}else{return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x21d386[_0xbb43('0x40')]={'id':_0x2ad6da['id']};_0x539730();});})[_0xbb43('0x36')](function(){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fcf64){_0x539730(_0x1fcf64);}}else if(_0x510b05){_0x539730();}else{return _0x473828[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}})['use'](function(_0x3e0871,_0x136bd4,_0x59750b){if(_0x3e0871[_0xbb43('0x40')]){db['User'][_0xbb43('0x47')]({'where':{'id':_0x3e0871[_0xbb43('0x40')]['id']},'attributes':userAttributes})[_0xbb43('0x3b')](function(_0x14e57e){if(!_0x14e57e){return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':'User\x20not\x20found.'});}_0x3e0871[_0xbb43('0x40')]=_0x14e57e;_0x59750b();})['catch'](function(_0x307f1e){_0x59750b(_0x307f1e);});}else if(_0x510b05){_0x59750b();}else{return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':_0xbb43('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb43('0x2d')](function(_0x39f75f,_0x4bc351,_0x24ba15){return licenseUtil[_0xbb43('0x52')]()[_0xbb43('0x3b')](function(_0x40f519){if(_0x40f519[_0xbb43('0x53')]){_0x24ba15();}else{return _0x4bc351['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x54')});}})['catch'](function(_0x1a66f0){_0x24ba15(_0x1a66f0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d7034,_0x5e2e6d,_0x1c3482){return licenseUtil['getLicense']()[_0xbb43('0x3b')](function(_0x5e5c86){if(_0x5e5c86[_0xbb43('0x55')]){_0x1c3482();}else{return _0x5e2e6d[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':'Forbidden'});}})[_0xbb43('0x36')](function(_0x4d9f18){_0x1c3482(_0x4d9f18);});});};exports[_0xbb43('0x56')]=function(_0x2518bf,_0xd43d24,_0x29840e){_0x2518bf[_0xbb43('0x56')]=!![];return _0x29840e();};exports[_0xbb43('0x57')]=function signToken(_0x37d8d3){return signJwt(_0x37d8d3);};exports['setTokenCookie']=function(_0x93f6e7,_0x26ea59){if(!_0x93f6e7[_0xbb43('0x40')]){return _0x26ea59[_0xbb43('0x3e')](0x194)['json']({'message':_0xbb43('0x58')});}var _0x3233b7={'payload':{'id':_0x93f6e7[_0xbb43('0x40')]['id'],'role':_0x93f6e7[_0xbb43('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3233b7)[_0xbb43('0x3b')](function(_0x3fdb10){_0x26ea59[_0xbb43('0x59')]('motion.token',_0x3fdb10);_0x26ea59[_0xbb43('0x5a')](_0xbb43('0x5b'));})[_0xbb43('0x36')](function(_0x1dc40a){return _0x26ea59[_0xbb43('0x3e')](0x1f4)['send'](_0x1dc40a);});};exports['retrieveApiKey']=function(_0xb44557){if(_['isNil'](_0xb44557[_0xbb43('0x5c')])||_[_0xbb43('0x5d')](_0xb44557['apiKeyIat'])){return null;}else{return createJwt(_0xb44557);}};exports[_0xbb43('0x5e')]=function(_0x3719dc){_0x3719dc[_0xbb43('0x5c')]=generateNonce();_0x3719dc[_0xbb43('0x5f')]=generateIssuedAt();return createJwt(_0x3719dc);};exports[_0xbb43('0x60')]=function(_0x5cb3c6,_0x124f88){var _0x539ffc=_0x5cb3c6['query'][_0xbb43('0x44')];if(_0x539ffc){var _0x1b9307={'nonce':_0x124f88[_0xbb43('0x5c')],'iat':_0x124f88[_0xbb43('0x5f')],'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x539ffc,_0x1b9307)['then'](function(){return generateApiKey(_0x124f88);});}else{throw{'message':_0xbb43('0x61')};}};exports[_0xbb43('0x62')]=function(_0x3a84ad){var _0x308646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x308646[_0xbb43('0x63')](_0x3a84ad))throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0xbb43('0x66'));return;};exports[_0xbb43('0x67')]=function(_0x578b85,_0x1b6f96,_0xb996d7){var _0x432bd8=encryptor[_0xbb43('0x68')](_0x1b6f96)[_0xbb43('0x69')](',');for(var _0x1fae27=0x0;_0x1fae27<_0xb996d7;_0x1fae27++){if(!_0x432bd8[_0x1fae27])break;if(_0x578b85[_0xbb43('0x6a')]()===_0x432bd8[_0x1fae27][_0xbb43('0x6a')]()){var _0x3e01e4=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb996d7);if(_0xb996d7===0x1){_0x3e01e4=_0xbb43('0x6b');}throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0x3e01e4);}}return;};exports[_0xbb43('0x6c')]=function(_0x38814a,_0x19e27e){var _0x2e01fb=_0x19e27e?encryptor['decryptString'](_0x19e27e)[_0xbb43('0x69')](','):[];if(_0x2e01fb['length']===0x5){_0x2e01fb['splice'](-0x1,0x1);}_0x2e01fb[_0xbb43('0x6d')](_0x38814a);return encryptor[_0xbb43('0x6e')](_0x2e01fb[_0xbb43('0x6f')](','));};function signJwt(_0x22ce17){var _0x24393a=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x71')],{'context':jwt});var _0x341481=_0x22ce17['secret']||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0x2b96b8,_0x137e75){_0x24393a(_0x22ce17[_0xbb43('0x72')],_0x341481,_0x22ce17[_0xbb43('0x73')])[_0xbb43('0x3b')](function(_0x12717e){_0x2b96b8(_0x12717e);})[_0xbb43('0x36')](function(_0x3ca6ad){_0x137e75(_0x3ca6ad);});});}function verifyJwt(_0x555426,_0x165936,_0x392d1a){var _0x234bc7=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x74')],{'context':jwt});var _0x33a4db=_0x392d1a||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0xb48be2,_0x42e437){_0x234bc7(_0x555426,_0x33a4db,_0x165936)[_0xbb43('0x3b')](function(_0xc34a02){_0xb48be2(_0xc34a02);})['catch'](function(_0x3c260f){_0x42e437(_0x3c260f);});});}function generateNonce(){return crypto[_0xbb43('0x75')](0x10)[_0xbb43('0x76')](_0xbb43('0x77'));}function generateIssuedAt(){return Math[_0xbb43('0x78')](Date[_0xbb43('0x79')]()/0x3e8)[_0xbb43('0x76')]();}function createJwt(_0x2992ea){var _0x10fd8b={'payload':{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce']},'options':{'algorithm':_0xbb43('0x7a'),'subject':_0x2992ea['id']['toString'](),'issuer':hardwareConf[_0xbb43('0x45')](),'audience':hardwareConf[_0xbb43('0x45')]()}};return signJwt(_0x10fd8b)[_0xbb43('0x3b')](function(_0x3dbcd9){return{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce'],'token':_0x3dbcd9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index d6d5ab7..f1979ec 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['rows','catch','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','fields','user','clause','tags','skip','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts'];(function(_0x18e55c,_0x513fc8){var _0x2070f2=function(_0x3a038){while(--_0x3a038){_0x18e55c['push'](_0x18e55c['shift']());}};_0x2070f2(++_0x513fc8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3f845b,_0x25bb5b){_0x3f845b=_0x3f845b-0x0;var _0x324a6b=_0x5f2f[_0x3f845b];return _0x324a6b;};'use strict';var _=require(_0xf5f2('0x0'));var sqlUtils=require(_0xf5f2('0x1'));var db=require(_0xf5f2('0x2'))['db'];exports[_0xf5f2('0x3')]=function(_0x1172dd,_0x174bc7,_0x3c72ee,_0x107cf){var _0x501fbd={'count':0x0,'rows':[]};var _0x4854b6=sqlUtils[_0xf5f2('0x4')](_0x174bc7,_0x1172dd);if(_0x4854b6){return Promise[_0xf5f2('0x5')](_0x501fbd);}var _0xad7f65=sqlUtils[_0xf5f2('0x6')]();var _0x3133bc={};var _0x473100=![];var _0x5907aa=![];return Promise[_0xf5f2('0x5')]()[_0xf5f2('0x7')](function(){if(_0x1172dd[_0xf5f2('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1172dd[_0xf5f2('0x8')],_0x107cf);}else{return sqlUtils[_0xf5f2('0x9')](_0x1172dd,_0x107cf);}})[_0xf5f2('0x7')](function(_0x4e0e6b){_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['default']);_0xad7f65['where'](_0x4e0e6b[_0xf5f2('0xb')]);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['filter']);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xd')]);_0x3133bc=_0x4e0e6b[_0xf5f2('0xe')];_0x5907aa=_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xf')];return sqlUtils['checkListsRestrictions'](_0x174bc7,_0x1172dd,_0x5907aa);})[_0xf5f2('0x7')](function(_0xea612c){_0xad7f65[_0xf5f2('0xa')](_0xea612c);var _0x1c1a5c=_0x1172dd[_0xf5f2('0x8')]?_0x3133bc['ids']:_0x1172dd[_0xf5f2('0x10')];_0x473100=_0x1c1a5c?!![]:![];return sqlUtils[_0xf5f2('0x11')](_0xad7f65,_0x1c1a5c);})[_0xf5f2('0x7')](function(_0x1b6dd2){_0x501fbd[_0xf5f2('0x12')]=_0x1b6dd2;if(_0x501fbd[_0xf5f2('0x12')]===0x0){return;}return sqlUtils[_0xf5f2('0x13')](_0xad7f65,_0x1172dd[_0xf5f2('0xb')],_0x3c72ee,_0x473100,_0x3133bc[_0xf5f2('0xd')],_0x5907aa);})[_0xf5f2('0x7')](function(_0x20fccd){if(!_0x20fccd){return[];}return sqlUtils[_0xf5f2('0x14')](_0x20fccd,_0x1172dd,_0x3c72ee);})[_0xf5f2('0x7')](function(_0x3ee69){_0x501fbd[_0xf5f2('0x15')]=_0x3ee69;return _0x501fbd;})[_0xf5f2('0x16')](function(_0x1bf655){throw _0x1bf655;});};exports['describe']=function(){var _0x34706d={};var _0x47101e=[];return db['CmContact']['describe']()[_0xf5f2('0x7')](function(_0x388e6c){_0x34706d=_0x388e6c;var _0x4ae323=Object[_0xf5f2('0x17')](_0x34706d)[_0xf5f2('0x18')](function(_0x39e44a){return _[_0xf5f2('0x19')](_0x39e44a,_0xf5f2('0x1a'))?_0x39e44a:undefined;});var _0x4c691a=_0x4ae323[_0xf5f2('0x1b')](function(_0x4669a6){return db[_0xf5f2('0x1c')][_0xf5f2('0x1d')]({'where':{'id':_0x4669a6[_0xf5f2('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x4c691a);})['then'](function(_0x5f1124){for(var _0x3f79d5=0x0;_0x3f79d5<_0x5f1124[_0xf5f2('0x1f')];_0x3f79d5++){if(_0x5f1124[_0x3f79d5]){var _0x1a5bb3=_0xf5f2('0x1a')+_0x5f1124[_0x3f79d5]['id'];_0x34706d[_0x1a5bb3][_0xf5f2('0x20')]=_0x5f1124[_0x3f79d5][_0xf5f2('0x21')];}}_0x47101e=_[_0xf5f2('0x1b')](Object[_0xf5f2('0x17')](_0x34706d),function(_0x4ab014){return{'name':_0x4ab014,'type':_0x34706d[_0x4ab014][_0xf5f2('0x21')]};});return _0x47101e;})[_0xf5f2('0x16')](function(_0x375ca8){throw _0x375ca8;});}; \ No newline at end of file +var _0xb7e7=['parseQueryParameters','where','default','fields','filter','user','clause','skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','startsWith','cf_','map','CmCustomField','fieldType','type','keys','lodash','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x7b7e('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x7b7e('0x1'))['db'];exports['findAll']=function(_0x1b7cc7,_0x54a37f,_0x3f5804,_0x556d68){var _0x31d0ed={'count':0x0,'rows':[]};var _0x118577=sqlUtils[_0x7b7e('0x2')](_0x54a37f,_0x1b7cc7);if(_0x118577){return Promise['resolve'](_0x31d0ed);}var _0x53ed64=sqlUtils[_0x7b7e('0x3')]();var _0x372bde={};var _0x7f87e0=![];var _0x55ce81=![];return Promise[_0x7b7e('0x4')]()[_0x7b7e('0x5')](function(){if(_0x1b7cc7[_0x7b7e('0x6')]){return sqlUtils[_0x7b7e('0x7')](_0x1b7cc7[_0x7b7e('0x6')],_0x556d68);}else{return sqlUtils[_0x7b7e('0x8')](_0x1b7cc7,_0x556d68);}})[_0x7b7e('0x5')](function(_0x52de3b){_0x53ed64[_0x7b7e('0x9')](_0x52de3b[_0x7b7e('0xa')]);_0x53ed64[_0x7b7e('0x9')](_0x52de3b[_0x7b7e('0xb')]);_0x53ed64[_0x7b7e('0x9')](_0x52de3b[_0x7b7e('0xc')]);_0x53ed64[_0x7b7e('0x9')](_0x52de3b[_0x7b7e('0xd')][_0x7b7e('0xe')]);_0x372bde=_0x52de3b['tags'];_0x55ce81=_0x52de3b[_0x7b7e('0xd')][_0x7b7e('0xf')];return sqlUtils['checkListsRestrictions'](_0x54a37f,_0x1b7cc7,_0x55ce81);})[_0x7b7e('0x5')](function(_0x5976ac){_0x53ed64['where'](_0x5976ac);var _0x2889ed=_0x1b7cc7[_0x7b7e('0x6')]?_0x372bde[_0x7b7e('0x10')]:_0x1b7cc7[_0x7b7e('0x11')];_0x7f87e0=_0x2889ed?!![]:![];return sqlUtils[_0x7b7e('0x12')](_0x53ed64,_0x2889ed);})['then'](function(_0x51baf6){_0x31d0ed[_0x7b7e('0x13')]=_0x51baf6;if(_0x31d0ed[_0x7b7e('0x13')]===0x0){return;}return sqlUtils[_0x7b7e('0x14')](_0x53ed64,_0x1b7cc7[_0x7b7e('0xb')],_0x3f5804,_0x7f87e0,_0x372bde[_0x7b7e('0xe')],_0x55ce81);})[_0x7b7e('0x5')](function(_0x242368){if(!_0x242368){return[];}return sqlUtils[_0x7b7e('0x15')](_0x242368,_0x1b7cc7,_0x3f5804);})[_0x7b7e('0x5')](function(_0x429a0e){_0x31d0ed[_0x7b7e('0x16')]=_0x429a0e;return _0x31d0ed;})[_0x7b7e('0x17')](function(_0x448980){throw _0x448980;});};exports[_0x7b7e('0x18')]=function(){var _0x9776c3={};var _0x864287=[];return db[_0x7b7e('0x19')]['describe']()[_0x7b7e('0x5')](function(_0x43db4f){_0x9776c3=_0x43db4f;var _0x24718c=Object['keys'](_0x9776c3)[_0x7b7e('0xc')](function(_0xbf0cb3){return _[_0x7b7e('0x1a')](_0xbf0cb3,_0x7b7e('0x1b'))?_0xbf0cb3:undefined;});var _0x2b7211=_0x24718c[_0x7b7e('0x1c')](function(_0x28bf43){return db[_0x7b7e('0x1d')]['findOne']({'where':{'id':_0x28bf43['slice'](0x3)},'raw':!![]});});return Promise['all'](_0x2b7211);})[_0x7b7e('0x5')](function(_0x22598e){for(var _0x23bfa3=0x0;_0x23bfa3<_0x22598e['length'];_0x23bfa3++){if(_0x22598e[_0x23bfa3]){var _0x51d3b1='cf_'+_0x22598e[_0x23bfa3]['id'];_0x9776c3[_0x51d3b1][_0x7b7e('0x1e')]=_0x22598e[_0x23bfa3][_0x7b7e('0x1f')];}}_0x864287=_[_0x7b7e('0x1c')](Object[_0x7b7e('0x20')](_0x9776c3),function(_0x3ceaf5){return{'name':_0x3ceaf5,'type':_0x9776c3[_0x3ceaf5]['type']};});return _0x864287;})[_0x7b7e('0x17')](function(_0x21a15){throw _0x21a15;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d674818..4020bf7 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa154=['conditions','find','name','dateOfBirth','fieldType','datetime','DATE','text','value','start','end','Tag','split','map','tags','clause','and','User','user','skip','keys','some','compact','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?'];(function(_0x22943d,_0x2e167b){var _0x3fb073=function(_0x49d52d){while(--_0x49d52d){_0x22943d['push'](_0x22943d['shift']());}};_0x3fb073(++_0x2e167b);}(_0xa154,0x1e7));var _0x4a15=function(_0x3b660f,_0x45c3db){_0x3b660f=_0x3b660f-0x0;var _0x187a29=_0xa154[_0x3b660f];return _0x187a29;};'use strict';var _=require(_0x4a15('0x0'));var squel=require(_0x4a15('0x1'));var as=require(_0x4a15('0x2'));var qs=require(_0x4a15('0x3'));var utils=require(_0x4a15('0x4'));var db=require(_0x4a15('0x5'))['db'];function skipContactsQuery(_0xf405d9,_0x3b583f){var _0x541114=![];if(_0xf405d9[_0x4a15('0x6')]===_0x4a15('0x7')&&!_0x3b583f[_0x4a15('0x8')]&&!_0x3b583f[_0x4a15('0x9')]&&_0x3b583f['autocomplete']!==_0x4a15('0xa')){_0x541114=!![];}return _0x541114;}function getContactsSubquery(){return squel[_0x4a15('0xb')]()[_0x4a15('0xc')](_0x4a15('0xd'),'c')['where'](_0x4a15('0xe'));}function applyJoinClauses(_0x2a78bc,_0xfdfd99){var _0x556de8=_0xfdfd99?'c':_0x4a15('0xf');_0x2a78bc[_0x4a15('0x10')](_0x4a15('0x11'),'uc',_0x4a15('0x12')+_0x556de8+_0x4a15('0x13'))[_0x4a15('0x10')](_0x4a15('0x14'),'ct','ct.CmContactId\x20=\x20'+_0x556de8+_0x4a15('0x13'))[_0x4a15('0x10')]('tools_tags','t',_0x4a15('0x15'));return _0x2a78bc;}function addFieldsToQuery(_0x4f866,_0xdb4a80,_0x53904b,_0x42f671,_0x1e44db){var _0x2dcbc0=_0x1e44db?'c':'subqry';if(!_0xdb4a80){_0xdb4a80=['id','firstName',_0x4a15('0x16'),_0x4a15('0x17'),_0x4a15('0x18'),_0x4a15('0x19'),_0x4a15('0x1a'),_0x4a15('0x9'),_0x4a15('0x1b'),_0x4a15('0x1c'),_0x4a15('0x1d'),_0x4a15('0x1e'),'TagIds'];}else if(!_0xdb4a80['includes']('id')){_0xdb4a80[_0x4a15('0x1f')]('id');}var _0x136b24=_0x53904b&&_0x1e44db||!_0x53904b&&!_0x1e44db;if(_0x42f671){_0x136b24=_0x42f671&&_0x1e44db||!_0x42f671&&!_0x1e44db;}_0xdb4a80[_0x4a15('0x20')](function(_0x48ab7a){if(_0x48ab7a===_0x4a15('0x21')){if(_0x136b24){_0x4f866[_0x4a15('0x22')](_0x4a15('0x23'),_0x48ab7a);}else if(_0x53904b||_0x42f671){_0x4f866[_0x4a15('0x22')](_0x2dcbc0+'.'+_0x48ab7a);}}else{_0x4f866['field'](_0x2dcbc0+'.'+_0x48ab7a);}});return _0x4f866;}function getSqlClauses(){var _0x2f182d={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x4a15('0x24')](),'tags':{'clause':squel[_0x4a15('0x24')](),'ids':null},'user':{'clause':squel[_0x4a15('0x24')](),'skip':![]}};return _0x2f182d;}function parseTagParameter(_0x10f0ff){var _0x3fe4b3=squel[_0x4a15('0x24')]();if(_0x10f0ff){var _0x446179=utils[_0x4a15('0x25')](_0x10f0ff);_0x446179[_0x4a15('0x20')](function(_0xa5bfbd){_0x3fe4b3['or'](_0x4a15('0x26'),'%,'+_0xa5bfbd+',%');});}return _0x3fe4b3;}function parseSearchFilter(_0x27410b){var _0x3225c7=squel[_0x4a15('0x24')]();if(_0x27410b){var _0x37b84b=_0x27410b['replace']('\x5c','\x5c\x5c')[_0x4a15('0x27')](/'/g,'\x27\x27');if(_0x37b84b['split']('\x20')[_0x4a15('0x28')]>0x1){_0x3225c7['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4a15('0x29')](_0x37b84b),null);}else{if(qs[_0x4a15('0x2a')](_0x37b84b)){_0x3225c7['or'](_0x4a15('0x2b'),_0x37b84b+'%');_0x3225c7['or'](_0x4a15('0x2c'),_0x37b84b+'%');_0x3225c7['or'](_0x4a15('0x2d'),_0x37b84b+'%');_0x3225c7['or']('c.fax\x20LIKE\x20?',_0x37b84b+'%');}else if(qs['isEmail'](_0x37b84b)){_0x3225c7['or'](_0x4a15('0x2e'),_0x37b84b+'%');}else{_0x3225c7['or']('c.firstName\x20LIKE\x20?','%'+_0x37b84b+'%');_0x3225c7['or'](_0x4a15('0x2f'),'%'+_0x37b84b+'%');_0x3225c7['or'](_0x4a15('0x2e'),'%'+_0x37b84b+'%');}}}return _0x3225c7;}function parseAdvancedSearchFilter(_0x423d34,_0x539346){var _0x432abf=getSqlClauses();var _0x288448=as['parseSearch'](_0x423d34);var _0x1aa731=_0x288448['sqlOperator'];for(var _0x11f9f7=0x0;_0x11f9f7<_0x288448[_0x4a15('0x30')][_0x4a15('0x28')];_0x11f9f7++){var _0x4cdf76=_0x288448[_0x4a15('0x30')][_0x11f9f7];var _0x432468='c';var _0x60b997=_[_0x4a15('0x31')](_0x539346,[_0x4a15('0x32'),_0x4cdf76[_0x4a15('0x22')]]);if(_0x60b997){if(_0x4cdf76[_0x4a15('0x22')]===_0x4a15('0x33')||_0x60b997[_0x4a15('0x34')]===_0x4a15('0x35')){_0x4cdf76['castTo']=_0x4a15('0x36');}var _0x2506bf=as['buildExpression'](_0x432468,_0x60b997['type'],_0x4cdf76);_0x432abf['default'][_0x1aa731](_0x2506bf[_0x4a15('0x37')],_0x2506bf[_0x4a15('0x38')][_0x4a15('0x39')],_0x2506bf['value'][_0x4a15('0x3a')]);}else{if(_0x4cdf76['field']===_0x4a15('0x3b')){var _0x1f06b2=_0x4cdf76['value'][_0x4a15('0x3c')](',')[_0x4a15('0x3d')](function(_0x190358){return Number(_0x190358);});var _0x4e3acb=parseTagParameter(_0x1f06b2);_0x432abf[_0x4a15('0x3e')][_0x4a15('0x3f')][_0x4a15('0x40')](_0x4e3acb);_0x432abf['tags']['ids']=_0x1f06b2;}else if(_0x4cdf76[_0x4a15('0x22')]===_0x4a15('0x41')){_0x432abf[_0x4a15('0x42')][_0x4a15('0x3f')][_0x4a15('0x40')]('uc.UserId\x20=\x20?',_0x4cdf76[_0x4a15('0x38')]);_0x432abf[_0x4a15('0x42')][_0x4a15('0x43')]=!![];}}}return _0x432abf;}function parseModelFields(_0x112bb4,_0x5d7aca){var _0x3ac647=squel[_0x4a15('0x24')]();var _0x4c81a6=_(_0x112bb4)[_0x4a15('0x44')]()['map'](function(_0x384b22){return _[_0x4a15('0x45')](_0x5d7aca,[_0x4a15('0x32'),_0x384b22])?_0x384b22:undefined;})[_0x4a15('0x46')]()['value']();if(_0x112bb4['Contact']){_0x4c81a6['push']('Contact');}if(_0x4c81a6[_0x4a15('0x28')]>0x0){_0x4c81a6[_0x4a15('0x20')](function(_0x3c59fc){if(_0x3c59fc==='ListId'){_0x3ac647[_0x4a15('0x40')]('c.ListId\x20IN\x20?',[][_0x4a15('0x47')](_0x112bb4[_0x3c59fc]));}else if(_0x3c59fc===_0x4a15('0x48')){var _0x36b67c='%'+_0x112bb4[_0x3c59fc]+'%';_0x3ac647[_0x4a15('0x40')](_0x4a15('0x49'),_0x36b67c);}else{_0x3ac647[_0x4a15('0x40')]('c.'+_0x3c59fc+_0x4a15('0x4a'),_0x112bb4[_0x3c59fc]);}});}return _0x3ac647;}function parseQueryParameters(_0x11e526,_0x312131){var _0xc87152=getSqlClauses();return Promise[_0x4a15('0x4b')]()[_0x4a15('0x4c')](function(){return parseModelFields(_0x11e526,_0x312131);})[_0x4a15('0x4c')](function(_0x24ed2c){_0xc87152[_0x4a15('0x4d')][_0x4a15('0x40')](_0x24ed2c);return parseTagParameter(_0x11e526[_0x4a15('0x4e')]);})[_0x4a15('0x4c')](function(_0x461be9){_0xc87152[_0x4a15('0x3e')][_0x4a15('0x3f')][_0x4a15('0x40')](_0x461be9);return parseSearchFilter(_0x11e526[_0x4a15('0x4f')]);})['then'](function(_0x91daaa){_0xc87152[_0x4a15('0x4f')]=_0x91daaa;return _0xc87152;});}function checkListsRestrictions(_0x335f4d,_0x44d502,_0x51cf66){var _0x22bfed=squel['expr']();return Promise[_0x4a15('0x4b')]()[_0x4a15('0x4c')](function(){if(_0x44d502['search']&&_0x335f4d[_0x4a15('0x6')]===_0x4a15('0x7')&&!_0x51cf66){return _0x335f4d['getLists']({'attributes':['id'],'raw':!![]});}})[_0x4a15('0x4c')](function(_0x397e7b){if(_0x397e7b){if(_0x397e7b[_0x4a15('0x28')]===0x0){_0x22bfed['and'](_0x4a15('0x50'));}else{_0x22bfed[_0x4a15('0x40')]('c.ListId\x20IN\x20?',_[_0x4a15('0x3d')](_0x397e7b,'id'));}}})[_0x4a15('0x4c')](function(){return _0x22bfed;});}function buildContactsQuery(_0x334ca2,_0x3394c7,_0x3c73bd,_0x238f4e,_0x496af8,_0x5d2928){if(_0x3394c7){_0x3394c7=_0x3c73bd[_0x4a15('0x51')];}_0x334ca2=addFieldsToQuery(_0x334ca2,_0x3394c7,_0x238f4e,_0x5d2928,!![]);var _0x2dd626=squel['select']();_0x2dd626=addFieldsToQuery(_0x2dd626,_0x3394c7,_0x238f4e,_0x5d2928,![]);if(_0x238f4e||_0x5d2928){_0x334ca2=applyJoinClauses(_0x334ca2,!![]);_0x334ca2[_0x4a15('0x52')](_0x4a15('0x53'));if(_0x3c73bd[_0x4a15('0x54')]){_0x2dd626[_0x4a15('0x54')](_0x3c73bd['limit']);}if(_0x3c73bd['offset']){_0x2dd626[_0x4a15('0x55')](_0x3c73bd[_0x4a15('0x55')]);}}else{_0x2dd626=applyJoinClauses(_0x2dd626,![]);_0x2dd626[_0x4a15('0x52')](_0x4a15('0x56'));if(_0x3c73bd[_0x4a15('0x54')]){_0x334ca2[_0x4a15('0x54')](_0x3c73bd[_0x4a15('0x54')]);}if(_0x3c73bd[_0x4a15('0x55')]){_0x334ca2['offset'](_0x3c73bd[_0x4a15('0x55')]);}}_0x2dd626[_0x4a15('0x57')](_0x496af8);if(_0x3c73bd[_0x4a15('0x58')]){_0x3c73bd['order']['forEach'](function(_0x5098cd){_0x334ca2[_0x4a15('0x58')]('c.'+_0x5098cd[0x0],_0x5098cd[0x1]==='DESC'?![]:!![]);_0x2dd626['order'](_0x4a15('0x59')+_0x5098cd[0x0],_0x5098cd[0x1]==='DESC'?![]:!![]);});}_0x2dd626[_0x4a15('0xc')](_0x334ca2,_0x4a15('0xf'));return _0x2dd626;}function getFilteredContacts(_0x3c3463){var _0x27821c=[];return db[_0x4a15('0x3b')][_0x4a15('0x5a')]({'attributes':['id','name',_0x4a15('0x5b')],'raw':!![]})[_0x4a15('0x4c')](function(_0x231fc1){_0x27821c=_[_0x4a15('0x5c')](_0x231fc1,'id');var _0x3433f7={'type':db[_0x4a15('0x5d')][_0x4a15('0x5e')][_0x4a15('0x5f')],'model':db[_0x4a15('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4a15('0x61')][_0x4a15('0x62')](_0x3c3463[_0x4a15('0x63')](),_0x3433f7);})[_0x4a15('0x4c')](function(_0xf11e00){_0xf11e00[_0x4a15('0x20')](function(_0x107e94){if(_0x107e94['TagIds']){_0x107e94['Tags']=[];_0x107e94[_0x4a15('0x21')][_0x4a15('0x3c')](',')[_0x4a15('0x20')](function(_0x1fb799){_0x107e94[_0x4a15('0x64')][_0x4a15('0x1f')](_0x27821c[_0x1fb799]);});}delete _0x107e94[_0x4a15('0x21')];});return _0xf11e00;});}function countFilteredContacts(_0x24039f,_0x41a291){var _0x3cdcb3=_0x24039f[_0x4a15('0x65')]();_0x3cdcb3['field'](_0x4a15('0x66'));_0x3cdcb3=applyJoinClauses(_0x3cdcb3,!![]);_0x24039f[_0x4a15('0x52')]('c.id');var _0x5212ef=utils[_0x4a15('0x25')](_0x41a291);if(!_[_0x4a15('0x67')](_0x5212ef)){_0x3cdcb3[_0x4a15('0x68')](_0x4a15('0x69'),_0x5212ef);}var _0xa8aa56={'type':db[_0x4a15('0x5d')][_0x4a15('0x5e')][_0x4a15('0x5f')],'raw':!![]};return db[_0x4a15('0x61')][_0x4a15('0x62')](_0x3cdcb3['toString'](),_0xa8aa56)[_0x4a15('0x4c')](function(_0x549f81){return _0x549f81[0x0][_0x4a15('0x66')];});}module[_0x4a15('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x8fb3=['value','start','Tag','map','tags','ids','User','user','clause','and','uc.UserId\x20=\x20?','skip','keys','some','name','Contact','push','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','role','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','isEmpty','exports','lodash','squel','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','phone','mobile','email','createdAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','DATE','buildExpression','default','text'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x8fb3,0x9d));var _0x38fb=function(_0xd7d3b8,_0x3ad3da){_0xd7d3b8=_0xd7d3b8-0x0;var _0x103a80=_0x8fb3[_0xd7d3b8];return _0x103a80;};'use strict';var _=require(_0x38fb('0x0'));var squel=require(_0x38fb('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0x38fb('0x2'));var db=require(_0x38fb('0x3'))['db'];function skipContactsQuery(_0x399d92,_0xdcfb56){var _0xa42df7=![];if(_0x399d92['role']===_0x38fb('0x4')&&!_0xdcfb56[_0x38fb('0x5')]&&!_0xdcfb56[_0x38fb('0x6')]&&_0xdcfb56[_0x38fb('0x7')]!==_0x38fb('0x8')){_0xa42df7=!![];}return _0xa42df7;}function getContactsSubquery(){return squel[_0x38fb('0x9')]()[_0x38fb('0xa')](_0x38fb('0xb'),'c')[_0x38fb('0xc')](_0x38fb('0xd'));}function applyJoinClauses(_0x14d52,_0x4443e6){var _0x14a7b2=_0x4443e6?'c':_0x38fb('0xe');_0x14d52[_0x38fb('0xf')](_0x38fb('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x14a7b2+'.id')[_0x38fb('0xf')](_0x38fb('0x11'),'ct',_0x38fb('0x12')+_0x14a7b2+_0x38fb('0x13'))[_0x38fb('0xf')](_0x38fb('0x14'),'t','t.id\x20=\x20ct.TagId');return _0x14d52;}function addFieldsToQuery(_0xce9ea8,_0x2bac6a,_0x4864a1,_0x173335,_0x4b0559){var _0x2d978b=_0x4b0559?'c':_0x38fb('0xe');if(!_0x2bac6a){_0x2bac6a=['id',_0x38fb('0x15'),_0x38fb('0x16'),_0x38fb('0x17'),_0x38fb('0x18'),'fax',_0x38fb('0x19'),_0x38fb('0x6'),'CompanyId',_0x38fb('0x1a'),'updatedAt',_0x38fb('0x1b'),_0x38fb('0x1c')];}else if(!_0x2bac6a[_0x38fb('0x1d')]('id')){_0x2bac6a['push']('id');}var _0x191d57=_0x4864a1&&_0x4b0559||!_0x4864a1&&!_0x4b0559;if(_0x173335){_0x191d57=_0x173335&&_0x4b0559||!_0x173335&&!_0x4b0559;}_0x2bac6a[_0x38fb('0x1e')](function(_0x536d1b){if(_0x536d1b===_0x38fb('0x1c')){if(_0x191d57){_0xce9ea8[_0x38fb('0x1f')](_0x38fb('0x20'),_0x536d1b);}else if(_0x4864a1||_0x173335){_0xce9ea8[_0x38fb('0x1f')](_0x2d978b+'.'+_0x536d1b);}}else{_0xce9ea8[_0x38fb('0x1f')](_0x2d978b+'.'+_0x536d1b);}});return _0xce9ea8;}function getSqlClauses(){var _0x4cebea={'default':squel[_0x38fb('0x21')](),'fields':squel[_0x38fb('0x21')](),'filter':squel[_0x38fb('0x21')](),'tags':{'clause':squel[_0x38fb('0x21')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x4cebea;}function parseTagParameter(_0xb5b8a9){var _0x5eeffc=squel[_0x38fb('0x21')]();if(_0xb5b8a9){var _0x3e8c18=utils[_0x38fb('0x22')](_0xb5b8a9);_0x3e8c18[_0x38fb('0x1e')](function(_0x57c071){_0x5eeffc['or'](_0x38fb('0x23'),'%,'+_0x57c071+',%');});}return _0x5eeffc;}function parseSearchFilter(_0x57b513){var _0x4a2141=squel[_0x38fb('0x21')]();if(_0x57b513){var _0x56c13f=_0x57b513[_0x38fb('0x24')]('\x5c','\x5c\x5c')[_0x38fb('0x24')](/'/g,'\x27\x27');if(_0x56c13f[_0x38fb('0x25')]('\x20')[_0x38fb('0x26')]>0x1){_0x4a2141['or'](_0x38fb('0x27'),qs['getFullTextValue'](_0x56c13f),null);}else{if(qs[_0x38fb('0x28')](_0x56c13f)){_0x4a2141['or'](_0x38fb('0x29'),_0x56c13f+'%');_0x4a2141['or'](_0x38fb('0x2a'),_0x56c13f+'%');_0x4a2141['or'](_0x38fb('0x2b'),_0x56c13f+'%');_0x4a2141['or'](_0x38fb('0x2c'),_0x56c13f+'%');}else if(qs[_0x38fb('0x2d')](_0x56c13f)){_0x4a2141['or'](_0x38fb('0x2e'),_0x56c13f+'%');}else{_0x4a2141['or']('c.firstName\x20LIKE\x20?','%'+_0x56c13f+'%');_0x4a2141['or'](_0x38fb('0x2f'),'%'+_0x56c13f+'%');_0x4a2141['or']('c.email\x20LIKE\x20?','%'+_0x56c13f+'%');}}}return _0x4a2141;}function parseAdvancedSearchFilter(_0x1275a4,_0x2dd7d6){var _0x4848dc=getSqlClauses();var _0x1eabb8=as[_0x38fb('0x30')](_0x1275a4);var _0x171b51=_0x1eabb8[_0x38fb('0x31')];for(var _0x5d986e=0x0;_0x5d986e<_0x1eabb8[_0x38fb('0x32')][_0x38fb('0x26')];_0x5d986e++){var _0xbfc6e8=_0x1eabb8[_0x38fb('0x32')][_0x5d986e];var _0x207180='c';var _0x50b30f=_[_0x38fb('0x33')](_0x2dd7d6,['name',_0xbfc6e8[_0x38fb('0x1f')]]);if(_0x50b30f){if(_0xbfc6e8['field']===_0x38fb('0x34')||_0x50b30f[_0x38fb('0x35')]===_0x38fb('0x36')){_0xbfc6e8['castTo']=_0x38fb('0x37');}var _0x3deacf=as[_0x38fb('0x38')](_0x207180,_0x50b30f['type'],_0xbfc6e8);_0x4848dc[_0x38fb('0x39')][_0x171b51](_0x3deacf[_0x38fb('0x3a')],_0x3deacf[_0x38fb('0x3b')][_0x38fb('0x3c')],_0x3deacf['value']['end']);}else{if(_0xbfc6e8[_0x38fb('0x1f')]===_0x38fb('0x3d')){var _0x5b661d=_0xbfc6e8[_0x38fb('0x3b')]['split'](',')[_0x38fb('0x3e')](function(_0x1f1bcf){return Number(_0x1f1bcf);});var _0xed0fe9=parseTagParameter(_0x5b661d);_0x4848dc[_0x38fb('0x3f')]['clause']['and'](_0xed0fe9);_0x4848dc['tags'][_0x38fb('0x40')]=_0x5b661d;}else if(_0xbfc6e8[_0x38fb('0x1f')]===_0x38fb('0x41')){_0x4848dc[_0x38fb('0x42')][_0x38fb('0x43')][_0x38fb('0x44')](_0x38fb('0x45'),_0xbfc6e8[_0x38fb('0x3b')]);_0x4848dc[_0x38fb('0x42')][_0x38fb('0x46')]=!![];}}}return _0x4848dc;}function parseModelFields(_0x954b52,_0x556373){var _0x34ba84=squel['expr']();var _0x1e5210=_(_0x954b52)[_0x38fb('0x47')]()['map'](function(_0xd77d2){return _[_0x38fb('0x48')](_0x556373,[_0x38fb('0x49'),_0xd77d2])?_0xd77d2:undefined;})['compact']()[_0x38fb('0x3b')]();if(_0x954b52[_0x38fb('0x4a')]){_0x1e5210[_0x38fb('0x4b')](_0x38fb('0x4a'));}if(_0x1e5210[_0x38fb('0x26')]>0x0){_0x1e5210[_0x38fb('0x1e')](function(_0x169a36){if(_0x169a36===_0x38fb('0x6')){_0x34ba84['and']('c.ListId\x20IN\x20?',[][_0x38fb('0x4c')](_0x954b52[_0x169a36]));}else if(_0x169a36===_0x38fb('0x4a')){var _0x4cea79='%'+_0x954b52[_0x169a36]+'%';_0x34ba84[_0x38fb('0x44')](_0x38fb('0x4d'),_0x4cea79);}else{_0x34ba84[_0x38fb('0x44')]('c.'+_0x169a36+_0x38fb('0x4e'),_0x954b52[_0x169a36]);}});}return _0x34ba84;}function parseQueryParameters(_0x3db9ff,_0x465dc4){var _0x32b379=getSqlClauses();return Promise[_0x38fb('0x4f')]()['then'](function(){return parseModelFields(_0x3db9ff,_0x465dc4);})[_0x38fb('0x50')](function(_0x50f1c4){_0x32b379[_0x38fb('0x51')][_0x38fb('0x44')](_0x50f1c4);return parseTagParameter(_0x3db9ff[_0x38fb('0x52')]);})[_0x38fb('0x50')](function(_0x64cf36){_0x32b379['tags'][_0x38fb('0x43')][_0x38fb('0x44')](_0x64cf36);return parseSearchFilter(_0x3db9ff[_0x38fb('0x53')]);})[_0x38fb('0x50')](function(_0x253977){_0x32b379['filter']=_0x253977;return _0x32b379;});}function checkListsRestrictions(_0x4e7ad3,_0x56db3b,_0x35a8af){var _0x3f7cb6=squel[_0x38fb('0x21')]();return Promise['resolve']()[_0x38fb('0x50')](function(){if(_0x56db3b['search']&&_0x4e7ad3[_0x38fb('0x54')]==='agent'&&!_0x35a8af){return _0x4e7ad3['getLists']({'attributes':['id'],'raw':!![]});}})[_0x38fb('0x50')](function(_0x324b3c){if(_0x324b3c){if(_0x324b3c['length']===0x0){_0x3f7cb6[_0x38fb('0x44')]('c.ListId\x20IS\x20NULL');}else{_0x3f7cb6[_0x38fb('0x44')]('c.ListId\x20IN\x20?',_[_0x38fb('0x3e')](_0x324b3c,'id'));}}})[_0x38fb('0x50')](function(){return _0x3f7cb6;});}function buildContactsQuery(_0x4db18c,_0x4c9375,_0x335069,_0x3d55b5,_0x567cb2,_0x4a5b09){if(_0x4c9375){_0x4c9375=_0x335069['attributes'];}_0x4db18c=addFieldsToQuery(_0x4db18c,_0x4c9375,_0x3d55b5,_0x4a5b09,!![]);var _0x1716e3=squel[_0x38fb('0x9')]();_0x1716e3=addFieldsToQuery(_0x1716e3,_0x4c9375,_0x3d55b5,_0x4a5b09,![]);if(_0x3d55b5||_0x4a5b09){_0x4db18c=applyJoinClauses(_0x4db18c,!![]);_0x4db18c[_0x38fb('0x55')](_0x38fb('0x56'));if(_0x335069[_0x38fb('0x57')]){_0x1716e3['limit'](_0x335069[_0x38fb('0x57')]);}if(_0x335069['offset']){_0x1716e3[_0x38fb('0x58')](_0x335069['offset']);}}else{_0x1716e3=applyJoinClauses(_0x1716e3,![]);_0x1716e3[_0x38fb('0x55')](_0x38fb('0x59'));if(_0x335069[_0x38fb('0x57')]){_0x4db18c[_0x38fb('0x57')](_0x335069[_0x38fb('0x57')]);}if(_0x335069[_0x38fb('0x58')]){_0x4db18c['offset'](_0x335069['offset']);}}_0x1716e3[_0x38fb('0x5a')](_0x567cb2);if(_0x335069[_0x38fb('0x5b')]){_0x335069[_0x38fb('0x5b')][_0x38fb('0x1e')](function(_0x2027aa){_0x4db18c[_0x38fb('0x5b')]('c.'+_0x2027aa[0x0],_0x2027aa[0x1]===_0x38fb('0x5c')?![]:!![]);_0x1716e3['order'](_0x38fb('0x5d')+_0x2027aa[0x0],_0x2027aa[0x1]===_0x38fb('0x5c')?![]:!![]);});}_0x1716e3['from'](_0x4db18c,_0x38fb('0xe'));return _0x1716e3;}function getFilteredContacts(_0x23cd65){var _0x5d81dd=[];return db[_0x38fb('0x3d')][_0x38fb('0x5e')]({'attributes':['id',_0x38fb('0x49'),_0x38fb('0x5f')],'raw':!![]})[_0x38fb('0x50')](function(_0x337f38){_0x5d81dd=_[_0x38fb('0x60')](_0x337f38,'id');var _0x4bfb15={'type':db[_0x38fb('0x61')][_0x38fb('0x62')][_0x38fb('0x63')],'model':db[_0x38fb('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x38fb('0x65')][_0x38fb('0x66')](_0x23cd65[_0x38fb('0x67')](),_0x4bfb15);})['then'](function(_0x32c853){_0x32c853[_0x38fb('0x1e')](function(_0x5e3309){if(_0x5e3309[_0x38fb('0x1c')]){_0x5e3309[_0x38fb('0x68')]=[];_0x5e3309[_0x38fb('0x1c')]['split'](',')[_0x38fb('0x1e')](function(_0x403bbf){_0x5e3309[_0x38fb('0x68')][_0x38fb('0x4b')](_0x5d81dd[_0x403bbf]);});}delete _0x5e3309[_0x38fb('0x1c')];});return _0x32c853;});}function countFilteredContacts(_0xceddef,_0x2739b9){var _0x32c7b0=_0xceddef['clone']();_0x32c7b0[_0x38fb('0x1f')](_0x38fb('0x69'));_0x32c7b0=applyJoinClauses(_0x32c7b0,!![]);_0xceddef['group'](_0x38fb('0x56'));var _0x157c07=utils['getSelectedTags'](_0x2739b9);if(!_[_0x38fb('0x6a')](_0x157c07)){_0x32c7b0[_0x38fb('0xc')]('t.id\x20IN\x20?',_0x157c07);}var _0x37cd45={'type':db[_0x38fb('0x61')][_0x38fb('0x62')][_0x38fb('0x63')],'raw':!![]};return db[_0x38fb('0x65')]['query'](_0x32c7b0[_0x38fb('0x67')](),_0x37cd45)[_0x38fb('0x50')](function(_0x3d7d79){return _0x3d7d79[0x0][_0x38fb('0x69')];});}module[_0x38fb('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 728fd26..47cbd6d 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x633e=['encryptString','utf8','decryptString','secret','base64','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','binary','final','write','end','unlink','createDecipher','close'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x633e,0xfa));var _0xe633=function(_0x349880,_0x4f168e){_0x349880=_0x349880-0x0;var _0x43c1d1=_0x633e[_0x349880];return _0x43c1d1;};'use strict';var crypto=require(_0xe633('0x0'));var fs=require('fs');var BPromise=require(_0xe633('0x1'));var _=require(_0xe633('0x2'));var config=require(_0xe633('0x3'));var logger=require(_0xe633('0x4'))(_0xe633('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe633('0x6')][_0xe633('0x7')],'algorithm':_0xe633('0x8')};const fileOptions={'algorithm':_0xe633('0x9')};if(config[_0xe633('0xa')]&&config[_0xe633('0xa')][_0xe633('0xb')]){var isSupported=isAlgorithmSupported(config[_0xe633('0xa')][_0xe633('0xb')]);if(isSupported){fileOptions[_0xe633('0xb')]=config['encrypt'][_0xe633('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe633('0xc')](',\x20');logger[_0xe633('0xd')](config['encrypt'][_0xe633('0xb')],_0xe633('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x3c4f67){return AES_SUPPORTED_RX[_0xe633('0xf')](_0x3c4f67);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xe633('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x2a91b7){return getSupportedCiphers()[_0xe633('0x11')](_0x2a91b7)>-0x1;}function combineOptions(_0x3c1826){var _0x5776d1={};for(var _0x347da7 in fileOptions){if(fileOptions[_0xe633('0x12')](_0x347da7)){_0x5776d1[_0x347da7]=fileOptions[_0x347da7];}}if(_0x3c1826){for(var _0x2e4288 in _0x3c1826){if(_0x3c1826[_0xe633('0x12')](_0x2e4288)){_0x5776d1[_0x2e4288]=_0x3c1826[_0x2e4288];}}}return _0x5776d1;}exports['encryptFile']=function(_0x162d4c,_0x26dc26,_0x4a927c,_0x402e2d){return new BPromise(function(_0x46317d,_0x101247){_0x402e2d=combineOptions(_0x402e2d);var _0x345daf=new Buffer(_0x4a927c);var _0x56ba03=fs[_0xe633('0x13')](_0x162d4c);var _0x39da4e=fs[_0xe633('0x14')](_0x26dc26);var _0x53bf35=crypto[_0xe633('0x15')](_0x402e2d[_0xe633('0xb')],_0x345daf);_0x56ba03['on']('data',function(_0x56a200){var _0x52d625=new Buffer(_0x53bf35[_0xe633('0x16')](_0x56a200),_0xe633('0x17'));_0x39da4e['write'](_0x52d625);});_0x56ba03['on']('end',function(){try{var _0xd40247=new Buffer(_0x53bf35[_0xe633('0x18')](_0xe633('0x17')),_0xe633('0x17'));_0x39da4e[_0xe633('0x19')](_0xd40247);_0x39da4e[_0xe633('0x1a')]();_0x39da4e['on']('close',function(){return _0x46317d(_0x26dc26);});}catch(_0xf2b8a7){fs[_0xe633('0x1b')](_0x26dc26);return _0x101247(_0xf2b8a7);}});});};exports['decryptFile']=function(_0xc7db2e,_0x208972,_0xe190b6,_0x174f4c){return new BPromise(function(_0x1d870c,_0x2fc0f3){_0x174f4c=combineOptions(_0x174f4c);var _0x337495=new Buffer(_0xe190b6);var _0x48d1cc=fs[_0xe633('0x13')](_0xc7db2e);var _0x14f355=fs[_0xe633('0x14')](_0x208972);var _0x35f857=crypto[_0xe633('0x1c')](_0x174f4c[_0xe633('0xb')],_0x337495);_0x48d1cc['on']('data',function(_0x1684b5){var _0x3e1aca=new Buffer(_0x35f857[_0xe633('0x16')](_0x1684b5),_0xe633('0x17'));_0x14f355['write'](_0x3e1aca);});_0x48d1cc['on'](_0xe633('0x1a'),function(){try{var _0x342053=new Buffer(_0x35f857['final']('binary'),'binary');_0x14f355['write'](_0x342053);_0x14f355[_0xe633('0x1a')]();_0x14f355['on'](_0xe633('0x1d'),function(){return _0x1d870c(_0x208972);});}catch(_0x5d1c68){fs[_0xe633('0x1b')](_0x208972);return _0x2fc0f3(_0x5d1c68);}});});};exports[_0xe633('0x1e')]=function(_0xd14a95,_0x3d1823,_0x4b3c7d){var _0x54b722=_0x4b3c7d||stringOptions[_0xe633('0xb')];var _0x29e176=_0x3d1823||stringOptions['secret'];var _0x890175=crypto[_0xe633('0x15')](_0x54b722,_0x29e176);var _0x367c35=_0x890175[_0xe633('0x16')](_0xd14a95,_0xe633('0x1f'),'base64');_0x367c35+=_0x890175[_0xe633('0x18')]('base64');return _0x367c35;};exports[_0xe633('0x20')]=function(_0x200386,_0x14ff75,_0x11280a){var _0x7ef59b=_0x11280a||stringOptions[_0xe633('0xb')];var _0x3f6fe1=_0x14ff75||stringOptions[_0xe633('0x21')];var _0x9b7caa=crypto[_0xe633('0x1c')](_0x7ef59b,_0x3f6fe1);var _0x3f7511=_0x9b7caa[_0xe633('0x16')](_0x200386,_0xe633('0x22'),_0xe633('0x1f'));_0x3f7511+=_0x9b7caa[_0xe633('0x18')](_0xe633('0x1f'));return _0x3f7511;}; \ No newline at end of file +var _0x35b3=['createReadStream','update','final','encryptString','secret','utf8','base64','decryptString','bluebird','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','write','end','binary','close','unlink','decryptFile'];(function(_0xe9c7c3,_0x5c7349){var _0x51db07=function(_0x5772fb){while(--_0x5772fb){_0xe9c7c3['push'](_0xe9c7c3['shift']());}};_0x51db07(++_0x5c7349);}(_0x35b3,0x128));var _0x335b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35b3[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x335b('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x335b('0x1'))(_0x335b('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x335b('0x3')],'algorithm':_0x335b('0x4')};const fileOptions={'algorithm':_0x335b('0x5')};if(config[_0x335b('0x6')]&&config[_0x335b('0x6')][_0x335b('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x335b('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0x335b('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x335b('0x8')](',\x20');logger[_0x335b('0x9')](config[_0x335b('0x6')][_0x335b('0x7')],_0x335b('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x27617b){return AES_SUPPORTED_RX[_0x335b('0xb')](_0x27617b);}function getSupportedCiphers(){return crypto[_0x335b('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x32ef53){return getSupportedCiphers()['indexOf'](_0x32ef53)>-0x1;}function combineOptions(_0xb22f52){var _0x2b4154={};for(var _0x487d49 in fileOptions){if(fileOptions[_0x335b('0xd')](_0x487d49)){_0x2b4154[_0x487d49]=fileOptions[_0x487d49];}}if(_0xb22f52){for(var _0x3c8e4a in _0xb22f52){if(_0xb22f52['hasOwnProperty'](_0x3c8e4a)){_0x2b4154[_0x3c8e4a]=_0xb22f52[_0x3c8e4a];}}}return _0x2b4154;}exports[_0x335b('0xe')]=function(_0x40c633,_0x5172a1,_0x4b6bd2,_0x21bf0c){return new BPromise(function(_0x20f268,_0xfd6337){_0x21bf0c=combineOptions(_0x21bf0c);var _0x29102e=new Buffer(_0x4b6bd2);var _0x1e32c8=fs['createReadStream'](_0x40c633);var _0x171351=fs[_0x335b('0xf')](_0x5172a1);var _0xd2bf2b=crypto[_0x335b('0x10')](_0x21bf0c['algorithm'],_0x29102e);_0x1e32c8['on'](_0x335b('0x11'),function(_0x2d71bd){var _0x369e0f=new Buffer(_0xd2bf2b['update'](_0x2d71bd),'binary');_0x171351[_0x335b('0x12')](_0x369e0f);});_0x1e32c8['on'](_0x335b('0x13'),function(){try{var _0xda3263=new Buffer(_0xd2bf2b['final'](_0x335b('0x14')),_0x335b('0x14'));_0x171351[_0x335b('0x12')](_0xda3263);_0x171351[_0x335b('0x13')]();_0x171351['on'](_0x335b('0x15'),function(){return _0x20f268(_0x5172a1);});}catch(_0x370a16){fs[_0x335b('0x16')](_0x5172a1);return _0xfd6337(_0x370a16);}});});};exports[_0x335b('0x17')]=function(_0x25348c,_0x3ea991,_0x1fe5ff,_0x725b76){return new BPromise(function(_0x231cb4,_0x5746b2){_0x725b76=combineOptions(_0x725b76);var _0x18a708=new Buffer(_0x1fe5ff);var _0x8fbedd=fs[_0x335b('0x18')](_0x25348c);var _0xb2b783=fs['createWriteStream'](_0x3ea991);var _0xac1a9=crypto['createDecipher'](_0x725b76[_0x335b('0x7')],_0x18a708);_0x8fbedd['on'](_0x335b('0x11'),function(_0x4c51a9){var _0x597425=new Buffer(_0xac1a9[_0x335b('0x19')](_0x4c51a9),_0x335b('0x14'));_0xb2b783[_0x335b('0x12')](_0x597425);});_0x8fbedd['on']('end',function(){try{var _0x2fa78d=new Buffer(_0xac1a9[_0x335b('0x1a')](_0x335b('0x14')),_0x335b('0x14'));_0xb2b783[_0x335b('0x12')](_0x2fa78d);_0xb2b783[_0x335b('0x13')]();_0xb2b783['on'](_0x335b('0x15'),function(){return _0x231cb4(_0x3ea991);});}catch(_0x2001eb){fs[_0x335b('0x16')](_0x3ea991);return _0x5746b2(_0x2001eb);}});});};exports[_0x335b('0x1b')]=function(_0x4391c6,_0x8dff86,_0x2e50b0){var _0x12cb4b=_0x2e50b0||stringOptions['algorithm'];var _0x5ebacc=_0x8dff86||stringOptions[_0x335b('0x1c')];var _0x30b3d1=crypto['createCipher'](_0x12cb4b,_0x5ebacc);var _0x460926=_0x30b3d1[_0x335b('0x19')](_0x4391c6,_0x335b('0x1d'),_0x335b('0x1e'));_0x460926+=_0x30b3d1['final']('base64');return _0x460926;};exports[_0x335b('0x1f')]=function(_0x374909,_0x20ad0c,_0x4e2581){var _0x5c80c6=_0x4e2581||stringOptions[_0x335b('0x7')];var _0x3b00a0=_0x20ad0c||stringOptions['secret'];var _0x533328=crypto['createDecipher'](_0x5c80c6,_0x3b00a0);var _0xd4ee25=_0x533328['update'](_0x374909,_0x335b('0x1e'),_0x335b('0x1d'));_0xd4ee25+=_0x533328['final'](_0x335b('0x1d'));return _0xd4ee25;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0f7eaa0..e30c801 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb28=['savename','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','length','existsSync','join','mkdirSync','each','%s.%s','csv','writeFileSync','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv'];(function(_0x47397f,_0x45ba05){var _0xba5ff1=function(_0x4e139a){while(--_0x4e139a){_0x47397f['push'](_0x47397f['shift']());}};_0xba5ff1(++_0x45ba05);}(_0xcb28,0xad));var _0x8cb2=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xcb28[_0x58547b];return _0x1d3fd2;};'use strict';var util=require(_0x8cb2('0x0'));var path=require('path');var _=require(_0x8cb2('0x1'));var csv=require(_0x8cb2('0x2'));var fs=require('fs');var BPromise=require(_0x8cb2('0x3'));var zipdir=require(_0x8cb2('0x4'));var rimraf=require(_0x8cb2('0x5'));var db=require(_0x8cb2('0x6'))['db'];var dbH=require('../../mysqldb')[_0x8cb2('0x7')];var logger=require(_0x8cb2('0x8'))(_0x8cb2('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x8cb2('0xa')][0x3];var PATH=process[_0x8cb2('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b08df,_0x10e643){var _0x5127e0={'status':_0x5b08df};var _0x53a0b1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x10e643){_0x5127e0[_0x8cb2('0xb')]=_0x10e643;}return db['AnalyticExtractedReport'][_0x8cb2('0xc')](_0x5127e0,_0x53a0b1);}function main(){var _0x233a31=0x1388;var _0x3008a5;logger['info'](util['format'](_0x8cb2('0xd'),EXTRACTED_REPORT_ID,_0x8cb2('0xe')));return db['Setting'][_0x8cb2('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8cb2('0x10'),'splitSizeCsv']})[_0x8cb2('0x11')](function(_0x4ef7be){if(_0x4ef7be){_0x3008a5=_0x4ef7be;_0x233a31=_0x3008a5['splitSizeCsv']||0x1388;}})[_0x8cb2('0x11')](function(){return dbH['sequelize'][_0x8cb2('0x12')](util[_0x8cb2('0x13')](_0x8cb2('0x14'),QUERY),{'type':dbH[_0x8cb2('0x15')][_0x8cb2('0x16')][_0x8cb2('0x17')]});})[_0x8cb2('0x11')](function(_0x558eac){if(!_0x558eac[0x0][_0x8cb2('0x18')]){return analyticExtractedReport(_0x8cb2('0x19'));}var _0x21d979=[];var _0x436b96=0x0;if(_0x3008a5['split']){if(_0x558eac&&_0x558eac['length']){var _0x3e708d=_[_0x8cb2('0x1a')](_0x558eac[0x0][_0x8cb2('0x18')]/_0x233a31);var _0x38689c=Number['isInteger'](_0x558eac[0x0][_0x8cb2('0x18')]/_0x233a31)?_0x558eac[0x0][_0x8cb2('0x18')]%_0x233a31:0x0;_0x3e708d[_0x8cb2('0x1b')](function(_0x5d5ef5){if(_0x5d5ef5>0x0){_0x436b96+=_0x233a31;}_0x21d979[_0x8cb2('0x1c')](dbH[_0x8cb2('0x15')]['query'](util['format'](_0x8cb2('0x1d'),QUERY,_0x233a31,_0x436b96),{'type':dbH[_0x8cb2('0x15')][_0x8cb2('0x16')][_0x8cb2('0x17')]}));});if(_0x38689c>0x0){_0x436b96+=_0x233a31;_0x21d979[_0x8cb2('0x1c')](dbH[_0x8cb2('0x15')][_0x8cb2('0x12')](util[_0x8cb2('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x38689c,_0x436b96),{'type':dbH[_0x8cb2('0x15')][_0x8cb2('0x16')][_0x8cb2('0x17')]}));}}}else{_0x21d979['push'](dbH[_0x8cb2('0x15')][_0x8cb2('0x12')](QUERY,{'type':dbH[_0x8cb2('0x15')][_0x8cb2('0x16')][_0x8cb2('0x17')]}));}var _0x33b6f0=path['dirname'](PATH);var _0x451605=path[_0x8cb2('0x1e')](PATH,_0x8cb2('0x1f'));var _0x54476a=_0x3008a5[_0x8cb2('0x10')]&&_0x21d979[_0x8cb2('0x20')]>0x1;var _0x2c112f=[];if(!fs[_0x8cb2('0x21')](path[_0x8cb2('0x22')](_0x33b6f0,_0x451605))&&_0x54476a){fs[_0x8cb2('0x23')](path[_0x8cb2('0x22')](_0x33b6f0,_0x451605));}return BPromise[_0x8cb2('0x24')](_0x21d979,function(_0x2392cd){_0x2c112f[_0x8cb2('0x1c')](_0x2392cd);})[_0x8cb2('0x11')](function(){for(var _0x3ea6cc=0x0;_0x3ea6cc<_0x2c112f[_0x8cb2('0x20')];_0x3ea6cc+=0x1){var _0x1dee2f;var _0x265517=_0x2c112f[_0x3ea6cc];if(_0x54476a){_0x1dee2f=path[_0x8cb2('0x22')](_0x33b6f0,_0x451605,util[_0x8cb2('0x13')]('%s%d.%s',_0x451605,_0x3ea6cc,'csv'));}else{_0x1dee2f=path[_0x8cb2('0x22')](_0x33b6f0,util[_0x8cb2('0x13')](_0x8cb2('0x25'),_0x451605,_0x8cb2('0x26')));}fs[_0x8cb2('0x27')](_0x1dee2f,csv(_0x265517));}})[_0x8cb2('0x11')](function(){if(_0x54476a){return new Promise(function(_0x353ea9){zipdir(path[_0x8cb2('0x22')](_0x33b6f0,_0x451605),{'saveTo':path[_0x8cb2('0x22')](_0x33b6f0,util['format']('%s.%s',_0x451605,'zip'))},function(_0x47815f,_0x343fde){rimraf(path[_0x8cb2('0x22')](_0x33b6f0,_0x451605),function(){});_0x353ea9('zip\x20finished');});});}})[_0x8cb2('0x11')](function(){logger['info'](util[_0x8cb2('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8cb2('0xe')));return analyticExtractedReport('Completed',_0x54476a?util[_0x8cb2('0x13')]('%s.%s',_0x451605,_0x54476a?_0x8cb2('0x28'):_0x8cb2('0x26')):null);});})['catch'](function(_0x903412){logger['info'](util[_0x8cb2('0x13')](_0x8cb2('0x29'),EXTRACTED_REPORT_ID,_0x8cb2('0xe')),util[_0x8cb2('0x2a')](_0x903412,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8cb2('0x2b'));})[_0x8cb2('0x2c')](function(){process[_0x8cb2('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3474=['query','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize'];(function(_0x2f8bf7,_0x5e1fd4){var _0x318a50=function(_0x4f161b){while(--_0x4f161b){_0x2f8bf7['push'](_0x2f8bf7['shift']());}};_0x318a50(++_0x5e1fd4);}(_0x3474,0xac));var _0x4347=function(_0xe7259d,_0x32ad8f){_0xe7259d=_0xe7259d-0x0;var _0x3bf494=_0x3474[_0xe7259d];return _0x3bf494;};'use strict';var util=require(_0x4347('0x0'));var path=require('path');var _=require(_0x4347('0x1'));var csv=require(_0x4347('0x2'));var fs=require('fs');var BPromise=require(_0x4347('0x3'));var zipdir=require(_0x4347('0x4'));var rimraf=require(_0x4347('0x5'));var db=require(_0x4347('0x6'))['db'];var dbH=require(_0x4347('0x6'))[_0x4347('0x7')];var logger=require('../../config/logger')(_0x4347('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4347('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b9013,_0x575ac0){var _0x18d98e={'status':_0x1b9013};var _0x5bb44f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x575ac0){_0x18d98e['savename']=_0x575ac0;}return db[_0x4347('0xa')][_0x4347('0xb')](_0x18d98e,_0x5bb44f);}function main(){var _0x170917=0x1388;var _0x38ae4f;logger[_0x4347('0xc')](util[_0x4347('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4347('0xe')));return db[_0x4347('0xf')][_0x4347('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4347('0x11')]})['then'](function(_0x196dff){if(_0x196dff){_0x38ae4f=_0x196dff;_0x170917=_0x38ae4f[_0x4347('0x11')]||0x1388;}})[_0x4347('0x12')](function(){return dbH[_0x4347('0x13')][_0x4347('0x14')](util[_0x4347('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4347('0x13')][_0x4347('0x15')][_0x4347('0x16')]});})['then'](function(_0x2f1873){if(!_0x2f1873[0x0][_0x4347('0x17')]){return analyticExtractedReport(_0x4347('0x18'));}var _0x4a0da2=[];var _0x3e0501=0x0;if(_0x38ae4f[_0x4347('0x19')]){if(_0x2f1873&&_0x2f1873[_0x4347('0x1a')]){var _0x1a59df=_[_0x4347('0x1b')](_0x2f1873[0x0][_0x4347('0x17')]/_0x170917);var _0x15b42c=Number[_0x4347('0x1c')](_0x2f1873[0x0]['num']/_0x170917)?_0x2f1873[0x0][_0x4347('0x17')]%_0x170917:0x0;_0x1a59df[_0x4347('0x1d')](function(_0x5bbd29){if(_0x5bbd29>0x0){_0x3e0501+=_0x170917;}_0x4a0da2[_0x4347('0x1e')](dbH[_0x4347('0x13')][_0x4347('0x14')](util[_0x4347('0xd')](_0x4347('0x1f'),QUERY,_0x170917,_0x3e0501),{'type':dbH[_0x4347('0x13')][_0x4347('0x15')][_0x4347('0x16')]}));});if(_0x15b42c>0x0){_0x3e0501+=_0x170917;_0x4a0da2[_0x4347('0x1e')](dbH[_0x4347('0x13')][_0x4347('0x14')](util[_0x4347('0xd')](_0x4347('0x1f'),QUERY,_0x15b42c,_0x3e0501),{'type':dbH[_0x4347('0x13')][_0x4347('0x15')][_0x4347('0x16')]}));}}}else{_0x4a0da2['push'](dbH[_0x4347('0x13')][_0x4347('0x14')](QUERY,{'type':dbH[_0x4347('0x13')][_0x4347('0x15')][_0x4347('0x16')]}));}var _0x31e35c=path['dirname'](PATH);var _0x4202f4=path[_0x4347('0x20')](PATH,'.csv');var _0x48d566=_0x38ae4f[_0x4347('0x19')]&&_0x4a0da2['length']>0x1;var _0x2f1380=[];if(!fs[_0x4347('0x21')](path[_0x4347('0x22')](_0x31e35c,_0x4202f4))&&_0x48d566){fs['mkdirSync'](path[_0x4347('0x22')](_0x31e35c,_0x4202f4));}return BPromise['each'](_0x4a0da2,function(_0x98ab82){_0x2f1380[_0x4347('0x1e')](_0x98ab82);})['then'](function(){for(var _0x4d015a=0x0;_0x4d015a<_0x2f1380[_0x4347('0x1a')];_0x4d015a+=0x1){var _0x1417c2;var _0x4c8dbf=_0x2f1380[_0x4d015a];if(_0x48d566){_0x1417c2=path['join'](_0x31e35c,_0x4202f4,util[_0x4347('0xd')](_0x4347('0x23'),_0x4202f4,_0x4d015a,_0x4347('0x24')));}else{_0x1417c2=path[_0x4347('0x22')](_0x31e35c,util['format'](_0x4347('0x25'),_0x4202f4,'csv'));}fs[_0x4347('0x26')](_0x1417c2,csv(_0x4c8dbf));}})[_0x4347('0x12')](function(){if(_0x48d566){return new Promise(function(_0x4c49d9){zipdir(path['join'](_0x31e35c,_0x4202f4),{'saveTo':path[_0x4347('0x22')](_0x31e35c,util[_0x4347('0xd')](_0x4347('0x25'),_0x4202f4,'zip'))},function(_0x94a41b,_0x5e80af){rimraf(path[_0x4347('0x22')](_0x31e35c,_0x4202f4),function(){});_0x4c49d9(_0x4347('0x27'));});});}})[_0x4347('0x12')](function(){logger['info'](util['format'](_0x4347('0x28'),EXTRACTED_REPORT_ID,_0x4347('0xe')));return analyticExtractedReport('Completed',_0x48d566?util[_0x4347('0xd')](_0x4347('0x25'),_0x4202f4,_0x48d566?_0x4347('0x29'):_0x4347('0x24')):null);});})[_0x4347('0x2a')](function(_0x9956bb){logger[_0x4347('0xc')](util[_0x4347('0xd')](_0x4347('0x2b'),EXTRACTED_REPORT_ID,_0x4347('0xe')),util[_0x4347('0x2c')](_0x9956bb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4347('0x2d'));})[_0x4347('0x2e')](function(){process[_0x4347('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9e73fb3..0ea9c9a 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6483=['zip-dir','rimraf','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','toString','value','length','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','before','margin','landscape','\x20/\x20','Arial','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','each','flatten','%s.%s','pdf','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment'];(function(_0x29eafb,_0x5b3960){var _0x3c0307=function(_0x38756c){while(--_0x38756c){_0x29eafb['push'](_0x29eafb['shift']());}};_0x3c0307(++_0x5b3960);}(_0x6483,0x15c));var _0x3648=function(_0x4d843e,_0x7b176e){_0x4d843e=_0x4d843e-0x0;var _0x13f881=_0x6483[_0x4d843e];return _0x13f881;};'use strict';var _=require(_0x3648('0x0'));var fs=require('fs');var util=require(_0x3648('0x1'));var path=require(_0x3648('0x2'));var moment=require(_0x3648('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x3648('0x4'));var rimraf=require(_0x3648('0x5'));var JSDOM=require(_0x3648('0x6'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x3648('0x7'));var db=require(_0x3648('0x8'))['db'];var dbH=require('../../mysqldb')[_0x3648('0x9')];var logger=require(_0x3648('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3648('0xb')][0x2]);var QUERY=process[_0x3648('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x3648('0xb')][0x5];var FORMAT=_0x3648('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x76c564,_0xc40711){var _0x2b5a11={'status':_0x76c564};var _0x1abb3b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xc40711){_0x2b5a11[_0x3648('0xd')]=_0xc40711;}return db[_0x3648('0xe')]['update'](_0x2b5a11,_0x1abb3b);}function getHeaders(_0x37db1b){return _[_0x3648('0xf')](_0x37db1b,function(_0x2cc215){return{'text':_0x2cc215,'style':_0x3648('0x10')};});}function getRows(_0x7c20e7,_0x10ea70){return _[_0x3648('0xf')](_0x10ea70,function(_0x45bf7a){return _(_0x45bf7a)['pick'](_0x7c20e7)[_0x3648('0xf')](function(_0xd6be02){return _0xd6be02?_[_0x3648('0x11')](_0xd6be02):'';})[_0x3648('0x12')]();});}function createTable(_0x3f21c8,_0x3fffe5){var _0xea639f={'widths':_['fill'](Array(_0x3f21c8[_0x3648('0x13')]),0x91),'heights':function(_0x57d9fb){return _0x57d9fb===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x415275=getHeaders(_0x3f21c8);_0xea639f[_0x3648('0x14')][_0x3648('0x15')](_0x415275);var _0x43c4fe=getRows(_0x3f21c8,_0x3fffe5);_0xea639f['body']=_0xea639f[_0x3648('0x14')][_0x3648('0x16')](_0x43c4fe);return _0xea639f;}function createTables(_0x112dab){var _0x802668=[];var _0x481522=_[_0x3648('0x17')](Object[_0x3648('0x18')](_0x112dab[0x0]),0x5);_0x481522[_0x3648('0x19')](function(_0x187362){_0x802668['push'](createTable(_0x187362,_0x112dab));});return _0x802668;}function getPDFDocDefinition(_0x2b6a2f){var _0x1caad7=util[_0x3648('0x1a')](_0x3648('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x3648('0x1c')])[_0x3648('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x3648('0x1a')](FORMAT));var _0x2b3ad1=[];for(var _0x58e440=0x0;_0x58e440<_0x2b6a2f[_0x3648('0x13')];_0x58e440++){var _0x31e7a7=[];if(_0x58e440===0x0){_0x31e7a7[_0x3648('0x15')]({'text':_0x1caad7,'style':_0x3648('0x1d')});}var _0x5f475d={'table':_0x2b6a2f[_0x58e440]};if(_0x58e440>0x0){_0x5f475d['pageBreak']=_0x3648('0x1e');_0x5f475d[_0x3648('0x1f')]=[0x0,0x46,0x0,0x0];}_0x31e7a7[_0x3648('0x15')](_0x5f475d);_0x2b3ad1[_0x3648('0x15')](_0x31e7a7);}return{'pageSize':'A4','pageOrientation':_0x3648('0x20'),'content':_0x2b3ad1,'footer':function(_0x1bdcc4,_0x19e6f4){return{'text':_0x1bdcc4[_0x3648('0x11')]()+_0x3648('0x21')+_0x19e6f4,'style':'footer'};},'defaultStyle':{'font':_0x3648('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x3648('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x128e93){var _0x3de630=0x1388;var _0x25646b;if(!_0x128e93[0x0][_0x3648('0x24')]){return analyticExtractedReport(_0x3648('0x25'));}return db['Setting'][_0x3648('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3648('0x27'),_0x3648('0x28')]})[_0x3648('0x29')](function(_0x32f587){if(_0x32f587){_0x25646b=_0x32f587;_0x3de630=_0x25646b['splitSizePdf']||0x3e8;}})[_0x3648('0x29')](function(){var _0x5d42e2=[];var _0x9d7aef=0x0;if(_0x25646b['split']){if(_0x128e93&&_0x128e93['length']){var _0x3573d1=_[_0x3648('0x2a')](_0x128e93[0x0]['num']/_0x3de630);var _0xd2a13c=Number[_0x3648('0x2b')](_0x128e93[0x0]['num']/_0x3de630)?_0x128e93[0x0]['num']%_0x3de630:0x0;_0x3573d1[_0x3648('0x19')](function(_0x46ab8c){if(_0x46ab8c>0x0){_0x9d7aef+=_0x3de630;}_0x5d42e2[_0x3648('0x15')](dbH[_0x3648('0x2c')][_0x3648('0x2d')](util[_0x3648('0x1a')](_0x3648('0x2e'),QUERY,_0x3de630,_0x9d7aef),{'type':dbH['sequelize'][_0x3648('0x2f')][_0x3648('0x30')]}));});if(_0xd2a13c>0x0){_0x9d7aef+=_0x3de630;_0x5d42e2[_0x3648('0x15')](dbH['sequelize'][_0x3648('0x2d')](util[_0x3648('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xd2a13c,_0x9d7aef),{'type':dbH[_0x3648('0x2c')][_0x3648('0x2f')][_0x3648('0x30')]}));}}}else{_0x5d42e2[_0x3648('0x15')](dbH[_0x3648('0x2c')][_0x3648('0x2d')](QUERY,{'type':dbH[_0x3648('0x2c')]['QueryTypes'][_0x3648('0x30')]}));}var _0x228b62=path[_0x3648('0x31')](PATH);var _0x428e2f=path[_0x3648('0x32')](PATH,_0x3648('0x33'));var _0x156dea=_0x25646b[_0x3648('0x27')]&&_0x5d42e2['length']>0x1;var _0x78274e=[];if(!fs['existsSync'](path['join'](_0x228b62,_0x428e2f))&&_0x156dea){fs['mkdirSync'](path[_0x3648('0x34')](_0x228b62,_0x428e2f));}return BPromise[_0x3648('0x35')](_0x5d42e2,function(_0x549759){_0x78274e[_0x3648('0x15')](_0x549759);})[_0x3648('0x29')](function(){var _0x5c7751=[];for(var _0x4c659c=0x0;_0x4c659c<_0x78274e[_0x3648('0x13')];_0x4c659c+=0x1){var _0x149a35=_0x78274e[_0x4c659c];var _0x435559=createTables(_[_0x3648('0x36')](_0x149a35));var _0x25aa38;var _0x46db83=getPDFDocDefinition(_0x435559);var _0x2e0442=getPDFPrinter();var _0x5135f0=_0x2e0442['createPdfKitDocument'](_0x46db83);if(_0x156dea){_0x25aa38=path['join'](_0x228b62,_0x428e2f,util['format']('%s%d.%s',_0x428e2f,_0x4c659c,'pdf'));}else{_0x25aa38=path[_0x3648('0x34')](_0x228b62,util[_0x3648('0x1a')](_0x3648('0x37'),_0x428e2f,_0x3648('0x38')));}_0x5c7751[_0x3648('0x15')](writePDFDocument(_0x5135f0,_0x25aa38));}return Promise[_0x3648('0x39')](_0x5c7751);})[_0x3648('0x29')](function(){if(_0x156dea){return new Promise(function(_0x2ce330){zipdir(path[_0x3648('0x34')](_0x228b62,_0x428e2f),{'saveTo':path[_0x3648('0x34')](_0x228b62,util[_0x3648('0x1a')](_0x3648('0x37'),_0x428e2f,_0x3648('0x3a')))},function(){rimraf(path[_0x3648('0x34')](_0x228b62,_0x428e2f),function(){});_0x2ce330('zip\x20finished');});});}})[_0x3648('0x29')](function(){if(!_0x156dea)return;rimraf(path[_0x3648('0x34')](_0x228b62,_0x428e2f),function(){});})[_0x3648('0x29')](function(){logger[_0x3648('0x3b')](util[_0x3648('0x1a')](_0x3648('0x3c'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x3648('0x3d'),_0x156dea?util[_0x3648('0x1a')](_0x3648('0x37'),_0x428e2f,_0x156dea?_0x3648('0x3a'):_0x3648('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3648('0x3b')](util['format'](_0x3648('0x3e'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x3648('0xe')][_0x3648('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3648('0x29')](function(_0x2dbeed){EXTRACTED_REPORT=_0x2dbeed;return dbH['sequelize']['query'](util[_0x3648('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3648('0x2c')][_0x3648('0x2f')][_0x3648('0x30')]});})[_0x3648('0x29')](extractReport)[_0x3648('0x40')](function(_0x3ce22f){logger[_0x3648('0x3b')](util['format'](_0x3648('0x41'),EXTRACTED_REPORT_ID,_0x3648('0x42')),util[_0x3648('0x43')](_0x3ce22f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3648('0x44'));})[_0x3648('0x45')](function(){process[_0x3648('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x315fdb=new PdfPrinter({'Arial':{'normal':__dirname+_0x3648('0x47'),'bold':__dirname+_0x3648('0x48'),'italics':__dirname+_0x3648('0x49'),'bolditalics':__dirname+_0x3648('0x4a')}});return _0x315fdb;}function getPDFDocDefinitionFromHTML(_0x31f888,_0x2782eb){var _0xb8f869=util[_0x3648('0x1a')]('%s\x20#%d',_0x2782eb[_0x3648('0x4b')],_0x2782eb[_0x3648('0x4c')]);var _0x4edacc=moment()[_0x3648('0x1a')](_0x3648('0x4d'))[_0x3648('0x11')]();var _0x1c8570=htmlToPdfmake(_0x31f888,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1c8570],'defaultStyle':{'font':_0x3648('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3648('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3648('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x4dc81e,_0x1fef5d){return[{'text':util['format'](_0x3648('0x4f'),_0xb8f869,_0x4dc81e,_0x1fef5d,_0x4edacc),'style':_0x3648('0x50')}];}};}function writePDFDocument(_0x52eeed,_0x3aaf0e){return new Promise(function(_0x1cbef9,_0x726025){var _0x413b55=_0x52eeed[_0x3648('0x51')](fs[_0x3648('0x52')](_0x3aaf0e));_0x413b55['on'](_0x3648('0x53'),function(){_0x1cbef9(_0x3648('0x53'));});_0x413b55['on'](_0x3648('0x54'),function(_0x23eece){_0x726025(_0x23eece);});_0x52eeed[_0x3648('0x55')]();});}exports[_0x3648('0x56')]=function(_0x129a38,_0x387efb){var _0x1c4d5a=getPDFPrinter();var _0x2a396f=getPDFDocDefinitionFromHTML(_0x129a38,_0x387efb);var _0x4313d5=_0x1c4d5a[_0x3648('0x57')](_0x2a396f);return writePDFDocument(_0x4313d5,_0x387efb[_0x3648('0x2')])[_0x3648('0x40')](function(_0x4572b8){throw _0x4572b8;});}; \ No newline at end of file +var _0x89ee=['channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','util','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','bluebird','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','length','auto','body','concat','chunk','forEach','push','format','name','endDate','before','margin','landscape','toString','\x20/\x20','footer','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d'];(function(_0x5b8592,_0xb5283c){var _0x2c0c94=function(_0x4f2d88){while(--_0x4f2d88){_0x5b8592['push'](_0x5b8592['shift']());}};_0x2c0c94(++_0xb5283c);}(_0x89ee,0x17d));var _0xe89e=function(_0x295645,_0x2f109c){_0x295645=_0x295645-0x0;var _0x1ec8ad=_0x89ee[_0x295645];return _0x1ec8ad;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xe89e('0x0'));var path=require('path');var moment=require(_0xe89e('0x1'));var htmlToPdfmake=require(_0xe89e('0x2'));var PdfPrinter=require(_0xe89e('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xe89e('0x4'))[_0xe89e('0x5')];var window=new JSDOM('')[_0xe89e('0x6')];var BPromise=require(_0xe89e('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xe89e('0x8'))(_0xe89e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe89e('0xa')][0x2]);var QUERY=process[_0xe89e('0xa')][0x3];var PATH=process[_0xe89e('0xa')][0x4];var NAME=process[_0xe89e('0xa')][0x5];var FORMAT=_0xe89e('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x20978b,_0x286c7d){var _0x388884={'status':_0x20978b};var _0x1ab9ef={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x286c7d){_0x388884[_0xe89e('0xc')]=_0x286c7d;}return db[_0xe89e('0xd')][_0xe89e('0xe')](_0x388884,_0x1ab9ef);}function getHeaders(_0x1b5869){return _[_0xe89e('0xf')](_0x1b5869,function(_0x4320ec){return{'text':_0x4320ec,'style':_0xe89e('0x10')};});}function getRows(_0x14946a,_0x566908){return _['map'](_0x566908,function(_0x44dd52){return _(_0x44dd52)[_0xe89e('0x11')](_0x14946a)[_0xe89e('0xf')](function(_0x54f836){return _0x54f836?_['toString'](_0x54f836):'';})[_0xe89e('0x12')]();});}function createTable(_0x78c475,_0x4aec35){var _0x3acc8a={'widths':_[_0xe89e('0x13')](Array(_0x78c475[_0xe89e('0x14')]),0x91),'heights':function(_0x32e446){return _0x32e446===0x0?_0xe89e('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2931c4=getHeaders(_0x78c475);_0x3acc8a[_0xe89e('0x16')]['push'](_0x2931c4);var _0x4e7fbe=getRows(_0x78c475,_0x4aec35);_0x3acc8a['body']=_0x3acc8a[_0xe89e('0x16')][_0xe89e('0x17')](_0x4e7fbe);return _0x3acc8a;}function createTables(_0x3ae6e2){var _0x3fa04f=[];var _0x51a3d8=_[_0xe89e('0x18')](Object['keys'](_0x3ae6e2[0x0]),0x5);_0x51a3d8[_0xe89e('0x19')](function(_0x3b73b3){_0x3fa04f[_0xe89e('0x1a')](createTable(_0x3b73b3,_0x3ae6e2));});return _0x3fa04f;}function getPDFDocDefinition(_0x3c9893){var _0x4d0353=util[_0xe89e('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xe89e('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0xe89e('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0xe89e('0x1d')])['format'](FORMAT));var _0x5853e2=[];for(var _0x33954b=0x0;_0x33954b<_0x3c9893[_0xe89e('0x14')];_0x33954b++){var _0x2bd37d=[];if(_0x33954b===0x0){_0x2bd37d[_0xe89e('0x1a')]({'text':_0x4d0353,'style':'header'});}var _0x220c68={'table':_0x3c9893[_0x33954b]};if(_0x33954b>0x0){_0x220c68['pageBreak']=_0xe89e('0x1e');_0x220c68[_0xe89e('0x1f')]=[0x0,0x46,0x0,0x0];}_0x2bd37d[_0xe89e('0x1a')](_0x220c68);_0x5853e2[_0xe89e('0x1a')](_0x2bd37d);}return{'pageSize':'A4','pageOrientation':_0xe89e('0x20'),'content':_0x5853e2,'footer':function(_0x5e0937,_0x3405e5){return{'text':_0x5e0937[_0xe89e('0x21')]()+_0xe89e('0x22')+_0x3405e5,'style':_0xe89e('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe89e('0x24')},'footer':{'alignment':_0xe89e('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3f99f2){var _0x312d4f=0x1388;var _0x467405;if(!_0x3f99f2[0x0][_0xe89e('0x26')]){return analyticExtractedReport(_0xe89e('0x27'));}return db[_0xe89e('0x28')][_0xe89e('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe89e('0x2a')]})[_0xe89e('0x2b')](function(_0x305c69){if(_0x305c69){_0x467405=_0x305c69;_0x312d4f=_0x467405[_0xe89e('0x2a')]||0x3e8;}})[_0xe89e('0x2b')](function(){var _0x251bc5=[];var _0x4d5158=0x0;if(_0x467405[_0xe89e('0x2c')]){if(_0x3f99f2&&_0x3f99f2[_0xe89e('0x14')]){var _0x4e3599=_[_0xe89e('0x2d')](_0x3f99f2[0x0][_0xe89e('0x26')]/_0x312d4f);var _0x3a5f2d=Number[_0xe89e('0x2e')](_0x3f99f2[0x0][_0xe89e('0x26')]/_0x312d4f)?_0x3f99f2[0x0]['num']%_0x312d4f:0x0;_0x4e3599[_0xe89e('0x19')](function(_0x37f357){if(_0x37f357>0x0){_0x4d5158+=_0x312d4f;}_0x251bc5[_0xe89e('0x1a')](dbH[_0xe89e('0x2f')][_0xe89e('0x30')](util[_0xe89e('0x1b')](_0xe89e('0x31'),QUERY,_0x312d4f,_0x4d5158),{'type':dbH[_0xe89e('0x2f')][_0xe89e('0x32')][_0xe89e('0x33')]}));});if(_0x3a5f2d>0x0){_0x4d5158+=_0x312d4f;_0x251bc5[_0xe89e('0x1a')](dbH['sequelize'][_0xe89e('0x30')](util['format'](_0xe89e('0x31'),QUERY,_0x3a5f2d,_0x4d5158),{'type':dbH[_0xe89e('0x2f')]['QueryTypes']['SELECT']}));}}}else{_0x251bc5[_0xe89e('0x1a')](dbH['sequelize'][_0xe89e('0x30')](QUERY,{'type':dbH[_0xe89e('0x2f')]['QueryTypes'][_0xe89e('0x33')]}));}var _0x5b5479=path[_0xe89e('0x34')](PATH);var _0x264250=path[_0xe89e('0x35')](PATH,_0xe89e('0x36'));var _0x4b412f=_0x467405[_0xe89e('0x2c')]&&_0x251bc5[_0xe89e('0x14')]>0x1;var _0x5ddd84=[];if(!fs['existsSync'](path[_0xe89e('0x37')](_0x5b5479,_0x264250))&&_0x4b412f){fs[_0xe89e('0x38')](path[_0xe89e('0x37')](_0x5b5479,_0x264250));}return BPromise['each'](_0x251bc5,function(_0x4b7796){_0x5ddd84[_0xe89e('0x1a')](_0x4b7796);})[_0xe89e('0x2b')](function(){var _0x35e9b3=[];for(var _0x5ee1cf=0x0;_0x5ee1cf<_0x5ddd84[_0xe89e('0x14')];_0x5ee1cf+=0x1){var _0x244f17=_0x5ddd84[_0x5ee1cf];var _0xf953e4=createTables(_[_0xe89e('0x39')](_0x244f17));var _0x574ae5;var _0x3634d3=getPDFDocDefinition(_0xf953e4);var _0x2e2bc1=getPDFPrinter();var _0x2e8616=_0x2e2bc1[_0xe89e('0x3a')](_0x3634d3);if(_0x4b412f){_0x574ae5=path['join'](_0x5b5479,_0x264250,util['format'](_0xe89e('0x3b'),_0x264250,_0x5ee1cf,_0xe89e('0x3c')));}else{_0x574ae5=path[_0xe89e('0x37')](_0x5b5479,util['format'](_0xe89e('0x3d'),_0x264250,_0xe89e('0x3c')));}_0x35e9b3[_0xe89e('0x1a')](writePDFDocument(_0x2e8616,_0x574ae5));}return Promise[_0xe89e('0x3e')](_0x35e9b3);})['then'](function(){if(_0x4b412f){return new Promise(function(_0x155f35){zipdir(path[_0xe89e('0x37')](_0x5b5479,_0x264250),{'saveTo':path['join'](_0x5b5479,util[_0xe89e('0x1b')]('%s.%s',_0x264250,_0xe89e('0x3f')))},function(){rimraf(path[_0xe89e('0x37')](_0x5b5479,_0x264250),function(){});_0x155f35(_0xe89e('0x40'));});});}})[_0xe89e('0x2b')](function(){if(!_0x4b412f)return;rimraf(path[_0xe89e('0x37')](_0x5b5479,_0x264250),function(){});})[_0xe89e('0x2b')](function(){logger[_0xe89e('0x41')](util[_0xe89e('0x1b')](_0xe89e('0x42'),EXTRACTED_REPORT_ID,_0xe89e('0x43')));return analyticExtractedReport(_0xe89e('0x44'),_0x4b412f?util[_0xe89e('0x1b')](_0xe89e('0x3d'),_0x264250,_0x4b412f?_0xe89e('0x3f'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe89e('0x41')](util[_0xe89e('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0xe89e('0xd')][_0xe89e('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe89e('0x2b')](function(_0x7bf315){EXTRACTED_REPORT=_0x7bf315;return dbH[_0xe89e('0x2f')][_0xe89e('0x30')](util[_0xe89e('0x1b')](_0xe89e('0x46'),QUERY),{'type':dbH[_0xe89e('0x2f')][_0xe89e('0x32')]['SELECT']});})[_0xe89e('0x2b')](extractReport)[_0xe89e('0x47')](function(_0x1da78d){logger[_0xe89e('0x41')](util['format'](_0xe89e('0x48'),EXTRACTED_REPORT_ID,_0xe89e('0x43')),util['inspect'](_0x1da78d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe89e('0x49')](function(){process[_0xe89e('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5e3f20=new PdfPrinter({'Arial':{'normal':__dirname+_0xe89e('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xe89e('0x4c'),'bolditalics':__dirname+_0xe89e('0x4d')}});return _0x5e3f20;}function getPDFDocDefinitionFromHTML(_0x3832f3,_0x34cc8f){var _0x22152d=util[_0xe89e('0x1b')](_0xe89e('0x4e'),_0x34cc8f[_0xe89e('0x4f')],_0x34cc8f[_0xe89e('0x50')]);var _0x4b3804=moment()[_0xe89e('0x1b')](_0xe89e('0x51'))[_0xe89e('0x21')]();var _0x9b6bb3=htmlToPdfmake(_0x3832f3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x9b6bb3],'defaultStyle':{'font':_0xe89e('0x52')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe89e('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe89e('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xe89e('0x53')}},'header':function(){return[{'text':_0xe89e('0x54'),'style':_0xe89e('0x55')}];},'footer':function(_0x2841c7,_0xd54053){return[{'text':util[_0xe89e('0x1b')](_0xe89e('0x56'),_0x22152d,_0x2841c7,_0xd54053,_0x4b3804),'style':'footer'}];}};}function writePDFDocument(_0x5d2894,_0x24fb41){return new Promise(function(_0x5f2a03,_0x7fc8a9){var _0xd3d552=_0x5d2894['pipe'](fs[_0xe89e('0x57')](_0x24fb41));_0xd3d552['on'](_0xe89e('0x58'),function(){_0x5f2a03(_0xe89e('0x58'));});_0xd3d552['on'](_0xe89e('0x59'),function(_0x2db1ae){_0x7fc8a9(_0x2db1ae);});_0x5d2894[_0xe89e('0x5a')]();});}exports[_0xe89e('0x5b')]=function(_0x53b225,_0x1d9ee4){var _0x23bbd4=getPDFPrinter();var _0x4d3246=getPDFDocDefinitionFromHTML(_0x53b225,_0x1d9ee4);var _0x5d48d5=_0x23bbd4['createPdfKitDocument'](_0x4d3246);return writePDFDocument(_0x5d48d5,_0x1d9ee4['path'])[_0xe89e('0x47')](function(_0x32d0be){throw _0x32d0be;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2508db0..cee14f9 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc359=['zip','zip\x20finished','XLSX','Completed','catch','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','info','format','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','.xlsx','join','mkdirSync','length','%s%d.%s','xlsx','writeFileSync','binary'];(function(_0x4fa92b,_0x7d972){var _0x2a6579=function(_0x1642a3){while(--_0x1642a3){_0x4fa92b['push'](_0x4fa92b['shift']());}};_0x2a6579(++_0x7d972);}(_0xc359,0x93));var _0x9c35=function(_0x252805,_0x1d1e8e){_0x252805=_0x252805-0x0;var _0x3e74b9=_0xc359[_0x252805];return _0x3e74b9;};'use strict';var util=require(_0x9c35('0x0'));var path=require('path');var _=require(_0x9c35('0x1'));var fs=require('fs');var json2xls=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var zipdir=require(_0x9c35('0x4'));var rimraf=require(_0x9c35('0x5'));var db=require(_0x9c35('0x6'))['db'];var dbH=require('../../mysqldb')[_0x9c35('0x7')];var logger=require(_0x9c35('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9c35('0x9')][0x3];var PATH=process[_0x9c35('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c3b23,_0x3a11dd){var _0x44bd09={'status':_0x5c3b23};var _0x64ad94={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a11dd){_0x44bd09[_0x9c35('0xa')]=_0x3a11dd;}return db['AnalyticExtractedReport']['update'](_0x44bd09,_0x64ad94);}function main(){var _0x81ad06=0x1388;var _0x5f3708;logger[_0x9c35('0xb')](util[_0x9c35('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x9c35('0xd')][_0x9c35('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9c35('0xf'),'splitSizeXlsx']})[_0x9c35('0x10')](function(_0x10fb07){if(_0x10fb07){_0x5f3708=_0x10fb07;_0x81ad06=_0x5f3708[_0x9c35('0x11')]||0x1388;}})[_0x9c35('0x10')](function(){return dbH[_0x9c35('0x12')][_0x9c35('0x13')](util['format'](_0x9c35('0x14'),QUERY),{'type':dbH[_0x9c35('0x12')][_0x9c35('0x15')][_0x9c35('0x16')]});})[_0x9c35('0x10')](function(_0x51628a){if(!_0x51628a[0x0][_0x9c35('0x17')]){return analyticExtractedReport(_0x9c35('0x18'));}var _0x5144f8=[];var _0x166f9a=0x0;if(_0x5f3708['split']){if(_0x51628a&&_0x51628a['length']){var _0x516a43=_[_0x9c35('0x19')](_0x51628a[0x0]['num']/_0x81ad06);var _0x7fd978=Number[_0x9c35('0x1a')](_0x51628a[0x0]['num']/_0x81ad06)?_0x51628a[0x0][_0x9c35('0x17')]%_0x81ad06:0x0;_0x516a43[_0x9c35('0x1b')](function(_0x25615a){if(_0x25615a>0x0){_0x166f9a+=_0x81ad06;}_0x5144f8[_0x9c35('0x1c')](dbH[_0x9c35('0x12')][_0x9c35('0x13')](util[_0x9c35('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x81ad06,_0x166f9a),{'type':dbH[_0x9c35('0x12')][_0x9c35('0x15')][_0x9c35('0x16')]}));});if(_0x7fd978>0x0){_0x166f9a+=_0x81ad06;_0x5144f8[_0x9c35('0x1c')](dbH[_0x9c35('0x12')][_0x9c35('0x13')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x7fd978,_0x166f9a),{'type':dbH[_0x9c35('0x12')][_0x9c35('0x15')][_0x9c35('0x16')]}));}}}else{_0x5144f8['push'](dbH[_0x9c35('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0x9c35('0x15')][_0x9c35('0x16')]}));}var _0x36f8a9=path['dirname'](PATH);var _0x50cc6b=path['basename'](PATH,_0x9c35('0x1d'));var _0x433a7a=_0x5f3708[_0x9c35('0xf')]&&_0x5144f8['length']>0x1;var _0x14a5f4=[];if(!fs['existsSync'](path[_0x9c35('0x1e')](_0x36f8a9,_0x50cc6b))&&_0x433a7a){fs[_0x9c35('0x1f')](path[_0x9c35('0x1e')](_0x36f8a9,_0x50cc6b));}return BPromise['each'](_0x5144f8,function(_0x52046f){_0x14a5f4['push'](_0x52046f);})[_0x9c35('0x10')](function(){for(var _0x5c4015=0x0;_0x5c4015<_0x14a5f4[_0x9c35('0x20')];_0x5c4015+=0x1){var _0x394262;var _0x421efa=_0x14a5f4[_0x5c4015];if(_0x433a7a){_0x394262=path[_0x9c35('0x1e')](_0x36f8a9,_0x50cc6b,util[_0x9c35('0xc')](_0x9c35('0x21'),_0x50cc6b,_0x5c4015,_0x9c35('0x22')));}else{_0x394262=path[_0x9c35('0x1e')](_0x36f8a9,util[_0x9c35('0xc')]('%s.%s',_0x50cc6b,_0x9c35('0x22')));}fs[_0x9c35('0x23')](_0x394262,json2xls(_0x421efa),_0x9c35('0x24'));}})[_0x9c35('0x10')](function(){if(_0x433a7a){return new Promise(function(_0x550c2d){zipdir(path[_0x9c35('0x1e')](_0x36f8a9,_0x50cc6b),{'saveTo':path[_0x9c35('0x1e')](_0x36f8a9,util[_0x9c35('0xc')]('%s.%s',_0x50cc6b,_0x9c35('0x25')))},function(_0x3f492a,_0x5f5259){rimraf(path[_0x9c35('0x1e')](_0x36f8a9,_0x50cc6b),function(){});_0x550c2d(_0x9c35('0x26'));});});}})[_0x9c35('0x10')](function(){logger[_0x9c35('0xb')](util[_0x9c35('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9c35('0x27')));return analyticExtractedReport(_0x9c35('0x28'),_0x433a7a?util['format']('%s.%s',_0x50cc6b,_0x433a7a?_0x9c35('0x25'):'xlsx'):null);});})[_0x9c35('0x29')](function(_0x446c92){logger[_0x9c35('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9c35('0x27')),util[_0x9c35('0x2a')](_0x446c92,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9c35('0x2b'));})[_0x9c35('0x2c')](function(){process[_0x9c35('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6a47=['SELECT','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Empty','length','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes'];(function(_0x2280e0,_0x3a3e10){var _0x3299d2=function(_0x4a4916){while(--_0x4a4916){_0x2280e0['push'](_0x2280e0['shift']());}};_0x3299d2(++_0x3a3e10);}(_0x6a47,0x112));var _0x76a4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6a47[_0x413feb];return _0x40ee88;};'use strict';var util=require(_0x76a4('0x0'));var path=require(_0x76a4('0x1'));var _=require(_0x76a4('0x2'));var fs=require('fs');var json2xls=require(_0x76a4('0x3'));var BPromise=require(_0x76a4('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x76a4('0x5'));var db=require(_0x76a4('0x6'))['db'];var dbH=require('../../mysqldb')[_0x76a4('0x7')];var logger=require(_0x76a4('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x76a4('0x9')][0x2]);var QUERY=process[_0x76a4('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x364fe8,_0xb1de4d){var _0x53d422={'status':_0x364fe8};var _0x24a5fd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb1de4d){_0x53d422[_0x76a4('0xa')]=_0xb1de4d;}return db[_0x76a4('0xb')]['update'](_0x53d422,_0x24a5fd);}function main(){var _0x28e872=0x1388;var _0x43922a;logger[_0x76a4('0xc')](util[_0x76a4('0xd')](_0x76a4('0xe'),EXTRACTED_REPORT_ID,_0x76a4('0xf')));return db[_0x76a4('0x10')][_0x76a4('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x76a4('0x12'),'splitSizeXlsx']})[_0x76a4('0x13')](function(_0xfe603f){if(_0xfe603f){_0x43922a=_0xfe603f;_0x28e872=_0x43922a[_0x76a4('0x14')]||0x1388;}})['then'](function(){return dbH[_0x76a4('0x15')][_0x76a4('0x16')](util['format'](_0x76a4('0x17'),QUERY),{'type':dbH[_0x76a4('0x15')]['QueryTypes']['SELECT']});})[_0x76a4('0x13')](function(_0x6213d3){if(!_0x6213d3[0x0]['num']){return analyticExtractedReport(_0x76a4('0x18'));}var _0x3aed77=[];var _0x325969=0x0;if(_0x43922a[_0x76a4('0x12')]){if(_0x6213d3&&_0x6213d3[_0x76a4('0x19')]){var _0x1f0fd2=_[_0x76a4('0x1a')](_0x6213d3[0x0][_0x76a4('0x1b')]/_0x28e872);var _0x52e81f=Number[_0x76a4('0x1c')](_0x6213d3[0x0]['num']/_0x28e872)?_0x6213d3[0x0][_0x76a4('0x1b')]%_0x28e872:0x0;_0x1f0fd2['forEach'](function(_0x58ae5c){if(_0x58ae5c>0x0){_0x325969+=_0x28e872;}_0x3aed77[_0x76a4('0x1d')](dbH['sequelize'][_0x76a4('0x16')](util[_0x76a4('0xd')](_0x76a4('0x1e'),QUERY,_0x28e872,_0x325969),{'type':dbH[_0x76a4('0x15')][_0x76a4('0x1f')]['SELECT']}));});if(_0x52e81f>0x0){_0x325969+=_0x28e872;_0x3aed77['push'](dbH[_0x76a4('0x15')][_0x76a4('0x16')](util['format'](_0x76a4('0x1e'),QUERY,_0x52e81f,_0x325969),{'type':dbH[_0x76a4('0x15')][_0x76a4('0x1f')][_0x76a4('0x20')]}));}}}else{_0x3aed77[_0x76a4('0x1d')](dbH[_0x76a4('0x15')][_0x76a4('0x16')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x4fd6eb=path[_0x76a4('0x21')](PATH);var _0x4570a0=path[_0x76a4('0x22')](PATH,_0x76a4('0x23'));var _0xd63395=_0x43922a['split']&&_0x3aed77['length']>0x1;var _0x23ba6e=[];if(!fs[_0x76a4('0x24')](path['join'](_0x4fd6eb,_0x4570a0))&&_0xd63395){fs['mkdirSync'](path[_0x76a4('0x25')](_0x4fd6eb,_0x4570a0));}return BPromise[_0x76a4('0x26')](_0x3aed77,function(_0x43ce16){_0x23ba6e[_0x76a4('0x1d')](_0x43ce16);})[_0x76a4('0x13')](function(){for(var _0x303634=0x0;_0x303634<_0x23ba6e['length'];_0x303634+=0x1){var _0x58ce28;var _0x2ac1a9=_0x23ba6e[_0x303634];if(_0xd63395){_0x58ce28=path[_0x76a4('0x25')](_0x4fd6eb,_0x4570a0,util[_0x76a4('0xd')](_0x76a4('0x27'),_0x4570a0,_0x303634,_0x76a4('0x28')));}else{_0x58ce28=path[_0x76a4('0x25')](_0x4fd6eb,util[_0x76a4('0xd')]('%s.%s',_0x4570a0,'xlsx'));}fs[_0x76a4('0x29')](_0x58ce28,json2xls(_0x2ac1a9),_0x76a4('0x2a'));}})[_0x76a4('0x13')](function(){if(_0xd63395){return new Promise(function(_0xd2bddb){zipdir(path[_0x76a4('0x25')](_0x4fd6eb,_0x4570a0),{'saveTo':path[_0x76a4('0x25')](_0x4fd6eb,util[_0x76a4('0xd')]('%s.%s',_0x4570a0,'zip'))},function(_0xbc3e07,_0x5004){rimraf(path[_0x76a4('0x25')](_0x4fd6eb,_0x4570a0),function(){});_0xd2bddb(_0x76a4('0x2b'));});});}})['then'](function(){logger[_0x76a4('0xc')](util[_0x76a4('0xd')](_0x76a4('0x2c'),EXTRACTED_REPORT_ID,_0x76a4('0xf')));return analyticExtractedReport(_0x76a4('0x2d'),_0xd63395?util[_0x76a4('0xd')]('%s.%s',_0x4570a0,_0xd63395?_0x76a4('0x2e'):'xlsx'):null);});})[_0x76a4('0x2f')](function(_0x33429f){logger['info'](util[_0x76a4('0xd')](_0x76a4('0x30'),EXTRACTED_REPORT_ID,_0x76a4('0xf')),util[_0x76a4('0x31')](_0x33429f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x76a4('0x32'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 47e5935..3f9c17e 100644 --- a/server/components/extensions/rewrite.js +++ b/server/components/extensions/rewrite.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f87=['playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','*,*,*,*','interval','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','map','exten','filter','groupBy','queue'];(function(_0x1091d6,_0x10a498){var _0x23940f=function(_0xe71162){while(--_0xe71162){_0x1091d6['push'](_0x1091d6['shift']());}};_0x23940f(++_0x10a498);}(_0x4f87,0x1dd));var _0x74f8=function(_0x431db6,_0x39e17b){_0x431db6=_0x431db6-0x0;var _0x34674e=_0x4f87[_0x431db6];return _0x34674e;};'use strict';var _=require(_0x74f8('0x0'));var util=require(_0x74f8('0x1'));function rewrite(_0x14cc84,_0x34b85a){var _0x1c3e99=this;return _0x14cc84[_0x74f8('0x2')][_0x74f8('0x3')][_0x74f8('0x4')]({'raw':!![]})[_0x74f8('0x5')](function(_0x1c3580){_0x1c3e99[_0x74f8('0x6')]=_0x1c3580;return _0x14cc84[_0x74f8('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x34b85a['IntervalId']},'raw':!![]});})['then'](function(_0x17b2da){return _0x14cc84[_0x74f8('0x2')][_0x74f8('0x7')][_0x74f8('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x74f8('0x8')](_0x17b2da,_0x74f8('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x74f8('0x5')](function(_0x2a9516){var _0x1245e2=_[_0x74f8('0xa')](_0x2a9516,{'priority':'1'});var _0x483ce9=_['filter'](_0x2a9516,{'isApp':0x1});var _0x2e7df4=_[_0x74f8('0xb')](_0x483ce9,_0x74f8('0x9'));var _0x1ffa9c=[_0x74f8('0xc'),_0x74f8('0xd')];var _0xe8b712=[];var _0x887642=[];for(var _0x2f02bc in _0x2e7df4){if(_0x2e7df4[_0x74f8('0xe')](_0x2f02bc)){_0x1c3e99[_0x74f8('0xf')]=0x2;_0x1c3e99[_0x74f8('0x10')]=[];_0x1c3e99[_0x74f8('0x11')]=_['find'](_0x1245e2,{'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')]});_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':util[_0x74f8('0x15')](_0x74f8('0x16'),_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')]),'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});if(_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')]===_0x74f8('0x19')){_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':'Set','appdata':_0x74f8('0x1a')+_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')],'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0]['exten'],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});}else if(_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')]===_0x74f8('0x1b')){if(_0x1c3e99[_0x74f8('0x11')]){_0x1c3e99[_0x74f8('0x10')]['push']({'type':_0x2e7df4[_0x2f02bc][0x0]['type'],'app':'Set','appdata':_0x74f8('0x1c')+(_0x1c3e99[_0x74f8('0x11')][_0x74f8('0x1d')]?'${EXTEN:'+_0x1c3e99['extension'][_0x74f8('0x1d')]+'}':'${EXTEN}'),'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99['priority']++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});}_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':_0x74f8('0x1a')+_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')],'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});var _0x37acc4=_0x1c3e99['priority']++;_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':_0x74f8('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x37acc4+0x2)+_0x74f8('0x1f')+(_0x37acc4+0x1)+')','context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x37acc4,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});if(_0x1c3e99[_0x74f8('0x11')]){_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':'Set','appdata':_0x1c3e99[_0x74f8('0x11')][_0x74f8('0x1d')]?_0x74f8('0x20')+_0x1c3e99['extension']['cutdigits']+'}':_0x74f8('0x21'),'context':_0x2e7df4[_0x2f02bc][0x0]['context'],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});}_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':'outboundrouteid='+_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')],'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});if(_0x1c3e99[_0x74f8('0x11')]&&_0x1c3e99[_0x74f8('0x11')][_0x74f8('0xe')](_0x74f8('0x22'))&&_0x1c3e99[_0x74f8('0x11')][_0x74f8('0x22')]!=='none'){_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0]['type'],'app':_0x74f8('0x14'),'appdata':_0x74f8('0x23'),'context':_0x2e7df4[_0x2f02bc][0x0]['context'],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});_0x1c3e99['extensions'][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':_0x74f8('0x24')+_0x1c3e99['extension'][_0x74f8('0x22')]||_0x74f8('0x25'),'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0]['VoiceExtensionId']});}}_0x1c3e99['extensions'][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':_0x74f8('0x26'),'context':_0x2e7df4[_0x2f02bc][0x0]['context'],'exten':_0x2e7df4[_0x2f02bc][0x0]['exten'],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});_0x1c3e99['extensions']['push']({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':_0x74f8('0x27'),'context':_0x2e7df4[_0x2f02bc][0x0]['context'],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99[_0x74f8('0xf')]++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});_0x1c3e99[_0x74f8('0x10')][_0x74f8('0x12')]({'type':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x13')],'app':'Set','appdata':_0x74f8('0x28'),'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'priority':_0x1c3e99['priority']++,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});for(var _0x36a8c4=0x0,_0x59b8d8=0x0;_0x36a8c4<_0x2e7df4[_0x2f02bc][_0x74f8('0x29')];_0x36a8c4+=0x1,_0x59b8d8=0x0){var _0xd5a876=_0x2e7df4[_0x2f02bc][_0x36a8c4];if(_0xd5a876[_0x74f8('0x13')]){_0xd5a876[_0x74f8('0x13')]=_0xd5a876['type']['toLowerCase']();}var _0x149a00=[];var _0x36df2f=[];delete _0xd5a876['id'];delete _0xd5a876['createdAt'];delete _0xd5a876[_0x74f8('0x2a')];var _0x365949=_0xd5a876['interval']!==_0x74f8('0x2b')?[_0xd5a876[_0x74f8('0x2c')]]:_0xd5a876['IntervalId']?_['map'](_[_0x74f8('0xa')](_0x1c3e99['intervals'],{'IntervalId':_0xd5a876[_0x74f8('0x2d')]}),_0x74f8('0x2c')):[];if(_0xd5a876[_0x74f8('0xe')](_0x74f8('0x2e'))){if(_0xd5a876[_0x74f8('0x2e')]&&_0xd5a876[_0x74f8('0x2e')]!=='--'){_0x149a00[_0x74f8('0x12')]({'type':_0xd5a876['type'],'app':_0x74f8('0x14'),'appdata':_0x74f8('0x2f')+_0xd5a876[_0x74f8('0x2e')],'context':_0xd5a876['context'],'exten':_0xd5a876[_0x74f8('0x9')],'priority':_0x365949[_0x74f8('0x29')]+_0x1c3e99[_0x74f8('0xf')]+_0x59b8d8++,'VoiceExtensionId':_0xd5a876[_0x74f8('0x18')]});}}if(_0xd5a876['type']===_0x74f8('0x1b')&&_0xd5a876[_0x74f8('0xe')](_0x74f8('0x30'))){if(_0xd5a876['callerID']){_0x149a00[_0x74f8('0x12')]({'type':_0xd5a876[_0x74f8('0x13')],'app':_0x74f8('0x1e'),'appdata':_0x74f8('0x31')+_0xd5a876['callerID']+')','context':_0xd5a876['context'],'exten':_0xd5a876[_0x74f8('0x9')],'priority':_0x365949['length']+_0x1c3e99['priority']+_0x59b8d8++,'VoiceExtensionId':_0xd5a876[_0x74f8('0x18')]});}else{_0x149a00[_0x74f8('0x12')]({'type':_0xd5a876[_0x74f8('0x13')],'app':_0x74f8('0x1e'),'appdata':_0x74f8('0x32'),'context':_0xd5a876[_0x74f8('0x17')],'exten':_0xd5a876[_0x74f8('0x9')],'priority':_0x365949['length']+_0x1c3e99[_0x74f8('0xf')]+_0x59b8d8++,'VoiceExtensionId':_0xd5a876[_0x74f8('0x18')]});}}if(_0xd5a876[_0x74f8('0xe')](_0x74f8('0x33'))){if(_0x1ffa9c[_0x74f8('0x34')](_0xd5a876[_0x74f8('0x35')][_0x74f8('0x36')]())>=0x0&&_0xd5a876[_0x74f8('0x37')]!==_0x74f8('0x38')){if(_0xd5a876[_0x74f8('0x33')]){_0x149a00[_0x74f8('0x12')]({'type':_0xd5a876[_0x74f8('0x13')],'app':_0x74f8('0x1e'),'appdata':_0x74f8('0x39'),'context':_0xd5a876[_0x74f8('0x17')],'exten':_0xd5a876[_0x74f8('0x9')],'priority':_0x365949[_0x74f8('0x29')]+_0x1c3e99[_0x74f8('0xf')]+_0x59b8d8++,'VoiceExtensionId':_0xd5a876[_0x74f8('0x18')]});_0x149a00[_0x74f8('0x12')]({'type':_0xd5a876[_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xd5a876[_0x74f8('0x17')],'exten':_0xd5a876[_0x74f8('0x9')],'priority':_0x365949[_0x74f8('0x29')]+_0x1c3e99[_0x74f8('0xf')]+_0x59b8d8++,'VoiceExtensionId':_0xd5a876['VoiceExtensionId']});}else{_0x149a00[_0x74f8('0x12')]({'type':_0xd5a876[_0x74f8('0x13')],'app':_0x74f8('0x1e'),'appdata':_0x74f8('0x3a'),'context':_0xd5a876[_0x74f8('0x17')],'exten':_0xd5a876[_0x74f8('0x9')],'priority':_0x365949['length']+_0x1c3e99['priority']+_0x59b8d8++,'VoiceExtensionId':_0xd5a876[_0x74f8('0x18')]});_0x149a00[_0x74f8('0x12')]({'type':_0xd5a876[_0x74f8('0x13')],'app':_0x74f8('0x14'),'appdata':_0x74f8('0x3b'),'context':_0xd5a876[_0x74f8('0x17')],'exten':_0xd5a876[_0x74f8('0x9')],'priority':_0x365949[_0x74f8('0x29')]+_0x1c3e99[_0x74f8('0xf')]+_0x59b8d8++,'VoiceExtensionId':_0xd5a876[_0x74f8('0x18')]});}}}for(var _0x569d2f=0x0;_0x569d2f<_0x365949[_0x74f8('0x29')];_0x569d2f+=0x1){var _0x39326f=_0x1c3e99[_0x74f8('0xf')]+_0x365949['length'];var _0xc801d9=_0x569d2f===_0x365949['length']-0x1?_0x1c3e99[_0x74f8('0xf')]+_0x149a00[_0x74f8('0x29')]+_0x36df2f[_0x74f8('0x29')]+0x2:_0x1c3e99[_0x74f8('0xf')]+_0x569d2f+0x1;_0x149a00[_0x74f8('0x3c')](_0x569d2f,0x0,{'type':_0xd5a876[_0x74f8('0x13')],'app':_0x74f8('0x3d'),'appdata':_0x365949[_0x569d2f]+'?'+_0xd5a876[_0x74f8('0x17')]+_0x74f8('0x3e')+_0x39326f+':'+_0xd5a876[_0x74f8('0x17')]+_0x74f8('0x3e')+_0xc801d9,'exten':_0xd5a876[_0x74f8('0x9')],'context':_0xd5a876[_0x74f8('0x17')],'priority':_0x1c3e99[_0x74f8('0xf')]+_0x569d2f,'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});}_0xd5a876[_0x74f8('0xf')]=_0x149a00[_0x74f8('0x29')]?_[_0x74f8('0x3f')](_0x149a00)[_0x74f8('0xf')]+0x1:_0x1c3e99[_0x74f8('0xf')];_0x1c3e99[_0x74f8('0xf')]=(_0x36df2f[_0x74f8('0x29')]?_[_0x74f8('0x3f')](_0x36df2f)[_0x74f8('0xf')]:_0xd5a876[_0x74f8('0xf')])+0x1;_0x1c3e99[_0x74f8('0x10')]=_[_0x74f8('0x40')](_0x1c3e99[_0x74f8('0x10')],_0x149a00,[_0xd5a876],_0x36df2f);}_0x1c3e99[_0x74f8('0x10')]['push']({'type':_0x2e7df4[_0x2f02bc][0x0]['type'],'app':_0x74f8('0x41'),'exten':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x9')],'context':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x17')],'priority':_0x1c3e99['priority'],'VoiceExtensionId':_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]});_0xe8b712[_0x74f8('0x12')](_0x2e7df4[_0x2f02bc][0x0][_0x74f8('0x18')]);_0x887642=_[_0x74f8('0x40')](_0x887642,_0x1c3e99[_0x74f8('0x10')]);}}return _0x14cc84['transaction'](function(_0x191af6){return _0x14cc84[_0x74f8('0x2')][_0x74f8('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0xe8b712}},'transaction':_0x191af6})['then'](function(_0x44c2dd){return _0x14cc84[_0x74f8('0x2')][_0x74f8('0x7')][_0x74f8('0x42')](_[_0x74f8('0x43')](_0x887642,_0x74f8('0xf')),{'transaction':_0x191af6});});});})[_0x74f8('0x44')](function(_0x2be3fd){console['error'](_0x2be3fd);});}exports[_0x74f8('0x45')]=rewrite; \ No newline at end of file +var _0xcb19=['models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','toLowerCase','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util'];(function(_0x3db2c,_0x5e66d3){var _0x402b07=function(_0x2167e4){while(--_0x2167e4){_0x3db2c['push'](_0x3db2c['shift']());}};_0x402b07(++_0x5e66d3);}(_0xcb19,0x161));var _0x9cb1=function(_0x4caf35,_0x3240b9){_0x4caf35=_0x4caf35-0x0;var _0xd79b1b=_0xcb19[_0x4caf35];return _0xd79b1b;};'use strict';var _=require(_0x9cb1('0x0'));var util=require(_0x9cb1('0x1'));function rewrite(_0x22ea96,_0x4506b9){var _0x250a80=this;return _0x22ea96[_0x9cb1('0x2')]['Interval'][_0x9cb1('0x3')]({'raw':!![]})[_0x9cb1('0x4')](function(_0x2e288d){_0x250a80[_0x9cb1('0x5')]=_0x2e288d;return _0x22ea96[_0x9cb1('0x2')][_0x9cb1('0x6')][_0x9cb1('0x3')]({'where':{'IntervalId':_0x4506b9[_0x9cb1('0x7')]},'raw':!![]});})[_0x9cb1('0x4')](function(_0x1ad248){return _0x22ea96[_0x9cb1('0x2')][_0x9cb1('0x6')][_0x9cb1('0x3')]({'where':{'exten':{'$in':_[_0x9cb1('0x8')](_[_0x9cb1('0x9')](_0x1ad248,_0x9cb1('0xa')))}},'order':[{'raw':_0x9cb1('0xb')}],'raw':!![]});})[_0x9cb1('0x4')](function(_0x43b6ce){var _0x2edc05=_[_0x9cb1('0xc')](_0x43b6ce,{'priority':'1'});var _0x481ed5=_[_0x9cb1('0xc')](_0x43b6ce,{'isApp':0x1});var _0x1fc01c=_[_0x9cb1('0xd')](_0x481ed5,_0x9cb1('0xa'));var _0x1c33f9=[_0x9cb1('0xe'),_0x9cb1('0xf')];var _0x61ab7a=[];var _0x3f647=[];for(var _0xbf0f95 in _0x1fc01c){if(_0x1fc01c['hasOwnProperty'](_0xbf0f95)){_0x250a80['priority']=0x2;_0x250a80['extensions']=[];_0x250a80[_0x9cb1('0x10')]=_[_0x9cb1('0x11')](_0x2edc05,{'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')]});_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':util[_0x9cb1('0x16')](_0x9cb1('0x17'),_0x1fc01c[_0xbf0f95][0x0]['type']),'context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')]});if(_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')]===_0x9cb1('0x1b')){_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':_0x9cb1('0x1c')+_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')],'context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0]['exten'],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']});}else if(_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')]===_0x9cb1('0x1d')){if(_0x250a80[_0x9cb1('0x10')]){_0x250a80[_0x9cb1('0x12')]['push']({'type':_0x1fc01c[_0xbf0f95][0x0]['type'],'app':_0x9cb1('0x15'),'appdata':_0x9cb1('0x1e')+(_0x250a80[_0x9cb1('0x10')][_0x9cb1('0x1f')]?_0x9cb1('0x20')+_0x250a80[_0x9cb1('0x10')][_0x9cb1('0x1f')]+'}':_0x9cb1('0x21')),'context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']});}_0x250a80['extensions']['push']({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':_0x9cb1('0x1c')+_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')],'context':_0x1fc01c[_0xbf0f95][0x0]['context'],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']});var _0x370c83=_0x250a80[_0x9cb1('0x19')]++;_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x22'),'appdata':_0x9cb1('0x23')+(_0x370c83+0x2)+'):Goto('+(_0x370c83+0x1)+')','context':_0x1fc01c[_0xbf0f95][0x0]['context'],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x370c83,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']});if(_0x250a80[_0x9cb1('0x10')]){_0x250a80['extensions'][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':_0x250a80[_0x9cb1('0x10')][_0x9cb1('0x1f')]?_0x9cb1('0x24')+_0x250a80[_0x9cb1('0x10')][_0x9cb1('0x1f')]+'}':_0x9cb1('0x25'),'context':_0x1fc01c[_0xbf0f95][0x0]['context'],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')]});}_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0]['type'],'app':_0x9cb1('0x15'),'appdata':_0x9cb1('0x26')+_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')],'context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']});if(_0x250a80[_0x9cb1('0x10')]&&_0x250a80[_0x9cb1('0x10')][_0x9cb1('0x27')](_0x9cb1('0x28'))&&_0x250a80['extension'][_0x9cb1('0x28')]!=='none'){_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0]['type'],'app':_0x9cb1('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0]['exten'],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']});_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':_0x9cb1('0x29')+_0x250a80[_0x9cb1('0x10')][_0x9cb1('0x28')]||_0x9cb1('0x2a'),'context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0]['exten'],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')]});}}_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')]});_0x250a80['extensions'][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0]['type'],'app':_0x9cb1('0x15'),'appdata':_0x9cb1('0x2b'),'context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'priority':_0x250a80['priority']++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')]});_0x250a80['extensions'][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':_0x9cb1('0x2c'),'context':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x18')],'exten':_0x1fc01c[_0xbf0f95][0x0]['exten'],'priority':_0x250a80[_0x9cb1('0x19')]++,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')]});for(var _0x318fab=0x0,_0x41eb29=0x0;_0x318fab<_0x1fc01c[_0xbf0f95][_0x9cb1('0x2d')];_0x318fab+=0x1,_0x41eb29=0x0){var _0x5a619f=_0x1fc01c[_0xbf0f95][_0x318fab];if(_0x5a619f[_0x9cb1('0x14')]){_0x5a619f[_0x9cb1('0x14')]=_0x5a619f[_0x9cb1('0x14')]['toLowerCase']();}var _0x597d35=[];var _0x489d52=[];delete _0x5a619f['id'];delete _0x5a619f['createdAt'];delete _0x5a619f[_0x9cb1('0x2e')];var _0x37a77a=_0x5a619f[_0x9cb1('0x2f')]!==_0x9cb1('0x30')?[_0x5a619f[_0x9cb1('0x2f')]]:_0x5a619f['IntervalId']?_[_0x9cb1('0x9')](_[_0x9cb1('0xc')](_0x250a80[_0x9cb1('0x5')],{'IntervalId':_0x5a619f[_0x9cb1('0x7')]}),'interval'):[];if(_0x5a619f[_0x9cb1('0x27')](_0x9cb1('0x31'))){if(_0x5a619f[_0x9cb1('0x31')]&&_0x5a619f[_0x9cb1('0x31')]!=='--'){_0x597d35[_0x9cb1('0x13')]({'type':_0x5a619f[_0x9cb1('0x14')],'app':_0x9cb1('0x15'),'appdata':'CDR(tag)='+_0x5a619f[_0x9cb1('0x31')],'context':_0x5a619f[_0x9cb1('0x18')],'exten':_0x5a619f[_0x9cb1('0xa')],'priority':_0x37a77a['length']+_0x250a80[_0x9cb1('0x19')]+_0x41eb29++,'VoiceExtensionId':_0x5a619f[_0x9cb1('0x1a')]});}}if(_0x5a619f[_0x9cb1('0x14')]===_0x9cb1('0x1d')&&_0x5a619f[_0x9cb1('0x27')](_0x9cb1('0x32'))){if(_0x5a619f[_0x9cb1('0x32')]){_0x597d35[_0x9cb1('0x13')]({'type':_0x5a619f[_0x9cb1('0x14')],'app':_0x9cb1('0x22'),'appdata':_0x9cb1('0x33')+_0x5a619f['callerID']+')','context':_0x5a619f['context'],'exten':_0x5a619f['exten'],'priority':_0x37a77a[_0x9cb1('0x2d')]+_0x250a80['priority']+_0x41eb29++,'VoiceExtensionId':_0x5a619f['VoiceExtensionId']});}else{_0x597d35[_0x9cb1('0x13')]({'type':_0x5a619f['type'],'app':_0x9cb1('0x22'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5a619f[_0x9cb1('0x18')],'exten':_0x5a619f[_0x9cb1('0xa')],'priority':_0x37a77a['length']+_0x250a80[_0x9cb1('0x19')]+_0x41eb29++,'VoiceExtensionId':_0x5a619f[_0x9cb1('0x1a')]});}}if(_0x5a619f[_0x9cb1('0x27')](_0x9cb1('0x34'))){if(_0x1c33f9[_0x9cb1('0x35')](_0x5a619f['app'][_0x9cb1('0x36')]())>=0x0&&_0x5a619f[_0x9cb1('0x37')]!=='custom'){if(_0x5a619f[_0x9cb1('0x34')]){_0x597d35['push']({'type':_0x5a619f[_0x9cb1('0x14')],'app':_0x9cb1('0x22'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5a619f[_0x9cb1('0x18')],'exten':_0x5a619f[_0x9cb1('0xa')],'priority':_0x37a77a['length']+_0x250a80[_0x9cb1('0x19')]+_0x41eb29++,'VoiceExtensionId':_0x5a619f[_0x9cb1('0x1a')]});_0x597d35[_0x9cb1('0x13')]({'type':_0x5a619f[_0x9cb1('0x14')],'app':'Set','appdata':_0x9cb1('0x38'),'context':_0x5a619f[_0x9cb1('0x18')],'exten':_0x5a619f[_0x9cb1('0xa')],'priority':_0x37a77a[_0x9cb1('0x2d')]+_0x250a80['priority']+_0x41eb29++,'VoiceExtensionId':_0x5a619f[_0x9cb1('0x1a')]});}else{_0x597d35[_0x9cb1('0x13')]({'type':_0x5a619f[_0x9cb1('0x14')],'app':'ExecIf','appdata':_0x9cb1('0x39'),'context':_0x5a619f['context'],'exten':_0x5a619f[_0x9cb1('0xa')],'priority':_0x37a77a['length']+_0x250a80[_0x9cb1('0x19')]+_0x41eb29++,'VoiceExtensionId':_0x5a619f[_0x9cb1('0x1a')]});_0x597d35[_0x9cb1('0x13')]({'type':_0x5a619f[_0x9cb1('0x14')],'app':'Set','appdata':_0x9cb1('0x3a'),'context':_0x5a619f[_0x9cb1('0x18')],'exten':_0x5a619f[_0x9cb1('0xa')],'priority':_0x37a77a[_0x9cb1('0x2d')]+_0x250a80[_0x9cb1('0x19')]+_0x41eb29++,'VoiceExtensionId':_0x5a619f[_0x9cb1('0x1a')]});}}}for(var _0x1a89df=0x0;_0x1a89df<_0x37a77a[_0x9cb1('0x2d')];_0x1a89df+=0x1){var _0x52bd25=_0x250a80[_0x9cb1('0x19')]+_0x37a77a['length'];var _0x2e3a0c=_0x1a89df===_0x37a77a['length']-0x1?_0x250a80['priority']+_0x597d35[_0x9cb1('0x2d')]+_0x489d52[_0x9cb1('0x2d')]+0x2:_0x250a80[_0x9cb1('0x19')]+_0x1a89df+0x1;_0x597d35[_0x9cb1('0x3b')](_0x1a89df,0x0,{'type':_0x5a619f[_0x9cb1('0x14')],'app':_0x9cb1('0x3c'),'appdata':_0x37a77a[_0x1a89df]+'?'+_0x5a619f[_0x9cb1('0x18')]+_0x9cb1('0x3d')+_0x52bd25+':'+_0x5a619f['context']+',${EXTEN},'+_0x2e3a0c,'exten':_0x5a619f[_0x9cb1('0xa')],'context':_0x5a619f['context'],'priority':_0x250a80[_0x9cb1('0x19')]+_0x1a89df,'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']});}_0x5a619f[_0x9cb1('0x19')]=_0x597d35[_0x9cb1('0x2d')]?_['last'](_0x597d35)[_0x9cb1('0x19')]+0x1:_0x250a80['priority'];_0x250a80[_0x9cb1('0x19')]=(_0x489d52['length']?_[_0x9cb1('0x3e')](_0x489d52)[_0x9cb1('0x19')]:_0x5a619f[_0x9cb1('0x19')])+0x1;_0x250a80['extensions']=_[_0x9cb1('0x3f')](_0x250a80[_0x9cb1('0x12')],_0x597d35,[_0x5a619f],_0x489d52);}_0x250a80[_0x9cb1('0x12')][_0x9cb1('0x13')]({'type':_0x1fc01c[_0xbf0f95][0x0]['type'],'app':_0x9cb1('0x40'),'exten':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0xa')],'context':_0x1fc01c[_0xbf0f95][0x0]['context'],'priority':_0x250a80[_0x9cb1('0x19')],'VoiceExtensionId':_0x1fc01c[_0xbf0f95][0x0][_0x9cb1('0x1a')]});_0x61ab7a[_0x9cb1('0x13')](_0x1fc01c[_0xbf0f95][0x0]['VoiceExtensionId']);_0x3f647=_['concat'](_0x3f647,_0x250a80[_0x9cb1('0x12')]);}}return _0x22ea96[_0x9cb1('0x41')](function(_0x4bf037){return _0x22ea96[_0x9cb1('0x2')][_0x9cb1('0x6')][_0x9cb1('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x61ab7a}},'transaction':_0x4bf037})[_0x9cb1('0x4')](function(_0x23115b){return _0x22ea96[_0x9cb1('0x2')][_0x9cb1('0x6')][_0x9cb1('0x43')](_['sortBy'](_0x3f647,_0x9cb1('0x19')),{'transaction':_0x4bf037});});});})[_0x9cb1('0x44')](function(_0x5e32ca){console[_0x9cb1('0x45')](_0x5e32ca);});}exports[_0x9cb1('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index a7f0eb7..c701746 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcb8=['resolve','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','firstName','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','create','keys','then','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','fromQuery','calleridnum','cm_hopper_final','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','VoiceQueueId','query','catch','all','BlackLists','Campaign','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume'];(function(_0x35c579,_0x4c40ca){var _0x2eb742=function(_0x43649f){while(--_0x43649f){_0x35c579['push'](_0x35c579['shift']());}};_0x2eb742(++_0x4c40ca);}(_0xfcb8,0x151));var _0x8fcb=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xfcb8[_0x3df9dd];return _0x4f11e4;};'use strict';var BPromise=require(_0x8fcb('0x0'));var util=require(_0x8fcb('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x8fcb('0x2'));var Papa=require(_0x8fcb('0x3'));var Redis=require('ioredis');var db=require(_0x8fcb('0x4'))['db'];var config=require(_0x8fcb('0x5'));var logger=require('../../../config/logger')(_0x8fcb('0x6'));config['redis']=_['defaults'](config[_0x8fcb('0x7')],{'host':_0x8fcb('0x8'),'port':0x18eb});var socket=require(_0x8fcb('0x9'))(new Redis(config[_0x8fcb('0x7')]));require(_0x8fcb('0xa'))[_0x8fcb('0xb')](socket);try{if(!process[_0x8fcb('0xc')][0x2]||process[_0x8fcb('0xc')][0x2]===_0x8fcb('0xd')||process[_0x8fcb('0xc')][0x2]===_0x8fcb('0xe')){throw new Error(_0x8fcb('0xf'));}var FILEPATH=process[_0x8fcb('0xc')][0x2];if(!process[_0x8fcb('0xc')][0x3]||process[_0x8fcb('0xc')][0x3]===_0x8fcb('0xd')||process[_0x8fcb('0xc')][0x3]===_0x8fcb('0xe')||!process[_0x8fcb('0xc')][0x4]||process[_0x8fcb('0xc')][0x4]===_0x8fcb('0xd')||process[_0x8fcb('0xc')][0x4]===_0x8fcb('0xe')){throw new Error(_0x8fcb('0x10'));}var FIELDS=_[_0x8fcb('0x11')](process['argv'][0x3]['split'](','),process[_0x8fcb('0xc')][0x4][_0x8fcb('0x12')](','));if(!process[_0x8fcb('0xc')][0x5]||process[_0x8fcb('0xc')][0x5]===_0x8fcb('0xd')||process[_0x8fcb('0xc')][0x5]==='null'){throw new Error(_0x8fcb('0x13'));}var LISTID=process[_0x8fcb('0xc')][0x5];var COMPANYID=process[_0x8fcb('0xc')][0x6]&&process[_0x8fcb('0xc')][0x6]!=='undefined'&&process[_0x8fcb('0xc')][0x6]!=='null'?process[_0x8fcb('0xc')][0x6]:null;var DUPLICATES=process[_0x8fcb('0xc')][0x7]&&process['argv'][0x7]!==_0x8fcb('0xd')&&process['argv'][0x7]!==_0x8fcb('0xe')?process['argv'][0x7]:null;if(!process[_0x8fcb('0xc')][0x8]||process[_0x8fcb('0xc')][0x8]===_0x8fcb('0xd')||process[_0x8fcb('0xc')][0x8]===_0x8fcb('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x8fcb('0xc')][0x8];}catch(_0x50f76b){logger[_0x8fcb('0x14')](_0x50f76b);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x33cad4,_0x199477,_0x2ca6d9,_0x4782f4){var _0x4bc271={'message':_0x199477};_0x4bc271[_0x33cad4]=!![];if(_0x2ca6d9){_0x4bc271[_0x8fcb('0x15')]=_0x2ca6d9;}if(_0x4782f4){_0x4bc271['index']=_0x4782f4;}return _0x4bc271;}function isEmail(_0x4c1926){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x8fcb('0x16')](_0x4c1926);}function checkRow(_0x14664d,_0x33cf79,_0x3d51a4){return new BPromise(function(_0x34e9ef,_0x44c0ae){if(_[_0x8fcb('0x17')](_0x14664d)){return _0x44c0ae(handleCheckRowError('error',_0x8fcb('0x18'),null,_0x3d51a4));}if(_0x14664d['errors']&&_0x14664d[_0x8fcb('0x19')][_0x8fcb('0x1a')]){var _0x25d209=_['map'](_0x14664d[_0x8fcb('0x19')],_0x8fcb('0x1b'))['join'](';');return _0x44c0ae(handleCheckRowError('error',_0x25d209,null,_0x3d51a4));}var _0x30620c={};for(var _0x53d27d in FIELDS){if(FIELDS[_0x8fcb('0x1c')](_0x53d27d)&&FIELDS[_0x53d27d]){_0x30620c[_0x53d27d]=_0x14664d[_0x8fcb('0x1d')][0x0][FIELDS[_0x53d27d]]||_0x14664d['data'][0x0]['\ufeff'+FIELDS[_0x53d27d]];}}if(!_0x30620c[_0x8fcb('0x1e')]){return _0x44c0ae(handleCheckRowError(_0x8fcb('0x14'),'firstName\x20not\x20specified!',null,_0x3d51a4));}if(!_0x30620c[_0x8fcb('0x1f')]){return _0x44c0ae(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x3d51a4));}if(_0x30620c[_0x8fcb('0x20')]){var _0x18406b=moment(_0x30620c[_0x8fcb('0x20')],'YYYY-MM-DD');if(!_0x18406b[_0x8fcb('0x21')]()){return _0x44c0ae(handleCheckRowError(_0x8fcb('0x14'),_0x8fcb('0x22'),null,_0x3d51a4));}}if(_0x30620c['email']){if(!isEmail(_0x30620c[_0x8fcb('0x23')])){return _0x44c0ae(handleCheckRowError(_0x8fcb('0x14'),_0x8fcb('0x24'),null,_0x3d51a4));}}_0x30620c[_0x8fcb('0x25')]=LISTID;_0x30620c[_0x8fcb('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8fcb('0x1a')]&&_0x33cf79){var _0x181255={};for(var _0x5e8ed9=0x0,_0x3b7740=DUPLICATES[_0x8fcb('0x1a')];_0x5e8ed9<_0x3b7740;_0x5e8ed9+=0x1){_0x181255[DUPLICATES[_0x5e8ed9]]=_0x30620c[DUPLICATES[_0x5e8ed9]];}var _0x53a9b8=_[_0x8fcb('0x27')](_0x33cf79,_0x181255);if(_0x53a9b8){return _0x44c0ae(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x53a9b8,_0x3d51a4));}}return db['CmContact'][_0x8fcb('0x28')](_0x30620c,{'raw':!![],'hooks':![],'fields':_[_0x8fcb('0x29')](_0x30620c)})[_0x8fcb('0x2a')](function(_0x35f251){if(DUPLICATES&&DUPLICATES[_0x8fcb('0x1a')]&&_0x33cf79){_0x33cf79['push'](_['pick'](_0x30620c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x35f251['id'];return _0x34e9ef();})['catch'](function(_0x5149cd){return _0x44c0ae(handleCheckRowError(_0x8fcb('0x14'),_0x8fcb('0x2b')+(_0x5149cd[_0x8fcb('0x1b')]||JSON[_0x8fcb('0x2c')](_0x5149cd)),null,_0x3d51a4));});});}function checkHopper(){function _0x4ca925(){return function(_0x9ec2ad){logger['error'](_0x8fcb('0x2d'),_0x8fcb('0x2e'),util['inspect'](_0x9ec2ad,{'showHidden':![],'depth':null}));};}var _0x31b292=function(_0x176978,_0x47d9a3){var _0x4623d3=squel['insert']()[_0x8fcb('0x2f')](_0x8fcb('0x30'))['fromQuery'](['phone',_0x8fcb('0x31'),_0x8fcb('0x32'),_0x8fcb('0x25'),_0x47d9a3,_0x8fcb('0x33'),_0x8fcb('0x34')],squel[_0x8fcb('0x35')]()[_0x8fcb('0x36')]('phone','phone')[_0x8fcb('0x36')](_0x8fcb('0x37'),'scheduledAt')[_0x8fcb('0x36')]('id','ContactId')[_0x8fcb('0x36')](LISTID[_0x8fcb('0x38')](),'ListId')[_0x8fcb('0x36')](_0x176978['id'][_0x8fcb('0x38')](),_0x47d9a3)[_0x8fcb('0x36')](_0x8fcb('0x37'),_0x8fcb('0x33'))[_0x8fcb('0x36')](_0x8fcb('0x37'),_0x8fcb('0x34'))[_0x8fcb('0x39')](_0x8fcb('0x3a'))[_0x8fcb('0x3b')](_0x8fcb('0x3c'))[_0x8fcb('0x3b')](_0x8fcb('0x3d'),LISTID[_0x8fcb('0x38')]())[_0x8fcb('0x3b')](_0x8fcb('0x3e'))['where'](_0x8fcb('0x3f'),squel['select']()[_0x8fcb('0x36')](_0x8fcb('0x1f'))[_0x8fcb('0x39')](_0x8fcb('0x30'))[_0x8fcb('0x3b')](_0x47d9a3+_0x8fcb('0x40'),_0x176978['id'][_0x8fcb('0x38')]())))['toString']();return _0x4623d3;};var _0xd81428=function(_0x5f1329,_0x46921d){var _0x113077=squel[_0x8fcb('0x41')]()[_0x8fcb('0x2f')](_0x8fcb('0x30'))[_0x8fcb('0x42')]([_0x8fcb('0x1f'),'scheduledAt',_0x8fcb('0x32'),'ListId',_0x46921d,_0x8fcb('0x33'),'updatedAt'],squel[_0x8fcb('0x35')]()[_0x8fcb('0x36')](_0x8fcb('0x1f'),_0x8fcb('0x1f'))[_0x8fcb('0x36')](_0x8fcb('0x37'),_0x8fcb('0x31'))[_0x8fcb('0x36')]('id','ContactId')['field'](LISTID[_0x8fcb('0x38')](),_0x8fcb('0x25'))[_0x8fcb('0x36')](_0x5f1329['id'][_0x8fcb('0x38')](),_0x46921d)[_0x8fcb('0x36')](_0x8fcb('0x37'),'createdAt')[_0x8fcb('0x36')]('NOW()',_0x8fcb('0x34'))[_0x8fcb('0x39')]('cm_contacts')[_0x8fcb('0x3b')]('deletedAt\x20IS\x20NULL')['where'](_0x8fcb('0x3d'),LISTID[_0x8fcb('0x38')]())[_0x8fcb('0x3b')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x8fcb('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x8fcb('0x3b')](_0x8fcb('0x3f'),squel[_0x8fcb('0x35')]()[_0x8fcb('0x36')](_0x8fcb('0x43'))['from'](_0x8fcb('0x44'))['where'](_0x46921d+_0x8fcb('0x40'),_0x5f1329['id'][_0x8fcb('0x38')]()))[_0x8fcb('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8fcb('0x35')]()[_0x8fcb('0x36')](_0x8fcb('0x1f'))['from'](_0x8fcb('0x30'))[_0x8fcb('0x3b')](_0x46921d+_0x8fcb('0x40'),_0x5f1329['id'][_0x8fcb('0x38')]())))['toString']();return _0x113077;};function _0x43004a(_0x15254b,_0x17cf1e){var _0x5b4218=squel[_0x8fcb('0x41')]()['into']('cm_hopper')[_0x8fcb('0x42')]([_0x8fcb('0x1f'),_0x8fcb('0x31'),_0x8fcb('0x32'),_0x8fcb('0x25'),_0x17cf1e,_0x8fcb('0x33'),_0x8fcb('0x34')],squel[_0x8fcb('0x35')]()[_0x8fcb('0x36')]('phone','phone')[_0x8fcb('0x36')](_0x8fcb('0x37'),_0x8fcb('0x31'))[_0x8fcb('0x36')]('id',_0x8fcb('0x32'))[_0x8fcb('0x36')](LISTID['toString'](),'ListId')[_0x8fcb('0x36')](_0x15254b['id'][_0x8fcb('0x38')](),_0x17cf1e)['field'](_0x8fcb('0x37'),'createdAt')[_0x8fcb('0x36')]('NOW()',_0x8fcb('0x34'))['from'](_0x8fcb('0x3a'))[_0x8fcb('0x3b')](_0x8fcb('0x3c'))[_0x8fcb('0x3b')](_0x8fcb('0x3d'),LISTID[_0x8fcb('0x38')]())[_0x8fcb('0x3b')](_0x8fcb('0x45'),squel[_0x8fcb('0x46')](hopperContacts))[_0x8fcb('0x3b')](_0x8fcb('0x3e')))[_0x8fcb('0x38')]();return _0x5b4218;}function _0x3f952d(_0x7c9847,_0x1cc143){var _0x41517c=squel[_0x8fcb('0x41')]()[_0x8fcb('0x2f')](_0x8fcb('0x47'))['fromQuery']([_0x8fcb('0x1f'),_0x8fcb('0x32'),_0x8fcb('0x25'),_0x1cc143,_0x8fcb('0x33'),_0x8fcb('0x34')],squel[_0x8fcb('0x35')]()['field']('phone','phone')[_0x8fcb('0x36')]('id','ContactId')[_0x8fcb('0x36')](LISTID[_0x8fcb('0x38')](),_0x8fcb('0x25'))[_0x8fcb('0x36')](_0x7c9847['id'][_0x8fcb('0x38')](),_0x1cc143)[_0x8fcb('0x36')]('NOW()','createdAt')[_0x8fcb('0x36')](_0x8fcb('0x37'),_0x8fcb('0x34'))[_0x8fcb('0x39')](_0x8fcb('0x3a'))[_0x8fcb('0x3b')](_0x8fcb('0x3c'))[_0x8fcb('0x3b')](_0x8fcb('0x3d'),LISTID['toString']())[_0x8fcb('0x3b')](_0x8fcb('0x45'),squel['str'](hopperContacts))[_0x8fcb('0x3b')](_0x8fcb('0x3e')))[_0x8fcb('0x38')]();return _0x41517c;}return db[_0x8fcb('0x48')][_0x8fcb('0x49')]({'where':{'type':_0x8fcb('0x4a')},'attributes':['id',_0x8fcb('0x4b')],'include':[{'model':db[_0x8fcb('0x4c')],'as':_0x8fcb('0x4d'),'where':{'id':LISTID}}]})[_0x8fcb('0x2a')](function(_0xa7c85f){var _0x113181=[];if(_0xa7c85f){var _0x409ced;for(var _0x235935=0x0,_0xf8014f;_0x235935<_0xa7c85f['length'];_0x235935+=0x1){_0xf8014f=_0xa7c85f[_0x235935][_0x8fcb('0x4e')]({'plain':!![]});switch(_0xf8014f[_0x8fcb('0x4b')]){case _0x8fcb('0x4f'):_0x113181[_0x8fcb('0x50')](db[_0x8fcb('0x51')]['query'](_0xd81428(_0xf8014f,_0x8fcb('0x52')))['then'](function(){})['catch'](_0x4ca925()));break;case'onlyIfOpen':_0x113181[_0x8fcb('0x50')](db[_0x8fcb('0x51')][_0x8fcb('0x53')](_0x31b292(_0xf8014f,_0x8fcb('0x52')))[_0x8fcb('0x2a')](function(){})[_0x8fcb('0x54')](_0x4ca925()));break;default:_0x113181['push'](db[_0x8fcb('0x51')][_0x8fcb('0x53')](_0x43004a(_0xf8014f,_0x8fcb('0x52')))[_0x8fcb('0x2a')](function(){})['catch'](_0x4ca925()));}}}return _0x113181;})[_0x8fcb('0x55')]()['then'](function(){return db[_0x8fcb('0x48')][_0x8fcb('0x49')]({'where':{'type':_0x8fcb('0x4a')},'attributes':['id'],'include':[{'model':db[_0x8fcb('0x4c')],'as':_0x8fcb('0x56'),'where':{'id':LISTID}}]})[_0x8fcb('0x2a')](function(_0x19103a){var _0x4ec90d=[];if(_0x19103a){var _0x4be561;for(var _0x4716cb=0x0,_0x1ad7b5;_0x4716cb<_0x19103a[_0x8fcb('0x1a')];_0x4716cb+=0x1){_0x1ad7b5=_0x19103a[_0x4716cb][_0x8fcb('0x4e')]({'plain':!![]});_0x4ec90d[_0x8fcb('0x50')](db[_0x8fcb('0x51')]['query'](_0x3f952d(_0x1ad7b5,_0x8fcb('0x52')))[_0x8fcb('0x2a')](function(){})[_0x8fcb('0x54')](_0x4ca925()));}}return _0x4ec90d;})[_0x8fcb('0x55')]();})[_0x8fcb('0x2a')](function(){return db[_0x8fcb('0x57')]['findAll']({'attributes':['id',_0x8fcb('0x4b')],'include':[{'model':db[_0x8fcb('0x4c')],'as':_0x8fcb('0x4d'),'where':{'id':LISTID}}]})[_0x8fcb('0x2a')](function(_0x1dabbe){var _0xc394d5=[];if(_0x1dabbe){for(var _0x24d3e6=0x0,_0x220ae3;_0x24d3e6<_0x1dabbe['length'];_0x24d3e6+=0x1){_0x220ae3=_0x1dabbe[_0x24d3e6][_0x8fcb('0x4e')]({'plain':!![]});switch(_0x220ae3[_0x8fcb('0x4b')]){case _0x8fcb('0x4f'):_0xc394d5[_0x8fcb('0x50')](db[_0x8fcb('0x51')][_0x8fcb('0x53')](_0xd81428(_0x220ae3,_0x8fcb('0x58')))[_0x8fcb('0x2a')](function(){})[_0x8fcb('0x54')](_0x4ca925()));break;case _0x8fcb('0x59'):_0xc394d5[_0x8fcb('0x50')](db[_0x8fcb('0x51')][_0x8fcb('0x53')](_0x31b292(_0x220ae3,_0x8fcb('0x58')))[_0x8fcb('0x2a')](function(){})[_0x8fcb('0x54')](_0x4ca925()));break;default:_0xc394d5[_0x8fcb('0x50')](db[_0x8fcb('0x51')][_0x8fcb('0x53')](_0x43004a(_0x220ae3,_0x8fcb('0x58')))[_0x8fcb('0x2a')](function(){})[_0x8fcb('0x54')](_0x4ca925()));}}}return _0xc394d5;})[_0x8fcb('0x55')]();})[_0x8fcb('0x2a')](function(){return db[_0x8fcb('0x57')][_0x8fcb('0x49')]({'attributes':['id'],'include':[{'model':db[_0x8fcb('0x4c')],'as':_0x8fcb('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x29c488){var _0x2d1b92=[];if(_0x29c488){for(var _0x2fadca=0x0,_0x3441df;_0x2fadca<_0x29c488[_0x8fcb('0x1a')];_0x2fadca+=0x1){_0x3441df=_0x29c488[_0x2fadca][_0x8fcb('0x4e')]({'plain':!![]});_0x2d1b92[_0x8fcb('0x50')](db[_0x8fcb('0x51')]['query'](_0x3f952d(_0x3441df,_0x8fcb('0x58')))['then'](function(){})[_0x8fcb('0x54')](_0x4ca925()));}}return _0x2d1b92;})[_0x8fcb('0x55')]();})[_0x8fcb('0x54')](function(_0x23d501){logger['error']('cmContact,\x20%s,\x20%s',_0x8fcb('0x5a'),_0x23d501[_0x8fcb('0x1b')]);});}var processPromises=function(_0x59e5f3){return BPromise['all'](promises)[_0x8fcb('0x2a')](function(_0x579558){})['catch'](function(_0x2a37d5){logger['error'](_0x8fcb('0x5b'),JSON[_0x8fcb('0x2c')](_0x2a37d5));})[_0x8fcb('0x5c')](function(){socket[_0x8fcb('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x59e5f3){return _0x59e5f3[_0x8fcb('0x5e')]();}});};var endCsv=function(){return BPromise[_0x8fcb('0x5f')]()[_0x8fcb('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x8fcb('0x2a')](function(){socket['emit'](_0x8fcb('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2f67b2){logger['error'](_0x8fcb('0x61'),JSON[_0x8fcb('0x2c')](_0x2f67b2));}finally{process['exit'](0x0);}});};process['on'](_0x8fcb('0x62'),function(){logger[_0x8fcb('0x63')](_0x8fcb('0x64'));endCsv();});function main(){return BPromise['resolve']()[_0x8fcb('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8fcb('0x12')](',');return db[_0x8fcb('0x65')][_0x8fcb('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8fcb('0x2a')](function(_0x2240c0){var _0x404aca=fs[_0x8fcb('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x404aca,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1646f5,_0xa7d402){total+=0x1;var _0xd5020c=total;promises['push'](checkRow(_0x1646f5,_0x2240c0,_0xd5020c)[_0x8fcb('0x2a')](function(){success+=0x1;})[_0x8fcb('0x54')](function(_0x901da3){if(_0x901da3[_0x8fcb('0x14')]){errors+=0x1;delete _0x901da3[_0x8fcb('0x14')];}else if(_0x901da3['duplicate']){duplicates+=0x1;delete _0x901da3[_0x8fcb('0x67')];}rows['push'](_0x901da3);}));if(total%0xc8===0x0){_0xa7d402[_0x8fcb('0x68')]();return processPromises(_0xa7d402);}},'complete':function(){return processPromises()[_0x8fcb('0x2a')](function(){logger[_0x8fcb('0x63')](_0x8fcb('0x69'));endCsv();});},'error':function(_0x24ccb8,_0x569286){logger[_0x8fcb('0x63')](_0x8fcb('0x6a'),JSON[_0x8fcb('0x2c')](_0x24ccb8));endCsv();}});})[_0x8fcb('0x54')](function(_0x391552){logger[_0x8fcb('0x14')](_0x8fcb('0x6b'),JSON[_0x8fcb('0x2c')](_0x391552));});}main(); \ No newline at end of file +var _0xde8c=['Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','CSV\x20import\x20process\x20stopped!','parse','pause','info','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','../../../mysqldb','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','errors','message','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','keys','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','into','fromQuery','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','sequelize','query','catch','onlyIfOpen','push','CmList','BlackLists','VoiceQueueId','all'];(function(_0x35e46b,_0x3716c6){var _0xac2336=function(_0x297bbc){while(--_0x297bbc){_0x35e46b['push'](_0x35e46b['shift']());}};_0xac2336(++_0x3716c6);}(_0xde8c,0x1a4));var _0xcde8=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xde8c[_0x3afe18];return _0x19ed1f;};'use strict';var BPromise=require(_0xcde8('0x0'));var util=require(_0xcde8('0x1'));var _=require(_0xcde8('0x2'));var fs=require('fs');var squel=require(_0xcde8('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xcde8('0x4'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xcde8('0x5'));config[_0xcde8('0x6')]=_['defaults'](config[_0xcde8('0x6')],{'host':_0xcde8('0x7'),'port':0x18eb});var socket=require(_0xcde8('0x8'))(new Redis(config[_0xcde8('0x6')]));require(_0xcde8('0x9'))['register'](socket);try{if(!process[_0xcde8('0xa')][0x2]||process[_0xcde8('0xa')][0x2]===_0xcde8('0xb')||process['argv'][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xcde8('0xa')][0x2];if(!process[_0xcde8('0xa')][0x3]||process[_0xcde8('0xa')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process['argv'][0x4]===_0xcde8('0xb')||process[_0xcde8('0xa')][0x4]===_0xcde8('0xc')){throw new Error(_0xcde8('0xd'));}var FIELDS=_[_0xcde8('0xe')](process[_0xcde8('0xa')][0x3][_0xcde8('0xf')](','),process[_0xcde8('0xa')][0x4][_0xcde8('0xf')](','));if(!process[_0xcde8('0xa')][0x5]||process[_0xcde8('0xa')][0x5]===_0xcde8('0xb')||process[_0xcde8('0xa')][0x5]==='null'){throw new Error(_0xcde8('0x10'));}var LISTID=process[_0xcde8('0xa')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0xcde8('0xb')&&process[_0xcde8('0xa')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xcde8('0xa')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xcde8('0xa')][0x7]!==_0xcde8('0xc')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xcde8('0xa')][0x8]==='undefined'||process[_0xcde8('0xa')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xcde8('0xa')][0x8];}catch(_0x1c5711){logger[_0xcde8('0x11')](_0x1c5711);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x56dd21,_0x5cb5e5,_0x1698c4,_0x2c11ed){var _0x16f35a={'message':_0x5cb5e5};_0x16f35a[_0x56dd21]=!![];if(_0x1698c4){_0x16f35a[_0xcde8('0x12')]=_0x1698c4;}if(_0x2c11ed){_0x16f35a[_0xcde8('0x13')]=_0x2c11ed;}return _0x16f35a;}function isEmail(_0x4e963f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4e963f);}function checkRow(_0x55315c,_0xcca011,_0x4a3a04){return new BPromise(function(_0x3674f1,_0x1a3e13){if(_[_0xcde8('0x14')](_0x55315c)){return _0x1a3e13(handleCheckRowError('error',_0xcde8('0x15'),null,_0x4a3a04));}if(_0x55315c['errors']&&_0x55315c['errors'][_0xcde8('0x16')]){var _0x1aecf5=_['map'](_0x55315c[_0xcde8('0x17')],_0xcde8('0x18'))['join'](';');return _0x1a3e13(handleCheckRowError(_0xcde8('0x11'),_0x1aecf5,null,_0x4a3a04));}var _0x4aab7d={};for(var _0x3b3e09 in FIELDS){if(FIELDS[_0xcde8('0x19')](_0x3b3e09)&&FIELDS[_0x3b3e09]){_0x4aab7d[_0x3b3e09]=_0x55315c['data'][0x0][FIELDS[_0x3b3e09]]||_0x55315c['data'][0x0]['\ufeff'+FIELDS[_0x3b3e09]];}}if(!_0x4aab7d[_0xcde8('0x1a')]){return _0x1a3e13(handleCheckRowError('error',_0xcde8('0x1b'),null,_0x4a3a04));}if(!_0x4aab7d[_0xcde8('0x1c')]){return _0x1a3e13(handleCheckRowError(_0xcde8('0x11'),'phone\x20not\x20specified!',null,_0x4a3a04));}if(_0x4aab7d[_0xcde8('0x1d')]){var _0xa59a6a=moment(_0x4aab7d['birthDate'],_0xcde8('0x1e'));if(!_0xa59a6a[_0xcde8('0x1f')]()){return _0x1a3e13(handleCheckRowError(_0xcde8('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a3a04));}}if(_0x4aab7d[_0xcde8('0x20')]){if(!isEmail(_0x4aab7d[_0xcde8('0x20')])){return _0x1a3e13(handleCheckRowError(_0xcde8('0x11'),_0xcde8('0x21'),null,_0x4a3a04));}}_0x4aab7d[_0xcde8('0x22')]=LISTID;_0x4aab7d[_0xcde8('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xcca011){var _0x1feb07={};for(var _0x3a2371=0x0,_0x5951d9=DUPLICATES[_0xcde8('0x16')];_0x3a2371<_0x5951d9;_0x3a2371+=0x1){_0x1feb07[DUPLICATES[_0x3a2371]]=_0x4aab7d[DUPLICATES[_0x3a2371]];}var _0x29412f=_[_0xcde8('0x24')](_0xcca011,_0x1feb07);if(_0x29412f){return _0x1a3e13(handleCheckRowError(_0xcde8('0x25'),'Duplicate\x20Contact',_0x29412f,_0x4a3a04));}}return db[_0xcde8('0x26')]['create'](_0x4aab7d,{'raw':!![],'hooks':![],'fields':_[_0xcde8('0x27')](_0x4aab7d)})['then'](function(_0x14c525){if(DUPLICATES&&DUPLICATES[_0xcde8('0x16')]&&_0xcca011){_0xcca011['push'](_[_0xcde8('0x28')](_0x4aab7d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x14c525['id'];return _0x3674f1();})['catch'](function(_0x3e4e42){return _0x1a3e13(handleCheckRowError('error',_0xcde8('0x29')+(_0x3e4e42[_0xcde8('0x18')]||JSON[_0xcde8('0x2a')](_0x3e4e42)),null,_0x4a3a04));});});}function checkHopper(){function _0x4e35f6(){return function(_0x5c2623){logger[_0xcde8('0x11')](_0xcde8('0x2b'),'checkHopper',util[_0xcde8('0x2c')](_0x5c2623,{'showHidden':![],'depth':null}));};}var _0x3bbc01=function(_0x2c02ec,_0x3d93d0){var _0x444bcb=squel[_0xcde8('0x2d')]()['into'](_0xcde8('0x2e'))['fromQuery']([_0xcde8('0x1c'),_0xcde8('0x2f'),_0xcde8('0x30'),'ListId',_0x3d93d0,_0xcde8('0x31'),_0xcde8('0x32')],squel[_0xcde8('0x33')]()[_0xcde8('0x34')](_0xcde8('0x1c'),_0xcde8('0x1c'))['field']('NOW()','scheduledAt')[_0xcde8('0x34')]('id',_0xcde8('0x30'))[_0xcde8('0x34')](LISTID[_0xcde8('0x35')](),_0xcde8('0x22'))['field'](_0x2c02ec['id'][_0xcde8('0x35')](),_0x3d93d0)[_0xcde8('0x34')](_0xcde8('0x36'),_0xcde8('0x31'))[_0xcde8('0x34')]('NOW()',_0xcde8('0x32'))[_0xcde8('0x37')](_0xcde8('0x38'))[_0xcde8('0x39')]('deletedAt\x20IS\x20NULL')[_0xcde8('0x39')](_0xcde8('0x3a'),LISTID[_0xcde8('0x35')]())[_0xcde8('0x39')](_0xcde8('0x3b'))[_0xcde8('0x39')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xcde8('0x1c'))[_0xcde8('0x37')](_0xcde8('0x2e'))['where'](_0x3d93d0+_0xcde8('0x3c'),_0x2c02ec['id']['toString']())))[_0xcde8('0x35')]();return _0x444bcb;};var _0x4d5a31=function(_0x44f260,_0x5f56b6){var _0x1e9e19=squel['insert']()[_0xcde8('0x3d')]('cm_hopper')[_0xcde8('0x3e')]([_0xcde8('0x1c'),'scheduledAt',_0xcde8('0x30'),_0xcde8('0x22'),_0x5f56b6,_0xcde8('0x31'),_0xcde8('0x32')],squel[_0xcde8('0x33')]()[_0xcde8('0x34')](_0xcde8('0x1c'),_0xcde8('0x1c'))[_0xcde8('0x34')](_0xcde8('0x36'),_0xcde8('0x2f'))[_0xcde8('0x34')]('id',_0xcde8('0x30'))[_0xcde8('0x34')](LISTID[_0xcde8('0x35')](),_0xcde8('0x22'))[_0xcde8('0x34')](_0x44f260['id'][_0xcde8('0x35')](),_0x5f56b6)[_0xcde8('0x34')](_0xcde8('0x36'),_0xcde8('0x31'))[_0xcde8('0x34')](_0xcde8('0x36'),_0xcde8('0x32'))['from']('cm_contacts')[_0xcde8('0x39')](_0xcde8('0x3f'))['where'](_0xcde8('0x3a'),LISTID[_0xcde8('0x35')]())[_0xcde8('0x39')](_0xcde8('0x40'),squel[_0xcde8('0x41')](hopperContacts))['where'](_0xcde8('0x3b'))[_0xcde8('0x39')](_0xcde8('0x42'),squel[_0xcde8('0x33')]()[_0xcde8('0x34')](_0xcde8('0x43'))[_0xcde8('0x37')]('cm_hopper_final')[_0xcde8('0x39')](_0x5f56b6+_0xcde8('0x3c'),_0x44f260['id']['toString']()))[_0xcde8('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcde8('0x33')]()[_0xcde8('0x34')]('phone')['from'](_0xcde8('0x2e'))['where'](_0x5f56b6+_0xcde8('0x3c'),_0x44f260['id'][_0xcde8('0x35')]())))[_0xcde8('0x35')]();return _0x1e9e19;};function _0x23921b(_0xe6d6c2,_0x5b292d){var _0x1b2243=squel[_0xcde8('0x2d')]()[_0xcde8('0x3d')](_0xcde8('0x2e'))[_0xcde8('0x3e')]([_0xcde8('0x1c'),'scheduledAt',_0xcde8('0x30'),_0xcde8('0x22'),_0x5b292d,_0xcde8('0x31'),'updatedAt'],squel[_0xcde8('0x33')]()[_0xcde8('0x34')](_0xcde8('0x1c'),_0xcde8('0x1c'))['field'](_0xcde8('0x36'),_0xcde8('0x2f'))['field']('id',_0xcde8('0x30'))[_0xcde8('0x34')](LISTID[_0xcde8('0x35')](),'ListId')[_0xcde8('0x34')](_0xe6d6c2['id']['toString'](),_0x5b292d)[_0xcde8('0x34')]('NOW()',_0xcde8('0x31'))[_0xcde8('0x34')](_0xcde8('0x36'),'updatedAt')['from'](_0xcde8('0x38'))[_0xcde8('0x39')](_0xcde8('0x3f'))[_0xcde8('0x39')](_0xcde8('0x3a'),LISTID[_0xcde8('0x35')]())[_0xcde8('0x39')](_0xcde8('0x40'),squel[_0xcde8('0x41')](hopperContacts))[_0xcde8('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xcde8('0x35')]();return _0x1b2243;}function _0x45fd03(_0x2b80d5,_0x1e6774){var _0x2253d9=squel[_0xcde8('0x2d')]()[_0xcde8('0x3d')](_0xcde8('0x44'))[_0xcde8('0x3e')]([_0xcde8('0x1c'),_0xcde8('0x30'),'ListId',_0x1e6774,_0xcde8('0x31'),_0xcde8('0x32')],squel[_0xcde8('0x33')]()[_0xcde8('0x34')](_0xcde8('0x1c'),'phone')[_0xcde8('0x34')]('id','ContactId')['field'](LISTID['toString'](),_0xcde8('0x22'))[_0xcde8('0x34')](_0x2b80d5['id']['toString'](),_0x1e6774)[_0xcde8('0x34')]('NOW()',_0xcde8('0x31'))[_0xcde8('0x34')](_0xcde8('0x36'),_0xcde8('0x32'))['from']('cm_contacts')[_0xcde8('0x39')](_0xcde8('0x3f'))[_0xcde8('0x39')](_0xcde8('0x3a'),LISTID[_0xcde8('0x35')]())[_0xcde8('0x39')](_0xcde8('0x40'),squel[_0xcde8('0x41')](hopperContacts))[_0xcde8('0x39')](_0xcde8('0x3b')))[_0xcde8('0x35')]();return _0x2253d9;}return db[_0xcde8('0x45')][_0xcde8('0x46')]({'where':{'type':_0xcde8('0x47')},'attributes':['id',_0xcde8('0x48')],'include':[{'model':db['CmList'],'as':_0xcde8('0x49'),'where':{'id':LISTID}}]})[_0xcde8('0x4a')](function(_0x152e20){var _0x3177b0=[];if(_0x152e20){var _0x1837ab;for(var _0x12305e=0x0,_0x54b52b;_0x12305e<_0x152e20[_0xcde8('0x16')];_0x12305e+=0x1){_0x54b52b=_0x152e20[_0x12305e][_0xcde8('0x4b')]({'plain':!![]});switch(_0x54b52b[_0xcde8('0x48')]){case'always':_0x3177b0['push'](db[_0xcde8('0x4c')][_0xcde8('0x4d')](_0x4d5a31(_0x54b52b,'VoiceQueueId'))['then'](function(){})[_0xcde8('0x4e')](_0x4e35f6()));break;case _0xcde8('0x4f'):_0x3177b0[_0xcde8('0x50')](db[_0xcde8('0x4c')]['query'](_0x3bbc01(_0x54b52b,'VoiceQueueId'))[_0xcde8('0x4a')](function(){})['catch'](_0x4e35f6()));break;default:_0x3177b0[_0xcde8('0x50')](db['sequelize']['query'](_0x23921b(_0x54b52b,'VoiceQueueId'))['then'](function(){})['catch'](_0x4e35f6()));}}}return _0x3177b0;})['all']()[_0xcde8('0x4a')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0xcde8('0x47')},'attributes':['id'],'include':[{'model':db[_0xcde8('0x51')],'as':_0xcde8('0x52'),'where':{'id':LISTID}}]})[_0xcde8('0x4a')](function(_0x2fd7ad){var _0x55bd36=[];if(_0x2fd7ad){var _0x333e58;for(var _0x492810=0x0,_0x165bc0;_0x492810<_0x2fd7ad[_0xcde8('0x16')];_0x492810+=0x1){_0x165bc0=_0x2fd7ad[_0x492810][_0xcde8('0x4b')]({'plain':!![]});_0x55bd36['push'](db[_0xcde8('0x4c')][_0xcde8('0x4d')](_0x45fd03(_0x165bc0,_0xcde8('0x53')))[_0xcde8('0x4a')](function(){})[_0xcde8('0x4e')](_0x4e35f6()));}}return _0x55bd36;})[_0xcde8('0x54')]();})['then'](function(){return db[_0xcde8('0x55')]['findAll']({'attributes':['id',_0xcde8('0x48')],'include':[{'model':db['CmList'],'as':_0xcde8('0x49'),'where':{'id':LISTID}}]})['then'](function(_0x4e8171){var _0x340f21=[];if(_0x4e8171){for(var _0x53fdf0=0x0,_0x37be09;_0x53fdf0<_0x4e8171[_0xcde8('0x16')];_0x53fdf0+=0x1){_0x37be09=_0x4e8171[_0x53fdf0][_0xcde8('0x4b')]({'plain':!![]});switch(_0x37be09[_0xcde8('0x48')]){case _0xcde8('0x56'):_0x340f21[_0xcde8('0x50')](db[_0xcde8('0x4c')][_0xcde8('0x4d')](_0x4d5a31(_0x37be09,_0xcde8('0x57')))[_0xcde8('0x4a')](function(){})[_0xcde8('0x4e')](_0x4e35f6()));break;case _0xcde8('0x4f'):_0x340f21[_0xcde8('0x50')](db[_0xcde8('0x4c')][_0xcde8('0x4d')](_0x3bbc01(_0x37be09,_0xcde8('0x57')))['then'](function(){})[_0xcde8('0x4e')](_0x4e35f6()));break;default:_0x340f21[_0xcde8('0x50')](db[_0xcde8('0x4c')][_0xcde8('0x4d')](_0x23921b(_0x37be09,_0xcde8('0x57')))[_0xcde8('0x4a')](function(){})[_0xcde8('0x4e')](_0x4e35f6()));}}}return _0x340f21;})[_0xcde8('0x54')]();})[_0xcde8('0x4a')](function(){return db[_0xcde8('0x55')][_0xcde8('0x46')]({'attributes':['id'],'include':[{'model':db[_0xcde8('0x51')],'as':_0xcde8('0x52'),'where':{'id':LISTID}}]})[_0xcde8('0x4a')](function(_0x5bfeab){var _0x4e26d8=[];if(_0x5bfeab){for(var _0x466d07=0x0,_0x4a310b;_0x466d07<_0x5bfeab[_0xcde8('0x16')];_0x466d07+=0x1){_0x4a310b=_0x5bfeab[_0x466d07][_0xcde8('0x4b')]({'plain':!![]});_0x4e26d8[_0xcde8('0x50')](db['sequelize']['query'](_0x45fd03(_0x4a310b,_0xcde8('0x57')))[_0xcde8('0x4a')](function(){})[_0xcde8('0x4e')](_0x4e35f6()));}}return _0x4e26d8;})[_0xcde8('0x54')]();})['catch'](function(_0x1c5d1a){logger[_0xcde8('0x11')](_0xcde8('0x58'),'generalCheckHopper',_0x1c5d1a[_0xcde8('0x18')]);});}var processPromises=function(_0x1f8d8f){return BPromise[_0xcde8('0x54')](promises)['then'](function(_0x4070de){})[_0xcde8('0x4e')](function(_0x3d2f58){logger['error'](_0xcde8('0x59'),JSON['stringify'](_0x3d2f58));})[_0xcde8('0x5a')](function(){socket[_0xcde8('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1f8d8f){return _0x1f8d8f[_0xcde8('0x5c')]();}});};var endCsv=function(){return BPromise[_0xcde8('0x5d')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xcde8('0x5e')](FILEPATH);}catch(_0x3e0de5){logger[_0xcde8('0x11')](_0xcde8('0x5f'),JSON[_0xcde8('0x2a')](_0x3e0de5));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xcde8('0x60'));endCsv();});function main(){return BPromise['resolve']()[_0xcde8('0x4a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xcde8('0xf')](',');return db[_0xcde8('0x26')][_0xcde8('0x46')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2d7b47){var _0x296c1d=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xcde8('0x61')](_0x296c1d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x22e721,_0x4ab451){total+=0x1;var _0xd396d8=total;promises[_0xcde8('0x50')](checkRow(_0x22e721,_0x2d7b47,_0xd396d8)['then'](function(){success+=0x1;})[_0xcde8('0x4e')](function(_0xe2fa8d){if(_0xe2fa8d[_0xcde8('0x11')]){errors+=0x1;delete _0xe2fa8d[_0xcde8('0x11')];}else if(_0xe2fa8d[_0xcde8('0x25')]){duplicates+=0x1;delete _0xe2fa8d[_0xcde8('0x25')];}rows['push'](_0xe2fa8d);}));if(total%0xc8===0x0){_0x4ab451[_0xcde8('0x62')]();return processPromises(_0x4ab451);}},'complete':function(){return processPromises()[_0xcde8('0x4a')](function(){logger[_0xcde8('0x63')](_0xcde8('0x64'));endCsv();});},'error':function(_0x1f1e20,_0x52e323){logger[_0xcde8('0x63')]('CSV\x20parse\x20error',JSON[_0xcde8('0x2a')](_0x1f1e20));endCsv();}});})[_0xcde8('0x4e')](function(_0x1243c7){logger[_0xcde8('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xcde8('0x2a')](_0x1243c7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 44c2ae7..26c04f4 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2df=['campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','affectedRows','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','../../../mysqldb','../../../config/environment','../../../config/environment/shared','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','from','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','then','length','push','all','split','filter','CmContactHasItem','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','fromQuery','phone','ListId','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','UserId','\x22onlyIfOpen\x22','\x20=\x20','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','errors','code','message','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','timezones','isNil','utcOffset','set','offset','dialTimezone','main','send','start','binding','clone','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','data','rows','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists'];(function(_0x35f424,_0x393848){var _0x3a96cd=function(_0x48a20d){while(--_0x48a20d){_0x35f424['push'](_0x35f424['shift']());}};_0x3a96cd(++_0x393848);}(_0xd2df,0x175));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xfd2d('0x0'));var _=require(_0xfd2d('0x1'));var Papa=require(_0xfd2d('0x2'));var util=require(_0xfd2d('0x3'));var BPromise=require(_0xfd2d('0x4'));var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0xfd2d('0x5'))['db'];var config=require(_0xfd2d('0x6'));var shared=require(_0xfd2d('0x7'));var logger=require('../../../config/logger')('import');config['redis']=_[_0xfd2d('0x8')](config[_0xfd2d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd2d('0xa'))(new Redis(config[_0xfd2d('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xfd2d('0xb')](_0xfd2d('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xfd2d('0xb')](_0xfd2d('0xc'));function isEmail(_0x475c75){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xfd2d('0xd')](_0x475c75);}function selectNotIn(_0x199ccf,_0x5b52d5,_0x2830e1,_0xfb6647,_0x2fde52){return squel[_0xfd2d('0xe')]()['field']('phone')[_0xfd2d('0xf')](_0xfb6647)[_0xfd2d('0x10')](_0x5b52d5,null,_0x5b52d5+_0xfd2d('0x11')+_0xfb6647+'.'+_0x2830e1)['where'](_0xfb6647+'.'+_0x2830e1+'\x20=\x20'+_0x199ccf+'.'+_0x2830e1)[_0xfd2d('0x12')](_0x5b52d5+'.dialCheckDuplicateType\x20IN\x20('+_0x2fde52[_0xfd2d('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xff0440,_0x1fe4c6){promisesAdditionalPhones=[];return db[_0xfd2d('0x13')][_0xfd2d('0x14')]({'raw':!![],'attributes':['id',_0xfd2d('0x15')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xfd2d('0x16')](function(_0x2b0564){if(_0x2b0564!==null){var _0x140bda=[];for(var _0x482d3b=0x0;_0x482d3b<_0x2b0564[_0xfd2d('0x17')];_0x482d3b++){var _0x324657=_0x2b0564[_0x482d3b];_0x140bda[_0xfd2d('0x18')](insertAdditionalPhones(_0x324657));}}Promise[_0xfd2d('0x19')](_0x140bda)['then'](function(){_0xff0440({'val':0x1});});});});}function insertAdditionalPhones(_0x337967){return new Promise(function(_0x22104a,_0x28e8b5){var _0x4383a7=_0x337967[_0xfd2d('0x15')];var _0x42c3ef=_0x4383a7[_0xfd2d('0x1a')](';');var _0x3c7420=[];orderBy=0x0;for(var _0x5d8513=0x0;_0x5d8513<_0x42c3ef[_0xfd2d('0x17')];_0x5d8513++){_0x3c7420[_0xfd2d('0x18')](splitAdditionalPhone(_0x337967['id'],_0x42c3ef[_0x5d8513]));}Promise[_0xfd2d('0x19')](_0x3c7420)[_0xfd2d('0x16')](function(){_0x22104a({'val':_0x42c3ef[_0xfd2d('0x17')]});});});}function splitAdditionalPhone(_0x437701,_0x2a06eb){return new Promise(function(_0x158ab8,_0x57af43){var _0xec781a=_0x2a06eb[_0xfd2d('0x1a')](':');var _0x4498f8=_0xec781a[0x0];var _0x221805=_0xec781a[0x1];if(!_['isNil'](_0x221805)){var _0x2c3531=_0x221805[_0xfd2d('0x1a')]('|');var _0x180755=[];for(var _0x390c8e=0x0;_0x390c8e<_0x2c3531[_0xfd2d('0x17')];_0x390c8e++){if(_0x2c3531[_0x390c8e]!==''){var _0x36302c=_[_0xfd2d('0x1b')](promisesAdditionalPhones,{'contactId':_0x437701,'phone':_0x2c3531[_0x390c8e]});if(_0x36302c['length']==0x0){orderBy++;promisesAdditionalPhones[_0xfd2d('0x18')]({'contactId':_0x437701,'contactTypeId':_0x4498f8,'phone':_0x2c3531[_0x390c8e],'orderBy':orderBy});}}}_0x158ab8({'ok':0x1});}else _0x158ab8({'res':0x0});});}function createAdditionalPhone(_0x4ccc61,_0x38c4b9,_0x1200cf,_0xc8142f){var _0x17c0ee='';var _0x146af8='';var _0xb4543e=_0x1200cf[_0xfd2d('0x1a')]('§');_0x17c0ee=_0xb4543e[0x0];if(_0xb4543e[_0xfd2d('0x17')]==0x2)_0x146af8=_0xb4543e[0x1];return new Promise(function(_0x1fe98f,_0x28b3a5){return db[_0xfd2d('0x1c')]['findOne']({'where':{'CmContactId':_0x4ccc61,'item':_0x17c0ee}})[_0xfd2d('0x16')](function(_0x4af54b){if(_0x4af54b){return db[_0xfd2d('0x1c')][_0xfd2d('0x1d')]({'ItemTypeId':_0x38c4b9,'description':_0x146af8,'OrderBy':_0xc8142f},{'where':{'CmContactId':_0x4ccc61,'item':_0x17c0ee}})[_0xfd2d('0x16')](function(_0x11f65f){_0x1fe98f({'res':_0xfd2d('0x1e')});});}else{return db[_0xfd2d('0x1c')][_0xfd2d('0x1f')]({'CmContactId':_0x4ccc61,'item':_0x17c0ee,'description':_0x146af8,'ItemTypeId':_0x38c4b9,'OrderBy':_0xc8142f,'ItemClass':'PHONE'})[_0xfd2d('0x16')](function(_0x28eb02){_0x1fe98f({'res':_0xfd2d('0x20')});});}});});}function insertCmHopper(_0x2220fd,_0x5c36c0,_0x1ab604,_0x3a04af,_0xcb1b23){var _0x519e61=[_0xfd2d('0x21'),_0xfd2d('0x22'),_0xfd2d('0x23'),'cm_contacts.ListId',_0x5c36c0+'.'+_0x3a04af,_0xfd2d('0x24'),_0xfd2d('0x25'),_0xfd2d('0x26'),'cm_contacts.UserId','\x22'+_0xcb1b23+'\x22'];return squel[_0xfd2d('0x27')]()[_0xfd2d('0x28')](_0xfd2d('0x29'))['fromQuery'](['phone',_0xfd2d('0x2a'),_0xfd2d('0x2b'),'ListId',_0x3a04af,_0xfd2d('0x2c'),_0xfd2d('0x2d'),'priority','UserId',_0xfd2d('0x2e')],squel[_0xfd2d('0xe')]()[_0xfd2d('0x2f')](_0x519e61)[_0xfd2d('0xf')](_0x5c36c0)[_0xfd2d('0x10')](_0xfd2d('0x30'),null,_0xfd2d('0x31')+_0x5c36c0+_0xfd2d('0x32'))['join'](_0x1ab604,null,_0x1ab604+_0xfd2d('0x11')+_0x5c36c0+'.'+_0x3a04af)['where'](_0x5c36c0+_0xfd2d('0x33'),_0x2220fd)[_0xfd2d('0x12')](_0xfd2d('0x34'),NOW)[_0xfd2d('0x12')](_0xfd2d('0x35'),selectNotIn(_0x5c36c0,_0x1ab604,_0x3a04af,'cm_hopper',[_0xfd2d('0x36'),'\x22onlyIfOpen\x22']))[_0xfd2d('0x12')](_0xfd2d('0x35'),selectNotIn(_0x5c36c0,_0x1ab604,_0x3a04af,_0xfd2d('0x29'),[_0xfd2d('0x36')])))[_0xfd2d('0x37')]();}function insertCmHopperBlack(_0x4d042a,_0x20589b,_0x1e9134,_0x4f4ef1){var _0x3e0fe0=[_0xfd2d('0x21'),_0xfd2d('0x23'),_0xfd2d('0x38'),_0x20589b+'.'+_0x4f4ef1,_0xfd2d('0x24'),_0xfd2d('0x25')];return squel['insert']()['into'](_0xfd2d('0x39'))[_0xfd2d('0x3a')]([_0xfd2d('0x3b'),'ContactId',_0xfd2d('0x3c'),_0x4f4ef1,_0xfd2d('0x2c'),_0xfd2d('0x2d')],squel[_0xfd2d('0xe')]()[_0xfd2d('0x2f')](_0x3e0fe0)[_0xfd2d('0xf')](_0x20589b)[_0xfd2d('0x10')](_0xfd2d('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x20589b+_0xfd2d('0x32'))[_0xfd2d('0x10')](_0x1e9134,null,_0x1e9134+_0xfd2d('0x11')+_0x20589b+'.'+_0x4f4ef1)[_0xfd2d('0x12')](_0x20589b+_0xfd2d('0x33'),_0x4d042a)[_0xfd2d('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfd2d('0xe')]()[_0xfd2d('0x3d')](_0xfd2d('0x3b'))[_0xfd2d('0xf')](_0xfd2d('0x39'))['where'](_0xfd2d('0x3e'),_0x4d042a)[_0xfd2d('0x12')](_0x4f4ef1+'\x20=\x20'+_0x20589b+'.'+_0x4f4ef1)))['toString']();}function insertTzCmHopper(_0x3d841d,_0x5c066b,_0x2e4e7f,_0x2d3b81,_0xaa67bb,_0x55503f){var _0x3772b3=['cm_contacts.phone',_0xfd2d('0x3f')+_0x55503f+_0xfd2d('0x40'),_0xfd2d('0x23'),_0xfd2d('0x38'),_0x5c066b+'.'+_0x2d3b81,_0xfd2d('0x24'),'cm_contacts.updatedAt',_0xfd2d('0x26'),_0xfd2d('0x41'),'\x22'+_0xaa67bb+'\x22'];var _0x4e06b7=squel[_0xfd2d('0x27')]()[_0xfd2d('0x28')]('cm_hopper')[_0xfd2d('0x3a')]([_0xfd2d('0x3b'),'scheduledat',_0xfd2d('0x2b'),_0xfd2d('0x3c'),_0x2d3b81,_0xfd2d('0x2c'),_0xfd2d('0x2d'),'priority',_0xfd2d('0x42'),_0xfd2d('0x2e')],squel[_0xfd2d('0xe')]()[_0xfd2d('0x2f')](_0x3772b3)[_0xfd2d('0xf')](_0x5c066b)[_0xfd2d('0x10')](_0xfd2d('0x30'),null,_0xfd2d('0x31')+_0x5c066b+_0xfd2d('0x32'))[_0xfd2d('0x10')](_0x2e4e7f,null,_0x2e4e7f+_0xfd2d('0x11')+_0x5c066b+'.'+_0x2d3b81)['join'](_0x55503f,null,_0x55503f+_0xfd2d('0x11')+_0x5c066b+'.'+_0x2d3b81)['where'](_0x5c066b+_0xfd2d('0x33'),_0x3d841d)['where'](_0xfd2d('0x34'),NOW)[_0xfd2d('0x12')](_0xfd2d('0x35'),selectNotIn(_0x5c066b,_0x2e4e7f,_0x2d3b81,_0xfd2d('0x29'),[_0xfd2d('0x36'),_0xfd2d('0x43')]))[_0xfd2d('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5c066b,_0x2e4e7f,_0x2d3b81,_0xfd2d('0x29'),[_0xfd2d('0x36')])))[_0xfd2d('0x37')]();return _0x4e06b7;}function insertTzCmHopperBlack(_0xbf7849,_0x1dadd4,_0x15ce16,_0x219752){var _0x12ea39=[_0xfd2d('0x21'),_0xfd2d('0x23'),_0xfd2d('0x38'),_0x1dadd4+'.'+_0x219752,_0xfd2d('0x24'),_0xfd2d('0x25')];return squel['insert']()[_0xfd2d('0x28')](_0xfd2d('0x39'))['fromQuery']([_0xfd2d('0x3b'),'ContactId','ListId',_0x219752,_0xfd2d('0x2c'),_0xfd2d('0x2d')],squel[_0xfd2d('0xe')]()['fields'](_0x12ea39)['from'](_0x1dadd4)['join'](_0xfd2d('0x30'),null,_0xfd2d('0x31')+_0x1dadd4+_0xfd2d('0x32'))[_0xfd2d('0x10')](_0x15ce16,null,_0x15ce16+'.id\x20=\x20'+_0x1dadd4+'.'+_0x219752)[_0xfd2d('0x12')](_0x1dadd4+'.CmListId\x20=\x20?',_0xbf7849)[_0xfd2d('0x12')](_0xfd2d('0x34'),NOW)[_0xfd2d('0x12')](_0xfd2d('0x35'),squel[_0xfd2d('0xe')]()['field'](_0xfd2d('0x3b'))[_0xfd2d('0xf')](_0xfd2d('0x39'))[_0xfd2d('0x12')](_0xfd2d('0x3e'),_0xbf7849)[_0xfd2d('0x12')](_0x219752+_0xfd2d('0x44')+_0x1dadd4+'.'+_0x219752)))[_0xfd2d('0x37')]();}function insertCmHopperAdditionalPhones(_0x4fb78d){var _0x38194b=['cm_hopper.id',_0xfd2d('0x45'),'cm_contact_has_items.OrderBy',_0xfd2d('0x46'),_0xfd2d('0x47')];return squel[_0xfd2d('0x27')]()['into'](_0xfd2d('0x48'))['fromQuery']([_0xfd2d('0x49'),'phone','OrderBy',_0xfd2d('0x2c'),'updatedAt'],squel[_0xfd2d('0xe')]()[_0xfd2d('0x2f')](_0x38194b)[_0xfd2d('0xf')](_0xfd2d('0x29'))[_0xfd2d('0x10')](_0xfd2d('0x30'),null,_0xfd2d('0x4a'))[_0xfd2d('0x10')](_0xfd2d('0x4b'),null,_0xfd2d('0x4c'))['where'](_0xfd2d('0x4d'),_0x4fb78d)['where'](_0xfd2d('0x34'),NOW))[_0xfd2d('0x37')]();}function insertCmContact(_0x2ce8be,_0xee82ef,_0x34e1a3,_0x176a76){var _0x44daac=_[_0xfd2d('0x4e')](_[_0xfd2d('0x4f')](_0x176a76),[_0xfd2d('0x3c'),_0xfd2d('0x50'),_0xfd2d('0x2c'),_0xfd2d('0x2d')]);return squel[_0xfd2d('0x27')]()['into'](_0xfd2d('0x30'))['fromQuery'](_0x44daac,squel[_0xfd2d('0xe')]()['fields'](_0x44daac)[_0xfd2d('0xf')](_0xee82ef)[_0xfd2d('0x12')]('('+_0x34e1a3['join'](',')+_0xfd2d('0x51'),squel['select']()[_0xfd2d('0x2f')](_0x34e1a3)['from'](_0xfd2d('0x30'))[_0xfd2d('0x12')](_0xfd2d('0x3e'),_0x2ce8be)['where']('deletedAt\x20IS\x20NULL'))['where'](_0xfd2d('0x52'),squel[_0xfd2d('0xe')]()['field'](_0xfd2d('0x53'),_0xfd2d('0x54'))['from'](_0xee82ef)[_0xfd2d('0x55')](_0x34e1a3[_0xfd2d('0x10')](','))))[_0xfd2d('0x37')]();}function handleStop(){logger[_0xfd2d('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5e5f0c){logger[_0xfd2d('0x57')](_0x5e5f0c['message']);process['exit'](0x1);}function handleError(_0x4c103f,_0x59c697){stats[_0xfd2d('0x58')][_0xfd2d('0x18')]({'name':_0x59c697[_0xfd2d('0x59')],'message':_0x59c697[_0xfd2d('0x5a')],'row':_0x4c103f});}function handleQuery(_0x240dd5){logger[_0xfd2d('0x56')](_0x240dd5);return db[_0xfd2d('0x5b')][_0xfd2d('0x5c')](_0x240dd5)[_0xfd2d('0x5d')](function(_0x5d0a08){results[_0xfd2d('0x18')](_0x5d0a08);})[_0xfd2d('0x5e')](function(_0x2ddda1){logger[_0xfd2d('0x57')](_0x2ddda1[_0xfd2d('0x5a')]);});}function updateTzCampaigns(_0x4d2ae4){return new Promise(function(_0x48a129,_0x35705a){var _0x36b1da=squel[_0xfd2d('0xe')]()['fields']([_0xfd2d('0x5f'),_0xfd2d('0x60')])[_0xfd2d('0xf')](_0xfd2d('0x61'))['join']('campaigns_has_cm_lists',null,_0xfd2d('0x62'))[_0xfd2d('0x12')](_0xfd2d('0x63')+_0x4d2ae4);db[_0xfd2d('0x5b')][_0xfd2d('0x5c')](_0x36b1da[_0xfd2d('0x37')]())['spread'](function(_0x142b44){var _0x659d4a=[];for(var _0x442297=0x0;_0x442297<_0x142b44[_0xfd2d('0x17')];_0x442297++){_0x659d4a[_0xfd2d('0x18')](getTimezoneData(_0x142b44[_0x442297],tmp_campaigns));}BPromise[_0xfd2d('0x19')](_0x659d4a)[_0xfd2d('0x16')](function(){_0x48a129({'val':0x1});});})[_0xfd2d('0x5e')](function(_0x46b67e){logger[_0xfd2d('0x57')](_0x46b67e[_0xfd2d('0x5a')]);_0x48a129({'val':0x0});});});}function updateTzVoiceQueues(_0x5fc18e){return new Promise(function(_0x2258e0,_0x5d2764){var _0x41cdf2=squel['select']()[_0xfd2d('0x2f')]([_0xfd2d('0x64'),_0xfd2d('0x65')])[_0xfd2d('0xf')](_0xfd2d('0x66'))[_0xfd2d('0x10')](_0xfd2d('0x67'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xfd2d('0x12')]('voice_queues_has_cm_lists.CmListId='+_0x5fc18e);db[_0xfd2d('0x5b')][_0xfd2d('0x5c')](_0x41cdf2[_0xfd2d('0x37')]())[_0xfd2d('0x5d')](function(_0x493a32){var _0x1b2b86=[];for(var _0x2291e8=0x0;_0x2291e8<_0x493a32[_0xfd2d('0x17')];_0x2291e8++){_0x1b2b86[_0xfd2d('0x18')](getTimezoneData(_0x493a32[_0x2291e8],tmp_voice_queues));}BPromise['all'](_0x1b2b86)[_0xfd2d('0x16')](function(){_0x2258e0({'val':0x1});});})['catch'](function(_0x4372a0){logger[_0xfd2d('0x57')](_0x4372a0[_0xfd2d('0x5a')]);_0x2258e0({'val':0x0});});});}function getTimezoneData(_0x17ed00,_0x554077){return new Promise(function(_0x3e0cd3,_0x30f1be){var _0x393ca7=shared[_0xfd2d('0x68')];var _0x580825=_0x393ca7[_0x17ed00['dialTimezone']];if(_[_0xfd2d('0x69')](_0x580825)){_0x3e0cd3({'ret':0x1});}else{var _0x1070cd=_0x580825[_0xfd2d('0x6a')];var _0x42b32e=squel[_0xfd2d('0x27')]()[_0xfd2d('0x28')](_0x554077)[_0xfd2d('0x6b')]('id',_0x17ed00['id'])[_0xfd2d('0x6b')](_0xfd2d('0x6c'),_0x1070cd)['set'](_0xfd2d('0x6d'),_0x17ed00[_0xfd2d('0x6d')])[_0xfd2d('0x37')]();return db[_0xfd2d('0x5b')][_0xfd2d('0x5c')](_0x42b32e)[_0xfd2d('0x5d')](function(_0x1cd13d){_0x3e0cd3({'ret':0x1});})[_0xfd2d('0x5e')](function(_0x11793e){logger['error'](_0x11793e[_0xfd2d('0x5a')]);_0x30f1be({'ret':0x1});});}});}function handleTZQuery(_0x43e827){logger[_0xfd2d('0x56')](_0x43e827);return db['sequelize'][_0xfd2d('0x5c')](_0x43e827)[_0xfd2d('0x5d')](function(_0x9cf3dc){})[_0xfd2d('0x5e')](function(_0x576324){logger[_0xfd2d('0x57')](_0x576324['message']);});}function main(_0x472b49,_0x12e44a,_0x2631fe,_0x287833){logger[_0xfd2d('0x56')](_0xfd2d('0x6e'),_0x472b49,JSON['stringify'](_0x12e44a));process[_0xfd2d('0x6f')](_0xfd2d('0x70'));var _0x1c99a2=_0x12e44a[_0xfd2d('0x71')];var _0x42bb45=_[_0xfd2d('0x72')](_0x1c99a2);var _0x27efbb=_0x12e44a['socket_timestamp'];var _0x5df72b=path[_0xfd2d('0x10')](config[_0xfd2d('0x73')],_0xfd2d('0x74'),_0x27efbb+_0xfd2d('0x75'));hasTZ=_[_0xfd2d('0x4f')](_0x1c99a2)[_0xfd2d('0x76')](_0xfd2d('0x6d'));var _0x86f65b=_[_0xfd2d('0x4f')](_0x1c99a2)[_0xfd2d('0x10')]();logger['info'](_0xfd2d('0x77'),_0x86f65b);db[_0xfd2d('0x78')][_0xfd2d('0x14')]({'raw':!![],'attributes':['id',_0xfd2d('0x79')]})[_0xfd2d('0x16')](function(_0x4f18a0){for(var _0x450d92=0x0;_0x450d92<_0x4f18a0['length'];_0x450d92++){if(_0x4f18a0[_0x450d92]['name']in _0x1c99a2){contactItemTypes[_0xfd2d('0x18')](_0x4f18a0[_0x450d92]);delete _0x42bb45[_0x4f18a0[_0x450d92][_0xfd2d('0x79')]];hasAdditionalPhones=!![];}for(var _0x56e836 in _0x1c99a2){if(_0x4f18a0[_0x450d92]['name']+_0xfd2d('0x7a')===_0x56e836){phoneDescriptions[_0xfd2d('0x18')]({'itemTypeId':_0x4f18a0[_0x450d92]['id'],'description':_0x56e836});delete _0x42bb45[_0x56e836];}}}if(hasAdditionalPhones)_0x42bb45[_0xfd2d('0x15')]='';var _0x3bb83a=_[_0xfd2d('0x4f')](_0x42bb45)['join']();logger[_0xfd2d('0x56')](_0xfd2d('0x77'),_0x3bb83a);fs[_0xfd2d('0x7b')](_0x5df72b,_0x3bb83a+'\x0a');Papa['parse'](fs['createReadStream'](_0x472b49),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5be797,_0xdd2c7f){try{for(var _0x1a7b31=0x0,_0x31d319=[];_0x1a7b31<_0x5be797[_0xfd2d('0x7c')][_0xfd2d('0x17')];_0x1a7b31++){stats[_0xfd2d('0x7d')]+=0x1;if(_0x5be797['errors'][_0x1a7b31]){handleError(_0x5be797['data'][_0x1a7b31],_0x5be797[_0xfd2d('0x58')][_0x1a7b31]);}else{var _0x508ac5=[];var _0x2218d3=[];var _0x460592={};for(var _0x448826 in _0x1c99a2){let _0x448c37=contactItemTypes[_0xfd2d('0x7e')](_0x66668e=>_0x66668e[_0xfd2d('0x79')]===_0x448826);let _0x589631=contactItemTypes[_0xfd2d('0x7e')](_0x1dd1c5=>_0x1dd1c5[_0xfd2d('0x79')]+_0xfd2d('0x7a')===_0x448826);if(_[_0xfd2d('0x69')](_0x448c37)&&_[_0xfd2d('0x69')](_0x589631)){if(_0x1c99a2[_0xfd2d('0x7f')](_0x448826)){if(_0x5be797[_0xfd2d('0x7c')][_0x1a7b31][_0x1c99a2[_0x448826]]){var _0x36b7f3=_['trim'](_0x5be797[_0xfd2d('0x7c')][_0x1a7b31][_0x1c99a2[_0x448826]][_0xfd2d('0x80')](/"/g,'\x27'));switch(_0x448826){case _0xfd2d('0x2a'):var _0x389333=moment(_0x36b7f3,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x389333[_0xfd2d('0x81')]()){_0x31d319['push']('\x22'+_0x36b7f3+'\x22');}else{_0x508ac5[_0xfd2d('0x18')](_0xfd2d('0x82'));}break;case _0xfd2d('0x83'):var _0x162725=parseInt(_0x36b7f3);_0x36b7f3=_[_0xfd2d('0x84')](_0x162725)||_0x162725<0x0||_0x162725>0x4?_0x287833?0x3:0x2:_0x162725;_0x31d319[_0xfd2d('0x18')]('\x22'+_0x36b7f3+'\x22');break;case _0xfd2d('0x42'):var _0x173c82=parseInt(_0x36b7f3);if(_['isNumber'](_0x173c82)&&_[_0xfd2d('0x76')](_0x2631fe,_0x173c82)){_0x31d319[_0xfd2d('0x18')]('\x22'+_0x173c82+'\x22');}else{_0x508ac5['push']('agent\x20not\x20exists');}break;case _0xfd2d('0x85'):if(isEmail(_0x36b7f3)){_0x31d319[_0xfd2d('0x18')]('\x22'+_0x36b7f3+'\x22');}else{_0x508ac5[_0xfd2d('0x18')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x53e169=moment(_0x36b7f3,_0xfd2d('0x86'),!![]);if(_0x53e169[_0xfd2d('0x81')]()){_0x31d319[_0xfd2d('0x18')]('\x22'+_0x36b7f3+'\x22');}else{_0x508ac5[_0xfd2d('0x18')](_0xfd2d('0x87'));}break;case _0xfd2d('0x6d'):var _0x1fefbc=shared[_0xfd2d('0x68')];var _0x4dda2c=_0x1fefbc[_0x36b7f3];if(!_[_0xfd2d('0x69')](_0x4dda2c)){var _0x11ea98=_0x4dda2c[_0xfd2d('0x6a')];_0x31d319[_0xfd2d('0x18')]('\x22'+_0x36b7f3+'\x22');_0x31d319[_0xfd2d('0x18')]('\x22'+_0x11ea98+'\x22');}break;default:_0x31d319[_0xfd2d('0x18')]('\x22'+_0x36b7f3+'\x22');}}else{switch(_0x448826){case _0xfd2d('0x88'):case _0xfd2d('0x3b'):_0x508ac5['push'](_0x448826+'\x20not\x20specified');break;default:_0x31d319['push']('\x22\x22');}}}}else{var _0x334778='';if(!_['isNil'](_0x448c37)){if(!_0x460592['hasOwnProperty'](_0x448c37['id'])){if(!_[_0xfd2d('0x69')](_0x5be797[_0xfd2d('0x7c')][_0x1a7b31][_0x1c99a2[_0x448826]])){var _0x36b7f3=_[_0xfd2d('0x89')](_0x5be797['data'][_0x1a7b31][_0x1c99a2[_0x448826]][_0xfd2d('0x80')](/"/g,'\x27'));var _0x353b0f=phoneDescriptions[_0xfd2d('0x7e')](_0x17029a=>_0x17029a[_0xfd2d('0x8a')]===_0x448c37['id']);if(!_[_0xfd2d('0x69')](_0x353b0f)){var _0x39c248=_['trim'](_0x5be797[_0xfd2d('0x7c')][_0x1a7b31][_0x1c99a2[_0x353b0f[_0xfd2d('0x8b')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x39c248))_0x36b7f3=_0x36b7f3+'§'+_0x39c248;}if(_0x334778=='')_0x334778=_0x36b7f3;else _0x334778+='|'+_0x36b7f3;}_0x2218d3['push'](_0x448c37['id']+':'+_0x334778);_0x460592[_0x448c37['id']]=0x1;}}}}if(hasAdditionalPhones){_0x31d319[_0xfd2d('0x18')]('\x22'+_0x2218d3['join'](';')+'\x22');}if(_0x508ac5[_0xfd2d('0x17')]){handleError(_0x5be797[_0xfd2d('0x7c')][_0x1a7b31],{'code':_0xfd2d('0x8c'),'message':_0x508ac5[_0xfd2d('0x10')]()});}else{fs[_0xfd2d('0x8d')](_0x5df72b,_0x31d319['join']()+'\x0a');}_0x31d319=[];}if(!(stats[_0xfd2d('0x7d')]%0xc8)){socket[_0xfd2d('0x8e')](_0xfd2d('0x8f')+_0x27efbb,stats);stats['errors']=[];}}if(stopped){logger[_0xfd2d('0x56')](_0xfd2d('0x90'));_0xdd2c7f['abort']();}}catch(_0x1a1625){handleError(_0x5be797[_0xfd2d('0x7c')][_0x1a7b31],{'code':_0xfd2d('0x91'),'message':_0x1a1625[_0xfd2d('0x5a')]});logger[_0xfd2d('0x57')](_0xfd2d('0x92'),_0x1a1625['message']);}},'complete':function(){try{var _0x3027e0=[];var _0x5bbd0f=[];var _0x36b032='cm_contacts';if(_0x12e44a[_0xfd2d('0x93')]&&_0x12e44a[_0xfd2d('0x93')][_0xfd2d('0x17')]){_0x36b032='cm_contacts_'+_0x27efbb;_0x3027e0[_0xfd2d('0x18')](_0xfd2d('0x94')+_0x36b032+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xfd2d('0x95')+_0x27efbb;tmp_voice_queues=_0xfd2d('0x96')+_0x27efbb;_0x5bbd0f['push']('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x5bbd0f[_0xfd2d('0x18')](_0xfd2d('0x94')+tmp_voice_queues+_0xfd2d('0x97'));BPromise[_0xfd2d('0x98')](_0x5bbd0f,handleTZQuery)['then'](function(_0x36cf09){updateTzCampaigns(_0x12e44a[_0xfd2d('0x3c')])[_0xfd2d('0x16')](function(_0x32a7f0){updateTzVoiceQueues(_0x12e44a[_0xfd2d('0x3c')])[_0xfd2d('0x16')](function(_0x53bc10){if(hasTZ)_0x3bb83a=_0x3bb83a[_0xfd2d('0x80')]('dialTimezone',_0xfd2d('0x99'));var _0x2c8cd8=util[_0xfd2d('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x5df72b,_0x36b032,_0x3bb83a,_0x12e44a[_0xfd2d('0x3c')],_0x12e44a[_0xfd2d('0x50')]||null,NOW,NOW);if(_[_0xfd2d('0x69')](_0x1c99a2['scheduledat'])){_0x2c8cd8+=_0xfd2d('0x9a');}_0x3027e0[_0xfd2d('0x18')](_0x2c8cd8);if(_0x12e44a[_0xfd2d('0x93')]&&_0x12e44a[_0xfd2d('0x93')][_0xfd2d('0x17')]){_0x3027e0[_0xfd2d('0x18')](insertCmContact(_0x12e44a[_0xfd2d('0x3c')],_0x36b032,_0x12e44a[_0xfd2d('0x93')],_0x1c99a2));_0x3027e0['push'](_0xfd2d('0x9b')+_0x36b032+';');}BPromise[_0xfd2d('0x98')](_0x3027e0,handleQuery)[_0xfd2d('0x16')](function(_0xe24067){BPromise['all']([handleAdditionalPhones()])[_0xfd2d('0x16')](function(){_0x3027e0=[];for(var _0x111f0f=0x0;_0x111f0f\x20\x20');}var _0x309043=path[_0xfd2d('0x10')](config[_0xfd2d('0x73')],'server/files/tmp',process[_0xfd2d('0xa8')][0x2]);if(!fs[_0xfd2d('0xa9')](_0x309043)){throw new Error(_0xfd2d('0xaa'));}var _0x10fbd9={};try{_0x10fbd9=JSON['parse'](process[_0xfd2d('0xa8')][0x3]);if(!_0x10fbd9[_0xfd2d('0x71')]){throw new Error(_0xfd2d('0xab'));}if(!_0x10fbd9[_0xfd2d('0x71')][_0xfd2d('0x3b')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x10fbd9[_0xfd2d('0x71')][_0xfd2d('0x88')]){throw new Error(_0xfd2d('0xac'));}var _0x43366f=0x0;if(_0x10fbd9[_0xfd2d('0x71')][_0xfd2d('0x42')]){_0x43366f=0x1;}if(!_0x10fbd9[_0xfd2d('0x3c')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x58c1ff){throw new Error(_0xfd2d('0xad'));}var _0x3cbf5b=[];try{_0x3cbf5b=_[_0xfd2d('0xae')](JSON[_0xfd2d('0xaf')](process[_0xfd2d('0xa8')][0x4]),'id');}catch(_0x1bdec1){logger[_0xfd2d('0x56')]('No\x20agent\x20available');}main(_0x309043,_0x10fbd9,_0x3cbf5b,_0x43366f);}validate();process['on'](_0xfd2d('0xb0'),handleStop);process['on'](_0xfd2d('0xb1'),handleUncaughtException); \ No newline at end of file +var _0xceb6=['YYYY-MM-DD\x20HH:mm:ss','format','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','push','split','length','all','isNil','filter','CmContactHasItem','findOne','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','into','cm_hopper_black','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','error','message','errors','sequelize','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','main','start','clone','server/files/tmp','.csv','includes','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','VoiceQueueId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','affectedRows','contact:import:','unlink','exit','argv','arguments\x20\x20\x20','root','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter'];(function(_0x5b651d,_0x5231f5){var _0x42cd5f=function(_0xcd4014){while(--_0xcd4014){_0x5b651d['push'](_0x5b651d['shift']());}};_0x42cd5f(++_0x5231f5);}(_0xceb6,0x162));var _0x6ceb=function(_0x443396,_0x1ea3de){_0x443396=_0x443396-0x0;var _0x158ae0=_0xceb6[_0x443396];return _0x158ae0;};'use strict';var fs=require('fs');var path=require(_0x6ceb('0x0'));var _=require(_0x6ceb('0x1'));var Papa=require(_0x6ceb('0x2'));var util=require(_0x6ceb('0x3'));var BPromise=require(_0x6ceb('0x4'));var moment=require(_0x6ceb('0x5'));var squel=require(_0x6ceb('0x6'));var Redis=require(_0x6ceb('0x7'));var db=require(_0x6ceb('0x8'))['db'];var config=require('../../../config/environment');var shared=require(_0x6ceb('0x9'));var logger=require(_0x6ceb('0xa'))('import');config['redis']=_['defaults'](config[_0x6ceb('0xb')],{'host':_0x6ceb('0xc'),'port':0x18eb});var socket=require(_0x6ceb('0xd'))(new Redis(config[_0x6ceb('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x6ceb('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6ceb('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x15e72a){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x15e72a);}function selectNotIn(_0x5bfd12,_0x2ee4fc,_0xf954c6,_0x91729f,_0x39fdcf){return squel['select']()[_0x6ceb('0x10')]('phone')[_0x6ceb('0x11')](_0x91729f)[_0x6ceb('0x12')](_0x2ee4fc,null,_0x2ee4fc+_0x6ceb('0x13')+_0x91729f+'.'+_0xf954c6)[_0x6ceb('0x14')](_0x91729f+'.'+_0xf954c6+'\x20=\x20'+_0x5bfd12+'.'+_0xf954c6)[_0x6ceb('0x14')](_0x2ee4fc+_0x6ceb('0x15')+_0x39fdcf[_0x6ceb('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x22d2ed,_0x4c5de6){promisesAdditionalPhones=[];return db[_0x6ceb('0x16')]['findAll']({'raw':!![],'attributes':['id',_0x6ceb('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6ceb('0x18')](function(_0x1cab7c){if(_0x1cab7c!==null){var _0x43fd3c=[];for(var _0x4d42f7=0x0;_0x4d42f7<_0x1cab7c['length'];_0x4d42f7++){var _0x4c7a28=_0x1cab7c[_0x4d42f7];_0x43fd3c[_0x6ceb('0x19')](insertAdditionalPhones(_0x4c7a28));}}Promise['all'](_0x43fd3c)[_0x6ceb('0x18')](function(){_0x22d2ed({'val':0x1});});});});}function insertAdditionalPhones(_0x3f5752){return new Promise(function(_0x1141ec,_0x369f70){var _0x29eaa6=_0x3f5752['AdditionalPhones'];var _0x1cf738=_0x29eaa6[_0x6ceb('0x1a')](';');var _0x17b4b8=[];orderBy=0x0;for(var _0x34289e=0x0;_0x34289e<_0x1cf738[_0x6ceb('0x1b')];_0x34289e++){_0x17b4b8['push'](splitAdditionalPhone(_0x3f5752['id'],_0x1cf738[_0x34289e]));}Promise[_0x6ceb('0x1c')](_0x17b4b8)[_0x6ceb('0x18')](function(){_0x1141ec({'val':_0x1cf738[_0x6ceb('0x1b')]});});});}function splitAdditionalPhone(_0x4a0e49,_0x51cf74){return new Promise(function(_0x4c5236,_0x208fff){var _0xe45978=_0x51cf74['split'](':');var _0x5247b8=_0xe45978[0x0];var _0x3c4453=_0xe45978[0x1];if(!_[_0x6ceb('0x1d')](_0x3c4453)){var _0x58c33c=_0x3c4453['split']('|');var _0x2074c4=[];for(var _0x974ff8=0x0;_0x974ff8<_0x58c33c['length'];_0x974ff8++){if(_0x58c33c[_0x974ff8]!==''){var _0x186b48=_[_0x6ceb('0x1e')](promisesAdditionalPhones,{'contactId':_0x4a0e49,'phone':_0x58c33c[_0x974ff8]});if(_0x186b48[_0x6ceb('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x6ceb('0x19')]({'contactId':_0x4a0e49,'contactTypeId':_0x5247b8,'phone':_0x58c33c[_0x974ff8],'orderBy':orderBy});}}}_0x4c5236({'ok':0x1});}else _0x4c5236({'res':0x0});});}function createAdditionalPhone(_0x2371f6,_0x18a91b,_0x246c29,_0x3802bc){var _0x442852='';var _0x1261b8='';var _0x15b15e=_0x246c29[_0x6ceb('0x1a')]('§');_0x442852=_0x15b15e[0x0];if(_0x15b15e[_0x6ceb('0x1b')]==0x2)_0x1261b8=_0x15b15e[0x1];return new Promise(function(_0x937e52,_0x4fcb5b){return db[_0x6ceb('0x1f')][_0x6ceb('0x20')]({'where':{'CmContactId':_0x2371f6,'item':_0x442852}})[_0x6ceb('0x18')](function(_0x4e8be4){if(_0x4e8be4){return db[_0x6ceb('0x1f')]['update']({'ItemTypeId':_0x18a91b,'description':_0x1261b8,'OrderBy':_0x3802bc},{'where':{'CmContactId':_0x2371f6,'item':_0x442852}})[_0x6ceb('0x18')](function(_0x306dee){_0x937e52({'res':_0x6ceb('0x21')});});}else{return db[_0x6ceb('0x1f')][_0x6ceb('0x22')]({'CmContactId':_0x2371f6,'item':_0x442852,'description':_0x1261b8,'ItemTypeId':_0x18a91b,'OrderBy':_0x3802bc,'ItemClass':'PHONE'})[_0x6ceb('0x18')](function(_0x29bdb7){_0x937e52({'res':_0x6ceb('0x23')});});}});});}function insertCmHopper(_0x18acd8,_0x506a9c,_0x2b8c55,_0x40ce32,_0x24323e){var _0x315fed=[_0x6ceb('0x24'),_0x6ceb('0x25'),_0x6ceb('0x26'),_0x6ceb('0x27'),_0x506a9c+'.'+_0x40ce32,_0x6ceb('0x28'),_0x6ceb('0x29'),_0x6ceb('0x2a'),_0x6ceb('0x2b'),'\x22'+_0x24323e+'\x22'];return squel[_0x6ceb('0x2c')]()['into']('cm_hopper')[_0x6ceb('0x2d')]([_0x6ceb('0x2e'),_0x6ceb('0x2f'),_0x6ceb('0x30'),_0x6ceb('0x31'),_0x40ce32,_0x6ceb('0x32'),_0x6ceb('0x33'),_0x6ceb('0x34'),_0x6ceb('0x35'),_0x6ceb('0x36')],squel[_0x6ceb('0x37')]()[_0x6ceb('0x38')](_0x315fed)[_0x6ceb('0x11')](_0x506a9c)[_0x6ceb('0x12')](_0x6ceb('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x506a9c+'.CmListId')[_0x6ceb('0x12')](_0x2b8c55,null,_0x2b8c55+_0x6ceb('0x13')+_0x506a9c+'.'+_0x40ce32)[_0x6ceb('0x14')](_0x506a9c+'.CmListId\x20=\x20?',_0x18acd8)[_0x6ceb('0x14')](_0x6ceb('0x3a'),NOW)[_0x6ceb('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x506a9c,_0x2b8c55,_0x40ce32,_0x6ceb('0x3b'),['\x22always\x22',_0x6ceb('0x3c')]))['where'](_0x6ceb('0x3d'),selectNotIn(_0x506a9c,_0x2b8c55,_0x40ce32,_0x6ceb('0x3b'),[_0x6ceb('0x3e')])))[_0x6ceb('0x3f')]();}function insertCmHopperBlack(_0x5dff94,_0x3c1f38,_0x294cf7,_0x401872){var _0x19706c=['cm_contacts.phone',_0x6ceb('0x26'),'cm_contacts.ListId',_0x3c1f38+'.'+_0x401872,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x6ceb('0x2c')]()[_0x6ceb('0x40')](_0x6ceb('0x41'))['fromQuery']([_0x6ceb('0x2e'),_0x6ceb('0x30'),'ListId',_0x401872,'createdAt','updatedAt'],squel[_0x6ceb('0x37')]()[_0x6ceb('0x38')](_0x19706c)[_0x6ceb('0x11')](_0x3c1f38)['join'](_0x6ceb('0x39'),null,_0x6ceb('0x42')+_0x3c1f38+_0x6ceb('0x43'))['join'](_0x294cf7,null,_0x294cf7+_0x6ceb('0x13')+_0x3c1f38+'.'+_0x401872)[_0x6ceb('0x14')](_0x3c1f38+_0x6ceb('0x44'),_0x5dff94)[_0x6ceb('0x14')](_0x6ceb('0x3a'),NOW)[_0x6ceb('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6ceb('0x37')]()[_0x6ceb('0x10')]('phone')[_0x6ceb('0x11')](_0x6ceb('0x41'))[_0x6ceb('0x14')](_0x6ceb('0x45'),_0x5dff94)['where'](_0x401872+_0x6ceb('0x46')+_0x3c1f38+'.'+_0x401872)))[_0x6ceb('0x3f')]();}function insertTzCmHopper(_0x3371ca,_0x43b85c,_0x322855,_0xfd9916,_0x46f0fb,_0x194c94){var _0x411dc5=[_0x6ceb('0x24'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x194c94+_0x6ceb('0x47'),_0x6ceb('0x26'),_0x6ceb('0x27'),_0x43b85c+'.'+_0xfd9916,_0x6ceb('0x28'),_0x6ceb('0x29'),_0x6ceb('0x2a'),_0x6ceb('0x2b'),'\x22'+_0x46f0fb+'\x22'];var _0x4620d3=squel[_0x6ceb('0x2c')]()[_0x6ceb('0x40')](_0x6ceb('0x3b'))[_0x6ceb('0x2d')]([_0x6ceb('0x2e'),'scheduledat',_0x6ceb('0x30'),_0x6ceb('0x31'),_0xfd9916,_0x6ceb('0x32'),'updatedAt',_0x6ceb('0x34'),_0x6ceb('0x35'),_0x6ceb('0x36')],squel[_0x6ceb('0x37')]()[_0x6ceb('0x38')](_0x411dc5)[_0x6ceb('0x11')](_0x43b85c)[_0x6ceb('0x12')]('cm_contacts',null,_0x6ceb('0x42')+_0x43b85c+_0x6ceb('0x43'))[_0x6ceb('0x12')](_0x322855,null,_0x322855+_0x6ceb('0x13')+_0x43b85c+'.'+_0xfd9916)[_0x6ceb('0x12')](_0x194c94,null,_0x194c94+_0x6ceb('0x13')+_0x43b85c+'.'+_0xfd9916)[_0x6ceb('0x14')](_0x43b85c+_0x6ceb('0x44'),_0x3371ca)[_0x6ceb('0x14')](_0x6ceb('0x3a'),NOW)[_0x6ceb('0x14')](_0x6ceb('0x3d'),selectNotIn(_0x43b85c,_0x322855,_0xfd9916,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))['where'](_0x6ceb('0x3d'),selectNotIn(_0x43b85c,_0x322855,_0xfd9916,_0x6ceb('0x3b'),['\x22always\x22'])))[_0x6ceb('0x3f')]();return _0x4620d3;}function insertTzCmHopperBlack(_0x4125fe,_0x1db65d,_0x26364e,_0x294422){var _0x123c62=[_0x6ceb('0x24'),'cm_contacts.id',_0x6ceb('0x27'),_0x1db65d+'.'+_0x294422,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x6ceb('0x2c')]()[_0x6ceb('0x40')]('cm_hopper_black')[_0x6ceb('0x2d')]([_0x6ceb('0x2e'),_0x6ceb('0x30'),_0x6ceb('0x31'),_0x294422,_0x6ceb('0x32'),_0x6ceb('0x33')],squel[_0x6ceb('0x37')]()[_0x6ceb('0x38')](_0x123c62)[_0x6ceb('0x11')](_0x1db65d)[_0x6ceb('0x12')](_0x6ceb('0x39'),null,_0x6ceb('0x42')+_0x1db65d+_0x6ceb('0x43'))[_0x6ceb('0x12')](_0x26364e,null,_0x26364e+_0x6ceb('0x13')+_0x1db65d+'.'+_0x294422)[_0x6ceb('0x14')](_0x1db65d+_0x6ceb('0x44'),_0x4125fe)[_0x6ceb('0x14')](_0x6ceb('0x3a'),NOW)[_0x6ceb('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6ceb('0x37')]()[_0x6ceb('0x10')](_0x6ceb('0x2e'))[_0x6ceb('0x11')](_0x6ceb('0x41'))[_0x6ceb('0x14')]('ListId\x20=\x20?',_0x4125fe)[_0x6ceb('0x14')](_0x294422+_0x6ceb('0x46')+_0x1db65d+'.'+_0x294422)))['toString']();}function insertCmHopperAdditionalPhones(_0x1f2030){var _0xc819eb=[_0x6ceb('0x48'),_0x6ceb('0x49'),_0x6ceb('0x4a'),_0x6ceb('0x4b'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x6ceb('0x40')]('cm_hopper_additional_phones')['fromQuery']([_0x6ceb('0x4c'),_0x6ceb('0x2e'),_0x6ceb('0x4d'),'createdAt','updatedAt'],squel[_0x6ceb('0x37')]()[_0x6ceb('0x38')](_0xc819eb)[_0x6ceb('0x11')](_0x6ceb('0x3b'))[_0x6ceb('0x12')](_0x6ceb('0x39'),null,_0x6ceb('0x4e'))[_0x6ceb('0x12')](_0x6ceb('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x6ceb('0x14')](_0x6ceb('0x50'),_0x1f2030)[_0x6ceb('0x14')](_0x6ceb('0x3a'),NOW))[_0x6ceb('0x3f')]();}function insertCmContact(_0x573773,_0x58ab8a,_0x12016a,_0x3449b9){var _0x36f1c2=_[_0x6ceb('0x51')](_[_0x6ceb('0x52')](_0x3449b9),[_0x6ceb('0x31'),_0x6ceb('0x53'),'createdAt',_0x6ceb('0x33')]);return squel[_0x6ceb('0x2c')]()[_0x6ceb('0x40')](_0x6ceb('0x39'))[_0x6ceb('0x2d')](_0x36f1c2,squel[_0x6ceb('0x37')]()[_0x6ceb('0x38')](_0x36f1c2)[_0x6ceb('0x11')](_0x58ab8a)['where']('('+_0x12016a[_0x6ceb('0x12')](',')+_0x6ceb('0x54'),squel[_0x6ceb('0x37')]()['fields'](_0x12016a)[_0x6ceb('0x11')]('cm_contacts')['where'](_0x6ceb('0x45'),_0x573773)['where']('deletedAt\x20IS\x20NULL'))[_0x6ceb('0x14')]('id\x20IN\x20?',squel[_0x6ceb('0x37')]()[_0x6ceb('0x10')](_0x6ceb('0x55'),_0x6ceb('0x56'))[_0x6ceb('0x11')](_0x58ab8a)[_0x6ceb('0x57')](_0x12016a[_0x6ceb('0x12')](','))))['toString']();}function handleStop(){logger[_0x6ceb('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x21ec1b){logger[_0x6ceb('0x59')](_0x21ec1b[_0x6ceb('0x5a')]);process['exit'](0x1);}function handleError(_0x13d177,_0x400def){stats[_0x6ceb('0x5b')]['push']({'name':_0x400def['code'],'message':_0x400def[_0x6ceb('0x5a')],'row':_0x13d177});}function handleQuery(_0x32444e){logger[_0x6ceb('0x58')](_0x32444e);return db[_0x6ceb('0x5c')]['query'](_0x32444e)['spread'](function(_0x590406){results[_0x6ceb('0x19')](_0x590406);})[_0x6ceb('0x5d')](function(_0x5d1959){logger[_0x6ceb('0x59')](_0x5d1959['message']);});}function updateTzCampaigns(_0x4d7203){return new Promise(function(_0x730a92,_0x2b2d51){var _0x151200=squel['select']()[_0x6ceb('0x38')]([_0x6ceb('0x5e'),_0x6ceb('0x5f')])[_0x6ceb('0x11')](_0x6ceb('0x60'))['join']('campaigns_has_cm_lists',null,_0x6ceb('0x61'))[_0x6ceb('0x14')](_0x6ceb('0x62')+_0x4d7203);db[_0x6ceb('0x5c')][_0x6ceb('0x63')](_0x151200['toString']())[_0x6ceb('0x64')](function(_0x157908){var _0xc071e4=[];for(var _0x43a9cc=0x0;_0x43a9cc<_0x157908[_0x6ceb('0x1b')];_0x43a9cc++){_0xc071e4[_0x6ceb('0x19')](getTimezoneData(_0x157908[_0x43a9cc],tmp_campaigns));}BPromise[_0x6ceb('0x1c')](_0xc071e4)[_0x6ceb('0x18')](function(){_0x730a92({'val':0x1});});})[_0x6ceb('0x5d')](function(_0x21a976){logger['error'](_0x21a976[_0x6ceb('0x5a')]);_0x730a92({'val':0x0});});});}function updateTzVoiceQueues(_0x19b685){return new Promise(function(_0x3ba10d,_0x522567){var _0x10fd99=squel[_0x6ceb('0x37')]()['fields']([_0x6ceb('0x65'),_0x6ceb('0x66')])['from'](_0x6ceb('0x67'))[_0x6ceb('0x12')](_0x6ceb('0x68'),null,_0x6ceb('0x69'))['where'](_0x6ceb('0x6a')+_0x19b685);db[_0x6ceb('0x5c')][_0x6ceb('0x63')](_0x10fd99[_0x6ceb('0x3f')]())['spread'](function(_0x2b365a){var _0x23a499=[];for(var _0xb4367c=0x0;_0xb4367c<_0x2b365a['length'];_0xb4367c++){_0x23a499[_0x6ceb('0x19')](getTimezoneData(_0x2b365a[_0xb4367c],tmp_voice_queues));}BPromise[_0x6ceb('0x1c')](_0x23a499)[_0x6ceb('0x18')](function(){_0x3ba10d({'val':0x1});});})[_0x6ceb('0x5d')](function(_0x531c1d){logger[_0x6ceb('0x59')](_0x531c1d[_0x6ceb('0x5a')]);_0x3ba10d({'val':0x0});});});}function getTimezoneData(_0x434a26,_0x5af88e){return new Promise(function(_0xb4d6cb,_0x5e8e97){var _0x4428a6=shared[_0x6ceb('0x6b')];var _0x5d1a5c=_0x4428a6[_0x434a26[_0x6ceb('0x6c')]];if(_[_0x6ceb('0x1d')](_0x5d1a5c)){_0xb4d6cb({'ret':0x1});}else{var _0x318189=_0x5d1a5c['utcOffset'];var _0x1ad4bf=squel[_0x6ceb('0x2c')]()[_0x6ceb('0x40')](_0x5af88e)[_0x6ceb('0x6d')]('id',_0x434a26['id'])[_0x6ceb('0x6d')]('offset',_0x318189)[_0x6ceb('0x6d')](_0x6ceb('0x6c'),_0x434a26[_0x6ceb('0x6c')])[_0x6ceb('0x3f')]();return db['sequelize'][_0x6ceb('0x63')](_0x1ad4bf)['spread'](function(_0x499528){_0xb4d6cb({'ret':0x1});})[_0x6ceb('0x5d')](function(_0x47c0a9){logger[_0x6ceb('0x59')](_0x47c0a9[_0x6ceb('0x5a')]);_0x5e8e97({'ret':0x1});});}});}function handleTZQuery(_0x153c90){logger[_0x6ceb('0x58')](_0x153c90);return db[_0x6ceb('0x5c')][_0x6ceb('0x63')](_0x153c90)[_0x6ceb('0x64')](function(_0x30356b){})[_0x6ceb('0x5d')](function(_0x4c9216){logger[_0x6ceb('0x59')](_0x4c9216[_0x6ceb('0x5a')]);});}function main(_0x11e951,_0xcfc054,_0x52884f,_0x2d7a84){logger[_0x6ceb('0x58')](_0x6ceb('0x6e'),_0x11e951,JSON['stringify'](_0xcfc054));process['send'](_0x6ceb('0x6f'));var _0x51c843=_0xcfc054['binding'];var _0x4cdf5c=_[_0x6ceb('0x70')](_0x51c843);var _0x197e87=_0xcfc054['socket_timestamp'];var _0x938771=path[_0x6ceb('0x12')](config['root'],_0x6ceb('0x71'),_0x197e87+_0x6ceb('0x72'));hasTZ=_['keys'](_0x51c843)[_0x6ceb('0x73')](_0x6ceb('0x6c'));var _0x2775b4=_[_0x6ceb('0x52')](_0x51c843)[_0x6ceb('0x12')]();logger['info']('header',_0x2775b4);db[_0x6ceb('0x74')][_0x6ceb('0x75')]({'raw':!![],'attributes':['id',_0x6ceb('0x76')]})[_0x6ceb('0x18')](function(_0xf6a666){for(var _0x5016ee=0x0;_0x5016ee<_0xf6a666[_0x6ceb('0x1b')];_0x5016ee++){if(_0xf6a666[_0x5016ee][_0x6ceb('0x76')]in _0x51c843){contactItemTypes['push'](_0xf6a666[_0x5016ee]);delete _0x4cdf5c[_0xf6a666[_0x5016ee][_0x6ceb('0x76')]];hasAdditionalPhones=!![];}for(var _0x1d4c26 in _0x51c843){if(_0xf6a666[_0x5016ee]['name']+_0x6ceb('0x77')===_0x1d4c26){phoneDescriptions['push']({'itemTypeId':_0xf6a666[_0x5016ee]['id'],'description':_0x1d4c26});delete _0x4cdf5c[_0x1d4c26];}}}if(hasAdditionalPhones)_0x4cdf5c[_0x6ceb('0x17')]='';var _0x51a236=_[_0x6ceb('0x52')](_0x4cdf5c)[_0x6ceb('0x12')]();logger[_0x6ceb('0x58')](_0x6ceb('0x78'),_0x51a236);fs[_0x6ceb('0x79')](_0x938771,_0x51a236+'\x0a');Papa[_0x6ceb('0x7a')](fs[_0x6ceb('0x7b')](_0x11e951),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2ef143,_0x4558f8){try{for(var _0x2e2f76=0x0,_0x3f3b06=[];_0x2e2f76<_0x2ef143[_0x6ceb('0x7c')][_0x6ceb('0x1b')];_0x2e2f76++){stats[_0x6ceb('0x7d')]+=0x1;if(_0x2ef143['errors'][_0x2e2f76]){handleError(_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76],_0x2ef143[_0x6ceb('0x5b')][_0x2e2f76]);}else{var _0x599bdb=[];var _0x217fb6=[];var _0x55c9f4={};for(var _0x2fab16 in _0x51c843){let _0xeb988=contactItemTypes[_0x6ceb('0x7e')](_0x16eccb=>_0x16eccb[_0x6ceb('0x76')]===_0x2fab16);let _0x409966=contactItemTypes[_0x6ceb('0x7e')](_0x3dd89a=>_0x3dd89a['name']+'_description'===_0x2fab16);if(_[_0x6ceb('0x1d')](_0xeb988)&&_['isNil'](_0x409966)){if(_0x51c843[_0x6ceb('0x7f')](_0x2fab16)){if(_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76][_0x51c843[_0x2fab16]]){var _0xc611dc=_[_0x6ceb('0x80')](_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76][_0x51c843[_0x2fab16]][_0x6ceb('0x81')](/"/g,'\x27'));switch(_0x2fab16){case _0x6ceb('0x2f'):var _0x4d8afa=moment(_0xc611dc,_0x6ceb('0xe'),!![]);if(_0x4d8afa['isValid']()){_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0xc611dc+'\x22');}else{_0x599bdb['push'](_0x6ceb('0x82'));}break;case _0x6ceb('0x34'):var _0x455c35=parseInt(_0xc611dc);_0xc611dc=_[_0x6ceb('0x83')](_0x455c35)||_0x455c35<0x0||_0x455c35>0x4?_0x2d7a84?0x3:0x2:_0x455c35;_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0xc611dc+'\x22');break;case'UserId':var _0x5a6d98=parseInt(_0xc611dc);if(_[_0x6ceb('0x84')](_0x5a6d98)&&_[_0x6ceb('0x73')](_0x52884f,_0x5a6d98)){_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0x5a6d98+'\x22');}else{_0x599bdb[_0x6ceb('0x19')](_0x6ceb('0x85'));}break;case'email':if(isEmail(_0xc611dc)){_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0xc611dc+'\x22');}else{_0x599bdb[_0x6ceb('0x19')](_0x6ceb('0x86'));}break;case _0x6ceb('0x87'):var _0x2085a9=moment(_0xc611dc,_0x6ceb('0x88'),!![]);if(_0x2085a9['isValid']()){_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0xc611dc+'\x22');}else{_0x599bdb['push'](_0x6ceb('0x89'));}break;case _0x6ceb('0x6c'):var _0x2f58c1=shared[_0x6ceb('0x6b')];var _0x48eec9=_0x2f58c1[_0xc611dc];if(!_[_0x6ceb('0x1d')](_0x48eec9)){var _0xd0e118=_0x48eec9['utcOffset'];_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0xc611dc+'\x22');_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0xd0e118+'\x22');}break;default:_0x3f3b06[_0x6ceb('0x19')]('\x22'+_0xc611dc+'\x22');}}else{switch(_0x2fab16){case _0x6ceb('0x8a'):case _0x6ceb('0x2e'):_0x599bdb['push'](_0x2fab16+_0x6ceb('0x8b'));break;default:_0x3f3b06[_0x6ceb('0x19')]('\x22\x22');}}}}else{var _0x23f88e='';if(!_[_0x6ceb('0x1d')](_0xeb988)){if(!_0x55c9f4[_0x6ceb('0x7f')](_0xeb988['id'])){if(!_[_0x6ceb('0x1d')](_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76][_0x51c843[_0x2fab16]])){var _0xc611dc=_[_0x6ceb('0x80')](_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76][_0x51c843[_0x2fab16]][_0x6ceb('0x81')](/"/g,'\x27'));var _0x341788=phoneDescriptions[_0x6ceb('0x7e')](_0x50e4b2=>_0x50e4b2[_0x6ceb('0x8c')]===_0xeb988['id']);if(!_[_0x6ceb('0x1d')](_0x341788)){var _0x500c25=_[_0x6ceb('0x80')](_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76][_0x51c843[_0x341788[_0x6ceb('0x8d')]]][_0x6ceb('0x81')](/"/g,'\x27'));if(!_[_0x6ceb('0x1d')](_0x500c25))_0xc611dc=_0xc611dc+'§'+_0x500c25;}if(_0x23f88e=='')_0x23f88e=_0xc611dc;else _0x23f88e+='|'+_0xc611dc;}_0x217fb6[_0x6ceb('0x19')](_0xeb988['id']+':'+_0x23f88e);_0x55c9f4[_0xeb988['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3f3b06['push']('\x22'+_0x217fb6['join'](';')+'\x22');}if(_0x599bdb[_0x6ceb('0x1b')]){handleError(_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76],{'code':_0x6ceb('0x8e'),'message':_0x599bdb['join']()});}else{fs[_0x6ceb('0x8f')](_0x938771,_0x3f3b06[_0x6ceb('0x12')]()+'\x0a');}_0x3f3b06=[];}if(!(stats['rows']%0xc8)){socket[_0x6ceb('0x90')]('contact:import:'+_0x197e87,stats);stats[_0x6ceb('0x5b')]=[];}}if(stopped){logger['info'](_0x6ceb('0x91'));_0x4558f8[_0x6ceb('0x92')]();}}catch(_0x19a7ef){handleError(_0x2ef143[_0x6ceb('0x7c')][_0x2e2f76],{'code':_0x6ceb('0x93'),'message':_0x19a7ef[_0x6ceb('0x5a')]});logger[_0x6ceb('0x59')](_0x6ceb('0x94'),_0x19a7ef['message']);}},'complete':function(){try{var _0x1db524=[];var _0x594da1=[];var _0x428f55=_0x6ceb('0x39');if(_0xcfc054[_0x6ceb('0x95')]&&_0xcfc054[_0x6ceb('0x95')][_0x6ceb('0x1b')]){_0x428f55=_0x6ceb('0x96')+_0x197e87;_0x1db524[_0x6ceb('0x19')](_0x6ceb('0x97')+_0x428f55+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x6ceb('0x98')+_0x197e87;tmp_voice_queues=_0x6ceb('0x99')+_0x197e87;_0x594da1[_0x6ceb('0x19')](_0x6ceb('0x97')+tmp_campaigns+_0x6ceb('0x9a'));_0x594da1[_0x6ceb('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x6ceb('0x9a'));BPromise[_0x6ceb('0x9b')](_0x594da1,handleTZQuery)['then'](function(_0x67f9f4){updateTzCampaigns(_0xcfc054[_0x6ceb('0x31')])[_0x6ceb('0x18')](function(_0x30c209){updateTzVoiceQueues(_0xcfc054['ListId'])[_0x6ceb('0x18')](function(_0x3f3f9d){if(hasTZ)_0x51a236=_0x51a236[_0x6ceb('0x81')](_0x6ceb('0x6c'),_0x6ceb('0x9c'));var _0x4f124b=util[_0x6ceb('0xf')](_0x6ceb('0x9d'),_0x938771,_0x428f55,_0x51a236,_0xcfc054[_0x6ceb('0x31')],_0xcfc054[_0x6ceb('0x53')]||null,NOW,NOW);if(_[_0x6ceb('0x1d')](_0x51c843['scheduledat'])){_0x4f124b+=_0x6ceb('0x9e');}_0x1db524['push'](_0x4f124b);if(_0xcfc054[_0x6ceb('0x95')]&&_0xcfc054[_0x6ceb('0x95')]['length']){_0x1db524[_0x6ceb('0x19')](insertCmContact(_0xcfc054[_0x6ceb('0x31')],_0x428f55,_0xcfc054[_0x6ceb('0x95')],_0x51c843));_0x1db524[_0x6ceb('0x19')](_0x6ceb('0x9f')+_0x428f55+';');}BPromise[_0x6ceb('0x9b')](_0x1db524,handleQuery)['then'](function(_0x31bfb8){BPromise['all']([handleAdditionalPhones()])[_0x6ceb('0x18')](function(){_0x1db524=[];for(var _0x8d64b0=0x0;_0x8d64b0\x20\x20','binding\x20doesn\x27t\x20exists','binding','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','bluebird','moment','squel','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','message','split','filter','findOne','CmContactHasItem','update','updated','create','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt'];(function(_0x5a723f,_0x2a5802){var _0x17783e=function(_0x407461){while(--_0x407461){_0x5a723f['push'](_0x5a723f['shift']());}};_0x17783e(++_0x2a5802);}(_0x065e,0x1a7));var _0xe065=function(_0xe85858,_0x3560be){_0xe85858=_0xe85858-0x0;var _0x27c87e=_0x065e[_0xe85858];return _0x27c87e;};'use strict';var fs=require('fs');var path=require(_0xe065('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var squel=require(_0xe065('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xe065('0x4'));var logger=require(_0xe065('0x5'))('import');config[_0xe065('0x6')]=_[_0xe065('0x7')](config[_0xe065('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xe065('0x8'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xe065('0x9')](_0xe065('0xa'));var tempTableName=_0xe065('0xb')+moment()[_0xe065('0x9')](_0xe065('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x531ebd){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xe065('0xd')](_0x531ebd);}function selectNotIn(_0x6c9117,_0x3f59d3,_0x1ad433,_0x415d7a,_0x2a6a6e){return squel['select']()['field'](_0xe065('0xe'))[_0xe065('0xf')](_0x415d7a)[_0xe065('0x10')](_0x3f59d3,null,_0x3f59d3+'.id\x20=\x20'+_0x415d7a+'.'+_0x1ad433)[_0xe065('0x11')](_0x415d7a+'.'+_0x1ad433+_0xe065('0x12')+_0x6c9117+'.'+_0x1ad433)[_0xe065('0x11')](_0x3f59d3+_0xe065('0x13')+_0x2a6a6e[_0xe065('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x541985,_0x3d3557){promisesAdditionalPhones=[];promisesContact=[];return db[_0xe065('0x14')][_0xe065('0x15')](_0xe065('0x16')+tempTableName)[_0xe065('0x17')](function(_0x352206){if(_0x352206!==null){var _0x2e5feb=[];for(var _0x545100=0x0;_0x545100<_0x352206[_0xe065('0x18')];_0x545100++){var _0xe48f8c=_0x352206[_0x545100];if(!_['isNil'](_0xe48f8c[_0xe065('0xe')])){if(!_[_0xe065('0x19')](_0xe48f8c[_0xe065('0x1a')]))_0x2e5feb[_0xe065('0x1b')](insertAdditionalPhones(_0xe48f8c));promisesContact[_0xe065('0x1b')]({'contact':_0xe48f8c});}}}Promise[_0xe065('0x1c')](_0x2e5feb)[_0xe065('0x1d')](function(){_0x541985({'val':0x1});});})['catch'](function(_0x45479e){logger['error'](_0x45479e[_0xe065('0x1e')]);});});}function insertAdditionalPhones(_0x23233d){return new Promise(function(_0x55f55c,_0x1c6567){var _0x587d47=_0x23233d[_0xe065('0x1a')];if(_[_0xe065('0x19')](_0x587d47))_0x1c6567({'val':0x0});else{var _0x216f26=_0x587d47[_0xe065('0x1f')](';');var _0x3ecd13=[];orderBy=0x0;for(var _0x105cb2=0x0;_0x105cb2<_0x216f26[_0xe065('0x18')];_0x105cb2++){_0x3ecd13[_0xe065('0x1b')](splitAdditionalPhone(_0x23233d['id'],_0x216f26[_0x105cb2]));}Promise[_0xe065('0x1c')](_0x3ecd13)['then'](function(){_0x55f55c({'val':_0x216f26[_0xe065('0x18')]});});}});}function splitAdditionalPhone(_0x43b712,_0x44ec95){return new Promise(function(_0x13f6e5,_0x5e8b60){var _0x517d53=_0x44ec95[_0xe065('0x1f')](':');var _0x530dc0=_0x517d53[0x0];var _0x14e6b6=_0x517d53[0x1];if(_0x14e6b6!==''){var _0x27e669=_0x14e6b6[_0xe065('0x1f')]('|');var _0x15b598=[];for(var _0x418731=0x0;_0x418731<_0x27e669[_0xe065('0x18')];_0x418731++){if(_0x27e669[_0x418731]!==''){var _0x3b1caf=_[_0xe065('0x20')](promisesAdditionalPhones,{'contactId':_0x43b712,'phone':_0x27e669[_0x418731]});if(_0x3b1caf['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x43b712,'contactTypeId':_0x530dc0,'phone':_0x27e669[_0x418731],'orderBy':orderBy});}}}_0x13f6e5({'ok':0x1});}else _0x13f6e5({'res':0x0});});}function createAdditionalPhone(_0x14de01,_0x10e6ba,_0x23aee9,_0x441e96){var _0x5b1220='';var _0x23f573='';var _0x55ecaa=_0x23aee9['split']('§');_0x5b1220=_0x55ecaa[0x0];if(_0x55ecaa[_0xe065('0x18')]==0x2)_0x23f573=_0x55ecaa[0x1];return new Promise(function(_0x2659e6,_0x2aa766){return db['CmContactHasItem'][_0xe065('0x21')]({'where':{'CmContactId':_0x14de01,'item':_0x5b1220}})['then'](function(_0x12679d){if(_0x12679d){return db[_0xe065('0x22')][_0xe065('0x23')]({'ItemTypeId':_0x10e6ba,'description':_0x23f573,'OrderBy':_0x441e96},{'where':{'CmContactId':_0x14de01,'item':_0x5b1220}})[_0xe065('0x1d')](function(_0x58c49b){_0x2659e6({'res':_0xe065('0x24')});});}else{return db['CmContactHasItem'][_0xe065('0x25')]({'CmContactId':_0x14de01,'item':_0x5b1220,'ItemTypeId':_0x10e6ba,'description':_0x23f573,'OrderBy':_0x441e96,'ItemClass':_0xe065('0x26')})['then'](function(_0x1f2847){_0x2659e6({'res':'inserted'});});}});});}function updateContact(_0x3e8a3e){return new Promise(function(_0x4999b0,_0xa5e103){var _0x1c32e6=_0x3e8a3e['id'];delete _0x3e8a3e['id'];return db[_0xe065('0x27')][_0xe065('0x23')](_0x3e8a3e,{'where':{'id':_0x1c32e6}})['then'](function(_0x1fe1dc){updatedRows+=0x1;return db[_0xe065('0x28')][_0xe065('0x23')]({'phone':_0x3e8a3e[_0xe065('0xe')]},{'where':{'ContactId':_0x1c32e6}})[_0xe065('0x1d')](function(_0x3f9426){_0x4999b0({'ret':'OK'});});});});}function insertCmHopper(_0x4b822a,_0x415cf1,_0x1e4ee6,_0x501785,_0x27183f){var _0x22da5c=[_0xe065('0x29'),_0xe065('0x2a'),_0xe065('0x2b'),_0xe065('0x2c'),_0x415cf1+'.'+_0x501785,_0xe065('0x2d'),'cm_contacts.updatedAt',_0xe065('0x2e'),'cm_contacts.UserId','\x22'+_0x27183f+'\x22'];return squel[_0xe065('0x2f')]()[_0xe065('0x30')](_0xe065('0x31'))[_0xe065('0x32')]([_0xe065('0xe'),_0xe065('0x33'),'ContactId',_0xe065('0x34'),_0x501785,_0xe065('0x35'),_0xe065('0x36'),'priority',_0xe065('0x37'),_0xe065('0x38')],squel[_0xe065('0x39')]()[_0xe065('0x3a')](_0x22da5c)[_0xe065('0xf')](_0x415cf1)['join'](_0xe065('0x3b'),null,_0xe065('0x3c')+_0x415cf1+'.CmListId')[_0xe065('0x10')](_0x1e4ee6,null,_0x1e4ee6+'.id\x20=\x20'+_0x415cf1+'.'+_0x501785)[_0xe065('0x11')](_0x415cf1+_0xe065('0x3d'),_0x4b822a)['where'](_0xe065('0x3e'),NOW)[_0xe065('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x415cf1,_0x1e4ee6,_0x501785,_0xe065('0x31'),[_0xe065('0x3f'),_0xe065('0x40')]))[_0xe065('0x11')](_0xe065('0x41'),selectNotIn(_0x415cf1,_0x1e4ee6,_0x501785,_0xe065('0x31'),[_0xe065('0x3f')])))[_0xe065('0x42')]();}function insertCmHopperBlack(_0x3068f0,_0x445738,_0x326493,_0x4364c3){var _0x137627=['cm_contacts.phone','cm_contacts.id',_0xe065('0x2c'),_0x445738+'.'+_0x4364c3,_0xe065('0x2d'),'cm_contacts.updatedAt'];return squel[_0xe065('0x2f')]()[_0xe065('0x30')](_0xe065('0x43'))[_0xe065('0x32')]([_0xe065('0xe'),_0xe065('0x44'),_0xe065('0x34'),_0x4364c3,_0xe065('0x35'),_0xe065('0x36')],squel['select']()[_0xe065('0x3a')](_0x137627)[_0xe065('0xf')](_0x445738)[_0xe065('0x10')]('cm_contacts',null,_0xe065('0x3c')+_0x445738+_0xe065('0x45'))[_0xe065('0x10')](_0x326493,null,_0x326493+_0xe065('0x46')+_0x445738+'.'+_0x4364c3)['where'](_0x445738+_0xe065('0x3d'),_0x3068f0)[_0xe065('0x11')](_0xe065('0x3e'),NOW)[_0xe065('0x11')](_0xe065('0x41'),squel[_0xe065('0x39')]()[_0xe065('0x47')]('phone')[_0xe065('0xf')](_0xe065('0x43'))[_0xe065('0x11')](_0xe065('0x48'),_0x3068f0)[_0xe065('0x11')](_0x4364c3+_0xe065('0x49'),_0x445738+'.'+_0x4364c3)))[_0xe065('0x42')]();}function insertCmHopperAdditionalPhones(_0x4c0b32){var _0x1b51f9=['cm_hopper.id',_0xe065('0x4a'),_0xe065('0x4b'),_0xe065('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0xe065('0x2f')]()[_0xe065('0x30')](_0xe065('0x4d'))[_0xe065('0x32')]([_0xe065('0x4e'),_0xe065('0xe'),_0xe065('0x4f'),_0xe065('0x35'),_0xe065('0x36')],squel[_0xe065('0x39')]()[_0xe065('0x3a')](_0x1b51f9)[_0xe065('0xf')](_0xe065('0x31'))['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xe065('0x10')]('cm_contact_has_items',null,_0xe065('0x50'))[_0xe065('0x11')](_0xe065('0x51'),_0x4c0b32)['where'](_0xe065('0x3e'),NOW))[_0xe065('0x42')]();}function insertCmContact(_0x5cce78,_0x39f24b,_0x366d4b,_0x18c7de){var _0x15d40f=_[_0xe065('0x52')](_[_0xe065('0x53')](_0x18c7de),[_0xe065('0x34'),_0xe065('0x54'),_0xe065('0x35'),_0xe065('0x36')]);return squel['insert']()[_0xe065('0x30')](_0xe065('0x3b'))[_0xe065('0x32')](_0x15d40f,squel[_0xe065('0x39')]()['fields'](_0x15d40f)[_0xe065('0xf')](_0x39f24b)[_0xe065('0x11')]('('+_0x366d4b[_0xe065('0x10')](',')+_0xe065('0x55'),squel['select']()[_0xe065('0x3a')](_0x366d4b)[_0xe065('0xf')](_0xe065('0x3b'))['where'](_0xe065('0x48'),_0x5cce78))[_0xe065('0x11')](_0xe065('0x56'),squel[_0xe065('0x39')]()[_0xe065('0x47')](_0xe065('0x57'),_0xe065('0x58'))[_0xe065('0xf')](_0x39f24b)[_0xe065('0x59')](_0x366d4b['join'](','))))[_0xe065('0x42')]();}function handleStop(){logger['info'](_0xe065('0x5a'));stopped=!![];}function handleUncaughtException(_0x24fc1c){logger[_0xe065('0x5b')](_0x24fc1c['message']);process['exit'](0x1);}function handleError(_0x5e47d6,_0xda7f12){stats[_0xe065('0x5c')][_0xe065('0x1b')]({'name':_0xda7f12[_0xe065('0x5d')],'message':_0xda7f12[_0xe065('0x1e')],'row':_0x5e47d6});}function handleQuery(_0x431855){logger[_0xe065('0x5e')](_0x431855);return db[_0xe065('0x14')][_0xe065('0x15')](_0x431855)[_0xe065('0x17')](function(_0x25ec8a){results['push'](_0x25ec8a);})['catch'](function(_0x2fe0ac){logger[_0xe065('0x5b')](_0x2fe0ac['message']);});}function main(_0x276c17,_0x528bd0,_0x4f4dca,_0x1be0f2){logger[_0xe065('0x5e')](_0xe065('0x5f'),_0x276c17,JSON[_0xe065('0x60')](_0x528bd0));process[_0xe065('0x61')](_0xe065('0x62'));var _0x198e25=_0x528bd0['binding'];var _0x219fbc=_[_0xe065('0x63')](_0x198e25);var _0xaef095=_0x528bd0[_0xe065('0x64')];var _0x432def=path['join'](config[_0xe065('0x65')],_0xe065('0x66'),_0xaef095+_0xe065('0x67'));logger[_0xe065('0x5e')](_0xe065('0x68'),_0x528bd0);db[_0xe065('0x69')]['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x50f6e9){for(var _0x5c3d7a=0x0;_0x5c3d7a<_0x50f6e9[_0xe065('0x18')];_0x5c3d7a++){if(_0x50f6e9[_0x5c3d7a][_0xe065('0x6a')]in _0x198e25){contactItemTypes[_0xe065('0x1b')](_0x50f6e9[_0x5c3d7a]);delete _0x219fbc[_0x50f6e9[_0x5c3d7a][_0xe065('0x6a')]];hasAdditionalPhones=!![];}for(var _0x46bb53 in _0x198e25){if(_0x50f6e9[_0x5c3d7a][_0xe065('0x6a')]+_0xe065('0x6b')===_0x46bb53){phoneDescriptions[_0xe065('0x1b')]({'itemTypeId':_0x50f6e9[_0x5c3d7a]['id'],'description':_0x46bb53});delete _0x219fbc[_0x46bb53];}}}if(hasAdditionalPhones)_0x219fbc['AdditionalPhones']='';var _0x4c96d1=_[_0xe065('0x53')](_0x219fbc)[_0xe065('0x10')]();logger[_0xe065('0x5e')]('header',_0x4c96d1);fs[_0xe065('0x6c')](_0x432def,_0x4c96d1+'\x0a');Papa[_0xe065('0x6d')](fs[_0xe065('0x6e')](_0x276c17),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4765a0,_0x136e40){try{for(var _0x2c0b2e=0x0,_0xac5395=[];_0x2c0b2e<_0x4765a0[_0xe065('0x6f')][_0xe065('0x18')];_0x2c0b2e++){stats[_0xe065('0x70')]+=0x1;if(_0x4765a0[_0xe065('0x5c')][_0x2c0b2e]){handleError(_0x4765a0[_0xe065('0x6f')][_0x2c0b2e],_0x4765a0[_0xe065('0x5c')][_0x2c0b2e]);}else{var _0xc0ebe8=[];var _0x460431=[];var _0x23daec={};for(var _0x9e67c8 in _0x198e25){let _0x2dee53=contactItemTypes['find'](_0x31d6cb=>_0x31d6cb[_0xe065('0x6a')]===_0x9e67c8);let _0x233a43=contactItemTypes[_0xe065('0x71')](_0x36b88d=>_0x36b88d[_0xe065('0x6a')]+_0xe065('0x6b')===_0x9e67c8);if(_[_0xe065('0x19')](_0x2dee53)&&_[_0xe065('0x19')](_0x233a43)){if(_0x198e25[_0xe065('0x72')](_0x9e67c8)){if(_0x4765a0[_0xe065('0x6f')][_0x2c0b2e][_0x198e25[_0x9e67c8]]){var _0x3c024b=_[_0xe065('0x73')](_0x4765a0[_0xe065('0x6f')][_0x2c0b2e][_0x198e25[_0x9e67c8]][_0xe065('0x74')](/"/g,'\x27'));switch(_0x9e67c8){case _0xe065('0x33'):var _0x334c6c=moment(_0x3c024b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x334c6c[_0xe065('0x75')]()){_0xac5395[_0xe065('0x1b')]('\x22'+_0x3c024b+'\x22');}else{_0xc0ebe8[_0xe065('0x1b')](_0xe065('0x76'));}break;case _0xe065('0x77'):var _0x4686c9=parseInt(_0x3c024b);_0x3c024b=_[_0xe065('0x78')](_0x4686c9)||_0x4686c9<0x0||_0x4686c9>0x4?_0x1be0f2?0x3:0x2:_0x4686c9;_0xac5395[_0xe065('0x1b')]('\x22'+_0x3c024b+'\x22');break;case _0xe065('0x37'):var _0x3a9a23=parseInt(_0x3c024b);if(_['isNumber'](_0x3a9a23)&&_['includes'](_0x4f4dca,_0x3a9a23)){_0xac5395[_0xe065('0x1b')]('\x22'+_0x3a9a23+'\x22');}else{_0xc0ebe8['push'](_0xe065('0x79'));}break;case'email':if(isEmail(_0x3c024b)){_0xac5395[_0xe065('0x1b')]('\x22'+_0x3c024b+'\x22');}else{_0xc0ebe8[_0xe065('0x1b')](_0xe065('0x7a'));}break;case _0xe065('0x7b'):var _0x42cb90=moment(_0x3c024b,_0xe065('0x7c'),!![]);if(_0x42cb90[_0xe065('0x75')]()){_0xac5395[_0xe065('0x1b')]('\x22'+_0x3c024b+'\x22');}else{_0xc0ebe8[_0xe065('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0xac5395[_0xe065('0x1b')]('\x22'+_0x3c024b+'\x22');}}else{switch(_0x9e67c8){case _0xe065('0x7d'):case _0xe065('0xe'):_0xc0ebe8[_0xe065('0x1b')](_0x9e67c8+'\x20not\x20specified');break;default:_0xac5395[_0xe065('0x1b')]('\x22\x22');}}}}else{var _0x2fdaae='';if(!_[_0xe065('0x19')](_0x2dee53)){if(!_0x23daec['hasOwnProperty'](_0x2dee53['id'])){for(var _0x200d25=0x0;_0x200d25<_0x198e25[_0x9e67c8][_0xe065('0x18')];_0x200d25++){var _0x3c024b=_['trim'](_0x4765a0[_0xe065('0x6f')][_0x2c0b2e][_0x198e25[_0x9e67c8][_0x200d25]][_0xe065('0x74')](/"/g,'\x27'));var _0x5de58f=phoneDescriptions['find'](_0x2479ed=>_0x2479ed[_0xe065('0x7e')]===_0x2dee53['id']);if(!_[_0xe065('0x19')](_0x5de58f)){var _0x3f3878=_[_0xe065('0x73')](_0x4765a0['data'][_0x2c0b2e][_0x198e25[_0x5de58f['description']][0x0]][_0xe065('0x74')](/"/g,'\x27'));if(!_[_0xe065('0x19')](_0x3f3878))_0x3c024b=_0x3c024b+'§'+_0x3f3878;}if(_0x2fdaae=='')_0x2fdaae=_0x3c024b;else _0x2fdaae+='|'+_0x3c024b;}_0x460431['push'](_0x2dee53['id']+':'+_0x2fdaae);_0x23daec[_0x2dee53['id']]=0x1;}}}}if(hasAdditionalPhones){_0xac5395[_0xe065('0x1b')]('\x22'+_0x460431[_0xe065('0x10')](';')+'\x22');}if(_0xc0ebe8[_0xe065('0x18')]){handleError(_0x4765a0[_0xe065('0x6f')][_0x2c0b2e],{'code':_0xe065('0x7f'),'message':_0xc0ebe8[_0xe065('0x10')]()});}else{fs[_0xe065('0x80')](_0x432def,_0xac5395[_0xe065('0x10')]()+'\x0a');}_0xac5395=[];}if(!(stats[_0xe065('0x70')]%0xc8)){socket[_0xe065('0x81')]('contact:import:'+_0xaef095,stats);stats['errors']=[];}}if(stopped){logger[_0xe065('0x5e')](_0xe065('0x82'));_0x136e40[_0xe065('0x83')]();}}catch(_0x45b479){handleError(_0x4765a0[_0xe065('0x6f')][_0x2c0b2e],{'code':'SystemError','message':_0x45b479[_0xe065('0x1e')]});logger[_0xe065('0x5b')](_0xe065('0x84'),_0x45b479[_0xe065('0x1e')]);}},'complete':function(){try{var _0x13e316=[];var _0x124a32=tempTableName;_0x13e316[_0xe065('0x1b')](_0xe065('0x85')+_0x124a32+_0xe065('0x86'));logger[_0xe065('0x5e')](_0xe065('0x87'),contactItemTypes['length']);var _0x3e120c=util[_0xe065('0x9')](_0xe065('0x88'),_0x432def,_0x124a32,_0x4c96d1,_0x528bd0[_0xe065('0x34')],_0x528bd0[_0xe065('0x54')]||null,NOW,NOW);if(_[_0xe065('0x19')](_0x198e25[_0xe065('0x33')])){_0x3e120c+=_0xe065('0x89');}_0x13e316[_0xe065('0x1b')](_0x3e120c);BPromise[_0xe065('0x8a')](_0x13e316,handleQuery)[_0xe065('0x1d')](function(_0x3200ed){BPromise['all']([handleAdditionalPhones()])[_0xe065('0x1d')](function(){_0x13e316=[];for(var _0xf7982f=0x0;_0xf7982f\x20\x20','server/files/tmp','existsSync','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/logger','import','defaults','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','update','updated','create','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','ContactId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','insert','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','code'];(function(_0x525673,_0xb429c2){var _0x8f7574=function(_0xeb3bce){while(--_0xeb3bce){_0x525673['push'](_0x525673['shift']());}};_0x8f7574(++_0xb429c2);}(_0x8588,0x185));var _0x8858=function(_0x327261,_0x2c97b8){_0x327261=_0x327261-0x0;var _0x66ef06=_0x8588[_0x327261];return _0x66ef06;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8858('0x0'));var Papa=require(_0x8858('0x1'));var util=require(_0x8858('0x2'));var BPromise=require(_0x8858('0x3'));var moment=require('moment');var squel=require(_0x8858('0x4'));var Redis=require(_0x8858('0x5'));var db=require(_0x8858('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x8858('0x7'))(_0x8858('0x8'));config['redis']=_[_0x8858('0x9')](config[_0x8858('0xa')],{'host':_0x8858('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x8858('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x8858('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x59a68f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x8858('0xe')](_0x59a68f);}function selectNotIn(_0x3a014a,_0x59e67e,_0x5e3270,_0x3ac955,_0x31d1c0){return squel[_0x8858('0xf')]()[_0x8858('0x10')](_0x8858('0x11'))[_0x8858('0x12')](_0x3ac955)[_0x8858('0x13')](_0x59e67e,null,_0x59e67e+_0x8858('0x14')+_0x3ac955+'.'+_0x5e3270)[_0x8858('0x15')](_0x3ac955+'.'+_0x5e3270+_0x8858('0x16')+_0x3a014a+'.'+_0x5e3270)[_0x8858('0x15')](_0x59e67e+_0x8858('0x17')+_0x31d1c0[_0x8858('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x424f1d,_0x1b7b6a){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x8858('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x8858('0x19')](function(_0x22b356){if(_0x22b356!==null){var _0x1cab6a=[];for(var _0x3b7d14=0x0;_0x3b7d14<_0x22b356[_0x8858('0x1a')];_0x3b7d14++){var _0x3c94b3=_0x22b356[_0x3b7d14];if(!_[_0x8858('0x1b')](_0x3c94b3[_0x8858('0x11')])){if(!_[_0x8858('0x1b')](_0x3c94b3[_0x8858('0x1c')]))_0x1cab6a['push'](insertAdditionalPhones(_0x3c94b3));promisesContact[_0x8858('0x1d')]({'contact':_0x3c94b3});}}}Promise[_0x8858('0x1e')](_0x1cab6a)[_0x8858('0x1f')](function(){_0x424f1d({'val':0x1});});})[_0x8858('0x20')](function(_0xa3f23e){logger[_0x8858('0x21')](_0xa3f23e[_0x8858('0x22')]);});});}function insertAdditionalPhones(_0x28336a){return new Promise(function(_0x837d58,_0x19c37d){var _0x2b3786=_0x28336a[_0x8858('0x1c')];if(_[_0x8858('0x1b')](_0x2b3786))_0x19c37d({'val':0x0});else{var _0x169487=_0x2b3786['split'](';');var _0x55ec5b=[];orderBy=0x0;for(var _0x1e7ee=0x0;_0x1e7ee<_0x169487['length'];_0x1e7ee++){_0x55ec5b[_0x8858('0x1d')](splitAdditionalPhone(_0x28336a['id'],_0x169487[_0x1e7ee]));}Promise[_0x8858('0x1e')](_0x55ec5b)[_0x8858('0x1f')](function(){_0x837d58({'val':_0x169487['length']});});}});}function splitAdditionalPhone(_0x4d7267,_0x4caccb){return new Promise(function(_0x1a6672,_0x1d3ee0){var _0x1bab62=_0x4caccb[_0x8858('0x23')](':');var _0x479254=_0x1bab62[0x0];var _0x113e0c=_0x1bab62[0x1];if(_0x113e0c!==''){var _0x160167=_0x113e0c[_0x8858('0x23')]('|');var _0x1303c5=[];for(var _0x1e8f99=0x0;_0x1e8f99<_0x160167[_0x8858('0x1a')];_0x1e8f99++){if(_0x160167[_0x1e8f99]!==''){var _0x3c763b=_[_0x8858('0x24')](promisesAdditionalPhones,{'contactId':_0x4d7267,'phone':_0x160167[_0x1e8f99]});if(_0x3c763b[_0x8858('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x8858('0x1d')]({'contactId':_0x4d7267,'contactTypeId':_0x479254,'phone':_0x160167[_0x1e8f99],'orderBy':orderBy});}}}_0x1a6672({'ok':0x1});}else _0x1a6672({'res':0x0});});}function createAdditionalPhone(_0x539596,_0x363fd2,_0x4e2459,_0x3f9191){var _0x2fa4f9='';var _0xba3171='';var _0x1aaae3=_0x4e2459[_0x8858('0x23')]('§');_0x2fa4f9=_0x1aaae3[0x0];if(_0x1aaae3['length']==0x2)_0xba3171=_0x1aaae3[0x1];return new Promise(function(_0xec2b,_0x4ce8b8){return db[_0x8858('0x25')]['findOne']({'where':{'CmContactId':_0x539596,'item':_0x2fa4f9}})[_0x8858('0x1f')](function(_0x4f00f8){if(_0x4f00f8){return db['CmContactHasItem'][_0x8858('0x26')]({'ItemTypeId':_0x363fd2,'description':_0xba3171,'OrderBy':_0x3f9191},{'where':{'CmContactId':_0x539596,'item':_0x2fa4f9}})['then'](function(_0x429730){_0xec2b({'res':_0x8858('0x27')});});}else{return db[_0x8858('0x25')][_0x8858('0x28')]({'CmContactId':_0x539596,'item':_0x2fa4f9,'ItemTypeId':_0x363fd2,'description':_0xba3171,'OrderBy':_0x3f9191,'ItemClass':_0x8858('0x29')})['then'](function(_0x1d0dd1){_0xec2b({'res':'inserted'});});}});});}function updateContact(_0x5b411b){return new Promise(function(_0x2dfacb,_0x354927){var _0xf4d436=_0x5b411b['id'];delete _0x5b411b['id'];return db[_0x8858('0x2a')]['update'](_0x5b411b,{'where':{'id':_0xf4d436}})[_0x8858('0x1f')](function(_0xd1bbf9){updatedRows+=0x1;return db[_0x8858('0x2b')][_0x8858('0x26')]({'phone':_0x5b411b[_0x8858('0x11')]},{'where':{'ContactId':_0xf4d436}})[_0x8858('0x1f')](function(_0x5be381){_0x2dfacb({'ret':'OK'});});});});}function insertCmHopper(_0xeab690,_0xb1b98,_0x4551c8,_0x238662,_0x3aa281){var _0xe64078=[_0x8858('0x2c'),_0x8858('0x2d'),_0x8858('0x2e'),_0x8858('0x2f'),_0xb1b98+'.'+_0x238662,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x8858('0x30'),_0x8858('0x31'),'\x22'+_0x3aa281+'\x22'];return squel['insert']()[_0x8858('0x32')](_0x8858('0x33'))[_0x8858('0x34')](['phone','scheduledat','ContactId',_0x8858('0x35'),_0x238662,_0x8858('0x36'),_0x8858('0x37'),_0x8858('0x38'),'UserId',_0x8858('0x39')],squel[_0x8858('0xf')]()[_0x8858('0x3a')](_0xe64078)[_0x8858('0x12')](_0xb1b98)['join'](_0x8858('0x3b'),null,_0x8858('0x3c')+_0xb1b98+_0x8858('0x3d'))[_0x8858('0x13')](_0x4551c8,null,_0x4551c8+_0x8858('0x14')+_0xb1b98+'.'+_0x238662)['where'](_0xb1b98+_0x8858('0x3e'),_0xeab690)[_0x8858('0x15')](_0x8858('0x3f'),NOW)[_0x8858('0x15')](_0x8858('0x40'),selectNotIn(_0xb1b98,_0x4551c8,_0x238662,_0x8858('0x33'),[_0x8858('0x41'),_0x8858('0x42')]))[_0x8858('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb1b98,_0x4551c8,_0x238662,_0x8858('0x33'),[_0x8858('0x41')])))[_0x8858('0x43')]();}function insertCmHopperBlack(_0xc6b4db,_0x5d33d0,_0x1bdead,_0x5e86bd){var _0x497fcd=[_0x8858('0x2c'),_0x8858('0x2e'),_0x8858('0x2f'),_0x5d33d0+'.'+_0x5e86bd,_0x8858('0x44'),_0x8858('0x45')];return squel['insert']()[_0x8858('0x32')](_0x8858('0x46'))['fromQuery']([_0x8858('0x11'),_0x8858('0x47'),_0x8858('0x35'),_0x5e86bd,_0x8858('0x36'),_0x8858('0x37')],squel[_0x8858('0xf')]()[_0x8858('0x3a')](_0x497fcd)[_0x8858('0x12')](_0x5d33d0)[_0x8858('0x13')](_0x8858('0x3b'),null,_0x8858('0x3c')+_0x5d33d0+_0x8858('0x3d'))[_0x8858('0x13')](_0x1bdead,null,_0x1bdead+_0x8858('0x14')+_0x5d33d0+'.'+_0x5e86bd)[_0x8858('0x15')](_0x5d33d0+_0x8858('0x3e'),_0xc6b4db)[_0x8858('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8858('0x15')](_0x8858('0x40'),squel['select']()[_0x8858('0x10')]('phone')[_0x8858('0x12')](_0x8858('0x46'))[_0x8858('0x15')]('ListId\x20=\x20?',_0xc6b4db)[_0x8858('0x15')](_0x5e86bd+'\x20=\x20?',_0x5d33d0+'.'+_0x5e86bd)))['toString']();}function insertCmHopperAdditionalPhones(_0x18fc7e){var _0x22bec1=[_0x8858('0x48'),_0x8858('0x49'),_0x8858('0x4a'),_0x8858('0x4b'),_0x8858('0x4c')];return squel[_0x8858('0x4d')]()['into']('cm_hopper_additional_phones')[_0x8858('0x34')]([_0x8858('0x4e'),_0x8858('0x11'),_0x8858('0x4f'),_0x8858('0x36'),'updatedAt'],squel[_0x8858('0xf')]()['fields'](_0x22bec1)[_0x8858('0x12')](_0x8858('0x33'))[_0x8858('0x13')](_0x8858('0x3b'),null,_0x8858('0x50'))[_0x8858('0x13')](_0x8858('0x51'),null,_0x8858('0x52'))[_0x8858('0x15')](_0x8858('0x53'),_0x18fc7e)[_0x8858('0x15')](_0x8858('0x3f'),NOW))['toString']();}function insertCmContact(_0xe6f5f5,_0x35153c,_0x575fda,_0x7ac427){var _0x3d54ee=_[_0x8858('0x54')](_[_0x8858('0x55')](_0x7ac427),[_0x8858('0x35'),_0x8858('0x56'),_0x8858('0x36'),_0x8858('0x37')]);return squel[_0x8858('0x4d')]()[_0x8858('0x32')](_0x8858('0x3b'))[_0x8858('0x34')](_0x3d54ee,squel[_0x8858('0xf')]()[_0x8858('0x3a')](_0x3d54ee)[_0x8858('0x12')](_0x35153c)[_0x8858('0x15')]('('+_0x575fda['join'](',')+_0x8858('0x57'),squel[_0x8858('0xf')]()[_0x8858('0x3a')](_0x575fda)['from'](_0x8858('0x3b'))[_0x8858('0x15')](_0x8858('0x58'),_0xe6f5f5))[_0x8858('0x15')](_0x8858('0x59'),squel[_0x8858('0xf')]()['field'](_0x8858('0x5a'),_0x8858('0x5b'))[_0x8858('0x12')](_0x35153c)[_0x8858('0x5c')](_0x575fda[_0x8858('0x13')](','))))[_0x8858('0x43')]();}function handleStop(){logger['info'](_0x8858('0x5d'));stopped=!![];}function handleUncaughtException(_0x5e63e0){logger[_0x8858('0x21')](_0x5e63e0[_0x8858('0x22')]);process[_0x8858('0x5e')](0x1);}function handleError(_0x4bcf7d,_0x41db9a){stats[_0x8858('0x5f')][_0x8858('0x1d')]({'name':_0x41db9a[_0x8858('0x60')],'message':_0x41db9a[_0x8858('0x22')],'row':_0x4bcf7d});}function handleQuery(_0x4c44b9){logger[_0x8858('0x61')](_0x4c44b9);return db[_0x8858('0x62')][_0x8858('0x18')](_0x4c44b9)[_0x8858('0x19')](function(_0x28bfae){results[_0x8858('0x1d')](_0x28bfae);})['catch'](function(_0x4fd963){logger['error'](_0x4fd963[_0x8858('0x22')]);});}function main(_0x440fa0,_0x2abac8,_0x239e73,_0x47df0d){logger['info']('main',_0x440fa0,JSON[_0x8858('0x63')](_0x2abac8));process[_0x8858('0x64')]('start');var _0x832470=_0x2abac8[_0x8858('0x65')];var _0x2e42ea=_[_0x8858('0x66')](_0x832470);var _0x44dcd6=_0x2abac8['socket_timestamp'];var _0x35917f=path['join'](config[_0x8858('0x67')],'server/files/tmp',_0x44dcd6+_0x8858('0x68'));logger[_0x8858('0x61')](_0x8858('0x69'),_0x2abac8);db[_0x8858('0x6a')][_0x8858('0x6b')]({'raw':!![],'attributes':['id',_0x8858('0x6c')]})[_0x8858('0x1f')](function(_0x313575){for(var _0x46d689=0x0;_0x46d689<_0x313575['length'];_0x46d689++){if(_0x313575[_0x46d689]['name']in _0x832470){contactItemTypes['push'](_0x313575[_0x46d689]);delete _0x2e42ea[_0x313575[_0x46d689]['name']];hasAdditionalPhones=!![];}for(var _0x3a369d in _0x832470){if(_0x313575[_0x46d689][_0x8858('0x6c')]+_0x8858('0x6d')===_0x3a369d){phoneDescriptions[_0x8858('0x1d')]({'itemTypeId':_0x313575[_0x46d689]['id'],'description':_0x3a369d});delete _0x2e42ea[_0x3a369d];}}}if(hasAdditionalPhones)_0x2e42ea[_0x8858('0x1c')]='';var _0x21b10b=_[_0x8858('0x55')](_0x2e42ea)[_0x8858('0x13')]();logger[_0x8858('0x61')](_0x8858('0x6e'),_0x21b10b);fs[_0x8858('0x6f')](_0x35917f,_0x21b10b+'\x0a');Papa[_0x8858('0x70')](fs[_0x8858('0x71')](_0x440fa0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4dbe59,_0x1b4f30){try{for(var _0x183d52=0x0,_0x3af3c9=[];_0x183d52<_0x4dbe59[_0x8858('0x72')][_0x8858('0x1a')];_0x183d52++){stats[_0x8858('0x73')]+=0x1;if(_0x4dbe59[_0x8858('0x5f')][_0x183d52]){handleError(_0x4dbe59['data'][_0x183d52],_0x4dbe59[_0x8858('0x5f')][_0x183d52]);}else{var _0xdc2cda=[];var _0x29d994=[];var _0x5b7820={};for(var _0x1dc215 in _0x832470){let _0x20d726=contactItemTypes[_0x8858('0x74')](_0x1b16ac=>_0x1b16ac[_0x8858('0x6c')]===_0x1dc215);let _0x49c362=contactItemTypes['find'](_0x5cb3ca=>_0x5cb3ca[_0x8858('0x6c')]+_0x8858('0x6d')===_0x1dc215);if(_['isNil'](_0x20d726)&&_[_0x8858('0x1b')](_0x49c362)){if(_0x832470['hasOwnProperty'](_0x1dc215)){if(_0x4dbe59['data'][_0x183d52][_0x832470[_0x1dc215]]){var _0x266348=_['trim'](_0x4dbe59[_0x8858('0x72')][_0x183d52][_0x832470[_0x1dc215]]['replace'](/"/g,'\x27'));switch(_0x1dc215){case _0x8858('0x75'):var _0x2d2c6f=moment(_0x266348,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2d2c6f['isValid']()){_0x3af3c9[_0x8858('0x1d')]('\x22'+_0x266348+'\x22');}else{_0xdc2cda[_0x8858('0x1d')](_0x8858('0x76'));}break;case _0x8858('0x38'):var _0xdf02ea=parseInt(_0x266348);_0x266348=_[_0x8858('0x77')](_0xdf02ea)||_0xdf02ea<0x0||_0xdf02ea>0x4?_0x47df0d?0x3:0x2:_0xdf02ea;_0x3af3c9['push']('\x22'+_0x266348+'\x22');break;case'UserId':var _0x15f3be=parseInt(_0x266348);if(_[_0x8858('0x78')](_0x15f3be)&&_[_0x8858('0x79')](_0x239e73,_0x15f3be)){_0x3af3c9[_0x8858('0x1d')]('\x22'+_0x15f3be+'\x22');}else{_0xdc2cda[_0x8858('0x1d')]('agent\x20not\x20exists');}break;case _0x8858('0x7a'):if(isEmail(_0x266348)){_0x3af3c9[_0x8858('0x1d')]('\x22'+_0x266348+'\x22');}else{_0xdc2cda['push'](_0x8858('0x7b'));}break;case _0x8858('0x7c'):var _0xe93832=moment(_0x266348,'YYYY-MM-DD',!![]);if(_0xe93832[_0x8858('0x7d')]()){_0x3af3c9[_0x8858('0x1d')]('\x22'+_0x266348+'\x22');}else{_0xdc2cda['push'](_0x8858('0x7e'));}break;default:_0x3af3c9[_0x8858('0x1d')]('\x22'+_0x266348+'\x22');}}else{switch(_0x1dc215){case _0x8858('0x7f'):case _0x8858('0x11'):_0xdc2cda['push'](_0x1dc215+'\x20not\x20specified');break;default:_0x3af3c9[_0x8858('0x1d')]('\x22\x22');}}}}else{var _0x4a6139='';if(!_['isNil'](_0x20d726)){if(!_0x5b7820[_0x8858('0x80')](_0x20d726['id'])){for(var _0x4cb7be=0x0;_0x4cb7be<_0x832470[_0x1dc215][_0x8858('0x1a')];_0x4cb7be++){var _0x266348=_['trim'](_0x4dbe59[_0x8858('0x72')][_0x183d52][_0x832470[_0x1dc215][_0x4cb7be]][_0x8858('0x81')](/"/g,'\x27'));var _0x4d6555=phoneDescriptions[_0x8858('0x74')](_0x1f3742=>_0x1f3742[_0x8858('0x82')]===_0x20d726['id']);if(!_[_0x8858('0x1b')](_0x4d6555)){var _0x15bb94=_['trim'](_0x4dbe59[_0x8858('0x72')][_0x183d52][_0x832470[_0x4d6555['description']][0x0]][_0x8858('0x81')](/"/g,'\x27'));if(!_[_0x8858('0x1b')](_0x15bb94))_0x266348=_0x266348+'§'+_0x15bb94;}if(_0x4a6139=='')_0x4a6139=_0x266348;else _0x4a6139+='|'+_0x266348;}_0x29d994[_0x8858('0x1d')](_0x20d726['id']+':'+_0x4a6139);_0x5b7820[_0x20d726['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3af3c9[_0x8858('0x1d')]('\x22'+_0x29d994['join'](';')+'\x22');}if(_0xdc2cda[_0x8858('0x1a')]){handleError(_0x4dbe59[_0x8858('0x72')][_0x183d52],{'code':_0x8858('0x83'),'message':_0xdc2cda[_0x8858('0x13')]()});}else{fs['appendFileSync'](_0x35917f,_0x3af3c9[_0x8858('0x13')]()+'\x0a');}_0x3af3c9=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x8858('0x84')+_0x44dcd6,stats);stats[_0x8858('0x5f')]=[];}}if(stopped){logger[_0x8858('0x61')](_0x8858('0x85'));_0x1b4f30[_0x8858('0x86')]();}}catch(_0x1b1ebe){handleError(_0x4dbe59[_0x8858('0x72')][_0x183d52],{'code':_0x8858('0x87'),'message':_0x1b1ebe[_0x8858('0x22')]});logger['error'](_0x8858('0x88'),_0x1b1ebe[_0x8858('0x22')]);}},'complete':function(){try{var _0x340f95=[];var _0x5a296b=tempTableName;_0x340f95[_0x8858('0x1d')](_0x8858('0x89')+_0x5a296b+_0x8858('0x8a'));logger[_0x8858('0x61')](_0x8858('0x8b'),contactItemTypes[_0x8858('0x1a')]);var _0x4c6a3b=util['format'](_0x8858('0x8c'),_0x35917f,_0x5a296b,_0x21b10b,_0x2abac8[_0x8858('0x35')],_0x2abac8[_0x8858('0x56')]||null,NOW,NOW);if(_[_0x8858('0x1b')](_0x832470[_0x8858('0x75')])){_0x4c6a3b+=_0x8858('0x8d');}_0x340f95[_0x8858('0x1d')](_0x4c6a3b);BPromise['each'](_0x340f95,handleQuery)['then'](function(_0x3b8108){BPromise[_0x8858('0x1e')]([handleAdditionalPhones()])[_0x8858('0x1f')](function(){_0x340f95=[];for(var _0x2b189e=0x0;_0x2b189e\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','toString','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?','Sequelize','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','search','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','select','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','conditions','find','buildExpression','type','default','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','split','map','clause','tags','User','user','UserId','plainBody','some','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Accounts','agent','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','SELECT','query','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','Account.email','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb248,0xc6));var _0x8b24=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb248[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x8b24('0x0'));var squel=require('squel');var as=require(_0x8b24('0x1'));var qs=require(_0x8b24('0x2'));var updateInteraction=require(_0x8b24('0x3'))[_0x8b24('0x4')];var utils=require('./utils');var db=require(_0x8b24('0x5'))['db'];function skipInteractionsQuery(_0x4438f7,_0x5d4103,_0x253441){var _0x2b605d=![];var _0x4cc3c4=utils[_0x8b24('0x6')](_0x4438f7);if(_0x5d4103[_0x8b24('0x7')]==='agent'&&!_0x253441[_0x8b24('0x8')]&&!_0x253441[_0x4cc3c4]){_0x2b605d=!![];}return _0x2b605d;}function getTagsQuery(){return squel['select']()[_0x8b24('0x9')]('id')[_0x8b24('0x9')](_0x8b24('0xa'))['field'](_0x8b24('0xb'))[_0x8b24('0xc')](_0x8b24('0xd'));}function getUsersQuery(_0x2edeb7,_0x3847bd){var _0xc773bf=utils[_0x8b24('0xe')](_0x2edeb7);var _0x641713=_0x8b24('0xf')+_0x2edeb7+_0x8b24('0x10');var _0x273ecc=squel[_0x8b24('0x11')]()[_0x8b24('0x9')](_0x8b24('0x12'))['field']('u.fullname')[_0x8b24('0x9')](_0x8b24('0x13')+_0xc773bf)[_0x8b24('0xc')](_0x641713,'ui')[_0x8b24('0x14')](_0x8b24('0x15'),'u',_0x8b24('0x16'));if(_0x3847bd[_0x8b24('0x17')]>0x0){_0x273ecc[_0x8b24('0x18')]('ui.'+_0xc773bf+'\x20IN\x20?',_['map'](_0x3847bd,'id'));}return _0x273ecc;}function getInteractionsQuery(_0xfe489b){var _0x523863=utils['getInteractionsTables'](_0xfe489b);var _0xafc423=utils[_0x8b24('0x6')](_0xfe489b);var _0x527af7=utils[_0x8b24('0xe')](_0xfe489b);return squel['select']()[_0x8b24('0xc')](_0x523863['interactions'],'i')[_0x8b24('0x14')]('cm_contacts','c',_0x8b24('0x19'))[_0x8b24('0x14')](_0x8b24('0x15'),'o',_0x8b24('0x1a'))[_0x8b24('0x14')](_0x523863[_0x8b24('0x1b')],'a',_0x8b24('0x1c')+_0xafc423)['left_join'](_0x523863[_0x8b24('0x1d')],'me',_0x8b24('0x1e')+_0x527af7+'\x20=\x20i.id')[_0x8b24('0x14')](_0x523863[_0x8b24('0x1f')],'it',_0x8b24('0x20')+_0x527af7+_0x8b24('0x21'))[_0x8b24('0x14')](_0x8b24('0xd'),'t',_0x8b24('0x22'));}function getSqlClauses(){var _0x3fddf8={'body':squel[_0x8b24('0x23')](),'contact':squel[_0x8b24('0x23')](),'default':squel[_0x8b24('0x23')](),'fields':squel[_0x8b24('0x23')](),'filter':squel[_0x8b24('0x23')](),'read':squel[_0x8b24('0x23')](),'tags':{'clause':squel[_0x8b24('0x23')](),'ids':null},'user':squel[_0x8b24('0x23')]()};return _0x3fddf8;}function parseTagParameter(_0x1fe79f){var _0x1a62e9=squel[_0x8b24('0x23')]();if(_0x1fe79f){var _0x279837=utils[_0x8b24('0x24')](_0x1fe79f);_0x279837[_0x8b24('0x25')](function(_0x2be377){_0x1a62e9['or'](_0x8b24('0x26'),'%,'+_0x2be377+',%');});}return _0x1a62e9;}function parseReadParameter(_0x1934d2){var _0x364f3a='';if(_0x1934d2){_0x364f3a=_0x8b24('0x27');if(_0x1934d2==='1'){_0x364f3a=_0x364f3a[_0x8b24('0x28')]('{OPERATOR}','=');}else{_0x364f3a=_0x364f3a[_0x8b24('0x28')](_0x8b24('0x29'),'>');}}return _0x364f3a;}function parseSearchFilter(_0xadbba0,_0x14316c){var _0x3be949=squel[_0x8b24('0x23')]();if(_0x14316c){var _0x1ab949=_0x14316c['replace']('\x5c','\x5c\x5c')[_0x8b24('0x28')](/'/g,'\x27\x27');if(qs[_0x8b24('0x2a')](_0x1ab949)){_0x3be949['or'](_0x8b24('0x2b'),_0x1ab949+'%');if(['sms','whatsapp']['includes'](_0xadbba0)){_0x3be949['or'](_0x8b24('0x2c'),_0x1ab949+'%');}else if(_0xadbba0===_0x8b24('0x2d')){_0x3be949['or'](_0x8b24('0x2e'),_0x1ab949+'%');}else if(_0xadbba0===_0x8b24('0x2f')){_0x3be949['or'](_0x8b24('0x30'),_0x1ab949+'%');}}else if(_0xadbba0===_0x8b24('0x31')&&qs[_0x8b24('0x32')](_0x1ab949)){_0x3be949['or'](_0x8b24('0x33'),_0x1ab949+'%');}else{if(_0xadbba0===_0x8b24('0x31')){_0x3be949['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8b24('0x34')](_0x1ab949))['or'](_0x8b24('0x35'),qs[_0x8b24('0x34')](_0x1ab949));}else{if(_0xadbba0!=='fax'){_0x3be949['or'](_0x8b24('0x36'),qs[_0x8b24('0x34')](_0x1ab949));}_0x3be949['or'](_0x8b24('0x37'),_0x1ab949+'%');}}}return _0x3be949;}function parseAdvancedSearchFilter(_0x3567b2,_0x446bb2){var _0x3fbf90=getSqlClauses();var _0x40c6de=as[_0x8b24('0x38')](_0x3567b2);var _0x42fc91=_0x40c6de['sqlOperator'];for(var _0xdb46f5=0x0;_0xdb46f5<_0x40c6de[_0x8b24('0x39')]['length'];_0xdb46f5++){var _0x252e10=_0x40c6de[_0x8b24('0x39')][_0xdb46f5];var _0x56bbd6='i';var _0x467e47=_[_0x8b24('0x3a')](_0x446bb2,[_0x8b24('0xa'),_0x252e10[_0x8b24('0x9')]]);if(_0x467e47){var _0x51a2f3=as[_0x8b24('0x3b')](_0x56bbd6,_0x467e47[_0x8b24('0x3c')],_0x252e10);_0x3fbf90[_0x8b24('0x3d')][_0x42fc91](_0x51a2f3[_0x8b24('0x3e')],_0x51a2f3[_0x8b24('0x3f')][_0x8b24('0x40')],_0x51a2f3['value'][_0x8b24('0x41')]);}else{switch(_0x252e10[_0x8b24('0x9')]){case _0x8b24('0x42'):var _0x1e79aa=parseReadParameter(_0x252e10[_0x8b24('0x3f')]);_0x3fbf90[_0x8b24('0x43')][_0x8b24('0x44')](_0x1e79aa);break;case _0x8b24('0x45'):if(_0x252e10[_0x8b24('0x46')]===_0x8b24('0x47')){if(_0x252e10[_0x8b24('0x3f')]['split']('\x20')[_0x8b24('0x17')]>0x1){_0x3fbf90['contact'][_0x42fc91](_0x8b24('0x48'),qs[_0x8b24('0x34')](_0x252e10[_0x8b24('0x3f')]),null);}else{var _0x5397aa='%'+_0x252e10[_0x8b24('0x3f')]+'%';_0x3fbf90[_0x8b24('0x49')][_0x42fc91](_0x8b24('0x4a'),_0x5397aa,_0x5397aa,_0x5397aa);}}else{_0x467e47=_['find'](_0x446bb2,[_0x8b24('0xa'),'ContactId']);_0x252e10['field']=_0x8b24('0x4b');_0x51a2f3=as['buildExpression'](_0x56bbd6,_0x467e47['type'],_0x252e10);_0x3fbf90[_0x8b24('0x49')][_0x42fc91](_0x51a2f3[_0x8b24('0x3e')],_0x51a2f3[_0x8b24('0x3f')][_0x8b24('0x40')],_0x51a2f3[_0x8b24('0x3f')][_0x8b24('0x41')]);}break;case _0x8b24('0x4c'):var _0x5688a9=_0x252e10['value'][_0x8b24('0x4d')](',')[_0x8b24('0x4e')](function(_0x1752b0){return Number(_0x1752b0);});var _0x33eeb2=parseTagParameter(_0x5688a9);_0x3fbf90['tags'][_0x8b24('0x4f')][_0x8b24('0x44')](_0x33eeb2);_0x3fbf90[_0x8b24('0x50')]['ids']=_0x5688a9;break;case _0x8b24('0x51'):if(_0x252e10['operator']===_0x8b24('0x47')){_0x3fbf90[_0x8b24('0x52')][_0x42fc91]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x252e10[_0x8b24('0x3f')]+'%',null);}else{_0x467e47=_[_0x8b24('0x3a')](_0x446bb2,[_0x8b24('0xa'),_0x8b24('0x53')]);_0x252e10[_0x8b24('0x9')]=_0x8b24('0x53');_0x51a2f3=as[_0x8b24('0x3b')](_0x56bbd6,_0x467e47[_0x8b24('0x3c')],_0x252e10);_0x3fbf90[_0x8b24('0x52')][_0x42fc91](_0x51a2f3[_0x8b24('0x3e')],_0x51a2f3[_0x8b24('0x3f')][_0x8b24('0x40')],_0x51a2f3['value'][_0x8b24('0x41')]);}break;case'body':case _0x8b24('0x54'):_0x51a2f3=as[_0x8b24('0x3b')]('me',null,_0x252e10);_0x3fbf90['body'][_0x42fc91](_0x51a2f3['text'],_0x51a2f3[_0x8b24('0x3f')][_0x8b24('0x40')],_0x51a2f3[_0x8b24('0x3f')][_0x8b24('0x41')]);break;}}}return _0x3fbf90;}function parseModelFields(_0x407b2f,_0x22619e,_0x3d0d0b){var _0xf99c26=utils['getAccountFK'](_0x407b2f);var _0x478a0b=squel['expr']();var _0x3cacf8=_(_0x22619e)['keys']()[_0x8b24('0x4e')](function(_0x3f5462){return _[_0x8b24('0x55')](_0x3d0d0b,[_0x8b24('0xa'),_0x3f5462])?_0x3f5462:undefined;})['compact']()[_0x8b24('0x3f')]();if(_0x3cacf8[_0x8b24('0x17')]>0x0){_0x3cacf8[_0x8b24('0x25')](function(_0x2d5164){if(_0x2d5164===_0xf99c26){_0x478a0b[_0x8b24('0x44')]('i.'+_0xf99c26+_0x8b24('0x56'),[][_0x8b24('0x57')](_0x22619e[_0x2d5164]));}else if(_0x2d5164===_0x8b24('0x58')){var _0x31fcf6=JSON[_0x8b24('0x59')](_0x22619e[_0x2d5164])[_0x8b24('0x5a')];var _0x1f4882=JSON[_0x8b24('0x59')](_0x22619e[_0x2d5164])[_0x8b24('0x5b')];_0x478a0b[_0x8b24('0x44')](_0x8b24('0x5c'),_0x31fcf6,_0x1f4882);}else{if(_0x22619e[_0x2d5164]===_0x8b24('0x5d')){_0x478a0b['and']('i.'+_0x2d5164+_0x8b24('0x5e'));}else{_0x478a0b[_0x8b24('0x44')]('i.'+_0x2d5164+_0x8b24('0x5f'),_0x22619e[_0x2d5164]);}}});}return _0x478a0b;}function parseQueryParameters(_0x3dcec6,_0x4bac9f,_0x475d53){var _0xa16ed6=getSqlClauses();return Promise[_0x8b24('0x60')]()[_0x8b24('0x61')](function(){return parseModelFields(_0x3dcec6,_0x4bac9f,_0x475d53);})[_0x8b24('0x61')](function(_0x147d84){_0xa16ed6[_0x8b24('0x62')][_0x8b24('0x44')](_0x147d84);return parseReadParameter(_0x4bac9f[_0x8b24('0x43')]);})[_0x8b24('0x61')](function(_0x3cb3a7){_0xa16ed6[_0x8b24('0x43')][_0x8b24('0x44')](_0x3cb3a7);return parseTagParameter(_0x4bac9f[_0x8b24('0x63')]);})[_0x8b24('0x61')](function(_0x43a00e){_0xa16ed6['tags']['clause']['and'](_0x43a00e);return parseSearchFilter(_0x3dcec6,_0x4bac9f[_0x8b24('0x64')]);})['then'](function(_0x5a507a){_0xa16ed6[_0x8b24('0x64')]=_0x5a507a;return _0xa16ed6;});}function checkAccountsRestrictions(_0x124478,_0x4b46b1,_0x37eac0){var _0x6e0a03=utils[_0x8b24('0x6')](_0x124478);var _0x1d4daa=_0x8b24('0x65')+_[_0x8b24('0x66')](_0x124478)+(_0x124478===_0x8b24('0x67')?'Websites':_0x8b24('0x68'));var _0x405172=squel[_0x8b24('0x23')]();return Promise['resolve']()['then'](function(){if(_0x37eac0[_0x8b24('0x8')]&&_0x4b46b1[_0x8b24('0x7')]===_0x8b24('0x69')){return _0x4b46b1[_0x1d4daa]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1743b0){if(_0x1743b0){if(_0x1743b0['length']===0x0){_0x405172[_0x8b24('0x44')]('i.'+_0x6e0a03+_0x8b24('0x5e'));}else{_0x405172[_0x8b24('0x44')]('i.'+_0x6e0a03+_0x8b24('0x56'),_[_0x8b24('0x4e')](_0x1743b0,'id'));}}else if(!_0x37eac0[_0x6e0a03]){_0x405172['and']('i.'+_0x6e0a03+_0x8b24('0x6a'));}})[_0x8b24('0x61')](function(){return _0x405172;});}function getClosedOrderClause(_0x2662b9,_0xe7ca10){var _0x948e8='';var _0x4f9cf3=['i.thirdDisposition',_0x8b24('0x6b'),_0x8b24('0x6c')];if(_0x2662b9===_0x8b24('0x31')){_0x4f9cf3['unshift'](_0x8b24('0x6d'));}if(_0xe7ca10[_0x8b24('0x6e')]==='0'&&_0x2662b9==='mail'){_0x948e8='i.substatus';}else{if(_0xe7ca10[_0x8b24('0x6e')]==='1'){_0x4f9cf3[_0x8b24('0x6f')]();}_0x948e8=_0x8b24('0x70')+_0x4f9cf3[_0x8b24('0x71')](',\x20')+')';}return _0x948e8;}function getFilteredInteractions(_0x1820ad,_0x45be82,_0x536667,_0x455127){var _0x393ffe=utils['getInteractionFK'](_0x1820ad);var _0xe818f6=_[_0x8b24('0x66')](_0x1820ad)+_0x8b24('0x72');var _0x7c2917=[];var _0x14ca5b=getTagsQuery();var _0x57537a={'type':db['Sequelize'][_0x8b24('0x73')][_0x8b24('0x74')],'raw':!![]};var _0x5adb3e=[];var _0x725151=[];return db['sequelize'][_0x8b24('0x75')](_0x14ca5b['toString'](),_0x57537a)['then'](function(_0x25b5a4){_0x7c2917=_[_0x8b24('0x76')](_0x25b5a4,'id');_0x57537a=_['merge'](_0x57537a,{'model':db[_0xe818f6],'mapToModel':!![],'nest':!![]});if(_0x536667[_0x8b24('0x62')]){_0x455127['attributes'][_0x8b24('0x25')](function(_0x4a51bd){_0x45be82[_0x8b24('0x9')]('i.'+_0x4a51bd);});}else{_0x45be82[_0x8b24('0x9')](_0x8b24('0x77'),_0x8b24('0x42'));_0x45be82['field'](_0x8b24('0x78'),_0x8b24('0x79'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x7a'),'Account.mandatoryDisposition');if(_0x1820ad===_0x8b24('0x31')){_0x45be82[_0x8b24('0x9')](_0x8b24('0x7b'),_0x8b24('0x7c'));_0x45be82['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x45be82[_0x8b24('0x9')](_0x8b24('0x7d'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x7e'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x7f'));_0x45be82['field'](_0x8b24('0x80'));_0x45be82['field'](_0x8b24('0x81'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x82'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x83'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x84'));_0x45be82['field']('i.subject');_0x45be82[_0x8b24('0x9')]('i.disposition');_0x45be82[_0x8b24('0x9')]('i.secondDisposition');_0x45be82[_0x8b24('0x9')](_0x8b24('0x85'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x6d'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x86'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x87'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x88'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x89'));}else if(_0x1820ad===_0x8b24('0x2f')){_0x45be82[_0x8b24('0x9')](_0x8b24('0x8a'),_0x8b24('0x8b'));}else{_0x45be82[_0x8b24('0x9')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8b24('0x8b'));}if(_0x1820ad!=='mail'){_0x45be82[_0x8b24('0x9')](_0x8b24('0x8c'));}_0x45be82[_0x8b24('0x9')](_0x8b24('0x8d'),_0x8b24('0x8e'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x8f'),_0x8b24('0x90'));_0x45be82['field']('c.email',_0x8b24('0x91'));_0x45be82[_0x8b24('0x9')]('c.phone','Contact.phone');_0x45be82[_0x8b24('0x9')]('c.mobile',_0x8b24('0x92'));_0x45be82['field'](_0x8b24('0x93'),_0x8b24('0x94'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x95'),_0x8b24('0x96'));_0x45be82[_0x8b24('0x9')]('o.internal',_0x8b24('0x97'));_0x45be82[_0x8b24('0x9')](_0x8b24('0x98'),_0x8b24('0x99'));}if(_0x455127[_0x8b24('0x9a')]){_0x45be82['limit'](_0x455127[_0x8b24('0x9a')]);}if(_0x455127[_0x8b24('0x9b')]){_0x45be82[_0x8b24('0x9b')](_0x455127['offset']);}return db[_0x8b24('0x9c')][_0x8b24('0x75')](_0x45be82[_0x8b24('0x9d')](),_0x57537a);})[_0x8b24('0x61')](function(_0x1a0c39){_0x5adb3e=_0x1a0c39;var _0x41aea0=getUsersQuery(_0x1820ad,_0x5adb3e);return db[_0x8b24('0x9c')][_0x8b24('0x75')](_0x41aea0[_0x8b24('0x9d')](),_0x57537a);})[_0x8b24('0x61')](function(_0x4a742f){_0x725151=_[_0x8b24('0x9e')](_0x4a742f,_0x393ffe);if(_0x1820ad===_0x8b24('0x31')){return db[_0x8b24('0x9f')][_0x8b24('0xa0')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x2059a6){var _0x59d68c=_0x2059a6?_0x2059a6[_0x8b24('0xa1')]:undefined;var _0x144b52=_0x5adb3e['map'](function(_0x5c90ea){return updateInteraction(_0x5c90ea,_0x7c2917,_0x725151,_0x59d68c);});return Promise['all'](_0x144b52);});}function countFilteredInteractions(_0x11b7d6,_0x3979bc){var _0x55e4d6=_0x11b7d6[_0x8b24('0xa2')]();_0x55e4d6[_0x8b24('0x9')](_0x8b24('0xa3'));_0x55e4d6[_0x8b24('0x9')](_0x8b24('0x77'),_0x8b24('0x42'));var _0x56d1da=utils[_0x8b24('0x24')](_0x3979bc);if(!_['isEmpty'](_0x56d1da)){_0x55e4d6[_0x8b24('0x18')](_0x8b24('0xa4'),_0x56d1da);}var _0x343a37={'type':db[_0x8b24('0xa5')][_0x8b24('0x73')][_0x8b24('0x74')],'raw':!![]};return db[_0x8b24('0x9c')][_0x8b24('0x75')](_0x55e4d6[_0x8b24('0x9d')](),_0x343a37);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x00b3=['join','capitalize','Interaction','QueryTypes','SELECT','sequelize','query','toString','keyBy','attributes','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','findOne','enableEmailPreview','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','getAccountFK','search','field','name','from','tools_tags','getInteractionFK','user_has_','select','u.id','u.fullname','ui.','length','where','\x20IN\x20?','getInteractionsTables','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','isEmail','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','conditions','find','type','default','value','end','unreadMessages','and','Contact','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','text','start','Tag','map','tags','ids','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','plainBody','keys','some','compact','forEach','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','tag','clause','filter','get','chat','Accounts','role','agent','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20'];(function(_0x240cca,_0x392017){var _0x118f2c=function(_0x2a42de){while(--_0x2a42de){_0x240cca['push'](_0x240cca['shift']());}};_0x118f2c(++_0x392017);}(_0x00b3,0x17a));var _0x300b=function(_0x2c23bc,_0x12d31a){_0x2c23bc=_0x2c23bc-0x0;var _0x132c67=_0x00b3[_0x2c23bc];return _0x132c67;};'use strict';var _=require('lodash');var squel=require(_0x300b('0x0'));var as=require(_0x300b('0x1'));var qs=require(_0x300b('0x2'));var updateInteraction=require(_0x300b('0x3'))['updateInteraction'];var utils=require(_0x300b('0x4'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x245c32,_0x524b8d,_0x1be801){var _0x3861ea=![];var _0x3a8c64=utils[_0x300b('0x5')](_0x245c32);if(_0x524b8d['role']==='agent'&&!_0x1be801[_0x300b('0x6')]&&!_0x1be801[_0x3a8c64]){_0x3861ea=!![];}return _0x3861ea;}function getTagsQuery(){return squel['select']()['field']('id')[_0x300b('0x7')](_0x300b('0x8'))[_0x300b('0x7')]('color')[_0x300b('0x9')](_0x300b('0xa'));}function getUsersQuery(_0x243abf,_0x212b2b){var _0x566fb9=utils[_0x300b('0xb')](_0x243abf);var _0x2eeb2d=_0x300b('0xc')+_0x243abf+'_interactions';var _0x42282f=squel[_0x300b('0xd')]()[_0x300b('0x7')](_0x300b('0xe'))[_0x300b('0x7')](_0x300b('0xf'))[_0x300b('0x7')](_0x300b('0x10')+_0x566fb9)['from'](_0x2eeb2d,'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');if(_0x212b2b[_0x300b('0x11')]>0x0){_0x42282f[_0x300b('0x12')](_0x300b('0x10')+_0x566fb9+_0x300b('0x13'),_['map'](_0x212b2b,'id'));}return _0x42282f;}function getInteractionsQuery(_0x509089){var _0x35b1d7=utils[_0x300b('0x14')](_0x509089);var _0x2fed99=utils[_0x300b('0x5')](_0x509089);var _0x4d2024=utils[_0x300b('0xb')](_0x509089);return squel[_0x300b('0xd')]()[_0x300b('0x9')](_0x35b1d7['interactions'],'i')[_0x300b('0x15')](_0x300b('0x16'),'c',_0x300b('0x17'))[_0x300b('0x15')]('users','o',_0x300b('0x18'))[_0x300b('0x15')](_0x35b1d7[_0x300b('0x19')],'a','a.id\x20=\x20i.'+_0x2fed99)[_0x300b('0x15')](_0x35b1d7[_0x300b('0x1a')],'me',_0x300b('0x1b')+_0x4d2024+_0x300b('0x1c'))[_0x300b('0x15')](_0x35b1d7['interactionsTags'],'it','it.'+_0x4d2024+_0x300b('0x1c'))[_0x300b('0x15')](_0x300b('0xa'),'t',_0x300b('0x1d'));}function getSqlClauses(){var _0x3219aa={'body':squel[_0x300b('0x1e')](),'contact':squel[_0x300b('0x1e')](),'default':squel[_0x300b('0x1e')](),'fields':squel[_0x300b('0x1e')](),'filter':squel['expr'](),'read':squel[_0x300b('0x1e')](),'tags':{'clause':squel[_0x300b('0x1e')](),'ids':null},'user':squel[_0x300b('0x1e')]()};return _0x3219aa;}function parseTagParameter(_0x43c480){var _0x4cce77=squel['expr']();if(_0x43c480){var _0x489b79=utils[_0x300b('0x1f')](_0x43c480);_0x489b79['forEach'](function(_0x1241c7){_0x4cce77['or'](_0x300b('0x20'),'%,'+_0x1241c7+',%');});}return _0x4cce77;}function parseReadParameter(_0x60bb0c){var _0x30b260='';if(_0x60bb0c){_0x30b260=_0x300b('0x21');if(_0x60bb0c==='1'){_0x30b260=_0x30b260[_0x300b('0x22')](_0x300b('0x23'),'=');}else{_0x30b260=_0x30b260[_0x300b('0x22')](_0x300b('0x23'),'>');}}return _0x30b260;}function parseSearchFilter(_0x3210cd,_0x485952){var _0x48eb77=squel[_0x300b('0x1e')]();if(_0x485952){var _0x2a7604=_0x485952[_0x300b('0x22')]('\x5c','\x5c\x5c')[_0x300b('0x22')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2a7604)){_0x48eb77['or'](_0x300b('0x24'),_0x2a7604+'%');if(['sms','whatsapp']['includes'](_0x3210cd)){_0x48eb77['or'](_0x300b('0x25'),_0x2a7604+'%');}else if(_0x3210cd===_0x300b('0x26')){_0x48eb77['or']('i.fax\x20LIKE\x20?',_0x2a7604+'%');}else if(_0x3210cd===_0x300b('0x27')){_0x48eb77['or'](_0x300b('0x28'),_0x2a7604+'%');}}else if(_0x3210cd==='mail'&&qs[_0x300b('0x29')](_0x2a7604)){_0x48eb77['or']('c.email\x20LIKE\x20?',_0x2a7604+'%');}else{if(_0x3210cd===_0x300b('0x2a')){_0x48eb77['or'](_0x300b('0x2b'),qs[_0x300b('0x2c')](_0x2a7604))['or'](_0x300b('0x2d'),qs[_0x300b('0x2c')](_0x2a7604));}else{if(_0x3210cd!==_0x300b('0x26')){_0x48eb77['or'](_0x300b('0x2e'),qs['getFullTextValue'](_0x2a7604));}_0x48eb77['or'](_0x300b('0x2f'),_0x2a7604+'%');}}}return _0x48eb77;}function parseAdvancedSearchFilter(_0x57c44e,_0x43c71e){var _0x32e326=getSqlClauses();var _0x4ad19a=as[_0x300b('0x30')](_0x57c44e);var _0x355088=_0x4ad19a['sqlOperator'];for(var _0x45007a=0x0;_0x45007a<_0x4ad19a[_0x300b('0x31')][_0x300b('0x11')];_0x45007a++){var _0x534874=_0x4ad19a[_0x300b('0x31')][_0x45007a];var _0x9f9c82='i';var _0xf5874=_[_0x300b('0x32')](_0x43c71e,[_0x300b('0x8'),_0x534874[_0x300b('0x7')]]);if(_0xf5874){var _0x2004ae=as['buildExpression'](_0x9f9c82,_0xf5874[_0x300b('0x33')],_0x534874);_0x32e326[_0x300b('0x34')][_0x355088](_0x2004ae['text'],_0x2004ae[_0x300b('0x35')]['start'],_0x2004ae['value'][_0x300b('0x36')]);}else{switch(_0x534874[_0x300b('0x7')]){case _0x300b('0x37'):var _0x662dad=parseReadParameter(_0x534874[_0x300b('0x35')]);_0x32e326['read'][_0x300b('0x38')](_0x662dad);break;case _0x300b('0x39'):if(_0x534874['operator']===_0x300b('0x3a')){if(_0x534874['value'][_0x300b('0x3b')]('\x20')[_0x300b('0x11')]>0x1){_0x32e326[_0x300b('0x3c')][_0x355088](_0x300b('0x3d'),qs[_0x300b('0x2c')](_0x534874[_0x300b('0x35')]),null);}else{var _0x256536='%'+_0x534874[_0x300b('0x35')]+'%';_0x32e326[_0x300b('0x3c')][_0x355088](_0x300b('0x3e'),_0x256536,_0x256536,_0x256536);}}else{_0xf5874=_[_0x300b('0x32')](_0x43c71e,['name','ContactId']);_0x534874[_0x300b('0x7')]='ContactId';_0x2004ae=as['buildExpression'](_0x9f9c82,_0xf5874[_0x300b('0x33')],_0x534874);_0x32e326[_0x300b('0x3c')][_0x355088](_0x2004ae[_0x300b('0x3f')],_0x2004ae['value'][_0x300b('0x40')],_0x2004ae['value']['end']);}break;case _0x300b('0x41'):var _0x31af5=_0x534874['value'][_0x300b('0x3b')](',')[_0x300b('0x42')](function(_0x54bdc9){return Number(_0x54bdc9);});var _0x1d0ea0=parseTagParameter(_0x31af5);_0x32e326[_0x300b('0x43')]['clause'][_0x300b('0x38')](_0x1d0ea0);_0x32e326[_0x300b('0x43')][_0x300b('0x44')]=_0x31af5;break;case _0x300b('0x45'):if(_0x534874[_0x300b('0x46')]===_0x300b('0x3a')){_0x32e326[_0x300b('0x47')][_0x355088](_0x300b('0x48'),'%'+_0x534874['value']+'%',null);}else{_0xf5874=_['find'](_0x43c71e,[_0x300b('0x8'),'UserId']);_0x534874['field']=_0x300b('0x49');_0x2004ae=as[_0x300b('0x4a')](_0x9f9c82,_0xf5874[_0x300b('0x33')],_0x534874);_0x32e326[_0x300b('0x47')][_0x355088](_0x2004ae[_0x300b('0x3f')],_0x2004ae[_0x300b('0x35')]['start'],_0x2004ae[_0x300b('0x35')]['end']);}break;case'body':case _0x300b('0x4b'):_0x2004ae=as[_0x300b('0x4a')]('me',null,_0x534874);_0x32e326['body'][_0x355088](_0x2004ae[_0x300b('0x3f')],_0x2004ae[_0x300b('0x35')][_0x300b('0x40')],_0x2004ae[_0x300b('0x35')]['end']);break;}}}return _0x32e326;}function parseModelFields(_0x389256,_0x43eef6,_0x5384eb){var _0x4279f4=utils[_0x300b('0x5')](_0x389256);var _0x450716=squel['expr']();var _0x27c57d=_(_0x43eef6)[_0x300b('0x4c')]()[_0x300b('0x42')](function(_0x355522){return _[_0x300b('0x4d')](_0x5384eb,[_0x300b('0x8'),_0x355522])?_0x355522:undefined;})[_0x300b('0x4e')]()[_0x300b('0x35')]();if(_0x27c57d[_0x300b('0x11')]>0x0){_0x27c57d[_0x300b('0x4f')](function(_0x2a38a4){if(_0x2a38a4===_0x4279f4){_0x450716[_0x300b('0x38')]('i.'+_0x4279f4+_0x300b('0x13'),[]['concat'](_0x43eef6[_0x2a38a4]));}else if(_0x2a38a4==='createdAt'){var _0x20ac11=JSON[_0x300b('0x50')](_0x43eef6[_0x2a38a4])[_0x300b('0x51')];var _0x55ca18=JSON[_0x300b('0x50')](_0x43eef6[_0x2a38a4])['$lte'];_0x450716[_0x300b('0x38')](_0x300b('0x52'),_0x20ac11,_0x55ca18);}else{if(_0x43eef6[_0x2a38a4]==='null'){_0x450716[_0x300b('0x38')]('i.'+_0x2a38a4+_0x300b('0x53'));}else{_0x450716[_0x300b('0x38')]('i.'+_0x2a38a4+_0x300b('0x54'),_0x43eef6[_0x2a38a4]);}}});}return _0x450716;}function parseQueryParameters(_0x5309a3,_0x224375,_0x5dba7e){var _0x17dc41=getSqlClauses();return Promise[_0x300b('0x55')]()[_0x300b('0x56')](function(){return parseModelFields(_0x5309a3,_0x224375,_0x5dba7e);})[_0x300b('0x56')](function(_0x116ff5){_0x17dc41[_0x300b('0x57')][_0x300b('0x38')](_0x116ff5);return parseReadParameter(_0x224375[_0x300b('0x58')]);})[_0x300b('0x56')](function(_0x1927a7){_0x17dc41[_0x300b('0x58')][_0x300b('0x38')](_0x1927a7);return parseTagParameter(_0x224375[_0x300b('0x59')]);})[_0x300b('0x56')](function(_0x545255){_0x17dc41[_0x300b('0x43')][_0x300b('0x5a')]['and'](_0x545255);return parseSearchFilter(_0x5309a3,_0x224375['filter']);})[_0x300b('0x56')](function(_0x23e11e){_0x17dc41[_0x300b('0x5b')]=_0x23e11e;return _0x17dc41;});}function checkAccountsRestrictions(_0xb9eb0a,_0x3acad4,_0x3a4a0e){var _0x18d5d2=utils['getAccountFK'](_0xb9eb0a);var _0xff003a=_0x300b('0x5c')+_['capitalize'](_0xb9eb0a)+(_0xb9eb0a===_0x300b('0x5d')?'Websites':_0x300b('0x5e'));var _0x1a5a85=squel[_0x300b('0x1e')]();return Promise['resolve']()[_0x300b('0x56')](function(){if(_0x3a4a0e[_0x300b('0x6')]&&_0x3acad4[_0x300b('0x5f')]===_0x300b('0x60')){return _0x3acad4[_0xff003a]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x304909){if(_0x304909){if(_0x304909['length']===0x0){_0x1a5a85[_0x300b('0x38')]('i.'+_0x18d5d2+_0x300b('0x53'));}else{_0x1a5a85['and']('i.'+_0x18d5d2+_0x300b('0x13'),_[_0x300b('0x42')](_0x304909,'id'));}}else if(!_0x3a4a0e[_0x18d5d2]){_0x1a5a85[_0x300b('0x38')]('i.'+_0x18d5d2+'\x20IS\x20NOT\x20NULL');}})[_0x300b('0x56')](function(){return _0x1a5a85;});}function getClosedOrderClause(_0x199439,_0x54f3b2){var _0x158b08='';var _0x4db9d4=[_0x300b('0x61'),_0x300b('0x62'),_0x300b('0x63')];if(_0x199439===_0x300b('0x2a')){_0x4db9d4[_0x300b('0x64')](_0x300b('0x65'));}if(_0x54f3b2[_0x300b('0x66')]==='0'&&_0x199439===_0x300b('0x2a')){_0x158b08=_0x300b('0x65');}else{if(_0x54f3b2[_0x300b('0x66')]==='1'){_0x4db9d4[_0x300b('0x67')]();}_0x158b08=_0x300b('0x68')+_0x4db9d4[_0x300b('0x69')](',\x20')+')';}return _0x158b08;}function getFilteredInteractions(_0x2f829c,_0x37ce80,_0x41c6c4,_0x3069c0){var _0x21ada1=utils[_0x300b('0xb')](_0x2f829c);var _0x105e1e=_[_0x300b('0x6a')](_0x2f829c)+_0x300b('0x6b');var _0x3a7470=[];var _0x49fcb9=getTagsQuery();var _0x260a85={'type':db['Sequelize'][_0x300b('0x6c')][_0x300b('0x6d')],'raw':!![]};var _0x2680e0=[];var _0x44d9e2=[];return db[_0x300b('0x6e')][_0x300b('0x6f')](_0x49fcb9[_0x300b('0x70')](),_0x260a85)[_0x300b('0x56')](function(_0x5ea509){_0x3a7470=_[_0x300b('0x71')](_0x5ea509,'id');_0x260a85=_['merge'](_0x260a85,{'model':db[_0x105e1e],'mapToModel':!![],'nest':!![]});if(_0x41c6c4['fields']){_0x3069c0[_0x300b('0x72')][_0x300b('0x4f')](function(_0x46600a){_0x37ce80[_0x300b('0x7')]('i.'+_0x46600a);});}else{_0x37ce80[_0x300b('0x7')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x300b('0x37'));_0x37ce80[_0x300b('0x7')](_0x300b('0x73'),_0x300b('0x74'));_0x37ce80[_0x300b('0x7')](_0x300b('0x75'),_0x300b('0x76'));if(_0x2f829c==='mail'){_0x37ce80[_0x300b('0x7')](_0x300b('0x77'),_0x300b('0x78'));_0x37ce80[_0x300b('0x7')](_0x300b('0x79'),_0x300b('0x7a'));_0x37ce80[_0x300b('0x7')](_0x300b('0x7b'));_0x37ce80['field']('i.createdAt');_0x37ce80[_0x300b('0x7')](_0x300b('0x7c'));_0x37ce80[_0x300b('0x7')](_0x300b('0x7d'));_0x37ce80[_0x300b('0x7')](_0x300b('0x7e'));_0x37ce80[_0x300b('0x7')](_0x300b('0x7f'));_0x37ce80[_0x300b('0x7')](_0x300b('0x80'));_0x37ce80[_0x300b('0x7')]('i.lastMsgDirection');_0x37ce80['field'](_0x300b('0x81'));_0x37ce80[_0x300b('0x7')](_0x300b('0x63'));_0x37ce80['field'](_0x300b('0x62'));_0x37ce80['field']('i.thirdDisposition');_0x37ce80[_0x300b('0x7')](_0x300b('0x65'));_0x37ce80[_0x300b('0x7')](_0x300b('0x82'));_0x37ce80['field']('i.ContactId');_0x37ce80[_0x300b('0x7')](_0x300b('0x83'));_0x37ce80[_0x300b('0x7')](_0x300b('0x84'));}else if(_0x2f829c===_0x300b('0x27')){_0x37ce80[_0x300b('0x7')](_0x300b('0x85'),_0x300b('0x7a'));}else{_0x37ce80[_0x300b('0x7')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x2f829c!==_0x300b('0x2a')){_0x37ce80['field']('i.*');}_0x37ce80[_0x300b('0x7')](_0x300b('0x86'),_0x300b('0x87'));_0x37ce80['field'](_0x300b('0x88'),_0x300b('0x89'));_0x37ce80['field'](_0x300b('0x8a'),_0x300b('0x8b'));_0x37ce80[_0x300b('0x7')](_0x300b('0x8c'),_0x300b('0x8d'));_0x37ce80[_0x300b('0x7')]('c.mobile','Contact.mobile');_0x37ce80['field'](_0x300b('0x8e'),_0x300b('0x8f'));_0x37ce80[_0x300b('0x7')](_0x300b('0x90'),_0x300b('0x91'));_0x37ce80['field'](_0x300b('0x92'),_0x300b('0x93'));_0x37ce80['field'](_0x300b('0x94'),_0x300b('0x95'));}if(_0x3069c0[_0x300b('0x96')]){_0x37ce80[_0x300b('0x96')](_0x3069c0[_0x300b('0x96')]);}if(_0x3069c0[_0x300b('0x97')]){_0x37ce80[_0x300b('0x97')](_0x3069c0['offset']);}return db['sequelize'][_0x300b('0x6f')](_0x37ce80[_0x300b('0x70')](),_0x260a85);})[_0x300b('0x56')](function(_0x46ae22){_0x2680e0=_0x46ae22;var _0x561347=getUsersQuery(_0x2f829c,_0x2680e0);return db[_0x300b('0x6e')]['query'](_0x561347[_0x300b('0x70')](),_0x260a85);})['then'](function(_0x546cbc){_0x44d9e2=_[_0x300b('0x98')](_0x546cbc,_0x21ada1);if(_0x2f829c==='mail'){return db['Setting'][_0x300b('0x99')]({'attributes':[_0x300b('0x9a')],'raw':!![]});}})[_0x300b('0x56')](function(_0x28923a){var _0x1b64e7=_0x28923a?_0x28923a[_0x300b('0x9a')]:undefined;var _0x23e93e=_0x2680e0[_0x300b('0x42')](function(_0x1a1cfd){return updateInteraction(_0x1a1cfd,_0x3a7470,_0x44d9e2,_0x1b64e7);});return Promise['all'](_0x23e93e);});}function countFilteredInteractions(_0xe21b41,_0x40970a){var _0x18eae9=_0xe21b41[_0x300b('0x9b')]();_0x18eae9[_0x300b('0x7')]('COUNT(*)');_0x18eae9[_0x300b('0x7')](_0x300b('0x9c'),_0x300b('0x37'));var _0x1090df=utils[_0x300b('0x1f')](_0x40970a);if(!_[_0x300b('0x9d')](_0x1090df)){_0x18eae9[_0x300b('0x12')](_0x300b('0x9e'),_0x1090df);}var _0x2f5fc={'type':db[_0x300b('0x9f')][_0x300b('0x6c')][_0x300b('0x6d')],'raw':!![]};return db[_0x300b('0x6e')][_0x300b('0x6f')](_0x18eae9['toString'](),_0x2f5fc);}module[_0x300b('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index a0313c4..7afaa56 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4e8=['Users','TagIds','Tags','../../mysqldb','map','fullname','split','push','waiting','talking','abandoned','total','answered','disposition','unmanaged','UserId','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch','updateInteraction'];(function(_0x1ae261,_0xf01043){var _0x333331=function(_0x7cc35c){while(--_0x7cc35c){_0x1ae261['push'](_0x1ae261['shift']());}};_0x333331(++_0xf01043);}(_0xc4e8,0x1de));var _0x8c4e=function(_0x4f3b2b,_0x33bd99){_0x4f3b2b=_0x4f3b2b-0x0;var _0x1469db=_0xc4e8[_0x4f3b2b];return _0x1469db;};'use strict';var _=require('lodash');var db=require(_0x8c4e('0x0'))['db'];function getInteractionUsers(_0x2eb267,_0x16a8f3){return new Promise(function(_0x51f4ca,_0x40e4a4){try{var _0x178adc=[];if(_0x16a8f3[_0x2eb267]){_0x178adc=_0x16a8f3[_0x2eb267][_0x8c4e('0x1')](function(_0x39f364){return{'id':_0x39f364['id'],'fullname':_0x39f364[_0x8c4e('0x2')]};});}return _0x51f4ca(_0x178adc);}catch(_0x589006){_0x40e4a4(_0x589006);}});}function getInteractionTags(_0x339937,_0x56004b){var _0x2446b1=[];if(_0x339937){_0x339937[_0x8c4e('0x3')](',')['forEach'](function(_0x41499d){_0x2446b1[_0x8c4e('0x4')](_0x56004b[_0x41499d]);});}return _0x2446b1;}function updateWaitingCounter(_0x4aa021){if(_0x4aa021[_0x8c4e('0x5')]){_0x4aa021['waiting']-=0x1;}}function updateInteractionCounters(_0x4f4371){_0x4f4371[_0x8c4e('0x5')]=0x0;_0x4f4371[_0x8c4e('0x6')]=0x0;_0x4f4371['answered']=0x0;_0x4f4371['unmanaged']=0x0;_0x4f4371[_0x8c4e('0x7')]=0x0;_0x4f4371[_0x8c4e('0x8')]=0x0;if(_0x4f4371['closed']){if(_0x4f4371['disposition']===_0x8c4e('0x7')){_0x4f4371[_0x8c4e('0x7')]+=0x1;updateWaitingCounter(_0x4f4371);}if(_0x4f4371['UserId']){_0x4f4371[_0x8c4e('0x9')]+=0x1;if(_0x4f4371[_0x8c4e('0x6')]){_0x4f4371[_0x8c4e('0x6')]-=0x1;}}else{if(_0x4f4371[_0x8c4e('0xa')]){_0x4f4371[_0x8c4e('0xb')]+=0x1;updateWaitingCounter(_0x4f4371);}}}else{if(!_0x4f4371['UserId']){_0x4f4371['waiting']+=0x1;}if(_0x4f4371[_0x8c4e('0xc')]){_0x4f4371[_0x8c4e('0x6')]+=0x1;updateWaitingCounter(_0x4f4371);}}_0x4f4371['total']+=0x1;return _0x4f4371;}function getLastMessageText(_0x7959fc){return db[_0x8c4e('0xd')][_0x8c4e('0xe')]({'where':{'$and':[{'MailInteractionId':_0x7959fc['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8c4e('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8c4e('0x10')],'order':_0x8c4e('0x11'),'raw':!![]})[_0x8c4e('0x12')](function(_0x2b3898){if(_0x2b3898&&_0x2b3898['plainBody']){_0x7959fc['lastMsgText']=_[_0x8c4e('0x13')](_0x2b3898[_0x8c4e('0x10')]);}return _0x7959fc;})[_0x8c4e('0x14')](function(_0x2a603f){throw _0x2a603f;});}exports[_0x8c4e('0x15')]=function(_0x41d209,_0xdd6d59,_0x46397d,_0x5080fb){return new Promise(function(_0x36048c,_0x2eb776){return getInteractionUsers(_0x41d209['id'],_0x46397d)[_0x8c4e('0x12')](function(_0x5a436e){_0x41d209[_0x8c4e('0x16')]=_0x5a436e;return getInteractionTags(_0x41d209[_0x8c4e('0x17')],_0xdd6d59);})[_0x8c4e('0x12')](function(_0x33e22a){_0x41d209[_0x8c4e('0x18')]=_0x33e22a;delete _0x41d209['TagIds'];return updateInteractionCounters(_0x41d209);})[_0x8c4e('0x12')](function(_0x3fcd7c){if(_0x5080fb){return getLastMessageText(_0x3fcd7c);}else{return _0x3fcd7c;}})[_0x8c4e('0x12')](function(_0x41c07e){_0x36048c(_0x41c07e);})[_0x8c4e('0x14')](function(_0x43712c){_0x2eb776(_0x43712c);});});}; \ No newline at end of file +var _0x32ce=['forEach','push','waiting','talking','answered','unmanaged','total','disposition','abandoned','UserId','MailMessage','then','plainBody','lastMsgText','trimStart','updateInteraction','Users','TagIds','Tags','catch','lodash','../../mysqldb','fullname','split'];(function(_0x539b2c,_0x4df606){var _0x42a1c1=function(_0x1ebe2d){while(--_0x1ebe2d){_0x539b2c['push'](_0x539b2c['shift']());}};_0x42a1c1(++_0x4df606);}(_0x32ce,0x1f4));var _0xe32c=function(_0xa1a978,_0x4b1529){_0xa1a978=_0xa1a978-0x0;var _0x554060=_0x32ce[_0xa1a978];return _0x554060;};'use strict';var _=require(_0xe32c('0x0'));var db=require(_0xe32c('0x1'))['db'];function getInteractionUsers(_0x183672,_0xad4277){return new Promise(function(_0x57e84f,_0x243223){try{var _0xa19a99=[];if(_0xad4277[_0x183672]){_0xa19a99=_0xad4277[_0x183672]['map'](function(_0x5b0578){return{'id':_0x5b0578['id'],'fullname':_0x5b0578[_0xe32c('0x2')]};});}return _0x57e84f(_0xa19a99);}catch(_0x4dcdd9){_0x243223(_0x4dcdd9);}});}function getInteractionTags(_0x2daf1c,_0x3c436d){var _0x4bcac0=[];if(_0x2daf1c){_0x2daf1c[_0xe32c('0x3')](',')[_0xe32c('0x4')](function(_0x49eb1e){_0x4bcac0[_0xe32c('0x5')](_0x3c436d[_0x49eb1e]);});}return _0x4bcac0;}function updateWaitingCounter(_0xb2b75){if(_0xb2b75['waiting']){_0xb2b75[_0xe32c('0x6')]-=0x1;}}function updateInteractionCounters(_0x26c901){_0x26c901[_0xe32c('0x6')]=0x0;_0x26c901[_0xe32c('0x7')]=0x0;_0x26c901[_0xe32c('0x8')]=0x0;_0x26c901[_0xe32c('0x9')]=0x0;_0x26c901['abandoned']=0x0;_0x26c901[_0xe32c('0xa')]=0x0;if(_0x26c901['closed']){if(_0x26c901[_0xe32c('0xb')]===_0xe32c('0xc')){_0x26c901[_0xe32c('0xc')]+=0x1;updateWaitingCounter(_0x26c901);}if(_0x26c901[_0xe32c('0xd')]){_0x26c901[_0xe32c('0x8')]+=0x1;if(_0x26c901['talking']){_0x26c901[_0xe32c('0x7')]-=0x1;}}else{if(_0x26c901[_0xe32c('0xb')]){_0x26c901[_0xe32c('0x9')]+=0x1;updateWaitingCounter(_0x26c901);}}}else{if(!_0x26c901[_0xe32c('0xd')]){_0x26c901[_0xe32c('0x6')]+=0x1;}if(_0x26c901[_0xe32c('0xd')]){_0x26c901[_0xe32c('0x7')]+=0x1;updateWaitingCounter(_0x26c901);}}_0x26c901[_0xe32c('0xa')]+=0x1;return _0x26c901;}function getLastMessageText(_0x304f2a){return db[_0xe32c('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x304f2a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0xe32c('0xf')](function(_0x289f17){if(_0x289f17&&_0x289f17[_0xe32c('0x10')]){_0x304f2a[_0xe32c('0x11')]=_[_0xe32c('0x12')](_0x289f17[_0xe32c('0x10')]);}return _0x304f2a;})['catch'](function(_0x497abb){throw _0x497abb;});}exports[_0xe32c('0x13')]=function(_0x4fd4bf,_0x56c9d0,_0x185bc4,_0x567e0e){return new Promise(function(_0x13d209,_0x4eb4f0){return getInteractionUsers(_0x4fd4bf['id'],_0x185bc4)[_0xe32c('0xf')](function(_0xb0605c){_0x4fd4bf[_0xe32c('0x14')]=_0xb0605c;return getInteractionTags(_0x4fd4bf[_0xe32c('0x15')],_0x56c9d0);})[_0xe32c('0xf')](function(_0x49945b){_0x4fd4bf[_0xe32c('0x16')]=_0x49945b;delete _0x4fd4bf['TagIds'];return updateInteractionCounters(_0x4fd4bf);})[_0xe32c('0xf')](function(_0x5e1d51){if(_0x567e0e){return getLastMessageText(_0x5e1d51);}else{return _0x5e1d51;}})['then'](function(_0x54ad54){_0x13d209(_0x54ad54);})[_0xe32c('0x17')](function(_0x3891ad){_0x4eb4f0(_0x3891ad);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 9c29f51..4072ddb 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24b5=['exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','catch','error'];(function(_0x508eb3,_0x19a0a6){var _0x54ef1d=function(_0x1f7b05){while(--_0x1f7b05){_0x508eb3['push'](_0x508eb3['shift']());}};_0x54ef1d(++_0x19a0a6);}(_0x24b5,0x194));var _0x524b=function(_0xe7d30b,_0x525bf2){_0xe7d30b=_0xe7d30b-0x0;var _0x2bf356=_0x24b5[_0xe7d30b];return _0x2bf356;};'use strict';var _=require(_0x524b('0x0'));var db=require(_0x524b('0x1'))['db'];var loggers={'openchannel':require(_0x524b('0x2'))(_0x524b('0x3')),'mail':require(_0x524b('0x2'))('mail-interactions'),'fax':require(_0x524b('0x2'))(_0x524b('0x4')),'sms':require(_0x524b('0x2'))(_0x524b('0x5')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0x524b('0x2'))('whatsapp-interactions')};function getAccountFK(_0x315f43){return _[_0x524b('0x6')](_0x315f43)+(_0x315f43===_0x524b('0x7')?_0x524b('0x8'):_0x524b('0x9'))+'Id';}function getInteractionFK(_0xb62a98){return _[_0x524b('0x6')](_0xb62a98)+_0x524b('0xa');}function getInteractionId(_0x11ae19,_0x4b71ee,_0x205340){if(_0x11ae19&&_0x11ae19[_[_0x524b('0xb')](_0x205340)+'InteractionId']){return _0x11ae19[_[_0x524b('0xb')](_0x205340)+_0x524b('0xa')];}else if(_0x11ae19&&_0x11ae19['id']){return _0x11ae19['id'];}else if(_0x4b71ee&&_0x4b71ee['id']){return _0x4b71ee['id'];}else{return _0x524b('0xc');}}function getInteractionsTables(_0x1051b6){return{'accounts':_0x1051b6+'_'+(_0x1051b6===_0x524b('0x7')?'websites':_0x524b('0xd')),'interactions':_0x1051b6+_0x524b('0xe'),'interactionsTags':_0x1051b6+'_interaction_has_tags','messages':_0x1051b6+_0x524b('0xf'),'userInteractions':_0x524b('0x10')+_0x1051b6+_0x524b('0xe')};}function getSelectedTags(_0x3f0b1a){var _0x1a8287=[];if(_0x3f0b1a){_0x1a8287=Array[_0x524b('0x11')](_0x3f0b1a)?_0x3f0b1a:[_0x3f0b1a];}return _0x1a8287;}function log(_0x3f21d3,_0x1949f4,_0x35e0d5,_0x1a827d,_0x75b165,_0x392f28){loggers[_0x75b165['toLowerCase']()][_0x3f21d3](_0x524b('0x12'),_0x392f28[_0x524b('0x13')](),_0x1949f4?_0x1949f4['id']:null,_0x1949f4?_0x1949f4[_0x524b('0x14')]:null,_0x1949f4?_0x1949f4[_0x524b('0x15')]:null,getInteractionId(_0x35e0d5,_0x1a827d,_0x75b165),_0x35e0d5?JSON[_0x524b('0x16')](_0x35e0d5):_0x524b('0x17'));}function updateUser(_0x53abfc,_0x44a016,_0x51b0ea,_0x5465c8,_0x315cec){db[_['upperFirst'](_0x5465c8)+_0x524b('0x18')][_0x524b('0x19')]({'where':{'id':getInteractionId(_0x44a016,_0x51b0ea,_0x5465c8)}})[_0x524b('0x1a')](function(_0x41d3f9){if(_0x41d3f9){return _0x41d3f9[_0x524b('0x1b')]({'UserId':_0x53abfc?_0x53abfc['id']:null});}})[_0x524b('0x1a')](function(_0x51146f){if(_0x51146f){log('info',_0x53abfc,_0x44a016,_0x51b0ea,_0x5465c8,_0x315cec);}})[_0x524b('0x1c')](function(){log(_0x524b('0x1d'),_0x53abfc,_0x44a016,_0x51b0ea,_0x5465c8,_0x315cec);});}module[_0x524b('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x8bf3=['null','findOne','then','update','info','exports','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','Account','capitalize','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify'];(function(_0x2add26,_0x31bba7){var _0x50a21e=function(_0x522138){while(--_0x522138){_0x2add26['push'](_0x2add26['shift']());}};_0x50a21e(++_0x31bba7);}(_0x8bf3,0x1aa));var _0x38bf=function(_0x5488af,_0x1ce95f){_0x5488af=_0x5488af-0x0;var _0x3783e7=_0x8bf3[_0x5488af];return _0x3783e7;};'use strict';var _=require('lodash');var db=require(_0x38bf('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x38bf('0x1')),'mail':require(_0x38bf('0x2'))(_0x38bf('0x3')),'fax':require(_0x38bf('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0x38bf('0x4')),'chat':require('../../config/logger')(_0x38bf('0x5')),'whatsapp':require(_0x38bf('0x2'))(_0x38bf('0x6'))};function getAccountFK(_0x3d7921){return _['capitalize'](_0x3d7921)+(_0x3d7921===_0x38bf('0x7')?'Website':_0x38bf('0x8'))+'Id';}function getInteractionFK(_0x231a18){return _[_0x38bf('0x9')](_0x231a18)+'InteractionId';}function getInteractionId(_0x40e01a,_0x4fe7f3,_0x34f6eb){if(_0x40e01a&&_0x40e01a[_[_0x38bf('0xa')](_0x34f6eb)+_0x38bf('0xb')]){return _0x40e01a[_[_0x38bf('0xa')](_0x34f6eb)+'InteractionId'];}else if(_0x40e01a&&_0x40e01a['id']){return _0x40e01a['id'];}else if(_0x4fe7f3&&_0x4fe7f3['id']){return _0x4fe7f3['id'];}else{return _0x38bf('0xc');}}function getInteractionsTables(_0x28ee37){return{'accounts':_0x28ee37+'_'+(_0x28ee37===_0x38bf('0x7')?_0x38bf('0xd'):_0x38bf('0xe')),'interactions':_0x28ee37+_0x38bf('0xf'),'interactionsTags':_0x28ee37+_0x38bf('0x10'),'messages':_0x28ee37+_0x38bf('0x11'),'userInteractions':'user_has_'+_0x28ee37+_0x38bf('0xf')};}function getSelectedTags(_0x34649b){var _0x30edb1=[];if(_0x34649b){_0x30edb1=Array[_0x38bf('0x12')](_0x34649b)?_0x34649b:[_0x34649b];}return _0x30edb1;}function log(_0x6d0b5d,_0x56d6ad,_0xa742c9,_0x3314fa,_0x2978b1,_0x3e99d4){loggers[_0x2978b1[_0x38bf('0x13')]()][_0x6d0b5d](_0x38bf('0x14'),_0x3e99d4['toUpperCase'](),_0x56d6ad?_0x56d6ad['id']:null,_0x56d6ad?_0x56d6ad['name']:null,_0x56d6ad?_0x56d6ad['role']:null,getInteractionId(_0xa742c9,_0x3314fa,_0x2978b1),_0xa742c9?JSON[_0x38bf('0x15')](_0xa742c9):_0x38bf('0x16'));}function updateUser(_0x3d079b,_0x3407ef,_0x1a5477,_0x49aa0a,_0x59665c){db[_['upperFirst'](_0x49aa0a)+'Interaction'][_0x38bf('0x17')]({'where':{'id':getInteractionId(_0x3407ef,_0x1a5477,_0x49aa0a)}})[_0x38bf('0x18')](function(_0x29b729){if(_0x29b729){return _0x29b729[_0x38bf('0x19')]({'UserId':_0x3d079b?_0x3d079b['id']:null});}})[_0x38bf('0x18')](function(_0x15b13f){if(_0x15b13f){log(_0x38bf('0x1a'),_0x3d079b,_0x3407ef,_0x1a5477,_0x49aa0a,_0x59665c);}})['catch'](function(){log('error',_0x3d079b,_0x3407ef,_0x1a5477,_0x49aa0a,_0x59665c);});}module[_0x38bf('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 18f8a9f..683a95f 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2169=['json','catch','User','user','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','License','then','count','status'];(function(_0x228fe0,_0x4e2bf6){var _0x39422a=function(_0x38cda9){while(--_0x38cda9){_0x228fe0['push'](_0x228fe0['shift']());}};_0x39422a(++_0x4e2bf6);}(_0x2169,0x15d));var _0x9216=function(_0x5676d3,_0x582062){_0x5676d3=_0x5676d3-0x0;var _0x573736=_0x2169[_0x5676d3];return _0x573736;};'use strict';var crypto=require(_0x9216('0x0'));var util=require(_0x9216('0x1'));var compose=require(_0x9216('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x9216('0x3'));function getValueFromLicense(_0xba7c13,_0x23de92){if(_0xba7c13&&_0x23de92){if(_0x23de92['data1']&&_0x23de92['license']){var _0x4f1895=_0x23de92[_0x9216('0x4')];var _0x597310=_0x23de92[_0x9216('0x5')];var _0x48af40=_0x4f1895[_0x9216('0x6')]('-')[0x4];var _0x186872=_0x4f1895[_0x9216('0x6')]('-')[0x0];var _0x3074c1=crypto[_0x9216('0x7')](_0x9216('0x8'),util[_0x9216('0x9')](_0x9216('0xa'),_0x48af40,_0x4f1895,_0x186872));var _0xeaca7=_0x3074c1[_0x9216('0xb')](_0x597310,_0x9216('0xc'),_0x9216('0xd'));_0xeaca7+=_0x3074c1[_0x9216('0xe')](_0x9216('0xd'));var _0x1da0ca=JSON['parse'](_0xeaca7);return _0x1da0ca['hasOwnProperty'](_0xba7c13)?_0x1da0ca[_0xba7c13]:null;}}return null;}function isLimit(_0x5ca4b4,_0x4d97ba,_0x5eee07,_0x1c29db){var _0x3208b5=_0x4d97ba;return compose()['use'](function(_0x53b810,_0x488b30,_0x5362f2){return db[_0x9216('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x9216('0x10')](function(_0x42bee6){var _0x49e197=getValueFromLicense(_0x5ca4b4,_0x42bee6);return _0x49e197?_0x49e197:_0x3208b5;})['then'](function(_0x234f8a){_0x3208b5=_0x234f8a;return _0x5eee07[_0x9216('0x11')](_0x1c29db);})['then'](function(_0xec1127){if(_0xec1127>=_0x3208b5){return _0x488b30[_0x9216('0x12')](0x193)[_0x9216('0x13')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5ca4b4)});}_0x5362f2();})[_0x9216('0x14')](function(_0xd7aba0){_0x5362f2(_0xd7aba0);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x9216('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x9216('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xf007=['data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x116d6f,_0x277e21){var _0x50de25=function(_0x32c12c){while(--_0x32c12c){_0x116d6f['push'](_0x116d6f['shift']());}};_0x50de25(++_0x277e21);}(_0xf007,0x19f));var _0x7f00=function(_0x50859e,_0x2c958a){_0x50859e=_0x50859e-0x0;var _0x5847a2=_0xf007[_0x50859e];return _0x5847a2;};'use strict';var crypto=require(_0x7f00('0x0'));var util=require(_0x7f00('0x1'));var compose=require(_0x7f00('0x2'));var db=require(_0x7f00('0x3'))['db'];var config=require(_0x7f00('0x4'));function getValueFromLicense(_0x548011,_0x4e0bf9){if(_0x548011&&_0x4e0bf9){if(_0x4e0bf9[_0x7f00('0x5')]&&_0x4e0bf9[_0x7f00('0x6')]){var _0x179a86=_0x4e0bf9[_0x7f00('0x5')];var _0x406853=_0x4e0bf9[_0x7f00('0x6')];var _0x20d84a=_0x179a86[_0x7f00('0x7')]('-')[0x4];var _0x22fc58=_0x179a86[_0x7f00('0x7')]('-')[0x0];var _0x8ed6c6=crypto[_0x7f00('0x8')](_0x7f00('0x9'),util['format'](_0x7f00('0xa'),_0x20d84a,_0x179a86,_0x22fc58));var _0x4cf19c=_0x8ed6c6[_0x7f00('0xb')](_0x406853,_0x7f00('0xc'),'utf8');_0x4cf19c+=_0x8ed6c6['final'](_0x7f00('0xd'));var _0x2227dd=JSON[_0x7f00('0xe')](_0x4cf19c);return _0x2227dd[_0x7f00('0xf')](_0x548011)?_0x2227dd[_0x548011]:null;}}return null;}function isLimit(_0x1d2a7b,_0x3d4872,_0x576425,_0x3b2a5a){var _0x43527e=_0x3d4872;return compose()[_0x7f00('0x10')](function(_0x18d439,_0x2a6617,_0x2cc85e){return db[_0x7f00('0x11')][_0x7f00('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x7f00('0x13')](function(_0x122968){var _0x5bf495=getValueFromLicense(_0x1d2a7b,_0x122968);return _0x5bf495?_0x5bf495:_0x43527e;})['then'](function(_0x466488){_0x43527e=_0x466488;return _0x576425[_0x7f00('0x14')](_0x3b2a5a);})['then'](function(_0x257391){if(_0x257391>=_0x43527e){return _0x2a6617[_0x7f00('0x15')](0x193)[_0x7f00('0x16')]({'message':util[_0x7f00('0x17')](_0x7f00('0x18'),_0x1d2a7b)});}_0x2cc85e();})[_0x7f00('0x19')](function(_0x2ae1f3){_0x2cc85e(_0x2ae1f3);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x7f00('0x1a')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x7f00('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8a4d044..2e9a8a6 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9164=['castTo','CAST(','field','\x20AS\x20','$ne','$notIn','text','$in','IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$between','pop','utcOffset','minutes','seconds','lodash','moment','sqlOperator','startsWith','and','[$and]','replace','[$or]','split','length','slice','shift','forEach','indexOf','map','conditions','push','buildExpression','DATE','operator','value','includes','$lte','add','days','format','YYYY-MM-DD'];(function(_0xc2c13a,_0x1070d3){var _0x2b8e2f=function(_0x3ebc15){while(--_0x3ebc15){_0xc2c13a['push'](_0xc2c13a['shift']());}};_0x2b8e2f(++_0x1070d3);}(_0x9164,0x135));var _0x4916=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9164[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4916('0x0'));var moment=require(_0x4916('0x1'));exports['parseSearch']=function(_0x32f28c){var _0x3c81e7={'conditions':[]};_0x3c81e7[_0x4916('0x2')]=_[_0x4916('0x3')](_0x32f28c,'[$or]')?'or':_0x4916('0x4');var _0x236ed5=_0x32f28c['replace'](_0x4916('0x5'),'')[_0x4916('0x6')](_0x4916('0x7'),'')[_0x4916('0x8')]('||');for(var _0x4d98a2=0x0;_0x4d98a2<_0x236ed5[_0x4916('0x9')];_0x4d98a2++){var _0x5b4ba6=_0x236ed5[_0x4d98a2][_0x4916('0x8')](':=');var _0x147907=_0x5b4ba6[0x0];var _0x51af85=_0x5b4ba6[_0x4916('0xa')](0x1);_0x51af85['forEach'](function(_0x139822){var _0x494079=_0x139822['split']('[')[_0x4916('0xb')]();var _0x543632=_0x139822['match'](/\[(.*?)\]/g);_0x543632[_0x4916('0xc')](function(_0x5eb9de){var _0x2339a6=_0x5eb9de[_0x4916('0x8')]('[')['filter'](function(_0x189fb2){return _0x189fb2[_0x4916('0xd')](']')>-0x1;})[_0x4916('0xe')](function(_0x596d65){return _0x596d65[_0x4916('0x8')](']')[0x0];})[0x0];_0x3c81e7[_0x4916('0xf')][_0x4916('0x10')]({'field':_0x147907,'operator':_0x494079,'value':_0x2339a6});});});}return _0x3c81e7;};exports[_0x4916('0x11')]=function(_0x69d74b,_0x3e6e39,_0x2184e4){var _0xfcdeb2={};if(_0x3e6e39===_0x4916('0x12')){if(_0x2184e4[_0x4916('0x13')]==='$eq'){_0x2184e4[_0x4916('0x13')]='$between';_0x2184e4[_0x4916('0x14')]+=','+_0x2184e4[_0x4916('0x14')];}else if(_[_0x4916('0x15')](['$gt',_0x4916('0x16')],_0x2184e4[_0x4916('0x13')])){_0x2184e4[_0x4916('0x14')]=moment(_0x2184e4['value'])[_0x4916('0x17')](0x1,_0x4916('0x18'))[_0x4916('0x19')](_0x4916('0x1a'));}}if(_0x2184e4['castTo']){_0x3e6e39=_0x2184e4[_0x4916('0x1b')];_0xfcdeb2['text']=_0x4916('0x1c')+_0x69d74b+'.'+_0x2184e4[_0x4916('0x1d')]+_0x4916('0x1e')+_0x2184e4[_0x4916('0x1b')]+')\x20'+parseOperator(_0x2184e4[_0x4916('0x13')]);}else{_0xfcdeb2['text']=_0x69d74b+'.'+_0x2184e4['field']+'\x20'+parseOperator(_0x2184e4[_0x4916('0x13')]);}if(_['includes']([_0x4916('0x1f'),_0x4916('0x20')],_0x2184e4[_0x4916('0x13')]))_0xfcdeb2[_0x4916('0x21')]='('+_0xfcdeb2[_0x4916('0x21')]+'\x20OR\x20'+_0x69d74b+'.'+_0x2184e4[_0x4916('0x1d')]+'\x20IS\x20NULL)';_0xfcdeb2[_0x4916('0x14')]=parseValue(_0x3e6e39,_0x2184e4[_0x4916('0x13')],_0x2184e4[_0x4916('0x14')]);return _0xfcdeb2;};function parseOperator(_0xc006dd){var _0x40532c;switch(_0xc006dd){case _0x4916('0x22'):_0x40532c=_0x4916('0x23');break;case _0x4916('0x20'):_0x40532c='NOT\x20IN\x20?';break;case _0x4916('0x24'):_0x40532c=_0x4916('0x25');break;case _0x4916('0x1f'):_0x40532c=_0x4916('0x26');break;case _0x4916('0x27'):case _0x4916('0x28'):case _0x4916('0x29'):_0x40532c=_0x4916('0x2a');break;case _0x4916('0x2b'):_0x40532c='<\x20?';break;case _0x4916('0x2c'):_0x40532c=_0x4916('0x2d');break;case _0x4916('0x16'):_0x40532c=_0x4916('0x2e');break;case _0x4916('0x2f'):_0x40532c=_0x4916('0x30');break;case'$between':_0x40532c=_0x4916('0x31');break;}return _0x40532c;}function parseValue(_0x13c22f,_0x20e782,_0x2e41ba){var _0x298b2a={'start':undefined,'end':undefined};switch(_0x20e782){case _0x4916('0x22'):case _0x4916('0x20'):_0x298b2a[_0x4916('0x32')]=_0x2e41ba[_0x4916('0x8')](',');break;case'$substring':_0x298b2a['start']='%'+_0x2e41ba+'%';break;case'$startsWith':_0x298b2a[_0x4916('0x32')]=_0x2e41ba+'%';break;case _0x4916('0x29'):_0x298b2a[_0x4916('0x32')]='%'+_0x2e41ba;break;case _0x4916('0x33'):var _0x5be0d4=_0x2e41ba['split'](',');var _0x2e41ba=_0x5be0d4[_0x4916('0xb')]();var _0x2759cd=_0x5be0d4[_0x4916('0x34')]();if(_0x13c22f===_0x4916('0x12')){_0x2e41ba=moment(_0x2e41ba)[_0x4916('0x35')](0x0,!![])[_0x4916('0x19')]();_0x2759cd=moment(_0x2759cd)[_0x4916('0x35')](0x0,!![])['add'](0x17,'hours')[_0x4916('0x17')](0x3b,_0x4916('0x36'))[_0x4916('0x17')](0x3b,_0x4916('0x37'))['format']();}_0x298b2a={'start':_0x2e41ba,'end':_0x2759cd};break;default:_0x298b2a['start']=_0x2e41ba;break;}return _0x298b2a;} \ No newline at end of file +var _0x9647=['$notIn','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','LIKE\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','length','split','forEach','filter','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','castTo','text','field','\x20AS\x20'];(function(_0x343dfb,_0xed8587){var _0x297fe2=function(_0x19cbbd){while(--_0x19cbbd){_0x343dfb['push'](_0x343dfb['shift']());}};_0x297fe2(++_0xed8587);}(_0x9647,0x171));var _0x7964=function(_0x35254f,_0x42b5d2){_0x35254f=_0x35254f-0x0;var _0x12259b=_0x9647[_0x35254f];return _0x12259b;};'use strict';var _=require(_0x7964('0x0'));var moment=require(_0x7964('0x1'));exports[_0x7964('0x2')]=function(_0x455f2e){var _0x4d9b5d={'conditions':[]};_0x4d9b5d['sqlOperator']=_[_0x7964('0x3')](_0x455f2e,_0x7964('0x4'))?'or':_0x7964('0x5');var _0x215e42=_0x455f2e[_0x7964('0x6')](_0x7964('0x7'),'')[_0x7964('0x6')](_0x7964('0x4'),'')['split']('||');for(var _0x125548=0x0;_0x125548<_0x215e42[_0x7964('0x8')];_0x125548++){var _0x16e88d=_0x215e42[_0x125548][_0x7964('0x9')](':=');var _0x39e4b6=_0x16e88d[0x0];var _0x34d67e=_0x16e88d['slice'](0x1);_0x34d67e[_0x7964('0xa')](function(_0x3f1c35){var _0x11f653=_0x3f1c35['split']('[')['shift']();var _0x3a7ce2=_0x3f1c35['match'](/\[(.*?)\]/g);_0x3a7ce2[_0x7964('0xa')](function(_0x40a2a3){var _0x38a97c=_0x40a2a3['split']('[')[_0x7964('0xb')](function(_0xbd9378){return _0xbd9378['indexOf'](']')>-0x1;})['map'](function(_0x741b86){return _0x741b86['split'](']')[0x0];})[0x0];_0x4d9b5d['conditions']['push']({'field':_0x39e4b6,'operator':_0x11f653,'value':_0x38a97c});});});}return _0x4d9b5d;};exports[_0x7964('0xc')]=function(_0x33c02d,_0x3005b7,_0x48bd5b){var _0x1826c0={};if(_0x3005b7===_0x7964('0xd')){if(_0x48bd5b['operator']==='$eq'){_0x48bd5b[_0x7964('0xe')]=_0x7964('0xf');_0x48bd5b[_0x7964('0x10')]+=','+_0x48bd5b['value'];}else if(_[_0x7964('0x11')]([_0x7964('0x12'),_0x7964('0x13')],_0x48bd5b[_0x7964('0xe')])){_0x48bd5b[_0x7964('0x10')]=moment(_0x48bd5b[_0x7964('0x10')])[_0x7964('0x14')](0x1,_0x7964('0x15'))[_0x7964('0x16')]('YYYY-MM-DD');}}if(_0x48bd5b[_0x7964('0x17')]){_0x3005b7=_0x48bd5b[_0x7964('0x17')];_0x1826c0[_0x7964('0x18')]='CAST('+_0x33c02d+'.'+_0x48bd5b[_0x7964('0x19')]+_0x7964('0x1a')+_0x48bd5b[_0x7964('0x17')]+')\x20'+parseOperator(_0x48bd5b[_0x7964('0xe')]);}else{_0x1826c0[_0x7964('0x18')]=_0x33c02d+'.'+_0x48bd5b['field']+'\x20'+parseOperator(_0x48bd5b[_0x7964('0xe')]);}if(_[_0x7964('0x11')](['$ne',_0x7964('0x1b')],_0x48bd5b[_0x7964('0xe')]))_0x1826c0[_0x7964('0x18')]='('+_0x1826c0[_0x7964('0x18')]+'\x20OR\x20'+_0x33c02d+'.'+_0x48bd5b[_0x7964('0x19')]+_0x7964('0x1c');_0x1826c0[_0x7964('0x10')]=parseValue(_0x3005b7,_0x48bd5b[_0x7964('0xe')],_0x48bd5b['value']);return _0x1826c0;};function parseOperator(_0x124af7){var _0x220c6f;switch(_0x124af7){case'$in':_0x220c6f=_0x7964('0x1d');break;case _0x7964('0x1b'):_0x220c6f=_0x7964('0x1e');break;case _0x7964('0x1f'):_0x220c6f=_0x7964('0x20');break;case'$ne':_0x220c6f=_0x7964('0x21');break;case _0x7964('0x22'):case'$startsWith':case'$endsWith':_0x220c6f=_0x7964('0x23');break;case'$lt':_0x220c6f='<\x20?';break;case _0x7964('0x12'):_0x220c6f='>\x20?';break;case _0x7964('0x13'):_0x220c6f='<=\x20?';break;case _0x7964('0x24'):_0x220c6f='>=\x20?';break;case'$between':_0x220c6f=_0x7964('0x25');break;}return _0x220c6f;}function parseValue(_0x23e36b,_0x2b724c,_0x52f561){var _0x322021={'start':undefined,'end':undefined};switch(_0x2b724c){case'$in':case _0x7964('0x1b'):_0x322021['start']=_0x52f561[_0x7964('0x9')](',');break;case _0x7964('0x22'):_0x322021[_0x7964('0x26')]='%'+_0x52f561+'%';break;case'$startsWith':_0x322021['start']=_0x52f561+'%';break;case _0x7964('0x27'):_0x322021[_0x7964('0x26')]='%'+_0x52f561;break;case _0x7964('0xf'):var _0x4025b7=_0x52f561[_0x7964('0x9')](',');var _0x52f561=_0x4025b7['shift']();var _0x272e30=_0x4025b7[_0x7964('0x28')]();if(_0x23e36b==='DATE'){_0x52f561=moment(_0x52f561)['utcOffset'](0x0,!![])[_0x7964('0x16')]();_0x272e30=moment(_0x272e30)['utcOffset'](0x0,!![])[_0x7964('0x14')](0x17,_0x7964('0x29'))[_0x7964('0x14')](0x3b,_0x7964('0x2a'))[_0x7964('0x14')](0x3b,_0x7964('0x2b'))[_0x7964('0x16')]();}_0x322021={'start':_0x52f561,'end':_0x272e30};break;default:_0x322021[_0x7964('0x26')]=_0x52f561;break;}return _0x322021;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index dea261f..aad161f 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb66c=['isEmpty','length','omit','isObject','unset','hasOwnProperty','isNumeric','match','isEmail','forEach','push','join','getOptions','$id','query','model','intersection','attributes','nolimit','limit','offset','where','pick','object','filter','columns','merge','map','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','fields','split','filters','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','name','uniqueid','isArray','sort','cast','priority','unsigned','substr','DESC','col'];(function(_0x5c225c,_0x5b0b1f){var _0x1668e7=function(_0x46a639){while(--_0x46a639){_0x5c225c['push'](_0x5c225c['shift']());}};_0x1668e7(++_0x5b0b1f);}(_0xb66c,0x175));var _0xcb66=function(_0x343f09,_0x5c2785){_0x343f09=_0x343f09-0x0;var _0xee84a3=_0xb66c[_0x343f09];return _0xee84a3;};'use strict';var _=require(_0xcb66('0x0'));var sequelize=require('sequelize');var moment=require(_0xcb66('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x55a57b){var _0x2afcb8=['ne'];try{var _0x24ea13=JSON[_0xcb66('0x2')](_0x55a57b);var _0x5f487c=Object[_0xcb66('0x3')](_0x24ea13)[0x0];return _0x2afcb8[_0xcb66('0x4')](_0x5f487c);}catch(_0x3f7cc7){return![];}}function getOperatorValue(_0x21be55){var _0x5d766d=JSON['parse'](_0x21be55);var _0x19adf5=Object[_0xcb66('0x3')](_0x5d766d)[0x0];var _0xa3993=_0x5d766d[_0x19adf5];return{['$'+_0x19adf5]:_0xa3993};}exports[_0xcb66('0x5')]=function(_0xf7bc39){var _0x58582b=null;if(_0xf7bc39){_0x58582b=_0xf7bc39[_0xcb66('0x6')](',');}return _0x58582b;};exports[_0xcb66('0x7')]=function(_0x174969,_0x25b56c){var _0x3c4ce1={};if(!_['isEmpty'](_0x174969)){_[_0xcb66('0x8')](_0x174969,function(_0x2b32ec,_0xf12828){try{if(_0x25b56c){var _0x38c2e6=_['find'](_0x25b56c,{'name':_0xf12828})||{};if(hasSequelizeOperator(_0x2b32ec)){_0x3c4ce1[_0xf12828]=getOperatorValue(_0x2b32ec);}else if(_0x38c2e6[_0xcb66('0x9')]===_0xcb66('0xa')&&_[_0xcb66('0xb')](_0x2b32ec)){var _0x2339bb=JSON['parse'](_0x2b32ec);var _0x4079ae={'$gte':moment(moment(_0x2339bb[_0xcb66('0xc')])[_0xcb66('0xd')](_0xcb66('0xe')))['utc']()[_0xcb66('0xd')](),'$lte':moment(moment(_0x2339bb['$lte'])[_0xcb66('0xd')]('YYYY-MM-DD'))[_0xcb66('0xf')]()['subtract'](0x1,'s')['format']()};_0x3c4ce1[_0xf12828]=_0x4079ae;}else if(_0x38c2e6[_0xcb66('0x10')]===_0xcb66('0x11')){_0x3c4ce1[_0xf12828]=_0x2b32ec;}else{_0x3c4ce1[_0xf12828]=_[_0xcb66('0x12')](_0x2b32ec)?_0x2b32ec:JSON[_0xcb66('0x2')](_0x2b32ec);}}else{_0x3c4ce1[_0xf12828]=_['isArray'](_0x2b32ec)?_0x2b32ec:JSON[_0xcb66('0x2')](_0x2b32ec);}}catch(_0x42ad03){_0x3c4ce1[_0xf12828]=_0x2b32ec[_0xcb66('0x6')](',');}});}return _0x3c4ce1;};exports['limit']=function(_0x2e4126){_0x2e4126=parseInt(_0x2e4126,0xa);if(!_0x2e4126||_0x2e4126<0x0){_0x2e4126=LIMIT_VALUE;}return _0x2e4126;};exports['offset']=function(_0x4165ea){_0x4165ea=parseInt(_0x4165ea,0xa);if(!_0x4165ea||_0x4165ea<0x0){_0x4165ea=0x0;}return _0x4165ea;};exports[_0xcb66('0x13')]=function(_0xdf0ba0){var _0x1ccb71,_0x540782=null;if(_0xdf0ba0){_0x1ccb71=_0xdf0ba0['split'](',');_0x540782=_['map'](_0x1ccb71,function(_0xb39b87){if(_0xb39b87['indexOf']('-')===0x0){return[_0xb39b87==='priority'?sequelize[_0xcb66('0x14')](sequelize['col'](_0xcb66('0x15')),_0xcb66('0x16')):_0xb39b87[_0xcb66('0x17')](0x1),_0xcb66('0x18')];}else{return[_0xb39b87===_0xcb66('0x15')?sequelize[_0xcb66('0x14')](sequelize[_0xcb66('0x19')]('priority'),_0xcb66('0x16')):_0xb39b87,'ASC'];}});}return _0x540782;};exports['omit']=function(_0xf89c0e,_0x37e4c8){if(_[_0xcb66('0x1a')](_0xf89c0e)){return _0xf89c0e;}if(_['isArray'](_0xf89c0e)){for(var _0x341554=0x0;_0x341554<_0xf89c0e[_0xcb66('0x1b')];_0x341554+=0x1){_0xf89c0e[_0x341554]=this[_0xcb66('0x1c')](_0xf89c0e[_0x341554],_0x37e4c8);}return _0xf89c0e;}if(!_[_0xcb66('0x1d')](_0xf89c0e)){return _0xf89c0e;}if(_['isString'](_0x37e4c8)){_0x37e4c8=[_0x37e4c8];}if(!_[_0xcb66('0x12')](_0x37e4c8)){return _0xf89c0e;}for(var _0x31560e=0x0;_0x31560e<_0x37e4c8[_0xcb66('0x1b')];_0x31560e+=0x1){_[_0xcb66('0x1e')](_0xf89c0e,_0x37e4c8[_0x31560e]);}for(var _0x37a676 in _0xf89c0e){if(_0xf89c0e[_0xcb66('0x1f')](_0x37a676)){_0xf89c0e[_0x37a676]=this[_0xcb66('0x1c')](_0xf89c0e[_0x37a676],_0x37e4c8);}}return _0xf89c0e;};exports[_0xcb66('0x20')]=function(_0x28fc0b){return _0x28fc0b[_0xcb66('0x21')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xcb66('0x22')]=function(_0x5b7cf2){return _0x5b7cf2['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x31a10a){var _0x4ca8b4=[];_0x31a10a[_0xcb66('0x6')](/[ ,]+/)[_0xcb66('0x23')](function(_0x1b8a79){_0x1b8a79=_0x1b8a79['replace'](/([^:]")"+/g,'$1');_0x1b8a79='+'+_0x1b8a79+'*';var _0x123787=/[ `!@#$%^&*()_\-?~]/;if(_0x1b8a79[_0xcb66('0x21')](_0x123787))_0x1b8a79='\x22'+_0x1b8a79+'\x22';_0x4ca8b4[_0xcb66('0x24')](_0x1b8a79);});return _0x4ca8b4[_0xcb66('0x25')]('\x20');};exports[_0xcb66('0x26')]=function(_0x375636,_0x2a5e56,_0x36dfe3){var _0x2d27f7={},_0x3e4755={};if(_0x2a5e56['query'][_0xcb66('0x27')]){_0x2a5e56[_0xcb66('0x28')]['id']=_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x27')];delete _0x2a5e56[_0xcb66('0x28')][_0xcb66('0x27')];}_0x2d27f7[_0xcb66('0x29')]=_['map'](_0x375636,_0xcb66('0x10'));_0x2d27f7[_0xcb66('0x28')]=_[_0xcb66('0x3')](_0x2a5e56[_0xcb66('0x28')]);_0x2d27f7['filters']=_[_0xcb66('0x2a')](_0x2d27f7[_0xcb66('0x29')],_0x2d27f7[_0xcb66('0x28')]);_0x3e4755[_0xcb66('0x2b')]=_[_0xcb66('0x2a')](_0x2d27f7[_0xcb66('0x29')],this[_0xcb66('0x5')](_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x5')]));_0x3e4755[_0xcb66('0x2b')]=_0x3e4755[_0xcb66('0x2b')][_0xcb66('0x1b')]?_0x3e4755['attributes']:_0x2d27f7['model'];if(!_0x2a5e56['query'][_0xcb66('0x1f')](_0xcb66('0x2c'))){_0x3e4755[_0xcb66('0x2d')]=this[_0xcb66('0x2d')](_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x2d')]);_0x3e4755['offset']=this[_0xcb66('0x2e')](_0x2a5e56['query']['offset']);}_0x3e4755['order']=this[_0xcb66('0x13')](_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x13')]);_0x3e4755[_0xcb66('0x2f')]=this[_0xcb66('0x7')](_[_0xcb66('0x30')](_0x2a5e56[_0xcb66('0x28')],_0x2d27f7[_0xcb66('0x7')]),_0x375636);if(_0x2a5e56[_0xcb66('0x28')]['filter']){var _0xe45331=_0x375636;var _0x3f2781=_0x2a5e56[_0xcb66('0x28')]['filter'];if(typeof _0x3f2781===_0xcb66('0x31')){_0xe45331=_[_0xcb66('0x32')](_0x375636,function(_0x4a5934){return _['includes'](_0x3f2781[_0xcb66('0x33')],_0x4a5934['name']);});_0x3f2781=_0x3f2781['value'];}_0x3e4755[_0xcb66('0x2f')]=_[_0xcb66('0x34')](_0x3e4755[_0xcb66('0x2f')],{'$or':_[_0xcb66('0x35')](_0xe45331,function(_0x99229){if(_0x99229[_0xcb66('0x9')]!==_0xcb66('0x36')){if(_0x36dfe3){return sequelize[_0xcb66('0x2f')](sequelize['fn'](_0xcb66('0x37'),sequelize['col'](_0x99229['name'])),{'$like':sequelize['fn']('lower','%'+_0x2a5e56[_0xcb66('0x28')]['filter']+'%')});}else{var _0x8736aa={};_0x8736aa[_0x99229['name']]={'$like':'%'+_0x2a5e56[_0xcb66('0x28')][_0xcb66('0x32')]+'%'};return _0x8736aa;}}})});}_0x3e4755=_[_0xcb66('0x34')]({},_0x3e4755,_0x2a5e56[_0xcb66('0x38')]);return _0x3e4755;}; \ No newline at end of file +var _0x29d4=['map','indexOf','priority','cast','unsigned','substr','DESC','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','$id','query','name','model','intersection','attributes','nolimit','order','where','object','filter','value','merge','lower','col','options','lodash','moment','parse','keys','includes','fields','split','filters','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','$lte','format','subtract','uniqueid','isArray','limit','offset','sort'];(function(_0x53a29e,_0x30fee8){var _0x563f27=function(_0x262478){while(--_0x262478){_0x53a29e['push'](_0x53a29e['shift']());}};_0x563f27(++_0x30fee8);}(_0x29d4,0x1a1));var _0x429d=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x29d4[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x429d('0x0'));var sequelize=require('sequelize');var moment=require(_0x429d('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x40881e){var _0x16ce75=['ne'];try{var _0x472fc9=JSON[_0x429d('0x2')](_0x40881e);var _0x4e287b=Object[_0x429d('0x3')](_0x472fc9)[0x0];return _0x16ce75[_0x429d('0x4')](_0x4e287b);}catch(_0x36a3d8){return![];}}function getOperatorValue(_0x5e2a9c){var _0x1c55aa=JSON[_0x429d('0x2')](_0x5e2a9c);var _0x56aa2f=Object[_0x429d('0x3')](_0x1c55aa)[0x0];var _0x4befb9=_0x1c55aa[_0x56aa2f];return{['$'+_0x56aa2f]:_0x4befb9};}exports[_0x429d('0x5')]=function(_0x47cb29){var _0x471129=null;if(_0x47cb29){_0x471129=_0x47cb29[_0x429d('0x6')](',');}return _0x471129;};exports[_0x429d('0x7')]=function(_0x5e8430,_0x1f9b3e){var _0x8c7cb6={};if(!_['isEmpty'](_0x5e8430)){_[_0x429d('0x8')](_0x5e8430,function(_0x2fd1ca,_0x417f77){try{if(_0x1f9b3e){var _0x5b45c2=_[_0x429d('0x9')](_0x1f9b3e,{'name':_0x417f77})||{};if(hasSequelizeOperator(_0x2fd1ca)){_0x8c7cb6[_0x417f77]=getOperatorValue(_0x2fd1ca);}else if(_0x5b45c2[_0x429d('0xa')]===_0x429d('0xb')&&_[_0x429d('0xc')](_0x2fd1ca)){var _0x4843af=JSON[_0x429d('0x2')](_0x2fd1ca);var _0x158942={'$gte':moment(moment(_0x4843af[_0x429d('0xd')])['format'](_0x429d('0xe')))[_0x429d('0xf')]()['format'](),'$lte':moment(moment(_0x4843af[_0x429d('0x10')])[_0x429d('0x11')](_0x429d('0xe')))[_0x429d('0xf')]()[_0x429d('0x12')](0x1,'s')[_0x429d('0x11')]()};_0x8c7cb6[_0x417f77]=_0x158942;}else if(_0x5b45c2['name']===_0x429d('0x13')){_0x8c7cb6[_0x417f77]=_0x2fd1ca;}else{_0x8c7cb6[_0x417f77]=_['isArray'](_0x2fd1ca)?_0x2fd1ca:JSON[_0x429d('0x2')](_0x2fd1ca);}}else{_0x8c7cb6[_0x417f77]=_[_0x429d('0x14')](_0x2fd1ca)?_0x2fd1ca:JSON[_0x429d('0x2')](_0x2fd1ca);}}catch(_0x2dc57a){_0x8c7cb6[_0x417f77]=_0x2fd1ca['split'](',');}});}return _0x8c7cb6;};exports[_0x429d('0x15')]=function(_0xc80aab){_0xc80aab=parseInt(_0xc80aab,0xa);if(!_0xc80aab||_0xc80aab<0x0){_0xc80aab=LIMIT_VALUE;}return _0xc80aab;};exports[_0x429d('0x16')]=function(_0x513854){_0x513854=parseInt(_0x513854,0xa);if(!_0x513854||_0x513854<0x0){_0x513854=0x0;}return _0x513854;};exports[_0x429d('0x17')]=function(_0x36916d){var _0x202c4e,_0xcbf00c=null;if(_0x36916d){_0x202c4e=_0x36916d[_0x429d('0x6')](',');_0xcbf00c=_[_0x429d('0x18')](_0x202c4e,function(_0x5a4093){if(_0x5a4093[_0x429d('0x19')]('-')===0x0){return[_0x5a4093===_0x429d('0x1a')?sequelize[_0x429d('0x1b')](sequelize['col'](_0x429d('0x1a')),_0x429d('0x1c')):_0x5a4093[_0x429d('0x1d')](0x1),_0x429d('0x1e')];}else{return[_0x5a4093===_0x429d('0x1a')?sequelize[_0x429d('0x1b')](sequelize['col'](_0x429d('0x1a')),_0x429d('0x1c')):_0x5a4093,'ASC'];}});}return _0xcbf00c;};exports[_0x429d('0x1f')]=function(_0x37fbf9,_0x1ed030){if(_[_0x429d('0x20')](_0x37fbf9)){return _0x37fbf9;}if(_['isArray'](_0x37fbf9)){for(var _0x3b12f6=0x0;_0x3b12f6<_0x37fbf9[_0x429d('0x21')];_0x3b12f6+=0x1){_0x37fbf9[_0x3b12f6]=this[_0x429d('0x1f')](_0x37fbf9[_0x3b12f6],_0x1ed030);}return _0x37fbf9;}if(!_[_0x429d('0x22')](_0x37fbf9)){return _0x37fbf9;}if(_[_0x429d('0x23')](_0x1ed030)){_0x1ed030=[_0x1ed030];}if(!_['isArray'](_0x1ed030)){return _0x37fbf9;}for(var _0x33e4a4=0x0;_0x33e4a4<_0x1ed030[_0x429d('0x21')];_0x33e4a4+=0x1){_[_0x429d('0x24')](_0x37fbf9,_0x1ed030[_0x33e4a4]);}for(var _0x1cba36 in _0x37fbf9){if(_0x37fbf9[_0x429d('0x25')](_0x1cba36)){_0x37fbf9[_0x1cba36]=this[_0x429d('0x1f')](_0x37fbf9[_0x1cba36],_0x1ed030);}}return _0x37fbf9;};exports[_0x429d('0x26')]=function(_0xdc7bf9){return _0xdc7bf9[_0x429d('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x429d('0x28')]=function(_0x3ca640){return _0x3ca640['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x429d('0x29')]=function(_0x30c1ba){var _0x2e95b5=[];_0x30c1ba[_0x429d('0x6')](/[ ,]+/)[_0x429d('0x2a')](function(_0x481122){_0x481122=_0x481122[_0x429d('0x2b')](/([^:]")"+/g,'$1');_0x481122='+'+_0x481122+'*';var _0x6761d=/[ `!@#$%^&*()_\-?~]/;if(_0x481122[_0x429d('0x27')](_0x6761d))_0x481122='\x22'+_0x481122+'\x22';_0x2e95b5[_0x429d('0x2c')](_0x481122);});return _0x2e95b5[_0x429d('0x2d')]('\x20');};exports[_0x429d('0x2e')]=function(_0x4dcacd,_0x559bd5,_0x6d33c7){var _0x3da9d9={},_0x4d83fb={};if(_0x559bd5['query'][_0x429d('0x2f')]){_0x559bd5['query']['id']=_0x559bd5[_0x429d('0x30')][_0x429d('0x2f')];delete _0x559bd5[_0x429d('0x30')][_0x429d('0x2f')];}_0x3da9d9['model']=_[_0x429d('0x18')](_0x4dcacd,_0x429d('0x31'));_0x3da9d9['query']=_['keys'](_0x559bd5['query']);_0x3da9d9['filters']=_['intersection'](_0x3da9d9[_0x429d('0x32')],_0x3da9d9['query']);_0x4d83fb['attributes']=_[_0x429d('0x33')](_0x3da9d9[_0x429d('0x32')],this[_0x429d('0x5')](_0x559bd5[_0x429d('0x30')][_0x429d('0x5')]));_0x4d83fb[_0x429d('0x34')]=_0x4d83fb['attributes'][_0x429d('0x21')]?_0x4d83fb[_0x429d('0x34')]:_0x3da9d9[_0x429d('0x32')];if(!_0x559bd5[_0x429d('0x30')][_0x429d('0x25')](_0x429d('0x35'))){_0x4d83fb[_0x429d('0x15')]=this[_0x429d('0x15')](_0x559bd5[_0x429d('0x30')][_0x429d('0x15')]);_0x4d83fb[_0x429d('0x16')]=this[_0x429d('0x16')](_0x559bd5[_0x429d('0x30')][_0x429d('0x16')]);}_0x4d83fb[_0x429d('0x36')]=this[_0x429d('0x17')](_0x559bd5['query']['sort']);_0x4d83fb[_0x429d('0x37')]=this[_0x429d('0x7')](_['pick'](_0x559bd5[_0x429d('0x30')],_0x3da9d9[_0x429d('0x7')]),_0x4dcacd);if(_0x559bd5[_0x429d('0x30')]['filter']){var _0x50a907=_0x4dcacd;var _0x257ce3=_0x559bd5[_0x429d('0x30')]['filter'];if(typeof _0x257ce3===_0x429d('0x38')){_0x50a907=_[_0x429d('0x39')](_0x4dcacd,function(_0x57dcda){return _[_0x429d('0x4')](_0x257ce3['columns'],_0x57dcda[_0x429d('0x31')]);});_0x257ce3=_0x257ce3[_0x429d('0x3a')];}_0x4d83fb[_0x429d('0x37')]=_[_0x429d('0x3b')](_0x4d83fb['where'],{'$or':_[_0x429d('0x18')](_0x50a907,function(_0x38b40c){if(_0x38b40c[_0x429d('0xa')]!=='VIRTUAL'){if(_0x6d33c7){return sequelize['where'](sequelize['fn'](_0x429d('0x3c'),sequelize[_0x429d('0x3d')](_0x38b40c[_0x429d('0x31')])),{'$like':sequelize['fn'](_0x429d('0x3c'),'%'+_0x559bd5['query'][_0x429d('0x39')]+'%')});}else{var _0xbff12e={};_0xbff12e[_0x38b40c[_0x429d('0x31')]]={'$like':'%'+_0x559bd5[_0x429d('0x30')][_0x429d('0x39')]+'%'};return _0xbff12e;}}})});}_0x4d83fb=_[_0x429d('0x3b')]({},_0x4d83fb,_0x559bd5[_0x429d('0x3e')]);return _0x4d83fb;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 63e38a9..24b6c80 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8897=['then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','sort','globalStatus','pause','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','Agents'];(function(_0x5c056f,_0x2abaf5){var _0x27b15d=function(_0x25235c){while(--_0x25235c){_0x5c056f['push'](_0x5c056f['shift']());}};_0x27b15d(++_0x2abaf5);}(_0x8897,0xa5));var _0x7889=function(_0x59311b,_0xef8110){_0x59311b=_0x59311b-0x0;var _0x47c4fb=_0x8897[_0x59311b];return _0x47c4fb;};'use strict';var _=require('lodash');var jayson=require(_0x7889('0x0'));var db=require(_0x7889('0x1'))['db'];var amiClient=jayson['client'][_0x7889('0x2')]({'port':0x232a});var routingClient=jayson[_0x7889('0x3')][_0x7889('0x2')]({'port':0x232c});function isAgentPaused(_0x29ab3e,_0x153b6a){var _0x570741=[_0x29ab3e[_0x7889('0x4')],_0x29ab3e[_0x7889('0x5')],_0x29ab3e[_0x7889('0x6')],_0x29ab3e[_0x7889('0x7')],_0x29ab3e[_0x7889('0x8')],_0x29ab3e[_0x7889('0x9')],_0x29ab3e[_0x7889('0xa')]];if(!_0x153b6a)return _[_0x7889('0xb')](_0x570741);var _0x327824=_['filter'](_0x570741);return _0x327824['length']>0x0&&_0x327824[_0x7889('0xc')]<_0x570741['length']?!![]:![];}function isIdle(_0x17665b){return _0x17665b===_0x7889('0xd')||_0x17665b===_0x7889('0xe')||_0x17665b===_0x7889('0xf')||_0x17665b===_0x7889('0x10')||_[_0x7889('0x11')](_0x17665b);}function isAgentIdle(_0xed057d){if(_0xed057d[_0x7889('0x12')]!=='idle'&&_0xed057d[_0x7889('0x9')]){_0xed057d[_0x7889('0x12')]='pause';return![];}return _['every']([_0xed057d[_0x7889('0x13')],_0xed057d['faxStatus'],_0xed057d[_0x7889('0x14')],_0xed057d[_0x7889('0x15')],_0xed057d[_0x7889('0x16')],_0xed057d[_0x7889('0x12')],_0xed057d[_0x7889('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x7889('0x18'),{})[_0x7889('0x19')](function(_0x16291b){if(_0x16291b['error']){throw new Error(_0x7889('0x1a'));}var _0x479a7f=_0x16291b[_0x7889('0x1b')];return routingClient['request'](_0x7889('0x18'),{})[_0x7889('0x19')](function(_0x299a7a){if(_0x299a7a[_0x7889('0x1c')]){throw new Error(_0x7889('0x1d'));}var _0x4a9f6e=_0x299a7a[_0x7889('0x1b')];return _[_0x7889('0x1e')]({},_0x479a7f,_0x4a9f6e);});})[_0x7889('0x1f')](function(_0xb7fd14){throw _0xb7fd14;});}exports[_0x7889('0x20')]=getRealtimeAgents;function getAgentStatus(_0x48e6cc){var _0x57a6e5='unknown';if(isAgentPaused(_0x48e6cc))_0x57a6e5='pause';else if(isAgentPaused(_0x48e6cc,!![]))_0x57a6e5='*pause';else if(isAgentIdle(_0x48e6cc))_0x57a6e5=_0x7889('0xd');else _0x57a6e5=_0x7889('0x21');return _0x57a6e5;}exports[_0x7889('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x1d4caf,_0x9dd454){var _0x583168=_['isArray'](_0x1d4caf)?_0x1d4caf:[_0x1d4caf];var _0x5b8bd=_[_0x7889('0x23')](_0x9dd454)+_0x7889('0x24');var _0xbcba8e=_[_0x7889('0x25')](_0x583168,function(_0x39b16a){return db[_0x5b8bd][_0x7889('0x26')]({'where':{'id':_0x39b16a}})[_0x7889('0x19')](function(_0x4452f8){if(!_0x4452f8)return[];return _0x4452f8[_0x7889('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0xbcba8e)[_0x7889('0x19')](function(_0x16b209){var _0x555f60=_(_0x16b209)[_0x7889('0x28')]()['map']('id')[_0x7889('0x29')]()[_0x7889('0x2a')]();return _0x555f60;});}exports[_0x7889('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5dc7ad,_0x372842,_0x3d18a0){try{if(_0x372842[_0x7889('0xc')]>0x0){_0x5dc7ad=_0x5dc7ad[_0x7889('0x2c')](function(_0x23be57){return _0x372842[_0x7889('0x2d')](_0x23be57['id']);});}var _0x37d64a=_0x5dc7ad[_0x7889('0x2c')](function(_0x55810a){var _0x5ef5be=_0x7889('0x21');if(isAgentIdle(_0x55810a)){_0x5ef5be=_0x7889('0xd');}return _0x5ef5be===_0x3d18a0;});return _[_0x7889('0x25')](_0x37d64a,'id');}catch(_0x12aa76){throw _0x12aa76;}}exports[_0x7889('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1ec941,_0x5a3c39,_0x1e861e){return Promise[_0x7889('0x2f')]()['then'](function(){if(_0x5a3c39[_0x7889('0xc')]>0x0){_0x1ec941=_0x1ec941[_0x7889('0x2c')](function(_0x5782ea){return _0x5a3c39['includes'](_0x5782ea['id']);});}return _0x1ec941;})[_0x7889('0x19')](function(){return db['User'][_0x7889('0x30')]({'attributes':['id',_0x7889('0x31'),_0x7889('0x32'),_0x7889('0x4'),_0x7889('0x5'),_0x7889('0x6'),_0x7889('0x7'),_0x7889('0x8'),_0x7889('0x9'),_0x7889('0xa'),'pauseType'],'where':{'id':{'$in':_[_0x7889('0x25')](_0x1ec941,'id')}},'raw':!![]});})[_0x7889('0x19')](function(_0x449be5){return _0x449be5[_0x7889('0x25')](function(_0x532488){var _0x32c44d=_['find'](_0x1ec941,['id',_0x532488['id']]);var _0xe5c805=filterAgentAttributes(_0x32c44d);_[_0x7889('0x1e')](_0x532488,_0xe5c805);_0x532488['globalStatus']=getAgentStatus(_0x532488);return _0x532488;});})[_0x7889('0x19')](function(_0x2c0298){var _0x9d0157=sortAgentsByStatus(_0x2c0298,_0x1e861e);return _[_0x7889('0x25')](_0x9d0157,'id');})[_0x7889('0x1f')](function(_0x5afb99){throw _0x5afb99;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4b9313){var _0x5dbc8e={'fields':[],'order':null};var _0x5b8ec7=_0x4b9313[_0x7889('0x33')](',');_0x5dbc8e[_0x7889('0x34')]=_[_0x7889('0x2c')](_0x5b8ec7,function(_0x96f92){if(!_0x96f92[_0x7889('0x2d')]('globalStatus')){return!![];}_0x5dbc8e[_0x7889('0x35')]=_[_0x7889('0x36')](_0x96f92,'-')?_0x7889('0x37'):_0x7889('0x38');return![];});return _0x5dbc8e;}exports[_0x7889('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x293f7a){if(_0x293f7a[_0x7889('0x2d')](_0x7889('0x32'))&&!_0x293f7a[_0x7889('0x2d')](_0x7889('0x3a'))){var _0x218758=_0x293f7a[_0x7889('0x3b')](0x0,_0x293f7a[_0x7889('0x3c')]('fullname'));_0x293f7a+=','+_0x218758+_0x7889('0x3a');}return _0x293f7a;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x86dacf,_0xf1e62d){var _0x3e6316=_0x86dacf[_0x7889('0x3d')](function(_0x49ce5b,_0x2d8dcd){if(_0x49ce5b[_0x7889('0x3e')]===_0x2d8dcd[_0x7889('0x3e')]){if(_0x49ce5b[_0x7889('0x3e')]===_0x7889('0x3f')){if(_0xf1e62d==='DESC'){return(_0x49ce5b[_0x7889('0x40')]||'')<(_0x2d8dcd['pauseType']||'')||_0x49ce5b[_0x7889('0x32')]['toLowerCase']()>_0x2d8dcd[_0x7889('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x49ce5b['pauseType']||'')<(_0x2d8dcd[_0x7889('0x40')]||'')||_0x49ce5b[_0x7889('0x32')][_0x7889('0x41')]()>_0x2d8dcd['fullname'][_0x7889('0x41')]()?-0x1:0x1;}}else{if(_0xf1e62d===_0x7889('0x37')){return _0x49ce5b[_0x7889('0x32')]['toLowerCase']()<_0x2d8dcd[_0x7889('0x32')]['toLowerCase']()?0x1:-0x1;}else{return _0x49ce5b['fullname'][_0x7889('0x41')]()<_0x2d8dcd[_0x7889('0x32')][_0x7889('0x41')]()?-0x1:0x1;}}}else{if(_0xf1e62d==='DESC'){return _0x49ce5b[_0x7889('0x3e')]<_0x2d8dcd[_0x7889('0x3e')]?0x1:-0x1;}else{return _0x49ce5b[_0x7889('0x3e')]<_0x2d8dcd['globalStatus']?-0x1:0x1;}}});return _0x3e6316;}exports[_0x7889('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x2196f0){var _0x7b3108=[_0x7889('0x43'),_0x7889('0x44'),_0x7889('0x45'),_0x7889('0x46'),_0x7889('0x40'),_0x7889('0x46'),_0x7889('0x3a'),'address',_0x7889('0x4'),_0x7889('0x7'),'mailPause',_0x7889('0x8'),_0x7889('0xa'),_0x7889('0x5'),'voicePause',_0x7889('0x47'),_0x7889('0x48'),_0x7889('0x49'),_0x7889('0x4a'),'whatsappCapacity',_0x7889('0x4b'),_0x7889('0x4c'),_0x7889('0x4d'),_0x7889('0x4e'),_0x7889('0x4f'),_0x7889('0x50'),_0x7889('0x51'),_0x7889('0x13'),'openchannelStatus',_0x7889('0x14'),_0x7889('0x16'),_0x7889('0x17'),_0x7889('0x52'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0x7889('0x53'),_0x7889('0x54'),'whatsappStatusTime',_0x7889('0x55'),_0x7889('0x56'),'queue',_0x7889('0x57'),_0x7889('0x58'),_0x7889('0x59'),_0x7889('0x5a'),_0x7889('0x5b')];var _0x372a49=[_0x7889('0x4'),_0x7889('0x7'),_0x7889('0x6'),_0x7889('0x8'),'whatsappPause',_0x7889('0x5'),'voicePause',_0x7889('0x44')];var _0x3391be=_(_0x2196f0)[_0x7889('0x5c')](_0x372a49)[_0x7889('0x5d')](_0x7b3108)[_0x7889('0x2a')]();return _0x3391be;}exports[_0x7889('0x5e')]=filterAgentAttributes; \ No newline at end of file +var _0xae88=['openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','whatsappPause','omit','pick','filterAgentAttributes','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','filter','length','idle','unknown','ringing','voiceStatus','pause','mailStatus','openchannelStatus','whatsappStatus','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','*pause','getAgentStatus','isArray','startCase','Queue','findOne','getAgents','flatten','value','getAgentIdsByQueues','busy','getAgentIdsByStatus','includes','User','name','fullname','pauseType','map','find','catch','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','globalStatus','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','openchannelPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','smsStatus','chatStatusTime'];(function(_0x30e65c,_0x1967dc){var _0xaff1b7=function(_0x5f0012){while(--_0x5f0012){_0x30e65c['push'](_0x30e65c['shift']());}};_0xaff1b7(++_0x1967dc);}(_0xae88,0x188));var _0x8ae8=function(_0x33e2c9,_0x77c7c3){_0x33e2c9=_0x33e2c9-0x0;var _0xd7a82b=_0xae88[_0x33e2c9];return _0xd7a82b;};'use strict';var _=require('lodash');var jayson=require(_0x8ae8('0x0'));var db=require(_0x8ae8('0x1'))['db'];var amiClient=jayson[_0x8ae8('0x2')][_0x8ae8('0x3')]({'port':0x232a});var routingClient=jayson[_0x8ae8('0x2')][_0x8ae8('0x3')]({'port':0x232c});function isAgentPaused(_0x2bf8ae,_0x2e79c1){var _0x460c53=[_0x2bf8ae[_0x8ae8('0x4')],_0x2bf8ae[_0x8ae8('0x5')],_0x2bf8ae[_0x8ae8('0x6')],_0x2bf8ae['openchannelPause'],_0x2bf8ae[_0x8ae8('0x7')],_0x2bf8ae[_0x8ae8('0x8')],_0x2bf8ae['whatsappPause']];if(!_0x2e79c1)return _['every'](_0x460c53);var _0x5227e3=_[_0x8ae8('0x9')](_0x460c53);return _0x5227e3[_0x8ae8('0xa')]>0x0&&_0x5227e3[_0x8ae8('0xa')]<_0x460c53[_0x8ae8('0xa')]?!![]:![];}function isIdle(_0x43525){return _0x43525===_0x8ae8('0xb')||_0x43525===_0x8ae8('0xc')||_0x43525==='unavailable'||_0x43525===_0x8ae8('0xd')||_['isNil'](_0x43525);}function isAgentIdle(_0x5051a7){if(_0x5051a7[_0x8ae8('0xe')]!==_0x8ae8('0xb')&&_0x5051a7['voicePause']){_0x5051a7[_0x8ae8('0xe')]=_0x8ae8('0xf');return![];}return _['every']([_0x5051a7['chatStatus'],_0x5051a7['faxStatus'],_0x5051a7[_0x8ae8('0x10')],_0x5051a7[_0x8ae8('0x11')],_0x5051a7['smsStatus'],_0x5051a7['voiceStatus'],_0x5051a7[_0x8ae8('0x12')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x8ae8('0x13'),{})['then'](function(_0x5037a0){if(_0x5037a0[_0x8ae8('0x14')]){throw new Error(_0x8ae8('0x15'));}var _0x3a0435=_0x5037a0[_0x8ae8('0x16')];return routingClient[_0x8ae8('0x17')](_0x8ae8('0x13'),{})[_0x8ae8('0x18')](function(_0x3be258){if(_0x3be258[_0x8ae8('0x14')]){throw new Error(_0x8ae8('0x19'));}var _0x48d901=_0x3be258[_0x8ae8('0x16')];return _[_0x8ae8('0x1a')]({},_0x3a0435,_0x48d901);});})['catch'](function(_0x2e0efa){throw _0x2e0efa;});}exports[_0x8ae8('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x58c972){var _0x209404='unknown';if(isAgentPaused(_0x58c972))_0x209404=_0x8ae8('0xf');else if(isAgentPaused(_0x58c972,!![]))_0x209404=_0x8ae8('0x1c');else if(isAgentIdle(_0x58c972))_0x209404=_0x8ae8('0xb');else _0x209404='busy';return _0x209404;}exports[_0x8ae8('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0xad9f9b,_0x33a3d1){var _0xf07657=_[_0x8ae8('0x1e')](_0xad9f9b)?_0xad9f9b:[_0xad9f9b];var _0x3eaa9b=_[_0x8ae8('0x1f')](_0x33a3d1)+_0x8ae8('0x20');var _0x39e1a9=_['map'](_0xf07657,function(_0x3eb1d9){return db[_0x3eaa9b][_0x8ae8('0x21')]({'where':{'id':_0x3eb1d9}})[_0x8ae8('0x18')](function(_0x19a78d){if(!_0x19a78d)return[];return _0x19a78d[_0x8ae8('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x39e1a9)[_0x8ae8('0x18')](function(_0x230be3){var _0x14f79d=_(_0x230be3)[_0x8ae8('0x23')]()['map']('id')['uniq']()[_0x8ae8('0x24')]();return _0x14f79d;});}exports[_0x8ae8('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x29a554,_0x33a2fb,_0x33d6af){try{if(_0x33a2fb[_0x8ae8('0xa')]>0x0){_0x29a554=_0x29a554[_0x8ae8('0x9')](function(_0xc93691){return _0x33a2fb['includes'](_0xc93691['id']);});}var _0x270cc5=_0x29a554['filter'](function(_0x203303){var _0x99aa92=_0x8ae8('0x26');if(isAgentIdle(_0x203303)){_0x99aa92=_0x8ae8('0xb');}return _0x99aa92===_0x33d6af;});return _['map'](_0x270cc5,'id');}catch(_0x92bc1c){throw _0x92bc1c;}}exports[_0x8ae8('0x27')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x142702,_0xa8627b,_0x3fa125){return Promise['resolve']()[_0x8ae8('0x18')](function(){if(_0xa8627b['length']>0x0){_0x142702=_0x142702[_0x8ae8('0x9')](function(_0x3b4310){return _0xa8627b[_0x8ae8('0x28')](_0x3b4310['id']);});}return _0x142702;})[_0x8ae8('0x18')](function(){return db[_0x8ae8('0x29')]['findAll']({'attributes':['id',_0x8ae8('0x2a'),_0x8ae8('0x2b'),_0x8ae8('0x4'),_0x8ae8('0x5'),_0x8ae8('0x6'),'openchannelPause',_0x8ae8('0x7'),_0x8ae8('0x8'),'whatsappPause',_0x8ae8('0x2c')],'where':{'id':{'$in':_[_0x8ae8('0x2d')](_0x142702,'id')}},'raw':!![]});})['then'](function(_0x829992){return _0x829992[_0x8ae8('0x2d')](function(_0x7eb6da){var _0x4acfad=_[_0x8ae8('0x2e')](_0x142702,['id',_0x7eb6da['id']]);var _0x164702=filterAgentAttributes(_0x4acfad);_[_0x8ae8('0x1a')](_0x7eb6da,_0x164702);_0x7eb6da['globalStatus']=getAgentStatus(_0x7eb6da);return _0x7eb6da;});})[_0x8ae8('0x18')](function(_0x59af51){var _0x385811=sortAgentsByStatus(_0x59af51,_0x3fa125);return _[_0x8ae8('0x2d')](_0x385811,'id');})[_0x8ae8('0x2f')](function(_0x3cfecf){throw _0x3cfecf;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2285e2){var _0x223ba7={'fields':[],'order':null};var _0x3f3fe8=_0x2285e2[_0x8ae8('0x30')](',');_0x223ba7[_0x8ae8('0x31')]=_[_0x8ae8('0x9')](_0x3f3fe8,function(_0x3beea9){if(!_0x3beea9[_0x8ae8('0x28')]('globalStatus')){return!![];}_0x223ba7[_0x8ae8('0x32')]=_[_0x8ae8('0x33')](_0x3beea9,'-')?_0x8ae8('0x34'):_0x8ae8('0x35');return![];});return _0x223ba7;}exports[_0x8ae8('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x179859){if(_0x179859['includes'](_0x8ae8('0x2b'))&&!_0x179859['includes'](_0x8ae8('0x37'))){var _0x44c423=_0x179859[_0x8ae8('0x38')](0x0,_0x179859[_0x8ae8('0x39')]('fullname'));_0x179859+=','+_0x44c423+_0x8ae8('0x37');}return _0x179859;}exports[_0x8ae8('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x601827,_0x5eb56a){var _0x1efbd6=_0x601827[_0x8ae8('0x3b')](function(_0x2c6eed,_0x2cf851){if(_0x2c6eed[_0x8ae8('0x3c')]===_0x2cf851['globalStatus']){if(_0x2c6eed[_0x8ae8('0x3c')]==='pause'){if(_0x5eb56a===_0x8ae8('0x34')){return(_0x2c6eed[_0x8ae8('0x2c')]||'')<(_0x2cf851[_0x8ae8('0x2c')]||'')||_0x2c6eed[_0x8ae8('0x2b')]['toLowerCase']()>_0x2cf851[_0x8ae8('0x2b')]['toLowerCase']()?0x1:-0x1;}else{return(_0x2c6eed[_0x8ae8('0x2c')]||'')<(_0x2cf851[_0x8ae8('0x2c')]||'')||_0x2c6eed[_0x8ae8('0x2b')][_0x8ae8('0x3d')]()>_0x2cf851['fullname'][_0x8ae8('0x3d')]()?-0x1:0x1;}}else{if(_0x5eb56a===_0x8ae8('0x34')){return _0x2c6eed[_0x8ae8('0x2b')][_0x8ae8('0x3d')]()<_0x2cf851[_0x8ae8('0x2b')][_0x8ae8('0x3d')]()?0x1:-0x1;}else{return _0x2c6eed[_0x8ae8('0x2b')][_0x8ae8('0x3d')]()<_0x2cf851['fullname'][_0x8ae8('0x3d')]()?-0x1:0x1;}}}else{if(_0x5eb56a===_0x8ae8('0x34')){return _0x2c6eed['globalStatus']<_0x2cf851[_0x8ae8('0x3c')]?0x1:-0x1;}else{return _0x2c6eed[_0x8ae8('0x3c')]<_0x2cf851[_0x8ae8('0x3c')]?-0x1:0x1;}}});return _0x1efbd6;}exports[_0x8ae8('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x2e635a){var _0x137085=[_0x8ae8('0x3f'),_0x8ae8('0x40'),'lastLoginAt',_0x8ae8('0x41'),_0x8ae8('0x2c'),_0x8ae8('0x41'),'internal',_0x8ae8('0x42'),'chatPause',_0x8ae8('0x43'),'mailPause',_0x8ae8('0x7'),'whatsappPause',_0x8ae8('0x5'),_0x8ae8('0x8'),_0x8ae8('0x44'),_0x8ae8('0x45'),_0x8ae8('0x46'),'smsCapacity',_0x8ae8('0x47'),_0x8ae8('0x48'),'chatCurrentCapacity',_0x8ae8('0x49'),_0x8ae8('0x4a'),'smsCurrentCapacity',_0x8ae8('0x4b'),'faxCurrentCapacity','chatStatus',_0x8ae8('0x11'),_0x8ae8('0x10'),_0x8ae8('0x4c'),_0x8ae8('0x12'),'faxStatus','voiceStatus',_0x8ae8('0x4d'),_0x8ae8('0x4e'),_0x8ae8('0x4f'),_0x8ae8('0x50'),_0x8ae8('0x51'),_0x8ae8('0x52'),_0x8ae8('0x53'),_0x8ae8('0x54'),_0x8ae8('0x55'),_0x8ae8('0x56'),_0x8ae8('0x57'),_0x8ae8('0x58'),_0x8ae8('0x59')];var _0x1054c6=[_0x8ae8('0x4'),_0x8ae8('0x43'),_0x8ae8('0x6'),'smsPause',_0x8ae8('0x5a'),_0x8ae8('0x5'),_0x8ae8('0x8'),_0x8ae8('0x40')];var _0x1a3708=_(_0x2e635a)[_0x8ae8('0x5b')](_0x1054c6)[_0x8ae8('0x5c')](_0x137085)[_0x8ae8('0x24')]();return _0x1a3708;}exports[_0x8ae8('0x5d')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 90ee822..b9ce5f0 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb164=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','get','available','voice','find','merge','pick','lodash','util','client','http','loggedIn','paused','waiting','inUse','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAnsweredCalls'];(function(_0x1e52bf,_0x4cfa32){var _0x2fdc63=function(_0x243d06){while(--_0x243d06){_0x1e52bf['push'](_0x1e52bf['shift']());}};_0x2fdc63(++_0x4cfa32);}(_0xb164,0x172));var _0x4b16=function(_0xea18b8,_0x52b097){_0xea18b8=_0xea18b8-0x0;var _0x992982=_0xb164[_0xea18b8];return _0x992982;};'use strict';var _=require(_0x4b16('0x0'));var jayson=require('jayson/promise');var util=require(_0x4b16('0x1'));var amiClient=jayson[_0x4b16('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x4b16('0x2')][_0x4b16('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x4b16('0x4'),_0x4b16('0x5'),_0x4b16('0x6')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x4b16('0x7'),'invalid',_0x4b16('0x8'),_0x4b16('0x9'),_0x4b16('0xa'),_0x4b16('0xb'),_0x4b16('0xc'),_0x4b16('0xd'),_0x4b16('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x4b16('0xf'),_0x4b16('0x10'),_0x4b16('0x11'),_0x4b16('0x12'),_0x4b16('0x13'),_0x4b16('0x14'),_0x4b16('0x15'),'startProgressive',_0x4b16('0x16'),_0x4b16('0x17'),_0x4b16('0x18'),_0x4b16('0x19'),_0x4b16('0x1a'),_0x4b16('0x1b'),_0x4b16('0x1c'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0x4b16('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0x4b16('0x1e'),_0x4b16('0x1f'),_0x4b16('0x20')];function getRealtimeQueues(_0x1a4cd4,_0x476564){var _0xbe00fc=_0x476564==='voice'?amiClient:routingClient;return _0xbe00fc[_0x4b16('0x21')](_[_0x4b16('0x22')](_0x476564)+'Queues',_0x1a4cd4)[_0x4b16('0x23')](function(_0x56b27c){if(_0x56b27c['error'])throw new Error(util[_0x4b16('0x24')](_0x4b16('0x25'),_0x476564));return _0x56b27c[_0x4b16('0x26')];})[_0x4b16('0x27')](function(_0x1d7d22){throw _0x1d7d22;});}exports[_0x4b16('0x28')]=getRealtimeQueues;function initializeQueues(_0x2cb771,_0x29b422,_0x48e322,_0x1a6d76){var _0x2f8ed7=DEFAULT_QUEUE_ATTRIBUTES;if(_0x48e322==='voice'){if(_0x1a6d76==='inbound'){_0x2f8ed7=_0x2f8ed7[_0x4b16('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1a6d76===_0x4b16('0x2a')){_0x2f8ed7=_0x2f8ed7[_0x4b16('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2cb771[_0x4b16('0x2b')](function(_0x802772){var _0x53e4ce=_0x802772[_0x4b16('0x2c')]({'plain':!![]});_0x53e4ce[_0x4b16('0x5')]=0x0;_0x53e4ce[_0x4b16('0x8')]=0x0;_0x53e4ce[_0x4b16('0x4')]=0x0;_0x53e4ce[_0x4b16('0x2d')]=0x0;_0x53e4ce['waiting']=0x0;if(_0x48e322===_0x4b16('0x2e')){_0x53e4ce['talking']=0x0;_0x53e4ce['busy']=0x0;if(_0x1a6d76===_0x4b16('0x2a')){_0x53e4ce['pTalking']=0x0;_0x53e4ce[_0x4b16('0xf')]=0x0;}}var _0x4ed0f4=_[_0x4b16('0x2f')](_0x29b422,['id',_0x53e4ce['id']]);if(_0x4ed0f4){_[_0x4b16('0x30')](_0x53e4ce,_[_0x4b16('0x31')](_0x4ed0f4,_0x2f8ed7));}return _0x53e4ce;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0xe0cd=['dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','map','get','loggedInDb','find','pick','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x2a9ec5,_0xed23b){var _0x52c7c0=function(_0x54b22d){while(--_0x54b22d){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x52c7c0(++_0xed23b);}(_0xe0cd,0x88));var _0xde0c=function(_0x1a0b45,_0x469dc3){_0x1a0b45=_0x1a0b45-0x0;var _0x2740f5=_0xe0cd[_0x1a0b45];return _0x2740f5;};'use strict';var _=require(_0xde0c('0x0'));var jayson=require(_0xde0c('0x1'));var util=require('util');var amiClient=jayson[_0xde0c('0x2')][_0xde0c('0x3')]({'port':0x232a});var routingClient=jayson[_0xde0c('0x2')][_0xde0c('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xde0c('0x4'),_0xde0c('0x5'),_0xde0c('0x6'),_0xde0c('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0xde0c('0x8'),_0xde0c('0x9'),_0xde0c('0xa'),'loggedInDb',_0xde0c('0xb'),_0xde0c('0xc'),_0xde0c('0xd'),_0xde0c('0xe'),_0xde0c('0xf'),_0xde0c('0x10'),_0xde0c('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xde0c('0x12'),_0xde0c('0x13'),_0xde0c('0x14'),'statusMessage',_0xde0c('0x15'),_0xde0c('0x16'),_0xde0c('0x17'),_0xde0c('0x18'),'startProgressive',_0xde0c('0x19'),_0xde0c('0x1a'),_0xde0c('0x1b'),_0xde0c('0x1c'),_0xde0c('0x1d'),_0xde0c('0x1e'),_0xde0c('0x1f'),_0xde0c('0x20'),_0xde0c('0x21'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xde0c('0x22'),_0xde0c('0x23'),_0xde0c('0x24')];function getRealtimeQueues(_0x267c57,_0x244cbc){var _0x1f44e4=_0x244cbc===_0xde0c('0x25')?amiClient:routingClient;return _0x1f44e4[_0xde0c('0x26')](_['startCase'](_0x244cbc)+_0xde0c('0x27'),_0x267c57)[_0xde0c('0x28')](function(_0x445eb8){if(_0x445eb8[_0xde0c('0x29')])throw new Error(util[_0xde0c('0x2a')](_0xde0c('0x2b'),_0x244cbc));return _0x445eb8[_0xde0c('0x2c')];})[_0xde0c('0x2d')](function(_0xe2ffe6){throw _0xe2ffe6;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1aed74,_0x1d12a9,_0x2874d4,_0x19a79f){var _0x5f2c04=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2874d4===_0xde0c('0x25')){if(_0x19a79f===_0xde0c('0x2e')){_0x5f2c04=_0x5f2c04[_0xde0c('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x19a79f===_0xde0c('0x30')){_0x5f2c04=_0x5f2c04['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1aed74[_0xde0c('0x31')](function(_0x5c4e90){var _0x5c8ef9=_0x5c4e90[_0xde0c('0x32')]({'plain':!![]});_0x5c8ef9[_0xde0c('0x6')]=0x0;_0x5c8ef9[_0xde0c('0x33')]=0x0;_0x5c8ef9[_0xde0c('0x5')]=0x0;_0x5c8ef9['available']=0x0;_0x5c8ef9[_0xde0c('0x7')]=0x0;if(_0x2874d4===_0xde0c('0x25')){_0x5c8ef9['talking']=0x0;_0x5c8ef9['busy']=0x0;if(_0x19a79f===_0xde0c('0x30')){_0x5c8ef9[_0xde0c('0x12')]=0x0;_0x5c8ef9[_0xde0c('0x13')]=0x0;}}var _0x57148=_[_0xde0c('0x34')](_0x1d12a9,['id',_0x5c8ef9['id']]);if(_0x57148){_['merge'](_0x5c8ef9,_[_0xde0c('0x35')](_0x57148,_0x5f2c04));}return _0x5c8ef9;});}exports[_0xde0c('0x36')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index af0c262..77ee1a6 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x235f7f,_0x4cc112){var _0x3bf31e=function(_0x618236){while(--_0x618236){_0x235f7f['push'](_0x235f7f['shift']());}};_0x3bf31e(++_0x4cc112);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 6d1e79f..a60d1f8 100644 --- a/server/config/license/hardware.js +++ b/server/config/license/hardware.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4489=['macAddress','ipAddress','createHash','hex','substring','lodash','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','update','digest','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x48c988,_0x3c7e2d){var _0x2216bd=function(_0x5eabae){while(--_0x5eabae){_0x48c988['push'](_0x48c988['shift']());}};_0x2216bd(++_0x3c7e2d);}(_0x4489,0xb9));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9448('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x9448('0x1'));var exec=require(_0x9448('0x2'))['execSync'];var config=require(_0x9448('0x3'));function getInterfaces(){var _0x42c08a=[];var _0x455579=os[_0x9448('0x4')]();var _0x12bc4e=_[_0x9448('0x5')](_[_0x9448('0x6')](_0x455579));for(var _0x44d26b=0x0;_0x44d26b<_0x12bc4e[_0x9448('0x7')];_0x44d26b++){var _0x43f36f=_0x455579[_0x12bc4e[_0x44d26b]][_0x9448('0x8')](function(_0x2e5600){return _0x2e5600[_0x9448('0x9')]===_0x9448('0xa')&&_0x2e5600[_0x9448('0xb')]===![];});_0x42c08a=_0x42c08a[_0x9448('0xc')](_0x43f36f);}return _0x42c08a;}function getFirstInterface(){var _0x32b7b9=_[_0x9448('0xd')](getInterfaces());return{'macAddress':_0x32b7b9&&_0x32b7b9[_0x9448('0xe')]?_0x32b7b9[_0x9448('0xe')]:_0x9448('0xf'),'ipAddress':_0x32b7b9&&_0x32b7b9[_0x9448('0x10')]?_0x32b7b9[_0x9448('0x10')]:_0x9448('0x11')};}exports[_0x9448('0x12')]=getFirstInterface;function getCPUhash(){var _0x5f354b=_[_0x9448('0x5')](os[_0x9448('0x13')]()[_0x9448('0x14')](function(_0x104329){return _0x104329[_0x9448('0x15')];}))[_0x9448('0x16')](':');return crypto['createHash'](_0x9448('0x17'))[_0x9448('0x18')](_0x5f354b)[_0x9448('0x19')]('hex');}exports['getUuid']=function(){var _0x5c5e5a=os[_0x9448('0x1a')]();var _0x4ae33c=/[0-9a-f-]{36}/;if(config[_0x9448('0x1b')]&&_0x4ae33c['test'](config[_0x9448('0x1b')])){return config['licenseToken'];}else if(_0x5c5e5a==='win32'){return exec(_0x9448('0x1c'),{'encoding':_0x9448('0x1d')})[_0x9448('0x1e')]('\x0d\x0a','');}else{var _0x3e13a8=getFirstInterface();var _0x44d775=getCPUhash();var _0x25ce2c=_0x44d775+'|'+os['hostname']()+'|'+_0x3e13a8[_0x9448('0x1f')]+'|'+_0x3e13a8[_0x9448('0x20')];var _0x1cd886=crypto[_0x9448('0x21')]('md5')['update'](_0x25ce2c)[_0x9448('0x19')](_0x9448('0x22'));return _0x1cd886['substring'](0x0,0x8)+'-'+_0x1cd886[_0x9448('0x23')](0x8,0xc)+'-'+_0x1cd886[_0x9448('0x23')](0xc,0x10)+'-'+_0x1cd886[_0x9448('0x23')](0x10,0x14)+'-'+_0x1cd886['substring'](0x14);}}; \ No newline at end of file +var _0x7684=['127.0.0.1','getFirstInterface','map','join','createHash','md5','update','digest','hex','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x7684,0x107));var _0x4768=function(_0x22f02d,_0x2b5671){_0x22f02d=_0x22f02d-0x0;var _0x4f4da3=_0x7684[_0x22f02d];return _0x4f4da3;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x4768('0x0'));var machine=require(_0x4768('0x1'));var exec=require(_0x4768('0x2'))[_0x4768('0x3')];var config=require(_0x4768('0x4'));function getInterfaces(){var _0x463f6e=[];var _0x47bbac=os[_0x4768('0x5')]();var _0x4e3e79=_[_0x4768('0x6')](_[_0x4768('0x7')](_0x47bbac));for(var _0x3a675e=0x0;_0x3a675e<_0x4e3e79[_0x4768('0x8')];_0x3a675e++){var _0x41e923=_0x47bbac[_0x4e3e79[_0x3a675e]][_0x4768('0x9')](function(_0x264f35){return _0x264f35[_0x4768('0xa')]===_0x4768('0xb')&&_0x264f35['internal']===![];});_0x463f6e=_0x463f6e[_0x4768('0xc')](_0x41e923);}return _0x463f6e;}function getFirstInterface(){var _0x21466e=_[_0x4768('0xd')](getInterfaces());return{'macAddress':_0x21466e&&_0x21466e[_0x4768('0xe')]?_0x21466e['mac']:_0x4768('0xf'),'ipAddress':_0x21466e&&_0x21466e[_0x4768('0x10')]?_0x21466e['address']:_0x4768('0x11')};}exports[_0x4768('0x12')]=getFirstInterface;function getCPUhash(){var _0x5061b4=_[_0x4768('0x6')](os['cpus']()[_0x4768('0x13')](function(_0x4df837){return _0x4df837['model'];}))[_0x4768('0x14')](':');return crypto[_0x4768('0x15')](_0x4768('0x16'))[_0x4768('0x17')](_0x5061b4)[_0x4768('0x18')](_0x4768('0x19'));}exports[_0x4768('0x1a')]=function(){var _0x33cffe=os['platform']();var _0x1d38fe=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1d38fe['test'](config[_0x4768('0x1b')])){return config['licenseToken'];}else if(_0x33cffe===_0x4768('0x1c')){return exec(_0x4768('0x1d'),{'encoding':_0x4768('0x1e')})[_0x4768('0x1f')]('\x0d\x0a','');}else{var _0x23c8a1=getFirstInterface();var _0x5a3c97=getCPUhash();var _0x3a6eef=_0x5a3c97+'|'+os['hostname']()+'|'+_0x23c8a1[_0x4768('0x20')]+'|'+_0x23c8a1[_0x4768('0x21')];var _0x5a2310=crypto['createHash'](_0x4768('0x16'))[_0x4768('0x17')](_0x3a6eef)['digest'](_0x4768('0x19'));return _0x5a2310[_0x4768('0x22')](0x0,0x8)+'-'+_0x5a2310[_0x4768('0x22')](0x8,0xc)+'-'+_0x5a2310[_0x4768('0x22')](0xc,0x10)+'-'+_0x5a2310['substring'](0x10,0x14)+'-'+_0x5a2310[_0x4768('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dadabc0..69bdf11 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e5f=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED'];(function(_0x2d3958,_0x59dec5){var _0x1f8a3b=function(_0x50f320){while(--_0x50f320){_0x2d3958['push'](_0x2d3958['shift']());}};_0x1f8a3b(++_0x59dec5);}(_0x5e5f,0x18e));var _0xf5e5=function(_0xcb5360,_0x5efb60){_0xcb5360=_0xcb5360-0x0;var _0x37d0d4=_0x5e5f[_0xcb5360];return _0x37d0d4;};'use strict';var util=require(_0xf5e5('0x0'));var moment=require(_0xf5e5('0x1'));var rp=require('request-promise');var BPromise=require(_0xf5e5('0x2'));var pkginfo=require(_0xf5e5('0x3'))(module,_0xf5e5('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xf5e5('0x5'));var hardware=require(_0xf5e5('0x6'));var logger=require(_0xf5e5('0x7'))('license');var HOST=_0xf5e5('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3fc13){return new BPromise(function(_0x26f97f,_0x501f02){var _0x2f1f8c=util[_0xf5e5('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x3fc13,module[_0xf5e5('0xa')]['version']);if(oldToken){_0x2f1f8c=util['format'](_0xf5e5('0xb'),HOST,_0x3fc13,module['exports'][_0xf5e5('0x4')],oldToken);}var _0x1d2808={'uri':_0x2f1f8c,'method':_0xf5e5('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x1d2808)[_0xf5e5('0xd')](function(_0x161ee4){_0x26f97f(_0x161ee4);})[_0xf5e5('0xe')](function(_0x46ce6d){_0x501f02(_0x46ce6d);});});}function manageLicense(_0x239188,_0x5e95c6){var _0x4bdcef=_0x5e95c6[_0xf5e5('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4bdcef['data1']!==_0x239188&&!_0x4bdcef[_0xf5e5('0x10')]){oldToken=_0x4bdcef[_0xf5e5('0x11')];}httpRequest(_0x239188)[_0xf5e5('0xd')](function(_0x3db74b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3db74b[_0xf5e5('0x12')]){isOldTokenSent=![];if(!_0x4bdcef[_0xf5e5('0x13')]&&_0x4bdcef['license']!=_0x3db74b[_0xf5e5('0x13')]||_0x4bdcef[_0xf5e5('0x13')]&&_0x4bdcef[_0xf5e5('0x10')]){logger[_0xf5e5('0x14')](_0xf5e5('0x15'));}if(_0x4bdcef[_0xf5e5('0x13')]&&!_0x4bdcef[_0xf5e5('0x10')]&&_0x4bdcef['license']!=_0x3db74b[_0xf5e5('0x13')]){logger[_0xf5e5('0x14')](_0xf5e5('0x16'));}if(_0x4bdcef[_0xf5e5('0x13')]&&!_0x4bdcef['data2']&&_0x4bdcef['license']==_0x3db74b[_0xf5e5('0x13')]){return _0x5e95c6;}return _0x5e95c6[_0xf5e5('0x17')]({'data1':_0x239188,'data2':null,'license':_0x3db74b[_0xf5e5('0x13')]});}else{if(_0x3db74b[_0xf5e5('0x13')]||_0x4bdcef[_0xf5e5('0x13')]){if(!_0x4bdcef['data2']){if(_0x4bdcef[_0xf5e5('0x11')]==_0x239188){GRAY_PERIOD_REASON='Disabled';logger[_0xf5e5('0x14')](_0xf5e5('0x18'));}else{GRAY_PERIOD_REASON=_0xf5e5('0x19');logger[_0xf5e5('0x14')](_0xf5e5('0x1a'),_0x4bdcef[_0xf5e5('0x11')],_0x239188);}logger['info'](_0xf5e5('0x1b'),GRAY_PERIOD_REASON[_0xf5e5('0x1c')](),moment()[_0xf5e5('0x9')](_0xf5e5('0x1d')));return _0x5e95c6[_0xf5e5('0x17')]({'data2':encryptor[_0xf5e5('0x1e')](moment()[_0xf5e5('0x9')](_0xf5e5('0x1d')))});}else{if(moment()['diff'](encryptor[_0xf5e5('0x1f')](_0x4bdcef[_0xf5e5('0x10')]),_0xf5e5('0x20'))>DAYS){logger['info'](_0xf5e5('0x21'),moment()[_0xf5e5('0x9')](_0xf5e5('0x1d')));isOldTokenSent=![];return _0x5e95c6['update']({'data1':_0x239188,'data2':null,'license':null});}}}else{if(_0x4bdcef[_0xf5e5('0x11')]!=_0x239188){logger['info'](_0xf5e5('0x1a'),_0x4bdcef[_0xf5e5('0x11')],_0x239188);return _0x5e95c6[_0xf5e5('0x17')]({'data1':_0x239188,'data2':null,'license':null});}}}return _0x5e95c6;})[_0xf5e5('0xd')](function(_0x407e6f){_0x5e95c6=_0x407e6f;})[_0xf5e5('0xe')](function(_0x8a22a){logger['error'](_0x8a22a[_0xf5e5('0x22')]);})[_0xf5e5('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5e95c6);},TIME);});}function defaultLicense(){var _0x5bce29=hardware['getUuid']();if(_0x5bce29){return db[_0xf5e5('0x24')][_0xf5e5('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x5bce29}})[_0xf5e5('0x26')](function(_0x3b6add,_0x2e84b4){logger[_0xf5e5('0x14')](_0xf5e5('0x27'),_0x5bce29);manageLicense(_0x5bce29,_0x3b6add);})[_0xf5e5('0xe')](function(_0x27dbd5){logger[_0xf5e5('0x28')](_0x27dbd5[_0xf5e5('0x22')]);});}}exports[_0xf5e5('0x29')]=defaultLicense; \ No newline at end of file +var _0xd118=['findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','message','finally','getUuid'];(function(_0x31ce6b,_0x3f92e3){var _0x1818b4=function(_0x552936){while(--_0x552936){_0x31ce6b['push'](_0x31ce6b['shift']());}};_0x1818b4(++_0x3f92e3);}(_0xd118,0xcb));var _0x8d11=function(_0x151df2,_0x315a2e){_0x151df2=_0x151df2-0x0;var _0x53456a=_0xd118[_0x151df2];return _0x53456a;};'use strict';var util=require(_0x8d11('0x0'));var moment=require(_0x8d11('0x1'));var rp=require(_0x8d11('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x8d11('0x3'))(module,_0x8d11('0x4'));var db=require(_0x8d11('0x5'))['db'];var encryptor=require(_0x8d11('0x6'));var hardware=require(_0x8d11('0x7'));var logger=require('../logger')('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x45b64a){return new BPromise(function(_0x302872,_0x24f8fa){var _0x4296d9=util[_0x8d11('0x8')](_0x8d11('0x9'),HOST,_0x45b64a,module[_0x8d11('0xa')][_0x8d11('0x4')]);if(oldToken){_0x4296d9=util[_0x8d11('0x8')](_0x8d11('0xb'),HOST,_0x45b64a,module[_0x8d11('0xa')][_0x8d11('0x4')],oldToken);}var _0x383717={'uri':_0x4296d9,'method':_0x8d11('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x383717)[_0x8d11('0xd')](function(_0x48a9bc){_0x302872(_0x48a9bc);})[_0x8d11('0xe')](function(_0x172316){_0x24f8fa(_0x172316);});});}function manageLicense(_0x7a890,_0x46e293){var _0x3e7dae=_0x46e293[_0x8d11('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x3e7dae['data1']!==_0x7a890&&!_0x3e7dae[_0x8d11('0x10')]){oldToken=_0x3e7dae[_0x8d11('0x11')];}httpRequest(_0x7a890)[_0x8d11('0xd')](function(_0x368396){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x368396[_0x8d11('0x12')]){isOldTokenSent=![];if(!_0x3e7dae[_0x8d11('0x13')]&&_0x3e7dae[_0x8d11('0x13')]!=_0x368396[_0x8d11('0x13')]||_0x3e7dae['license']&&_0x3e7dae['data2']){logger['info'](_0x8d11('0x14'));}if(_0x3e7dae[_0x8d11('0x13')]&&!_0x3e7dae['data2']&&_0x3e7dae[_0x8d11('0x13')]!=_0x368396[_0x8d11('0x13')]){logger[_0x8d11('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3e7dae[_0x8d11('0x13')]&&!_0x3e7dae[_0x8d11('0x10')]&&_0x3e7dae['license']==_0x368396[_0x8d11('0x13')]){return _0x46e293;}return _0x46e293[_0x8d11('0x16')]({'data1':_0x7a890,'data2':null,'license':_0x368396[_0x8d11('0x13')]});}else{if(_0x368396[_0x8d11('0x13')]||_0x3e7dae[_0x8d11('0x13')]){if(!_0x3e7dae[_0x8d11('0x10')]){if(_0x3e7dae[_0x8d11('0x11')]==_0x7a890){GRAY_PERIOD_REASON=_0x8d11('0x17');logger['info'](_0x8d11('0x18'));}else{GRAY_PERIOD_REASON=_0x8d11('0x19');logger[_0x8d11('0x15')](_0x8d11('0x1a'),_0x3e7dae['data1'],_0x7a890);}logger[_0x8d11('0x15')](_0x8d11('0x1b'),GRAY_PERIOD_REASON[_0x8d11('0x1c')](),moment()[_0x8d11('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x46e293['update']({'data2':encryptor[_0x8d11('0x1d')](moment()[_0x8d11('0x8')](_0x8d11('0x1e')))});}else{if(moment()[_0x8d11('0x1f')](encryptor[_0x8d11('0x20')](_0x3e7dae[_0x8d11('0x10')]),'days')>DAYS){logger[_0x8d11('0x15')](_0x8d11('0x21'),moment()['format'](_0x8d11('0x1e')));isOldTokenSent=![];return _0x46e293['update']({'data1':_0x7a890,'data2':null,'license':null});}}}else{if(_0x3e7dae[_0x8d11('0x11')]!=_0x7a890){logger[_0x8d11('0x15')](_0x8d11('0x1a'),_0x3e7dae['data1'],_0x7a890);return _0x46e293[_0x8d11('0x16')]({'data1':_0x7a890,'data2':null,'license':null});}}}return _0x46e293;})[_0x8d11('0xd')](function(_0x56788c){_0x46e293=_0x56788c;})['catch'](function(_0x560ace){logger['error'](_0x560ace[_0x8d11('0x22')]);})[_0x8d11('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x46e293);},TIME);});}function defaultLicense(){var _0x4b552a=hardware[_0x8d11('0x24')]();if(_0x4b552a){return db['License'][_0x8d11('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x4b552a}})['spread'](function(_0x158af9,_0x12047b){logger['info'](_0x8d11('0x26'),_0x4b552a);manageLicense(_0x4b552a,_0x158af9);})[_0x8d11('0xe')](function(_0x5d4e01){logger[_0x8d11('0x27')](_0x5d4e01[_0x8d11('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 157bc96..6c12642 100644 --- a/server/config/license/util.js +++ b/server/config/license/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9254=['disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','users','telephones','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','uuid','machineUuid','gray','add','days','format','grayReason','changed'];(function(_0x3dca53,_0x283913){var _0xc7709d=function(_0x1add53){while(--_0x1add53){_0x3dca53['push'](_0x3dca53['shift']());}};_0xc7709d(++_0x283913);}(_0x9254,0x1de));var _0x4925=function(_0x313118,_0x112646){_0x313118=_0x313118-0x0;var _0x14052d=_0x9254[_0x313118];return _0x14052d;};'use strict';var util=require(_0x4925('0x0'));var _=require(_0x4925('0x1'));var moment=require(_0x4925('0x2'));var BPromise=require(_0x4925('0x3'));var hardware=require(_0x4925('0x4'));var encryptor=require(_0x4925('0x5'));var db=require(_0x4925('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x4925('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4925('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x4925('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x54eef0){return new BPromise(function(_0xa9b717,_0x3c9ad0){return db[_0x4925('0x9')][_0x4925('0xa')](_[_0x4925('0xb')](_0x54eef0,{'raw':!![],'where':{'id':0x1}}))[_0x4925('0xc')](function(_0x2e2e32){return checkLicense(_0x2e2e32,null);})['then'](function(_0x5a54c5){_0xa9b717(_0x5a54c5);return;})[_0x4925('0xd')](function(_0xee3c8f){_0x3c9ad0(_0xee3c8f);});});}function checkLicense(_0x2ce01b,_0x4becc8){if(!_0x2ce01b){demoLicense['uuid']=_0x2ce01b[_0x4925('0xe')];return demoLicense;}try{var _0x45bafc=_0x4becc8||_0x2ce01b[_0x4925('0xf')];if(_[_0x4925('0x10')](_0x45bafc)){throw new Error(_0x4925('0x11'));}var _0x1b8909=_0x2ce01b[_0x4925('0xe')];var _0x162249=_0x2ce01b[_0x4925('0x12')];var _0x3e087d=_0x1b8909[_0x4925('0x13')]('-')[0x4];var _0x36c566=_0x1b8909[_0x4925('0x13')]('-')[0x0];var _0x3155b9=encryptor[_0x4925('0x14')](_0x45bafc,util['format'](_0x4925('0x15'),_0x3e087d,_0x1b8909,_0x36c566));var _0x1d9819=JSON[_0x4925('0x16')](_0x3155b9);_0x1d9819[_0x4925('0x17')]=![];_0x1d9819[_0x4925('0x18')]=_0x1b8909;_0x1d9819[_0x4925('0x19')]=hardware['getUuid']();if(_0x162249){var _0x208168=encryptor['decryptString'](_0x162249);_0x1d9819[_0x4925('0x1a')]=_0x208168;_0x1d9819['deadline']=moment(_0x208168)[_0x4925('0x1b')](0x7,_0x4925('0x1c'))[_0x4925('0x1d')]();_0x1d9819[_0x4925('0x1e')]=_0x1d9819[_0x4925('0x18')]!=_0x1d9819['machineUuid']?_0x4925('0x1f'):_0x4925('0x20');}return _0x1d9819;}catch(_0x51402c){breakingLicense[_0x4925('0x18')]=_0x2ce01b['data1'];breakingLicense[_0x4925('0x21')]=_0x51402c[_0x4925('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x21c609,_0x2ce808){getLicense()['then'](function(_0x4fd08d){return db[_0x4925('0x22')][_0x4925('0x23')]({'attributes':[_0x4925('0x24'),[db[_0x4925('0x25')]['fn'](_0x4925('0x26'),db['sequelize'][_0x4925('0x27')](_0x4925('0x24'))),_0x4925('0x28')]],'group':_0x4925('0x24'),'where':{'role':{'$or':[_0x4925('0x29'),_0x4925('0x2a'),'telephone']}},'raw':!![]})[_0x4925('0xc')](function(_0x4e9475){var _0x1f75a3={'user':_0x4fd08d[_0x4925('0x2b')]||0x0,'telephone':_0x4fd08d[_0x4925('0x2c')]||0x0};_0x4e9475['forEach'](function(_0x12c88f){var _0x247628=_0x12c88f[_0x4925('0x24')]==='admin'?_0x4925('0x2a'):_0x12c88f[_0x4925('0x24')];_0x1f75a3[_0x247628]-=_0x12c88f['count'];if(_0x1f75a3[_0x247628]<0x0)_0x1f75a3[_0x247628]=0x0;});_0x21c609(_0x1f75a3);return;});})['catch'](function(_0x3a3fa6){_0x2ce808(_0x3a3fa6);});});}function checkUserLimits(_0x547525){return new BPromise(function(_0x356d4a,_0x33fd1f){getLimits()[_0x4925('0xc')](function(_0x416706){var _0xaebd60=_[_0x4925('0x2d')](_[_0x4925('0x2e')](_0x547525,_0x4925('0x24')),[_0x4925('0x29'),_0x4925('0x2a'),_0x4925('0x2f')]);var _0x1e2046=(_0xaebd60['admin']||0x0)+(_0xaebd60[_0x4925('0x2a')]||0x0);var _0x51da1=_0xaebd60['telephone']||0x0;if(_0x1e2046>_0x416706[_0x4925('0x2a')])return _0x33fd1f(_0x4925('0x30'));if(_0x51da1>_0x416706[_0x4925('0x2f')])return _0x33fd1f(_0x4925('0x31'));return _0x356d4a();})[_0x4925('0xd')](function(_0x270cd8){_0x33fd1f(_0x270cd8);});});}module[_0x4925('0x32')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x413d=['admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','format','%s:%s:%s','parse','demo','machineUuid','gray','add','days','grayReason','changed','disabled','message','findAll','role','sequelize','COUNT','col','count'];(function(_0x881dc7,_0x3ea78e){var _0x2a6f22=function(_0x1f6ff9){while(--_0x1f6ff9){_0x881dc7['push'](_0x881dc7['shift']());}};_0x2a6f22(++_0x3ea78e);}(_0x413d,0x18a));var _0xd413=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x413d[_0xf71120];return _0xbe2fd3;};'use strict';var util=require(_0xd413('0x0'));var _=require(_0xd413('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0xd413('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xd413('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd413('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd413('0x5'),'machineUuid':hardware[_0xd413('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd413('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd413('0x7'),'machineUuid':hardware[_0xd413('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1ba3bb){return new BPromise(function(_0x433b55,_0x4eb15e){return db[_0xd413('0x8')][_0xd413('0x9')](_[_0xd413('0xa')](_0x1ba3bb,{'raw':!![],'where':{'id':0x1}}))[_0xd413('0xb')](function(_0x32193f){return checkLicense(_0x32193f,null);})[_0xd413('0xb')](function(_0x4da2cd){_0x433b55(_0x4da2cd);return;})[_0xd413('0xc')](function(_0x234b87){_0x4eb15e(_0x234b87);});});}function checkLicense(_0x43f1dc,_0x405527){if(!_0x43f1dc){demoLicense[_0xd413('0xd')]=_0x43f1dc['data1'];return demoLicense;}try{var _0x2179c5=_0x405527||_0x43f1dc[_0xd413('0xe')];if(_[_0xd413('0xf')](_0x2179c5)){throw new Error(_0xd413('0x10'));}var _0x3ed796=_0x43f1dc[_0xd413('0x11')];var _0x748ddb=_0x43f1dc[_0xd413('0x12')];var _0x110532=_0x3ed796[_0xd413('0x13')]('-')[0x4];var _0x2e2b44=_0x3ed796['split']('-')[0x0];var _0x360012=encryptor['decryptString'](_0x2179c5,util[_0xd413('0x14')](_0xd413('0x15'),_0x110532,_0x3ed796,_0x2e2b44));var _0x50a17d=JSON[_0xd413('0x16')](_0x360012);_0x50a17d[_0xd413('0x17')]=![];_0x50a17d[_0xd413('0xd')]=_0x3ed796;_0x50a17d[_0xd413('0x18')]=hardware[_0xd413('0x6')]();if(_0x748ddb){var _0x210708=encryptor['decryptString'](_0x748ddb);_0x50a17d[_0xd413('0x19')]=_0x210708;_0x50a17d['deadline']=moment(_0x210708)[_0xd413('0x1a')](0x7,_0xd413('0x1b'))[_0xd413('0x14')]();_0x50a17d[_0xd413('0x1c')]=_0x50a17d[_0xd413('0xd')]!=_0x50a17d[_0xd413('0x18')]?_0xd413('0x1d'):_0xd413('0x1e');}return _0x50a17d;}catch(_0x3422c4){breakingLicense['uuid']=_0x43f1dc[_0xd413('0x11')];breakingLicense[_0xd413('0x1f')]=_0x3422c4[_0xd413('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4b3f96,_0x387c71){getLicense()[_0xd413('0xb')](function(_0x4d350d){return db['User'][_0xd413('0x20')]({'attributes':[_0xd413('0x21'),[db[_0xd413('0x22')]['fn'](_0xd413('0x23'),db['sequelize'][_0xd413('0x24')](_0xd413('0x21'))),_0xd413('0x25')]],'group':_0xd413('0x21'),'where':{'role':{'$or':[_0xd413('0x26'),_0xd413('0x27'),_0xd413('0x28')]}},'raw':!![]})['then'](function(_0x390545){var _0x381197={'user':_0x4d350d['users']||0x0,'telephone':_0x4d350d[_0xd413('0x29')]||0x0};_0x390545[_0xd413('0x2a')](function(_0xcc47f3){var _0x5d84bd=_0xcc47f3[_0xd413('0x21')]===_0xd413('0x26')?_0xd413('0x27'):_0xcc47f3[_0xd413('0x21')];_0x381197[_0x5d84bd]-=_0xcc47f3['count'];if(_0x381197[_0x5d84bd]<0x0)_0x381197[_0x5d84bd]=0x0;});_0x4b3f96(_0x381197);return;});})[_0xd413('0xc')](function(_0x578ce3){_0x387c71(_0x578ce3);});});}function checkUserLimits(_0x43537f){return new BPromise(function(_0x1052ba,_0x11ebdd){getLimits()[_0xd413('0xb')](function(_0x40c1bc){var _0x2ed42c=_[_0xd413('0x2b')](_[_0xd413('0x2c')](_0x43537f,_0xd413('0x21')),[_0xd413('0x26'),_0xd413('0x27'),_0xd413('0x28')]);var _0x393972=(_0x2ed42c[_0xd413('0x26')]||0x0)+(_0x2ed42c[_0xd413('0x27')]||0x0);var _0x5ceeb9=_0x2ed42c[_0xd413('0x28')]||0x0;if(_0x393972>_0x40c1bc[_0xd413('0x27')])return _0x11ebdd(_0xd413('0x2d'));if(_0x5ceeb9>_0x40c1bc[_0xd413('0x28')])return _0x11ebdd(_0xd413('0x2e'));return _0x1052ba();})['catch'](function(_0x45e728){_0x11ebdd(_0x45e728);});});}module[_0xd413('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9d45b66..7a08b4d 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63a5=['myappanuglar-secret','secret','exports','http://localhost:9000'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x63a5,0x18e));var _0x563a=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x63a5[_0x45bf86];return _0x1f02b7;};'use strict';module[_0x563a('0x0')]={'DOMAIN':_0x563a('0x1'),'SESSION_SECRET':_0x563a('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x563a('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x66fa=['http://localhost:9000','app-id','secret','exports'];(function(_0x4460fe,_0x2d7209){var _0x496ef8=function(_0x45e08e){while(--_0x45e08e){_0x4460fe['push'](_0x4460fe['shift']());}};_0x496ef8(++_0x2d7209);}(_0x66fa,0x117));var _0xa66f=function(_0x284370,_0x384432){_0x284370=_0x284370-0x0;var _0x166e7e=_0x66fa[_0x284370];return _0x166e7e;};'use strict';module[_0xa66f('0x0')]={'DOMAIN':_0xa66f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa66f('0x2'),'GOOGLE_SECRET':_0xa66f('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 593bea7..0110633 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59c1=['exports','../utils/loggers'];(function(_0x352a53,_0x2ef22d){var _0x1f2e10=function(_0x535a66){while(--_0x535a66){_0x352a53['push'](_0x352a53['shift']());}};_0x1f2e10(++_0x2ef22d);}(_0x59c1,0x1d7));var _0x159c=function(_0x121e5b,_0x194742){_0x121e5b=_0x121e5b-0x0;var _0x40222a=_0x59c1[_0x121e5b];return _0x40222a;};'use strict';var fileLogger=require(_0x159c('0x0'))['fileLogger'];module[_0x159c('0x1')]=fileLogger; \ No newline at end of file +var _0xf52d=['fileLogger','../utils/loggers'];(function(_0x345556,_0x5b89d2){var _0xaf323e=function(_0x365d9b){while(--_0x365d9b){_0x345556['push'](_0x345556['shift']());}};_0xaf323e(++_0x5b89d2);}(_0xf52d,0x15d));var _0xdf52=function(_0x4851f2,_0x37d910){_0x4851f2=_0x4851f2-0x0;var _0x56cc0c=_0xf52d[_0x4851f2];return _0x56cc0c;};'use strict';var fileLogger=require(_0xdf52('0x0'))[_0xdf52('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 0ea8f43..389f696 100644 --- a/server/config/pm2/config.js +++ b/server/config/pm2/config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72f3=['../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x3a5c05,_0x365003){var _0x35b549=function(_0x5f3d6b){while(--_0x5f3d6b){_0x3a5c05['push'](_0x3a5c05['shift']());}};_0x35b549(++_0x365003);}(_0x72f3,0x85));var _0x372f=function(_0x548464,_0x45d8f7){_0x548464=_0x548464-0x0;var _0x14ec8f=_0x72f3[_0x548464];return _0x14ec8f;};'use strict';var path=require(_0x372f('0x0'));var os=require('os');var config={'apps':[{'name':_0x372f('0x1'),'script':path[_0x372f('0x2')](__dirname,_0x372f('0x3'))},{'name':_0x372f('0x4'),'script':path[_0x372f('0x2')](__dirname,_0x372f('0x5'))},{'name':_0x372f('0x6'),'script':path[_0x372f('0x2')](__dirname,_0x372f('0x7'))},{'name':_0x372f('0x8'),'script':path[_0x372f('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x372f('0x9'),'script':path['join'](__dirname,_0x372f('0xa'))},{'name':_0x372f('0xb'),'script':path['join'](__dirname,_0x372f('0xc'))}]};module[_0x372f('0xd')]=config; \ No newline at end of file +var _0xddab=['xdr','exports','path','express','join','../../services/express/index.js','ami','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xddab,0xe8));var _0xbdda=function(_0x3b5045,_0xb0bea7){_0x3b5045=_0x3b5045-0x0;var _0x3fa262=_0xddab[_0x3b5045];return _0x3fa262;};'use strict';var path=require(_0xbdda('0x0'));var os=require('os');var config={'apps':[{'name':_0xbdda('0x1'),'script':path[_0xbdda('0x2')](__dirname,_0xbdda('0x3'))},{'name':_0xbdda('0x4'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xbdda('0x5'),'script':path['join'](__dirname,_0xbdda('0x6'))},{'name':'email','script':path['join'](__dirname,_0xbdda('0x7'))},{'name':'routing','script':path[_0xbdda('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0xbdda('0x8'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xbdda('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 09971bc..e8d2ad8 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88f8=['list','describe','delete','dump','pm2','./config','connect','connected','start','then','stop','disconnect','restart'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x88f8,0x115));var _0x888f=function(_0x5855ae,_0x2986a9){_0x5855ae=_0x5855ae-0x0;var _0x521003=_0x88f8[_0x5855ae];return _0x521003;};'use strict';var pm2=require(_0x888f('0x0'));var BPromise=require('bluebird');var config=require(_0x888f('0x1'));function connect(){return new BPromise(function(_0x4daf88,_0x22ea54){return pm2[_0x888f('0x2')](function(_0x412336){if(_0x412336){return _0x22ea54(_0x412336);}return _0x4daf88(_0x888f('0x3'));});});};exports[_0x888f('0x4')]=function(_0x1a3447){return connect()[_0x888f('0x5')](function(){return new BPromise(function(_0x370759,_0x10618a){return pm2['start'](_0x1a3447,function(_0x33289b,_0x1dd7b0){if(_0x33289b){return _0x10618a(_0x33289b);}pm2['disconnect']();return _0x370759(_0x1dd7b0);});});});};exports[_0x888f('0x6')]=function(_0x22bd69){return connect()[_0x888f('0x5')](function(){return new BPromise(function(_0x4defea,_0x3d8827){return pm2[_0x888f('0x6')](_0x22bd69,function(_0x1fb905,_0x3b14da){if(_0x1fb905){return _0x3d8827(_0x1fb905);}pm2[_0x888f('0x7')]();return _0x4defea(_0x3b14da);});});});};exports['restart']=function(_0x130577){return connect()[_0x888f('0x5')](function(){return new BPromise(function(_0x1be31e,_0x14a15e){return pm2[_0x888f('0x8')](_0x130577,function(_0x80e7e4,_0x546281){if(_0x80e7e4){return _0x14a15e(_0x80e7e4);}pm2[_0x888f('0x7')]();return _0x1be31e(_0x546281);});});});};exports[_0x888f('0x9')]=function(){return connect()[_0x888f('0x5')](function(){return new BPromise(function(_0x2f0688,_0x389667){return pm2[_0x888f('0x9')](function(_0x28b3f9,_0x3a2f3b){if(_0x28b3f9){return _0x389667(_0x28b3f9);}pm2['disconnect']();return _0x2f0688(_0x3a2f3b);});});});};exports[_0x888f('0xa')]=function(_0x49fdde){return connect()[_0x888f('0x5')](function(){return new BPromise(function(_0x486660,_0x914e07){return pm2[_0x888f('0xa')](_0x49fdde,function(_0x3f3506,_0x249c79){if(_0x3f3506){return _0x914e07(_0x3f3506);}pm2[_0x888f('0x7')]();return _0x486660(_0x249c79);});});});};exports['delete']=function(_0x3d9888){return connect()['then'](function(){return new BPromise(function(_0x40271a,_0x27cc96){return pm2[_0x888f('0xb')](_0x3d9888,function(_0x21c585,_0x6ccbe){if(_0x21c585){return _0x27cc96(_0x21c585);}pm2[_0x888f('0x7')]();return _0x40271a(_0x6ccbe);});});});};exports[_0x888f('0xc')]=function(){return connect()[_0x888f('0x5')](function(){return new BPromise(function(_0x20f3b4,_0x14da78){return pm2[_0x888f('0xc')](function(_0x3a272a){if(_0x3a272a){return _0x14da78(_0x3a272a);}return _0x20f3b4('saved');});});});}; \ No newline at end of file +var _0x4e1a=['stop','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then','disconnect'];(function(_0x3b510a,_0x5bde5c){var _0x28a77f=function(_0xe1018c){while(--_0xe1018c){_0x3b510a['push'](_0x3b510a['shift']());}};_0x28a77f(++_0x5bde5c);}(_0x4e1a,0xa0));var _0xa4e1=function(_0x18bdb8,_0x400aa5){_0x18bdb8=_0x18bdb8-0x0;var _0x3177d2=_0x4e1a[_0x18bdb8];return _0x3177d2;};'use strict';var pm2=require(_0xa4e1('0x0'));var BPromise=require(_0xa4e1('0x1'));var config=require(_0xa4e1('0x2'));function connect(){return new BPromise(function(_0x56aa82,_0x4d9d8a){return pm2[_0xa4e1('0x3')](function(_0x4800aa){if(_0x4800aa){return _0x4d9d8a(_0x4800aa);}return _0x56aa82(_0xa4e1('0x4'));});});};exports[_0xa4e1('0x5')]=function(_0x12097){return connect()[_0xa4e1('0x6')](function(){return new BPromise(function(_0x17ec4a,_0x19e31f){return pm2[_0xa4e1('0x5')](_0x12097,function(_0x132b4b,_0x3893bf){if(_0x132b4b){return _0x19e31f(_0x132b4b);}pm2[_0xa4e1('0x7')]();return _0x17ec4a(_0x3893bf);});});});};exports['stop']=function(_0x417974){return connect()[_0xa4e1('0x6')](function(){return new BPromise(function(_0x5f2175,_0x4335b7){return pm2[_0xa4e1('0x8')](_0x417974,function(_0x2b9ee0,_0x3539eb){if(_0x2b9ee0){return _0x4335b7(_0x2b9ee0);}pm2[_0xa4e1('0x7')]();return _0x5f2175(_0x3539eb);});});});};exports[_0xa4e1('0x9')]=function(_0xd4ed34){return connect()[_0xa4e1('0x6')](function(){return new BPromise(function(_0x5f5cbc,_0xa900ce){return pm2[_0xa4e1('0x9')](_0xd4ed34,function(_0x1072f5,_0x5547aa){if(_0x1072f5){return _0xa900ce(_0x1072f5);}pm2['disconnect']();return _0x5f5cbc(_0x5547aa);});});});};exports[_0xa4e1('0xa')]=function(){return connect()[_0xa4e1('0x6')](function(){return new BPromise(function(_0x48950c,_0x2c351c){return pm2['list'](function(_0x19f89a,_0x167f05){if(_0x19f89a){return _0x2c351c(_0x19f89a);}pm2[_0xa4e1('0x7')]();return _0x48950c(_0x167f05);});});});};exports[_0xa4e1('0xb')]=function(_0x49bf17){return connect()[_0xa4e1('0x6')](function(){return new BPromise(function(_0x41fcd4,_0x8a1cd1){return pm2['describe'](_0x49bf17,function(_0x58b4c6,_0x4d0d07){if(_0x58b4c6){return _0x8a1cd1(_0x58b4c6);}pm2[_0xa4e1('0x7')]();return _0x41fcd4(_0x4d0d07);});});});};exports[_0xa4e1('0xc')]=function(_0x39e10c){return connect()[_0xa4e1('0x6')](function(){return new BPromise(function(_0x390416,_0x1a9301){return pm2[_0xa4e1('0xc')](_0x39e10c,function(_0x4d11db,_0xa04cdb){if(_0x4d11db){return _0x1a9301(_0x4d11db);}pm2['disconnect']();return _0x390416(_0xa04cdb);});});});};exports[_0xa4e1('0xd')]=function(){return connect()[_0xa4e1('0x6')](function(){return new BPromise(function(_0x304fd8,_0x1fc62f){return pm2['dump'](function(_0x1565ea){if(_0x1565ea){return _0x1fc62f(_0x1565ea);}return _0x304fd8('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 338f589..f6c2ac4 100644 --- a/server/config/schedule/chat.js +++ b/server/config/schedule/chat.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5278=['start','moment','ioredis','../../config/environment','redis','localhost','socket.io-emitter','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','map','info','join','ChatInteraction','system','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','error','inspect'];(function(_0x43f7c0,_0x41e65a){var _0x2ea3c4=function(_0x4cf9fa){while(--_0x4cf9fa){_0x43f7c0['push'](_0x43f7c0['shift']());}};_0x2ea3c4(++_0x41e65a);}(_0x5278,0x12d));var _0x8527=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5278[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var moment=require(_0x8527('0x0'));var Redis=require(_0x8527('0x1'));var util=require('util');var config=require(_0x8527('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x8527('0x3')]=_['defaults'](config[_0x8527('0x3')],{'host':_0x8527('0x4'),'port':0x18eb});var io=require(_0x8527('0x5'))(new Redis(config[_0x8527('0x3')]));function closeInteractions(){var _0x50c938=0x0;var _0x2a21b4=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x8527('0x6')],'where':{'id':0x1}})[_0x8527('0x7')](function(_0x32cee5){_0x50c938=_0x32cee5[_0x8527('0x6')];if(_0x50c938){return db['ChatInteraction'][_0x8527('0x8')]({'raw':!![],'attributes':['id',_0x8527('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8527('0xa')](_0x32cee5[_0x8527('0x6')],_0x8527('0xb'))}}});}else{return[];}})[_0x8527('0x7')](function(_0x1fcf09){if(_0x1fcf09&&_0x1fcf09['length']){_0x2a21b4=_[_0x8527('0xc')](_0x1fcf09||[],'id');logger[_0x8527('0xd')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2a21b4[_0x8527('0xe')]());return db[_0x8527('0xf')]['update']({'closeReason':_0x8527('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x8527('0x11')](_0x8527('0x12'))},{'where':{'id':_0x2a21b4}});}})[_0x8527('0x7')](function(){if(_0x2a21b4&&_0x2a21b4[_0x8527('0x13')]){logger[_0x8527('0xd')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2a21b4[_0x8527('0xe')]());for(var _0xd18670=0x0;_0xd18670<_0x2a21b4[_0x8527('0x13')];_0xd18670++){io[_0x8527('0x14')](_0x8527('0x15'),{'id':_0x2a21b4[_0xd18670],'closed':!![]});}}})['catch'](function(_0x2fc20f){logger[_0x8527('0x16')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2fc20f?util[_0x8527('0x17')](_0x2fc20f,{'showHidden':![],'depth':null}):'');});}exports[_0x8527('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7847=['Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7847,0xb0));var _0x7784=function(_0xb08b54,_0x149ec4){_0xb08b54=_0xb08b54-0x0;var _0x353ed9=_0x7847[_0xb08b54];return _0x353ed9;};'use strict';var _=require(_0x7784('0x0'));var moment=require(_0x7784('0x1'));var Redis=require(_0x7784('0x2'));var util=require(_0x7784('0x3'));var config=require(_0x7784('0x4'));var db=require(_0x7784('0x5'))['db'];var logger=require(_0x7784('0x6'))('schedule');config[_0x7784('0x7')]=_['defaults'](config[_0x7784('0x7')],{'host':_0x7784('0x8'),'port':0x18eb});var io=require(_0x7784('0x9'))(new Redis(config[_0x7784('0x7')]));function closeInteractions(){var _0xe8f1d8=0x0;var _0x2c8a35=[];return db[_0x7784('0xa')][_0x7784('0xb')]({'raw':!![],'attributes':['id',_0x7784('0xc')],'where':{'id':0x1}})[_0x7784('0xd')](function(_0x156696){_0xe8f1d8=_0x156696[_0x7784('0xc')];if(_0xe8f1d8){return db[_0x7784('0xe')][_0x7784('0xf')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7784('0x10')](_0x156696[_0x7784('0xc')],_0x7784('0x11'))}}});}else{return[];}})[_0x7784('0xd')](function(_0x2dbcda){if(_0x2dbcda&&_0x2dbcda[_0x7784('0x12')]){_0x2c8a35=_[_0x7784('0x13')](_0x2dbcda||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x2c8a35[_0x7784('0x14')]());return db[_0x7784('0xe')][_0x7784('0x15')]({'closeReason':_0x7784('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x7784('0x17')](_0x7784('0x18'))},{'where':{'id':_0x2c8a35}});}})[_0x7784('0xd')](function(){if(_0x2c8a35&&_0x2c8a35[_0x7784('0x12')]){logger[_0x7784('0x19')](_0x7784('0x1a'),_0x2c8a35[_0x7784('0x14')]());for(var _0x59f84a=0x0;_0x59f84a<_0x2c8a35['length'];_0x59f84a++){io['emit'](_0x7784('0x1b'),{'id':_0x2c8a35[_0x59f84a],'closed':!![]});}}})[_0x7784('0x1c')](function(_0x22fa93){logger[_0x7784('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x22fa93?util['inspect'](_0x22fa93,{'showHidden':![],'depth':null}):'');});}exports[_0x7784('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index ed3e33b..85b9cda 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a36=['exports'];(function(_0x5c9eb6,_0x50a0c9){var _0x4324e3=function(_0x4307de){while(--_0x4307de){_0x5c9eb6['push'](_0x5c9eb6['shift']());}};_0x4324e3(++_0x50a0c9);}(_0x9a36,0x1d8));var _0x69a3=function(_0x360bd1,_0x1fc405){_0x360bd1=_0x360bd1-0x0;var _0x226292=_0x9a36[_0x360bd1];return _0x226292;};'use strict';function start(){var _0x322cfc=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x322cfc['startAllRefreshIntervals']();}module[_0x69a3('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xe604=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x581b33,_0x47bf03){var _0x13e619=function(_0x131368){while(--_0x131368){_0x581b33['push'](_0x581b33['shift']());}};_0x13e619(++_0x47bf03);}(_0xe604,0x79));var _0x4e60=function(_0x496eed,_0x5d33f9){_0x496eed=_0x496eed-0x0;var _0x2a0757=_0xe604[_0x496eed];return _0x2a0757;};'use strict';function start(){var _0x59ac8e=require(_0x4e60('0x0'));return _0x59ac8e[_0x4e60('0x1')]();}module[_0x4e60('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index f0b0aca..2a2e781 100644 --- a/server/config/schedule/index.js +++ b/server/config/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b6f=['no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','length','exists','stop','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','endAt','add','add\x20cron','deleteJob','stop\x20cron','update\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','format','MailAccount','Smtp','user','bcc','name','subtractNumber','subtractUnit','join','../../files/reports','basename','savename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId'];(function(_0x3f230,_0x5a9325){var _0x1d9aad=function(_0x229b2f){while(--_0x229b2f){_0x3f230['push'](_0x3f230['shift']());}};_0x1d9aad(++_0x5a9325);}(_0x3b6f,0x11b));var _0xf3b6=function(_0xb1cf5c,_0x3913e1){_0xb1cf5c=_0xb1cf5c-0x0;var _0x3bbfac=_0x3b6f[_0xb1cf5c];return _0x3bbfac;};'use strict';var fs=require('fs');var util=require(_0xf3b6('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0xf3b6('0x1'));var CronJobManager=require(_0xf3b6('0x2'));var jayson=require(_0xf3b6('0x3'));var BPromise=require(_0xf3b6('0x4'));var logger=require(_0xf3b6('0x5'))(_0xf3b6('0x6'));var db=require(_0xf3b6('0x7'))['db'];var analyticCustomReportController=require(_0xf3b6('0x8'));var analyticDefaultReportController=require(_0xf3b6('0x9'));var client=jayson[_0xf3b6('0xa')][_0xf3b6('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3a4ee1,_0x1cd8c5){return function(){logger[_0xf3b6('0xc')](_0xf3b6('0xd'),_0x3a4ee1[_0xf3b6('0xe')]);var _0x30f6c2=!![];var _0x3a3ef5=_0x3a4ee1['MailAccount']['getSmtpOptions']();var _0x4a37ab={'account':_0x3a3ef5,'message':{'from':util[_0xf3b6('0xf')]('\x22%s\x22\x20<%s>',_0x3a4ee1[_0xf3b6('0x10')]['name'],_0x3a4ee1[_0xf3b6('0x10')][_0xf3b6('0xe')]||_0x3a4ee1[_0xf3b6('0x10')][_0xf3b6('0x11')][_0xf3b6('0x12')]),'to':_0x3a4ee1['email'],'cc':_0x3a4ee1['cc'],'bcc':_0x3a4ee1[_0xf3b6('0x13')],'subject':util[_0xf3b6('0xf')]('Report\x20%s\x20last\x20%s\x20%s',_0x1cd8c5[_0xf3b6('0x14')],_0x3a4ee1[_0xf3b6('0x15')],_0x3a4ee1[_0xf3b6('0x16')])}};var _0x2dd84f=path[_0xf3b6('0x17')](__dirname,_0xf3b6('0x18'));var _0x296c74=_0x1cd8c5['savename'];var _0x3970b8=util[_0xf3b6('0xf')]('%s.%s',path[_0xf3b6('0x19')](_0x1cd8c5[_0xf3b6('0x1a')],path[_0xf3b6('0x1b')](_0x1cd8c5['savename'])),_0xf3b6('0x1c'));var _0x397cad=path[_0xf3b6('0x17')](_0x2dd84f,_0x296c74);var _0x48b634=path[_0xf3b6('0x17')](_0x2dd84f,_0x3970b8);if(fs[_0xf3b6('0x1d')](_0x397cad)){_0x1cd8c5[_0xf3b6('0x1e')]=_0xf3b6('0x1f');_0x4a37ab[_0xf3b6('0x20')]['attachments']=[{'filename':_0x296c74,'path':_0x397cad}];_0x4a37ab[_0xf3b6('0x20')][_0xf3b6('0x21')]=util[_0xf3b6('0xf')](_0xf3b6('0x22'),JSON[_0xf3b6('0x23')](_0x1cd8c5,null,0x2));}else if(fs[_0xf3b6('0x1d')](_0x48b634)){_0x1cd8c5['status']=_0xf3b6('0x1f');_0x4a37ab['message'][_0xf3b6('0x24')]=[{'filename':_0x3970b8,'path':_0x48b634}];}else{_0x4a37ab[_0xf3b6('0x20')][_0xf3b6('0x21')]=_0xf3b6('0x25');if(!_0x3a4ee1['sendIfEmpty']){_0x30f6c2=![];logger['info'](_0xf3b6('0x26'));}}if(_0x30f6c2){return client['request'](_0xf3b6('0x27'),_0x4a37ab)[_0xf3b6('0x28')](function(_0x55a139){if(_0x55a139[_0xf3b6('0x29')]){return logger[_0xf3b6('0x29')](_0xf3b6('0x2a'),JSON[_0xf3b6('0x23')](_0x55a139));}return logger[_0xf3b6('0xc')]('email\x20sent');})[_0xf3b6('0x2b')](function(_0x3d6391){return logger[_0xf3b6('0x29')](_0xf3b6('0x2a'),JSON[_0xf3b6('0x23')](_0x3d6391));});}};}function handleError(){return function(_0x131057){return logger['error'](JSON[_0xf3b6('0x23')](_0x131057));};}function handleResult(_0x1ea045){return function(_0x5ae96a){logger['info'](_0xf3b6('0x2c'),JSON[_0xf3b6('0x23')](_0x5ae96a));if(_0x1ea045[_0xf3b6('0x10')]&&_0x1ea045['MailAccount'][_0xf3b6('0x11')]&&!_[_0xf3b6('0x2d')](_0x1ea045[_0xf3b6('0xe')])){setTimeout(handleSendEmail(_0x1ea045,_0x5ae96a),0x3c*0x3e8);}};}function handleJob(_0x58de2f){return function(){try{if(_['isNil'](_0x58de2f['subtractNumber'])){return logger[_0xf3b6('0xc')](_0xf3b6('0x2e'));}if(_[_0xf3b6('0x2d')](_0x58de2f[_0xf3b6('0x16')])){return logger[_0xf3b6('0xc')](_0xf3b6('0x2f'));}var _0x5eb26e={'startDate':moment()[_0xf3b6('0x30')](_0x58de2f[_0xf3b6('0x15')],_0x58de2f[_0xf3b6('0x16')])[_0xf3b6('0xf')](_0xf3b6('0x31')),'endDate':moment()[_0xf3b6('0xf')](_0xf3b6('0x31')),'type':_0xf3b6('0x32'),'output':_0x58de2f[_0xf3b6('0x33')],'name':_0x58de2f[_0xf3b6('0x14')]};if(!_['isNil'](_0x58de2f['DefaultReportId'])){logger[_0xf3b6('0xc')](_0xf3b6('0x34'),_0x58de2f[_0xf3b6('0x35')]);return analyticDefaultReportController[_0xf3b6('0x36')]({'id':_0x58de2f[_0xf3b6('0x35')]},_0x5eb26e)[_0xf3b6('0x28')](handleResult(_0x58de2f))[_0xf3b6('0x2b')](handleError());}if(!_['isNil'](_0x58de2f['CustomReportId'])){logger[_0xf3b6('0xc')](_0xf3b6('0x37'),_0x58de2f[_0xf3b6('0x38')]);return analyticCustomReportController[_0xf3b6('0x36')]({'id':_0x58de2f[_0xf3b6('0x38')]},_0x5eb26e)['then'](handleResult(_0x58de2f))[_0xf3b6('0x2b')](handleError());}}catch(_0x3e005e){logger[_0xf3b6('0x29')](JSON[_0xf3b6('0x23')](_0x3e005e));}return logger[_0xf3b6('0xc')](_0xf3b6('0x39'));};}function getJobs(_0x5bf45b){var _0x168cd9={};if(_0x5bf45b){_0x168cd9['id']=_0x5bf45b;}return db[_0xf3b6('0x3a')][_0xf3b6('0x3b')]({'where':_0x168cd9,'include':[{'model':db[_0xf3b6('0x10')],'attributes':['id','name',_0xf3b6('0xe')],'include':[{'model':db[_0xf3b6('0x3c')],'as':_0xf3b6('0x11'),'include':[{'model':db[_0xf3b6('0x3d')],'as':'CloudProvider'}]}]}]})[_0xf3b6('0x28')](function(_0x342a28){var _0xd2e20c=_[_0xf3b6('0x3e')](manager[_0xf3b6('0x3f')]);var _0x2308f9=_['map'](_0x342a28,function(_0x4749f7){return _0x4749f7['id'][_0xf3b6('0x40')]();});var _0x1b16c1=_[_0xf3b6('0x41')](_0x342a28,function(_0x3b3fdb){return _0x3b3fdb['id'][_0xf3b6('0x40')]();});var _0x5a8994=_0x5bf45b?_0x2308f9:_[_0xf3b6('0x42')](_0x2308f9,_0xd2e20c);var _0x5e3c55=_['intersection'](_0x2308f9,_0xd2e20c);var _0x5733e9=_['difference'](_0xd2e20c,_0x2308f9);var _0x4317cc;var _0x121852;for(_0x4317cc=0x0;_0x4317cc<_0x5733e9[_0xf3b6('0x43')]&&!_0x5bf45b;_0x4317cc+=0x1){_0x121852=_0x5733e9[_0x4317cc][_0xf3b6('0x40')]();if(manager[_0xf3b6('0x44')](_0x121852)){manager[_0xf3b6('0x45')](_0x121852);manager['deleteJob'](_0x121852);logger[_0xf3b6('0xc')](_0xf3b6('0x46'),_0x121852);}}logger['info'](_0xf3b6('0x47'),JSON[_0xf3b6('0x23')](_0x5a8994));for(_0x4317cc=0x0;_0x4317cc<_0x5a8994[_0xf3b6('0x43')];_0x4317cc+=0x1){_0x121852=_0x5a8994[_0x4317cc][_0xf3b6('0x40')]();logger['info'](_0xf3b6('0x48'),_0x121852);if(_0x5bf45b){logger['info']('my\x20id',_0x5bf45b);logger[_0xf3b6('0xc')](JSON[_0xf3b6('0x23')](_0x1b16c1[_0x121852]));BPromise[_0xf3b6('0x49')]()['then'](handleJob(_0x1b16c1[_0x121852]));logger[_0xf3b6('0xc')](_0xf3b6('0x4a'),_0x1b16c1[_0x121852][_0xf3b6('0x14')],_0x1b16c1[_0x121852][_0xf3b6('0x4b')]);}else if(_0x1b16c1[_0x121852][_0xf3b6('0x4b')]&&_0x1b16c1[_0x121852][_0xf3b6('0x4c')]&&moment()[_0xf3b6('0x4d')](_0x1b16c1[_0x121852]['startAt'],_0x1b16c1[_0x121852][_0xf3b6('0x4e')])){manager[_0xf3b6('0x4f')](_0x121852,_0x1b16c1[_0x121852]['cron'],handleJob(_0x1b16c1[_0x121852]));manager['start'](_0x121852);logger['info'](_0xf3b6('0x50'),_0x1b16c1[_0x121852][_0xf3b6('0x14')],_0x1b16c1[_0x121852][_0xf3b6('0x4b')]);}else if(manager[_0xf3b6('0x44')](_0x121852)){manager[_0xf3b6('0x45')](_0x121852);manager[_0xf3b6('0x51')](_0x121852);logger['info'](_0xf3b6('0x52'),_0x1b16c1[_0x121852][_0xf3b6('0x14')],_0x1b16c1[_0x121852][_0xf3b6('0x4b')]);}}for(_0x4317cc=0x0,_0x121852;_0x4317cc<_0x5e3c55['length']&&!_0x5bf45b;_0x4317cc+=0x1){_0x121852=_0x5e3c55[_0x4317cc]['toString']();if(manager[_0xf3b6('0x44')](_0x121852)){if(_0x1b16c1[_0x121852][_0xf3b6('0x4b')]&&_0x1b16c1[_0x121852][_0xf3b6('0x4c')]&&moment()[_0xf3b6('0x4d')](_0x1b16c1[_0x121852]['startAt'],_0x1b16c1[_0x121852][_0xf3b6('0x4e')])){manager['update'](_0x121852,_0x1b16c1[_0x121852][_0xf3b6('0x4b')],handleJob(_0x1b16c1[_0x121852]));logger[_0xf3b6('0xc')](_0xf3b6('0x53'),_0x1b16c1[_0x121852]['name'],_0x1b16c1[_0x121852]['cron']);}else{manager[_0xf3b6('0x45')](_0x121852);manager[_0xf3b6('0x51')](_0x121852);logger[_0xf3b6('0xc')](_0xf3b6('0x52'),_0x1b16c1[_0x121852][_0xf3b6('0x14')],_0x1b16c1[_0x121852][_0xf3b6('0x4b')]);}}}})[_0xf3b6('0x2b')](function(_0x21c4b6){logger[_0xf3b6('0x29')](JSON[_0xf3b6('0x23')](_0x21c4b6));});}exports[_0xf3b6('0x54')]=function(_0x55b0ff){return getJobs(_0x55b0ff);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa4fa=['scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','stop','deleteJob','delete\x20cron','toRun','index','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','update','update\x20cron','stop\x20cron','run','util','path','lodash','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info','getSmtpOptions','MailAccount','email','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','Sent','attachments','message','stringify','existsSync','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x6c4bb5,_0x3af853){var _0x29c2fe=function(_0x38a611){while(--_0x38a611){_0x6c4bb5['push'](_0x6c4bb5['shift']());}};_0x29c2fe(++_0x3af853);}(_0xa4fa,0x77));var _0xaa4f=function(_0x40d36f,_0x2ab62a){_0x40d36f=_0x40d36f-0x0;var _0x3635cd=_0xa4fa[_0x40d36f];return _0x3635cd;};'use strict';var fs=require('fs');var util=require(_0xaa4f('0x0'));var path=require(_0xaa4f('0x1'));var _=require(_0xaa4f('0x2'));var moment=require('moment');var CronJobManager=require(_0xaa4f('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xaa4f('0x4'));var logger=require(_0xaa4f('0x5'))('schedule');var db=require(_0xaa4f('0x6'))['db'];var analyticCustomReportController=require(_0xaa4f('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xaa4f('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e0ad1,_0x205334){return function(){logger[_0xaa4f('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x5e0ad1['email']);var _0x169faf=!![];var _0x130f2e=_0x5e0ad1['MailAccount'][_0xaa4f('0xa')]();var _0x364a31={'account':_0x130f2e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x5e0ad1[_0xaa4f('0xb')]['name'],_0x5e0ad1[_0xaa4f('0xb')][_0xaa4f('0xc')]||_0x5e0ad1['MailAccount'][_0xaa4f('0xd')][_0xaa4f('0xe')]),'to':_0x5e0ad1['email'],'cc':_0x5e0ad1['cc'],'bcc':_0x5e0ad1['bcc'],'subject':util[_0xaa4f('0xf')](_0xaa4f('0x10'),_0x205334[_0xaa4f('0x11')],_0x5e0ad1[_0xaa4f('0x12')],_0x5e0ad1[_0xaa4f('0x13')])}};var _0x504f24=path[_0xaa4f('0x14')](__dirname,_0xaa4f('0x15'));var _0x52ce01=_0x205334['savename'];var _0xcc7346=util[_0xaa4f('0xf')](_0xaa4f('0x16'),path[_0xaa4f('0x17')](_0x205334['savename'],path['extname'](_0x205334[_0xaa4f('0x18')])),'zip');var _0x6127eb=path['join'](_0x504f24,_0x52ce01);var _0x1a021b=path[_0xaa4f('0x14')](_0x504f24,_0xcc7346);if(fs['existsSync'](_0x6127eb)){_0x205334['status']=_0xaa4f('0x19');_0x364a31['message'][_0xaa4f('0x1a')]=[{'filename':_0x52ce01,'path':_0x6127eb}];_0x364a31[_0xaa4f('0x1b')]['text']=util[_0xaa4f('0xf')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xaa4f('0x1c')](_0x205334,null,0x2));}else if(fs[_0xaa4f('0x1d')](_0x1a021b)){_0x205334[_0xaa4f('0x1e')]=_0xaa4f('0x19');_0x364a31['message'][_0xaa4f('0x1a')]=[{'filename':_0xcc7346,'path':_0x1a021b}];}else{_0x364a31[_0xaa4f('0x1b')]['text']=_0xaa4f('0x1f');if(!_0x5e0ad1[_0xaa4f('0x20')]){_0x169faf=![];logger[_0xaa4f('0x9')](_0xaa4f('0x21'));}}if(_0x169faf){return client['request'](_0xaa4f('0x22'),_0x364a31)['then'](function(_0x4da15f){if(_0x4da15f[_0xaa4f('0x23')]){return logger['error'](_0xaa4f('0x24'),JSON['stringify'](_0x4da15f));}return logger[_0xaa4f('0x9')](_0xaa4f('0x25'));})[_0xaa4f('0x26')](function(_0x15a2e4){return logger[_0xaa4f('0x23')](_0xaa4f('0x24'),JSON[_0xaa4f('0x1c')](_0x15a2e4));});}};}function handleError(){return function(_0x32e34f){return logger[_0xaa4f('0x23')](JSON[_0xaa4f('0x1c')](_0x32e34f));};}function handleResult(_0x1a72b3){return function(_0xb55b93){logger[_0xaa4f('0x9')](_0xaa4f('0x27'),JSON['stringify'](_0xb55b93));if(_0x1a72b3[_0xaa4f('0xb')]&&_0x1a72b3[_0xaa4f('0xb')][_0xaa4f('0xd')]&&!_[_0xaa4f('0x28')](_0x1a72b3['email'])){setTimeout(handleSendEmail(_0x1a72b3,_0xb55b93),0x3c*0x3e8);}};}function handleJob(_0x5d5a25){return function(){try{if(_[_0xaa4f('0x28')](_0x5d5a25['subtractNumber'])){return logger[_0xaa4f('0x9')](_0xaa4f('0x29'));}if(_[_0xaa4f('0x28')](_0x5d5a25[_0xaa4f('0x13')])){return logger[_0xaa4f('0x9')](_0xaa4f('0x2a'));}var _0x4ed974={'startDate':moment()[_0xaa4f('0x2b')](_0x5d5a25['subtractNumber'],_0x5d5a25[_0xaa4f('0x13')])[_0xaa4f('0xf')](_0xaa4f('0x2c')),'endDate':moment()[_0xaa4f('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xaa4f('0x2d'),'output':_0x5d5a25[_0xaa4f('0x2e')],'name':_0x5d5a25[_0xaa4f('0x11')]};if(!_[_0xaa4f('0x28')](_0x5d5a25[_0xaa4f('0x2f')])){logger[_0xaa4f('0x9')](_0xaa4f('0x30'),_0x5d5a25['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5d5a25[_0xaa4f('0x2f')]},_0x4ed974)[_0xaa4f('0x31')](handleResult(_0x5d5a25))[_0xaa4f('0x26')](handleError());}if(!_[_0xaa4f('0x28')](_0x5d5a25[_0xaa4f('0x32')])){logger['info'](_0xaa4f('0x33'),_0x5d5a25['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x5d5a25[_0xaa4f('0x32')]},_0x4ed974)[_0xaa4f('0x31')](handleResult(_0x5d5a25))[_0xaa4f('0x26')](handleError());}}catch(_0x5b48ce){logger[_0xaa4f('0x23')](JSON[_0xaa4f('0x1c')](_0x5b48ce));}return logger[_0xaa4f('0x9')](_0xaa4f('0x34'));};}function getJobs(_0x28b9b8){var _0x165a36={};if(_0x28b9b8){_0x165a36['id']=_0x28b9b8;}return db[_0xaa4f('0x35')][_0xaa4f('0x36')]({'where':_0x165a36,'include':[{'model':db[_0xaa4f('0xb')],'attributes':['id',_0xaa4f('0x11'),_0xaa4f('0xc')],'include':[{'model':db[_0xaa4f('0x37')],'as':'Smtp','include':[{'model':db[_0xaa4f('0x38')],'as':'CloudProvider'}]}]}]})[_0xaa4f('0x31')](function(_0x386afe){var _0x45f2a2=_[_0xaa4f('0x39')](manager['jobs']);var _0xbdf2fc=_[_0xaa4f('0x3a')](_0x386afe,function(_0xb6d0e){return _0xb6d0e['id'][_0xaa4f('0x3b')]();});var _0x25c1bb=_[_0xaa4f('0x3c')](_0x386afe,function(_0x3b8b42){return _0x3b8b42['id'][_0xaa4f('0x3b')]();});var _0xf01c7b=_0x28b9b8?_0xbdf2fc:_[_0xaa4f('0x3d')](_0xbdf2fc,_0x45f2a2);var _0x2df3ad=_[_0xaa4f('0x3e')](_0xbdf2fc,_0x45f2a2);var _0x550f92=_[_0xaa4f('0x3d')](_0x45f2a2,_0xbdf2fc);var _0x414a48;var _0x12acf8;for(_0x414a48=0x0;_0x414a48<_0x550f92['length']&&!_0x28b9b8;_0x414a48+=0x1){_0x12acf8=_0x550f92[_0x414a48][_0xaa4f('0x3b')]();if(manager['exists'](_0x12acf8)){manager[_0xaa4f('0x3f')](_0x12acf8);manager[_0xaa4f('0x40')](_0x12acf8);logger[_0xaa4f('0x9')](_0xaa4f('0x41'),_0x12acf8);}}logger['info'](_0xaa4f('0x42'),JSON['stringify'](_0xf01c7b));for(_0x414a48=0x0;_0x414a48<_0xf01c7b['length'];_0x414a48+=0x1){_0x12acf8=_0xf01c7b[_0x414a48]['toString']();logger[_0xaa4f('0x9')](_0xaa4f('0x43'),_0x12acf8);if(_0x28b9b8){logger[_0xaa4f('0x9')]('my\x20id',_0x28b9b8);logger['info'](JSON[_0xaa4f('0x1c')](_0x25c1bb[_0x12acf8]));BPromise[_0xaa4f('0x44')]()[_0xaa4f('0x31')](handleJob(_0x25c1bb[_0x12acf8]));logger[_0xaa4f('0x9')]('run\x20job',_0x25c1bb[_0x12acf8][_0xaa4f('0x11')],_0x25c1bb[_0x12acf8][_0xaa4f('0x45')]);}else if(_0x25c1bb[_0x12acf8][_0xaa4f('0x45')]&&_0x25c1bb[_0x12acf8][_0xaa4f('0x46')]&&moment()[_0xaa4f('0x47')](_0x25c1bb[_0x12acf8][_0xaa4f('0x48')],_0x25c1bb[_0x12acf8][_0xaa4f('0x49')])){manager[_0xaa4f('0x4a')](_0x12acf8,_0x25c1bb[_0x12acf8][_0xaa4f('0x45')],handleJob(_0x25c1bb[_0x12acf8]));manager[_0xaa4f('0x4b')](_0x12acf8);logger[_0xaa4f('0x9')](_0xaa4f('0x4c'),_0x25c1bb[_0x12acf8][_0xaa4f('0x11')],_0x25c1bb[_0x12acf8]['cron']);}else if(manager[_0xaa4f('0x4d')](_0x12acf8)){manager[_0xaa4f('0x3f')](_0x12acf8);manager[_0xaa4f('0x40')](_0x12acf8);logger[_0xaa4f('0x9')]('stop\x20cron',_0x25c1bb[_0x12acf8][_0xaa4f('0x11')],_0x25c1bb[_0x12acf8][_0xaa4f('0x45')]);}}for(_0x414a48=0x0,_0x12acf8;_0x414a48<_0x2df3ad['length']&&!_0x28b9b8;_0x414a48+=0x1){_0x12acf8=_0x2df3ad[_0x414a48][_0xaa4f('0x3b')]();if(manager[_0xaa4f('0x4d')](_0x12acf8)){if(_0x25c1bb[_0x12acf8][_0xaa4f('0x45')]&&_0x25c1bb[_0x12acf8][_0xaa4f('0x46')]&&moment()[_0xaa4f('0x47')](_0x25c1bb[_0x12acf8]['startAt'],_0x25c1bb[_0x12acf8]['endAt'])){manager[_0xaa4f('0x4e')](_0x12acf8,_0x25c1bb[_0x12acf8][_0xaa4f('0x45')],handleJob(_0x25c1bb[_0x12acf8]));logger[_0xaa4f('0x9')](_0xaa4f('0x4f'),_0x25c1bb[_0x12acf8][_0xaa4f('0x11')],_0x25c1bb[_0x12acf8]['cron']);}else{manager[_0xaa4f('0x3f')](_0x12acf8);manager[_0xaa4f('0x40')](_0x12acf8);logger[_0xaa4f('0x9')](_0xaa4f('0x50'),_0x25c1bb[_0x12acf8][_0xaa4f('0x11')],_0x25c1bb[_0x12acf8][_0xaa4f('0x45')]);}}}})[_0xaa4f('0x26')](function(_0x387842){logger[_0xaa4f('0x23')](JSON[_0xaa4f('0x1c')](_0x387842));});}exports[_0xaa4f('0x51')]=function(_0x584f2e){return getJobs(_0x584f2e);};exports[_0xaa4f('0x4b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 7967d51..4930ed5 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71f4=['bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Neutral','FailureReason','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','Cloud\x20Provider\x20not\x20available','Sentiment','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','SequelizeValidationError','error','inspect','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language'];(function(_0x42c5d0,_0x465d49){var _0x77e24a=function(_0x3d5278){while(--_0x3d5278){_0x42c5d0['push'](_0x42c5d0['shift']());}};_0x77e24a(++_0x465d49);}(_0x71f4,0xf9));var _0x471f=function(_0x900a62,_0x52889d){_0x900a62=_0x900a62-0x0;var _0x1f537a=_0x71f4[_0x900a62];return _0x1f537a;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x471f('0x0'));var util=require(_0x471f('0x1'));var BPromise=require(_0x471f('0x2'));var db=require(_0x471f('0x3'))['db'];var logger=require(_0x471f('0x4'))('transcribe');function getTranscriptionJob(_0x453f79,_0x57bbfa,_0x3e0c2e,_0x5978a7){return new Promise(function(_0x1d0101,_0x3bdf82){var _0x155a77=new AWS[(_0x471f('0x5'))]({'accessKeyId':_0x57bbfa,'secretAccessKey':_0x453f79,'region':_0x3e0c2e});_0x155a77[_0x471f('0x6')]({'TranscriptionJobName':_0x5978a7},function(_0x246851,_0x2844e2){if(_0x246851){return _0x3bdf82(_0x246851);}else{return _0x1d0101(_0x2844e2);}});});}function sentiment(_0x3a4fa9,_0x3e59ed,_0x556733,_0x51f77e,_0x519567){return new Promise(function(_0x321e48,_0x22ea73){var _0x55042a=new AWS[(_0x471f('0x7'))]({'accessKeyId':_0x3e59ed,'secretAccessKey':_0x3a4fa9,'region':_0x556733});_0x55042a[_0x471f('0x8')]({'Text':_0x51f77e,'LanguageCode':_0x519567[_0x471f('0x9')](0x0,0x2)},function(_0x4d7364,_0x8b54cb){if(_0x4d7364){return _0x22ea73(_0x4d7364);}else{return _0x321e48(_0x8b54cb);}});});}function checkTranscribeJob(_0x16662a,_0x9f73ca,_0x22651b){var _0xafc5e8;return new BPromise(function(_0x4151c1,_0xdc7747){logger[_0x471f('0xa')](util[_0x471f('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x16662a['id'],_0x16662a[_0x471f('0xc')]));return getTranscriptionJob(_0x22651b['data1'],_0x22651b[_0x471f('0xd')],_0x9f73ca[_0x471f('0xe')],_0x16662a[_0x471f('0xc')])[_0x471f('0xf')](function(_0x117e7f){logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x10'),_0x16662a['id'],_0x16662a['transcribeName'],_0x117e7f[_0x471f('0x11')][_0x471f('0x12')]));if(!_0x16662a['fileText']){switch(_0x117e7f[_0x471f('0x11')]['TranscriptionJobStatus']){case _0x471f('0x13'):var _0x4e9833={'transcribeStatus':_0x117e7f[_0x471f('0x11')][_0x471f('0x12')],'fileUri':_0x117e7f[_0x471f('0x11')][_0x471f('0x14')]['TranscriptFileUri']};logger['info'](util[_0x471f('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x16662a['id']));return rp({'uri':_0x117e7f[_0x471f('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x471f('0xf')](function(_0x2503f4){logger['info'](util[_0x471f('0xb')](_0x471f('0x15'),_0x16662a['id']));if(_0x2503f4&&_0x2503f4[_0x471f('0x16')]&&_0x2503f4['results'][_0x471f('0x17')]&&_0x2503f4[_0x471f('0x16')][_0x471f('0x17')][_0x471f('0x18')]){_0x4e9833[_0x471f('0x19')]='';for(var _0x505ca3=0x0;_0x505ca3<_0x2503f4[_0x471f('0x16')][_0x471f('0x17')]['length'];_0x505ca3++){_0x4e9833['fileText']+=_0x2503f4[_0x471f('0x16')][_0x471f('0x17')][_0x505ca3][_0x471f('0x1a')]+'';}}return _0x16662a[_0x471f('0x1b')](_0x4e9833);})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x1c'),_0x16662a['id']));if(!_0x16662a['tempSentiment']){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x9f73ca[_0x471f('0x1f')]||!_0x9f73ca[_0x471f('0x20')]||!_0x9f73ca[_0x471f('0x21')]||!_0x9f73ca[_0x471f('0x22')]||!_0x9f73ca[_0x471f('0x23')]){throw new db['Sequelize'][(_0x471f('0x1e'))](_0x471f('0x24'));}if(!_0x4e9833['fileText']){throw new Error(_0x471f('0x25'));}if(_0x9f73ca[_0x471f('0x20')]===_0x22651b['id']){return _0x22651b;}else{return db[_0x471f('0x26')][_0x471f('0x27')]({'where':{'id':_settings[_0x471f('0x20')]}});}})[_0x471f('0xf')](function(_0x28392f){if(!_0x28392f){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x28392f['data1']||!_0x28392f[_0x471f('0xd')]){throw new db[(_0x471f('0x1d'))]['ValidationError'](_0x471f('0x28'));}_0xafc5e8=_0x28392f;logger['info'](util[_0x471f('0xb')](_0x471f('0x29'),_0x16662a['id']));return sentiment(_0xafc5e8[_0x471f('0x2a')],_0xafc5e8[_0x471f('0xd')],_0x9f73ca[_0x471f('0x21')],_0x4e9833[_0x471f('0x19')],_0x9f73ca['language']);})[_0x471f('0xf')](function(_0x4fda1b){logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x2b'),_0x16662a['id']));return _0x16662a['update']({'sentiment':_0x4fda1b['Sentiment'],'sPositive':_0x4fda1b[_0x471f('0x2c')][_0x471f('0x2d')],'sNegative':_0x4fda1b[_0x471f('0x2c')][_0x471f('0x2e')],'sMixed':_0x4fda1b[_0x471f('0x2c')]['Mixed'],'sNeutral':_0x4fda1b['SentimentScore'][_0x471f('0x2f')]});})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util['format'](_0x471f('0x1c'),_0x16662a['id']));_0x4151c1();});case'FAILED':return _0x16662a['update']({'transcribeStatus':'FAILED','failureReason':_0x117e7f[_0x471f('0x11')][_0x471f('0x30')]})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util[_0x471f('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x16662a['id']));_0x4151c1();});default:logger['info'](util[_0x471f('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x16662a['id']));break;}}else{return BPromise[_0x471f('0x31')]()['then'](function(){if(!_0x16662a[_0x471f('0x32')]){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))](_0x471f('0x33'));}if(!_0x9f73ca[_0x471f('0x1f')]||!_0x9f73ca[_0x471f('0x20')]||!_0x9f73ca[_0x471f('0x21')]||!_0x9f73ca[_0x471f('0x22')]||!_0x9f73ca[_0x471f('0x23')]){throw new db[(_0x471f('0x1d'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x16662a[_0x471f('0x19')]){throw new Error(_0x471f('0x25'));}if(_0x9f73ca['sentimentAccountId']===_0x22651b['id']){return _0x22651b;}else{return db['CloudProvider'][_0x471f('0x27')]({'where':{'id':_settings[_0x471f('0x20')]}});}})[_0x471f('0xf')](function(_0x4e37b7){if(!_0x4e37b7){throw new db[(_0x471f('0x1d'))]['ValidationError'](_0x471f('0x34'));}if(!_0x4e37b7[_0x471f('0x2a')]||!_0x4e37b7['data2']){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))](_0x471f('0x28'));}_0xafc5e8=_0x4e37b7;logger[_0x471f('0xa')](util[_0x471f('0xb')](_0x471f('0x29'),_0x16662a['id']));return sentiment(_0xafc5e8[_0x471f('0x2a')],_0xafc5e8['data2'],_0x9f73ca['sentimentRegion'],_0x16662a[_0x471f('0x19')],_0x9f73ca[_0x471f('0x22')]);})[_0x471f('0xf')](function(_0x41ccd5){logger['info'](util[_0x471f('0xb')](_0x471f('0x2b'),_0x16662a['id']));return _0x16662a[_0x471f('0x1b')]({'sentiment':_0x41ccd5[_0x471f('0x35')],'sPositive':_0x41ccd5['SentimentScore'][_0x471f('0x2d')],'sNegative':_0x41ccd5[_0x471f('0x2c')][_0x471f('0x2e')],'sMixed':_0x41ccd5[_0x471f('0x2c')]['Mixed'],'sNeutral':_0x41ccd5['SentimentScore']['Neutral'],'transcribeStatus':_0x471f('0x13')});})[_0x471f('0xf')](function(){logger[_0x471f('0xa')](util[_0x471f('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x16662a['id']));_0x4151c1();});}})[_0x471f('0x36')](function(_0x56d79c){if(_0x56d79c){if(!_0x56d79c[_0x471f('0x37')]||_0x56d79c[_0x471f('0x37')]!=='SequelizeValidationError'){logger['error'](util['format'](_0x471f('0x38'),_0x16662a['id']),util['inspect'](_0x56d79c,{'showHidden':![],'depth':null}));}}_0x4151c1();});});}function checkTranscribe(){var _0x3b758b;var _0x245b1b;var _0x36a9e3;return db[_0x471f('0x39')][_0x471f('0x3a')]({'where':{'transcribeStatus':_0x471f('0x3b')}})[_0x471f('0xf')](function(_0x3a6625){if(!_0x3a6625||!_0x3a6625[_0x471f('0x18')]){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))]('No\x20transcribe\x20job\x20to\x20check');}_0x3b758b=_0x3a6625;return db[_0x471f('0x3c')][_0x471f('0x27')]({'where':{'id':0x1}});})[_0x471f('0xf')](function(_0x136687){if(!_0x136687){throw new db[(_0x471f('0x1d'))][(_0x471f('0x1e'))](_0x471f('0x3d'));}_0x245b1b=_0x136687;if(!_0x245b1b[_0x471f('0x3e')]||!_0x245b1b[_0x471f('0x3f')]||!_0x245b1b['transcribeRegion']||!_0x245b1b['language']||!_0x245b1b[_0x471f('0x23')]){throw new db['Sequelize'][(_0x471f('0x1e'))](_0x471f('0x40'));}return db['CloudProvider']['findOne']({'where':{'id':_0x245b1b[_0x471f('0x3f')]}});})[_0x471f('0xf')](function(_0x1f4e5a){if(!_0x1f4e5a){throw new db['Sequelize'][(_0x471f('0x1e'))](_0x471f('0x34'));}if(!_0x1f4e5a['data1']||!_0x1f4e5a['data2']){throw new db['Sequelize']['ValidationError'](_0x471f('0x28'));}_0x36a9e3=_0x1f4e5a;var _0x14c97c=[];_0x3b758b[_0x471f('0x41')](function(_0x183d2e){_0x14c97c['push'](checkTranscribeJob(_0x183d2e,_0x245b1b,_0x36a9e3));});return BPromise[_0x471f('0x42')](_0x14c97c);})[_0x471f('0x36')](function(_0x34af86){if(_0x34af86){if(!_0x34af86['name']||_0x34af86[_0x471f('0x37')]!==_0x471f('0x43')){logger[_0x471f('0x44')](util[_0x471f('0x45')](_0x34af86,{'showHidden':![],'depth':null}));}}});}exports[_0x471f('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xee4f=['language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','CloudProvider','catch','name','error','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','all','SequelizeValidationError','start','lodash','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','sentiment','sentimentAccountId','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0xee4f,0xad));var _0xfee4=function(_0x2423ea,_0x14786a){_0x2423ea=_0x2423ea-0x0;var _0x406d5c=_0xee4f[_0x2423ea];return _0x406d5c;};var _=require(_0xfee4('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xfee4('0x1'));var BPromise=require(_0xfee4('0x2'));var db=require(_0xfee4('0x3'))['db'];var logger=require('../../config/logger')(_0xfee4('0x4'));function getTranscriptionJob(_0x5b9149,_0x27874a,_0x505b55,_0x4da9b6){return new Promise(function(_0x1c39b1,_0x498647){var _0x52fb6b=new AWS[(_0xfee4('0x5'))]({'accessKeyId':_0x27874a,'secretAccessKey':_0x5b9149,'region':_0x505b55});_0x52fb6b[_0xfee4('0x6')]({'TranscriptionJobName':_0x4da9b6},function(_0x34908a,_0x4d3c71){if(_0x34908a){return _0x498647(_0x34908a);}else{return _0x1c39b1(_0x4d3c71);}});});}function sentiment(_0x52fc6e,_0x3e3e3a,_0x11556d,_0xa77876,_0x4dc812){return new Promise(function(_0x53f260,_0x2ca5f9){var _0x1d6855=new AWS[(_0xfee4('0x7'))]({'accessKeyId':_0x3e3e3a,'secretAccessKey':_0x52fc6e,'region':_0x11556d});_0x1d6855['detectSentiment']({'Text':_0xa77876,'LanguageCode':_0x4dc812[_0xfee4('0x8')](0x0,0x2)},function(_0x30c56e,_0x25ef80){if(_0x30c56e){return _0x2ca5f9(_0x30c56e);}else{return _0x53f260(_0x25ef80);}});});}function checkTranscribeJob(_0x166004,_0x95be61,_0x1cbbf5){var _0x297cee;return new BPromise(function(_0x562832,_0x367ca5){logger[_0xfee4('0x9')](util['format'](_0xfee4('0xa'),_0x166004['id'],_0x166004[_0xfee4('0xb')]));return getTranscriptionJob(_0x1cbbf5[_0xfee4('0xc')],_0x1cbbf5[_0xfee4('0xd')],_0x95be61[_0xfee4('0xe')],_0x166004[_0xfee4('0xb')])[_0xfee4('0xf')](function(_0x55440a){logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x11'),_0x166004['id'],_0x166004['transcribeName'],_0x55440a[_0xfee4('0x12')]['TranscriptionJobStatus']));if(!_0x166004['fileText']){switch(_0x55440a[_0xfee4('0x12')][_0xfee4('0x13')]){case _0xfee4('0x14'):var _0x44a1ec={'transcribeStatus':_0x55440a[_0xfee4('0x12')][_0xfee4('0x13')],'fileUri':_0x55440a[_0xfee4('0x12')][_0xfee4('0x15')][_0xfee4('0x16')]};logger['info'](util[_0xfee4('0x10')](_0xfee4('0x17'),_0x166004['id']));return rp({'uri':_0x55440a[_0xfee4('0x12')][_0xfee4('0x15')][_0xfee4('0x16')],'json':!![]})[_0xfee4('0xf')](function(_0x57012c){logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x18'),_0x166004['id']));if(_0x57012c&&_0x57012c[_0xfee4('0x19')]&&_0x57012c[_0xfee4('0x19')][_0xfee4('0x1a')]&&_0x57012c[_0xfee4('0x19')][_0xfee4('0x1a')][_0xfee4('0x1b')]){_0x44a1ec[_0xfee4('0x1c')]='';for(var _0x4eb11b=0x0;_0x4eb11b<_0x57012c['results']['transcripts']['length'];_0x4eb11b++){_0x44a1ec['fileText']+=_0x57012c[_0xfee4('0x19')][_0xfee4('0x1a')][_0x4eb11b][_0xfee4('0x1d')]+'';}}return _0x166004[_0xfee4('0x1e')](_0x44a1ec);})[_0xfee4('0xf')](function(){logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x1f'),_0x166004['id']));if(!_0x166004['tempSentiment']){throw new db[(_0xfee4('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x95be61[_0xfee4('0x21')]||!_0x95be61[_0xfee4('0x22')]||!_0x95be61['sentimentRegion']||!_0x95be61['language']||!_0x95be61[_0xfee4('0x23')]){throw new db['Sequelize']['ValidationError'](_0xfee4('0x24'));}if(!_0x44a1ec[_0xfee4('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x95be61[_0xfee4('0x22')]===_0x1cbbf5['id']){return _0x1cbbf5;}else{return db['CloudProvider'][_0xfee4('0x25')]({'where':{'id':_settings[_0xfee4('0x22')]}});}})[_0xfee4('0xf')](function(_0x48b196){if(!_0x48b196){throw new db[(_0xfee4('0x20'))][(_0xfee4('0x26'))](_0xfee4('0x27'));}if(!_0x48b196[_0xfee4('0xc')]||!_0x48b196['data2']){throw new db[(_0xfee4('0x20'))]['ValidationError'](_0xfee4('0x28'));}_0x297cee=_0x48b196;logger[_0xfee4('0x9')](util['format'](_0xfee4('0x29'),_0x166004['id']));return sentiment(_0x297cee[_0xfee4('0xc')],_0x297cee['data2'],_0x95be61[_0xfee4('0x2a')],_0x44a1ec['fileText'],_0x95be61[_0xfee4('0x2b')]);})[_0xfee4('0xf')](function(_0x1e09bb){logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x2c'),_0x166004['id']));return _0x166004['update']({'sentiment':_0x1e09bb[_0xfee4('0x2d')],'sPositive':_0x1e09bb['SentimentScore'][_0xfee4('0x2e')],'sNegative':_0x1e09bb['SentimentScore'][_0xfee4('0x2f')],'sMixed':_0x1e09bb[_0xfee4('0x30')][_0xfee4('0x31')],'sNeutral':_0x1e09bb[_0xfee4('0x30')][_0xfee4('0x32')]});})[_0xfee4('0xf')](function(){logger['info'](util[_0xfee4('0x10')](_0xfee4('0x1f'),_0x166004['id']));_0x562832();});case _0xfee4('0x33'):return _0x166004[_0xfee4('0x1e')]({'transcribeStatus':_0xfee4('0x33'),'failureReason':_0x55440a[_0xfee4('0x12')][_0xfee4('0x34')]})['then'](function(){logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x1f'),_0x166004['id']));_0x562832();});default:logger['info'](util['format'](_0xfee4('0x35'),_0x166004['id']));break;}}else{return BPromise[_0xfee4('0x36')]()[_0xfee4('0xf')](function(){if(!_0x166004['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xfee4('0x37'));}if(!_0x95be61[_0xfee4('0x21')]||!_0x95be61[_0xfee4('0x22')]||!_0x95be61[_0xfee4('0x2a')]||!_0x95be61['language']||!_0x95be61['bucket']){throw new db[(_0xfee4('0x20'))][(_0xfee4('0x26'))](_0xfee4('0x24'));}if(!_0x166004[_0xfee4('0x1c')]){throw new Error(_0xfee4('0x38'));}if(_0x95be61[_0xfee4('0x22')]===_0x1cbbf5['id']){return _0x1cbbf5;}else{return db[_0xfee4('0x39')][_0xfee4('0x25')]({'where':{'id':_settings[_0xfee4('0x22')]}});}})[_0xfee4('0xf')](function(_0x49c343){if(!_0x49c343){throw new db[(_0xfee4('0x20'))][(_0xfee4('0x26'))](_0xfee4('0x27'));}if(!_0x49c343[_0xfee4('0xc')]||!_0x49c343[_0xfee4('0xd')]){throw new db[(_0xfee4('0x20'))][(_0xfee4('0x26'))](_0xfee4('0x28'));}_0x297cee=_0x49c343;logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x29'),_0x166004['id']));return sentiment(_0x297cee[_0xfee4('0xc')],_0x297cee[_0xfee4('0xd')],_0x95be61['sentimentRegion'],_0x166004[_0xfee4('0x1c')],_0x95be61[_0xfee4('0x2b')]);})[_0xfee4('0xf')](function(_0x3da34f){logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x2c'),_0x166004['id']));return _0x166004[_0xfee4('0x1e')]({'sentiment':_0x3da34f[_0xfee4('0x2d')],'sPositive':_0x3da34f['SentimentScore'][_0xfee4('0x2e')],'sNegative':_0x3da34f[_0xfee4('0x30')]['Negative'],'sMixed':_0x3da34f[_0xfee4('0x30')][_0xfee4('0x31')],'sNeutral':_0x3da34f['SentimentScore']['Neutral'],'transcribeStatus':_0xfee4('0x14')});})['then'](function(){logger[_0xfee4('0x9')](util[_0xfee4('0x10')](_0xfee4('0x1f'),_0x166004['id']));_0x562832();});}})[_0xfee4('0x3a')](function(_0x32e4c7){if(_0x32e4c7){if(!_0x32e4c7[_0xfee4('0x3b')]||_0x32e4c7[_0xfee4('0x3b')]!=='SequelizeValidationError'){logger[_0xfee4('0x3c')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x166004['id']),util['inspect'](_0x32e4c7,{'showHidden':![],'depth':null}));}}_0x562832();});});}function checkTranscribe(){var _0x40cf21;var _0x3aa574;var _0x2419f4;return db['VoiceRecording'][_0xfee4('0x3d')]({'where':{'transcribeStatus':_0xfee4('0x3e')}})[_0xfee4('0xf')](function(_0x532ec8){if(!_0x532ec8||!_0x532ec8[_0xfee4('0x1b')]){throw new db['Sequelize'][(_0xfee4('0x26'))](_0xfee4('0x3f'));}_0x40cf21=_0x532ec8;return db[_0xfee4('0x40')][_0xfee4('0x25')]({'where':{'id':0x1}});})['then'](function(_0x3f2fb1){if(!_0x3f2fb1){throw new db[(_0xfee4('0x20'))]['ValidationError'](_0xfee4('0x41'));}_0x3aa574=_0x3f2fb1;if(!_0x3aa574[_0xfee4('0x4')]||!_0x3aa574['transcribeAccountId']||!_0x3aa574[_0xfee4('0xe')]||!_0x3aa574['language']||!_0x3aa574[_0xfee4('0x23')]){throw new db['Sequelize'][(_0xfee4('0x26'))](_0xfee4('0x42'));}return db['CloudProvider'][_0xfee4('0x25')]({'where':{'id':_0x3aa574[_0xfee4('0x43')]}});})[_0xfee4('0xf')](function(_0x48043b){if(!_0x48043b){throw new db[(_0xfee4('0x20'))]['ValidationError'](_0xfee4('0x27'));}if(!_0x48043b[_0xfee4('0xc')]||!_0x48043b[_0xfee4('0xd')]){throw new db['Sequelize'][(_0xfee4('0x26'))](_0xfee4('0x28'));}_0x2419f4=_0x48043b;var _0x249d43=[];_0x40cf21['forEach'](function(_0x16a18e){_0x249d43[_0xfee4('0x44')](checkTranscribeJob(_0x16a18e,_0x3aa574,_0x2419f4));});return BPromise[_0xfee4('0x45')](_0x249d43);})['catch'](function(_0x5520b6){if(_0x5520b6){if(!_0x5520b6[_0xfee4('0x3b')]||_0x5520b6[_0xfee4('0x3b')]!==_0xfee4('0x46')){logger[_0xfee4('0x3c')](util['inspect'](_0x5520b6,{'showHidden':![],'depth':null}));}}});}exports[_0xfee4('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 61eb9ee..b6a7007 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5777=['map','info','join','update','system','timeout','format','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','../../config/environment','../logger','schedule','redis','WhatsappInteraction','subtract','hours','then'];(function(_0x5ae3dc,_0x18cb4e){var _0xa3c337=function(_0x2efece){while(--_0x2efece){_0x5ae3dc['push'](_0x5ae3dc['shift']());}};_0xa3c337(++_0x18cb4e);}(_0x5777,0x15e));var _0x7577=function(_0x45c14a,_0x3c8cc3){_0x45c14a=_0x45c14a-0x0;var _0x3979c7=_0x5777[_0x45c14a];return _0x3979c7;};'use strict';var _=require(_0x7577('0x0'));var moment=require(_0x7577('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x7577('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x7577('0x3'))(_0x7577('0x4'));config[_0x7577('0x5')]=_['defaults'](config[_0x7577('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7577('0x5')]));function closeInteractions(){var _0x2d26d2=[];return db[_0x7577('0x6')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7577('0x7')](0x18,_0x7577('0x8'))}}})[_0x7577('0x9')](function(_0x20cd75){if(_0x20cd75&&_0x20cd75['length']){_0x2d26d2=_[_0x7577('0xa')](_0x20cd75||[],'id');logger[_0x7577('0xb')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2d26d2[_0x7577('0xc')]());return db['WhatsappInteraction'][_0x7577('0xd')]({'closeReason':_0x7577('0xe'),'disposition':_0x7577('0xf'),'closed':!![],'closedAt':moment()[_0x7577('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2d26d2}});}})[_0x7577('0x9')](function(){if(_0x2d26d2&&_0x2d26d2[_0x7577('0x11')]){logger['info'](_0x7577('0x12'),_0x2d26d2[_0x7577('0xc')]());for(var _0x42cf5a=0x0;_0x42cf5a<_0x2d26d2[_0x7577('0x11')];_0x42cf5a++){io['emit'](_0x7577('0x13'),{'id':_0x2d26d2[_0x42cf5a],'closed':!![]});}}})[_0x7577('0x14')](function(_0x499234){logger[_0x7577('0x15')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x499234?util[_0x7577('0x16')](_0x499234,{'showHidden':![],'depth':null}):'');});}exports[_0x7577('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6e12=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','inspect','start','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join'];(function(_0x1caac7,_0x6b935d){var _0x3b8b10=function(_0x453145){while(--_0x453145){_0x1caac7['push'](_0x1caac7['shift']());}};_0x3b8b10(++_0x6b935d);}(_0x6e12,0x1d4));var _0x26e1=function(_0x1fdc13,_0x1de8ec){_0x1fdc13=_0x1fdc13-0x0;var _0xdc23f8=_0x6e12[_0x1fdc13];return _0xdc23f8;};'use strict';var _=require('lodash');var moment=require(_0x26e1('0x0'));var Redis=require(_0x26e1('0x1'));var util=require('util');var config=require(_0x26e1('0x2'));var db=require(_0x26e1('0x3'))['db'];var logger=require(_0x26e1('0x4'))(_0x26e1('0x5'));config[_0x26e1('0x6')]=_['defaults'](config['redis'],{'host':_0x26e1('0x7'),'port':0x18eb});var io=require(_0x26e1('0x8'))(new Redis(config[_0x26e1('0x6')]));function closeInteractions(){var _0x56e9ba=[];return db['WhatsappInteraction'][_0x26e1('0x9')]({'raw':!![],'attributes':['id',_0x26e1('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x26e1('0xb'))}}})[_0x26e1('0xc')](function(_0x23546f){if(_0x23546f&&_0x23546f[_0x26e1('0xd')]){_0x56e9ba=_[_0x26e1('0xe')](_0x23546f||[],'id');logger[_0x26e1('0xf')](_0x26e1('0x10'),_0x56e9ba[_0x26e1('0x11')]());return db['WhatsappInteraction']['update']({'closeReason':_0x26e1('0x12'),'disposition':_0x26e1('0x13'),'closed':!![],'closedAt':moment()[_0x26e1('0x14')](_0x26e1('0x15'))},{'where':{'id':_0x56e9ba}});}})[_0x26e1('0xc')](function(){if(_0x56e9ba&&_0x56e9ba[_0x26e1('0xd')]){logger[_0x26e1('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x56e9ba[_0x26e1('0x11')]());for(var _0x4dbc3c=0x0;_0x4dbc3c<_0x56e9ba[_0x26e1('0xd')];_0x4dbc3c++){io[_0x26e1('0x16')](_0x26e1('0x17'),{'id':_0x56e9ba[_0x4dbc3c],'closed':!![]});}}})[_0x26e1('0x18')](function(_0x51fb38){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x51fb38?util[_0x26e1('0x19')](_0x51fb38,{'showHidden':![],'depth':null}):'');});}exports[_0x26e1('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 712f78c..0164eb9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5af6=['CmHopper','log','hopper1','contacts2','catch','util','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1'];(function(_0x2f0d91,_0x5cf829){var _0x2eb402=function(_0x1d9021){while(--_0x1d9021){_0x2f0d91['push'](_0x2f0d91['shift']());}};_0x2eb402(++_0x5cf829);}(_0x5af6,0x113));var _0x65af=function(_0x440c6f,_0xd51cd3){_0x440c6f=_0x440c6f-0x0;var _0x3d7407=_0x5af6[_0x440c6f];return _0x3d7407;};'use strict';var util=require(_0x65af('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x65af('0x1')]({'id':i,'firstName':_0x65af('0x2')+i,'lastName':_0x65af('0x3')+i,'phone':0xf879fb460+i,'email':_0x65af('0x4')+i+_0x65af('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x65af('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x65af('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x65af('0x6')](),'updatedAt':Date[_0x65af('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x65af('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x65af('0x4')+i+_0x65af('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x65af('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x65af('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x65af('0x6')]()});}db[_0x65af('0x7')][_0x65af('0x8')]({'where':{}})[_0x65af('0x9')](function(){return db[_0x65af('0x7')][_0x65af('0xa')](contacts);})['then'](function(){console['log'](_0x65af('0xb'),_0x65af('0xc'));return db[_0x65af('0xd')][_0x65af('0x8')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x65af('0xa')](hopper);})[_0x65af('0x9')](function(){console[_0x65af('0xe')]('finished\x20populating',_0x65af('0xf'));return db[_0x65af('0x7')][_0x65af('0xa')](contacts2);})[_0x65af('0x9')](function(){console[_0x65af('0xe')](_0x65af('0xb'),_0x65af('0x10'));return db[_0x65af('0xd')][_0x65af('0xa')](hopper2);})[_0x65af('0x9')](function(){console[_0x65af('0xe')](_0x65af('0xb'),'hopper2');})[_0x65af('0x11')](function(_0x342fab){console[_0x65af('0xe')](_0x342fab);}); \ No newline at end of file +var _0x8659=['bulkCreate','log','CmHopper','hopper1','finished\x20populating','contacts2','hopper2','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then'];(function(_0x2795d9,_0x5928cb){var _0x4c88e9=function(_0x1e4395){while(--_0x1e4395){_0x2795d9['push'](_0x2795d9['shift']());}};_0x4c88e9(++_0x5928cb);}(_0x8659,0x16f));var _0x9865=function(_0x4bae7d,_0x1f7864){_0x4bae7d=_0x4bae7d-0x0;var _0x24ff97=_0x8659[_0x4bae7d];return _0x24ff97;};'use strict';var util=require(_0x9865('0x0'));var db=require(_0x9865('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9865('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9865('0x3')+i,'phone':0xf879fb460+i,'email':_0x9865('0x4')+i+_0x9865('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x9865('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9865('0x6')](),'updatedAt':Date[_0x9865('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x9865('0x7')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9865('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9865('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9865('0x6')](),'updatedAt':Date[_0x9865('0x6')]()});}db[_0x9865('0x8')][_0x9865('0x9')]({'where':{}})[_0x9865('0xa')](function(){return db[_0x9865('0x8')][_0x9865('0xb')](contacts);})['then'](function(){console[_0x9865('0xc')]('finished\x20populating','contacts1');return db[_0x9865('0xd')][_0x9865('0x9')]({'where':{}});})[_0x9865('0xa')](function(){return db[_0x9865('0xd')][_0x9865('0xb')](hopper);})[_0x9865('0xa')](function(){console[_0x9865('0xc')]('finished\x20populating',_0x9865('0xe'));return db[_0x9865('0x8')][_0x9865('0xb')](contacts2);})[_0x9865('0xa')](function(){console[_0x9865('0xc')](_0x9865('0xf'),_0x9865('0x10'));return db[_0x9865('0xd')][_0x9865('0xb')](hopper2);})[_0x9865('0xa')](function(){console[_0x9865('0xc')]('finished\x20populating',_0x9865('0x11'));})['catch'](function(_0x267089){console[_0x9865('0xc')](_0x267089);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5d3db37..794633b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8890=['%s%s','format','agent','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','util','../mysqldb'];(function(_0x18a81a,_0x4fc65b){var _0x114027=function(_0x1b7e0f){while(--_0x1b7e0f){_0x18a81a['push'](_0x18a81a['shift']());}};_0x114027(++_0x4fc65b);}(_0x8890,0x6a));var _0x0889=function(_0x1fde74,_0x491289){_0x1fde74=_0x1fde74-0x0;var _0x4ed6ae=_0x8890[_0x1fde74];return _0x4ed6ae;};'use strict';var util=require(_0x0889('0x0'));var db=require(_0x0889('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x0889('0x2'),'agent',i),'fullname':util[_0x0889('0x3')](_0x0889('0x2'),_0x0889('0x4'),i),'email':util['format']('%s%s@xcally.com',_0x0889('0x4'),i),'role':_0x0889('0x4'),'password':'password','internal':0xfa0+i,'type':_0x0889('0x5'),'transport':[_0x0889('0x6'),'ws',_0x0889('0x7')],'disallow':[_0x0889('0x8')],'allow':[_0x0889('0x9')],'defaultuser':util[_0x0889('0x3')](_0x0889('0x2'),_0x0889('0x4'),i),'encryption':_0x0889('0xa'),'avpf':_0x0889('0xa'),'force_avp':'yes','icesupport':_0x0889('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x0889('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x0889('0xc'),'callerid':util[_0x0889('0x3')](_0x0889('0xd'),util[_0x0889('0x3')](_0x0889('0x2'),_0x0889('0x4'),i),0xfa0+i)});}db[_0x0889('0xe')][_0x0889('0xf')](users)['then'](function(){console[_0x0889('0x10')]('add\x20user');})[_0x0889('0x11')](function(_0x1728aa){console[_0x0889('0x10')](_0x1728aa);}); \ No newline at end of file +var _0x0e81=['ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','util','../mysqldb','push','%s%s','format','agent','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x22490e,_0x4935bd){var _0x5b6459=function(_0x46ab8e){while(--_0x46ab8e){_0x22490e['push'](_0x22490e['shift']());}};_0x5b6459(++_0x4935bd);}(_0x0e81,0x159));var _0x10e8=function(_0x18ee80,_0x2adf1c){_0x18ee80=_0x18ee80-0x0;var _0x2f60c2=_0x0e81[_0x18ee80];return _0x2f60c2;};'use strict';var util=require(_0x10e8('0x0'));var db=require(_0x10e8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x10e8('0x2')]({'name':util['format'](_0x10e8('0x3'),'agent',i),'fullname':util[_0x10e8('0x4')](_0x10e8('0x3'),_0x10e8('0x5'),i),'email':util[_0x10e8('0x4')](_0x10e8('0x6'),_0x10e8('0x5'),i),'role':_0x10e8('0x5'),'password':_0x10e8('0x7'),'internal':0xfa0+i,'type':_0x10e8('0x8'),'transport':[_0x10e8('0x9'),'ws',_0x10e8('0xa')],'disallow':[_0x10e8('0xb')],'allow':[_0x10e8('0xc')],'defaultuser':util[_0x10e8('0x4')](_0x10e8('0x3'),'agent',i),'encryption':'yes','avpf':_0x10e8('0xd'),'force_avp':_0x10e8('0xd'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x10e8('0xe'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x10e8('0xf'),'callerid':util[_0x10e8('0x4')](_0x10e8('0x10'),util[_0x10e8('0x4')](_0x10e8('0x3'),'agent',i),0xfa0+i)});}db[_0x10e8('0x11')][_0x10e8('0x12')](users)[_0x10e8('0x13')](function(){console[_0x10e8('0x14')]('add\x20user');})['catch'](function(_0x282a3b){console[_0x10e8('0x14')](_0x282a3b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 9fa4728..0bcc0a7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0257=['findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','type','format','%s:queue:%s','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','voice:outbound','VoiceQueue','ChatQueues','FaxQueue','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','trunk:%s','leave','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','request','connection','remoteAddress','remotePort','log','SocketIO\x20','nsp','address','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','ivr','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x0257,0x1db));var _0x7025=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x0257[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var util=require(_0x7025('0x0'));var BPromise=require(_0x7025('0x1'));var db=require(_0x7025('0x2'))['db'];var config=require(_0x7025('0x3'));var queryQueues={'attributes':['id',_0x7025('0x4')],'include':[{'as':_0x7025('0x5'),'model':db[_0x7025('0x6')],'attributes':['id',_0x7025('0x4'),_0x7025('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7025('0x4')],'where':{'role':_0x7025('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7025('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x7025('0x4')],'where':{'role':_0x7025('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7025('0x4'),'type'],'where':{'type':_0x7025('0xa')}};function getAssociatedResources(_0x1dd525,_0x2f3fd9,_0x5dbd09){return db['UserProfileSection'][_0x7025('0xb')]({'where':{'name':_0x1dd525,'userProfileId':_0x2f3fd9},'raw':!![]})[_0x7025('0xc')](function(_0x469d9c){if(_0x469d9c){if(_0x469d9c[_0x7025('0xd')]){switch(_0x1dd525){case _0x7025('0xe'):case'ChatQueues':case _0x7025('0xf'):case _0x7025('0x10'):case _0x7025('0x11'):case _0x7025('0x12'):case _0x7025('0x13'):return db[_0x5dbd09][_0x7025('0x14')](queryQueues);case _0x7025('0x15'):return db[_0x5dbd09][_0x7025('0x14')](queryTelephones);case _0x7025('0x16'):return db[_0x5dbd09][_0x7025('0x14')](queryTrunks);case _0x7025('0x17'):return db[_0x5dbd09][_0x7025('0x14')](queryCampaigns);}}else{return db[_0x7025('0x18')]['findAll']({'attributes':[_0x7025('0x19')],'where':{'sectionId':_0x469d9c['id']},'raw':!![]})['then'](function(_0x17d9f2){if(_0x17d9f2){var _0x201e48={'where':{'id':_[_0x7025('0x1a')](_0x17d9f2,'resourceId')},'raw':!![]};switch(_0x5dbd09){case _0x7025('0x6'):_0x201e48['where'][_0x7025('0x7')]='telephone';break;case _0x7025('0x1b'):_0x201e48[_0x7025('0x1c')][_0x7025('0x1d')]=_0x7025('0xa');break;}return db[_0x5dbd09][_0x7025('0x14')](_0x201e48);}else{return[];}});}}else{return[];}})['then'](function(_0x25b2af){return _0x25b2af;});}function joinOrLeaveQueues(_0x37afea,_0x399c8c,_0x2168e5,_0x1d49e4){_0x37afea[_0x399c8c](util[_0x7025('0x1e')](_0x7025('0x1f'),_0x2168e5,_0x1d49e4['name']));if(_0x1d49e4[_0x7025('0x5')]){for(var _0x19d7f8=0x0;_0x19d7f8<_0x1d49e4[_0x7025('0x5')]['length'];_0x19d7f8+=0x1){_0x37afea[_0x399c8c](util[_0x7025('0x1e')](_0x7025('0x20'),_0x1d49e4['Agents'][_0x19d7f8][_0x7025('0x4')]));}}}function joinOrLeave(_0x10a3d2,_0x38bd2b,_0x1cf43f){var _0x5babca;if(_0x10a3d2[_0x7025('0x21')][_0x7025('0x22')]['id']){db[_0x7025('0x6')]['find']({'attributes':['id',_0x7025('0x4'),_0x7025('0x7'),_0x7025('0x23')],'where':{'id':_0x10a3d2[_0x7025('0x21')]['query']['id']},'include':[{'model':db[_0x7025('0x24')],'as':_0x7025('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7025('0x26')],'as':_0x7025('0x27'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x7025('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7025('0x29')],'as':_0x7025('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x7025('0x2b')],'as':_0x7025('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x7025('0x2d')],'as':_0x7025('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x7025('0xc')](function(_0x23be1b){if(_0x23be1b){_0x5babca=_0x23be1b;_0x10a3d2[_0x38bd2b](util[_0x7025('0x1e')](_0x7025('0x20'),_0x23be1b[_0x7025('0x4')]));var _0x58afc7=[];switch(_0x23be1b['role']){case _0x7025('0x2f'):_0x10a3d2[_0x38bd2b]('voice:inbound');_0x10a3d2[_0x38bd2b]('voice:outbound');if(queryQueues[_0x7025('0x30')](_0x7025('0x31'))){delete queryQueues[_0x7025('0x31')];}_0x58afc7['push'](db['VoiceQueue'][_0x7025('0x14')](queryQueues));_0x58afc7[_0x7025('0x32')](db[_0x7025('0x33')][_0x7025('0x14')](queryQueues));_0x58afc7['push'](db['FaxQueue'][_0x7025('0x14')](queryQueues));_0x58afc7[_0x7025('0x32')](db[_0x7025('0x34')]['findAll'](queryQueues));_0x58afc7['push'](db[_0x7025('0x35')][_0x7025('0x14')](queryQueues));_0x58afc7[_0x7025('0x32')](db[_0x7025('0x36')][_0x7025('0x14')](queryQueues));_0x58afc7['push'](db[_0x7025('0x37')][_0x7025('0x14')](queryQueues));_0x58afc7[_0x7025('0x32')](db['User']['findAll'](queryTelephones));_0x58afc7['push'](db[_0x7025('0x38')][_0x7025('0x14')](queryTrunks));_0x58afc7['push'](db['Campaign'][_0x7025('0x14')](queryCampaigns));_0x58afc7[_0x7025('0x32')](db[_0x7025('0x6')][_0x7025('0x14')](queryAgents));break;case _0x7025('0x39'):_0x10a3d2[_0x38bd2b](_0x7025('0x3a'));_0x10a3d2[_0x38bd2b](_0x7025('0x3b'));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0xe'),_0x23be1b[_0x7025('0x23')],_0x7025('0x3c')));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0x3d'),_0x23be1b[_0x7025('0x23')],_0x7025('0x33')));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0xf'),_0x23be1b[_0x7025('0x23')],_0x7025('0x3e')));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0x10'),_0x23be1b[_0x7025('0x23')],_0x7025('0x34')));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0x11'),_0x23be1b[_0x7025('0x23')],_0x7025('0x35')));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0x12'),_0x23be1b[_0x7025('0x23')],'OpenchannelQueue'));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0x13'),_0x23be1b['userProfileId'],'WhatsappQueue'));_0x58afc7['push'](getAssociatedResources(_0x7025('0x15'),_0x23be1b[_0x7025('0x23')],'User'));_0x58afc7[_0x7025('0x32')](getAssociatedResources(_0x7025('0x16'),_0x23be1b['userProfileId'],_0x7025('0x38')));_0x58afc7[_0x7025('0x32')](getAssociatedResources('IvrCampaigns',_0x23be1b[_0x7025('0x23')],_0x7025('0x1b')));_0x58afc7[_0x7025('0x32')](db[_0x7025('0x6')][_0x7025('0x14')](queryAgents));break;case _0x7025('0x9'):_0x10a3d2[_0x38bd2b](_0x7025('0x3a'));_0x10a3d2[_0x38bd2b]('voice:outbound');_0x58afc7['push'](_0x23be1b[_0x7025('0x3f')]({'attributes':['id','name']}));_0x58afc7[_0x7025('0x32')](_0x23be1b['getChatQueues']({'attributes':['id',_0x7025('0x4')]}));_0x58afc7['push'](_0x23be1b['getFaxQueues']({'attributes':['id',_0x7025('0x4')]}));_0x58afc7[_0x7025('0x32')](_0x23be1b[_0x7025('0x40')]({'attributes':['id','name']}));_0x58afc7[_0x7025('0x32')](_0x23be1b[_0x7025('0x41')]({'attributes':['id','name']}));_0x58afc7[_0x7025('0x32')](_0x23be1b[_0x7025('0x42')]({'attributes':['id',_0x7025('0x4')]}));_0x58afc7[_0x7025('0x32')](_0x23be1b[_0x7025('0x43')]({'attributes':['id',_0x7025('0x4')]}));break;}return BPromise[_0x7025('0x44')](_0x58afc7);}})[_0x7025('0xc')](function(_0xa7555d){if(_0xa7555d&&_0xa7555d[_0x7025('0x45')]){for(var _0x3cdbbe=0x0;_0x3cdbbe<_0xa7555d[_0x7025('0x45')];_0x3cdbbe+=0x1){for(var _0x3583dd=0x0;_0x3583dd<_0xa7555d[_0x3cdbbe]['length'];_0x3583dd+=0x1){switch(_0x3cdbbe){case 0x0:joinOrLeaveQueues(_0x10a3d2,_0x38bd2b,_0x7025('0x46'),_0xa7555d[_0x3cdbbe][_0x3583dd]);break;case 0x1:joinOrLeaveQueues(_0x10a3d2,_0x38bd2b,_0x7025('0x47'),_0xa7555d[_0x3cdbbe][_0x3583dd]);break;case 0x2:joinOrLeaveQueues(_0x10a3d2,_0x38bd2b,_0x7025('0x48'),_0xa7555d[_0x3cdbbe][_0x3583dd]);break;case 0x3:joinOrLeaveQueues(_0x10a3d2,_0x38bd2b,_0x7025('0x49'),_0xa7555d[_0x3cdbbe][_0x3583dd]);break;case 0x4:joinOrLeaveQueues(_0x10a3d2,_0x38bd2b,_0x7025('0x4a'),_0xa7555d[_0x3cdbbe][_0x3583dd]);break;case 0x5:joinOrLeaveQueues(_0x10a3d2,_0x38bd2b,'openchannel',_0xa7555d[_0x3cdbbe][_0x3583dd]);break;case 0x6:joinOrLeaveQueues(_0x10a3d2,_0x38bd2b,'whatsapp',_0xa7555d[_0x3cdbbe][_0x3583dd]);break;case 0x7:if(_0x5babca[_0x7025('0x7')]!==_0x7025('0x9'))_0x10a3d2[_0x38bd2b](util['format']('telephone:%s',_0xa7555d[_0x3cdbbe][_0x3583dd]['name']));break;case 0x8:if(_0x5babca[_0x7025('0x7')]!==_0x7025('0x9'))_0x10a3d2[_0x38bd2b](util['format'](_0x7025('0x4b'),_0xa7555d[_0x3cdbbe][_0x3583dd]['name']));break;case 0x9:if(_0x5babca[_0x7025('0x7')]!==_0x7025('0x9'))_0x10a3d2[_0x38bd2b](util[_0x7025('0x1e')]('campaign:%s:%s',_0xa7555d[_0x3cdbbe][_0x3583dd][_0x7025('0x1d')],_0xa7555d[_0x3cdbbe][_0x3583dd][_0x7025('0x4')]));break;case 0xa:_0x10a3d2[_0x38bd2b](util[_0x7025('0x1e')]('user:%s',_0xa7555d[_0x3cdbbe][_0x3583dd]['name']));break;}}}}})[_0x7025('0xc')](function(){if(_0x38bd2b===_0x7025('0x4c')){var _0x30a1e9=_[_0x7025('0x1a')](_0x5babca[_0x7025('0x25')],'id');return _0x5babca['removeChatInteractions'](_0x30a1e9)[_0x7025('0xc')](function(){for(var _0x60bc2e=0x0;_0x60bc2e<_0x30a1e9[_0x7025('0x45')];_0x60bc2e+=0x1){_0x1cf43f['emit'](_0x7025('0x4d'),{'ChatInteractionId':Number(_0x30a1e9[_0x60bc2e]),'UserId':Number(_0x5babca['id'])});}});}})['then'](function(){if(_0x38bd2b===_0x7025('0x4c')){var _0x177447=_[_0x7025('0x1a')](_0x5babca[_0x7025('0x27')],'id');return _0x5babca[_0x7025('0x4e')](_0x177447)[_0x7025('0xc')](function(){for(var _0x5008b5=0x0;_0x5008b5<_0x177447['length'];_0x5008b5+=0x1){_0x1cf43f[_0x7025('0x4f')](_0x7025('0x50'),{'MailInteractionId':Number(_0x177447[_0x5008b5]),'UserId':Number(_0x5babca['id'])});}});}})[_0x7025('0xc')](function(){if(_0x38bd2b===_0x7025('0x4c')){var _0x328ad6=_['map'](_0x5babca[_0x7025('0x28')],'id');return _0x5babca['removeFaxInteractions'](_0x328ad6)['then'](function(){for(var _0x3e6062=0x0;_0x3e6062<_0x328ad6[_0x7025('0x45')];_0x3e6062+=0x1){_0x1cf43f[_0x7025('0x4f')](_0x7025('0x51'),{'FaxInteractionId':Number(_0x328ad6[_0x3e6062]),'UserId':Number(_0x5babca['id'])});}});}})[_0x7025('0xc')](function(){if(_0x38bd2b===_0x7025('0x4c')){var _0x25c23d=_[_0x7025('0x1a')](_0x5babca[_0x7025('0x2a')],'id');return _0x5babca[_0x7025('0x52')](_0x25c23d)[_0x7025('0xc')](function(){for(var _0x1d91dc=0x0;_0x1d91dc<_0x25c23d['length'];_0x1d91dc+=0x1){_0x1cf43f[_0x7025('0x4f')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x25c23d[_0x1d91dc]),'UserId':Number(_0x5babca['id'])});}});}})[_0x7025('0xc')](function(){if(_0x38bd2b===_0x7025('0x4c')){var _0xb4dfee=_[_0x7025('0x1a')](_0x5babca[_0x7025('0x2c')],'id');return _0x5babca[_0x7025('0x53')](_0xb4dfee)[_0x7025('0xc')](function(){for(var _0x1bf33b=0x0;_0x1bf33b<_0xb4dfee[_0x7025('0x45')];_0x1bf33b+=0x1){_0x1cf43f['emit'](_0x7025('0x54'),{'OpenchannelInteractionId':Number(_0xb4dfee[_0x1bf33b]),'UserId':Number(_0x5babca['id'])});}});}})['then'](function(){if(_0x38bd2b===_0x7025('0x4c')){var _0x2d9cf5=_['map'](_0x5babca[_0x7025('0x2e')],'id');return _0x5babca[_0x7025('0x55')](_0x2d9cf5)[_0x7025('0xc')](function(){for(var _0x422395=0x0;_0x422395<_0x2d9cf5[_0x7025('0x45')];_0x422395+=0x1){_0x1cf43f[_0x7025('0x4f')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2d9cf5[_0x422395]),'UserId':Number(_0x5babca['id'])});}});}})[_0x7025('0x56')](function(_0x2591d0){_0x10a3d2['log'](_0x2591d0);});}}function onDisconnect(_0x7aa16e,_0xf12c3b){joinOrLeave(_0x7aa16e,_0x7025('0x4c'),_0xf12c3b);}function onConnect(_0x444033){joinOrLeave(_0x444033,_0x7025('0x57'));}exports[_0x7025('0x58')]=function(_0x510e02){_0x510e02['on']('connection',function(_0x858713){_0x858713['setMaxListeners'](0x0);_0x858713['address']=_0x858713[_0x7025('0x59')][_0x7025('0x5a')][_0x7025('0x5b')]+':'+_0x858713[_0x7025('0x59')][_0x7025('0x5a')][_0x7025('0x5c')];_0x858713['connectedAt']=new Date();_0x858713['log']=function(_0x157e69){console[_0x7025('0x5d')](_0x7025('0x5e')+_0x858713[_0x7025('0x5f')][_0x7025('0x4')]+'['+_0x858713[_0x7025('0x60')]+']',_0x157e69);};_0x858713['on']('disconnect',function(){onDisconnect(_0x858713,_0x510e02);_0x858713[_0x7025('0x5d')](_0x7025('0x61'));});onConnect(_0x858713);_0x858713[_0x7025('0x5d')](_0x7025('0x62'));});}; \ No newline at end of file +var _0x3f48=['bluebird','../mysqldb','./environment','name','User','agent','telephone','type','ivr','UserProfileSection','findOne','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','then','map','where','role','Campaign','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:outbound','FaxQueue','OpenchannelQueue','WhatsappQueues','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','address','disconnect','CONNECTED'];(function(_0x2f2a6f,_0xe63e10){var _0x14441d=function(_0x3ab031){while(--_0x3ab031){_0x2f2a6f['push'](_0x2f2a6f['shift']());}};_0x14441d(++_0xe63e10);}(_0x3f48,0x17c));var _0x83f4=function(_0xf5e6a8,_0x5791fc){_0xf5e6a8=_0xf5e6a8-0x0;var _0x5c208f=_0x3f48[_0xf5e6a8];return _0x5c208f;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x83f4('0x0'));var db=require(_0x83f4('0x1'))['db'];var config=require(_0x83f4('0x2'));var queryQueues={'attributes':['id',_0x83f4('0x3')],'include':[{'as':'Agents','model':db[_0x83f4('0x4')],'attributes':['id',_0x83f4('0x3'),'role'],'raw':!![],'where':{'role':_0x83f4('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x83f4('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x83f4('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x83f4('0x3')],'where':{'role':_0x83f4('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x83f4('0x3'),_0x83f4('0x7')],'where':{'type':_0x83f4('0x8')}};function getAssociatedResources(_0x2b8d91,_0x47964e,_0x11a159){return db[_0x83f4('0x9')][_0x83f4('0xa')]({'where':{'name':_0x2b8d91,'userProfileId':_0x47964e},'raw':!![]})['then'](function(_0x4cb8bb){if(_0x4cb8bb){if(_0x4cb8bb['autoAssociation']){switch(_0x2b8d91){case _0x83f4('0xb'):case _0x83f4('0xc'):case _0x83f4('0xd'):case'SmsQueues':case _0x83f4('0xe'):case _0x83f4('0xf'):case'WhatsappQueues':return db[_0x11a159][_0x83f4('0x10')](queryQueues);case _0x83f4('0x11'):return db[_0x11a159][_0x83f4('0x10')](queryTelephones);case _0x83f4('0x12'):return db[_0x11a159][_0x83f4('0x10')](queryTrunks);case _0x83f4('0x13'):return db[_0x11a159][_0x83f4('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0x83f4('0x10')]({'attributes':[_0x83f4('0x14')],'where':{'sectionId':_0x4cb8bb['id']},'raw':!![]})[_0x83f4('0x15')](function(_0x8062f){if(_0x8062f){var _0x38f762={'where':{'id':_[_0x83f4('0x16')](_0x8062f,'resourceId')},'raw':!![]};switch(_0x11a159){case _0x83f4('0x4'):_0x38f762[_0x83f4('0x17')][_0x83f4('0x18')]=_0x83f4('0x6');break;case _0x83f4('0x19'):_0x38f762['where'][_0x83f4('0x7')]='ivr';break;}return db[_0x11a159][_0x83f4('0x10')](_0x38f762);}else{return[];}});}}else{return[];}})[_0x83f4('0x15')](function(_0x411b03){return _0x411b03;});}function joinOrLeaveQueues(_0x250351,_0x30ac1d,_0x9ef4a9,_0x52452b){_0x250351[_0x30ac1d](util[_0x83f4('0x1a')](_0x83f4('0x1b'),_0x9ef4a9,_0x52452b[_0x83f4('0x3')]));if(_0x52452b[_0x83f4('0x1c')]){for(var _0x5bb5f1=0x0;_0x5bb5f1<_0x52452b['Agents'][_0x83f4('0x1d')];_0x5bb5f1+=0x1){_0x250351[_0x30ac1d](util[_0x83f4('0x1a')](_0x83f4('0x1e'),_0x52452b[_0x83f4('0x1c')][_0x5bb5f1]['name']));}}}function joinOrLeave(_0x362b6b,_0x219bd1,_0x4115da){var _0x10c3b8;if(_0x362b6b['handshake'][_0x83f4('0x1f')]['id']){db['User'][_0x83f4('0x20')]({'attributes':['id',_0x83f4('0x3'),_0x83f4('0x18'),_0x83f4('0x21')],'where':{'id':_0x362b6b[_0x83f4('0x22')][_0x83f4('0x1f')]['id']},'include':[{'model':db[_0x83f4('0x23')],'as':_0x83f4('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x83f4('0x25')],'as':_0x83f4('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x83f4('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x83f4('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x83f4('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x83f4('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x83f4('0x15')](function(_0x139913){if(_0x139913){_0x10c3b8=_0x139913;_0x362b6b[_0x219bd1](util['format']('user:%s',_0x139913['name']));var _0x4f0c2=[];switch(_0x139913[_0x83f4('0x18')]){case _0x83f4('0x2b'):_0x362b6b[_0x219bd1](_0x83f4('0x2c'));_0x362b6b[_0x219bd1]('voice:outbound');if(queryQueues[_0x83f4('0x2d')](_0x83f4('0x2e'))){delete queryQueues[_0x83f4('0x2e')];}_0x4f0c2[_0x83f4('0x2f')](db[_0x83f4('0x30')][_0x83f4('0x10')](queryQueues));_0x4f0c2[_0x83f4('0x2f')](db[_0x83f4('0x31')]['findAll'](queryQueues));_0x4f0c2[_0x83f4('0x2f')](db['FaxQueue'][_0x83f4('0x10')](queryQueues));_0x4f0c2['push'](db[_0x83f4('0x32')]['findAll'](queryQueues));_0x4f0c2[_0x83f4('0x2f')](db[_0x83f4('0x33')]['findAll'](queryQueues));_0x4f0c2[_0x83f4('0x2f')](db['OpenchannelQueue'][_0x83f4('0x10')](queryQueues));_0x4f0c2['push'](db[_0x83f4('0x34')]['findAll'](queryQueues));_0x4f0c2[_0x83f4('0x2f')](db[_0x83f4('0x4')][_0x83f4('0x10')](queryTelephones));_0x4f0c2[_0x83f4('0x2f')](db[_0x83f4('0x35')][_0x83f4('0x10')](queryTrunks));_0x4f0c2['push'](db[_0x83f4('0x19')][_0x83f4('0x10')](queryCampaigns));_0x4f0c2[_0x83f4('0x2f')](db[_0x83f4('0x4')][_0x83f4('0x10')](queryAgents));break;case _0x83f4('0x36'):_0x362b6b[_0x219bd1](_0x83f4('0x2c'));_0x362b6b[_0x219bd1](_0x83f4('0x37'));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources(_0x83f4('0xb'),_0x139913[_0x83f4('0x21')],_0x83f4('0x30')));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources(_0x83f4('0xc'),_0x139913[_0x83f4('0x21')],_0x83f4('0x31')));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources(_0x83f4('0xd'),_0x139913[_0x83f4('0x21')],_0x83f4('0x38')));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources('SmsQueues',_0x139913[_0x83f4('0x21')],'SmsQueue'));_0x4f0c2['push'](getAssociatedResources(_0x83f4('0xe'),_0x139913[_0x83f4('0x21')],_0x83f4('0x33')));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources('OpenchannelQueues',_0x139913[_0x83f4('0x21')],_0x83f4('0x39')));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources(_0x83f4('0x3a'),_0x139913['userProfileId'],_0x83f4('0x34')));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources(_0x83f4('0x11'),_0x139913[_0x83f4('0x21')],_0x83f4('0x4')));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources(_0x83f4('0x12'),_0x139913[_0x83f4('0x21')],'Trunk'));_0x4f0c2[_0x83f4('0x2f')](getAssociatedResources(_0x83f4('0x13'),_0x139913['userProfileId'],'Campaign'));_0x4f0c2[_0x83f4('0x2f')](db[_0x83f4('0x4')][_0x83f4('0x10')](queryAgents));break;case _0x83f4('0x5'):_0x362b6b[_0x219bd1](_0x83f4('0x2c'));_0x362b6b[_0x219bd1](_0x83f4('0x37'));_0x4f0c2[_0x83f4('0x2f')](_0x139913[_0x83f4('0x3b')]({'attributes':['id','name']}));_0x4f0c2[_0x83f4('0x2f')](_0x139913['getChatQueues']({'attributes':['id',_0x83f4('0x3')]}));_0x4f0c2[_0x83f4('0x2f')](_0x139913[_0x83f4('0x3c')]({'attributes':['id',_0x83f4('0x3')]}));_0x4f0c2[_0x83f4('0x2f')](_0x139913['getSmsQueues']({'attributes':['id','name']}));_0x4f0c2[_0x83f4('0x2f')](_0x139913[_0x83f4('0x3d')]({'attributes':['id',_0x83f4('0x3')]}));_0x4f0c2[_0x83f4('0x2f')](_0x139913[_0x83f4('0x3e')]({'attributes':['id','name']}));_0x4f0c2[_0x83f4('0x2f')](_0x139913[_0x83f4('0x3f')]({'attributes':['id',_0x83f4('0x3')]}));break;}return BPromise[_0x83f4('0x40')](_0x4f0c2);}})[_0x83f4('0x15')](function(_0x4b9a62){if(_0x4b9a62&&_0x4b9a62[_0x83f4('0x1d')]){for(var _0x252d25=0x0;_0x252d25<_0x4b9a62[_0x83f4('0x1d')];_0x252d25+=0x1){for(var _0x5b2a44=0x0;_0x5b2a44<_0x4b9a62[_0x252d25][_0x83f4('0x1d')];_0x5b2a44+=0x1){switch(_0x252d25){case 0x0:joinOrLeaveQueues(_0x362b6b,_0x219bd1,'voice',_0x4b9a62[_0x252d25][_0x5b2a44]);break;case 0x1:joinOrLeaveQueues(_0x362b6b,_0x219bd1,'chat',_0x4b9a62[_0x252d25][_0x5b2a44]);break;case 0x2:joinOrLeaveQueues(_0x362b6b,_0x219bd1,'fax',_0x4b9a62[_0x252d25][_0x5b2a44]);break;case 0x3:joinOrLeaveQueues(_0x362b6b,_0x219bd1,_0x83f4('0x41'),_0x4b9a62[_0x252d25][_0x5b2a44]);break;case 0x4:joinOrLeaveQueues(_0x362b6b,_0x219bd1,_0x83f4('0x42'),_0x4b9a62[_0x252d25][_0x5b2a44]);break;case 0x5:joinOrLeaveQueues(_0x362b6b,_0x219bd1,_0x83f4('0x43'),_0x4b9a62[_0x252d25][_0x5b2a44]);break;case 0x6:joinOrLeaveQueues(_0x362b6b,_0x219bd1,_0x83f4('0x44'),_0x4b9a62[_0x252d25][_0x5b2a44]);break;case 0x7:if(_0x10c3b8[_0x83f4('0x18')]!==_0x83f4('0x5'))_0x362b6b[_0x219bd1](util[_0x83f4('0x1a')](_0x83f4('0x45'),_0x4b9a62[_0x252d25][_0x5b2a44][_0x83f4('0x3')]));break;case 0x8:if(_0x10c3b8[_0x83f4('0x18')]!==_0x83f4('0x5'))_0x362b6b[_0x219bd1](util['format']('trunk:%s',_0x4b9a62[_0x252d25][_0x5b2a44]['name']));break;case 0x9:if(_0x10c3b8[_0x83f4('0x18')]!==_0x83f4('0x5'))_0x362b6b[_0x219bd1](util[_0x83f4('0x1a')](_0x83f4('0x46'),_0x4b9a62[_0x252d25][_0x5b2a44]['type'],_0x4b9a62[_0x252d25][_0x5b2a44][_0x83f4('0x3')]));break;case 0xa:_0x362b6b[_0x219bd1](util[_0x83f4('0x1a')]('user:%s',_0x4b9a62[_0x252d25][_0x5b2a44]['name']));break;}}}}})[_0x83f4('0x15')](function(){if(_0x219bd1===_0x83f4('0x47')){var _0x5b7926=_[_0x83f4('0x16')](_0x10c3b8[_0x83f4('0x24')],'id');return _0x10c3b8[_0x83f4('0x48')](_0x5b7926)['then'](function(){for(var _0x15242d=0x0;_0x15242d<_0x5b7926[_0x83f4('0x1d')];_0x15242d+=0x1){_0x4115da[_0x83f4('0x49')](_0x83f4('0x4a'),{'ChatInteractionId':Number(_0x5b7926[_0x15242d]),'UserId':Number(_0x10c3b8['id'])});}});}})[_0x83f4('0x15')](function(){if(_0x219bd1===_0x83f4('0x47')){var _0x2bf597=_[_0x83f4('0x16')](_0x10c3b8['MailInteractions'],'id');return _0x10c3b8['removeMailInteractions'](_0x2bf597)[_0x83f4('0x15')](function(){for(var _0x113590=0x0;_0x113590<_0x2bf597[_0x83f4('0x1d')];_0x113590+=0x1){_0x4115da[_0x83f4('0x49')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2bf597[_0x113590]),'UserId':Number(_0x10c3b8['id'])});}});}})[_0x83f4('0x15')](function(){if(_0x219bd1===_0x83f4('0x47')){var _0x49a056=_['map'](_0x10c3b8['FaxInteractions'],'id');return _0x10c3b8[_0x83f4('0x4b')](_0x49a056)[_0x83f4('0x15')](function(){for(var _0x114f9a=0x0;_0x114f9a<_0x49a056[_0x83f4('0x1d')];_0x114f9a+=0x1){_0x4115da[_0x83f4('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x49a056[_0x114f9a]),'UserId':Number(_0x10c3b8['id'])});}});}})[_0x83f4('0x15')](function(){if(_0x219bd1===_0x83f4('0x47')){var _0x23386b=_['map'](_0x10c3b8[_0x83f4('0x4c')],'id');return _0x10c3b8[_0x83f4('0x4d')](_0x23386b)[_0x83f4('0x15')](function(){for(var _0x5f25a1=0x0;_0x5f25a1<_0x23386b['length'];_0x5f25a1+=0x1){_0x4115da[_0x83f4('0x49')](_0x83f4('0x4e'),{'SmsInteractionId':Number(_0x23386b[_0x5f25a1]),'UserId':Number(_0x10c3b8['id'])});}});}})['then'](function(){if(_0x219bd1===_0x83f4('0x47')){var _0x10a088=_[_0x83f4('0x16')](_0x10c3b8['OpenchannelInteractions'],'id');return _0x10c3b8[_0x83f4('0x4f')](_0x10a088)[_0x83f4('0x15')](function(){for(var _0x301292=0x0;_0x301292<_0x10a088['length'];_0x301292+=0x1){_0x4115da[_0x83f4('0x49')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x10a088[_0x301292]),'UserId':Number(_0x10c3b8['id'])});}});}})[_0x83f4('0x15')](function(){if(_0x219bd1===_0x83f4('0x47')){var _0xdaf4ed=_[_0x83f4('0x16')](_0x10c3b8[_0x83f4('0x2a')],'id');return _0x10c3b8[_0x83f4('0x50')](_0xdaf4ed)[_0x83f4('0x15')](function(){for(var _0x28490a=0x0;_0x28490a<_0xdaf4ed[_0x83f4('0x1d')];_0x28490a+=0x1){_0x4115da[_0x83f4('0x49')](_0x83f4('0x51'),{'WhatsappInteractionId':Number(_0xdaf4ed[_0x28490a]),'UserId':Number(_0x10c3b8['id'])});}});}})[_0x83f4('0x52')](function(_0x299b1c){_0x362b6b['log'](_0x299b1c);});}}function onDisconnect(_0x424cea,_0x48f894){joinOrLeave(_0x424cea,'leave',_0x48f894);}function onConnect(_0x1ea2a8){joinOrLeave(_0x1ea2a8,_0x83f4('0x53'));}exports['default']=function(_0x181c01){_0x181c01['on'](_0x83f4('0x54'),function(_0x2ee10c){_0x2ee10c[_0x83f4('0x55')](0x0);_0x2ee10c['address']=_0x2ee10c[_0x83f4('0x56')][_0x83f4('0x54')][_0x83f4('0x57')]+':'+_0x2ee10c[_0x83f4('0x56')][_0x83f4('0x54')][_0x83f4('0x58')];_0x2ee10c[_0x83f4('0x59')]=new Date();_0x2ee10c[_0x83f4('0x5a')]=function(_0x174dbf){console['log'](_0x83f4('0x5b')+_0x2ee10c['nsp'][_0x83f4('0x3')]+'['+_0x2ee10c[_0x83f4('0x5c')]+']',_0x174dbf);};_0x2ee10c['on'](_0x83f4('0x5d'),function(){onDisconnect(_0x2ee10c,_0x181c01);_0x2ee10c[_0x83f4('0x5a')]('DISCONNECTED');});onConnect(_0x2ee10c);_0x2ee10c['log'](_0x83f4('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 118f41b..6104629 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f58=['UserId','format','agent','channel','outgoingmessage','offlineMessage','get','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','contact','interface','SIP/%s','changed','closed','substatus','name','User','find','email','default','length','model','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','code','error','catch','motionChannel','event','resolve','then','ContactId','undefined','sequelize','query','QueryTypes','SELECT'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8f58,0xa6));var _0x88f5=function(_0x4ad52e,_0x696226){_0x4ad52e=_0x4ad52e-0x0;var _0x18ae8b=_0x8f58[_0x4ad52e];return _0x18ae8b;};'use strict';var util=require(_0x88f5('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x88f5('0x1'));var logger=require(_0x88f5('0x2'))(_0x88f5('0x3'));var client=jayson[_0x88f5('0x4')][_0x88f5('0x5')]({'port':0x232a});var triggers=[{'channel':_0x88f5('0x6'),'model':'ChatInteraction','event':_0x88f5('0x7'),'condition':_0x88f5('0x8'),'callback':afterCreate},{'channel':_0x88f5('0x6'),'model':_0x88f5('0x9'),'event':_0x88f5('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x88f5('0x6'),'model':_0x88f5('0xb'),'event':'afterCreate','condition':_0x88f5('0xc'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x88f5('0xd'),'event':'afterCreate','condition':_0x88f5('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x88f5('0xe'),'model':_0x88f5('0xf'),'event':_0x88f5('0x7'),'condition':_0x88f5('0x8'),'callback':afterCreate},{'channel':_0x88f5('0xe'),'model':_0x88f5('0xf'),'event':_0x88f5('0xa'),'condition':_0x88f5('0x10'),'callback':afterUpdate},{'channel':_0x88f5('0xe'),'model':_0x88f5('0x11'),'event':_0x88f5('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x88f5('0x12'),'model':_0x88f5('0x13'),'event':_0x88f5('0x7'),'condition':_0x88f5('0x8'),'callback':afterCreate},{'channel':_0x88f5('0x12'),'model':_0x88f5('0x13'),'event':_0x88f5('0xa'),'condition':_0x88f5('0x10'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x88f5('0x14'),'event':_0x88f5('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x88f5('0x15'),'model':_0x88f5('0x16'),'event':_0x88f5('0x7'),'condition':_0x88f5('0x8'),'callback':afterCreate},{'channel':'Fax','model':_0x88f5('0x16'),'event':_0x88f5('0xa'),'condition':_0x88f5('0x10'),'callback':afterUpdate},{'channel':_0x88f5('0x15'),'model':_0x88f5('0x17'),'event':_0x88f5('0x7'),'condition':_0x88f5('0xc'),'callback':afterCreateMessage},{'channel':_0x88f5('0x18'),'model':_0x88f5('0x19'),'event':'afterCreate','condition':_0x88f5('0x8'),'callback':afterCreate},{'channel':_0x88f5('0x18'),'model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x88f5('0x18'),'model':_0x88f5('0x1a'),'event':_0x88f5('0x7'),'condition':_0x88f5('0xc'),'callback':afterCreateMessage},{'channel':_0x88f5('0x1b'),'model':_0x88f5('0x1c'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x88f5('0x1b'),'model':'OpenchannelInteraction','event':_0x88f5('0xa'),'condition':_0x88f5('0x10'),'callback':afterUpdate},{'channel':_0x88f5('0x1b'),'model':_0x88f5('0x1d'),'event':_0x88f5('0x7'),'condition':_0x88f5('0xc'),'callback':afterCreateMessage}];function request(_0x1aebdb){return client[_0x88f5('0x1e')](_0x88f5('0x1f'),_0x1aebdb)['then'](function(_0x55ca2b){logger[_0x88f5('0x20')](_0x88f5('0x21'),_0x88f5('0x1f'),_0x55ca2b);if(_0x55ca2b['error']){if(_0x55ca2b['error'][_0x88f5('0x22')]===0x1f4){logger[_0x88f5('0x23')]('Trigger,\x20%s',_0x88f5('0x1f'),_0x55ca2b[_0x88f5('0x23')]);}}})[_0x88f5('0x24')](function(_0x19c7cd){logger[_0x88f5('0x23')](_0x88f5('0x21'),_0x88f5('0x1f'),_0x19c7cd);});}function afterCreateMessage(_0x1d84e6){return function(_0x31c966){_0x31c966=_0x31c966['get']({'plain':!![]});_0x31c966['channel']=_0x1d84e6;_0x31c966[_0x88f5('0x25')]=_0x1d84e6;_0x31c966[_0x88f5('0x26')]=_0x31c966['direction'];Promise[_0x88f5('0x27')]()[_0x88f5('0x28')](function(){if(typeof _0x31c966[_0x88f5('0x29')]===_0x88f5('0x2a'))return null;var _0x3d6f01='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31c966[_0x88f5('0x29')];return db[_0x88f5('0x2b')][_0x88f5('0x2c')](_0x3d6f01,{'type':db['Sequelize'][_0x88f5('0x2d')][_0x88f5('0x2e')],'raw':!![]});})['then'](function(_0x445d63){if(_0x445d63){_0x31c966['contact']=_0x445d63[0x0];}if(typeof _0x31c966[_0x88f5('0x2f')]===_0x88f5('0x2a'))return;return getAgent(_0x31c966[_0x88f5('0x2f')]);})['then'](function(_0x10dd60){if(_0x10dd60){_0x31c966['interface']=util[_0x88f5('0x30')]('SIP/%s',_0x10dd60['name']);_0x31c966[_0x88f5('0x31')]=_0x10dd60;_0x31c966[_0x88f5('0x32')]=_0x1d84e6;return request({'event':'incomingmessage','message':_0x31c966});}else{return request({'event':_0x88f5('0x33'),'message':_0x31c966});}})[_0x88f5('0x24')](function(_0x118c59){logger[_0x88f5('0x23')](_0x88f5('0x21'),'AfterCreateMessage',_0x118c59);});};}function afterCreateOfflineMessage(_0x451c55){return function(_0x4108c8){_0x4108c8=_0x4108c8['get']({'plain':!![]});_0x4108c8['channel']=_0x451c55;_0x4108c8[_0x88f5('0x25')]=_0x451c55;_0x4108c8[_0x88f5('0x26')]=_0x88f5('0x34');return request({'event':_0x4108c8[_0x88f5('0x26')],'message':_0x4108c8});};}function afterCreate(_0x39db16,_0x4c78e7){return function(_0xdd88be){_0xdd88be=_0xdd88be[_0x88f5('0x35')]({'plain':!![]});_0xdd88be['channel']=_0x39db16;_0xdd88be['motionChannel']=_0x39db16;_0xdd88be[_0x88f5('0x26')]='opened';Promise[_0x88f5('0x27')]()['then'](function(){var _0x19b4af=_0x88f5('0x36')+_0xdd88be[_0x88f5('0x29')];return db[_0x88f5('0x2b')][_0x88f5('0x2c')](_0x19b4af,{'type':db[_0x88f5('0x37')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x88f5('0x28')](function(_0x4dc852){if(_0x4dc852){_0xdd88be[_0x88f5('0x38')]=_0x4dc852[0x0];}if(typeof _0xdd88be[_0x88f5('0x2f')]===_0x88f5('0x2a'))return;return getAgent(_0xdd88be[_0x88f5('0x2f')]);})[_0x88f5('0x28')](function(_0x16bb4c){if(_0x16bb4c){_0xdd88be[_0x88f5('0x39')]=util[_0x88f5('0x30')](_0x88f5('0x3a'),_0x16bb4c['name']);_0xdd88be['agent']=_0x16bb4c;}return request({'event':_0x4c78e7,'message':_0xdd88be});})[_0x88f5('0x24')](function(_0x5cb4d4){logger[_0x88f5('0x23')](_0x88f5('0x21'),'AfterCreate',_0x5cb4d4);});};}function afterUpdate(_0x58cb73){return function(_0x457b6c){var _0x14b1b8=_0x457b6c[_0x88f5('0x3b')](_0x88f5('0x3c'))&&_0x457b6c[_0x88f5('0x3c')];var _0x5453fc=_0x457b6c[_0x88f5('0x3b')](_0x88f5('0x3d'));if(_0x14b1b8||_0x5453fc){var _0x36e572=_0x14b1b8?'closedinteraction':'substatus';var _0x3a4767=_0x457b6c[_0x88f5('0x35')]({'plain':!![]});_0x3a4767[_0x88f5('0x32')]=_0x58cb73;_0x3a4767['motionChannel']=_0x58cb73;_0x3a4767[_0x88f5('0x26')]=_0x14b1b8?_0x88f5('0x3c'):_0x88f5('0x3d');var _0x104fad=_0x88f5('0x36')+_0x3a4767[_0x88f5('0x29')];return db['sequelize'][_0x88f5('0x2c')](_0x104fad,{'type':db[_0x88f5('0x37')][_0x88f5('0x2d')]['SELECT'],'raw':!![]})['then'](function(_0x115c95){if(_0x115c95){_0x3a4767[_0x88f5('0x38')]=_0x115c95[0x0];}if(typeof _0x3a4767[_0x88f5('0x2f')]===_0x88f5('0x2a'))return;return getAgent(_0x3a4767[_0x88f5('0x2f')]);})[_0x88f5('0x28')](function(_0x1a466e){if(_0x1a466e){_0x3a4767[_0x88f5('0x39')]=util[_0x88f5('0x30')](_0x88f5('0x3a'),_0x1a466e[_0x88f5('0x3e')]);_0x3a4767[_0x88f5('0x31')]=_0x1a466e;}return request({'event':_0x36e572,'message':_0x3a4767});})[_0x88f5('0x24')](function(_0x241444){logger[_0x88f5('0x23')](_0x88f5('0x21'),'AfterUpdate',_0x241444);});}};}function getAgent(_0x8bc807){return db[_0x88f5('0x3f')][_0x88f5('0x40')]({'where':{'id':_0x8bc807},'attributes':['id',_0x88f5('0x3e'),'fullname',_0x88f5('0x41'),'internal'],'raw':!![]})[_0x88f5('0x28')](function(_0x241ec1){return _0x241ec1;});}exports[_0x88f5('0x42')]=function(){for(var _0x1f4d61=0x0;_0x1f4d61=_0x4ddea2[_0xc47a('0xd')]){throw Error(_0xc47a('0xe'));}_0x15b184(_0x55a3ec);})[_0xc47a('0xf')](function(_0x5637ba){_0x1f4fec(_0x5637ba);});});}; \ No newline at end of file +var _0x272c=['role','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','openchannel','getChannels','clearBlockUser','updateAttributes','getLicense'];(function(_0x2f73e0,_0x42c60b){var _0x228a3b=function(_0x273ea7){while(--_0x273ea7){_0x2f73e0['push'](_0x2f73e0['shift']());}};_0x228a3b(++_0x42c60b);}(_0x272c,0x6b));var _0xc272=function(_0x3861a1,_0x3d6d1e){_0x3861a1=_0x3861a1-0x0;var _0x54d8dd=_0x272c[_0x3861a1];return _0x54d8dd;};'use strict';var _=require(_0xc272('0x0'));var BPromise=require(_0xc272('0x1'));var db=require(_0xc272('0x2'))['db'];var util=require(_0xc272('0x3'));var channels=[_0xc272('0x4'),_0xc272('0x5'),_0xc272('0x6'),_0xc272('0x7'),'sms','whatsapp',_0xc272('0x8')];exports[_0xc272('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x28a34a){_0x28a34a=_0x28a34a['toLowerCase']();return _['includes'](channels,_0x28a34a);};exports[_0xc272('0xa')]=function(_0x1117c4,_0x52ba91,_0x321426,_0x27379a){var _0x50fd79={'loginAttempts':_0x52ba91,'blocked':_0x321426};if(!_['isUndefined'](_0x27379a)){_0x50fd79['blockedAt']=_0x27379a;}return _0x1117c4[_0xc272('0xb')](_0x50fd79);};exports[_0xc272('0xc')]=function(_0x51b452){return new BPromise(function(_0x57ab44,_0x16600f){var _0x2b48bb=0x0;if(_0x51b452[_0xc272('0xd')]!==_0xc272('0xe')){_0x57ab44(_0x51b452);}db[_0xc272('0xf')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x51b452['id']}}})[_0xc272('0x10')](function(_0x1caf9a){_0x2b48bb=_0x1caf9a;return util[_0xc272('0xc')]();})[_0xc272('0x10')](function(_0x3a4cf8){if(_0x3a4cf8&&_0x3a4cf8[_0xc272('0x11')]&&_0x2b48bb>=_0x3a4cf8['agents']){throw Error(_0xc272('0x12'));}_0x57ab44(_0x51b452);})[_0xc272('0x13')](function(_0x2773dd){_0x16600f(_0x2773dd);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index efa7958..58e4125 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['send','exports','util','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','status'];(function(_0x36d5d5,_0x1c1590){var _0x4eaa56=function(_0x56fa0e){while(--_0x56fa0e){_0x36d5d5['push'](_0x36d5d5['shift']());}};_0x4eaa56(++_0x1c1590);}(_0xdace,0xc5));var _0xedac=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0xdace[_0xb8cfbe];return _0x227d51;};'use strict';var util=require(_0xedac('0x0'));var logger=require('../config/logger')(_0xedac('0x1'));var APIError=function(_0x13adb5,_0x46eba0){this['message']=_0x13adb5||_0xedac('0x2');this[_0xedac('0x3')]=_0x46eba0||_0xedac('0x4');util[_0xedac('0x5')](APIError,Error);};var APIBadRequestError=function(_0x5a97c0){this[_0xedac('0x6')]=_0x5a97c0||_0xedac('0x7');this[_0xedac('0x3')]='Bad\x20Request';util[_0xedac('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x21440e){this[_0xedac('0x6')]=_0x21440e||'Entity\x20not\x20found';this[_0xedac('0x3')]=_0xedac('0x8');util[_0xedac('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x4af030){switch(_0x4af030){case'Bad\x20Request':return 0x190;case _0xedac('0x9'),_0xedac('0xa'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d6a29){return function(_0x4db2ad){logger[_0xedac('0xb')](_0x4db2ad['stack']);var _0x261401=getStatusCode(_0x4db2ad['name']);if(_0x4db2ad[_0xedac('0x3')])delete _0x4db2ad[_0xedac('0x3')];return _0x4d6a29[_0xedac('0xc')](_0x261401)[_0xedac('0xd')](_0x4db2ad);};}module[_0xedac('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xcb91=['Not\x20Found','error','stack','send','exports','api','message','name','Error','Bad\x20Request','Forbidden','OutOfInterval'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xcb91[_0x3430aa];return _0x2ac5c;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x1cb9('0x0'));var APIError=function(_0xe4a5bf,_0x17d4ec){this[_0x1cb9('0x1')]=_0xe4a5bf||'Internal\x20Server\x20Error';this[_0x1cb9('0x2')]=_0x17d4ec||_0x1cb9('0x3');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x13d5fd){this[_0x1cb9('0x1')]=_0x13d5fd||'Bad\x20Request';this[_0x1cb9('0x2')]=_0x1cb9('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x38737d){this[_0x1cb9('0x1')]=_0x38737d||'Entity\x20not\x20found';this[_0x1cb9('0x2')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x45a12f){switch(_0x45a12f){case _0x1cb9('0x4'):return 0x190;case _0x1cb9('0x5'),_0x1cb9('0x6'):return 0x193;case _0x1cb9('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x50ce71){return function(_0x9b58f1){logger[_0x1cb9('0x8')](_0x9b58f1[_0x1cb9('0x9')]);var _0x3fdd83=getStatusCode(_0x9b58f1[_0x1cb9('0x2')]);if(_0x9b58f1['name'])delete _0x9b58f1['name'];return _0x50ce71['status'](_0x3fdd83)[_0x1cb9('0xa')](_0x9b58f1);};}module[_0x1cb9('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7d753c4..390c4ab 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde2c=['render','send','exports','404','status'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0xde2c,0x7f));var _0xcde2=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0xde2c[_0x25fc41];return _0x1371d1;};'use strict';module[_0xcde2('0x0')][0x194]=function pageNotFound(_0x2030db,_0x2f5f10){var _0x1a777c=_0xcde2('0x1');var _0x40fa0a=0x194;var _0x33bb0c={'status':_0x40fa0a};_0x2f5f10[_0xcde2('0x2')](_0x33bb0c['status']);_0x2f5f10[_0xcde2('0x3')](_0x1a777c,{},function(_0x196898,_0x141f4b){if(_0x196898){return _0x2f5f10[_0xcde2('0x2')](_0x33bb0c[_0xcde2('0x2')])['json'](_0x33bb0c);}_0x2f5f10[_0xcde2('0x4')](_0x141f4b);});}; \ No newline at end of file +var _0x6a21=['404','status','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a21,0xf9));var _0x16a2=function(_0x89ec21,_0x5265e4){_0x89ec21=_0x89ec21-0x0;var _0xff910f=_0x6a21[_0x89ec21];return _0xff910f;};'use strict';module['exports'][0x194]=function pageNotFound(_0x374a65,_0x176bf0){var _0x58fa6e=_0x16a2('0x0');var _0x2d450c=0x194;var _0x54db00={'status':_0x2d450c};_0x176bf0[_0x16a2('0x1')](_0x54db00[_0x16a2('0x1')]);_0x176bf0['render'](_0x58fa6e,{},function(_0x4c40eb,_0x66fced){if(_0x4c40eb){return _0x176bf0[_0x16a2('0x1')](_0x54db00['status'])[_0x16a2('0x2')](_0x54db00);}_0x176bf0['send'](_0x66fced);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a0b0763..c32acea 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x465f=['../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','userSetting','UserId','Recordings','hasMany','VoiceQueuesRt','VoiceExtension','Extensions','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','TeamVoiceQueue','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','MailAccountId','CloudProvider','restrict','CloudProviderId','Smtp','Dispositions','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','Teams','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','TagId','ContactId','DashboardItem','Items','FaxAccountId','Answers','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','Disposition','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','Applications','OpenchannelQueueId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','ChatMessage','Agent','Queue','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Website','Contacts','CompanyId','Phones','CmContactId','CmCompany','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Condition','All','OneAll','Any','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','ItemType','ItemTypeId','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','Description','SubjectId','Field','VariableId','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Field','FromId','ToId','SessionId','SmsQueueReport','ProjectId','VoiceQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','utf8','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField'];(function(_0x122939,_0x1c4aa1){var _0x45aa88=function(_0x4d9f18){while(--_0x4d9f18){_0x122939['push'](_0x122939['shift']());}};_0x45aa88(++_0x1c4aa1);}(_0x465f,0x160));var _0xf465=function(_0x2137bb,_0x31ee30){_0x2137bb=_0x2137bb-0x0;var _0x176db1=_0x465f[_0x2137bb];return _0x176db1;};'use strict';var config=require(_0xf465('0x0'));var Sequelize=require(_0xf465('0x1'));var _=require(_0xf465('0x2'));var jstz=require(_0xf465('0x3'));var timezone=jstz[_0xf465('0x4')]();config[_0xf465('0x1')]=_[_0xf465('0x5')](config[_0xf465('0x1')],{'database':_0xf465('0x6'),'username':_0xf465('0x7'),'password':_0xf465('0x8'),'options':{'host':_0xf465('0x9'),'port':0xcea,'dialect':_0xf465('0xa'),'dialectOptions':{'charset':_0xf465('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xf465('0xc')}}});config[_0xf465('0xd')]=_['defaultsDeep'](config[_0xf465('0xd')],{'database':_0xf465('0x6'),'username':'xcall','password':_0xf465('0x8'),'options':{'host':_0xf465('0x9'),'port':0xcea,'dialect':_0xf465('0xa'),'dialectOptions':{'charset':_0xf465('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xf465('0xe'),'collate':_0xf465('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf465('0x1')]['database'],config[_0xf465('0x1')][_0xf465('0xf')],config['sequelize']['password'],config[_0xf465('0x1')][_0xf465('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0xf465('0xd')][_0xf465('0xf')],config[_0xf465('0xd')][_0xf465('0x11')],config[_0xf465('0xd')]['options'])};db[_0xf465('0x12')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x14'));db[_0xf465('0x15')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x16'));db[_0xf465('0x17')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x18'));db['VoiceExtension']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x19'));db[_0xf465('0x1a')]=db[_0xf465('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xf465('0x1b')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xf465('0x1c')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x1d'));db['ScreenRecording']=db['sequelize'][_0xf465('0x13')]('../api/screenRecording/screenRecording.model');db[_0xf465('0x1e')]=db['sequelize'][_0xf465('0x13')]('../api/voiceMail/voiceMail.model');db[_0xf465('0x1f')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xf465('0x20')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x21'));db['VoiceDialReport']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x22'));db[_0xf465('0x23')]=db[_0xf465('0x1')]['import'](_0xf465('0x24'));db[_0xf465('0x25')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x26'));db[_0xf465('0x27')]=db['sequelize'][_0xf465('0x13')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0xf465('0x13')](_0xf465('0x28'));db[_0xf465('0x29')]=db['sequelize']['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0xf465('0x2a')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x2b'));db[_0xf465('0x2c')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x2d'));db[_0xf465('0x2e')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x2f'));db[_0xf465('0x30')]=db[_0xf465('0x1')]['import'](_0xf465('0x31'));db[_0xf465('0x32')]=db[_0xf465('0x1')]['import'](_0xf465('0x33'));db[_0xf465('0x34')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x35'));db['UserOpenchannelQueue']=db['sequelize'][_0xf465('0x13')](_0xf465('0x36'));db[_0xf465('0x37')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x38'));db[_0xf465('0x39')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x3a'));db[_0xf465('0x3b')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x3c'));db[_0xf465('0x3d')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x3e'));db[_0xf465('0x3f')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x40'));db['MailSubstatus']=db['sequelize'][_0xf465('0x13')]('../api/mailSubstatus/mailSubstatus.model');db[_0xf465('0x41')]=db['sequelize'][_0xf465('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xf465('0x42')]=db[_0xf465('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0xf465('0x43')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x44'));db[_0xf465('0x45')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x46'));db['Dashboard']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x47'));db['DashboardItem']=db[_0xf465('0x1')][_0xf465('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0xf465('0x48')]=db[_0xf465('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0xf465('0x49')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x4a'));db[_0xf465('0x4b')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x4c'));db['FaxMessage']=db[_0xf465('0x1')]['import'](_0xf465('0x4d'));db[_0xf465('0x4e')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x4f'));db['FaxQueueReport']=db[_0xf465('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0xf465('0x50')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x51'));db[_0xf465('0x52')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x53'));db['SmsInteraction']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x54'));db['SmsMessage']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x55'));db[_0xf465('0x56')]=db[_0xf465('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0xf465('0x57')]=db[_0xf465('0x1')]['import'](_0xf465('0x58'));db[_0xf465('0x59')]=db['sequelize'][_0xf465('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0xf465('0x5a')]=db[_0xf465('0x1')]['import'](_0xf465('0x5b'));db['OpenchannelMessage']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x5c'));db['OpenchannelQueue']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x5d'));db[_0xf465('0x5e')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x5f'));db[_0xf465('0x60')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x61'));db[_0xf465('0x62')]=db['sequelize'][_0xf465('0x13')]('../api/chatApplication/chatApplication.model');db[_0xf465('0x63')]=db['sequelize']['import'](_0xf465('0x64'));db['ChatMessage']=db[_0xf465('0x1')]['import'](_0xf465('0x65'));db[_0xf465('0x66')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x67'));db[_0xf465('0x68')]=db[_0xf465('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0xf465('0x69')]=db[_0xf465('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0xf465('0x6a')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x6b'));db['CmCompany']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x6c'));db[_0xf465('0x6d')]=db[_0xf465('0x1')]['import'](_0xf465('0x6e'));db[_0xf465('0x6f')]=db['sequelize'][_0xf465('0x13')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x70'));db['CmHopperFinal']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x71'));db['CmHopperHistory']=db[_0xf465('0x1')]['import'](_0xf465('0x72'));db['ReportAgentPreview']=db['sequelize']['import'](_0xf465('0x73'));db[_0xf465('0x74')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xf465('0x75')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x76'));db[_0xf465('0x77')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/automation/automation.model');db[_0xf465('0x78')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x79'));db['Disposition']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x7a'));db['Condition']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x7b'));db[_0xf465('0x7c')]=db['sequelize'][_0xf465('0x13')]('../api/interval/interval.model');db[_0xf465('0x7d')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x7e'));db[_0xf465('0x7f')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x80'));db[_0xf465('0x81')]=db[_0xf465('0x1')]['import'](_0xf465('0x82'));db[_0xf465('0x83')]=db['sequelize']['import'](_0xf465('0x84'));db[_0xf465('0x85')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x86'));db[_0xf465('0x87')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/tag/tag.model');db[_0xf465('0x88')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/contactItemType/contactItemType.model');db[_0xf465('0x89')]=db[_0xf465('0x1')]['import'](_0xf465('0x8a'));db['CmHopperAdditionalPhone']=db['sequelize'][_0xf465('0x13')](_0xf465('0x8b'));db[_0xf465('0x8c')]=db['sequelize'][_0xf465('0x13')]('../api/template/template.model');db['Trigger']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x8d'));db[_0xf465('0x8e')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x8f'));db[_0xf465('0x90')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x91'));db[_0xf465('0x92')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x93'));db[_0xf465('0x94')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x95'));db[_0xf465('0x96')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x97'));db[_0xf465('0x98')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x99'));db['AnalyticMetric']=db[_0xf465('0x1')]['import'](_0xf465('0x9a'));db['AnalyticFieldReport']=db['sequelize']['import'](_0xf465('0x9b'));db[_0xf465('0x9c')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x9d'));db[_0xf465('0x9e')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x9f'));db[_0xf465('0xa0')]=db['sequelize'][_0xf465('0x13')](_0xf465('0xa1'));db[_0xf465('0xa2')]=db['sequelize'][_0xf465('0x13')](_0xf465('0xa3'));db[_0xf465('0xa4')]=db['sequelize'][_0xf465('0x13')](_0xf465('0xa5'));db[_0xf465('0xa6')]=db[_0xf465('0x1')]['import'](_0xf465('0xa7'));db[_0xf465('0xa8')]=db['sequelize'][_0xf465('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xf465('0xa9')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xaa'));db[_0xf465('0xab')]=db[_0xf465('0x1')]['import'](_0xf465('0xac'));db[_0xf465('0xad')]=db[_0xf465('0x1')]['import'](_0xf465('0xae'));db[_0xf465('0xaf')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0xf465('0xb0')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xb1'));db['ZohoField']=db['sequelize']['import'](_0xf465('0xb2'));db[_0xf465('0xb3')]=db['sequelize'][_0xf465('0x13')](_0xf465('0xb4'));db[_0xf465('0xb5')]=db[_0xf465('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xf465('0xb6')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xb7'));db[_0xf465('0xb8')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xb9'));db['FreshdeskConfiguration']=db[_0xf465('0x1')]['import'](_0xf465('0xba'));db[_0xf465('0xbb')]=db[_0xf465('0x1')]['import'](_0xf465('0xbc'));db[_0xf465('0xbd')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xbe'));db['VtigerConfiguration']=db['sequelize'][_0xf465('0x13')](_0xf465('0xbf'));db[_0xf465('0xc0')]=db['sequelize'][_0xf465('0x13')](_0xf465('0xc1'));db[_0xf465('0xc2')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xc3'));db[_0xf465('0xc4')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xc5'));db[_0xf465('0xc6')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xc7'));db[_0xf465('0xc8')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xc9'));db[_0xf465('0xca')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xcb'));db['Dynamics365Field']=db[_0xf465('0x1')]['import'](_0xf465('0xcc'));db[_0xf465('0xcd')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xce'));db[_0xf465('0xcf')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xd0'));db[_0xf465('0xd1')]=db['sequelize'][_0xf465('0x13')](_0xf465('0xd2'));db[_0xf465('0x90')]=db['sequelize'][_0xf465('0x13')]('../api/integration/integration.model');db[_0xf465('0xd3')]=db['sequelize']['import'](_0xf465('0xd4'));db[_0xf465('0xd5')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xd6'));db['ChatInternalMessage']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xd7'));db[_0xf465('0xd8')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xd9'));db['JscriptyQuestionReport']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xda'));db[_0xf465('0xdb')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xdc'));db['SmsQueueReport']=db['sequelize'][_0xf465('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0xf465('0xdd')]=db[_0xf465('0x1')]['import'](_0xf465('0xde'));db[_0xf465('0xdf')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xe0'));db[_0xf465('0xe1')]=db[_0xf465('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0xf465('0xe2')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/setting/setting.model');db[_0xf465('0xe3')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0xf465('0xe4')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xe5'));db[_0xf465('0xe6')]=db['sequelize']['import'](_0xf465('0xe7'));db['SquareMessage']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xe8'));db[_0xf465('0xe9')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/team/team.model');db['License']=db[_0xf465('0x1')]['import'](_0xf465('0xea'));db[_0xf465('0xeb')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xec'));db[_0xf465('0xed')]=db[_0xf465('0x1')]['import'](_0xf465('0xee'));db[_0xf465('0xef')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xf0'));db[_0xf465('0xf1')]=db[_0xf465('0x1')]['import'](_0xf465('0xf2'));db[_0xf465('0xf3')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xf4'));db[_0xf465('0xf5')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xf6'));db[_0xf465('0xf7')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xf465('0xf8')]=db[_0xf465('0x1')][_0xf465('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xf465('0x1')][_0xf465('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0xf465('0xf9')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0xf465('0xfa')]=db[_0xf465('0x1')]['import'](_0xf465('0xfb'));db[_0xf465('0xfc')]=db['sequelize'][_0xf465('0x13')](_0xf465('0xfd'));db[_0xf465('0xfe')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0xff'));db[_0xf465('0x100')]=db[_0xf465('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x101'));db[_0xf465('0x102')]=db[_0xf465('0x1')]['import'](_0xf465('0x103'));db[_0xf465('0x104')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x105'));db[_0xf465('0x106')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x107'));db[_0xf465('0x108')]=db[_0xf465('0x1')]['import'](_0xf465('0x109'));db['WhatsappQueueReport']=db[_0xf465('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xf465('0x10a')]=db['sequelize'][_0xf465('0x13')](_0xf465('0x10b'));db[_0xf465('0x10c')]=db[_0xf465('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0xf465('0x13')](_0xf465('0x10d'));db['TeamVoiceQueue']=db[_0xf465('0x1')][_0xf465('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xf465('0x10e')]=db[_0xf465('0x1')]['import'](_0xf465('0x10f'));db[_0xf465('0x110')]=db[_0xf465('0x1')][_0xf465('0x13')](_0xf465('0x111'));db[_0xf465('0x112')]=db['sequelize']['import'](_0xf465('0x113'));db[_0xf465('0x12')][_0xf465('0x114')](db[_0xf465('0x1e')],{'as':_0xf465('0x1e'),'onDelete':_0xf465('0x115'),'foreignKey':'UserId'});db[_0xf465('0x12')][_0xf465('0x114')](db[_0xf465('0x112')],{'as':_0xf465('0x116'),'onDelete':'cascade','foreignKey':_0xf465('0x117')});db[_0xf465('0x12')]['hasMany'](db[_0xf465('0x1c')],{'as':_0xf465('0x118'),'foreignKey':'UserId'});db['User'][_0xf465('0x119')](db[_0xf465('0x2a')],{'as':_0xf465('0x11a'),'foreignKey':_0xf465('0x117')});db['User'][_0xf465('0x119')](db[_0xf465('0x11b')],{'as':_0xf465('0x11c'),'onDelete':_0xf465('0x115'),'hooks':!![]});db[_0xf465('0x12')][_0xf465('0x119')](db[_0xf465('0x11d')],{'as':_0xf465('0x11e'),'foreignKey':'UserId'});db[_0xf465('0x12')][_0xf465('0x119')](db[_0xf465('0x11f')],{'as':_0xf465('0x120'),'foreignKey':_0xf465('0x117')});db[_0xf465('0x12')]['hasMany'](db[_0xf465('0x121')],{'as':_0xf465('0x121'),'foreignKey':'UserId'});db[_0xf465('0x12')]['hasMany'](db[_0xf465('0x5a')],{'as':_0xf465('0x122'),'foreignKey':'UserId'});db['User'][_0xf465('0x119')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xf465('0x117')});db[_0xf465('0x12')][_0xf465('0x119')](db[_0xf465('0x123')],{'as':'SmsInteractions','foreignKey':_0xf465('0x117')});db[_0xf465('0x12')][_0xf465('0x119')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0xf465('0x117')});db[_0xf465('0x12')][_0xf465('0x119')](db['MailInteraction'],{'as':_0xf465('0x124'),'foreignKey':'UserId'});db[_0xf465('0x12')][_0xf465('0x119')](db[_0xf465('0x106')],{'as':_0xf465('0x125'),'foreignKey':'UserId'});db[_0xf465('0x12')][_0xf465('0x119')](db[_0xf465('0x126')],{'as':_0xf465('0x127'),'foreignKey':'SenderId'});db[_0xf465('0x12')][_0xf465('0x128')](db[_0xf465('0xfc')],{'as':'UserProfile','foreignKey':_0xf465('0x129')});db['User']['belongsToMany'](db[_0xf465('0x69')],{'as':_0xf465('0x12a'),'through':_0xf465('0x12b')});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x6d')],{'as':'Contacts','through':_0xf465('0x12d')});db['User'][_0xf465('0x12c')](db[_0xf465('0xf9')],{'as':_0xf465('0x12e'),'through':_0xf465('0x12f')});db[_0xf465('0x12')][_0xf465('0x12c')](db['Team'],{'through':_0xf465('0x130')});db[_0xf465('0x12')]['belongsToMany'](db['MailInteraction'],{'as':_0xf465('0x124'),'through':_0xf465('0x131')});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x63')],{'as':_0xf465('0x132'),'through':_0xf465('0x133')});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x4b')],{'as':_0xf465('0x134'),'through':_0xf465('0x135')});db[_0xf465('0x12')]['belongsToMany'](db[_0xf465('0x123')],{'as':_0xf465('0x136'),'through':_0xf465('0x137')});db[_0xf465('0x12')]['belongsToMany'](db[_0xf465('0x5a')],{'as':_0xf465('0x122'),'through':_0xf465('0x138')});db['User']['belongsToMany'](db[_0xf465('0x106')],{'as':_0xf465('0x125'),'through':_0xf465('0x139')});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x1b')],{'as':'VoiceQueues','through':_0xf465('0x2c'),'required':![]});db[_0xf465('0x12')][_0xf465('0x12c')](db['VoicePrefix'],{'as':_0xf465('0x13a'),'through':'UserVoicePrefix','required':![]});db['User']['belongsToMany'](db[_0xf465('0x3f')],{'as':_0xf465('0x13b'),'through':_0xf465('0x30'),'required':![]});db[_0xf465('0x12')]['belongsToMany'](db[_0xf465('0x68')],{'as':_0xf465('0x13c'),'through':_0xf465('0x2e'),'required':![],'hooks':!![]});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x4e')],{'as':_0xf465('0x13d'),'through':_0xf465('0x32'),'required':![]});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x56')],{'as':'SmsQueues','through':_0xf465('0x34'),'required':![]});db[_0xf465('0x12')]['belongsToMany'](db[_0xf465('0x13e')],{'as':_0xf465('0x13f'),'through':_0xf465('0x140'),'required':![]});db[_0xf465('0x12')][_0xf465('0x12c')](db['WhatsappQueue'],{'as':_0xf465('0x141'),'through':_0xf465('0x37'),'required':![]});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0xf9')],{'through':_0xf465('0x12f')});db['User'][_0xf465('0x12c')](db[_0xf465('0x5e')],{'as':_0xf465('0x142'),'through':_0xf465('0x143')});db['User'][_0xf465('0x12c')](db['FaxAccount'],{'as':_0xf465('0x144'),'through':_0xf465('0x145')});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x3d')],{'as':'MailAccounts','through':_0xf465('0x146')});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x57')],{'as':'OpenchannelAccounts','through':_0xf465('0x147')});db[_0xf465('0x12')][_0xf465('0x12c')](db['SmsAccount'],{'as':'SmsAccounts','through':_0xf465('0x148')});db[_0xf465('0x12')][_0xf465('0x12c')](db[_0xf465('0x102')],{'as':_0xf465('0x149'),'through':'user_has_whatsapp_accounts'});db['VoiceChanSpy'][_0xf465('0x119')](db[_0xf465('0x11b')],{'as':_0xf465('0x14a'),'onDelete':_0xf465('0x115'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0xf465('0x119')](db['VoiceExtension'],{'onDelete':_0xf465('0x115')});db[_0xf465('0x11b')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0xf465('0x115')});db[_0xf465('0x1a')][_0xf465('0x12c')](db[_0xf465('0x85')],{'as':'Sounds','through':_0xf465('0x14b')});db[_0xf465('0x1b')][_0xf465('0x119')](db[_0xf465('0x2a')],{'as':_0xf465('0x14c'),'foreignKey':_0xf465('0x14d')});db[_0xf465('0x1b')][_0xf465('0x119')](db['CmHopper'],{'as':_0xf465('0x14e'),'foreignKey':_0xf465('0x14d')});db[_0xf465('0x1b')][_0xf465('0x119')](db[_0xf465('0x11d')],{'as':'HopperFinals','foreignKey':_0xf465('0x14d')});db[_0xf465('0x1b')]['hasMany'](db[_0xf465('0x11f')],{'as':_0xf465('0x14f'),'foreignKey':_0xf465('0x14d')});db[_0xf465('0x1b')][_0xf465('0x119')](db[_0xf465('0x121')],{'as':'ReportAgentPreview','foreignKey':_0xf465('0x14d')});db['VoiceQueue']['hasMany'](db[_0xf465('0x150')],{'as':_0xf465('0x151'),'foreignKey':_0xf465('0x14d')});db[_0xf465('0x1b')][_0xf465('0x119')](db[_0xf465('0xdb')],{'as':_0xf465('0x152'),'foreignKey':_0xf465('0x14d')});db[_0xf465('0x1b')]['belongsTo'](db['Trunk'],{'as':_0xf465('0x153'),'foreignKey':'TrunkId'});db[_0xf465('0x1b')][_0xf465('0x128')](db[_0xf465('0x153')],{'as':_0xf465('0x154'),'foreignKey':'TrunkBackupId'});db[_0xf465('0x1b')][_0xf465('0x128')](db[_0xf465('0x7c')],{'as':_0xf465('0x7c'),'foreignKey':'IntervalId'});db[_0xf465('0x1b')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xf465('0x155')});db['VoiceQueue'][_0xf465('0x12c')](db['CmList'],{'as':_0xf465('0x12e'),'through':_0xf465('0x156')});db[_0xf465('0x1b')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':_0xf465('0x2c')});db[_0xf465('0x1b')]['belongsToMany'](db[_0xf465('0xe9')],{'as':'Teams','through':_0xf465('0x158')});db[_0xf465('0x1b')][_0xf465('0x12c')](db[_0xf465('0xf9')],{'as':_0xf465('0x159'),'through':'voice_queues_has_cm_blacklists'});db[_0xf465('0x1c')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x12'),'foreignKey':_0xf465('0x117')});db[_0xf465('0x15a')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':'User','foreignKey':_0xf465('0x117')});db[_0xf465('0x1e')][_0xf465('0x119')](db['VoiceMailMessage'],{'as':_0xf465('0x15b'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x15c'),'sourceKey':_0xf465('0x15d')});db['VoiceMailMessage'][_0xf465('0x128')](db[_0xf465('0x1e')],{'foreignKey':_0xf465('0x15c'),'targetKey':_0xf465('0x15d')});db[_0xf465('0x20')]['hasMany'](db[_0xf465('0x25')],{'as':_0xf465('0x15e'),'foreignKey':_0xf465('0x15f'),'constraints':![]});db[_0xf465('0x20')][_0xf465('0x119')](db[_0xf465('0x23')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xf465('0x20')][_0xf465('0x128')](db['User'],{'as':_0xf465('0x12'),'foreignKey':_0xf465('0x117')});db['VoiceCallReport']['belongsTo'](db[_0xf465('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn'][_0xf465('0x128')](db[_0xf465('0x3d')],{'as':_0xf465('0x3d'),'foreignKey':_0xf465('0x160')});db['MailServerIn'][_0xf465('0x128')](db[_0xf465('0x161')],{'as':_0xf465('0x161'),'foreignKey':'CloudProviderId','onDelete':_0xf465('0x162')});db[_0xf465('0x3b')][_0xf465('0x128')](db[_0xf465('0x3d')],{'as':_0xf465('0x3d'),'foreignKey':_0xf465('0x160')});db[_0xf465('0x3b')][_0xf465('0x128')](db[_0xf465('0x161')],{'as':_0xf465('0x161'),'foreignKey':_0xf465('0x163'),'onDelete':_0xf465('0x162')});db[_0xf465('0x3d')][_0xf465('0x114')](db[_0xf465('0x39')],{'as':'Imap','onDelete':'cascade'});db[_0xf465('0x3d')]['hasOne'](db[_0xf465('0x3b')],{'as':_0xf465('0x164'),'onDelete':_0xf465('0x115')});db[_0xf465('0x3d')][_0xf465('0x119')](db['Disposition'],{'as':_0xf465('0x165'),'foreignKey':_0xf465('0x160'),'onDelete':_0xf465('0x115')});db[_0xf465('0x3d')][_0xf465('0x119')](db[_0xf465('0x78')],{'as':'Answers','foreignKey':_0xf465('0x160')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db[_0xf465('0x3d')]['hasMany'](db[_0xf465('0x41')],{'as':_0xf465('0x166')});db['MailAccount']['hasMany'](db['MailApplication'],{'as':'Applications'});db[_0xf465('0x3d')]['belongsTo'](db[_0xf465('0xf9')],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db[_0xf465('0x3d')][_0xf465('0x128')](db['Template'],{'as':_0xf465('0x8c'),'foreignKey':_0xf465('0x169')});db[_0xf465('0x3d')][_0xf465('0x128')](db['Pause'],{'as':_0xf465('0x16a'),'foreignKey':_0xf465('0x155')});db[_0xf465('0x3d')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':_0xf465('0x30')});db[_0xf465('0x3f')][_0xf465('0x12c')](db[_0xf465('0xe9')],{'through':_0xf465('0x16b'),'as':_0xf465('0x16c')});db[_0xf465('0x41')][_0xf465('0x119')](db[_0xf465('0x42')],{'as':_0xf465('0x15b'),'onDelete':_0xf465('0x115'),'foreignKey':'MailInteractionId'});db[_0xf465('0x41')][_0xf465('0x128')](db['MailAccount'],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x160')});db[_0xf465('0x41')]['belongsTo'](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':'ContactId'});db[_0xf465('0x41')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x16f'),'foreignKey':'UserId'});db['MailInteraction'][_0xf465('0x12c')](db['Tag'],{'through':_0xf465('0x170'),'as':_0xf465('0x171')});db['MailInteraction'][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':_0xf465('0x170'),'as':_0xf465('0x172')});db['MailInteraction'][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x173'),'through':_0xf465('0x131'),'foreignKey':_0xf465('0x174')});db[_0xf465('0x42')][_0xf465('0x119')](db[_0xf465('0xef')],{'as':'Attachments','onDelete':'cascade'});db[_0xf465('0x42')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x12')});db['MailMessage'][_0xf465('0x128')](db[_0xf465('0x6d')],{'onDelete':_0xf465('0x115'),'as':'Contact'});db[_0xf465('0x42')][_0xf465('0x128')](db['MailInteraction'],{'as':_0xf465('0x175'),'foreignKey':_0xf465('0x174')});db[_0xf465('0x42')]['belongsTo'](db[_0xf465('0x3d')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x160')});db[_0xf465('0x42')][_0xf465('0x128')](db['ChatWebsite'],{'as':_0xf465('0x5e'),'foreignKey':_0xf465('0x176')});db[_0xf465('0x42')]['belongsTo'](db[_0xf465('0x66')],{'as':_0xf465('0x66'),'foreignKey':_0xf465('0x177')});db[_0xf465('0x43')]['belongsTo'](db['User'],{'onDelete':_0xf465('0x162')});db[_0xf465('0x43')][_0xf465('0x128')](db[_0xf465('0x3f')],{'onDelete':'restrict'});db[_0xf465('0x43')][_0xf465('0x128')](db[_0xf465('0x3d')],{'onDelete':_0xf465('0x162')});db[_0xf465('0x43')][_0xf465('0x128')](db[_0xf465('0x7c')],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x178')});db[_0xf465('0x43')][_0xf465('0x128')](db[_0xf465('0x87')],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x179')});db[_0xf465('0x45')][_0xf465('0x128')](db[_0xf465('0x3d')],{});db['MailQueueReport'][_0xf465('0x128')](db['CmList'],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db[_0xf465('0x45')]['belongsTo'](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x45')][_0xf465('0x128')](db[_0xf465('0x41')],{});db[_0xf465('0x45')]['belongsTo'](db[_0xf465('0x42')],{});db[_0xf465('0x45')][_0xf465('0x128')](db[_0xf465('0x12')],{});db[_0xf465('0x45')]['belongsTo'](db[_0xf465('0x3f')],{});db['Dashboard'][_0xf465('0x119')](db[_0xf465('0x17b')],{'as':_0xf465('0x17c'),'onDelete':_0xf465('0x115')});db['FaxAccount'][_0xf465('0x119')](db['Disposition'],{'as':_0xf465('0x165'),'foreignKey':_0xf465('0x17d'),'onDelete':_0xf465('0x115')});db[_0xf465('0x48')]['hasMany'](db[_0xf465('0x78')],{'as':_0xf465('0x17e'),'foreignKey':_0xf465('0x17d')});db[_0xf465('0x48')][_0xf465('0x119')](db[_0xf465('0x4b')],{'as':_0xf465('0x166')});db[_0xf465('0x48')][_0xf465('0x119')](db['FaxApplication'],{'as':'Applications'});db['FaxAccount'][_0xf465('0x119')](db[_0xf465('0x11b')],{'as':_0xf465('0x17f'),'onDelete':'cascade'});db[_0xf465('0x48')][_0xf465('0x119')](db[_0xf465('0x180')],{'as':_0xf465('0x15b')});db['FaxAccount']['belongsTo'](db[_0xf465('0x153')],{'as':_0xf465('0x153')});db[_0xf465('0x48')][_0xf465('0x128')](db[_0xf465('0xf9')],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db[_0xf465('0x48')]['belongsTo'](db[_0xf465('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf465('0x155')});db[_0xf465('0x48')]['belongsToMany'](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':_0xf465('0x145')});db[_0xf465('0x49')][_0xf465('0x128')](db[_0xf465('0x12')],{'onDelete':'restrict'});db[_0xf465('0x49')][_0xf465('0x128')](db[_0xf465('0x4e')],{'onDelete':_0xf465('0x162')});db[_0xf465('0x49')]['belongsTo'](db[_0xf465('0x48')],{'onDelete':_0xf465('0x162')});db['FaxApplication']['belongsTo'](db[_0xf465('0x87')],{'onDelete':'restrict','foreignKey':_0xf465('0x179')});db[_0xf465('0x4b')][_0xf465('0x119')](db[_0xf465('0x180')],{'as':_0xf465('0x15b'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x181')});db[_0xf465('0x4b')][_0xf465('0x128')](db[_0xf465('0x48')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x17d')});db[_0xf465('0x4b')][_0xf465('0x128')](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x4b')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x16f'),'foreignKey':_0xf465('0x117')});db[_0xf465('0x4b')][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':_0xf465('0x182'),'as':'Tags'});db[_0xf465('0x4b')][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':_0xf465('0x182'),'as':_0xf465('0x172')});db[_0xf465('0x4b')][_0xf465('0x12c')](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xf465('0x181')});db[_0xf465('0x180')][_0xf465('0x128')](db['User'],{'onDelete':'cascade','as':'User'});db['FaxMessage'][_0xf465('0x128')](db[_0xf465('0x4b')],{'as':'Interaction','foreignKey':_0xf465('0x181')});db[_0xf465('0x180')][_0xf465('0x128')](db[_0xf465('0x6d')],{'onDelete':_0xf465('0x115'),'as':_0xf465('0x16e')});db[_0xf465('0x180')][_0xf465('0x128')](db[_0xf465('0xef')],{'as':_0xf465('0xef'),'foreignKey':_0xf465('0x183')});db[_0xf465('0x180')][_0xf465('0x128')](db['FaxAccount'],{'as':'Account','foreignKey':_0xf465('0x17d')});db[_0xf465('0x4e')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':_0xf465('0x32')});db[_0xf465('0x4e')][_0xf465('0x12c')](db[_0xf465('0xe9')],{'through':_0xf465('0x184'),'as':_0xf465('0x16c')});db['FaxQueueReport']['belongsTo'](db[_0xf465('0x48')],{});db['FaxQueueReport'][_0xf465('0x128')](db['CmList'],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db[_0xf465('0x185')][_0xf465('0x128')](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':'ContactId'});db[_0xf465('0x185')][_0xf465('0x128')](db[_0xf465('0x4b')],{});db[_0xf465('0x185')]['belongsTo'](db[_0xf465('0x180')],{});db[_0xf465('0x185')][_0xf465('0x128')](db['User'],{});db[_0xf465('0x185')]['belongsTo'](db[_0xf465('0x4e')],{});db[_0xf465('0x50')][_0xf465('0x119')](db[_0xf465('0x186')],{'as':_0xf465('0x165'),'foreignKey':'SmsAccountId','onDelete':_0xf465('0x115')});db[_0xf465('0x50')][_0xf465('0x119')](db[_0xf465('0x78')],{'as':_0xf465('0x17e'),'foreignKey':'SmsAccountId'});db[_0xf465('0x50')]['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':_0xf465('0x187')});db['SmsAccount'][_0xf465('0x119')](db[_0xf465('0x123')],{'as':_0xf465('0x166')});db[_0xf465('0x50')][_0xf465('0x119')](db['SmsApplication'],{'as':'Applications'});db[_0xf465('0x50')][_0xf465('0x128')](db['CmList'],{'as':'List','foreignKey':_0xf465('0x168')});db[_0xf465('0x50')]['belongsTo'](db[_0xf465('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xf465('0x155')});db[_0xf465('0x50')]['belongsToMany'](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':'user_has_sms_accounts'});db[_0xf465('0x52')]['belongsTo'](db[_0xf465('0x12')],{'onDelete':_0xf465('0x162')});db[_0xf465('0x52')][_0xf465('0x128')](db[_0xf465('0x56')],{'onDelete':_0xf465('0x162')});db[_0xf465('0x52')][_0xf465('0x128')](db[_0xf465('0x50')],{'onDelete':_0xf465('0x162')});db[_0xf465('0x52')][_0xf465('0x128')](db['Interval'],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x178')});db[_0xf465('0x52')][_0xf465('0x128')](db[_0xf465('0x87')],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x179')});db[_0xf465('0x123')][_0xf465('0x119')](db[_0xf465('0x188')],{'as':_0xf465('0x15b'),'onDelete':'cascade','foreignKey':_0xf465('0x189')});db[_0xf465('0x123')][_0xf465('0x128')](db[_0xf465('0x50')],{'as':'Account','foreignKey':_0xf465('0x187')});db[_0xf465('0x123')]['belongsTo'](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x123')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x16f'),'foreignKey':_0xf465('0x117')});db[_0xf465('0x123')][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':'sms_interaction_has_tags','as':_0xf465('0x171')});db[_0xf465('0x123')][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':_0xf465('0x18a'),'as':_0xf465('0x172')});db[_0xf465('0x123')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':'Users','through':_0xf465('0x137'),'foreignKey':'SmsInteractionId'});db[_0xf465('0x188')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x12')});db[_0xf465('0x188')][_0xf465('0x128')](db[_0xf465('0x6d')],{'onDelete':_0xf465('0x115'),'as':_0xf465('0x16e')});db[_0xf465('0x188')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0xf465('0x115'),'as':_0xf465('0x175'),'foreignKey':_0xf465('0x189')});db[_0xf465('0x188')][_0xf465('0x128')](db['SmsAccount'],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x187')});db[_0xf465('0x56')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':_0xf465('0x34'),'foreignKey':_0xf465('0x18b')});db[_0xf465('0x56')]['belongsToMany'](db[_0xf465('0xe9')],{'through':_0xf465('0x18c'),'as':'Teams'});db[_0xf465('0x57')][_0xf465('0x119')](db[_0xf465('0x186')],{'as':'Dispositions','foreignKey':_0xf465('0x18d'),'onDelete':_0xf465('0x115')});db[_0xf465('0x57')][_0xf465('0x119')](db['CannedAnswer'],{'as':_0xf465('0x17e'),'foreignKey':_0xf465('0x18d')});db['OpenchannelAccount'][_0xf465('0x119')](db[_0xf465('0x5a')],{'as':_0xf465('0x166'),'foreignKey':_0xf465('0x18d')});db[_0xf465('0x57')][_0xf465('0x119')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0xf465('0x18d')});db[_0xf465('0x57')]['hasMany'](db[_0xf465('0x59')],{'as':_0xf465('0x18e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xf465('0x128')](db[_0xf465('0xf9')],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db[_0xf465('0x57')][_0xf465('0x128')](db[_0xf465('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xf465('0x57')][_0xf465('0x12c')](db['User'],{'as':'Agents','through':_0xf465('0x147')});db['OpenchannelApplication'][_0xf465('0x128')](db[_0xf465('0x12')],{'onDelete':_0xf465('0x162')});db[_0xf465('0x59')]['belongsTo'](db[_0xf465('0x13e')],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x18f')});db[_0xf465('0x59')][_0xf465('0x128')](db[_0xf465('0x57')],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x18d')});db[_0xf465('0x59')][_0xf465('0x128')](db[_0xf465('0x7c')],{'onDelete':'restrict','foreignKey':_0xf465('0x178')});db[_0xf465('0x59')][_0xf465('0x128')](db['Tag'],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x179')});db[_0xf465('0x5a')][_0xf465('0x119')](db[_0xf465('0x190')],{'as':'Messages','onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x191')});db['OpenchannelInteraction'][_0xf465('0x128')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xf465('0x5a')][_0xf465('0x128')](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x16f'),'foreignKey':_0xf465('0x117')});db['OpenchannelInteraction']['belongsToMany'](db[_0xf465('0x87')],{'through':_0xf465('0x192'),'as':_0xf465('0x171')});db[_0xf465('0x5a')][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':_0xf465('0x192'),'as':'ThroughTags'});db[_0xf465('0x5a')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0xf465('0x191')});db['OpenchannelMessage'][_0xf465('0x128')](db[_0xf465('0x12')],{'onDelete':_0xf465('0x115'),'as':'User'});db[_0xf465('0x190')][_0xf465('0x128')](db[_0xf465('0x6d')],{'onDelete':_0xf465('0x115'),'as':_0xf465('0x16e')});db['OpenchannelMessage'][_0xf465('0x128')](db[_0xf465('0x5a')],{'onDelete':_0xf465('0x115'),'as':_0xf465('0x175'),'foreignKey':'OpenchannelInteractionId'});db[_0xf465('0x190')][_0xf465('0x128')](db['Attachment'],{'as':_0xf465('0xef'),'foreignKey':_0xf465('0x183')});db['OpenchannelMessage'][_0xf465('0x128')](db['OpenchannelAccount'],{'as':_0xf465('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0xf465('0x13e')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':_0xf465('0x140'),'foreignKey':_0xf465('0x18f')});db[_0xf465('0x13e')]['belongsToMany'](db[_0xf465('0xe9')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xf465('0x5e')][_0xf465('0x119')](db[_0xf465('0x186')],{'as':_0xf465('0x165'),'foreignKey':_0xf465('0x176'),'onDelete':_0xf465('0x115')});db[_0xf465('0x5e')][_0xf465('0x119')](db[_0xf465('0x78')],{'as':_0xf465('0x17e'),'foreignKey':_0xf465('0x176')});db[_0xf465('0x5e')][_0xf465('0x119')](db[_0xf465('0x6a')],{'as':_0xf465('0x193')});db[_0xf465('0x5e')][_0xf465('0x119')](db[_0xf465('0x63')],{'as':_0xf465('0x166')});db[_0xf465('0x5e')][_0xf465('0x119')](db[_0xf465('0x62')],{'as':_0xf465('0x18e')});db[_0xf465('0x5e')][_0xf465('0x119')](db[_0xf465('0x194')],{'as':_0xf465('0x15b')});db[_0xf465('0x5e')][_0xf465('0x128')](db['CmList'],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db[_0xf465('0x5e')][_0xf465('0x128')](db['Interval'],{'as':_0xf465('0x7c'),'foreignKey':_0xf465('0x178')});db['ChatWebsite'][_0xf465('0x128')](db[_0xf465('0x3d')],{'as':_0xf465('0x3d'),'foreignKey':'MailAccountId'});db[_0xf465('0x5e')][_0xf465('0x128')](db['Pause'],{'as':_0xf465('0x16a'),'foreignKey':_0xf465('0x155')});db[_0xf465('0x5e')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':'Agents','through':_0xf465('0x143')});db[_0xf465('0x60')][_0xf465('0x128')](db[_0xf465('0x57')],{});db[_0xf465('0x60')][_0xf465('0x128')](db[_0xf465('0xf9')],{'as':'List','foreignKey':_0xf465('0x168')});db['OpenchannelQueueReport'][_0xf465('0x128')](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':'ContactId'});db[_0xf465('0x60')][_0xf465('0x128')](db[_0xf465('0x5a')],{});db[_0xf465('0x60')][_0xf465('0x128')](db[_0xf465('0x190')],{});db[_0xf465('0x60')][_0xf465('0x128')](db['User'],{});db['OpenchannelQueueReport'][_0xf465('0x128')](db[_0xf465('0x13e')],{});db['ChatApplication'][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x195'),'foreignKey':_0xf465('0x117'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xf465('0x68')],{'as':_0xf465('0x196'),'foreignKey':'ChatQueueId','onDelete':_0xf465('0x162')});db['ChatApplication'][_0xf465('0x128')](db[_0xf465('0x5e')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0xf465('0x162')});db[_0xf465('0x62')]['belongsTo'](db[_0xf465('0x87')],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x179')});db[_0xf465('0x63')][_0xf465('0x119')](db[_0xf465('0x194')],{'as':'Messages','onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x197')});db['ChatInteraction'][_0xf465('0x128')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xf465('0x63')][_0xf465('0x128')](db[_0xf465('0x6d')],{'as':'Contact','foreignKey':_0xf465('0x17a')});db[_0xf465('0x63')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x16f'),'foreignKey':'UserId'});db[_0xf465('0x63')][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':'chat_interaction_has_tags','as':_0xf465('0x171')});db[_0xf465('0x63')][_0xf465('0x12c')](db[_0xf465('0x87')],{'through':_0xf465('0x198'),'as':_0xf465('0x172')});db[_0xf465('0x63')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x173'),'through':_0xf465('0x133'),'foreignKey':_0xf465('0x197')});db[_0xf465('0x194')][_0xf465('0x128')](db[_0xf465('0x12')],{'onDelete':_0xf465('0x115'),'as':'User'});db[_0xf465('0x194')][_0xf465('0x128')](db[_0xf465('0x6d')],{'onDelete':_0xf465('0x115'),'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a')});db['ChatMessage'][_0xf465('0x128')](db['ChatInteraction'],{'onDelete':_0xf465('0x115'),'as':'Interaction','foreignKey':_0xf465('0x197')});db[_0xf465('0x194')]['belongsTo'](db['Attachment'],{'as':_0xf465('0xef'),'foreignKey':_0xf465('0x183')});db[_0xf465('0x194')]['belongsTo'](db[_0xf465('0x5e')],{'as':_0xf465('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0xf465('0x66')][_0xf465('0x119')](db[_0xf465('0xef')],{'as':_0xf465('0x199'),'foreignKey':_0xf465('0x177'),'onDelete':_0xf465('0x115'),'hooks':!![]});db[_0xf465('0x66')]['belongsTo'](db['CmContact'],{'onDelete':_0xf465('0x115'),'as':'Contact','foreignKey':_0xf465('0x17a')});db[_0xf465('0x66')]['belongsTo'](db[_0xf465('0x5e')],{'as':_0xf465('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0xf465('0x68')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xf465('0x12c')](db[_0xf465('0xe9')],{'through':_0xf465('0x19a'),'as':_0xf465('0x16c')});db['ChatGroup'][_0xf465('0x119')](db[_0xf465('0x19b')],{'as':_0xf465('0x15b'),'foreignKey':_0xf465('0x19c'),'onDelete':_0xf465('0x115')});db[_0xf465('0x69')][_0xf465('0x12c')](db['User'],{'as':_0xf465('0x14c'),'through':'chat_group_has_users'});db[_0xf465('0x6a')][_0xf465('0x128')](db[_0xf465('0x5e')],{'as':_0xf465('0x19d'),'foreignKey':_0xf465('0x176')});db['CmCompany'][_0xf465('0x119')](db[_0xf465('0x6d')],{'as':_0xf465('0x19e'),'foreignKey':_0xf465('0x19f')});db[_0xf465('0x6d')][_0xf465('0x119')](db[_0xf465('0x89')],{'as':_0xf465('0x1a0'),'foreignKey':_0xf465('0x1a1')});db[_0xf465('0x6d')][_0xf465('0x119')](db[_0xf465('0x6f')],{'as':_0xf465('0x14e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x6d')]['hasMany'](db[_0xf465('0x11d')],{'as':_0xf465('0x11e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x6d')][_0xf465('0x119')](db[_0xf465('0x11f')],{'as':_0xf465('0x14f'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x6d')][_0xf465('0x119')](db[_0xf465('0x121')],{'as':_0xf465('0x121'),'foreignKey':_0xf465('0x17a')});db['CmContact'][_0xf465('0x119')](db[_0xf465('0xdb')],{'as':_0xf465('0x152'),'foreignKey':_0xf465('0x17a')});db['CmContact'][_0xf465('0x119')](db['OpenchannelInteraction'],{'as':_0xf465('0x122'),'foreignKey':_0xf465('0x17a'),'onDelete':_0xf465('0x162')});db['CmContact'][_0xf465('0x119')](db[_0xf465('0x63')],{'as':_0xf465('0x132'),'foreignKey':_0xf465('0x17a'),'onDelete':'restrict'});db[_0xf465('0x6d')][_0xf465('0x119')](db['SmsInteraction'],{'as':_0xf465('0x136'),'foreignKey':'ContactId','onDelete':_0xf465('0x162')});db[_0xf465('0x6d')][_0xf465('0x119')](db[_0xf465('0x4b')],{'as':'FaxInteractions','foreignKey':_0xf465('0x17a'),'onDelete':_0xf465('0x162')});db[_0xf465('0x6d')][_0xf465('0x119')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xf465('0x17a'),'onDelete':_0xf465('0x162')});db['CmContact'][_0xf465('0x128')](db[_0xf465('0x1a2')],{'as':'Company','foreignKey':_0xf465('0x19f')});db[_0xf465('0x6d')][_0xf465('0x128')](db[_0xf465('0xf9')],{'as':_0xf465('0x167'),'foreignKey':'ListId','onDelete':_0xf465('0x115')});db[_0xf465('0x6d')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x173'),'through':_0xf465('0x12d')});db['CmContact'][_0xf465('0x12c')](db[_0xf465('0x87')],{'as':_0xf465('0x171'),'through':'cm_contact_has_tags'});db[_0xf465('0x6d')][_0xf465('0x12c')](db['Tag'],{'through':_0xf465('0x1a3'),'as':'ThroughTags'});db[_0xf465('0x6f')]['hasMany'](db[_0xf465('0x1a4')],{'as':_0xf465('0x1a5'),'foreignKey':_0xf465('0x1a6')});db['CmHopper']['belongsTo'](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a'),'onDelete':_0xf465('0x115')});db[_0xf465('0x6f')][_0xf465('0x128')](db[_0xf465('0xf9')],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xf465('0x12')],{'as':'Agent','foreignKey':_0xf465('0x117')});db['CmHopper'][_0xf465('0x128')](db[_0xf465('0x1b')],{'as':_0xf465('0x196'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xf465('0x6f')][_0xf465('0x128')](db[_0xf465('0xeb')],{'as':_0xf465('0xeb'),'foreignKey':_0xf465('0x1a7'),'onDelete':_0xf465('0x115')});db[_0xf465('0x6f')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x16f'),'foreignKey':_0xf465('0x1a8')});db[_0xf465('0x150')][_0xf465('0x128')](db['CmContact'],{'as':'Contact','foreignKey':_0xf465('0x17a'),'onDelete':_0xf465('0x115')});db[_0xf465('0x150')][_0xf465('0x128')](db[_0xf465('0xf9')],{'as':'List','foreignKey':_0xf465('0x168'),'onDelete':_0xf465('0x115')});db[_0xf465('0x150')][_0xf465('0x128')](db[_0xf465('0x1b')],{'as':_0xf465('0x196'),'foreignKey':_0xf465('0x14d'),'onDelete':_0xf465('0x115')});db[_0xf465('0x150')][_0xf465('0x128')](db[_0xf465('0xeb')],{'as':_0xf465('0xeb'),'foreignKey':_0xf465('0x1a7'),'onDelete':_0xf465('0x115')});db[_0xf465('0x77')]['hasMany'](db[_0xf465('0x1a9')],{'as':{'plural':_0xf465('0x1aa'),'singular':_0xf465('0x1ab')},'foreignKey':'AutomationAllId','onDelete':_0xf465('0x115'),'hooks':!![]});db[_0xf465('0x77')]['hasMany'](db[_0xf465('0x1a9')],{'as':{'plural':_0xf465('0x1ac'),'singular':'OneAny'},'foreignKey':_0xf465('0x1ad'),'onDelete':_0xf465('0x115'),'hooks':!![]});db[_0xf465('0x77')][_0xf465('0x119')](db[_0xf465('0x75')],{'as':_0xf465('0x1ae'),'foreignKey':_0xf465('0x1af'),'onDelete':_0xf465('0x115'),'hooks':!![]});db[_0xf465('0x186')][_0xf465('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xf465('0x1b0'),'onDelete':'cascade'});db[_0xf465('0x7c')][_0xf465('0x119')](db[_0xf465('0x7c')],{'as':_0xf465('0x1b1'),'foreignKey':_0xf465('0x178'),'onDelete':_0xf465('0x115'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0xf465('0x11c'),'foreignKey':_0xf465('0x178'),'onDelete':'restrict'});db[_0xf465('0x7c')][_0xf465('0x119')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xf465('0x178')});db[_0xf465('0x7c')][_0xf465('0x119')](db['ChatApplication'],{'as':_0xf465('0x1b2'),'foreignKey':'IntervalId'});db[_0xf465('0x7c')][_0xf465('0x119')](db['FaxApplication'],{'as':_0xf465('0x1b3'),'foreignKey':_0xf465('0x178')});db[_0xf465('0x7c')][_0xf465('0x119')](db['SmsApplication'],{'as':_0xf465('0x1b4'),'foreignKey':_0xf465('0x178')});db[_0xf465('0x83')][_0xf465('0x128')](db[_0xf465('0x3d')],{});db['Schedule'][_0xf465('0x128')](db[_0xf465('0x96')],{'foreignKey':_0xf465('0x1b5')});db[_0xf465('0x83')][_0xf465('0x128')](db[_0xf465('0x94')],{'foreignKey':'CustomReportId'});db[_0xf465('0x85')][_0xf465('0x12c')](db[_0xf465('0x1a')],{'as':_0xf465('0x1b6'),'through':_0xf465('0x14b'),'onDelete':_0xf465('0x162')});db[_0xf465('0x87')]['belongsToMany'](db[_0xf465('0x6d')],{'through':_0xf465('0x1a3')});db['Tag'][_0xf465('0x12c')](db['ChatInteraction'],{'through':_0xf465('0x198')});db[_0xf465('0x87')][_0xf465('0x12c')](db[_0xf465('0x41')],{'through':'mail_interaction_has_tags'});db[_0xf465('0x87')][_0xf465('0x12c')](db[_0xf465('0x123')],{'through':_0xf465('0x18a')});db[_0xf465('0x87')][_0xf465('0x12c')](db[_0xf465('0x4b')],{'through':_0xf465('0x182')});db[_0xf465('0x87')][_0xf465('0x12c')](db[_0xf465('0x5a')],{'through':_0xf465('0x192')});db[_0xf465('0x87')][_0xf465('0x12c')](db[_0xf465('0x106')],{'through':'whatsapp_interaction_has_tags'});db[_0xf465('0x89')][_0xf465('0x128')](db[_0xf465('0x88')],{'as':_0xf465('0x1b7'),'foreignKey':_0xf465('0x1b8')});db['CmHopperAdditionalPhone'][_0xf465('0x128')](db['CmHopper'],{'as':_0xf465('0x1b9'),'foreignKey':_0xf465('0x1a6')});db[_0xf465('0x89')]['belongsTo'](db[_0xf465('0x6d')],{'as':'Contact','foreignKey':_0xf465('0x1a1')});db[_0xf465('0x1ba')]['hasMany'](db[_0xf465('0x1a9')],{'as':{'plural':_0xf465('0x1bb'),'singular':_0xf465('0x1bc')},'foreignKey':_0xf465('0x1bd'),'onDelete':_0xf465('0x115'),'hooks':!![]});db['Trigger'][_0xf465('0x119')](db['Condition'],{'as':{'plural':_0xf465('0x1be'),'singular':_0xf465('0x1bf')},'foreignKey':'TriggerAnyId','onDelete':_0xf465('0x115'),'hooks':!![]});db['Trigger'][_0xf465('0x119')](db[_0xf465('0x75')],{'as':_0xf465('0x1ae'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0xf465('0x94')][_0xf465('0x119')](db[_0xf465('0x1c0')],{'as':_0xf465('0x1c1'),'onDelete':_0xf465('0x115'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xf465('0x96')][_0xf465('0x119')](db['AnalyticFieldReport'],{'as':_0xf465('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xf465('0x1c2')][_0xf465('0x119')](db[_0xf465('0x1c0')],{'as':_0xf465('0x1c1'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c3')});db[_0xf465('0x1c0')][_0xf465('0x128')](db[_0xf465('0x1c2')],{'foreignKey':_0xf465('0x1c3')});db[_0xf465('0x9e')][_0xf465('0x119')](db[_0xf465('0xa0')],{'as':_0xf465('0x1c4'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xa0')][_0xf465('0x119')](db['SalesforceField'],{'as':_0xf465('0x1c6'),'onDelete':_0xf465('0x115'),'foreignKey':'SubjectId'});db[_0xf465('0xa0')][_0xf465('0x119')](db[_0xf465('0xa2')],{'as':_0xf465('0x1c7'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xa0')][_0xf465('0x119')](db[_0xf465('0xa2')],{'as':_0xf465('0x1c1'),'onDelete':'cascade','foreignKey':_0xf465('0x1c9')});db[_0xf465('0xa0')][_0xf465('0x128')](db[_0xf465('0x9e')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xa2')][_0xf465('0x119')](db[_0xf465('0xa2')],{'as':_0xf465('0x1ca'),'foreignKey':'SubjectId'});db[_0xf465('0xa2')][_0xf465('0x119')](db['SalesforceField'],{'as':_0xf465('0x1cb'),'foreignKey':'DescriptionId'});db[_0xf465('0xa2')][_0xf465('0x119')](db[_0xf465('0xa2')],{'as':'Field','foreignKey':_0xf465('0x1c9')});db[_0xf465('0xa2')][_0xf465('0x128')](db[_0xf465('0x8e')],{'as':'Variable','foreignKey':'VariableId'});db[_0xf465('0xa4')][_0xf465('0x119')](db['SugarcrmConfiguration'],{'as':_0xf465('0x1c4'),'onDelete':_0xf465('0x115'),'foreignKey':'AccountId'});db[_0xf465('0xa6')][_0xf465('0x119')](db[_0xf465('0xa8')],{'as':_0xf465('0x1c6'),'onDelete':_0xf465('0x115'),'foreignKey':'SubjectId'});db[_0xf465('0xa6')][_0xf465('0x119')](db[_0xf465('0xa8')],{'as':'Descriptions','onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xa6')][_0xf465('0x119')](db[_0xf465('0xa8')],{'as':'Fields','onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c9')});db['SugarcrmConfiguration'][_0xf465('0x128')](db[_0xf465('0xa4')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xa8')][_0xf465('0x119')](db[_0xf465('0xa8')],{'as':_0xf465('0x1ca'),'foreignKey':_0xf465('0x1cc')});db['SugarcrmField'][_0xf465('0x119')](db[_0xf465('0xa8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf465('0xa8')][_0xf465('0x119')](db['SugarcrmField'],{'as':_0xf465('0x1cd'),'foreignKey':_0xf465('0x1c9')});db[_0xf465('0xa8')][_0xf465('0x128')](db[_0xf465('0x8e')],{'as':_0xf465('0x8e'),'foreignKey':_0xf465('0x1ce')});db[_0xf465('0xa9')][_0xf465('0x119')](db[_0xf465('0xab')],{'as':'Configurations','onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c5')});db['DeskConfiguration'][_0xf465('0x119')](db['DeskField'],{'as':_0xf465('0x1c6'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0xab')][_0xf465('0x119')](db['DeskField'],{'as':'Descriptions','onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c8')});db['DeskConfiguration'][_0xf465('0x119')](db['DeskField'],{'as':_0xf465('0x1c1'),'onDelete':_0xf465('0x115'),'foreignKey':'FieldId'});db[_0xf465('0xab')]['belongsTo'](db[_0xf465('0xa9')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xab')]['belongsToMany'](db[_0xf465('0x87')],{'through':_0xf465('0x1cf')});db['DeskField'][_0xf465('0x119')](db[_0xf465('0xad')],{'as':'Subject','foreignKey':_0xf465('0x1cc')});db[_0xf465('0xad')][_0xf465('0x119')](db['DeskField'],{'as':_0xf465('0x1cb'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xad')][_0xf465('0x119')](db[_0xf465('0xad')],{'as':_0xf465('0x1cd'),'foreignKey':_0xf465('0x1c9')});db[_0xf465('0xad')][_0xf465('0x128')](db[_0xf465('0x8e')],{'as':_0xf465('0x8e'),'foreignKey':_0xf465('0x1ce')});db[_0xf465('0xaf')][_0xf465('0x119')](db[_0xf465('0xb0')],{'as':_0xf465('0x1c4'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xb0')][_0xf465('0x119')](db[_0xf465('0x1d0')],{'as':_0xf465('0x1c6'),'onDelete':'cascade','foreignKey':_0xf465('0x1cc')});db[_0xf465('0xb0')]['hasMany'](db[_0xf465('0x1d0')],{'as':_0xf465('0x1c7'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xb0')]['hasMany'](db['ZohoField'],{'as':_0xf465('0x1c1'),'onDelete':'cascade','foreignKey':_0xf465('0x1c9')});db[_0xf465('0xb0')][_0xf465('0x128')](db[_0xf465('0xaf')],{'as':_0xf465('0x16d'),'foreignKey':'AccountId'});db[_0xf465('0x1d0')][_0xf465('0x119')](db[_0xf465('0x1d0')],{'as':_0xf465('0x1ca'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0x1d0')][_0xf465('0x119')](db['ZohoField'],{'as':_0xf465('0x1cb'),'foreignKey':_0xf465('0x1c8')});db['ZohoField'][_0xf465('0x119')](db[_0xf465('0x1d0')],{'as':_0xf465('0x1cd'),'foreignKey':_0xf465('0x1c9')});db['ZohoField']['belongsTo'](db['Variable'],{'as':_0xf465('0x8e'),'foreignKey':_0xf465('0x1ce')});db[_0xf465('0xb3')]['hasMany'](db[_0xf465('0xb5')],{'as':'Configurations','onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c5')});db['ZendeskConfiguration'][_0xf465('0x119')](db[_0xf465('0xb6')],{'as':_0xf465('0x1c6'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0xb5')]['hasMany'](db[_0xf465('0xb6')],{'as':_0xf465('0x1c7'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xb5')][_0xf465('0x119')](db[_0xf465('0xb6')],{'as':_0xf465('0x1c1'),'foreignKey':_0xf465('0x1c9')});db[_0xf465('0xb5')][_0xf465('0x128')](db[_0xf465('0xb3')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xb5')]['belongsToMany'](db['Tag'],{'through':_0xf465('0x1d1')});db[_0xf465('0xb6')][_0xf465('0x119')](db['ZendeskField'],{'as':_0xf465('0x1ca'),'foreignKey':_0xf465('0x1cc')});db['ZendeskField'][_0xf465('0x119')](db[_0xf465('0xb6')],{'as':'Description','foreignKey':_0xf465('0x1c8')});db['ZendeskField'][_0xf465('0x119')](db[_0xf465('0xb6')],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db[_0xf465('0x8e')],{'as':'Variable','foreignKey':_0xf465('0x1ce')});db[_0xf465('0xb8')][_0xf465('0x119')](db[_0xf465('0x1d2')],{'as':'Configurations','onDelete':_0xf465('0x115'),'foreignKey':'AccountId'});db[_0xf465('0x1d2')][_0xf465('0x119')](db[_0xf465('0xbb')],{'as':_0xf465('0x1c6'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0x1d2')][_0xf465('0x119')](db[_0xf465('0xbb')],{'as':_0xf465('0x1c7'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0x1d2')][_0xf465('0x119')](db[_0xf465('0xbb')],{'as':_0xf465('0x1c1'),'onDelete':_0xf465('0x115'),'foreignKey':'FieldId'});db[_0xf465('0x1d2')][_0xf465('0x128')](db[_0xf465('0xb8')],{'as':_0xf465('0x16d'),'foreignKey':'AccountId'});db[_0xf465('0x1d2')]['belongsToMany'](db['Tag'],{'through':_0xf465('0x1d3')});db[_0xf465('0xbb')][_0xf465('0x119')](db[_0xf465('0xbb')],{'as':_0xf465('0x1ca'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0xbb')][_0xf465('0x119')](db[_0xf465('0xbb')],{'as':'Description','foreignKey':_0xf465('0x1c8')});db['FreshdeskField']['hasMany'](db[_0xf465('0xbb')],{'as':_0xf465('0x1cd'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xf465('0x128')](db[_0xf465('0x8e')],{'as':_0xf465('0x8e'),'foreignKey':'VariableId'});db[_0xf465('0xbd')][_0xf465('0x119')](db[_0xf465('0x1d4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf465('0x1c5')});db[_0xf465('0x1d4')][_0xf465('0x119')](db[_0xf465('0xc0')],{'as':'Subjects','foreignKey':_0xf465('0x1cc')});db['VtigerConfiguration'][_0xf465('0x119')](db[_0xf465('0xc0')],{'as':'Descriptions','foreignKey':_0xf465('0x1c8')});db[_0xf465('0x1d4')][_0xf465('0x119')](db['VtigerField'],{'as':_0xf465('0x1c1'),'foreignKey':_0xf465('0x1c9')});db[_0xf465('0x1d4')]['belongsTo'](db[_0xf465('0xbd')],{'as':'Account','foreignKey':'AccountId'});db['VtigerField'][_0xf465('0x119')](db[_0xf465('0xc0')],{'as':_0xf465('0x1ca'),'foreignKey':'SubjectId'});db[_0xf465('0xc0')]['hasMany'](db[_0xf465('0xc0')],{'as':_0xf465('0x1cb'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xc0')][_0xf465('0x119')](db['VtigerField'],{'as':_0xf465('0x1cd'),'foreignKey':_0xf465('0x1c9')});db[_0xf465('0xc0')][_0xf465('0x128')](db[_0xf465('0x8e')],{'as':'Variable','foreignKey':_0xf465('0x1ce')});db[_0xf465('0xc2')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xf465('0x1c4'),'onDelete':'cascade','foreignKey':_0xf465('0x1c5')});db[_0xf465('0xc4')][_0xf465('0x119')](db[_0xf465('0xc6')],{'as':_0xf465('0x1c6'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0xc4')][_0xf465('0x119')](db[_0xf465('0xc6')],{'as':_0xf465('0x1c7'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xc4')][_0xf465('0x119')](db[_0xf465('0xc6')],{'as':_0xf465('0x1c1'),'foreignKey':'FieldId'});db[_0xf465('0xc4')][_0xf465('0x128')](db[_0xf465('0xc2')],{'as':_0xf465('0x16d'),'foreignKey':'AccountId'});db[_0xf465('0xc6')][_0xf465('0x119')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xf465('0x1cc')});db[_0xf465('0xc6')][_0xf465('0x119')](db[_0xf465('0xc6')],{'as':_0xf465('0x1cb'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0xc6')]['hasMany'](db[_0xf465('0xc6')],{'as':'Field','foreignKey':_0xf465('0x1c9')});db[_0xf465('0xc6')][_0xf465('0x128')](db[_0xf465('0x8e')],{'as':_0xf465('0x8e'),'foreignKey':_0xf465('0x1ce')});db['Dynamics365Account'][_0xf465('0x119')](db[_0xf465('0xca')],{'as':_0xf465('0x1c4'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xc8')]['belongsTo'](db[_0xf465('0x161')],{'as':_0xf465('0x161'),'foreignKey':'CloudProviderId'});db[_0xf465('0xca')]['hasMany'](db[_0xf465('0x1d5')],{'as':_0xf465('0x1c6'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0xca')][_0xf465('0x119')](db[_0xf465('0x1d5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xf465('0x1c8')});db[_0xf465('0xca')][_0xf465('0x119')](db[_0xf465('0x1d5')],{'as':_0xf465('0x1c1'),'onDelete':'cascade','foreignKey':_0xf465('0x1c9')});db[_0xf465('0xca')][_0xf465('0x128')](db[_0xf465('0xc8')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0x1d5')]['hasMany'](db['Dynamics365Field'],{'as':_0xf465('0x1ca'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0x1d5')][_0xf465('0x119')](db[_0xf465('0x1d5')],{'as':_0xf465('0x1cb'),'foreignKey':_0xf465('0x1c8')});db[_0xf465('0x1d5')][_0xf465('0x119')](db[_0xf465('0x1d5')],{'as':_0xf465('0x1cd'),'foreignKey':_0xf465('0x1c9')});db[_0xf465('0x1d5')]['belongsTo'](db[_0xf465('0x8e')],{'as':_0xf465('0x8e'),'foreignKey':'VariableId'});db[_0xf465('0xcd')]['hasMany'](db[_0xf465('0xcf')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xf465('0x119')](db[_0xf465('0xd1')],{'as':_0xf465('0x1c6'),'foreignKey':_0xf465('0x1cc')});db[_0xf465('0xcf')][_0xf465('0x119')](db[_0xf465('0xd1')],{'as':'Descriptions','foreignKey':_0xf465('0x1c8')});db[_0xf465('0xcf')][_0xf465('0x119')](db[_0xf465('0xd1')],{'as':_0xf465('0x1c1'),'foreignKey':_0xf465('0x1c9')});db['FreshsalesConfiguration'][_0xf465('0x128')](db[_0xf465('0xcd')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1c5')});db[_0xf465('0xd1')][_0xf465('0x119')](db[_0xf465('0xd1')],{'as':_0xf465('0x1ca'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0xf465('0x119')](db[_0xf465('0xd1')],{'as':_0xf465('0x1cb'),'foreignKey':'DescriptionId'});db[_0xf465('0xd1')][_0xf465('0x119')](db[_0xf465('0xd1')],{'as':_0xf465('0x1cd'),'foreignKey':'FieldId'});db[_0xf465('0xd1')]['belongsTo'](db[_0xf465('0x8e')],{'as':_0xf465('0x8e'),'foreignKey':_0xf465('0x1ce')});db[_0xf465('0xd5')]['belongsTo'](db['ChatWebsite'],{});db[_0xf465('0xd5')][_0xf465('0x128')](db['CmList'],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db['ChatQueueReport'][_0xf465('0x128')](db['CmContact'],{'as':_0xf465('0x16e'),'foreignKey':'ContactId'});db[_0xf465('0xd5')][_0xf465('0x128')](db[_0xf465('0x63')],{});db[_0xf465('0xd5')]['belongsTo'](db[_0xf465('0x194')],{});db[_0xf465('0xd5')][_0xf465('0x128')](db[_0xf465('0x12')],{});db['ChatQueueReport'][_0xf465('0x128')](db['ChatQueue'],{});db[_0xf465('0x19b')]['belongsTo'](db[_0xf465('0x12')],{'onDelete':'cascade','foreignKey':_0xf465('0x1d6')});db[_0xf465('0x19b')][_0xf465('0x128')](db[_0xf465('0x12')],{'onDelete':'cascade','foreignKey':_0xf465('0x1d7')});db[_0xf465('0xdb')][_0xf465('0x119')](db['JscriptyQuestionReport'],{'foreignKey':_0xf465('0x1d8'),'onDelete':_0xf465('0x115')});db[_0xf465('0xdb')][_0xf465('0x119')](db['JscriptyAnswerReport'],{'foreignKey':_0xf465('0x1d8'),'onDelete':'cascade'});db[_0xf465('0x1d9')][_0xf465('0x128')](db[_0xf465('0x50')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport'][_0xf465('0x128')](db['CmContact'],{'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x1d9')][_0xf465('0x128')](db['SmsInteraction'],{});db[_0xf465('0x1d9')][_0xf465('0x128')](db[_0xf465('0x188')],{});db[_0xf465('0x1d9')][_0xf465('0x128')](db[_0xf465('0x12')],{});db[_0xf465('0x1d9')][_0xf465('0x128')](db[_0xf465('0x56')],{});db[_0xf465('0xe1')]['hasMany'](db[_0xf465('0xdb')],{'foreignKey':_0xf465('0x1da')});db[_0xf465('0xe1')][_0xf465('0x119')](db['JscriptyQuestionReport'],{'foreignKey':_0xf465('0x1da')});db[_0xf465('0xe1')][_0xf465('0x119')](db['JscriptyAnswerReport'],{'foreignKey':_0xf465('0x1da')});db[_0xf465('0xe9')]['belongsToMany'](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':'user_has_teams'});db['Team'][_0xf465('0x12c')](db[_0xf465('0x1b')],{'through':_0xf465('0x158'),'as':_0xf465('0x1db')});db[_0xf465('0xe9')][_0xf465('0x12c')](db[_0xf465('0x3f')],{'through':_0xf465('0x16b'),'as':_0xf465('0x13b')});db[_0xf465('0xe9')][_0xf465('0x12c')](db[_0xf465('0x68')],{'through':_0xf465('0x19a'),'as':_0xf465('0x13c')});db['Team'][_0xf465('0x12c')](db[_0xf465('0x4e')],{'through':_0xf465('0x184'),'as':_0xf465('0x13d')});db['Team'][_0xf465('0x12c')](db[_0xf465('0x56')],{'through':_0xf465('0x18c'),'as':'SmsQueues'});db[_0xf465('0xe9')][_0xf465('0x12c')](db[_0xf465('0x13e')],{'through':_0xf465('0x1dc'),'as':_0xf465('0x13f')});db[_0xf465('0xe9')][_0xf465('0x12c')](db[_0xf465('0x10c')],{'through':_0xf465('0x1dd'),'as':_0xf465('0x141')});db[_0xf465('0xe9')][_0xf465('0x12c')](db['VoicePrefix'],{'through':_0xf465('0x10e'),'as':'VoicePrefixes'});db[_0xf465('0xeb')][_0xf465('0x119')](db[_0xf465('0x6f')],{'as':'Hoppers','foreignKey':_0xf465('0x1a7')});db[_0xf465('0xeb')][_0xf465('0x119')](db[_0xf465('0x11d')],{'as':_0xf465('0x11e'),'foreignKey':_0xf465('0x1a7')});db[_0xf465('0xeb')][_0xf465('0x119')](db[_0xf465('0x11f')],{'as':_0xf465('0x14f'),'foreignKey':'CampaignId'});db[_0xf465('0xeb')][_0xf465('0x119')](db[_0xf465('0x150')],{'as':_0xf465('0x151'),'foreignKey':'CampaignId'});db[_0xf465('0xeb')]['belongsTo'](db[_0xf465('0x153')],{'as':'Trunk','foreignKey':_0xf465('0x1de')});db[_0xf465('0xeb')][_0xf465('0x128')](db[_0xf465('0x153')],{'as':'TrunkBackup','foreignKey':_0xf465('0x1df')});db[_0xf465('0xeb')][_0xf465('0x128')](db['Interval'],{'as':_0xf465('0x7c'),'foreignKey':'IntervalId'});db[_0xf465('0xeb')][_0xf465('0x128')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xf465('0x1e0')});db[_0xf465('0xeb')][_0xf465('0x12c')](db['CmList'],{'as':_0xf465('0x12e'),'through':_0xf465('0x1e1')});db[_0xf465('0xeb')][_0xf465('0x12c')](db[_0xf465('0xf9')],{'as':_0xf465('0x159'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0xf465('0x128')](db[_0xf465('0x66')],{'as':_0xf465('0x66'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0xf465('0x128')](db['MailMessage'],{});db['MailTransferReport'][_0xf465('0x128')](db[_0xf465('0x41')],{});db[_0xf465('0xf3')][_0xf465('0x128')](db[_0xf465('0x3d')],{'foreignKey':_0xf465('0x1e2'),'as':'FromAccount'});db[_0xf465('0xf3')][_0xf465('0x128')](db[_0xf465('0x12')],{'foreignKey':_0xf465('0x1e3'),'as':_0xf465('0x1e4')});db[_0xf465('0xf3')]['belongsTo'](db['User'],{'foreignKey':_0xf465('0x1e5'),'as':_0xf465('0x1e6')});db[_0xf465('0xf3')][_0xf465('0x128')](db[_0xf465('0x3f')],{'foreignKey':_0xf465('0x1e7'),'as':_0xf465('0x1e8')});db[_0xf465('0xf3')]['belongsTo'](db[_0xf465('0x3d')],{'foreignKey':_0xf465('0x1e9'),'as':_0xf465('0x1ea')});db[_0xf465('0xf5')]['belongsTo'](db[_0xf465('0x194')],{});db['ChatTransferReport'][_0xf465('0x128')](db['ChatInteraction'],{});db['ChatTransferReport'][_0xf465('0x128')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xf465('0xf5')]['belongsTo'](db[_0xf465('0x12')],{'foreignKey':_0xf465('0x1e3'),'as':_0xf465('0x1e4')});db['ChatTransferReport'][_0xf465('0x128')](db[_0xf465('0x12')],{'foreignKey':'ToUserId','as':_0xf465('0x1e6')});db['ChatTransferReport'][_0xf465('0x128')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db[_0xf465('0x5e')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db['FaxTransferReport'][_0xf465('0x128')](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db[_0xf465('0x4b')],{});db[_0xf465('0xf7')]['belongsTo'](db[_0xf465('0x48')],{'foreignKey':'FromFaxAccountId','as':_0xf465('0x1eb')});db[_0xf465('0xf7')][_0xf465('0x128')](db[_0xf465('0x12')],{'foreignKey':_0xf465('0x1e3'),'as':_0xf465('0x1e4')});db[_0xf465('0xf7')][_0xf465('0x128')](db[_0xf465('0x12')],{'foreignKey':'ToUserId','as':_0xf465('0x1e6')});db[_0xf465('0xf7')]['belongsTo'](db[_0xf465('0x4e')],{'foreignKey':_0xf465('0x1ec'),'as':'ToQueue'});db['FaxTransferReport'][_0xf465('0x128')](db[_0xf465('0x48')],{'foreignKey':_0xf465('0x1ed'),'as':_0xf465('0x1ea')});db[_0xf465('0xf8')][_0xf465('0x128')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0xf465('0x128')](db[_0xf465('0x5a')],{});db['OpenchannelTransferReport'][_0xf465('0x128')](db[_0xf465('0x57')],{'foreignKey':_0xf465('0x1ee'),'as':'FromAccount'});db[_0xf465('0xf8')][_0xf465('0x128')](db[_0xf465('0x12')],{'foreignKey':_0xf465('0x1e3'),'as':_0xf465('0x1e4')});db[_0xf465('0xf8')][_0xf465('0x128')](db['User'],{'foreignKey':_0xf465('0x1e5'),'as':_0xf465('0x1e6')});db['OpenchannelTransferReport'][_0xf465('0x128')](db[_0xf465('0x13e')],{'foreignKey':_0xf465('0x1ef'),'as':_0xf465('0x1e8')});db['OpenchannelTransferReport'][_0xf465('0x128')](db[_0xf465('0x57')],{'foreignKey':_0xf465('0x1f0'),'as':'ToAccount'});db[_0xf465('0x1f1')]['belongsTo'](db[_0xf465('0x188')],{});db[_0xf465('0x1f1')]['belongsTo'](db['SmsInteraction'],{});db[_0xf465('0x1f1')][_0xf465('0x128')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0xf465('0x1eb')});db[_0xf465('0x1f1')][_0xf465('0x128')](db[_0xf465('0x12')],{'foreignKey':'FromUserId','as':_0xf465('0x1e4')});db[_0xf465('0x1f1')][_0xf465('0x128')](db['User'],{'foreignKey':_0xf465('0x1e5'),'as':_0xf465('0x1e6')});db['SmsTransferReport'][_0xf465('0x128')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xf465('0x1e8')});db[_0xf465('0x1f1')][_0xf465('0x128')](db[_0xf465('0x50')],{'foreignKey':_0xf465('0x1f2'),'as':_0xf465('0x1ea')});db[_0xf465('0xf9')][_0xf465('0x119')](db[_0xf465('0x186')],{'as':_0xf465('0x165'),'foreignKey':_0xf465('0x168'),'onDelete':_0xf465('0x115')});db['CmList']['hasMany'](db['CmCustomField'],{'as':_0xf465('0x1f3'),'foreignKey':'ListId'});db['CmList'][_0xf465('0x119')](db[_0xf465('0x6d')],{'as':_0xf465('0x19e'),'onDelete':_0xf465('0x115'),'foreignKey':'ListId'});db[_0xf465('0xf9')][_0xf465('0x119')](db[_0xf465('0x11d')],{'as':_0xf465('0x11e'),'foreignKey':_0xf465('0x168')});db[_0xf465('0xf9')][_0xf465('0x119')](db[_0xf465('0x11f')],{'as':'HopperHistory','foreignKey':_0xf465('0x168')});db[_0xf465('0xf9')]['hasMany'](db['ReportAgentPreview'],{'as':_0xf465('0x121'),'foreignKey':_0xf465('0x168')});db[_0xf465('0xf9')][_0xf465('0x12c')](db[_0xf465('0x1b')],{'as':_0xf465('0x1f4'),'through':_0xf465('0x156')});db[_0xf465('0xf9')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xf465('0x119')](db['VoiceExtension'],{'as':_0xf465('0x11c'),'onDelete':_0xf465('0x115')});db[_0xf465('0xfa')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x157'),'through':_0xf465('0x110')});db[_0xf465('0xfa')][_0xf465('0x12c')](db['Team'],{'through':_0xf465('0x10e'),'as':_0xf465('0x16c')});db[_0xf465('0xfc')][_0xf465('0x119')](db[_0xf465('0x12')],{'as':_0xf465('0x173'),'foreignKey':_0xf465('0x129')});db[_0xf465('0xfc')][_0xf465('0x119')](db[_0xf465('0xfe')],{'as':_0xf465('0x1f5'),'foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection'][_0xf465('0x119')](db[_0xf465('0x100')],{'as':_0xf465('0x1f6'),'foreignKey':_0xf465('0x1f7'),'onDelete':_0xf465('0x115')});db[_0xf465('0x102')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xf465('0x102')][_0xf465('0x119')](db[_0xf465('0x78')],{'as':_0xf465('0x17e'),'foreignKey':'WhatsappAccountId'});db[_0xf465('0x102')]['hasMany'](db[_0xf465('0x108')],{'as':_0xf465('0x15b'),'foreignKey':_0xf465('0x1f8')});db['WhatsappAccount'][_0xf465('0x119')](db[_0xf465('0x106')],{'as':'Interactions'});db[_0xf465('0x102')]['hasMany'](db[_0xf465('0x104')],{'as':_0xf465('0x18e')});db[_0xf465('0x102')][_0xf465('0x128')](db[_0xf465('0xf9')],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db[_0xf465('0x102')]['belongsTo'](db['Pause'],{'as':_0xf465('0x16a'),'foreignKey':_0xf465('0x155')});db[_0xf465('0x102')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':'Agents','through':_0xf465('0x1f9')});db[_0xf465('0x104')][_0xf465('0x128')](db['User'],{'onDelete':_0xf465('0x162')});db['WhatsappApplication']['belongsTo'](db[_0xf465('0x10c')],{'onDelete':'restrict'});db[_0xf465('0x104')][_0xf465('0x128')](db['WhatsappAccount'],{'onDelete':_0xf465('0x162')});db['WhatsappApplication']['belongsTo'](db[_0xf465('0x7c')],{'onDelete':_0xf465('0x162'),'foreignKey':_0xf465('0x178')});db['WhatsappApplication'][_0xf465('0x128')](db[_0xf465('0x87')],{'onDelete':'restrict','foreignKey':_0xf465('0x179')});db[_0xf465('0x106')][_0xf465('0x119')](db['WhatsappMessage'],{'as':_0xf465('0x15b'),'onDelete':_0xf465('0x115'),'foreignKey':_0xf465('0x1fa')});db[_0xf465('0x106')][_0xf465('0x128')](db['WhatsappAccount'],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1f8')});db[_0xf465('0x106')][_0xf465('0x128')](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x106')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':'Owner','foreignKey':_0xf465('0x117')});db['WhatsappInteraction'][_0xf465('0x12c')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xf465('0x171')});db[_0xf465('0x106')]['belongsToMany'](db[_0xf465('0x87')],{'through':_0xf465('0x1fb'),'as':'ThroughTags'});db['WhatsappInteraction'][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':_0xf465('0x173'),'through':_0xf465('0x139'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db[_0xf465('0x12')],{'as':_0xf465('0x12')});db['WhatsappMessage'][_0xf465('0x128')](db[_0xf465('0x6d')],{'onDelete':'cascade','as':_0xf465('0x16e')});db[_0xf465('0x108')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xf465('0x175'),'foreignKey':_0xf465('0x1fa')});db[_0xf465('0x108')][_0xf465('0x128')](db[_0xf465('0x102')],{'as':_0xf465('0x16d'),'foreignKey':_0xf465('0x1f8')});db[_0xf465('0x1fc')][_0xf465('0x128')](db[_0xf465('0x102')],{});db[_0xf465('0x1fc')]['belongsTo'](db[_0xf465('0xf9')],{'as':_0xf465('0x167'),'foreignKey':_0xf465('0x168')});db['WhatsappQueueReport'][_0xf465('0x128')](db[_0xf465('0x6d')],{'as':_0xf465('0x16e'),'foreignKey':_0xf465('0x17a')});db[_0xf465('0x1fc')][_0xf465('0x128')](db['WhatsappInteraction'],{});db[_0xf465('0x1fc')]['belongsTo'](db[_0xf465('0x10c')],{});db['WhatsappQueueReport'][_0xf465('0x128')](db['WhatsappMessage'],{});db[_0xf465('0x1fc')][_0xf465('0x128')](db[_0xf465('0x12')],{});db[_0xf465('0x10a')]['belongsTo'](db[_0xf465('0x108')],{});db[_0xf465('0x10a')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xf465('0x10a')][_0xf465('0x128')](db[_0xf465('0x102')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xf465('0x1fd'),'as':_0xf465('0x1ea')});db['WhatsappTransferReport']['belongsTo'](db[_0xf465('0x10c')],{'foreignKey':_0xf465('0x1fe'),'as':_0xf465('0x1e8')});db[_0xf465('0x10a')][_0xf465('0x128')](db[_0xf465('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xf465('0x10a')][_0xf465('0x128')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf465('0x10c')][_0xf465('0x12c')](db[_0xf465('0x12')],{'as':'Agents','through':_0xf465('0x37'),'foreignKey':_0xf465('0x1ff')});db['WhatsappQueue'][_0xf465('0x12c')](db[_0xf465('0xe9')],{'through':_0xf465('0x1dd'),'as':'Teams'});db[_0xf465('0x112')][_0xf465('0x128')](db[_0xf465('0x12')],{'as':_0xf465('0x200'),'foreignKey':_0xf465('0x117'),'onDelete':'cascade','hooks':!![]});db[_0xf465('0x161')][_0xf465('0x114')](db[_0xf465('0xc8')],{'as':_0xf465('0xc8'),'onDelete':'restrict'});db[_0xf465('0x161')][_0xf465('0x114')](db[_0xf465('0x39')],{'as':_0xf465('0x201'),'onDelete':'restrict'});db['CloudProvider']['hasOne'](db[_0xf465('0x3b')],{'as':_0xf465('0x164'),'onDelete':'restrict'});module[_0xf465('0x202')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x2d32=['determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','utf8','username','password','sequelizeHistory','database','options','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','User','cascade','UserId','hasOne','hasMany','Recordings','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','belongsToMany','ChatGroup','Groups','chat_group_has_users','CmContact','cm_user_has_contacts','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserChatQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sound','Sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Answers','List','ListId','mandatoryDispositionPauseId','user_has_mail_accounts','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','Account','TagId','Dashboard','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','Interactions','SmsApplication','SmsMessage','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','Contacts','CmContactHasItem','Company','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Automation','OneAll','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','DefaultReportId','AnalyticCustomReport','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','SugarcrmAccount','Description','DeskConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerConfiguration','ServicenowField','Dynamics365Account','FreshsalesField','FromId','ToId','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','ChatQueues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','ChatOfflineMessageId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','voice_queues_has_cm_lists','UserProfileSections','userProfileId','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','sequelize','lodash','jstz'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2d32,0x1ea));var _0x22d3=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2d32[_0x5bd426];return _0x23a7eb;};'use strict';var config=require(_0x22d3('0x0'));var Sequelize=require(_0x22d3('0x1'));var _=require(_0x22d3('0x2'));var jstz=require(_0x22d3('0x3'));var timezone=jstz[_0x22d3('0x4')]();config[_0x22d3('0x1')]=_[_0x22d3('0x5')](config[_0x22d3('0x1')],{'database':_0x22d3('0x6'),'username':_0x22d3('0x7'),'password':_0x22d3('0x8'),'options':{'host':_0x22d3('0x9'),'port':0xcea,'dialect':_0x22d3('0xa'),'dialectOptions':{'charset':_0x22d3('0xb')},'logging':![],'timezone':timezone[_0x22d3('0xc')](),'define':{'charset':'utf8','collate':_0x22d3('0xd')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':'motion2','username':_0x22d3('0x7'),'password':'xC@LL1234','options':{'host':_0x22d3('0x9'),'port':0xcea,'dialect':_0x22d3('0xa'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x22d3('0xc')](),'define':{'charset':_0x22d3('0xe'),'collate':_0x22d3('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x22d3('0x1')]['database'],config[_0x22d3('0x1')][_0x22d3('0xf')],config['sequelize'][_0x22d3('0x10')],config[_0x22d3('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x22d3('0x11')][_0x22d3('0x12')],config[_0x22d3('0x11')][_0x22d3('0xf')],config[_0x22d3('0x11')]['password'],config[_0x22d3('0x11')][_0x22d3('0x13')])};db['User']=db[_0x22d3('0x1')]['import'](_0x22d3('0x14'));db['VoiceChanSpy']=db[_0x22d3('0x1')]['import'](_0x22d3('0x15'));db[_0x22d3('0x16')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x18'));db['VoiceExtension']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x19'));db[_0x22d3('0x1a')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x22d3('0x1b')]=db[_0x22d3('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x1c'));db[_0x22d3('0x1d')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x1e'));db[_0x22d3('0x1f')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/voiceMail/voiceMail.model');db[_0x22d3('0x20')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x21'));db['VoiceCallReport']=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x22d3('0x22')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/voiceDialReport/voiceDialReport.model');db[_0x22d3('0x23')]=db[_0x22d3('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x22d3('0x24')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x25'));db['MemberReport']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x26'));db[_0x22d3('0x27')]=db['sequelize'][_0x22d3('0x17')]('../api/trunk/trunk.model');db[_0x22d3('0x28')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x22d3('0x29')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x2a'));db[_0x22d3('0x2b')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x2c'));db['UserChatQueue']=db[_0x22d3('0x1')]['import'](_0x22d3('0x2d'));db[_0x22d3('0x2e')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x2f'));db[_0x22d3('0x30')]=db[_0x22d3('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x31'));db[_0x22d3('0x32')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x33'));db[_0x22d3('0x34')]=db['sequelize'][_0x22d3('0x17')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x22d3('0x35')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x36'));db[_0x22d3('0x37')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x38'));db[_0x22d3('0x39')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x3a'));db[_0x22d3('0x3b')]=db[_0x22d3('0x1')]['import']('../api/mailQueue/mailQueue.model');db[_0x22d3('0x3c')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x3d'));db[_0x22d3('0x3e')]=db['sequelize'][_0x22d3('0x17')]('../api/mailInteraction/mailInteraction.model');db[_0x22d3('0x3f')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x40'));db[_0x22d3('0x41')]=db[_0x22d3('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x22d3('0x42')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x22d3('0x1')]['import']('../api/dashboard/dashboard.model');db[_0x22d3('0x43')]=db[_0x22d3('0x1')]['import'](_0x22d3('0x44'));db['FaxAccount']=db[_0x22d3('0x1')]['import'](_0x22d3('0x45'));db[_0x22d3('0x46')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/faxApplication/faxApplication.model');db[_0x22d3('0x47')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/faxInteraction/faxInteraction.model');db[_0x22d3('0x48')]=db[_0x22d3('0x1')]['import'](_0x22d3('0x49'));db[_0x22d3('0x4a')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x4b'));db[_0x22d3('0x4c')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x4d'));db['SmsAccount']=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x4e'));db['SmsApplication']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x4f'));db[_0x22d3('0x50')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x51'));db['SmsMessage']=db[_0x22d3('0x1')]['import'](_0x22d3('0x52'));db[_0x22d3('0x53')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x54'));db[_0x22d3('0x55')]=db[_0x22d3('0x1')]['import'](_0x22d3('0x56'));db[_0x22d3('0x57')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x58'));db[_0x22d3('0x59')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x5a'));db[_0x22d3('0x5b')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/openchannelMessage/openchannelMessage.model');db[_0x22d3('0x5c')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/openchannelQueue/openchannelQueue.model');db[_0x22d3('0x5d')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/chatWebsite/chatWebsite.model');db[_0x22d3('0x5e')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x22d3('0x5f')]=db[_0x22d3('0x1')]['import'](_0x22d3('0x60'));db[_0x22d3('0x61')]=db['sequelize'][_0x22d3('0x17')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x22d3('0x1')]['import'](_0x22d3('0x62'));db[_0x22d3('0x63')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x64'));db[_0x22d3('0x65')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/chatGroup/chatGroup.model');db[_0x22d3('0x66')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x67'));db['CmCompany']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x68'));db['CmContact']=db[_0x22d3('0x1')]['import'](_0x22d3('0x69'));db[_0x22d3('0x6a')]=db['sequelize']['import'](_0x22d3('0x6b'));db[_0x22d3('0x6c')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x6d'));db[_0x22d3('0x6e')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x6f'));db[_0x22d3('0x70')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x71'));db[_0x22d3('0x72')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x22d3('0x73')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x74'));db['Action']=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x75'));db['Automation']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x76'));db[_0x22d3('0x77')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x78'));db['Disposition']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x79'));db[_0x22d3('0x7a')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x7b'));db[_0x22d3('0x7c')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x7d'));db[_0x22d3('0x7e')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x7f'));db[_0x22d3('0x80')]=db['sequelize'][_0x22d3('0x17')]('../api/cdr/cdr.model');db[_0x22d3('0x81')]=db[_0x22d3('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x22d3('0x82')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x83'));db['Sound']=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x84'));db[_0x22d3('0x85')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x86'));db[_0x22d3('0x87')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x88'));db['CmContactHasItem']=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x89'));db[_0x22d3('0x8a')]=db['sequelize'][_0x22d3('0x17')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x22d3('0x8b')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x8c'));db[_0x22d3('0x8d')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x8e'));db[_0x22d3('0x8f')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x90'));db['Integration']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x91'));db['IntegrationReport']=db['sequelize'][_0x22d3('0x17')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x22d3('0x1')]['import'](_0x22d3('0x92'));db[_0x22d3('0x93')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x94'));db['AnalyticExtractedReport']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x95'));db['AnalyticMetric']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x96'));db[_0x22d3('0x97')]=db[_0x22d3('0x1')]['import'](_0x22d3('0x98'));db[_0x22d3('0x99')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x9a'));db[_0x22d3('0x9b')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x9c'));db[_0x22d3('0x9d')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x9e'));db['SugarcrmAccount']=db[_0x22d3('0x1')]['import'](_0x22d3('0x9f'));db[_0x22d3('0xa0')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xa1'));db[_0x22d3('0xa2')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xa3'));db[_0x22d3('0xa4')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xa5'));db['DeskConfiguration']=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x22d3('0xa6')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xa7'));db[_0x22d3('0xa8')]=db['sequelize']['import'](_0x22d3('0xa9'));db[_0x22d3('0xaa')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xab'));db[_0x22d3('0xac')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xad'));db['ZendeskAccount']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xae'));db[_0x22d3('0xaf')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xb0'));db[_0x22d3('0xb1')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xb2'));db['FreshdeskAccount']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xb3'));db[_0x22d3('0xb4')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x22d3('0xb5')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xb6'));db[_0x22d3('0xb7')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xb8'));db['VtigerConfiguration']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xb9'));db[_0x22d3('0xba')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/intVtigerField/intVtigerField.model');db[_0x22d3('0xbb')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xbc'));db[_0x22d3('0xbd')]=db['sequelize'][_0x22d3('0x17')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xbe'));db['Dynamics365Account']=db['sequelize']['import']('../api/intDynamics365Account/intDynamics365Account.model');db[_0x22d3('0xbf')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x22d3('0xc0')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xc1'));db[_0x22d3('0xc2')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xc3'));db[_0x22d3('0xc4')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xc5'));db['FreshsalesField']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xc6'));db[_0x22d3('0xc7')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x91'));db[_0x22d3('0xc8')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xc9'));db[_0x22d3('0xca')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xcb'));db[_0x22d3('0xcc')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xcd'));db['JscriptyAnswerReport']=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x22d3('0xce')]=db['sequelize'][_0x22d3('0x17')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x22d3('0xcf')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xd0'));db[_0x22d3('0xd1')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xd2'));db[_0x22d3('0xd3')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xd4'));db['SquareDetailsReport']=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xd5'));db[_0x22d3('0xd6')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0x22d3('0x17')]('../api/setting/setting.model');db[_0x22d3('0xd7')]=db['sequelize']['import'](_0x22d3('0xd8'));db[_0x22d3('0xd9')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xda'));db[_0x22d3('0xdb')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xdc'));db['SquareMessage']=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/squareMessage/squareMessage.model');db[_0x22d3('0xdd')]=db['sequelize']['import'](_0x22d3('0xde'));db[_0x22d3('0xdf')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xe0'));db[_0x22d3('0xe1')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xe2'));db['Migration']=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xe3'));db[_0x22d3('0xe4')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/attachment/attachment.model');db[_0x22d3('0xe5')]=db[_0x22d3('0x1')]['import']('../api/plugin/plugin.model');db[_0x22d3('0xe6')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xe7'));db[_0x22d3('0xe8')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xe9'));db[_0x22d3('0xea')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/faxTransferReport/faxTransferReport.model');db[_0x22d3('0xeb')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xec'));db[_0x22d3('0xed')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xee'));db[_0x22d3('0xef')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x22d3('0xf0')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xf1'));db['UserProfile']=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/userProfile/userProfile.model');db[_0x22d3('0xf2')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x22d3('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x22d3('0xf3')]=db[_0x22d3('0x1')]['import'](_0x22d3('0xf4'));db[_0x22d3('0xf5')]=db[_0x22d3('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x22d3('0xf6')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xf7'));db[_0x22d3('0xf8')]=db['sequelize'][_0x22d3('0x17')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x22d3('0xf9')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xfa'));db[_0x22d3('0xfb')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0xfc'));db[_0x22d3('0xfd')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0xfe'));db[_0x22d3('0xff')]=db['sequelize'][_0x22d3('0x17')](_0x22d3('0x100'));db['CloudProvider']=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/cloudProvider/cloudProvider.model');db[_0x22d3('0x101')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x102'));db[_0x22d3('0x103')]=db[_0x22d3('0x1')][_0x22d3('0x17')](_0x22d3('0x104'));db[_0x22d3('0x105')]=db[_0x22d3('0x1')][_0x22d3('0x17')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x22d3('0x106')]=db[_0x22d3('0x1')]['import'](_0x22d3('0x107'));db[_0x22d3('0x108')]['hasOne'](db[_0x22d3('0x1f')],{'as':'VoiceMail','onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')][_0x22d3('0x10b')](db[_0x22d3('0x106')],{'as':'userSetting','onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')][_0x22d3('0x10c')](db['VoiceRecording'],{'as':_0x22d3('0x10d'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')][_0x22d3('0x10c')](db[_0x22d3('0x29')],{'as':'VoiceQueuesRt','foreignKey':_0x22d3('0x10a')});db['User'][_0x22d3('0x10c')](db[_0x22d3('0x10e')],{'as':_0x22d3('0x10f'),'onDelete':'cascade','hooks':!![]});db[_0x22d3('0x108')]['hasMany'](db['CmHopperFinal'],{'as':_0x22d3('0x110'),'foreignKey':'UserId'});db[_0x22d3('0x108')]['hasMany'](db[_0x22d3('0x70')],{'as':_0x22d3('0x111'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')][_0x22d3('0x10c')](db[_0x22d3('0x72')],{'as':_0x22d3('0x72'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x22d3('0x112'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')][_0x22d3('0x10c')](db[_0x22d3('0x61')],{'as':_0x22d3('0x113'),'foreignKey':'UserId'});db[_0x22d3('0x108')][_0x22d3('0x10c')](db[_0x22d3('0x50')],{'as':'SmsInteractions','foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')]['hasMany'](db[_0x22d3('0x47')],{'as':_0x22d3('0x114'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')][_0x22d3('0x10c')](db[_0x22d3('0x3e')],{'as':_0x22d3('0x115'),'foreignKey':'UserId'});db[_0x22d3('0x108')][_0x22d3('0x10c')](db[_0x22d3('0xf8')],{'as':_0x22d3('0x116'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x108')]['hasMany'](db[_0x22d3('0xf3')],{'as':_0x22d3('0x117'),'foreignKey':'SenderId'});db[_0x22d3('0x108')][_0x22d3('0x118')](db[_0x22d3('0x119')],{'as':_0x22d3('0x119'),'foreignKey':'userProfileId'});db['User'][_0x22d3('0x11a')](db[_0x22d3('0x11b')],{'as':_0x22d3('0x11c'),'through':_0x22d3('0x11d')});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x11e')],{'as':'Contacts','through':_0x22d3('0x11f')});db[_0x22d3('0x108')]['belongsToMany'](db[_0x22d3('0xef')],{'as':'Lists','through':_0x22d3('0x120')});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0xdd')],{'through':'user_has_teams'});db['User'][_0x22d3('0x11a')](db[_0x22d3('0x3e')],{'as':_0x22d3('0x115'),'through':_0x22d3('0x121')});db[_0x22d3('0x108')]['belongsToMany'](db[_0x22d3('0x61')],{'as':_0x22d3('0x113'),'through':_0x22d3('0x122')});db[_0x22d3('0x108')]['belongsToMany'](db[_0x22d3('0x47')],{'as':'FaxInteractions','through':_0x22d3('0x123')});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x50')],{'as':_0x22d3('0x124'),'through':'user_has_sms_interactions'});db['User'][_0x22d3('0x11a')](db[_0x22d3('0x59')],{'as':'OpenchannelInteractions','through':_0x22d3('0x125')});db[_0x22d3('0x108')]['belongsToMany'](db[_0x22d3('0xf8')],{'as':_0x22d3('0x116'),'through':_0x22d3('0x126')});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x1b')],{'as':_0x22d3('0x127'),'through':_0x22d3('0x2b'),'required':![]});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0xf0')],{'as':_0x22d3('0x128'),'through':_0x22d3('0x105'),'required':![]});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x3b')],{'as':_0x22d3('0x129'),'through':_0x22d3('0x2e'),'required':![]});db['User'][_0x22d3('0x11a')](db[_0x22d3('0x65')],{'as':'ChatQueues','through':_0x22d3('0x12a'),'required':![],'hooks':!![]});db[_0x22d3('0x108')]['belongsToMany'](db[_0x22d3('0x4a')],{'as':_0x22d3('0x12b'),'through':_0x22d3('0x30'),'required':![]});db['User'][_0x22d3('0x11a')](db['SmsQueue'],{'as':_0x22d3('0x12c'),'through':_0x22d3('0x12d'),'required':![]});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x5c')],{'as':_0x22d3('0x12e'),'through':_0x22d3('0x32'),'required':![]});db['User'][_0x22d3('0x11a')](db[_0x22d3('0xff')],{'as':_0x22d3('0x12f'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x22d3('0x11a')](db[_0x22d3('0xef')],{'through':'cm_user_has_lists'});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x5d')],{'as':_0x22d3('0x130'),'through':_0x22d3('0x131')});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x132')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x22d3('0x108')][_0x22d3('0x11a')](db[_0x22d3('0x39')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x22d3('0x108')][_0x22d3('0x11a')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x22d3('0x133')});db['User'][_0x22d3('0x11a')](db[_0x22d3('0x134')],{'as':_0x22d3('0x135'),'through':_0x22d3('0x136')});db['User'][_0x22d3('0x11a')](db[_0x22d3('0xf5')],{'as':'WhatsappAccounts','through':_0x22d3('0x137')});db['VoiceChanSpy'][_0x22d3('0x10c')](db[_0x22d3('0x10e')],{'as':'SpiedAgents','onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x138')});db[_0x22d3('0x16')]['hasMany'](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x22d3('0x10e')][_0x22d3('0x10c')](db[_0x22d3('0x10e')],{'as':_0x22d3('0x139'),'onDelete':_0x22d3('0x109')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x22d3('0x13a')],{'as':_0x22d3('0x13b'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x22d3('0x10c')](db['UserVoiceQueueRt'],{'as':_0x22d3('0x13c'),'foreignKey':'VoiceQueueId'});db[_0x22d3('0x1b')]['hasMany'](db[_0x22d3('0x6a')],{'as':_0x22d3('0x13d'),'foreignKey':'VoiceQueueId'});db[_0x22d3('0x1b')]['hasMany'](db[_0x22d3('0x6e')],{'as':'HopperFinals','foreignKey':_0x22d3('0x13e')});db[_0x22d3('0x1b')][_0x22d3('0x10c')](db['CmHopperHistory'],{'as':_0x22d3('0x13f'),'foreignKey':_0x22d3('0x13e')});db[_0x22d3('0x1b')][_0x22d3('0x10c')](db[_0x22d3('0x72')],{'as':_0x22d3('0x72'),'foreignKey':_0x22d3('0x13e')});db[_0x22d3('0x1b')][_0x22d3('0x10c')](db[_0x22d3('0x6c')],{'as':_0x22d3('0x140'),'foreignKey':_0x22d3('0x13e')});db[_0x22d3('0x1b')]['hasMany'](db[_0x22d3('0xcf')],{'as':'JscriptySessions','foreignKey':_0x22d3('0x13e')});db[_0x22d3('0x1b')][_0x22d3('0x118')](db[_0x22d3('0x27')],{'as':_0x22d3('0x27'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0x22d3('0x118')](db[_0x22d3('0x27')],{'as':_0x22d3('0x141'),'foreignKey':_0x22d3('0x142')});db[_0x22d3('0x1b')]['belongsTo'](db['Interval'],{'as':_0x22d3('0x7c'),'foreignKey':_0x22d3('0x143')});db[_0x22d3('0x1b')][_0x22d3('0x118')](db[_0x22d3('0x7e')],{'as':_0x22d3('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x22d3('0x1b')][_0x22d3('0x11a')](db['CmList'],{'as':_0x22d3('0x145'),'through':'voice_queues_has_cm_lists'});db[_0x22d3('0x1b')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':_0x22d3('0x2b')});db[_0x22d3('0x1b')][_0x22d3('0x11a')](db['Team'],{'as':_0x22d3('0x147'),'through':_0x22d3('0x101')});db[_0x22d3('0x1b')][_0x22d3('0x11a')](db[_0x22d3('0xef')],{'as':_0x22d3('0x148'),'through':_0x22d3('0x149')});db[_0x22d3('0x14a')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x108'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x1d')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x108'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x1f')][_0x22d3('0x10c')](db[_0x22d3('0x20')],{'as':_0x22d3('0x14b'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x14c'),'sourceKey':_0x22d3('0x14d')});db[_0x22d3('0x20')][_0x22d3('0x118')](db[_0x22d3('0x1f')],{'foreignKey':_0x22d3('0x14c'),'targetKey':'mailbox'});db[_0x22d3('0x14e')][_0x22d3('0x10c')](db[_0x22d3('0x24')],{'as':_0x22d3('0x14f'),'foreignKey':_0x22d3('0x150'),'constraints':![]});db[_0x22d3('0x14e')][_0x22d3('0x10c')](db[_0x22d3('0x23')],{'as':_0x22d3('0x151'),'foreignKey':_0x22d3('0x150'),'constraints':![]});db[_0x22d3('0x14e')][_0x22d3('0x118')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x22d3('0x14e')][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db[_0x22d3('0x35')][_0x22d3('0x118')](db['MailAccount'],{'as':_0x22d3('0x39'),'foreignKey':_0x22d3('0x154')});db[_0x22d3('0x35')][_0x22d3('0x118')](db[_0x22d3('0x155')],{'as':_0x22d3('0x155'),'foreignKey':_0x22d3('0x156'),'onDelete':'restrict'});db[_0x22d3('0x37')][_0x22d3('0x118')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x22d3('0x37')][_0x22d3('0x118')](db['CloudProvider'],{'as':_0x22d3('0x155'),'foreignKey':_0x22d3('0x156'),'onDelete':_0x22d3('0x157')});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':_0x22d3('0x158'),'onDelete':_0x22d3('0x109')});db['MailAccount'][_0x22d3('0x10b')](db[_0x22d3('0x37')],{'as':_0x22d3('0x159'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x39')][_0x22d3('0x10c')](db[_0x22d3('0x15a')],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x154'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x39')][_0x22d3('0x10c')](db[_0x22d3('0x77')],{'as':_0x22d3('0x15c'),'foreignKey':'MailAccountId'});db[_0x22d3('0x39')][_0x22d3('0x10c')](db[_0x22d3('0x3f')],{'as':_0x22d3('0x14b'),'foreignKey':'MailAccountId'});db[_0x22d3('0x39')]['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0x22d3('0x39')][_0x22d3('0x10c')](db[_0x22d3('0x41')],{'as':_0x22d3('0x139')});db['MailAccount'][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e')});db[_0x22d3('0x39')][_0x22d3('0x118')](db['Template'],{'as':_0x22d3('0x8b'),'foreignKey':'TemplateId'});db[_0x22d3('0x39')][_0x22d3('0x118')](db[_0x22d3('0x7e')],{'as':_0x22d3('0x144'),'foreignKey':_0x22d3('0x15f')});db[_0x22d3('0x39')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':_0x22d3('0x160')});db['MailQueue'][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':_0x22d3('0x2e')});db[_0x22d3('0x3b')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0x22d3('0x147')});db[_0x22d3('0x3e')]['hasMany'](db[_0x22d3('0x3f')],{'as':_0x22d3('0x14b'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x22d3('0x3e')]['belongsTo'](db[_0x22d3('0x39')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x22d3('0x3e')]['belongsTo'](db[_0x22d3('0x11e')],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db['MailInteraction'][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x161'),'foreignKey':'UserId'});db[_0x22d3('0x3e')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':'mail_interaction_has_tags','as':_0x22d3('0x162')});db[_0x22d3('0x3e')][_0x22d3('0x11a')](db['Tag'],{'through':_0x22d3('0x163'),'as':_0x22d3('0x164')});db[_0x22d3('0x3e')]['belongsToMany'](db['User'],{'as':_0x22d3('0x165'),'through':_0x22d3('0x121'),'foreignKey':_0x22d3('0x166')});db['MailMessage'][_0x22d3('0x10c')](db[_0x22d3('0xe4')],{'as':_0x22d3('0x167'),'onDelete':_0x22d3('0x109')});db['MailMessage'][_0x22d3('0x118')](db['User'],{'as':'User'});db[_0x22d3('0x3f')][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x152')});db['MailMessage']['belongsTo'](db[_0x22d3('0x3e')],{'as':'Interaction','foreignKey':_0x22d3('0x166')});db[_0x22d3('0x3f')][_0x22d3('0x118')](db[_0x22d3('0x39')],{'as':_0x22d3('0x168'),'foreignKey':'MailAccountId'});db[_0x22d3('0x3f')][_0x22d3('0x118')](db['ChatWebsite'],{'as':_0x22d3('0x5d'),'foreignKey':'ChatWebsiteId'});db[_0x22d3('0x3f')][_0x22d3('0x118')](db[_0x22d3('0x63')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x22d3('0x41')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'onDelete':'restrict'});db[_0x22d3('0x41')][_0x22d3('0x118')](db[_0x22d3('0x3b')],{'onDelete':'restrict'});db['MailApplication'][_0x22d3('0x118')](db['MailAccount'],{'onDelete':'restrict'});db[_0x22d3('0x41')][_0x22d3('0x118')](db[_0x22d3('0x7c')],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x143')});db[_0x22d3('0x41')][_0x22d3('0x118')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x22d3('0x169')});db[_0x22d3('0x42')][_0x22d3('0x118')](db['MailAccount'],{});db[_0x22d3('0x42')][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e')});db['MailQueueReport'][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'as':_0x22d3('0x152'),'foreignKey':'ContactId'});db[_0x22d3('0x42')][_0x22d3('0x118')](db[_0x22d3('0x3e')],{});db['MailQueueReport']['belongsTo'](db[_0x22d3('0x3f')],{});db['MailQueueReport'][_0x22d3('0x118')](db[_0x22d3('0x108')],{});db['MailQueueReport'][_0x22d3('0x118')](db[_0x22d3('0x3b')],{});db[_0x22d3('0x16a')][_0x22d3('0x10c')](db[_0x22d3('0x43')],{'as':'Items','onDelete':_0x22d3('0x109')});db[_0x22d3('0x132')][_0x22d3('0x10c')](db[_0x22d3('0x15a')],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x16b'),'onDelete':'cascade'});db[_0x22d3('0x132')][_0x22d3('0x10c')](db[_0x22d3('0x77')],{'as':'Answers','foreignKey':_0x22d3('0x16b')});db[_0x22d3('0x132')][_0x22d3('0x10c')](db[_0x22d3('0x47')],{'as':'Interactions'});db[_0x22d3('0x132')]['hasMany'](db[_0x22d3('0x46')],{'as':_0x22d3('0x139')});db[_0x22d3('0x132')]['hasMany'](db[_0x22d3('0x10e')],{'as':_0x22d3('0x16c'),'onDelete':_0x22d3('0x109')});db['FaxAccount'][_0x22d3('0x10c')](db[_0x22d3('0x48')],{'as':_0x22d3('0x14b')});db['FaxAccount'][_0x22d3('0x118')](db['Trunk'],{'as':_0x22d3('0x27')});db[_0x22d3('0x132')][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':'List','foreignKey':_0x22d3('0x15e')});db[_0x22d3('0x132')][_0x22d3('0x118')](db[_0x22d3('0x7e')],{'as':_0x22d3('0x144'),'foreignKey':_0x22d3('0x15f')});db[_0x22d3('0x132')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':'user_has_fax_accounts'});db[_0x22d3('0x46')][_0x22d3('0x118')](db['User'],{'onDelete':'restrict'});db[_0x22d3('0x46')][_0x22d3('0x118')](db[_0x22d3('0x4a')],{'onDelete':_0x22d3('0x157')});db[_0x22d3('0x46')][_0x22d3('0x118')](db[_0x22d3('0x132')],{'onDelete':_0x22d3('0x157')});db[_0x22d3('0x46')][_0x22d3('0x118')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x22d3('0x169')});db[_0x22d3('0x47')][_0x22d3('0x10c')](db[_0x22d3('0x48')],{'as':_0x22d3('0x14b'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x16d')});db[_0x22d3('0x47')][_0x22d3('0x118')](db['FaxAccount'],{'as':_0x22d3('0x168'),'foreignKey':_0x22d3('0x16b')});db['FaxInteraction'][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'as':'Contact','foreignKey':_0x22d3('0x153')});db[_0x22d3('0x47')][_0x22d3('0x118')](db['User'],{'as':_0x22d3('0x161'),'foreignKey':'UserId'});db[_0x22d3('0x47')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':_0x22d3('0x16e'),'as':_0x22d3('0x162')});db['FaxInteraction'][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':_0x22d3('0x16e'),'as':_0x22d3('0x164')});db[_0x22d3('0x47')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':'Users','through':_0x22d3('0x123'),'foreignKey':_0x22d3('0x16d')});db[_0x22d3('0x48')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x108')});db[_0x22d3('0x48')][_0x22d3('0x118')](db['FaxInteraction'],{'as':_0x22d3('0x16f'),'foreignKey':_0x22d3('0x16d')});db['FaxMessage'][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x152')});db[_0x22d3('0x48')][_0x22d3('0x118')](db['Attachment'],{'as':_0x22d3('0xe4'),'foreignKey':_0x22d3('0x170')});db[_0x22d3('0x48')][_0x22d3('0x118')](db['FaxAccount'],{'as':_0x22d3('0x168'),'foreignKey':_0x22d3('0x16b')});db[_0x22d3('0x4a')][_0x22d3('0x11a')](db['User'],{'as':'Agents','through':_0x22d3('0x30')});db[_0x22d3('0x4a')][_0x22d3('0x11a')](db['Team'],{'through':_0x22d3('0x171'),'as':'Teams'});db[_0x22d3('0x4c')][_0x22d3('0x118')](db[_0x22d3('0x132')],{});db[_0x22d3('0x4c')]['belongsTo'](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':'ListId'});db[_0x22d3('0x4c')][_0x22d3('0x118')](db['CmContact'],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db['FaxQueueReport'][_0x22d3('0x118')](db[_0x22d3('0x47')],{});db[_0x22d3('0x4c')][_0x22d3('0x118')](db[_0x22d3('0x48')],{});db[_0x22d3('0x4c')][_0x22d3('0x118')](db[_0x22d3('0x108')],{});db[_0x22d3('0x4c')][_0x22d3('0x118')](db['FaxQueue'],{});db[_0x22d3('0x134')]['hasMany'](db[_0x22d3('0x15a')],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x172'),'onDelete':'cascade'});db[_0x22d3('0x134')][_0x22d3('0x10c')](db['CannedAnswer'],{'as':_0x22d3('0x15c'),'foreignKey':_0x22d3('0x172')});db['SmsAccount']['hasMany'](db['SmsMessage'],{'as':_0x22d3('0x14b'),'foreignKey':'SmsAccountId'});db[_0x22d3('0x134')]['hasMany'](db[_0x22d3('0x50')],{'as':_0x22d3('0x173')});db[_0x22d3('0x134')][_0x22d3('0x10c')](db['SmsApplication'],{'as':'Applications'});db[_0x22d3('0x134')][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e')});db[_0x22d3('0x134')][_0x22d3('0x118')](db[_0x22d3('0x7e')],{'as':_0x22d3('0x144'),'foreignKey':_0x22d3('0x15f')});db['SmsAccount']['belongsToMany'](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x22d3('0x118')](db['User'],{'onDelete':_0x22d3('0x157')});db['SmsApplication'][_0x22d3('0x118')](db[_0x22d3('0x53')],{'onDelete':_0x22d3('0x157')});db[_0x22d3('0x174')][_0x22d3('0x118')](db['SmsAccount'],{'onDelete':_0x22d3('0x157')});db[_0x22d3('0x174')]['belongsTo'](db[_0x22d3('0x7c')],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x143')});db[_0x22d3('0x174')][_0x22d3('0x118')](db[_0x22d3('0x85')],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x169')});db[_0x22d3('0x50')][_0x22d3('0x10c')](db[_0x22d3('0x175')],{'as':_0x22d3('0x14b'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x22d3('0x50')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x22d3('0x50')][_0x22d3('0x118')](db['CmContact'],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db['SmsInteraction'][_0x22d3('0x118')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x22d3('0x50')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':'sms_interaction_has_tags','as':_0x22d3('0x162')});db[_0x22d3('0x50')][_0x22d3('0x11a')](db['Tag'],{'through':_0x22d3('0x176'),'as':'ThroughTags'});db[_0x22d3('0x50')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x165'),'through':_0x22d3('0x177'),'foreignKey':'SmsInteractionId'});db[_0x22d3('0x175')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x108')});db[_0x22d3('0x175')]['belongsTo'](db[_0x22d3('0x11e')],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x152')});db[_0x22d3('0x175')]['belongsTo'](db[_0x22d3('0x50')],{'onDelete':'cascade','as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x22d3('0x175')][_0x22d3('0x118')](db['SmsAccount'],{'as':_0x22d3('0x168'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':_0x22d3('0x12d'),'foreignKey':_0x22d3('0x178')});db['SmsQueue'][_0x22d3('0x11a')](db[_0x22d3('0xdd')],{'through':_0x22d3('0x179'),'as':'Teams'});db[_0x22d3('0x55')][_0x22d3('0x10c')](db[_0x22d3('0x15a')],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x17a'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x55')][_0x22d3('0x10c')](db[_0x22d3('0x77')],{'as':'Answers','foreignKey':_0x22d3('0x17a')});db['OpenchannelAccount'][_0x22d3('0x10c')](db[_0x22d3('0x59')],{'as':_0x22d3('0x173'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x22d3('0x5b')],{'as':_0x22d3('0x14b'),'foreignKey':_0x22d3('0x17a')});db[_0x22d3('0x55')][_0x22d3('0x10c')](db[_0x22d3('0x57')],{'as':'Applications','foreignKey':_0x22d3('0x17a')});db[_0x22d3('0x55')][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e')});db[_0x22d3('0x55')][_0x22d3('0x118')](db['Pause'],{'as':_0x22d3('0x144'),'foreignKey':_0x22d3('0x15f')});db[_0x22d3('0x55')]['belongsToMany'](db[_0x22d3('0x108')],{'as':'Agents','through':_0x22d3('0x133')});db[_0x22d3('0x57')]['belongsTo'](db['User'],{'onDelete':_0x22d3('0x157')});db['OpenchannelApplication'][_0x22d3('0x118')](db[_0x22d3('0x5c')],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x17b')});db[_0x22d3('0x57')][_0x22d3('0x118')](db['OpenchannelAccount'],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x17a')});db[_0x22d3('0x57')][_0x22d3('0x118')](db[_0x22d3('0x7c')],{'onDelete':_0x22d3('0x157'),'foreignKey':'IntervalId'});db[_0x22d3('0x57')][_0x22d3('0x118')](db[_0x22d3('0x85')],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x169')});db['OpenchannelInteraction'][_0x22d3('0x10c')](db[_0x22d3('0x5b')],{'as':_0x22d3('0x14b'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x17c')});db[_0x22d3('0x59')][_0x22d3('0x118')](db[_0x22d3('0x55')],{'as':'Account','foreignKey':_0x22d3('0x17a')});db[_0x22d3('0x59')][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'as':'Contact','foreignKey':_0x22d3('0x153')});db['OpenchannelInteraction'][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x161'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x59')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':_0x22d3('0x17d'),'as':_0x22d3('0x162')});db[_0x22d3('0x59')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':_0x22d3('0x17d'),'as':_0x22d3('0x164')});db[_0x22d3('0x59')][_0x22d3('0x11a')](db['User'],{'as':'Users','through':_0x22d3('0x125'),'foreignKey':_0x22d3('0x17c')});db[_0x22d3('0x5b')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'onDelete':_0x22d3('0x109'),'as':'User'});db[_0x22d3('0x5b')][_0x22d3('0x118')](db['CmContact'],{'onDelete':_0x22d3('0x109'),'as':'Contact'});db[_0x22d3('0x5b')][_0x22d3('0x118')](db[_0x22d3('0x59')],{'onDelete':'cascade','as':_0x22d3('0x16f'),'foreignKey':'OpenchannelInteractionId'});db[_0x22d3('0x5b')][_0x22d3('0x118')](db[_0x22d3('0xe4')],{'as':_0x22d3('0xe4'),'foreignKey':_0x22d3('0x170')});db[_0x22d3('0x5b')][_0x22d3('0x118')](db[_0x22d3('0x55')],{'as':_0x22d3('0x168'),'foreignKey':_0x22d3('0x17a')});db[_0x22d3('0x5c')][_0x22d3('0x11a')](db['User'],{'as':_0x22d3('0x146'),'through':_0x22d3('0x32'),'foreignKey':_0x22d3('0x17b')});db[_0x22d3('0x5c')]['belongsToMany'](db[_0x22d3('0xdd')],{'through':'team_has_openchannel_queues','as':_0x22d3('0x147')});db[_0x22d3('0x5d')][_0x22d3('0x10c')](db[_0x22d3('0x15a')],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x17e'),'onDelete':'cascade'});db['ChatWebsite'][_0x22d3('0x10c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x22d3('0x5d')][_0x22d3('0x10c')](db[_0x22d3('0x66')],{'as':_0x22d3('0x17f')});db[_0x22d3('0x5d')][_0x22d3('0x10c')](db['ChatInteraction'],{'as':_0x22d3('0x173')});db[_0x22d3('0x5d')][_0x22d3('0x10c')](db[_0x22d3('0x5f')],{'as':_0x22d3('0x139')});db['ChatWebsite'][_0x22d3('0x10c')](db['ChatMessage'],{'as':_0x22d3('0x14b')});db[_0x22d3('0x5d')][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e')});db[_0x22d3('0x5d')][_0x22d3('0x118')](db[_0x22d3('0x7c')],{'as':_0x22d3('0x7c'),'foreignKey':_0x22d3('0x143')});db['ChatWebsite'][_0x22d3('0x118')](db[_0x22d3('0x39')],{'as':_0x22d3('0x39'),'foreignKey':_0x22d3('0x154')});db['ChatWebsite'][_0x22d3('0x118')](db['Pause'],{'as':_0x22d3('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x22d3('0x5d')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':_0x22d3('0x131')});db[_0x22d3('0x5e')][_0x22d3('0x118')](db[_0x22d3('0x55')],{});db['OpenchannelQueueReport'][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':'List','foreignKey':'ListId'});db[_0x22d3('0x5e')][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db[_0x22d3('0x5e')][_0x22d3('0x118')](db[_0x22d3('0x59')],{});db[_0x22d3('0x5e')][_0x22d3('0x118')](db[_0x22d3('0x5b')],{});db[_0x22d3('0x5e')][_0x22d3('0x118')](db['User'],{});db[_0x22d3('0x5e')][_0x22d3('0x118')](db[_0x22d3('0x5c')],{});db[_0x22d3('0x5f')]['belongsTo'](db[_0x22d3('0x108')],{'as':_0x22d3('0x180'),'foreignKey':_0x22d3('0x10a'),'onDelete':'restrict'});db[_0x22d3('0x5f')][_0x22d3('0x118')](db[_0x22d3('0x65')],{'as':_0x22d3('0x181'),'foreignKey':_0x22d3('0x182'),'onDelete':_0x22d3('0x157')});db[_0x22d3('0x5f')][_0x22d3('0x118')](db[_0x22d3('0x5d')],{'as':_0x22d3('0x183'),'foreignKey':_0x22d3('0x17e'),'onDelete':_0x22d3('0x157')});db[_0x22d3('0x5f')][_0x22d3('0x118')](db['Tag'],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x169')});db[_0x22d3('0x61')][_0x22d3('0x10c')](db[_0x22d3('0x184')],{'as':_0x22d3('0x14b'),'onDelete':'cascade','foreignKey':_0x22d3('0x185')});db[_0x22d3('0x61')][_0x22d3('0x118')](db[_0x22d3('0x5d')],{'as':_0x22d3('0x168'),'foreignKey':_0x22d3('0x17e')});db['ChatInteraction']['belongsTo'](db[_0x22d3('0x11e')],{'as':_0x22d3('0x152'),'foreignKey':'ContactId'});db[_0x22d3('0x61')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x161'),'foreignKey':_0x22d3('0x10a')});db['ChatInteraction']['belongsToMany'](db[_0x22d3('0x85')],{'through':_0x22d3('0x186'),'as':'Tags'});db[_0x22d3('0x61')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':_0x22d3('0x186'),'as':'ThroughTags'});db[_0x22d3('0x61')]['belongsToMany'](db[_0x22d3('0x108')],{'as':_0x22d3('0x165'),'through':'user_has_chat_interactions','foreignKey':_0x22d3('0x185')});db[_0x22d3('0x184')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x108')});db[_0x22d3('0x184')][_0x22d3('0x118')](db[_0x22d3('0x11e')],{'onDelete':'cascade','as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db[_0x22d3('0x184')][_0x22d3('0x118')](db[_0x22d3('0x61')],{'onDelete':'cascade','as':_0x22d3('0x16f'),'foreignKey':_0x22d3('0x185')});db[_0x22d3('0x184')][_0x22d3('0x118')](db[_0x22d3('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x22d3('0x184')][_0x22d3('0x118')](db[_0x22d3('0x5d')],{'as':'Account','foreignKey':_0x22d3('0x17e')});db[_0x22d3('0x63')][_0x22d3('0x10c')](db['Attachment'],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x22d3('0x109'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0x22d3('0x11e')],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db[_0x22d3('0x63')][_0x22d3('0x118')](db[_0x22d3('0x5d')],{'as':_0x22d3('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x22d3('0x65')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':'Agents','through':_0x22d3('0x12a'),'hooks':!![]});db['ChatQueue'][_0x22d3('0x11a')](db[_0x22d3('0xdd')],{'through':_0x22d3('0x187'),'as':'Teams'});db[_0x22d3('0x11b')]['hasMany'](db[_0x22d3('0xcc')],{'as':_0x22d3('0x14b'),'foreignKey':_0x22d3('0x188'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x11b')][_0x22d3('0x11a')](db['User'],{'as':'Members','through':'chat_group_has_users'});db[_0x22d3('0x66')][_0x22d3('0x118')](db['ChatWebsite'],{'as':_0x22d3('0x183'),'foreignKey':'ChatWebsiteId'});db[_0x22d3('0x189')][_0x22d3('0x10c')](db[_0x22d3('0x11e')],{'as':_0x22d3('0x18a'),'foreignKey':'CompanyId'});db[_0x22d3('0x11e')][_0x22d3('0x10c')](db[_0x22d3('0x18b')],{'as':'Phones','foreignKey':'CmContactId'});db[_0x22d3('0x11e')][_0x22d3('0x10c')](db[_0x22d3('0x6a')],{'as':'Hoppers','foreignKey':_0x22d3('0x153')});db[_0x22d3('0x11e')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x22d3('0x153')});db[_0x22d3('0x11e')][_0x22d3('0x10c')](db[_0x22d3('0x70')],{'as':_0x22d3('0x13f'),'foreignKey':_0x22d3('0x153')});db['CmContact'][_0x22d3('0x10c')](db[_0x22d3('0x72')],{'as':_0x22d3('0x72'),'foreignKey':_0x22d3('0x153')});db[_0x22d3('0x11e')]['hasMany'](db[_0x22d3('0xcf')],{'as':'JscriptySessions','foreignKey':_0x22d3('0x153')});db['CmContact']['hasMany'](db[_0x22d3('0x59')],{'as':_0x22d3('0x112'),'foreignKey':_0x22d3('0x153'),'onDelete':'restrict'});db[_0x22d3('0x11e')][_0x22d3('0x10c')](db[_0x22d3('0x61')],{'as':_0x22d3('0x113'),'foreignKey':_0x22d3('0x153'),'onDelete':_0x22d3('0x157')});db[_0x22d3('0x11e')]['hasMany'](db[_0x22d3('0x50')],{'as':_0x22d3('0x124'),'foreignKey':_0x22d3('0x153'),'onDelete':_0x22d3('0x157')});db[_0x22d3('0x11e')][_0x22d3('0x10c')](db[_0x22d3('0x47')],{'as':'FaxInteractions','foreignKey':_0x22d3('0x153'),'onDelete':'restrict'});db['CmContact'][_0x22d3('0x10c')](db[_0x22d3('0x3e')],{'as':'MailInteractions','foreignKey':_0x22d3('0x153'),'onDelete':_0x22d3('0x157')});db['CmContact'][_0x22d3('0x118')](db[_0x22d3('0x189')],{'as':_0x22d3('0x18c'),'foreignKey':_0x22d3('0x18d')});db[_0x22d3('0x11e')][_0x22d3('0x118')](db['CmList'],{'as':_0x22d3('0x15d'),'foreignKey':'ListId','onDelete':_0x22d3('0x109')});db[_0x22d3('0x11e')][_0x22d3('0x11a')](db['User'],{'as':'Users','through':_0x22d3('0x11f')});db[_0x22d3('0x11e')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'as':_0x22d3('0x162'),'through':_0x22d3('0x18e')});db['CmContact']['belongsToMany'](db[_0x22d3('0x85')],{'through':_0x22d3('0x18e'),'as':_0x22d3('0x164')});db[_0x22d3('0x6a')][_0x22d3('0x10c')](db[_0x22d3('0x8a')],{'as':_0x22d3('0x18f'),'foreignKey':_0x22d3('0x190')});db[_0x22d3('0x6a')]['belongsTo'](db[_0x22d3('0x11e')],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153'),'onDelete':_0x22d3('0x109')});db['CmHopper'][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':'ListId','onDelete':_0x22d3('0x109')});db[_0x22d3('0x6a')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x180'),'foreignKey':_0x22d3('0x10a')});db[_0x22d3('0x6a')][_0x22d3('0x118')](db[_0x22d3('0x1b')],{'as':'Queue','foreignKey':_0x22d3('0x13e'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x6a')][_0x22d3('0x118')](db[_0x22d3('0xe1')],{'as':_0x22d3('0xe1'),'foreignKey':_0x22d3('0x191'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x6a')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x161'),'foreignKey':_0x22d3('0x192')});db[_0x22d3('0x6c')]['belongsTo'](db[_0x22d3('0x11e')],{'as':'Contact','foreignKey':_0x22d3('0x153'),'onDelete':'cascade'});db[_0x22d3('0x6c')][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e'),'onDelete':'cascade'});db[_0x22d3('0x6c')][_0x22d3('0x118')](db['VoiceQueue'],{'as':_0x22d3('0x181'),'foreignKey':_0x22d3('0x13e'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x6c')][_0x22d3('0x118')](db[_0x22d3('0xe1')],{'as':_0x22d3('0xe1'),'foreignKey':_0x22d3('0x191'),'onDelete':'cascade'});db[_0x22d3('0x193')][_0x22d3('0x10c')](db[_0x22d3('0x7a')],{'as':{'plural':'All','singular':_0x22d3('0x194')},'foreignKey':'AutomationAllId','onDelete':_0x22d3('0x109'),'hooks':!![]});db[_0x22d3('0x193')][_0x22d3('0x10c')](db[_0x22d3('0x7a')],{'as':{'plural':_0x22d3('0x195'),'singular':_0x22d3('0x196')},'foreignKey':_0x22d3('0x197'),'onDelete':_0x22d3('0x109'),'hooks':!![]});db['Automation'][_0x22d3('0x10c')](db[_0x22d3('0x198')],{'as':_0x22d3('0x199'),'foreignKey':_0x22d3('0x19a'),'onDelete':_0x22d3('0x109'),'hooks':!![]});db['Disposition'][_0x22d3('0x10c')](db['Disposition'],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x19b'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0x7c')][_0x22d3('0x10c')](db[_0x22d3('0x7c')],{'as':_0x22d3('0x19c'),'foreignKey':_0x22d3('0x143'),'onDelete':_0x22d3('0x109'),'hooks':!![],'required':![]});db[_0x22d3('0x7c')][_0x22d3('0x10c')](db[_0x22d3('0x10e')],{'as':_0x22d3('0x10f'),'foreignKey':_0x22d3('0x143'),'onDelete':'restrict'});db['Interval'][_0x22d3('0x10c')](db['MailApplication'],{'as':_0x22d3('0x19d'),'foreignKey':_0x22d3('0x143')});db[_0x22d3('0x7c')][_0x22d3('0x10c')](db[_0x22d3('0x5f')],{'as':'ChatApplications','foreignKey':_0x22d3('0x143')});db[_0x22d3('0x7c')][_0x22d3('0x10c')](db[_0x22d3('0x46')],{'as':'FaxApplications','foreignKey':_0x22d3('0x143')});db['Interval'][_0x22d3('0x10c')](db[_0x22d3('0x174')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x22d3('0x82')][_0x22d3('0x118')](db[_0x22d3('0x39')],{});db['Schedule'][_0x22d3('0x118')](db[_0x22d3('0x93')],{'foreignKey':_0x22d3('0x19e')});db[_0x22d3('0x82')][_0x22d3('0x118')](db[_0x22d3('0x19f')],{'foreignKey':'CustomReportId'});db[_0x22d3('0x13a')][_0x22d3('0x11a')](db['VoiceMusicOnHold'],{'as':_0x22d3('0x1a0'),'through':_0x22d3('0x1a1'),'onDelete':_0x22d3('0x157')});db[_0x22d3('0x85')][_0x22d3('0x11a')](db[_0x22d3('0x11e')],{'through':'cm_contact_has_tags'});db['Tag']['belongsToMany'](db[_0x22d3('0x61')],{'through':'chat_interaction_has_tags'});db[_0x22d3('0x85')]['belongsToMany'](db[_0x22d3('0x3e')],{'through':'mail_interaction_has_tags'});db[_0x22d3('0x85')][_0x22d3('0x11a')](db[_0x22d3('0x50')],{'through':_0x22d3('0x176')});db['Tag']['belongsToMany'](db['FaxInteraction'],{'through':_0x22d3('0x16e')});db[_0x22d3('0x85')][_0x22d3('0x11a')](db[_0x22d3('0x59')],{'through':'openchannel_interaction_has_tags'});db[_0x22d3('0x85')]['belongsToMany'](db[_0x22d3('0xf8')],{'through':_0x22d3('0x1a2')});db[_0x22d3('0x18b')]['belongsTo'](db[_0x22d3('0x87')],{'as':_0x22d3('0x1a3'),'foreignKey':'ItemTypeId'});db[_0x22d3('0x8a')][_0x22d3('0x118')](db[_0x22d3('0x6a')],{'as':'Hopper','foreignKey':_0x22d3('0x190')});db[_0x22d3('0x18b')]['belongsTo'](db[_0x22d3('0x11e')],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x1a4')});db[_0x22d3('0x8d')]['hasMany'](db['Condition'],{'as':{'plural':_0x22d3('0x1a5'),'singular':_0x22d3('0x1a6')},'foreignKey':_0x22d3('0x1a7'),'onDelete':'cascade','hooks':!![]});db[_0x22d3('0x8d')]['hasMany'](db[_0x22d3('0x7a')],{'as':{'plural':_0x22d3('0x1a8'),'singular':_0x22d3('0x1a9')},'foreignKey':_0x22d3('0x1aa'),'onDelete':_0x22d3('0x109'),'hooks':!![]});db[_0x22d3('0x8d')][_0x22d3('0x10c')](db[_0x22d3('0x198')],{'as':_0x22d3('0x199'),'foreignKey':'TriggerId','onDelete':_0x22d3('0x109'),'hooks':!![]});db[_0x22d3('0x19f')][_0x22d3('0x10c')](db['AnalyticFieldReport'],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x22d3('0x97')],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x19e')});db['AnalyticMetric'][_0x22d3('0x10c')](db[_0x22d3('0x97')],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':'MetricId'});db['AnalyticFieldReport']['belongsTo'](db[_0x22d3('0x1ac')],{'foreignKey':_0x22d3('0x1ad')});db[_0x22d3('0x9b')][_0x22d3('0x10c')](db[_0x22d3('0x1ae')],{'as':_0x22d3('0x1af'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b0')});db[_0x22d3('0x1ae')]['hasMany'](db['SalesforceField'],{'as':_0x22d3('0x1b1'),'onDelete':'cascade','foreignKey':_0x22d3('0x1b2')});db['SalesforceConfiguration'][_0x22d3('0x10c')](db[_0x22d3('0x9d')],{'as':_0x22d3('0x1b3'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0x1ae')][_0x22d3('0x10c')](db[_0x22d3('0x9d')],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b5')});db['SalesforceConfiguration']['belongsTo'](db[_0x22d3('0x9b')],{'as':_0x22d3('0x168'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x22d3('0x1b6'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0x9d')][_0x22d3('0x10c')](db['SalesforceField'],{'as':'Description','foreignKey':_0x22d3('0x1b4')});db['SalesforceField']['hasMany'](db[_0x22d3('0x9d')],{'as':_0x22d3('0x1b7'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0x9d')][_0x22d3('0x118')](db[_0x22d3('0x8f')],{'as':_0x22d3('0x8f'),'foreignKey':_0x22d3('0x1b8')});db[_0x22d3('0x1b9')][_0x22d3('0x10c')](db[_0x22d3('0xa0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x22d3('0x1b0')});db[_0x22d3('0xa0')][_0x22d3('0x10c')](db[_0x22d3('0xa2')],{'as':_0x22d3('0x1b1'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x22d3('0xa0')][_0x22d3('0x10c')](db['SugarcrmField'],{'as':_0x22d3('0x1b3'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xa0')]['hasMany'](db['SugarcrmField'],{'as':_0x22d3('0x1ab'),'onDelete':'cascade','foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xa0')][_0x22d3('0x118')](db[_0x22d3('0x1b9')],{'as':_0x22d3('0x168'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x22d3('0x10c')](db[_0x22d3('0xa2')],{'as':_0x22d3('0x1b6'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xa2')][_0x22d3('0x10c')](db['SugarcrmField'],{'as':_0x22d3('0x1ba'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xa2')]['hasMany'](db['SugarcrmField'],{'as':_0x22d3('0x1b7'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xa2')][_0x22d3('0x118')](db[_0x22d3('0x8f')],{'as':'Variable','foreignKey':'VariableId'});db[_0x22d3('0xa4')]['hasMany'](db[_0x22d3('0x1bb')],{'as':_0x22d3('0x1af'),'onDelete':_0x22d3('0x109'),'foreignKey':'AccountId'});db[_0x22d3('0x1bb')][_0x22d3('0x10c')](db[_0x22d3('0xa6')],{'as':'Subjects','onDelete':_0x22d3('0x109'),'foreignKey':'SubjectId'});db[_0x22d3('0x1bb')]['hasMany'](db[_0x22d3('0xa6')],{'as':_0x22d3('0x1b3'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0x1bb')][_0x22d3('0x10c')](db['DeskField'],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0x1bb')][_0x22d3('0x118')](db['DeskAccount'],{'as':_0x22d3('0x168'),'foreignKey':_0x22d3('0x1b0')});db['DeskConfiguration']['belongsToMany'](db[_0x22d3('0x85')],{'through':_0x22d3('0x1bc')});db['DeskField'][_0x22d3('0x10c')](db['DeskField'],{'as':_0x22d3('0x1b6'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xa6')][_0x22d3('0x10c')](db[_0x22d3('0xa6')],{'as':_0x22d3('0x1ba'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xa6')]['hasMany'](db['DeskField'],{'as':_0x22d3('0x1b7'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db['Variable'],{'as':_0x22d3('0x8f'),'foreignKey':_0x22d3('0x1b8')});db['ZohoAccount'][_0x22d3('0x10c')](db['ZohoConfiguration'],{'as':_0x22d3('0x1af'),'onDelete':_0x22d3('0x109'),'foreignKey':'AccountId'});db[_0x22d3('0xaa')][_0x22d3('0x10c')](db[_0x22d3('0xac')],{'as':_0x22d3('0x1b1'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xaa')]['hasMany'](db[_0x22d3('0xac')],{'as':_0x22d3('0x1b3'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xaa')][_0x22d3('0x10c')](db[_0x22d3('0xac')],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xaa')]['belongsTo'](db[_0x22d3('0xa8')],{'as':_0x22d3('0x168'),'foreignKey':'AccountId'});db[_0x22d3('0xac')][_0x22d3('0x10c')](db[_0x22d3('0xac')],{'as':_0x22d3('0x1b6'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xac')]['hasMany'](db[_0x22d3('0xac')],{'as':_0x22d3('0x1ba'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xac')][_0x22d3('0x10c')](db[_0x22d3('0xac')],{'as':'Field','foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xac')][_0x22d3('0x118')](db['Variable'],{'as':_0x22d3('0x8f'),'foreignKey':_0x22d3('0x1b8')});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':_0x22d3('0x1af'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b0')});db['ZendeskConfiguration']['hasMany'](db[_0x22d3('0xb1')],{'as':'Subjects','foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xaf')]['hasMany'](db[_0x22d3('0xb1')],{'as':'Descriptions','foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xaf')][_0x22d3('0x10c')](db['ZendeskField'],{'as':_0x22d3('0x1ab'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xaf')][_0x22d3('0x118')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x22d3('0x1b0')});db[_0x22d3('0xaf')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':_0x22d3('0x1bd')});db[_0x22d3('0xb1')]['hasMany'](db['ZendeskField'],{'as':_0x22d3('0x1b6'),'foreignKey':'SubjectId'});db[_0x22d3('0xb1')][_0x22d3('0x10c')](db[_0x22d3('0xb1')],{'as':_0x22d3('0x1ba'),'foreignKey':_0x22d3('0x1b4')});db['ZendeskField'][_0x22d3('0x10c')](db[_0x22d3('0xb1')],{'as':_0x22d3('0x1b7'),'foreignKey':_0x22d3('0x1b5')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':_0x22d3('0x8f'),'foreignKey':'VariableId'});db[_0x22d3('0x1be')][_0x22d3('0x10c')](db[_0x22d3('0xb4')],{'as':'Configurations','onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b0')});db[_0x22d3('0xb4')][_0x22d3('0x10c')](db['FreshdeskField'],{'as':_0x22d3('0x1b1'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xb4')][_0x22d3('0x10c')](db[_0x22d3('0xb5')],{'as':_0x22d3('0x1b3'),'onDelete':_0x22d3('0x109'),'foreignKey':'DescriptionId'});db[_0x22d3('0xb4')][_0x22d3('0x10c')](db[_0x22d3('0xb5')],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xb4')]['belongsTo'](db[_0x22d3('0x1be')],{'as':_0x22d3('0x168'),'foreignKey':_0x22d3('0x1b0')});db['FreshdeskConfiguration']['belongsToMany'](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x22d3('0xb5')][_0x22d3('0x10c')](db['FreshdeskField'],{'as':_0x22d3('0x1b6'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xb5')][_0x22d3('0x10c')](db['FreshdeskField'],{'as':_0x22d3('0x1ba'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xb5')][_0x22d3('0x10c')](db['FreshdeskField'],{'as':_0x22d3('0x1b7'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xb5')]['belongsTo'](db[_0x22d3('0x8f')],{'as':_0x22d3('0x8f'),'foreignKey':_0x22d3('0x1b8')});db[_0x22d3('0xb7')][_0x22d3('0x10c')](db['VtigerConfiguration'],{'as':_0x22d3('0x1af'),'onDelete':'cascade','foreignKey':_0x22d3('0x1b0')});db[_0x22d3('0x1bf')][_0x22d3('0x10c')](db[_0x22d3('0xba')],{'as':_0x22d3('0x1b1'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0x1bf')][_0x22d3('0x10c')](db[_0x22d3('0xba')],{'as':_0x22d3('0x1b3'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0x1bf')][_0x22d3('0x10c')](db[_0x22d3('0xba')],{'as':'Fields','foreignKey':'FieldId'});db[_0x22d3('0x1bf')]['belongsTo'](db[_0x22d3('0xb7')],{'as':'Account','foreignKey':_0x22d3('0x1b0')});db['VtigerField'][_0x22d3('0x10c')](db[_0x22d3('0xba')],{'as':_0x22d3('0x1b6'),'foreignKey':_0x22d3('0x1b2')});db['VtigerField'][_0x22d3('0x10c')](db['VtigerField'],{'as':_0x22d3('0x1ba'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xba')][_0x22d3('0x10c')](db[_0x22d3('0xba')],{'as':_0x22d3('0x1b7'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xba')][_0x22d3('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0x22d3('0x1b8')});db['ServicenowAccount']['hasMany'](db[_0x22d3('0xbd')],{'as':_0x22d3('0x1af'),'onDelete':_0x22d3('0x109'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x22d3('0x10c')](db[_0x22d3('0x1c0')],{'as':_0x22d3('0x1b1'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xbd')][_0x22d3('0x10c')](db[_0x22d3('0x1c0')],{'as':'Descriptions','foreignKey':_0x22d3('0x1b4')});db['ServicenowConfiguration'][_0x22d3('0x10c')](db[_0x22d3('0x1c0')],{'as':_0x22d3('0x1ab'),'foreignKey':_0x22d3('0x1b5')});db['ServicenowConfiguration']['belongsTo'](db[_0x22d3('0xbb')],{'as':'Account','foreignKey':'AccountId'});db[_0x22d3('0x1c0')][_0x22d3('0x10c')](db[_0x22d3('0x1c0')],{'as':_0x22d3('0x1b6'),'foreignKey':'SubjectId'});db[_0x22d3('0x1c0')]['hasMany'](db[_0x22d3('0x1c0')],{'as':_0x22d3('0x1ba'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0x1c0')][_0x22d3('0x10c')](db[_0x22d3('0x1c0')],{'as':_0x22d3('0x1b7'),'foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0x1c0')][_0x22d3('0x118')](db[_0x22d3('0x8f')],{'as':_0x22d3('0x8f'),'foreignKey':_0x22d3('0x1b8')});db['Dynamics365Account']['hasMany'](db[_0x22d3('0xbf')],{'as':_0x22d3('0x1af'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b0')});db[_0x22d3('0x1c1')]['belongsTo'](db[_0x22d3('0x155')],{'as':'CloudProvider','foreignKey':_0x22d3('0x156')});db[_0x22d3('0xbf')]['hasMany'](db[_0x22d3('0xc0')],{'as':'Subjects','onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xbf')]['hasMany'](db['Dynamics365Field'],{'as':_0x22d3('0x1b3'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0xbf')][_0x22d3('0x10c')](db[_0x22d3('0xc0')],{'as':_0x22d3('0x1ab'),'onDelete':_0x22d3('0x109'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x22d3('0x118')](db[_0x22d3('0x1c1')],{'as':_0x22d3('0x168'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0x22d3('0x10c')](db[_0x22d3('0xc0')],{'as':_0x22d3('0x1b6'),'foreignKey':'SubjectId'});db[_0x22d3('0xc0')]['hasMany'](db[_0x22d3('0xc0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x22d3('0xc0')][_0x22d3('0x10c')](db[_0x22d3('0xc0')],{'as':'Field','foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0xc0')]['belongsTo'](db['Variable'],{'as':_0x22d3('0x8f'),'foreignKey':_0x22d3('0x1b8')});db[_0x22d3('0xc2')][_0x22d3('0x10c')](db['FreshsalesConfiguration'],{'as':_0x22d3('0x1af'),'onDelete':_0x22d3('0x109'),'foreignKey':'AccountId'});db[_0x22d3('0xc4')][_0x22d3('0x10c')](db[_0x22d3('0x1c2')],{'as':_0x22d3('0x1b1'),'foreignKey':_0x22d3('0x1b2')});db[_0x22d3('0xc4')][_0x22d3('0x10c')](db[_0x22d3('0x1c2')],{'as':_0x22d3('0x1b3'),'foreignKey':_0x22d3('0x1b4')});db['FreshsalesConfiguration']['hasMany'](db[_0x22d3('0x1c2')],{'as':_0x22d3('0x1ab'),'foreignKey':'FieldId'});db[_0x22d3('0xc4')][_0x22d3('0x118')](db['FreshsalesAccount'],{'as':_0x22d3('0x168'),'foreignKey':'AccountId'});db[_0x22d3('0x1c2')][_0x22d3('0x10c')](db[_0x22d3('0x1c2')],{'as':_0x22d3('0x1b6'),'foreignKey':'SubjectId'});db[_0x22d3('0x1c2')][_0x22d3('0x10c')](db[_0x22d3('0x1c2')],{'as':'Description','foreignKey':_0x22d3('0x1b4')});db[_0x22d3('0x1c2')][_0x22d3('0x10c')](db[_0x22d3('0x1c2')],{'as':'Field','foreignKey':_0x22d3('0x1b5')});db[_0x22d3('0x1c2')][_0x22d3('0x118')](db['Variable'],{'as':_0x22d3('0x8f'),'foreignKey':_0x22d3('0x1b8')});db['ChatQueueReport'][_0x22d3('0x118')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x22d3('0x118')](db[_0x22d3('0xef')],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e')});db[_0x22d3('0xca')][_0x22d3('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0x22d3('0x153')});db[_0x22d3('0xca')][_0x22d3('0x118')](db[_0x22d3('0x61')],{});db[_0x22d3('0xca')][_0x22d3('0x118')](db['ChatMessage'],{});db[_0x22d3('0xca')][_0x22d3('0x118')](db[_0x22d3('0x108')],{});db[_0x22d3('0xca')]['belongsTo'](db[_0x22d3('0x65')],{});db[_0x22d3('0xcc')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'onDelete':'cascade','foreignKey':_0x22d3('0x1c3')});db[_0x22d3('0xcc')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'onDelete':'cascade','foreignKey':_0x22d3('0x1c4')});db[_0x22d3('0xcf')][_0x22d3('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':_0x22d3('0x1c5'),'onDelete':_0x22d3('0x109')});db['JscriptySessionReport'][_0x22d3('0x10c')](db[_0x22d3('0x1c6')],{'foreignKey':_0x22d3('0x1c5'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0xd1')]['belongsTo'](db[_0x22d3('0x134')],{});db['SmsQueueReport'][_0x22d3('0x118')](db['CmList'],{'as':_0x22d3('0x15d'),'foreignKey':_0x22d3('0x15e')});db[_0x22d3('0xd1')]['belongsTo'](db[_0x22d3('0x11e')],{'as':'Contact','foreignKey':_0x22d3('0x153')});db[_0x22d3('0xd1')]['belongsTo'](db[_0x22d3('0x50')],{});db[_0x22d3('0xd1')][_0x22d3('0x118')](db[_0x22d3('0x175')],{});db['SmsQueueReport']['belongsTo'](db[_0x22d3('0x108')],{});db['SmsQueueReport'][_0x22d3('0x118')](db[_0x22d3('0x53')],{});db[_0x22d3('0xd6')][_0x22d3('0x10c')](db[_0x22d3('0xcf')],{'foreignKey':_0x22d3('0x1c7')});db[_0x22d3('0xd6')]['hasMany'](db[_0x22d3('0xce')],{'foreignKey':_0x22d3('0x1c7')});db[_0x22d3('0xd6')]['hasMany'](db[_0x22d3('0x1c6')],{'foreignKey':_0x22d3('0x1c7')});db[_0x22d3('0xdd')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':'user_has_teams'});db[_0x22d3('0xdd')][_0x22d3('0x11a')](db[_0x22d3('0x1b')],{'through':'TeamVoiceQueue','as':_0x22d3('0x127')});db[_0x22d3('0xdd')][_0x22d3('0x11a')](db[_0x22d3('0x3b')],{'through':_0x22d3('0x1c8'),'as':_0x22d3('0x129')});db[_0x22d3('0xdd')]['belongsToMany'](db[_0x22d3('0x65')],{'through':_0x22d3('0x187'),'as':_0x22d3('0x1c9')});db[_0x22d3('0xdd')]['belongsToMany'](db[_0x22d3('0x4a')],{'through':_0x22d3('0x171'),'as':_0x22d3('0x12b')});db[_0x22d3('0xdd')][_0x22d3('0x11a')](db['SmsQueue'],{'through':_0x22d3('0x179'),'as':_0x22d3('0x12c')});db[_0x22d3('0xdd')][_0x22d3('0x11a')](db['OpenchannelQueue'],{'through':_0x22d3('0x1ca'),'as':_0x22d3('0x12e')});db[_0x22d3('0xdd')][_0x22d3('0x11a')](db[_0x22d3('0xff')],{'through':_0x22d3('0x1cb'),'as':_0x22d3('0x12f')});db[_0x22d3('0xdd')][_0x22d3('0x11a')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x22d3('0x128')});db['Campaign'][_0x22d3('0x10c')](db[_0x22d3('0x6a')],{'as':'Hoppers','foreignKey':_0x22d3('0x191')});db[_0x22d3('0xe1')]['hasMany'](db[_0x22d3('0x6e')],{'as':_0x22d3('0x110'),'foreignKey':_0x22d3('0x191')});db[_0x22d3('0xe1')][_0x22d3('0x10c')](db['CmHopperHistory'],{'as':_0x22d3('0x13f'),'foreignKey':'CampaignId'});db[_0x22d3('0xe1')]['hasMany'](db[_0x22d3('0x6c')],{'as':_0x22d3('0x140'),'foreignKey':'CampaignId'});db[_0x22d3('0xe1')][_0x22d3('0x118')](db[_0x22d3('0x27')],{'as':_0x22d3('0x27'),'foreignKey':'TrunkId'});db[_0x22d3('0xe1')][_0x22d3('0x118')](db[_0x22d3('0x27')],{'as':_0x22d3('0x141'),'foreignKey':_0x22d3('0x142')});db[_0x22d3('0xe1')][_0x22d3('0x118')](db[_0x22d3('0x7c')],{'as':_0x22d3('0x7c'),'foreignKey':_0x22d3('0x143')});db[_0x22d3('0xe1')][_0x22d3('0x118')](db[_0x22d3('0xd9')],{'as':'SquareProject','foreignKey':_0x22d3('0x1cc')});db['Campaign'][_0x22d3('0x11a')](db['CmList'],{'as':_0x22d3('0x145'),'through':_0x22d3('0x1cd')});db[_0x22d3('0xe1')]['belongsToMany'](db[_0x22d3('0xef')],{'as':_0x22d3('0x148'),'through':'campaigns_has_cm_blacklists'});db[_0x22d3('0xe4')][_0x22d3('0x118')](db[_0x22d3('0x63')],{'as':'ChatOfflineMessage','foreignKey':_0x22d3('0x1ce')});db['MailTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x3f')],{});db[_0x22d3('0xe6')][_0x22d3('0x118')](db['MailInteraction'],{});db['MailTransferReport'][_0x22d3('0x118')](db['MailAccount'],{'foreignKey':_0x22d3('0x1cf'),'as':_0x22d3('0x1d0')});db['MailTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d1'),'as':_0x22d3('0x1d2')});db['MailTransferReport'][_0x22d3('0x118')](db['User'],{'foreignKey':_0x22d3('0x1d3'),'as':_0x22d3('0x1d4')});db[_0x22d3('0xe6')][_0x22d3('0x118')](db[_0x22d3('0x3b')],{'foreignKey':_0x22d3('0x1d5'),'as':_0x22d3('0x1d6')});db[_0x22d3('0xe6')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x22d3('0x1d7'),'as':_0x22d3('0x1d8')});db[_0x22d3('0xe8')]['belongsTo'](db[_0x22d3('0x184')],{});db[_0x22d3('0xe8')][_0x22d3('0x118')](db['ChatInteraction'],{});db['ChatTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x5d')],{'foreignKey':'FromChatWebsiteId','as':_0x22d3('0x1d0')});db['ChatTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d1'),'as':_0x22d3('0x1d2')});db[_0x22d3('0xe8')][_0x22d3('0x118')](db['User'],{'foreignKey':_0x22d3('0x1d3'),'as':_0x22d3('0x1d4')});db[_0x22d3('0xe8')][_0x22d3('0x118')](db[_0x22d3('0x65')],{'foreignKey':_0x22d3('0x1d9'),'as':'ToQueue'});db[_0x22d3('0xe8')][_0x22d3('0x118')](db['ChatWebsite'],{'foreignKey':_0x22d3('0x1da'),'as':_0x22d3('0x1d8')});db[_0x22d3('0xea')][_0x22d3('0x118')](db[_0x22d3('0x48')],{});db[_0x22d3('0xea')][_0x22d3('0x118')](db[_0x22d3('0x47')],{});db[_0x22d3('0xea')][_0x22d3('0x118')](db[_0x22d3('0x132')],{'foreignKey':_0x22d3('0x1db'),'as':_0x22d3('0x1d0')});db[_0x22d3('0xea')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d1'),'as':_0x22d3('0x1d2')});db['FaxTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d3'),'as':_0x22d3('0x1d4')});db[_0x22d3('0xea')][_0x22d3('0x118')](db[_0x22d3('0x4a')],{'foreignKey':_0x22d3('0x1dc'),'as':_0x22d3('0x1d6')});db[_0x22d3('0xea')][_0x22d3('0x118')](db['FaxAccount'],{'foreignKey':_0x22d3('0x1dd'),'as':_0x22d3('0x1d8')});db['OpenchannelTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x5b')],{});db[_0x22d3('0xeb')][_0x22d3('0x118')](db['OpenchannelInteraction'],{});db[_0x22d3('0xeb')][_0x22d3('0x118')](db[_0x22d3('0x55')],{'foreignKey':_0x22d3('0x1de'),'as':'FromAccount'});db[_0x22d3('0xeb')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d1'),'as':_0x22d3('0x1d2')});db[_0x22d3('0xeb')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':'ToUserId','as':_0x22d3('0x1d4')});db['OpenchannelTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x5c')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x22d3('0xeb')][_0x22d3('0x118')](db[_0x22d3('0x55')],{'foreignKey':'ToOpenchannelAccountId','as':_0x22d3('0x1d8')});db['SmsTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x175')],{});db[_0x22d3('0xed')][_0x22d3('0x118')](db[_0x22d3('0x50')],{});db[_0x22d3('0xed')]['belongsTo'](db[_0x22d3('0x134')],{'foreignKey':'FromSmsAccountId','as':_0x22d3('0x1d0')});db[_0x22d3('0xed')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d1'),'as':_0x22d3('0x1d2')});db['SmsTransferReport']['belongsTo'](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d3'),'as':'ToAgent'});db['SmsTransferReport'][_0x22d3('0x118')](db[_0x22d3('0x53')],{'foreignKey':_0x22d3('0x1df'),'as':'ToQueue'});db[_0x22d3('0xed')][_0x22d3('0x118')](db[_0x22d3('0x134')],{'foreignKey':_0x22d3('0x1e0'),'as':_0x22d3('0x1d8')});db[_0x22d3('0xef')][_0x22d3('0x10c')](db[_0x22d3('0x15a')],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x15e'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0xef')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x22d3('0x15e')});db[_0x22d3('0xef')][_0x22d3('0x10c')](db[_0x22d3('0x11e')],{'as':'Contacts','onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x15e')});db['CmList'][_0x22d3('0x10c')](db['CmHopperFinal'],{'as':_0x22d3('0x110'),'foreignKey':_0x22d3('0x15e')});db['CmList'][_0x22d3('0x10c')](db[_0x22d3('0x70')],{'as':_0x22d3('0x111'),'foreignKey':_0x22d3('0x15e')});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0x22d3('0x72'),'foreignKey':_0x22d3('0x15e')});db[_0x22d3('0xef')][_0x22d3('0x11a')](db[_0x22d3('0x1b')],{'as':'Queues','through':_0x22d3('0x1e1')});db[_0x22d3('0xef')]['belongsToMany'](db[_0x22d3('0x108')],{'as':'Agents','through':_0x22d3('0x120')});db['VoicePrefix'][_0x22d3('0x10c')](db[_0x22d3('0x10e')],{'as':_0x22d3('0x10f'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0xf0')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':_0x22d3('0x105')});db[_0x22d3('0xf0')][_0x22d3('0x11a')](db['Team'],{'through':_0x22d3('0x103'),'as':_0x22d3('0x147')});db[_0x22d3('0x119')][_0x22d3('0x10c')](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x22d3('0x119')][_0x22d3('0x10c')](db['UserProfileSection'],{'as':_0x22d3('0x1e2'),'foreignKey':_0x22d3('0x1e3'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0xf2')]['hasMany'](db[_0x22d3('0x1e4')],{'as':_0x22d3('0x1e5'),'foreignKey':_0x22d3('0x1e6'),'onDelete':_0x22d3('0x109')});db[_0x22d3('0xf5')][_0x22d3('0x10c')](db[_0x22d3('0x15a')],{'as':_0x22d3('0x15b'),'foreignKey':_0x22d3('0x1e7'),'onDelete':'cascade'});db['WhatsappAccount'][_0x22d3('0x10c')](db[_0x22d3('0x77')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0x22d3('0xf5')][_0x22d3('0x10c')](db['WhatsappMessage'],{'as':_0x22d3('0x14b'),'foreignKey':_0x22d3('0x1e7')});db[_0x22d3('0xf5')]['hasMany'](db['WhatsappInteraction'],{'as':_0x22d3('0x173')});db['WhatsappAccount'][_0x22d3('0x10c')](db[_0x22d3('0xf6')],{'as':_0x22d3('0x139')});db[_0x22d3('0xf5')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x22d3('0x15e')});db[_0x22d3('0xf5')][_0x22d3('0x118')](db[_0x22d3('0x7e')],{'as':_0x22d3('0x144'),'foreignKey':_0x22d3('0x15f')});db[_0x22d3('0xf5')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':'Agents','through':_0x22d3('0x137')});db[_0x22d3('0xf6')][_0x22d3('0x118')](db['User'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x22d3('0x118')](db[_0x22d3('0xff')],{'onDelete':_0x22d3('0x157')});db[_0x22d3('0xf6')][_0x22d3('0x118')](db[_0x22d3('0xf5')],{'onDelete':_0x22d3('0x157')});db['WhatsappApplication'][_0x22d3('0x118')](db['Interval'],{'onDelete':_0x22d3('0x157'),'foreignKey':_0x22d3('0x143')});db['WhatsappApplication'][_0x22d3('0x118')](db[_0x22d3('0x85')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x22d3('0xf8')][_0x22d3('0x10c')](db['WhatsappMessage'],{'as':_0x22d3('0x14b'),'onDelete':_0x22d3('0x109'),'foreignKey':_0x22d3('0x1e8')});db[_0x22d3('0xf8')][_0x22d3('0x118')](db[_0x22d3('0xf5')],{'as':_0x22d3('0x168'),'foreignKey':_0x22d3('0x1e7')});db[_0x22d3('0xf8')][_0x22d3('0x118')](db['CmContact'],{'as':_0x22d3('0x152'),'foreignKey':_0x22d3('0x153')});db[_0x22d3('0xf8')]['belongsTo'](db[_0x22d3('0x108')],{'as':_0x22d3('0x161'),'foreignKey':_0x22d3('0x10a')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x22d3('0x162')});db[_0x22d3('0xf8')][_0x22d3('0x11a')](db[_0x22d3('0x85')],{'through':_0x22d3('0x1a2'),'as':_0x22d3('0x164')});db['WhatsappInteraction']['belongsToMany'](db[_0x22d3('0x108')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0x22d3('0x1e8')});db['WhatsappMessage'][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x108')});db[_0x22d3('0xf9')]['belongsTo'](db[_0x22d3('0x11e')],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x152')});db[_0x22d3('0xf9')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x22d3('0x109'),'as':_0x22d3('0x16f'),'foreignKey':_0x22d3('0x1e8')});db['WhatsappMessage'][_0x22d3('0x118')](db[_0x22d3('0xf5')],{'as':_0x22d3('0x168'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x22d3('0x118')](db[_0x22d3('0xf5')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x22d3('0xef')],{'as':'List','foreignKey':_0x22d3('0x15e')});db[_0x22d3('0xfb')]['belongsTo'](db[_0x22d3('0x11e')],{'as':'Contact','foreignKey':_0x22d3('0x153')});db[_0x22d3('0xfb')][_0x22d3('0x118')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x22d3('0x118')](db[_0x22d3('0xff')],{});db[_0x22d3('0xfb')][_0x22d3('0x118')](db['WhatsappMessage'],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db[_0x22d3('0xfd')][_0x22d3('0x118')](db['WhatsappMessage'],{});db[_0x22d3('0xfd')][_0x22d3('0x118')](db[_0x22d3('0xf8')],{});db[_0x22d3('0xfd')]['belongsTo'](db[_0x22d3('0xf5')],{'foreignKey':_0x22d3('0x1e9'),'as':'FromAccount'});db[_0x22d3('0xfd')]['belongsTo'](db[_0x22d3('0xf5')],{'foreignKey':_0x22d3('0x1ea'),'as':_0x22d3('0x1d8')});db[_0x22d3('0xfd')][_0x22d3('0x118')](db['WhatsappQueue'],{'foreignKey':_0x22d3('0x1eb'),'as':_0x22d3('0x1d6')});db[_0x22d3('0xfd')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':_0x22d3('0x1d1'),'as':_0x22d3('0x1d2')});db[_0x22d3('0xfd')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x22d3('0xff')][_0x22d3('0x11a')](db[_0x22d3('0x108')],{'as':_0x22d3('0x146'),'through':_0x22d3('0x34'),'foreignKey':_0x22d3('0x1ec')});db[_0x22d3('0xff')][_0x22d3('0x11a')](db[_0x22d3('0xdd')],{'through':_0x22d3('0x1cb'),'as':_0x22d3('0x147')});db[_0x22d3('0x106')][_0x22d3('0x118')](db[_0x22d3('0x108')],{'as':_0x22d3('0x1ed'),'foreignKey':'UserId','onDelete':_0x22d3('0x109'),'hooks':!![]});db['CloudProvider'][_0x22d3('0x10b')](db[_0x22d3('0x1c1')],{'as':_0x22d3('0x1c1'),'onDelete':'restrict'});db[_0x22d3('0x155')][_0x22d3('0x10b')](db['MailServerIn'],{'as':_0x22d3('0x158'),'onDelete':_0x22d3('0x157')});db['CloudProvider'][_0x22d3('0x10b')](db[_0x22d3('0x37')],{'as':_0x22d3('0x159'),'onDelete':_0x22d3('0x157')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index d3664a8..fd6c2b8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8026=['./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/action','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/attachments','/api/plugins','./api/plugin','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/demo','3.1.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x8026,0xb4));var _0x6802=function(_0x1e24b1,_0x14ab30){_0x1e24b1=_0x1e24b1-0x0;var _0x212baf=_0x8026[_0x1e24b1];return _0x212baf;};'use strict';var path=require(_0x6802('0x0'));var express=require(_0x6802('0x1'));var errors=require('./errors');var config=require(_0x6802('0x2'));var setupLoggers=require(_0x6802('0x3'))['setupLoggers'];var clientSideLogs=require(_0x6802('0x4'));exports[_0x6802('0x5')]=function(_0xada5c){return setupLoggers(_0xada5c)['then'](function(){_0xada5c[_0x6802('0x6')](_0x6802('0x7'),require(_0x6802('0x8')));_0xada5c[_0x6802('0x6')](_0x6802('0x9'),require(_0x6802('0xa')));_0xada5c[_0x6802('0x6')](_0x6802('0xb'),require(_0x6802('0xc')));_0xada5c['use']('/api/voice/extensions',require(_0x6802('0xd')));_0xada5c[_0x6802('0x6')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0xada5c['use'](_0x6802('0xe'),require(_0x6802('0xf')));_0xada5c[_0x6802('0x6')](_0x6802('0x10'),require(_0x6802('0x11')));_0xada5c['use']('/api/screen/recordings',require(_0x6802('0x12')));_0xada5c['use'](_0x6802('0x13'),require(_0x6802('0x14')));_0xada5c[_0x6802('0x6')](_0x6802('0x15'),require('./api/voiceMailMessage'));_0xada5c[_0x6802('0x6')](_0x6802('0x16'),require(_0x6802('0x17')));_0xada5c['use'](_0x6802('0x18'),require(_0x6802('0x19')));_0xada5c[_0x6802('0x6')](_0x6802('0x1a'),require('./api/voiceAgentReport'));_0xada5c[_0x6802('0x6')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0xada5c[_0x6802('0x6')](_0x6802('0x1b'),require('./api/memberReport'));_0xada5c['use'](_0x6802('0x1c'),require(_0x6802('0x1d')));_0xada5c[_0x6802('0x6')](_0x6802('0x1e'),require(_0x6802('0x1f')));_0xada5c[_0x6802('0x6')](_0x6802('0x20'),require(_0x6802('0x21')));_0xada5c[_0x6802('0x6')](_0x6802('0x22'),require(_0x6802('0x23')));_0xada5c[_0x6802('0x6')](_0x6802('0x24'),require('./api/mailQueue'));_0xada5c[_0x6802('0x6')]('/api/mail/substatuses',require(_0x6802('0x25')));_0xada5c[_0x6802('0x6')](_0x6802('0x26'),require(_0x6802('0x27')));_0xada5c[_0x6802('0x6')](_0x6802('0x28'),require('./api/mailMessage'));_0xada5c[_0x6802('0x6')](_0x6802('0x29'),require(_0x6802('0x2a')));_0xada5c[_0x6802('0x6')](_0x6802('0x2b'),require(_0x6802('0x2c')));_0xada5c[_0x6802('0x6')](_0x6802('0x2d'),require(_0x6802('0x2e')));_0xada5c[_0x6802('0x6')](_0x6802('0x2f'),require(_0x6802('0x30')));_0xada5c['use'](_0x6802('0x31'),require('./api/faxAccount'));_0xada5c[_0x6802('0x6')]('/api/fax/applications',require(_0x6802('0x32')));_0xada5c['use'](_0x6802('0x33'),require(_0x6802('0x34')));_0xada5c[_0x6802('0x6')](_0x6802('0x35'),require(_0x6802('0x36')));_0xada5c[_0x6802('0x6')](_0x6802('0x37'),require(_0x6802('0x38')));_0xada5c[_0x6802('0x6')]('/api/fax/reports/queue',require(_0x6802('0x39')));_0xada5c[_0x6802('0x6')](_0x6802('0x3a'),require('./api/smsAccount'));_0xada5c[_0x6802('0x6')](_0x6802('0x3b'),require(_0x6802('0x3c')));_0xada5c[_0x6802('0x6')](_0x6802('0x3d'),require('./api/smsInteraction'));_0xada5c[_0x6802('0x6')](_0x6802('0x3e'),require(_0x6802('0x3f')));_0xada5c['use'](_0x6802('0x40'),require('./api/smsQueue'));_0xada5c[_0x6802('0x6')](_0x6802('0x41'),require(_0x6802('0x42')));_0xada5c[_0x6802('0x6')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0xada5c[_0x6802('0x6')]('/api/openchannel/interactions',require(_0x6802('0x43')));_0xada5c['use'](_0x6802('0x44'),require('./api/openchannelMessage'));_0xada5c[_0x6802('0x6')](_0x6802('0x45'),require('./api/openchannelQueue'));_0xada5c[_0x6802('0x6')](_0x6802('0x46'),require(_0x6802('0x47')));_0xada5c[_0x6802('0x6')]('/api/openchannel/reports/queue',require(_0x6802('0x48')));_0xada5c[_0x6802('0x6')](_0x6802('0x49'),require(_0x6802('0x4a')));_0xada5c[_0x6802('0x6')](_0x6802('0x4b'),require('./api/chatInteraction'));_0xada5c['use']('/api/chat/messages',require(_0x6802('0x4c')));_0xada5c[_0x6802('0x6')](_0x6802('0x4d'),require('./api/chatOfflineMessage'));_0xada5c[_0x6802('0x6')](_0x6802('0x4e'),require(_0x6802('0x4f')));_0xada5c[_0x6802('0x6')](_0x6802('0x50'),require(_0x6802('0x51')));_0xada5c[_0x6802('0x6')](_0x6802('0x52'),require(_0x6802('0x53')));_0xada5c[_0x6802('0x6')]('/api/cm/companies',require(_0x6802('0x54')));_0xada5c[_0x6802('0x6')](_0x6802('0x55'),require(_0x6802('0x56')));_0xada5c['use'](_0x6802('0x57'),require(_0x6802('0x58')));_0xada5c[_0x6802('0x6')]('/api/cm/hopper_black',require(_0x6802('0x59')));_0xada5c['use'](_0x6802('0x5a'),require('./api/cmHopperFinal'));_0xada5c[_0x6802('0x6')](_0x6802('0x5b'),require('./api/cmHopperHistory'));_0xada5c[_0x6802('0x6')](_0x6802('0x5c'),require('./api/cmCustomField'));_0xada5c[_0x6802('0x6')]('/api/actions',require(_0x6802('0x5d')));_0xada5c[_0x6802('0x6')](_0x6802('0x5e'),require('./api/automation'));_0xada5c[_0x6802('0x6')](_0x6802('0x5f'),require('./api/cannedAnswer'));_0xada5c['use'](_0x6802('0x60'),require(_0x6802('0x61')));_0xada5c[_0x6802('0x6')]('/api/conditions',require(_0x6802('0x62')));_0xada5c[_0x6802('0x6')]('/api/intervals',require(_0x6802('0x63')));_0xada5c[_0x6802('0x6')]('/api/pauses',require('./api/pause'));_0xada5c['use'](_0x6802('0x64'),require(_0x6802('0x65')));_0xada5c[_0x6802('0x6')](_0x6802('0x66'),require('./api/voiceQueuesLog'));_0xada5c[_0x6802('0x6')](_0x6802('0x67'),require(_0x6802('0x68')));_0xada5c[_0x6802('0x6')](_0x6802('0x69'),require('./api/sound'));_0xada5c[_0x6802('0x6')]('/api/tags',require(_0x6802('0x6a')));_0xada5c[_0x6802('0x6')](_0x6802('0x6b'),require(_0x6802('0x6c')));_0xada5c[_0x6802('0x6')](_0x6802('0x6d'),require(_0x6802('0x6e')));_0xada5c[_0x6802('0x6')]('/api/cm_hopper_additional_phones',require(_0x6802('0x6f')));_0xada5c[_0x6802('0x6')](_0x6802('0x70'),require(_0x6802('0x71')));_0xada5c[_0x6802('0x6')](_0x6802('0x72'),require(_0x6802('0x73')));_0xada5c[_0x6802('0x6')](_0x6802('0x74'),require('./api/variable'));_0xada5c[_0x6802('0x6')](_0x6802('0x75'),require('./api/integration'));_0xada5c[_0x6802('0x6')](_0x6802('0x76'),require(_0x6802('0x77')));_0xada5c[_0x6802('0x6')](_0x6802('0x78'),require(_0x6802('0x79')));_0xada5c[_0x6802('0x6')](_0x6802('0x7a'),require(_0x6802('0x7b')));_0xada5c[_0x6802('0x6')](_0x6802('0x7c'),require(_0x6802('0x7d')));_0xada5c[_0x6802('0x6')](_0x6802('0x7e'),require(_0x6802('0x7f')));_0xada5c[_0x6802('0x6')](_0x6802('0x80'),require(_0x6802('0x81')));_0xada5c[_0x6802('0x6')](_0x6802('0x82'),require(_0x6802('0x83')));_0xada5c[_0x6802('0x6')](_0x6802('0x84'),require(_0x6802('0x85')));_0xada5c[_0x6802('0x6')](_0x6802('0x86'),require('./api/intSalesforceConfiguration'));_0xada5c[_0x6802('0x6')](_0x6802('0x87'),require(_0x6802('0x88')));_0xada5c[_0x6802('0x6')](_0x6802('0x89'),require(_0x6802('0x8a')));_0xada5c[_0x6802('0x6')](_0x6802('0x8b'),require(_0x6802('0x8c')));_0xada5c[_0x6802('0x6')](_0x6802('0x8d'),require(_0x6802('0x8e')));_0xada5c['use'](_0x6802('0x8f'),require(_0x6802('0x90')));_0xada5c[_0x6802('0x6')](_0x6802('0x91'),require(_0x6802('0x92')));_0xada5c['use'](_0x6802('0x93'),require(_0x6802('0x94')));_0xada5c['use'](_0x6802('0x95'),require(_0x6802('0x96')));_0xada5c[_0x6802('0x6')]('/api/integrations/zoho/configurations',require(_0x6802('0x97')));_0xada5c['use'](_0x6802('0x98'),require('./api/intZohoField'));_0xada5c[_0x6802('0x6')](_0x6802('0x99'),require('./api/intZendeskAccount'));_0xada5c[_0x6802('0x6')](_0x6802('0x9a'),require(_0x6802('0x9b')));_0xada5c['use'](_0x6802('0x9c'),require('./api/intZendeskField'));_0xada5c['use'](_0x6802('0x9d'),require('./api/intFreshdeskAccount'));_0xada5c[_0x6802('0x6')]('/api/integrations/freshdesk/configurations',require(_0x6802('0x9e')));_0xada5c[_0x6802('0x6')](_0x6802('0x9f'),require(_0x6802('0xa0')));_0xada5c['use'](_0x6802('0xa1'),require(_0x6802('0xa2')));_0xada5c[_0x6802('0x6')](_0x6802('0xa3'),require(_0x6802('0xa4')));_0xada5c[_0x6802('0x6')](_0x6802('0xa5'),require(_0x6802('0xa6')));_0xada5c[_0x6802('0x6')](_0x6802('0xa7'),require(_0x6802('0xa8')));_0xada5c[_0x6802('0x6')]('/api/integrations/servicenow/configurations',require(_0x6802('0xa9')));_0xada5c[_0x6802('0x6')](_0x6802('0xaa'),require('./api/intServicenowField'));_0xada5c[_0x6802('0x6')](_0x6802('0xab'),require(_0x6802('0xac')));_0xada5c[_0x6802('0x6')]('/api/integrations/dynamics365/configurations',require(_0x6802('0xad')));_0xada5c[_0x6802('0x6')](_0x6802('0xae'),require('./api/intDynamics365Field'));_0xada5c[_0x6802('0x6')]('/api/integrations/freshsales/accounts',require(_0x6802('0xaf')));_0xada5c[_0x6802('0x6')]('/api/integrations/freshsales/configurations',require(_0x6802('0xb0')));_0xada5c[_0x6802('0x6')](_0x6802('0xb1'),require('./api/intFreshsalesField'));_0xada5c[_0x6802('0x6')](_0x6802('0xb2'),require(_0x6802('0xb3')));_0xada5c[_0x6802('0x6')](_0x6802('0xb4'),require('./api/chatQueueReport'));_0xada5c[_0x6802('0x6')](_0x6802('0xb5'),require(_0x6802('0xb6')));_0xada5c[_0x6802('0x6')](_0x6802('0xb7'),require('./api/jscriptyAnswerReport'));_0xada5c[_0x6802('0x6')](_0x6802('0xb8'),require(_0x6802('0xb9')));_0xada5c['use'](_0x6802('0xba'),require(_0x6802('0xbb')));_0xada5c[_0x6802('0x6')](_0x6802('0xbc'),require(_0x6802('0xbd')));_0xada5c[_0x6802('0x6')]('/api/square/reports',require('./api/squareReport'));_0xada5c[_0x6802('0x6')](_0x6802('0xbe'),require(_0x6802('0xbf')));_0xada5c[_0x6802('0x6')](_0x6802('0xc0'),require(_0x6802('0xc1')));_0xada5c[_0x6802('0x6')](_0x6802('0xc2'),require(_0x6802('0xc3')));_0xada5c[_0x6802('0x6')](_0x6802('0xc4'),require('./api/squareOdbc'));_0xada5c['use']('/api/square/projects',require(_0x6802('0xc5')));_0xada5c['use'](_0x6802('0xc6'),require(_0x6802('0xc7')));_0xada5c['use'](_0x6802('0xc8'),require(_0x6802('0xc9')));_0xada5c[_0x6802('0x6')](_0x6802('0xca'),require(_0x6802('0xcb')));_0xada5c[_0x6802('0x6')]('/api/license',require(_0x6802('0xcc')));_0xada5c[_0x6802('0x6')](_0x6802('0xcd'),require(_0x6802('0xce')));_0xada5c[_0x6802('0x6')]('/api/migrations',require('./api/migration'));_0xada5c[_0x6802('0x6')](_0x6802('0xcf'),require('./api/attachment'));_0xada5c[_0x6802('0x6')](_0x6802('0xd0'),require(_0x6802('0xd1')));_0xada5c[_0x6802('0x6')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0xada5c[_0x6802('0x6')](_0x6802('0xd2'),require(_0x6802('0xd3')));_0xada5c[_0x6802('0x6')]('/api/fax/reports/transfer',require(_0x6802('0xd4')));_0xada5c[_0x6802('0x6')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0xada5c['use'](_0x6802('0xd5'),require(_0x6802('0xd6')));_0xada5c[_0x6802('0x6')]('/api/cm/lists',require(_0x6802('0xd7')));_0xada5c[_0x6802('0x6')](_0x6802('0xd8'),require(_0x6802('0xd9')));_0xada5c[_0x6802('0x6')](_0x6802('0xda'),require(_0x6802('0xdb')));_0xada5c['use'](_0x6802('0xdc'),require(_0x6802('0xdd')));_0xada5c[_0x6802('0x6')](_0x6802('0xde'),require(_0x6802('0xdf')));_0xada5c[_0x6802('0x6')]('/api/userNotifications',require('./api/userNotification'));_0xada5c[_0x6802('0x6')](_0x6802('0xe0'),require(_0x6802('0xe1')));_0xada5c['use']('/api/whatsapp/applications',require(_0x6802('0xe2')));_0xada5c[_0x6802('0x6')](_0x6802('0xe3'),require(_0x6802('0xe4')));_0xada5c[_0x6802('0x6')](_0x6802('0xe5'),require(_0x6802('0xe6')));_0xada5c[_0x6802('0x6')]('/api/whatsapp/reports/queue',require(_0x6802('0xe7')));_0xada5c[_0x6802('0x6')](_0x6802('0xe8'),require(_0x6802('0xe9')));_0xada5c[_0x6802('0x6')](_0x6802('0xea'),require(_0x6802('0xeb')));_0xada5c['use']('/api/cloudProviders',require('./api/cloudProvider'));_0xada5c[_0x6802('0x6')]('/api/realtime',require('./api/realtime'));_0xada5c[_0x6802('0x6')](_0x6802('0xec'),require(_0x6802('0xed')));_0xada5c[_0x6802('0x6')](_0x6802('0xee'),require(_0x6802('0xef')));_0xada5c[_0x6802('0x6')](_0x6802('0xf0'),require(_0x6802('0xf1')));_0xada5c[_0x6802('0x6')]('/api/auth/activedirectory',require(_0x6802('0xf2')));_0xada5c[_0x6802('0x6')](_0x6802('0xf3'),require('./api/jira'));_0xada5c['use']('/api/rpc',require('./api/rpc'));_0xada5c[_0x6802('0x6')](_0x6802('0xf4'),require('./api/version'));_0xada5c[_0x6802('0x6')]('/api/system',require(_0x6802('0xf5')));_0xada5c[_0x6802('0x6')](_0x6802('0xf6'),require(_0x6802('0xf7')));_0xada5c[_0x6802('0x6')](_0x6802('0xf8'),require('./api/webbar'));_0xada5c[_0x6802('0x6')](_0x6802('0xf9'),clientSideLogs);_0xada5c[_0x6802('0x6')](_0x6802('0xfa'),express[_0x6802('0xfb')](path[_0x6802('0xfc')](config[_0x6802('0xfd')],_0x6802('0xfa'))));_0xada5c[_0x6802('0x6')]('/www',express[_0x6802('0xfb')](path[_0x6802('0xfc')](config[_0x6802('0xfd')],'/www')));_0xada5c[_0x6802('0x6')](_0x6802('0xfe'),express[_0x6802('0xfb')](path[_0x6802('0xfc')](config[_0x6802('0xfd')],_0x6802('0xfe'))));_0xada5c[_0x6802('0x6')]('/snippet',express[_0x6802('0xfb')](path['join'](config[_0x6802('0xfd')],'snippet',_0x6802('0xff'))));_0xada5c[_0x6802('0x6')](_0x6802('0x100'),express[_0x6802('0xfb')](path[_0x6802('0xfc')](config['root'],_0x6802('0x101'))));_0xada5c[_0x6802('0x102')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6802('0x103')](errors[0x194]);_0xada5c[_0x6802('0x102')]('/*')[_0x6802('0x103')](function(_0x5884ff,_0x2ff807){_0x2ff807[_0x6802('0x104')](path[_0x6802('0x105')](_0xada5c[_0x6802('0x103')](_0x6802('0x106'))+_0x6802('0x107')));});return _0xada5c;});}; \ No newline at end of file +var _0x8655=['/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','root','/demo','static','/snippet','3.1.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','sendFile','resolve','appPath','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage'];(function(_0x5efb3c,_0x852a5a){var _0x349be3=function(_0x44b9de){while(--_0x44b9de){_0x5efb3c['push'](_0x5efb3c['shift']());}};_0x349be3(++_0x852a5a);}(_0x8655,0xdc));var _0x5865=function(_0x2602ef,_0x5aceb9){_0x2602ef=_0x2602ef-0x0;var _0x3c5ed6=_0x8655[_0x2602ef];return _0x3c5ed6;};'use strict';var path=require('path');var express=require(_0x5865('0x0'));var errors=require(_0x5865('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x5865('0x2'))[_0x5865('0x3')];var clientSideLogs=require(_0x5865('0x4'));exports[_0x5865('0x5')]=function(_0x36eae4){return setupLoggers(_0x36eae4)['then'](function(){_0x36eae4[_0x5865('0x6')](_0x5865('0x7'),require('./api/user'));_0x36eae4[_0x5865('0x6')]('/api/voice/chanspy',require(_0x5865('0x8')));_0x36eae4[_0x5865('0x6')](_0x5865('0x9'),require('./api/voiceContext'));_0x36eae4['use'](_0x5865('0xa'),require(_0x5865('0xb')));_0x36eae4[_0x5865('0x6')]('/api/voice/mohs',require(_0x5865('0xc')));_0x36eae4['use']('/api/voice/queues',require(_0x5865('0xd')));_0x36eae4[_0x5865('0x6')](_0x5865('0xe'),require(_0x5865('0xf')));_0x36eae4['use']('/api/screen/recordings',require(_0x5865('0x10')));_0x36eae4['use']('/api/voice/mails',require('./api/voiceMail'));_0x36eae4[_0x5865('0x6')](_0x5865('0x11'),require(_0x5865('0x12')));_0x36eae4['use'](_0x5865('0x13'),require(_0x5865('0x14')));_0x36eae4[_0x5865('0x6')](_0x5865('0x15'),require('./api/voiceDialReport'));_0x36eae4[_0x5865('0x6')](_0x5865('0x16'),require(_0x5865('0x17')));_0x36eae4[_0x5865('0x6')](_0x5865('0x18'),require(_0x5865('0x19')));_0x36eae4[_0x5865('0x6')]('/api/members/reports',require(_0x5865('0x1a')));_0x36eae4[_0x5865('0x6')](_0x5865('0x1b'),require(_0x5865('0x1c')));_0x36eae4[_0x5865('0x6')](_0x5865('0x1d'),require(_0x5865('0x1e')));_0x36eae4[_0x5865('0x6')](_0x5865('0x1f'),require(_0x5865('0x20')));_0x36eae4[_0x5865('0x6')](_0x5865('0x21'),require(_0x5865('0x22')));_0x36eae4[_0x5865('0x6')](_0x5865('0x23'),require(_0x5865('0x24')));_0x36eae4[_0x5865('0x6')](_0x5865('0x25'),require(_0x5865('0x26')));_0x36eae4[_0x5865('0x6')](_0x5865('0x27'),require(_0x5865('0x28')));_0x36eae4['use'](_0x5865('0x29'),require('./api/mailMessage'));_0x36eae4[_0x5865('0x6')](_0x5865('0x2a'),require(_0x5865('0x2b')));_0x36eae4[_0x5865('0x6')](_0x5865('0x2c'),require(_0x5865('0x2d')));_0x36eae4[_0x5865('0x6')]('/api/dashboards',require(_0x5865('0x2e')));_0x36eae4[_0x5865('0x6')](_0x5865('0x2f'),require(_0x5865('0x30')));_0x36eae4[_0x5865('0x6')](_0x5865('0x31'),require(_0x5865('0x32')));_0x36eae4['use']('/api/fax/applications',require(_0x5865('0x33')));_0x36eae4[_0x5865('0x6')](_0x5865('0x34'),require('./api/faxInteraction'));_0x36eae4[_0x5865('0x6')](_0x5865('0x35'),require(_0x5865('0x36')));_0x36eae4[_0x5865('0x6')](_0x5865('0x37'),require(_0x5865('0x38')));_0x36eae4[_0x5865('0x6')](_0x5865('0x39'),require(_0x5865('0x3a')));_0x36eae4['use'](_0x5865('0x3b'),require(_0x5865('0x3c')));_0x36eae4[_0x5865('0x6')](_0x5865('0x3d'),require('./api/smsApplication'));_0x36eae4[_0x5865('0x6')](_0x5865('0x3e'),require(_0x5865('0x3f')));_0x36eae4[_0x5865('0x6')](_0x5865('0x40'),require(_0x5865('0x41')));_0x36eae4['use'](_0x5865('0x42'),require(_0x5865('0x43')));_0x36eae4[_0x5865('0x6')](_0x5865('0x44'),require(_0x5865('0x45')));_0x36eae4['use'](_0x5865('0x46'),require(_0x5865('0x47')));_0x36eae4[_0x5865('0x6')](_0x5865('0x48'),require('./api/openchannelInteraction'));_0x36eae4[_0x5865('0x6')](_0x5865('0x49'),require(_0x5865('0x4a')));_0x36eae4[_0x5865('0x6')](_0x5865('0x4b'),require(_0x5865('0x4c')));_0x36eae4[_0x5865('0x6')]('/api/chat/websites',require(_0x5865('0x4d')));_0x36eae4[_0x5865('0x6')]('/api/openchannel/reports/queue',require(_0x5865('0x4e')));_0x36eae4['use'](_0x5865('0x4f'),require(_0x5865('0x50')));_0x36eae4[_0x5865('0x6')](_0x5865('0x51'),require(_0x5865('0x52')));_0x36eae4['use'](_0x5865('0x53'),require('./api/chatMessage'));_0x36eae4[_0x5865('0x6')](_0x5865('0x54'),require(_0x5865('0x55')));_0x36eae4[_0x5865('0x6')](_0x5865('0x56'),require(_0x5865('0x57')));_0x36eae4['use'](_0x5865('0x58'),require(_0x5865('0x59')));_0x36eae4['use']('/api/chat/proactive_actions',require(_0x5865('0x5a')));_0x36eae4[_0x5865('0x6')](_0x5865('0x5b'),require(_0x5865('0x5c')));_0x36eae4[_0x5865('0x6')](_0x5865('0x5d'),require(_0x5865('0x5e')));_0x36eae4[_0x5865('0x6')](_0x5865('0x5f'),require(_0x5865('0x60')));_0x36eae4[_0x5865('0x6')](_0x5865('0x61'),require(_0x5865('0x62')));_0x36eae4[_0x5865('0x6')](_0x5865('0x63'),require(_0x5865('0x64')));_0x36eae4[_0x5865('0x6')](_0x5865('0x65'),require(_0x5865('0x66')));_0x36eae4[_0x5865('0x6')](_0x5865('0x67'),require(_0x5865('0x68')));_0x36eae4[_0x5865('0x6')](_0x5865('0x69'),require('./api/action'));_0x36eae4[_0x5865('0x6')](_0x5865('0x6a'),require('./api/automation'));_0x36eae4[_0x5865('0x6')](_0x5865('0x6b'),require(_0x5865('0x6c')));_0x36eae4['use'](_0x5865('0x6d'),require('./api/disposition'));_0x36eae4[_0x5865('0x6')]('/api/conditions',require(_0x5865('0x6e')));_0x36eae4['use'](_0x5865('0x6f'),require(_0x5865('0x70')));_0x36eae4['use']('/api/pauses',require(_0x5865('0x71')));_0x36eae4[_0x5865('0x6')](_0x5865('0x72'),require('./api/cdr'));_0x36eae4[_0x5865('0x6')](_0x5865('0x73'),require(_0x5865('0x74')));_0x36eae4[_0x5865('0x6')](_0x5865('0x75'),require(_0x5865('0x76')));_0x36eae4['use']('/api/sounds',require('./api/sound'));_0x36eae4[_0x5865('0x6')]('/api/tags',require('./api/tag'));_0x36eae4[_0x5865('0x6')](_0x5865('0x77'),require(_0x5865('0x78')));_0x36eae4[_0x5865('0x6')](_0x5865('0x79'),require(_0x5865('0x7a')));_0x36eae4['use']('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x36eae4[_0x5865('0x6')](_0x5865('0x7b'),require(_0x5865('0x7c')));_0x36eae4[_0x5865('0x6')]('/api/triggers',require(_0x5865('0x7d')));_0x36eae4['use']('/api/variables',require(_0x5865('0x7e')));_0x36eae4[_0x5865('0x6')](_0x5865('0x7f'),require(_0x5865('0x80')));_0x36eae4[_0x5865('0x6')]('/api/integrations/reports',require(_0x5865('0x81')));_0x36eae4[_0x5865('0x6')](_0x5865('0x82'),require(_0x5865('0x83')));_0x36eae4[_0x5865('0x6')](_0x5865('0x84'),require(_0x5865('0x85')));_0x36eae4[_0x5865('0x6')](_0x5865('0x86'),require(_0x5865('0x87')));_0x36eae4['use']('/api/analytics/metrics',require('./api/analyticMetric'));_0x36eae4['use'](_0x5865('0x88'),require('./api/analyticFieldReport'));_0x36eae4['use'](_0x5865('0x89'),require(_0x5865('0x8a')));_0x36eae4[_0x5865('0x6')](_0x5865('0x8b'),require(_0x5865('0x8c')));_0x36eae4['use'](_0x5865('0x8d'),require('./api/intSalesforceConfiguration'));_0x36eae4[_0x5865('0x6')](_0x5865('0x8e'),require(_0x5865('0x8f')));_0x36eae4[_0x5865('0x6')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x36eae4[_0x5865('0x6')](_0x5865('0x90'),require(_0x5865('0x91')));_0x36eae4[_0x5865('0x6')](_0x5865('0x92'),require(_0x5865('0x93')));_0x36eae4[_0x5865('0x6')](_0x5865('0x94'),require('./api/intDeskAccount'));_0x36eae4[_0x5865('0x6')](_0x5865('0x95'),require(_0x5865('0x96')));_0x36eae4['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x36eae4[_0x5865('0x6')](_0x5865('0x97'),require(_0x5865('0x98')));_0x36eae4['use']('/api/integrations/zoho/configurations',require(_0x5865('0x99')));_0x36eae4['use'](_0x5865('0x9a'),require(_0x5865('0x9b')));_0x36eae4[_0x5865('0x6')](_0x5865('0x9c'),require(_0x5865('0x9d')));_0x36eae4['use'](_0x5865('0x9e'),require(_0x5865('0x9f')));_0x36eae4[_0x5865('0x6')](_0x5865('0xa0'),require(_0x5865('0xa1')));_0x36eae4[_0x5865('0x6')](_0x5865('0xa2'),require('./api/intFreshdeskAccount'));_0x36eae4[_0x5865('0x6')]('/api/integrations/freshdesk/configurations',require(_0x5865('0xa3')));_0x36eae4[_0x5865('0x6')](_0x5865('0xa4'),require(_0x5865('0xa5')));_0x36eae4[_0x5865('0x6')]('/api/integrations/vtiger/accounts',require(_0x5865('0xa6')));_0x36eae4[_0x5865('0x6')](_0x5865('0xa7'),require(_0x5865('0xa8')));_0x36eae4['use'](_0x5865('0xa9'),require(_0x5865('0xaa')));_0x36eae4[_0x5865('0x6')](_0x5865('0xab'),require(_0x5865('0xac')));_0x36eae4['use'](_0x5865('0xad'),require('./api/intServicenowConfiguration'));_0x36eae4[_0x5865('0x6')](_0x5865('0xae'),require(_0x5865('0xaf')));_0x36eae4['use'](_0x5865('0xb0'),require(_0x5865('0xb1')));_0x36eae4[_0x5865('0x6')](_0x5865('0xb2'),require(_0x5865('0xb3')));_0x36eae4[_0x5865('0x6')](_0x5865('0xb4'),require(_0x5865('0xb5')));_0x36eae4[_0x5865('0x6')](_0x5865('0xb6'),require(_0x5865('0xb7')));_0x36eae4[_0x5865('0x6')](_0x5865('0xb8'),require(_0x5865('0xb9')));_0x36eae4[_0x5865('0x6')](_0x5865('0xba'),require(_0x5865('0xbb')));_0x36eae4['use'](_0x5865('0xbc'),require(_0x5865('0xbd')));_0x36eae4[_0x5865('0x6')](_0x5865('0xbe'),require(_0x5865('0xbf')));_0x36eae4[_0x5865('0x6')]('/api/chat/internal/messages',require(_0x5865('0xc0')));_0x36eae4[_0x5865('0x6')](_0x5865('0xc1'),require('./api/jscriptyAnswerReport'));_0x36eae4[_0x5865('0x6')]('/api/jscripty/questions/reports',require(_0x5865('0xc2')));_0x36eae4['use'](_0x5865('0xc3'),require(_0x5865('0xc4')));_0x36eae4[_0x5865('0x6')](_0x5865('0xc5'),require(_0x5865('0xc6')));_0x36eae4[_0x5865('0x6')]('/api/square/reports',require(_0x5865('0xc7')));_0x36eae4[_0x5865('0x6')](_0x5865('0xc8'),require('./api/squareReportDetail'));_0x36eae4['use'](_0x5865('0xc9'),require(_0x5865('0xca')));_0x36eae4[_0x5865('0x6')](_0x5865('0xcb'),require(_0x5865('0xcc')));_0x36eae4[_0x5865('0x6')](_0x5865('0xcd'),require(_0x5865('0xce')));_0x36eae4['use'](_0x5865('0xcf'),require('./api/squareProject'));_0x36eae4['use'](_0x5865('0xd0'),require('./api/squareRecording'));_0x36eae4['use']('/api/square/messages',require(_0x5865('0xd1')));_0x36eae4[_0x5865('0x6')](_0x5865('0xd2'),require(_0x5865('0xd3')));_0x36eae4[_0x5865('0x6')](_0x5865('0xd4'),require(_0x5865('0xd5')));_0x36eae4[_0x5865('0x6')]('/api/campaigns',require(_0x5865('0xd6')));_0x36eae4[_0x5865('0x6')](_0x5865('0xd7'),require(_0x5865('0xd8')));_0x36eae4[_0x5865('0x6')](_0x5865('0xd9'),require(_0x5865('0xda')));_0x36eae4[_0x5865('0x6')]('/api/plugins',require(_0x5865('0xdb')));_0x36eae4['use'](_0x5865('0xdc'),require(_0x5865('0xdd')));_0x36eae4['use'](_0x5865('0xde'),require(_0x5865('0xdf')));_0x36eae4[_0x5865('0x6')](_0x5865('0xe0'),require(_0x5865('0xe1')));_0x36eae4[_0x5865('0x6')](_0x5865('0xe2'),require('./api/openchannelTransferReport'));_0x36eae4['use'](_0x5865('0xe3'),require(_0x5865('0xe4')));_0x36eae4[_0x5865('0x6')](_0x5865('0xe5'),require(_0x5865('0xe6')));_0x36eae4[_0x5865('0x6')](_0x5865('0xe7'),require(_0x5865('0xe8')));_0x36eae4['use'](_0x5865('0xe9'),require('./api/userProfile'));_0x36eae4[_0x5865('0x6')](_0x5865('0xea'),require(_0x5865('0xeb')));_0x36eae4['use'](_0x5865('0xec'),require('./api/userProfileResource'));_0x36eae4[_0x5865('0x6')](_0x5865('0xed'),require(_0x5865('0xee')));_0x36eae4[_0x5865('0x6')](_0x5865('0xef'),require(_0x5865('0xf0')));_0x36eae4[_0x5865('0x6')](_0x5865('0xf1'),require('./api/whatsappApplication'));_0x36eae4[_0x5865('0x6')](_0x5865('0xf2'),require(_0x5865('0xf3')));_0x36eae4[_0x5865('0x6')](_0x5865('0xf4'),require(_0x5865('0xf5')));_0x36eae4[_0x5865('0x6')](_0x5865('0xf6'),require(_0x5865('0xf7')));_0x36eae4[_0x5865('0x6')]('/api/whatsapp/reports/transfer',require(_0x5865('0xf8')));_0x36eae4[_0x5865('0x6')](_0x5865('0xf9'),require(_0x5865('0xfa')));_0x36eae4['use'](_0x5865('0xfb'),require(_0x5865('0xfc')));_0x36eae4['use'](_0x5865('0xfd'),require(_0x5865('0xfe')));_0x36eae4[_0x5865('0x6')]('/api/user-settings',require(_0x5865('0xff')));_0x36eae4[_0x5865('0x6')](_0x5865('0x100'),require(_0x5865('0x101')));_0x36eae4[_0x5865('0x6')](_0x5865('0x102'),require(_0x5865('0x103')));_0x36eae4[_0x5865('0x6')]('/api/auth/activedirectory',require(_0x5865('0x104')));_0x36eae4[_0x5865('0x6')](_0x5865('0x105'),require('./api/jira'));_0x36eae4[_0x5865('0x6')](_0x5865('0x106'),require(_0x5865('0x107')));_0x36eae4['use'](_0x5865('0x108'),require(_0x5865('0x109')));_0x36eae4[_0x5865('0x6')](_0x5865('0x10a'),require(_0x5865('0x10b')));_0x36eae4[_0x5865('0x6')](_0x5865('0x10c'),require(_0x5865('0x10d')));_0x36eae4[_0x5865('0x6')](_0x5865('0x10e'),require(_0x5865('0x10f')));_0x36eae4[_0x5865('0x6')](_0x5865('0x110'),clientSideLogs);_0x36eae4[_0x5865('0x6')](_0x5865('0x111'),express['static'](path[_0x5865('0x112')](config[_0x5865('0x113')],'/apidoc')));_0x36eae4[_0x5865('0x6')]('/www',express['static'](path[_0x5865('0x112')](config[_0x5865('0x113')],'/www')));_0x36eae4[_0x5865('0x6')](_0x5865('0x114'),express[_0x5865('0x115')](path[_0x5865('0x112')](config[_0x5865('0x113')],'/demo')));_0x36eae4[_0x5865('0x6')](_0x5865('0x116'),express[_0x5865('0x115')](path[_0x5865('0x112')](config['root'],'snippet',_0x5865('0x117'))));_0x36eae4[_0x5865('0x6')]('/plugins',express['static'](path[_0x5865('0x112')](config['root'],_0x5865('0x118'))));_0x36eae4['route'](_0x5865('0x119'))['get'](errors[0x194]);_0x36eae4[_0x5865('0x11a')]('/*')['get'](function(_0x6c2396,_0x26a0ad){_0x26a0ad[_0x5865('0x11b')](path[_0x5865('0x11c')](_0x36eae4['get'](_0x5865('0x11d'))+'/index.html'));});return _0x36eae4;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 8a6169e..e732aa7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f59=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','error','log'];(function(_0x4c91da,_0x4bbebb){var _0x172d2a=function(_0x3465b2){while(--_0x3465b2){_0x4c91da['push'](_0x4c91da['shift']());}};_0x172d2a(++_0x4bbebb);}(_0x7f59,0x156));var _0x97f5=function(_0x2f3690,_0x5371d0){_0x2f3690=_0x2f3690-0x0;var _0xd53b59=_0x7f59[_0x2f3690];return _0xd53b59;};'use strict';var jayson=require('jayson/promise');var _=require(_0x97f5('0x0'));var config=require('../config/environment');exports[_0x97f5('0x1')]=function(){return new Promise(function(_0x13ebf5,_0x3488d8){var _0x4be386={};_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x3')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x4')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x5')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x6')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x7')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x8')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x9')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0xa')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0xb')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0xc')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0xd')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0xe')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/mailQueue/mailQueue.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0xf')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x10')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x11')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4be386=_['merge'](_0x4be386,require('../api/faxAccount/faxAccount.rpc'));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x12')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x13')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x14')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x15')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x16')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x17')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/smsInteraction/smsInteraction.rpc'));_0x4be386=_['merge'](_0x4be386,require('../api/smsMessage/smsMessage.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x18')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x19')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x1a')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x1b')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/chatInteraction/chatInteraction.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x1c')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/chatQueue/chatQueue.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x1d')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x1e')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x1f')));_0x4be386=_['merge'](_0x4be386,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x20')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x21')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x22')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x23')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x24')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/template/template.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x25')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x26')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x27')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x28')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x29')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x2a')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x2b')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x2c')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x2d')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x2e')));_0x4be386=_['merge'](_0x4be386,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x2f')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x30')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x31')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/squareReport/squareReport.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x32')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x33')));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x34')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x35')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/squareRecording/squareRecording.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/squareMessage/squareMessage.rpc'));_0x4be386=_['merge'](_0x4be386,require(_0x97f5('0x36')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require('../api/attachment/attachment.rpc'));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x37')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x38')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x39')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x3a')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x3b')));_0x4be386=_[_0x97f5('0x2')](_0x4be386,require(_0x97f5('0x3c')));var _0x12f2b6=jayson[_0x97f5('0x3d')](_0x4be386)[_0x97f5('0x3e')]();var _0x330b6a=config['rpc'][_0x97f5('0x3f')]||config[_0x97f5('0x3f')]+0x1;var _0x836944=config['rpc']['ip']||'localhost';_0x12f2b6['on'](_0x97f5('0x40'),function(_0x2b3dbe){return _0x3488d8(_0x2b3dbe);});_0x12f2b6[_0x97f5('0x1')](_0x330b6a,_0x836944,function(){console[_0x97f5('0x41')](_0x97f5('0x42'),_0x836944,_0x330b6a);require(_0x97f5('0x43'))['default']();return _0x13ebf5('RPC\x20listening\x20on\x20'+_0x836944+':'+_0x330b6a);});});}; \ No newline at end of file +var _0x3809=['../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc'];(function(_0x3c10f4,_0x1fd44){var _0x17c2dd=function(_0x2c5c60){while(--_0x2c5c60){_0x3c10f4['push'](_0x3c10f4['shift']());}};_0x17c2dd(++_0x1fd44);}(_0x3809,0xca));var _0x9380=function(_0xa15cbd,_0x37f859){_0xa15cbd=_0xa15cbd-0x0;var _0x510297=_0x3809[_0xa15cbd];return _0x510297;};'use strict';var jayson=require('jayson/promise');var _=require(_0x9380('0x0'));var config=require(_0x9380('0x1'));exports[_0x9380('0x2')]=function(){return new Promise(function(_0x4b23a3,_0x395f70){var _0x192df8={};_0x192df8=_['merge'](_0x192df8,require('../api/user/user.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x4')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x5')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x6')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x7')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x8')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x9')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0xa')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/trunk/trunk.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0xb')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0xc')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0xd')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0xe')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/mailMessage/mailMessage.rpc'));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0xf')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x10')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x11')));_0x192df8=_['merge'](_0x192df8,require('../api/faxApplication/faxApplication.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x12')));_0x192df8=_['merge'](_0x192df8,require('../api/faxMessage/faxMessage.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x13')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x14')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/smsAccount/smsAccount.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x15')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x16')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x17')));_0x192df8=_['merge'](_0x192df8,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x18')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x19')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x1a')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x1b')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x1c')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x1d')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x1e')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x1f')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x20')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x21')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x22')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x23')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x24')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x25')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x26')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x27')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/trigger/trigger.rpc'));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x28')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x29')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x2a')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x2b')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x2c')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x2d')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x2e')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x2f')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x192df8=_['merge'](_0x192df8,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x30')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x31')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x32')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x192df8=_['merge'](_0x192df8,require('../api/setting/setting.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x33')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x34')));_0x192df8=_['merge'](_0x192df8,require('../api/squareRecording/squareRecording.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/squareMessage/squareMessage.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require('../api/campaign/campaign.rpc'));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x35')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x36')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x37')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x38')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x39')));_0x192df8=_['merge'](_0x192df8,require(_0x9380('0x3a')));_0x192df8=_[_0x9380('0x3')](_0x192df8,require(_0x9380('0x3b')));var _0x4210d3=jayson['server'](_0x192df8)[_0x9380('0x3c')]();var _0x32f993=config['rpc']['port']||config[_0x9380('0x3d')]+0x1;var _0x20c12b=config[_0x9380('0x3e')]['ip']||_0x9380('0x3f');_0x4210d3['on'](_0x9380('0x40'),function(_0x5d6cd5){return _0x395f70(_0x5d6cd5);});_0x4210d3[_0x9380('0x2')](_0x32f993,_0x20c12b,function(){console[_0x9380('0x41')](_0x9380('0x42'),_0x20c12b,_0x32f993);require(_0x9380('0x43'))[_0x9380('0x44')]();return _0x4b23a3(_0x9380('0x45')+_0x20c12b+':'+_0x32f993);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 41d9545..bab2bfe 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff22=['setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','label','util','lodash','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','emit','E_AGI_SOCKET_CLOSE','timeout','command','destroy','inherits','prototype','sendRequest','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s'];(function(_0x1237e4,_0x401724){var _0x603899=function(_0x42d5a0){while(--_0x42d5a0){_0x1237e4['push'](_0x1237e4['shift']());}};_0x603899(++_0x401724);}(_0xff22,0x1a0));var _0x2ff2=function(_0x2c2f1e,_0x5b6e44){_0x2c2f1e=_0x2c2f1e-0x0;var _0x508929=_0xff22[_0x2c2f1e];return _0x508929;};'use strict';var util=require(_0x2ff2('0x0'));var _=require(_0x2ff2('0x1'));var EventEmitter=require('events')[_0x2ff2('0x2')];var AGIReply=require(_0x2ff2('0x3'));var AGIError=require(_0x2ff2('0x4'));function AGIChannel(_0x2425fd){var _0x13f7fc=this,_0x2caf71=new AGIReply(),_0x173f7c=![],_0x23d982={};EventEmitter[_0x2ff2('0x5')](_0x13f7fc);_0x2425fd['setEncoding'](_0x2ff2('0x6'));_0x2425fd[_0x2ff2('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2caf71[_0x2ff2('0x8')](_0x2ff2('0x6'));_0x2caf71['on'](_0x2ff2('0x9'),function(_0x3006f5){for(var _0x2fb54b in _0x3006f5){_0x13f7fc[_0x2fb54b]=_0x3006f5[_0x2fb54b];}_0x13f7fc['emit'](_0x2ff2('0xa'));});_0x2caf71['on'](_0x2ff2('0xb'),function(_0x15822a){if(_0x15822a[_0x2ff2('0xc')]()==_0x2ff2('0xd')){_0x13f7fc['emit']('hangup');return;}if(_0x15822a['substring'](0x0,0xb)==_0x2ff2('0xe')){_0x173f7c=!![];}if(_0x173f7c){_0x23d982['rx']+=_0x15822a+'\x0a';if(_0x15822a[_0x2ff2('0xf')](_0x2ff2('0x10'))!=-0x1){_0x173f7c=![];}}else{_0x23d982['rx']=_0x15822a;}if(_0x173f7c){return;}if(typeof _0x23d982['cb']==_0x2ff2('0x11')){var _0x13cfff=_0x23d982['rx']['substring'](0x0,0x3),_0x1c8850=null,_0x1d333f=null;_0x13cfff=parseInt(_0x13cfff);if(isNaN(_0x13cfff)){_0x23d982['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2ff2('0x12')});return;}if(_0x13cfff!=0xc8){_0x23d982['cb'](null,{'code':_0x13cfff,'result':-0x1,'extra':'KO'});return;}_0x1c8850=_0x23d982['rx'][_0x2ff2('0x13')](0x4)[_0x2ff2('0x14')](_0x2ff2('0x15'),'');if(_0x1c8850[_0x2ff2('0x16')]('\x20')!=-0x1){_0x1c8850=_0x1c8850['substr'](0x0,_0x1c8850['indexOf']('\x20'));}if(_[_0x2ff2('0x17')](_0x1c8850,'-1')){_0x1c8850=parseInt(_0x1c8850);}_0x1d333f=_0x23d982['rx']['split']('\x20');if(_0x1d333f[_0x2ff2('0x18')]==0x3){_0x1d333f=_0x1d333f[0x2][_0x2ff2('0x13')](0x1,_0x1d333f[0x2][_0x2ff2('0x18')]-0x1);}else if(_0x1d333f[_0x2ff2('0x18')]>0x3){var _0x15c2af=/\((.+)\)/;var _0x2f2476=_0x23d982['rx'][_0x2ff2('0x19')](_0x15c2af);if(_0x2f2476){_0x1d333f=_0x2f2476[0x1];}else{_0x1d333f=null;}}else{_0x1d333f=null;}_0x23d982['cb'](null,{'code':_0x13cfff,'result':_0x1c8850,'extra':_0x1d333f});}});_0x2425fd['on']('error',function(_0x321b0a){_0x13f7fc['emit'](_0x2ff2('0x1a'),new AGIError(_0x2ff2('0x1b'),_0x321b0a[_0x2ff2('0x1c')]));});_0x2425fd['on'](_0x2ff2('0x1d'),function(){_0x13f7fc[_0x2ff2('0x1e')](_0x2ff2('0x1d'),new AGIError(_0x2ff2('0x1f')));});_0x2425fd['on'](_0x2ff2('0x20'),function(){_0x13f7fc[_0x2ff2('0x1e')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2425fd['destroy']();});_0x2425fd['pipe'](_0x2caf71);this[_0x2ff2('0x21')]=function(_0x51147a,_0x1009e1){var _0x51147a=_0x51147a||'',_0x1009e1=typeof _0x1009e1=='function'?_0x1009e1:new Function();_0x23d982={'tx':_0x51147a,'rx':'','cb':_0x1009e1};_0x2425fd['write'](_0x51147a+'\x0a');},this[_0x2ff2('0x1d')]=function(){_0x2425fd[_0x2ff2('0x22')]();};}util[_0x2ff2('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x25')]=function(_0x386841){return this['command']['sync'](this,_0x386841);};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x26')]=function(){return this['sendRequest'](_0x2ff2('0x27'));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x28')]=function(_0x3cffae,_0x2a7684,_0x2af017){_0x3cffae=_0x3cffae===undefined?_0x2ff2('0x29'):_0x3cffae;_0x2a7684=_0x2a7684===undefined?'5':_0x2a7684;_0x2af017=_0x2af017===undefined?'1':_0x2af017;return this[_0x2ff2('0x25')](util['format'](_0x2ff2('0x2a'),_0x3cffae,_0x2a7684*0x3e8,_0x2af017));};AGIChannel['prototype'][_0x2ff2('0x2b')]=function(_0x49b954){_0x49b954=_0x49b954||_0x2ff2('0x2c');return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x2e'),_0x49b954));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x2f')]=function(_0x116f9d,_0x2a9e81){if(_['isArray'](_0x2a9e81)){return this[_0x2ff2('0x25')](util['format']('EXEC\x20%s\x20%s',_0x116f9d,_0x2a9e81['join'](',')));}return this[_0x2ff2('0x25')](util['format'](_0x2ff2('0x30'),_0x116f9d,_0x2a9e81));};AGIChannel['prototype']['setContext']=function(_0x1b93a9){return this['sendRequest'](util['format'](_0x2ff2('0x31'),_0x1b93a9));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x32')]=function(_0x4b8082){return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x33'),_0x4b8082));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x34')]=function(_0x3d8f5b){return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x35'),_0x3d8f5b));};AGIChannel[_0x2ff2('0x24')]['hangup']=function(){return this[_0x2ff2('0x25')](_0x2ff2('0x36'));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x37')]=function(_0x52af86,_0x41507b){var _0x28de96=_[_0x2ff2('0x38')](_0x41507b)||_[_0x2ff2('0x39')](_0x41507b)?_0x41507b['toString']():_0x41507b;return this['sendRequest'](util[_0x2ff2('0x2d')](_0x2ff2('0x3a'),_0x52af86,_0x28de96?_0x28de96[_0x2ff2('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x2ff2('0x3c')]=function(_0x2f487c,_0x108907){return this['sendRequest'](util[_0x2ff2('0x2d')](_0x2ff2('0x3d'),_0x2f487c,_0x108907));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x3e')]=function(_0x36b9c8,_0x857d96){return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x3f'),_0x36b9c8,_0x857d96));};AGIChannel[_0x2ff2('0x24')]['sayPhonetic']=function(_0x18e7a4,_0x10edfa){return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x40'),_0x18e7a4,_0x10edfa));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x41')]=function(_0x531992,_0x3f9bb8,_0x2a1af7){_0x3f9bb8=_0x3f9bb8||this['extension'];_0x2a1af7=_0x2a1af7||0x1;this[_0x2ff2('0x42')](_0x531992);this['setExtension'](_0x3f9bb8);this[_0x2ff2('0x34')](_0x2a1af7);return this['noop'](util[_0x2ff2('0x2d')]('GOTO\x20%s\x20%s\x20%s',_0x531992,_0x3f9bb8,_0x2a1af7));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x43')]=function(_0x3d82a0){return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x44'),_0x3d82a0));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x45')]=function(_0x37a7fc,_0x4f5d14,_0x2bfd96,_0x51bd67,_0x22f593,_0x1706cb){_0x4f5d14=_0x4f5d14||_0x2ff2('0x46');_0x2bfd96=_0x2bfd96||'';_0x51bd67=_0x51bd67===undefined?-0x1:_0x51bd67==='-1'?-0x1:_0x51bd67*0x3e8;_0x22f593=_0x22f593===undefined?'':'s='+_0x22f593;_0x1706cb=_0x1706cb?_0x2ff2('0x47'):'';return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x48'),_0x37a7fc,_0x4f5d14,_0x2bfd96,_0x51bd67,_0x1706cb,_0x22f593));};AGIChannel[_0x2ff2('0x24')]['streamFile']=function(_0x36fa1d,_0x2c7d65){_0x2c7d65=_0x2c7d65||'';return this[_0x2ff2('0x25')](util[_0x2ff2('0x2d')](_0x2ff2('0x49'),_0x36fa1d,_0x2c7d65));};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x4a')]=function(_0x498869){return this['exec']('AGI',_0x498869);};AGIChannel[_0x2ff2('0x24')][_0x2ff2('0x4b')]=function(_0x69dce3){return this[_0x2ff2('0x2f')](_0x2ff2('0x4c'),_0x69dce3);};AGIChannel['prototype'][_0x2ff2('0x1a')]=function(_0x502990,_0x24c4af){this[_0x2ff2('0x2b')](util[_0x2ff2('0x2d')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x502990['id'],_0x502990[_0x2ff2('0x4d')],_0x24c4af));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xb258=['command','inherits','prototype','sendRequest','sync','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','lodash','events','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe'];(function(_0x26ac71,_0x6d8b7b){var _0x2caeba=function(_0x4e7910){while(--_0x4e7910){_0x26ac71['push'](_0x26ac71['shift']());}};_0x2caeba(++_0x6d8b7b);}(_0xb258,0x19c));var _0x8b25=function(_0x443c37,_0x23a5b2){_0x443c37=_0x443c37-0x0;var _0x582a41=_0xb258[_0x443c37];return _0x582a41;};'use strict';var util=require('util');var _=require(_0x8b25('0x0'));var EventEmitter=require(_0x8b25('0x1'))['EventEmitter'];var AGIReply=require(_0x8b25('0x2'));var AGIError=require(_0x8b25('0x3'));function AGIChannel(_0x2de324){var _0x47cb8e=this,_0x321087=new AGIReply(),_0x15393d=![],_0x43e7eb={};EventEmitter[_0x8b25('0x4')](_0x47cb8e);_0x2de324[_0x8b25('0x5')]('utf8');_0x2de324[_0x8b25('0x6')](0x8*0x3c*0x3c*0x3e8);_0x321087['setEncoding'](_0x8b25('0x7'));_0x321087['on'](_0x8b25('0x8'),function(_0x5d8410){for(var _0x1075d8 in _0x5d8410){_0x47cb8e[_0x1075d8]=_0x5d8410[_0x1075d8];}_0x47cb8e[_0x8b25('0x9')](_0x8b25('0xa'));});_0x321087['on']('line',function(_0x384218){if(_0x384218['toLowerCase']()==_0x8b25('0xb')){_0x47cb8e[_0x8b25('0x9')]('hangup');return;}if(_0x384218[_0x8b25('0xc')](0x0,0xb)==_0x8b25('0xd')){_0x15393d=!![];}if(_0x15393d){_0x43e7eb['rx']+=_0x384218+'\x0a';if(_0x384218[_0x8b25('0xe')](_0x8b25('0xf'))!=-0x1){_0x15393d=![];}}else{_0x43e7eb['rx']=_0x384218;}if(_0x15393d){return;}if(typeof _0x43e7eb['cb']==_0x8b25('0x10')){var _0x3ea6ca=_0x43e7eb['rx']['substring'](0x0,0x3),_0x1d0950=null,_0x552239=null;_0x3ea6ca=parseInt(_0x3ea6ca);if(isNaN(_0x3ea6ca)){_0x43e7eb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8b25('0x11')});return;}if(_0x3ea6ca!=0xc8){_0x43e7eb['cb'](null,{'code':_0x3ea6ca,'result':-0x1,'extra':'KO'});return;}_0x1d0950=_0x43e7eb['rx']['substring'](0x4)[_0x8b25('0x12')](_0x8b25('0x13'),'');if(_0x1d0950[_0x8b25('0x14')]('\x20')!=-0x1){_0x1d0950=_0x1d0950[_0x8b25('0x15')](0x0,_0x1d0950['indexOf']('\x20'));}if(_['startsWith'](_0x1d0950,'-1')){_0x1d0950=parseInt(_0x1d0950);}_0x552239=_0x43e7eb['rx'][_0x8b25('0x16')]('\x20');if(_0x552239[_0x8b25('0x17')]==0x3){_0x552239=_0x552239[0x2][_0x8b25('0xc')](0x1,_0x552239[0x2][_0x8b25('0x17')]-0x1);}else if(_0x552239[_0x8b25('0x17')]>0x3){var _0x218c4e=/\((.+)\)/;var _0x34de9f=_0x43e7eb['rx'][_0x8b25('0x18')](_0x218c4e);if(_0x34de9f){_0x552239=_0x34de9f[0x1];}else{_0x552239=null;}}else{_0x552239=null;}_0x43e7eb['cb'](null,{'code':_0x3ea6ca,'result':_0x1d0950,'extra':_0x552239});}});_0x2de324['on'](_0x8b25('0x19'),function(_0x39f814){_0x47cb8e[_0x8b25('0x9')](_0x8b25('0x19'),new AGIError(_0x8b25('0x1a'),_0x39f814['code']));});_0x2de324['on']('close',function(){_0x47cb8e[_0x8b25('0x9')](_0x8b25('0x1b'),new AGIError(_0x8b25('0x1c')));});_0x2de324['on'](_0x8b25('0x1d'),function(){_0x47cb8e[_0x8b25('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x2de324[_0x8b25('0x1e')]();});_0x2de324[_0x8b25('0x1f')](_0x321087);this[_0x8b25('0x20')]=function(_0x51b074,_0xb91883){var _0x51b074=_0x51b074||'',_0xb91883=typeof _0xb91883==_0x8b25('0x10')?_0xb91883:new Function();_0x43e7eb={'tx':_0x51b074,'rx':'','cb':_0xb91883};_0x2de324['write'](_0x51b074+'\x0a');},this[_0x8b25('0x1b')]=function(){_0x2de324['destroy']();};}util[_0x8b25('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x8b25('0x22')][_0x8b25('0x23')]=function(_0x13bede){return this[_0x8b25('0x20')][_0x8b25('0x24')](this,_0x13bede);};AGIChannel['prototype']['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x8b25('0x22')][_0x8b25('0x25')]=function(_0x2d4d60,_0x41edae,_0x5569df){_0x2d4d60=_0x2d4d60===undefined?_0x8b25('0x26'):_0x2d4d60;_0x41edae=_0x41edae===undefined?'5':_0x41edae;_0x5569df=_0x5569df===undefined?'1':_0x5569df;return this[_0x8b25('0x23')](util[_0x8b25('0x27')](_0x8b25('0x28'),_0x2d4d60,_0x41edae*0x3e8,_0x5569df));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x29')]=function(_0x3bce75){_0x3bce75=_0x3bce75||_0x8b25('0x2a');return this[_0x8b25('0x23')](util['format'](_0x8b25('0x2b'),_0x3bce75));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x2c')]=function(_0x58a265,_0x27c781){if(_[_0x8b25('0x2d')](_0x27c781)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x58a265,_0x27c781[_0x8b25('0x2e')](',')));}return this[_0x8b25('0x23')](util[_0x8b25('0x27')]('EXEC\x20%s\x20%s',_0x58a265,_0x27c781));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x2f')]=function(_0x5e50aa){return this[_0x8b25('0x23')](util[_0x8b25('0x27')](_0x8b25('0x30'),_0x5e50aa));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x31')]=function(_0xb387e3){return this[_0x8b25('0x23')](util[_0x8b25('0x27')](_0x8b25('0x32'),_0xb387e3));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x33')]=function(_0x4c44c2){return this[_0x8b25('0x23')](util[_0x8b25('0x27')](_0x8b25('0x34'),_0x4c44c2));};AGIChannel[_0x8b25('0x22')]['hangup']=function(){return this['sendRequest'](_0x8b25('0x35'));};AGIChannel['prototype']['setVariable']=function(_0xf686d3,_0x2f17ab){var _0x3a040f=_[_0x8b25('0x36')](_0x2f17ab)||_[_0x8b25('0x37')](_0x2f17ab)?_0x2f17ab['toString']():_0x2f17ab;return this[_0x8b25('0x23')](util[_0x8b25('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf686d3,_0x3a040f?_0x3a040f[_0x8b25('0x38')]()[_0x8b25('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x8b25('0x39')]=function(_0x38d269,_0x5366b1){return this[_0x8b25('0x23')](util['format'](_0x8b25('0x3a'),_0x38d269,_0x5366b1));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x3b')]=function(_0x333136,_0x15602a){return this[_0x8b25('0x23')](util[_0x8b25('0x27')](_0x8b25('0x3c'),_0x333136,_0x15602a));};AGIChannel[_0x8b25('0x22')]['sayPhonetic']=function(_0x384cc7,_0x4d1de7){return this[_0x8b25('0x23')](util['format'](_0x8b25('0x3d'),_0x384cc7,_0x4d1de7));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x3e')]=function(_0x3644f7,_0x5c3afe,_0x4afcb0){_0x5c3afe=_0x5c3afe||this[_0x8b25('0x3f')];_0x4afcb0=_0x4afcb0||0x1;this[_0x8b25('0x2f')](_0x3644f7);this[_0x8b25('0x31')](_0x5c3afe);this['setPriority'](_0x4afcb0);return this[_0x8b25('0x29')](util[_0x8b25('0x27')](_0x8b25('0x40'),_0x3644f7,_0x5c3afe,_0x4afcb0));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x41')]=function(_0x3c251e){return this['sendRequest'](util[_0x8b25('0x27')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3c251e));};AGIChannel['prototype'][_0x8b25('0x42')]=function(_0x57913c,_0x19f6d8,_0x4a8d87,_0x541512,_0x8543b9,_0x2f959c){_0x19f6d8=_0x19f6d8||'wav';_0x4a8d87=_0x4a8d87||'';_0x541512=_0x541512===undefined?-0x1:_0x541512==='-1'?-0x1:_0x541512*0x3e8;_0x8543b9=_0x8543b9===undefined?'':'s='+_0x8543b9;_0x2f959c=_0x2f959c?_0x8b25('0x43'):'';return this[_0x8b25('0x23')](util[_0x8b25('0x27')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x57913c,_0x19f6d8,_0x4a8d87,_0x541512,_0x2f959c,_0x8543b9));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x44')]=function(_0x579af3,_0x379fc4){_0x379fc4=_0x379fc4||'';return this[_0x8b25('0x23')](util[_0x8b25('0x27')](_0x8b25('0x45'),_0x579af3,_0x379fc4));};AGIChannel[_0x8b25('0x22')][_0x8b25('0x46')]=function(_0x569c16){return this[_0x8b25('0x2c')](_0x8b25('0x47'),_0x569c16);};AGIChannel['prototype']['wait']=function(_0x314e1f){return this['exec'](_0x8b25('0x48'),_0x314e1f);};AGIChannel['prototype'][_0x8b25('0x19')]=function(_0x1d3236,_0x5bcd9f){this[_0x8b25('0x29')](util[_0x8b25('0x27')](_0x8b25('0x49'),_0x1d3236['id'],_0x1d3236['label'],_0x5bcd9f));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 143a106..0ae4225 100644 --- a/server/services/agi/error.js +++ b/server/services/agi/error.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7528=['format','message','exports','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x11efa2,_0x5895b7){var _0x56a4e5=function(_0x2d303c){while(--_0x2d303c){_0x11efa2['push'](_0x11efa2['shift']());}};_0x56a4e5(++_0x5895b7);}(_0x7528,0x1d7));var _0x8752=function(_0x413c23,_0x353069){_0x413c23=_0x413c23-0x0;var _0x1eeb84=_0x7528[_0x413c23];return _0x1eeb84;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x8752('0x0'),'E_AGI_SERVER_CLOSE':_0x8752('0x1'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8752('0x2'),'E_AGI_SOCKET_CLOSE':_0x8752('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x8752('0x4'),'E_AGI_COMMAND_EMPTY':_0x8752('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8752('0x6'),'E_AGI_IVR_ENTRY':_0x8752('0x7')};function AGIError(_0x21e987){var _0x21e987=_0x21e987||null,_0xf2bdb5=_0xf2bdb5||[],_0x3be5d5=0x1,_0x1ed098='';if(!error[_0x21e987]){_0x21e987=_0x8752('0x8');}_0xf2bdb5['push'](error[_0x21e987]);while(arguments[_0x3be5d5]){_0xf2bdb5['push'](arguments[_0x3be5d5]);_0x3be5d5++;}_0x1ed098=util[_0x8752('0x9')]['apply'](util,_0xf2bdb5);this[_0x8752('0xa')]=_0x1ed098;this['name']=_0x21e987;}module[_0x8752('0xb')]=AGIError; \ No newline at end of file +var _0x672b=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x1750a9,_0x373841){var _0x409942=function(_0x449160){while(--_0x449160){_0x1750a9['push'](_0x1750a9['shift']());}};_0x409942(++_0x373841);}(_0x672b,0x7f));var _0xb672=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x672b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xb672('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xb672('0x1'),'E_AGI_SERVER_CLOSE':_0xb672('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xb672('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xb672('0x4'),'E_AGI_SOCKET_ERROR':_0xb672('0x5'),'E_AGI_SOCKET_CLOSE':_0xb672('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xb672('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xb672('0x8')};function AGIError(_0x5517be){var _0x5517be=_0x5517be||null,_0x1b0d49=_0x1b0d49||[],_0x3392a0=0x1,_0x6886fd='';if(!error[_0x5517be]){_0x5517be='E_AGI_UNDEFINED';}_0x1b0d49[_0xb672('0x9')](error[_0x5517be]);while(arguments[_0x3392a0]){_0x1b0d49[_0xb672('0x9')](arguments[_0x3392a0]);_0x3392a0++;}_0x6886fd=util[_0xb672('0xa')]['apply'](util,_0x1b0d49);this[_0xb672('0xb')]=_0x6886fd;this['name']=_0x5517be;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8b9ae70..2292be6 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2da7=['../../config/environment','redis','defaults','localhost','subscribe','emit','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','error','lodash','events','EventEmitter','ioredis','./error'];(function(_0x1702a1,_0x3c7d18){var _0x5b771b=function(_0x4c7213){while(--_0x4c7213){_0x1702a1['push'](_0x1702a1['shift']());}};_0x5b771b(++_0x3c7d18);}(_0x2da7,0x11c));var _0x72da=function(_0x2d1b3d,_0x3548c4){_0x2d1b3d=_0x2d1b3d-0x0;var _0x1cc32d=_0x2da7[_0x2d1b3d];return _0x1cc32d;};'use strict';var _=require(_0x72da('0x0'));var EventEmitter=require(_0x72da('0x1'))[_0x72da('0x2')];var Redis=require(_0x72da('0x3'));var AGIError=require(_0x72da('0x4'));var config=require(_0x72da('0x5'));config[_0x72da('0x6')]=_[_0x72da('0x7')](config[_0x72da('0x6')],{'host':_0x72da('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x72da('0x9')]('agi',function(_0x449be5){if(_0x449be5)return eventEmitter[_0x72da('0xa')]('error',new AGIError(_0x72da('0xb'),_0x449be5));});sub['on'](_0x72da('0xc'),function(_0x3aa7ff,_0x3d6231){if(_0x3aa7ff!==_0x72da('0xd'))return;try{var _0x9e278a=JSON[_0x72da('0xe')](_0x3d6231);eventEmitter[_0x72da('0xa')](_0x72da('0xf'),_0x9e278a);}catch(_0x2ff37f){eventEmitter[_0x72da('0xa')](_0x72da('0x10'),new AGIError('E_AGI_SERVER_ERROR',_0x2ff37f));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x8929=['E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi','emit','error'];(function(_0x3143ce,_0x469eca){var _0x5a9299=function(_0x58c692){while(--_0x58c692){_0x3143ce['push'](_0x3143ce['shift']());}};_0x5a9299(++_0x469eca);}(_0x8929,0xe2));var _0x9892=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0x8929[_0x4fc80b];return _0x119dba;};'use strict';var _=require(_0x9892('0x0'));var EventEmitter=require('events')[_0x9892('0x1')];var Redis=require(_0x9892('0x2'));var AGIError=require(_0x9892('0x3'));var config=require(_0x9892('0x4'));config[_0x9892('0x5')]=_[_0x9892('0x6')](config[_0x9892('0x5')],{'host':_0x9892('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x9892('0x5')]);sub[_0x9892('0x8')](_0x9892('0x9'),function(_0x46227f){if(_0x46227f)return eventEmitter[_0x9892('0xa')](_0x9892('0xb'),new AGIError(_0x9892('0xc'),_0x46227f));});sub['on'](_0x9892('0xd'),function(_0x780bbe,_0x44ee1d){if(_0x780bbe!=='agi')return;try{var _0x5b19e0=JSON[_0x9892('0xe')](_0x44ee1d);eventEmitter[_0x9892('0xa')](_0x9892('0xf'),_0x5b19e0);}catch(_0x2d5503){eventEmitter[_0x9892('0xa')](_0x9892('0xb'),new AGIError(_0x9892('0xc'),_0x2d5503));}});module[_0x9892('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index faaad5b..1e53c5f 100644 --- a/server/services/agi/graph/index.js +++ b/server/services/agi/graph/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf70=['no\x20edge/s\x20available','length','condition','agicommand','vswitch','target','default','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','getdigits','vertices','prototype','addVertex','edges','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse'];(function(_0x40f496,_0x14a198){var _0x1bbcf4=function(_0x45802d){while(--_0x45802d){_0x40f496['push'](_0x40f496['shift']());}};_0x1bbcf4(++_0x14a198);}(_0xcf70,0xe2));var _0x0cf7=function(_0xf4fee8,_0x5951ce){_0xf4fee8=_0xf4fee8-0x0;var _0x1303d7=_0xcf70[_0xf4fee8];return _0x1303d7;};'use strict';var _=require(_0x0cf7('0x0'));var logger=require(_0x0cf7('0x1'))(_0x0cf7('0x2'));var verticesWithRetry=['menu',_0x0cf7('0x3'),'getsecretdigits'];var Graph=function(){this[_0x0cf7('0x4')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x0cf7('0x5')][_0x0cf7('0x6')]=function(_0xe395a2){this[_0x0cf7('0x4')][_0xe395a2['id']]=_0xe395a2;this[_0x0cf7('0x7')][_0xe395a2['id']]=[];};Graph['prototype']['addEdge']=function(_0x3ed2bf,_0x12f3ee,_0x57a06e){this[_0x0cf7('0x7')][_0x3ed2bf][_0x0cf7('0x8')]({'target':_0x12f3ee,'condition':_0x57a06e});this[_0x0cf7('0x9')]+=0x1;};Graph[_0x0cf7('0x5')][_0x0cf7('0xa')]=function(){return _[_0x0cf7('0xa')](this[_0x0cf7('0x4')]);};Graph[_0x0cf7('0x5')][_0x0cf7('0xb')]=function(){return this[_0x0cf7('0x9')];};Graph[_0x0cf7('0x5')][_0x0cf7('0xc')]=function(_0x3fa3fb){return this['vertices'][_0x3fa3fb];};Graph[_0x0cf7('0x5')][_0x0cf7('0xd')]=function(_0x5ad28f,_0x194875){if(!this[_0x0cf7('0x4')][_0x5ad28f]){return logger[_0x0cf7('0xe')](_0x0cf7('0xf'));}var _0x5e9a89=_0x194875(this[_0x0cf7('0x4')][_0x5ad28f]);if(!_0x5e9a89){return logger['info'](_0x0cf7('0x10'));}if(this['edges'][_0x5ad28f]['length']===0x0){return logger[_0x0cf7('0xe')](_0x0cf7('0x11'));}for(var _0x8735be=0x0,_0x37fde5=[],_0x2c0d80=![];_0x8735be\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','find','production','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','stack','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','error','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','then','catch','hasOwnProperty','indexOf','agi_','variables','stringify'];(function(_0x26d4ac,_0x3093e9){var _0x3d683b=function(_0x16ce28){while(--_0x16ce28){_0x26d4ac['push'](_0x26d4ac['shift']());}};_0x3d683b(++_0x3093e9);}(_0x4bc3,0x1f2));var _0x34bc=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x4bc3[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x34bc('0x0'));var syncho=require(_0x34bc('0x1'));var util=require(_0x34bc('0x2'));var config=require(_0x34bc('0x3'));var logger=require(_0x34bc('0x4'))(_0x34bc('0x5'));var utilLicense=require(_0x34bc('0x6'));var rpc=require(_0x34bc('0x7'));var Project=require(_0x34bc('0x8'));var AGIEmitter=require(_0x34bc('0x9'))[_0x34bc('0xa')];var projects=[];config[_0x34bc('0x5')]=_[_0x34bc('0xb')](config[_0x34bc('0x5')],{'ip':_0x34bc('0xc'),'port':0x11dd});AGIEmitter['on'](_0x34bc('0xd'),projectUpdateHandler);function connectionHandler(_0x4c9bc1){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4c9bc1);agiHandler(_0x4c9bc1);}catch(_0x8d1f3d){logger['error'](_0x8d1f3d[_0x34bc('0xe')]);}});});}function projectUpdateHandler(_0xcc126e){try{var _0x462bba=_['findIndex'](projects,['id',_0xcc126e['id']]);if(_0x462bba>-0x1){if(_0xcc126e[_0x34bc('0xf')]===!![]){projects[_0x34bc('0x10')](_0x462bba,0x1);}else{projects[_0x462bba]=_0xcc126e;}}else{projects[_0x34bc('0x11')](_0xcc126e);}}catch(_0x202a0b){logger['error'](_0x202a0b[_0x34bc('0xe')]);}}function listeningHandler(){console[_0x34bc('0x12')](_0x34bc('0x13'),config[_0x34bc('0x5')][_0x34bc('0x14')]);logger[_0x34bc('0x15')](util[_0x34bc('0x16')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x34bc('0x5')]['ip'],config['agi'][_0x34bc('0x14')]));}function errorHandler(_0x4d7542){if(_0x4d7542&&_0x4d7542[_0x34bc('0x17')]&&_0x4d7542['message']){logger[_0x34bc('0x18')](util[_0x34bc('0x16')](_0x34bc('0x19'),_0x4d7542[_0x34bc('0x17')],_0x4d7542[_0x34bc('0x1a')]));}else{logger[_0x34bc('0x18')](util['format'](_0x34bc('0x1b'),_0x4d7542[_0x34bc('0xe')]));}}function closeHandler(){logger['info'](util[_0x34bc('0x16')](_0x34bc('0x1c'),this[_0x34bc('0x1d')],this['calleridname'],this[_0x34bc('0x1e')],this[_0x34bc('0x1f')],this['uniqueid']));try{createSquareReport(this);}catch(_0x17ce46){logger[_0x34bc('0x18')](_0x17ce46[_0x34bc('0xe')]);}}function timeoutHandler(){logger[_0x34bc('0x15')](util[_0x34bc('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x34bc('0x20')],this[_0x34bc('0x1e')],this[_0x34bc('0x1f')],this[_0x34bc('0x21')]));}function hangupHandler(){logger[_0x34bc('0x15')](util[_0x34bc('0x16')](_0x34bc('0x22'),this[_0x34bc('0x1d')],this[_0x34bc('0x20')],this[_0x34bc('0x1e')],this[_0x34bc('0x1f')],this[_0x34bc('0x21')]));this['evtHangup']=!![];}function createSquareReport(_0x5e340e,_0xa738f5){rpc['createSquareReport'](_0x5e340e)[_0x34bc('0x23')](function(_0xb09001){if(_0xa738f5){_0xa738f5(null,_0xb09001);}})[_0x34bc('0x24')](function(_0x9161f7){if(_0xa738f5){_0xa738f5(null,_0x9161f7);}});}function setChannelVariables(_0x39ead9){for(var _0x218f08 in _0x39ead9){if(_0x39ead9[_0x34bc('0x25')](_0x218f08)){if(_0x218f08[_0x34bc('0x26')](_0x34bc('0x27'))===0x0){_0x39ead9[_0x218f08['substring'](0x4)]=_0x39ead9[_0x218f08];delete _0x39ead9[_0x218f08];}}}}function agiHandler(_0x3d8201){logger['debug'](_0x34bc('0x28'),JSON[_0x34bc('0x29')](_0x3d8201,null,0x2));logger[_0x34bc('0x15')](util[_0x34bc('0x16')](_0x34bc('0x2a'),_0x3d8201[_0x34bc('0x1d')],_0x3d8201[_0x34bc('0x20')],_0x3d8201[_0x34bc('0x1e')],_0x3d8201['dnid'],_0x3d8201[_0x34bc('0x21')]));_0x3d8201['on'](_0x34bc('0x18'),errorHandler);_0x3d8201['on'](_0x34bc('0x2b'),closeHandler);_0x3d8201['on'](_0x34bc('0x2c'),timeoutHandler);_0x3d8201[_0x34bc('0x2d')]=![];_0x3d8201['on'](_0x34bc('0x2e'),hangupHandler);var _0x259205=_[_0x34bc('0x2f')](projects,[_0x34bc('0x17'),_0x3d8201[_0x34bc('0x1d')]]);if(!_0x259205)return Project['handleNotFound'](_0x3d8201);if(!_0x259205[_0x34bc('0x30')])return Project['handleUnpublished'](_0x3d8201);return Project[_0x34bc('0x31')](_0x259205,_0x3d8201);}function main(){var _0x474671;return utilLicense[_0x34bc('0x32')]()['then'](function(_0x27e9f2){if(!_0x27e9f2)return;if(_0x27e9f2['voice']){if(_0x27e9f2[_0x34bc('0x33')]&&_0x27e9f2[_0x34bc('0x33')]>0x0){logger[_0x34bc('0x15')](util['format'](_0x34bc('0x34'),_0x27e9f2['callysquare']));_0x474671=_0x27e9f2[_0x34bc('0x33')];}else{logger[_0x34bc('0x15')](_0x34bc('0x35'));}}else{logger[_0x34bc('0x15')](_0x34bc('0x36'));_0x474671=-0x1;}})['then'](function(){return Project[_0x34bc('0x37')]();})[_0x34bc('0x23')](function(_0xf161e9){projects=_0xf161e9;return;})['catch'](function(_0x5cdc9c){logger[_0x34bc('0x18')](_0x34bc('0x38'),_0x5cdc9c['stack']);})[_0x34bc('0x39')](function(){var _0x2d7a48=require(_0x34bc('0x3a'))(config[_0x34bc('0x5')][_0x34bc('0x14')],config['agi']['ip'],_0x474671);_0x2d7a48['on'](_0x34bc('0x18'),errorHandler);_0x2d7a48['on']('listening',listeningHandler);_0x2d7a48['on'](_0x34bc('0x3b'),connectionHandler);_0x2d7a48['on'](_0x34bc('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0x9071=['handleNotFound','production','handleUnpublished','initialize','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','syncho','util','../../config/environment','agi','../../config/license/util','./rpc','./project','defaults','127.0.0.1','projectUpdate','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','debug','variables','stringify','close','timeout','hangup','find'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x9071,0xc1));var _0x1907=function(_0x2ea179,_0x11a524){_0x2ea179=_0x2ea179-0x0;var _0x10c245=_0x9071[_0x2ea179];return _0x10c245;};'use strict';var _=require('lodash');var syncho=require(_0x1907('0x0'));var util=require(_0x1907('0x1'));var config=require(_0x1907('0x2'));var logger=require('../../config/logger')(_0x1907('0x3'));var utilLicense=require(_0x1907('0x4'));var rpc=require(_0x1907('0x5'));var Project=require(_0x1907('0x6'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x1907('0x3')]=_[_0x1907('0x7')](config[_0x1907('0x3')],{'ip':_0x1907('0x8'),'port':0x11dd});AGIEmitter['on'](_0x1907('0x9'),projectUpdateHandler);function connectionHandler(_0x203aab){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x203aab);agiHandler(_0x203aab);}catch(_0x1d5afd){logger[_0x1907('0xa')](_0x1d5afd[_0x1907('0xb')]);}});});}function projectUpdateHandler(_0x58e701){try{var _0x57c937=_[_0x1907('0xc')](projects,['id',_0x58e701['id']]);if(_0x57c937>-0x1){if(_0x58e701[_0x1907('0xd')]===!![]){projects[_0x1907('0xe')](_0x57c937,0x1);}else{projects[_0x57c937]=_0x58e701;}}else{projects[_0x1907('0xf')](_0x58e701);}}catch(_0x1eea22){logger[_0x1907('0xa')](_0x1eea22[_0x1907('0xb')]);}}function listeningHandler(){console[_0x1907('0x10')](_0x1907('0x11'),config['agi']['port']);logger['info'](util['format'](_0x1907('0x12'),config[_0x1907('0x3')]['ip'],config[_0x1907('0x3')]['port']));}function errorHandler(_0x3949e7){if(_0x3949e7&&_0x3949e7[_0x1907('0x13')]&&_0x3949e7[_0x1907('0x14')]){logger[_0x1907('0xa')](util[_0x1907('0x15')](_0x1907('0x16'),_0x3949e7[_0x1907('0x13')],_0x3949e7[_0x1907('0x14')]));}else{logger[_0x1907('0xa')](util[_0x1907('0x15')](_0x1907('0x17'),_0x3949e7[_0x1907('0xb')]));}}function closeHandler(){logger[_0x1907('0x18')](util[_0x1907('0x15')](_0x1907('0x19'),this[_0x1907('0x1a')],this['calleridname'],this[_0x1907('0x1b')],this[_0x1907('0x1c')],this[_0x1907('0x1d')]));try{createSquareReport(this);}catch(_0x31876a){logger[_0x1907('0xa')](_0x31876a['stack']);}}function timeoutHandler(){logger[_0x1907('0x18')](util[_0x1907('0x15')](_0x1907('0x1e'),this[_0x1907('0x1a')],this[_0x1907('0x1f')],this[_0x1907('0x1b')],this[_0x1907('0x1c')],this[_0x1907('0x1d')]));}function hangupHandler(){logger[_0x1907('0x18')](util['format'](_0x1907('0x20'),this[_0x1907('0x1a')],this[_0x1907('0x1f')],this['callerid'],this['dnid'],this[_0x1907('0x1d')]));this[_0x1907('0x21')]=!![];}function createSquareReport(_0x1f7d74,_0x27ea8c){rpc[_0x1907('0x22')](_0x1f7d74)[_0x1907('0x23')](function(_0x436f9f){if(_0x27ea8c){_0x27ea8c(null,_0x436f9f);}})[_0x1907('0x24')](function(_0x56a573){if(_0x27ea8c){_0x27ea8c(null,_0x56a573);}});}function setChannelVariables(_0x28c14b){for(var _0x527ada in _0x28c14b){if(_0x28c14b[_0x1907('0x25')](_0x527ada)){if(_0x527ada[_0x1907('0x26')](_0x1907('0x27'))===0x0){_0x28c14b[_0x527ada['substring'](0x4)]=_0x28c14b[_0x527ada];delete _0x28c14b[_0x527ada];}}}}function agiHandler(_0x2178ec){logger[_0x1907('0x28')](_0x1907('0x29'),JSON[_0x1907('0x2a')](_0x2178ec,null,0x2));logger['info'](util[_0x1907('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2178ec[_0x1907('0x1a')],_0x2178ec[_0x1907('0x1f')],_0x2178ec[_0x1907('0x1b')],_0x2178ec[_0x1907('0x1c')],_0x2178ec['uniqueid']));_0x2178ec['on']('error',errorHandler);_0x2178ec['on'](_0x1907('0x2b'),closeHandler);_0x2178ec['on'](_0x1907('0x2c'),timeoutHandler);_0x2178ec[_0x1907('0x21')]=![];_0x2178ec['on'](_0x1907('0x2d'),hangupHandler);var _0x2baf9b=_[_0x1907('0x2e')](projects,[_0x1907('0x13'),_0x2178ec[_0x1907('0x1a')]]);if(!_0x2baf9b)return Project[_0x1907('0x2f')](_0x2178ec);if(!_0x2baf9b[_0x1907('0x30')])return Project[_0x1907('0x31')](_0x2178ec);return Project[_0x1907('0x32')](_0x2baf9b,_0x2178ec);}function main(){var _0xb0c549;return utilLicense['getLicense']()[_0x1907('0x23')](function(_0x2f7e27){if(!_0x2f7e27)return;if(_0x2f7e27['voice']){if(_0x2f7e27[_0x1907('0x33')]&&_0x2f7e27[_0x1907('0x33')]>0x0){logger['info'](util[_0x1907('0x15')](_0x1907('0x34'),_0x2f7e27[_0x1907('0x33')]));_0xb0c549=_0x2f7e27['callysquare'];}else{logger[_0x1907('0x18')](_0x1907('0x35'));}}else{logger['info'](_0x1907('0x36'));_0xb0c549=-0x1;}})['then'](function(){return Project[_0x1907('0x37')]();})['then'](function(_0x266d95){projects=_0x266d95;return;})[_0x1907('0x24')](function(_0x17a79a){logger[_0x1907('0xa')](_0x1907('0x38'),_0x17a79a[_0x1907('0xb')]);})[_0x1907('0x39')](function(){var _0x50a65c=require('./server')(config[_0x1907('0x3')]['port'],config[_0x1907('0x3')]['ip'],_0xb0c549);_0x50a65c['on'](_0x1907('0xa'),errorHandler);_0x50a65c['on'](_0x1907('0x3a'),listeningHandler);_0x50a65c['on'](_0x1907('0x3b'),connectionHandler);_0x50a65c['on'](_0x1907('0x2b'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index e0f911f..aef076c 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x253b=['result','sendMailMessage','SendMail','client','request','then','error','message'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x253b,0x14b));var _0xb253=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x253b[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xb253('0x0')]['http']({'port':0x232b});function request(_0x19dc5c,_0x252725){return new BPromise(function(_0x48587f,_0x1938b9){return client[_0xb253('0x1')](_0x19dc5c,_0x252725)[_0xb253('0x2')](function(_0x692a78){if(_0x692a78[_0xb253('0x3')]){return _0x1938b9(_0x692a78['error'][_0xb253('0x4')]);}else{return _0x48587f(_0x692a78[_0xb253('0x5')]);}})['catch'](function(_0x14d560){return _0x1938b9(_0x14d560);});});}exports[_0xb253('0x6')]=function(_0x366e4b,_0x5839f6){return request(_0xb253('0x7'),{'account':_0x366e4b,'message':_0x5839f6});}; \ No newline at end of file +var _0xb316=['result','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','error','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb316,0x6f));var _0x6b31=function(_0x5d2f35,_0x5b8f73){_0x5d2f35=_0x5d2f35-0x0;var _0x59aad0=_0xb316[_0x5d2f35];return _0x59aad0;};'use strict';var BPromise=require(_0x6b31('0x0'));var jayson=require(_0x6b31('0x1'));var client=jayson[_0x6b31('0x2')][_0x6b31('0x3')]({'port':0x232b});function request(_0x48d1ea,_0x25bebe){return new BPromise(function(_0x519545,_0x57d90a){return client['request'](_0x48d1ea,_0x25bebe)['then'](function(_0xf4285){if(_0xf4285[_0x6b31('0x4')]){return _0x57d90a(_0xf4285[_0x6b31('0x4')][_0x6b31('0x5')]);}else{return _0x519545(_0xf4285[_0x6b31('0x6')]);}})['catch'](function(_0x3a7d03){return _0x57d90a(_0x3a7d03);});});}exports[_0x6b31('0x7')]=function(_0x25268a,_0x444a9a){return request(_0x6b31('0x8'),{'account':_0x25268a,'message':_0x444a9a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 5161ff4..4194ea6 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4c7=['xml2json','util','agi','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','toJson','root','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','lodash','moment'];(function(_0x27080f,_0x1868d1){var _0x53d605=function(_0x3cb0aa){while(--_0x3cb0aa){_0x27080f['push'](_0x27080f['shift']());}};_0x53d605(++_0x1868d1);}(_0xd4c7,0x1ee));var _0x7d4c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd4c7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7d4c('0x0'));var moment=require(_0x7d4c('0x1'));var parser=require(_0x7d4c('0x2'));var util=require(_0x7d4c('0x3'));var logger=require('../../config/logger')(_0x7d4c('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x7d4c('0x5'));var Graph=require(_0x7d4c('0x6'));var Vertices=require(_0x7d4c('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7d4c('0x8')]()[_0x7d4c('0x9')](function(_0x468d8b){logger[_0x7d4c('0xa')](_0x7d4c('0xb'),_0x468d8b[_0x7d4c('0xc')]);return[];});}function addVertex(_0x202eb4,_0x6f83db,_0x11f574){_0x6f83db[_0x7d4c('0xd')]=_0x11f574;if(_0x6f83db[_0x7d4c('0xe')]('retry')){_0x6f83db['maxRetry']=parseInt(_0x6f83db[_0x7d4c('0xf')],0xa);}_0x202eb4[_0x7d4c('0x10')](_[_0x7d4c('0x11')](_0x6f83db,_0x7d4c('0x12')));}function initGraph(_0x2e369,_0x2f0f74){var _0xfbdd23=new Graph();for(var _0x3a113d in _0x2e369){if(_0x2e369['hasOwnProperty'](_0x3a113d)){if(_[_0x7d4c('0x13')](_0x2e369[_0x3a113d])){for(var _0x50ecf7=0x0;_0x50ecf7<_0x2e369[_0x3a113d]['length'];_0x50ecf7+=0x1){addVertex(_0xfbdd23,_0x2e369[_0x3a113d][_0x50ecf7],_0x3a113d);}}else{addVertex(_0xfbdd23,_0x2e369[_0x3a113d],_0x3a113d);}}}for(var _0x567062=0x0;_0x567062<_0x2f0f74[_0x7d4c('0x14')];_0x567062+=0x1){if(_0x2f0f74[_0x567062]['source']&&_0x2f0f74[_0x567062][_0x7d4c('0x15')]){_0xfbdd23[_0x7d4c('0x16')](_0x2f0f74[_0x567062][_0x7d4c('0x17')],_0x2f0f74[_0x567062]['target'],_0x2f0f74[_0x567062][_0x7d4c('0x18')]);}}return _0xfbdd23;}function getRoot(_0x47a36b){return parser[_0x7d4c('0x19')](_0x47a36b,{'object':!![]})['mxGraphModel'][_0x7d4c('0x1a')];}function inspect(_0x4349ff){return util['inspect'](_0x4349ff,{'showHidden':![],'depth':null});}function initialize(_0x376f44,_0x12b92a){var _0x59768a=getRoot(_0x376f44[_0x7d4c('0x1b')]);if(!_0x59768a||!_0x59768a[_0x7d4c('0x1c')])return;var _0x1c7366,_0x2516f1,_0x544900;logger[_0x7d4c('0x1d')](_0x7d4c('0x1a'),JSON[_0x7d4c('0x1e')](_0x59768a,null,0x2));_0x12b92a[_0x7d4c('0x1f')]=moment()['format'](_0x7d4c('0x20'));_0x1c7366=initGraph(_[_0x7d4c('0x11')](_0x59768a,_0x7d4c('0x12')),_0x59768a['mxCell']);_0x2516f1=new Vertices(_0x12b92a,rpc,mailRpc);logger[_0x7d4c('0x21')](util[_0x7d4c('0x22')](_0x7d4c('0x23'),_0x12b92a['arg_1'],_0x12b92a[_0x7d4c('0x24')],_0x12b92a['callerid'],_0x12b92a['dnid'],_0x12b92a[_0x7d4c('0x25')]));_0x1c7366[_0x7d4c('0x26')](_0x59768a['start']['id'],function(_0x28b61b){try{_0x28b61b=_0x2516f1[_0x7d4c('0x27')](_0x28b61b);logger[_0x7d4c('0x1d')](_0x7d4c('0x28'),JSON['stringify'](_0x28b61b,null,0x2));if(_0x28b61b[_0x7d4c('0xd')]===_0x7d4c('0x29')){logger[_0x7d4c('0x21')](_0x7d4c('0x2a'));_0x12b92a[_0x7d4c('0x2b')]=_0x28b61b['context']||_0x12b92a[_0x7d4c('0x2b')];_0x12b92a['extension']=_0x28b61b[_0x7d4c('0x2c')];_0x12b92a[_0x7d4c('0x2d')]=_0x28b61b[_0x7d4c('0x2d')]?_0x28b61b[_0x7d4c('0x2d')]-0x1:0x1;return null;}else if(_0x28b61b&&_0x2516f1[_0x28b61b[_0x7d4c('0xd')]]){_0x544900=_0x2516f1[_0x28b61b['agicommand']](_0x28b61b);logger['info'](_0x7d4c('0x2e'),JSON[_0x7d4c('0x1e')](_0x544900,null,0x2));if(_0x544900&&_0x544900[_0x7d4c('0x2f')]===AGI_CODE_SUCCESS&&_0x544900[_0x7d4c('0x30')]!==AGI_RESULT_ERROR&&!_0x12b92a[_0x7d4c('0x31')]){logger[_0x7d4c('0x1d')]('response',inspect(_0x544900));return _[_0x7d4c('0x32')](_0x544900['result'])?null:_0x544900['result']['toString']();}else{logger[_0x7d4c('0xa')](_0x7d4c('0x2e'),inspect(_0x544900));return null;}}else{logger[_0x7d4c('0xa')](_0x7d4c('0x33'));return null;}}catch(_0x16f5d8){logger['error'](_0x16f5d8['stack']);return null;}});if(_0x59768a['finally']){logger['info'](util[_0x7d4c('0x22')](_0x7d4c('0x34'),_0x12b92a[_0x7d4c('0x35')],_0x12b92a['calleridname'],_0x12b92a[_0x7d4c('0x36')],_0x12b92a[_0x7d4c('0x37')],_0x12b92a[_0x7d4c('0x25')]));_0x1c7366['traverseBFS'](_0x59768a['finally']['id'],function(_0xe50e6f){try{_0xe50e6f=_0x2516f1[_0x7d4c('0x27')](_0xe50e6f);logger[_0x7d4c('0x1d')](_0x7d4c('0x28'),JSON[_0x7d4c('0x1e')](_0xe50e6f,null,0x2));if(_0xe50e6f&&_0x2516f1[_0xe50e6f['agicommand']]){_0x544900=_0x2516f1[_0xe50e6f[_0x7d4c('0xd')]](_0xe50e6f);if(_0x544900){logger['debug'](_0x7d4c('0x2e'),inspect(_0x544900));return _['isUndefined'](_0x544900['result'])?null:_0x544900['result'][_0x7d4c('0x38')]();}else{logger[_0x7d4c('0xa')](_0x7d4c('0x2e'),inspect(_0x544900));return null;}}else{logger[_0x7d4c('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x2bee69){logger['error'](_0x2bee69[_0x7d4c('0xc')]);return null;}});}logger[_0x7d4c('0x21')](util[_0x7d4c('0x22')](_0x7d4c('0x39'),_0x12b92a[_0x7d4c('0x35')],_0x12b92a[_0x7d4c('0x24')],_0x12b92a[_0x7d4c('0x36')],_0x12b92a[_0x7d4c('0x37')],_0x12b92a[_0x7d4c('0x25')]));logger[_0x7d4c('0x21')](util[_0x7d4c('0x22')](_0x7d4c('0x3a'),_0x12b92a[_0x7d4c('0x2b')],_0x12b92a[_0x7d4c('0x2c')],parseInt(_0x12b92a[_0x7d4c('0x2d')],0xa)+0x1));_0x12b92a[_0x7d4c('0x3b')](_0x12b92a['context'],_0x12b92a[_0x7d4c('0x2c')],parseInt(_0x12b92a['priority'],0xa)+0x1);_0x12b92a['close']();}function handleNotFound(_0x2f2afc){logger['error'](util[_0x7d4c('0x22')](_0x7d4c('0x3c'),_0x2f2afc[_0x7d4c('0x35')]));_0x2f2afc['continueAt'](_0x2f2afc['context'],_0x2f2afc[_0x7d4c('0x2c')],parseInt(_0x2f2afc[_0x7d4c('0x2d')],0xa)+0x1);_0x2f2afc[_0x7d4c('0x3d')]();}function handleUnpublished(_0x247a8b){logger[_0x7d4c('0xa')](util['format']('Project\x20%s\x20not\x20published',_0x247a8b['arg_1']));_0x247a8b[_0x7d4c('0x3b')](_0x247a8b[_0x7d4c('0x2b')],_0x247a8b[_0x7d4c('0x2c')],parseInt(_0x247a8b[_0x7d4c('0x2d')],0xa)+0x1);_0x247a8b[_0x7d4c('0x3d')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x0ed4=['continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','exports','lodash','moment','agi','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','target','addEdge','source','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','agicommand','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s'];(function(_0x390bec,_0x4709c6){var _0x567d65=function(_0x124ea2){while(--_0x124ea2){_0x390bec['push'](_0x390bec['shift']());}};_0x567d65(++_0x4709c6);}(_0x0ed4,0x7f));var _0x40ed=function(_0x4ede00,_0x16905f){_0x4ede00=_0x4ede00-0x0;var _0x5455a6=_0x0ed4[_0x4ede00];return _0x5455a6;};'use strict';var _=require(_0x40ed('0x0'));var moment=require(_0x40ed('0x1'));var parser=require('xml2json');var util=require('util');var logger=require('../../config/logger')(_0x40ed('0x2'));var rpc=require(_0x40ed('0x3'));var mailRpc=require(_0x40ed('0x4'));var Graph=require(_0x40ed('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x40ed('0x6')]()[_0x40ed('0x7')](function(_0x22f503){logger[_0x40ed('0x8')](_0x40ed('0x9'),_0x22f503[_0x40ed('0xa')]);return[];});}function addVertex(_0x116720,_0x3f197c,_0x527d18){_0x3f197c['agicommand']=_0x527d18;if(_0x3f197c[_0x40ed('0xb')](_0x40ed('0xc'))){_0x3f197c[_0x40ed('0xd')]=parseInt(_0x3f197c[_0x40ed('0xc')],0xa);}_0x116720[_0x40ed('0xe')](_[_0x40ed('0xf')](_0x3f197c,_0x40ed('0x10')));}function initGraph(_0x24ede6,_0x5c05c3){var _0x534f2c=new Graph();for(var _0x55e645 in _0x24ede6){if(_0x24ede6[_0x40ed('0xb')](_0x55e645)){if(_[_0x40ed('0x11')](_0x24ede6[_0x55e645])){for(var _0x2da34e=0x0;_0x2da34e<_0x24ede6[_0x55e645][_0x40ed('0x12')];_0x2da34e+=0x1){addVertex(_0x534f2c,_0x24ede6[_0x55e645][_0x2da34e],_0x55e645);}}else{addVertex(_0x534f2c,_0x24ede6[_0x55e645],_0x55e645);}}}for(var _0x1f4329=0x0;_0x1f4329<_0x5c05c3[_0x40ed('0x12')];_0x1f4329+=0x1){if(_0x5c05c3[_0x1f4329]['source']&&_0x5c05c3[_0x1f4329][_0x40ed('0x13')]){_0x534f2c[_0x40ed('0x14')](_0x5c05c3[_0x1f4329][_0x40ed('0x15')],_0x5c05c3[_0x1f4329]['target'],_0x5c05c3[_0x1f4329][_0x40ed('0x16')]);}}return _0x534f2c;}function getRoot(_0x34c339){return parser[_0x40ed('0x17')](_0x34c339,{'object':!![]})[_0x40ed('0x18')][_0x40ed('0x19')];}function inspect(_0x477f0c){return util[_0x40ed('0x1a')](_0x477f0c,{'showHidden':![],'depth':null});}function initialize(_0x354a69,_0x45a28a){var _0x5ed38b=getRoot(_0x354a69['production']);if(!_0x5ed38b||!_0x5ed38b[_0x40ed('0x1b')])return;var _0x3bdeae,_0x56dbe9,_0x3bf0a8;logger[_0x40ed('0x1c')]('root',JSON[_0x40ed('0x1d')](_0x5ed38b,null,0x2));_0x45a28a['joinAt']=moment()[_0x40ed('0x1e')](_0x40ed('0x1f'));_0x3bdeae=initGraph(_[_0x40ed('0xf')](_0x5ed38b,'mxCell'),_0x5ed38b['mxCell']);_0x56dbe9=new Vertices(_0x45a28a,rpc,mailRpc);logger['info'](util[_0x40ed('0x1e')](_0x40ed('0x20'),_0x45a28a[_0x40ed('0x21')],_0x45a28a[_0x40ed('0x22')],_0x45a28a[_0x40ed('0x23')],_0x45a28a[_0x40ed('0x24')],_0x45a28a[_0x40ed('0x25')]));_0x3bdeae[_0x40ed('0x26')](_0x5ed38b[_0x40ed('0x1b')]['id'],function(_0xeac854){try{_0xeac854=_0x56dbe9[_0x40ed('0x27')](_0xeac854);logger[_0x40ed('0x1c')](_0x40ed('0x28'),JSON['stringify'](_0xeac854,null,0x2));if(_0xeac854[_0x40ed('0x29')]===_0x40ed('0x2a')){logger[_0x40ed('0x2b')](_0x40ed('0x2c'));_0x45a28a['context']=_0xeac854['context']||_0x45a28a[_0x40ed('0x2d')];_0x45a28a[_0x40ed('0x2e')]=_0xeac854[_0x40ed('0x2e')];_0x45a28a[_0x40ed('0x2f')]=_0xeac854[_0x40ed('0x2f')]?_0xeac854[_0x40ed('0x2f')]-0x1:0x1;return null;}else if(_0xeac854&&_0x56dbe9[_0xeac854[_0x40ed('0x29')]]){_0x3bf0a8=_0x56dbe9[_0xeac854[_0x40ed('0x29')]](_0xeac854);logger[_0x40ed('0x2b')](_0x40ed('0x30'),JSON[_0x40ed('0x1d')](_0x3bf0a8,null,0x2));if(_0x3bf0a8&&_0x3bf0a8['code']===AGI_CODE_SUCCESS&&_0x3bf0a8[_0x40ed('0x31')]!==AGI_RESULT_ERROR&&!_0x45a28a['evtHangup']){logger[_0x40ed('0x1c')](_0x40ed('0x30'),inspect(_0x3bf0a8));return _[_0x40ed('0x32')](_0x3bf0a8[_0x40ed('0x31')])?null:_0x3bf0a8['result'][_0x40ed('0x33')]();}else{logger[_0x40ed('0x8')](_0x40ed('0x30'),inspect(_0x3bf0a8));return null;}}else{logger[_0x40ed('0x8')](_0x40ed('0x34'));return null;}}catch(_0x5c6983){logger['error'](_0x5c6983[_0x40ed('0xa')]);return null;}});if(_0x5ed38b['finally']){logger[_0x40ed('0x2b')](util[_0x40ed('0x1e')](_0x40ed('0x35'),_0x45a28a['arg_1'],_0x45a28a[_0x40ed('0x22')],_0x45a28a[_0x40ed('0x23')],_0x45a28a[_0x40ed('0x24')],_0x45a28a[_0x40ed('0x25')]));_0x3bdeae['traverseBFS'](_0x5ed38b[_0x40ed('0x36')]['id'],function(_0x258267){try{_0x258267=_0x56dbe9[_0x40ed('0x27')](_0x258267);logger[_0x40ed('0x1c')]('vertex',JSON['stringify'](_0x258267,null,0x2));if(_0x258267&&_0x56dbe9[_0x258267['agicommand']]){_0x3bf0a8=_0x56dbe9[_0x258267[_0x40ed('0x29')]](_0x258267);if(_0x3bf0a8){logger[_0x40ed('0x1c')]('response',inspect(_0x3bf0a8));return _[_0x40ed('0x32')](_0x3bf0a8[_0x40ed('0x31')])?null:_0x3bf0a8[_0x40ed('0x31')][_0x40ed('0x33')]();}else{logger['error'](_0x40ed('0x30'),inspect(_0x3bf0a8));return null;}}else{logger[_0x40ed('0x8')](_0x40ed('0x34'));return null;}}catch(_0x3d4a9e){logger[_0x40ed('0x8')](_0x3d4a9e[_0x40ed('0xa')]);return null;}});}logger['info'](util[_0x40ed('0x1e')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x45a28a['arg_1'],_0x45a28a[_0x40ed('0x22')],_0x45a28a[_0x40ed('0x23')],_0x45a28a['dnid'],_0x45a28a[_0x40ed('0x25')]));logger[_0x40ed('0x2b')](util[_0x40ed('0x1e')](_0x40ed('0x37'),_0x45a28a['context'],_0x45a28a[_0x40ed('0x2e')],parseInt(_0x45a28a['priority'],0xa)+0x1));_0x45a28a[_0x40ed('0x38')](_0x45a28a[_0x40ed('0x2d')],_0x45a28a['extension'],parseInt(_0x45a28a[_0x40ed('0x2f')],0xa)+0x1);_0x45a28a['close']();}function handleNotFound(_0x3bbbda){logger[_0x40ed('0x8')](util[_0x40ed('0x1e')](_0x40ed('0x39'),_0x3bbbda[_0x40ed('0x21')]));_0x3bbbda['continueAt'](_0x3bbbda[_0x40ed('0x2d')],_0x3bbbda['extension'],parseInt(_0x3bbbda[_0x40ed('0x2f')],0xa)+0x1);_0x3bbbda[_0x40ed('0x3a')]();}function handleUnpublished(_0x52fc9f){logger[_0x40ed('0x8')](util['format'](_0x40ed('0x3b'),_0x52fc9f[_0x40ed('0x21')]));_0x52fc9f[_0x40ed('0x38')](_0x52fc9f[_0x40ed('0x2d')],_0x52fc9f['extension'],parseInt(_0x52fc9f[_0x40ed('0x2f')],0xa)+0x1);_0x52fc9f[_0x40ed('0x3a')]();}module[_0x40ed('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 2ef66dc..31d20c4 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd18=['util','stream','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','split','slice','trim','emit','headers','exports'];(function(_0x434138,_0x74656){var _0x40ebdd=function(_0x2b8c41){while(--_0x2b8c41){_0x434138['push'](_0x434138['shift']());}};_0x40ebdd(++_0x74656);}(_0xcd18,0xb4));var _0x8cd1=function(_0x4a39af,_0x86837){_0x4a39af=_0x4a39af-0x0;var _0x33a9a5=_0xcd18[_0x4a39af];return _0x33a9a5;};'use strict';var util=require(_0x8cd1('0x0'));var Transform=require(_0x8cd1('0x1'))['Transform'];function AGIReply(_0x15c9ef){Transform[_0x8cd1('0x2')](this,_0x15c9ef);this['_localBuffer']='';this[_0x8cd1('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x8cd1('0x4')][_0x8cd1('0x5')]=function(_0x5b152d,_0x12a9b7,_0x2b6649){var _0x2d35e4='\x0a',_0x375f15=['\x0a\x0a',_0x8cd1('0x6')],_0x16eecb=-0x1,_0x3cd29b=-0x1,_0x10b229='',_0x52b6fd=0x0,_0x9abcc7='',_0x6a7f9b='';this[_0x8cd1('0x7')]+=_0x5b152d[_0x8cd1('0x8')]();_0x9abcc7=this[_0x8cd1('0x7')];if(!this[_0x8cd1('0x3')]){_0x52b6fd=0x0;while(_0x375f15[_0x52b6fd]){while((_0x3cd29b=_0x9abcc7[_0x8cd1('0x9')](_0x375f15[_0x52b6fd]))!=-0x1){_0x10b229=_0x375f15[_0x52b6fd];_0x6a7f9b=_0x9abcc7['substring'](0x0,_0x3cd29b);_0x9abcc7=_0x9abcc7[_0x8cd1('0xa')](_0x3cd29b+_0x10b229[_0x8cd1('0xb')]);var _0x564c99=_0x6a7f9b[_0x8cd1('0xc')](_0x2d35e4),_0x41a984=0x0,_0xf5d628={},_0x5acfd3='',_0x27c04e='',_0x22cbc7=-0x1;while(_0x564c99[_0x41a984]){_0x22cbc7=_0x564c99[_0x41a984]['indexOf'](':');if(_0x22cbc7!=-0x1){_0x5acfd3=_0x564c99[_0x41a984][_0x8cd1('0xd')](0x0,_0x22cbc7)[_0x8cd1('0xe')]();_0x27c04e=_0x564c99[_0x41a984][_0x8cd1('0xd')](_0x22cbc7+0x1)[_0x8cd1('0xe')]();if(_0x5acfd3[_0x8cd1('0xb')]>0x0){_0xf5d628[_0x5acfd3]=_0x27c04e;}}else{}_0x41a984++;}this[_0x8cd1('0xf')](_0x8cd1('0x10'),_0xf5d628);this[_0x8cd1('0x3')]=!![];}_0x52b6fd++;}this['_localBuffer']=_0x9abcc7;}else{while((_0x16eecb=_0x9abcc7[_0x8cd1('0x9')](_0x2d35e4))!=-0x1){_0x6a7f9b=_0x9abcc7[_0x8cd1('0xa')](0x0,_0x16eecb);this[_0x8cd1('0xf')]('line',_0x6a7f9b);_0x9abcc7=_0x9abcc7[_0x8cd1('0xa')](_0x16eecb+_0x2d35e4[_0x8cd1('0xb')]);}this['_localBuffer']=_0x9abcc7;}_0x2b6649();};module[_0x8cd1('0x11')]=AGIReply; \ No newline at end of file +var _0x0592=['split','slice','trim','emit','headers','util','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','toString','indexOf','substring','length'];(function(_0x49fc58,_0x59f2e5){var _0x304bcb=function(_0x1eb830){while(--_0x1eb830){_0x49fc58['push'](_0x49fc58['shift']());}};_0x304bcb(++_0x59f2e5);}(_0x0592,0xf3));var _0x2059=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0592[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x2059('0x0'));var Transform=require(_0x2059('0x1'))[_0x2059('0x2')];function AGIReply(_0x35d280){Transform[_0x2059('0x3')](this,_0x35d280);this[_0x2059('0x4')]='';this[_0x2059('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x2059('0x6')][_0x2059('0x7')]=function(_0x2538f7,_0x1bd39e,_0x2e0d68){var _0xca0d47='\x0a',_0x5f226e=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xc6e0=-0x1,_0x3de42a=-0x1,_0xcf4993='',_0x168c1a=0x0,_0x2b698a='',_0xad5ab1='';this['_localBuffer']+=_0x2538f7[_0x2059('0x8')]();_0x2b698a=this[_0x2059('0x4')];if(!this[_0x2059('0x5')]){_0x168c1a=0x0;while(_0x5f226e[_0x168c1a]){while((_0x3de42a=_0x2b698a[_0x2059('0x9')](_0x5f226e[_0x168c1a]))!=-0x1){_0xcf4993=_0x5f226e[_0x168c1a];_0xad5ab1=_0x2b698a['substring'](0x0,_0x3de42a);_0x2b698a=_0x2b698a[_0x2059('0xa')](_0x3de42a+_0xcf4993[_0x2059('0xb')]);var _0xb2a964=_0xad5ab1[_0x2059('0xc')](_0xca0d47),_0x49e3c1=0x0,_0xe925e3={},_0x3684f8='',_0x7440f2='',_0xe2cd24=-0x1;while(_0xb2a964[_0x49e3c1]){_0xe2cd24=_0xb2a964[_0x49e3c1][_0x2059('0x9')](':');if(_0xe2cd24!=-0x1){_0x3684f8=_0xb2a964[_0x49e3c1][_0x2059('0xd')](0x0,_0xe2cd24)[_0x2059('0xe')]();_0x7440f2=_0xb2a964[_0x49e3c1][_0x2059('0xd')](_0xe2cd24+0x1)[_0x2059('0xe')]();if(_0x3684f8[_0x2059('0xb')]>0x0){_0xe925e3[_0x3684f8]=_0x7440f2;}}else{}_0x49e3c1++;}this[_0x2059('0xf')](_0x2059('0x10'),_0xe925e3);this['_inBody']=!![];}_0x168c1a++;}this[_0x2059('0x4')]=_0x2b698a;}else{while((_0xc6e0=_0x2b698a[_0x2059('0x9')](_0xca0d47))!=-0x1){_0xad5ab1=_0x2b698a['substring'](0x0,_0xc6e0);this[_0x2059('0xf')]('line',_0xad5ab1);_0x2b698a=_0x2b698a[_0x2059('0xa')](_0xc6e0+_0xca0d47[_0x2059('0xb')]);}this['_localBuffer']=_0x2b698a;}_0x2e0d68();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9721a55..bc14a1f 100644 --- a/server/services/agi/rpc/index.js +++ b/server/services/agi/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde64=['getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','error','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xde64,0x17c));var _0x4de6=function(_0x18dfc4,_0x21f90c){_0x18dfc4=_0x18dfc4-0x0;var _0x4bee95=_0xde64[_0x18dfc4];return _0x4bee95;};'use strict';var _=require(_0x4de6('0x0'));var moment=require(_0x4de6('0x1'));var jayson=require(_0x4de6('0x2'));var client=jayson[_0x4de6('0x3')][_0x4de6('0x4')]({'port':0x2329});function request(_0x3421c5,_0x5d77e7){return new Promise(function(_0x3c4b91,_0x3bd290){return client['request'](_0x3421c5,_0x5d77e7)['then'](function(_0xe0bed){if(_0xe0bed[_0x4de6('0x5')]){return _0x3bd290(_0xe0bed['error']['message']);}else{return _0x3c4b91(_0xe0bed[_0x4de6('0x6')]);}})[_0x4de6('0x7')](function(_0x475fb9){return _0x3bd290(_0x475fb9);});});}exports[_0x4de6('0x8')]=function(){return request(_0x4de6('0x9'),{'options':{'raw':![],'attributes':['id',_0x4de6('0xa'),'production']}});};exports[_0x4de6('0xb')]=function(_0x45329b){return request(_0x4de6('0xc'),{'options':{'raw':![],'where':{'name':_0x45329b},'attributes':['production']}});};exports[_0x4de6('0xd')]=function(_0x170183){return request(_0x4de6('0xe'),{'options':{'raw':![],'where':{'id':_0x170183},'include':[{'model':_0x4de6('0xf'),'as':_0x4de6('0x10'),'include':[{'model':'CloudProvider','as':_0x4de6('0x11')}]}],'attributes':['id',_0x4de6('0xa'),_0x4de6('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x46d3e0){return request(_0x4de6('0xc'),{'options':{'where':{'id':_0x46d3e0},'attributes':[_0x4de6('0xa')]}});};exports[_0x4de6('0x13')]=function(_0x58b0c1){return request(_0x4de6('0x14'),{'options':{'where':{'id':_0x58b0c1},'attributes':[_0x4de6('0xa')]}});};exports[_0x4de6('0x15')]=function(_0x4dd3b5){return request(_0x4de6('0x16'),{'options':{'where':{'id':_0x4dd3b5},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x30b3b8){return request(_0x4de6('0x17'),{'options':{'where':{'id':_0x30b3b8},'attributes':[_0x4de6('0x18')]}});};exports[_0x4de6('0x19')]=function(_0x37975a){return request(_0x4de6('0x1a'),{'options':{'where':{'id':_0x37975a},'attributes':[_0x4de6('0xa')]}});};exports['getContactByPhone']=function(_0x420f7c){return request(_0x4de6('0x1b'),{'options':{'where':{'phone':_0x420f7c[_0x4de6('0x1c')]},'attributes':['id']}});};exports[_0x4de6('0x1d')]=function(_0x167c7c){return request(_0x4de6('0x1e'),{'options':{'where':{'id':_0x167c7c},'attributes':[_0x4de6('0xa')]}});};exports[_0x4de6('0x1f')]=function(_0x1b935f){return request(_0x4de6('0x20'),{'options':{'where':{'id':_0x1b935f},'attributes':['save_name']}});};exports[_0x4de6('0x21')]=function(_0x51ad13){return request(_0x4de6('0x22'),{'options':{'raw':![],'where':{'id':_0x51ad13},'include':[{'model':_0x4de6('0x23'),'as':_0x4de6('0x24')}]}});};exports['getSmsAccountById']=function(_0xe1b69d){return request('ShowSmsAccount',{'options':{'where':{'id':_0xe1b69d},'attributes':['id',_0x4de6('0xa')]}});};exports[_0x4de6('0x25')]=function(_0x1a64e9){return request('CreateSmsMessage',{'body':_0x1a64e9});};exports[_0x4de6('0x26')]=function(_0x2789e0){return request(_0x4de6('0x27'),{'body':_0x2789e0});};exports[_0x4de6('0x28')]=function(_0x8d0007){return request(_0x4de6('0x29'),{'body':_[_0x4de6('0x2a')](_0x8d0007,{'project_name':_0x8d0007['arg_1'],'prev_project_name':_0x8d0007[_0x4de6('0x2b')]||'','is_subproject':_0x8d0007[_0x4de6('0x2b')]?!![]:![],'leaveAt':moment()[_0x4de6('0x2c')](_0x4de6('0x2d'))})});};exports[_0x4de6('0x2e')]=function(_0x281060){return request(_0x4de6('0x2f'),{'body':_0x281060});};exports[_0x4de6('0x30')]=function(_0x28cf1e){return request('CreateSquareMessage',{'body':_0x28cf1e});};exports[_0x4de6('0x31')]=function(_0x2a5592){return request(_0x4de6('0x32'),{'options':{'raw':![],'where':{'phone':_0x2a5592[_0x4de6('0x1c')],'ListId':_0x2a5592[_0x4de6('0x33')]}}})['then'](function(_0x2a6797){if(_0x2a6797){return _0x2a6797;}return request('CreateCmContact',{'body':_0x2a5592});});};exports[_0x4de6('0x34')]=function(_0x2bfc77){return request(_0x4de6('0x35'),{'options':{'where':{'id':_0x2bfc77},'attributes':[_0x4de6('0xa')]}});};exports['agentLogin']=function(_0x5593e8,_0x530e04){return request('LoginUser',{'body':{'interface':_0x530e04},'options':{'where':_0x5593e8}});};exports['agentPause']=function(_0x46d57a,_0x1da3b1,_0x4a5274){return request(_0x4de6('0x36'),{'body':{'type':_0x1da3b1,'uniqueid':_0x4a5274},'options':{'where':_0x46d57a}});};exports[_0x4de6('0x37')]=function(_0x2bb3c2){return request(_0x4de6('0x38'),{'body':{},'options':{'where':_0x2bb3c2}});};exports[_0x4de6('0x39')]=function(_0x175ee9){return request(_0x4de6('0x3a'),{'body':{},'options':{'where':_0x175ee9}});}; \ No newline at end of file +var _0x18d6=['ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','lodash','moment','client','http','request','error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject'];(function(_0x2bcc60,_0x442350){var _0x54dae3=function(_0x2ef9c4){while(--_0x2ef9c4){_0x2bcc60['push'](_0x2bcc60['shift']());}};_0x54dae3(++_0x442350);}(_0x18d6,0x166));var _0x618d=function(_0x3475bb,_0x20708c){_0x3475bb=_0x3475bb-0x0;var _0x1d7815=_0x18d6[_0x3475bb];return _0x1d7815;};'use strict';var _=require(_0x618d('0x0'));var moment=require(_0x618d('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x618d('0x2')][_0x618d('0x3')]({'port':0x2329});function request(_0x2a5bc1,_0x3b0d41){return new Promise(function(_0x5f341a,_0x3151de){return client[_0x618d('0x4')](_0x2a5bc1,_0x3b0d41)['then'](function(_0x41f56a){if(_0x41f56a['error']){return _0x3151de(_0x41f56a[_0x618d('0x5')][_0x618d('0x6')]);}else{return _0x5f341a(_0x41f56a['result']);}})[_0x618d('0x7')](function(_0x45d2d3){return _0x3151de(_0x45d2d3);});});}exports[_0x618d('0x8')]=function(){return request(_0x618d('0x9'),{'options':{'raw':![],'attributes':['id',_0x618d('0xa'),_0x618d('0xb')]}});};exports[_0x618d('0xc')]=function(_0x48bd76){return request(_0x618d('0xd'),{'options':{'raw':![],'where':{'name':_0x48bd76},'attributes':[_0x618d('0xb')]}});};exports['getMailAccountById']=function(_0xd7cc0e){return request(_0x618d('0xe'),{'options':{'raw':![],'where':{'id':_0xd7cc0e},'include':[{'model':_0x618d('0xf'),'as':_0x618d('0x10'),'include':[{'model':_0x618d('0x11'),'as':_0x618d('0x11')}]}],'attributes':['id',_0x618d('0xa'),_0x618d('0x12')],'smtp':!![]}});};exports[_0x618d('0x13')]=function(_0x17dfd9){return request('ShowSquareProject',{'options':{'where':{'id':_0x17dfd9},'attributes':['name']}});};exports[_0x618d('0x14')]=function(_0x3ff5d1){return request(_0x618d('0x15'),{'options':{'where':{'id':_0x3ff5d1},'attributes':[_0x618d('0xa')]}});};exports[_0x618d('0x16')]=function(_0x1f584a){return request(_0x618d('0x17'),{'options':{'where':{'id':_0x1f584a},'attributes':[_0x618d('0xa')]}});};exports[_0x618d('0x18')]=function(_0x456aaf){return request(_0x618d('0x19'),{'options':{'where':{'id':_0x456aaf},'attributes':[_0x618d('0x1a')]}});};exports[_0x618d('0x1b')]=function(_0x499ae8){return request(_0x618d('0x1c'),{'options':{'where':{'id':_0x499ae8},'attributes':[_0x618d('0xa')]}});};exports[_0x618d('0x1d')]=function(_0x2799e6){return request('GetContactByPhone',{'options':{'where':{'phone':_0x2799e6[_0x618d('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x5644a7){return request(_0x618d('0x1f'),{'options':{'where':{'id':_0x5644a7},'attributes':['name']}});};exports[_0x618d('0x20')]=function(_0x2855eb){return request(_0x618d('0x21'),{'options':{'where':{'id':_0x2855eb},'attributes':[_0x618d('0x22')]}});};exports[_0x618d('0x23')]=function(_0x104c3d){return request(_0x618d('0x24'),{'options':{'raw':![],'where':{'id':_0x104c3d},'include':[{'model':_0x618d('0x25'),'as':_0x618d('0x26')}]}});};exports[_0x618d('0x27')]=function(_0x4d55ee){return request(_0x618d('0x28'),{'options':{'where':{'id':_0x4d55ee},'attributes':['id',_0x618d('0xa')]}});};exports[_0x618d('0x29')]=function(_0x3aa5a2){return request(_0x618d('0x2a'),{'body':_0x3aa5a2});};exports[_0x618d('0x2b')]=function(_0x14da0c){return request('CreateSquareDetailsReport',{'body':_0x14da0c});};exports[_0x618d('0x2c')]=function(_0x1624c3){return request(_0x618d('0x2d'),{'body':_[_0x618d('0x2e')](_0x1624c3,{'project_name':_0x1624c3['arg_1'],'prev_project_name':_0x1624c3[_0x618d('0x2f')]||'','is_subproject':_0x1624c3[_0x618d('0x2f')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x618d('0x30')]=function(_0x2492ee){return request('CreateSquareRecording',{'body':_0x2492ee});};exports['createSquareMessage']=function(_0x2267d6){return request(_0x618d('0x31'),{'body':_0x2267d6});};exports[_0x618d('0x32')]=function(_0x2d1ece){return request(_0x618d('0x33'),{'options':{'raw':![],'where':{'phone':_0x2d1ece[_0x618d('0x1e')],'ListId':_0x2d1ece[_0x618d('0x34')]}}})[_0x618d('0x35')](function(_0x2baf89){if(_0x2baf89){return _0x2baf89;}return request(_0x618d('0x36'),{'body':_0x2d1ece});});};exports[_0x618d('0x37')]=function(_0x54d0e4){return request(_0x618d('0x38'),{'options':{'where':{'id':_0x54d0e4},'attributes':[_0x618d('0xa')]}});};exports[_0x618d('0x39')]=function(_0x182934,_0x3820f5){return request(_0x618d('0x3a'),{'body':{'interface':_0x3820f5},'options':{'where':_0x182934}});};exports['agentPause']=function(_0x1211a5,_0x461d0a,_0x3ed97d){return request(_0x618d('0x3b'),{'body':{'type':_0x461d0a,'uniqueid':_0x3ed97d},'options':{'where':_0x1211a5}});};exports[_0x618d('0x3c')]=function(_0x14dc57){return request('UnpauseUser',{'body':{},'options':{'where':_0x14dc57}});};exports[_0x618d('0x3d')]=function(_0x822877){return request('LogoutUser',{'body':{},'options':{'where':_0x822877}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 627dcf9..4f7c0b0 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba0d=['./polly','exports'];(function(_0x1f35fb,_0x556409){var _0x18d2b3=function(_0x7bdbcf){while(--_0x7bdbcf){_0x1f35fb['push'](_0x1f35fb['shift']());}};_0x18d2b3(++_0x556409);}(_0xba0d,0x8e));var _0xdba0=function(_0x574435,_0x54f42c){_0x574435=_0x574435-0x0;var _0x267011=_0xba0d[_0x574435];return _0x267011;};var polly=require(_0xdba0('0x0'));var lex=require('./lex');module[_0xdba0('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x06f4=['./polly','./lex'];(function(_0x4173ed,_0x796b8e){var _0x8551f=function(_0x3f91c5){while(--_0x3f91c5){_0x4173ed['push'](_0x4173ed['shift']());}};_0x8551f(++_0x796b8e);}(_0x06f4,0x136));var _0x406f=function(_0x277a91,_0x1a5ece){_0x277a91=_0x277a91-0x0;var _0x38c482=_0x06f4[_0x277a91];return _0x38c482;};var polly=require(_0x406f('0x0'));var lex=require(_0x406f('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 5d9137c..22515b4 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb){return lex(_0x2936e7,_0x2afa91,_0x27405a,_0x305d85,_0x864539,_0x52b5fb);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 3a4e40c..3321341 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x12487f,_0x5c77a3){var _0x58eb66=function(_0x101e98){while(--_0x101e98){_0x12487f['push'](_0x12487f['shift']());}};_0x58eb66(++_0x5c77a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x586c66,_0x3fae9f){var _0x35515f=function(_0x2fe7ae){while(--_0x2fe7ae){_0x586c66['push'](_0x586c66['shift']());}};_0x35515f(++_0x3fae9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 7d83bb4..a987000 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35f2=['exports'];(function(_0x1e18a7,_0x540959){var _0x28f883=function(_0x24b213){while(--_0x24b213){_0x1e18a7['push'](_0x1e18a7['shift']());}};_0x28f883(++_0x540959);}(_0x35f2,0x1dc));var _0x235f=function(_0x4c3a36,_0xdba60f){_0x4c3a36=_0x4c3a36-0x0;var _0x40f945=_0x35f2[_0x4c3a36];return _0x40f945;};'use strict';var polly=require('./lib/api');module[_0x235f('0x0')]=function(_0xa80f6f,_0x36067a,_0x515723,_0x157f53,_0x23030c,_0x15245a,_0x12b5ef){return polly(_0xa80f6f,_0x36067a,_0x515723,_0x157f53,_0x23030c,_0x15245a,_0x12b5ef);}; \ No newline at end of file +var _0xdcbc=['./lib/api','exports'];(function(_0x315cf1,_0x5c5b4a){var _0x574278=function(_0x5abd6a){while(--_0x5abd6a){_0x315cf1['push'](_0x315cf1['shift']());}};_0x574278(++_0x5c5b4a);}(_0xdcbc,0x184));var _0xcdcb=function(_0x3d3305,_0x1cc5bc){_0x3d3305=_0x3d3305-0x0;var _0x3cb8c2=_0xdcbc[_0x3d3305];return _0x3cb8c2;};'use strict';var polly=require(_0xcdcb('0x0'));module[_0xcdcb('0x1')]=function(_0x1b1a30,_0x2b278d,_0x494387,_0x22001d,_0x1491c4,_0x2c1dfd,_0x531848){return polly(_0x1b1a30,_0x2b278d,_0x494387,_0x22001d,_0x1491c4,_0x2c1dfd,_0x531848);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 393d684..2b13d7b 100644 --- a/server/services/agi/scripts/aws/polly/lib/api.js +++ b/server/services/agi/scripts/aws/polly/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc96b=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring'];(function(_0x56b762,_0x538831){var _0x125e18=function(_0x5623){while(--_0x5623){_0x56b762['push'](_0x56b762['shift']());}};_0x125e18(++_0x538831);}(_0xc96b,0x195));var _0xbc96=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc96b[_0xa464c9];return _0x3d73c4;};'use strict';var fs=require('fs');var path=require(_0xbc96('0x0'));var BPromise=require(_0xbc96('0x1'));var rs=require(_0xbc96('0x2'));var AWS=require(_0xbc96('0x3'));function pollyResult(_0xca448d,_0x37c805,_0x3a2b37){return new BPromise(function(_0x5025c9,_0x2c8b48){_0xca448d[_0xbc96('0x4')](_0x37c805,function(_0x1311aa,_0xc46559){if(_0x1311aa){_0x2c8b48(_0x1311aa);}else if(_0xc46559){if(_0xc46559[_0xbc96('0x5')]instanceof Buffer){fs[_0xbc96('0x6')](_0x3a2b37,_0xc46559[_0xbc96('0x5')],function(_0x36b4d2){if(_0x36b4d2){_0x2c8b48(_0x36b4d2);}else{_0x5025c9();}});}else{_0x2c8b48(new Error(_0xbc96('0x7')));}}else{_0x2c8b48(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xbc96('0x8')]=function(_0x2f9ad9,_0x26ef3c,_0x47af77,_0x2cbcdc,_0x498816,_0x36aeff,_0x1d67f7){var _0x580f3f=new AWS[(_0xbc96('0x9'))]({'accessKeyId':_0x2f9ad9,'secretAccessKey':_0x26ef3c,'region':_0x47af77});var _0xbf4351={'Text':_0x498816,'TextType':_0x36aeff||_0xbc96('0xa'),'OutputFormat':_0xbc96('0xb'),'VoiceId':_0x2cbcdc};return pollyResult(_0x580f3f,_0xbf4351,_0x1d67f7);}; \ No newline at end of file +var _0x8333=['writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x171b2f,_0x337677){var _0x4678d8=function(_0x160fce){while(--_0x160fce){_0x171b2f['push'](_0x171b2f['shift']());}};_0x4678d8(++_0x337677);}(_0x8333,0x163));var _0x3833=function(_0x596fa6,_0x57ff15){_0x596fa6=_0x596fa6-0x0;var _0xb09094=_0x8333[_0x596fa6];return _0xb09094;};'use strict';var fs=require('fs');var path=require(_0x3833('0x0'));var BPromise=require(_0x3833('0x1'));var rs=require(_0x3833('0x2'));var AWS=require(_0x3833('0x3'));function pollyResult(_0xb9adf5,_0x368d76,_0x508d91){return new BPromise(function(_0x53ca23,_0x5ca486){_0xb9adf5[_0x3833('0x4')](_0x368d76,function(_0x5c4f49,_0x454b40){if(_0x5c4f49){_0x5ca486(_0x5c4f49);}else if(_0x454b40){if(_0x454b40['AudioStream']instanceof Buffer){fs[_0x3833('0x5')](_0x508d91,_0x454b40[_0x3833('0x6')],function(_0x44cd98){if(_0x44cd98){_0x5ca486(_0x44cd98);}else{_0x53ca23();}});}else{_0x5ca486(new Error(_0x3833('0x7')));}}else{_0x5ca486(new Error(_0x3833('0x8')));}});});}module[_0x3833('0x9')]=function(_0x34d9c9,_0x47bd88,_0x5065de,_0x1bb5c4,_0x5a9a6a,_0x19b970,_0x5a8c29){var _0x5483a0=new AWS[(_0x3833('0xa'))]({'accessKeyId':_0x34d9c9,'secretAccessKey':_0x47bd88,'region':_0x5065de});var _0x49cb7a={'Text':_0x5a9a6a,'TextType':_0x19b970||'text','OutputFormat':_0x3833('0xb'),'VoiceId':_0x1bb5c4};return pollyResult(_0x5483a0,_0x49cb7a,_0x5a8c29);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index d53fcf2..7fca569 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x013a=['exports','./lib/api'];(function(_0xeeab65,_0x57c636){var _0x1e0b1d=function(_0x1155a2){while(--_0x1155a2){_0xeeab65['push'](_0xeeab65['shift']());}};_0x1e0b1d(++_0x57c636);}(_0x013a,0x193));var _0xa013=function(_0x48404b,_0x107b24){_0x48404b=_0x48404b-0x0;var _0x5bec5a=_0x013a[_0x48404b];return _0x5bec5a;};'use strict';var asr=require(_0xa013('0x0'));module[_0xa013('0x1')]=function(_0x358466,_0x4ebf49,_0x55d83b,_0x38435a){return asr(_0x358466,_0x4ebf49,_0x55d83b);}; \ No newline at end of file +var _0x26a2=['./lib/api','exports'];(function(_0x3ba133,_0x36ff11){var _0x269313=function(_0x23de6b){while(--_0x23de6b){_0x3ba133['push'](_0x3ba133['shift']());}};_0x269313(++_0x36ff11);}(_0x26a2,0xa4));var _0x226a=function(_0x1f554a,_0x1c9496){_0x1f554a=_0x1f554a-0x0;var _0xf1da33=_0x26a2[_0x1f554a];return _0xf1da33;};'use strict';var asr=require(_0x226a('0x0'));module[_0x226a('0x1')]=function(_0x910af8,_0x2bc255,_0x55a175,_0x24b8d6){return asr(_0x910af8,_0x2bc255,_0x55a175);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 929df21..ed6aadf 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5ba=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x4bb5ec,_0x1a681f){var _0xcfc39f=function(_0x376cb9){while(--_0x376cb9){_0x4bb5ec['push'](_0x4bb5ec['shift']());}};_0xcfc39f(++_0x1a681f);}(_0xc5ba,0xb9));var _0xac5b=function(_0x25b022,_0x394a08){_0x25b022=_0x25b022-0x0;var _0x2e13a5=_0xc5ba[_0x25b022];return _0x2e13a5;};'use strict';var url=require(_0xac5b('0x0'));var BPromise=require(_0xac5b('0x1'));var fs=require('fs');var host=_0xac5b('0x2');module[_0xac5b('0x3')]=function(_0x2faba9,_0x34fad9,_0x3158cd){return new BPromise(function(_0x1292a5,_0x3d0dc6){var _0x3c48f1;if(typeof _0x2faba9!==_0xac5b('0x4')||_0x2faba9[_0xac5b('0x5')]===0x0){return _0x3d0dc6(_0xac5b('0x6'));}if(typeof _0x34fad9!==_0xac5b('0x4')||_0x34fad9[_0xac5b('0x5')]===0x0){return _0x3d0dc6(_0xac5b('0x7'));}if(typeof _0x3158cd!==_0xac5b('0x8')&&(typeof _0x3158cd!=='string'||_0x3158cd['length']===0x0)){return _0x3d0dc6(_0xac5b('0x9'));}try{_0x3c48f1=fs['readFileSync'](_0x2faba9)[_0xac5b('0xa')](_0xac5b('0xb'));}catch(_0x221d70){return _0x3d0dc6(_0x221d70);}return _0x1292a5({'method':_0xac5b('0xc'),'uri':host+_0xac5b('0xd')+_0x34fad9,'body':{'config':{'encoding':_0xac5b('0xe'),'sampleRateHertz':_0xac5b('0xf'),'languageCode':_0x3158cd},'audio':{'content':_0x3c48f1}},'json':!![]});});}; \ No newline at end of file +var _0x4a47=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x23a264,_0x1e54a8){var _0x574e12=function(_0x127d60){while(--_0x127d60){_0x23a264['push'](_0x23a264['shift']());}};_0x574e12(++_0x1e54a8);}(_0x4a47,0xb5));var _0x74a4=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x4a47[_0x553502];return _0x246c37;};'use strict';var url=require(_0x74a4('0x0'));var BPromise=require(_0x74a4('0x1'));var fs=require('fs');var host=_0x74a4('0x2');module[_0x74a4('0x3')]=function(_0x43adbe,_0x54d63a,_0x24cff9){return new BPromise(function(_0x55c541,_0x2aa3d1){var _0x450c10;if(typeof _0x43adbe!=='string'||_0x43adbe[_0x74a4('0x4')]===0x0){return _0x2aa3d1(_0x74a4('0x5'));}if(typeof _0x54d63a!==_0x74a4('0x6')||_0x54d63a['length']===0x0){return _0x2aa3d1(_0x74a4('0x7'));}if(typeof _0x24cff9!=='undefined'&&(typeof _0x24cff9!==_0x74a4('0x6')||_0x24cff9['length']===0x0)){return _0x2aa3d1(_0x74a4('0x8'));}try{_0x450c10=fs[_0x74a4('0x9')](_0x43adbe)[_0x74a4('0xa')](_0x74a4('0xb'));}catch(_0x56a17a){return _0x2aa3d1(_0x56a17a);}return _0x55c541({'method':_0x74a4('0xc'),'uri':host+_0x74a4('0xd')+_0x54d63a,'body':{'config':{'encoding':_0x74a4('0xe'),'sampleRateHertz':_0x74a4('0xf'),'languageCode':_0x24cff9},'audio':{'content':_0x450c10}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 5871603..9d10bfa 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb90c=['./asr','exports'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0xb90c,0x1d0));var _0xcb90=function(_0x541095,_0x582b30){_0x541095=_0x541095-0x0;var _0x5a2c40=_0xb90c[_0x541095];return _0x5a2c40;};var asr=require(_0xcb90('0x0'));module[_0xcb90('0x1')]={'asr':asr}; \ No newline at end of file +var _0x29c8=['./asr','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x29c8,0x1da));var _0x829c=function(_0x3d27aa,_0x53cca5){_0x3d27aa=_0x3d27aa-0x0;var _0xad9874=_0x29c8[_0x3d27aa];return _0xad9874;};var asr=require(_0x829c('0x0'));module[_0x829c('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 4e64668..1ec5071 100644 --- a/server/services/agi/scripts/index.js +++ b/server/services/agi/scripts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dc5=['Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','querystring','request-promise','randomstring','google-tts-api','parse','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','get','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','statusCode','createWriteStream','finish','error','unlink','pipe','end','host','WHAT_EVER','data','wav','error\x20convert','info','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','resolve','.mp3','from','audioContent','writeFile','777','googleTTS','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','actionIncomplete','fulfillment','score','status','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','name','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR'];(function(_0x1f1122,_0x521358){var _0xb4bd63=function(_0x231e62){while(--_0x231e62){_0x1f1122['push'](_0x1f1122['shift']());}};_0xb4bd63(++_0x521358);}(_0x4dc5,0x97));var _0x54dc=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x4dc5[_0x25d386];return _0x857f4a;};'use strict';var apiai=require(_0x54dc('0x0'));var BPromise=require(_0x54dc('0x1'));var dialogflow=require(_0x54dc('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x54dc('0x3'));var md5=require('md5');var path=require(_0x54dc('0x4'));var querystring=require(_0x54dc('0x5'));var rp=require(_0x54dc('0x6'));var rs=require(_0x54dc('0x7'));var sox=require('sox');var tts=require(_0x54dc('0x8'));var urlParse=require('url')[_0x54dc('0x9')];var util=require(_0x54dc('0xa'));var aws=require(_0x54dc('0xb'));var google=require('./google');var sestek=require(_0x54dc('0xc'));var tilde=require('./tilde');var logger=require(_0x54dc('0xd'))(_0x54dc('0xe'));var ISPEECH_API=_0x54dc('0xf');function downloadFile(_0x402a52,_0x581a3f){return new BPromise(function(_0x3b8b1c,_0x517b3e){var _0x201f1f=urlParse(_0x402a52);var _0x2e20c9=_0x201f1f[_0x54dc('0x10')]==='https:'?https:http;var _0x5dc08f={'host':_0x201f1f['host'],'path':_0x201f1f[_0x54dc('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x2e20c9[_0x54dc('0x11')](_0x5dc08f,function(_0x3fb77b){if(_0x3fb77b['statusCode']!==0xc8){logger['error']('request\x20to\x20'+_0x402a52+_0x54dc('0x12')+_0x3fb77b['statusCode']+'\x20('+_0x3fb77b[_0x54dc('0x13')]+')');_0x517b3e(new Error(_0x54dc('0x14')+_0x402a52+_0x54dc('0x12')+_0x3fb77b[_0x54dc('0x15')]+'\x20('+_0x3fb77b['statusMessage']+')'));return;}var _0x2e6c2e=fs[_0x54dc('0x16')](_0x581a3f);_0x2e6c2e['on'](_0x54dc('0x17'),function(){logger['info']('finish\x20download\x20file');_0x2e6c2e['close'](_0x3b8b1c);});_0x2e6c2e['on'](_0x54dc('0x18'),function(_0x48a020){fs[_0x54dc('0x19')](_0x581a3f);logger['error']('download\x20error',_0x48a020);_0x517b3e(_0x48a020);});_0x3fb77b[_0x54dc('0x1a')](_0x2e6c2e);})['on'](_0x54dc('0x18'),function(_0x37e8f3){logger['error'](_0x37e8f3);_0x517b3e(_0x37e8f3);})[_0x54dc('0x1b')]();});}function uploadFile(_0x20d7c6){return new BPromise(function(_0x4a4e4b,_0x1f33c3){var _0x23f1c4=urlParse(_0x20d7c6);var _0x3fe204=_0x23f1c4[_0x54dc('0x10')]==='https:'?https:http;var _0x50cca7={'host':_0x23f1c4[_0x54dc('0x1c')],'path':_0x23f1c4[_0x54dc('0x4')],'headers':{'user-agent':_0x54dc('0x1d')}};_0x3fe204['get'](_0x50cca7,function(_0x675e2e){if(_0x675e2e[_0x54dc('0x15')]!==0xc8){_0x1f33c3(new Error(_0x54dc('0x14')+_0x20d7c6+_0x54dc('0x12')+_0x675e2e[_0x54dc('0x15')]+'\x20('+_0x675e2e[_0x54dc('0x13')]+')'));return;}var _0xad5213='';_0x675e2e['on'](_0x54dc('0x1e'),function(_0x5aeab2){_0xad5213+=_0x5aeab2;});_0x675e2e['on'](_0x54dc('0x1b'),function(){_0x4a4e4b(_0xad5213);});})['on'](_0x54dc('0x18'),function(_0x3bbe6e){_0x1f33c3(_0x3bbe6e);})['end']();});}function convertFile(_0x519921,_0x151fe8){return new BPromise(function(_0x35e5fe,_0x1ee23a){var _0x121a85=sox['transcode'](_0x519921,_0x151fe8,{'sampleRate':0x1f40,'format':_0x54dc('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x121a85['on'](_0x54dc('0x18'),function(_0x4ca187){logger[_0x54dc('0x18')](_0x54dc('0x20'),_0x4ca187);_0x1ee23a(_0x4ca187);});_0x121a85['on']('end',function(){logger[_0x54dc('0x21')](_0x54dc('0x22'));_0x35e5fe();});_0x121a85['start']();});}function base64Decode(_0xf6ba01,_0x29c4da){var _0x1a7db3=path['resolve'](__dirname,_0x54dc('0x23'),rs[_0x54dc('0x24')](0x4)+_0x54dc('0x25'));fs[_0x54dc('0x26')](_0x1a7db3,_0xf6ba01,_0x54dc('0x27'));return convertFile(_0x1a7db3,_0x29c4da)[_0x54dc('0x28')](function(){try{fs['unlink'](_0x1a7db3);fs[_0x54dc('0x29')](_0x29c4da,'777');}catch(_0x15f077){logger[_0x54dc('0x18')](_0x15f077);}return _0x29c4da[_0x54dc('0x2a')]('.')[0x0];});}function base64Encode(_0x12af7c){var _0x3f5d67=fs[_0x54dc('0x2b')](_0x12af7c);return new Buffer(_0x3f5d67)[_0x54dc('0x2c')](_0x54dc('0x27'));}exports['googleCloudTTS']=function(_0x303277,_0x514526,_0x24925f,_0x1bbe6e,_0x51f2b8,_0x287054){var _0x2a764a,_0x38b177;var _0x2bda55=_0x54dc('0x2d');var _0x3ee822=_0x54dc('0x2e')+_0x303277;var _0x47989a={};if(_0x514526===_0x54dc('0x2f')){_0x47989a[_0x54dc('0x30')]={'ssml':_0x24925f};}else{_0x47989a[_0x54dc('0x30')]={'text':_0x24925f};};_0x47989a[_0x54dc('0x31')]={'languageCode':_0x1bbe6e,'ssmlGender':_0x51f2b8};_0x47989a[_0x54dc('0x32')]={'audioEncoding':_0x54dc('0x33'),'sampleRateHertz':0x1f40};var _0x20556f={'url':_0x2bda55+'text:synthesize'+_0x3ee822,'method':'POST','json':!![],'body':_0x47989a};return rp(_0x20556f)[_0x54dc('0x28')](function(_0x178eb8){return new BPromise(function(_0xe8c727,_0x30b4df){_0x2a764a=path[_0x54dc('0x34')](__dirname,_0x54dc('0x23'),rs[_0x54dc('0x24')](0x4)+_0x54dc('0x35'));var _0x3e13b0=Buffer[_0x54dc('0x36')](_0x178eb8[_0x54dc('0x37')],_0x54dc('0x27'));return fs[_0x54dc('0x38')](_0x2a764a,_0x3e13b0,function(_0x50f597){_0x30b4df(_0x50f597);},function(_0x418b93){fs[_0x54dc('0x29')](_0x2a764a,_0x54dc('0x39'));_0xe8c727(_0x418b93);});});})[_0x54dc('0x28')](function(_0x36f035){_0x38b177=path[_0x54dc('0x34')](__dirname,'tmp',rs[_0x54dc('0x24')](0x4)+_0x54dc('0x25'));return convertFile(_0x2a764a,_0x38b177);})[_0x54dc('0x28')](function(){try{fs[_0x54dc('0x19')](_0x2a764a);fs['chmodSync'](_0x38b177,_0x54dc('0x39'));}catch(_0x386442){logger[_0x54dc('0x18')](_0x386442);}logger[_0x54dc('0x21')]('googleCloudTTS\x20path',_0x38b177[_0x54dc('0x2a')]('.')[0x0]);return _0x38b177[_0x54dc('0x2a')]('.')[0x0];});};exports[_0x54dc('0x3a')]=function(_0x1323f9,_0x485852){var _0x5065ea='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1983ce,_0x62a734;var _0xc11dc1;var _0x5e5c91={'encoding':_0x54dc('0x3b'),'method':_0x54dc('0x3c'),'timeout':0x2710,'url':_0x5065ea,'headers':{'Content-Type':_0x54dc('0x3d')},'body':_0x54dc('0x3e')+encodeURIComponent(JSON[_0x54dc('0x3f')]([[['jQ1olc',JSON['stringify']([_0x1323f9,_0x485852||'en',![],'null']),null,_0x54dc('0x40')]]]))};return rp(_0x5e5c91)[_0x54dc('0x28')](function(_0x1f2716){try{_0xc11dc1=eval(_0x1f2716[_0x54dc('0x41')](0x5))[0x0][0x2];}catch(_0x2a9435){throw new Error(_0x54dc('0x42')+_0x1f2716['data']);}if(!_0xc11dc1){if(_0x1323f9['length']>0xc8){throw new Error(_0x54dc('0x43'));}else{throw new Error(_0x54dc('0x44')+_0x485852+_0x54dc('0x45'));}}try{_0xc11dc1=eval(_0xc11dc1)[0x0];}catch(_0x1b4409){throw new Error(_0x54dc('0x42')+res[_0x54dc('0x1e')]);}const _0x5a2e11=_0xc11dc1;_0x1983ce=path[_0x54dc('0x34')](__dirname,_0x54dc('0x23'),rs['generate'](0x4)+_0x54dc('0x35'));fs[_0x54dc('0x26')](_0x1983ce,_0xc11dc1,{'encoding':_0x54dc('0x27')});_0x62a734=path[_0x54dc('0x34')](__dirname,_0x54dc('0x23'),rs['generate'](0x4)+_0x54dc('0x25'));return convertFile(_0x1983ce,_0x62a734);})[_0x54dc('0x28')](function(){try{fs[_0x54dc('0x19')](_0x1983ce);fs[_0x54dc('0x29')](_0x62a734,_0x54dc('0x39'));}catch(_0x5a0e84){logger['error'](_0x5a0e84);}logger[_0x54dc('0x21')](_0x54dc('0x46'),_0x62a734['split']('.')[0x0]);return _0x62a734[_0x54dc('0x2a')]('.')[0x0];});};exports[_0x54dc('0x47')]=function(_0x23b850,_0x4198ca,_0x4a34fe){return google[_0x54dc('0x48')](_0x23b850,_0x4198ca,_0x4a34fe)['then'](function(_0x575103){logger[_0x54dc('0x21')](_0x575103['uri']);return rp(_0x575103);})[_0x54dc('0x28')](function(_0x53bf2f){var _0x2b8800='';var _0x3ebc96=0x0;try{fs[_0x54dc('0x19')](_0x23b850);}catch(_0x427937){logger[_0x54dc('0x18')](_0x427937);}if(_0x53bf2f&&_0x53bf2f[_0x54dc('0x49')]){_0x2b8800=_0x53bf2f[_0x54dc('0x49')][_0x54dc('0x4a')](function(_0x263077){return _0x263077&&_0x263077[_0x54dc('0x4b')][0x0]&&_0x263077[_0x54dc('0x4b')][0x0][_0x54dc('0x4c')]?_0x263077[_0x54dc('0x4b')][0x0][_0x54dc('0x4c')]:'';})[_0x54dc('0x4d')]('\x0a');_0x3ebc96=_0x53bf2f['results'][_0x54dc('0x4a')](function(_0x4faf2a){return _0x4faf2a&&_0x4faf2a['alternatives'][0x0]&&_0x4faf2a['alternatives'][0x0][_0x54dc('0x4e')]?_0x4faf2a['alternatives'][0x0][_0x54dc('0x4e')]:0x0;})[_0x54dc('0x4d')]('\x0a');}logger[_0x54dc('0x21')]('googleASR\x20transcription',_0x2b8800);logger[_0x54dc('0x21')](_0x54dc('0x4f'),_0x3ebc96);return{'transcript':_0x2b8800,'confidence':_0x3ebc96};})['catch'](function(_0x2d65c0){logger['error'](_0x54dc('0x50'),_0x2d65c0[_0x54dc('0x15')],_0x2d65c0['name'],_0x2d65c0[_0x54dc('0x51')]);});};exports[_0x54dc('0x52')]=function(_0x1a412d,_0x54ec6e,_0x49f6f5,_0x45c0d8){var _0x2db837=apiai(_0x54ec6e,{'language':_0x45c0d8||'en'});return _0x2db837[_0x54dc('0x53')](_0x49f6f5,{'sessionId':md5(_0x1a412d)})[_0x54dc('0x28')](function(_0x2b0cb9){logger[_0x54dc('0x21')](JSON[_0x54dc('0x3f')](_0x2b0cb9));return{'source':_0x2b0cb9['result'][_0x54dc('0x54')],'resolvedQuery':_0x2b0cb9[_0x54dc('0x55')]['resolvedQuery'],'action':_0x2b0cb9['result']['action'],'actionIncomplete':_0x2b0cb9[_0x54dc('0x55')][_0x54dc('0x56')],'speech':_0x2b0cb9['result'][_0x54dc('0x57')]['speech'],'score':_0x2b0cb9['result'][_0x54dc('0x58')],'statusCode':_0x2b0cb9[_0x54dc('0x59')]['code'],'endConversation':_0x2b0cb9[_0x54dc('0x55')]['metadata'][_0x54dc('0x5a')]||![],'isFallbackIntent':_0x2b0cb9['result'][_0x54dc('0x5b')][_0x54dc('0x5c')]};});};exports[_0x54dc('0x5d')]=function(_0xfe8a91,_0x393832,_0x5cbf80,_0x24a602,_0x2cd37f,_0x2d0c9d){var _0x472731=_0x24a602[_0x54dc('0x5e')](/\\n/g,'\x0a');var _0x20d189={'credentials':{'private_key':_0x472731,'client_email':_0x5cbf80}};var _0x232063=new dialogflow[(_0x54dc('0x5f'))](_0x20d189);var _0x449408=_0x232063['sessionPath'](_0x393832,md5(_0xfe8a91));var _0x3d97b6={'session':_0x449408,'queryInput':{'text':{'text':_0x2cd37f,'languageCode':_0x2d0c9d}}};return _0x232063[_0x54dc('0x60')](_0x3d97b6)[_0x54dc('0x28')](function(_0x503613){if(_0x503613&&_0x503613[_0x54dc('0x61')]){logger[_0x54dc('0x21')](_0x54dc('0x62'),JSON[_0x54dc('0x3f')](_0x503613));var _0x40d988=_0x503613[0x0];if(_0x40d988){var _0x2afcc1={'action':_0x40d988[_0x54dc('0x63')][_0x54dc('0x64')],'allRequiredParamsPresent':_0x40d988['queryResult'][_0x54dc('0x65')],'endConversation':_0x40d988[_0x54dc('0x63')][_0x54dc('0x66')]&&_0x40d988[_0x54dc('0x63')][_0x54dc('0x66')][_0x54dc('0x67')]?_0x40d988[_0x54dc('0x63')][_0x54dc('0x66')][_0x54dc('0x67')][_0x54dc('0x68')][_0x54dc('0x69')]:![],'fulfillmentText':_0x40d988[_0x54dc('0x63')][_0x54dc('0x6a')],'intentName':_0x40d988[_0x54dc('0x63')]['intent'][_0x54dc('0x6b')],'intentDisplayName':_0x40d988[_0x54dc('0x63')][_0x54dc('0x6c')][_0x54dc('0x6d')],'isFallbackIntent':_0x40d988[_0x54dc('0x63')]['intent'][_0x54dc('0x6e')],'languageCode':_0x40d988[_0x54dc('0x63')][_0x54dc('0x6f')],'queryText':_0x40d988[_0x54dc('0x63')]['queryText'],'responseId':_0x40d988[_0x54dc('0x70')],'score':_0x40d988['queryResult'][_0x54dc('0x71')],'speech':_0x40d988[_0x54dc('0x63')][_0x54dc('0x6a')],'providerResponse':JSON[_0x54dc('0x3f')](_0x503613)};return _0x2afcc1;}}});};exports[_0x54dc('0x72')]=function(_0x2ed0e9,_0x47cd55,_0x54c238,_0xcac2d2){return tilde[_0x54dc('0x48')](_0x2ed0e9,_0x47cd55,_0x54c238,_0xcac2d2)['then'](function(_0x183cc6){try{fs[_0x54dc('0x19')](_0x2ed0e9);}catch(_0x2fa82e){logger[_0x54dc('0x18')](_0x2fa82e);}logger[_0x54dc('0x21')](_0x54dc('0x73'),_0x183cc6[_0x54dc('0x4c')]);logger['info'](_0x54dc('0x74'),_0x183cc6['confidence']);return _0x183cc6;});};exports['awsPolly']=function(_0x2dde5e,_0x5460a9,_0x4f181d,_0x3bf524,_0x21adaa,_0x8bab0c){var _0x4adb1b=path[_0x54dc('0x34')](__dirname,_0x54dc('0x23'),rs[_0x54dc('0x24')](0x4)+_0x54dc('0x35'));var _0x5e6915;return aws['polly'](_0x2dde5e,_0x5460a9,_0x4f181d,_0x3bf524,_0x21adaa,_0x8bab0c,_0x4adb1b)[_0x54dc('0x28')](function(){_0x5e6915=path['resolve'](__dirname,_0x54dc('0x23'),rs['generate'](0x4)+_0x54dc('0x25'));return convertFile(_0x4adb1b,_0x5e6915);})[_0x54dc('0x28')](function(){try{fs[_0x54dc('0x19')](_0x4adb1b);fs[_0x54dc('0x29')](_0x5e6915,'777');}catch(_0x3a36a9){logger[_0x54dc('0x18')](_0x3a36a9);}return _0x5e6915['split']('.')[0x0];});};exports['awsLex']=function(_0x421315,_0xcc088e,_0x2cfd72,_0x582fe4,_0x1a0506,_0x2d9cea){return aws[_0x54dc('0x75')](_0x421315,_0xcc088e,_0x2cfd72,_0x582fe4,_0x1a0506,_0x2d9cea)[_0x54dc('0x28')](function(_0x487c64){logger[_0x54dc('0x21')](JSON['stringify'](_0x487c64));return _0x487c64;});};exports[_0x54dc('0x76')]=function(_0x5a15a6,_0x252aeb,_0x5eb17c,_0x453062){var _0x1ed3c4=util[_0x54dc('0x77')](_0x54dc('0x78'),ISPEECH_API,_0x5a15a6,encodeURIComponent(_0x252aeb),_0x5eb17c,_0x453062);var _0x10597d=path[_0x54dc('0x34')](__dirname,'tmp',rs[_0x54dc('0x24')](0x4)+_0x54dc('0x35'));var _0x35c999;return downloadFile(_0x1ed3c4,_0x10597d)['then'](function(){_0x35c999=path[_0x54dc('0x34')](__dirname,_0x54dc('0x23'),rs[_0x54dc('0x24')](0x4)+_0x54dc('0x25'));return convertFile(_0x10597d,_0x35c999);})[_0x54dc('0x28')](function(){try{fs[_0x54dc('0x19')](_0x10597d);fs['chmodSync'](_0x35c999,_0x54dc('0x39'));}catch(_0x5e6f2d){logger['error'](_0x5e6f2d);}return _0x35c999[_0x54dc('0x2a')]('.')[0x0];});};exports[_0x54dc('0x79')]=function(_0x3d91e7,_0x35ae21,_0x14a53b,_0xbd7bf0){var _0x1cbb73=util['format'](_0x54dc('0x7a'),ISPEECH_API,_0x35ae21,_0x14a53b,base64Encode(_0x3d91e7),_0xbd7bf0?util[_0x54dc('0x77')](_0x54dc('0x7b'),encodeURIComponent(_0xbd7bf0)):'freeform=3');return uploadFile(_0x1cbb73)[_0x54dc('0x28')](function(_0x10740a){return querystring[_0x54dc('0x9')](_0x10740a);});};exports[_0x54dc('0x7c')]=function(_0x3f0655,_0x22a0b3){return sestek[_0x54dc('0x7d')](_0x3f0655,_0x22a0b3)[_0x54dc('0x28')](function(_0x3b69b9){logger['info'](JSON['stringify'](_0x3b69b9));var _0x4f821a={'speech':_0x3b69b9[_0x54dc('0x7e')],'action':_0x3b69b9[_0x54dc('0x7f')]?_0x3b69b9['channelData'][_0x54dc('0x80')]:undefined,'actiondata':_0x3b69b9[_0x54dc('0x7f')]?_0x3b69b9[_0x54dc('0x7f')][_0x54dc('0x81')]:undefined};if(_0x3b69b9[_0x54dc('0x7f')]&&_0x3b69b9[_0x54dc('0x7f')]['AudioFromTts']){return base64Decode(_0x3b69b9['channelData']['AudioFromTts'][_0x54dc('0x82')],path[_0x54dc('0x34')](__dirname,_0x54dc('0x23'),rs[_0x54dc('0x24')](0x4)+_0x54dc('0x25')))['then'](function(_0x214221){_0x4f821a[_0x54dc('0x83')]=_0x214221;return _0x4f821a;});}return _0x4f821a;});};exports[_0x54dc('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x9b11=['map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','https:','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','finish\x20download\x20file','close','download\x20error','pipe','protocol','host','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','then','unlink','chmodSync','777','readFileSync','toString','googleCloudTTS','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','.mp3','audioContent','base64','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','POST','application/x-www-form-urlencoded','stringify','null','generic','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','asr','results'];(function(_0x50e545,_0x342948){var _0x181af8=function(_0x369add){while(--_0x369add){_0x50e545['push'](_0x50e545['shift']());}};_0x181af8(++_0x342948);}(_0x9b11,0xc7));var _0x19b1=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x9b11[_0x2e0443];return _0x52d450;};'use strict';var apiai=require(_0x19b1('0x0'));var BPromise=require(_0x19b1('0x1'));var dialogflow=require(_0x19b1('0x2'));var fs=require('fs');var http=require(_0x19b1('0x3'));var https=require(_0x19b1('0x4'));var md5=require(_0x19b1('0x5'));var path=require(_0x19b1('0x6'));var querystring=require(_0x19b1('0x7'));var rp=require(_0x19b1('0x8'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x19b1('0x9'));var urlParse=require(_0x19b1('0xa'))[_0x19b1('0xb')];var util=require(_0x19b1('0xc'));var aws=require(_0x19b1('0xd'));var google=require(_0x19b1('0xe'));var sestek=require(_0x19b1('0xf'));var tilde=require('./tilde');var logger=require(_0x19b1('0x10'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x405bd0,_0x3acdc7){return new BPromise(function(_0xf5d3fc,_0x553b27){var _0xd2f699=urlParse(_0x405bd0);var _0x296425=_0xd2f699['protocol']===_0x19b1('0x11')?https:http;var _0x4f1cd9={'host':_0xd2f699['host'],'path':_0xd2f699['path'],'headers':{'user-agent':_0x19b1('0x12')}};_0x296425[_0x19b1('0x13')](_0x4f1cd9,function(_0x543629){if(_0x543629['statusCode']!==0xc8){logger[_0x19b1('0x14')](_0x19b1('0x15')+_0x405bd0+_0x19b1('0x16')+_0x543629[_0x19b1('0x17')]+'\x20('+_0x543629[_0x19b1('0x18')]+')');_0x553b27(new Error(_0x19b1('0x15')+_0x405bd0+_0x19b1('0x16')+_0x543629['statusCode']+'\x20('+_0x543629[_0x19b1('0x18')]+')'));return;}var _0x21889e=fs['createWriteStream'](_0x3acdc7);_0x21889e['on'](_0x19b1('0x19'),function(){logger['info'](_0x19b1('0x1a'));_0x21889e[_0x19b1('0x1b')](_0xf5d3fc);});_0x21889e['on'](_0x19b1('0x14'),function(_0x566b02){fs['unlink'](_0x3acdc7);logger[_0x19b1('0x14')](_0x19b1('0x1c'),_0x566b02);_0x553b27(_0x566b02);});_0x543629[_0x19b1('0x1d')](_0x21889e);})['on'](_0x19b1('0x14'),function(_0x5d9a27){logger[_0x19b1('0x14')](_0x5d9a27);_0x553b27(_0x5d9a27);})['end']();});}function uploadFile(_0x4a1609){return new BPromise(function(_0x20acb6,_0x2109f2){var _0x127143=urlParse(_0x4a1609);var _0x17489b=_0x127143[_0x19b1('0x1e')]===_0x19b1('0x11')?https:http;var _0x3569d5={'host':_0x127143[_0x19b1('0x1f')],'path':_0x127143[_0x19b1('0x6')],'headers':{'user-agent':_0x19b1('0x12')}};_0x17489b['get'](_0x3569d5,function(_0x471978){if(_0x471978[_0x19b1('0x17')]!==0xc8){_0x2109f2(new Error(_0x19b1('0x15')+_0x4a1609+'\x20failed,\x20status\x20code\x20=\x20'+_0x471978['statusCode']+'\x20('+_0x471978[_0x19b1('0x18')]+')'));return;}var _0x1e844a='';_0x471978['on']('data',function(_0x534b78){_0x1e844a+=_0x534b78;});_0x471978['on'](_0x19b1('0x20'),function(){_0x20acb6(_0x1e844a);});})['on'](_0x19b1('0x14'),function(_0x5653dd){_0x2109f2(_0x5653dd);})[_0x19b1('0x20')]();});}function convertFile(_0x1464b0,_0x57ae78){return new BPromise(function(_0x685362,_0x107f55){var _0x273af=sox[_0x19b1('0x21')](_0x1464b0,_0x57ae78,{'sampleRate':0x1f40,'format':_0x19b1('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x273af['on'](_0x19b1('0x14'),function(_0x4cf9c5){logger[_0x19b1('0x14')](_0x19b1('0x23'),_0x4cf9c5);_0x107f55(_0x4cf9c5);});_0x273af['on'](_0x19b1('0x20'),function(){logger[_0x19b1('0x24')](_0x19b1('0x25'));_0x685362();});_0x273af['start']();});}function base64Decode(_0x176dc0,_0x5c7b9a){var _0xfd32c=path['resolve'](__dirname,_0x19b1('0x26'),rs[_0x19b1('0x27')](0x4)+_0x19b1('0x28'));fs[_0x19b1('0x29')](_0xfd32c,_0x176dc0,'base64');return convertFile(_0xfd32c,_0x5c7b9a)[_0x19b1('0x2a')](function(){try{fs[_0x19b1('0x2b')](_0xfd32c);fs[_0x19b1('0x2c')](_0x5c7b9a,_0x19b1('0x2d'));}catch(_0x2fc596){logger[_0x19b1('0x14')](_0x2fc596);}return _0x5c7b9a['split']('.')[0x0];});}function base64Encode(_0x294a23){var _0x29e8d5=fs[_0x19b1('0x2e')](_0x294a23);return new Buffer(_0x29e8d5)[_0x19b1('0x2f')]('base64');}exports[_0x19b1('0x30')]=function(_0x588e38,_0x262320,_0x5ac093,_0x4aa200,_0x199170,_0x5226f4){var _0x3c2004,_0x6c9290;var _0x47be93='https://texttospeech.googleapis.com/v1/';var _0x48be56='?key='+_0x588e38;var _0x337d1a={};if(_0x262320===_0x19b1('0x31')){_0x337d1a[_0x19b1('0x32')]={'ssml':_0x5ac093};}else{_0x337d1a[_0x19b1('0x32')]={'text':_0x5ac093};};_0x337d1a[_0x19b1('0x33')]={'languageCode':_0x4aa200,'ssmlGender':_0x199170};_0x337d1a[_0x19b1('0x34')]={'audioEncoding':_0x19b1('0x35'),'sampleRateHertz':0x1f40};var _0xebd2db={'url':_0x47be93+_0x19b1('0x36')+_0x48be56,'method':'POST','json':!![],'body':_0x337d1a};return rp(_0xebd2db)[_0x19b1('0x2a')](function(_0x299874){return new BPromise(function(_0x7818e3,_0x3f8eab){_0x3c2004=path[_0x19b1('0x37')](__dirname,_0x19b1('0x26'),rs[_0x19b1('0x27')](0x4)+_0x19b1('0x38'));var _0x91efcc=Buffer['from'](_0x299874[_0x19b1('0x39')],_0x19b1('0x3a'));return fs[_0x19b1('0x3b')](_0x3c2004,_0x91efcc,function(_0x11fa8a){_0x3f8eab(_0x11fa8a);},function(_0x349c49){fs[_0x19b1('0x2c')](_0x3c2004,'777');_0x7818e3(_0x349c49);});});})[_0x19b1('0x2a')](function(_0x179e1f){_0x6c9290=path[_0x19b1('0x37')](__dirname,_0x19b1('0x26'),rs[_0x19b1('0x27')](0x4)+_0x19b1('0x28'));return convertFile(_0x3c2004,_0x6c9290);})[_0x19b1('0x2a')](function(){try{fs[_0x19b1('0x2b')](_0x3c2004);fs[_0x19b1('0x2c')](_0x6c9290,_0x19b1('0x2d'));}catch(_0x11c1e7){logger[_0x19b1('0x14')](_0x11c1e7);}logger[_0x19b1('0x24')](_0x19b1('0x3c'),_0x6c9290['split']('.')[0x0]);return _0x6c9290[_0x19b1('0x3d')]('.')[0x0];});};exports[_0x19b1('0x3e')]=function(_0x46ac7d,_0xebecd9){var _0x264f8b=_0x19b1('0x3f');var _0x3d4743,_0x4e693b;var _0x47a02e;var _0x1af788={'encoding':'utf8','method':_0x19b1('0x40'),'timeout':0x2710,'url':_0x264f8b,'headers':{'Content-Type':_0x19b1('0x41')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x19b1('0x42')]([_0x46ac7d,_0xebecd9||'en',![],_0x19b1('0x43')]),null,_0x19b1('0x44')]]]))};return rp(_0x1af788)[_0x19b1('0x2a')](function(_0x4a32a4){try{_0x47a02e=eval(_0x4a32a4['slice'](0x5))[0x0][0x2];}catch(_0x1e5e11){throw new Error(_0x19b1('0x45')+_0x4a32a4[_0x19b1('0x46')]);}if(!_0x47a02e){if(_0x46ac7d[_0x19b1('0x47')]>0xc8){throw new Error(_0x19b1('0x48'));}else{throw new Error(_0x19b1('0x49')+_0xebecd9+'\x22\x20might\x20not\x20exist');}}try{_0x47a02e=eval(_0x47a02e)[0x0];}catch(_0x11032b){throw new Error(_0x19b1('0x45')+res[_0x19b1('0x46')]);}const _0x3aea6c=_0x47a02e;_0x3d4743=path[_0x19b1('0x37')](__dirname,_0x19b1('0x26'),rs[_0x19b1('0x27')](0x4)+_0x19b1('0x38'));fs[_0x19b1('0x29')](_0x3d4743,_0x47a02e,{'encoding':'base64'});_0x4e693b=path[_0x19b1('0x37')](__dirname,_0x19b1('0x26'),rs[_0x19b1('0x27')](0x4)+_0x19b1('0x28'));return convertFile(_0x3d4743,_0x4e693b);})[_0x19b1('0x2a')](function(){try{fs[_0x19b1('0x2b')](_0x3d4743);fs[_0x19b1('0x2c')](_0x4e693b,_0x19b1('0x2d'));}catch(_0x543de0){logger['error'](_0x543de0);}logger[_0x19b1('0x24')](_0x19b1('0x4a'),_0x4e693b[_0x19b1('0x3d')]('.')[0x0]);return _0x4e693b['split']('.')[0x0];});};exports['googleASR']=function(_0xea8b7,_0x56b6b6,_0x5864cd){return google[_0x19b1('0x4b')](_0xea8b7,_0x56b6b6,_0x5864cd)['then'](function(_0x4dcf66){logger[_0x19b1('0x24')](_0x4dcf66['uri']);return rp(_0x4dcf66);})['then'](function(_0xbb5661){var _0x564672='';var _0x201c0a=0x0;try{fs[_0x19b1('0x2b')](_0xea8b7);}catch(_0x42e0a7){logger['error'](_0x42e0a7);}if(_0xbb5661&&_0xbb5661[_0x19b1('0x4c')]){_0x564672=_0xbb5661['results'][_0x19b1('0x4d')](function(_0x3580c6){return _0x3580c6&&_0x3580c6[_0x19b1('0x4e')][0x0]&&_0x3580c6['alternatives'][0x0][_0x19b1('0x4f')]?_0x3580c6[_0x19b1('0x4e')][0x0][_0x19b1('0x4f')]:'';})[_0x19b1('0x50')]('\x0a');_0x201c0a=_0xbb5661[_0x19b1('0x4c')]['map'](function(_0x4eb675){return _0x4eb675&&_0x4eb675[_0x19b1('0x4e')][0x0]&&_0x4eb675['alternatives'][0x0][_0x19b1('0x51')]?_0x4eb675[_0x19b1('0x4e')][0x0]['confidence']:0x0;})[_0x19b1('0x50')]('\x0a');}logger['info'](_0x19b1('0x52'),_0x564672);logger[_0x19b1('0x24')]('googleASR\x20confidence',_0x201c0a);return{'transcript':_0x564672,'confidence':_0x201c0a};})['catch'](function(_0x38054a){logger[_0x19b1('0x14')](_0x19b1('0x53'),_0x38054a[_0x19b1('0x17')],_0x38054a[_0x19b1('0x54')],_0x38054a[_0x19b1('0x55')]);});};exports[_0x19b1('0x56')]=function(_0x281e90,_0x1f5c14,_0x4943b2,_0x15b37e){var _0x4359cc=apiai(_0x1f5c14,{'language':_0x15b37e||'en'});return _0x4359cc[_0x19b1('0x57')](_0x4943b2,{'sessionId':md5(_0x281e90)})[_0x19b1('0x2a')](function(_0x15dae){logger['info'](JSON[_0x19b1('0x42')](_0x15dae));return{'source':_0x15dae[_0x19b1('0x58')][_0x19b1('0x59')],'resolvedQuery':_0x15dae[_0x19b1('0x58')][_0x19b1('0x5a')],'action':_0x15dae[_0x19b1('0x58')]['action'],'actionIncomplete':_0x15dae[_0x19b1('0x58')][_0x19b1('0x5b')],'speech':_0x15dae[_0x19b1('0x58')][_0x19b1('0x5c')][_0x19b1('0x5d')],'score':_0x15dae[_0x19b1('0x58')][_0x19b1('0x5e')],'statusCode':_0x15dae[_0x19b1('0x5f')][_0x19b1('0x60')],'endConversation':_0x15dae['result'][_0x19b1('0x61')][_0x19b1('0x62')]||![],'isFallbackIntent':_0x15dae['result']['metadata'][_0x19b1('0x63')]};});};exports[_0x19b1('0x64')]=function(_0x227511,_0x17c533,_0x5878ee,_0x4d823e,_0x34e755,_0x66f447){var _0x40d85b=_0x4d823e[_0x19b1('0x65')](/\\n/g,'\x0a');var _0x9b7986={'credentials':{'private_key':_0x40d85b,'client_email':_0x5878ee}};var _0x22c6e0=new dialogflow[(_0x19b1('0x66'))](_0x9b7986);var _0x1ad6f6=_0x22c6e0[_0x19b1('0x67')](_0x17c533,md5(_0x227511));var _0x4e90c4={'session':_0x1ad6f6,'queryInput':{'text':{'text':_0x34e755,'languageCode':_0x66f447}}};return _0x22c6e0[_0x19b1('0x68')](_0x4e90c4)[_0x19b1('0x2a')](function(_0x441e34){if(_0x441e34&&_0x441e34['length']){logger[_0x19b1('0x24')](_0x19b1('0x69'),JSON[_0x19b1('0x42')](_0x441e34));var _0x24db65=_0x441e34[0x0];if(_0x24db65){var _0x464e38={'action':_0x24db65[_0x19b1('0x6a')][_0x19b1('0x6b')],'allRequiredParamsPresent':_0x24db65[_0x19b1('0x6a')][_0x19b1('0x6c')],'endConversation':_0x24db65[_0x19b1('0x6a')][_0x19b1('0x6d')]&&_0x24db65['queryResult']['diagnosticInfo']['fields']?_0x24db65[_0x19b1('0x6a')][_0x19b1('0x6d')][_0x19b1('0x6e')][_0x19b1('0x6f')][_0x19b1('0x70')]:![],'fulfillmentText':_0x24db65[_0x19b1('0x6a')]['fulfillmentText'],'intentName':_0x24db65[_0x19b1('0x6a')][_0x19b1('0x71')]['name'],'intentDisplayName':_0x24db65['queryResult'][_0x19b1('0x71')][_0x19b1('0x72')],'isFallbackIntent':_0x24db65['queryResult'][_0x19b1('0x71')][_0x19b1('0x73')],'languageCode':_0x24db65['queryResult'][_0x19b1('0x74')],'queryText':_0x24db65[_0x19b1('0x6a')][_0x19b1('0x75')],'responseId':_0x24db65[_0x19b1('0x76')],'score':_0x24db65[_0x19b1('0x6a')][_0x19b1('0x77')],'speech':_0x24db65[_0x19b1('0x6a')]['fulfillmentText'],'providerResponse':JSON[_0x19b1('0x42')](_0x441e34)};return _0x464e38;}}});};exports[_0x19b1('0x78')]=function(_0x43c870,_0xb3df7c,_0x496eb6,_0x30832b){return tilde['asr'](_0x43c870,_0xb3df7c,_0x496eb6,_0x30832b)[_0x19b1('0x2a')](function(_0x74d59a){try{fs[_0x19b1('0x2b')](_0x43c870);}catch(_0x3385c5){logger[_0x19b1('0x14')](_0x3385c5);}logger[_0x19b1('0x24')](_0x19b1('0x79'),_0x74d59a[_0x19b1('0x4f')]);logger[_0x19b1('0x24')]('Tilde\x20ASR\x20confidence',_0x74d59a['confidence']);return _0x74d59a;});};exports[_0x19b1('0x7a')]=function(_0x1157cd,_0x5f1a5f,_0x1b2e77,_0x322c2f,_0xbf03e,_0x1c2ebb){var _0x581d76=path[_0x19b1('0x37')](__dirname,'tmp',rs[_0x19b1('0x27')](0x4)+'.mp3');var _0x59a626;return aws['polly'](_0x1157cd,_0x5f1a5f,_0x1b2e77,_0x322c2f,_0xbf03e,_0x1c2ebb,_0x581d76)[_0x19b1('0x2a')](function(){_0x59a626=path[_0x19b1('0x37')](__dirname,_0x19b1('0x26'),rs[_0x19b1('0x27')](0x4)+_0x19b1('0x28'));return convertFile(_0x581d76,_0x59a626);})[_0x19b1('0x2a')](function(){try{fs[_0x19b1('0x2b')](_0x581d76);fs['chmodSync'](_0x59a626,_0x19b1('0x2d'));}catch(_0x49d3fe){logger[_0x19b1('0x14')](_0x49d3fe);}return _0x59a626[_0x19b1('0x3d')]('.')[0x0];});};exports[_0x19b1('0x7b')]=function(_0x38f6ea,_0x22a67a,_0x43713f,_0xf75dee,_0x45fe28,_0x579ded){return aws[_0x19b1('0x7c')](_0x38f6ea,_0x22a67a,_0x43713f,_0xf75dee,_0x45fe28,_0x579ded)[_0x19b1('0x2a')](function(_0x415246){logger[_0x19b1('0x24')](JSON[_0x19b1('0x42')](_0x415246));return _0x415246;});};exports['ispeechTTS']=function(_0x5e6790,_0x1d0a13,_0x3b5940,_0x1fea3d){var _0x4c1908=util[_0x19b1('0x7d')](_0x19b1('0x7e'),ISPEECH_API,_0x5e6790,encodeURIComponent(_0x1d0a13),_0x3b5940,_0x1fea3d);var _0x5ebf94=path['resolve'](__dirname,'tmp',rs[_0x19b1('0x27')](0x4)+'.mp3');var _0x3eb57f;return downloadFile(_0x4c1908,_0x5ebf94)['then'](function(){_0x3eb57f=path[_0x19b1('0x37')](__dirname,'tmp',rs['generate'](0x4)+_0x19b1('0x28'));return convertFile(_0x5ebf94,_0x3eb57f);})['then'](function(){try{fs[_0x19b1('0x2b')](_0x5ebf94);fs[_0x19b1('0x2c')](_0x3eb57f,'777');}catch(_0x16a41b){logger[_0x19b1('0x14')](_0x16a41b);}return _0x3eb57f[_0x19b1('0x3d')]('.')[0x0];});};exports['ispeechASR']=function(_0x4b0110,_0x46742f,_0x3fa3c,_0x7b178e){var _0xae1ea=util[_0x19b1('0x7d')](_0x19b1('0x7f'),ISPEECH_API,_0x46742f,_0x3fa3c,base64Encode(_0x4b0110),_0x7b178e?util[_0x19b1('0x7d')]('model=%s',encodeURIComponent(_0x7b178e)):_0x19b1('0x80'));return uploadFile(_0xae1ea)[_0x19b1('0x2a')](function(_0xa5fcbf){return querystring[_0x19b1('0xb')](_0xa5fcbf);});};exports[_0x19b1('0x81')]=function(_0x11b7d2,_0x3c7e7f){return sestek[_0x19b1('0x82')](_0x11b7d2,_0x3c7e7f)[_0x19b1('0x2a')](function(_0x5710a0){logger[_0x19b1('0x24')](JSON['stringify'](_0x5710a0));var _0x2d20af={'speech':_0x5710a0[_0x19b1('0x83')],'action':_0x5710a0[_0x19b1('0x84')]?_0x5710a0['channelData'][_0x19b1('0x85')]:undefined,'actiondata':_0x5710a0[_0x19b1('0x84')]?_0x5710a0[_0x19b1('0x84')][_0x19b1('0x86')]:undefined};if(_0x5710a0['channelData']&&_0x5710a0[_0x19b1('0x84')]['AudioFromTts']){return base64Decode(_0x5710a0[_0x19b1('0x84')][_0x19b1('0x87')][_0x19b1('0x88')],path['resolve'](__dirname,_0x19b1('0x26'),rs[_0x19b1('0x27')](0x4)+'.wav'))[_0x19b1('0x2a')](function(_0x3e4610){_0x2d20af[_0x19b1('0x89')]=_0x3e4610;return _0x2d20af;});}return _0x2d20af;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 449375f..9d9d2e3 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7818=['exports'];(function(_0x1210bf,_0x2f37fc){var _0x46a5b1=function(_0x320dc0){while(--_0x320dc0){_0x1210bf['push'](_0x1210bf['shift']());}};_0x46a5b1(++_0x2f37fc);}(_0x7818,0x134));var _0x8781=function(_0x11e35d,_0x55ad07){_0x11e35d=_0x11e35d-0x0;var _0x308818=_0x7818[_0x11e35d];return _0x308818;};var nda=require('./nda');module[_0x8781('0x0')]={'nda':nda}; \ No newline at end of file +var _0x2947=['exports','./nda'];(function(_0x7e27ff,_0x4f61ed){var _0x58962d=function(_0x3f8a4b){while(--_0x3f8a4b){_0x7e27ff['push'](_0x7e27ff['shift']());}};_0x58962d(++_0x4f61ed);}(_0x2947,0xb7));var _0x7294=function(_0x10eb14,_0x356c68){_0x10eb14=_0x10eb14-0x0;var _0x4aa626=_0x2947[_0x10eb14];return _0x4aa626;};var nda=require(_0x7294('0x0'));module[_0x7294('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 0784176..67fce46 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa739=['message','uniqueid','callerid','dnid','extension','text','access_token','project','body','ProjectName','channelData','audio/wav','CustomAction','custom_action_data','CustomActionData','info','stringify','url','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x449e26,_0xbc14b6){var _0x6b3fc8=function(_0x81abc5){while(--_0x81abc5){_0x449e26['push'](_0x449e26['shift']());}};_0x6b3fc8(++_0xbc14b6);}(_0xa739,0x1e1));var _0x9a73=function(_0x409dc,_0x23cc23){_0x409dc=_0x409dc-0x0;var _0xb69f24=_0xa739[_0x409dc];return _0xb69f24;};'use strict';var rp=require('request-promise');var url=require(_0x9a73('0x0'));var logger=require('../../../../../config/logger')(_0x9a73('0x1'));module[_0x9a73('0x2')]=function(_0x524293,_0x149e72){var _0x352cec={'method':_0x9a73('0x3'),'uri':url['resolve'](_0x149e72[_0x9a73('0x4')],_0x9a73('0x5')),'form':{'grant_type':_0x9a73('0x6'),'username':_0x149e72[_0x9a73('0x7')],'password':_0x149e72[_0x9a73('0x6')]},'json':!![]};return rp(_0x352cec)[_0x9a73('0x8')](function(_0x3a6506){var _0x125177={'method':'POST','uri':url[_0x9a73('0x9')](_0x149e72['ndassistant_url'],_0x9a73('0xa')),'body':{'type':_0x149e72[_0x9a73('0xb')]||_0x9a73('0xc'),'channelId':'Nda','conversation':{'id':_0x524293[_0x9a73('0xd')]},'from':{'id':_0x524293[_0x9a73('0xe')],'name':_0x524293['calleridname']},'recipient':{'id':_0x524293[_0x9a73('0xf')],'name':_0x524293[_0x9a73('0x10')]},'text':_0x149e72[_0x9a73('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3a6506[_0x9a73('0x12')]},'json':!![]};if(_0x149e72[_0x9a73('0x13')]){_0x125177[_0x9a73('0x14')]['channelData'][_0x9a73('0x15')]=_0x149e72[_0x9a73('0x13')];}if(_0x149e72['ndagenerate_audio']=='1'){_0x125177[_0x9a73('0x14')][_0x9a73('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9a73('0x17')};}if(_0x149e72['custom_action']){_0x125177[_0x9a73('0x14')]['channelData'][_0x9a73('0x18')]=_0x149e72['custom_action'];if(_0x149e72[_0x9a73('0x19')]){_0x125177[_0x9a73('0x14')][_0x9a73('0x16')][_0x9a73('0x1a')]=_0x149e72[_0x9a73('0x19')];}}logger[_0x9a73('0x1b')](JSON[_0x9a73('0x1c')](_0x125177));return rp(_0x125177);});}; \ No newline at end of file +var _0x2c54=['Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','custom_action','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text'];(function(_0x35b730,_0x30070e){var _0x80ff20=function(_0x2ae86c){while(--_0x2ae86c){_0x35b730['push'](_0x35b730['shift']());}};_0x80ff20(++_0x30070e);}(_0x2c54,0x136));var _0x42c5=function(_0x2e4839,_0x378900){_0x2e4839=_0x2e4839-0x0;var _0x4ffce9=_0x2c54[_0x2e4839];return _0x4ffce9;};'use strict';var rp=require(_0x42c5('0x0'));var url=require(_0x42c5('0x1'));var logger=require(_0x42c5('0x2'))('agi');module[_0x42c5('0x3')]=function(_0x46bcc4,_0x3d5e1d){var _0x253cc1={'method':_0x42c5('0x4'),'uri':url[_0x42c5('0x5')](_0x3d5e1d['ndauth_url'],_0x42c5('0x6')),'form':{'grant_type':'password','username':_0x3d5e1d['username'],'password':_0x3d5e1d[_0x42c5('0x7')]},'json':!![]};return rp(_0x253cc1)[_0x42c5('0x8')](function(_0x38d528){var _0x134cb6={'method':_0x42c5('0x4'),'uri':url[_0x42c5('0x5')](_0x3d5e1d[_0x42c5('0x9')],_0x42c5('0xa')),'body':{'type':_0x3d5e1d[_0x42c5('0xb')]||_0x42c5('0xc'),'channelId':_0x42c5('0xd'),'conversation':{'id':_0x46bcc4[_0x42c5('0xe')]},'from':{'id':_0x46bcc4[_0x42c5('0xf')],'name':_0x46bcc4[_0x42c5('0x10')]},'recipient':{'id':_0x46bcc4[_0x42c5('0x11')],'name':_0x46bcc4[_0x42c5('0x12')]},'text':_0x3d5e1d[_0x42c5('0x13')],'channelData':{}},'headers':{'Authorization':_0x42c5('0x14')+_0x38d528[_0x42c5('0x15')]},'json':!![]};if(_0x3d5e1d[_0x42c5('0x16')]){_0x134cb6[_0x42c5('0x17')][_0x42c5('0x18')]['ProjectName']=_0x3d5e1d['project'];}if(_0x3d5e1d[_0x42c5('0x19')]=='1'){_0x134cb6[_0x42c5('0x17')][_0x42c5('0x18')][_0x42c5('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3d5e1d[_0x42c5('0x1b')]){_0x134cb6[_0x42c5('0x17')][_0x42c5('0x18')]['CustomAction']=_0x3d5e1d[_0x42c5('0x1b')];if(_0x3d5e1d['custom_action_data']){_0x134cb6['body'][_0x42c5('0x18')]['CustomActionData']=_0x3d5e1d['custom_action_data'];}}logger[_0x42c5('0x1c')](JSON[_0x42c5('0x1d')](_0x134cb6));return rp(_0x134cb6);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 135d675..8036f52 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x908a=['exports'];(function(_0x44c44b,_0x57e40d){var _0xb29ca8=function(_0x1fea49){while(--_0x1fea49){_0x44c44b['push'](_0x44c44b['shift']());}};_0xb29ca8(++_0x57e40d);}(_0x908a,0x8f));var _0xa908=function(_0x142a50,_0x1b32a8){_0x142a50=_0x142a50-0x0;var _0x5f26c9=_0x908a[_0x142a50];return _0x5f26c9;};'use strict';var asr=require('./lib/api');module[_0xa908('0x0')]=function(_0x5c5403,_0x1afda7,_0x31c58a,_0x5195f4){return asr(_0x5c5403,_0x1afda7,_0x31c58a,_0x5195f4);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x4c6e5c,_0x1d6b45,_0x370086,_0x506061){return asr(_0x4c6e5c,_0x1d6b45,_0x370086,_0x506061);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 5a532ef..f9bd546 100644 --- a/server/services/agi/scripts/tilde/asr/lib/api.js +++ b/server/services/agi/scripts/tilde/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87d6=['final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','error','stringify','terminate','result'];(function(_0x403044,_0x117002){var _0xdf3618=function(_0x46ac61){while(--_0x46ac61){_0x403044['push'](_0x403044['shift']());}};_0xdf3618(++_0x117002);}(_0x87d6,0x1f1));var _0x687d=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x87d6[_0x3a73bc];return _0x32891b;};'use strict';var BPromise=require(_0x687d('0x0'));var _=require(_0x687d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x687d('0x2'));var logger=require(_0x687d('0x3'))(_0x687d('0x4'));module[_0x687d('0x5')]=function(_0x3bc222,_0x4e39d0,_0x2279d3,_0x2cdf80){return new BPromise(function(_0x3ea336,_0x488628){logger[_0x687d('0x6')]('Tilde\x20URI',_0x2cdf80||_0x687d('0x7'));var _0x7143c=new WebSocket(_0x2cdf80||_0x687d('0x7'),{'perMessageDeflate':![]});var _0x324254='';var _0xca6bb='0';var _0x3be108='1';var _0x974406='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5a98ee(_0x596966){var _0xaf9f1f=crypto['createHash'](_0x687d('0x8'));_0xaf9f1f[_0x687d('0x9')](_0x596966);return _0xaf9f1f['digest'](_0x687d('0xa'));}function _0x383019(){try{logger[_0x687d('0x6')](_0x687d('0xb'));var _0xa2b5e3=moment()[_0x687d('0xc')]();var _0x890eb=_0x5a98ee(_0xa2b5e3+_0x4e39d0+_0x2279d3);_0x7143c[_0x687d('0xd')](JSON['stringify']({'appID':_0x4e39d0,'timestamp':_0xa2b5e3,'appKey':_0x890eb}));var _0x138bb9=fs[_0x687d('0xe')](_0x3bc222);_0x138bb9['on'](_0x687d('0xf'),function(_0x350f46){_0x7143c[_0x687d('0xd')](_0x350f46);});_0x138bb9['on'](_0x687d('0x10'),function(){_0x7143c[_0x687d('0xd')]('EOS');});}catch(_0x2c4504){logger[_0x687d('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0x687d('0x12')](_0x2c4504));_0x7143c[_0x687d('0x13')]();}}function _0x5861ff(_0x5c7158){try{if(_0x5c7158){var _0x32c73c=JSON['parse'](_0x5c7158);switch(_0x32c73c['status']){case 0x0:if(_0x32c73c[_0x687d('0x14')]){if(_0x32c73c['result'][_0x687d('0x15')]){logger[_0x687d('0x6')](_0x687d('0x16'),JSON[_0x687d('0x12')](_0x32c73c[_0x687d('0x14')][_0x687d('0x17')]));_0x324254=_0x32c73c[_0x687d('0x14')][_0x687d('0x17')][0x0]['transcript'];_0xca6bb=_0x32c73c[_0x687d('0x14')][_0x687d('0x17')][0x0][_0x687d('0x18')];_0x3be108='0';_0x974406=_0x687d('0x19');_0x7143c[_0x687d('0x13')]();}}break;case 0x1:logger[_0x687d('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3be108='1';_0x974406=_0x687d('0x1a');break;case 0x2:logger[_0x687d('0x6')](_0x687d('0x1b'));_0x3be108='2';_0x974406=_0x687d('0x1b');break;case 0x9:logger[_0x687d('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3be108='9';_0x974406=_0x687d('0x1c');break;case 0xa:logger[_0x687d('0x6')](_0x687d('0x1d'));_0x3be108='10';_0x974406=_0x687d('0x1d');break;case 0xb:logger['info'](_0x687d('0x1e'));_0x3be108='11';_0x974406='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x480119){logger[_0x687d('0x11')](_0x687d('0x1f'),JSON[_0x687d('0x12')](_0x480119));_0x7143c[_0x687d('0x13')]();}}function _0x515266(){logger[_0x687d('0x6')](_0x687d('0x20'));_0x3ea336({'transcript':_0x324254,'confidence':_0xca6bb,'status':_0x3be108,'status_message':_0x974406});}function _0x553b3b(_0x4a19a5){logger[_0x687d('0x11')](_0x687d('0x21'));if(!_['isNil'](_0x4a19a5)){logger['error'](_[_0x687d('0x22')](_0x4a19a5)?JSON[_0x687d('0x12')](_0x4a19a5):_0x4a19a5);}}_0x7143c['on'](_0x687d('0x23'),_0x383019);_0x7143c['on'](_0x687d('0x24'),_0x5861ff);_0x7143c['on'](_0x687d('0x10'),_0x515266);_0x7143c['on']('error',_0x553b3b);});}; \ No newline at end of file +var _0xfac3=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','hex','info','unix','stringify','createReadStream','send','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','Success.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','bluebird','lodash','crypto','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfac3,0xc6));var _0x3fac=function(_0x14aebc,_0x1bd3ca){_0x14aebc=_0x14aebc-0x0;var _0x4690b4=_0xfac3[_0x14aebc];return _0x4690b4;};'use strict';var BPromise=require(_0x3fac('0x0'));var _=require(_0x3fac('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3fac('0x2'));var logger=require('../../../../../../config/logger')(_0x3fac('0x3'));module[_0x3fac('0x4')]=function(_0x4b58dc,_0x48337b,_0x2afdc9,_0x1e7298){return new BPromise(function(_0x535c4d,_0x694865){logger['info']('Tilde\x20URI',_0x1e7298||_0x3fac('0x5'));var _0x31abbb=new WebSocket(_0x1e7298||_0x3fac('0x5'),{'perMessageDeflate':![]});var _0x3f1774='';var _0x4ebed3='0';var _0x48d42a='1';var _0x41a06c=_0x3fac('0x6');function _0x47c566(_0x50ac92){var _0x3c8bd6=crypto[_0x3fac('0x7')](_0x3fac('0x8'));_0x3c8bd6['update'](_0x50ac92);return _0x3c8bd6['digest'](_0x3fac('0x9'));}function _0x4c45b1(){try{logger[_0x3fac('0xa')]('Open\x20Tilde\x20ASR\x20socket');var _0x4b166b=moment()[_0x3fac('0xb')]();var _0x57c1bd=_0x47c566(_0x4b166b+_0x48337b+_0x2afdc9);_0x31abbb['send'](JSON[_0x3fac('0xc')]({'appID':_0x48337b,'timestamp':_0x4b166b,'appKey':_0x57c1bd}));var _0x30045e=fs[_0x3fac('0xd')](_0x4b58dc);_0x30045e['on']('data',function(_0x1b1268){_0x31abbb['send'](_0x1b1268);});_0x30045e['on']('close',function(){_0x31abbb[_0x3fac('0xe')](_0x3fac('0xf'));});}catch(_0x28acb3){logger[_0x3fac('0x10')](_0x3fac('0x11'),JSON['stringify'](_0x28acb3));_0x31abbb[_0x3fac('0x12')]();}}function _0x3470c7(_0x6f3877){try{if(_0x6f3877){var _0x9779e4=JSON[_0x3fac('0x13')](_0x6f3877);switch(_0x9779e4[_0x3fac('0x14')]){case 0x0:if(_0x9779e4[_0x3fac('0x15')]){if(_0x9779e4[_0x3fac('0x15')][_0x3fac('0x16')]){logger[_0x3fac('0xa')]('Tilde\x20ASR\x20hypoteses',JSON[_0x3fac('0xc')](_0x9779e4['result'][_0x3fac('0x17')]));_0x3f1774=_0x9779e4[_0x3fac('0x15')]['hypotheses'][0x0][_0x3fac('0x18')];_0x4ebed3=_0x9779e4[_0x3fac('0x15')]['hypotheses'][0x0]['likelihood'];_0x48d42a='0';_0x41a06c=_0x3fac('0x19');_0x31abbb[_0x3fac('0x12')]();}}break;case 0x1:logger['info'](_0x3fac('0x6'));_0x48d42a='1';_0x41a06c=_0x3fac('0x6');break;case 0x2:logger[_0x3fac('0xa')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x48d42a='2';_0x41a06c='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x3fac('0x1a'));_0x48d42a='9';_0x41a06c=_0x3fac('0x1a');break;case 0xa:logger['info']('Authentication\x20failed.');_0x48d42a='10';_0x41a06c=_0x3fac('0x1b');break;case 0xb:logger[_0x3fac('0xa')](_0x3fac('0x1c'));_0x48d42a='11';_0x41a06c=_0x3fac('0x1c');}}}catch(_0xa3aa98){logger[_0x3fac('0x10')](_0x3fac('0x1d'),JSON['stringify'](_0xa3aa98));_0x31abbb[_0x3fac('0x12')]();}}function _0x1cf67d(){logger[_0x3fac('0xa')](_0x3fac('0x1e'));_0x535c4d({'transcript':_0x3f1774,'confidence':_0x4ebed3,'status':_0x48d42a,'status_message':_0x41a06c});}function _0x2c1e86(_0x1231d6){logger[_0x3fac('0x10')](_0x3fac('0x1f'));if(!_[_0x3fac('0x20')](_0x1231d6)){logger[_0x3fac('0x10')](_[_0x3fac('0x21')](_0x1231d6)?JSON[_0x3fac('0xc')](_0x1231d6):_0x1231d6);}}_0x31abbb['on']('open',_0x4c45b1);_0x31abbb['on']('message',_0x3470c7);_0x31abbb['on']('close',_0x1cf67d);_0x31abbb['on'](_0x3fac('0x10'),_0x2c1e86);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 10cb4be..123c3d8 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xac70=['exports','./asr'];(function(_0x523bb8,_0x3ff8b5){var _0x44dcd8=function(_0x2e83b2){while(--_0x2e83b2){_0x523bb8['push'](_0x523bb8['shift']());}};_0x44dcd8(++_0x3ff8b5);}(_0xac70,0x1d1));var _0x0ac7=function(_0x2b67ab,_0x2d9aff){_0x2b67ab=_0x2b67ab-0x0;var _0x5e05cb=_0xac70[_0x2b67ab];return _0x5e05cb;};var asr=require(_0x0ac7('0x0'));module[_0x0ac7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 1387840..54b57fd 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2b6fe91..cc4f319 100644 --- a/server/services/agi/vertices.js +++ b/server/services/agi/vertices.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85f8=['no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','getData','test','mindigit','maxdigit','hiddendigitsnum','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','generate','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','operation','no\x20operation\x20configured','math\x20%s','no\x20file\x20audio\x20found','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','context','extension','priority','accountcode','createSquareMessage','createCmContact','isEmpty','callback_','lastName','isNil','phone','list_id','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','error','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_bot_name','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','isConfigured','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected'];(function(_0x326b39,_0x4143c9){var _0x5b62d1=function(_0x51c092){while(--_0x51c092){_0x326b39['push'](_0x326b39['shift']());}};_0x5b62d1(++_0x4143c9);}(_0x85f8,0xd7));var _0x885f=function(_0x5a9a85,_0x5cd70f){_0x5a9a85=_0x5a9a85-0x0;var _0x5b2562=_0x85f8[_0x5a9a85];return _0x5b2562;};'use strict';var fs=require('fs');var util=require(_0x885f('0x0'));var _=require(_0x885f('0x1'));var sh=require(_0x885f('0x2'));var odbc=require(_0x885f('0x3'))();var rs=require(_0x885f('0x4'));var moment=require(_0x885f('0x5'));var Mustache=require(_0x885f('0x6'));var rp=require(_0x885f('0x7'));var logger=require('../../config/logger')(_0x885f('0x8'));var config=require(_0x885f('0x9'));var shared=require(_0x885f('0xa'));var scripts=require('./scripts');var FILES_PATH=_0x885f('0xb');var recursiveMapAttributes=[_0x885f('0xc'),_0x885f('0xd')];var verticesWithRetry=[_0x885f('0xe'),_0x885f('0xf'),_0x885f('0x10')];var AGIVertices=function(_0x9c0173,_0x34eae5,_0xece628){this[_0x885f('0x11')]=_0x9c0173;this[_0x885f('0x12')]=_0x34eae5;this[_0x885f('0x13')]=_0xece628;};AGIVertices[_0x885f('0x14')][_0x885f('0x15')]=function(_0x49244e,_0x3f606c){this[_0x885f('0x12')][_0x885f('0x16')](_0x49244e)[_0x885f('0x17')](function(_0x4e657c){_0x3f606c(null,_0x4e657c?_0x4e657c['name']:![]);})['catch'](function(_0x3608ac){_0x3f606c(_0x3608ac);});};AGIVertices[_0x885f('0x14')][_0x885f('0x18')]=function(_0x5e5cdc,_0x40b206){this[_0x885f('0x12')][_0x885f('0x19')](_0x5e5cdc)[_0x885f('0x17')](function(_0x33866a){_0x40b206(null,_0x33866a?_0x33866a[_0x885f('0x1a')]:![]);})[_0x885f('0x1b')](function(_0x47f988){_0x40b206(_0x47f988);});};AGIVertices[_0x885f('0x14')][_0x885f('0x1c')]=function(_0x3de046,_0x3b05a3){this[_0x885f('0x12')][_0x885f('0x1d')](_0x3de046)[_0x885f('0x17')](function(_0x52e6cb){_0x3b05a3(null,_0x52e6cb?_0x52e6cb[_0x885f('0x1a')]:![]);})['catch'](function(_0x1670b9){_0x3b05a3(_0x1670b9);});};AGIVertices[_0x885f('0x14')][_0x885f('0x1e')]=function(_0x5513b1,_0x4f66b5){this[_0x885f('0x12')][_0x885f('0x1f')](_0x5513b1)['then'](function(_0x3b7230){_0x4f66b5(null,_0x3b7230?_0x3b7230[_0x885f('0x20')]:![]);})[_0x885f('0x1b')](function(_0x59fcc6){_0x4f66b5(_0x59fcc6);});};AGIVertices[_0x885f('0x14')][_0x885f('0x21')]=function(_0x53cd9f,_0x43ce83){this[_0x885f('0x12')][_0x885f('0x22')](_0x53cd9f)[_0x885f('0x17')](function(_0x458ff3){_0x43ce83(null,_0x458ff3?_0x458ff3['name']:![]);})[_0x885f('0x1b')](function(_0x573c8c){_0x43ce83(_0x573c8c);});};AGIVertices[_0x885f('0x14')][_0x885f('0x23')]=function(_0x59da94,_0x26bac6){this['rpc']['getTrunkById'](_0x59da94)[_0x885f('0x17')](function(_0xb14918){_0x26bac6(null,_0xb14918?_0xb14918[_0x885f('0x1a')]:![]);})[_0x885f('0x1b')](function(_0x44cef9){_0x26bac6(_0x44cef9);});};AGIVertices[_0x885f('0x14')]['getSound']=function(_0xc13dda,_0x22f657){var _0x59e1b7=this;this[_0x885f('0x12')][_0x885f('0x24')](_0xc13dda)[_0x885f('0x17')](function(_0x531e67){_0x22f657(null,_0x531e67?_0x59e1b7[_0x885f('0x25')](_0x531e67[_0x885f('0x26')]):![]);})[_0x885f('0x1b')](function(_0x1c6440){_0x22f657(_0x1c6440);});};AGIVertices[_0x885f('0x14')][_0x885f('0x27')]=function(_0x4989ab,_0x1be6a8){this[_0x885f('0x12')][_0x885f('0x28')](_0x4989ab)['then'](function(_0x49d61f){_0x1be6a8(null,_0x49d61f?_0x49d61f:![]);})[_0x885f('0x1b')](function(_0x143649){_0x1be6a8(_0x143649);});};AGIVertices[_0x885f('0x14')][_0x885f('0x29')]=function(_0x15d92a,_0x511ba2,_0x5b6d33){this['mailRpc']['sendMailMessage'](_0x15d92a,_0x511ba2)[_0x885f('0x17')](function(){_0x5b6d33(null);})[_0x885f('0x1b')](function(_0xd8102f){_0x5b6d33(_0xd8102f);});};AGIVertices['prototype']['getIntervals']=function(_0x2948a4,_0x1edf53){this[_0x885f('0x12')][_0x885f('0x2a')](_0x2948a4)[_0x885f('0x17')](function(_0x288685){if(_0x288685){if(_0x288685[_0x885f('0x2b')]){_0x1edf53(null,[_0x288685[_0x885f('0x2c')]]);}else{_0x1edf53(null,_[_0x885f('0x2d')](_0x288685[_0x885f('0x2e')],_0x885f('0x2c')));}}else{_0x1edf53(null,![]);}})[_0x885f('0x1b')](function(_0x49e30d){_0x1edf53(_0x49e30d);});};AGIVertices['prototype'][_0x885f('0x25')]=function(_0x509c9d){return util[_0x885f('0x2f')]('%s/sounds/converted/%s',FILES_PATH,_0x509c9d);};AGIVertices['prototype'][_0x885f('0x30')]=function(_0x4960c9,_0xa79fc4,_0x586b88){odbc[_0x885f('0x31')](_0x4960c9,function(_0x122689){if(_0x122689){logger['error'](_0x885f('0x32'),_0x122689);_0x586b88(_0x122689);}else{logger[_0x885f('0x33')]('ODBC\x20connection\x20successfully');odbc[_0x885f('0x34')](_0xa79fc4,function(_0x3a686f,_0x1342ba){if(_0x3a686f){logger[_0x885f('0x33')](_0x885f('0x35'),_0xa79fc4);_0x586b88(_0x3a686f);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0xa79fc4);odbc[_0x885f('0x36')](function(_0x5b5e98){if(_0x5b5e98){logger['error'](_0x885f('0x37'),_0x5b5e98);}_0x586b88(null,_0x1342ba);});}});}});};AGIVertices[_0x885f('0x14')][_0x885f('0x38')]=function(_0xbbf051,_0x3e9df0){this[_0x885f('0x12')][_0x885f('0x39')](_0xbbf051)[_0x885f('0x17')](function(_0x196e69){_0x3e9df0(null,_0x196e69?_0x196e69:![]);})['catch'](function(_0x1bb561){_0x3e9df0(_0x1bb561);});};AGIVertices[_0x885f('0x14')][_0x885f('0x3a')]=function(_0xc92b8c,_0x16b77c){this[_0x885f('0x12')][_0x885f('0x3a')](_0xc92b8c)['then'](function(_0x289c94){_0x16b77c(null,_0x289c94);})[_0x885f('0x1b')](function(_0x4b74ab){_0x16b77c(_0x4b74ab);});};AGIVertices[_0x885f('0x14')][_0x885f('0x3b')]=function(_0x1a25d2,_0x47ee0f,_0x204f5c){this[_0x885f('0x12')]['createSquareDetailsReport']({'uniqueid':this[_0x885f('0x11')][_0x885f('0x3c')],'node':_0x1a25d2['label'],'application':_0x1a25d2[_0x885f('0x3d')],'data':_0x47ee0f||null,'project_name':this[_0x885f('0x11')][_0x885f('0x3e')],'callerid':this[_0x885f('0x11')]['callerid']})[_0x885f('0x17')](function(_0x465693){if(_0x204f5c){_0x204f5c(null,_0x465693);}})[_0x885f('0x1b')](function(_0x245cc1){if(_0x204f5c){_0x204f5c(_0x245cc1);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x40f2b3,_0x410174,_0x3acdae,_0x4bb627){this['rpc']['createSquareRecording']({'uniqueid':this[_0x885f('0x11')][_0x885f('0x3c')],'callerid':this[_0x885f('0x11')][_0x885f('0x3f')],'calleridname':this[_0x885f('0x11')]['calleridname'],'context':this[_0x885f('0x11')][_0x885f('0x40')],'extension':this[_0x885f('0x11')][_0x885f('0x41')],'priority':this[_0x885f('0x11')][_0x885f('0x42')],'accountcode':this['channel'][_0x885f('0x43')],'dnid':this[_0x885f('0x11')]['dnid'],'projectName':this[_0x885f('0x11')][_0x885f('0x3e')],'saveName':_0x410174,'filename':_0x40f2b3['file']||_0x410174,'savePath':_0x3acdae})['then'](function(_0x38fb2a){_0x4bb627(null,_0x38fb2a);})[_0x885f('0x1b')](function(_0x511166){_0x4bb627(_0x511166);});};AGIVertices[_0x885f('0x14')][_0x885f('0x44')]=function(_0x5e7278,_0x174862,_0x50d4d1,_0x4e10eb,_0x58a674){this['rpc']['createSquareMessage']({'uniqueid':this[_0x885f('0x11')][_0x885f('0x3c')],'body':_0x5e7278,'direction':_0x174862,'providerName':_0x50d4d1,'providerResponse':_0x4e10eb})['then'](function(_0x1272a6){if(_0x58a674){_0x58a674(null,_0x1272a6);}})[_0x885f('0x1b')](function(_0x332d77){if(_0x58a674){_0x58a674(_0x332d77);}});};AGIVertices['prototype'][_0x885f('0x45')]=function(_0x400a6a,_0x283222){this[_0x885f('0x12')]['createCmContact']({'firstName':_[_0x885f('0x46')](_0x400a6a['name'])||_['isNil'](_0x400a6a[_0x885f('0x1a')])?_0x885f('0x47')+Math['random']():_0x400a6a[_0x885f('0x1a')],'lastName':_['isEmpty'](_0x400a6a[_0x885f('0x48')])||_[_0x885f('0x49')](_0x400a6a[_0x885f('0x48')])?null:_0x400a6a['lastName'],'phone':_0x400a6a[_0x885f('0x4a')],'ListId':_0x400a6a[_0x885f('0x4b')],'scheduledat':_0x400a6a[_0x885f('0x4c')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x885f('0x4d'),'description':'Callback\x20scheduled\x20at\x20'+_0x400a6a[_0x885f('0x4c')][_0x885f('0x4e')](),'priority':_0x400a6a['callback_priority']})[_0x885f('0x17')](function(_0x3385bb){_0x283222(null,_0x3385bb);})[_0x885f('0x1b')](function(_0x368134){_0x283222(_0x368134);});};AGIVertices[_0x885f('0x14')][_0x885f('0x4f')]=function(_0x45b65f,_0x410414){this[_0x885f('0x12')][_0x885f('0x50')](_0x45b65f)[_0x885f('0x17')](function(_0x55fbfa){_0x410414(null,_0x55fbfa?_0x55fbfa['name']:![]);})[_0x885f('0x1b')](function(_0x5de066){_0x410414(_0x5de066);});};AGIVertices[_0x885f('0x14')][_0x885f('0x51')]=function(_0x1a8cb2,_0x4c197e,_0x1f2649){var _0x5bf76f={'role':_0x885f('0x52')};_0x5bf76f[_0x1a8cb2]=this['channel'][_0x885f('0x3f')];this[_0x885f('0x12')][_0x885f('0x51')](_0x5bf76f,_0x4c197e,this['channel'][_0x885f('0x3c')])['then'](function(_0x44c0c3){_0x1f2649(null,_[_0x885f('0x49')](_0x44c0c3)?![]:!![]);})['catch'](function(_0x10b9c4){logger[_0x885f('0x53')](_0x10b9c4);_0x1f2649(null,![]);});};AGIVertices[_0x885f('0x14')][_0x885f('0x54')]=function(_0x5cbe66,_0x2fa5f7){var _0x486c84={'role':_0x885f('0x52')};_0x486c84[_0x5cbe66]=this[_0x885f('0x11')][_0x885f('0x3f')];this['rpc']['agentUnpause'](_0x486c84)['then'](function(_0x581a89){_0x2fa5f7(null,_[_0x885f('0x49')](_0x581a89)?![]:!![]);})[_0x885f('0x1b')](function(_0x5f4c86){logger[_0x885f('0x53')](_0x5f4c86);_0x2fa5f7(null,![]);});};AGIVertices[_0x885f('0x14')]['agentLogout']=function(_0x9a33c,_0x1962f0){var _0x1fcd09={'role':_0x885f('0x52')};_0x1fcd09[_0x9a33c]=this['channel']['callerid'];this['rpc'][_0x885f('0x55')](_0x1fcd09)['then'](function(_0x7863b9){_0x1962f0(null,_['isNil'](_0x7863b9)?![]:!![]);})[_0x885f('0x1b')](function(_0xe8fe51){logger[_0x885f('0x53')](_0xe8fe51);_0x1962f0(null,![]);});};AGIVertices[_0x885f('0x14')]['agentLogin']=function(_0x2ad6cb,_0x1b0c5d){var _0x2ec455={'role':_0x885f('0x52')};_0x2ec455[_0x2ad6cb]=this[_0x885f('0x11')][_0x885f('0x3f')];var _0x3acf55=_0x2ad6cb!=_0x885f('0x56')?util[_0x885f('0x2f')](_0x885f('0x57'),'LOCAL',this[_0x885f('0x11')][_0x885f('0x3f')]):undefined;this[_0x885f('0x12')][_0x885f('0x58')](_0x2ec455,_0x3acf55)['then'](function(_0x2950f5){_0x1b0c5d(null,_[_0x885f('0x49')](_0x2950f5)?![]:!![]);})[_0x885f('0x1b')](function(_0x4e59de){logger[_0x885f('0x53')](_0x4e59de);_0x1b0c5d(null,![]);});};AGIVertices[_0x885f('0x14')][_0x885f('0x59')]=function(_0x5d71ad,_0x14d42f){sh[_0x885f('0x5a')](_[_0x885f('0x5b')](_0x5d71ad),function(_0x26a9ab,_0x143c7c){var _0x1822c7=_0x143c7c[_0x885f('0x5c')](/(\r\n|\n|\r)/gm,'');_0x14d42f(null,_0x1822c7);});};AGIVertices[_0x885f('0x14')][_0x885f('0x5d')]=function(_0x189aee,_0x4897e2){scripts[_0x885f('0x5d')](_0x189aee['apiKey'],_0x189aee[_0x885f('0x5e')]||_0x885f('0x5f'),_0x189aee[_0x885f('0x5f')],_0x189aee['languageCode']||_0x885f('0x60'),_0x189aee[_0x885f('0x61')]||_0x885f('0x62'),_0x189aee['audioEncoding']||_0x885f('0x63'))['then'](function(_0x323522){_0x4897e2(null,_0x323522);})[_0x885f('0x1b')](function(_0x11a653){_0x4897e2(_0x11a653);});};AGIVertices['prototype'][_0x885f('0x64')]=function(_0x4abf5d,_0x4563b8){scripts[_0x885f('0x64')](_0x4abf5d[_0x885f('0x5f')],_0x4abf5d[_0x885f('0x65')]||'en',0x1)[_0x885f('0x17')](function(_0x2163b7){_0x4563b8(null,_0x2163b7);})['catch'](function(_0x5b8a26){_0x4563b8(_0x5b8a26);});};AGIVertices['prototype'][_0x885f('0x66')]=function(_0x4fdccb,_0x5a8897){var _0x5d5b00={'uri':_0x4fdccb[_0x885f('0x67')],'method':_0x4fdccb[_0x885f('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4fdccb[_0x885f('0x69')])===_0x885f('0x6a')&&parseInt(_0x4fdccb[_0x885f('0x69')])>=0x1?parseInt(_0x4fdccb[_0x885f('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x885f('0x6b')](['POST',_0x885f('0x6c')],_0x5d5b00[_0x885f('0x68')][_0x885f('0x6d')]())){try{_0x5d5b00['body']=_0x4fdccb[_0x885f('0xd')]?JSON[_0x885f('0x6e')](_0x4fdccb[_0x885f('0xd')]):{};}catch(_0x361dff){logger[_0x885f('0x53')](_0x885f('0x6f'),_0x361dff);}}try{_0x5d5b00[_0x885f('0x70')]=_0x4fdccb['rawHeaders']?JSON['parse'](_0x4fdccb[_0x885f('0xc')]):{};}catch(_0x56dca2){logger[_0x885f('0x53')](_0x885f('0x71'),_0x56dca2);}if(_0x4fdccb[_0x885f('0x72')]){try{var _0x228a45=require(_0x4fdccb[_0x885f('0x72')])[_0x885f('0x73')](this,_0x5d5b00);_0x5d5b00[_0x885f('0x74')]=Mustache[_0x885f('0x75')](_0x4fdccb[_0x885f('0x67')],_0x228a45,{},['$$','$$']);if(_0x5d5b00[_0x885f('0x70')]){_0x5d5b00[_0x885f('0x70')]=JSON[_0x885f('0x6e')](Mustache[_0x885f('0x75')](JSON[_0x885f('0x76')](_0x5d5b00[_0x885f('0x70')]),_0x228a45,{},['$$','$$']));}if(_0x5d5b00[_0x885f('0x77')]){_0x5d5b00[_0x885f('0x77')]=JSON[_0x885f('0x6e')](Mustache[_0x885f('0x75')](JSON[_0x885f('0x76')](_0x5d5b00[_0x885f('0x77')]),_0x228a45,{},['$$','$$']));}}catch(_0x703eb8){logger[_0x885f('0x53')](_0x885f('0x78'),_0x703eb8);}}rp(_0x5d5b00)[_0x885f('0x17')](function(_0x2b2bab){var _0x5e1002={'statusCode':_0x2b2bab[_0x885f('0x79')]||0xc8,'statusMessage':_0x2b2bab[_0x885f('0x7a')]||'OK','headers':_0x2b2bab['headers']||{},'body':_0x2b2bab['body']||{}};_0x5a8897(null,_0x5e1002);})[_0x885f('0x1b')](function(_0xa09ef4){var _0x1a755a={'statusCode':_0xa09ef4[_0x885f('0x79')]||0x1f4,'statusMessage':_0xa09ef4[_0x885f('0x7b')]||_0x885f('0x7c'),'headers':_0xa09ef4['options'][_0x885f('0x70')]||{},'body':_0xa09ef4[_0x885f('0x7d')][_0x885f('0x77')]||{}};_0x5a8897(null,_0x1a755a);});};AGIVertices[_0x885f('0x14')]['googleDialogflow']=function(_0x1e8f97,_0x3dc43e){scripts[_0x885f('0x7e')](this[_0x885f('0x11')][_0x885f('0x3c')],_0x1e8f97[_0x885f('0x7f')],_0x1e8f97[_0x885f('0x5f')],_0x1e8f97[_0x885f('0x80')]||'en')[_0x885f('0x17')](function(_0x4d98a5){_0x3dc43e(null,_0x4d98a5);})[_0x885f('0x1b')](function(_0x273bef){_0x3dc43e(_0x273bef);});};AGIVertices['prototype'][_0x885f('0x81')]=function(_0x5749b3,_0x51d308){scripts[_0x885f('0x81')](this['channel']['uniqueid'],_0x5749b3[_0x885f('0x82')],_0x5749b3[_0x885f('0x83')],_0x5749b3['private_key'],_0x5749b3['text'],_0x5749b3['dialogflowV2_language']||'en')[_0x885f('0x17')](function(_0x3e4ffa){_0x51d308(null,_0x3e4ffa);})[_0x885f('0x1b')](function(_0x3ff363){_0x51d308(_0x3ff363);});};AGIVertices['prototype']['sestekNDA']=function(_0x3b4a90,_0x8a0160){scripts[_0x885f('0x84')](this[_0x885f('0x11')],_0x3b4a90)['then'](function(_0x32570b){_0x8a0160(null,_0x32570b);})[_0x885f('0x1b')](function(_0x1af6e7){_0x8a0160(_0x1af6e7);});};AGIVertices['prototype'][_0x885f('0x85')]=function(_0x35b94b,_0xf54836){scripts[_0x885f('0x85')](_0x35b94b[_0x885f('0x7f')],_0x35b94b[_0x885f('0x5f')],_0x35b94b[_0x885f('0x86')]||_0x885f('0x60'),_0x35b94b[_0x885f('0x87')])['then'](function(_0x40fb69){_0xf54836(null,_0x40fb69);})[_0x885f('0x1b')](function(_0x4788d7){_0xf54836(_0x4788d7);});};AGIVertices[_0x885f('0x14')]['ispeechASR']=function(_0x3b22be,_0x21e864,_0xaf236d){scripts['ispeechASR'](_0x21e864,_0x3b22be[_0x885f('0x7f')],_0x3b22be[_0x885f('0x88')]||_0x885f('0x60'),this['isConfigured'](_0x3b22be[_0x885f('0x89')])?_0x3b22be[_0x885f('0x89')]:undefined)[_0x885f('0x17')](function(_0x2c5489){_0xaf236d(null,_0x2c5489);})[_0x885f('0x1b')](function(_0x278195){_0xaf236d(_0x278195);});};AGIVertices[_0x885f('0x14')]['awsPolly']=function(_0xfcbbb4,_0x3a4dd0){scripts[_0x885f('0x8a')](_0xfcbbb4[_0x885f('0x8b')],_0xfcbbb4[_0x885f('0x8c')],_0xfcbbb4[_0x885f('0x8d')],_0xfcbbb4[_0x885f('0x8e')]||'Amy',_0xfcbbb4['text'],_0xfcbbb4[_0x885f('0x8f')]||_0x885f('0x5f'))[_0x885f('0x17')](function(_0x24880d){_0x3a4dd0(null,_0x24880d);})['catch'](function(_0x2bec96){_0x3a4dd0(_0x2bec96);});};AGIVertices[_0x885f('0x14')][_0x885f('0x90')]=function(_0x739470,_0x2f3d7c){scripts[_0x885f('0x90')](this['channel'][_0x885f('0x3c')],_0x739470[_0x885f('0x8b')],_0x739470[_0x885f('0x8c')],_0x739470['aws_lex_region'],_0x739470[_0x885f('0x5f')],_0x739470[_0x885f('0x91')])[_0x885f('0x17')](function(_0x4c21ff){_0x2f3d7c(null,_0x4c21ff);})[_0x885f('0x1b')](function(_0xad75a4){_0x2f3d7c(_0xad75a4);});};AGIVertices[_0x885f('0x14')]['googleASR']=function(_0x349a6f,_0x4716c0,_0x2d5c65){scripts['googleASR'](_0x4716c0,_0x349a6f['key'],_0x349a6f[_0x885f('0x92')]||_0x885f('0x60'))[_0x885f('0x17')](function(_0x1e41ad){_0x2d5c65(null,_0x1e41ad);})['catch'](function(_0x555af6){_0x2d5c65(_0x555af6);});};AGIVertices[_0x885f('0x14')][_0x885f('0x93')]=function(_0x2db905,_0x5a8180,_0x393d80){scripts[_0x885f('0x93')](_0x5a8180,_0x2db905[_0x885f('0x94')],_0x2db905[_0x885f('0x95')],_0x2db905[_0x885f('0x74')])[_0x885f('0x17')](function(_0x319420){_0x393d80(null,_0x319420);})['catch'](function(_0x299eaa){_0x393d80(_0x299eaa);});};AGIVertices[_0x885f('0x14')][_0x885f('0x96')]=function(_0x484293){var _0x5888ed=_[_0x885f('0x6b')](verticesWithRetry,_0x484293[_0x885f('0x3d')])?_0x484293:_[_0x885f('0x97')](_0x484293);for(var _0x4e7b36 in _0x5888ed){if(_0x5888ed[_0x885f('0x98')](_0x4e7b36)){if(_0x5888ed[_0x4e7b36]&&_[_0x885f('0x99')](_0x5888ed[_0x4e7b36])){if(_['includes'](recursiveMapAttributes,_0x4e7b36)){_0x5888ed[_0x4e7b36]=this[_0x885f('0x9a')](_0x5888ed[_0x4e7b36]);}else{_0x5888ed[_0x4e7b36]=this[_0x885f('0x9b')](_0x5888ed[_0x4e7b36]);}}}}return _0x5888ed;};AGIVertices['prototype'][_0x885f('0x9c')]=function(_0x2e6c6e){for(var _0x28c668 in _0x2e6c6e){if(_0x2e6c6e[_0x885f('0x98')](_0x28c668)){if(_[_0x885f('0x9d')](_0x2e6c6e[_0x28c668])){this[_0x885f('0x9c')](_0x2e6c6e[_0x28c668]);}else if(_[_0x885f('0x9e')](_0x2e6c6e[_0x28c668])){for(var _0x4cdfc2=0x0;_0x4cdfc2<_0x2e6c6e[_0x28c668][_0x885f('0x9f')];_0x4cdfc2++){this[_0x885f('0x9c')](_0x2e6c6e[_0x28c668][_0x4cdfc2]);}}else if(_[_0x885f('0x99')](_0x2e6c6e[_0x28c668])){_0x2e6c6e[_0x28c668]=this[_0x885f('0x9b')](_0x2e6c6e[_0x28c668]);}}}};AGIVertices[_0x885f('0x14')][_0x885f('0xa0')]=function(_0x25c131,_0x1b8f16){for(var _0x26c485 in _0x25c131){if(_0x25c131[_0x885f('0x98')](_0x26c485)){if(_[_0x885f('0x9d')](_0x25c131[_0x26c485])){if(!_[_0x885f('0x46')](_0x25c131[_0x26c485])){this[_0x885f('0xa0')](_0x25c131[_0x26c485],util[_0x885f('0x2f')](_0x885f('0xa1'),_0x1b8f16,_0x26c485));}}else if(_[_0x885f('0x9e')](_0x25c131[_0x26c485])){for(var _0x570775=0x0;_0x570775<_0x25c131[_0x26c485][_0x885f('0x9f')];_0x570775++){this[_0x885f('0xa0')](_0x25c131[_0x26c485][_0x570775],util[_0x885f('0x2f')](_0x885f('0xa1'),_0x1b8f16,_0x26c485+'['+_0x570775+']'));}}else{if(!_[_0x885f('0x49')](_0x25c131[_0x26c485])){this[_0x885f('0x11')][_0x885f('0xa2')](util[_0x885f('0x2f')](_0x885f('0xa1'),_0x1b8f16,_0x26c485),_0x25c131[_0x26c485]);}}}}};AGIVertices['prototype'][_0x885f('0x9a')]=function(_0x55599e){try{var _0x5503b8=JSON[_0x885f('0x6e')](_0x55599e);this['recursiveNodeIndex'](_0x5503b8);return JSON[_0x885f('0x76')](_0x5503b8);}catch(_0x4dafbe){return this[_0x885f('0x9b')](_0x55599e);}};AGIVertices[_0x885f('0x14')][_0x885f('0x9b')]=function(_0x4eebc9){var _0x47a986=_0x4eebc9[_0x885f('0xa3')]('{');for(var _0x374842=0x1;_0x374842<_0x47a986[_0x885f('0x9f')];_0x374842+=0x1){var _0x4b5c7b=_0x47a986[_0x374842][_0x885f('0xa3')]('}');if(_0x4b5c7b[_0x885f('0x9f')]>0x1){_0x4eebc9=_0x4eebc9[_0x885f('0xa4')]('{'+_0x4b5c7b[0x0]+'}',this['channel'][_0x885f('0x15')](_0x4b5c7b[0x0])[_0x885f('0xa5')]||_0x4b5c7b[0x0]);}}if(_0x47a986[_0x885f('0x9f')]===0x1){return _0x4eebc9['toString']();}return this['replaceAllVariables'](_0x4eebc9);};AGIVertices[_0x885f('0x14')]['getAndSetVariable']=function(_0xdaf368,_0x597b86){var _0x343436=this[_0x885f('0x11')]['getVariable'](_0xdaf368);if(_0x343436[_0x885f('0xa6')]===-0x1){return _0x343436;}logger[_0x885f('0x33')](util[_0x885f('0x2f')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x597b86,_0x343436[_0x885f('0xa5')]));return this[_0x885f('0x11')]['setVariable'](_0x597b86,_0x343436['extra']);};AGIVertices[_0x885f('0x14')][_0x885f('0xa7')]=function(_0x190a96){return _0x190a96&&_0x190a96!=='0'&&_0x190a96!=='-1'&&_0x190a96!=='';};AGIVertices[_0x885f('0x14')]['maxRetry']=function(_0x5a4202){this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x5a4202,'-');_0x5a4202[_0x885f('0xa8')]=_0x5a4202[_0x885f('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x885f('0x14')]['mrcpsynth']=function(_0x313525){logger['info'](util[_0x885f('0x2f')](_0x885f('0xaa'),_0x313525[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x313525[_0x885f('0x5f')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xad'));}var _0x2a94b7='\x22'+_0x313525[_0x885f('0x5f')]+'\x22';if(this[_0x885f('0xa7')](_0x313525['options'])){_0x2a94b7+=','+_0x313525['options'];}var _0x43a65f=this[_0x885f('0x11')]['exec'](_0x885f('0xae'),_0x2a94b7);if(_0x43a65f[_0x885f('0xa6')]===-0x1){return _0x43a65f;}return this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0xaf'),_0x2a94b7));};AGIVertices[_0x885f('0x14')][_0x885f('0xb0')]=function(_0x58be9b){logger[_0x885f('0x33')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x58be9b['label']));if(!this['isConfigured'](_0x58be9b['grammar'])){return this['channel'][_0x885f('0xac')](_0x885f('0xb1'));}var _0xdc0c72=_0x58be9b[_0x885f('0xb2')];if(this[_0x885f('0xa7')](_0x58be9b[_0x885f('0x7d')])){_0xdc0c72+=','+_0x58be9b[_0x885f('0x7d')];}var _0x415cc5=this[_0x885f('0x11')][_0x885f('0x5a')]('MRCPRecog',_0xdc0c72);if(_0x415cc5[_0x885f('0xa6')]===-0x1){return _0x415cc5;}var _0x28a05f=this[_0x885f('0xb3')](_0x885f('0xb4'),_0x885f('0xb5'));if(_0x28a05f[_0x885f('0xa6')]===-0x1){return _0x28a05f;}var _0x3ff2ed=this['getAndSetVariable'](_0x885f('0xb6'),_0x885f('0xb7'));if(_0x3ff2ed[_0x885f('0xa6')]===-0x1){return _0x3ff2ed;}var _0x3071ee=this['getAndSetVariable'](_0x885f('0xb8'),_0x885f('0xb9'));if(_0x3071ee[_0x885f('0xa6')]===-0x1){return _0x3071ee;}return this['channel']['noop'](util['format'](_0x885f('0xba'),_0xdc0c72));};AGIVertices[_0x885f('0x14')][_0x885f('0x8')]=function(_0x5b68fa){logger[_0x885f('0x33')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x5b68fa[_0x885f('0xab')]));return this[_0x885f('0x11')][_0x885f('0x8')]([_0x5b68fa[_0x885f('0xbb')],_0x5b68fa[_0x885f('0xbc')]]);};AGIVertices[_0x885f('0x14')][_0x885f('0xbd')]=function(_0x340783){logger['info'](util[_0x885f('0x2f')](_0x885f('0xbe'),_0x340783[_0x885f('0xab')]));if(this[_0x885f('0xa7')](_0x340783['timeout'])){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0xbf'),_0x340783[_0x885f('0x69')]));var _0x916c20=this['channel'][_0x885f('0xc0')](_0x340783[_0x885f('0x69')]);if(_0x916c20[_0x885f('0xa6')]===-0x1){return _0x916c20;}}return this['channel'][_0x885f('0xbd')]();};AGIVertices['prototype'][_0x885f('0x4d')]=function(_0x21e508){logger[_0x885f('0x33')](util['format'](_0x885f('0xc1'),_0x21e508[_0x885f('0xab')]));if(!this['isConfigured'](_0x21e508[_0x885f('0x4b')])){return this[_0x885f('0x11')]['error'](_0x21e508,_0x885f('0xc2'));}_0x21e508['scheduledAt']=moment();if(this[_0x885f('0xa7')](_0x21e508['delay'])){_0x21e508['scheduledAt']=moment()[_0x885f('0xc3')](_0x21e508[_0x885f('0xc4')],_0x885f('0xc5'));}if(!this[_0x885f('0xa7')](_0x21e508[_0x885f('0xc6')])){_0x21e508[_0x885f('0xc6')]=0x2;}this[_0x885f('0x45')][_0x885f('0x73')](this,_0x21e508);return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0xc7'),_0x21e508[_0x885f('0x4a')],_0x21e508[_0x885f('0x4b')],_0x21e508[_0x885f('0x4c')]));};AGIVertices[_0x885f('0x14')]['custom_app']=function(_0x159691){logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x159691['label']));var _0x41fda7=this[_0x885f('0x11')][_0x885f('0x5a')](_0x159691[_0x885f('0xc8')],_0x159691[_0x885f('0x7d')]);if(_0x41fda7['result']===-0x1){return _0x41fda7;}return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')]('Executed\x20command\x20%s\x20%s',_0x159691[_0x885f('0xc8')],_0x159691[_0x885f('0x7d')]));};AGIVertices[_0x885f('0x14')][_0x885f('0xc9')]=function(_0x373728){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0xca'),_0x373728['label']));if(!this[_0x885f('0xa7')](_0x373728[_0x885f('0x5f')])){return this[_0x885f('0x11')]['noop'](_0x885f('0xad'));}var _0x4368b5='\x22'+_0x373728[_0x885f('0x5f')]+'\x22';if(this[_0x885f('0xa7')](_0x373728[_0x885f('0x7d')])){_0x4368b5+=','+_0x373728[_0x885f('0x7d')];}var _0x316c82=this[_0x885f('0x11')][_0x885f('0x5a')]('MRCPSynth',_0x4368b5);if(_0x316c82[_0x885f('0xa6')]===-0x1){return _0x316c82;}return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0xaf'),_0x4368b5));};AGIVertices['prototype'][_0x885f('0xcb')]=function(_0x2e7c82){logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2e7c82[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x2e7c82[_0x885f('0x5f')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xad'));}var _0x3ca3e0='\x22'+_0x2e7c82[_0x885f('0x5f')]+'\x22';if(this[_0x885f('0xa7')](_0x2e7c82['options'])){_0x3ca3e0+=','+_0x2e7c82[_0x885f('0x7d')];}var _0x356dad=this[_0x885f('0x11')][_0x885f('0x5a')](_0x885f('0xae'),_0x3ca3e0);if(_0x356dad['result']===-0x1){return _0x356dad;}return this[_0x885f('0x11')][_0x885f('0xac')](util['format'](_0x885f('0xaf'),_0x3ca3e0));};AGIVertices[_0x885f('0x14')][_0x885f('0xcc')]=function(_0xd3a509){logger[_0x885f('0x33')](util['format'](_0x885f('0xcd'),_0xd3a509[_0x885f('0xab')]));if(!this['isConfigured'](_0xd3a509[_0x885f('0xb2')])){return this[_0x885f('0x11')][_0x885f('0xac')]('no\x20grammar\x20configured');}var _0x48a338=_0xd3a509[_0x885f('0xb2')];if(this['isConfigured'](_0xd3a509[_0x885f('0x7d')])){_0x48a338+=','+_0xd3a509[_0x885f('0x7d')];}var _0x5b3cf4=this['channel'][_0x885f('0x5a')]('MRCPRecog',_0x48a338);if(_0x5b3cf4['result']===-0x1){return _0x5b3cf4;}var _0x547bb3=this[_0x885f('0xb3')](_0x885f('0xb4'),'LUMENVOX_ASR_CONFIDENCE');if(_0x547bb3['result']===-0x1){return _0x547bb3;}var _0x59b3b9=this[_0x885f('0xb3')](_0x885f('0xb6'),_0x885f('0xce'));if(_0x59b3b9[_0x885f('0xa6')]===-0x1){return _0x59b3b9;}var _0xa4e16a=this[_0x885f('0xb3')](_0x885f('0xb8'),'LUMENVOX_ASR_INSTANCE');if(_0xa4e16a[_0x885f('0xa6')]===-0x1){return _0xa4e16a;}return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0xba'),_0x48a338));};AGIVertices[_0x885f('0x14')]['sestekasr']=function(_0x541fe2){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0xcf'),_0x541fe2['label']));if(!this[_0x885f('0xa7')](_0x541fe2[_0x885f('0xb2')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xb1'));}var _0x44169a=_0x541fe2[_0x885f('0xb2')];if(this[_0x885f('0xa7')](_0x541fe2['options'])){_0x44169a+=','+_0x541fe2[_0x885f('0x7d')];}var _0x47aced=this[_0x885f('0x11')]['exec'](_0x885f('0xd0'),_0x44169a);if(_0x47aced[_0x885f('0xa6')]===-0x1){return _0x47aced;}var _0x75843c=this[_0x885f('0xb3')](_0x885f('0xb4'),_0x885f('0xd1'));if(_0x75843c[_0x885f('0xa6')]===-0x1){return _0x75843c;}var _0x3083ed=this[_0x885f('0xb3')]('RECOG_INPUT()',_0x885f('0xd2'));if(_0x3083ed[_0x885f('0xa6')]===-0x1){return _0x3083ed;}var _0x2a85d9=this[_0x885f('0xb3')](_0x885f('0xb8'),_0x885f('0xd3'));if(_0x2a85d9['result']===-0x1){return _0x2a85d9;}return this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')]('Executed\x20command\x20MRCPRecog\x20%s',_0x44169a));};AGIVertices[_0x885f('0x14')]['database']=function(_0x3eae86){logger[_0x885f('0x33')](util['format'](_0x885f('0xd4'),_0x3eae86[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x3eae86['odbc_id'])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x3eae86,_0x885f('0xd5'));}var _0x23be16=this[_0x885f('0x1e')]['sync'](this,_0x3eae86['odbc_id']);if(!_0x23be16){return this[_0x885f('0x11')][_0x885f('0x53')](_0x3eae86,_0x885f('0xd6'));}if(!this[_0x885f('0xa7')](_0x3eae86[_0x885f('0x34')])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x3eae86,_0x885f('0xd7'));}var _0x371ce6=_0x3eae86[_0x885f('0x34')][_0x885f('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')]('query:\x20%s',_0x371ce6));var _0x2c0118=this[_0x885f('0x30')][_0x885f('0x73')](this,_0x23be16,_0x371ce6);this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x3eae86,_0x371ce6);if(!this[_0x885f('0xa7')](_0x3eae86[_0x885f('0xd8')])){return this['channel'][_0x885f('0xac')](_0x885f('0xd9'));}var _0x1a72e0=this['getVariable']['sync'](this,_0x3eae86[_0x885f('0xd8')]);if(!_0x1a72e0){return this[_0x885f('0x11')]['error'](_0x3eae86,_0x885f('0xda'));}var _0x4bd26b=this;_0x2c0118[_0x885f('0xdb')](function(_0x5a32cf,_0x5bfba9){Object[_0x885f('0xdc')](_0x5a32cf)[_0x885f('0xdb')](function(_0x36788b){_0x4bd26b['channel']['setVariable'](util['format'](_0x885f('0xdd'),_0x1a72e0,_0x5bfba9,_0x36788b),_0x5a32cf[_0x36788b]);});});this[_0x885f('0x11')][_0x885f('0xa2')](util[_0x885f('0x2f')]('%s_ROWS_COUNT',_0x1a72e0),_0x2c0118[_0x885f('0x9f')]);return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0xde'),_0x1a72e0));};AGIVertices['prototype']['dial']=function(_0x24b8f0){logger[_0x885f('0xdf')](util[_0x885f('0x2f')](_0x885f('0xe0'),_0x24b8f0[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x24b8f0['sip_id'])){return this[_0x885f('0x11')]['error'](_0x24b8f0,_0x885f('0xe1'));}var _0x2e5d5e=this[_0x885f('0x21')][_0x885f('0x73')](this,_0x24b8f0['sip_id']);if(!_0x2e5d5e){return this[_0x885f('0x11')][_0x885f('0x53')](_0x24b8f0,_0x885f('0xe2'));}var _0x5bda1a=this[_0x885f('0x11')][_0x885f('0x5a')](_0x885f('0xe3'),[util['format'](_0x885f('0xe4'),_0x2e5d5e),_0x24b8f0[_0x885f('0x69')],_0x24b8f0[_0x885f('0xe5')],_0x24b8f0[_0x885f('0x67')]]);if(_0x5bda1a[_0x885f('0xa6')]===-0x1){return _0x5bda1a;}return this['channel']['noop'](util['format'](_0x885f('0xe6'),'DIAL'));};AGIVertices[_0x885f('0x14')][_0x885f('0xe7')]=function(_0x2ee96e){logger[_0x885f('0x33')](util['format'](_0x885f('0xe8'),_0x2ee96e['label']));if(!this[_0x885f('0xa7')](_0x2ee96e['key'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xe9'));}if(!this['isConfigured'](_0x2ee96e['text'])){return this['channel'][_0x885f('0xac')](_0x885f('0xad'));}this[_0x885f('0x11')]['bot']=!![];this[_0x885f('0x3b')](_0x2ee96e);this[_0x885f('0x44')](_0x2ee96e['text'],'in','','');this[_0x885f('0x11')][_0x885f('0xac')](util['format'](_0x885f('0xea'),_0x2ee96e[_0x885f('0x5f')]));var _0x466859=this[_0x885f('0x7e')][_0x885f('0x73')](this,_0x2ee96e);if(_0x466859){for(var _0x87b2af in _0x466859){if(_0x466859[_0x885f('0x98')](_0x87b2af)){this[_0x885f('0x11')][_0x885f('0xa2')](util[_0x885f('0x2f')](_0x885f('0xeb'),_0x87b2af[_0x885f('0x6d')]()),_0x466859[_0x87b2af]);}}this[_0x885f('0x44')](_0x466859[_0x885f('0xec')],_0x885f('0xed'),'dialogflow','');return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0xee'),_0x466859[_0x885f('0xec')]));}return this[_0x885f('0x11')][_0x885f('0x53')](_0x2ee96e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x885f('0x14')][_0x885f('0xef')]=function(_0x1dd350){logger['info'](util[_0x885f('0x2f')](_0x885f('0xf0'),_0x1dd350[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x1dd350[_0x885f('0x82')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xf1'));}if(!this[_0x885f('0xa7')](_0x1dd350['client_email'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xf2'));}if(!this['isConfigured'](_0x1dd350['private_key'])){return this[_0x885f('0x11')][_0x885f('0xac')]('no\x20private_key\x20configured');}if(!this[_0x885f('0xa7')](_0x1dd350[_0x885f('0xf3')])){return this[_0x885f('0x11')]['noop'](_0x885f('0xf4'));}if(!this['isConfigured'](_0x1dd350[_0x885f('0x5f')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xad'));}this[_0x885f('0x11')][_0x885f('0xf5')]=!![];this[_0x885f('0x3b')](_0x1dd350);this[_0x885f('0x44')](_0x1dd350[_0x885f('0x5f')],'in','','');this[_0x885f('0x11')]['noop'](util['format'](_0x885f('0xf6'),_0x1dd350['text']));var _0x2943fb=this[_0x885f('0x81')][_0x885f('0x73')](this,_0x1dd350);if(_0x2943fb){for(var _0x2f70af in _0x2943fb){if(_0x2943fb[_0x885f('0x98')](_0x2f70af)){if(_0x2f70af!==_0x885f('0xf7')){this[_0x885f('0x11')][_0x885f('0xa2')](util[_0x885f('0x2f')](_0x885f('0xeb'),_0x2f70af[_0x885f('0x6d')]()),_0x2943fb[_0x2f70af]);}}}this['createSquareMessage'](_0x2943fb['speech'],_0x885f('0xed'),_0x885f('0xef'),_0x2943fb[_0x885f('0xf7')]);return this['channel'][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0xf8'),_0x2943fb[_0x885f('0xec')]));}return this[_0x885f('0x11')][_0x885f('0x53')](_0x1dd350,_0x885f('0xf9'));};AGIVertices['prototype'][_0x885f('0xfa')]=function(_0x2435d3){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0xfb'),_0x2435d3[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x2435d3[_0x885f('0xfc')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xfd'));}if(!this['isConfigured'](_0x2435d3[_0x885f('0xfe')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xff'));}if(!this['isConfigured'](_0x2435d3[_0x885f('0x100')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x101'));}if(!this[_0x885f('0xa7')](_0x2435d3[_0x885f('0x102')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xad'));}this['channel'][_0x885f('0xf5')]=!![];this['createSquareDetailsReport'](_0x2435d3);this[_0x885f('0x44')](_0x2435d3['text'],'in','','');this['channel'][_0x885f('0xac')](util['format'](_0x885f('0x103'),_0x2435d3[_0x885f('0x5f')]));var _0x7d17db=this['sestekNDA']['sync'](this,_0x2435d3);if(_0x7d17db){for(var _0x36cabd in _0x7d17db){if(_0x7d17db[_0x885f('0x98')](_0x36cabd)){this[_0x885f('0x11')][_0x885f('0xa2')](util['format'](_0x885f('0x104'),_0x36cabd[_0x885f('0x6d')]()),_0x7d17db[_0x36cabd]);}}this[_0x885f('0x44')](_0x7d17db[_0x885f('0xec')],_0x885f('0xed'),_0x885f('0xfa'),'');if(_0x7d17db[_0x885f('0x105')]){this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x7d17db[_0x885f('0x105')]));var _0x1e62cf=this[_0x885f('0x11')][_0x885f('0x106')](_0x7d17db['audiofile']);try{fs['unlink'](_0x7d17db[_0x885f('0x105')]+_0x885f('0x107'));}catch(_0x4807ec){logger[_0x885f('0x53')](_0x4807ec);}return _0x1e62cf;}else{return this['channel'][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x108'),_0x7d17db[_0x885f('0xec')]));}}return this['channel'][_0x885f('0x53')](_0x2435d3,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x885f('0x14')]['end']=function(_0x2c3b75){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x2c3b75[_0x885f('0xab')]));return this[_0x885f('0x11')]['noop']('end');};AGIVertices[_0x885f('0x14')][_0x885f('0x109')]=function(_0x79be53){logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x79be53['label']));var _0x2e2675='';if(_0x79be53[_0x885f('0x10a')]){if(!this[_0x885f('0xa7')](_0x79be53['trunk_id'])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x79be53,_0x885f('0x10b'));}else{var _0x4dd3c7=parseInt(_0x79be53['trunk_id'],0xa);if(isNaN(_0x4dd3c7)){_0x2e2675=_0x79be53[_0x885f('0x10a')];}else{_0x2e2675=this[_0x885f('0x23')][_0x885f('0x73')](this,_0x79be53['trunk_id']);if(!_0x2e2675){return this[_0x885f('0x11')][_0x885f('0x53')](_0x79be53,_0x885f('0x10c'));}}}}else if(_0x79be53['trunk_name']){_0x2e2675=_0x79be53[_0x885f('0x10d')];}else{return this[_0x885f('0x11')]['error'](_0x79be53,_0x885f('0x10b'));}var _0x21624e=this[_0x885f('0x11')][_0x885f('0x5a')](_0x885f('0xe3'),[util[_0x885f('0x2f')]('SIP/%s/%s',_0x2e2675,_0x79be53[_0x885f('0x4a')]),_0x79be53['timeout'],_0x79be53[_0x885f('0xe5')],_0x79be53[_0x885f('0x67')]]);if(_0x21624e[_0x885f('0xa6')]===-0x1){return _0x21624e;}return this['channel']['noop'](util[_0x885f('0x2f')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x885f('0x14')]['finally']=function(_0x4346fa){logger[_0x885f('0x33')](util['format'](_0x885f('0x10e'),_0x4346fa[_0x885f('0xab')]));return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x10f'));};AGIVertices[_0x885f('0x14')][_0x885f('0xf')]=function(_0x2f12dd){logger['info'](util[_0x885f('0x2f')](_0x885f('0x110'),_0x2f12dd[_0x885f('0xab')]));if(_0x2f12dd[_0x885f('0xa8')]===0x0){return this[_0x885f('0xa9')](_0x2f12dd);}_0x2f12dd[_0x885f('0xa8')]-=0x1;if(!this[_0x885f('0xa7')](_0x2f12dd['file_id'])){return this[_0x885f('0x11')]['error'](_0x2f12dd,_0x885f('0x111'));}var _0x26a9c2=this[_0x885f('0x112')]['sync'](this,_0x2f12dd[_0x885f('0x113')]);if(!_0x26a9c2){return this['channel'][_0x885f('0x53')](_0x2f12dd,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x2f12dd[_0x885f('0xd8')])){return this['channel'][_0x885f('0x53')](_0x885f('0xd9'));}var _0x4af698=this[_0x885f('0x11')][_0x885f('0x114')](_0x26a9c2,_0x2f12dd['response'],_0x2f12dd['maxdigit']);var _0xda18d1=_0x4af698[_0x885f('0xa6')]?_0x4af698[_0x885f('0xa6')][_0x885f('0x4e')]():'';logger[_0x885f('0x33')](_0x885f('0x115'),JSON[_0x885f('0x76')](_0x4af698));if(_0x4af698[_0x885f('0xa6')]===-0x1){this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x2f12dd,_0xda18d1);return _0x4af698;}else if(_0x4af698[_0x885f('0xa5')]==='timeout'){_0x4af698['result']=_0xda18d1[_0x885f('0x9f')]>=parseInt(_0x2f12dd[_0x885f('0x116')])?'x':'i';}else{_0x4af698['result']=_0xda18d1['length']>=parseInt(_0x2f12dd[_0x885f('0x116')])&&_0xda18d1[_0x885f('0x9f')]<=parseInt(_0x2f12dd[_0x885f('0x117')])?'x':'i';}var _0x3fb3e8=this['getVariable'][_0x885f('0x73')](this,_0x2f12dd[_0x885f('0xd8')]);if(!_0x3fb3e8){return this[_0x885f('0x11')]['error'](_0x2f12dd,'no\x20variable\x20found');}this[_0x885f('0x11')]['setVariable'](_0x3fb3e8,_0xda18d1);if(this['isConfigured'](_0x2f12dd[_0x885f('0x118')])){var _0x58ce02=parseInt(_0x2f12dd[_0x885f('0x118')],0xa);var _0x2fa970=rs['generate']({'charset':'*','length':_0x58ce02});var _0x2d9f8f=_0xda18d1['length'];if(_0x2d9f8f>0x0){if(_0x2d9f8f>_0x58ce02){this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x2f12dd,_0x2f12dd['hiddendigitspos']==='first'?_0x2fa970+_0xda18d1[_0x885f('0x119')](_0x58ce02):_0xda18d1[_0x885f('0x119')](0x0,_0x2d9f8f-_0x58ce02)+_0x2fa970);}else{this[_0x885f('0x3b')]['sync'](this,_0x2f12dd,rs['generate']({'charset':'*','length':_0x2d9f8f}));}}else{this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x2f12dd,'');}}else{this['createSquareDetailsReport'][_0x885f('0x73')](this,_0x2f12dd,_0xda18d1);}return _0x4af698;};AGIVertices['prototype'][_0x885f('0x10')]=function(_0x224187){logger['info'](util[_0x885f('0x2f')](_0x885f('0x11a'),_0x224187['label']));return this[_0x885f('0xf')](_0x224187);};AGIVertices['prototype']['goal']=function(_0x2d273e){logger['info'](util[_0x885f('0x2f')](_0x885f('0x11b'),_0x2d273e['label']));this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x2d273e,_0x2d273e[_0x885f('0x11c')]);return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')]('GOAL\x20%s',_0x2d273e[_0x885f('0x11c')]));};AGIVertices['prototype'][_0x885f('0x11d')]=function(_0x1e89b9){logger[_0x885f('0x33')](util['format'](_0x885f('0x11e'),_0x1e89b9[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x1e89b9[_0x885f('0x8b')])||!this[_0x885f('0xa7')](_0x1e89b9[_0x885f('0x8c')])){return this[_0x885f('0x11')]['noop'](_0x885f('0x11f'));}if(!this[_0x885f('0xa7')](_0x1e89b9[_0x885f('0x5f')])){return this[_0x885f('0x11')]['noop']('no\x20text\x20configured');}this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')]('Trying\x20aws\x20Polly\x20%s',_0x1e89b9[_0x885f('0x5f')]));var _0x254849=this[_0x885f('0x8a')][_0x885f('0x73')](this,_0x1e89b9);if(_0x254849){this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x120'),_0x254849));var _0x156d56=this[_0x885f('0x11')][_0x885f('0x106')](_0x254849);try{fs[_0x885f('0x121')](_0x254849+_0x885f('0x107'));}catch(_0x240a38){logger['error'](_0x240a38);}return _0x156d56;}return this[_0x885f('0x11')][_0x885f('0x53')](_0x1e89b9,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x885f('0x14')][_0x885f('0x122')]=function(_0x5b62e6){logger[_0x885f('0x33')](util['format'](_0x885f('0x123'),_0x5b62e6['label']));if(!this['isConfigured'](_0x5b62e6['aws_access_key_id'])||!this[_0x885f('0xa7')](_0x5b62e6[_0x885f('0x8c')])){return this['channel'][_0x885f('0xac')](_0x885f('0x11f'));}if(!this[_0x885f('0xa7')](_0x5b62e6['aws_bot_name'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x124'));}if(!this['isConfigured'](_0x5b62e6[_0x885f('0x5f')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xad'));}this[_0x885f('0x11')][_0x885f('0xf5')]=!![];this[_0x885f('0x3b')](_0x5b62e6);this[_0x885f('0x44')](_0x5b62e6['text'],'in','','');this[_0x885f('0x11')][_0x885f('0xac')](util['format'](_0x885f('0x125'),_0x5b62e6[_0x885f('0x5f')]));var _0x54e62a=this[_0x885f('0x90')]['sync'](this,_0x5b62e6);if(_0x54e62a){for(var _0x1ed17e in _0x54e62a){if(_0x54e62a['hasOwnProperty'](_0x1ed17e)&&_['isString'](_0x54e62a[_0x1ed17e])){this[_0x885f('0x11')][_0x885f('0xa2')](util['format'](_0x885f('0x126'),_0x1ed17e[_0x885f('0x6d')]()),_0x54e62a[_0x1ed17e]);}}if(_['isNil'](_0x54e62a[_0x885f('0x7b')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x127'));}else{this[_0x885f('0x44')](_0x54e62a[_0x885f('0x7b')],_0x885f('0xed'),_0x885f('0x128'),'');return this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0x129'),_0x54e62a[_0x885f('0x7b')]));}}return this['channel'][_0x885f('0x53')](_0x5b62e6,_0x885f('0x12a'));};AGIVertices['prototype'][_0x885f('0x12b')]=function(_0x425ba5){logger['info'](util[_0x885f('0x2f')](_0x885f('0x12c'),_0x425ba5[_0x885f('0xab')],_0x425ba5[_0x885f('0x69')]));if(!this['isConfigured'](_0x425ba5[_0x885f('0x7f')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xe9'));}var _0x3bb2d4=_0x885f('0x12d');var _0x2455e6=util['format'](_0x885f('0x12e'),FILES_PATH,rs[_0x885f('0x12f')](0x4));var _0x150745=util[_0x885f('0x2f')](_0x885f('0xa1'),_0x2455e6,_0x3bb2d4);var _0x37ba38=!![];if(_0x425ba5[_0x885f('0x130')]===_0x885f('0x131')){_0x37ba38=![];}var _0x11f7ae=this[_0x885f('0x11')][_0x885f('0x132')](_0x2455e6,_0x3bb2d4,_0x425ba5['intKey'],_0x425ba5[_0x885f('0x69')],undefined,_0x37ba38);if(_0x11f7ae[_0x885f('0xa6')]!==-0x1){this['channel'][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x133'),_0x150745));var _0x173df0=this['googleASR'][_0x885f('0x73')](this,_0x425ba5,_0x150745);if(_0x173df0){for(var _0x48260b in _0x173df0){if(_0x173df0[_0x885f('0x98')](_0x48260b)){this[_0x885f('0x11')][_0x885f('0xa2')](util[_0x885f('0x2f')](_0x885f('0x134'),_0x48260b[_0x885f('0x6d')]()),_0x173df0[_0x48260b]);}}return this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0x135'),JSON[_0x885f('0x76')](_0x173df0)));}}return _0x11f7ae;};AGIVertices['prototype'][_0x885f('0x136')]=function(_0x11ede4){logger[_0x885f('0x33')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x11ede4[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x11ede4[_0x885f('0x94')])){return this[_0x885f('0x11')]['noop'](_0x885f('0x137'));}if(!this[_0x885f('0xa7')](_0x11ede4[_0x885f('0x95')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x138'));}var _0x50e1d4='wav';var _0x5c29f5=util['format'](_0x885f('0x12e'),FILES_PATH,rs[_0x885f('0x12f')](0x4));var _0xfba930=util[_0x885f('0x2f')](_0x885f('0xa1'),_0x5c29f5,_0x50e1d4);var _0x329cdc=!![];if(_0x11ede4['beep']===_0x885f('0x131')){_0x329cdc=![];}var _0x1374cc=this[_0x885f('0x11')][_0x885f('0x132')](_0x5c29f5,_0x50e1d4,_0x11ede4[_0x885f('0x139')],_0x11ede4['timeout'],undefined,_0x329cdc);if(_0x1374cc[_0x885f('0xa6')]!==-0x1){this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')]('tilde\x20%s\x20file\x20created',_0xfba930));var _0xc9c3c0=this[_0x885f('0x93')][_0x885f('0x73')](this,_0x11ede4,_0xfba930);if(_0xc9c3c0){for(var _0xa11023 in _0xc9c3c0){if(_0xc9c3c0[_0x885f('0x98')](_0xa11023)){this[_0x885f('0x11')]['setVariable'](util[_0x885f('0x2f')](_0x885f('0x13a'),_0xa11023[_0x885f('0x6d')]()),_0xc9c3c0[_0xa11023]);}}return this[_0x885f('0x11')][_0x885f('0xac')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x885f('0x76')](_0xc9c3c0)));}}return _0x1374cc;};AGIVertices['prototype']['gotoc']=function(_0x293d9e){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x13b'),_0x293d9e[_0x885f('0xab')]));return this['channel'][_0x885f('0x13c')](_0x293d9e['context'],_0x293d9e[_0x885f('0x41')],_0x293d9e['priority']);};AGIVertices['prototype']['gotoif']=function(_0x242bfe){logger[_0x885f('0x33')](util['format'](_0x885f('0x13d'),_0x242bfe['label']));if(!this[_0x885f('0xa7')](_0x242bfe[_0x885f('0x13e')])){return this[_0x885f('0x11')]['error'](_0x242bfe,_0x885f('0x13f'));}try{var _0xedfb4a=eval(_0x242bfe[_0x885f('0x13e')])?_0x885f('0x140'):_0x885f('0x141');this['channel'][_0x885f('0xac')](util['format'](_0x885f('0x142'),_0x242bfe[_0x885f('0x13e')],_0xedfb4a));return{'code':0xc8,'result':_0xedfb4a};}catch(_0x30dc40){return{'code':0xc8,'result':_0x885f('0x141')};}};AGIVertices['prototype']['gotoiftime']=function(_0x3eb106){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x143'),_0x3eb106[_0x885f('0xab')]));if(!this['isConfigured'](_0x3eb106[_0x885f('0x144')])){return this['channel'][_0x885f('0x53')](_0x3eb106,_0x885f('0x145'));}var _0x2432bb=this[_0x885f('0x146')]['sync'](this,_0x3eb106[_0x885f('0x144')]);if(!_0x2432bb){return this[_0x885f('0x11')]['error'](_0x3eb106,'no\x20intervals\x20found');}for(var _0x5e7e6a=0x0;_0x5e7e6a<_0x2432bb[_0x885f('0x9f')];_0x5e7e6a+=0x1){var _0x3df930=this['channel'][_0x885f('0x15')](util['format']('IFTIME(%s?true:false)',_0x2432bb[_0x5e7e6a]));if(_0x3df930[_0x885f('0xa6')]===-0x1){return _0x3df930;}logger[_0x885f('0x33')](util[_0x885f('0x2f')]('IFTIME\x20%s\x20%s',_0x2432bb[_0x5e7e6a],_0x3df930['extra']));if(_0x3df930[_0x885f('0xa5')]===_0x885f('0x140')){logger['info'](util[_0x885f('0x2f')](_0x885f('0x147'),_0x2432bb[_0x5e7e6a],_0x885f('0x140')));this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x147'),_0x2432bb[_0x5e7e6a],'true'));return{'code':0xc8,'result':_0x885f('0x140')};}else{logger[_0x885f('0x33')](util[_0x885f('0x2f')]('IFTIME\x20%s\x20%s',_0x2432bb[_0x5e7e6a],_0x885f('0x141')));this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0x147'),_0x2432bb[_0x5e7e6a],_0x885f('0x141')));}}return{'code':0xc8,'result':_0x885f('0x141')};};AGIVertices[_0x885f('0x14')]['hangup']=function(_0x5e43cb){logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5e43cb[_0x885f('0xab')]));return this[_0x885f('0x11')][_0x885f('0x148')]();};AGIVertices[_0x885f('0x14')][_0x885f('0x149')]=function(_0x537d0b){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x14a'),_0x537d0b[_0x885f('0xab')]));if(!this['isConfigured'](_0x537d0b[_0x885f('0x7f')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xe9'));}var _0xa9d163='wav';var _0xb230a5=util[_0x885f('0x2f')](_0x885f('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x57a2e5=util[_0x885f('0x2f')]('%s.%s',_0xb230a5,_0xa9d163);var _0x282150=!![];if(_0x537d0b['beep']===_0x885f('0x131')){_0x282150=![];}var _0x20f444=this[_0x885f('0x11')][_0x885f('0x132')](_0xb230a5,_0xa9d163,_0x537d0b[_0x885f('0x139')],_0x537d0b[_0x885f('0x69')],undefined,_0x282150);if(_0x20f444['result']!==-0x1){this['channel'][_0x885f('0xac')](util['format'](_0x885f('0x14b'),_0x57a2e5));var _0x318493=this['ispeechASR'][_0x885f('0x73')](this,_0x537d0b,_0x57a2e5);if(_0x318493){for(var _0x37c4c5 in _0x318493){if(_0x318493[_0x885f('0x98')](_0x37c4c5)){this[_0x885f('0x11')][_0x885f('0xa2')](util[_0x885f('0x2f')]('ISPEECH_ASR_%s',_0x37c4c5['toUpperCase']()),_0x318493[_0x37c4c5]);}}return this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0x14c'),JSON[_0x885f('0x76')](_0x318493)));}}return _0x20f444;};AGIVertices[_0x885f('0x14')]['ispeechtts']=function(_0x18eedf){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x14d'),_0x18eedf[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x18eedf[_0x885f('0x7f')])){return this[_0x885f('0x11')]['noop'](_0x885f('0xe9'));}if(!this['isConfigured'](_0x18eedf['text'])){return this[_0x885f('0x11')]['noop'](_0x885f('0xad'));}this['channel']['noop'](util[_0x885f('0x2f')](_0x885f('0x14e'),_0x18eedf[_0x885f('0x5f')]));var _0x331c0f=this[_0x885f('0x85')][_0x885f('0x73')](this,_0x18eedf);if(_0x331c0f){this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')]('ispeech\x20%s\x20file\x20created',_0x331c0f));var _0x4e5737=this[_0x885f('0x11')]['streamFile'](_0x331c0f,_0x18eedf[_0x885f('0x139')]);try{fs[_0x885f('0x121')](_0x331c0f+'.wav');}catch(_0x5d6a0e){logger[_0x885f('0x53')](_0x5d6a0e);}return _0x4e5737;}return this[_0x885f('0x11')]['error'](_0x18eedf,_0x885f('0x14f'));};AGIVertices[_0x885f('0x14')]['login']=function(_0x2e0146){logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2e0146[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x2e0146[_0x885f('0x150')])){return this['channel'][_0x885f('0x53')](_0x2e0146,_0x885f('0x151'));}logger['info'](util[_0x885f('0x2f')](_0x885f('0x152'),this['channel'][_0x885f('0x3f')],_0x2e0146[_0x885f('0x150')]));var _0x18e135=this['agentLogin']['sync'](this,_0x2e0146[_0x885f('0x150')]);if(_0x18e135){logger['info'](util[_0x885f('0x2f')](_0x885f('0x153'),this['channel']['callerid'],_0x2e0146[_0x885f('0x150')]));this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x153'),this[_0x885f('0x11')]['callerid'],_0x2e0146[_0x885f('0x150')]));return{'code':0xc8,'result':_0x885f('0x154')};}else{logger['info'](util[_0x885f('0x2f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x885f('0x11')][_0x885f('0x3f')],_0x2e0146[_0x885f('0x150')]));this['channel'][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x155'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x2e0146[_0x885f('0x150')]));return{'code':0xc8,'result':_0x885f('0x156')};}};AGIVertices[_0x885f('0x14')][_0x885f('0x157')]=function(_0x27f850){logger[_0x885f('0x33')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x27f850[_0x885f('0xab')]));if(!this['isConfigured'](_0x27f850[_0x885f('0x150')])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x27f850,'no\x20find\x20by\x20configured');}logger[_0x885f('0x33')](util[_0x885f('0x2f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x885f('0x3f')],_0x27f850['findBy']));var _0x2aa77b=this[_0x885f('0x55')][_0x885f('0x73')](this,_0x27f850['findBy']);if(_0x2aa77b){logger['info'](util[_0x885f('0x2f')](_0x885f('0x153'),this[_0x885f('0x11')]['callerid'],_0x27f850[_0x885f('0x150')]));this[_0x885f('0x11')][_0x885f('0xac')](util['format'](_0x885f('0x153'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x27f850[_0x885f('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x885f('0x33')](util['format'](_0x885f('0x155'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x27f850[_0x885f('0x150')]));this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x155'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x27f850[_0x885f('0x150')]));return{'code':0xc8,'result':_0x885f('0x156')};}};AGIVertices[_0x885f('0x14')][_0x885f('0x158')]=function(_0x2b6255){logger[_0x885f('0x33')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2b6255[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x2b6255[_0x885f('0x159')])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x2b6255,_0x885f('0x15a'));}this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x15b'),_0x2b6255[_0x885f('0x159')]));var _0x11b8eb=eval(_0x2b6255[_0x885f('0x159')]);if(!this[_0x885f('0xa7')](_0x2b6255[_0x885f('0xd8')])){return this['channel']['noop'](_0x885f('0xd9'));}var _0x2eb9cd=this[_0x885f('0x15')][_0x885f('0x73')](this,_0x2b6255[_0x885f('0xd8')]);if(!_0x2eb9cd){return this[_0x885f('0x11')][_0x885f('0x53')](_0x2b6255,_0x885f('0xda'));}if(_[_0x885f('0x9e')](_0x11b8eb)){var _0x5eaf88=this;_0x11b8eb['forEach'](function(_0xde7a65,_0x2a6758){_0x5eaf88['channel'][_0x885f('0xa2')](util[_0x885f('0x2f')]('%s[%s]',_0x2eb9cd,_0x2a6758),_0xde7a65);});return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')]('variable\x20%s[key]\x20set',_0x2eb9cd));}else{return this[_0x885f('0x11')][_0x885f('0xa2')](_0x2eb9cd,_0x11b8eb);}};AGIVertices['prototype']['menu']=function(_0x55203){logger[_0x885f('0x33')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x55203[_0x885f('0xab')]));if(_0x55203[_0x885f('0xa8')]===0x0){return this[_0x885f('0xa9')](_0x55203);}_0x55203[_0x885f('0xa8')]-=0x1;if(!this[_0x885f('0xa7')](_0x55203[_0x885f('0x113')])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x55203,_0x885f('0x111'));}var _0x5e45a7=this[_0x885f('0x112')][_0x885f('0x73')](this,_0x55203[_0x885f('0x113')]);if(!_0x5e45a7){return this['channel']['error'](_0x55203,_0x885f('0x15c'));}var _0x3266ac=this[_0x885f('0x11')][_0x885f('0x114')](_0x5e45a7,_0x55203['response'],_0x55203['digit']);var _0x28eaac=_0x3266ac[_0x885f('0xa6')];if(_0x3266ac[_0x885f('0xa6')]===-0x1){this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x55203,'-1');return _0x3266ac;}else if(_0x3266ac['extra']===_0x885f('0x69')){_0x3266ac[_0x885f('0xa6')]=_0x3266ac[_0x885f('0xa6')][_0x885f('0x9f')]>0x0?_0x3266ac[_0x885f('0xa6')]:'t';}else if(_['isEmpty'](_0x3266ac[_0x885f('0xa6')])){_0x3266ac[_0x885f('0xa6')]='#';_0x28eaac='#';}if(!this[_0x885f('0xa7')](_0x55203[_0x885f('0xd8')])){this[_0x885f('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1eacbd=this['getVariable'][_0x885f('0x73')](this,_0x55203['variable_id']);if(!_0x1eacbd){return this[_0x885f('0x11')][_0x885f('0x53')](_0x55203,_0x885f('0xda'));}this['channel'][_0x885f('0xa2')](_0x1eacbd,_0x28eaac);}this['createSquareDetailsReport']['sync'](this,_0x55203,_0x28eaac);return _0x3266ac;};AGIVertices['prototype'][_0x885f('0xac')]=function(_0x470261){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x15d'),_0x470261['label']));return this[_0x885f('0x11')][_0x885f('0xac')](_0x470261[_0x885f('0x15e')]||_0x470261['label']);};AGIVertices['prototype']['pause']=function(_0x17df48){logger['info'](util['format'](_0x885f('0x15f'),_0x17df48[_0x885f('0xab')]));if(!this['isConfigured'](_0x17df48[_0x885f('0x150')])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x17df48,_0x885f('0x151'));}logger[_0x885f('0x33')](util['format'](_0x885f('0x152'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x17df48['findBy']));var _0xf09304=this[_0x885f('0x4f')][_0x885f('0x73')](this,_0x17df48[_0x885f('0x160')]);var _0x81e9a4=this[_0x885f('0x51')]['sync'](this,_0x17df48['findBy'],_0xf09304);if(_0x81e9a4){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x153'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x17df48['findBy']));this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0x153'),this['channel'][_0x885f('0x3f')],_0x17df48[_0x885f('0x150')]));return{'code':0xc8,'result':_0x885f('0x154')};}else{logger[_0x885f('0x33')](util[_0x885f('0x2f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x885f('0x11')]['callerid'],_0x17df48[_0x885f('0x150')]));this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x153'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x17df48['findBy']));return{'code':0xc8,'result':_0x885f('0x156')};}};AGIVertices[_0x885f('0x14')][_0x885f('0x161')]=function(_0x34a036){logger[_0x885f('0x33')](util['format'](_0x885f('0x162'),_0x34a036[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x34a036[_0x885f('0x113')])){return this['channel'][_0x885f('0x53')](_0x34a036,_0x885f('0x111'));}var _0x276fae=this[_0x885f('0x112')][_0x885f('0x73')](this,_0x34a036['file_id']);if(!_0x276fae){return this[_0x885f('0x11')][_0x885f('0x53')](_0x34a036,'no\x20file\x20audio\x20found');}var _0x1461f4=this['channel'][_0x885f('0x5a')](_0x885f('0x163'),[_0x276fae,_0x34a036[_0x885f('0xe5')]]);if(_0x1461f4['result']===-0x1){return _0x1461f4;}return this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0x164'),_0x885f('0x163'),_0x276fae));};AGIVertices[_0x885f('0x14')][_0x885f('0x165')]=function(_0x489655){logger['info'](util[_0x885f('0x2f')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x489655['label']));if(!this[_0x885f('0xa7')](_0x489655['queue_id'])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x489655,_0x885f('0x166'));}var _0x549545='';var _0xd5fa82=parseInt(_0x489655[_0x885f('0x167')],0xa);if(isNaN(_0xd5fa82)){_0x549545=_0x489655['queue_id'];}else{_0x549545=this[_0x885f('0x18')][_0x885f('0x73')](this,_0x489655['queue_id']);if(!_0x549545){return this[_0x885f('0x11')]['error'](_0x489655,_0x885f('0x168'));}}var _0xfe9cd0='';if(this['isConfigured'](_0x489655['file_id'])){var _0x44c753=this[_0x885f('0x112')][_0x885f('0x73')](this,_0x489655[_0x885f('0x113')]);if(_0x44c753){_0xfe9cd0=_0x44c753;}}this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x489655,_0x549545);if(_0x489655[_0x885f('0xe5')][_0x885f('0x169')]('x')<0x0){_0x489655[_0x885f('0xe5')]+='x';}if(_0x489655['opts'][_0x885f('0x169')]('X')<0x0){_0x489655['opts']+='X';}this[_0x885f('0x11')][_0x885f('0xa2')](_0x885f('0x16a'),_0x549545?_0x549545[_0x885f('0x16b')]():'');var _0x9c8a9=this[_0x885f('0x11')][_0x885f('0x5a')]('QUEUE',[_0x549545,_0x489655[_0x885f('0xe5')],_0x489655[_0x885f('0x67')],_0xfe9cd0,_0x489655[_0x885f('0x69')],_0x489655[_0x885f('0x8')],_0x489655['macro'],_0x489655[_0x885f('0x16c')],'',_0x489655['position']]);if(_0x9c8a9[_0x885f('0xa6')]===-0x1){return _0x9c8a9;}return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x164'),_0x885f('0x16d'),_0x549545));};AGIVertices[_0x885f('0x14')][_0x885f('0x16e')]=function(_0x64cb4c){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x16f'),_0x64cb4c[_0x885f('0xab')]));var _0x4e4f5c=_0x64cb4c[_0x885f('0x170')]||_0x885f('0x12d');var _0x276610=util[_0x885f('0x2f')]('%s_%s',this[_0x885f('0x11')]['uniqueid'],rs[_0x885f('0x12f')](0x5));var _0x226e37=util[_0x885f('0x2f')](_0x885f('0x171'),FILES_PATH,_0x276610,_0x4e4f5c);var _0xa6b761=util[_0x885f('0x2f')](_0x885f('0x12e'),FILES_PATH,_0x276610);this[_0x885f('0x172')][_0x885f('0x73')](this,_0x64cb4c,_0x276610,_0x226e37);this[_0x885f('0x11')][_0x885f('0xa2')](_0x885f('0x173'),_0x276610);logger[_0x885f('0x33')](_0x885f('0x174'),_0xa6b761,_0x4e4f5c,_0x64cb4c['escape_digits'],_0x64cb4c[_0x885f('0x69')]);return this[_0x885f('0x11')][_0x885f('0x132')](_0xa6b761,_0x4e4f5c,_0x64cb4c[_0x885f('0x175')],_0x64cb4c['timeout'],undefined,!![]);};AGIVertices[_0x885f('0x14')][_0x885f('0x176')]=function(_0xb48977){logger['info'](util[_0x885f('0x2f')](_0x885f('0x177'),_0xb48977[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0xb48977['url'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x178'));}var _0x2d90b7=this[_0x885f('0x66')][_0x885f('0x73')](this,_0xb48977);logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Response:',util[_0x885f('0x179')](_0x2d90b7,{'showHidden':![],'depth':null})));if(!this[_0x885f('0xa7')](_0xb48977[_0x885f('0xd8')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x17a'));}var _0x26689b=this[_0x885f('0x15')][_0x885f('0x73')](this,_0xb48977[_0x885f('0xd8')]);if(!_0x26689b){return this[_0x885f('0x11')][_0x885f('0x53')](_0xb48977,'no\x20variable\x20found');}this[_0x885f('0x11')][_0x885f('0xa2')](util['format'](_0x885f('0x17b'),_0x26689b),_0x2d90b7[_0x885f('0x79')]?_0x2d90b7['statusCode']:'200');this[_0x885f('0x11')][_0x885f('0xa2')](util[_0x885f('0x2f')]('%s_STATUS_MESSAGE',_0x26689b),_0x2d90b7[_0x885f('0x7a')]?_0x2d90b7[_0x885f('0x7a')]:'OK');if(_0x2d90b7['body']){try{this[_0x885f('0xa0')](_0x2d90b7[_0x885f('0x77')],_0x26689b);}catch(_0x1d5843){logger['error'](util[_0x885f('0x2f')](_0x885f('0x17c'),_0x26689b));}}return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')]('variable\x20%s\x20set',_0x26689b));};AGIVertices[_0x885f('0x14')]['saydigits']=function(_0x1443ee){logger['info'](util[_0x885f('0x2f')](_0x885f('0x17d'),_0x1443ee[_0x885f('0xab')]));return this[_0x885f('0x11')][_0x885f('0x17e')](_0x1443ee['digits'][_0x885f('0x5c')](/\s+/g,''),_0x1443ee[_0x885f('0x175')]);};AGIVertices[_0x885f('0x14')][_0x885f('0x17f')]=function(_0x32319f){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x180'),_0x32319f[_0x885f('0xab')]));return this['channel'][_0x885f('0x181')](_0x32319f['number'][_0x885f('0x5c')](/\s+/g,''),_0x32319f[_0x885f('0x175')]);};AGIVertices[_0x885f('0x14')][_0x885f('0x182')]=function(_0x10a259){logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x10a259[_0x885f('0xab')]));return this['channel']['sayPhonetic'](_0x10a259[_0x885f('0x5f')],_0x10a259[_0x885f('0x175')]);};AGIVertices['prototype'][_0x885f('0x183')]=function(_0x3c3604){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x184'),_0x3c3604[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x3c3604['account_id'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x185'));}var _0x3f135e=this[_0x885f('0x27')][_0x885f('0x73')](this,_0x3c3604[_0x885f('0x186')]);if(!_0x3f135e||!_0x3f135e[_0x885f('0x187')]){return this[_0x885f('0x11')][_0x885f('0x53')](_0x3c3604,_0x885f('0x188'));}var _0x5c86a6={'from':util[_0x885f('0x2f')]('\x22%s\x22\x20<%s>',_0x3f135e['name'],_0x3f135e['email']||_0x3f135e[_0x885f('0x187')][_0x885f('0x189')]),'to':_0x3c3604['to']||'','cc':_0x3c3604['cc']||'','bcc':_0x3c3604[_0x885f('0x18a')]||'','subject':_0x3c3604[_0x885f('0x18b')],'html':_0x3c3604['text'],'text':_0x3c3604[_0x885f('0x5f')]};if(this[_0x885f('0xa7')](_0x3c3604[_0x885f('0x18c')])){}logger[_0x885f('0xdf')](_0x885f('0x18d'),JSON['stringify'](_0x5c86a6));this[_0x885f('0x3b')]['sync'](this,_0x3c3604,_0x3c3604[_0x885f('0x186')]);this[_0x885f('0x11')][_0x885f('0xac')](util['format'](_0x885f('0x18e'),_0x3f135e['name']));this[_0x885f('0x29')]['sync'](this,_0x3f135e[_0x885f('0x18f')],_0x5c86a6);return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x190'));};AGIVertices[_0x885f('0x14')][_0x885f('0x191')]=function(_0x5ed35b){logger[_0x885f('0x33')](util[_0x885f('0x2f')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5ed35b[_0x885f('0xab')]));return this[_0x885f('0x11')][_0x885f('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x885f('0x14')][_0x885f('0x192')]=function(_0x562f79){logger['info'](util[_0x885f('0x2f')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x562f79[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x562f79['sms_account_id'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x193'));}var _0x85fbac=this['getSmsAccount'][_0x885f('0x73')](this,_0x562f79['sms_account_id']);if(!_0x85fbac){return this[_0x885f('0x11')]['error'](_0x562f79,'no\x20sms\x20account\x20found');}var _0x211e91={'body':_0x562f79[_0x885f('0x194')],'phone':_0x562f79['to']||'','SmsAccountId':_0x85fbac['id']};logger[_0x885f('0xdf')]('sendSMS\x20message',JSON[_0x885f('0x76')](_0x211e91));this['createSquareDetailsReport'][_0x885f('0x73')](this,_0x562f79,_0x562f79['sms_account_id']);this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x195'),_0x85fbac[_0x885f('0x1a')]));this['createSmsMessage']['sync'](this,_0x211e91);return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x196'));};AGIVertices[_0x885f('0x14')][_0x885f('0x197')]=function(_0x5478df){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x198'),_0x5478df[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x5478df[_0x885f('0xd8')])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x5478df,_0x885f('0x199'));}var _0x139869=this[_0x885f('0x15')][_0x885f('0x73')](this,_0x5478df['variable_id']);if(!_0x139869){return this['channel'][_0x885f('0x53')](_0x5478df,_0x885f('0xda'));}return this[_0x885f('0x11')][_0x885f('0xa2')](_0x139869,_0x5478df[_0x885f('0x19a')]);};AGIVertices[_0x885f('0x14')][_0x885f('0x19b')]=function(_0x29080f){logger['info'](util[_0x885f('0x2f')](_0x885f('0x19c'),_0x29080f['label']));this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x19d'));if(_0x29080f[_0x885f('0xbd')]===_0x885f('0x19e')){this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x19f'));return this[_0x885f('0x11')]['answer']();}return this['channel'][_0x885f('0xac')](_0x885f('0x1a0'));};AGIVertices[_0x885f('0x14')][_0x885f('0x1a1')]=function(_0x2fc436){logger['info'](util[_0x885f('0x2f')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2fc436['label']));if(!this[_0x885f('0xa7')](_0x2fc436['project_id'])){return this[_0x885f('0x11')][_0x885f('0x53')](_0x2fc436,_0x885f('0x1a2'));}var _0x46c7be=this[_0x885f('0x1c')][_0x885f('0x73')](this,_0x2fc436['project_id']);if(!this['isConfigured'](_0x46c7be)){return this[_0x885f('0x11')]['error'](_0x2fc436,util[_0x885f('0x2f')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2fc436['project_id']));}if(_0x46c7be===this[_0x885f('0x11')][_0x885f('0x3e')]){return this[_0x885f('0x11')][_0x885f('0x53')](_0x2fc436,_0x885f('0x1a3'));}this[_0x885f('0x3b')][_0x885f('0x73')](this,_0x2fc436,_0x46c7be);var _0x1b3ce9=this[_0x885f('0x11')][_0x885f('0x5a')]('AGI',util[_0x885f('0x2f')](_0x885f('0x1a4'),config[_0x885f('0x8')][_0x885f('0x1a5')]||'127.0.0.1',_0x46c7be,this[_0x885f('0x11')][_0x885f('0x3e')]));if(_0x1b3ce9['result']===-0x1){return _0x1b3ce9;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x885f('0x1a6'),_0x46c7be));};AGIVertices[_0x885f('0x14')]['system']=function(_0x5f094c){logger[_0x885f('0x33')](util['format'](_0x885f('0x1a7'),_0x5f094c[_0x885f('0xab')]));var _0x103654=this['shellCommand'][_0x885f('0x73')](this,_0x5f094c[_0x885f('0xbb')]);this['createSquareDetailsReport']['sync'](this,_0x5f094c,_0x5f094c['command']);if(this[_0x885f('0xa7')](_0x5f094c['variable_id'])){var _0x37a3a6=this['getVariable']['sync'](this,_0x5f094c[_0x885f('0xd8')]);if(_0x37a3a6){this[_0x885f('0x11')][_0x885f('0xa2')](_0x37a3a6,_0x103654);return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x1a8'),_0x5f094c['command'],_0x37a3a6));}}return this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5f094c[_0x885f('0xbb')]));};AGIVertices[_0x885f('0x14')]['google_cloud_tts']=function(_0x4ca8a4){logger[_0x885f('0x33')](util['format'](_0x885f('0x1a9'),_0x4ca8a4[_0x885f('0xab')]));_0x4ca8a4['text']=_0x4ca8a4[_0x885f('0x5f')][_0x885f('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x885f('0xa7')](_0x4ca8a4['apiKey'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0x1aa'));}if(!this[_0x885f('0xa7')](_0x4ca8a4[_0x885f('0x5f')])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xad'));}this[_0x885f('0x11')][_0x885f('0xac')](util['format'](_0x885f('0x1ab'),_0x4ca8a4[_0x885f('0x5f')]));var _0x5ec384=this[_0x885f('0x5d')][_0x885f('0x73')](this,_0x4ca8a4);if(_0x5ec384){this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')](_0x885f('0x1ac'),_0x5ec384));var _0x120833=this['channel']['streamFile'](_0x5ec384);try{fs[_0x885f('0x121')](_0x5ec384+_0x885f('0x107'));}catch(_0x2f98d1){logger[_0x885f('0x53')](_0x2f98d1);}return _0x120833;}return this[_0x885f('0x11')][_0x885f('0x53')](_0x4ca8a4,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x885f('0x14')][_0x885f('0x1ad')]=function(_0x3a045f){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x1ae'),_0x3a045f[_0x885f('0xab')]));_0x3a045f['text']=_0x3a045f['text'][_0x885f('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3a045f['text'])){return this[_0x885f('0x11')][_0x885f('0xac')](_0x885f('0xad'));}this[_0x885f('0x11')][_0x885f('0xac')](util['format'](_0x885f('0x1af'),_0x3a045f[_0x885f('0x5f')]));var _0x3f586c=this['googleTTS']['sync'](this,_0x3a045f);if(_0x3f586c){this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x1b0'),_0x3f586c));var _0xcf0c13=this[_0x885f('0x11')][_0x885f('0x106')](_0x3f586c);try{fs['unlink'](_0x3f586c+_0x885f('0x107'));}catch(_0x168643){logger['error'](_0x168643);}return _0xcf0c13;}return this[_0x885f('0x11')]['error'](_0x3a045f,_0x885f('0x1b1'));};AGIVertices[_0x885f('0x14')]['unpause']=function(_0x10fd40){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x1b2'),_0x10fd40['label']));if(!this[_0x885f('0xa7')](_0x10fd40['findBy'])){return this[_0x885f('0x11')]['error'](_0x10fd40,_0x885f('0x151'));}logger[_0x885f('0x33')](util[_0x885f('0x2f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x885f('0x11')][_0x885f('0x3f')],_0x10fd40[_0x885f('0x150')]));var _0x177226=this[_0x885f('0x54')][_0x885f('0x73')](this,_0x10fd40[_0x885f('0x150')]);if(_0x177226){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x153'),this[_0x885f('0x11')]['callerid'],_0x10fd40[_0x885f('0x150')]));this[_0x885f('0x11')]['noop'](util[_0x885f('0x2f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x885f('0x11')]['callerid'],_0x10fd40[_0x885f('0x150')]));return{'code':0xc8,'result':_0x885f('0x154')};}else{logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x155'),this[_0x885f('0x11')]['callerid'],_0x10fd40['findBy']));this['channel'][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x155'),this[_0x885f('0x11')][_0x885f('0x3f')],_0x10fd40[_0x885f('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x885f('0x14')]['voicemail']=function(_0x384e5d){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x1b3'),_0x384e5d[_0x885f('0xab')]));var _0x8aca26=this[_0x885f('0x11')][_0x885f('0x5a')](_0x885f('0x1b4'),[_0x384e5d[_0x885f('0x1b5')],_0x384e5d['options']]);if(_0x8aca26[_0x885f('0xa6')]===-0x1){return _0x8aca26;}return this[_0x885f('0x11')][_0x885f('0xac')](util[_0x885f('0x2f')](_0x885f('0x164'),_0x885f('0x1b4'),_0x384e5d['mailbox']));};AGIVertices[_0x885f('0x14')]['vswitch']=function(_0x56b268){logger[_0x885f('0x33')](util[_0x885f('0x2f')](_0x885f('0x1b6'),_0x56b268[_0x885f('0xab')]));if(!this[_0x885f('0xa7')](_0x56b268['variable_id'])){return this['channel'][_0x885f('0x53')](_0x56b268,'no\x20variable\x20selected');}var _0x18845c=this[_0x885f('0x15')][_0x885f('0x73')](this,_0x56b268[_0x885f('0xd8')]);if(!_0x18845c){return this[_0x885f('0x11')][_0x885f('0x53')](_0x56b268,_0x885f('0xda'));}var _0x2452ee=this[_0x885f('0x11')][_0x885f('0x15')](_0x18845c);return{'code':0xc8,'result':_0x2452ee[_0x885f('0xa5')]?_0x2452ee['extra']:'-'};};String[_0x885f('0x14')]['replaceAll']=function(_0x362dac,_0x1d509b){return this[_0x885f('0xa3')](_0x362dac)[_0x885f('0x1b7')](_0x1d509b);};module[_0x885f('0x1b8')]=AGIVertices; \ No newline at end of file +var _0xa988=['dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','save_name','mailRpc','sendMailMessage','getIntervalById','interval','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','saveRestApiResult','%s.%s','isArray','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','RECOG_CONFIDENCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','.wav','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','intKey','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','beep','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa988,0x1a7));var _0x8a98=function(_0x25576e,_0x29f37d){_0x25576e=_0x25576e-0x0;var _0x423474=_0xa988[_0x25576e];return _0x423474;};'use strict';var fs=require('fs');var util=require(_0x8a98('0x0'));var _=require(_0x8a98('0x1'));var sh=require(_0x8a98('0x2'));var odbc=require(_0x8a98('0x3'))();var rs=require(_0x8a98('0x4'));var moment=require('moment');var Mustache=require(_0x8a98('0x5'));var rp=require(_0x8a98('0x6'));var logger=require(_0x8a98('0x7'))(_0x8a98('0x8'));var config=require(_0x8a98('0x9'));var shared=require(_0x8a98('0xa'));var scripts=require(_0x8a98('0xb'));var FILES_PATH=_0x8a98('0xc');var recursiveMapAttributes=['rawHeaders',_0x8a98('0xd')];var verticesWithRetry=[_0x8a98('0xe'),'getdigits',_0x8a98('0xf')];var AGIVertices=function(_0x188aea,_0x4e1bb9,_0x5552b2){this[_0x8a98('0x10')]=_0x188aea;this[_0x8a98('0x11')]=_0x4e1bb9;this['mailRpc']=_0x5552b2;};AGIVertices[_0x8a98('0x12')][_0x8a98('0x13')]=function(_0x1f88b0,_0x591b27){this[_0x8a98('0x11')][_0x8a98('0x14')](_0x1f88b0)[_0x8a98('0x15')](function(_0x50fd87){_0x591b27(null,_0x50fd87?_0x50fd87[_0x8a98('0x16')]:![]);})['catch'](function(_0x55dcde){_0x591b27(_0x55dcde);});};AGIVertices['prototype'][_0x8a98('0x17')]=function(_0x4a317f,_0x519e18){this['rpc'][_0x8a98('0x18')](_0x4a317f)['then'](function(_0x28f117){_0x519e18(null,_0x28f117?_0x28f117[_0x8a98('0x16')]:![]);})[_0x8a98('0x19')](function(_0x2d3997){_0x519e18(_0x2d3997);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x1a')]=function(_0x384bec,_0x92a1e8){this['rpc']['getSquareProjectById'](_0x384bec)[_0x8a98('0x15')](function(_0x467317){_0x92a1e8(null,_0x467317?_0x467317['name']:![]);})[_0x8a98('0x19')](function(_0x4c91d6){_0x92a1e8(_0x4c91d6);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x1b')]=function(_0xc9658d,_0xf35f5){this[_0x8a98('0x11')]['getSquareOdbcById'](_0xc9658d)['then'](function(_0x239094){_0xf35f5(null,_0x239094?_0x239094[_0x8a98('0x1c')]:![]);})[_0x8a98('0x19')](function(_0x291d03){_0xf35f5(_0x291d03);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x1d')]=function(_0x3b9b88,_0xde5a55){this[_0x8a98('0x11')][_0x8a98('0x1e')](_0x3b9b88)['then'](function(_0x2c08ae){_0xde5a55(null,_0x2c08ae?_0x2c08ae[_0x8a98('0x16')]:![]);})[_0x8a98('0x19')](function(_0x2576e9){_0xde5a55(_0x2576e9);});};AGIVertices[_0x8a98('0x12')]['getTrunk']=function(_0x1deb61,_0x58f590){this['rpc'][_0x8a98('0x1f')](_0x1deb61)[_0x8a98('0x15')](function(_0x21c720){_0x58f590(null,_0x21c720?_0x21c720[_0x8a98('0x16')]:![]);})[_0x8a98('0x19')](function(_0xfb5806){_0x58f590(_0xfb5806);});};AGIVertices['prototype'][_0x8a98('0x20')]=function(_0x1bcb8c,_0x190578){var _0x5ddb9a=this;this[_0x8a98('0x11')][_0x8a98('0x21')](_0x1bcb8c)[_0x8a98('0x15')](function(_0x2f4aba){_0x190578(null,_0x2f4aba?_0x5ddb9a['getSoundPath'](_0x2f4aba[_0x8a98('0x22')]):![]);})['catch'](function(_0x214172){_0x190578(_0x214172);});};AGIVertices[_0x8a98('0x12')]['getMailAccount']=function(_0xc3e740,_0x292fee){this[_0x8a98('0x11')]['getMailAccountById'](_0xc3e740)[_0x8a98('0x15')](function(_0x15afbd){_0x292fee(null,_0x15afbd?_0x15afbd:![]);})[_0x8a98('0x19')](function(_0x1a9622){_0x292fee(_0x1a9622);});};AGIVertices[_0x8a98('0x12')]['sendMailMessage']=function(_0x56b35d,_0x24ea39,_0x346c61){this[_0x8a98('0x23')][_0x8a98('0x24')](_0x56b35d,_0x24ea39)[_0x8a98('0x15')](function(){_0x346c61(null);})[_0x8a98('0x19')](function(_0x6720e0){_0x346c61(_0x6720e0);});};AGIVertices['prototype']['getIntervals']=function(_0x3bc48d,_0x1f93e3){this[_0x8a98('0x11')][_0x8a98('0x25')](_0x3bc48d)[_0x8a98('0x15')](function(_0x10efd3){if(_0x10efd3){if(_0x10efd3['IntervalId']){_0x1f93e3(null,[_0x10efd3[_0x8a98('0x26')]]);}else{_0x1f93e3(null,_['map'](_0x10efd3[_0x8a98('0x27')],'interval'));}}else{_0x1f93e3(null,![]);}})[_0x8a98('0x19')](function(_0x1d88ea){_0x1f93e3(_0x1d88ea);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x28')]=function(_0x2799a4){return util[_0x8a98('0x29')](_0x8a98('0x2a'),FILES_PATH,_0x2799a4);};AGIVertices['prototype'][_0x8a98('0x2b')]=function(_0x166f42,_0x4f3d4c,_0x39d1a9){odbc[_0x8a98('0x2c')](_0x166f42,function(_0x6cf1ae){if(_0x6cf1ae){logger[_0x8a98('0x2d')](_0x8a98('0x2e'),_0x6cf1ae);_0x39d1a9(_0x6cf1ae);}else{logger['info'](_0x8a98('0x2f'));odbc[_0x8a98('0x30')](_0x4f3d4c,function(_0x278241,_0x1a8ee2){if(_0x278241){logger[_0x8a98('0x31')](_0x8a98('0x32'),_0x4f3d4c);_0x39d1a9(_0x278241);}else{logger['info'](_0x8a98('0x33'),_0x4f3d4c);odbc[_0x8a98('0x34')](function(_0x26afd2){if(_0x26afd2){logger[_0x8a98('0x2d')](_0x8a98('0x35'),_0x26afd2);}_0x39d1a9(null,_0x1a8ee2);});}});}});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x36')]=function(_0x29385f,_0x4e9e82){this[_0x8a98('0x11')]['getSmsAccountById'](_0x29385f)[_0x8a98('0x15')](function(_0x47617b){_0x4e9e82(null,_0x47617b?_0x47617b:![]);})[_0x8a98('0x19')](function(_0x2f450c){_0x4e9e82(_0x2f450c);});};AGIVertices['prototype'][_0x8a98('0x37')]=function(_0x197edc,_0x10b0cc){this[_0x8a98('0x11')][_0x8a98('0x37')](_0x197edc)[_0x8a98('0x15')](function(_0x4c399e){_0x10b0cc(null,_0x4c399e);})[_0x8a98('0x19')](function(_0x100816){_0x10b0cc(_0x100816);});};AGIVertices['prototype'][_0x8a98('0x38')]=function(_0x173105,_0x9d34d7,_0x4d18c9){this['rpc'][_0x8a98('0x38')]({'uniqueid':this[_0x8a98('0x10')]['uniqueid'],'node':_0x173105[_0x8a98('0x39')],'application':_0x173105['agicommand'],'data':_0x9d34d7||null,'project_name':this[_0x8a98('0x10')][_0x8a98('0x3a')],'callerid':this[_0x8a98('0x10')][_0x8a98('0x3b')]})[_0x8a98('0x15')](function(_0xe9fabb){if(_0x4d18c9){_0x4d18c9(null,_0xe9fabb);}})[_0x8a98('0x19')](function(_0x806c7c){if(_0x4d18c9){_0x4d18c9(_0x806c7c);}});};AGIVertices[_0x8a98('0x12')]['createSquareRecording']=function(_0x3125c8,_0x198f40,_0x156d5f,_0x1b7473){this[_0x8a98('0x11')][_0x8a98('0x3c')]({'uniqueid':this['channel'][_0x8a98('0x3d')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0x8a98('0x3e')],'context':this[_0x8a98('0x10')]['context'],'extension':this['channel'][_0x8a98('0x3f')],'priority':this[_0x8a98('0x10')][_0x8a98('0x40')],'accountcode':this[_0x8a98('0x10')]['accountcode'],'dnid':this['channel'][_0x8a98('0x41')],'projectName':this[_0x8a98('0x10')]['arg_1'],'saveName':_0x198f40,'filename':_0x3125c8[_0x8a98('0x42')]||_0x198f40,'savePath':_0x156d5f})[_0x8a98('0x15')](function(_0x5222d8){_0x1b7473(null,_0x5222d8);})[_0x8a98('0x19')](function(_0x2f3b37){_0x1b7473(_0x2f3b37);});};AGIVertices[_0x8a98('0x12')]['createSquareMessage']=function(_0x310a50,_0x5918a9,_0x1056cb,_0x4e66ec,_0x3b4c84){this[_0x8a98('0x11')][_0x8a98('0x43')]({'uniqueid':this[_0x8a98('0x10')][_0x8a98('0x3d')],'body':_0x310a50,'direction':_0x5918a9,'providerName':_0x1056cb,'providerResponse':_0x4e66ec})[_0x8a98('0x15')](function(_0xef0f7a){if(_0x3b4c84){_0x3b4c84(null,_0xef0f7a);}})[_0x8a98('0x19')](function(_0x39be84){if(_0x3b4c84){_0x3b4c84(_0x39be84);}});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x44')]=function(_0x3290d7,_0x25e850){this['rpc'][_0x8a98('0x44')]({'firstName':_[_0x8a98('0x45')](_0x3290d7['name'])||_[_0x8a98('0x46')](_0x3290d7['name'])?_0x8a98('0x47')+Math[_0x8a98('0x48')]():_0x3290d7[_0x8a98('0x16')],'lastName':_[_0x8a98('0x45')](_0x3290d7[_0x8a98('0x49')])||_[_0x8a98('0x46')](_0x3290d7[_0x8a98('0x49')])?null:_0x3290d7[_0x8a98('0x49')],'phone':_0x3290d7[_0x8a98('0x4a')],'ListId':_0x3290d7['list_id'],'scheduledat':_0x3290d7[_0x8a98('0x4b')],'callbackUniqueid':this[_0x8a98('0x10')]['uniqueid'],'tags':_0x8a98('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x3290d7[_0x8a98('0x4b')][_0x8a98('0x4d')](),'priority':_0x3290d7[_0x8a98('0x4e')]})[_0x8a98('0x15')](function(_0x58af81){_0x25e850(null,_0x58af81);})['catch'](function(_0x2cd97b){_0x25e850(_0x2cd97b);});};AGIVertices['prototype'][_0x8a98('0x4f')]=function(_0x281172,_0x24ad38){this['rpc'][_0x8a98('0x50')](_0x281172)[_0x8a98('0x15')](function(_0x147695){_0x24ad38(null,_0x147695?_0x147695[_0x8a98('0x16')]:![]);})[_0x8a98('0x19')](function(_0x47f02d){_0x24ad38(_0x47f02d);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x51')]=function(_0x4dabdf,_0x4b758d,_0xcf5ae8){var _0x4966ed={'role':_0x8a98('0x52')};_0x4966ed[_0x4dabdf]=this[_0x8a98('0x10')][_0x8a98('0x3b')];this[_0x8a98('0x11')][_0x8a98('0x51')](_0x4966ed,_0x4b758d,this['channel']['uniqueid'])[_0x8a98('0x15')](function(_0x144db5){_0xcf5ae8(null,_[_0x8a98('0x46')](_0x144db5)?![]:!![]);})[_0x8a98('0x19')](function(_0x56c0c4){logger[_0x8a98('0x2d')](_0x56c0c4);_0xcf5ae8(null,![]);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x53')]=function(_0x552ec5,_0x20baed){var _0x1e7c06={'role':'agent'};_0x1e7c06[_0x552ec5]=this['channel'][_0x8a98('0x3b')];this[_0x8a98('0x11')][_0x8a98('0x53')](_0x1e7c06)['then'](function(_0x5daaa1){_0x20baed(null,_['isNil'](_0x5daaa1)?![]:!![]);})['catch'](function(_0x147fb6){logger[_0x8a98('0x2d')](_0x147fb6);_0x20baed(null,![]);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x54')]=function(_0x20bc7e,_0x5caa01){var _0x3517a7={'role':_0x8a98('0x52')};_0x3517a7[_0x20bc7e]=this[_0x8a98('0x10')][_0x8a98('0x3b')];this[_0x8a98('0x11')][_0x8a98('0x54')](_0x3517a7)[_0x8a98('0x15')](function(_0x133bff){_0x5caa01(null,_[_0x8a98('0x46')](_0x133bff)?![]:!![]);})[_0x8a98('0x19')](function(_0x2c5bd1){logger['error'](_0x2c5bd1);_0x5caa01(null,![]);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x55')]=function(_0x220257,_0x30fe59){var _0xe2cb84={'role':_0x8a98('0x52')};_0xe2cb84[_0x220257]=this[_0x8a98('0x10')][_0x8a98('0x3b')];var _0x25249f=_0x220257!='internal'?util[_0x8a98('0x29')]('%s/%s@from-sip/n',_0x8a98('0x56'),this[_0x8a98('0x10')]['callerid']):undefined;this[_0x8a98('0x11')][_0x8a98('0x55')](_0xe2cb84,_0x25249f)[_0x8a98('0x15')](function(_0x364bd5){_0x30fe59(null,_[_0x8a98('0x46')](_0x364bd5)?![]:!![]);})['catch'](function(_0x4b3aa7){logger[_0x8a98('0x2d')](_0x4b3aa7);_0x30fe59(null,![]);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x57')]=function(_0x62b3be,_0x3c5b5b){sh['exec'](_[_0x8a98('0x58')](_0x62b3be),function(_0x128840,_0x4973cb){var _0x317d8c=_0x4973cb[_0x8a98('0x59')](/(\r\n|\n|\r)/gm,'');_0x3c5b5b(null,_0x317d8c);});};AGIVertices['prototype'][_0x8a98('0x5a')]=function(_0x2d91d7,_0x34197f){scripts[_0x8a98('0x5a')](_0x2d91d7[_0x8a98('0x5b')],_0x2d91d7[_0x8a98('0x5c')]||_0x8a98('0x5d'),_0x2d91d7[_0x8a98('0x5d')],_0x2d91d7['languageCode']||'en-US',_0x2d91d7[_0x8a98('0x5e')]||_0x8a98('0x5f'),_0x2d91d7[_0x8a98('0x60')]||_0x8a98('0x61'))['then'](function(_0x191856){_0x34197f(null,_0x191856);})['catch'](function(_0x2952ce){_0x34197f(_0x2952ce);});};AGIVertices[_0x8a98('0x12')]['googleTTS']=function(_0x5db50e,_0x20b646){scripts[_0x8a98('0x62')](_0x5db50e[_0x8a98('0x5d')],_0x5db50e[_0x8a98('0x63')]||'en',0x1)[_0x8a98('0x15')](function(_0x343f3b){_0x20b646(null,_0x343f3b);})[_0x8a98('0x19')](function(_0x299b91){_0x20b646(_0x299b91);});};AGIVertices[_0x8a98('0x12')]['restAPI']=function(_0x24cc56,_0x582650){var _0x4f5117={'uri':_0x24cc56[_0x8a98('0x64')],'method':_0x24cc56[_0x8a98('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x24cc56[_0x8a98('0x66')])==='number'&&parseInt(_0x24cc56[_0x8a98('0x66')])>=0x1?parseInt(_0x24cc56[_0x8a98('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x8a98('0x67')](['POST',_0x8a98('0x68')],_0x4f5117[_0x8a98('0x65')][_0x8a98('0x69')]())){try{_0x4f5117[_0x8a98('0x6a')]=_0x24cc56[_0x8a98('0xd')]?JSON[_0x8a98('0x6b')](_0x24cc56[_0x8a98('0xd')]):{};}catch(_0x1f23f5){logger[_0x8a98('0x2d')](_0x8a98('0x6c'),_0x1f23f5);}}try{_0x4f5117[_0x8a98('0x6d')]=_0x24cc56['rawHeaders']?JSON[_0x8a98('0x6b')](_0x24cc56[_0x8a98('0x6e')]):{};}catch(_0x27e2dc){logger[_0x8a98('0x2d')](_0x8a98('0x6f'),_0x27e2dc);}if(_0x24cc56[_0x8a98('0x70')]){try{var _0x4801f6=require(_0x24cc56[_0x8a98('0x70')])[_0x8a98('0x71')](this,_0x4f5117);_0x4f5117[_0x8a98('0x72')]=Mustache[_0x8a98('0x73')](_0x24cc56[_0x8a98('0x64')],_0x4801f6,{},['$$','$$']);if(_0x4f5117[_0x8a98('0x6d')]){_0x4f5117[_0x8a98('0x6d')]=JSON['parse'](Mustache['render'](JSON[_0x8a98('0x74')](_0x4f5117[_0x8a98('0x6d')]),_0x4801f6,{},['$$','$$']));}if(_0x4f5117[_0x8a98('0x6a')]){_0x4f5117[_0x8a98('0x6a')]=JSON[_0x8a98('0x6b')](Mustache[_0x8a98('0x73')](JSON[_0x8a98('0x74')](_0x4f5117['body']),_0x4801f6,{},['$$','$$']));}}catch(_0x48b7b0){logger[_0x8a98('0x2d')](_0x8a98('0x75'),_0x48b7b0);}}rp(_0x4f5117)[_0x8a98('0x15')](function(_0x48432a){var _0x5a1004={'statusCode':_0x48432a[_0x8a98('0x76')]||0xc8,'statusMessage':_0x48432a[_0x8a98('0x77')]||'OK','headers':_0x48432a[_0x8a98('0x6d')]||{},'body':_0x48432a[_0x8a98('0x6a')]||{}};_0x582650(null,_0x5a1004);})[_0x8a98('0x19')](function(_0x2bf1fb){var _0x39ffd1={'statusCode':_0x2bf1fb[_0x8a98('0x76')]||0x1f4,'statusMessage':_0x2bf1fb[_0x8a98('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2bf1fb[_0x8a98('0x79')][_0x8a98('0x6d')]||{},'body':_0x2bf1fb[_0x8a98('0x79')][_0x8a98('0x6a')]||{}};_0x582650(null,_0x39ffd1);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x7a')]=function(_0x36644d,_0x4f7bdd){scripts[_0x8a98('0x7a')](this[_0x8a98('0x10')][_0x8a98('0x3d')],_0x36644d[_0x8a98('0x7b')],_0x36644d[_0x8a98('0x5d')],_0x36644d[_0x8a98('0x7c')]||'en')['then'](function(_0x1d5f79){_0x4f7bdd(null,_0x1d5f79);})[_0x8a98('0x19')](function(_0x48f85d){_0x4f7bdd(_0x48f85d);});};AGIVertices[_0x8a98('0x12')]['googleDialogflowV2']=function(_0xcf29df,_0x2e6dda){scripts[_0x8a98('0x7d')](this[_0x8a98('0x10')][_0x8a98('0x3d')],_0xcf29df[_0x8a98('0x7e')],_0xcf29df['client_email'],_0xcf29df[_0x8a98('0x7f')],_0xcf29df[_0x8a98('0x5d')],_0xcf29df[_0x8a98('0x80')]||'en')[_0x8a98('0x15')](function(_0x2b1e49){_0x2e6dda(null,_0x2b1e49);})[_0x8a98('0x19')](function(_0xd43112){_0x2e6dda(_0xd43112);});};AGIVertices[_0x8a98('0x12')]['sestekNDA']=function(_0x27a17a,_0x2dec53){scripts['sestekNDA'](this[_0x8a98('0x10')],_0x27a17a)[_0x8a98('0x15')](function(_0x21b8c7){_0x2dec53(null,_0x21b8c7);})[_0x8a98('0x19')](function(_0xc23db3){_0x2dec53(_0xc23db3);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x81')]=function(_0x4bd760,_0x3eb047){scripts[_0x8a98('0x81')](_0x4bd760['key'],_0x4bd760[_0x8a98('0x5d')],_0x4bd760[_0x8a98('0x82')]||_0x8a98('0x83'),_0x4bd760[_0x8a98('0x84')])[_0x8a98('0x15')](function(_0x2c36ef){_0x3eb047(null,_0x2c36ef);})[_0x8a98('0x19')](function(_0x5cafbc){_0x3eb047(_0x5cafbc);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x85')]=function(_0x4cdbe6,_0x687ec8,_0x29f12a){scripts[_0x8a98('0x85')](_0x687ec8,_0x4cdbe6[_0x8a98('0x7b')],_0x4cdbe6['ispeech_asr_language']||'en-US',this[_0x8a98('0x86')](_0x4cdbe6[_0x8a98('0x87')])?_0x4cdbe6[_0x8a98('0x87')]:undefined)['then'](function(_0x2cc4b8){_0x29f12a(null,_0x2cc4b8);})[_0x8a98('0x19')](function(_0x12b753){_0x29f12a(_0x12b753);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x88')]=function(_0x5a9588,_0x441665){scripts['awsPolly'](_0x5a9588[_0x8a98('0x89')],_0x5a9588[_0x8a98('0x8a')],_0x5a9588[_0x8a98('0x8b')],_0x5a9588[_0x8a98('0x8c')]||_0x8a98('0x8d'),_0x5a9588[_0x8a98('0x5d')],_0x5a9588[_0x8a98('0x8e')]||'text')[_0x8a98('0x15')](function(_0x310aff){_0x441665(null,_0x310aff);})[_0x8a98('0x19')](function(_0x321a49){_0x441665(_0x321a49);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x8f')]=function(_0x1200aa,_0x57e4bc){scripts[_0x8a98('0x8f')](this[_0x8a98('0x10')][_0x8a98('0x3d')],_0x1200aa[_0x8a98('0x89')],_0x1200aa[_0x8a98('0x8a')],_0x1200aa[_0x8a98('0x90')],_0x1200aa[_0x8a98('0x5d')],_0x1200aa[_0x8a98('0x91')])[_0x8a98('0x15')](function(_0x42f9a9){_0x57e4bc(null,_0x42f9a9);})['catch'](function(_0x5742f6){_0x57e4bc(_0x5742f6);});};AGIVertices['prototype'][_0x8a98('0x92')]=function(_0xe31f3d,_0x2859d9,_0x1dbe53){scripts[_0x8a98('0x92')](_0x2859d9,_0xe31f3d[_0x8a98('0x7b')],_0xe31f3d['google_asr_language']||'en-US')[_0x8a98('0x15')](function(_0x3d2254){_0x1dbe53(null,_0x3d2254);})['catch'](function(_0x5f454a){_0x1dbe53(_0x5f454a);});};AGIVertices[_0x8a98('0x12')]['tildeASR']=function(_0x5e1027,_0x3df624,_0x2fa156){scripts[_0x8a98('0x93')](_0x3df624,_0x5e1027[_0x8a98('0x94')],_0x5e1027[_0x8a98('0x95')],_0x5e1027['uri'])[_0x8a98('0x15')](function(_0x175e02){_0x2fa156(null,_0x175e02);})[_0x8a98('0x19')](function(_0x321bb8){_0x2fa156(_0x321bb8);});};AGIVertices[_0x8a98('0x12')][_0x8a98('0x96')]=function(_0x14330a){var _0xb36c0f=_[_0x8a98('0x67')](verticesWithRetry,_0x14330a[_0x8a98('0x97')])?_0x14330a:_[_0x8a98('0x98')](_0x14330a);for(var _0x1292a9 in _0xb36c0f){if(_0xb36c0f[_0x8a98('0x99')](_0x1292a9)){if(_0xb36c0f[_0x1292a9]&&_[_0x8a98('0x9a')](_0xb36c0f[_0x1292a9])){if(_[_0x8a98('0x67')](recursiveMapAttributes,_0x1292a9)){_0xb36c0f[_0x1292a9]=this[_0x8a98('0x9b')](_0xb36c0f[_0x1292a9]);}else{_0xb36c0f[_0x1292a9]=this[_0x8a98('0x9c')](_0xb36c0f[_0x1292a9]);}}}}return _0xb36c0f;};AGIVertices[_0x8a98('0x12')][_0x8a98('0x9d')]=function(_0x4fb239){for(var _0x1fae30 in _0x4fb239){if(_0x4fb239[_0x8a98('0x99')](_0x1fae30)){if(_['isPlainObject'](_0x4fb239[_0x1fae30])){this[_0x8a98('0x9d')](_0x4fb239[_0x1fae30]);}else if(_['isArray'](_0x4fb239[_0x1fae30])){for(var _0x439c99=0x0;_0x439c99<_0x4fb239[_0x1fae30][_0x8a98('0x9e')];_0x439c99++){this[_0x8a98('0x9d')](_0x4fb239[_0x1fae30][_0x439c99]);}}else if(_[_0x8a98('0x9a')](_0x4fb239[_0x1fae30])){_0x4fb239[_0x1fae30]=this[_0x8a98('0x9c')](_0x4fb239[_0x1fae30]);}}}};AGIVertices[_0x8a98('0x12')][_0x8a98('0x9f')]=function(_0x34bb1b,_0x2152a9){for(var _0x2eeeb5 in _0x34bb1b){if(_0x34bb1b[_0x8a98('0x99')](_0x2eeeb5)){if(_['isPlainObject'](_0x34bb1b[_0x2eeeb5])){if(!_[_0x8a98('0x45')](_0x34bb1b[_0x2eeeb5])){this[_0x8a98('0x9f')](_0x34bb1b[_0x2eeeb5],util[_0x8a98('0x29')](_0x8a98('0xa0'),_0x2152a9,_0x2eeeb5));}}else if(_[_0x8a98('0xa1')](_0x34bb1b[_0x2eeeb5])){for(var _0x355010=0x0;_0x355010<_0x34bb1b[_0x2eeeb5]['length'];_0x355010++){this[_0x8a98('0x9f')](_0x34bb1b[_0x2eeeb5][_0x355010],util[_0x8a98('0x29')](_0x8a98('0xa0'),_0x2152a9,_0x2eeeb5+'['+_0x355010+']'));}}else{if(!_[_0x8a98('0x46')](_0x34bb1b[_0x2eeeb5])){this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0xa0'),_0x2152a9,_0x2eeeb5),_0x34bb1b[_0x2eeeb5]);}}}}};AGIVertices[_0x8a98('0x12')][_0x8a98('0x9b')]=function(_0x116cc1){try{var _0x13a46b=JSON[_0x8a98('0x6b')](_0x116cc1);this[_0x8a98('0x9d')](_0x13a46b);return JSON[_0x8a98('0x74')](_0x13a46b);}catch(_0x56fe87){return this[_0x8a98('0x9c')](_0x116cc1);}};AGIVertices[_0x8a98('0x12')][_0x8a98('0x9c')]=function(_0x41a065){var _0x3c23b0=_0x41a065[_0x8a98('0xa3')]('{');for(var _0x3083b6=0x1;_0x3083b6<_0x3c23b0[_0x8a98('0x9e')];_0x3083b6+=0x1){var _0xbada99=_0x3c23b0[_0x3083b6]['split']('}');if(_0xbada99[_0x8a98('0x9e')]>0x1){_0x41a065=_0x41a065[_0x8a98('0xa4')]('{'+_0xbada99[0x0]+'}',this['channel'][_0x8a98('0x13')](_0xbada99[0x0])['extra']||_0xbada99[0x0]);}}if(_0x3c23b0[_0x8a98('0x9e')]===0x1){return _0x41a065['toString']();}return this['replaceAllVariables'](_0x41a065);};AGIVertices[_0x8a98('0x12')][_0x8a98('0xa5')]=function(_0x853701,_0x604422){var _0x38b3fc=this[_0x8a98('0x10')][_0x8a98('0x13')](_0x853701);if(_0x38b3fc[_0x8a98('0xa6')]===-0x1){return _0x38b3fc;}logger['info'](util['format'](_0x8a98('0xa7'),_0x604422,_0x38b3fc['extra']));return this['channel'][_0x8a98('0xa2')](_0x604422,_0x38b3fc[_0x8a98('0xa8')]);};AGIVertices[_0x8a98('0x12')][_0x8a98('0x86')]=function(_0x2e2085){return _0x2e2085&&_0x2e2085!=='0'&&_0x2e2085!=='-1'&&_0x2e2085!=='';};AGIVertices[_0x8a98('0x12')]['maxRetry']=function(_0x33b39f){this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x33b39f,'-');_0x33b39f[_0x8a98('0xa9')]=_0x33b39f[_0x8a98('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x17a38f){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xab'),_0x17a38f[_0x8a98('0x39')]));if(!this['isConfigured'](_0x17a38f[_0x8a98('0x5d')])){return this['channel'][_0x8a98('0xac')](_0x8a98('0xad'));}var _0xe9cc36='\x22'+_0x17a38f[_0x8a98('0x5d')]+'\x22';if(this[_0x8a98('0x86')](_0x17a38f[_0x8a98('0x79')])){_0xe9cc36+=','+_0x17a38f[_0x8a98('0x79')];}var _0x27b059=this[_0x8a98('0x10')][_0x8a98('0xae')]('MRCPSynth',_0xe9cc36);if(_0x27b059[_0x8a98('0xa6')]===-0x1){return _0x27b059;}return this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0xe9cc36));};AGIVertices[_0x8a98('0x12')][_0x8a98('0xaf')]=function(_0x283f03){logger[_0x8a98('0x31')](util['format'](_0x8a98('0xb0'),_0x283f03[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x283f03[_0x8a98('0xb1')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xb2'));}var _0x34dcb7=_0x283f03[_0x8a98('0xb1')];if(this['isConfigured'](_0x283f03[_0x8a98('0x79')])){_0x34dcb7+=','+_0x283f03['options'];}var _0x3f4bbe=this[_0x8a98('0x10')][_0x8a98('0xae')](_0x8a98('0xb3'),_0x34dcb7);if(_0x3f4bbe['result']===-0x1){return _0x3f4bbe;}var _0x20a954=this[_0x8a98('0xa5')]('RECOG_CONFIDENCE()',_0x8a98('0xb4'));if(_0x20a954[_0x8a98('0xa6')]===-0x1){return _0x20a954;}var _0x54e7e1=this[_0x8a98('0xa5')](_0x8a98('0xb5'),_0x8a98('0xb6'));if(_0x54e7e1[_0x8a98('0xa6')]===-0x1){return _0x54e7e1;}var _0x3f907a=this[_0x8a98('0xa5')](_0x8a98('0xb7'),_0x8a98('0xb8'));if(_0x3f907a['result']===-0x1){return _0x3f907a;}return this['channel'][_0x8a98('0xac')](util[_0x8a98('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x34dcb7));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x8')]=function(_0x16b74d){logger['info'](util['format'](_0x8a98('0xb9'),_0x16b74d['label']));return this[_0x8a98('0x10')][_0x8a98('0x8')]([_0x16b74d['command'],_0x16b74d['args']]);};AGIVertices['prototype']['answer']=function(_0x5670f7){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xba'),_0x5670f7[_0x8a98('0x39')]));if(this[_0x8a98('0x86')](_0x5670f7[_0x8a98('0x66')])){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xbb'),_0x5670f7['timeout']));var _0x13419c=this['channel']['wait'](_0x5670f7[_0x8a98('0x66')]);if(_0x13419c['result']===-0x1){return _0x13419c;}}return this[_0x8a98('0x10')][_0x8a98('0xbc')]();};AGIVertices[_0x8a98('0x12')][_0x8a98('0x4c')]=function(_0x47e98a){logger['info'](util[_0x8a98('0x29')](_0x8a98('0xbd'),_0x47e98a['label']));if(!this[_0x8a98('0x86')](_0x47e98a[_0x8a98('0xbe')])){return this[_0x8a98('0x10')]['error'](_0x47e98a,_0x8a98('0xbf'));}_0x47e98a[_0x8a98('0x4b')]=moment();if(this['isConfigured'](_0x47e98a[_0x8a98('0xc0')])){_0x47e98a['scheduledAt']=moment()['add'](_0x47e98a[_0x8a98('0xc0')],'minutes');}if(!this[_0x8a98('0x86')](_0x47e98a[_0x8a98('0x4e')])){_0x47e98a[_0x8a98('0x4e')]=0x2;}this[_0x8a98('0x44')][_0x8a98('0x71')](this,_0x47e98a);return this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x47e98a[_0x8a98('0x4a')],_0x47e98a[_0x8a98('0xbe')],_0x47e98a[_0x8a98('0x4b')]));};AGIVertices[_0x8a98('0x12')]['custom_app']=function(_0x387a29){logger[_0x8a98('0x31')](util[_0x8a98('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x387a29[_0x8a98('0x39')]));var _0x44c905=this[_0x8a98('0x10')][_0x8a98('0xae')](_0x387a29[_0x8a98('0xc1')],_0x387a29['options']);if(_0x44c905['result']===-0x1){return _0x44c905;}return this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')](_0x8a98('0xc2'),_0x387a29[_0x8a98('0xc1')],_0x387a29[_0x8a98('0x79')]));};AGIVertices['prototype'][_0x8a98('0xc3')]=function(_0x259eb4){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xc4'),_0x259eb4[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x259eb4[_0x8a98('0x5d')])){return this[_0x8a98('0x10')]['noop'](_0x8a98('0xad'));}var _0x462a71='\x22'+_0x259eb4[_0x8a98('0x5d')]+'\x22';if(this['isConfigured'](_0x259eb4[_0x8a98('0x79')])){_0x462a71+=','+_0x259eb4['options'];}var _0x5db8c4=this[_0x8a98('0x10')][_0x8a98('0xae')](_0x8a98('0xc5'),_0x462a71);if(_0x5db8c4[_0x8a98('0xa6')]===-0x1){return _0x5db8c4;}return this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xc6'),_0x462a71));};AGIVertices[_0x8a98('0x12')][_0x8a98('0xc7')]=function(_0xde4486){logger[_0x8a98('0x31')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xde4486[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0xde4486[_0x8a98('0x5d')])){return this[_0x8a98('0x10')][_0x8a98('0xac')]('no\x20text\x20configured');}var _0x29be06='\x22'+_0xde4486['text']+'\x22';if(this[_0x8a98('0x86')](_0xde4486['options'])){_0x29be06+=','+_0xde4486[_0x8a98('0x79')];}var _0x1d9eef=this[_0x8a98('0x10')][_0x8a98('0xae')]('MRCPSynth',_0x29be06);if(_0x1d9eef['result']===-0x1){return _0x1d9eef;}return this['channel'][_0x8a98('0xac')](util['format'](_0x8a98('0xc6'),_0x29be06));};AGIVertices[_0x8a98('0x12')]['lumenvoxasr']=function(_0x538602){logger[_0x8a98('0x31')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x538602[_0x8a98('0x39')]));if(!this['isConfigured'](_0x538602[_0x8a98('0xb1')])){return this['channel']['noop'](_0x8a98('0xb2'));}var _0x2638af=_0x538602['grammar'];if(this[_0x8a98('0x86')](_0x538602['options'])){_0x2638af+=','+_0x538602[_0x8a98('0x79')];}var _0x4e922d=this[_0x8a98('0x10')][_0x8a98('0xae')](_0x8a98('0xb3'),_0x2638af);if(_0x4e922d[_0x8a98('0xa6')]===-0x1){return _0x4e922d;}var _0x140fe6=this[_0x8a98('0xa5')](_0x8a98('0xc8'),'LUMENVOX_ASR_CONFIDENCE');if(_0x140fe6[_0x8a98('0xa6')]===-0x1){return _0x140fe6;}var _0x17abbb=this[_0x8a98('0xa5')](_0x8a98('0xb5'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x17abbb['result']===-0x1){return _0x17abbb;}var _0x283de3=this['getAndSetVariable'](_0x8a98('0xb7'),'LUMENVOX_ASR_INSTANCE');if(_0x283de3[_0x8a98('0xa6')]===-0x1){return _0x283de3;}return this['channel'][_0x8a98('0xac')](util['format'](_0x8a98('0xc9'),_0x2638af));};AGIVertices['prototype'][_0x8a98('0xca')]=function(_0x24e61b){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xcb'),_0x24e61b[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x24e61b[_0x8a98('0xb1')])){return this['channel']['noop'](_0x8a98('0xb2'));}var _0xafffae=_0x24e61b['grammar'];if(this['isConfigured'](_0x24e61b[_0x8a98('0x79')])){_0xafffae+=','+_0x24e61b['options'];}var _0x2070e3=this[_0x8a98('0x10')][_0x8a98('0xae')](_0x8a98('0xb3'),_0xafffae);if(_0x2070e3[_0x8a98('0xa6')]===-0x1){return _0x2070e3;}var _0x2e12b1=this[_0x8a98('0xa5')](_0x8a98('0xc8'),_0x8a98('0xcc'));if(_0x2e12b1[_0x8a98('0xa6')]===-0x1){return _0x2e12b1;}var _0x40c436=this[_0x8a98('0xa5')](_0x8a98('0xb5'),'SESTEK_ASR_TRANSCRIPT');if(_0x40c436['result']===-0x1){return _0x40c436;}var _0x24824c=this[_0x8a98('0xa5')](_0x8a98('0xb7'),_0x8a98('0xcd'));if(_0x24824c[_0x8a98('0xa6')]===-0x1){return _0x24824c;}return this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xc9'),_0xafffae));};AGIVertices['prototype'][_0x8a98('0xce')]=function(_0x1a748a){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xcf'),_0x1a748a[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x1a748a[_0x8a98('0xd0')])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x1a748a,_0x8a98('0xd1'));}var _0x331bf2=this[_0x8a98('0x1b')][_0x8a98('0x71')](this,_0x1a748a['odbc_id']);if(!_0x331bf2){return this['channel'][_0x8a98('0x2d')](_0x1a748a,_0x8a98('0xd2'));}if(!this[_0x8a98('0x86')](_0x1a748a[_0x8a98('0x30')])){return this['channel'][_0x8a98('0x2d')](_0x1a748a,_0x8a98('0xd3'));}var _0xf40239=_0x1a748a['query'][_0x8a98('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')]('query:\x20%s',_0xf40239));var _0x4af5b8=this[_0x8a98('0x2b')]['sync'](this,_0x331bf2,_0xf40239);this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x1a748a,_0xf40239);if(!this[_0x8a98('0x86')](_0x1a748a[_0x8a98('0xd4')])){return this[_0x8a98('0x10')]['noop'](_0x8a98('0xd5'));}var _0x1e9b87=this[_0x8a98('0x13')]['sync'](this,_0x1a748a[_0x8a98('0xd4')]);if(!_0x1e9b87){return this['channel'][_0x8a98('0x2d')](_0x1a748a,_0x8a98('0xd6'));}var _0x5ac8e2=this;_0x4af5b8[_0x8a98('0xd7')](function(_0x1e4076,_0x1fa9c4){Object[_0x8a98('0xd8')](_0x1e4076)[_0x8a98('0xd7')](function(_0xd16743){_0x5ac8e2[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0xd9'),_0x1e9b87,_0x1fa9c4,_0xd16743),_0x1e4076[_0xd16743]);});});this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0xda'),_0x1e9b87),_0x4af5b8[_0x8a98('0x9e')]);return this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xdb'),_0x1e9b87));};AGIVertices[_0x8a98('0x12')]['dial']=function(_0x2572ad){logger[_0x8a98('0xdc')](util['format'](_0x8a98('0xdd'),_0x2572ad[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x2572ad['sip_id'])){return this['channel'][_0x8a98('0x2d')](_0x2572ad,_0x8a98('0xde'));}var _0x471c78=this[_0x8a98('0x1d')][_0x8a98('0x71')](this,_0x2572ad[_0x8a98('0xdf')]);if(!_0x471c78){return this[_0x8a98('0x10')]['error'](_0x2572ad,_0x8a98('0xe0'));}var _0x141bd1=this['channel'][_0x8a98('0xae')]('DIAL',[util['format'](_0x8a98('0xe1'),_0x471c78),_0x2572ad['timeout'],_0x2572ad[_0x8a98('0xe2')],_0x2572ad[_0x8a98('0x64')]]);if(_0x141bd1[_0x8a98('0xa6')]===-0x1){return _0x141bd1;}return this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0xe3'),_0x8a98('0xe4')));};AGIVertices[_0x8a98('0x12')]['dialogflow']=function(_0x25a9a5){logger[_0x8a98('0x31')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x25a9a5['label']));if(!this['isConfigured'](_0x25a9a5[_0x8a98('0x7b')])){return this[_0x8a98('0x10')]['noop'](_0x8a98('0xe5'));}if(!this[_0x8a98('0x86')](_0x25a9a5[_0x8a98('0x5d')])){return this['channel'][_0x8a98('0xac')](_0x8a98('0xad'));}this['channel'][_0x8a98('0xe6')]=!![];this['createSquareDetailsReport'](_0x25a9a5);this['createSquareMessage'](_0x25a9a5[_0x8a98('0x5d')],'in','','');this[_0x8a98('0x10')]['noop'](util['format'](_0x8a98('0xe7'),_0x25a9a5[_0x8a98('0x5d')]));var _0x47e082=this[_0x8a98('0x7a')][_0x8a98('0x71')](this,_0x25a9a5);if(_0x47e082){for(var _0x2911dc in _0x47e082){if(_0x47e082[_0x8a98('0x99')](_0x2911dc)){this[_0x8a98('0x10')][_0x8a98('0xa2')](util['format']('DIALOGFLOW_%s',_0x2911dc[_0x8a98('0x69')]()),_0x47e082[_0x2911dc]);}}this[_0x8a98('0x43')](_0x47e082[_0x8a98('0xe8')],'out',_0x8a98('0xe9'),'');return this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xea'),_0x47e082[_0x8a98('0xe8')]));}return this['channel']['error'](_0x25a9a5,_0x8a98('0xeb'));};AGIVertices['prototype']['dialogflowV2']=function(_0x174a10){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xec'),_0x174a10['label']));if(!this[_0x8a98('0x86')](_0x174a10[_0x8a98('0x7e')])){return this[_0x8a98('0x10')]['noop']('no\x20project_id\x20configured');}if(!this[_0x8a98('0x86')](_0x174a10['client_email'])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xed'));}if(!this['isConfigured'](_0x174a10[_0x8a98('0x7f')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xee'));}if(!this[_0x8a98('0x86')](_0x174a10['dialogflowV2_language'])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xef'));}if(!this[_0x8a98('0x86')](_0x174a10[_0x8a98('0x5d')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xad'));}this[_0x8a98('0x10')][_0x8a98('0xe6')]=!![];this['createSquareDetailsReport'](_0x174a10);this[_0x8a98('0x43')](_0x174a10['text'],'in','','');this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xf0'),_0x174a10['text']));var _0x597cac=this[_0x8a98('0x7d')]['sync'](this,_0x174a10);if(_0x597cac){for(var _0x2dba7a in _0x597cac){if(_0x597cac[_0x8a98('0x99')](_0x2dba7a)){if(_0x2dba7a!==_0x8a98('0xf1')){this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')]('DIALOGFLOW_%s',_0x2dba7a['toUpperCase']()),_0x597cac[_0x2dba7a]);}}}this['createSquareMessage'](_0x597cac[_0x8a98('0xe8')],_0x8a98('0xf2'),_0x8a98('0xf3'),_0x597cac[_0x8a98('0xf1')]);return this['channel'][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xf4'),_0x597cac[_0x8a98('0xe8')]));}return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x174a10,_0x8a98('0xf5'));};AGIVertices[_0x8a98('0x12')][_0x8a98('0xf6')]=function(_0x3a3544){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0xf7'),_0x3a3544[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x3a3544[_0x8a98('0xf8')])){return this[_0x8a98('0x10')][_0x8a98('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8a98('0x86')](_0x3a3544[_0x8a98('0xf9')])){return this['channel']['noop'](_0x8a98('0xfa'));}if(!this[_0x8a98('0x86')](_0x3a3544[_0x8a98('0xfb')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xfc'));}if(!this[_0x8a98('0x86')](_0x3a3544[_0x8a98('0xfd')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xad'));}this[_0x8a98('0x10')][_0x8a98('0xe6')]=!![];this['createSquareDetailsReport'](_0x3a3544);this['createSquareMessage'](_0x3a3544[_0x8a98('0x5d')],'in','','');this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')](_0x8a98('0xfe'),_0x3a3544[_0x8a98('0x5d')]));var _0x31b31e=this[_0x8a98('0xff')]['sync'](this,_0x3a3544);if(_0x31b31e){for(var _0x12ca4b in _0x31b31e){if(_0x31b31e[_0x8a98('0x99')](_0x12ca4b)){this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0x100'),_0x12ca4b[_0x8a98('0x69')]()),_0x31b31e[_0x12ca4b]);}}this['createSquareMessage'](_0x31b31e['speech'],_0x8a98('0xf2'),'sesteknda','');if(_0x31b31e['audiofile']){this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x31b31e[_0x8a98('0x101')]));var _0x1a245b=this[_0x8a98('0x10')][_0x8a98('0x102')](_0x31b31e[_0x8a98('0x101')]);try{fs[_0x8a98('0x103')](_0x31b31e[_0x8a98('0x101')]+'.wav');}catch(_0x3e644d){logger[_0x8a98('0x2d')](_0x3e644d);}return _0x1a245b;}else{return this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')](_0x8a98('0x104'),_0x31b31e[_0x8a98('0xe8')]));}}return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x3a3544,_0x8a98('0x105'));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x106')]=function(_0xdb9855){logger['info'](util['format'](_0x8a98('0x107'),_0xdb9855['label']));return this[_0x8a98('0x10')][_0x8a98('0xac')]('end');};AGIVertices[_0x8a98('0x12')][_0x8a98('0x108')]=function(_0xb31c4){logger[_0x8a98('0x31')](util['format'](_0x8a98('0x109'),_0xb31c4[_0x8a98('0x39')]));var _0x4bd1d9='';if(_0xb31c4['trunk_id']){if(!this[_0x8a98('0x86')](_0xb31c4[_0x8a98('0x10a')])){return this[_0x8a98('0x10')]['error'](_0xb31c4,_0x8a98('0x10b'));}else{var _0x54a500=parseInt(_0xb31c4['trunk_id'],0xa);if(isNaN(_0x54a500)){_0x4bd1d9=_0xb31c4[_0x8a98('0x10a')];}else{_0x4bd1d9=this['getTrunk']['sync'](this,_0xb31c4['trunk_id']);if(!_0x4bd1d9){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0xb31c4,_0x8a98('0x10c'));}}}}else if(_0xb31c4['trunk_name']){_0x4bd1d9=_0xb31c4['trunk_name'];}else{return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0xb31c4,_0x8a98('0x10b'));}var _0x1dd3be=this['channel'][_0x8a98('0xae')](_0x8a98('0xe4'),[util[_0x8a98('0x29')](_0x8a98('0x10d'),_0x4bd1d9,_0xb31c4['phone']),_0xb31c4['timeout'],_0xb31c4[_0x8a98('0xe2')],_0xb31c4[_0x8a98('0x64')]]);if(_0x1dd3be[_0x8a98('0xa6')]===-0x1){return _0x1dd3be;}return this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x8a98('0x12')]['finally']=function(_0x178b4b){logger[_0x8a98('0x31')](util[_0x8a98('0x29')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x178b4b['label']));return this['channel'][_0x8a98('0xac')](_0x8a98('0x10e'));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x10f')]=function(_0x42eb09){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x110'),_0x42eb09['label']));if(_0x42eb09[_0x8a98('0xa9')]===0x0){return this[_0x8a98('0xaa')](_0x42eb09);}_0x42eb09[_0x8a98('0xa9')]-=0x1;if(!this[_0x8a98('0x86')](_0x42eb09[_0x8a98('0x111')])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x42eb09,'no\x20file\x20audio\x20selected');}var _0x1061a1=this[_0x8a98('0x20')]['sync'](this,_0x42eb09[_0x8a98('0x111')]);if(!_0x1061a1){return this['channel'][_0x8a98('0x2d')](_0x42eb09,_0x8a98('0x112'));}if(!this[_0x8a98('0x86')](_0x42eb09['variable_id'])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x8a98('0xd5'));}var _0x3391b8=this[_0x8a98('0x10')][_0x8a98('0x113')](_0x1061a1,_0x42eb09[_0x8a98('0x114')],_0x42eb09[_0x8a98('0x115')]);var _0x26671c=_0x3391b8[_0x8a98('0xa6')]?_0x3391b8[_0x8a98('0xa6')][_0x8a98('0x4d')]():'';logger[_0x8a98('0x31')](_0x8a98('0x116'),JSON[_0x8a98('0x74')](_0x3391b8));if(_0x3391b8['result']===-0x1){this[_0x8a98('0x38')]['sync'](this,_0x42eb09,_0x26671c);return _0x3391b8;}else if(_0x3391b8[_0x8a98('0xa8')]===_0x8a98('0x66')){_0x3391b8['result']=_0x26671c[_0x8a98('0x9e')]>=parseInt(_0x42eb09['mindigit'])?'x':'i';}else{_0x3391b8['result']=_0x26671c[_0x8a98('0x9e')]>=parseInt(_0x42eb09[_0x8a98('0x117')])&&_0x26671c[_0x8a98('0x9e')]<=parseInt(_0x42eb09[_0x8a98('0x115')])?'x':'i';}var _0x2ca9b8=this[_0x8a98('0x13')]['sync'](this,_0x42eb09[_0x8a98('0xd4')]);if(!_0x2ca9b8){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x42eb09,_0x8a98('0xd6'));}this[_0x8a98('0x10')][_0x8a98('0xa2')](_0x2ca9b8,_0x26671c);if(this[_0x8a98('0x86')](_0x42eb09['hiddendigitsnum'])){var _0x41ef8a=parseInt(_0x42eb09[_0x8a98('0x118')],0xa);var _0xbde9bc=rs[_0x8a98('0x119')]({'charset':'*','length':_0x41ef8a});var _0x5b1189=_0x26671c['length'];if(_0x5b1189>0x0){if(_0x5b1189>_0x41ef8a){this['createSquareDetailsReport']['sync'](this,_0x42eb09,_0x42eb09[_0x8a98('0x11a')]===_0x8a98('0x11b')?_0xbde9bc+_0x26671c[_0x8a98('0x11c')](_0x41ef8a):_0x26671c[_0x8a98('0x11c')](0x0,_0x5b1189-_0x41ef8a)+_0xbde9bc);}else{this['createSquareDetailsReport'][_0x8a98('0x71')](this,_0x42eb09,rs[_0x8a98('0x119')]({'charset':'*','length':_0x5b1189}));}}else{this[_0x8a98('0x38')]['sync'](this,_0x42eb09,'');}}else{this[_0x8a98('0x38')]['sync'](this,_0x42eb09,_0x26671c);}return _0x3391b8;};AGIVertices[_0x8a98('0x12')][_0x8a98('0xf')]=function(_0x23a23d){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x11d'),_0x23a23d['label']));return this[_0x8a98('0x10f')](_0x23a23d);};AGIVertices['prototype'][_0x8a98('0x11e')]=function(_0x45056b){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x11f'),_0x45056b[_0x8a98('0x39')]));this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x45056b,_0x45056b[_0x8a98('0x120')]);return this[_0x8a98('0x10')][_0x8a98('0xac')](util['format']('GOAL\x20%s',_0x45056b[_0x8a98('0x120')]));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x121')]=function(_0x50a2f8){logger[_0x8a98('0x31')](util['format'](_0x8a98('0x122'),_0x50a2f8['label']));if(!this[_0x8a98('0x86')](_0x50a2f8[_0x8a98('0x89')])||!this['isConfigured'](_0x50a2f8['aws_secret_access_key'])){return this['channel'][_0x8a98('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8a98('0x86')](_0x50a2f8[_0x8a98('0x5d')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xad'));}this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x123'),_0x50a2f8['text']));var _0x45919a=this[_0x8a98('0x88')][_0x8a98('0x71')](this,_0x50a2f8);if(_0x45919a){this['channel'][_0x8a98('0xac')](util[_0x8a98('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x45919a));var _0x2e3b22=this[_0x8a98('0x10')][_0x8a98('0x102')](_0x45919a);try{fs['unlink'](_0x45919a+_0x8a98('0x124'));}catch(_0x58a4ca){logger[_0x8a98('0x2d')](_0x58a4ca);}return _0x2e3b22;}return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x50a2f8,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x8a98('0x125')]=function(_0x14c558){logger[_0x8a98('0x31')](util[_0x8a98('0x29')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x14c558[_0x8a98('0x39')]));if(!this['isConfigured'](_0x14c558[_0x8a98('0x89')])||!this[_0x8a98('0x86')](_0x14c558[_0x8a98('0x8a')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0x126'));}if(!this['isConfigured'](_0x14c558[_0x8a98('0x91')])){return this['channel'][_0x8a98('0xac')](_0x8a98('0x127'));}if(!this[_0x8a98('0x86')](_0x14c558['text'])){return this[_0x8a98('0x10')]['noop'](_0x8a98('0xad'));}this[_0x8a98('0x10')][_0x8a98('0xe6')]=!![];this['createSquareDetailsReport'](_0x14c558);this[_0x8a98('0x43')](_0x14c558[_0x8a98('0x5d')],'in','','');this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')]('Trying\x20Amazon\x20Lex:\x20%s',_0x14c558[_0x8a98('0x5d')]));var _0x3e7b5c=this[_0x8a98('0x8f')][_0x8a98('0x71')](this,_0x14c558);if(_0x3e7b5c){for(var _0x86d66d in _0x3e7b5c){if(_0x3e7b5c[_0x8a98('0x99')](_0x86d66d)&&_[_0x8a98('0x9a')](_0x3e7b5c[_0x86d66d])){this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0x128'),_0x86d66d[_0x8a98('0x69')]()),_0x3e7b5c[_0x86d66d]);}}if(_[_0x8a98('0x46')](_0x3e7b5c[_0x8a98('0x78')])){return this['channel'][_0x8a98('0xac')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x8a98('0x43')](_0x3e7b5c[_0x8a98('0x78')],_0x8a98('0xf2'),_0x8a98('0x129'),'');return this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x12a'),_0x3e7b5c[_0x8a98('0x78')]));}}return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x14c558,_0x8a98('0x12b'));};AGIVertices[_0x8a98('0x12')]['googleasr']=function(_0xf359b){logger[_0x8a98('0x31')](util['format'](_0x8a98('0x12c'),_0xf359b[_0x8a98('0x39')],_0xf359b[_0x8a98('0x66')]));if(!this[_0x8a98('0x86')](_0xf359b[_0x8a98('0x7b')])){return this[_0x8a98('0x10')]['noop']('no\x20key\x20configured');}var _0x42d707=_0x8a98('0x12d');var _0x53e920=util[_0x8a98('0x29')](_0x8a98('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x502148=util[_0x8a98('0x29')](_0x8a98('0xa0'),_0x53e920,_0x42d707);var _0x289e6b=!![];if(_0xf359b['beep']==='NOBEEP'){_0x289e6b=![];}var _0x14be3a=this[_0x8a98('0x10')]['recordFile'](_0x53e920,_0x42d707,_0xf359b[_0x8a98('0x12f')],_0xf359b['timeout'],undefined,_0x289e6b);if(_0x14be3a[_0x8a98('0xa6')]!==-0x1){this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x130'),_0x502148));var _0x3d7720=this[_0x8a98('0x92')][_0x8a98('0x71')](this,_0xf359b,_0x502148);if(_0x3d7720){for(var _0xddbc01 in _0x3d7720){if(_0x3d7720['hasOwnProperty'](_0xddbc01)){this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')]('GOOGLE_ASR_%s',_0xddbc01[_0x8a98('0x69')]()),_0x3d7720[_0xddbc01]);}}return this[_0x8a98('0x10')][_0x8a98('0xac')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0x8a98('0x74')](_0x3d7720)));}}return _0x14be3a;};AGIVertices[_0x8a98('0x12')][_0x8a98('0x131')]=function(_0x117414){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x132'),_0x117414[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x117414[_0x8a98('0x94')])){return this[_0x8a98('0x10')][_0x8a98('0xac')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x117414[_0x8a98('0x95')])){return this[_0x8a98('0x10')][_0x8a98('0xac')]('no\x20appsecret\x20configured');}var _0x38fc3a=_0x8a98('0x12d');var _0x3dd7c5=util['format'](_0x8a98('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x40bde1=util[_0x8a98('0x29')]('%s.%s',_0x3dd7c5,_0x38fc3a);var _0x33b360=!![];if(_0x117414[_0x8a98('0x133')]==='NOBEEP'){_0x33b360=![];}var _0x24402e=this[_0x8a98('0x10')][_0x8a98('0x134')](_0x3dd7c5,_0x38fc3a,_0x117414[_0x8a98('0x12f')],_0x117414[_0x8a98('0x66')],undefined,_0x33b360);if(_0x24402e[_0x8a98('0xa6')]!==-0x1){this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')]('tilde\x20%s\x20file\x20created',_0x40bde1));var _0x180a8b=this['tildeASR'][_0x8a98('0x71')](this,_0x117414,_0x40bde1);if(_0x180a8b){for(var _0x529148 in _0x180a8b){if(_0x180a8b[_0x8a98('0x99')](_0x529148)){this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0x135'),_0x529148[_0x8a98('0x69')]()),_0x180a8b[_0x529148]);}}return this['channel']['noop'](util[_0x8a98('0x29')](_0x8a98('0x136'),JSON[_0x8a98('0x74')](_0x180a8b)));}}return _0x24402e;};AGIVertices[_0x8a98('0x12')][_0x8a98('0x137')]=function(_0x4cb428){logger['info'](util[_0x8a98('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4cb428[_0x8a98('0x39')]));return this[_0x8a98('0x10')][_0x8a98('0x138')](_0x4cb428[_0x8a98('0x139')],_0x4cb428[_0x8a98('0x3f')],_0x4cb428[_0x8a98('0x40')]);};AGIVertices['prototype'][_0x8a98('0x13a')]=function(_0x683719){logger[_0x8a98('0x31')](util['format'](_0x8a98('0x13b'),_0x683719['label']));if(!this[_0x8a98('0x86')](_0x683719[_0x8a98('0x13c')])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x683719,_0x8a98('0x13d'));}try{var _0x2b22a3=eval(_0x683719[_0x8a98('0x13c')])?_0x8a98('0x13e'):'false';this['channel']['noop'](util['format'](_0x8a98('0x13f'),_0x683719[_0x8a98('0x13c')],_0x2b22a3));return{'code':0xc8,'result':_0x2b22a3};}catch(_0x4e7ee9){return{'code':0xc8,'result':_0x8a98('0x140')};}};AGIVertices[_0x8a98('0x12')]['gotoiftime']=function(_0xa71f4){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x141'),_0xa71f4[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0xa71f4['interval_id'])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0xa71f4,_0x8a98('0x142'));}var _0x403298=this[_0x8a98('0x143')][_0x8a98('0x71')](this,_0xa71f4[_0x8a98('0x144')]);if(!_0x403298){return this['channel'][_0x8a98('0x2d')](_0xa71f4,'no\x20intervals\x20found');}for(var _0x3fe47d=0x0;_0x3fe47d<_0x403298[_0x8a98('0x9e')];_0x3fe47d+=0x1){var _0x18bfaa=this[_0x8a98('0x10')]['getVariable'](util[_0x8a98('0x29')](_0x8a98('0x145'),_0x403298[_0x3fe47d]));if(_0x18bfaa[_0x8a98('0xa6')]===-0x1){return _0x18bfaa;}logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x146'),_0x403298[_0x3fe47d],_0x18bfaa[_0x8a98('0xa8')]));if(_0x18bfaa['extra']===_0x8a98('0x13e')){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x146'),_0x403298[_0x3fe47d],_0x8a98('0x13e')));this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x146'),_0x403298[_0x3fe47d],_0x8a98('0x13e')));return{'code':0xc8,'result':_0x8a98('0x13e')};}else{logger[_0x8a98('0x31')](util['format'](_0x8a98('0x146'),_0x403298[_0x3fe47d],_0x8a98('0x140')));this[_0x8a98('0x10')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x403298[_0x3fe47d],'false'));}}return{'code':0xc8,'result':_0x8a98('0x140')};};AGIVertices[_0x8a98('0x12')][_0x8a98('0x147')]=function(_0x442dd5){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x148'),_0x442dd5[_0x8a98('0x39')]));return this[_0x8a98('0x10')]['hangup']();};AGIVertices[_0x8a98('0x12')]['ispeechasr']=function(_0x427d39){logger['info'](util[_0x8a98('0x29')](_0x8a98('0x149'),_0x427d39[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x427d39[_0x8a98('0x7b')])){return this['channel'][_0x8a98('0xac')](_0x8a98('0xe5'));}var _0x87f439=_0x8a98('0x12d');var _0x16e61c=util[_0x8a98('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x8a98('0x119')](0x4));var _0x5ca3ef=util[_0x8a98('0x29')](_0x8a98('0xa0'),_0x16e61c,_0x87f439);var _0x3ec559=!![];if(_0x427d39[_0x8a98('0x133')]===_0x8a98('0x14a')){_0x3ec559=![];}var _0x433521=this[_0x8a98('0x10')][_0x8a98('0x134')](_0x16e61c,_0x87f439,_0x427d39['intKey'],_0x427d39[_0x8a98('0x66')],undefined,_0x3ec559);if(_0x433521[_0x8a98('0xa6')]!==-0x1){this['channel']['noop'](util[_0x8a98('0x29')](_0x8a98('0x14b'),_0x5ca3ef));var _0x2a2d7c=this[_0x8a98('0x85')][_0x8a98('0x71')](this,_0x427d39,_0x5ca3ef);if(_0x2a2d7c){for(var _0x8494d1 in _0x2a2d7c){if(_0x2a2d7c[_0x8a98('0x99')](_0x8494d1)){this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0x14c'),_0x8494d1[_0x8a98('0x69')]()),_0x2a2d7c[_0x8494d1]);}}return this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x14d'),JSON['stringify'](_0x2a2d7c)));}}return _0x433521;};AGIVertices[_0x8a98('0x12')][_0x8a98('0x14e')]=function(_0x47cab1){logger['info'](util[_0x8a98('0x29')](_0x8a98('0x14f'),_0x47cab1[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x47cab1[_0x8a98('0x7b')])){return this[_0x8a98('0x10')]['noop'](_0x8a98('0xe5'));}if(!this['isConfigured'](_0x47cab1[_0x8a98('0x5d')])){return this['channel'][_0x8a98('0xac')]('no\x20text\x20configured');}this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x150'),_0x47cab1[_0x8a98('0x5d')]));var _0xc015ce=this[_0x8a98('0x81')]['sync'](this,_0x47cab1);if(_0xc015ce){this['channel']['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0xc015ce));var _0x3e7a5b=this['channel'][_0x8a98('0x102')](_0xc015ce,_0x47cab1[_0x8a98('0x12f')]);try{fs[_0x8a98('0x103')](_0xc015ce+'.wav');}catch(_0xa00b20){logger[_0x8a98('0x2d')](_0xa00b20);}return _0x3e7a5b;}return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x47cab1,_0x8a98('0x151'));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x152')]=function(_0x3fb5bb){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x153'),_0x3fb5bb[_0x8a98('0x39')]));if(!this['isConfigured'](_0x3fb5bb['findBy'])){return this['channel']['error'](_0x3fb5bb,_0x8a98('0x154'));}logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x155'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x3fb5bb[_0x8a98('0x156')]));var _0x461869=this['agentLogin'][_0x8a98('0x71')](this,_0x3fb5bb[_0x8a98('0x156')]);if(_0x461869){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x157'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x3fb5bb[_0x8a98('0x156')]));this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x157'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x3fb5bb[_0x8a98('0x156')]));return{'code':0xc8,'result':_0x8a98('0x158')};}else{logger['info'](util[_0x8a98('0x29')](_0x8a98('0x159'),this[_0x8a98('0x10')]['callerid'],_0x3fb5bb[_0x8a98('0x156')]));this['channel']['noop'](util[_0x8a98('0x29')](_0x8a98('0x159'),this[_0x8a98('0x10')]['callerid'],_0x3fb5bb[_0x8a98('0x156')]));return{'code':0xc8,'result':_0x8a98('0x15a')};}};AGIVertices['prototype'][_0x8a98('0x15b')]=function(_0x28fb9f){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x15c'),_0x28fb9f['label']));if(!this[_0x8a98('0x86')](_0x28fb9f[_0x8a98('0x156')])){return this['channel']['error'](_0x28fb9f,'no\x20find\x20by\x20configured');}logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x155'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x28fb9f['findBy']));var _0x2d35ac=this[_0x8a98('0x54')][_0x8a98('0x71')](this,_0x28fb9f[_0x8a98('0x156')]);if(_0x2d35ac){logger[_0x8a98('0x31')](util['format'](_0x8a98('0x157'),this[_0x8a98('0x10')]['callerid'],_0x28fb9f['findBy']));this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x157'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x28fb9f[_0x8a98('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x159'),this['channel']['callerid'],_0x28fb9f[_0x8a98('0x156')]));this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x159'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x28fb9f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8a98('0x15d')]=function(_0x16339b){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x15e'),_0x16339b[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x16339b[_0x8a98('0x15f')])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x16339b,'no\x20operation\x20configured');}this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x160'),_0x16339b[_0x8a98('0x15f')]));var _0x19c269=eval(_0x16339b[_0x8a98('0x15f')]);if(!this['isConfigured'](_0x16339b[_0x8a98('0xd4')])){return this[_0x8a98('0x10')][_0x8a98('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3b6f9b=this[_0x8a98('0x13')][_0x8a98('0x71')](this,_0x16339b[_0x8a98('0xd4')]);if(!_0x3b6f9b){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x16339b,_0x8a98('0xd6'));}if(_[_0x8a98('0xa1')](_0x19c269)){var _0x5115a5=this;_0x19c269[_0x8a98('0xd7')](function(_0x4969b9,_0x5d0cc4){_0x5115a5[_0x8a98('0x10')]['setVariable'](util['format'](_0x8a98('0x161'),_0x3b6f9b,_0x5d0cc4),_0x4969b9);});return this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')]('variable\x20%s[key]\x20set',_0x3b6f9b));}else{return this[_0x8a98('0x10')][_0x8a98('0xa2')](_0x3b6f9b,_0x19c269);}};AGIVertices[_0x8a98('0x12')][_0x8a98('0xe')]=function(_0x1b5f20){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x162'),_0x1b5f20[_0x8a98('0x39')]));if(_0x1b5f20[_0x8a98('0xa9')]===0x0){return this[_0x8a98('0xaa')](_0x1b5f20);}_0x1b5f20[_0x8a98('0xa9')]-=0x1;if(!this[_0x8a98('0x86')](_0x1b5f20[_0x8a98('0x111')])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x1b5f20,_0x8a98('0x163'));}var _0x160da5=this[_0x8a98('0x20')][_0x8a98('0x71')](this,_0x1b5f20['file_id']);if(!_0x160da5){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x1b5f20,_0x8a98('0x112'));}var _0x4df310=this[_0x8a98('0x10')]['getData'](_0x160da5,_0x1b5f20['response'],_0x1b5f20['digit']);var _0x4d9609=_0x4df310['result'];if(_0x4df310[_0x8a98('0xa6')]===-0x1){this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x1b5f20,'-1');return _0x4df310;}else if(_0x4df310[_0x8a98('0xa8')]==='timeout'){_0x4df310[_0x8a98('0xa6')]=_0x4df310[_0x8a98('0xa6')]['length']>0x0?_0x4df310[_0x8a98('0xa6')]:'t';}else if(_[_0x8a98('0x45')](_0x4df310[_0x8a98('0xa6')])){_0x4df310[_0x8a98('0xa6')]='#';_0x4d9609='#';}if(!this[_0x8a98('0x86')](_0x1b5f20[_0x8a98('0xd4')])){this[_0x8a98('0x10')]['noop'](_0x8a98('0xd5'));}else{var _0x23772f=this[_0x8a98('0x13')][_0x8a98('0x71')](this,_0x1b5f20[_0x8a98('0xd4')]);if(!_0x23772f){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x1b5f20,_0x8a98('0xd6'));}this[_0x8a98('0x10')]['setVariable'](_0x23772f,_0x4d9609);}this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x1b5f20,_0x4d9609);return _0x4df310;};AGIVertices[_0x8a98('0x12')][_0x8a98('0xac')]=function(_0x410288){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x164'),_0x410288[_0x8a98('0x39')]));return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x410288[_0x8a98('0x165')]||_0x410288[_0x8a98('0x39')]);};AGIVertices[_0x8a98('0x12')][_0x8a98('0x166')]=function(_0x332465){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x167'),_0x332465['label']));if(!this[_0x8a98('0x86')](_0x332465['findBy'])){return this[_0x8a98('0x10')]['error'](_0x332465,_0x8a98('0x154'));}logger[_0x8a98('0x31')](util[_0x8a98('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x332465[_0x8a98('0x156')]));var _0xe8b692=this[_0x8a98('0x4f')][_0x8a98('0x71')](this,_0x332465[_0x8a98('0x168')]);var _0x27d155=this['agentPause'][_0x8a98('0x71')](this,_0x332465['findBy'],_0xe8b692);if(_0x27d155){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x157'),this['channel'][_0x8a98('0x3b')],_0x332465[_0x8a98('0x156')]));this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x157'),this[_0x8a98('0x10')]['callerid'],_0x332465[_0x8a98('0x156')]));return{'code':0xc8,'result':_0x8a98('0x158')};}else{logger[_0x8a98('0x31')](util['format'](_0x8a98('0x159'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x332465['findBy']));this['channel']['noop'](util[_0x8a98('0x29')](_0x8a98('0x157'),this['channel'][_0x8a98('0x3b')],_0x332465['findBy']));return{'code':0xc8,'result':_0x8a98('0x15a')};}};AGIVertices[_0x8a98('0x12')][_0x8a98('0x169')]=function(_0x2ac62a){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x16a'),_0x2ac62a[_0x8a98('0x39')]));if(!this['isConfigured'](_0x2ac62a['file_id'])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x2ac62a,_0x8a98('0x163'));}var _0x4752d2=this['getSound'][_0x8a98('0x71')](this,_0x2ac62a[_0x8a98('0x111')]);if(!_0x4752d2){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x2ac62a,'no\x20file\x20audio\x20found');}var _0x5dd484=this[_0x8a98('0x10')]['exec'](_0x8a98('0x16b'),[_0x4752d2,_0x2ac62a['opts']]);if(_0x5dd484[_0x8a98('0xa6')]===-0x1){return _0x5dd484;}return this['channel'][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xc2'),_0x8a98('0x16b'),_0x4752d2));};AGIVertices[_0x8a98('0x12')]['queue']=function(_0x1b4093){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x16c'),_0x1b4093[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x1b4093['queue_id'])){return this[_0x8a98('0x10')]['error'](_0x1b4093,_0x8a98('0x16d'));}var _0xc4a16e='';var _0x3ae72e=parseInt(_0x1b4093[_0x8a98('0x16e')],0xa);if(isNaN(_0x3ae72e)){_0xc4a16e=_0x1b4093[_0x8a98('0x16e')];}else{_0xc4a16e=this[_0x8a98('0x17')][_0x8a98('0x71')](this,_0x1b4093['queue_id']);if(!_0xc4a16e){return this[_0x8a98('0x10')]['error'](_0x1b4093,'no\x20queue\x20found');}}var _0x369ab5='';if(this[_0x8a98('0x86')](_0x1b4093['file_id'])){var _0x25adf2=this[_0x8a98('0x20')]['sync'](this,_0x1b4093[_0x8a98('0x111')]);if(_0x25adf2){_0x369ab5=_0x25adf2;}}this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x1b4093,_0xc4a16e);if(_0x1b4093[_0x8a98('0xe2')][_0x8a98('0x16f')]('x')<0x0){_0x1b4093[_0x8a98('0xe2')]+='x';}if(_0x1b4093['opts']['indexOf']('X')<0x0){_0x1b4093[_0x8a98('0xe2')]+='X';}this[_0x8a98('0x10')]['setVariable'](_0x8a98('0x170'),_0xc4a16e?_0xc4a16e[_0x8a98('0x171')]():'');var _0x250556=this[_0x8a98('0x10')]['exec'](_0x8a98('0x172'),[_0xc4a16e,_0x1b4093[_0x8a98('0xe2')],_0x1b4093[_0x8a98('0x64')],_0x369ab5,_0x1b4093[_0x8a98('0x66')],_0x1b4093[_0x8a98('0x8')],_0x1b4093[_0x8a98('0x173')],_0x1b4093[_0x8a98('0x174')],'',_0x1b4093[_0x8a98('0x175')]]);if(_0x250556[_0x8a98('0xa6')]===-0x1){return _0x250556;}return this['channel'][_0x8a98('0xac')](util['format']('Executed\x20command\x20%s\x20%s',_0x8a98('0x172'),_0xc4a16e));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x176')]=function(_0x14345d){logger['info'](util[_0x8a98('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x14345d['label']));var _0x307b12=_0x14345d[_0x8a98('0x177')]||_0x8a98('0x12d');var _0x33833c=util['format'](_0x8a98('0x178'),this['channel']['uniqueid'],rs[_0x8a98('0x119')](0x5));var _0x1ee1d9=util[_0x8a98('0x29')](_0x8a98('0x179'),FILES_PATH,_0x33833c,_0x307b12);var _0x120752=util[_0x8a98('0x29')]('%s/recordings/%s',FILES_PATH,_0x33833c);this[_0x8a98('0x3c')]['sync'](this,_0x14345d,_0x33833c,_0x1ee1d9);this['channel'][_0x8a98('0xa2')](_0x8a98('0x17a'),_0x33833c);logger[_0x8a98('0x31')](_0x8a98('0x17b'),_0x120752,_0x307b12,_0x14345d[_0x8a98('0x17c')],_0x14345d['timeout']);return this[_0x8a98('0x10')]['recordFile'](_0x120752,_0x307b12,_0x14345d[_0x8a98('0x17c')],_0x14345d[_0x8a98('0x66')],undefined,!![]);};AGIVertices[_0x8a98('0x12')][_0x8a98('0x17d')]=function(_0x19dfb2){logger['info'](util[_0x8a98('0x29')](_0x8a98('0x17e'),_0x19dfb2[_0x8a98('0x39')]));if(!this['isConfigured'](_0x19dfb2['url'])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0x17f'));}var _0x19413f=this[_0x8a98('0x180')][_0x8a98('0x71')](this,_0x19dfb2);logger[_0x8a98('0x31')](util['format'](_0x8a98('0x181'),util[_0x8a98('0x182')](_0x19413f,{'showHidden':![],'depth':null})));if(!this[_0x8a98('0x86')](_0x19dfb2['variable_id'])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0x183'));}var _0x58352a=this[_0x8a98('0x13')][_0x8a98('0x71')](this,_0x19dfb2[_0x8a98('0xd4')]);if(!_0x58352a){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x19dfb2,'no\x20variable\x20found');}this[_0x8a98('0x10')][_0x8a98('0xa2')](util[_0x8a98('0x29')](_0x8a98('0x184'),_0x58352a),_0x19413f[_0x8a98('0x76')]?_0x19413f[_0x8a98('0x76')]:_0x8a98('0x185'));this['channel']['setVariable'](util[_0x8a98('0x29')](_0x8a98('0x186'),_0x58352a),_0x19413f['statusMessage']?_0x19413f[_0x8a98('0x77')]:'OK');if(_0x19413f[_0x8a98('0x6a')]){try{this[_0x8a98('0x9f')](_0x19413f['body'],_0x58352a);}catch(_0x211a9f){logger['error'](util[_0x8a98('0x29')](_0x8a98('0x187'),_0x58352a));}}return this['channel']['noop'](util['format'](_0x8a98('0xdb'),_0x58352a));};AGIVertices[_0x8a98('0x12')]['saydigits']=function(_0x5ce9b2){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5ce9b2[_0x8a98('0x39')]));return this['channel'][_0x8a98('0x188')](_0x5ce9b2[_0x8a98('0x189')][_0x8a98('0x59')](/\s+/g,''),_0x5ce9b2[_0x8a98('0x17c')]);};AGIVertices[_0x8a98('0x12')][_0x8a98('0x18a')]=function(_0x26fc4c){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x18b'),_0x26fc4c[_0x8a98('0x39')]));return this[_0x8a98('0x10')][_0x8a98('0x18c')](_0x26fc4c[_0x8a98('0x18d')][_0x8a98('0x59')](/\s+/g,''),_0x26fc4c[_0x8a98('0x17c')]);};AGIVertices['prototype']['sayphonetic']=function(_0x1b80c3){logger[_0x8a98('0x31')](util['format'](_0x8a98('0x18e'),_0x1b80c3['label']));return this['channel'][_0x8a98('0x18f')](_0x1b80c3[_0x8a98('0x5d')],_0x1b80c3[_0x8a98('0x17c')]);};AGIVertices[_0x8a98('0x12')][_0x8a98('0x190')]=function(_0x176575){logger[_0x8a98('0x31')](util['format'](_0x8a98('0x191'),_0x176575['label']));if(!this[_0x8a98('0x86')](_0x176575[_0x8a98('0x192')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0x193'));}var _0x2317a0=this['getMailAccount'][_0x8a98('0x71')](this,_0x176575['account_id']);if(!_0x2317a0||!_0x2317a0['Smtp']){return this['channel'][_0x8a98('0x2d')](_0x176575,'no\x20mail\x20account\x20found');}var _0x17c55b={'from':util['format'](_0x8a98('0x194'),_0x2317a0[_0x8a98('0x16')],_0x2317a0[_0x8a98('0x195')]||_0x2317a0[_0x8a98('0x196')][_0x8a98('0x197')]),'to':_0x176575['to']||'','cc':_0x176575['cc']||'','bcc':_0x176575['bcc']||'','subject':_0x176575['subject'],'html':_0x176575['text'],'text':_0x176575[_0x8a98('0x5d')]};if(this['isConfigured'](_0x176575['template_id'])){}logger[_0x8a98('0xdc')](_0x8a98('0x198'),JSON[_0x8a98('0x74')](_0x17c55b));this[_0x8a98('0x38')]['sync'](this,_0x176575,_0x176575[_0x8a98('0x192')]);this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x2317a0[_0x8a98('0x16')]));this['sendMailMessage'][_0x8a98('0x71')](this,_0x2317a0[_0x8a98('0x199')],_0x17c55b);return this[_0x8a98('0x10')]['noop'](_0x8a98('0x19a'));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x19b')]=function(_0x10aab5){logger['info'](util[_0x8a98('0x29')](_0x8a98('0x19c'),_0x10aab5[_0x8a98('0x39')]));return this[_0x8a98('0x10')][_0x8a98('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x8a98('0x12')]['sendSMS']=function(_0xabc295){logger['info'](util[_0x8a98('0x29')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xabc295[_0x8a98('0x39')]));if(!this['isConfigured'](_0xabc295['sms_account_id'])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0x19d'));}var _0x4bdea5=this[_0x8a98('0x36')]['sync'](this,_0xabc295[_0x8a98('0x19e')]);if(!_0x4bdea5){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0xabc295,'no\x20sms\x20account\x20found');}var _0x3a4bb5={'body':_0xabc295[_0x8a98('0x19f')],'phone':_0xabc295['to']||'','SmsAccountId':_0x4bdea5['id']};logger[_0x8a98('0xdc')](_0x8a98('0x1a0'),JSON[_0x8a98('0x74')](_0x3a4bb5));this[_0x8a98('0x38')]['sync'](this,_0xabc295,_0xabc295[_0x8a98('0x19e')]);this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x1a1'),_0x4bdea5[_0x8a98('0x16')]));this[_0x8a98('0x37')][_0x8a98('0x71')](this,_0x3a4bb5);return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0x1a2'));};AGIVertices[_0x8a98('0x12')]['set']=function(_0x383aec){logger['info'](util[_0x8a98('0x29')](_0x8a98('0x1a3'),_0x383aec['label']));if(!this[_0x8a98('0x86')](_0x383aec[_0x8a98('0xd4')])){return this['channel'][_0x8a98('0x2d')](_0x383aec,'no\x20variable\x20selected');}var _0x12b780=this[_0x8a98('0x13')]['sync'](this,_0x383aec[_0x8a98('0xd4')]);if(!_0x12b780){return this['channel'][_0x8a98('0x2d')](_0x383aec,_0x8a98('0xd6'));}return this['channel'][_0x8a98('0xa2')](_0x12b780,_0x383aec[_0x8a98('0x1a4')]);};AGIVertices[_0x8a98('0x12')][_0x8a98('0x1a5')]=function(_0x3028d7){logger['info'](util[_0x8a98('0x29')](_0x8a98('0x1a6'),_0x3028d7['label']));this[_0x8a98('0x10')][_0x8a98('0xac')]('START\x20CALLY\x20SQUARE');if(_0x3028d7['answer']===_0x8a98('0x1a7')){this['channel'][_0x8a98('0xac')](_0x8a98('0x1a8'));return this[_0x8a98('0x10')]['answer']();}return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0x1a9'));};AGIVertices[_0x8a98('0x12')]['subproject']=function(_0x534527){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x1aa'),_0x534527[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x534527['project_id'])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x534527,'no\x20subproject\x20selected');}var _0x20f586=this[_0x8a98('0x1a')]['sync'](this,_0x534527[_0x8a98('0x1ab')]);if(!this[_0x8a98('0x86')](_0x20f586)){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x534527,util[_0x8a98('0x29')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x534527[_0x8a98('0x1ab')]));}if(_0x20f586===this['channel']['arg_1']){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x534527,_0x8a98('0x1ac'));}this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x534527,_0x20f586);var _0x5e6acf=this[_0x8a98('0x10')][_0x8a98('0xae')](_0x8a98('0x1ad'),util[_0x8a98('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x8a98('0x8')][_0x8a98('0x1ae')]||'127.0.0.1',_0x20f586,this[_0x8a98('0x10')][_0x8a98('0x3a')]));if(_0x5e6acf[_0x8a98('0xa6')]===-0x1){return _0x5e6acf;}return this['channel'][_0x8a98('0xac')](util['format'](_0x8a98('0xc2'),_0x8a98('0x1ad'),_0x20f586));};AGIVertices[_0x8a98('0x12')]['system']=function(_0x48e7e0){logger['info'](util[_0x8a98('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x48e7e0['label']));var _0x57789f=this[_0x8a98('0x57')][_0x8a98('0x71')](this,_0x48e7e0[_0x8a98('0x1af')]);this[_0x8a98('0x38')][_0x8a98('0x71')](this,_0x48e7e0,_0x48e7e0[_0x8a98('0x1af')]);if(this['isConfigured'](_0x48e7e0[_0x8a98('0xd4')])){var _0x3fd35b=this[_0x8a98('0x13')]['sync'](this,_0x48e7e0[_0x8a98('0xd4')]);if(_0x3fd35b){this[_0x8a98('0x10')][_0x8a98('0xa2')](_0x3fd35b,_0x57789f);return this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x1b0'),_0x48e7e0[_0x8a98('0x1af')],_0x3fd35b));}}return this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x1b1'),_0x48e7e0['command']));};AGIVertices['prototype'][_0x8a98('0x1b2')]=function(_0x43d362){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x1b3'),_0x43d362[_0x8a98('0x39')]));_0x43d362[_0x8a98('0x5d')]=_0x43d362['text'][_0x8a98('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8a98('0x86')](_0x43d362[_0x8a98('0x5b')])){return this[_0x8a98('0x10')]['noop'](_0x8a98('0x1b4'));}if(!this[_0x8a98('0x86')](_0x43d362[_0x8a98('0x5d')])){return this[_0x8a98('0x10')][_0x8a98('0xac')](_0x8a98('0xad'));}this['channel']['noop'](util[_0x8a98('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x43d362['text']));var _0x131b30=this[_0x8a98('0x5a')][_0x8a98('0x71')](this,_0x43d362);if(_0x131b30){this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')](_0x8a98('0x1b5'),_0x131b30));var _0x24412a=this[_0x8a98('0x10')][_0x8a98('0x102')](_0x131b30);try{fs[_0x8a98('0x103')](_0x131b30+_0x8a98('0x124'));}catch(_0x449063){logger[_0x8a98('0x2d')](_0x449063);}return _0x24412a;}return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x43d362,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8a98('0x12')][_0x8a98('0x1b6')]=function(_0x24e79c){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x1b7'),_0x24e79c[_0x8a98('0x39')]));_0x24e79c['text']=_0x24e79c[_0x8a98('0x5d')][_0x8a98('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8a98('0x86')](_0x24e79c[_0x8a98('0x5d')])){return this[_0x8a98('0x10')][_0x8a98('0xac')]('no\x20text\x20configured');}this[_0x8a98('0x10')]['noop'](util[_0x8a98('0x29')](_0x8a98('0x1b8'),_0x24e79c[_0x8a98('0x5d')]));var _0x5d4a31=this['googleTTS']['sync'](this,_0x24e79c);if(_0x5d4a31){this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x1b9'),_0x5d4a31));var _0x37f5a5=this[_0x8a98('0x10')][_0x8a98('0x102')](_0x5d4a31);try{fs['unlink'](_0x5d4a31+_0x8a98('0x124'));}catch(_0xcf1a44){logger[_0x8a98('0x2d')](_0xcf1a44);}return _0x37f5a5;}return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x24e79c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8a98('0x12')][_0x8a98('0x1ba')]=function(_0x98f50f){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x1bb'),_0x98f50f[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x98f50f['findBy'])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x98f50f,_0x8a98('0x154'));}logger[_0x8a98('0x31')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a98('0x10')]['callerid'],_0x98f50f[_0x8a98('0x156')]));var _0x58069f=this[_0x8a98('0x53')][_0x8a98('0x71')](this,_0x98f50f[_0x8a98('0x156')]);if(_0x58069f){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x157'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x98f50f[_0x8a98('0x156')]));this[_0x8a98('0x10')][_0x8a98('0xac')](util['format'](_0x8a98('0x157'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x98f50f[_0x8a98('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x159'),this[_0x8a98('0x10')]['callerid'],_0x98f50f['findBy']));this['channel'][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0x159'),this[_0x8a98('0x10')][_0x8a98('0x3b')],_0x98f50f[_0x8a98('0x156')]));return{'code':0xc8,'result':_0x8a98('0x15a')};}};AGIVertices['prototype'][_0x8a98('0x1bc')]=function(_0x5cf7bd){logger[_0x8a98('0x31')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5cf7bd[_0x8a98('0x39')]));var _0x50085c=this[_0x8a98('0x10')][_0x8a98('0xae')](_0x8a98('0x1bd'),[_0x5cf7bd[_0x8a98('0x1be')],_0x5cf7bd['options']]);if(_0x50085c[_0x8a98('0xa6')]===-0x1){return _0x50085c;}return this[_0x8a98('0x10')][_0x8a98('0xac')](util[_0x8a98('0x29')](_0x8a98('0xc2'),_0x8a98('0x1bd'),_0x5cf7bd[_0x8a98('0x1be')]));};AGIVertices[_0x8a98('0x12')][_0x8a98('0x1bf')]=function(_0x71e13){logger[_0x8a98('0x31')](util[_0x8a98('0x29')](_0x8a98('0x1c0'),_0x71e13[_0x8a98('0x39')]));if(!this[_0x8a98('0x86')](_0x71e13[_0x8a98('0xd4')])){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x71e13,'no\x20variable\x20selected');}var _0x470ea3=this[_0x8a98('0x13')]['sync'](this,_0x71e13[_0x8a98('0xd4')]);if(!_0x470ea3){return this[_0x8a98('0x10')][_0x8a98('0x2d')](_0x71e13,_0x8a98('0xd6'));}var _0x491172=this[_0x8a98('0x10')][_0x8a98('0x13')](_0x470ea3);return{'code':0xc8,'result':_0x491172['extra']?_0x491172['extra']:'-'};};String['prototype'][_0x8a98('0xa4')]=function(_0x2dc394,_0x3a6437){return this[_0x8a98('0xa3')](_0x2dc394)[_0x8a98('0x1c1')](_0x3a6437);};module[_0x8a98('0x1c2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 2e6bc81..a877578 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde69=['agents','timers','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','update','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','message','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues'];(function(_0x5201d2,_0x31ff3a){var _0x1d0440=function(_0x5f1d87){while(--_0x5f1d87){_0x5201d2['push'](_0x5201d2['shift']());}};_0x1d0440(++_0x31ff3a);}(_0xde69,0x19d));var _0x9de6=function(_0x5326df,_0x4babd6){_0x5326df=_0x5326df-0x0;var _0x6a86fd=_0xde69[_0x5326df];return _0x6a86fd;};'use strict';var _=require(_0x9de6('0x0'));var moment=require(_0x9de6('0x1'));var ami=require(_0x9de6('0x2'));var logger=require(_0x9de6('0x3'))(_0x9de6('0x4'));var RpcUser=require(_0x9de6('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x90a3ee){this[_0x9de6('0x6')]=_0x90a3ee[_0x9de6('0x6')];this[_0x9de6('0x7')]=_0x90a3ee['agents'];this[_0x9de6('0x8')]=_0x90a3ee[_0x9de6('0x8')];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x9de6('0x9')](this));ami['on'](_0x9de6('0xa'),this['syncHangupRequest'][_0x9de6('0x9')](this));ami['on'](_0x9de6('0xb'),this[_0x9de6('0xc')]['bind'](this));ami['on'](_0x9de6('0xd'),this[_0x9de6('0xe')][_0x9de6('0x9')](this));ami['on'](_0x9de6('0xf'),this['syncAttendedTransfer'][_0x9de6('0x9')](this));ami['on']('blindtransfer',this[_0x9de6('0x10')][_0x9de6('0x9')](this));ami['on'](_0x9de6('0x11'),this[_0x9de6('0x12')][_0x9de6('0x9')](this));}function getDiff(_0x5d1151){var _0x254543=moment()['milliseconds'](0x0);var _0x2062d1=moment(_0x5d1151)[_0x9de6('0x13')](0x0);return _0x254543[_0x9de6('0x14')](_0x2062d1,_0x9de6('0x15'));}Acw['prototype'][_0x9de6('0x16')]=function(_0x1a8650){try{var _0x54470f=this;var _0x58cff6=this[_0x9de6('0x17')][_0x1a8650][_0x9de6('0x18')];var _0x3997ff=this[_0x9de6('0x17')][_0x1a8650][_0x9de6('0x19')];var _0x5c8b4e=this[_0x9de6('0x6')][_0x3997ff];var _0x1dcc36=![];var _0x9ab5a8=_0x9de6('0x1a');if(_0x5c8b4e[_0x9de6('0x1b')]){if(_0x5c8b4e[_0x9de6('0x1c')][_0x9de6('0x1d')]){_0x1dcc36=!![];_0x9ab5a8=_0x5c8b4e['mandatoryDispositionPause'][_0x9de6('0x1d')];}}return ami[_0x9de6('0x1e')]({'action':_0x9de6('0x1f'),'interface':_0x58cff6,'paused':!![],'reason':_0x9ab5a8})[_0x9de6('0x20')](function(){if(_0x54470f[_0x9de6('0x7')][_0x58cff6]){return RpcUser[_0x9de6('0x21')](_0x54470f[_0x9de6('0x7')][_0x58cff6]['id'])[_0x9de6('0x20')](function(_0x46ba01){if(_0x46ba01&&!_0x46ba01['voicePause']){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x1a8650,_0x58cff6,_0x3997ff);var _0x259ed2=_0x54470f[_0x9de6('0x17')][_0x1a8650]['attended']&&_0x54470f[_0x9de6('0x17')][_0x1a8650]['destlinkedid']?_0x54470f[_0x9de6('0x17')][_0x1a8650]['destlinkedid']:_0x1a8650;return RpcUser['savePause'](_0x54470f[_0x9de6('0x7')][_0x58cff6],_0x9ab5a8,_0x259ed2)[_0x9de6('0x20')](function(){if(!_0x1dcc36){_0x54470f['timers'][_0x58cff6]={};logger[_0x9de6('0x22')](_0x9de6('0x23'),_0x1a8650,_0x54470f['voiceQueues'][_0x3997ff][_0x9de6('0x24')],_0x58cff6,_0x3997ff);_0x54470f[_0x9de6('0x8')][_0x58cff6][_0x9de6('0x25')]=setTimeout(_0x54470f[_0x9de6('0x26')]['bind'](_0x54470f,_0x58cff6),_0x54470f['voiceQueues'][_0x3997ff][_0x9de6('0x24')]*0x3e8);_0x54470f[_0x9de6('0x8')][_0x58cff6]['lastPauseAt']=moment()['format'](_0x9de6('0x27'));_0x54470f['timers'][_0x58cff6][_0x9de6('0x28')]=_0x1a8650;_0x54470f[_0x9de6('0x8')][_0x58cff6][_0x9de6('0x19')]=_0x3997ff;_0x54470f['timers'][_0x58cff6][_0x9de6('0x29')]=function(){var _0x1bfa40=getDiff(_0x54470f[_0x9de6('0x8')][_0x58cff6][_0x9de6('0x2a')]);clearTimeout(_0x54470f['timers'][_0x58cff6][_0x9de6('0x25')]);_0x54470f[_0x9de6('0x8')][_0x58cff6][_0x9de6('0x25')]=![];RpcVoiceAgentReport[_0x9de6('0x2b')]({'acwtime':_0x1bfa40},_0x54470f[_0x9de6('0x8')][_0x58cff6][_0x9de6('0x28')],_0x58cff6)[_0x9de6('0x20')](function(_0x55927e){logger[_0x9de6('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x1a8650,_0x1bfa40,_0x55927e);})['catch'](function(_0x5f7ce4){logger[_0x9de6('0x2c')](_0x9de6('0x2d'),_0x1a8650,_0x5f7ce4);});delete _0x54470f['timers'][_0x58cff6];};}});}else{logger[_0x9de6('0x22')](_0x9de6('0x2e'),_0x1a8650,_0x58cff6,_0x3997ff);}});}})[_0x9de6('0x2f')](function(){logger[_0x9de6('0x2c')](_0x9de6('0x23'),_0x1a8650,_0x54470f[_0x9de6('0x6')][_0x3997ff][_0x9de6('0x24')],_0x58cff6,_0x3997ff);})[_0x9de6('0x30')](function(){delete _0x54470f[_0x9de6('0x17')][_0x1a8650];});}catch(_0x4fc02b){logger[_0x9de6('0x2c')]('[ACW][START]\x20%s',_0x4fc02b['message']);}};Acw[_0x9de6('0x31')][_0x9de6('0x26')]=function(_0x1c9c12){try{var _0x561677=this;if(_0x561677[_0x9de6('0x8')][_0x1c9c12]){_0x561677[_0x9de6('0x8')][_0x1c9c12]['timer']=![];var _0x58fc19=_0x561677[_0x9de6('0x8')][_0x1c9c12]['uniqueid'];var _0x9a2a5d=_0x561677[_0x9de6('0x8')][_0x1c9c12]['queue'];var _0x4c3bb0=_0x561677[_0x9de6('0x6')][_0x9a2a5d]['acwTimeout'];logger[_0x9de6('0x22')](_0x9de6('0x32'),_0x58fc19,_0x1c9c12);RpcUser[_0x9de6('0x33')](this[_0x9de6('0x7')][_0x1c9c12]);RpcVoiceAgentReport[_0x9de6('0x2b')]({'acwtime':_0x4c3bb0,'agentacw':!![]},_0x58fc19,_0x1c9c12)[_0x9de6('0x20')](function(_0x17054f){logger[_0x9de6('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x58fc19,_0x4c3bb0,_0x17054f);})[_0x9de6('0x2f')](function(_0x8530b5){logger[_0x9de6('0x2c')](_0x9de6('0x2d'),_0x58fc19,_0x8530b5);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1c9c12);if(_0x561677[_0x9de6('0x8')]){logger[_0x9de6('0x22')](_0x9de6('0x34'),JSON['stringify'](_0x561677[_0x9de6('0x8')]));}}}catch(_0x47d8f0){logger['error'](_0x9de6('0x35'),_0x47d8f0['message']);}};Acw[_0x9de6('0x31')][_0x9de6('0x36')]=function(_0x3a812f){try{if(this[_0x9de6('0x6')][_0x3a812f['queue']]&&(this['voiceQueues'][_0x3a812f[_0x9de6('0x19')]][_0x9de6('0x4')]||this[_0x9de6('0x6')][_0x3a812f[_0x9de6('0x19')]][_0x9de6('0x1b')])){if(this[_0x9de6('0x7')][_0x3a812f['interface']]){this[_0x9de6('0x17')][_0x3a812f['uniqueid']]={'queue':_0x3a812f[_0x9de6('0x19')],'interface':_0x3a812f[_0x9de6('0x18')],'destlinkedid':_0x3a812f['destlinkedid']};}}}catch(_0x48c40f){logger[_0x9de6('0x2c')]('[ACW][syncAgentConnect]\x20%s',_0x48c40f[_0x9de6('0x37')]);}};Acw[_0x9de6('0x31')][_0x9de6('0x12')]=function(_0x71f04b){try{if(this[_0x9de6('0x6')][_0x71f04b[_0x9de6('0x19')]]&&(this[_0x9de6('0x6')][_0x71f04b['queue']][_0x9de6('0x4')]||this[_0x9de6('0x6')][_0x71f04b['queue']][_0x9de6('0x1b')])){if(this['agents'][_0x71f04b['interface']]){this['channels'][_0x71f04b[_0x9de6('0x28')]]={'queue':_0x71f04b[_0x9de6('0x19')],'interface':_0x71f04b['interface']};}}}catch(_0xa8cf26){logger[_0x9de6('0x2c')](_0x9de6('0x38'),_0xa8cf26['message']);}};Acw[_0x9de6('0x31')]['syncHangupRequest']=function(_0x342678){try{if(this[_0x9de6('0x17')][_0x342678[_0x9de6('0x28')]]&&_[_0x9de6('0x39')](this['channels'][_0x342678[_0x9de6('0x28')]][_0x9de6('0x3a')])){logger['info'](_0x9de6('0x3b'),_0x342678['uniqueid']);this[_0x9de6('0x16')](_0x342678[_0x9de6('0x28')]);}else if(this['channels'][_0x342678[_0x9de6('0x3c')]]&&_[_0x9de6('0x39')](this[_0x9de6('0x17')][_0x342678['linkedid']]['attended'])){logger[_0x9de6('0x22')]('[%s][HANGUP:LINKEDID]',_0x342678[_0x9de6('0x3c')]);this[_0x9de6('0x16')](_0x342678[_0x9de6('0x3c')]);}}catch(_0x345b7f){logger[_0x9de6('0x2c')](_0x9de6('0x3d'),_0x345b7f[_0x9de6('0x37')]);}};Acw['prototype'][_0x9de6('0xc')]=function(_0x3de11c){try{if(this[_0x9de6('0x17')][_0x3de11c[_0x9de6('0x28')]]&&this[_0x9de6('0x17')][_0x3de11c[_0x9de6('0x28')]][_0x9de6('0x3a')]){logger[_0x9de6('0x22')](_0x9de6('0x3e'),_0x3de11c[_0x9de6('0x28')]);this[_0x9de6('0x16')](_0x3de11c['uniqueid']);}else if(this[_0x9de6('0x17')][_0x3de11c[_0x9de6('0x3c')]]&&this[_0x9de6('0x17')][_0x3de11c[_0x9de6('0x3c')]][_0x9de6('0x3a')]){logger[_0x9de6('0x22')](_0x9de6('0x3f'),_0x3de11c[_0x9de6('0x3c')]);this[_0x9de6('0x16')](_0x3de11c[_0x9de6('0x3c')]);}}catch(_0x20b36b){logger[_0x9de6('0x2c')](_0x9de6('0x40'),_0x20b36b[_0x9de6('0x37')]);}};Acw[_0x9de6('0x31')][_0x9de6('0x41')]=function(_0x5148c1){try{if(!_[_0x9de6('0x42')](this[_0x9de6('0x17')][_0x5148c1['transfereeuniqueid']])){this[_0x9de6('0x16')](_0x5148c1[_0x9de6('0x43')]);if(this[_0x9de6('0x17')][_0x5148c1[_0x9de6('0x44')]]){this[_0x9de6('0x17')][_0x5148c1[_0x9de6('0x44')]]['attended']=!![];this[_0x9de6('0x17')][_0x5148c1[_0x9de6('0x45')]]=this[_0x9de6('0x17')][_0x5148c1[_0x9de6('0x44')]];delete this['channels'][_0x5148c1[_0x9de6('0x44')]];}}else if(!_[_0x9de6('0x42')](this['channels'][_0x5148c1[_0x9de6('0x45')]])){this[_0x9de6('0x16')](_0x5148c1['transfertargetuniqueid']);if(this[_0x9de6('0x17')][_0x5148c1[_0x9de6('0x46')]]){this[_0x9de6('0x17')][_0x5148c1['origtransfereruniqueid']][_0x9de6('0x3a')]=!![];this['channels'][_0x5148c1[_0x9de6('0x43')]]=this[_0x9de6('0x17')][_0x5148c1[_0x9de6('0x46')]];delete this['channels'][_0x5148c1[_0x9de6('0x46')]];}}}catch(_0x538761){logger[_0x9de6('0x2c')](_0x9de6('0x47'),_0x538761[_0x9de6('0x37')]);}};Acw[_0x9de6('0x31')][_0x9de6('0x10')]=function(_0x270d9d){try{if(this['channels'][_0x270d9d[_0x9de6('0x48')]]){logger['info'](_0x9de6('0x49'),JSON[_0x9de6('0x4a')](_0x270d9d['transfereruniqueid']));this['startAcw'](_0x270d9d[_0x9de6('0x48')]);}else if(this[_0x9de6('0x17')][_0x270d9d[_0x9de6('0x4b')]]){logger['info'](_0x9de6('0x4c'),JSON[_0x9de6('0x4a')](_0x270d9d[_0x9de6('0x4b')]));this[_0x9de6('0x16')](_0x270d9d['transfererlinkedid']);}}catch(_0x191e6e){logger['error'](_0x9de6('0x4d'),_0x191e6e[_0x9de6('0x37')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x24ebeb){try{if(this[_0x9de6('0x6')][_0x24ebeb[_0x9de6('0x19')]]&&this[_0x9de6('0x6')][_0x24ebeb[_0x9de6('0x19')]][_0x9de6('0x4e')]==='all'){if(this['agents'][_0x24ebeb[_0x9de6('0x18')]]){logger[_0x9de6('0x22')](_0x9de6('0x4f'),_0x24ebeb[_0x9de6('0x28')],_0x24ebeb[_0x9de6('0x18')],_0x24ebeb[_0x9de6('0x19')]);return RpcUser[_0x9de6('0x50')](this[_0x9de6('0x7')][_0x24ebeb[_0x9de6('0x18')]],_0x9de6('0x51'),_0x24ebeb[_0x9de6('0x28')]);}}}catch(_0xb36e98){logger['error'](_0x9de6('0x52'),_0xb36e98[_0x9de6('0x37')]);}};module[_0x9de6('0x53')]=Acw; \ No newline at end of file +var _0xc754=['../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami'];(function(_0x1e7600,_0x11348d){var _0x80b052=function(_0x276413){while(--_0x276413){_0x1e7600['push'](_0x1e7600['shift']());}};_0x80b052(++_0x11348d);}(_0xc754,0x1b0));var _0x4c75=function(_0x22d431,_0x27c0d8){_0x22d431=_0x22d431-0x0;var _0x3e1b6a=_0xc754[_0x22d431];return _0x3e1b6a;};'use strict';var _=require(_0x4c75('0x0'));var moment=require(_0x4c75('0x1'));var ami=require(_0x4c75('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x4c75('0x3'));var RpcVoiceAgentReport=require(_0x4c75('0x4'));function Acw(_0x2d5c3d){this[_0x4c75('0x5')]=_0x2d5c3d['voiceQueues'];this[_0x4c75('0x6')]=_0x2d5c3d['agents'];this['timers']=_0x2d5c3d[_0x4c75('0x7')];this[_0x4c75('0x8')]={};ami['on'](_0x4c75('0x9'),this[_0x4c75('0xa')][_0x4c75('0xb')](this));ami['on'](_0x4c75('0xc'),this[_0x4c75('0xd')][_0x4c75('0xb')](this));ami['on'](_0x4c75('0xe'),this[_0x4c75('0xf')][_0x4c75('0xb')](this));ami['on'](_0x4c75('0x10'),this['syncAgentRingNoAnswer'][_0x4c75('0xb')](this));ami['on']('attendedtransfer',this[_0x4c75('0x11')][_0x4c75('0xb')](this));ami['on']('blindtransfer',this[_0x4c75('0x12')][_0x4c75('0xb')](this));ami['on'](_0x4c75('0x13'),this['syncAgentConnectPreview'][_0x4c75('0xb')](this));}function getDiff(_0x2617fd){var _0x2c1ed3=moment()['milliseconds'](0x0);var _0x5b544a=moment(_0x2617fd)[_0x4c75('0x14')](0x0);return _0x2c1ed3['diff'](_0x5b544a,_0x4c75('0x15'));}Acw['prototype'][_0x4c75('0x16')]=function(_0x4f731a){try{var _0x3661b8=this;var _0x18c76c=this[_0x4c75('0x8')][_0x4f731a][_0x4c75('0x17')];var _0x4766dc=this[_0x4c75('0x8')][_0x4f731a][_0x4c75('0x18')];var _0x8e8d1c=this['voiceQueues'][_0x4766dc];var _0x5f1d16=![];var _0x3a2ba9=_0x4c75('0x19');if(_0x8e8d1c[_0x4c75('0x1a')]){if(_0x8e8d1c[_0x4c75('0x1b')]['name']){_0x5f1d16=!![];_0x3a2ba9=_0x8e8d1c[_0x4c75('0x1b')][_0x4c75('0x1c')];}}return ami[_0x4c75('0x1d')]({'action':_0x4c75('0x1e'),'interface':_0x18c76c,'paused':!![],'reason':_0x3a2ba9})[_0x4c75('0x1f')](function(){if(_0x3661b8['agents'][_0x18c76c]){return RpcUser[_0x4c75('0x20')](_0x3661b8['agents'][_0x18c76c]['id'])[_0x4c75('0x1f')](function(_0x131f8d){if(_0x131f8d&&!_0x131f8d[_0x4c75('0x21')]){logger['info'](_0x4c75('0x22'),_0x4f731a,_0x18c76c,_0x4766dc);var _0x285fa2=_0x3661b8[_0x4c75('0x8')][_0x4f731a]['attended']&&_0x3661b8[_0x4c75('0x8')][_0x4f731a][_0x4c75('0x23')]?_0x3661b8['channels'][_0x4f731a][_0x4c75('0x23')]:_0x4f731a;return RpcUser['savePause'](_0x3661b8[_0x4c75('0x6')][_0x18c76c],_0x3a2ba9,_0x285fa2)[_0x4c75('0x1f')](function(){if(!_0x5f1d16){_0x3661b8['timers'][_0x18c76c]={};logger[_0x4c75('0x24')](_0x4c75('0x25'),_0x4f731a,_0x3661b8[_0x4c75('0x5')][_0x4766dc][_0x4c75('0x26')],_0x18c76c,_0x4766dc);_0x3661b8[_0x4c75('0x7')][_0x18c76c][_0x4c75('0x27')]=setTimeout(_0x3661b8[_0x4c75('0x28')]['bind'](_0x3661b8,_0x18c76c),_0x3661b8[_0x4c75('0x5')][_0x4766dc][_0x4c75('0x26')]*0x3e8);_0x3661b8[_0x4c75('0x7')][_0x18c76c][_0x4c75('0x29')]=moment()[_0x4c75('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3661b8[_0x4c75('0x7')][_0x18c76c][_0x4c75('0x2b')]=_0x4f731a;_0x3661b8[_0x4c75('0x7')][_0x18c76c][_0x4c75('0x18')]=_0x4766dc;_0x3661b8['timers'][_0x18c76c][_0x4c75('0x2c')]=function(){var _0x5b61a5=getDiff(_0x3661b8[_0x4c75('0x7')][_0x18c76c][_0x4c75('0x29')]);clearTimeout(_0x3661b8[_0x4c75('0x7')][_0x18c76c][_0x4c75('0x27')]);_0x3661b8['timers'][_0x18c76c]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x5b61a5},_0x3661b8[_0x4c75('0x7')][_0x18c76c][_0x4c75('0x2b')],_0x18c76c)['then'](function(_0x3d8972){logger['info'](_0x4c75('0x2d'),_0x4f731a,_0x5b61a5,_0x3d8972);})['catch'](function(_0x24a1bd){logger['error'](_0x4c75('0x2e'),_0x4f731a,_0x24a1bd);});delete _0x3661b8['timers'][_0x18c76c];};}});}else{logger[_0x4c75('0x24')](_0x4c75('0x2f'),_0x4f731a,_0x18c76c,_0x4766dc);}});}})['catch'](function(){logger[_0x4c75('0x30')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4f731a,_0x3661b8[_0x4c75('0x5')][_0x4766dc][_0x4c75('0x26')],_0x18c76c,_0x4766dc);})['finally'](function(){delete _0x3661b8['channels'][_0x4f731a];});}catch(_0x27d95c){logger[_0x4c75('0x30')]('[ACW][START]\x20%s',_0x27d95c[_0x4c75('0x31')]);}};Acw[_0x4c75('0x32')][_0x4c75('0x28')]=function(_0x43cd94){try{var _0x47d2aa=this;if(_0x47d2aa[_0x4c75('0x7')][_0x43cd94]){_0x47d2aa[_0x4c75('0x7')][_0x43cd94][_0x4c75('0x27')]=![];var _0x1a66d8=_0x47d2aa['timers'][_0x43cd94][_0x4c75('0x2b')];var _0x396a8e=_0x47d2aa[_0x4c75('0x7')][_0x43cd94]['queue'];var _0x307d02=_0x47d2aa[_0x4c75('0x5')][_0x396a8e][_0x4c75('0x26')];logger['info'](_0x4c75('0x33'),_0x1a66d8,_0x43cd94);RpcUser[_0x4c75('0x34')](this[_0x4c75('0x6')][_0x43cd94]);RpcVoiceAgentReport[_0x4c75('0x35')]({'acwtime':_0x307d02,'agentacw':!![]},_0x1a66d8,_0x43cd94)[_0x4c75('0x1f')](function(_0x5875e3){logger[_0x4c75('0x24')](_0x4c75('0x2d'),_0x1a66d8,_0x307d02,_0x5875e3);})[_0x4c75('0x36')](function(_0x28daa9){logger[_0x4c75('0x30')](_0x4c75('0x2e'),_0x1a66d8,_0x28daa9);});}else{logger['error'](_0x4c75('0x37'),_0x43cd94);if(_0x47d2aa[_0x4c75('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x4c75('0x38')](_0x47d2aa[_0x4c75('0x7')]));}}}catch(_0x19e199){logger[_0x4c75('0x30')](_0x4c75('0x39'),_0x19e199[_0x4c75('0x31')]);}};Acw[_0x4c75('0x32')]['syncAgentConnect']=function(_0x3c937a){try{if(this['voiceQueues'][_0x3c937a['queue']]&&(this['voiceQueues'][_0x3c937a[_0x4c75('0x18')]][_0x4c75('0x3a')]||this['voiceQueues'][_0x3c937a['queue']]['mandatoryDisposition'])){if(this[_0x4c75('0x6')][_0x3c937a['interface']]){this[_0x4c75('0x8')][_0x3c937a['uniqueid']]={'queue':_0x3c937a[_0x4c75('0x18')],'interface':_0x3c937a[_0x4c75('0x17')],'destlinkedid':_0x3c937a[_0x4c75('0x23')]};}}}catch(_0x5ec519){logger[_0x4c75('0x30')](_0x4c75('0x3b'),_0x5ec519[_0x4c75('0x31')]);}};Acw['prototype'][_0x4c75('0x3c')]=function(_0x1d7ead){try{if(this[_0x4c75('0x5')][_0x1d7ead[_0x4c75('0x18')]]&&(this[_0x4c75('0x5')][_0x1d7ead[_0x4c75('0x18')]][_0x4c75('0x3a')]||this[_0x4c75('0x5')][_0x1d7ead['queue']]['mandatoryDisposition'])){if(this[_0x4c75('0x6')][_0x1d7ead[_0x4c75('0x17')]]){this['channels'][_0x1d7ead[_0x4c75('0x2b')]]={'queue':_0x1d7ead[_0x4c75('0x18')],'interface':_0x1d7ead['interface']};}}}catch(_0x243c7f){logger[_0x4c75('0x30')](_0x4c75('0x3d'),_0x243c7f['message']);}};Acw[_0x4c75('0x32')][_0x4c75('0xd')]=function(_0x401fa1){try{if(this[_0x4c75('0x8')][_0x401fa1[_0x4c75('0x2b')]]&&_[_0x4c75('0x3e')](this[_0x4c75('0x8')][_0x401fa1[_0x4c75('0x2b')]][_0x4c75('0x3f')])){logger['info'](_0x4c75('0x40'),_0x401fa1[_0x4c75('0x2b')]);this[_0x4c75('0x16')](_0x401fa1['uniqueid']);}else if(this[_0x4c75('0x8')][_0x401fa1[_0x4c75('0x41')]]&&_[_0x4c75('0x3e')](this[_0x4c75('0x8')][_0x401fa1[_0x4c75('0x41')]]['attended'])){logger[_0x4c75('0x24')](_0x4c75('0x42'),_0x401fa1[_0x4c75('0x41')]);this['startAcw'](_0x401fa1[_0x4c75('0x41')]);}}catch(_0x1cda38){logger[_0x4c75('0x30')](_0x4c75('0x43'),_0x1cda38[_0x4c75('0x31')]);}};Acw['prototype']['syncHangup']=function(_0x3738e1){try{if(this[_0x4c75('0x8')][_0x3738e1['uniqueid']]&&this['channels'][_0x3738e1[_0x4c75('0x2b')]]['attended']){logger[_0x4c75('0x24')](_0x4c75('0x44'),_0x3738e1[_0x4c75('0x2b')]);this[_0x4c75('0x16')](_0x3738e1[_0x4c75('0x2b')]);}else if(this[_0x4c75('0x8')][_0x3738e1[_0x4c75('0x41')]]&&this['channels'][_0x3738e1[_0x4c75('0x41')]][_0x4c75('0x3f')]){logger[_0x4c75('0x24')](_0x4c75('0x45'),_0x3738e1[_0x4c75('0x41')]);this['startAcw'](_0x3738e1[_0x4c75('0x41')]);}}catch(_0x5e30a0){logger['error'](_0x4c75('0x46'),_0x5e30a0[_0x4c75('0x31')]);}};Acw['prototype'][_0x4c75('0x11')]=function(_0xd1e1b1){try{if(!_[_0x4c75('0x47')](this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x48')]])){this['startAcw'](_0xd1e1b1[_0x4c75('0x48')]);if(this['channels'][_0xd1e1b1[_0x4c75('0x49')]]){this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x49')]][_0x4c75('0x3f')]=!![];this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x4a')]]=this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x49')]];delete this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x49')]];}}else if(!_[_0x4c75('0x47')](this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x4a')]])){this[_0x4c75('0x16')](_0xd1e1b1[_0x4c75('0x4a')]);if(this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x4b')]]){this[_0x4c75('0x8')][_0xd1e1b1['origtransfereruniqueid']][_0x4c75('0x3f')]=!![];this['channels'][_0xd1e1b1[_0x4c75('0x48')]]=this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x4b')]];delete this[_0x4c75('0x8')][_0xd1e1b1[_0x4c75('0x4b')]];}}}catch(_0x25981e){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x25981e[_0x4c75('0x31')]);}};Acw[_0x4c75('0x32')][_0x4c75('0x12')]=function(_0x517381){try{if(this[_0x4c75('0x8')][_0x517381[_0x4c75('0x4c')]]){logger[_0x4c75('0x24')](_0x4c75('0x4d'),JSON[_0x4c75('0x38')](_0x517381[_0x4c75('0x4c')]));this[_0x4c75('0x16')](_0x517381[_0x4c75('0x4c')]);}else if(this[_0x4c75('0x8')][_0x517381[_0x4c75('0x4e')]]){logger[_0x4c75('0x24')](_0x4c75('0x4f'),JSON[_0x4c75('0x38')](_0x517381['transfererlinkedid']));this[_0x4c75('0x16')](_0x517381[_0x4c75('0x4e')]);}}catch(_0x4a9fc4){logger[_0x4c75('0x30')](_0x4c75('0x50'),_0x4a9fc4[_0x4c75('0x31')]);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x5bf357){try{if(this[_0x4c75('0x5')][_0x5bf357[_0x4c75('0x18')]]&&this[_0x4c75('0x5')][_0x5bf357['queue']][_0x4c75('0x51')]===_0x4c75('0x52')){if(this[_0x4c75('0x6')][_0x5bf357['interface']]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5bf357[_0x4c75('0x2b')],_0x5bf357['interface'],_0x5bf357[_0x4c75('0x18')]);return RpcUser[_0x4c75('0x53')](this[_0x4c75('0x6')][_0x5bf357[_0x4c75('0x17')]],_0x4c75('0x54'),_0x5bf357[_0x4c75('0x2b')]);}}}catch(_0x1f99a4){logger[_0x4c75('0x30')](_0x4c75('0x55'),_0x1f99a4[_0x4c75('0x31')]);}};module[_0x4c75('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 6aea01a..f21bf31 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d74=['actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','ami','../../config/environment','port','asterisk','username','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary'];(function(_0x7e19de,_0x368cce){var _0x3b06be=function(_0x5021eb){while(--_0x5021eb){_0x7e19de['push'](_0x7e19de['shift']());}};_0x3b06be(++_0x368cce);}(_0x9d74,0x15b));var _0x49d7=function(_0x5ebcda,_0x5aaa0a){_0x5ebcda=_0x5ebcda-0x0;var _0x179c8e=_0x9d74[_0x5ebcda];return _0x179c8e;};'use strict';var Manager=require(_0x49d7('0x0'));var BPromise=require(_0x49d7('0x1'));var util=require(_0x49d7('0x2'));var logger=require('../../config/logger')(_0x49d7('0x3'));var config=require(_0x49d7('0x4'));var ami=new Manager(config['asterisk'][_0x49d7('0x5')],config[_0x49d7('0x6')]['ip'],config[_0x49d7('0x6')][_0x49d7('0x7')],config[_0x49d7('0x6')]['password'],!![]);ami[_0x49d7('0x8')]();ami['Action']=BPromise[_0x49d7('0x9')](ami[_0x49d7('0xa')]);function error(_0x58b746){logger['error'](util[_0x49d7('0xb')](_0x49d7('0xc'),config['asterisk'][_0x49d7('0x7')],config['asterisk']['ip'],config[_0x49d7('0x6')]['port'],util[_0x49d7('0xd')](_0x58b746,![],null)));}function close(){logger[_0x49d7('0xe')](util[_0x49d7('0xb')](_0x49d7('0xf'),config[_0x49d7('0x6')][_0x49d7('0x7')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0x49d7('0x10')]=function(){return function(){return ami[_0x49d7('0x11')]({'action':'sipshowregistry'});};};ami[_0x49d7('0x12')]=function(){return function(){return ami[_0x49d7('0x11')]({'action':'devicestatelist'});};};ami[_0x49d7('0x13')]=function(){return function(){return ami[_0x49d7('0x11')]({'action':_0x49d7('0x14')});};};ami[_0x49d7('0x15')]=function(){return function(){return ami[_0x49d7('0x11')]({'action':_0x49d7('0x16')});};};ami[_0x49d7('0x17')]=function(){return function(){return ami[_0x49d7('0x11')]({'action':_0x49d7('0x18')});};};function connect(){logger[_0x49d7('0x19')](util[_0x49d7('0xb')](_0x49d7('0x1a'),config['asterisk'][_0x49d7('0x7')],config[_0x49d7('0x6')]['ip'],config[_0x49d7('0x6')]['port']));ami[_0x49d7('0x1b')]('error',error);ami['once'](_0x49d7('0x1c'),close);}ami['on'](_0x49d7('0x1d'),connect);ami['on'](_0x49d7('0x1e'),function(_0x49c3c3){logger[_0x49d7('0x19')](util[_0x49d7('0xb')](_0x49d7('0x1f'),config[_0x49d7('0x6')][_0x49d7('0x7')],config['asterisk']['ip'],config['asterisk'][_0x49d7('0x5')],util[_0x49d7('0xd')](_0x49c3c3,![],null)));});ami['on'](_0x49d7('0x20'),function(){logger['info'](util[_0x49d7('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0x49d7('0x6')][_0x49d7('0x5')]));return Promise[_0x49d7('0x21')]()['then'](ami[_0x49d7('0x10')]())['then'](ami[_0x49d7('0x12')]())[_0x49d7('0x22')](ami['actionSipPeerStatus']())[_0x49d7('0x22')](ami[_0x49d7('0x15')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x3a09ba){logger[_0x49d7('0xe')](_0x49d7('0x23'),util[_0x49d7('0xd')](_0x3a09ba,{'showHidden':![],'depth':null}));});});ami[_0x49d7('0x1b')]('error',error);ami[_0x49d7('0x1b')](_0x49d7('0x1c'),close);module[_0x49d7('0x24')]=ami; \ No newline at end of file +var _0xeb6b=['Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb6b,0xff));var _0xbeb6=function(_0x5d9718,_0x2f9e4a){_0x5d9718=_0x5d9718-0x0;var _0x5b601e=_0xeb6b[_0x5d9718];return _0x5b601e;};'use strict';var Manager=require(_0xbeb6('0x0'));var BPromise=require(_0xbeb6('0x1'));var util=require(_0xbeb6('0x2'));var logger=require(_0xbeb6('0x3'))(_0xbeb6('0x4'));var config=require(_0xbeb6('0x5'));var ami=new Manager(config[_0xbeb6('0x6')][_0xbeb6('0x7')],config[_0xbeb6('0x6')]['ip'],config[_0xbeb6('0x6')][_0xbeb6('0x8')],config[_0xbeb6('0x6')][_0xbeb6('0x9')],!![]);ami[_0xbeb6('0xa')]();ami[_0xbeb6('0xb')]=BPromise[_0xbeb6('0xc')](ami['action']);function error(_0x1f606e){logger[_0xbeb6('0xd')](util[_0xbeb6('0xe')](_0xbeb6('0xf'),config[_0xbeb6('0x6')][_0xbeb6('0x8')],config[_0xbeb6('0x6')]['ip'],config['asterisk']['port'],util['inspect'](_0x1f606e,![],null)));}function close(){logger[_0xbeb6('0xd')](util[_0xbeb6('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbeb6('0x6')]['username'],config[_0xbeb6('0x6')]['ip'],config[_0xbeb6('0x6')][_0xbeb6('0x7')]));}ami[_0xbeb6('0x10')]=function(){return function(){return ami['Action']({'action':_0xbeb6('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xbeb6('0xb')]({'action':_0xbeb6('0x12')});};};ami[_0xbeb6('0x13')]=function(){return function(){return ami[_0xbeb6('0xb')]({'action':_0xbeb6('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xbeb6('0xb')]({'action':_0xbeb6('0x15')});};};ami[_0xbeb6('0x16')]=function(){return function(){return ami['Action']({'action':_0xbeb6('0x17')});};};function connect(){logger[_0xbeb6('0x18')](util[_0xbeb6('0xe')](_0xbeb6('0x19'),config[_0xbeb6('0x6')]['username'],config['asterisk']['ip'],config['asterisk']['port']));ami['once'](_0xbeb6('0xd'),error);ami[_0xbeb6('0x1a')](_0xbeb6('0x1b'),close);}ami['on']('connect',connect);ami['on'](_0xbeb6('0x1c'),function(_0xa3dadc){logger['info'](util[_0xbeb6('0xe')](_0xbeb6('0x1d'),config[_0xbeb6('0x6')][_0xbeb6('0x8')],config[_0xbeb6('0x6')]['ip'],config[_0xbeb6('0x6')][_0xbeb6('0x7')],util[_0xbeb6('0x1e')](_0xa3dadc,![],null)));});ami['on']('fullybooted',function(){logger[_0xbeb6('0x18')](util[_0xbeb6('0xe')](_0xbeb6('0x1f'),config[_0xbeb6('0x6')]['username'],config['asterisk']['ip'],config[_0xbeb6('0x6')][_0xbeb6('0x7')]));return Promise[_0xbeb6('0x20')]()[_0xbeb6('0x21')](ami[_0xbeb6('0x10')]())[_0xbeb6('0x21')](ami[_0xbeb6('0x22')]())[_0xbeb6('0x21')](ami[_0xbeb6('0x13')]())[_0xbeb6('0x21')](ami[_0xbeb6('0x23')]())[_0xbeb6('0x21')](ami[_0xbeb6('0x16')]())[_0xbeb6('0x24')](function(_0x1e3403){logger[_0xbeb6('0xd')](_0xbeb6('0x25'),util[_0xbeb6('0x1e')](_0x1e3403,{'showHidden':![],'depth':null}));});});ami[_0xbeb6('0x1a')](_0xbeb6('0xd'),error);ami['once'](_0xbeb6('0x1b'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7365591..d2b1efd 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x457a9c,_0xc6ef6e){var _0x2a7586=function(_0x393c8e){while(--_0x393c8e){_0x457a9c['push'](_0x457a9c['shift']());}};_0x2a7586(++_0xc6ef6e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x18cb43,_0x387ded){_0x18cb43=_0x18cb43-0x0;var _0x322a01=_0x9ffd[_0x18cb43];return _0x322a01;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x200e97,_0x164626){var _0xfe45f5=function(_0x44ff95){while(--_0x44ff95){_0x200e97['push'](_0x200e97['shift']());}};_0xfe45f5(++_0x164626);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 73746a2..1781ca0 100644 --- a/server/services/ami/dialer/index.js +++ b/server/services/ami/dialer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaea3=['[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','countbusyretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x2019\x20machine....','add','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','statusMessage','available','inUse','talking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','[actions]','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','getCaller','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','Trunk','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','[originateError]:\x20%s','[originate][error]','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAvgHoldtime','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','getContactDialerIvr','dialOrderByScheduledAt','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','countReScheduled','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','localhost','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','startProgressive','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','iftime\x20%s,%s','indexOf','true','catch','content','all','some','OVERTIME_GLOBAL_INTERVAL','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIfTime','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','uniqueid','type','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','dialDropMaxRetry','queueCallerAbandonCreateState','additional','rescheduleContact','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','locked','stateinterface','isNil','merge','paused','strategy','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaea3,0xff));var _0x3aea=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaea3[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x3aea('0x0'));var _=require('lodash');var uuid=require(_0x3aea('0x1'));var moment=require(_0x3aea('0x2'));var rr=require('rr');var Redis=require(_0x3aea('0x3'));var utils=require(_0x3aea('0x4'));var hopperUtils=require(_0x3aea('0x5'));var ut=require('../preview/util/util');var config=require(_0x3aea('0x6'));var logger=require(_0x3aea('0x7'))('dialer');var loggerBooked=require(_0x3aea('0x7'))(_0x3aea('0x8'));var loggerPredictive=require(_0x3aea('0x7'))(_0x3aea('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0x3aea('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x3aea('0xb'));var ami=require(_0x3aea('0xc'));config['redis']=_['defaults'](config['redis'],{'host':_0x3aea('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x3aea('0xe'));var RpcSetting=require(_0x3aea('0xf'));var Interval=require('../rpc/interval');var Action=require(_0x3aea('0x10'));var History=require(_0x3aea('0x11'));var Final=require(_0x3aea('0x12'));var AgentComplete=require(_0x3aea('0x13'));var QueueCallerAbandon=require(_0x3aea('0x14'));var Hangup=require(_0x3aea('0x15'));var ipAgi=process[_0x3aea('0x16')][_0x3aea('0x17')]||_0x3aea('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3aea('0x19')][_0x3aea('0x1a')]=function(_0x4153c4){this[_0x3aea('0x1b')]=this[_0x3aea('0x1b')]?this[_0x3aea('0x1b')][_0x3aea('0x1c')](_0x4153c4):_0x4153c4();};function Dialer(_0x4000e6,_0x586312){this[_0x3aea('0x1d')]=new Sequence();this[_0x3aea('0x1e')]=_0x586312;this[_0x3aea('0x1f')]=_0x4000e6[_0x3aea('0x1f')];this[_0x3aea('0x20')]=_0x4000e6[_0x3aea('0x20')];this['agents']=_0x4000e6[_0x3aea('0x21')];this['trunks']=_0x4000e6[_0x3aea('0x22')];this[_0x3aea('0x23')]=config[_0x3aea('0x23')]||0x2;this[_0x3aea('0x24')]={};this[_0x3aea('0x25')]={};this[_0x3aea('0x26')]={};this[_0x3aea('0x27')]={};this[_0x3aea('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0x3aea('0x29')]={};this[_0x3aea('0x2a')]={};this[_0x3aea('0x2b')]={};this[_0x3aea('0x2c')]={};ami['on'](_0x3aea('0x2d'),this[_0x3aea('0x2e')][_0x3aea('0x2f')](this));ami['on']('queuecallerabandon',this[_0x3aea('0x30')]['bind'](this));ami['on'](_0x3aea('0x31'),this[_0x3aea('0x32')][_0x3aea('0x2f')](this));ami['on']('agentcomplete',this[_0x3aea('0x33')][_0x3aea('0x2f')](this));ami['on'](_0x3aea('0x34'),this[_0x3aea('0xb')][_0x3aea('0x2f')](this));ami['on'](_0x3aea('0x35'),this[_0x3aea('0x36')][_0x3aea('0x2f')](this));ami['on'](_0x3aea('0x37'),this[_0x3aea('0x38')][_0x3aea('0x2f')](this));ami['on'](_0x3aea('0x39'),this[_0x3aea('0x3a')][_0x3aea('0x2f')](this));ami['on'](_0x3aea('0x3b'),this[_0x3aea('0x3c')]['bind'](this));ami['on'](_0x3aea('0x3d'),this[_0x3aea('0x3e')]['bind'](this));ami['on'](_0x3aea('0x3f'),this[_0x3aea('0x40')]['bind'](this));this[_0x3aea('0x41')]();this[_0x3aea('0x42')]();RpcSetting[_0x3aea('0x43')]()[_0x3aea('0x44')](function(_0x1b7542){previewRecallmeReminderInterval=_0x1b7542['previewRecallmeReminderInterval'];});}function isNotNull(_0xaf4f16){return _0xaf4f16!==null&&!_[_0x3aea('0x45')](_0xaf4f16);}function msgResponse(_0x358b8c,_0x140641,_0x411b23){return{'action':_0x358b8c,'response':_0x140641,'message':_0x411b23,'stack':_0x411b23};}function emit(_0x371196,_0x3187df,_0x400747){io['to'](_0x371196)[_0x3aea('0x46')](_0x3187df,_0x400747);}function emitOutboundVoiceQueueSummary(_0x57959a){if(_0x57959a['type']===_0x3aea('0x47')){logger[_0x3aea('0x48')](_0x3aea('0x49'),util[_0x3aea('0x4a')](_0x57959a,{'showHidden':![],'depth':null}));emit(util[_0x3aea('0x4b')]('voice:queue:%s',_0x57959a[_0x3aea('0x4c')]),'voice_queue:save',_0x57959a);}}function checkGetDataPredictive(_0x58a837){if(isNotNull(_0x58a837)&&!_[_0x3aea('0x4d')](_0x58a837)){loggerPredictive[_0x3aea('0x4e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x4f'),_0x58a837[_0x3aea('0x50')]);loggerPredictive['info'](_0x3aea('0x51'),_0x58a837[_0x3aea('0x52')]);loggerPredictive[_0x3aea('0x4e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58a837[_0x3aea('0x53')]);loggerPredictive['info'](_0x3aea('0x54'),_0x58a837['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x55'),_0x58a837['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x56'),_0x58a837['predictiveIntervalAvgTalktime']);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x57'));if(_0x58a837['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3aea('0x45')](_0x58a837['predictiveIntervalAvgTalktime'])&&_0x58a837[_0x3aea('0x58')]>0x0){return!![];}loggerPredictive['info'](_0x3aea('0x59'));if(!_[_0x3aea('0x45')](_0x58a837['predictiveIntervalAvgHoldtime'])&&_0x58a837['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x5a'));}else{loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x5b'));}}else{loggerPredictive['info'](_0x3aea('0x5c'));}return![];}function mergeDataErlangB(_0x30d608){return function(_0x3d6aa7){loggerPredictive[_0x3aea('0x4e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x5d'),_0x3d6aa7[_0x3aea('0x5e')]);loggerPredictive['info'](_0x3aea('0x5f'),_0x3d6aa7[_0x3aea('0x60')]);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x61'),_0x3d6aa7['erlangAbandonmentRate']);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x62'),_0x3d6aa7[_0x3aea('0x63')]);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x61'),_0x3d6aa7[_0x3aea('0x64')]);loggerPredictive['info'](_0x3aea('0x57'));_['merge'](_0x30d608,_0x3d6aa7);};}function ifInterval(_0x5a970f,_0x4fc680){if(_['isUndefined'](_0x4fc680)){return![];}return utils['getSeconds'](undefined,_0x4fc680)<_0x5a970f*0x3c;}function clearPredictiveAttributes(_0x9bc1a0){if(_0x9bc1a0[_0x3aea('0x65')]){_0x9bc1a0[_0x3aea('0x65')]=undefined;loggerPredictive[_0x3aea('0x48')](_0x9bc1a0[_0x3aea('0x4c')],_0x3aea('0x66'));}if(_0x9bc1a0[_0x3aea('0x67')]){_0x9bc1a0['startPredictive']=undefined;loggerPredictive[_0x3aea('0x48')](_0x9bc1a0[_0x3aea('0x4c')],'startPredictive\x20value\x20cleared');}if(_0x9bc1a0[_0x3aea('0x68')]){clearInterval(_0x9bc1a0[_0x3aea('0x68')]);_0x9bc1a0[_0x3aea('0x68')]=undefined;loggerPredictive[_0x3aea('0x48')](_0x9bc1a0['name'],_0x3aea('0x69'));}}function loggerCatchPredictive(_0x15a208,_0x874c0b){return function(_0xee4d47){loggerPredictive[_0x3aea('0x6a')](_0x874c0b[_0x3aea('0x4c')],_0x15a208);loggerPredictive['error'](_0xee4d47[_0x3aea('0x6b')]);clearPredictiveAttributes(_0x874c0b);};}function loggerCatch(_0x4289df){return function(_0x2b8cfb){logger['error'](_0x4289df,util[_0x3aea('0x4a')](_0x2b8cfb,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x16534e,_0xaa329,_0x2051d4){return function(_0x274854){utils[_0x3aea('0x6c')](_0xaa329,_0x2051d4,0x0);logger[_0x3aea('0x6a')](_0x16534e,util[_0x3aea('0x4a')](_0x274854,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4a1f74){return function(_0x51c086){if(isNotNull(_0x51c086)&&isNotNull(_0x51c086[0x0])){if(_0x51c086[0x0][_0x3aea('0x6d')]>0x0){_0x4a1f74[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')][_0x3aea('0x70')];logger['info'](_0x3aea('0x71')+_0x4a1f74[_0x3aea('0x4c')],_0x51c086[0x0][_0x3aea('0x6d')],_0x3aea('0x72'));}else{_0x4a1f74[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')][_0x3aea('0x73')];logger['info'](_0x3aea('0x74')+_0x4a1f74[_0x3aea('0x4c')]);}}};}function createObjHistory(_0x4c82ec,_0x3cf38f,_0x207763,_0x52cc74,_0x184a89){_0x4c82ec[_0x3aea('0x6e')]=_0x207763;var _0x43957c=new Action(_0x4c82ec,_0x3cf38f);var _0x4b3906=new History(_0x43957c);_0x4b3906[_0x3aea('0x75')]=_0x52cc74;_0x4b3906[_0x3aea('0x76')]=_0x184a89;_0x4b3906[_0x3aea('0x77')]=_0x43957c[_0x3aea('0x78')];return _0x4b3906;}function unlockQueueStatus(_0xc51f67,_0xb13389){setTimeout(function(){if(_['isUndefined'](_0xc51f67[_0x3aea('0x79')])){loggerBooked[_0x3aea('0x6a')]('[unlockQueueStatus][undefined]',_0xb13389);}_0xc51f67['queueStatusComplete']=!![];loggerBooked['info'](_0x3aea('0x7a'),_0xb13389,JSON[_0x3aea('0x7b')](_[_0x3aea('0x7c')](_0xc51f67,[_0x3aea('0x4c'),_0x3aea('0x79')])));},0x1f3);}function checkInterval(_0x1e4766){return function(){if(!isNotNull(_0x1e4766[_0x3aea('0x7d')])){_0x1e4766['message']=utils[_0x3aea('0x6f')][_0x3aea('0x7e')];throw _0x1e4766[_0x3aea('0x4c')]+_0x3aea('0x7f');}if(!isNotNull(_0x1e4766[_0x3aea('0x7d')][_0x3aea('0x80')])){_0x1e4766[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')]['NULL_INTERVAL'];throw _0x1e4766[_0x3aea('0x4c')]+_0x3aea('0x7f');}if(!isNotNull(_[_0x3aea('0x4d')](_0x1e4766[_0x3aea('0x7d')][_0x3aea('0x80')]))){_0x1e4766[_0x3aea('0x6e')]=utils['CAMPAIGN_STATUS'][_0x3aea('0x7e')];throw _0x1e4766[_0x3aea('0x4c')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x5ce002){return function(){if(!utils[_0x3aea('0x81')](_0x5ce002)){_0x5ce002[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')][_0x3aea('0x82')];throw _0x5ce002['name']+_0x3aea('0x83');}};}function emitCampaignSummary(_0x21c352){if(utils[_0x3aea('0x84')](_0x21c352)){emit(util[_0x3aea('0x4b')](_0x3aea('0x85'),_0x21c352[_0x3aea('0x4c')]),'campaign:save',_0x21c352);}}function loggerCatchQueueSummary(_0xb180a5,_0x3fb4e9){return function(_0x10652b){clearPredictiveAttributes(_0x3fb4e9);emitCampaignSummary(_0x3fb4e9);loggerSyncQueueSummary[_0x3aea('0x48')](_0xb180a5,util[_0x3aea('0x4a')](_0x10652b,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x311b07){if(_0x311b07[_0x3aea('0x86')]){if(_0x311b07[_0x3aea('0x87')]===0x0){_0x311b07[_0x3aea('0x86')]=![];_0x311b07[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')][_0x3aea('0x82')];loggerSyncQueueSummary[_0x3aea('0x48')](_0x3aea('0x88'),_0x311b07[_0x3aea('0x4c')],_0x3aea('0x89'));}else{_0x311b07['message']=utils[_0x3aea('0x6f')][_0x3aea('0x8a')];loggerSyncQueueSummary[_0x3aea('0x48')](_0x3aea('0x88'),_0x311b07['name'],_0x3aea('0x8b'));}emitCampaignSummary(_0x311b07);}}function myreject(_0xeccbc2){return function(_0x3b4702){return _0xeccbc2(msgResponse('[ifTime][Action]',_0x3aea('0x8c'),JSON['stringify'](_0x3b4702)));};}Dialer[_0x3aea('0x19')][_0x3aea('0x8d')]=function(_0x4efe94){return!_[_0x3aea('0x45')](_0x4efe94)&&_0x4efe94&&!_[_0x3aea('0x45')](_0x4efe94[_0x3aea('0x4c')])&&!_[_0x3aea('0x45')](_0x4efe94['active'])&&_0x4efe94[_0x3aea('0x8e')]&&(this['trunks'][util[_0x3aea('0x4b')](_0x3aea('0x8f'),_0x4efe94['name'])]['status']===_0x3aea('0x90')||this[_0x3aea('0x22')][util['format']('SIP/%s',_0x4efe94[_0x3aea('0x4c')])][_0x3aea('0x91')]===_0x3aea('0x92'));};Dialer[_0x3aea('0x19')]['checkIsTrunkReachable']=function(_0x1e0730){var _0x38a187=this;return function(){if(!_0x38a187[_0x3aea('0x8d')](_0x1e0730['Trunk'])){if(!_0x38a187[_0x3aea('0x8d')](_0x1e0730[_0x3aea('0x93')])){_0x1e0730[_0x3aea('0x6e')]=utils['CAMPAIGN_STATUS'][_0x3aea('0x94')];throw _0x1e0730[_0x3aea('0x4c')]+_0x3aea('0x95');}}};};Dialer[_0x3aea('0x19')]['checkIfTime']=function(_0x448680,_0x9d2336,_0x44eb91,_0x432f3d){var _0x589b17=this;return function(){var _0x1acc6d=!![];return _0x589b17[_0x3aea('0x96')](_0x448680,_0x9d2336,_0x44eb91,_0x432f3d,_0x1acc6d);};};Dialer[_0x3aea('0x19')][_0x3aea('0x97')]=function(_0x3ff3b3,_0x4dc33a,_0x50137f,_0x5fc141){var _0x5695e3=this;return function(){var _0x5b2275=![];return _0x5695e3[_0x3aea('0x96')](_0x3ff3b3['Intervals'],_0x4dc33a,_0x50137f,_0x5fc141,_0x5b2275);};};Dialer[_0x3aea('0x19')][_0x3aea('0x96')]=function(_0x470070,_0x2fb068,_0x4bf96d,_0x3db1e6,_0x2d6bc0){var _0x1b13d9=[];return new Promise(function(_0xb2cbe5,_0x1e2a98){if(!isNotNull(_0x470070)){_0x3db1e6[_0x3aea('0x6e')]=utils['CAMPAIGN_STATUS'][_0x3aea('0x7e')];return _0x1e2a98(msgResponse(_0x3aea('0x98'),_0x3aea('0x99'),_0x4bf96d+_0x3aea('0x9a')));}if(_[_0x3aea('0x4d')](_0x470070)){_0x3db1e6[_0x3aea('0x6e')]=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x1e2a98(msgResponse('ifTime','Failure',_0x4bf96d+_0x3aea('0x9b')));}if(_0x2fb068&&_[_0x3aea('0x45')](config[_0x3aea('0x9c')][_0x2fb068])){_0x3db1e6['message']=utils[_0x3aea('0x6f')][_0x3aea('0x9d')];return _0x1e2a98(msgResponse(_0x3aea('0x98'),'Failure',_0x4bf96d+'\x20Timezone\x20unknow\x20'+_0x2fb068));}if(_[_0x3aea('0x9e')](_0x470070)){for(var _0x3e982b=0x0;_0x3e982b<_0x470070[_0x3aea('0x9f')];_0x3e982b+=0x1){_0x1b13d9[_0x3aea('0xa0')](ami[_0x3aea('0xa1')]({'action':_0x3aea('0xa2'),'command':util[_0x3aea('0x4b')](_0x3aea('0xa3'),_0x470070[_0x3e982b]['interval'],!_[_0x3aea('0x45')](config['timezones'][_0x2fb068])?_0x2fb068:'')})[_0x3aea('0x44')](function(_0x2ecc27){return _0x2ecc27['content'][_0x3aea('0xa4')](_0x3aea('0xa5'))>=0x0;})[_0x3aea('0xa6')](myreject(_0x1e2a98)));}}else{_0x1b13d9[_0x3aea('0xa0')](ami[_0x3aea('0xa1')]({'action':'command','command':util[_0x3aea('0x4b')](_0x3aea('0xa3'),_0x470070,!_[_0x3aea('0x45')](config['timezones'][_0x2fb068])?_0x2fb068:'')})[_0x3aea('0x44')](function(_0x38f923){return _0x38f923[_0x3aea('0xa7')][_0x3aea('0xa4')](_0x3aea('0xa5'))>=0x0;})[_0x3aea('0xa6')](myreject(_0x1e2a98)));}Promise[_0x3aea('0xa8')](_0x1b13d9)[_0x3aea('0x44')](function(_0x1255be){var _0x1765e4=_[_0x3aea('0xa9')](_0x1255be);if(_0x1765e4){return _0xb2cbe5(_0x1765e4);}else{_0x3db1e6[_0x3aea('0x6e')]=_0x2d6bc0?utils[_0x3aea('0x6f')][_0x3aea('0xaa')]:utils[_0x3aea('0x6f')]['OVERTIME_INTERVAL'];return _0x1e2a98(msgResponse('[ifTime][promiseAll]','Failure',_0x3aea('0xab')+_0x2d6bc0+'\x20'+_0x4bf96d+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3aea('0x4a')](_0x470070,{'showHidden':![],'depth':null})+_0x3aea('0xac')+_0x2fb068));}})[_0x3aea('0xa6')](function(_0x2fc7ad){return _0x1e2a98(msgResponse('ifTime',_0x3aea('0x99'),JSON[_0x3aea('0x7b')](_0x2fc7ad)));});});};Dialer[_0x3aea('0x19')][_0x3aea('0x41')]=function(){var _0x2a245a=this;return cmHopper[_0x3aea('0xad')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x2a245a[_0x3aea('0xae')]();},0x3e8);});};Dialer[_0x3aea('0x19')][_0x3aea('0xae')]=function(){var _0x2c5f98=this;var _0x4f7dec;for(var _0x14c199 in this[_0x3aea('0x20')]){if(typeof this[_0x3aea('0x20')][_0x14c199]!==_0x3aea('0xaf')){_0x4f7dec=this['campaigns'][_0x14c199];if(utils['isIVRCampaign'](_0x4f7dec)&&utils['isIVRCampaignActive'](_0x4f7dec)){_0x4f7dec[_0x3aea('0x86')]=!![];Promise[_0x3aea('0xb0')]()[_0x3aea('0x44')](checkIsIVRCampaignActive(_0x4f7dec))['then'](checkInterval(_0x4f7dec))[_0x3aea('0x44')](_0x2c5f98['checkIsTrunkReachable'](_0x4f7dec))[_0x3aea('0x44')](_0x2c5f98[_0x3aea('0xb1')](_0x4f7dec['dialGlobalInterval'],_0x4f7dec['dialTimezone'],_0x4f7dec['name'],_0x4f7dec))['then'](_0x2c5f98[_0x3aea('0x97')](_0x4f7dec[_0x3aea('0x7d')],_0x4f7dec[_0x3aea('0xb2')],_0x4f7dec[_0x3aea('0x4c')],_0x4f7dec))['then'](_0x2c5f98[_0x3aea('0xb3')](_0x4f7dec))[_0x3aea('0xa6')](loggerCatchQueueSummary(_0x3aea('0xb4'),_0x4f7dec));}else{notSendMessagesCampaign(_0x4f7dec);}}}};Dialer[_0x3aea('0x19')][_0x3aea('0xb5')]=function(_0x36b9fb){if(_0x36b9fb[_0x3aea('0xb6')]!=='predictive'){clearPredictiveAttributes(_0x36b9fb);}switch(_0x36b9fb[_0x3aea('0xb6')]){case _0x3aea('0xb7'):this[_0x3aea('0xb8')](_0x36b9fb,0x1);break;case _0x3aea('0xb9'):this[_0x3aea('0xb8')](_0x36b9fb,_0x36b9fb[_0x3aea('0xba')]);break;case _0x3aea('0x9'):this[_0x3aea('0x9')](_0x36b9fb);break;case _0x3aea('0x8'):this[_0x3aea('0xb8')](_0x36b9fb,0x1);break;default:logger[_0x3aea('0x6a')](_0x3aea('0xbb'),_0x36b9fb[_0x3aea('0x4c')],_0x3aea('0xbc'));}};Dialer[_0x3aea('0x19')][_0x3aea('0x98')]=function(_0x44dcb5,_0x8fa27f){var _0x2d923d=_0x44dcb5[_0x3aea('0xb2')];var _0x2fe930=_0x8fa27f?_0x44dcb5['dialGlobalInterval']:_0x44dcb5[_0x3aea('0x7d')][_0x3aea('0x80')];logger['silly'](_0x3aea('0xbd'),_0x2fe930,_0x2d923d,_0x44dcb5[_0x3aea('0x4c')],util[_0x3aea('0x4b')](_0x3aea('0xbe'),_0x44dcb5[_0x3aea('0x4c')],_0x44dcb5['id']));var _0x598b3a=null;return Interval[_0x3aea('0xbf')](_0x2fe930,_0x2d923d)[_0x3aea('0x44')](function(_0x419ad9){if(_0x419ad9===!![]){return _0x419ad9;}else{_0x44dcb5[_0x3aea('0x6e')]=_0x8fa27f?utils[_0x3aea('0x6f')][_0x3aea('0xaa')]:utils[_0x3aea('0x6f')][_0x3aea('0xc0')];_0x598b3a=msgResponse(_0x3aea('0xc1'),_0x3aea('0x99'),_0x3aea('0xab')+_0x8fa27f+'\x20'+_0x44dcb5[_0x3aea('0x4c')]+_0x3aea('0xc2')+util[_0x3aea('0x4a')](_0x2fe930,{'showHidden':![],'depth':null})+_0x3aea('0xac')+_0x2d923d);}if(_0x598b3a!==null){logger[_0x3aea('0xc3')](_0x3aea('0xc4'),_0x598b3a);_0x598b3a[_0x3aea('0xc5')]=_0x8fa27f;throw _0x598b3a;}})[_0x3aea('0xa6')](function(_0x5d44e9){logger[_0x3aea('0x6a')](_0x3aea('0xc6'),_0x5d44e9);throw msgResponse(_0x3aea('0xc7'),_0x3aea('0x8c'),util['inspect'](_0x5d44e9,{'showHidden':![],'depth':null}));});};Dialer[_0x3aea('0x19')][_0x3aea('0x2e')]=function(_0x23d519){if(this[_0x3aea('0x1f')][_0x23d519['queue']]){if(this[_0x3aea('0x27')][_0x23d519[_0x3aea('0xc8')]]&&this[_0x3aea('0x27')][_0x23d519['uniqueid']][_0x3aea('0xc9')]!=='ivr'){this[_0x3aea('0xca')](this[_0x3aea('0x1f')][_0x23d519[_0x3aea('0xcb')]]);this[_0x3aea('0x27')][_0x23d519['uniqueid']][_0x3aea('0xcc')]=moment()['format'](_0x3aea('0xcd'));}}};Dialer[_0x3aea('0x19')][_0x3aea('0x33')]=function(_0x520a60){var _0x5ac478=this[_0x3aea('0x27')][_0x520a60[_0x3aea('0xc8')]];if(this[_0x3aea('0x1f')][_0x520a60['queue']]){if(_0x5ac478&&_0x5ac478['type']!==_0x3aea('0xce')){delete this[_0x3aea('0x27')][_0x520a60['uniqueid']];this[_0x3aea('0x1f')][_0x520a60[_0x3aea('0xcb')]][_0x3aea('0xcf')]+=0x1;var _0x1d2b6b=new AgentComplete(_0x5ac478,_0x520a60);if(_0x520a60[_0x3aea('0xd0')]===_0x3aea('0xd1')){_0x1d2b6b['agiafterat']=this['voiceQueues'][_0x520a60['queue']][_0x3aea('0xd2')]&&this[_0x3aea('0x1f')][_0x520a60[_0x3aea('0xcb')]][_0x3aea('0xd3')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x3aea('0xd4')](_0x1d2b6b)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xd5')));hopperUtils[_0x3aea('0xd6')](_0x1d2b6b)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xd7')));}}};Dialer[_0x3aea('0x19')]['syncQueueCallerAbandon']=function(_0x511398){var _0x2222f7=this[_0x3aea('0x27')][_0x511398[_0x3aea('0xc8')]];var _0x384d0f=this;var _0x3973a6=![];var _0x32257b;var _0xfcdb8c;if(this['voiceQueues'][_0x511398[_0x3aea('0xcb')]]){if(_0x2222f7&&_0x2222f7['type']!==_0x3aea('0xce')){delete this[_0x3aea('0x27')][_0x511398['uniqueid']];this[_0x3aea('0xca')](this['voiceQueues'][_0x511398[_0x3aea('0xcb')]]);_0x2222f7['droptime']=moment()[_0x3aea('0x4b')](_0x3aea('0xcd'));var _0x4fb89b=new QueueCallerAbandon(_0x2222f7,_0x511398);if(utils['getSeconds'](_0x2222f7[_0x3aea('0xd8')],_0x2222f7[_0x3aea('0xd9')])>=_0x2222f7[_0x3aea('0xda')]){this[_0x3aea('0x1f')][_0x511398[_0x3aea('0xcb')]][_0x3aea('0x53')]+=0x1;this[_0x3aea('0x1f')][_0x511398['queue']][_0x3aea('0xdb')]+=0x1;this['voiceQueues'][_0x511398[_0x3aea('0xcb')]][_0x3aea('0xdc')]+=0x1;_0x4fb89b[_0x3aea('0x75')]=0xa;_0x4fb89b[_0x3aea('0x76')]='Drop';_0x4fb89b[_0x3aea('0xdd')]=_0x3aea('0xde');_0x4fb89b['agiafterat']=this[_0x3aea('0x1f')][_0x511398[_0x3aea('0xcb')]][_0x3aea('0xd2')]?moment()[_0x3aea('0x4b')](_0x3aea('0xcd')):undefined;_0x4fb89b[_0x3aea('0xdf')]+=0x1;_0x4fb89b[_0x3aea('0xe0')]+=0x1;_0x32257b=this['voiceQueues'][_0x511398['queue']][_0x3aea('0xe1')];_0xfcdb8c=this[_0x3aea('0x1f')][_0x511398['queue']][_0x3aea('0xe2')];hopperUtils['verifyAdditionalPhones'](_0x4fb89b,_0x4fb89b[_0x3aea('0x75')],_0x2222f7['voiceQueue'])[_0x3aea('0x44')](function(_0x12990b){_0x3973a6=_0x12990b['additional']==0x1;if(_0x4fb89b['countdropretry']>=_0x384d0f['voiceQueues'][_0x511398['queue']][_0x3aea('0xe3')]){_0x384d0f[_0x3aea('0xe4')](_0x4fb89b,_0x12990b[_0x3aea('0xe5')]);}else{hopperUtils[_0x3aea('0xe6')]({'active':![],'countdropretry':_0x4fb89b[_0x3aea('0xdf')],'scheduledat':moment()['add'](_0x384d0f[_0x3aea('0x1f')][_0x511398['queue']][_0x3aea('0xe1')],_0x3aea('0xe7'))[_0x3aea('0x4b')](_0x3aea('0xcd')),'ContactId':_0x2222f7[_0x3aea('0xe8')],'ListId':_0x2222f7[_0x3aea('0xe9')],'VoiceQueueId':_0x2222f7[_0x3aea('0xea')]||undefined,'CampaignId':_0x2222f7[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xec')));var _0x2d6d5b=new History(_0x4fb89b);_0x2d6d5b[_0x3aea('0x75')]=0xa;_0x2d6d5b['statedesc']=_0x3aea('0xed');_0x2d6d5b[_0x3aea('0x78')]=moment()[_0x3aea('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d6d5b[_0x3aea('0x77')]=_0x2d6d5b[_0x3aea('0x78')];_0x2d6d5b[_0x3aea('0xee')]=_0x4fb89b[_0x3aea('0xee')];_0x2d6d5b[_0x3aea('0xef')]=_0x4fb89b['calleridnum'];hopperUtils[_0x3aea('0xd4')](_0x2d6d5b)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xf0')));}})[_0x3aea('0x44')](function(){if(_0x3973a6)hopperUtils[_0x3aea('0xf1')](_0x4fb89b,_0x32257b,_0xfcdb8c)[_0x3aea('0x44')](function(){return 0x1;});});}else{this[_0x3aea('0x1f')][_0x511398[_0x3aea('0xcb')]][_0x3aea('0xf2')]+=0x1;this[_0x3aea('0x1f')][_0x511398[_0x3aea('0xcb')]][_0x3aea('0xf3')]+=0x1;_0x4fb89b[_0x3aea('0x75')]=0xb;_0x4fb89b[_0x3aea('0x76')]=_0x3aea('0xf4');_0x4fb89b[_0x3aea('0xdd')]=_0x3aea('0xf5');_0x4fb89b[_0x3aea('0xf6')]+=0x1;_0x4fb89b[_0x3aea('0xe0')]+=0x1;_0x32257b=this[_0x3aea('0x1f')][_0x511398[_0x3aea('0xcb')]][_0x3aea('0xf7')];_0xfcdb8c=this[_0x3aea('0x1f')][_0x511398[_0x3aea('0xcb')]][_0x3aea('0xe2')];hopperUtils['verifyAdditionalPhones'](_0x4fb89b,_0x4fb89b[_0x3aea('0x75')],_0x2222f7[_0x3aea('0xf8')])[_0x3aea('0x44')](function(_0x8fd732){if(_0x4fb89b[_0x3aea('0xf6')]>=_0x384d0f[_0x3aea('0x1f')][_0x511398[_0x3aea('0xcb')]]['dialAbandonedMaxRetry']){_0x384d0f[_0x3aea('0xe4')](_0x4fb89b,_0x8fd732[_0x3aea('0xe5')]);}else{hopperUtils[_0x3aea('0xe6')]({'active':![],'countabandonedretry':_0x4fb89b[_0x3aea('0xf6')],'scheduledat':moment()['add'](_0x384d0f[_0x3aea('0x1f')][_0x511398['queue']][_0x3aea('0xf7')],_0x3aea('0xe7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2222f7[_0x3aea('0xe8')],'ListId':_0x2222f7['ListId'],'VoiceQueueId':_0x2222f7[_0x3aea('0xea')]||undefined,'CampaignId':_0x2222f7[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xf9')));var _0x5784c4=new History(_0x4fb89b);_0x5784c4['state']=0xb;_0x5784c4['statedesc']='Abandoned';_0x5784c4['starttime']=moment()[_0x3aea('0x4b')](_0x3aea('0xcd'));_0x5784c4['endtime']=_0x5784c4[_0x3aea('0x78')];_0x5784c4['calleridname']=_0x4fb89b[_0x3aea('0xee')];_0x5784c4['calleridnum']=_0x4fb89b[_0x3aea('0xef')];hopperUtils[_0x3aea('0xd4')](_0x5784c4)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xfa')));}})[_0x3aea('0x44')](function(){if(_0x3973a6)hopperUtils['swapAdditionalPhones'](_0x4fb89b,_0x32257b,_0xfcdb8c)[_0x3aea('0x44')](function(){return 0x1;});});}}}};Dialer[_0x3aea('0x19')][_0x3aea('0x3a')]=function(_0x4bc6c7){if(this[_0x3aea('0x25')][_0x4bc6c7['uniqueid']]){this[_0x3aea('0x25')][_0x4bc6c7[_0x3aea('0xc8')]][_0x3aea('0xfb')]=_0x4bc6c7['channel'];}if(this[_0x3aea('0x27')][_0x4bc6c7[_0x3aea('0xc8')]]){this[_0x3aea('0x27')][_0x4bc6c7[_0x3aea('0xc8')]][_0x3aea('0xfb')]=_0x4bc6c7[_0x3aea('0xfb')];}};Dialer[_0x3aea('0x19')][_0x3aea('0x3e')]=function(_0x1a923b){if(!this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]]){return;}var _0xbb9354=this[_0x3aea('0x1f')][this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]]['queue']]['strategy']||_0x3aea('0xfd');if(_0xbb9354==='roundrobin'){if(this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]]&&_['isNil'](this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]][_0x3aea('0xfe')])&&_0x1a923b['status']==='1'&&_0x1a923b['paused']==='0'){if(this[_0x3aea('0x21')][_0x1a923b[_0x3aea('0xff')]]){if(!this[_0x3aea('0x21')][_0x1a923b[_0x3aea('0xff')]][_0x3aea('0xfe')]){this[_0x3aea('0x21')][_0x1a923b[_0x3aea('0xff')]]['locked']=!![];this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]]['locked']=!![];this[_0x3aea('0x25')][_0x1a923b['actionid']][_0x3aea('0xff')]=_0x1a923b[_0x3aea('0xff')];}}}}else if(_0xbb9354===_0x3aea('0xfd')){if(this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]]){if(this[_0x3aea('0x21')][_0x1a923b[_0x3aea('0xff')]]){this[_0x3aea('0x25')][_0x1a923b['actionid']][_0x3aea('0xff')]=_0x1a923b['stateinterface'];if(_[_0x3aea('0x100')](this[_0x3aea('0x2a')][this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]][_0x3aea('0xcb')]])){this[_0x3aea('0x2a')][this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]][_0x3aea('0xcb')]]=[];}this[_0x3aea('0x2a')][this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]][_0x3aea('0xcb')]][_0x3aea('0xa0')](_[_0x3aea('0x101')](_[_0x3aea('0x7c')](this[_0x3aea('0x25')][_0x1a923b[_0x3aea('0xfc')]],['idHopper',_0x3aea('0xff')]),{'status':_0x1a923b['status'],'paused':_0x1a923b[_0x3aea('0x102')]}));}}}};Dialer[_0x3aea('0x19')][_0x3aea('0x40')]=function(_0x2198c7){if(!this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]]){return;}var _0x48058d=this;var _0x1b325a=this[_0x3aea('0x1f')][this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]]['queue']];var _0x441b9a=_0x1b325a[_0x3aea('0x103')]||'rrmemory';if(_0x441b9a===_0x3aea('0x104')){if(this[_0x3aea('0x25')][_0x2198c7['actionid']]&&this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xff')]){this[_0x3aea('0x1e')][_0x3aea('0x105')](this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0x106')],this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]]['stateinterface'])[_0x3aea('0xa6')](function(_0x28b8e0){logger[_0x3aea('0x6a')](_0x3aea('0x107'),util[_0x3aea('0x4a')](_0x28b8e0,{'showHidden':![],'depth':null}));})[_0x3aea('0x1c')](function(){_0x48058d['updateOriginated'](_0x48058d['voiceQueues'][_0x48058d[_0x3aea('0x25')][_0x2198c7['actionid']][_0x3aea('0xcb')]]);_0x48058d['agents'][_0x48058d[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xff')]][_0x3aea('0xfe')]=![];delete _0x48058d['actions'][_0x2198c7[_0x3aea('0xfc')]];unlockQueueStatus(_0x1b325a);});}else{this[_0x3aea('0xca')](this[_0x3aea('0x1f')][this['actions'][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]]);hopperUtils[_0x3aea('0xe6')]({'active':![],'ContactId':this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xe8')],'ListId':this['actions'][_0x2198c7['actionid']][_0x3aea('0xe9')],'VoiceQueueId':this['actions'][_0x2198c7[_0x3aea('0xfc')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]]['CampaignId']||undefined})[_0x3aea('0xa6')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]];unlockQueueStatus(_0x1b325a);}}else if(_0x441b9a==='rrmemory'){var _0x32765b;if(this['actions'][_0x2198c7[_0x3aea('0xfc')]]&&!_[_0x3aea('0x4d')](this['queueBooked'][this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]])){if(this[_0x3aea('0x2b')][_0x48058d['actions'][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]]){this[_0x3aea('0x2b')][_0x48058d[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]]=this['queueBookedRR'][this[_0x3aea('0x25')][_0x2198c7['actionid']][_0x3aea('0xcb')]]?this['queueBookedRR'][this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]]:this[_0x3aea('0x2a')][this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]]?this[_0x3aea('0x2a')][this[_0x3aea('0x25')][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]][_0x3aea('0x108')]||0x0:0x0;}this[_0x3aea('0x2a')][this['actions'][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]][_0x3aea('0x108')]=this['queueBookedRR'][this['actions'][_0x2198c7[_0x3aea('0xfc')]][_0x3aea('0xcb')]];for(var _0x2fe15a=0x0;_0x2fe15a=_0x14fd4f['dialGlobalMaxRetry']){_0x4fbb8b['stateGlobal'](_0x113be9,_0x3eb782,_0x2ad9b5,_0x3aea('0x12b'));}else{if(_0x113be9[_0x3aea('0x129')]>=_0x14fd4f[_0x3aea('0x12c')]){_0x4fbb8b['createStateFinal'](_0x113be9,_0x3eb782,_0x2ad9b5,'reason\x2019\x20machine....');}else{hopperUtils[_0x3aea('0xe6')]({'active':![],'countmachineretry':_0x113be9['countmachineretry'],'scheduledat':moment()['add'](_0x14fd4f[_0x3aea('0x12d')],_0x3aea('0xe7'))['format'](_0x3aea('0xcd')),'ContactId':_0x113be9[_0x3aea('0xe8')],'ListId':_0x113be9['ListId'],'VoiceQueueId':_0x113be9[_0x3aea('0xea')]||undefined,'CampaignId':_0x113be9[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x12e')));_0x3eb782({'reschedule':0x1});}}});}if(_0x57c733[_0x3aea('0xc9')]===_0x3aea('0xce')&&this[_0x3aea('0x20')][_0x57c733['queue']][_0x3aea('0x119')]&&_0x3df1e2['value']==='HANGUP'){delete this[_0x3aea('0x27')][_0x3df1e2['uniqueid']];this[_0x3aea('0xca')](this['campaigns'][_0x57c733[_0x3aea('0xcb')]]);_0x4b3085=new Hangup(_0x57c733,_0x3df1e2);_0x4b3085['state']=0x12;_0x4b3085['statedesc']=_0x3aea('0x11c');_0x4b3085[_0x3aea('0x125')]=_0x3aea('0x11d');ami[_0x3aea('0x46')](_0x3aea('0x11e'),ut[_0x3aea('0x11f')](_0x4b3085,_0x3aea('0x120')));this['saveInDb'](_0x4b3085,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x57c733[_0x3aea('0xc9')]===_0x3aea('0xce')&&this[_0x3aea('0x20')][_0x57c733['queue']][_0x3aea('0x119')]&&_0x3df1e2[_0x3aea('0x11a')]===_0x3aea('0x123')){return new Promise(function(_0x41c0d0,_0x58f0ed){delete _0x4fbb8b[_0x3aea('0x27')][_0x3df1e2[_0x3aea('0xc8')]];_0x4fbb8b[_0x3aea('0xca')](_0x4fbb8b['campaigns'][_0x57c733[_0x3aea('0xcb')]]);_0x4fbb8b[_0x3aea('0x20')][_0x57c733[_0x3aea('0xcb')]][_0x3aea('0xcf')]+=0x1;_0x4fbb8b[_0x3aea('0x20')][_0x57c733[_0x3aea('0xcb')]][_0x3aea('0x11b')]+=0x1;var _0x58d5c2=_0x4fbb8b[_0x3aea('0x20')][_0x57c733[_0x3aea('0xcb')]];var _0x5c5543=new Hangup(_0x57c733,_0x3df1e2);_0x5c5543[_0x3aea('0x75')]=0x13;_0x5c5543['statedesc']='Machine';_0x5c5543[_0x3aea('0x125')]=_0x3aea('0x11d');_0x5c5543[_0x3aea('0x129')]+=0x1;_0x5c5543[_0x3aea('0xe0')]+=0x1;_0x5c5543[_0x3aea('0x120')]=!![];ami[_0x3aea('0x46')](_0x3aea('0x11e'),ut[_0x3aea('0x11f')](_0x5c5543,_0x3aea('0x120')));hopperUtils[_0x3aea('0xd4')](_0x5c5543)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x126')));if(_0x5c5543[_0x3aea('0x12f')]+_0x5c5543[_0x3aea('0x127')]+_0x5c5543['countnoanswerretry']+_0x5c5543[_0x3aea('0x130')]+_0x5c5543[_0x3aea('0xdf')]+_0x5c5543[_0x3aea('0xf6')]+_0x5c5543[_0x3aea('0x129')]+_0x5c5543[_0x3aea('0x12a')]>=_0x58d5c2[_0x3aea('0x131')]){_0x4fbb8b[_0x3aea('0x132')](_0x5c5543,_0x41c0d0,_0x58f0ed,_0x3aea('0x12b'));}else{if(_0x5c5543[_0x3aea('0x129')]>=_0x58d5c2[_0x3aea('0x12c')]){_0x4fbb8b[_0x3aea('0x133')](_0x5c5543,_0x41c0d0,_0x58f0ed,_0x3aea('0x134'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x5c5543[_0x3aea('0x129')],'scheduledat':moment()[_0x3aea('0x135')](_0x58d5c2[_0x3aea('0x12d')],_0x3aea('0xe7'))[_0x3aea('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5c5543[_0x3aea('0xe8')],'ListId':_0x5c5543[_0x3aea('0xe9')],'VoiceQueueId':_0x5c5543[_0x3aea('0xea')]||undefined,'CampaignId':_0x5c5543['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x41c0d0({'reschedule':0x1});}}});}}};Dialer[_0x3aea('0x19')][_0x3aea('0x38')]=function(_0x344ed9){var _0x300295=this[_0x3aea('0x27')][_0x344ed9['uniqueid']];var _0x35db90;if(_0x300295&&_0x300295[_0x3aea('0xc9')]===_0x3aea('0xce')){delete this[_0x3aea('0x27')][_0x344ed9['uniqueid']];this[_0x3aea('0xca')](this[_0x3aea('0x20')][_0x300295['queue']]);this['campaigns'][_0x300295[_0x3aea('0xcb')]]['ivrAnswerCallsDay']+=0x1;_0x35db90=new Hangup(_0x300295,_0x344ed9);hopperUtils[_0x3aea('0xd4')](_0x35db90)['catch'](loggerCatch(_0x3aea('0x136')));hopperUtils[_0x3aea('0xd6')](_0x35db90)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x137')));}if(_0x300295&&_0x300295['type']!==_0x3aea('0xce')&&isNotNull(this[_0x3aea('0x1f')][_0x300295[_0x3aea('0xcb')]][_0x3aea('0x138')])){delete this['uniqueId'][_0x344ed9[_0x3aea('0xc8')]];this[_0x3aea('0xca')](this[_0x3aea('0x1f')][_0x300295[_0x3aea('0xcb')]]);this[_0x3aea('0x1f')][_0x300295[_0x3aea('0xcb')]][_0x3aea('0xcf')]+=0x1;this[_0x3aea('0x1f')][_0x300295[_0x3aea('0xcb')]][_0x3aea('0x11b')]+=0x1;_0x35db90=new Hangup(_0x300295,_0x344ed9);_0x35db90['state']=0x10;_0x35db90['statedesc']=_0x3aea('0x139');_0x35db90[_0x3aea('0x125')]=_0x3aea('0x13a');hopperUtils['createHistory'](_0x35db90)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x136')));hopperUtils[_0x3aea('0xd6')](_0x35db90)[_0x3aea('0xa6')](loggerCatch('[syncHangupIvr]'));}if(_0x300295&&_0x300295[_0x3aea('0xc9')]!==_0x3aea('0xce')&&!isNotNull(this[_0x3aea('0x1f')][_0x300295[_0x3aea('0xcb')]][_0x3aea('0x138')])){delete this['uniqueId'][_0x344ed9[_0x3aea('0xc8')]];this[_0x3aea('0xca')](this['voiceQueues'][_0x300295[_0x3aea('0xcb')]]);this[_0x3aea('0x1f')][_0x300295[_0x3aea('0xcb')]][_0x3aea('0x13b')]+=0x1;_0x35db90=new Hangup(_0x300295,_0x344ed9);_0x35db90['state']=0xc;_0x35db90[_0x3aea('0x76')]=_0x344ed9[_0x3aea('0x13c')];_0x35db90[_0x3aea('0x125')]='Unknow';hopperUtils['createHistory'](_0x35db90)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x136')));hopperUtils[_0x3aea('0xd6')](_0x35db90)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x137')));}};Dialer['prototype'][_0x3aea('0xb')]=function(_0x5e54f3){var _0xd98d0e=this;if(!_0xd98d0e[_0x3aea('0x2c')][_0x5e54f3[_0x3aea('0x4c')]]){_0xd98d0e[_0x3aea('0x2c')][_0x5e54f3['name']]={'running':![]};}else if(_0xd98d0e[_0x3aea('0x2c')][_0x5e54f3['name']][_0x3aea('0x13d')]===!![]){return;}else if(_0xd98d0e[_0x3aea('0x2c')][_0x5e54f3['name']][_0x3aea('0x13d')]===![]){_0xd98d0e[_0x3aea('0x2c')][_0x5e54f3[_0x3aea('0x4c')]][_0x3aea('0x13d')]=!![];}var _0x520a86=_0xd98d0e['voiceQueues'][_0x5e54f3[_0x3aea('0x4c')]];var _0x152df3=_0x520a86[_0x3aea('0x6e')]!==utils['CAMPAIGN_STATUS'][_0x3aea('0x82')];var _0x540277=utils[_0x3aea('0x13e')](_0x520a86);_0x520a86[_0x3aea('0x13f')]=utils['getQueueCampaignStatusMessage'](_0x520a86,_0xd98d0e[_0x3aea('0x22')]);Promise[_0x3aea('0xb0')]()[_0x3aea('0x44')](function(){if(_0x520a86['statusMessage']===utils[_0x3aea('0x6f')][_0x3aea('0x82')]){if(_0x152df3){clearPredictiveAttributes(_0x520a86);_0x5e54f3[_0x3aea('0x67')]=undefined;_0x5e54f3[_0x3aea('0x65')]=undefined;}if(_0x520a86[_0x3aea('0x13f')]===utils[_0x3aea('0x6f')][_0x3aea('0x82')]){_0x5e54f3[_0x3aea('0x140')]=0x0;_0x5e54f3[_0x3aea('0x102')]=0x0;_0x5e54f3[_0x3aea('0x141')]=0x0;_0x5e54f3[_0x3aea('0x142')]=0x0;_0x5e54f3['pTalking']=0x0;}}else if(_0x520a86[_0x3aea('0x13f')]===utils[_0x3aea('0x6f')][_0x3aea('0x143')]&&!_0x540277){return _0xd98d0e[_0x3aea('0x98')](_0x520a86,!![])[_0x3aea('0x44')](function(){return _0xd98d0e[_0x3aea('0x98')](_0x520a86,![]);})[_0x3aea('0x44')](function(){return _0xd98d0e[_0x3aea('0xb5')](_0x520a86);})[_0x3aea('0xa6')](function(_0x41a221){loggerSyncQueueSummary[_0x3aea('0x48')]('[syncQueueSummary]',util[_0x3aea('0x4a')](_0x41a221,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x520a86);});}else{clearPredictiveAttributes(_0x520a86);}})['then'](function(){var _0x35da11=_0x5e54f3[_0x3aea('0x144')](_0x520a86);if(_0x35da11||_0x520a86[_0x3aea('0x145')]){_0x520a86[_0x3aea('0x145')]=![];_0x5e54f3[_0x3aea('0x146')](_0x520a86);Object[_0x3aea('0x147')](_0x520a86,_0x5e54f3);emitOutboundVoiceQueueSummary(_0x5e54f3);}_0xd98d0e['queuesSummary'][_0x520a86['name']]['running']=![];})[_0x3aea('0xa6')](function(_0x3b88a1){logger[_0x3aea('0x6a')]('[syncQueueSummary]',util[_0x3aea('0x4a')](_0x3b88a1,{'showHidden':![],'depth':null}));_0xd98d0e[_0x3aea('0x2c')][_0x520a86['name']][_0x3aea('0x13d')]=![];});};Dialer[_0x3aea('0x19')][_0x3aea('0x36')]=_[_0x3aea('0x148')](function(){var _0x1446bc=_[_0x3aea('0x149')](this[_0x3aea('0x1f')],function(_0x5cf900){return _0x5cf900[_0x3aea('0x14a')];});var _0x1199b6=_['filter'](this[_0x3aea('0x21')],function(_0x1060c8){return _0x1060c8[_0x3aea('0x14b')]&&_0x1060c8[_0x3aea('0x91')]===_0x3aea('0x90');});if(_0x1446bc['length']>0x0&&_0x1199b6[_0x3aea('0x9f')]>0x0){return Promise[_0x3aea('0xb0')]()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0x3aea('0x14c')](_0x1446bc,'id'),previewRecallmeReminderInterval,_['map'](_0x1199b6,'id')))[_0x3aea('0x44')](function(_0x2849c7){for(var _0x29bc8f=0x0;_0x29bc8f<_0x2849c7[_0x3aea('0x9f')];_0x29bc8f++){var _0x4c205b=_0x2849c7[_0x29bc8f][_0x3aea('0x14d')][_0x3aea('0x4c')];if(_0x4c205b)io['to'](util[_0x3aea('0x4b')](_0x3aea('0x14e'),_0x4c205b))[_0x3aea('0x46')](_0x3aea('0x14f'),{'hopper':_0x2849c7[_0x29bc8f]});}})[_0x3aea('0xa6')](function(_0x5411de){logger['error'](_0x3aea('0x150'),_0x5411de);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x3aea('0x42')]=function(){var _0x458e3a=this;setInterval(function(){_0x458e3a['clearZombieChannels'](_0x458e3a['uniqueId'],_0x3aea('0x151'));_0x458e3a['clearZombieChannels'](_0x458e3a['actions'],_0x3aea('0x152'));},0x32c8);};Dialer[_0x3aea('0x19')][_0x3aea('0x153')]=function(_0xe625a1,_0x4c461d){var _0x2e0b44=this;for(var _0x1eda74 in _0xe625a1){if(typeof _0xe625a1[_0x1eda74]!==_0x3aea('0xaf')){this['sequence'][_0x3aea('0x1a')](function(){if(!_['isNil'](_0xe625a1[_0x1eda74])){return ami[_0x3aea('0xa1')]({'action':_0x3aea('0x91'),'channel':_0xe625a1[_0x1eda74]['channel']})[_0x3aea('0xa6')](function(_0x5349dd){if(_0x5349dd[_0x3aea('0x6e')]===_0x3aea('0x154')){setTimeout(function(){if(_0xe625a1[_0x1eda74]&&_0xe625a1[_0x1eda74][_0x3aea('0xc9')]!=='ivr'){_0x2e0b44[_0x3aea('0xca')](_0x2e0b44[_0x3aea('0x1f')][_0xe625a1[_0x1eda74][_0x3aea('0xcb')]]);logger[_0x3aea('0x6a')](_0x3aea('0x155'),_0x4c461d,_0x1eda74,_0xe625a1[_0x1eda74]['queue']);delete _0xe625a1[_0x1eda74];}if(_0xe625a1[_0x1eda74]&&_0xe625a1[_0x1eda74][_0x3aea('0xc9')]==='ivr'){_0x2e0b44[_0x3aea('0xca')](_0x2e0b44[_0x3aea('0x20')][_0xe625a1[_0x1eda74][_0x3aea('0xcb')]]);logger[_0x3aea('0x6a')](_0x3aea('0x156'),_0x4c461d,_0x1eda74,_0xe625a1[_0x1eda74][_0x3aea('0xcb')]);delete _0xe625a1[_0x1eda74];}},0x2328);}});}});}}};Dialer[_0x3aea('0x19')][_0x3aea('0x157')]=function(_0x14ab79){return Promise[_0x3aea('0xb0')]()[_0x3aea('0x44')](voiceQueueRt[_0x3aea('0x157')](_0x14ab79))['catch'](loggerCatch(_0x3aea('0x158')));};Dialer[_0x3aea('0x19')][_0x3aea('0xca')]=function(_0x45fb46){if(!_[_0x3aea('0x45')](_0x45fb46)&&_0x45fb46!==null){if(typeof _0x45fb46['originated']!==_0x3aea('0xaf')){if(_0x45fb46[_0x3aea('0x87')]>0x0){_0x45fb46[_0x3aea('0x87')]-=0x1;}else{logger[_0x3aea('0x6a')](_0x3aea('0x159'));}}}else{logger[_0x3aea('0x6a')](_0x3aea('0x15a'));}};Dialer[_0x3aea('0x19')][_0x3aea('0x15b')]=function(_0x5139b2,_0x473650){var _0x119c4c=this;return function(_0x33bdb4){_0x119c4c[_0x3aea('0xca')](_0x473650);logger[_0x3aea('0x6a')](_0x5139b2,util['inspect'](_0x33bdb4,{'showHidden':![],'depth':null}));};};Dialer[_0x3aea('0x19')]['emptyContact']=function(_0x27f9bf,_0x38eb88,_0xe872d){var _0x4d05f5={'state':0x19,'statedesc':'notFound'};this[_0x3aea('0xca')](_0x38eb88);this[_0x3aea('0x15c')](_[_0x3aea('0x101')](_0x4d05f5,_['pick'](_0xe872d,[_0x3aea('0xe8'),'ListId','UserId',_0x3aea('0xea'),_0x3aea('0xeb')])),_0x3aea('0x15d'),_0x3aea('0x15e'));logger[_0x3aea('0x6a')](_0x27f9bf);};Dialer[_0x3aea('0x19')][_0x3aea('0x15c')]=function(_0x297157,_0x332114,_0x34ca04){hopperUtils[_0x3aea('0xd4')](_0x297157)[_0x3aea('0xa6')](loggerCatch(_0x332114));hopperUtils['moveContactManagedDialer'](_0x297157)[_0x3aea('0xa6')](loggerCatch(_0x34ca04));};Dialer[_0x3aea('0x19')][_0x3aea('0xe4')]=function(_0x5493b4,_0x3b1618){hopperUtils['createHistory'](_0x5493b4)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xd5')));if(_0x3b1618==0x0){hopperUtils[_0x3aea('0xd6')](_0x5493b4)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x15f')));}};Dialer['prototype'][_0x3aea('0x150')]=function(_0x55b36f){return Promise[_0x3aea('0xb0')]()['then'](cmHopper[_0x3aea('0x160')](_0x55b36f['id'],previewRecallmeReminderInterval))[_0x3aea('0x44')](function(_0x5d773d){for(var _0x5303cc=0x0;_0x5303cc<_0x5d773d[_0x3aea('0x9f')];_0x5303cc++){var _0xf79fa6=_0x5d773d[_0x5303cc]['Agent'][_0x3aea('0x4c')];if(_0xf79fa6)io['to'](util[_0x3aea('0x4b')]('user:%s',_0xf79fa6))[_0x3aea('0x46')](_0x3aea('0x14f'),{'hopper':_0x5d773d[_0x5303cc]});}})[_0x3aea('0xa6')](function(){});};Dialer[_0x3aea('0x19')]['launchHandleIvr']=function(_0xb32324){var _0x23c905=this;return function(){_0x23c905[_0x3aea('0x161')](_0xb32324);};};Dialer[_0x3aea('0x19')][_0x3aea('0x162')]=function(_0x15cbe2,_0x104733){var _0x9631e9=this;var _0x34dc9f=uuid['v4']();this[_0x3aea('0x25')][_0x34dc9f]=new Action(_0x15cbe2,_0x104733,_0x34dc9f);return new Promise(function(_0xa0ab3b,_0x5497d2){if(_[_0x3aea('0x45')](_0x15cbe2)&&typeof _0x15cbe2!==_0x3aea('0x163')){return _0x5497d2(msgResponse(_0x3aea('0x164'),_0x3aea('0x99'),'voiceQueue\x20is\x20undefine'));}if(_[_0x3aea('0x45')](_0x104733[_0x3aea('0x165')])||_0x104733[_0x3aea('0x165')]===null){return _0x5497d2(msgResponse(_0x3aea('0x164'),'Failure',_0x3aea('0x166')));}var _0x4394a7={'XMD-CALLERID':_0x9631e9[_0x3aea('0x25')][_0x34dc9f]['getCaller'](),'XMD-AGI':_0x15cbe2[_0x3aea('0x138')]?util[_0x3aea('0x4b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x15cbe2[_0x3aea('0x138')]):_0x3aea('0x167'),'XMD-AGIAFTER':_0x15cbe2[_0x3aea('0xd2')]?util[_0x3aea('0x4b')](_0x3aea('0x168'),ipAgi,_0x15cbe2[_0x3aea('0xd2')]):_0x3aea('0x167'),'XMD-QUEUE':utils[_0x3aea('0x169')](_0x15cbe2)?util[_0x3aea('0x4b')](_0x3aea('0x16a'),_0x15cbe2[_0x3aea('0x4c')],_0x15cbe2[_0x3aea('0x16b')]||'',_0x15cbe2[_0x3aea('0xd3')]?'c':'',_0x15cbe2[_0x3aea('0xda')]||0x3):_0x3aea('0x167'),'XMD-CONTACTID':_0x104733[_0x3aea('0xe8')],'XMD-CDRTYPE':_0x3aea('0x16c'),'CALLERID(all)':_0x9631e9[_0x3aea('0x25')][_0x34dc9f][_0x3aea('0x16d')](),'XMD-AMD':_0x15cbe2[_0x3aea('0x119')]?_0x3aea('0x143'):_0x3aea('0x167'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x15cbe2[_0x3aea('0x119')]){_0x4394a7[_0x3aea('0x16e')]=_0x15cbe2['dialAMDInitialSilence']||0x9c4;_0x4394a7[_0x3aea('0x16f')]=_0x15cbe2['dialAMDGreeting']||0x5dc;_0x4394a7[_0x3aea('0x170')]=_0x15cbe2[_0x3aea('0x171')]||0x320;_0x4394a7['XMD-AMDTOTALANALYSISTIME']=_0x15cbe2[_0x3aea('0x172')]||0x1388;_0x4394a7['XMD-AMDMINWORDLENGTH']=_0x15cbe2[_0x3aea('0x173')]||0x64;_0x4394a7[_0x3aea('0x174')]=_0x15cbe2['dialAMDBetweenWordsSilence']||0x32;_0x4394a7[_0x3aea('0x175')]=_0x15cbe2[_0x3aea('0x176')]||0x3;_0x4394a7[_0x3aea('0x177')]=_0x15cbe2[_0x3aea('0x178')]||0x100;_0x4394a7[_0x3aea('0x179')]=_0x15cbe2[_0x3aea('0x17a')]||0x1388;}if(utils[_0x3aea('0x169')](_0x15cbe2)){_0x4394a7[_0x3aea('0x17b')]=_0x104733[_0x3aea('0xea')];}else{_0x4394a7[_0x3aea('0x17c')]=_0x104733[_0x3aea('0xeb')];}for(var _0x51fe18 in _0x104733[_0x3aea('0x17d')]){if(typeof _0x104733[_0x3aea('0x17d')][_0x51fe18]!==_0x3aea('0xaf')){if(isNotNull(_0x104733[_0x3aea('0x17d')][_0x51fe18])&&_0x51fe18!=='id'&&_0x51fe18!==_0x3aea('0x17e')&&_0x51fe18!==_0x3aea('0x17f')&&_0x51fe18!==_0x3aea('0x180')){_0x4394a7[util[_0x3aea('0x4b')]('%s%s',_0x3aea('0x181'),_['toUpper'](_0x51fe18))]=_0x104733[_0x3aea('0x17d')][_0x51fe18];}}}var _0x8bced5=_0x9631e9[_0x3aea('0x8d')](_0x15cbe2[_0x3aea('0x182')])?utils[_0x3aea('0x183')](_0x15cbe2['Trunk']['callerid'],_0x15cbe2[_0x3aea('0x184')],_0x15cbe2[_0x3aea('0x185')]>0x0?utils[_0x3aea('0x186')](_0x15cbe2[_0x3aea('0x187')],_0x15cbe2[_0x3aea('0x185')]):_0x15cbe2[_0x3aea('0x187')]):utils[_0x3aea('0x183')](_[_0x3aea('0x100')](_0x15cbe2[_0x3aea('0x93')])?_0x15cbe2[_0x3aea('0x182')][_0x3aea('0x188')]:_0x15cbe2[_0x3aea('0x93')][_0x3aea('0x188')],_0x15cbe2[_0x3aea('0x184')],_0x15cbe2[_0x3aea('0x185')]>0x0?utils[_0x3aea('0x186')](_0x15cbe2['dialOriginateCallerIdNumber'],_0x15cbe2[_0x3aea('0x185')]):_0x15cbe2[_0x3aea('0x187')]);if(_0x8bced5){_0x4394a7[_0x3aea('0x189')]=_0x9631e9['actions'][_0x34dc9f]['originatecalleridname']=utils['extractCalleridName'](_0x8bced5);_0x4394a7['XMD-ORIGINATECALLERIDNUM']=_0x104733['phone'];}_0x15cbe2[_0x3aea('0x18a')]=_0x4394a7;return ami['Action']({'actionid':_0x34dc9f,'action':'originate','channel':_0x9631e9[_0x3aea('0x8d')](_0x15cbe2['Trunk'])?util['format'](_0x3aea('0x18b'),_0x15cbe2[_0x3aea('0x182')][_0x3aea('0x4c')],isNotNull(_0x15cbe2[_0x3aea('0x18c')])?_0x15cbe2[_0x3aea('0x18c')]['trim']()||'':'',_0x15cbe2[_0x3aea('0x18d')]>0x0?_0x104733['phone'][_0x3aea('0x18e')](_0x15cbe2[_0x3aea('0x18d')]):_0x104733[_0x3aea('0x165')]):util[_0x3aea('0x4b')]('SIP/%s/%s%s',_[_0x3aea('0x100')](_0x15cbe2[_0x3aea('0x93')])?_0x15cbe2[_0x3aea('0x182')][_0x3aea('0x4c')]:_0x15cbe2['TrunkBackup'][_0x3aea('0x4c')],isNotNull(_0x15cbe2['dialPrefix'])?_0x15cbe2['dialPrefix'][_0x3aea('0x18f')]()||'':'',_0x15cbe2[_0x3aea('0x18d')]>0x0?_0x104733[_0x3aea('0x165')][_0x3aea('0x18e')](_0x15cbe2[_0x3aea('0x18d')]):_0x104733[_0x3aea('0x165')]),'callerid':_0x8bced5,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x4394a7,'timeout':(_0x15cbe2['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x34dc9f})[_0x3aea('0x44')](function(_0x781947){return _0xa0ab3b(_0x781947);})[_0x3aea('0xa6')](function(_0x2c7c9a){_0x15cbe2['outboundOriginateFailureCallsDay']+=0x1;var _0x2293f0=new History(_0x9631e9[_0x3aea('0x25')][_0x34dc9f]);logger[_0x3aea('0x6a')](util[_0x3aea('0x4b')](_0x3aea('0x190'),JSON[_0x3aea('0x7b')](_0x2c7c9a)));_0x2293f0[_0x3aea('0x75')]=0xe;_0x2293f0[_0x3aea('0x76')]='OriginateError';_0x2293f0['starttime']=moment()[_0x3aea('0x4b')](_0x3aea('0xcd'));_0x2293f0[_0x3aea('0x77')]=_0x2293f0[_0x3aea('0x78')];hopperUtils[_0x3aea('0xd4')](_0x2293f0)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x191')));_0x9631e9[_0x3aea('0xd6')](_0x2293f0)['catch'](loggerCatch(_0x3aea('0x191')))[_0x3aea('0x1c')](function(){delete _0x9631e9[_0x3aea('0x25')][_0x34dc9f];return _0x5497d2(msgResponse(_0x3aea('0x164'),_0x3aea('0x8c'),'originate\x20action\x20Error'));});});});};Dialer[_0x3aea('0x19')][_0x3aea('0x192')]=function(_0xe1dbbf,_0x24f43c,_0x4ba6df){var _0x358699=new History(_0x24f43c);if(_0x358699['countbusyretry']+_0x358699[_0x3aea('0x127')]+_0x358699[_0x3aea('0x128')]+_0x358699[_0x3aea('0x130')]+_0x358699[_0x3aea('0xdf')]+_0x358699[_0x3aea('0xf6')]+_0x358699[_0x3aea('0x129')]+_0x358699[_0x3aea('0x12a')]>=_0x4ba6df[_0x3aea('0x131')]-0x1){return!![];}switch(_0xe1dbbf){case 0x3:if(_0x358699['countnoanswerretry']>=_0x4ba6df[_0x3aea('0x193')]-0x1){return!![];}hopperUtils[_0x3aea('0xe6')]({'active':![],'countnoanswerretry':_0x358699[_0x3aea('0x128')]+=0x1,'scheduledat':moment()['add'](_0x4ba6df['dialNoAnswerRetryFrequency'],_0x3aea('0xe7'))[_0x3aea('0x4b')](_0x3aea('0xcd')),'ContactId':_0x358699[_0x3aea('0xe8')],'ListId':_0x358699[_0x3aea('0xe9')],'VoiceQueueId':_0x358699['VoiceQueueId']||undefined,'CampaignId':_0x358699[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x194')));break;case 0x5:if(_0x358699[_0x3aea('0x12f')]>=_0x4ba6df['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x3aea('0xe6')]({'active':![],'countbusyretry':_0x358699[_0x3aea('0x12f')]+=0x1,'scheduledat':moment()['add'](_0x4ba6df[_0x3aea('0x195')],_0x3aea('0xe7'))[_0x3aea('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x358699[_0x3aea('0xe8')],'ListId':_0x358699[_0x3aea('0xe9')],'VoiceQueueId':_0x358699['VoiceQueueId']||undefined,'CampaignId':_0x358699[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x196')));break;case 0x8:if(_0x358699['countcongestionretry']>=_0x4ba6df[_0x3aea('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x358699[_0x3aea('0x127')]+=0x1,'scheduledat':moment()[_0x3aea('0x135')](_0x4ba6df[_0x3aea('0x198')],_0x3aea('0xe7'))[_0x3aea('0x4b')](_0x3aea('0xcd')),'ContactId':_0x358699['ContactId'],'ListId':_0x358699[_0x3aea('0xe9')],'VoiceQueueId':_0x358699[_0x3aea('0xea')]||undefined,'CampaignId':_0x358699[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x199')));break;case 0x0:if(_0x358699[_0x3aea('0x130')]>=_0x4ba6df[_0x3aea('0x19a')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x358699['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x3aea('0x135')](_0x4ba6df[_0x3aea('0x19b')],_0x3aea('0xe7'))[_0x3aea('0x4b')](_0x3aea('0xcd')),'ContactId':_0x358699[_0x3aea('0xe8')],'ListId':_0x358699[_0x3aea('0xe9')],'VoiceQueueId':_0x358699[_0x3aea('0xea')]||undefined,'CampaignId':_0x358699['CampaignId']||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x19c')));}break;case 0xa:if(_0x358699[_0x3aea('0xdf')]>=_0x4ba6df[_0x3aea('0xe3')]-0x1){return!![];}hopperUtils[_0x3aea('0xe6')]({'active':![],'countdropretry':_0x358699[_0x3aea('0xdf')]+=0x1,'scheduledat':moment()[_0x3aea('0x135')](_0x4ba6df[_0x3aea('0xe1')],'minutes')[_0x3aea('0x4b')](_0x3aea('0xcd')),'ContactId':_0x358699[_0x3aea('0xe8')],'ListId':_0x358699[_0x3aea('0xe9')],'VoiceQueueId':_0x358699['VoiceQueueId']||undefined,'CampaignId':_0x358699[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0xec')));break;case 0xb:if(_0x358699[_0x3aea('0xf6')]>=_0x4ba6df['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x358699[_0x3aea('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x4ba6df[_0x3aea('0xf7')],'minutes')[_0x3aea('0x4b')](_0x3aea('0xcd')),'ContactId':_0x358699[_0x3aea('0xe8')],'ListId':_0x358699[_0x3aea('0xe9')],'VoiceQueueId':_0x358699[_0x3aea('0xea')]||undefined,'CampaignId':_0x358699[_0x3aea('0xeb')]||undefined})['catch'](loggerCatch(_0x3aea('0xf9')));break;case 0x13:if(_0x358699[_0x3aea('0x129')]>=_0x4ba6df[_0x3aea('0x12c')]-0x1){return!![];}hopperUtils[_0x3aea('0xe6')]({'active':![],'countmachineretry':_0x358699[_0x3aea('0x129')]+=0x1,'scheduledat':moment()[_0x3aea('0x135')](_0x4ba6df[_0x3aea('0x12d')],_0x3aea('0xe7'))[_0x3aea('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x358699[_0x3aea('0xe8')],'ListId':_0x358699['ListId'],'VoiceQueueId':_0x358699[_0x3aea('0xea')]||undefined,'CampaignId':_0x358699[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x358699[_0x3aea('0x12a')]>=_0x4ba6df[_0x3aea('0x19d')]-0x1){return!![];}hopperUtils[_0x3aea('0xe6')]({'active':![],'countagentrejectretry':_0x358699[_0x3aea('0x12a')]+=0x1,'scheduledat':moment()[_0x3aea('0x135')](_0x4ba6df[_0x3aea('0x19e')],'minutes')['format'](_0x3aea('0xcd')),'ContactId':_0x358699[_0x3aea('0xe8')],'ListId':_0x358699[_0x3aea('0xe9')],'VoiceQueueId':_0x358699[_0x3aea('0xea')]||undefined,'CampaignId':_0x358699[_0x3aea('0xeb')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3aea('0x19')][_0x3aea('0x114')]=function(_0x449662,_0xb3be07,_0x11a622){var _0x1357db=this;var _0x3a13c4=new History(_0x449662);var _0x296bc1=![];var _0x34f3bd;var _0x2f6059;return new Promise(function(_0x4f1716,_0xe8cf78){if(_['isUndefined'](_0xb3be07)&&typeof _0xb3be07!==_0x3aea('0x163')){return _0xe8cf78(msgResponse(_0x3aea('0x19f'),_0x3aea('0x99'),_0x3aea('0x1a0')));}if(_[_0x3aea('0x45')](_0x11a622)&&typeof _0x11a622!==_0x3aea('0x163')){return _0xe8cf78(msgResponse(_0x3aea('0x19f'),_0x3aea('0x99'),_0x3aea('0x1a1')));}hopperUtils['verifyAdditionalPhones'](_0x3a13c4,_0x11a622[_0x3aea('0xd0')],_0xb3be07)[_0x3aea('0x44')](function(_0x4bd5f5){if(_0x4bd5f5[_0x3aea('0xe5')]==0x1)_0x296bc1=!![];switch(_0x11a622['reason']){case'0':_0xb3be07[_0x3aea('0x1a2')]+=0x1;_0x3a13c4['state']=0x0;_0x3a13c4[_0x3aea('0x76')]=_0x3aea('0x1a3');_0x3a13c4[_0x3aea('0x130')]+=0x1;_0x3a13c4[_0x3aea('0xe0')]+=0x1;ami[_0x3aea('0x46')](_0x3aea('0x1a4'),ut[_0x3aea('0x11f')](_0x449662,_0x3aea('0x1a5')));_0x34f3bd=_0xb3be07['dialNoSuchNumberRetryFrequency'];_0x2f6059=_0xb3be07[_0x3aea('0xe2')];hopperUtils[_0x3aea('0xd4')](_0x3a13c4)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x126')));if(_0x1357db[_0x3aea('0x192')](0x0,_0x449662,_0xb3be07)&&!_0x296bc1){if(_0x3a13c4[_0x3aea('0x130')]>=_0xb3be07[_0x3aea('0x19a')]){_0x1357db[_0x3aea('0x133')](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1a6'));}else{_0x1357db['stateGlobal'](_0x3a13c4,_0x4f1716,_0xe8cf78,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xb3be07[_0x3aea('0x1a7')]+=0x1;_0x3a13c4[_0x3aea('0x75')]=0x3;_0x3a13c4[_0x3aea('0x76')]=_0x3aea('0x1a8');_0x3a13c4[_0x3aea('0x128')]+=0x1;_0x3a13c4[_0x3aea('0xe0')]+=0x1;var _0x42bc40=ut['buildNoAnswerEventPayload'](_0x449662,_0xb3be07);ami[_0x3aea('0x46')]('custom:agentnoanswer',_0x42bc40);_0x34f3bd=_0xb3be07[_0x3aea('0x1a9')];_0x2f6059=_0xb3be07['callAdditionalPhoneAfterMin'];hopperUtils[_0x3aea('0xd4')](_0x3a13c4)[_0x3aea('0xa6')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1357db[_0x3aea('0x192')](0x3,_0x449662,_0xb3be07)&&!_0x296bc1){if(_0x3a13c4[_0x3aea('0x128')]>=_0xb3be07[_0x3aea('0x193')]){_0x1357db[_0x3aea('0x133')](_0x3a13c4,_0x4f1716,_0xe8cf78,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1357db['stateGlobal'](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1aa'));}}break;case'5':_0xb3be07[_0x3aea('0x1ab')]+=0x1;_0x3a13c4[_0x3aea('0x75')]=0x5;_0x3a13c4[_0x3aea('0x76')]=_0x3aea('0x1ac');_0x3a13c4[_0x3aea('0x12f')]+=0x1;_0x3a13c4[_0x3aea('0xe0')]+=0x1;ami[_0x3aea('0x46')](_0x3aea('0x1ad'),ut[_0x3aea('0x11f')](_0x449662,_0x3aea('0x1ae')));_0x34f3bd=_0xb3be07[_0x3aea('0x195')];_0x2f6059=_0xb3be07[_0x3aea('0xe2')];hopperUtils[_0x3aea('0xd4')](_0x3a13c4)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x1af')));if(_0x1357db[_0x3aea('0x192')](0x5,_0x449662,_0xb3be07)&&!_0x296bc1){if(_0x3a13c4[_0x3aea('0x12f')]>=_0xb3be07[_0x3aea('0x1b0')]){_0x1357db[_0x3aea('0x133')](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1b1'));}else{_0x1357db['stateGlobal'](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1b1'));}}break;case'8':_0xb3be07['outboundCongestionCallsDay']+=0x1;_0x3a13c4[_0x3aea('0x75')]=0x8;_0x3a13c4[_0x3aea('0x76')]=_0x3aea('0x1b2');_0x3a13c4[_0x3aea('0x127')]+=0x1;_0x3a13c4[_0x3aea('0xe0')]+=0x1;_0x34f3bd=_0xb3be07['dialCongestionRetryFrequency'];_0x2f6059=_0xb3be07['callAdditionalPhoneAfterMin'];ami[_0x3aea('0x46')]('custom:agentcongestion',ut[_0x3aea('0x11f')](_0x449662,'congestion'));hopperUtils[_0x3aea('0xd4')](_0x3a13c4)[_0x3aea('0xa6')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1357db[_0x3aea('0x192')](0x8,_0x449662,_0xb3be07)&&!_0x296bc1){if(_0x3a13c4[_0x3aea('0x127')]>=_0xb3be07[_0x3aea('0x197')]){_0x1357db['createStateFinal'](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1b3'));}else{_0x1357db['stateGlobal'](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1b3'));}}break;case'11':_0xb3be07[_0x3aea('0x1b4')]+=0x1;_0x3a13c4[_0x3aea('0x75')]=0xb;_0x3a13c4[_0x3aea('0x76')]=_0x3aea('0xf4');_0x3a13c4[_0x3aea('0xf6')]+=0x1;_0x3a13c4[_0x3aea('0xe0')]+=0x1;_0x34f3bd=_0xb3be07[_0x3aea('0xf7')];_0x2f6059=_0xb3be07[_0x3aea('0xe2')];hopperUtils[_0x3aea('0xd4')](_0x3a13c4)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1357db[_0x3aea('0x192')](0xb,_0x449662,_0xb3be07)&&!_0x296bc1){if(_0x3a13c4[_0x3aea('0xf6')]>=_0xb3be07['dialAbandonedMaxRetry']){_0x1357db['createStateFinal'](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1b5'));}else{_0x1357db['stateGlobal'](_0x3a13c4,_0x4f1716,_0xe8cf78,'reason\x2011\x20abandoned');}}break;case'20':_0xb3be07[_0x3aea('0x1b6')]+=0x1;_0x3a13c4[_0x3aea('0x75')]=0x14;_0x3a13c4[_0x3aea('0x76')]=_0x3aea('0x1b7');_0x3a13c4[_0x3aea('0x12a')]+=0x1;_0x3a13c4[_0x3aea('0xe0')]+=0x1;_0x34f3bd=_0xb3be07[_0x3aea('0x19e')];_0x2f6059=_0xb3be07[_0x3aea('0xe2')];ami[_0x3aea('0x46')](_0x3aea('0x1b8'),ut['buildObj'](_0x449662,_0x3aea('0x1b9')));hopperUtils[_0x3aea('0xd4')](_0x3a13c4)[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x1ba')));if(_0x1357db[_0x3aea('0x192')](0x14,_0x449662,_0xb3be07)&&!_0x296bc1){if(_0x3a13c4['countagentrejectretry']>=_0xb3be07['dialAgentRejectMaxRetry']){_0x1357db[_0x3aea('0x133')](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1bb'));}else{_0x1357db[_0x3aea('0x132')](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x3aea('0x1bb'));}}break;default:_0xb3be07[_0x3aea('0x13b')]+=0x1;_0x3a13c4[_0x3aea('0x75')]=0xc;_0x3a13c4[_0x3aea('0x76')]=_0x11a622[_0x3aea('0xd0')];_0x34f3bd=_0xb3be07[_0x3aea('0x19e')];_0x2f6059=_0xb3be07['callAdditionalPhoneAfterMin'];hopperUtils[_0x3aea('0xd4')](_0x3a13c4)[_0x3aea('0xa6')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x1357db[_0x3aea('0x192')](_0x11a622[_0x3aea('0xd0')],_0x449662,_0xb3be07)&&!_0x296bc1){if(_0x3a13c4[_0x3aea('0x12f')]+_0x3a13c4[_0x3aea('0x127')]+_0x3a13c4['countnoanswerretry']+_0x3a13c4[_0x3aea('0x130')]+_0x3a13c4[_0x3aea('0xdf')]+_0x3a13c4[_0x3aea('0xf6')]+_0x3a13c4[_0x3aea('0x129')]+_0x3a13c4[_0x3aea('0x12a')]>=_0xb3be07[_0x3aea('0x131')]){_0x1357db[_0x3aea('0x132')](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x11a622[_0x3aea('0xd0')]);}else{_0x1357db[_0x3aea('0x133')](_0x3a13c4,_0x4f1716,_0xe8cf78,_0x11a622[_0x3aea('0xd0')]);}}}})['then'](function(){if(_0x296bc1){hopperUtils['swapAdditionalPhones'](_0x3a13c4,_0x34f3bd,_0x2f6059)[_0x3aea('0x44')](function(){return _0x4f1716(0x1);});}});});};Dialer[_0x3aea('0x19')][_0x3aea('0x132')]=function(_0x4a11c6,_0xcdeb83,_0x19738a,_0x465fd1){var _0x1442c9=new Final(_0x4a11c6);_0x1442c9['state']=0xf;_0x1442c9['statedesc']=_0x3aea('0x1bc');this['createStateFinal'](_0x1442c9,_0xcdeb83,_0x19738a,_0x465fd1);};Dialer[_0x3aea('0x19')][_0x3aea('0x133')]=function(_0x4fffc2,_0x2dee59,_0x2199ac,_0x5d7079){hopperUtils[_0x3aea('0xd6')](_0x4fffc2)[_0x3aea('0x44')](function(){return _0x2dee59(msgResponse(_0x3aea('0x19f'),_0x3aea('0x1bd'),_0x5d7079));})[_0x3aea('0xa6')](function(){return _0x2199ac(msgResponse(_0x3aea('0x1be'),_0x3aea('0x99'),_0x3aea('0x1bf')));});};Dialer['prototype']['predictive']=function(_0x80d427){var _0x14a155=_0x80d427[_0x3aea('0x1c0')]/0x64;var _0xb9299b=_0x80d427['outboundDropCallsDayTimeout']/(_0x80d427[_0x3aea('0xdb')]+_0x80d427[_0x3aea('0xcf')]);var _0x35d8b5=Math[_0x3aea('0x1c1')](_0x80d427['predictiveIntervalAvailable']*(_0x80d427[_0x3aea('0x1c2')]/0x64));var _0x3474fc=Math[_0x3aea('0x1c1')](_0x80d427[_0x3aea('0x1c3')]*(_0x80d427[_0x3aea('0x1c4')]/0x64));var _0x4002d7=_0x80d427['available']+_0x80d427[_0x3aea('0x142')];var _0x157b3a=Math[_0x3aea('0x1c5')](_0x80d427[_0x3aea('0x5e')]*_0x80d427[_0x3aea('0x64')]*_0x80d427[_0x3aea('0x1c6')]*_0x80d427[_0x3aea('0x1c7')]);if(_['isUndefined'](_0x80d427[_0x3aea('0x65')])){if(!_[_0x3aea('0x45')](_0x80d427['startPredictive'])){_0x80d427[_0x3aea('0x67')]=undefined;loggerPredictive['error'](_0x3aea('0x1c8'),_0x3aea('0x1c9'));}if(!_[_0x3aea('0x45')](_0x80d427[_0x3aea('0x68')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x80d427[_0x3aea('0x68')]);_0x80d427[_0x3aea('0x68')]=undefined;}_0x80d427[_0x3aea('0x65')]=moment()[_0x3aea('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3aea('0x4e')](_0x80d427[_0x3aea('0x4c')],_0x3aea('0x1ca'),_0x80d427[_0x3aea('0x65')]);this[_0x3aea('0xb8')](_0x80d427,0x1);}else if(ifInterval(_0x80d427[_0x3aea('0x1cb')],_0x80d427[_0x3aea('0x65')])){this[_0x3aea('0xb8')](_0x80d427,0x1);loggerPredictiveCalls[_0x3aea('0x4e')](_0x3aea('0x1cc'),_0x80d427['startProgressive'],_0x80d427['name']);_0x80d427[_0x3aea('0x5e')]=0x0;_0x80d427[_0x3aea('0xdc')]=0x0;}else if(_0x14a155<_0xb9299b&&_0x80d427[_0x3aea('0x1cd')]==='dropRate'){clearPredictiveAttributes(_0x80d427);loggerPredictive['info'](_0x3aea('0x1ce'),_0x3aea('0x1cf'),_0xb9299b,_0x3aea('0x65'),_0x80d427[_0x3aea('0x4c')]);}else if(_0x157b3a<_0x80d427[_0x3aea('0xdc')]&&_0x80d427[_0x3aea('0x1cd')]===_0x3aea('0x1d0')){clearPredictiveAttributes(_0x80d427);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x1d1'),_0x3aea('0x1d2'),_0x157b3a,_0x3aea('0x1d3'),_0x80d427[_0x3aea('0xdc')],_0x3aea('0x65'),_0x80d427[_0x3aea('0x4c')]);}else if(!ifInterval(_0x80d427[_0x3aea('0x1cb')],_0x80d427[_0x3aea('0x65')])&&_[_0x3aea('0x45')](_0x80d427[_0x3aea('0x67')])&&!_[_0x3aea('0x45')](_0x80d427[_0x3aea('0x65')])){_0x80d427[_0x3aea('0x67')]=moment()[_0x3aea('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3aea('0x4e')](_0x80d427[_0x3aea('0x4c')],'started\x20in\x20predictive\x20at',_0x80d427['startPredictive']);hopperUtils['avgHandleTime'](_0x80d427[_0x3aea('0x1cb')])[_0x3aea('0x44')](this[_0x3aea('0x1d4')](_0x80d427))[_0x3aea('0x44')](mergeDataErlangB(_0x80d427))[_0x3aea('0x44')](this[_0x3aea('0x1d5')](_0x80d427))[_0x3aea('0xa6')](loggerCatchPredictive(_0x3aea('0x1d6'),_0x80d427));}else if(!ifInterval(_0x80d427[_0x3aea('0x1cb')],_0x80d427[_0x3aea('0x67')])){_0x80d427[_0x3aea('0xdc')]=0x0;_0x80d427['startPredictive']=moment()[_0x3aea('0x4b')](_0x3aea('0xcd'));loggerPredictive[_0x3aea('0x4e')](_0x80d427[_0x3aea('0x4c')],_0x3aea('0x1d7'),_0x80d427['startPredictive']);clearInterval(_0x80d427['handlePredictive']);_0x80d427[_0x3aea('0x68')]=undefined;hopperUtils[_0x3aea('0x1d8')](_0x80d427['dialPredictiveInterval'])[_0x3aea('0x44')](this['getDataPredictive'](_0x80d427))['then'](mergeDataErlangB(_0x80d427))['then'](this[_0x3aea('0x1d5')](_0x80d427))[_0x3aea('0xa6')](loggerCatchPredictive(_0x3aea('0x1d9'),_0x80d427));}else if(_0x80d427[_0x3aea('0x1c3')]&&_0x4002d7<_0x80d427[_0x3aea('0x1c3')]-_0x3474fc){clearPredictiveAttributes(_0x80d427);loggerPredictive[_0x3aea('0x4e')](_0x80d427[_0x3aea('0x4c')],_0x3aea('0x1da'),_0x4002d7,_0x3aea('0x1db'),_0x80d427[_0x3aea('0x1c3')],'-',_0x3474fc,'=',_0x80d427[_0x3aea('0x1c3')]-_0x3474fc,')');}else if(_0x80d427[_0x3aea('0x1c3')]&&_0x4002d7>_0x80d427['predictiveIntervalAvailable']+_0x35d8b5){clearPredictiveAttributes(_0x80d427);loggerPredictive[_0x3aea('0x4e')](_0x80d427[_0x3aea('0x4c')],_0x3aea('0x1da'),_0x4002d7,_0x3aea('0x1dc'),_0x80d427[_0x3aea('0x1c3')],'+',_0x35d8b5,'=',_0x80d427[_0x3aea('0x1c3')]+_0x35d8b5,')');}};Dialer['prototype'][_0x3aea('0x1d4')]=function(_0x19a271){var _0x43bb82=this;return function(_0x1cf94c){return new Promise(function(_0x6e7a94,_0x5588a5){_[_0x3aea('0x101')](_0x19a271,_0x1cf94c[0x0]);if(checkGetDataPredictive(_0x1cf94c[0x0])){var _0x29b4a7=_0x19a271[_0x3aea('0x1c3')]=_0x19a271['talking']+_0x19a271[_0x3aea('0x140')];var _0x3cec8d=_0x19a271[_0x3aea('0x1cb')]*0x3c;var _0x1f72d2=_0x1cf94c[0x0][_0x3aea('0x58')]+_0x1cf94c[0x0][_0x3aea('0x1dd')];var _0x51ae66=(_0x1cf94c[0x0][_0x3aea('0x52')]+_0x1cf94c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1cf94c[0x0][_0x3aea('0xf2')])/_0x1cf94c[0x0][_0x3aea('0x50')];_0x19a271[_0x3aea('0x1c6')]=_0x51ae66>0x0?_0x51ae66:0x1;switch(_0x19a271['dialPredictiveOptimization']){case'dropRate':var _0x307493=_0x19a271[_0x3aea('0x1c0')]/0x64;return _0x43bb82[_0x3aea('0x1de')](_0x29b4a7,_0x3cec8d,_0x1f72d2,_0x51ae66,_0x307493)[_0x3aea('0x44')](function(_0x4a0cf1){return _0x6e7a94(_0x4a0cf1);});case _0x3aea('0x1df'):var _0x3090cb=_0x19a271['dialPredictiveOptimizationPercentage']/0x64;return _0x43bb82['busyFactor'](_0x29b4a7,_0x3cec8d,_0x1f72d2,_0x51ae66,_0x3090cb)[_0x3aea('0x44')](function(_0x4abf3e){return _0x6e7a94(_0x4abf3e);});default:return _0x5588a5(msgResponse(_0x3aea('0x1e0'),_0x3aea('0x99'),_0x3aea('0x1e1')));}}else{return _0x5588a5(msgResponse(_0x3aea('0x1e0'),_0x3aea('0x99'),_0x3aea('0x1e2')));}});};};Dialer['prototype'][_0x3aea('0x1e3')]=function(_0x435118){var _0x2979db=this;return function(_0x915ab7){return new Promise(function(_0x19b09b,_0x11a84a){_[_0x3aea('0x101')](_0x435118,_0x915ab7[0x0]);if(checkGetDataPredictive(_0x915ab7[0x0])){loggerPredictive[_0x3aea('0x4e')](JSON[_0x3aea('0x7b')](_0x915ab7[0x0]));if(_0x435118['dialPredictiveOptimization']==='dropRate'){return _0x2979db[_0x3aea('0x157')](_0x435118['id'])[_0x3aea('0x44')](function(_0x3ae1a9){var _0x1888a6=_0x435118[_0x3aea('0x1e4')]-_0x3ae1a9[0x0]['outboundQueuePauses'];var _0xa6440d=_0x435118[_0x3aea('0x1cb')]*0x3c;var _0x2c68be=_0x915ab7[0x0][_0x3aea('0x58')]+_0x915ab7[0x0][_0x3aea('0x1dd')];var _0xfde1c=(_0x915ab7[0x0][_0x3aea('0x52')]+_0x915ab7[0x0][_0x3aea('0x53')]+_0x915ab7[0x0][_0x3aea('0xf2')])/_0x915ab7[0x0][_0x3aea('0x50')];var _0x2f0423=_0x435118[_0x3aea('0x1c0')]/0x64;_0x435118[_0x3aea('0x1e5')]=_0x3ae1a9[0x0]['outboundQueuePauses']||0x0;_0x435118[_0x3aea('0x1c6')]=_0xfde1c>0x0?_0xfde1c:0x1;return _0x2979db[_0x3aea('0x1de')](_0x1888a6,_0xa6440d,_0x2c68be,_0xfde1c,_0x2f0423);})[_0x3aea('0x44')](function(_0xc81fcc){return _0x19b09b(_0xc81fcc);})[_0x3aea('0xa6')](function(_0x187120){return _0x11a84a(msgResponse('[CatchErlangB]',_0x3aea('0x99'),JSON[_0x3aea('0x7b')](_0x187120)));});}if(_0x435118[_0x3aea('0x1cd')]===_0x3aea('0x1df')){return _0x2979db['getVoiceQueueRtPauses'](_0x435118['id'])[_0x3aea('0x44')](function(_0xb26a28){var _0x5064b7=_0x435118['loggedIn']-_0xb26a28[0x0][_0x3aea('0x1e6')];var _0x26c72f=_0x435118[_0x3aea('0x1cb')]*0x3c;var _0x477e24=_0x915ab7[0x0]['predictiveIntervalAvgTalktime']+_0x915ab7[0x0]['predictiveIntervalAvgHoldtime'];var _0x123db0=(_0x915ab7[0x0]['predictiveIntervalAnsweredCalls']+_0x915ab7[0x0][_0x3aea('0x53')]+_0x915ab7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x915ab7[0x0][_0x3aea('0x50')];var _0x35f156=_0x435118[_0x3aea('0x1c0')]/0x64;_0x435118[_0x3aea('0x1e5')]=_0xb26a28[0x0][_0x3aea('0x1e6')]||0x0;_0x435118[_0x3aea('0x1c6')]=_0x123db0>0x0?_0x123db0:0x1;return _0x2979db['busyFactor'](_0x5064b7,_0x26c72f,_0x477e24,_0x123db0,_0x35f156);})[_0x3aea('0x44')](function(_0x5bc8cf){return _0x19b09b(_0x5bc8cf);})[_0x3aea('0xa6')](function(_0x172ebb){return _0x11a84a(msgResponse(_0x3aea('0x1e7'),'Failure',JSON[_0x3aea('0x7b')](_0x172ebb)));});}}else{return _0x11a84a(msgResponse(_0x3aea('0x1e0'),'Failure','check\x20failure'));}});};};Dialer[_0x3aea('0x19')][_0x3aea('0x1d5')]=function(_0x280482){var _0xc62748=this;return function(){var _0x3cb938=0x0;var _0xca79df=Math[_0x3aea('0x1c5')](_0x280482[_0x3aea('0x60')]*0x3e8);if(_0xca79df>0x0){_0xca79df=_0xca79df<0x64?0x64:_0xca79df;loggerPredictive[_0x3aea('0x4e')](_0x280482['name'],_0x3aea('0x1e8'),_0xca79df,_0x3aea('0x1e9'));_0x280482[_0x3aea('0x68')]=setInterval(function(){_0xc62748[_0x3aea('0x68')](_0x280482);loggerPredictiveCalls[_0x3aea('0x4e')](_0x3aea('0x1ea'),_0x3cb938+=0x1);},_0xca79df);}else{loggerPredictive[_0x3aea('0x4e')](_0x280482[_0x3aea('0x4c')],_0x3aea('0x1eb'));}};};Dialer[_0x3aea('0x19')][_0x3aea('0x1ec')]=function(_0x4b7c80,_0xe0164a){var _0x320915=this;return function(_0x5c595c){if(_[_0x3aea('0x4d')](_0x5c595c)){if(_[_0x3aea('0x100')](_0xe0164a[_0x3aea('0x1ed')])||!_0xe0164a[_0x3aea('0x1ee')]){if(_0x4b7c80[_0x3aea('0xb6')]==='booked'){_0x4b7c80[_0x3aea('0x79')]=_[_0x3aea('0x45')](_0x4b7c80['queueStatusComplete'])?!![]:_0x4b7c80['queueStatusComplete'];var _0x190689=uuid['v4']();_0x320915[_0x3aea('0x25')][_0x190689]=new Action(_0x4b7c80,_0xe0164a,_0x190689);loggerBooked['info'](_0x3aea('0x1ef'),_0x190689,_0x3aea('0x1f0'),JSON['stringify'](_0x4b7c80[_0x3aea('0x79')]),'Queue:\x20',_0x4b7c80[_0x3aea('0x4c')]);if(_0x4b7c80[_0x3aea('0x79')]){_0x4b7c80[_0x3aea('0x79')]=![];_0x320915[_0x3aea('0x2a')][_0x320915[_0x3aea('0x25')][_0x190689][_0x3aea('0xcb')]]=[];ami['Action']({'actionid':_0x190689,'action':_0x3aea('0x1f1'),'queue':_0x4b7c80[_0x3aea('0x4c')]})[_0x3aea('0xa6')](function(){_0x320915[_0x3aea('0xca')](_0x4b7c80);hopperUtils[_0x3aea('0xe6')]({'active':![],'ContactId':_0x320915[_0x3aea('0x25')][_0x190689][_0x3aea('0xe8')],'ListId':_0x320915[_0x3aea('0x25')][_0x190689]['ListId'],'VoiceQueueId':_0x320915['actions'][_0x190689]['VoiceQueueId']||undefined,'CampaignId':_0x320915[_0x3aea('0x25')][_0x190689][_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x1f2')));delete _0x320915[_0x3aea('0x25')][_0x190689];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON['stringify'](_0x4b7c80[_0x3aea('0x79')]),_0x3aea('0x1f3'),_0x4b7c80[_0x3aea('0x4c')]);_0x320915[_0x3aea('0xca')](_0x4b7c80);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x320915[_0x3aea('0x25')][_0x190689][_0x3aea('0xe8')],'ListId':_0x320915[_0x3aea('0x25')][_0x190689][_0x3aea('0xe9')],'VoiceQueueId':_0x320915['actions'][_0x190689][_0x3aea('0xea')]||undefined,'CampaignId':_0x320915['actions'][_0x190689][_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x1f2')));delete _0x320915[_0x3aea('0x25')][_0x190689];}}else{return _0x320915[_0x3aea('0x162')](_0x4b7c80,_0xe0164a);}}else{if(utils['getSeconds'](undefined,_0xe0164a['scheduledat'])<_0x4b7c80[_0x3aea('0x1f4')]*0x3c){if(_0xe0164a[_0x3aea('0x14d')]&&!_0xe0164a[_0x3aea('0x14d')][_0x3aea('0x1f5')]){_0x320915[_0x3aea('0x1e')][_0x3aea('0x105')](_0xe0164a['id'])[_0x3aea('0x1c')](function(){_0x320915[_0x3aea('0xca')](_0x4b7c80);});}else{hopperUtils['unlockContact']({'active':![]},_0xe0164a['id'],0x1)[_0x3aea('0x1c')](function(){_0x320915[_0x3aea('0xca')](_0x4b7c80);});}}else{_0x4b7c80['outboundReCallsDay']+=0x1;_0x320915[_0x3aea('0xca')](_0x4b7c80);if(_0x4b7c80[_0x3aea('0x1f6')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xe0164a[_0x3aea('0xe8')],'ListId':_0xe0164a[_0x3aea('0xe9')],'VoiceQueueId':_0xe0164a[_0x3aea('0xea')]||undefined,'CampaignId':_0xe0164a[_0x3aea('0xeb')]||undefined})[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x1f7')));hopperUtils[_0x3aea('0xd4')](createObjHistory(_0x4b7c80,_0xe0164a,utils[_0x3aea('0x6f')][_0x3aea('0x1f8')],0x17,_0x3aea('0x1f9')))[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x1fa')));}else{_0x320915[_0x3aea('0x15c')](createObjHistory(_0x4b7c80,_0xe0164a,utils[_0x3aea('0x6f')][_0x3aea('0x1fb')],0x16,_0x3aea('0x1fc')),'[Originate][HistoryRecallClose][historyCatch]',_0x3aea('0x1fd'));}}}}else{_0x4b7c80['outboundBlacklistCallsDay']+=0x1;_0x320915['saveInDb'](createObjHistory(_0x4b7c80,_0xe0164a,utils[_0x3aea('0x6f')][_0x3aea('0x1fe')],0xd,_0x3aea('0x1ff')),_0x3aea('0x200'),_0x3aea('0x201'));throw'inBlackList';}};};Dialer[_0x3aea('0x19')][_0x3aea('0x161')]=function(_0x3a83b1){var _0x284b31=this;var _0x1e9f20=_0x3a83b1['limitCalls']-_0x3a83b1[_0x3aea('0x87')]-_0x3a83b1[_0x3aea('0x202')];emitCampaignSummary(_0x3a83b1);if(_0x1e9f20>0x0){if(_0x1e9f20>this['maxNumberOriginate']){_0x1e9f20=this[_0x3aea('0x23')];}_0x3a83b1[_0x3aea('0x202')]+=_0x1e9f20;hopperUtils[_0x3aea('0x203')](_0x3a83b1['id'],_0x1e9f20,_0x3a83b1[_0x3aea('0x204')],_0x3a83b1)[_0x3aea('0x44')](function(_0x2d6047){_0x3a83b1[_0x3aea('0x202')]-=_0x1e9f20;_0x3a83b1['temp']=_0x3a83b1[_0x3aea('0x202')]>0x0?_0x3a83b1[_0x3aea('0x202')]:0x0;if(!utils[_0x3aea('0x205')](_0x2d6047)){_0x3a83b1[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')][_0x3aea('0x73')];logger[_0x3aea('0x4e')]('[getContactCampaign2][Empty]'+_0x3a83b1[_0x3aea('0x4c')]);}else{_0x3a83b1[_0x3aea('0x87')]+=_0x2d6047[_0x3aea('0x9f')];_0x3a83b1[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')][_0x3aea('0x206')];for(var _0x1bd7c6=0x0;_0x1bd7c6<_0x2d6047[_0x3aea('0x9f')];_0x1bd7c6+=0x1){_0x3a83b1[_0x3aea('0x207')]+=0x1;if(_[_0x3aea('0x100')](_0x2d6047[_0x1bd7c6])||_[_0x3aea('0x100')](_0x2d6047[_0x1bd7c6][_0x3aea('0x17d')])||_[_0x3aea('0x100')](_0x2d6047[_0x1bd7c6][_0x3aea('0x165')])){_0x284b31['emptyContact'](_0x3aea('0x208'),_0x3a83b1,_0x2d6047[_0x1bd7c6]);}else{hopperUtils[_0x3aea('0x209')](_[_0x3aea('0x7c')](_0x2d6047[_0x1bd7c6],[_0x3aea('0xeb'),_0x3aea('0x165')]))[_0x3aea('0x44')](_0x284b31['checkContactBlack'](_0x3a83b1,_0x2d6047[_0x1bd7c6]))[_0x3aea('0xa6')](_0x284b31[_0x3aea('0x15b')](_0x3aea('0x20a'),_0x3a83b1));}}}})[_0x3aea('0xa6')](loggerGetContactDialer('[getContactCampaign2]',_0x3a83b1,_0x1e9f20));}};Dialer['prototype'][_0x3aea('0xb8')]=function(_0x777483,_0x6544c0){var _0x3f11b6=this;var _0x43fbad=[];if(_0x6544c0<0x1||_0x777483[_0x3aea('0xb6')]===_0x3aea('0x8')){_0x6544c0=0x1;}var _0x438916=Math[_0x3aea('0x1c5')](_0x777483[_0x3aea('0x140')]*_0x6544c0)-_0x777483['originated']-_0x777483[_0x3aea('0x202')];if(_0x777483[_0x3aea('0x20b')]>0x0){var _0x319b6c=_0x777483['dialLimitQueue']-_0x777483['originated']-_0x777483['talking']-_0x777483[_0x3aea('0x202')]-_0x777483[_0x3aea('0x20c')];if(_0x438916>_0x319b6c){_0x438916=_0x319b6c;}}if(_0x438916>0x0){if(_0x777483[_0x3aea('0xb6')]===_0x3aea('0x8')){_0x438916=0x1;}if(_0x438916>this['maxNumberOriginate']){_0x438916=this[_0x3aea('0x23')];}_0x777483[_0x3aea('0x202')]+=_0x438916;for(var _0x27790b in this[_0x3aea('0x21')]){if(typeof this[_0x3aea('0x21')][_0x27790b]!==_0x3aea('0xaf')){if(this['agents'][_0x27790b][_0x3aea('0x75')]===_0x3aea('0x20d')&&this[_0x3aea('0x21')][_0x27790b][_0x3aea('0x91')]==='reachable'){_0x43fbad[_0x3aea('0xa0')](this['agents'][_0x27790b]['id']);}}}hopperUtils[_0x3aea('0x20e')](_0x777483,_0x43fbad,_0x438916)[_0x3aea('0x44')](function(_0x5a0b37){_0x777483[_0x3aea('0x202')]-=_0x438916;_0x777483[_0x3aea('0x202')]=_0x777483[_0x3aea('0x202')]>0x0?_0x777483[_0x3aea('0x202')]:0x0;if(!utils[_0x3aea('0x205')](_0x5a0b37)){hopperUtils['countReScheduled'](_0x777483)['then'](sendMessageReschedule(_0x777483))[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x20f')));}else{_0x777483['originated']+=_0x5a0b37[_0x3aea('0x9f')];_0x777483[_0x3aea('0x6e')]=_0x777483[_0x3aea('0xb6')]==='booked'?utils['CAMPAIGN_STATUS'][_0x3aea('0x143')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x327798=0x0;_0x327798<_0x5a0b37[_0x3aea('0x9f')];_0x327798+=0x1){if(_[_0x3aea('0x100')](_0x5a0b37[_0x327798])||_[_0x3aea('0x100')](_0x5a0b37[_0x327798][_0x3aea('0x17d')])||_['isNil'](_0x5a0b37[_0x327798][_0x3aea('0x165')])){_0x3f11b6['emptyContact'](_0x3aea('0x208'),_0x777483,_0x5a0b37[_0x327798]);}else{hopperUtils[_0x3aea('0x210')](_[_0x3aea('0x7c')](_0x5a0b37[_0x327798],[_0x3aea('0xea'),_0x3aea('0x165')]))[_0x3aea('0x44')](_0x3f11b6[_0x3aea('0x1ec')](_0x777483,_0x5a0b37[_0x327798]))[_0x3aea('0xa6')](_0x3f11b6[_0x3aea('0x15b')](_0x3aea('0x208'),_0x777483));}}}})[_0x3aea('0xa6')](loggerGetContactDialer(_0x3aea('0x211'),_0x777483,_0x438916));}};Dialer[_0x3aea('0x19')][_0x3aea('0x68')]=function(_0x168f56){if(_0x168f56[_0x3aea('0x20b')]>0x0){var _0x2afb9a=_0x168f56[_0x3aea('0x20b')]-_0x168f56[_0x3aea('0x87')]-_0x168f56[_0x3aea('0x142')];if(_0x2afb9a>0x0){this['tryOriginatePredictive'](_0x168f56);}else{loggerPredictiveCalls[_0x3aea('0x4e')](_0x3aea('0x212'));}}else{this[_0x3aea('0x213')](_0x168f56);}};Dialer[_0x3aea('0x19')][_0x3aea('0x213')]=function(_0x33aafa){var _0x25c6f6=this;var _0x32e76c=[];_0x33aafa[_0x3aea('0x87')]+=0x1;for(var _0x51ca93 in this[_0x3aea('0x21')]){if(typeof this[_0x3aea('0x21')][_0x51ca93]!==_0x3aea('0xaf')){if(this['agents'][_0x51ca93][_0x3aea('0x75')]==='not_inuse'&&this[_0x3aea('0x21')][_0x51ca93]['status']===_0x3aea('0x90')){_0x32e76c['push'](this[_0x3aea('0x21')][_0x51ca93]['id']);}}}return this['getContactDialer'](_0x33aafa['id'],_0x32e76c,0x1,_0x33aafa[_0x3aea('0x204')],_0x33aafa)[_0x3aea('0x44')](function(_0x37842d){if(!utils[_0x3aea('0x205')](_0x37842d)){utils[_0x3aea('0x6c')](_0x33aafa,0x1,0x0);return hopperUtils[_0x3aea('0x214')](_0x33aafa)['then'](sendMessageReschedule(_0x33aafa))[_0x3aea('0xa6')](loggerCatch(_0x3aea('0x20f')));}else{_0x33aafa[_0x3aea('0x6e')]=utils[_0x3aea('0x6f')][_0x3aea('0x206')];if(_[_0x3aea('0x100')](_0x37842d[0x0])||_[_0x3aea('0x100')](_0x37842d[0x0][_0x3aea('0x17d')])||_['isNil'](_0x37842d[0x0]['phone'])){_0x25c6f6['emptyContact']('[actionOriginate]\x20',_0x33aafa,_0x37842d[0x0]);}else{return hopperUtils[_0x3aea('0x210')](_[_0x3aea('0x7c')](_0x37842d[0x0],['VoiceQueueId',_0x3aea('0x165')]))[_0x3aea('0x44')](_0x25c6f6['checkContactBlack'](_0x33aafa,_0x37842d[0x0]))[_0x3aea('0xa6')](_0x25c6f6['loggerHandler']('[actionOriginatePredictive]\x20',_0x33aafa));}}})[_0x3aea('0xa6')](loggerGetContactDialer(_0x3aea('0x215'),_0x33aafa,0x1));};Dialer[_0x3aea('0x19')][_0x3aea('0x1de')]=function(_0xf14795,_0x2036ba,_0x1758a6,_0x28a0cb,_0x31b3ac,_0x896c67){loggerPredictive['info'](_0x3aea('0x216'));loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x217'),_0xf14795);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x218'),_0x2036ba);loggerPredictive[_0x3aea('0x4e')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1758a6);loggerPredictive[_0x3aea('0x4e')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28a0cb);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x219'),_0x31b3ac);loggerPredictive['info'](_0x3aea('0x57'));return new Promise(function(_0x58ce03,_0xa527e5){if(_0xf14795<=0x0||isNaN(_0xf14795)){return _0xa527e5(msgResponse('[abandonmentRate]','Error',_0x3aea('0x21a')+_0xf14795));}if(_0x1758a6<=0x0||isNaN(_0x1758a6)){return _0xa527e5(msgResponse(_0x3aea('0x21b'),'Error',_0x3aea('0x21c')+_0x1758a6));}if(_0x28a0cb<=0x0||isNaN(_0x28a0cb)){return _0xa527e5(msgResponse(_0x3aea('0x21b'),'Error',_0x3aea('0x21d')+_0x28a0cb));}if(_0x2036ba<=0x0||isNaN(_0x2036ba)){return _0xa527e5(msgResponse(_0x3aea('0x21b'),'Error','interval\x20=\x20'+_0x2036ba));}if(_0x31b3ac<=0x0||isNaN(_0x31b3ac)){return _0xa527e5(msgResponse(_0x3aea('0x21b'),_0x3aea('0x8c'),'Amax\x20=\x20'+_0x31b3ac));}_0x896c67=_0x896c67||0x0;var _0x344079=0x1/_0x1758a6;var _0x1576ab=0x0;var _0x11a4a5=0x0;var _0x277425=0x0;var _0x254f6b=0x0;for(var _0x44fc2e=0x0;_0x277425<_0x31b3ac;_0x44fc2e+=0x1){_0x11a4a5=_0x44fc2e/_0x2036ba;_0x1576ab=(_0x28a0cb*_0x11a4a5+_0x896c67)/_0x344079;_0x277425=utils['erlangb'](_0x1576ab,_0xf14795);_0x254f6b=_0x1576ab/_0xf14795*(0x1-utils[_0x3aea('0x21e')](_0x1576ab,_0xf14795));}return _0x58ce03({'erlangCalls':_0x44fc2e,'erlangCallToSecond':_0x2036ba/_0x44fc2e,'erlangAbandonmentRate':_0x277425,'erlangBusyFactor':_0x254f6b});});};Dialer[_0x3aea('0x19')]['busyFactor']=function(_0x2ab59c,_0x16c910,_0x54612c,_0x3fe89a,_0x41f9e4,_0x2adfe8){loggerPredictive['info'](_0x3aea('0x21f'));loggerPredictive[_0x3aea('0x4e')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ab59c);loggerPredictive['info'](_0x3aea('0x218'),_0x16c910);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x220'),_0x54612c);loggerPredictive['info'](_0x3aea('0x221'),_0x3fe89a);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x222'),_0x41f9e4);loggerPredictive[_0x3aea('0x4e')](_0x3aea('0x57'));return new Promise(function(_0x13b9ab,_0x5301dd){if(_0x2ab59c<=0x0||isNaN(_0x2ab59c)){return _0x5301dd(msgResponse(_0x3aea('0x223'),_0x3aea('0x8c'),'m\x20=\x20'+_0x2ab59c));}if(_0x54612c<=0x0||isNaN(_0x54612c)){return _0x5301dd(msgResponse(_0x3aea('0x223'),'Error',_0x3aea('0x21c')+_0x54612c));}if(_0x3fe89a<=0x0||isNaN(_0x3fe89a)){return _0x5301dd(msgResponse('[busyFactor]',_0x3aea('0x8c'),_0x3aea('0x21d')+_0x3fe89a));}if(_0x16c910<=0x0||isNaN(_0x16c910)){return _0x5301dd(msgResponse('[busyFactor]',_0x3aea('0x8c'),'interval\x20=\x20'+_0x16c910));}if(_0x41f9e4<=0x0||isNaN(_0x41f9e4)){return _0x5301dd(msgResponse(_0x3aea('0x223'),_0x3aea('0x8c'),'Umin\x20=\x20'+_0x41f9e4));}_0x2adfe8=_0x2adfe8||0x0;var _0x80c665=0x1/_0x54612c;var _0x571ebb=0x0;var _0x932404=0x0;var _0x3b764f=0x0;var _0x3ffcc1=0x0;for(var _0x231db8=0x0;_0x3ffcc1<_0x41f9e4;_0x231db8+=0x1){_0x932404=_0x231db8/_0x16c910;_0x571ebb=(_0x3fe89a*_0x932404+_0x2adfe8)/_0x80c665;_0x3b764f=utils[_0x3aea('0x21e')](_0x571ebb,_0x2ab59c);_0x3ffcc1=_0x571ebb/_0x2ab59c*(0x1-utils['erlangb'](_0x571ebb,_0x2ab59c));}return _0x13b9ab({'erlangCalls':_0x231db8,'erlangCallToSecond':_0x16c910/_0x231db8,'erlangAbandonmentRate':_0x3b764f,'erlangBusyFactor':_0x3ffcc1});});};module[_0x3aea('0x224')]=Dialer; \ No newline at end of file +var _0x0077=['dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','dialPredictiveOptimization','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','dialMethod','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','queuecallerabandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','getSeconds','startProgressive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isEmpty','Interval','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','handlePower','power','dialPowerLevel','method\x20not\x20recognized','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','silly','syncAgentConnect','uniqueid','type','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','dialQueueTimeout','state','dropreason','TIMEOUT','agiafterat','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','starttime','endtime','calleridname','calleridnum','createHistory','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','minutes','[rescheduleContact][Abandoned]','syncNewExten','actions','channel','syncQueueMember','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','amdstatus','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','emit','custom:amd','buildObj','amd','saveInDb','MACHINE','Machine','membername','AMD','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','syncQueueSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','checkDialMethod','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','dialPreviewRecallmeReminder','filter','map','Agent','user:%s','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','merge','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','actionOriginate','originate','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','isOutboundQueue','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','%s%s','toUpper','getCallerId','Trunk','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','callerid','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry'];(function(_0x167384,_0x55070c){var _0x22798d=function(_0x895077){while(--_0x895077){_0x167384['push'](_0x167384['shift']());}};_0x22798d(++_0x55070c);}(_0x0077,0x8e));var _0x7007=function(_0x433ff5,_0x3a22aa){_0x433ff5=_0x433ff5-0x0;var _0x471017=_0x0077[_0x433ff5];return _0x471017;};'use strict';var util=require(_0x7007('0x0'));var _=require(_0x7007('0x1'));var uuid=require(_0x7007('0x2'));var moment=require(_0x7007('0x3'));var rr=require('rr');var Redis=require(_0x7007('0x4'));var utils=require('./utils');var hopperUtils=require(_0x7007('0x5'));var ut=require(_0x7007('0x6'));var config=require(_0x7007('0x7'));var logger=require(_0x7007('0x8'))(_0x7007('0x9'));var loggerBooked=require(_0x7007('0x8'))(_0x7007('0xa'));var loggerPredictive=require('../../../config/logger')(_0x7007('0xb'));var loggerPredictiveCalls=require(_0x7007('0x8'))(_0x7007('0xc'));var loggerSyncQueueSummary=require(_0x7007('0x8'))('syncQueueSummary');var ami=require(_0x7007('0xd'));config['redis']=_[_0x7007('0xe')](config[_0x7007('0xf')],{'host':_0x7007('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7007('0xf')]));var cmHopper=require(_0x7007('0x11'));var voiceQueueRt=require(_0x7007('0x12'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x7007('0x13'));var Action=require(_0x7007('0x14'));var History=require(_0x7007('0x15'));var Final=require(_0x7007('0x16'));var AgentComplete=require(_0x7007('0x17'));var QueueCallerAbandon=require(_0x7007('0x18'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x7007('0x19')]||_0x7007('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7007('0x1b')][_0x7007('0x1c')]=function(_0xd38886){this[_0x7007('0x1d')]=this['tail']?this[_0x7007('0x1d')][_0x7007('0x1e')](_0xd38886):_0xd38886();};function Dialer(_0x3010f8,_0x32f8fc){this[_0x7007('0x1f')]=new Sequence();this[_0x7007('0x20')]=_0x32f8fc;this[_0x7007('0x21')]=_0x3010f8['voiceQueues'];this['campaigns']=_0x3010f8[_0x7007('0x22')];this[_0x7007('0x23')]=_0x3010f8['agents'];this[_0x7007('0x24')]=_0x3010f8[_0x7007('0x24')];this[_0x7007('0x25')]=config[_0x7007('0x25')]||0x2;this[_0x7007('0x26')]={};this['actions']={};this['contactsId']={};this[_0x7007('0x27')]={};this[_0x7007('0x28')]={};this[_0x7007('0x29')]={};this['startProgressive']={};this[_0x7007('0x2a')]={};this[_0x7007('0x2b')]={};this[_0x7007('0x2c')]={};this[_0x7007('0x2d')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x7007('0x2e'),this['syncQueueCallerAbandon'][_0x7007('0x2f')](this));ami['on']('originateresponse',this[_0x7007('0x30')]['bind'](this));ami['on'](_0x7007('0x31'),this[_0x7007('0x32')][_0x7007('0x2f')](this));ami['on'](_0x7007('0x33'),this['syncQueueSummary']['bind'](this));ami['on'](_0x7007('0x34'),this[_0x7007('0x35')][_0x7007('0x2f')](this));ami['on'](_0x7007('0x36'),this[_0x7007('0x37')][_0x7007('0x2f')](this));ami['on'](_0x7007('0x38'),this['syncNewExten'][_0x7007('0x2f')](this));ami['on'](_0x7007('0x39'),this['syncVarSet']['bind'](this));ami['on'](_0x7007('0x3a'),this['syncQueueMember'][_0x7007('0x2f')](this));ami['on'](_0x7007('0x3b'),this[_0x7007('0x3c')][_0x7007('0x2f')](this));this[_0x7007('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0x7007('0x3e')]()[_0x7007('0x3f')](function(_0x5de5a9){previewRecallmeReminderInterval=_0x5de5a9[_0x7007('0x40')];});}function isNotNull(_0x5734e5){return _0x5734e5!==null&&!_[_0x7007('0x41')](_0x5734e5);}function msgResponse(_0x1d5fac,_0x26d27e,_0x5732df){return{'action':_0x1d5fac,'response':_0x26d27e,'message':_0x5732df,'stack':_0x5732df};}function emit(_0x8c3bbc,_0x102fcf,_0x34f8c0){io['to'](_0x8c3bbc)['emit'](_0x102fcf,_0x34f8c0);}function emitOutboundVoiceQueueSummary(_0xbfc044){if(_0xbfc044['type']===_0x7007('0x42')){logger[_0x7007('0x43')](_0x7007('0x44'),util['inspect'](_0xbfc044,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0xbfc044[_0x7007('0x45')]),_0x7007('0x46'),_0xbfc044);}}function checkGetDataPredictive(_0x5d700c){if(isNotNull(_0x5d700c)&&!_['isEmpty'](_0x5d700c)){loggerPredictive[_0x7007('0x47')](_0x7007('0x48'));loggerPredictive[_0x7007('0x47')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d700c[_0x7007('0x49')]);loggerPredictive[_0x7007('0x47')](_0x7007('0x4a'),_0x5d700c['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x7007('0x4b'),_0x5d700c[_0x7007('0x4c')]);loggerPredictive['info'](_0x7007('0x4d'),_0x5d700c[_0x7007('0x4e')]);loggerPredictive[_0x7007('0x47')](_0x7007('0x4f'),_0x5d700c[_0x7007('0x50')]);loggerPredictive['info'](_0x7007('0x51'),_0x5d700c[_0x7007('0x52')]);loggerPredictive[_0x7007('0x47')](_0x7007('0x53'));if(_0x5d700c[_0x7007('0x49')]>0x0){if(!_[_0x7007('0x41')](_0x5d700c[_0x7007('0x52')])&&_0x5d700c[_0x7007('0x52')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x7007('0x41')](_0x5d700c[_0x7007('0x50')])&&_0x5d700c[_0x7007('0x50')]>0x0){return!![];}loggerPredictive['info'](_0x7007('0x54'));}else{loggerPredictive[_0x7007('0x47')](_0x7007('0x55'));}}else{loggerPredictive[_0x7007('0x47')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x225d25){return function(_0x2e6750){loggerPredictive[_0x7007('0x47')](_0x7007('0x56'));loggerPredictive[_0x7007('0x47')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e6750[_0x7007('0x57')]);loggerPredictive[_0x7007('0x47')](_0x7007('0x58'),_0x2e6750[_0x7007('0x59')]);loggerPredictive[_0x7007('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e6750[_0x7007('0x5a')]);loggerPredictive['info'](_0x7007('0x5b'),_0x2e6750['erlangBusyFactor']);loggerPredictive[_0x7007('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2e6750[_0x7007('0x5a')]);loggerPredictive[_0x7007('0x47')](_0x7007('0x53'));_['merge'](_0x225d25,_0x2e6750);};}function ifInterval(_0x5a8941,_0x40f2ab){if(_[_0x7007('0x41')](_0x40f2ab)){return![];}return utils[_0x7007('0x5c')](undefined,_0x40f2ab)<_0x5a8941*0x3c;}function clearPredictiveAttributes(_0x16f7f9){if(_0x16f7f9[_0x7007('0x5d')]){_0x16f7f9[_0x7007('0x5d')]=undefined;loggerPredictive['debug'](_0x16f7f9[_0x7007('0x45')],'startProgressive\x20value\x20cleared');}if(_0x16f7f9[_0x7007('0x29')]){_0x16f7f9[_0x7007('0x29')]=undefined;loggerPredictive[_0x7007('0x43')](_0x16f7f9[_0x7007('0x45')],_0x7007('0x5e'));}if(_0x16f7f9[_0x7007('0x5f')]){clearInterval(_0x16f7f9[_0x7007('0x5f')]);_0x16f7f9[_0x7007('0x5f')]=undefined;loggerPredictive[_0x7007('0x43')](_0x16f7f9[_0x7007('0x45')],_0x7007('0x60'));}}function loggerCatchPredictive(_0x491bde,_0x177137){return function(_0x2cae20){loggerPredictive['error'](_0x177137[_0x7007('0x45')],_0x491bde);loggerPredictive[_0x7007('0x61')](_0x2cae20[_0x7007('0x62')]);clearPredictiveAttributes(_0x177137);};}function loggerCatch(_0x3078c3){return function(_0x26bd9a){logger[_0x7007('0x61')](_0x3078c3,util[_0x7007('0x63')](_0x26bd9a,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5ea852,_0x112bd9,_0x16f909){return function(_0x5efece){utils[_0x7007('0x64')](_0x112bd9,_0x16f909,0x0);logger[_0x7007('0x61')](_0x5ea852,util[_0x7007('0x63')](_0x5efece,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x370bb8){return function(_0x4132cc){if(isNotNull(_0x4132cc)&&isNotNull(_0x4132cc[0x0])){if(_0x4132cc[0x0][_0x7007('0x65')]>0x0){_0x370bb8['message']=utils[_0x7007('0x66')][_0x7007('0x67')];logger[_0x7007('0x47')](_0x7007('0x68')+_0x370bb8[_0x7007('0x45')],_0x4132cc[0x0][_0x7007('0x65')],_0x7007('0x69'));}else{_0x370bb8[_0x7007('0x6a')]=utils[_0x7007('0x66')][_0x7007('0x6b')];logger[_0x7007('0x47')](_0x7007('0x6c')+_0x370bb8['name']);}}};}function createObjHistory(_0x5698a6,_0xdae758,_0x4e3d9e,_0x512400,_0x1611f8){_0x5698a6[_0x7007('0x6a')]=_0x4e3d9e;var _0x2f641d=new Action(_0x5698a6,_0xdae758);var _0x2fcf4c=new History(_0x2f641d);_0x2fcf4c['state']=_0x512400;_0x2fcf4c[_0x7007('0x6d')]=_0x1611f8;_0x2fcf4c['endtime']=_0x2f641d['starttime'];return _0x2fcf4c;}function unlockQueueStatus(_0x4c84b5,_0x490f89){setTimeout(function(){if(_['isUndefined'](_0x4c84b5[_0x7007('0x6e')])){loggerBooked['error'](_0x7007('0x6f'),_0x490f89);}_0x4c84b5[_0x7007('0x6e')]=!![];loggerBooked[_0x7007('0x47')](_0x7007('0x70'),_0x490f89,JSON[_0x7007('0x71')](_[_0x7007('0x72')](_0x4c84b5,[_0x7007('0x45'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x4f187a){return function(){if(!isNotNull(_0x4f187a['Interval'])){_0x4f187a[_0x7007('0x6a')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4f187a[_0x7007('0x45')]+_0x7007('0x73');}if(!isNotNull(_0x4f187a['Interval'][_0x7007('0x74')])){_0x4f187a[_0x7007('0x6a')]=utils['CAMPAIGN_STATUS'][_0x7007('0x75')];throw _0x4f187a[_0x7007('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x7007('0x76')](_0x4f187a[_0x7007('0x77')]['Intervals']))){_0x4f187a['message']=utils[_0x7007('0x66')][_0x7007('0x75')];throw _0x4f187a['name']+_0x7007('0x73');}};}function checkIsIVRCampaignActive(_0x3f22e4){return function(){if(!utils[_0x7007('0x78')](_0x3f22e4)){_0x3f22e4[_0x7007('0x6a')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x3f22e4['name']+_0x7007('0x79');}};}function emitCampaignSummary(_0x5792af){if(utils[_0x7007('0x7a')](_0x5792af)){emit(util[_0x7007('0x7b')](_0x7007('0x7c'),_0x5792af['name']),_0x7007('0x7d'),_0x5792af);}}function loggerCatchQueueSummary(_0xfb065a,_0x395c73){return function(_0x4ca3f4){clearPredictiveAttributes(_0x395c73);emitCampaignSummary(_0x395c73);loggerSyncQueueSummary[_0x7007('0x43')](_0xfb065a,util[_0x7007('0x63')](_0x4ca3f4,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4063a6){if(_0x4063a6[_0x7007('0x7e')]){if(_0x4063a6[_0x7007('0x7f')]===0x0){_0x4063a6[_0x7007('0x7e')]=![];_0x4063a6[_0x7007('0x6a')]=utils['CAMPAIGN_STATUS'][_0x7007('0x80')];loggerSyncQueueSummary[_0x7007('0x43')](_0x7007('0x81'),_0x4063a6['name'],_0x7007('0x82'));}else{_0x4063a6[_0x7007('0x6a')]=utils[_0x7007('0x66')]['DISACTIVED'];loggerSyncQueueSummary[_0x7007('0x43')](_0x7007('0x81'),_0x4063a6['name'],_0x7007('0x83'));}emitCampaignSummary(_0x4063a6);}}function myreject(_0x3a3514){return function(_0x44deac){return _0x3a3514(msgResponse('[ifTime][Action]',_0x7007('0x84'),JSON[_0x7007('0x71')](_0x44deac)));};}Dialer[_0x7007('0x1b')][_0x7007('0x85')]=function(_0x1c220f){return!_[_0x7007('0x41')](_0x1c220f)&&_0x1c220f&&!_[_0x7007('0x41')](_0x1c220f['name'])&&!_[_0x7007('0x41')](_0x1c220f['active'])&&_0x1c220f[_0x7007('0x86')]&&(this[_0x7007('0x24')][util['format'](_0x7007('0x87'),_0x1c220f[_0x7007('0x45')])][_0x7007('0x88')]===_0x7007('0x89')||this[_0x7007('0x24')][util[_0x7007('0x7b')](_0x7007('0x87'),_0x1c220f['name'])]['status']===_0x7007('0x8a'));};Dialer[_0x7007('0x1b')][_0x7007('0x8b')]=function(_0x12ede0){var _0xa7ecac=this;return function(){if(!_0xa7ecac[_0x7007('0x85')](_0x12ede0['Trunk'])){if(!_0xa7ecac[_0x7007('0x85')](_0x12ede0[_0x7007('0x8c')])){_0x12ede0[_0x7007('0x6a')]=utils[_0x7007('0x66')][_0x7007('0x8d')];throw _0x12ede0[_0x7007('0x45')]+_0x7007('0x8e');}}};};Dialer[_0x7007('0x1b')][_0x7007('0x8f')]=function(_0x3e57a5,_0x5cd206,_0x16a543,_0x3faa00){var _0x1074d0=this;return function(){var _0x4e7bc9=!![];return _0x1074d0['ifTimeIvr'](_0x3e57a5,_0x5cd206,_0x16a543,_0x3faa00,_0x4e7bc9);};};Dialer[_0x7007('0x1b')][_0x7007('0x90')]=function(_0x241d05,_0x1fcb53,_0x3391e2,_0x3fb9a2){var _0x5e90cb=this;return function(){var _0x172071=![];return _0x5e90cb['ifTimeIvr'](_0x241d05[_0x7007('0x74')],_0x1fcb53,_0x3391e2,_0x3fb9a2,_0x172071);};};Dialer[_0x7007('0x1b')]['ifTimeIvr']=function(_0x1fed6d,_0x2c7466,_0x214a14,_0x32e363,_0x3ce5b3){var _0x5cbba9=[];return new Promise(function(_0x547cde,_0x2d5996){if(!isNotNull(_0x1fed6d)){_0x32e363[_0x7007('0x6a')]=utils[_0x7007('0x66')][_0x7007('0x75')];return _0x2d5996(msgResponse(_0x7007('0x91'),_0x7007('0x92'),_0x214a14+_0x7007('0x93')));}if(_[_0x7007('0x76')](_0x1fed6d)){_0x32e363['message']=utils[_0x7007('0x66')][_0x7007('0x94')];return _0x2d5996(msgResponse(_0x7007('0x91'),'Failure',_0x214a14+_0x7007('0x95')));}if(_0x2c7466&&_['isUndefined'](config[_0x7007('0x96')][_0x2c7466])){_0x32e363[_0x7007('0x6a')]=utils[_0x7007('0x66')][_0x7007('0x97')];return _0x2d5996(msgResponse('ifTime',_0x7007('0x92'),_0x214a14+'\x20Timezone\x20unknow\x20'+_0x2c7466));}if(_['isArray'](_0x1fed6d)){for(var _0x1c9815=0x0;_0x1c9815<_0x1fed6d['length'];_0x1c9815+=0x1){_0x5cbba9[_0x7007('0x98')](ami[_0x7007('0x99')]({'action':_0x7007('0x9a'),'command':util[_0x7007('0x7b')](_0x7007('0x9b'),_0x1fed6d[_0x1c9815][_0x7007('0x9c')],!_[_0x7007('0x41')](config[_0x7007('0x96')][_0x2c7466])?_0x2c7466:'')})[_0x7007('0x3f')](function(_0x258143){return _0x258143[_0x7007('0x9d')][_0x7007('0x9e')](_0x7007('0x9f'))>=0x0;})[_0x7007('0xa0')](myreject(_0x2d5996)));}}else{_0x5cbba9[_0x7007('0x98')](ami[_0x7007('0x99')]({'action':_0x7007('0x9a'),'command':util['format']('iftime\x20%s,%s',_0x1fed6d,!_[_0x7007('0x41')](config[_0x7007('0x96')][_0x2c7466])?_0x2c7466:'')})[_0x7007('0x3f')](function(_0x75de21){return _0x75de21[_0x7007('0x9d')][_0x7007('0x9e')](_0x7007('0x9f'))>=0x0;})[_0x7007('0xa0')](myreject(_0x2d5996)));}Promise[_0x7007('0xa1')](_0x5cbba9)[_0x7007('0x3f')](function(_0x1549a2){var _0x571d74=_['some'](_0x1549a2);if(_0x571d74){return _0x547cde(_0x571d74);}else{_0x32e363[_0x7007('0x6a')]=_0x3ce5b3?utils['CAMPAIGN_STATUS'][_0x7007('0xa2')]:utils['CAMPAIGN_STATUS'][_0x7007('0xa3')];return _0x2d5996(msgResponse(_0x7007('0xa4'),_0x7007('0x92'),'Global:\x20'+_0x3ce5b3+'\x20'+_0x214a14+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x1fed6d,{'showHidden':![],'depth':null})+_0x7007('0xa5')+_0x2c7466));}})[_0x7007('0xa0')](function(_0x188080){return _0x2d5996(msgResponse(_0x7007('0x91'),_0x7007('0x92'),JSON[_0x7007('0x71')](_0x188080)));});});};Dialer['prototype'][_0x7007('0x3d')]=function(){var _0x514ac3=this;return cmHopper[_0x7007('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0x7007('0x3f')](function(){setInterval(function(){_0x514ac3['syncCampaigns']();},0x3e8);});};Dialer['prototype'][_0x7007('0xa7')]=function(){var _0x41bb39=this;var _0x341c6d;for(var _0x3a2076 in this['campaigns']){if(typeof this['campaigns'][_0x3a2076]!==_0x7007('0xa8')){_0x341c6d=this['campaigns'][_0x3a2076];if(utils[_0x7007('0x7a')](_0x341c6d)&&utils[_0x7007('0x78')](_0x341c6d)){_0x341c6d[_0x7007('0x7e')]=!![];Promise[_0x7007('0xa9')]()[_0x7007('0x3f')](checkIsIVRCampaignActive(_0x341c6d))[_0x7007('0x3f')](checkInterval(_0x341c6d))['then'](_0x41bb39[_0x7007('0x8b')](_0x341c6d))['then'](_0x41bb39['checkIfTime'](_0x341c6d[_0x7007('0xaa')],_0x341c6d[_0x7007('0xab')],_0x341c6d[_0x7007('0x45')],_0x341c6d))[_0x7007('0x3f')](_0x41bb39[_0x7007('0x90')](_0x341c6d[_0x7007('0x77')],_0x341c6d[_0x7007('0xab')],_0x341c6d[_0x7007('0x45')],_0x341c6d))['then'](_0x41bb39[_0x7007('0xac')](_0x341c6d))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x341c6d));}else{notSendMessagesCampaign(_0x341c6d);}}}};Dialer[_0x7007('0x1b')]['checkDialMethod']=function(_0x2dd7cc){if(_0x2dd7cc['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x2dd7cc);}switch(_0x2dd7cc['dialMethod']){case'progressive':this[_0x7007('0xad')](_0x2dd7cc,0x1);break;case _0x7007('0xae'):this[_0x7007('0xad')](_0x2dd7cc,_0x2dd7cc[_0x7007('0xaf')]);break;case'predictive':this[_0x7007('0xb')](_0x2dd7cc);break;case'booked':this[_0x7007('0xad')](_0x2dd7cc,0x1);break;default:logger[_0x7007('0x61')]('Queue',_0x2dd7cc[_0x7007('0x45')],_0x7007('0xb0'));}};Dialer['prototype'][_0x7007('0x91')]=function(_0x5e02e3,_0x4e4688){var _0x1f69a4=_0x5e02e3[_0x7007('0xab')];var _0x54ecf8=_0x4e4688?_0x5e02e3[_0x7007('0xaa')]:_0x5e02e3[_0x7007('0x77')]['Intervals'];logger['silly']('Dialer::ifTime()',_0x54ecf8,_0x1f69a4,_0x5e02e3[_0x7007('0x45')],util['format'](_0x7007('0xb1'),_0x5e02e3['name'],_0x5e02e3['id']));var _0x2c3d6e=null;return Interval[_0x7007('0xb2')](_0x54ecf8,_0x1f69a4)[_0x7007('0x3f')](function(_0x1fc41e){if(_0x1fc41e===!![]){return _0x1fc41e;}else{_0x5e02e3['message']=_0x4e4688?utils[_0x7007('0x66')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x7007('0x66')][_0x7007('0xa3')];_0x2c3d6e=msgResponse(_0x7007('0xa4'),_0x7007('0x92'),_0x7007('0xb3')+_0x4e4688+'\x20'+_0x5e02e3['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7007('0x63')](_0x54ecf8,{'showHidden':![],'depth':null})+_0x7007('0xa5')+_0x1f69a4);}if(_0x2c3d6e!==null){logger[_0x7007('0xb4')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x2c3d6e);_0x2c3d6e['isGlobal']=_0x4e4688;throw _0x2c3d6e;}})[_0x7007('0xa0')](function(_0x4c6408){logger[_0x7007('0x61')]('AMI\x20IfTime',_0x4c6408);throw msgResponse('[ifTime][Action]',_0x7007('0x84'),util[_0x7007('0x63')](_0x4c6408,{'showHidden':![],'depth':null}));});};Dialer[_0x7007('0x1b')][_0x7007('0xb5')]=function(_0x6a0ade){if(this[_0x7007('0x21')][_0x6a0ade['queue']]){if(this[_0x7007('0x27')][_0x6a0ade[_0x7007('0xb6')]]&&this[_0x7007('0x27')][_0x6a0ade[_0x7007('0xb6')]][_0x7007('0xb7')]!==_0x7007('0xb8')){this[_0x7007('0xb9')](this['voiceQueues'][_0x6a0ade[_0x7007('0xba')]]);this[_0x7007('0x27')][_0x6a0ade[_0x7007('0xb6')]][_0x7007('0xbb')]=moment()[_0x7007('0x7b')](_0x7007('0xbc'));}}};Dialer[_0x7007('0x1b')][_0x7007('0x32')]=function(_0x68bd93){var _0x19a2c2=this[_0x7007('0x27')][_0x68bd93[_0x7007('0xb6')]];if(this[_0x7007('0x21')][_0x68bd93['queue']]){if(_0x19a2c2&&_0x19a2c2[_0x7007('0xb7')]!=='ivr'){delete this[_0x7007('0x27')][_0x68bd93['uniqueid']];this[_0x7007('0x21')][_0x68bd93[_0x7007('0xba')]][_0x7007('0xbd')]+=0x1;var _0x5c38c4=new AgentComplete(_0x19a2c2,_0x68bd93);if(_0x68bd93[_0x7007('0xbe')]===_0x7007('0xbf')){_0x5c38c4['agiafterat']=this[_0x7007('0x21')][_0x68bd93[_0x7007('0xba')]]['dialQueueProject2']&&this[_0x7007('0x21')][_0x68bd93[_0x7007('0xba')]][_0x7007('0xc0')]?moment()['format'](_0x7007('0xbc')):undefined;}hopperUtils['createHistory'](_0x5c38c4)[_0x7007('0xa0')](loggerCatch(_0x7007('0xc1')));hopperUtils[_0x7007('0xc2')](_0x5c38c4)[_0x7007('0xa0')](loggerCatch(_0x7007('0xc3')));}}};Dialer['prototype'][_0x7007('0xc4')]=function(_0x24fc89){var _0xf6456d=this['uniqueId'][_0x24fc89[_0x7007('0xb6')]];var _0x443363=this;var _0x30f0df=![];var _0x17a9e8;var _0x458ac4;if(this['voiceQueues'][_0x24fc89[_0x7007('0xba')]]){if(_0xf6456d&&_0xf6456d[_0x7007('0xb7')]!==_0x7007('0xb8')){delete this[_0x7007('0x27')][_0x24fc89[_0x7007('0xb6')]];this[_0x7007('0xb9')](this[_0x7007('0x21')][_0x24fc89['queue']]);_0xf6456d[_0x7007('0xc5')]=moment()[_0x7007('0x7b')](_0x7007('0xbc'));var _0x538b65=new QueueCallerAbandon(_0xf6456d,_0x24fc89);if(utils['getSeconds'](_0xf6456d['droptime'],_0xf6456d['responsetime'])>=_0xf6456d[_0x7007('0xc6')]){this[_0x7007('0x21')][_0x24fc89[_0x7007('0xba')]][_0x7007('0x4c')]+=0x1;this['voiceQueues'][_0x24fc89['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x24fc89['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x538b65[_0x7007('0xc7')]=0xa;_0x538b65[_0x7007('0x6d')]='Drop';_0x538b65[_0x7007('0xc8')]=_0x7007('0xc9');_0x538b65[_0x7007('0xca')]=this[_0x7007('0x21')][_0x24fc89[_0x7007('0xba')]][_0x7007('0xcb')]?moment()[_0x7007('0x7b')](_0x7007('0xbc')):undefined;_0x538b65[_0x7007('0xcc')]+=0x1;_0x538b65[_0x7007('0xcd')]+=0x1;_0x17a9e8=this['voiceQueues'][_0x24fc89[_0x7007('0xba')]][_0x7007('0xce')];_0x458ac4=this[_0x7007('0x21')][_0x24fc89['queue']][_0x7007('0xcf')];hopperUtils[_0x7007('0xd0')](_0x538b65,_0x538b65[_0x7007('0xc7')],_0xf6456d[_0x7007('0xd1')])['then'](function(_0xd8e34e){_0x30f0df=_0xd8e34e[_0x7007('0xd2')]==0x1;if(_0x538b65['countdropretry']>=_0x443363[_0x7007('0x21')][_0x24fc89['queue']][_0x7007('0xd3')]){_0x443363[_0x7007('0xd4')](_0x538b65,_0xd8e34e[_0x7007('0xd2')]);}else{hopperUtils[_0x7007('0xd5')]({'active':![],'countdropretry':_0x538b65[_0x7007('0xcc')],'scheduledat':moment()['add'](_0x443363[_0x7007('0x21')][_0x24fc89['queue']]['dialDropRetryFrequency'],'minutes')[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0xf6456d[_0x7007('0xd6')],'ListId':_0xf6456d[_0x7007('0xd7')],'VoiceQueueId':_0xf6456d[_0x7007('0xd8')]||undefined,'CampaignId':_0xf6456d[_0x7007('0xd9')]||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0xda')));var _0x324ebb=new History(_0x538b65);_0x324ebb[_0x7007('0xc7')]=0xa;_0x324ebb[_0x7007('0x6d')]=_0x7007('0xdb');_0x324ebb[_0x7007('0xdc')]=moment()[_0x7007('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x324ebb[_0x7007('0xdd')]=_0x324ebb[_0x7007('0xdc')];_0x324ebb[_0x7007('0xde')]=_0x538b65[_0x7007('0xde')];_0x324ebb[_0x7007('0xdf')]=_0x538b65[_0x7007('0xdf')];hopperUtils[_0x7007('0xe0')](_0x324ebb)[_0x7007('0xa0')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x7007('0x3f')](function(){if(_0x30f0df)hopperUtils[_0x7007('0xe1')](_0x538b65,_0x17a9e8,_0x458ac4)['then'](function(){return 0x1;});});}else{this[_0x7007('0x21')][_0x24fc89[_0x7007('0xba')]][_0x7007('0x4e')]+=0x1;this[_0x7007('0x21')][_0x24fc89['queue']][_0x7007('0xe2')]+=0x1;_0x538b65[_0x7007('0xc7')]=0xb;_0x538b65[_0x7007('0x6d')]=_0x7007('0xe3');_0x538b65[_0x7007('0xc8')]='CALLEREXIT';_0x538b65[_0x7007('0xe4')]+=0x1;_0x538b65[_0x7007('0xcd')]+=0x1;_0x17a9e8=this['voiceQueues'][_0x24fc89[_0x7007('0xba')]][_0x7007('0xe5')];_0x458ac4=this['voiceQueues'][_0x24fc89[_0x7007('0xba')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x7007('0xd0')](_0x538b65,_0x538b65[_0x7007('0xc7')],_0xf6456d[_0x7007('0xd1')])[_0x7007('0x3f')](function(_0x22da41){if(_0x538b65['countabandonedretry']>=_0x443363[_0x7007('0x21')][_0x24fc89[_0x7007('0xba')]][_0x7007('0xe6')]){_0x443363[_0x7007('0xd4')](_0x538b65,_0x22da41['additional']);}else{hopperUtils[_0x7007('0xd5')]({'active':![],'countabandonedretry':_0x538b65[_0x7007('0xe4')],'scheduledat':moment()[_0x7007('0xe7')](_0x443363[_0x7007('0x21')][_0x24fc89[_0x7007('0xba')]][_0x7007('0xe5')],_0x7007('0xe8'))['format'](_0x7007('0xbc')),'ContactId':_0xf6456d['ContactId'],'ListId':_0xf6456d[_0x7007('0xd7')],'VoiceQueueId':_0xf6456d[_0x7007('0xd8')]||undefined,'CampaignId':_0xf6456d[_0x7007('0xd9')]||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0xe9')));var _0x4366ba=new History(_0x538b65);_0x4366ba[_0x7007('0xc7')]=0xb;_0x4366ba[_0x7007('0x6d')]=_0x7007('0xe3');_0x4366ba[_0x7007('0xdc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4366ba[_0x7007('0xdd')]=_0x4366ba['starttime'];_0x4366ba['calleridname']=_0x538b65[_0x7007('0xde')];_0x4366ba['calleridnum']=_0x538b65[_0x7007('0xdf')];hopperUtils[_0x7007('0xe0')](_0x4366ba)[_0x7007('0xa0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x7007('0x3f')](function(){if(_0x30f0df)hopperUtils[_0x7007('0xe1')](_0x538b65,_0x17a9e8,_0x458ac4)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x7007('0xea')]=function(_0x23a3f6){if(this[_0x7007('0xeb')][_0x23a3f6[_0x7007('0xb6')]]){this[_0x7007('0xeb')][_0x23a3f6[_0x7007('0xb6')]][_0x7007('0xec')]=_0x23a3f6[_0x7007('0xec')];}if(this['uniqueId'][_0x23a3f6[_0x7007('0xb6')]]){this[_0x7007('0x27')][_0x23a3f6['uniqueid']][_0x7007('0xec')]=_0x23a3f6[_0x7007('0xec')];}};Dialer[_0x7007('0x1b')][_0x7007('0xed')]=function(_0x28a0fc){if(!this[_0x7007('0xeb')][_0x28a0fc[_0x7007('0xee')]]){return;}var _0x167a4f=this[_0x7007('0x21')][this[_0x7007('0xeb')][_0x28a0fc[_0x7007('0xee')]][_0x7007('0xba')]][_0x7007('0xef')]||'rrmemory';if(_0x167a4f===_0x7007('0xf0')){if(this[_0x7007('0xeb')][_0x28a0fc['actionid']]&&_[_0x7007('0xf1')](this[_0x7007('0xeb')][_0x28a0fc['actionid']][_0x7007('0xf2')])&&_0x28a0fc['status']==='1'&&_0x28a0fc[_0x7007('0xf3')]==='0'){if(this[_0x7007('0x23')][_0x28a0fc[_0x7007('0xf4')]]){if(!this[_0x7007('0x23')][_0x28a0fc[_0x7007('0xf4')]][_0x7007('0xf2')]){this[_0x7007('0x23')][_0x28a0fc['stateinterface']][_0x7007('0xf2')]=!![];this[_0x7007('0xeb')][_0x28a0fc['actionid']][_0x7007('0xf2')]=!![];this[_0x7007('0xeb')][_0x28a0fc[_0x7007('0xee')]][_0x7007('0xf4')]=_0x28a0fc['stateinterface'];}}}}else if(_0x167a4f===_0x7007('0xf5')){if(this['actions'][_0x28a0fc[_0x7007('0xee')]]){if(this[_0x7007('0x23')][_0x28a0fc[_0x7007('0xf4')]]){this['actions'][_0x28a0fc[_0x7007('0xee')]]['stateinterface']=_0x28a0fc[_0x7007('0xf4')];if(_[_0x7007('0xf1')](this[_0x7007('0x2b')][this[_0x7007('0xeb')][_0x28a0fc[_0x7007('0xee')]][_0x7007('0xba')]])){this[_0x7007('0x2b')][this['actions'][_0x28a0fc[_0x7007('0xee')]][_0x7007('0xba')]]=[];}this['queueBooked'][this[_0x7007('0xeb')][_0x28a0fc[_0x7007('0xee')]][_0x7007('0xba')]][_0x7007('0x98')](_['merge'](_[_0x7007('0x72')](this['actions'][_0x28a0fc[_0x7007('0xee')]],[_0x7007('0xf6'),_0x7007('0xf4')]),{'status':_0x28a0fc[_0x7007('0x88')],'paused':_0x28a0fc[_0x7007('0xf3')]}));}}}};Dialer['prototype'][_0x7007('0x3c')]=function(_0x5ebc1d){if(!this[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]]){return;}var _0x274276=this;var _0x3428a4=this[_0x7007('0x21')][this[_0x7007('0xeb')][_0x5ebc1d['actionid']][_0x7007('0xba')]];var _0xbaeba=_0x3428a4[_0x7007('0xef')]||_0x7007('0xf5');if(_0xbaeba===_0x7007('0xf0')){if(this[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]]&&this[_0x7007('0xeb')][_0x5ebc1d['actionid']]['stateinterface']){this[_0x7007('0x20')][_0x7007('0xf7')](this['actions'][_0x5ebc1d[_0x7007('0xee')]][_0x7007('0xf6')],this['actions'][_0x5ebc1d['actionid']][_0x7007('0xf4')])[_0x7007('0xa0')](function(_0x19fef3){logger['error'](_0x7007('0xf8'),util[_0x7007('0x63')](_0x19fef3,{'showHidden':![],'depth':null}));})[_0x7007('0x1e')](function(){_0x274276[_0x7007('0xb9')](_0x274276[_0x7007('0x21')][_0x274276['actions'][_0x5ebc1d[_0x7007('0xee')]]['queue']]);_0x274276[_0x7007('0x23')][_0x274276[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]][_0x7007('0xf4')]][_0x7007('0xf2')]=![];delete _0x274276['actions'][_0x5ebc1d[_0x7007('0xee')]];unlockQueueStatus(_0x3428a4);});}else{this[_0x7007('0xb9')](this['voiceQueues'][this['actions'][_0x5ebc1d[_0x7007('0xee')]]['queue']]);hopperUtils[_0x7007('0xd5')]({'active':![],'ContactId':this[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]]['ContactId'],'ListId':this[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]]['ListId'],'VoiceQueueId':this[_0x7007('0xeb')][_0x5ebc1d['actionid']][_0x7007('0xd8')]||undefined,'CampaignId':this[_0x7007('0xeb')][_0x5ebc1d['actionid']]['CampaignId']||undefined})['catch'](loggerCatch(_0x7007('0xf9')));delete this['actions'][_0x5ebc1d[_0x7007('0xee')]];unlockQueueStatus(_0x3428a4);}}else if(_0xbaeba==='rrmemory'){var _0x2fb4c4;if(this[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]]&&!_[_0x7007('0x76')](this[_0x7007('0x2b')][this[_0x7007('0xeb')][_0x5ebc1d['actionid']]['queue']])){if(this[_0x7007('0x2c')][_0x274276[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]][_0x7007('0xba')]]){this[_0x7007('0x2c')][_0x274276[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]]['queue']]=this[_0x7007('0x2c')][this[_0x7007('0xeb')][_0x5ebc1d['actionid']]['queue']]?this[_0x7007('0x2c')][this[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]][_0x7007('0xba')]]:this[_0x7007('0x2b')][this[_0x7007('0xeb')][_0x5ebc1d[_0x7007('0xee')]]['queue']]?this[_0x7007('0x2b')][this[_0x7007('0xeb')][_0x5ebc1d['actionid']]['queue']][_0x7007('0xfa')]||0x0:0x0;}this[_0x7007('0x2b')][this[_0x7007('0xeb')][_0x5ebc1d['actionid']][_0x7007('0xba')]]['_rr']=this[_0x7007('0x2c')][this['actions'][_0x5ebc1d['actionid']][_0x7007('0xba')]];for(var _0x5a414c=0x0;_0x5a414c=_0x5c6ee4[_0x7007('0x11d')]){_0x5f4593[_0x7007('0x11e')](_0x4d9b41,_0x3fdd93,_0x2985ea,_0x7007('0x11f'));}else{if(_0x4d9b41['countmachineretry']>=_0x5c6ee4[_0x7007('0x120')]){_0x5f4593[_0x7007('0x121')](_0x4d9b41,_0x3fdd93,_0x2985ea,_0x7007('0x122'));}else{hopperUtils[_0x7007('0xd5')]({'active':![],'countmachineretry':_0x4d9b41[_0x7007('0x11c')],'scheduledat':moment()[_0x7007('0xe7')](_0x5c6ee4[_0x7007('0x123')],_0x7007('0xe8'))[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x4d9b41['ContactId'],'ListId':_0x4d9b41[_0x7007('0xd7')],'VoiceQueueId':_0x4d9b41['VoiceQueueId']||undefined,'CampaignId':_0x4d9b41[_0x7007('0xd9')]||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0x124')));_0x3fdd93({'reschedule':0x1});}}});}if(_0x34cb0a[_0x7007('0xb7')]===_0x7007('0xb8')&&this[_0x7007('0x22')][_0x34cb0a[_0x7007('0xba')]][_0x7007('0x10b')]&&_0x405780[_0x7007('0x10c')]==='HANGUP'){delete this[_0x7007('0x27')][_0x405780[_0x7007('0xb6')]];this[_0x7007('0xb9')](this['campaigns'][_0x34cb0a[_0x7007('0xba')]]);_0x184007=new Hangup(_0x34cb0a,_0x405780);_0x184007['state']=0x12;_0x184007['statedesc']=_0x7007('0x10e');_0x184007['membername']='AMD';ami['emit'](_0x7007('0x110'),ut[_0x7007('0x111')](_0x184007,_0x7007('0x112')));this[_0x7007('0x113')](_0x184007,_0x7007('0x125'),'[syncHangupInAMDIvr]');}if(_0x34cb0a[_0x7007('0xb7')]==='ivr'&&this[_0x7007('0x22')][_0x34cb0a[_0x7007('0xba')]][_0x7007('0x10b')]&&_0x405780[_0x7007('0x10c')]===_0x7007('0x114')){return new Promise(function(_0x15da49,_0x31807a){delete _0x5f4593[_0x7007('0x27')][_0x405780[_0x7007('0xb6')]];_0x5f4593['updateOriginated'](_0x5f4593[_0x7007('0x22')][_0x34cb0a[_0x7007('0xba')]]);_0x5f4593[_0x7007('0x22')][_0x34cb0a[_0x7007('0xba')]][_0x7007('0xbd')]+=0x1;_0x5f4593[_0x7007('0x22')][_0x34cb0a['queue']][_0x7007('0x10d')]+=0x1;var _0x527f38=_0x5f4593[_0x7007('0x22')][_0x34cb0a['queue']];var _0x40d65a=new Hangup(_0x34cb0a,_0x405780);_0x40d65a[_0x7007('0xc7')]=0x13;_0x40d65a[_0x7007('0x6d')]=_0x7007('0x115');_0x40d65a['membername']=_0x7007('0x117');_0x40d65a[_0x7007('0x11c')]+=0x1;_0x40d65a[_0x7007('0xcd')]+=0x1;_0x40d65a[_0x7007('0x112')]=!![];ami[_0x7007('0x10f')](_0x7007('0x110'),ut[_0x7007('0x111')](_0x40d65a,_0x7007('0x112')));hopperUtils[_0x7007('0xe0')](_0x40d65a)[_0x7007('0xa0')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x40d65a[_0x7007('0x119')]+_0x40d65a['countcongestionretry']+_0x40d65a[_0x7007('0x126')]+_0x40d65a[_0x7007('0x11b')]+_0x40d65a[_0x7007('0xcc')]+_0x40d65a['countabandonedretry']+_0x40d65a[_0x7007('0x11c')]+_0x40d65a['countagentrejectretry']>=_0x527f38[_0x7007('0x11d')]){_0x5f4593['stateGlobal'](_0x40d65a,_0x15da49,_0x31807a,_0x7007('0x11f'));}else{if(_0x40d65a[_0x7007('0x11c')]>=_0x527f38[_0x7007('0x120')]){_0x5f4593[_0x7007('0x121')](_0x40d65a,_0x15da49,_0x31807a,'reason\x2019\x20machine....');}else{hopperUtils[_0x7007('0xd5')]({'active':![],'countmachineretry':_0x40d65a['countmachineretry'],'scheduledat':moment()[_0x7007('0xe7')](_0x527f38['dialMachineRetryFrequency'],'minutes')[_0x7007('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x40d65a[_0x7007('0xd6')],'ListId':_0x40d65a[_0x7007('0xd7')],'VoiceQueueId':_0x40d65a['VoiceQueueId']||undefined,'CampaignId':_0x40d65a[_0x7007('0xd9')]||undefined})['catch'](loggerCatch(_0x7007('0x124')));_0x15da49({'reschedule':0x1});}}});}}};Dialer[_0x7007('0x1b')]['syncHangup']=function(_0x1f6645){var _0x33ddfe=this['uniqueId'][_0x1f6645[_0x7007('0xb6')]];var _0x2c7d66;if(_0x33ddfe&&_0x33ddfe[_0x7007('0xb7')]==='ivr'){delete this[_0x7007('0x27')][_0x1f6645[_0x7007('0xb6')]];this[_0x7007('0xb9')](this[_0x7007('0x22')][_0x33ddfe[_0x7007('0xba')]]);this[_0x7007('0x22')][_0x33ddfe[_0x7007('0xba')]]['ivrAnswerCallsDay']+=0x1;_0x2c7d66=new Hangup(_0x33ddfe,_0x1f6645);hopperUtils[_0x7007('0xe0')](_0x2c7d66)[_0x7007('0xa0')](loggerCatch(_0x7007('0x127')));hopperUtils[_0x7007('0xc2')](_0x2c7d66)[_0x7007('0xa0')](loggerCatch('[syncHangupIvr]'));}if(_0x33ddfe&&_0x33ddfe[_0x7007('0xb7')]!==_0x7007('0xb8')&&isNotNull(this['voiceQueues'][_0x33ddfe[_0x7007('0xba')]][_0x7007('0x128')])){delete this[_0x7007('0x27')][_0x1f6645[_0x7007('0xb6')]];this[_0x7007('0xb9')](this[_0x7007('0x21')][_0x33ddfe[_0x7007('0xba')]]);this['voiceQueues'][_0x33ddfe[_0x7007('0xba')]][_0x7007('0xbd')]+=0x1;this[_0x7007('0x21')][_0x33ddfe[_0x7007('0xba')]][_0x7007('0x10d')]+=0x1;_0x2c7d66=new Hangup(_0x33ddfe,_0x1f6645);_0x2c7d66[_0x7007('0xc7')]=0x10;_0x2c7d66[_0x7007('0x6d')]=_0x7007('0x129');_0x2c7d66['membername']=_0x7007('0x12a');hopperUtils[_0x7007('0xe0')](_0x2c7d66)[_0x7007('0xa0')](loggerCatch(_0x7007('0x127')));hopperUtils[_0x7007('0xc2')](_0x2c7d66)[_0x7007('0xa0')](loggerCatch(_0x7007('0x12b')));}if(_0x33ddfe&&_0x33ddfe[_0x7007('0xb7')]!==_0x7007('0xb8')&&!isNotNull(this['voiceQueues'][_0x33ddfe['queue']]['dialQueueProject'])){delete this[_0x7007('0x27')][_0x1f6645[_0x7007('0xb6')]];this[_0x7007('0xb9')](this[_0x7007('0x21')][_0x33ddfe[_0x7007('0xba')]]);this[_0x7007('0x21')][_0x33ddfe['queue']][_0x7007('0x12c')]+=0x1;_0x2c7d66=new Hangup(_0x33ddfe,_0x1f6645);_0x2c7d66[_0x7007('0xc7')]=0xc;_0x2c7d66['statedesc']=_0x1f6645[_0x7007('0x12d')];_0x2c7d66[_0x7007('0x116')]=_0x7007('0x12e');hopperUtils[_0x7007('0xe0')](_0x2c7d66)[_0x7007('0xa0')](loggerCatch(_0x7007('0x127')));hopperUtils['moveContactManagedDialer'](_0x2c7d66)[_0x7007('0xa0')](loggerCatch(_0x7007('0x12b')));}};Dialer[_0x7007('0x1b')][_0x7007('0x12f')]=function(_0x4fd983){var _0x2ebb77=this;if(!_0x2ebb77['queuesSummary'][_0x4fd983['name']]){_0x2ebb77[_0x7007('0x2d')][_0x4fd983[_0x7007('0x45')]]={'running':![]};}else if(_0x2ebb77[_0x7007('0x2d')][_0x4fd983['name']][_0x7007('0x130')]===!![]){return;}else if(_0x2ebb77[_0x7007('0x2d')][_0x4fd983[_0x7007('0x45')]][_0x7007('0x130')]===![]){_0x2ebb77[_0x7007('0x2d')][_0x4fd983[_0x7007('0x45')]]['running']=!![];}var _0x24c3cd=_0x2ebb77[_0x7007('0x21')][_0x4fd983[_0x7007('0x45')]];var _0x127e32=_0x24c3cd[_0x7007('0x6a')]!==utils[_0x7007('0x66')]['INACTIVE'];var _0x2fd451=utils[_0x7007('0x131')](_0x24c3cd);_0x24c3cd[_0x7007('0x132')]=utils[_0x7007('0x133')](_0x24c3cd,_0x2ebb77[_0x7007('0x24')]);Promise[_0x7007('0xa9')]()[_0x7007('0x3f')](function(){if(_0x24c3cd[_0x7007('0x132')]===utils[_0x7007('0x66')][_0x7007('0x80')]){if(_0x127e32){clearPredictiveAttributes(_0x24c3cd);_0x4fd983[_0x7007('0x29')]=undefined;_0x4fd983[_0x7007('0x5d')]=undefined;}if(_0x24c3cd[_0x7007('0x132')]===utils[_0x7007('0x66')][_0x7007('0x80')]){_0x4fd983[_0x7007('0x134')]=0x0;_0x4fd983['paused']=0x0;_0x4fd983[_0x7007('0x135')]=0x0;_0x4fd983[_0x7007('0x136')]=0x0;_0x4fd983[_0x7007('0x137')]=0x0;}}else if(_0x24c3cd['statusMessage']===utils[_0x7007('0x66')]['ACTIVE']&&!_0x2fd451){return _0x2ebb77[_0x7007('0x91')](_0x24c3cd,!![])[_0x7007('0x3f')](function(){return _0x2ebb77[_0x7007('0x91')](_0x24c3cd,![]);})[_0x7007('0x3f')](function(){return _0x2ebb77[_0x7007('0x138')](_0x24c3cd);})[_0x7007('0xa0')](function(_0x5dae04){loggerSyncQueueSummary['debug'](_0x7007('0x139'),util[_0x7007('0x63')](_0x5dae04,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x24c3cd);});}else{clearPredictiveAttributes(_0x24c3cd);}})[_0x7007('0x3f')](function(){var _0x9c8bc1=_0x4fd983['compareToOutboundQueue'](_0x24c3cd);if(_0x9c8bc1||_0x24c3cd[_0x7007('0x13a')]){_0x24c3cd[_0x7007('0x13a')]=![];_0x4fd983[_0x7007('0x13b')](_0x24c3cd);Object['assign'](_0x24c3cd,_0x4fd983);emitOutboundVoiceQueueSummary(_0x4fd983);}_0x2ebb77[_0x7007('0x2d')][_0x24c3cd[_0x7007('0x45')]][_0x7007('0x130')]=![];})[_0x7007('0xa0')](function(_0x1ebb67){logger[_0x7007('0x61')](_0x7007('0x139'),util[_0x7007('0x63')](_0x1ebb67,{'showHidden':![],'depth':null}));_0x2ebb77[_0x7007('0x2d')][_0x24c3cd[_0x7007('0x45')]][_0x7007('0x130')]=![];});};Dialer[_0x7007('0x1b')][_0x7007('0x35')]=_[_0x7007('0x13c')](function(){var _0x44137a=_['filter'](this[_0x7007('0x21')],function(_0x1d4e13){return _0x1d4e13[_0x7007('0x13d')];});var _0x9dae22=_[_0x7007('0x13e')](this[_0x7007('0x23')],function(_0x2170b4){return _0x2170b4['online']&&_0x2170b4[_0x7007('0x88')]===_0x7007('0x89');});if(_0x44137a[_0x7007('0xfb')]>0x0&&_0x9dae22[_0x7007('0xfb')]>0x0){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0x7007('0x13f')](_0x44137a,'id'),previewRecallmeReminderInterval,_[_0x7007('0x13f')](_0x9dae22,'id')))[_0x7007('0x3f')](function(_0x58f65b){for(var _0x564071=0x0;_0x564071<_0x58f65b[_0x7007('0xfb')];_0x564071++){var _0x37ac01=_0x58f65b[_0x564071][_0x7007('0x140')][_0x7007('0x45')];if(_0x37ac01)io['to'](util['format'](_0x7007('0x141'),_0x37ac01))[_0x7007('0x10f')]('user:dialPreviewRecallReminder',{'hopper':_0x58f65b[_0x564071]});}})['catch'](function(_0x331dec){logger['error'](_0x7007('0x142'),_0x331dec);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7007('0x1b')][_0x7007('0x143')]=function(){var _0x88a2c9=this;setInterval(function(){_0x88a2c9['clearZombieChannels'](_0x88a2c9[_0x7007('0x27')],'[uniqueid]');_0x88a2c9[_0x7007('0x144')](_0x88a2c9[_0x7007('0xeb')],'[actions]');},0x32c8);};Dialer[_0x7007('0x1b')][_0x7007('0x144')]=function(_0x3d96ed,_0x55b2ed){var _0x37414e=this;for(var _0x4202f5 in _0x3d96ed){if(typeof _0x3d96ed[_0x4202f5]!==_0x7007('0xa8')){this[_0x7007('0x1f')]['enqueue'](function(){if(!_['isNil'](_0x3d96ed[_0x4202f5])){return ami[_0x7007('0x99')]({'action':_0x7007('0x88'),'channel':_0x3d96ed[_0x4202f5]['channel']})[_0x7007('0xa0')](function(_0x336eb3){if(_0x336eb3[_0x7007('0x6a')]===_0x7007('0x145')){setTimeout(function(){if(_0x3d96ed[_0x4202f5]&&_0x3d96ed[_0x4202f5][_0x7007('0xb7')]!=='ivr'){_0x37414e[_0x7007('0xb9')](_0x37414e[_0x7007('0x21')][_0x3d96ed[_0x4202f5][_0x7007('0xba')]]);logger[_0x7007('0x61')](_0x7007('0x146'),_0x55b2ed,_0x4202f5,_0x3d96ed[_0x4202f5]['queue']);delete _0x3d96ed[_0x4202f5];}if(_0x3d96ed[_0x4202f5]&&_0x3d96ed[_0x4202f5][_0x7007('0xb7')]===_0x7007('0xb8')){_0x37414e[_0x7007('0xb9')](_0x37414e[_0x7007('0x22')][_0x3d96ed[_0x4202f5][_0x7007('0xba')]]);logger[_0x7007('0x61')](_0x7007('0x147'),_0x55b2ed,_0x4202f5,_0x3d96ed[_0x4202f5]['queue']);delete _0x3d96ed[_0x4202f5];}},0x2328);}});}});}}};Dialer['prototype'][_0x7007('0x148')]=function(_0xfd2db2){return Promise[_0x7007('0xa9')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0xfd2db2))[_0x7007('0xa0')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7007('0x1b')][_0x7007('0xb9')]=function(_0x1b0a28){if(!_[_0x7007('0x41')](_0x1b0a28)&&_0x1b0a28!==null){if(typeof _0x1b0a28['originated']!=='undefined'){if(_0x1b0a28['originated']>0x0){_0x1b0a28[_0x7007('0x7f')]-=0x1;}else{logger[_0x7007('0x61')](_0x7007('0x149'));}}}else{logger[_0x7007('0x61')](_0x7007('0x14a'));}};Dialer[_0x7007('0x1b')][_0x7007('0x14b')]=function(_0x589ebd,_0x290c71){var _0x54c80d=this;return function(_0x133c50){_0x54c80d[_0x7007('0xb9')](_0x290c71);logger[_0x7007('0x61')](_0x589ebd,util['inspect'](_0x133c50,{'showHidden':![],'depth':null}));};};Dialer[_0x7007('0x1b')][_0x7007('0x14c')]=function(_0x163637,_0x1e0798,_0x101028){var _0x3e4b23={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x1e0798);this['saveInDb'](_[_0x7007('0x14d')](_0x3e4b23,_['pick'](_0x101028,[_0x7007('0xd6'),_0x7007('0xd7'),_0x7007('0x14e'),_0x7007('0xd8'),_0x7007('0xd9')])),'[emptyContact][createHistory]',_0x7007('0x14f'));logger[_0x7007('0x61')](_0x163637);};Dialer[_0x7007('0x1b')][_0x7007('0x113')]=function(_0x30d06f,_0x3f24c7,_0x186998){hopperUtils['createHistory'](_0x30d06f)[_0x7007('0xa0')](loggerCatch(_0x3f24c7));hopperUtils['moveContactManagedDialer'](_0x30d06f)['catch'](loggerCatch(_0x186998));};Dialer[_0x7007('0x1b')]['queueCallerAbandonCreateState']=function(_0x1ae601,_0x36ae5a){hopperUtils[_0x7007('0xe0')](_0x1ae601)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x36ae5a==0x0){hopperUtils[_0x7007('0xc2')](_0x1ae601)[_0x7007('0xa0')](loggerCatch(_0x7007('0x150')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x7c6090){return Promise[_0x7007('0xa9')]()[_0x7007('0x3f')](cmHopper[_0x7007('0x151')](_0x7c6090['id'],previewRecallmeReminderInterval))[_0x7007('0x3f')](function(_0x5ebea5){for(var _0x1528f9=0x0;_0x1528f9<_0x5ebea5[_0x7007('0xfb')];_0x1528f9++){var _0x17b84a=_0x5ebea5[_0x1528f9][_0x7007('0x140')][_0x7007('0x45')];if(_0x17b84a)io['to'](util[_0x7007('0x7b')](_0x7007('0x141'),_0x17b84a))[_0x7007('0x10f')]('user:dialPreviewRecallReminder',{'hopper':_0x5ebea5[_0x1528f9]});}})[_0x7007('0xa0')](function(){});};Dialer['prototype'][_0x7007('0xac')]=function(_0x21e6f6){var _0x32dab4=this;return function(){_0x32dab4[_0x7007('0x152')](_0x21e6f6);};};Dialer[_0x7007('0x1b')][_0x7007('0x153')]=function(_0x5aaa63,_0x4f82c7){var _0x36880c=this;var _0x20dde0=uuid['v4']();this[_0x7007('0xeb')][_0x20dde0]=new Action(_0x5aaa63,_0x4f82c7,_0x20dde0);return new Promise(function(_0x1a879e,_0x4a7209){if(_[_0x7007('0x41')](_0x5aaa63)&&typeof _0x5aaa63!=='object'){return _0x4a7209(msgResponse(_0x7007('0x154'),_0x7007('0x92'),'voiceQueue\x20is\x20undefine'));}if(_[_0x7007('0x41')](_0x4f82c7[_0x7007('0x155')])||_0x4f82c7[_0x7007('0x155')]===null){return _0x4a7209(msgResponse(_0x7007('0x154'),'Failure',_0x7007('0x156')));}var _0x35b7f4={'XMD-CALLERID':_0x36880c[_0x7007('0xeb')][_0x20dde0]['getCaller'](),'XMD-AGI':_0x5aaa63['dialQueueProject']?util[_0x7007('0x7b')](_0x7007('0x157'),ipAgi,_0x5aaa63[_0x7007('0x128')]):_0x7007('0x158'),'XMD-AGIAFTER':_0x5aaa63['dialQueueProject2']?util[_0x7007('0x7b')](_0x7007('0x157'),ipAgi,_0x5aaa63['dialQueueProject2']):_0x7007('0x158'),'XMD-QUEUE':utils['isOutboundQueue'](_0x5aaa63)?util[_0x7007('0x7b')](_0x7007('0x159'),_0x5aaa63[_0x7007('0x45')],_0x5aaa63[_0x7007('0x15a')]||'',_0x5aaa63[_0x7007('0xc0')]?'c':'',_0x5aaa63[_0x7007('0xc6')]||0x3):'NONE','XMD-CONTACTID':_0x4f82c7[_0x7007('0xd6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x36880c[_0x7007('0xeb')][_0x20dde0]['getCaller'](),'XMD-AMD':_0x5aaa63[_0x7007('0x10b')]?_0x7007('0x15b'):_0x7007('0x158'),'XMD-DESTINATION':_0x7007('0x15c')};if(_0x5aaa63[_0x7007('0x10b')]){_0x35b7f4['XMD-AMDINITIALSILENCE']=_0x5aaa63[_0x7007('0x15d')]||0x9c4;_0x35b7f4[_0x7007('0x15e')]=_0x5aaa63[_0x7007('0x15f')]||0x5dc;_0x35b7f4[_0x7007('0x160')]=_0x5aaa63[_0x7007('0x161')]||0x320;_0x35b7f4[_0x7007('0x162')]=_0x5aaa63['dialAMDTotalAnalysisTime']||0x1388;_0x35b7f4[_0x7007('0x163')]=_0x5aaa63[_0x7007('0x164')]||0x64;_0x35b7f4['XMD-AMDBETWEENWORDSSILENCE']=_0x5aaa63[_0x7007('0x165')]||0x32;_0x35b7f4[_0x7007('0x166')]=_0x5aaa63['dialAMDMaximumNumberOfWords']||0x3;_0x35b7f4[_0x7007('0x167')]=_0x5aaa63[_0x7007('0x168')]||0x100;_0x35b7f4['XMD-AMDMAXIMUMWORDLENGTH']=_0x5aaa63[_0x7007('0x169')]||0x1388;}if(utils[_0x7007('0x16a')](_0x5aaa63)){_0x35b7f4['XMD-VOICEQUEUEID']=_0x4f82c7[_0x7007('0xd8')];}else{_0x35b7f4[_0x7007('0x16b')]=_0x4f82c7['CampaignId'];}for(var _0x47e8f9 in _0x4f82c7[_0x7007('0x16c')]){if(typeof _0x4f82c7['Contact'][_0x47e8f9]!==_0x7007('0xa8')){if(isNotNull(_0x4f82c7['Contact'][_0x47e8f9])&&_0x47e8f9!=='id'&&_0x47e8f9!=='tags'&&_0x47e8f9!==_0x7007('0x16d')&&_0x47e8f9!==_0x7007('0x16e')){_0x35b7f4[util[_0x7007('0x7b')](_0x7007('0x16f'),'XMD-',_[_0x7007('0x170')](_0x47e8f9))]=_0x4f82c7['Contact'][_0x47e8f9];}}}var _0x2b7bab=_0x36880c[_0x7007('0x85')](_0x5aaa63['Trunk'])?utils[_0x7007('0x171')](_0x5aaa63[_0x7007('0x172')]['callerid'],_0x5aaa63['dialOriginateCallerIdName'],_0x5aaa63['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x7007('0x173')](_0x5aaa63[_0x7007('0x174')],_0x5aaa63[_0x7007('0x175')]):_0x5aaa63[_0x7007('0x174')]):utils[_0x7007('0x171')](_[_0x7007('0xf1')](_0x5aaa63[_0x7007('0x8c')])?_0x5aaa63[_0x7007('0x172')][_0x7007('0x176')]:_0x5aaa63[_0x7007('0x8c')][_0x7007('0x176')],_0x5aaa63[_0x7007('0x177')],_0x5aaa63[_0x7007('0x175')]>0x0?utils['getCallerIdRandom'](_0x5aaa63[_0x7007('0x174')],_0x5aaa63[_0x7007('0x175')]):_0x5aaa63[_0x7007('0x174')]);if(_0x2b7bab){_0x35b7f4[_0x7007('0x178')]=_0x36880c[_0x7007('0xeb')][_0x20dde0][_0x7007('0x179')]=utils['extractCalleridName'](_0x2b7bab);_0x35b7f4['XMD-ORIGINATECALLERIDNUM']=_0x4f82c7['phone'];}_0x5aaa63[_0x7007('0x17a')]=_0x35b7f4;return ami['Action']({'actionid':_0x20dde0,'action':_0x7007('0x154'),'channel':_0x36880c[_0x7007('0x85')](_0x5aaa63['Trunk'])?util['format'](_0x7007('0x17b'),_0x5aaa63['Trunk'][_0x7007('0x45')],isNotNull(_0x5aaa63[_0x7007('0x17c')])?_0x5aaa63['dialPrefix'][_0x7007('0x17d')]()||'':'',_0x5aaa63[_0x7007('0x17e')]>0x0?_0x4f82c7[_0x7007('0x155')]['substring'](_0x5aaa63[_0x7007('0x17e')]):_0x4f82c7['phone']):util[_0x7007('0x7b')](_0x7007('0x17b'),_[_0x7007('0xf1')](_0x5aaa63['TrunkBackup'])?_0x5aaa63[_0x7007('0x172')][_0x7007('0x45')]:_0x5aaa63[_0x7007('0x8c')]['name'],isNotNull(_0x5aaa63[_0x7007('0x17c')])?_0x5aaa63['dialPrefix'][_0x7007('0x17d')]()||'':'',_0x5aaa63[_0x7007('0x17e')]>0x0?_0x4f82c7[_0x7007('0x155')][_0x7007('0x17f')](_0x5aaa63[_0x7007('0x17e')]):_0x4f82c7[_0x7007('0x155')]),'callerid':_0x2b7bab,'Exten':_0x7007('0x15c'),'Context':'from-sip','Priority':'1','variable':_0x35b7f4,'timeout':(_0x5aaa63[_0x7007('0x180')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20dde0})[_0x7007('0x3f')](function(_0x4b2fbc){return _0x1a879e(_0x4b2fbc);})[_0x7007('0xa0')](function(_0xd24fc){_0x5aaa63[_0x7007('0x181')]+=0x1;var _0x4dc4f7=new History(_0x36880c[_0x7007('0xeb')][_0x20dde0]);logger[_0x7007('0x61')](util['format'](_0x7007('0x182'),JSON[_0x7007('0x71')](_0xd24fc)));_0x4dc4f7[_0x7007('0xc7')]=0xe;_0x4dc4f7[_0x7007('0x6d')]='OriginateError';_0x4dc4f7[_0x7007('0xdc')]=moment()['format'](_0x7007('0xbc'));_0x4dc4f7['endtime']=_0x4dc4f7['starttime'];hopperUtils['createHistory'](_0x4dc4f7)['catch'](loggerCatch(_0x7007('0x183')));_0x36880c[_0x7007('0xc2')](_0x4dc4f7)['catch'](loggerCatch('[originate][error]'))[_0x7007('0x1e')](function(){delete _0x36880c['actions'][_0x20dde0];return _0x4a7209(msgResponse(_0x7007('0x154'),_0x7007('0x84'),_0x7007('0x184')));});});});};Dialer[_0x7007('0x1b')][_0x7007('0x185')]=function(_0x16a6b9,_0x5bb4c1,_0x4d0d49){var _0x153763=new History(_0x5bb4c1);if(_0x153763[_0x7007('0x119')]+_0x153763[_0x7007('0x11a')]+_0x153763[_0x7007('0x126')]+_0x153763[_0x7007('0x11b')]+_0x153763[_0x7007('0xcc')]+_0x153763[_0x7007('0xe4')]+_0x153763[_0x7007('0x11c')]+_0x153763[_0x7007('0x186')]>=_0x4d0d49[_0x7007('0x11d')]-0x1){return!![];}switch(_0x16a6b9){case 0x3:if(_0x153763['countnoanswerretry']>=_0x4d0d49[_0x7007('0x187')]-0x1){return!![];}hopperUtils[_0x7007('0xd5')]({'active':![],'countnoanswerretry':_0x153763['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x4d0d49[_0x7007('0x188')],_0x7007('0xe8'))[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763[_0x7007('0xd7')],'VoiceQueueId':_0x153763[_0x7007('0xd8')]||undefined,'CampaignId':_0x153763[_0x7007('0xd9')]||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0x189')));break;case 0x5:if(_0x153763[_0x7007('0x119')]>=_0x4d0d49['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x7007('0xd5')]({'active':![],'countbusyretry':_0x153763[_0x7007('0x119')]+=0x1,'scheduledat':moment()[_0x7007('0xe7')](_0x4d0d49[_0x7007('0x18a')],_0x7007('0xe8'))[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763[_0x7007('0xd7')],'VoiceQueueId':_0x153763[_0x7007('0xd8')]||undefined,'CampaignId':_0x153763[_0x7007('0xd9')]||undefined})['catch'](loggerCatch(_0x7007('0x18b')));break;case 0x8:if(_0x153763[_0x7007('0x11a')]>=_0x4d0d49['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x7007('0xd5')]({'active':![],'countcongestionretry':_0x153763['countcongestionretry']+=0x1,'scheduledat':moment()[_0x7007('0xe7')](_0x4d0d49[_0x7007('0x18c')],'minutes')[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763[_0x7007('0xd7')],'VoiceQueueId':_0x153763[_0x7007('0xd8')]||undefined,'CampaignId':_0x153763['CampaignId']||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0x18d')));break;case 0x0:if(_0x153763[_0x7007('0x11b')]>=_0x4d0d49[_0x7007('0x18e')]-0x1){return!![];}else{hopperUtils[_0x7007('0xd5')]({'active':![],'countnosuchnumberretry':_0x153763[_0x7007('0x11b')]+=0x1,'scheduledat':moment()[_0x7007('0xe7')](_0x4d0d49[_0x7007('0x18f')],_0x7007('0xe8'))[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763['ListId'],'VoiceQueueId':_0x153763[_0x7007('0xd8')]||undefined,'CampaignId':_0x153763[_0x7007('0xd9')]||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0x190')));}break;case 0xa:if(_0x153763['countdropretry']>=_0x4d0d49['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x7007('0xd5')]({'active':![],'countdropretry':_0x153763[_0x7007('0xcc')]+=0x1,'scheduledat':moment()[_0x7007('0xe7')](_0x4d0d49[_0x7007('0xce')],_0x7007('0xe8'))[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763[_0x7007('0xd7')],'VoiceQueueId':_0x153763[_0x7007('0xd8')]||undefined,'CampaignId':_0x153763[_0x7007('0xd9')]||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0xda')));break;case 0xb:if(_0x153763['countabandonedretry']>=_0x4d0d49[_0x7007('0xe6')]-0x1){return!![];}hopperUtils[_0x7007('0xd5')]({'active':![],'countabandonedretry':_0x153763[_0x7007('0xe4')]+=0x1,'scheduledat':moment()[_0x7007('0xe7')](_0x4d0d49['dialAbandonedRetryFrequency'],'minutes')[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763['ListId'],'VoiceQueueId':_0x153763[_0x7007('0xd8')]||undefined,'CampaignId':_0x153763[_0x7007('0xd9')]||undefined})['catch'](loggerCatch(_0x7007('0xe9')));break;case 0x13:if(_0x153763[_0x7007('0x11c')]>=_0x4d0d49[_0x7007('0x120')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x153763[_0x7007('0x11c')]+=0x1,'scheduledat':moment()[_0x7007('0xe7')](_0x4d0d49[_0x7007('0x123')],'minutes')[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763[_0x7007('0xd7')],'VoiceQueueId':_0x153763['VoiceQueueId']||undefined,'CampaignId':_0x153763[_0x7007('0xd9')]||undefined})['catch'](loggerCatch(_0x7007('0x124')));break;case 0x14:if(_0x153763[_0x7007('0x186')]>=_0x4d0d49[_0x7007('0x191')]-0x1){return!![];}hopperUtils[_0x7007('0xd5')]({'active':![],'countagentrejectretry':_0x153763[_0x7007('0x186')]+=0x1,'scheduledat':moment()[_0x7007('0xe7')](_0x4d0d49[_0x7007('0x192')],_0x7007('0xe8'))[_0x7007('0x7b')](_0x7007('0xbc')),'ContactId':_0x153763[_0x7007('0xd6')],'ListId':_0x153763[_0x7007('0xd7')],'VoiceQueueId':_0x153763[_0x7007('0xd8')]||undefined,'CampaignId':_0x153763['CampaignId']||undefined})[_0x7007('0xa0')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x7007('0x1b')][_0x7007('0x108')]=function(_0x48786e,_0x503f97,_0xbb7b82){var _0x2b0fa1=this;var _0x56df08=new History(_0x48786e);var _0x2061b1=![];var _0x26ecb9;var _0x209ba6;return new Promise(function(_0x163188,_0x31b5bf){if(_['isUndefined'](_0x503f97)&&typeof _0x503f97!==_0x7007('0x193')){return _0x31b5bf(msgResponse('[callProgressDetecting]',_0x7007('0x92'),_0x7007('0x194')));}if(_[_0x7007('0x41')](_0xbb7b82)&&typeof _0xbb7b82!==_0x7007('0x193')){return _0x31b5bf(msgResponse(_0x7007('0x195'),_0x7007('0x92'),'evt\x20is\x20undefine'));}hopperUtils[_0x7007('0xd0')](_0x56df08,_0xbb7b82[_0x7007('0xbe')],_0x503f97)[_0x7007('0x3f')](function(_0x598f9e){if(_0x598f9e[_0x7007('0xd2')]==0x1)_0x2061b1=!![];switch(_0xbb7b82[_0x7007('0xbe')]){case'0':_0x503f97[_0x7007('0x196')]+=0x1;_0x56df08[_0x7007('0xc7')]=0x0;_0x56df08[_0x7007('0x6d')]=_0x7007('0x197');_0x56df08[_0x7007('0x11b')]+=0x1;_0x56df08[_0x7007('0xcd')]+=0x1;ami[_0x7007('0x10f')]('custom:agentnosuchnumber',ut[_0x7007('0x111')](_0x48786e,_0x7007('0x198')));_0x26ecb9=_0x503f97[_0x7007('0x18f')];_0x209ba6=_0x503f97[_0x7007('0xcf')];hopperUtils[_0x7007('0xe0')](_0x56df08)[_0x7007('0xa0')](loggerCatch(_0x7007('0x118')));if(_0x2b0fa1[_0x7007('0x185')](0x0,_0x48786e,_0x503f97)&&!_0x2061b1){if(_0x56df08['countnosuchnumberretry']>=_0x503f97[_0x7007('0x18e')]){_0x2b0fa1[_0x7007('0x121')](_0x56df08,_0x163188,_0x31b5bf,_0x7007('0x199'));}else{_0x2b0fa1[_0x7007('0x11e')](_0x56df08,_0x163188,_0x31b5bf,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x503f97['outboundNoAnswerCallsDay']+=0x1;_0x56df08[_0x7007('0xc7')]=0x3;_0x56df08[_0x7007('0x6d')]=_0x7007('0x19a');_0x56df08[_0x7007('0x126')]+=0x1;_0x56df08[_0x7007('0xcd')]+=0x1;var _0x2a5ed6=ut[_0x7007('0x19b')](_0x48786e,_0x503f97);ami[_0x7007('0x10f')]('custom:agentnoanswer',_0x2a5ed6);_0x26ecb9=_0x503f97[_0x7007('0x188')];_0x209ba6=_0x503f97[_0x7007('0xcf')];hopperUtils[_0x7007('0xe0')](_0x56df08)[_0x7007('0xa0')](loggerCatch(_0x7007('0x19c')));if(_0x2b0fa1['checkRetriveMax'](0x3,_0x48786e,_0x503f97)&&!_0x2061b1){if(_0x56df08[_0x7007('0x126')]>=_0x503f97['dialNoAnswerMaxRetry']){_0x2b0fa1[_0x7007('0x121')](_0x56df08,_0x163188,_0x31b5bf,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2b0fa1[_0x7007('0x11e')](_0x56df08,_0x163188,_0x31b5bf,_0x7007('0x19d'));}}break;case'5':_0x503f97[_0x7007('0x19e')]+=0x1;_0x56df08[_0x7007('0xc7')]=0x5;_0x56df08[_0x7007('0x6d')]='Busy';_0x56df08[_0x7007('0x119')]+=0x1;_0x56df08[_0x7007('0xcd')]+=0x1;ami[_0x7007('0x10f')](_0x7007('0x19f'),ut[_0x7007('0x111')](_0x48786e,'busy'));_0x26ecb9=_0x503f97[_0x7007('0x18a')];_0x209ba6=_0x503f97['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x56df08)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2b0fa1[_0x7007('0x185')](0x5,_0x48786e,_0x503f97)&&!_0x2061b1){if(_0x56df08[_0x7007('0x119')]>=_0x503f97[_0x7007('0x1a0')]){_0x2b0fa1[_0x7007('0x121')](_0x56df08,_0x163188,_0x31b5bf,_0x7007('0x1a1'));}else{_0x2b0fa1['stateGlobal'](_0x56df08,_0x163188,_0x31b5bf,_0x7007('0x1a1'));}}break;case'8':_0x503f97[_0x7007('0x1a2')]+=0x1;_0x56df08[_0x7007('0xc7')]=0x8;_0x56df08[_0x7007('0x6d')]=_0x7007('0x1a3');_0x56df08[_0x7007('0x11a')]+=0x1;_0x56df08['countglobal']+=0x1;_0x26ecb9=_0x503f97[_0x7007('0x18c')];_0x209ba6=_0x503f97['callAdditionalPhoneAfterMin'];ami[_0x7007('0x10f')](_0x7007('0x1a4'),ut[_0x7007('0x111')](_0x48786e,'congestion'));hopperUtils[_0x7007('0xe0')](_0x56df08)[_0x7007('0xa0')](loggerCatch(_0x7007('0x1a5')));if(_0x2b0fa1[_0x7007('0x185')](0x8,_0x48786e,_0x503f97)&&!_0x2061b1){if(_0x56df08['countcongestionretry']>=_0x503f97[_0x7007('0x1a6')]){_0x2b0fa1[_0x7007('0x121')](_0x56df08,_0x163188,_0x31b5bf,'reason\x208\x20congestion');}else{_0x2b0fa1[_0x7007('0x11e')](_0x56df08,_0x163188,_0x31b5bf,_0x7007('0x1a7'));}}break;case'11':_0x503f97['outboundAbandonedCallsDay']+=0x1;_0x56df08[_0x7007('0xc7')]=0xb;_0x56df08[_0x7007('0x6d')]=_0x7007('0xe3');_0x56df08[_0x7007('0xe4')]+=0x1;_0x56df08['countglobal']+=0x1;_0x26ecb9=_0x503f97[_0x7007('0xe5')];_0x209ba6=_0x503f97['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x56df08)[_0x7007('0xa0')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2b0fa1[_0x7007('0x185')](0xb,_0x48786e,_0x503f97)&&!_0x2061b1){if(_0x56df08[_0x7007('0xe4')]>=_0x503f97['dialAbandonedMaxRetry']){_0x2b0fa1['createStateFinal'](_0x56df08,_0x163188,_0x31b5bf,'reason\x2011\x20abandoned');}else{_0x2b0fa1['stateGlobal'](_0x56df08,_0x163188,_0x31b5bf,_0x7007('0x1a8'));}}break;case'20':_0x503f97[_0x7007('0x1a9')]+=0x1;_0x56df08['state']=0x14;_0x56df08[_0x7007('0x6d')]=_0x7007('0x1aa');_0x56df08[_0x7007('0x186')]+=0x1;_0x56df08[_0x7007('0xcd')]+=0x1;_0x26ecb9=_0x503f97[_0x7007('0x192')];_0x209ba6=_0x503f97['callAdditionalPhoneAfterMin'];ami['emit'](_0x7007('0x1ab'),ut[_0x7007('0x111')](_0x48786e,_0x7007('0x1ac')));hopperUtils['createHistory'](_0x56df08)[_0x7007('0xa0')](loggerCatch(_0x7007('0x1ad')));if(_0x2b0fa1[_0x7007('0x185')](0x14,_0x48786e,_0x503f97)&&!_0x2061b1){if(_0x56df08['countagentrejectretry']>=_0x503f97[_0x7007('0x191')]){_0x2b0fa1[_0x7007('0x121')](_0x56df08,_0x163188,_0x31b5bf,'reason\x2020\x20agentreject');}else{_0x2b0fa1[_0x7007('0x11e')](_0x56df08,_0x163188,_0x31b5bf,_0x7007('0x1ae'));}}break;default:_0x503f97[_0x7007('0x12c')]+=0x1;_0x56df08['state']=0xc;_0x56df08[_0x7007('0x6d')]=_0xbb7b82['reason'];_0x26ecb9=_0x503f97[_0x7007('0x192')];_0x209ba6=_0x503f97[_0x7007('0xcf')];hopperUtils['createHistory'](_0x56df08)[_0x7007('0xa0')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x2b0fa1['checkRetriveMax'](_0xbb7b82[_0x7007('0xbe')],_0x48786e,_0x503f97)&&!_0x2061b1){if(_0x56df08[_0x7007('0x119')]+_0x56df08['countcongestionretry']+_0x56df08[_0x7007('0x126')]+_0x56df08['countnosuchnumberretry']+_0x56df08[_0x7007('0xcc')]+_0x56df08['countabandonedretry']+_0x56df08[_0x7007('0x11c')]+_0x56df08['countagentrejectretry']>=_0x503f97[_0x7007('0x11d')]){_0x2b0fa1['stateGlobal'](_0x56df08,_0x163188,_0x31b5bf,_0xbb7b82['reason']);}else{_0x2b0fa1[_0x7007('0x121')](_0x56df08,_0x163188,_0x31b5bf,_0xbb7b82[_0x7007('0xbe')]);}}}})['then'](function(){if(_0x2061b1){hopperUtils[_0x7007('0xe1')](_0x56df08,_0x26ecb9,_0x209ba6)['then'](function(){return _0x163188(0x1);});}});});};Dialer[_0x7007('0x1b')][_0x7007('0x11e')]=function(_0x442c3d,_0x4ac29b,_0x1c71e2,_0x5a95d8){var _0x38f5ec=new Final(_0x442c3d);_0x38f5ec[_0x7007('0xc7')]=0xf;_0x38f5ec[_0x7007('0x6d')]=_0x7007('0x1af');this[_0x7007('0x121')](_0x38f5ec,_0x4ac29b,_0x1c71e2,_0x5a95d8);};Dialer[_0x7007('0x1b')][_0x7007('0x121')]=function(_0x5856cf,_0x5145b4,_0x1346f2,_0x54f892){hopperUtils['moveContactManagedDialer'](_0x5856cf)[_0x7007('0x3f')](function(){return _0x5145b4(msgResponse(_0x7007('0x195'),_0x7007('0x107'),_0x54f892));})[_0x7007('0xa0')](function(){return _0x1346f2(msgResponse(_0x7007('0x1b0'),_0x7007('0x92'),_0x7007('0x1b1')));});};Dialer[_0x7007('0x1b')][_0x7007('0xb')]=function(_0x3fccc8){var _0x48d3b1=_0x3fccc8[_0x7007('0x1b2')]/0x64;var _0x4afe4e=_0x3fccc8[_0x7007('0x1b3')]/(_0x3fccc8[_0x7007('0x1b3')]+_0x3fccc8[_0x7007('0xbd')]);var _0x1f6af0=Math[_0x7007('0x1b4')](_0x3fccc8[_0x7007('0x1b5')]*(_0x3fccc8[_0x7007('0x1b6')]/0x64));var _0x117a6e=Math[_0x7007('0x1b4')](_0x3fccc8[_0x7007('0x1b5')]*(_0x3fccc8[_0x7007('0x1b7')]/0x64));var _0x4617b1=_0x3fccc8['available']+_0x3fccc8[_0x7007('0x136')];var _0x52d98a=Math['floor'](_0x3fccc8[_0x7007('0x57')]*_0x3fccc8[_0x7007('0x5a')]*_0x3fccc8['predictiveIntervalHitRate']*_0x3fccc8[_0x7007('0x1b8')]);if(_[_0x7007('0x41')](_0x3fccc8['startProgressive'])){if(!_['isUndefined'](_0x3fccc8[_0x7007('0x29')])){_0x3fccc8['startPredictive']=undefined;loggerPredictive['error'](_0x7007('0x1b9'),_0x7007('0x1ba'));}if(!_[_0x7007('0x41')](_0x3fccc8[_0x7007('0x5f')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x7007('0x1bb'));clearInterval(_0x3fccc8[_0x7007('0x5f')]);_0x3fccc8[_0x7007('0x5f')]=undefined;}_0x3fccc8['startProgressive']=moment()['format'](_0x7007('0xbc'));loggerPredictive[_0x7007('0x47')](_0x3fccc8[_0x7007('0x45')],_0x7007('0x1bc'),_0x3fccc8[_0x7007('0x5d')]);this[_0x7007('0xad')](_0x3fccc8,0x1);}else if(ifInterval(_0x3fccc8[_0x7007('0x1bd')],_0x3fccc8[_0x7007('0x5d')])){this['handlePower'](_0x3fccc8,0x1);loggerPredictiveCalls[_0x7007('0x47')](_0x7007('0x1be'),_0x3fccc8['startProgressive'],_0x3fccc8[_0x7007('0x45')]);_0x3fccc8[_0x7007('0x57')]=0x0;_0x3fccc8['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x48d3b1<_0x4afe4e&&_0x3fccc8['dialPredictiveOptimization']===_0x7007('0x1bf')){clearPredictiveAttributes(_0x3fccc8);loggerPredictive[_0x7007('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7007('0x1c0'),_0x4afe4e,'startProgressive',_0x3fccc8[_0x7007('0x45')]);}else if(_0x52d98a<_0x3fccc8[_0x7007('0x1c1')]&&_0x3fccc8['dialPredictiveOptimization']===_0x7007('0x1bf')){clearPredictiveAttributes(_0x3fccc8);loggerPredictive['info'](_0x7007('0x1c2'),_0x7007('0x1c3'),_0x52d98a,_0x7007('0x1c4'),_0x3fccc8[_0x7007('0x1c1')],_0x7007('0x5d'),_0x3fccc8[_0x7007('0x45')]);}else if(!ifInterval(_0x3fccc8[_0x7007('0x1bd')],_0x3fccc8[_0x7007('0x5d')])&&_[_0x7007('0x41')](_0x3fccc8[_0x7007('0x29')])&&!_[_0x7007('0x41')](_0x3fccc8[_0x7007('0x5d')])){_0x3fccc8[_0x7007('0x29')]=moment()[_0x7007('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3fccc8[_0x7007('0x45')],_0x7007('0x1c5'),_0x3fccc8['startPredictive']);hopperUtils[_0x7007('0x1c6')](_0x3fccc8[_0x7007('0x1bd')])[_0x7007('0x3f')](this[_0x7007('0x1c7')](_0x3fccc8))[_0x7007('0x3f')](mergeDataErlangB(_0x3fccc8))['then'](this[_0x7007('0x1c8')](_0x3fccc8))[_0x7007('0xa0')](loggerCatchPredictive(_0x7007('0x1c9'),_0x3fccc8));}else if(!ifInterval(_0x3fccc8[_0x7007('0x1bd')],_0x3fccc8['startPredictive'])){_0x3fccc8[_0x7007('0x1c1')]=0x0;_0x3fccc8[_0x7007('0x29')]=moment()[_0x7007('0x7b')](_0x7007('0xbc'));loggerPredictive[_0x7007('0x47')](_0x3fccc8[_0x7007('0x45')],_0x7007('0x1ca'),_0x3fccc8[_0x7007('0x29')]);clearInterval(_0x3fccc8['handlePredictive']);_0x3fccc8[_0x7007('0x5f')]=undefined;hopperUtils[_0x7007('0x1c6')](_0x3fccc8[_0x7007('0x1bd')])[_0x7007('0x3f')](this[_0x7007('0x1c7')](_0x3fccc8))['then'](mergeDataErlangB(_0x3fccc8))[_0x7007('0x3f')](this[_0x7007('0x1c8')](_0x3fccc8))[_0x7007('0xa0')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3fccc8));}else if(_0x3fccc8[_0x7007('0x1b5')]&&_0x4617b1<_0x3fccc8[_0x7007('0x1b5')]-_0x117a6e){clearPredictiveAttributes(_0x3fccc8);loggerPredictive[_0x7007('0x47')](_0x3fccc8[_0x7007('0x45')],_0x7007('0x1cb'),_0x4617b1,')\x20are\x20less\x20than\x20threshold\x20(',_0x3fccc8[_0x7007('0x1b5')],'-',_0x117a6e,'=',_0x3fccc8[_0x7007('0x1b5')]-_0x117a6e,')');}else if(_0x3fccc8[_0x7007('0x1b5')]&&_0x4617b1>_0x3fccc8[_0x7007('0x1b5')]+_0x1f6af0){clearPredictiveAttributes(_0x3fccc8);loggerPredictive[_0x7007('0x47')](_0x3fccc8[_0x7007('0x45')],_0x7007('0x1cb'),_0x4617b1,_0x7007('0x1cc'),_0x3fccc8[_0x7007('0x1b5')],'+',_0x1f6af0,'=',_0x3fccc8[_0x7007('0x1b5')]+_0x1f6af0,')');}};Dialer[_0x7007('0x1b')][_0x7007('0x1c7')]=function(_0x36d2d3){var _0x260b1f=this;return function(_0x3315a4){return new Promise(function(_0x30a196,_0x5a2c2d){_[_0x7007('0x14d')](_0x36d2d3,_0x3315a4[0x0]);if(checkGetDataPredictive(_0x3315a4[0x0])){var _0x511d0d=_0x36d2d3[_0x7007('0x1b5')]=_0x36d2d3[_0x7007('0x136')]+_0x36d2d3[_0x7007('0x134')];var _0x393317=_0x36d2d3[_0x7007('0x1bd')]*0x3c;var _0x8c5899=_0x3315a4[0x0][_0x7007('0x52')]+_0x3315a4[0x0][_0x7007('0x50')];var _0x52d19d=(_0x3315a4[0x0][_0x7007('0x1cd')]+_0x3315a4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3315a4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3315a4[0x0][_0x7007('0x49')];_0x36d2d3[_0x7007('0x1ce')]=_0x52d19d>0x0?_0x52d19d:0x1;switch(_0x36d2d3[_0x7007('0x1cf')]){case _0x7007('0x1bf'):var _0x2f3ea5=_0x36d2d3[_0x7007('0x1b2')]/0x64;return _0x260b1f['abandonmentRate'](_0x511d0d,_0x393317,_0x8c5899,_0x52d19d,_0x2f3ea5)[_0x7007('0x3f')](function(_0x3c900d){return _0x30a196(_0x3c900d);});case _0x7007('0x1d0'):var _0x43bd7f=_0x36d2d3['dialPredictiveOptimizationPercentage']/0x64;return _0x260b1f[_0x7007('0x1d1')](_0x511d0d,_0x393317,_0x8c5899,_0x52d19d,_0x43bd7f)[_0x7007('0x3f')](function(_0x2c31ca){return _0x30a196(_0x2c31ca);});default:return _0x5a2c2d(msgResponse(_0x7007('0x1d2'),_0x7007('0x92'),_0x7007('0x1d3')));}}else{return _0x5a2c2d(msgResponse(_0x7007('0x1d2'),'Failure',_0x7007('0x1d4')));}});};};Dialer[_0x7007('0x1b')]['getDataPredictiveOld']=function(_0x5c35d3){var _0x5cf09c=this;return function(_0x28eb56){return new Promise(function(_0x5467db,_0x571877){_[_0x7007('0x14d')](_0x5c35d3,_0x28eb56[0x0]);if(checkGetDataPredictive(_0x28eb56[0x0])){loggerPredictive[_0x7007('0x47')](JSON[_0x7007('0x71')](_0x28eb56[0x0]));if(_0x5c35d3['dialPredictiveOptimization']===_0x7007('0x1bf')){return _0x5cf09c[_0x7007('0x148')](_0x5c35d3['id'])[_0x7007('0x3f')](function(_0xb4d9fb){var _0x2c674d=_0x5c35d3['loggedIn']-_0xb4d9fb[0x0][_0x7007('0x1d5')];var _0x14a37e=_0x5c35d3[_0x7007('0x1bd')]*0x3c;var _0x4fb6d3=_0x28eb56[0x0]['predictiveIntervalAvgTalktime']+_0x28eb56[0x0]['predictiveIntervalAvgHoldtime'];var _0x51a6fd=(_0x28eb56[0x0][_0x7007('0x1cd')]+_0x28eb56[0x0][_0x7007('0x4c')]+_0x28eb56[0x0][_0x7007('0x4e')])/_0x28eb56[0x0][_0x7007('0x49')];var _0xa15caa=_0x5c35d3[_0x7007('0x1b2')]/0x64;_0x5c35d3[_0x7007('0x1d6')]=_0xb4d9fb[0x0][_0x7007('0x1d5')]||0x0;_0x5c35d3[_0x7007('0x1ce')]=_0x51a6fd>0x0?_0x51a6fd:0x1;return _0x5cf09c[_0x7007('0x1d7')](_0x2c674d,_0x14a37e,_0x4fb6d3,_0x51a6fd,_0xa15caa);})['then'](function(_0x513ee3){return _0x5467db(_0x513ee3);})[_0x7007('0xa0')](function(_0x2b8c88){return _0x571877(msgResponse('[CatchErlangB]',_0x7007('0x92'),JSON['stringify'](_0x2b8c88)));});}if(_0x5c35d3[_0x7007('0x1cf')]===_0x7007('0x1d0')){return _0x5cf09c[_0x7007('0x148')](_0x5c35d3['id'])[_0x7007('0x3f')](function(_0x2f3755){var _0x2db8d5=_0x5c35d3['loggedIn']-_0x2f3755[0x0][_0x7007('0x1d5')];var _0x32ff61=_0x5c35d3[_0x7007('0x1bd')]*0x3c;var _0xecd88a=_0x28eb56[0x0][_0x7007('0x52')]+_0x28eb56[0x0]['predictiveIntervalAvgHoldtime'];var _0x36f9d9=(_0x28eb56[0x0][_0x7007('0x1cd')]+_0x28eb56[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x28eb56[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x28eb56[0x0][_0x7007('0x49')];var _0x1dfcc1=_0x5c35d3[_0x7007('0x1b2')]/0x64;_0x5c35d3[_0x7007('0x1d6')]=_0x2f3755[0x0][_0x7007('0x1d5')]||0x0;_0x5c35d3[_0x7007('0x1ce')]=_0x36f9d9>0x0?_0x36f9d9:0x1;return _0x5cf09c[_0x7007('0x1d1')](_0x2db8d5,_0x32ff61,_0xecd88a,_0x36f9d9,_0x1dfcc1);})[_0x7007('0x3f')](function(_0x22e08f){return _0x5467db(_0x22e08f);})[_0x7007('0xa0')](function(_0x1fdead){return _0x571877(msgResponse('[CatchErlangB]',_0x7007('0x92'),JSON[_0x7007('0x71')](_0x1fdead)));});}}else{return _0x571877(msgResponse(_0x7007('0x1d2'),'Failure',_0x7007('0x1d4')));}});};};Dialer[_0x7007('0x1b')][_0x7007('0x1c8')]=function(_0x4a0499){var _0x4cd30b=this;return function(){var _0x3483d8=0x0;var _0x2539ad=Math[_0x7007('0x1d8')](_0x4a0499[_0x7007('0x59')]*0x3e8);if(_0x2539ad>0x0){_0x2539ad=_0x2539ad<0x64?0x64:_0x2539ad;loggerPredictive[_0x7007('0x47')](_0x4a0499[_0x7007('0x45')],_0x7007('0x1d9'),_0x2539ad,_0x7007('0x1da'));_0x4a0499[_0x7007('0x5f')]=setInterval(function(){_0x4cd30b[_0x7007('0x5f')](_0x4a0499);loggerPredictiveCalls[_0x7007('0x47')](_0x7007('0x1db'),_0x3483d8+=0x1);},_0x2539ad);}else{loggerPredictive[_0x7007('0x47')](_0x4a0499[_0x7007('0x45')],_0x7007('0x1dc'));}};};Dialer['prototype']['checkContactBlack']=function(_0x5b02cc,_0x290931){var _0x2616c0=this;return function(_0x6a5b2b){if(_['isEmpty'](_0x6a5b2b)){if(_[_0x7007('0xf1')](_0x290931[_0x7007('0x14e')])||!_0x290931['recallme']){if(_0x5b02cc[_0x7007('0x1dd')]===_0x7007('0xa')){_0x5b02cc['queueStatusComplete']=_[_0x7007('0x41')](_0x5b02cc['queueStatusComplete'])?!![]:_0x5b02cc[_0x7007('0x6e')];var _0x150826=uuid['v4']();_0x2616c0['actions'][_0x150826]=new Action(_0x5b02cc,_0x290931,_0x150826);loggerBooked[_0x7007('0x47')](_0x7007('0x1de'),_0x150826,_0x7007('0x1df'),JSON[_0x7007('0x71')](_0x5b02cc['queueStatusComplete']),_0x7007('0x1e0'),_0x5b02cc[_0x7007('0x45')]);if(_0x5b02cc[_0x7007('0x6e')]){_0x5b02cc['queueStatusComplete']=![];_0x2616c0[_0x7007('0x2b')][_0x2616c0[_0x7007('0xeb')][_0x150826][_0x7007('0xba')]]=[];ami[_0x7007('0x99')]({'actionid':_0x150826,'action':_0x7007('0x1e1'),'queue':_0x5b02cc[_0x7007('0x45')]})['catch'](function(){_0x2616c0[_0x7007('0xb9')](_0x5b02cc);hopperUtils[_0x7007('0xd5')]({'active':![],'ContactId':_0x2616c0[_0x7007('0xeb')][_0x150826][_0x7007('0xd6')],'ListId':_0x2616c0[_0x7007('0xeb')][_0x150826][_0x7007('0xd7')],'VoiceQueueId':_0x2616c0[_0x7007('0xeb')][_0x150826][_0x7007('0xd8')]||undefined,'CampaignId':_0x2616c0[_0x7007('0xeb')][_0x150826]['CampaignId']||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0x1e2')));delete _0x2616c0['actions'][_0x150826];});}else{loggerBooked[_0x7007('0x47')](_0x7007('0x1e3'),JSON[_0x7007('0x71')](_0x5b02cc['queueStatusComplete']),_0x7007('0x1e0'),_0x5b02cc['name']);_0x2616c0[_0x7007('0xb9')](_0x5b02cc);hopperUtils[_0x7007('0xd5')]({'active':![],'ContactId':_0x2616c0[_0x7007('0xeb')][_0x150826]['ContactId'],'ListId':_0x2616c0['actions'][_0x150826][_0x7007('0xd7')],'VoiceQueueId':_0x2616c0['actions'][_0x150826]['VoiceQueueId']||undefined,'CampaignId':_0x2616c0[_0x7007('0xeb')][_0x150826][_0x7007('0xd9')]||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0x1e2')));delete _0x2616c0[_0x7007('0xeb')][_0x150826];}}else{return _0x2616c0[_0x7007('0x153')](_0x5b02cc,_0x290931);}}else{if(utils[_0x7007('0x5c')](undefined,_0x290931[_0x7007('0x1e4')])<_0x5b02cc[_0x7007('0x1e5')]*0x3c){if(_0x290931['Agent']&&!_0x290931[_0x7007('0x140')]['voicePause']){_0x2616c0['preview'][_0x7007('0xf7')](_0x290931['id'])[_0x7007('0x1e')](function(){_0x2616c0[_0x7007('0xb9')](_0x5b02cc);});}else{hopperUtils[_0x7007('0x1e6')]({'active':![]},_0x290931['id'],0x1)['finally'](function(){_0x2616c0[_0x7007('0xb9')](_0x5b02cc);});}}else{_0x5b02cc[_0x7007('0x1e7')]+=0x1;_0x2616c0['updateOriginated'](_0x5b02cc);if(_0x5b02cc[_0x7007('0x1e8')]){hopperUtils[_0x7007('0xd5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x290931[_0x7007('0xd6')],'ListId':_0x290931['ListId'],'VoiceQueueId':_0x290931['VoiceQueueId']||undefined,'CampaignId':_0x290931['CampaignId']||undefined})[_0x7007('0xa0')](loggerCatch(_0x7007('0x1e9')));hopperUtils['createHistory'](createObjHistory(_0x5b02cc,_0x290931,utils[_0x7007('0x66')][_0x7007('0x1ea')],0x17,_0x7007('0x1eb')))[_0x7007('0xa0')](loggerCatch(_0x7007('0x1ec')));}else{_0x2616c0[_0x7007('0x113')](createObjHistory(_0x5b02cc,_0x290931,utils[_0x7007('0x66')][_0x7007('0x1ed')],0x16,_0x7007('0x1ee')),_0x7007('0x1ef'),'[Originate][HistoryRecallClose]');}}}}else{_0x5b02cc[_0x7007('0x1f0')]+=0x1;_0x2616c0[_0x7007('0x113')](createObjHistory(_0x5b02cc,_0x290931,utils[_0x7007('0x66')][_0x7007('0x1f1')],0xd,'Blacklist'),_0x7007('0x1f2'),_0x7007('0x1f3'));throw _0x7007('0x1f4');}};};Dialer[_0x7007('0x1b')][_0x7007('0x152')]=function(_0x4146fc){var _0x5e0ba6=this;var _0x5a50a1=_0x4146fc[_0x7007('0x1f5')]-_0x4146fc[_0x7007('0x7f')]-_0x4146fc[_0x7007('0x1f6')];emitCampaignSummary(_0x4146fc);if(_0x5a50a1>0x0){if(_0x5a50a1>this[_0x7007('0x25')]){_0x5a50a1=this[_0x7007('0x25')];}_0x4146fc[_0x7007('0x1f6')]+=_0x5a50a1;hopperUtils['getContactDialerIvr'](_0x4146fc['id'],_0x5a50a1,_0x4146fc['dialOrderByScheduledAt'],_0x4146fc)[_0x7007('0x3f')](function(_0x284086){_0x4146fc[_0x7007('0x1f6')]-=_0x5a50a1;_0x4146fc[_0x7007('0x1f6')]=_0x4146fc[_0x7007('0x1f6')]>0x0?_0x4146fc[_0x7007('0x1f6')]:0x0;if(!utils[_0x7007('0x1f7')](_0x284086)){_0x4146fc[_0x7007('0x6a')]=utils[_0x7007('0x66')][_0x7007('0x6b')];logger['info'](_0x7007('0x1f8')+_0x4146fc[_0x7007('0x45')]);}else{_0x4146fc[_0x7007('0x7f')]+=_0x284086[_0x7007('0xfb')];_0x4146fc[_0x7007('0x6a')]=utils[_0x7007('0x66')][_0x7007('0x1f9')];for(var _0x5af48d=0x0;_0x5af48d<_0x284086[_0x7007('0xfb')];_0x5af48d+=0x1){_0x4146fc[_0x7007('0x1fa')]+=0x1;if(_[_0x7007('0xf1')](_0x284086[_0x5af48d])||_[_0x7007('0xf1')](_0x284086[_0x5af48d][_0x7007('0x16c')])||_['isNil'](_0x284086[_0x5af48d][_0x7007('0x155')])){_0x5e0ba6[_0x7007('0x14c')](_0x7007('0x1fb'),_0x4146fc,_0x284086[_0x5af48d]);}else{hopperUtils[_0x7007('0x1fc')](_[_0x7007('0x72')](_0x284086[_0x5af48d],[_0x7007('0xd9'),'phone']))[_0x7007('0x3f')](_0x5e0ba6[_0x7007('0x1fd')](_0x4146fc,_0x284086[_0x5af48d]))['catch'](_0x5e0ba6[_0x7007('0x14b')]('[actionOriginateIvr]\x20',_0x4146fc));}}}})[_0x7007('0xa0')](loggerGetContactDialer(_0x7007('0x1fe'),_0x4146fc,_0x5a50a1));}};Dialer[_0x7007('0x1b')][_0x7007('0xad')]=function(_0x407d7f,_0x19cb66){var _0x56dd6f=this;var _0x3db66c=[];if(_0x19cb66<0x1||_0x407d7f[_0x7007('0x1dd')]===_0x7007('0xa')){_0x19cb66=0x1;}var _0x358fd8=Math['floor'](_0x407d7f[_0x7007('0x134')]*_0x19cb66)-_0x407d7f[_0x7007('0x7f')]-_0x407d7f[_0x7007('0x1f6')];if(_0x407d7f[_0x7007('0x1ff')]>0x0){var _0x127e3a=_0x407d7f[_0x7007('0x1ff')]-_0x407d7f[_0x7007('0x7f')]-_0x407d7f['talking']-_0x407d7f['temp']-_0x407d7f[_0x7007('0x137')];if(_0x358fd8>_0x127e3a){_0x358fd8=_0x127e3a;}}if(_0x358fd8>0x0){if(_0x407d7f[_0x7007('0x1dd')]===_0x7007('0xa')){_0x358fd8=0x1;}if(_0x358fd8>this['maxNumberOriginate']){_0x358fd8=this[_0x7007('0x25')];}_0x407d7f['temp']+=_0x358fd8;for(var _0x12a8bb in this[_0x7007('0x23')]){if(typeof this[_0x7007('0x23')][_0x12a8bb]!==_0x7007('0xa8')){if(this[_0x7007('0x23')][_0x12a8bb][_0x7007('0xc7')]===_0x7007('0x200')&&this['agents'][_0x12a8bb]['status']===_0x7007('0x89')){_0x3db66c[_0x7007('0x98')](this[_0x7007('0x23')][_0x12a8bb]['id']);}}}hopperUtils[_0x7007('0x201')](_0x407d7f,_0x3db66c,_0x358fd8)[_0x7007('0x3f')](function(_0x444278){_0x407d7f['temp']-=_0x358fd8;_0x407d7f['temp']=_0x407d7f[_0x7007('0x1f6')]>0x0?_0x407d7f['temp']:0x0;if(!utils[_0x7007('0x1f7')](_0x444278)){hopperUtils[_0x7007('0x202')](_0x407d7f)[_0x7007('0x3f')](sendMessageReschedule(_0x407d7f))[_0x7007('0xa0')](loggerCatch(_0x7007('0x203')));}else{_0x407d7f[_0x7007('0x7f')]+=_0x444278[_0x7007('0xfb')];_0x407d7f['message']=_0x407d7f['dialMethod']===_0x7007('0xa')?utils[_0x7007('0x66')]['ACTIVE']:utils['CAMPAIGN_STATUS'][_0x7007('0x1f9')];for(var _0x210a97=0x0;_0x210a97<_0x444278[_0x7007('0xfb')];_0x210a97+=0x1){if(_[_0x7007('0xf1')](_0x444278[_0x210a97])||_[_0x7007('0xf1')](_0x444278[_0x210a97][_0x7007('0x16c')])||_[_0x7007('0xf1')](_0x444278[_0x210a97]['phone'])){_0x56dd6f[_0x7007('0x14c')](_0x7007('0x1fb'),_0x407d7f,_0x444278[_0x210a97]);}else{hopperUtils['checkIsBlackList'](_[_0x7007('0x72')](_0x444278[_0x210a97],[_0x7007('0xd8'),_0x7007('0x155')]))['then'](_0x56dd6f[_0x7007('0x1fd')](_0x407d7f,_0x444278[_0x210a97]))['catch'](_0x56dd6f[_0x7007('0x14b')](_0x7007('0x1fb'),_0x407d7f));}}}})['catch'](loggerGetContactDialer(_0x7007('0x204'),_0x407d7f,_0x358fd8));}};Dialer['prototype'][_0x7007('0x5f')]=function(_0x311ce9){if(_0x311ce9[_0x7007('0x1ff')]>0x0){var _0x5b049a=_0x311ce9[_0x7007('0x1ff')]-_0x311ce9[_0x7007('0x7f')]-_0x311ce9[_0x7007('0x136')];if(_0x5b049a>0x0){this[_0x7007('0x205')](_0x311ce9);}else{loggerPredictiveCalls[_0x7007('0x47')](_0x7007('0x206'));}}else{this[_0x7007('0x205')](_0x311ce9);}};Dialer[_0x7007('0x1b')]['tryOriginatePredictive']=function(_0x43a2dd){var _0x58155d=this;var _0x554386=[];_0x43a2dd[_0x7007('0x7f')]+=0x1;for(var _0x370cb4 in this['agents']){if(typeof this[_0x7007('0x23')][_0x370cb4]!=='undefined'){if(this['agents'][_0x370cb4][_0x7007('0xc7')]===_0x7007('0x200')&&this[_0x7007('0x23')][_0x370cb4][_0x7007('0x88')]===_0x7007('0x89')){_0x554386['push'](this[_0x7007('0x23')][_0x370cb4]['id']);}}}return this[_0x7007('0x201')](_0x43a2dd['id'],_0x554386,0x1,_0x43a2dd[_0x7007('0x207')],_0x43a2dd)[_0x7007('0x3f')](function(_0x4e5f15){if(!utils[_0x7007('0x1f7')](_0x4e5f15)){utils[_0x7007('0x64')](_0x43a2dd,0x1,0x0);return hopperUtils[_0x7007('0x202')](_0x43a2dd)[_0x7007('0x3f')](sendMessageReschedule(_0x43a2dd))[_0x7007('0xa0')](loggerCatch('[countReScheduled]\x20'));}else{_0x43a2dd[_0x7007('0x6a')]=utils[_0x7007('0x66')][_0x7007('0x1f9')];if(_['isNil'](_0x4e5f15[0x0])||_['isNil'](_0x4e5f15[0x0][_0x7007('0x16c')])||_[_0x7007('0xf1')](_0x4e5f15[0x0][_0x7007('0x155')])){_0x58155d['emptyContact'](_0x7007('0x1fb'),_0x43a2dd,_0x4e5f15[0x0]);}else{return hopperUtils[_0x7007('0x208')](_[_0x7007('0x72')](_0x4e5f15[0x0],['VoiceQueueId',_0x7007('0x155')]))['then'](_0x58155d[_0x7007('0x1fd')](_0x43a2dd,_0x4e5f15[0x0]))['catch'](_0x58155d[_0x7007('0x14b')](_0x7007('0x209'),_0x43a2dd));}}})['catch'](loggerGetContactDialer(_0x7007('0x20a'),_0x43a2dd,0x1));};Dialer['prototype'][_0x7007('0x1d7')]=function(_0x574dea,_0xf37e90,_0x11f23b,_0x2d834d,_0x44de72,_0x4d41ef){loggerPredictive[_0x7007('0x47')](_0x7007('0x20b'));loggerPredictive[_0x7007('0x47')](_0x7007('0x20c'),_0x574dea);loggerPredictive[_0x7007('0x47')](_0x7007('0x20d'),_0xf37e90);loggerPredictive[_0x7007('0x47')](_0x7007('0x20e'),_0x11f23b);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d834d);loggerPredictive['info'](_0x7007('0x20f'),_0x44de72);loggerPredictive[_0x7007('0x47')](_0x7007('0x53'));return new Promise(function(_0x23f8de,_0x53f638){if(_0x574dea<=0x0||isNaN(_0x574dea)){return _0x53f638(msgResponse(_0x7007('0x210'),_0x7007('0x84'),_0x7007('0x211')+_0x574dea));}if(_0x11f23b<=0x0||isNaN(_0x11f23b)){return _0x53f638(msgResponse(_0x7007('0x210'),_0x7007('0x84'),_0x7007('0x212')+_0x11f23b));}if(_0x2d834d<=0x0||isNaN(_0x2d834d)){return _0x53f638(msgResponse(_0x7007('0x210'),_0x7007('0x84'),_0x7007('0x213')+_0x2d834d));}if(_0xf37e90<=0x0||isNaN(_0xf37e90)){return _0x53f638(msgResponse('[abandonmentRate]','Error',_0x7007('0x214')+_0xf37e90));}if(_0x44de72<=0x0||isNaN(_0x44de72)){return _0x53f638(msgResponse(_0x7007('0x210'),'Error',_0x7007('0x215')+_0x44de72));}_0x4d41ef=_0x4d41ef||0x0;var _0x5ec64d=0x1/_0x11f23b;var _0x4caeb4=0x0;var _0x272cbd=0x0;var _0x4ce46e=0x0;var _0x300c7d=0x0;for(var _0x5b1c4d=0x0;_0x4ce46e<_0x44de72;_0x5b1c4d+=0x1){_0x272cbd=_0x5b1c4d/_0xf37e90;_0x4caeb4=(_0x2d834d*_0x272cbd+_0x4d41ef)/_0x5ec64d;_0x4ce46e=utils[_0x7007('0x216')](_0x4caeb4,_0x574dea);_0x300c7d=_0x4caeb4/_0x574dea*(0x1-utils[_0x7007('0x216')](_0x4caeb4,_0x574dea));}return _0x23f8de({'erlangCalls':_0x5b1c4d,'erlangCallToSecond':_0xf37e90/_0x5b1c4d,'erlangAbandonmentRate':_0x4ce46e,'erlangBusyFactor':_0x300c7d});});};Dialer[_0x7007('0x1b')][_0x7007('0x1d1')]=function(_0x118a34,_0x2a233b,_0x151afa,_0x11ad3c,_0x2257cb,_0x2e7264){loggerPredictive[_0x7007('0x47')](_0x7007('0x217'));loggerPredictive[_0x7007('0x47')](_0x7007('0x20c'),_0x118a34);loggerPredictive[_0x7007('0x47')](_0x7007('0x20d'),_0x2a233b);loggerPredictive['info'](_0x7007('0x20e'),_0x151afa);loggerPredictive[_0x7007('0x47')](_0x7007('0x218'),_0x11ad3c);loggerPredictive[_0x7007('0x47')](_0x7007('0x219'),_0x2257cb);loggerPredictive[_0x7007('0x47')](_0x7007('0x53'));return new Promise(function(_0x83d1b1,_0x4a3935){if(_0x118a34<=0x0||isNaN(_0x118a34)){return _0x4a3935(msgResponse('[busyFactor]',_0x7007('0x84'),_0x7007('0x211')+_0x118a34));}if(_0x151afa<=0x0||isNaN(_0x151afa)){return _0x4a3935(msgResponse('[busyFactor]',_0x7007('0x84'),'Ts\x20=\x20'+_0x151afa));}if(_0x11ad3c<=0x0||isNaN(_0x11ad3c)){return _0x4a3935(msgResponse(_0x7007('0x21a'),_0x7007('0x84'),_0x7007('0x213')+_0x11ad3c));}if(_0x2a233b<=0x0||isNaN(_0x2a233b)){return _0x4a3935(msgResponse(_0x7007('0x21a'),_0x7007('0x84'),_0x7007('0x214')+_0x2a233b));}if(_0x2257cb<=0x0||isNaN(_0x2257cb)){return _0x4a3935(msgResponse('[busyFactor]',_0x7007('0x84'),_0x7007('0x21b')+_0x2257cb));}_0x2e7264=_0x2e7264||0x0;var _0x34dd2c=0x1/_0x151afa;var _0xbe7cd2=0x0;var _0x227421=0x0;var _0x1a36b6=0x0;var _0x2d2b62=0x0;for(var _0x583d63=0x0;_0x2d2b62<_0x2257cb;_0x583d63+=0x1){_0x227421=_0x583d63/_0x2a233b;_0xbe7cd2=(_0x11ad3c*_0x227421+_0x2e7264)/_0x34dd2c;_0x1a36b6=utils[_0x7007('0x216')](_0xbe7cd2,_0x118a34);_0x2d2b62=_0xbe7cd2/_0x118a34*(0x1-utils[_0x7007('0x216')](_0xbe7cd2,_0x118a34));}return _0x83d1b1({'erlangCalls':_0x583d63,'erlangCallToSecond':_0x2a233b/_0x583d63,'erlangAbandonmentRate':_0x1a36b6,'erlangBusyFactor':_0x2d2b62});});};module[_0x7007('0x21c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index a96999f..977edf3 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52b9=['\x22%s\x22\x20<%s>','dialCutDigit','number','substring','queue','exports','lodash','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','phone','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridname','prototype','getCaller'];(function(_0x386f3a,_0x47d646){var _0x435442=function(_0x4790aa){while(--_0x4790aa){_0x386f3a['push'](_0x386f3a['shift']());}};_0x435442(++_0x47d646);}(_0x52b9,0x81));var _0x952b=function(_0x2a52b4,_0x132380){_0x2a52b4=_0x2a52b4-0x0;var _0x194fac=_0x52b9[_0x2a52b4];return _0x194fac;};'use strict';var util=require('util');var _=require(_0x952b('0x0'));var moment=require('moment');function checkNameSurname(_0x2a450e,_0x48f3e0,_0x5ec7c6){var _0x12f0e3='';if(!_[_0x952b('0x1')](_0x48f3e0)&&'string'===typeof _0x48f3e0){_0x12f0e3+=_0x48f3e0;}if(!_['isNil'](_0x5ec7c6)&&'string'===typeof _0x5ec7c6){_0x12f0e3+='\x20'+_0x5ec7c6;}if(_0x12f0e3!==''){return _0x12f0e3;}return _0x2a450e;}function Action(_0x992755,_0x3e51ba,_0x2e02c1){this[_0x952b('0x2')]=_0x992755;this[_0x952b('0x3')]=_0x2e02c1||undefined;this[_0x952b('0x4')]=checkNameSurname(_0x3e51ba[_0x952b('0x5')]['phone'],_0x3e51ba[_0x952b('0x5')][_0x952b('0x6')],_0x3e51ba[_0x952b('0x5')][_0x952b('0x7')]);this['number']=_0x3e51ba[_0x952b('0x8')];this['queue']=_0x992755[_0x952b('0x4')];this[_0x952b('0x9')]=_0x3e51ba[_0x952b('0x9')]||![];this['type']=_0x992755[_0x952b('0xa')];this[_0x952b('0xb')]=_0x992755[_0x952b('0xb')]||0x3;this[_0x952b('0xc')]=_0x3e51ba['scheduledat'];this[_0x952b('0xd')]=_0x3e51ba[_0x952b('0xd')];this[_0x952b('0xe')]=_0x3e51ba[_0x952b('0xe')];this[_0x952b('0xf')]=_0x3e51ba[_0x952b('0xf')];this[_0x952b('0x10')]=_0x3e51ba['countnosuchnumberretry'];this[_0x952b('0x11')]=_0x3e51ba[_0x952b('0x11')];this[_0x952b('0x12')]=_0x3e51ba[_0x952b('0x12')];this['countmachineretry']=_0x3e51ba[_0x952b('0x13')];this[_0x952b('0x14')]=_0x3e51ba[_0x952b('0x14')];this['ContactId']=_0x3e51ba['ContactId'];this[_0x952b('0x15')]=_0x3e51ba[_0x952b('0x15')];this[_0x952b('0x16')]=_0x3e51ba[_0x952b('0x16')];this[_0x952b('0x17')]=_0x3e51ba[_0x952b('0x17')];this[_0x952b('0x18')]=_0x3e51ba[_0x952b('0x18')];this[_0x952b('0x19')]=_0x3e51ba['id'];this['ContactFirstName']=_0x3e51ba[_0x952b('0x5')]['firstName']||'';this[_0x952b('0x1a')]=moment()[_0x952b('0x1b')](_0x952b('0x1c'));this[_0x952b('0x1d')]=_0x3e51ba[_0x952b('0x1d')];this[_0x952b('0x1e')]=_0x3e51ba['callbackuniqueid'];this[_0x952b('0x1f')]=_0x3e51ba[_0x952b('0x1f')];this['recallme']=_0x3e51ba['recallme'];this['originatecalleridnum']='';this[_0x952b('0x20')]='';}Action[_0x952b('0x21')][_0x952b('0x22')]=function(){return util['format'](_0x952b('0x23'),this[_0x952b('0x4')],this[_0x952b('0x2')][_0x952b('0x24')]>0x0?this[_0x952b('0x25')][_0x952b('0x26')](this[_0x952b('0x2')][_0x952b('0x24')]):this[_0x952b('0x25')]);};Action['prototype']['getQueue']=function(){return this[_0x952b('0x27')];};module[_0x952b('0x28')]=Action; \ No newline at end of file +var _0x6441=['starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','phone','Contact','firstName','lastName','number','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x1e9d39,_0x398621){var _0x252d2d=function(_0x52a355){while(--_0x52a355){_0x1e9d39['push'](_0x1e9d39['shift']());}};_0x252d2d(++_0x398621);}(_0x6441,0x15e));var _0x1644=function(_0x11eac6,_0x228e5b){_0x11eac6=_0x11eac6-0x0;var _0xc6a250=_0x6441[_0x11eac6];return _0xc6a250;};'use strict';var util=require('util');var _=require(_0x1644('0x0'));var moment=require('moment');function checkNameSurname(_0x4b1446,_0x275484,_0x3f75f2){var _0x501ee0='';if(!_[_0x1644('0x1')](_0x275484)&&'string'===typeof _0x275484){_0x501ee0+=_0x275484;}if(!_[_0x1644('0x1')](_0x3f75f2)&&_0x1644('0x2')===typeof _0x3f75f2){_0x501ee0+='\x20'+_0x3f75f2;}if(_0x501ee0!==''){return _0x501ee0;}return _0x4b1446;}function Action(_0x1d247a,_0x5e4643,_0x8ffd94){this[_0x1644('0x3')]=_0x1d247a;this[_0x1644('0x4')]=_0x8ffd94||undefined;this['name']=checkNameSurname(_0x5e4643['Contact'][_0x1644('0x5')],_0x5e4643[_0x1644('0x6')][_0x1644('0x7')],_0x5e4643[_0x1644('0x6')][_0x1644('0x8')]);this[_0x1644('0x9')]=_0x5e4643[_0x1644('0x5')];this['queue']=_0x1d247a[_0x1644('0xa')];this[_0x1644('0xb')]=_0x5e4643['active']||![];this[_0x1644('0xc')]=_0x1d247a['type'];this['dialQueueTimeout']=_0x1d247a['dialQueueTimeout']||0x3;this[_0x1644('0xd')]=_0x5e4643['scheduledat'];this[_0x1644('0xe')]=_0x5e4643[_0x1644('0xe')];this[_0x1644('0xf')]=_0x5e4643[_0x1644('0xf')];this[_0x1644('0x10')]=_0x5e4643[_0x1644('0x10')];this[_0x1644('0x11')]=_0x5e4643[_0x1644('0x11')];this[_0x1644('0x12')]=_0x5e4643[_0x1644('0x12')];this[_0x1644('0x13')]=_0x5e4643['countabandonedretry'];this[_0x1644('0x14')]=_0x5e4643['countmachineretry'];this[_0x1644('0x15')]=_0x5e4643[_0x1644('0x15')];this[_0x1644('0x16')]=_0x5e4643['ContactId'];this[_0x1644('0x17')]=_0x5e4643['ListId'];this[_0x1644('0x18')]=_0x5e4643[_0x1644('0x18')];this[_0x1644('0x19')]=_0x5e4643[_0x1644('0x19')];this[_0x1644('0x1a')]=_0x5e4643['CampaignId'];this[_0x1644('0x1b')]=_0x5e4643['id'];this['ContactFirstName']=_0x5e4643[_0x1644('0x6')][_0x1644('0x7')]||'';this[_0x1644('0x1c')]=moment()['format'](_0x1644('0x1d'));this[_0x1644('0x1e')]=_0x5e4643[_0x1644('0x1e')];this[_0x1644('0x1f')]=_0x5e4643[_0x1644('0x1f')];this['callbackat']=_0x5e4643[_0x1644('0x20')];this[_0x1644('0x21')]=_0x5e4643[_0x1644('0x21')];this[_0x1644('0x22')]='';this[_0x1644('0x23')]='';}Action[_0x1644('0x24')]['getCaller']=function(){return util[_0x1644('0x25')](_0x1644('0x26'),this[_0x1644('0xa')],this[_0x1644('0x3')][_0x1644('0x27')]>0x0?this[_0x1644('0x9')]['substring'](this[_0x1644('0x3')][_0x1644('0x27')]):this[_0x1644('0x9')]);};Action[_0x1644('0x24')][_0x1644('0x28')]=function(){return this['queue'];};module[_0x1644('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 54294df..13fbff3 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x524a=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','starttime','responsetime','answertime','endtime'];(function(_0x169dae,_0x431b6e){var _0x1a5a64=function(_0x48f4cc){while(--_0x48f4cc){_0x169dae['push'](_0x169dae['shift']());}};_0x1a5a64(++_0x431b6e);}(_0x524a,0x175));var _0xa524=function(_0x58ff0b,_0xb2df0b){_0x58ff0b=_0x58ff0b-0x0;var _0x22e874=_0x524a[_0x58ff0b];return _0x22e874;};'use strict';var moment=require(_0xa524('0x0'));var utils=require(_0xa524('0x1'));function AgentComplete(_0x5a826c,_0x4be990){this[_0xa524('0x2')]=0x4;this[_0xa524('0x3')]='Answer';this['scheduledat']=_0x5a826c[_0xa524('0x4')];this[_0xa524('0x5')]=_0x5a826c['type'];this[_0xa524('0x6')]=_0x5a826c[_0xa524('0x5')]===_0xa524('0x7')?'queue':_0x5a826c['type'];this[_0xa524('0x8')]=_0x5a826c['countbusyretry'];this[_0xa524('0x9')]=_0x5a826c[_0xa524('0x9')];this[_0xa524('0xa')]=_0x5a826c['countnoanswerretry'];this[_0xa524('0xb')]=_0x5a826c[_0xa524('0x8')]+_0x5a826c[_0xa524('0x9')]+_0x5a826c[_0xa524('0xa')]+_0x5a826c['countnosuchnumberretry']+_0x5a826c[_0xa524('0xc')]+_0x5a826c[_0xa524('0xd')]+_0x5a826c[_0xa524('0xe')]+_0x5a826c[_0xa524('0xf')];this['countnosuchnumberretry']=_0x5a826c[_0xa524('0x10')];this[_0xa524('0xc')]=_0x5a826c[_0xa524('0xc')];this[_0xa524('0xd')]=_0x5a826c[_0xa524('0xd')];this[_0xa524('0xe')]=_0x5a826c[_0xa524('0xe')];this[_0xa524('0xf')]=_0x5a826c[_0xa524('0xf')];this[_0xa524('0x11')]=_0x4be990[_0xa524('0x11')];this['calleridname']=_0x5a826c['name'];this[_0xa524('0x12')]=_0x5a826c['number'];this[_0xa524('0x13')]=_0x5a826c[_0xa524('0x13')];this[_0xa524('0x14')]=_0x5a826c[_0xa524('0x14')];this['answertime']=_0x5a826c[_0xa524('0x15')];this[_0xa524('0x16')]=moment()[_0xa524('0x17')](_0xa524('0x18'));this[_0xa524('0x19')]=utils[_0xa524('0x1a')](_0x5a826c[_0xa524('0x14')],_0x5a826c[_0xa524('0x13')]);this[_0xa524('0x1b')]=utils[_0xa524('0x1a')](_0x5a826c[_0xa524('0x15')],_0x5a826c['responsetime']);this[_0xa524('0x1c')]=utils['getSeconds'](this[_0xa524('0x16')],_0x5a826c['answertime']);this[_0xa524('0x1d')]=_0x4be990['queue'];this['membername']=_0x4be990[_0xa524('0x1e')];this[_0xa524('0x1f')]=_0x4be990['reason'];this[_0xa524('0x20')]=_0x5a826c[_0xa524('0x20')];this[_0xa524('0x21')]=_0x5a826c[_0xa524('0x21')];this[_0xa524('0x22')]=_0x5a826c[_0xa524('0x22')];this[_0xa524('0x23')]=_0x5a826c['recallme'];this['ContactId']=_0x5a826c[_0xa524('0x24')];this[_0xa524('0x25')]=_0x5a826c[_0xa524('0x25')];this[_0xa524('0x26')]=_0x5a826c['UserId'];this['VoiceQueueId']=_0x5a826c['VoiceQueueId'];this[_0xa524('0x27')]=_0x5a826c['CampaignId'];this[_0xa524('0x28')]=_0x5a826c['originatecalleridnum']||'';this[_0xa524('0x29')]=_0x5a826c['originatecalleridname']||'';this[_0xa524('0x2a')]=_0x5a826c[_0xa524('0x2a')];}module[_0xa524('0x2b')]=AgentComplete; \ No newline at end of file +var _0xeaf0=['countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x1fafcd,_0x40f8e1){var _0x5bf9ad=function(_0x55bf15){while(--_0x55bf15){_0x1fafcd['push'](_0x1fafcd['shift']());}};_0x5bf9ad(++_0x40f8e1);}(_0xeaf0,0x78));var _0x0eaf=function(_0x213675,_0x5a7c4b){_0x213675=_0x213675-0x0;var _0xac1aa=_0xeaf0[_0x213675];return _0xac1aa;};'use strict';var moment=require(_0x0eaf('0x0'));var utils=require(_0x0eaf('0x1'));function AgentComplete(_0x4e0d89,_0x61206b){this[_0x0eaf('0x2')]=0x4;this['statedesc']=_0x0eaf('0x3');this['scheduledat']=_0x4e0d89['scheduledat'];this['type']=_0x4e0d89['type'];this[_0x0eaf('0x4')]=_0x4e0d89[_0x0eaf('0x5')]===_0x0eaf('0x6')?_0x0eaf('0x7'):_0x4e0d89[_0x0eaf('0x5')];this[_0x0eaf('0x8')]=_0x4e0d89[_0x0eaf('0x8')];this[_0x0eaf('0x9')]=_0x4e0d89[_0x0eaf('0x9')];this[_0x0eaf('0xa')]=_0x4e0d89[_0x0eaf('0xa')];this[_0x0eaf('0xb')]=_0x4e0d89[_0x0eaf('0x8')]+_0x4e0d89[_0x0eaf('0x9')]+_0x4e0d89['countnoanswerretry']+_0x4e0d89['countnosuchnumberretry']+_0x4e0d89[_0x0eaf('0xc')]+_0x4e0d89[_0x0eaf('0xd')]+_0x4e0d89[_0x0eaf('0xe')]+_0x4e0d89['countagentrejectretry'];this[_0x0eaf('0xf')]=_0x4e0d89[_0x0eaf('0xf')];this[_0x0eaf('0xc')]=_0x4e0d89[_0x0eaf('0xc')];this['countabandonedretry']=_0x4e0d89[_0x0eaf('0xd')];this[_0x0eaf('0xe')]=_0x4e0d89['countmachineretry'];this[_0x0eaf('0x10')]=_0x4e0d89[_0x0eaf('0x10')];this[_0x0eaf('0x11')]=_0x61206b[_0x0eaf('0x11')];this['calleridname']=_0x4e0d89[_0x0eaf('0x12')];this[_0x0eaf('0x13')]=_0x4e0d89[_0x0eaf('0x14')];this[_0x0eaf('0x15')]=_0x4e0d89[_0x0eaf('0x15')];this[_0x0eaf('0x16')]=_0x4e0d89[_0x0eaf('0x16')];this[_0x0eaf('0x17')]=_0x4e0d89[_0x0eaf('0x17')];this['endtime']=moment()['format'](_0x0eaf('0x18'));this[_0x0eaf('0x19')]=utils['getSeconds'](_0x4e0d89[_0x0eaf('0x16')],_0x4e0d89[_0x0eaf('0x15')]);this[_0x0eaf('0x1a')]=utils[_0x0eaf('0x1b')](_0x4e0d89[_0x0eaf('0x17')],_0x4e0d89[_0x0eaf('0x16')]);this['talktime']=utils[_0x0eaf('0x1b')](this[_0x0eaf('0x1c')],_0x4e0d89[_0x0eaf('0x17')]);this['queue']=_0x61206b['queue'];this[_0x0eaf('0x1d')]=_0x61206b['membername'];this[_0x0eaf('0x1e')]=_0x61206b[_0x0eaf('0x1e')];this[_0x0eaf('0x1f')]=_0x4e0d89[_0x0eaf('0x1f')];this[_0x0eaf('0x20')]=_0x4e0d89['callbackuniqueid'];this[_0x0eaf('0x21')]=_0x4e0d89[_0x0eaf('0x21')];this['recallme']=_0x4e0d89[_0x0eaf('0x22')];this[_0x0eaf('0x23')]=_0x4e0d89[_0x0eaf('0x23')];this[_0x0eaf('0x24')]=_0x4e0d89[_0x0eaf('0x24')];this[_0x0eaf('0x25')]=_0x4e0d89[_0x0eaf('0x25')];this[_0x0eaf('0x26')]=_0x4e0d89[_0x0eaf('0x26')];this[_0x0eaf('0x27')]=_0x4e0d89[_0x0eaf('0x27')];this[_0x0eaf('0x28')]=_0x4e0d89[_0x0eaf('0x28')]||'';this['originatecalleridname']=_0x4e0d89[_0x0eaf('0x29')]||'';this[_0x0eaf('0x2a')]=_0x4e0d89['agiafterat'];}module[_0x0eaf('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 3e19672..f0759cc 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae84=['countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xae84,0x1bb));var _0x4ae8=function(_0x151d4f,_0x5cfe43){_0x151d4f=_0x151d4f-0x0;var _0x2a7f71=_0xae84[_0x151d4f];return _0x2a7f71;};'use strict';function Final(_0x35c76a){this['uniqueid']=_0x35c76a[_0x4ae8('0x0')];this[_0x4ae8('0x1')]=_0x35c76a[_0x4ae8('0x1')];this['type']=_0x35c76a[_0x4ae8('0x2')];this[_0x4ae8('0x3')]=_0x35c76a[_0x4ae8('0x2')]===_0x4ae8('0x4')?_0x4ae8('0x5'):_0x35c76a[_0x4ae8('0x2')];this[_0x4ae8('0x6')]=_0x35c76a[_0x4ae8('0x6')];this[_0x4ae8('0x7')]=_0x35c76a[_0x4ae8('0x7')];this[_0x4ae8('0x8')]=_0x35c76a[_0x4ae8('0x8')];this['countglobal']=_0x35c76a[_0x4ae8('0x6')]+_0x35c76a['countcongestionretry']+_0x35c76a[_0x4ae8('0x8')]+_0x35c76a[_0x4ae8('0x9')]+_0x35c76a[_0x4ae8('0xa')]+_0x35c76a[_0x4ae8('0xb')]+_0x35c76a[_0x4ae8('0xc')]+_0x35c76a[_0x4ae8('0xd')];this[_0x4ae8('0x9')]=_0x35c76a[_0x4ae8('0x9')];this[_0x4ae8('0xa')]=_0x35c76a[_0x4ae8('0xa')];this['countabandonedretry']=_0x35c76a['countabandonedretry'];this['countmachineretry']=_0x35c76a[_0x4ae8('0xc')];this[_0x4ae8('0xd')]=_0x35c76a[_0x4ae8('0xd')];this[_0x4ae8('0x5')]=_0x35c76a[_0x4ae8('0x5')];this[_0x4ae8('0xe')]=_0x35c76a[_0x4ae8('0xe')];this[_0x4ae8('0xf')]=_0x35c76a[_0x4ae8('0xf')];this['starttime']=_0x35c76a[_0x4ae8('0x10')];this[_0x4ae8('0x11')]=_0x35c76a[_0x4ae8('0x11')];this[_0x4ae8('0x12')]=_0x35c76a[_0x4ae8('0x11')];this[_0x4ae8('0x13')]=_0x35c76a['ringtime']||0x0;this['holdtime']=_0x35c76a[_0x4ae8('0x14')]||0x0;this[_0x4ae8('0x15')]=_0x35c76a['talktime']||0x0;this[_0x4ae8('0x16')]=_0x35c76a['callback'];this[_0x4ae8('0x17')]=_0x35c76a[_0x4ae8('0x17')];this[_0x4ae8('0x18')]=_0x35c76a[_0x4ae8('0x18')];this[_0x4ae8('0x19')]=_0x35c76a['recallme'];this[_0x4ae8('0x1a')]=_0x35c76a[_0x4ae8('0x1a')];this[_0x4ae8('0x1b')]=_0x35c76a[_0x4ae8('0x1b')];this[_0x4ae8('0x1c')]=_0x35c76a[_0x4ae8('0x1c')];this[_0x4ae8('0x1d')]=_0x35c76a['VoiceQueueId'];this[_0x4ae8('0x1e')]=_0x35c76a[_0x4ae8('0x1e')];this[_0x4ae8('0x1f')]=_0x35c76a[_0x4ae8('0x1f')]||'';this[_0x4ae8('0x20')]=_0x35c76a[_0x4ae8('0x20')]||'';this[_0x4ae8('0x21')]=_0x35c76a[_0x4ae8('0x21')];this[_0x4ae8('0x22')]=_0x35c76a[_0x4ae8('0x22')];}module['exports']=Final; \ No newline at end of file +var _0xf359=['state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x57166e,_0x4648bc){var _0x3379ea=function(_0x3eba79){while(--_0x3eba79){_0x57166e['push'](_0x57166e['shift']());}};_0x3379ea(++_0x4648bc);}(_0xf359,0x6e));var _0x9f35=function(_0xcf386d,_0x31306d){_0xcf386d=_0xcf386d-0x0;var _0x325c22=_0xf359[_0xcf386d];return _0x325c22;};'use strict';function Final(_0x659b62){this['uniqueid']=_0x659b62[_0x9f35('0x0')];this[_0x9f35('0x1')]=_0x659b62[_0x9f35('0x1')];this[_0x9f35('0x2')]=_0x659b62['type'];this[_0x9f35('0x3')]=_0x659b62[_0x9f35('0x2')]===_0x9f35('0x4')?'queue':_0x659b62[_0x9f35('0x2')];this[_0x9f35('0x5')]=_0x659b62[_0x9f35('0x5')];this[_0x9f35('0x6')]=_0x659b62['countcongestionretry'];this[_0x9f35('0x7')]=_0x659b62[_0x9f35('0x7')];this[_0x9f35('0x8')]=_0x659b62['countbusyretry']+_0x659b62[_0x9f35('0x6')]+_0x659b62[_0x9f35('0x7')]+_0x659b62[_0x9f35('0x9')]+_0x659b62[_0x9f35('0xa')]+_0x659b62[_0x9f35('0xb')]+_0x659b62[_0x9f35('0xc')]+_0x659b62[_0x9f35('0xd')];this[_0x9f35('0x9')]=_0x659b62[_0x9f35('0x9')];this[_0x9f35('0xa')]=_0x659b62[_0x9f35('0xa')];this[_0x9f35('0xb')]=_0x659b62[_0x9f35('0xb')];this[_0x9f35('0xc')]=_0x659b62[_0x9f35('0xc')];this[_0x9f35('0xd')]=_0x659b62[_0x9f35('0xd')];this[_0x9f35('0xe')]=_0x659b62[_0x9f35('0xe')];this['calleridname']=_0x659b62[_0x9f35('0xf')];this[_0x9f35('0x10')]=_0x659b62['calleridnum'];this[_0x9f35('0x11')]=_0x659b62[_0x9f35('0x11')];this[_0x9f35('0x12')]=_0x659b62[_0x9f35('0x12')];this[_0x9f35('0x13')]=_0x659b62[_0x9f35('0x12')];this[_0x9f35('0x14')]=_0x659b62['ringtime']||0x0;this[_0x9f35('0x15')]=_0x659b62[_0x9f35('0x15')]||0x0;this[_0x9f35('0x16')]=_0x659b62[_0x9f35('0x16')]||0x0;this[_0x9f35('0x17')]=_0x659b62['callback'];this[_0x9f35('0x18')]=_0x659b62[_0x9f35('0x18')];this[_0x9f35('0x19')]=_0x659b62['callbackat'];this[_0x9f35('0x1a')]=_0x659b62[_0x9f35('0x1a')];this['ContactId']=_0x659b62[_0x9f35('0x1b')];this[_0x9f35('0x1c')]=_0x659b62[_0x9f35('0x1c')];this[_0x9f35('0x1d')]=_0x659b62[_0x9f35('0x1d')];this[_0x9f35('0x1e')]=_0x659b62[_0x9f35('0x1e')];this['CampaignId']=_0x659b62[_0x9f35('0x1f')];this[_0x9f35('0x20')]=_0x659b62[_0x9f35('0x20')]||'';this[_0x9f35('0x21')]=_0x659b62['originatecalleridname']||'';this[_0x9f35('0x22')]=_0x659b62[_0x9f35('0x22')];this['statedesc']=_0x659b62[_0x9f35('0x23')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 89b6cf8..00057db 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x542f=['format','ringtime','getSeconds','IVR','reason','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x542f,0xd9));var _0xf542=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x542f[_0x34c553];return _0x1357d2;};'use strict';var moment=require(_0xf542('0x0'));var utils=require(_0xf542('0x1'));function Hangup(_0x29c819,_0x15d8fe){this['state']=0x4;this['statedesc']='Answer';this[_0xf542('0x2')]=_0x29c819[_0xf542('0x2')];this[_0xf542('0x3')]=_0x29c819['type'];this['campaigntype']=_0x29c819[_0xf542('0x3')]==='outbound'?_0xf542('0x4'):_0x29c819[_0xf542('0x3')];this[_0xf542('0x5')]=_0x29c819[_0xf542('0x5')]||![];this[_0xf542('0x6')]=_0x29c819[_0xf542('0x6')];this[_0xf542('0x7')]=_0x29c819[_0xf542('0x7')];this[_0xf542('0x8')]=_0x29c819['countnoanswerretry'];this['countglobal']=_0x29c819[_0xf542('0x6')]+_0x29c819[_0xf542('0x7')]+_0x29c819[_0xf542('0x8')]+_0x29c819[_0xf542('0x9')]+_0x29c819[_0xf542('0xa')]+_0x29c819[_0xf542('0xb')]+_0x29c819[_0xf542('0xc')]+_0x29c819[_0xf542('0xd')];this['countnosuchnumberretry']=_0x29c819[_0xf542('0x9')];this[_0xf542('0xa')]=_0x29c819[_0xf542('0xa')];this['countabandonedretry']=_0x29c819[_0xf542('0xb')];this[_0xf542('0xc')]=_0x29c819[_0xf542('0xc')];this[_0xf542('0xd')]=_0x29c819[_0xf542('0xd')];this[_0xf542('0xe')]=_0x15d8fe[_0xf542('0xe')];this['calleridname']=_0x29c819[_0xf542('0xf')];this[_0xf542('0x10')]=_0x29c819[_0xf542('0x11')];this[_0xf542('0x12')]=_0x29c819[_0xf542('0x12')];this[_0xf542('0x13')]=_0x29c819[_0xf542('0x13')];this[_0xf542('0x14')]=moment()[_0xf542('0x15')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf542('0x16')]=utils[_0xf542('0x17')](_0x29c819['responsetime'],_0x29c819[_0xf542('0x12')]);this['holdtime']=0x0;this['talktime']=utils['getSeconds'](this[_0xf542('0x14')],_0x29c819[_0xf542('0x13')]);this['queue']=_0x29c819['queue'];this['membername']=_0xf542('0x18');this[_0xf542('0x19')]=_0x15d8fe['cause-txt'];this['callback']=_0x29c819['callback'];this[_0xf542('0x1a')]=_0x29c819[_0xf542('0x1a')];this[_0xf542('0x1b')]=_0x29c819[_0xf542('0x1b')];this[_0xf542('0x1c')]=_0x29c819[_0xf542('0x1c')];this[_0xf542('0x1d')]=_0x29c819[_0xf542('0x1d')];this['ListId']=_0x29c819['ListId'];this[_0xf542('0x1e')]=_0x29c819['UserId'];this[_0xf542('0x1f')]=_0x29c819[_0xf542('0x1f')];this[_0xf542('0x20')]=_0x29c819['CampaignId'];}module[_0xf542('0x21')]=Hangup; \ No newline at end of file +var _0x68bf=['cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countglobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','membername','reason'];(function(_0x5f138e,_0x2b7bed){var _0x59f282=function(_0x5ad928){while(--_0x5ad928){_0x5f138e['push'](_0x5f138e['shift']());}};_0x59f282(++_0x2b7bed);}(_0x68bf,0x1a3));var _0xf68b=function(_0x51c94d,_0x2abfb4){_0x51c94d=_0x51c94d-0x0;var _0x447824=_0x68bf[_0x51c94d];return _0x447824;};'use strict';var moment=require(_0xf68b('0x0'));var utils=require(_0xf68b('0x1'));function Hangup(_0x4b8402,_0x2f7afc){this['state']=0x4;this[_0xf68b('0x2')]=_0xf68b('0x3');this[_0xf68b('0x4')]=_0x4b8402['scheduledat'];this[_0xf68b('0x5')]=_0x4b8402[_0xf68b('0x5')];this['campaigntype']=_0x4b8402[_0xf68b('0x5')]===_0xf68b('0x6')?_0xf68b('0x7'):_0x4b8402['type'];this[_0xf68b('0x8')]=_0x4b8402[_0xf68b('0x8')]||![];this[_0xf68b('0x9')]=_0x4b8402[_0xf68b('0x9')];this['countcongestionretry']=_0x4b8402['countcongestionretry'];this['countnoanswerretry']=_0x4b8402['countnoanswerretry'];this[_0xf68b('0xa')]=_0x4b8402['countbusyretry']+_0x4b8402[_0xf68b('0xb')]+_0x4b8402[_0xf68b('0xc')]+_0x4b8402[_0xf68b('0xd')]+_0x4b8402['countdropretry']+_0x4b8402[_0xf68b('0xe')]+_0x4b8402['countmachineretry']+_0x4b8402[_0xf68b('0xf')];this[_0xf68b('0xd')]=_0x4b8402[_0xf68b('0xd')];this[_0xf68b('0x10')]=_0x4b8402['countdropretry'];this[_0xf68b('0xe')]=_0x4b8402[_0xf68b('0xe')];this['countmachineretry']=_0x4b8402[_0xf68b('0x11')];this[_0xf68b('0xf')]=_0x4b8402[_0xf68b('0xf')];this[_0xf68b('0x12')]=_0x2f7afc[_0xf68b('0x12')];this[_0xf68b('0x13')]=_0x4b8402[_0xf68b('0x14')];this[_0xf68b('0x15')]=_0x4b8402['number'];this[_0xf68b('0x16')]=_0x4b8402['starttime'];this[_0xf68b('0x17')]=_0x4b8402[_0xf68b('0x17')];this[_0xf68b('0x18')]=moment()[_0xf68b('0x19')](_0xf68b('0x1a'));this[_0xf68b('0x1b')]=utils['getSeconds'](_0x4b8402[_0xf68b('0x17')],_0x4b8402['starttime']);this[_0xf68b('0x1c')]=0x0;this['talktime']=utils[_0xf68b('0x1d')](this[_0xf68b('0x18')],_0x4b8402[_0xf68b('0x17')]);this[_0xf68b('0x7')]=_0x4b8402['queue'];this[_0xf68b('0x1e')]='IVR';this[_0xf68b('0x1f')]=_0x2f7afc[_0xf68b('0x20')];this[_0xf68b('0x21')]=_0x4b8402[_0xf68b('0x21')];this[_0xf68b('0x22')]=_0x4b8402[_0xf68b('0x22')];this[_0xf68b('0x23')]=_0x4b8402[_0xf68b('0x23')];this[_0xf68b('0x24')]=_0x4b8402[_0xf68b('0x24')];this['ContactId']=_0x4b8402['ContactId'];this[_0xf68b('0x25')]=_0x4b8402[_0xf68b('0x25')];this[_0xf68b('0x26')]=_0x4b8402[_0xf68b('0x26')];this[_0xf68b('0x27')]=_0x4b8402[_0xf68b('0x27')];this[_0xf68b('0x28')]=_0x4b8402[_0xf68b('0x28')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index cbbf9f9..e74f147 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba89=['talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x911bf0,_0x32a9dd){var _0x2bf35b=function(_0x5d4957){while(--_0x5d4957){_0x911bf0['push'](_0x911bf0['shift']());}};_0x2bf35b(++_0x32a9dd);}(_0xba89,0x1a5));var _0x9ba8=function(_0x48291a,_0x5a29dc){_0x48291a=_0x48291a-0x0;var _0xf76871=_0xba89[_0x48291a];return _0xf76871;};'use strict';var utils=require(_0x9ba8('0x0'));function History(_0x40a086){this[_0x9ba8('0x1')]=_0x40a086[_0x9ba8('0x1')];this[_0x9ba8('0x2')]=_0x40a086[_0x9ba8('0x2')]||undefined;this[_0x9ba8('0x3')]=_0x40a086[_0x9ba8('0x3')];this['campaigntype']=_0x40a086[_0x9ba8('0x3')]===_0x9ba8('0x4')?'queue':_0x40a086[_0x9ba8('0x3')];this['countbusyretry']=_0x40a086['countbusyretry'];this['countcongestionretry']=_0x40a086[_0x9ba8('0x5')];this['countnoanswerretry']=_0x40a086[_0x9ba8('0x6')];this[_0x9ba8('0x7')]=_0x40a086[_0x9ba8('0x8')]+_0x40a086['countcongestionretry']+_0x40a086[_0x9ba8('0x6')]+_0x40a086[_0x9ba8('0x9')]+_0x40a086[_0x9ba8('0xa')]+_0x40a086[_0x9ba8('0xb')]+_0x40a086[_0x9ba8('0xc')]+_0x40a086[_0x9ba8('0xd')];this['countnosuchnumberretry']=_0x40a086[_0x9ba8('0x9')];this['countdropretry']=_0x40a086[_0x9ba8('0xa')];this[_0x9ba8('0xb')]=_0x40a086[_0x9ba8('0xb')];this[_0x9ba8('0xc')]=_0x40a086['countmachineretry'];this[_0x9ba8('0xd')]=_0x40a086['countagentrejectretry'];this[_0x9ba8('0xe')]=_0x40a086[_0x9ba8('0xe')];this['calleridname']=_0x40a086[_0x9ba8('0xf')];this[_0x9ba8('0x10')]=_0x40a086[_0x9ba8('0x11')];this['starttime']=_0x40a086[_0x9ba8('0x12')];this[_0x9ba8('0x13')]=_0x40a086['responsetime'];this[_0x9ba8('0x14')]=_0x40a086['responsetime'];this[_0x9ba8('0x15')]=utils['getSeconds'](_0x40a086[_0x9ba8('0x13')],_0x40a086[_0x9ba8('0x12')]);this[_0x9ba8('0x16')]=0x0;this[_0x9ba8('0x17')]=0x0;this[_0x9ba8('0x18')]=_0x40a086[_0x9ba8('0x18')];this['callbackuniqueid']=_0x40a086['callbackuniqueid'];this['callbackat']=_0x40a086[_0x9ba8('0x19')];this[_0x9ba8('0x1a')]=_0x40a086['recallme'];this[_0x9ba8('0x1b')]=_0x40a086['ContactId'];this[_0x9ba8('0x1c')]=_0x40a086[_0x9ba8('0x1c')];this['UserId']=_0x40a086[_0x9ba8('0x1d')];this[_0x9ba8('0x1e')]=_0x40a086[_0x9ba8('0x1e')];this[_0x9ba8('0x1f')]=_0x40a086['CampaignId'];this[_0x9ba8('0x20')]=_0x40a086[_0x9ba8('0x20')]||'';this[_0x9ba8('0x21')]=_0x40a086[_0x9ba8('0x21')]||'';this['state']=_0x40a086[_0x9ba8('0x22')];this['statedesc']=_0x40a086[_0x9ba8('0x23')];}module[_0x9ba8('0x24')]=History; \ No newline at end of file +var _0xc35b=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','queue','calleridname','calleridnum','number','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','scheduledat','type','outbound','countbusyretry'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0xc35b,0xa5));var _0xbc35=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xc35b[_0x257642];return _0x3d813b;};'use strict';var utils=require(_0xbc35('0x0'));function History(_0xd7eafe){this['uniqueid']=_0xd7eafe['uniqueid'];this[_0xbc35('0x1')]=_0xd7eafe['scheduledat']||undefined;this[_0xbc35('0x2')]=_0xd7eafe['type'];this['campaigntype']=_0xd7eafe[_0xbc35('0x2')]===_0xbc35('0x3')?'queue':_0xd7eafe['type'];this[_0xbc35('0x4')]=_0xd7eafe[_0xbc35('0x4')];this[_0xbc35('0x5')]=_0xd7eafe['countcongestionretry'];this[_0xbc35('0x6')]=_0xd7eafe['countnoanswerretry'];this[_0xbc35('0x7')]=_0xd7eafe[_0xbc35('0x4')]+_0xd7eafe[_0xbc35('0x5')]+_0xd7eafe[_0xbc35('0x6')]+_0xd7eafe[_0xbc35('0x8')]+_0xd7eafe['countdropretry']+_0xd7eafe[_0xbc35('0x9')]+_0xd7eafe['countmachineretry']+_0xd7eafe[_0xbc35('0xa')];this[_0xbc35('0x8')]=_0xd7eafe['countnosuchnumberretry'];this[_0xbc35('0xb')]=_0xd7eafe[_0xbc35('0xb')];this[_0xbc35('0x9')]=_0xd7eafe[_0xbc35('0x9')];this[_0xbc35('0xc')]=_0xd7eafe[_0xbc35('0xc')];this[_0xbc35('0xa')]=_0xd7eafe[_0xbc35('0xa')];this[_0xbc35('0xd')]=_0xd7eafe[_0xbc35('0xd')];this[_0xbc35('0xe')]=_0xd7eafe['name'];this[_0xbc35('0xf')]=_0xd7eafe[_0xbc35('0x10')];this[_0xbc35('0x11')]=_0xd7eafe[_0xbc35('0x11')];this['responsetime']=_0xd7eafe[_0xbc35('0x12')];this['endtime']=_0xd7eafe[_0xbc35('0x12')];this[_0xbc35('0x13')]=utils['getSeconds'](_0xd7eafe[_0xbc35('0x12')],_0xd7eafe[_0xbc35('0x11')]);this['holdtime']=0x0;this[_0xbc35('0x14')]=0x0;this[_0xbc35('0x15')]=_0xd7eafe[_0xbc35('0x15')];this[_0xbc35('0x16')]=_0xd7eafe[_0xbc35('0x16')];this[_0xbc35('0x17')]=_0xd7eafe[_0xbc35('0x17')];this[_0xbc35('0x18')]=_0xd7eafe[_0xbc35('0x18')];this[_0xbc35('0x19')]=_0xd7eafe[_0xbc35('0x19')];this[_0xbc35('0x1a')]=_0xd7eafe[_0xbc35('0x1a')];this[_0xbc35('0x1b')]=_0xd7eafe[_0xbc35('0x1b')];this[_0xbc35('0x1c')]=_0xd7eafe['VoiceQueueId'];this[_0xbc35('0x1d')]=_0xd7eafe[_0xbc35('0x1d')];this[_0xbc35('0x1e')]=_0xd7eafe[_0xbc35('0x1e')]||'';this['originatecalleridname']=_0xd7eafe['originatecalleridname']||'';this[_0xbc35('0x1f')]=_0xd7eafe['state'];this['statedesc']=_0xd7eafe[_0xbc35('0x20')];}module[_0xbc35('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 028ee6d..6a2a46d 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83b8=['callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','queue','membername','reason'];(function(_0x594fa6,_0x192b70){var _0x3617cd=function(_0x53f178){while(--_0x53f178){_0x594fa6['push'](_0x594fa6['shift']());}};_0x3617cd(++_0x192b70);}(_0x83b8,0x83));var _0x883b=function(_0x368c5c,_0x3fa1e0){_0x368c5c=_0x368c5c-0x0;var _0x1cf62f=_0x83b8[_0x368c5c];return _0x1cf62f;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x284af2,_0x467643){this['scheduledat']=_0x284af2['scheduledat'];this[_0x883b('0x0')]=_0x284af2[_0x883b('0x0')];this[_0x883b('0x1')]=_0x284af2['type']===_0x883b('0x2')?'queue':_0x284af2[_0x883b('0x0')];this[_0x883b('0x3')]=_0x284af2[_0x883b('0x3')];this['countcongestionretry']=_0x284af2['countcongestionretry'];this[_0x883b('0x4')]=_0x284af2['countnoanswerretry'];this[_0x883b('0x5')]=_0x284af2[_0x883b('0x3')]+_0x284af2[_0x883b('0x6')]+_0x284af2[_0x883b('0x4')]+_0x284af2[_0x883b('0x7')]+_0x284af2[_0x883b('0x8')]+_0x284af2[_0x883b('0x9')]+_0x284af2[_0x883b('0xa')]+_0x284af2[_0x883b('0xb')];this[_0x883b('0x7')]=_0x284af2[_0x883b('0x7')];this[_0x883b('0x8')]=_0x284af2[_0x883b('0x8')];this[_0x883b('0x9')]=_0x284af2[_0x883b('0x9')];this[_0x883b('0xa')]=_0x284af2['countmachineretry'];this[_0x883b('0xb')]=_0x284af2[_0x883b('0xb')];this[_0x883b('0xc')]=_0x467643['uniqueid'];this['calleridname']=_0x284af2['name'];this[_0x883b('0xd')]=_0x284af2['number'];this[_0x883b('0xe')]=_0x284af2[_0x883b('0xe')];this[_0x883b('0xf')]=_0x284af2[_0x883b('0xf')];this[_0x883b('0x10')]=_0x284af2[_0x883b('0x10')];this[_0x883b('0x11')]=_0x284af2[_0x883b('0x11')];this[_0x883b('0x12')]=this[_0x883b('0x10')];this['ringtime']=utils[_0x883b('0x13')](_0x284af2[_0x883b('0xf')],_0x284af2['starttime']);this[_0x883b('0x14')]=utils[_0x883b('0x13')](this['droptime'],_0x284af2[_0x883b('0xf')]);this[_0x883b('0x15')]=0x0;this[_0x883b('0x16')]=_0x467643['queue'];this[_0x883b('0x17')]=_0x467643['connectedlinename'];this[_0x883b('0x18')]=_0x467643[_0x883b('0x18')];this[_0x883b('0x19')]=_0x284af2['callback'];this[_0x883b('0x1a')]=_0x284af2[_0x883b('0x1a')];this[_0x883b('0x1b')]=_0x284af2[_0x883b('0x1b')];this['recallme']=_0x284af2['recallme'];this['ContactId']=_0x284af2[_0x883b('0x1c')];this[_0x883b('0x1d')]=_0x284af2[_0x883b('0x1d')];this[_0x883b('0x1e')]=_0x284af2['UserId'];this[_0x883b('0x1f')]=_0x284af2[_0x883b('0x1f')];this[_0x883b('0x20')]=_0x284af2['CampaignId'];this[_0x883b('0x21')]=_0x284af2[_0x883b('0x21')]||'';this['originatecalleridname']=_0x284af2[_0x883b('0x22')]||'';this[_0x883b('0x23')]=_0x284af2[_0x883b('0x23')];this[_0x883b('0x24')]=_0x284af2[_0x883b('0x24')];this['statedesc']=_0x284af2[_0x883b('0x25')];}module[_0x883b('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x8979=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid'];(function(_0x4e4436,_0x15df65){var _0x16ec51=function(_0x176ce6){while(--_0x176ce6){_0x4e4436['push'](_0x4e4436['shift']());}};_0x16ec51(++_0x15df65);}(_0x8979,0x1f0));var _0x9897=function(_0x22cf02,_0x2c402d){_0x22cf02=_0x22cf02-0x0;var _0x9cd603=_0x8979[_0x22cf02];return _0x9cd603;};'use strict';var utils=require(_0x9897('0x0'));function QueueCallerAbandon(_0x327ecf,_0x4931ac){this['scheduledat']=_0x327ecf['scheduledat'];this['type']=_0x327ecf['type'];this[_0x9897('0x1')]=_0x327ecf[_0x9897('0x2')]===_0x9897('0x3')?_0x9897('0x4'):_0x327ecf['type'];this[_0x9897('0x5')]=_0x327ecf['countbusyretry'];this[_0x9897('0x6')]=_0x327ecf['countcongestionretry'];this[_0x9897('0x7')]=_0x327ecf[_0x9897('0x7')];this['countglobal']=_0x327ecf['countbusyretry']+_0x327ecf[_0x9897('0x6')]+_0x327ecf['countnoanswerretry']+_0x327ecf[_0x9897('0x8')]+_0x327ecf[_0x9897('0x9')]+_0x327ecf[_0x9897('0xa')]+_0x327ecf[_0x9897('0xb')]+_0x327ecf[_0x9897('0xc')];this['countnosuchnumberretry']=_0x327ecf['countnosuchnumberretry'];this[_0x9897('0x9')]=_0x327ecf[_0x9897('0x9')];this[_0x9897('0xa')]=_0x327ecf['countabandonedretry'];this[_0x9897('0xb')]=_0x327ecf[_0x9897('0xb')];this[_0x9897('0xc')]=_0x327ecf['countagentrejectretry'];this[_0x9897('0xd')]=_0x4931ac[_0x9897('0xd')];this[_0x9897('0xe')]=_0x327ecf[_0x9897('0xf')];this[_0x9897('0x10')]=_0x327ecf[_0x9897('0x11')];this['starttime']=_0x327ecf[_0x9897('0x12')];this[_0x9897('0x13')]=_0x327ecf[_0x9897('0x13')];this[_0x9897('0x14')]=_0x327ecf[_0x9897('0x14')];this['dropreason']=_0x327ecf[_0x9897('0x15')];this[_0x9897('0x16')]=this['droptime'];this[_0x9897('0x17')]=utils['getSeconds'](_0x327ecf[_0x9897('0x13')],_0x327ecf[_0x9897('0x12')]);this[_0x9897('0x18')]=utils[_0x9897('0x19')](this[_0x9897('0x14')],_0x327ecf[_0x9897('0x13')]);this[_0x9897('0x1a')]=0x0;this[_0x9897('0x4')]=_0x4931ac['queue'];this[_0x9897('0x1b')]=_0x4931ac[_0x9897('0x1c')];this['reason']=_0x4931ac[_0x9897('0x1d')];this[_0x9897('0x1e')]=_0x327ecf[_0x9897('0x1e')];this[_0x9897('0x1f')]=_0x327ecf['callbackuniqueid'];this[_0x9897('0x20')]=_0x327ecf[_0x9897('0x20')];this[_0x9897('0x21')]=_0x327ecf[_0x9897('0x21')];this[_0x9897('0x22')]=_0x327ecf[_0x9897('0x22')];this[_0x9897('0x23')]=_0x327ecf['ListId'];this[_0x9897('0x24')]=_0x327ecf[_0x9897('0x24')];this[_0x9897('0x25')]=_0x327ecf[_0x9897('0x25')];this[_0x9897('0x26')]=_0x327ecf[_0x9897('0x26')];this[_0x9897('0x27')]=_0x327ecf[_0x9897('0x27')]||'';this[_0x9897('0x28')]=_0x327ecf[_0x9897('0x28')]||'';this[_0x9897('0x29')]=_0x327ecf[_0x9897('0x29')];this[_0x9897('0x2a')]=_0x327ecf[_0x9897('0x2a')];this[_0x9897('0x2b')]=_0x327ecf[_0x9897('0x2b')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 919a323..4d5cdc1 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0xe9671c,_0x39a719){var _0x6cdd6c=function(_0x120603){while(--_0x120603){_0xe9671c['push'](_0xe9671c['shift']());}};_0x6cdd6c(++_0x39a719);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xa9e0=['catch','temp','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt'];(function(_0x2bfd52,_0x5b5aa3){var _0x22875d=function(_0x13ccdc){while(--_0x13ccdc){_0x2bfd52['push'](_0x2bfd52['shift']());}};_0x22875d(++_0x5b5aa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0a9e('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x333808){return util[_0x0a9e('0x4')](_0x333808,{'showHidden':![],'depth':null});}function getContactDialer(_0x2ab90b,_0x991246,_0x981158){return cmHopper['getContactDialer'](_0x2ab90b['id'],_0x991246,_0x981158,_0x2ab90b[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x2cc193){_0x2ab90b['temp']-=_0x981158;if(_0x2ab90b['temp']<0x0){_0x2ab90b[_0x0a9e('0x7')]=0x0;}logger['error']('[getContactDialer]',inspectError(_0x2cc193));});}exports[_0x0a9e('0x8')]=getContactDialer;function getContactDialerIvr(_0xf81284,_0x307b3e){return cmHopper[_0x0a9e('0x9')](_0xf81284['id'],_0x307b3e,_0xf81284[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x4a4c56){_0xf81284['temp']-=_0x307b3e;if(_0xf81284['temp']<0x0){_0xf81284['temp']=0x0;}logger[_0x0a9e('0xa')](_0x0a9e('0xb'),inspectError(_0x4a4c56));});}exports[_0x0a9e('0x9')]=getContactDialerIvr;function countReScheduled(_0x26d672){return cmHopper[_0x0a9e('0xc')](_0x26d672)[_0x0a9e('0x6')](function(_0x5db4b0){logger[_0x0a9e('0xa')](_0x0a9e('0xd'),inspectError(_0x5db4b0));});}exports[_0x0a9e('0xc')]=countReScheduled;function rescheduleContact(_0x281129){return cmHopper[_0x0a9e('0xe')](_0x281129)[_0x0a9e('0x6')](function(_0x52a03d){logger[_0x0a9e('0xa')]('[rescheduleContact]',inspectError(_0x52a03d));});}exports[_0x0a9e('0xe')]=rescheduleContact;function unlockContact(_0x519dfd,_0x16033c,_0x12066b){return cmHopper['unlockContact'](_0x519dfd,_0x16033c,_0x12066b)[_0x0a9e('0x6')](function(_0x5a0a06){logger[_0x0a9e('0xa')](_0x0a9e('0xf'),inspectError(_0x5a0a06));});}exports[_0x0a9e('0x10')]=unlockContact;function moveContactManagedDialer(_0x205fd6){return cmHopper[_0x0a9e('0x11')](_0x205fd6)[_0x0a9e('0x6')](function(_0x530eb7){logger[_0x0a9e('0xa')](_0x0a9e('0x12'),inspectError(_0x530eb7));});}exports[_0x0a9e('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1c696a){return cmHopperBlack[_0x0a9e('0x13')](_0x1c696a)['catch'](function(_0x2c3407){logger[_0x0a9e('0xa')]('[checkIsBlackList]',inspectError(_0x2c3407));});}exports[_0x0a9e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5a09ef){return cmHopperBlack['checkIsBlackListIvr'](_0x5a09ef)[_0x0a9e('0x6')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x14'),inspectError(_0x432e56));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return cmHopperAdditionalPhone[_0x0a9e('0x15')](_0xfb6e48,_0x2fb0e4,_0x3b45bc)[_0x0a9e('0x6')](function(_0x42ac8f){logger[_0x0a9e('0xa')]('[verifyAdditionalPhone]',inspectError(_0x42ac8f));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x197ec0,_0x3a8e58,_0x40c424){return cmHopperAdditionalPhone[_0x0a9e('0x16')](_0x197ec0,_0x3a8e58,_0x40c424)['catch'](function(_0x384319){logger['error'](_0x0a9e('0x17'),inspectError(_0x384319));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1dc186){return cmHopperHistory[_0x0a9e('0x18')](_0x1dc186)[_0x0a9e('0x6')](function(_0x14433c){logger[_0x0a9e('0xa')](_0x0a9e('0x19'),inspectError(_0x14433c));});}exports[_0x0a9e('0x18')]=avgHandleTime;function createHistory(_0x14de77){return cmHopperHistory['createHistory'](_0x14de77)[_0x0a9e('0x6')](function(_0x468813){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),inspectError(_0x468813));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index b16fa77..5b1d4c0 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3e6=['loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Intervals','isEmpty','Interval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','dialer','../../../../config/environment/shared','timezones','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn'];(function(_0x5c747d,_0x2ca282){var _0x47267f=function(_0x584f6d){while(--_0x584f6d){_0x5c747d['push'](_0x5c747d['shift']());}};_0x47267f(++_0x2ca282);}(_0xd3e6,0x1e0));var _0x6d3e=function(_0x2fec32,_0x4c2c42){_0x2fec32=_0x2fec32-0x0;var _0xdfd76e=_0xd3e6[_0x2fec32];return _0xdfd76e;};'use strict';var _=require(_0x6d3e('0x0'));var moment=require(_0x6d3e('0x1'));var util=require(_0x6d3e('0x2'));var logger=require('../../../../config/logger')(_0x6d3e('0x3'));var timezones=require(_0x6d3e('0x4'))[_0x6d3e('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x6d3e('0x6'),'DEACTIVATED':_0x6d3e('0x7'),'DISACTIVED':_0x6d3e('0x8'),'EMPTY_INTERVAL':_0x6d3e('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x6d3e('0xa'),'NO_AVAILABLE_CONTACTS':_0x6d3e('0xb'),'NULL_INTERVAL':_0x6d3e('0xc'),'OVERTIME_INTERVAL':_0x6d3e('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x6d3e('0xe'),'QUEUE_RECALL':_0x6d3e('0xf'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x6d3e('0x10'),'UNKNOWN_TIMEZONE':_0x6d3e('0x11'),'UNREACHABLE_TRUNK':_0x6d3e('0x12')};exports[_0x6d3e('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x350ff3){return _0x350ff3[_0x6d3e('0x14')]===_0x6d3e('0x15');}exports[_0x6d3e('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x54701f){return _0x54701f[_0x6d3e('0x17')]===_0x6d3e('0x18');}exports[_0x6d3e('0x19')]=isIVRCampaign;function isOutboundQueue(_0x44d34d){return _0x44d34d[_0x6d3e('0x17')]==='outbound';}exports[_0x6d3e('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x1bc874){return _0x1bc874[_0x6d3e('0x1b')];}exports[_0x6d3e('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x253696){return _0x253696[_0x6d3e('0x1d')];}exports[_0x6d3e('0x1e')]=isIVRCampaignActive;function getSeconds(_0x89439c,_0x34baa8){var _0x1532e3=moment(_0x89439c)['milliseconds'](0x0);var _0xfdfa34=moment(_0x34baa8)[_0x6d3e('0x1f')](0x0);return _0x1532e3['diff'](_0xfdfa34,_0x6d3e('0x20'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x52c8d9,_0x4adf04){var _0x23070f=![];var _0x12fe0e=_0x52c8d9[_0x6d3e('0x14')]!==_0x4adf04[_0x6d3e('0x14')]||_0x52c8d9[_0x6d3e('0x1b')]!==_0x4adf04[_0x6d3e('0x1b')]||_0x52c8d9[_0x6d3e('0x21')]!==_0x4adf04[_0x6d3e('0x21')];var _0x50df28=_0x52c8d9[_0x6d3e('0x22')]!==_0x4adf04[_0x6d3e('0x22')]||_0x52c8d9[_0x6d3e('0x23')]!==_0x4adf04[_0x6d3e('0x23')]||_0x52c8d9['loggedInDb']!==_0x4adf04[_0x6d3e('0x24')]||_0x52c8d9['paused']!==_0x4adf04[_0x6d3e('0x25')]||_0x52c8d9[_0x6d3e('0x26')]!==_0x4adf04[_0x6d3e('0x26')]||_0x52c8d9[_0x6d3e('0x27')]!==_0x4adf04['pTalking']||_0x52c8d9[_0x6d3e('0x28')]!==_0x4adf04[_0x6d3e('0x28')]||_0x52c8d9[_0x6d3e('0x29')]!==_0x4adf04[_0x6d3e('0x29')]||_0x52c8d9[_0x6d3e('0x2a')]!==_0x4adf04[_0x6d3e('0x2a')];if(_0x52c8d9[_0x6d3e('0x2b')]&&_0x4adf04[_0x6d3e('0x2b')]){_0x23070f=_0x52c8d9['Trunk']['name']!==_0x4adf04[_0x6d3e('0x2b')][_0x6d3e('0x2c')]||_0x52c8d9[_0x6d3e('0x2b')][_0x6d3e('0x1d')]!==_0x4adf04[_0x6d3e('0x2b')][_0x6d3e('0x1d')];}return _0x12fe0e||_0x50df28||_0x23070f;}exports[_0x6d3e('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2b2dc9){var _0x541422=null;var _0x2c717d=_0x2b2dc9[_0x6d3e('0x2e')];if(_[_0x6d3e('0x2f')](_0x2b2dc9[_0x6d3e('0x30')])||_['isNil'](_0x2b2dc9['Interval'])||_[_0x6d3e('0x2f')](_0x2b2dc9['Interval'][_0x6d3e('0x31')])){_0x541422=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x6d3e('0x32')](_0x2b2dc9['dialGlobalInterval'])||_[_0x6d3e('0x32')](_0x2b2dc9[_0x6d3e('0x33')]['Intervals'])){_0x541422=CAMPAIGN_STATUS[_0x6d3e('0x34')];}else if(_0x2c717d&&!timezones[_0x2c717d]){_0x541422=CAMPAIGN_STATUS[_0x6d3e('0x35')];}return _0x541422;}function checkAnyValidTrunk(_0x416d56,_0x303243){var _0x2cad7b=null;var _0xfdabde=_0x6d3e('0x36');var _0x1274b5=[_0x6d3e('0x37'),_0x6d3e('0x38')];var _0x3bd8af=!![];if(_0x416d56['Trunk']&&_0x416d56[_0x6d3e('0x2b')][_0x6d3e('0x1d')]){_0xfdabde+=_0x416d56[_0x6d3e('0x2b')][_0x6d3e('0x2c')];_0x2cad7b=_0x303243[_0xfdabde];_0x3bd8af=_0x1274b5[_0x6d3e('0x39')](_0x2cad7b[_0x6d3e('0x3a')]);}else if(_0x416d56[_0x6d3e('0x3b')]&&_0x416d56[_0x6d3e('0x3b')][_0x6d3e('0x1d')]){_0xfdabde+=_0x416d56[_0x6d3e('0x3b')][_0x6d3e('0x2c')];_0x2cad7b=_0x303243[_0xfdabde];_0x3bd8af=_0x1274b5[_0x6d3e('0x39')](_0x2cad7b[_0x6d3e('0x3a')]);}return _0x3bd8af;}function getQueueCampaignStatusMessage(_0x725825,_0x401d5a){var _0xadb346=CAMPAIGN_STATUS[_0x6d3e('0x3c')];var _0x13bd78=isPreviewCampaign(_0x725825);if(!isQueueCampaignActive(_0x725825)){if(_0x13bd78){_0xadb346=CAMPAIGN_STATUS[_0x6d3e('0x3d')];}else{if(_0x725825['originated']===0x0&&_0x725825[_0x6d3e('0x26')]===0x0&&_0x725825[_0x6d3e('0x28')]===0x0&&(_0x725825['pTalking']||0x0)===0x0){_0xadb346=CAMPAIGN_STATUS[_0x6d3e('0x3d')];}else{_0xadb346=CAMPAIGN_STATUS[_0x6d3e('0x3e')];}}}else if(_0x725825[_0x6d3e('0x23')]===0x0){_0xadb346=CAMPAIGN_STATUS[_0x6d3e('0x3f')];}else if(!checkAnyValidTrunk(_0x725825,_0x401d5a)){_0xadb346=CAMPAIGN_STATUS[_0x6d3e('0x40')];}else if(!isPreviewCampaign(_0x725825)){var _0x5bc3de=checkAnyValidQueueCampaignInterval(_0x725825);if(_0x5bc3de){_0xadb346=_0x5bc3de;}}return _0xadb346;}exports[_0x6d3e('0x41')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x219703){var _0x5da731=CAMPAIGN_STATUS[_0x6d3e('0x3e')];if(_0x219703[_0x6d3e('0x2a')]===0x0&&_0x219703[_0x6d3e('0x26')]===0x0&&_0x219703[_0x6d3e('0x28')]===0x0&&(_0x219703[_0x6d3e('0x27')]||0x0)===0x0){_0x5da731=CAMPAIGN_STATUS[_0x6d3e('0x3d')];}return _0x5da731;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2ba3ed){var _0xec299=_0x2ba3ed[_0x6d3e('0x42')](/"(.*?)"/);return _0xec299?_0xec299[0x1]:_0x2ba3ed;}exports[_0x6d3e('0x43')]=extractCalleridName;function getCallerId(_0x40bb72,_0x5dddae,_0x3c7225){if(!_['isUndefined'](_0x3c7225)&&typeof _0x3c7225===_0x6d3e('0x44')&&!_[_0x6d3e('0x32')](_0x3c7225)){if(!_[_0x6d3e('0x45')](_0x5dddae)&&typeof _0x5dddae===_0x6d3e('0x44')&&!_[_0x6d3e('0x32')](_0x5dddae)){return util[_0x6d3e('0x46')](_0x6d3e('0x47'),_0x5dddae,_0x3c7225);}return util[_0x6d3e('0x46')](_0x6d3e('0x47'),_0x3c7225,_0x3c7225);}if(!_[_0x6d3e('0x45')](_0x40bb72)&&typeof _0x40bb72===_0x6d3e('0x44')&&!_[_0x6d3e('0x32')](_0x40bb72)){return _0x40bb72;}return _0x6d3e('0x48');}exports[_0x6d3e('0x49')]=getCallerId;function getCallerIdRandom(_0x149d96,_0x310f42){var _0x1925c5;var _0x647948;var _0x32aec6;if(_0x310f42<=0x0){_0x310f42=0x1;}_0x1925c5=new RegExp(_0x6d3e('0x4a')+_0x310f42+'}$');_0x647948=Math[_0x6d3e('0x4b')](0xa,_0x310f42-0x1);_0x32aec6=Math[_0x6d3e('0x4b')](0xa,_0x310f42)-0x1;return util['format']('%s',_['replace'](_0x149d96,_0x1925c5,_[_0x6d3e('0x4c')](_0x647948,_0x32aec6)[_0x6d3e('0x4d')]()));}exports[_0x6d3e('0x4e')]=getCallerIdRandom;function decrementOriginate(_0xdb6ab9){if(_0xdb6ab9[_0x6d3e('0x2a')]&&_0xdb6ab9['originated']>0x0){_0xdb6ab9['originated']-=0x1;}else{logger[_0x6d3e('0x4f')](_0x6d3e('0x50'));}}exports[_0x6d3e('0x51')]=decrementOriginate;function checkContactEmpty(_0x4baf5b){return _0x4baf5b&&_0x4baf5b[_0x6d3e('0x52')]>0x0;}exports[_0x6d3e('0x53')]=checkContactEmpty;function erlangb(_0x3399b8,_0x3b4f97){if(_0x3b4f97===0x0){return 0x0;}var _0x4dc9e2=0x1;for(var _0x2912fe=0x1;_0x2912fe<=_0x3b4f97;_0x2912fe+=0x1){_0x4dc9e2=0x1+_0x4dc9e2*_0x2912fe/_0x3399b8;}return 0x1/_0x4dc9e2;}exports[_0x6d3e('0x54')]=erlangb;function checkContactLowerLimitOriginate(_0x5c94d1,_0x29f5e9,_0x470d43){if(_0x29f5e9>_0x470d43){for(var _0x59f8e9=0x0;_0x59f8e9<_0x29f5e9-_0x470d43;_0x59f8e9+=0x1){decrementOriginate(_0x5c94d1);}}}exports[_0x6d3e('0x55')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x5edc=['waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','Interval','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','erlangb','checkContactLowerLimitOriginate','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','loggedIn','loggedInDb','paused','talking','pTalking'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x5edc,0x10f));var _0xc5ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5edc[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xc5ed('0x0'));var util=require(_0xc5ed('0x1'));var logger=require('../../../../config/logger')(_0xc5ed('0x2'));var timezones=require(_0xc5ed('0x3'))[_0xc5ed('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xc5ed('0x5'),'BLACKLIST':_0xc5ed('0x6'),'CONTACTS_RESCHEDULED':_0xc5ed('0x7'),'DEACTIVATED':_0xc5ed('0x8'),'DISACTIVED':_0xc5ed('0x9'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xc5ed('0xa'),'NO_AGENTS_LOGGED':_0xc5ed('0xb'),'NO_AVAILABLE_CONTACTS':_0xc5ed('0xc'),'NULL_INTERVAL':_0xc5ed('0xd'),'OVERTIME_INTERVAL':_0xc5ed('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0xc5ed('0xf'),'QUEUE_RECALL':_0xc5ed('0x10'),'RECALL_TIMEOUT':_0xc5ed('0x11'),'RUNNING':_0xc5ed('0x12'),'UNKNOWN_TIMEZONE':_0xc5ed('0x13'),'UNREACHABLE_TRUNK':_0xc5ed('0x14')};exports[_0xc5ed('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x49599e){return _0x49599e[_0xc5ed('0x16')]===_0xc5ed('0x17');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0xc8b3c7){return _0xc8b3c7[_0xc5ed('0x18')]===_0xc5ed('0x19');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x7268){return _0x7268[_0xc5ed('0x18')]===_0xc5ed('0x1a');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x1fac77){return _0x1fac77[_0xc5ed('0x1b')];}exports[_0xc5ed('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x42f77a){return _0x42f77a[_0xc5ed('0x1d')];}exports[_0xc5ed('0x1e')]=isIVRCampaignActive;function getSeconds(_0x259a34,_0x2ffd9e){var _0x4c0f73=moment(_0x259a34)['milliseconds'](0x0);var _0x5bec3b=moment(_0x2ffd9e)[_0xc5ed('0x1f')](0x0);return _0x4c0f73[_0xc5ed('0x20')](_0x5bec3b,_0xc5ed('0x21'));}exports[_0xc5ed('0x22')]=getSeconds;function hasQueueCampaignDataChanged(_0x11576d,_0x4abf6c){var _0x1e136c=![];var _0x351811=_0x11576d[_0xc5ed('0x16')]!==_0x4abf6c[_0xc5ed('0x16')]||_0x11576d['dialActive']!==_0x4abf6c['dialActive']||_0x11576d[_0xc5ed('0x23')]!==_0x4abf6c[_0xc5ed('0x23')];var _0x3537fe=_0x11576d['available']!==_0x4abf6c['available']||_0x11576d['loggedIn']!==_0x4abf6c[_0xc5ed('0x24')]||_0x11576d['loggedInDb']!==_0x4abf6c[_0xc5ed('0x25')]||_0x11576d['paused']!==_0x4abf6c[_0xc5ed('0x26')]||_0x11576d[_0xc5ed('0x27')]!==_0x4abf6c[_0xc5ed('0x27')]||_0x11576d[_0xc5ed('0x28')]!==_0x4abf6c[_0xc5ed('0x28')]||_0x11576d[_0xc5ed('0x29')]!==_0x4abf6c[_0xc5ed('0x29')]||_0x11576d[_0xc5ed('0x2a')]!==_0x4abf6c['inUse']||_0x11576d[_0xc5ed('0x2b')]!==_0x4abf6c[_0xc5ed('0x2b')];if(_0x11576d[_0xc5ed('0x2c')]&&_0x4abf6c[_0xc5ed('0x2c')]){_0x1e136c=_0x11576d[_0xc5ed('0x2c')]['name']!==_0x4abf6c[_0xc5ed('0x2c')][_0xc5ed('0x2d')]||_0x11576d[_0xc5ed('0x2c')]['active']!==_0x4abf6c[_0xc5ed('0x2c')][_0xc5ed('0x1d')];}return _0x351811||_0x3537fe||_0x1e136c;}exports[_0xc5ed('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2a7bfb){var _0xa60bb4=null;var _0x5cd057=_0x2a7bfb['dialTimezone'];if(_['isNil'](_0x2a7bfb['dialGlobalInterval'])||_[_0xc5ed('0x2f')](_0x2a7bfb['Interval'])||_[_0xc5ed('0x2f')](_0x2a7bfb[_0xc5ed('0x30')]['Intervals'])){_0xa60bb4=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xc5ed('0x31')](_0x2a7bfb[_0xc5ed('0x32')])||_['isEmpty'](_0x2a7bfb[_0xc5ed('0x30')]['Intervals'])){_0xa60bb4=CAMPAIGN_STATUS[_0xc5ed('0x33')];}else if(_0x5cd057&&!timezones[_0x5cd057]){_0xa60bb4=CAMPAIGN_STATUS[_0xc5ed('0x34')];}return _0xa60bb4;}function checkAnyValidTrunk(_0x2b32f2,_0x31add6){var _0x59f1aa=null;var _0x1e537c=_0xc5ed('0x35');var _0x5bae3d=['reachable',_0xc5ed('0x36')];var _0x2fb6eb=!![];if(_0x2b32f2[_0xc5ed('0x2c')]&&_0x2b32f2[_0xc5ed('0x2c')]['active']){_0x1e537c+=_0x2b32f2[_0xc5ed('0x2c')]['name'];_0x59f1aa=_0x31add6[_0x1e537c];_0x2fb6eb=_0x5bae3d['includes'](_0x59f1aa[_0xc5ed('0x37')]);}else if(_0x2b32f2[_0xc5ed('0x38')]&&_0x2b32f2['TrunkBackup'][_0xc5ed('0x1d')]){_0x1e537c+=_0x2b32f2[_0xc5ed('0x38')][_0xc5ed('0x2d')];_0x59f1aa=_0x31add6[_0x1e537c];_0x2fb6eb=_0x5bae3d[_0xc5ed('0x39')](_0x59f1aa[_0xc5ed('0x37')]);}return _0x2fb6eb;}function getQueueCampaignStatusMessage(_0x1d3f44,_0x58b246){var _0x222188=CAMPAIGN_STATUS['ACTIVE'];var _0x5645cd=isPreviewCampaign(_0x1d3f44);if(!isQueueCampaignActive(_0x1d3f44)){if(_0x5645cd){_0x222188=CAMPAIGN_STATUS[_0xc5ed('0x3a')];}else{if(_0x1d3f44[_0xc5ed('0x2b')]===0x0&&_0x1d3f44[_0xc5ed('0x27')]===0x0&&_0x1d3f44[_0xc5ed('0x29')]===0x0&&(_0x1d3f44[_0xc5ed('0x28')]||0x0)===0x0){_0x222188=CAMPAIGN_STATUS[_0xc5ed('0x3a')];}else{_0x222188=CAMPAIGN_STATUS[_0xc5ed('0x3b')];}}}else if(_0x1d3f44[_0xc5ed('0x24')]===0x0){_0x222188=CAMPAIGN_STATUS[_0xc5ed('0x3c')];}else if(!checkAnyValidTrunk(_0x1d3f44,_0x58b246)){_0x222188=CAMPAIGN_STATUS[_0xc5ed('0x3d')];}else if(!isPreviewCampaign(_0x1d3f44)){var _0x60e6a=checkAnyValidQueueCampaignInterval(_0x1d3f44);if(_0x60e6a){_0x222188=_0x60e6a;}}return _0x222188;}exports[_0xc5ed('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1f4793){var _0x1ee0cb=CAMPAIGN_STATUS[_0xc5ed('0x3b')];if(_0x1f4793[_0xc5ed('0x2b')]===0x0&&_0x1f4793[_0xc5ed('0x27')]===0x0&&_0x1f4793[_0xc5ed('0x29')]===0x0&&(_0x1f4793[_0xc5ed('0x28')]||0x0)===0x0){_0x1ee0cb=CAMPAIGN_STATUS[_0xc5ed('0x3a')];}return _0x1ee0cb;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x220eb2){var _0x4b670d=_0x220eb2[_0xc5ed('0x3f')](/"(.*?)"/);return _0x4b670d?_0x4b670d[0x1]:_0x220eb2;}exports[_0xc5ed('0x40')]=extractCalleridName;function getCallerId(_0x2f1b63,_0x35841f,_0x22d88b){if(!_['isUndefined'](_0x22d88b)&&typeof _0x22d88b===_0xc5ed('0x41')&&!_[_0xc5ed('0x31')](_0x22d88b)){if(!_[_0xc5ed('0x42')](_0x35841f)&&typeof _0x35841f==='string'&&!_[_0xc5ed('0x31')](_0x35841f)){return util[_0xc5ed('0x43')](_0xc5ed('0x44'),_0x35841f,_0x22d88b);}return util[_0xc5ed('0x43')]('\x22%s\x22\x20<%s>',_0x22d88b,_0x22d88b);}if(!_[_0xc5ed('0x42')](_0x2f1b63)&&typeof _0x2f1b63===_0xc5ed('0x41')&&!_[_0xc5ed('0x31')](_0x2f1b63)){return _0x2f1b63;}return _0xc5ed('0x45');}exports[_0xc5ed('0x46')]=getCallerId;function getCallerIdRandom(_0x2ccf3d,_0x459d82){var _0xfb771e;var _0x3c409c;var _0x18aa2d;if(_0x459d82<=0x0){_0x459d82=0x1;}_0xfb771e=new RegExp('\x5cw{0,'+_0x459d82+'}$');_0x3c409c=Math[_0xc5ed('0x47')](0xa,_0x459d82-0x1);_0x18aa2d=Math[_0xc5ed('0x47')](0xa,_0x459d82)-0x1;return util[_0xc5ed('0x43')]('%s',_['replace'](_0x2ccf3d,_0xfb771e,_[_0xc5ed('0x48')](_0x3c409c,_0x18aa2d)[_0xc5ed('0x49')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x80bb31){if(_0x80bb31['originated']&&_0x80bb31[_0xc5ed('0x2b')]>0x0){_0x80bb31['originated']-=0x1;}else{logger[_0xc5ed('0x4a')](_0xc5ed('0x4b'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x4635d9){return _0x4635d9&&_0x4635d9['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x28d2f4,_0x21f977){if(_0x21f977===0x0){return 0x0;}var _0x1eb4fc=0x1;for(var _0x2ccc97=0x1;_0x2ccc97<=_0x21f977;_0x2ccc97+=0x1){_0x1eb4fc=0x1+_0x1eb4fc*_0x2ccc97/_0x28d2f4;}return 0x1/_0x1eb4fc;}exports[_0xc5ed('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x531e6f,_0x21845f,_0x569024){if(_0x21845f>_0x569024){for(var _0x13adcf=0x0;_0x13adcf<_0x21845f-_0x569024;_0x13adcf+=0x1){decrementOriginate(_0x531e6f);}}}exports[_0xc5ed('0x4d')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1cd0f9c..b6cc347 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x2fd543,_0x1ca908){var _0x516981=function(_0x3f98d0){while(--_0x3f98d0){_0x2fd543['push'](_0x2fd543['shift']());}};_0x516981(++_0x1ca908);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5a60ad,_0x1d0ba3){var _0x2286f1=function(_0x4085b6){while(--_0x4085b6){_0x5a60ad['push'](_0x5a60ad['shift']());}};_0x2286f1(++_0x1d0ba3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 7157c1d..55974ed 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x791a=['./action','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','\x20syncNewchannel\x20','info','syncVarSet','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','message','create','parse','name','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','tiff2pdf','../ami','./rpcDb','./channel'];(function(_0x30add1,_0x142015){var _0xb0a9d0=function(_0x576370){while(--_0x576370){_0x30add1['push'](_0x30add1['shift']());}};_0xb0a9d0(++_0x142015);}(_0x791a,0x6e));var _0xa791=function(_0x1139eb,_0x37ac09){_0x1139eb=_0x1139eb-0x0;var _0x4509bd=_0x791a[_0x1139eb];return _0x4509bd;};'use strict';var util=require(_0xa791('0x0'));var _=require('lodash');var BPromise=require(_0xa791('0x1'));var uuid=require(_0xa791('0x2'));var moment=require(_0xa791('0x3'));var path=require('path');var tiff2pdf=require(_0xa791('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')('fax');var ami=require(_0xa791('0x5'));var rpcDb=require(_0xa791('0x6'));var Channel=require(_0xa791('0x7'));var ut=require('./util/util');var Action=require(_0xa791('0x8'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xa791('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5f23e5){this[_0xa791('0xa')]={};this[_0xa791('0xb')]=_0x5f23e5[_0xa791('0xb')];this[_0xa791('0xc')]=_0x5f23e5[_0xa791('0xc')];this[_0xa791('0xd')]={};ami['on'](_0xa791('0xe'),this[_0xa791('0xf')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0xa791('0x10')](this));ami['on']('newstate',this['syncNewState'][_0xa791('0x10')](this));ami['on'](_0xa791('0x11'),this['syncNewExten'][_0xa791('0x10')](this));ami['on']('faxstatus',this[_0xa791('0x12')][_0xa791('0x10')](this));ami['on'](_0xa791('0x13'),this[_0xa791('0x14')][_0xa791('0x10')](this));ami['on'](_0xa791('0x15'),this[_0xa791('0x16')][_0xa791('0x10')](this));ami['on'](_0xa791('0x17'),this[_0xa791('0x18')]['bind'](this));}Fax[_0xa791('0x19')]['syncNewchannel']=function(_0x5f958f){if(_0x5f958f[_0xa791('0x1a')]===_0xa791('0x1b')){for(var _0x628e68 in this[_0xa791('0xb')]){if(this[_0xa791('0xb')][_0xa791('0x1c')](_0x628e68)){if(_0x5f958f[_0xa791('0x1d')]===this[_0xa791('0xb')][_0x628e68][_0xa791('0x1e')]){this['channels'][_0x5f958f[_0xa791('0x1f')]]={};this[_0xa791('0xa')][_0x5f958f[_0xa791('0x1f')]][_0xa791('0x20')]=_0x5f958f['channel'];this[_0xa791('0xa')][_0x5f958f[_0xa791('0x1f')]]['id']=this[_0xa791('0xb')][_0x628e68]['id'];this[_0xa791('0xa')][_0x5f958f[_0xa791('0x1f')]]['name']=this[_0xa791('0xb')][_0x628e68]['name'];logger['info'](_0x5f958f[_0xa791('0x1f')],_0xa791('0x21'));}}}}if(this[_0xa791('0xd')][_0x5f958f[_0xa791('0x1f')]]){this['channels'][_0x5f958f['uniqueid']]={};this['channels'][_0x5f958f[_0xa791('0x1f')]][_0xa791('0x20')]=_0x5f958f[_0xa791('0x20')];logger[_0xa791('0x22')](_0x5f958f['uniqueid'],_0xa791('0x21'));}};Fax[_0xa791('0x19')][_0xa791('0x23')]=function(_0x501f10){if(this[_0xa791('0xa')][_0x501f10[_0xa791('0x1f')]]){for(var _0x2378dd in _0x501f10[_0xa791('0x24')]){if(_0x501f10[_0xa791('0x24')][_0xa791('0x1c')](_0x2378dd)){this['channels'][_0x501f10[_0xa791('0x1f')]][_0x2378dd]=_0x501f10[_0xa791('0x25')];}}}};Fax[_0xa791('0x19')][_0xa791('0x26')]=function(_0x1e694a){if(this[_0xa791('0xa')][_0x1e694a['uniqueid']]){this[_0xa791('0xa')][_0x1e694a[_0xa791('0x1f')]][_0xa791('0x27')]=_0x1e694a[_0xa791('0x27')];this[_0xa791('0xa')][_0x1e694a[_0xa791('0x1f')]][_0xa791('0x28')]=_0x1e694a[_0xa791('0x28')];}};Fax[_0xa791('0x19')][_0xa791('0x29')]=function(_0x384d21){if(this['channels'][_0x384d21[_0xa791('0x1f')]]){for(var _0x279c35 in _0x384d21[_0xa791('0x24')]){if(_0x384d21[_0xa791('0x24')][_0xa791('0x1c')](_0x279c35)){this[_0xa791('0xa')][_0x384d21['uniqueid']][_0x279c35]=_0x384d21[_0xa791('0x25')];}}}};Fax[_0xa791('0x19')]['syncFaxStatus']=function(_0x1c1945){if(this[_0xa791('0xa')][_0x1c1945[_0xa791('0x1f')]]){this[_0xa791('0xa')][_0x1c1945[_0xa791('0x1f')]][_0xa791('0x2a')]=_0x1c1945[_0xa791('0x2a')];this[_0xa791('0xa')][_0x1c1945[_0xa791('0x1f')]][_0xa791('0x2b')]=_0x1c1945[_0xa791('0x2b')];this[_0xa791('0xa')][_0x1c1945[_0xa791('0x1f')]][_0xa791('0x1e')]=_0x1c1945[_0xa791('0x1e')];this['channels'][_0x1c1945[_0xa791('0x1f')]][_0xa791('0x2c')]=_0x1c1945[_0xa791('0x2c')];logger[_0xa791('0x22')](_0x1c1945[_0xa791('0x1f')],'\x20syncFaxStatus\x20');}};Fax[_0xa791('0x19')]['syncReceiveFax']=function(_0x5bd018){var _0x320041=this;if(this[_0xa791('0xa')][_0x5bd018[_0xa791('0x1f')]]){var _0x31f062=this[_0xa791('0xa')][_0x5bd018['uniqueid']]['id'];this[_0xa791('0xa')][_0x5bd018[_0xa791('0x1f')]][_0xa791('0x2d')]=_0x5bd018[_0xa791('0x2d')];this[_0xa791('0xa')][_0x5bd018[_0xa791('0x1f')]][_0xa791('0x2e')]=_0x5bd018[_0xa791('0x2e')];this[_0xa791('0xa')][_0x5bd018[_0xa791('0x1f')]][_0xa791('0x1e')]=_0x5bd018['localstationid'];this[_0xa791('0xa')][_0x5bd018[_0xa791('0x1f')]][_0xa791('0x2f')]=_0x5bd018['resolution'];this[_0xa791('0xa')][_0x5bd018[_0xa791('0x1f')]][_0xa791('0x30')]=_0x5bd018[_0xa791('0x30')];this[_0xa791('0xa')][_0x5bd018[_0xa791('0x1f')]]['filename']=_0x5bd018[_0xa791('0x2c')];this['channels'][_0x5bd018[_0xa791('0x1f')]]['calleridnum']=_0x5bd018['calleridnum'];if(this[_0xa791('0xa')][_0x5bd018['uniqueid']][_0xa791('0x2e')]>0x0){tiff2pdf(_0x5bd018[_0xa791('0x2c')],_0xa791('0x31'),function(_0x42d3c3){logger[_0xa791('0x22')](_0x5bd018[_0xa791('0x1f')],'\x20result\x20conversion\x20file\x20',_0x42d3c3[_0xa791('0x32')]);attachment[_0xa791('0x33')]({'name':path[_0xa791('0x34')](_0x5bd018[_0xa791('0x2c')])[_0xa791('0x35')],'basename':path[_0xa791('0x34')](_0x5bd018[_0xa791('0x2c')])[_0xa791('0x35')]+'.pdf','type':_0xa791('0x36')})['then'](function(_0x10055a){faxAccount[_0xa791('0x37')](_0x31f062,{'from':_0x5bd018['calleridnum'],'mapKey':_0xa791('0x38'),'body':path[_0xa791('0x34')](_0x5bd018[_0xa791('0x2c')])[_0xa791('0x35')]+'.pdf','AttachmentId':_0x10055a['id']})[_0xa791('0x39')](function(_0xa58ef0){logger[_0xa791('0x3a')](_0x5bd018[_0xa791('0x1f')],_0xa791('0x3b'),JSON[_0xa791('0x3c')](_0xa58ef0));});})[_0xa791('0x39')](function(_0x16e914){logger['error'](_0x5bd018[_0xa791('0x1f')],_0xa791('0x3d'),JSON[_0xa791('0x3c')](_0x16e914));});});}logger[_0xa791('0x22')](_0x5bd018[_0xa791('0x1f')],'\x20receiveFax\x20');}};Fax['prototype'][_0xa791('0x18')]=function(_0x57d7b2){if(this[_0xa791('0xd')][_0x57d7b2[_0xa791('0x1f')]]){_[_0xa791('0x3e')](this[_0xa791('0xa')][_0x57d7b2['uniqueid']],_[_0xa791('0x3f')](_0x57d7b2,[_0xa791('0x40'),_0xa791('0x41')]));}};function updateStatus(_0x344410){if(_0x344410[_0xa791('0x42')]){faxMessage[_0xa791('0x43')](_0x344410[_0xa791('0x42')],{'failMessage':_0xa791('0x44')})[_0xa791('0x45')](function(_0x5204c5){ut['logger']('[Fax][Message][Error][Updated]',_0x5204c5);})[_0xa791('0x39')](function(_0x5542c2){ut[_0xa791('0x46')](_0xa791('0x47'),_0x5542c2);});}else{ut[_0xa791('0x46')](_0xa791('0x48'));}}Fax[_0xa791('0x19')][_0xa791('0x49')]=function(_0x14a222,_0x572311,_0x4f7063){var _0x25e614=this;var _0x4142d9={};if(_0x572311){_0x4142d9={'read':_0x572311};}else{_0x4142d9={'failMessage':_0x4f7063};}if(this[_0xa791('0xd')][_0x14a222][_0xa791('0x42')]){faxMessage[_0xa791('0x43')](this['actions'][_0x14a222][_0xa791('0x42')],_0x4142d9)[_0xa791('0x45')](function(_0x2abb36){ut[_0xa791('0x46')]('[Fax][Message][Updated]',_0x2abb36);})[_0xa791('0x39')](function(_0x165550){ut[_0xa791('0x46')](_0xa791('0x4a'),_0x165550);})['finally'](function(){delete _0x25e614[_0xa791('0xa')][_0x14a222];delete _0x25e614[_0xa791('0xd')][_0x14a222];});}else{ut[_0xa791('0x46')](_0xa791('0x4b'));delete this[_0xa791('0xa')][_0x14a222];delete this[_0xa791('0xd')][_0x14a222];}};Fax[_0xa791('0x19')]['syncHangup']=function(_0xb38520){var _0x2433a1=this;if(this[_0xa791('0xa')][_0xb38520[_0xa791('0x1f')]]){if(this['actions'][_0xb38520['uniqueid']]){this[_0xa791('0xa')][_0xb38520[_0xa791('0x1f')]]['id']=this[_0xa791('0xd')][_0xb38520[_0xa791('0x1f')]]['id'];this[_0xa791('0xa')][_0xb38520[_0xa791('0x1f')]][_0xa791('0x35')]=this[_0xa791('0xd')][_0xb38520[_0xa791('0x1f')]][_0xa791('0x35')];}logger['info'](_0xb38520[_0xa791('0x1f')],this[_0xa791('0xd')][_0xb38520[_0xa791('0x1f')]]?_0xa791('0x4c'):_0xa791('0x4d'),JSON['stringify'](this[_0xa791('0xa')][_0xb38520[_0xa791('0x1f')]]));if(this[_0xa791('0xd')][_0xb38520['uniqueid']]){if(this[_0xa791('0xa')][_0xb38520[_0xa791('0x1f')]][_0xa791('0x4e')]>0x0&&this[_0xa791('0xa')][_0xb38520[_0xa791('0x1f')]][_0xa791('0x4f')]===_0xa791('0x50')){this[_0xa791('0x49')](_0xb38520['uniqueid'],!![]);}else{this[_0xa791('0x49')](_0xb38520[_0xa791('0x1f')],![],this['channels'][_0xb38520['uniqueid']][_0xa791('0x51')]?_0xa791('0x52')+this[_0xa791('0xa')][_0xb38520[_0xa791('0x1f')]][_0xa791('0x51')]:_0xa791('0x53'));}}}};Fax[_0xa791('0x19')]['send']=function(_0x23bfa9){var _0x5263ae=this;return new BPromise(function(_0x2353c6,_0x56d806){_0x5263ae[_0xa791('0x54')](_0x23bfa9,_0x5263ae[_0xa791('0xb')][_0x23bfa9[_0xa791('0x55')]])['then'](function(_0x3290e1){ut[_0xa791('0x46')](_0xa791('0x56'),_0x3290e1);_0x2353c6(ut[_0xa791('0x32')]('Fax\x20received'));})[_0xa791('0x39')](function(_0x299e4b){ut[_0xa791('0x46')](_0xa791('0x57'),_0x299e4b);updateStatus(_0x23bfa9);_0x56d806(ut[_0xa791('0x32')](_0xa791('0x58')));});});};Fax[_0xa791('0x19')]['checkAfterSend']=function(_0xc68a0b){var _0x80ff74=this;return new BPromise(function(_0x144fd7,_0x15ec96){var _0x4ba765=_0x80ff74[_0xa791('0x59')](_0x80ff74[_0xa791('0xb')][_0xc68a0b[_0xa791('0x55')]][_0xa791('0x5a')],_0xc68a0b);if(_0x4ba765[_0xa791('0x5b')]){_0x144fd7(ut[_0xa791('0x32')]('Trunk\x20Reachable'));}else{_0x15ec96(ut[_0xa791('0x32')](_0x4ba765[_0xa791('0x32')]));}});};function originate(_0x2626d6,_0x24faf8,_0x49b44c){return new BPromise(function(_0x5cc29b,_0x5b4943){if(_0x49b44c){var _0x3c4f95=util[_0xa791('0x5c')](_0xa791('0x5d'),path[_0xa791('0x34')](_0x2626d6[_0xa791('0x5e')])[_0xa791('0x35')],_0x2626d6['path']);gs[_0xa791('0x5f')](_0x3c4f95)[_0xa791('0x45')](function(){_0x2626d6[_0xa791('0x5e')]=util[_0xa791('0x5c')](_0xa791('0x60'),path[_0xa791('0x34')](_0x2626d6[_0xa791('0x5e')])[_0xa791('0x61')],path['parse'](_0x2626d6[_0xa791('0x5e')])[_0xa791('0x35')]);_0x24faf8['XMF-PATH']=_0x2626d6[_0xa791('0x5e')];ut[_0xa791('0x46')](_0xa791('0x62'),'');ami[_0xa791('0x63')](ut[_0xa791('0x64')](_0x2626d6,_0x24faf8))[_0xa791('0x45')](function(_0x4c7788){_0x5cc29b(_0x4c7788);})[_0xa791('0x39')](function(_0xbc7307){_0x5b4943(_0xbc7307);});})[_0xa791('0x39')](function(_0x2f1ee3){_0x5b4943(_0x2f1ee3);});}else{ami[_0xa791('0x63')](ut[_0xa791('0x64')](_0x2626d6,_0x24faf8))['then'](function(_0x15b5ff){_0x5cc29b(_0x15b5ff);})['catch'](function(_0x4cca47){_0x5b4943(_0x4cca47);});}});}Fax[_0xa791('0x19')][_0xa791('0x54')]=function(_0x5283e8,_0x252911){var _0x2aec5a=this;return new BPromise(function(_0x20c701,_0x398787){var _0x360a17=uuid['v4']();var _0x4ef754=ut[_0xa791('0x65')](_0x5283e8,_0x252911);_0x2aec5a[_0xa791('0xd')][_0x360a17]=new Action(_0x360a17,_0x252911,_0x5283e8);var _0x590219=_0x2aec5a[_0xa791('0xd')][_0x360a17];if(path[_0xa791('0x34')](_0x5283e8[_0xa791('0x5e')])[_0xa791('0x66')]===_0xa791('0x67')){originate(_0x590219,_0x4ef754,!![])[_0xa791('0x45')](function(_0x109dcb){_0x20c701(_0x109dcb);})[_0xa791('0x39')](function(_0xd8889b){_0x398787(_0xd8889b);});}else{originate(_0x590219,_0x4ef754,![])['then'](function(_0x1d2287){_0x20c701(_0x1d2287);})[_0xa791('0x39')](function(_0x204d68){_0x398787(_0x204d68);});}});};Fax[_0xa791('0x19')]['isTrunkReachable']=function(_0x167cd3){return!_[_0xa791('0x68')](_0x167cd3)&&!_['isNil'](_0x167cd3['name'])&&!_['isNil'](_0x167cd3['active'])&&_0x167cd3[_0xa791('0x69')]&&!_['isNil'](this['trunks'][util[_0xa791('0x5c')](_0xa791('0x6a'),_0x167cd3[_0xa791('0x35')])])&&!_['isNil'](this[_0xa791('0xc')][util[_0xa791('0x5c')](_0xa791('0x6a'),_0x167cd3[_0xa791('0x35')])][_0xa791('0x2b')])&&(this[_0xa791('0xc')][util['format'](_0xa791('0x6a'),_0x167cd3[_0xa791('0x35')])][_0xa791('0x2b')]===_0xa791('0x6b')||this[_0xa791('0xc')][util['format'](_0xa791('0x6a'),_0x167cd3[_0xa791('0x35')])]['status']===_0xa791('0x6c'));};Fax[_0xa791('0x19')][_0xa791('0x59')]=function(_0x16d6da,_0x2fd520){if(!this[_0xa791('0x6d')](_0x16d6da)){ut[_0xa791('0x46')](_0xa791('0x6e'),_['isNil'](_0x16d6da)?'':_0x16d6da[_0xa791('0x35')]+_0xa791('0x6f'));return{'isValid':![],'message':_0xa791('0x70')};}if(_['isNil'](_0x2fd520['fax'])){ut['logger'](_0xa791('0x71'),JSON[_0xa791('0x3c')](_0x2fd520));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xa791('0x68')](_0x2fd520[_0xa791('0x5e')])){ut[_0xa791('0x46')](_0xa791('0x72'),JSON[_0xa791('0x3c')](_0x2fd520));return{'isValid':![],'message':_0xa791('0x73')};}return{'isValid':!![],'message':_0xa791('0x74')};};module[_0xa791('0x75')]=Fax; \ No newline at end of file +var _0x8abc=['channel','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','name','.pdf','application/pdf','notify','stringify','\x20receiveFax\x20','pick','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','message','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','fax','../ami','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','uniqueid'];(function(_0xaa212d,_0x2b8fda){var _0xef1d1a=function(_0x43063a){while(--_0x43063a){_0xaa212d['push'](_0xaa212d['shift']());}};_0xef1d1a(++_0x2b8fda);}(_0x8abc,0xc8));var _0xc8ab=function(_0x38553b,_0x1ee976){_0x38553b=_0x38553b-0x0;var _0x54d386=_0x8abc[_0x38553b];return _0x54d386;};'use strict';var util=require(_0xc8ab('0x0'));var _=require('lodash');var BPromise=require(_0xc8ab('0x1'));var uuid=require(_0xc8ab('0x2'));var moment=require(_0xc8ab('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xc8ab('0x4'));var ami=require(_0xc8ab('0x5'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xc8ab('0x6'));var Action=require('./action');var faxAccount=require(_0xc8ab('0x7'));var attachment=require(_0xc8ab('0x8'));var faxMessage=require(_0xc8ab('0x9'));function Fax(_0x1bbd57){this[_0xc8ab('0xa')]={};this[_0xc8ab('0xb')]=_0x1bbd57[_0xc8ab('0xb')];this[_0xc8ab('0xc')]=_0x1bbd57['trunks'];this['actions']={};ami['on'](_0xc8ab('0xd'),this[_0xc8ab('0xe')]['bind'](this));ami['on'](_0xc8ab('0xf'),this[_0xc8ab('0x10')][_0xc8ab('0x11')](this));ami['on'](_0xc8ab('0x12'),this[_0xc8ab('0x13')]['bind'](this));ami['on'](_0xc8ab('0x14'),this[_0xc8ab('0x15')][_0xc8ab('0x11')](this));ami['on']('faxstatus',this[_0xc8ab('0x16')][_0xc8ab('0x11')](this));ami['on'](_0xc8ab('0x17'),this[_0xc8ab('0x18')][_0xc8ab('0x11')](this));ami['on'](_0xc8ab('0x19'),this[_0xc8ab('0x1a')]['bind'](this));ami['on'](_0xc8ab('0x1b'),this[_0xc8ab('0x1c')][_0xc8ab('0x11')](this));}Fax[_0xc8ab('0x1d')][_0xc8ab('0xe')]=function(_0x139dd8){if(_0x139dd8[_0xc8ab('0x1e')]===_0xc8ab('0x1f')){for(var _0x569ff1 in this[_0xc8ab('0xb')]){if(this['faxAccounts'][_0xc8ab('0x20')](_0x569ff1)){if(_0x139dd8['exten']===this['faxAccounts'][_0x569ff1]['localstationid']){this[_0xc8ab('0xa')][_0x139dd8[_0xc8ab('0x21')]]={};this[_0xc8ab('0xa')][_0x139dd8[_0xc8ab('0x21')]]['channel']=_0x139dd8[_0xc8ab('0x22')];this[_0xc8ab('0xa')][_0x139dd8[_0xc8ab('0x21')]]['id']=this[_0xc8ab('0xb')][_0x569ff1]['id'];this[_0xc8ab('0xa')][_0x139dd8[_0xc8ab('0x21')]]['name']=this['faxAccounts'][_0x569ff1]['name'];logger[_0xc8ab('0x23')](_0x139dd8[_0xc8ab('0x21')],_0xc8ab('0x24'));}}}}if(this[_0xc8ab('0x25')][_0x139dd8[_0xc8ab('0x21')]]){this[_0xc8ab('0xa')][_0x139dd8[_0xc8ab('0x21')]]={};this[_0xc8ab('0xa')][_0x139dd8[_0xc8ab('0x21')]][_0xc8ab('0x22')]=_0x139dd8['channel'];logger[_0xc8ab('0x23')](_0x139dd8['uniqueid'],_0xc8ab('0x24'));}};Fax[_0xc8ab('0x1d')][_0xc8ab('0x10')]=function(_0x5d46c8){if(this[_0xc8ab('0xa')][_0x5d46c8[_0xc8ab('0x21')]]){for(var _0x12f8e6 in _0x5d46c8[_0xc8ab('0x26')]){if(_0x5d46c8[_0xc8ab('0x26')][_0xc8ab('0x20')](_0x12f8e6)){this['channels'][_0x5d46c8[_0xc8ab('0x21')]][_0x12f8e6]=_0x5d46c8[_0xc8ab('0x27')];}}}};Fax['prototype'][_0xc8ab('0x13')]=function(_0x59bab4){if(this['channels'][_0x59bab4[_0xc8ab('0x21')]]){this[_0xc8ab('0xa')][_0x59bab4['uniqueid']][_0xc8ab('0x28')]=_0x59bab4[_0xc8ab('0x28')];this[_0xc8ab('0xa')][_0x59bab4[_0xc8ab('0x21')]][_0xc8ab('0x29')]=_0x59bab4['channelstatedesc'];}};Fax[_0xc8ab('0x1d')]['syncNewExten']=function(_0x2b0ce0){if(this['channels'][_0x2b0ce0[_0xc8ab('0x21')]]){for(var _0x5b7757 in _0x2b0ce0[_0xc8ab('0x26')]){if(_0x2b0ce0['variable'][_0xc8ab('0x20')](_0x5b7757)){this[_0xc8ab('0xa')][_0x2b0ce0['uniqueid']][_0x5b7757]=_0x2b0ce0['value'];}}}};Fax[_0xc8ab('0x1d')][_0xc8ab('0x16')]=function(_0x22485b){if(this['channels'][_0x22485b[_0xc8ab('0x21')]]){this[_0xc8ab('0xa')][_0x22485b[_0xc8ab('0x21')]][_0xc8ab('0x2a')]=_0x22485b['operation'];this[_0xc8ab('0xa')][_0x22485b[_0xc8ab('0x21')]]['status']=_0x22485b[_0xc8ab('0x2b')];this[_0xc8ab('0xa')][_0x22485b[_0xc8ab('0x21')]][_0xc8ab('0x2c')]=_0x22485b[_0xc8ab('0x2c')];this['channels'][_0x22485b[_0xc8ab('0x21')]][_0xc8ab('0x2d')]=_0x22485b[_0xc8ab('0x2d')];logger[_0xc8ab('0x23')](_0x22485b['uniqueid'],_0xc8ab('0x2e'));}};Fax['prototype'][_0xc8ab('0x18')]=function(_0x3cb860){var _0xb05b0d=this;if(this[_0xc8ab('0xa')][_0x3cb860[_0xc8ab('0x21')]]){var _0x113d59=this['channels'][_0x3cb860['uniqueid']]['id'];this[_0xc8ab('0xa')][_0x3cb860['uniqueid']][_0xc8ab('0x2f')]=_0x3cb860['remotestationid'];this[_0xc8ab('0xa')][_0x3cb860[_0xc8ab('0x21')]][_0xc8ab('0x30')]=_0x3cb860[_0xc8ab('0x30')];this[_0xc8ab('0xa')][_0x3cb860[_0xc8ab('0x21')]][_0xc8ab('0x2c')]=_0x3cb860[_0xc8ab('0x2c')];this[_0xc8ab('0xa')][_0x3cb860['uniqueid']][_0xc8ab('0x31')]=_0x3cb860[_0xc8ab('0x31')];this['channels'][_0x3cb860['uniqueid']]['transferrate']=_0x3cb860[_0xc8ab('0x32')];this['channels'][_0x3cb860[_0xc8ab('0x21')]][_0xc8ab('0x2d')]=_0x3cb860['filename'];this[_0xc8ab('0xa')][_0x3cb860[_0xc8ab('0x21')]][_0xc8ab('0x33')]=_0x3cb860[_0xc8ab('0x33')];if(this[_0xc8ab('0xa')][_0x3cb860[_0xc8ab('0x21')]][_0xc8ab('0x30')]>0x0){tiff2pdf(_0x3cb860[_0xc8ab('0x2d')],_0xc8ab('0x34'),function(_0x5433c7){logger[_0xc8ab('0x23')](_0x3cb860['uniqueid'],_0xc8ab('0x35'),_0x5433c7['message']);attachment[_0xc8ab('0x36')]({'name':path[_0xc8ab('0x37')](_0x3cb860[_0xc8ab('0x2d')])[_0xc8ab('0x38')],'basename':path[_0xc8ab('0x37')](_0x3cb860[_0xc8ab('0x2d')])[_0xc8ab('0x38')]+_0xc8ab('0x39'),'type':_0xc8ab('0x3a')})['then'](function(_0x4905fc){faxAccount[_0xc8ab('0x3b')](_0x113d59,{'from':_0x3cb860[_0xc8ab('0x33')],'mapKey':_0xc8ab('0x4'),'body':path['parse'](_0x3cb860[_0xc8ab('0x2d')])[_0xc8ab('0x38')]+_0xc8ab('0x39'),'AttachmentId':_0x4905fc['id']})['catch'](function(_0x2a95ab){logger['error'](_0x3cb860[_0xc8ab('0x21')],'\x20notify\x20',JSON[_0xc8ab('0x3c')](_0x2a95ab));});})['catch'](function(_0x15d2d7){logger['error'](_0x3cb860[_0xc8ab('0x21')],_0xc8ab('0x3d'),JSON[_0xc8ab('0x3c')](_0x15d2d7));});});}logger['info'](_0x3cb860['uniqueid'],_0xc8ab('0x3d'));}};Fax[_0xc8ab('0x1d')][_0xc8ab('0x1c')]=function(_0x370c9b){if(this['actions'][_0x370c9b[_0xc8ab('0x21')]]){_['merge'](this['channels'][_0x370c9b[_0xc8ab('0x21')]],_[_0xc8ab('0x3e')](_0x370c9b,['response',_0xc8ab('0x3f')]));}};function updateStatus(_0x1e9ae7){if(_0x1e9ae7[_0xc8ab('0x40')]){faxMessage['update'](_0x1e9ae7['AttachmentId'],{'failMessage':_0xc8ab('0x41')})[_0xc8ab('0x42')](function(_0x583f32){ut[_0xc8ab('0x43')]('[Fax][Message][Error][Updated]',_0x583f32);})[_0xc8ab('0x44')](function(_0x477435){ut[_0xc8ab('0x43')](_0xc8ab('0x45'),_0x477435);});}else{ut[_0xc8ab('0x43')](_0xc8ab('0x46'));}}Fax[_0xc8ab('0x1d')]['updateStatus']=function(_0x19dcc4,_0x2ac457,_0x3117bc){var _0x47fde5=this;var _0x4008b0={};if(_0x2ac457){_0x4008b0={'read':_0x2ac457};}else{_0x4008b0={'failMessage':_0x3117bc};}if(this[_0xc8ab('0x25')][_0x19dcc4][_0xc8ab('0x40')]){faxMessage['update'](this[_0xc8ab('0x25')][_0x19dcc4][_0xc8ab('0x40')],_0x4008b0)[_0xc8ab('0x42')](function(_0x1092e3){ut[_0xc8ab('0x43')]('[Fax][Message][Updated]',_0x1092e3);})[_0xc8ab('0x44')](function(_0x289fe6){ut[_0xc8ab('0x43')](_0xc8ab('0x47'),_0x289fe6);})[_0xc8ab('0x48')](function(){delete _0x47fde5['channels'][_0x19dcc4];delete _0x47fde5[_0xc8ab('0x25')][_0x19dcc4];});}else{ut['logger'](_0xc8ab('0x49'));delete this[_0xc8ab('0xa')][_0x19dcc4];delete this[_0xc8ab('0x25')][_0x19dcc4];}};Fax['prototype'][_0xc8ab('0x1a')]=function(_0x29588a){var _0x1327af=this;if(this[_0xc8ab('0xa')][_0x29588a['uniqueid']]){if(this[_0xc8ab('0x25')][_0x29588a[_0xc8ab('0x21')]]){this[_0xc8ab('0xa')][_0x29588a['uniqueid']]['id']=this[_0xc8ab('0x25')][_0x29588a[_0xc8ab('0x21')]]['id'];this[_0xc8ab('0xa')][_0x29588a[_0xc8ab('0x21')]][_0xc8ab('0x38')]=this[_0xc8ab('0x25')][_0x29588a[_0xc8ab('0x21')]][_0xc8ab('0x38')];}logger[_0xc8ab('0x23')](_0x29588a['uniqueid'],this['actions'][_0x29588a[_0xc8ab('0x21')]]?_0xc8ab('0x4a'):_0xc8ab('0x4b'),JSON['stringify'](this[_0xc8ab('0xa')][_0x29588a[_0xc8ab('0x21')]]));if(this[_0xc8ab('0x25')][_0x29588a['uniqueid']]){if(this['channels'][_0x29588a[_0xc8ab('0x21')]]['faxpages']>0x0&&this['channels'][_0x29588a[_0xc8ab('0x21')]][_0xc8ab('0x4c')]===_0xc8ab('0x4d')){this[_0xc8ab('0x4e')](_0x29588a[_0xc8ab('0x21')],!![]);}else{this['updateStatus'](_0x29588a[_0xc8ab('0x21')],![],this[_0xc8ab('0xa')][_0x29588a[_0xc8ab('0x21')]][_0xc8ab('0x4f')]?_0xc8ab('0x50')+this['channels'][_0x29588a[_0xc8ab('0x21')]][_0xc8ab('0x4f')]:_0xc8ab('0x51'));}}}};Fax[_0xc8ab('0x1d')][_0xc8ab('0x52')]=function(_0x3ddd34){var _0x2b5dbe=this;return new BPromise(function(_0x448a28,_0x5326fe){_0x2b5dbe[_0xc8ab('0x53')](_0x3ddd34,_0x2b5dbe['faxAccounts'][_0x3ddd34['FaxAccountId']])[_0xc8ab('0x42')](function(_0x522351){ut['logger'](_0xc8ab('0x54'),_0x522351);_0x448a28(ut['message'](_0xc8ab('0x55')));})[_0xc8ab('0x44')](function(_0x4e7f60){ut[_0xc8ab('0x43')]('[Fax][execOriginate][failure]',_0x4e7f60);updateStatus(_0x3ddd34);_0x5326fe(ut[_0xc8ab('0x56')](_0xc8ab('0x57')));});});};Fax['prototype'][_0xc8ab('0x58')]=function(_0x18235f){var _0x4a504a=this;return new BPromise(function(_0x38ba04,_0x365c52){var _0x1d3194=_0x4a504a[_0xc8ab('0x59')](_0x4a504a[_0xc8ab('0xb')][_0x18235f[_0xc8ab('0x5a')]][_0xc8ab('0x5b')],_0x18235f);if(_0x1d3194[_0xc8ab('0x5c')]){_0x38ba04(ut[_0xc8ab('0x56')]('Trunk\x20Reachable'));}else{_0x365c52(ut[_0xc8ab('0x56')](_0x1d3194[_0xc8ab('0x56')]));}});};function originate(_0x5bd79b,_0x485081,_0x2126e5){return new BPromise(function(_0x20c9dc,_0x4b2374){if(_0x2126e5){var _0x311a6a=util['format'](_0xc8ab('0x5d'),path[_0xc8ab('0x37')](_0x5bd79b[_0xc8ab('0x5e')])[_0xc8ab('0x38')],_0x5bd79b[_0xc8ab('0x5e')]);gs[_0xc8ab('0x5f')](_0x311a6a)[_0xc8ab('0x42')](function(){_0x5bd79b[_0xc8ab('0x5e')]=util[_0xc8ab('0x60')]('%s/%s.tif',path[_0xc8ab('0x37')](_0x5bd79b[_0xc8ab('0x5e')])[_0xc8ab('0x61')],path[_0xc8ab('0x37')](_0x5bd79b['path'])[_0xc8ab('0x38')]);_0x485081[_0xc8ab('0x62')]=_0x5bd79b['path'];ut['logger'](_0xc8ab('0x63'),'');ami[_0xc8ab('0x64')](ut[_0xc8ab('0x65')](_0x5bd79b,_0x485081))[_0xc8ab('0x42')](function(_0x46fa7f){_0x20c9dc(_0x46fa7f);})[_0xc8ab('0x44')](function(_0x767a29){_0x4b2374(_0x767a29);});})['catch'](function(_0xae4450){_0x4b2374(_0xae4450);});}else{ami['Action'](ut[_0xc8ab('0x65')](_0x5bd79b,_0x485081))[_0xc8ab('0x42')](function(_0x2a5f42){_0x20c9dc(_0x2a5f42);})[_0xc8ab('0x44')](function(_0xe6cbed){_0x4b2374(_0xe6cbed);});}});}Fax[_0xc8ab('0x1d')][_0xc8ab('0x53')]=function(_0x557623,_0x53a164){var _0x48b7d8=this;return new BPromise(function(_0x4d0b08,_0x3d4dab){var _0x4c7615=uuid['v4']();var _0x276864=ut['addVariables'](_0x557623,_0x53a164);_0x48b7d8['actions'][_0x4c7615]=new Action(_0x4c7615,_0x53a164,_0x557623);var _0x29ab63=_0x48b7d8[_0xc8ab('0x25')][_0x4c7615];if(path[_0xc8ab('0x37')](_0x557623[_0xc8ab('0x5e')])[_0xc8ab('0x66')]===_0xc8ab('0x39')){originate(_0x29ab63,_0x276864,!![])[_0xc8ab('0x42')](function(_0x42d389){_0x4d0b08(_0x42d389);})['catch'](function(_0x476d55){_0x3d4dab(_0x476d55);});}else{originate(_0x29ab63,_0x276864,![])[_0xc8ab('0x42')](function(_0x3015a8){_0x4d0b08(_0x3015a8);})[_0xc8ab('0x44')](function(_0x3eee4f){_0x3d4dab(_0x3eee4f);});}});};Fax['prototype']['isTrunkReachable']=function(_0x4cb0ad){return!_[_0xc8ab('0x67')](_0x4cb0ad)&&!_['isNil'](_0x4cb0ad[_0xc8ab('0x38')])&&!_[_0xc8ab('0x67')](_0x4cb0ad[_0xc8ab('0x68')])&&_0x4cb0ad[_0xc8ab('0x68')]&&!_['isNil'](this[_0xc8ab('0xc')][util[_0xc8ab('0x60')]('SIP/%s',_0x4cb0ad['name'])])&&!_[_0xc8ab('0x67')](this['trunks'][util['format'](_0xc8ab('0x69'),_0x4cb0ad[_0xc8ab('0x38')])][_0xc8ab('0x2b')])&&(this[_0xc8ab('0xc')][util[_0xc8ab('0x60')](_0xc8ab('0x69'),_0x4cb0ad[_0xc8ab('0x38')])]['status']===_0xc8ab('0x6a')||this[_0xc8ab('0xc')][util[_0xc8ab('0x60')](_0xc8ab('0x69'),_0x4cb0ad['name'])][_0xc8ab('0x2b')]===_0xc8ab('0x6b'));};Fax[_0xc8ab('0x1d')][_0xc8ab('0x59')]=function(_0x9a7627,_0x36a981){if(!this['isTrunkReachable'](_0x9a7627)){ut[_0xc8ab('0x43')](_0xc8ab('0x6c'),_[_0xc8ab('0x67')](_0x9a7627)?'':_0x9a7627['name']+_0xc8ab('0x6d'));return{'isValid':![],'message':_0xc8ab('0x6e')};}if(_[_0xc8ab('0x67')](_0x36a981[_0xc8ab('0x4')])){ut['logger'](_0xc8ab('0x6f'),JSON[_0xc8ab('0x3c')](_0x36a981));return{'isValid':![],'message':_0xc8ab('0x70')};}if(_[_0xc8ab('0x67')](_0x36a981[_0xc8ab('0x5e')])){ut['logger'](_0xc8ab('0x71'),JSON[_0xc8ab('0x3c')](_0x36a981));return{'isValid':![],'message':_0xc8ab('0x72')};}return{'isValid':!![],'message':_0xc8ab('0x73')};};module[_0xc8ab('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 9051cc8..43835bd 100644 --- a/server/services/ami/fax/rpcDb.js +++ b/server/services/ami/fax/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf37=['util','bluebird','preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20'];(function(_0x2263d6,_0x23ef72){var _0x392795=function(_0x555ceb){while(--_0x555ceb){_0x2263d6['push'](_0x2263d6['shift']());}};_0x392795(++_0x23ef72);}(_0xbf37,0x1d9));var _0x7bf3=function(_0xe25b32,_0x4dab6d){_0xe25b32=_0xe25b32-0x0;var _0x97b442=_0xbf37[_0xe25b32];return _0x97b442;};'use strict';var util=require(_0x7bf3('0x0'));var BPromise=require(_0x7bf3('0x1'));var logger=require('../../../config/logger')(_0x7bf3('0x2'));var _=require(_0x7bf3('0x3'));var faxAccount=require(_0x7bf3('0x4'));function loggerCatch(_0x5552b0){return function(_0x134a8a){logger[_0x7bf3('0x5')](_0x5552b0,util['inspect'](_0x134a8a,{'showHidden':![],'depth':null}));};}exports[_0x7bf3('0x6')]=function(_0x209c61,_0x284133){return BPromise[_0x7bf3('0x7')]()[_0x7bf3('0x8')](faxAccount[_0x7bf3('0x6')](_0x209c61,_0x284133))[_0x7bf3('0x9')](loggerCatch(_0x7bf3('0xa')));}; \ No newline at end of file +var _0x5847=['resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','notify'];(function(_0x104e26,_0x3e60ae){var _0x1525ac=function(_0x4f5fa7){while(--_0x4f5fa7){_0x104e26['push'](_0x104e26['shift']());}};_0x1525ac(++_0x3e60ae);}(_0x5847,0x175));var _0x7584=function(_0x2826cf,_0x11d891){_0x2826cf=_0x2826cf-0x0;var _0x11e957=_0x5847[_0x2826cf];return _0x11e957;};'use strict';var util=require(_0x7584('0x0'));var BPromise=require(_0x7584('0x1'));var logger=require(_0x7584('0x2'))(_0x7584('0x3'));var _=require(_0x7584('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x23fa0e){return function(_0x38406a){logger[_0x7584('0x5')](_0x23fa0e,util['inspect'](_0x38406a,{'showHidden':![],'depth':null}));};}exports[_0x7584('0x6')]=function(_0x1d33fe,_0x2776d1){return BPromise[_0x7584('0x7')]()[_0x7584('0x8')](faxAccount['notify'](_0x1d33fe,_0x2776d1))['catch'](loggerCatch(_0x7584('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 1ea1dd9..64511e9 100644 --- a/server/services/ami/fax/util/gs.js +++ b/server/services/ami/fax/util/gs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3664=['\x20Error\x20:','inspect','util','bluebird','exec','info','Exec\x20gs'];(function(_0xbe31a4,_0x11ba89){var _0x15ec28=function(_0x124633){while(--_0x124633){_0xbe31a4['push'](_0xbe31a4['shift']());}};_0x15ec28(++_0x11ba89);}(_0x3664,0x191));var _0x4366=function(_0x378fb5,_0x2e4f5a){_0x378fb5=_0x378fb5-0x0;var _0x399b1b=_0x3664[_0x378fb5];return _0x399b1b;};'use strict';var util=require(_0x4366('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x4366('0x1'));var exec=require('child_process')[_0x4366('0x2')];exports['execute']=function(_0x5efde6){return new BPromise(function(_0xdb264b,_0x627ccd){exec(_0x5efde6,function(_0xc6c670,_0x118096,_0x36e9bb){logger[_0x4366('0x3')](_0x4366('0x4'),_0x118096);if(_0xc6c670){logger['info'](_0x4366('0x4'),_0x4366('0x5'),util[_0x4366('0x6')](_0xc6c670,{'showHidden':![],'depth':null}),_0x118096,_0x36e9bb);_0x627ccd(_0xc6c670);}_0xdb264b(_0x118096);});});}; \ No newline at end of file +var _0x6b7a=['inspect','util','../../../../config/logger','fax','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x3edb33,_0xa4302d){var _0x238608=function(_0xa0310f){while(--_0xa0310f){_0x3edb33['push'](_0x3edb33['shift']());}};_0x238608(++_0xa4302d);}(_0x6b7a,0xe1));var _0xa6b7=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x6b7a[_0x15bc81];return _0x59440e;};'use strict';var util=require(_0xa6b7('0x0'));var logger=require(_0xa6b7('0x1'))(_0xa6b7('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0xa6b7('0x3')];exports['execute']=function(_0x377cbe){return new BPromise(function(_0x27f4ae,_0x58e605){exec(_0x377cbe,function(_0x3b2e4f,_0x3c1487,_0x11c2f2){logger[_0xa6b7('0x4')]('Exec\x20gs',_0x3c1487);if(_0x3b2e4f){logger['info'](_0xa6b7('0x5'),_0xa6b7('0x6'),util[_0xa6b7('0x7')](_0x3b2e4f,{'showHidden':![],'depth':null}),_0x3c1487,_0x11c2f2);_0x58e605(_0x3b2e4f);}_0x27f4ae(_0x3c1487);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 69dfc22..1776966 100644 --- a/server/services/ami/fax/util/util.js +++ b/server/services/ami/fax/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54bd=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','ecm','headerinfo','minrate','maxrate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54bd,0x18c));var _0xd54b=function(_0x167923,_0x3298e9){_0x167923=_0x167923-0x0;var _0x4f2e94=_0x54bd[_0x167923];return _0x4f2e94;};'use strict';var util=require(_0xd54b('0x0'));var _=require(_0xd54b('0x1'));var moment=require(_0xd54b('0x2'));var logger=require(_0xd54b('0x3'))(_0xd54b('0x4'));exports[_0xd54b('0x5')]=function(_0x1e803d){return{'message':_0x1e803d};};exports[_0xd54b('0x6')]=function(_0x5aad4d,_0x1dc0a9){logger[_0xd54b('0x7')](_0x5aad4d,util['inspect'](_0x1dc0a9,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x305c59,_0x16bf97){var _0x3fad50={'XMF-ECM':_0x16bf97[_0xd54b('0x8')],'XMF-HEADERINFO':_0x16bf97[_0xd54b('0x9')],'XMF-MINRATE':_0x16bf97[_0xd54b('0xa')],'XMF-MAXRATE':_0x16bf97[_0xd54b('0xb')],'XMF-MODEM':util[_0xd54b('0xc')](_0xd54b('0xd'),_0x16bf97['modem']),'XMF-GATEWAY':_0x16bf97[_0xd54b('0xe')],'XMF-FAXDETECT':_0x16bf97[_0xd54b('0xf')],'XMF-T38TIMEOUT':_0x16bf97[_0xd54b('0x10')],'XMF-LOCALSTATIONID':_0x16bf97[_0xd54b('0x11')],'XMF-PATH':_0x305c59[_0xd54b('0x12')]};return _0x3fad50;};exports[_0xd54b('0x13')]=function(_0x40c2b8,_0x55bd8e){return{'actionid':_0x40c2b8[_0xd54b('0x14')],'action':'originate','channel':_0x40c2b8[_0xd54b('0x15')],'Exten':'xcally-motion-fax','Context':_0xd54b('0x16'),'Priority':'1','callerid':util[_0xd54b('0xc')](_0xd54b('0x17'),_0x40c2b8[_0xd54b('0x9')]?_0x40c2b8[_0xd54b('0x9')]:'',_0x40c2b8[_0xd54b('0x11')]),'variable':_0x55bd8e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x40c2b8['uniqueid']};}; \ No newline at end of file +var _0x1360=['\x22%s\x22','modem','gateway','t38timeout','variablesAction','originate','channel','from-sip','localstationid','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','headerinfo','maxrate','format'];(function(_0x69d88,_0x290f5c){var _0x321cc4=function(_0x302640){while(--_0x302640){_0x69d88['push'](_0x69d88['shift']());}};_0x321cc4(++_0x290f5c);}(_0x1360,0x180));var _0x0136=function(_0x591896,_0x386bac){_0x591896=_0x591896-0x0;var _0x5eaa48=_0x1360[_0x591896];return _0x5eaa48;};'use strict';var util=require(_0x0136('0x0'));var _=require(_0x0136('0x1'));var moment=require(_0x0136('0x2'));var logger=require(_0x0136('0x3'))(_0x0136('0x4'));exports[_0x0136('0x5')]=function(_0x3bbbf3){return{'message':_0x3bbbf3};};exports[_0x0136('0x6')]=function(_0x44180e,_0x331bc0){logger[_0x0136('0x7')](_0x44180e,util[_0x0136('0x8')](_0x331bc0,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1aad3c,_0x1d8447){var _0x321bf1={'XMF-ECM':_0x1d8447['ecm'],'XMF-HEADERINFO':_0x1d8447[_0x0136('0x9')],'XMF-MINRATE':_0x1d8447['minrate'],'XMF-MAXRATE':_0x1d8447[_0x0136('0xa')],'XMF-MODEM':util[_0x0136('0xb')](_0x0136('0xc'),_0x1d8447[_0x0136('0xd')]),'XMF-GATEWAY':_0x1d8447[_0x0136('0xe')],'XMF-FAXDETECT':_0x1d8447['faxdetect'],'XMF-T38TIMEOUT':_0x1d8447[_0x0136('0xf')],'XMF-LOCALSTATIONID':_0x1d8447['localstationid'],'XMF-PATH':_0x1aad3c['path']};return _0x321bf1;};exports[_0x0136('0x10')]=function(_0x1dc80d,_0x422ede){return{'actionid':_0x1dc80d['uniqueid'],'action':_0x0136('0x11'),'channel':_0x1dc80d[_0x0136('0x12')],'Exten':'xcally-motion-fax','Context':_0x0136('0x13'),'Priority':'1','callerid':util[_0x0136('0xb')]('\x22%s\x22\x20<%s>',_0x1dc80d[_0x0136('0x9')]?_0x1dc80d['headerinfo']:'',_0x1dc80d[_0x0136('0x14')]),'variable':_0x422ede,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1dc80d[_0x0136('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index fe1330f..e9b4013 100644 --- a/server/services/ami/index.js +++ b/server/services/ami/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0150=['initZohoAccounts','getVtigerAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x0150,0x19a));var _0x0015=function(_0x1ef993,_0x1bb9b4){_0x1ef993=_0x1ef993-0x0;var _0x36aab2=_0x0150[_0x1ef993];return _0x36aab2;};'use strict';var util=require('util');var moment=require(_0x0015('0x0'));var server=require(_0x0015('0x1'));var Realtime=require(_0x0015('0x2'));var Report=require(_0x0015('0x3'));var Acw=require(_0x0015('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x0015('0x5'));var Preview=require(_0x0015('0x6'));var Fax=require(_0x0015('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x0015('0x8'));var voiceQueueReport=require(_0x0015('0x9'));var voiceCallReport=require(_0x0015('0xa'));var trunk=require(_0x0015('0xb'));var trigger=require(_0x0015('0xc'));var template=require(_0x0015('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x0015('0xe'));var faxAccount=require(_0x0015('0xf'));var zendesk=require(_0x0015('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x0015('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0015('0x12'));var vtiger=require(_0x0015('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0015('0x14'));var dynamics365=require(_0x0015('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0015('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0015('0x17')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0015('0x17')](_0x0015('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x0015('0x19')]()[_0x0015('0x1a')](user[_0x0015('0x1b')]())[_0x0015('0x1a')](realtime[_0x0015('0x1c')]())['then'](user[_0x0015('0x1d')]())[_0x0015('0x1a')](realtime[_0x0015('0x1e')]())[_0x0015('0x1a')](trunk[_0x0015('0x1f')]())['then'](realtime['initTrunks']())[_0x0015('0x1a')](voiceQueue[_0x0015('0x20')]())[_0x0015('0x1a')](realtime[_0x0015('0x21')]())[_0x0015('0x1a')](trigger[_0x0015('0x22')]())['then'](realtime[_0x0015('0x23')]())[_0x0015('0x1a')](template[_0x0015('0x24')]())[_0x0015('0x1a')](realtime['initTemplates']())[_0x0015('0x1a')](zendesk['getZendeskAccounts']())['then'](realtime[_0x0015('0x25')]())['then'](salesforce[_0x0015('0x26')]())[_0x0015('0x1a')](realtime[_0x0015('0x27')]())[_0x0015('0x1a')](sugarcrm[_0x0015('0x28')]())[_0x0015('0x1a')](realtime[_0x0015('0x29')]())[_0x0015('0x1a')](freshdesk['getFreshdeskAccounts']())[_0x0015('0x1a')](realtime[_0x0015('0x2a')]())['then'](desk[_0x0015('0x2b')]())[_0x0015('0x1a')](realtime[_0x0015('0x2c')]())[_0x0015('0x1a')](zoho['getZohoAccounts']())[_0x0015('0x1a')](realtime[_0x0015('0x2d')]())[_0x0015('0x1a')](vtiger[_0x0015('0x2e')]())[_0x0015('0x1a')](realtime['initVtigerAccounts']())[_0x0015('0x1a')](freshsales['getFreshsalesAccounts']())[_0x0015('0x1a')](realtime['initFreshsalesAccounts']())['then'](servicenow['getServicenowAccounts']())[_0x0015('0x1a')](realtime['initServicenowAccounts']())[_0x0015('0x1a')](dynamics365[_0x0015('0x2f')]())[_0x0015('0x1a')](realtime['initDynamics365Accounts']())[_0x0015('0x1a')](campaign[_0x0015('0x30')]())[_0x0015('0x1a')](realtime['initCampaigns']())['then'](voiceExtension[_0x0015('0x31')]())[_0x0015('0x1a')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x0015('0x32')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0x0015('0x19')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x0015('0x1a')](realtime[_0x0015('0x33')]())['then'](cmHopperHistory[_0x0015('0x34')]())[_0x0015('0x1a')](realtime[_0x0015('0x35')]())['then'](cmHopperHistory[_0x0015('0x36')]())['then'](realtime[_0x0015('0x37')]())[_0x0015('0x1a')](voiceCallReport[_0x0015('0x38')]())['then'](realtime[_0x0015('0x39')]())[_0x0015('0x3a')](function(_0x4b3d94){logger[_0x0015('0x3b')](_0x0015('0x3c'),util[_0x0015('0x3d')](_0x4b3d94,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0015('0x3e')](realtime,preview,fax)[_0x0015('0x1a')](function(){return initRealtime();})[_0x0015('0x1a')](function(){return initParams();})[_0x0015('0x1a')](function(){report[_0x0015('0x3f')]();setInterval(initRealtime,0x1388);})[_0x0015('0x3a')](function(_0x5155b3){logger[_0x0015('0x3b')](_0x0015('0x40'),util[_0x0015('0x3d')](_0x5155b3,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0ccb=['error','[index.js][initParams]','inspect','listen','[index.js][main]','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0ccb,0xe0));var _0xb0cc=function(_0x3b38f4,_0x1458e4){_0x3b38f4=_0x3b38f4-0x0;var _0x5a56b9=_0x0ccb[_0x3b38f4];return _0x5a56b9;};'use strict';var util=require(_0xb0cc('0x0'));var moment=require(_0xb0cc('0x1'));var server=require(_0xb0cc('0x2'));var Realtime=require('./realtime');var Report=require(_0xb0cc('0x3'));var Acw=require(_0xb0cc('0x4'));var Trigger=require(_0xb0cc('0x5'));var Dialer=require(_0xb0cc('0x6'));var Preview=require(_0xb0cc('0x7'));var Fax=require(_0xb0cc('0x8'));var user=require(_0xb0cc('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xb0cc('0xa'));var voiceCallReport=require(_0xb0cc('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0xb0cc('0xc'));var template=require(_0xb0cc('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xb0cc('0xe'));var voiceExtension=require(_0xb0cc('0xf'));var faxAccount=require(_0xb0cc('0x10'));var zendesk=require(_0xb0cc('0x11'));var salesforce=require(_0xb0cc('0x12'));var sugarcrm=require(_0xb0cc('0x13'));var freshdesk=require(_0xb0cc('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xb0cc('0x15'));var vtiger=require(_0xb0cc('0x16'));var freshsales=require(_0xb0cc('0x17'));var servicenow=require(_0xb0cc('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xb0cc('0x19'))(_0xb0cc('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xb0cc('0x1b')](_0xb0cc('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb0cc('0x1b')](_0xb0cc('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xb0cc('0x1d')]()['then'](user[_0xb0cc('0x1e')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x20')]())[_0xb0cc('0x1f')](user[_0xb0cc('0x21')]())['then'](realtime[_0xb0cc('0x22')]())[_0xb0cc('0x1f')](trunk[_0xb0cc('0x23')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x24')]())[_0xb0cc('0x1f')](voiceQueue[_0xb0cc('0x25')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x26')]())[_0xb0cc('0x1f')](trigger[_0xb0cc('0x27')]())['then'](realtime[_0xb0cc('0x28')]())['then'](template[_0xb0cc('0x29')]())['then'](realtime[_0xb0cc('0x2a')]())[_0xb0cc('0x1f')](zendesk[_0xb0cc('0x2b')]())[_0xb0cc('0x1f')](realtime['initZendeskAccounts']())['then'](salesforce['getSalesforceAccounts']())['then'](realtime[_0xb0cc('0x2c')]())[_0xb0cc('0x1f')](sugarcrm[_0xb0cc('0x2d')]())[_0xb0cc('0x1f')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xb0cc('0x2e')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())[_0xb0cc('0x1f')](realtime['initDeskAccounts']())[_0xb0cc('0x1f')](zoho[_0xb0cc('0x2f')]())[_0xb0cc('0x1f')](realtime['initZohoAccounts']())['then'](vtiger[_0xb0cc('0x30')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x31')]())[_0xb0cc('0x1f')](freshsales['getFreshsalesAccounts']())[_0xb0cc('0x1f')](realtime['initFreshsalesAccounts']())[_0xb0cc('0x1f')](servicenow[_0xb0cc('0x32')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x33')]())[_0xb0cc('0x1f')](dynamics365[_0xb0cc('0x34')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x35')]())[_0xb0cc('0x1f')](campaign[_0xb0cc('0x36')]())[_0xb0cc('0x1f')](realtime['initCampaigns']())['then'](voiceExtension[_0xb0cc('0x37')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x38')]())[_0xb0cc('0x1f')](faxAccount[_0xb0cc('0x39')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x3a')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xb0cc('0x1f')](voiceQueueReport[_0xb0cc('0x3b')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x3c')]())['then'](cmHopperHistory[_0xb0cc('0x3d')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x3e')]())[_0xb0cc('0x1f')](cmHopperHistory[_0xb0cc('0x3f')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x40')]())[_0xb0cc('0x1f')](voiceCallReport[_0xb0cc('0x41')]())[_0xb0cc('0x1f')](realtime[_0xb0cc('0x42')]())[_0xb0cc('0x43')](function(_0x4fabfd){logger[_0xb0cc('0x44')](_0xb0cc('0x45'),util[_0xb0cc('0x46')](_0x4fabfd,{'showHidden':![],'depth':null}));});}function main(){return server[_0xb0cc('0x47')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x520652){logger['error'](_0xb0cc('0x48'),util[_0xb0cc('0x46')](_0x520652,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 5c6e357..bdffeec 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c4f=['emit','user:save','user:presence','exports','lodash','util','moment','defaults','localhost','redis','name','email','accountcode','fullname','unknown','stateTime','status','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','address','stringify'];(function(_0x3e6628,_0x48f6d0){var _0x244062=function(_0x1e8b84){while(--_0x1e8b84){_0x3e6628['push'](_0x3e6628['shift']());}};_0x244062(++_0x48f6d0);}(_0x2c4f,0x18a));var _0xf2c4=function(_0x34517a,_0x57bce2){_0x34517a=_0x34517a-0x0;var _0x2e3576=_0x2c4f[_0x34517a];return _0x2e3576;};'use strict';var _=require(_0xf2c4('0x0'));var util=require(_0xf2c4('0x1'));var moment=require(_0xf2c4('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xf2c4('0x3')](config['redis'],{'host':_0xf2c4('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf2c4('0x5')]));function Agent(_0xf00bff){this['id']=_0xf00bff['id']||0x0;this['name']=_0xf00bff[_0xf2c4('0x6')]||'';this[_0xf2c4('0x7')]=_0xf00bff['email']||'';this['accountcode']=_0xf00bff[_0xf2c4('0x8')]||'';this['fullname']=_0xf00bff[_0xf2c4('0x9')]||'';this['state']=_0xf2c4('0xa');this[_0xf2c4('0xb')]=0x0;this[_0xf2c4('0xc')]=_0xf2c4('0xa');this['address']='';this[_0xf2c4('0xd')]='';this[_0xf2c4('0xe')]='';this['interface']='';this[_0xf2c4('0xf')]=_0xf00bff[_0xf2c4('0xf')]||![];this[_0xf2c4('0x10')]=_0xf2c4('0xa');this[_0xf2c4('0x11')]=0x0;this[_0xf2c4('0x12')]='';this[_0xf2c4('0x13')]='';this[_0xf2c4('0x14')]=![];this[_0xf2c4('0x15')]=![];this[_0xf2c4('0x16')]='';}Agent[_0xf2c4('0x17')]['updateStatusRealtime']=function(_0x420c1c){var _0x470c48;if(_0x420c1c&&_0x420c1c[_0xf2c4('0x18')]){_0x470c48=_0x420c1c[_0xf2c4('0x18')][_0xf2c4('0x19')]();switch(_0x470c48){case _0xf2c4('0x1a'):_0x470c48=_0xf2c4('0x1b');break;case _0xf2c4('0x1c'):_0x470c48=_0xf2c4('0x1d');break;}}if(_0x470c48&&this[_0xf2c4('0x10')]!==_0x470c48||_0x420c1c[_0xf2c4('0x1e')]){this[_0xf2c4('0x11')]=_[_0xf2c4('0x1f')](moment()[_0xf2c4('0x20')]('x'));}if(_0x470c48){this['voiceStatus']=_0x470c48;}var _0x43631e={'id':this['id'],'name':this[_0xf2c4('0x6')],'email':this[_0xf2c4('0x7')],'accountcode':this[_0xf2c4('0x8')],'fullname':this[_0xf2c4('0x9')],'state':this[_0xf2c4('0x18')],'stateTime':this[_0xf2c4('0xb')],'status':this['status'],'address':this[_0xf2c4('0x21')],'online':this[_0xf2c4('0xf')],'voiceStatus':this[_0xf2c4('0x10')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xf2c4('0x12')],'voiceStatusQueue':this[_0xf2c4('0x13')],'interface':this['interface'],'onhold':this[_0xf2c4('0x14')]};var _0x1bbd89=md5(JSON[_0xf2c4('0x22')](_0x43631e));if(this[_0xf2c4('0x16')]!==_0x1bbd89){this[_0xf2c4('0x16')]=_0x1bbd89;io['to'](util[_0xf2c4('0x20')]('user:%s',_0x43631e[_0xf2c4('0x6')]))[_0xf2c4('0x23')](_0xf2c4('0x24'),_0x43631e);io[_0xf2c4('0x23')](_0xf2c4('0x25'),_0x43631e);}};module[_0xf2c4('0x26')]=Agent; \ No newline at end of file +var _0x6560=['idle','inuse','talking','statePause','voiceStatusTime','toNumber','format','stateTime','user:%s','emit','user:save','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','not_inuse'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6560,0xbf));var _0x0656=function(_0x4bd47d,_0x1b8c98){_0x4bd47d=_0x4bd47d-0x0;var _0x2a9320=_0x6560[_0x4bd47d];return _0x2a9320;};'use strict';var _=require('lodash');var util=require(_0x0656('0x0'));var moment=require(_0x0656('0x1'));var md5=require(_0x0656('0x2'));var Redis=require(_0x0656('0x3'));var config=require(_0x0656('0x4'));config[_0x0656('0x5')]=_[_0x0656('0x6')](config[_0x0656('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0656('0x7'))(new Redis(config[_0x0656('0x5')]));function Agent(_0x2ec72a){this['id']=_0x2ec72a['id']||0x0;this[_0x0656('0x8')]=_0x2ec72a['name']||'';this[_0x0656('0x9')]=_0x2ec72a['email']||'';this[_0x0656('0xa')]=_0x2ec72a['accountcode']||'';this[_0x0656('0xb')]=_0x2ec72a[_0x0656('0xb')]||'';this[_0x0656('0xc')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0x0656('0xd')]='';this[_0x0656('0xe')]='';this[_0x0656('0xf')]='';this[_0x0656('0x10')]='';this[_0x0656('0x11')]=_0x2ec72a[_0x0656('0x11')]||![];this[_0x0656('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x0656('0x13')]='';this[_0x0656('0x14')]='';this[_0x0656('0x15')]=![];this[_0x0656('0x16')]=![];this[_0x0656('0x2')]='';}Agent['prototype'][_0x0656('0x17')]=function(_0x572731){var _0x5aad9f;if(_0x572731&&_0x572731[_0x0656('0xc')]){_0x5aad9f=_0x572731[_0x0656('0xc')]['toLowerCase']();switch(_0x5aad9f){case _0x0656('0x18'):_0x5aad9f=_0x0656('0x19');break;case _0x0656('0x1a'):_0x5aad9f=_0x0656('0x1b');break;}}if(_0x5aad9f&&this['voiceStatus']!==_0x5aad9f||_0x572731[_0x0656('0x1c')]){this[_0x0656('0x1d')]=_[_0x0656('0x1e')](moment()[_0x0656('0x1f')]('x'));}if(_0x5aad9f){this[_0x0656('0x12')]=_0x5aad9f;}var _0x281107={'id':this['id'],'name':this[_0x0656('0x8')],'email':this[_0x0656('0x9')],'accountcode':this[_0x0656('0xa')],'fullname':this[_0x0656('0xb')],'state':this[_0x0656('0xc')],'stateTime':this[_0x0656('0x20')],'status':this['status'],'address':this['address'],'online':this[_0x0656('0x11')],'voiceStatus':this[_0x0656('0x12')],'voiceStatusTime':this[_0x0656('0x1d')],'voiceStatusCallerIdNumber':this[_0x0656('0x13')],'voiceStatusQueue':this[_0x0656('0x14')],'interface':this[_0x0656('0x10')],'onhold':this[_0x0656('0x15')]};var _0x42c384=md5(JSON['stringify'](_0x281107));if(this[_0x0656('0x2')]!==_0x42c384){this['md5']=_0x42c384;io['to'](util['format'](_0x0656('0x21'),_0x281107[_0x0656('0x8')]))[_0x0656('0x22')](_0x0656('0x23'),_0x281107);io[_0x0656('0x22')]('user:presence',_0x281107);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 3b0e180..b2af1f8 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5019=['ivrAnswerCallsDay','ivrTotalCallsDays','message','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','originated','temp'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x5019,0x1d1));var _0x9501=function(_0x4bc030,_0x46e923){_0x4bc030=_0x4bc030-0x0;var _0x209533=_0x5019[_0x4bc030];return _0x209533;};'use strict';function Campaign(_0x2f095f){this['id']=_0x2f095f['id']||0x0;this[_0x9501('0x0')]=_0x2f095f[_0x9501('0x0')]||'';this[_0x9501('0x1')]=_0x2f095f[_0x9501('0x1')]||_0x9501('0x2');this[_0x9501('0x3')]=0x0;this[_0x9501('0x4')]=0x0;this[_0x9501('0x5')]=0x0;this[_0x9501('0x6')]=0x0;this[_0x9501('0x7')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x2f095f['active'];this['limitCalls']=_0x2f095f[_0x9501('0x8')];this[_0x9501('0x9')]=_0x2f095f[_0x9501('0x9')]||null;this['dialGlobalInterval']=_0x2f095f[_0x9501('0xa')]?_0x2f095f[_0x9501('0xa')]:null;this[_0x9501('0xb')]=_0x2f095f['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x2f095f[_0x9501('0xc')];this[_0x9501('0xd')]=_0x2f095f[_0x9501('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x2f095f[_0x9501('0xe')];this[_0x9501('0xf')]=_0x2f095f[_0x9501('0xf')];this[_0x9501('0x10')]=_0x2f095f[_0x9501('0x10')];this['dialBusyRetryFrequency']=_0x2f095f['dialBusyRetryFrequency'];this[_0x9501('0x11')]=_0x2f095f[_0x9501('0x11')];this[_0x9501('0x12')]=_0x2f095f[_0x9501('0x12')];this['dialGlobalMaxRetry']=_0x2f095f[_0x9501('0x13')];this[_0x9501('0x14')]=_0x2f095f[_0x9501('0x14')]||0x3;this[_0x9501('0x15')]=_0x2f095f['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9501('0x16')]=_0x2f095f[_0x9501('0x16')]||0x3;this[_0x9501('0x17')]=_0x2f095f[_0x9501('0x17')]||0x96;this[_0x9501('0x18')]=_0x2f095f[_0x9501('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x2f095f[_0x9501('0x19')]||0x96;this['dialMachineMaxRetry']=_0x2f095f[_0x9501('0x1a')]||0x3;this[_0x9501('0x1b')]=_0x2f095f[_0x9501('0x1b')]||0x96;this[_0x9501('0x1c')]=_0x2f095f['dialAgentRejectMaxRetry']||0x3;this[_0x9501('0x1d')]=_0x2f095f[_0x9501('0x1d')]||0x96;this[_0x9501('0x1e')]=_0x2f095f[_0x9501('0x1e')]||_0x9501('0x1f');this['dialPrefix']=_0x2f095f[_0x9501('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2f095f[_0x9501('0x21')]||undefined;this['dialCutDigit']=_0x2f095f[_0x9501('0x22')]||undefined;this[_0x9501('0x23')]=_0x2f095f[_0x9501('0x23')]?_0x2f095f[_0x9501('0x23')]:undefined;this['Trunk']=_0x2f095f['Trunk']?_0x2f095f['Trunk']:undefined;this[_0x9501('0x24')]=_0x2f095f[_0x9501('0x24')]?_0x2f095f['Interval']:undefined;this[_0x9501('0x25')]=_0x2f095f[_0x9501('0x25')]?_0x2f095f['SquareProject']:undefined;this['dialQueueProject']=_0x2f095f[_0x9501('0x25')]?_0x2f095f[_0x9501('0x25')][_0x9501('0x0')]:undefined;this[_0x9501('0x26')]=_0x2f095f['dialAMDActive']||![];this[_0x9501('0x27')]=_0x2f095f['dialAMDInitialSilence'];this[_0x9501('0x28')]=_0x2f095f[_0x9501('0x28')];this[_0x9501('0x29')]=_0x2f095f['dialAMDAfterGreetingSilence'];this[_0x9501('0x2a')]=_0x2f095f[_0x9501('0x2a')];this['dialAMDMinWordLength']=_0x2f095f[_0x9501('0x2b')];this[_0x9501('0x2c')]=_0x2f095f[_0x9501('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x2f095f[_0x9501('0x2d')];this[_0x9501('0x2e')]=_0x2f095f['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x2f095f['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x39a2=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','temp','ivrAnswerCallsDay','message','active','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x39a2,0x9e));var _0x239a=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x39a2[_0x3b1e3f];return _0x3b1cd3;};'use strict';function Campaign(_0x2dde6e){this['id']=_0x2dde6e['id']||0x0;this['name']=_0x2dde6e[_0x239a('0x0')]||'';this[_0x239a('0x1')]=_0x2dde6e[_0x239a('0x1')]||'campaign';this['originated']=0x0;this[_0x239a('0x2')]=0x0;this[_0x239a('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x239a('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x239a('0x5')]=_0x2dde6e[_0x239a('0x5')];this['limitCalls']=_0x2dde6e['limitCalls'];this['dialTimezone']=_0x2dde6e['dialTimezone']||null;this[_0x239a('0x6')]=_0x2dde6e['dialGlobalInterval']?_0x2dde6e[_0x239a('0x6')]:null;this[_0x239a('0x7')]=_0x2dde6e[_0x239a('0x7')];this['dialOriginateCallerIdNumber']=_0x2dde6e[_0x239a('0x8')];this['dialOriginateTimeout']=_0x2dde6e['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x2dde6e[_0x239a('0x9')];this['dialCongestionRetryFrequency']=_0x2dde6e[_0x239a('0xa')];this[_0x239a('0xb')]=_0x2dde6e[_0x239a('0xb')];this[_0x239a('0xc')]=_0x2dde6e['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x2dde6e[_0x239a('0xd')];this[_0x239a('0xe')]=_0x2dde6e[_0x239a('0xe')];this[_0x239a('0xf')]=_0x2dde6e[_0x239a('0xf')];this[_0x239a('0x10')]=_0x2dde6e[_0x239a('0x10')]||0x3;this[_0x239a('0x11')]=_0x2dde6e[_0x239a('0x11')]||0x96;this[_0x239a('0x12')]=_0x2dde6e['dialDropMaxRetry']||0x3;this[_0x239a('0x13')]=_0x2dde6e[_0x239a('0x13')]||0x96;this[_0x239a('0x14')]=_0x2dde6e[_0x239a('0x14')]||0x3;this['dialAbandonedRetryFrequency']=_0x2dde6e[_0x239a('0x15')]||0x96;this[_0x239a('0x16')]=_0x2dde6e['dialMachineMaxRetry']||0x3;this[_0x239a('0x17')]=_0x2dde6e[_0x239a('0x17')]||0x96;this['dialAgentRejectMaxRetry']=_0x2dde6e[_0x239a('0x18')]||0x3;this[_0x239a('0x19')]=_0x2dde6e[_0x239a('0x19')]||0x96;this['dialOrderByScheduledAt']=_0x2dde6e[_0x239a('0x1a')]||'DESC';this['dialPrefix']=_0x2dde6e[_0x239a('0x1b')]||undefined;this[_0x239a('0x1c')]=_0x2dde6e[_0x239a('0x1c')]||undefined;this[_0x239a('0x1d')]=_0x2dde6e['dialCutDigit']||undefined;this['TrunkBackup']=_0x2dde6e[_0x239a('0x1e')]?_0x2dde6e[_0x239a('0x1e')]:undefined;this[_0x239a('0x1f')]=_0x2dde6e[_0x239a('0x1f')]?_0x2dde6e[_0x239a('0x1f')]:undefined;this[_0x239a('0x20')]=_0x2dde6e[_0x239a('0x20')]?_0x2dde6e[_0x239a('0x20')]:undefined;this[_0x239a('0x21')]=_0x2dde6e[_0x239a('0x21')]?_0x2dde6e['SquareProject']:undefined;this[_0x239a('0x22')]=_0x2dde6e['SquareProject']?_0x2dde6e[_0x239a('0x21')]['name']:undefined;this[_0x239a('0x23')]=_0x2dde6e[_0x239a('0x23')]||![];this[_0x239a('0x24')]=_0x2dde6e[_0x239a('0x24')];this[_0x239a('0x25')]=_0x2dde6e[_0x239a('0x25')];this[_0x239a('0x26')]=_0x2dde6e[_0x239a('0x26')];this['dialAMDTotalAnalysisTime']=_0x2dde6e['dialAMDTotalAnalysisTime'];this[_0x239a('0x27')]=_0x2dde6e[_0x239a('0x27')];this[_0x239a('0x28')]=_0x2dde6e[_0x239a('0x28')];this[_0x239a('0x29')]=_0x2dde6e[_0x239a('0x29')];this[_0x239a('0x2a')]=_0x2dde6e['dialAMDSilenceThreshold'];this[_0x239a('0x2b')]=_0x2dde6e[_0x239a('0x2b')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index ed83df8..45722bc 100644 --- a/server/services/ami/model/channel.js +++ b/server/services/ami/model/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x199c=['answered','answertime','endtime','abandoned','billableseconds','holdtime','type','disposition','monitor','queue','monitors','transfercalleridnum','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','uniqueid','linkedid','exten'];(function(_0x889c01,_0x1fb47b){var _0x4176dd=function(_0x2e4d88){while(--_0x2e4d88){_0x889c01['push'](_0x889c01['shift']());}};_0x4176dd(++_0x1fb47b);}(_0x199c,0x7b));var _0xc199=function(_0x4d9e65,_0x1f614f){_0x4d9e65=_0x4d9e65-0x0;var _0x287f5b=_0x199c[_0x4d9e65];return _0x287f5b;};'use strict';function Channel(){this[_0xc199('0x0')]=null;this[_0xc199('0x1')]='';this[_0xc199('0x2')]='';this['calleridnum']=0x0;this[_0xc199('0x3')]='';this[_0xc199('0x4')]=undefined;this[_0xc199('0x5')]=undefined;this['accountcode']=0x0;this['context']='';this[_0xc199('0x6')]=0x0;this[_0xc199('0x7')]=0x0;this[_0xc199('0x8')]=0x0;this[_0xc199('0x9')]=![];this[_0xc199('0xa')]=null;this[_0xc199('0xb')]=null;this['unmanaged']=![];this[_0xc199('0xc')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0xc199('0xd')]=0x0;this[_0xc199('0xe')]=0x0;this[_0xc199('0xf')]=null;this['tag']=null;this[_0xc199('0x10')]=null;this[_0xc199('0x11')]=![];this['monitorFilename']=null;this[_0xc199('0x12')]=null;this[_0xc199('0x13')]=[];this[_0xc199('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xc199('0x15')]=Channel; \ No newline at end of file +var _0xce2e=['endtime','unmanaged','lastdata','duration','billableseconds','type','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten'];(function(_0x215935,_0x537d50){var _0x59902f=function(_0x4ab277){while(--_0x4ab277){_0x215935['push'](_0x215935['shift']());}};_0x59902f(++_0x537d50);}(_0xce2e,0x1d8));var _0xece2=function(_0x27ca81,_0x4e823e){_0x27ca81=_0x27ca81-0x0;var _0x304fb3=_0xce2e[_0x27ca81];return _0x304fb3;};'use strict';function Channel(){this[_0xece2('0x0')]=null;this[_0xece2('0x1')]='';this[_0xece2('0x2')]='';this[_0xece2('0x3')]=0x0;this[_0xece2('0x4')]='';this[_0xece2('0x5')]=undefined;this[_0xece2('0x6')]=undefined;this['accountcode']=0x0;this[_0xece2('0x7')]='';this[_0xece2('0x8')]=0x0;this[_0xece2('0x9')]=0x0;this[_0xece2('0xa')]=0x0;this['answered']=![];this['answertime']=null;this[_0xece2('0xb')]=null;this[_0xece2('0xc')]=![];this['abandoned']=![];this['lastapplication']='';this[_0xece2('0xd')]='';this[_0xece2('0xe')]=0x0;this[_0xece2('0xf')]=0x0;this['holdtime']=0x0;this[_0xece2('0x10')]=null;this['tag']=null;this['disposition']=null;this[_0xece2('0x11')]=![];this[_0xece2('0x12')]=null;this['queue']=null;this[_0xece2('0x13')]=[];this[_0xece2('0x14')]=undefined;this[_0xece2('0x15')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xece2('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 5670ca0..6e50ee6 100644 --- a/server/services/ami/model/deskAccount.js +++ b/server/services/ami/model/deskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7e4=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0xb5a1c7,_0x295c05){var _0x53eae8=function(_0x3c0b07){while(--_0x3c0b07){_0xb5a1c7['push'](_0xb5a1c7['shift']());}};_0x53eae8(++_0x295c05);}(_0xe7e4,0x1e9));var _0x4e7e=function(_0x57308c,_0x3cb939){_0x57308c=_0x57308c-0x0;var _0x212a52=_0xe7e4[_0x57308c];return _0x212a52;};'use strict';function DeskAccount(_0x4b8329){this['id']=_0x4b8329['id']||0x0;this[_0x4e7e('0x0')]=_0x4b8329['name']||'';this['username']=_0x4b8329[_0x4e7e('0x1')]||'';this[_0x4e7e('0x2')]=_0x4b8329[_0x4e7e('0x2')]||'';this[_0x4e7e('0x3')]=_0x4b8329[_0x4e7e('0x3')]||'';this['password']=_0x4b8329[_0x4e7e('0x4')]||'';this[_0x4e7e('0x5')]=_0x4b8329[_0x4e7e('0x5')]||'';this[_0x4e7e('0x6')]=_0x4b8329[_0x4e7e('0x6')]||'';this[_0x4e7e('0x7')]=_0x4b8329[_0x4e7e('0x7')]||'';this[_0x4e7e('0x8')]=_0x4b8329[_0x4e7e('0x8')]||'';this[_0x4e7e('0x9')]=_0x4b8329[_0x4e7e('0x9')]||'';this[_0x4e7e('0xa')]=_0x4b8329['serverUrl']||'';this[_0x4e7e('0xb')]=_0x4b8329['Configurations']||{};}module[_0x4e7e('0xc')]=DeskAccount; \ No newline at end of file +var _0xefa0=['token','tokenSecret','type','serverUrl','Configurations','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xefa0,0x186));var _0x0efa=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xefa0[_0x1cc8fe];return _0x230054;};'use strict';function DeskAccount(_0xe8da11){this['id']=_0xe8da11['id']||0x0;this['name']=_0xe8da11['name']||'';this[_0x0efa('0x0')]=_0xe8da11[_0x0efa('0x0')]||'';this[_0x0efa('0x1')]=_0xe8da11['remoteUri']||'';this[_0x0efa('0x2')]=_0xe8da11[_0x0efa('0x2')]||'';this[_0x0efa('0x3')]=_0xe8da11[_0x0efa('0x3')]||'';this[_0x0efa('0x4')]=_0xe8da11['consumerKey']||'';this[_0x0efa('0x5')]=_0xe8da11['consumerSecret']||'';this[_0x0efa('0x6')]=_0xe8da11[_0x0efa('0x6')]||'';this[_0x0efa('0x7')]=_0xe8da11[_0x0efa('0x7')]||'';this[_0x0efa('0x8')]=_0xe8da11['type']||'';this[_0x0efa('0x9')]=_0xe8da11[_0x0efa('0x9')]||'';this[_0x0efa('0xa')]=_0xe8da11[_0x0efa('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0d78042..08b6e8a 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb2b=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','serverUrl'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0xfb2b,0x17a));var _0xbfb2=function(_0x45bd5b,_0x458ac6){_0x45bd5b=_0x45bd5b-0x0;var _0x364d0c=_0xfb2b[_0x45bd5b];return _0x364d0c;};'use strict';function Dynamics365Account(_0x2cb04c){this['id']=_0x2cb04c['id']||0x0;this[_0xbfb2('0x0')]=_0x2cb04c[_0xbfb2('0x0')]||'';this['username']=_0x2cb04c[_0xbfb2('0x1')]||'';this[_0xbfb2('0x2')]=_0x2cb04c[_0xbfb2('0x2')]||'';this[_0xbfb2('0x3')]=_0x2cb04c[_0xbfb2('0x3')]||'';this[_0xbfb2('0x4')]=_0x2cb04c[_0xbfb2('0x4')]||'';this[_0xbfb2('0x5')]=_0x2cb04c[_0xbfb2('0x5')]||'';this['clientSecret']=_0x2cb04c['clientSecret']||{};this[_0xbfb2('0x6')]=_0x2cb04c['serverUrl']||'';this[_0xbfb2('0x7')]=_0x2cb04c[_0xbfb2('0x7')]||![];this[_0xbfb2('0x8')]=_0x2cb04c['Configurations']||{};this['CloudProvider']=_0x2cb04c[_0xbfb2('0x9')]||{};}module[_0xbfb2('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x3d5e=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x5af890,_0x3e3693){var _0x3e8003=function(_0x45548e){while(--_0x45548e){_0x5af890['push'](_0x5af890['shift']());}};_0x3e8003(++_0x3e3693);}(_0x3d5e,0x1c5));var _0xe3d5=function(_0x410417,_0x43b262){_0x410417=_0x410417-0x0;var _0x4f270a=_0x3d5e[_0x410417];return _0x4f270a;};'use strict';function Dynamics365Account(_0x48540d){this['id']=_0x48540d['id']||0x0;this[_0xe3d5('0x0')]=_0x48540d[_0xe3d5('0x0')]||'';this[_0xe3d5('0x1')]=_0x48540d[_0xe3d5('0x1')]||'';this[_0xe3d5('0x2')]=_0x48540d[_0xe3d5('0x2')]||'';this[_0xe3d5('0x3')]=_0x48540d[_0xe3d5('0x3')]||'';this[_0xe3d5('0x4')]=_0x48540d['tenantId']||'';this['clientId']=_0x48540d[_0xe3d5('0x5')]||'';this['clientSecret']=_0x48540d[_0xe3d5('0x6')]||{};this[_0xe3d5('0x7')]=_0x48540d[_0xe3d5('0x7')]||'';this['modernAuthentication']=_0x48540d[_0xe3d5('0x8')]||![];this[_0xe3d5('0x9')]=_0x48540d[_0xe3d5('0x9')]||{};this['CloudProvider']=_0x48540d[_0xe3d5('0xa')]||{};}module[_0xe3d5('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e2da8c7..69bf11c 100644 --- a/server/services/ami/model/faxAccount.js +++ b/server/services/ami/model/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf207=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x5aa8bf,_0x29c3dd){var _0x2b1d09=function(_0x16c7ce){while(--_0x16c7ce){_0x5aa8bf['push'](_0x5aa8bf['shift']());}};_0x2b1d09(++_0x29c3dd);}(_0xf207,0x13b));var _0x7f20=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xf207[_0x1d211b];return _0x47c88b;};'use strict';function FaxAccount(_0x52d700){this['id']=_0x52d700['id']||0x0;this['name']=_0x52d700[_0x7f20('0x0')]||'';this[_0x7f20('0x1')]=_0x52d700['description'];this[_0x7f20('0x2')]=_0x52d700[_0x7f20('0x2')];this[_0x7f20('0x3')]=_0x52d700[_0x7f20('0x3')];this[_0x7f20('0x4')]=_0x52d700[_0x7f20('0x4')];this['minrate']=_0x52d700[_0x7f20('0x5')]||0x960;this[_0x7f20('0x6')]=_0x52d700[_0x7f20('0x6')]||0x3840;this[_0x7f20('0x7')]=_0x52d700[_0x7f20('0x7')]||_0x7f20('0x8');this[_0x7f20('0x9')]=_0x52d700[_0x7f20('0x9')]||'no';this[_0x7f20('0xa')]=_0x52d700[_0x7f20('0xa')]||'no';this['t38timeout']=_0x52d700[_0x7f20('0xb')]||0x1388;this[_0x7f20('0xc')]=_0x52d700[_0x7f20('0xc')]||_0x7f20('0xd');this[_0x7f20('0xe')]=_0x52d700['Trunk']?_0x52d700[_0x7f20('0xe')]:undefined;this[_0x7f20('0xf')]=_0x52d700[_0x7f20('0xf')];this[_0x7f20('0x10')]=_0x52d700[_0x7f20('0x10')];}module[_0x7f20('0x11')]=FaxAccount; \ No newline at end of file +var _0xa7a0=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo'];(function(_0x3c0e33,_0x4e9903){var _0x48d10c=function(_0x227823){while(--_0x227823){_0x3c0e33['push'](_0x3c0e33['shift']());}};_0x48d10c(++_0x4e9903);}(_0xa7a0,0x183));var _0x0a7a=function(_0x262bd7,_0xad262d){_0x262bd7=_0x262bd7-0x0;var _0x7b549e=_0xa7a0[_0x262bd7];return _0x7b549e;};'use strict';function FaxAccount(_0x304e8f){this['id']=_0x304e8f['id']||0x0;this[_0x0a7a('0x0')]=_0x304e8f[_0x0a7a('0x0')]||'';this[_0x0a7a('0x1')]=_0x304e8f[_0x0a7a('0x1')];this[_0x0a7a('0x2')]=_0x304e8f['ecm'];this[_0x0a7a('0x3')]=_0x304e8f[_0x0a7a('0x3')];this['localstationid']=_0x304e8f[_0x0a7a('0x4')];this[_0x0a7a('0x5')]=_0x304e8f[_0x0a7a('0x5')]||0x960;this[_0x0a7a('0x6')]=_0x304e8f[_0x0a7a('0x6')]||0x3840;this[_0x0a7a('0x7')]=_0x304e8f['modem']||_0x0a7a('0x8');this[_0x0a7a('0x9')]=_0x304e8f[_0x0a7a('0x9')]||'no';this[_0x0a7a('0xa')]=_0x304e8f[_0x0a7a('0xa')]||'no';this['t38timeout']=_0x304e8f[_0x0a7a('0xb')]||0x1388;this[_0x0a7a('0xc')]=_0x304e8f[_0x0a7a('0xc')]||_0x0a7a('0xd');this[_0x0a7a('0xe')]=_0x304e8f['Trunk']?_0x304e8f[_0x0a7a('0xe')]:undefined;this[_0x0a7a('0xf')]=_0x304e8f[_0x0a7a('0xf')];this[_0x0a7a('0x10')]=_0x304e8f[_0x0a7a('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 560cdbc..3f1ea35 100644 --- a/server/services/ami/model/freshdeskAccount.js +++ b/server/services/ami/model/freshdeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41d8=['serverUrl','Configurations','exports','name','username','token'];(function(_0x384d7b,_0x2475bf){var _0x389b7e=function(_0x1f1454){while(--_0x1f1454){_0x384d7b['push'](_0x384d7b['shift']());}};_0x389b7e(++_0x2475bf);}(_0x41d8,0xe7));var _0x841d=function(_0x27973c,_0x2d8b16){_0x27973c=_0x27973c-0x0;var _0x2ef123=_0x41d8[_0x27973c];return _0x2ef123;};'use strict';function FreshdeskAccount(_0x2e5044){this['id']=_0x2e5044['id']||0x0;this[_0x841d('0x0')]=_0x2e5044[_0x841d('0x0')]||'';this[_0x841d('0x1')]=_0x2e5044[_0x841d('0x1')]||'';this['apiKey']=_0x2e5044[_0x841d('0x2')]||'';this['remoteUri']=_0x2e5044['remoteUri']||'';this['serverUrl']=_0x2e5044[_0x841d('0x3')]||'';this[_0x841d('0x4')]=_0x2e5044[_0x841d('0x4')]||{};}module[_0x841d('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xd40b=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x265d31,_0x5dbbb0){var _0x162f48=function(_0x3b314d){while(--_0x3b314d){_0x265d31['push'](_0x265d31['shift']());}};_0x162f48(++_0x5dbbb0);}(_0xd40b,0x1cc));var _0xbd40=function(_0x44e677,_0x7b9445){_0x44e677=_0x44e677-0x0;var _0x3f9881=_0xd40b[_0x44e677];return _0x3f9881;};'use strict';function FreshdeskAccount(_0x17135f){this['id']=_0x17135f['id']||0x0;this[_0xbd40('0x0')]=_0x17135f[_0xbd40('0x0')]||'';this[_0xbd40('0x1')]=_0x17135f['username']||'';this[_0xbd40('0x2')]=_0x17135f[_0xbd40('0x3')]||'';this[_0xbd40('0x4')]=_0x17135f[_0xbd40('0x4')]||'';this[_0xbd40('0x5')]=_0x17135f[_0xbd40('0x5')]||'';this['Configurations']=_0x17135f[_0xbd40('0x6')]||{};}module[_0xbd40('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 9c51fbe..cc1b540 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37cc=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x32f7de,_0x2c2557){var _0x49ebd0=function(_0x366844){while(--_0x366844){_0x32f7de['push'](_0x32f7de['shift']());}};_0x49ebd0(++_0x2c2557);}(_0x37cc,0x185));var _0xc37c=function(_0x511e19,_0x25a151){_0x511e19=_0x511e19-0x0;var _0x19260f=_0x37cc[_0x511e19];return _0x19260f;};'use strict';function FreshsalesAccount(_0x4c4cbb){this['id']=_0x4c4cbb['id']||0x0;this[_0xc37c('0x0')]=_0x4c4cbb[_0xc37c('0x0')]||'';this[_0xc37c('0x1')]=_0x4c4cbb[_0xc37c('0x1')]||'';this[_0xc37c('0x2')]=_0x4c4cbb['token']||'';this['remoteUri']=_0x4c4cbb[_0xc37c('0x3')]||'';this[_0xc37c('0x4')]=_0x4c4cbb[_0xc37c('0x4')]||'';this[_0xc37c('0x5')]=_0x4c4cbb[_0xc37c('0x5')]||{};}module[_0xc37c('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x4cfd=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x407f7e,_0x3ab637){var _0x58826d=function(_0x4b4ebb){while(--_0x4b4ebb){_0x407f7e['push'](_0x407f7e['shift']());}};_0x58826d(++_0x3ab637);}(_0x4cfd,0x170));var _0xd4cf=function(_0x470b0a,_0x2889d6){_0x470b0a=_0x470b0a-0x0;var _0x4463f6=_0x4cfd[_0x470b0a];return _0x4463f6;};'use strict';function FreshsalesAccount(_0x2adf32){this['id']=_0x2adf32['id']||0x0;this[_0xd4cf('0x0')]=_0x2adf32['name']||'';this[_0xd4cf('0x1')]=_0x2adf32[_0xd4cf('0x1')]||'';this[_0xd4cf('0x2')]=_0x2adf32[_0xd4cf('0x3')]||'';this[_0xd4cf('0x4')]=_0x2adf32[_0xd4cf('0x4')]||'';this['serverUrl']=_0x2adf32[_0xd4cf('0x5')]||'';this[_0xd4cf('0x6')]=_0x2adf32[_0xd4cf('0x6')]||{};}module[_0xd4cf('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7b1d34f..cfc70e9 100644 --- a/server/services/ami/model/queueReport.js +++ b/server/services/ami/model/queueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd6d=['calleridname','queue','queuecallerleaveAt','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','mohtime','variables','exports','type','inbound'];(function(_0x33b0e2,_0x3bbcc8){var _0x58ae57=function(_0xe8238d){while(--_0xe8238d){_0x33b0e2['push'](_0x33b0e2['shift']());}};_0x58ae57(++_0x3bbcc8);}(_0xcd6d,0xcd));var _0xdcd6=function(_0x19a10c,_0x2a1a77){_0x19a10c=_0x19a10c-0x0;var _0x385bf4=_0xcd6d[_0x19a10c];return _0x385bf4;};'use strict';function QueueReport(){this[_0xdcd6('0x0')]=_0xdcd6('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xdcd6('0x2')]='';this[_0xdcd6('0x3')]='';this['queuecallerjoinAt']=null;this[_0xdcd6('0x4')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xdcd6('0x5')]=null;this[_0xdcd6('0x6')]=![];this['queuecallercompleteAt']=null;this[_0xdcd6('0x7')]=![];this[_0xdcd6('0x8')]=null;this[_0xdcd6('0x9')]=0x1;this[_0xdcd6('0xa')]='';this[_0xdcd6('0xb')]='';this[_0xdcd6('0xc')]='';this[_0xdcd6('0xd')]='';this[_0xdcd6('0xe')]='';this[_0xdcd6('0xf')]='';this[_0xdcd6('0x10')]='';this[_0xdcd6('0x11')]=0x0;this['assigned']=![];this[_0xdcd6('0x12')]='';this[_0xdcd6('0x13')]='voice';this['routealias']=null;this[_0xdcd6('0x14')]=0x0;this[_0xdcd6('0x15')]={};}module[_0xdcd6('0x16')]=QueueReport; \ No newline at end of file +var _0xfc38=['mohtime','variables','exports','type','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','lastAssignedTo','voice','routealias'];(function(_0x1b7d81,_0x5cb6a8){var _0x459fc5=function(_0x3a4f84){while(--_0x3a4f84){_0x1b7d81['push'](_0x1b7d81['shift']());}};_0x459fc5(++_0x5cb6a8);}(_0xfc38,0xf3));var _0x8fc3=function(_0x2cf61a,_0x3ae8bf){_0x2cf61a=_0x2cf61a-0x0;var _0x4ed7de=_0xfc38[_0x2cf61a];return _0x4ed7de;};'use strict';function QueueReport(){this[_0x8fc3('0x0')]=_0x8fc3('0x1');this[_0x8fc3('0x2')]='';this['calleridnum']='';this[_0x8fc3('0x3')]='';this['queue']='';this[_0x8fc3('0x4')]=null;this[_0x8fc3('0x5')]=null;this[_0x8fc3('0x6')]=0x1;this[_0x8fc3('0x7')]=0x1;this[_0x8fc3('0x8')]=![];this[_0x8fc3('0x9')]=null;this[_0x8fc3('0xa')]=![];this[_0x8fc3('0xb')]=null;this[_0x8fc3('0xc')]=![];this[_0x8fc3('0xd')]=null;this[_0x8fc3('0xe')]=0x1;this['channel']='';this[_0x8fc3('0xf')]='';this['connectedlinename']='';this[_0x8fc3('0x10')]='';this[_0x8fc3('0x11')]='';this['exten']='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0x8fc3('0x12')]='';this['motionChannel']=_0x8fc3('0x13');this[_0x8fc3('0x14')]=null;this[_0x8fc3('0x15')]=0x0;this[_0x8fc3('0x16')]={};}module[_0x8fc3('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index decbfb3..cd9c5d2 100644 --- a/server/services/ami/model/salesforceAccount.js +++ b/server/services/ami/model/salesforceAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x070f=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x070f,0x13a));var _0xf070=function(_0x430884,_0x1bd0bb){_0x430884=_0x430884-0x0;var _0x2cccd8=_0x070f[_0x430884];return _0x2cccd8;};'use strict';function SalesforceAccount(_0x1253e6){this['id']=_0x1253e6['id']||0x0;this['name']=_0x1253e6[_0xf070('0x0')]||'';this['username']=_0x1253e6[_0xf070('0x1')]||'';this[_0xf070('0x2')]=_0x1253e6[_0xf070('0x2')]||'';this[_0xf070('0x3')]=_0x1253e6[_0xf070('0x3')]||'';this[_0xf070('0x4')]=_0x1253e6['clientId']||'';this[_0xf070('0x5')]=_0x1253e6['clientSecret']||'';this['securityToken']=_0x1253e6['securityToken']||'';this[_0xf070('0x6')]=_0x1253e6['type']||_0xf070('0x7');this[_0xf070('0x8')]=_0x1253e6['serverUrl']||'';this['Configurations']=_0x1253e6[_0xf070('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xef0a=['clientSecret','securityToken','type','integrationTab','serverUrl','exports','name','username','remoteUri','password','clientId'];(function(_0x53b106,_0x122955){var _0xf75414=function(_0x44e0e7){while(--_0x44e0e7){_0x53b106['push'](_0x53b106['shift']());}};_0xf75414(++_0x122955);}(_0xef0a,0x1a8));var _0xaef0=function(_0x3cf5c5,_0x456c4b){_0x3cf5c5=_0x3cf5c5-0x0;var _0x3c06ba=_0xef0a[_0x3cf5c5];return _0x3c06ba;};'use strict';function SalesforceAccount(_0x48f58a){this['id']=_0x48f58a['id']||0x0;this[_0xaef0('0x0')]=_0x48f58a[_0xaef0('0x0')]||'';this[_0xaef0('0x1')]=_0x48f58a[_0xaef0('0x1')]||'';this['remoteUri']=_0x48f58a[_0xaef0('0x2')]||'';this['password']=_0x48f58a[_0xaef0('0x3')]||'';this[_0xaef0('0x4')]=_0x48f58a['clientId']||'';this[_0xaef0('0x5')]=_0x48f58a[_0xaef0('0x5')]||'';this[_0xaef0('0x6')]=_0x48f58a['securityToken']||'';this[_0xaef0('0x7')]=_0x48f58a[_0xaef0('0x7')]||_0xaef0('0x8');this[_0xaef0('0x9')]=_0x48f58a[_0xaef0('0x9')]||'';this['Configurations']=_0x48f58a['Configurations']||{};}module[_0xaef0('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 262d595..1ac1cb4 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe20=['password','remoteUri','serverUrl','exports','name','username'];(function(_0x5bb20a,_0x4612f0){var _0x25a9ee=function(_0x5886e9){while(--_0x5886e9){_0x5bb20a['push'](_0x5bb20a['shift']());}};_0x25a9ee(++_0x4612f0);}(_0xbe20,0xe8));var _0x0be2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbe20[_0x14add3];return _0x4a174f;};'use strict';function ServicenowAccount(_0x474297){this['id']=_0x474297['id']||0x0;this[_0x0be2('0x0')]=_0x474297[_0x0be2('0x0')]||'';this[_0x0be2('0x1')]=_0x474297[_0x0be2('0x1')]||'';this['password']=_0x474297[_0x0be2('0x2')]||'';this[_0x0be2('0x3')]=_0x474297[_0x0be2('0x3')]||'';this[_0x0be2('0x4')]=_0x474297[_0x0be2('0x4')]||'';this['Configurations']=_0x474297['Configurations']||{};}module[_0x0be2('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x0482=['Configurations','name','username','password','remoteUri'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0482,0x128));var _0x2048=function(_0x2f888d,_0x597d3c){_0x2f888d=_0x2f888d-0x0;var _0x40f285=_0x0482[_0x2f888d];return _0x40f285;};'use strict';function ServicenowAccount(_0x530186){this['id']=_0x530186['id']||0x0;this[_0x2048('0x0')]=_0x530186[_0x2048('0x0')]||'';this[_0x2048('0x1')]=_0x530186[_0x2048('0x1')]||'';this[_0x2048('0x2')]=_0x530186['password']||'';this[_0x2048('0x3')]=_0x530186[_0x2048('0x3')]||'';this['serverUrl']=_0x530186['serverUrl']||'';this['Configurations']=_0x530186[_0x2048('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b4aa413..acc4afb 100644 --- a/server/services/ami/model/sugarcrmAccount.js +++ b/server/services/ami/model/sugarcrmAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8f4=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x5a4027,_0x1bc3d3){var _0x14cad6=function(_0x3fc5f6){while(--_0x3fc5f6){_0x5a4027['push'](_0x5a4027['shift']());}};_0x14cad6(++_0x1bc3d3);}(_0xd8f4,0x119));var _0x4d8f=function(_0x3b789a,_0x24f09c){_0x3b789a=_0x3b789a-0x0;var _0x531fa1=_0xd8f4[_0x3b789a];return _0x531fa1;};'use strict';function SugarcrmAccount(_0x566d68){this['id']=_0x566d68['id']||0x0;this[_0x4d8f('0x0')]=_0x566d68[_0x4d8f('0x0')]||'';this[_0x4d8f('0x1')]=_0x566d68[_0x4d8f('0x1')]||'';this[_0x4d8f('0x2')]=_0x566d68[_0x4d8f('0x2')]||'';this[_0x4d8f('0x3')]=_0x566d68[_0x4d8f('0x3')]||'';this[_0x4d8f('0x4')]=_0x566d68['serverUrl']||'';this[_0x4d8f('0x5')]=_0x566d68[_0x4d8f('0x5')]||{};}module[_0x4d8f('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x76f1=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4d9380,_0x405327){var _0x2450cf=function(_0x46a6f1){while(--_0x46a6f1){_0x4d9380['push'](_0x4d9380['shift']());}};_0x2450cf(++_0x405327);}(_0x76f1,0x83));var _0x176f=function(_0x59acfd,_0x5d50ec){_0x59acfd=_0x59acfd-0x0;var _0x6e789e=_0x76f1[_0x59acfd];return _0x6e789e;};'use strict';function SugarcrmAccount(_0x59fa8b){this['id']=_0x59fa8b['id']||0x0;this[_0x176f('0x0')]=_0x59fa8b['name']||'';this[_0x176f('0x1')]=_0x59fa8b[_0x176f('0x1')]||'';this[_0x176f('0x2')]=_0x59fa8b['password']||'';this[_0x176f('0x3')]=_0x59fa8b[_0x176f('0x3')]||'';this[_0x176f('0x4')]=_0x59fa8b[_0x176f('0x4')]||'';this['Configurations']=_0x59fa8b[_0x176f('0x5')]||{};}module[_0x176f('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 8eb05b5..a503c99 100644 --- a/server/services/ami/model/telephone.js +++ b/server/services/ami/model/telephone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe903=['status','address','exports','name','accountcode','unknown','stateTime'];(function(_0x45be52,_0x46d496){var _0x15294f=function(_0x3fa77d){while(--_0x3fa77d){_0x45be52['push'](_0x45be52['shift']());}};_0x15294f(++_0x46d496);}(_0xe903,0x17d));var _0x3e90=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe903[_0x4dbaad];return _0x226c72;};'use strict';function Telephone(_0x2a1d00){this['id']=_0x2a1d00['id']||0x0;this[_0x3e90('0x0')]=_0x2a1d00[_0x3e90('0x0')]||'';this[_0x3e90('0x1')]=_0x2a1d00[_0x3e90('0x1')]||'';this['state']=_0x3e90('0x2');this[_0x3e90('0x3')]=0x0;this[_0x3e90('0x4')]=_0x3e90('0x2');this[_0x3e90('0x5')]='';}module[_0x3e90('0x6')]=Telephone; \ No newline at end of file +var _0x0713=['exports','name','accountcode','state','unknown','status','address'];(function(_0x340237,_0x343493){var _0x286a89=function(_0x7df819){while(--_0x7df819){_0x340237['push'](_0x340237['shift']());}};_0x286a89(++_0x343493);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x4bf247){this['id']=_0x4bf247['id']||0x0;this['name']=_0x4bf247[_0x3071('0x0')]||'';this[_0x3071('0x1')]=_0x4bf247[_0x3071('0x1')]||'';this[_0x3071('0x2')]=_0x3071('0x3');this['stateTime']=0x0;this[_0x3071('0x4')]=_0x3071('0x3');this[_0x3071('0x5')]='';}module[_0x3071('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0b46066..90d496e 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x50da1c,_0xc63b4a){var _0x44f76c=function(_0x5ac2f4){while(--_0x5ac2f4){_0x50da1c['push'](_0x50da1c['shift']());}};_0x44f76c(++_0xc63b4a);}(_0xb10b,0x12a));var _0xbb10=function(_0x477b8a,_0x2a198d){_0x477b8a=_0x477b8a-0x0;var _0x4183f9=_0xb10b[_0x477b8a];return _0x4183f9;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1732cc,_0x5df889){var _0x4ff993=function(_0x18702b){while(--_0x18702b){_0x1732cc['push'](_0x1732cc['shift']());}};_0x4ff993(++_0x5df889);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index a52022b..9d482b8 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x5529be,_0x50c829){var _0x3b1116=function(_0x24062c){while(--_0x24062c){_0x5529be['push'](_0x5529be['shift']());}};_0x3b1116(++_0x50c829);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b43c0,_0x3a8091){_0x4b43c0=_0x4b43c0-0x0;var _0x574c13=_0xb10b[_0x4b43c0];return _0x574c13;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x358155,_0x427759){var _0x1f6aa9=function(_0x4bcd2c){while(--_0x4bcd2c){_0x358155['push'](_0x358155['shift']());}};_0x1f6aa9(++_0x427759);}(_0x14a0,0x8e));var _0x014a=function(_0x418f0a,_0x21137f){_0x418f0a=_0x418f0a-0x0;var _0xa6b49=_0x14a0[_0x418f0a];return _0xa6b49;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index fbc7253..cf774ab 100644 --- a/server/services/ami/model/trunk.js +++ b/server/services/ami/model/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2035=['registry','host','port','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2035,0x167));var _0x5203=function(_0x4b345f,_0x34b1cb){_0x4b345f=_0x4b345f-0x0;var _0x126048=_0x2035[_0x4b345f];return _0x126048;};'use strict';function Trunk(_0x438f05){this['id']=_0x438f05['id']||0x0;this['active']=_0x438f05[_0x5203('0x0')]||![];this[_0x5203('0x1')]=_0x438f05[_0x5203('0x1')]||'';this[_0x5203('0x2')]=_0x5203('0x3');this[_0x5203('0x4')]=0x0;this['status']=_0x5203('0x3');this[_0x5203('0x5')]=_0x438f05[_0x5203('0x5')]&&_0x438f05[_0x5203('0x5')]['indexOf'](':')?_0x438f05[_0x5203('0x5')]['split'](':')[0x0]:'';this[_0x5203('0x6')]='';this[_0x5203('0x7')]='';this['domain']='';this[_0x5203('0x8')]='';this[_0x5203('0x9')]='';this[_0x5203('0xa')]=_0x5203('0x3');this[_0x5203('0xb')]='';this['address']='';this[_0x5203('0xc')]=_0x438f05['defaultuser']||'';}module[_0x5203('0xd')]=Trunk; \ No newline at end of file +var _0x4fdd=['host','port','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','state','unknown','stateTime','status','registry','indexOf','split'];(function(_0xcafb2b,_0x2cc85e){var _0x539f9a=function(_0x9a96e6){while(--_0x9a96e6){_0xcafb2b['push'](_0xcafb2b['shift']());}};_0x539f9a(++_0x2cc85e);}(_0x4fdd,0x190));var _0xd4fd=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4fdd[_0x59ee6f];return _0x4c0979;};'use strict';function Trunk(_0x37a7b3){this['id']=_0x37a7b3['id']||0x0;this[_0xd4fd('0x0')]=_0x37a7b3['active']||![];this['name']=_0x37a7b3['name']||'';this[_0xd4fd('0x1')]=_0xd4fd('0x2');this[_0xd4fd('0x3')]=0x0;this[_0xd4fd('0x4')]=_0xd4fd('0x2');this[_0xd4fd('0x5')]=_0x37a7b3[_0xd4fd('0x5')]&&_0x37a7b3['registry'][_0xd4fd('0x6')](':')?_0x37a7b3[_0xd4fd('0x5')][_0xd4fd('0x7')](':')[0x0]:'';this[_0xd4fd('0x8')]='';this[_0xd4fd('0x9')]='';this['domain']='';this[_0xd4fd('0xa')]='';this[_0xd4fd('0xb')]='';this[_0xd4fd('0xc')]=_0xd4fd('0x2');this[_0xd4fd('0xd')]='';this[_0xd4fd('0xe')]='';this[_0xd4fd('0xf')]=_0x37a7b3[_0xd4fd('0xf')]||'';}module[_0xd4fd('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f96b4a7..6dd0a63 100644 --- a/server/services/ami/model/voiceExtension.js +++ b/server/services/ami/model/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe504=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4a2977,_0x252bd2){var _0x11a47d=function(_0x3a04dd){while(--_0x3a04dd){_0x4a2977['push'](_0x4a2977['shift']());}};_0x11a47d(++_0x252bd2);}(_0xe504,0x17e));var _0x4e50=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe504[_0x59ee6f];return _0x4c0979;};'use strict';function voiceExtension(_0x3065ae){this['id']=_0x3065ae['id']||0x0;this['exten']=_0x3065ae[_0x4e50('0x0')]||'';this[_0x4e50('0x1')]=_0x3065ae[_0x4e50('0x1')]||'none';this['mandatoryDisposition']=_0x3065ae[_0x4e50('0x2')]||![];}module[_0x4e50('0x3')]=voiceExtension; \ No newline at end of file +var _0xd0e8=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x2068ec,_0x545a78){var _0xd84464=function(_0x4734ba){while(--_0x4734ba){_0x2068ec['push'](_0x2068ec['shift']());}};_0xd84464(++_0x545a78);}(_0xd0e8,0xb6));var _0x8d0e=function(_0x5a2f40,_0x1046e2){_0x5a2f40=_0x5a2f40-0x0;var _0x3a647d=_0xd0e8[_0x5a2f40];return _0x3a647d;};'use strict';function voiceExtension(_0x39999d){this['id']=_0x39999d['id']||0x0;this[_0x8d0e('0x0')]=_0x39999d['exten']||'';this[_0x8d0e('0x1')]=_0x39999d[_0x8d0e('0x1')]||_0x8d0e('0x2');this[_0x8d0e('0x3')]=_0x39999d[_0x8d0e('0x3')]||![];}module[_0x8d0e('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 2e63fc9..fd92702 100644 --- a/server/services/ami/model/voiceQueue.js +++ b/server/services/ami/model/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0c0=['total','sumDuration','sumHoldTime','unmanaged','available','busy','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','ringall','rrmemory','rrordered','name','monitor_format','type','inbound','waiting'];(function(_0x55c634,_0x53c8e8){var _0xacd039=function(_0x16f57a){while(--_0x16f57a){_0x55c634['push'](_0x55c634['shift']());}};_0xacd039(++_0x53c8e8);}(_0xd0c0,0x75));var _0x0d0c=function(_0x57e738,_0x5422b3){_0x57e738=_0x57e738-0x0;var _0x260bbf=_0xd0c0[_0x57e738];return _0x260bbf;};'use strict';var monitorFormat={'wav':_0x0d0c('0x0'),'wav49':_0x0d0c('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x0d0c('0x2'),'leastrecent':_0x0d0c('0x3'),'linear':_0x0d0c('0x4'),'random':'random','ringall':_0x0d0c('0x5'),'rr':'roundrobin','rrmemory':_0x0d0c('0x6'),'rrordered':_0x0d0c('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x46585c){this['id']=_0x46585c['id']||0x0;this['name']=_0x46585c[_0x0d0c('0x8')]||'';this['monitor_format']=_0x46585c[_0x0d0c('0x9')]||'';this['type']=_0x46585c[_0x0d0c('0xa')]||_0x0d0c('0xb');this[_0x0d0c('0xc')]=0x0;this[_0x0d0c('0xd')]=0x0;this['answered']=0x0;this[_0x0d0c('0xe')]=0x0;this[_0x0d0c('0xf')]=0x0;this['sumBillable']=0x0;this[_0x0d0c('0x10')]=0x0;this['abandoned']=0x0;this[_0x0d0c('0x11')]=0x0;this[_0x0d0c('0x12')]=0x0;this[_0x0d0c('0x13')]=0x0;this[_0x0d0c('0x14')]=0x0;this['loggedIn']=0x0;this[_0x0d0c('0x15')]=0x0;this[_0x0d0c('0x16')]=0x0;this[_0x0d0c('0x17')]=0x0;this[_0x0d0c('0x18')]=0x0;this[_0x0d0c('0x19')]=0x0;this['talking']=0x0;this[_0x0d0c('0x1a')]=0x0;this['unknown']=0x0;this[_0x0d0c('0x1b')]=_0x46585c[_0x0d0c('0x1b')]||![];this[_0x0d0c('0x1c')]=_0x46585c[_0x0d0c('0x1c')]||0xa;this[_0x0d0c('0x1d')]=_0x46585c['autopause']||'no';this[_0x0d0c('0x1e')]=!![];this[_0x0d0c('0x1f')]='';this['statusMessage']='';this[_0x0d0c('0x20')]=0x0;this[_0x0d0c('0x21')]=0x0;this[_0x0d0c('0x22')]=_0x46585c[_0x0d0c('0x22')]||null;this[_0x0d0c('0x23')]=_0x46585c[_0x0d0c('0x23')]?_0x46585c[_0x0d0c('0x23')]:null;this[_0x0d0c('0x24')]=_0x46585c[_0x0d0c('0x24')];this[_0x0d0c('0x25')]=_0x46585c[_0x0d0c('0x25')]||_0x0d0c('0x26');this[_0x0d0c('0x27')]=_0x46585c[_0x0d0c('0x27')]||0x0;this[_0x0d0c('0x28')]=_0x46585c[_0x0d0c('0x28')]||0x0;this[_0x0d0c('0x29')]=_0x46585c[_0x0d0c('0x29')]||0x1;this[_0x0d0c('0x2a')]=_0x46585c['dialPredictiveOptimization']||'dropRate';this[_0x0d0c('0x2b')]=_0x46585c[_0x0d0c('0x2b')]||0.03;this['dialPredictiveInterval']=_0x46585c['dialPredictiveInterval']||0x258;this[_0x0d0c('0x2c')]=_0x46585c[_0x0d0c('0x2c')]||_0x0d0c('0x2d');this[_0x0d0c('0x2e')]=_0x46585c[_0x0d0c('0x2e')]||_0x0d0c('0x2d');this['dialOriginateTimeout']=_0x46585c['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x46585c[_0x0d0c('0x2f')]||_0x0d0c('0x30');this[_0x0d0c('0x31')]=_0x46585c['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x46585c[_0x0d0c('0x32')]||undefined;this[_0x0d0c('0x33')]=_0x46585c[_0x0d0c('0x33')]||0x3;this[_0x0d0c('0x34')]=_0x46585c['dialCongestionRetryFrequency']||0x96;this[_0x0d0c('0x35')]=_0x46585c[_0x0d0c('0x35')]||0x3;this[_0x0d0c('0x36')]=_0x46585c[_0x0d0c('0x36')]||0x96;this[_0x0d0c('0x37')]=_0x46585c['dialNoAnswerMaxRetry']||0x3;this[_0x0d0c('0x38')]=_0x46585c['dialNoAnswerRetryFrequency']||0x96;this[_0x0d0c('0x39')]=_0x46585c['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x46585c[_0x0d0c('0x3a')]||0x96;this[_0x0d0c('0x3b')]=_0x46585c[_0x0d0c('0x3b')]||0x3;this['dialDropRetryFrequency']=_0x46585c[_0x0d0c('0x3c')]||0x96;this[_0x0d0c('0x3d')]=_0x46585c[_0x0d0c('0x3d')]||0x3;this[_0x0d0c('0x3e')]=_0x46585c[_0x0d0c('0x3e')]||0x96;this[_0x0d0c('0x3f')]=_0x46585c[_0x0d0c('0x3f')]||0x3;this[_0x0d0c('0x40')]=_0x46585c[_0x0d0c('0x40')]||0x96;this['dialAgentRejectMaxRetry']=_0x46585c[_0x0d0c('0x41')]||0x3;this[_0x0d0c('0x42')]=_0x46585c[_0x0d0c('0x42')]||0x96;this[_0x0d0c('0x43')]=_0x46585c[_0x0d0c('0x43')]||0x3;this[_0x0d0c('0x44')]=_0x46585c[_0x0d0c('0x44')]||0x4;this[_0x0d0c('0x45')]=_0x46585c['Trunk']?_0x46585c[_0x0d0c('0x45')]:undefined;this[_0x0d0c('0x46')]=_0x46585c[_0x0d0c('0x46')]?_0x46585c[_0x0d0c('0x46')]:undefined;this[_0x0d0c('0x47')]=_0x46585c[_0x0d0c('0x47')]||undefined;this[_0x0d0c('0x48')]=_0x46585c[_0x0d0c('0x48')]?_0x46585c[_0x0d0c('0x48')]:undefined;this[_0x0d0c('0x49')]=_0x46585c[_0x0d0c('0x49')]||_0x0d0c('0x4a');this[_0x0d0c('0x4b')]=_0x46585c[_0x0d0c('0x4b')]||undefined;this['dialCutDigit']=_0x46585c[_0x0d0c('0x4c')]||undefined;this[_0x0d0c('0x4d')]=strategy[_0x46585c[_0x0d0c('0x4d')]];this[_0x0d0c('0x4e')]=!![];this['dialAMDActive']=_0x46585c[_0x0d0c('0x4f')]||![];this['dialAMDInitialSilence']=_0x46585c[_0x0d0c('0x50')];this['dialAMDGreeting']=_0x46585c[_0x0d0c('0x51')];this[_0x0d0c('0x52')]=_0x46585c[_0x0d0c('0x52')];this[_0x0d0c('0x53')]=_0x46585c[_0x0d0c('0x53')];this[_0x0d0c('0x54')]=_0x46585c[_0x0d0c('0x54')];this[_0x0d0c('0x55')]=_0x46585c[_0x0d0c('0x55')];this[_0x0d0c('0x56')]=_0x46585c[_0x0d0c('0x56')];this[_0x0d0c('0x57')]=_0x46585c[_0x0d0c('0x57')];this[_0x0d0c('0x58')]=_0x46585c['dialAMDMaximumWordLength'];this[_0x0d0c('0x59')]=0x0;this[_0x0d0c('0x5a')]=0x0;this[_0x0d0c('0x5b')]=_0x46585c[_0x0d0c('0x5b')];this['outboundAnswerCallsDay']=0x0;this[_0x0d0c('0x5c')]=0x0;this[_0x0d0c('0x5d')]=0x0;this[_0x0d0c('0x5e')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0d0c('0x5f')]=0x0;this[_0x0d0c('0x60')]=0x0;this[_0x0d0c('0x61')]=0x0;this[_0x0d0c('0x62')]=0x0;this[_0x0d0c('0x63')]=0x0;this[_0x0d0c('0x64')]=0x0;this[_0x0d0c('0x65')]=0x0;this[_0x0d0c('0x66')]=0x0;this[_0x0d0c('0x67')]=0x0;this[_0x0d0c('0x68')]=undefined;this[_0x0d0c('0x69')]=undefined;this[_0x0d0c('0x6a')]=undefined;this[_0x0d0c('0x6b')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x0d0c('0x6c')]=0x0;this[_0x0d0c('0x6d')]=0x0;this[_0x0d0c('0x6e')]=0x0;this[_0x0d0c('0x6f')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x0d0c('0x70')]=0x0;this[_0x0d0c('0x71')]=_0x46585c['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x46585c[_0x0d0c('0x72')]||0xa;this[_0x0d0c('0x73')]=0x0;this[_0x0d0c('0x74')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x0d0c('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0x0d0c('0x76')]=0x0;this[_0x0d0c('0x77')]=0x0;this[_0x0d0c('0x78')]=_0x46585c[_0x0d0c('0x78')]||0x1e;this[_0x0d0c('0x79')]=_0x46585c['dialRecallInQueue']||![];this[_0x0d0c('0x7a')]=!!_0x46585c[_0x0d0c('0x7a')]||![];this[_0x0d0c('0x7b')]=!!_0x46585c[_0x0d0c('0x7b')]||![];this[_0x0d0c('0x7c')]=_0x46585c[_0x0d0c('0x7c')]||undefined;this['dialAgiAfterHangupClient']=_0x46585c['dialAgiAfterHangupClient']||![];this[_0x0d0c('0x7d')]=_0x46585c['dialAgiAfterHangupAgent']||![];this[_0x0d0c('0x9')]=monitorFormat[_0x46585c[_0x0d0c('0x9')]]?monitorFormat[_0x46585c[_0x0d0c('0x9')]]:undefined;this[_0x0d0c('0x7e')]=_0x46585c[_0x0d0c('0x7e')]||![];this[_0x0d0c('0x7f')]=_0x46585c[_0x0d0c('0x7f')]?_0x46585c['mandatoryDispositionPause']:undefined;this[_0x0d0c('0x80')]=![];}module[_0x0d0c('0x81')]=VoiceQueue; \ No newline at end of file +var _0xb924=['mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','unavailable','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xb924,0x87));var _0x4b92=function(_0x34d8f1,_0xcf1a9d){_0x34d8f1=_0x34d8f1-0x0;var _0x584c95=_0xb924[_0x34d8f1];return _0x584c95;};'use strict';var monitorFormat={'wav':_0x4b92('0x0'),'wav49':_0x4b92('0x1'),'gsm':_0x4b92('0x2')};var strategy={'fewestcalls':_0x4b92('0x3'),'leastrecent':_0x4b92('0x4'),'linear':_0x4b92('0x5'),'random':'random','ringall':'ringall','rr':_0x4b92('0x6'),'rrmemory':_0x4b92('0x7'),'rrordered':_0x4b92('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x4218a2){this['id']=_0x4218a2['id']||0x0;this[_0x4b92('0x9')]=_0x4218a2[_0x4b92('0x9')]||'';this[_0x4b92('0xa')]=_0x4218a2['monitor_format']||'';this[_0x4b92('0xb')]=_0x4218a2['type']||_0x4b92('0xc');this[_0x4b92('0xd')]=0x0;this[_0x4b92('0xe')]=0x0;this[_0x4b92('0xf')]=0x0;this[_0x4b92('0x10')]=0x0;this[_0x4b92('0x11')]=0x0;this['sumBillable']=0x0;this[_0x4b92('0x12')]=0x0;this[_0x4b92('0x13')]=0x0;this['available']=0x0;this[_0x4b92('0x14')]=0x0;this['inUse']=0x0;this[_0x4b92('0x15')]=0x0;this[_0x4b92('0x16')]=0x0;this[_0x4b92('0x17')]=0x0;this[_0x4b92('0x18')]=0x0;this[_0x4b92('0x19')]=0x0;this[_0x4b92('0x1a')]=0x0;this['ringInUse']=0x0;this['talking']=0x0;this[_0x4b92('0x1b')]=0x0;this['unknown']=0x0;this['acw']=_0x4218a2[_0x4b92('0x1c')]||![];this[_0x4b92('0x1d')]=_0x4218a2['acwTimeout']||0xa;this[_0x4b92('0x1e')]=_0x4218a2[_0x4b92('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0x4b92('0x1f')]='';this[_0x4b92('0x20')]='';this[_0x4b92('0x21')]=0x0;this[_0x4b92('0x22')]=0x0;this[_0x4b92('0x23')]=_0x4218a2[_0x4b92('0x23')]||null;this['dialGlobalInterval']=_0x4218a2[_0x4b92('0x24')]?_0x4218a2[_0x4b92('0x24')]:null;this[_0x4b92('0x25')]=_0x4218a2[_0x4b92('0x25')];this[_0x4b92('0x26')]=_0x4218a2[_0x4b92('0x26')]||_0x4b92('0x27');this[_0x4b92('0x28')]=_0x4218a2[_0x4b92('0x28')]||0x0;this[_0x4b92('0x29')]=_0x4218a2[_0x4b92('0x29')]||0x0;this[_0x4b92('0x2a')]=_0x4218a2[_0x4b92('0x2a')]||0x1;this[_0x4b92('0x2b')]=_0x4218a2[_0x4b92('0x2b')]||_0x4b92('0x2c');this[_0x4b92('0x2d')]=_0x4218a2[_0x4b92('0x2d')]||0.03;this[_0x4b92('0x2e')]=_0x4218a2[_0x4b92('0x2e')]||0x258;this['dialOriginateCallerIdName']=_0x4218a2[_0x4b92('0x2f')]||'anonymous';this[_0x4b92('0x30')]=_0x4218a2['dialOriginateCallerIdNumber']||_0x4b92('0x31');this[_0x4b92('0x32')]=_0x4218a2[_0x4b92('0x32')]||0x1e;this[_0x4b92('0x33')]=_0x4218a2['dialQueueOptions']||_0x4b92('0x34');this['dialQueueTimeout']=_0x4218a2[_0x4b92('0x35')]||0x3;this[_0x4b92('0x36')]=_0x4218a2[_0x4b92('0x36')]||undefined;this['dialCongestionMaxRetry']=_0x4218a2[_0x4b92('0x37')]||0x3;this['dialCongestionRetryFrequency']=_0x4218a2[_0x4b92('0x38')]||0x96;this[_0x4b92('0x39')]=_0x4218a2[_0x4b92('0x39')]||0x3;this[_0x4b92('0x3a')]=_0x4218a2[_0x4b92('0x3a')]||0x96;this[_0x4b92('0x3b')]=_0x4218a2[_0x4b92('0x3b')]||0x3;this[_0x4b92('0x3c')]=_0x4218a2[_0x4b92('0x3c')]||0x96;this[_0x4b92('0x3d')]=_0x4218a2[_0x4b92('0x3d')]||0x3;this[_0x4b92('0x3e')]=_0x4218a2[_0x4b92('0x3e')]||0x96;this[_0x4b92('0x3f')]=_0x4218a2[_0x4b92('0x3f')]||0x3;this['dialDropRetryFrequency']=_0x4218a2[_0x4b92('0x40')]||0x96;this[_0x4b92('0x41')]=_0x4218a2[_0x4b92('0x41')]||0x3;this[_0x4b92('0x42')]=_0x4218a2[_0x4b92('0x42')]||0x96;this[_0x4b92('0x43')]=_0x4218a2['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x4218a2[_0x4b92('0x44')]||0x96;this[_0x4b92('0x45')]=_0x4218a2[_0x4b92('0x45')]||0x3;this[_0x4b92('0x46')]=_0x4218a2[_0x4b92('0x46')]||0x96;this['callAdditionalPhoneAfterMin']=_0x4218a2[_0x4b92('0x47')]||0x3;this['dialGlobalMaxRetry']=_0x4218a2[_0x4b92('0x48')]||0x4;this[_0x4b92('0x49')]=_0x4218a2[_0x4b92('0x49')]?_0x4218a2[_0x4b92('0x49')]:undefined;this['TrunkBackup']=_0x4218a2[_0x4b92('0x4a')]?_0x4218a2[_0x4b92('0x4a')]:undefined;this[_0x4b92('0x4b')]=_0x4218a2[_0x4b92('0x4b')]||undefined;this[_0x4b92('0x4c')]=_0x4218a2[_0x4b92('0x4c')]?_0x4218a2['Interval']:undefined;this['dialOrderByScheduledAt']=_0x4218a2[_0x4b92('0x4d')]||_0x4b92('0x4e');this[_0x4b92('0x4f')]=_0x4218a2[_0x4b92('0x4f')]||undefined;this['dialCutDigit']=_0x4218a2['dialCutDigit']||undefined;this[_0x4b92('0x50')]=strategy[_0x4218a2[_0x4b92('0x50')]];this[_0x4b92('0x51')]=!![];this[_0x4b92('0x52')]=_0x4218a2[_0x4b92('0x52')]||![];this[_0x4b92('0x53')]=_0x4218a2[_0x4b92('0x53')];this[_0x4b92('0x54')]=_0x4218a2[_0x4b92('0x54')];this['dialAMDAfterGreetingSilence']=_0x4218a2[_0x4b92('0x55')];this[_0x4b92('0x56')]=_0x4218a2['dialAMDTotalAnalysisTime'];this[_0x4b92('0x57')]=_0x4218a2[_0x4b92('0x57')];this[_0x4b92('0x58')]=_0x4218a2[_0x4b92('0x58')];this['dialAMDMaximumNumberOfWords']=_0x4218a2[_0x4b92('0x59')];this[_0x4b92('0x5a')]=_0x4218a2[_0x4b92('0x5a')];this[_0x4b92('0x5b')]=_0x4218a2['dialAMDMaximumWordLength'];this[_0x4b92('0x5c')]=0x0;this['pTalking']=0x0;this['timeout']=_0x4218a2[_0x4b92('0x5d')];this[_0x4b92('0x5e')]=0x0;this[_0x4b92('0x5f')]=0x0;this[_0x4b92('0x60')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x4b92('0x61')]=0x0;this[_0x4b92('0x62')]=0x0;this[_0x4b92('0x63')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x4b92('0x64')]=0x0;this[_0x4b92('0x65')]=0x0;this[_0x4b92('0x66')]=0x0;this[_0x4b92('0x67')]=0x0;this['outboundReCallsDay']=0x0;this[_0x4b92('0x68')]=0x0;this[_0x4b92('0x69')]=undefined;this[_0x4b92('0x6a')]=undefined;this['handlePredictive']=undefined;this[_0x4b92('0x6b')]=1.05;this[_0x4b92('0x6c')]=0x0;this[_0x4b92('0x6d')]=0x0;this[_0x4b92('0x6e')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x4b92('0x6f')]=0x0;this[_0x4b92('0x70')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x4b92('0x71')]=0x0;this[_0x4b92('0x72')]=_0x4218a2[_0x4b92('0x73')]||0x14;this[_0x4b92('0x74')]=_0x4218a2[_0x4b92('0x73')]||0xa;this[_0x4b92('0x75')]=0x0;this[_0x4b92('0x76')]=0x0;this[_0x4b92('0x77')]=0x1;this[_0x4b92('0x78')]=0x0;this['erlangCallToSecond']=0x0;this[_0x4b92('0x79')]=0x0;this[_0x4b92('0x7a')]=0x0;this[_0x4b92('0x7b')]=_0x4218a2['dialRecallMeTimeout']||0x1e;this[_0x4b92('0x7c')]=_0x4218a2[_0x4b92('0x7c')]||![];this['dialPreviewAutoRecallMe']=!!_0x4218a2['dialPreviewAutoRecallMe']||![];this[_0x4b92('0x7d')]=!!_0x4218a2['dialPreviewRecallmeReminder']||![];this[_0x4b92('0x7e')]=_0x4218a2[_0x4b92('0x7e')]||undefined;this[_0x4b92('0x7f')]=_0x4218a2[_0x4b92('0x7f')]||![];this['dialAgiAfterHangupAgent']=_0x4218a2[_0x4b92('0x80')]||![];this[_0x4b92('0xa')]=monitorFormat[_0x4218a2[_0x4b92('0xa')]]?monitorFormat[_0x4218a2['monitor_format']]:undefined;this['mandatoryDisposition']=_0x4218a2[_0x4b92('0x81')]||![];this['mandatoryDispositionPause']=_0x4218a2[_0x4b92('0x82')]?_0x4218a2[_0x4b92('0x82')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x4b92('0x83')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 36a77cb..5d18db0 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49fe=['outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','total','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','paused','ringing','ringInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','incall','includes','status','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','exports','available','loggedIn','loggedInDb','talking','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay'];(function(_0x338831,_0xd98428){var _0x2eb1f0=function(_0x2d0932){while(--_0x2d0932){_0x338831['push'](_0x338831['shift']());}};_0x2eb1f0(++_0xd98428);}(_0x49fe,0x100));var _0xe49f=function(_0x1b169d,_0x3a71cd){_0x1b169d=_0x1b169d-0x0;var _0x2379c1=_0x49fe[_0x1b169d];return _0x2379c1;};'use strict';var INBOUND_COUNTERS=[_0xe49f('0x0'),_0xe49f('0x1'),_0xe49f('0x2'),'paused','ringing',_0xe49f('0x3'),'waiting'];var OUTBOUND_COUNTERS=[_0xe49f('0x0'),_0xe49f('0x4'),_0xe49f('0x5'),_0xe49f('0x1'),'loggedInDb',_0xe49f('0x6'),_0xe49f('0x7'),_0xe49f('0x8'),_0xe49f('0x9'),'outboundBusyCallsDay',_0xe49f('0xa'),_0xe49f('0xb'),_0xe49f('0xc'),_0xe49f('0xd'),_0xe49f('0xe'),'outboundUnknownCallsDay','paused',_0xe49f('0xf'),_0xe49f('0x3'),'sumBillable','sumDuration',_0xe49f('0x10'),_0xe49f('0x11')];function VoiceQueueSummary(_0x118a05){this['id']=_0x118a05['id'];this[_0xe49f('0x12')]=_0x118a05[_0xe49f('0x12')];this[_0xe49f('0x13')]=_0x118a05['strategy'];this['abandoned']=_0x118a05[_0xe49f('0x14')]||0x0;this[_0xe49f('0x4')]=_0x118a05[_0xe49f('0x4')]||0x0;this[_0xe49f('0x0')]=_0x118a05[_0xe49f('0x0')]||0x0;this['busy']=_0x118a05[_0xe49f('0x15')]||0x0;this[_0xe49f('0x5')]=_0x118a05[_0xe49f('0x5')]||0x0;this['invalid']=_0x118a05[_0xe49f('0x16')]||0x0;this[_0xe49f('0x1')]=_0x118a05[_0xe49f('0x1')]||0x0;this['loggedInDb']=_0x118a05[_0xe49f('0x2')]||0x0;this[_0xe49f('0x17')]=_0x118a05[_0xe49f('0x17')]||0x0;this[_0xe49f('0x18')]=_0x118a05[_0xe49f('0x18')]||0x0;this[_0xe49f('0x19')]=_0x118a05[_0xe49f('0x19')]||0x0;this[_0xe49f('0x1a')]=_0x118a05['ringing']||0x0;this[_0xe49f('0x1b')]=_0x118a05['ringInUse'];this[_0xe49f('0x1c')]=_0x118a05[_0xe49f('0x1c')];this[_0xe49f('0x1d')]=_0x118a05[_0xe49f('0x1d')];this[_0xe49f('0x1e')]=_0x118a05[_0xe49f('0x1e')]||0x0;this['talking']=_0x118a05[_0xe49f('0x3')]||0x0;this[_0xe49f('0x10')]=_0x118a05[_0xe49f('0x10')]||0x0;this[_0xe49f('0x1f')]=_0x118a05[_0xe49f('0x1f')];this[_0xe49f('0x20')]=_0x118a05['unavailable']||0x0;this[_0xe49f('0x21')]=_0x118a05[_0xe49f('0x21')]||0x0;this[_0xe49f('0x22')]=_0x118a05['unmanaged']||0x0;this[_0xe49f('0x11')]=_0x118a05[_0xe49f('0x11')]||0x0;if(_0x118a05[_0xe49f('0x1f')]===_0xe49f('0x23')){this[_0xe49f('0xf')]=_0x118a05['pTalking']||0x0;this[_0xe49f('0x24')]=_0x118a05[_0xe49f('0x24')];this[_0xe49f('0x25')]=_0x118a05[_0xe49f('0x25')];this[_0xe49f('0x26')]=_0x118a05['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x118a05[_0xe49f('0x27')];this[_0xe49f('0x28')]=_0x118a05[_0xe49f('0x28')];this['dialPrefix']=_0x118a05[_0xe49f('0x29')];this[_0xe49f('0x2a')]=_0x118a05[_0xe49f('0x2a')];this[_0xe49f('0x2b')]=_0x118a05[_0xe49f('0x2b')];this[_0xe49f('0x8')]=_0x118a05[_0xe49f('0x8')];this[_0xe49f('0x9')]=_0x118a05[_0xe49f('0x9')];this[_0xe49f('0x2c')]=_0x118a05[_0xe49f('0x2c')];this[_0xe49f('0xa')]=_0x118a05[_0xe49f('0xa')];this['outboundDropCallsDayACS']=_0x118a05[_0xe49f('0x2d')];this[_0xe49f('0x2e')]=_0x118a05['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x118a05[_0xe49f('0x2f')];this['outboundNoAnswerCallsDay']=_0x118a05[_0xe49f('0xb')];this[_0xe49f('0xc')]=_0x118a05[_0xe49f('0xc')];this['outboundOriginateFailureCallsDay']=_0x118a05[_0xe49f('0x30')];this['outboundReCallsDay']=_0x118a05[_0xe49f('0xd')];this[_0xe49f('0xe')]=_0x118a05[_0xe49f('0xe')];this[_0xe49f('0x31')]=_0x118a05[_0xe49f('0x31')];this[_0xe49f('0x32')]=_0x118a05[_0xe49f('0x32')];this[_0xe49f('0x33')]=_0x118a05[_0xe49f('0x33')];this['predictiveIntervalAvgTalktime']=_0x118a05[_0xe49f('0x34')];this[_0xe49f('0x35')]=_0x118a05[_0xe49f('0x35')];this[_0xe49f('0x36')]=_0x118a05[_0xe49f('0x36')];this[_0xe49f('0x37')]=_0x118a05[_0xe49f('0x37')];this[_0xe49f('0x38')]=_0x118a05[_0xe49f('0x38')];this[_0xe49f('0x39')]=_0x118a05['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x118a05[_0xe49f('0x3a')];this[_0xe49f('0x3b')]=_0x118a05['predictiveIntervalPauses'];this[_0xe49f('0x3c')]=_0x118a05['predictiveIntervalAvailable'];this[_0xe49f('0x3d')]=_0x118a05[_0xe49f('0x3d')];this['originated']=_0x118a05[_0xe49f('0x6')];this[_0xe49f('0x3e')]=_0x118a05[_0xe49f('0x3e')];this[_0xe49f('0x3f')]=_0x118a05[_0xe49f('0x3f')];this[_0xe49f('0x40')]=_0x118a05['erlangAbandonmentRate'];this[_0xe49f('0x41')]=_0x118a05[_0xe49f('0x41')];this[_0xe49f('0x42')]=_0x118a05[_0xe49f('0x42')];this[_0xe49f('0x43')]=_0x118a05['startProgressive'];this['message']=_0x118a05[_0xe49f('0x44')];this[_0xe49f('0x45')]=_0x118a05[_0xe49f('0x45')];}if(_0x118a05['Trunk']){this[_0xe49f('0x46')]={'id':_0x118a05['Trunk']['id'],'name':_0x118a05['Trunk'][_0xe49f('0x12')],'active':_0x118a05[_0xe49f('0x46')][_0xe49f('0x47')],'callerid':_0x118a05[_0xe49f('0x46')][_0xe49f('0x48')]};}}VoiceQueueSummary[_0xe49f('0x49')][_0xe49f('0x4a')]=function(_0x3a3429,_0x3b7676,_0x551907,_0x57ccb1){this['loggedInDb']=0x0;this[_0xe49f('0x3')]=0x0;this[_0xe49f('0x19')]=0x0;this[_0xe49f('0x21')]=0x0;this[_0xe49f('0x18')]=0x0;this[_0xe49f('0x5')]=0x0;this['busy']=0x0;this[_0xe49f('0x16')]=0x0;this[_0xe49f('0x20')]=0x0;this['ringing']=0x0;this[_0xe49f('0x1b')]=0x0;this[_0xe49f('0x17')]=0x0;if(_0x551907){if(_0x551907[_0xe49f('0x0')]){this['available']=Number(_0x551907['available']);}if(_0x551907[_0xe49f('0x4b')]){this[_0xe49f('0x1')]=Number(_0x551907[_0xe49f('0x4b')]);}if(_0x551907[_0xe49f('0x4c')]){this['waiting']=Number(_0x551907[_0xe49f('0x4c')]);}}for(var _0x341b30=0x0;_0x341b30<_0x3a3429[_0xe49f('0x4d')];_0x341b30++){var _0x25bdbf=_0x3b7676['SIP/'+_0x3a3429[_0x341b30][_0xe49f('0x12')]];if(_0x25bdbf&&_0x25bdbf['online']){this[_0xe49f('0x2')]+=0x1;}if(_0x3a3429[_0x341b30][_0xe49f('0x4e')]==='1'){this[_0xe49f('0x3')]+=0x1;}if(_0x3a3429[_0x341b30][_0xe49f('0x19')]==='1'&&!['2','7','8'][_0xe49f('0x4f')](_0x3a3429[_0x341b30][_0xe49f('0x50')])){this[_0xe49f('0x19')]+=0x1;}switch(_0x3a3429[_0x341b30][_0xe49f('0x50')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xe49f('0x5')]+=0x1;break;case'3':this[_0xe49f('0x15')]+=0x1;break;case'4':this[_0xe49f('0x16')]+=0x1;break;case'5':this[_0xe49f('0x20')]+=0x1;break;case'6':this[_0xe49f('0x1a')]+=0x1;break;case'7':this[_0xe49f('0x1b')]+=0x1;break;case'8':this[_0xe49f('0x17')]+=0x1;break;}}if(this[_0xe49f('0x25')]==='booked'){var _0x52edd8=Object[_0xe49f('0x51')](_0x57ccb1);for(var _0x25e77f=0x0;_0x25e77f<_0x52edd8[_0xe49f('0x4d')];_0x25e77f++){var _0xb36b00=_0x52edd8[_0x25e77f];var _0x258430=_0x57ccb1[_0xb36b00];if(_0x258430['queue']===this[_0xe49f('0x12')]&&_0x258430[_0xe49f('0x1f')]===_0xe49f('0x52')&&_0x258430[_0xe49f('0x53')]===_0xe49f('0x54')){this[_0xe49f('0x3')]+=0x1;}}if(this['talking']>this[_0xe49f('0x5')]){this[_0xe49f('0x3')]=this['inUse'];}this[_0xe49f('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xe49f('0x49')][_0xe49f('0x55')]=function(_0x1db862){var _0x3a6b31=![];if(_0x1db862){_0x3a6b31=INBOUND_COUNTERS[_0xe49f('0x56')](function(_0x11ab4d){return this[_0x11ab4d]!==_0x1db862[_0x11ab4d];},this);}return _0x3a6b31;};VoiceQueueSummary[_0xe49f('0x49')][_0xe49f('0x57')]=function(_0x731da1){var _0x48da35=![];var _0x5f2347=![];var _0x56a30c=![];if(_0x731da1){_0x48da35=this[_0xe49f('0x25')]!==_0x731da1[_0xe49f('0x25')]||this[_0xe49f('0x24')]!==_0x731da1[_0xe49f('0x24')]||this[_0xe49f('0x44')]!==_0x731da1[_0xe49f('0x44')]||this[_0xe49f('0x45')]!==_0x731da1['statusMessage'];_0x5f2347=OUTBOUND_COUNTERS[_0xe49f('0x56')](function(_0x1e1934){return this[_0x1e1934]!==_0x731da1[_0x1e1934];},this);if(this[_0xe49f('0x46')]&&_0x731da1[_0xe49f('0x46')]){_0x56a30c=this[_0xe49f('0x46')][_0xe49f('0x12')]!==_0x731da1[_0xe49f('0x46')][_0xe49f('0x12')]||this[_0xe49f('0x46')]['active']!==_0x731da1['Trunk'][_0xe49f('0x47')];}}return _0x48da35||_0x5f2347||_0x56a30c;};VoiceQueueSummary[_0xe49f('0x49')]['updateReportFromOutboundQueue']=function(_0x2f2e53){this[_0xe49f('0x4')]=_0x2f2e53['answered'];this['message']=_0x2f2e53[_0xe49f('0x44')];this[_0xe49f('0x45')]=_0x2f2e53[_0xe49f('0x45')];this[_0xe49f('0x6')]=_0x2f2e53['originated'];this[_0xe49f('0x7')]=_0x2f2e53[_0xe49f('0x7')];this[_0xe49f('0x8')]=_0x2f2e53[_0xe49f('0x8')];this[_0xe49f('0x9')]=_0x2f2e53[_0xe49f('0x9')];this[_0xe49f('0x2c')]=_0x2f2e53['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x2f2e53[_0xe49f('0xa')];this[_0xe49f('0xb')]=_0x2f2e53[_0xe49f('0xb')];this['outboundNoSuchCallsDay']=_0x2f2e53[_0xe49f('0xc')];this[_0xe49f('0xd')]=_0x2f2e53[_0xe49f('0xd')];this[_0xe49f('0xe')]=_0x2f2e53[_0xe49f('0xe')];this[_0xe49f('0x31')]=_0x2f2e53[_0xe49f('0x31')];this[_0xe49f('0x1c')]=_0x2f2e53[_0xe49f('0x1c')];this[_0xe49f('0x1d')]=_0x2f2e53['sumDuration'];this[_0xe49f('0x10')]=_0x2f2e53[_0xe49f('0x10')];if(this['dialMethod']==='preview'){this[_0xe49f('0xf')]=_0x2f2e53[_0xe49f('0xf')];}};module[_0xe49f('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x302c=['updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','ringing','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumDuration','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','callerid','loggedin','callers','SIP/','incall','includes','status','dialMethod','booked','keys','dialer','xcally-motion-preview','prototype','some','compareToOutboundQueue','active'];(function(_0x7767c3,_0x4825ac){var _0x1f22a1=function(_0x5164a3){while(--_0x5164a3){_0x7767c3['push'](_0x7767c3['shift']());}};_0x1f22a1(++_0x4825ac);}(_0x302c,0x15c));var _0xc302=function(_0x15697e,_0x4be652){_0x15697e=_0x15697e-0x0;var _0xab45c7=_0x302c[_0x15697e];return _0xab45c7;};'use strict';var INBOUND_COUNTERS=[_0xc302('0x0'),_0xc302('0x1'),_0xc302('0x2'),_0xc302('0x3'),_0xc302('0x4'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0xc302('0x0'),_0xc302('0x5'),_0xc302('0x6'),'loggedIn','loggedInDb',_0xc302('0x7'),'outboundAbandonedCallsDay',_0xc302('0x8'),_0xc302('0x9'),_0xc302('0xa'),_0xc302('0xb'),_0xc302('0xc'),_0xc302('0xd'),'outboundReCallsDay',_0xc302('0xe'),_0xc302('0xf'),'paused','pTalking',_0xc302('0x10'),'sumBillable','sumDuration','total',_0xc302('0x11')];function VoiceQueueSummary(_0x246ae7){this['id']=_0x246ae7['id'];this[_0xc302('0x12')]=_0x246ae7[_0xc302('0x12')];this[_0xc302('0x13')]=_0x246ae7[_0xc302('0x13')];this[_0xc302('0x14')]=_0x246ae7[_0xc302('0x14')]||0x0;this[_0xc302('0x5')]=_0x246ae7[_0xc302('0x5')]||0x0;this['available']=_0x246ae7[_0xc302('0x0')]||0x0;this[_0xc302('0x15')]=_0x246ae7['busy']||0x0;this[_0xc302('0x6')]=_0x246ae7[_0xc302('0x6')]||0x0;this[_0xc302('0x16')]=_0x246ae7[_0xc302('0x16')]||0x0;this[_0xc302('0x1')]=_0x246ae7['loggedIn']||0x0;this[_0xc302('0x2')]=_0x246ae7['loggedInDb']||0x0;this[_0xc302('0x17')]=_0x246ae7[_0xc302('0x17')]||0x0;this['notInUse']=_0x246ae7[_0xc302('0x18')]||0x0;this[_0xc302('0x3')]=_0x246ae7[_0xc302('0x3')]||0x0;this[_0xc302('0x4')]=_0x246ae7[_0xc302('0x4')]||0x0;this[_0xc302('0x19')]=_0x246ae7['ringInUse'];this[_0xc302('0x1a')]=_0x246ae7[_0xc302('0x1a')];this['sumDuration']=_0x246ae7[_0xc302('0x1b')];this[_0xc302('0x1c')]=_0x246ae7['sumHoldTime']||0x0;this[_0xc302('0x10')]=_0x246ae7[_0xc302('0x10')]||0x0;this[_0xc302('0x1d')]=_0x246ae7['total']||0x0;this[_0xc302('0x1e')]=_0x246ae7[_0xc302('0x1e')];this[_0xc302('0x1f')]=_0x246ae7['unavailable']||0x0;this[_0xc302('0x20')]=_0x246ae7['unknown']||0x0;this[_0xc302('0x21')]=_0x246ae7['unmanaged']||0x0;this['waiting']=_0x246ae7['waiting']||0x0;if(_0x246ae7['type']===_0xc302('0x22')){this[_0xc302('0x23')]=_0x246ae7[_0xc302('0x23')]||0x0;this['dialActive']=_0x246ae7[_0xc302('0x24')];this['dialMethod']=_0x246ae7['dialMethod'];this['dialOriginateCallerIdName']=_0x246ae7['dialOriginateCallerIdName'];this[_0xc302('0x25')]=_0x246ae7[_0xc302('0x25')];this[_0xc302('0x26')]=_0x246ae7[_0xc302('0x26')];this[_0xc302('0x27')]=_0x246ae7[_0xc302('0x27')];this[_0xc302('0x28')]=_0x246ae7[_0xc302('0x28')];this[_0xc302('0x29')]=_0x246ae7[_0xc302('0x29')];this[_0xc302('0x8')]=_0x246ae7[_0xc302('0x8')];this[_0xc302('0x9')]=_0x246ae7[_0xc302('0x9')];this[_0xc302('0xa')]=_0x246ae7[_0xc302('0xa')];this[_0xc302('0xb')]=_0x246ae7[_0xc302('0xb')];this[_0xc302('0x2a')]=_0x246ae7['outboundDropCallsDayACS'];this[_0xc302('0x2b')]=_0x246ae7[_0xc302('0x2b')];this['outboundDropCallsDayTimeout']=_0x246ae7['outboundDropCallsDayTimeout'];this[_0xc302('0xc')]=_0x246ae7['outboundNoAnswerCallsDay'];this[_0xc302('0xd')]=_0x246ae7[_0xc302('0xd')];this['outboundOriginateFailureCallsDay']=_0x246ae7[_0xc302('0x2c')];this['outboundReCallsDay']=_0x246ae7[_0xc302('0x2d')];this['outboundRejectCallsDay']=_0x246ae7['outboundRejectCallsDay'];this[_0xc302('0xf')]=_0x246ae7[_0xc302('0xf')];this[_0xc302('0x2e')]=_0x246ae7[_0xc302('0x2e')];this['predictiveIntervalAvgHoldtime']=_0x246ae7[_0xc302('0x2f')];this[_0xc302('0x30')]=_0x246ae7[_0xc302('0x30')];this[_0xc302('0x31')]=_0x246ae7[_0xc302('0x31')];this[_0xc302('0x32')]=_0x246ae7[_0xc302('0x32')];this[_0xc302('0x33')]=_0x246ae7[_0xc302('0x33')];this[_0xc302('0x34')]=_0x246ae7[_0xc302('0x34')];this[_0xc302('0x35')]=_0x246ae7[_0xc302('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x246ae7[_0xc302('0x36')];this['predictiveIntervalPauses']=_0x246ae7[_0xc302('0x37')];this[_0xc302('0x38')]=_0x246ae7['predictiveIntervalAvailable'];this[_0xc302('0x39')]=_0x246ae7[_0xc302('0x39')];this[_0xc302('0x7')]=_0x246ae7[_0xc302('0x7')];this[_0xc302('0x3a')]=_0x246ae7[_0xc302('0x3a')];this[_0xc302('0x3b')]=_0x246ae7['erlangCallToSecond'];this[_0xc302('0x3c')]=_0x246ae7[_0xc302('0x3c')];this['erlangBusyFactor']=_0x246ae7[_0xc302('0x3d')];this['startPredictive']=_0x246ae7['startPredictive'];this[_0xc302('0x3e')]=_0x246ae7['startProgressive'];this[_0xc302('0x3f')]=_0x246ae7[_0xc302('0x3f')];this[_0xc302('0x40')]=_0x246ae7[_0xc302('0x40')];}if(_0x246ae7[_0xc302('0x41')]){this[_0xc302('0x41')]={'id':_0x246ae7[_0xc302('0x41')]['id'],'name':_0x246ae7[_0xc302('0x41')][_0xc302('0x12')],'active':_0x246ae7[_0xc302('0x41')]['active'],'callerid':_0x246ae7[_0xc302('0x41')][_0xc302('0x42')]};}}VoiceQueueSummary['prototype']['createReport']=function(_0xca4848,_0x19377d,_0x169f5c,_0x4ec56b){this['loggedInDb']=0x0;this['talking']=0x0;this[_0xc302('0x3')]=0x0;this[_0xc302('0x20')]=0x0;this[_0xc302('0x18')]=0x0;this[_0xc302('0x6')]=0x0;this[_0xc302('0x15')]=0x0;this['invalid']=0x0;this[_0xc302('0x1f')]=0x0;this['ringing']=0x0;this[_0xc302('0x19')]=0x0;this[_0xc302('0x17')]=0x0;if(_0x169f5c){if(_0x169f5c['available']){this['available']=Number(_0x169f5c['available']);}if(_0x169f5c[_0xc302('0x43')]){this['loggedIn']=Number(_0x169f5c[_0xc302('0x43')]);}if(_0x169f5c[_0xc302('0x44')]){this[_0xc302('0x11')]=Number(_0x169f5c['callers']);}}for(var _0x39f7e2=0x0;_0x39f7e2<_0xca4848['length'];_0x39f7e2++){var _0x3fe964=_0x19377d[_0xc302('0x45')+_0xca4848[_0x39f7e2][_0xc302('0x12')]];if(_0x3fe964&&_0x3fe964['online']){this['loggedInDb']+=0x1;}if(_0xca4848[_0x39f7e2][_0xc302('0x46')]==='1'){this[_0xc302('0x10')]+=0x1;}if(_0xca4848[_0x39f7e2][_0xc302('0x3')]==='1'&&!['2','7','8'][_0xc302('0x47')](_0xca4848[_0x39f7e2][_0xc302('0x48')])){this[_0xc302('0x3')]+=0x1;}switch(_0xca4848[_0x39f7e2][_0xc302('0x48')]){case'0':this[_0xc302('0x20')]+=0x1;break;case'1':this[_0xc302('0x18')]+=0x1;break;case'2':this[_0xc302('0x6')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xc302('0x16')]+=0x1;break;case'5':this[_0xc302('0x1f')]+=0x1;break;case'6':this[_0xc302('0x4')]+=0x1;break;case'7':this[_0xc302('0x19')]+=0x1;break;case'8':this[_0xc302('0x17')]+=0x1;break;}}if(this[_0xc302('0x49')]===_0xc302('0x4a')){var _0x1b3f29=Object[_0xc302('0x4b')](_0x4ec56b);for(var _0x4624e7=0x0;_0x4624e7<_0x1b3f29['length'];_0x4624e7++){var _0xb60332=_0x1b3f29[_0x4624e7];var _0x3ed6fb=_0x4ec56b[_0xb60332];if(_0x3ed6fb['queue']===this[_0xc302('0x12')]&&_0x3ed6fb[_0xc302('0x1e')]===_0xc302('0x4c')&&_0x3ed6fb['exten']===_0xc302('0x4d')){this[_0xc302('0x10')]+=0x1;}}if(this[_0xc302('0x10')]>this[_0xc302('0x6')]){this[_0xc302('0x10')]=this[_0xc302('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xc302('0x4e')]['compareToInboundQueue']=function(_0x5baf6d){var _0x10769e=![];if(_0x5baf6d){_0x10769e=INBOUND_COUNTERS[_0xc302('0x4f')](function(_0x1f2f84){return this[_0x1f2f84]!==_0x5baf6d[_0x1f2f84];},this);}return _0x10769e;};VoiceQueueSummary[_0xc302('0x4e')][_0xc302('0x50')]=function(_0x2e1104){var _0x3d0c48=![];var _0x4b5a19=![];var _0x25c976=![];if(_0x2e1104){_0x3d0c48=this[_0xc302('0x49')]!==_0x2e1104[_0xc302('0x49')]||this[_0xc302('0x24')]!==_0x2e1104[_0xc302('0x24')]||this[_0xc302('0x3f')]!==_0x2e1104[_0xc302('0x3f')]||this['statusMessage']!==_0x2e1104[_0xc302('0x40')];_0x4b5a19=OUTBOUND_COUNTERS[_0xc302('0x4f')](function(_0x2b3724){return this[_0x2b3724]!==_0x2e1104[_0x2b3724];},this);if(this[_0xc302('0x41')]&&_0x2e1104['Trunk']){_0x25c976=this[_0xc302('0x41')][_0xc302('0x12')]!==_0x2e1104[_0xc302('0x41')][_0xc302('0x12')]||this[_0xc302('0x41')][_0xc302('0x51')]!==_0x2e1104['Trunk'][_0xc302('0x51')];}}return _0x3d0c48||_0x4b5a19||_0x25c976;};VoiceQueueSummary[_0xc302('0x4e')][_0xc302('0x52')]=function(_0x44e031){this['answered']=_0x44e031['answered'];this[_0xc302('0x3f')]=_0x44e031[_0xc302('0x3f')];this[_0xc302('0x40')]=_0x44e031['statusMessage'];this[_0xc302('0x7')]=_0x44e031['originated'];this[_0xc302('0x53')]=_0x44e031['outboundAbandonedCallsDay'];this[_0xc302('0x8')]=_0x44e031['outboundAnswerCallsDay'];this[_0xc302('0x9')]=_0x44e031[_0xc302('0x9')];this[_0xc302('0xa')]=_0x44e031[_0xc302('0xa')];this[_0xc302('0xb')]=_0x44e031['outboundCongestionCallsDay'];this[_0xc302('0xc')]=_0x44e031[_0xc302('0xc')];this[_0xc302('0xd')]=_0x44e031[_0xc302('0xd')];this[_0xc302('0x2d')]=_0x44e031[_0xc302('0x2d')];this['outboundRejectCallsDay']=_0x44e031[_0xc302('0xe')];this[_0xc302('0xf')]=_0x44e031[_0xc302('0xf')];this['sumBillable']=_0x44e031[_0xc302('0x1a')];this[_0xc302('0x1b')]=_0x44e031[_0xc302('0x1b')];this[_0xc302('0x1d')]=_0x44e031[_0xc302('0x1d')];if(this[_0xc302('0x49')]===_0xc302('0x54')){this['pTalking']=_0x44e031[_0xc302('0x23')];}};module[_0xc302('0x55')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 95aacd7..3ab20df 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03ad=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x93f4e5,_0x50287d){var _0x5afb90=function(_0x3315ca){while(--_0x3315ca){_0x93f4e5['push'](_0x93f4e5['shift']());}};_0x5afb90(++_0x50287d);}(_0x03ad,0xe0));var _0xd03a=function(_0x4f39fd,_0x36d85f){_0x4f39fd=_0x4f39fd-0x0;var _0x4ef809=_0x03ad[_0x4f39fd];return _0x4ef809;};'use strict';function VtigerAccount(_0x3cf409){this['id']=_0x3cf409['id']||0x0;this['name']=_0x3cf409[_0xd03a('0x0')]||'';this[_0xd03a('0x1')]=_0x3cf409[_0xd03a('0x1')]||'';this['accessKey']=_0x3cf409[_0xd03a('0x2')]||'';this[_0xd03a('0x3')]=_0x3cf409[_0xd03a('0x3')]||'';this[_0xd03a('0x4')]=_0x3cf409[_0xd03a('0x4')]||'';this[_0xd03a('0x5')]=_0x3cf409[_0xd03a('0x5')]||{};}module[_0xd03a('0x6')]=VtigerAccount; \ No newline at end of file +var _0x1702=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x4d9a48,_0x20bc50){var _0xef464d=function(_0x30e968){while(--_0x30e968){_0x4d9a48['push'](_0x4d9a48['shift']());}};_0xef464d(++_0x20bc50);}(_0x1702,0x114));var _0x2170=function(_0x557640,_0x50212a){_0x557640=_0x557640-0x0;var _0x2516a4=_0x1702[_0x557640];return _0x2516a4;};'use strict';function VtigerAccount(_0x41e2fd){this['id']=_0x41e2fd['id']||0x0;this[_0x2170('0x0')]=_0x41e2fd[_0x2170('0x0')]||'';this[_0x2170('0x1')]=_0x41e2fd[_0x2170('0x1')]||'';this[_0x2170('0x2')]=_0x41e2fd[_0x2170('0x2')]||'';this[_0x2170('0x3')]=_0x41e2fd['remoteUri']||'';this[_0x2170('0x4')]=_0x41e2fd[_0x2170('0x4')]||'';this[_0x2170('0x5')]=_0x41e2fd[_0x2170('0x5')]||{};}module[_0x2170('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 66d3d1b..13f678f 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d50=['authType','type','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x4dd70d,_0x15c201){var _0x48f094=function(_0x415f3e){while(--_0x415f3e){_0x4dd70d['push'](_0x4dd70d['shift']());}};_0x48f094(++_0x15c201);}(_0x7d50,0x67));var _0x07d5=function(_0x3dda55,_0x30fa29){_0x3dda55=_0x3dda55-0x0;var _0x4a74c2=_0x7d50[_0x3dda55];return _0x4a74c2;};'use strict';function ZendeskAccount(_0x214dfc){this['id']=_0x214dfc['id']||0x0;this[_0x07d5('0x0')]=_0x214dfc[_0x07d5('0x0')]||'';this['username']=_0x214dfc[_0x07d5('0x1')]||'';this['password']=_0x214dfc[_0x07d5('0x2')]||'';this[_0x07d5('0x3')]=_0x214dfc[_0x07d5('0x3')]||'';this[_0x07d5('0x4')]=_0x214dfc[_0x07d5('0x4')]||'';this[_0x07d5('0x5')]=_0x214dfc[_0x07d5('0x5')]||'';this[_0x07d5('0x6')]=_0x214dfc[_0x07d5('0x6')]||'integrationTab';this[_0x07d5('0x7')]=_0x214dfc[_0x07d5('0x7')]||'';this[_0x07d5('0x8')]=_0x214dfc[_0x07d5('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x81ba=['serverUrl','exports','name','username','password','token','remoteUri','type'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x81ba,0x14a));var _0xa81b=function(_0x4fb519,_0x1811dd){_0x4fb519=_0x4fb519-0x0;var _0x4930b7=_0x81ba[_0x4fb519];return _0x4930b7;};'use strict';function ZendeskAccount(_0x39cba6){this['id']=_0x39cba6['id']||0x0;this[_0xa81b('0x0')]=_0x39cba6[_0xa81b('0x0')]||'';this[_0xa81b('0x1')]=_0x39cba6[_0xa81b('0x1')]||'';this['password']=_0x39cba6[_0xa81b('0x2')]||'';this[_0xa81b('0x3')]=_0x39cba6[_0xa81b('0x3')]||'';this[_0xa81b('0x4')]=_0x39cba6[_0xa81b('0x4')]||'';this['authType']=_0x39cba6['authType']||'';this[_0xa81b('0x5')]=_0x39cba6[_0xa81b('0x5')]||'integrationTab';this[_0xa81b('0x6')]=_0x39cba6[_0xa81b('0x6')]||'';this['Configurations']=_0x39cba6['Configurations']||{};}module[_0xa81b('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4637271..12ac032 100644 --- a/server/services/ami/model/zohoAccount.js +++ b/server/services/ami/model/zohoAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d6b=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x3a9e3f,_0x39063f){var _0x45acac=function(_0x1a7141){while(--_0x1a7141){_0x3a9e3f['push'](_0x3a9e3f['shift']());}};_0x45acac(++_0x39063f);}(_0x6d6b,0x1d2));var _0xb6d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d6b[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x2b5540){this['id']=_0x2b5540['id']||0x0;this[_0xb6d6('0x0')]=_0x2b5540['name']||'';this[_0xb6d6('0x1')]=_0x2b5540[_0xb6d6('0x1')]||'';this['host']=_0x2b5540[_0xb6d6('0x2')]||'';this[_0xb6d6('0x3')]=_0x2b5540[_0xb6d6('0x3')]||'';this['clientId']=_0x2b5540[_0xb6d6('0x4')]||'';this[_0xb6d6('0x5')]=_0x2b5540[_0xb6d6('0x5')]||'';this[_0xb6d6('0x6')]=_0x2b5540['serverUrl']||'';this['code']=_0x2b5540[_0xb6d6('0x7')]||'';this[_0xb6d6('0x8')]=_0x2b5540[_0xb6d6('0x8')]||'';this['Configurations']=_0x2b5540[_0xb6d6('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xb9c7=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xb9c7,0xe4));var _0x7b9c=function(_0x5512c0,_0x16a364){_0x5512c0=_0x5512c0-0x0;var _0x40f994=_0xb9c7[_0x5512c0];return _0x40f994;};'use strict';function ZohoAccount(_0x239528){this['id']=_0x239528['id']||0x0;this[_0x7b9c('0x0')]=_0x239528[_0x7b9c('0x0')]||'';this[_0x7b9c('0x1')]=_0x239528[_0x7b9c('0x1')]||'';this[_0x7b9c('0x2')]=_0x239528[_0x7b9c('0x2')]||'';this[_0x7b9c('0x3')]=_0x239528['zone']||'';this[_0x7b9c('0x4')]=_0x239528[_0x7b9c('0x4')]||'';this[_0x7b9c('0x5')]=_0x239528[_0x7b9c('0x5')]||'';this[_0x7b9c('0x6')]=_0x239528[_0x7b9c('0x6')]||'';this['code']=_0x239528[_0x7b9c('0x7')]||'';this[_0x7b9c('0x8')]=_0x239528[_0x7b9c('0x8')]||'';this[_0x7b9c('0x9')]=_0x239528[_0x7b9c('0x9')]||{};}module[_0x7b9c('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 04f4168..cafe6f8 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0424=['dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','moment','isNil','string','uniqueid','name','type','queue'];(function(_0x1a56f9,_0x2e5407){var _0x282b10=function(_0x368aef){while(--_0x368aef){_0x1a56f9['push'](_0x1a56f9['shift']());}};_0x282b10(++_0x2e5407);}(_0x0424,0x159));var _0x4042=function(_0x90cba6,_0x3c97d3){_0x90cba6=_0x90cba6-0x0;var _0x500b97=_0x0424[_0x90cba6];return _0x500b97;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4042('0x0'));function checkNameSurname(_0x28e024,_0x161add,_0x292a62){var _0x53f080='';if(!_[_0x4042('0x1')](_0x161add)&&'string'===typeof _0x161add){_0x53f080+=_0x161add;}if(!_['isNil'](_0x292a62)&&_0x4042('0x2')===typeof _0x292a62){_0x53f080+='\x20'+_0x292a62;}if(_0x53f080!==''){return _0x53f080;}return _0x28e024;}function Action(_0x24fdfd,_0x472795,_0xc0fba0,_0x3abaf1,_0xa5310f){this[_0x4042('0x3')]=_0xc0fba0||undefined;this['idContact']=_0x24fdfd['id'];this['queue']=_0x472795[_0x4042('0x4')];this[_0x4042('0x5')]=_0x472795[_0x4042('0x5')];this['campaigntype']=_0x4042('0x6');this[_0x4042('0x7')]=![];this[_0x4042('0x8')]=_[_0x4042('0x1')](_0x24fdfd[_0x4042('0x9')])?undefined:_0x24fdfd[_0x4042('0x9')][_0x4042('0x4')];this[_0x4042('0xa')]=this['membername']?util[_0x4042('0xb')](_0x4042('0xc'),this['membername']):_0x3abaf1||undefined;this[_0x4042('0xd')]=checkNameSurname(_0x24fdfd[_0x4042('0xe')][_0x4042('0xf')],_0x24fdfd[_0x4042('0xe')][_0x4042('0x10')],_0x24fdfd[_0x4042('0xe')][_0x4042('0x11')]);this['active']=_0x24fdfd[_0x4042('0x12')]||![];this[_0x4042('0x13')]=_0x24fdfd['phone'];this[_0x4042('0x14')]=_0x24fdfd[_0x4042('0x14')];this[_0x4042('0x15')]=_0x24fdfd[_0x4042('0x15')]||0x0;this[_0x4042('0x16')]=_0x24fdfd[_0x4042('0x16')]||0x0;this[_0x4042('0x17')]=_0x24fdfd[_0x4042('0x17')]||0x0;this[_0x4042('0x18')]=(_0x24fdfd['countbusyretry']||0x0)+(_0x24fdfd[_0x4042('0x16')]||0x0)+(_0x24fdfd['countnoanswerretry']||0x0)+(_0x24fdfd[_0x4042('0x19')]||0x0)+(_0x24fdfd['countdropretry']||0x0)+(_0x24fdfd[_0x4042('0x1a')]||0x0)+(_0x24fdfd[_0x4042('0x1b')]||0x0)+(_0x24fdfd[_0x4042('0x1c')]||0x0);this[_0x4042('0x19')]=_0x24fdfd['countnosuchnumberretry']||0x0;this[_0x4042('0x1d')]=_0x24fdfd[_0x4042('0x1d')]||0x0;this[_0x4042('0x1a')]=_0x24fdfd[_0x4042('0x1a')]||0x0;this['countmachineretry']=_0x24fdfd[_0x4042('0x1b')]||0x0;this[_0x4042('0x1c')]=_0x24fdfd[_0x4042('0x1c')]||0x0;this[_0x4042('0x1e')]=_0x24fdfd[_0x4042('0x1e')];this['callbackuniqueid']=_0x24fdfd[_0x4042('0x1f')];this[_0x4042('0x20')]=_0x24fdfd['callbackat'];this[_0x4042('0x21')]=_0x24fdfd['recallme'];this[_0x4042('0x22')]=_0x24fdfd[_0x4042('0x22')];this[_0x4042('0x23')]=_0x24fdfd['ListId'];this[_0x4042('0x24')]=_[_0x4042('0x1')](_0x24fdfd[_0x4042('0x9')])?_0x24fdfd[_0x4042('0x24')]:_0x24fdfd[_0x4042('0x9')]['id'];this['VoiceQueueId']=_0x24fdfd['VoiceQueueId'];this[_0x4042('0x25')]='';this[_0x4042('0x26')]='';}Action[_0x4042('0x27')][_0x4042('0x28')]=function(){return util[_0x4042('0xb')](_0x4042('0x29'),this['calleridname'],this[_0x4042('0x2a')]);};module[_0x4042('0x2b')]=Action; \ No newline at end of file +var _0x1c9a=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','moment','string','isNil','uniqueid','idContact','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x3f8406,_0x4351a6){var _0x2c3b18=function(_0x19ae37){while(--_0x19ae37){_0x3f8406['push'](_0x3f8406['shift']());}};_0x2c3b18(++_0x4351a6);}(_0x1c9a,0x98));var _0xa1c9=function(_0x5a1d1e,_0x3cf57a){_0x5a1d1e=_0x5a1d1e-0x0;var _0x36b5e9=_0x1c9a[_0x5a1d1e];return _0x36b5e9;};'use strict';var util=require(_0xa1c9('0x0'));var _=require('lodash');var moment=require(_0xa1c9('0x1'));function checkNameSurname(_0x5c45c5,_0x1a771d,_0x1d631b){var _0x1a05a3='';if(!_['isNil'](_0x1a771d)&&_0xa1c9('0x2')===typeof _0x1a771d){_0x1a05a3+=_0x1a771d;}if(!_[_0xa1c9('0x3')](_0x1d631b)&&_0xa1c9('0x2')===typeof _0x1d631b){_0x1a05a3+='\x20'+_0x1d631b;}if(_0x1a05a3!==''){return _0x1a05a3;}return _0x5c45c5;}function Action(_0x3a4387,_0x572229,_0x144e91,_0x5448f2,_0x222624){this[_0xa1c9('0x4')]=_0x144e91||undefined;this[_0xa1c9('0x5')]=_0x3a4387['id'];this['queue']=_0x572229[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x572229[_0xa1c9('0x7')];this[_0xa1c9('0x8')]='queue';this[_0xa1c9('0x9')]=![];this[_0xa1c9('0xa')]=_[_0xa1c9('0x3')](_0x3a4387[_0xa1c9('0xb')])?undefined:_0x3a4387[_0xa1c9('0xb')][_0xa1c9('0x6')];this[_0xa1c9('0xc')]=this[_0xa1c9('0xa')]?util[_0xa1c9('0xd')](_0xa1c9('0xe'),this['membername']):_0x5448f2||undefined;this[_0xa1c9('0xf')]=checkNameSurname(_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x11')],_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x12')],_0x3a4387['Contact'][_0xa1c9('0x13')]);this[_0xa1c9('0x14')]=_0x3a4387[_0xa1c9('0x14')]||![];this[_0xa1c9('0x15')]=_0x3a4387[_0xa1c9('0x11')];this[_0xa1c9('0x16')]=_0x3a4387[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x3a4387[_0xa1c9('0x17')]||0x0;this[_0xa1c9('0x18')]=_0x3a4387['countcongestionretry']||0x0;this[_0xa1c9('0x19')]=_0x3a4387[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=(_0x3a4387['countbusyretry']||0x0)+(_0x3a4387[_0xa1c9('0x18')]||0x0)+(_0x3a4387['countnoanswerretry']||0x0)+(_0x3a4387[_0xa1c9('0x1b')]||0x0)+(_0x3a4387[_0xa1c9('0x1c')]||0x0)+(_0x3a4387[_0xa1c9('0x1d')]||0x0)+(_0x3a4387['countmachineretry']||0x0)+(_0x3a4387[_0xa1c9('0x1e')]||0x0);this[_0xa1c9('0x1b')]=_0x3a4387[_0xa1c9('0x1b')]||0x0;this['countdropretry']=_0x3a4387[_0xa1c9('0x1c')]||0x0;this[_0xa1c9('0x1d')]=_0x3a4387['countabandonedretry']||0x0;this[_0xa1c9('0x1f')]=_0x3a4387[_0xa1c9('0x1f')]||0x0;this[_0xa1c9('0x1e')]=_0x3a4387['countagentrejectretry']||0x0;this[_0xa1c9('0x20')]=_0x3a4387[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x3a4387[_0xa1c9('0x21')];this[_0xa1c9('0x22')]=_0x3a4387['callbackat'];this['recallme']=_0x3a4387[_0xa1c9('0x23')];this['ContactId']=_0x3a4387[_0xa1c9('0x24')];this[_0xa1c9('0x25')]=_0x3a4387[_0xa1c9('0x25')];this[_0xa1c9('0x26')]=_[_0xa1c9('0x3')](_0x3a4387['Agent'])?_0x3a4387[_0xa1c9('0x26')]:_0x3a4387[_0xa1c9('0xb')]['id'];this[_0xa1c9('0x27')]=_0x3a4387['VoiceQueueId'];this[_0xa1c9('0x28')]='';this[_0xa1c9('0x29')]='';}Action[_0xa1c9('0x2a')]['getCaller']=function(){return util[_0xa1c9('0xd')](_0xa1c9('0x2b'),this['calleridname'],this[_0xa1c9('0x2c')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 8645834..d0e3e54 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['countbusyretry','scheduledAt','unlockAgent','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','loggerError','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','checkInBlack','Contact\x20is\x20undefined','lookAgent','execCall','Queue:\x20','custom:agentcalled','[Preview][execCall][failure]','logBlacklist','createHistory','active','SIP/%s','format','reachable','unmonitored','execRun','getContactPreview','recallme','validateContact','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','logger','[Preview][validateContact][Empty\x20Contact]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','addVariables','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','filterKey','keys','variable','addVariable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','ioredis','preview','../../../config/logger','actionPreview','./action','../dialer/utils','defaults','socket.io-emitter','redis','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','syncNewExten','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','message','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','CAMPAIGN_STATUS','DEACTIVATED','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','total','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]'];(function(_0x5a90f5,_0x216a60){var _0x2e6110=function(_0x46e6f8){while(--_0x46e6f8){_0x5a90f5['push'](_0x5a90f5['shift']());}};_0x2e6110(++_0x216a60);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0x4b84[_0x2a390b];return _0x5df10a;};'use strict';var util=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0x44b8('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x44b8('0x3'));var loggerAction=require(_0x44b8('0x4'))(_0x44b8('0x5'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x44b8('0x6'));var ut=require('./util/util');var utils=require(_0x44b8('0x7'));config['redis']=_[_0x44b8('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x44b8('0x9'))(new Redis(config[_0x44b8('0xa')]));var Sequence=function(){};Sequence[_0x44b8('0xb')]['enqueue']=function(_0xc650ec){this[_0x44b8('0xc')]=this[_0x44b8('0xc')]?this[_0x44b8('0xc')][_0x44b8('0xd')](_0xc650ec):_0xc650ec();};function Preview(_0x37e471){this[_0x44b8('0xe')]=new Sequence();this['campaignsPreview']=_0x37e471[_0x44b8('0xf')];this[_0x44b8('0x10')]=_0x37e471['trunks'];this[_0x44b8('0x11')]={};this['agents']=_0x37e471[_0x44b8('0x12')];this[_0x44b8('0x13')]=0x0;ami['on']('originateresponse',this[_0x44b8('0x14')]['bind'](this));ami['on']('hangup',this[_0x44b8('0x15')][_0x44b8('0x16')](this));ami['on'](_0x44b8('0x17'),this[_0x44b8('0x18')]['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0x44b8('0x16')](this));ami['on']('newexten',this[_0x44b8('0x19')][_0x44b8('0x16')](this));ami['on']('varset',this[_0x44b8('0x1a')][_0x44b8('0x16')](this));ami['on']('attendedtransfer',this[_0x44b8('0x1b')][_0x44b8('0x16')](this));ami['on']('blindtransfer',this[_0x44b8('0x1c')][_0x44b8('0x16')](this));this[_0x44b8('0x1d')](this[_0x44b8('0x1e')]);}function emit(_0x102ef9,_0x369c09,_0x452f2f){io['to'](_0x102ef9)[_0x44b8('0x1f')](_0x369c09,_0x452f2f);}function emitVoiceQueueChannelRemove(_0x429461){logger[_0x44b8('0x20')](_0x44b8('0x21'),JSON[_0x44b8('0x22')](_0x429461));emit(util['format'](_0x44b8('0x23'),_0x429461[_0x44b8('0x24')]),_0x44b8('0x25'),_0x429461);io[_0x44b8('0x1f')](_0x44b8('0x26'),_0x429461);}function notSendMessagesQueue(_0x51a34a){if(_0x51a34a[_0x44b8('0x27')]){if(_0x51a34a['originated']===0x0&&_0x51a34a[_0x44b8('0x28')]===0x0){_0x51a34a[_0x44b8('0x27')]=![];_0x51a34a[_0x44b8('0x29')]=0x0;_0x51a34a[_0x44b8('0x2a')]=0x0;_0x51a34a[_0x44b8('0x2b')]=utils['CAMPAIGN_STATUS'][_0x44b8('0x2c')];ut['logger'](_0x44b8('0x2d'),_0x51a34a[_0x44b8('0x24')]+'\x20is\x20not\x20active');}else{_0x51a34a[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x2f')];ut['logger'](_0x44b8('0x2d'),_0x51a34a[_0x44b8('0x24')]+'\x20is\x20deactivated');}}}Preview[_0x44b8('0xb')]['loopCampaigns']=function(){var _0xfb0028=this;setInterval(function(){_0xfb0028['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x387293=this[_0x44b8('0x1e')];this[_0x44b8('0x13')]+=0x1;for(var _0x1bd1be in _0x387293){if(_0x387293[_0x44b8('0x30')](_0x1bd1be)&&(_0x387293[_0x1bd1be][_0x44b8('0x31')]===_0x44b8('0x3')||_0x387293[_0x1bd1be][_0x44b8('0x31')]===_0x44b8('0x32'))&&_0x387293[_0x1bd1be][_0x44b8('0x33')]===_0x44b8('0x34')){if(this[_0x44b8('0x13')]>0x7){this[_0x44b8('0x13')]=0x0;this['clearZombieChannels']();}}if(_0x387293[_0x44b8('0x30')](_0x1bd1be)&&_0x387293[_0x1bd1be]['dialMethod']===_0x44b8('0x3')&&_0x387293[_0x1bd1be][_0x44b8('0x33')]===_0x44b8('0x34')){if(_0x387293[_0x1bd1be][_0x44b8('0x35')]){this[_0x44b8('0x36')](_0x387293[_0x1bd1be]);if(_0x387293[_0x1bd1be]['dialPreviewAutoRecallMe'])this[_0x44b8('0x37')](_0x387293[_0x1bd1be]);}else{notSendMessagesQueue(_0x387293[_0x1bd1be]);}}}};Preview[_0x44b8('0xb')][_0x44b8('0x38')]=function(_0x339f0f){var _0x46b008=this;this['sequence'][_0x44b8('0x39')](function(){if(!_[_0x44b8('0x3a')](_0x46b008[_0x44b8('0x11')][_0x339f0f])){loggerAction[_0x44b8('0x20')](_0x44b8('0x3b'),_0x339f0f,_0x44b8('0x3c'),_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')],_0x44b8('0x3e'),JSON[_0x44b8('0x22')](_0x46b008[_0x44b8('0x1e')][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]][_0x44b8('0x3f')]),_0x44b8('0x40'),JSON[_0x44b8('0x22')](_0x46b008[_0x44b8('0x1e')][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]][_0x44b8('0x28')]),JSON[_0x44b8('0x22')](_0x46b008[_0x44b8('0x11')][_0x339f0f]['dialAnswer']),JSON[_0x44b8('0x22')](_[_0x44b8('0x41')](_0x46b008['actions'][_0x339f0f],[_0x44b8('0x42'),_0x44b8('0x43'),_0x44b8('0x44'),_0x44b8('0x45')])));return ami['Action']({'action':_0x44b8('0x46'),'channel':_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x47')]})[_0x44b8('0x48')](function(_0x9cb2a){if(_0x9cb2a[_0x44b8('0x2b')]===_0x44b8('0x49')){setTimeout(function(){if(_0x46b008[_0x44b8('0x11')][_0x339f0f]){ut[_0x44b8('0x4a')](_0x46b008[_0x44b8('0x1e')][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]],_0x44b8('0x4b'));if(_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x4c')]===!![]){ut[_0x44b8('0x4d')](_0x46b008['campaignsPreview'][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]],_0x44b8('0x4b'));ut['loggerError'](_0x44b8('0x4e')+_0x339f0f,_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]);}ut['loggerError'](_0x44b8('0x4f')+_0x339f0f,_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]);delete _0x46b008[_0x44b8('0x11')][_0x339f0f];}},0x2328);}});}});};Preview[_0x44b8('0xb')]['clearZombieChannels']=function(){var _0x5ae5f9=this;loggerAction[_0x44b8('0x20')](_0x44b8('0x50'),_[_0x44b8('0x51')](this[_0x44b8('0x11')]));for(var _0x43906b in this[_0x44b8('0x11')]){if(_0x5ae5f9[_0x44b8('0x11')][_0x44b8('0x30')](_0x43906b)){_0x5ae5f9[_0x44b8('0x38')](_0x43906b);}}};Preview[_0x44b8('0xb')][_0x44b8('0x37')]=function(_0x2a9b2a){var _0xc1b9de=this;rpcDb[_0x44b8('0x52')](_0x2a9b2a['id'],ut[_0x44b8('0x53')](this[_0x44b8('0x12')]))[_0x44b8('0x54')](function(_0x3b3d5d){if(!_[_0x44b8('0x3a')](_0x3b3d5d)){for(var _0x49c507=0x0;_0x49c507<_0x3b3d5d['length'];_0x49c507+=0x1){if(ut[_0x44b8('0x55')](_0x3b3d5d[_0x49c507][_0x44b8('0x56')])<_0x2a9b2a[_0x44b8('0x57')]*0x3c){if(_0x3b3d5d[_0x49c507][_0x44b8('0x58')]&&!_0x3b3d5d[_0x49c507][_0x44b8('0x58')][_0x44b8('0x59')]){_0xc1b9de[_0x44b8('0x5a')](_0x3b3d5d[_0x49c507]['id'])['then'](ut[_0x44b8('0x5b')]('[RecallMe]'))[_0x44b8('0x48')](ut[_0x44b8('0x5b')](_0x44b8('0x5c')));}else{rpcDb[_0x44b8('0x5d')](_0x3b3d5d[_0x49c507]['id']);}}else{var _0x103d57=new Action(_0x3b3d5d[_0x49c507],_0x2a9b2a);_0x103d57[_0x44b8('0x5e')]=moment()['format'](_0x44b8('0x5f'));_0x2a9b2a[_0x44b8('0x60')]+=0x1;ut[_0x44b8('0x61')](_0x103d57,0x17,_0x44b8('0x62'));if(_0x2a9b2a['dialRecallInQueue']){rpcDb[_0x44b8('0x63')](ut[_0x44b8('0x64')](_0x3b3d5d[_0x49c507]));rpcDb[_0x44b8('0x65')](_0x103d57,_0x44b8('0x66'));}else{ut[_0x44b8('0x61')](_0x103d57,0x16,_0x44b8('0x67'));rpcDb['createCustomerHistory'](_0x103d57,_0x44b8('0x68'));rpcDb[_0x44b8('0x69')](_0x103d57,_0x44b8('0x68'));}}}}})[_0x44b8('0x48')](ut[_0x44b8('0x5b')]('[getContactRecallMe]'));};Preview['prototype'][_0x44b8('0x36')]=function(_0x4eb344){_0x4eb344[_0x44b8('0x27')]=!![];if(ut['IsNotLoggedIn'](_0x4eb344[_0x44b8('0x6a')])){_0x4eb344[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x6b')];}else if(!ut[_0x44b8('0x6c')](_0x4eb344[_0x44b8('0x35')])){_0x4eb344[_0x44b8('0x2b')]=utils['CAMPAIGN_STATUS'][_0x44b8('0x2c')];}else if(!this[_0x44b8('0x6d')](_0x4eb344[_0x44b8('0x6e')])){if(!this['isTrunkReachable'](_0x4eb344[_0x44b8('0x6f')])){_0x4eb344[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x70')];}else{_0x4eb344['message']=utils[_0x44b8('0x2e')][_0x44b8('0x71')];}}else{_0x4eb344['message']=utils[_0x44b8('0x2e')][_0x44b8('0x71')];}};Preview[_0x44b8('0xb')][_0x44b8('0x72')]=function(_0xe86e34,_0x546a50,_0x5b99a3){var _0xc181d2=this;var _0x3154bc=this[_0x44b8('0x11')][_0x546a50];var _0x4358aa=this[_0x44b8('0x1e')][_0x3154bc[_0x44b8('0x3d')]];var _0x3c9534;var _0xf0fb0d=![];var _0x10bbd9=0x2;var _0xdff81b=0x3;if(_0x4358aa){switch(_0x5b99a3){case'1':_0x4358aa[_0x44b8('0x73')]+=0x1;_0x3154bc[_0x44b8('0x74')]+=0x1;_0x3154bc['countglobal']=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x0,_0x44b8('0x76'));ami[_0x44b8('0x1f')](_0x44b8('0x77'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0x79')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0x7a'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'0',_0x4358aa)[_0x44b8('0x54')](function(_0x15bcba){_0xf0fb0d=_0x15bcba[_0x44b8('0x7c')]==0x1;_0x10bbd9=_0x4358aa[_0x44b8('0x7d')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,'Global');rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0x81'));}else{if(_0x3154bc[_0x44b8('0x74')]>=_0x4358aa[_0x44b8('0x82')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0x81'));}else{rpcDb[_0x44b8('0x83')](ut['scheduledAt'](_0x3154bc,_0x44b8('0x74'),_0x4358aa[_0x44b8('0x7d')]),_0x3154bc['unlockAgent'],_0x3154bc[_0x44b8('0x84')]);}}delete this[_0x44b8('0x11')][_0xe86e34['linkedid']];}else{_0x3154bc[_0x44b8('0x74')]++;logger[_0x44b8('0x20')](_0x44b8('0x85'),_0x3154bc['countnosuchnumberretry']);logger[_0x44b8('0x20')]('id',_0x3154bc['idContact']);_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc['idContact'],'field':{'countnosuchnumberretry':_0x3154bc[_0x44b8('0x74')]}})[_0x44b8('0x54')](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});break;case _0x44b8('0x88'):var _0x230b6a=moment()['format'](_0x44b8('0x5f'));_0x3154bc['responsetime']=_0x230b6a;_0x3154bc[_0x44b8('0x89')]=_0x230b6a;_0x3154bc[_0x44b8('0x4c')]=!![];_0x4358aa['pTalking']+=0x1;logger[_0x44b8('0x20')](_0x44b8('0x8a'),_0x3154bc[_0x44b8('0x8b')],_0x44b8('0x8c'),_0x4358aa[_0x44b8('0x24')],_0x44b8('0x40'),_0x4358aa[_0x44b8('0x28')]);ami[_0x44b8('0x1f')](_0x44b8('0x8d'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0x8e'),this[_0x44b8('0x1e')][_0x3154bc['queue']]));if(_0x4358aa[_0x44b8('0x8f')]){ami[_0x44b8('0x1f')](_0x44b8('0x90'),ut['buildAcw'](_0x3154bc));}break;case'16':ami[_0x44b8('0x1f')](_0x44b8('0x91'),ut['buildObj'](_0x3154bc,_0x44b8('0x92'),this[_0x44b8('0x1e')][_0x3154bc[_0x44b8('0x3d')]]));emitVoiceQueueChannelRemove(ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0x92')));_0x4358aa['outboundAnswerCallsDay']+=0x1;_0x4358aa[_0x44b8('0x93')]+=0x1;_0x4358aa[_0x44b8('0x94')]+=0x1;ut[_0x44b8('0x4d')](_0x4358aa,_0x44b8('0x95'));_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x4,_0x44b8('0x97'));rpcDb['createCustomerHistory'](_0x3154bc,_0x44b8('0x98'));rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0x99'));rpcDb[_0x44b8('0x9a')](_0x3154bc);_0x4358aa['sumDuration']+=_0x3154bc['talktime'];_0x4358aa['sumBillable']+=_0x3154bc[_0x44b8('0x9b')];logger[_0x44b8('0x20')](_0x44b8('0x9c'),_0x3154bc[_0x44b8('0x8b')],_0x44b8('0x8c'),_0x4358aa['name'],_0x44b8('0x40'),_0x4358aa['pTalking']);delete this[_0x44b8('0x11')][_0xe86e34[_0x44b8('0x9d')]];break;case _0x44b8('0x9e'):_0x4358aa['outboundBusyCallsDay']+=0x1;_0x3154bc['countbusyretry']+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x5,'Busy');_0x10bbd9=_0x4358aa[_0x44b8('0x9f')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];ami[_0x44b8('0x1f')](_0x44b8('0xa0'),ut[_0x44b8('0x78')](_0x3154bc,'busy'));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xa1'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'5',_0x4358aa)[_0x44b8('0x54')](function(_0x220f1b){_0xf0fb0d=_0x220f1b['additional']==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xa3'));}else{if(_0x3154bc[_0x44b8('0xa4')]>=_0x4358aa['dialBusyMaxRetry']){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xa1'));}else{rpcDb['rescheduleContact'](ut[_0x44b8('0xa5')](_0x3154bc,_0x44b8('0xa4'),_0x4358aa['dialBusyRetryFrequency']),_0x3154bc[_0x44b8('0xa6')],_0x3154bc['activeContact']);}}}else{_0x3154bc['countbusyretry']++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countbusyretry':_0x3154bc[_0x44b8('0xa4')]}})['then'](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)['then'](function(){});});}});break;case _0x44b8('0xa8'):_0x4358aa[_0x44b8('0xa9')]+=0x1;_0x3154bc[_0x44b8('0xaa')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x3,_0x44b8('0xab'));_0x10bbd9=_0x4358aa[_0x44b8('0xac')];_0xdff81b=_0x4358aa['callAdditionalPhoneAfterMin'];var _0x388c4c=ut['buildNoAnswerEventPayload'](_0x3154bc,_0x4358aa);ami['emit']('custom:agentnoanswer',_0x388c4c);rpcDb[_0x44b8('0x65')](_0x3154bc,'[callProgressDetectingCustomer][logNoAnswer]');_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'3',_0x4358aa)[_0x44b8('0x54')](function(_0x268e1e){_0xf0fb0d=_0x268e1e[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb['createCustomerFinal'](_0x3c9534,_0x44b8('0xad'));}else{if(_0x3154bc[_0x44b8('0xaa')]>=_0x4358aa[_0x44b8('0xae')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xaf'));}else{rpcDb[_0x44b8('0x83')](ut[_0x44b8('0xa5')](_0x3154bc,_0x44b8('0xaa'),_0x4358aa[_0x44b8('0xac')]),_0x3154bc['unlockAgent'],_0x3154bc['activeContact']);}}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2['incrementPreviewCounters']({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})[_0x44b8('0x54')](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)['then'](function(){});});}});break;case'CONGESTION':_0x4358aa[_0x44b8('0xb0')]+=0x1;_0x3154bc['countcongestionretry']+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x8,_0x44b8('0xb1'));_0x10bbd9=_0x4358aa[_0x44b8('0xb2')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];ami[_0x44b8('0x1f')](_0x44b8('0xb3'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xb4')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xb5'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'8',_0x4358aa)[_0x44b8('0x54')](function(_0x5de033){_0xf0fb0d=_0x5de033[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xb6'));}else{if(_0x3154bc[_0x44b8('0xb7')]>=_0x4358aa[_0x44b8('0xb8')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xb5'));}else{rpcDb[_0x44b8('0x83')](ut[_0x44b8('0xa5')](_0x3154bc,'countcongestionretry',_0x4358aa[_0x44b8('0x9f')]),_0x3154bc[_0x44b8('0xa6')],_0x3154bc[_0x44b8('0x84')]);}}}else{_0x3154bc['countcongestionretry']++;_0xc181d2['incrementPreviewCounters']({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countcongestionretry':_0x3154bc[_0x44b8('0xb7')]}})[_0x44b8('0x54')](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});break;case _0x44b8('0xb9'):_0x4358aa[_0x44b8('0xba')]+=0x1;_0x3154bc[_0x44b8('0xbb')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x14,_0x44b8('0xbc'));_0x10bbd9=_0x4358aa['dialAgentRejectRetryFrequency'];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];ami[_0x44b8('0x1f')](_0x44b8('0xbd'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xbe')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xbf'));_0xc181d2['verifyAdditionalPhones'](_0x3154bc,'20',_0x4358aa)['then'](function(_0x478f17){_0xf0fb0d=_0x478f17[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0x14,_0x44b8('0xbc'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xc0'));}else{if(_0x3154bc[_0x44b8('0xbb')]>=_0x4358aa[_0x44b8('0xc1')]){rpcDb['createCustomerFinal'](_0x3154bc,_0x44b8('0xc0'));}else{rpcDb[_0x44b8('0x83')](ut['scheduledAt'](_0x3154bc,'countagentrejectretry',_0x4358aa[_0x44b8('0xc2')]),_0x3154bc['unlockAgent'],_0x3154bc[_0x44b8('0x84')]);}}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc['idContact'],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})[_0x44b8('0x54')](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});break;case'ABANDONED':_0x4358aa[_0x44b8('0xc3')]+=0x1;_0x3154bc['countabandonedretry']+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0xb,_0x44b8('0xc4'));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xc5'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'11',_0x4358aa)['then'](function(_0x4d3b82){_0xf0fb0d=_0x4d3b82['additional']==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xc5'));}else{if(_0x3154bc[_0x44b8('0xc6')]>=_0x4358aa[_0x44b8('0xc7')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xc5'));}else{rpcDb[_0x44b8('0x83')](ut[_0x44b8('0xa5')](_0x3154bc,_0x44b8('0xc8'),_0x4358aa[_0x44b8('0xc9')]),_0x3154bc[_0x44b8('0xa6')],_0x3154bc[_0x44b8('0x84')]);}}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc['idContact'],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})['then'](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)['then'](function(){});});}});break;case'18':_0x4358aa['outboundUnknownCallsDay']+=0x1;_0x3154bc[_0x44b8('0xca')]+=0x1;_0x3154bc['countglobal']=ut['totalGlobal'](_0x3154bc);ut['logCustomer'](_0x3154bc,0x12,_0xe86e34['cause-txt']||_0xe86e34['dialstatus']);ami[_0x44b8('0x1f')](_0x44b8('0xcb'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xcc')));rpcDb['createCustomerHistory'](_0x3154bc,_0x44b8('0xcd'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'18',_0x4358aa)['then'](function(_0x572e5c){_0xf0fb0d=_0x572e5c[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut['cloneAction'](_0x3154bc,0x12,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xcd'));}else{rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xcd'));}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})['then'](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});delete this['actions'][_0xe86e34[_0x44b8('0x9d')]];break;case'19':_0x4358aa[_0x44b8('0xce')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut['totalGlobal'](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x13,_0xe86e34['cause-txt']||_0xe86e34[_0x44b8('0xcf')]);ami[_0x44b8('0x1f')]('custom:amd',ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xcc')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xd0'));_0xc181d2['verifyAdditionalPhones'](_0x3154bc,'18',_0x4358aa)[_0x44b8('0x54')](function(_0xf73cde){_0xf0fb0d=_0xf73cde[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xd0'));}else{rpcDb['createCustomerFinal'](_0x3154bc,'[callProgressDetectingCustomer][machine]');}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})[_0x44b8('0x54')](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});delete this['actions'][_0xe86e34[_0x44b8('0x9d')]];break;default:if(_0x3154bc['dialAnswer']){ut[_0x44b8('0x4d')](_0x4358aa,_0x44b8('0xd1'));ut[_0x44b8('0xd2')](_0x44b8('0xd3')+_0x4358aa[_0x44b8('0x24')],_0xe86e34);}_0x4358aa[_0x44b8('0xce')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0xc,_0xe86e34['cause-txt']||_0xe86e34[_0x44b8('0xcf')]);_0x10bbd9=_0x4358aa[_0x44b8('0xc2')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];rpcDb[_0x44b8('0x65')](_0x3154bc,'[callProgressDetectingCustomer][logUnknown]');_0xc181d2['verifyAdditionalPhones'](_0x3154bc,'20',_0x4358aa)['then'](function(_0xf5e39){_0xf0fb0d=_0xf5e39['additional']==0x1;if(!_0xf0fb0d){if(ut['totalGlobal'](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xd4'));}else{rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xd4'));}delete this[_0x44b8('0x11')][_0xe86e34['linkedid']];}else{_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});}});}if(!(_0x3154bc[_0x44b8('0x4c')]&&_0x5b99a3==='16')){ut[_0x44b8('0x4a')](_0x4358aa,'[callProgressDetectingCustomer]');logger[_0x44b8('0x20')](_0x44b8('0xd5'),_0x3154bc[_0x44b8('0x8b')],'\x20Queue',_0x4358aa['name'],_0x44b8('0x3e'),_0x4358aa[_0x44b8('0x3f')]);}if(_0x5b99a3!==_0x44b8('0x88')){delete this[_0x44b8('0x11')][_0xe86e34[_0x44b8('0x9d')]];delete this['actions'][_0xe86e34[_0x44b8('0xd6')]];}_0x4358aa[_0x44b8('0xd7')]=!![];}};Preview['prototype'][_0x44b8('0xd8')]=function(_0x13942e,_0xcb4c9b,_0x237f67){if(_['isUndefined'](_0xcb4c9b)&&_0x44b8('0xd9')!==typeof _0xcb4c9b){return;}if(_['isUndefined'](_0x237f67)&&_0x44b8('0xd9')!==typeof _0x237f67){return;}switch(_0x237f67[_0x44b8('0xda')]){case'0':ut[_0x44b8('0xdb')](_0x13942e,0x0,_0x44b8('0x76'));rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xdd'));break;case'3':ut[_0x44b8('0xdb')](_0x13942e,0x3,_0x44b8('0xab'));rpcDb['createAgentHistory'](_0x13942e,_0x44b8('0xde'));break;case'5':ut[_0x44b8('0xdb')](_0x13942e,0x5,_0x44b8('0xdf'));rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xe0'));break;case'8':ut[_0x44b8('0xdb')](_0x13942e,0x8,'Congestion');rpcDb['createAgentHistory'](_0x13942e,_0x44b8('0xe1'));break;case'22':ut[_0x44b8('0xdb')](_0x13942e,0x16,'AnswerAGI');rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xe2'));break;default:ut['logAgent'](_0x13942e,0xc,_0x237f67[_0x44b8('0xda')]);rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xe1'));}ut[_0x44b8('0x4a')](_0xcb4c9b,_0x44b8('0xe3'));logger[_0x44b8('0x20')](_0x44b8('0xe4'),_0x13942e[_0x44b8('0x8b')],_0x44b8('0x8c'),_0xcb4c9b[_0x44b8('0x24')],_0x44b8('0x3e'),_0xcb4c9b[_0x44b8('0x3f')]);delete this[_0x44b8('0x11')][_0x13942e[_0x44b8('0x8b')]];};Preview[_0x44b8('0xb')]['verifyAdditionalPhones']=function(_0x30fca,_0x3d92a9,_0x13ab7b){return cmHopperAdditionalPhone[_0x44b8('0x7b')](_0x30fca,_0x3d92a9,_0x13ab7b)['catch'](logger[_0x44b8('0x20')](_0x44b8('0xe5')));};Preview['prototype'][_0x44b8('0x87')]=function(_0x4b9731,_0x1cd645,_0x3fee20){return cmHopperAdditionalPhone[_0x44b8('0x87')](_0x4b9731,_0x1cd645,_0x3fee20)[_0x44b8('0x48')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0x44b8('0xb')][_0x44b8('0x86')]=function(_0x5a2a9f){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x44b8('0x86')](_0x5a2a9f))[_0x44b8('0x48')](logger[_0x44b8('0x20')]('[incrementPreviewCounters]\x20'));};Preview['prototype'][_0x44b8('0xe6')]=function(_0x289fbd,_0x12f78b,_0x24a6a6,_0x2f5451,_0xc54e64){var _0x100295=this;return new Promise(function(_0x287902,_0x2675e9){if(_['isNil'](_0x12f78b)||_[_0x44b8('0x3a')](_0x12f78b['Contact'])||_[_0x44b8('0x3a')](_0x12f78b['phone'])||_['isNil'](_0x12f78b[_0x44b8('0x44')])){_0x2675e9(ut[_0x44b8('0x2b')](_0x44b8('0xe7'),_0x2f5451,_0xc54e64));return;}var _0x13c741=uuid['v4']();var _0x2eec38=_0x100295[_0x44b8('0x1e')][_0x12f78b[_0x44b8('0x3c')][_0x44b8('0x24')]];var _0x17b749=_0x24a6a6?_0x100295['agents'][_0x24a6a6]['id']:undefined;_0x100295[_0x44b8('0x11')][_0x13c741]=new Action(_0x12f78b,_0x2eec38,_0x13c741,_0x24a6a6,_0x17b749);var _0x1e3b5f=_0x100295[_0x44b8('0x11')][_0x13c741];_0x1e3b5f['unlockAgent']=_0x2f5451;_0x1e3b5f['activeContact']=_0xc54e64;_0x1e3b5f[_0x44b8('0xe8')]=_0x24a6a6;if(_['isEmpty'](_0x289fbd)){_0x100295[_0x44b8('0xe9')](_0x1e3b5f,_0x2eec38,_0x12f78b,_0x24a6a6)['then'](function(_0x1ae0bb){logger['info']('[Preview][execCall][success]',_0x44b8('0xea')+_0x1e3b5f[_0x44b8('0x3d')]+'\x20IdHopper:\x20'+_0x1e3b5f[_0x44b8('0xa7')],JSON[_0x44b8('0x22')](_0x1ae0bb));ami[_0x44b8('0x1f')](_0x44b8('0xeb'),ut[_0x44b8('0x78')](_0x1e3b5f,'called',_0x100295[_0x44b8('0x1e')][_0x1e3b5f['queue']]));_0x287902(ut['message']('Calling'));})[_0x44b8('0x48')](function(_0x2818ec){ut['logger'](_0x44b8('0xec'),_0x2818ec);_0x2675e9(ut[_0x44b8('0x2b')]('Call\x20failed',_0x2f5451,_0xc54e64));});}else{_0x2eec38['outboundBlacklistCallsDay']+=0x1;ut[_0x44b8('0xed')](_0x1e3b5f);rpcDb[_0x44b8('0xee')](_0x1e3b5f,'[Blacklist][error]');delete _0x100295[_0x44b8('0x11')][_0x13c741];_0x2675e9(ut[_0x44b8('0x2b')]('Contact\x20in\x20black\x20List',_0x2f5451,_0xc54e64));}});};Preview[_0x44b8('0xb')][_0x44b8('0x6d')]=function(_0x5ce5ed){return!_[_0x44b8('0x3a')](_0x5ce5ed)&&!_[_0x44b8('0x3a')](_0x5ce5ed[_0x44b8('0x24')])&&!_['isNil'](_0x5ce5ed[_0x44b8('0xef')])&&_0x5ce5ed['active']&&!_[_0x44b8('0x3a')](this['trunks'][util['format'](_0x44b8('0xf0'),_0x5ce5ed[_0x44b8('0x24')])])&&!_[_0x44b8('0x3a')](this[_0x44b8('0x10')][util[_0x44b8('0xf1')](_0x44b8('0xf0'),_0x5ce5ed[_0x44b8('0x24')])][_0x44b8('0x46')])&&(this[_0x44b8('0x10')][util[_0x44b8('0xf1')](_0x44b8('0xf0'),_0x5ce5ed['name'])][_0x44b8('0x46')]===_0x44b8('0xf2')||this[_0x44b8('0x10')][util[_0x44b8('0xf1')](_0x44b8('0xf0'),_0x5ce5ed[_0x44b8('0x24')])][_0x44b8('0x46')]===_0x44b8('0xf3'));};Preview['prototype'][_0x44b8('0x5a')]=function(_0x3f33a9,_0x561645){return this[_0x44b8('0xf4')](_0x3f33a9,_0x561645)[_0x44b8('0x54')](function(_0x2a40a3){return _['pick'](_0x2a40a3,['message']);})[_0x44b8('0x48')](function(_0x133da8){if(_0x133da8['unlock']){rpcDb['unlockContact'](_0x3f33a9);}if(_0x133da8[_0x44b8('0xef')]){rpcDb[_0x44b8('0x5d')](_0x3f33a9);}throw _[_0x44b8('0x41')](_0x133da8,[_0x44b8('0x2b')]);});};Preview[_0x44b8('0xb')]['execRun']=function(_0x2ded38,_0x4fbf1d){var _0x444f66=this;var _0x1386c6,_0x36537c;return rpcDb[_0x44b8('0xf5')](_0x2ded38)[_0x44b8('0x54')](function(_0x180c33){if(!_['isNil'](_0x180c33[0x0])){_0x36537c=_0x180c33[0x0][_0x44b8('0xf6')]?![]:!![];_0x1386c6=_0x180c33[0x0]['recallme']?!![]:![];_0x1386c6=_0x4fbf1d?!![]:_0x1386c6;}var _0x2c3e11=_0x444f66[_0x44b8('0xf7')](_0x180c33);if(_0x2c3e11['isValid']){rpcDb[_0x44b8('0xf8')](_['pick'](_0x180c33[0x0],[_0x44b8('0x44'),_0x44b8('0xf9')]))[_0x44b8('0x54')](function(_0x4b0aa0){_0x444f66[_0x44b8('0xe6')](_0x4b0aa0,_0x180c33[0x0],_0x4fbf1d,_0x36537c,_0x1386c6)[_0x44b8('0x54')](function(_0x4ff63e){return _0x4ff63e;})[_0x44b8('0x48')](function(_0x5af83d){throw _0x5af83d;});})['catch'](function(_0x4220b5){ut['logger'](_0x44b8('0xfa'),_0x4220b5);throw ut['message'](_0x44b8('0xfb'),_0x36537c,_0x1386c6);});}else{throw ut[_0x44b8('0x2b')](_0x2c3e11['message'],_0x36537c,_0x1386c6);}})[_0x44b8('0x48')](function(_0x39507e){ut['logger']('[Preview][getContactPreview]',_0x39507e);throw ut[_0x44b8('0x2b')](_0x44b8('0xfb'),![],!![]);});};Preview[_0x44b8('0xb')][_0x44b8('0xf7')]=function(_0x596fa4){if(_[_0x44b8('0x3a')](_0x596fa4)||_[_0x44b8('0xfc')](_0x596fa4)||!_[_0x44b8('0x3a')](_0x596fa4[0x0][_0x44b8('0x58')])&&_['isNil'](_0x596fa4[0x0]['Agent'][_0x44b8('0x24')])){ut[_0x44b8('0xfd')](_0x44b8('0xfe'),_0x596fa4);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1443bd=this[_0x44b8('0x1e')][_0x596fa4[0x0]['Queue'][_0x44b8('0x24')]];_0x1443bd[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x71')];if(_[_0x44b8('0x3a')](_0x1443bd)){ut[_0x44b8('0xfd')]('[Preview][validateContact][Empty\x20Campaign]',_0x1443bd);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x44b8('0x6d')](_0x1443bd['Trunk'])){ut[_0x44b8('0xfd')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x44b8('0xff')+_0x1443bd[_0x44b8('0x24')]+_0x44b8('0x100'));if(!this[_0x44b8('0x6d')](_0x1443bd[_0x44b8('0x6f')])){ut[_0x44b8('0xfd')](_0x44b8('0x101'),_0x1443bd[_0x44b8('0x24')]+_0x44b8('0x102'));return{'isValid':![],'message':_0x44b8('0x103')};}}if(!ut[_0x44b8('0x6c')](_0x1443bd[_0x44b8('0x35')])){ut[_0x44b8('0xfd')](_0x44b8('0x104'),_0x1443bd[_0x44b8('0x24')]+_0x44b8('0x105'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1443bd[_0x44b8('0x24')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x44b8('0x106')};};Preview[_0x44b8('0xb')][_0x44b8('0xe9')]=function(_0x10fd21,_0x420a61,_0x22e5ae,_0x2f3340){var _0x4d98de=this;return new Promise(function(_0x597139,_0x2fffd5){var _0x3c90c2=_0x10fd21[_0x44b8('0x8b')];var _0x43c7ac=_0x4d98de[_0x44b8('0x6d')](_0x420a61['Trunk'])?util[_0x44b8('0xf1')](_0x44b8('0x107'),_0x420a61[_0x44b8('0x6e')][_0x44b8('0x24')],_[_0x44b8('0x3a')](_0x420a61[_0x44b8('0x108')])?'':_0x420a61['dialPrefix'][_0x44b8('0x109')]()||'',_0x420a61[_0x44b8('0x10a')]>0x0?_0x22e5ae[_0x44b8('0xf9')][_0x44b8('0x10b')](_0x420a61[_0x44b8('0x10a')]):_0x22e5ae['phone']):util['format'](_0x44b8('0x107'),_[_0x44b8('0x3a')](_0x420a61['TrunkBackup'])?_0x420a61['Trunk'][_0x44b8('0x24')]:_0x420a61['TrunkBackup'][_0x44b8('0x24')],_[_0x44b8('0x3a')](_0x420a61[_0x44b8('0x108')])?'':_0x420a61[_0x44b8('0x108')][_0x44b8('0x109')]()||'',_0x420a61[_0x44b8('0x10a')]>0x0?_0x22e5ae[_0x44b8('0xf9')][_0x44b8('0x10b')](_0x420a61['dialCutDigit']):_0x22e5ae[_0x44b8('0xf9')]);var _0xf24cdd=_0x4d98de[_0x44b8('0x6d')](_0x420a61['Trunk'])?ut[_0x44b8('0x10c')](_0x420a61[_0x44b8('0x6e')]['callerid'],_0x420a61['dialOriginateCallerIdName'],_0x420a61['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x420a61[_0x44b8('0x10d')],_0x420a61['dialRandomLastDigitCallerIdNumber']):_0x420a61['dialOriginateCallerIdNumber']):ut[_0x44b8('0x10c')](_[_0x44b8('0x3a')](_0x420a61[_0x44b8('0x6f')])?_0x420a61['Trunk'][_0x44b8('0x10e')]:_0x420a61['TrunkBackup'][_0x44b8('0x10e')],_0x420a61[_0x44b8('0x10f')],_0x420a61[_0x44b8('0x110')]>0x0?ut[_0x44b8('0x111')](_0x420a61['dialOriginateCallerIdNumber'],_0x420a61[_0x44b8('0x110')]):_0x420a61[_0x44b8('0x10d')]);if(_0xf24cdd){_0x10fd21[_0x44b8('0x112')]=ut[_0x44b8('0x113')](_0xf24cdd);_0x10fd21['originatecalleridnum']=ut['extractCalleridNumber'](_0xf24cdd);}var _0x35a564=ut[_0x44b8('0x114')](_0x420a61,_0x22e5ae,_0x43c7ac,_0xf24cdd,_0x3c90c2,_0x10fd21);_['merge'](_0x10fd21,ut[_0x44b8('0x115')](_0x35a564));_0x10fd21[_0x44b8('0x5e')]=moment()[_0x44b8('0xf1')](_0x44b8('0x5f'));_0x420a61[_0x44b8('0x116')]=_0x35a564;var _0x2da727=ut[_0x44b8('0x117')](_0x10fd21,_0x420a61,_0x35a564,_0x10fd21[_0x44b8('0x84')],_0x2f3340);return ami['Action'](_0x2da727)[_0x44b8('0x54')](function(_0x3e5fa8){_0x420a61[_0x44b8('0x3f')]+=0x1;logger['info'](_0x44b8('0x118'),_0x3c90c2,'\x20Queue',_0x420a61[_0x44b8('0x24')],'originated:\x20',_0x420a61[_0x44b8('0x3f')]);_0x597139(_0x3e5fa8);})[_0x44b8('0x48')](function(_0x1f5c08){ut[_0x44b8('0xdb')](_0x10fd21,0xe,_0x44b8('0x119'));rpcDb[_0x44b8('0xdc')](_0x10fd21,_0x44b8('0x11a'));_0x2fffd5(_0x1f5c08);});});};Preview[_0x44b8('0xb')][_0x44b8('0x19')]=function(_0x31913d){if(this[_0x44b8('0x11')][_0x31913d[_0x44b8('0x9d')]]){this['actions'][_0x31913d[_0x44b8('0x9d')]]['channel']=_0x31913d[_0x44b8('0x47')];}};Preview['prototype'][_0x44b8('0x14')]=function(_0x31132c){var _0xdfc44b=this;var _0x2c8438=this[_0x44b8('0x11')][_0x31132c[_0x44b8('0x11b')]];if(_0x2c8438){if(_0x2c8438[_0x44b8('0xe8')]&&this['agents'][_0x2c8438[_0x44b8('0xe8')]]){ut[_0x44b8('0x11c')](_0x2c8438,this[_0x44b8('0x12')][_0x2c8438[_0x44b8('0xe8')]][_0x44b8('0x24')],this[_0x44b8('0x12')][_0x2c8438[_0x44b8('0xe8')]]['id']);}var _0x46cdee=_[_0x44b8('0x11d')](_0x2c8438);_0x46cdee[_0x44b8('0x11e')]=moment()[_0x44b8('0xf1')](_0x44b8('0x5f'));var _0xbbc40d=_0xdfc44b[_0x44b8('0x1e')][_0x2c8438['queue']];if(ut[_0x44b8('0x11f')](_0x31132c[_0x44b8('0x120')])){if(_0x2c8438['unlockAgent']){rpcDb[_0x44b8('0x121')](_0x2c8438[_0x44b8('0xa7')]);}if(_0x2c8438[_0x44b8('0x84')]){rpcDb[_0x44b8('0x5d')](_0x2c8438[_0x44b8('0xa7')]);}ami['emit'](_0x44b8('0x122'),ut[_0x44b8('0x78')](_0x2c8438,_0x44b8('0x123'),this[_0x44b8('0x1e')][_0x2c8438['queue']]));this[_0x44b8('0xd8')](_0x46cdee,_0xbbc40d,_0x31132c);}else{_0x2c8438[_0x44b8('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x46cdee,0x4,'Answer');rpcDb[_0x44b8('0xdc')](_0x46cdee,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x44b8('0x15')]=function(_0xb5c212){var _0x87a38=this['actions'][_0xb5c212[_0x44b8('0x9d')]];var _0x32dafb;if(_0x87a38){_0x32dafb=this[_0x44b8('0x1e')][_0x87a38[_0x44b8('0x3d')]];logger['info'](_0x44b8('0x124'),_0xb5c212['linkedid'],_0x44b8('0x8c'),_0x32dafb[_0x44b8('0x24')],'pTalking:\x20',_0x32dafb[_0x44b8('0x28')]);}if(this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]]&&_0xb5c212[_0x44b8('0x9d')]!==_0xb5c212[_0x44b8('0x8b')]){if(_0xb5c212['cause']==='16'&&this['actions'][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){this[_0x44b8('0x72')](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')]);}else if(this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){logger[_0x44b8('0x20')](_0x44b8('0x126'),_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')],'\x20Queue',_0x32dafb['name'],_0x44b8('0x40'),_0x32dafb['pTalking']);this[_0x44b8('0x72')](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')]);}}else if(_0x87a38&&_['isNil'](_0x87a38[_0x44b8('0x127')])&&_0x32dafb[_0x44b8('0x128')]&&_0xb5c212[_0x44b8('0x9d')]===_0xb5c212[_0x44b8('0x8b')]&&_[_0x44b8('0x3a')](_0xb5c212[_0x44b8('0xda')])&&_0xb5c212['cause']==='16'&&_0xb5c212[_0x44b8('0x129')]==='6'&&_[_0x44b8('0x12a')](_0x87a38['transfer'])){if(_0x87a38[_0x44b8('0xa6')]){rpcDb[_0x44b8('0x121')](_0x87a38[_0x44b8('0xa7')]);}if(_0x87a38[_0x44b8('0x84')]){rpcDb[_0x44b8('0x5d')](_0x87a38['idContact']);}_0xb5c212[_0x44b8('0xda')]='22';this[_0x44b8('0xd8')](_0x87a38,_0x32dafb,_0xb5c212);}else if(_0x87a38&&_0x87a38[_0x44b8('0x12b')]){if(_0xb5c212[_0x44b8('0x125')]==='16'&&this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){logger[_0x44b8('0x20')](_0x44b8('0x12c'),_0xb5c212[_0x44b8('0x9d')],_0xb5c212['cause'],_0x44b8('0x8c'),_0x32dafb[_0x44b8('0x24')],_0x44b8('0x40'),_0x32dafb['pTalking']);this['callProgressDetectingCustomer'](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212['cause']);}else if(this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){logger[_0x44b8('0x20')](_0x44b8('0x126'),_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')],'\x20Queue',_0x32dafb['name'],_0x44b8('0x40'),_0x32dafb[_0x44b8('0x28')]);this[_0x44b8('0x72')](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')]);}}};Preview[_0x44b8('0xb')]['syncDialEnd']=function(_0x4d88a6){if(this[_0x44b8('0x11')][_0x4d88a6[_0x44b8('0xd6')]]&&_0x4d88a6[_0x44b8('0xd6')]!==_0x4d88a6[_0x44b8('0x12d')]){this[_0x44b8('0x72')](_0x4d88a6,_0x4d88a6[_0x44b8('0xd6')],_0x4d88a6[_0x44b8('0xcf')]);}};Preview['prototype'][_0x44b8('0x18')]=function(_0x1f6244){if(this[_0x44b8('0x11')][_0x1f6244['linkedid']]&&_0x1f6244[_0x44b8('0x9d')]!==_0x1f6244[_0x44b8('0x8b')]&&!this[_0x44b8('0x11')][_0x1f6244[_0x44b8('0x9d')]]['dialAnswer']){if(_0x1f6244[_0x44b8('0x125')]==='1'){this[_0x44b8('0x72')](_0x1f6244,_0x1f6244[_0x44b8('0x9d')],_0x1f6244['cause']);}}};Preview['prototype']['addVariable']=function(_0x4b3c64,_0x59a43a,_0x355c5c){if(this[_0x44b8('0x11')][_0x4b3c64]){if(_[_0x44b8('0x3a')](this[_0x44b8('0x11')][_0x4b3c64][_0x44b8('0x116')])){this[_0x44b8('0x11')][_0x4b3c64][_0x44b8('0x116')]={};}this[_0x44b8('0x11')][_0x4b3c64][_0x44b8('0x116')][_0x59a43a]=_0x355c5c;}};Preview[_0x44b8('0xb')][_0x44b8('0x1a')]=function(_0x56aecf){try{if(!_[_0x44b8('0x3a')](_0x56aecf)){if(ut[_0x44b8('0x12e')](_[_0x44b8('0x12f')](_0x56aecf[_0x44b8('0x130')])[0x0])){this[_0x44b8('0x131')](_0x56aecf['uniqueid'],_[_0x44b8('0x12f')](_0x56aecf['variable'])[0x0],_0x56aecf[_0x44b8('0x132')]);}}}catch(_0x3432da){logger[_0x44b8('0x133')]('[syncVarSet][Preview]',util[_0x44b8('0x134')](_0x3432da,{'showHidden':![],'depth':null}));}};Preview[_0x44b8('0xb')]['syncAttendedTransfer']=function(_0xc8e8f4){if(_0xc8e8f4){if(this[_0x44b8('0x11')][_0xc8e8f4[_0x44b8('0x135')]]){this['actions'][_0xc8e8f4[_0x44b8('0x135')]]['transfer']=!![];}}};Preview[_0x44b8('0xb')][_0x44b8('0x1c')]=function(_0x280fe1){if(_0x280fe1){if(this['actions'][_0x280fe1[_0x44b8('0x136')]]){this['actions'][_0x280fe1[_0x44b8('0x136')]][_0x44b8('0x12b')]=!![];}}};module[_0x44b8('0x137')]=Preview; \ No newline at end of file +var _0x4b84=['countbusyretry','scheduledAt','unlockAgent','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','loggerError','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','checkInBlack','Contact\x20is\x20undefined','lookAgent','execCall','Queue:\x20','custom:agentcalled','[Preview][execCall][failure]','logBlacklist','createHistory','active','SIP/%s','format','reachable','unmonitored','execRun','getContactPreview','recallme','validateContact','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','logger','[Preview][validateContact][Empty\x20Contact]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdNumber','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','addVariables','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','filterKey','keys','variable','addVariable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','ioredis','preview','../../../config/logger','actionPreview','./action','../dialer/utils','defaults','socket.io-emitter','redis','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','syncNewExten','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','available','paused','message','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','CAMPAIGN_STATUS','DEACTIVATED','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','total','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]'];(function(_0x38f575,_0x205d15){var _0x1ef728=function(_0x4ea234){while(--_0x4ea234){_0x38f575['push'](_0x38f575['shift']());}};_0x1ef728(++_0x205d15);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x4b84[_0x2b9cf5];return _0xd0cf15;};'use strict';var util=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0x44b8('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x44b8('0x3'));var loggerAction=require(_0x44b8('0x4'))(_0x44b8('0x5'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x44b8('0x6'));var ut=require('./util/util');var utils=require(_0x44b8('0x7'));config['redis']=_[_0x44b8('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x44b8('0x9'))(new Redis(config[_0x44b8('0xa')]));var Sequence=function(){};Sequence[_0x44b8('0xb')]['enqueue']=function(_0xc650ec){this[_0x44b8('0xc')]=this[_0x44b8('0xc')]?this[_0x44b8('0xc')][_0x44b8('0xd')](_0xc650ec):_0xc650ec();};function Preview(_0x37e471){this[_0x44b8('0xe')]=new Sequence();this['campaignsPreview']=_0x37e471[_0x44b8('0xf')];this[_0x44b8('0x10')]=_0x37e471['trunks'];this[_0x44b8('0x11')]={};this['agents']=_0x37e471[_0x44b8('0x12')];this[_0x44b8('0x13')]=0x0;ami['on']('originateresponse',this[_0x44b8('0x14')]['bind'](this));ami['on']('hangup',this[_0x44b8('0x15')][_0x44b8('0x16')](this));ami['on'](_0x44b8('0x17'),this[_0x44b8('0x18')]['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0x44b8('0x16')](this));ami['on']('newexten',this[_0x44b8('0x19')][_0x44b8('0x16')](this));ami['on']('varset',this[_0x44b8('0x1a')][_0x44b8('0x16')](this));ami['on']('attendedtransfer',this[_0x44b8('0x1b')][_0x44b8('0x16')](this));ami['on']('blindtransfer',this[_0x44b8('0x1c')][_0x44b8('0x16')](this));this[_0x44b8('0x1d')](this[_0x44b8('0x1e')]);}function emit(_0x102ef9,_0x369c09,_0x452f2f){io['to'](_0x102ef9)[_0x44b8('0x1f')](_0x369c09,_0x452f2f);}function emitVoiceQueueChannelRemove(_0x429461){logger[_0x44b8('0x20')](_0x44b8('0x21'),JSON[_0x44b8('0x22')](_0x429461));emit(util['format'](_0x44b8('0x23'),_0x429461[_0x44b8('0x24')]),_0x44b8('0x25'),_0x429461);io[_0x44b8('0x1f')](_0x44b8('0x26'),_0x429461);}function notSendMessagesQueue(_0x51a34a){if(_0x51a34a[_0x44b8('0x27')]){if(_0x51a34a['originated']===0x0&&_0x51a34a[_0x44b8('0x28')]===0x0){_0x51a34a[_0x44b8('0x27')]=![];_0x51a34a[_0x44b8('0x29')]=0x0;_0x51a34a[_0x44b8('0x2a')]=0x0;_0x51a34a[_0x44b8('0x2b')]=utils['CAMPAIGN_STATUS'][_0x44b8('0x2c')];ut['logger'](_0x44b8('0x2d'),_0x51a34a[_0x44b8('0x24')]+'\x20is\x20not\x20active');}else{_0x51a34a[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x2f')];ut['logger'](_0x44b8('0x2d'),_0x51a34a[_0x44b8('0x24')]+'\x20is\x20deactivated');}}}Preview[_0x44b8('0xb')]['loopCampaigns']=function(){var _0xfb0028=this;setInterval(function(){_0xfb0028['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x387293=this[_0x44b8('0x1e')];this[_0x44b8('0x13')]+=0x1;for(var _0x1bd1be in _0x387293){if(_0x387293[_0x44b8('0x30')](_0x1bd1be)&&(_0x387293[_0x1bd1be][_0x44b8('0x31')]===_0x44b8('0x3')||_0x387293[_0x1bd1be][_0x44b8('0x31')]===_0x44b8('0x32'))&&_0x387293[_0x1bd1be][_0x44b8('0x33')]===_0x44b8('0x34')){if(this[_0x44b8('0x13')]>0x7){this[_0x44b8('0x13')]=0x0;this['clearZombieChannels']();}}if(_0x387293[_0x44b8('0x30')](_0x1bd1be)&&_0x387293[_0x1bd1be]['dialMethod']===_0x44b8('0x3')&&_0x387293[_0x1bd1be][_0x44b8('0x33')]===_0x44b8('0x34')){if(_0x387293[_0x1bd1be][_0x44b8('0x35')]){this[_0x44b8('0x36')](_0x387293[_0x1bd1be]);if(_0x387293[_0x1bd1be]['dialPreviewAutoRecallMe'])this[_0x44b8('0x37')](_0x387293[_0x1bd1be]);}else{notSendMessagesQueue(_0x387293[_0x1bd1be]);}}}};Preview[_0x44b8('0xb')][_0x44b8('0x38')]=function(_0x339f0f){var _0x46b008=this;this['sequence'][_0x44b8('0x39')](function(){if(!_[_0x44b8('0x3a')](_0x46b008[_0x44b8('0x11')][_0x339f0f])){loggerAction[_0x44b8('0x20')](_0x44b8('0x3b'),_0x339f0f,_0x44b8('0x3c'),_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')],_0x44b8('0x3e'),JSON[_0x44b8('0x22')](_0x46b008[_0x44b8('0x1e')][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]][_0x44b8('0x3f')]),_0x44b8('0x40'),JSON[_0x44b8('0x22')](_0x46b008[_0x44b8('0x1e')][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]][_0x44b8('0x28')]),JSON[_0x44b8('0x22')](_0x46b008[_0x44b8('0x11')][_0x339f0f]['dialAnswer']),JSON[_0x44b8('0x22')](_[_0x44b8('0x41')](_0x46b008['actions'][_0x339f0f],[_0x44b8('0x42'),_0x44b8('0x43'),_0x44b8('0x44'),_0x44b8('0x45')])));return ami['Action']({'action':_0x44b8('0x46'),'channel':_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x47')]})[_0x44b8('0x48')](function(_0x9cb2a){if(_0x9cb2a[_0x44b8('0x2b')]===_0x44b8('0x49')){setTimeout(function(){if(_0x46b008[_0x44b8('0x11')][_0x339f0f]){ut[_0x44b8('0x4a')](_0x46b008[_0x44b8('0x1e')][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]],_0x44b8('0x4b'));if(_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x4c')]===!![]){ut[_0x44b8('0x4d')](_0x46b008['campaignsPreview'][_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]],_0x44b8('0x4b'));ut['loggerError'](_0x44b8('0x4e')+_0x339f0f,_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]);}ut['loggerError'](_0x44b8('0x4f')+_0x339f0f,_0x46b008[_0x44b8('0x11')][_0x339f0f][_0x44b8('0x3d')]);delete _0x46b008[_0x44b8('0x11')][_0x339f0f];}},0x2328);}});}});};Preview[_0x44b8('0xb')]['clearZombieChannels']=function(){var _0x5ae5f9=this;loggerAction[_0x44b8('0x20')](_0x44b8('0x50'),_[_0x44b8('0x51')](this[_0x44b8('0x11')]));for(var _0x43906b in this[_0x44b8('0x11')]){if(_0x5ae5f9[_0x44b8('0x11')][_0x44b8('0x30')](_0x43906b)){_0x5ae5f9[_0x44b8('0x38')](_0x43906b);}}};Preview[_0x44b8('0xb')][_0x44b8('0x37')]=function(_0x2a9b2a){var _0xc1b9de=this;rpcDb[_0x44b8('0x52')](_0x2a9b2a['id'],ut[_0x44b8('0x53')](this[_0x44b8('0x12')]))[_0x44b8('0x54')](function(_0x3b3d5d){if(!_[_0x44b8('0x3a')](_0x3b3d5d)){for(var _0x49c507=0x0;_0x49c507<_0x3b3d5d['length'];_0x49c507+=0x1){if(ut[_0x44b8('0x55')](_0x3b3d5d[_0x49c507][_0x44b8('0x56')])<_0x2a9b2a[_0x44b8('0x57')]*0x3c){if(_0x3b3d5d[_0x49c507][_0x44b8('0x58')]&&!_0x3b3d5d[_0x49c507][_0x44b8('0x58')][_0x44b8('0x59')]){_0xc1b9de[_0x44b8('0x5a')](_0x3b3d5d[_0x49c507]['id'])['then'](ut[_0x44b8('0x5b')]('[RecallMe]'))[_0x44b8('0x48')](ut[_0x44b8('0x5b')](_0x44b8('0x5c')));}else{rpcDb[_0x44b8('0x5d')](_0x3b3d5d[_0x49c507]['id']);}}else{var _0x103d57=new Action(_0x3b3d5d[_0x49c507],_0x2a9b2a);_0x103d57[_0x44b8('0x5e')]=moment()['format'](_0x44b8('0x5f'));_0x2a9b2a[_0x44b8('0x60')]+=0x1;ut[_0x44b8('0x61')](_0x103d57,0x17,_0x44b8('0x62'));if(_0x2a9b2a['dialRecallInQueue']){rpcDb[_0x44b8('0x63')](ut[_0x44b8('0x64')](_0x3b3d5d[_0x49c507]));rpcDb[_0x44b8('0x65')](_0x103d57,_0x44b8('0x66'));}else{ut[_0x44b8('0x61')](_0x103d57,0x16,_0x44b8('0x67'));rpcDb['createCustomerHistory'](_0x103d57,_0x44b8('0x68'));rpcDb[_0x44b8('0x69')](_0x103d57,_0x44b8('0x68'));}}}}})[_0x44b8('0x48')](ut[_0x44b8('0x5b')]('[getContactRecallMe]'));};Preview['prototype'][_0x44b8('0x36')]=function(_0x4eb344){_0x4eb344[_0x44b8('0x27')]=!![];if(ut['IsNotLoggedIn'](_0x4eb344[_0x44b8('0x6a')])){_0x4eb344[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x6b')];}else if(!ut[_0x44b8('0x6c')](_0x4eb344[_0x44b8('0x35')])){_0x4eb344[_0x44b8('0x2b')]=utils['CAMPAIGN_STATUS'][_0x44b8('0x2c')];}else if(!this[_0x44b8('0x6d')](_0x4eb344[_0x44b8('0x6e')])){if(!this['isTrunkReachable'](_0x4eb344[_0x44b8('0x6f')])){_0x4eb344[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x70')];}else{_0x4eb344['message']=utils[_0x44b8('0x2e')][_0x44b8('0x71')];}}else{_0x4eb344['message']=utils[_0x44b8('0x2e')][_0x44b8('0x71')];}};Preview[_0x44b8('0xb')][_0x44b8('0x72')]=function(_0xe86e34,_0x546a50,_0x5b99a3){var _0xc181d2=this;var _0x3154bc=this[_0x44b8('0x11')][_0x546a50];var _0x4358aa=this[_0x44b8('0x1e')][_0x3154bc[_0x44b8('0x3d')]];var _0x3c9534;var _0xf0fb0d=![];var _0x10bbd9=0x2;var _0xdff81b=0x3;if(_0x4358aa){switch(_0x5b99a3){case'1':_0x4358aa[_0x44b8('0x73')]+=0x1;_0x3154bc[_0x44b8('0x74')]+=0x1;_0x3154bc['countglobal']=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x0,_0x44b8('0x76'));ami[_0x44b8('0x1f')](_0x44b8('0x77'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0x79')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0x7a'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'0',_0x4358aa)[_0x44b8('0x54')](function(_0x15bcba){_0xf0fb0d=_0x15bcba[_0x44b8('0x7c')]==0x1;_0x10bbd9=_0x4358aa[_0x44b8('0x7d')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,'Global');rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0x81'));}else{if(_0x3154bc[_0x44b8('0x74')]>=_0x4358aa[_0x44b8('0x82')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0x81'));}else{rpcDb[_0x44b8('0x83')](ut['scheduledAt'](_0x3154bc,_0x44b8('0x74'),_0x4358aa[_0x44b8('0x7d')]),_0x3154bc['unlockAgent'],_0x3154bc[_0x44b8('0x84')]);}}delete this[_0x44b8('0x11')][_0xe86e34['linkedid']];}else{_0x3154bc[_0x44b8('0x74')]++;logger[_0x44b8('0x20')](_0x44b8('0x85'),_0x3154bc['countnosuchnumberretry']);logger[_0x44b8('0x20')]('id',_0x3154bc['idContact']);_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc['idContact'],'field':{'countnosuchnumberretry':_0x3154bc[_0x44b8('0x74')]}})[_0x44b8('0x54')](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});break;case _0x44b8('0x88'):var _0x230b6a=moment()['format'](_0x44b8('0x5f'));_0x3154bc['responsetime']=_0x230b6a;_0x3154bc[_0x44b8('0x89')]=_0x230b6a;_0x3154bc[_0x44b8('0x4c')]=!![];_0x4358aa['pTalking']+=0x1;logger[_0x44b8('0x20')](_0x44b8('0x8a'),_0x3154bc[_0x44b8('0x8b')],_0x44b8('0x8c'),_0x4358aa[_0x44b8('0x24')],_0x44b8('0x40'),_0x4358aa[_0x44b8('0x28')]);ami[_0x44b8('0x1f')](_0x44b8('0x8d'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0x8e'),this[_0x44b8('0x1e')][_0x3154bc['queue']]));if(_0x4358aa[_0x44b8('0x8f')]){ami[_0x44b8('0x1f')](_0x44b8('0x90'),ut['buildAcw'](_0x3154bc));}break;case'16':ami[_0x44b8('0x1f')](_0x44b8('0x91'),ut['buildObj'](_0x3154bc,_0x44b8('0x92'),this[_0x44b8('0x1e')][_0x3154bc[_0x44b8('0x3d')]]));emitVoiceQueueChannelRemove(ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0x92')));_0x4358aa['outboundAnswerCallsDay']+=0x1;_0x4358aa[_0x44b8('0x93')]+=0x1;_0x4358aa[_0x44b8('0x94')]+=0x1;ut[_0x44b8('0x4d')](_0x4358aa,_0x44b8('0x95'));_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x4,_0x44b8('0x97'));rpcDb['createCustomerHistory'](_0x3154bc,_0x44b8('0x98'));rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0x99'));rpcDb[_0x44b8('0x9a')](_0x3154bc);_0x4358aa['sumDuration']+=_0x3154bc['talktime'];_0x4358aa['sumBillable']+=_0x3154bc[_0x44b8('0x9b')];logger[_0x44b8('0x20')](_0x44b8('0x9c'),_0x3154bc[_0x44b8('0x8b')],_0x44b8('0x8c'),_0x4358aa['name'],_0x44b8('0x40'),_0x4358aa['pTalking']);delete this[_0x44b8('0x11')][_0xe86e34[_0x44b8('0x9d')]];break;case _0x44b8('0x9e'):_0x4358aa['outboundBusyCallsDay']+=0x1;_0x3154bc['countbusyretry']+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x5,'Busy');_0x10bbd9=_0x4358aa[_0x44b8('0x9f')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];ami[_0x44b8('0x1f')](_0x44b8('0xa0'),ut[_0x44b8('0x78')](_0x3154bc,'busy'));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xa1'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'5',_0x4358aa)[_0x44b8('0x54')](function(_0x220f1b){_0xf0fb0d=_0x220f1b['additional']==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xa3'));}else{if(_0x3154bc[_0x44b8('0xa4')]>=_0x4358aa['dialBusyMaxRetry']){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xa1'));}else{rpcDb['rescheduleContact'](ut[_0x44b8('0xa5')](_0x3154bc,_0x44b8('0xa4'),_0x4358aa['dialBusyRetryFrequency']),_0x3154bc[_0x44b8('0xa6')],_0x3154bc['activeContact']);}}}else{_0x3154bc['countbusyretry']++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countbusyretry':_0x3154bc[_0x44b8('0xa4')]}})['then'](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)['then'](function(){});});}});break;case _0x44b8('0xa8'):_0x4358aa[_0x44b8('0xa9')]+=0x1;_0x3154bc[_0x44b8('0xaa')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x3,_0x44b8('0xab'));_0x10bbd9=_0x4358aa[_0x44b8('0xac')];_0xdff81b=_0x4358aa['callAdditionalPhoneAfterMin'];var _0x388c4c=ut['buildNoAnswerEventPayload'](_0x3154bc,_0x4358aa);ami['emit']('custom:agentnoanswer',_0x388c4c);rpcDb[_0x44b8('0x65')](_0x3154bc,'[callProgressDetectingCustomer][logNoAnswer]');_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'3',_0x4358aa)[_0x44b8('0x54')](function(_0x268e1e){_0xf0fb0d=_0x268e1e[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb['createCustomerFinal'](_0x3c9534,_0x44b8('0xad'));}else{if(_0x3154bc[_0x44b8('0xaa')]>=_0x4358aa[_0x44b8('0xae')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xaf'));}else{rpcDb[_0x44b8('0x83')](ut[_0x44b8('0xa5')](_0x3154bc,_0x44b8('0xaa'),_0x4358aa[_0x44b8('0xac')]),_0x3154bc['unlockAgent'],_0x3154bc['activeContact']);}}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2['incrementPreviewCounters']({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})[_0x44b8('0x54')](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)['then'](function(){});});}});break;case'CONGESTION':_0x4358aa[_0x44b8('0xb0')]+=0x1;_0x3154bc['countcongestionretry']+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x8,_0x44b8('0xb1'));_0x10bbd9=_0x4358aa[_0x44b8('0xb2')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];ami[_0x44b8('0x1f')](_0x44b8('0xb3'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xb4')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xb5'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'8',_0x4358aa)[_0x44b8('0x54')](function(_0x5de033){_0xf0fb0d=_0x5de033[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xb6'));}else{if(_0x3154bc[_0x44b8('0xb7')]>=_0x4358aa[_0x44b8('0xb8')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xb5'));}else{rpcDb[_0x44b8('0x83')](ut[_0x44b8('0xa5')](_0x3154bc,'countcongestionretry',_0x4358aa[_0x44b8('0x9f')]),_0x3154bc[_0x44b8('0xa6')],_0x3154bc[_0x44b8('0x84')]);}}}else{_0x3154bc['countcongestionretry']++;_0xc181d2['incrementPreviewCounters']({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countcongestionretry':_0x3154bc[_0x44b8('0xb7')]}})[_0x44b8('0x54')](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});break;case _0x44b8('0xb9'):_0x4358aa[_0x44b8('0xba')]+=0x1;_0x3154bc[_0x44b8('0xbb')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x14,_0x44b8('0xbc'));_0x10bbd9=_0x4358aa['dialAgentRejectRetryFrequency'];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];ami[_0x44b8('0x1f')](_0x44b8('0xbd'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xbe')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xbf'));_0xc181d2['verifyAdditionalPhones'](_0x3154bc,'20',_0x4358aa)['then'](function(_0x478f17){_0xf0fb0d=_0x478f17[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0x14,_0x44b8('0xbc'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xc0'));}else{if(_0x3154bc[_0x44b8('0xbb')]>=_0x4358aa[_0x44b8('0xc1')]){rpcDb['createCustomerFinal'](_0x3154bc,_0x44b8('0xc0'));}else{rpcDb[_0x44b8('0x83')](ut['scheduledAt'](_0x3154bc,'countagentrejectretry',_0x4358aa[_0x44b8('0xc2')]),_0x3154bc['unlockAgent'],_0x3154bc[_0x44b8('0x84')]);}}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc['idContact'],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})[_0x44b8('0x54')](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});break;case'ABANDONED':_0x4358aa[_0x44b8('0xc3')]+=0x1;_0x3154bc['countabandonedretry']+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0xb,_0x44b8('0xc4'));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xc5'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'11',_0x4358aa)['then'](function(_0x4d3b82){_0xf0fb0d=_0x4d3b82['additional']==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xc5'));}else{if(_0x3154bc[_0x44b8('0xc6')]>=_0x4358aa[_0x44b8('0xc7')]){rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xc5'));}else{rpcDb[_0x44b8('0x83')](ut[_0x44b8('0xa5')](_0x3154bc,_0x44b8('0xc8'),_0x4358aa[_0x44b8('0xc9')]),_0x3154bc[_0x44b8('0xa6')],_0x3154bc[_0x44b8('0x84')]);}}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc['idContact'],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})['then'](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)['then'](function(){});});}});break;case'18':_0x4358aa['outboundUnknownCallsDay']+=0x1;_0x3154bc[_0x44b8('0xca')]+=0x1;_0x3154bc['countglobal']=ut['totalGlobal'](_0x3154bc);ut['logCustomer'](_0x3154bc,0x12,_0xe86e34['cause-txt']||_0xe86e34['dialstatus']);ami[_0x44b8('0x1f')](_0x44b8('0xcb'),ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xcc')));rpcDb['createCustomerHistory'](_0x3154bc,_0x44b8('0xcd'));_0xc181d2[_0x44b8('0x7b')](_0x3154bc,'18',_0x4358aa)['then'](function(_0x572e5c){_0xf0fb0d=_0x572e5c[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut['cloneAction'](_0x3154bc,0x12,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xcd'));}else{rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xcd'));}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})['then'](function(){_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});delete this['actions'][_0xe86e34[_0x44b8('0x9d')]];break;case'19':_0x4358aa[_0x44b8('0xce')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut['totalGlobal'](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0x13,_0xe86e34['cause-txt']||_0xe86e34[_0x44b8('0xcf')]);ami[_0x44b8('0x1f')]('custom:amd',ut[_0x44b8('0x78')](_0x3154bc,_0x44b8('0xcc')));rpcDb[_0x44b8('0x65')](_0x3154bc,_0x44b8('0xd0'));_0xc181d2['verifyAdditionalPhones'](_0x3154bc,'18',_0x4358aa)[_0x44b8('0x54')](function(_0xf73cde){_0xf0fb0d=_0xf73cde[_0x44b8('0x7c')]==0x1;if(!_0xf0fb0d){if(ut[_0x44b8('0x75')](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xd0'));}else{rpcDb['createCustomerFinal'](_0x3154bc,'[callProgressDetectingCustomer][machine]');}}else{_0x3154bc[_0x44b8('0xaa')]++;_0xc181d2[_0x44b8('0x86')]({'id':_0x3154bc[_0x44b8('0xa7')],'field':{'countnoanswerretry':_0x3154bc[_0x44b8('0xaa')]}})[_0x44b8('0x54')](function(){_0xc181d2['swapAdditionalPhones'](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});});}});delete this['actions'][_0xe86e34[_0x44b8('0x9d')]];break;default:if(_0x3154bc['dialAnswer']){ut[_0x44b8('0x4d')](_0x4358aa,_0x44b8('0xd1'));ut[_0x44b8('0xd2')](_0x44b8('0xd3')+_0x4358aa[_0x44b8('0x24')],_0xe86e34);}_0x4358aa[_0x44b8('0xce')]+=0x1;_0x3154bc[_0x44b8('0x96')]=ut[_0x44b8('0x75')](_0x3154bc);ut[_0x44b8('0x61')](_0x3154bc,0xc,_0xe86e34['cause-txt']||_0xe86e34[_0x44b8('0xcf')]);_0x10bbd9=_0x4358aa[_0x44b8('0xc2')];_0xdff81b=_0x4358aa[_0x44b8('0x7e')];rpcDb[_0x44b8('0x65')](_0x3154bc,'[callProgressDetectingCustomer][logUnknown]');_0xc181d2['verifyAdditionalPhones'](_0x3154bc,'20',_0x4358aa)['then'](function(_0xf5e39){_0xf0fb0d=_0xf5e39['additional']==0x1;if(!_0xf0fb0d){if(ut['totalGlobal'](_0x3154bc)>=_0x4358aa[_0x44b8('0x7f')]){_0x3c9534=ut[_0x44b8('0x80')](_0x3154bc,0xf,_0x44b8('0xa2'));rpcDb[_0x44b8('0x69')](_0x3c9534,_0x44b8('0xd4'));}else{rpcDb[_0x44b8('0x69')](_0x3154bc,_0x44b8('0xd4'));}delete this[_0x44b8('0x11')][_0xe86e34['linkedid']];}else{_0xc181d2[_0x44b8('0x87')](_0x3154bc,_0x10bbd9,_0xdff81b)[_0x44b8('0x54')](function(){});}});}if(!(_0x3154bc[_0x44b8('0x4c')]&&_0x5b99a3==='16')){ut[_0x44b8('0x4a')](_0x4358aa,'[callProgressDetectingCustomer]');logger[_0x44b8('0x20')](_0x44b8('0xd5'),_0x3154bc[_0x44b8('0x8b')],'\x20Queue',_0x4358aa['name'],_0x44b8('0x3e'),_0x4358aa[_0x44b8('0x3f')]);}if(_0x5b99a3!==_0x44b8('0x88')){delete this[_0x44b8('0x11')][_0xe86e34[_0x44b8('0x9d')]];delete this['actions'][_0xe86e34[_0x44b8('0xd6')]];}_0x4358aa[_0x44b8('0xd7')]=!![];}};Preview['prototype'][_0x44b8('0xd8')]=function(_0x13942e,_0xcb4c9b,_0x237f67){if(_['isUndefined'](_0xcb4c9b)&&_0x44b8('0xd9')!==typeof _0xcb4c9b){return;}if(_['isUndefined'](_0x237f67)&&_0x44b8('0xd9')!==typeof _0x237f67){return;}switch(_0x237f67[_0x44b8('0xda')]){case'0':ut[_0x44b8('0xdb')](_0x13942e,0x0,_0x44b8('0x76'));rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xdd'));break;case'3':ut[_0x44b8('0xdb')](_0x13942e,0x3,_0x44b8('0xab'));rpcDb['createAgentHistory'](_0x13942e,_0x44b8('0xde'));break;case'5':ut[_0x44b8('0xdb')](_0x13942e,0x5,_0x44b8('0xdf'));rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xe0'));break;case'8':ut[_0x44b8('0xdb')](_0x13942e,0x8,'Congestion');rpcDb['createAgentHistory'](_0x13942e,_0x44b8('0xe1'));break;case'22':ut[_0x44b8('0xdb')](_0x13942e,0x16,'AnswerAGI');rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xe2'));break;default:ut['logAgent'](_0x13942e,0xc,_0x237f67[_0x44b8('0xda')]);rpcDb[_0x44b8('0xdc')](_0x13942e,_0x44b8('0xe1'));}ut[_0x44b8('0x4a')](_0xcb4c9b,_0x44b8('0xe3'));logger[_0x44b8('0x20')](_0x44b8('0xe4'),_0x13942e[_0x44b8('0x8b')],_0x44b8('0x8c'),_0xcb4c9b[_0x44b8('0x24')],_0x44b8('0x3e'),_0xcb4c9b[_0x44b8('0x3f')]);delete this[_0x44b8('0x11')][_0x13942e[_0x44b8('0x8b')]];};Preview[_0x44b8('0xb')]['verifyAdditionalPhones']=function(_0x30fca,_0x3d92a9,_0x13ab7b){return cmHopperAdditionalPhone[_0x44b8('0x7b')](_0x30fca,_0x3d92a9,_0x13ab7b)['catch'](logger[_0x44b8('0x20')](_0x44b8('0xe5')));};Preview['prototype'][_0x44b8('0x87')]=function(_0x4b9731,_0x1cd645,_0x3fee20){return cmHopperAdditionalPhone[_0x44b8('0x87')](_0x4b9731,_0x1cd645,_0x3fee20)[_0x44b8('0x48')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0x44b8('0xb')][_0x44b8('0x86')]=function(_0x5a2a9f){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x44b8('0x86')](_0x5a2a9f))[_0x44b8('0x48')](logger[_0x44b8('0x20')]('[incrementPreviewCounters]\x20'));};Preview['prototype'][_0x44b8('0xe6')]=function(_0x289fbd,_0x12f78b,_0x24a6a6,_0x2f5451,_0xc54e64){var _0x100295=this;return new Promise(function(_0x287902,_0x2675e9){if(_['isNil'](_0x12f78b)||_[_0x44b8('0x3a')](_0x12f78b['Contact'])||_[_0x44b8('0x3a')](_0x12f78b['phone'])||_['isNil'](_0x12f78b[_0x44b8('0x44')])){_0x2675e9(ut[_0x44b8('0x2b')](_0x44b8('0xe7'),_0x2f5451,_0xc54e64));return;}var _0x13c741=uuid['v4']();var _0x2eec38=_0x100295[_0x44b8('0x1e')][_0x12f78b[_0x44b8('0x3c')][_0x44b8('0x24')]];var _0x17b749=_0x24a6a6?_0x100295['agents'][_0x24a6a6]['id']:undefined;_0x100295[_0x44b8('0x11')][_0x13c741]=new Action(_0x12f78b,_0x2eec38,_0x13c741,_0x24a6a6,_0x17b749);var _0x1e3b5f=_0x100295[_0x44b8('0x11')][_0x13c741];_0x1e3b5f['unlockAgent']=_0x2f5451;_0x1e3b5f['activeContact']=_0xc54e64;_0x1e3b5f[_0x44b8('0xe8')]=_0x24a6a6;if(_['isEmpty'](_0x289fbd)){_0x100295[_0x44b8('0xe9')](_0x1e3b5f,_0x2eec38,_0x12f78b,_0x24a6a6)['then'](function(_0x1ae0bb){logger['info']('[Preview][execCall][success]',_0x44b8('0xea')+_0x1e3b5f[_0x44b8('0x3d')]+'\x20IdHopper:\x20'+_0x1e3b5f[_0x44b8('0xa7')],JSON[_0x44b8('0x22')](_0x1ae0bb));ami[_0x44b8('0x1f')](_0x44b8('0xeb'),ut[_0x44b8('0x78')](_0x1e3b5f,'called',_0x100295[_0x44b8('0x1e')][_0x1e3b5f['queue']]));_0x287902(ut['message']('Calling'));})[_0x44b8('0x48')](function(_0x2818ec){ut['logger'](_0x44b8('0xec'),_0x2818ec);_0x2675e9(ut[_0x44b8('0x2b')]('Call\x20failed',_0x2f5451,_0xc54e64));});}else{_0x2eec38['outboundBlacklistCallsDay']+=0x1;ut[_0x44b8('0xed')](_0x1e3b5f);rpcDb[_0x44b8('0xee')](_0x1e3b5f,'[Blacklist][error]');delete _0x100295[_0x44b8('0x11')][_0x13c741];_0x2675e9(ut[_0x44b8('0x2b')]('Contact\x20in\x20black\x20List',_0x2f5451,_0xc54e64));}});};Preview[_0x44b8('0xb')][_0x44b8('0x6d')]=function(_0x5ce5ed){return!_[_0x44b8('0x3a')](_0x5ce5ed)&&!_[_0x44b8('0x3a')](_0x5ce5ed[_0x44b8('0x24')])&&!_['isNil'](_0x5ce5ed[_0x44b8('0xef')])&&_0x5ce5ed['active']&&!_[_0x44b8('0x3a')](this['trunks'][util['format'](_0x44b8('0xf0'),_0x5ce5ed[_0x44b8('0x24')])])&&!_[_0x44b8('0x3a')](this[_0x44b8('0x10')][util[_0x44b8('0xf1')](_0x44b8('0xf0'),_0x5ce5ed[_0x44b8('0x24')])][_0x44b8('0x46')])&&(this[_0x44b8('0x10')][util[_0x44b8('0xf1')](_0x44b8('0xf0'),_0x5ce5ed['name'])][_0x44b8('0x46')]===_0x44b8('0xf2')||this[_0x44b8('0x10')][util[_0x44b8('0xf1')](_0x44b8('0xf0'),_0x5ce5ed[_0x44b8('0x24')])][_0x44b8('0x46')]===_0x44b8('0xf3'));};Preview['prototype'][_0x44b8('0x5a')]=function(_0x3f33a9,_0x561645){return this[_0x44b8('0xf4')](_0x3f33a9,_0x561645)[_0x44b8('0x54')](function(_0x2a40a3){return _['pick'](_0x2a40a3,['message']);})[_0x44b8('0x48')](function(_0x133da8){if(_0x133da8['unlock']){rpcDb['unlockContact'](_0x3f33a9);}if(_0x133da8[_0x44b8('0xef')]){rpcDb[_0x44b8('0x5d')](_0x3f33a9);}throw _[_0x44b8('0x41')](_0x133da8,[_0x44b8('0x2b')]);});};Preview[_0x44b8('0xb')]['execRun']=function(_0x2ded38,_0x4fbf1d){var _0x444f66=this;var _0x1386c6,_0x36537c;return rpcDb[_0x44b8('0xf5')](_0x2ded38)[_0x44b8('0x54')](function(_0x180c33){if(!_['isNil'](_0x180c33[0x0])){_0x36537c=_0x180c33[0x0][_0x44b8('0xf6')]?![]:!![];_0x1386c6=_0x180c33[0x0]['recallme']?!![]:![];_0x1386c6=_0x4fbf1d?!![]:_0x1386c6;}var _0x2c3e11=_0x444f66[_0x44b8('0xf7')](_0x180c33);if(_0x2c3e11['isValid']){rpcDb[_0x44b8('0xf8')](_['pick'](_0x180c33[0x0],[_0x44b8('0x44'),_0x44b8('0xf9')]))[_0x44b8('0x54')](function(_0x4b0aa0){_0x444f66[_0x44b8('0xe6')](_0x4b0aa0,_0x180c33[0x0],_0x4fbf1d,_0x36537c,_0x1386c6)[_0x44b8('0x54')](function(_0x4ff63e){return _0x4ff63e;})[_0x44b8('0x48')](function(_0x5af83d){throw _0x5af83d;});})['catch'](function(_0x4220b5){ut['logger'](_0x44b8('0xfa'),_0x4220b5);throw ut['message'](_0x44b8('0xfb'),_0x36537c,_0x1386c6);});}else{throw ut[_0x44b8('0x2b')](_0x2c3e11['message'],_0x36537c,_0x1386c6);}})[_0x44b8('0x48')](function(_0x39507e){ut['logger']('[Preview][getContactPreview]',_0x39507e);throw ut[_0x44b8('0x2b')](_0x44b8('0xfb'),![],!![]);});};Preview[_0x44b8('0xb')][_0x44b8('0xf7')]=function(_0x596fa4){if(_[_0x44b8('0x3a')](_0x596fa4)||_[_0x44b8('0xfc')](_0x596fa4)||!_[_0x44b8('0x3a')](_0x596fa4[0x0][_0x44b8('0x58')])&&_['isNil'](_0x596fa4[0x0]['Agent'][_0x44b8('0x24')])){ut[_0x44b8('0xfd')](_0x44b8('0xfe'),_0x596fa4);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1443bd=this[_0x44b8('0x1e')][_0x596fa4[0x0]['Queue'][_0x44b8('0x24')]];_0x1443bd[_0x44b8('0x2b')]=utils[_0x44b8('0x2e')][_0x44b8('0x71')];if(_[_0x44b8('0x3a')](_0x1443bd)){ut[_0x44b8('0xfd')]('[Preview][validateContact][Empty\x20Campaign]',_0x1443bd);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x44b8('0x6d')](_0x1443bd['Trunk'])){ut[_0x44b8('0xfd')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x44b8('0xff')+_0x1443bd[_0x44b8('0x24')]+_0x44b8('0x100'));if(!this[_0x44b8('0x6d')](_0x1443bd[_0x44b8('0x6f')])){ut[_0x44b8('0xfd')](_0x44b8('0x101'),_0x1443bd[_0x44b8('0x24')]+_0x44b8('0x102'));return{'isValid':![],'message':_0x44b8('0x103')};}}if(!ut[_0x44b8('0x6c')](_0x1443bd[_0x44b8('0x35')])){ut[_0x44b8('0xfd')](_0x44b8('0x104'),_0x1443bd[_0x44b8('0x24')]+_0x44b8('0x105'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1443bd[_0x44b8('0x24')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x44b8('0x106')};};Preview[_0x44b8('0xb')][_0x44b8('0xe9')]=function(_0x10fd21,_0x420a61,_0x22e5ae,_0x2f3340){var _0x4d98de=this;return new Promise(function(_0x597139,_0x2fffd5){var _0x3c90c2=_0x10fd21[_0x44b8('0x8b')];var _0x43c7ac=_0x4d98de[_0x44b8('0x6d')](_0x420a61['Trunk'])?util[_0x44b8('0xf1')](_0x44b8('0x107'),_0x420a61[_0x44b8('0x6e')][_0x44b8('0x24')],_[_0x44b8('0x3a')](_0x420a61[_0x44b8('0x108')])?'':_0x420a61['dialPrefix'][_0x44b8('0x109')]()||'',_0x420a61[_0x44b8('0x10a')]>0x0?_0x22e5ae[_0x44b8('0xf9')][_0x44b8('0x10b')](_0x420a61[_0x44b8('0x10a')]):_0x22e5ae['phone']):util['format'](_0x44b8('0x107'),_[_0x44b8('0x3a')](_0x420a61['TrunkBackup'])?_0x420a61['Trunk'][_0x44b8('0x24')]:_0x420a61['TrunkBackup'][_0x44b8('0x24')],_[_0x44b8('0x3a')](_0x420a61[_0x44b8('0x108')])?'':_0x420a61[_0x44b8('0x108')][_0x44b8('0x109')]()||'',_0x420a61[_0x44b8('0x10a')]>0x0?_0x22e5ae[_0x44b8('0xf9')][_0x44b8('0x10b')](_0x420a61['dialCutDigit']):_0x22e5ae[_0x44b8('0xf9')]);var _0xf24cdd=_0x4d98de[_0x44b8('0x6d')](_0x420a61['Trunk'])?ut[_0x44b8('0x10c')](_0x420a61[_0x44b8('0x6e')]['callerid'],_0x420a61['dialOriginateCallerIdName'],_0x420a61['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x420a61[_0x44b8('0x10d')],_0x420a61['dialRandomLastDigitCallerIdNumber']):_0x420a61['dialOriginateCallerIdNumber']):ut[_0x44b8('0x10c')](_[_0x44b8('0x3a')](_0x420a61[_0x44b8('0x6f')])?_0x420a61['Trunk'][_0x44b8('0x10e')]:_0x420a61['TrunkBackup'][_0x44b8('0x10e')],_0x420a61[_0x44b8('0x10f')],_0x420a61[_0x44b8('0x110')]>0x0?ut[_0x44b8('0x111')](_0x420a61['dialOriginateCallerIdNumber'],_0x420a61[_0x44b8('0x110')]):_0x420a61[_0x44b8('0x10d')]);if(_0xf24cdd){_0x10fd21[_0x44b8('0x112')]=ut[_0x44b8('0x113')](_0xf24cdd);_0x10fd21['originatecalleridnum']=ut['extractCalleridNumber'](_0xf24cdd);}var _0x35a564=ut[_0x44b8('0x114')](_0x420a61,_0x22e5ae,_0x43c7ac,_0xf24cdd,_0x3c90c2,_0x10fd21);_['merge'](_0x10fd21,ut[_0x44b8('0x115')](_0x35a564));_0x10fd21[_0x44b8('0x5e')]=moment()[_0x44b8('0xf1')](_0x44b8('0x5f'));_0x420a61[_0x44b8('0x116')]=_0x35a564;var _0x2da727=ut[_0x44b8('0x117')](_0x10fd21,_0x420a61,_0x35a564,_0x10fd21[_0x44b8('0x84')],_0x2f3340);return ami['Action'](_0x2da727)[_0x44b8('0x54')](function(_0x3e5fa8){_0x420a61[_0x44b8('0x3f')]+=0x1;logger['info'](_0x44b8('0x118'),_0x3c90c2,'\x20Queue',_0x420a61[_0x44b8('0x24')],'originated:\x20',_0x420a61[_0x44b8('0x3f')]);_0x597139(_0x3e5fa8);})[_0x44b8('0x48')](function(_0x1f5c08){ut[_0x44b8('0xdb')](_0x10fd21,0xe,_0x44b8('0x119'));rpcDb[_0x44b8('0xdc')](_0x10fd21,_0x44b8('0x11a'));_0x2fffd5(_0x1f5c08);});});};Preview[_0x44b8('0xb')][_0x44b8('0x19')]=function(_0x31913d){if(this[_0x44b8('0x11')][_0x31913d[_0x44b8('0x9d')]]){this['actions'][_0x31913d[_0x44b8('0x9d')]]['channel']=_0x31913d[_0x44b8('0x47')];}};Preview['prototype'][_0x44b8('0x14')]=function(_0x31132c){var _0xdfc44b=this;var _0x2c8438=this[_0x44b8('0x11')][_0x31132c[_0x44b8('0x11b')]];if(_0x2c8438){if(_0x2c8438[_0x44b8('0xe8')]&&this['agents'][_0x2c8438[_0x44b8('0xe8')]]){ut[_0x44b8('0x11c')](_0x2c8438,this[_0x44b8('0x12')][_0x2c8438[_0x44b8('0xe8')]][_0x44b8('0x24')],this[_0x44b8('0x12')][_0x2c8438[_0x44b8('0xe8')]]['id']);}var _0x46cdee=_[_0x44b8('0x11d')](_0x2c8438);_0x46cdee[_0x44b8('0x11e')]=moment()[_0x44b8('0xf1')](_0x44b8('0x5f'));var _0xbbc40d=_0xdfc44b[_0x44b8('0x1e')][_0x2c8438['queue']];if(ut[_0x44b8('0x11f')](_0x31132c[_0x44b8('0x120')])){if(_0x2c8438['unlockAgent']){rpcDb[_0x44b8('0x121')](_0x2c8438[_0x44b8('0xa7')]);}if(_0x2c8438[_0x44b8('0x84')]){rpcDb[_0x44b8('0x5d')](_0x2c8438[_0x44b8('0xa7')]);}ami['emit'](_0x44b8('0x122'),ut[_0x44b8('0x78')](_0x2c8438,_0x44b8('0x123'),this[_0x44b8('0x1e')][_0x2c8438['queue']]));this[_0x44b8('0xd8')](_0x46cdee,_0xbbc40d,_0x31132c);}else{_0x2c8438[_0x44b8('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x46cdee,0x4,'Answer');rpcDb[_0x44b8('0xdc')](_0x46cdee,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x44b8('0x15')]=function(_0xb5c212){var _0x87a38=this['actions'][_0xb5c212[_0x44b8('0x9d')]];var _0x32dafb;if(_0x87a38){_0x32dafb=this[_0x44b8('0x1e')][_0x87a38[_0x44b8('0x3d')]];logger['info'](_0x44b8('0x124'),_0xb5c212['linkedid'],_0x44b8('0x8c'),_0x32dafb[_0x44b8('0x24')],'pTalking:\x20',_0x32dafb[_0x44b8('0x28')]);}if(this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]]&&_0xb5c212[_0x44b8('0x9d')]!==_0xb5c212[_0x44b8('0x8b')]){if(_0xb5c212['cause']==='16'&&this['actions'][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){this[_0x44b8('0x72')](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')]);}else if(this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){logger[_0x44b8('0x20')](_0x44b8('0x126'),_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')],'\x20Queue',_0x32dafb['name'],_0x44b8('0x40'),_0x32dafb['pTalking']);this[_0x44b8('0x72')](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')]);}}else if(_0x87a38&&_['isNil'](_0x87a38[_0x44b8('0x127')])&&_0x32dafb[_0x44b8('0x128')]&&_0xb5c212[_0x44b8('0x9d')]===_0xb5c212[_0x44b8('0x8b')]&&_[_0x44b8('0x3a')](_0xb5c212[_0x44b8('0xda')])&&_0xb5c212['cause']==='16'&&_0xb5c212[_0x44b8('0x129')]==='6'&&_[_0x44b8('0x12a')](_0x87a38['transfer'])){if(_0x87a38[_0x44b8('0xa6')]){rpcDb[_0x44b8('0x121')](_0x87a38[_0x44b8('0xa7')]);}if(_0x87a38[_0x44b8('0x84')]){rpcDb[_0x44b8('0x5d')](_0x87a38['idContact']);}_0xb5c212[_0x44b8('0xda')]='22';this[_0x44b8('0xd8')](_0x87a38,_0x32dafb,_0xb5c212);}else if(_0x87a38&&_0x87a38[_0x44b8('0x12b')]){if(_0xb5c212[_0x44b8('0x125')]==='16'&&this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){logger[_0x44b8('0x20')](_0x44b8('0x12c'),_0xb5c212[_0x44b8('0x9d')],_0xb5c212['cause'],_0x44b8('0x8c'),_0x32dafb[_0x44b8('0x24')],_0x44b8('0x40'),_0x32dafb['pTalking']);this['callProgressDetectingCustomer'](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212['cause']);}else if(this[_0x44b8('0x11')][_0xb5c212[_0x44b8('0x9d')]][_0x44b8('0x4c')]){logger[_0x44b8('0x20')](_0x44b8('0x126'),_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')],'\x20Queue',_0x32dafb['name'],_0x44b8('0x40'),_0x32dafb[_0x44b8('0x28')]);this[_0x44b8('0x72')](_0xb5c212,_0xb5c212[_0x44b8('0x9d')],_0xb5c212[_0x44b8('0x125')]);}}};Preview[_0x44b8('0xb')]['syncDialEnd']=function(_0x4d88a6){if(this[_0x44b8('0x11')][_0x4d88a6[_0x44b8('0xd6')]]&&_0x4d88a6[_0x44b8('0xd6')]!==_0x4d88a6[_0x44b8('0x12d')]){this[_0x44b8('0x72')](_0x4d88a6,_0x4d88a6[_0x44b8('0xd6')],_0x4d88a6[_0x44b8('0xcf')]);}};Preview['prototype'][_0x44b8('0x18')]=function(_0x1f6244){if(this[_0x44b8('0x11')][_0x1f6244['linkedid']]&&_0x1f6244[_0x44b8('0x9d')]!==_0x1f6244[_0x44b8('0x8b')]&&!this[_0x44b8('0x11')][_0x1f6244[_0x44b8('0x9d')]]['dialAnswer']){if(_0x1f6244[_0x44b8('0x125')]==='1'){this[_0x44b8('0x72')](_0x1f6244,_0x1f6244[_0x44b8('0x9d')],_0x1f6244['cause']);}}};Preview['prototype']['addVariable']=function(_0x4b3c64,_0x59a43a,_0x355c5c){if(this[_0x44b8('0x11')][_0x4b3c64]){if(_[_0x44b8('0x3a')](this[_0x44b8('0x11')][_0x4b3c64][_0x44b8('0x116')])){this[_0x44b8('0x11')][_0x4b3c64][_0x44b8('0x116')]={};}this[_0x44b8('0x11')][_0x4b3c64][_0x44b8('0x116')][_0x59a43a]=_0x355c5c;}};Preview[_0x44b8('0xb')][_0x44b8('0x1a')]=function(_0x56aecf){try{if(!_[_0x44b8('0x3a')](_0x56aecf)){if(ut[_0x44b8('0x12e')](_[_0x44b8('0x12f')](_0x56aecf[_0x44b8('0x130')])[0x0])){this[_0x44b8('0x131')](_0x56aecf['uniqueid'],_[_0x44b8('0x12f')](_0x56aecf['variable'])[0x0],_0x56aecf[_0x44b8('0x132')]);}}}catch(_0x3432da){logger[_0x44b8('0x133')]('[syncVarSet][Preview]',util[_0x44b8('0x134')](_0x3432da,{'showHidden':![],'depth':null}));}};Preview[_0x44b8('0xb')]['syncAttendedTransfer']=function(_0xc8e8f4){if(_0xc8e8f4){if(this[_0x44b8('0x11')][_0xc8e8f4[_0x44b8('0x135')]]){this['actions'][_0xc8e8f4[_0x44b8('0x135')]]['transfer']=!![];}}};Preview[_0x44b8('0xb')][_0x44b8('0x1c')]=function(_0x280fe1){if(_0x280fe1){if(this['actions'][_0x280fe1[_0x44b8('0x136')]]){this['actions'][_0x280fe1[_0x44b8('0x136')]][_0x44b8('0x12b')]=!![];}}};module[_0x44b8('0x137')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 543eac8..3ebe66d 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x164e=['../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','holdtime','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory'];(function(_0x2a3d9d,_0xe08f40){var _0x7417f9=function(_0x13b26d){while(--_0x13b26d){_0x2a3d9d['push'](_0x2a3d9d['shift']());}};_0x7417f9(++_0xe08f40);}(_0x164e,0x98));var _0xe164=function(_0x3ddd54,_0x81ff53){_0x3ddd54=_0x3ddd54-0x0;var _0x347b08=_0x164e[_0x3ddd54];return _0x347b08;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xe164('0x0'))(_0xe164('0x1'));var cmHopper=require(_0xe164('0x2'));var cmHopperHistory=require(_0xe164('0x3'));var cmHopperBlack=require(_0xe164('0x4'));var agentReportPreview=require(_0xe164('0x5'));var voiceQueueReport=require(_0xe164('0x6'));function loggerCatch(_0x4dd3d8){return function(_0x47e529){logger[_0xe164('0x7')](_0x4dd3d8,util[_0xe164('0x8')](_0x47e529,{'showHidden':![],'depth':null}));};}function create(_0xe13fb7){return cmHopperHistory[_0xe164('0x9')](_0xe13fb7)[_0xe164('0xa')](loggerCatch(_0xe164('0xb')));}function createAgent(_0x377c29){return BPromise[_0xe164('0xc')]()[_0xe164('0xd')](agentReportPreview[_0xe164('0x9')](_0x377c29))['catch'](loggerCatch(_0xe164('0xb')));}function moveContact(_0x3d523){return cmHopper['moveContactManagedDialer'](_0x3d523,!![])[_0xe164('0xa')](loggerCatch(_0xe164('0xe')));}exports[_0xe164('0xf')]=function(_0x1f6da6){return cmHopperBlack['checkIsBlackList'](_0x1f6da6)['catch'](loggerCatch(_0xe164('0x10')));};exports[_0xe164('0x11')]=function(_0x2460da){return BPromise[_0xe164('0xc')]()[_0xe164('0xd')](cmHopper[_0xe164('0x11')](_0x2460da))[_0xe164('0xa')](loggerCatch(_0xe164('0x12')));};exports[_0xe164('0x9')]=function(_0x1afb7b,_0x5a2ea8){create(_0x1afb7b)[_0xe164('0xa')](loggerCatch(_0x5a2ea8));moveContact(_0x1afb7b)[_0xe164('0xa')](loggerCatch(_0x5a2ea8));};exports[_0xe164('0x13')]=function(_0x5c52bc,_0x5c6968){createAgent(_0x5c52bc)['catch'](loggerCatch(_0x5c6968));};exports[_0xe164('0x14')]=function(_0x7b21c9,_0x5d6781){create(_0x7b21c9)['catch'](loggerCatch(_0x5d6781));};exports[_0xe164('0x15')]=function(_0x25ae94,_0xc9add7){moveContact(_0x25ae94)[_0xe164('0xa')](loggerCatch(_0xc9add7));};exports[_0xe164('0x16')]=function(_0x21eefc,_0x30f529,_0x3847aa){if(_0x30f529){_0x21eefc['UserId']=null;}if(_0x3847aa){_0x21eefc[_0xe164('0x17')]=![];}return cmHopper[_0xe164('0x16')](_0x21eefc)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xe164('0x18')]=function(_0x39f9b9){return cmHopper['countReScheduled'](_0x39f9b9)[_0xe164('0xa')](loggerCatch(_0xe164('0x19')));};exports[_0xe164('0x1a')]=function(_0x4ceb50){return cmHopper[_0xe164('0x1a')]({'UserId':null},_0x4ceb50,0x1)['catch'](loggerCatch(_0xe164('0x1b')));};exports[_0xe164('0x1c')]=function(_0x2bf6e7){return cmHopper[_0xe164('0x1a')]({'active':![]},_0x2bf6e7,0x1)['catch'](loggerCatch(_0xe164('0x1d')));};exports[_0xe164('0x1e')]=function(_0x4fbdca){var _0x373258={};_0x373258[_0xe164('0x1f')]=_0x4fbdca[_0xe164('0x1f')];_0x373258[_0xe164('0x20')]=_0x4fbdca[_0xe164('0x20')];_0x373258[_0xe164('0x21')]=_0x4fbdca[_0xe164('0x21')];_0x373258[_0xe164('0x22')]=_0x4fbdca[_0xe164('0x22')];_0x373258[_0xe164('0x23')]=_0x4fbdca['queue'];_0x373258['queuecallerjoinAt']=_0x4fbdca[_0xe164('0x24')];_0x373258[_0xe164('0x25')]=_0x4fbdca[_0xe164('0x24')];_0x373258['queuecallercomplete']=0x1;_0x373258[_0xe164('0x26')]=_0x4fbdca[_0xe164('0x27')];_0x373258[_0xe164('0x28')]=_0x4fbdca['membername'];_0x373258[_0xe164('0x29')]=_0xe164('0x2a');_0x373258[_0xe164('0x2b')]='xcally-motion-preview';_0x373258[_0xe164('0x2c')]=0x0;_0x373258['assigned']=0x1;_0x373258['lastAssignedTo']=_0x4fbdca[_0xe164('0x2d')];_0x373258[_0xe164('0x2e')]='COMPLETED';return BPromise['resolve']()[_0xe164('0xd')](voiceQueueReport[_0xe164('0x2f')](_0x373258))[_0xe164('0xa')](loggerCatch(_0xe164('0x30')));};exports[_0xe164('0x31')]=function(_0x4e332b,_0x4c45f5){return BPromise[_0xe164('0xc')]()[_0xe164('0xd')](cmHopper[_0xe164('0x31')](_0x4e332b,_0x4c45f5))[_0xe164('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xe164('0x32')]=function(_0x523338){return cmHopper[_0xe164('0x16')](_0x523338,!![],!![])[_0xe164('0xa')](loggerCatch(_0xe164('0x33')));}; \ No newline at end of file +var _0x0de5=['queuecallercompleteAt','endtime','connectedlinename','context','exten','xcally-motion-preview','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0de5,0x10e));var _0x50de=function(_0x4cf80a,_0x3a463b){_0x4cf80a=_0x4cf80a-0x0;var _0x31d459=_0x0de5[_0x4cf80a];return _0x31d459;};'use strict';var util=require('util');var BPromise=require(_0x50de('0x0'));var logger=require(_0x50de('0x1'))('preview');var cmHopper=require(_0x50de('0x2'));var cmHopperHistory=require(_0x50de('0x3'));var cmHopperBlack=require(_0x50de('0x4'));var agentReportPreview=require(_0x50de('0x5'));var voiceQueueReport=require(_0x50de('0x6'));function loggerCatch(_0x25008c){return function(_0x234468){logger[_0x50de('0x7')](_0x25008c,util[_0x50de('0x8')](_0x234468,{'showHidden':![],'depth':null}));};}function create(_0x48c928){return cmHopperHistory[_0x50de('0x9')](_0x48c928)[_0x50de('0xa')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x18986e){return BPromise[_0x50de('0xb')]()[_0x50de('0xc')](agentReportPreview[_0x50de('0x9')](_0x18986e))['catch'](loggerCatch(_0x50de('0xd')));}function moveContact(_0x489d11){return cmHopper[_0x50de('0xe')](_0x489d11,!![])['catch'](loggerCatch(_0x50de('0xf')));}exports[_0x50de('0x10')]=function(_0x41188c){return cmHopperBlack[_0x50de('0x10')](_0x41188c)[_0x50de('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x4244d7){return BPromise['resolve']()[_0x50de('0xc')](cmHopper[_0x50de('0x11')](_0x4244d7))[_0x50de('0xa')](loggerCatch(_0x50de('0x12')));};exports[_0x50de('0x9')]=function(_0x567514,_0x1f084f){create(_0x567514)[_0x50de('0xa')](loggerCatch(_0x1f084f));moveContact(_0x567514)[_0x50de('0xa')](loggerCatch(_0x1f084f));};exports['createAgentHistory']=function(_0x2818c1,_0x5f4ebf){createAgent(_0x2818c1)[_0x50de('0xa')](loggerCatch(_0x5f4ebf));};exports['createCustomerHistory']=function(_0x306d74,_0x3ef414){create(_0x306d74)[_0x50de('0xa')](loggerCatch(_0x3ef414));};exports['createCustomerFinal']=function(_0x100b56,_0x13fbf6){moveContact(_0x100b56)[_0x50de('0xa')](loggerCatch(_0x13fbf6));};exports[_0x50de('0x13')]=function(_0x49d66e,_0x4f76e7,_0x2fc1a7){if(_0x4f76e7){_0x49d66e[_0x50de('0x14')]=null;}if(_0x2fc1a7){_0x49d66e[_0x50de('0x15')]=![];}return cmHopper[_0x50de('0x13')](_0x49d66e)[_0x50de('0xa')](loggerCatch(_0x50de('0x16')));};exports['countReScheduled']=function(_0x360398){return cmHopper[_0x50de('0x17')](_0x360398)[_0x50de('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x50de('0x18')]=function(_0x10d70a){return cmHopper[_0x50de('0x18')]({'UserId':null},_0x10d70a,0x1)[_0x50de('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0x50de('0x19')]=function(_0x1c7a8a){return cmHopper['unlockContact']({'active':![]},_0x1c7a8a,0x1)[_0x50de('0xa')](loggerCatch(_0x50de('0x1a')));};exports['crateCustomerReportQueue']=function(_0x5f1e4a){var _0xf1f7a6={};_0xf1f7a6['type']=_0x5f1e4a[_0x50de('0x1b')];_0xf1f7a6[_0x50de('0x1c')]=_0x5f1e4a['uniqueid'];_0xf1f7a6[_0x50de('0x1d')]=_0x5f1e4a['calleridnum'];_0xf1f7a6['calleridname']=_0x5f1e4a[_0x50de('0x1e')];_0xf1f7a6[_0x50de('0x1f')]=_0x5f1e4a[_0x50de('0x1f')];_0xf1f7a6[_0x50de('0x20')]=_0x5f1e4a['answertime'];_0xf1f7a6[_0x50de('0x21')]=_0x5f1e4a[_0x50de('0x22')];_0xf1f7a6[_0x50de('0x23')]=0x1;_0xf1f7a6[_0x50de('0x24')]=_0x5f1e4a[_0x50de('0x25')];_0xf1f7a6[_0x50de('0x26')]=_0x5f1e4a['membername'];_0xf1f7a6[_0x50de('0x27')]='from-sip';_0xf1f7a6[_0x50de('0x28')]=_0x50de('0x29');_0xf1f7a6['holdtime']=0x0;_0xf1f7a6[_0x50de('0x2a')]=0x1;_0xf1f7a6[_0x50de('0x2b')]=_0x5f1e4a[_0x50de('0x2c')];_0xf1f7a6[_0x50de('0x2d')]=_0x50de('0x2e');return BPromise['resolve']()[_0x50de('0xc')](voiceQueueReport[_0x50de('0x2f')](_0xf1f7a6))[_0x50de('0xa')](loggerCatch(_0x50de('0x30')));};exports[_0x50de('0x31')]=function(_0x5c2921,_0x222f16){return BPromise[_0x50de('0xb')]()[_0x50de('0xc')](cmHopper[_0x50de('0x31')](_0x5c2921,_0x222f16))[_0x50de('0xa')](loggerCatch(_0x50de('0x32')));};exports['rescheduleContactInQueue']=function(_0x3f2b0f){return cmHopper[_0x50de('0x13')](_0x3f2b0f,!![],!![])[_0x50de('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 0bebe74..f9b7e7b 100644 --- a/server/services/ami/preview/util/util.js +++ b/server/services/ami/preview/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb158=['milliseconds','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','active','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','getCallerIdRandom','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','toUpper','toLowerVariables','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','logAgent','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','push','getDiff'];(function(_0x17987c,_0x2cdd65){var _0x481cca=function(_0x3b205b){while(--_0x3b205b){_0x17987c['push'](_0x17987c['shift']());}};_0x481cca(++_0x2cdd65);}(_0xb158,0x1ee));var _0x8b15=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xb158[_0x5c351c];return _0x26f3b3;};'use strict';var util=require(_0x8b15('0x0'));var _=require('lodash');var moment=require(_0x8b15('0x1'));var logger=require(_0x8b15('0x2'))(_0x8b15('0x3'));var ipAgi=process['env'][_0x8b15('0x4')]||_0x8b15('0x5');var utils=require(_0x8b15('0x6'));exports[_0x8b15('0x7')]=function(_0x2a3a6c){return function(_0x2609d4){logger[_0x8b15('0x8')](_0x2a3a6c,util[_0x8b15('0x9')](_0x2609d4,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x9e9a79,_0x4676bd){logger[_0x8b15('0xa')](_0x9e9a79,util[_0x8b15('0x9')](_0x4676bd,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x352711,_0x334816){logger['error'](_0x352711,util[_0x8b15('0x9')](_0x334816,{'showHidden':![],'depth':null}));};exports[_0x8b15('0xb')]=function(_0x14caa4){return function(_0x74e92f){logger['info'](_0x14caa4,util[_0x8b15('0x9')](_0x74e92f,{'showHidden':![],'depth':null}));};};exports[_0x8b15('0xc')]=function(_0x545d7e,_0x4892b5,_0x71782a){return{'message':_0x545d7e,'unlock':_0x4892b5,'active':_0x71782a};};exports[_0x8b15('0xd')]=function(_0xf7b40e,_0x245d4d,_0x39a594){if(!_[_0x8b15('0xe')](_0x39a594)&&'string'===typeof _0x39a594&&!_['isEmpty'](_0x39a594)){if(!_['isUndefined'](_0x245d4d)&&_0x8b15('0xf')===typeof _0x245d4d&&!_[_0x8b15('0x10')](_0x245d4d)){return util[_0x8b15('0x11')](_0x8b15('0x12'),_0x245d4d,_0x39a594);}return util[_0x8b15('0x11')](_0x8b15('0x12'),_0x39a594,_0x39a594);}if(!_[_0x8b15('0xe')](_0xf7b40e)&&_0x8b15('0xf')===typeof _0xf7b40e&&!_[_0x8b15('0x10')](_0xf7b40e)){return _0xf7b40e;}return _0x8b15('0x13');};exports[_0x8b15('0x14')]=function(_0x12ccef){if(_['isNil'](_0x12ccef)){return![];}return _0x12ccef;};exports[_0x8b15('0x15')]=function(_0x3c70c5,_0x463fa6,_0x3e9402,_0x1727bb,_0x1aa164,_0x215baa){var _0x3c7b70={'XMD-QUEUE':_0x463fa6[_0x8b15('0x16')]?_0x463fa6[_0x8b15('0x16')][_0x8b15('0x17')]:'','XMD-CALLERID':_0x1727bb,'XMD-CALLERID-PREVIEW':_0x215baa?util[_0x8b15('0x11')](_0x8b15('0x12'),_0x215baa[_0x8b15('0x18')],_0x215baa[_0x8b15('0x19')]):_0x1727bb,'XMD-DIALID':_0x1aa164,'XMD-CONTACTID':_0x463fa6[_0x8b15('0x1a')],'XMD-CDRTYPE':_0x8b15('0x1b'),'CALLERID(all)':_0x1727bb,'XMD-VOICEQUEUEID':_0x463fa6[_0x8b15('0x1c')],'XMD-DIALCHANNEL':_0x3e9402,'XMD-DIALTIMEOUT':_0x3c70c5[_0x8b15('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x8b15('0x1e'),_0x3c70c5['dialQueueProject2']?'g':'',_[_0x8b15('0x10')](_0x3c70c5['monitor_format'])?'':_0x8b15('0x1f')),'XMD-DIALURL':_0x3c70c5['dialPreviewUrl']||'','XMD-AGI':_0x3c70c5['dialQueueProject']?util[_0x8b15('0x11')](_0x8b15('0x20'),ipAgi,_0x3c70c5[_0x8b15('0x21')]):_0x8b15('0x22'),'XMD-AGIAFTER':_0x3c70c5[_0x8b15('0x23')]?util[_0x8b15('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c70c5[_0x8b15('0x23')]):_0x8b15('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x215baa?_0x215baa[_0x8b15('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x215baa?_0x215baa['originatecalleridname']:'','XMD-DESTINATION':_0x8b15('0x25'),'SIPADDHEADER':_0x8b15('0x26')};if(!_['isEmpty'](_0x3c70c5['monitor_format'])){_0x3c7b70[util[_0x8b15('0x11')]('%s',_0x8b15('0x27'))]=_0x3c70c5[_0x8b15('0x28')];_0x3c7b70[util[_0x8b15('0x11')]('%s',_0x8b15('0x29'))]=_0x1aa164;}if(_0x463fa6&&_0x463fa6[_0x8b15('0x2a')]){for(var _0x3c1911 in _0x463fa6[_0x8b15('0x2a')]){if(_0x463fa6['Contact'][_0x8b15('0x2b')](_0x3c1911)){if(!_[_0x8b15('0x2c')](_0x463fa6[_0x8b15('0x2a')][_0x3c1911])&&_0x3c1911!=='id'&&_0x3c1911!==_0x8b15('0x2d')&&_0x3c1911!==_0x8b15('0x2e')&&_0x3c1911!==_0x8b15('0x2f')){_0x3c7b70[util[_0x8b15('0x11')]('%s%s','XMD-',_[_0x8b15('0x30')](_0x3c1911))]=_0x463fa6[_0x8b15('0x2a')][_0x3c1911];}}}}return _0x3c7b70;};exports[_0x8b15('0x31')]=function(_0x37c0cd){var _0x135ed0={};for(var _0x460ded in _0x37c0cd){if(_0x37c0cd[_0x8b15('0x2b')](_0x460ded)){_0x135ed0[util[_0x8b15('0x11')]('%s',_['toLower'](_0x460ded))]=_0x37c0cd[_0x460ded];}}return{'variables':_0x135ed0};};exports[_0x8b15('0x32')]=function(_0x61f743,_0x1eee6d){if(!_[_0x8b15('0x2c')](_0x61f743)){if(_0x61f743[_0x8b15('0x2b')](_0x8b15('0x33'))){if(_0x61f743[_0x8b15('0x33')]>0x0){_0x61f743[_0x8b15('0x33')]-=0x1;}else{logger[_0x8b15('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1eee6d);}}}else{logger[_0x8b15('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x1eee6d);}};exports[_0x8b15('0x34')]=function(_0x5ec423){var _0x3f7b12=moment()[_0x8b15('0x11')](_0x8b15('0x35'));_0x5ec423[_0x8b15('0x36')]=0xd;_0x5ec423[_0x8b15('0x37')]=_0x8b15('0x38');_0x5ec423[_0x8b15('0x39')]=_0x3f7b12;_0x5ec423['responsetime']=_0x3f7b12;_0x5ec423['endtime']=_0x3f7b12;};exports[_0x8b15('0x3a')]=function(_0x4272f5,_0x1d3aaa,_0x137403){var _0x5544c7=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4272f5['state']=_0x1d3aaa;_0x4272f5[_0x8b15('0x37')]=_0x137403;_0x4272f5[_0x8b15('0x3b')]=_0x5544c7;_0x4272f5[_0x8b15('0x3c')]=utils[_0x8b15('0x3d')](_0x4272f5[_0x8b15('0x3b')],_0x4272f5[_0x8b15('0x39')]);};exports[_0x8b15('0x3e')]=function(_0x329b00,_0x1d72b2,_0x5cd4c9){_0x329b00[_0x8b15('0x3f')]=_0x1d72b2;_0x329b00[_0x8b15('0x40')]=_0x5cd4c9;};exports[_0x8b15('0x41')]=function(_0x81bae0,_0x5db243,_0x305765){var _0x4405f7=moment()['format'](_0x8b15('0x35'));_0x81bae0[_0x8b15('0x36')]=_0x5db243;_0x81bae0['statedesc']=_0x305765;_0x81bae0['responsetime']=_0x81bae0[_0x8b15('0x3b')]?_0x81bae0['responsetime']:_0x4405f7;_0x81bae0['endtime']=_0x81bae0[_0x8b15('0x42')]?_0x81bae0[_0x8b15('0x42')]:_0x4405f7;_0x81bae0[_0x8b15('0x3c')]=utils[_0x8b15('0x3d')](_0x81bae0['responsetime']||0x0,_0x81bae0[_0x8b15('0x39')]||0x0);_0x81bae0[_0x8b15('0x43')]=_0x81bae0[_0x8b15('0x44')]?utils[_0x8b15('0x3d')](_0x81bae0[_0x8b15('0x42')],_0x81bae0[_0x8b15('0x44')]):0x0;};exports[_0x8b15('0x45')]=function(_0x348fb8){return _0x348fb8===_0x8b15('0x46');};exports[_0x8b15('0x47')]=function(_0x178286,_0x21d101,_0x461ba3,_0x2c0f5d,_0x493c3e){var _0x23e385=_0x2c0f5d?_0x8b15('0x48'):_0x178286[_0x8b15('0x18')];_0x23e385=_0x493c3e?_0x8b15('0x49'):_0x23e385;return{'actionid':_0x178286['uniqueid'],'action':'originate','channel':_0x178286[_0x8b15('0x4a')],'callerid':util[_0x8b15('0x11')](_0x8b15('0x12'),_0x23e385,_0x178286['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x8b15('0x4b'),'Priority':'1','variable':_0x461ba3,'timeout':(_0x21d101[_0x8b15('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x178286[_0x8b15('0x4d')]};};exports[_0x8b15('0x4e')]=function(_0x4b22eb){return _0x4b22eb[_0x8b15('0x4f')]+_0x4b22eb[_0x8b15('0x50')]+_0x4b22eb[_0x8b15('0x51')]+_0x4b22eb[_0x8b15('0x52')]+_0x4b22eb[_0x8b15('0x53')];};exports[_0x8b15('0x54')]=function(_0x4cd630){var _0x51ba7b=_['clone'](_0x4cd630);_0x51ba7b[_0x8b15('0x36')]=0xf;_0x51ba7b[_0x8b15('0x37')]=_0x8b15('0x55');return _0x51ba7b;};exports[_0x8b15('0x56')]=function(_0x22e256,_0x155920,_0xe94ab8){var _0x51a797={};_0x51a797[_0x155920]=_0x22e256[_0x155920];_0x51a797['active']=![];_0x51a797[_0x8b15('0x57')]=moment()[_0x8b15('0x58')](_0xe94ab8,_0x8b15('0x59'))[_0x8b15('0x11')](_0x8b15('0x35'));_0x51a797[_0x8b15('0x1a')]=_0x22e256['ContactId'];_0x51a797[_0x8b15('0x5a')]=_0x22e256['ListId'];_0x51a797[_0x8b15('0x1c')]=_0x22e256[_0x8b15('0x1c')]||undefined;return _0x51a797;};exports['decrementTalkink']=function(_0x1328a0,_0x11f980){if(!_[_0x8b15('0x2c')](_0x1328a0)){if(_0x1328a0[_0x8b15('0x5b')]>0x0){_0x1328a0[_0x8b15('0x5b')]-=0x1;}else{logger[_0x8b15('0x8')](_0x11f980,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x8b15('0x8')](_0x11f980,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x8b15('0x5c')]=function(_0x41df91){if(_0x41df91<=0x0){return!![];}return![];};function buildObj(_0x45bb23,_0x35999e,_0x244766){_0x45bb23[_0x8b15('0x5d')]=_0x35999e;_0x45bb23['name']=_0x45bb23[_0x8b15('0x5e')];_0x45bb23[_0x8b15('0x5f')]=_0x45bb23[_0x8b15('0x4a')];_0x45bb23[_0x8b15('0x60')]=_0x8b15('0x61');if(_0x244766){_0x45bb23[_0x8b15('0x62')]=_0x244766[_0x8b15('0x62')];}return _0x45bb23;}exports[_0x8b15('0x63')]=buildObj;exports[_0x8b15('0x64')]=function(_0x5bc790){var _0x25e633={};_0x25e633['queue']=_0x5bc790[_0x8b15('0x5e')];_0x25e633['interface']=_0x5bc790[_0x8b15('0x4a')];_0x25e633[_0x8b15('0x4d')]=_0x5bc790['uniqueid'];return _0x25e633;};exports[_0x8b15('0x65')]=function(_0x1eee54){var _0x27f04e=[];for(var _0x900751 in _0x1eee54){if(_0x1eee54[_0x8b15('0x2b')](_0x900751)){if(!_['isNil'](_0x1eee54[_0x900751])&&_0x1eee54[_0x900751][_0x8b15('0x36')]===_0x8b15('0x66')&&_0x1eee54[_0x900751][_0x8b15('0x67')]==='reachable'){_0x27f04e[_0x8b15('0x68')](_0x1eee54[_0x900751]['id']);}}}return _0x27f04e;};exports[_0x8b15('0x69')]=function(_0x6e7ae6){var _0x2b95e4=moment()[_0x8b15('0x6a')](0x0);var _0x5931b8=moment(_0x6e7ae6)[_0x8b15('0x6a')](0x0);return _0x2b95e4['diff'](_0x5931b8,_0x8b15('0x6b'));};exports[_0x8b15('0x6c')]=function(_0x361226){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x361226[_0x8b15('0x1a')],'ListId':_0x361226[_0x8b15('0x5a')],'VoiceQueueId':_0x361226[_0x8b15('0x1c')]||undefined,'CampaignId':_0x361226[_0x8b15('0x6d')]||undefined};};exports[_0x8b15('0x6e')]=function(_0x444951){if(_0x444951===_0x8b15('0x4d')||_0x444951===_0x8b15('0x6f')||_0x444951===_0x8b15('0x5e')||_0x444951==='type'||_0x444951===_0x8b15('0x70')||_0x444951==='dialAnswer'||_0x444951===_0x8b15('0x3f')||_0x444951===_0x8b15('0x4a')||_0x444951===_0x8b15('0x18')||_0x444951===_0x8b15('0x71')||_0x444951===_0x8b15('0x19')||_0x444951===_0x8b15('0x57')||_0x444951===_0x8b15('0x4f')||_0x444951===_0x8b15('0x50')||_0x444951===_0x8b15('0x51')||_0x444951==='countglobal'||_0x444951==='callback'||_0x444951===_0x8b15('0x72')||_0x444951==='callbackat'||_0x444951===_0x8b15('0x73')||_0x444951===_0x8b15('0x1a')||_0x444951===_0x8b15('0x5a')||_0x444951===_0x8b15('0x40')||_0x444951===_0x8b15('0x1c')||_0x444951===_0x8b15('0x74')||_0x444951===_0x8b15('0x75')||_0x444951==='xmd-queue'||_0x444951===_0x8b15('0x76')||_0x444951===_0x8b15('0x77')||_0x444951==='xmd-dialurl'||_0x444951===_0x8b15('0x78')||_0x444951===_0x8b15('0x79')||_0x444951===_0x8b15('0x7a')||_0x444951===_0x8b15('0x7b')||_0x444951===_0x8b15('0x7c')||_0x444951===_0x8b15('0x7d')||_0x444951===_0x8b15('0x7e')||_0x444951===_0x8b15('0x7f')||_0x444951===_0x8b15('0x80')||_0x444951==='rtpaudioqos'||_0x444951===_0x8b15('0x81')||_0x444951===_0x8b15('0x82')||_0x444951===_0x8b15('0x83')||_0x444951===_0x8b15('0x84')||_0x444951===_0x8b15('0x85')||_0x444951===_0x8b15('0x86')||_0x444951===_0x8b15('0x87')||_0x444951===_0x8b15('0x88')||_0x444951===_0x8b15('0x81')||_0x444951===_0x8b15('0x82')||_0x444951===_0x8b15('0x83')||_0x444951==='rtpaudioqosloss'||_0x444951===_0x8b15('0x85')||_0x444951===_0x8b15('0x86')||_0x444951==='rtpaudioqosrttbridged'||_0x444951===_0x8b15('0x89')||_0x444951==='bridgepvtcallid'||_0x444951==='state'||_0x444951===_0x8b15('0x37')){return![];}return!![];};exports[_0x8b15('0x8a')]=function(_0x1861f2,_0xb30a4f){var _0x453339,_0x4b6ec1,_0x4dc43;if(_0xb30a4f<=0x0){_0xb30a4f=0x1;}_0x453339=new RegExp('\x5cw{0,'+_0xb30a4f+'}$');_0x4b6ec1=Math['pow'](0xa,_0xb30a4f-0x1);_0x4dc43=Math['pow'](0xa,_0xb30a4f)-0x1;return util[_0x8b15('0x11')]('%s',_[_0x8b15('0x8b')](_0x1861f2,_0x453339,_[_0x8b15('0x8c')](_0x4b6ec1,_0x4dc43)));};exports[_0x8b15('0x8d')]=function(_0x2ac54f){var _0x22bc44=_0x2ac54f['match'](/"(.*?)"/);return _0x22bc44?_0x22bc44[0x1]:_0x2ac54f;};exports[_0x8b15('0x8e')]=function(_0xa1a31f){var _0x1b03ba=_0xa1a31f[_0x8b15('0x8f')](/<(.*?)>/);return _0x1b03ba?_0x1b03ba[0x1]:_0xa1a31f;};function buildNoAnswerEventPayload(_0x1219d3,_0x4254b8){var _0xa50b42=buildObj(_0x1219d3,_0x8b15('0x90'));if(!_['isEmpty'](_0x4254b8[_0x8b15('0x91')])){Object[_0x8b15('0x92')](_0x4254b8[_0x8b15('0x91')])[_0x8b15('0x93')](function(_0x54109b){_0xa50b42[_0x54109b[_0x8b15('0x94')]()]=_0x4254b8[_0x8b15('0x91')][_0x54109b];});}return _0xa50b42;}exports[_0x8b15('0x95')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x78cc=['YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','statedesc','ringtime','getSeconds','responsetime','logLookAgent','membername','UserId','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','\x5cw{0,','pow','replace','extractCalleridName','match','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','error','inspect','logger','info','loggerError','logger2','message','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','isEmpty','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist'];(function(_0x4f7a97,_0x14f986){var _0x2d97cb=function(_0x4323b6){while(--_0x4323b6){_0x4f7a97['push'](_0x4f7a97['shift']());}};_0x2d97cb(++_0x14f986);}(_0x78cc,0xf4));var _0xc78c=function(_0x1905a9,_0x2a902c){_0x1905a9=_0x1905a9-0x0;var _0x3ebf12=_0x78cc[_0x1905a9];return _0x3ebf12;};'use strict';var util=require(_0xc78c('0x0'));var _=require(_0xc78c('0x1'));var moment=require(_0xc78c('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xc78c('0x3')][_0xc78c('0x4')]||_0xc78c('0x5');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x16cceb){return function(_0x319e33){logger[_0xc78c('0x6')](_0x16cceb,util[_0xc78c('0x7')](_0x319e33,{'showHidden':![],'depth':null}));};};exports[_0xc78c('0x8')]=function(_0x5ed40d,_0xba3259){logger[_0xc78c('0x9')](_0x5ed40d,util[_0xc78c('0x7')](_0xba3259,{'showHidden':![],'depth':null}));};exports[_0xc78c('0xa')]=function(_0x21569a,_0x2e2d82){logger[_0xc78c('0x6')](_0x21569a,util[_0xc78c('0x7')](_0x2e2d82,{'showHidden':![],'depth':null}));};exports[_0xc78c('0xb')]=function(_0x550edd){return function(_0x45bc62){logger[_0xc78c('0x9')](_0x550edd,util[_0xc78c('0x7')](_0x45bc62,{'showHidden':![],'depth':null}));};};exports[_0xc78c('0xc')]=function(_0x5a904d,_0x564904,_0xe0cdc2){return{'message':_0x5a904d,'unlock':_0x564904,'active':_0xe0cdc2};};exports['getCallerId']=function(_0x1daac6,_0x4946b8,_0x51712a){if(!_['isUndefined'](_0x51712a)&&_0xc78c('0xd')===typeof _0x51712a&&!_['isEmpty'](_0x51712a)){if(!_[_0xc78c('0xe')](_0x4946b8)&&_0xc78c('0xd')===typeof _0x4946b8&&!_['isEmpty'](_0x4946b8)){return util['format']('\x22%s\x22\x20<%s>',_0x4946b8,_0x51712a);}return util[_0xc78c('0xf')](_0xc78c('0x10'),_0x51712a,_0x51712a);}if(!_['isUndefined'](_0x1daac6)&&'string'===typeof _0x1daac6&&!_['isEmpty'](_0x1daac6)){return _0x1daac6;}return _0xc78c('0x11');};exports['isActive']=function(_0x1c8d5b){if(_[_0xc78c('0x12')](_0x1c8d5b)){return![];}return _0x1c8d5b;};exports[_0xc78c('0x13')]=function(_0xc7957,_0x3069a8,_0x421ed2,_0x2b9b1f,_0x2b6787,_0x33eead){var _0x36c40d={'XMD-QUEUE':_0x3069a8[_0xc78c('0x14')]?_0x3069a8[_0xc78c('0x14')]['name']:'','XMD-CALLERID':_0x2b9b1f,'XMD-CALLERID-PREVIEW':_0x33eead?util[_0xc78c('0xf')](_0xc78c('0x10'),_0x33eead[_0xc78c('0x15')],_0x33eead[_0xc78c('0x16')]):_0x2b9b1f,'XMD-DIALID':_0x2b6787,'XMD-CONTACTID':_0x3069a8[_0xc78c('0x17')],'XMD-CDRTYPE':_0xc78c('0x18'),'CALLERID(all)':_0x2b9b1f,'XMD-VOICEQUEUEID':_0x3069a8['VoiceQueueId'],'XMD-DIALCHANNEL':_0x421ed2,'XMD-DIALTIMEOUT':_0xc7957[_0xc78c('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xc78c('0xf')](_0xc78c('0x1a'),_0xc7957[_0xc78c('0x1b')]?'g':'',_[_0xc78c('0x1c')](_0xc7957[_0xc78c('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xc7957[_0xc78c('0x1e')]||'','XMD-AGI':_0xc7957['dialQueueProject']?util[_0xc78c('0xf')](_0xc78c('0x1f'),ipAgi,_0xc7957[_0xc78c('0x20')]):_0xc78c('0x21'),'XMD-AGIAFTER':_0xc7957[_0xc78c('0x1b')]?util[_0xc78c('0xf')](_0xc78c('0x1f'),ipAgi,_0xc7957['dialQueueProject2']):_0xc78c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x33eead?_0x33eead[_0xc78c('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x33eead?_0x33eead['originatecalleridname']:'','XMD-DESTINATION':_0xc78c('0x23'),'SIPADDHEADER':_0xc78c('0x24')};if(!_[_0xc78c('0x1c')](_0xc7957[_0xc78c('0x1d')])){_0x36c40d[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0xc7957[_0xc78c('0x1d')];_0x36c40d[util[_0xc78c('0xf')]('%s',_0xc78c('0x25'))]=_0x2b6787;}if(_0x3069a8&&_0x3069a8[_0xc78c('0x26')]){for(var _0x3ba00c in _0x3069a8['Contact']){if(_0x3069a8['Contact'][_0xc78c('0x27')](_0x3ba00c)){if(!_[_0xc78c('0x12')](_0x3069a8['Contact'][_0x3ba00c])&&_0x3ba00c!=='id'&&_0x3ba00c!==_0xc78c('0x28')&&_0x3ba00c!==_0xc78c('0x29')&&_0x3ba00c!==_0xc78c('0x2a')){_0x36c40d[util['format']('%s%s',_0xc78c('0x2b'),_[_0xc78c('0x2c')](_0x3ba00c))]=_0x3069a8[_0xc78c('0x26')][_0x3ba00c];}}}}return _0x36c40d;};exports[_0xc78c('0x2d')]=function(_0x1f1f64){var _0x2497bd={};for(var _0x377506 in _0x1f1f64){if(_0x1f1f64['hasOwnProperty'](_0x377506)){_0x2497bd[util['format']('%s',_['toLower'](_0x377506))]=_0x1f1f64[_0x377506];}}return{'variables':_0x2497bd};};exports[_0xc78c('0x2e')]=function(_0x4f3e5a,_0x386435){if(!_[_0xc78c('0x12')](_0x4f3e5a)){if(_0x4f3e5a['hasOwnProperty'](_0xc78c('0x2f'))){if(_0x4f3e5a['originated']>0x0){_0x4f3e5a[_0xc78c('0x2f')]-=0x1;}else{logger[_0xc78c('0x6')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x386435);}}}else{logger[_0xc78c('0x6')](_0xc78c('0x30'),_0x386435);}};exports[_0xc78c('0x31')]=function(_0x15d105){var _0x5ee92c=moment()[_0xc78c('0xf')](_0xc78c('0x32'));_0x15d105[_0xc78c('0x33')]=0xd;_0x15d105['statedesc']=_0xc78c('0x34');_0x15d105[_0xc78c('0x35')]=_0x5ee92c;_0x15d105['responsetime']=_0x5ee92c;_0x15d105['endtime']=_0x5ee92c;};exports['logAgent']=function(_0x218965,_0x727330,_0x267ba1){var _0x152b1c=moment()[_0xc78c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x218965[_0xc78c('0x33')]=_0x727330;_0x218965[_0xc78c('0x36')]=_0x267ba1;_0x218965['responsetime']=_0x152b1c;_0x218965[_0xc78c('0x37')]=utils[_0xc78c('0x38')](_0x218965[_0xc78c('0x39')],_0x218965['starttime']);};exports[_0xc78c('0x3a')]=function(_0x38d856,_0x56d637,_0x181957){_0x38d856[_0xc78c('0x3b')]=_0x56d637;_0x38d856[_0xc78c('0x3c')]=_0x181957;};exports[_0xc78c('0x3d')]=function(_0x2cef17,_0x231ba5,_0x2bb04c){var _0x5c2d6e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2cef17[_0xc78c('0x33')]=_0x231ba5;_0x2cef17[_0xc78c('0x36')]=_0x2bb04c;_0x2cef17['responsetime']=_0x2cef17['responsetime']?_0x2cef17[_0xc78c('0x39')]:_0x5c2d6e;_0x2cef17['endtime']=_0x2cef17[_0xc78c('0x3e')]?_0x2cef17[_0xc78c('0x3e')]:_0x5c2d6e;_0x2cef17[_0xc78c('0x37')]=utils[_0xc78c('0x38')](_0x2cef17[_0xc78c('0x39')]||0x0,_0x2cef17[_0xc78c('0x35')]||0x0);_0x2cef17[_0xc78c('0x3f')]=_0x2cef17[_0xc78c('0x40')]?utils['getSeconds'](_0x2cef17[_0xc78c('0x3e')],_0x2cef17[_0xc78c('0x40')]):0x0;};exports[_0xc78c('0x41')]=function(_0x6a1200){return _0x6a1200===_0xc78c('0x42');};exports[_0xc78c('0x43')]=function(_0x410741,_0x2013bb,_0x5298cd,_0x5a4dbc,_0x62b2e1){var _0x1753dd=_0x5a4dbc?_0xc78c('0x44'):_0x410741[_0xc78c('0x15')];_0x1753dd=_0x62b2e1?'BOOKED':_0x1753dd;return{'actionid':_0x410741[_0xc78c('0x45')],'action':_0xc78c('0x46'),'channel':_0x410741[_0xc78c('0x47')],'callerid':util[_0xc78c('0xf')](_0xc78c('0x10'),_0x1753dd,_0x410741[_0xc78c('0x16')]),'Exten':_0xc78c('0x23'),'Context':'from-sip','Priority':'1','variable':_0x5298cd,'timeout':(_0x2013bb[_0xc78c('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x410741['uniqueid']};};exports[_0xc78c('0x49')]=function(_0x3d819a){return _0x3d819a[_0xc78c('0x4a')]+_0x3d819a[_0xc78c('0x4b')]+_0x3d819a[_0xc78c('0x4c')]+_0x3d819a[_0xc78c('0x4d')]+_0x3d819a[_0xc78c('0x4e')];};exports[_0xc78c('0x4f')]=function(_0x241333){var _0x2ec74f=_['clone'](_0x241333);_0x2ec74f[_0xc78c('0x33')]=0xf;_0x2ec74f[_0xc78c('0x36')]=_0xc78c('0x50');return _0x2ec74f;};exports['scheduledAt']=function(_0x3381eb,_0x31ef53,_0x47a898){var _0x7a1af={};_0x7a1af[_0x31ef53]=_0x3381eb[_0x31ef53];_0x7a1af[_0xc78c('0x51')]=![];_0x7a1af[_0xc78c('0x52')]=moment()[_0xc78c('0x53')](_0x47a898,_0xc78c('0x54'))[_0xc78c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x7a1af[_0xc78c('0x17')]=_0x3381eb[_0xc78c('0x17')];_0x7a1af[_0xc78c('0x55')]=_0x3381eb[_0xc78c('0x55')];_0x7a1af[_0xc78c('0x56')]=_0x3381eb[_0xc78c('0x56')]||undefined;return _0x7a1af;};exports[_0xc78c('0x57')]=function(_0x4ff9cf,_0x556a9b){if(!_['isNil'](_0x4ff9cf)){if(_0x4ff9cf['pTalking']>0x0){_0x4ff9cf[_0xc78c('0x58')]-=0x1;}else{logger[_0xc78c('0x6')](_0x556a9b,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc78c('0x6')](_0x556a9b,_0xc78c('0x59'));}};exports[_0xc78c('0x5a')]=function(_0x4eb40c){if(_0x4eb40c<=0x0){return!![];}return![];};function buildObj(_0x3797d8,_0x5361db,_0x748515){_0x3797d8[_0xc78c('0x5b')]=_0x5361db;_0x3797d8[_0xc78c('0x5c')]=_0x3797d8[_0xc78c('0x5d')];_0x3797d8[_0xc78c('0x5e')]=_0x3797d8[_0xc78c('0x47')];_0x3797d8['motionChannel']=_0xc78c('0x5f');if(_0x748515){_0x3797d8['mandatoryDisposition']=_0x748515[_0xc78c('0x60')];}return _0x3797d8;}exports[_0xc78c('0x61')]=buildObj;exports[_0xc78c('0x62')]=function(_0x325294){var _0x1b2b01={};_0x1b2b01[_0xc78c('0x5d')]=_0x325294[_0xc78c('0x5d')];_0x1b2b01['interface']=_0x325294['channelAgent'];_0x1b2b01[_0xc78c('0x45')]=_0x325294[_0xc78c('0x45')];return _0x1b2b01;};exports[_0xc78c('0x63')]=function(_0x486b58){var _0x1aa8c1=[];for(var _0x56eaaf in _0x486b58){if(_0x486b58[_0xc78c('0x27')](_0x56eaaf)){if(!_['isNil'](_0x486b58[_0x56eaaf])&&_0x486b58[_0x56eaaf][_0xc78c('0x33')]===_0xc78c('0x64')&&_0x486b58[_0x56eaaf]['status']===_0xc78c('0x65')){_0x1aa8c1[_0xc78c('0x66')](_0x486b58[_0x56eaaf]['id']);}}}return _0x1aa8c1;};exports[_0xc78c('0x67')]=function(_0x1ef415){var _0x10fda1=moment()[_0xc78c('0x68')](0x0);var _0x16d103=moment(_0x1ef415)[_0xc78c('0x68')](0x0);return _0x10fda1[_0xc78c('0x69')](_0x16d103,_0xc78c('0x6a'));};exports[_0xc78c('0x6b')]=function(_0x12dd86){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x12dd86['ContactId'],'ListId':_0x12dd86[_0xc78c('0x55')],'VoiceQueueId':_0x12dd86[_0xc78c('0x56')]||undefined,'CampaignId':_0x12dd86[_0xc78c('0x6c')]||undefined};};exports[_0xc78c('0x6d')]=function(_0x5de092){if(_0x5de092===_0xc78c('0x45')||_0x5de092==='idContact'||_0x5de092===_0xc78c('0x5d')||_0x5de092===_0xc78c('0x6e')||_0x5de092===_0xc78c('0x6f')||_0x5de092==='dialAnswer'||_0x5de092===_0xc78c('0x3b')||_0x5de092===_0xc78c('0x47')||_0x5de092===_0xc78c('0x15')||_0x5de092===_0xc78c('0x51')||_0x5de092===_0xc78c('0x16')||_0x5de092==='scheduledat'||_0x5de092===_0xc78c('0x4a')||_0x5de092==='countcongestionretry'||_0x5de092===_0xc78c('0x4c')||_0x5de092===_0xc78c('0x70')||_0x5de092===_0xc78c('0x71')||_0x5de092===_0xc78c('0x72')||_0x5de092===_0xc78c('0x73')||_0x5de092===_0xc78c('0x74')||_0x5de092===_0xc78c('0x17')||_0x5de092===_0xc78c('0x55')||_0x5de092===_0xc78c('0x3c')||_0x5de092==='VoiceQueueId'||_0x5de092===_0xc78c('0x75')||_0x5de092===_0xc78c('0x76')||_0x5de092===_0xc78c('0x77')||_0x5de092===_0xc78c('0x78')||_0x5de092===_0xc78c('0x79')||_0x5de092===_0xc78c('0x7a')||_0x5de092==='xmd-dialtimeout'||_0x5de092===_0xc78c('0x7b')||_0x5de092===_0xc78c('0x7c')||_0x5de092==='xmd-dialchannel'||_0x5de092==='xmd-contactid'||_0x5de092===_0xc78c('0x7d')||_0x5de092===_0xc78c('0x7e')||_0x5de092===_0xc78c('0x7f')||_0x5de092===_0xc78c('0x80')||_0x5de092===_0xc78c('0x81')||_0x5de092===_0xc78c('0x82')||_0x5de092===_0xc78c('0x83')||_0x5de092===_0xc78c('0x84')||_0x5de092===_0xc78c('0x85')||_0x5de092===_0xc78c('0x86')||_0x5de092===_0xc78c('0x87')||_0x5de092===_0xc78c('0x88')||_0x5de092===_0xc78c('0x81')||_0x5de092==='rtpaudioqosbridged'||_0x5de092==='rtpaudioqosjitter'||_0x5de092===_0xc78c('0x84')||_0x5de092===_0xc78c('0x85')||_0x5de092===_0xc78c('0x86')||_0x5de092===_0xc78c('0x87')||_0x5de092===_0xc78c('0x88')||_0x5de092==='bridgepeer'||_0x5de092==='bridgepvtcallid'||_0x5de092===_0xc78c('0x33')||_0x5de092===_0xc78c('0x36')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1a3474,_0x4b4fba){var _0x33a154,_0x13d298,_0x83d228;if(_0x4b4fba<=0x0){_0x4b4fba=0x1;}_0x33a154=new RegExp(_0xc78c('0x89')+_0x4b4fba+'}$');_0x13d298=Math['pow'](0xa,_0x4b4fba-0x1);_0x83d228=Math[_0xc78c('0x8a')](0xa,_0x4b4fba)-0x1;return util[_0xc78c('0xf')]('%s',_[_0xc78c('0x8b')](_0x1a3474,_0x33a154,_['random'](_0x13d298,_0x83d228)));};exports[_0xc78c('0x8c')]=function(_0x594d5e){var _0x386c6a=_0x594d5e[_0xc78c('0x8d')](/"(.*?)"/);return _0x386c6a?_0x386c6a[0x1]:_0x594d5e;};exports['extractCalleridNumber']=function(_0x5714cd){var _0x958e59=_0x5714cd[_0xc78c('0x8d')](/<(.*?)>/);return _0x958e59?_0x958e59[0x1]:_0x5714cd;};function buildNoAnswerEventPayload(_0x980052,_0x4633e9){var _0x40e49b=buildObj(_0x980052,_0xc78c('0x8e'));if(!_['isEmpty'](_0x4633e9[_0xc78c('0x8f')])){Object[_0xc78c('0x90')](_0x4633e9[_0xc78c('0x8f')])['forEach'](function(_0x4f99b9){_0x40e49b[_0x4f99b9[_0xc78c('0x91')]()]=_0x4633e9[_0xc78c('0x8f')][_0x4f99b9];});}return _0x40e49b;}exports[_0xc78c('0x92')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index be382c8..39f0807 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa3e=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean'];(function(_0x14e249,_0x21b474){var _0x56fb38=function(_0xa906dd){while(--_0xa906dd){_0x14e249['push'](_0x14e249['shift']());}};_0x56fb38(++_0x21b474);}(_0xaa3e,0xc2));var _0xeaa3=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xaa3e[_0x39106e];return _0x892aec;};'use strict';exports[_0xeaa3('0x0')]={'queue':{'type':_0xeaa3('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xeaa3('0x1'),'required':!![]},'penalty':{'type':_0xeaa3('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xeaa3('0x3')]={'queue':{'type':_0xeaa3('0x1'),'required':!![]},'interface':{'type':_0xeaa3('0x1'),'required':!![]}};exports[_0xeaa3('0x4')]={'interface':{'type':_0xeaa3('0x1'),'required':!![]},'paused':{'type':_0xeaa3('0x5')},'reason':{'type':_0xeaa3('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xeaa3('0x6')]={'uniqueid':{'type':_0xeaa3('0x1'),'required':!![]}};exports[_0xeaa3('0x7')]={'uniqueid':{'type':_0xeaa3('0x1'),'required':!![]},'filename':{'type':_0xeaa3('0x1')},'format':{'type':_0xeaa3('0x1')},'mixmonitorid':{'type':_0xeaa3('0x1')}};exports[_0xeaa3('0x8')]={'uniqueid':{'type':_0xeaa3('0x1'),'required':!![]}};exports[_0xeaa3('0x9')]={'uniqueid':{'type':_0xeaa3('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xeaa3('0x1')}}; \ No newline at end of file +var _0x26bb=['queuepause','boolean','reload','voicequeuechannel','voicechannel','queueadd','string','number','queueremove'];(function(_0x5afc24,_0x4e8e08){var _0x591bd2=function(_0x572bfd){while(--_0x572bfd){_0x5afc24['push'](_0x5afc24['shift']());}};_0x591bd2(++_0x4e8e08);}(_0x26bb,0x95));var _0xb26b=function(_0x4da528,_0x3e5a26){_0x4da528=_0x4da528-0x0;var _0x13b677=_0x26bb[_0x4da528];return _0x13b677;};'use strict';exports[_0xb26b('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xb26b('0x1'),'required':!![]},'membername':{'type':_0xb26b('0x1'),'required':!![]},'penalty':{'type':_0xb26b('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xb26b('0x3')]={'queue':{'type':_0xb26b('0x1'),'required':!![]},'interface':{'type':_0xb26b('0x1'),'required':!![]}};exports[_0xb26b('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xb26b('0x5')},'reason':{'type':_0xb26b('0x1'),'required':![]}};exports[_0xb26b('0x6')]={'module':{'type':'string','required':![]}};exports[_0xb26b('0x7')]={'uniqueid':{'type':_0xb26b('0x1'),'required':!![]}};exports[_0xb26b('0x8')]={'uniqueid':{'type':_0xb26b('0x1'),'required':!![]},'filename':{'type':_0xb26b('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xb26b('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xb26b('0x1'),'required':!![]},'exten':{'type':_0xb26b('0x1'),'required':!![]},'context':{'type':_0xb26b('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7acfabf..633cfe5 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x513a96,_0x3f21d4){var _0x284c0a=function(_0x16ef88){while(--_0x16ef88){_0x513a96['push'](_0x513a96['shift']());}};_0x284c0a(++_0x3f21d4);}(_0xadb5,0xad));var _0x5adb=function(_0x8fe32,_0x5eb216){_0x8fe32=_0x8fe32-0x0;var _0x1b4427=_0xadb5[_0x8fe32];return _0x1b4427;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x12a06b,_0x417b51){_0x12a06b=_0x12a06b-0x0;var _0x5d0bb8=_0x0b0e[_0x12a06b];return _0x5d0bb8;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 14a973f..334ffb4 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3401=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x6a1267,_0x9d5139){var _0x26c79b=function(_0x1f468d){while(--_0x1f468d){_0x6a1267['push'](_0x6a1267['shift']());}};_0x26c79b(++_0x9d5139);}(_0x3401,0x145));var _0x1340=function(_0x1a548d,_0x2daad7){_0x1a548d=_0x1a548d-0x0;var _0x5be5ad=_0x3401[_0x1a548d];return _0x5be5ad;};'use strict';function mergeDBDataToRealtime(_0x292aa2,_0x25c14e){var _0xbcc77=Object[_0x1340('0x0')]({},_0x292aa2);for(var _0x66c2e5 in _0x25c14e){if(_0xbcc77[_0x1340('0x1')](_0x66c2e5)){_0xbcc77[_0x66c2e5]=_0x25c14e[_0x66c2e5];}}return _0xbcc77;}exports[_0x1340('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x83f4=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x4bb779,_0x5781c1){var _0x59372a=function(_0x182476){while(--_0x182476){_0x4bb779['push'](_0x4bb779['shift']());}};_0x59372a(++_0x5781c1);}(_0x83f4,0x186));var _0x483f=function(_0x6489f6,_0xde8e10){_0x6489f6=_0x6489f6-0x0;var _0xa566db=_0x83f4[_0x6489f6];return _0xa566db;};'use strict';function mergeDBDataToRealtime(_0x4ffab3,_0x4f52b0){var _0xb9f047=Object[_0x483f('0x0')]({},_0x4ffab3);for(var _0x98b638 in _0x4f52b0){if(_0xb9f047[_0x483f('0x1')](_0x98b638)){_0xb9f047[_0x98b638]=_0x4f52b0[_0x98b638];}}return _0xb9f047;}exports[_0x483f('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index cae2710..53c21a8 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e42=['monitors','createdAt','calleridname','isArray','startsWith','Local','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','callerid','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','UserId','membername','create','monitorFilename'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2e42,0x1c8));var _0x22e4=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0x2e42[_0x193ddf];return _0x5bc6df;};'use strict';var _=require(_0x22e4('0x0'));var moment=require(_0x22e4('0x1'));var util=require(_0x22e4('0x2'));var config=require(_0x22e4('0x3'));var ami=require(_0x22e4('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x22e4('0x5'));var RpcVoiceDialReport=require(_0x22e4('0x6'));var RpcMemberReport=require(_0x22e4('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x22e4('0x8'));var RpcVoiceTransferReport=require(_0x22e4('0x9'));var VoiceQueueReport=require(_0x22e4('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x22e4('0xb'));function Report(_0x58a3aa){this[_0x22e4('0xc')]=_0x58a3aa;this[_0x22e4('0xd')]=_0x58a3aa['agents'];this[_0x22e4('0xe')]=_0x58a3aa[_0x22e4('0xe')];}Report[_0x22e4('0xf')][_0x22e4('0x10')]=function(_0x29e7a5){var _0x247bf0=new VoiceQueueReport(this[_0x22e4('0xc')]);var _0x2f3f36=new VoiceAgentReport(this[_0x22e4('0xc')]);var _0x3ffdbf=new VoiceDialReport(this['realtime']);var _0x22bcd4=new VoiceCallReport(this['realtime']);var _0x21f174=new UserReport(this[_0x22e4('0xc')]);if(config[_0x22e4('0x11')]&&config[_0x22e4('0x11')][_0x22e4('0x12')]){ami['on'](_0x22e4('0x13'),this[_0x22e4('0x14')][_0x22e4('0x15')](this));ami['on'](_0x22e4('0x16'),this[_0x22e4('0x17')][_0x22e4('0x15')](this));ami['on'](_0x22e4('0x18'),this[_0x22e4('0x19')]['bind'](this));ami['on'](_0x22e4('0x1a'),this[_0x22e4('0x1b')]['bind'](this));ami['on'](_0x22e4('0x1c'),this[_0x22e4('0x1d')][_0x22e4('0x15')](this));ami['on']('attendedtransfer',this[_0x22e4('0x1e')][_0x22e4('0x15')](this));}};Report[_0x22e4('0xf')][_0x22e4('0x1f')]=function(_0x157b6c){var _0x3061fd;_0x3061fd=_[_0x22e4('0x20')](this[_0x22e4('0xd')],function(_0x4093e5){return _0x4093e5[_0x22e4('0x21')]==_0x157b6c||_0x4093e5[_0x22e4('0x22')]==_0x157b6c;});if(_[_0x22e4('0x23')](_0x3061fd)){var _0x160a2a=_[_0x22e4('0x20')](this[_0x22e4('0xe')],function(_0xec1155){return _0xec1155[_0x22e4('0x21')]==_0x157b6c||_0xec1155[_0x22e4('0x22')]==_0x157b6c;});if(_0x160a2a){_0x3061fd=_[_0x22e4('0x20')](this[_0x22e4('0xd')],function(_0x3667c5){return _0x3667c5[_0x22e4('0x24')]==util[_0x22e4('0x25')](_0x22e4('0x26'),_0x160a2a[_0x22e4('0x22')]);});}}return _0x3061fd;};Report['prototype'][_0x22e4('0x14')]=function(_0x23a8bb){for(var _0x472fb4=0x0;_0x472fb4<_0x23a8bb[_0x22e4('0x27')];_0x472fb4+=0x1){var _0xf36040=this[_0x22e4('0x1f')](_0x23a8bb[_0x472fb4][_0x22e4('0x28')]);if(_0xf36040){_0x23a8bb[_0x472fb4][_0x22e4('0x21')]=_0xf36040[_0x22e4('0x21')];_0x23a8bb[_0x472fb4]['assigned']=!![];_0x23a8bb[_0x472fb4][_0x22e4('0x29')]=_0xf36040[_0x22e4('0x22')];_0x23a8bb[_0x472fb4][_0x22e4('0x24')]=_[_0x22e4('0x23')](_0xf36040[_0x22e4('0x24')])?util[_0x22e4('0x25')](_0x22e4('0x26'),_0xf36040[_0x22e4('0x22')]):_0xf36040['interface'];if(_0x23a8bb[_0x472fb4]['queuecallercomplete']){_0x23a8bb[_0x472fb4][_0x22e4('0x2a')]=moment()['format'](_0x22e4('0x2b'));}if(_0x23a8bb[_0x472fb4][_0x22e4('0x2c')]){_0x23a8bb[_0x472fb4][_0x22e4('0x2d')]=moment()['format'](_0x22e4('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x23a8bb[_0x472fb4]);}RpcVoiceQueueReport['create'](_0x23a8bb[_0x472fb4]);}};function extractCalleridNumber(_0x3ed4c7){var _0x1cc03c=_0x3ed4c7[_0x22e4('0x2e')](/<(.*?)>/);return _0x1cc03c?_0x1cc03c[0x1]:_0x3ed4c7;}Report[_0x22e4('0xf')][_0x22e4('0x2f')]=function(_0x7b5992){for(var _0x575576=0x0;_0x575576','calleridname','transfers','linkedid','transfereelinkedid','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','interface','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment'];(function(_0x30c48d,_0x25e828){var _0x2c64aa=function(_0x244ae6){while(--_0x244ae6){_0x30c48d['push'](_0x30c48d['shift']());}};_0x2c64aa(++_0x25e828);}(_0x907d,0x174));var _0xd907=function(_0x53b6ae,_0x3cb9f4){_0x53b6ae=_0x53b6ae-0x0;var _0x34f4b2=_0x907d[_0x53b6ae];return _0x34f4b2;};'use strict';var _=require(_0xd907('0x0'));var moment=require(_0xd907('0x1'));var util=require(_0xd907('0x2'));var config=require(_0xd907('0x3'));var ami=require(_0xd907('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xd907('0x5'));var RpcMemberReport=require(_0xd907('0x6'));var RpcVoiceQueueReport=require(_0xd907('0x7'));var RpcVoiceRecording=require(_0xd907('0x8'));var RpcVoiceTransferReport=require(_0xd907('0x9'));var VoiceQueueReport=require(_0xd907('0xa'));var VoiceCallReport=require(_0xd907('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xd907('0xc'));var UserReport=require(_0xd907('0xd'));function Report(_0x3c56c0){this['realtime']=_0x3c56c0;this[_0xd907('0xe')]=_0x3c56c0[_0xd907('0xe')];this[_0xd907('0xf')]=_0x3c56c0[_0xd907('0xf')];}Report[_0xd907('0x10')][_0xd907('0x11')]=function(_0x500d81){var _0x4d2dfb=new VoiceQueueReport(this[_0xd907('0x12')]);var _0x5b9654=new VoiceAgentReport(this['realtime']);var _0x75a3fb=new VoiceDialReport(this['realtime']);var _0x544aa1=new VoiceCallReport(this[_0xd907('0x12')]);var _0x5edbc4=new UserReport(this[_0xd907('0x12')]);if(config[_0xd907('0x13')]&&config[_0xd907('0x13')][_0xd907('0x14')]){ami['on'](_0xd907('0x15'),this[_0xd907('0x16')][_0xd907('0x17')](this));ami['on'](_0xd907('0x18'),this[_0xd907('0x19')][_0xd907('0x17')](this));ami['on'](_0xd907('0x1a'),this[_0xd907('0x1b')][_0xd907('0x17')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0xd907('0x17')](this));ami['on'](_0xd907('0x1c'),this[_0xd907('0x1d')][_0xd907('0x17')](this));ami['on'](_0xd907('0x1e'),this['attendedTransfer']['bind'](this));}};Report[_0xd907('0x10')][_0xd907('0x1f')]=function(_0x443083){var _0x1b8f3d;_0x1b8f3d=_[_0xd907('0x20')](this[_0xd907('0xe')],function(_0x26b677){return _0x26b677[_0xd907('0x21')]==_0x443083||_0x26b677[_0xd907('0x22')]==_0x443083;});if(_[_0xd907('0x23')](_0x1b8f3d)){var _0x2b4c64=_[_0xd907('0x20')](this[_0xd907('0xf')],function(_0x14906a){return _0x14906a[_0xd907('0x21')]==_0x443083||_0x14906a[_0xd907('0x22')]==_0x443083;});if(_0x2b4c64){_0x1b8f3d=_['find'](this[_0xd907('0xe')],function(_0x578655){return _0x578655['interface']==util['format']('SIP/%s',_0x2b4c64[_0xd907('0x22')]);});}}return _0x1b8f3d;};Report[_0xd907('0x10')][_0xd907('0x16')]=function(_0x219311){for(var _0x466eab=0x0;_0x466eab<_0x219311[_0xd907('0x24')];_0x466eab+=0x1){var _0x561f6c=this[_0xd907('0x1f')](_0x219311[_0x466eab][_0xd907('0x25')]);if(_0x561f6c){_0x219311[_0x466eab][_0xd907('0x21')]=_0x561f6c['accountcode'];_0x219311[_0x466eab][_0xd907('0x26')]=!![];_0x219311[_0x466eab][_0xd907('0x27')]=_0x561f6c[_0xd907('0x22')];_0x219311[_0x466eab]['interface']=_['isNil'](_0x561f6c['interface'])?util[_0xd907('0x28')](_0xd907('0x29'),_0x561f6c['name']):_0x561f6c['interface'];if(_0x219311[_0x466eab][_0xd907('0x2a')]){_0x219311[_0x466eab][_0xd907('0x2b')]=moment()[_0xd907('0x28')](_0xd907('0x2c'));}if(_0x219311[_0x466eab]['queuecallerexit']){_0x219311[_0x466eab][_0xd907('0x2d')]=moment()['format'](_0xd907('0x2c'));}RpcMemberReport[_0xd907('0x16')](_0x219311[_0x466eab]);}RpcVoiceQueueReport[_0xd907('0x2e')](_0x219311[_0x466eab]);}};function extractCalleridNumber(_0x116961){var _0x2d5e62=_0x116961[_0xd907('0x2f')](/<(.*?)>/);return _0x2d5e62?_0x2d5e62[0x1]:_0x116961;}Report[_0xd907('0x10')][_0xd907('0x30')]=function(_0x1666ff){for(var _0x2a875c=0x0;_0x2a875c0x0?!![]:![];if(!_0x4b7fb5){return this[_0xae9d('0x1a')](this['summary']['completeEvent']);}};VoiceQueueReport[_0xae9d('0xc')][_0xae9d('0x1d')]=function(_0x11cdf1){var _0x8699dd=this['summary']['id'];if(this[_0xae9d('0x16')][_0xae9d('0x61')][_0x8699dd]&&this[_0xae9d('0x16')][_0xae9d('0x61')][_0x8699dd][_0x11cdf1[_0xae9d('0x62')]]){this['summary']['queuestatus'][_0x8699dd][_0x11cdf1[_0xae9d('0x62')]]['agents'][_0xae9d('0x6c')](_0x11cdf1);}};VoiceQueueReport['prototype'][_0xae9d('0x19')]=function(_0x1e0486){var _0x2c3878=this;try{if(this['isNotNull'](_0x1e0486)&&this['isNotNull'](_0x1e0486['queue'])){logger[_0xae9d('0x4b')](_0xae9d('0x6d'),util[_0xae9d('0x43')](_0x1e0486,{'showHidden':![],'depth':null}));var _0x21f532=this['voiceQueues'][_0x1e0486[_0xae9d('0x53')]];if(_0x21f532){logger[_0xae9d('0x6e')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x21f532[_0xae9d('0x58')]);this[_0xae9d('0x16')][_0xae9d('0x5c')][_0x21f532[_0xae9d('0x58')]]={'summaryEvent':_0x1e0486};this[_0xae9d('0x16')][_0xae9d('0x6b')]+=0x1;return ami[_0xae9d('0x3b')]({'action':_0xae9d('0x61'),'queue':_0x21f532[_0xae9d('0x58')]})[_0xae9d('0x5f')](function(_0x105f27){if(!_0x2c3878['summary'][_0xae9d('0x61')][_0x1e0486[_0xae9d('0x62')]]){_0x2c3878['summary'][_0xae9d('0x61')][_0x1e0486['actionid']]={};}_0x2c3878[_0xae9d('0x16')][_0xae9d('0x61')][_0x1e0486['actionid']][_0x105f27[_0xae9d('0x62')]]={'queue':_0x21f532['name'],'agents':[]};})[_0xae9d('0x3d')](function(_0x4148f4){throw _0x4148f4;});}}}catch(_0x1eb861){logger[_0xae9d('0x41')](_0xae9d('0x63'),util[_0xae9d('0x43')](_0x1eb861,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9d('0xc')][_0xae9d('0x1a')]=function(_0x2a4122){if(this[_0xae9d('0x16')][_0xae9d('0x6b')]>0x0){this[_0xae9d('0x16')][_0xae9d('0x6f')]=_0x2a4122;return;}logger[_0xae9d('0x4b')](_0xae9d('0x70'),util[_0xae9d('0x43')](_0x2a4122,{'showHidden':![],'depth':null}));this[_0xae9d('0x16')]=initializeSummary();ami[_0xae9d('0x49')](_0xae9d('0x71'),{});};VoiceQueueReport[_0xae9d('0xc')][_0xae9d('0x20')]=function(_0x27e815){try{if(this[_0xae9d('0x5a')](_0x27e815)){logger[_0xae9d('0x4b')]('[%s][voiceQueueReport][queuecallerjoin]',_0x27e815[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x27e815,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xae9d('0x11')][_0x27e815[_0xae9d('0x4e')]])){this[_0xae9d('0x11')][_0x27e815[_0xae9d('0x4e')]]=[];}if(_[_0xae9d('0x5b')](this[_0xae9d('0x39')][_0x27e815[_0xae9d('0x4e')]])){this[_0xae9d('0x39')][_0x27e815['uniqueid']]={};}var _0x4c5adf=new QueueReport();_0x4c5adf[_0xae9d('0x53')]=_0x27e815['queue'];_0x4c5adf['type']=this[_0xae9d('0x14')][_0x4c5adf[_0xae9d('0x53')]]&&this[_0xae9d('0x14')][_0x4c5adf['queue']][_0xae9d('0x56')]?this['voiceQueues'][_0x4c5adf[_0xae9d('0x53')]][_0xae9d('0x56')]||_0xae9d('0x57'):_0xae9d('0x57');_0x4c5adf[_0xae9d('0x72')]=moment()[_0xae9d('0x52')](_0xae9d('0x73'));_0x4c5adf['position']=_0x27e815[_0xae9d('0x74')];_0x4c5adf[_0xae9d('0x75')]=_0x27e815['count'];_0x4c5adf[_0xae9d('0x4e')]=_0x27e815[_0xae9d('0x4e')];_0x4c5adf[_0xae9d('0x76')]=this['channels'][_0x27e815[_0xae9d('0x4e')]][_0xae9d('0x76')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4c5adf['queue'],_0x4c5adf['type']);_[_0xae9d('0x77')](_0x4c5adf,_[_0xae9d('0x78')](_0x27e815,_['keys'](_0x4c5adf)));this[_0xae9d('0x11')][_0x27e815[_0xae9d('0x4e')]]['push'](_0x4c5adf);this[_0xae9d('0x39')][_0x27e815[_0xae9d('0x4e')]]=_0x4c5adf;this[_0xae9d('0x4a')](_0x4c5adf,_0xae9d('0x1f'));}}catch(_0x2d6223){logger[_0xae9d('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x27e815[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x2d6223,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9d('0xc')][_0xae9d('0x22')]=function(_0x2416ec){try{if(this['isNotNull'](_0x2416ec)){logger[_0xae9d('0x4b')](_0xae9d('0x79'),_0x2416ec[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x2416ec,{'showHidden':![],'depth':null}));if(this[_0xae9d('0x11')][_0x2416ec[_0xae9d('0x4e')]]){var _0x1c030b=_[_0xae9d('0x7a')](this[_0xae9d('0x11')][_0x2416ec[_0xae9d('0x4e')]]);_0x1c030b['queuecallercomplete']=![];_0x1c030b[_0xae9d('0x7b')]=null;_0x1c030b[_0xae9d('0x7c')]=_0x2416ec[_0xae9d('0x7c')];_0x1c030b['originalposition']=_0x2416ec[_0xae9d('0x7d')];_0x1c030b['queuecallerabandon']=!![];_0x1c030b[_0xae9d('0x7e')]=moment()['format'](_0xae9d('0x73'));_0x1c030b[_0xae9d('0x7f')]=_0xae9d('0x80');_0x1c030b[_0xae9d('0x81')]=null;logger[_0xae9d('0x6e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1c030b[_0xae9d('0x53')],_0x1c030b[_0xae9d('0x56')]);this[_0xae9d('0x39')][_0x2416ec[_0xae9d('0x4e')]]=_0x1c030b;this[_0xae9d('0x47')](_0x1c030b,_0xae9d('0x21'));}}}catch(_0x27ca16){logger[_0xae9d('0x41')](_0xae9d('0x79'),_0x2416ec[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x27ca16,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9d('0xc')]['syncQueueCallerLeave']=function(_0x2fc6ad){try{if(this[_0xae9d('0x5a')](_0x2fc6ad)){logger[_0xae9d('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0x2fc6ad['uniqueid'],util[_0xae9d('0x43')](_0x2fc6ad,{'showHidden':![],'depth':null}));if(this[_0xae9d('0x11')][_0x2fc6ad[_0xae9d('0x4e')]]){var _0x23533e=_[_0xae9d('0x7a')](this['queueReports'][_0x2fc6ad[_0xae9d('0x4e')]]);_0x23533e['queuecallerleaveAt']=moment()[_0xae9d('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x23533e[_0xae9d('0x82')]=_0x2fc6ad[_0xae9d('0x82')];_0x23533e[_0xae9d('0x83')]=_0x2fc6ad['connectedlinename'];logger[_0xae9d('0x6e')](_0xae9d('0x84'),_0x23533e[_0xae9d('0x53')],_0x23533e[_0xae9d('0x56')],_0x2fc6ad[_0xae9d('0x82')],_0x2fc6ad[_0xae9d('0x83')]);this[_0xae9d('0x39')][_0x2fc6ad['uniqueid']]=_0x23533e;this[_0xae9d('0x4a')](_0x23533e,'queuecallerleave');}}}catch(_0xabc876){logger[_0xae9d('0x41')](_0xae9d('0x85'),_0x2fc6ad[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0xabc876,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9d('0xc')][_0xae9d('0x25')]=function(_0x457a1e){try{if(this['isNotNull'](_0x457a1e)){logger[_0xae9d('0x4b')](_0xae9d('0x86'),_0x457a1e['uniqueid'],util['inspect'](_0x457a1e,{'showHidden':![],'depth':null}));if(this[_0xae9d('0x11')][_0x457a1e[_0xae9d('0x4e')]]){var _0x4487c3=_[_0xae9d('0x7a')](this[_0xae9d('0x11')][_0x457a1e['uniqueid']]);_0x4487c3[_0xae9d('0x87')]=!![];_0x4487c3['queuecallerexitreason']=_0xae9d('0x88');logger[_0xae9d('0x6e')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4487c3['queue'],_0x4487c3[_0xae9d('0x56')]);}}}catch(_0x4c1b9e){logger[_0xae9d('0x41')](_0xae9d('0x86'),_0x457a1e[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x4c1b9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9d('0xc')][_0xae9d('0x24')]=function(_0x1683ea){try{if(this[_0xae9d('0x5a')](_0x1683ea)){logger['debug'](_0xae9d('0x89'),_0x1683ea[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x1683ea,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1683ea[_0xae9d('0x4e')]]){var _0x4282cb=_['last'](this[_0xae9d('0x11')][_0x1683ea['uniqueid']]);_0x4282cb[_0xae9d('0x21')]=![];_0x4282cb['queuecallerabandonAt']=null;_0x4282cb[_0xae9d('0x8a')]=!![];_0x4282cb[_0xae9d('0x81')]=_0x1683ea[_0xae9d('0x8b')];_0x4282cb[_0xae9d('0x7c')]=_0x1683ea[_0xae9d('0x7c')];_0x4282cb[_0xae9d('0x87')]=!![];_0x4282cb[_0xae9d('0x8c')]=![];_0x4282cb['queuecallerexitAt']=null;if(!_0x4282cb[_0xae9d('0x8d')]){if(_0x1683ea[_0xae9d('0x8e')]==_0xae9d('0x8d')){_0x4282cb[_0xae9d('0x7f')]='COMPLETED';logger[_0xae9d('0x6e')](_0xae9d('0x8f'),_0x4282cb[_0xae9d('0x53')],_0x4282cb[_0xae9d('0x56')]);}else{if(_[_0xae9d('0x90')](_0x1683ea['channel'][_0xae9d('0x91')](),_0xae9d('0x92'))){if(this[_0xae9d('0x11')][_0x1683ea['linkedid']]){var _0x5152c8=_[_0xae9d('0x7a')](this[_0xae9d('0x11')][_0x1683ea[_0xae9d('0x93')]]);_0x5152c8[_0xae9d('0x87')]=![];_0x5152c8['queuecallerexit']=!![];_0x5152c8[_0xae9d('0x94')]=moment(_0x4282cb[_0xae9d('0x72')])[_0xae9d('0x95')](_0x1683ea[_0xae9d('0x7c')],'seconds')[_0xae9d('0x52')](_0xae9d('0x73'));_0x5152c8[_0xae9d('0x7f')]=_0xae9d('0x96');_0x5152c8[_0xae9d('0x8d')]=!![];_0x5152c8['transfertype']='FORWARD';_0x5152c8[_0xae9d('0x97')]=_0x1683ea[_0xae9d('0x98')];_0x5152c8[_0xae9d('0x99')]=_0x1683ea[_0xae9d('0x4e')];logger[_0xae9d('0x6e')](_0xae9d('0x9a'),_0x5152c8[_0xae9d('0x53')],_0x5152c8[_0xae9d('0x56')]);var _0x2ef651=this[_0xae9d('0x11')][_0x1683ea[_0xae9d('0x93')]];this[_0xae9d('0x11')][_0x1683ea[_0xae9d('0x93')]]=this[_0xae9d('0x11')][_0x1683ea['uniqueid']];this[_0xae9d('0x11')][_0x1683ea[_0xae9d('0x4e')]]=_0x2ef651;}}else{_0x4282cb[_0xae9d('0x7f')]=_0xae9d('0x9b')+_0x1683ea[_0xae9d('0x8e')][_0xae9d('0x9c')]();logger[_0xae9d('0x6e')](_0xae9d('0x9d'),_0x4282cb['queue'],_0x4282cb[_0xae9d('0x56')],_0x4282cb[_0xae9d('0x7f')]);}}}this['channels'][_0x1683ea[_0xae9d('0x4e')]]=_0x4282cb;this[_0xae9d('0x47')](_0x4282cb,_0xae9d('0x9e'));}}}catch(_0xfd82fc){logger[_0xae9d('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x1683ea[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0xfd82fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xae9d('0x27')]=function(_0x37fd36){try{if(this[_0xae9d('0x5a')](_0x37fd36)){logger[_0xae9d('0x4b')](_0xae9d('0x9f'),_0x37fd36[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x37fd36,{'showHidden':![],'depth':null}));this[_0xae9d('0xa0')](_0x37fd36['uniqueid'],_[_0xae9d('0xa1')](_0x37fd36['variable'])[0x0],_0x37fd36[_0xae9d('0xa2')]);if(this['queueReports'][_0x37fd36[_0xae9d('0x4e')]]){var _0x2ca781=_[_0xae9d('0x7a')](this['queueReports'][_0x37fd36[_0xae9d('0x4e')]]);if(_0x2ca781){if(this[_0xae9d('0x5a')](_0x37fd36[_0xae9d('0xa3')])&&this[_0xae9d('0x5a')](_0x37fd36[_0xae9d('0xa3')][_0xae9d('0x61')])){switch(_0x37fd36[_0xae9d('0xa2')]){case _0xae9d('0xa4'):_0x2ca781[_0xae9d('0x8c')]=![];_0x2ca781['queuecallerexitAt']=null;break;case _0xae9d('0xa5'):_0x2ca781[_0xae9d('0xa6')]=_0xae9d('0xa7');_0x2ca781['queuecallerexit']=!![];_0x2ca781[_0xae9d('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ca781['queuecallerleaveAt']=moment()['format'](_0xae9d('0x73'));logger[_0xae9d('0x4b')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x37fd36['uniqueid'],util['inspect'](_0x2ca781,{'showHidden':![],'depth':null}));ami[_0xae9d('0x49')](_0xae9d('0xa8'),_0x2ca781);break;default:_0x2ca781[_0xae9d('0x8c')]=!![];_0x2ca781[_0xae9d('0x94')]=moment()[_0xae9d('0x52')](_0xae9d('0x73'));_0x2ca781['queuecallerleaveAt']=moment()[_0xae9d('0x52')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ca781[_0xae9d('0x21')]=![];_0x2ca781[_0xae9d('0x7e')]=null;_0x2ca781[_0xae9d('0x7f')]=_0x37fd36['value'];this[_0xae9d('0x39')][_0x37fd36['uniqueid']]=_0x2ca781;this[_0xae9d('0x47')](_0x2ca781,_0xae9d('0x26'));}else if(this['isNotNull'](_0x37fd36[_0xae9d('0xa3')])&&this[_0xae9d('0x5a')](_0x37fd36['variable'][_0xae9d('0xa9')])){if(!_0x2ca781[_0xae9d('0x21')]){_0x2ca781[_0xae9d('0x8c')]=!![];_0x2ca781[_0xae9d('0x94')]=moment()[_0xae9d('0x52')](_0xae9d('0x73'));_0x2ca781['queuecallerexitreason']=_0xae9d('0xaa');_0x2ca781['queuecallerleaveAt']=moment()[_0xae9d('0x52')](_0xae9d('0x73'));this[_0xae9d('0x39')][_0x37fd36[_0xae9d('0x4e')]]=_0x2ca781;}}logger['info'](_0xae9d('0xab'),_0x37fd36['uniqueid'],_0x2ca781['queue'],_0x2ca781['type'],_['keys'](_0x37fd36[_0xae9d('0xa3')])[0x0],_0x37fd36[_0xae9d('0xa2')]);_0x2ca781[_0xae9d('0x17')]=this[_0xae9d('0x17')][_0x37fd36[_0xae9d('0x4e')]];}}}}catch(_0x1cc435){logger['error'](_0xae9d('0x9f'),_0x37fd36[_0xae9d('0x4e')],util[_0xae9d('0x43')](_0x1cc435,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9d('0xc')]['addVariable']=function(_0x2995a5,_0x5b3a82,_0x2c5ae0){var _0x5aa49f=['rtpaudioqos',_0xae9d('0xac'),_0xae9d('0xad'),_0xae9d('0xae'),_0xae9d('0xaf'),_0xae9d('0xb0'),_0xae9d('0xb1'),'rtpaudioqosrttbridged',_0xae9d('0xb2'),_0xae9d('0xb3'),_0xae9d('0xb4'),_0xae9d('0xb5'),_0xae9d('0xb6'),_0xae9d('0xb7'),'memberinterface',_0xae9d('0xb8'),_0xae9d('0x8b'),_0xae9d('0xb9'),_0xae9d('0xba')];if(!_[_0xae9d('0xbb')](_0x5b3a82)&&!_[_0xae9d('0xbc')](_0x5aa49f,_0x5b3a82)){if(_[_0xae9d('0x5b')](this['variables'][_0x2995a5])){this[_0xae9d('0x17')][_0x2995a5]={};}this['variables'][_0x2995a5][_0x5b3a82]=_0x2c5ae0;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x429a51,_0x36582a,_0x508c92){var _0xbbb0b9={};for(var _0x332fcc=0x0;_0x332fcc0x0?!![]:![];if(!_0x77b170){return this[_0xcdac('0x68')](this[_0xcdac('0x11')][_0xcdac('0x69')]);}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0x16')]=function(_0x4c2f09){var _0x5c52f8=this[_0xcdac('0x11')]['id'];if(this['summary'][_0xcdac('0x59')][_0x5c52f8]&&this['summary'][_0xcdac('0x59')][_0x5c52f8][_0x4c2f09['actionid']]){this[_0xcdac('0x11')][_0xcdac('0x59')][_0x5c52f8][_0x4c2f09['actionid']][_0xcdac('0xc')][_0xcdac('0x6a')](_0x4c2f09);}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0x14')]=function(_0x5e6fb0){var _0x27c0cb=this;try{if(this['isNotNull'](_0x5e6fb0)&&this[_0xcdac('0x53')](_0x5e6fb0[_0xcdac('0x48')])){logger[_0xcdac('0x43')](_0xcdac('0x6b'),util[_0xcdac('0x3b')](_0x5e6fb0,{'showHidden':![],'depth':null}));var _0x3217c4=this[_0xcdac('0xf')][_0x5e6fb0['queue']];if(_0x3217c4){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x3217c4[_0xcdac('0x63')]);this[_0xcdac('0x11')][_0xcdac('0x55')][_0x3217c4[_0xcdac('0x63')]]={'summaryEvent':_0x5e6fb0};this[_0xcdac('0x11')][_0xcdac('0x67')]+=0x1;return ami[_0xcdac('0x54')]({'action':'queuestatus','queue':_0x3217c4[_0xcdac('0x63')]})['then'](function(_0x49c637){if(!_0x27c0cb[_0xcdac('0x11')][_0xcdac('0x59')][_0x5e6fb0['actionid']]){_0x27c0cb['summary'][_0xcdac('0x59')][_0x5e6fb0[_0xcdac('0x5a')]]={};}_0x27c0cb[_0xcdac('0x11')]['queuestatus'][_0x5e6fb0[_0xcdac('0x5a')]][_0x49c637[_0xcdac('0x5a')]]={'queue':_0x3217c4[_0xcdac('0x63')],'agents':[]};})[_0xcdac('0x56')](function(_0x521328){throw _0x521328;});}}}catch(_0x5dfefd){logger[_0xcdac('0x39')](_0xcdac('0x5b'),util[_0xcdac('0x3b')](_0x5dfefd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0x68')]=function(_0x55a842){if(this[_0xcdac('0x11')][_0xcdac('0x67')]>0x0){this[_0xcdac('0x11')][_0xcdac('0x69')]=_0x55a842;return;}logger[_0xcdac('0x43')](_0xcdac('0x6c'),util[_0xcdac('0x3b')](_0x55a842,{'showHidden':![],'depth':null}));this[_0xcdac('0x11')]=initializeSummary();ami['emit'](_0xcdac('0x6d'),{});};VoiceQueueReport['prototype'][_0xcdac('0x19')]=function(_0x541332){try{if(this[_0xcdac('0x53')](_0x541332)){logger[_0xcdac('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x541332[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x541332,{'showHidden':![],'depth':null}));if(_[_0xcdac('0x6e')](this[_0xcdac('0xb')][_0x541332[_0xcdac('0x45')]])){this[_0xcdac('0xb')][_0x541332[_0xcdac('0x45')]]=[];}if(_[_0xcdac('0x6e')](this[_0xcdac('0xd')][_0x541332['uniqueid']])){this[_0xcdac('0xd')][_0x541332[_0xcdac('0x45')]]={};}var _0x333cab=new QueueReport();_0x333cab[_0xcdac('0x48')]=_0x541332[_0xcdac('0x48')];_0x333cab[_0xcdac('0x50')]=this[_0xcdac('0xf')][_0x333cab['queue']]&&this[_0xcdac('0xf')][_0x333cab[_0xcdac('0x48')]][_0xcdac('0x50')]?this[_0xcdac('0xf')][_0x333cab[_0xcdac('0x48')]][_0xcdac('0x50')]||'inbound':_0xcdac('0x51');_0x333cab['queuecallerjoinAt']=moment()[_0xcdac('0x46')](_0xcdac('0x6f'));_0x333cab['position']=_0x541332['position'];_0x333cab[_0xcdac('0x70')]=_0x541332[_0xcdac('0x70')];_0x333cab[_0xcdac('0x45')]=_0x541332[_0xcdac('0x45')];_0x333cab[_0xcdac('0x71')]=this['channels'][_0x541332[_0xcdac('0x45')]][_0xcdac('0x71')];logger[_0xcdac('0x72')](_0xcdac('0x73'),_0x333cab[_0xcdac('0x48')],_0x333cab[_0xcdac('0x50')]);_[_0xcdac('0x74')](_0x333cab,_[_0xcdac('0x75')](_0x541332,_['keys'](_0x333cab)));this['queueReports'][_0x541332[_0xcdac('0x45')]][_0xcdac('0x6a')](_0x333cab);this['channels'][_0x541332[_0xcdac('0x45')]]=_0x333cab;this[_0xcdac('0x76')](_0x333cab,_0xcdac('0x18'));}}catch(_0x627328){logger[_0xcdac('0x39')](_0xcdac('0x77'),_0x541332['uniqueid'],util[_0xcdac('0x3b')](_0x627328,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x3cb84a){try{if(this[_0xcdac('0x53')](_0x3cb84a)){logger[_0xcdac('0x43')](_0xcdac('0x78'),_0x3cb84a[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x3cb84a,{'showHidden':![],'depth':null}));if(this[_0xcdac('0xb')][_0x3cb84a[_0xcdac('0x45')]]){var _0x3dd1c7=_[_0xcdac('0x79')](this[_0xcdac('0xb')][_0x3cb84a[_0xcdac('0x45')]]);_0x3dd1c7[_0xcdac('0x7a')]=![];_0x3dd1c7['queuecallercompleteAt']=null;_0x3dd1c7[_0xcdac('0x7b')]=_0x3cb84a['holdtime'];_0x3dd1c7[_0xcdac('0x7c')]=_0x3cb84a['originalposition'];_0x3dd1c7[_0xcdac('0x1a')]=!![];_0x3dd1c7[_0xcdac('0x7d')]=moment()[_0xcdac('0x46')](_0xcdac('0x6f'));_0x3dd1c7[_0xcdac('0x7e')]=_0xcdac('0x7f');_0x3dd1c7[_0xcdac('0x80')]=null;logger['info'](_0xcdac('0x81'),_0x3dd1c7['queue'],_0x3dd1c7[_0xcdac('0x50')]);this['channels'][_0x3cb84a[_0xcdac('0x45')]]=_0x3dd1c7;this[_0xcdac('0x40')](_0x3dd1c7,'queuecallerabandon');}}}catch(_0x2c22fb){logger['error'](_0xcdac('0x78'),_0x3cb84a['uniqueid'],util[_0xcdac('0x3b')](_0x2c22fb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0x1d')]=function(_0x1e5165){try{if(this[_0xcdac('0x53')](_0x1e5165)){logger[_0xcdac('0x43')](_0xcdac('0x82'),_0x1e5165[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x1e5165,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1e5165['uniqueid']]){var _0x24c5ca=_[_0xcdac('0x79')](this[_0xcdac('0xb')][_0x1e5165['uniqueid']]);_0x24c5ca[_0xcdac('0x83')]=moment()[_0xcdac('0x46')](_0xcdac('0x6f'));_0x24c5ca[_0xcdac('0x84')]=_0x1e5165['connectedlinenum'];_0x24c5ca[_0xcdac('0x85')]=_0x1e5165['connectedlinename'];logger[_0xcdac('0x72')](_0xcdac('0x86'),_0x24c5ca[_0xcdac('0x48')],_0x24c5ca[_0xcdac('0x50')],_0x1e5165[_0xcdac('0x84')],_0x1e5165[_0xcdac('0x85')]);this[_0xcdac('0xd')][_0x1e5165[_0xcdac('0x45')]]=_0x24c5ca;this['emitVoiceQueueChannelSave'](_0x24c5ca,_0xcdac('0x1c'));}}}catch(_0xd74e88){logger['error'](_0xcdac('0x82'),_0x1e5165[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0xd74e88,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdac('0x9')]['syncAgentConnect']=function(_0x138eb3){try{if(this[_0xcdac('0x53')](_0x138eb3)){logger[_0xcdac('0x43')](_0xcdac('0x87'),_0x138eb3[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x138eb3,{'showHidden':![],'depth':null}));if(this[_0xcdac('0xb')][_0x138eb3[_0xcdac('0x45')]]){var _0x385863=_[_0xcdac('0x79')](this[_0xcdac('0xb')][_0x138eb3[_0xcdac('0x45')]]);_0x385863[_0xcdac('0x7a')]=!![];_0x385863[_0xcdac('0x7e')]='COMPLETEDBYAGENT';logger[_0xcdac('0x72')](_0xcdac('0x88'),_0x385863['queue'],_0x385863[_0xcdac('0x50')]);}}}catch(_0x5d82b5){logger[_0xcdac('0x39')](_0xcdac('0x87'),_0x138eb3[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x5d82b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0x1f')]=function(_0x23534a){try{if(this[_0xcdac('0x53')](_0x23534a)){logger['debug'](_0xcdac('0x89'),_0x23534a[_0xcdac('0x45')],util['inspect'](_0x23534a,{'showHidden':![],'depth':null}));if(this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x45')]]){var _0x97ba68=_[_0xcdac('0x79')](this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x45')]]);_0x97ba68[_0xcdac('0x1a')]=![];_0x97ba68[_0xcdac('0x7d')]=null;_0x97ba68[_0xcdac('0x8a')]=!![];_0x97ba68[_0xcdac('0x80')]=_0x23534a['membername'];_0x97ba68[_0xcdac('0x7b')]=_0x23534a[_0xcdac('0x7b')];_0x97ba68[_0xcdac('0x7a')]=!![];_0x97ba68[_0xcdac('0x8b')]=![];_0x97ba68[_0xcdac('0x8c')]=null;if(!_0x97ba68['transfer']){if(_0x23534a[_0xcdac('0x8d')]=='transfer'){_0x97ba68['queuecallerexitreason']='COMPLETED';logger[_0xcdac('0x72')](_0xcdac('0x8e'),_0x97ba68[_0xcdac('0x48')],_0x97ba68['type']);}else{if(_['startsWith'](_0x23534a['channel'][_0xcdac('0x8f')](),_0xcdac('0x90'))){if(this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x91')]]){var _0xa03ac7=_[_0xcdac('0x79')](this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x91')]]);_0xa03ac7[_0xcdac('0x7a')]=![];_0xa03ac7[_0xcdac('0x8b')]=!![];_0xa03ac7['queuecallerexitAt']=moment(_0x97ba68['queuecallerjoinAt'])['add'](_0x23534a[_0xcdac('0x7b')],_0xcdac('0x92'))[_0xcdac('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xa03ac7[_0xcdac('0x7e')]=_0xcdac('0x93');_0xa03ac7['transfer']=!![];_0xa03ac7[_0xcdac('0x94')]=_0xcdac('0x95');_0xa03ac7[_0xcdac('0x96')]=_0x23534a[_0xcdac('0x97')];_0xa03ac7[_0xcdac('0x98')]=_0x23534a[_0xcdac('0x45')];logger[_0xcdac('0x72')](_0xcdac('0x99'),_0xa03ac7['queue'],_0xa03ac7[_0xcdac('0x50')]);var _0x2ea6e5=this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x91')]];this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x91')]]=this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x45')]];this[_0xcdac('0xb')][_0x23534a[_0xcdac('0x45')]]=_0x2ea6e5;}}else{_0x97ba68[_0xcdac('0x7e')]=_0xcdac('0x9a')+_0x23534a[_0xcdac('0x8d')][_0xcdac('0x9b')]();logger[_0xcdac('0x72')](_0xcdac('0x9c'),_0x97ba68['queue'],_0x97ba68['type'],_0x97ba68['queuecallerexitreason']);}}}this[_0xcdac('0xd')][_0x23534a['uniqueid']]=_0x97ba68;this['emitVoiceQueueChannelRemove'](_0x97ba68,_0xcdac('0x1e'));}}}catch(_0x2e3b11){logger[_0xcdac('0x39')](_0xcdac('0x89'),_0x23534a[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x2e3b11,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0x23')]=function(_0x2a9922){try{if(this[_0xcdac('0x53')](_0x2a9922)){logger[_0xcdac('0x43')](_0xcdac('0x9d'),_0x2a9922[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x2a9922,{'showHidden':![],'depth':null}));this['addVariable'](_0x2a9922['uniqueid'],_[_0xcdac('0x9e')](_0x2a9922['variable'])[0x0],_0x2a9922[_0xcdac('0x9f')]);if(this['queueReports'][_0x2a9922[_0xcdac('0x45')]]){var _0x3e1556=_[_0xcdac('0x79')](this['queueReports'][_0x2a9922[_0xcdac('0x45')]]);if(_0x3e1556){if(this[_0xcdac('0x53')](_0x2a9922['variable'])&&this[_0xcdac('0x53')](_0x2a9922[_0xcdac('0xa0')][_0xcdac('0x59')])){switch(_0x2a9922['value']){case _0xcdac('0xa1'):_0x3e1556[_0xcdac('0x8b')]=![];_0x3e1556[_0xcdac('0x8c')]=null;break;case'TIMEOUT':_0x3e1556[_0xcdac('0xa2')]=_0xcdac('0xa3');_0x3e1556[_0xcdac('0x8b')]=!![];_0x3e1556[_0xcdac('0x8c')]=moment()[_0xcdac('0x46')](_0xcdac('0x6f'));_0x3e1556[_0xcdac('0x83')]=moment()[_0xcdac('0x46')](_0xcdac('0x6f'));logger['debug'](_0xcdac('0xa4'),_0x2a9922[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x3e1556,{'showHidden':![],'depth':null}));ami[_0xcdac('0x42')](_0xcdac('0xa5'),_0x3e1556);break;default:_0x3e1556[_0xcdac('0x8b')]=!![];_0x3e1556['queuecallerexitAt']=moment()[_0xcdac('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e1556[_0xcdac('0x83')]=moment()[_0xcdac('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3e1556[_0xcdac('0x1a')]=![];_0x3e1556[_0xcdac('0x7d')]=null;_0x3e1556['queuecallerexitreason']=_0x2a9922[_0xcdac('0x9f')];this[_0xcdac('0xd')][_0x2a9922[_0xcdac('0x45')]]=_0x3e1556;this[_0xcdac('0x40')](_0x3e1556,'varset');}else if(this[_0xcdac('0x53')](_0x2a9922[_0xcdac('0xa0')])&&this[_0xcdac('0x53')](_0x2a9922[_0xcdac('0xa0')]['queueposition'])){if(!_0x3e1556[_0xcdac('0x1a')]){_0x3e1556[_0xcdac('0x8b')]=!![];_0x3e1556[_0xcdac('0x8c')]=moment()[_0xcdac('0x46')](_0xcdac('0x6f'));_0x3e1556[_0xcdac('0x7e')]='EXITWITHKEY';_0x3e1556[_0xcdac('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xcdac('0xd')][_0x2a9922[_0xcdac('0x45')]]=_0x3e1556;}}logger[_0xcdac('0x72')](_0xcdac('0xa6'),_0x2a9922[_0xcdac('0x45')],_0x3e1556['queue'],_0x3e1556['type'],_[_0xcdac('0x9e')](_0x2a9922['variable'])[0x0],_0x2a9922['value']);_0x3e1556[_0xcdac('0x12')]=this['variables'][_0x2a9922[_0xcdac('0x45')]];}}}}catch(_0x3bf4d7){logger[_0xcdac('0x39')]('[%s][voiceQueueReport][varset]',_0x2a9922[_0xcdac('0x45')],util[_0xcdac('0x3b')](_0x3bf4d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0xa7')]=function(_0x3a3a82,_0x234770,_0x5f531c){var _0x3c23bd=[_0xcdac('0xa8'),_0xcdac('0xa9'),_0xcdac('0xaa'),_0xcdac('0xab'),_0xcdac('0xac'),_0xcdac('0xad'),_0xcdac('0xae'),_0xcdac('0xaf'),_0xcdac('0xb0'),_0xcdac('0xb1'),'bridgepeer',_0xcdac('0xb2'),_0xcdac('0xb3'),_0xcdac('0xb4'),_0xcdac('0xb5'),_0xcdac('0xb6'),_0xcdac('0xb7'),_0xcdac('0xb8'),_0xcdac('0xb9')];if(!_['isNil'](_0x234770)&&!_['includes'](_0x3c23bd,_0x234770)){if(_[_0xcdac('0x6e')](this[_0xcdac('0x12')][_0x3a3a82])){this[_0xcdac('0x12')][_0x3a3a82]={};}this['variables'][_0x3a3a82][_0x234770]=_0x5f531c;}};VoiceQueueReport[_0xcdac('0x9')][_0xcdac('0xba')]=function(_0x451373,_0x480e3d,_0x4c1a99){var _0x3428f1={};for(var _0x29ca89=0x0;_0x29ca89=0x0?moment(_0x526b4b['endtime'])[_0x8771('0xc')](_0x526b4b[_0x8771('0x18')],_0x8771('0xd')):null,'data1':_0x8771('0x1a'),'data2':_0x526b4b[_0x8771('0x13')],'data3':_0x526b4b[_0x8771('0x10')],'data4':_0x526b4b[_0x8771('0x1b')]||null,'role':_0x8771('0x12'),'internal':_0x526b4b['accountcode']?_[_0x8771('0x14')](_0x526b4b['accountcode']):undefined,'uniqueid':_0x526b4b[_0x8771('0x15')]},'log':_0x8771('0x6')});}; \ No newline at end of file +var _0x4e29=['CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','diff','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','seconds','dialstring','moment','lodash','../client','queuecallercompleteAt','Request'];(function(_0x3f6cc3,_0x21c641){var _0x25a876=function(_0x15ddfe){while(--_0x15ddfe){_0x3f6cc3['push'](_0x3f6cc3['shift']());}};_0x25a876(++_0x21c641);}(_0x4e29,0xcb));var _0x94e2=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x4e29[_0x32729c];return _0x482cfd;};'use strict';var moment=require(_0x94e2('0x0'));var _=require(_0x94e2('0x1'));var util=require('util');var client=require(_0x94e2('0x2'));exports['voiceQueueReport']=function(_0x5845e6){var _0x3abd7e=_0x5845e6[_0x94e2('0x3')]||_0x5845e6['queuecallerexitAt'];return client[_0x94e2('0x4')](_0x94e2('0x5'),{'body':{'channel':_0x94e2('0x6'),'membername':_0x5845e6[_0x94e2('0x7')],'interface':_[_0x94e2('0x8')](_0x5845e6[_0x94e2('0x9')])?util[_0x94e2('0xa')](_0x94e2('0xb'),_0x5845e6[_0x94e2('0x7')]):_0x5845e6[_0x94e2('0x9')],'type':'TALKING','enterAt':_0x5845e6[_0x94e2('0xc')],'exitAt':_0x3abd7e,'duration':moment(_0x3abd7e)[_0x94e2('0xd')](_0x5845e6[_0x94e2('0xc')],'seconds'),'data1':'inbound','data2':_0x5845e6[_0x94e2('0xe')],'data3':_0x5845e6[_0x94e2('0xf')],'data4':null,'data5':_0x5845e6[_0x94e2('0x10')],'role':_0x94e2('0x11'),'internal':_0x5845e6[_0x94e2('0x12')]?_[_0x94e2('0x13')](_0x5845e6['accountcode']):undefined,'uniqueid':_0x5845e6[_0x94e2('0x14')]},'log':'CreateMemberReport'});};exports[_0x94e2('0x15')]=function(_0x162b76){return client[_0x94e2('0x4')](_0x94e2('0x5'),{'body':{'channel':_0x94e2('0x6'),'membername':_0x162b76['membername'],'interface':_0x162b76[_0x94e2('0x9')],'type':'TALKING','enterAt':_0x162b76[_0x94e2('0x16')],'exitAt':_0x162b76[_0x94e2('0x17')],'duration':moment(_0x162b76[_0x94e2('0x17')])[_0x94e2('0xd')](_0x162b76[_0x94e2('0x16')],_0x94e2('0x18'))>=0x0?moment(_0x162b76[_0x94e2('0x17')])[_0x94e2('0xd')](_0x162b76['starttime'],_0x94e2('0x18')):null,'data1':'outbound','data2':_0x162b76[_0x94e2('0x12')],'data3':_0x162b76['exten'],'data4':_0x162b76[_0x94e2('0x19')]||null,'role':'agent','internal':_0x162b76['accountcode']?_['toNumber'](_0x162b76[_0x94e2('0x12')]):undefined,'uniqueid':_0x162b76[_0x94e2('0x14')]},'log':_0x94e2('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 64a14ca..1d2eb5b 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37e9=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x322c32,_0x438c72){var _0x32cbe6=function(_0x5e6cc6){while(--_0x5e6cc6){_0x322c32['push'](_0x322c32['shift']());}};_0x32cbe6(++_0x438c72);}(_0x37e9,0x1e7));var _0x937e=function(_0x291454,_0x4d4958){_0x291454=_0x291454-0x0;var _0x511588=_0x37e9[_0x291454];return _0x511588;};'use strict';var client=require(_0x937e('0x0'));exports[_0x937e('0x1')]=function(){return client[_0x937e('0x2')](_0x937e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x937e('0x4'),_0x937e('0x5')]},'log':_0x937e('0x6')});}; \ No newline at end of file +var _0xfdf7=['ShowSetting','GetSettings'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xfdf7,0xfa));var _0x7fdf=function(_0x37897a,_0x1a355a){_0x37897a=_0x37897a-0x0;var _0x2701fb=_0xfdf7[_0x37897a];return _0x2701fb;};'use strict';var client=require('../client');exports['getSettings']=function(){return client['Request'](_0x7fdf('0x0'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x7fdf('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 88179e2..31d3545 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dc0=['GetTemplate','name','Request'];(function(_0x36621a,_0x5642a3){var _0x247a1f=function(_0x5d92a8){while(--_0x5d92a8){_0x36621a['push'](_0x36621a['shift']());}};_0x247a1f(++_0x5642a3);}(_0x4dc0,0x13d));var _0x04dc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4dc0[_0x5b644e];return _0x49c6bf;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x2cf313){return function(_0x3fe02c){return client[_0x04dc('0x0')](_0x04dc('0x1'),{'options':{'raw':!![],'attributes':['id',_0x04dc('0x2'),'html']},'log':_0x04dc('0x1')});};}; \ No newline at end of file +var _0x5087=['GetTemplate','name','getTemplates','Request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5087,0x1da));var _0x7508=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x5087[_0x2aee2f];return _0x19337f;};'use strict';var client=require('../client');exports[_0x7508('0x0')]=function(_0x55279f){return function(_0x18dcda){return client[_0x7508('0x1')](_0x7508('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7508('0x3'),'html']},'log':_0x7508('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c14018a..341bbe8 100644 --- a/server/services/ami/rpc/trigger.js +++ b/server/services/ami/rpc/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58b8=['data6','data7','../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data2','data3','data4'];(function(_0x3fc25b,_0x4cc871){var _0x34e5ca=function(_0x124db8){while(--_0x124db8){_0x3fc25b['push'](_0x3fc25b['shift']());}};_0x34e5ca(++_0x4cc871);}(_0x58b8,0x192));var _0x858b=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x58b8[_0x34c553];return _0x1357d2;};'use strict';var client=require(_0x858b('0x0'));exports[_0x858b('0x1')]=function(_0x5a4832){return function(_0x54969e){return client[_0x858b('0x2')](_0x858b('0x3'),{'options':{'raw':![],'attributes':['id',_0x858b('0x4'),'channel','status'],'include':[{'model':_0x858b('0x5'),'as':_0x858b('0x6'),'attributes':['id','field',_0x858b('0x7'),_0x858b('0x8')]},{'model':_0x858b('0x5'),'as':_0x858b('0x9'),'attributes':['id',_0x858b('0xa'),_0x858b('0x7'),_0x858b('0x8')]},{'model':_0x858b('0xb'),'as':_0x858b('0xc'),'attributes':['id',_0x858b('0xd'),_0x858b('0xe'),_0x858b('0xf'),_0x858b('0x10'),_0x858b('0x11'),'data5',_0x858b('0x12'),_0x858b('0x13')]}]},'log':_0x858b('0x3')});};}; \ No newline at end of file +var _0xbacb=['operator','value','AnyConditions','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','Request','GetTrigger','channel','status','Condition','AllConditions','field'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0xbacb,0xac));var _0xbbac=function(_0xfeea33,_0xe23099){_0xfeea33=_0xfeea33-0x0;var _0x14ec7f=_0xbacb[_0xfeea33];return _0x14ec7f;};'use strict';var client=require(_0xbbac('0x0'));exports['getTriggers']=function(_0x39ad92){return function(_0x5cd45a){return client[_0xbbac('0x1')](_0xbbac('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbbac('0x3'),_0xbbac('0x4')],'include':[{'model':_0xbbac('0x5'),'as':_0xbbac('0x6'),'attributes':['id',_0xbbac('0x7'),_0xbbac('0x8'),_0xbbac('0x9')]},{'model':'Condition','as':_0xbbac('0xa'),'attributes':['id','field',_0xbbac('0x8'),_0xbbac('0x9')]},{'model':'Action','as':_0xbbac('0xb'),'attributes':['id',_0xbbac('0xc'),_0xbbac('0xd'),_0xbbac('0xe'),_0xbbac('0xf'),_0xbbac('0x10'),_0xbbac('0x11'),_0xbbac('0x12'),_0xbbac('0x13')]}]},'log':_0xbbac('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 96fb72c..109849d 100644 --- a/server/services/ami/rpc/trunk.js +++ b/server/services/ami/rpc/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa482=['defaultuser','../client','getTrunks','Request','GetTrunk','registry'];(function(_0x5b1eea,_0xcec9cf){var _0x4f95aa=function(_0x473c5d){while(--_0x473c5d){_0x5b1eea['push'](_0x5b1eea['shift']());}};_0x4f95aa(++_0xcec9cf);}(_0xa482,0x181));var _0x2a48=function(_0x276d57,_0xa74649){_0x276d57=_0x276d57-0x0;var _0x590cb1=_0xa482[_0x276d57];return _0x590cb1;};'use strict';var client=require(_0x2a48('0x0'));exports[_0x2a48('0x1')]=function(_0x2e1bbe){return function(_0x161ad4){return client[_0x2a48('0x2')](_0x2a48('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x2a48('0x4'),_0x2a48('0x5')]},'log':_0x2a48('0x3')});};}; \ No newline at end of file +var _0xee39=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee39,0x1e6));var _0x9ee3=function(_0x161547,_0x46d849){_0x161547=_0x161547-0x0;var _0x5036d9=_0xee39[_0x161547];return _0x5036d9;};'use strict';var client=require(_0x9ee3('0x0'));exports[_0x9ee3('0x1')]=function(_0xe604cf){return function(_0x58cf62){return client[_0x9ee3('0x2')](_0x9ee3('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9ee3('0x4'),_0x9ee3('0x5'),_0x9ee3('0x6')]},'log':_0x9ee3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2047328..86b6d97 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x5e03ff,_0x5325bb){var _0x29e059=function(_0x45cc21){while(--_0x45cc21){_0x5e03ff['push'](_0x5e03ff['shift']());}};_0x29e059(++_0x5325bb);}(_0x70e0,0x17b));var _0x070e=function(_0x54035d,_0x309111){_0x54035d=_0x54035d-0x0;var _0x36cbc7=_0x70e0[_0x54035d];return _0x36cbc7;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x265090,_0x55991c){var _0x4e0a95=function(_0x30d503){while(--_0x30d503){_0x265090['push'](_0x265090['shift']());}};_0x4e0a95(++_0x55991c);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index afa122a..a02c518 100644 --- a/server/services/ami/rpc/voiceAgentReport.js +++ b/server/services/ami/rpc/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe416=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport','update'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe416,0x119));var _0x6e41=function(_0x3434eb,_0x472c67){_0x3434eb=_0x3434eb-0x0;var _0x3fdb23=_0xe416[_0x3434eb];return _0x3fdb23;};'use strict';var client=require('../client');exports[_0x6e41('0x0')]=function(_0x5a012e){return client[_0x6e41('0x1')](_0x6e41('0x2'),{'body':_0x5a012e,'log':_0x6e41('0x2')});};exports[_0x6e41('0x3')]=function(_0x42858f,_0x5533a1,_0x13a3ed){return client[_0x6e41('0x1')](_0x6e41('0x4'),{'body':_0x42858f,'options':{'where':{'uniqueid':_0x5533a1,'interface':_0x13a3ed,'agentcomplete':!![]}},'log':_0x6e41('0x4')});}; \ No newline at end of file +var _0xd41c=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0xe9fd53,_0x50ab99){var _0x295a14=function(_0x9c665e){while(--_0x9c665e){_0xe9fd53['push'](_0xe9fd53['shift']());}};_0x295a14(++_0x50ab99);}(_0xd41c,0x13d));var _0xcd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xcd41('0x0'));exports[_0xcd41('0x1')]=function(_0x2da3c9){return client[_0xcd41('0x2')](_0xcd41('0x3'),{'body':_0x2da3c9,'log':'CreateVoiceAgentReport'});};exports[_0xcd41('0x4')]=function(_0x24eabe,_0x342a6f,_0x57f083){return client[_0xcd41('0x2')](_0xcd41('0x5'),{'body':_0x24eabe,'options':{'where':{'uniqueid':_0x342a6f,'interface':_0x57f083,'agentcomplete':!![]}},'log':_0xcd41('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b35c1e3..f87fbd2 100644 --- a/server/services/ami/rpc/voiceCallReport.js +++ b/server/services/ami/rpc/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b9c=['endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5ea6fc,_0x26ae9e){var _0x14d2ad=function(_0x5bcf1c){while(--_0x5bcf1c){_0x5ea6fc['push'](_0x5ea6fc['shift']());}};_0x14d2ad(++_0x26ae9e);}(_0x4b9c,0xa6));var _0xc4b9=function(_0x3e55a9,_0x265ff1){_0x3e55a9=_0x3e55a9-0x0;var _0x601273=_0x4b9c[_0x3e55a9];return _0x601273;};'use strict';var moment=require(_0xc4b9('0x0'));var util=require(_0xc4b9('0x1'));var _=require(_0xc4b9('0x2'));var client=require(_0xc4b9('0x3'));exports[_0xc4b9('0x4')]=function(_0x57046b){return client['Request'](_0xc4b9('0x5'),{'body':_[_0xc4b9('0x6')](_0x57046b,{'source':_0x57046b[_0xc4b9('0x7')],'destinationcontext':_0x57046b[_0xc4b9('0x8')],'callerid':_0x57046b[_0xc4b9('0x9')],'amaflags':_0xc4b9('0xa')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0xc4b9('0xb')](_0xc4b9('0xc'),{'options':{'where':{'type':[_0xc4b9('0xd')],'createdAt':{'$between':[moment()[_0xc4b9('0xe')](_0xc4b9('0xf'))[_0xc4b9('0x10')](_0xc4b9('0x11')),moment()[_0xc4b9('0x12')]('day')[_0xc4b9('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xc4b9('0x13'),_0xc4b9('0x14'),'duration',_0xc4b9('0x15')]},'log':_0xc4b9('0x16')});};}; \ No newline at end of file +var _0x650c=['GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','Request','calleridnum','context','callerid','CreateVoiceCallReport'];(function(_0x162d2a,_0x4f6c9f){var _0x395e92=function(_0x520241){while(--_0x520241){_0x162d2a['push'](_0x162d2a['shift']());}};_0x395e92(++_0x4f6c9f);}(_0x650c,0x19c));var _0xc650=function(_0x33a893,_0x3ec136){_0x33a893=_0x33a893-0x0;var _0x339b19=_0x650c[_0x33a893];return _0x339b19;};'use strict';var moment=require(_0xc650('0x0'));var util=require(_0xc650('0x1'));var _=require('lodash');var client=require(_0xc650('0x2'));exports['create']=function(_0x48704a){return client[_0xc650('0x3')]('CreateVoiceCallReport',{'body':_['merge'](_0x48704a,{'source':_0x48704a[_0xc650('0x4')],'destinationcontext':_0x48704a[_0xc650('0x5')],'callerid':_0x48704a[_0xc650('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0xc650('0x7')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xc650('0x3')](_0xc650('0x8'),{'options':{'where':{'type':[_0xc650('0x9')],'createdAt':{'$between':[moment()[_0xc650('0xa')](_0xc650('0xb'))[_0xc650('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xc650('0xd')]('day')[_0xc650('0xc')](_0xc650('0xe'))]}},'attributes':[_0xc650('0xf'),_0xc650('0x10'),_0xc650('0x11'),_0xc650('0x12')]},'log':_0xc650('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 596e4be..30cec54 100644 --- a/server/services/ami/rpc/voiceDialReport.js +++ b/server/services/ami/rpc/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ab5=['CreateVoiceDialReport','../client','create','Request'];(function(_0x4835d9,_0x2a37a2){var _0x9ad61a=function(_0x4ed89a){while(--_0x4ed89a){_0x4835d9['push'](_0x4835d9['shift']());}};_0x9ad61a(++_0x2a37a2);}(_0x1ab5,0x1bd));var _0x51ab=function(_0x204089,_0x2ebed3){_0x204089=_0x204089-0x0;var _0x12689a=_0x1ab5[_0x204089];return _0x12689a;};'use strict';var client=require(_0x51ab('0x0'));exports[_0x51ab('0x1')]=function(_0x323e8f){return client[_0x51ab('0x2')]('CreateVoiceDialReport',{'body':_0x323e8f,'log':_0x51ab('0x3')});}; \ No newline at end of file +var _0x486a=['Request','CreateVoiceDialReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x486a,0x1f2));var _0xa486=function(_0x3f2ecf,_0x4ccad6){_0x3f2ecf=_0x3f2ecf-0x0;var _0xa6dd7e=_0x486a[_0x3f2ecf];return _0xa6dd7e;};'use strict';var client=require(_0xa486('0x0'));exports[_0xa486('0x1')]=function(_0x4ec4b0){return client[_0xa486('0x2')](_0xa486('0x3'),{'body':_0x4ec4b0,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 90d7274..f50bfa5 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43c8=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x210b93,_0x133e6d){var _0x2b020f=function(_0x3f9601){while(--_0x3f9601){_0x210b93['push'](_0x210b93['shift']());}};_0x2b020f(++_0x133e6d);}(_0x43c8,0xaf));var _0x843c=function(_0xd12d1d,_0x4ad319){_0xd12d1d=_0xd12d1d-0x0;var _0x14e8e0=_0x43c8[_0xd12d1d];return _0x14e8e0;};'use strict';var client=require('../client');exports[_0x843c('0x0')]=function(){return function(){return client['Request'](_0x843c('0x1'),{'options':{'raw':!![],'attributes':['id',_0x843c('0x2'),_0x843c('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x843c('0x0')});};}; \ No newline at end of file +var _0x7846=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x7846,0xf4));var _0x6784=function(_0x818500,_0xe7620c){_0x818500=_0x818500-0x0;var _0x342023=_0x7846[_0x818500];return _0x342023;};'use strict';var client=require('../client');exports[_0x6784('0x0')]=function(){return function(){return client[_0x6784('0x1')](_0x6784('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6784('0x3'),_0x6784('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x6784('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3ed30ba..e700865 100644 --- a/server/services/ami/rpc/voiceQueue.js +++ b/server/services/ami/rpc/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c08=['dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','name','callerid','active','Pause','TrunkBackup','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout'];(function(_0x454f96,_0x22f017){var _0x2a2c2d=function(_0x43befc){while(--_0x43befc){_0x454f96['push'](_0x454f96['shift']());}};_0x2a2c2d(++_0x22f017);}(_0x1c08,0x17b));var _0x81c0=function(_0x9ace37,_0x4d1159){_0x9ace37=_0x9ace37-0x0;var _0x23ecc0=_0x1c08[_0x9ace37];return _0x23ecc0;};'use strict';var client=require(_0x81c0('0x0'));exports[_0x81c0('0x1')]=function(){return function(){return client[_0x81c0('0x2')](_0x81c0('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x81c0('0x4'),_0x81c0('0x5'),_0x81c0('0x6'),_0x81c0('0x7'),_0x81c0('0x8'),_0x81c0('0x9'),_0x81c0('0xa'),_0x81c0('0xb'),'dialLimitQueue',_0x81c0('0xc'),_0x81c0('0xd'),_0x81c0('0xe'),_0x81c0('0xf'),'dialOriginateCallerIdName',_0x81c0('0x10'),_0x81c0('0x11'),_0x81c0('0x12'),_0x81c0('0x13'),_0x81c0('0x14'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x81c0('0x15'),_0x81c0('0x16'),_0x81c0('0x17'),_0x81c0('0x18'),_0x81c0('0x19'),_0x81c0('0x1a'),'dialGlobalInterval','dialPrefix',_0x81c0('0x1b'),_0x81c0('0x1c'),'dialAMDInitialSilence',_0x81c0('0x1d'),'dialAMDAfterGreetingSilence',_0x81c0('0x1e'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x81c0('0x1f'),'dialAMDSilenceThreshold',_0x81c0('0x20'),_0x81c0('0x21'),_0x81c0('0x22'),'dialRecallInQueue',_0x81c0('0x23'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x81c0('0x24'),_0x81c0('0x7'),_0x81c0('0x25'),_0x81c0('0x26'),_0x81c0('0x27'),_0x81c0('0x28'),_0x81c0('0x29'),'dialDropMaxRetry',_0x81c0('0x2a'),_0x81c0('0x2b'),_0x81c0('0x2c'),_0x81c0('0x2d'),_0x81c0('0x2e'),_0x81c0('0x2f'),'dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x81c0('0x30'),_0x81c0('0x31'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x81c0('0x32'),'attributes':['id',_0x81c0('0x33'),_0x81c0('0x34'),_0x81c0('0x35')]},{'model':_0x81c0('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0x81c0('0x33')]},{'model':_0x81c0('0x32'),'as':_0x81c0('0x37'),'attributes':['id',_0x81c0('0x33'),_0x81c0('0x34'),_0x81c0('0x35')]},{'model':'Interval','as':'Interval','attributes':['id',_0x81c0('0x33')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x81c0('0x33'),_0x81c0('0x38')]}]}]},'log':_0x81c0('0x1')});};}; \ No newline at end of file +var _0x92c4=['dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold'];(function(_0xc2f9e7,_0x8063c8){var _0x3c172f=function(_0x18f1b3){while(--_0x18f1b3){_0xc2f9e7['push'](_0xc2f9e7['shift']());}};_0x3c172f(++_0x8063c8);}(_0x92c4,0x1a8));var _0x492c=function(_0x3327b1,_0x2f8300){_0x3327b1=_0x3327b1-0x0;var _0x159fc9=_0x92c4[_0x3327b1];return _0x159fc9;};'use strict';var client=require(_0x492c('0x0'));exports[_0x492c('0x1')]=function(){return function(){return client[_0x492c('0x2')](_0x492c('0x3'),{'options':{'raw':![],'attributes':['id',_0x492c('0x4'),_0x492c('0x5'),'acwTimeout',_0x492c('0x6'),_0x492c('0x7'),_0x492c('0x8'),_0x492c('0x9'),_0x492c('0xa'),_0x492c('0xb'),'dialLimitQueue',_0x492c('0xc'),_0x492c('0xd'),_0x492c('0xe'),'dialPredictiveInterval',_0x492c('0xf'),_0x492c('0x10'),_0x492c('0x11'),_0x492c('0x12'),_0x492c('0x13'),_0x492c('0x14'),_0x492c('0x15'),_0x492c('0x16'),_0x492c('0x17'),_0x492c('0x18'),_0x492c('0x19'),_0x492c('0x1a'),'dialGlobalMaxRetry',_0x492c('0x1b'),_0x492c('0x1c'),_0x492c('0x1d'),_0x492c('0x1e'),_0x492c('0x1f'),'dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence',_0x492c('0x20'),'dialAMDMinWordLength',_0x492c('0x21'),'dialAMDMaximumNumberOfWords',_0x492c('0x22'),'dialAMDMaximumWordLength',_0x492c('0x23'),'dialRecallMeTimeout',_0x492c('0x24'),'dialOrderByScheduledAt',_0x492c('0x25'),'dialAgiAfterHangupClient',_0x492c('0x26'),_0x492c('0x7'),_0x492c('0x27'),_0x492c('0x28'),_0x492c('0x29'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x492c('0x2a'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x492c('0x2b'),'dialMachineMaxRetry',_0x492c('0x2c'),_0x492c('0x2d'),_0x492c('0x2e'),'mandatoryDisposition',_0x492c('0x2f'),_0x492c('0x30'),_0x492c('0x31'),_0x492c('0x32')],'include':[{'model':_0x492c('0x33'),'as':'Trunk','attributes':['id',_0x492c('0x4'),_0x492c('0x34'),_0x492c('0x35')]},{'model':_0x492c('0x36'),'as':_0x492c('0x37'),'attributes':['id',_0x492c('0x4')]},{'model':_0x492c('0x33'),'as':_0x492c('0x38'),'attributes':['id',_0x492c('0x4'),'callerid',_0x492c('0x35')]},{'model':_0x492c('0x39'),'as':_0x492c('0x39'),'attributes':['id',_0x492c('0x4')],'include':[{'model':_0x492c('0x39'),'as':_0x492c('0x3a'),'attributes':['id',_0x492c('0x4'),'interval']}]}]},'log':_0x492c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index c8b1ebe..cbf5354 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x4722ae,_0x57d118){var _0x32c256=function(_0x6db062){while(--_0x6db062){_0x4722ae['push'](_0x4722ae['shift']());}};_0x32c256(++_0x57d118);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x48843f,_0x5c9ca8){var _0x1ee3bc=function(_0x3be259){while(--_0x3be259){_0x48843f['push'](_0x48843f['shift']());}};_0x1ee3bc(++_0x5c9ca8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 62f0772..1d9b715 100644 --- a/server/services/ami/rpc/voiceQueueRt.js +++ b/server/services/ami/rpc/voiceQueueRt.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef8b=['Request','../client','getVoiceQueueRtPauses'];(function(_0x2ff7d2,_0x55a4e6){var _0x5c9aa9=function(_0x2d538){while(--_0x2d538){_0x2ff7d2['push'](_0x2ff7d2['shift']());}};_0x5c9aa9(++_0x55a4e6);}(_0xef8b,0x1a8));var _0xbef8=function(_0x25280c,_0x2edec1){_0x25280c=_0x25280c-0x0;var _0x3a58c3=_0xef8b[_0x25280c];return _0x3a58c3;};'use strict';var client=require(_0xbef8('0x0'));exports[_0xbef8('0x1')]=function(_0x2ca087){return function(){return client[_0xbef8('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2ca087,'paused':!![]},'raw':!![]},'log':_0xbef8('0x1')});};}; \ No newline at end of file +var _0x2edc=['../client','getVoiceQueueRtPauses'];(function(_0x1d7b54,_0x108920){var _0x6eabc0=function(_0x52bfc8){while(--_0x52bfc8){_0x1d7b54['push'](_0x1d7b54['shift']());}};_0x6eabc0(++_0x108920);}(_0x2edc,0x1e6));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc2ed('0x0'));exports[_0xc2ed('0x1')]=function(_0xfc8c7d){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0xfc8c7d,'paused':!![]},'raw':!![]},'log':_0xc2ed('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 2024f8c..5c339ed 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x13d68c,_0x4c8177){var _0x484d30=function(_0x4fb942){while(--_0x4fb942){_0x13d68c['push'](_0x13d68c['shift']());}};_0x484d30(++_0x4c8177);}(_0x7a54,0x106));var _0x47a5=function(_0xd3e859,_0x512271){_0xd3e859=_0xd3e859-0x0;var _0x1c211c=_0x7a54[_0xd3e859];return _0x1c211c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x474745,_0x3b23d7){var _0x4333c4=function(_0xe46e84){while(--_0xe46e84){_0x474745['push'](_0x474745['shift']());}};_0x4333c4(++_0x3b23d7);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index e0cc4cc..68f3943 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x195e=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum'];(function(_0x1e060d,_0x298b5a){var _0x1334e8=function(_0x30c556){while(--_0x30c556){_0x1e060d['push'](_0x1e060d['shift']());}};_0x1334e8(++_0x298b5a);}(_0x195e,0x196));var _0xe195=function(_0x343bca,_0x242be0){_0x343bca=_0x343bca-0x0;var _0x11601c=_0x195e[_0x343bca];return _0x11601c;};'use strict';var client=require(_0xe195('0x0'));exports[_0xe195('0x1')]={};exports['blindTransfer']=function(_0x2abeef){return client[_0xe195('0x2')](_0xe195('0x3'),{'body':{'result':_0x2abeef['result'],'transfererchannel':_0x2abeef['transfererchannel'],'transferercalleridnum':_0x2abeef[_0xe195('0x4')],'transferercalleridname':_0x2abeef[_0xe195('0x5')],'transfererconnectedlinenum':_0x2abeef[_0xe195('0x6')],'transfererconnectedlinename':_0x2abeef[_0xe195('0x7')],'transfereraccountcode':_0x2abeef[_0xe195('0x8')],'transferercontext':_0x2abeef[_0xe195('0x9')],'transfererexten':_0x2abeef[_0xe195('0xa')],'transfererlinkedid':_0x2abeef[_0xe195('0xb')],'transfereechannel':_0x2abeef['transfereechannel'],'transfereecalleridnum':_0x2abeef[_0xe195('0xc')],'transfereecalleridname':_0x2abeef['transfereecalleridname'],'transfereeconnectedlinenum':_0x2abeef[_0xe195('0xd')],'transfereeconnectedlinename':_0x2abeef[_0xe195('0xe')],'transfereeaccountcode':_0x2abeef['transfereeaccountcode'],'transfereecontext':_0x2abeef['transfereecontext'],'transfereeexten':_0x2abeef[_0xe195('0xf')],'transfereelinkedid':_0x2abeef['transfereelinkedid'],'isexternal':_0x2abeef[_0xe195('0x10')],'context':_0x2abeef['context'],'extension':_0x2abeef[_0xe195('0x11')],'type':_0xe195('0x12')},'log':_0xe195('0x3')});};exports[_0xe195('0x13')]=function(_0xb266a){return client['Request'](_0xe195('0x3'),{'body':{'result':_0xb266a[_0xe195('0x14')],'transfererchannel':_0xb266a[_0xe195('0x15')],'transferercalleridnum':_0xb266a[_0xe195('0x16')],'transferercalleridname':_0xb266a[_0xe195('0x17')],'transfererconnectedlinenum':_0xb266a[_0xe195('0x18')],'transfererconnectedlinename':_0xb266a[_0xe195('0x19')],'transfereraccountcode':_0xb266a[_0xe195('0x1a')],'transferercontext':_0xb266a[_0xe195('0x1b')],'transfererexten':_0xb266a[_0xe195('0x1c')],'transfererlinkedid':_0xb266a[_0xe195('0x1d')],'transfereechannel':_0xb266a[_0xe195('0x1e')],'transfereecalleridnum':_0xb266a[_0xe195('0x1f')],'transfereecalleridname':_0xb266a[_0xe195('0x20')],'transfereeconnectedlinenum':_0xb266a[_0xe195('0x21')],'transfereeconnectedlinename':_0xb266a[_0xe195('0x22')],'transfereeaccountcode':_0xb266a['transfertargetaccountcode'],'transfereecontext':_0xb266a['transfertargetcontext'],'transfereeexten':_0xb266a['transfertargetexten'],'transfereelinkedid':_0xb266a[_0xe195('0x23')],'isexternal':_0xb266a['isexternal'],'context':_0xb266a[_0xe195('0x24')],'extension':_0xb266a[_0xe195('0x25')],'type':_0xe195('0x26')},'log':_0xe195('0x3')});}; \ No newline at end of file +var _0x047b=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x047b,0x17f));var _0xb047=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x047b[_0x352e09];return _0x1b7094;};'use strict';var client=require(_0xb047('0x0'));exports[_0xb047('0x1')]={};exports[_0xb047('0x2')]=function(_0x48f52a){return client[_0xb047('0x3')](_0xb047('0x4'),{'body':{'result':_0x48f52a[_0xb047('0x5')],'transfererchannel':_0x48f52a['transfererchannel'],'transferercalleridnum':_0x48f52a['transferercalleridnum'],'transferercalleridname':_0x48f52a[_0xb047('0x6')],'transfererconnectedlinenum':_0x48f52a[_0xb047('0x7')],'transfererconnectedlinename':_0x48f52a[_0xb047('0x8')],'transfereraccountcode':_0x48f52a[_0xb047('0x9')],'transferercontext':_0x48f52a[_0xb047('0xa')],'transfererexten':_0x48f52a[_0xb047('0xb')],'transfererlinkedid':_0x48f52a['transfererlinkedid'],'transfereechannel':_0x48f52a[_0xb047('0xc')],'transfereecalleridnum':_0x48f52a[_0xb047('0xd')],'transfereecalleridname':_0x48f52a[_0xb047('0xe')],'transfereeconnectedlinenum':_0x48f52a['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x48f52a[_0xb047('0xf')],'transfereeaccountcode':_0x48f52a['transfereeaccountcode'],'transfereecontext':_0x48f52a[_0xb047('0x10')],'transfereeexten':_0x48f52a[_0xb047('0x11')],'transfereelinkedid':_0x48f52a[_0xb047('0x12')],'isexternal':_0x48f52a[_0xb047('0x13')],'context':_0x48f52a[_0xb047('0x14')],'extension':_0x48f52a[_0xb047('0x15')],'type':_0xb047('0x16')},'log':_0xb047('0x4')});};exports['attendedTransfer']=function(_0x22ff46){return client[_0xb047('0x3')](_0xb047('0x4'),{'body':{'result':_0x22ff46[_0xb047('0x5')],'transfererchannel':_0x22ff46[_0xb047('0x17')],'transferercalleridnum':_0x22ff46[_0xb047('0x18')],'transferercalleridname':_0x22ff46['origtransferercalleridname'],'transfererconnectedlinenum':_0x22ff46[_0xb047('0x19')],'transfererconnectedlinename':_0x22ff46['secondtransfererconnectedlinename'],'transfereraccountcode':_0x22ff46[_0xb047('0x1a')],'transferercontext':_0x22ff46['secondtransferercontext'],'transfererexten':_0x22ff46[_0xb047('0x1b')],'transfererlinkedid':_0x22ff46[_0xb047('0x1c')],'transfereechannel':_0x22ff46[_0xb047('0x1d')],'transfereecalleridnum':_0x22ff46['transfertargetcalleridnum'],'transfereecalleridname':_0x22ff46[_0xb047('0x1e')],'transfereeconnectedlinenum':_0x22ff46[_0xb047('0x1f')],'transfereeconnectedlinename':_0x22ff46[_0xb047('0x20')],'transfereeaccountcode':_0x22ff46[_0xb047('0x21')],'transfereecontext':_0x22ff46['transfertargetcontext'],'transfereeexten':_0x22ff46[_0xb047('0x22')],'transfereelinkedid':_0x22ff46[_0xb047('0x23')],'isexternal':_0x22ff46['isexternal'],'context':_0x22ff46[_0xb047('0x24')],'extension':_0x22ff46[_0xb047('0x25')],'type':_0xb047('0x26')},'log':_0xb047('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 93a37ea..86a9a47 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0faf=['wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','length','map','resolve','destinationchannel','stop','StopMixMonitor\x20Success','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','Redirect','exten','context','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','reload','module','action','Action','then','message','catch','isConnected','error','command','Command','content','voiceQueues','push','find','omit','undefined','values','channels','uniqueid','channel','%s.%s','filename'];(function(_0x1ea3c9,_0x534203){var _0x3d17b3=function(_0x3e7209){while(--_0x3e7209){_0x1ea3c9['push'](_0x1ea3c9['shift']());}};_0x3d17b3(++_0x534203);}(_0x0faf,0x132));var _0xf0fa=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0x0faf[_0x3616bb];return _0x1c0994;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var jayson=require(_0xf0fa('0x1'));var schema=require(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var config=require(_0xf0fa('0x4'));var properties=require(_0xf0fa('0x5'));var ami=require(_0xf0fa('0x6'));var VoiceQueueSummary=require(_0xf0fa('0x7'));exports[_0xf0fa('0x8')]=function(_0x283f04,_0x5d9b58,_0x3637a3){return new Promise(function(_0x44ffa0,_0x25b5c4){var _0x3a703b={'QueuePause':function(_0x2db1d9){return new Promise(function(_0x587865){var _0x42f7fd=util[_0xf0fa('0x9')]('%s/%s','SIP',_0x2db1d9[_0xf0fa('0xa')]);if(_0x283f04[_0xf0fa('0xb')]&&_0x283f04[_0xf0fa('0xb')][_0x42f7fd]&&_0x283f04[_0xf0fa('0xb')][_0x42f7fd][_0xf0fa('0xc')]){_0x283f04[_0xf0fa('0xb')][_0x42f7fd][_0xf0fa('0xd')]();}if(_0x283f04[_0xf0fa('0xe')][_0x42f7fd]){_0x283f04['agents'][_0x42f7fd][_0xf0fa('0xf')]({'statePause':_0x2db1d9['pause']?!![]:![]});}_0x587865({'code':0xc8,'message':_0xf0fa('0x10')});});},'Reload':function(_0x521034){var _0x39ae2b=this;return new Promise(function(_0x17326f,_0x39a086){if(ami['isConnected']()==![]){return _0x39a086(_0x39ae2b['error'](0x1f4,[config[_0xf0fa('0x11')]['ip'],config['asterisk'][_0xf0fa('0x12')],_0xf0fa('0x13')][_0xf0fa('0x14')]('\x20')));}_0x521034=_[_0xf0fa('0x15')](_0x521034,_[_0xf0fa('0x16')](properties[_0xf0fa('0x17')][_0xf0fa('0x18')]));_0x521034[_0xf0fa('0x19')]='Reload';return ami[_0xf0fa('0x1a')](_0x521034)[_0xf0fa('0x1b')](function(_0x30ce17){_0x17326f({'code':0xc8,'message':_0x30ce17[_0xf0fa('0x1c')]});})[_0xf0fa('0x1d')](function(_0x386e5f){_0x39a086(_0x39ae2b['error'](0x1f5,_0x386e5f['message']));});});},'Command':function(_0x2f376d){var _0x2751cc=this;return new Promise(function(_0x151d09,_0x2385e2){if(ami[_0xf0fa('0x1e')]()==![]){return _0x2385e2(_0x2751cc[_0xf0fa('0x1f')](0x1f4,[config[_0xf0fa('0x11')]['ip'],config[_0xf0fa('0x11')][_0xf0fa('0x12')],_0xf0fa('0x13')][_0xf0fa('0x14')]('\x20')));}_0x2f376d=_['pick'](_0x2f376d,_0xf0fa('0x20'));_0x2f376d[_0xf0fa('0x19')]=_0xf0fa('0x21');return ami[_0xf0fa('0x1a')](_0x2f376d)[_0xf0fa('0x1b')](function(_0x2b22c5){_0x151d09({'code':0xc8,'message':_0x2b22c5[_0xf0fa('0x22')]});})[_0xf0fa('0x1d')](function(_0x3feb0c){_0x2385e2(_0x2751cc['error'](0x1f5,_0x3feb0c[_0xf0fa('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x19e392){var _0x56134e=[];for(var _0x3b5d7d in _0x283f04[_0xf0fa('0x23')]){if(_0x283f04[_0xf0fa('0x23')]['hasOwnProperty'](_0x3b5d7d)){var _0xded80d=_0x283f04[_0xf0fa('0x23')][_0x3b5d7d];var _0x3d10fb=new VoiceQueueSummary(_0xded80d);_0x56134e[_0xf0fa('0x24')](_0x3d10fb);}}_0x19e392({'count':_0x56134e['length'],'rows':_0x56134e});});},'UpdateVoiceQueue':function(_0x4be235){return new Promise(function(_0x287810,_0x1c5eaf){var _0x1679cf=_[_0xf0fa('0x25')](_0x283f04['voiceQueues'],{'id':parseInt(_0x4be235['id'])});var _0x4058d6=_[_0xf0fa('0x26')](_0x4be235,['id']);if(_0x1679cf){for(var _0x1279cf in _0x4058d6){if(typeof _0x4058d6[_0x1279cf]!=='undefined'&&typeof _0x1679cf[_0x1279cf]!==_0xf0fa('0x27')){_0x1679cf[_0x1279cf]=_0x4058d6[_0x1279cf];}}_0x287810(_0x1679cf);}else{_0x1c5eaf();}});},'VoiceChannels':function(){return new Promise(function(_0x593697){var _0x42c656=_[_0xf0fa('0x28')](_0x283f04[_0xf0fa('0x29')]);_0x593697({'count':_0x42c656['length'],'rows':_0x42c656});});},'VoiceChannelMixMonitor':function(_0x35d202){var _0x33cc64=this;return new Promise(function(_0x574ba7,_0x212986){if(ami[_0xf0fa('0x1e')]()==![]){return _0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xf0fa('0x12')],_0xf0fa('0x13')]['join']('\x20')));}var _0x38cf8c=schema(properties['voicechannel'])['validate'](_0x35d202);if(_0x38cf8c['length']>0x0){return _0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f4,_['map'](_0x38cf8c,_0xf0fa('0x1c'))[_0xf0fa('0x14')](',\x20')));}var _0x5e1d57=_[_0xf0fa('0x25')](_0x283f04[_0xf0fa('0x29')],{'uniqueid':_0x35d202[_0xf0fa('0x2a')]});if(_0x5e1d57&&_0x5e1d57[_0xf0fa('0x2b')]){var _0xe61cb7=util['format'](_0xf0fa('0x2c'),_0x35d202[_0xf0fa('0x2d')]||_0x35d202[_0xf0fa('0x2a')],_0x35d202['format']||_0xf0fa('0x2e'));return ami[_0xf0fa('0x1a')]({'action':_0xf0fa('0x2f'),'channel':_0x5e1d57[_0xf0fa('0x2b')],'file':_0xe61cb7,'options':'ai(mixmonitorid)'})['then'](function(_0x2a9f4b){var _0x68b3fe=_[_0xf0fa('0x25')](_0x5e1d57[_0xf0fa('0x30')],{'filename':_0xf0fa('0x31')+_0xe61cb7['toLowerCase']()});if(_['isNil'](_0x68b3fe)){_0x5e1d57['monitors']['push']({'filename':_0xf0fa('0x31')+_0xe61cb7[_0xf0fa('0x32')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x2a9f4b[_0xf0fa('0x33')],'status':_0xf0fa('0x34')});}else{_0x68b3fe[_0xf0fa('0x33')]=_0x2a9f4b[_0xf0fa('0x33')];_0x68b3fe[_0xf0fa('0x35')]=_0xf0fa('0x34');}_0x574ba7({'code':0xc8,'message':[_0x35d202[_0xf0fa('0x2a')],'MixMonitor\x20Success',_0x2a9f4b['mixmonitorid']][_0xf0fa('0x14')]('\x20'),'mixmonitorid':_0x2a9f4b[_0xf0fa('0x33')]});})[_0xf0fa('0x1d')](function(_0x46e376){_0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f5,[_0x35d202[_0xf0fa('0x2a')],_0x46e376['message'][_0xf0fa('0x32')]()]['join']('\x20')));});}else{return _0x212986(_0x33cc64[_0xf0fa('0x1f')](0x1f5,_0xf0fa('0x36')));}});},'VoiceChannelStopMixMonitor':function(_0x6e1fd9){var _0x4107ba=this;return new Promise(function(_0x14bee8,_0x8cce53){if(ami[_0xf0fa('0x1e')]()==![]){return _0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f4,[config[_0xf0fa('0x11')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xf0fa('0x14')]('\x20')));}var _0x34be72=schema(properties['voicechannel'])[_0xf0fa('0x2')](_0x6e1fd9);if(_0x34be72[_0xf0fa('0x37')]>0x0){return _0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f4,_[_0xf0fa('0x38')](_0x34be72,'message')[_0xf0fa('0x14')](',\x20')));}var _0x1f3916=_[_0xf0fa('0x25')](_0x283f04[_0xf0fa('0x29')],{'uniqueid':_0x6e1fd9[_0xf0fa('0x2a')]});if(_0x1f3916){return Promise[_0xf0fa('0x39')]()[_0xf0fa('0x1b')](function(){if(_0x1f3916[_0xf0fa('0x2b')]){return ami[_0xf0fa('0x1a')]({'action':'StopMixMonitor','channel':_0x1f3916[_0xf0fa('0x2b')],'mixmonitorid':_0x6e1fd9[_0xf0fa('0x33')]})[_0xf0fa('0x1d')](function(){});}})[_0xf0fa('0x1b')](function(){if(_0x1f3916[_0xf0fa('0x3a')]){return ami[_0xf0fa('0x1a')]({'action':'StopMixMonitor','channel':_0x1f3916[_0xf0fa('0x3a')],'mixmonitorid':_0x6e1fd9[_0xf0fa('0x33')]})['catch'](function(){});}})[_0xf0fa('0x1b')](function(){var _0x235e99=_[_0xf0fa('0x25')](_0x1f3916[_0xf0fa('0x30')],{'mixmonitorid':_0x6e1fd9[_0xf0fa('0x33')]});if(_0x235e99){_0x235e99[_0xf0fa('0x35')]=_0xf0fa('0x3b');}})[_0xf0fa('0x1b')](function(){var _0x35272e=util['format'](_0xf0fa('0x2c'),_0x6e1fd9['filename']||_0x6e1fd9[_0xf0fa('0x2a')],_0x6e1fd9[_0xf0fa('0x9')]||_0xf0fa('0x2e'));var _0x569ba9=_[_0xf0fa('0x25')](_0x1f3916[_0xf0fa('0x30')],{'filename':_0xf0fa('0x31')+_0x35272e[_0xf0fa('0x32')]()});if(_0x569ba9){_0x569ba9[_0xf0fa('0x35')]='stop';}})[_0xf0fa('0x1b')](function(){_0x14bee8({'code':0xc8,'message':[_0x6e1fd9['uniqueid'],_0xf0fa('0x3c')][_0xf0fa('0x14')]('\x20')});})[_0xf0fa('0x1d')](function(_0x141087){_0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f5,[_0x6e1fd9['uniqueid'],_0x141087[_0xf0fa('0x1c')][_0xf0fa('0x32')]()][_0xf0fa('0x14')]('\x20')));});}else{return _0x8cce53(_0x4107ba[_0xf0fa('0x1f')](0x1f5,_0xf0fa('0x36')));}});},'VoiceQueuesChannels':function(_0x29f3d0){var _0x52e781=this;return new Promise(function(_0x44a3bf){var _0x5e1e8e=_['values'](_0x283f04['queueChannels']);var _0x31a192={'count':_0x5e1e8e[_0xf0fa('0x37')],'rows':_0x5e1e8e};if(_0x29f3d0&&_0x29f3d0[_0xf0fa('0x3d')]){if(![_0xf0fa('0x3e'),_0xf0fa('0x3f')][_0xf0fa('0x40')](_0x29f3d0[_0xf0fa('0x3d')])){return _0x25b5c4(_0x52e781[_0xf0fa('0x1f')](0x190,_0xf0fa('0x41')));}var _0x506b2f=_[_0xf0fa('0x42')](_0x5e1e8e,function(_0x5c4f0c){return _0x5c4f0c[_0xf0fa('0x3d')]===_0x29f3d0[_0xf0fa('0x3d')];});_0x31a192[_0xf0fa('0x43')]=_0x506b2f[_0xf0fa('0x37')];_0x31a192['rows']=_0x506b2f;}_0x44a3bf(_0x31a192);});},'VoiceQueuesChannel':function(_0x36e343){var _0x5844a3=this;return new Promise(function(_0x2f0e8e,_0x398ea0){var _0x10b45c=schema(properties[_0xf0fa('0x44')])[_0xf0fa('0x2')](_0x36e343);if(_0x10b45c[_0xf0fa('0x37')]>0x0){return _0x398ea0(_0x5844a3['error'](0x1f4,_[_0xf0fa('0x38')](_0x10b45c,_0xf0fa('0x1c'))['join'](',\x20')));}var _0x4498b3=_[_0xf0fa('0x25')](_0x283f04['queueChannels'],{'uniqueid':_0x36e343[_0xf0fa('0x2a')]});if(_0x4498b3){_0x2f0e8e(_0x4498b3);}else{return _0x398ea0(_0x5844a3[_0xf0fa('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0xd01a7a){var _0x3c5014=this;return new Promise(function(_0xd7cd1a,_0x4db972){if(ami[_0xf0fa('0x1e')]()==![]){return _0x4db972(_0x3c5014[_0xf0fa('0x1f')](0x1f4,[config['asterisk']['ip'],config[_0xf0fa('0x11')][_0xf0fa('0x12')],_0xf0fa('0x13')]['join']('\x20')));}var _0x3ac82c=schema(properties[_0xf0fa('0x45')])['validate'](_0xd01a7a);if(_0x3ac82c[_0xf0fa('0x37')]>0x0){return _0x4db972(_0x3c5014[_0xf0fa('0x1f')](0x1f4,_[_0xf0fa('0x38')](_0x3ac82c,_0xf0fa('0x1c'))[_0xf0fa('0x14')](',\x20')));}var _0x19c816=_[_0xf0fa('0x25')](_0x283f04[_0xf0fa('0x46')],{'uniqueid':_0xd01a7a[_0xf0fa('0x2a')]});if(_0x19c816&&_0x19c816[_0xf0fa('0x2b')]){return ami['Action']({'action':_0xf0fa('0x47'),'channel':_0x19c816[_0xf0fa('0x2b')]})[_0xf0fa('0x1b')](function(_0x664a0d){_0xd7cd1a({'code':0xc8,'message':[_0xd01a7a[_0xf0fa('0x2a')],_0x664a0d[_0xf0fa('0x1c')][_0xf0fa('0x32')]()]['join']('\x20')});})[_0xf0fa('0x1d')](function(_0x195632){_0x4db972(_0x3c5014[_0xf0fa('0x1f')](0x1f5,[_0xd01a7a[_0xf0fa('0x2a')],_0x195632[_0xf0fa('0x1c')][_0xf0fa('0x32')]()][_0xf0fa('0x14')]('\x20')));});}else{return _0x4db972(_0x3c5014['error'](0x1f5,_0xf0fa('0x36')));}});},'VoiceQueuesChannelRedirect':function(_0x150076){var _0x2e21ba=this;return new Promise(function(_0x1f608e,_0x473e3d){if(ami['isConnected']()==![]){return _0x473e3d(_0x2e21ba['error'](0x1f4,[config['asterisk']['ip'],config[_0xf0fa('0x11')][_0xf0fa('0x12')],_0xf0fa('0x13')][_0xf0fa('0x14')]('\x20')));}var _0x508df9=schema(properties['voicequeuechannelredirect'])[_0xf0fa('0x2')](_0x150076);if(_0x508df9['length']>0x0){return _0x473e3d(_0x2e21ba[_0xf0fa('0x1f')](0x1f4,_[_0xf0fa('0x38')](_0x508df9,_0xf0fa('0x1c'))[_0xf0fa('0x14')](',\x20')));}var _0x1b4c03=_['find'](_0x283f04[_0xf0fa('0x46')],{'uniqueid':_0x150076[_0xf0fa('0x2a')]});if(_0x1b4c03&&_0x1b4c03[_0xf0fa('0x2b')]){return ami[_0xf0fa('0x1a')]({'action':_0xf0fa('0x48'),'channel':_0x1b4c03[_0xf0fa('0x2b')],'exten':_0x150076[_0xf0fa('0x49')],'context':_0x150076[_0xf0fa('0x4a')]||_0x1b4c03[_0xf0fa('0x4a')],'priority':0x1})['then'](function(_0x5b166d){_0x1f608e({'code':0xc8,'message':[_0x150076[_0xf0fa('0x2a')],_0x5b166d['message'][_0xf0fa('0x32')]()]['join']('\x20')});})['catch'](function(_0x4a851b){_0x473e3d(_0x2e21ba[_0xf0fa('0x1f')](0x1f5,[_0x150076[_0xf0fa('0x2a')],_0x4a851b[_0xf0fa('0x1c')][_0xf0fa('0x32')]()][_0xf0fa('0x14')]('\x20')));});}else{return _0x473e3d(_0x2e21ba[_0xf0fa('0x1f')](0x1f5,_0xf0fa('0x36')));}});},'Agents':function(_0x2b7965){return new Promise(function(_0x2a5a11){var _0x1cd67c=_['values'](_0x283f04[_0xf0fa('0xe')]);if(_0x2b7965&&_0x2b7965['id']){var _0x5de588=_[_0xf0fa('0x25')](_0x1cd67c,function(_0x56c701){return _0x56c701['id']===_0x2b7965['id'];});_0x2a5a11(_0x5de588);}else{_0x2a5a11({'count':_0x1cd67c[_0xf0fa('0x37')],'rows':_0x1cd67c});}});},'Telephones':function(){return new Promise(function(_0x499e82){var _0xfc616e=_['values'](_0x283f04[_0xf0fa('0x4b')]);_0x499e82({'count':_0xfc616e[_0xf0fa('0x37')],'rows':_0xfc616e});});},'Trunks':function(){return new Promise(function(_0x274ae3){var _0x17ab19=_[_0xf0fa('0x28')](_0x283f04['trunks']);_0x274ae3({'count':_0x17ab19['length'],'rows':_0x17ab19});});},'OutboundChannels':function(){return new Promise(function(_0x4224ce){var _0x157772=_['values'](_0x283f04['outboundChannels']);_0x4224ce({'count':_0x157772[_0xf0fa('0x37')],'rows':_0x157772});});},'Outbound':function(){return new Promise(function(_0x1390d8){_0x1390d8(_0x283f04[_0xf0fa('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0x38b507){var _0x2748ef=_['values'](_0x283f04[_0xf0fa('0x4c')]);_0x38b507({'count':_0x2748ef[_0xf0fa('0x37')],'rows':_0x2748ef});});},'VoiceQueuesPreview':function(_0x16492b){var _0x5ab304=this;return new Promise(function(_0x5c2839,_0x82277a){_0x5d9b58[_0xf0fa('0x4d')](_0x16492b['id'])['then'](function(_0x4c1032){_0x5c2839({'code':0xc8,'message':_0x4c1032[_0xf0fa('0x1c')]});})[_0xf0fa('0x1d')](function(_0x22cf95){_0x82277a(_0x5ab304['error'](0x1f4,_0x22cf95['message']));});});},'EventManager':function(_0x516eec){var _0x39711c=this;return new Promise(function(_0x4df165,_0x5a27e8){if(!_0x516eec[_0xf0fa('0x4e')]){return _0x5a27e8(_0x39711c[_0xf0fa('0x1f')](0x1f4,_0xf0fa('0x4f')));}ami[_0xf0fa('0x50')](_0xf0fa('0x51')+_0x516eec[_0xf0fa('0x4e')],_0x516eec['message']);_0x4df165({'code':0xc8,'message':_0x516eec});});},'FaxAccounts':function(){return new Promise(function(_0x1b538a){var _0x18281f=_[_0xf0fa('0x28')](_0x283f04['faxAccounts']);_0x1b538a({'count':_0x18281f[_0xf0fa('0x37')],'rows':_0x18281f});});},'SendFax':function(_0x4b803f){var _0x4e8263=this;return new Promise(function(_0x21a479,_0x5141d4){_0x3637a3['send'](_0x4b803f)[_0xf0fa('0x1b')](function(_0x418ee8){_0x21a479({'code':0xc8,'message':_0x418ee8[_0xf0fa('0x1c')]});})['catch'](function(_0xe1b0ff){_0x5141d4(_0x4e8263[_0xf0fa('0x1f')](0x1f4,_0xe1b0ff['message']));});});},'CheckAfterSend':function(_0x6fc2af){var _0xb8aff2=this;return new Promise(function(_0x22c518,_0xe232f8){_0x3637a3[_0xf0fa('0x52')](_0x6fc2af)[_0xf0fa('0x1b')](function(_0x56265f){_0x22c518({'code':0xc8,'message':_0x56265f[_0xf0fa('0x1c')]});})['catch'](function(_0x101751){_0xe232f8(_0xb8aff2[_0xf0fa('0x1f')](0x1f4,_0x101751[_0xf0fa('0x1c')]));});});}};var _0x487ed0=jayson[_0xf0fa('0x53')](_0x3a703b)[_0xf0fa('0x54')]();_0x487ed0['on'](_0xf0fa('0x1f'),function(_0x578ca0){return _0x25b5c4(_0x578ca0);});_0x487ed0['listen'](0x232a,_0xf0fa('0x55'),function(){console[_0xf0fa('0x56')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x44ffa0(_0xf0fa('0x57')+0x232a);});});}; \ No newline at end of file +var _0xf072=['outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','send','checkAfterSend','server','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../properties','../ami','../model/voiceQueueSummary','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','catch','isConnected','command','Command','voiceQueues','push','length','find','omit','undefined','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','rec','mixmonitorid','status','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','values','queueChannels','inbound','outbound','filter','type','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks'];(function(_0x1a007a,_0x5f3509){var _0x1b3ea8=function(_0x26e958){while(--_0x26e958){_0x1a007a['push'](_0x1a007a['shift']());}};_0x1b3ea8(++_0x5f3509);}(_0xf072,0x1cf));var _0x2f07=function(_0x3d8d52,_0x19664b){_0x3d8d52=_0x3d8d52-0x0;var _0x5f0932=_0xf072[_0x3d8d52];return _0x5f0932;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var jayson=require(_0x2f07('0x2'));var schema=require('validate');var moment=require(_0x2f07('0x3'));var config=require('../../../config/environment');var properties=require(_0x2f07('0x4'));var ami=require(_0x2f07('0x5'));var VoiceQueueSummary=require(_0x2f07('0x6'));exports['listen']=function(_0x1d5a33,_0x14d6e6,_0x3643bb){return new Promise(function(_0x2e6422,_0x235418){var _0xf73d1a={'QueuePause':function(_0x33b99c){return new Promise(function(_0x379b2e){var _0x4746c2=util[_0x2f07('0x7')](_0x2f07('0x8'),_0x2f07('0x9'),_0x33b99c[_0x2f07('0xa')]);if(_0x1d5a33[_0x2f07('0xb')]&&_0x1d5a33[_0x2f07('0xb')][_0x4746c2]&&_0x1d5a33['timers'][_0x4746c2][_0x2f07('0xc')]){_0x1d5a33[_0x2f07('0xb')][_0x4746c2][_0x2f07('0xd')]();}if(_0x1d5a33[_0x2f07('0xe')][_0x4746c2]){_0x1d5a33['agents'][_0x4746c2]['updateStatusRealtime']({'statePause':_0x33b99c[_0x2f07('0xf')]?!![]:![]});}_0x379b2e({'code':0xc8,'message':_0x2f07('0x10')});});},'Reload':function(_0x58549c){var _0x6eb88a=this;return new Promise(function(_0x34dbd4,_0x26edfa){if(ami['isConnected']()==![]){return _0x26edfa(_0x6eb88a[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}_0x58549c=_['pick'](_0x58549c,_[_0x2f07('0x16')](properties['reload'][_0x2f07('0x17')]));_0x58549c[_0x2f07('0x18')]=_0x2f07('0x19');return ami[_0x2f07('0x1a')](_0x58549c)[_0x2f07('0x1b')](function(_0x46c9b4){_0x34dbd4({'code':0xc8,'message':_0x46c9b4[_0x2f07('0x1c')]});})[_0x2f07('0x1d')](function(_0x55bd60){_0x26edfa(_0x6eb88a[_0x2f07('0x11')](0x1f5,_0x55bd60['message']));});});},'Command':function(_0x3cd3c0){var _0x2df6ed=this;return new Promise(function(_0x119b68,_0xd944d6){if(ami[_0x2f07('0x1e')]()==![]){return _0xd944d6(_0x2df6ed['error'](0x1f4,[config[_0x2f07('0x12')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x2f07('0x15')]('\x20')));}_0x3cd3c0=_['pick'](_0x3cd3c0,_0x2f07('0x1f'));_0x3cd3c0['action']=_0x2f07('0x20');return ami[_0x2f07('0x1a')](_0x3cd3c0)[_0x2f07('0x1b')](function(_0x307888){_0x119b68({'code':0xc8,'message':_0x307888['content']});})[_0x2f07('0x1d')](function(_0x428d8c){_0xd944d6(_0x2df6ed[_0x2f07('0x11')](0x1f5,_0x428d8c['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x111376){var _0x113916=[];for(var _0x522006 in _0x1d5a33[_0x2f07('0x21')]){if(_0x1d5a33[_0x2f07('0x21')]['hasOwnProperty'](_0x522006)){var _0x427e13=_0x1d5a33['voiceQueues'][_0x522006];var _0x894cd4=new VoiceQueueSummary(_0x427e13);_0x113916[_0x2f07('0x22')](_0x894cd4);}}_0x111376({'count':_0x113916[_0x2f07('0x23')],'rows':_0x113916});});},'UpdateVoiceQueue':function(_0x18f599){return new Promise(function(_0x20e4f8,_0x139ea8){var _0x787aad=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x21')],{'id':parseInt(_0x18f599['id'])});var _0x468cd8=_[_0x2f07('0x25')](_0x18f599,['id']);if(_0x787aad){for(var _0x279eb3 in _0x468cd8){if(typeof _0x468cd8[_0x279eb3]!=='undefined'&&typeof _0x787aad[_0x279eb3]!==_0x2f07('0x26')){_0x787aad[_0x279eb3]=_0x468cd8[_0x279eb3];}}_0x20e4f8(_0x787aad);}else{_0x139ea8();}});},'VoiceChannels':function(){return new Promise(function(_0x2b806a){var _0xada137=_['values'](_0x1d5a33[_0x2f07('0x27')]);_0x2b806a({'count':_0xada137[_0x2f07('0x23')],'rows':_0xada137});});},'VoiceChannelMixMonitor':function(_0x115c97){var _0x5ad0de=this;return new Promise(function(_0xcd91be,_0x368e3d){if(ami[_0x2f07('0x1e')]()==![]){return _0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],'ami\x20disconnected'][_0x2f07('0x15')]('\x20')));}var _0x5b0407=schema(properties[_0x2f07('0x28')])[_0x2f07('0x29')](_0x115c97);if(_0x5b0407[_0x2f07('0x23')]>0x0){return _0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x2a')](_0x5b0407,_0x2f07('0x1c'))[_0x2f07('0x15')](',\x20')));}var _0x3a2bb7=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x27')],{'uniqueid':_0x115c97[_0x2f07('0x2b')]});if(_0x3a2bb7&&_0x3a2bb7[_0x2f07('0x2c')]){var _0xa74d2c=util[_0x2f07('0x7')](_0x2f07('0x2d'),_0x115c97[_0x2f07('0x2e')]||_0x115c97['uniqueid'],_0x115c97['format']||_0x2f07('0x2f'));return ami[_0x2f07('0x1a')]({'action':_0x2f07('0x30'),'channel':_0x3a2bb7['channel'],'file':_0xa74d2c,'options':'ai(mixmonitorid)'})[_0x2f07('0x1b')](function(_0x4acfb6){var _0x35c4e2=_[_0x2f07('0x24')](_0x3a2bb7[_0x2f07('0x31')],{'filename':_0x2f07('0x32')+_0xa74d2c[_0x2f07('0x33')]()});if(_['isNil'](_0x35c4e2)){_0x3a2bb7[_0x2f07('0x31')]['push']({'filename':_0x2f07('0x32')+_0xa74d2c['toLowerCase'](),'createdAt':moment()[_0x2f07('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x4acfb6['mixmonitorid'],'status':_0x2f07('0x34')});}else{_0x35c4e2[_0x2f07('0x35')]=_0x4acfb6['mixmonitorid'];_0x35c4e2[_0x2f07('0x36')]=_0x2f07('0x34');}_0xcd91be({'code':0xc8,'message':[_0x115c97[_0x2f07('0x2b')],'MixMonitor\x20Success',_0x4acfb6[_0x2f07('0x35')]][_0x2f07('0x15')]('\x20'),'mixmonitorid':_0x4acfb6[_0x2f07('0x35')]});})[_0x2f07('0x1d')](function(_0x25b1a9){_0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f5,[_0x115c97[_0x2f07('0x2b')],_0x25b1a9[_0x2f07('0x1c')]['toLowerCase']()][_0x2f07('0x15')]('\x20')));});}else{return _0x368e3d(_0x5ad0de[_0x2f07('0x11')](0x1f5,_0x2f07('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x3f1b6b){var _0x46c665=this;return new Promise(function(_0x2ded2e,_0x5129c){if(ami['isConnected']()==![]){return _0x5129c(_0x46c665[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}var _0x4d5932=schema(properties[_0x2f07('0x28')])[_0x2f07('0x29')](_0x3f1b6b);if(_0x4d5932[_0x2f07('0x23')]>0x0){return _0x5129c(_0x46c665[_0x2f07('0x11')](0x1f4,_['map'](_0x4d5932,'message')[_0x2f07('0x15')](',\x20')));}var _0x437e94=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x27')],{'uniqueid':_0x3f1b6b['uniqueid']});if(_0x437e94){return Promise[_0x2f07('0x38')]()[_0x2f07('0x1b')](function(){if(_0x437e94[_0x2f07('0x2c')]){return ami[_0x2f07('0x1a')]({'action':_0x2f07('0x39'),'channel':_0x437e94[_0x2f07('0x2c')],'mixmonitorid':_0x3f1b6b[_0x2f07('0x35')]})[_0x2f07('0x1d')](function(){});}})[_0x2f07('0x1b')](function(){if(_0x437e94[_0x2f07('0x3a')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x437e94['destinationchannel'],'mixmonitorid':_0x3f1b6b[_0x2f07('0x35')]})[_0x2f07('0x1d')](function(){});}})['then'](function(){var _0x97c166=_['find'](_0x437e94[_0x2f07('0x31')],{'mixmonitorid':_0x3f1b6b[_0x2f07('0x35')]});if(_0x97c166){_0x97c166[_0x2f07('0x36')]='stop';}})[_0x2f07('0x1b')](function(){var _0x350ace=util['format']('%s.%s',_0x3f1b6b[_0x2f07('0x2e')]||_0x3f1b6b[_0x2f07('0x2b')],_0x3f1b6b[_0x2f07('0x7')]||_0x2f07('0x2f'));var _0x1596f8=_[_0x2f07('0x24')](_0x437e94[_0x2f07('0x31')],{'filename':_0x2f07('0x32')+_0x350ace[_0x2f07('0x33')]()});if(_0x1596f8){_0x1596f8[_0x2f07('0x36')]=_0x2f07('0x3b');}})[_0x2f07('0x1b')](function(){_0x2ded2e({'code':0xc8,'message':[_0x3f1b6b[_0x2f07('0x2b')],_0x2f07('0x3c')][_0x2f07('0x15')]('\x20')});})[_0x2f07('0x1d')](function(_0x47ea61){_0x5129c(_0x46c665[_0x2f07('0x11')](0x1f5,[_0x3f1b6b[_0x2f07('0x2b')],_0x47ea61[_0x2f07('0x1c')][_0x2f07('0x33')]()][_0x2f07('0x15')]('\x20')));});}else{return _0x5129c(_0x46c665[_0x2f07('0x11')](0x1f5,_0x2f07('0x37')));}});},'VoiceQueuesChannels':function(_0x23a8ee){var _0x146d70=this;return new Promise(function(_0x5b920b){var _0x3354e0=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x3e')]);var _0x12523d={'count':_0x3354e0['length'],'rows':_0x3354e0};if(_0x23a8ee&&_0x23a8ee['type']){if(![_0x2f07('0x3f'),_0x2f07('0x40')]['includes'](_0x23a8ee['type'])){return _0x235418(_0x146d70[_0x2f07('0x11')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x2bfb93=_[_0x2f07('0x41')](_0x3354e0,function(_0x236e61){return _0x236e61[_0x2f07('0x42')]===_0x23a8ee[_0x2f07('0x42')];});_0x12523d[_0x2f07('0x43')]=_0x2bfb93[_0x2f07('0x23')];_0x12523d[_0x2f07('0x44')]=_0x2bfb93;}_0x5b920b(_0x12523d);});},'VoiceQueuesChannel':function(_0x418be3){var _0x3b381a=this;return new Promise(function(_0x49dfeb,_0x42fa33){var _0x399072=schema(properties[_0x2f07('0x45')])[_0x2f07('0x29')](_0x418be3);if(_0x399072['length']>0x0){return _0x42fa33(_0x3b381a[_0x2f07('0x11')](0x1f4,_['map'](_0x399072,'message')['join'](',\x20')));}var _0x43fa9b=_[_0x2f07('0x24')](_0x1d5a33[_0x2f07('0x3e')],{'uniqueid':_0x418be3[_0x2f07('0x2b')]});if(_0x43fa9b){_0x49dfeb(_0x43fa9b);}else{return _0x42fa33(_0x3b381a[_0x2f07('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x13c1b0){var _0x4084d6=this;return new Promise(function(_0x402da6,_0x56e9be){if(ami[_0x2f07('0x1e')]()==![]){return _0x56e9be(_0x4084d6['error'](0x1f4,[config[_0x2f07('0x12')]['ip'],config['asterisk'][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}var _0xcef3d2=schema(properties[_0x2f07('0x46')])[_0x2f07('0x29')](_0x13c1b0);if(_0xcef3d2[_0x2f07('0x23')]>0x0){return _0x56e9be(_0x4084d6[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x2a')](_0xcef3d2,_0x2f07('0x1c'))['join'](',\x20')));}var _0x5c2dd2=_[_0x2f07('0x24')](_0x1d5a33['queueChannels'],{'uniqueid':_0x13c1b0['uniqueid']});if(_0x5c2dd2&&_0x5c2dd2['channel']){return ami['Action']({'action':_0x2f07('0x47'),'channel':_0x5c2dd2['channel']})[_0x2f07('0x1b')](function(_0x41e88f){_0x402da6({'code':0xc8,'message':[_0x13c1b0[_0x2f07('0x2b')],_0x41e88f[_0x2f07('0x1c')]['toLowerCase']()][_0x2f07('0x15')]('\x20')});})[_0x2f07('0x1d')](function(_0x16fab3){_0x56e9be(_0x4084d6[_0x2f07('0x11')](0x1f5,[_0x13c1b0['uniqueid'],_0x16fab3[_0x2f07('0x1c')][_0x2f07('0x33')]()][_0x2f07('0x15')]('\x20')));});}else{return _0x56e9be(_0x4084d6[_0x2f07('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x7d22f5){var _0x365298=this;return new Promise(function(_0x939049,_0x28b3c3){if(ami['isConnected']()==![]){return _0x28b3c3(_0x365298[_0x2f07('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x15')]('\x20')));}var _0x5990d5=schema(properties[_0x2f07('0x48')])[_0x2f07('0x29')](_0x7d22f5);if(_0x5990d5['length']>0x0){return _0x28b3c3(_0x365298[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x2a')](_0x5990d5,'message')[_0x2f07('0x15')](',\x20')));}var _0x71df4d=_[_0x2f07('0x24')](_0x1d5a33['queueChannels'],{'uniqueid':_0x7d22f5['uniqueid']});if(_0x71df4d&&_0x71df4d[_0x2f07('0x2c')]){return ami[_0x2f07('0x1a')]({'action':'Redirect','channel':_0x71df4d[_0x2f07('0x2c')],'exten':_0x7d22f5[_0x2f07('0x49')],'context':_0x7d22f5[_0x2f07('0x4a')]||_0x71df4d[_0x2f07('0x4a')],'priority':0x1})[_0x2f07('0x1b')](function(_0x26f986){_0x939049({'code':0xc8,'message':[_0x7d22f5[_0x2f07('0x2b')],_0x26f986[_0x2f07('0x1c')]['toLowerCase']()]['join']('\x20')});})['catch'](function(_0x58e5ee){_0x28b3c3(_0x365298['error'](0x1f5,[_0x7d22f5['uniqueid'],_0x58e5ee['message'][_0x2f07('0x33')]()][_0x2f07('0x15')]('\x20')));});}else{return _0x28b3c3(_0x365298[_0x2f07('0x11')](0x1f5,_0x2f07('0x37')));}});},'Agents':function(_0x49ae15){return new Promise(function(_0x2fb109){var _0xed7e01=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0xe')]);if(_0x49ae15&&_0x49ae15['id']){var _0x5b68f9=_[_0x2f07('0x24')](_0xed7e01,function(_0x3dc5ee){return _0x3dc5ee['id']===_0x49ae15['id'];});_0x2fb109(_0x5b68f9);}else{_0x2fb109({'count':_0xed7e01['length'],'rows':_0xed7e01});}});},'Telephones':function(){return new Promise(function(_0x5cbc28){var _0x5da460=_['values'](_0x1d5a33[_0x2f07('0x4b')]);_0x5cbc28({'count':_0x5da460[_0x2f07('0x23')],'rows':_0x5da460});});},'Trunks':function(){return new Promise(function(_0x127a39){var _0x5db1db=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x4c')]);_0x127a39({'count':_0x5db1db[_0x2f07('0x23')],'rows':_0x5db1db});});},'OutboundChannels':function(){return new Promise(function(_0x455841){var _0x285df7=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x4d')]);_0x455841({'count':_0x285df7[_0x2f07('0x23')],'rows':_0x285df7});});},'Outbound':function(){return new Promise(function(_0x4d8bf0){_0x4d8bf0(_0x1d5a33['outbound']);});},'Campaigns':function(){return new Promise(function(_0x417618){var _0x1ab958=_[_0x2f07('0x3d')](_0x1d5a33[_0x2f07('0x4e')]);_0x417618({'count':_0x1ab958[_0x2f07('0x23')],'rows':_0x1ab958});});},'VoiceQueuesPreview':function(_0x220236){var _0xc4c1c6=this;return new Promise(function(_0x3650d9,_0x1eda37){_0x14d6e6[_0x2f07('0x4f')](_0x220236['id'])[_0x2f07('0x1b')](function(_0x5effb2){_0x3650d9({'code':0xc8,'message':_0x5effb2[_0x2f07('0x1c')]});})[_0x2f07('0x1d')](function(_0x4d738e){_0x1eda37(_0xc4c1c6[_0x2f07('0x11')](0x1f4,_0x4d738e[_0x2f07('0x1c')]));});});},'EventManager':function(_0x5b8f8c){var _0x1cc1f7=this;return new Promise(function(_0x31dd3,_0x212d68){if(!_0x5b8f8c[_0x2f07('0x50')]){return _0x212d68(_0x1cc1f7[_0x2f07('0x11')](0x1f4,_0x2f07('0x51')));}ami['emit'](_0x2f07('0x52')+_0x5b8f8c[_0x2f07('0x50')],_0x5b8f8c['message']);_0x31dd3({'code':0xc8,'message':_0x5b8f8c});});},'FaxAccounts':function(){return new Promise(function(_0xabe7e7){var _0x22c670=_[_0x2f07('0x3d')](_0x1d5a33['faxAccounts']);_0xabe7e7({'count':_0x22c670[_0x2f07('0x23')],'rows':_0x22c670});});},'SendFax':function(_0x4393bd){var _0x4d141f=this;return new Promise(function(_0x31d816,_0x4c182c){_0x3643bb[_0x2f07('0x53')](_0x4393bd)[_0x2f07('0x1b')](function(_0x1a0f5c){_0x31d816({'code':0xc8,'message':_0x1a0f5c[_0x2f07('0x1c')]});})[_0x2f07('0x1d')](function(_0x3a99ce){_0x4c182c(_0x4d141f[_0x2f07('0x11')](0x1f4,_0x3a99ce[_0x2f07('0x1c')]));});});},'CheckAfterSend':function(_0xbdb45c){var _0x4e7f9f=this;return new Promise(function(_0x2443d7,_0x199440){_0x3643bb[_0x2f07('0x54')](_0xbdb45c)[_0x2f07('0x1b')](function(_0x10f5bf){_0x2443d7({'code':0xc8,'message':_0x10f5bf[_0x2f07('0x1c')]});})['catch'](function(_0x52d5c6){_0x199440(_0x4e7f9f[_0x2f07('0x11')](0x1f4,_0x52d5c6[_0x2f07('0x1c')]));});});}};var _0x410a53=jayson[_0x2f07('0x55')](_0xf73d1a)['http']();_0x410a53['on'](_0x2f07('0x11'),function(_0x51db42){return _0x235418(_0x51db42);});_0x410a53[_0x2f07('0x56')](0x232a,'127.0.0.1',function(){console[_0x2f07('0x57')](_0x2f07('0x58'),0x232a);return _0x2e6422(_0x2f07('0x59')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index e50e825..42d72cf 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bca=['','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','trigger:%s','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','data5','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','scheduledAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname'];(function(_0x239a99,_0x2eea66){var _0x5e65dc=function(_0x2f16ff){while(--_0x2f16ff){_0x239a99['push'](_0x239a99['shift']());}};_0x5e65dc(++_0x2eea66);}(_0x2bca,0x19a));var _0xa2bc=function(_0x185f13,_0x3b9556){_0x185f13=_0x185f13-0x0;var _0x1b8f28=_0x2bca[_0x185f13];return _0x1b8f28;};'use strict';var _=require(_0xa2bc('0x0'));var BPromise=require('bluebird');var Redis=require(_0xa2bc('0x1'));var util=require(_0xa2bc('0x2'));var config=require(_0xa2bc('0x3'));var logger=require(_0xa2bc('0x4'))(_0xa2bc('0x5'));var cmContactRpc=require(_0xa2bc('0x6'));config[_0xa2bc('0x7')]=_[_0xa2bc('0x8')](config['redis'],{'host':_0xa2bc('0x9'),'port':0x18eb});var io=require(_0xa2bc('0xa'))(new Redis(config[_0xa2bc('0x7')]));function emit(_0x5e45eb,_0x3d4f4b,_0x410e03,_0x43700c,_0x26f454){logger[_0xa2bc('0xb')](_0xa2bc('0xc'),_0x5e45eb,_0x3d4f4b['id'],_0x410e03,_0x43700c,JSON[_0xa2bc('0xd')](_0x26f454));io['to'](_0x410e03)[_0xa2bc('0xe')](_0x43700c,_0x26f454);}exports['exec']=function(_0x287f09,_0x13ce5a,_0x184c2e,_0xb521f9){var _0x5b58f1,_0x5ba3c9;var _0x468ac4={};var _0x443e9f;var _0x227816=Number(_0x184c2e[_0xa2bc('0xf')]);var _0x42883c=_0x184c2e[_0xa2bc('0x10')]?Boolean(Number(_0x184c2e['data2'])):![];var _0x4bea93;var _0x95a878=![];if(!_['isNil'](_0x184c2e[_0xa2bc('0x11')])){if(_0x184c2e['data5']=='1')_0x95a878=!![];}if(!_0x95a878){if(_0xb521f9['xmd-contactid']){_0x468ac4['id']=_0xb521f9['xmd-contactid'];}}if(!_0x468ac4['id']){_0x468ac4[_0xa2bc('0x12')]=_0x227816;_0x4bea93=_0x184c2e['data3']&&_0x184c2e[_0xa2bc('0x13')]!=='0'?_0x184c2e[_0xa2bc('0x13')][_0xa2bc('0x14')](','):[_0xa2bc('0x15')];_0x468ac4[_0xa2bc('0x16')]=_[_0xa2bc('0x17')](_0x4bea93,function(_0x540ea7){var _0x5cee0f={};_0x5cee0f[_0x540ea7]=_0xb521f9[_0xa2bc('0x18')]?_0xb521f9[_0xa2bc('0x19')]:_0xb521f9[_0xa2bc('0x1a')];return _0x5cee0f;});_0x443e9f=_0xb521f9['routeId']?_0xb521f9[_0xa2bc('0x19')]:_0xb521f9[_0xa2bc('0x1a')];}var _0x13758e=['id',_0xa2bc('0x1b'),_0xa2bc('0x1c'),'phone',_0xa2bc('0x1d'),_0xa2bc('0x1e'),'ListId','createdAt',_0xa2bc('0x1f'),'updatedAt'];var _0x13ed98=_[_0xa2bc('0x20')](_0x13758e,_0x4bea93);BPromise[_0xa2bc('0x21')]()[_0xa2bc('0x22')](cmContactRpc[_0xa2bc('0x23')]({'attributes':_0x13ed98,'where':_0x468ac4,'phone':_0x443e9f}))[_0xa2bc('0x22')](function(_0x3e8ba8){_0x5ba3c9=_0x3e8ba8;if(!_[_0xa2bc('0x24')](_0x5ba3c9)){if(_0x5ba3c9[_0xa2bc('0x25')]===0x1){_0x5b58f1=_0x5ba3c9[0x0];logger[_0xa2bc('0xb')](_0xa2bc('0x26'),_0xb521f9[_0xa2bc('0x27')],_0x13ce5a['id'],_0x5b58f1['id']);}else{logger[_0xa2bc('0xb')](_0xa2bc('0x28'),_0xb521f9[_0xa2bc('0x27')],_0x13ce5a['id'],_['map'](_0x5ba3c9,'id')['join'](','));}return;}else{logger[_0xa2bc('0xb')](_0xa2bc('0x29'),_0xb521f9[_0xa2bc('0x27')],_0x13ce5a['id']);var _0x215ff={'ListId':_0x227816};var _0x2b1b51=_0x184c2e[_0xa2bc('0x2a')]&&_0x184c2e[_0xa2bc('0x2a')]!=='0'?_0x184c2e[_0xa2bc('0x2a')]:'phone';if(_0x42883c){logger[_0xa2bc('0xb')](_0xa2bc('0x2b'),_0xb521f9[_0xa2bc('0x27')],_0x13ce5a['id']);_0x215ff[_0x2b1b51]=_[_0xa2bc('0x2c')](_0xb521f9[_0xa2bc('0x18')])?_0xb521f9[_0xa2bc('0x1a')]:_0xb521f9[_0xa2bc('0x19')];if(_['isNil'](_0xb521f9[_0xa2bc('0x18')])){_0x215ff[_0xa2bc('0x1b')]=_0xb521f9['calleridname']&&_0xb521f9[_0xa2bc('0x2d')]!==_0xa2bc('0x2e')?_0xb521f9[_0xa2bc('0x2d')]:_0xa2bc('0x2f');}else{_0x215ff[_0xa2bc('0x1b')]=_0xb521f9[_0xa2bc('0x30')]&&_0xb521f9['destcalleridname']!==_0xa2bc('0x2e')?_0xb521f9[_0xa2bc('0x30')]:_0xa2bc('0x2f');}return BPromise[_0xa2bc('0x21')]()[_0xa2bc('0x22')](cmContactRpc[_0xa2bc('0x31')](_0x215ff))['then'](function(_0x54e93b){_0x5b58f1=_0x54e93b;_0x5ba3c9[_0xa2bc('0x32')](_0x54e93b);if(_0x5b58f1){logger[_0xa2bc('0xb')](_0xa2bc('0x33'),_0xb521f9[_0xa2bc('0x27')],_0x13ce5a['id'],_0x5b58f1['id']);}return;});}else{logger[_0xa2bc('0xb')](_0xa2bc('0x34'),_0xb521f9['uniqueid'],_0x13ce5a['id']);_0x215ff[_0x2b1b51]=_[_0xa2bc('0x2c')](_0xb521f9[_0xa2bc('0x18')])?_0xb521f9['calleridnum']:_0xb521f9[_0xa2bc('0x19')];if(_['isNil'](_0xb521f9[_0xa2bc('0x18')])){_0x215ff[_0xa2bc('0x1b')]=_0xb521f9['calleridname']&&_0xb521f9[_0xa2bc('0x2d')]!==_0xa2bc('0x2e')?_0xb521f9[_0xa2bc('0x2d')]:_0xa2bc('0x2f');}else{_0x215ff[_0xa2bc('0x1b')]=_0xb521f9['destcalleridname']&&_0xb521f9['destcalleridname']!==_0xa2bc('0x2e')?_0xb521f9[_0xa2bc('0x30')]:'Unknown';}_0x5b58f1=_0x215ff;_0x5ba3c9[_0xa2bc('0x32')](_0x215ff);return;}}})['then'](function(){if(_0x287f09){emit(_0xb521f9[_0xa2bc('0x27')],_0x13ce5a,util['format'](_0xa2bc('0x35'),_0x287f09[_0xa2bc('0x36')]),util['format'](_0xa2bc('0x37'),_0x184c2e['action']['toLowerCase']()),{'evt':_[_0xa2bc('0x38')](_0xb521f9,{'autoCreate':_0x42883c}),'contact':_0x5b58f1===undefined?{}:_0x5b58f1,'contacts':_0x5ba3c9['length']===0x0?undefined:_0x5ba3c9});}});}; \ No newline at end of file +var _0xe76a=['updatedAt','union','resolve','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','destcalleridnum','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','calleridnum','firstName','lastName','phone','mobile','fax','createdAt','scheduledAt'];(function(_0x12c060,_0x61375f){var _0x323568=function(_0x5f31d6){while(--_0x5f31d6){_0x12c060['push'](_0x12c060['shift']());}};_0x323568(++_0x61375f);}(_0xe76a,0x177));var _0xae76=function(_0xa5a54e,_0x43ef3e){_0xa5a54e=_0xa5a54e-0x0;var _0x380532=_0xe76a[_0xa5a54e];return _0x380532;};'use strict';var _=require(_0xae76('0x0'));var BPromise=require(_0xae76('0x1'));var Redis=require('ioredis');var util=require(_0xae76('0x2'));var config=require(_0xae76('0x3'));var logger=require(_0xae76('0x4'))(_0xae76('0x5'));var cmContactRpc=require(_0xae76('0x6'));config[_0xae76('0x7')]=_[_0xae76('0x8')](config[_0xae76('0x7')],{'host':_0xae76('0x9'),'port':0x18eb});var io=require(_0xae76('0xa'))(new Redis(config[_0xae76('0x7')]));function emit(_0x5a5e9d,_0x4a9d4b,_0x3c3886,_0x5cedf1,_0x3734ab){logger['info']('[CM][%s][%s]',_0x5a5e9d,_0x4a9d4b['id'],_0x3c3886,_0x5cedf1,JSON[_0xae76('0xb')](_0x3734ab));io['to'](_0x3c3886)['emit'](_0x5cedf1,_0x3734ab);}exports[_0xae76('0xc')]=function(_0x2b726b,_0x1d451a,_0x764c84,_0x1c86ab){var _0x56aaa7,_0x2cf55d;var _0x962e2b={};var _0x41922a;var _0x448038=Number(_0x764c84[_0xae76('0xd')]);var _0x401de9=_0x764c84[_0xae76('0xe')]?Boolean(Number(_0x764c84[_0xae76('0xe')])):![];var _0x3f1e4a;var _0x1ac322=![];if(!_[_0xae76('0xf')](_0x764c84[_0xae76('0x10')])){if(_0x764c84[_0xae76('0x10')]=='1')_0x1ac322=!![];}if(!_0x1ac322){if(_0x1c86ab[_0xae76('0x11')]){_0x962e2b['id']=_0x1c86ab[_0xae76('0x11')];}}if(!_0x962e2b['id']){_0x962e2b[_0xae76('0x12')]=_0x448038;_0x3f1e4a=_0x764c84['data3']&&_0x764c84['data3']!=='0'?_0x764c84[_0xae76('0x13')][_0xae76('0x14')](','):['phone'];_0x962e2b[_0xae76('0x15')]=_[_0xae76('0x16')](_0x3f1e4a,function(_0x23aed4){var _0x33eaf8={};_0x33eaf8[_0x23aed4]=_0x1c86ab['routeId']?_0x1c86ab['destcalleridnum']:_0x1c86ab[_0xae76('0x17')];return _0x33eaf8;});_0x41922a=_0x1c86ab['routeId']?_0x1c86ab['destcalleridnum']:_0x1c86ab['calleridnum'];}var _0x4f75a0=['id',_0xae76('0x18'),_0xae76('0x19'),_0xae76('0x1a'),_0xae76('0x1b'),_0xae76('0x1c'),_0xae76('0x12'),_0xae76('0x1d'),_0xae76('0x1e'),_0xae76('0x1f')];var _0x319fe8=_[_0xae76('0x20')](_0x4f75a0,_0x3f1e4a);BPromise[_0xae76('0x21')]()[_0xae76('0x22')](cmContactRpc['getContacts']({'attributes':_0x319fe8,'where':_0x962e2b,'phone':_0x41922a}))[_0xae76('0x22')](function(_0x4cb829){_0x2cf55d=_0x4cb829;if(!_[_0xae76('0x23')](_0x2cf55d)){if(_0x2cf55d[_0xae76('0x24')]===0x1){_0x56aaa7=_0x2cf55d[0x0];logger[_0xae76('0x25')](_0xae76('0x26'),_0x1c86ab[_0xae76('0x27')],_0x1d451a['id'],_0x56aaa7['id']);}else{logger[_0xae76('0x25')](_0xae76('0x28'),_0x1c86ab[_0xae76('0x27')],_0x1d451a['id'],_[_0xae76('0x16')](_0x2cf55d,'id')['join'](','));}return;}else{logger[_0xae76('0x25')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1c86ab[_0xae76('0x27')],_0x1d451a['id']);var _0xff99fc={'ListId':_0x448038};var _0x5a836e=_0x764c84[_0xae76('0x29')]&&_0x764c84[_0xae76('0x29')]!=='0'?_0x764c84['data4']:_0xae76('0x1a');if(_0x401de9){logger[_0xae76('0x25')](_0xae76('0x2a'),_0x1c86ab[_0xae76('0x27')],_0x1d451a['id']);_0xff99fc[_0x5a836e]=_[_0xae76('0xf')](_0x1c86ab[_0xae76('0x2b')])?_0x1c86ab[_0xae76('0x17')]:_0x1c86ab[_0xae76('0x2c')];if(_[_0xae76('0xf')](_0x1c86ab['routeId'])){_0xff99fc[_0xae76('0x18')]=_0x1c86ab[_0xae76('0x2d')]&&_0x1c86ab['calleridname']!==''?_0x1c86ab[_0xae76('0x2d')]:_0xae76('0x2e');}else{_0xff99fc['firstName']=_0x1c86ab[_0xae76('0x2f')]&&_0x1c86ab[_0xae76('0x2f')]!==_0xae76('0x30')?_0x1c86ab['destcalleridname']:'Unknown';}return BPromise[_0xae76('0x21')]()['then'](cmContactRpc[_0xae76('0x31')](_0xff99fc))['then'](function(_0x2f6a17){_0x56aaa7=_0x2f6a17;_0x2cf55d[_0xae76('0x32')](_0x2f6a17);if(_0x56aaa7){logger[_0xae76('0x25')](_0xae76('0x33'),_0x1c86ab[_0xae76('0x27')],_0x1d451a['id'],_0x56aaa7['id']);}return;});}else{logger['info'](_0xae76('0x34'),_0x1c86ab[_0xae76('0x27')],_0x1d451a['id']);_0xff99fc[_0x5a836e]=_[_0xae76('0xf')](_0x1c86ab['routeId'])?_0x1c86ab[_0xae76('0x17')]:_0x1c86ab['destcalleridnum'];if(_[_0xae76('0xf')](_0x1c86ab[_0xae76('0x2b')])){_0xff99fc['firstName']=_0x1c86ab[_0xae76('0x2d')]&&_0x1c86ab[_0xae76('0x2d')]!==''?_0x1c86ab['calleridname']:'Unknown';}else{_0xff99fc['firstName']=_0x1c86ab['destcalleridname']&&_0x1c86ab[_0xae76('0x2f')]!==''?_0x1c86ab[_0xae76('0x2f')]:_0xae76('0x2e');}_0x56aaa7=_0xff99fc;_0x2cf55d['push'](_0xff99fc);return;}}})[_0xae76('0x22')](function(){if(_0x2b726b){emit(_0x1c86ab[_0xae76('0x27')],_0x1d451a,util['format'](_0xae76('0x35'),_0x2b726b[_0xae76('0x36')]),util[_0xae76('0x37')](_0xae76('0x38'),_0x764c84[_0xae76('0x39')]['toLowerCase']()),{'evt':_['merge'](_0x1c86ab,{'autoCreate':_0x401de9}),'contact':_0x56aaa7===undefined?{}:_0x56aaa7,'contacts':_0x2cf55d['length']===0x0?undefined:_0x2cf55d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0230961..171eb44 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1702=['operator','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','event','queue','membername','lastevent','mailSubstatus','substatus','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','syncAgentDial','custom:dialconnect','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','winApplication','winArguments','emit','format','user:%s','name','trigger:%s:%s','trigger:%s','exec','integration','routeId','urlforward','script','query','search','replace','channel','AllConditions','length','every','checkConditions','some','AnyConditions','account','chat'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1702,0x114));var _0x2170=function(_0x526b78,_0x8a5c3f){_0x526b78=_0x526b78-0x0;var _0x2fb988=_0x1702[_0x526b78];return _0x2fb988;};'use strict';var util=require(_0x2170('0x0'));var _=require(_0x2170('0x1'));var url=require(_0x2170('0x2'));var Mustache=require(_0x2170('0x3'));var Redis=require(_0x2170('0x4'));var urlforward=require(_0x2170('0x5'));var integration=require(_0x2170('0x6'));var cmContact=require(_0x2170('0x7'));var script=require('./script');var config=require(_0x2170('0x8'));var logger=require(_0x2170('0x9'))(_0x2170('0xa'));var ami=require(_0x2170('0xb'));config[_0x2170('0xc')]=_['defaults'](config[_0x2170('0xc')],{'host':_0x2170('0xd'),'port':0x18eb});var io=require(_0x2170('0xe'))(new Redis(config[_0x2170('0xc')]));var operators={'equals':function(_0x269e03,_0x10df02){return _0x269e03==_0x10df02;},'not_equals':function(_0x5ee74f,_0x40c553){return _0x5ee74f!=_0x40c553;}};var barAndWebActions=['popup','url',_0x2170('0xf')];function Trigger(_0xcfbe29){this[_0x2170('0x10')]=_0xcfbe29[_0x2170('0x10')];this[_0x2170('0x11')]=_0xcfbe29[_0x2170('0x11')];this[_0x2170('0x12')]=_0xcfbe29[_0x2170('0x12')];this[_0x2170('0x13')]=_0xcfbe29['templates'];this[_0x2170('0x14')]=_0xcfbe29[_0x2170('0x14')];this[_0x2170('0x15')]=_0xcfbe29[_0x2170('0x15')];this[_0x2170('0x16')]=_0xcfbe29['freshdeskAccounts'];this[_0x2170('0x17')]=_0xcfbe29['salesforceAccounts'];this[_0x2170('0x18')]=_0xcfbe29['sugarcrmAccounts'];this['zohoAccounts']=_0xcfbe29[_0x2170('0x19')];this[_0x2170('0x1a')]=_0xcfbe29[_0x2170('0x1a')];this[_0x2170('0x1b')]=_0xcfbe29[_0x2170('0x1b')];this[_0x2170('0x1c')]=_0xcfbe29[_0x2170('0x1c')];this[_0x2170('0x1d')]=_0xcfbe29[_0x2170('0x1d')];this[_0x2170('0x1e')]=_0xcfbe29[_0x2170('0x1e')];this[_0x2170('0x1f')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x2170('0x17')],'freshdesk':this[_0x2170('0x16')],'sugarcrm':this[_0x2170('0x18')],'zoho':this[_0x2170('0x19')],'desk':this[_0x2170('0x1a')],'vtiger':this[_0x2170('0x1b')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x2170('0x1e')],'servicenow':this[_0x2170('0x1c')]};ami['on'](_0x2170('0x20'),this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on'](_0x2170('0x23'),this['syncCustomEvent'][_0x2170('0x22')](this));ami['on'](_0x2170('0x24'),this['syncCustomEvent'][_0x2170('0x22')](this));ami['on'](_0x2170('0x25'),this['syncCustomEvent'][_0x2170('0x22')](this));ami['on'](_0x2170('0x26'),this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on']('custom:agentnoanswer',this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on'](_0x2170('0x27'),this[_0x2170('0x21')]['bind'](this));ami['on'](_0x2170('0x28'),this[_0x2170('0x21')]['bind'](this));ami['on'](_0x2170('0x29'),this['syncCustomEvent'][_0x2170('0x22')](this));ami['on']('custom:amd',this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x2170('0x22')](this));ami['on'](_0x2170('0x2a'),this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on']('custom:dialbegin',this[_0x2170('0x2b')][_0x2170('0x22')](this));ami['on'](_0x2170('0x2c'),this[_0x2170('0x2b')][_0x2170('0x22')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0x2170('0x22')](this));ami['on']('custom:newinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0x2170('0x2d'),this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on'](_0x2170('0x2e'),this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on'](_0x2170('0x2f'),this[_0x2170('0x21')]['bind'](this));ami['on'](_0x2170('0x30'),this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on'](_0x2170('0x31'),this[_0x2170('0x21')][_0x2170('0x22')](this));ami['on'](_0x2170('0x32'),this['syncCustomEvent'][_0x2170('0x22')](this));ami['on'](_0x2170('0x33'),this['syncCustomEvent']['bind'](this));}Trigger[_0x2170('0x34')]['emit']=function(_0xc7035c,_0x8d59a2,_0x138e29){logger[_0x2170('0x35')](_0xc7035c,_0x8d59a2,JSON[_0x2170('0x36')](_0x138e29));io['to'](_0xc7035c)['emit'](_0x8d59a2,_0x138e29);};Trigger[_0x2170('0x34')][_0x2170('0x21')]=function(_0x170df4){var _0x23d2bc=_['clone'](_0x170df4);if(typeof _0x23d2bc[_0x2170('0x37')]===_0x2170('0x38')){_0x23d2bc[_0x2170('0x37')]=_0x2170('0x39');}this[_0x2170('0x3a')](_0x23d2bc);};Trigger[_0x2170('0x34')][_0x2170('0x2b')]=function(_0x47ff8d){if(this['agents'][_0x47ff8d[_0x2170('0x3b')]]){this[_0x2170('0x21')](_0x47ff8d);}};Trigger['prototype']['checkTriggers']=function(_0x557fdb){var _0x234b13;for(var _0x5388ac in this[_0x2170('0x10')]){if(this[_0x2170('0x10')][_0x2170('0x3c')](_0x5388ac)){if(this['triggers'][_0x5388ac][_0x2170('0x3d')]){_0x234b13=this[_0x2170('0x3e')](this[_0x2170('0x10')][_0x5388ac],_0x557fdb);if(_0x234b13){_[_0x2170('0x3f')](_0x557fdb,_0x557fdb[_0x2170('0x40')]);for(var _0x2d807d=0x0,_0x37e774,_0x492425,_0x18c7d3;_0x2d807d0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x39214b,_0x5d0e5c){var _0x388a9d=function(_0x2a7255){while(--_0x2a7255){_0x39214b['push'](_0x39214b['shift']());}};_0x388a9d(++_0x5d0e5c);}(_0x55ca,0x126));var _0xa55c=function(_0xcc2c66,_0x27cf7b){_0xcc2c66=_0xcc2c66-0x0;var _0x2197b2=_0x55ca[_0xcc2c66];return _0x2197b2;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 5f227da..335d367 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18a5=['Subjects','getString','Descriptions','/contacts(','Fields','phonecall','/systemusers(','callDirection','queue','phonecalls','calleridnum','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','CloudProvider','data7','tenantId','data2','resolve','clientId','remoteUri','password','clientSecret','then','catch','error',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','isNil','email','length','internalemailaddress','isdisabled','info','toUpperCase','systemuserid','userEmail','username','userId','toLowerCase','outbound','POST','contacts','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','&$filter=','replace','%2b','value','nothing',']\x20Enduser\x20created!','includes','string','type','indexOf','content','ticketType','incident','incidents','assign'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x18a5,0xf0));var _0x518a=function(_0x4a667b,_0x2c0f30){_0x4a667b=_0x4a667b-0x0;var _0x103077=_0x18a5[_0x4a667b];return _0x103077;};'use strict';var _=require('lodash');var rp=require(_0x518a('0x0'));var util=require('util');var intUtil=require(_0x518a('0x1'));var md5=require(_0x518a('0x2'));var Redis=require(_0x518a('0x3'));var logger=require(_0x518a('0x4'))(_0x518a('0x5'));var config=require(_0x518a('0x6'));config[_0x518a('0x7')]=_[_0x518a('0x8')](config[_0x518a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x518a('0x9'))(new Redis(config[_0x518a('0x7')]));function getAuthToken(_0x3d71f1,_0x1366bd,_0x47a2c1){if(_0x3d71f1['modernAuthentication']){_0x3d71f1['remoteUri']=_0x3d71f1[_0x518a('0xa')][_0x518a('0xb')];_0x3d71f1[_0x518a('0xc')]=_0x3d71f1[_0x518a('0xa')][_0x518a('0xd')];return Promise[_0x518a('0xe')](_0x3d71f1[_0x518a('0xa')]['data5']);}var _0x44cc6a={'method':'POST','uri':_0x1366bd,'form':{'client_id':_0x3d71f1[_0x518a('0xf')],'resource':_0x3d71f1[_0x518a('0x10')],'username':_0x3d71f1['username'],'password':_0x3d71f1[_0x518a('0x11')],'grant_type':'password','client_secret':_0x3d71f1[_0x518a('0x12')]},'json':!![]};return rp(_0x44cc6a)[_0x518a('0x13')](function(_0x2f3a8f){return _0x2f3a8f['access_token'];})[_0x518a('0x14')](function(_0x15a976){logger[_0x518a('0x15')]('['+[_0x47a2c1['toUpperCase']()]+_0x518a('0x16'));return _0x15a976[_0x518a('0x17')];});}function getUser(_0x18942d,_0x583d98,_0x54cf0b,_0x4b9cb9,_0x418e43,_0x46e5bc){return new Promise(function(_0x4ba002,_0x1a24e7){return getAuthToken(_0x583d98,_0x4b9cb9,_0x46e5bc)['then'](function(_0x330e05){var _0x50f35e={'method':_0x518a('0x18'),'uri':_0x418e43+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x518a('0x19')+_0x330e05,'OData-Version':_0x518a('0x1a')},'json':!![]};return rp(_0x50f35e);})[_0x518a('0x13')](function(_0xc60843){var _0x580ea9=_0xc60843['value'];var _0x419667=![];var _0xddebe=null;if(!_[_0x518a('0x1b')](_0x54cf0b)){if(intUtil['validateEmail'](_0x54cf0b['email'])){_0x18942d['userEmail']=_0x54cf0b[_0x518a('0x1c')];for(_0xddebe=0x0;_0xddebe<_0x580ea9[_0x518a('0x1d')];_0xddebe++){if(_0x580ea9[_0xddebe][_0x518a('0x1e')]===_0x54cf0b['email']&&!_0x580ea9[_0xddebe][_0x518a('0x1f')]){_0x419667=!![];logger[_0x518a('0x20')]('['+[_0x46e5bc[_0x518a('0x21')]()]+']\x20Agent\x20found\x20'+_0x580ea9[_0xddebe][_0x518a('0x22')]+'!');_0x18942d['userId']=_0x580ea9[_0xddebe][_0x518a('0x22')];}}}}if(!_0x419667){logger[_0x518a('0x20')]('['+[_0x46e5bc['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x18942d[_0x518a('0x23')]=_0x583d98[_0x518a('0x24')];for(_0xddebe=0x0;_0xddebe<_0x580ea9[_0x518a('0x1d')];_0xddebe++){if(_0x580ea9[_0xddebe][_0x518a('0x1e')]===_0x583d98['username']){_0x18942d[_0x518a('0x25')]=_0x580ea9[_0xddebe][_0x518a('0x22')];}}}_0x4ba002(_0x18942d);})[_0x518a('0x14')](function(_0x22a95d){_0x1a24e7(_0x22a95d[_0x518a('0x17')]);});});}function createEndUser(_0x251e33,_0x3e92ed,_0x2d1608,_0x4ec817,_0x2fb301,_0x51904c,_0x3114d1){return new Promise(function(_0x5c6870,_0x47b728){return getAuthToken(_0x3e92ed,_0x2d1608,_0x51904c)[_0x518a('0x13')](function(_0x1cc14f){var _0x5ab2b2=_0x51904c[_0x518a('0x26')]()===_0x518a('0x27')?_0x2fb301['destcalleridnum']:_0x2fb301['calleridnum'];var _0xf99190={'method':_0x518a('0x28'),'uri':_0x4ec817+_0x518a('0x29'),'body':{'fullname':_0x5ab2b2,'firstname':_0x5ab2b2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x251e33[_0x518a('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x1cc14f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0xf99190[_0x518a('0x2a')][_0x3114d1]=_0x5ab2b2;return rp(_0xf99190);})[_0x518a('0x13')](function(_0x5083b2){var _0x3e4e3e=_0x5083b2[_0x518a('0x2b')][_0x518a('0x2c')];var _0x184553=_0x3e4e3e[_0x518a('0x2d')](_0x3e4e3e['lastIndexOf']('(')+0x1,_0x3e4e3e[_0x518a('0x2e')](')'));_0x251e33[_0x518a('0x2f')]=_0x184553;_0x5c6870(_0x251e33);})['catch'](function(_0x434a69){_0x47b728(_0x434a69[_0x518a('0x17')]);});});}function getEndUser(_0x3cf3ad,_0x21195f,_0x219fcb,_0x4b936f,_0x6af055,_0x3f766f,_0x38c3d2,_0x408224){var _0x14b56b=_0x3f766f[_0x518a('0x26')]()==='outbound'?_0x6af055[_0x518a('0x30')]:_0x6af055['calleridnum'];return getAuthToken(_0x21195f,_0x219fcb,_0x3f766f)[_0x518a('0x13')](function(_0x230a98){_0x408224=_0x408224?_0x408224:_0x518a('0x31');var _0x55a726={'method':_0x518a('0x18'),'uri':_0x4b936f+_0x518a('0x32')+_0x408224+_0x518a('0x33')+_0x408224+'\x20eq\x20\x27'+_0x14b56b[_0x518a('0x34')]('+',_0x518a('0x35'))+'\x27','headers':{'Authorization':_0x518a('0x19')+_0x230a98,'If-None-Match':null,'OData-Version':_0x518a('0x1a')},'json':!![]};return rp(_0x55a726);})[_0x518a('0x13')](function(_0x53f0c0){var _0x28ea3f=![];if(!_0x53f0c0)return _0x28ea3f;var _0x2f9c69=_0x53f0c0[_0x518a('0x36')];for(var _0x133ad1=0x0;_0x133ad1<_0x2f9c69['length'];_0x133ad1++){if(_0x2f9c69[_0x133ad1][_0x408224]===_0x14b56b){_0x28ea3f=!![];_0x3cf3ad[_0x518a('0x2f')]=_0x2f9c69[_0x133ad1]['contactid'];}}return _0x28ea3f;})[_0x518a('0x13')](function(_0x2043a0){if(_0x2043a0)return _0x3cf3ad;if(_0x38c3d2===_0x518a('0x37')){logger[_0x518a('0x20')]('['+[_0x3f766f[_0x518a('0x21')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x3cf3ad;}return createEndUser(_0x3cf3ad,_0x21195f,_0x219fcb,_0x4b936f,_0x6af055,_0x3f766f,_0x408224)['then'](function(_0x58d2ea){logger['info']('['+[_0x3f766f[_0x518a('0x21')]()]+_0x518a('0x38'),_0x58d2ea[_0x518a('0x2f')]);return _0x58d2ea;});});}function getCustomFields(_0x1f4297,_0x253645,_0xf62d78){var _0x4f4f75={};if(_0x1f4297[_0x518a('0x1d')]>0x0){_['forEach'](_0x1f4297,function(_0x381fd2){if(_[_0x518a('0x39')]([_0x518a('0x3a'),'picklist'],_0x381fd2[_0x518a('0x3b')])&&_0x381fd2['nameField']&&!_0x381fd2['customField']){var _0x3ae0a0=_0x381fd2['idField'][_0x518a('0x26')]();var _0x18ec9a=_0x3ae0a0[_0x518a('0x2d')](0x0,_0x3ae0a0[_0x518a('0x3c')]('_'));var _0x26c3d7=_0x3ae0a0[_0x518a('0x2d')](_0x3ae0a0[_0x518a('0x3c')]('_')+0x1);if(_0x18ec9a===_0xf62d78){_0x4f4f75[_0x26c3d7]=_0x381fd2[_0x518a('0x3d')];}}});}return _0x4f4f75;}function getTicket(_0x17a1d1,_0x25fbb4,_0x14b6d3,_0x34bc12,_0x146106,_0x4d339d,_0x35791a){return new Promise(function(_0x218ecc,_0x4e3d85){var _0x41d770;return getAuthToken(_0x25fbb4,_0x14b6d3,_0x35791a)[_0x518a('0x13')](function(_0x365946){if(_0x4d339d[_0x518a('0x3e')]===_0x518a('0x3f')){_0x41d770={'method':_0x518a('0x28'),'uri':_0x34bc12+_0x518a('0x40'),'body':Object[_0x518a('0x41')]({},{'title':intUtil['getString'](_0x4d339d[_0x518a('0x42')],_0x146106,'\x20'),'description':intUtil[_0x518a('0x43')](_0x4d339d[_0x518a('0x44')],_0x146106,'\x0a'),'customerid_contact@odata.bind':_0x17a1d1[_0x518a('0x2f')]?_0x518a('0x45')+_0x17a1d1[_0x518a('0x2f')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x17a1d1[_0x518a('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x4d339d[_0x518a('0x46')],_0x146106,_0x4d339d['ticketType'])),'headers':{'Authorization':_0x518a('0x19')+_0x365946,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4d339d['ticketType']===_0x518a('0x47')){var _0x25a5f0=_0x17a1d1[_0x518a('0x2f')]?[{'partyid_systemuser@odata.bind':_0x518a('0x48')+_0x17a1d1[_0x518a('0x25')]+')','participationtypemask':_0x17a1d1[_0x518a('0x49')]===_0x518a('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x17a1d1[_0x518a('0x2f')]+')','participationtypemask':_0x17a1d1[_0x518a('0x49')]===_0x518a('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x518a('0x48')+_0x17a1d1['userId']+')','participationtypemask':_0x17a1d1[_0x518a('0x49')]===_0x518a('0x4a')?0x2:0x1}];_0x41d770={'method':_0x518a('0x28'),'uri':_0x34bc12+_0x518a('0x4b'),'body':Object[_0x518a('0x41')]({},{'subject':intUtil['getString'](_0x4d339d[_0x518a('0x42')],_0x146106,'\x20'),'phonenumber':String(_0x146106[_0x518a('0x4c')]),'description':intUtil[_0x518a('0x43')](_0x4d339d[_0x518a('0x44')],_0x146106,'\x0a'),'regardingobjectid_contact@odata.bind':_0x17a1d1['enduserId']?_0x518a('0x45')+_0x17a1d1[_0x518a('0x2f')]+')':undefined,'ownerid@odata.bind':_0x518a('0x48')+_0x17a1d1[_0x518a('0x25')]+')','directioncode':_0x17a1d1['callDirection']===_0x518a('0x4a')?![]:!![],'phonecall_activity_parties':_0x25a5f0},getCustomFields(_0x4d339d[_0x518a('0x46')],_0x146106,_0x4d339d['ticketType'])),'headers':{'Authorization':_0x518a('0x19')+_0x365946,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x41d770);})[_0x518a('0x13')](function(_0x3d90b6){var _0x11d577=_0x3d90b6[_0x518a('0x2b')]['odata-entityid'];var _0x13bd62=_0x11d577[_0x518a('0x2d')](_0x11d577[_0x518a('0x2e')]('(')+0x1,_0x11d577[_0x518a('0x2e')](')'));_0x17a1d1[_0x518a('0x4d')]=_0x13bd62;_0x218ecc(_0x17a1d1);})[_0x518a('0x14')](function(_0x19e82c){_0x4e3d85(_0x19e82c['message']);});});}function emit(_0xbbec30,_0x378453,_0x5f2e04,_0x4246a2){var _0x4829ab={'uri':util[_0x518a('0x4e')](_0x518a('0x4f'),_0xbbec30,_0x5f2e04,_0x4246a2)};io['to'](util[_0x518a('0x4e')](_0x518a('0x50'),_0x378453))['emit']('trigger:browser:url',_0x4829ab);}exports['cs']=function(_0xdd7796,_0x5615de,_0x2c07b6,_0x20d698,_0x37b246,_0x214b01,_0x1b251d,_0xdd12ce){var _0x246855={};_0x214b01[_0x518a('0x10')]=_0x214b01[_0x518a('0x51')]?intUtil[_0x518a('0x52')](_0x214b01[_0x518a('0xa')][_0x518a('0xb')]):intUtil[_0x518a('0x52')](_0x214b01[_0x518a('0x10')]);_0x214b01[_0x518a('0x53')]=intUtil[_0x518a('0x52')](_0x214b01[_0x518a('0x53')]);_0x246855[_0x518a('0x49')]=_0xdd12ce==='queue'||_0xdd12ce===_0x518a('0x54')?_0x518a('0x4a'):'outbound';var _0x346022=_0x214b01[_0x518a('0x51')]?util[_0x518a('0x4e')]('%s/api/data/v9.0/',_0x214b01[_0x518a('0xa')]['data7']):util[_0x518a('0x4e')](_0x518a('0x55'),_0x214b01[_0x518a('0x10')]);var _0x2f888f=util[_0x518a('0x4e')](_0x518a('0x56'),_0x214b01[_0x518a('0xc')]);var _0x243cf9=util['format'](_0x518a('0x57'),_0x214b01['serverUrl'],_0x5615de[_0x518a('0x58')],md5(_0x5615de[_0x518a('0x58')]));if(_0x37b246&&_0x37b246[_0x518a('0x59')]){logger[_0x518a('0x20')]('[QUEUE]',_0x518a('0x5a'));_0x5615de[_0x518a('0x5b')]=_0x243cf9;}else if(_0x1b251d&&_0x1b251d['recordingFormat']&&_0x1b251d[_0x518a('0x5c')]!==_0x518a('0x5d')){logger[_0x518a('0x20')](_0x518a('0x5e'),_0x518a('0x5a'));_0x5615de['recordingURL']=_0x243cf9;}else{_0x5615de['recordingURL']='';}return getUser(_0x246855,_0x214b01,_0x20d698,_0x2f888f,_0x346022,_0xdd12ce)[_0x518a('0x13')](function(_0x4a3574){logger[_0x518a('0x20')]('['+_0xdd12ce['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x4a3574[_0x518a('0x25')]);logger[_0x518a('0x20')]('['+_0xdd12ce[_0x518a('0x21')]()+_0x518a('0x5f'),_0x4a3574[_0x518a('0x23')]);return getEndUser(_0x4a3574,_0x214b01,_0x2f888f,_0x346022,_0x5615de,_0xdd12ce,_0x2c07b6['moduleCreate'],_0x2c07b6[_0x518a('0x60')]);})[_0x518a('0x13')](function(_0x1f0a97){logger[_0x518a('0x20')]('['+_0xdd12ce['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x1f0a97[_0x518a('0x2f')]);logger[_0x518a('0x20')]('['+_0xdd12ce[_0x518a('0x21')]()+_0x518a('0x61'),_0x5615de[_0x518a('0x4c')]);return getTicket(_0x1f0a97,_0x214b01,_0x2f888f,_0x346022,_0x5615de,_0x2c07b6,_0xdd12ce);})[_0x518a('0x13')](function(_0x1bd6e0){logger['info'](util[_0x518a('0x4e')]('['+_0xdd12ce[_0x518a('0x21')]()+_0x518a('0x62'),_0x2c07b6[_0x518a('0x3e')],_0x1bd6e0[_0x518a('0x4d')]));logger[_0x518a('0x20')](util[_0x518a('0x4e')]('['+_0xdd12ce['toUpperCase']()+_0x518a('0x63'),_0xdd12ce));if(_0xdd12ce!==_0x518a('0x54')&&_0x2c07b6['openNewTab']){logger[_0x518a('0x20')]('['+_0xdd12ce[_0x518a('0x21')]()+']',_0x518a('0x64'));emit(_0x214b01['remoteUri'],_0x20d698[_0x518a('0x65')],_0x2c07b6[_0x518a('0x3e')],_0x1bd6e0[_0x518a('0x4d')]);}})[_0x518a('0x14')](function(_0x1d4e12){logger[_0x518a('0x15')]('['+_0xdd12ce[_0x518a('0x21')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x1d4e12[_0x518a('0x17')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x1d4e12);});}; \ No newline at end of file +var _0xbdf5=['%2b','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','picklist','type','nameField','customField','idField','toLowerCase','substring','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','/systemusers(','Fields','callDirection','queue','phonecalls','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','data7','stripTrailingSlash','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','clientId','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','email','userEmail','info',']\x20Agent\x20found\x20','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','destcalleridnum','POST','contacts','userId','Bearer\x20','body','headers','odata-entityid','lastIndexOf','enduserId','outbound','calleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace'];(function(_0x30cfcc,_0x340db8){var _0x28691f=function(_0x5ae6d0){while(--_0x5ae6d0){_0x30cfcc['push'](_0x30cfcc['shift']());}};_0x28691f(++_0x340db8);}(_0xbdf5,0x176));var _0x5bdf=function(_0xf444de,_0x45625b){_0xf444de=_0xf444de-0x0;var _0xc6da50=_0xbdf5[_0xf444de];return _0xc6da50;};'use strict';var _=require(_0x5bdf('0x0'));var rp=require(_0x5bdf('0x1'));var util=require(_0x5bdf('0x2'));var intUtil=require('./util');var md5=require(_0x5bdf('0x3'));var Redis=require(_0x5bdf('0x4'));var logger=require(_0x5bdf('0x5'))(_0x5bdf('0x6'));var config=require('../../../../config/environment');config[_0x5bdf('0x7')]=_['defaults'](config[_0x5bdf('0x7')],{'host':_0x5bdf('0x8'),'port':0x18eb});var io=require(_0x5bdf('0x9'))(new Redis(config[_0x5bdf('0x7')]));function getAuthToken(_0x5039a2,_0x41e09b,_0x479c07){if(_0x5039a2[_0x5bdf('0xa')]){_0x5039a2[_0x5bdf('0xb')]=_0x5039a2[_0x5bdf('0xc')]['data7'];_0x5039a2[_0x5bdf('0xd')]=_0x5039a2[_0x5bdf('0xc')][_0x5bdf('0xe')];return Promise[_0x5bdf('0xf')](_0x5039a2[_0x5bdf('0xc')]['data5']);}var _0x4fab3e={'method':'POST','uri':_0x41e09b,'form':{'client_id':_0x5039a2[_0x5bdf('0x10')],'resource':_0x5039a2['remoteUri'],'username':_0x5039a2[_0x5bdf('0x11')],'password':_0x5039a2[_0x5bdf('0x12')],'grant_type':_0x5bdf('0x12'),'client_secret':_0x5039a2[_0x5bdf('0x13')]},'json':!![]};return rp(_0x4fab3e)[_0x5bdf('0x14')](function(_0x8a558b){return _0x8a558b[_0x5bdf('0x15')];})[_0x5bdf('0x16')](function(_0x3a73dc){logger[_0x5bdf('0x17')]('['+[_0x479c07['toUpperCase']()]+_0x5bdf('0x18'));return _0x3a73dc[_0x5bdf('0x19')];});}function getUser(_0x1d4cfd,_0x28bdd1,_0xe43df5,_0x34626d,_0x25e108,_0x12a6a3){return new Promise(function(_0x524a30,_0x5a8c39){return getAuthToken(_0x28bdd1,_0x34626d,_0x12a6a3)[_0x5bdf('0x14')](function(_0x2016a9){var _0x11175f={'method':_0x5bdf('0x1a'),'uri':_0x25e108+_0x5bdf('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x2016a9,'OData-Version':_0x5bdf('0x1c')},'json':!![]};return rp(_0x11175f);})[_0x5bdf('0x14')](function(_0x3e2430){var _0x447574=_0x3e2430['value'];var _0x1a38cf=![];var _0x1332e3=null;if(!_[_0x5bdf('0x1d')](_0xe43df5)){if(intUtil['validateEmail'](_0xe43df5[_0x5bdf('0x1e')])){_0x1d4cfd[_0x5bdf('0x1f')]=_0xe43df5[_0x5bdf('0x1e')];for(_0x1332e3=0x0;_0x1332e3<_0x447574['length'];_0x1332e3++){if(_0x447574[_0x1332e3]['internalemailaddress']===_0xe43df5['email']&&!_0x447574[_0x1332e3]['isdisabled']){_0x1a38cf=!![];logger[_0x5bdf('0x20')]('['+[_0x12a6a3['toUpperCase']()]+_0x5bdf('0x21')+_0x447574[_0x1332e3][_0x5bdf('0x22')]+'!');_0x1d4cfd['userId']=_0x447574[_0x1332e3][_0x5bdf('0x22')];}}}}if(!_0x1a38cf){logger['info']('['+[_0x12a6a3[_0x5bdf('0x23')]()]+_0x5bdf('0x24'));_0x1d4cfd[_0x5bdf('0x1f')]=_0x28bdd1[_0x5bdf('0x11')];for(_0x1332e3=0x0;_0x1332e3<_0x447574[_0x5bdf('0x25')];_0x1332e3++){if(_0x447574[_0x1332e3]['internalemailaddress']===_0x28bdd1[_0x5bdf('0x11')]){_0x1d4cfd['userId']=_0x447574[_0x1332e3]['systemuserid'];}}}_0x524a30(_0x1d4cfd);})[_0x5bdf('0x16')](function(_0x5818c5){_0x5a8c39(_0x5818c5[_0x5bdf('0x19')]);});});}function createEndUser(_0x41809a,_0x532713,_0x244a99,_0x3f0363,_0x346014,_0x2d8df9,_0xb0b51c){return new Promise(function(_0x24c0fb,_0x5f46f2){return getAuthToken(_0x532713,_0x244a99,_0x2d8df9)[_0x5bdf('0x14')](function(_0x5b6f76){var _0x598df3=_0x2d8df9['toLowerCase']()==='outbound'?_0x346014[_0x5bdf('0x26')]:_0x346014['calleridnum'];var _0x22d591={'method':_0x5bdf('0x27'),'uri':_0x3f0363+_0x5bdf('0x28'),'body':{'fullname':_0x598df3,'firstname':_0x598df3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x41809a[_0x5bdf('0x29')]+')'},'headers':{'Authorization':_0x5bdf('0x2a')+_0x5b6f76,'OData-Version':_0x5bdf('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x22d591[_0x5bdf('0x2b')][_0xb0b51c]=_0x598df3;return rp(_0x22d591);})[_0x5bdf('0x14')](function(_0x3ba515){var _0x2e4fe0=_0x3ba515[_0x5bdf('0x2c')][_0x5bdf('0x2d')];var _0x92606d=_0x2e4fe0['substring'](_0x2e4fe0[_0x5bdf('0x2e')]('(')+0x1,_0x2e4fe0[_0x5bdf('0x2e')](')'));_0x41809a[_0x5bdf('0x2f')]=_0x92606d;_0x24c0fb(_0x41809a);})[_0x5bdf('0x16')](function(_0x2cde2c){_0x5f46f2(_0x2cde2c[_0x5bdf('0x19')]);});});}function getEndUser(_0x4bd6d3,_0x64ebea,_0x1a4b33,_0x21909c,_0xfe43d3,_0x12665e,_0x2d9cc9,_0x242d08){var _0x40e0b3=_0x12665e['toLowerCase']()===_0x5bdf('0x30')?_0xfe43d3[_0x5bdf('0x26')]:_0xfe43d3[_0x5bdf('0x31')];return getAuthToken(_0x64ebea,_0x1a4b33,_0x12665e)[_0x5bdf('0x14')](function(_0x2d5ebf){_0x242d08=_0x242d08?_0x242d08:_0x5bdf('0x32');var _0xab3703={'method':_0x5bdf('0x1a'),'uri':_0x21909c+_0x5bdf('0x33')+_0x242d08+'&$filter='+_0x242d08+_0x5bdf('0x34')+_0x40e0b3[_0x5bdf('0x35')]('+',_0x5bdf('0x36'))+'\x27','headers':{'Authorization':_0x5bdf('0x2a')+_0x2d5ebf,'If-None-Match':null,'OData-Version':_0x5bdf('0x1c')},'json':!![]};return rp(_0xab3703);})[_0x5bdf('0x14')](function(_0x193dfd){var _0x14b04e=![];if(!_0x193dfd)return _0x14b04e;var _0x920f9d=_0x193dfd[_0x5bdf('0x37')];for(var _0x170c25=0x0;_0x170c25<_0x920f9d[_0x5bdf('0x25')];_0x170c25++){if(_0x920f9d[_0x170c25][_0x242d08]===_0x40e0b3){_0x14b04e=!![];_0x4bd6d3[_0x5bdf('0x2f')]=_0x920f9d[_0x170c25][_0x5bdf('0x38')];}}return _0x14b04e;})[_0x5bdf('0x14')](function(_0x27deae){if(_0x27deae)return _0x4bd6d3;if(_0x2d9cc9===_0x5bdf('0x39')){logger[_0x5bdf('0x20')]('['+[_0x12665e[_0x5bdf('0x23')]()]+_0x5bdf('0x3a'));return _0x4bd6d3;}return createEndUser(_0x4bd6d3,_0x64ebea,_0x1a4b33,_0x21909c,_0xfe43d3,_0x12665e,_0x242d08)['then'](function(_0x4cb279){logger[_0x5bdf('0x20')]('['+[_0x12665e['toUpperCase']()]+_0x5bdf('0x3b'),_0x4cb279[_0x5bdf('0x2f')]);return _0x4cb279;});});}function getCustomFields(_0x1404de,_0x21c97b,_0x492398){var _0x54b196={};if(_0x1404de[_0x5bdf('0x25')]>0x0){_['forEach'](_0x1404de,function(_0x17e6ff){if(_[_0x5bdf('0x3c')](['string',_0x5bdf('0x3d')],_0x17e6ff[_0x5bdf('0x3e')])&&_0x17e6ff[_0x5bdf('0x3f')]&&!_0x17e6ff[_0x5bdf('0x40')]){var _0x4f4b77=_0x17e6ff[_0x5bdf('0x41')][_0x5bdf('0x42')]();var _0x4b0cd6=_0x4f4b77[_0x5bdf('0x43')](0x0,_0x4f4b77['indexOf']('_'));var _0x30c9df=_0x4f4b77[_0x5bdf('0x43')](_0x4f4b77['indexOf']('_')+0x1);if(_0x4b0cd6===_0x492398){_0x54b196[_0x30c9df]=_0x17e6ff[_0x5bdf('0x44')];}}});}return _0x54b196;}function getTicket(_0x20ce96,_0x533ed4,_0x234a60,_0x3e851c,_0x2ed4fb,_0x517868,_0x5e471b){return new Promise(function(_0x3750ce,_0x5df899){var _0xb2a02;return getAuthToken(_0x533ed4,_0x234a60,_0x5e471b)[_0x5bdf('0x14')](function(_0xfa1a89){if(_0x517868[_0x5bdf('0x45')]===_0x5bdf('0x46')){_0xb2a02={'method':'POST','uri':_0x3e851c+_0x5bdf('0x47'),'body':Object[_0x5bdf('0x48')]({},{'title':intUtil['getString'](_0x517868[_0x5bdf('0x49')],_0x2ed4fb,'\x20'),'description':intUtil[_0x5bdf('0x4a')](_0x517868[_0x5bdf('0x4b')],_0x2ed4fb,'\x0a'),'customerid_contact@odata.bind':_0x20ce96[_0x5bdf('0x2f')]?_0x5bdf('0x4c')+_0x20ce96[_0x5bdf('0x2f')]+')':undefined,'ownerid@odata.bind':_0x5bdf('0x4d')+_0x20ce96['userId']+')','caseorigincode':'1'},getCustomFields(_0x517868[_0x5bdf('0x4e')],_0x2ed4fb,_0x517868['ticketType'])),'headers':{'Authorization':_0x5bdf('0x2a')+_0xfa1a89,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x517868[_0x5bdf('0x45')]==='phonecall'){var _0x5a9ad5=_0x20ce96['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x20ce96['userId']+')','participationtypemask':_0x20ce96[_0x5bdf('0x4f')]===_0x5bdf('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x5bdf('0x4c')+_0x20ce96['enduserId']+')','participationtypemask':_0x20ce96[_0x5bdf('0x4f')]===_0x5bdf('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5bdf('0x4d')+_0x20ce96[_0x5bdf('0x29')]+')','participationtypemask':_0x20ce96[_0x5bdf('0x4f')]===_0x5bdf('0x50')?0x2:0x1}];_0xb2a02={'method':_0x5bdf('0x27'),'uri':_0x3e851c+_0x5bdf('0x51'),'body':Object[_0x5bdf('0x48')]({},{'subject':intUtil[_0x5bdf('0x4a')](_0x517868['Subjects'],_0x2ed4fb,'\x20'),'phonenumber':String(_0x2ed4fb[_0x5bdf('0x31')]),'description':intUtil[_0x5bdf('0x4a')](_0x517868[_0x5bdf('0x4b')],_0x2ed4fb,'\x0a'),'regardingobjectid_contact@odata.bind':_0x20ce96[_0x5bdf('0x2f')]?_0x5bdf('0x4c')+_0x20ce96['enduserId']+')':undefined,'ownerid@odata.bind':_0x5bdf('0x4d')+_0x20ce96[_0x5bdf('0x29')]+')','directioncode':_0x20ce96[_0x5bdf('0x4f')]===_0x5bdf('0x50')?![]:!![],'phonecall_activity_parties':_0x5a9ad5},getCustomFields(_0x517868[_0x5bdf('0x4e')],_0x2ed4fb,_0x517868[_0x5bdf('0x45')])),'headers':{'Authorization':_0x5bdf('0x2a')+_0xfa1a89,'OData-Version':_0x5bdf('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xb2a02);})[_0x5bdf('0x14')](function(_0x1e4402){var _0x20b856=_0x1e4402[_0x5bdf('0x2c')][_0x5bdf('0x2d')];var _0x13884f=_0x20b856['substring'](_0x20b856[_0x5bdf('0x2e')]('(')+0x1,_0x20b856[_0x5bdf('0x2e')](')'));_0x20ce96[_0x5bdf('0x52')]=_0x13884f;_0x3750ce(_0x20ce96);})[_0x5bdf('0x16')](function(_0x5818e9){_0x5df899(_0x5818e9[_0x5bdf('0x19')]);});});}function emit(_0x9d3787,_0x20af6b,_0x2366e6,_0xec9a93){var _0x7c956c={'uri':util['format'](_0x5bdf('0x53'),_0x9d3787,_0x2366e6,_0xec9a93)};io['to'](util['format'](_0x5bdf('0x54'),_0x20af6b))['emit'](_0x5bdf('0x55'),_0x7c956c);}exports['cs']=function(_0x31bf86,_0x45bdee,_0x3961aa,_0x473f68,_0x539d9e,_0xbe0065,_0x5707d1,_0x5c24d6){var _0x32caa4={};_0xbe0065[_0x5bdf('0xb')]=_0xbe0065[_0x5bdf('0xa')]?intUtil['stripTrailingSlash'](_0xbe0065[_0x5bdf('0xc')][_0x5bdf('0x56')]):intUtil[_0x5bdf('0x57')](_0xbe0065[_0x5bdf('0xb')]);_0xbe0065['serverUrl']=intUtil[_0x5bdf('0x57')](_0xbe0065['serverUrl']);_0x32caa4['callDirection']=_0x5c24d6===_0x5bdf('0x50')||_0x5c24d6===_0x5bdf('0x58')?_0x5bdf('0x50'):_0x5bdf('0x30');var _0x242fcc=_0xbe0065['modernAuthentication']?util[_0x5bdf('0x59')](_0x5bdf('0x5a'),_0xbe0065[_0x5bdf('0xc')][_0x5bdf('0x56')]):util['format']('%s/api/data/v9.0/',_0xbe0065[_0x5bdf('0xb')]);var _0x2e52e6=util[_0x5bdf('0x59')](_0x5bdf('0x5b'),_0xbe0065['tenantId']);var _0x1bcc75=util[_0x5bdf('0x59')](_0x5bdf('0x5c'),_0xbe0065[_0x5bdf('0x5d')],_0x45bdee[_0x5bdf('0x5e')],md5(_0x45bdee['uniqueid']));if(_0x539d9e&&_0x539d9e['monitor_format']){logger[_0x5bdf('0x20')]('[QUEUE]',_0x5bdf('0x5f'));_0x45bdee[_0x5bdf('0x60')]=_0x1bcc75;}else if(_0x5707d1&&_0x5707d1[_0x5bdf('0x61')]&&_0x5707d1['recordingFormat']!==_0x5bdf('0x62')){logger[_0x5bdf('0x20')](_0x5bdf('0x63'),_0x5bdf('0x5f'));_0x45bdee[_0x5bdf('0x60')]=_0x1bcc75;}else{_0x45bdee['recordingURL']='';}return getUser(_0x32caa4,_0xbe0065,_0x473f68,_0x2e52e6,_0x242fcc,_0x5c24d6)[_0x5bdf('0x14')](function(_0x456c6b){logger['info']('['+_0x5c24d6[_0x5bdf('0x23')]()+_0x5bdf('0x64'),_0x456c6b[_0x5bdf('0x29')]);logger[_0x5bdf('0x20')]('['+_0x5c24d6[_0x5bdf('0x23')]()+']\x20The\x20User\x20email\x20is:',_0x456c6b['userEmail']);return getEndUser(_0x456c6b,_0xbe0065,_0x2e52e6,_0x242fcc,_0x45bdee,_0x5c24d6,_0x3961aa['moduleCreate'],_0x3961aa[_0x5bdf('0x65')]);})[_0x5bdf('0x14')](function(_0x12569e){logger[_0x5bdf('0x20')]('['+_0x5c24d6[_0x5bdf('0x23')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x12569e['enduserId']);logger[_0x5bdf('0x20')]('['+_0x5c24d6['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x45bdee[_0x5bdf('0x31')]);return getTicket(_0x12569e,_0xbe0065,_0x2e52e6,_0x242fcc,_0x45bdee,_0x3961aa,_0x5c24d6);})[_0x5bdf('0x14')](function(_0x4ea77e){logger[_0x5bdf('0x20')](util['format']('['+_0x5c24d6[_0x5bdf('0x23')]()+_0x5bdf('0x66'),_0x3961aa[_0x5bdf('0x45')],_0x4ea77e[_0x5bdf('0x52')]));logger[_0x5bdf('0x20')](util[_0x5bdf('0x59')]('['+_0x5c24d6[_0x5bdf('0x23')]()+_0x5bdf('0x67'),_0x5c24d6));if(_0x5c24d6!==_0x5bdf('0x58')&&_0x3961aa[_0x5bdf('0x68')]){logger['info']('['+_0x5c24d6[_0x5bdf('0x23')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xbe0065[_0x5bdf('0xb')],_0x473f68['name'],_0x3961aa[_0x5bdf('0x45')],_0x4ea77e[_0x5bdf('0x52')]);}})[_0x5bdf('0x16')](function(_0x4519ed){logger['error']('['+_0x5c24d6[_0x5bdf('0x23')]()+_0x5bdf('0x69'),_0x4519ed[_0x5bdf('0x19')]);console['error'](_0x5bdf('0x6a'),_0x4519ed);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 546a3ae..6db35db 100644 --- a/server/services/ami/trigger/integration/freshdesk.js +++ b/server/services/ami/trigger/integration/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13e0=['custom_fields','mapValues','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','defaults','map','length','forEach','includes','string','picklist','nameField','customField','content','toString','type','idField','push','variable','variableName','customVariable','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','user:%s','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Fields'];(function(_0xb2c2b4,_0x4800b2){var _0x362374=function(_0x72ccae){while(--_0x72ccae){_0xb2c2b4['push'](_0xb2c2b4['shift']());}};_0x362374(++_0x4800b2);}(_0x13e0,0x114));var _0x013e=function(_0x19e4a6,_0x30ab79){_0x19e4a6=_0x19e4a6-0x0;var _0x27d28d=_0x13e0[_0x19e4a6];return _0x27d28d;};'use strict';var _=require(_0x013e('0x0'));var rp=require(_0x013e('0x1'));var md5=require(_0x013e('0x2'));var util=require(_0x013e('0x3'));var Redis=require('ioredis');var intUtil=require(_0x013e('0x4'));var config=require(_0x013e('0x5'));var logger=require(_0x013e('0x6'))(_0x013e('0x7'));config[_0x013e('0x8')]=_['defaults'](config[_0x013e('0x8')],{'host':_0x013e('0x9'),'port':0x18eb});var io=require(_0x013e('0xa'))(new Redis(config[_0x013e('0x8')]));var headers={'Content-Type':_0x013e('0xb'),'Accept':_0x013e('0xb')};function emit(_0x1c9d8e,_0x9acea4,_0x2cb246){io['to'](_0x1c9d8e)[_0x013e('0xc')](_0x9acea4,_0x2cb246);}function getTicket(_0x2c2b15,_0x2c4358,_0x37abc4,_0x196b04,_0x370611){logger[_0x013e('0xd')]('Creating\x20new\x20ticket...');var _0xa217bc=_[_0x013e('0xe')]({'responder_id':_0x2c4358['id'],'requester_id':_0x37abc4['id'],'name':util[_0x013e('0xf')](_0x013e('0x10'),_0x370611[_0x013e('0x11')]),'phone':_0x370611[_0x013e('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x013e('0x13')](_0x196b04[_0x013e('0x14')],_0x370611,'\x20'),'description':intUtil[_0x013e('0x13')](_0x196b04[_0x013e('0x15')],_0x370611,_0x013e('0x16')),'tags':getTags(_0x196b04['Tags'],'name')},getCustomFields(_0x196b04[_0x013e('0x17')],_0x370611));_0xa217bc[_0x013e('0x18')]=_[_0x013e('0x19')](_[_0x013e('0x1a')](_0xa217bc[_0x013e('0x18')],'id'),_0x013e('0x1b'));return request({'uri':util['format']('%s/api/v2/tickets',_0x2c2b15[_0x013e('0x1c')]),'method':_0x013e('0x1d'),'body':_0xa217bc})[_0x013e('0x1e')](function(_0x56d662){logger[_0x013e('0xd')](_0x013e('0x1f'));return _0x56d662;});}function getUser(_0x49ded9,_0x5cd6d3){if(intUtil[_0x013e('0x20')](_0x5cd6d3)){return request({'uri':util[_0x013e('0xf')](_0x013e('0x21'),_0x49ded9[_0x013e('0x1c')]),'qs':{'email':_0x5cd6d3}})[_0x013e('0x1e')](function(_0x4cbd3b){if(_0x4cbd3b['length']){logger[_0x013e('0xd')](_0x013e('0x22'));return _[_0x013e('0x23')](_0x4cbd3b,function(_0x1e8d81){return _0x1e8d81[_0x013e('0x24')][_0x013e('0x25')]===_0x5cd6d3;});}else{logger['info'](_0x013e('0x26'));return request({'uri':util[_0x013e('0xf')](_0x013e('0x27'),_0x49ded9[_0x013e('0x1c')])})[_0x013e('0x1e')](function(_0x2067a6){logger[_0x013e('0xd')](_0x013e('0x28'));return _0x2067a6;});}});}else{logger[_0x013e('0xd')](_0x013e('0x29'));return request({'uri':util[_0x013e('0xf')]('%s/api/v2/agents/me',_0x49ded9['remoteUri'])})['then'](function(_0x570f7b){logger[_0x013e('0xd')]('Admin\x20account\x20selected.');return _0x570f7b;});}}function getEndUser(_0x39c39c,_0x26be07,_0x54000b){logger[_0x013e('0xd')](_0x013e('0x2a'),_0x54000b);return request({'uri':util[_0x013e('0xf')](_0x013e('0x2b'),_0x39c39c[_0x013e('0x1c')]),'qs':{'phone':_0x54000b}})[_0x013e('0x1e')](function(_0x265fa8){if(_0x265fa8['length']){logger[_0x013e('0xd')](_0x013e('0x2c'));return _[_0x013e('0x23')](_0x265fa8,{'phone':_0x54000b});}else{logger['info'](_0x013e('0x2d'));return request({'uri':util[_0x013e('0xf')]('%s/api/v2/contacts',_0x39c39c[_0x013e('0x1c')]),'method':_0x013e('0x1d'),'body':{'name':_0x26be07,'phone':_0x54000b}})[_0x013e('0x1e')](function(_0x2e4dad){logger[_0x013e('0xd')](_0x013e('0x2e'));return _0x2e4dad;});}});}function getAuth(_0x298672){return util['format'](_0x013e('0x2f'),new Buffer(_0x298672[_0x013e('0x30')]+':X')['toString'](_0x013e('0x31')));}function request(_0x48b497){logger[_0x013e('0x32')](_0x013e('0x33'),JSON[_0x013e('0x34')](_0x48b497));return rp(_[_0x013e('0x35')](_0x48b497,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x36d96c,_0x54c279){var _0x56da31=[];if(_0x36d96c&&_0x36d96c['length']>0x0){_0x56da31=_[_0x013e('0x36')](_0x36d96c,_0x54c279);}return _0x56da31;}function getCustomFields(_0x17e1d2,_0xd50077){var _0x2a20b8=[];var _0x35fc47={'custom_fields':[]};if(_0x17e1d2[_0x013e('0x37')]>0x0){_[_0x013e('0x38')](_0x17e1d2,function(_0x1b906b){if(_[_0x013e('0x39')]([_0x013e('0x3a'),_0x013e('0x3b')],_0x1b906b['type'])&&_0x1b906b[_0x013e('0x3c')]&&!_0x1b906b[_0x013e('0x3d')]){_0x35fc47[_0x1b906b[_0x013e('0x3c')]['toLowerCase']()]=_0x1b906b[_0x013e('0x3e')][_0x013e('0x3f')]();}else if(_[_0x013e('0x39')]([_0x013e('0x3a'),_0x013e('0x3b')],_0x1b906b[_0x013e('0x40')])&&_0x1b906b[_0x013e('0x41')]&&_0x1b906b[_0x013e('0x3d')]){_0x35fc47['custom_fields'][_0x013e('0x42')]({'id':_0x1b906b[_0x013e('0x41')],'value':_0x1b906b[_0x013e('0x3e')][_0x013e('0x3f')]()});}else if(_0x1b906b['type']===_0x013e('0x43')&&_0x1b906b[_0x013e('0x44')]&&_0x1b906b['idField']&&_0x1b906b[_0x013e('0x3d')]){_0xd50077[_0x1b906b[_0x013e('0x44')]]&&_0x35fc47[_0x013e('0x18')]['push']({'id':_0x1b906b[_0x013e('0x41')],'value':_0xd50077[_0x1b906b[_0x013e('0x44')]][_0x013e('0x3f')]()});}else if(_0x1b906b[_0x013e('0x40')]===_0x013e('0x45')&&_0x1b906b[_0x013e('0x46')]&&_0x1b906b[_0x013e('0x46')][_0x013e('0x47')]&&_0x1b906b[_0x013e('0x41')]&&_0x1b906b['customField']){_0xd50077[_0x1b906b[_0x013e('0x46')][_0x013e('0x47')][_0x013e('0x48')]()]&&_0x35fc47['custom_fields']['push']({'id':_0x1b906b[_0x013e('0x41')],'value':_0xd50077[_0x1b906b[_0x013e('0x46')][_0x013e('0x47')][_0x013e('0x48')]()][_0x013e('0x3f')]()});}});}return _0x35fc47;}exports['queue']=function(_0x376aa8,_0x4ec9a0,_0x484fe4,_0x34a721,_0x52b772,_0x555659){var _0x454aae,_0x2d33c8;_0x555659[_0x013e('0x1c')]=intUtil['stripTrailingSlash'](_0x555659[_0x013e('0x1c')]);_0x555659['serverUrl']=intUtil[_0x013e('0x49')](_0x555659[_0x013e('0x4a')]);if(_0x52b772&&_0x52b772[_0x013e('0x4b')]){logger['info'](_0x013e('0x4c'),_0x013e('0x4d'));_0x4ec9a0['recordingURL']=util['format'](_0x013e('0x4e'),_0x555659[_0x013e('0x4a')],_0x4ec9a0[_0x013e('0x4f')],md5(_0x4ec9a0[_0x013e('0x4f')]));}else{_0x4ec9a0['recordingURL']='';}headers[_0x013e('0x50')]=getAuth(_0x555659);return getUser(_0x555659,_0x34a721[_0x013e('0x25')])[_0x013e('0x1e')](function(_0x5ec1e5){_0x454aae=_0x5ec1e5;logger[_0x013e('0xd')](_0x013e('0x51'),_0x454aae['id']);return getEndUser(_0x555659,_0x4ec9a0[_0x013e('0x11')],_0x4ec9a0[_0x013e('0x12')]);})[_0x013e('0x1e')](function(_0x4106f0){_0x2d33c8=_0x4106f0;logger[_0x013e('0xd')](_0x013e('0x52'),_0x2d33c8['id']);return getTicket(_0x555659,_0x454aae,_0x2d33c8,_0x484fe4,_0x4ec9a0);})[_0x013e('0x1e')](function(_0x11143c){if(_0x11143c&&_0x11143c['id']){logger[_0x013e('0xd')]('Ticket\x20created!');logger[_0x013e('0xd')](_0x013e('0x53'),_0x11143c['id']);logger[_0x013e('0xd')](_0x013e('0x4c'),_0x013e('0x54'));emit(util[_0x013e('0xf')]('user:%s',_0x34a721['name']),_0x013e('0x55'),{'uri':util[_0x013e('0xf')](_0x013e('0x56'),_0x555659['remoteUri'],_0x11143c['id'])});}})[_0x013e('0x57')](function(_0x3103c3){logger['error'](_0x013e('0x4c'),JSON[_0x013e('0x34')](_0x3103c3));});};exports[_0x013e('0x58')]=function(_0x5eedb0,_0x46318f,_0x2c90d4,_0x2e1cd6,_0x18a65e,_0x10a745,_0x2dc3c5){var _0x185a1f,_0x4c2c8a;_0x10a745[_0x013e('0x1c')]=intUtil['stripTrailingSlash'](_0x10a745['remoteUri']);_0x10a745[_0x013e('0x4a')]=intUtil['stripTrailingSlash'](_0x10a745[_0x013e('0x4a')]);if(_0x2dc3c5&&_0x2dc3c5[_0x013e('0x59')]&&_0x2dc3c5[_0x013e('0x59')]!==_0x013e('0x5a')){logger[_0x013e('0xd')](_0x013e('0x5b'),'Recording\x20is\x20enabled!');_0x46318f[_0x013e('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10a745[_0x013e('0x4a')],_0x46318f[_0x013e('0x4f')],md5(_0x46318f[_0x013e('0x4f')]));}headers[_0x013e('0x50')]=getAuth(_0x10a745);return getUser(_0x10a745,_0x2e1cd6['email'])[_0x013e('0x1e')](function(_0x242c8a){_0x185a1f=_0x242c8a;logger[_0x013e('0xd')](_0x013e('0x51'),_0x185a1f['id']);return getEndUser(_0x10a745,_0x46318f[_0x013e('0x5d')],_0x46318f[_0x013e('0x5e')]);})[_0x013e('0x1e')](function(_0x2b8e94){_0x4c2c8a=_0x2b8e94;logger[_0x013e('0xd')](_0x013e('0x52'),_0x4c2c8a['id']);return getTicket(_0x10a745,_0x185a1f,_0x4c2c8a,_0x2c90d4,_0x46318f);})['then'](function(_0x323e53){if(_0x323e53&&_0x323e53['id']){logger['info']('Ticket\x20created!');logger[_0x013e('0xd')](_0x013e('0x53'),_0x323e53['id']);logger[_0x013e('0xd')](_0x013e('0x5b'),_0x013e('0x54'));emit(util[_0x013e('0xf')](_0x013e('0x5f'),_0x2e1cd6['name']),_0x013e('0x55'),{'uri':util['format'](_0x013e('0x56'),_0x10a745['remoteUri'],_0x323e53['id'])});}})[_0x013e('0x57')](function(_0x144a51){logger[_0x013e('0x60')](_0x013e('0x5b'),JSON[_0x013e('0x34')](_0x144a51));});};exports[_0x013e('0x61')]=function(_0x33888,_0x3c1fd8,_0x1482af,_0x20bc8d,_0x49b205,_0x1ee3c6){var _0x31222c,_0x3bd8ee;_0x1ee3c6['remoteUri']=intUtil[_0x013e('0x49')](_0x1ee3c6[_0x013e('0x1c')]);_0x1ee3c6[_0x013e('0x4a')]=intUtil[_0x013e('0x49')](_0x1ee3c6[_0x013e('0x4a')]);if(_0x49b205&&_0x49b205[_0x013e('0x4b')]){logger[_0x013e('0xd')]('['+_0x3c1fd8[_0x013e('0x62')]['toUpperCase']()+']',_0x013e('0x4d'));_0x3c1fd8[_0x013e('0x5c')]=util[_0x013e('0xf')](_0x013e('0x4e'),_0x1ee3c6[_0x013e('0x4a')],_0x3c1fd8['uniqueid'],md5(_0x3c1fd8['uniqueid']));}else{_0x3c1fd8[_0x013e('0x5c')]='';}headers[_0x013e('0x50')]=getAuth(_0x1ee3c6);return getUser(_0x1ee3c6,'')['then'](function(_0x55c888){_0x31222c=_0x55c888;logger['info'](_0x013e('0x51'),_0x31222c['id']);return getEndUser(_0x1ee3c6,_0x3c1fd8[_0x013e('0x11')],_0x3c1fd8[_0x013e('0x12')]);})[_0x013e('0x1e')](function(_0x52a3d1){_0x3bd8ee=_0x52a3d1;logger[_0x013e('0xd')](_0x013e('0x52'),_0x3bd8ee['id']);return getTicket(_0x1ee3c6,_0x31222c,_0x3bd8ee,_0x1482af,_0x3c1fd8);})[_0x013e('0x1e')](function(_0x349ca2){if(_0x349ca2){logger[_0x013e('0xd')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x349ca2['id']);}})[_0x013e('0x57')](function(_0x4465ac){logger[_0x013e('0x60')]('['+_0x3c1fd8['lastevent'][_0x013e('0x63')]()+']',JSON[_0x013e('0x34')](_0x4465ac));});}; \ No newline at end of file +var _0x61c5=['[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','stripTrailingSlash','recordingFormat','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','destcalleridname','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','Tags','Fields','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','GET','map','forEach','includes','nameField','customField','toLowerCase','content','toString','string','picklist','type','idField','push','variable','variableName','Variable','name','queue','monitor_format'];(function(_0x5aab8e,_0x44820b){var _0x192f75=function(_0x3097b0){while(--_0x3097b0){_0x5aab8e['push'](_0x5aab8e['shift']());}};_0x192f75(++_0x44820b);}(_0x61c5,0x183));var _0x561c=function(_0x391ff3,_0x32cf04){_0x391ff3=_0x391ff3-0x0;var _0x36e2fd=_0x61c5[_0x391ff3];return _0x36e2fd;};'use strict';var _=require(_0x561c('0x0'));var rp=require(_0x561c('0x1'));var md5=require(_0x561c('0x2'));var util=require(_0x561c('0x3'));var Redis=require(_0x561c('0x4'));var intUtil=require('./util');var config=require(_0x561c('0x5'));var logger=require('../../../../config/logger')(_0x561c('0x6'));config[_0x561c('0x7')]=_[_0x561c('0x8')](config[_0x561c('0x7')],{'host':_0x561c('0x9'),'port':0x18eb});var io=require(_0x561c('0xa'))(new Redis(config[_0x561c('0x7')]));var headers={'Content-Type':_0x561c('0xb'),'Accept':_0x561c('0xb')};function emit(_0x2eedcc,_0x287b41,_0x40cb4e){io['to'](_0x2eedcc)['emit'](_0x287b41,_0x40cb4e);}function getTicket(_0x301edf,_0x4efe9e,_0x5180d1,_0x33d7ad,_0x2bbbc6){logger['info']('Creating\x20new\x20ticket...');var _0x1fd30f=_[_0x561c('0xc')]({'responder_id':_0x4efe9e['id'],'requester_id':_0x5180d1['id'],'name':util['format'](_0x561c('0xd'),_0x2bbbc6[_0x561c('0xe')]),'phone':_0x2bbbc6[_0x561c('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x561c('0x10')](_0x33d7ad['Subjects'],_0x2bbbc6,'\x20'),'description':intUtil[_0x561c('0x10')](_0x33d7ad[_0x561c('0x11')],_0x2bbbc6,'
'),'tags':getTags(_0x33d7ad[_0x561c('0x12')],'name')},getCustomFields(_0x33d7ad[_0x561c('0x13')],_0x2bbbc6));_0x1fd30f['custom_fields']=_['mapValues'](_['keyBy'](_0x1fd30f[_0x561c('0x14')],'id'),_0x561c('0x15'));return request({'uri':util[_0x561c('0x16')](_0x561c('0x17'),_0x301edf[_0x561c('0x18')]),'method':_0x561c('0x19'),'body':_0x1fd30f})['then'](function(_0x1ff324){logger[_0x561c('0x1a')](_0x561c('0x1b'));return _0x1ff324;});}function getUser(_0x528a04,_0x4723b5){if(intUtil[_0x561c('0x1c')](_0x4723b5)){return request({'uri':util[_0x561c('0x16')]('%s/api/v2/agents',_0x528a04['remoteUri']),'qs':{'email':_0x4723b5}})[_0x561c('0x1d')](function(_0x18e6b6){if(_0x18e6b6[_0x561c('0x1e')]){logger[_0x561c('0x1a')](_0x561c('0x1f'));return _['find'](_0x18e6b6,function(_0x1a2f9f){return _0x1a2f9f[_0x561c('0x20')]['email']===_0x4723b5;});}else{logger[_0x561c('0x1a')](_0x561c('0x21'));return request({'uri':util['format'](_0x561c('0x22'),_0x528a04['remoteUri'])})[_0x561c('0x1d')](function(_0x5cfc00){logger[_0x561c('0x1a')]('Admin\x20account\x20selected.');return _0x5cfc00;});}});}else{logger[_0x561c('0x1a')](_0x561c('0x23'));return request({'uri':util[_0x561c('0x16')](_0x561c('0x22'),_0x528a04[_0x561c('0x18')])})[_0x561c('0x1d')](function(_0x1fcdd5){logger[_0x561c('0x1a')](_0x561c('0x24'));return _0x1fcdd5;});}}function getEndUser(_0x23dc09,_0x196bfe,_0x3ccbbb){logger[_0x561c('0x1a')](_0x561c('0x25'),_0x3ccbbb);return request({'uri':util[_0x561c('0x16')](_0x561c('0x26'),_0x23dc09[_0x561c('0x18')]),'qs':{'phone':_0x3ccbbb}})[_0x561c('0x1d')](function(_0x41fa11){if(_0x41fa11[_0x561c('0x1e')]){logger['info'](_0x561c('0x27'));return _[_0x561c('0x28')](_0x41fa11,{'phone':_0x3ccbbb});}else{logger[_0x561c('0x1a')](_0x561c('0x29'));return request({'uri':util['format'](_0x561c('0x26'),_0x23dc09[_0x561c('0x18')]),'method':'POST','body':{'name':_0x196bfe,'phone':_0x3ccbbb}})[_0x561c('0x1d')](function(_0x349557){logger[_0x561c('0x1a')](_0x561c('0x2a'));return _0x349557;});}});}function getAuth(_0x5912a6){return util['format'](_0x561c('0x2b'),new Buffer(_0x5912a6[_0x561c('0x2c')]+':X')['toString'](_0x561c('0x2d')));}function request(_0xcfa9d){logger['debug'](_0x561c('0x2e'),JSON[_0x561c('0x2f')](_0xcfa9d));return rp(_[_0x561c('0x8')](_0xcfa9d,{'method':_0x561c('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x377e90,_0x48aa08){var _0x30b288=[];if(_0x377e90&&_0x377e90['length']>0x0){_0x30b288=_[_0x561c('0x31')](_0x377e90,_0x48aa08);}return _0x30b288;}function getCustomFields(_0x36d66d,_0xd545df){var _0x8891c5=[];var _0x57da1a={'custom_fields':[]};if(_0x36d66d[_0x561c('0x1e')]>0x0){_[_0x561c('0x32')](_0x36d66d,function(_0x56609e){if(_[_0x561c('0x33')](['string','picklist'],_0x56609e['type'])&&_0x56609e[_0x561c('0x34')]&&!_0x56609e[_0x561c('0x35')]){_0x57da1a[_0x56609e['nameField'][_0x561c('0x36')]()]=_0x56609e[_0x561c('0x37')][_0x561c('0x38')]();}else if(_[_0x561c('0x33')]([_0x561c('0x39'),_0x561c('0x3a')],_0x56609e[_0x561c('0x3b')])&&_0x56609e[_0x561c('0x3c')]&&_0x56609e[_0x561c('0x35')]){_0x57da1a[_0x561c('0x14')][_0x561c('0x3d')]({'id':_0x56609e[_0x561c('0x3c')],'value':_0x56609e[_0x561c('0x37')][_0x561c('0x38')]()});}else if(_0x56609e[_0x561c('0x3b')]===_0x561c('0x3e')&&_0x56609e[_0x561c('0x3f')]&&_0x56609e[_0x561c('0x3c')]&&_0x56609e[_0x561c('0x35')]){_0xd545df[_0x56609e[_0x561c('0x3f')]]&&_0x57da1a['custom_fields'][_0x561c('0x3d')]({'id':_0x56609e[_0x561c('0x3c')],'value':_0xd545df[_0x56609e['variableName']]['toString']()});}else if(_0x56609e[_0x561c('0x3b')]==='customVariable'&&_0x56609e[_0x561c('0x40')]&&_0x56609e[_0x561c('0x40')][_0x561c('0x41')]&&_0x56609e[_0x561c('0x3c')]&&_0x56609e[_0x561c('0x35')]){_0xd545df[_0x56609e[_0x561c('0x40')]['name'][_0x561c('0x36')]()]&&_0x57da1a[_0x561c('0x14')]['push']({'id':_0x56609e['idField'],'value':_0xd545df[_0x56609e['Variable'][_0x561c('0x41')][_0x561c('0x36')]()]['toString']()});}});}return _0x57da1a;}exports[_0x561c('0x42')]=function(_0x4c7d0c,_0x2b46e6,_0x33704e,_0x438689,_0x142dae,_0x19e10d){var _0x370dbf,_0x4656f7;_0x19e10d[_0x561c('0x18')]=intUtil['stripTrailingSlash'](_0x19e10d[_0x561c('0x18')]);_0x19e10d['serverUrl']=intUtil['stripTrailingSlash'](_0x19e10d['serverUrl']);if(_0x142dae&&_0x142dae[_0x561c('0x43')]){logger[_0x561c('0x1a')](_0x561c('0x44'),_0x561c('0x45'));_0x2b46e6['recordingURL']=util['format'](_0x561c('0x46'),_0x19e10d[_0x561c('0x47')],_0x2b46e6[_0x561c('0x48')],md5(_0x2b46e6[_0x561c('0x48')]));}else{_0x2b46e6['recordingURL']='';}headers[_0x561c('0x49')]=getAuth(_0x19e10d);return getUser(_0x19e10d,_0x438689[_0x561c('0x4a')])[_0x561c('0x1d')](function(_0x5ec7a3){_0x370dbf=_0x5ec7a3;logger[_0x561c('0x1a')]('The\x20User\x20ID\x20is:',_0x370dbf['id']);return getEndUser(_0x19e10d,_0x2b46e6['calleridname'],_0x2b46e6['calleridnum']);})[_0x561c('0x1d')](function(_0x208f93){_0x4656f7=_0x208f93;logger['info'](_0x561c('0x4b'),_0x4656f7['id']);return getTicket(_0x19e10d,_0x370dbf,_0x4656f7,_0x33704e,_0x2b46e6);})[_0x561c('0x1d')](function(_0x2db5ad){if(_0x2db5ad&&_0x2db5ad['id']){logger[_0x561c('0x1a')](_0x561c('0x1b'));logger['info'](_0x561c('0x4c'),_0x2db5ad['id']);logger[_0x561c('0x1a')](_0x561c('0x44'),_0x561c('0x4d'));emit(util[_0x561c('0x16')](_0x561c('0x4e'),_0x438689[_0x561c('0x41')]),'trigger:browser:url',{'uri':util[_0x561c('0x16')](_0x561c('0x4f'),_0x19e10d[_0x561c('0x18')],_0x2db5ad['id'])});}})[_0x561c('0x50')](function(_0x288ed2){logger[_0x561c('0x51')]('[QUEUE]',JSON['stringify'](_0x288ed2));});};exports['outbound']=function(_0x561fd2,_0x27b9cb,_0x488ed5,_0x539599,_0xcdde4e,_0x2c3b70,_0x4724b1){var _0x4f57af,_0x31bd4c;_0x2c3b70[_0x561c('0x18')]=intUtil[_0x561c('0x52')](_0x2c3b70[_0x561c('0x18')]);_0x2c3b70[_0x561c('0x47')]=intUtil['stripTrailingSlash'](_0x2c3b70[_0x561c('0x47')]);if(_0x4724b1&&_0x4724b1[_0x561c('0x53')]&&_0x4724b1[_0x561c('0x53')]!=='none'){logger[_0x561c('0x1a')](_0x561c('0x54'),'Recording\x20is\x20enabled!');_0x27b9cb[_0x561c('0x55')]=util[_0x561c('0x16')](_0x561c('0x46'),_0x2c3b70['serverUrl'],_0x27b9cb[_0x561c('0x48')],md5(_0x27b9cb['uniqueid']));}headers['Authorization']=getAuth(_0x2c3b70);return getUser(_0x2c3b70,_0x539599[_0x561c('0x4a')])[_0x561c('0x1d')](function(_0x2e36d0){_0x4f57af=_0x2e36d0;logger[_0x561c('0x1a')](_0x561c('0x56'),_0x4f57af['id']);return getEndUser(_0x2c3b70,_0x27b9cb[_0x561c('0x57')],_0x27b9cb['destcalleridnum']);})[_0x561c('0x1d')](function(_0x5158e8){_0x31bd4c=_0x5158e8;logger['info'](_0x561c('0x4b'),_0x31bd4c['id']);return getTicket(_0x2c3b70,_0x4f57af,_0x31bd4c,_0x488ed5,_0x27b9cb);})[_0x561c('0x1d')](function(_0x48f57e){if(_0x48f57e&&_0x48f57e['id']){logger[_0x561c('0x1a')](_0x561c('0x1b'));logger[_0x561c('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x48f57e['id']);logger[_0x561c('0x1a')](_0x561c('0x54'),_0x561c('0x4d'));emit(util[_0x561c('0x16')](_0x561c('0x4e'),_0x539599[_0x561c('0x41')]),'trigger:browser:url',{'uri':util[_0x561c('0x16')]('%s/helpdesk/tickets/%d',_0x2c3b70[_0x561c('0x18')],_0x48f57e['id'])});}})[_0x561c('0x50')](function(_0x49d848){logger[_0x561c('0x51')]('[OUTBOUND]',JSON[_0x561c('0x2f')](_0x49d848));});};exports[_0x561c('0x58')]=function(_0x264486,_0x4bf9b3,_0x3749b5,_0x5a8778,_0xa1130f,_0x37474f){var _0x2a561a,_0xde290f;_0x37474f['remoteUri']=intUtil[_0x561c('0x52')](_0x37474f[_0x561c('0x18')]);_0x37474f[_0x561c('0x47')]=intUtil['stripTrailingSlash'](_0x37474f[_0x561c('0x47')]);if(_0xa1130f&&_0xa1130f['monitor_format']){logger[_0x561c('0x1a')]('['+_0x4bf9b3[_0x561c('0x59')]['toUpperCase']()+']',_0x561c('0x45'));_0x4bf9b3[_0x561c('0x55')]=util[_0x561c('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x37474f[_0x561c('0x47')],_0x4bf9b3[_0x561c('0x48')],md5(_0x4bf9b3['uniqueid']));}else{_0x4bf9b3['recordingURL']='';}headers[_0x561c('0x49')]=getAuth(_0x37474f);return getUser(_0x37474f,'')['then'](function(_0x51d8d7){_0x2a561a=_0x51d8d7;logger[_0x561c('0x1a')](_0x561c('0x56'),_0x2a561a['id']);return getEndUser(_0x37474f,_0x4bf9b3[_0x561c('0xe')],_0x4bf9b3[_0x561c('0xf')]);})[_0x561c('0x1d')](function(_0x2da8ba){_0xde290f=_0x2da8ba;logger[_0x561c('0x1a')]('The\x20Enduser\x20ID\x20is:',_0xde290f['id']);return getTicket(_0x37474f,_0x2a561a,_0xde290f,_0x3749b5,_0x4bf9b3);})[_0x561c('0x1d')](function(_0x49593d){if(_0x49593d){logger['info'](_0x561c('0x1b'));logger[_0x561c('0x1a')]('The\x20Ticket\x20ID\x20is:',_0x49593d['id']);}})[_0x561c('0x50')](function(_0x2e2754){logger[_0x561c('0x51')]('['+_0x4bf9b3['lastevent'][_0x561c('0x5a')]()+']',JSON['stringify'](_0x2e2754));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 85473a9..abac160 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb807=['email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','Admin\x20selected','adminEmail','userId','toUpperCase','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Contact','ticketId','task','emit','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','username','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xb807,0x1e0));var _0x7b80=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0xb807[_0x48f8c4];return _0x118849;};'use strict';var _=require('lodash');var rp=require(_0x7b80('0x0'));var md5=require('md5');var util=require(_0x7b80('0x1'));var moment=require(_0x7b80('0x2'));var Promise=require(_0x7b80('0x3'));var Redis=require(_0x7b80('0x4'));var intUtil=require(_0x7b80('0x5'));var config=require(_0x7b80('0x6'));var logger=require(_0x7b80('0x7'))(_0x7b80('0x8'));config[_0x7b80('0x9')]=_[_0x7b80('0xa')](config[_0x7b80('0x9')],{'host':_0x7b80('0xb'),'port':0x18eb});var io=require(_0x7b80('0xc'))(new Redis(config['redis']));function getAdminId(_0x13a404,_0x2eeedc,_0x3910f0,_0x1baa74){return new Promise(function(_0x4521ac,_0x1f8942){var _0x423eb1=![];var _0xf561ea={'method':_0x7b80('0xd'),'uri':_0x1baa74+_0x7b80('0xe'),'json':!![]};_0xf561ea['headers']=_0x3910f0;logger['info'](_0x7b80('0xf'));return rp(_0xf561ea)[_0x7b80('0x10')](function(_0x2200a8){if(_0x2200a8){var _0x1b1647=_0x2200a8[_0x7b80('0x11')];var _0x4c270b=null;for(_0x4c270b=0x0;_0x4c270b<_0x1b1647['length'];_0x4c270b++){if(_0x1b1647[_0x4c270b][_0x7b80('0x12')]===_0x13a404['adminEmail']){_0x13a404[_0x7b80('0x13')]=_0x1b1647[_0x4c270b]['id'];_0x423eb1=!![];}}if(_0x423eb1){logger[_0x7b80('0x14')](_0x7b80('0x15'),_0x13a404['adminId']);_0x4521ac(_0x13a404);}else{_0x1f8942({'statusCode':0x194,'message':_0x7b80('0x16')});}}else{_0x1f8942({'statusCode':0x194,'message':_0x7b80('0x16')});}})[_0x7b80('0x17')](function(_0x420188){logger[_0x7b80('0x18')]('['+[_0x2eeedc['toUpperCase']()]+']',_0x420188[_0x7b80('0x19')]);_0x1f8942(_0x420188);});});}function getUser(_0x1276e0,_0x5bd4d5,_0x235de3){return function(_0x3c99a6){return new Promise(function(_0x128d9e,_0x11622a){var _0x293a10={'method':_0x7b80('0xd'),'uri':_0x235de3+_0x7b80('0xe'),'json':!![]};_0x293a10[_0x7b80('0x1a')]=_0x5bd4d5;logger[_0x7b80('0x14')]('Getting\x20user\x20list');return rp(_0x293a10)[_0x7b80('0x10')](function(_0x4e543){if(_0x4e543){var _0x49105f=_0x4e543[_0x7b80('0x11')];var _0x110353=![];var _0x40be13=null;if(_0x3c99a6[_0x7b80('0x1b')]!==null){logger[_0x7b80('0x14')](_0x7b80('0x1c'),_0x3c99a6[_0x7b80('0x1b')]);_0x3c99a6[_0x7b80('0x1d')]=_0x3c99a6[_0x7b80('0x1b')];for(_0x40be13=0x0;_0x40be13<_0x49105f['length'];_0x40be13++){if(_0x49105f[_0x40be13][_0x7b80('0x12')]===_0x3c99a6['agentEmail']){_0x110353=!![];_0x3c99a6['userId']=_0x49105f[_0x40be13]['id'];logger[_0x7b80('0x14')](_0x7b80('0x1e'),_0x3c99a6['userId']);}}}if(!_0x110353){logger[_0x7b80('0x14')](_0x7b80('0x1f'));_0x3c99a6[_0x7b80('0x1d')]=_0x3c99a6[_0x7b80('0x20')];_0x3c99a6[_0x7b80('0x21')]=_0x3c99a6[_0x7b80('0x13')];_0x110353=!![];}if(_0x110353){_0x128d9e(_0x3c99a6);}else{_0x11622a({'statusCode':0x194,'message':_0x7b80('0x16')});}}else{_0x11622a({'statusCode':0x194,'message':_0x7b80('0x16')});}})[_0x7b80('0x17')](function(_0x265eba){logger[_0x7b80('0x18')]('['+[_0x1276e0[_0x7b80('0x22')]()]+']',_0x265eba[_0x7b80('0x19')]);_0x11622a(_0x265eba);});});};}function searchContact(_0x5d443a,_0x3d2bbe,_0x49ff01,_0x48b663){return new Promise(function(_0x5bb2f8,_0x303baf){var _0x4fb343={'method':_0x7b80('0xd'),'headers':_0x3d2bbe,'uri':_0x5d443a+_0x7b80('0x23')+_0x48b663+_0x7b80('0x24')+_0x49ff01+'&entities=contact','json':!![]};rp(_0x4fb343)[_0x7b80('0x10')](function(_0x2138e3){var _0x42e2ee=_[_0x7b80('0x25')](_0x2138e3['contacts'][_0x7b80('0x26')],[_0x49ff01,_0x48b663]);_0x5bb2f8(_0x42e2ee);})['catch'](function(_0x31edff){_0x303baf(_0x31edff);});});}function getEndUser(_0x4b2493,_0x3ab6e3,_0x7ca6ea){return function(_0x779b4){return new Promise(function(_0x59eb09,_0x2b153a){logger[_0x7b80('0x14')](util[_0x7b80('0x27')](_0x7b80('0x28'),_0x779b4['contactNumber']));searchContact(_0x7ca6ea,_0x3ab6e3,_0x7b80('0x29'),_0x779b4[_0x7b80('0x2a')])[_0x7b80('0x10')](function(_0x14441f){if(_0x14441f){_0x779b4[_0x7b80('0x2b')]=_0x14441f['id'];logger['info'](_0x7b80('0x2c'),_0x779b4[_0x7b80('0x2b')]);return _0x59eb09(_0x779b4);}searchContact(_0x7ca6ea,_0x3ab6e3,_0x7b80('0x2d'),_0x779b4['contactNumber'])['then'](function(_0x192c50){if(_0x192c50){_0x779b4['endUserId']=_0x192c50['id'];logger[_0x7b80('0x14')]('Contact\x20found\x20work_number:',_0x779b4['endUserId']);return _0x59eb09(_0x779b4);}createEndUser(_0x779b4,_0x4b2493,_0x3ab6e3,_0x7ca6ea)['then'](function(_0x3c6e2c){logger[_0x7b80('0x14')](_0x7b80('0x2e'),_0x3c6e2c[_0x7b80('0x2b')]);return _0x59eb09(_0x3c6e2c);});});})[_0x7b80('0x17')](function(_0x1af3d2){_0x2b153a(_0x1af3d2);});});};}function createEndUser(_0x4db5f2,_0x18122d,_0x36e9f3,_0x5f1c69){return new Promise(function(_0x23e47f,_0x40d737){var _0x55e3f0=moment();var _0x20cb83={'method':_0x7b80('0x2f'),'uri':_0x5f1c69+_0x7b80('0x30'),'body':{'contact':{'last_name':_0x4db5f2[_0x7b80('0x2a')],'work_number':_0x4db5f2[_0x7b80('0x2a')],'mobile_number':_0x4db5f2['contactNumber'],'owner_id':_0x4db5f2['userId'],'created_at':_0x55e3f0[_0x7b80('0x27')](_0x7b80('0x31'))}},'json':!![]};_0x20cb83[_0x7b80('0x1a')]=_0x36e9f3;logger['info'](_0x7b80('0x32'));return rp(_0x20cb83)[_0x7b80('0x10')](function(_0x35483a){_0x4db5f2[_0x7b80('0x2b')]=_0x35483a[_0x7b80('0x33')]['id'];_0x23e47f(_0x4db5f2);})[_0x7b80('0x17')](function(_0x286e0a){logger['error']('['+[_0x18122d[_0x7b80('0x22')]()]+']',_0x286e0a[_0x7b80('0x19')]);_0x40d737(_0x286e0a[_0x7b80('0x19')]);});});}function getTicket(_0x1223d2,_0x48c246,_0x3a5065,_0x2aa050,_0x1e59ee){return function(_0x371fc3){logger['info'](_0x7b80('0x34'));return new Promise(function(_0xfd429b,_0x161f8c){var _0x40ef73=moment();var _0x102faa={'method':_0x7b80('0x2f'),'uri':_0x3a5065+_0x7b80('0x35'),'body':{'title':intUtil[_0x7b80('0x36')](_0x2aa050['Subjects'],_0x1e59ee,'\x20'),'description':intUtil[_0x7b80('0x36')](_0x2aa050['Descriptions'],_0x1e59ee,'\x0a'),'owner_id':_0x371fc3['userId'],'creater_id':_0x371fc3['adminId'],'targetable_id':_0x371fc3['endUserId'],'targetable_type':_0x7b80('0x37'),'created_at':_0x40ef73['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x40ef73['add'](0x1e,'m')[_0x7b80('0x27')](_0x7b80('0x31'))},'json':!![]};_0x102faa[_0x7b80('0x1a')]=_0x48c246;return rp(_0x102faa)['then'](function(_0x37fc32){_0x371fc3[_0x7b80('0x38')]=_0x37fc32[_0x7b80('0x39')]['id'];logger[_0x7b80('0x14')]('Task\x20created:',_0x371fc3[_0x7b80('0x38')]);_0xfd429b(_0x371fc3);})[_0x7b80('0x17')](function(_0x3e82bc){logger[_0x7b80('0x18')]('['+[_0x1223d2[_0x7b80('0x22')]()]+']',_0x3e82bc[_0x7b80('0x19')]);_0x161f8c(_0x3e82bc['message']);});});};}function emit(_0x96bf0b,_0x3d252f,_0x2a53a2){var _0x14cdf7={'uri':_0x96bf0b+'/contacts/'+_0x2a53a2};io['to'](util[_0x7b80('0x27')]('user:%s',_0x3d252f))[_0x7b80('0x3a')](_0x7b80('0x3b'),_0x14cdf7);}exports['cs']=function(_0xdab151,_0x548d85,_0x1e3335,_0x522fef,_0x45541e,_0x4d712f,_0x53dd8f,_0x4c54b4){var _0x3aad8c={};var _0x27bcc7={'Authorization':'Token\x20token='+_0x4d712f[_0x7b80('0x3c')]};_0x4d712f['remoteUri']=intUtil[_0x7b80('0x3d')](_0x4d712f[_0x7b80('0x3e')]);_0x4d712f['serverUrl']=intUtil['stripTrailingSlash'](_0x4d712f['serverUrl']);var _0x5718e7=_0x4d712f[_0x7b80('0x3e')];_0x3aad8c[_0x7b80('0x20')]=_0x4d712f[_0x7b80('0x3f')];_0x3aad8c[_0x7b80('0x2a')]=_0x4c54b4['toLowerCase']()===_0x7b80('0x40')?_0x548d85[_0x7b80('0x41')]:_0x548d85[_0x7b80('0x42')];_0x3aad8c[_0x7b80('0x43')]=_0x4c54b4==='queue'||_0x4c54b4===_0x7b80('0x44')?_0x7b80('0x45'):'outbound';if(_0x522fef){_0x3aad8c[_0x7b80('0x1b')]=_0x522fef[_0x7b80('0x12')];}var _0x23770c=util[_0x7b80('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4d712f[_0x7b80('0x46')],_0x548d85[_0x7b80('0x47')],md5(_0x548d85['uniqueid']));if(_0x45541e&&_0x45541e[_0x7b80('0x48')]){logger[_0x7b80('0x14')](_0x7b80('0x49'),'Recording\x20is\x20enabled!');_0x548d85[_0x7b80('0x4a')]=_0x23770c;}else if(_0x53dd8f&&_0x53dd8f[_0x7b80('0x4b')]&&_0x53dd8f[_0x7b80('0x4b')]!==_0x7b80('0x4c')){logger[_0x7b80('0x14')](_0x7b80('0x4d'),_0x7b80('0x4e'));_0x548d85[_0x7b80('0x4a')]=_0x23770c;}else{_0x548d85[_0x7b80('0x4a')]='';}return getAdminId(_0x3aad8c,_0x4c54b4,_0x27bcc7,_0x5718e7)['then'](getUser(_0x4c54b4,_0x27bcc7,_0x5718e7))[_0x7b80('0x10')](getEndUser(_0x4c54b4,_0x27bcc7,_0x5718e7))[_0x7b80('0x10')](getTicket(_0x4c54b4,_0x27bcc7,_0x5718e7,_0x1e3335,_0x548d85))[_0x7b80('0x10')](function(_0x4a4e35){logger[_0x7b80('0x14')](util[_0x7b80('0x27')](_0x7b80('0x4f'),_0x4a4e35[_0x7b80('0x38')]));if(_0x4c54b4!=='unmanaged'){logger[_0x7b80('0x14')]('['+[_0x4c54b4[_0x7b80('0x22')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5718e7,_0x522fef[_0x7b80('0x50')],_0x4a4e35[_0x7b80('0x2b')]);}})['catch'](function(_0x339c8e){logger[_0x7b80('0x18')]('['+[_0x4c54b4[_0x7b80('0x22')]()]+_0x7b80('0x51'),util[_0x7b80('0x52')](_0x339c8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd337=[']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','moment','ioredis','./util','../../../../config/logger','redis','localhost','GET','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','Admin\x20selected','userEmail','catch','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','headers','contact','Creating\x20new\x20task','POST','/api/tasks','getString','userId','Contact','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','name'];(function(_0x10e9ee,_0x5035df){var _0x3a3e14=function(_0x241c32){while(--_0x241c32){_0x10e9ee['push'](_0x10e9ee['shift']());}};_0x3a3e14(++_0x5035df);}(_0xd337,0x135));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d33('0x0'));var rp=require('request-promise');var md5=require(_0x7d33('0x1'));var util=require(_0x7d33('0x2'));var moment=require(_0x7d33('0x3'));var Promise=require('bluebird');var Redis=require(_0x7d33('0x4'));var intUtil=require(_0x7d33('0x5'));var config=require('../../../../config/environment');var logger=require(_0x7d33('0x6'))('freshsales');config[_0x7d33('0x7')]=_['defaults'](config[_0x7d33('0x7')],{'host':_0x7d33('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7d33('0x7')]));function getAdminId(_0x37057d,_0x434dda,_0x486616,_0x4c44b1){return new Promise(function(_0x23d951,_0xca52f7){var _0x4c1a9a=![];var _0xeb9a54={'method':_0x7d33('0x9'),'uri':_0x4c44b1+'/api/selector/owners','json':!![]};_0xeb9a54['headers']=_0x486616;logger[_0x7d33('0xa')](_0x7d33('0xb'));return rp(_0xeb9a54)['then'](function(_0x3bfa44){if(_0x3bfa44){var _0x220aad=_0x3bfa44[_0x7d33('0xc')];var _0x5f0dc6=null;for(_0x5f0dc6=0x0;_0x5f0dc6<_0x220aad[_0x7d33('0xd')];_0x5f0dc6++){if(_0x220aad[_0x5f0dc6][_0x7d33('0xe')]===_0x37057d[_0x7d33('0xf')]){_0x37057d[_0x7d33('0x10')]=_0x220aad[_0x5f0dc6]['id'];_0x4c1a9a=!![];}}if(_0x4c1a9a){logger[_0x7d33('0xa')](_0x7d33('0x11'),_0x37057d['adminId']);_0x23d951(_0x37057d);}else{_0xca52f7({'statusCode':0x194,'message':_0x7d33('0x12')});}}else{_0xca52f7({'statusCode':0x194,'message':_0x7d33('0x12')});}})['catch'](function(_0x365542){logger[_0x7d33('0x13')]('['+[_0x434dda[_0x7d33('0x14')]()]+']',_0x365542['message']);_0xca52f7(_0x365542);});});}function getUser(_0x2d50a6,_0xf9baa,_0x322bc8){return function(_0x46df01){return new Promise(function(_0x399ccc,_0x575ab1){var _0xdeb700={'method':_0x7d33('0x9'),'uri':_0x322bc8+_0x7d33('0x15'),'json':!![]};_0xdeb700['headers']=_0xf9baa;logger[_0x7d33('0xa')](_0x7d33('0x16'));return rp(_0xdeb700)[_0x7d33('0x17')](function(_0x22dc02){if(_0x22dc02){var _0x9ee42e=_0x22dc02['users'];var _0x3011c5=![];var _0x293b2a=null;if(_0x46df01[_0x7d33('0x18')]!==null){logger[_0x7d33('0xa')](_0x7d33('0x19'),_0x46df01[_0x7d33('0x18')]);_0x46df01['userEmail']=_0x46df01[_0x7d33('0x18')];for(_0x293b2a=0x0;_0x293b2a<_0x9ee42e[_0x7d33('0xd')];_0x293b2a++){if(_0x9ee42e[_0x293b2a][_0x7d33('0xe')]===_0x46df01[_0x7d33('0x18')]){_0x3011c5=!![];_0x46df01['userId']=_0x9ee42e[_0x293b2a]['id'];logger[_0x7d33('0xa')](_0x7d33('0x1a'),_0x46df01['userId']);}}}if(!_0x3011c5){logger[_0x7d33('0xa')](_0x7d33('0x1b'));_0x46df01[_0x7d33('0x1c')]=_0x46df01[_0x7d33('0xf')];_0x46df01['userId']=_0x46df01['adminId'];_0x3011c5=!![];}if(_0x3011c5){_0x399ccc(_0x46df01);}else{_0x575ab1({'statusCode':0x194,'message':_0x7d33('0x12')});}}else{_0x575ab1({'statusCode':0x194,'message':_0x7d33('0x12')});}})[_0x7d33('0x1d')](function(_0x23184f){logger[_0x7d33('0x13')]('['+[_0x2d50a6[_0x7d33('0x14')]()]+']',_0x23184f[_0x7d33('0x1e')]);_0x575ab1(_0x23184f);});});};}function searchContact(_0x36b672,_0x5b7534,_0xfcc98c,_0x535e94){return new Promise(function(_0x5b4c55,_0x4c1031){var _0x57c98d={'method':_0x7d33('0x9'),'headers':_0x5b7534,'uri':_0x36b672+_0x7d33('0x1f')+_0x535e94+_0x7d33('0x20')+_0xfcc98c+_0x7d33('0x21'),'json':!![]};rp(_0x57c98d)[_0x7d33('0x17')](function(_0x218545){var _0x5e31de=_[_0x7d33('0x22')](_0x218545[_0x7d33('0x23')][_0x7d33('0x23')],[_0xfcc98c,_0x535e94]);_0x5b4c55(_0x5e31de);})[_0x7d33('0x1d')](function(_0x464779){_0x4c1031(_0x464779);});});}function getEndUser(_0x418378,_0x575236,_0x5c434c){return function(_0x2d841b){return new Promise(function(_0x3dcd05,_0x98fa26){logger[_0x7d33('0xa')](util[_0x7d33('0x24')](_0x7d33('0x25'),_0x2d841b['contactNumber']));searchContact(_0x5c434c,_0x575236,'mobile_number',_0x2d841b[_0x7d33('0x26')])[_0x7d33('0x17')](function(_0x38c716){if(_0x38c716){_0x2d841b[_0x7d33('0x27')]=_0x38c716['id'];logger[_0x7d33('0xa')](_0x7d33('0x28'),_0x2d841b['endUserId']);return _0x3dcd05(_0x2d841b);}searchContact(_0x5c434c,_0x575236,_0x7d33('0x29'),_0x2d841b[_0x7d33('0x26')])['then'](function(_0x3eb532){if(_0x3eb532){_0x2d841b[_0x7d33('0x27')]=_0x3eb532['id'];logger[_0x7d33('0xa')]('Contact\x20found\x20work_number:',_0x2d841b['endUserId']);return _0x3dcd05(_0x2d841b);}createEndUser(_0x2d841b,_0x418378,_0x575236,_0x5c434c)['then'](function(_0x121e71){logger[_0x7d33('0xa')](_0x7d33('0x2a'),_0x121e71['endUserId']);return _0x3dcd05(_0x121e71);});});})['catch'](function(_0x2bbff4){_0x98fa26(_0x2bbff4);});});};}function createEndUser(_0x54ccfa,_0x59abde,_0x40955f,_0x387af2){return new Promise(function(_0x30909b,_0x1df4ae){var _0x4ec1e3=moment();var _0xa7fbb3={'method':'POST','uri':_0x387af2+'/api/contacts','body':{'contact':{'last_name':_0x54ccfa['contactNumber'],'work_number':_0x54ccfa[_0x7d33('0x26')],'mobile_number':_0x54ccfa[_0x7d33('0x26')],'owner_id':_0x54ccfa['userId'],'created_at':_0x4ec1e3['format'](_0x7d33('0x2b'))}},'json':!![]};_0xa7fbb3[_0x7d33('0x2c')]=_0x40955f;logger[_0x7d33('0xa')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0xa7fbb3)[_0x7d33('0x17')](function(_0x521cfc){_0x54ccfa[_0x7d33('0x27')]=_0x521cfc[_0x7d33('0x2d')]['id'];_0x30909b(_0x54ccfa);})[_0x7d33('0x1d')](function(_0x53039b){logger[_0x7d33('0x13')]('['+[_0x59abde[_0x7d33('0x14')]()]+']',_0x53039b['message']);_0x1df4ae(_0x53039b[_0x7d33('0x1e')]);});});}function getTicket(_0x4a5d95,_0x4f0230,_0x4e270f,_0x1add16,_0x552a45){return function(_0x2ff198){logger[_0x7d33('0xa')](_0x7d33('0x2e'));return new Promise(function(_0x321e82,_0x1cb058){var _0x10e1bd=moment();var _0x121bcf={'method':_0x7d33('0x2f'),'uri':_0x4e270f+_0x7d33('0x30'),'body':{'title':intUtil[_0x7d33('0x31')](_0x1add16['Subjects'],_0x552a45,'\x20'),'description':intUtil[_0x7d33('0x31')](_0x1add16['Descriptions'],_0x552a45,'\x0a'),'owner_id':_0x2ff198[_0x7d33('0x32')],'creater_id':_0x2ff198[_0x7d33('0x10')],'targetable_id':_0x2ff198[_0x7d33('0x27')],'targetable_type':_0x7d33('0x33'),'created_at':_0x10e1bd[_0x7d33('0x24')](_0x7d33('0x2b')),'due_date':_0x10e1bd[_0x7d33('0x34')](0x1e,'m')['format'](_0x7d33('0x2b'))},'json':!![]};_0x121bcf['headers']=_0x4f0230;return rp(_0x121bcf)['then'](function(_0x22f8cb){_0x2ff198[_0x7d33('0x35')]=_0x22f8cb['task']['id'];logger['info'](_0x7d33('0x36'),_0x2ff198[_0x7d33('0x35')]);_0x321e82(_0x2ff198);})[_0x7d33('0x1d')](function(_0x4f3986){logger[_0x7d33('0x13')]('['+[_0x4a5d95['toUpperCase']()]+']',_0x4f3986['message']);_0x1cb058(_0x4f3986[_0x7d33('0x1e')]);});});};}function emit(_0x55a917,_0x59d03b,_0x17f530){var _0x2ae01f={'uri':_0x55a917+'/contacts/'+_0x17f530};io['to'](util['format'](_0x7d33('0x37'),_0x59d03b))[_0x7d33('0x38')](_0x7d33('0x39'),_0x2ae01f);}exports['cs']=function(_0x70e90c,_0x3da46f,_0x486999,_0x57bcfe,_0x69ce8b,_0x28a544,_0x4c7848,_0x145353){var _0x1858d7={};var _0x3d60c7={'Authorization':_0x7d33('0x3a')+_0x28a544[_0x7d33('0x3b')]};_0x28a544[_0x7d33('0x3c')]=intUtil[_0x7d33('0x3d')](_0x28a544[_0x7d33('0x3c')]);_0x28a544[_0x7d33('0x3e')]=intUtil[_0x7d33('0x3d')](_0x28a544[_0x7d33('0x3e')]);var _0x38d2e5=_0x28a544['remoteUri'];_0x1858d7[_0x7d33('0xf')]=_0x28a544[_0x7d33('0x3f')];_0x1858d7['contactNumber']=_0x145353['toLowerCase']()==='outbound'?_0x3da46f['destcalleridnum']:_0x3da46f[_0x7d33('0x40')];_0x1858d7[_0x7d33('0x41')]=_0x145353===_0x7d33('0x42')||_0x145353===_0x7d33('0x43')?_0x7d33('0x42'):'outbound';if(_0x57bcfe){_0x1858d7[_0x7d33('0x18')]=_0x57bcfe['email'];}var _0x2263ee=util[_0x7d33('0x24')](_0x7d33('0x44'),_0x28a544[_0x7d33('0x3e')],_0x3da46f[_0x7d33('0x45')],md5(_0x3da46f[_0x7d33('0x45')]));if(_0x69ce8b&&_0x69ce8b[_0x7d33('0x46')]){logger['info']('[QUEUE]',_0x7d33('0x47'));_0x3da46f['recordingURL']=_0x2263ee;}else if(_0x4c7848&&_0x4c7848[_0x7d33('0x48')]&&_0x4c7848['recordingFormat']!==_0x7d33('0x49')){logger['info']('[OUTBOUND]',_0x7d33('0x47'));_0x3da46f['recordingURL']=_0x2263ee;}else{_0x3da46f[_0x7d33('0x4a')]='';}return getAdminId(_0x1858d7,_0x145353,_0x3d60c7,_0x38d2e5)['then'](getUser(_0x145353,_0x3d60c7,_0x38d2e5))['then'](getEndUser(_0x145353,_0x3d60c7,_0x38d2e5))[_0x7d33('0x17')](getTicket(_0x145353,_0x3d60c7,_0x38d2e5,_0x486999,_0x3da46f))[_0x7d33('0x17')](function(_0x11941f){logger[_0x7d33('0xa')](util[_0x7d33('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x11941f['ticketId']));if(_0x145353!==_0x7d33('0x43')){logger[_0x7d33('0xa')]('['+[_0x145353[_0x7d33('0x14')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x38d2e5,_0x57bcfe[_0x7d33('0x4b')],_0x11941f['endUserId']);}})[_0x7d33('0x1d')](function(_0x560e62){logger[_0x7d33('0x13')]('['+[_0x145353['toUpperCase']()]+_0x7d33('0x4c'),util['inspect'](_0x560e62,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 4a90a00..e14ea1f 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd110=['unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','log','unmanaged','salesforce'];(function(_0x2eef1a,_0x5d56e5){var _0x8cb2ea=function(_0x540253){while(--_0x540253){_0x2eef1a['push'](_0x2eef1a['shift']());}};_0x8cb2ea(++_0x5d56e5);}(_0xd110,0x19e));var _0x0d11=function(_0xab4301,_0x2a4d28){_0xab4301=_0xab4301-0x0;var _0x25a115=_0xd110[_0xab4301];return _0x25a115;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var zendesk=require(_0x0d11('0x2'));var salesforce=require(_0x0d11('0x3'));var sugarcrm=require(_0x0d11('0x4'));var freshdesk=require(_0x0d11('0x5'));var zoho=require('./zoho');var desk=require(_0x0d11('0x6'));var vtiger=require(_0x0d11('0x7'));var servicenow=require(_0x0d11('0x8'));var dynamics365=require(_0x0d11('0x9'));var freshsales=require(_0x0d11('0xa'));var integrations=[_0x0d11('0xb'),'salesforce',_0x0d11('0xc'),'freshdesk',_0x0d11('0xd'),_0x0d11('0xe'),_0x0d11('0xf'),_0x0d11('0x10'),'freshsales',_0x0d11('0x11')];exports[_0x0d11('0x12')]=function(_0x5079e5,_0x4f7c30,_0x53a123,_0x17c017,_0x57ccbd,_0x3d3bb4){if(_0x53a123){if(_[_0x0d11('0x13')](integrations,_0x5079e5[_0x0d11('0x14')][_0x0d11('0x15')]())){try{var _0x54dce6=null;var _0x2c01b3='';var _0x48f5cf=_0x53a123[_0x5079e5[_0x0d11('0x14')][_0x0d11('0x15')]()];if(_0x48f5cf){var _0x29b91b=_0x48f5cf[_0x5079e5['data2']];if(_0x29b91b){var _0x13798=_[_0x0d11('0x16')](_0x29b91b[_0x0d11('0x17')],{'id':parseInt(_0x5079e5[_0x0d11('0x18')],0xa)});if(_0x13798){if(_0x17c017){if(_0x57ccbd&&_0x4f7c30[_0x0d11('0x19')]){_0x2c01b3='queue';}else if(_0x4f7c30[_0x0d11('0x1a')]){_0x2c01b3='outbound';}else{console[_0x0d11('0x1b')]('EVENT\x20UNKNOWN',_0x4f7c30);}}else{_0x2c01b3=_0x0d11('0x1c');}switch(_0x5079e5[_0x0d11('0x14')][_0x0d11('0x15')]()){case _0x0d11('0xb'):zendesk[_0x2c01b3](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4);break;case _0x0d11('0x1d'):salesforce[_0x2c01b3](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4);break;case _0x0d11('0xc'):sugarcrm[_0x2c01b3](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4);break;case'freshdesk':freshdesk[_0x2c01b3](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4);break;case _0x0d11('0xd'):zoho[_0x2c01b3](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4);break;case _0x0d11('0xe'):desk[_0x2c01b3](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4);break;case'vtiger':vtiger[_0x2c01b3](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4);break;case'freshsales':freshsales['cs'](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4,_0x2c01b3);break;case _0x0d11('0x11'):servicenow['cs'](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4,_0x2c01b3);break;case'dynamics365':dynamics365['cs'](_0x5079e5,_0x4f7c30,_0x13798,_0x17c017,_0x57ccbd,_0x29b91b,_0x3d3bb4,_0x2c01b3);break;default:console['log'](_0x0d11('0x1e'));}}else{_0x54dce6=require(_0x0d11('0x1f'))(_0x5079e5['data1'][_0x0d11('0x15')]());_0x54dce6['error'](_0x0d11('0x20'),util[_0x0d11('0x21')](_0x0d11('0x22'),_0x5079e5[_0x0d11('0x14')][_0x0d11('0x15')](),_0x5079e5[_0x0d11('0x18')]));}}else{_0x54dce6=require('../../../../config/logger')(_0x5079e5[_0x0d11('0x14')][_0x0d11('0x15')]());_0x54dce6[_0x0d11('0x23')](_0x0d11('0x20'),util[_0x0d11('0x21')](_0x0d11('0x24'),_0x5079e5[_0x0d11('0x14')][_0x0d11('0x15')](),_0x5079e5['data2']));}}else{}}catch(_0x46e99e){console[_0x0d11('0x23')](_0x46e99e);}}}}; \ No newline at end of file +var _0x9b0d=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho'];(function(_0x536fe2,_0x142cc1){var _0x5013e3=function(_0x3e2a05){while(--_0x3e2a05){_0x536fe2['push'](_0x536fe2['shift']());}};_0x5013e3(++_0x142cc1);}(_0x9b0d,0x19e));var _0xd9b0=function(_0x3f2730,_0x59fe68){_0x3f2730=_0x3f2730-0x0;var _0x1b5fa0=_0x9b0d[_0x3f2730];return _0x1b5fa0;};'use strict';var _=require(_0xd9b0('0x0'));var util=require(_0xd9b0('0x1'));var zendesk=require(_0xd9b0('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xd9b0('0x3'));var freshdesk=require(_0xd9b0('0x4'));var zoho=require(_0xd9b0('0x5'));var desk=require(_0xd9b0('0x6'));var vtiger=require(_0xd9b0('0x7'));var servicenow=require(_0xd9b0('0x8'));var dynamics365=require(_0xd9b0('0x9'));var freshsales=require(_0xd9b0('0xa'));var integrations=[_0xd9b0('0xb'),_0xd9b0('0xc'),_0xd9b0('0xd'),_0xd9b0('0xe'),_0xd9b0('0xf'),_0xd9b0('0x10'),_0xd9b0('0x11'),_0xd9b0('0x12'),_0xd9b0('0x13'),_0xd9b0('0x14')];exports[_0xd9b0('0x15')]=function(_0x12177a,_0x13b867,_0x518bd3,_0x141bd4,_0x1b02a0,_0x16ae6d){if(_0x518bd3){if(_[_0xd9b0('0x16')](integrations,_0x12177a[_0xd9b0('0x17')]['toLowerCase']())){try{var _0x3df764=null;var _0x37c2e0='';var _0xf2a6a0=_0x518bd3[_0x12177a[_0xd9b0('0x17')][_0xd9b0('0x18')]()];if(_0xf2a6a0){var _0x120fbe=_0xf2a6a0[_0x12177a[_0xd9b0('0x19')]];if(_0x120fbe){var _0x5f3301=_[_0xd9b0('0x1a')](_0x120fbe[_0xd9b0('0x1b')],{'id':parseInt(_0x12177a[_0xd9b0('0x1c')],0xa)});if(_0x5f3301){if(_0x141bd4){if(_0x1b02a0&&_0x13b867[_0xd9b0('0x1d')]){_0x37c2e0='queue';}else if(_0x13b867[_0xd9b0('0x1e')]){_0x37c2e0=_0xd9b0('0x1f');}else{console[_0xd9b0('0x20')](_0xd9b0('0x21'),_0x13b867);}}else{_0x37c2e0=_0xd9b0('0x22');}switch(_0x12177a['data1'][_0xd9b0('0x18')]()){case'zendesk':zendesk[_0x37c2e0](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d);break;case _0xd9b0('0xc'):salesforce[_0x37c2e0](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d);break;case _0xd9b0('0xd'):sugarcrm[_0x37c2e0](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d);break;case _0xd9b0('0xe'):freshdesk[_0x37c2e0](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d);break;case _0xd9b0('0xf'):zoho[_0x37c2e0](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d);break;case _0xd9b0('0x10'):desk[_0x37c2e0](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d);break;case _0xd9b0('0x11'):vtiger[_0x37c2e0](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d);break;case'freshsales':freshsales['cs'](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d,_0x37c2e0);break;case _0xd9b0('0x14'):servicenow['cs'](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d,_0x37c2e0);break;case _0xd9b0('0x12'):dynamics365['cs'](_0x12177a,_0x13b867,_0x5f3301,_0x141bd4,_0x1b02a0,_0x120fbe,_0x16ae6d,_0x37c2e0);break;default:console[_0xd9b0('0x20')](_0xd9b0('0x23'));}}else{_0x3df764=require('../../../../config/logger')(_0x12177a['data1'][_0xd9b0('0x18')]());_0x3df764[_0xd9b0('0x24')](_0xd9b0('0x25'),util['format'](_0xd9b0('0x26'),_0x12177a[_0xd9b0('0x17')][_0xd9b0('0x18')](),_0x12177a[_0xd9b0('0x1c')]));}}else{_0x3df764=require(_0xd9b0('0x27'))(_0x12177a[_0xd9b0('0x17')]['toLowerCase']());_0x3df764[_0xd9b0('0x24')]('[EXEC]',util[_0xd9b0('0x28')](_0xd9b0('0x29'),_0x12177a[_0xd9b0('0x17')]['toLowerCase'](),_0x12177a[_0xd9b0('0x19')]));}}else{}}catch(_0x3abc6a){console[_0xd9b0('0x24')](_0x3abc6a);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index a5a4ad8..689f3f4 100644 --- a/server/services/ami/trigger/integration/salesforce.js +++ b/server/services/ami/trigger/integration/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4f7=['recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','getString','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','account','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','find','Lead','account_contact_lead','additionalSearchAccount','Contact','additionalSearchLead','Account','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','Name','upperFirst','forEach','string','picklist','idField','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0xc4f7,0x1a6));var _0x7c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7c4f('0x0'));var rp=require(_0x7c4f('0x1'));var moment=require(_0x7c4f('0x2'));var BPromise=require(_0x7c4f('0x3'));var md5=require(_0x7c4f('0x4'));var jsforce=require(_0x7c4f('0x5'));var util=require(_0x7c4f('0x6'));var Redis=require(_0x7c4f('0x7'));var intUtil=require(_0x7c4f('0x8'));var config=require(_0x7c4f('0x9'));var logger=require(_0x7c4f('0xa'))(_0x7c4f('0xb'));config[_0x7c4f('0xc')]=_['defaults'](config[_0x7c4f('0xc')],{'host':_0x7c4f('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c4f('0xc')]));function emit(_0x33867d,_0x3d757d,_0x5a35eb){io['to'](_0x33867d)['emit'](_0x3d757d,_0x5a35eb);}function getTicket(_0x4ab39f,_0x22e7f9,_0x6dc69e,_0x894780,_0x57079d,_0x3312e3,_0x25ac6a,_0x229a35){var _0x38db7a=Object['assign']({},{'OwnerId':_0x22e7f9['id'],'Subject':intUtil[_0x7c4f('0xe')](_0x894780['Subjects'],_0x57079d,'\x20'),'Description':intUtil[_0x7c4f('0xe')](_0x894780[_0x7c4f('0xf')],_0x57079d,'\x0a')},getCustomFields(_0x3312e3,_0x57079d));if(_0x6dc69e){if(_0x894780[_0x7c4f('0x10')]==='Task'){_0x38db7a[_0x7c4f('0x11')]=moment[_0x7c4f('0x12')]();_0x38db7a['IsReminderSet']=![];_0x38db7a[_0x7c4f('0x13')]=![];if(_0x6dc69e[_0x7c4f('0x14')]===_0x7c4f('0x15')||_0x6dc69e['endUserType']==='lead'){_0x38db7a[_0x7c4f('0x16')]=_0x6dc69e['id'];}else if(_0x6dc69e[_0x7c4f('0x14')]===_0x7c4f('0x17')){_0x38db7a['WhatId']=_0x6dc69e['id'];}}else if(_0x894780[_0x7c4f('0x10')]===_0x7c4f('0x18')){if(_0x6dc69e[_0x7c4f('0x14')]===_0x7c4f('0x15')){_0x38db7a[_0x7c4f('0x19')]=_0x6dc69e['id'];}else if(_0x6dc69e[_0x7c4f('0x14')]==='account'){_0x38db7a[_0x7c4f('0x1a')]=_0x6dc69e['id'];}else if(_0x6dc69e['endUserType']===_0x7c4f('0x1b')&&_0x894780[_0x7c4f('0x1c')]){_0x38db7a[_0x894780[_0x7c4f('0x1c')]]=_0x6dc69e['id'];}else{logger[_0x7c4f('0x1d')](_0x7c4f('0x1e'));}}}return _0x25ac6a['sobject'](_0x894780[_0x7c4f('0x10')])[_0x7c4f('0x1f')](_0x38db7a);}function getUser(_0x4a169f,_0x5c3412,_0x4376aa){if(!_[_0x7c4f('0x20')](_0x5c3412)&&intUtil[_0x7c4f('0x21')](_0x5c3412)){var _0x116763={'Email':_0x5c3412};var _0x13a22a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4376aa[_0x7c4f('0x22')](_0x7c4f('0x23'))['find'](_0x116763,_0x13a22a)[_0x7c4f('0x24')]()[_0x7c4f('0x25')](function(_0x4d8436){if(_0x4d8436[_0x7c4f('0x26')]){var _0x148f02=_['find'](_0x4d8436,function(_0x41c611){return _0x41c611[_0x7c4f('0x27')]===_0x5c3412;});if(_0x148f02){logger[_0x7c4f('0x1d')](_0x7c4f('0x28'),_0x5c3412);return BPromise[_0x7c4f('0x29')]({'id':_0x148f02['Id'],'name':_0x148f02['Name']});}}else{logger[_0x7c4f('0x1d')](_0x7c4f('0x2a'),_0x5c3412);return _0x4376aa[_0x7c4f('0x2b')]()[_0x7c4f('0x25')](function(_0x120fce){return BPromise[_0x7c4f('0x29')]({'id':_0x120fce[_0x7c4f('0x2c')],'name':_0x120fce[_0x7c4f('0x2d')]});});}});}else{logger['info'](_0x7c4f('0x2a'),_0x5c3412);return _0x4376aa[_0x7c4f('0x2b')]()[_0x7c4f('0x25')](function(_0x446ef0){return BPromise['resolve']({'id':_0x446ef0[_0x7c4f('0x2c')],'name':_0x446ef0[_0x7c4f('0x2d')]});});}}function getEndUser(_0x47925c,_0x1ec863,_0x2d826a,_0x3bce29,_0x1e1665){var _0x14db8c={'$or':{'Phone':_0x3bce29}};var _0x3bb132={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7c4f('0x29')]()[_0x7c4f('0x25')](function(){logger['info'](_0x7c4f('0x2e'),_0x3bce29,_0x1ec863[_0x7c4f('0x2f')]);switch(_0x1ec863['moduleSearch']){case _0x7c4f('0x30'):var _0x205ee0=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863[_0x7c4f('0x32')]){var _0x42f124={};_0x42f124[_0x1ec863[_0x7c4f('0x32')]]=_0x3bce29;_[_0x7c4f('0x33')](_0x205ee0[_0x7c4f('0x34')],_0x42f124);}return _0x1e1665[_0x7c4f('0x22')]('Contact')[_0x7c4f('0x35')](_0x205ee0,_0x3bb132)[_0x7c4f('0x24')]()[_0x7c4f('0x25')](function(_0x3b2f31){if(_0x3b2f31&&_0x3b2f31[_0x7c4f('0x26')]){return _0x3b2f31;}else{var _0x27bf79=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863['additionalSearchLead']){var _0x550fb7={};_0x550fb7[_0x1ec863['additionalSearchLead']]=_0x3bce29;_[_0x7c4f('0x33')](_0x27bf79['$or'],_0x550fb7);}return _0x1e1665[_0x7c4f('0x22')](_0x7c4f('0x36'))['find'](_0x27bf79,_0x3bb132);}});case _0x7c4f('0x37'):var _0x4d364c=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863[_0x7c4f('0x38')]){var _0x42f124={};_0x42f124[_0x1ec863[_0x7c4f('0x38')]]=_0x3bce29;_[_0x7c4f('0x33')](_0x4d364c[_0x7c4f('0x34')],_0x42f124);}return _0x1e1665[_0x7c4f('0x22')]('Account')['find'](_0x4d364c,_0x3bb132)[_0x7c4f('0x24')]()[_0x7c4f('0x25')](function(_0x4eded4){if(_0x4eded4&&_0x4eded4[_0x7c4f('0x26')]){return _0x4eded4;}else{var _0x1fed80=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863['additionalSearchContact']){var _0x3be7a0={};_0x3be7a0[_0x1ec863['additionalSearchContact']]=_0x3bce29;_['merge'](_0x1fed80['$or'],_0x3be7a0);}return _0x1e1665[_0x7c4f('0x22')](_0x7c4f('0x39'))['find'](_0x1fed80,_0x3bb132)[_0x7c4f('0x25')](function(_0x25beca){if(_0x25beca&&_0x25beca['length']){return _0x25beca;}else{var _0x5c466e=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863[_0x7c4f('0x3a')]){var _0x517f21={};_0x517f21[_0x1ec863[_0x7c4f('0x3a')]]=_0x3bce29;_['merge'](_0x5c466e[_0x7c4f('0x34')],_0x517f21);}return _0x1e1665['sobject']('Lead')[_0x7c4f('0x35')](_0x5c466e,_0x3bb132);}});}});case _0x7c4f('0x15'):var _0x205ee0=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863['additionalSearchContact']){var _0x42f124={};_0x42f124[_0x1ec863[_0x7c4f('0x32')]]=_0x3bce29;_[_0x7c4f('0x33')](_0x205ee0[_0x7c4f('0x34')],_0x42f124);}return _0x1e1665['sobject'](_0x7c4f('0x39'))['find'](_0x205ee0,_0x3bb132)[_0x7c4f('0x24')]();case'lead':var _0x4be83f=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863['additionalSearchLead']){var _0x42f124={};_0x42f124[_0x1ec863[_0x7c4f('0x3a')]]=_0x3bce29;_[_0x7c4f('0x33')](_0x4be83f[_0x7c4f('0x34')],_0x42f124);}return _0x1e1665['sobject'](_0x7c4f('0x36'))['find'](_0x4be83f,_0x3bb132);case _0x7c4f('0x17'):var _0x4d364c=_[_0x7c4f('0x31')](_0x14db8c);if(_0x1ec863['additionalSearchAccount']){var _0x42f124={};_0x42f124[_0x1ec863[_0x7c4f('0x38')]]=_0x3bce29;_['merge'](_0x4d364c[_0x7c4f('0x34')],_0x42f124);}return _0x1e1665['sobject'](_0x7c4f('0x3b'))[_0x7c4f('0x35')](_0x4d364c,_0x3bb132);default:return null;}})[_0x7c4f('0x25')](function(_0xa590e){if(_0xa590e&&_0xa590e['length']){var _0x1b1b71=_['first'](_0xa590e);if(_0x1b1b71){return BPromise['resolve']({'id':_0x1b1b71['Id'],'name':_0x1b1b71['Name'],'phone':_0x1b1b71[_0x7c4f('0x3c')],'endUserType':_0x1b1b71[_0x7c4f('0x3d')][_0x7c4f('0x3e')][_0x7c4f('0x3f')]()});}}})['then'](function(_0x9e3ea5){if(_0x9e3ea5){logger[_0x7c4f('0x1d')](_0x7c4f('0x40'),_0x9e3ea5[_0x7c4f('0x14')],_0x3bce29);return BPromise[_0x7c4f('0x29')](_0x9e3ea5);}else{logger[_0x7c4f('0x1d')](_0x7c4f('0x41'),_0x3bce29);var _0x7092a={'Phone':_0x3bce29};if(_0x1ec863[_0x7c4f('0x42')]){if(_0x1ec863[_0x7c4f('0x42')]===_0x7c4f('0x15')){logger[_0x7c4f('0x1d')](_0x7c4f('0x43'),_0x3bce29,_0x1ec863[_0x7c4f('0x42')]);_0x7092a[_0x7c4f('0x44')]=_0x2d826a!==_0x7c4f('0x45')?_0x2d826a:util[_0x7c4f('0x46')](_0x7c4f('0x47'),_0x3bce29);}else if(_0x1ec863['moduleCreate']==='lead'){logger[_0x7c4f('0x1d')](_0x7c4f('0x43'),_0x3bce29,_0x1ec863[_0x7c4f('0x42')]);_0x7092a['LastName']=_0x2d826a!==_0x7c4f('0x45')?_0x2d826a:util[_0x7c4f('0x46')](_0x7c4f('0x47'),_0x3bce29);_0x7092a[_0x7c4f('0x48')]='No\x20Company';}else if(_0x1ec863[_0x7c4f('0x42')]===_0x7c4f('0x17')){logger[_0x7c4f('0x1d')](_0x7c4f('0x43'),_0x3bce29,_0x1ec863[_0x7c4f('0x42')]);_0x7092a[_0x7c4f('0x49')]=_0x2d826a!==_0x7c4f('0x45')?_0x2d826a:util[_0x7c4f('0x46')](_0x7c4f('0x47'),_0x3bce29);}else{return null;}}return _0x1e1665['sobject'](_[_0x7c4f('0x4a')](_0x1ec863[_0x7c4f('0x42')]))[_0x7c4f('0x1f')](_0x7092a)['then'](function(_0x598615){return BPromise[_0x7c4f('0x29')]({'id':_0x598615['id'],'endUserType':_0x1ec863[_0x7c4f('0x42')]});});}});}function getCustomFields(_0x3e582a,_0x5985ca){var _0x32337b={};if(_0x3e582a[_0x7c4f('0x26')]>0x0){_[_0x7c4f('0x4b')](_0x3e582a,function(_0x181961){if(_['includes']([_0x7c4f('0x4c'),_0x7c4f('0x4d')],_0x181961['type'])&&_0x181961[_0x7c4f('0x4e')]){_0x32337b[_0x181961[_0x7c4f('0x4e')]]=_0x181961['content'][_0x7c4f('0x4f')]();}else if(_0x181961[_0x7c4f('0x3e')]===_0x7c4f('0x50')&&_0x181961[_0x7c4f('0x51')]&&_0x181961[_0x7c4f('0x4e')]){_0x5985ca[_0x181961[_0x7c4f('0x51')]]&&(_0x32337b[_0x181961['idField']]=_0x5985ca[_0x181961[_0x7c4f('0x51')]][_0x7c4f('0x4f')]());}else if(_0x181961['type']==='customVariable'&&_0x181961['Variable']&&_0x181961[_0x7c4f('0x52')][_0x7c4f('0x53')]&&_0x181961['idField']){_0x5985ca[_0x181961[_0x7c4f('0x52')][_0x7c4f('0x53')][_0x7c4f('0x3f')]()]&&(_0x32337b[_0x181961[_0x7c4f('0x4e')]]=_0x5985ca[_0x181961[_0x7c4f('0x52')]['name'][_0x7c4f('0x3f')]()][_0x7c4f('0x4f')]());}});}return _0x32337b;}function getConnection(_0x3c213c){var _0x18b62a=_0x3c213c[_0x7c4f('0x54')][_0x7c4f('0x55')](_0x3c213c[_0x7c4f('0x56')]);var _0x4379fe=new jsforce[(_0x7c4f('0x57'))]({'oauth2':{'loginUrl':_0x3c213c[_0x7c4f('0x58')]||_0x7c4f('0x59'),'clientId':_0x3c213c[_0x7c4f('0x5a')],'clientSecret':_0x3c213c[_0x7c4f('0x5b')]}});return _0x4379fe[_0x7c4f('0x5c')](_0x3c213c[_0x7c4f('0x5d')],_0x18b62a)['then'](function(){logger['info'](_0x7c4f('0x5e'));return _0x4379fe;});}exports['queue']=function(_0x8ad38e,_0x319ddd,_0x505f22,_0x25114e,_0xc01156,_0x48a7a5){var _0x36cab7,_0x480d15,_0x102244,_0x548192;_0x48a7a5[_0x7c4f('0x5f')]=intUtil[_0x7c4f('0x60')](_0x48a7a5[_0x7c4f('0x5f')]);_0x48a7a5['remoteUri']=intUtil[_0x7c4f('0x60')](_0x48a7a5[_0x7c4f('0x58')]);if(_0xc01156&&_0xc01156[_0x7c4f('0x61')]){logger[_0x7c4f('0x1d')](_0x7c4f('0x62'),_0x7c4f('0x63'));_0x319ddd['recordingURL']=util[_0x7c4f('0x46')](_0x7c4f('0x64'),_0x48a7a5['serverUrl'],_0x319ddd['uniqueid'],md5(_0x319ddd[_0x7c4f('0x65')]));}else{_0x319ddd[_0x7c4f('0x66')]='';}return getConnection(_0x48a7a5)[_0x7c4f('0x25')](function(_0x19b185){_0x548192=_0x19b185;return getUser(_0x48a7a5,_0x25114e[_0x7c4f('0x67')],_0x548192);})[_0x7c4f('0x25')](function(_0x598560){_0x36cab7=_0x598560;return getEndUser(_0x48a7a5,_0x505f22,_0x319ddd[_0x7c4f('0x68')],_0x319ddd[_0x7c4f('0x69')],_0x548192);})[_0x7c4f('0x25')](function(_0xf93337){_0x480d15=_0xf93337;return getTicket(_0x48a7a5,_0x36cab7,_0x480d15,_0x505f22,_0x319ddd,_0x505f22[_0x7c4f('0x6a')],_0x548192,_0x7c4f('0x6b'));})[_0x7c4f('0x25')](function(_0x4b6148){_0x102244=_0x4b6148;logger[_0x7c4f('0x1d')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x102244['id']);logger[_0x7c4f('0x1d')](_0x7c4f('0x6c'),_0x102244['id'],_0x25114e['name'],_0x48a7a5['type']);switch(_0x48a7a5[_0x7c4f('0x3e')]){case _0x7c4f('0x6d'):emit(util[_0x7c4f('0x46')](_0x7c4f('0x6e'),_0x25114e[_0x7c4f('0x53')]),'trigger:salesforce:display',{'recordId':_0x102244['id']});break;case'newTab':emit(util[_0x7c4f('0x46')]('user:%s',_0x25114e[_0x7c4f('0x53')]),_0x7c4f('0x6f'),{'uri':util[_0x7c4f('0x46')](_0x7c4f('0x70'),_0x548192[_0x7c4f('0x71')],_0x102244['id'])});break;default:logger[_0x7c4f('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x7c4f('0x73')](function(_0xc3c631){logger[_0x7c4f('0x72')](_0x7c4f('0x62'),_0xc3c631);});};exports[_0x7c4f('0x74')]=function(_0x3671aa,_0x95234a,_0x3271bc,_0x44531a,_0x2ba843,_0x37a5b0,_0x35600a){var _0x33cbf5,_0x2ee4f8,_0x564967,_0x288147;_0x37a5b0[_0x7c4f('0x5f')]=intUtil[_0x7c4f('0x60')](_0x37a5b0['serverUrl']);_0x37a5b0[_0x7c4f('0x58')]=intUtil['stripTrailingSlash'](_0x37a5b0[_0x7c4f('0x58')]);if(_0x35600a&&_0x35600a['recordingFormat']&&_0x35600a[_0x7c4f('0x75')]!==_0x7c4f('0x76')){logger[_0x7c4f('0x1d')](_0x7c4f('0x77'),_0x7c4f('0x63'));_0x95234a['recordingURL']=util[_0x7c4f('0x46')](_0x7c4f('0x64'),_0x37a5b0[_0x7c4f('0x5f')],_0x95234a[_0x7c4f('0x65')],md5(_0x95234a[_0x7c4f('0x65')]));}return getConnection(_0x37a5b0)[_0x7c4f('0x25')](function(_0x1fd0f4){_0x288147=_0x1fd0f4;return getUser(_0x37a5b0,_0x44531a[_0x7c4f('0x67')],_0x288147);})[_0x7c4f('0x25')](function(_0xe2ca78){_0x33cbf5=_0xe2ca78;return getEndUser(_0x37a5b0,_0x3271bc,_0x95234a[_0x7c4f('0x78')],_0x95234a[_0x7c4f('0x79')],_0x288147);})[_0x7c4f('0x25')](function(_0xe18666){_0x2ee4f8=_0xe18666;return getTicket(_0x37a5b0,_0x33cbf5,_0x2ee4f8,_0x3271bc,_0x95234a,_0x3271bc[_0x7c4f('0x6a')],_0x288147,_0x7c4f('0x74'));})['then'](function(_0x109802){_0x564967=_0x109802;logger[_0x7c4f('0x1d')](_0x7c4f('0x7a'),_0x564967['id']);logger[_0x7c4f('0x1d')](_0x7c4f('0x7b'),_0x564967['id'],_0x44531a['name'],_0x37a5b0['type']);switch(_0x37a5b0[_0x7c4f('0x3e')]){case _0x7c4f('0x6d'):emit(util[_0x7c4f('0x46')](_0x7c4f('0x6e'),_0x44531a[_0x7c4f('0x53')]),_0x7c4f('0x7c'),{'recordId':_0x564967['id']});break;case _0x7c4f('0x7d'):emit(util[_0x7c4f('0x46')](_0x7c4f('0x6e'),_0x44531a[_0x7c4f('0x53')]),_0x7c4f('0x6f'),{'uri':util[_0x7c4f('0x46')](_0x7c4f('0x70'),_0x288147[_0x7c4f('0x71')],_0x564967['id'])});break;default:logger[_0x7c4f('0x72')](_0x7c4f('0x77'),_0x7c4f('0x7e'));}})['catch'](function(_0x2f932c){logger[_0x7c4f('0x72')](_0x7c4f('0x77'),_0x2f932c);});};exports['unmanaged']=function(_0x4e172b,_0x427189,_0x5798e5,_0x40852a,_0x4f322a,_0x16ce9b){var _0x2d0db0,_0x657950,_0x5574a3,_0x26a746;_0x16ce9b['serverUrl']=intUtil[_0x7c4f('0x60')](_0x16ce9b[_0x7c4f('0x5f')]);_0x16ce9b[_0x7c4f('0x58')]=intUtil['stripTrailingSlash'](_0x16ce9b[_0x7c4f('0x58')]);if(_0x4f322a&&_0x4f322a[_0x7c4f('0x61')]){logger['info']('['+_0x427189[_0x7c4f('0x7f')][_0x7c4f('0x80')]()+']',_0x7c4f('0x63'));_0x427189[_0x7c4f('0x66')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16ce9b['serverUrl'],_0x427189[_0x7c4f('0x65')],md5(_0x427189[_0x7c4f('0x65')]));}else{_0x427189[_0x7c4f('0x66')]='';}return getConnection(_0x16ce9b)[_0x7c4f('0x25')](function(_0x1bf0b4){_0x26a746=_0x1bf0b4;if(!_[_0x7c4f('0x20')](_0x40852a)){return getUser(_0x16ce9b,_0x40852a['name'],_0x26a746);}else{return getUser(_0x16ce9b,null,_0x26a746);}})['then'](function(_0x595cfe){_0x2d0db0=_0x595cfe;return getEndUser(_0x16ce9b,_0x5798e5,_0x427189[_0x7c4f('0x68')],_0x427189[_0x7c4f('0x69')],_0x26a746);})[_0x7c4f('0x25')](function(_0x4a3b1d){_0x657950=_0x4a3b1d;return getTicket(_0x16ce9b,_0x2d0db0,_0x657950,_0x5798e5,_0x427189,_0x5798e5[_0x7c4f('0x6a')],_0x26a746);})['then'](function(_0x466523){_0x5574a3=_0x466523;logger['info']('['+_0x427189[_0x7c4f('0x7f')][_0x7c4f('0x80')]()+_0x7c4f('0x81'),_0x5574a3['id']);logger['info']('['+_0x427189['lastevent'][_0x7c4f('0x80')]()+_0x7c4f('0x82'),_0x16ce9b[_0x7c4f('0x3e')]);})[_0x7c4f('0x73')](function(_0x51d02b){logger[_0x7c4f('0x72')]('['+_0x427189[_0x7c4f('0x7f')]['toUpperCase']()+']',_0x51d02b);});}; \ No newline at end of file +var _0xb68f=['display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','first','Phone','attributes','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','type','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','none','[OUTBOUND]','recordingURL','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','jsforce','util','./util','salesforce','redis','localhost','socket.io-emitter','emit','Subjects','getString','ticketType','Task','IsReminderSet','IsRecurrence','contact','endUserType','lead','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','user_id'];(function(_0x4bbc31,_0x733ade){var _0x32049e=function(_0x5ccb79){while(--_0x5ccb79){_0x4bbc31['push'](_0x4bbc31['shift']());}};_0x32049e(++_0x733ade);}(_0xb68f,0xd1));var _0xfb68=function(_0x4453d0,_0x10c417){_0x4453d0=_0x4453d0-0x0;var _0x228ae7=_0xb68f[_0x4453d0];return _0x228ae7;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xfb68('0x0'));var BPromise=require(_0xfb68('0x1'));var md5=require(_0xfb68('0x2'));var jsforce=require(_0xfb68('0x3'));var util=require(_0xfb68('0x4'));var Redis=require('ioredis');var intUtil=require(_0xfb68('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfb68('0x6'));config[_0xfb68('0x7')]=_['defaults'](config['redis'],{'host':_0xfb68('0x8'),'port':0x18eb});var io=require(_0xfb68('0x9'))(new Redis(config['redis']));function emit(_0x5d4a37,_0x3f0822,_0xb6e102){io['to'](_0x5d4a37)[_0xfb68('0xa')](_0x3f0822,_0xb6e102);}function getTicket(_0x2c266b,_0x2f1ff7,_0xebc0d2,_0x267948,_0x1faff8,_0x5a8b1e,_0x578e45,_0x174a4a){var _0x40a622=Object['assign']({},{'OwnerId':_0x2f1ff7['id'],'Subject':intUtil['getString'](_0x267948[_0xfb68('0xb')],_0x1faff8,'\x20'),'Description':intUtil[_0xfb68('0xc')](_0x267948['Descriptions'],_0x1faff8,'\x0a')},getCustomFields(_0x5a8b1e,_0x1faff8));if(_0xebc0d2){if(_0x267948[_0xfb68('0xd')]===_0xfb68('0xe')){_0x40a622['ActivityDate']=moment['utc']();_0x40a622[_0xfb68('0xf')]=![];_0x40a622[_0xfb68('0x10')]=![];if(_0xebc0d2['endUserType']===_0xfb68('0x11')||_0xebc0d2[_0xfb68('0x12')]===_0xfb68('0x13')){_0x40a622['WhoId']=_0xebc0d2['id'];}else if(_0xebc0d2[_0xfb68('0x12')]===_0xfb68('0x14')){_0x40a622[_0xfb68('0x15')]=_0xebc0d2['id'];}}else if(_0x267948[_0xfb68('0xd')]===_0xfb68('0x16')){if(_0xebc0d2[_0xfb68('0x12')]===_0xfb68('0x11')){_0x40a622[_0xfb68('0x17')]=_0xebc0d2['id'];}else if(_0xebc0d2['endUserType']==='account'){_0x40a622[_0xfb68('0x18')]=_0xebc0d2['id'];}else if(_0xebc0d2[_0xfb68('0x12')]===_0xfb68('0x13')&&_0x267948[_0xfb68('0x19')]){_0x40a622[_0x267948['leadId']]=_0xebc0d2['id'];}else{logger[_0xfb68('0x1a')](_0xfb68('0x1b'));}}}return _0x578e45[_0xfb68('0x1c')](_0x267948[_0xfb68('0xd')])[_0xfb68('0x1d')](_0x40a622);}function getUser(_0x5f346f,_0x163652,_0x22ed19){if(!_[_0xfb68('0x1e')](_0x163652)&&intUtil[_0xfb68('0x1f')](_0x163652)){var _0xbdebfc={'Email':_0x163652};var _0x2a306a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x22ed19[_0xfb68('0x1c')](_0xfb68('0x20'))[_0xfb68('0x21')](_0xbdebfc,_0x2a306a)[_0xfb68('0x22')]()[_0xfb68('0x23')](function(_0x4e1acd){if(_0x4e1acd[_0xfb68('0x24')]){var _0x393530=_['find'](_0x4e1acd,function(_0x45dc4e){return _0x45dc4e['Email']===_0x163652;});if(_0x393530){logger['info'](_0xfb68('0x25'),_0x163652);return BPromise[_0xfb68('0x26')]({'id':_0x393530['Id'],'name':_0x393530[_0xfb68('0x27')]});}}else{logger[_0xfb68('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x163652);return _0x22ed19['identity']()[_0xfb68('0x23')](function(_0x1ab0da){return BPromise['resolve']({'id':_0x1ab0da[_0xfb68('0x28')],'name':_0x1ab0da[_0xfb68('0x29')]});});}});}else{logger[_0xfb68('0x1a')](_0xfb68('0x2a'),_0x163652);return _0x22ed19[_0xfb68('0x2b')]()[_0xfb68('0x23')](function(_0x183aae){return BPromise['resolve']({'id':_0x183aae[_0xfb68('0x28')],'name':_0x183aae[_0xfb68('0x29')]});});}}function getEndUser(_0x1e9ded,_0x1e6657,_0x41f6e9,_0x59e687,_0xaa83ff){var _0x58f8a5={'$or':{'Phone':_0x59e687}};var _0x2dec79={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfb68('0x26')]()[_0xfb68('0x23')](function(){logger[_0xfb68('0x1a')](_0xfb68('0x2c'),_0x59e687,_0x1e6657[_0xfb68('0x2d')]);switch(_0x1e6657['moduleSearch']){case _0xfb68('0x2e'):var _0x2da007=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657[_0xfb68('0x30')]){var _0x5ec282={};_0x5ec282[_0x1e6657['additionalSearchContact']]=_0x59e687;_[_0xfb68('0x31')](_0x2da007[_0xfb68('0x32')],_0x5ec282);}return _0xaa83ff[_0xfb68('0x1c')](_0xfb68('0x33'))[_0xfb68('0x21')](_0x2da007,_0x2dec79)['execute']()['then'](function(_0x57de62){if(_0x57de62&&_0x57de62[_0xfb68('0x24')]){return _0x57de62;}else{var _0x295bd3=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657[_0xfb68('0x34')]){var _0x1bd4fd={};_0x1bd4fd[_0x1e6657[_0xfb68('0x34')]]=_0x59e687;_['merge'](_0x295bd3[_0xfb68('0x32')],_0x1bd4fd);}return _0xaa83ff['sobject'](_0xfb68('0x35'))[_0xfb68('0x21')](_0x295bd3,_0x2dec79);}});case'account_contact_lead':var _0x1a5d95=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657[_0xfb68('0x36')]){var _0x5ec282={};_0x5ec282[_0x1e6657[_0xfb68('0x36')]]=_0x59e687;_[_0xfb68('0x31')](_0x1a5d95[_0xfb68('0x32')],_0x5ec282);}return _0xaa83ff[_0xfb68('0x1c')](_0xfb68('0x37'))[_0xfb68('0x21')](_0x1a5d95,_0x2dec79)[_0xfb68('0x22')]()[_0xfb68('0x23')](function(_0x33e7e8){if(_0x33e7e8&&_0x33e7e8[_0xfb68('0x24')]){return _0x33e7e8;}else{var _0x546d2d=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657['additionalSearchContact']){var _0x297dd1={};_0x297dd1[_0x1e6657['additionalSearchContact']]=_0x59e687;_[_0xfb68('0x31')](_0x546d2d[_0xfb68('0x32')],_0x297dd1);}return _0xaa83ff[_0xfb68('0x1c')]('Contact')[_0xfb68('0x21')](_0x546d2d,_0x2dec79)[_0xfb68('0x23')](function(_0x414d54){if(_0x414d54&&_0x414d54['length']){return _0x414d54;}else{var _0x43c452=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657[_0xfb68('0x34')]){var _0x3bf047={};_0x3bf047[_0x1e6657[_0xfb68('0x34')]]=_0x59e687;_['merge'](_0x43c452[_0xfb68('0x32')],_0x3bf047);}return _0xaa83ff['sobject']('Lead')['find'](_0x43c452,_0x2dec79);}});}});case _0xfb68('0x11'):var _0x2da007=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657[_0xfb68('0x30')]){var _0x5ec282={};_0x5ec282[_0x1e6657[_0xfb68('0x30')]]=_0x59e687;_[_0xfb68('0x31')](_0x2da007[_0xfb68('0x32')],_0x5ec282);}return _0xaa83ff['sobject'](_0xfb68('0x33'))[_0xfb68('0x21')](_0x2da007,_0x2dec79)[_0xfb68('0x22')]();case _0xfb68('0x13'):var _0xd7162e=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657['additionalSearchLead']){var _0x5ec282={};_0x5ec282[_0x1e6657[_0xfb68('0x34')]]=_0x59e687;_[_0xfb68('0x31')](_0xd7162e[_0xfb68('0x32')],_0x5ec282);}return _0xaa83ff[_0xfb68('0x1c')]('Lead')[_0xfb68('0x21')](_0xd7162e,_0x2dec79);case _0xfb68('0x14'):var _0x1a5d95=_[_0xfb68('0x2f')](_0x58f8a5);if(_0x1e6657[_0xfb68('0x36')]){var _0x5ec282={};_0x5ec282[_0x1e6657['additionalSearchAccount']]=_0x59e687;_[_0xfb68('0x31')](_0x1a5d95[_0xfb68('0x32')],_0x5ec282);}return _0xaa83ff[_0xfb68('0x1c')](_0xfb68('0x37'))[_0xfb68('0x21')](_0x1a5d95,_0x2dec79);default:return null;}})[_0xfb68('0x23')](function(_0x2b258c){if(_0x2b258c&&_0x2b258c[_0xfb68('0x24')]){var _0x586670=_[_0xfb68('0x38')](_0x2b258c);if(_0x586670){return BPromise['resolve']({'id':_0x586670['Id'],'name':_0x586670[_0xfb68('0x27')],'phone':_0x586670[_0xfb68('0x39')],'endUserType':_0x586670[_0xfb68('0x3a')]['type'][_0xfb68('0x3b')]()});}}})[_0xfb68('0x23')](function(_0x51d3fe){if(_0x51d3fe){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x51d3fe[_0xfb68('0x12')],_0x59e687);return BPromise['resolve'](_0x51d3fe);}else{logger[_0xfb68('0x1a')](_0xfb68('0x3c'),_0x59e687);var _0x16ce49={'Phone':_0x59e687};if(_0x1e6657[_0xfb68('0x3d')]){if(_0x1e6657[_0xfb68('0x3d')]===_0xfb68('0x11')){logger[_0xfb68('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x59e687,_0x1e6657[_0xfb68('0x3d')]);_0x16ce49[_0xfb68('0x3e')]=_0x41f6e9!==_0xfb68('0x3f')?_0x41f6e9:util[_0xfb68('0x40')]('Caller\x20-\x20%s',_0x59e687);}else if(_0x1e6657[_0xfb68('0x3d')]===_0xfb68('0x13')){logger[_0xfb68('0x1a')](_0xfb68('0x41'),_0x59e687,_0x1e6657['moduleCreate']);_0x16ce49[_0xfb68('0x3e')]=_0x41f6e9!==_0xfb68('0x3f')?_0x41f6e9:util[_0xfb68('0x40')](_0xfb68('0x42'),_0x59e687);_0x16ce49['Company']=_0xfb68('0x43');}else if(_0x1e6657[_0xfb68('0x3d')]===_0xfb68('0x14')){logger[_0xfb68('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x59e687,_0x1e6657[_0xfb68('0x3d')]);_0x16ce49[_0xfb68('0x27')]=_0x41f6e9!==_0xfb68('0x3f')?_0x41f6e9:util['format'](_0xfb68('0x42'),_0x59e687);}else{return null;}}return _0xaa83ff[_0xfb68('0x1c')](_[_0xfb68('0x44')](_0x1e6657[_0xfb68('0x3d')]))['create'](_0x16ce49)[_0xfb68('0x23')](function(_0xd19e8){return BPromise['resolve']({'id':_0xd19e8['id'],'endUserType':_0x1e6657[_0xfb68('0x3d')]});});}});}function getCustomFields(_0x13e256,_0x4a3e42){var _0x31ca67={};if(_0x13e256[_0xfb68('0x24')]>0x0){_[_0xfb68('0x45')](_0x13e256,function(_0x11bb04){if(_[_0xfb68('0x46')](['string','picklist'],_0x11bb04[_0xfb68('0x47')])&&_0x11bb04[_0xfb68('0x48')]){_0x31ca67[_0x11bb04[_0xfb68('0x48')]]=_0x11bb04[_0xfb68('0x49')][_0xfb68('0x4a')]();}else if(_0x11bb04['type']===_0xfb68('0x4b')&&_0x11bb04[_0xfb68('0x4c')]&&_0x11bb04[_0xfb68('0x48')]){_0x4a3e42[_0x11bb04[_0xfb68('0x4c')]]&&(_0x31ca67[_0x11bb04[_0xfb68('0x48')]]=_0x4a3e42[_0x11bb04[_0xfb68('0x4c')]][_0xfb68('0x4a')]());}else if(_0x11bb04[_0xfb68('0x47')]===_0xfb68('0x4d')&&_0x11bb04[_0xfb68('0x4e')]&&_0x11bb04[_0xfb68('0x4e')][_0xfb68('0x4f')]&&_0x11bb04[_0xfb68('0x48')]){_0x4a3e42[_0x11bb04[_0xfb68('0x4e')][_0xfb68('0x4f')][_0xfb68('0x3b')]()]&&(_0x31ca67[_0x11bb04[_0xfb68('0x48')]]=_0x4a3e42[_0x11bb04[_0xfb68('0x4e')][_0xfb68('0x4f')]['toLowerCase']()][_0xfb68('0x4a')]());}});}return _0x31ca67;}function getConnection(_0x47729e){var _0x151e7d=_0x47729e['password'][_0xfb68('0x50')](_0x47729e[_0xfb68('0x51')]);var _0x164456=new jsforce[(_0xfb68('0x52'))]({'oauth2':{'loginUrl':_0x47729e['remoteUri']||_0xfb68('0x53'),'clientId':_0x47729e[_0xfb68('0x54')],'clientSecret':_0x47729e[_0xfb68('0x55')]}});return _0x164456[_0xfb68('0x56')](_0x47729e[_0xfb68('0x57')],_0x151e7d)[_0xfb68('0x23')](function(){logger[_0xfb68('0x1a')](_0xfb68('0x58'));return _0x164456;});}exports[_0xfb68('0x59')]=function(_0x194fb4,_0x48fefa,_0x585357,_0x5ba1db,_0x1bf265,_0x5ac912){var _0x38c625,_0x5f3d9c,_0x2823b7,_0x3968bc;_0x5ac912[_0xfb68('0x5a')]=intUtil[_0xfb68('0x5b')](_0x5ac912['serverUrl']);_0x5ac912[_0xfb68('0x5c')]=intUtil[_0xfb68('0x5b')](_0x5ac912[_0xfb68('0x5c')]);if(_0x1bf265&&_0x1bf265[_0xfb68('0x5d')]){logger[_0xfb68('0x1a')](_0xfb68('0x5e'),_0xfb68('0x5f'));_0x48fefa['recordingURL']=util[_0xfb68('0x40')](_0xfb68('0x60'),_0x5ac912['serverUrl'],_0x48fefa['uniqueid'],md5(_0x48fefa[_0xfb68('0x61')]));}else{_0x48fefa['recordingURL']='';}return getConnection(_0x5ac912)[_0xfb68('0x23')](function(_0x57685b){_0x3968bc=_0x57685b;return getUser(_0x5ac912,_0x5ba1db[_0xfb68('0x62')],_0x3968bc);})['then'](function(_0x10d38b){_0x38c625=_0x10d38b;return getEndUser(_0x5ac912,_0x585357,_0x48fefa[_0xfb68('0x63')],_0x48fefa[_0xfb68('0x64')],_0x3968bc);})[_0xfb68('0x23')](function(_0x3d2300){_0x5f3d9c=_0x3d2300;return getTicket(_0x5ac912,_0x38c625,_0x5f3d9c,_0x585357,_0x48fefa,_0x585357[_0xfb68('0x65')],_0x3968bc,_0xfb68('0x59'));})['then'](function(_0x39f03b){_0x2823b7=_0x39f03b;logger[_0xfb68('0x1a')](_0xfb68('0x66'),_0x2823b7['id']);logger[_0xfb68('0x1a')](_0xfb68('0x67'),_0x2823b7['id'],_0x5ba1db[_0xfb68('0x4f')],_0x5ac912[_0xfb68('0x47')]);switch(_0x5ac912['type']){case _0xfb68('0x68'):emit(util['format'](_0xfb68('0x69'),_0x5ba1db[_0xfb68('0x4f')]),_0xfb68('0x6a'),{'recordId':_0x2823b7['id']});break;case'newTab':emit(util[_0xfb68('0x40')](_0xfb68('0x69'),_0x5ba1db['name']),_0xfb68('0x6b'),{'uri':util[_0xfb68('0x40')](_0xfb68('0x6c'),_0x3968bc[_0xfb68('0x6d')],_0x2823b7['id'])});break;default:logger[_0xfb68('0x6e')](_0xfb68('0x6f'));}})[_0xfb68('0x70')](function(_0x2e6572){logger['error'](_0xfb68('0x5e'),_0x2e6572);});};exports[_0xfb68('0x71')]=function(_0x2467ef,_0x4e3cc0,_0x3ec8d8,_0x11fcfc,_0xd0d759,_0x46abe8,_0x38b997){var _0x18a92b,_0x3790fc,_0x1ee2b7,_0x16529b;_0x46abe8[_0xfb68('0x5a')]=intUtil[_0xfb68('0x5b')](_0x46abe8[_0xfb68('0x5a')]);_0x46abe8[_0xfb68('0x5c')]=intUtil['stripTrailingSlash'](_0x46abe8['remoteUri']);if(_0x38b997&&_0x38b997['recordingFormat']&&_0x38b997['recordingFormat']!==_0xfb68('0x72')){logger[_0xfb68('0x1a')](_0xfb68('0x73'),_0xfb68('0x5f'));_0x4e3cc0[_0xfb68('0x74')]=util['format'](_0xfb68('0x60'),_0x46abe8[_0xfb68('0x5a')],_0x4e3cc0[_0xfb68('0x61')],md5(_0x4e3cc0[_0xfb68('0x61')]));}return getConnection(_0x46abe8)[_0xfb68('0x23')](function(_0x196b81){_0x16529b=_0x196b81;return getUser(_0x46abe8,_0x11fcfc[_0xfb68('0x62')],_0x16529b);})[_0xfb68('0x23')](function(_0x1127b2){_0x18a92b=_0x1127b2;return getEndUser(_0x46abe8,_0x3ec8d8,_0x4e3cc0[_0xfb68('0x75')],_0x4e3cc0['destcalleridnum'],_0x16529b);})[_0xfb68('0x23')](function(_0x25222c){_0x3790fc=_0x25222c;return getTicket(_0x46abe8,_0x18a92b,_0x3790fc,_0x3ec8d8,_0x4e3cc0,_0x3ec8d8['Fields'],_0x16529b,_0xfb68('0x71'));})['then'](function(_0x9c03ca){_0x1ee2b7=_0x9c03ca;logger[_0xfb68('0x1a')](_0xfb68('0x76'),_0x1ee2b7['id']);logger[_0xfb68('0x1a')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1ee2b7['id'],_0x11fcfc[_0xfb68('0x4f')],_0x46abe8[_0xfb68('0x47')]);switch(_0x46abe8[_0xfb68('0x47')]){case _0xfb68('0x68'):emit(util['format'](_0xfb68('0x69'),_0x11fcfc[_0xfb68('0x4f')]),_0xfb68('0x6a'),{'recordId':_0x1ee2b7['id']});break;case _0xfb68('0x77'):emit(util['format']('user:%s',_0x11fcfc[_0xfb68('0x4f')]),_0xfb68('0x6b'),{'uri':util[_0xfb68('0x40')]('%s/%s/e',_0x16529b[_0xfb68('0x6d')],_0x1ee2b7['id'])});break;default:logger[_0xfb68('0x6e')]('[OUTBOUND]',_0xfb68('0x78'));}})[_0xfb68('0x70')](function(_0x19a201){logger['error']('[OUTBOUND]',_0x19a201);});};exports['unmanaged']=function(_0x52d028,_0x4442d0,_0x2d6fe9,_0x347f50,_0x26b90b,_0x2b5674){var _0x10aaad,_0x4c4a47,_0x1623a5,_0x535b8d;_0x2b5674[_0xfb68('0x5a')]=intUtil['stripTrailingSlash'](_0x2b5674[_0xfb68('0x5a')]);_0x2b5674[_0xfb68('0x5c')]=intUtil[_0xfb68('0x5b')](_0x2b5674[_0xfb68('0x5c')]);if(_0x26b90b&&_0x26b90b[_0xfb68('0x5d')]){logger['info']('['+_0x4442d0[_0xfb68('0x79')][_0xfb68('0x7a')]()+']',_0xfb68('0x5f'));_0x4442d0['recordingURL']=util[_0xfb68('0x40')](_0xfb68('0x60'),_0x2b5674['serverUrl'],_0x4442d0[_0xfb68('0x61')],md5(_0x4442d0[_0xfb68('0x61')]));}else{_0x4442d0[_0xfb68('0x74')]='';}return getConnection(_0x2b5674)[_0xfb68('0x23')](function(_0x198d22){_0x535b8d=_0x198d22;if(!_[_0xfb68('0x1e')](_0x347f50)){return getUser(_0x2b5674,_0x347f50[_0xfb68('0x4f')],_0x535b8d);}else{return getUser(_0x2b5674,null,_0x535b8d);}})[_0xfb68('0x23')](function(_0x2f04b9){_0x10aaad=_0x2f04b9;return getEndUser(_0x2b5674,_0x2d6fe9,_0x4442d0[_0xfb68('0x63')],_0x4442d0[_0xfb68('0x64')],_0x535b8d);})['then'](function(_0x5529c8){_0x4c4a47=_0x5529c8;return getTicket(_0x2b5674,_0x10aaad,_0x4c4a47,_0x2d6fe9,_0x4442d0,_0x2d6fe9[_0xfb68('0x65')],_0x535b8d);})[_0xfb68('0x23')](function(_0x4d1f57){_0x1623a5=_0x4d1f57;logger[_0xfb68('0x1a')]('['+_0x4442d0['lastevent'][_0xfb68('0x7a')]()+_0xfb68('0x7b'),_0x1623a5['id']);logger['info']('['+_0x4442d0['lastevent'][_0xfb68('0x7a')]()+_0xfb68('0x7c'),_0x2b5674['type']);})[_0xfb68('0x70')](function(_0x2e4278){logger[_0xfb68('0x6e')]('['+_0x4442d0[_0xfb68('0x79')][_0xfb68('0x7a')]()+']',_0x2e4278);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 8b9208c..248fa4e 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8330=['outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','content','toString','type','idField','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm'];(function(_0xfcdb3f,_0x24387f){var _0x5614bf=function(_0x2850bd){while(--_0x2850bd){_0xfcdb3f['push'](_0xfcdb3f['shift']());}};_0x5614bf(++_0x24387f);}(_0x8330,0x1dc));var _0x0833=function(_0x292d6b,_0xbeb20e){_0x292d6b=_0x292d6b-0x0;var _0x41768b=_0x8330[_0x292d6b];return _0x41768b;};'use strict';var _=require('lodash');var Promise=require(_0x0833('0x0'));var rp=require('request-promise');var util=require('util');var md5=require(_0x0833('0x1'));var Redis=require('ioredis');var intUtil=require(_0x0833('0x2'));var config=require(_0x0833('0x3'));var logger=require(_0x0833('0x4'))(_0x0833('0x5'));config[_0x0833('0x6')]=_[_0x0833('0x7')](config[_0x0833('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0833('0x8'))(new Redis(config[_0x0833('0x6')]));function getAdminUser(_0x5ce48a,_0x290a9f,_0x166a6d,_0x587fb6,_0xb5357d,_0x253280){return new Promise(function(_0x2ce6fe,_0x1f47f2){var _0x448758={'method':_0x0833('0x9'),'uri':_0x587fb6+_0x0833('0xa')+'&'+_0xb5357d+'&'+_0x253280,'auth':_0x290a9f,'json':!![]};return rp(_0x448758)[_0x0833('0xb')](function(_0x568e05){if(_0x568e05['result'][_0x0833('0xc')]>0x0){_0x166a6d['adminId']=_0x568e05[_0x0833('0xd')][0x0][_0x0833('0xe')];}logger[_0x0833('0xf')]('['+[_0x5ce48a[_0x0833('0x10')]()]+_0x0833('0x11'),_0x166a6d);_0x2ce6fe(_0x166a6d);})[_0x0833('0x12')](function(_0x287213){logger['error']('['+[_0x5ce48a['toUpperCase']()]+']',_0x287213[_0x0833('0x13')]);_0x1f47f2(_0x287213[_0x0833('0x13')]);});});}function getUser(_0x27e7a7,_0x50efdd,_0x391908,_0x4a8ac7,_0x4a7dd5){return function(_0x499d64){logger[_0x0833('0xf')]('['+[_0x27e7a7[_0x0833('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x499d64);return new Promise(function(_0x5d76f5,_0x36d472){if(intUtil[_0x0833('0x14')](_0x499d64['userEmail'])){var _0x35b31e={'method':_0x0833('0x9'),'uri':_0x391908+_0x0833('0x15')+_0x499d64[_0x0833('0x16')]+'&'+_0x4a8ac7+'&'+_0x4a7dd5,'auth':_0x50efdd,'json':!![]};logger[_0x0833('0xf')]('['+[_0x27e7a7['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x35b31e);return rp(_0x35b31e)[_0x0833('0xb')](function(_0x4b5df2){logger[_0x0833('0xf')]('['+[_0x27e7a7[_0x0833('0x10')]()]+_0x0833('0x17'),_0x4b5df2);if(_0x4b5df2[_0x0833('0xd')][_0x0833('0xc')]>0x0&&String(_0x4b5df2[_0x0833('0xd')][0x0][_0x0833('0x18')])===_0x0833('0x19')){_0x499d64['userId']=_0x4b5df2[_0x0833('0xd')][0x0][_0x0833('0xe')];}else{_0x499d64[_0x0833('0x1a')]=_0x499d64[_0x0833('0x1b')];_0x499d64['userEmail']=_0x499d64[_0x0833('0x1c')];}logger[_0x0833('0xf')]('['+[_0x27e7a7['toUpperCase']()]+_0x0833('0x1d'),_0x499d64);_0x5d76f5(_0x499d64);})[_0x0833('0x12')](function(_0x557146){logger[_0x0833('0x1e')]('['+[_0x27e7a7['toUpperCase']()]+']',_0x557146['message']);_0x36d472(_0x557146[_0x0833('0x13')]);});}else{logger[_0x0833('0xf')]('['+[_0x27e7a7[_0x0833('0x10')]()]+_0x0833('0x1f'));_0x499d64[_0x0833('0x1a')]=_0x499d64[_0x0833('0x1b')];_0x499d64[_0x0833('0x16')]=_0x499d64[_0x0833('0x1c')];_0x5d76f5(_0x499d64);}});};}function createEndUser(_0x534810,_0x53d191,_0x30c2e1,_0x335b2f,_0x575fd8){logger[_0x0833('0xf')]('['+[_0x534810['toUpperCase']()]+_0x0833('0x20'),_0x30c2e1);return new Promise(function(_0x3ea318,_0x4a0eda){var _0x462302={'method':_0x0833('0x21'),'uri':_0x335b2f+_0x0833('0x22')+_0x575fd8,'body':{'user_name':_0x30c2e1[_0x0833('0x23')],'roles':_0x0833('0x24'),'first_name':_0x30c2e1[_0x0833('0x23')],'active':_0x0833('0x19'),'date_format':_0x0833('0x25'),'phone':_0x30c2e1['endUserNumber']},'auth':_0x53d191,'json':!![]};return rp(_0x462302)[_0x0833('0xb')](function(_0x47e245){logger[_0x0833('0xf')]('['+[_0x534810[_0x0833('0x10')]()]+_0x0833('0x26'),_0x47e245[_0x0833('0xd')]);_0x30c2e1[_0x0833('0x27')]=_0x47e245[_0x0833('0xd')][_0x0833('0xe')];_0x3ea318(_0x30c2e1);})[_0x0833('0x12')](function(_0xf748ed){logger['error']('['+[_0x534810[_0x0833('0x10')]()]+']',_0xf748ed[_0x0833('0x13')]);_0x4a0eda(_0xf748ed[_0x0833('0x13')]);});});}function getEndUser(_0x34a30e,_0x324c47,_0x1ea3c5,_0x4307c,_0x3815a7){return function(_0x28fa37){logger[_0x0833('0xf')]('['+[_0x34a30e[_0x0833('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x28fa37);return new Promise(function(_0x2be8d4,_0x195b56){var _0xb87e6={'method':_0x0833('0x9'),'uri':_0x1ea3c5+_0x0833('0x28')+_0x28fa37['endUserNumber']+'&'+_0x4307c+'&'+_0x3815a7,'auth':_0x324c47,'json':!![]};return rp(_0xb87e6)[_0x0833('0xb')](function(_0x35abba){if(_0x35abba['result']['length']>0x0){_0x28fa37[_0x0833('0x27')]=_0x35abba[_0x0833('0xd')][0x0][_0x0833('0xe')];logger[_0x0833('0xf')]('['+[_0x34a30e[_0x0833('0x10')]()]+_0x0833('0x29'),_0x28fa37);_0x2be8d4(_0x28fa37);}else{return createEndUser(_0x34a30e,_0x324c47,_0x28fa37,_0x1ea3c5,_0x4307c)[_0x0833('0xb')](function(_0x139d0b){logger[_0x0833('0xf')]('['+[_0x34a30e[_0x0833('0x10')]()]+_0x0833('0x2a'),_0x139d0b);_0x2be8d4(_0x139d0b);});}})['catch'](function(_0x5dd62f){logger['error']('['+[_0x34a30e[_0x0833('0x10')]()]+']',_0x5dd62f['message']);_0x195b56(_0x5dd62f['message']);});});};}function getCustomFields(_0x1191aa,_0x18d6d2){var _0x4c1ab1={};if(_0x1191aa[_0x0833('0xc')]>0x0){_[_0x0833('0x2b')](_0x1191aa,function(_0x559b16){if(_[_0x0833('0x2c')]([_0x0833('0x2d'),_0x0833('0x2e')],_0x559b16['type'])&&_0x559b16[_0x0833('0x2f')]&&!_0x559b16[_0x0833('0x30')]){_0x4c1ab1[_0x559b16[_0x0833('0x2f')]['toLowerCase']()]=_0x559b16[_0x0833('0x31')][_0x0833('0x32')]();}else if(_[_0x0833('0x2c')]([_0x0833('0x2d'),_0x0833('0x2e')],_0x559b16[_0x0833('0x33')])&&_0x559b16[_0x0833('0x34')]&&_0x559b16[_0x0833('0x30')]){_0x4c1ab1[_0x559b16['idField'][_0x0833('0x35')]()]=_0x559b16[_0x0833('0x31')][_0x0833('0x32')]();}else if(_0x559b16[_0x0833('0x33')]==='variable'&&_0x559b16['variableName']&&_0x559b16[_0x0833('0x34')]&&_0x559b16['customField']){_0x4c1ab1[_0x559b16[_0x0833('0x34')][_0x0833('0x35')]()]=_0x18d6d2[_0x559b16[_0x0833('0x36')]][_0x0833('0x32')]();}else if(_0x559b16[_0x0833('0x33')]===_0x0833('0x37')&&_0x559b16[_0x0833('0x38')]&&_0x559b16[_0x0833('0x38')][_0x0833('0x39')]&&_0x559b16['idField']&&_0x559b16[_0x0833('0x30')]){_0x4c1ab1[_0x559b16[_0x0833('0x34')][_0x0833('0x35')]()]=_0x18d6d2[_0x559b16[_0x0833('0x38')]['name']['toLowerCase']()]['toString']();}});}return _0x4c1ab1;}function getTicket(_0x50b208,_0x3c6399,_0x1e6d26,_0x20ca0f,_0x1b5a32,_0x46f8c6){return function(_0x8345a8){logger[_0x0833('0xf')]('['+[_0x50b208['toUpperCase']()]+_0x0833('0x3a'),_0x8345a8);return new Promise(function(_0x58ba19,_0x29693c){var _0x3ce0ae=_0x50b208[_0x0833('0x35')]()===_0x0833('0x3b')?_0x8345a8[_0x0833('0x1a')]:_0x8345a8[_0x0833('0x27')];var _0x4ca2d3={'method':_0x0833('0x21'),'uri':_0x1e6d26+_0x0833('0x3c')+'?'+_0x46f8c6,'body':Object[_0x0833('0x3d')]({},{'active':_0x0833('0x19'),'caller_id':_0x3ce0ae,'assigned_to':_0x8345a8['userId'],'short_description':intUtil[_0x0833('0x3e')](_0x20ca0f[_0x0833('0x3f')],_0x1b5a32,'\x20'),'description':intUtil[_0x0833('0x3e')](_0x20ca0f[_0x0833('0x40')],_0x1b5a32,'\x0a')},getCustomFields(_0x20ca0f[_0x0833('0x41')],_0x1b5a32)),'auth':_0x3c6399,'json':!![]};return rp(_0x4ca2d3)[_0x0833('0xb')](function(_0x48e702){logger[_0x0833('0xf')]('['+[_0x50b208[_0x0833('0x10')]()]+_0x0833('0x42'),_0x48e702[_0x0833('0xd')]);_0x8345a8['ticketId']=_0x48e702[_0x0833('0xd')]['sys_id'];_0x8345a8[_0x0833('0x43')]=_0x48e702[_0x0833('0xd')][_0x0833('0x44')];logger[_0x0833('0xf')]('['+[_0x50b208[_0x0833('0x10')]()]+_0x0833('0x45'),_0x8345a8);_0x58ba19(_0x8345a8);})[_0x0833('0x12')](function(_0x32bddd){logger['error']('['+[_0x50b208[_0x0833('0x10')]()]+']',_0x32bddd['message']);_0x29693c(_0x32bddd['message']);});});};}function createRemoteTag(_0x4388c6,_0x579549,_0x360007,_0x5f50a2){return new Promise(function(_0x5dd646,_0x7dc7ae){var _0x3df1e6={'method':_0x0833('0x21'),'uri':_0x360007+_0x0833('0x46')+'?'+_0x5f50a2,'body':{'short_description':_0x4388c6,'global':!![],'active':!![],'name':_0x4388c6},'auth':_0x579549,'json':!![]};return rp(_0x3df1e6)['then'](function(_0x51cf12){var _0x2dbf8f=_0x51cf12[_0x0833('0xd')][_0x0833('0xe')];_0x5dd646(_0x2dbf8f);});});}function getRemoteTag(_0xd888b1,_0x3a0c04,_0x19583b,_0x3b4fef,_0x3c276a){return new Promise(function(_0x112634,_0x121516){var _0x2a3afd={'method':_0x0833('0x9'),'uri':_0x19583b+_0x0833('0x46')+_0x0833('0x47')+_0xd888b1+'&'+_0x3b4fef,'auth':_0x3a0c04,'json':!![]};return rp(_0x2a3afd)[_0x0833('0xb')](function(_0x3eb416){if(_0x3eb416['result'][_0x0833('0xc')]>0x0){var _0x175df0=_0x3eb416[_0x0833('0xd')][0x0]['sys_id'];_0x112634(_0x175df0);}else{return createRemoteTag(_0xd888b1,_0x3a0c04,_0x19583b,_0x3b4fef)[_0x0833('0xb')](function(_0x5e45a9){_0x112634(_0x5e45a9);});}});});}function assignTagToIncident(_0x2ed6a3,_0x1c4817,_0x29f08c,_0x452f7e,_0x2532e3){return new Promise(function(_0x2ea110,_0x49fecd){var _0x2a2e3a={'method':'POST','uri':_0x29f08c+_0x0833('0x48')+'?'+_0x2532e3,'body':{'label':_0x2ed6a3,'table':_0x0833('0x3c'),'id_type':_0x0833('0x49'),'table_key':_0x452f7e[_0x0833('0x4a')],'title':_0x0833('0x4b')+_0x452f7e[_0x0833('0x43')],'id_display':_0x452f7e[_0x0833('0x43')]},'auth':_0x1c4817,'json':!![]};return rp(_0x2a2e3a)[_0x0833('0xb')](function(_0x220838){_0x2ea110();})[_0x0833('0x12')](function(){_0x2ea110();});});}function manageTags(_0x515f73,_0x11f563,_0x21be89,_0x408d61,_0x457ad4,_0x1ffcf1,_0x55e71a){return new Promise(function(_0x1d6a72,_0x4b7790){var _0x2b4deb=[];_0x11f563[_0x0833('0x2b')](function(_0x5d884e){_0x2b4deb[_0x0833('0x4c')](getRemoteTag(_0x5d884e,_0x21be89,_0x408d61,_0x1ffcf1,_0x55e71a));});return Promise[_0x0833('0x4d')](_0x2b4deb)[_0x0833('0xb')](function(_0x1383eb){if(_0x1383eb[_0x0833('0xc')]){logger[_0x0833('0xf')]('['+[_0x515f73[_0x0833('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1383eb);var _0x3bfd5c=[];_0x1383eb['forEach'](function(_0x1dfb8d){_0x3bfd5c[_0x0833('0x4c')](assignTagToIncident(_0x1dfb8d,_0x21be89,_0x408d61,_0x457ad4,_0x1ffcf1));});return Promise['all'](_0x3bfd5c)['then'](function(){_0x1d6a72();})[_0x0833('0x12')](function(){_0x1d6a72();});}else{_0x1d6a72();}});});}function getTags(_0x7a193,_0x4f060c,_0x3feb22,_0x56feae,_0x47a12d,_0x1eca41){return function(_0x55f826){return new Promise(function(_0x138fc3,_0x264998){var _0x2c83c6=[];var _0x218b27=_0x56feae[_0x0833('0x4e')];if(_0x218b27&&_0x218b27[_0x0833('0xc')]>0x0){_0x2c83c6=_[_0x0833('0x4f')](_0x218b27,'name');}if(_0x2c83c6[_0x0833('0xc')]>0x0){return manageTags(_0x7a193,_0x2c83c6,_0x4f060c,_0x3feb22,_0x55f826,_0x47a12d,_0x1eca41)[_0x0833('0xb')](function(){_0x138fc3(_0x55f826);});}else{_0x138fc3(_0x55f826);}});};}function emit(_0x1c797e,_0x39d8c5,_0x1f79f0){var _0x32a10e=_0x0833('0x50')+_0x0833('0x51')+_0x0833('0x52')+_0x0833('0x53');var _0x17d74c={'uri':_0x1c797e+_0x0833('0x54')+_0x1f79f0+_0x32a10e};io['to'](util[_0x0833('0x55')](_0x0833('0x56'),_0x39d8c5))['emit']('trigger:browser:url',_0x17d74c);}exports['cs']=function(_0x28cad0,_0x78515e,_0x5c53c7,_0x1f98f2,_0x561c99,_0x1ba40f,_0x4da71c,_0x279160){var _0x3f6900={};var _0x40fd7d={'user':_0x1ba40f['username'],'pass':_0x1ba40f['password']};var _0x180d12=_0x0833('0x57');var _0x362f4c=_0x0833('0x58');_0x1ba40f[_0x0833('0x59')]=intUtil[_0x0833('0x5a')](_0x1ba40f['remoteUri']);_0x1ba40f['serverUrl']=intUtil[_0x0833('0x5a')](_0x1ba40f[_0x0833('0x5b')]);var _0x2ef389=util[_0x0833('0x55')]('%s/api/now/table/',_0x1ba40f[_0x0833('0x59')]);_0x3f6900[_0x0833('0x16')]=!_['isNil'](_0x1f98f2)?_0x1f98f2[_0x0833('0x5c')]:null;_0x3f6900[_0x0833('0x1c')]=_0x1ba40f['email'];_0x3f6900[_0x0833('0x23')]=_0x279160['toLowerCase']()==='outbound'?_0x78515e[_0x0833('0x5d')]:_0x78515e[_0x0833('0x5e')];_0x3f6900[_0x0833('0x5f')]=_0x279160===_0x0833('0x60')||_0x279160===_0x0833('0x61')?_0x0833('0x60'):_0x0833('0x3b');var _0x460253=util[_0x0833('0x55')](_0x0833('0x62'),_0x1ba40f[_0x0833('0x5b')],_0x78515e[_0x0833('0x63')],md5(_0x78515e[_0x0833('0x63')]));if(_0x561c99&&_0x561c99['monitor_format']){logger[_0x0833('0xf')]('[QUEUE]',_0x0833('0x64'));_0x78515e['recordingURL']=_0x460253;}else if(_0x4da71c&&_0x4da71c[_0x0833('0x65')]&&_0x4da71c['recordingFormat']!=='none'){logger[_0x0833('0xf')](_0x0833('0x66'),_0x0833('0x64'));_0x78515e['recordingURL']=_0x460253;}else{_0x78515e[_0x0833('0x67')]='';}return getAdminUser(_0x279160,_0x40fd7d,_0x3f6900,_0x2ef389,_0x362f4c,_0x180d12)[_0x0833('0xb')](getUser(_0x279160,_0x40fd7d,_0x2ef389,_0x362f4c,_0x180d12))[_0x0833('0xb')](getEndUser(_0x279160,_0x40fd7d,_0x2ef389,_0x362f4c,_0x180d12))[_0x0833('0xb')](getTicket(_0x279160,_0x40fd7d,_0x2ef389,_0x5c53c7,_0x78515e,_0x362f4c))[_0x0833('0xb')](function(_0x305a41){logger[_0x0833('0xf')](util[_0x0833('0x55')](_0x0833('0x68'),_0x305a41[_0x0833('0x4a')]));logger[_0x0833('0xf')](util[_0x0833('0x55')](_0x0833('0x69'),_0x279160));if(_0x279160!=='unmanaged'){logger[_0x0833('0xf')]('['+[_0x279160[_0x0833('0x10')]()]+']',_0x0833('0x6a'));emit(_0x1ba40f[_0x0833('0x59')],_0x1f98f2[_0x0833('0x39')],_0x305a41[_0x0833('0x4a')]);}})[_0x0833('0x12')](function(_0x41ef3f){logger['error']('['+[_0x279160[_0x0833('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x41ef3f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1e86=['error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','length','active','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','true','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','toString','idField','customField','variable','variableName','customVariable','Variable','name','outbound','assign','getString','Subjects','Descriptions','Fields','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','username','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','info','toUpperCase','catch'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x1e86,0x130));var _0x61e8=function(_0x2eaa8f,_0x44cc67){_0x2eaa8f=_0x2eaa8f-0x0;var _0x374f8f=_0x1e86[_0x2eaa8f];return _0x374f8f;};'use strict';var _=require(_0x61e8('0x0'));var Promise=require(_0x61e8('0x1'));var rp=require(_0x61e8('0x2'));var util=require(_0x61e8('0x3'));var md5=require(_0x61e8('0x4'));var Redis=require(_0x61e8('0x5'));var intUtil=require(_0x61e8('0x6'));var config=require(_0x61e8('0x7'));var logger=require(_0x61e8('0x8'))(_0x61e8('0x9'));config['redis']=_[_0x61e8('0xa')](config['redis'],{'host':_0x61e8('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x53401d,_0x1d1500,_0x511935,_0x382b6e,_0x265e89,_0x3a95da){return new Promise(function(_0x16bfb5,_0xd7d977){var _0x2e6786={'method':_0x61e8('0xc'),'uri':_0x382b6e+_0x61e8('0xd')+'&'+_0x265e89+'&'+_0x3a95da,'auth':_0x1d1500,'json':!![]};return rp(_0x2e6786)[_0x61e8('0xe')](function(_0x2d91f3){if(_0x2d91f3['result']['length']>0x0){_0x511935[_0x61e8('0xf')]=_0x2d91f3[_0x61e8('0x10')][0x0]['sys_id'];}logger[_0x61e8('0x11')]('['+[_0x53401d[_0x61e8('0x12')]()]+'],\x20getAdminUser\x20crm',_0x511935);_0x16bfb5(_0x511935);})[_0x61e8('0x13')](function(_0x448b11){logger[_0x61e8('0x14')]('['+[_0x53401d['toUpperCase']()]+']',_0x448b11[_0x61e8('0x15')]);_0xd7d977(_0x448b11[_0x61e8('0x15')]);});});}function getUser(_0xf7d381,_0x5af325,_0x4b3930,_0x80359,_0x473265){return function(_0xe36021){logger[_0x61e8('0x11')]('['+[_0xf7d381['toUpperCase']()]+_0x61e8('0x16'),_0xe36021);return new Promise(function(_0x134eec,_0x4391aa){if(intUtil['validateEmail'](_0xe36021[_0x61e8('0x17')])){var _0x4deb80={'method':'GET','uri':_0x4b3930+_0x61e8('0x18')+_0xe36021['userEmail']+'&'+_0x80359+'&'+_0x473265,'auth':_0x5af325,'json':!![]};logger['info']('['+[_0xf7d381[_0x61e8('0x12')]()]+'],\x20getUser\x20rp\x20obj',_0x4deb80);return rp(_0x4deb80)[_0x61e8('0xe')](function(_0x2afcac){logger[_0x61e8('0x11')]('['+[_0xf7d381[_0x61e8('0x12')]()]+_0x61e8('0x19'),_0x2afcac);if(_0x2afcac[_0x61e8('0x10')][_0x61e8('0x1a')]>0x0&&String(_0x2afcac['result'][0x0][_0x61e8('0x1b')])==='true'){_0xe36021[_0x61e8('0x1c')]=_0x2afcac['result'][0x0][_0x61e8('0x1d')];}else{_0xe36021[_0x61e8('0x1c')]=_0xe36021['adminId'];_0xe36021[_0x61e8('0x17')]=_0xe36021[_0x61e8('0x1e')];}logger[_0x61e8('0x11')]('['+[_0xf7d381['toUpperCase']()]+_0x61e8('0x1f'),_0xe36021);_0x134eec(_0xe36021);})[_0x61e8('0x13')](function(_0xfc9d72){logger[_0x61e8('0x14')]('['+[_0xf7d381[_0x61e8('0x12')]()]+']',_0xfc9d72['message']);_0x4391aa(_0xfc9d72['message']);});}else{logger[_0x61e8('0x11')]('['+[_0xf7d381[_0x61e8('0x12')]()]+_0x61e8('0x20'));_0xe36021['userId']=_0xe36021[_0x61e8('0xf')];_0xe36021['userEmail']=_0xe36021[_0x61e8('0x1e')];_0x134eec(_0xe36021);}});};}function createEndUser(_0x4d707c,_0x7a18c3,_0x34f56d,_0x5c33e2,_0x399ec9){logger[_0x61e8('0x11')]('['+[_0x4d707c[_0x61e8('0x12')]()]+_0x61e8('0x21'),_0x34f56d);return new Promise(function(_0x124cbe,_0x57785e){var _0x1823ae={'method':_0x61e8('0x22'),'uri':_0x5c33e2+_0x61e8('0x23')+_0x399ec9,'body':{'user_name':_0x34f56d['endUserNumber'],'roles':_0x61e8('0x24'),'first_name':_0x34f56d['endUserNumber'],'active':_0x61e8('0x25'),'date_format':_0x61e8('0x26'),'phone':_0x34f56d[_0x61e8('0x27')]},'auth':_0x7a18c3,'json':!![]};return rp(_0x1823ae)[_0x61e8('0xe')](function(_0xd47189){logger['info']('['+[_0x4d707c[_0x61e8('0x12')]()]+_0x61e8('0x28'),_0xd47189[_0x61e8('0x10')]);_0x34f56d[_0x61e8('0x29')]=_0xd47189[_0x61e8('0x10')][_0x61e8('0x1d')];_0x124cbe(_0x34f56d);})[_0x61e8('0x13')](function(_0x355822){logger[_0x61e8('0x14')]('['+[_0x4d707c[_0x61e8('0x12')]()]+']',_0x355822['message']);_0x57785e(_0x355822[_0x61e8('0x15')]);});});}function getEndUser(_0x16ec3f,_0x435504,_0x59b4c1,_0x40a9df,_0x30c30c){return function(_0x4b7244){logger[_0x61e8('0x11')]('['+[_0x16ec3f['toUpperCase']()]+_0x61e8('0x2a'),_0x4b7244);return new Promise(function(_0x262d48,_0x399e4c){var _0x224c3c={'method':'GET','uri':_0x59b4c1+_0x61e8('0x2b')+_0x4b7244['endUserNumber']+'&'+_0x40a9df+'&'+_0x30c30c,'auth':_0x435504,'json':!![]};return rp(_0x224c3c)[_0x61e8('0xe')](function(_0x5bb393){if(_0x5bb393['result'][_0x61e8('0x1a')]>0x0){_0x4b7244['endUserId']=_0x5bb393[_0x61e8('0x10')][0x0][_0x61e8('0x1d')];logger[_0x61e8('0x11')]('['+[_0x16ec3f['toUpperCase']()]+_0x61e8('0x2c'),_0x4b7244);_0x262d48(_0x4b7244);}else{return createEndUser(_0x16ec3f,_0x435504,_0x4b7244,_0x59b4c1,_0x40a9df)[_0x61e8('0xe')](function(_0x11a370){logger[_0x61e8('0x11')]('['+[_0x16ec3f[_0x61e8('0x12')]()]+'],\x20createEndUser\x20crm',_0x11a370);_0x262d48(_0x11a370);});}})[_0x61e8('0x13')](function(_0x15b612){logger[_0x61e8('0x14')]('['+[_0x16ec3f[_0x61e8('0x12')]()]+']',_0x15b612['message']);_0x399e4c(_0x15b612[_0x61e8('0x15')]);});});};}function getCustomFields(_0x5c4c71,_0x4ed367){var _0x2836a4={};if(_0x5c4c71[_0x61e8('0x1a')]>0x0){_[_0x61e8('0x2d')](_0x5c4c71,function(_0x304da6){if(_['includes']([_0x61e8('0x2e'),_0x61e8('0x2f')],_0x304da6[_0x61e8('0x30')])&&_0x304da6[_0x61e8('0x31')]&&!_0x304da6['customField']){_0x2836a4[_0x304da6[_0x61e8('0x31')][_0x61e8('0x32')]()]=_0x304da6['content'][_0x61e8('0x33')]();}else if(_['includes']([_0x61e8('0x2e'),_0x61e8('0x2f')],_0x304da6[_0x61e8('0x30')])&&_0x304da6[_0x61e8('0x34')]&&_0x304da6[_0x61e8('0x35')]){_0x2836a4[_0x304da6[_0x61e8('0x34')][_0x61e8('0x32')]()]=_0x304da6['content'][_0x61e8('0x33')]();}else if(_0x304da6[_0x61e8('0x30')]===_0x61e8('0x36')&&_0x304da6[_0x61e8('0x37')]&&_0x304da6[_0x61e8('0x34')]&&_0x304da6['customField']){_0x2836a4[_0x304da6[_0x61e8('0x34')][_0x61e8('0x32')]()]=_0x4ed367[_0x304da6[_0x61e8('0x37')]][_0x61e8('0x33')]();}else if(_0x304da6[_0x61e8('0x30')]===_0x61e8('0x38')&&_0x304da6['Variable']&&_0x304da6[_0x61e8('0x39')][_0x61e8('0x3a')]&&_0x304da6['idField']&&_0x304da6[_0x61e8('0x35')]){_0x2836a4[_0x304da6['idField'][_0x61e8('0x32')]()]=_0x4ed367[_0x304da6['Variable']['name'][_0x61e8('0x32')]()][_0x61e8('0x33')]();}});}return _0x2836a4;}function getTicket(_0x41e5cb,_0x423114,_0x109126,_0x2697b4,_0x2d2e06,_0xd3f9da){return function(_0x2ba022){logger[_0x61e8('0x11')]('['+[_0x41e5cb[_0x61e8('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x2ba022);return new Promise(function(_0x36d577,_0x326654){var _0x305a2b=_0x41e5cb[_0x61e8('0x32')]()===_0x61e8('0x3b')?_0x2ba022[_0x61e8('0x1c')]:_0x2ba022[_0x61e8('0x29')];var _0x33c001={'method':_0x61e8('0x22'),'uri':_0x109126+'incident'+'?'+_0xd3f9da,'body':Object[_0x61e8('0x3c')]({},{'active':_0x61e8('0x25'),'caller_id':_0x305a2b,'assigned_to':_0x2ba022[_0x61e8('0x1c')],'short_description':intUtil[_0x61e8('0x3d')](_0x2697b4[_0x61e8('0x3e')],_0x2d2e06,'\x20'),'description':intUtil[_0x61e8('0x3d')](_0x2697b4[_0x61e8('0x3f')],_0x2d2e06,'\x0a')},getCustomFields(_0x2697b4[_0x61e8('0x40')],_0x2d2e06)),'auth':_0x423114,'json':!![]};return rp(_0x33c001)['then'](function(_0x3b2049){logger[_0x61e8('0x11')]('['+[_0x41e5cb[_0x61e8('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3b2049[_0x61e8('0x10')]);_0x2ba022['ticketId']=_0x3b2049[_0x61e8('0x10')]['sys_id'];_0x2ba022['ticketNumber']=_0x3b2049[_0x61e8('0x10')][_0x61e8('0x41')];logger[_0x61e8('0x11')]('['+[_0x41e5cb['toUpperCase']()]+_0x61e8('0x42'),_0x2ba022);_0x36d577(_0x2ba022);})[_0x61e8('0x13')](function(_0x249c93){logger[_0x61e8('0x14')]('['+[_0x41e5cb[_0x61e8('0x12')]()]+']',_0x249c93['message']);_0x326654(_0x249c93[_0x61e8('0x15')]);});});};}function createRemoteTag(_0x1ede93,_0x1f47f0,_0x1e235d,_0x3b51e8){return new Promise(function(_0x51894d,_0x3fb4b4){var _0x1b54c0={'method':'POST','uri':_0x1e235d+_0x61e8('0x43')+'?'+_0x3b51e8,'body':{'short_description':_0x1ede93,'global':!![],'active':!![],'name':_0x1ede93},'auth':_0x1f47f0,'json':!![]};return rp(_0x1b54c0)[_0x61e8('0xe')](function(_0x5a7aab){var _0x330357=_0x5a7aab['result'][_0x61e8('0x1d')];_0x51894d(_0x330357);});});}function getRemoteTag(_0x27faa6,_0x126272,_0x2ec33a,_0x54aa97,_0x2a2a42){return new Promise(function(_0x165034,_0x4aea54){var _0x4a24f4={'method':_0x61e8('0xc'),'uri':_0x2ec33a+'label'+'?sysparm_query=name%3D'+_0x27faa6+'&'+_0x54aa97,'auth':_0x126272,'json':!![]};return rp(_0x4a24f4)[_0x61e8('0xe')](function(_0x9b7543){if(_0x9b7543['result'][_0x61e8('0x1a')]>0x0){var _0x29e21f=_0x9b7543[_0x61e8('0x10')][0x0][_0x61e8('0x1d')];_0x165034(_0x29e21f);}else{return createRemoteTag(_0x27faa6,_0x126272,_0x2ec33a,_0x54aa97)[_0x61e8('0xe')](function(_0x3b48e0){_0x165034(_0x3b48e0);});}});});}function assignTagToIncident(_0x3575e5,_0x515cc1,_0x4b06cc,_0x756ef0,_0x119848){return new Promise(function(_0x3c4784,_0x578734){var _0xb89f4e={'method':_0x61e8('0x22'),'uri':_0x4b06cc+_0x61e8('0x44')+'?'+_0x119848,'body':{'label':_0x3575e5,'table':_0x61e8('0x45'),'id_type':_0x61e8('0x46'),'table_key':_0x756ef0['ticketId'],'title':_0x61e8('0x47')+_0x756ef0[_0x61e8('0x48')],'id_display':_0x756ef0[_0x61e8('0x48')]},'auth':_0x515cc1,'json':!![]};return rp(_0xb89f4e)[_0x61e8('0xe')](function(_0x1f10db){_0x3c4784();})[_0x61e8('0x13')](function(){_0x3c4784();});});}function manageTags(_0x1cb352,_0x1792da,_0x5337a9,_0x5ccdf5,_0x77e2a5,_0x14de51,_0x411113){return new Promise(function(_0x4d8f04,_0x4ba23a){var _0x380e0b=[];_0x1792da[_0x61e8('0x2d')](function(_0x31c2a8){_0x380e0b[_0x61e8('0x49')](getRemoteTag(_0x31c2a8,_0x5337a9,_0x5ccdf5,_0x14de51,_0x411113));});return Promise['all'](_0x380e0b)[_0x61e8('0xe')](function(_0x12311d){if(_0x12311d[_0x61e8('0x1a')]){logger[_0x61e8('0x11')]('['+[_0x1cb352[_0x61e8('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x12311d);var _0x1f4a59=[];_0x12311d[_0x61e8('0x2d')](function(_0x2caf6f){_0x1f4a59[_0x61e8('0x49')](assignTagToIncident(_0x2caf6f,_0x5337a9,_0x5ccdf5,_0x77e2a5,_0x14de51));});return Promise[_0x61e8('0x4a')](_0x1f4a59)[_0x61e8('0xe')](function(){_0x4d8f04();})[_0x61e8('0x13')](function(){_0x4d8f04();});}else{_0x4d8f04();}});});}function getTags(_0x19d776,_0x437ee3,_0x35dbf5,_0x1142ae,_0x2122ca,_0x3ba193){return function(_0x4e6a37){return new Promise(function(_0x3a8b12,_0x9cef4f){var _0x393c5d=[];var _0x44ffd9=_0x1142ae[_0x61e8('0x4b')];if(_0x44ffd9&&_0x44ffd9[_0x61e8('0x1a')]>0x0){_0x393c5d=_[_0x61e8('0x4c')](_0x44ffd9,_0x61e8('0x3a'));}if(_0x393c5d[_0x61e8('0x1a')]>0x0){return manageTags(_0x19d776,_0x393c5d,_0x437ee3,_0x35dbf5,_0x4e6a37,_0x2122ca,_0x3ba193)[_0x61e8('0xe')](function(){_0x3a8b12(_0x4e6a37);});}else{_0x3a8b12(_0x4e6a37);}});};}function emit(_0x328f75,_0x28ebb2,_0x455bfd){var _0x137dbb='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x61e8('0x4d')+_0x61e8('0x4e');var _0x35d029={'uri':_0x328f75+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x455bfd+_0x137dbb};io['to'](util[_0x61e8('0x4f')](_0x61e8('0x50'),_0x28ebb2))[_0x61e8('0x51')]('trigger:browser:url',_0x35d029);}exports['cs']=function(_0x56f62f,_0x5534f5,_0x3bb1c8,_0x90d804,_0x81d69a,_0x42255f,_0x132f3e,_0x28d720){var _0x38c21e={};var _0x5448aa={'user':_0x42255f[_0x61e8('0x52')],'pass':_0x42255f['password']};var _0x225ad5=_0x61e8('0x53');var _0x5dd421=_0x61e8('0x54');_0x42255f['remoteUri']=intUtil[_0x61e8('0x55')](_0x42255f[_0x61e8('0x56')]);_0x42255f[_0x61e8('0x57')]=intUtil[_0x61e8('0x55')](_0x42255f[_0x61e8('0x57')]);var _0x14170c=util[_0x61e8('0x4f')](_0x61e8('0x58'),_0x42255f[_0x61e8('0x56')]);_0x38c21e[_0x61e8('0x17')]=!_[_0x61e8('0x59')](_0x90d804)?_0x90d804[_0x61e8('0x5a')]:null;_0x38c21e[_0x61e8('0x1e')]=_0x42255f[_0x61e8('0x5a')];_0x38c21e[_0x61e8('0x27')]=_0x28d720[_0x61e8('0x32')]()===_0x61e8('0x3b')?_0x5534f5[_0x61e8('0x5b')]:_0x5534f5[_0x61e8('0x5c')];_0x38c21e[_0x61e8('0x5d')]=_0x28d720===_0x61e8('0x5e')||_0x28d720===_0x61e8('0x5f')?_0x61e8('0x5e'):'outbound';var _0x10c243=util[_0x61e8('0x4f')](_0x61e8('0x60'),_0x42255f[_0x61e8('0x57')],_0x5534f5['uniqueid'],md5(_0x5534f5['uniqueid']));if(_0x81d69a&&_0x81d69a[_0x61e8('0x61')]){logger[_0x61e8('0x11')](_0x61e8('0x62'),_0x61e8('0x63'));_0x5534f5['recordingURL']=_0x10c243;}else if(_0x132f3e&&_0x132f3e[_0x61e8('0x64')]&&_0x132f3e[_0x61e8('0x64')]!==_0x61e8('0x65')){logger[_0x61e8('0x11')](_0x61e8('0x66'),'Recording\x20is\x20enabled!');_0x5534f5['recordingURL']=_0x10c243;}else{_0x5534f5[_0x61e8('0x67')]='';}return getAdminUser(_0x28d720,_0x5448aa,_0x38c21e,_0x14170c,_0x5dd421,_0x225ad5)['then'](getUser(_0x28d720,_0x5448aa,_0x14170c,_0x5dd421,_0x225ad5))[_0x61e8('0xe')](getEndUser(_0x28d720,_0x5448aa,_0x14170c,_0x5dd421,_0x225ad5))[_0x61e8('0xe')](getTicket(_0x28d720,_0x5448aa,_0x14170c,_0x3bb1c8,_0x5534f5,_0x5dd421))['then'](function(_0x2c0153){logger[_0x61e8('0x11')](util[_0x61e8('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2c0153[_0x61e8('0x68')]));logger[_0x61e8('0x11')](util[_0x61e8('0x4f')]('call\x20direction:\x20%s',_0x28d720));if(_0x28d720!==_0x61e8('0x5f')){logger['info']('['+[_0x28d720[_0x61e8('0x12')]()]+']',_0x61e8('0x69'));emit(_0x42255f[_0x61e8('0x56')],_0x90d804[_0x61e8('0x3a')],_0x2c0153[_0x61e8('0x68')]);}})[_0x61e8('0x13')](function(_0x1d3702){logger[_0x61e8('0x14')]('['+[_0x28d720[_0x61e8('0x12')]()]+_0x61e8('0x6a'),util[_0x61e8('0x6b')](_0x1d3702,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index ba4b76d..a737bf7 100644 --- a/server/services/ami/trigger/integration/sugarcrm.js +++ b/server/services/ami/trigger/integration/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1518=['password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','unmanaged','monitor_format','lastevent','toUpperCase','isNil','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','date_start','toISOString','slice','replace','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','map','type','string','nameField','content','customField','custom_fields','variable','customVariable','Variable','toLowerCase','login','username'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x1518,0xaf));var _0x8151=function(_0x2435e7,_0x3f7c3a){_0x2435e7=_0x2435e7-0x0;var _0x14904b=_0x1518[_0x2435e7];return _0x14904b;};'use strict';var _=require(_0x8151('0x0'));var rp=require(_0x8151('0x1'));var BPromise=require('bluebird');var md5=require(_0x8151('0x2'));var util=require(_0x8151('0x3'));var Redis=require(_0x8151('0x4'));var intUtil=require('./util');var config=require(_0x8151('0x5'));var logger=require(_0x8151('0x6'))('sugarcrm');config[_0x8151('0x7')]=_[_0x8151('0x8')](config[_0x8151('0x7')],{'host':_0x8151('0x9'),'port':0x18eb});var io=require(_0x8151('0xa'))(new Redis(config[_0x8151('0x7')]));var def={'method':_0x8151('0xb'),'json':!![]};function emit(_0x2a9ad7,_0x2f6767,_0x4e7c03){io['to'](_0x2a9ad7)[_0x8151('0xc')](_0x2f6767,_0x4e7c03);}function getTicket(_0x3e4e26,_0x54214f,_0x4f8198,_0x2cd7ad,_0x2323e3,_0x3950a7,_0x207db0,_0x37c3f9){logger[_0x8151('0xd')](_0x8151('0xe'));var _0x2d6d56=new Date();var _0x322328=[{'name':_0x8151('0xf'),'value':intUtil['getString'](_0x2cd7ad[_0x8151('0x10')],_0x2323e3,'\x20')},{'name':_0x8151('0x11'),'value':_0x54214f['id']},{'name':_0x8151('0x12'),'value':_0x54214f['id']},{'name':_0x8151('0x13'),'value':intUtil[_0x8151('0x14')](_0x2cd7ad['Descriptions'],_0x2323e3,'\x0a')},{'name':_0x8151('0x15'),'value':_0x2d6d56[_0x8151('0x16')]()[_0x8151('0x17')](0x0,0x13)[_0x8151('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x8151('0x19'),'value':'15'},{'name':_0x8151('0x1a'),'value':_0x4f8198['id']},{'name':'parent_type','value':_0x8151('0x1b')},{'name':_0x8151('0x1c'),'value':_0x4f8198[_0x8151('0xf')]},{'name':_0x8151('0x1d'),'value':_0x37c3f9}];if(_0x3950a7[_0x8151('0x1e')]){_[_0x8151('0x1f')](_0x3950a7,function(_0x163778){if(_0x2323e3[_0x163778[_0x8151('0x20')]]){_0x322328[_0x8151('0x21')]({'name':_0x163778[_0x8151('0x22')],'value':_0x2323e3[_0x163778[_0x8151('0x20')]]});}});}return request({'form':{'method':_0x8151('0x23'),'input_type':_0x8151('0x24'),'response_type':_0x8151('0x24'),'rest_data':JSON[_0x8151('0x25')]({'session':_0x207db0['id'],'module_name':_0x8151('0x26'),'name_value_list':_0x322328})}});}function getAuth(_0x38964a){return util[_0x8151('0x27')](_0x8151('0x28'),new Buffer(_0x38964a[_0x8151('0x29')]+':X')[_0x8151('0x2a')](_0x8151('0x2b')));}function getServerInfo(_0x408c3c){return request({'form':{'method':_0x8151('0x2c'),'input_type':_0x8151('0x24'),'response_type':_0x8151('0x24'),'rest_data':JSON[_0x8151('0x25')]({'session':_0x408c3c['id']})}});}function getUser(_0x34ef40,_0x5aea09,_0x70750c){if(!_['isNil'](_0x5aea09)){logger['info'](_0x8151('0x2d'),_0x5aea09);return request({'form':{'method':_0x8151('0x2e'),'input_type':_0x8151('0x24'),'response_type':_0x8151('0x24'),'rest_data':JSON['stringify']({'session':_0x70750c['id'],'module_name':'Employees','query':util[_0x8151('0x27')](_0x8151('0x2f'),_0x5aea09),'order_by':'','offset':'0','select_fields':['id','name',_0x8151('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8151('0x31')](function(_0x4d1fba){if(_0x4d1fba[_0x8151('0x32')][_0x8151('0x1e')]){var _0x12a5e5=_[_0x8151('0x33')](_0x4d1fba[_0x8151('0x32')],function(_0x2043fb){return _0x2043fb[_0x8151('0x34')][_0x8151('0x30')][_0x8151('0x35')]===_0x5aea09;});if(_0x12a5e5){logger[_0x8151('0xd')](_0x8151('0x36'));return BPromise[_0x8151('0x37')]({'id':_0x12a5e5['name_value_list']['id'][_0x8151('0x35')],'name':_0x12a5e5[_0x8151('0x34')][_0x8151('0xf')][_0x8151('0x35')]});}}logger[_0x8151('0xd')](_0x8151('0x38'));return BPromise[_0x8151('0x37')]({'id':_0x70750c[_0x8151('0x34')][_0x8151('0x39')][_0x8151('0x35')],'name':_0x70750c['name_value_list'][_0x8151('0x30')][_0x8151('0x35')]});});}else{logger[_0x8151('0xd')](_0x8151('0x3a'));return BPromise['resolve']({'id':_0x70750c[_0x8151('0x34')]['user_id'][_0x8151('0x35')],'name':_0x70750c[_0x8151('0x34')][_0x8151('0x30')][_0x8151('0x35')]});}}function getEndUser(_0x2df1d,_0x278953,_0xb12e61,_0x21baf6){logger[_0x8151('0xd')]('Searching\x20enduser\x20with\x20phone',_0xb12e61);return request({'form':{'method':'get_entry_list','input_type':_0x8151('0x24'),'response_type':_0x8151('0x24'),'rest_data':JSON[_0x8151('0x25')]({'session':_0x21baf6['id'],'module_name':_0x8151('0x1b'),'query':util[_0x8151('0x27')](_0x8151('0x3b'),_0xb12e61),'order_by':'','offset':'0','select_fields':['id',_0x8151('0xf'),_0x8151('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x8151('0x31')](function(_0x2bbd44){if(_0x2bbd44[_0x8151('0x32')]['length']){var _0x208238=_[_0x8151('0x33')](_0x2bbd44['entry_list'],function(_0x220300){return _0x220300[_0x8151('0x34')]['phone_home']['value']===_0xb12e61;});if(_0x208238){logger['info'](_0x8151('0x3d'));return BPromise[_0x8151('0x37')]({'id':_0x208238[_0x8151('0x34')]['id']['value'],'name':_0x208238['name_value_list'][_0x8151('0xf')][_0x8151('0x35')],'phone':_0x208238[_0x8151('0x34')][_0x8151('0x3c')][_0x8151('0x35')]});}}else{logger[_0x8151('0xd')](_0x8151('0x3e'));return request({'form':{'method':_0x8151('0x23'),'input_type':'JSON','response_type':_0x8151('0x24'),'rest_data':JSON['stringify']({'session':_0x21baf6['id'],'module_name':_0x8151('0x1b'),'name_value_list':[{'name':'first_name','value':_0x278953!==_0x8151('0x3f')?_0x278953:util[_0x8151('0x27')](_0x8151('0x40'),_0xb12e61)},{'name':_0x8151('0x3c'),'value':_0xb12e61}]})}})['then'](function(_0xe5effb){logger[_0x8151('0xd')](_0x8151('0x41'));return BPromise['resolve']({'id':_0xe5effb['id'],'name':_0xe5effb[_0x8151('0x32')][_0x8151('0x42')]['value'],'phone':_0xe5effb['entry_list'][_0x8151('0x3c')]['value']});});}});}function request(_0x18bf0d){logger[_0x8151('0x43')]('[HTTP]',JSON[_0x8151('0x25')](_0x18bf0d));return rp(_['merge'](def,_0x18bf0d));}function getTags(_0x3f07c8,_0x5bfbce){var _0x35b833=[];if(_0x3f07c8&&_0x3f07c8[_0x8151('0x1e')]>0x0){_0x35b833=_[_0x8151('0x44')](_0x3f07c8,_0x5bfbce);}return _0x35b833;}function getCustomFields(_0x380a5c,_0x4d76de){var _0x59b2d8=[];var _0x4314cc={'custom_fields':[]};if(_0x380a5c[_0x8151('0x1e')]>0x0){_['forEach'](_0x380a5c,function(_0x1ea55d){if(_0x1ea55d[_0x8151('0x45')]===_0x8151('0x46')&&_0x1ea55d[_0x8151('0x47')]&&!_0x1ea55d['customField']){_0x4314cc[_0x1ea55d[_0x8151('0x47')]['toLowerCase']()]=_0x1ea55d[_0x8151('0x48')][_0x8151('0x2a')]();}else if(_0x1ea55d[_0x8151('0x45')]===_0x8151('0x46')&&_0x1ea55d[_0x8151('0x22')]&&_0x1ea55d[_0x8151('0x49')]){_0x4314cc[_0x8151('0x4a')][_0x8151('0x21')]({'id':_0x1ea55d[_0x8151('0x22')],'value':_0x1ea55d['content'][_0x8151('0x2a')]()});}else if(_0x1ea55d[_0x8151('0x45')]===_0x8151('0x4b')&&_0x1ea55d['variableName']&&_0x1ea55d[_0x8151('0x22')]&&_0x1ea55d[_0x8151('0x49')]){_0x4d76de[_0x1ea55d['variableName']]&&_0x4314cc[_0x8151('0x4a')][_0x8151('0x21')]({'id':_0x1ea55d[_0x8151('0x22')],'value':_0x4d76de[_0x1ea55d['variableName']][_0x8151('0x2a')]()});}else if(_0x1ea55d[_0x8151('0x45')]===_0x8151('0x4c')&&_0x1ea55d[_0x8151('0x4d')]&&_0x1ea55d[_0x8151('0x4d')]['name']&&_0x1ea55d['idField']&&_0x1ea55d[_0x8151('0x49')]){_0x4d76de[_0x1ea55d['Variable'][_0x8151('0xf')][_0x8151('0x4e')]()]&&_0x4314cc[_0x8151('0x4a')]['push']({'id':_0x1ea55d[_0x8151('0x22')],'value':_0x4d76de[_0x1ea55d[_0x8151('0x4d')][_0x8151('0xf')][_0x8151('0x4e')]()][_0x8151('0x2a')]()});}});}return _0x4314cc;}function getConnection(_0x9cb68f){return request({'method':_0x8151('0xb'),'form':{'method':_0x8151('0x4f'),'input_type':_0x8151('0x24'),'response_type':_0x8151('0x24'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x9cb68f[_0x8151('0x50')],'password':_0x9cb68f[_0x8151('0x51')],'encryption':_0x8151('0x52')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x26db52){var _0x1b8d5b=_0x26db52;if(_0x1b8d5b['id']){def[_0x8151('0x53')]=_0x1b8d5b['id'];return BPromise[_0x8151('0x37')](_0x1b8d5b);}else{throw new Error(util[_0x8151('0x27')](_0x8151('0x54'),_0x9cb68f['id']));}});}function setRelationship(_0x5c6bc6,_0x446805,_0x23713a,_0x8b26f7){return request({'form':{'method':_0x8151('0x55'),'input_type':_0x8151('0x24'),'response_type':'JSON','rest_data':JSON[_0x8151('0x25')]({'session':_0x5c6bc6['id'],'module_name':'Calls','module_id':_0x23713a['id'],'link_field_name':_0x8b26f7,'related_ids':[_0x446805['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x8151('0x56')]=function(_0x52e100,_0x3e463d,_0x272282,_0x5511ba,_0x48e009,_0x22c347){var _0x3b65bf,_0x2d95b3,_0x6c9ea0,_0xa8d270;_0x22c347['remoteUri']=intUtil[_0x8151('0x57')](_0x22c347['remoteUri']);_0x22c347[_0x8151('0x58')]=intUtil[_0x8151('0x57')](_0x22c347[_0x8151('0x58')]);def['uri']=util[_0x8151('0x27')]('%s/service/v4_1/rest.php',_0x22c347[_0x8151('0x59')]);if(_0x48e009&&_0x48e009['monitor_format']){logger[_0x8151('0xd')](_0x8151('0x5a'),_0x8151('0x5b'));_0x3e463d[_0x8151('0x5c')]=util[_0x8151('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22c347['serverUrl'],_0x3e463d['uniqueid'],md5(_0x3e463d[_0x8151('0x5d')]));}else{_0x3e463d[_0x8151('0x5c')]='';}return getConnection(_0x22c347)[_0x8151('0x31')](function(_0x395623){_0xa8d270=_0x395623;return getUser(_0x22c347,_0x5511ba[_0x8151('0xf')],_0xa8d270);})['then'](function(_0x306aa9){_0x3b65bf=_0x306aa9;logger['info'](_0x8151('0x5e'),_0x3b65bf['id']);return getEndUser(_0x22c347,_0x3e463d[_0x8151('0x5f')],_0x3e463d[_0x8151('0x60')],_0xa8d270);})['then'](function(_0x53c38f){_0x2d95b3=_0x53c38f;logger[_0x8151('0xd')](_0x8151('0x61'),_0x2d95b3['id']);return getTicket(_0x22c347,_0x3b65bf,_0x2d95b3,_0x272282,_0x3e463d,_0x272282[_0x8151('0x62')],_0xa8d270,_0x8151('0x63'));})[_0x8151('0x31')](function(_0x4f3eb5){_0x6c9ea0=_0x4f3eb5;logger['info']('Ticket\x20created!');logger['info'](_0x8151('0x64'),_0x6c9ea0['id']);return setRelationship(_0xa8d270,_0x3b65bf,_0x6c9ea0,_0x8151('0x65'));})[_0x8151('0x31')](function(){return setRelationship(_0xa8d270,_0x2d95b3,_0x6c9ea0,_0x8151('0x66'));})['then'](function(){return getServerInfo(_0xa8d270);})[_0x8151('0x31')](function(_0x1c038e){var _0x408796=parseInt(_0x1c038e[_0x8151('0x67')][_0x8151('0x68')](0x0));var _0x211a26=util[_0x8151('0x27')](_0x8151('0x69'),_0x22c347[_0x8151('0x59')],_0x6c9ea0['id']);if(_0x408796>0x6){_0x211a26=util[_0x8151('0x27')](_0x8151('0x6a'),_0x22c347['remoteUri'],_0x6c9ea0['id']);}logger[_0x8151('0xd')](_0x8151('0x5a'),_0x8151('0x6b'));emit(util[_0x8151('0x27')](_0x8151('0x6c'),_0x5511ba[_0x8151('0xf')]),_0x8151('0x6d'),{'uri':_0x211a26});})[_0x8151('0x6e')](function(_0x46b8a9){logger[_0x8151('0x6f')](_0x8151('0x5a'),JSON['stringify'](_0x46b8a9));});};exports[_0x8151('0x70')]=function(_0x2de3f5,_0x49a0b0,_0x2490e2,_0x1f4c07,_0x20c875,_0x505986,_0x165abb){var _0x207cc9,_0x36c91b,_0x2f6ab7,_0x4dc834;_0x505986[_0x8151('0x59')]=intUtil['stripTrailingSlash'](_0x505986['remoteUri']);_0x505986['serverUrl']=intUtil[_0x8151('0x57')](_0x505986[_0x8151('0x58')]);def[_0x8151('0x71')]=util[_0x8151('0x27')](_0x8151('0x72'),_0x505986[_0x8151('0x59')]);if(_0x165abb&&_0x165abb[_0x8151('0x73')]&&_0x165abb[_0x8151('0x73')]!==_0x8151('0x74')){logger[_0x8151('0xd')](_0x8151('0x75'),_0x8151('0x5b'));_0x49a0b0[_0x8151('0x5c')]=util['format'](_0x8151('0x76'),_0x505986[_0x8151('0x58')],_0x49a0b0[_0x8151('0x5d')],md5(_0x49a0b0[_0x8151('0x5d')]));}return getConnection(_0x505986)[_0x8151('0x31')](function(_0x2c7dc3){_0x4dc834=_0x2c7dc3;return getUser(_0x505986,_0x1f4c07['name'],_0x4dc834);})[_0x8151('0x31')](function(_0x13b82e){_0x207cc9=_0x13b82e;logger[_0x8151('0xd')]('The\x20User\x20ID\x20is:',_0x207cc9['id']);return getEndUser(_0x505986,_0x49a0b0[_0x8151('0x77')],_0x49a0b0[_0x8151('0x78')],_0x4dc834);})[_0x8151('0x31')](function(_0x46b283){_0x36c91b=_0x46b283;logger[_0x8151('0xd')](_0x8151('0x61'),_0x36c91b['id']);return getTicket(_0x505986,_0x207cc9,_0x36c91b,_0x2490e2,_0x49a0b0,_0x2490e2[_0x8151('0x62')],_0x4dc834,_0x8151('0x79'));})[_0x8151('0x31')](function(_0x1b5be4){_0x2f6ab7=_0x1b5be4;logger['info'](_0x8151('0x7a'));logger[_0x8151('0xd')](_0x8151('0x64'),_0x2f6ab7['id']);return setRelationship(_0x4dc834,_0x207cc9,_0x2f6ab7,_0x8151('0x65'));})[_0x8151('0x31')](function(){return setRelationship(_0x4dc834,_0x36c91b,_0x2f6ab7,_0x8151('0x66'));})[_0x8151('0x31')](function(){return getServerInfo(_0x4dc834);})['then'](function(_0xdf38fc){var _0x12f6a7=parseInt(_0xdf38fc[_0x8151('0x67')][_0x8151('0x68')](0x0));var _0x3239d4=util['format'](_0x8151('0x69'),_0x505986['remoteUri'],_0x2f6ab7['id']);if(_0x12f6a7>0x6){_0x3239d4=util[_0x8151('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x505986[_0x8151('0x59')],_0x2f6ab7['id']);}logger[_0x8151('0xd')](_0x8151('0x75'),_0x8151('0x6b'));emit(util[_0x8151('0x27')](_0x8151('0x6c'),_0x1f4c07['name']),_0x8151('0x6d'),{'uri':_0x3239d4});})['catch'](function(_0x33a261){logger['error'](_0x8151('0x75'),JSON[_0x8151('0x25')](_0x33a261));});};exports[_0x8151('0x7b')]=function(_0x3e8380,_0x1b2375,_0x5ad4c5,_0x90c5ee,_0x2c3863,_0xc3460d){var _0x4336f2,_0x179210,_0x38fe18,_0x29523d;_0xc3460d[_0x8151('0x59')]=intUtil[_0x8151('0x57')](_0xc3460d[_0x8151('0x59')]);_0xc3460d[_0x8151('0x58')]=intUtil['stripTrailingSlash'](_0xc3460d[_0x8151('0x58')]);def[_0x8151('0x71')]=util[_0x8151('0x27')](_0x8151('0x72'),_0xc3460d[_0x8151('0x59')]);if(_0x2c3863&&_0x2c3863[_0x8151('0x7c')]){logger[_0x8151('0xd')]('['+_0x1b2375[_0x8151('0x7d')][_0x8151('0x7e')]()+']',_0x8151('0x5b'));_0x1b2375[_0x8151('0x5c')]=util[_0x8151('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc3460d['serverUrl'],_0x1b2375[_0x8151('0x5d')],md5(_0x1b2375[_0x8151('0x5d')]));}else{_0x1b2375['recordingURL']='';}return getConnection(_0xc3460d)['then'](function(_0x506ccc){_0x29523d=_0x506ccc;if(!_[_0x8151('0x7f')](_0x90c5ee)){return getUser(_0xc3460d,_0x90c5ee[_0x8151('0xf')],_0x29523d);}else{return getUser(_0xc3460d,null,_0x29523d);}})[_0x8151('0x31')](function(_0x20fb43){_0x4336f2=_0x20fb43;logger[_0x8151('0xd')](_0x8151('0x5e'),_0x4336f2['id']);return getEndUser(_0xc3460d,_0x1b2375[_0x8151('0x5f')],_0x1b2375[_0x8151('0x60')],_0x29523d);})[_0x8151('0x31')](function(_0x535b7d){_0x179210=_0x535b7d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x179210['id']);return getTicket(_0xc3460d,_0x4336f2,_0x179210,_0x5ad4c5,_0x1b2375,_0x5ad4c5[_0x8151('0x62')],_0x29523d,_0x8151('0x63'));})[_0x8151('0x31')](function(_0x2c65f5){_0x38fe18=_0x2c65f5;logger[_0x8151('0xd')](_0x8151('0x7a'));logger[_0x8151('0xd')]('The\x20Ticket\x20ID\x20is:',_0x38fe18['id']);return setRelationship(_0x29523d,_0x4336f2,_0x38fe18,_0x8151('0x65'));})[_0x8151('0x31')](function(){return setRelationship(_0x29523d,_0x179210,_0x38fe18,_0x8151('0x66'));})[_0x8151('0x31')](function(){return getServerInfo(_0x29523d);})[_0x8151('0x6e')](function(_0x4dda06){logger['error']('['+_0x1b2375[_0x8151('0x7d')][_0x8151('0x7e')]()+']',JSON['stringify'](_0x4dda06));});}; \ No newline at end of file +var _0x6564=['Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','version','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','calleridname','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','variableName','push','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','idField','customField','custom_fields','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','queue','remoteUri','stripTrailingSlash','uri','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x6564,0x8f));var _0x4656=function(_0x32b576,_0x1c91c4){_0x32b576=_0x32b576-0x0;var _0x40f17b=_0x6564[_0x32b576];return _0x40f17b;};'use strict';var _=require(_0x4656('0x0'));var rp=require(_0x4656('0x1'));var BPromise=require(_0x4656('0x2'));var md5=require(_0x4656('0x3'));var util=require(_0x4656('0x4'));var Redis=require(_0x4656('0x5'));var intUtil=require(_0x4656('0x6'));var config=require(_0x4656('0x7'));var logger=require(_0x4656('0x8'))('sugarcrm');config['redis']=_['defaults'](config[_0x4656('0x9')],{'host':_0x4656('0xa'),'port':0x18eb});var io=require(_0x4656('0xb'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x319b31,_0x19a3cc,_0x2edabd){io['to'](_0x319b31)[_0x4656('0xc')](_0x19a3cc,_0x2edabd);}function getTicket(_0x3ff4a2,_0x50cde5,_0x19501a,_0x1eaeef,_0x58c897,_0x5bd356,_0x3c5c06,_0xb3a512){logger['info'](_0x4656('0xd'));var _0x31a69c=new Date();var _0x3fbeaf=[{'name':_0x4656('0xe'),'value':intUtil['getString'](_0x1eaeef[_0x4656('0xf')],_0x58c897,'\x20')},{'name':_0x4656('0x10'),'value':_0x50cde5['id']},{'name':'created_by','value':_0x50cde5['id']},{'name':'description','value':intUtil['getString'](_0x1eaeef[_0x4656('0x11')],_0x58c897,'\x0a')},{'name':_0x4656('0x12'),'value':_0x31a69c[_0x4656('0x13')]()[_0x4656('0x14')](0x0,0x13)[_0x4656('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4656('0x16'),'value':'15'},{'name':_0x4656('0x17'),'value':_0x19501a['id']},{'name':_0x4656('0x18'),'value':'Contacts'},{'name':_0x4656('0x19'),'value':_0x19501a['name']},{'name':_0x4656('0x1a'),'value':_0xb3a512}];if(_0x5bd356[_0x4656('0x1b')]){_[_0x4656('0x1c')](_0x5bd356,function(_0x24b456){if(_0x58c897[_0x24b456[_0x4656('0x1d')]]){_0x3fbeaf[_0x4656('0x1e')]({'name':_0x24b456['idField'],'value':_0x58c897[_0x24b456['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x4656('0x1f'),'response_type':'JSON','rest_data':JSON[_0x4656('0x20')]({'session':_0x3c5c06['id'],'module_name':_0x4656('0x21'),'name_value_list':_0x3fbeaf})}});}function getAuth(_0x44c05f){return util[_0x4656('0x22')](_0x4656('0x23'),new Buffer(_0x44c05f[_0x4656('0x24')]+':X')[_0x4656('0x25')](_0x4656('0x26')));}function getServerInfo(_0x56ff01){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4656('0x20')]({'session':_0x56ff01['id']})}});}function getUser(_0x2b5325,_0x41a8a9,_0x5aa5ab){if(!_[_0x4656('0x27')](_0x41a8a9)){logger[_0x4656('0x28')](_0x4656('0x29'),_0x41a8a9);return request({'form':{'method':_0x4656('0x2a'),'input_type':_0x4656('0x1f'),'response_type':_0x4656('0x1f'),'rest_data':JSON[_0x4656('0x20')]({'session':_0x5aa5ab['id'],'module_name':'Employees','query':util['format'](_0x4656('0x2b'),_0x41a8a9),'order_by':'','offset':'0','select_fields':['id',_0x4656('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4656('0x2c')](function(_0x2761ca){if(_0x2761ca['entry_list'][_0x4656('0x1b')]){var _0x2d7e69=_[_0x4656('0x2d')](_0x2761ca['entry_list'],function(_0x3f0d4b){return _0x3f0d4b[_0x4656('0x2e')][_0x4656('0x2f')][_0x4656('0x30')]===_0x41a8a9;});if(_0x2d7e69){logger['info'](_0x4656('0x31'));return BPromise[_0x4656('0x32')]({'id':_0x2d7e69[_0x4656('0x2e')]['id'][_0x4656('0x30')],'name':_0x2d7e69['name_value_list']['name'][_0x4656('0x30')]});}}logger[_0x4656('0x28')](_0x4656('0x33'));return BPromise[_0x4656('0x32')]({'id':_0x5aa5ab['name_value_list'][_0x4656('0x34')][_0x4656('0x30')],'name':_0x5aa5ab['name_value_list']['user_name'][_0x4656('0x30')]});});}else{logger[_0x4656('0x28')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4656('0x32')]({'id':_0x5aa5ab[_0x4656('0x2e')]['user_id'][_0x4656('0x30')],'name':_0x5aa5ab['name_value_list'][_0x4656('0x2f')][_0x4656('0x30')]});}}function getEndUser(_0x146a00,_0x2a6586,_0x4f026e,_0x34f354){logger['info'](_0x4656('0x35'),_0x4f026e);return request({'form':{'method':_0x4656('0x2a'),'input_type':_0x4656('0x1f'),'response_type':_0x4656('0x1f'),'rest_data':JSON[_0x4656('0x20')]({'session':_0x34f354['id'],'module_name':'Contacts','query':util[_0x4656('0x22')](_0x4656('0x36'),_0x4f026e),'order_by':'','offset':'0','select_fields':['id',_0x4656('0xe'),_0x4656('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x37fff6){if(_0x37fff6[_0x4656('0x38')][_0x4656('0x1b')]){var _0x234eca=_[_0x4656('0x2d')](_0x37fff6[_0x4656('0x38')],function(_0x36ed34){return _0x36ed34[_0x4656('0x2e')][_0x4656('0x37')][_0x4656('0x30')]===_0x4f026e;});if(_0x234eca){logger[_0x4656('0x28')](_0x4656('0x39'));return BPromise['resolve']({'id':_0x234eca['name_value_list']['id'][_0x4656('0x30')],'name':_0x234eca['name_value_list'][_0x4656('0xe')][_0x4656('0x30')],'phone':_0x234eca[_0x4656('0x2e')]['phone_home'][_0x4656('0x30')]});}}else{logger['info'](_0x4656('0x3a'));return request({'form':{'method':_0x4656('0x3b'),'input_type':_0x4656('0x1f'),'response_type':'JSON','rest_data':JSON[_0x4656('0x20')]({'session':_0x34f354['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x2a6586!==''?_0x2a6586:util[_0x4656('0x22')](_0x4656('0x3c'),_0x4f026e)},{'name':_0x4656('0x37'),'value':_0x4f026e}]})}})[_0x4656('0x2c')](function(_0x475a68){logger[_0x4656('0x28')](_0x4656('0x3d'));return BPromise[_0x4656('0x32')]({'id':_0x475a68['id'],'name':_0x475a68[_0x4656('0x38')][_0x4656('0x3e')][_0x4656('0x30')],'phone':_0x475a68[_0x4656('0x38')][_0x4656('0x37')][_0x4656('0x30')]});});}});}function request(_0x5e59da){logger[_0x4656('0x3f')](_0x4656('0x40'),JSON['stringify'](_0x5e59da));return rp(_[_0x4656('0x41')](def,_0x5e59da));}function getTags(_0x1077f,_0x4f1cff){var _0x5f481d=[];if(_0x1077f&&_0x1077f['length']>0x0){_0x5f481d=_[_0x4656('0x42')](_0x1077f,_0x4f1cff);}return _0x5f481d;}function getCustomFields(_0x1bdcce,_0x4b2bf6){var _0x1e89c5=[];var _0x5ccdde={'custom_fields':[]};if(_0x1bdcce[_0x4656('0x1b')]>0x0){_['forEach'](_0x1bdcce,function(_0x17dfd0){if(_0x17dfd0[_0x4656('0x43')]===_0x4656('0x44')&&_0x17dfd0[_0x4656('0x45')]&&!_0x17dfd0['customField']){_0x5ccdde[_0x17dfd0[_0x4656('0x45')][_0x4656('0x46')]()]=_0x17dfd0[_0x4656('0x47')][_0x4656('0x25')]();}else if(_0x17dfd0['type']===_0x4656('0x44')&&_0x17dfd0[_0x4656('0x48')]&&_0x17dfd0[_0x4656('0x49')]){_0x5ccdde[_0x4656('0x4a')][_0x4656('0x1e')]({'id':_0x17dfd0['idField'],'value':_0x17dfd0[_0x4656('0x47')][_0x4656('0x25')]()});}else if(_0x17dfd0[_0x4656('0x43')]===_0x4656('0x4b')&&_0x17dfd0[_0x4656('0x1d')]&&_0x17dfd0[_0x4656('0x48')]&&_0x17dfd0[_0x4656('0x49')]){_0x4b2bf6[_0x17dfd0[_0x4656('0x1d')]]&&_0x5ccdde[_0x4656('0x4a')]['push']({'id':_0x17dfd0[_0x4656('0x48')],'value':_0x4b2bf6[_0x17dfd0['variableName']]['toString']()});}else if(_0x17dfd0[_0x4656('0x43')]===_0x4656('0x4c')&&_0x17dfd0[_0x4656('0x4d')]&&_0x17dfd0[_0x4656('0x4d')][_0x4656('0xe')]&&_0x17dfd0[_0x4656('0x48')]&&_0x17dfd0[_0x4656('0x49')]){_0x4b2bf6[_0x17dfd0[_0x4656('0x4d')]['name'][_0x4656('0x46')]()]&&_0x5ccdde['custom_fields']['push']({'id':_0x17dfd0[_0x4656('0x48')],'value':_0x4b2bf6[_0x17dfd0[_0x4656('0x4d')][_0x4656('0xe')]['toLowerCase']()]['toString']()});}});}return _0x5ccdde;}function getConnection(_0x361c94){return request({'method':'POST','form':{'method':_0x4656('0x4e'),'input_type':_0x4656('0x1f'),'response_type':_0x4656('0x1f'),'rest_data':JSON[_0x4656('0x20')]({'user_auth':{'user_name':_0x361c94[_0x4656('0x4f')],'password':_0x361c94[_0x4656('0x50')],'encryption':'PLAIN'},'application':_0x4656('0x51')})}})['then'](function(_0x523148){var _0x3936af=_0x523148;if(_0x3936af['id']){def['sessionID']=_0x3936af['id'];return BPromise[_0x4656('0x32')](_0x3936af);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x361c94['id']));}});}function setRelationship(_0xdcd1b8,_0x309d25,_0x36ed3a,_0x2961ab){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4656('0x20')]({'session':_0xdcd1b8['id'],'module_name':_0x4656('0x21'),'module_id':_0x36ed3a['id'],'link_field_name':_0x2961ab,'related_ids':[_0x309d25['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4656('0x52')]=function(_0xdfd301,_0x2193f1,_0x5ce81e,_0x2ddc98,_0x58416e,_0x15b2a8){var _0x28df0e,_0x1269a9,_0x31d256,_0xa7ac81;_0x15b2a8[_0x4656('0x53')]=intUtil[_0x4656('0x54')](_0x15b2a8['remoteUri']);_0x15b2a8['serverUrl']=intUtil['stripTrailingSlash'](_0x15b2a8['serverUrl']);def[_0x4656('0x55')]=util['format']('%s/service/v4_1/rest.php',_0x15b2a8['remoteUri']);if(_0x58416e&&_0x58416e[_0x4656('0x56')]){logger[_0x4656('0x28')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2193f1['recordingURL']=util[_0x4656('0x22')](_0x4656('0x57'),_0x15b2a8['serverUrl'],_0x2193f1[_0x4656('0x58')],md5(_0x2193f1[_0x4656('0x58')]));}else{_0x2193f1[_0x4656('0x59')]='';}return getConnection(_0x15b2a8)['then'](function(_0x40194e){_0xa7ac81=_0x40194e;return getUser(_0x15b2a8,_0x2ddc98[_0x4656('0xe')],_0xa7ac81);})[_0x4656('0x2c')](function(_0x31d49e){_0x28df0e=_0x31d49e;logger[_0x4656('0x28')](_0x4656('0x5a'),_0x28df0e['id']);return getEndUser(_0x15b2a8,_0x2193f1['calleridname'],_0x2193f1[_0x4656('0x5b')],_0xa7ac81);})[_0x4656('0x2c')](function(_0x2fd79d){_0x1269a9=_0x2fd79d;logger[_0x4656('0x28')](_0x4656('0x5c'),_0x1269a9['id']);return getTicket(_0x15b2a8,_0x28df0e,_0x1269a9,_0x5ce81e,_0x2193f1,_0x5ce81e['Fields'],_0xa7ac81,_0x4656('0x5d'));})[_0x4656('0x2c')](function(_0xfc7962){_0x31d256=_0xfc7962;logger['info'](_0x4656('0x5e'));logger[_0x4656('0x28')](_0x4656('0x5f'),_0x31d256['id']);return setRelationship(_0xa7ac81,_0x28df0e,_0x31d256,'users');})['then'](function(){return setRelationship(_0xa7ac81,_0x1269a9,_0x31d256,'contacts');})[_0x4656('0x2c')](function(){return getServerInfo(_0xa7ac81);})[_0x4656('0x2c')](function(_0x376c19){var _0x140b3e=parseInt(_0x376c19['version'][_0x4656('0x60')](0x0));var _0x44aab4=util[_0x4656('0x22')](_0x4656('0x61'),_0x15b2a8[_0x4656('0x53')],_0x31d256['id']);if(_0x140b3e>0x6){_0x44aab4=util['format'](_0x4656('0x62'),_0x15b2a8[_0x4656('0x53')],_0x31d256['id']);}logger[_0x4656('0x28')](_0x4656('0x63'),_0x4656('0x64'));emit(util[_0x4656('0x22')](_0x4656('0x65'),_0x2ddc98[_0x4656('0xe')]),_0x4656('0x66'),{'uri':_0x44aab4});})[_0x4656('0x67')](function(_0xae1c1d){logger[_0x4656('0x68')](_0x4656('0x63'),JSON[_0x4656('0x20')](_0xae1c1d));});};exports[_0x4656('0x69')]=function(_0x490abd,_0xdfc04a,_0x224bd5,_0x18eab7,_0x2096d9,_0x2c1de3,_0x4d00d3){var _0x49622f,_0x13346d,_0x2fa3c3,_0x3c5f3b;_0x2c1de3[_0x4656('0x53')]=intUtil[_0x4656('0x54')](_0x2c1de3['remoteUri']);_0x2c1de3[_0x4656('0x6a')]=intUtil[_0x4656('0x54')](_0x2c1de3[_0x4656('0x6a')]);def[_0x4656('0x55')]=util[_0x4656('0x22')]('%s/service/v4_1/rest.php',_0x2c1de3[_0x4656('0x53')]);if(_0x4d00d3&&_0x4d00d3[_0x4656('0x6b')]&&_0x4d00d3[_0x4656('0x6b')]!==_0x4656('0x6c')){logger['info'](_0x4656('0x6d'),_0x4656('0x6e'));_0xdfc04a[_0x4656('0x59')]=util[_0x4656('0x22')](_0x4656('0x57'),_0x2c1de3['serverUrl'],_0xdfc04a[_0x4656('0x58')],md5(_0xdfc04a['uniqueid']));}return getConnection(_0x2c1de3)[_0x4656('0x2c')](function(_0xadf813){_0x3c5f3b=_0xadf813;return getUser(_0x2c1de3,_0x18eab7[_0x4656('0xe')],_0x3c5f3b);})[_0x4656('0x2c')](function(_0x368fee){_0x49622f=_0x368fee;logger[_0x4656('0x28')]('The\x20User\x20ID\x20is:',_0x49622f['id']);return getEndUser(_0x2c1de3,_0xdfc04a['destcalleridname'],_0xdfc04a['destcalleridnum'],_0x3c5f3b);})[_0x4656('0x2c')](function(_0x5c3ebc){_0x13346d=_0x5c3ebc;logger[_0x4656('0x28')]('The\x20Enduser\x20ID\x20is:',_0x13346d['id']);return getTicket(_0x2c1de3,_0x49622f,_0x13346d,_0x224bd5,_0xdfc04a,_0x224bd5['Fields'],_0x3c5f3b,'Outbound');})['then'](function(_0x2ee4ba){_0x2fa3c3=_0x2ee4ba;logger[_0x4656('0x28')](_0x4656('0x5e'));logger[_0x4656('0x28')]('The\x20Ticket\x20ID\x20is:',_0x2fa3c3['id']);return setRelationship(_0x3c5f3b,_0x49622f,_0x2fa3c3,'users');})[_0x4656('0x2c')](function(){return setRelationship(_0x3c5f3b,_0x13346d,_0x2fa3c3,'contacts');})[_0x4656('0x2c')](function(){return getServerInfo(_0x3c5f3b);})[_0x4656('0x2c')](function(_0x1b5e90){var _0x3dff55=parseInt(_0x1b5e90[_0x4656('0x6f')][_0x4656('0x60')](0x0));var _0x20783e=util[_0x4656('0x22')](_0x4656('0x61'),_0x2c1de3[_0x4656('0x53')],_0x2fa3c3['id']);if(_0x3dff55>0x6){_0x20783e=util[_0x4656('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2c1de3[_0x4656('0x53')],_0x2fa3c3['id']);}logger[_0x4656('0x28')]('[OUTBOUND]',_0x4656('0x64'));emit(util[_0x4656('0x22')](_0x4656('0x65'),_0x18eab7['name']),_0x4656('0x66'),{'uri':_0x20783e});})[_0x4656('0x67')](function(_0x379455){logger[_0x4656('0x68')](_0x4656('0x6d'),JSON[_0x4656('0x20')](_0x379455));});};exports[_0x4656('0x70')]=function(_0x1477fa,_0x327e96,_0x53b3bc,_0x1cbab2,_0x5cd127,_0x1ad756){var _0x1340f1,_0x464323,_0xcc7b1a,_0x571c5f;_0x1ad756['remoteUri']=intUtil[_0x4656('0x54')](_0x1ad756[_0x4656('0x53')]);_0x1ad756['serverUrl']=intUtil[_0x4656('0x54')](_0x1ad756['serverUrl']);def[_0x4656('0x55')]=util[_0x4656('0x22')](_0x4656('0x71'),_0x1ad756['remoteUri']);if(_0x5cd127&&_0x5cd127[_0x4656('0x56')]){logger[_0x4656('0x28')]('['+_0x327e96[_0x4656('0x72')][_0x4656('0x73')]()+']',_0x4656('0x6e'));_0x327e96['recordingURL']=util[_0x4656('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ad756[_0x4656('0x6a')],_0x327e96[_0x4656('0x58')],md5(_0x327e96[_0x4656('0x58')]));}else{_0x327e96[_0x4656('0x59')]='';}return getConnection(_0x1ad756)['then'](function(_0x56ef00){_0x571c5f=_0x56ef00;if(!_[_0x4656('0x27')](_0x1cbab2)){return getUser(_0x1ad756,_0x1cbab2[_0x4656('0xe')],_0x571c5f);}else{return getUser(_0x1ad756,null,_0x571c5f);}})[_0x4656('0x2c')](function(_0x3ab11a){_0x1340f1=_0x3ab11a;logger[_0x4656('0x28')](_0x4656('0x5a'),_0x1340f1['id']);return getEndUser(_0x1ad756,_0x327e96[_0x4656('0x74')],_0x327e96[_0x4656('0x5b')],_0x571c5f);})['then'](function(_0x2f45fb){_0x464323=_0x2f45fb;logger[_0x4656('0x28')](_0x4656('0x5c'),_0x464323['id']);return getTicket(_0x1ad756,_0x1340f1,_0x464323,_0x53b3bc,_0x327e96,_0x53b3bc[_0x4656('0x75')],_0x571c5f,_0x4656('0x5d'));})[_0x4656('0x2c')](function(_0x424bb6){_0xcc7b1a=_0x424bb6;logger['info'](_0x4656('0x5e'));logger[_0x4656('0x28')](_0x4656('0x5f'),_0xcc7b1a['id']);return setRelationship(_0x571c5f,_0x1340f1,_0xcc7b1a,'users');})['then'](function(){return setRelationship(_0x571c5f,_0x464323,_0xcc7b1a,'contacts');})['then'](function(){return getServerInfo(_0x571c5f);})[_0x4656('0x67')](function(_0x5d3880){logger[_0x4656('0x68')]('['+_0x327e96['lastevent'][_0x4656('0x73')]()+']',JSON[_0x4656('0x20')](_0x5d3880));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 2d865dd..5a9cee4 100644 --- a/server/services/ami/trigger/integration/util.js +++ b/server/services/ami/trigger/integration/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8115=['push','content','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','variable','customVariable','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','test','lodash','util','sortBy','length','type'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x8115,0x13f));var _0x5811=function(_0x141d18,_0x203b63){_0x141d18=_0x141d18-0x0;var _0x1e2298=_0x8115[_0x141d18];return _0x1e2298;};'use strict';var _=require(_0x5811('0x0'));var util=require(_0x5811('0x1'));exports['getString']=function(_0x4937b5,_0x492598,_0x408f02){var _0x587e60=[];if(_0x4937b5['length']>0x0){var _0x460a02=_[_0x5811('0x2')](_0x4937b5,['id']);for(var _0x39483a=0x0;_0x39483a<_0x460a02[_0x5811('0x3')];_0x39483a++){var _0x4c4210=_0x460a02[_0x39483a];if(_0x4c4210[_0x5811('0x4')]==='string'){_0x587e60[_0x5811('0x5')](_0x4c4210[_0x5811('0x6')]);}else if(_0x4c4210['type']==='variable'&&_0x4c4210[_0x5811('0x7')]){_0x492598[_0x4c4210[_0x5811('0x7')]]&&_0x587e60[_0x5811('0x5')](_0x492598[_0x4c4210[_0x5811('0x7')]][_0x5811('0x8')]());}else if(_0x4c4210[_0x5811('0x4')]==='customVariable'&&_0x4c4210['Variable']&&_0x4c4210[_0x5811('0x9')][_0x5811('0xa')]){_0x492598[_0x4c4210[_0x5811('0x9')][_0x5811('0xa')][_0x5811('0xb')]()]&&_0x587e60[_0x5811('0x5')](_0x492598[_0x4c4210[_0x5811('0x9')][_0x5811('0xa')][_0x5811('0xb')]()][_0x5811('0x8')]());}else if(_0x4c4210[_0x5811('0x4')]===_0x5811('0xc')){if(_0x4c4210[_0x5811('0xd')]===_0x5811('0xe')&&_0x4c4210[_0x5811('0xf')]){_0x587e60[_0x5811('0x5')](util[_0x5811('0x10')](_0x5811('0x11'),_0x4c4210[_0x5811('0xf')],_0x4c4210[_0x5811('0x12')]));}else if(_0x4c4210['keyType']===_0x5811('0x13')&&_0x4c4210[_0x5811('0x7')]&&_0x4c4210[_0x5811('0xf')]){_0x492598[_0x4c4210[_0x5811('0x7')]]&&_0x587e60[_0x5811('0x5')](util[_0x5811('0x10')]('%s:\x20%s',_0x4c4210[_0x5811('0xf')],_0x492598[_0x4c4210['variableName']]));}else if(_0x4c4210[_0x5811('0xd')]===_0x5811('0x14')&&_0x4c4210['Variable']&&_0x4c4210[_0x5811('0x9')][_0x5811('0xa')]&&_0x4c4210['key']){_0x492598[_0x4c4210[_0x5811('0x9')][_0x5811('0xa')][_0x5811('0xb')]()]&&_0x587e60[_0x5811('0x5')](util['format'](_0x5811('0x11'),_0x4c4210[_0x5811('0xf')],_0x492598[_0x4c4210[_0x5811('0x9')]['name'][_0x5811('0xb')]()]));}}}}return _0x587e60[_0x5811('0x15')](_0x408f02);};exports[_0x5811('0x16')]=function(_0x29f6d2){var _0x393091=_0x29f6d2['slice'](-0x1);if(_0x393091==='/'){_0x29f6d2=_0x29f6d2[_0x5811('0x17')](0x0,_0x29f6d2[_0x5811('0x18')](_0x393091));}return _0x29f6d2;};exports[_0x5811('0x19')]=function(_0x278f68){if(!_['isNil'](_0x278f68)&&_0x278f68!==''){var _0xe7b6f2=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0xe7b6f2[_0x5811('0x1a')](String(_0x278f68)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xace5=['customVariable','stripTrailingSlash','slice','substring','lastIndexOf','test','lodash','util','getString','length','string','push','variable','variableName','toString','type','Variable','name','toLowerCase','keyValue','key','%s:\x20%s','keyContent'];(function(_0x585700,_0x5eaa85){var _0x57eebb=function(_0x98ee7d){while(--_0x98ee7d){_0x585700['push'](_0x585700['shift']());}};_0x57eebb(++_0x5eaa85);}(_0xace5,0x103));var _0x5ace=function(_0x1cdb18,_0x42f3d4){_0x1cdb18=_0x1cdb18-0x0;var _0x24ac6c=_0xace5[_0x1cdb18];return _0x24ac6c;};'use strict';var _=require(_0x5ace('0x0'));var util=require(_0x5ace('0x1'));exports[_0x5ace('0x2')]=function(_0x17b66e,_0x5054b8,_0x248aac){var _0x54161a=[];if(_0x17b66e[_0x5ace('0x3')]>0x0){var _0x2630ab=_['sortBy'](_0x17b66e,['id']);for(var _0x409091=0x0;_0x409091<_0x2630ab[_0x5ace('0x3')];_0x409091++){var _0x35a31c=_0x2630ab[_0x409091];if(_0x35a31c['type']===_0x5ace('0x4')){_0x54161a[_0x5ace('0x5')](_0x35a31c['content']);}else if(_0x35a31c['type']===_0x5ace('0x6')&&_0x35a31c[_0x5ace('0x7')]){_0x5054b8[_0x35a31c[_0x5ace('0x7')]]&&_0x54161a[_0x5ace('0x5')](_0x5054b8[_0x35a31c[_0x5ace('0x7')]][_0x5ace('0x8')]());}else if(_0x35a31c[_0x5ace('0x9')]==='customVariable'&&_0x35a31c[_0x5ace('0xa')]&&_0x35a31c['Variable'][_0x5ace('0xb')]){_0x5054b8[_0x35a31c[_0x5ace('0xa')][_0x5ace('0xb')][_0x5ace('0xc')]()]&&_0x54161a[_0x5ace('0x5')](_0x5054b8[_0x35a31c[_0x5ace('0xa')]['name'][_0x5ace('0xc')]()][_0x5ace('0x8')]());}else if(_0x35a31c['type']===_0x5ace('0xd')){if(_0x35a31c['keyType']===_0x5ace('0x4')&&_0x35a31c[_0x5ace('0xe')]){_0x54161a['push'](util['format'](_0x5ace('0xf'),_0x35a31c['key'],_0x35a31c[_0x5ace('0x10')]));}else if(_0x35a31c['keyType']===_0x5ace('0x6')&&_0x35a31c[_0x5ace('0x7')]&&_0x35a31c[_0x5ace('0xe')]){_0x5054b8[_0x35a31c[_0x5ace('0x7')]]&&_0x54161a['push'](util['format']('%s:\x20%s',_0x35a31c[_0x5ace('0xe')],_0x5054b8[_0x35a31c[_0x5ace('0x7')]]));}else if(_0x35a31c['keyType']===_0x5ace('0x11')&&_0x35a31c[_0x5ace('0xa')]&&_0x35a31c[_0x5ace('0xa')]['name']&&_0x35a31c[_0x5ace('0xe')]){_0x5054b8[_0x35a31c[_0x5ace('0xa')][_0x5ace('0xb')]['toLowerCase']()]&&_0x54161a[_0x5ace('0x5')](util['format'](_0x5ace('0xf'),_0x35a31c[_0x5ace('0xe')],_0x5054b8[_0x35a31c[_0x5ace('0xa')][_0x5ace('0xb')]['toLowerCase']()]));}}}}return _0x54161a['join'](_0x248aac);};exports[_0x5ace('0x12')]=function(_0x5227df){var _0x46fb7f=_0x5227df[_0x5ace('0x13')](-0x1);if(_0x46fb7f==='/'){_0x5227df=_0x5227df[_0x5ace('0x14')](0x0,_0x5227df[_0x5ace('0x15')](_0x46fb7f));}return _0x5227df;};exports['validateEmail']=function(_0x77b45b){if(!_['isNil'](_0x77b45b)&&_0x77b45b!==''){var _0x258937=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x258937[_0x5ace('0x16')](String(_0x77b45b)[_0x5ace('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 590bdc1..ec27c96 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xe706,0xa3));var _0x6e70=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xe706[_0x764874];return _0x29f9d5;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x59268f,_0x59a514){var _0x1d446e=function(_0x917f8e){while(--_0x917f8e){_0x59268f['push'](_0x59268f['shift']());}};_0x1d446e(++_0x59a514);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index aeed17e..c49a2f1 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67cd=['/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','[OUTBOUND]','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','trigger:browser:url','replace','unmanaged','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','getString','Descriptions','Fields','then','validateEmail','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','password','token','%s/token:%s','username','base64','[HTTP]','stringify','GET','forEach','picklist','type','nameField','customField','toLowerCase','content','toString','includes','string','custom_fields','push','idField','variableName','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s'];(function(_0x48f059,_0xd56f13){var _0x45fb52=function(_0x1d5c06){while(--_0x1d5c06){_0x48f059['push'](_0x48f059['shift']());}};_0x45fb52(++_0xd56f13);}(_0x67cd,0x79));var _0xd67c=function(_0x5df5e1,_0x3e0305){_0x5df5e1=_0x5df5e1-0x0;var _0x2fffd3=_0x67cd[_0x5df5e1];return _0x2fffd3;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xd67c('0x0'));var util=require(_0xd67c('0x1'));var Redis=require(_0xd67c('0x2'));var intUtil=require(_0xd67c('0x3'));var config=require(_0xd67c('0x4'));var logger=require(_0xd67c('0x5'))(_0xd67c('0x6'));config[_0xd67c('0x7')]=_[_0xd67c('0x8')](config['redis'],{'host':_0xd67c('0x9'),'port':0x18eb});var io=require(_0xd67c('0xa'))(new Redis(config['redis']));function emit(_0x4135f6,_0x36bf3d,_0x53b526){io['to'](_0x4135f6)['emit'](_0x36bf3d,_0x53b526);}var headers={'Content-Type':_0xd67c('0xb'),'Accept':_0xd67c('0xb')};function getTicket(_0x5f5a6b,_0x3ad046,_0x3bbe1a,_0x43421e,_0x401e2f){logger[_0xd67c('0xc')](_0xd67c('0xd'));return request({'uri':util[_0xd67c('0xe')]('%s/tickets.json',_0x5f5a6b[_0xd67c('0xf')]),'method':_0xd67c('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x3bbe1a['id'],'submitter_id':_0x3ad046?_0x3ad046['id']:undefined,'assignee_id':_0x3ad046?_0x3ad046['id']:undefined,'tags':getTags(_0x43421e['Tags'],'name'),'subject':intUtil['getString'](_0x43421e['Subjects'],_0x401e2f,'\x20'),'description':intUtil[_0xd67c('0x11')](_0x43421e[_0xd67c('0x12')],_0x401e2f,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd67c('0x11')](_0x43421e[_0xd67c('0x12')],_0x401e2f,'\x0a')}},getCustomFields(_0x43421e[_0xd67c('0x13')],_0x401e2f))}})[_0xd67c('0x14')](function(_0x5c13da){logger['info']('Ticket\x20created!');return _0x5c13da['ticket'];});}function getUser(_0x59d607,_0x2621ae){if(intUtil[_0xd67c('0x15')](_0x2621ae)){logger[_0xd67c('0xc')]('Getting\x20agent\x20with\x20email',_0x2621ae);return request({'uri':util[_0xd67c('0xe')]('%s/search.json',_0x59d607['remoteUri']),'qs':{'query':util[_0xd67c('0xe')](_0xd67c('0x16'),_0x2621ae)}})[_0xd67c('0x14')](function(_0x43068d){if(_0x43068d[_0xd67c('0x17')]){logger[_0xd67c('0xc')](_0xd67c('0x18'));return _['find'](_0x43068d[_0xd67c('0x19')],{'email':_0x2621ae,'role':'agent'});}else{logger['info'](_0xd67c('0x1a'));return request({'uri':util[_0xd67c('0xe')]('%s/users/me.json',_0x59d607[_0xd67c('0xf')])})['then'](function(_0x4988b2){logger['info']('Admin\x20account\x20selected.');return _0x4988b2[_0xd67c('0x1b')];});}});}else{logger[_0xd67c('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xd67c('0x1c'),_0x59d607[_0xd67c('0xf')])})['then'](function(_0x4cec52){logger[_0xd67c('0xc')](_0xd67c('0x1d'));return _0x4cec52[_0xd67c('0x1b')];});}}function getEndUser(_0x51ab2d,_0x3d92ee,_0x5f44bb){logger[_0xd67c('0xc')](_0xd67c('0x1e'),_0x5f44bb);return request({'uri':util['format'](_0xd67c('0x1f'),_0x51ab2d[_0xd67c('0xf')]),'qs':{'query':util[_0xd67c('0xe')](_0xd67c('0x20'),_0x5f44bb)}})[_0xd67c('0x14')](function(_0x240058){var _0x4e5579;if(_0x240058[_0xd67c('0x19')][_0xd67c('0x21')]){_0x240058[_0xd67c('0x19')]=_[_0xd67c('0x22')](_0x240058[_0xd67c('0x19')],{'suspended':![],'role':_0xd67c('0x23')});if(_0x240058[_0xd67c('0x19')][_0xd67c('0x21')]){_0x4e5579=_[_0xd67c('0x24')](_0x240058[_0xd67c('0x19')]);}}if(_0x4e5579){logger['info']('Enduser\x20found!');return _0x4e5579;}else{logger['info'](_0xd67c('0x25'));return request({'uri':util[_0xd67c('0xe')](_0xd67c('0x26'),_0x51ab2d[_0xd67c('0xf')]),'method':_0xd67c('0x10'),'body':{'user':{'role':_0xd67c('0x23'),'name':util[_0xd67c('0xe')](_0xd67c('0x27'),_0x3d92ee||_0x5f44bb),'phone':_0x5f44bb}}})[_0xd67c('0x14')](function(_0x510f3b){logger[_0xd67c('0xc')]('Enduser\x20created.');return _0x510f3b[_0xd67c('0x1b')];});}});}function getAuth(_0x3b6cf3){var _0x4b47ea;if(_0x3b6cf3[_0xd67c('0x28')]==='password'){_0x4b47ea=util[_0xd67c('0xe')](_0xd67c('0x29'),_0x3b6cf3['username'],_0x3b6cf3[_0xd67c('0x2a')]);}else if(_0x3b6cf3[_0xd67c('0x28')]===_0xd67c('0x2b')){_0x4b47ea=util[_0xd67c('0xe')](_0xd67c('0x2c'),_0x3b6cf3[_0xd67c('0x2d')],_0x3b6cf3[_0xd67c('0x2b')]);}return util[_0xd67c('0xe')]('Basic\x20%s',new Buffer(_0x4b47ea)['toString'](_0xd67c('0x2e')));}function request(_0x4c2009){logger['debug'](_0xd67c('0x2f'),JSON[_0xd67c('0x30')](_0x4c2009));return rp(_['defaults'](_0x4c2009,{'method':_0xd67c('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x146992,_0x263935){var _0x4f9bd1=[];if(_0x146992&&_0x146992['length']>0x0){_0x4f9bd1=_['map'](_0x146992,_0x263935);}return _0x4f9bd1;}function getCustomFields(_0x2ae3cf,_0x254232){var _0x52fb52=[];var _0x94541d={'custom_fields':[]};if(_0x2ae3cf[_0xd67c('0x21')]>0x0){_[_0xd67c('0x32')](_0x2ae3cf,function(_0x2648c7){if(_['includes'](['string',_0xd67c('0x33')],_0x2648c7[_0xd67c('0x34')])&&_0x2648c7[_0xd67c('0x35')]&&!_0x2648c7[_0xd67c('0x36')]){_0x94541d[_0x2648c7[_0xd67c('0x35')][_0xd67c('0x37')]()]=_0x2648c7[_0xd67c('0x38')][_0xd67c('0x39')]();}else if(_[_0xd67c('0x3a')]([_0xd67c('0x3b'),_0xd67c('0x33')],_0x2648c7[_0xd67c('0x34')])&&_0x2648c7['idField']&&_0x2648c7[_0xd67c('0x36')]){_0x94541d[_0xd67c('0x3c')][_0xd67c('0x3d')]({'id':_0x2648c7[_0xd67c('0x3e')],'value':_0x2648c7[_0xd67c('0x38')][_0xd67c('0x39')]()});}else if(_0x2648c7[_0xd67c('0x34')]==='variable'&&_0x2648c7[_0xd67c('0x3f')]&&_0x2648c7[_0xd67c('0x3e')]&&_0x2648c7[_0xd67c('0x36')]){_0x254232[_0x2648c7[_0xd67c('0x3f')]]&&_0x94541d[_0xd67c('0x3c')][_0xd67c('0x3d')]({'id':_0x2648c7['idField'],'value':_0x254232[_0x2648c7[_0xd67c('0x3f')]][_0xd67c('0x39')]()});}else if(_0x2648c7[_0xd67c('0x34')]==='customVariable'&&_0x2648c7[_0xd67c('0x40')]&&_0x2648c7[_0xd67c('0x40')][_0xd67c('0x41')]&&_0x2648c7['idField']&&_0x2648c7[_0xd67c('0x36')]){_0x254232[_0x2648c7[_0xd67c('0x40')][_0xd67c('0x41')]['toLowerCase']()]&&_0x94541d['custom_fields']['push']({'id':_0x2648c7['idField'],'value':_0x254232[_0x2648c7[_0xd67c('0x40')][_0xd67c('0x41')][_0xd67c('0x37')]()][_0xd67c('0x39')]()});}});}return _0x94541d;}exports[_0xd67c('0x42')]=function(_0x578e33,_0x3839e2,_0x5626f9,_0x3342ac,_0x463473,_0x56895d){var _0x5cb7f1,_0x5ee9b1;_0x56895d[_0xd67c('0xf')]=intUtil[_0xd67c('0x43')](_0x56895d[_0xd67c('0xf')]);_0x56895d['serverUrl']=intUtil[_0xd67c('0x43')](_0x56895d['serverUrl']);if(_0x463473&&_0x463473[_0xd67c('0x44')]){logger['info'](_0xd67c('0x45'),_0xd67c('0x46'));_0x3839e2[_0xd67c('0x47')]=util[_0xd67c('0xe')](_0xd67c('0x48'),_0x56895d[_0xd67c('0x49')],_0x3839e2[_0xd67c('0x4a')],md5(_0x3839e2[_0xd67c('0x4a')]));}else{_0x3839e2[_0xd67c('0x47')]='';}headers[_0xd67c('0x4b')]=getAuth(_0x56895d);return getUser(_0x56895d,_0x3342ac[_0xd67c('0x4c')])['then'](function(_0x1c31c4){_0x5cb7f1=_0x1c31c4;logger['info'](_0xd67c('0x4d'),_0x5cb7f1['id']);return getEndUser(_0x56895d,_0x3839e2['calleridname'],_0x3839e2[_0xd67c('0x4e')]);})[_0xd67c('0x14')](function(_0x5376e5){_0x5ee9b1=_0x5376e5;logger['info'](_0xd67c('0x4f'),_0x5ee9b1['id']);return getTicket(_0x56895d,_0x5cb7f1,_0x5ee9b1,_0x5626f9,_0x3839e2);})[_0xd67c('0x14')](function(_0x259a1a){if(_0x259a1a){logger[_0xd67c('0xc')](_0xd67c('0x50'),_0x259a1a['id']);switch(_0x56895d['type']){case'integrationTab':logger[_0xd67c('0xc')](_0xd67c('0x45'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd67c('0xe')](_0xd67c('0x51'),_0x56895d[_0xd67c('0xf')],_0x5cb7f1['id'],_0x259a1a['id']),'method':_0xd67c('0x10')});case'newTab':logger['info']('[QUEUE]',_0xd67c('0x52'));emit(util[_0xd67c('0xe')](_0xd67c('0x53'),_0x3342ac[_0xd67c('0x41')]),'trigger:browser:url',{'uri':util[_0xd67c('0xe')](_0xd67c('0x54'),_0x56895d[_0xd67c('0xf')]['replace'](_0xd67c('0x55'),''),_0x259a1a['id'])});break;default:logger[_0xd67c('0x56')](_0xd67c('0x45'),_0xd67c('0x57'));}}})[_0xd67c('0x58')](function(_0x5e9cc3){logger[_0xd67c('0x56')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd67c('0x59')](_0x5e9cc3,{'showHidden':!![],'depth':null}));});};exports[_0xd67c('0x5a')]=function(_0x1bca41,_0x53679a,_0x26d8e3,_0x2ed741,_0x5b9997,_0x369281,_0x5a4d7f){var _0x169c64,_0x4eb8a5;_0x369281[_0xd67c('0xf')]=intUtil[_0xd67c('0x43')](_0x369281['remoteUri']);_0x369281[_0xd67c('0x49')]=intUtil['stripTrailingSlash'](_0x369281['serverUrl']);if(_0x5a4d7f&&_0x5a4d7f['recordingFormat']&&_0x5a4d7f['recordingFormat']!=='none'){logger[_0xd67c('0xc')](_0xd67c('0x5b'),'Recording\x20is\x20enabled!');_0x53679a['recordingURL']=util[_0xd67c('0xe')](_0xd67c('0x48'),_0x369281[_0xd67c('0x49')],_0x53679a[_0xd67c('0x4a')],md5(_0x53679a[_0xd67c('0x4a')]));}headers[_0xd67c('0x4b')]=getAuth(_0x369281);return getUser(_0x369281,_0x2ed741[_0xd67c('0x4c')])[_0xd67c('0x14')](function(_0x352d75){_0x169c64=_0x352d75;logger[_0xd67c('0xc')](_0xd67c('0x4d'),_0x169c64['id']);return getEndUser(_0x369281,_0x53679a[_0xd67c('0x5c')],_0x53679a[_0xd67c('0x5d')]);})[_0xd67c('0x14')](function(_0x52bf08){_0x4eb8a5=_0x52bf08;logger[_0xd67c('0xc')](_0xd67c('0x4f'),_0x4eb8a5['id']);return getTicket(_0x369281,_0x169c64,_0x4eb8a5,_0x26d8e3,_0x53679a);})[_0xd67c('0x14')](function(_0x417c99){if(_0x417c99){logger[_0xd67c('0xc')](_0xd67c('0x50'),_0x417c99['id']);switch(_0x369281[_0xd67c('0x34')]){case _0xd67c('0x5e'):logger['info']('[OUTBOUND]',_0xd67c('0x5f'));return request({'uri':util[_0xd67c('0xe')](_0xd67c('0x51'),_0x369281[_0xd67c('0xf')],_0x169c64['id'],_0x417c99['id']),'method':_0xd67c('0x10')});case _0xd67c('0x60'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd67c('0xe')](_0xd67c('0x53'),_0x2ed741[_0xd67c('0x41')]),_0xd67c('0x61'),{'uri':util[_0xd67c('0xe')]('%s/agent/tickets/%s',_0x369281[_0xd67c('0xf')][_0xd67c('0x62')]('/api/v2',''),_0x417c99['id'])});break;default:logger[_0xd67c('0x56')](_0xd67c('0x5b'),_0xd67c('0x57'));}}})[_0xd67c('0x58')](function(_0xba00f2){logger[_0xd67c('0x56')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd67c('0x59')](_0xba00f2,{'showHidden':!![],'depth':null}));});};exports[_0xd67c('0x63')]=function(_0x28b09a,_0x4e57ad,_0x4f5b46,_0x3a1195,_0x125d96,_0x5d0f57){var _0x13ca92,_0x45f204;_0x5d0f57['remoteUri']=intUtil[_0xd67c('0x43')](_0x5d0f57[_0xd67c('0xf')]);_0x5d0f57['serverUrl']=intUtil[_0xd67c('0x43')](_0x5d0f57['serverUrl']);if(_0x125d96&&_0x125d96[_0xd67c('0x44')]){logger[_0xd67c('0xc')]('['+_0x4e57ad['lastevent'][_0xd67c('0x64')]()+']',_0xd67c('0x46'));_0x4e57ad[_0xd67c('0x47')]=util[_0xd67c('0xe')](_0xd67c('0x48'),_0x5d0f57[_0xd67c('0x49')],_0x4e57ad['uniqueid'],md5(_0x4e57ad[_0xd67c('0x4a')]));}else{_0x4e57ad[_0xd67c('0x47')]='';}headers['Authorization']=getAuth(_0x5d0f57);return getUser(_0x5d0f57)[_0xd67c('0x14')](function(_0x46a207){_0x13ca92=_0x46a207;logger[_0xd67c('0xc')]('The\x20User\x20ID\x20is:',_0x13ca92['id']);return getEndUser(_0x5d0f57,_0x4e57ad[_0xd67c('0x65')],_0x4e57ad['calleridnum']);})[_0xd67c('0x14')](function(_0x42a08d){_0x45f204=_0x42a08d;logger[_0xd67c('0xc')](_0xd67c('0x4f'),_0x45f204['id']);return getTicket(_0x5d0f57,_0x13ca92,_0x45f204,_0x4f5b46,_0x4e57ad);})['then'](function(_0x4cf497){if(_0x4cf497){logger[_0xd67c('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4cf497['id']);}})[_0xd67c('0x58')](function(_0x2a225e){logger[_0xd67c('0x56')]('['+_0x4e57ad['lastevent'][_0xd67c('0x64')]()+']'+_0xd67c('0x66'),util[_0xd67c('0x59')](_0x2a225e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5d22=['queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','integrationTab','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','POST','name','Subjects','getString','Descriptions','then','validateEmail','Getting\x20agent\x20with\x20email','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','results','end-user','length','first','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','base64','debug','[HTTP]','stringify','map','forEach','includes','picklist','nameField','customField','toLowerCase','toString','string','type','idField','custom_fields','push','content','variable','variableName','Variable'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5d22,0x104));var _0x25d2=function(_0x1b9a2e,_0x37b29a){_0x1b9a2e=_0x1b9a2e-0x0;var _0x1f21ce=_0x5d22[_0x1b9a2e];return _0x1f21ce;};'use strict';var _=require(_0x25d2('0x0'));var rp=require(_0x25d2('0x1'));var md5=require(_0x25d2('0x2'));var util=require(_0x25d2('0x3'));var Redis=require(_0x25d2('0x4'));var intUtil=require('./util');var config=require(_0x25d2('0x5'));var logger=require(_0x25d2('0x6'))(_0x25d2('0x7'));config[_0x25d2('0x8')]=_[_0x25d2('0x9')](config['redis'],{'host':_0x25d2('0xa'),'port':0x18eb});var io=require(_0x25d2('0xb'))(new Redis(config['redis']));function emit(_0x39a2f8,_0x32b417,_0x5d5bf1){io['to'](_0x39a2f8)[_0x25d2('0xc')](_0x32b417,_0x5d5bf1);}var headers={'Content-Type':'application/json','Accept':_0x25d2('0xd')};function getTicket(_0x193012,_0x19db93,_0x514ffc,_0x55aecf,_0x5d26fc){logger[_0x25d2('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x25d2('0xf')](_0x25d2('0x10'),_0x193012['remoteUri']),'method':_0x25d2('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x514ffc['id'],'submitter_id':_0x19db93?_0x19db93['id']:undefined,'assignee_id':_0x19db93?_0x19db93['id']:undefined,'tags':getTags(_0x55aecf['Tags'],_0x25d2('0x12')),'subject':intUtil['getString'](_0x55aecf[_0x25d2('0x13')],_0x5d26fc,'\x20'),'description':intUtil[_0x25d2('0x14')](_0x55aecf[_0x25d2('0x15')],_0x5d26fc,'\x0a'),'comment':{'public':![],'body':intUtil[_0x25d2('0x14')](_0x55aecf[_0x25d2('0x15')],_0x5d26fc,'\x0a')}},getCustomFields(_0x55aecf['Fields'],_0x5d26fc))}})[_0x25d2('0x16')](function(_0x2faa15){logger[_0x25d2('0xe')]('Ticket\x20created!');return _0x2faa15['ticket'];});}function getUser(_0x1589e9,_0x2020e8){if(intUtil[_0x25d2('0x17')](_0x2020e8)){logger[_0x25d2('0xe')](_0x25d2('0x18'),_0x2020e8);return request({'uri':util[_0x25d2('0xf')]('%s/search.json',_0x1589e9['remoteUri']),'qs':{'query':util[_0x25d2('0xf')]('type:user\x20role:agent\x20email:%s',_0x2020e8)}})[_0x25d2('0x16')](function(_0x37c666){if(_0x37c666[_0x25d2('0x19')]){logger[_0x25d2('0xe')](_0x25d2('0x1a'));return _[_0x25d2('0x1b')](_0x37c666['results'],{'email':_0x2020e8,'role':_0x25d2('0x1c')});}else{logger['info'](_0x25d2('0x1d'));return request({'uri':util['format'](_0x25d2('0x1e'),_0x1589e9[_0x25d2('0x1f')])})[_0x25d2('0x16')](function(_0x404eaa){logger['info'](_0x25d2('0x20'));return _0x404eaa[_0x25d2('0x21')];});}});}else{logger[_0x25d2('0xe')](_0x25d2('0x1d'));return request({'uri':util[_0x25d2('0xf')]('%s/users/me.json',_0x1589e9[_0x25d2('0x1f')])})['then'](function(_0x926c28){logger['info']('Admin\x20account\x20selected.');return _0x926c28[_0x25d2('0x21')];});}}function getEndUser(_0x36b389,_0x5bdc90,_0x58d091){logger[_0x25d2('0xe')]('Searching\x20enduser\x20with\x20phone',_0x58d091);return request({'uri':util[_0x25d2('0xf')]('%s/search.json',_0x36b389['remoteUri']),'qs':{'query':util[_0x25d2('0xf')](_0x25d2('0x22'),_0x58d091)}})['then'](function(_0x29ab30){var _0x671fd2;if(_0x29ab30[_0x25d2('0x23')]['length']){_0x29ab30['results']=_['filter'](_0x29ab30['results'],{'suspended':![],'role':_0x25d2('0x24')});if(_0x29ab30[_0x25d2('0x23')][_0x25d2('0x25')]){_0x671fd2=_[_0x25d2('0x26')](_0x29ab30[_0x25d2('0x23')]);}}if(_0x671fd2){logger[_0x25d2('0xe')](_0x25d2('0x27'));return _0x671fd2;}else{logger[_0x25d2('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x36b389[_0x25d2('0x1f')]),'method':_0x25d2('0x11'),'body':{'user':{'role':'end-user','name':util[_0x25d2('0xf')](_0x25d2('0x28'),_0x5bdc90||_0x58d091),'phone':_0x58d091}}})['then'](function(_0x52390a){logger[_0x25d2('0xe')](_0x25d2('0x29'));return _0x52390a[_0x25d2('0x21')];});}});}function getAuth(_0x2dd508){var _0x2b732d;if(_0x2dd508[_0x25d2('0x2a')]===_0x25d2('0x2b')){_0x2b732d=util['format'](_0x25d2('0x2c'),_0x2dd508['username'],_0x2dd508[_0x25d2('0x2b')]);}else if(_0x2dd508['authType']===_0x25d2('0x2d')){_0x2b732d=util[_0x25d2('0xf')](_0x25d2('0x2e'),_0x2dd508[_0x25d2('0x2f')],_0x2dd508[_0x25d2('0x2d')]);}return util[_0x25d2('0xf')](_0x25d2('0x30'),new Buffer(_0x2b732d)['toString'](_0x25d2('0x31')));}function request(_0x56b141){logger[_0x25d2('0x32')](_0x25d2('0x33'),JSON[_0x25d2('0x34')](_0x56b141));return rp(_[_0x25d2('0x9')](_0x56b141,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x10fdf4,_0x11abbb){var _0x4baf20=[];if(_0x10fdf4&&_0x10fdf4[_0x25d2('0x25')]>0x0){_0x4baf20=_[_0x25d2('0x35')](_0x10fdf4,_0x11abbb);}return _0x4baf20;}function getCustomFields(_0x5eb877,_0x2d1627){var _0x1b0178=[];var _0x3379ec={'custom_fields':[]};if(_0x5eb877[_0x25d2('0x25')]>0x0){_[_0x25d2('0x36')](_0x5eb877,function(_0xfe2d8){if(_[_0x25d2('0x37')](['string',_0x25d2('0x38')],_0xfe2d8['type'])&&_0xfe2d8[_0x25d2('0x39')]&&!_0xfe2d8[_0x25d2('0x3a')]){_0x3379ec[_0xfe2d8[_0x25d2('0x39')][_0x25d2('0x3b')]()]=_0xfe2d8['content'][_0x25d2('0x3c')]();}else if(_[_0x25d2('0x37')]([_0x25d2('0x3d'),_0x25d2('0x38')],_0xfe2d8[_0x25d2('0x3e')])&&_0xfe2d8[_0x25d2('0x3f')]&&_0xfe2d8[_0x25d2('0x3a')]){_0x3379ec[_0x25d2('0x40')][_0x25d2('0x41')]({'id':_0xfe2d8[_0x25d2('0x3f')],'value':_0xfe2d8[_0x25d2('0x42')]['toString']()});}else if(_0xfe2d8[_0x25d2('0x3e')]===_0x25d2('0x43')&&_0xfe2d8[_0x25d2('0x44')]&&_0xfe2d8['idField']&&_0xfe2d8[_0x25d2('0x3a')]){_0x2d1627[_0xfe2d8[_0x25d2('0x44')]]&&_0x3379ec[_0x25d2('0x40')][_0x25d2('0x41')]({'id':_0xfe2d8['idField'],'value':_0x2d1627[_0xfe2d8[_0x25d2('0x44')]][_0x25d2('0x3c')]()});}else if(_0xfe2d8[_0x25d2('0x3e')]==='customVariable'&&_0xfe2d8[_0x25d2('0x45')]&&_0xfe2d8[_0x25d2('0x45')]['name']&&_0xfe2d8['idField']&&_0xfe2d8[_0x25d2('0x3a')]){_0x2d1627[_0xfe2d8['Variable'][_0x25d2('0x12')][_0x25d2('0x3b')]()]&&_0x3379ec[_0x25d2('0x40')][_0x25d2('0x41')]({'id':_0xfe2d8['idField'],'value':_0x2d1627[_0xfe2d8[_0x25d2('0x45')][_0x25d2('0x12')][_0x25d2('0x3b')]()][_0x25d2('0x3c')]()});}});}return _0x3379ec;}exports[_0x25d2('0x46')]=function(_0x589212,_0x276b13,_0x55d6ff,_0x4cb57d,_0x3de548,_0xf44429){var _0x2460a5,_0x54cb3d;_0xf44429[_0x25d2('0x1f')]=intUtil[_0x25d2('0x47')](_0xf44429['remoteUri']);_0xf44429[_0x25d2('0x48')]=intUtil[_0x25d2('0x47')](_0xf44429[_0x25d2('0x48')]);if(_0x3de548&&_0x3de548[_0x25d2('0x49')]){logger[_0x25d2('0xe')](_0x25d2('0x4a'),_0x25d2('0x4b'));_0x276b13[_0x25d2('0x4c')]=util[_0x25d2('0xf')](_0x25d2('0x4d'),_0xf44429[_0x25d2('0x48')],_0x276b13[_0x25d2('0x4e')],md5(_0x276b13['uniqueid']));}else{_0x276b13[_0x25d2('0x4c')]='';}headers[_0x25d2('0x4f')]=getAuth(_0xf44429);return getUser(_0xf44429,_0x4cb57d[_0x25d2('0x50')])[_0x25d2('0x16')](function(_0x13ac00){_0x2460a5=_0x13ac00;logger[_0x25d2('0xe')]('The\x20User\x20ID\x20is:',_0x2460a5['id']);return getEndUser(_0xf44429,_0x276b13[_0x25d2('0x51')],_0x276b13[_0x25d2('0x52')]);})[_0x25d2('0x16')](function(_0x513990){_0x54cb3d=_0x513990;logger[_0x25d2('0xe')](_0x25d2('0x53'),_0x54cb3d['id']);return getTicket(_0xf44429,_0x2460a5,_0x54cb3d,_0x55d6ff,_0x276b13);})[_0x25d2('0x16')](function(_0x5df7e3){if(_0x5df7e3){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5df7e3['id']);switch(_0xf44429[_0x25d2('0x3e')]){case'integrationTab':logger[_0x25d2('0xe')]('[QUEUE]',_0x25d2('0x54'));return request({'uri':util['format'](_0x25d2('0x55'),_0xf44429[_0x25d2('0x1f')],_0x2460a5['id'],_0x5df7e3['id']),'method':_0x25d2('0x11')});case'newTab':logger[_0x25d2('0xe')](_0x25d2('0x4a'),_0x25d2('0x56'));emit(util['format'](_0x25d2('0x57'),_0x4cb57d[_0x25d2('0x12')]),_0x25d2('0x58'),{'uri':util[_0x25d2('0xf')]('%s/agent/tickets/%s',_0xf44429['remoteUri'][_0x25d2('0x59')](_0x25d2('0x5a'),''),_0x5df7e3['id'])});break;default:logger['error']('[QUEUE]',_0x25d2('0x5b'));}}})[_0x25d2('0x5c')](function(_0x4482d2){logger[_0x25d2('0x5d')](_0x25d2('0x5e'),util[_0x25d2('0x5f')](_0x4482d2,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1198af,_0x2e40d9,_0x40e5a2,_0x561b11,_0x1cb3ae,_0x10bb3c,_0x1dce1c){var _0x3ecb90,_0x1fd5b7;_0x10bb3c[_0x25d2('0x1f')]=intUtil['stripTrailingSlash'](_0x10bb3c[_0x25d2('0x1f')]);_0x10bb3c[_0x25d2('0x48')]=intUtil[_0x25d2('0x47')](_0x10bb3c[_0x25d2('0x48')]);if(_0x1dce1c&&_0x1dce1c['recordingFormat']&&_0x1dce1c[_0x25d2('0x60')]!==_0x25d2('0x61')){logger[_0x25d2('0xe')](_0x25d2('0x62'),'Recording\x20is\x20enabled!');_0x2e40d9['recordingURL']=util['format'](_0x25d2('0x4d'),_0x10bb3c['serverUrl'],_0x2e40d9[_0x25d2('0x4e')],md5(_0x2e40d9[_0x25d2('0x4e')]));}headers[_0x25d2('0x4f')]=getAuth(_0x10bb3c);return getUser(_0x10bb3c,_0x561b11['email'])['then'](function(_0x587f59){_0x3ecb90=_0x587f59;logger[_0x25d2('0xe')](_0x25d2('0x63'),_0x3ecb90['id']);return getEndUser(_0x10bb3c,_0x2e40d9[_0x25d2('0x64')],_0x2e40d9[_0x25d2('0x65')]);})[_0x25d2('0x16')](function(_0x39b11b){_0x1fd5b7=_0x39b11b;logger[_0x25d2('0xe')](_0x25d2('0x53'),_0x1fd5b7['id']);return getTicket(_0x10bb3c,_0x3ecb90,_0x1fd5b7,_0x40e5a2,_0x2e40d9);})[_0x25d2('0x16')](function(_0x4acf78){if(_0x4acf78){logger[_0x25d2('0xe')]('The\x20Ticket\x20ID\x20is:',_0x4acf78['id']);switch(_0x10bb3c[_0x25d2('0x3e')]){case _0x25d2('0x66'):logger[_0x25d2('0xe')](_0x25d2('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x25d2('0xf')](_0x25d2('0x55'),_0x10bb3c[_0x25d2('0x1f')],_0x3ecb90['id'],_0x4acf78['id']),'method':_0x25d2('0x11')});case'newTab':logger['info'](_0x25d2('0x62'),_0x25d2('0x56'));emit(util['format'](_0x25d2('0x57'),_0x561b11[_0x25d2('0x12')]),_0x25d2('0x58'),{'uri':util[_0x25d2('0xf')](_0x25d2('0x67'),_0x10bb3c[_0x25d2('0x1f')][_0x25d2('0x59')]('/api/v2',''),_0x4acf78['id'])});break;default:logger[_0x25d2('0x5d')]('[OUTBOUND]',_0x25d2('0x5b'));}}})['catch'](function(_0x4ded73){logger[_0x25d2('0x5d')](_0x25d2('0x68'),util['inspect'](_0x4ded73,{'showHidden':!![],'depth':null}));});};exports[_0x25d2('0x69')]=function(_0x2917d7,_0x5be8c0,_0x253fa5,_0x17c9f7,_0x4b7cb1,_0x434a63){var _0x23aba7,_0x3b5d44;_0x434a63[_0x25d2('0x1f')]=intUtil[_0x25d2('0x47')](_0x434a63[_0x25d2('0x1f')]);_0x434a63[_0x25d2('0x48')]=intUtil[_0x25d2('0x47')](_0x434a63[_0x25d2('0x48')]);if(_0x4b7cb1&&_0x4b7cb1[_0x25d2('0x49')]){logger[_0x25d2('0xe')]('['+_0x5be8c0[_0x25d2('0x6a')][_0x25d2('0x6b')]()+']','Recording\x20is\x20enabled!');_0x5be8c0[_0x25d2('0x4c')]=util[_0x25d2('0xf')](_0x25d2('0x4d'),_0x434a63[_0x25d2('0x48')],_0x5be8c0['uniqueid'],md5(_0x5be8c0[_0x25d2('0x4e')]));}else{_0x5be8c0[_0x25d2('0x4c')]='';}headers['Authorization']=getAuth(_0x434a63);return getUser(_0x434a63)[_0x25d2('0x16')](function(_0x5175c2){_0x23aba7=_0x5175c2;logger['info']('The\x20User\x20ID\x20is:',_0x23aba7['id']);return getEndUser(_0x434a63,_0x5be8c0[_0x25d2('0x51')],_0x5be8c0[_0x25d2('0x52')]);})[_0x25d2('0x16')](function(_0x9dec33){_0x3b5d44=_0x9dec33;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3b5d44['id']);return getTicket(_0x434a63,_0x23aba7,_0x3b5d44,_0x253fa5,_0x5be8c0);})[_0x25d2('0x16')](function(_0x51ea36){if(_0x51ea36){logger['info'](_0x25d2('0x6c'),_0x51ea36['id']);}})[_0x25d2('0x5c')](function(_0x39fd86){logger[_0x25d2('0x5d')]('['+_0x5be8c0['lastevent'][_0x25d2('0x6b')]()+']'+_0x25d2('0x6d'),util['inspect'](_0x39fd86,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 343e99b..7203c1b 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a5a=['POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','contact','lead','nothing','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','YYYY-MM-DDTHH:mm:ss','starttime','called','Called','complete','Call_Result','Answered','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','details','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','calleridname','calleridnum','lodash','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','emit','debug','[HTTP]','stringify','length','forEach','idField','content','variableName','type','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4a5a,0x6e));var _0xa4a5=function(_0x44ff7d,_0x16542e){_0x44ff7d=_0x44ff7d-0x0;var _0x524573=_0x4a5a[_0x44ff7d];return _0x524573;};'use strict';var _=require(_0xa4a5('0x0'));var rp=require('request-promise');var md5=require(_0xa4a5('0x1'));var util=require(_0xa4a5('0x2'));var intUtil=require(_0xa4a5('0x3'));var moment=require('moment');var Redis=require(_0xa4a5('0x4'));var BPromise=require(_0xa4a5('0x5'));var config=require(_0xa4a5('0x6'));var logger=require(_0xa4a5('0x7'))(_0xa4a5('0x8'));config[_0xa4a5('0x9')]=_['defaults'](config['redis'],{'host':_0xa4a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa4a5('0x9')]));function emit(_0x161489,_0x1e4550,_0x5d0711){io['to'](_0x161489)[_0xa4a5('0xb')](_0x1e4550,_0x5d0711);}function request(_0x4eb5ad){logger[_0xa4a5('0xc')](_0xa4a5('0xd'),JSON[_0xa4a5('0xe')](_0x4eb5ad));return rp(_0x4eb5ad);}function getCustomFields(_0x226bda,_0x4dc0e5){var _0x5eed82={};if(_0x226bda[_0xa4a5('0xf')]>0x0){_[_0xa4a5('0x10')](_0x226bda,function(_0x4d35f2){if(_['includes'](['string','picklist'],_0x4d35f2['type'])&&_0x4d35f2[_0xa4a5('0x11')]){_0x5eed82[_0x4d35f2[_0xa4a5('0x11')]]=_0x4d35f2[_0xa4a5('0x12')]['toString']();}else if(_0x4d35f2['type']==='variable'&&_0x4d35f2['variableName']&&_0x4d35f2[_0xa4a5('0x11')]&&_0x4dc0e5[_0x4d35f2[_0xa4a5('0x13')]]){_0x5eed82[_0x4d35f2[_0xa4a5('0x11')]]=_0x4dc0e5[_0x4d35f2[_0xa4a5('0x13')]]['toString']();}else if(_0x4d35f2[_0xa4a5('0x14')]===_0xa4a5('0x15')&&_0x4d35f2[_0xa4a5('0x16')]&&_0x4d35f2[_0xa4a5('0x16')][_0xa4a5('0x17')]&&_0x4d35f2[_0xa4a5('0x11')]&&_0x4dc0e5[_0x4d35f2[_0xa4a5('0x16')][_0xa4a5('0x17')][_0xa4a5('0x18')]()]){_0x5eed82[_0x4d35f2[_0xa4a5('0x11')]]=_0x4dc0e5[_0x4d35f2['Variable'][_0xa4a5('0x17')]['toLowerCase']()][_0xa4a5('0x19')]();}});}return _0x5eed82;}function getName(_0x16da49){if(_0x16da49[_0xa4a5('0x1a')]('\x20')>0x0){var _0x24cd55=_0x16da49[_0xa4a5('0x1b')](/ (.+)/);if(_0x24cd55[0x1]){return _0x24cd55;}}return[_0x16da49,_0x16da49];}var accountsTokens={};function getAccessToken(_0x4e9f7f){return new Promise(function(_0x2d8d24,_0x545342){if(!_['isNil'](accountsTokens[_0x4e9f7f['id']])&&!_[_0xa4a5('0x1c')](accountsTokens[_0x4e9f7f['id']][_0xa4a5('0x1d')])){if(moment()[_0xa4a5('0x1e')](accountsTokens[_0x4e9f7f['id']][_0xa4a5('0x1f')])){_0x2d8d24(accountsTokens[_0x4e9f7f['id']][_0xa4a5('0x1d')]);}}var _0x32bf00;switch(_0x4e9f7f[_0xa4a5('0x20')]){case'US':_0x32bf00=_0xa4a5('0x21');break;case'AU':_0x32bf00='https://accounts.zoho.com.au';break;case'EU':_0x32bf00=_0xa4a5('0x22');break;case'IN':_0x32bf00=_0xa4a5('0x23');break;case'CN':_0x32bf00=_0xa4a5('0x24');break;default:_0x32bf00=_0xa4a5('0x22');break;}var _0x250000={'method':_0xa4a5('0x25'),'uri':_0x32bf00+_0xa4a5('0x26'),'qs':{'refresh_token':_0x4e9f7f[_0xa4a5('0x27')],'client_id':_0x4e9f7f['clientId'],'client_secret':_0x4e9f7f[_0xa4a5('0x28')],'grant_type':_0xa4a5('0x29')},'json':!![]};return rp(_0x250000)[_0xa4a5('0x2a')](function(_0x57a526){accountsTokens[_0x4e9f7f['id']]={'access_token':_0x57a526['access_token'],'expires_in':moment()['add'](_0x57a526['expires_in'],'seconds')};_0x2d8d24(_0x57a526[_0xa4a5('0x1d')]);})[_0xa4a5('0x2b')](function(_0x1067fa){logger[_0xa4a5('0x2c')](_0xa4a5('0x2d'),_0x1067fa['stack']);_0x545342(_0x1067fa);});});}function getUser(_0x313da2,_0x10486b,_0x484c44,_0x52bb2e){logger[_0xa4a5('0x2e')](_0xa4a5('0x2f'));return request({'method':_0xa4a5('0x30'),'uri':util['format'](_0xa4a5('0x31'),_0x10486b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x313da2},'json':!![]})['then'](function(_0x154b2e){if(_0x154b2e[_0xa4a5('0x32')]){var _0x5d09b9=-0x1;if(_[_0xa4a5('0x33')](_0x154b2e[_0xa4a5('0x32')])){if(!_['isNil'](_0x52bb2e)){_0x5d09b9=_['findIndex'](_0x154b2e['users'],function(_0x3e5e73){return _0x3e5e73['email']===_0x52bb2e;});}if(_0x5d09b9>=0x0){logger['info'](_0xa4a5('0x34'));}else{logger[_0xa4a5('0x2e')](_0xa4a5('0x35'));_0x5d09b9=_[_0xa4a5('0x36')](_0x154b2e['users'],function(_0x685729){return _0x685729[_0xa4a5('0x37')][_0xa4a5('0x17')]===_0xa4a5('0x38');});}return _0x154b2e[_0xa4a5('0x32')][_0x5d09b9];}else{if(_0x154b2e['user'][_0xa4a5('0x37')][_0xa4a5('0x17')]===_0xa4a5('0x38')){logger[_0xa4a5('0x2e')]('Using\x20the\x20admin\x20account!');user=_0x154b2e['user'];return user;}else{logger[_0xa4a5('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x154b2e));throw new Error(_0xa4a5('0x39')+JSON[_0xa4a5('0xe')](_0x154b2e));}}}else{logger[_0xa4a5('0x2c')](_0xa4a5('0x3a'),JSON['stringify'](_0x154b2e));throw new Error(_0xa4a5('0x39')+JSON['stringify'](_0x154b2e));}})['catch'](function(_0xa9c23c){console[_0xa4a5('0x2c')](_0xa9c23c);});}function getZohoUser(_0x18f33f,_0x91dc34){return new BPromise(function(_0x470eb6,_0x194d23){request(_0x18f33f)['then'](function(_0x4230c9){var _0x355f80=null;if(_0x4230c9){_0x355f80=_0x4230c9[_0xa4a5('0x3b')][0x0];_0x355f80[_0xa4a5('0x3c')]=_0x91dc34;}_0x470eb6(_0x355f80);})['catch'](function(_0x1d44f1){_0x194d23(_0x1d44f1);});});}function createEndUser(_0x3a690f,_0x4d111a,_0x50a3a0,_0x26ad20,_0x51d70f,_0xeec8b){var _0x50a3a0=getName(_0x50a3a0);return request({'method':_0xa4a5('0x25'),'uri':'https://www.zohoapis.'+_0x4d111a+_0xa4a5('0x3d')+_['startCase'](_0xeec8b[_0xa4a5('0x3e')])+'s','body':{'data':[{'Last_Name':_0x50a3a0[0x1],'First_Name':_0x50a3a0[0x0],'Phone':_0x26ad20,'Owner':{'name':!_[_0xa4a5('0x1c')](_0x51d70f[_0xa4a5('0x3f')][_0xa4a5('0x17')])?_0x51d70f[_0xa4a5('0x3f')][_0xa4a5('0x17')]:!_[_0xa4a5('0x1c')](_0x51d70f[_0xa4a5('0x40')])?_0x51d70f['first_name']+'\x20'+_0x51d70f[_0xa4a5('0x41')]:_0x51d70f[_0xa4a5('0x41')],'id':_0x51d70f['id']}}]},'headers':{'Authorization':_0xa4a5('0x42')+_0x3a690f},'json':!![]})[_0xa4a5('0x2a')](function(_0x159330){if(_0x159330&&_0x159330[_0xa4a5('0x3b')][0x0][_0xa4a5('0x43')]===_0xa4a5('0x44')){var _0x47a9f1=_0x159330[_0xa4a5('0x3b')][0x0]['details'];_0x47a9f1['enduserType']=_[_0xa4a5('0x45')](_0xeec8b[_0xa4a5('0x3e')])+'s';return _0x47a9f1;}logger['error'](_0xa4a5('0x3a'),JSON['stringify'](data));throw new Error(_0xa4a5('0x46')+JSON['stringify'](data));})[_0xa4a5('0x2b')](function(_0x46a7c8){console[_0xa4a5('0x47')](_0xa4a5('0x48'),_0x46a7c8);});}function getEndUser(_0x5e40a2,_0x16a71f,_0x144374,_0x52bc00,_0x237799,_0xdadc63,_0xa59588){var _0x52a884={'method':'GET','uri':'','headers':{'Authorization':_0xa4a5('0x42')+_0x5e40a2},'json':!![]};switch(_0xa59588[_0xa4a5('0x49')]){case'contact_lead':_0x52a884['uri']=_0xa4a5('0x4a')+_0x16a71f+_0xa4a5('0x4b')+_0x237799+'))';return getZohoUser(_0x52a884,'Contacts')['then'](function(_0x296dd7){if(_0x296dd7)return _0x296dd7;_0x52a884['uri']=_0xa4a5('0x4a')+_0x16a71f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x237799+'))';return getZohoUser(_0x52a884,_0xa4a5('0x4c'))[_0xa4a5('0x2a')](function(_0x296b88){if(_0x296b88)return _0x296b88;if(_0xa59588['moduleCreate']!='nothing'){return createEndUser(_0x5e40a2,_0x16a71f,_0x52bc00,_0x237799,_0xdadc63,_0xa59588);}else{return{};}});});break;case _0xa4a5('0x4d'):_0x52a884['uri']=_0xa4a5('0x4a')+_0x16a71f+_0xa4a5('0x4b')+_0x237799+'))';return getZohoUser(_0x52a884,'Contacts')['then'](function(_0x115ea7){if(_0x115ea7)return _0x115ea7;if(_0xa59588[_0xa4a5('0x3e')]!='nothing'){return createEndUser(_0x5e40a2,_0x16a71f,_0x52bc00,_0x237799,_0xdadc63,_0xa59588);}else{return{};}});break;case _0xa4a5('0x4e'):_0x52a884['uri']='https://www.zohoapis.'+_0x16a71f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x237799+'))';return getZohoUser(_0x52a884,_0xa4a5('0x4c'))[_0xa4a5('0x2a')](function(_0x46992e){if(_0x46992e)return _0x46992e;if(_0xa59588[_0xa4a5('0x3e')]!=_0xa4a5('0x4f')){return createEndUser(_0x5e40a2,_0x16a71f,_0x52bc00,_0x237799,_0xdadc63,_0xa59588);}else{return{};}});break;}}function getCall(_0x21cc9e,_0x46b364,_0xe060ed,_0x447124,_0x575352,_0x5505a3,_0x4ca6e2,_0x262ec8){logger[_0xa4a5('0x2e')](_0xa4a5('0x50'));var _0x2be2f3={};_0x2be2f3[_0xa4a5('0x51')]={'name':!_['isNil'](_0x447124['role'][_0xa4a5('0x17')])&&!_[_0xa4a5('0x1c')](_0x447124['profile'][_0xa4a5('0x17')])&&_0x447124['profile'][_0xa4a5('0x17')]===_0xa4a5('0x52')?_0x447124['role'][_0xa4a5('0x17')]:!_['isNil'](_0x447124[_0xa4a5('0x40')])?_0x447124['first_name']+'\x20'+_0x447124['last_name']:_0x447124[_0xa4a5('0x41')],'id':_0x447124['id']};_0x2be2f3['Subject']=intUtil[_0xa4a5('0x53')](_0x5505a3[_0xa4a5('0x54')],_0x4ca6e2,'\x20');_0x2be2f3['Description']=intUtil[_0xa4a5('0x53')](_0x5505a3[_0xa4a5('0x55')],_0x4ca6e2,'\x0a');if(_0x575352['enduserType']==='Contacts'){_0x2be2f3[_0xa4a5('0x56')]={'name':!_['isNil'](_0x575352[_0xa4a5('0x57')])?_0x575352['Full_Name']:!_[_0xa4a5('0x1c')](_0x575352[_0xa4a5('0x58')])?_0x575352[_0xa4a5('0x58')]+'\x20'+_0x575352[_0xa4a5('0x59')]:_0x575352['Last_Name'],'id':_0x575352['id']};}if(_0x575352[_0xa4a5('0x3c')]===_0xa4a5('0x4c')){_0x2be2f3[_0xa4a5('0x5a')]={'name':!_[_0xa4a5('0x1c')](_0x575352[_0xa4a5('0x57')])?_0x575352[_0xa4a5('0x57')]:!_[_0xa4a5('0x1c')](_0x575352['First_Name'])?_0x575352[_0xa4a5('0x58')]+'\x20'+_0x575352[_0xa4a5('0x59')]:_0x575352[_0xa4a5('0x59')],'id':_0x575352['id']};_0x2be2f3[_0xa4a5('0x5b')]=_[_0xa4a5('0x45')](_0x575352['enduserType']);}if(_0x4ca6e2[_0xa4a5('0x5c')]){_0x2be2f3[_0xa4a5('0x5d')]=moment[_0xa4a5('0x5e')](parseInt(_0x4ca6e2[_0xa4a5('0x5c')])*0x3e8)[_0xa4a5('0x5f')](_0xa4a5('0x60'));}else if(_0x4ca6e2[_0xa4a5('0x61')]&&_0x4ca6e2['endtime']){_0x2be2f3[_0xa4a5('0x5d')]=moment[_0xa4a5('0x5e')](moment(_0x4ca6e2['endtime'],_0xa4a5('0x62'))['diff'](moment(_0x4ca6e2[_0xa4a5('0x63')],_0xa4a5('0x62'))))[_0xa4a5('0x5f')](_0xa4a5('0x60'));}switch(_0x4ca6e2['lastevent']){case _0xa4a5('0x64'):_0x2be2f3['Call_Result']=_0xa4a5('0x65');break;case _0xa4a5('0x66'):case'connect':_0x2be2f3[_0xa4a5('0x67')]=_0xa4a5('0x68');break;case'rejected':_0x2be2f3[_0xa4a5('0x67')]=_0xa4a5('0x69');break;case _0xa4a5('0x6a'):_0x2be2f3[_0xa4a5('0x67')]='Abandoned';break;case _0xa4a5('0x6b'):_0x2be2f3[_0xa4a5('0x67')]='Timeout';default:}_0x2be2f3[_0xa4a5('0x6c')]=(_0x262ec8===_0xa4a5('0x6d')?moment(_0x4ca6e2['starttime'])[_0xa4a5('0x5f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x4ca6e2[_0xa4a5('0x6e')])['format'](_0xa4a5('0x62')))||moment()[_0xa4a5('0x5f')](_0xa4a5('0x62'));_0x2be2f3[_0xa4a5('0x6f')]=_0x262ec8||_0xa4a5('0x70');_0x2be2f3=_[_0xa4a5('0x71')](_0x2be2f3,getCustomFields(_0x5505a3['Fields'],_0x4ca6e2));return request({'method':_0xa4a5('0x25'),'uri':_0xa4a5('0x4a')+_0x46b364+_0xa4a5('0x72'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x21cc9e},'body':{'data':[_0x2be2f3]},'json':!![]})['then'](function(_0x33746e){if(_0x33746e&&_0x33746e[_0xa4a5('0x3b')][0x0]['code']==='SUCCESS'){logger['info'](_0xa4a5('0x73'));return{'id':_0x33746e[_0xa4a5('0x3b')][0x0][_0xa4a5('0x74')]['id']};}})[_0xa4a5('0x2b')](function(_0x583b0b){logger[_0xa4a5('0x2e')](_0xa4a5('0x75'),_0x583b0b[_0xa4a5('0x76')]);console[_0xa4a5('0x47')](_0xa4a5('0x75'),_0x583b0b);});}exports[_0xa4a5('0x77')]=function(_0x19f3c4,_0x5b4fd9,_0xdbcb83,_0x296004,_0x8d99df,_0x1bdc89){var _0x2c9ebb,_0x54d37f,_0x2afe31;_0x1bdc89[_0xa4a5('0x78')]=intUtil[_0xa4a5('0x79')](_0x1bdc89[_0xa4a5('0x78')]);_0x1bdc89[_0xa4a5('0x7a')]=intUtil['stripTrailingSlash'](_0x1bdc89[_0xa4a5('0x7a')]);if(_0x8d99df&&_0x8d99df[_0xa4a5('0x7b')]){logger[_0xa4a5('0x2e')]('[QUEUE]',_0xa4a5('0x7c'));_0x5b4fd9[_0xa4a5('0x7d')]=_0x1bdc89[_0xa4a5('0x7a')]+'/api/voice/recordings/'+_0x5b4fd9[_0xa4a5('0x7e')]+_0xa4a5('0x7f')+md5(_0x5b4fd9[_0xa4a5('0x7e')]);}else{_0x5b4fd9[_0xa4a5('0x7d')]='';}var _0x505bcc=_0x1bdc89[_0xa4a5('0x78')]===_0xa4a5('0x80')?'eu':_0xa4a5('0x81');return getAccessToken(_0x1bdc89)[_0xa4a5('0x2a')](function(_0x45d345){_0x2afe31=_0x45d345;return getUser(_0x2afe31,_0x505bcc,_0x1bdc89,_0x296004[_0xa4a5('0x82')]);})[_0xa4a5('0x2a')](function(_0x297006){_0x2c9ebb=_0x297006;logger[_0xa4a5('0x2e')]('The\x20User\x20ID\x20is:',_0x2c9ebb['id']);return getEndUser(_0x2afe31,_0x505bcc,_0x1bdc89,_0x5b4fd9['calleridname'],_0x5b4fd9['calleridnum'],_0x2c9ebb,_0xdbcb83);})[_0xa4a5('0x2a')](function(_0x1512e3){_0x54d37f=_0x1512e3;return getCall(_0x2afe31,_0x505bcc,_0x1bdc89,_0x2c9ebb,_0x54d37f,_0xdbcb83,_0x5b4fd9,'Inbound');})['then'](function(_0x256b42){if(_0x256b42){logger[_0xa4a5('0x2e')](_0xa4a5('0x83'),_0x256b42['id']);logger['info']('[QUEUE]',_0xa4a5('0x84'));emit(util[_0xa4a5('0x5f')](_0xa4a5('0x85'),_0x296004[_0xa4a5('0x17')]),_0xa4a5('0x86'),{'uri':_0xa4a5('0x87')+_0x1bdc89['host']+_0xa4a5('0x88')+_0x256b42['id']});}})[_0xa4a5('0x2b')](function(_0x51fd5f){logger[_0xa4a5('0x2c')]('[QUEUE]',JSON[_0xa4a5('0xe')](_0x51fd5f));});};exports[_0xa4a5('0x6d')]=function(_0x14a9cd,_0x213db7,_0x113ca9,_0x10de09,_0x992589,_0x194d14,_0x2caced){var _0x587abb,_0x478f94,_0x3bcb9f;_0x194d14[_0xa4a5('0x78')]=intUtil['stripTrailingSlash'](_0x194d14[_0xa4a5('0x78')]);_0x194d14[_0xa4a5('0x7a')]=intUtil['stripTrailingSlash'](_0x194d14[_0xa4a5('0x7a')]);if(_0x2caced&&_0x2caced[_0xa4a5('0x89')]&&_0x2caced[_0xa4a5('0x89')]!==_0xa4a5('0x8a')){logger[_0xa4a5('0x2e')]('[OUTBOUND]',_0xa4a5('0x7c'));_0x213db7[_0xa4a5('0x7d')]=_0x194d14[_0xa4a5('0x7a')]+_0xa4a5('0x8b')+_0x213db7['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x213db7[_0xa4a5('0x7e')]);}var _0x3f1d02=_0x194d14[_0xa4a5('0x78')]==='zoho.eu'?'eu':_0xa4a5('0x81');return getAccessToken(_0x194d14)[_0xa4a5('0x2a')](function(_0xbcac48){_0x3bcb9f=_0xbcac48;return getUser(_0x3bcb9f,_0x3f1d02,_0x194d14,_0x10de09[_0xa4a5('0x82')]);})[_0xa4a5('0x2a')](function(_0xcdef70){_0x587abb=_0xcdef70;logger[_0xa4a5('0x2e')]('The\x20User\x20ID\x20is:',_0x587abb['id']);return getEndUser(_0x3bcb9f,_0x3f1d02,_0x194d14,_0x213db7[_0xa4a5('0x8c')],_0x213db7[_0xa4a5('0x8d')],_0x587abb,_0x113ca9);})[_0xa4a5('0x2a')](function(_0x29a5f9){_0x478f94=_0x29a5f9;return getCall(_0x3bcb9f,_0x3f1d02,_0x194d14,_0x587abb,_0x478f94,_0x113ca9,_0x213db7,_0xa4a5('0x8e'));})[_0xa4a5('0x2a')](function(_0x40872c){if(_0x40872c){logger[_0xa4a5('0x2e')](_0xa4a5('0x83'),_0x40872c['id']);logger[_0xa4a5('0x2e')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa4a5('0x5f')](_0xa4a5('0x85'),_0x10de09[_0xa4a5('0x17')]),_0xa4a5('0x86'),{'uri':_0xa4a5('0x87')+_0x194d14[_0xa4a5('0x78')]+_0xa4a5('0x88')+_0x40872c['id']});}})['catch'](function(_0x459d3e){logger['error']('[OUTBOUND]',JSON[_0xa4a5('0xe')](_0x459d3e));});};exports[_0xa4a5('0x8f')]=function(_0x59d43a,_0x4c19f8,_0xc16612,_0x301b69,_0x2a2ca3,_0x2246c5){var _0x2de4bd,_0x49bfab,_0x29cc2d;_0x2246c5[_0xa4a5('0x78')]=intUtil[_0xa4a5('0x79')](_0x2246c5[_0xa4a5('0x78')]);_0x2246c5[_0xa4a5('0x7a')]=intUtil[_0xa4a5('0x79')](_0x2246c5[_0xa4a5('0x7a')]);if(_0x2a2ca3&&_0x2a2ca3[_0xa4a5('0x7b')]){logger[_0xa4a5('0x2e')]('['+_0x4c19f8[_0xa4a5('0x90')]['toUpperCase']()+']',_0xa4a5('0x7c'));_0x4c19f8['recordingURL']=_0x2246c5[_0xa4a5('0x7a')]+_0xa4a5('0x8b')+_0x4c19f8[_0xa4a5('0x7e')]+_0xa4a5('0x7f')+md5(_0x4c19f8[_0xa4a5('0x7e')]);}else{_0x4c19f8['recordingURL']='';}var _0x47ed29=_0x2246c5[_0xa4a5('0x78')]==='zoho.eu'?'eu':_0xa4a5('0x81');return getAccessToken(_0x2246c5)[_0xa4a5('0x2a')](function(_0x5b059c){_0x29cc2d=_0x5b059c;return getUser(_0x29cc2d,_0x47ed29,_0x2246c5);})[_0xa4a5('0x2a')](function(_0x21c7ce){_0x2de4bd=_0x21c7ce;logger[_0xa4a5('0x2e')]('The\x20User\x20ID\x20is:',_0x2de4bd['id']);return getEndUser(_0x29cc2d,_0x47ed29,_0x2246c5,_0x4c19f8[_0xa4a5('0x91')],_0x4c19f8[_0xa4a5('0x92')],_0x2de4bd,_0xc16612);})[_0xa4a5('0x2a')](function(_0x2f3c83){_0x49bfab=_0x2f3c83;return getCall(_0x29cc2d,_0x47ed29,_0x2246c5,_0x2de4bd,_0x49bfab,_0xc16612,_0x4c19f8,'Inbound');})[_0xa4a5('0x2a')](function(_0x11a2bd){if(_0x11a2bd){logger[_0xa4a5('0x2e')]('The\x20Call\x20ID\x20is:',_0x11a2bd['id']);}})[_0xa4a5('0x2b')](function(_0x1fb052){logger['error']('['+_0x4c19f8[_0xa4a5('0x90')]['toUpperCase']()+']',JSON[_0xa4a5('0xe')](_0x1fb052));});}; \ No newline at end of file +var _0xbb1e=['util','./util','ioredis','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','forEach','string','picklist','idField','variableName','toString','type','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','then','seconds','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','nothing','contact','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','rejected','Abandoned','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','https://crm.','unmanaged','lastevent','toUpperCase','request-promise','md5'];(function(_0x5c0fa9,_0x4dbc85){var _0x853fa9=function(_0x21cb87){while(--_0x21cb87){_0x5c0fa9['push'](_0x5c0fa9['shift']());}};_0x853fa9(++_0x4dbc85);}(_0xbb1e,0x90));var _0xebb1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbb1e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var rp=require(_0xebb1('0x0'));var md5=require(_0xebb1('0x1'));var util=require(_0xebb1('0x2'));var intUtil=require(_0xebb1('0x3'));var moment=require('moment');var Redis=require(_0xebb1('0x4'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xebb1('0x5'))(_0xebb1('0x6'));config[_0xebb1('0x7')]=_[_0xebb1('0x8')](config[_0xebb1('0x7')],{'host':_0xebb1('0x9'),'port':0x18eb});var io=require(_0xebb1('0xa'))(new Redis(config[_0xebb1('0x7')]));function emit(_0x9fcae9,_0x2a248d,_0x4f34e5){io['to'](_0x9fcae9)[_0xebb1('0xb')](_0x2a248d,_0x4f34e5);}function request(_0x15f6cb){logger[_0xebb1('0xc')](_0xebb1('0xd'),JSON['stringify'](_0x15f6cb));return rp(_0x15f6cb);}function getCustomFields(_0xc420df,_0x4ded78){var _0x1d3dfc={};if(_0xc420df['length']>0x0){_[_0xebb1('0xe')](_0xc420df,function(_0x11a4ff){if(_['includes']([_0xebb1('0xf'),_0xebb1('0x10')],_0x11a4ff['type'])&&_0x11a4ff['idField']){_0x1d3dfc[_0x11a4ff['idField']]=_0x11a4ff['content']['toString']();}else if(_0x11a4ff['type']==='variable'&&_0x11a4ff['variableName']&&_0x11a4ff[_0xebb1('0x11')]&&_0x4ded78[_0x11a4ff[_0xebb1('0x12')]]){_0x1d3dfc[_0x11a4ff[_0xebb1('0x11')]]=_0x4ded78[_0x11a4ff[_0xebb1('0x12')]][_0xebb1('0x13')]();}else if(_0x11a4ff[_0xebb1('0x14')]===_0xebb1('0x15')&&_0x11a4ff[_0xebb1('0x16')]&&_0x11a4ff[_0xebb1('0x16')][_0xebb1('0x17')]&&_0x11a4ff['idField']&&_0x4ded78[_0x11a4ff[_0xebb1('0x16')]['name'][_0xebb1('0x18')]()]){_0x1d3dfc[_0x11a4ff[_0xebb1('0x11')]]=_0x4ded78[_0x11a4ff[_0xebb1('0x16')][_0xebb1('0x17')][_0xebb1('0x18')]()][_0xebb1('0x13')]();}});}return _0x1d3dfc;}function getName(_0x35a091){if(_0x35a091[_0xebb1('0x19')]('\x20')>0x0){var _0x32f834=_0x35a091[_0xebb1('0x1a')](/ (.+)/);if(_0x32f834[0x1]){return _0x32f834;}}return[_0x35a091,_0x35a091];}var accountsTokens={};function getAccessToken(_0xc9c86c){return new Promise(function(_0x5e2f4e,_0x3ed952){if(!_[_0xebb1('0x1b')](accountsTokens[_0xc9c86c['id']])&&!_[_0xebb1('0x1b')](accountsTokens[_0xc9c86c['id']][_0xebb1('0x1c')])){if(moment()['isBefore'](accountsTokens[_0xc9c86c['id']][_0xebb1('0x1d')])){_0x5e2f4e(accountsTokens[_0xc9c86c['id']]['access_token']);}}var _0x40b9af;switch(_0xc9c86c[_0xebb1('0x1e')]){case'US':_0x40b9af='https://accounts.zoho.com';break;case'AU':_0x40b9af=_0xebb1('0x1f');break;case'EU':_0x40b9af=_0xebb1('0x20');break;case'IN':_0x40b9af=_0xebb1('0x21');break;case'CN':_0x40b9af=_0xebb1('0x22');break;default:_0x40b9af='https://accounts.zoho.eu';break;}var _0x3c94a8={'method':_0xebb1('0x23'),'uri':_0x40b9af+_0xebb1('0x24'),'qs':{'refresh_token':_0xc9c86c['refreshToken'],'client_id':_0xc9c86c[_0xebb1('0x25')],'client_secret':_0xc9c86c[_0xebb1('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3c94a8)[_0xebb1('0x27')](function(_0x147c0b){accountsTokens[_0xc9c86c['id']]={'access_token':_0x147c0b[_0xebb1('0x1c')],'expires_in':moment()['add'](_0x147c0b[_0xebb1('0x1d')],_0xebb1('0x28'))};_0x5e2f4e(_0x147c0b['access_token']);})['catch'](function(_0x475cfd){logger['error']('Failing\x20creating\x20the\x20access_token',_0x475cfd[_0xebb1('0x29')]);_0x3ed952(_0x475cfd);});});}function getUser(_0x142991,_0x1cb0ce,_0x1e4562,_0x449093){logger[_0xebb1('0x2a')](_0xebb1('0x2b'));return request({'method':_0xebb1('0x2c'),'uri':util[_0xebb1('0x2d')](_0xebb1('0x2e'),_0x1cb0ce),'qs':{'type':_0xebb1('0x2f')},'headers':{'Authorization':_0xebb1('0x30')+_0x142991},'json':!![]})[_0xebb1('0x27')](function(_0x1941a4){if(_0x1941a4['users']){var _0x45cf48=-0x1;if(_[_0xebb1('0x31')](_0x1941a4['users'])){if(!_[_0xebb1('0x1b')](_0x449093)){_0x45cf48=_['findIndex'](_0x1941a4[_0xebb1('0x32')],function(_0x1d7b7a){return _0x1d7b7a['email']===_0x449093;});}if(_0x45cf48>=0x0){logger[_0xebb1('0x2a')](_0xebb1('0x33'));}else{logger[_0xebb1('0x2a')](_0xebb1('0x34'));_0x45cf48=_[_0xebb1('0x35')](_0x1941a4[_0xebb1('0x32')],function(_0xa1b703){return _0xa1b703[_0xebb1('0x36')]['name']===_0xebb1('0x37');});}return _0x1941a4['users'][_0x45cf48];}else{if(_0x1941a4[_0xebb1('0x38')][_0xebb1('0x36')][_0xebb1('0x17')]===_0xebb1('0x37')){logger[_0xebb1('0x2a')]('Using\x20the\x20admin\x20account!');user=_0x1941a4[_0xebb1('0x38')];return user;}else{logger[_0xebb1('0x39')](_0xebb1('0x3a'),JSON[_0xebb1('0x3b')](_0x1941a4));throw new Error(_0xebb1('0x3c')+JSON[_0xebb1('0x3b')](_0x1941a4));}}}else{logger[_0xebb1('0x39')](_0xebb1('0x3a'),JSON[_0xebb1('0x3b')](_0x1941a4));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xebb1('0x3b')](_0x1941a4));}})[_0xebb1('0x3d')](function(_0xf39d9c){console[_0xebb1('0x39')](_0xf39d9c);});}function getZohoUser(_0x13a01d,_0x2c96b6){return new BPromise(function(_0x1199b9,_0x3237f9){request(_0x13a01d)[_0xebb1('0x27')](function(_0x222f73){var _0x154ef4=null;if(_0x222f73){_0x154ef4=_0x222f73['data'][0x0];_0x154ef4[_0xebb1('0x3e')]=_0x2c96b6;}_0x1199b9(_0x154ef4);})[_0xebb1('0x3d')](function(_0x8cf587){_0x3237f9(_0x8cf587);});});}function createEndUser(_0xf0c469,_0x136e07,_0x204d77,_0x4851d5,_0x221e23,_0x17c72d){var _0x204d77=getName(_0x204d77);return request({'method':_0xebb1('0x23'),'uri':'https://www.zohoapis.'+_0x136e07+'/crm/v2/'+_['startCase'](_0x17c72d[_0xebb1('0x3f')])+'s','body':{'data':[{'Last_Name':_0x204d77[0x1],'First_Name':_0x204d77[0x0],'Phone':_0x4851d5,'Owner':{'name':!_[_0xebb1('0x1b')](_0x221e23[_0xebb1('0x40')][_0xebb1('0x17')])?_0x221e23[_0xebb1('0x40')][_0xebb1('0x17')]:!_['isNil'](_0x221e23[_0xebb1('0x41')])?_0x221e23[_0xebb1('0x41')]+'\x20'+_0x221e23['last_name']:_0x221e23[_0xebb1('0x42')],'id':_0x221e23['id']}}]},'headers':{'Authorization':_0xebb1('0x30')+_0xf0c469},'json':!![]})[_0xebb1('0x27')](function(_0x1d2c7e){if(_0x1d2c7e&&_0x1d2c7e[_0xebb1('0x43')][0x0][_0xebb1('0x44')]===_0xebb1('0x45')){var _0x390adf=_0x1d2c7e[_0xebb1('0x43')][0x0][_0xebb1('0x46')];_0x390adf['enduserType']=_[_0xebb1('0x47')](_0x17c72d[_0xebb1('0x3f')])+'s';return _0x390adf;}logger[_0xebb1('0x39')](_0xebb1('0x3a'),JSON[_0xebb1('0x3b')](data));throw new Error(_0xebb1('0x48')+JSON[_0xebb1('0x3b')](data));})[_0xebb1('0x3d')](function(_0x270e28){console[_0xebb1('0x49')](_0xebb1('0x4a'),_0x270e28);});}function getEndUser(_0xf8ca30,_0x1b62a3,_0x3d486c,_0x2344b0,_0x25e5c7,_0x22019d,_0xa0c84e){var _0x3ff691={'method':'GET','uri':'','headers':{'Authorization':_0xebb1('0x30')+_0xf8ca30},'json':!![]};switch(_0xa0c84e[_0xebb1('0x4b')]){case _0xebb1('0x4c'):_0x3ff691['uri']='https://www.zohoapis.'+_0x1b62a3+_0xebb1('0x4d')+_0x25e5c7+'))';return getZohoUser(_0x3ff691,_0xebb1('0x4e'))['then'](function(_0x5dc13e){if(_0x5dc13e)return _0x5dc13e;_0x3ff691[_0xebb1('0x4f')]='https://www.zohoapis.'+_0x1b62a3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x25e5c7+'))';return getZohoUser(_0x3ff691,'Leads')['then'](function(_0x56dcaf){if(_0x56dcaf)return _0x56dcaf;if(_0xa0c84e[_0xebb1('0x3f')]!=_0xebb1('0x50')){return createEndUser(_0xf8ca30,_0x1b62a3,_0x2344b0,_0x25e5c7,_0x22019d,_0xa0c84e);}else{return{};}});});break;case _0xebb1('0x51'):_0x3ff691[_0xebb1('0x4f')]='https://www.zohoapis.'+_0x1b62a3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x25e5c7+'))';return getZohoUser(_0x3ff691,'Contacts')[_0xebb1('0x27')](function(_0x344621){if(_0x344621)return _0x344621;if(_0xa0c84e['moduleCreate']!=_0xebb1('0x50')){return createEndUser(_0xf8ca30,_0x1b62a3,_0x2344b0,_0x25e5c7,_0x22019d,_0xa0c84e);}else{return{};}});break;case'lead':_0x3ff691[_0xebb1('0x4f')]=_0xebb1('0x52')+_0x1b62a3+_0xebb1('0x53')+_0x25e5c7+'))';return getZohoUser(_0x3ff691,'Leads')[_0xebb1('0x27')](function(_0x4fdbc2){if(_0x4fdbc2)return _0x4fdbc2;if(_0xa0c84e[_0xebb1('0x3f')]!='nothing'){return createEndUser(_0xf8ca30,_0x1b62a3,_0x2344b0,_0x25e5c7,_0x22019d,_0xa0c84e);}else{return{};}});break;}}function getCall(_0x599199,_0x4c100b,_0x211e02,_0x3f5e0f,_0xa8ad4c,_0x55013c,_0x5948d1,_0x18bf23){logger['info']('Creating\x20new\x20call...');var _0x44caa3={};_0x44caa3['Owner']={'name':!_[_0xebb1('0x1b')](_0x3f5e0f['role']['name'])&&!_[_0xebb1('0x1b')](_0x3f5e0f[_0xebb1('0x36')][_0xebb1('0x17')])&&_0x3f5e0f[_0xebb1('0x36')][_0xebb1('0x17')]===_0xebb1('0x54')?_0x3f5e0f[_0xebb1('0x40')][_0xebb1('0x17')]:!_['isNil'](_0x3f5e0f[_0xebb1('0x41')])?_0x3f5e0f[_0xebb1('0x41')]+'\x20'+_0x3f5e0f[_0xebb1('0x42')]:_0x3f5e0f['last_name'],'id':_0x3f5e0f['id']};_0x44caa3['Subject']=intUtil[_0xebb1('0x55')](_0x55013c[_0xebb1('0x56')],_0x5948d1,'\x20');_0x44caa3[_0xebb1('0x57')]=intUtil['getString'](_0x55013c['Descriptions'],_0x5948d1,'\x0a');if(_0xa8ad4c[_0xebb1('0x3e')]===_0xebb1('0x4e')){_0x44caa3[_0xebb1('0x58')]={'name':!_[_0xebb1('0x1b')](_0xa8ad4c['Full_Name'])?_0xa8ad4c[_0xebb1('0x59')]:!_[_0xebb1('0x1b')](_0xa8ad4c['First_Name'])?_0xa8ad4c[_0xebb1('0x5a')]+'\x20'+_0xa8ad4c[_0xebb1('0x5b')]:_0xa8ad4c[_0xebb1('0x5b')],'id':_0xa8ad4c['id']};}if(_0xa8ad4c['enduserType']==='Leads'){_0x44caa3['What_Id']={'name':!_[_0xebb1('0x1b')](_0xa8ad4c[_0xebb1('0x59')])?_0xa8ad4c[_0xebb1('0x59')]:!_[_0xebb1('0x1b')](_0xa8ad4c['First_Name'])?_0xa8ad4c[_0xebb1('0x5a')]+'\x20'+_0xa8ad4c['Last_Name']:_0xa8ad4c[_0xebb1('0x5b')],'id':_0xa8ad4c['id']};_0x44caa3['$se_module']=_[_0xebb1('0x47')](_0xa8ad4c[_0xebb1('0x3e')]);}if(_0x5948d1['talktime']){_0x44caa3[_0xebb1('0x5c')]=moment[_0xebb1('0x5d')](parseInt(_0x5948d1[_0xebb1('0x5e')])*0x3e8)[_0xebb1('0x2d')](_0xebb1('0x5f'));}else if(_0x5948d1[_0xebb1('0x60')]&&_0x5948d1['endtime']){_0x44caa3[_0xebb1('0x5c')]=moment[_0xebb1('0x5d')](moment(_0x5948d1[_0xebb1('0x61')],_0xebb1('0x62'))['diff'](moment(_0x5948d1['starttime'],_0xebb1('0x62'))))[_0xebb1('0x2d')](_0xebb1('0x5f'));}switch(_0x5948d1['lastevent']){case _0xebb1('0x63'):_0x44caa3[_0xebb1('0x64')]=_0xebb1('0x65');break;case _0xebb1('0x66'):case'connect':_0x44caa3[_0xebb1('0x64')]='Answered';break;case _0xebb1('0x67'):_0x44caa3['Call_Result']='Rejected';break;case'abandoned':_0x44caa3[_0xebb1('0x64')]=_0xebb1('0x68');break;case'timeout':_0x44caa3[_0xebb1('0x64')]=_0xebb1('0x69');default:}_0x44caa3[_0xebb1('0x6a')]=(_0x18bf23==='outbound'?moment(_0x5948d1[_0xebb1('0x6b')])[_0xebb1('0x2d')](_0xebb1('0x62')):moment(_0x5948d1[_0xebb1('0x6c')])['format'](_0xebb1('0x62')))||moment()['format'](_0xebb1('0x62'));_0x44caa3[_0xebb1('0x6d')]=_0x18bf23||_0xebb1('0x6e');_0x44caa3=_[_0xebb1('0x6f')](_0x44caa3,getCustomFields(_0x55013c[_0xebb1('0x70')],_0x5948d1));return request({'method':_0xebb1('0x23'),'uri':_0xebb1('0x52')+_0x4c100b+_0xebb1('0x71'),'headers':{'Authorization':_0xebb1('0x30')+_0x599199},'body':{'data':[_0x44caa3]},'json':!![]})[_0xebb1('0x27')](function(_0x4d9ae2){if(_0x4d9ae2&&_0x4d9ae2[_0xebb1('0x43')][0x0]['code']===_0xebb1('0x45')){logger[_0xebb1('0x2a')](_0xebb1('0x72'));return{'id':_0x4d9ae2[_0xebb1('0x43')][0x0][_0xebb1('0x46')]['id']};}})[_0xebb1('0x3d')](function(_0x21d0b0){logger[_0xebb1('0x2a')]('err',_0x21d0b0[_0xebb1('0x29')]);console['log'](_0xebb1('0x73'),_0x21d0b0);});}exports['queue']=function(_0x24328a,_0x490356,_0xd937b5,_0x52214b,_0x4ceaab,_0x54aaaa){var _0x3c26e4,_0x20edad,_0x1935bc;_0x54aaaa[_0xebb1('0x74')]=intUtil[_0xebb1('0x75')](_0x54aaaa['host']);_0x54aaaa[_0xebb1('0x76')]=intUtil[_0xebb1('0x75')](_0x54aaaa[_0xebb1('0x76')]);if(_0x4ceaab&&_0x4ceaab[_0xebb1('0x77')]){logger[_0xebb1('0x2a')]('[QUEUE]',_0xebb1('0x78'));_0x490356[_0xebb1('0x79')]=_0x54aaaa[_0xebb1('0x76')]+_0xebb1('0x7a')+_0x490356[_0xebb1('0x7b')]+_0xebb1('0x7c')+md5(_0x490356['uniqueid']);}else{_0x490356[_0xebb1('0x79')]='';}var _0xac4684=_0x54aaaa[_0xebb1('0x74')]===_0xebb1('0x7d')?'eu':_0xebb1('0x7e');return getAccessToken(_0x54aaaa)[_0xebb1('0x27')](function(_0x17334b){_0x1935bc=_0x17334b;return getUser(_0x1935bc,_0xac4684,_0x54aaaa,_0x52214b[_0xebb1('0x7f')]);})[_0xebb1('0x27')](function(_0x2be1e6){_0x3c26e4=_0x2be1e6;logger[_0xebb1('0x2a')](_0xebb1('0x80'),_0x3c26e4['id']);return getEndUser(_0x1935bc,_0xac4684,_0x54aaaa,_0x490356[_0xebb1('0x81')],_0x490356[_0xebb1('0x82')],_0x3c26e4,_0xd937b5);})[_0xebb1('0x27')](function(_0x1e4d61){_0x20edad=_0x1e4d61;return getCall(_0x1935bc,_0xac4684,_0x54aaaa,_0x3c26e4,_0x20edad,_0xd937b5,_0x490356,'Inbound');})[_0xebb1('0x27')](function(_0x4686cc){if(_0x4686cc){logger[_0xebb1('0x2a')](_0xebb1('0x83'),_0x4686cc['id']);logger['info']('[QUEUE]',_0xebb1('0x84'));emit(util['format'](_0xebb1('0x85'),_0x52214b['name']),_0xebb1('0x86'),{'uri':'https://crm.'+_0x54aaaa[_0xebb1('0x74')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4686cc['id']});}})['catch'](function(_0x131cfa){logger[_0xebb1('0x39')](_0xebb1('0x87'),JSON[_0xebb1('0x3b')](_0x131cfa));});};exports[_0xebb1('0x88')]=function(_0x2d96fb,_0x5aa8f5,_0x2892ce,_0x5ad285,_0x31b181,_0x106308,_0x4d8a5d){var _0x339464,_0x55db14,_0x37c4d2;_0x106308[_0xebb1('0x74')]=intUtil[_0xebb1('0x75')](_0x106308[_0xebb1('0x74')]);_0x106308[_0xebb1('0x76')]=intUtil[_0xebb1('0x75')](_0x106308[_0xebb1('0x76')]);if(_0x4d8a5d&&_0x4d8a5d[_0xebb1('0x89')]&&_0x4d8a5d[_0xebb1('0x89')]!==_0xebb1('0x8a')){logger['info'](_0xebb1('0x8b'),_0xebb1('0x78'));_0x5aa8f5[_0xebb1('0x79')]=_0x106308[_0xebb1('0x76')]+_0xebb1('0x7a')+_0x5aa8f5[_0xebb1('0x7b')]+_0xebb1('0x7c')+md5(_0x5aa8f5[_0xebb1('0x7b')]);}var _0xe8726b=_0x106308['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x106308)[_0xebb1('0x27')](function(_0x5a64ad){_0x37c4d2=_0x5a64ad;return getUser(_0x37c4d2,_0xe8726b,_0x106308,_0x5ad285['email']);})[_0xebb1('0x27')](function(_0x2a7506){_0x339464=_0x2a7506;logger[_0xebb1('0x2a')]('The\x20User\x20ID\x20is:',_0x339464['id']);return getEndUser(_0x37c4d2,_0xe8726b,_0x106308,_0x5aa8f5[_0xebb1('0x8c')],_0x5aa8f5[_0xebb1('0x8d')],_0x339464,_0x2892ce);})[_0xebb1('0x27')](function(_0x3e341e){_0x55db14=_0x3e341e;return getCall(_0x37c4d2,_0xe8726b,_0x106308,_0x339464,_0x55db14,_0x2892ce,_0x5aa8f5,'Outbound');})[_0xebb1('0x27')](function(_0x47d12f){if(_0x47d12f){logger[_0xebb1('0x2a')]('The\x20Call\x20ID\x20is:',_0x47d12f['id']);logger['info'](_0xebb1('0x8b'),_0xebb1('0x84'));emit(util['format'](_0xebb1('0x85'),_0x5ad285[_0xebb1('0x17')]),_0xebb1('0x86'),{'uri':_0xebb1('0x8e')+_0x106308[_0xebb1('0x74')]+'/crm/EntityInfo.do?module=Calls&id='+_0x47d12f['id']});}})[_0xebb1('0x3d')](function(_0xfaa930){logger[_0xebb1('0x39')](_0xebb1('0x8b'),JSON[_0xebb1('0x3b')](_0xfaa930));});};exports[_0xebb1('0x8f')]=function(_0x2c25fc,_0x5d9cfb,_0x12a06e,_0x5e91fc,_0x160639,_0x2dfaad){var _0x45240b,_0x2564cf,_0x4ded3a;_0x2dfaad[_0xebb1('0x74')]=intUtil[_0xebb1('0x75')](_0x2dfaad[_0xebb1('0x74')]);_0x2dfaad[_0xebb1('0x76')]=intUtil[_0xebb1('0x75')](_0x2dfaad[_0xebb1('0x76')]);if(_0x160639&&_0x160639[_0xebb1('0x77')]){logger[_0xebb1('0x2a')]('['+_0x5d9cfb[_0xebb1('0x90')][_0xebb1('0x91')]()+']',_0xebb1('0x78'));_0x5d9cfb['recordingURL']=_0x2dfaad['serverUrl']+_0xebb1('0x7a')+_0x5d9cfb['uniqueid']+_0xebb1('0x7c')+md5(_0x5d9cfb[_0xebb1('0x7b')]);}else{_0x5d9cfb[_0xebb1('0x79')]='';}var _0x58387c=_0x2dfaad[_0xebb1('0x74')]===_0xebb1('0x7d')?'eu':_0xebb1('0x7e');return getAccessToken(_0x2dfaad)['then'](function(_0x3ca206){_0x4ded3a=_0x3ca206;return getUser(_0x4ded3a,_0x58387c,_0x2dfaad);})[_0xebb1('0x27')](function(_0x4e3a5a){_0x45240b=_0x4e3a5a;logger[_0xebb1('0x2a')](_0xebb1('0x80'),_0x45240b['id']);return getEndUser(_0x4ded3a,_0x58387c,_0x2dfaad,_0x5d9cfb[_0xebb1('0x81')],_0x5d9cfb['calleridnum'],_0x45240b,_0x12a06e);})[_0xebb1('0x27')](function(_0x536e97){_0x2564cf=_0x536e97;return getCall(_0x4ded3a,_0x58387c,_0x2dfaad,_0x45240b,_0x2564cf,_0x12a06e,_0x5d9cfb,'Inbound');})[_0xebb1('0x27')](function(_0x4fed9c){if(_0x4fed9c){logger[_0xebb1('0x2a')](_0xebb1('0x83'),_0x4fed9c['id']);}})['catch'](function(_0x27f839){logger[_0xebb1('0x39')]('['+_0x5d9cfb[_0xebb1('0x90')][_0xebb1('0x91')]()+']',JSON[_0xebb1('0x3b')](_0x27f839));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 8468140..826e34b 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf18d=['data3','render','error','format','info','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf18d,0x19d));var _0xdf18=function(_0x2e6d80,_0x38ca97){_0x2e6d80=_0x2e6d80-0x0;var _0x4d29f2=_0xf18d[_0x2e6d80];return _0x4d29f2;};'use strict';var util=require(_0xdf18('0x0'));var sh=require(_0xdf18('0x1'));var Mustache=require(_0xdf18('0x2'));var logger=require(_0xdf18('0x3'))(_0xdf18('0x4'));exports[_0xdf18('0x5')]=function(_0x4b7962,_0x17dff8){var _0x35224b=_0x4b7962[_0xdf18('0x6')]?_0x4b7962[_0xdf18('0x6')]:'Script';var _0x44fde8=_0x4b7962[_0xdf18('0x7')]?Mustache[_0xdf18('0x8')](_0x4b7962['data3'],_0x17dff8):_0x17dff8;sh['exec'](_0x44fde8,function(_0x1a3724,_0xbbf06b,_0x641ea7){if(_0x1a3724!==0x0){logger[_0xdf18('0x9')](util[_0xdf18('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x35224b,_0x44fde8,_0x1a3724,_0x641ea7));}else{logger[_0xdf18('0xb')](util[_0xdf18('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x35224b,_0x44fde8,_0xbbf06b));}});}; \ No newline at end of file +var _0xd81c=['data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','Script'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd81c,0xd6));var _0xcd81=function(_0xf20bbd,_0x148402){_0xf20bbd=_0xf20bbd-0x0;var _0xc40730=_0xd81c[_0xf20bbd];return _0xc40730;};'use strict';var util=require(_0xcd81('0x0'));var sh=require(_0xcd81('0x1'));var Mustache=require(_0xcd81('0x2'));var logger=require('../../../../config/logger')(_0xcd81('0x3'));exports[_0xcd81('0x4')]=function(_0x1835c1,_0x41554c){var _0x28de7e=_0x1835c1[_0xcd81('0x5')]?_0x1835c1['data2']:_0xcd81('0x6');var _0xa790b1=_0x1835c1[_0xcd81('0x7')]?Mustache[_0xcd81('0x8')](_0x1835c1[_0xcd81('0x7')],_0x41554c):_0x41554c;sh[_0xcd81('0x4')](_0xa790b1,function(_0xb3b78,_0x176ad1,_0xeb50dd){if(_0xb3b78!==0x0){logger[_0xcd81('0x9')](util['format'](_0xcd81('0xa'),_0x28de7e,_0xa790b1,_0xb3b78,_0xeb50dd));}else{logger[_0xcd81('0xb')](util['format'](_0xcd81('0xc'),_0x28de7e,_0xa790b1,_0x176ad1));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 42160c6..ad4e6a9 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8cd=['%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','../../../../config/logger','trigger','exec','data1','render','data2','data5','data6','error','stack','toUpperCase','GET','DELETE','POST','data7','body','info','format'];(function(_0x4f8e5c,_0x29af5c){var _0x917a18=function(_0x5ea553){while(--_0x5ea553){_0x4f8e5c['push'](_0x4f8e5c['shift']());}};_0x917a18(++_0x29af5c);}(_0xc8cd,0xe4));var _0xdc8c=function(_0x20c2c2,_0x42fa43){_0x20c2c2=_0x20c2c2-0x0;var _0x599b63=_0xc8cd[_0x20c2c2];return _0x599b63;};'use strict';var rp=require('request-promise');var util=require(_0xdc8c('0x0'));var _=require(_0xdc8c('0x1'));var Mustache=require('mustache');var logger=require(_0xdc8c('0x2'))(_0xdc8c('0x3'));exports[_0xdc8c('0x4')]=function(_0x29accd,_0x2804cc){var _0x541746,_0x31fadd;var _0x36de99={'method':_0x29accd[_0xdc8c('0x5')]['toUpperCase'](),'uri':Mustache[_0xdc8c('0x6')](_0x29accd[_0xdc8c('0x7')],_0x2804cc),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x29accd[_0xdc8c('0x8')])==='number'&&parseInt(_0x29accd[_0xdc8c('0x8')])>=0x1&&parseInt(_0x29accd['data5'])<=0xa?parseInt(_0x29accd[_0xdc8c('0x8')])*0x3e8:0x5*0x3e8};try{_0x36de99['headers']=_0x29accd['data6']?JSON['parse'](Mustache['render'](_0x29accd[_0xdc8c('0x9')],_0x2804cc)):{};}catch(_0x5d1d7d){logger[_0xdc8c('0xa')](_0x5d1d7d[_0xdc8c('0xb')]);}switch(_0x29accd[_0xdc8c('0x5')][_0xdc8c('0xc')]()){case _0xdc8c('0xd'):case _0xdc8c('0xe'):_0x541746=null;_0x36de99['qs']=_0x2804cc;break;case _0xdc8c('0xf'):case'PUT':if(_0x29accd['data7']){try{_0x541746=JSON['parse'](Mustache[_0xdc8c('0x6')](_0x29accd[_0xdc8c('0x10')],_0x2804cc));_0x36de99['body']=_0x541746;}catch(_0x600ac8){logger[_0xdc8c('0xa')](_0x600ac8[_0xdc8c('0xb')]);logger[_0xdc8c('0xa')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x541746=_0x2804cc;_0x36de99[_0xdc8c('0x11')]=_0x541746;}break;}logger[_0xdc8c('0x12')](util[_0xdc8c('0x13')](_0xdc8c('0x14'),_0x29accd[_0xdc8c('0x5')],_0x29accd[_0xdc8c('0x7')],JSON['stringify'](_0x36de99)));rp(_0x36de99)[_0xdc8c('0x15')](function(_0x1a863c){_0x541746=!_[_0xdc8c('0x16')](_0x541746)?_0xdc8c('0x17')+_0x541746:'';_0x31fadd=typeof _0x1a863c['body']===_0xdc8c('0x18')?JSON[_0xdc8c('0x19')](_0x1a863c[_0xdc8c('0x11')]):_0x1a863c[_0xdc8c('0x11')];logger[_0xdc8c('0x12')](util['format'](_0xdc8c('0x1a'),_0x29accd[_0xdc8c('0x5')],_0x29accd[_0xdc8c('0x7')],_0x1a863c[_0xdc8c('0x1b')],_0x31fadd));})['catch'](function(_0x290396){logger[_0xdc8c('0xa')](util[_0xdc8c('0x13')](_0xdc8c('0x1c'),_0x29accd[_0xdc8c('0x5')],_0x29accd['data2'],_0x290396['statusCode'],_0x290396[_0xdc8c('0x1d')],_0x290396[_0xdc8c('0x1e')]));});}; \ No newline at end of file +var _0x94ad=['message','request-promise','util','mustache','../../../../config/logger','data1','toUpperCase','render','data5','headers','stack','DELETE','PUT','data7','parse','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil',',\x20request\x20body:\x20','object','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x94ad,0x15d));var _0xd94a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x94ad[_0x342baa];return _0x1208f3;};'use strict';var rp=require(_0xd94a('0x0'));var util=require(_0xd94a('0x1'));var _=require('lodash');var Mustache=require(_0xd94a('0x2'));var logger=require(_0xd94a('0x3'))('trigger');exports['exec']=function(_0x46c2e3,_0x4726d8){var _0x5e853a,_0x20706f;var _0x35c0c9={'method':_0x46c2e3[_0xd94a('0x4')][_0xd94a('0x5')](),'uri':Mustache[_0xd94a('0x6')](_0x46c2e3['data2'],_0x4726d8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x46c2e3[_0xd94a('0x7')])==='number'&&parseInt(_0x46c2e3[_0xd94a('0x7')])>=0x1&&parseInt(_0x46c2e3[_0xd94a('0x7')])<=0xa?parseInt(_0x46c2e3[_0xd94a('0x7')])*0x3e8:0x5*0x3e8};try{_0x35c0c9[_0xd94a('0x8')]=_0x46c2e3['data6']?JSON['parse'](Mustache[_0xd94a('0x6')](_0x46c2e3['data6'],_0x4726d8)):{};}catch(_0x2b0af1){logger['error'](_0x2b0af1[_0xd94a('0x9')]);}switch(_0x46c2e3[_0xd94a('0x4')][_0xd94a('0x5')]()){case'GET':case _0xd94a('0xa'):_0x5e853a=null;_0x35c0c9['qs']=_0x4726d8;break;case'POST':case _0xd94a('0xb'):if(_0x46c2e3[_0xd94a('0xc')]){try{_0x5e853a=JSON[_0xd94a('0xd')](Mustache[_0xd94a('0x6')](_0x46c2e3[_0xd94a('0xc')],_0x4726d8));_0x35c0c9[_0xd94a('0xe')]=_0x5e853a;}catch(_0x4c30ee){logger[_0xd94a('0xf')](_0x4c30ee['stack']);logger['error'](_0xd94a('0x10'));}}else{_0x5e853a=_0x4726d8;_0x35c0c9[_0xd94a('0xe')]=_0x5e853a;}break;}logger[_0xd94a('0x11')](util[_0xd94a('0x12')](_0xd94a('0x13'),_0x46c2e3[_0xd94a('0x4')],_0x46c2e3[_0xd94a('0x14')],JSON[_0xd94a('0x15')](_0x35c0c9)));rp(_0x35c0c9)['then'](function(_0x393234){_0x5e853a=!_[_0xd94a('0x16')](_0x5e853a)?_0xd94a('0x17')+_0x5e853a:'';_0x20706f=typeof _0x393234[_0xd94a('0xe')]===_0xd94a('0x18')?JSON[_0xd94a('0x15')](_0x393234[_0xd94a('0xe')]):_0x393234['body'];logger[_0xd94a('0x11')](util[_0xd94a('0x12')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x46c2e3[_0xd94a('0x4')],_0x46c2e3[_0xd94a('0x14')],_0x393234[_0xd94a('0x19')],_0x20706f));})['catch'](function(_0x36929d){logger['error'](util[_0xd94a('0x12')](_0xd94a('0x1a'),_0x46c2e3[_0xd94a('0x4')],_0x46c2e3[_0xd94a('0x14')],_0x36929d['statusCode'],_0x36929d[_0xd94a('0x1b')],_0x36929d[_0xd94a('0x1c')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b9d6446..480a8d7 100644 --- a/server/services/email/client.js +++ b/server/services/email/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a92=['result','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x6a92,0x1b5));var _0x26a9=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x6a92[_0x476bf4];return _0x788ffe;};'use strict';var jayson=require(_0x26a9('0x0'));var BPromise=require('bluebird');var logger=require(_0x26a9('0x1'))(_0x26a9('0x2'));var client=jayson[_0x26a9('0x3')][_0x26a9('0x4')]({'port':0x2329});client[_0x26a9('0x5')]=function(_0xf6821d,_0x39759c){return new BPromise(function(_0x597378,_0x371aa5){return client[_0x26a9('0x6')](_0xf6821d,_0x39759c)['then'](function(_0x4294f8){logger[_0x26a9('0x7')](_0x26a9('0x8'),_0x26a9('0x2'),_0xf6821d,_0x39759c,_0x4294f8);if(_0x4294f8[_0x26a9('0x9')]){logger['error']('rpc','routing',_0xf6821d,_0x4294f8['error'][_0x26a9('0xa')],_0x39759c);return _0x371aa5(_0x4294f8[_0x26a9('0x9')]['message']);}else{return _0x597378(_0x4294f8[_0x26a9('0xb')]);}})[_0x26a9('0xc')](function(_0x5bf1a5){logger[_0x26a9('0x9')](_0x26a9('0x8'),_0x26a9('0x2'),_0xf6821d,_0x5bf1a5,_0x39759c);return _0x371aa5(_0x5bf1a5);});});};module[_0x26a9('0xd')]=client; \ No newline at end of file +var _0x12c6=['result','catch','../../config/logger','client','request','debug','rpc','routing','error','message'];(function(_0x1fcd95,_0x13578a){var _0x95252=function(_0x3d6ccb){while(--_0x3d6ccb){_0x1fcd95['push'](_0x1fcd95['shift']());}};_0x95252(++_0x13578a);}(_0x12c6,0x192));var _0x612c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x12c6[_0x122ef9];return _0x42fba0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x612c('0x0'))('routing');var client=jayson[_0x612c('0x1')]['http']({'port':0x2329});client['Request']=function(_0x249746,_0x361541){return new BPromise(function(_0xa52599,_0x578d90){return client[_0x612c('0x2')](_0x249746,_0x361541)['then'](function(_0x4d188f){logger[_0x612c('0x3')](_0x612c('0x4'),_0x612c('0x5'),_0x249746,_0x361541,_0x4d188f);if(_0x4d188f[_0x612c('0x6')]){logger[_0x612c('0x6')](_0x612c('0x4'),'routing',_0x249746,_0x4d188f[_0x612c('0x6')]['message'],_0x361541);return _0x578d90(_0x4d188f[_0x612c('0x6')][_0x612c('0x7')]);}else{return _0xa52599(_0x4d188f[_0x612c('0x8')]);}})[_0x612c('0x9')](function(_0x3b3084){logger['error'](_0x612c('0x4'),_0x612c('0x5'),_0x249746,_0x3b3084,_0x361541);return _0x578d90(_0x3b3084);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 05e1bdf..dd3ce5c 100644 --- a/server/services/email/index.js +++ b/server/services/email/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x688a=['listen','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./rpc/setting','../../config/logger','email','then','getMailAccounts','mailAccounts'];(function(_0x26683c,_0x304652){var _0x306ed5=function(_0x4103ea){while(--_0x4103ea){_0x26683c['push'](_0x26683c['shift']());}};_0x306ed5(++_0x304652);}(_0x688a,0x1dd));var _0xa688=function(_0x3a5cb7,_0xfc4d87){_0x3a5cb7=_0x3a5cb7-0x0;var _0x4e5f8b=_0x688a[_0x3a5cb7];return _0x4e5f8b;};'use strict';var server=require('./server');var Realtime=require(_0xa688('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0xa688('0x1'));var logger=require(_0xa688('0x2'))(_0xa688('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xa688('0x4')](mailAccount[_0xa688('0x5')]())[_0xa688('0x4')](realtime['initMailAccounts']())[_0xa688('0x4')](function(){email['refresh'](realtime[_0xa688('0x6')]);return realtime;});}function main(){return server[_0xa688('0x7')](realtime,email)[_0xa688('0x4')](function(){return initRealtime();})[_0xa688('0x4')](function(){return setting['getSettings']();})[_0xa688('0x4')](function(_0x5474da){return setInterval(initRealtime,_0x5474da[_0xa688('0x8')]*0x3e8);})['catch'](function(_0x3f33e4){logger[_0xa688('0x9')](_0xa688('0xa'),_0x3f33e4);});}main(); \ No newline at end of file +var _0xe70f=['../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','error','./server','./lib/email','./rpc/setting'];(function(_0x36f922,_0xd35384){var _0x174416=function(_0x39821f){while(--_0x39821f){_0x36f922['push'](_0x36f922['shift']());}};_0x174416(++_0xd35384);}(_0xe70f,0x97));var _0xfe70=function(_0x1639d5,_0x51fbaa){_0x1639d5=_0x1639d5-0x0;var _0x4a63bc=_0xe70f[_0x1639d5];return _0x4a63bc;};'use strict';var server=require(_0xfe70('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xfe70('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xfe70('0x2'));var logger=require(_0xfe70('0x3'))(_0xfe70('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xfe70('0x5')]()[_0xfe70('0x6')](mailAccount[_0xfe70('0x7')]())[_0xfe70('0x6')](realtime[_0xfe70('0x8')]())[_0xfe70('0x6')](function(){email['refresh'](realtime[_0xfe70('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xfe70('0x6')](function(){return initRealtime();})[_0xfe70('0x6')](function(){return setting[_0xfe70('0xa')]();})[_0xfe70('0x6')](function(_0x2bb8f6){return setInterval(initRealtime,_0x2bb8f6[_0xfe70('0xb')]*0x3e8);})[_0xfe70('0xc')](function(_0x56b0a9){logger[_0xfe70('0xd')]('Email\x20service\x20initialization',_0x56b0a9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index b141b2d..d15378b 100644 --- a/server/services/email/lib/email.js +++ b/server/services/email/lib/email.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa87=['error','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','imapAccounts','prototype','emit','mailAccounts','name','key','active','status','Imap','messageStatus','total','stringify','mailAccount:update','hasOwnProperty','provider','service','handleImapBox','bind','handleImapEnd','isNil','disabled','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','catch','lastSync','sendMail','send','verifySmtp','Smtp','smtp','verify','verified'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xaa87,0xa7));var _0x7aa8=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xaa87[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var moment=require(_0x7aa8('0x0'));var BPromise=require(_0x7aa8('0x1'));var md5=require(_0x7aa8('0x2'));var Redis=require(_0x7aa8('0x3'));var config=require(_0x7aa8('0x4'));var logger=require(_0x7aa8('0x5'))(_0x7aa8('0x6'));config[_0x7aa8('0x7')]=_[_0x7aa8('0x8')](config[_0x7aa8('0x7')],{'host':_0x7aa8('0x9'),'port':0x18eb});var io=require(_0x7aa8('0xa'))(new Redis(config[_0x7aa8('0x7')]));var EmailImap=require(_0x7aa8('0xb'));var EmailSmtp=require(_0x7aa8('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1ccb1a){logger['info'](_0x7aa8('0xd'));this['mailAccounts']=_0x1ccb1a['mailAccounts'];this[_0x7aa8('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7aa8('0xf')][_0x7aa8('0x10')]=function(_0x59ca6c){var _0x1f3615=this[_0x7aa8('0x11')][_0x59ca6c];var _0xcf6f30={'id':_0x1f3615['id'],'name':_0x1f3615[_0x7aa8('0x12')],'key':_0x1f3615[_0x7aa8('0x13')],'active':_0x1f3615[_0x7aa8('0x14')],'Imap':{'status':_0x1f3615['Imap'][_0x7aa8('0x15')],'messageStatus':_0x1f3615[_0x7aa8('0x16')][_0x7aa8('0x17')],'total':_0x1f3615['Imap'][_0x7aa8('0x18')]}};if(_['isNil'](md5Accounts[_0x59ca6c])){md5Accounts[_0x59ca6c]={};}var _0x3c8f59=md5(JSON[_0x7aa8('0x19')](_0xcf6f30));if(md5Accounts[_0x59ca6c][_0x7aa8('0x2')]!==_0x3c8f59){md5Accounts[_0x59ca6c]['md5']=_0x3c8f59;io[_0x7aa8('0x10')](_0x7aa8('0x1a'),_0xcf6f30);}};EmailChannel[_0x7aa8('0xf')]['refresh']=function(_0x16e37b){for(var _0x2c09d9 in _0x16e37b){if(_0x16e37b[_0x7aa8('0x1b')](_0x2c09d9)){if(_0x16e37b[_0x2c09d9][_0x7aa8('0x16')]&&_0x16e37b[_0x2c09d9][_0x7aa8('0x14')]){var _0x258de1=_0x16e37b[_0x2c09d9][_0x7aa8('0x16')];if(!_0x258de1['service']&&_0x16e37b[_0x2c09d9][_0x7aa8('0x1c')]!=='custom')_0x258de1[_0x7aa8('0x1d')]=_0x16e37b[_0x2c09d9][_0x7aa8('0x1c')];if(!this[_0x7aa8('0xe')][_0x7aa8('0x1b')](_0x258de1['id'])){this[_0x7aa8('0xe')][_0x258de1['id']]=new EmailImap(_0x258de1,_0x16e37b[_0x2c09d9]['email']);this[_0x7aa8('0xe')][_0x258de1['id']]['on']('box',this[_0x7aa8('0x1e')][_0x7aa8('0x1f')](this,_0x2c09d9));this[_0x7aa8('0xe')][_0x258de1['id']]['on'](_0x7aa8('0x6'),this['handleImapEmail'][_0x7aa8('0x1f')](this,_0x2c09d9));this[_0x7aa8('0xe')][_0x258de1['id']]['on']('end',this[_0x7aa8('0x20')][_0x7aa8('0x1f')](this,_0x2c09d9));this[_0x7aa8('0xe')][_0x258de1['id']]['on']('error',this['handleImapError'][_0x7aa8('0x1f')](this,_0x2c09d9));}}else{if(_[_0x7aa8('0x21')](this['mailAccounts'][_0x2c09d9][_0x7aa8('0x16')])){this[_0x7aa8('0x11')][_0x2c09d9]['Imap']={};}this['mailAccounts'][_0x2c09d9][_0x7aa8('0x16')][_0x7aa8('0x15')]=_0x7aa8('0x22');this[_0x7aa8('0x11')][_0x2c09d9]['Imap'][_0x7aa8('0x17')]='';this[_0x7aa8('0x10')](_0x2c09d9);}}}};EmailChannel[_0x7aa8('0xf')][_0x7aa8('0x1e')]=function(_0x196d1a,_0x5f3a23){if(this[_0x7aa8('0x11')][_0x196d1a]){this['mailAccounts'][_0x196d1a][_0x7aa8('0x16')][_0x7aa8('0x15')]=_0x7aa8('0x23');this[_0x7aa8('0x11')][_0x196d1a][_0x7aa8('0x16')][_0x7aa8('0x17')]=_0x5f3a23[_0x7aa8('0x12')];if(_0x5f3a23['messages']){this[_0x7aa8('0x11')][_0x196d1a][_0x7aa8('0x16')]['total']=_0x5f3a23[_0x7aa8('0x24')][_0x7aa8('0x18')];}return this[_0x7aa8('0x10')](_0x196d1a);}};EmailChannel['prototype'][_0x7aa8('0x25')]=function(_0x3c7810,_0x1cf767){logger[_0x7aa8('0x26')](_0x7aa8('0x27'),_0x1cf767[_0x7aa8('0x28')],_0x1cf767['lastName'],_0x1cf767[_0x7aa8('0x29')],_0x3c7810);if(this[_0x7aa8('0x11')][_0x3c7810]){return mailAccount[_0x7aa8('0x2a')](_0x3c7810,_0x1cf767)[_0x7aa8('0x2b')](function(_0x42fced){if(_0x42fced){logger[_0x7aa8('0x26')]('Mail\x20accepted\x20from\x20routing');}})[_0x7aa8('0x2c')](function(_0x1c732a){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x7aa8('0x19')](_0x1c732a));});}};EmailChannel['prototype'][_0x7aa8('0x20')]=function(_0x48e301){if(this[_0x7aa8('0x11')][_0x48e301]&&this['mailAccounts'][_0x48e301][_0x7aa8('0x16')]){if(this[_0x7aa8('0xe')][this[_0x7aa8('0x11')][_0x48e301][_0x7aa8('0x16')]['id']]){delete this[_0x7aa8('0xe')][this[_0x7aa8('0x11')][_0x48e301]['Imap']['id']];}this['mailAccounts'][_0x48e301]['Imap'][_0x7aa8('0x2d')]=moment();this[_0x7aa8('0x10')](_0x48e301);}};EmailChannel[_0x7aa8('0xf')]['handleImapError']=function(_0x455b53,_0x868a61){if(this['mailAccounts'][_0x455b53]){this[_0x7aa8('0x11')][_0x455b53][_0x7aa8('0x16')][_0x7aa8('0x15')]='error';this[_0x7aa8('0x11')][_0x455b53][_0x7aa8('0x16')][_0x7aa8('0x17')]=_0x868a61;return this[_0x7aa8('0x10')](_0x455b53);}};EmailChannel['prototype'][_0x7aa8('0x2e')]=function(_0x5c43af,_0x18d081){return this['smtp'][_0x7aa8('0x2f')](_0x5c43af,_0x18d081);};EmailChannel[_0x7aa8('0xf')][_0x7aa8('0x30')]=function(_0x24ed37){var _0x47cab2=this;if(this['mailAccounts'][_0x24ed37['id']]){if(_[_0x7aa8('0x21')](this['mailAccounts'][_0x24ed37['id']][_0x7aa8('0x31')])){this[_0x7aa8('0x11')][_0x24ed37['id']][_0x7aa8('0x31')]={};}this[_0x7aa8('0x11')][_0x24ed37['id']][_0x7aa8('0x31')][_0x7aa8('0x2d')]=moment();return new BPromise(function(_0x2effc5,_0x409d98){return _0x47cab2[_0x7aa8('0x32')][_0x7aa8('0x33')](_0x24ed37)[_0x7aa8('0x2b')](function(_0x4e2dc3){_0x47cab2[_0x7aa8('0x11')][_0x24ed37['id']][_0x7aa8('0x31')][_0x7aa8('0x15')]=_0x7aa8('0x34');_0x47cab2[_0x7aa8('0x11')][_0x24ed37['id']]['Smtp']['messageStatus']='';_0x47cab2[_0x7aa8('0x10')](_0x24ed37['id']);_0x2effc5(_0x4e2dc3);})[_0x7aa8('0x2c')](function(_0x344039){_0x47cab2[_0x7aa8('0x11')][_0x24ed37['id']][_0x7aa8('0x31')]['status']=_0x7aa8('0x35');_0x47cab2[_0x7aa8('0x11')][_0x24ed37['id']]['Smtp'][_0x7aa8('0x17')]=_0x344039;_0x47cab2['emit'](_0x24ed37['id']);_0x409d98(_0x344039);});});}return this['smtp'][_0x7aa8('0x33')](_0x24ed37);};module[_0x7aa8('0x36')]=EmailChannel; \ No newline at end of file +var _0xf8c6=['verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','messageStatus','total','md5','hasOwnProperty','service','provider','box','handleImapBox','bind','handleImapEmail','end','error','isNil','status','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','smtp','send'];(function(_0x505ce3,_0x2120ac){var _0x11588a=function(_0x2b1d02){while(--_0x2b1d02){_0x505ce3['push'](_0x505ce3['shift']());}};_0x11588a(++_0x2120ac);}(_0xf8c6,0xac));var _0x6f8c=function(_0x58bd6b,_0x1101dd){_0x58bd6b=_0x58bd6b-0x0;var _0x4d40b2=_0xf8c6[_0x58bd6b];return _0x4d40b2;};'use strict';var _=require(_0x6f8c('0x0'));var moment=require(_0x6f8c('0x1'));var BPromise=require(_0x6f8c('0x2'));var md5=require('md5');var Redis=require(_0x6f8c('0x3'));var config=require(_0x6f8c('0x4'));var logger=require(_0x6f8c('0x5'))(_0x6f8c('0x6'));config[_0x6f8c('0x7')]=_['defaults'](config[_0x6f8c('0x7')],{'host':_0x6f8c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6f8c('0x7')]));var EmailImap=require(_0x6f8c('0x9'));var EmailSmtp=require(_0x6f8c('0xa'));var mailAccount=require(_0x6f8c('0xb'));var md5Accounts={};function EmailChannel(_0x4ca9b1){logger[_0x6f8c('0xc')](_0x6f8c('0xd'));this[_0x6f8c('0xe')]=_0x4ca9b1[_0x6f8c('0xe')];this[_0x6f8c('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x6f8c('0x10')][_0x6f8c('0x11')]=function(_0x5e2802){var _0x4de0fb=this[_0x6f8c('0xe')][_0x5e2802];var _0x2f2e12={'id':_0x4de0fb['id'],'name':_0x4de0fb[_0x6f8c('0x12')],'key':_0x4de0fb[_0x6f8c('0x13')],'active':_0x4de0fb[_0x6f8c('0x14')],'Imap':{'status':_0x4de0fb[_0x6f8c('0x15')]['status'],'messageStatus':_0x4de0fb[_0x6f8c('0x15')][_0x6f8c('0x16')],'total':_0x4de0fb[_0x6f8c('0x15')][_0x6f8c('0x17')]}};if(_['isNil'](md5Accounts[_0x5e2802])){md5Accounts[_0x5e2802]={};}var _0x432965=md5(JSON['stringify'](_0x2f2e12));if(md5Accounts[_0x5e2802]['md5']!==_0x432965){md5Accounts[_0x5e2802][_0x6f8c('0x18')]=_0x432965;io['emit']('mailAccount:update',_0x2f2e12);}};EmailChannel[_0x6f8c('0x10')]['refresh']=function(_0x319b6d){for(var _0x41b566 in _0x319b6d){if(_0x319b6d[_0x6f8c('0x19')](_0x41b566)){if(_0x319b6d[_0x41b566][_0x6f8c('0x15')]&&_0x319b6d[_0x41b566][_0x6f8c('0x14')]){var _0x3a7af8=_0x319b6d[_0x41b566][_0x6f8c('0x15')];if(!_0x3a7af8[_0x6f8c('0x1a')]&&_0x319b6d[_0x41b566]['provider']!=='custom')_0x3a7af8[_0x6f8c('0x1a')]=_0x319b6d[_0x41b566][_0x6f8c('0x1b')];if(!this['imapAccounts'][_0x6f8c('0x19')](_0x3a7af8['id'])){this['imapAccounts'][_0x3a7af8['id']]=new EmailImap(_0x3a7af8,_0x319b6d[_0x41b566][_0x6f8c('0x6')]);this[_0x6f8c('0xf')][_0x3a7af8['id']]['on'](_0x6f8c('0x1c'),this[_0x6f8c('0x1d')][_0x6f8c('0x1e')](this,_0x41b566));this[_0x6f8c('0xf')][_0x3a7af8['id']]['on']('email',this[_0x6f8c('0x1f')][_0x6f8c('0x1e')](this,_0x41b566));this['imapAccounts'][_0x3a7af8['id']]['on'](_0x6f8c('0x20'),this['handleImapEnd'][_0x6f8c('0x1e')](this,_0x41b566));this[_0x6f8c('0xf')][_0x3a7af8['id']]['on'](_0x6f8c('0x21'),this['handleImapError'][_0x6f8c('0x1e')](this,_0x41b566));}}else{if(_[_0x6f8c('0x22')](this['mailAccounts'][_0x41b566][_0x6f8c('0x15')])){this['mailAccounts'][_0x41b566][_0x6f8c('0x15')]={};}this[_0x6f8c('0xe')][_0x41b566][_0x6f8c('0x15')][_0x6f8c('0x23')]=_0x6f8c('0x24');this[_0x6f8c('0xe')][_0x41b566][_0x6f8c('0x15')][_0x6f8c('0x16')]='';this['emit'](_0x41b566);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x3d69a1,_0x5d5a81){if(this[_0x6f8c('0xe')][_0x3d69a1]){this[_0x6f8c('0xe')][_0x3d69a1][_0x6f8c('0x15')][_0x6f8c('0x23')]=_0x6f8c('0x25');this['mailAccounts'][_0x3d69a1]['Imap'][_0x6f8c('0x16')]=_0x5d5a81[_0x6f8c('0x12')];if(_0x5d5a81[_0x6f8c('0x26')]){this['mailAccounts'][_0x3d69a1][_0x6f8c('0x15')][_0x6f8c('0x17')]=_0x5d5a81[_0x6f8c('0x26')]['total'];}return this['emit'](_0x3d69a1);}};EmailChannel[_0x6f8c('0x10')][_0x6f8c('0x1f')]=function(_0x1361d8,_0x4c7920){logger['info'](_0x6f8c('0x27'),_0x4c7920[_0x6f8c('0x28')],_0x4c7920[_0x6f8c('0x29')],_0x4c7920[_0x6f8c('0x2a')],_0x1361d8);if(this[_0x6f8c('0xe')][_0x1361d8]){return mailAccount[_0x6f8c('0x2b')](_0x1361d8,_0x4c7920)[_0x6f8c('0x2c')](function(_0x3c3f61){if(_0x3c3f61){logger[_0x6f8c('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x6f8c('0x2d')](function(_0x358364){logger['error'](_0x6f8c('0x2e'),JSON['stringify'](_0x358364));});}};EmailChannel[_0x6f8c('0x10')][_0x6f8c('0x2f')]=function(_0x29bc44){if(this['mailAccounts'][_0x29bc44]&&this[_0x6f8c('0xe')][_0x29bc44][_0x6f8c('0x15')]){if(this[_0x6f8c('0xf')][this[_0x6f8c('0xe')][_0x29bc44][_0x6f8c('0x15')]['id']]){delete this[_0x6f8c('0xf')][this['mailAccounts'][_0x29bc44][_0x6f8c('0x15')]['id']];}this[_0x6f8c('0xe')][_0x29bc44]['Imap'][_0x6f8c('0x30')]=moment();this[_0x6f8c('0x11')](_0x29bc44);}};EmailChannel['prototype'][_0x6f8c('0x31')]=function(_0x477e93,_0x5baff6){if(this[_0x6f8c('0xe')][_0x477e93]){this[_0x6f8c('0xe')][_0x477e93]['Imap'][_0x6f8c('0x23')]='error';this[_0x6f8c('0xe')][_0x477e93][_0x6f8c('0x15')]['messageStatus']=_0x5baff6;return this['emit'](_0x477e93);}};EmailChannel[_0x6f8c('0x10')]['sendMail']=function(_0x4c33c3,_0x69ca5e){return this[_0x6f8c('0x32')][_0x6f8c('0x33')](_0x4c33c3,_0x69ca5e);};EmailChannel['prototype'][_0x6f8c('0x34')]=function(_0x43efd1){var _0x52ec35=this;if(this[_0x6f8c('0xe')][_0x43efd1['id']]){if(_['isNil'](this[_0x6f8c('0xe')][_0x43efd1['id']][_0x6f8c('0x35')])){this[_0x6f8c('0xe')][_0x43efd1['id']][_0x6f8c('0x35')]={};}this[_0x6f8c('0xe')][_0x43efd1['id']][_0x6f8c('0x35')][_0x6f8c('0x30')]=moment();return new BPromise(function(_0xf71dbc,_0x5c112a){return _0x52ec35['smtp'][_0x6f8c('0x36')](_0x43efd1)['then'](function(_0x19be5e){_0x52ec35[_0x6f8c('0xe')][_0x43efd1['id']][_0x6f8c('0x35')][_0x6f8c('0x23')]='verified';_0x52ec35[_0x6f8c('0xe')][_0x43efd1['id']][_0x6f8c('0x35')][_0x6f8c('0x16')]='';_0x52ec35[_0x6f8c('0x11')](_0x43efd1['id']);_0xf71dbc(_0x19be5e);})['catch'](function(_0x56acdd){_0x52ec35[_0x6f8c('0xe')][_0x43efd1['id']][_0x6f8c('0x35')][_0x6f8c('0x23')]='error';_0x52ec35['mailAccounts'][_0x43efd1['id']][_0x6f8c('0x35')][_0x6f8c('0x16')]=_0x56acdd;_0x52ec35['emit'](_0x43efd1['id']);_0x5c112a(_0x56acdd);});});}return this[_0x6f8c('0x32')][_0x6f8c('0x36')](_0x43efd1);};module[_0x6f8c('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 59a8b09..5a846c3 100644 --- a/server/services/email/lib/imap.js +++ b/server/services/email/lib/imap.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40ff=['readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','stringify','textCode','hasOwnProperty','exports','lodash','imap','mailparser','iconv','Iconv','events','EventEmitter','../../../config/logger','mailbox','account','once','ready','bind','end','handleEnd','handleError','connect','inherits','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','email','anonymous@xcally.com','host','port','tls','required','prototype','handleReady','openBox','handleOpenBox','emit','box'];(function(_0x43764b,_0x209f71){var _0x25f667=function(_0x53f89c){while(--_0x53f89c){_0x43764b['push'](_0x43764b['shift']());}};_0x25f667(++_0x209f71);}(_0x40ff,0x10e));var _0xf40f=function(_0xb9c0ae,_0x43d1ad){_0xb9c0ae=_0xb9c0ae-0x0;var _0x579954=_0x40ff[_0xb9c0ae];return _0x579954;};'use strict';var _=require(_0xf40f('0x0'));var util=require('util');var Imap=require(_0xf40f('0x1'));var simpleParser=require(_0xf40f('0x2'))['simpleParser'];var Iconv=require(_0xf40f('0x3'))[_0xf40f('0x4')];var EventEmitter=require(_0xf40f('0x5'))[_0xf40f('0x6')];var utils=require('./utils');var logger=require(_0xf40f('0x7'))('email');function EmailImap(_0x11d84d,_0x77e640){this[_0xf40f('0x8')]=_0x11d84d[_0xf40f('0x8')];this['account']=this['getAccount'](_0x11d84d,_0x77e640);this[_0xf40f('0x1')]=new Imap(this[_0xf40f('0x9')]);this['imap'][_0xf40f('0xa')](_0xf40f('0xb'),this['handleReady'][_0xf40f('0xc')](this));this[_0xf40f('0x1')]['once'](_0xf40f('0xd'),this[_0xf40f('0xe')][_0xf40f('0xc')](this));this[_0xf40f('0x1')]['on']('error',this[_0xf40f('0xf')][_0xf40f('0xc')](this));this[_0xf40f('0x1')][_0xf40f('0x10')]();}util[_0xf40f('0x11')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x2f8dd8,_0x142afc){var _0x3dfb86={'connTimeout':_0x2f8dd8['connTimeout']?_0x2f8dd8[_0xf40f('0x12')]*0x3e8:0x2710,'authTimeout':_0x2f8dd8[_0xf40f('0x13')]?_0x2f8dd8[_0xf40f('0x13')]*0x3e8:0x1388};if(_0x2f8dd8[_0xf40f('0x14')]){_0x3dfb86[_0xf40f('0x15')]=_0x2f8dd8[_0xf40f('0x15')];if(_0x2f8dd8[_0xf40f('0x16')]){_0x3dfb86[_0xf40f('0x17')]=utils[_0xf40f('0x18')](_0x2f8dd8[_0xf40f('0x19')]['data5'],_0x2f8dd8[_0xf40f('0x15')]);}else{_0x3dfb86['password']=_0x2f8dd8[_0xf40f('0x1a')];}}else{if(_0x2f8dd8[_0xf40f('0x1b')]){_0x3dfb86[_0xf40f('0x15')]=_0x2f8dd8['user'];_0x3dfb86['password']=_0x2f8dd8[_0xf40f('0x1a')];}}_0x3dfb86[_0xf40f('0x1c')]=_0x142afc||_0x2f8dd8['user']||_0xf40f('0x1d');_0x3dfb86['host']=_0x2f8dd8[_0xf40f('0x1e')];_0x3dfb86[_0xf40f('0x1f')]=_0x2f8dd8[_0xf40f('0x1f')]||0x3e1;if(_0x2f8dd8[_0xf40f('0x20')]){_0x3dfb86[_0xf40f('0x20')]=!![];}else{_0x3dfb86[_0xf40f('0x20')]=![];_0x3dfb86['autotls']=_0xf40f('0x21');}return _0x3dfb86;};EmailImap[_0xf40f('0x22')][_0xf40f('0x23')]=function(){this[_0xf40f('0x1')][_0xf40f('0x24')](this[_0xf40f('0x8')],![],this['handleOpenBox'][_0xf40f('0xc')](this));};EmailImap[_0xf40f('0x22')][_0xf40f('0x25')]=function(_0x4566c6,_0x5e83a5){if(_0x4566c6){this[_0xf40f('0xf')](_0x4566c6,!![]);}else{this[_0xf40f('0x26')](_0xf40f('0x27'),_0x5e83a5);this[_0xf40f('0x28')]();}};EmailImap[_0xf40f('0x22')][_0xf40f('0x29')]=function(_0x2e997f){if(_0x2e997f){this[_0xf40f('0xf')](_0x2e997f,!![]);}else{this[_0xf40f('0x1')][_0xf40f('0xd')]();}};EmailImap[_0xf40f('0x22')][_0xf40f('0x28')]=function(){this['imap'][_0xf40f('0x2a')]([_0xf40f('0x2b')],this['handleReadUnseen'][_0xf40f('0xc')](this));};EmailImap[_0xf40f('0x22')][_0xf40f('0x2c')]=function(_0x43fbec,_0x227659){if(_0x43fbec){this[_0xf40f('0xf')](_0x43fbec,!![]);}else{if(_0x227659['length']){try{var _0x4dd57c=this[_0xf40f('0x1')][_0xf40f('0x2d')](_0x227659,{'bodies':'','markSeen':!![]});_0x4dd57c['on'](_0xf40f('0x2e'),this[_0xf40f('0x2f')]['bind'](this));_0x4dd57c['once'](_0xf40f('0x30'),this[_0xf40f('0x31')][_0xf40f('0xc')](this));_0x4dd57c[_0xf40f('0xa')]('end',this[_0xf40f('0x32')][_0xf40f('0xc')](this));}catch(_0xc0a958){logger[_0xf40f('0x30')](_0xc0a958);}}else{this[_0xf40f('0x1')]['closeBox'](!![],this[_0xf40f('0x29')][_0xf40f('0xc')](this));}}};EmailImap[_0xf40f('0x22')]['handleFetchMessage']=function(_0x2888c4){_0x2888c4['on'](_0xf40f('0x33'),this[_0xf40f('0x34')][_0xf40f('0xc')](this));_0x2888c4[_0xf40f('0xa')](_0xf40f('0x35'),this[_0xf40f('0x36')][_0xf40f('0xc')](this));_0x2888c4[_0xf40f('0xa')](_0xf40f('0xd'),this[_0xf40f('0x37')][_0xf40f('0xc')](this));};EmailImap['prototype'][_0xf40f('0x34')]=function(_0x20be42){simpleParser(_0x20be42,{'Iconv':Iconv},this[_0xf40f('0x38')][_0xf40f('0xc')](this));};EmailImap[_0xf40f('0x22')][_0xf40f('0x36')]=function(){};EmailImap['prototype'][_0xf40f('0x37')]=function(){};EmailImap[_0xf40f('0x22')]['handleSimpleParser']=function(_0x2e1961,_0x288107){if(_0x2e1961){logger['error'](_0x2e1961);}else{var _0xdb2bdc=this;utils['parser'](this[_0xf40f('0x9')],_0x288107,function(_0x3dbbd4){_0xdb2bdc[_0xf40f('0x26')]('email',_0x3dbbd4);});}};EmailImap[_0xf40f('0x22')][_0xf40f('0x32')]=function(){this[_0xf40f('0x1')][_0xf40f('0x39')](!![],this[_0xf40f('0x29')][_0xf40f('0xc')](this));};EmailImap[_0xf40f('0x22')]['handleFetchError']=function(_0x4df041){this['handleError'](_0x4df041);this[_0xf40f('0x1')]['closeBox'](!![],this[_0xf40f('0x29')]['bind'](this));};EmailImap[_0xf40f('0x22')][_0xf40f('0xe')]=function(){this[_0xf40f('0x26')]('end');};EmailImap['prototype'][_0xf40f('0xf')]=function(_0x2081c4,_0x4e82f7){logger[_0xf40f('0x30')](_0xf40f('0xf'),this['account']['email'],JSON[_0xf40f('0x3a')](_0x2081c4));var _0x1ec130='';if(_0x2081c4){if(_0x2081c4[_0xf40f('0x3b')]){_0x1ec130=_0x2081c4[_0xf40f('0x3b')];}else{for(var _0x4397fc in _0x2081c4){if(_0x2081c4[_0xf40f('0x3c')](_0x4397fc)){_0x1ec130+=_['upperFirst'](_0x4397fc)+':\x20'+_0x2081c4[_0x4397fc]+'\x0a';}}}}if(_0x4e82f7){this[_0xf40f('0x1')][_0xf40f('0xd')]();}else{this[_0xf40f('0x26')](_0xf40f('0x30'),_0x1ec130);this[_0xf40f('0x26')](_0xf40f('0xd'));}};module[_0xf40f('0x3d')]=EmailImap; \ No newline at end of file +var _0x9292=['UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','handleEnd','stringify','hasOwnProperty','upperFirst','lodash','util','imap','mailparser','Iconv','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','connect','prototype','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','search'];(function(_0x182140,_0x4d3397){var _0x1a6415=function(_0xcbc8eb){while(--_0xcbc8eb){_0x182140['push'](_0x182140['shift']());}};_0x1a6415(++_0x4d3397);}(_0x9292,0xcb));var _0x2929=function(_0x21a63c,_0xdc29c9){_0x21a63c=_0x21a63c-0x0;var _0x2d127d=_0x9292[_0x21a63c];return _0x2d127d;};'use strict';var _=require(_0x2929('0x0'));var util=require(_0x2929('0x1'));var Imap=require(_0x2929('0x2'));var simpleParser=require(_0x2929('0x3'))['simpleParser'];var Iconv=require('iconv')[_0x2929('0x4')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x2929('0x5'));var logger=require(_0x2929('0x6'))(_0x2929('0x7'));function EmailImap(_0x5e83e7,_0x525a13){this[_0x2929('0x8')]=_0x5e83e7[_0x2929('0x8')];this['account']=this['getAccount'](_0x5e83e7,_0x525a13);this['imap']=new Imap(this[_0x2929('0x9')]);this['imap'][_0x2929('0xa')](_0x2929('0xb'),this[_0x2929('0xc')][_0x2929('0xd')](this));this[_0x2929('0x2')]['once'](_0x2929('0xe'),this['handleEnd'][_0x2929('0xd')](this));this['imap']['on']('error',this['handleError'][_0x2929('0xd')](this));this[_0x2929('0x2')][_0x2929('0xf')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x2929('0x10')][_0x2929('0x11')]=function(_0x1f0cf8,_0x133e51){var _0x11ebf0={'connTimeout':_0x1f0cf8[_0x2929('0x12')]?_0x1f0cf8['connTimeout']*0x3e8:0x2710,'authTimeout':_0x1f0cf8['authTimeout']?_0x1f0cf8[_0x2929('0x13')]*0x3e8:0x1388};if(_0x1f0cf8[_0x2929('0x14')]){_0x11ebf0[_0x2929('0x15')]=_0x1f0cf8[_0x2929('0x15')];if(_0x1f0cf8[_0x2929('0x16')]){_0x11ebf0[_0x2929('0x17')]=utils[_0x2929('0x18')](_0x1f0cf8[_0x2929('0x19')]['data5'],_0x1f0cf8[_0x2929('0x15')]);}else{_0x11ebf0[_0x2929('0x1a')]=_0x1f0cf8[_0x2929('0x1a')];}}else{if(_0x1f0cf8[_0x2929('0x1b')]){_0x11ebf0['user']=_0x1f0cf8[_0x2929('0x15')];_0x11ebf0[_0x2929('0x1a')]=_0x1f0cf8['password'];}}_0x11ebf0[_0x2929('0x7')]=_0x133e51||_0x1f0cf8[_0x2929('0x15')]||_0x2929('0x1c');_0x11ebf0[_0x2929('0x1d')]=_0x1f0cf8[_0x2929('0x1d')];_0x11ebf0[_0x2929('0x1e')]=_0x1f0cf8['port']||0x3e1;if(_0x1f0cf8['tls']){_0x11ebf0['tls']=!![];}else{_0x11ebf0[_0x2929('0x1f')]=![];_0x11ebf0[_0x2929('0x20')]=_0x2929('0x21');}return _0x11ebf0;};EmailImap[_0x2929('0x10')]['handleReady']=function(){this[_0x2929('0x2')][_0x2929('0x22')](this[_0x2929('0x8')],![],this[_0x2929('0x23')][_0x2929('0xd')](this));};EmailImap[_0x2929('0x10')][_0x2929('0x23')]=function(_0x2fb29d,_0x2368cd){if(_0x2fb29d){this[_0x2929('0x24')](_0x2fb29d,!![]);}else{this[_0x2929('0x25')]('box',_0x2368cd);this[_0x2929('0x26')]();}};EmailImap[_0x2929('0x10')][_0x2929('0x27')]=function(_0x4f711a){if(_0x4f711a){this[_0x2929('0x24')](_0x4f711a,!![]);}else{this[_0x2929('0x2')]['end']();}};EmailImap[_0x2929('0x10')]['readUnseen']=function(){this[_0x2929('0x2')][_0x2929('0x28')]([_0x2929('0x29')],this[_0x2929('0x2a')][_0x2929('0xd')](this));};EmailImap[_0x2929('0x10')]['handleReadUnseen']=function(_0x5468a1,_0x29101b){if(_0x5468a1){this[_0x2929('0x24')](_0x5468a1,!![]);}else{if(_0x29101b['length']){try{var _0x3ee6b3=this[_0x2929('0x2')][_0x2929('0x2b')](_0x29101b,{'bodies':'','markSeen':!![]});_0x3ee6b3['on'](_0x2929('0x2c'),this[_0x2929('0x2d')]['bind'](this));_0x3ee6b3[_0x2929('0xa')](_0x2929('0x2e'),this[_0x2929('0x2f')][_0x2929('0xd')](this));_0x3ee6b3[_0x2929('0xa')](_0x2929('0xe'),this[_0x2929('0x30')][_0x2929('0xd')](this));}catch(_0xa05adb){logger['error'](_0xa05adb);}}else{this['imap'][_0x2929('0x31')](!![],this[_0x2929('0x27')][_0x2929('0xd')](this));}}};EmailImap[_0x2929('0x10')]['handleFetchMessage']=function(_0x4a0fa1){_0x4a0fa1['on'](_0x2929('0x32'),this[_0x2929('0x33')][_0x2929('0xd')](this));_0x4a0fa1['once'](_0x2929('0x34'),this['handleMessageAttributes'][_0x2929('0xd')](this));_0x4a0fa1[_0x2929('0xa')](_0x2929('0xe'),this[_0x2929('0x35')][_0x2929('0xd')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x3455d4){simpleParser(_0x3455d4,{'Iconv':Iconv},this[_0x2929('0x36')][_0x2929('0xd')](this));};EmailImap['prototype'][_0x2929('0x37')]=function(){};EmailImap[_0x2929('0x10')][_0x2929('0x35')]=function(){};EmailImap['prototype'][_0x2929('0x36')]=function(_0x3ce41a,_0x8b830f){if(_0x3ce41a){logger[_0x2929('0x2e')](_0x3ce41a);}else{var _0x7945fc=this;utils[_0x2929('0x38')](this[_0x2929('0x9')],_0x8b830f,function(_0x2392c2){_0x7945fc[_0x2929('0x25')]('email',_0x2392c2);});}};EmailImap['prototype'][_0x2929('0x30')]=function(){this['imap'][_0x2929('0x31')](!![],this[_0x2929('0x27')][_0x2929('0xd')](this));};EmailImap['prototype']['handleFetchError']=function(_0x30b0ad){this[_0x2929('0x24')](_0x30b0ad);this[_0x2929('0x2')][_0x2929('0x31')](!![],this[_0x2929('0x27')][_0x2929('0xd')](this));};EmailImap[_0x2929('0x10')][_0x2929('0x39')]=function(){this[_0x2929('0x25')](_0x2929('0xe'));};EmailImap[_0x2929('0x10')][_0x2929('0x24')]=function(_0x5cac47,_0x3047b1){logger[_0x2929('0x2e')]('handleError',this['account']['email'],JSON[_0x2929('0x3a')](_0x5cac47));var _0x291af1='';if(_0x5cac47){if(_0x5cac47['textCode']){_0x291af1=_0x5cac47['textCode'];}else{for(var _0x22df46 in _0x5cac47){if(_0x5cac47[_0x2929('0x3b')](_0x22df46)){_0x291af1+=_[_0x2929('0x3c')](_0x22df46)+':\x20'+_0x5cac47[_0x22df46]+'\x0a';}}}}if(_0x3047b1){this[_0x2929('0x2')]['end']();}else{this['emit']('error',_0x291af1);this[_0x2929('0x25')](_0x2929('0xe'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 397e340..bc72d1d 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9635=['use','sendMail','toString','createTransport','verify','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x12c867,_0x1a7885){var _0x2031e1=function(_0x5a2474){while(--_0x5a2474){_0x12c867['push'](_0x12c867['shift']());}};_0x2031e1(++_0x1a7885);}(_0x9635,0x125));var _0x5963=function(_0x2a087b,_0x51dce7){_0x2a087b=_0x2a087b-0x0;var _0x2d4530=_0x9635[_0x2a087b];return _0x2d4530;};'use strict';var nodemailer=require(_0x5963('0x0'));var inlineBase64=require(_0x5963('0x1'));function EmailSmtp(){}EmailSmtp[_0x5963('0x2')]['send']=function(_0x2b6cd9,_0x2314f6){return new Promise(function(_0x534edc,_0x4c5af0){var _0x12db94=nodemailer['createTransport'](_0x2b6cd9);_0x12db94[_0x5963('0x3')]('compile',inlineBase64());_0x12db94[_0x5963('0x4')](_0x2314f6,function(_0x22bf9c,_0x3646a5){if(_0x22bf9c){_0x4c5af0(_0x22bf9c[_0x5963('0x5')]());}else{_0x534edc(_0x3646a5);}});});};EmailSmtp[_0x5963('0x2')]['verify']=function(_0x236020){return new Promise(function(_0x1497e0,_0x260e9b){var _0x277e0e=nodemailer[_0x5963('0x6')](_0x236020);_0x277e0e[_0x5963('0x7')](function(_0x5d7c01,_0x5964e0){if(_0x5d7c01){_0x260e9b(_0x5d7c01['toString']());}else{if(_0x5964e0){_0x1497e0(_0x5964e0);}else{_0x260e9b('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x298b=['send','createTransport','compile','sendMail','toString','prototype','verify','Not\x20verifired','exports'];(function(_0x533ffd,_0x547e7b){var _0x1069f5=function(_0x580224){while(--_0x580224){_0x533ffd['push'](_0x533ffd['shift']());}};_0x1069f5(++_0x547e7b);}(_0x298b,0x19e));var _0xb298=function(_0x5cb85e,_0x420d65){_0x5cb85e=_0x5cb85e-0x0;var _0x51675c=_0x298b[_0x5cb85e];return _0x51675c;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xb298('0x0')]=function(_0x136988,_0x416567){return new Promise(function(_0x2b8a6e,_0x289ad5){var _0x4e32bc=nodemailer[_0xb298('0x1')](_0x136988);_0x4e32bc['use'](_0xb298('0x2'),inlineBase64());_0x4e32bc[_0xb298('0x3')](_0x416567,function(_0x502390,_0xc0857){if(_0x502390){_0x289ad5(_0x502390[_0xb298('0x4')]());}else{_0x2b8a6e(_0xc0857);}});});};EmailSmtp[_0xb298('0x5')][_0xb298('0x6')]=function(_0x8a996a){return new Promise(function(_0x3ec441,_0x1e4716){var _0x2f2d88=nodemailer[_0xb298('0x1')](_0x8a996a);_0x2f2d88[_0xb298('0x6')](function(_0x48b864,_0x536d2e){if(_0x48b864){_0x1e4716(_0x48b864[_0xb298('0x4')]());}else{if(_0x536d2e){_0x3ec441(_0x536d2e);}else{_0x1e4716(_0xb298('0x7'));}}});});};module[_0xb298('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 4a802b6..baff3be 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb67e=['base64','lodash','moment','path','util','node-tnef','email','../../../config/environment','address','generate','@xcally.com','head','name','indexOf','length','join','Anonymous','value','split','isEmpty','anonymous','html','','textAsHtml','body','Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString'];(function(_0x573eae,_0x5f103f){var _0x2be09c=function(_0x70c4bd){while(--_0x70c4bd){_0x573eae['push'](_0x573eae['shift']());}};_0x2be09c(++_0x5f103f);}(_0xb67e,0x193));var _0xeb67=function(_0x3982eb,_0x5c7966){_0x3982eb=_0x3982eb-0x0;var _0x4274be=_0xb67e[_0x3982eb];return _0x4274be;};'use strict';var _=require(_0xeb67('0x0'));var moment=require(_0xeb67('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xeb67('0x2'));var util=require(_0xeb67('0x3'));var tnef=require(_0xeb67('0x4'));var logger=require('../../../config/logger')(_0xeb67('0x5'));var config=require(_0xeb67('0x6'));function getAddress(_0x218210){var _0x5c3657=_['head'](_0x218210['value']);return _0x5c3657&&_0x5c3657[_0xeb67('0x7')]?_0x5c3657[_0xeb67('0x7')]:'anonymous'+random[_0xeb67('0x8')](0x6)+_0xeb67('0x9');}function getFirstName(_0x457542){var _0xee0ff=_[_0xeb67('0xa')](_0x457542['value']);if(_0xee0ff&&_0xee0ff['name']){if(_0xee0ff[_0xeb67('0xb')]==_0xee0ff[_0xeb67('0x7')]){return _0xee0ff[_0xeb67('0xb')]['substring'](0x0,_0xee0ff['name'][_0xeb67('0xc')]('@'));}var _0x3c5a92=_0xee0ff[_0xeb67('0xb')]['split'](/\s+/);return _0x3c5a92[_0xeb67('0xd')]>0x1?_0x3c5a92['slice'](0x0,-0x1)[_0xeb67('0xe')]('\x20'):_0xee0ff[_0xeb67('0xb')];}return _0xeb67('0xf');}function getLastName(_0x5742ea){var _0x376d74=_[_0xeb67('0xa')](_0x5742ea[_0xeb67('0x10')]);if(_0x376d74&&_0x376d74[_0xeb67('0xb')]){var _0x12e2c0=_0x376d74['name'][_0xeb67('0x11')](/\s+/);return _0x12e2c0[_0xeb67('0xd')]>0x1?_0x12e2c0['pop']():'';}return'';}function getMails(_0xae33c9,_0x19becf){var _0xca4d7e='';for(var _0x300efd=0x0;_0x300efd<_0x19becf[_0xeb67('0x10')][_0xeb67('0xd')];_0x300efd+=0x1){if(_0x19becf[_0xeb67('0x10')][_0x300efd]['address']!==_0xae33c9){if(!_[_0xeb67('0x12')](_0xca4d7e)){_0xca4d7e+=',';}_0xca4d7e+=_0x19becf[_0xeb67('0x10')][_0x300efd]['name']||_0x19becf['value'][_0x300efd][_0xeb67('0x7')]||'';_0xca4d7e+='\x20<';_0xca4d7e+=_0x19becf[_0xeb67('0x10')][_0x300efd]['address']?_0x19becf[_0xeb67('0x10')][_0x300efd][_0xeb67('0x7')]:_0xeb67('0x13')+random[_0xeb67('0x8')](0x6)+_0xeb67('0x9');_0xca4d7e+='>';}}return _0xca4d7e;}function parseEmail(_0x1cc8d3,_0x6f01ed,_0x50712d){if(_0x6f01ed['html']){var _0x3a7279=/)<[^<]*)*<\/script>/gi;while(_0x3a7279['test'](_0x6f01ed['html'])){_0x6f01ed[_0xeb67('0x14')]=_0x6f01ed[_0xeb67('0x14')]['replace'](_0x3a7279,'');}if(_0x6f01ed[_0xeb67('0x14')]['includes'](_0xeb67('0x15'))){var _0x4185d1=[];_0x6f01ed[_0xeb67('0x16')]['forEach'](_0x4a5cdd=>{_0x4185d1[_0xeb67('0x17')](_0x4a5cdd[_0xeb67('0x18')]);});var _0x47ccbc=/]+>/g;var _0x148884=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x501f6b=_0x6f01ed[_0xeb67('0x14')][_0xeb67('0x19')](_0x148884,_0xeb67('0x1a'));var _0x3a58cd=_0x501f6b[_0xeb67('0x19')](_0x47ccbc,'_IMG');for(let _0x53e811=0x0;_0x53e811<_0x4185d1[_0xeb67('0xd')];_0x53e811++){var _0x2e9b06=_0x3a58cd['replace']('_IMG','\x20[Attachment:\x20'+_0x4185d1[_0x53e811]+_0xeb67('0x1b'));_0x3a58cd=_0x2e9b06;}_0x6f01ed[_0xeb67('0x14')]=_0x3a58cd;}_0x50712d['body']=_0x6f01ed[_0xeb67('0x14')];}else{_0x50712d['body']=_0x6f01ed[_0xeb67('0x1c')];}if(_0x50712d[_0xeb67('0x1d')]){_0x50712d[_0xeb67('0x1d')]=_0x50712d[_0xeb67('0x1d')][_0xeb67('0x19')](/0x0){var _0x73e5b7=[_0xeb67('0x2b'),_0xeb67('0x2c'),_0xeb67('0x2d')];for(var _0x22d949=0x0;_0x22d949<_0x6f01ed[_0xeb67('0x2a')]['length'];_0x22d949++){var _0x43ad10=_[_0xeb67('0xc')](_0x73e5b7,_0x6f01ed[_0xeb67('0x2a')][_0x22d949][_0xeb67('0x2e')]);if(_0x43ad10>=0x0){_0x50712d[_0xeb67('0x2f')]=!![];}}}return _0x50712d;}exports[_0xeb67('0x30')]=function(_0x3f6b0d,_0x65424e,_0x32b671){var _0x50b525={'from':getAddress(_0x65424e[_0xeb67('0x31')]),'firstName':getFirstName(_0x65424e[_0xeb67('0x31')]),'lastName':getLastName(_0x65424e[_0xeb67('0x31')]),'mapKey':_0xeb67('0x5'),'message':{'from':getMails(_0x3f6b0d[_0xeb67('0x5')],_0x65424e['from']),'to':_0x3f6b0d[_0xeb67('0x5')],'cc':'','subject':_0x65424e[_0xeb67('0x32')]||'','messageId':_0x65424e['messageId'],'inReplyTo':_0x65424e[_0xeb67('0x33')],'sentAt':moment(_0x65424e['date'])['format'](_0xeb67('0x34')),'attach':![],'attachments':[]}};if(!_0x65424e['html']&&!_0x65424e[_0xeb67('0x1c')]){var _0x13c8f4=_['filter'](_0x65424e[_0xeb67('0x16')],{'contentType':'application/ms-tnef'});if(_0x13c8f4[_0xeb67('0xd')]){logger[_0xeb67('0x35')](util[_0xeb67('0x25')](_0xeb67('0x36'),_0x65424e[_0xeb67('0x37')]));tnef['parseBuffer'](_['first'](_0x13c8f4)[_0xeb67('0x38')],function(_0x51cdb0,_0x372519){if(_0x372519){_0x65424e[_0xeb67('0x14')]=_0x372519[_0xeb67('0x39')]||_0xeb67('0x3a');if(_0x372519[_0xeb67('0x3b')]){for(var _0x20abcd=0x0;_0x20abcd<_0x372519[_0xeb67('0x3b')]['length'];_0x20abcd++){var _0x116764=_0x372519[_0xeb67('0x3b')][_0x20abcd];_0x50b525['message'][_0xeb67('0x16')][_0xeb67('0x17')]({'filename':_0x116764[_0xeb67('0x3c')],'content':Buffer[_0xeb67('0x31')](_0x116764['Data'])});}}}_0x32b671(parseEmail(_0x3f6b0d,_0x65424e,_0x50b525));});}else{_0x65424e['html']=_0xeb67('0x3a');_0x32b671(parseEmail(_0x3f6b0d,_0x65424e,_0x50b525));}}else{_0x32b671(parseEmail(_0x3f6b0d,_0x65424e,_0x50b525));}};exports[_0xeb67('0x3d')]=function(_0x94a2a0,_0x1cd825){var _0x677fec=[_0xeb67('0x3e')+(_0x1cd825||''),_0xeb67('0x3f')+_0x94a2a0,'',''];return Buffer[_0xeb67('0x31')](_0x677fec[_0xeb67('0xe')](''),_0xeb67('0x40'))[_0xeb67('0x41')](_0xeb67('0x42'));}; \ No newline at end of file +var _0xf7d5=['subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','utf-8','toString','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','anonymous','generate','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0xc2242[_0x5f7d('0x10')](0x0,-0x1)['join']('\x20'):_0x58cc74[_0x5f7d('0xb')];}return _0x5f7d('0x11');}function getLastName(_0x3d6ae4){var _0x1d8382=_[_0x5f7d('0x7')](_0x3d6ae4[_0x5f7d('0x8')]);if(_0x1d8382&&_0x1d8382[_0x5f7d('0xb')]){var _0x4ac966=_0x1d8382[_0x5f7d('0xb')]['split'](/\s+/);return _0x4ac966[_0x5f7d('0xf')]>0x1?_0x4ac966[_0x5f7d('0x12')]():'';}return'';}function getMails(_0x3a12ef,_0x11f672){var _0x2b7bf0='';for(var _0x3b15fa=0x0;_0x3b15fa<_0x11f672[_0x5f7d('0x8')][_0x5f7d('0xf')];_0x3b15fa+=0x1){if(_0x11f672[_0x5f7d('0x8')][_0x3b15fa][_0x5f7d('0x9')]!==_0x3a12ef){if(!_[_0x5f7d('0x13')](_0x2b7bf0)){_0x2b7bf0+=',';}_0x2b7bf0+=_0x11f672['value'][_0x3b15fa]['name']||_0x11f672['value'][_0x3b15fa][_0x5f7d('0x9')]||'';_0x2b7bf0+='\x20<';_0x2b7bf0+=_0x11f672[_0x5f7d('0x8')][_0x3b15fa][_0x5f7d('0x9')]?_0x11f672['value'][_0x3b15fa][_0x5f7d('0x9')]:_0x5f7d('0x14')+random[_0x5f7d('0x15')](0x6)+_0x5f7d('0xa');_0x2b7bf0+='>';}}return _0x2b7bf0;}function parseEmail(_0x5302a9,_0x59d19c,_0x59f48d){if(_0x59d19c[_0x5f7d('0x16')]){var _0x66f15a=/)<[^<]*)*<\/script>/gi;while(_0x66f15a['test'](_0x59d19c[_0x5f7d('0x16')])){_0x59d19c[_0x5f7d('0x16')]=_0x59d19c[_0x5f7d('0x16')]['replace'](_0x66f15a,'');}if(_0x59d19c[_0x5f7d('0x16')][_0x5f7d('0x17')](_0x5f7d('0x18'))){var _0x3508f8=[];_0x59d19c[_0x5f7d('0x19')][_0x5f7d('0x1a')](_0xe6c9a9=>{_0x3508f8[_0x5f7d('0x1b')](_0xe6c9a9[_0x5f7d('0x1c')]);});var _0x59f970=/]+>/g;var _0xc24e75=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x53863f=_0x59d19c[_0x5f7d('0x16')][_0x5f7d('0x1d')](_0xc24e75,_0x5f7d('0x1e'));var _0x4af575=_0x53863f[_0x5f7d('0x1d')](_0x59f970,_0x5f7d('0x1f'));for(let _0x30f7c6=0x0;_0x30f7c6<_0x3508f8['length'];_0x30f7c6++){var _0x2a8880=_0x4af575['replace']('_IMG',_0x5f7d('0x20')+_0x3508f8[_0x30f7c6]+_0x5f7d('0x21'));_0x4af575=_0x2a8880;}_0x59d19c[_0x5f7d('0x16')]=_0x4af575;}_0x59f48d[_0x5f7d('0x22')]=_0x59d19c[_0x5f7d('0x16')];}else{_0x59f48d['body']=_0x59d19c[_0x5f7d('0x23')];}if(_0x59f48d['body']){_0x59f48d[_0x5f7d('0x22')]=_0x59f48d[_0x5f7d('0x22')][_0x5f7d('0x1d')](/0x0){var _0x2f668d=[_0x5f7d('0x36'),_0x5f7d('0x37'),'Precedence:\x20auto_reply'];for(var _0x2baead=0x0;_0x2baead<_0x59d19c['headerLines'][_0x5f7d('0xf')];_0x2baead++){var _0x2f36da=_[_0x5f7d('0xd')](_0x2f668d,_0x59d19c[_0x5f7d('0x35')][_0x2baead][_0x5f7d('0x38')]);if(_0x2f36da>=0x0){_0x59f48d[_0x5f7d('0x39')]=!![];}}}return _0x59f48d;}exports[_0x5f7d('0x3a')]=function(_0x3a1c23,_0x7f66b9,_0x353c51){var _0x51f4ed={'from':getAddress(_0x7f66b9[_0x5f7d('0x3b')]),'firstName':getFirstName(_0x7f66b9['from']),'lastName':getLastName(_0x7f66b9[_0x5f7d('0x3b')]),'mapKey':'email','message':{'from':getMails(_0x3a1c23['email'],_0x7f66b9['from']),'to':_0x3a1c23['email'],'cc':'','subject':_0x7f66b9[_0x5f7d('0x3c')]||'','messageId':_0x7f66b9[_0x5f7d('0x3d')],'inReplyTo':_0x7f66b9[_0x5f7d('0x3e')],'sentAt':moment(_0x7f66b9[_0x5f7d('0x3f')])[_0x5f7d('0x2d')](_0x5f7d('0x40')),'attach':![],'attachments':[]}};if(!_0x7f66b9[_0x5f7d('0x16')]&&!_0x7f66b9[_0x5f7d('0x23')]){var _0x226685=_[_0x5f7d('0x41')](_0x7f66b9['attachments'],{'contentType':_0x5f7d('0x42')});if(_0x226685['length']){logger[_0x5f7d('0x43')](util[_0x5f7d('0x2d')](_0x5f7d('0x44'),_0x7f66b9['messageId']));tnef[_0x5f7d('0x45')](_[_0x5f7d('0x46')](_0x226685)[_0x5f7d('0x33')],function(_0x26d7b6,_0x205e08){if(_0x205e08){_0x7f66b9[_0x5f7d('0x16')]=_0x205e08['BodyHTML']||_0x5f7d('0x47');if(_0x205e08[_0x5f7d('0x48')]){for(var _0x4fb4c6=0x0;_0x4fb4c6<_0x205e08[_0x5f7d('0x48')][_0x5f7d('0xf')];_0x4fb4c6++){var _0x3b6546=_0x205e08[_0x5f7d('0x48')][_0x4fb4c6];_0x51f4ed['message']['attachments']['push']({'filename':_0x3b6546[_0x5f7d('0x49')],'content':Buffer[_0x5f7d('0x3b')](_0x3b6546['Data'])});}}}_0x353c51(parseEmail(_0x3a1c23,_0x7f66b9,_0x51f4ed));});}else{_0x7f66b9[_0x5f7d('0x16')]=_0x5f7d('0x47');_0x353c51(parseEmail(_0x3a1c23,_0x7f66b9,_0x51f4ed));}}else{_0x353c51(parseEmail(_0x3a1c23,_0x7f66b9,_0x51f4ed));}};exports[_0x5f7d('0x4a')]=function(_0x297646,_0x224f2a){var _0x5b8790=[_0x5f7d('0x4b')+(_0x224f2a||''),'auth=Bearer\x20'+_0x297646,'',''];return Buffer[_0x5f7d('0x3b')](_0x5b8790[_0x5f7d('0x2f')](''),_0x5f7d('0x4c'))[_0x5f7d('0x4d')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b95cca8..404cf55 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32cb=['name','Service','key','active','Imap','Smtp','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x32cb,0x196));var _0xb32c=function(_0x4fb7cc,_0x193b1e){_0x4fb7cc=_0x4fb7cc-0x0;var _0x116eae=_0x32cb[_0x4fb7cc];return _0x116eae;};'use strict';var _=require('lodash');function MailAccount(_0x2cf4d1){this['id']=_0x2cf4d1['id']||0x0;this['name']=_0x2cf4d1[_0xb32c('0x0')]||_0xb32c('0x1');this[_0xb32c('0x2')]=_0x2cf4d1[_0xb32c('0x2')]||'SERV';this[_0xb32c('0x3')]=_0x2cf4d1[_0xb32c('0x3')]||![];this[_0xb32c('0x4')]=_0x2cf4d1[_0xb32c('0x4')]||[];this[_0xb32c('0x5')]=_0x2cf4d1['Smtp']||[];}module[_0xb32c('0x6')]=MailAccount; \ No newline at end of file +var _0x8b82=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x27272b,_0x414607){var _0x4ba275=function(_0x117934){while(--_0x117934){_0x27272b['push'](_0x27272b['shift']());}};_0x4ba275(++_0x414607);}(_0x8b82,0x11d));var _0x28b8=function(_0x5fda40,_0x293ba2){_0x5fda40=_0x5fda40-0x0;var _0x537772=_0x8b82[_0x5fda40];return _0x537772;};'use strict';var _=require(_0x28b8('0x0'));function MailAccount(_0x5c83f8){this['id']=_0x5c83f8['id']||0x0;this['name']=_0x5c83f8[_0x28b8('0x1')]||_0x28b8('0x2');this[_0x28b8('0x3')]=_0x5c83f8['key']||_0x28b8('0x4');this[_0x28b8('0x5')]=_0x5c83f8['active']||![];this[_0x28b8('0x6')]=_0x5c83f8[_0x28b8('0x6')]||[];this[_0x28b8('0x7')]=_0x5c83f8[_0x28b8('0x7')]||[];}module[_0x28b8('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7e6f82d..e33d4c1 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa14d=['prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x51af40,_0x50293f){var _0xe2cd16=function(_0x212cab){while(--_0x212cab){_0x51af40['push'](_0x51af40['shift']());}};_0xe2cd16(++_0x50293f);}(_0xa14d,0x193));var _0xda14=function(_0x34b0ff,_0xcde780){_0x34b0ff=_0x34b0ff-0x0;var _0xe2c8da=_0xa14d[_0x34b0ff];return _0xe2c8da;};'use strict';var _=require(_0xda14('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xda14('0x1')]={};};function freeIsNotKey(_0x381a81,_0x5c288f,_0x4e2484){var _0x2248aa=_[_0xda14('0x2')](_0x381a81,function(_0x1e51c1,_0x4f4fdf){return _0x1e51c1[_0x4e2484];});for(var _0x33adaa in _0x5c288f){if(_0x5c288f[_0xda14('0x3')](_0x33adaa)){if(!_0x2248aa[_0x33adaa]){delete _0x5c288f[_0x33adaa];}}}}Realtime[_0xda14('0x4')][_0xda14('0x5')]=function(_0x56aafb,_0x1ff8ec){for(var _0x3e9d55 in _0x1ff8ec){if(_0x56aafb[_0xda14('0x3')](_0x3e9d55)){_0x56aafb[_0x3e9d55]=_0x1ff8ec[_0x3e9d55];}}};Realtime[_0xda14('0x4')][_0xda14('0x6')]=function(){var _0x2829c1=this;return function(_0x53f2ac){if(_0x53f2ac){freeIsNotKey(_0x53f2ac,_0x2829c1[_0xda14('0x1')],'id');for(var _0x363d86=0x0,_0x2b7ef4={},_0x22e87f={};_0x363d86<_0x53f2ac[_0xda14('0x7')];_0x363d86+=0x1){_0x2b7ef4=_0x53f2ac[_0x363d86];if(_[_0xda14('0x8')](_0x2829c1[_0xda14('0x1')][_0x2b7ef4['id']])){_0x2829c1[_0xda14('0x1')][_0x2b7ef4['id']]=new MailAccount(_0x2b7ef4);}else{_[_0xda14('0x9')](_0x2829c1['mailAccounts'][_0x2b7ef4['id']],_0x2b7ef4);}}}return _0x2829c1[_0xda14('0x1')];};};module[_0xda14('0xa')]=Realtime; \ No newline at end of file +var _0x22f9=['mapKeys','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','mailAccounts'];(function(_0x57647b,_0x264c9a){var _0x5b4432=function(_0x56e372){while(--_0x56e372){_0x57647b['push'](_0x57647b['shift']());}};_0x5b4432(++_0x264c9a);}(_0x22f9,0x170));var _0x922f=function(_0x3243bc,_0x498e99){_0x3243bc=_0x3243bc-0x0;var _0x27f192=_0x22f9[_0x3243bc];return _0x27f192;};'use strict';var _=require(_0x922f('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x922f('0x1')]={};};function freeIsNotKey(_0x5285b2,_0x1ba9a5,_0x4dfe16){var _0x34c877=_[_0x922f('0x2')](_0x5285b2,function(_0x514ec5,_0x45aa4e){return _0x514ec5[_0x4dfe16];});for(var _0x44f191 in _0x1ba9a5){if(_0x1ba9a5['hasOwnProperty'](_0x44f191)){if(!_0x34c877[_0x44f191]){delete _0x1ba9a5[_0x44f191];}}}}Realtime[_0x922f('0x3')][_0x922f('0x4')]=function(_0x51f14a,_0x49bc09){for(var _0x543e95 in _0x49bc09){if(_0x51f14a['hasOwnProperty'](_0x543e95)){_0x51f14a[_0x543e95]=_0x49bc09[_0x543e95];}}};Realtime['prototype'][_0x922f('0x5')]=function(){var _0x2901db=this;return function(_0xb5142){if(_0xb5142){freeIsNotKey(_0xb5142,_0x2901db[_0x922f('0x1')],'id');for(var _0x12752a=0x0,_0x15c476={},_0x4f08c7={};_0x12752a<_0xb5142[_0x922f('0x6')];_0x12752a+=0x1){_0x15c476=_0xb5142[_0x12752a];if(_[_0x922f('0x7')](_0x2901db[_0x922f('0x1')][_0x15c476['id']])){_0x2901db[_0x922f('0x1')][_0x15c476['id']]=new MailAccount(_0x15c476);}else{_[_0x922f('0x8')](_0x2901db[_0x922f('0x1')][_0x15c476['id']],_0x15c476);}}}return _0x2901db[_0x922f('0x1')];};};module[_0x922f('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 363d3f6..37a7f2a 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5e5=['email','key','ListId','TemplateId','Imap','CloudProvider','type','data5','MailServerOut','Smtp','notify','NotifyMailAccount','Request','name','provider','service'];(function(_0x2b1057,_0x50d2a3){var _0x1a2267=function(_0x4d22ba){while(--_0x4d22ba){_0x2b1057['push'](_0x2b1057['shift']());}};_0x1a2267(++_0x50d2a3);}(_0xc5e5,0xdc));var _0x5c5e=function(_0x29a6c0,_0x1102cd){_0x29a6c0=_0x29a6c0-0x0;var _0x13cb24=_0xc5e5[_0x29a6c0];return _0x13cb24;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x5c5e('0x0')]('GetMailAccount',{'options':{'attributes':['id',_0x5c5e('0x1'),_0x5c5e('0x2'),_0x5c5e('0x3'),_0x5c5e('0x4'),'active',_0x5c5e('0x5'),_0x5c5e('0x6'),_0x5c5e('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':_0x5c5e('0x8'),'include':[{'model':_0x5c5e('0x9'),'attributes':['id','name',_0x5c5e('0x3'),_0x5c5e('0xa'),_0x5c5e('0xb')],'as':_0x5c5e('0x9')}]},{'model':_0x5c5e('0xc'),'as':_0x5c5e('0xd'),'include':[{'model':_0x5c5e('0x9'),'attributes':['id','name',_0x5c5e('0x3'),_0x5c5e('0xa'),'data5'],'as':_0x5c5e('0x9')}]}]},'log':'getMailAccount'});};};exports[_0x5c5e('0xe')]=function(_0x226bc6,_0x2dd535){return client[_0x5c5e('0x0')](_0x5c5e('0xf'),{'account':{'id':_0x226bc6},'body':_0x2dd535,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x2d2c=['TemplateId','MailServerIn','Imap','service','type','data5','CloudProvider','MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','email','key','ListId'];(function(_0x2b6a59,_0x4fc1d3){var _0x270160=function(_0x518ca3){while(--_0x518ca3){_0x2b6a59['push'](_0x2b6a59['shift']());}};_0x270160(++_0x4fc1d3);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x5bda3b,_0x41160f){_0x5bda3b=_0x5bda3b-0x0;var _0x431bb9=_0x2d2c[_0x5bda3b];return _0x431bb9;};'use strict';var client=require(_0xc2d2('0x0'));exports[_0xc2d2('0x1')]=function(){return function(){return client[_0xc2d2('0x2')](_0xc2d2('0x3'),{'options':{'attributes':['id',_0xc2d2('0x4'),_0xc2d2('0x5'),'service',_0xc2d2('0x6'),'active',_0xc2d2('0x7'),_0xc2d2('0x8'),_0xc2d2('0x9')],'raw':![],'include':[{'model':_0xc2d2('0xa'),'as':_0xc2d2('0xb'),'include':[{'model':'CloudProvider','attributes':['id','name',_0xc2d2('0xc'),_0xc2d2('0xd'),_0xc2d2('0xe')],'as':_0xc2d2('0xf')}]},{'model':_0xc2d2('0x10'),'as':_0xc2d2('0x11'),'include':[{'model':_0xc2d2('0xf'),'attributes':['id',_0xc2d2('0x4'),_0xc2d2('0xc'),_0xc2d2('0xd'),_0xc2d2('0xe')],'as':_0xc2d2('0xf')}]}]},'log':'getMailAccount'});};};exports[_0xc2d2('0x12')]=function(_0x13a247,_0x1e0cbc){return client['Request'](_0xc2d2('0x13'),{'account':{'id':_0x13a247},'body':_0x1e0cbc,'log':_0xc2d2('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 03e1ef0..34c8c10 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x351e=['GetSettings','Request'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x351e,0xaf));var _0xe351=function(_0x4f49d1,_0x1dbca2){_0x4f49d1=_0x4f49d1-0x0;var _0xc9616d=_0x351e[_0x4f49d1];return _0xc9616d;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xe351('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe351('0x1')});}; \ No newline at end of file +var _0x49af=['ShowSetting','loginMailFrequency','../client','getSettings','Request'];(function(_0x1b24c8,_0x4f1cbc){var _0x2077bf=function(_0x1d092a){while(--_0x1d092a){_0x1b24c8['push'](_0x1b24c8['shift']());}};_0x2077bf(++_0x4f1cbc);}(_0x49af,0x115));var _0xf49a=function(_0x179bbc,_0x20cf33){_0x179bbc=_0x179bbc-0x0;var _0x196b1f=_0x49af[_0x179bbc];return _0x196b1f;};'use strict';var client=require(_0xf49a('0x0'));exports[_0xf49a('0x1')]=function(){return client[_0xf49a('0x2')](_0xf49a('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf49a('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f2a19ed..426a609 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 3cb5060..953a24e 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49e0=['redis','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','ioredis','listen','port','socket.io','websocket'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49e0,0x138));var _0x049e=function(_0x2a4c4,_0x24a863){_0x2a4c4=_0x2a4c4-0x0;var _0x54b233=_0x49e0[_0x2a4c4];return _0x54b233;};'use strict';var _=require(_0x049e('0x0'));var http=require('http');var express=require(_0x049e('0x1'));var sticky=require(_0x049e('0x2'));var Redis=require(_0x049e('0x3'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x049e('0x4')](server,config[_0x049e('0x5')])){var socketio=require(_0x049e('0x6'))(server,{'transports':[_0x049e('0x7'),'polling']});config[_0x049e('0x8')]=_['defaults'](config[_0x049e('0x8')],{'host':_0x049e('0x9'),'port':0x18eb});socketio[_0x049e('0xa')](require(_0x049e('0xb'))({'pubClient':new Redis(config[_0x049e('0x8')]),'subClient':new Redis(config[_0x049e('0x8')])}));require('../../config/triggers')[_0x049e('0xc')]();require(_0x049e('0xd'))[_0x049e('0xc')](socketio);require(_0x049e('0xe'))[_0x049e('0xc')](app);require(_0x049e('0xf'))[_0x049e('0xc')](app);}else{server[_0x049e('0x10')](_0x049e('0x11'),function(){console[_0x049e('0x12')](_0x049e('0x13'),config[_0x049e('0x5')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x0786=['../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','createServer','listen','port','socket.io','websocket','polling','defaults','redis','localhost','socket.io-redis'];(function(_0x401927,_0x40e43a){var _0x50f232=function(_0x1ec8cf){while(--_0x1ec8cf){_0x401927['push'](_0x401927['shift']());}};_0x50f232(++_0x40e43a);}(_0x0786,0xe1));var _0x6078=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x0786[_0x58ee19];return _0x49af25;};'use strict';var _=require(_0x6078('0x0'));var http=require(_0x6078('0x1'));var express=require(_0x6078('0x2'));var sticky=require(_0x6078('0x3'));var Redis=require(_0x6078('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x6078('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x6078('0x6')](server,config[_0x6078('0x7')])){var socketio=require(_0x6078('0x8'))(server,{'transports':[_0x6078('0x9'),_0x6078('0xa')]});config['redis']=_[_0x6078('0xb')](config[_0x6078('0xc')],{'host':_0x6078('0xd'),'port':0x18eb});socketio['adapter'](require(_0x6078('0xe'))({'pubClient':new Redis(config[_0x6078('0xc')]),'subClient':new Redis(config[_0x6078('0xc')])}));require(_0x6078('0xf'))[_0x6078('0x10')]();require(_0x6078('0x11'))[_0x6078('0x10')](socketio);require(_0x6078('0x12'))['default'](app);require(_0x6078('0x13'))['default'](app);}else{server[_0x6078('0x14')]('listening',function(){console[_0x6078('0x15')](_0x6078('0x16'),config[_0x6078('0x7')]);});}exports=module[_0x6078('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 1e0cf6a..b1349e4 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb62d=['client','Request','request','then','debug','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62d,0xe6));var _0xdb62=function(_0x26e5a7,_0x5b918f){_0x26e5a7=_0x26e5a7-0x0;var _0x3a2818=_0xb62d[_0x26e5a7];return _0x3a2818;};'use strict';var jayson=require(_0xdb62('0x0'));var BPromise=require(_0xdb62('0x1'));var logger=require(_0xdb62('0x2'))(_0xdb62('0x3'));var client=jayson[_0xdb62('0x4')]['http']({'port':0x2329});client[_0xdb62('0x5')]=function(_0x26c363,_0x62c50){return new BPromise(function(_0x9865d1,_0x2c0e02){return client[_0xdb62('0x6')](_0x26c363,_0x62c50)[_0xdb62('0x7')](function(_0x780053){logger[_0xdb62('0x8')]('rpc','routing',_0x26c363,_0x62c50,_0x780053);if(_0x780053[_0xdb62('0x9')]){logger['error']('rpc',_0xdb62('0x3'),_0x26c363,_0x780053[_0xdb62('0x9')][_0xdb62('0xa')],_0x62c50);return _0x2c0e02(_0x780053[_0xdb62('0x9')][_0xdb62('0xa')]);}else{return _0x9865d1(_0x780053['result']);}})[_0xdb62('0xb')](function(_0x18d00f){logger[_0xdb62('0x9')]('rpc',_0xdb62('0x3'),_0x26c363,_0x18d00f,_0x62c50);return _0x2c0e02(_0x18d00f);});});};module[_0xdb62('0xc')]=client; \ No newline at end of file +var _0x436f=['bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','jayson/promise'];(function(_0x324d77,_0x307ef7){var _0x2a77a7=function(_0x54120e){while(--_0x54120e){_0x324d77['push'](_0x324d77['shift']());}};_0x2a77a7(++_0x307ef7);}(_0x436f,0x10d));var _0xf436=function(_0x53c7d6,_0x2ab0c3){_0x53c7d6=_0x53c7d6-0x0;var _0x25cfc4=_0x436f[_0x53c7d6];return _0x25cfc4;};'use strict';var jayson=require(_0xf436('0x0'));var BPromise=require(_0xf436('0x1'));var logger=require(_0xf436('0x2'))(_0xf436('0x3'));var client=jayson[_0xf436('0x4')][_0xf436('0x5')]({'port':0x2329});client[_0xf436('0x6')]=function(_0x479297,_0x557693){return new BPromise(function(_0x28f172,_0x53d967){return client[_0xf436('0x7')](_0x479297,_0x557693)[_0xf436('0x8')](function(_0xa716e3){logger[_0xf436('0x9')](_0xf436('0xa'),'routing',_0x479297,_0x557693,_0xa716e3);if(_0xa716e3[_0xf436('0xb')]){logger['error'](_0xf436('0xa'),_0xf436('0x3'),_0x479297,_0xa716e3[_0xf436('0xb')][_0xf436('0xc')],_0x557693);return _0x53d967(_0xa716e3[_0xf436('0xb')][_0xf436('0xc')]);}else{return _0x28f172(_0xa716e3[_0xf436('0xd')]);}})[_0xf436('0xe')](function(_0x12ac53){logger[_0xf436('0xb')](_0xf436('0xa'),_0xf436('0x3'),_0x479297,_0x12ac53,_0x557693);return _0x53d967(_0x12ac53);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 50d81be..d852f13 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c2a=['initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','getChatQueues'];(function(_0x43b6f6,_0x3ceab7){var _0x5512f=function(_0x17addb){while(--_0x17addb){_0x43b6f6['push'](_0x43b6f6['shift']());}};_0x5512f(++_0x3ceab7);}(_0x8c2a,0xae));var _0xa8c2=function(_0x409ad2,_0x5129c1){_0x409ad2=_0x409ad2-0x0;var _0x595b5f=_0x8c2a[_0x409ad2];return _0x595b5f;};'use strict';var BPromise=require(_0xa8c2('0x0'));var server=require(_0xa8c2('0x1'));var Realtime=require(_0xa8c2('0x2'));var user=require('./rpc/user');var interval=require(_0xa8c2('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xa8c2('0x4'));var mailQueue=require(_0xa8c2('0x5'));var faxQueue=require(_0xa8c2('0x6'));var whatsappQueue=require(_0xa8c2('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xa8c2('0x8')]()[_0xa8c2('0x9')](user[_0xa8c2('0xa')]())[_0xa8c2('0x9')](realtime[_0xa8c2('0xb')]())[_0xa8c2('0x9')](interval['getIntervals']())[_0xa8c2('0x9')](realtime[_0xa8c2('0xc')]())['then'](openchannelQueue[_0xa8c2('0xd')]())[_0xa8c2('0x9')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0xa8c2('0xe')]())[_0xa8c2('0x9')](realtime[_0xa8c2('0xf')]())[_0xa8c2('0x9')](smsQueue[_0xa8c2('0x10')]())[_0xa8c2('0x9')](realtime[_0xa8c2('0x11')]())['then'](mailQueue[_0xa8c2('0x12')]())[_0xa8c2('0x9')](realtime[_0xa8c2('0x13')]())[_0xa8c2('0x9')](faxQueue[_0xa8c2('0x14')]())[_0xa8c2('0x9')](realtime[_0xa8c2('0x15')]())[_0xa8c2('0x9')](whatsappQueue[_0xa8c2('0x16')]())[_0xa8c2('0x9')](realtime[_0xa8c2('0x17')]())[_0xa8c2('0x9')](function(){return realtime;});}function main(){return server[_0xa8c2('0x18')](realtime)[_0xa8c2('0x9')](function(_0x3e823a){return initRealtime();})[_0xa8c2('0x9')](function(_0xd2d5c8){return setInterval(initRealtime,0x1388);})[_0xa8c2('0x19')](function(_0x36cfcf){console[_0xa8c2('0x1a')](_0x36cfcf);});}main(); \ No newline at end of file +var _0x386f=['getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues'];(function(_0x31dfe4,_0x36d3fa){var _0x172f5d=function(_0x269e1e){while(--_0x269e1e){_0x31dfe4['push'](_0x31dfe4['shift']());}};_0x172f5d(++_0x36d3fa);}(_0x386f,0x91));var _0xf386=function(_0x487af1,_0x2c1e6b){_0x487af1=_0x487af1-0x0;var _0x518fcb=_0x386f[_0x487af1];return _0x518fcb;};'use strict';var BPromise=require(_0xf386('0x0'));var server=require(_0xf386('0x1'));var Realtime=require(_0xf386('0x2'));var user=require(_0xf386('0x3'));var interval=require(_0xf386('0x4'));var openchannelQueue=require(_0xf386('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xf386('0x6'));var mailQueue=require(_0xf386('0x7'));var faxQueue=require(_0xf386('0x8'));var whatsappQueue=require(_0xf386('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xf386('0xa')]()[_0xf386('0xb')](user[_0xf386('0xc')]())[_0xf386('0xb')](realtime[_0xf386('0xd')]())['then'](interval[_0xf386('0xe')]())[_0xf386('0xb')](realtime[_0xf386('0xf')]())[_0xf386('0xb')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xf386('0x10')]())['then'](chatQueue[_0xf386('0x11')]())[_0xf386('0xb')](realtime[_0xf386('0x12')]())[_0xf386('0xb')](smsQueue[_0xf386('0x13')]())[_0xf386('0xb')](realtime['initSmsQueues']())[_0xf386('0xb')](mailQueue[_0xf386('0x14')]())[_0xf386('0xb')](realtime[_0xf386('0x15')]())['then'](faxQueue['getFaxQueues']())[_0xf386('0xb')](realtime[_0xf386('0x16')]())[_0xf386('0xb')](whatsappQueue[_0xf386('0x17')]())[_0xf386('0xb')](realtime[_0xf386('0x18')]())[_0xf386('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xf386('0xb')](function(_0x304426){return initRealtime();})['then'](function(_0x2f75b6){return setInterval(initRealtime,0x1388);})[_0xf386('0x19')](function(_0x1efc95){console[_0xf386('0x1a')](_0x1efc95);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 1c41167..2c729bf 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x2e5a33,_0x2e768c){var _0x1f5221=function(_0x29f9df){while(--_0x29f9df){_0x2e5a33['push'](_0x2e5a33['shift']());}};_0x1f5221(++_0x2e768c);}(_0x326f,0xd1));var _0xf326=function(_0x109d47,_0x266163){_0x109d47=_0x109d47-0x0;var _0x33f51d=_0x326f[_0x109d47];return _0x33f51d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x21b236,_0x2b981d){var _0x462edf=function(_0x1a7927){while(--_0x1a7927){_0x21b236['push'](_0x21b236['shift']());}};_0x462edf(++_0x2b981d);}(_0x814b,0x1a2));var _0xb814=function(_0x1b640f,_0x215390){_0x1b640f=_0x1b640f-0x0;var _0x560770=_0x814b[_0x1b640f];return _0x560770;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b64db09..9b6dbfe 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cd4=['bluebird','jayson/promise','http','then','catch','sendMailMessage','SendMail'];(function(_0x48442d,_0x225572){var _0x478c4=function(_0x25f7ba){while(--_0x25f7ba){_0x48442d['push'](_0x48442d['shift']());}};_0x478c4(++_0x225572);}(_0x1cd4,0x11f));var _0x41cd=function(_0x438156,_0x2534bc){_0x438156=_0x438156-0x0;var _0x1437bf=_0x1cd4[_0x438156];return _0x1437bf;};'use strict';var BPromise=require(_0x41cd('0x0'));var jayson=require(_0x41cd('0x1'));var client=jayson['client'][_0x41cd('0x2')]({'port':0x232b});function request(_0x16922a,_0x1a8a0d){return new BPromise(function(_0x5f5a85,_0x31b828){return client['request'](_0x16922a,_0x1a8a0d)[_0x41cd('0x3')](function(_0x529738){if(_0x529738['error']){return _0x31b828(_0x529738['error']['message']);}else{return _0x5f5a85(_0x529738['result']);}})[_0x41cd('0x4')](function(_0x234fd9){return _0x31b828(_0x234fd9);});});}exports[_0x41cd('0x5')]=function(_0x283625,_0x161e38){return request(_0x41cd('0x6'),{'account':_0x283625,'message':_0x161e38});}; \ No newline at end of file +var _0x6477=['error','result','SendMail','bluebird','jayson/promise','http','request','then'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6477,0x193));var _0x7647=function(_0x11a566,_0x4b82c5){_0x11a566=_0x11a566-0x0;var _0x2395ac=_0x6477[_0x11a566];return _0x2395ac;};'use strict';var BPromise=require(_0x7647('0x0'));var jayson=require(_0x7647('0x1'));var client=jayson['client'][_0x7647('0x2')]({'port':0x232b});function request(_0x184aec,_0x2894c2){return new BPromise(function(_0x416453,_0x4562cd){return client[_0x7647('0x3')](_0x184aec,_0x2894c2)[_0x7647('0x4')](function(_0x1a85b4){if(_0x1a85b4[_0x7647('0x5')]){return _0x4562cd(_0x1a85b4[_0x7647('0x5')]['message']);}else{return _0x416453(_0x1a85b4[_0x7647('0x6')]);}})['catch'](function(_0x50d315){return _0x4562cd(_0x50d315);});});}exports['sendMailMessage']=function(_0x30624e,_0x1107cc){return request(_0x7647('0x7'),{'account':_0x30624e,'message':_0x1107cc});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index e4864d3..0e9efc6 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66c9=['chatWaitingInteractions','whatsappWaitingInteractions','emit','user:save','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','mailWaitingInteractions','openchannelWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','mail','chat','openchannel','fax','sms','whatsapp','Status','StatusTime','toNumber','mailStatus','whatsappCurrentCapacity','openchannelStatusTime','busy'];(function(_0x15c481,_0x246d89){var _0x587558=function(_0x2a946f){while(--_0x2a946f){_0x15c481['push'](_0x15c481['shift']());}};_0x587558(++_0x246d89);}(_0x66c9,0xbb));var _0x966c=function(_0x4a49d3,_0x557a94){_0x4a49d3=_0x4a49d3-0x0;var _0x55597f=_0x66c9[_0x4a49d3];return _0x55597f;};'use strict';var _=require('lodash');var moment=require(_0x966c('0x0'));var md5=require('md5');var Redis=require(_0x966c('0x1'));var config=require(_0x966c('0x2'));config[_0x966c('0x3')]=_['defaults'](config[_0x966c('0x3')],{'host':_0x966c('0x4'),'port':0x18eb});var io=require(_0x966c('0x5'))(new Redis(config[_0x966c('0x3')]));function Agent(_0xb60bd1){this['id']=_0xb60bd1['id']||0x0;this[_0x966c('0x6')]=_0xb60bd1['name']||'';this[_0x966c('0x7')]=_0xb60bd1[_0x966c('0x7')]||!![];this['voicePause']=_0xb60bd1[_0x966c('0x8')]||![];this[_0x966c('0x9')]=_0xb60bd1[_0x966c('0x9')]||![];this[_0x966c('0xa')]=_0xb60bd1[_0x966c('0xa')]||![];this[_0x966c('0xb')]=_0xb60bd1[_0x966c('0xb')]||![];this[_0x966c('0xc')]=_0xb60bd1[_0x966c('0xc')]||![];this[_0x966c('0xd')]=_0xb60bd1[_0x966c('0xd')]||![];this[_0x966c('0xe')]='unknown';this[_0x966c('0xf')]=0x0;this['chatCapacity']=_0xb60bd1[_0x966c('0x10')]||0x0;this[_0x966c('0x11')]=0x0;this['mailStatus']='unknown';this[_0x966c('0x12')]=0x0;this[_0x966c('0x13')]=_0xb60bd1[_0x966c('0x13')]||0x0;this[_0x966c('0x14')]=0x0;this[_0x966c('0x15')]=_0x966c('0x16');this[_0x966c('0x17')]=0x0;this[_0x966c('0x18')]=_0xb60bd1['faxCapacity']||0x0;this[_0x966c('0x19')]=0x0;this[_0x966c('0x1a')]=_0x966c('0x16');this[_0x966c('0x1b')]=0x0;this[_0x966c('0x1c')]=_0xb60bd1['smsCapacity']||0x0;this[_0x966c('0x1d')]=0x0;this[_0x966c('0x1e')]=_0x966c('0x16');this['whatsappStatusTime']=0x0;this[_0x966c('0x1f')]=_0xb60bd1['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x966c('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0x966c('0x21')]=_0xb60bd1[_0x966c('0x21')]||0x0;this[_0x966c('0x22')]=0x0;this['busy']=![];this[_0x966c('0x23')]=undefined;this[_0x966c('0x24')]='';this['chatWaitingInteractions']={};this['faxWaitingInteractions']={};this[_0x966c('0x25')]={};this[_0x966c('0x26')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0x966c('0x27')]();}Agent[_0x966c('0x28')][_0x966c('0x29')]=function(_0x211a59){if(this[_0x211a59+_0x966c('0x2a')]>0x0){if(this[_0x211a59+_0x966c('0x2b')]>0x0&&this[_0x211a59+_0x966c('0x2a')]>=this[_0x211a59+'Capacity']){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x966c('0x28')]['updateRealtime']=function(){var _0x2b1bda=[_0x966c('0x2c'),_0x966c('0x2d'),_0x966c('0x2e'),_0x966c('0x2f'),_0x966c('0x30'),_0x966c('0x31')];for(var _0x30eae4=0x0;_0x30eae4<_0x2b1bda['length'];_0x30eae4+=0x1){var _0xf8cc01=this['getChannelStatus'](_0x2b1bda[_0x30eae4]);if(this[_0x2b1bda[_0x30eae4]+_0x966c('0x32')]!==_0xf8cc01){this[_0x2b1bda[_0x30eae4]+_0x966c('0x33')]=_[_0x966c('0x34')](moment()['format']('x'));}this[_0x2b1bda[_0x30eae4]+_0x966c('0x32')]=_0xf8cc01;}var _0xf77f24={'id':this['id'],'name':this[_0x966c('0x6')],'online':this[_0x966c('0x7')],'voicePause':this[_0x966c('0x8')],'chatPause':this[_0x966c('0x9')],'mailPause':this[_0x966c('0xa')],'smsPause':this[_0x966c('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x966c('0xe')],'chatStatusTime':this[_0x966c('0xf')],'chatCapacity':this[_0x966c('0x10')],'chatCurrentCapacity':this[_0x966c('0x11')],'mailStatus':this[_0x966c('0x35')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x966c('0x13')],'mailCurrentCapacity':this[_0x966c('0x14')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x966c('0x17')],'faxCapacity':this[_0x966c('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x966c('0x1a')],'smsStatusTime':this[_0x966c('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x966c('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x966c('0x1f')],'whatsappCurrentCapacity':this[_0x966c('0x36')],'openchannelStatus':this[_0x966c('0x20')],'openchannelStatusTime':this[_0x966c('0x37')],'openchannelCapacity':this[_0x966c('0x21')],'openchannelCurrentCapacity':this[_0x966c('0x22')],'busy':this[_0x966c('0x38')],'busyQueue':this[_0x966c('0x23')],'chatWaitingInteractions':this[_0x966c('0x39')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x966c('0x26')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x966c('0x3a')]};var _0x41ae05=md5(JSON['stringify'](_0xf77f24));if(this['md5']!==_0x41ae05){this['md5']=_0x41ae05;io[_0x966c('0x3b')](_0x966c('0x3c'),_0xf77f24);}};module['exports']=Agent; \ No newline at end of file +var _0x7349=['chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','mail','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailCurrentCapacity','faxStatus','stringify','emit','user:save','exports','moment','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity'];(function(_0x4e6f6e,_0x575e3f){var _0x492e33=function(_0x283e77){while(--_0x283e77){_0x4e6f6e['push'](_0x4e6f6e['shift']());}};_0x492e33(++_0x575e3f);}(_0x7349,0xe4));var _0x9734=function(_0x14063a,_0x1cafe3){_0x14063a=_0x14063a-0x0;var _0x709ca5=_0x7349[_0x14063a];return _0x709ca5;};'use strict';var _=require('lodash');var moment=require(_0x9734('0x0'));var md5=require(_0x9734('0x1'));var Redis=require('ioredis');var config=require(_0x9734('0x2'));config[_0x9734('0x3')]=_['defaults'](config[_0x9734('0x3')],{'host':_0x9734('0x4'),'port':0x18eb});var io=require(_0x9734('0x5'))(new Redis(config[_0x9734('0x3')]));function Agent(_0x7fb9f5){this['id']=_0x7fb9f5['id']||0x0;this[_0x9734('0x6')]=_0x7fb9f5[_0x9734('0x6')]||'';this[_0x9734('0x7')]=_0x7fb9f5[_0x9734('0x7')]||!![];this[_0x9734('0x8')]=_0x7fb9f5[_0x9734('0x8')]||![];this['chatPause']=_0x7fb9f5[_0x9734('0x9')]||![];this['mailPause']=_0x7fb9f5[_0x9734('0xa')]||![];this[_0x9734('0xb')]=_0x7fb9f5[_0x9734('0xb')]||![];this['smsPause']=_0x7fb9f5[_0x9734('0xc')]||![];this[_0x9734('0xd')]=_0x7fb9f5[_0x9734('0xd')]||![];this['chatStatus']='unknown';this[_0x9734('0xe')]=0x0;this[_0x9734('0xf')]=_0x7fb9f5[_0x9734('0xf')]||0x0;this[_0x9734('0x10')]=0x0;this[_0x9734('0x11')]='unknown';this[_0x9734('0x12')]=0x0;this[_0x9734('0x13')]=_0x7fb9f5[_0x9734('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x9734('0x14');this[_0x9734('0x15')]=0x0;this[_0x9734('0x16')]=_0x7fb9f5[_0x9734('0x16')]||0x0;this[_0x9734('0x17')]=0x0;this[_0x9734('0x18')]=_0x9734('0x14');this['smsStatusTime']=0x0;this['smsCapacity']=_0x7fb9f5[_0x9734('0x19')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0x9734('0x1a')]=0x0;this[_0x9734('0x1b')]=_0x7fb9f5[_0x9734('0x1b')]||0x0;this[_0x9734('0x1c')]=0x0;this['openchannelStatus']=_0x9734('0x14');this[_0x9734('0x1d')]=0x0;this[_0x9734('0x1e')]=_0x7fb9f5[_0x9734('0x1e')]||0x0;this[_0x9734('0x1f')]=0x0;this[_0x9734('0x20')]=![];this[_0x9734('0x21')]=undefined;this['md5']='';this[_0x9734('0x22')]={};this[_0x9734('0x23')]={};this[_0x9734('0x24')]={};this[_0x9734('0x25')]={};this[_0x9734('0x26')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x9734('0x27')]['getChannelStatus']=function(_0x470852){if(this[_0x470852+_0x9734('0x28')]>0x0){if(this[_0x470852+_0x9734('0x29')]>0x0&&this[_0x470852+_0x9734('0x28')]>=this[_0x470852+'Capacity']){return _0x9734('0x2a');}else{return _0x9734('0x2b');}}else{return _0x9734('0x2c');}};Agent['prototype'][_0x9734('0x2d')]=function(){var _0x4c3255=[_0x9734('0x2e'),'chat','openchannel',_0x9734('0x2f'),_0x9734('0x30'),_0x9734('0x31')];for(var _0x5711f9=0x0;_0x5711f9<_0x4c3255[_0x9734('0x32')];_0x5711f9+=0x1){var _0x422aba=this['getChannelStatus'](_0x4c3255[_0x5711f9]);if(this[_0x4c3255[_0x5711f9]+_0x9734('0x33')]!==_0x422aba){this[_0x4c3255[_0x5711f9]+_0x9734('0x34')]=_[_0x9734('0x35')](moment()[_0x9734('0x36')]('x'));}this[_0x4c3255[_0x5711f9]+_0x9734('0x33')]=_0x422aba;}var _0x57a744={'id':this['id'],'name':this[_0x9734('0x6')],'online':this[_0x9734('0x7')],'voicePause':this[_0x9734('0x8')],'chatPause':this[_0x9734('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x9734('0xc')],'faxPause':this[_0x9734('0xb')],'openchannelPause':this[_0x9734('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x9734('0xe')],'chatCapacity':this[_0x9734('0xf')],'chatCurrentCapacity':this[_0x9734('0x10')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x9734('0x12')],'mailCapacity':this[_0x9734('0x13')],'mailCurrentCapacity':this[_0x9734('0x37')],'faxStatus':this[_0x9734('0x38')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x9734('0x17')],'smsStatus':this[_0x9734('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x9734('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x9734('0x1a')],'whatsappCapacity':this[_0x9734('0x1b')],'whatsappCurrentCapacity':this[_0x9734('0x1c')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x9734('0x1e')],'openchannelCurrentCapacity':this[_0x9734('0x1f')],'busy':this[_0x9734('0x20')],'busyQueue':this[_0x9734('0x21')],'chatWaitingInteractions':this[_0x9734('0x22')],'faxWaitingInteractions':this[_0x9734('0x23')],'mailWaitingInteractions':this[_0x9734('0x24')],'openchannelWaitingInteractions':this[_0x9734('0x25')],'smsWaitingInteractions':this[_0x9734('0x26')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x3fbd40=md5(JSON[_0x9734('0x39')](_0x57a744));if(this[_0x9734('0x1')]!==_0x3fbd40){this['md5']=_0x3fbd40;io[_0x9734('0x3a')](_0x9734('0x3b'),_0x57a744);}};module[_0x9734('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 53d1d38..c8e0206 100644 --- a/server/services/routing/model/chatQueue.js +++ b/server/services/routing/model/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1662=['updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x4e9adc,_0x24386d){var _0x4dd205=function(_0x5f439b){while(--_0x5f439b){_0x4e9adc['push'](_0x4e9adc['shift']());}};_0x4dd205(++_0x24386d);}(_0x1662,0x10b));var _0x2166=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x1662[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x2166('0x0'));var md5=require(_0x2166('0x1'));var util=require(_0x2166('0x2'));var Redis=require('ioredis');var config=require(_0x2166('0x3'));config['redis']=_[_0x2166('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2166('0x5')]));function ChatQueue(_0x288da7){this['id']=_0x288da7['id']||0x0;this[_0x2166('0x6')]=_0x288da7[_0x2166('0x6')]||'';this['timeout']=_0x288da7[_0x2166('0x7')]||0xa;this[_0x2166('0x8')]=_0x288da7[_0x2166('0x8')]||_0x2166('0x9');this[_0x2166('0xa')]=_0x288da7[_0x2166('0xa')];this[_0x2166('0xb')]={};this[_0x2166('0xc')]=0x0;this[_0x2166('0x1')]='';this['updateRouting']();this[_0x2166('0xd')]();}ChatQueue[_0x2166('0xe')][_0x2166('0xf')]=function(){var _0x3738fa=this['mapAgentsId'][_0x2166('0x10')];this[_0x2166('0xb')]=_[_0x2166('0x11')](this[_0x2166('0xa')],'id');this['mapAgentsId']['_rr']=_0x3738fa;};ChatQueue['prototype'][_0x2166('0xd')]=function(){this[_0x2166('0x12')]=0x0;this[_0x2166('0x13')]=0x0;for(var _0x17ae82=0x0;_0x17ae82=0x0?this['available']:0x0;var _0x3525c4={'id':this['id'],'available':this[_0x2166('0x17')],'loggedIn':this[_0x2166('0x12')],'name':this[_0x2166('0x6')],'paused':this[_0x2166('0x13')],'waiting':this[_0x2166('0xc')]};var _0x4c6963=md5(JSON['stringify'](_0x3525c4));if(this[_0x2166('0x1')]!==_0x4c6963){this[_0x2166('0x1')]=_0x4c6963;io['to'](util[_0x2166('0x18')](_0x2166('0x19'),_0x3525c4[_0x2166('0x6')]))[_0x2166('0x1a')](_0x2166('0x1b'),_0x3525c4);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x2b9b=['name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','paused','Agents','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x30952e,_0x4aac87){var _0x554fe8=function(_0x59d8b5){while(--_0x59d8b5){_0x30952e['push'](_0x30952e['shift']());}};_0x554fe8(++_0x4aac87);}(_0x2b9b,0x124));var _0xb2b9=function(_0x56d499,_0x3e1630){_0x56d499=_0x56d499-0x0;var _0x287af5=_0x2b9b[_0x56d499];return _0x287af5;};'use strict';var _=require(_0xb2b9('0x0'));var md5=require(_0xb2b9('0x1'));var util=require(_0xb2b9('0x2'));var Redis=require('ioredis');var config=require(_0xb2b9('0x3'));config[_0xb2b9('0x4')]=_[_0xb2b9('0x5')](config['redis'],{'host':_0xb2b9('0x6'),'port':0x18eb});var io=require(_0xb2b9('0x7'))(new Redis(config[_0xb2b9('0x4')]));function ChatQueue(_0x2ffad6){this['id']=_0x2ffad6['id']||0x0;this[_0xb2b9('0x8')]=_0x2ffad6[_0xb2b9('0x8')]||'';this[_0xb2b9('0x9')]=_0x2ffad6[_0xb2b9('0x9')]||0xa;this[_0xb2b9('0xa')]=_0x2ffad6[_0xb2b9('0xa')]||_0xb2b9('0xb');this['Agents']=_0x2ffad6['Agents'];this[_0xb2b9('0xc')]={};this[_0xb2b9('0xd')]=0x0;this['md5']='';this[_0xb2b9('0xe')]();this[_0xb2b9('0xf')]();}ChatQueue[_0xb2b9('0x10')][_0xb2b9('0xe')]=function(){var _0x3dd624=this['mapAgentsId']['_rr'];this[_0xb2b9('0xc')]=_[_0xb2b9('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x3dd624;};ChatQueue['prototype'][_0xb2b9('0xf')]=function(){this['loggedIn']=0x0;this[_0xb2b9('0x12')]=0x0;for(var _0xd9b1e6=0x0;_0xd9b1e6=0x0?this['available']:0x0;var _0x199c56={'id':this['id'],'available':this[_0xb2b9('0x18')],'loggedIn':this[_0xb2b9('0x16')],'name':this['name'],'paused':this[_0xb2b9('0x12')],'waiting':this['waiting']};var _0x9003c7=md5(JSON[_0xb2b9('0x19')](_0x199c56));if(this[_0xb2b9('0x1')]!==_0x9003c7){this['md5']=_0x9003c7;io['to'](util[_0xb2b9('0x1a')](_0xb2b9('0x1b'),_0x199c56[_0xb2b9('0x8')]))['emit'](_0xb2b9('0x1c'),_0x199c56);}};module[_0xb2b9('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6a745e3..e2a9864 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40b9=['available','format','emit','fax_queue:save','exports','md5','util','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','faxPause'];(function(_0x18fcca,_0x851c56){var _0x37644a=function(_0x30d7bb){while(--_0x30d7bb){_0x18fcca['push'](_0x18fcca['shift']());}};_0x37644a(++_0x851c56);}(_0x40b9,0x131));var _0x940b=function(_0x5f1659,_0x4e5141){_0x5f1659=_0x5f1659-0x0;var _0x4149b4=_0x40b9[_0x5f1659];return _0x4149b4;};'use strict';var _=require('lodash');var md5=require(_0x940b('0x0'));var util=require(_0x940b('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x940b('0x2')](config['redis'],{'host':_0x940b('0x3'),'port':0x18eb});var io=require(_0x940b('0x4'))(new Redis(config[_0x940b('0x5')]));function FaxQueue(_0x3e2af1){this['id']=_0x3e2af1['id']||0x0;this[_0x940b('0x6')]=_0x3e2af1[_0x940b('0x6')]||'';this[_0x940b('0x7')]=_0x3e2af1[_0x940b('0x7')]||0xa;this[_0x940b('0x8')]=_0x3e2af1[_0x940b('0x8')]||'beepall';this[_0x940b('0x9')]=_0x3e2af1[_0x940b('0x9')];this[_0x940b('0xa')]={};this[_0x940b('0xb')]=0x0;this[_0x940b('0x0')]='';this['updateRouting']();this[_0x940b('0xc')]();}FaxQueue[_0x940b('0xd')][_0x940b('0xe')]=function(){var _0x2a8db6=this[_0x940b('0xa')]['_rr'];this[_0x940b('0xa')]=_['map'](this[_0x940b('0x9')],'id');this[_0x940b('0xa')][_0x940b('0xf')]=_0x2a8db6;};FaxQueue['prototype'][_0x940b('0xc')]=function(){this[_0x940b('0x10')]=0x0;this[_0x940b('0x11')]=0x0;for(var _0x1cf93e=0x0;_0x1cf93e=0x0?this[_0x940b('0x14')]:0x0;var _0x240c36={'id':this['id'],'available':this['available'],'loggedIn':this[_0x940b('0x10')],'name':this[_0x940b('0x6')],'paused':this[_0x940b('0x11')],'waiting':this['waiting']};var _0x5a386d=md5(JSON['stringify'](_0x240c36));if(this['md5']!==_0x5a386d){this['md5']=_0x5a386d;io['to'](util[_0x940b('0x15')]('fax:queue:%s',_0x240c36[_0x940b('0x6')]))[_0x940b('0x16')](_0x940b('0x17'),_0x240c36);}};module[_0x940b('0x18')]=FaxQueue; \ No newline at end of file +var _0x258f=['ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','_rr','map','mapAgentsId','prototype','loggedIn','length','online','paused','available','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0x258f,0x12a));var _0xf258=function(_0x252fa2,_0x3de62b){_0x252fa2=_0x252fa2-0x0;var _0x4f1768=_0x258f[_0x252fa2];return _0x4f1768;};'use strict';var _=require('lodash');var md5=require(_0xf258('0x0'));var util=require(_0xf258('0x1'));var Redis=require(_0xf258('0x2'));var config=require(_0xf258('0x3'));config['redis']=_[_0xf258('0x4')](config['redis'],{'host':_0xf258('0x5'),'port':0x18eb});var io=require(_0xf258('0x6'))(new Redis(config[_0xf258('0x7')]));function FaxQueue(_0x12d80d){this['id']=_0x12d80d['id']||0x0;this['name']=_0x12d80d[_0xf258('0x8')]||'';this[_0xf258('0x9')]=_0x12d80d[_0xf258('0x9')]||0xa;this['strategy']=_0x12d80d[_0xf258('0xa')]||_0xf258('0xb');this['Agents']=_0x12d80d[_0xf258('0xc')];this['mapAgentsId']={};this[_0xf258('0xd')]=0x0;this[_0xf258('0x0')]='';this[_0xf258('0xe')]();this[_0xf258('0xf')]();}FaxQueue['prototype'][_0xf258('0xe')]=function(){var _0xf1f2d5=this['mapAgentsId'][_0xf258('0x10')];this['mapAgentsId']=_[_0xf258('0x11')](this['Agents'],'id');this[_0xf258('0x12')]['_rr']=_0xf1f2d5;};FaxQueue[_0xf258('0x13')][_0xf258('0xf')]=function(){this[_0xf258('0x14')]=0x0;this['paused']=0x0;for(var _0x25f5a8=0x0;_0x25f5a8=0x0?this['available']:0x0;var _0x2d981c={'id':this['id'],'available':this[_0xf258('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xf258('0x17')],'waiting':this['waiting']};var _0x2339de=md5(JSON['stringify'](_0x2d981c));if(this[_0xf258('0x0')]!==_0x2339de){this[_0xf258('0x0')]=_0x2339de;io['to'](util[_0xf258('0x19')](_0xf258('0x1a'),_0x2d981c[_0xf258('0x8')]))[_0xf258('0x1b')](_0xf258('0x1c'),_0x2d981c);}};module[_0xf258('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d31a6b3..99b0e27 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d50=['name','exports'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x5d50,0x150));var _0x05d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d50[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x1bef9d){this['id']=_0x1bef9d['id']||0x0;this[_0x05d5('0x0')]=_0x1bef9d[_0x05d5('0x0')]||'';this['Intervals']=_0x1bef9d['Intervals']||{};}module[_0x05d5('0x1')]=Interval; \ No newline at end of file +var _0x4e56=['name','Intervals'];(function(_0xf88586,_0x32be82){var _0x3ebb3e=function(_0x1a0e7e){while(--_0x1a0e7e){_0xf88586['push'](_0xf88586['shift']());}};_0x3ebb3e(++_0x32be82);}(_0x4e56,0x92));var _0x64e5=function(_0x4cc192,_0x31873a){_0x4cc192=_0x4cc192-0x0;var _0x2d1eb7=_0x4e56[_0x4cc192];return _0x2d1eb7;};'use strict';function Interval(_0x28e9dc){this['id']=_0x28e9dc['id']||0x0;this[_0x64e5('0x0')]=_0x28e9dc[_0x64e5('0x0')]||'';this[_0x64e5('0x1')]=_0x28e9dc[_0x64e5('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e153622..25cfefc 100644 --- a/server/services/routing/model/mailQueue.js +++ b/server/services/routing/model/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d75=['emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','paused','online','loggedIn','mailPause','available','format','mail:queue:%s'];(function(_0x124fbe,_0x5a9dfe){var _0x4700d5=function(_0x1829cb){while(--_0x1829cb){_0x124fbe['push'](_0x124fbe['shift']());}};_0x4700d5(++_0x5a9dfe);}(_0x4d75,0x199));var _0x54d7=function(_0x2e1654,_0x21f0bb){_0x2e1654=_0x2e1654-0x0;var _0x43d235=_0x4d75[_0x2e1654];return _0x43d235;};'use strict';var _=require(_0x54d7('0x0'));var md5=require(_0x54d7('0x1'));var util=require(_0x54d7('0x2'));var Redis=require(_0x54d7('0x3'));var config=require('../../../config/environment');config[_0x54d7('0x4')]=_[_0x54d7('0x5')](config[_0x54d7('0x4')],{'host':_0x54d7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x54d7('0x4')]));function MailQueue(_0x3f7688){this['id']=_0x3f7688['id']||0x0;this[_0x54d7('0x7')]=_0x3f7688[_0x54d7('0x7')]||'';this['timeout']=_0x3f7688[_0x54d7('0x8')]||0xa;this[_0x54d7('0x9')]=_0x3f7688[_0x54d7('0x9')]||_0x54d7('0xa');this[_0x54d7('0xb')]=_0x3f7688[_0x54d7('0xb')];this[_0x54d7('0xc')]={};this[_0x54d7('0xd')]=0x0;this[_0x54d7('0x1')]='';this['updateRouting']();this[_0x54d7('0xe')]();}MailQueue[_0x54d7('0xf')][_0x54d7('0x10')]=function(){var _0x22ddf9=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x54d7('0x11')](this[_0x54d7('0xb')],'id');this[_0x54d7('0xc')][_0x54d7('0x12')]=_0x22ddf9;};MailQueue['prototype'][_0x54d7('0xe')]=function(){this['loggedIn']=0x0;this[_0x54d7('0x13')]=0x0;for(var _0x16f22b=0x0;_0x16f22b=0x0?this[_0x54d7('0x17')]:0x0;var _0x79355a={'id':this['id'],'available':this[_0x54d7('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x54d7('0x7')],'paused':this['paused'],'waiting':this[_0x54d7('0xd')]};var _0x2e1314=md5(JSON['stringify'](_0x79355a));if(this['md5']!==_0x2e1314){this[_0x54d7('0x1')]=_0x2e1314;io['to'](util[_0x54d7('0x18')](_0x54d7('0x19'),_0x79355a[_0x54d7('0x7')]))[_0x54d7('0x1a')](_0x54d7('0x1b'),_0x79355a);}};module[_0x54d7('0x1c')]=MailQueue; \ No newline at end of file +var _0x30b5=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5'];(function(_0x27995e,_0x191dae){var _0x49a232=function(_0x110ac8){while(--_0x110ac8){_0x27995e['push'](_0x27995e['shift']());}};_0x49a232(++_0x191dae);}(_0x30b5,0xee));var _0x530b=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0x30b5[_0x565fed];return _0x3e018f;};'use strict';var _=require(_0x530b('0x0'));var md5=require(_0x530b('0x1'));var util=require(_0x530b('0x2'));var Redis=require(_0x530b('0x3'));var config=require(_0x530b('0x4'));config[_0x530b('0x5')]=_[_0x530b('0x6')](config['redis'],{'host':_0x530b('0x7'),'port':0x18eb});var io=require(_0x530b('0x8'))(new Redis(config[_0x530b('0x5')]));function MailQueue(_0xc70d69){this['id']=_0xc70d69['id']||0x0;this['name']=_0xc70d69[_0x530b('0x9')]||'';this[_0x530b('0xa')]=_0xc70d69[_0x530b('0xa')]||0xa;this[_0x530b('0xb')]=_0xc70d69[_0x530b('0xb')]||'beepall';this['Agents']=_0xc70d69[_0x530b('0xc')];this[_0x530b('0xd')]={};this[_0x530b('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x530b('0xf')]();}MailQueue[_0x530b('0x10')][_0x530b('0x11')]=function(){var _0x110e0f=this['mapAgentsId'][_0x530b('0x12')];this[_0x530b('0xd')]=_[_0x530b('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x530b('0x12')]=_0x110e0f;};MailQueue[_0x530b('0x10')]['updateRealtime']=function(){this[_0x530b('0x14')]=0x0;this[_0x530b('0x15')]=0x0;for(var _0x4be78c=0x0;_0x4be78c=0x0?this[_0x530b('0x18')]:0x0;var _0x25c571={'id':this['id'],'available':this[_0x530b('0x18')],'loggedIn':this[_0x530b('0x14')],'name':this[_0x530b('0x9')],'paused':this[_0x530b('0x15')],'waiting':this[_0x530b('0xe')]};var _0x50cd66=md5(JSON[_0x530b('0x19')](_0x25c571));if(this[_0x530b('0x1')]!==_0x50cd66){this[_0x530b('0x1')]=_0x50cd66;io['to'](util['format'](_0x530b('0x1a'),_0x25c571[_0x530b('0x9')]))[_0x530b('0x1b')](_0x530b('0x1c'),_0x25c571);}};module[_0x530b('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b65b674..76a6e4f 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c74ad6e..14022ab 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb205=['available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','loggedIn'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0xb205,0xf0));var _0x5b20=function(_0x118953,_0x3ba38a){_0x118953=_0x118953-0x0;var _0x14eb15=_0xb205[_0x118953];return _0x14eb15;};'use strict';var _=require(_0x5b20('0x0'));var md5=require(_0x5b20('0x1'));var util=require(_0x5b20('0x2'));var Redis=require(_0x5b20('0x3'));var config=require(_0x5b20('0x4'));config['redis']=_['defaults'](config[_0x5b20('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x5b20('0x6'))(new Redis(config[_0x5b20('0x5')]));function SmsQueue(_0x5a4526){this['id']=_0x5a4526['id']||0x0;this[_0x5b20('0x7')]=_0x5a4526[_0x5b20('0x7')]||'';this[_0x5b20('0x8')]=_0x5a4526['timeout']||0xa;this[_0x5b20('0x9')]=_0x5a4526[_0x5b20('0x9')]||'beepall';this['Agents']=_0x5a4526[_0x5b20('0xa')];this[_0x5b20('0xb')]={};this[_0x5b20('0xc')]=0x0;this[_0x5b20('0x1')]='';this[_0x5b20('0xd')]();this[_0x5b20('0xe')]();}SmsQueue[_0x5b20('0xf')]['updateRouting']=function(){var _0xdec7cd=this[_0x5b20('0xb')][_0x5b20('0x10')];this['mapAgentsId']=_['map'](this[_0x5b20('0xa')],'id');this[_0x5b20('0xb')][_0x5b20('0x10')]=_0xdec7cd;};SmsQueue[_0x5b20('0xf')][_0x5b20('0xe')]=function(){this['loggedIn']=0x0;this[_0x5b20('0x11')]=0x0;for(var _0x32c2df=0x0;_0x32c2df=0x0?this[_0x5b20('0x14')]:0x0;var _0x301c9a={'id':this['id'],'available':this[_0x5b20('0x14')],'loggedIn':this[_0x5b20('0x13')],'name':this['name'],'paused':this[_0x5b20('0x11')],'waiting':this['waiting']};var _0x1a75d7=md5(JSON[_0x5b20('0x15')](_0x301c9a));if(this['md5']!==_0x1a75d7){this[_0x5b20('0x1')]=_0x1a75d7;io['to'](util[_0x5b20('0x16')](_0x5b20('0x17'),_0x301c9a['name']))[_0x5b20('0x18')](_0x5b20('0x19'),_0x301c9a);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x195e=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','paused','Agents','loggedIn','available','stringify','sms:queue:%s','emit','sms_queue:save','lodash'];(function(_0x322327,_0x5a6b94){var _0x57ff6e=function(_0x2ac19f){while(--_0x2ac19f){_0x322327['push'](_0x322327['shift']());}};_0x57ff6e(++_0x5a6b94);}(_0x195e,0xfb));var _0xe195=function(_0x1e221b,_0x320514){_0x1e221b=_0x1e221b-0x0;var _0x1a2a36=_0x195e[_0x1e221b];return _0x1a2a36;};'use strict';var _=require(_0xe195('0x0'));var md5=require(_0xe195('0x1'));var util=require(_0xe195('0x2'));var Redis=require(_0xe195('0x3'));var config=require(_0xe195('0x4'));config[_0xe195('0x5')]=_[_0xe195('0x6')](config[_0xe195('0x5')],{'host':_0xe195('0x7'),'port':0x18eb});var io=require(_0xe195('0x8'))(new Redis(config[_0xe195('0x5')]));function SmsQueue(_0x2d1fa7){this['id']=_0x2d1fa7['id']||0x0;this[_0xe195('0x9')]=_0x2d1fa7['name']||'';this[_0xe195('0xa')]=_0x2d1fa7[_0xe195('0xa')]||0xa;this[_0xe195('0xb')]=_0x2d1fa7[_0xe195('0xb')]||_0xe195('0xc');this['Agents']=_0x2d1fa7['Agents'];this['mapAgentsId']={};this[_0xe195('0xd')]=0x0;this[_0xe195('0x1')]='';this[_0xe195('0xe')]();this[_0xe195('0xf')]();}SmsQueue['prototype'][_0xe195('0xe')]=function(){var _0x267721=this[_0xe195('0x10')]['_rr'];this[_0xe195('0x10')]=_[_0xe195('0x11')](this['Agents'],'id');this[_0xe195('0x10')][_0xe195('0x12')]=_0x267721;};SmsQueue[_0xe195('0x13')][_0xe195('0xf')]=function(){this['loggedIn']=0x0;this[_0xe195('0x14')]=0x0;for(var _0x2e82d1=0x0;_0x2e82d1=0x0?this[_0xe195('0x17')]:0x0;var _0x41265d={'id':this['id'],'available':this[_0xe195('0x17')],'loggedIn':this[_0xe195('0x16')],'name':this['name'],'paused':this[_0xe195('0x14')],'waiting':this[_0xe195('0xd')]};var _0xdf735a=md5(JSON[_0xe195('0x18')](_0x41265d));if(this[_0xe195('0x1')]!==_0xdf735a){this[_0xe195('0x1')]=_0xdf735a;io['to'](util['format'](_0xe195('0x19'),_0x41265d[_0xe195('0x9')]))[_0xe195('0x1a')](_0xe195('0x1b'),_0x41265d);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 65b2c68..4fb4b6f 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7080=['beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','name','stringify','emit','whatsapp_queue:save','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy'];(function(_0x182e21,_0x39f681){var _0x357888=function(_0x5c5e26){while(--_0x5c5e26){_0x182e21['push'](_0x182e21['shift']());}};_0x357888(++_0x39f681);}(_0x7080,0x147));var _0x0708=function(_0x18ac4a,_0x3970f0){_0x18ac4a=_0x18ac4a-0x0;var _0x48cb7a=_0x7080[_0x18ac4a];return _0x48cb7a;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x0708('0x0'));var Redis=require(_0x0708('0x1'));var config=require(_0x0708('0x2'));config[_0x0708('0x3')]=_[_0x0708('0x4')](config[_0x0708('0x3')],{'host':_0x0708('0x5'),'port':0x18eb});var io=require(_0x0708('0x6'))(new Redis(config[_0x0708('0x3')]));function WhatsappQueue(_0x48a867){this['id']=_0x48a867['id']||0x0;this['name']=_0x48a867['name']||'';this['timeout']=_0x48a867[_0x0708('0x7')]||0xa;this['strategy']=_0x48a867[_0x0708('0x8')]||_0x0708('0x9');this['Agents']=_0x48a867[_0x0708('0xa')];this[_0x0708('0xb')]={};this[_0x0708('0xc')]=0x0;this[_0x0708('0xd')]='';this[_0x0708('0xe')]();this[_0x0708('0xf')]();}WhatsappQueue[_0x0708('0x10')][_0x0708('0xe')]=function(){var _0x4e8723=this[_0x0708('0xb')][_0x0708('0x11')];this[_0x0708('0xb')]=_[_0x0708('0x12')](this[_0x0708('0xa')],'id');this['mapAgentsId'][_0x0708('0x11')]=_0x4e8723;};WhatsappQueue[_0x0708('0x10')][_0x0708('0xf')]=function(){this['loggedIn']=0x0;this[_0x0708('0x13')]=0x0;for(var _0x2e52c8=0x0;_0x2e52c8=0x0?this[_0x0708('0x17')]:0x0;var _0x2facc5={'id':this['id'],'available':this[_0x0708('0x17')],'loggedIn':this[_0x0708('0x16')],'name':this[_0x0708('0x18')],'paused':this[_0x0708('0x13')],'waiting':this['waiting']};var _0x29dc47=md5(JSON[_0x0708('0x19')](_0x2facc5));if(this[_0x0708('0xd')]!==_0x29dc47){this[_0x0708('0xd')]=_0x29dc47;io['to'](util['format']('whatsapp:queue:%s',_0x2facc5[_0x0708('0x18')]))[_0x0708('0x1a')](_0x0708('0x1b'),_0x2facc5);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xbf78=['emit','whatsapp_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','format'];(function(_0x4199c8,_0x19a9f1){var _0x113d15=function(_0x162ddd){while(--_0x162ddd){_0x4199c8['push'](_0x4199c8['shift']());}};_0x113d15(++_0x19a9f1);}(_0xbf78,0x153));var _0x8bf7=function(_0xdc0fc8,_0x42842e){_0xdc0fc8=_0xdc0fc8-0x0;var _0x540cb9=_0xbf78[_0xdc0fc8];return _0x540cb9;};'use strict';var _=require(_0x8bf7('0x0'));var md5=require(_0x8bf7('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x8bf7('0x2'));config[_0x8bf7('0x3')]=_[_0x8bf7('0x4')](config['redis'],{'host':_0x8bf7('0x5'),'port':0x18eb});var io=require(_0x8bf7('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x399dcf){this['id']=_0x399dcf['id']||0x0;this[_0x8bf7('0x7')]=_0x399dcf['name']||'';this[_0x8bf7('0x8')]=_0x399dcf[_0x8bf7('0x8')]||0xa;this[_0x8bf7('0x9')]=_0x399dcf[_0x8bf7('0x9')]||_0x8bf7('0xa');this[_0x8bf7('0xb')]=_0x399dcf[_0x8bf7('0xb')];this[_0x8bf7('0xc')]={};this[_0x8bf7('0xd')]=0x0;this[_0x8bf7('0x1')]='';this[_0x8bf7('0xe')]();this[_0x8bf7('0xf')]();}WhatsappQueue[_0x8bf7('0x10')][_0x8bf7('0xe')]=function(){var _0x22f947=this[_0x8bf7('0xc')]['_rr'];this[_0x8bf7('0xc')]=_[_0x8bf7('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x8bf7('0x12')]=_0x22f947;};WhatsappQueue[_0x8bf7('0x10')][_0x8bf7('0xf')]=function(){this[_0x8bf7('0x13')]=0x0;this[_0x8bf7('0x14')]=0x0;for(var _0x31b0a1=0x0;_0x31b0a1=0x0?this['available']:0x0;var _0x18e48f={'id':this['id'],'available':this[_0x8bf7('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x8bf7('0x7')],'paused':this[_0x8bf7('0x14')],'waiting':this[_0x8bf7('0xd')]};var _0x5a8d6a=md5(JSON['stringify'](_0x18e48f));if(this[_0x8bf7('0x1')]!==_0x5a8d6a){this[_0x8bf7('0x1')]=_0x5a8d6a;io['to'](util[_0x8bf7('0x18')]('whatsapp:queue:%s',_0x18e48f['name']))[_0x8bf7('0x19')](_0x8bf7('0x1a'),_0x18e48f);}};module[_0x8bf7('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5957075..5dec144 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7c043b4..fcb92a1 100644 --- a/server/services/routing/rpc/chatInteraction.js +++ b/server/services/routing/rpc/chatInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb746=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb746,0x1bc));var _0x6b74=function(_0x3c4a4d,_0x1e2b93){_0x3c4a4d=_0x3c4a4d-0x0;var _0x2b6d0d=_0xb746[_0x3c4a4d];return _0x2b6d0d;};'use strict';var client=require('../client');exports['update']=function(_0x41637c,_0x428a8d){return client[_0x6b74('0x0')](_0x6b74('0x1'),{'body':_0x428a8d,'options':{'where':{'id':_0x41637c}},'log':_0x6b74('0x2')});};exports[_0x6b74('0x3')]=function(_0x153427,_0x5ae903){return client[_0x6b74('0x0')](_0x6b74('0x4'),{'body':_0x5ae903,'options':{'where':{'id':_0x153427}},'log':_0x6b74('0x5')});}; \ No newline at end of file +var _0xe1cd=['update','Request','UpdateChatInteraction','updateChatInteraction','addTagsToChatInteraction','../client'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe1cd,0x95));var _0xde1c=function(_0x5bcf32,_0x40f369){_0x5bcf32=_0x5bcf32-0x0;var _0x2138fb=_0xe1cd[_0x5bcf32];return _0x2138fb;};'use strict';var client=require(_0xde1c('0x0'));exports[_0xde1c('0x1')]=function(_0x38341b,_0x3f1197){return client[_0xde1c('0x2')](_0xde1c('0x3'),{'body':_0x3f1197,'options':{'where':{'id':_0x38341b}},'log':_0xde1c('0x4')});};exports['addTags']=function(_0x25cb0b,_0x7a692){return client[_0xde1c('0x2')]('AddTagsToChatInteraction',{'body':_0x7a692,'options':{'where':{'id':_0x25cb0b}},'log':_0xde1c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a6eca61..de71821 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5d8=['Request','CreateChatMessage','createChatMessage'];(function(_0x294665,_0x52347c){var _0x34abea=function(_0x5dbc85){while(--_0x5dbc85){_0x294665['push'](_0x294665['shift']());}};_0x34abea(++_0x52347c);}(_0xe5d8,0x108));var _0x8e5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe5d8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x288f94){return client[_0x8e5d('0x0')](_0x8e5d('0x1'),{'body':_0x288f94,'log':_0x8e5d('0x2')});}; \ No newline at end of file +var _0x00df=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x276809,_0x1f4024){var _0x19ec91=function(_0x21c127){while(--_0x21c127){_0x276809['push'](_0x276809['shift']());}};_0x19ec91(++_0x1f4024);}(_0x00df,0xfa));var _0xf00d=function(_0x18c94e,_0x52e288){_0x18c94e=_0x18c94e-0x0;var _0x1950fa=_0x00df[_0x18c94e];return _0x1950fa;};'use strict';var client=require(_0xf00d('0x0'));exports[_0xf00d('0x1')]=function(_0x27d9d5){return client[_0xf00d('0x2')](_0xf00d('0x3'),{'body':_0x27d9d5,'log':_0xf00d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 831e1eb..85cad66 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9e8=['GetChatQueue','name','timeout','strategy','Agents','online','chatPause','../client','getChatQueues','Request'];(function(_0x381cfc,_0x16bb4e){var _0x4105b3=function(_0x53833d){while(--_0x53833d){_0x381cfc['push'](_0x381cfc['shift']());}};_0x4105b3(++_0x16bb4e);}(_0xe9e8,0x179));var _0x8e9e=function(_0x2702c7,_0x502b3f){_0x2702c7=_0x2702c7-0x0;var _0x299135=_0xe9e8[_0x2702c7];return _0x299135;};'use strict';var client=require(_0x8e9e('0x0'));exports[_0x8e9e('0x1')]=function(){return function(){return client[_0x8e9e('0x2')](_0x8e9e('0x3'),{'options':{'raw':![],'attributes':['id',_0x8e9e('0x4'),_0x8e9e('0x5'),_0x8e9e('0x6')],'include':[{'model':'User','as':_0x8e9e('0x7'),'attributes':['id','name',_0x8e9e('0x8'),_0x8e9e('0x9')]}]},'log':_0x8e9e('0x1')});};}; \ No newline at end of file +var _0xe4b8=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','online','chatPause','../client'];(function(_0x362c06,_0x172c33){var _0x2cddb5=function(_0x4dee97){while(--_0x4dee97){_0x362c06['push'](_0x362c06['shift']());}};_0x2cddb5(++_0x172c33);}(_0xe4b8,0x179));var _0x8e4b=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xe4b8[_0x2e4e19];return _0x9ba20b;};'use strict';var client=require(_0x8e4b('0x0'));exports[_0x8e4b('0x1')]=function(){return function(){return client[_0x8e4b('0x2')](_0x8e4b('0x3'),{'options':{'raw':![],'attributes':['id',_0x8e4b('0x4'),_0x8e4b('0x5'),_0x8e4b('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8e4b('0x4'),_0x8e4b('0x7'),_0x8e4b('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 4105eb1..da4ced5 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb205=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb205,0xf0));var _0x5b20=function(_0x3a8e3d,_0x1fadb3){_0x3a8e3d=_0x3a8e3d-0x0;var _0x1a9206=_0xb205[_0x3a8e3d];return _0x1a9206;};'use strict';var client=require(_0x5b20('0x0'));exports[_0x5b20('0x1')]=function(_0x3edef1){return client[_0x5b20('0x2')](_0x5b20('0x3'),{'body':_0x3edef1,'log':'CreateChatQueueReport'});};exports['update']=function(_0x37fe91,_0x573200){return client[_0x5b20('0x2')](_0x5b20('0x4'),{'body':_0x573200,'options':{'where':{'uniqueid':_0x37fe91},'order':[['id','DESC']],'limit':0x1},'log':_0x5b20('0x4')});}; \ No newline at end of file +var _0xc368=['update','UpdateChatQueueReport','DESC','create','Request','CreateChatQueueReport'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xc368,0x7b));var _0x8c36=function(_0x4f7ed4,_0x26f600){_0x4f7ed4=_0x4f7ed4-0x0;var _0x1bc285=_0xc368[_0x4f7ed4];return _0x1bc285;};'use strict';var client=require('../client');exports[_0x8c36('0x0')]=function(_0x4eaac5){return client[_0x8c36('0x1')](_0x8c36('0x2'),{'body':_0x4eaac5,'log':_0x8c36('0x2')});};exports[_0x8c36('0x3')]=function(_0x288b85,_0x5d3b27){return client[_0x8c36('0x1')](_0x8c36('0x4'),{'body':_0x5d3b27,'options':{'where':{'uniqueid':_0x288b85},'order':[['id',_0x8c36('0x5')]],'limit':0x1},'log':_0x8c36('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 55d2a2a..49b2fc6 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x7a54,0x106));var _0x47a5=function(_0x348226,_0x133a36){_0x348226=_0x348226-0x0;var _0x235d98=_0x7a54[_0x348226];return _0x235d98;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x29938d,_0x4b5e7c){var _0x1ef03f=function(_0x445147){while(--_0x445147){_0x29938d['push'](_0x29938d['shift']());}};_0x1ef03f(++_0x4b5e7c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 008bc37..89e9b2f 100644 --- a/server/services/routing/rpc/faxMessage.js +++ b/server/services/routing/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9532=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x15c70a,_0x111072){var _0x1b3724=function(_0x4ed674){while(--_0x4ed674){_0x15c70a['push'](_0x15c70a['shift']());}};_0x1b3724(++_0x111072);}(_0x9532,0xa1));var _0x2953=function(_0x26a78a,_0x1f7b6c){_0x26a78a=_0x26a78a-0x0;var _0x251e1c=_0x9532[_0x26a78a];return _0x251e1c;};'use strict';var client=require(_0x2953('0x0'));exports[_0x2953('0x1')]=function(_0x5a2656){return client[_0x2953('0x2')](_0x2953('0x3'),{'body':_0x5a2656,'log':_0x2953('0x4')});}; \ No newline at end of file +var _0xa437=['Request','createFaxMessage','../client','create'];(function(_0x251a15,_0xf729b2){var _0x377eed=function(_0x5d6ced){while(--_0x5d6ced){_0x251a15['push'](_0x251a15['shift']());}};_0x377eed(++_0xf729b2);}(_0xa437,0x186));var _0x7a43=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa437[_0xa1e3e3];return _0xc980e9;};'use strict';var client=require(_0x7a43('0x0'));exports[_0x7a43('0x1')]=function(_0xa4db80){return client[_0x7a43('0x2')]('CreateFaxMessage',{'body':_0xa4db80,'log':_0x7a43('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 219be13..c762b6e 100644 --- a/server/services/routing/rpc/faxQueue.js +++ b/server/services/routing/rpc/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd3b=['name','timeout','strategy','online','faxPause','getFaxQueues','../client','Request','GetFaxQueue'];(function(_0x29fefa,_0x3c9ba0){var _0x530b05=function(_0xc21842){while(--_0xc21842){_0x29fefa['push'](_0x29fefa['shift']());}};_0x530b05(++_0x3c9ba0);}(_0xcd3b,0xf0));var _0xbcd3=function(_0x41a116,_0x3256b4){_0x41a116=_0x41a116-0x0;var _0x2f3142=_0xcd3b[_0x41a116];return _0x2f3142;};'use strict';var client=require(_0xbcd3('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xbcd3('0x1')](_0xbcd3('0x2'),{'options':{'raw':![],'attributes':['id',_0xbcd3('0x3'),_0xbcd3('0x4'),_0xbcd3('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xbcd3('0x3'),_0xbcd3('0x6'),_0xbcd3('0x7')]}]},'log':_0xbcd3('0x8')});};}; \ No newline at end of file +var _0xc08c=['User','Agents','online','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0xc08c,0x7b));var _0xcc08=function(_0x1f097d,_0x511f64){_0x1f097d=_0x1f097d-0x0;var _0x5e2cf9=_0xc08c[_0x1f097d];return _0x5e2cf9;};'use strict';var client=require(_0xcc08('0x0'));exports[_0xcc08('0x1')]=function(){return function(){return client[_0xcc08('0x2')](_0xcc08('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc08('0x4'),_0xcc08('0x5'),_0xcc08('0x6')],'include':[{'model':_0xcc08('0x7'),'as':_0xcc08('0x8'),'attributes':['id',_0xcc08('0x4'),_0xcc08('0x9'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d1bd995..0e46d41 100644 --- a/server/services/routing/rpc/faxQueueReport.js +++ b/server/services/routing/rpc/faxQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1762=['create','update','UpdateFaxQueueReport'];(function(_0x43f631,_0x519107){var _0x241582=function(_0x3f3616){while(--_0x3f3616){_0x43f631['push'](_0x43f631['shift']());}};_0x241582(++_0x519107);}(_0x1762,0xf9));var _0x2176=function(_0xeaa2d4,_0x4a6c02){_0xeaa2d4=_0xeaa2d4-0x0;var _0x369794=_0x1762[_0xeaa2d4];return _0x369794;};'use strict';var client=require('../client');exports[_0x2176('0x0')]=function(_0x2d9e97){return client['Request']('CreateFaxQueueReport',{'body':_0x2d9e97,'log':'CreateFaxQueueReport'});};exports[_0x2176('0x1')]=function(_0x583ab4,_0x2e38e6){return client['Request'](_0x2176('0x2'),{'body':_0x2e38e6,'options':{'where':{'uniqueid':_0x583ab4},'order':[['id','DESC']],'limit':0x1},'log':_0x2176('0x2')});}; \ No newline at end of file +var _0xd7f3=['../client','CreateFaxQueueReport','Request','DESC'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd7f3,0x1c8));var _0x3d7f=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0xd7f3[_0x2dfd0e];return _0x343af6;};'use strict';var client=require(_0x3d7f('0x0'));exports['create']=function(_0x1b8ea0){return client['Request'](_0x3d7f('0x1'),{'body':_0x1b8ea0,'log':_0x3d7f('0x1')});};exports['update']=function(_0x546be2,_0x284e5f){return client[_0x3d7f('0x2')]('UpdateFaxQueueReport',{'body':_0x284e5f,'options':{'where':{'uniqueid':_0x546be2},'order':[['id',_0x3d7f('0x3')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 84017c4..f72d0bc 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e99=['getIntervals','Request','Intervals','name','interval','../client'];(function(_0x41e3fe,_0x24c253){var _0x137c21=function(_0x5c9207){while(--_0x5c9207){_0x41e3fe['push'](_0x41e3fe['shift']());}};_0x137c21(++_0x24c253);}(_0x7e99,0xef));var _0x97e9=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x7e99[_0x4fbb86];return _0xb141fe;};'use strict';var client=require(_0x97e9('0x0'));exports[_0x97e9('0x1')]=function(){return function(){return client[_0x97e9('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x97e9('0x3'),'attributes':['id',_0x97e9('0x4'),_0x97e9('0x5')]}]},'log':_0x97e9('0x1')});};}; \ No newline at end of file +var _0x9818=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0xdcb61,_0x3a70b2){var _0xe363d2=function(_0x26e509){while(--_0x26e509){_0xdcb61['push'](_0xdcb61['shift']());}};_0xe363d2(++_0x3a70b2);}(_0x9818,0x13d));var _0x8981=function(_0x4a64a2,_0x5d9152){_0x4a64a2=_0x4a64a2-0x0;var _0x52ef7c=_0x9818[_0x4a64a2];return _0x52ef7c;};'use strict';var client=require(_0x8981('0x0'));exports[_0x8981('0x1')]=function(){return function(){return client[_0x8981('0x2')](_0x8981('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8981('0x4')],'include':[{'model':_0x8981('0x5'),'as':_0x8981('0x6'),'attributes':['id',_0x8981('0x4'),_0x8981('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f19e908..a8937cd 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7096=['AddTagsToMailInteraction','addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x7096,0x10c));var _0x6709=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x7096[_0x3ff085];return _0x2b68c3;};'use strict';var client=require('../client');exports[_0x6709('0x0')]=function(_0x5035b7,_0x253760){return client['Request'](_0x6709('0x1'),{'body':_0x253760,'options':{'where':{'id':_0x5035b7}},'log':_0x6709('0x2')});};exports[_0x6709('0x3')]=function(_0xccdcb5,_0x3cd087){return client[_0x6709('0x4')](_0x6709('0x5'),{'body':_0x3cd087,'options':{'where':{'id':_0xccdcb5}},'log':_0x6709('0x6')});}; \ No newline at end of file +var _0x47c5=['UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request'];(function(_0x23efa3,_0x4b3c37){var _0x246443=function(_0x582874){while(--_0x582874){_0x23efa3['push'](_0x23efa3['shift']());}};_0x246443(++_0x4b3c37);}(_0x47c5,0x165));var _0x547c=function(_0x5b6553,_0x2526c4){_0x5b6553=_0x5b6553-0x0;var _0x5c9e87=_0x47c5[_0x5b6553];return _0x5c9e87;};'use strict';var client=require(_0x547c('0x0'));exports[_0x547c('0x1')]=function(_0x2b2280,_0x123697){return client[_0x547c('0x2')](_0x547c('0x3'),{'body':_0x123697,'options':{'where':{'id':_0x2b2280}},'log':'updateMailInteraction'});};exports[_0x547c('0x4')]=function(_0x16f4db,_0x5b48c9){return client[_0x547c('0x2')](_0x547c('0x5'),{'body':_0x5b48c9,'options':{'where':{'id':_0x16f4db}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 50f1f96..71acf63 100644 --- a/server/services/routing/rpc/mailMessage.js +++ b/server/services/routing/rpc/mailMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fa7=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0x1fa7,0x6a));var _0x71fa=function(_0x876fa4,_0x2c03ad){_0x876fa4=_0x876fa4-0x0;var _0x2f11f5=_0x1fa7[_0x876fa4];return _0x2f11f5;};'use strict';var client=require(_0x71fa('0x0'));exports[_0x71fa('0x1')]=function(_0x3debd0){return client[_0x71fa('0x2')](_0x71fa('0x3'),{'body':_0x3debd0,'log':_0x71fa('0x4')});}; \ No newline at end of file +var _0x144c=['../client','create','Request','CreateMailMessage'];(function(_0x563169,_0x10d4cb){var _0x5612b8=function(_0x1b0acb){while(--_0x1b0acb){_0x563169['push'](_0x563169['shift']());}};_0x5612b8(++_0x10d4cb);}(_0x144c,0xf8));var _0xc144=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x144c[_0x5d30b4];return _0x1acfb8;};'use strict';var client=require(_0xc144('0x0'));exports[_0xc144('0x1')]=function(_0x697f5e){return client[_0xc144('0x2')](_0xc144('0x3'),{'body':_0x697f5e,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 11e91d5..06bc7cb 100644 --- a/server/services/routing/rpc/mailQueue.js +++ b/server/services/routing/rpc/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3718=['User','Agents','online','mailPause','../client','getMailQueues','Request','name','timeout','strategy'];(function(_0x4824de,_0x4594af){var _0x4b62de=function(_0x4af8c0){while(--_0x4af8c0){_0x4824de['push'](_0x4824de['shift']());}};_0x4b62de(++_0x4594af);}(_0x3718,0x1b2));var _0x8371=function(_0x2786f7,_0x170226){_0x2786f7=_0x2786f7-0x0;var _0x1dad97=_0x3718[_0x2786f7];return _0x1dad97;};'use strict';var client=require(_0x8371('0x0'));exports[_0x8371('0x1')]=function(){return function(){return client[_0x8371('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x8371('0x3'),_0x8371('0x4'),_0x8371('0x5')],'include':[{'model':_0x8371('0x6'),'as':_0x8371('0x7'),'attributes':['id',_0x8371('0x3'),_0x8371('0x8'),_0x8371('0x9')]}]},'log':_0x8371('0x1')});};}; \ No newline at end of file +var _0x29a8=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','Agents','online'];(function(_0x47473d,_0x19d14d){var _0x2abf6a=function(_0x12e143){while(--_0x12e143){_0x47473d['push'](_0x47473d['shift']());}};_0x2abf6a(++_0x19d14d);}(_0x29a8,0x97));var _0x829a=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x29a8[_0x8dc04d];return _0x2f5f28;};'use strict';var client=require(_0x829a('0x0'));exports[_0x829a('0x1')]=function(){return function(){return client[_0x829a('0x2')](_0x829a('0x3'),{'options':{'raw':![],'attributes':['id',_0x829a('0x4'),_0x829a('0x5'),_0x829a('0x6')],'include':[{'model':'User','as':_0x829a('0x7'),'attributes':['id',_0x829a('0x4'),_0x829a('0x8'),_0x829a('0x9')]}]},'log':_0x829a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3111991..86a5f1d 100644 --- a/server/services/routing/rpc/mailQueueReport.js +++ b/server/services/routing/rpc/mailQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22ff=['DESC','../client','create','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x33491b,_0x747609){var _0x44ee94=function(_0x4d4429){while(--_0x4d4429){_0x33491b['push'](_0x33491b['shift']());}};_0x44ee94(++_0x747609);}(_0x22ff,0xb5));var _0xf22f=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0x22ff[_0x4a73dd];return _0x279e6b;};'use strict';var client=require(_0xf22f('0x0'));exports[_0xf22f('0x1')]=function(_0x1a489d){return client['Request'](_0xf22f('0x2'),{'body':_0x1a489d,'log':_0xf22f('0x2')});};exports['update']=function(_0x23ec40,_0x177554){return client['Request'](_0xf22f('0x3'),{'body':_0x177554,'options':{'where':{'uniqueid':_0x23ec40},'order':[['id',_0xf22f('0x4')]],'limit':0x1},'log':_0xf22f('0x3')});}; \ No newline at end of file +var _0xa509=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x20d733,_0x109041){var _0x3f363d=function(_0x1a00de){while(--_0x1a00de){_0x20d733['push'](_0x20d733['shift']());}};_0x3f363d(++_0x109041);}(_0xa509,0x153));var _0x9a50=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa509[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x9a50('0x0'));exports[_0x9a50('0x1')]=function(_0x2aaf64){return client[_0x9a50('0x2')]('CreateMailQueueReport',{'body':_0x2aaf64,'log':_0x9a50('0x3')});};exports[_0x9a50('0x4')]=function(_0x4be203,_0x12faa4){return client['Request'](_0x9a50('0x5'),{'body':_0x12faa4,'options':{'where':{'uniqueid':_0x4be203},'order':[['id',_0x9a50('0x6')]],'limit':0x1},'log':_0x9a50('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 348daa7..7c6358b 100644 --- a/server/services/routing/rpc/openchannelInteraction.js +++ b/server/services/routing/rpc/openchannelInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd991=['UpdateOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x1028bd,_0x414515){var _0x42ad6b=function(_0x283d7c){while(--_0x283d7c){_0x1028bd['push'](_0x1028bd['shift']());}};_0x42ad6b(++_0x414515);}(_0xd991,0xb6));var _0x1d99=function(_0x4aa1c2,_0x56eb59){_0x4aa1c2=_0x4aa1c2-0x0;var _0x92ed5b=_0xd991[_0x4aa1c2];return _0x92ed5b;};'use strict';var client=require(_0x1d99('0x0'));exports[_0x1d99('0x1')]=function(_0x30747a,_0x6dc926){return client[_0x1d99('0x2')](_0x1d99('0x3'),{'body':_0x6dc926,'options':{'where':{'id':_0x30747a}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x502bcd,_0x297f55){return client[_0x1d99('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x297f55,'options':{'where':{'id':_0x502bcd}},'log':_0x1d99('0x4')});}; \ No newline at end of file +var _0x55d0=['Request','addTagsToChatInteraction','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55d0,0x74));var _0x055d=function(_0x15f426,_0x3eaae4){_0x15f426=_0x15f426-0x0;var _0x1318e6=_0x55d0[_0x15f426];return _0x1318e6;};'use strict';var client=require('../client');exports[_0x055d('0x0')]=function(_0x1c0338,_0x1581cc){return client[_0x055d('0x1')]('UpdateOpenchannelInteraction',{'body':_0x1581cc,'options':{'where':{'id':_0x1c0338}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x3f9c4c,_0x5cc5e9){return client[_0x055d('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x5cc5e9,'options':{'where':{'id':_0x3f9c4c}},'log':_0x055d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 50a5035..5aba280 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49a5=['createOpenchannelMessage','create','Request'];(function(_0x5b5be8,_0x5219df){var _0x60220e=function(_0x2859cf){while(--_0x2859cf){_0x5b5be8['push'](_0x5b5be8['shift']());}};_0x60220e(++_0x5219df);}(_0x49a5,0x16c));var _0x549a=function(_0xbae391,_0x498a88){_0xbae391=_0xbae391-0x0;var _0x1ba6d0=_0x49a5[_0xbae391];return _0x1ba6d0;};'use strict';var client=require('../client');exports[_0x549a('0x0')]=function(_0xac7428){return client[_0x549a('0x1')]('CreateOpenchannelMessage',{'body':_0xac7428,'log':_0x549a('0x2')});}; \ No newline at end of file +var _0x1f8f=['createOpenchannelMessage','../client','create','CreateOpenchannelMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f8f,0x1b1));var _0xf1f8=function(_0x42c9ea,_0x55fc3a){_0x42c9ea=_0x42c9ea-0x0;var _0x40e25e=_0x1f8f[_0x42c9ea];return _0x40e25e;};'use strict';var client=require(_0xf1f8('0x0'));exports[_0xf1f8('0x1')]=function(_0x3ef461){return client['Request'](_0xf1f8('0x2'),{'body':_0x3ef461,'log':_0xf1f8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8236535..3d38fad 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12ee=['Agents','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x12ee,0x1a3));var _0xe12e=function(_0x589c8b,_0x45e782){_0x589c8b=_0x589c8b-0x0;var _0x5bede1=_0x12ee[_0x589c8b];return _0x5bede1;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xe12e('0x0')](_0xe12e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xe12e('0x2'),_0xe12e('0x3')],'include':[{'model':_0xe12e('0x4'),'as':_0xe12e('0x5'),'attributes':['id','name','online',_0xe12e('0x6')]}]},'log':_0xe12e('0x7')});};}; \ No newline at end of file +var _0x6dae=['getOpenchannelQueues','Request','name','strategy','openchannelPause'];(function(_0x347840,_0x3b2f5c){var _0x497617=function(_0x162ecd){while(--_0x162ecd){_0x347840['push'](_0x347840['shift']());}};_0x497617(++_0x3b2f5c);}(_0x6dae,0x91));var _0xe6da=function(_0x1d1075,_0x37aa65){_0x1d1075=_0x1d1075-0x0;var _0x27c56a=_0x6dae[_0x1d1075];return _0x27c56a;};'use strict';var client=require('../client');exports[_0xe6da('0x0')]=function(){return function(){return client[_0xe6da('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xe6da('0x2'),'timeout',_0xe6da('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xe6da('0x4')]}]},'log':_0xe6da('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3b3a92a..62c5dcc 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c8e=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3c8e,0xf3));var _0xe3c8=function(_0x4f47e1,_0x1d75ea){_0x4f47e1=_0x4f47e1-0x0;var _0xb3a84d=_0x3c8e[_0x4f47e1];return _0xb3a84d;};'use strict';var client=require(_0xe3c8('0x0'));exports[_0xe3c8('0x1')]=function(_0x3c416e){return client[_0xe3c8('0x2')](_0xe3c8('0x3'),{'body':_0x3c416e,'log':'CreateOpenchannelQueueReport'});};exports[_0xe3c8('0x4')]=function(_0x29834a,_0x4e05cf){return client[_0xe3c8('0x2')](_0xe3c8('0x5'),{'body':_0x4e05cf,'options':{'where':{'uniqueid':_0x29834a},'order':[['id',_0xe3c8('0x6')]],'limit':0x1},'log':_0xe3c8('0x5')});}; \ No newline at end of file +var _0x7403=['../client','create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport'];(function(_0x1477fa,_0x269406){var _0x4552d3=function(_0x252700){while(--_0x252700){_0x1477fa['push'](_0x1477fa['shift']());}};_0x4552d3(++_0x269406);}(_0x7403,0xc0));var _0x3740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7403[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3740('0x0'));exports[_0x3740('0x1')]=function(_0x1f6c4f){return client['Request'](_0x3740('0x2'),{'body':_0x1f6c4f,'log':_0x3740('0x2')});};exports[_0x3740('0x3')]=function(_0x1bd3ee,_0x48c094){return client[_0x3740('0x4')](_0x3740('0x5'),{'body':_0x48c094,'options':{'where':{'uniqueid':_0x1bd3ee},'order':[['id','DESC']],'limit':0x1},'log':_0x3740('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c968ae1..66b146f 100644 --- a/server/services/routing/rpc/smsInteraction.js +++ b/server/services/routing/rpc/smsInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9879=['Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0x9879,0x98));var _0x9987=function(_0x3aeb7a,_0xb4261f){_0x3aeb7a=_0x3aeb7a-0x0;var _0x373b9d=_0x9879[_0x3aeb7a];return _0x373b9d;};'use strict';var client=require(_0x9987('0x0'));exports[_0x9987('0x1')]=function(_0x44026e,_0x5681f5){return client[_0x9987('0x2')]('UpdateSmsInteraction',{'body':_0x5681f5,'options':{'where':{'id':_0x44026e}},'log':_0x9987('0x3')});};exports[_0x9987('0x4')]=function(_0x1fd45d,_0xcc5722){return client[_0x9987('0x2')](_0x9987('0x5'),{'body':_0xcc5722,'options':{'where':{'id':_0x1fd45d}},'log':_0x9987('0x6')});}; \ No newline at end of file +var _0xaa19=['AddTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags','Request'];(function(_0x521e8d,_0x23a290){var _0x518bbd=function(_0x4241eb){while(--_0x4241eb){_0x521e8d['push'](_0x521e8d['shift']());}};_0x518bbd(++_0x23a290);}(_0xaa19,0x79));var _0x9aa1=function(_0x5e932e,_0x1d6235){_0x5e932e=_0x5e932e-0x0;var _0x1bf62a=_0xaa19[_0x5e932e];return _0x1bf62a;};'use strict';var client=require(_0x9aa1('0x0'));exports[_0x9aa1('0x1')]=function(_0xa7aed3,_0xbd787f){return client['Request'](_0x9aa1('0x2'),{'body':_0xbd787f,'options':{'where':{'id':_0xa7aed3}},'log':'updateSmsInteraction'});};exports[_0x9aa1('0x3')]=function(_0x58fb46,_0x11fd1b){return client[_0x9aa1('0x4')](_0x9aa1('0x5'),{'body':_0x11fd1b,'options':{'where':{'id':_0x58fb46}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d2e2422..bb97814 100644 --- a/server/services/routing/rpc/smsMessage.js +++ b/server/services/routing/rpc/smsMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x031c=['../client','create','Request'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x031c,0xed));var _0xc031=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x031c[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xc031('0x0'));exports[_0xc031('0x1')]=function(_0x5da614){return client[_0xc031('0x2')]('CreateSmsMessage',{'body':_0x5da614,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xa4f1=['../client','create'];(function(_0x4d799c,_0x272b32){var _0x1837ea=function(_0x15f9b4){while(--_0x15f9b4){_0x4d799c['push'](_0x4d799c['shift']());}};_0x1837ea(++_0x272b32);}(_0xa4f1,0x84));var _0x1a4f=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xa4f1[_0x1deb03];return _0x189fe7;};'use strict';var client=require(_0x1a4f('0x0'));exports[_0x1a4f('0x1')]=function(_0x52a6aa){return client['Request']('CreateSmsMessage',{'body':_0x52a6aa,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 125e1ca..d018c3c 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x1adeaf,_0x44f47b){var _0x382106=function(_0x362fa2){while(--_0x362fa2){_0x1adeaf['push'](_0x1adeaf['shift']());}};_0x382106(++_0x44f47b);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x5cb0f9,_0x4a6cba){var _0x1b9092=function(_0x1b6eae){while(--_0x1b6eae){_0x5cb0f9['push'](_0x5cb0f9['shift']());}};_0x1b9092(++_0x4a6cba);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 013b133..37c11a8 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x4f0f47,_0x9799c9){var _0x2d3af8=function(_0x446775){while(--_0x446775){_0x4f0f47['push'](_0x4f0f47['shift']());}};_0x2d3af8(++_0x9799c9);}(_0x3e74,0x175));var _0x43e7=function(_0x2e4c82,_0x497c1d){_0x2e4c82=_0x2e4c82-0x0;var _0x849502=_0x3e74[_0x2e4c82];return _0x849502;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x48071b,_0x3943f3){var _0x38c935=function(_0x4a752e){while(--_0x4a752e){_0x48071b['push'](_0x48071b['shift']());}};_0x38c935(++_0x3943f3);}(_0x55ca,0x126));var _0xa55c=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0x55ca[_0x60878f];return _0x1fbefb;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 03be06e..15e1293 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x266c16,_0xf3947d){var _0x2a8fd0=function(_0x13b990){while(--_0x13b990){_0x266c16['push'](_0x266c16['shift']());}};_0x2a8fd0(++_0xf3947d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3362f3,_0x2af0bc){var _0x57be75=function(_0x43eed8){while(--_0x43eed8){_0x3362f3['push'](_0x3362f3['shift']());}};_0x57be75(++_0x2af0bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index eebe9b5..393a73e 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c46=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction','addTags'];(function(_0x733dbc,_0x1cc6db){var _0x5a99ad=function(_0x365e03){while(--_0x365e03){_0x733dbc['push'](_0x733dbc['shift']());}};_0x5a99ad(++_0x1cc6db);}(_0x8c46,0x171));var _0x68c4=function(_0x40dd31,_0x4a887a){_0x40dd31=_0x40dd31-0x0;var _0x2da8de=_0x8c46[_0x40dd31];return _0x2da8de;};'use strict';var client=require(_0x68c4('0x0'));exports['update']=function(_0x51f442,_0x3e1613){return client['Request']('UpdateWhatsappInteraction',{'body':_0x3e1613,'options':{'where':{'id':_0x51f442}},'log':_0x68c4('0x1')});};exports[_0x68c4('0x2')]=function(_0x1837ee,_0x1e3662){return client[_0x68c4('0x3')](_0x68c4('0x4'),{'body':_0x1e3662,'options':{'where':{'id':_0x1837ee}},'log':_0x68c4('0x5')});}; \ No newline at end of file +var _0x1c3b=['addTags','Request','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1c3b,0xab));var _0xb1c3=function(_0x3b20c2,_0x2f129e){_0x3b20c2=_0x3b20c2-0x0;var _0x1a3707=_0x1c3b[_0x3b20c2];return _0x1a3707;};'use strict';var client=require(_0xb1c3('0x0'));exports[_0xb1c3('0x1')]=function(_0x2724bd,_0x4f3ef7){return client['Request'](_0xb1c3('0x2'),{'body':_0x4f3ef7,'options':{'where':{'id':_0x2724bd}},'log':_0xb1c3('0x3')});};exports[_0xb1c3('0x4')]=function(_0x34dbb5,_0x24d4c0){return client[_0xb1c3('0x5')]('AddTagsToWhatsappInteraction',{'body':_0x24d4c0,'options':{'where':{'id':_0x34dbb5}},'log':_0xb1c3('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index cd46c4c..e8f5c35 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cae=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x1ac5c3,_0x5049c6){var _0x271782=function(_0x5e9507){while(--_0x5e9507){_0x1ac5c3['push'](_0x1ac5c3['shift']());}};_0x271782(++_0x5049c6);}(_0x9cae,0x82));var _0xe9ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9cae[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xe9ca('0x0'));exports[_0xe9ca('0x1')]=function(_0x31bcf5){return client[_0xe9ca('0x2')](_0xe9ca('0x3'),{'body':_0x31bcf5,'log':_0xe9ca('0x4')});}; \ No newline at end of file +var _0x9d49=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x5ef427,_0x58f2ae){var _0x17df58=function(_0x4db8a4){while(--_0x4db8a4){_0x5ef427['push'](_0x5ef427['shift']());}};_0x17df58(++_0x58f2ae);}(_0x9d49,0x106));var _0x99d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d49[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x99d4('0x0')]=function(_0x353e1a){return client[_0x99d4('0x1')](_0x99d4('0x2'),{'body':_0x353e1a,'log':_0x99d4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 278d116..f96d71a 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x103d=['whatsappPause','getWhatsappQueues','Request','name','timeout','strategy','Agents','online'];(function(_0x11a485,_0x44430f){var _0x19308b=function(_0x337eb6){while(--_0x337eb6){_0x11a485['push'](_0x11a485['shift']());}};_0x19308b(++_0x44430f);}(_0x103d,0x92));var _0xd103=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x103d[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xd103('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xd103('0x1'),_0xd103('0x2'),_0xd103('0x3')],'include':[{'model':'User','as':_0xd103('0x4'),'attributes':['id','name',_0xd103('0x5'),_0xd103('0x6')]}]},'log':_0xd103('0x7')});};}; \ No newline at end of file +var _0xe0c3=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0xe0c3,0xc3));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x3e0c('0x0'));exports[_0x3e0c('0x1')]=function(){return function(){return client[_0x3e0c('0x2')](_0x3e0c('0x3'),{'options':{'raw':![],'attributes':['id',_0x3e0c('0x4'),_0x3e0c('0x5'),_0x3e0c('0x6')],'include':[{'model':_0x3e0c('0x7'),'as':_0x3e0c('0x8'),'attributes':['id',_0x3e0c('0x4'),_0x3e0c('0x9'),_0x3e0c('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c3b8b4f..9cdf2c0 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11a3=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x307e15,_0x2d1c7a){var _0x1e202c=function(_0x4572bc){while(--_0x4572bc){_0x307e15['push'](_0x307e15['shift']());}};_0x1e202c(++_0x2d1c7a);}(_0x11a3,0x102));var _0x311a=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x11a3[_0x57add2];return _0x4e3670;};'use strict';var client=require(_0x311a('0x0'));exports[_0x311a('0x1')]=function(_0x205881){return client[_0x311a('0x2')](_0x311a('0x3'),{'body':_0x205881,'log':_0x311a('0x3')});};exports['update']=function(_0x3760b3,_0x2d0eb4){return client[_0x311a('0x2')](_0x311a('0x4'),{'body':_0x2d0eb4,'options':{'where':{'uniqueid':_0x3760b3},'order':[['id',_0x311a('0x5')]],'limit':0x1},'log':_0x311a('0x4')});}; \ No newline at end of file +var _0x3de2=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC','create'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x3de2,0x1bb));var _0x23de=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3de2[_0x29d94e];return _0x106237;};'use strict';var client=require('../client');exports[_0x23de('0x0')]=function(_0x204882){return client['Request']('CreateWhatsappQueueReport',{'body':_0x204882,'log':_0x23de('0x1')});};exports[_0x23de('0x2')]=function(_0x343503,_0x422971){return client[_0x23de('0x3')](_0x23de('0x4'),{'body':_0x422971,'options':{'where':{'uniqueid':_0x343503},'order':[['id',_0x23de('0x5')]],'limit':0x1},'log':_0x23de('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 592216e..3193aa0 100644 --- a/server/services/routing/server/applications/agent.js +++ b/server/services/routing/server/applications/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc6c=['length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','name','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcc6c,0xd2));var _0xccc6=function(_0x147722,_0xc11358){_0x147722=_0x147722-0x0;var _0x39bbca=_0xcc6c[_0x147722];return _0x39bbca;};'use strict';var schema=require(_0xccc6('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0xccc6('0x1'));var logger=require(_0xccc6('0x2'))(_0xccc6('0x3'));var strategy=require(_0xccc6('0x4'));var queue=schema({'name':{'type':_0xccc6('0x5'),'required':!![],'message':_0xccc6('0x6')},'timeout':{'type':'number','message':_0xccc6('0x7')}});function writeLog(_0x5be9b9,_0x165b66,_0x18872b){return logger['info'](util[_0xccc6('0x8')](_0xccc6('0x9'),_0x5be9b9,_0x165b66['name'],_0x18872b));}function handleFindAgent(_0x11f957){return function(_0x2d58fb){return _0x2d58fb['name']['toLowerCase']()===_0x11f957[_0xccc6('0xa')]();};}exports[_0xccc6('0xb')]=function(_0x2acb09,_0x1735c3,_0x53fa01,_0x14c13b){return function(_0x44fcab){try{var _0x2f3366={'name':_0x1735c3[0x0],'timeout':_0x1735c3[0x1]};var _0x1f45ce=queue['validate'](_0x2f3366,{'typecast':!![]});if(_0x1f45ce[_0xccc6('0xc')]){logger[_0xccc6('0xd')](_0xccc6('0xe'),_0x2acb09,_[_0xccc6('0xf')](_0x1f45ce,_0xccc6('0x10'))[_0xccc6('0x11')](',\x20'));_0x44fcab[_0xccc6('0x12')]();}else{var _0x539b85=_[_0xccc6('0x13')](_0x53fa01[_0xccc6('0x14')],handleFindAgent(_0x2f3366[_0xccc6('0x15')]));if(_0x539b85){var _0x1eb3d9=(_0x2f3366[_0xccc6('0x16')]||0xa)*0x3e8;var _0x2b6e09,_0x423ac3;var _0x2b6d20=seqqueue['createQueue'](_0x1eb3d9);_0x2b6d20['id']=_0x2acb09;_0x2b6d20[_0xccc6('0x17')]=_0x1eb3d9;_0x2b6d20[_0xccc6('0x18')]=_0x14c13b[_0xccc6('0x18')];writeLog(_0x2acb09,_0x539b85,util['format'](_0xccc6('0x19'),_0x1eb3d9));_0x53fa01[_0xccc6('0x1a')][_0x2acb09]['on'](_0xccc6('0x1b'),function(){logger['info'](_0xccc6('0x1c'),_0x2acb09);clearTimeout(_0x423ac3);_0x423ac3=undefined;_0x2b6d20[_0xccc6('0x1d')]();if(_0x53fa01[_0xccc6('0x1a')][_0x2acb09]){delete _0x53fa01[_0xccc6('0x1a')][_0x2acb09];}_0x44fcab[_0xccc6('0x12')]();});_0x53fa01[_0xccc6('0x1a')][_0x2acb09]['on']('complete',function(){if(_0x53fa01['rules'][_0x2acb09]){delete _0x53fa01[_0xccc6('0x1a')][_0x2acb09];}});_0x423ac3=setTimeout(function(){logger[_0xccc6('0x1e')](_0xccc6('0x1f'),_0x2acb09);clearTimeout(_0x423ac3);_0x2b6d20['close']();_0x44fcab[_0xccc6('0x20')]();},_0x1eb3d9);strategy[_0xccc6('0x21')](_0x2b6d20,_0x539b85,_0x53fa01,_0x14c13b);}else{logger['error'](_0xccc6('0x22'),_0x2acb09,_0x2f3366['name']);_0x44fcab[_0xccc6('0x12')]();}}}catch(_0x4b0a85){console[_0xccc6('0x23')](_0x4b0a85);logger['error']('[%s][QUEUE]\x20%s',_0x2acb09,_0x4b0a85[_0xccc6('0x24')]);_0x44fcab[_0xccc6('0x12')]();}};}; \ No newline at end of file +var _0x850d=['length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','atimeout','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence'];(function(_0x216154,_0x158a93){var _0x18d301=function(_0x1c8848){while(--_0x1c8848){_0x216154['push'](_0x216154['shift']());}};_0x18d301(++_0x158a93);}(_0x850d,0x140));var _0xd850=function(_0x7fb404,_0x35907e){_0x7fb404=_0x7fb404-0x0;var _0x14d9c1=_0x850d[_0x7fb404];return _0x14d9c1;};'use strict';var schema=require(_0xd850('0x0'));var _=require(_0xd850('0x1'));var util=require('util');var seqqueue=require(_0xd850('0x2'));var logger=require(_0xd850('0x3'))(_0xd850('0x4'));var strategy=require(_0xd850('0x5'));var queue=schema({'name':{'type':_0xd850('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xd850('0x7'),'message':_0xd850('0x8')}});function writeLog(_0x22b0a9,_0x252eae,_0xce97dc){return logger[_0xd850('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x22b0a9,_0x252eae[_0xd850('0xa')],_0xce97dc));}function handleFindAgent(_0x118397){return function(_0x2c6b99){return _0x2c6b99[_0xd850('0xa')][_0xd850('0xb')]()===_0x118397[_0xd850('0xb')]();};}exports[_0xd850('0xc')]=function(_0x200662,_0x4df000,_0x46ea72,_0x1e0e15){return function(_0x9ef803){try{var _0x2bde04={'name':_0x4df000[0x0],'timeout':_0x4df000[0x1]};var _0x223a0b=queue[_0xd850('0x0')](_0x2bde04,{'typecast':!![]});if(_0x223a0b[_0xd850('0xd')]){logger[_0xd850('0xe')](_0xd850('0xf'),_0x200662,_[_0xd850('0x10')](_0x223a0b,_0xd850('0x11'))[_0xd850('0x12')](',\x20'));_0x9ef803['stop']();}else{var _0x48098d=_[_0xd850('0x13')](_0x46ea72[_0xd850('0x14')],handleFindAgent(_0x2bde04[_0xd850('0xa')]));if(_0x48098d){var _0xa0f5d7=(_0x2bde04[_0xd850('0x15')]||0xa)*0x3e8;var _0xbcb5ef,_0x577637;var _0x2aecdb=seqqueue['createQueue'](_0xa0f5d7);_0x2aecdb['id']=_0x200662;_0x2aecdb[_0xd850('0x16')]=_0xa0f5d7;_0x2aecdb[_0xd850('0x17')]=_0x1e0e15['channel'];writeLog(_0x200662,_0x48098d,util[_0xd850('0x18')](_0xd850('0x19'),_0xa0f5d7));_0x46ea72[_0xd850('0x1a')][_0x200662]['on']('end',function(){logger['info'](_0xd850('0x1b'),_0x200662);clearTimeout(_0x577637);_0x577637=undefined;_0x2aecdb[_0xd850('0x1c')]();if(_0x46ea72[_0xd850('0x1a')][_0x200662]){delete _0x46ea72[_0xd850('0x1a')][_0x200662];}_0x9ef803[_0xd850('0x1d')]();});_0x46ea72[_0xd850('0x1a')][_0x200662]['on'](_0xd850('0x1e'),function(){if(_0x46ea72[_0xd850('0x1a')][_0x200662]){delete _0x46ea72[_0xd850('0x1a')][_0x200662];}});_0x577637=setTimeout(function(){logger[_0xd850('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x200662);clearTimeout(_0x577637);_0x2aecdb[_0xd850('0x1c')]();_0x9ef803[_0xd850('0x1f')]();},_0xa0f5d7);strategy[_0xd850('0x20')](_0x2aecdb,_0x48098d,_0x46ea72,_0x1e0e15);}else{logger['error'](_0xd850('0x21'),_0x200662,_0x2bde04['name']);_0x9ef803[_0xd850('0x1d')]();}}}catch(_0x2e075f){console[_0xd850('0x22')](_0x2e075f);logger[_0xd850('0xe')](_0xd850('0x23'),_0x200662,_0x2e075f[_0xd850('0x24')]);_0x9ef803[_0xd850('0x1d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 96d7f16..545d6cb 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0f=['error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','message','amazonlex','providerName','providerResponse','stringify','create','dialogState','Failed','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','then','body','catch'];(function(_0x3104f5,_0x5d84b2){var _0x49cf84=function(_0x143845){while(--_0x143845){_0x3104f5['push'](_0x3104f5['shift']());}};_0x49cf84(++_0x5d84b2);}(_0xef0f,0x9b));var _0xfef0=function(_0x254061,_0x284e6e){_0x254061=_0x254061-0x0;var _0x528a9f=_0xef0f[_0x254061];return _0x528a9f;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xfef0('0x0'));var utils=require(_0xfef0('0x1'));var logger=require(_0xfef0('0x2'))(_0xfef0('0x3'));var rpc={'chatMessage':require(_0xfef0('0x4')),'openchannelMessage':require(_0xfef0('0x5')),'mailMessage':require(_0xfef0('0x6')),'smsMessage':require(_0xfef0('0x7')),'faxMessage':require(_0xfef0('0x8')),'whatsappMessage':require(_0xfef0('0x9'))};exports[_0xfef0('0xa')]=function(_0x41206d,_0x343fce){return function(_0x5cf8a9){try{if(!_['isNil'](this[_0xfef0('0xb')]['UserId'])){logger[_0xfef0('0xc')](_0xfef0('0xd'),_0x41206d,_0xfef0('0xe'));return _0x5cf8a9[_0xfef0('0xf')]();}var _0x183715={'ContactId':this[_0xfef0('0x10')]['id'],'sentAt':moment()[_0xfef0('0x11')](_0xfef0('0x12')),'direction':'out'};if(this[_0xfef0('0x13')]==='sms'||this[_0xfef0('0x13')]===_0xfef0('0x14')){_0x183715[_0xfef0('0x15')]=this[_0xfef0('0xb')][_0xfef0('0x15')];}var _0x348fe7=this['channel'];if(_0x348fe7==='chat'){_0x183715[_0xfef0('0x16')]=this[_0xfef0('0x17')]['id'];}else{_0x183715[_[_0xfef0('0x18')](_0x348fe7)+_0xfef0('0x19')]=this['account']['id'];}_0x183715[_[_0xfef0('0x18')](_0x348fe7)+_0xfef0('0x1a')]=this[_0xfef0('0xb')]['id'];if(this[_0xfef0('0xb')][_0xfef0('0x1b')]){var _0xae8f61=_0x343fce[0x4];if(!_['isEmpty'](_0xae8f61)){_0x183715['body']=utils[_0xfef0('0x1c')](_0xae8f61,this);return rpc[_0x348fe7+_0xfef0('0x1d')]['create'](_0x183715)[_0xfef0('0x1e')](function(_0x4f3f04){logger[_0xfef0('0xc')](_0xfef0('0xd'),_0x41206d,_0x183715[_0xfef0('0x1f')]);})[_0xfef0('0x20')](function(_0x434788){logger[_0xfef0('0x21')]('[%s][AMAZONLEX]\x20%s',_0x41206d,JSON['stringify'](_0x434788));})['finally'](function(){logger['info'](_0xfef0('0x22'),_0x41206d);_0x5cf8a9[_0xfef0('0x23')]();});}else{logger['info'](_0xfef0('0x24'),_0x41206d);_0x5cf8a9['stop']();}}else{var _0x20b260=this;var _0x155b4a=new AWS[(_0xfef0('0x25'))]({'accessKeyId':_0x343fce[0x0],'secretAccessKey':_0x343fce[0x1],'region':_0x343fce[0x2]});var _0x58ef0f={'botAlias':'$LATEST','botName':_0x343fce[0x3],'inputText':this['message'][_0xfef0('0x1f')],'userId':this[_0xfef0('0x13')]+':'+this[_0xfef0('0xb')]['id'][_0xfef0('0x26')]()};_0x155b4a['postText'](_0x58ef0f,function(_0x1e1917,_0x4b1e2c){if(_0x1e1917){logger[_0xfef0('0x21')](_0xfef0('0xd'),_0x41206d,_0x1e1917[_0xfef0('0x27')]);_0x5cf8a9['next']();}else if(_0x4b1e2c&&_0x4b1e2c[_0xfef0('0x27')]){_0x20b260['body'][_0xfef0('0x28')]=_0x4b1e2c;_0x183715['body']=_0x4b1e2c[_0xfef0('0x27')];_0x183715[_0xfef0('0x29')]='amazonlex';_0x183715[_0xfef0('0x2a')]=JSON[_0xfef0('0x2b')](_0x4b1e2c);return rpc[_0x348fe7+_0xfef0('0x1d')][_0xfef0('0x2c')](_0x183715)[_0xfef0('0x1e')](function(_0x4ec491){logger[_0xfef0('0xc')](_0xfef0('0xd'),_0x41206d,_0x183715['body']);if(_0x4b1e2c[_0xfef0('0x2d')]==_0xfef0('0x2e')){_0x5cf8a9[_0xfef0('0xf')]();}else{_0x5cf8a9[_0xfef0('0x23')]();}})[_0xfef0('0x20')](function(_0x7d9d84){logger['error']('[%s][AMAZONLEX]\x20%s',_0x41206d,JSON[_0xfef0('0x2b')](_0x7d9d84));_0x5cf8a9['next']();});}else{_0x5cf8a9['next']();}});}}catch(_0x19bbd4){logger[_0xfef0('0x21')](_0xfef0('0xd'),_0x41206d,JSON['stringify'](_0x19bbd4));_0x5cf8a9[_0xfef0('0x23')]();}};}; \ No newline at end of file +var _0x8a7b=['$LATEST','message','toString','postText','amazonlex','providerResponse','dialogState','Failed','stop','error','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime'];(function(_0x41c31b,_0xdda69e){var _0x356ace=function(_0x7f680d){while(--_0x7f680d){_0x41c31b['push'](_0x41c31b['shift']());}};_0x356ace(++_0xdda69e);}(_0x8a7b,0x1b2));var _0xb8a7=function(_0xf2ee56,_0x565642){_0xf2ee56=_0xf2ee56-0x0;var _0x2b9bc9=_0x8a7b[_0xf2ee56];return _0x2b9bc9;};'use strict';var _=require(_0xb8a7('0x0'));var moment=require(_0xb8a7('0x1'));var AWS=require(_0xb8a7('0x2'));var utils=require(_0xb8a7('0x3'));var logger=require('../../../../config/logger')(_0xb8a7('0x4'));var rpc={'chatMessage':require(_0xb8a7('0x5')),'openchannelMessage':require(_0xb8a7('0x6')),'mailMessage':require(_0xb8a7('0x7')),'smsMessage':require(_0xb8a7('0x8')),'faxMessage':require(_0xb8a7('0x9')),'whatsappMessage':require(_0xb8a7('0xa'))};exports['consequence']=function(_0x57ea53,_0x59fa31){return function(_0x366bcd){try{if(!_[_0xb8a7('0xb')](this[_0xb8a7('0xc')][_0xb8a7('0xd')])){logger[_0xb8a7('0xe')](_0xb8a7('0xf'),_0x57ea53,_0xb8a7('0x10'));return _0x366bcd[_0xb8a7('0x11')]();}var _0xba3436={'ContactId':this[_0xb8a7('0x12')]['id'],'sentAt':moment()[_0xb8a7('0x13')](_0xb8a7('0x14')),'direction':_0xb8a7('0x15')};if(this[_0xb8a7('0x16')]==='sms'||this[_0xb8a7('0x16')]===_0xb8a7('0x17')){_0xba3436[_0xb8a7('0x18')]=this[_0xb8a7('0xc')]['phone'];}var _0x559c8f=this[_0xb8a7('0x16')];if(_0x559c8f===_0xb8a7('0x19')){_0xba3436['ChatWebsiteId']=this[_0xb8a7('0x1a')]['id'];}else{_0xba3436[_[_0xb8a7('0x1b')](_0x559c8f)+_0xb8a7('0x1c')]=this['account']['id'];}_0xba3436[_[_0xb8a7('0x1b')](_0x559c8f)+_0xb8a7('0x1d')]=this[_0xb8a7('0xc')]['id'];if(this[_0xb8a7('0xc')][_0xb8a7('0x1e')]){var _0x5c13e5=_0x59fa31[0x4];if(!_[_0xb8a7('0x1f')](_0x5c13e5)){_0xba3436[_0xb8a7('0x20')]=utils[_0xb8a7('0x21')](_0x5c13e5,this);return rpc[_0x559c8f+_0xb8a7('0x22')][_0xb8a7('0x23')](_0xba3436)[_0xb8a7('0x24')](function(_0x2cbfb4){logger['info'](_0xb8a7('0xf'),_0x57ea53,_0xba3436[_0xb8a7('0x20')]);})[_0xb8a7('0x25')](function(_0x486b07){logger['error'](_0xb8a7('0xf'),_0x57ea53,JSON[_0xb8a7('0x26')](_0x486b07));})[_0xb8a7('0x27')](function(){logger['info'](_0xb8a7('0x28'),_0x57ea53);_0x366bcd['stop']();});}else{logger['info'](_0xb8a7('0x29'),_0x57ea53);_0x366bcd['stop']();}}else{var _0x4ae2c8=this;var _0x2b6e11=new AWS[(_0xb8a7('0x2a'))]({'accessKeyId':_0x59fa31[0x0],'secretAccessKey':_0x59fa31[0x1],'region':_0x59fa31[0x2]});var _0x5f0a62={'botAlias':_0xb8a7('0x2b'),'botName':_0x59fa31[0x3],'inputText':this[_0xb8a7('0x2c')]['body'],'userId':this[_0xb8a7('0x16')]+':'+this[_0xb8a7('0xc')]['id'][_0xb8a7('0x2d')]()};_0x2b6e11[_0xb8a7('0x2e')](_0x5f0a62,function(_0x5023c4,_0x835172){if(_0x5023c4){logger['error'](_0xb8a7('0xf'),_0x57ea53,_0x5023c4['message']);_0x366bcd[_0xb8a7('0x11')]();}else if(_0x835172&&_0x835172[_0xb8a7('0x2c')]){_0x4ae2c8[_0xb8a7('0x20')][_0xb8a7('0x2f')]=_0x835172;_0xba3436['body']=_0x835172[_0xb8a7('0x2c')];_0xba3436['providerName']=_0xb8a7('0x2f');_0xba3436[_0xb8a7('0x30')]=JSON[_0xb8a7('0x26')](_0x835172);return rpc[_0x559c8f+_0xb8a7('0x22')][_0xb8a7('0x23')](_0xba3436)[_0xb8a7('0x24')](function(_0x2f5fb9){logger[_0xb8a7('0xe')](_0xb8a7('0xf'),_0x57ea53,_0xba3436[_0xb8a7('0x20')]);if(_0x835172[_0xb8a7('0x31')]==_0xb8a7('0x32')){_0x366bcd['next']();}else{_0x366bcd[_0xb8a7('0x33')]();}})[_0xb8a7('0x25')](function(_0x490b33){logger[_0xb8a7('0x34')](_0xb8a7('0xf'),_0x57ea53,JSON[_0xb8a7('0x26')](_0x490b33));_0x366bcd[_0xb8a7('0x11')]();});}else{_0x366bcd[_0xb8a7('0x11')]();}});}}catch(_0x47cca1){logger[_0xb8a7('0x34')](_0xb8a7('0xf'),_0x57ea53,JSON['stringify'](_0x47cca1));_0x366bcd['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 7bfdb23..1eda1fd 100644 --- a/server/services/routing/server/applications/autoreply.js +++ b/server/services/routing/server/applications/autoreply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2184=['One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','inReplyTo','headers','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','stringify','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x491b4e,_0x296293){var _0x1e2b64=function(_0x478f5c){while(--_0x478f5c){_0x491b4e['push'](_0x491b4e['shift']());}};_0x1e2b64(++_0x296293);}(_0x2184,0x1ae));var _0x4218=function(_0x2bc389,_0x3228ee){_0x2bc389=_0x2bc389-0x0;var _0x5b4909=_0x2184[_0x2bc389];return _0x5b4909;};'use strict';var _=require(_0x4218('0x0'));var moment=require(_0x4218('0x1'));var utils=require(_0x4218('0x2'));var logger=require('../../../../config/logger')(_0x4218('0x3'));var rpc={'chatMessage':require(_0x4218('0x4')),'openchannelMessage':require(_0x4218('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4218('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4218('0x7')),'chatInteraction':require(_0x4218('0x8')),'openchannelInteraction':require(_0x4218('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x4218('0xa')),'whatsappInteraction':require(_0x4218('0xb'))};var mailRpc=require(_0x4218('0xc'));exports['consequence']=function(_0x244c6f,_0x134174,_0x835df3,_0x103e3f){return function(_0x5b3557){try{var _0x361164=this[_0x4218('0xd')];if(_0x361164==='mail'&&_0x103e3f['body'][_0x4218('0xe')]){logger[_0x4218('0xf')]('[%s][AUTOREPLY]\x20%s',_0x244c6f,_0x4218('0x10'));return _0x5b3557['next']();}if(_0x134174[0x0]==='1'&&(_[_0x4218('0x11')](this['interaction'][_0x4218('0x12')])||!this[_0x4218('0x13')][_0x4218('0x12')])){logger[_0x4218('0xf')](_0x4218('0x14'),_0x244c6f,_0x4218('0x15'));return _0x5b3557[_0x4218('0x16')]();}if(_0x134174[0x0]==='2'&&this[_0x4218('0x13')][_0x4218('0x17')]){logger[_0x4218('0xf')](_0x4218('0x18'),_0x244c6f,_0x4218('0x19'));return _0x5b3557[_0x4218('0x16')]();}var _0x11d7bc={'ContactId':this[_0x4218('0x1a')]['id'],'sentAt':moment()[_0x4218('0x1b')](_0x4218('0x1c')),'direction':_0x4218('0x1d')};if(this[_0x4218('0xd')]===_0x4218('0x1e')){_0x11d7bc[_0x4218('0x1f')]=utils['getMustacheRender'](_0x134174[0x2],this);}else{_0x11d7bc[_0x4218('0x1f')]=utils[_0x4218('0x20')](_0x134174[0x1],this);}if(this[_0x4218('0x21')]){_0x11d7bc['to']=this[_0x4218('0x21')][_0x4218('0x22')]||'';if(this[_0x4218('0xd')]==='mail'&&_0x134174[0x1]==='1'){_0x11d7bc['cc']=this[_0x4218('0x21')]['cc']||'';}_0x11d7bc['from']=this[_0x4218('0x21')]['to']||'';_0x11d7bc[_0x4218('0x23')]=this[_0x4218('0x21')][_0x4218('0x23')]||'';_0x11d7bc[_0x4218('0x24')]=!![];if(this[_0x4218('0x21')][_0x4218('0x25')]){_0x11d7bc[_0x4218('0x25')]='';_0x11d7bc[_0x4218('0x25')]+=_[_0x4218('0x26')](this[_0x4218('0x21')][_0x4218('0x25')],_0x4218('0x27'))?'':'Re:\x20';_0x11d7bc[_0x4218('0x25')]+=this[_0x4218('0x21')][_0x4218('0x25')];}}if(this['channel']===_0x4218('0x28')){_0x11d7bc[_0x4218('0x29')]=this[_0x4218('0x2a')]['id'];}else{_0x11d7bc[_[_0x4218('0x2b')](this[_0x4218('0xd')])+'AccountId']=this[_0x4218('0x2a')]['id'];}_0x11d7bc[_[_0x4218('0x2b')](this[_0x4218('0xd')])+_0x4218('0x2c')]=this[_0x4218('0x13')]['id'];var _0x59c7a8=this[_0x4218('0x13')];if(rpc[this[_0x4218('0xd')]+_0x4218('0x2d')]){if(this[_0x4218('0xd')]===_0x4218('0x1e')){_0x11d7bc[_0x4218('0x2e')]=this[_0x4218('0x21')]['messageId'];_0x11d7bc['html']=''+_['replace'](_0x11d7bc[_0x4218('0x1f')],'';_0x11d7bc[_0x4218('0x2f')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x4218('0x30'),'Precedence':_0x4218('0x31')};return mailRpc[_0x4218('0x32')](this[_0x4218('0x2a')][_0x4218('0x33')],_0x11d7bc)['then'](function(_0x2d7a4b){logger[_0x4218('0xf')](_0x4218('0x34'),_0x244c6f);_0x11d7bc['messageId']=_0x2d7a4b[_0x4218('0x21')][_0x4218('0x35')];return rpc[_0x361164+_0x4218('0x2d')][_0x4218('0x36')](_0x11d7bc);})[_0x4218('0x37')](function(_0x9ea504){logger[_0x4218('0xf')]('[%s][AUTOREPLY]\x20%s',_0x244c6f,JSON['stringify'](_0x9ea504));})[_0x4218('0x38')](function(_0x2e719){logger[_0x4218('0x39')](_0x4218('0x3a'),_0x244c6f,JSON['stringify'](_0x2e719));})[_0x4218('0x3b')](function(){Promise[_0x4218('0x3c')]()[_0x4218('0x37')](function(){if(_0x134174[0x0]!=='2'||_0x59c7a8[_0x4218('0x17')])return;return rpc[_0x361164+_0x4218('0x3d')][_0x4218('0x3e')](_0x59c7a8['id'],{'autoreplyExecuted':!![]})['then'](function(_0x25c7de){logger[_0x4218('0xf')](_0x4218('0x18'),_0x244c6f,JSON[_0x4218('0x3f')](_0x25c7de));})['catch'](function(_0x432e32){logger[_0x4218('0x39')](_0x4218('0x40'),_0x244c6f,JSON[_0x4218('0x3f')](_0x432e32));});})[_0x4218('0x37')](function(){_0x5b3557['next']();});});}else{return rpc[this['channel']+_0x4218('0x2d')]['create'](_0x11d7bc)[_0x4218('0x37')](function(){logger[_0x4218('0xf')](_0x4218('0x14'),_0x244c6f,_0x11d7bc[_0x4218('0x1f')]);})[_0x4218('0x38')](function(_0xafe5e7){logger[_0x4218('0x39')](_0x4218('0x14'),_0x244c6f,JSON[_0x4218('0x3f')](_0xafe5e7));})[_0x4218('0x3b')](function(){Promise[_0x4218('0x3c')]()[_0x4218('0x37')](function(){if(_0x134174[0x0]!=='2'||_0x59c7a8[_0x4218('0x17')])return;return rpc[_0x361164+_0x4218('0x3d')][_0x4218('0x3e')](_0x59c7a8['id'],{'autoreplyExecuted':!![]})['then'](function(_0x170da5){logger[_0x4218('0xf')](_0x4218('0x18'),_0x244c6f,JSON[_0x4218('0x3f')](_0x170da5));})[_0x4218('0x38')](function(_0x39129b){logger[_0x4218('0x39')](_0x4218('0x40'),_0x244c6f,JSON[_0x4218('0x3f')](_0x39129b));});})['then'](function(){_0x5b3557[_0x4218('0x16')]();});});}}}catch(_0x5081cc){logger[_0x4218('0x39')](_0x4218('0x14'),_0x244c6f,JSON[_0x4218('0x3f')](_0x5081cc));_0x5b3557['stop']();}};}; \ No newline at end of file +var _0x2018=['YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','resolve','then','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','autoreplyExecuted','Interaction','error','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','format'];(function(_0x1afa5a,_0x28194f){var _0x86f759=function(_0x4c3130){while(--_0x4c3130){_0x1afa5a['push'](_0x1afa5a['shift']());}};_0x86f759(++_0x28194f);}(_0x2018,0xb4));var _0x8201=function(_0x5ab6dc,_0x119b9a){_0x5ab6dc=_0x5ab6dc-0x0;var _0x3d7250=_0x2018[_0x5ab6dc];return _0x3d7250;};'use strict';var _=require(_0x8201('0x0'));var moment=require(_0x8201('0x1'));var utils=require(_0x8201('0x2'));var logger=require(_0x8201('0x3'))(_0x8201('0x4'));var rpc={'chatMessage':require(_0x8201('0x5')),'openchannelMessage':require(_0x8201('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8201('0x7')),'faxMessage':require(_0x8201('0x8')),'whatsappMessage':require(_0x8201('0x9')),'chatInteraction':require(_0x8201('0xa')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x8201('0xb')),'smsInteraction':require(_0x8201('0xc')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8201('0xd'))};var mailRpc=require(_0x8201('0xe'));exports[_0x8201('0xf')]=function(_0x277877,_0x145c1e,_0x91cbba,_0x13605e){return function(_0x5ee5cd){try{var _0x54901e=this['channel'];if(_0x54901e===_0x8201('0x10')&&_0x13605e['body'][_0x8201('0x11')]){logger[_0x8201('0x12')](_0x8201('0x13'),_0x277877,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5ee5cd[_0x8201('0x14')]();}if(_0x145c1e[0x0]==='1'&&(_[_0x8201('0x15')](this[_0x8201('0x16')][_0x8201('0x17')])||!this[_0x8201('0x16')][_0x8201('0x17')])){logger['info'](_0x8201('0x13'),_0x277877,_0x8201('0x18'));return _0x5ee5cd[_0x8201('0x14')]();}if(_0x145c1e[0x0]==='2'&&this[_0x8201('0x16')]['autoreplyExecuted']){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x277877,_0x8201('0x19'));return _0x5ee5cd[_0x8201('0x14')]();}var _0x47586e={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8201('0x1a')](_0x8201('0x1b')),'direction':_0x8201('0x1c')};if(this[_0x8201('0x1d')]==='mail'){_0x47586e[_0x8201('0x1e')]=utils[_0x8201('0x1f')](_0x145c1e[0x2],this);}else{_0x47586e[_0x8201('0x1e')]=utils['getMustacheRender'](_0x145c1e[0x1],this);}if(this[_0x8201('0x20')]){_0x47586e['to']=this[_0x8201('0x20')][_0x8201('0x21')]||'';if(this[_0x8201('0x1d')]==='mail'&&_0x145c1e[0x1]==='1'){_0x47586e['cc']=this[_0x8201('0x20')]['cc']||'';}_0x47586e[_0x8201('0x21')]=this[_0x8201('0x20')]['to']||'';_0x47586e[_0x8201('0x22')]=this[_0x8201('0x20')][_0x8201('0x22')]||'';_0x47586e[_0x8201('0x23')]=!![];if(this['message']['subject']){_0x47586e[_0x8201('0x24')]='';_0x47586e[_0x8201('0x24')]+=_[_0x8201('0x25')](this[_0x8201('0x20')][_0x8201('0x24')],_0x8201('0x26'))?'':'Re:\x20';_0x47586e[_0x8201('0x24')]+=this[_0x8201('0x20')][_0x8201('0x24')];}}if(this['channel']==='chat'){_0x47586e[_0x8201('0x27')]=this[_0x8201('0x28')]['id'];}else{_0x47586e[_[_0x8201('0x29')](this[_0x8201('0x1d')])+_0x8201('0x2a')]=this[_0x8201('0x28')]['id'];}_0x47586e[_[_0x8201('0x29')](this[_0x8201('0x1d')])+_0x8201('0x2b')]=this[_0x8201('0x16')]['id'];var _0x200396=this[_0x8201('0x16')];if(rpc[this[_0x8201('0x1d')]+_0x8201('0x2c')]){if(this[_0x8201('0x1d')]==='mail'){_0x47586e[_0x8201('0x2d')]=this[_0x8201('0x20')][_0x8201('0x2e')];_0x47586e[_0x8201('0x2f')]=''+_[_0x8201('0x30')](_0x47586e[_0x8201('0x1e')],_0x8201('0x31'),_0x8201('0x32'))+_0x8201('0x33');_0x47586e[_0x8201('0x34')]={'Auto-Submitted':_0x8201('0x35'),'X-Auto-Response-Suppress':'All','Precedence':_0x8201('0x36')};return mailRpc[_0x8201('0x37')](this[_0x8201('0x28')][_0x8201('0x38')],_0x47586e)['then'](function(_0x4853fb){logger[_0x8201('0x12')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x277877);_0x47586e[_0x8201('0x2e')]=_0x4853fb['message']['messageId'];return rpc[_0x54901e+_0x8201('0x2c')][_0x8201('0x39')](_0x47586e);})['then'](function(_0x416b6d){logger[_0x8201('0x12')](_0x8201('0x13'),_0x277877,JSON[_0x8201('0x3a')](_0x416b6d));})[_0x8201('0x3b')](function(_0x341c9d){logger['error'](_0x8201('0x3c'),_0x277877,JSON[_0x8201('0x3a')](_0x341c9d));})['finally'](function(){Promise[_0x8201('0x3d')]()[_0x8201('0x3e')](function(){if(_0x145c1e[0x0]!=='2'||_0x200396['autoreplyExecuted'])return;return rpc[_0x54901e+'Interaction']['update'](_0x200396['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2605e4){logger[_0x8201('0x12')](_0x8201('0x3f'),_0x277877,JSON[_0x8201('0x3a')](_0x2605e4));})[_0x8201('0x3b')](function(_0x5970e6){logger['error'](_0x8201('0x40'),_0x277877,JSON['stringify'](_0x5970e6));});})[_0x8201('0x3e')](function(){_0x5ee5cd[_0x8201('0x14')]();});});}else{return rpc[this[_0x8201('0x1d')]+_0x8201('0x2c')][_0x8201('0x39')](_0x47586e)['then'](function(){logger['info'](_0x8201('0x13'),_0x277877,_0x47586e[_0x8201('0x1e')]);})['catch'](function(_0x5e9598){logger['error'](_0x8201('0x13'),_0x277877,JSON[_0x8201('0x3a')](_0x5e9598));})[_0x8201('0x41')](function(){Promise['resolve']()['then'](function(){if(_0x145c1e[0x0]!=='2'||_0x200396[_0x8201('0x42')])return;return rpc[_0x54901e+_0x8201('0x43')]['update'](_0x200396['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1e4e4b){logger[_0x8201('0x12')](_0x8201('0x3f'),_0x277877,JSON[_0x8201('0x3a')](_0x1e4e4b));})[_0x8201('0x3b')](function(_0x587a0d){logger[_0x8201('0x44')](_0x8201('0x40'),_0x277877,JSON[_0x8201('0x3a')](_0x587a0d));});})[_0x8201('0x3e')](function(){_0x5ee5cd[_0x8201('0x14')]();});});}}}catch(_0x41a995){logger[_0x8201('0x44')](_0x8201('0x13'),_0x277877,JSON[_0x8201('0x3a')](_0x41a995));_0x5ee5cd['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index d1c3828..0a8c1fb 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d84=['channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x53a27f,_0x31bbd3){var _0x1c1f81=function(_0x265572){while(--_0x265572){_0x53a27f['push'](_0x53a27f['shift']());}};_0x1c1f81(++_0x31bbd3);}(_0x1d84,0xbc));var _0x41d8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x1d84[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0x41d8('0x0'));var logger=require(_0x41d8('0x1'))(_0x41d8('0x2'));var rpc={'chatInteraction':require(_0x41d8('0x3')),'openchannelInteraction':require(_0x41d8('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x41d8('0x5')),'faxInteraction':require(_0x41d8('0x6')),'whatsappInteraction':require(_0x41d8('0x7'))};exports[_0x41d8('0x8')]=function(_0x3f9e2b,_0x495e23,_0x11fa1f,_0x5c7908){return function(_0xaff66e){try{logger['info']('[%s][CLOSE]\x20reason\x20%s',_0x3f9e2b,_0x495e23[0x0]);var _0x5479a4={'closed':0x1,'closedAt':moment()['format'](_0x41d8('0x9')),'closeReason':'system','disposition':_0x495e23[0x0]};if(rpc[_0x5c7908[_0x41d8('0xa')]+'Interaction']){rpc[_0x5c7908[_0x41d8('0xa')]+_0x41d8('0xb')][_0x41d8('0xc')](_0x5c7908[_0x41d8('0xd')]['id'],_0x5479a4)[_0x41d8('0xe')](function(_0xd4cc2b){logger[_0x41d8('0xf')](_0x41d8('0x10'),_0x3f9e2b,_0x5c7908[_0x41d8('0xd')]['id']);})[_0x41d8('0x11')](function(_0x481e31){logger[_0x41d8('0x12')](_0x41d8('0x13'),_0x3f9e2b,JSON[_0x41d8('0x14')](_0x481e31));})['finally'](function(){_0xaff66e[_0x41d8('0x15')]();});}}catch(_0x1302f8){logger[_0x41d8('0x12')](_0x41d8('0x13'),_0x3f9e2b,JSON['stringify'](_0x1302f8));_0xaff66e[_0x41d8('0x15')]();}};}; \ No newline at end of file +var _0x716f=['stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x3bc23c,_0x22df54){var _0x2db931=function(_0x15c272){while(--_0x15c272){_0x3bc23c['push'](_0x3bc23c['shift']());}};_0x2db931(++_0x22df54);}(_0x716f,0xc7));var _0xf716=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x716f[_0x12ca5f];return _0xfc3ae9;};'use strict';var moment=require('moment');var logger=require(_0xf716('0x0'))(_0xf716('0x1'));var rpc={'chatInteraction':require(_0xf716('0x2')),'openchannelInteraction':require(_0xf716('0x3')),'smsInteraction':require(_0xf716('0x4')),'mailInteraction':require(_0xf716('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf716('0x6'))};exports[_0xf716('0x7')]=function(_0x18b07c,_0x6557d,_0x2949bd,_0x5cf2c0){return function(_0x4ccad5){try{logger[_0xf716('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x18b07c,_0x6557d[0x0]);var _0x5dac02={'closed':0x1,'closedAt':moment()[_0xf716('0x9')](_0xf716('0xa')),'closeReason':_0xf716('0xb'),'disposition':_0x6557d[0x0]};if(rpc[_0x5cf2c0[_0xf716('0xc')]+_0xf716('0xd')]){rpc[_0x5cf2c0[_0xf716('0xc')]+_0xf716('0xd')]['update'](_0x5cf2c0[_0xf716('0xe')]['id'],_0x5dac02)[_0xf716('0xf')](function(_0x5a9631){logger[_0xf716('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x18b07c,_0x5cf2c0[_0xf716('0xe')]['id']);})[_0xf716('0x10')](function(_0x175f5d){logger[_0xf716('0x11')](_0xf716('0x12'),_0x18b07c,JSON[_0xf716('0x13')](_0x175f5d));})[_0xf716('0x14')](function(){_0x4ccad5[_0xf716('0x15')]();});}}catch(_0x8e0d05){logger[_0xf716('0x11')](_0xf716('0x12'),_0x18b07c,JSON[_0xf716('0x13')](_0x8e0d05));_0x4ccad5[_0xf716('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 5c6373d..97129c5 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89fb=['AccountId','account','InteractionId','isEmpty','body','getMustacheRender','then','info','catch','error','stringify','finally','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','create','metadata','endConversation','stop','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0x89fb,0x14b));var _0xb89f=function(_0x1afdeb,_0x1c50f3){_0x1afdeb=_0x1afdeb-0x0;var _0x1cf09f=_0x89fb[_0x1afdeb];return _0x1cf09f;};'use strict';var _=require('lodash');var moment=require(_0xb89f('0x0'));var apiai=require(_0xb89f('0x1'));var md5=require(_0xb89f('0x2'));var utils=require(_0xb89f('0x3'));var logger=require(_0xb89f('0x4'))('routing');var rpc={'chatMessage':require(_0xb89f('0x5')),'openchannelMessage':require(_0xb89f('0x6')),'mailMessage':require(_0xb89f('0x7')),'smsMessage':require(_0xb89f('0x8')),'faxMessage':require(_0xb89f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xb89f('0xa')]=function(_0x5b467c,_0x334236){return function(_0x537685){try{if(!_[_0xb89f('0xb')](this[_0xb89f('0xc')][_0xb89f('0xd')])){logger['info'](_0xb89f('0xe'),_0x5b467c,_0xb89f('0xf'));return _0x537685[_0xb89f('0x10')]();}var _0x7361c0={'ContactId':this[_0xb89f('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xb89f('0x12')};if(this[_0xb89f('0x13')]===_0xb89f('0x14')||this[_0xb89f('0x13')]===_0xb89f('0x15')){_0x7361c0['phone']=this[_0xb89f('0xc')][_0xb89f('0x16')];}var _0x98541=this[_0xb89f('0x13')];if(_0x98541===_0xb89f('0x17')){_0x7361c0[_0xb89f('0x18')]=this['account']['id'];}else{_0x7361c0[_[_0xb89f('0x19')](_0x98541)+_0xb89f('0x1a')]=this[_0xb89f('0x1b')]['id'];}_0x7361c0[_[_0xb89f('0x19')](_0x98541)+_0xb89f('0x1c')]=this[_0xb89f('0xc')]['id'];if(this[_0xb89f('0xc')]['created']){var _0x243388=_0x334236[0x2];if(!_[_0xb89f('0x1d')](_0x243388)){_0x7361c0[_0xb89f('0x1e')]=utils[_0xb89f('0x1f')](_0x243388,this);return rpc[_0x98541+'Message']['create'](_0x7361c0)[_0xb89f('0x20')](function(_0x3004b7){logger[_0xb89f('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x5b467c,_0x7361c0['body']);})[_0xb89f('0x22')](function(_0x1216c8){logger[_0xb89f('0x23')](_0xb89f('0xe'),_0x5b467c,JSON[_0xb89f('0x24')](_0x1216c8));})[_0xb89f('0x25')](function(){logger[_0xb89f('0x21')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5b467c);_0x537685['stop']();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5b467c);_0x537685['stop']();}}else{var _0x42005c=this;var _0x510dfe=apiai(_0x334236[0x0],{'language':_0x334236[0x1]||'en'});return _0x510dfe[_0xb89f('0x26')](this[_0xb89f('0x27')][_0xb89f('0x1e')],{'sessionId':md5(this[_0xb89f('0xc')]['id'])})[_0xb89f('0x20')](function(_0x2c8856){_0x42005c['body'][_0xb89f('0x28')]=_0x2c8856;_0x7361c0[_0xb89f('0x1e')]=_0x2c8856[_0xb89f('0x29')][_0xb89f('0x2a')][_0xb89f('0x2b')];_0x7361c0[_0xb89f('0x2c')]=_0xb89f('0x28');_0x7361c0[_0xb89f('0x2d')]=JSON['stringify'](_0x2c8856);return rpc[_0x98541+_0xb89f('0x2e')][_0xb89f('0x2f')](_0x7361c0)[_0xb89f('0x20')](function(_0x38983e){logger[_0xb89f('0x21')](_0xb89f('0xe'),_0x5b467c,_0x7361c0['body']);if(_0x2c8856[_0xb89f('0x29')][_0xb89f('0x30')][_0xb89f('0x31')]){_0x537685[_0xb89f('0x10')]();}else{_0x537685['stop']();}})['catch'](function(_0x4bef24){logger[_0xb89f('0x23')](_0xb89f('0xe'),_0x5b467c,JSON[_0xb89f('0x24')](_0x4bef24));_0x537685[_0xb89f('0x10')]();});})[_0xb89f('0x22')](function(_0x69713a){logger[_0xb89f('0x23')](_0xb89f('0xe'),_0x5b467c,_0x69713a[_0xb89f('0x27')]);_0x537685['next']();});}}catch(_0x17076d){logger[_0xb89f('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x5b467c,JSON[_0xb89f('0x24')](_0x17076d));_0x537685[_0xb89f('0x32')]();}};}; \ No newline at end of file +var _0xbb67=['next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','speech','providerResponse','Message','metadata','endConversation','stop','catch','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x1c46b3,_0x521326){var _0x5bf596=function(_0x6d0ae7){while(--_0x6d0ae7){_0x1c46b3['push'](_0x1c46b3['shift']());}};_0x5bf596(++_0x521326);}(_0xbb67,0x161));var _0x7bb6=function(_0x1bcb7f,_0x18cb5e){_0x1bcb7f=_0x1bcb7f-0x0;var _0x1549ad=_0xbb67[_0x1bcb7f];return _0x1549ad;};'use strict';var _=require('lodash');var moment=require(_0x7bb6('0x0'));var apiai=require(_0x7bb6('0x1'));var md5=require(_0x7bb6('0x2'));var utils=require(_0x7bb6('0x3'));var logger=require(_0x7bb6('0x4'))('routing');var rpc={'chatMessage':require(_0x7bb6('0x5')),'openchannelMessage':require(_0x7bb6('0x6')),'mailMessage':require(_0x7bb6('0x7')),'smsMessage':require(_0x7bb6('0x8')),'faxMessage':require(_0x7bb6('0x9')),'whatsappMessage':require(_0x7bb6('0xa'))};exports[_0x7bb6('0xb')]=function(_0x2a059b,_0x5f1898){return function(_0x45441a){try{if(!_[_0x7bb6('0xc')](this[_0x7bb6('0xd')][_0x7bb6('0xe')])){logger[_0x7bb6('0xf')](_0x7bb6('0x10'),_0x2a059b,_0x7bb6('0x11'));return _0x45441a[_0x7bb6('0x12')]();}var _0x14a6af={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7bb6('0x13')](_0x7bb6('0x14')),'direction':_0x7bb6('0x15')};if(this[_0x7bb6('0x16')]===_0x7bb6('0x17')||this[_0x7bb6('0x16')]===_0x7bb6('0x18')){_0x14a6af[_0x7bb6('0x19')]=this[_0x7bb6('0xd')]['phone'];}var _0x5e8002=this[_0x7bb6('0x16')];if(_0x5e8002===_0x7bb6('0x1a')){_0x14a6af['ChatWebsiteId']=this[_0x7bb6('0x1b')]['id'];}else{_0x14a6af[_[_0x7bb6('0x1c')](_0x5e8002)+_0x7bb6('0x1d')]=this[_0x7bb6('0x1b')]['id'];}_0x14a6af[_[_0x7bb6('0x1c')](_0x5e8002)+_0x7bb6('0x1e')]=this['interaction']['id'];if(this[_0x7bb6('0xd')][_0x7bb6('0x1f')]){var _0x23d047=_0x5f1898[0x2];if(!_[_0x7bb6('0x20')](_0x23d047)){_0x14a6af[_0x7bb6('0x21')]=utils[_0x7bb6('0x22')](_0x23d047,this);return rpc[_0x5e8002+'Message'][_0x7bb6('0x23')](_0x14a6af)[_0x7bb6('0x24')](function(_0xde089f){logger[_0x7bb6('0xf')](_0x7bb6('0x10'),_0x2a059b,_0x14a6af['body']);})['catch'](function(_0x533f9a){logger[_0x7bb6('0x25')](_0x7bb6('0x10'),_0x2a059b,JSON[_0x7bb6('0x26')](_0x533f9a));})[_0x7bb6('0x27')](function(){logger[_0x7bb6('0xf')](_0x7bb6('0x28'),_0x2a059b);_0x45441a['stop']();});}else{logger[_0x7bb6('0xf')](_0x7bb6('0x29'),_0x2a059b);_0x45441a['stop']();}}else{var _0x5c1a55=this;var _0x4df0de=apiai(_0x5f1898[0x0],{'language':_0x5f1898[0x1]||'en'});return _0x4df0de[_0x7bb6('0x2a')](this[_0x7bb6('0x2b')][_0x7bb6('0x21')],{'sessionId':md5(this['interaction']['id'])})[_0x7bb6('0x24')](function(_0x2b989f){_0x5c1a55[_0x7bb6('0x21')][_0x7bb6('0x2c')]=_0x2b989f;_0x14a6af[_0x7bb6('0x21')]=_0x2b989f[_0x7bb6('0x2d')]['fulfillment'][_0x7bb6('0x2e')];_0x14a6af['providerName']=_0x7bb6('0x2c');_0x14a6af[_0x7bb6('0x2f')]=JSON['stringify'](_0x2b989f);return rpc[_0x5e8002+_0x7bb6('0x30')][_0x7bb6('0x23')](_0x14a6af)[_0x7bb6('0x24')](function(_0x4a01d7){logger[_0x7bb6('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x2a059b,_0x14a6af['body']);if(_0x2b989f[_0x7bb6('0x2d')][_0x7bb6('0x31')][_0x7bb6('0x32')]){_0x45441a[_0x7bb6('0x12')]();}else{_0x45441a[_0x7bb6('0x33')]();}})[_0x7bb6('0x34')](function(_0x56efb5){logger[_0x7bb6('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x2a059b,JSON[_0x7bb6('0x26')](_0x56efb5));_0x45441a[_0x7bb6('0x12')]();});})[_0x7bb6('0x34')](function(_0x4f3763){logger[_0x7bb6('0x25')](_0x7bb6('0x10'),_0x2a059b,_0x4f3763[_0x7bb6('0x2b')]);_0x45441a[_0x7bb6('0x12')]();});}}catch(_0x4ff660){logger[_0x7bb6('0x25')](_0x7bb6('0x10'),_0x2a059b,JSON[_0x7bb6('0x26')](_0x4ff660));_0x45441a[_0x7bb6('0x33')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 7a04139..78f81b7 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c91=['info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','catch','stringify','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message'];(function(_0x24f66d,_0x261e88){var _0x147cdb=function(_0x137ea5){while(--_0x137ea5){_0x24f66d['push'](_0x24f66d['shift']());}};_0x147cdb(++_0x261e88);}(_0x5c91,0x1e9));var _0x15c9=function(_0xbbd97,_0x4148ab){_0xbbd97=_0xbbd97-0x0;var _0xa59c8e=_0x5c91[_0xbbd97];return _0xa59c8e;};'use strict';var _=require(_0x15c9('0x0'));var dialogflow=require(_0x15c9('0x1'));var md5=require(_0x15c9('0x2'));var moment=require('moment');var Promise=require(_0x15c9('0x3'));var logger=require(_0x15c9('0x4'))(_0x15c9('0x5'));var utils=require(_0x15c9('0x6'));var rpc={'chatMessage':require(_0x15c9('0x7')),'openchannelMessage':require(_0x15c9('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x15c9('0x9')),'faxMessage':require(_0x15c9('0xa')),'whatsappMessage':require(_0x15c9('0xb'))};function createMessage(_0x42bcb6,_0x2c213e,_0x51a779,_0x191695){return new Promise(function(_0x114775,_0x44983c){var _0x5c29fc=_[_0x15c9('0xc')](_0x51a779);_0x5c29fc[_0x15c9('0xd')]=_0x191695;return rpc[_0x2c213e+_0x15c9('0xe')]['create'](_0x5c29fc)['then'](function(){logger[_0x15c9('0xf')](_0x15c9('0x10'),_0x42bcb6,_0x5c29fc['body']);_0x114775();})['catch'](function(_0x538952){logger[_0x15c9('0x11')](_0x15c9('0x10'),_0x42bcb6,JSON['stringify'](_0x538952));_0x44983c(_0x538952);});});}exports[_0x15c9('0x12')]=function(_0x28a6fa,_0x317aee){return function(_0x56fbbd){try{if(!_['isNil'](this[_0x15c9('0x13')][_0x15c9('0x14')])){logger['info'](_0x15c9('0x10'),_0x28a6fa,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x56fbbd[_0x15c9('0x15')]();}var _0x15ce03={'ContactId':this[_0x15c9('0x16')]['id'],'sentAt':moment()[_0x15c9('0x17')](_0x15c9('0x18')),'direction':_0x15c9('0x19')};if(this['channel']===_0x15c9('0x1a')||this[_0x15c9('0x1b')]===_0x15c9('0x1c')){_0x15ce03[_0x15c9('0x1d')]=this[_0x15c9('0x13')][_0x15c9('0x1d')];}var _0x1c4b1a=this[_0x15c9('0x1b')];if(_0x1c4b1a==='chat'){_0x15ce03[_0x15c9('0x1e')]=this[_0x15c9('0x1f')]['id'];}else{_0x15ce03[_[_0x15c9('0x20')](_0x1c4b1a)+_0x15c9('0x21')]=this[_0x15c9('0x1f')]['id'];}_0x15ce03[_[_0x15c9('0x20')](_0x1c4b1a)+_0x15c9('0x22')]=this['interaction']['id'];if(this[_0x15c9('0x13')][_0x15c9('0x23')]){var _0x3085a4=_0x317aee[0x4];if(!_[_0x15c9('0x24')](_0x3085a4)){_0x15ce03[_0x15c9('0xd')]=utils[_0x15c9('0x25')](_0x3085a4,this);return rpc[_0x1c4b1a+_0x15c9('0xe')][_0x15c9('0x26')](_0x15ce03)[_0x15c9('0x27')](function(_0x45411c){logger['info'](_0x15c9('0x10'),_0x28a6fa,_0x15ce03['body']);})[_0x15c9('0x28')](function(_0x2a64d3){logger['error'](_0x15c9('0x10'),_0x28a6fa,JSON[_0x15c9('0x29')](_0x2a64d3));})[_0x15c9('0x2a')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x28a6fa);_0x56fbbd[_0x15c9('0x2b')]();});}else{logger[_0x15c9('0xf')](_0x15c9('0x2c'),_0x28a6fa);_0x56fbbd[_0x15c9('0x2b')]();}}else{var _0x4f76b7=this;var _0x12f6ed=_0x317aee[0x2][_0x15c9('0x2d')](/\\n/g,'\x0a');var _0x3d7b0a={'credentials':{'private_key':_0x12f6ed,'client_email':_0x317aee[0x1]}};var _0x8d9ab0=new dialogflow[(_0x15c9('0x2e'))](_0x3d7b0a);var _0x200d26=_0x8d9ab0[_0x15c9('0x2f')](_0x317aee[0x0],md5(_0x4f76b7[_0x15c9('0x13')]['id']));var _0x5ca63f={'session':_0x200d26,'queryInput':{'text':{'text':_0x4f76b7[_0x15c9('0x30')][_0x15c9('0xd')],'languageCode':_0x317aee[0x3]||'en'}}};return _0x8d9ab0[_0x15c9('0x31')](_0x5ca63f)[_0x15c9('0x27')](function(_0x331166){if(_0x331166&&_0x331166[_0x15c9('0x32')]){_0x4f76b7[_0x15c9('0xd')][_0x15c9('0x33')]=_0x331166;var _0x32aba4=_0x331166[0x0];var _0x2292eb=_0x32aba4[_0x15c9('0x34')][_0x15c9('0x35')]&&_0x32aba4['queryResult'][_0x15c9('0x35')]['fields']?_0x32aba4[_0x15c9('0x34')]['diagnosticInfo'][_0x15c9('0x36')][_0x15c9('0x37')][_0x15c9('0x38')]:![];_0x4f76b7['body'][_0x15c9('0x39')]=_0x32aba4[_0x15c9('0x34')]['action'];_0x4f76b7['body'][_0x15c9('0x3a')]=_0x32aba4[_0x15c9('0x34')]['allRequiredParamsPresent'];_0x4f76b7[_0x15c9('0xd')][_0x15c9('0x3b')]=_0x32aba4[_0x15c9('0x34')][_0x15c9('0x35')]&&_0x32aba4[_0x15c9('0x34')][_0x15c9('0x35')]['fields']?_0x32aba4[_0x15c9('0x34')]['diagnosticInfo'][_0x15c9('0x36')][_0x15c9('0x37')]['boolValue']:![];_0x4f76b7[_0x15c9('0xd')][_0x15c9('0x3c')]=_0x32aba4['queryResult'][_0x15c9('0x3d')][_0x15c9('0x3e')];_0x4f76b7['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x32aba4[_0x15c9('0x34')][_0x15c9('0x3d')]['displayName'];_0x4f76b7['body']['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x32aba4[_0x15c9('0x34')][_0x15c9('0x3d')]['isFallback'];_0x4f76b7['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x32aba4[_0x15c9('0x34')][_0x15c9('0x3f')];_0x4f76b7[_0x15c9('0xd')]['DIALOGFLOWV2_QUERYTEXT']=_0x32aba4['queryResult'][_0x15c9('0x40')];_0x4f76b7[_0x15c9('0xd')][_0x15c9('0x41')]=_0x32aba4[_0x15c9('0x34')][_0x15c9('0x42')];_0x15ce03[_0x15c9('0x43')]=_0x15c9('0x33');_0x15ce03[_0x15c9('0x44')]=JSON[_0x15c9('0x29')](_0x331166);var _0x348e23=[];for(var _0x43bcc4=0x0;_0x43bcc4<_0x331166['length'];_0x43bcc4++){var _0x202a94=_0x331166[_0x43bcc4];if(_0x202a94&&_0x202a94['queryResult']&&_0x202a94['queryResult'][_0x15c9('0x45')]){_0x348e23[_0x15c9('0x46')](createMessage(_0x28a6fa,_0x1c4b1a,_0x15ce03,_0x202a94[_0x15c9('0x34')][_0x15c9('0x45')]));}}return Promise[_0x15c9('0x47')](_0x348e23)[_0x15c9('0x27')](function(){if(_0x2292eb){_0x56fbbd[_0x15c9('0x15')]();}else{_0x56fbbd['stop']();}})[_0x15c9('0x28')](function(_0x483a37){logger[_0x15c9('0x11')](_0x15c9('0x10'),_0x28a6fa,JSON[_0x15c9('0x29')](_0x483a37));_0x56fbbd[_0x15c9('0x15')]();});}})['catch'](function(_0x33823f){logger[_0x15c9('0x11')](_0x15c9('0x10'),_0x28a6fa,_0x33823f[_0x15c9('0x30')]);_0x56fbbd[_0x15c9('0x15')]();});}}catch(_0x3d52aa){logger[_0x15c9('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x28a6fa,JSON[_0x15c9('0x29')](_0x3d52aa));_0x56fbbd[_0x15c9('0x2b')]();}};}; \ No newline at end of file +var _0xc931=['bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','isNil','interaction','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','error','stringify','next','lodash','md5'];(function(_0x2fecbc,_0x5e8b04){var _0x2bab10=function(_0x163c82){while(--_0x163c82){_0x2fecbc['push'](_0x2fecbc['shift']());}};_0x2bab10(++_0x5e8b04);}(_0xc931,0x8c));var _0x1c93=function(_0x4f71ad,_0x29e37c){_0x4f71ad=_0x4f71ad-0x0;var _0x49fa63=_0xc931[_0x4f71ad];return _0x49fa63;};'use strict';var _=require(_0x1c93('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x1c93('0x1'));var moment=require('moment');var Promise=require(_0x1c93('0x2'));var logger=require(_0x1c93('0x3'))('routing');var utils=require(_0x1c93('0x4'));var rpc={'chatMessage':require(_0x1c93('0x5')),'openchannelMessage':require(_0x1c93('0x6')),'mailMessage':require(_0x1c93('0x7')),'smsMessage':require(_0x1c93('0x8')),'faxMessage':require(_0x1c93('0x9')),'whatsappMessage':require(_0x1c93('0xa'))};function createMessage(_0x502c9a,_0x1b60f0,_0x262004,_0x15ed1c){return new Promise(function(_0x205f3b,_0x39141d){var _0xe706ad=_[_0x1c93('0xb')](_0x262004);_0xe706ad['body']=_0x15ed1c;return rpc[_0x1b60f0+'Message'][_0x1c93('0xc')](_0xe706ad)[_0x1c93('0xd')](function(){logger[_0x1c93('0xe')](_0x1c93('0xf'),_0x502c9a,_0xe706ad[_0x1c93('0x10')]);_0x205f3b();})[_0x1c93('0x11')](function(_0x55f61f){logger['error'](_0x1c93('0xf'),_0x502c9a,JSON['stringify'](_0x55f61f));_0x39141d(_0x55f61f);});});}exports['consequence']=function(_0x3a0729,_0x3f6343){return function(_0x13e70a){try{if(!_[_0x1c93('0x12')](this[_0x1c93('0x13')]['UserId'])){logger[_0x1c93('0xe')](_0x1c93('0xf'),_0x3a0729,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x13e70a['next']();}var _0x59aeab={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1c93('0x14')](_0x1c93('0x15')),'direction':_0x1c93('0x16')};if(this[_0x1c93('0x17')]===_0x1c93('0x18')||this[_0x1c93('0x17')]===_0x1c93('0x19')){_0x59aeab[_0x1c93('0x1a')]=this['interaction'][_0x1c93('0x1a')];}var _0x17764c=this[_0x1c93('0x17')];if(_0x17764c==='chat'){_0x59aeab[_0x1c93('0x1b')]=this['account']['id'];}else{_0x59aeab[_['upperFirst'](_0x17764c)+_0x1c93('0x1c')]=this[_0x1c93('0x1d')]['id'];}_0x59aeab[_[_0x1c93('0x1e')](_0x17764c)+_0x1c93('0x1f')]=this[_0x1c93('0x13')]['id'];if(this['interaction'][_0x1c93('0x20')]){var _0x3606b9=_0x3f6343[0x4];if(!_[_0x1c93('0x21')](_0x3606b9)){_0x59aeab['body']=utils[_0x1c93('0x22')](_0x3606b9,this);return rpc[_0x17764c+_0x1c93('0x23')][_0x1c93('0xc')](_0x59aeab)['then'](function(_0x195931){logger[_0x1c93('0xe')](_0x1c93('0xf'),_0x3a0729,_0x59aeab[_0x1c93('0x10')]);})[_0x1c93('0x11')](function(_0x37e566){logger['error'](_0x1c93('0xf'),_0x3a0729,JSON['stringify'](_0x37e566));})[_0x1c93('0x24')](function(){logger[_0x1c93('0xe')](_0x1c93('0x25'),_0x3a0729);_0x13e70a[_0x1c93('0x26')]();});}else{logger[_0x1c93('0xe')](_0x1c93('0x27'),_0x3a0729);_0x13e70a['stop']();}}else{var _0x3b745f=this;var _0x4b6dac=_0x3f6343[0x2]['replace'](/\\n/g,'\x0a');var _0x33608d={'credentials':{'private_key':_0x4b6dac,'client_email':_0x3f6343[0x1]}};var _0x5229d5=new dialogflow[(_0x1c93('0x28'))](_0x33608d);var _0x4f57a8=_0x5229d5[_0x1c93('0x29')](_0x3f6343[0x0],md5(_0x3b745f[_0x1c93('0x13')]['id']));var _0x33d9ab={'session':_0x4f57a8,'queryInput':{'text':{'text':_0x3b745f[_0x1c93('0x2a')][_0x1c93('0x10')],'languageCode':_0x3f6343[0x3]||'en'}}};return _0x5229d5[_0x1c93('0x2b')](_0x33d9ab)[_0x1c93('0xd')](function(_0x27eaae){if(_0x27eaae&&_0x27eaae[_0x1c93('0x2c')]){_0x3b745f[_0x1c93('0x10')][_0x1c93('0x2d')]=_0x27eaae;var _0x1d23c1=_0x27eaae[0x0];var _0x538286=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x2f')]&&_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x2f')][_0x1c93('0x30')]?_0x1d23c1[_0x1c93('0x2e')]['diagnosticInfo'][_0x1c93('0x30')][_0x1c93('0x31')][_0x1c93('0x32')]:![];_0x3b745f['body']['DIALOGFLOWV2_ACTION']=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x33')];_0x3b745f['body'][_0x1c93('0x34')]=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x35')];_0x3b745f['body'][_0x1c93('0x36')]=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x2f')]&&_0x1d23c1['queryResult'][_0x1c93('0x2f')][_0x1c93('0x30')]?_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x2f')][_0x1c93('0x30')][_0x1c93('0x31')]['boolValue']:![];_0x3b745f[_0x1c93('0x10')]['DIALOGFLOWV2_INTENTNAME']=_0x1d23c1[_0x1c93('0x2e')]['intent'][_0x1c93('0x37')];_0x3b745f[_0x1c93('0x10')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x38')]['displayName'];_0x3b745f[_0x1c93('0x10')][_0x1c93('0x39')]=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x38')][_0x1c93('0x3a')];_0x3b745f[_0x1c93('0x10')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x3b')];_0x3b745f[_0x1c93('0x10')][_0x1c93('0x3c')]=_0x1d23c1[_0x1c93('0x2e')][_0x1c93('0x3d')];_0x3b745f[_0x1c93('0x10')][_0x1c93('0x3e')]=_0x1d23c1['queryResult'][_0x1c93('0x3f')];_0x59aeab[_0x1c93('0x40')]=_0x1c93('0x2d');_0x59aeab[_0x1c93('0x41')]=JSON['stringify'](_0x27eaae);var _0x183941=[];for(var _0x4afea2=0x0;_0x4afea2<_0x27eaae[_0x1c93('0x2c')];_0x4afea2++){var _0x5898bf=_0x27eaae[_0x4afea2];if(_0x5898bf&&_0x5898bf[_0x1c93('0x2e')]&&_0x5898bf['queryResult'][_0x1c93('0x42')]){_0x183941[_0x1c93('0x43')](createMessage(_0x3a0729,_0x17764c,_0x59aeab,_0x5898bf[_0x1c93('0x2e')][_0x1c93('0x42')]));}}return Promise['all'](_0x183941)[_0x1c93('0xd')](function(){if(_0x538286){_0x13e70a['next']();}else{_0x13e70a[_0x1c93('0x26')]();}})[_0x1c93('0x11')](function(_0x15fe1a){logger[_0x1c93('0x44')](_0x1c93('0xf'),_0x3a0729,JSON[_0x1c93('0x45')](_0x15fe1a));_0x13e70a[_0x1c93('0x46')]();});}})[_0x1c93('0x11')](function(_0xbb8b53){logger[_0x1c93('0x44')](_0x1c93('0xf'),_0x3a0729,_0xbb8b53[_0x1c93('0x2a')]);_0x13e70a[_0x1c93('0x46')]();});}}catch(_0xcaf617){logger['error'](_0x1c93('0xf'),_0x3a0729,JSON[_0x1c93('0x45')](_0xcaf617));_0x13e70a[_0x1c93('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index c31cd7d..03b401e 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c59=['next','lodash','html-to-text','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0c59,0x191));var _0x90c5=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x0c59[_0x1b02bb];return _0x131245;};'use strict';var schema=require('validate');var _=require(_0x90c5('0x0'));var htmlToText=require(_0x90c5('0x1'));var utils=require('./utils');var logger=require(_0x90c5('0x2'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x90c5('0x3')},'priorityTrue':{'type':_0x90c5('0x4'),'message':_0x90c5('0x5')},'priorityFalse':{'type':_0x90c5('0x4'),'message':_0x90c5('0x6')}});exports[_0x90c5('0x7')]=function(_0x57f7a9,_0x581d73){return function(_0x260996){try{var _0x73b097={'condition':htmlToText['fromString'](utils[_0x90c5('0x8')](_0x581d73[0x0],this),{'wordwrap':![]})[_0x90c5('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x581d73[0x1],'priorityFalse':_0x581d73[0x2]};var _0x184408=gotoif['validate'](_0x73b097,{'typecast':!![]});if(_0x184408[_0x90c5('0xa')]){logger[_0x90c5('0xb')](_0x90c5('0xc'),_0x57f7a9,_[_0x90c5('0xd')](_0x184408,_0x90c5('0xe'))[_0x90c5('0xf')](',\x20'));_0x260996[_0x90c5('0x10')]();}else{try{var _0x380002=eval('('+_0x73b097[_0x90c5('0x11')]+')');var _0x211661=_0x380002?_0x73b097[_0x90c5('0x12')]:_0x73b097[_0x90c5('0x13')];logger['info'](_0x90c5('0x14'),_0x57f7a9,_0x73b097[_0x90c5('0x11')],_0x380002,_0x211661||'next');if(_0x211661){var _0x53b51c=_['findIndex'](_0x260996[_0x90c5('0x15')](),{'p':_0x211661});if(_0x53b51c>=0x0){logger[_0x90c5('0x16')](_0x90c5('0x17'),_0x57f7a9,_0x211661||_0x90c5('0x18'),_0x53b51c);_0x260996[_0x90c5('0x18')](_0x53b51c);}else{logger[_0x90c5('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x57f7a9,_0x211661||_0x90c5('0x18'));_0x260996['stop']();}}else{_0x260996[_0x90c5('0x18')]();}}catch(_0x2b0bf1){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x57f7a9,_0x2b0bf1[_0x90c5('0xe')]);_0x260996[_0x90c5('0x10')]();}}}catch(_0x57ed50){logger[_0x90c5('0xb')](_0x90c5('0xc'),_0x57f7a9,JSON['stringify'](_0x57ed50));_0x260996[_0x90c5('0x10')]();}};}; \ No newline at end of file +var _0x4acf=['getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number'];(function(_0x4926da,_0x4ce035){var _0x4daea3=function(_0x1880d1){while(--_0x1880d1){_0x4926da['push'](_0x4926da['shift']());}};_0x4daea3(++_0x4ce035);}(_0x4acf,0x70));var _0xf4ac=function(_0x2b3394,_0x3eebf8){_0x2b3394=_0x2b3394-0x0;var _0x534991=_0x4acf[_0x2b3394];return _0x534991;};'use strict';var schema=require(_0xf4ac('0x0'));var _=require(_0xf4ac('0x1'));var htmlToText=require(_0xf4ac('0x2'));var utils=require('./utils');var logger=require(_0xf4ac('0x3'))(_0xf4ac('0x4'));var gotoif=schema({'condition':{'type':_0xf4ac('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0xf4ac('0x6')},'priorityFalse':{'type':_0xf4ac('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x31348c,_0xf5bfc9){return function(_0x3bb631){try{var _0xcde114={'condition':htmlToText['fromString'](utils[_0xf4ac('0x8')](_0xf5bfc9[0x0],this),{'wordwrap':![]})[_0xf4ac('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xf5bfc9[0x1],'priorityFalse':_0xf5bfc9[0x2]};var _0x249a9f=gotoif[_0xf4ac('0x0')](_0xcde114,{'typecast':!![]});if(_0x249a9f[_0xf4ac('0xa')]){logger[_0xf4ac('0xb')](_0xf4ac('0xc'),_0x31348c,_[_0xf4ac('0xd')](_0x249a9f,_0xf4ac('0xe'))[_0xf4ac('0xf')](',\x20'));_0x3bb631[_0xf4ac('0x10')]();}else{try{var _0x2c9da0=eval('('+_0xcde114[_0xf4ac('0x11')]+')');var _0x2e142d=_0x2c9da0?_0xcde114['priorityTrue']:_0xcde114[_0xf4ac('0x12')];logger[_0xf4ac('0x13')](_0xf4ac('0x14'),_0x31348c,_0xcde114[_0xf4ac('0x11')],_0x2c9da0,_0x2e142d||'next');if(_0x2e142d){var _0x3c0c83=_['findIndex'](_0x3bb631[_0xf4ac('0x15')](),{'p':_0x2e142d});if(_0x3c0c83>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x31348c,_0x2e142d||_0xf4ac('0x16'),_0x3c0c83);_0x3bb631['next'](_0x3c0c83);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x31348c,_0x2e142d||_0xf4ac('0x16'));_0x3bb631[_0xf4ac('0x10')]();}}else{_0x3bb631['next']();}}catch(_0x59ebec){logger[_0xf4ac('0xb')](_0xf4ac('0x17'),_0x31348c,_0x59ebec[_0xf4ac('0xe')]);_0x3bb631[_0xf4ac('0x10')]();}}}catch(_0x3f86d2){logger['error'](_0xf4ac('0xc'),_0x31348c,JSON['stringify'](_0x3f86d2));_0x3bb631[_0xf4ac('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 155cc35..b024a35 100644 --- a/server/services/routing/server/applications/gotop.js +++ b/server/services/routing/server/applications/gotop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6464=['validate','error','[%s][GOTOP]\x20%s','map','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x2065bd,_0x508c24){var _0x3171dc=function(_0x25690e){while(--_0x25690e){_0x2065bd['push'](_0x2065bd['shift']());}};_0x3171dc(++_0x508c24);}(_0x6464,0x74));var _0x4646=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6464[_0x2641f9];return _0x585741;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0x4646('0x0'));var gotop=schema({'priority':{'type':_0x4646('0x1'),'required':!![],'message':_0x4646('0x2')}});exports[_0x4646('0x3')]=function(_0x128f65,_0x18cb66){return function(_0x515122){try{var _0x1ddfd1={'priority':_0x18cb66[0x0]};var _0x534f38=gotop[_0x4646('0x4')](_0x1ddfd1,{'typecast':!![]});if(_0x534f38['length']){logger[_0x4646('0x5')](_0x4646('0x6'),_0x128f65,_[_0x4646('0x7')](_0x534f38,'message')['join'](',\x20'));_0x515122[_0x4646('0x8')]();}else{logger[_0x4646('0x9')](_0x4646('0xa'),_0x128f65,_0x1ddfd1[_0x4646('0xb')]);if(_0x1ddfd1[_0x4646('0xb')]){var _0x4c6497=_[_0x4646('0xc')](_0x515122['rules'](),{'p':_0x1ddfd1[_0x4646('0xb')]});if(_0x4c6497>=0x0){logger[_0x4646('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x128f65,_0x1ddfd1['priority']||_0x4646('0xd'),_0x4c6497);_0x515122[_0x4646('0xd')](_0x4c6497);}else{logger[_0x4646('0x9')](_0x4646('0xe'),_0x128f65,_0x1ddfd1[_0x4646('0xb')]||'next');_0x515122['stop']();}}else{_0x515122[_0x4646('0xd')]();}}}catch(_0x4d839d){logger['error'](_0x4646('0x6'),_0x128f65,JSON['stringify'](_0x4d839d));_0x515122[_0x4646('0x8')]();}};}; \ No newline at end of file +var _0xdacf=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0xdacf,0x1b8));var _0xfdac=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xdacf[_0x40a045];return _0x1a687c;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0xfdac('0x0'));var gotop=schema({'priority':{'type':_0xfdac('0x1'),'required':!![],'message':_0xfdac('0x2')}});exports[_0xfdac('0x3')]=function(_0x2fbf34,_0x3ccae5){return function(_0x554ee8){try{var _0x31f699={'priority':_0x3ccae5[0x0]};var _0x467574=gotop['validate'](_0x31f699,{'typecast':!![]});if(_0x467574[_0xfdac('0x4')]){logger[_0xfdac('0x5')]('[%s][GOTOP]\x20%s',_0x2fbf34,_['map'](_0x467574,_0xfdac('0x6'))[_0xfdac('0x7')](',\x20'));_0x554ee8[_0xfdac('0x8')]();}else{logger[_0xfdac('0x9')](_0xfdac('0xa'),_0x2fbf34,_0x31f699['priority']);if(_0x31f699[_0xfdac('0xb')]){var _0x3d2e1f=_[_0xfdac('0xc')](_0x554ee8[_0xfdac('0xd')](),{'p':_0x31f699['priority']});if(_0x3d2e1f>=0x0){logger[_0xfdac('0x9')](_0xfdac('0xe'),_0x2fbf34,_0x31f699[_0xfdac('0xb')]||_0xfdac('0xf'),_0x3d2e1f);_0x554ee8[_0xfdac('0xf')](_0x3d2e1f);}else{logger[_0xfdac('0x9')](_0xfdac('0x10'),_0x2fbf34,_0x31f699[_0xfdac('0xb')]||_0xfdac('0xf'));_0x554ee8['stop']();}}else{_0x554ee8[_0xfdac('0xf')]();}}}catch(_0x494289){logger[_0xfdac('0x5')](_0xfdac('0x11'),_0x2fbf34,JSON[_0xfdac('0x12')](_0x494289));_0x554ee8[_0xfdac('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index da07b43..6a23d87 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75a2=['Message','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','channel','upperFirst'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x75a2,0x85));var _0x275a=function(_0x28805a,_0x2de2ae){_0x28805a=_0x28805a-0x0;var _0x1ad7e0=_0x75a2[_0x28805a];return _0x1ad7e0;};'use strict';var _=require(_0x275a('0x0'));var utils=require(_0x275a('0x1'));var logger=require(_0x275a('0x2'))(_0x275a('0x3'));var rpc={'chatMessage':require(_0x275a('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x275a('0x5')),'smsMessage':require(_0x275a('0x6')),'faxMessage':require(_0x275a('0x7')),'whatsappMessage':require(_0x275a('0x8'))};exports[_0x275a('0x9')]=function(_0x59d1aa,_0x4548ca){return function(_0x5dd171){try{var _0xacc225={'body':utils[_0x275a('0xa')](_0x4548ca[0x0],this),'ContactId':this[_0x275a('0xb')]['id']};if(this['channel']===_0x275a('0xc')){_0xacc225[_0x275a('0xd')]=this[_0x275a('0xe')]['id'];}else{_0xacc225[_['upperFirst'](this[_0x275a('0xf')])+'AccountId']=this['account']['id'];}_0xacc225[_[_0x275a('0x10')](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x275a('0xf')]+_0x275a('0x11')]){return rpc[this[_0x275a('0xf')]+_0x275a('0x11')]['create'](_0xacc225)['then'](function(_0x4608d1){logger[_0x275a('0x12')](_0x275a('0x13'),_0x59d1aa,_0xacc225['body']);_0x5dd171[_0x275a('0x14')]();})[_0x275a('0x15')](function(_0x22126d){logger[_0x275a('0x16')](_0x275a('0x13'),_0x59d1aa,JSON[_0x275a('0x17')](_0x22126d));_0x5dd171[_0x275a('0x18')]();});}}catch(_0x197183){logger[_0x275a('0x16')](_0x275a('0x13'),_0x59d1aa,JSON[_0x275a('0x17')](_0x197183));_0x5dd171[_0x275a('0x18')]();}};}; \ No newline at end of file +var _0x6de9=['../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','create','then','info','next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','./utils','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6de9,0xe6));var _0x96de=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6de9[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x96de('0x0'));var utils=require(_0x96de('0x1'));var logger=require(_0x96de('0x2'))(_0x96de('0x3'));var rpc={'chatMessage':require(_0x96de('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x96de('0x5')),'smsMessage':require(_0x96de('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x96de('0x7'))};exports[_0x96de('0x8')]=function(_0x4b61bc,_0x84f9b0){return function(_0x24da4e){try{var _0x20ed57={'body':utils[_0x96de('0x9')](_0x84f9b0[0x0],this),'ContactId':this['contact']['id']};if(this[_0x96de('0xa')]===_0x96de('0xb')){_0x20ed57[_0x96de('0xc')]=this['account']['id'];}else{_0x20ed57[_[_0x96de('0xd')](this[_0x96de('0xa')])+_0x96de('0xe')]=this['account']['id'];}_0x20ed57[_['upperFirst'](this[_0x96de('0xa')])+_0x96de('0xf')]=this['interaction']['id'];if(rpc[this[_0x96de('0xa')]+_0x96de('0x10')]){return rpc[this['channel']+'Message'][_0x96de('0x11')](_0x20ed57)[_0x96de('0x12')](function(_0x54d1bf){logger[_0x96de('0x13')]('[%s][MESSAGE]\x20%s',_0x4b61bc,_0x20ed57['body']);_0x24da4e[_0x96de('0x14')]();})[_0x96de('0x15')](function(_0x1a8935){logger[_0x96de('0x16')](_0x96de('0x17'),_0x4b61bc,JSON['stringify'](_0x1a8935));_0x24da4e[_0x96de('0x18')]();});}}catch(_0x3d9409){logger[_0x96de('0x16')](_0x96de('0x17'),_0x4b61bc,JSON[_0x96de('0x19')](_0x3d9409));_0x24da4e[_0x96de('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index fa0b81b..5ce76df 100644 --- a/server/services/routing/server/applications/noop.js +++ b/server/services/routing/server/applications/noop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b38=['error','stringify','./utils','../../../../config/logger','consequence','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x225d44,_0x399b52){var _0x4aa98a=function(_0xeffa74){while(--_0xeffa74){_0x225d44['push'](_0x225d44['shift']());}};_0x4aa98a(++_0x399b52);}(_0x8b38,0x18a));var _0x88b3=function(_0x45e18e,_0x47cc4d){_0x45e18e=_0x45e18e-0x0;var _0x175e61=_0x8b38[_0x45e18e];return _0x175e61;};'use strict';var utils=require(_0x88b3('0x0'));var logger=require(_0x88b3('0x1'))('routing');exports[_0x88b3('0x2')]=function(_0x3f05e5,_0x50b672){return function(_0x2c82fc){try{logger['info'](_0x88b3('0x3'),_0x3f05e5,utils[_0x88b3('0x4')](_0x50b672[0x0],this));_0x2c82fc[_0x88b3('0x5')]();}catch(_0x4c737b){logger[_0x88b3('0x6')]('[%s][NOOP]\x20%s',_0x3f05e5,JSON[_0x88b3('0x7')](_0x4c737b));_0x2c82fc['stop']();}};}; \ No newline at end of file +var _0x655a=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0x655a,0xe1));var _0xa655=function(_0x40b424,_0x3a9872){_0x40b424=_0x40b424-0x0;var _0x34c63a=_0x655a[_0x40b424];return _0x34c63a;};'use strict';var utils=require('./utils');var logger=require(_0xa655('0x0'))(_0xa655('0x1'));exports[_0xa655('0x2')]=function(_0xdc66d5,_0x32ac60){return function(_0x38eb0b){try{logger[_0xa655('0x3')](_0xa655('0x4'),_0xdc66d5,utils[_0xa655('0x5')](_0x32ac60[0x0],this));_0x38eb0b[_0xa655('0x6')]();}catch(_0x589099){logger[_0xa655('0x7')](_0xa655('0x4'),_0xdc66d5,JSON[_0xa655('0x8')](_0x589099));_0x38eb0b[_0xa655('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2e843c4..e18c50b 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa48b=['from','joinAt','emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','find','Queues','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','log','[%s][QUEUE]\x20%s','validate','util','moment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue'];(function(_0x530f66,_0x41bcb7){var _0x23a441=function(_0x24c67f){while(--_0x24c67f){_0x530f66['push'](_0x530f66['shift']());}};_0x23a441(++_0x41bcb7);}(_0xa48b,0xde));var _0xba48=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0xa48b[_0x5734e1];return _0x22c784;};'use strict';var schema=require(_0xba48('0x0'));var _=require('lodash');var util=require(_0xba48('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xba48('0x2'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xba48('0x3'));var strategy=require(_0xba48('0x4'));config[_0xba48('0x5')]=_[_0xba48('0x6')](config[_0xba48('0x5')],{'host':_0xba48('0x7'),'port':0x18eb});var io=require(_0xba48('0x8'))(new Redis(config[_0xba48('0x5')]));var attributes=['id',_0xba48('0x9'),_0xba48('0xa'),_0xba48('0xb'),_0xba48('0xc'),_0xba48('0xd')];function emit(_0x402fa7,_0x20cdd9,_0x40409a){io['to'](_0x402fa7)[_0xba48('0xe')](_0x20cdd9,_0x40409a);}function emitChannelQueueInteraction(_0x4134ea,_0x283186,_0x1cb98a,_0x360808,_0x4d41a6,_0x147aa9,_0x554740,_0x48ed6f){var _0xdb417b=_[_0xba48('0xf')](_0x1cb98a);_0xdb417b[_0xba48('0x9')]=_0x48ed6f;_0xdb417b[_0xba48('0xb')]=_0x283186;_0xdb417b[_0xba48('0xa')]=_0x360808;_0xdb417b['id']=_0x4d41a6;if(_0x147aa9){attributes[_0xba48('0x10')](_[_0xba48('0x11')](_0x4134ea)+_0xba48('0x12'));_0x554740[util[_0xba48('0x13')](_0xba48('0x14'),_0x4134ea)][_0x4d41a6]=_[_0xba48('0x15')](_0xdb417b,attributes);}else{delete _0x554740[util[_0xba48('0x13')](_0xba48('0x14'),_0x4134ea)][_0x4d41a6];}emit(util[_0xba48('0x13')](_0xba48('0x16'),_0x4134ea,_0x283186),util['format'](_0xba48('0x17'),_0x4134ea,_0x147aa9?_0xba48('0x18'):_0xba48('0x19')),_[_0xba48('0x15')](_0xdb417b,attributes));}var rpc={'openchannelQueueReport':require(_0xba48('0x1a')),'mailQueueReport':require(_0xba48('0x1b')),'chatQueueReport':require(_0xba48('0x1c')),'smsQueueReport':require(_0xba48('0x1d')),'faxQueueReport':require(_0xba48('0x1e')),'whatsappQueueReport':require(_0xba48('0x1f'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xba48('0x20')},'timeout':{'type':'number','message':_0xba48('0x21')}});function startRouting(_0x34baba,_0x4f7dd3,_0x5e5d80,_0x1a047e){if(_0x34baba&&_0x4f7dd3&&_0x5e5d80){_0x4f7dd3[_0xba48('0x22')]+=0x1;var _0xadde58={'uniqueid':_0x34baba,'from':_0x5e5d80['body']?_0x5e5d80[_0xba48('0x23')][_0xba48('0xc')]:'','joinAt':moment()['format'](_0xba48('0x24')),'ContactId':_0x5e5d80[_0xba48('0x25')]?_0x5e5d80[_0xba48('0x25')]['id']:null,'ListId':_0x5e5d80[_0xba48('0x26')]?_0x5e5d80[_0xba48('0x26')]['id']:null};_0xadde58[_[_0xba48('0x27')](_0x5e5d80[_0xba48('0x28')])+_0xba48('0x29')]=_0x4f7dd3['id']||null;_0xadde58[_['upperFirst'](_0x5e5d80[_0xba48('0x28')])+_0xba48('0x12')]=_0x5e5d80[_0xba48('0x2a')]?_0x5e5d80[_0xba48('0x2a')]['id']:null;_0xadde58[_[_0xba48('0x27')](_0x5e5d80[_0xba48('0x28')])+_0xba48('0x2b')]=_0x5e5d80[_0xba48('0x2c')]?_0x5e5d80[_0xba48('0x2c')]['id']:null;_0xadde58[_[_0xba48('0x27')](_0x5e5d80[_0xba48('0x28')])+(_0x5e5d80[_0xba48('0x28')]!==_0xba48('0x2d')?'AccountId':'WebsiteId')]=_0x5e5d80[_0xba48('0xa')]?_0x5e5d80[_0xba48('0xa')]['id']:null;logger[_0xba48('0x2e')](util[_0xba48('0x13')](_0xba48('0x2f'),_0x34baba,_0x4f7dd3[_0xba48('0x30')]));emitChannelQueueInteraction(_0x5e5d80['channel'],_0x4f7dd3[_0xba48('0x30')],_0xadde58,_0x5e5d80[_0xba48('0xa')][_0xba48('0x30')],_0x5e5d80[_0xba48('0x2c')]['id'],!![],_0x1a047e,_0x4f7dd3['id']);if(rpc[_0x5e5d80['channel']+'QueueReport']){return rpc[_0x5e5d80[_0xba48('0x28')]+_0xba48('0x31')][_0xba48('0x32')](_0xadde58)[_0xba48('0x33')](function(_0x1116e5){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x359d57,_0x1c6623,_0x437c4c,_0x100b31){if(_0x359d57&&_0x1c6623){_0x1c6623[_0xba48('0x22')]-=0x1;var _0x8b2108={'leaveAt':moment()[_0xba48('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xba48('0x34')};logger[_0xba48('0x2e')](util['format'](_0xba48('0x35'),_0x359d57,_0x1c6623['name']));emitChannelQueueInteraction(_0x437c4c[_0xba48('0x28')],_0x1c6623[_0xba48('0x30')],_0x437c4c['body'],_0x437c4c[_0xba48('0xa')][_0xba48('0x30')],_0x437c4c['message']['id'],![],_0x100b31,_0x1c6623['id']);if(rpc[_0x437c4c[_0xba48('0x28')]+_0xba48('0x31')]){return rpc[_0x437c4c[_0xba48('0x28')]+_0xba48('0x31')][_0xba48('0x36')](_0x359d57,_0x8b2108)[_0xba48('0x33')](function(_0x27559b){logger[_0xba48('0x37')](_0xba48('0x38'));});}}}function endRouting(_0x20143f,_0x337d6d,_0x5405e2,_0x4b468f){if(_0x20143f&&_0x337d6d){_0x337d6d[_0xba48('0x22')]-=0x1;var _0x27b0fe={'leaveAt':moment()['format'](_0xba48('0x24')),'exitAt':moment()[_0xba48('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xba48('0x39')};logger[_0xba48('0x2e')](util[_0xba48('0x13')](_0xba48('0x3a'),_0x20143f,_0x337d6d['name']));emitChannelQueueInteraction(_0x5405e2[_0xba48('0x28')],_0x337d6d[_0xba48('0x30')],_0x5405e2[_0xba48('0x23')],_0x5405e2[_0xba48('0xa')][_0xba48('0x30')],_0x5405e2['message']['id'],![],_0x4b468f);if(rpc[_0x5405e2[_0xba48('0x28')]+'QueueReport']){return rpc[_0x5405e2['channel']+_0xba48('0x31')][_0xba48('0x36')](_0x20143f,_0x27b0fe)[_0xba48('0x33')](function(_0x39ccdf){logger[_0xba48('0x37')](_0xba48('0x38'));});}}}function handleFindQueue(_0x54e01a){return function(_0x40bb62){return _0x40bb62['name'][_0xba48('0x3b')]()===_0x54e01a[_0xba48('0x3b')]();};}exports[_0xba48('0x3c')]=function(_0xfa1f7b,_0x2f7f97,_0x1bc617,_0xc2ff09){return function(_0x3f01a5){try{var _0x587475={'name':_0x2f7f97[0x0],'timeout':_0x2f7f97[0x1]};var _0xff07db=queue['validate'](_0x587475,{'typecast':!![]});if(_0xff07db[_0xba48('0x3d')]){logger[_0xba48('0x37')]('[%s][QUEUE]\x20%s',_0xfa1f7b,_[_0xba48('0x3e')](_0xff07db,'message')[_0xba48('0x3f')](',\x20'));_0x3f01a5[_0xba48('0x40')]();}else{var _0x12de3d=_[_0xba48('0x41')](_0x1bc617[_0xc2ff09['channel']+_0xba48('0x42')],handleFindQueue(_0x587475[_0xba48('0x30')]));if(_0x12de3d){startRouting(_0xfa1f7b,_0x12de3d,_0xc2ff09,_0x1bc617);var _0x3c42d0=(_0x12de3d[_0xba48('0x39')]||0xa)*0x3e8;var _0x3882c0=(_0x587475[_0xba48('0x39')]||0x14)*0x3e8;var _0x2722c9;if(_0x3c42d0>_0x3882c0){_0x3882c0=_0x3c42d0;}var _0x1440ed=seqqueue['createQueue'](_0x3c42d0);_0x1440ed['id']=_0xfa1f7b;_0x1440ed['atimeout']=_0x3c42d0;_0x1440ed[_0xba48('0x43')]=_0x3882c0;_0x1440ed[_0xba48('0x28')]=_0xc2ff09[_0xba48('0x28')];_0x1bc617[_0xba48('0x44')][_0xfa1f7b]['on'](_0xba48('0x45'),function(){logger[_0xba48('0x2e')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xfa1f7b);stopRouting(_0xfa1f7b,_0x12de3d,_0xc2ff09,_0x1bc617);clearTimeout(_0x2722c9);_0x2722c9=undefined;_0x1440ed[_0xba48('0x46')](!![]);if(_0x1bc617[_0xba48('0x44')][_0xfa1f7b]){delete _0x1bc617[_0xba48('0x44')][_0xfa1f7b];}_0x3f01a5[_0xba48('0x40')]();});_0x1bc617[_0xba48('0x44')][_0xfa1f7b]['on'](_0xba48('0x47'),function(){if(_0x1bc617[_0xba48('0x44')][_0xfa1f7b]){delete _0x1bc617[_0xba48('0x44')][_0xfa1f7b];}});_0x2722c9=setTimeout(function(){logger[_0xba48('0x2e')](_0xba48('0x48'),_0xfa1f7b);endRouting(_0xfa1f7b,_0x12de3d,_0xc2ff09,_0x1bc617);clearTimeout(_0x2722c9);_0x1440ed[_0xba48('0x46')](!![]);_0x3f01a5[_0xba48('0x49')]();},_0x3882c0);switch(_0x12de3d[_0xba48('0x4a')]){case _0xba48('0x4b'):strategy['rrmemory'](_0x1440ed,_0x12de3d,_0x1bc617,_0xc2ff09);break;default:strategy['beepall'](_0x1440ed,_0x12de3d,_0x1bc617,_0xc2ff09);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xfa1f7b,_0x587475[_0xba48('0x30')]);_0x3f01a5[_0xba48('0x40')]();}}}catch(_0x1365fa){console[_0xba48('0x4c')](_0x1365fa);logger[_0xba48('0x37')](_0xba48('0x4d'),_0xfa1f7b,_0x1365fa['stack']);_0x3f01a5[_0xba48('0x40')]();}};}; \ No newline at end of file +var _0x2a8a=['validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','../../../../config/environment','./strategy','defaults','redis','localhost','account','from','joinAt','emit','clone','queue_id','queue','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update','update\x20queue\x20report','timeout','toLowerCase','consequence'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x2a8a,0xaf));var _0xa2a8=function(_0x3d7090,_0x8a40a2){_0x3d7090=_0x3d7090-0x0;var _0x433080=_0x2a8a[_0x3d7090];return _0x433080;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xa2a8('0x0'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xa2a8('0x1'));config['redis']=_[_0xa2a8('0x2')](config[_0xa2a8('0x3')],{'host':_0xa2a8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa2a8('0x3')]));var attributes=['id','queue_id',_0xa2a8('0x5'),'queue',_0xa2a8('0x6'),_0xa2a8('0x7')];function emit(_0x151378,_0x354ee5,_0x1bc462){io['to'](_0x151378)[_0xa2a8('0x8')](_0x354ee5,_0x1bc462);}function emitChannelQueueInteraction(_0x4cb01a,_0x1b8334,_0x2016ad,_0x1d78ad,_0x3f82e8,_0x4fc349,_0x250ed2,_0x2870a5){var _0x2da09b=_[_0xa2a8('0x9')](_0x2016ad);_0x2da09b[_0xa2a8('0xa')]=_0x2870a5;_0x2da09b[_0xa2a8('0xb')]=_0x1b8334;_0x2da09b[_0xa2a8('0x5')]=_0x1d78ad;_0x2da09b['id']=_0x3f82e8;if(_0x4fc349){attributes[_0xa2a8('0xc')](_[_0xa2a8('0xd')](_0x4cb01a)+_0xa2a8('0xe'));_0x250ed2[util['format'](_0xa2a8('0xf'),_0x4cb01a)][_0x3f82e8]=_[_0xa2a8('0x10')](_0x2da09b,attributes);}else{delete _0x250ed2[util[_0xa2a8('0x11')](_0xa2a8('0xf'),_0x4cb01a)][_0x3f82e8];}emit(util[_0xa2a8('0x11')](_0xa2a8('0x12'),_0x4cb01a,_0x1b8334),util[_0xa2a8('0x11')]('%s_queue_waiting_interaction:%s',_0x4cb01a,_0x4fc349?'save':_0xa2a8('0x13')),_[_0xa2a8('0x10')](_0x2da09b,attributes));}var rpc={'openchannelQueueReport':require(_0xa2a8('0x14')),'mailQueueReport':require(_0xa2a8('0x15')),'chatQueueReport':require(_0xa2a8('0x16')),'smsQueueReport':require(_0xa2a8('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa2a8('0x18'))};var queue=schema({'name':{'type':_0xa2a8('0x19'),'required':!![],'message':_0xa2a8('0x1a')},'timeout':{'type':_0xa2a8('0x1b'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x48ac70,_0x1d34e4,_0x384af4,_0x2b1c64){if(_0x48ac70&&_0x1d34e4&&_0x384af4){_0x1d34e4[_0xa2a8('0x1c')]+=0x1;var _0x3198b4={'uniqueid':_0x48ac70,'from':_0x384af4[_0xa2a8('0x1d')]?_0x384af4[_0xa2a8('0x1d')][_0xa2a8('0x6')]:'','joinAt':moment()[_0xa2a8('0x11')](_0xa2a8('0x1e')),'ContactId':_0x384af4[_0xa2a8('0x1f')]?_0x384af4[_0xa2a8('0x1f')]['id']:null,'ListId':_0x384af4[_0xa2a8('0x20')]?_0x384af4[_0xa2a8('0x20')]['id']:null};_0x3198b4[_[_0xa2a8('0x21')](_0x384af4['channel'])+_0xa2a8('0x22')]=_0x1d34e4['id']||null;_0x3198b4[_[_0xa2a8('0x21')](_0x384af4[_0xa2a8('0x23')])+_0xa2a8('0xe')]=_0x384af4[_0xa2a8('0x24')]?_0x384af4[_0xa2a8('0x24')]['id']:null;_0x3198b4[_[_0xa2a8('0x21')](_0x384af4[_0xa2a8('0x23')])+_0xa2a8('0x25')]=_0x384af4[_0xa2a8('0x26')]?_0x384af4['message']['id']:null;_0x3198b4[_['upperFirst'](_0x384af4['channel'])+(_0x384af4[_0xa2a8('0x23')]!==_0xa2a8('0x27')?_0xa2a8('0x28'):_0xa2a8('0x29'))]=_0x384af4['account']?_0x384af4['account']['id']:null;logger[_0xa2a8('0x2a')](util[_0xa2a8('0x11')](_0xa2a8('0x2b'),_0x48ac70,_0x1d34e4[_0xa2a8('0x2c')]));emitChannelQueueInteraction(_0x384af4[_0xa2a8('0x23')],_0x1d34e4[_0xa2a8('0x2c')],_0x3198b4,_0x384af4[_0xa2a8('0x5')][_0xa2a8('0x2c')],_0x384af4[_0xa2a8('0x26')]['id'],!![],_0x2b1c64,_0x1d34e4['id']);if(rpc[_0x384af4[_0xa2a8('0x23')]+_0xa2a8('0x2d')]){return rpc[_0x384af4[_0xa2a8('0x23')]+'QueueReport'][_0xa2a8('0x2e')](_0x3198b4)[_0xa2a8('0x2f')](function(_0x3529ba){logger[_0xa2a8('0x30')](_0xa2a8('0x31'));});}}}function stopRouting(_0x57e1c6,_0x137000,_0x24a73f,_0x3a9746){if(_0x57e1c6&&_0x137000){_0x137000[_0xa2a8('0x1c')]-=0x1;var _0x208f2a={'leaveAt':moment()[_0xa2a8('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xa2a8('0x11')](_0xa2a8('0x1e')),'reason':_0xa2a8('0x32')};logger['info'](util[_0xa2a8('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x57e1c6,_0x137000['name']));emitChannelQueueInteraction(_0x24a73f['channel'],_0x137000[_0xa2a8('0x2c')],_0x24a73f['body'],_0x24a73f[_0xa2a8('0x5')]['name'],_0x24a73f[_0xa2a8('0x26')]['id'],![],_0x3a9746,_0x137000['id']);if(rpc[_0x24a73f['channel']+_0xa2a8('0x2d')]){return rpc[_0x24a73f[_0xa2a8('0x23')]+'QueueReport'][_0xa2a8('0x33')](_0x57e1c6,_0x208f2a)[_0xa2a8('0x2f')](function(_0x2ea055){logger['error'](_0xa2a8('0x34'));});}}}function endRouting(_0x5c5483,_0x2d1b7c,_0x1ee5ff,_0x4c3cb9){if(_0x5c5483&&_0x2d1b7c){_0x2d1b7c[_0xa2a8('0x1c')]-=0x1;var _0x24f3f5={'leaveAt':moment()[_0xa2a8('0x11')](_0xa2a8('0x1e')),'exitAt':moment()[_0xa2a8('0x11')](_0xa2a8('0x1e')),'reason':_0xa2a8('0x35')};logger[_0xa2a8('0x2a')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x5c5483,_0x2d1b7c[_0xa2a8('0x2c')]));emitChannelQueueInteraction(_0x1ee5ff[_0xa2a8('0x23')],_0x2d1b7c['name'],_0x1ee5ff[_0xa2a8('0x1d')],_0x1ee5ff[_0xa2a8('0x5')][_0xa2a8('0x2c')],_0x1ee5ff[_0xa2a8('0x26')]['id'],![],_0x4c3cb9);if(rpc[_0x1ee5ff[_0xa2a8('0x23')]+_0xa2a8('0x2d')]){return rpc[_0x1ee5ff[_0xa2a8('0x23')]+_0xa2a8('0x2d')][_0xa2a8('0x33')](_0x5c5483,_0x24f3f5)['catch'](function(_0x31cd1f){logger[_0xa2a8('0x30')](_0xa2a8('0x34'));});}}}function handleFindQueue(_0x48304d){return function(_0x8b353f){return _0x8b353f[_0xa2a8('0x2c')]['toLowerCase']()===_0x48304d[_0xa2a8('0x36')]();};}exports[_0xa2a8('0x37')]=function(_0x327491,_0x5c1f49,_0x234377,_0x15704e){return function(_0x31f4a5){try{var _0x2fdc1b={'name':_0x5c1f49[0x0],'timeout':_0x5c1f49[0x1]};var _0x41c41b=queue[_0xa2a8('0x38')](_0x2fdc1b,{'typecast':!![]});if(_0x41c41b[_0xa2a8('0x39')]){logger[_0xa2a8('0x30')](_0xa2a8('0x3a'),_0x327491,_[_0xa2a8('0x3b')](_0x41c41b,_0xa2a8('0x26'))[_0xa2a8('0x3c')](',\x20'));_0x31f4a5[_0xa2a8('0x3d')]();}else{var _0x98de7d=_[_0xa2a8('0x3e')](_0x234377[_0x15704e[_0xa2a8('0x23')]+_0xa2a8('0x3f')],handleFindQueue(_0x2fdc1b[_0xa2a8('0x2c')]));if(_0x98de7d){startRouting(_0x327491,_0x98de7d,_0x15704e,_0x234377);var _0x34ea56=(_0x98de7d[_0xa2a8('0x35')]||0xa)*0x3e8;var _0x3341f4=(_0x2fdc1b[_0xa2a8('0x35')]||0x14)*0x3e8;var _0x4ea44d;if(_0x34ea56>_0x3341f4){_0x3341f4=_0x34ea56;}var _0x2a0dd8=seqqueue['createQueue'](_0x34ea56);_0x2a0dd8['id']=_0x327491;_0x2a0dd8['atimeout']=_0x34ea56;_0x2a0dd8[_0xa2a8('0x40')]=_0x3341f4;_0x2a0dd8[_0xa2a8('0x23')]=_0x15704e[_0xa2a8('0x23')];_0x234377[_0xa2a8('0x41')][_0x327491]['on'](_0xa2a8('0x42'),function(){logger[_0xa2a8('0x2a')](_0xa2a8('0x43'),_0x327491);stopRouting(_0x327491,_0x98de7d,_0x15704e,_0x234377);clearTimeout(_0x4ea44d);_0x4ea44d=undefined;_0x2a0dd8['close'](!![]);if(_0x234377['rules'][_0x327491]){delete _0x234377[_0xa2a8('0x41')][_0x327491];}_0x31f4a5[_0xa2a8('0x3d')]();});_0x234377[_0xa2a8('0x41')][_0x327491]['on'](_0xa2a8('0x44'),function(){if(_0x234377[_0xa2a8('0x41')][_0x327491]){delete _0x234377['rules'][_0x327491];}});_0x4ea44d=setTimeout(function(){logger[_0xa2a8('0x2a')](_0xa2a8('0x45'),_0x327491);endRouting(_0x327491,_0x98de7d,_0x15704e,_0x234377);clearTimeout(_0x4ea44d);_0x2a0dd8[_0xa2a8('0x46')](!![]);_0x31f4a5[_0xa2a8('0x47')]();},_0x3341f4);switch(_0x98de7d[_0xa2a8('0x48')]){case _0xa2a8('0x49'):strategy['rrmemory'](_0x2a0dd8,_0x98de7d,_0x234377,_0x15704e);break;default:strategy[_0xa2a8('0x4a')](_0x2a0dd8,_0x98de7d,_0x234377,_0x15704e);}}else{logger[_0xa2a8('0x30')](_0xa2a8('0x4b'),_0x327491,_0x2fdc1b['name']);_0x31f4a5[_0xa2a8('0x3d')]();}}}catch(_0x4eb38f){console['log'](_0x4eb38f);logger['error'](_0xa2a8('0x3a'),_0x327491,_0x4eb38f[_0xa2a8('0x4c')]);_0x31f4a5[_0xa2a8('0x3d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 652b377..82ba254 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['routing','notificationId','agent','squeue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','forcedOwnership','channel','busy','saveWaitingNotification','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger'];(function(_0x12e983,_0x11e18c){var _0x1659dd=function(_0x59a4e8){while(--_0x59a4e8){_0x12e983['push'](_0x12e983['shift']());}};_0x1659dd(++_0x11e18c);}(_0x2d17,0x17e));var _0x72d1=function(_0x2c3b12,_0x482644){_0x2c3b12=_0x2c3b12-0x0;var _0x1f726c=_0x2d17[_0x2c3b12];return _0x1f726c;};'use strict';var _=require(_0x72d1('0x0'));var uuid=require(_0x72d1('0x1'));var util=require('./util');var logger=require(_0x72d1('0x2'))(_0x72d1('0x3'));var Agent=function(_0x531f4e,_0x3687bc,_0x38fec7,_0x55b722){this[_0x72d1('0x4')]=uuid['v4']();this['squeue']=_0x531f4e;this[_0x72d1('0x5')]=_0x3687bc;this['realtime']=_0x38fec7;this[_0x72d1('0x3')]=_0x55b722;this[_0x72d1('0x6')]['push'](this[_0x72d1('0x7')][_0x72d1('0x8')](this),this[_0x72d1('0x9')]['bind'](this));this[_0x72d1('0x6')]['on'](_0x72d1('0xa'),this[_0x72d1('0x9')]['bind'](this));this[_0x72d1('0x6')]['on'](_0x72d1('0xb'),this[_0x72d1('0xc')][_0x72d1('0x8')](this));};Agent[_0x72d1('0xd')][_0x72d1('0xe')]=function(){this[_0x72d1('0x6')][_0x72d1('0xe')](this[_0x72d1('0x7')][_0x72d1('0x8')](this),this['handleTimeout'][_0x72d1('0x8')](this));};Agent[_0x72d1('0xd')][_0x72d1('0xc')]=function(){this[_0x72d1('0x9')](!![]);};Agent[_0x72d1('0xd')][_0x72d1('0x7')]=function(){logger[_0x72d1('0xf')](_0x72d1('0x10'),this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);if(_[_0x72d1('0x11')](this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']])){logger[_0x72d1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);setTimeout(this['push'][_0x72d1('0x8')](this),0x3e8);}else{if(this[_0x72d1('0x3')][_0x72d1('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x72d1('0x12')][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],this[_0x72d1('0x6')][_0x72d1('0x15')],![])){this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']][_0x72d1('0x16')]=!![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x72d1('0x17')](this[_0x72d1('0x12')],this['routing'],this[_0x72d1('0x5')],this[_0x72d1('0x6')][_0x72d1('0x15')]);util[_0x72d1('0x18')](this[_0x72d1('0x4')],this['squeue']['id'],this['realtime'][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],null,this[_0x72d1('0x3')]);util[_0x72d1('0x19')](this[_0x72d1('0x6')]['id'],this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']],'RINGING'+(this[_0x72d1('0x3')]['forcedOwnership']?_0x72d1('0x1a'):''));}else{logger[_0x72d1('0xf')](_0x72d1('0x1b'),this['squeue']['id'],this[_0x72d1('0x5')]['id']);setTimeout(this['push'][_0x72d1('0x8')](this),0x3e8);}}};Agent[_0x72d1('0xd')][_0x72d1('0x9')]=function(_0x2cc0c8){if(_['isNil'](this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']])){return logger[_0x72d1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);}else{logger[_0x72d1('0xf')](_0x72d1('0x1c'),this[_0x72d1('0x6')]['id'],this['agent']['id']);util[_0x72d1('0x1d')](this[_0x72d1('0x4')],this[_0x72d1('0x6')]['id'],this['realtime'][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],null,this['routing']);this[_0x72d1('0x12')][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']]['busy']=![];this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']][_0x72d1('0x1e')]=undefined;util[_0x72d1('0x1f')](this[_0x72d1('0x12')],this[_0x72d1('0x3')],this[_0x72d1('0x5')],this[_0x72d1('0x6')][_0x72d1('0x15')]);util[_0x72d1('0x19')](this[_0x72d1('0x6')]['id'],this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']],_0x2cc0c8?_0x72d1('0x20'):_0x72d1('0x21'));}if(!_0x2cc0c8){setTimeout(this[_0x72d1('0xe')]['bind'](this),0x3e8);}};function agent(_0x3eb3da,_0x3ae025,_0x2783bb,_0x4fb07b){return new Agent(_0x3eb3da,_0x3ae025,_0x2783bb,_0x4fb07b);}module[_0x72d1('0x22')]=agent; \ No newline at end of file +var _0x98a8=['prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','push','isAgentAvailable','busy','saveWaitingNotification','channel','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','handleTimeout','bind','timeout','drained','handleDrained'];(function(_0x33c47b,_0x1291f4){var _0x462463=function(_0x10bb61){while(--_0x10bb61){_0x33c47b['push'](_0x33c47b['shift']());}};_0x462463(++_0x1291f4);}(_0x98a8,0x12c));var _0x898a=function(_0x14cc17,_0x101dff){_0x14cc17=_0x14cc17-0x0;var _0x9e2836=_0x98a8[_0x14cc17];return _0x9e2836;};'use strict';var _=require(_0x898a('0x0'));var uuid=require(_0x898a('0x1'));var util=require(_0x898a('0x2'));var logger=require(_0x898a('0x3'))(_0x898a('0x4'));var Agent=function(_0x226db7,_0x69c61f,_0x4a0836,_0x2bb3e2){this[_0x898a('0x5')]=uuid['v4']();this[_0x898a('0x6')]=_0x226db7;this[_0x898a('0x7')]=_0x69c61f;this[_0x898a('0x8')]=_0x4a0836;this['routing']=_0x2bb3e2;this[_0x898a('0x6')]['push'](this[_0x898a('0x9')]['bind'](this),this[_0x898a('0xa')][_0x898a('0xb')](this));this[_0x898a('0x6')]['on'](_0x898a('0xc'),this[_0x898a('0xa')][_0x898a('0xb')](this));this[_0x898a('0x6')]['on'](_0x898a('0xd'),this[_0x898a('0xe')]['bind'](this));};Agent[_0x898a('0xf')]['push']=function(){this[_0x898a('0x6')]['push'](this[_0x898a('0x9')][_0x898a('0xb')](this),this[_0x898a('0xa')]['bind'](this));};Agent['prototype']['handleDrained']=function(){this[_0x898a('0xa')](!![]);};Agent[_0x898a('0xf')][_0x898a('0x9')]=function(){logger[_0x898a('0x10')](_0x898a('0x11'),this[_0x898a('0x6')]['id'],this['agent']['id']);if(_[_0x898a('0x12')](this['realtime'][_0x898a('0x13')][this['agent']['id']])){logger[_0x898a('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x898a('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x898a('0x14')][_0x898a('0xb')](this),0x3e8);}else{if(this[_0x898a('0x4')]['forcedOwnership']||util[_0x898a('0x15')](this['squeue']['id'],this['realtime'][_0x898a('0x13')][this[_0x898a('0x7')]['id']],this['squeue']['channel'],![])){this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']][_0x898a('0x16')]=!![];this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']]['busyQueue']=undefined;util[_0x898a('0x17')](this[_0x898a('0x8')],this[_0x898a('0x4')],this[_0x898a('0x7')],this[_0x898a('0x6')][_0x898a('0x18')]);util['showNotification'](this[_0x898a('0x5')],this[_0x898a('0x6')]['id'],this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']],null,this[_0x898a('0x4')]);util['writeLog'](this[_0x898a('0x6')]['id'],this['realtime']['agents'][this['agent']['id']],_0x898a('0x19')+(this[_0x898a('0x4')][_0x898a('0x1a')]?_0x898a('0x1b'):''));}else{logger[_0x898a('0x10')](_0x898a('0x1c'),this[_0x898a('0x6')]['id'],this[_0x898a('0x7')]['id']);setTimeout(this[_0x898a('0x14')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0xe9c33d){if(_[_0x898a('0x12')](this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']])){return logger[_0x898a('0x10')](_0x898a('0x1d'),this[_0x898a('0x6')]['id'],this[_0x898a('0x7')]['id']);}else{logger[_0x898a('0x10')](_0x898a('0x1e'),this[_0x898a('0x6')]['id'],this['agent']['id']);util[_0x898a('0x1f')](this[_0x898a('0x5')],this[_0x898a('0x6')]['id'],this[_0x898a('0x8')][_0x898a('0x13')][this['agent']['id']],null,this['routing']);this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']]['busy']=![];this[_0x898a('0x8')][_0x898a('0x13')][this[_0x898a('0x7')]['id']][_0x898a('0x20')]=undefined;util[_0x898a('0x21')](this[_0x898a('0x8')],this[_0x898a('0x4')],this[_0x898a('0x7')],this['squeue'][_0x898a('0x18')]);util['writeLog'](this['squeue']['id'],this[_0x898a('0x8')]['agents'][this[_0x898a('0x7')]['id']],_0xe9c33d?'STOP':_0x898a('0x22'));}if(!_0xe9c33d){setTimeout(this['push'][_0x898a('0xb')](this),0x3e8);}};function agent(_0x354703,_0x101182,_0x50c0e4,_0x554897){return new Agent(_0x354703,_0x101182,_0x50c0e4,_0x554897);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 99ab6ef..d92301c 100644 --- a/server/services/routing/server/applications/strategy/beepall.js +++ b/server/services/routing/server/applications/strategy/beepall.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5493=['push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','saveWaitingNotification','showNotification','notificationId','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','busy','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','queue'];(function(_0x416d6e,_0x375e8c){var _0x4b934a=function(_0x419c7a){while(--_0x419c7a){_0x416d6e['push'](_0x416d6e['shift']());}};_0x4b934a(++_0x375e8c);}(_0x5493,0x161));var _0x3549=function(_0x27a6c5,_0x39c47d){_0x27a6c5=_0x27a6c5-0x0;var _0x2d785d=_0x5493[_0x27a6c5];return _0x2d785d;};'use strict';var _=require(_0x3549('0x0'));var uuid=require(_0x3549('0x1'));var util=require(_0x3549('0x2'));var logger=require(_0x3549('0x3'))(_0x3549('0x4'));var Beepall=function(_0x24b97d,_0x46ffca,_0x31da24,_0x56b93f){this['notificationId']=uuid['v4']();this[_0x3549('0x5')]=_0x24b97d;this[_0x3549('0x6')]=_0x46ffca;this['realtime']=_0x31da24;this[_0x3549('0x4')]=_0x56b93f;this['squeue'][_0x3549('0x7')](this[_0x3549('0x8')][_0x3549('0x9')](this),this['handleTimeout']['bind'](this));this[_0x3549('0x5')]['on'](_0x3549('0xa'),this[_0x3549('0xb')][_0x3549('0x9')](this));this['squeue']['on'](_0x3549('0xc'),this[_0x3549('0xd')][_0x3549('0x9')](this));};Beepall[_0x3549('0xe')]['push']=function(){this['squeue'][_0x3549('0x7')](this[_0x3549('0x8')][_0x3549('0x9')](this),this['handleTimeout'][_0x3549('0x9')](this));};Beepall[_0x3549('0xe')][_0x3549('0xd')]=function(){this[_0x3549('0xb')](!![]);};Beepall[_0x3549('0xe')]['handleRun']=function(){var _0x286118=!![];if(!_[_0x3549('0xf')](this[_0x3549('0x6')])&&!_[_0x3549('0xf')](this[_0x3549('0x6')]['Agents'])&&this[_0x3549('0x6')][_0x3549('0x10')][_0x3549('0x11')]>0x0){for(var _0x191471=0x0,_0x607b2;_0x1914710x0){for(var _0x4f9f84=0x0,_0x2e21ee;_0x4f9f840x0&&_0x557777[_0x15d386+_0x20b0('0x25')]>=_0x557777[_0x15d386+_0x20b0('0x24')]){writeLog(_0x5190bf,_0x557777,_0x15d386['toUpperCase']()+_0x20b0('0x26'));return![];}}return!![];};exports[_0x20b0('0x27')]=function(_0x4a31eb,_0x6293f5,_0xa99703,_0x186d8c,_0x5d4242){return sendNotification(!![],_0x4a31eb,_0x6293f5,_0xa99703,_0x186d8c,_0x5d4242);};exports[_0x20b0('0x28')]=function(_0x5f0688,_0x3c9066,_0xe3ac4b,_0x5d72da,_0x56de52){return sendNotification(![],_0x5f0688,_0x3c9066,_0xe3ac4b,_0x5d72da,_0x56de52);};exports[_0x20b0('0x29')]=function(_0x18471d,_0x1daa8b,_0x547456){var _0x5c5f0c=_0x1daa8b[_0x20b0('0x2a')][_0x20b0('0x2b')];if(!_0x5c5f0c&&_0x547456){_0x5c5f0c=_0x547456['id'];}var _0x2bb91f=_[_0x20b0('0x2c')](_0x18471d[_0x1daa8b[_0x20b0('0x2d')]+'QueuesWaitingInteractions'],function(_0x3e52e4){var _0x2ef1f3=_[_0x20b0('0x2e')](_0x1daa8b['channel'])+_0x20b0('0x2f');return _0x3e52e4[_0x2ef1f3]===_0x1daa8b['interaction']['id'];});if(!_0x2bb91f&&_0x5c5f0c){_0x2bb91f=_[_0x20b0('0x2c')](_0x18471d[_0x20b0('0x30')][_0x5c5f0c][_0x1daa8b['channel']+_0x20b0('0x31')],function(_0x3b4361){return _0x3b4361['id']===_0x1daa8b[_0x20b0('0x2a')]['id'];});}return _0x2bb91f;};exports[_0x20b0('0x32')]=function(_0x5aca2e,_0x42849a,_0x35517a,_0x17929a){_0x5aca2e[_0x20b0('0x30')][_0x35517a['id']][_0x17929a+_0x20b0('0x31')][_0x42849a['message']['id']]={'id':_0x42849a[_0x20b0('0x2a')]['id']};};exports[_0x20b0('0x33')]=function(_0x74391e,_0x1aae9a,_0x65bc5,_0x4be3fd){delete _0x74391e[_0x20b0('0x30')][_0x65bc5['id']][_0x4be3fd+'WaitingInteractions'][_0x1aae9a['message']['id']];};exports[_0x20b0('0x34')]=writeLog; \ No newline at end of file +var _0xd1b0=['Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','UserId','some','channel','capitalize','InteractionId','interaction','WaitingInteractions','saveWaitingNotification','message','removeWaitingNotification','agents','writeLog','lodash','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','name','emit','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','user:%s','notification:%s','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE'];(function(_0x4d4808,_0x17b16c){var _0x83d3bd=function(_0x4a2f99){while(--_0x4a2f99){_0x4d4808['push'](_0x4d4808['shift']());}};_0x83d3bd(++_0x17b16c);}(_0xd1b0,0xe8));var _0x0d1b=function(_0x17e556,_0x477fdb){_0x17e556=_0x17e556-0x0;var _0x53a1f7=_0xd1b0[_0x17e556];return _0x53a1f7;};'use strict';var _=require(_0x0d1b('0x0'));var util=require(_0x0d1b('0x1'));var utils=require(_0x0d1b('0x2'));var Redis=require('ioredis');var config=require(_0x0d1b('0x3'));var logger=require(_0x0d1b('0x4'))(_0x0d1b('0x5'));config['redis']=_['defaults'](config[_0x0d1b('0x6')],{'host':_0x0d1b('0x7'),'port':0x18eb});var io=require(_0x0d1b('0x8'))(new Redis(config[_0x0d1b('0x6')]));function sendNotification(_0x32f987,_0x5b3087,_0x554aad,_0x471ebb,_0xbc1e4,_0x556e0c){io['to'](util['format']('user:%s',_0x471ebb[_0x0d1b('0x9')]))[_0x0d1b('0xa')](_0x0d1b('0xb'),_0x471ebb);var _0x258409=_0x556e0c||{};var _0x2b1cb2=_0x554aad[_0x0d1b('0xc')]('.');var _0x233dbe={'uniqueid':_0x5b3087,'channel':_0x2b1cb2[0x0],'id':_0x2b1cb2[0x1],'title':_0x2b1cb2[0x0]+_0x0d1b('0xd'),'interactionId':_0x2b1cb2[0x2],'queue':_0xbc1e4?_0xbc1e4['name']:null,'sound':_0x258409[_0x0d1b('0xe')][_0x0d1b('0xf')],'shake':_0x258409[_0x0d1b('0xe')][_0x0d1b('0x10')]};try{if(!_0x258409[_0x0d1b('0x11')]){_0x258409[_0x0d1b('0x11')]={};}if(_0xbc1e4){_0x258409[_0x0d1b('0x11')][_0x0d1b('0x12')]=_0xbc1e4;}else if(_0x258409['body'][_0x0d1b('0x12')]){delete _0x258409[_0x0d1b('0x11')]['queue'];}_0x233dbe['msg']=utils[_0x0d1b('0x13')](_0x258409[_0x0d1b('0xe')][_0x0d1b('0x14')],_0x258409);}catch(_0x2b975a){_0x233dbe['msg']=_0x0d1b('0x15');logger[_0x0d1b('0x16')](util[_0x0d1b('0x17')](_0x0d1b('0x18'),_0x5b3087,_0x2b975a['message']));}io['to'](util[_0x0d1b('0x17')](_0x0d1b('0x19'),_0x471ebb[_0x0d1b('0x9')]))['emit'](util['format'](_0x0d1b('0x1a'),_0x32f987?_0x0d1b('0x1b'):'remove'),_0x233dbe);}function writeLog(_0x5a49a6,_0x625073,_0x303be9){return logger['debug'](util[_0x0d1b('0x17')](_0x0d1b('0x1c'),_0x5a49a6,_0x625073[_0x0d1b('0x9')],_0x303be9));}exports['isAgentAvailable']=function(_0x30e82b,_0xd71f9d,_0x2bf88e,_0x3fe0d6){if(_0xd71f9d[_0x0d1b('0x1d')]){writeLog(_0x30e82b,_0xd71f9d,_0x0d1b('0x1e'));return![];}if(!_0xd71f9d[_0x0d1b('0x1f')]){writeLog(_0x30e82b,_0xd71f9d,_0x0d1b('0x20'));return![];}if(_0xd71f9d[_0x2bf88e+_0x0d1b('0x21')]){writeLog(_0x30e82b,_0xd71f9d,'PAUSE');return![];}if(_0x3fe0d6&&_0xd71f9d[_0x0d1b('0x22')](_0x2bf88e+_0x0d1b('0x23'))&&_0xd71f9d[_0x0d1b('0x22')](_0x2bf88e+_0x0d1b('0x24'))){if(_0xd71f9d[_0x2bf88e+_0x0d1b('0x23')]>0x0&&_0xd71f9d[_0x2bf88e+_0x0d1b('0x24')]>=_0xd71f9d[_0x2bf88e+_0x0d1b('0x23')]){writeLog(_0x30e82b,_0xd71f9d,_0x2bf88e['toUpperCase']()+_0x0d1b('0x25'));return![];}}return!![];};exports[_0x0d1b('0x26')]=function(_0x435842,_0xa6b68e,_0x316ef3,_0x3219ee,_0x1f5c32){return sendNotification(!![],_0x435842,_0xa6b68e,_0x316ef3,_0x3219ee,_0x1f5c32);};exports[_0x0d1b('0x27')]=function(_0x22211e,_0x3cfffa,_0x297b23,_0x22d50e,_0x43622d){return sendNotification(![],_0x22211e,_0x3cfffa,_0x297b23,_0x22d50e,_0x43622d);};exports[_0x0d1b('0x28')]=function(_0x45dde3,_0x351efa,_0x5e210b){var _0x163c7e=_0x351efa['interaction'][_0x0d1b('0x29')];if(!_0x163c7e&&_0x5e210b){_0x163c7e=_0x5e210b['id'];}var _0x12c666=_[_0x0d1b('0x2a')](_0x45dde3[_0x351efa[_0x0d1b('0x2b')]+'QueuesWaitingInteractions'],function(_0x788a64){var _0x53104b=_[_0x0d1b('0x2c')](_0x351efa['channel'])+_0x0d1b('0x2d');return _0x788a64[_0x53104b]===_0x351efa[_0x0d1b('0x2e')]['id'];});if(!_0x12c666&&_0x163c7e){_0x12c666=_[_0x0d1b('0x2a')](_0x45dde3['agents'][_0x163c7e][_0x351efa[_0x0d1b('0x2b')]+_0x0d1b('0x2f')],function(_0x38950b){return _0x38950b['id']===_0x351efa[_0x0d1b('0x2e')]['id'];});}return _0x12c666;};exports[_0x0d1b('0x30')]=function(_0x5a07be,_0x5d5434,_0x31ed77,_0x3c21a4){_0x5a07be['agents'][_0x31ed77['id']][_0x3c21a4+'WaitingInteractions'][_0x5d5434[_0x0d1b('0x31')]['id']]={'id':_0x5d5434[_0x0d1b('0x2e')]['id']};};exports[_0x0d1b('0x32')]=function(_0x2523bd,_0x3bd8e2,_0x4772c0,_0x155256){delete _0x2523bd[_0x0d1b('0x33')][_0x4772c0['id']][_0x155256+'WaitingInteractions'][_0x3bd8e2[_0x0d1b('0x31')]['id']];};exports[_0x0d1b('0x34')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 0ac89af..a214350 100644 --- a/server/services/routing/server/applications/system.js +++ b/server/services/routing/server/applications/system.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3039=['next','getMustacheRender','exec','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','string','consequence','validate','length','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x10463c,_0x3d8f5e){var _0x4e086d=function(_0x3a071a){while(--_0x3a071a){_0x10463c['push'](_0x10463c['shift']());}};_0x4e086d(++_0x3d8f5e);}(_0x3039,0x18b));var _0x9303=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3039[_0x42cae2];return _0x5f256f;};'use strict';var schema=require('validate');var sh=require(_0x9303('0x0'));var _=require(_0x9303('0x1'));var utils=require(_0x9303('0x2'));var logger=require(_0x9303('0x3'))('routing');var system=schema({'command':{'type':_0x9303('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9303('0x5')]=function(_0x442524,_0x268661){return function(_0x4aa887){try{var _0x21d1c8={'command':_0x268661[0x0]};var _0x5b77f3=system[_0x9303('0x6')](_0x21d1c8,{'typecast':!![]});if(_0x5b77f3[_0x9303('0x7')]){logger[_0x9303('0x8')]('[%s][SYSTEM]\x20%s',_0x442524,_[_0x9303('0x9')](_0x5b77f3,'message')[_0x9303('0xa')](',\x20'));logger[_0x9303('0xb')](_0x9303('0xc'),_0x442524);_0x4aa887[_0x9303('0xd')]();}else{var _0x223d09=this;var _0x3f020b=utils[_0x9303('0xe')](_0x268661[0x0],this);logger[_0x9303('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x442524,_0x3f020b);sh[_0x9303('0xf')](_['trim'](_0x3f020b),function(_0x3bb1c9,_0x5bbf18){logger[_0x9303('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x442524,_0x3bb1c9);if(_0x3bb1c9==0x0){var _0xce0ff2=_0x5bbf18['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x9303('0x10')](_0x268661[0x1])||_[_0x9303('0x11')](_0x268661[0x1])){logger[_0x9303('0xb')](_0x9303('0x12'),_0x442524);_0x223d09[_0x9303('0x13')][_0x268661[0x1]]=_0xce0ff2;}else{logger[_0x9303('0xb')](_0x9303('0x14'),_0x442524,_0x268661[0x1],_0xce0ff2);_0x223d09[_0x9303('0x13')][_0x268661[0x1]]=_0xce0ff2;}}_0x4aa887[_0x9303('0xd')]();});}}catch(_0x2c886c){logger[_0x9303('0x8')](_0x9303('0x15'),_0x442524,_[_0x9303('0x16')](_0x2c886c)?JSON[_0x9303('0x17')](_0x2c886c):_0x2c886c);logger['info'](_0x9303('0xc'),_0x442524);_0x4aa887['next']();}};}; \ No newline at end of file +var _0xc9fa=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9fa,0x129));var _0xac9f=function(_0x22eb5d,_0x2e519d){_0x22eb5d=_0x22eb5d-0x0;var _0x4a39ad=_0xc9fa[_0x22eb5d];return _0x4a39ad;};'use strict';var schema=require(_0xac9f('0x0'));var sh=require(_0xac9f('0x1'));var _=require(_0xac9f('0x2'));var utils=require('./utils');var logger=require(_0xac9f('0x3'))('routing');var system=schema({'command':{'type':_0xac9f('0x4'),'required':!![],'message':_0xac9f('0x5')}});exports[_0xac9f('0x6')]=function(_0x5d5bf6,_0x4066e3){return function(_0x17b8e6){try{var _0x509a31={'command':_0x4066e3[0x0]};var _0x199939=system[_0xac9f('0x0')](_0x509a31,{'typecast':!![]});if(_0x199939[_0xac9f('0x7')]){logger[_0xac9f('0x8')]('[%s][SYSTEM]\x20%s',_0x5d5bf6,_['map'](_0x199939,_0xac9f('0x9'))[_0xac9f('0xa')](',\x20'));logger[_0xac9f('0xb')](_0xac9f('0xc'),_0x5d5bf6);_0x17b8e6[_0xac9f('0xd')]();}else{var _0x3b8e1e=this;var _0x2ff7e4=utils['getMustacheRender'](_0x4066e3[0x0],this);logger[_0xac9f('0xb')](_0xac9f('0xe'),_0x5d5bf6,_0x2ff7e4);sh['exec'](_[_0xac9f('0xf')](_0x2ff7e4),function(_0x5202f3,_0x1d418c){logger['info'](_0xac9f('0x10'),_0x5d5bf6,_0x5202f3);if(_0x5202f3==0x0){var _0x353203=_0x1d418c[_0xac9f('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4066e3[0x1])||_[_0xac9f('0x12')](_0x4066e3[0x1])){logger[_0xac9f('0xb')](_0xac9f('0x13'),_0x5d5bf6);_0x3b8e1e[_0xac9f('0x14')][_0x4066e3[0x1]]=_0x353203;}else{logger[_0xac9f('0xb')](_0xac9f('0x15'),_0x5d5bf6,_0x4066e3[0x1],_0x353203);_0x3b8e1e[_0xac9f('0x14')][_0x4066e3[0x1]]=_0x353203;}}_0x17b8e6[_0xac9f('0xd')]();});}}catch(_0x34b3ff){logger[_0xac9f('0x8')]('[%s][SYSTEM]\x20%s',_0x5d5bf6,_[_0xac9f('0x16')](_0x34b3ff)?JSON[_0xac9f('0x17')](_0x34b3ff):_0x34b3ff);logger['info'](_0xac9f('0xc'),_0x5d5bf6);_0x17b8e6[_0xac9f('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 4e92b18..7a55048 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b40=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','stringify','finally','next','isObject','lodash'];(function(_0x1b9903,_0x8c7342){var _0x1a2fc6=function(_0x254d6a){while(--_0x254d6a){_0x1b9903['push'](_0x1b9903['shift']());}};_0x1a2fc6(++_0x8c7342);}(_0x5b40,0x9b));var _0x05b4=function(_0x2f2a45,_0x5c9f29){_0x2f2a45=_0x2f2a45-0x0;var _0x31289b=_0x5b40[_0x2f2a45];return _0x31289b;};'use strict';var schema=require('validate');var _=require(_0x05b4('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x05b4('0x1')),'smsInteraction':require(_0x05b4('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x05b4('0x3')),'whatsappInteraction':require(_0x05b4('0x4'))};var logger=require(_0x05b4('0x5'))('routing');var tag=schema({'tag':{'type':_0x05b4('0x6'),'required':!![],'message':_0x05b4('0x7')}});exports['consequence']=function(_0x3425a1,_0x4db9cb,_0x2a9126,_0x6e0e03){return function(_0x30f22a){try{var _0x3d3fc2={'tag':_0x4db9cb[0x0]};var _0x13356c=tag[_0x05b4('0x8')](_0x3d3fc2,{'typecast':!![]});if(_0x13356c[_0x05b4('0x9')]){logger['error'](_0x05b4('0xa'),_0x3425a1,_[_0x05b4('0xb')](_0x13356c,_0x05b4('0xc'))[_0x05b4('0xd')](',\x20'));logger[_0x05b4('0xe')](_0x05b4('0xf'),_0x3425a1);_0x30f22a['next']();}else{var _0x190982={'ids':[_0x4db9cb[0x0]]};if(rpc[_0x6e0e03['channel']+_0x05b4('0x10')]){rpc[_0x6e0e03[_0x05b4('0x11')]+_0x05b4('0x10')][_0x05b4('0x12')](_0x6e0e03[_0x05b4('0x13')]['id'],_0x190982)['then'](function(_0x23faa1){logger[_0x05b4('0xe')](_0x05b4('0x14'),_0x3425a1,_0x4db9cb[0x1],_0x6e0e03['channel'],_0x6e0e03[_0x05b4('0x13')]['id']);})['catch'](function(_0x9d56a0){logger[_0x05b4('0x15')](_0x05b4('0xa'),_0x3425a1,JSON[_0x05b4('0x16')](_0x9d56a0));logger[_0x05b4('0xe')](_0x05b4('0xf'),_0x3425a1);})[_0x05b4('0x17')](function(){_0x30f22a[_0x05b4('0x18')]();});}}}catch(_0x52d89a){logger[_0x05b4('0x15')]('[%s][TAG]\x20%s',_0x3425a1,_[_0x05b4('0x19')](_0x52d89a)?JSON[_0x05b4('0x16')](_0x52d89a):_0x52d89a);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3425a1);_0x30f22a['next']();}};}; \ No newline at end of file +var _0x9ef9=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','isObject'];(function(_0x55e39d,_0x5a2760){var _0x184058=function(_0x56076f){while(--_0x56076f){_0x55e39d['push'](_0x55e39d['shift']());}};_0x184058(++_0x5a2760);}(_0x9ef9,0xd0));var _0x99ef=function(_0x1d602d,_0x4ea544){_0x1d602d=_0x1d602d-0x0;var _0x420908=_0x9ef9[_0x1d602d];return _0x420908;};'use strict';var schema=require('validate');var _=require(_0x99ef('0x0'));var rpc={'chatInteraction':require(_0x99ef('0x1')),'openchannelInteraction':require(_0x99ef('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x99ef('0x3')),'faxInteraction':require(_0x99ef('0x4')),'whatsappInteraction':require(_0x99ef('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x99ef('0x6')}});exports[_0x99ef('0x7')]=function(_0x35e4ea,_0x10c66b,_0x108e2d,_0x5e4084){return function(_0x29e615){try{var _0xdc0583={'tag':_0x10c66b[0x0]};var _0x23b5c6=tag[_0x99ef('0x8')](_0xdc0583,{'typecast':!![]});if(_0x23b5c6[_0x99ef('0x9')]){logger[_0x99ef('0xa')]('[%s][TAG]\x20%s',_0x35e4ea,_[_0x99ef('0xb')](_0x23b5c6,_0x99ef('0xc'))[_0x99ef('0xd')](',\x20'));logger[_0x99ef('0xe')](_0x99ef('0xf'),_0x35e4ea);_0x29e615[_0x99ef('0x10')]();}else{var _0x961d4b={'ids':[_0x10c66b[0x0]]};if(rpc[_0x5e4084[_0x99ef('0x11')]+_0x99ef('0x12')]){rpc[_0x5e4084[_0x99ef('0x11')]+_0x99ef('0x12')][_0x99ef('0x13')](_0x5e4084['interaction']['id'],_0x961d4b)['then'](function(_0x575f1d){logger[_0x99ef('0xe')](_0x99ef('0x14'),_0x35e4ea,_0x10c66b[0x1],_0x5e4084['channel'],_0x5e4084[_0x99ef('0x15')]['id']);})[_0x99ef('0x16')](function(_0x6d411c){logger[_0x99ef('0xa')]('[%s][TAG]\x20%s',_0x35e4ea,JSON[_0x99ef('0x17')](_0x6d411c));logger[_0x99ef('0xe')](_0x99ef('0xf'),_0x35e4ea);})[_0x99ef('0x18')](function(){_0x29e615[_0x99ef('0x10')]();});}}}catch(_0x4bafa6){logger[_0x99ef('0xa')]('[%s][TAG]\x20%s',_0x35e4ea,_[_0x99ef('0x19')](_0x4bafa6)?JSON[_0x99ef('0x17')](_0x4bafa6):_0x4bafa6);logger[_0x99ef('0xe')](_0x99ef('0xf'),_0x35e4ea);_0x29e615[_0x99ef('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 64642dc..4014b62 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf87=['login','push','params','stringify','utf8','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','routing','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method'];(function(_0x332fc0,_0x98069e){var _0x5ef716=function(_0x5e1669){while(--_0x5e1669){_0x332fc0['push'](_0x332fc0['shift']());}};_0x5ef716(++_0x98069e);}(_0xbf87,0x15f));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var rp=require(_0x7bf8('0x0'));var logger=require('../../../../config/logger')(_0x7bf8('0x1'));var _=require(_0x7bf8('0x2'));var arr=[];exports['consequence']=function(_0x47ff0e,_0x151564){return function(_0xa399ae){var _0x249d35=_0x151564[0xa];var _0x53ffd3=_0x151564[0xb];var _0x786224=_0x151564[0xc];var _0x4d9f88=_0x151564[0xd];var _0x1a57f4=_0x151564[0xe];var _0x51099e=_0x151564[0xf][_0x7bf8('0x3')](/\n/g,_0x7bf8('0x4'));var _0x372b3a=_0x151564[0x10][_0x7bf8('0x3')](/\n/g,'\x20');if(!arr[_0x7bf8('0x5')](_0x53ffd3)){arr['push'](_0x53ffd3);var _0x4bf291=_0x151564[0x3];var _0x2ef2a0=_0x151564[0x4];var _0x599446=_0x151564[0x1];var _0x4028fb=_0x151564[0x0];var _0x36f719={};_0x36f719[_0x7bf8('0x6')]=_0x151564[0x8]+_0x7bf8('0x7')+_0x786224+'|'+_0x249d35+'|'+_0x4d9f88+'|'+_0x53ffd3+'|'+_0x1a57f4;_0x36f719[_0x7bf8('0x8')]=_0x151564[0x7]+'?params='+_0x786224+'|'+_0x249d35+'|'+_0x4d9f88+'|'+_0x53ffd3+'|'+_0x1a57f4+'|'+_0x51099e+'|'+_0x372b3a;_0x36f719['title']=_0x151564[0x9];var _0x31f9ce={};_0x31f9ce[_0x7bf8('0x9')]=_0x7bf8('0xa');_0x31f9ce[_0x7bf8('0xb')]=_0x7bf8('0xc');var _0x112560=[];_0x112560[_0x7bf8('0xd')](_0x151564[0x2]);_0x112560[_0x7bf8('0xd')](_0x151564[0x5]);_0x112560[_0x7bf8('0xd')](_0x151564[0x6]);_0x31f9ce[_0x7bf8('0xe')]=_0x112560;_0x31f9ce['id']=0x1;var _0x22d4f3=JSON[_0x7bf8('0xf')](_0x31f9ce);var _0x27c137={'encoding':_0x7bf8('0x10'),'method':_0x7bf8('0x11'),'timeout':0x2710,'url':_0x4bf291,'headers':{'Content-Type':_0x7bf8('0x12')},'body':_0x22d4f3};return rp(_0x27c137)[_0x7bf8('0x13')](function(_0x4795e9){const _0x4269e9=JSON[_0x7bf8('0x14')](_0x4795e9);if(!_0x4269e9['result']['logged']){throw new Error(_0x7bf8('0x15'));}var _0x29c0ba=_0x53ffd3;var _0x55a36b=_0x7bf8('0x16')+_0x599446+_0x7bf8('0x17')+_0x4028fb+_0x7bf8('0x18')+_0x29c0ba+_0x7bf8('0x19')+JSON[_0x7bf8('0xf')](_0x36f719);var _0x6339a5=_0x2ef2a0+'?'+_0x55a36b;return rp(_0x6339a5);})['then'](function(_0x506a8c){logger[_0x7bf8('0x1a')](_0x7bf8('0x1b'),_0x47ff0e,_0x506a8c);_0xa399ae[_0x7bf8('0x1c')]();})[_0x7bf8('0x1d')](function(_0x1d02a5){logger[_0x7bf8('0x1e')]('[%s][TVOX]\x20%s',_0x47ff0e,_[_0x7bf8('0x1f')](_0x1d02a5)?JSON[_0x7bf8('0xf')](_0x1d02a5):_0x1d02a5);_0xa399ae[_0x7bf8('0x1c')]();});}else{logger[_0x7bf8('0x1a')](_0x7bf8('0x20'),_0x47ff0e);_0xa399ae['next']();}};}; \ No newline at end of file +var _0xdd41=['info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','lodash','replace','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data='];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0xdd41,0xb3));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var logger=require(_0x1dd4('0x0'))('routing');var _=require(_0x1dd4('0x1'));var arr=[];exports['consequence']=function(_0x5eae4d,_0x381210){return function(_0x192d2d){var _0x2e42c8=_0x381210[0xa];var _0x19ce19=_0x381210[0xb];var _0x2bffdf=_0x381210[0xc];var _0x34c391=_0x381210[0xd];var _0x339278=_0x381210[0xe];var _0x5b4ca9=_0x381210[0xf][_0x1dd4('0x2')](/\n/g,'\x20-\x20');var _0x20d443=_0x381210[0x10][_0x1dd4('0x2')](/\n/g,'\x20');if(!arr['includes'](_0x19ce19)){arr[_0x1dd4('0x3')](_0x19ce19);var _0x28990f=_0x381210[0x3];var _0x354585=_0x381210[0x4];var _0x5d3047=_0x381210[0x1];var _0x3d7e41=_0x381210[0x0];var _0x217cab={};_0x217cab[_0x1dd4('0x4')]=_0x381210[0x8]+'?params='+_0x2bffdf+'|'+_0x2e42c8+'|'+_0x34c391+'|'+_0x19ce19+'|'+_0x339278;_0x217cab[_0x1dd4('0x5')]=_0x381210[0x7]+_0x1dd4('0x6')+_0x2bffdf+'|'+_0x2e42c8+'|'+_0x34c391+'|'+_0x19ce19+'|'+_0x339278+'|'+_0x5b4ca9+'|'+_0x20d443;_0x217cab[_0x1dd4('0x7')]=_0x381210[0x9];var _0x2084d8={};_0x2084d8[_0x1dd4('0x8')]=_0x1dd4('0x9');_0x2084d8[_0x1dd4('0xa')]=_0x1dd4('0xb');var _0x51d669=[];_0x51d669[_0x1dd4('0x3')](_0x381210[0x2]);_0x51d669[_0x1dd4('0x3')](_0x381210[0x5]);_0x51d669[_0x1dd4('0x3')](_0x381210[0x6]);_0x2084d8[_0x1dd4('0xc')]=_0x51d669;_0x2084d8['id']=0x1;var _0x5588e1=JSON[_0x1dd4('0xd')](_0x2084d8);var _0x5c2a36={'encoding':'utf8','method':_0x1dd4('0xe'),'timeout':0x2710,'url':_0x28990f,'headers':{'Content-Type':_0x1dd4('0xf')},'body':_0x5588e1};return rp(_0x5c2a36)[_0x1dd4('0x10')](function(_0x56da10){const _0x202de3=JSON['parse'](_0x56da10);if(!_0x202de3[_0x1dd4('0x11')][_0x1dd4('0x12')]){throw new Error(_0x1dd4('0x13'));}var _0x41d55a=_0x19ce19;var _0x1a9237=_0x1dd4('0x14')+_0x5d3047+_0x1dd4('0x15')+_0x3d7e41+_0x1dd4('0x16')+_0x41d55a+_0x1dd4('0x17')+JSON[_0x1dd4('0xd')](_0x217cab);var _0x3bb5fa=_0x354585+'?'+_0x1a9237;return rp(_0x3bb5fa);})[_0x1dd4('0x10')](function(_0x5c12d8){logger[_0x1dd4('0x18')](_0x1dd4('0x19'),_0x5eae4d,_0x5c12d8);_0x192d2d['stop']();})[_0x1dd4('0x1a')](function(_0x10485d){logger['error']('[%s][TVOX]\x20%s',_0x5eae4d,_['isObject'](_0x10485d)?JSON[_0x1dd4('0xd')](_0x10485d):_0x10485d);_0x192d2d[_0x1dd4('0x1b')]();});}else{logger[_0x1dd4('0x18')](_0x1dd4('0x1c'),_0x5eae4d);_0x192d2d['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index fd360c4..bb112bf 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0xf9ac0,_0x33d96){var _0x10859b=function(_0x594713){while(--_0x594713){_0xf9ac0['push'](_0xf9ac0['shift']());}};_0x10859b(++_0x33d96);}(_0xe706,0xa3));var _0x6e70=function(_0x2bc78d,_0x31a288){_0x2bc78d=_0x2bc78d-0x0;var _0x5d96c9=_0xe706[_0x2bc78d];return _0x5d96c9;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x44c169,_0x109e3b){var _0x5e7e54=function(_0x378aae){while(--_0x378aae){_0x44c169['push'](_0x44c169['shift']());}};_0x5e7e54(++_0x109e3b);}(_0xe706,0xa3));var _0x6e70=function(_0xf9e76,_0x2e6b9a){_0xf9e76=_0xf9e76-0x0;var _0x119a9b=_0xe706[_0xf9e76];return _0x119a9b;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index d301203..4d45528 100644 --- a/server/services/routing/server/index.js +++ b/server/services/routing/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2293=['bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','IntervalId','isNil','map','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','app','toLowerCase','appdata','split','push','slice','dialogflow','dialogflowv2','tag','TagId','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','emit','end','QueueReport','UserId','catch','message\x20is\x20empty','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','waiting','mailQueues','name','openchannelQueues','loggedIn','paused','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2293,0x17d));var _0x3229=function(_0x788a11,_0x3c3e74){_0x788a11=_0x788a11-0x0;var _0xd2464a=_0x2293[_0x788a11];return _0xd2464a;};'use strict';var _=require(_0x3229('0x0'));var util=require(_0x3229('0x1'));var path=require(_0x3229('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x3229('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x3229('0x4'));var logger=require(_0x3229('0x5'))(_0x3229('0x6'));var rpc={'openchannelQueueReport':require(_0x3229('0x7')),'mailQueueReport':require(_0x3229('0x8')),'chatQueueReport':require(_0x3229('0x9')),'smsQueueReport':require(_0x3229('0xa')),'faxQueueReport':require(_0x3229('0xb')),'whatsappQueueReport':require(_0x3229('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x510c3a,_0x33aef1,_0x1a1f15){return util[_0x3229('0xd')](_0x3229('0xe'),_0x510c3a,_0x33aef1||0x0,_0x1a1f15||0x0);}function getIntervals(_0x3fdbdb,_0x27497c){var _0x164701=[];if(!_['isNil'](_0x27497c[_0x3229('0xf')])&&!_[_0x3229('0x10')](_0x3fdbdb[_0x27497c[_0x3229('0xf')]])&&!_[_0x3229('0x10')](_0x3fdbdb[_0x27497c[_0x3229('0xf')]]['Intervals'])){_0x164701=_[_0x3229('0x11')](_0x3fdbdb[_0x27497c[_0x3229('0xf')]]['Intervals'],'interval');}else if(!_[_0x3229('0x10')](_0x27497c[_0x3229('0x12')])){_0x164701=[_0x27497c[_0x3229('0x12')]];}return _0x164701;}exports['listen']=function(_0x3c69bb){_0x3c69bb[_0x3229('0x13')]={};return new BPromise(function(_0x6b83a1,_0x5e2528){var _0x3b752f={'Start':function(_0x23a129){var _0x57db47=this;return new Promise(function(_0xaead14,_0x1ee77b){if(_0x23a129){try{var _0x2dd842=[];var _0x20d7fa=getId(_0x23a129[_0x3229('0x14')],_0x23a129[_0x3229('0x15')]?_0x23a129[_0x3229('0x15')]['id']:0x0,_0x23a129[_0x3229('0x16')]?_0x23a129['interaction']['id']:0x0);var _0x564c7a=sUtils['checkWaitingNotifications'](_0x3c69bb,_0x23a129);if(!_0x564c7a&&_0x23a129[_0x3229('0x17')]&&_[_0x3229('0x18')](_0x23a129[_0x3229('0x17')])&&_0x23a129[_0x3229('0x17')][_0x3229('0x19')]){for(var _0x2990cd=0x0;_0x2990cd<_0x23a129['applications'][_0x3229('0x19')];_0x2990cd+=0x1){var _0x25d3a3=_0x23a129[_0x3229('0x17')][_0x2990cd];if(fs[_0x3229('0x1a')](path[_0x3229('0x1b')](__dirname,_0x3229('0x17'),_0x25d3a3['app']+_0x3229('0x1c')))){var _0x36618e=[];switch(_0x25d3a3[_0x3229('0x1d')][_0x3229('0x1e')]()){case'autoreply':var _0x235212=_0x25d3a3[_0x3229('0x1f')][_0x3229('0x20')](',');if(_0x23a129[_0x3229('0x14')]==='mail'){_0x36618e[_0x3229('0x21')](_0x235212[0x0]);_0x36618e[_0x3229('0x21')](_0x235212[0x1]);_0x36618e['push'](_0x235212[_0x3229('0x22')](0x2,_0x235212['length'])['join'](','));}else{_0x36618e[_0x3229('0x21')](_0x235212[0x0]);_0x36618e[_0x3229('0x21')](_0x235212[_0x3229('0x22')](0x1,_0x235212['length'])['join'](','));}break;case _0x3229('0x23'):var _0x2b8696=_0x25d3a3['appdata']['split'](',');_0x36618e[_0x3229('0x21')](_0x2b8696[0x0]);_0x36618e[_0x3229('0x21')](_0x2b8696[0x1]);_0x36618e[_0x3229('0x21')](_0x2b8696[_0x3229('0x22')](0x2,_0x2b8696['length'])[_0x3229('0x1b')](','));break;case _0x3229('0x24'):var _0x36e265=_0x25d3a3[_0x3229('0x1f')][_0x3229('0x20')](',');_0x36618e[_0x3229('0x21')](_0x36e265[0x0]);_0x36618e['push'](_0x36e265[0x1]);_0x36618e[_0x3229('0x21')](_0x36e265[0x2]);_0x36618e['push'](_0x36e265[0x3]);_0x36618e['push'](_0x36e265['slice'](0x4,_0x36e265[_0x3229('0x19')])['join'](','));break;case'amazonlex':var _0x41a50d=_0x25d3a3[_0x3229('0x1f')][_0x3229('0x20')](',');_0x36618e[_0x3229('0x21')](_0x41a50d[0x0]);_0x36618e['push'](_0x41a50d[0x1]);_0x36618e['push'](_0x41a50d[0x2]);_0x36618e[_0x3229('0x21')](_0x41a50d[0x3]);_0x36618e[_0x3229('0x21')](_0x41a50d[_0x3229('0x22')](0x4,_0x41a50d['length'])[_0x3229('0x1b')](','));break;case _0x3229('0x15'):_0x36618e[_0x3229('0x21')](_0x25d3a3['appdata']);break;case _0x3229('0x25'):_0x36618e[_0x3229('0x21')](_0x25d3a3[_0x3229('0x26')]);_0x36618e[_0x3229('0x21')](_0x25d3a3[_0x3229('0x1f')]);break;case'tvox':var _0x27a3ce=utils['getMustacheRender'](_0x23a129['account']['notificationTemplate'],_0x23a129);var _0x1765ae=_0x25d3a3['appdata'][_0x3229('0x20')](',');_0x36618e[_0x3229('0x21')](_0x1765ae[0x0]);_0x36618e[_0x3229('0x21')](_0x1765ae[0x1]);_0x36618e['push'](_0x1765ae[0x2]);_0x36618e[_0x3229('0x21')](_0x1765ae[0x3]);_0x36618e['push'](_0x1765ae[0x4]);_0x36618e[_0x3229('0x21')](_0x1765ae[0x5]);_0x36618e[_0x3229('0x21')](_0x1765ae[0x6]);_0x36618e[_0x3229('0x21')](_0x1765ae[0x7]);_0x36618e[_0x3229('0x21')](_0x1765ae[0x8]);_0x36618e['push'](_0x1765ae[0x9]);_0x36618e[_0x3229('0x21')](_0x1765ae[0xa]);_0x36618e[_0x3229('0x21')](_0x23a129[_0x3229('0x16')]['id']);_0x36618e[_0x3229('0x21')](_0x23a129[_0x3229('0x15')]['id']);_0x36618e[_0x3229('0x21')](_0x25d3a3[_0x3229('0x27')]);_0x36618e[_0x3229('0x21')](_0x23a129['interaction']['ContactId']);_0x36618e[_0x3229('0x21')](_0x23a129['body'][_0x3229('0x28')]);_0x36618e[_0x3229('0x21')](_0x27a3ce);break;default:_0x36618e=_[_0x3229('0x10')](_0x25d3a3[_0x3229('0x1f')])?[]:_0x25d3a3[_0x3229('0x1f')][_0x3229('0x20')](',');}var _0x41ee8d={'id':util[_0x3229('0xd')](_0x3229('0x29'),_0x20d7fa,_0x25d3a3['id'],_0x25d3a3[_0x3229('0x1d')]),'condition':require(_0x3229('0x2a'))[_0x3229('0x2b')](_0x20d7fa,getIntervals(_0x3c69bb[_0x3229('0x2c')],_0x25d3a3),_0x3c69bb),'consequence':require(_0x3229('0x2d')+_0x25d3a3['app'])[_0x3229('0x2e')](_0x20d7fa,_0x36618e,_0x3c69bb,_0x23a129),'p':_0x25d3a3['priority']||0x0};logger[_0x3229('0x2f')]('Push\x20new\x20rule',_0x41ee8d['id'],_0x3229('0x30'),getIntervals(_0x3c69bb[_0x3229('0x2c')],_0x25d3a3)[_0x3229('0x1b')]('\x20|\x20'));_0x2dd842[_0x3229('0x21')](_0x41ee8d);}else{logger[_0x3229('0x31')](_0x3229('0x32'),path[_0x3229('0x1b')](__dirname,_0x3229('0x17'),_0x25d3a3['app']+_0x3229('0x1c')));}}_0x3c69bb[_0x3229('0x13')][_0x20d7fa]=new RuleEngine(_0x2dd842);_0x3c69bb[_0x3229('0x13')][_0x20d7fa][_0x3229('0x33')](_0x23a129,function(_0x26e0af){logger['info'](_0x3229('0x34'),JSON[_0x3229('0x35')](_0x26e0af['matchPath']));if(_0x3c69bb[_0x3229('0x13')][_0x20d7fa]){_0x3c69bb['rules'][_0x20d7fa]['emit']('complete');}});return _0xaead14({'code':0xc8,'message':_0x23a129});}else{if(_0x564c7a){logger[_0x3229('0x2f')](util[_0x3229('0xd')]('Skipped\x20routing\x20for\x20%s',_0x20d7fa));}else{logger[_0x3229('0x2f')](_0x3229('0x36'));}return _0xaead14({'code':0xc8,'message':_0x23a129});}}catch(_0x517a0c){logger[_0x3229('0x31')](_0x517a0c[_0x3229('0x37')]);return _0x1ee77b(_0x57db47[_0x3229('0x31')](0x1f4,_0x517a0c));}}return _0x1ee77b(_0x3229('0x38'));});},'AcceptMessage':function(_0x3289cc){var _0x159f6a=this;return new Promise(function(_0x5c4d0,_0x4aab5a){if(_0x3289cc[_0x3229('0x39')]&&_0x3289cc['agent']['id']){if(_0x3c69bb[_0x3229('0x3a')][_0x3289cc[_0x3229('0x39')]['id']]){_0x3c69bb[_0x3229('0x3a')][_0x3289cc[_0x3229('0x39')]['id']]['busy']=![];_0x3c69bb[_0x3229('0x3a')][_0x3289cc['agent']['id']]['busyQueue']=undefined;}}if(_0x3289cc[_0x3229('0x15')]&&_0x3289cc[_0x3229('0x15')]['id']){try{var _0x56e2a5=getId(_0x3289cc['channel'],_0x3289cc[_0x3229('0x15')]?_0x3289cc[_0x3229('0x15')]['id']:0x0,_0x3289cc[_0x3229('0x16')]?_0x3289cc[_0x3229('0x16')]['id']:0x0);if(_0x3c69bb[_0x3229('0x13')][_0x56e2a5]){_0x3c69bb[_0x3229('0x13')][_0x56e2a5][_0x3229('0x3b')](_0x3229('0x3c'));if(rpc[_0x3289cc[_0x3229('0x14')]+_0x3229('0x3d')]){rpc[_0x3289cc['channel']+'QueueReport']['update'](_0x56e2a5,{'UserId':_0x3289cc[_0x3229('0x15')][_0x3229('0x3e')]})[_0x3229('0x3f')](function(){logger[_0x3229('0x31')]('error\x20update\x20queue\x20report');});}}return _0x5c4d0({'code':0xc8,'message':_0x3289cc});}catch(_0x345dc7){logger[_0x3229('0x31')](_0x345dc7[_0x3229('0x37')]);return _0x4aab5a(_0x159f6a[_0x3229('0x31')](0x1f4,_0x345dc7));}}logger['error'](_0x3229('0x40'));return _0x4aab5a(_0x159f6a[_0x3229('0x31')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x183970){var _0x50f17b=this;return new Promise(function(_0x197845,_0x82190f){if(_0x183970[_0x3229('0x39')]&&_0x183970[_0x3229('0x39')]['id']){try{if(_0x3c69bb['agents'][_0x183970[_0x3229('0x39')]['id']]){_0x3c69bb[_0x3229('0x3a')][_0x183970[_0x3229('0x39')]['id']][_0x3229('0x41')]=![];_0x3c69bb[_0x3229('0x3a')][_0x183970[_0x3229('0x39')]['id']][_0x3229('0x42')]=undefined;}return _0x197845({'code':0xc8,'message':_0x183970});}catch(_0x16ea49){logger[_0x3229('0x31')](_0x16ea49[_0x3229('0x37')]);return _0x82190f(_0x50f17b[_0x3229('0x31')](0x1f4,_0x16ea49));}}logger['error']('message\x20is\x20empty');return _0x82190f(_0x50f17b[_0x3229('0x31')](0x1f4,_0x3229('0x40')));});},'AbandonInteraction':function(_0x4c0b4a){var _0x23a0b2=this;return new Promise(function(_0x2ed31a,_0x3b63f7){if(_0x4c0b4a[_0x3229('0x14')]&&_0x4c0b4a[_0x3229('0x16')]&&_0x4c0b4a[_0x3229('0x16')]['id']){try{var _0x538d1b=getId(_0x4c0b4a[_0x3229('0x14')],_0x4c0b4a[_0x3229('0x15')]?_0x4c0b4a[_0x3229('0x15')]['id']:0x0,_0x4c0b4a[_0x3229('0x16')]?_0x4c0b4a[_0x3229('0x16')]['id']:0x0);if(_0x3c69bb[_0x3229('0x13')][_0x538d1b]){_0x3c69bb[_0x3229('0x13')][_0x538d1b][_0x3229('0x3b')](_0x3229('0x3c'));}return _0x2ed31a({'code':0xc8,'message':_0x4c0b4a});}catch(_0xc2d2d8){logger[_0x3229('0x31')](_0xc2d2d8[_0x3229('0x37')]);return _0x3b63f7(_0x23a0b2['error'](0x1f4,_0xc2d2d8));}}logger[_0x3229('0x31')](_0x3229('0x40'));return _0x3b63f7(_0x23a0b2[_0x3229('0x31')](0x1f4,_0x3229('0x40')));});},'AgentCapacity':function(_0x12afd6){var _0x1cbf61=this;return new Promise(function(_0x37bfbf,_0x34c04e){if(_0x3c69bb['agents'][_0x3229('0x43')](_0x12afd6['id'])){for(var _0x29978e in _0x12afd6[_0x3229('0x44')]){if(_0x12afd6[_0x3229('0x44')]['hasOwnProperty'](_0x29978e)){if(_0x3c69bb['agents'][_0x12afd6['id']][_0x3229('0x43')](_0x29978e+_0x3229('0x45'))){_0x3c69bb[_0x3229('0x3a')][_0x12afd6['id']][_0x29978e+'CurrentCapacity']=parseInt(_0x12afd6[_0x3229('0x44')][_0x29978e],0xa);}}}_0x3c69bb['agents'][_0x12afd6['id']][_0x3229('0x46')]();return _0x37bfbf({'code':0xc8,'message':_0x3c69bb[_0x3229('0x3a')][_0x12afd6['id']]});}else{return _0x34c04e(_0x1cbf61[_0x3229('0x31')](0x1f4,_0x3229('0x47')));}});},'Agents':function(_0x465001){return new Promise(function(_0x4d86fe){var _0x331444=_[_0x3229('0x48')](_0x3c69bb[_0x3229('0x3a')]);if(_0x465001&&_0x465001['id']){var _0x3cc40=_[_0x3229('0x49')](_0x331444,function(_0x1ce5d6){return _0x1ce5d6['id']===_0x465001['id'];});_0x4d86fe(_0x3cc40);}else{_0x4d86fe({'count':_0x331444[_0x3229('0x19')],'rows':_0x331444});}});},'ChatQueues':function(){return new Promise(function(_0x35bfa7){var _0x4c2cb4=[];for(var _0x373c5d in _0x3c69bb[_0x3229('0x4a')]){if(_0x3c69bb[_0x3229('0x4a')][_0x3229('0x43')](_0x373c5d)){var _0x424556=_0x3c69bb['chatQueues'][_0x373c5d];var _0x1ec7ce={'id':_0x424556['id'],'available':_0x424556[_0x3229('0x4b')],'loggedIn':_0x424556['loggedIn'],'name':_0x424556['name'],'paused':_0x424556['paused'],'waiting':_0x424556[_0x3229('0x4c')]};_0x4c2cb4['push'](_0x1ec7ce);}}_0x35bfa7({'count':_0x4c2cb4[_0x3229('0x19')],'rows':_0x4c2cb4});});},'MailQueues':function(){return new Promise(function(_0x7773f7){var _0x2c114a=[];for(var _0x44da38 in _0x3c69bb['mailQueues']){if(_0x3c69bb[_0x3229('0x4d')][_0x3229('0x43')](_0x44da38)){var _0x15b167=_0x3c69bb[_0x3229('0x4d')][_0x44da38];var _0x5c5ddc={'id':_0x15b167['id'],'available':_0x15b167['available'],'loggedIn':_0x15b167['loggedIn'],'name':_0x15b167[_0x3229('0x4e')],'paused':_0x15b167['paused'],'waiting':_0x15b167['waiting']};_0x2c114a[_0x3229('0x21')](_0x5c5ddc);}}_0x7773f7({'count':_0x2c114a[_0x3229('0x19')],'rows':_0x2c114a});});},'OpenchannelQueues':function(){return new Promise(function(_0x1a36e7){var _0x482b60=[];for(var _0x5d70e6 in _0x3c69bb[_0x3229('0x4f')]){if(_0x3c69bb[_0x3229('0x4f')]['hasOwnProperty'](_0x5d70e6)){var _0x44f1d7=_0x3c69bb[_0x3229('0x4f')][_0x5d70e6];var _0x5c58ce={'id':_0x44f1d7['id'],'available':_0x44f1d7[_0x3229('0x4b')],'loggedIn':_0x44f1d7[_0x3229('0x50')],'name':_0x44f1d7[_0x3229('0x4e')],'paused':_0x44f1d7[_0x3229('0x51')],'waiting':_0x44f1d7[_0x3229('0x4c')]};_0x482b60[_0x3229('0x21')](_0x5c58ce);}}_0x1a36e7({'count':_0x482b60[_0x3229('0x19')],'rows':_0x482b60});});},'SmsQueues':function(){return new Promise(function(_0x5eb7b9){var _0x2afe6c=[];for(var _0x5cd697 in _0x3c69bb['smsQueues']){if(_0x3c69bb['smsQueues'][_0x3229('0x43')](_0x5cd697)){var _0x22b4ba=_0x3c69bb[_0x3229('0x52')][_0x5cd697];var _0x49de06={'id':_0x22b4ba['id'],'available':_0x22b4ba['available'],'loggedIn':_0x22b4ba[_0x3229('0x50')],'name':_0x22b4ba[_0x3229('0x4e')],'paused':_0x22b4ba[_0x3229('0x51')],'waiting':_0x22b4ba[_0x3229('0x4c')]};_0x2afe6c[_0x3229('0x21')](_0x49de06);}}_0x5eb7b9({'count':_0x2afe6c[_0x3229('0x19')],'rows':_0x2afe6c});});},'FaxQueues':function(){return new Promise(function(_0x1354f4){var _0x1467ee=[];for(var _0x33ca0d in _0x3c69bb[_0x3229('0x53')]){if(_0x3c69bb['faxQueues'][_0x3229('0x43')](_0x33ca0d)){var _0x1d3b12=_0x3c69bb[_0x3229('0x53')][_0x33ca0d];var _0x2db5b0={'id':_0x1d3b12['id'],'available':_0x1d3b12[_0x3229('0x4b')],'loggedIn':_0x1d3b12[_0x3229('0x50')],'name':_0x1d3b12['name'],'paused':_0x1d3b12['paused'],'waiting':_0x1d3b12[_0x3229('0x4c')]};_0x1467ee['push'](_0x2db5b0);}}_0x1354f4({'count':_0x1467ee['length'],'rows':_0x1467ee});});},'WhatsappQueues':function(){return new Promise(function(_0x35ca17){var _0x3d732e=[];for(var _0x27d383 in _0x3c69bb['whatsappQueues']){if(_0x3c69bb[_0x3229('0x54')][_0x3229('0x43')](_0x27d383)){var _0x4e459c=_0x3c69bb[_0x3229('0x54')][_0x27d383];var _0x460fbc={'id':_0x4e459c['id'],'available':_0x4e459c[_0x3229('0x4b')],'loggedIn':_0x4e459c[_0x3229('0x50')],'name':_0x4e459c['name'],'paused':_0x4e459c[_0x3229('0x51')],'waiting':_0x4e459c[_0x3229('0x4c')]};_0x3d732e[_0x3229('0x21')](_0x460fbc);}}_0x35ca17({'count':_0x3d732e[_0x3229('0x19')],'rows':_0x3d732e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x572884){var _0x408c5e=_[_0x3229('0x48')](_0x3c69bb[_0x3229('0x55')]);_0x572884({'count':_0x408c5e['length'],'rows':_0x408c5e});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x321ebc){var _0x9ff2e=_[_0x3229('0x48')](_0x3c69bb[_0x3229('0x56')]);_0x321ebc({'count':_0x9ff2e[_0x3229('0x19')],'rows':_0x9ff2e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x11e10b){var _0x1de7c8=_[_0x3229('0x48')](_0x3c69bb['openchannelQueuesWaitingInteractions']);_0x11e10b({'count':_0x1de7c8[_0x3229('0x19')],'rows':_0x1de7c8});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x145f12){var _0x185017=_['values'](_0x3c69bb[_0x3229('0x57')]);_0x145f12({'count':_0x185017['length'],'rows':_0x185017});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x266331){var _0x31a79e=_['values'](_0x3c69bb[_0x3229('0x58')]);_0x266331({'count':_0x31a79e[_0x3229('0x19')],'rows':_0x31a79e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x403a9a){var _0x5c15b5=_[_0x3229('0x48')](_0x3c69bb['whatsappQueuesWaitingInteractions']);_0x403a9a({'count':_0x5c15b5['length'],'rows':_0x5c15b5});});}};var _0x47a711=jayson[_0x3229('0x59')](_0x3b752f)[_0x3229('0x5a')]();_0x47a711['on'](_0x3229('0x31'),function(_0x4e3293){logger['error'](JSON[_0x3229('0x35')](_0x4e3293));return _0x5e2528(_0x4e3293);});_0x47a711[_0x3229('0x5b')](0x232c,_0x3229('0x5c'),function(){console[_0x3229('0x5d')](_0x3229('0x5e'),0x232c);return _0x6b83a1(_0x3229('0x5f')+0x232c);});});}; \ No newline at end of file +var _0x1b86=['.js','toLowerCase','appdata','split','mail','push','slice','join','dialogflowv2','amazonlex','TagId','tvox','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agents','agent','busy','busyQueue','channel','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','agent\x20not\x20found','chatQueues','available','name','paused','waiting','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','rules','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app'];(function(_0x599938,_0x5310e8){var _0x4523f5=function(_0x471e41){while(--_0x471e41){_0x599938['push'](_0x599938['shift']());}};_0x4523f5(++_0x5310e8);}(_0x1b86,0x9f));var _0x61b8=function(_0x31a251,_0x3e9856){_0x31a251=_0x31a251-0x0;var _0x122d4a=_0x1b86[_0x31a251];return _0x122d4a;};'use strict';var _=require(_0x61b8('0x0'));var util=require('util');var path=require(_0x61b8('0x1'));var fs=require('fs');var jayson=require(_0x61b8('0x2'));var BPromise=require(_0x61b8('0x3'));var utils=require(_0x61b8('0x4'));var sUtils=require(_0x61b8('0x5'));var logger=require(_0x61b8('0x6'))(_0x61b8('0x7'));var rpc={'openchannelQueueReport':require(_0x61b8('0x8')),'mailQueueReport':require(_0x61b8('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x61b8('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x61b8('0xb'));function getId(_0x3ca1af,_0x17de09,_0x4e23af){return util[_0x61b8('0xc')](_0x61b8('0xd'),_0x3ca1af,_0x17de09||0x0,_0x4e23af||0x0);}function getIntervals(_0x52114e,_0x25692a){var _0x1c4c81=[];if(!_[_0x61b8('0xe')](_0x25692a[_0x61b8('0xf')])&&!_[_0x61b8('0xe')](_0x52114e[_0x25692a[_0x61b8('0xf')]])&&!_[_0x61b8('0xe')](_0x52114e[_0x25692a[_0x61b8('0xf')]]['Intervals'])){_0x1c4c81=_[_0x61b8('0x10')](_0x52114e[_0x25692a[_0x61b8('0xf')]]['Intervals'],_0x61b8('0x11'));}else if(!_[_0x61b8('0xe')](_0x25692a[_0x61b8('0x11')])){_0x1c4c81=[_0x25692a[_0x61b8('0x11')]];}return _0x1c4c81;}exports['listen']=function(_0x13e556){_0x13e556[_0x61b8('0x12')]={};return new BPromise(function(_0x5dfe22,_0x4459a4){var _0xbbcb22={'Start':function(_0x2d539e){var _0x591cce=this;return new Promise(function(_0x533b52,_0x462187){if(_0x2d539e){try{var _0x28ee69=[];var _0x7f82d4=getId(_0x2d539e['channel'],_0x2d539e[_0x61b8('0x13')]?_0x2d539e[_0x61b8('0x13')]['id']:0x0,_0x2d539e[_0x61b8('0x14')]?_0x2d539e[_0x61b8('0x14')]['id']:0x0);var _0xc1972a=sUtils[_0x61b8('0x15')](_0x13e556,_0x2d539e);if(!_0xc1972a&&_0x2d539e[_0x61b8('0x16')]&&_[_0x61b8('0x17')](_0x2d539e['applications'])&&_0x2d539e[_0x61b8('0x16')][_0x61b8('0x18')]){for(var _0x39641b=0x0;_0x39641b<_0x2d539e[_0x61b8('0x16')]['length'];_0x39641b+=0x1){var _0xf19341=_0x2d539e[_0x61b8('0x16')][_0x39641b];if(fs[_0x61b8('0x19')](path['join'](__dirname,'applications',_0xf19341[_0x61b8('0x1a')]+_0x61b8('0x1b')))){var _0x346713=[];switch(_0xf19341[_0x61b8('0x1a')][_0x61b8('0x1c')]()){case'autoreply':var _0x246c0a=_0xf19341[_0x61b8('0x1d')][_0x61b8('0x1e')](',');if(_0x2d539e['channel']===_0x61b8('0x1f')){_0x346713['push'](_0x246c0a[0x0]);_0x346713[_0x61b8('0x20')](_0x246c0a[0x1]);_0x346713[_0x61b8('0x20')](_0x246c0a[_0x61b8('0x21')](0x2,_0x246c0a['length'])[_0x61b8('0x22')](','));}else{_0x346713['push'](_0x246c0a[0x0]);_0x346713['push'](_0x246c0a[_0x61b8('0x21')](0x1,_0x246c0a[_0x61b8('0x18')])[_0x61b8('0x22')](','));}break;case'dialogflow':var _0x306846=_0xf19341[_0x61b8('0x1d')][_0x61b8('0x1e')](',');_0x346713[_0x61b8('0x20')](_0x306846[0x0]);_0x346713[_0x61b8('0x20')](_0x306846[0x1]);_0x346713['push'](_0x306846[_0x61b8('0x21')](0x2,_0x306846[_0x61b8('0x18')])['join'](','));break;case _0x61b8('0x23'):var _0x37dc9f=_0xf19341[_0x61b8('0x1d')][_0x61b8('0x1e')](',');_0x346713['push'](_0x37dc9f[0x0]);_0x346713[_0x61b8('0x20')](_0x37dc9f[0x1]);_0x346713[_0x61b8('0x20')](_0x37dc9f[0x2]);_0x346713['push'](_0x37dc9f[0x3]);_0x346713[_0x61b8('0x20')](_0x37dc9f[_0x61b8('0x21')](0x4,_0x37dc9f[_0x61b8('0x18')])[_0x61b8('0x22')](','));break;case _0x61b8('0x24'):var _0x263801=_0xf19341['appdata'][_0x61b8('0x1e')](',');_0x346713[_0x61b8('0x20')](_0x263801[0x0]);_0x346713[_0x61b8('0x20')](_0x263801[0x1]);_0x346713[_0x61b8('0x20')](_0x263801[0x2]);_0x346713[_0x61b8('0x20')](_0x263801[0x3]);_0x346713['push'](_0x263801[_0x61b8('0x21')](0x4,_0x263801['length'])[_0x61b8('0x22')](','));break;case _0x61b8('0x13'):_0x346713[_0x61b8('0x20')](_0xf19341[_0x61b8('0x1d')]);break;case'tag':_0x346713['push'](_0xf19341[_0x61b8('0x25')]);_0x346713[_0x61b8('0x20')](_0xf19341[_0x61b8('0x1d')]);break;case _0x61b8('0x26'):var _0x1514d9=utils['getMustacheRender'](_0x2d539e[_0x61b8('0x27')][_0x61b8('0x28')],_0x2d539e);var _0x431e45=_0xf19341[_0x61b8('0x1d')][_0x61b8('0x1e')](',');_0x346713[_0x61b8('0x20')](_0x431e45[0x0]);_0x346713[_0x61b8('0x20')](_0x431e45[0x1]);_0x346713[_0x61b8('0x20')](_0x431e45[0x2]);_0x346713[_0x61b8('0x20')](_0x431e45[0x3]);_0x346713['push'](_0x431e45[0x4]);_0x346713[_0x61b8('0x20')](_0x431e45[0x5]);_0x346713[_0x61b8('0x20')](_0x431e45[0x6]);_0x346713[_0x61b8('0x20')](_0x431e45[0x7]);_0x346713[_0x61b8('0x20')](_0x431e45[0x8]);_0x346713['push'](_0x431e45[0x9]);_0x346713[_0x61b8('0x20')](_0x431e45[0xa]);_0x346713[_0x61b8('0x20')](_0x2d539e['interaction']['id']);_0x346713['push'](_0x2d539e[_0x61b8('0x13')]['id']);_0x346713['push'](_0xf19341[_0x61b8('0x29')]);_0x346713['push'](_0x2d539e[_0x61b8('0x14')]['ContactId']);_0x346713['push'](_0x2d539e[_0x61b8('0x2a')][_0x61b8('0x2a')]);_0x346713[_0x61b8('0x20')](_0x1514d9);break;default:_0x346713=_[_0x61b8('0xe')](_0xf19341['appdata'])?[]:_0xf19341[_0x61b8('0x1d')]['split'](',');}var _0x26a97e={'id':util[_0x61b8('0xc')](_0x61b8('0x2b'),_0x7f82d4,_0xf19341['id'],_0xf19341[_0x61b8('0x1a')]),'condition':require('./interval')[_0x61b8('0x2c')](_0x7f82d4,getIntervals(_0x13e556[_0x61b8('0x2d')],_0xf19341),_0x13e556),'consequence':require(_0x61b8('0x2e')+_0xf19341[_0x61b8('0x1a')])[_0x61b8('0x2f')](_0x7f82d4,_0x346713,_0x13e556,_0x2d539e),'p':_0xf19341[_0x61b8('0x30')]||0x0};logger[_0x61b8('0x31')]('Push\x20new\x20rule',_0x26a97e['id'],'on\x20interval',getIntervals(_0x13e556[_0x61b8('0x2d')],_0xf19341)['join'](_0x61b8('0x32')));_0x28ee69[_0x61b8('0x20')](_0x26a97e);}else{logger[_0x61b8('0x33')](_0x61b8('0x34'),path[_0x61b8('0x22')](__dirname,_0x61b8('0x16'),_0xf19341[_0x61b8('0x1a')]+'.js'));}}_0x13e556[_0x61b8('0x12')][_0x7f82d4]=new RuleEngine(_0x28ee69);_0x13e556['rules'][_0x7f82d4]['execute'](_0x2d539e,function(_0x1bac1c){logger[_0x61b8('0x31')]('Applications\x20executed',JSON['stringify'](_0x1bac1c[_0x61b8('0x35')]));if(_0x13e556['rules'][_0x7f82d4]){_0x13e556[_0x61b8('0x12')][_0x7f82d4][_0x61b8('0x36')]('complete');}});return _0x533b52({'code':0xc8,'message':_0x2d539e});}else{if(_0xc1972a){logger[_0x61b8('0x31')](util[_0x61b8('0xc')](_0x61b8('0x37'),_0x7f82d4));}else{logger[_0x61b8('0x31')](_0x61b8('0x38'));}return _0x533b52({'code':0xc8,'message':_0x2d539e});}}catch(_0x651c67){logger[_0x61b8('0x33')](_0x651c67[_0x61b8('0x39')]);return _0x462187(_0x591cce['error'](0x1f4,_0x651c67));}}return _0x462187(_0x61b8('0x3a'));});},'AcceptMessage':function(_0x404b93){var _0x1a4c8a=this;return new Promise(function(_0x4d21af,_0x41cbfe){if(_0x404b93['agent']&&_0x404b93['agent']['id']){if(_0x13e556[_0x61b8('0x3b')][_0x404b93[_0x61b8('0x3c')]['id']]){_0x13e556[_0x61b8('0x3b')][_0x404b93[_0x61b8('0x3c')]['id']][_0x61b8('0x3d')]=![];_0x13e556[_0x61b8('0x3b')][_0x404b93[_0x61b8('0x3c')]['id']][_0x61b8('0x3e')]=undefined;}}if(_0x404b93['message']&&_0x404b93[_0x61b8('0x13')]['id']){try{var _0x1a244a=getId(_0x404b93['channel'],_0x404b93[_0x61b8('0x13')]?_0x404b93[_0x61b8('0x13')]['id']:0x0,_0x404b93[_0x61b8('0x14')]?_0x404b93[_0x61b8('0x14')]['id']:0x0);if(_0x13e556['rules'][_0x1a244a]){_0x13e556[_0x61b8('0x12')][_0x1a244a][_0x61b8('0x36')]('end');if(rpc[_0x404b93['channel']+'QueueReport']){rpc[_0x404b93[_0x61b8('0x3f')]+'QueueReport'][_0x61b8('0x40')](_0x1a244a,{'UserId':_0x404b93[_0x61b8('0x13')][_0x61b8('0x41')]})['catch'](function(){logger[_0x61b8('0x33')](_0x61b8('0x42'));});}}return _0x4d21af({'code':0xc8,'message':_0x404b93});}catch(_0x2464a7){logger[_0x61b8('0x33')](_0x2464a7[_0x61b8('0x39')]);return _0x41cbfe(_0x1a4c8a['error'](0x1f4,_0x2464a7));}}logger[_0x61b8('0x33')](_0x61b8('0x43'));return _0x41cbfe(_0x1a4c8a[_0x61b8('0x33')](0x1f4,_0x61b8('0x43')));});},'RejectMessage':function(_0x14076d){var _0x55ad32=this;return new Promise(function(_0x553818,_0xe7f493){if(_0x14076d['agent']&&_0x14076d['agent']['id']){try{if(_0x13e556[_0x61b8('0x3b')][_0x14076d[_0x61b8('0x3c')]['id']]){_0x13e556[_0x61b8('0x3b')][_0x14076d[_0x61b8('0x3c')]['id']][_0x61b8('0x3d')]=![];_0x13e556[_0x61b8('0x3b')][_0x14076d[_0x61b8('0x3c')]['id']][_0x61b8('0x3e')]=undefined;}return _0x553818({'code':0xc8,'message':_0x14076d});}catch(_0x3a500d){logger[_0x61b8('0x33')](_0x3a500d[_0x61b8('0x39')]);return _0xe7f493(_0x55ad32[_0x61b8('0x33')](0x1f4,_0x3a500d));}}logger[_0x61b8('0x33')]('message\x20is\x20empty');return _0xe7f493(_0x55ad32['error'](0x1f4,_0x61b8('0x43')));});},'AbandonInteraction':function(_0x2e1604){var _0x4cb53c=this;return new Promise(function(_0x191e77,_0x412f3e){if(_0x2e1604['channel']&&_0x2e1604[_0x61b8('0x14')]&&_0x2e1604[_0x61b8('0x14')]['id']){try{var _0x43e7c7=getId(_0x2e1604['channel'],_0x2e1604['message']?_0x2e1604['message']['id']:0x0,_0x2e1604[_0x61b8('0x14')]?_0x2e1604[_0x61b8('0x14')]['id']:0x0);if(_0x13e556[_0x61b8('0x12')][_0x43e7c7]){_0x13e556[_0x61b8('0x12')][_0x43e7c7]['emit']('end');}return _0x191e77({'code':0xc8,'message':_0x2e1604});}catch(_0x24a21c){logger[_0x61b8('0x33')](_0x24a21c[_0x61b8('0x39')]);return _0x412f3e(_0x4cb53c['error'](0x1f4,_0x24a21c));}}logger[_0x61b8('0x33')](_0x61b8('0x43'));return _0x412f3e(_0x4cb53c['error'](0x1f4,_0x61b8('0x43')));});},'AgentCapacity':function(_0xf0d8d8){var _0x2b579c=this;return new Promise(function(_0x57c1e8,_0x46589a){if(_0x13e556[_0x61b8('0x3b')]['hasOwnProperty'](_0xf0d8d8['id'])){for(var _0x5f45ea in _0xf0d8d8['capacity']){if(_0xf0d8d8['capacity'][_0x61b8('0x44')](_0x5f45ea)){if(_0x13e556[_0x61b8('0x3b')][_0xf0d8d8['id']][_0x61b8('0x44')](_0x5f45ea+_0x61b8('0x45'))){_0x13e556[_0x61b8('0x3b')][_0xf0d8d8['id']][_0x5f45ea+_0x61b8('0x45')]=parseInt(_0xf0d8d8[_0x61b8('0x46')][_0x5f45ea],0xa);}}}_0x13e556[_0x61b8('0x3b')][_0xf0d8d8['id']]['updateRealtime']();return _0x57c1e8({'code':0xc8,'message':_0x13e556[_0x61b8('0x3b')][_0xf0d8d8['id']]});}else{return _0x46589a(_0x2b579c[_0x61b8('0x33')](0x1f4,_0x61b8('0x47')));}});},'Agents':function(_0x2bf5f0){return new Promise(function(_0x25c7f5){var _0x2f3998=_['values'](_0x13e556[_0x61b8('0x3b')]);if(_0x2bf5f0&&_0x2bf5f0['id']){var _0x32bb8c=_['find'](_0x2f3998,function(_0xb72602){return _0xb72602['id']===_0x2bf5f0['id'];});_0x25c7f5(_0x32bb8c);}else{_0x25c7f5({'count':_0x2f3998[_0x61b8('0x18')],'rows':_0x2f3998});}});},'ChatQueues':function(){return new Promise(function(_0x664e39){var _0x3ee292=[];for(var _0x335a6d in _0x13e556[_0x61b8('0x48')]){if(_0x13e556[_0x61b8('0x48')]['hasOwnProperty'](_0x335a6d)){var _0xf80d1f=_0x13e556[_0x61b8('0x48')][_0x335a6d];var _0xc5de7b={'id':_0xf80d1f['id'],'available':_0xf80d1f[_0x61b8('0x49')],'loggedIn':_0xf80d1f['loggedIn'],'name':_0xf80d1f[_0x61b8('0x4a')],'paused':_0xf80d1f[_0x61b8('0x4b')],'waiting':_0xf80d1f[_0x61b8('0x4c')]};_0x3ee292[_0x61b8('0x20')](_0xc5de7b);}}_0x664e39({'count':_0x3ee292[_0x61b8('0x18')],'rows':_0x3ee292});});},'MailQueues':function(){return new Promise(function(_0x5ead1d){var _0x5c1ce5=[];for(var _0x3dcca in _0x13e556['mailQueues']){if(_0x13e556['mailQueues']['hasOwnProperty'](_0x3dcca)){var _0x7635a1=_0x13e556['mailQueues'][_0x3dcca];var _0x2c31c5={'id':_0x7635a1['id'],'available':_0x7635a1[_0x61b8('0x49')],'loggedIn':_0x7635a1[_0x61b8('0x4d')],'name':_0x7635a1[_0x61b8('0x4a')],'paused':_0x7635a1[_0x61b8('0x4b')],'waiting':_0x7635a1['waiting']};_0x5c1ce5[_0x61b8('0x20')](_0x2c31c5);}}_0x5ead1d({'count':_0x5c1ce5['length'],'rows':_0x5c1ce5});});},'OpenchannelQueues':function(){return new Promise(function(_0x1a4e42){var _0x3830dc=[];for(var _0x3ce546 in _0x13e556[_0x61b8('0x4e')]){if(_0x13e556[_0x61b8('0x4e')][_0x61b8('0x44')](_0x3ce546)){var _0x90256=_0x13e556[_0x61b8('0x4e')][_0x3ce546];var _0x352eb0={'id':_0x90256['id'],'available':_0x90256[_0x61b8('0x49')],'loggedIn':_0x90256[_0x61b8('0x4d')],'name':_0x90256['name'],'paused':_0x90256[_0x61b8('0x4b')],'waiting':_0x90256[_0x61b8('0x4c')]};_0x3830dc[_0x61b8('0x20')](_0x352eb0);}}_0x1a4e42({'count':_0x3830dc[_0x61b8('0x18')],'rows':_0x3830dc});});},'SmsQueues':function(){return new Promise(function(_0x414bfe){var _0x34d82d=[];for(var _0x48e36c in _0x13e556[_0x61b8('0x4f')]){if(_0x13e556['smsQueues'][_0x61b8('0x44')](_0x48e36c)){var _0x3c0d94=_0x13e556[_0x61b8('0x4f')][_0x48e36c];var _0x1c36c0={'id':_0x3c0d94['id'],'available':_0x3c0d94[_0x61b8('0x49')],'loggedIn':_0x3c0d94[_0x61b8('0x4d')],'name':_0x3c0d94['name'],'paused':_0x3c0d94[_0x61b8('0x4b')],'waiting':_0x3c0d94[_0x61b8('0x4c')]};_0x34d82d['push'](_0x1c36c0);}}_0x414bfe({'count':_0x34d82d[_0x61b8('0x18')],'rows':_0x34d82d});});},'FaxQueues':function(){return new Promise(function(_0x2053b5){var _0x366fcd=[];for(var _0x526a33 in _0x13e556[_0x61b8('0x50')]){if(_0x13e556[_0x61b8('0x50')][_0x61b8('0x44')](_0x526a33)){var _0x69b240=_0x13e556[_0x61b8('0x50')][_0x526a33];var _0x4c7616={'id':_0x69b240['id'],'available':_0x69b240['available'],'loggedIn':_0x69b240['loggedIn'],'name':_0x69b240[_0x61b8('0x4a')],'paused':_0x69b240[_0x61b8('0x4b')],'waiting':_0x69b240['waiting']};_0x366fcd[_0x61b8('0x20')](_0x4c7616);}}_0x2053b5({'count':_0x366fcd['length'],'rows':_0x366fcd});});},'WhatsappQueues':function(){return new Promise(function(_0x56049d){var _0x3bd73b=[];for(var _0x468f24 in _0x13e556[_0x61b8('0x51')]){if(_0x13e556['whatsappQueues'][_0x61b8('0x44')](_0x468f24)){var _0x449f66=_0x13e556['whatsappQueues'][_0x468f24];var _0x56bdad={'id':_0x449f66['id'],'available':_0x449f66[_0x61b8('0x49')],'loggedIn':_0x449f66[_0x61b8('0x4d')],'name':_0x449f66['name'],'paused':_0x449f66['paused'],'waiting':_0x449f66[_0x61b8('0x4c')]};_0x3bd73b[_0x61b8('0x20')](_0x56bdad);}}_0x56049d({'count':_0x3bd73b[_0x61b8('0x18')],'rows':_0x3bd73b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x17266e){var _0x141e01=_[_0x61b8('0x52')](_0x13e556['chatQueuesWaitingInteractions']);_0x17266e({'count':_0x141e01[_0x61b8('0x18')],'rows':_0x141e01});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x55c439){var _0x6e85f9=_[_0x61b8('0x52')](_0x13e556[_0x61b8('0x53')]);_0x55c439({'count':_0x6e85f9['length'],'rows':_0x6e85f9});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1629c8){var _0x2700c3=_[_0x61b8('0x52')](_0x13e556[_0x61b8('0x54')]);_0x1629c8({'count':_0x2700c3['length'],'rows':_0x2700c3});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4de02){var _0x3f1218=_[_0x61b8('0x52')](_0x13e556['smsQueuesWaitingInteractions']);_0x4de02({'count':_0x3f1218[_0x61b8('0x18')],'rows':_0x3f1218});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x461ee3){var _0x25a745=_[_0x61b8('0x52')](_0x13e556[_0x61b8('0x55')]);_0x461ee3({'count':_0x25a745['length'],'rows':_0x25a745});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4cfe4a){var _0x5a35a3=_['values'](_0x13e556[_0x61b8('0x56')]);_0x4cfe4a({'count':_0x5a35a3[_0x61b8('0x18')],'rows':_0x5a35a3});});}};var _0x4c6ddc=jayson[_0x61b8('0x57')](_0xbbcb22)[_0x61b8('0x58')]();_0x4c6ddc['on'](_0x61b8('0x33'),function(_0x2ac844){logger[_0x61b8('0x33')](JSON[_0x61b8('0x59')](_0x2ac844));return _0x4459a4(_0x2ac844);});_0x4c6ddc['listen'](0x232c,_0x61b8('0x5a'),function(){console[_0x61b8('0x5b')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5dfe22(_0x61b8('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 7a9004d..34f3ca4 100644 --- a/server/services/routing/server/interval.js +++ b/server/services/routing/server/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61f6=['log','join','stack','jayson/promise','routing','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','\x20|\x20','when'];(function(_0x5b3361,_0x5838fd){var _0x35d3e1=function(_0x371d53){while(--_0x371d53){_0x5b3361['push'](_0x5b3361['shift']());}};_0x35d3e1(++_0x5838fd);}(_0x61f6,0x1d7));var _0x661f=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x61f6[_0x1f36bb];return _0xaf97fa;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x661f('0x0'));var _=require('lodash');var logger=require('../../../config/logger')(_0x661f('0x1'));var client=jayson['client'][_0x661f('0x2')]({'port':0x232a});function request(_0x4f8a05,_0x11f0f7){return new BPromise(function(_0x2fcf0b,_0x1531e9){return client[_0x661f('0x3')](_0x4f8a05,_0x11f0f7)[_0x661f('0x4')](function(_0x1fc195){if(_0x1fc195['error']){return _0x1531e9(_0x1fc195[_0x661f('0x5')][_0x661f('0x6')]);}else{return _0x2fcf0b(_0x1fc195[_0x661f('0x7')]);}})[_0x661f('0x8')](function(_0x4df1d2){return _0x1531e9(_0x4df1d2);});});}exports[_0x661f('0x9')]=function(_0x905606,_0x16f0cb,_0x4254ad){return function(_0x384200){if(_0x4254ad['rules']&&!_0x4254ad[_0x661f('0xa')][_0x905606]){logger[_0x661f('0xb')](_0x661f('0xc'),_0x905606);return _0x384200[_0x661f('0xd')]();}var _0x97b657=[];for(var _0x28c73b=0x0;_0x28c73b<_0x16f0cb[_0x661f('0xe')];_0x28c73b+=0x1){_0x97b657['push'](request(_0x661f('0xf'),{'command':util['format'](_0x661f('0x10'),_0x16f0cb[_0x28c73b])})[_0x661f('0x4')](function(_0x373232){return _0x373232&&_0x373232[_0x661f('0x6')]&&_0x373232[_0x661f('0x6')][_0x661f('0x11')](_0x661f('0x12'))>=0x0?!![]:![];})[_0x661f('0x8')](function(_0x514c31){logger[_0x661f('0x5')](_0x661f('0x13'),_0x905606,_0x16f0cb[_0x28c73b]);}));}BPromise[_0x661f('0x14')](_0x97b657)[_0x661f('0x4')](function(_0x75b86b){var _0x3989a2=_['some'](_0x75b86b);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x905606,_0x16f0cb['join'](_0x661f('0x15')),_0x3989a2);_0x384200[_0x661f('0x16')](_0x3989a2);})[_0x661f('0x8')](function(_0x1f624a){console[_0x661f('0x17')](_0x1f624a);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x905606,_0x16f0cb[_0x661f('0x18')](_0x661f('0x15')),_0x1f624a[_0x661f('0x19')]);_0x384200[_0x661f('0xd')]();});};}; \ No newline at end of file +var _0x244c=['routing','client','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','lodash','../../../config/logger'];(function(_0x35e06d,_0xad434c){var _0x1b7a39=function(_0x40efcb){while(--_0x40efcb){_0x35e06d['push'](_0x35e06d['shift']());}};_0x1b7a39(++_0xad434c);}(_0x244c,0x18f));var _0xc244=function(_0xce623b,_0x42655f){_0xce623b=_0xce623b-0x0;var _0x370b1a=_0x244c[_0xce623b];return _0x370b1a;};'use strict';var util=require(_0xc244('0x0'));var BPromise=require('bluebird');var jayson=require(_0xc244('0x1'));var _=require(_0xc244('0x2'));var logger=require(_0xc244('0x3'))(_0xc244('0x4'));var client=jayson[_0xc244('0x5')]['http']({'port':0x232a});function request(_0x855594,_0xea4002){return new BPromise(function(_0x35fed1,_0x26758f){return client[_0xc244('0x6')](_0x855594,_0xea4002)[_0xc244('0x7')](function(_0x2cd208){if(_0x2cd208[_0xc244('0x8')]){return _0x26758f(_0x2cd208[_0xc244('0x8')]['message']);}else{return _0x35fed1(_0x2cd208[_0xc244('0x9')]);}})[_0xc244('0xa')](function(_0x40b9cc){return _0x26758f(_0x40b9cc);});});}exports[_0xc244('0xb')]=function(_0x57ae5b,_0x5cffe6,_0x4edb1f){return function(_0x2fd25e){if(_0x4edb1f[_0xc244('0xc')]&&!_0x4edb1f[_0xc244('0xc')][_0x57ae5b]){logger[_0xc244('0xd')](_0xc244('0xe'),_0x57ae5b);return _0x2fd25e[_0xc244('0xf')]();}var _0x3d5702=[];for(var _0x3d1906=0x0;_0x3d1906<_0x5cffe6[_0xc244('0x10')];_0x3d1906+=0x1){_0x3d5702[_0xc244('0x11')](request(_0xc244('0x12'),{'command':util['format'](_0xc244('0x13'),_0x5cffe6[_0x3d1906])})['then'](function(_0x24df40){return _0x24df40&&_0x24df40[_0xc244('0x14')]&&_0x24df40[_0xc244('0x14')][_0xc244('0x15')](_0xc244('0x16'))>=0x0?!![]:![];})['catch'](function(_0x50953d){logger[_0xc244('0x8')](_0xc244('0x17'),_0x57ae5b,_0x5cffe6[_0x3d1906]);}));}BPromise[_0xc244('0x18')](_0x3d5702)[_0xc244('0x7')](function(_0x3076df){var _0x1a26b1=_['some'](_0x3076df);logger[_0xc244('0xd')](_0xc244('0x19'),_0x57ae5b,_0x5cffe6[_0xc244('0x1a')](_0xc244('0x1b')),_0x1a26b1);_0x2fd25e[_0xc244('0x1c')](_0x1a26b1);})[_0xc244('0xa')](function(_0x362456){console[_0xc244('0x1d')](_0x362456);logger['error'](_0xc244('0x19'),_0x57ae5b,_0x5cffe6['join'](_0xc244('0x1b')),_0x362456[_0xc244('0x1e')]);_0x2fd25e[_0xc244('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d13400c..5b3f721 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','util','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','forIn'];(function(_0x4dc392,_0x255362){var _0x4e45ad=function(_0x1d932d){while(--_0x1d932d){_0x4dc392['push'](_0x4dc392['shift']());}};_0x4e45ad(++_0x255362);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var utils=require(_0x0baf('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e212d,_0x263f79){utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1e212d[_0x0baf('0x4')],_0x1e212d[_0x0baf('0x5')],_0x1e212d[_0x0baf('0x6')],_0x1e212d[_0x0baf('0x7')],_0x1e212d[_0x0baf('0x8')],_0x1e212d[_0x0baf('0x9')],_0x1e212d[_0x0baf('0xa')],_0x1e212d[_0x0baf('0xb')]));if(_0x1e212d[_0x0baf('0x6')]){utils['getVoiceQueueByName'](_0x1e212d[_0x0baf('0x6')])['then'](function(_0x4605c3){if(_0x4605c3){_0x1e212d[_0x0baf('0xc')]=_0x4605c3[_0x0baf('0xc')];_0x1e212d[_0x0baf('0xd')]=_0x1e212d[_0x0baf('0xe')]?_0x4605c3[_0x0baf('0xf')]:![];_0x1e212d[_0x0baf('0x10')]=_0x1e212d[_0x0baf('0xd')]?_0x4605c3[_0x0baf('0x11')]:0x0;}utils[_0x0baf('0x12')](_0x0baf('0x13'),_0x1e212d);});}else{utils['request']('CreateVoiceAgentReport',_0x1e212d);}if(_0x263f79){delete transfers[_0x1e212d[_0x0baf('0x4')]];}else{delete agents[_0x1e212d[_0x0baf('0x14')]];}}exports[_0x0baf('0x15')]=function(_0x13df17){try{utils['debug'](util[_0x0baf('0x3')]('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x13df17);agents[_0x13df17[_0x0baf('0x14')]]=_0x13df17;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();agents[_0x13df17[_0x0baf('0x14')]]['lastevent']='called';agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0xa')]=null;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x18')]=null;utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x13df17[_0x0baf('0x4')],agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x7')],_0x13df17[_0x0baf('0x14')]));}catch(_0x47070d){utils[_0x0baf('0x19')](util['format']('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x47070d);}};exports[_0x0baf('0x1a')]=function(_0x32e839){try{if(!_[_0x0baf('0x1b')](agents[_0x32e839[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0x32e839);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x1e'),_0x32e839['uniqueid'],agents[_0x32e839[_0x0baf('0x14')]]['membername'],_0x32e839['destuniqueid']));agents[_0x32e839[_0x0baf('0x14')]]['agentringnoanswer']=!![];agents[_0x32e839['destuniqueid']][_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x20');agents[_0x32e839['destuniqueid']][_0x0baf('0x21')]=_0x0baf('0x20');agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x32e839[_0x0baf('0x23')]?parseInt(_0x32e839[_0x0baf('0x23')])/0x3e8:0x0;agents[_0x32e839[_0x0baf('0x14')]]['talktime']=0x0;unanswered[_0x0baf('0x24')](_0x32e839[_0x0baf('0x14')]);}}catch(_0xcaf13d){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0xcaf13d);}};exports['queuecallerabandon']=function(_0x44ec31){try{_[_0x0baf('0x25')](agents,function(_0x478ce8,_0xb4dbb1){if(_0x478ce8[_0x0baf('0x4')]==_0x44ec31[_0x0baf('0x4')]&&!_[_0x0baf('0x26')](unanswered,_0x478ce8['destuniqueid'])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31[_0x0baf('0x4')]),_0x44ec31);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x28'),_0x44ec31[_0x0baf('0x4')],_0x478ce8[_0x0baf('0x7')],_0x478ce8[_0x0baf('0x14')]));_0x478ce8[_0x0baf('0x1a')]=!![];_0x478ce8[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x478ce8[_0x0baf('0xb')]='abandoned';_0x478ce8[_0x0baf('0x21')]='abandoned';_0x478ce8[_0x0baf('0x22')]=_0x44ec31[_0x0baf('0x22')];_0x478ce8[_0x0baf('0x29')]=0x0;writeDB(_0x478ce8);}});}catch(_0x3d65f2){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31['uniqueid']),_0x3d65f2);}};exports[_0x0baf('0x2a')]=function(_0x2447c2){try{if(agents[_0x2447c2[_0x0baf('0x14')]]){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x2447c2);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x2c'),_0x2447c2[_0x0baf('0x4')],agents[_0x2447c2['destuniqueid']][_0x0baf('0x7')],_0x2447c2['destuniqueid']));agents[_0x2447c2['destuniqueid']][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();agents[_0x2447c2['destuniqueid']]['connectedlinenum']=_0x2447c2[_0x0baf('0xa')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x18')]=_0x2447c2[_0x0baf('0x18')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x2e');_[_0x0baf('0x25')](agents,function(_0x148540,_0x354cb1){if(_0x148540[_0x0baf('0x14')]!=_0x2447c2['destuniqueid']&&_0x148540[_0x0baf('0x4')]==_0x2447c2[_0x0baf('0x4')]){_0x148540['talktime']=0x0;_0x148540[_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];_0x148540[_0x0baf('0x1a')]=!![];_0x148540[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x148540[_0x0baf('0xb')]='answered_elsewhere';_0x148540[_0x0baf('0x21')]=_0x0baf('0x2f');_0x148540['answeredelsewheredestinationuniqueid']=_0x2447c2[_0x0baf('0x14')];_0x148540[_0x0baf('0x30')]=_0x2447c2[_0x0baf('0x7')];writeDB(_0x148540);}});}}catch(_0x57903e){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x57903e);}};exports[_0x0baf('0xe')]=function(_0x2b6d54){try{if(!_[_0x0baf('0x1b')](agents[_0x2b6d54[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54['uniqueid']),_0x2b6d54);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x32'),_0x2b6d54[_0x0baf('0x4')],agents[_0x2b6d54[_0x0baf('0x14')]]['membername'],_0x2b6d54[_0x0baf('0x14')]));agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0xe')]=!![];agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')]=utils['now']();agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')],agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x2d')]);agents[_0x2b6d54['destuniqueid']][_0x0baf('0x21')]=_0x2b6d54[_0x0baf('0x21')];agents[_0x2b6d54[_0x0baf('0x14')]]['lastevent']=_0x0baf('0x35');writeDB(agents[_0x2b6d54[_0x0baf('0x14')]]);}}catch(_0x10fa62){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54[_0x0baf('0x4')]),_0x10fa62);}};exports['blindtransfer']=function(_0x22c451){try{if(!_[_0x0baf('0x1b')](agents[_0x22c451[_0x0baf('0x36')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x37'),_0x22c451[_0x0baf('0x4')]),_0x22c451);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x38'),_0x22c451[_0x0baf('0x4')],agents[_0x22c451['transfereruniqueid']]['membername'],agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')]));agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x39')]=!![];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3a')]=_0x0baf('0x3b');agents[_0x22c451['transfereruniqueid']][_0x0baf('0x3c')]=_0x22c451[_0x0baf('0x3d')];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3e')]=agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')];}}catch(_0x5e1849){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x37'),_0x22c451['uniqueid']),_0x5e1849);}};exports[_0x0baf('0x3f')]=function(_0x5eaeb2){try{utils[_0x0baf('0x1c')](util['format'](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5eaeb2);if(_0x5eaeb2[_0x0baf('0x41')]==_0x5eaeb2[_0x0baf('0x42')]){if(!_[_0x0baf('0x1b')](agents[_0x5eaeb2['secondtransfereruniqueid']])){utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x43'),_0x5eaeb2[_0x0baf('0x41')],agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x7')]));agents[_0x5eaeb2['secondtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3a')]=_0x0baf('0x45');agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x46')];agents[_0x5eaeb2['secondtransfereruniqueid']]['transferuniqueid']=_0x5eaeb2[_0x0baf('0x41')];}if(_0x5eaeb2[_0x0baf('0x47')]&&agents[_0x5eaeb2[_0x0baf('0x47')]]){agents[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x1;transfers[_0x5eaeb2[_0x0baf('0x47')]]=_[_0x0baf('0x49')](agents[_0x5eaeb2[_0x0baf('0x47')]]);transfers[_0x5eaeb2[_0x0baf('0x47')]]['calleridnum']=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x4a')];transfers[_0x5eaeb2[_0x0baf('0x47')]]['agentcalledAt']=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x2;}}else if(_0x5eaeb2['secondtransfereruniqueid']==_0x5eaeb2[_0x0baf('0x4b')]){if(!_['isNil'](agents[_0x5eaeb2[_0x0baf('0x41')]])){utils['info'](util['format'](_0x0baf('0x43'),_0x5eaeb2['origtransfereruniqueid'],agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x7')]));agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3a')]='ATTENDED';agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x4c')];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3e')]=_0x5eaeb2[_0x0baf('0x44')];}if(_0x5eaeb2['transfertargetuniqueid']&&agents[_0x5eaeb2[_0x0baf('0x4d')]]){agents[_0x5eaeb2['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x5eaeb2['transfertargetuniqueid']]=_[_0x0baf('0x49')](agents[_0x5eaeb2['transfertargetuniqueid']]);transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x9')]=agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x41')]]['calleridname'];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x48')]=0x2;}}}catch(_0x5d4053){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5d4053);}};exports[_0x0baf('0x4e')]=function(_0x27a959){try{utils[_0x0baf('0x1c')](util['format']('[%s][agents][hangup]',_0x27a959['uniqueid']),_0x27a959);if(agents[_0x27a959[_0x0baf('0x4')]]&&agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]===_0x0baf('0x20')){if(_0x27a959[_0x0baf('0x4f')]==='21'){agents[_0x27a959[_0x0baf('0x4')]]['reason']='rejected';agents[_0x27a959[_0x0baf('0x4')]]['lastevent']=_0x0baf('0x50');}utils[_0x0baf('0x2')](util['format'](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);var _0x5ea0f3=unanswered['indexOf'](_0x27a959['uniqueid']);if(_0x5ea0f3>-0x1){unanswered['splice'](_0x5ea0f3,0x1);}}if(transfers[_0x27a959['uniqueid']]){transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xe')]=!![];transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils['now']();transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x29')]=utils['diffTime'](transfers[_0x27a959['uniqueid']][_0x0baf('0x33')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x2d')]);transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=_0x0baf('0x52');transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27a959[_0x0baf('0x4')],transfers[_0x27a959[_0x0baf('0x4')]]['membername'],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(transfers[_0x27a959[_0x0baf('0x4')]],!![]);}if(agents[_0x27a959['uniqueid']]&&agents[_0x27a959['uniqueid']][_0x0baf('0x2d')]){agents[_0x27a959[_0x0baf('0x4')]]['agentcomplete']=!![];agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils[_0x0baf('0x17')]();agents[_0x27a959['uniqueid']][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x27a959[_0x0baf('0x4')]]['agentcompleteAt'],agents[_0x27a959[_0x0baf('0x4')]]['agentconnectAt']);agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x39')]?_0x0baf('0x39'):'agent';agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);}}catch(_0x2c2f09){utils['error'](util['format'](_0x0baf('0x53'),_0x27a959[_0x0baf('0x4')]),_0x2c2f09);}}; \ No newline at end of file +var _0xb49a=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','reason','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agentcomplete','agent','lodash','util','./utils','format'];(function(_0x5da6be,_0x86256f){var _0x26cbcb=function(_0x18b1e4){while(--_0x18b1e4){_0x5da6be['push'](_0x5da6be['shift']());}};_0x26cbcb(++_0x86256f);}(_0xb49a,0xfb));var _0xab49=function(_0x13651c,_0x1b81c5){_0x13651c=_0x13651c-0x0;var _0xc6ea66=_0xb49a[_0x13651c];return _0xc6ea66;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var utils=require(_0xab49('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d512a,_0x8db649){utils['info'](util[_0xab49('0x3')](_0xab49('0x4'),_0x1d512a['uniqueid'],_0x1d512a['channel'],_0x1d512a[_0xab49('0x5')],_0x1d512a[_0xab49('0x6')],_0x1d512a[_0xab49('0x7')],_0x1d512a[_0xab49('0x8')],_0x1d512a[_0xab49('0x9')],_0x1d512a[_0xab49('0xa')]));if(_0x1d512a[_0xab49('0x5')]){utils['getVoiceQueueByName'](_0x1d512a[_0xab49('0x5')])[_0xab49('0xb')](function(_0xf12653){if(_0xf12653){_0x1d512a[_0xab49('0xc')]=_0xf12653[_0xab49('0xc')];_0x1d512a['agentacw']=_0x1d512a['agentcomplete']?_0xf12653[_0xab49('0xd')]:![];_0x1d512a[_0xab49('0xe')]=_0x1d512a[_0xab49('0xf')]?_0xf12653[_0xab49('0x10')]:0x0;}utils[_0xab49('0x11')]('CreateVoiceAgentReport',_0x1d512a);});}else{utils[_0xab49('0x11')](_0xab49('0x12'),_0x1d512a);}if(_0x8db649){delete transfers[_0x1d512a[_0xab49('0x13')]];}else{delete agents[_0x1d512a[_0xab49('0x14')]];}}exports[_0xab49('0x15')]=function(_0x36091a){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x17'),_0x36091a[_0xab49('0x13')]),_0x36091a);agents[_0x36091a[_0xab49('0x14')]]=_0x36091a;agents[_0x36091a['destuniqueid']][_0xab49('0x18')]=utils[_0xab49('0x19')]();agents[_0x36091a[_0xab49('0x14')]][_0xab49('0xa')]=_0xab49('0x1a');agents[_0x36091a['destuniqueid']][_0xab49('0x9')]=null;agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x1b')]=null;utils[_0xab49('0x1c')](util[_0xab49('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x36091a[_0xab49('0x13')],agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x6')],_0x36091a['destuniqueid']));}catch(_0x4c22cd){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][agentcalled]',_0x36091a[_0xab49('0x13')]),_0x4c22cd);}};exports[_0xab49('0x1e')]=function(_0x49b716){try{if(!_[_0xab49('0x1f')](agents[_0x49b716['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716['uniqueid']),_0x49b716);utils[_0xab49('0x1c')](util['format'](_0xab49('0x20'),_0x49b716['uniqueid'],agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x6')],_0x49b716[_0xab49('0x14')]));agents[_0x49b716['destuniqueid']][_0xab49('0x1e')]=!![];agents[_0x49b716['destuniqueid']][_0xab49('0x21')]=utils[_0xab49('0x19')]();agents[_0x49b716['destuniqueid']][_0xab49('0xa')]=_0xab49('0x22');agents[_0x49b716['destuniqueid']]['reason']=_0xab49('0x22');agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x23')]=_0x49b716['ringtime']?parseInt(_0x49b716[_0xab49('0x24')])/0x3e8:0x0;agents[_0x49b716[_0xab49('0x14')]]['talktime']=0x0;unanswered[_0xab49('0x25')](_0x49b716[_0xab49('0x14')]);}}catch(_0x342fdf){utils['error'](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716[_0xab49('0x13')]),_0x342fdf);}};exports['queuecallerabandon']=function(_0x19f094){try{_['forIn'](agents,function(_0x134a03,_0x24bd0f){if(_0x134a03[_0xab49('0x13')]==_0x19f094[_0xab49('0x13')]&&!_['includes'](unanswered,_0x134a03[_0xab49('0x14')])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094[_0xab49('0x13')]),_0x19f094);utils['info'](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x19f094['uniqueid'],_0x134a03['membername'],_0x134a03[_0xab49('0x14')]));_0x134a03['agentringnoanswer']=!![];_0x134a03[_0xab49('0x21')]=utils[_0xab49('0x19')]();_0x134a03[_0xab49('0xa')]='abandoned';_0x134a03[_0xab49('0x26')]=_0xab49('0x27');_0x134a03[_0xab49('0x23')]=_0x19f094[_0xab49('0x23')];_0x134a03[_0xab49('0x28')]=0x0;writeDB(_0x134a03);}});}catch(_0x56b768){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094['uniqueid']),_0x56b768);}};exports[_0xab49('0x29')]=function(_0x29c6cf){try{if(agents[_0x29c6cf[_0xab49('0x14')]]){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x29c6cf);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x2b'),_0x29c6cf[_0xab49('0x13')],agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x6')],_0x29c6cf['destuniqueid']));agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x9')]=_0x29c6cf['connectedlinenum'];agents[_0x29c6cf[_0xab49('0x14')]]['connectedlinename']=_0x29c6cf['connectedlinename'];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0xa')]='connect';_[_0xab49('0x2d')](agents,function(_0x2cdcbf,_0x2016a9){if(_0x2cdcbf[_0xab49('0x14')]!=_0x29c6cf[_0xab49('0x14')]&&_0x2cdcbf['uniqueid']==_0x29c6cf['uniqueid']){_0x2cdcbf[_0xab49('0x28')]=0x0;_0x2cdcbf[_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];_0x2cdcbf['agentringnoanswer']=!![];_0x2cdcbf[_0xab49('0x21')]=utils['now']();_0x2cdcbf['lastevent']='answered_elsewhere';_0x2cdcbf['reason']=_0xab49('0x2e');_0x2cdcbf[_0xab49('0x2f')]=_0x29c6cf[_0xab49('0x14')];_0x2cdcbf[_0xab49('0x30')]=_0x29c6cf[_0xab49('0x6')];writeDB(_0x2cdcbf);}});}}catch(_0x3f3776){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x3f3776);}};exports['agentcomplete']=function(_0x158042){try{if(!_[_0xab49('0x1f')](agents[_0x158042['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0x158042);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x32'),_0x158042[_0xab49('0x13')],agents[_0x158042['destuniqueid']][_0xab49('0x6')],_0x158042[_0xab49('0x14')]));agents[_0x158042[_0xab49('0x14')]]['agentcomplete']=!![];agents[_0x158042[_0xab49('0x14')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x158042[_0xab49('0x14')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x158042['destuniqueid']][_0xab49('0x33')],agents[_0x158042[_0xab49('0x14')]][_0xab49('0x2c')]);agents[_0x158042[_0xab49('0x14')]][_0xab49('0x26')]=_0x158042[_0xab49('0x26')];agents[_0x158042['destuniqueid']][_0xab49('0xa')]=_0xab49('0x35');writeDB(agents[_0x158042[_0xab49('0x14')]]);}}catch(_0xca56ce){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0xca56ce);}};exports[_0xab49('0x36')]=function(_0xfb7d69){try{if(!_[_0xab49('0x1f')](agents[_0xfb7d69[_0xab49('0x37')]])){utils['debug'](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0xfb7d69);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x39'),_0xfb7d69[_0xab49('0x13')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x6')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x13')]));agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x3a')]=!![];agents[_0xfb7d69[_0xab49('0x37')]]['transfertype']=_0xab49('0x3b');agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3c')]=_0xfb7d69[_0xab49('0x3d')];agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3e')]=agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x13')];}}catch(_0x37cf42){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0x37cf42);}};exports[_0xab49('0x3f')]=function(_0x235ba8){try{utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][attendedtransfer]',_0x235ba8[_0xab49('0x40')]),_0x235ba8);if(_0x235ba8[_0xab49('0x40')]==_0x235ba8[_0xab49('0x41')]){if(!_[_0xab49('0x1f')](agents[_0x235ba8[_0xab49('0x42')]])){utils['info'](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x42')]]['transfer']=!![];agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x44')]=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x42')]]['transferexten']=_0x235ba8['origtransfererexten'];agents[_0x235ba8[_0xab49('0x42')]]['transferuniqueid']=_0x235ba8[_0xab49('0x40')];}if(_0x235ba8[_0xab49('0x46')]&&agents[_0x235ba8[_0xab49('0x46')]]){agents[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x1;transfers[_0x235ba8[_0xab49('0x46')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x46')]]);transfers[_0x235ba8['transfereeuniqueid']][_0xab49('0x8')]=agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x49')]=agents[_0x235ba8['secondtransfereruniqueid']][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x18')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x2;}}else if(_0x235ba8[_0xab49('0x42')]==_0x235ba8[_0xab49('0x4a')]){if(!_['isNil'](agents[_0x235ba8[_0xab49('0x40')]])){utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3a')]=!![];agents[_0x235ba8[_0xab49('0x40')]]['transfertype']=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x40')]]['transferexten']=_0x235ba8[_0xab49('0x4b')];agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3e')]=_0x235ba8['secondtransfereruniqueid'];}if(_0x235ba8[_0xab49('0x4c')]&&agents[_0x235ba8[_0xab49('0x4c')]]){agents[_0x235ba8['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x235ba8[_0xab49('0x4c')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x4c')]]);transfers[_0x235ba8['transfertargetuniqueid']]['calleridnum']=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x49')]=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x18')]=utils['now']();transfers[_0x235ba8['transfertargetuniqueid']][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x47')]=0x2;}}}catch(_0x108755){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x4d'),_0x235ba8['origtransfereruniqueid']),_0x108755);}};exports[_0xab49('0x4e')]=function(_0x24fb84){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x4f'),_0x24fb84[_0xab49('0x13')]),_0x24fb84);if(agents[_0x24fb84[_0xab49('0x13')]]&&agents[_0x24fb84[_0xab49('0x13')]]['reason']===_0xab49('0x22')){if(_0x24fb84['cause']==='21'){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x50');agents[_0x24fb84['uniqueid']][_0xab49('0xa')]=_0xab49('0x50');}utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);var _0x366a3c=unanswered[_0xab49('0x52')](_0x24fb84[_0xab49('0x13')]);if(_0x366a3c>-0x1){unanswered['splice'](_0x366a3c,0x1);}}if(transfers[_0x24fb84[_0xab49('0x13')]]){transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];transfers[_0x24fb84['uniqueid']][_0xab49('0x33')]=utils[_0xab49('0x19')]();transfers[_0x24fb84['uniqueid']][_0xab49('0x28')]=utils[_0xab49('0x34')](transfers[_0x24fb84['uniqueid']][_0xab49('0x33')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x54');transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]='complete';utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],transfers[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(transfers[_0x24fb84[_0xab49('0x13')]],!![]);}if(agents[_0x24fb84['uniqueid']]&&agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=agents[_0x24fb84['uniqueid']]['transfer']?_0xab49('0x3a'):_0xab49('0x54');agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]=_0xab49('0x35');utils[_0xab49('0x1c')](util['format'](_0xab49('0x51'),_0x24fb84['uniqueid'],agents[_0x24fb84['uniqueid']][_0xab49('0x6')],agents[_0x24fb84['uniqueid']][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);}}catch(_0x271ee4){utils[_0xab49('0x1d')](util['format']('[%s][agents][hangup]',_0x24fb84[_0xab49('0x13')]),_0x271ee4);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d25ff54..fcba5ab 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf32f=['getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','appdata','substring','lastIndexOf','includes','noop','execif','set','gotoif','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xf32f,0x140));var _0xff32=function(_0x2efa0b,_0x56ab71){_0x2efa0b=_0x2efa0b-0x0;var _0x36de01=_0xf32f[_0x2efa0b];return _0x36de01;};'use strict';var _=require('lodash');var util=require(_0xff32('0x0'));var utils=require(_0xff32('0x1'));var transfers=require(_0xff32('0x2'));var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0xff32('0x3'),_0xff32('0x3'),_0xff32('0x3'),_0xff32('0x4'),_0xff32('0x5'),'FAILED',_0xff32('0x6'),_0xff32('0x6')];var channels={};function writeDB(_0x4868bb){var _0x5eb228;if(transfers[_0xff32('0x7')][_0x4868bb[_0xff32('0x8')]]){_0x5eb228=_0x4868bb[_0xff32('0x8')];_0x4868bb['uniqueid']=transfers[_0xff32('0x7')][_0x4868bb[_0xff32('0x8')]][_0xff32('0x9')];}utils[_0xff32('0xa')](util[_0xff32('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4868bb[_0xff32('0x8')],_0x4868bb[_0xff32('0xc')],_0x4868bb['queue'],_0x4868bb[_0xff32('0xd')],_0x4868bb[_0xff32('0xe')],_0x4868bb[_0xff32('0xf')],_0x4868bb[_0xff32('0x10')],_0x4868bb[_0xff32('0x11')]));if(_0x4868bb[_0xff32('0x12')]){utils[_0xff32('0x13')](_0x4868bb['accountcode'])[_0xff32('0x14')](function(_0x43f998){if(_0x43f998){_0x4868bb[_0xff32('0x15')]=_0x43f998['id'];}utils[_0xff32('0x16')](_0xff32('0x17'),_0x4868bb);});}else{utils[_0xff32('0x16')](_0xff32('0x17'),_0x4868bb);}if(channels[_0x4868bb['uniqueid']]){delete channels[_0x4868bb[_0xff32('0x8')]];}else if(_0x5eb228&&channels[_0x5eb228]){if(!transfers[_0xff32('0x7')][_0x5eb228][_0xff32('0x18')])delete transfers[_0xff32('0x7')][_0x5eb228];delete channels[_0x5eb228];}}exports[_0xff32('0x19')]=function(_0x3c7735){try{utils[_0xff32('0x1a')](util[_0xff32('0xb')](_0xff32('0x1b'),_0x3c7735['uniqueid']),_0x3c7735);if(_0x3c7735[_0xff32('0x8')]==_0x3c7735['linkedid']&&_0x3c7735['channel']!='OutgoingSpoolFailed'){utils['info'](util[_0xff32('0xb')](_0xff32('0x1c'),_0x3c7735[_0xff32('0x8')],_0x3c7735[_0xff32('0x1d')],_0x3c7735['exten']));channels[_0x3c7735[_0xff32('0x8')]]={'uniqueid':_0x3c7735['uniqueid'],'accountcode':_0x3c7735[_0xff32('0x12')],'source':_0x3c7735[_0xff32('0xf')],'destination':_0x3c7735[_0xff32('0x1e')],'destinationcontext':_0x3c7735[_0xff32('0x1d')],'channel':_0x3c7735[_0xff32('0xc')],'starttime':utils[_0xff32('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xff32('0x3'),'amaflags':_0xff32('0x20')};}}catch(_0x382718){utils['error'](util[_0xff32('0xb')](_0xff32('0x1b'),_0x3c7735['uniqueid']),_0x382718);}};exports[_0xff32('0x21')]=function(_0x2898ef){try{utils['debug'](util[_0xff32('0xb')](_0xff32('0x22'),_0x2898ef['uniqueid']),_0x2898ef);if(!_['isNil'](channels[_0x2898ef['uniqueid']])&&_0x2898ef[_0xff32('0x23')]==0x6){utils[_0xff32('0xa')](util[_0xff32('0xb')](_0xff32('0x24'),_0x2898ef[_0xff32('0x8')],_0x2898ef['context'],_0x2898ef['channel']));if(_['isNil'](channels[_0x2898ef[_0xff32('0x8')]][_0xff32('0x25')])){channels[_0x2898ef[_0xff32('0x8')]]['systemanswertime']=utils[_0xff32('0x1f')]();}}else if(!_[_0xff32('0x26')](channels[_0x2898ef[_0xff32('0x27')]])&&_0x2898ef[_0xff32('0x23')]==0x6&&_0x2898ef[_0xff32('0x1d')]!=_0xff32('0x28')){utils[_0xff32('0xa')](util[_0xff32('0xb')](_0xff32('0x29'),_0x2898ef['uniqueid'],_0x2898ef[_0xff32('0x27')],_0x2898ef['context'],_0x2898ef[_0xff32('0xc')]));channels[_0x2898ef[_0xff32('0x27')]][_0xff32('0x12')]=_0x2898ef[_0xff32('0x12')];channels[_0x2898ef[_0xff32('0x27')]][_0xff32('0x2a')]=_0x2898ef[_0xff32('0xc')];if(_[_0xff32('0x26')](channels[_0x2898ef[_0xff32('0x27')]][_0xff32('0x2b')])){channels[_0x2898ef[_0xff32('0x27')]]['answertime']=utils[_0xff32('0x1f')]();}channels[_0x2898ef[_0xff32('0x27')]][_0xff32('0x2c')]=dispositions[_[_0xff32('0x2d')](_0x2898ef[_0xff32('0x23')])]||_0xff32('0x4');}}catch(_0x360ce9){utils[_0xff32('0x2e')](util[_0xff32('0xb')](_0xff32('0x22'),_0x2898ef['uniqueid']),_0x360ce9);}};exports[_0xff32('0x2f')]=function(_0x411f89){try{if(!_['isNil'](channels[_0x411f89[_0xff32('0x8')]])){utils[_0xff32('0x1a')](util[_0xff32('0xb')](_0xff32('0x30'),_0x411f89[_0xff32('0x8')]),_0x411f89);if(_[_0xff32('0x26')](channels[_0x411f89['uniqueid']][_0xff32('0x31')])){channels[_0x411f89[_0xff32('0x8')]][_0xff32('0x31')]=_0x411f89[_0xff32('0x32')]+'\x20<'+_0x411f89[_0xff32('0xf')]+'>';}utils['info'](util[_0xff32('0xb')](_0xff32('0x33'),_0x411f89[_0xff32('0x8')],channels[_0x411f89[_0xff32('0x8')]][_0xff32('0x31')],_0x411f89[_0xff32('0x34')]));channels[_0x411f89[_0xff32('0x8')]][_0xff32('0x35')]=utils['now']();channels[_0x411f89[_0xff32('0x8')]][_0xff32('0x36')]=utils[_0xff32('0x37')](channels[_0x411f89[_0xff32('0x8')]]['endtime'],channels[_0x411f89[_0xff32('0x8')]][_0xff32('0x38')]);channels[_0x411f89['uniqueid']][_0xff32('0x39')]=channels[_0x411f89['uniqueid']]['answertime']?utils[_0xff32('0x37')](channels[_0x411f89[_0xff32('0x8')]]['endtime'],channels[_0x411f89['uniqueid']][_0xff32('0x2b')]):0x0;writeDB(channels[_0x411f89['uniqueid']]);}}catch(_0x28a1c8){utils[_0xff32('0x2e')](util[_0xff32('0xb')]('[%s][calls][hangup]',_0x411f89[_0xff32('0x8')]),_0x28a1c8);}};exports[_0xff32('0x3a')]=function(_0x219741){try{if(!_['isNil'](channels[_0x219741[_0xff32('0x3b')]])){utils[_0xff32('0x1a')](util[_0xff32('0xb')](_0xff32('0x3c'),_0x219741['origtransfereruniqueid']),_0x219741);if(channels[_0x219741[_0xff32('0x3b')]][_0xff32('0xc')]==_0x219741[_0xff32('0x3d')]){utils[_0xff32('0xa')](util[_0xff32('0xb')](_0xff32('0x3e'),_0x219741[_0xff32('0x3f')],_0x219741[_0xff32('0x3b')],_0x219741[_0xff32('0x40')]));channels[_0x219741['localtwolinkedid']][_0xff32('0x2a')]=_0x219741['secondtransfererchannel'];channels[_0x219741['localtwolinkedid']][_0xff32('0x41')]='_attended';}else if(channels[_0x219741['localtwolinkedid']][_0xff32('0xc')]=_0x219741[_0xff32('0x42')]){utils[_0xff32('0xa')](util[_0xff32('0xb')](_0xff32('0x3e'),_0x219741['origtransfereruniqueid'],_0x219741[_0xff32('0x3b')],_0x219741[_0xff32('0x43')]));channels[_0x219741[_0xff32('0x3b')]][_0xff32('0x2a')]=_0x219741[_0xff32('0x43')];channels[_0x219741[_0xff32('0x3b')]]['userfield']='_attended';}}}catch(_0x2b8abe){utils[_0xff32('0x2e')](util['format']('[%s][calls][attendedtransfer]',_0x219741[_0xff32('0x3f')]),_0x2b8abe);}};exports[_0xff32('0x44')]=function(_0x5a4337){try{if(!_[_0xff32('0x26')](channels[_0x5a4337[_0xff32('0x8')]])){utils[_0xff32('0x1a')](util['format'](_0xff32('0x45'),_0x5a4337['uniqueid']),_0x5a4337);channels[_0x5a4337[_0xff32('0x8')]][_0xff32('0x46')]=utils[_0xff32('0x1f')]();utils[_0xff32('0xa')](util[_0xff32('0xb')](_0xff32('0x47'),_0x5a4337[_0xff32('0x8')],channels[_0x5a4337['uniqueid']][_0xff32('0x46')]));}}catch(_0x15d433){utils['error'](util[_0xff32('0xb')]('[%s][calls][musiconholdstart]',_0x5a4337['uniqueid']),_0x15d433);}};exports[_0xff32('0x48')]=function(_0xecf4eb){try{if(!_[_0xff32('0x26')](channels[_0xecf4eb[_0xff32('0x8')]])){utils[_0xff32('0x1a')](util[_0xff32('0xb')](_0xff32('0x49'),_0xecf4eb[_0xff32('0x8')]),_0xecf4eb);if(!_[_0xff32('0x26')](channels[_0xecf4eb['uniqueid']]['musiconholdstartAt'])){channels[_0xecf4eb['uniqueid']][_0xff32('0x4a')]+=utils[_0xff32('0x37')](utils[_0xff32('0x1f')](),channels[_0xecf4eb['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xff32('0xb')](_0xff32('0x4b'),_0xecf4eb[_0xff32('0x8')],channels[_0xecf4eb[_0xff32('0x8')]]['mohtime']));delete channels[_0xecf4eb[_0xff32('0x8')]][_0xff32('0x46')];}}}catch(_0x15a977){utils['error'](util[_0xff32('0xb')](_0xff32('0x49'),_0xecf4eb['uniqueid']),_0x15a977);}};exports[_0xff32('0x4c')]=function(_0x1a1145){try{if(!_[_0xff32('0x26')](channels[_0x1a1145[_0xff32('0x8')]])){utils['debug'](util['format'](_0xff32('0x4d'),_0x1a1145[_0xff32('0x8')]),_0x1a1145);if(!_[_0xff32('0x26')](_0x1a1145['variable']['xmd-originatecalleridnum'])){utils[_0xff32('0xa')](util[_0xff32('0xb')](_0xff32('0x4e'),_0x1a1145[_0xff32('0x8')],_0x1a1145[_0xff32('0x4f')]));channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x50')]=_0x1a1145[_0xff32('0x4f')];}if(!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')][_0xff32('0x52')])){utils['info'](util[_0xff32('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1a1145['uniqueid'],_0x1a1145[_0xff32('0x4f')]));channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x53')]=_0x1a1145[_0xff32('0x4f')];channels[_0x1a1145['uniqueid']][_0xff32('0x31')]='\x22'+_0x1a1145[_0xff32('0x4f')]+_0xff32('0x54')+_0x1a1145['value']+'>';}if(!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')][_0xff32('0x55')])||!_['isNil'](_0x1a1145[_0xff32('0x51')][_0xff32('0x56')])){utils[_0xff32('0xa')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1a1145[_0xff32('0x8')],!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')][_0xff32('0x55')])?_0xff32('0x55'):'xmd-callerid',_0x1a1145[_0xff32('0x4f')]));channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x31')]=_0x1a1145[_0xff32('0x4f')];}if(!_['isNil'](_0x1a1145['variable']['xmd-queue'])||!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')][_0xff32('0x57')])){utils['info'](util[_0xff32('0xb')](_0xff32('0x58'),_0x1a1145['uniqueid'],!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')]['xmd-queue'])?_0xff32('0x59'):'xmcs-queue',_0x1a1145['value']));channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x5a')]=_0xff32('0x5b');channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x5c')]=_0x1a1145[_0xff32('0x4f')];channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x5d')]=!![];}if(!_['isNil'](_0x1a1145[_0xff32('0x51')][_0xff32('0x5e')])){utils['info'](util[_0xff32('0xb')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1a1145['uniqueid'],_0x1a1145[_0xff32('0x4f')]));channels[_0x1a1145['uniqueid']]['ContactId']=_0x1a1145['value'];}if(!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')]['xmd-cdrtype'])){utils[_0xff32('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1a1145[_0xff32('0x8')],_0x1a1145[_0xff32('0x4f')]));channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x5f')]=_0x1a1145[_0xff32('0x4f')];}if(!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')][_0xff32('0x60')])){utils[_0xff32('0xa')](util[_0xff32('0xb')](_0xff32('0x61'),_0x1a1145[_0xff32('0x8')],_0x1a1145[_0xff32('0x4f')]));channels[_0x1a1145[_0xff32('0x8')]][_0xff32('0x62')]=_0x1a1145['value'];}if(!_[_0xff32('0x26')](_0x1a1145[_0xff32('0x51')]['sipcallid'])){utils['info'](util['format'](_0xff32('0x63'),_0x1a1145[_0xff32('0x8')],_0x1a1145[_0xff32('0x4f')]));channels[_0x1a1145['uniqueid']][_0xff32('0x64')]=_0x1a1145[_0xff32('0x4f')];}}}catch(_0x390d2c){utils[_0xff32('0x2e')](util[_0xff32('0xb')]('[%s][calls][varset]',_0x1a1145['uniqueid']),_0x390d2c);}};exports['newexten']=function(_0x2d5fff){try{if(!_[_0xff32('0x26')](channels[_0x2d5fff[_0xff32('0x8')]])){utils[_0xff32('0x1a')](util[_0xff32('0xb')](_0xff32('0x65'),_0x2d5fff[_0xff32('0x8')]),_0x2d5fff);utils[_0xff32('0xa')](util['format'](_0xff32('0x66'),_0x2d5fff[_0xff32('0x8')],_0x2d5fff[_0xff32('0x67')],_0x2d5fff['appdata']));if(_0x2d5fff['application'][_0xff32('0x68')]()=='set'&&_['startsWith'](_0x2d5fff['appdata']['toLowerCase'](),'cdr')){var _0x2b0ea7=_0x2d5fff[_0xff32('0x69')]['split']('=');var _0x4f5c3d=_0x2b0ea7[0x0][_0xff32('0x6a')](_0x2b0ea7[0x0][_0xff32('0x6b')]('(')+0x1,_0x2b0ea7[0x0]['lastIndexOf'](')'));var _0x2a6fa7=_0x2b0ea7[0x1];channels[_0x2d5fff[_0xff32('0x8')]][_0x4f5c3d]=_0x2a6fa7;}if(!_[_0xff32('0x6c')](['hangup',_0xff32('0x6d'),_0xff32('0x6e'),_0xff32('0x6f'),_0xff32('0x70')],_0x2d5fff['application'][_0xff32('0x68')]())){channels[_0x2d5fff['uniqueid']][_0xff32('0x5a')]=_0x2d5fff[_0xff32('0x67')];channels[_0x2d5fff['uniqueid']][_0xff32('0x5c')]=_0x2d5fff[_0xff32('0x69')];}}}catch(_0x15b748){utils['error'](util[_0xff32('0xb')](_0xff32('0x65'),_0x2d5fff[_0xff32('0x8')]),_0x15b748);}}; \ No newline at end of file +var _0x1419=['CreateVoiceCallReport','recording','debug','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','context','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','toNumber','ANSWERED','hangup','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','substring','lastIndexOf','includes','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request'];(function(_0x3ab7fd,_0x1754b4){var _0x517232=function(_0x5ba385){while(--_0x5ba385){_0x3ab7fd['push'](_0x3ab7fd['shift']());}};_0x517232(++_0x1754b4);}(_0x1419,0x127));var _0x9141=function(_0x2806e8,_0x1e157d){_0x2806e8=_0x2806e8-0x0;var _0x50a829=_0x1419[_0x2806e8];return _0x50a829;};'use strict';var _=require(_0x9141('0x0'));var util=require(_0x9141('0x1'));var utils=require(_0x9141('0x2'));var transfers=require(_0x9141('0x3'));var dispositions=[_0x9141('0x4'),'FAILED','FAILED',_0x9141('0x4'),_0x9141('0x4'),'NO\x20ANSWER','ANSWERED',_0x9141('0x5'),_0x9141('0x6'),_0x9141('0x6'),_0x9141('0x6')];var channels={};function writeDB(_0x47322a){var _0x421631;if(transfers[_0x9141('0x7')][_0x47322a[_0x9141('0x8')]]){_0x421631=_0x47322a[_0x9141('0x8')];_0x47322a[_0x9141('0x8')]=transfers['blinds'][_0x47322a[_0x9141('0x8')]][_0x9141('0x9')];}utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0xc'),_0x47322a[_0x9141('0x8')],_0x47322a[_0x9141('0xd')],_0x47322a[_0x9141('0xe')],_0x47322a[_0x9141('0xf')],_0x47322a[_0x9141('0x10')],_0x47322a['calleridnum'],_0x47322a[_0x9141('0x11')],_0x47322a[_0x9141('0x12')]));if(_0x47322a[_0x9141('0x13')]){utils[_0x9141('0x14')](_0x47322a[_0x9141('0x13')])[_0x9141('0x15')](function(_0x5c86f0){if(_0x5c86f0){_0x47322a['UserId']=_0x5c86f0['id'];}utils[_0x9141('0x16')](_0x9141('0x17'),_0x47322a);});}else{utils[_0x9141('0x16')](_0x9141('0x17'),_0x47322a);}if(channels[_0x47322a[_0x9141('0x8')]]){delete channels[_0x47322a[_0x9141('0x8')]];}else if(_0x421631&&channels[_0x421631]){if(!transfers[_0x9141('0x7')][_0x421631][_0x9141('0x18')])delete transfers[_0x9141('0x7')][_0x421631];delete channels[_0x421631];}}exports['newchannel']=function(_0x1cff83){try{utils[_0x9141('0x19')](util['format']('[%s][calls][newchannel]',_0x1cff83[_0x9141('0x8')]),_0x1cff83);if(_0x1cff83['uniqueid']==_0x1cff83['linkedid']&&_0x1cff83['channel']!='OutgoingSpoolFailed'){utils[_0x9141('0xa')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x1cff83[_0x9141('0x8')],_0x1cff83['context'],_0x1cff83[_0x9141('0x1a')]));channels[_0x1cff83[_0x9141('0x8')]]={'uniqueid':_0x1cff83[_0x9141('0x8')],'accountcode':_0x1cff83['accountcode'],'source':_0x1cff83[_0x9141('0x1b')],'destination':_0x1cff83['exten'],'destinationcontext':_0x1cff83['context'],'channel':_0x1cff83[_0x9141('0xd')],'starttime':utils[_0x9141('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9141('0x4'),'amaflags':_0x9141('0x1d')};}}catch(_0x30c1b5){utils[_0x9141('0x1e')](util[_0x9141('0xb')](_0x9141('0x1f'),_0x1cff83[_0x9141('0x8')]),_0x30c1b5);}};exports[_0x9141('0x20')]=function(_0x21d788){try{utils[_0x9141('0x19')](util[_0x9141('0xb')](_0x9141('0x21'),_0x21d788['uniqueid']),_0x21d788);if(!_[_0x9141('0x22')](channels[_0x21d788[_0x9141('0x8')]])&&_0x21d788[_0x9141('0x23')]==0x6){utils[_0x9141('0xa')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x21d788[_0x9141('0x8')],_0x21d788[_0x9141('0x24')],_0x21d788[_0x9141('0xd')]));if(_[_0x9141('0x22')](channels[_0x21d788[_0x9141('0x8')]][_0x9141('0x25')])){channels[_0x21d788['uniqueid']][_0x9141('0x25')]=utils[_0x9141('0x1c')]();}}else if(!_['isNil'](channels[_0x21d788['linkedid']])&&_0x21d788[_0x9141('0x23')]==0x6&&_0x21d788[_0x9141('0x24')]!=_0x9141('0x26')){utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x27'),_0x21d788['uniqueid'],_0x21d788[_0x9141('0x28')],_0x21d788[_0x9141('0x24')],_0x21d788[_0x9141('0xd')]));channels[_0x21d788[_0x9141('0x28')]][_0x9141('0x13')]=_0x21d788['accountcode'];channels[_0x21d788['linkedid']][_0x9141('0x29')]=_0x21d788['channel'];if(_[_0x9141('0x22')](channels[_0x21d788[_0x9141('0x28')]][_0x9141('0x2a')])){channels[_0x21d788['linkedid']]['answertime']=utils[_0x9141('0x1c')]();}channels[_0x21d788[_0x9141('0x28')]]['disposition']=dispositions[_[_0x9141('0x2b')](_0x21d788[_0x9141('0x23')])]||_0x9141('0x2c');}}catch(_0x40755d){utils[_0x9141('0x1e')](util[_0x9141('0xb')](_0x9141('0x21'),_0x21d788[_0x9141('0x8')]),_0x40755d);}};exports[_0x9141('0x2d')]=function(_0xabd203){try{if(!_[_0x9141('0x22')](channels[_0xabd203[_0x9141('0x8')]])){utils[_0x9141('0x19')](util[_0x9141('0xb')]('[%s][calls][hangup]',_0xabd203[_0x9141('0x8')]),_0xabd203);if(_[_0x9141('0x22')](channels[_0xabd203['uniqueid']][_0x9141('0x2e')])){channels[_0xabd203[_0x9141('0x8')]][_0x9141('0x2e')]=_0xabd203['calleridname']+'\x20<'+_0xabd203[_0x9141('0x1b')]+'>';}utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x2f'),_0xabd203[_0x9141('0x8')],channels[_0xabd203[_0x9141('0x8')]][_0x9141('0x2e')],_0xabd203['cause-txt']));channels[_0xabd203[_0x9141('0x8')]][_0x9141('0x30')]=utils['now']();channels[_0xabd203['uniqueid']][_0x9141('0x31')]=utils[_0x9141('0x32')](channels[_0xabd203[_0x9141('0x8')]]['endtime'],channels[_0xabd203[_0x9141('0x8')]][_0x9141('0x33')]);channels[_0xabd203[_0x9141('0x8')]][_0x9141('0x34')]=channels[_0xabd203[_0x9141('0x8')]][_0x9141('0x2a')]?utils[_0x9141('0x32')](channels[_0xabd203[_0x9141('0x8')]][_0x9141('0x30')],channels[_0xabd203[_0x9141('0x8')]]['answertime']):0x0;writeDB(channels[_0xabd203[_0x9141('0x8')]]);}}catch(_0x215120){utils[_0x9141('0x1e')](util[_0x9141('0xb')](_0x9141('0x35'),_0xabd203[_0x9141('0x8')]),_0x215120);}};exports[_0x9141('0x36')]=function(_0x2ba281){try{if(!_[_0x9141('0x22')](channels[_0x2ba281[_0x9141('0x37')]])){utils[_0x9141('0x19')](util['format'](_0x9141('0x38'),_0x2ba281[_0x9141('0x39')]),_0x2ba281);if(channels[_0x2ba281[_0x9141('0x37')]][_0x9141('0xd')]==_0x2ba281['transfereechannel']){utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x3a'),_0x2ba281[_0x9141('0x39')],_0x2ba281['localtwolinkedid'],_0x2ba281[_0x9141('0x3b')]));channels[_0x2ba281[_0x9141('0x37')]][_0x9141('0x29')]=_0x2ba281['secondtransfererchannel'];channels[_0x2ba281[_0x9141('0x37')]][_0x9141('0x3c')]='_attended';}else if(channels[_0x2ba281['localtwolinkedid']][_0x9141('0xd')]=_0x2ba281['transfertargetchannel']){utils[_0x9141('0xa')](util['format'](_0x9141('0x3a'),_0x2ba281['origtransfereruniqueid'],_0x2ba281['localtwolinkedid'],_0x2ba281[_0x9141('0x3d')]));channels[_0x2ba281[_0x9141('0x37')]][_0x9141('0x29')]=_0x2ba281[_0x9141('0x3d')];channels[_0x2ba281[_0x9141('0x37')]][_0x9141('0x3c')]=_0x9141('0x3e');}}}catch(_0x67aa4e){utils[_0x9141('0x1e')](util[_0x9141('0xb')]('[%s][calls][attendedtransfer]',_0x2ba281[_0x9141('0x39')]),_0x67aa4e);}};exports[_0x9141('0x3f')]=function(_0x5929dd){try{if(!_['isNil'](channels[_0x5929dd[_0x9141('0x8')]])){utils[_0x9141('0x19')](util[_0x9141('0xb')](_0x9141('0x40'),_0x5929dd['uniqueid']),_0x5929dd);channels[_0x5929dd[_0x9141('0x8')]]['musiconholdstartAt']=utils[_0x9141('0x1c')]();utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x41'),_0x5929dd[_0x9141('0x8')],channels[_0x5929dd['uniqueid']][_0x9141('0x42')]));}}catch(_0x2f7606){utils[_0x9141('0x1e')](util[_0x9141('0xb')](_0x9141('0x40'),_0x5929dd['uniqueid']),_0x2f7606);}};exports[_0x9141('0x43')]=function(_0x4db5c1){try{if(!_['isNil'](channels[_0x4db5c1['uniqueid']])){utils[_0x9141('0x19')](util['format'](_0x9141('0x44'),_0x4db5c1[_0x9141('0x8')]),_0x4db5c1);if(!_['isNil'](channels[_0x4db5c1['uniqueid']][_0x9141('0x42')])){channels[_0x4db5c1['uniqueid']][_0x9141('0x45')]+=utils[_0x9141('0x32')](utils[_0x9141('0x1c')](),channels[_0x4db5c1[_0x9141('0x8')]][_0x9141('0x42')]);utils[_0x9141('0xa')](util['format'](_0x9141('0x46'),_0x4db5c1[_0x9141('0x8')],channels[_0x4db5c1['uniqueid']][_0x9141('0x45')]));delete channels[_0x4db5c1[_0x9141('0x8')]]['musiconholdstartAt'];}}}catch(_0xd873ce){utils[_0x9141('0x1e')](util[_0x9141('0xb')](_0x9141('0x44'),_0x4db5c1[_0x9141('0x8')]),_0xd873ce);}};exports['varset']=function(_0x2e04df){try{if(!_[_0x9141('0x22')](channels[_0x2e04df[_0x9141('0x8')]])){utils[_0x9141('0x19')](util['format'](_0x9141('0x47'),_0x2e04df[_0x9141('0x8')]),_0x2e04df);if(!_[_0x9141('0x22')](_0x2e04df['variable']['xmd-originatecalleridnum'])){utils[_0x9141('0xa')](util['format'](_0x9141('0x48'),_0x2e04df[_0x9141('0x8')],_0x2e04df[_0x9141('0x49')]));channels[_0x2e04df[_0x9141('0x8')]]['source']=_0x2e04df['value'];}if(!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')][_0x9141('0x4b')])){utils[_0x9141('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2e04df[_0x9141('0x8')],_0x2e04df[_0x9141('0x49')]));channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0x4c')]=_0x2e04df['value'];channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0x2e')]='\x22'+_0x2e04df[_0x9141('0x49')]+_0x9141('0x4d')+_0x2e04df['value']+'>';}if(!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')][_0x9141('0x4e')])||!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')]['xmd-callerid'])){utils[_0x9141('0xa')](util[_0x9141('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2e04df['uniqueid'],!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')][_0x9141('0x4e')])?_0x9141('0x4e'):_0x9141('0x4f'),_0x2e04df[_0x9141('0x49')]));channels[_0x2e04df['uniqueid']][_0x9141('0x2e')]=_0x2e04df[_0x9141('0x49')];}if(!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')]['xmd-queue'])||!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')][_0x9141('0x50')])){utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x51'),_0x2e04df[_0x9141('0x8')],!_['isNil'](_0x2e04df[_0x9141('0x4a')]['xmd-queue'])?_0x9141('0x52'):_0x9141('0x50'),_0x2e04df[_0x9141('0x49')]));channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0x53')]=_0x9141('0x54');channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0x55')]=_0x2e04df['value'];channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0xe')]=!![];}if(!_[_0x9141('0x22')](_0x2e04df['variable'][_0x9141('0x56')])){utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x57'),_0x2e04df[_0x9141('0x8')],_0x2e04df['value']));channels[_0x2e04df['uniqueid']]['ContactId']=_0x2e04df[_0x9141('0x49')];}if(!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')][_0x9141('0x58')])){utils['info'](util[_0x9141('0xb')](_0x9141('0x59'),_0x2e04df['uniqueid'],_0x2e04df[_0x9141('0x49')]));channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0x5a')]=_0x2e04df[_0x9141('0x49')];}if(!_[_0x9141('0x22')](_0x2e04df[_0x9141('0x4a')][_0x9141('0x5b')])){utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x5c'),_0x2e04df[_0x9141('0x8')],_0x2e04df[_0x9141('0x49')]));channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0x5d')]=_0x2e04df[_0x9141('0x49')];}if(!_['isNil'](_0x2e04df[_0x9141('0x4a')][_0x9141('0x5e')])){utils[_0x9141('0xa')](util[_0x9141('0xb')](_0x9141('0x5f'),_0x2e04df['uniqueid'],_0x2e04df[_0x9141('0x49')]));channels[_0x2e04df[_0x9141('0x8')]][_0x9141('0x5e')]=_0x2e04df[_0x9141('0x49')];}}}catch(_0x45e3d7){utils[_0x9141('0x1e')](util[_0x9141('0xb')](_0x9141('0x47'),_0x2e04df['uniqueid']),_0x45e3d7);}};exports['newexten']=function(_0x297456){try{if(!_[_0x9141('0x22')](channels[_0x297456[_0x9141('0x8')]])){utils[_0x9141('0x19')](util[_0x9141('0xb')](_0x9141('0x60'),_0x297456['uniqueid']),_0x297456);utils['info'](util['format'](_0x9141('0x61'),_0x297456[_0x9141('0x8')],_0x297456[_0x9141('0x62')],_0x297456[_0x9141('0x63')]));if(_0x297456[_0x9141('0x62')][_0x9141('0x64')]()==_0x9141('0x65')&&_[_0x9141('0x66')](_0x297456[_0x9141('0x63')][_0x9141('0x64')](),'cdr')){var _0x50f15b=_0x297456[_0x9141('0x63')]['split']('=');var _0x2b064d=_0x50f15b[0x0][_0x9141('0x67')](_0x50f15b[0x0][_0x9141('0x68')]('(')+0x1,_0x50f15b[0x0][_0x9141('0x68')](')'));var _0x513853=_0x50f15b[0x1];channels[_0x297456[_0x9141('0x8')]][_0x2b064d]=_0x513853;}if(!_[_0x9141('0x69')]([_0x9141('0x2d'),'noop','execif',_0x9141('0x65'),'gotoif'],_0x297456['application']['toLowerCase']())){channels[_0x297456[_0x9141('0x8')]][_0x9141('0x53')]=_0x297456[_0x9141('0x62')];channels[_0x297456[_0x9141('0x8')]][_0x9141('0x55')]=_0x297456[_0x9141('0x63')];}}}catch(_0x1c8c44){utils['error'](util[_0x9141('0xb')](_0x9141('0x60'),_0x297456['uniqueid']),_0x1c8c44);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8aab1c7..70cc11f 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x726c=['[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x5f584a,_0x47f064){var _0x3788d9=function(_0x29c10b){while(--_0x29c10b){_0x5f584a['push'](_0x5f584a['shift']());}};_0x3788d9(++_0x47f064);}(_0x726c,0x145));var _0xc726=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x726c[_0x17b6e3];return _0x3906f3;};'use strict';var utils=require('./utils');exports[_0xc726('0x0')]=function(){utils[_0xc726('0x1')](_0xc726('0x2'));};exports[_0xc726('0x3')]=function(){utils[_0xc726('0x1')](_0xc726('0x4'));};exports['fullybooted']=function(){utils[_0xc726('0x1')](_0xc726('0x5'));};exports['error']=function(_0x440d89){utils[_0xc726('0x6')](_0xc726('0x7'),_0x440d89);};exports[_0xc726('0x8')]=function(){utils[_0xc726('0x1')](_0xc726('0x9'));};exports[_0xc726('0xa')]=function(_0xe4d4cd){}; \ No newline at end of file +var _0xd8fa=['./utils','info','[core]\x20connected','shutdown','fullybooted','error','[core]\x20error','[core]\x20close','managerevent'];(function(_0x1b29be,_0x13224f){var _0x3e77b0=function(_0xc4953e){while(--_0xc4953e){_0x1b29be['push'](_0x1b29be['shift']());}};_0x3e77b0(++_0x13224f);}(_0xd8fa,0x1c2));var _0xad8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8fa[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xad8f('0x0'));exports['connect']=function(){utils[_0xad8f('0x1')](_0xad8f('0x2'));};exports[_0xad8f('0x3')]=function(){utils[_0xad8f('0x1')]('[core]\x20shutdown');};exports[_0xad8f('0x4')]=function(){utils[_0xad8f('0x1')]('[core]\x20fullybooted');};exports['error']=function(_0x3ee598){utils[_0xad8f('0x5')](_0xad8f('0x6'),_0x3ee598);};exports['close']=function(){utils[_0xad8f('0x1')](_0xad8f('0x7'));};exports[_0xad8f('0x8')]=function(_0x49afeb){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0db423d..548a6e8 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x641f=['value','[%s][dials][varset]','assign','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','request','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x4659dc,_0x149eb3){var _0x1add5e=function(_0x1b409e){while(--_0x1b409e){_0x4659dc['push'](_0x4659dc['shift']());}};_0x1add5e(++_0x149eb3);}(_0x641f,0x146));var _0xf641=function(_0x418a99,_0x2d9e2a){_0x418a99=_0x418a99-0x0;var _0x5f132a=_0x641f[_0x418a99];return _0x5f132a;};'use strict';var _=require(_0xf641('0x0'));var util=require(_0xf641('0x1'));var utils=require(_0xf641('0x2'));var dials={};function writeDB(_0x38aaf7){utils[_0xf641('0x3')](util[_0xf641('0x4')](_0xf641('0x5'),_0x38aaf7[_0xf641('0x6')],_0x38aaf7['channel'],_0x38aaf7['dialstring'],_0x38aaf7[_0xf641('0x7')],_0x38aaf7[_0xf641('0x8')],_0x38aaf7['dialstatus']));utils[_0xf641('0x9')]('CreateVoiceDialReport',_0x38aaf7);delete dials[_0x38aaf7[_0xf641('0x6')]];}exports['newexten']=function(_0x12d3a5){try{utils[_0xf641('0xa')](util[_0xf641('0x4')](_0xf641('0xb'),_0x12d3a5[_0xf641('0x6')]),_0x12d3a5);utils[_0xf641('0x3')](util[_0xf641('0x4')](_0xf641('0xc'),_0x12d3a5[_0xf641('0x6')],_0x12d3a5[_0xf641('0xd')],_0x12d3a5[_0xf641('0xe')]));if(_0x12d3a5[_0xf641('0xd')]['toLowerCase']()=='set'&&_[_0xf641('0xf')](_0x12d3a5['appdata'][_0xf641('0x10')](),'cdr(routeid)')){var _0x290924=_0x12d3a5['appdata'][_0xf641('0x11')]('=');dials[_0x12d3a5[_0xf641('0x6')]]={'routeId':_0x290924[0x1]};}}catch(_0x142362){utils[_0xf641('0x12')](util[_0xf641('0x4')](_0xf641('0xb'),_0x12d3a5[_0xf641('0x6')]),_0x142362);}};exports[_0xf641('0x13')]=function(_0x396034){try{utils[_0xf641('0xa')](util[_0xf641('0x4')]('[%s][dials][varset]',_0x396034[_0xf641('0x6')]),_0x396034);if(!_[_0xf641('0x14')](_0x396034[_0xf641('0x15')][_0xf641('0x16')])){utils[_0xf641('0x3')](util[_0xf641('0x4')](_0xf641('0x17'),_0x396034['uniqueid'],_0x396034[_0xf641('0x18')]));dials[_0x396034[_0xf641('0x6')]]={'routeId':_0x396034[_0xf641('0x18')]};}}catch(_0x32d295){utils[_0xf641('0x12')](util[_0xf641('0x4')](_0xf641('0x19'),_0x396034[_0xf641('0x6')]),_0x32d295);}};exports['dialbegin']=function(_0x5ca096){try{if(!_[_0xf641('0x14')](dials[_0x5ca096[_0xf641('0x6')]])){utils[_0xf641('0xa')](util[_0xf641('0x4')]('[%s][dials][dialbegin]',_0x5ca096[_0xf641('0x6')]),_0x5ca096);dials[_0x5ca096[_0xf641('0x6')]]=_[_0xf641('0x1a')](dials[_0x5ca096[_0xf641('0x6')]],_0x5ca096);dials[_0x5ca096[_0xf641('0x6')]]['starttime']=utils['now']();dials[_0x5ca096[_0xf641('0x6')]]['lastevent']=_0xf641('0x1b');utils['info'](util[_0xf641('0x4')](_0xf641('0x1c'),_0x5ca096[_0xf641('0x6')],dials[_0x5ca096[_0xf641('0x6')]][_0xf641('0x1d')]));}}catch(_0x37cc12){utils[_0xf641('0x12')](util[_0xf641('0x4')](_0xf641('0x1e'),_0x5ca096[_0xf641('0x6')]),_0x37cc12);}};exports[_0xf641('0x1f')]=function(_0x1529a6){try{if(!_[_0xf641('0x14')](dials[_0x1529a6[_0xf641('0x6')]])){utils[_0xf641('0xa')](util[_0xf641('0x4')](_0xf641('0x20'),_0x1529a6[_0xf641('0x6')]),_0x1529a6);dials[_0x1529a6[_0xf641('0x6')]]['dialstatus']=_0x1529a6[_0xf641('0x21')];if(_0x1529a6[_0xf641('0x21')]==_0xf641('0x22')){dials[_0x1529a6[_0xf641('0x6')]]=_[_0xf641('0x1a')](dials[_0x1529a6['uniqueid']],_0x1529a6);dials[_0x1529a6['uniqueid']][_0xf641('0x23')]=utils['now']();dials[_0x1529a6[_0xf641('0x6')]][_0xf641('0x24')]=_0xf641('0x25');utils[_0xf641('0x3')](util['format'](_0xf641('0x26'),_0x1529a6[_0xf641('0x6')],_0x1529a6[_0xf641('0x21')],dials[_0x1529a6[_0xf641('0x6')]][_0xf641('0x23')]));}else{utils[_0xf641('0x3')](util[_0xf641('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x1529a6[_0xf641('0x6')],_0x1529a6[_0xf641('0x21')]));}}}catch(_0xbeb237){utils[_0xf641('0x12')](util[_0xf641('0x4')]('[%s][dials][dialend]',_0x1529a6['uniqueid']),_0xbeb237);}};exports[_0xf641('0x27')]=function(_0x5ec37c){try{if(!_[_0xf641('0x14')](dials[_0x5ec37c[_0xf641('0x6')]])){utils[_0xf641('0xa')](util[_0xf641('0x4')](_0xf641('0x28'),_0x5ec37c[_0xf641('0x6')]),_0x5ec37c);utils[_0xf641('0x3')](util[_0xf641('0x4')](_0xf641('0x29'),_0x5ec37c[_0xf641('0x6')],_0x5ec37c['calleridnum'],_0x5ec37c[_0xf641('0x2a')],_0x5ec37c[_0xf641('0x2b')]));dials[_0x5ec37c[_0xf641('0x6')]]=_['assign'](dials[_0x5ec37c['uniqueid']],{'endtime':utils['now'](),'lastevent':_0xf641('0x2c')});dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x2d')]=utils[_0xf641('0x2e')](dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x2f')],dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x1d')]);dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x30')]=utils[_0xf641('0x2e')](dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x23')]||dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x2f')],dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x1d')]);dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x31')]=dials[_0x5ec37c[_0xf641('0x6')]][_0xf641('0x23')]?utils[_0xf641('0x2e')](dials[_0x5ec37c['uniqueid']][_0xf641('0x2f')],dials[_0x5ec37c['uniqueid']][_0xf641('0x23')]):0x0;writeDB(dials[_0x5ec37c[_0xf641('0x6')]]);}}catch(_0x1ae06c){utils[_0xf641('0x12')](util['format'](_0xf641('0x28'),_0x5ec37c[_0xf641('0x6')]),_0x1ae06c);}}; \ No newline at end of file +var _0xbf60=['[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','debug','[%s][dials][dialbegin]','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','now','complete','diffTime','holdtime','endtime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0xbf60,0xfd));var _0x0bf6=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0xbf60[_0x3b8f2e];return _0x1433d5;};'use strict';var _=require('lodash');var util=require(_0x0bf6('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x5d6e11){utils[_0x0bf6('0x1')](util[_0x0bf6('0x2')](_0x0bf6('0x3'),_0x5d6e11['uniqueid'],_0x5d6e11[_0x0bf6('0x4')],_0x5d6e11[_0x0bf6('0x5')],_0x5d6e11[_0x0bf6('0x6')],_0x5d6e11[_0x0bf6('0x7')],_0x5d6e11[_0x0bf6('0x8')]));utils[_0x0bf6('0x9')](_0x0bf6('0xa'),_0x5d6e11);delete dials[_0x5d6e11['uniqueid']];}exports[_0x0bf6('0xb')]=function(_0x2350c2){try{utils['debug'](util['format'](_0x0bf6('0xc'),_0x2350c2[_0x0bf6('0xd')]),_0x2350c2);utils[_0x0bf6('0x1')](util['format'](_0x0bf6('0xe'),_0x2350c2[_0x0bf6('0xd')],_0x2350c2[_0x0bf6('0xf')],_0x2350c2[_0x0bf6('0x10')]));if(_0x2350c2[_0x0bf6('0xf')]['toLowerCase']()==_0x0bf6('0x11')&&_[_0x0bf6('0x12')](_0x2350c2['appdata'][_0x0bf6('0x13')](),_0x0bf6('0x14'))){var _0x29f72f=_0x2350c2[_0x0bf6('0x10')][_0x0bf6('0x15')]('=');dials[_0x2350c2[_0x0bf6('0xd')]]={'routeId':_0x29f72f[0x1]};}}catch(_0x3b60cb){utils['error'](util[_0x0bf6('0x2')]('[%s][dials][newexten]',_0x2350c2[_0x0bf6('0xd')]),_0x3b60cb);}};exports['varset']=function(_0x41678a){try{utils['debug'](util[_0x0bf6('0x2')](_0x0bf6('0x16'),_0x41678a[_0x0bf6('0xd')]),_0x41678a);if(!_[_0x0bf6('0x17')](_0x41678a[_0x0bf6('0x18')][_0x0bf6('0x19')])){utils[_0x0bf6('0x1')](util[_0x0bf6('0x2')](_0x0bf6('0x1a'),_0x41678a[_0x0bf6('0xd')],_0x41678a[_0x0bf6('0x1b')]));dials[_0x41678a[_0x0bf6('0xd')]]={'routeId':_0x41678a[_0x0bf6('0x1b')]};}}catch(_0x566edd){utils[_0x0bf6('0x1c')](util['format'](_0x0bf6('0x16'),_0x41678a[_0x0bf6('0xd')]),_0x566edd);}};exports[_0x0bf6('0x1d')]=function(_0x28836f){try{if(!_[_0x0bf6('0x17')](dials[_0x28836f[_0x0bf6('0xd')]])){utils[_0x0bf6('0x1e')](util[_0x0bf6('0x2')](_0x0bf6('0x1f'),_0x28836f[_0x0bf6('0xd')]),_0x28836f);dials[_0x28836f[_0x0bf6('0xd')]]=_['assign'](dials[_0x28836f['uniqueid']],_0x28836f);dials[_0x28836f[_0x0bf6('0xd')]][_0x0bf6('0x20')]=utils['now']();dials[_0x28836f[_0x0bf6('0xd')]][_0x0bf6('0x21')]=_0x0bf6('0x22');utils[_0x0bf6('0x1')](util[_0x0bf6('0x2')](_0x0bf6('0x23'),_0x28836f[_0x0bf6('0xd')],dials[_0x28836f[_0x0bf6('0xd')]][_0x0bf6('0x20')]));}}catch(_0x287d95){utils[_0x0bf6('0x1c')](util[_0x0bf6('0x2')](_0x0bf6('0x1f'),_0x28836f[_0x0bf6('0xd')]),_0x287d95);}};exports[_0x0bf6('0x24')]=function(_0x4a7d13){try{if(!_[_0x0bf6('0x17')](dials[_0x4a7d13[_0x0bf6('0xd')]])){utils[_0x0bf6('0x1e')](util[_0x0bf6('0x2')]('[%s][dials][dialend]',_0x4a7d13[_0x0bf6('0xd')]),_0x4a7d13);dials[_0x4a7d13['uniqueid']][_0x0bf6('0x8')]=_0x4a7d13[_0x0bf6('0x8')];if(_0x4a7d13[_0x0bf6('0x8')]==_0x0bf6('0x25')){dials[_0x4a7d13[_0x0bf6('0xd')]]=_[_0x0bf6('0x26')](dials[_0x4a7d13[_0x0bf6('0xd')]],_0x4a7d13);dials[_0x4a7d13[_0x0bf6('0xd')]][_0x0bf6('0x27')]=utils['now']();dials[_0x4a7d13[_0x0bf6('0xd')]]['lastevent']=_0x0bf6('0x28');utils[_0x0bf6('0x1')](util[_0x0bf6('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4a7d13['uniqueid'],_0x4a7d13[_0x0bf6('0x8')],dials[_0x4a7d13[_0x0bf6('0xd')]][_0x0bf6('0x27')]));}else{utils[_0x0bf6('0x1')](util[_0x0bf6('0x2')](_0x0bf6('0x29'),_0x4a7d13[_0x0bf6('0xd')],_0x4a7d13[_0x0bf6('0x8')]));}}}catch(_0x42c2f4){utils[_0x0bf6('0x1c')](util['format'](_0x0bf6('0x2a'),_0x4a7d13['uniqueid']),_0x42c2f4);}};exports[_0x0bf6('0x2b')]=function(_0x27ca0c){try{if(!_[_0x0bf6('0x17')](dials[_0x27ca0c[_0x0bf6('0xd')]])){utils[_0x0bf6('0x1e')](util[_0x0bf6('0x2')](_0x0bf6('0x2c'),_0x27ca0c[_0x0bf6('0xd')]),_0x27ca0c);utils[_0x0bf6('0x1')](util[_0x0bf6('0x2')](_0x0bf6('0x2d'),_0x27ca0c[_0x0bf6('0xd')],_0x27ca0c['calleridnum'],_0x27ca0c[_0x0bf6('0x2e')],_0x27ca0c['cause-txt']));dials[_0x27ca0c[_0x0bf6('0xd')]]=_[_0x0bf6('0x26')](dials[_0x27ca0c[_0x0bf6('0xd')]],{'endtime':utils[_0x0bf6('0x2f')](),'lastevent':_0x0bf6('0x30')});dials[_0x27ca0c[_0x0bf6('0xd')]]['duration']=utils[_0x0bf6('0x31')](dials[_0x27ca0c[_0x0bf6('0xd')]]['endtime'],dials[_0x27ca0c[_0x0bf6('0xd')]][_0x0bf6('0x20')]);dials[_0x27ca0c[_0x0bf6('0xd')]][_0x0bf6('0x32')]=utils[_0x0bf6('0x31')](dials[_0x27ca0c[_0x0bf6('0xd')]][_0x0bf6('0x27')]||dials[_0x27ca0c['uniqueid']][_0x0bf6('0x33')],dials[_0x27ca0c[_0x0bf6('0xd')]][_0x0bf6('0x20')]);dials[_0x27ca0c[_0x0bf6('0xd')]][_0x0bf6('0x34')]=dials[_0x27ca0c['uniqueid']][_0x0bf6('0x27')]?utils[_0x0bf6('0x31')](dials[_0x27ca0c[_0x0bf6('0xd')]]['endtime'],dials[_0x27ca0c[_0x0bf6('0xd')]][_0x0bf6('0x27')]):0x0;writeDB(dials[_0x27ca0c['uniqueid']]);}}catch(_0x40103){utils[_0x0bf6('0x1c')](util['format'](_0x0bf6('0x2c'),_0x27ca0c[_0x0bf6('0xd')]),_0x40103);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index aed1ece..e3a7766 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11a1=['../../config/environment','util','xdr','disabled','env','production','local','asterisk','password','keepConnected','info','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','agentringnoanswer','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x11a1,0x1cd));var _0x111a=function(_0x224964,_0x44c3c1){_0x224964=_0x224964-0x0;var _0x3789f1=_0x11a1[_0x224964];return _0x3789f1;};var AsteriskManager=require(_0x111a('0x0'));var config=require(_0x111a('0x1'));var utils=require('./utils');var util=require(_0x111a('0x2'));var isXDREnabled=config[_0x111a('0x3')]&&config['xdr'][_0x111a('0x4')]?!config['xdr'][_0x111a('0x4')]:!![];var isProduction=config[_0x111a('0x5')]===_0x111a('0x6')||![];var isLocalAsterisk=config[_0x111a('0x3')]&&config['xdr'][_0x111a('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x111a('0x8')]['port'],config['asterisk']['ip'],config[_0x111a('0x8')]['username'],config[_0x111a('0x8')][_0x111a('0x9')],!![]);ami[_0x111a('0xa')]();if(!isXDREnabled){utils[_0x111a('0xb')](_0x111a('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x111a('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0x111a('0xd'));var recordings=require(_0x111a('0xe'));var members=require(_0x111a('0xf'));var dials=require('./dials.controller');var transfers=require(_0x111a('0x10'));var core=require(_0x111a('0x11'));ami['on']('connect',core[_0x111a('0x12')]);ami['on'](_0x111a('0x13'),core[_0x111a('0x13')]);ami['on'](_0x111a('0x14'),core[_0x111a('0x14')]);ami['on'](_0x111a('0x15'),core['error']);ami['on'](_0x111a('0x16'),core[_0x111a('0x16')]);ami['on'](_0x111a('0x17'),core[_0x111a('0x17')]);ami['on'](_0x111a('0x18'),function(_0x13d083){try{utils[_0x111a('0x19')](util['format'](_0x111a('0x1a'),_0x13d083[_0x111a('0x1b')]),_0x13d083);members[_0x111a('0x18')](_0x13d083);}catch(_0x492793){utils[_0x111a('0x15')](util['format'](_0x111a('0x1a'),_0x13d083[_0x111a('0x1b')]),_0x492793);}});ami['on'](_0x111a('0x1c'),function(_0x560557){try{utils[_0x111a('0x19')](util['format']('[%s][index][agentcalled]',_0x560557['uniqueid']),_0x560557);agents[_0x111a('0x1c')](_0x560557);}catch(_0x1a5c30){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x1e'),_0x560557['uniqueid']),_0x1a5c30);}});ami['on'](_0x111a('0x1f'),function(_0x1831d6){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')]('[%s][index][agentringnoanswer]',_0x1831d6[_0x111a('0x20')]),_0x1831d6);agents['agentringnoanswer'](_0x1831d6);}catch(_0x311627){utils['error'](util[_0x111a('0x1d')](_0x111a('0x21'),_0x1831d6[_0x111a('0x20')]),_0x311627);}});ami['on'](_0x111a('0x22'),function(_0xc2c3d){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')](_0x111a('0x23'),_0xc2c3d[_0x111a('0x20')]),_0xc2c3d);agents[_0x111a('0x22')](_0xc2c3d);queues[_0x111a('0x22')](_0xc2c3d);}catch(_0x2ec224){utils['error'](util[_0x111a('0x1d')](_0x111a('0x23'),_0xc2c3d[_0x111a('0x20')]),_0x2ec224);}});ami['on'](_0x111a('0x24'),function(_0x5f48fb){try{utils['debug'](util[_0x111a('0x1d')]('[%s][index][agentcomplete]',_0x5f48fb[_0x111a('0x20')]),_0x5f48fb);agents['agentcomplete'](_0x5f48fb);queues[_0x111a('0x24')](_0x5f48fb);members[_0x111a('0x24')](_0x5f48fb);}catch(_0xc0eccf){utils[_0x111a('0x15')](util[_0x111a('0x1d')]('[%s][index][agentcomplete]',_0x5f48fb[_0x111a('0x20')]),_0xc0eccf);}});ami['on'](_0x111a('0x25'),function(_0x33fcad){try{utils['debug'](util[_0x111a('0x1d')](_0x111a('0x26'),_0x33fcad[_0x111a('0x20')]),_0x33fcad);agents[_0x111a('0x25')](_0x33fcad);queues[_0x111a('0x25')](_0x33fcad);}catch(_0x5dbe42){utils[_0x111a('0x15')](util[_0x111a('0x1d')]('[%s][index][queuecallerabandon]',_0x33fcad[_0x111a('0x20')]),_0x5dbe42);}});ami['on'](_0x111a('0x27'),function(_0x4fbd02){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')](_0x111a('0x28'),_0x4fbd02['uniqueid']),_0x4fbd02);queues[_0x111a('0x27')](_0x4fbd02);recordings[_0x111a('0x27')](_0x4fbd02);}catch(_0x4190f6){utils['error'](util[_0x111a('0x1d')](_0x111a('0x28'),_0x4fbd02[_0x111a('0x20')]),_0x4190f6);}});ami['on'](_0x111a('0x29'),function(_0x2c6a3d){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')](_0x111a('0x2a'),_0x2c6a3d['uniqueid']),_0x2c6a3d);queues[_0x111a('0x29')](_0x2c6a3d);}catch(_0x376ba3){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x2a'),_0x2c6a3d[_0x111a('0x20')]),_0x376ba3);}});ami['on'](_0x111a('0x2b'),function(_0x5bc269){try{utils[_0x111a('0x19')](util['format']('[%s][index][musiconholdstart]',_0x5bc269[_0x111a('0x20')]),_0x5bc269);queues[_0x111a('0x2b')](_0x5bc269);calls[_0x111a('0x2b')](_0x5bc269);}catch(_0x562328){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x2c'),_0x5bc269[_0x111a('0x20')]),_0x562328);}});ami['on'](_0x111a('0x2d'),function(_0x452fd9){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')]('[%s][index][musiconholdstop]',_0x452fd9['uniqueid']),_0x452fd9);queues[_0x111a('0x2d')](_0x452fd9);calls[_0x111a('0x2d')](_0x452fd9);}catch(_0x3d7fbc){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x2e'),_0x452fd9[_0x111a('0x20')]),_0x3d7fbc);}});ami['on']('newstate',function(_0x7d3ed9){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')]('[%s][index][newstate]',_0x7d3ed9[_0x111a('0x20')]),_0x7d3ed9);calls[_0x111a('0x2f')](_0x7d3ed9);recordings[_0x111a('0x2f')](_0x7d3ed9);}catch(_0x2aa24f){utils[_0x111a('0x15')](util[_0x111a('0x1d')]('[%s][index][newstate]',_0x7d3ed9[_0x111a('0x20')]),_0x2aa24f);}});ami['on'](_0x111a('0x30'),function(_0x41d7ee){try{utils[_0x111a('0x19')](util['format'](_0x111a('0x31'),_0x41d7ee['uniqueid']),_0x41d7ee);calls['hangup'](_0x41d7ee);recordings[_0x111a('0x30')](_0x41d7ee);dials[_0x111a('0x30')](_0x41d7ee);agents['hangup'](_0x41d7ee);queues[_0x111a('0x30')](_0x41d7ee);}catch(_0x54cd6e){utils['error'](util[_0x111a('0x1d')]('[%s][index][hangup]',_0x41d7ee[_0x111a('0x20')]),_0x54cd6e);}});ami['on'](_0x111a('0x32'),function(_0x531a54){try{utils['debug'](util[_0x111a('0x1d')](_0x111a('0x33'),_0x531a54[_0x111a('0x20')]),_0x531a54);members[_0x111a('0x32')](_0x531a54);}catch(_0x2b0fa8){utils[_0x111a('0x15')](util['format'](_0x111a('0x33'),_0x531a54[_0x111a('0x20')]),_0x2b0fa8);}});ami['on'](_0x111a('0x34'),function(_0x2dfa8b){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')]('[%s][index][blindtransfer]',_0x2dfa8b['uniqueid']),_0x2dfa8b);queues[_0x111a('0x34')](_0x2dfa8b);agents['blindtransfer'](_0x2dfa8b);transfers['blindtransfer'](_0x2dfa8b);recordings[_0x111a('0x34')](_0x2dfa8b);}catch(_0x5bc086){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x35'),_0x2dfa8b['uniqueid']),_0x5bc086);}});ami['on'](_0x111a('0x36'),function(_0x4dc9f0){try{utils[_0x111a('0x19')](util['format']('[%s][index][attendedtransfer]',_0x4dc9f0[_0x111a('0x37')]),_0x4dc9f0);queues[_0x111a('0x36')](_0x4dc9f0);transfers['attendedtransfer'](_0x4dc9f0);agents[_0x111a('0x36')](_0x4dc9f0);calls[_0x111a('0x36')](_0x4dc9f0);}catch(_0xa6a0fb){utils[_0x111a('0x15')](util[_0x111a('0x1d')]('[%s][index][attendedtransfer]',_0x4dc9f0['origtransfereruniqueid']),_0xa6a0fb);}});ami['on'](_0x111a('0x38'),function(_0x50c759){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')](_0x111a('0x39'),_0x50c759['uniqueid']),_0x50c759);queues[_0x111a('0x38')](_0x50c759);recordings[_0x111a('0x38')](_0x50c759);calls[_0x111a('0x38')](_0x50c759);dials[_0x111a('0x38')](_0x50c759);}catch(_0x102fe1){utils[_0x111a('0x15')](util[_0x111a('0x1d')]('[%s][index][varset]',_0x50c759[_0x111a('0x20')]),_0x102fe1);}});ami['on']('newexten',function(_0x51b403){try{utils['debug'](util[_0x111a('0x1d')]('[%s][index][newexten]',_0x51b403[_0x111a('0x20')]),_0x51b403);calls[_0x111a('0x3a')](_0x51b403);recordings[_0x111a('0x3a')](_0x51b403);dials[_0x111a('0x3a')](_0x51b403);}catch(_0xe03b5a){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x3b'),_0x51b403['uniqueid']),_0xe03b5a);}});ami['on'](_0x111a('0x3c'),function(_0x592ac3){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')](_0x111a('0x3d'),_0x592ac3[_0x111a('0x20')]),_0x592ac3);calls[_0x111a('0x3c')](_0x592ac3);recordings[_0x111a('0x3c')](_0x592ac3);}catch(_0x14ed81){utils[_0x111a('0x15')](util['format'](_0x111a('0x3d'),_0x592ac3['uniqueid']),_0x14ed81);}});ami['on'](_0x111a('0x3e'),function(_0x208ea0){try{utils['debug'](util[_0x111a('0x1d')](_0x111a('0x3f'),_0x208ea0[_0x111a('0x20')]),_0x208ea0);dials[_0x111a('0x3e')](_0x208ea0);}catch(_0x31fde7){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x40'),_0x208ea0[_0x111a('0x20')]),_0x31fde7);}});ami['on']('dialend',function(_0x4c74e7){try{utils[_0x111a('0x19')](util[_0x111a('0x1d')](_0x111a('0x41'),_0x4c74e7[_0x111a('0x20')]),_0x4c74e7);dials['dialend'](_0x4c74e7);}catch(_0xf206d8){utils[_0x111a('0x15')](util[_0x111a('0x1d')](_0x111a('0x41'),_0x4c74e7[_0x111a('0x20')]),_0xf206d8);}});} \ No newline at end of file +var _0x45f5=['cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]'];(function(_0x59239e,_0x30ee76){var _0x238989=function(_0x3e648c){while(--_0x3e648c){_0x59239e['push'](_0x59239e['shift']());}};_0x238989(++_0x30ee76);}(_0x45f5,0x17d));var _0x545f=function(_0x13be43,_0x1261e8){_0x13be43=_0x13be43-0x0;var _0x2b5d2f=_0x45f5[_0x13be43];return _0x2b5d2f;};var AsteriskManager=require(_0x545f('0x0'));var config=require(_0x545f('0x1'));var utils=require(_0x545f('0x2'));var util=require(_0x545f('0x3'));var isXDREnabled=config['xdr']&&config[_0x545f('0x4')][_0x545f('0x5')]?!config[_0x545f('0x4')][_0x545f('0x5')]:!![];var isProduction=config[_0x545f('0x6')]==='production'||![];var isLocalAsterisk=config[_0x545f('0x4')]&&config['xdr'][_0x545f('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x545f('0x8')][_0x545f('0x9')],config[_0x545f('0x8')]['ip'],config[_0x545f('0x8')]['username'],config['asterisk'][_0x545f('0xa')],!![]);ami[_0x545f('0xb')]();if(!isXDREnabled){utils[_0x545f('0xc')](_0x545f('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x545f('0xc')](_0x545f('0xe'));}else{var agents=require(_0x545f('0xf'));var calls=require(_0x545f('0x10'));var queues=require(_0x545f('0x11'));var recordings=require(_0x545f('0x12'));var members=require(_0x545f('0x13'));var dials=require(_0x545f('0x14'));var transfers=require(_0x545f('0x15'));var core=require(_0x545f('0x16'));ami['on'](_0x545f('0x17'),core[_0x545f('0x17')]);ami['on'](_0x545f('0x18'),core[_0x545f('0x18')]);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x545f('0x19'),core[_0x545f('0x19')]);ami['on'](_0x545f('0x1a'),core['close']);ami['on'](_0x545f('0x1b'),core['managerevent']);ami['on'](_0x545f('0x1c'),function(_0x163c90){try{utils[_0x545f('0x1d')](util['format'](_0x545f('0x1e'),_0x163c90[_0x545f('0x1f')]),_0x163c90);members['devicestatechange'](_0x163c90);}catch(_0x4b0cfa){utils['error'](util['format']('[%s][index][devicestatechange]',_0x163c90[_0x545f('0x1f')]),_0x4b0cfa);}});ami['on'](_0x545f('0x20'),function(_0x1e920f){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x22'),_0x1e920f[_0x545f('0x23')]),_0x1e920f);agents[_0x545f('0x20')](_0x1e920f);}catch(_0x25fee5){utils[_0x545f('0x19')](util[_0x545f('0x21')]('[%s][index][agentcalled]',_0x1e920f[_0x545f('0x23')]),_0x25fee5);}});ami['on'](_0x545f('0x24'),function(_0x2ca6b5){try{utils['debug'](util[_0x545f('0x21')](_0x545f('0x25'),_0x2ca6b5[_0x545f('0x23')]),_0x2ca6b5);agents[_0x545f('0x24')](_0x2ca6b5);}catch(_0x561061){utils[_0x545f('0x19')](util[_0x545f('0x21')]('[%s][index][agentringnoanswer]',_0x2ca6b5['uniqueid']),_0x561061);}});ami['on'](_0x545f('0x26'),function(_0x391b79){try{utils['debug'](util[_0x545f('0x21')](_0x545f('0x27'),_0x391b79['uniqueid']),_0x391b79);agents['agentconnect'](_0x391b79);queues[_0x545f('0x26')](_0x391b79);}catch(_0x9f8f98){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x27'),_0x391b79[_0x545f('0x23')]),_0x9f8f98);}});ami['on']('agentcomplete',function(_0x138978){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x28'),_0x138978[_0x545f('0x23')]),_0x138978);agents[_0x545f('0x29')](_0x138978);queues[_0x545f('0x29')](_0x138978);members[_0x545f('0x29')](_0x138978);}catch(_0x23d0ea){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x28'),_0x138978[_0x545f('0x23')]),_0x23d0ea);}});ami['on'](_0x545f('0x2a'),function(_0x53baba){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x2b'),_0x53baba[_0x545f('0x23')]),_0x53baba);agents[_0x545f('0x2a')](_0x53baba);queues['queuecallerabandon'](_0x53baba);}catch(_0x4479c1){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x2b'),_0x53baba[_0x545f('0x23')]),_0x4479c1);}});ami['on'](_0x545f('0x2c'),function(_0x45f181){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x2d'),_0x45f181[_0x545f('0x23')]),_0x45f181);queues[_0x545f('0x2c')](_0x45f181);recordings[_0x545f('0x2c')](_0x45f181);}catch(_0x2407f8){utils[_0x545f('0x19')](util[_0x545f('0x21')]('[%s][index][queuecallerjoin]',_0x45f181[_0x545f('0x23')]),_0x2407f8);}});ami['on'](_0x545f('0x2e'),function(_0x4ce14f){try{utils['debug'](util['format'](_0x545f('0x2f'),_0x4ce14f[_0x545f('0x23')]),_0x4ce14f);queues[_0x545f('0x2e')](_0x4ce14f);}catch(_0x24a701){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x2f'),_0x4ce14f[_0x545f('0x23')]),_0x24a701);}});ami['on']('musiconholdstart',function(_0x53a4d7){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x30'),_0x53a4d7[_0x545f('0x23')]),_0x53a4d7);queues[_0x545f('0x31')](_0x53a4d7);calls[_0x545f('0x31')](_0x53a4d7);}catch(_0x4f659d){utils[_0x545f('0x19')](util['format'](_0x545f('0x30'),_0x53a4d7['uniqueid']),_0x4f659d);}});ami['on']('musiconholdstop',function(_0x20956f){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x32'),_0x20956f[_0x545f('0x23')]),_0x20956f);queues[_0x545f('0x33')](_0x20956f);calls[_0x545f('0x33')](_0x20956f);}catch(_0x159038){utils[_0x545f('0x19')](util[_0x545f('0x21')]('[%s][index][musiconholdstop]',_0x20956f[_0x545f('0x23')]),_0x159038);}});ami['on'](_0x545f('0x34'),function(_0x32108c){try{utils['debug'](util['format'](_0x545f('0x35'),_0x32108c['uniqueid']),_0x32108c);calls[_0x545f('0x34')](_0x32108c);recordings[_0x545f('0x34')](_0x32108c);}catch(_0x1e3fdd){utils[_0x545f('0x19')](util['format']('[%s][index][newstate]',_0x32108c[_0x545f('0x23')]),_0x1e3fdd);}});ami['on'](_0x545f('0x36'),function(_0x2c3550){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x37'),_0x2c3550[_0x545f('0x23')]),_0x2c3550);calls[_0x545f('0x36')](_0x2c3550);recordings[_0x545f('0x36')](_0x2c3550);dials[_0x545f('0x36')](_0x2c3550);agents[_0x545f('0x36')](_0x2c3550);queues[_0x545f('0x36')](_0x2c3550);}catch(_0x587e38){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x37'),_0x2c3550[_0x545f('0x23')]),_0x587e38);}});ami['on']('cdr',function(_0x545035){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x38'),_0x545035[_0x545f('0x23')]),_0x545035);members[_0x545f('0x39')](_0x545035);}catch(_0x1d1e91){utils[_0x545f('0x19')](util['format']('[%s][index][cdr]',_0x545035[_0x545f('0x23')]),_0x1d1e91);}});ami['on'](_0x545f('0x3a'),function(_0x4fc773){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x3b'),_0x4fc773['uniqueid']),_0x4fc773);queues[_0x545f('0x3a')](_0x4fc773);agents[_0x545f('0x3a')](_0x4fc773);transfers[_0x545f('0x3a')](_0x4fc773);recordings[_0x545f('0x3a')](_0x4fc773);}catch(_0x387a15){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x3b'),_0x4fc773[_0x545f('0x23')]),_0x387a15);}});ami['on'](_0x545f('0x3c'),function(_0x34508f){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')]('[%s][index][attendedtransfer]',_0x34508f[_0x545f('0x3d')]),_0x34508f);queues['attendedtransfer'](_0x34508f);transfers[_0x545f('0x3c')](_0x34508f);agents[_0x545f('0x3c')](_0x34508f);calls[_0x545f('0x3c')](_0x34508f);}catch(_0x241c0d){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x3e'),_0x34508f[_0x545f('0x3d')]),_0x241c0d);}});ami['on'](_0x545f('0x3f'),function(_0x1f87ea){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x40'),_0x1f87ea[_0x545f('0x23')]),_0x1f87ea);queues['varset'](_0x1f87ea);recordings['varset'](_0x1f87ea);calls[_0x545f('0x3f')](_0x1f87ea);dials[_0x545f('0x3f')](_0x1f87ea);}catch(_0x14ad51){utils['error'](util['format'](_0x545f('0x40'),_0x1f87ea[_0x545f('0x23')]),_0x14ad51);}});ami['on'](_0x545f('0x41'),function(_0x2e20f5){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')](_0x545f('0x42'),_0x2e20f5['uniqueid']),_0x2e20f5);calls[_0x545f('0x41')](_0x2e20f5);recordings[_0x545f('0x41')](_0x2e20f5);dials[_0x545f('0x41')](_0x2e20f5);}catch(_0x9e58ee){utils[_0x545f('0x19')](util['format']('[%s][index][newexten]',_0x2e20f5[_0x545f('0x23')]),_0x9e58ee);}});ami['on']('newchannel',function(_0x218ebd){try{utils[_0x545f('0x1d')](util[_0x545f('0x21')]('[%s][index][newchannel]',_0x218ebd[_0x545f('0x23')]),_0x218ebd);calls[_0x545f('0x43')](_0x218ebd);recordings['newchannel'](_0x218ebd);}catch(_0x230eab){utils['error'](util[_0x545f('0x21')](_0x545f('0x44'),_0x218ebd[_0x545f('0x23')]),_0x230eab);}});ami['on'](_0x545f('0x45'),function(_0x3031da){try{utils[_0x545f('0x1d')](util['format'](_0x545f('0x46'),_0x3031da['uniqueid']),_0x3031da);dials[_0x545f('0x45')](_0x3031da);}catch(_0x39629c){utils[_0x545f('0x19')](util[_0x545f('0x21')](_0x545f('0x47'),_0x3031da['uniqueid']),_0x39629c);}});ami['on']('dialend',function(_0x18db73){try{utils[_0x545f('0x1d')](util['format'](_0x545f('0x48'),_0x18db73[_0x545f('0x23')]),_0x18db73);dials['dialend'](_0x18db73);}catch(_0x5725ba){utils['error'](util[_0x545f('0x21')](_0x545f('0x48'),_0x18db73[_0x545f('0x23')]),_0x5725ba);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 093ebec..9a84711 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['devicestatechange','debug','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','split','name','error','[%s][members][writeDB]','some','startsWith'];(function(_0x2a3d8f,_0x3d286f){var _0x46649b=function(_0x34cf67){while(--_0x34cf67){_0x2a3d8f['push'](_0x2a3d8f['shift']());}};_0x46649b(++_0x3d286f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1788cf,_0x449902){_0x1788cf=_0x1788cf-0x0;var _0x55c560=_0xa8a8[_0x1788cf];return _0x55c560;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var utils=require(_0x8a8a('0x2'));var members={};var exclude=[_0x8a8a('0x3'),'Queue:'];function writeDB(_0x2a2676){utils[_0x8a8a('0x4')](util[_0x8a8a('0x5')](_0x8a8a('0x6'),_0x2a2676[_0x8a8a('0x7')],_0x2a2676[_0x8a8a('0x8')],_0x2a2676[_0x8a8a('0x9')],_0x2a2676[_0x8a8a('0xa')],_0x2a2676[_0x8a8a('0xb')],_0x2a2676[_0x8a8a('0xc')]));if(_0x2a2676[_0x8a8a('0x8')]){utils[_0x8a8a('0xd')](_0x2a2676[_0x8a8a('0x8')])[_0x8a8a('0xe')](function(_0x3287f5){if(_0x3287f5){_0x2a2676['membername']=_0x3287f5['name'];_0x2a2676[_0x8a8a('0xf')]=_0x3287f5['internal'];utils[_0x8a8a('0x10')](_0x8a8a('0x11'),_0x2a2676);}else{utils['getUserByName'](_0x2a2676[_0x8a8a('0x8')][_0x8a8a('0x12')]('/')[0x1])[_0x8a8a('0xe')](function(_0x5e448d){if(_0x5e448d){_0x2a2676[_0x8a8a('0xb')]=_0x5e448d[_0x8a8a('0x13')];_0x2a2676[_0x8a8a('0xf')]=_0x5e448d[_0x8a8a('0xf')];utils['request'](_0x8a8a('0x11'),_0x2a2676);}});}})['catch'](function(_0x25e1d5){utils[_0x8a8a('0x14')](util[_0x8a8a('0x5')](_0x8a8a('0x15'),_0x2a2676[_0x8a8a('0x7')]),_0x25e1d5);});}delete members[_0x2a2676[_0x8a8a('0x8')]];}function startsWith(_0x16d38d,_0x51ce75){return _[_0x8a8a('0x16')](_0x16d38d,function(_0x568b83){return _[_0x8a8a('0x17')](_0x51ce75,_0x568b83);});}exports[_0x8a8a('0x18')]=function(_0x46a4f4){try{utils[_0x8a8a('0x19')](util[_0x8a8a('0x5')]('[%s][members][devicestatechange]',members[_0x46a4f4[_0x8a8a('0x1a')]]?members[_0x46a4f4[_0x8a8a('0x1a')]][_0x8a8a('0x7')]:_0x46a4f4[_0x8a8a('0x1a')]),_0x46a4f4);utils[_0x8a8a('0x4')](util[_0x8a8a('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x46a4f4['device']]?members[_0x46a4f4['device']]['uniqueid']:_0x46a4f4['device'],_0x46a4f4[_0x8a8a('0x1b')],_0x46a4f4[_0x8a8a('0x1a')]));switch(_0x46a4f4[_0x8a8a('0x1b')]){case _0x8a8a('0x1c'):case _0x8a8a('0x1d'):if(!startsWith(exclude,_0x46a4f4[_0x8a8a('0x1a')])){members[_0x46a4f4[_0x8a8a('0x1a')]]={'channel':_0x8a8a('0x1e'),'interface':_0x46a4f4[_0x8a8a('0x1a')],'type':_0x8a8a('0x1f'),'enterAt':utils[_0x8a8a('0x20')](),'role':_0x8a8a('0x21')};}break;case _0x8a8a('0x22'):if(!_[_0x8a8a('0x23')](members[_0x46a4f4[_0x8a8a('0x1a')]])){members[_0x46a4f4['device']][_0x8a8a('0x24')]=utils[_0x8a8a('0x20')]();members[_0x46a4f4[_0x8a8a('0x1a')]][_0x8a8a('0x25')]=utils[_0x8a8a('0x26')](members[_0x46a4f4[_0x8a8a('0x1a')]][_0x8a8a('0x24')],members[_0x46a4f4['device']][_0x8a8a('0x27')]);if(members[_0x46a4f4[_0x8a8a('0x1a')]][_0x8a8a('0x7')]){writeDB(members[_0x46a4f4['device']]);}}break;default:break;}}catch(_0x58f42b){utils[_0x8a8a('0x14')](util[_0x8a8a('0x5')]('[%s][members][devicestatechange]',members[_0x46a4f4['device']]?members[_0x46a4f4['device']][_0x8a8a('0x7')]:_0x46a4f4['device']),_0x58f42b);}};exports[_0x8a8a('0x28')]=function(_0xdd6221){try{if(!_['isNil'](members[_0xdd6221[_0x8a8a('0x8')]])){utils[_0x8a8a('0x19')](util[_0x8a8a('0x5')](_0x8a8a('0x29'),_0xdd6221[_0x8a8a('0x7')]),_0xdd6221);utils[_0x8a8a('0x4')](util[_0x8a8a('0x5')](_0x8a8a('0x2a'),_0xdd6221['uniqueid'],_0xdd6221['interface'],_0xdd6221['queue']));members[_0xdd6221[_0x8a8a('0x8')]]=_[_0x8a8a('0x2b')](members[_0xdd6221['interface']],{'data4':_0xdd6221[_0x8a8a('0x2c')],'uniqueid':_0xdd6221[_0x8a8a('0x7')]});}}catch(_0x481e92){utils[_0x8a8a('0x14')](util[_0x8a8a('0x5')](_0x8a8a('0x29'),_0xdd6221['uniqueid']),_0x481e92);}};exports['cdr']=function(_0x8457a0){try{utils['debug'](util[_0x8a8a('0x5')](_0x8a8a('0x2d'),_0x8457a0[_0x8a8a('0x7')]),_0x8457a0);if(_0x8457a0[_0x8a8a('0x9')]){var _0x3c69b4=_0x8457a0[_0x8a8a('0x9')][_0x8a8a('0x12')]('-')[0x0];if(!_[_0x8a8a('0x23')](members[_0x3c69b4])){members[_0x3c69b4]=_[_0x8a8a('0x2b')](members[_0x3c69b4],{'data1':members[_0x3c69b4][_0x8a8a('0x2e')]||_0x8457a0[_0x8a8a('0xc')],'data2':members[_0x3c69b4][_0x8a8a('0xa')]||_0x8457a0[_0x8a8a('0x2f')],'data3':members[_0x3c69b4][_0x8a8a('0x30')]||_0x8457a0[_0x8a8a('0x31')],'uniqueid':members[_0x3c69b4][_0x8a8a('0x7')]||_0x8457a0[_0x8a8a('0x7')]});utils[_0x8a8a('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x8457a0['uniqueid'],members[_0x3c69b4][_0x8a8a('0x2e')],members[_0x3c69b4][_0x8a8a('0xa')],members[_0x3c69b4][_0x8a8a('0x30')]));if(members[_0x3c69b4][_0x8a8a('0x24')]){writeDB(members[_0x3c69b4]);}}}if(_0x8457a0[_0x8a8a('0x32')]){var _0x508e67=_0x8457a0['destinationchannel'][_0x8a8a('0x12')]('-')[0x0];if(!_['isNil'](members[_0x508e67])){members[_0x508e67]=_[_0x8a8a('0x2b')](members[_0x508e67],{'data1':members[_0x508e67]['data1']||_0x8457a0['type'],'data2':members[_0x508e67][_0x8a8a('0xa')]||_0x8457a0[_0x8a8a('0x2f')],'data3':members[_0x508e67][_0x8a8a('0x30')]||_0x8457a0[_0x8a8a('0x31')],'uniqueid':members[_0x508e67][_0x8a8a('0x7')]||_0x8457a0[_0x8a8a('0x7')]});utils[_0x8a8a('0x4')](util['format'](_0x8a8a('0x33'),_0x8457a0[_0x8a8a('0x7')],members[_0x508e67][_0x8a8a('0x2e')],members[_0x508e67]['data2'],members[_0x508e67][_0x8a8a('0x30')]));if(members[_0x508e67][_0x8a8a('0x24')]){writeDB(members[_0x508e67]);}}}}catch(_0x3f845e){utils['error'](util[_0x8a8a('0x5')](_0x8a8a('0x2d'),_0x8457a0[_0x8a8a('0x7')]),_0x3f845e);}}; \ No newline at end of file +var _0x1acc=['assign','data1','type','source','data3','destination','data2','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','membername','getUserByInterface','then','internal','request','getUserByName','split','name','CreateMemberReport','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','[%s][members][devicestatechange]','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','agentcomplete','debug','queue','cdr','[%s][members][cdr]','channel'];(function(_0x3e8e1a,_0x8875a){var _0x190e35=function(_0x30a210){while(--_0x30a210){_0x3e8e1a['push'](_0x3e8e1a['shift']());}};_0x190e35(++_0x8875a);}(_0x1acc,0x15f));var _0xc1ac=function(_0x41273e,_0x1a8d3f){_0x41273e=_0x41273e-0x0;var _0x340241=_0x1acc[_0x41273e];return _0x340241;};'use strict';var _=require('lodash');var util=require(_0xc1ac('0x0'));var utils=require('./utils');var members={};var exclude=[_0xc1ac('0x1'),_0xc1ac('0x2')];function writeDB(_0x4d1eb5){utils[_0xc1ac('0x3')](util[_0xc1ac('0x4')](_0xc1ac('0x5'),_0x4d1eb5['uniqueid'],_0x4d1eb5[_0xc1ac('0x6')],_0x4d1eb5['channel'],_0x4d1eb5['data2'],_0x4d1eb5[_0xc1ac('0x7')],_0x4d1eb5['type']));if(_0x4d1eb5[_0xc1ac('0x6')]){utils[_0xc1ac('0x8')](_0x4d1eb5[_0xc1ac('0x6')])[_0xc1ac('0x9')](function(_0x336d32){if(_0x336d32){_0x4d1eb5['membername']=_0x336d32['name'];_0x4d1eb5[_0xc1ac('0xa')]=_0x336d32[_0xc1ac('0xa')];utils[_0xc1ac('0xb')]('CreateMemberReport',_0x4d1eb5);}else{utils[_0xc1ac('0xc')](_0x4d1eb5[_0xc1ac('0x6')][_0xc1ac('0xd')]('/')[0x1])[_0xc1ac('0x9')](function(_0x14167c){if(_0x14167c){_0x4d1eb5[_0xc1ac('0x7')]=_0x14167c[_0xc1ac('0xe')];_0x4d1eb5[_0xc1ac('0xa')]=_0x14167c[_0xc1ac('0xa')];utils[_0xc1ac('0xb')](_0xc1ac('0xf'),_0x4d1eb5);}});}})[_0xc1ac('0x10')](function(_0x501a08){utils[_0xc1ac('0x11')](util[_0xc1ac('0x4')](_0xc1ac('0x12'),_0x4d1eb5[_0xc1ac('0x13')]),_0x501a08);});}delete members[_0x4d1eb5['interface']];}function startsWith(_0x27f2c7,_0x138019){return _[_0xc1ac('0x14')](_0x27f2c7,function(_0x2b51c6){return _[_0xc1ac('0x15')](_0x138019,_0x2b51c6);});}exports['devicestatechange']=function(_0x34f75a){try{utils['debug'](util[_0xc1ac('0x4')](_0xc1ac('0x16'),members[_0x34f75a['device']]?members[_0x34f75a['device']][_0xc1ac('0x13')]:_0x34f75a['device']),_0x34f75a);utils[_0xc1ac('0x3')](util[_0xc1ac('0x4')](_0xc1ac('0x17'),members[_0x34f75a[_0xc1ac('0x18')]]?members[_0x34f75a[_0xc1ac('0x18')]]['uniqueid']:_0x34f75a[_0xc1ac('0x18')],_0x34f75a[_0xc1ac('0x19')],_0x34f75a[_0xc1ac('0x18')]));switch(_0x34f75a[_0xc1ac('0x19')]){case _0xc1ac('0x1a'):case _0xc1ac('0x1b'):if(!startsWith(exclude,_0x34f75a[_0xc1ac('0x18')])){members[_0x34f75a[_0xc1ac('0x18')]]={'channel':_0xc1ac('0x1c'),'interface':_0x34f75a[_0xc1ac('0x18')],'type':_0xc1ac('0x1d'),'enterAt':utils[_0xc1ac('0x1e')](),'role':'agent'};}break;case _0xc1ac('0x1f'):if(!_[_0xc1ac('0x20')](members[_0x34f75a['device']])){members[_0x34f75a['device']][_0xc1ac('0x21')]=utils[_0xc1ac('0x1e')]();members[_0x34f75a[_0xc1ac('0x18')]][_0xc1ac('0x22')]=utils['diffTime'](members[_0x34f75a[_0xc1ac('0x18')]][_0xc1ac('0x21')],members[_0x34f75a[_0xc1ac('0x18')]]['enterAt']);if(members[_0x34f75a[_0xc1ac('0x18')]][_0xc1ac('0x13')]){writeDB(members[_0x34f75a[_0xc1ac('0x18')]]);}}break;default:break;}}catch(_0x323568){utils[_0xc1ac('0x11')](util[_0xc1ac('0x4')](_0xc1ac('0x16'),members[_0x34f75a['device']]?members[_0x34f75a['device']][_0xc1ac('0x13')]:_0x34f75a[_0xc1ac('0x18')]),_0x323568);}};exports[_0xc1ac('0x23')]=function(_0x39e1ea){try{if(!_[_0xc1ac('0x20')](members[_0x39e1ea[_0xc1ac('0x6')]])){utils[_0xc1ac('0x24')](util[_0xc1ac('0x4')]('[%s][members][agentcomplete]',_0x39e1ea[_0xc1ac('0x13')]),_0x39e1ea);utils[_0xc1ac('0x3')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x39e1ea['uniqueid'],_0x39e1ea[_0xc1ac('0x6')],_0x39e1ea[_0xc1ac('0x25')]));members[_0x39e1ea[_0xc1ac('0x6')]]=_['assign'](members[_0x39e1ea['interface']],{'data4':_0x39e1ea['queue'],'uniqueid':_0x39e1ea[_0xc1ac('0x13')]});}}catch(_0x1e522f){utils['error'](util[_0xc1ac('0x4')]('[%s][members][agentcomplete]',_0x39e1ea[_0xc1ac('0x13')]),_0x1e522f);}};exports[_0xc1ac('0x26')]=function(_0x54302e){try{utils['debug'](util[_0xc1ac('0x4')](_0xc1ac('0x27'),_0x54302e[_0xc1ac('0x13')]),_0x54302e);if(_0x54302e[_0xc1ac('0x28')]){var _0x5ce7ea=_0x54302e['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x5ce7ea])){members[_0x5ce7ea]=_[_0xc1ac('0x29')](members[_0x5ce7ea],{'data1':members[_0x5ce7ea][_0xc1ac('0x2a')]||_0x54302e[_0xc1ac('0x2b')],'data2':members[_0x5ce7ea]['data2']||_0x54302e[_0xc1ac('0x2c')],'data3':members[_0x5ce7ea][_0xc1ac('0x2d')]||_0x54302e[_0xc1ac('0x2e')],'uniqueid':members[_0x5ce7ea][_0xc1ac('0x13')]||_0x54302e[_0xc1ac('0x13')]});utils['info'](util[_0xc1ac('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x54302e[_0xc1ac('0x13')],members[_0x5ce7ea][_0xc1ac('0x2a')],members[_0x5ce7ea][_0xc1ac('0x2f')],members[_0x5ce7ea]['data3']));if(members[_0x5ce7ea][_0xc1ac('0x21')]){writeDB(members[_0x5ce7ea]);}}}if(_0x54302e['destinationchannel']){var _0x110637=_0x54302e['destinationchannel']['split']('-')[0x0];if(!_[_0xc1ac('0x20')](members[_0x110637])){members[_0x110637]=_[_0xc1ac('0x29')](members[_0x110637],{'data1':members[_0x110637][_0xc1ac('0x2a')]||_0x54302e['type'],'data2':members[_0x110637][_0xc1ac('0x2f')]||_0x54302e[_0xc1ac('0x2c')],'data3':members[_0x110637][_0xc1ac('0x2d')]||_0x54302e[_0xc1ac('0x2e')],'uniqueid':members[_0x110637][_0xc1ac('0x13')]||_0x54302e[_0xc1ac('0x13')]});utils['info'](util[_0xc1ac('0x4')](_0xc1ac('0x30'),_0x54302e[_0xc1ac('0x13')],members[_0x110637][_0xc1ac('0x2a')],members[_0x110637][_0xc1ac('0x2f')],members[_0x110637][_0xc1ac('0x2d')]));if(members[_0x110637][_0xc1ac('0x21')]){writeDB(members[_0x110637]);}}}}catch(_0x9f9e19){utils[_0xc1ac('0x11')](util[_0xc1ac('0x4')]('[%s][members][cdr]',_0x54302e[_0xc1ac('0x13')]),_0x9f9e19);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4982da9..829eedf 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f11=['queuecallerexitreason','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','lastAssignedTo','membername','agentcomplete','reason','transfer','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','calleridnum','accountcode','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x2f11,0xb4));var _0x12f1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2f11[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x12f1('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x2b5942){utils['info'](util[_0x12f1('0x1')](_0x12f1('0x2'),_0x2b5942[_0x12f1('0x3')],_0x2b5942[_0x12f1('0x4')],_0x2b5942['queue'],_0x2b5942['lastAssignedTo'],_0x2b5942[_0x12f1('0x5')],_0x2b5942[_0x12f1('0x6')],_0x2b5942['queuecallerexitreason']));if(_0x2b5942[_0x12f1('0x7')]){utils[_0x12f1('0x8')](_0x2b5942[_0x12f1('0x7')])['then'](function(_0x1a1915){if(_0x1a1915){_0x2b5942[_0x12f1('0x9')]=_0x1a1915['type'];}utils[_0x12f1('0xa')](_0x12f1('0xb'),_0x2b5942);});}else{utils['request']('CreateVoiceQueueReport',_0x2b5942);}if(_0x2b5942[_0x12f1('0xc')]){delete queues[_0x2b5942[_0x12f1('0xc')]];}else{delete queues[_0x2b5942['uniqueid']];}}exports['queuecallerjoin']=function(_0x44a195){try{utils[_0x12f1('0xd')](util['format'](_0x12f1('0xe'),_0x44a195['uniqueid']),_0x44a195);utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x10'),_0x44a195[_0x12f1('0x3')],_0x44a195[_0x12f1('0x7')],_0x44a195[_0x12f1('0x11')]));queues[_0x44a195[_0x12f1('0x3')]]=_[_0x12f1('0x12')](_0x44a195,{'originalposition':_0x44a195[_0x12f1('0x11')],'queuecallerjoinAt':utils[_0x12f1('0x13')](),'mohtime':0x0});}catch(_0x1afe08){utils[_0x12f1('0x14')](util[_0x12f1('0x1')]('[%s][queues][queuecallerjoin]',_0x44a195[_0x12f1('0x3')]),_0x1afe08);}};exports[_0x12f1('0x15')]=function(_0x3f3257){try{if(!_[_0x12f1('0x16')](queues[_0x3f3257['uniqueid']])){utils[_0x12f1('0xd')](util[_0x12f1('0x1')](_0x12f1('0x17'),_0x3f3257['uniqueid']),_0x3f3257);if(queues[_0x3f3257[_0x12f1('0x3')]]['queuecallerleaveAt']){if(!queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0x18')]&&!queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0x19')]){queues[_0x3f3257['uniqueid']][_0x12f1('0x1a')]=!![];queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0x1b')]=utils['now']();queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0x1c')]=_0x12f1('0x1d');}utils[_0x12f1('0xf')](util[_0x12f1('0x1')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x3f3257['uniqueid'],queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0x1e')],queues[_0x3f3257['uniqueid']][_0x12f1('0x1c')]));writeDB(queues[_0x3f3257[_0x12f1('0x3')]]);}else if(queues[_0x3f3257['uniqueid']]['transfereduniqueid']){utils[_0x12f1('0xf')](util['format'](_0x12f1('0x1f'),_0x3f3257[_0x12f1('0x3')],queues[_0x3f3257[_0x12f1('0x3')]]['name'],queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0xc')]));queues[queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0xc')]]=queues[_0x3f3257['uniqueid']];queues[queues[_0x3f3257[_0x12f1('0x3')]][_0x12f1('0xc')]][_0x12f1('0x20')]=0x2;delete queues[_0x3f3257['uniqueid']];}}}catch(_0x33ce22){utils['error'](util[_0x12f1('0x1')](_0x12f1('0x17'),_0x3f3257[_0x12f1('0x3')]),_0x33ce22);}};exports[_0x12f1('0x21')]=function(_0x34331e){try{utils[_0x12f1('0xd')](util[_0x12f1('0x1')](_0x12f1('0x22'),_0x34331e['uniqueid']),_0x34331e);if(!_[_0x12f1('0x16')](_0x34331e[_0x12f1('0x23')][_0x12f1('0x24')])&&_0x34331e[_0x12f1('0x25')]['toUpperCase']()!==_0x12f1('0x26')){if(!_[_0x12f1('0x16')](queues[_0x34331e['uniqueid']])){queues[_0x34331e['uniqueid']][_0x12f1('0x18')]=![];queues[_0x34331e[_0x12f1('0x3')]]['queuecallerabandonAt']=null;queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x19')]=!![];queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x27')]=utils['now']();queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x1c')]=_0x34331e[_0x12f1('0x25')]['toUpperCase']();utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x28'),_0x34331e[_0x12f1('0x3')],queues[_0x34331e[_0x12f1('0x3')]]['name'],_0x34331e[_0x12f1('0x25')],queues[_0x34331e[_0x12f1('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x34331e[_0x12f1('0x3')]]);}}else if(!_[_0x12f1('0x16')](_0x34331e[_0x12f1('0x23')][_0x12f1('0x29')])){if(!_[_0x12f1('0x16')](queues[_0x34331e[_0x12f1('0x3')]])&&!queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x18')]){queues[_0x34331e['uniqueid']]['queuecallerabandon']=![];queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x2a')]=null;queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x19')]=!![];queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x27')]=utils['now']();queues[_0x34331e['uniqueid']]['queuecallerexitreason']=_0x12f1('0x2b');utils['info'](util[_0x12f1('0x1')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x34331e[_0x12f1('0x3')],queues[_0x34331e[_0x12f1('0x3')]][_0x12f1('0x1e')],_0x34331e['value'],queues[_0x34331e['uniqueid']][_0x12f1('0x1c')]));}}}catch(_0x5f3ebe){utils[_0x12f1('0x14')](util['format'](_0x12f1('0x22'),_0x34331e[_0x12f1('0x3')]),_0x5f3ebe);}};exports['queuecallerabandon']=function(_0x23ce01){try{if(!_[_0x12f1('0x16')](queues[_0x23ce01[_0x12f1('0x3')]])){utils[_0x12f1('0xd')](util['format'](_0x12f1('0x2c'),_0x23ce01['uniqueid']),_0x23ce01);queues[_0x23ce01[_0x12f1('0x3')]][_0x12f1('0x19')]=![];queues[_0x23ce01['uniqueid']]['queuecallerexitAt']=null;queues[_0x23ce01['uniqueid']][_0x12f1('0x18')]=!![];queues[_0x23ce01[_0x12f1('0x3')]][_0x12f1('0x2a')]=utils[_0x12f1('0x13')]();queues[_0x23ce01[_0x12f1('0x3')]][_0x12f1('0x1c')]='ABANDONED';utils['info'](util['format'](_0x12f1('0x2d'),_0x23ce01[_0x12f1('0x3')],queues[_0x23ce01['uniqueid']]['name'],queues[_0x23ce01[_0x12f1('0x3')]][_0x12f1('0x1c')]));}}catch(_0xec52d9){utils[_0x12f1('0x14')](util['format'](_0x12f1('0x2c'),_0x23ce01[_0x12f1('0x3')]),_0xec52d9);}};exports['queuecallerleave']=function(_0xd973e9){try{if(!_[_0x12f1('0x16')](queues[_0xd973e9['uniqueid']])){utils[_0x12f1('0xd')](util['format'](_0x12f1('0x2e'),_0xd973e9[_0x12f1('0x3')]),_0xd973e9);utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x2f'),_0xd973e9[_0x12f1('0x3')],queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x1e')],_0xd973e9[_0x12f1('0x30')],_0xd973e9[_0x12f1('0x31')]));queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x32')]=!![];queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x33')]=utils[_0x12f1('0x13')]();queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x34')]=utils[_0x12f1('0x35')](queues[_0xd973e9['uniqueid']]['queuecallerleaveAt'],queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x36')]);queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x11')]=_0xd973e9[_0x12f1('0x11')];queues[_0xd973e9[_0x12f1('0x3')]]['count']=_0xd973e9[_0x12f1('0x37')];queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x30')]=_0xd973e9[_0x12f1('0x30')];queues[_0xd973e9[_0x12f1('0x3')]][_0x12f1('0x31')]=_0xd973e9[_0x12f1('0x31')];}}catch(_0x4401f6){utils[_0x12f1('0x14')](util['format'](_0x12f1('0x2e'),_0xd973e9[_0x12f1('0x3')]),_0x4401f6);}};exports[_0x12f1('0x38')]=function(_0x50f1b4){try{if(!_[_0x12f1('0x16')](queues[_0x50f1b4[_0x12f1('0x3')]])){utils[_0x12f1('0xd')](util[_0x12f1('0x1')](_0x12f1('0x39'),_0x50f1b4[_0x12f1('0x3')]),_0x50f1b4);utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x3a'),_0x50f1b4[_0x12f1('0x3')],queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x1e')],_0x50f1b4['membername'],_0x50f1b4[_0x12f1('0x3b')]));queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x18')]=![];queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x18')]=![];queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x2a')]=null;queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x19')]=![];queues[_0x50f1b4['uniqueid']][_0x12f1('0x1c')]=null;queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x27')]=null;queues[_0x50f1b4[_0x12f1('0x3')]]['assigned']=!![];queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x6')]=_0x50f1b4['destaccountcode'];queues[_0x50f1b4[_0x12f1('0x3')]][_0x12f1('0x3c')]=_0x50f1b4[_0x12f1('0x3d')];}}catch(_0x5e30cd){utils[_0x12f1('0x14')](util[_0x12f1('0x1')](_0x12f1('0x39'),_0x50f1b4[_0x12f1('0x3')]),_0x5e30cd);}};exports[_0x12f1('0x3e')]=function(_0x2bb0ea){try{if(!_[_0x12f1('0x16')](queues[_0x2bb0ea[_0x12f1('0x3')]])){if(queues[_0x2bb0ea['uniqueid']]['queuecallerleaveAt']){utils[_0x12f1('0xd')](util['format']('[%s][queues][agentcomplete]',_0x2bb0ea['uniqueid']),_0x2bb0ea);queues[_0x2bb0ea[_0x12f1('0x3')]][_0x12f1('0x18')]=![];queues[_0x2bb0ea[_0x12f1('0x3')]]['queuecallerabandon']=![];queues[_0x2bb0ea['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2bb0ea['uniqueid']]['queuecallerexit']=![];queues[_0x2bb0ea['uniqueid']][_0x12f1('0x27')]=null;queues[_0x2bb0ea[_0x12f1('0x3')]]['assigned']=!![];queues[_0x2bb0ea[_0x12f1('0x3')]]['lastAssignedTo']=_0x2bb0ea[_0x12f1('0x3d')];queues[_0x2bb0ea['uniqueid']][_0x12f1('0x1a')]=!![];queues[_0x2bb0ea[_0x12f1('0x3')]][_0x12f1('0x1b')]=utils['now']();if(_0x2bb0ea[_0x12f1('0x3f')]==_0x12f1('0x40')){if(!queues[_0x2bb0ea['uniqueid']][_0x12f1('0x40')]){queues[_0x2bb0ea[_0x12f1('0x3')]][_0x12f1('0x1c')]='TRANSFER';}}else{queues[_0x2bb0ea[_0x12f1('0x3')]][_0x12f1('0x1c')]=_0x12f1('0x41')+_0x2bb0ea[_0x12f1('0x3f')][_0x12f1('0x42')]();}utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x43'),_0x2bb0ea[_0x12f1('0x3')],queues[_0x2bb0ea[_0x12f1('0x3')]]['name'],_0x2bb0ea['membername'],queues[_0x2bb0ea['uniqueid']][_0x12f1('0x1c')]));writeDB(queues[_0x2bb0ea[_0x12f1('0x3')]]);}}}catch(_0x31ef84){utils['error'](util[_0x12f1('0x1')](_0x12f1('0x44'),_0x2bb0ea[_0x12f1('0x3')]),_0x31ef84);}};exports['blindtransfer']=function(_0x311e3c){try{if(!_[_0x12f1('0x16')](queues[_0x311e3c['transfereeuniqueid']])){utils[_0x12f1('0xd')](util['format']('[%s][queues][blindtransfer]',_0x311e3c[_0x12f1('0x3')]),_0x311e3c);queues[_0x311e3c[_0x12f1('0x45')]][_0x12f1('0x40')]=!![];queues[_0x311e3c['transfereeuniqueid']][_0x12f1('0x46')]='BLIND';queues[_0x311e3c[_0x12f1('0x45')]][_0x12f1('0x47')]=_0x311e3c[_0x12f1('0x48')];queues[_0x311e3c[_0x12f1('0x45')]]['transferuniqueid']=_0x311e3c[_0x12f1('0x45')];queues[_0x311e3c['transfereeuniqueid']][_0x12f1('0x1c')]=_0x12f1('0x49');utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x4a'),_0x311e3c[_0x12f1('0x3')],queues[_0x311e3c[_0x12f1('0x45')]][_0x12f1('0x1e')],_0x311e3c[_0x12f1('0x45')],_0x311e3c[_0x12f1('0x48')]));}}catch(_0x447c67){utils[_0x12f1('0x14')](util[_0x12f1('0x1')](_0x12f1('0x4b'),_0x311e3c[_0x12f1('0x3')]),_0x447c67);}};exports[_0x12f1('0x4c')]=function(_0x115bfd){try{utils[_0x12f1('0xd')](util['format']('[%s][queues][attendedtransfer]',_0x115bfd[_0x12f1('0x4d')]),_0x115bfd);if(_0x115bfd[_0x12f1('0x4d')]==_0x115bfd[_0x12f1('0x4e')]){if(!_[_0x12f1('0x16')](queues[_0x115bfd[_0x12f1('0x4f')]])){utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x50'),_0x115bfd[_0x12f1('0x4d')],queues[_0x115bfd['secondtransfererlinkedid']][_0x12f1('0x1e')],_0x115bfd[_0x12f1('0x51')]));queues[_0x115bfd[_0x12f1('0x4f')]][_0x12f1('0x40')]=!![];queues[_0x115bfd[_0x12f1('0x4f')]]['transfertype']=_0x12f1('0x52');queues[_0x115bfd[_0x12f1('0x4f')]][_0x12f1('0x47')]=_0x115bfd[_0x12f1('0x51')];queues[_0x115bfd[_0x12f1('0x4f')]][_0x12f1('0x53')]=_0x115bfd[_0x12f1('0x4d')];queues[_0x115bfd[_0x12f1('0x4f')]]['queuecallerexitreason']=_0x12f1('0x54');}if(!_['isNil'](queues[_0x115bfd[_0x12f1('0x4e')]])){if(_0x115bfd[_0x12f1('0x55')]&&queues[_0x115bfd[_0x12f1('0x55')]]){queues[_0x115bfd[_0x12f1('0x55')]][_0x12f1('0x20')]=0x1;queues[_0x115bfd[_0x12f1('0x45')]]=_[_0x12f1('0x56')](queues[_0x115bfd[_0x12f1('0x55')]]);queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0xc')]=_0x115bfd[_0x12f1('0x57')];queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x20')]=0x2;queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x5')]=queues[_0x115bfd[_0x12f1('0x4f')]][_0x12f1('0x5')];queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x58')]=queues[_0x115bfd[_0x12f1('0x4f')]][_0x12f1('0x58')];queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x36')]=utils[_0x12f1('0x13')]();queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x33')]=utils[_0x12f1('0x13')]();queues[_0x115bfd[_0x12f1('0x45')]]['holdtime']=0x0;queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x59')]=0x0;utils['info'](util['format'](_0x12f1('0x5a'),_0x115bfd['origtransfereruniqueid'],queues[_0x115bfd['transfereeuniqueid']][_0x12f1('0x1e')],queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x5')],queues[_0x115bfd[_0x12f1('0x45')]][_0x12f1('0x58')]));}else{utils['info'](util[_0x12f1('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x115bfd['origtransfereruniqueid'],queues[_0x115bfd[_0x12f1('0x4e')]]['name'],_0x115bfd[_0x12f1('0x4f')]));queues[_0x115bfd['origtransfererlinkedid']][_0x12f1('0xc')]=_0x115bfd[_0x12f1('0x4f')];}}}else if(_0x115bfd[_0x12f1('0x5b')]==_0x115bfd[_0x12f1('0x4f')]){if(!_[_0x12f1('0x16')](queues[_0x115bfd[_0x12f1('0x4e')]])){utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x5c'),_0x115bfd[_0x12f1('0x4d')],queues[_0x115bfd[_0x12f1('0x4e')]]['name'],_0x115bfd['secondtransfereruniqueid'],_0x115bfd[_0x12f1('0x5d')]));queues[_0x115bfd[_0x12f1('0x4e')]]['transfer']=!![];queues[_0x115bfd[_0x12f1('0x4e')]][_0x12f1('0x46')]=_0x12f1('0x52');queues[_0x115bfd[_0x12f1('0x4e')]][_0x12f1('0x47')]=_0x115bfd['secondtransfererexten'];queues[_0x115bfd[_0x12f1('0x4e')]][_0x12f1('0x53')]=_0x115bfd[_0x12f1('0x5b')];queues[_0x115bfd[_0x12f1('0x4e')]][_0x12f1('0x1c')]=_0x12f1('0x54');}if(!_[_0x12f1('0x16')](queues[_0x115bfd['secondtransfererlinkedid']])){if(_0x115bfd[_0x12f1('0x5e')]&&queues[_0x115bfd[_0x12f1('0x5e')]]){queues[_0x115bfd[_0x12f1('0x5e')]][_0x12f1('0x20')]=0x1;queues[_0x115bfd[_0x12f1('0x57')]]=_['clone'](queues[_0x115bfd['transfertargetlinkedid']]);queues[_0x115bfd[_0x12f1('0x57')]][_0x12f1('0xc')]=_0x115bfd['transfertargetuniqueid'];queues[_0x115bfd[_0x12f1('0x57')]]['queuecallerenterreason']=0x2;queues[_0x115bfd[_0x12f1('0x57')]][_0x12f1('0x5')]=queues[_0x115bfd[_0x12f1('0x4e')]][_0x12f1('0x5')];queues[_0x115bfd[_0x12f1('0x57')]][_0x12f1('0x58')]=queues[_0x115bfd[_0x12f1('0x4e')]]['calleridname'];queues[_0x115bfd['transfertargetuniqueid']][_0x12f1('0x36')]=utils[_0x12f1('0x13')]();queues[_0x115bfd['transfertargetuniqueid']][_0x12f1('0x33')]=utils['now']();queues[_0x115bfd[_0x12f1('0x57')]][_0x12f1('0x34')]=0x0;queues[_0x115bfd['transfertargetuniqueid']][_0x12f1('0x59')]=0x0;utils[_0x12f1('0xf')](util['format'](_0x12f1('0x5f'),_0x115bfd[_0x12f1('0x4d')],queues[_0x115bfd['transfertargetuniqueid']][_0x12f1('0x1e')],queues[_0x115bfd[_0x12f1('0x57')]][_0x12f1('0xc')],queues[_0x115bfd[_0x12f1('0x57')]][_0x12f1('0x5')],queues[_0x115bfd[_0x12f1('0x57')]][_0x12f1('0x58')]));}else{utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x60'),_0x115bfd[_0x12f1('0x4d')],queues[_0x115bfd[_0x12f1('0x4f')]][_0x12f1('0x1e')],_0x115bfd[_0x12f1('0x4e')]));queues[_0x115bfd[_0x12f1('0x4f')]][_0x12f1('0xc')]=_0x115bfd[_0x12f1('0x4e')];}}}}catch(_0x2e26c5){utils[_0x12f1('0x14')](util[_0x12f1('0x1')](_0x12f1('0x61'),_0x115bfd[_0x12f1('0x4d')]),_0x2e26c5);}};exports['musiconholdstart']=function(_0x595ce3){try{if(!_[_0x12f1('0x16')](queues[_0x595ce3[_0x12f1('0x3')]])){utils['debug'](util[_0x12f1('0x1')](_0x12f1('0x62'),_0x595ce3[_0x12f1('0x3')]),_0x595ce3);queues[_0x595ce3[_0x12f1('0x3')]][_0x12f1('0x63')]=utils[_0x12f1('0x13')]();utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x64'),_0x595ce3[_0x12f1('0x3')],queues[_0x595ce3[_0x12f1('0x3')]][_0x12f1('0x1e')],queues[_0x595ce3['uniqueid']][_0x12f1('0x63')]));}}catch(_0x4cdacc){utils[_0x12f1('0x14')](util[_0x12f1('0x1')](_0x12f1('0x62'),_0x595ce3[_0x12f1('0x3')]),_0x4cdacc);}};exports[_0x12f1('0x65')]=function(_0x259d87){try{if(!_[_0x12f1('0x16')](queues[_0x259d87[_0x12f1('0x3')]])){if(!_[_0x12f1('0x16')](queues[_0x259d87[_0x12f1('0x3')]][_0x12f1('0x63')])){utils[_0x12f1('0xd')](util[_0x12f1('0x1')](_0x12f1('0x66'),_0x259d87[_0x12f1('0x3')]),_0x259d87);queues[_0x259d87[_0x12f1('0x3')]]['mohtime']+=utils[_0x12f1('0x35')](utils['now'](),queues[_0x259d87[_0x12f1('0x3')]][_0x12f1('0x63')]);utils[_0x12f1('0xf')](util[_0x12f1('0x1')](_0x12f1('0x67'),_0x259d87[_0x12f1('0x3')],queues[_0x259d87[_0x12f1('0x3')]][_0x12f1('0x1e')],queues[_0x259d87[_0x12f1('0x3')]][_0x12f1('0x59')]));delete queues[_0x259d87['uniqueid']][_0x12f1('0x63')];}}}catch(_0x5b6ae3){utils[_0x12f1('0x14')](util[_0x12f1('0x1')](_0x12f1('0x66'),_0x259d87[_0x12f1('0x3')]),_0x5b6ae3);}}; \ No newline at end of file +var _0xa8e3=['queuecallerjoinAt','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename'];(function(_0x1191ef,_0x4684e7){var _0x4535c5=function(_0xb1085a){while(--_0xb1085a){_0x1191ef['push'](_0x1191ef['shift']());}};_0x4535c5(++_0x4684e7);}(_0xa8e3,0x99));var _0x3a8e=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0xa8e3[_0x3fe393];return _0x534d14;};'use strict';var _=require(_0x3a8e('0x0'));var util=require(_0x3a8e('0x1'));var utils=require(_0x3a8e('0x2'));var queues={};function writeDB(_0x5a9d3c){utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')](_0x3a8e('0x5'),_0x5a9d3c[_0x3a8e('0x6')],_0x5a9d3c[_0x3a8e('0x7')],_0x5a9d3c[_0x3a8e('0x8')],_0x5a9d3c[_0x3a8e('0x9')],_0x5a9d3c['calleridnum'],_0x5a9d3c[_0x3a8e('0xa')],_0x5a9d3c['queuecallerexitreason']));if(_0x5a9d3c[_0x3a8e('0x8')]){utils[_0x3a8e('0xb')](_0x5a9d3c['queue'])['then'](function(_0x2eef33){if(_0x2eef33){_0x5a9d3c[_0x3a8e('0xc')]=_0x2eef33[_0x3a8e('0xc')];}utils[_0x3a8e('0xd')]('CreateVoiceQueueReport',_0x5a9d3c);});}else{utils[_0x3a8e('0xd')](_0x3a8e('0xe'),_0x5a9d3c);}if(_0x5a9d3c[_0x3a8e('0xf')]){delete queues[_0x5a9d3c['transfereduniqueid']];}else{delete queues[_0x5a9d3c[_0x3a8e('0x6')]];}}exports['queuecallerjoin']=function(_0x1c91da){try{utils[_0x3a8e('0x10')](util[_0x3a8e('0x4')]('[%s][queues][queuecallerjoin]',_0x1c91da['uniqueid']),_0x1c91da);utils['info'](util[_0x3a8e('0x4')](_0x3a8e('0x11'),_0x1c91da['uniqueid'],_0x1c91da['queue'],_0x1c91da['position']));queues[_0x1c91da[_0x3a8e('0x6')]]=_['assign'](_0x1c91da,{'originalposition':_0x1c91da[_0x3a8e('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xb96d14){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')](_0x3a8e('0x14'),_0x1c91da[_0x3a8e('0x6')]),_0xb96d14);}};exports[_0x3a8e('0x15')]=function(_0x4b0583){try{if(!_[_0x3a8e('0x16')](queues[_0x4b0583[_0x3a8e('0x6')]])){utils['debug'](util[_0x3a8e('0x4')](_0x3a8e('0x17'),_0x4b0583[_0x3a8e('0x6')]),_0x4b0583);if(queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0x18')]){if(!queues[_0x4b0583['uniqueid']][_0x3a8e('0x19')]&&!queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0x1a')]){queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0x1b')]=!![];queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0x1c')]=utils['now']();queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0x1d')]=_0x3a8e('0x1e');}utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')](_0x3a8e('0x1f'),_0x4b0583[_0x3a8e('0x6')],queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0x20')],queues[_0x4b0583['uniqueid']][_0x3a8e('0x1d')]));writeDB(queues[_0x4b0583[_0x3a8e('0x6')]]);}else if(queues[_0x4b0583['uniqueid']][_0x3a8e('0xf')]){utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')](_0x3a8e('0x21'),_0x4b0583['uniqueid'],queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0x20')],queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0xf')]));queues[queues[_0x4b0583[_0x3a8e('0x6')]][_0x3a8e('0xf')]]=queues[_0x4b0583['uniqueid']];queues[queues[_0x4b0583[_0x3a8e('0x6')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x4b0583[_0x3a8e('0x6')]];}}}catch(_0x209f5f){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')]('[%s][queues][hangup]',_0x4b0583[_0x3a8e('0x6')]),_0x209f5f);}};exports[_0x3a8e('0x22')]=function(_0x44b7c5){try{utils['debug'](util[_0x3a8e('0x4')](_0x3a8e('0x23'),_0x44b7c5[_0x3a8e('0x6')]),_0x44b7c5);if(!_[_0x3a8e('0x16')](_0x44b7c5['variable'][_0x3a8e('0x24')])&&_0x44b7c5[_0x3a8e('0x25')][_0x3a8e('0x26')]()!==_0x3a8e('0x27')){if(!_['isNil'](queues[_0x44b7c5[_0x3a8e('0x6')]])){queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x19')]=![];queues[_0x44b7c5[_0x3a8e('0x6')]]['queuecallerabandonAt']=null;queues[_0x44b7c5['uniqueid']][_0x3a8e('0x1a')]=!![];queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x28')]=utils[_0x3a8e('0x29')]();queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x1d')]=_0x44b7c5[_0x3a8e('0x25')][_0x3a8e('0x26')]();utils['info'](util[_0x3a8e('0x4')](_0x3a8e('0x2a'),_0x44b7c5[_0x3a8e('0x6')],queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x20')],_0x44b7c5[_0x3a8e('0x25')],queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x1d')]));writeDB(queues[_0x44b7c5[_0x3a8e('0x6')]]);}}else if(!_[_0x3a8e('0x16')](_0x44b7c5['variable'][_0x3a8e('0x2b')])){if(!_[_0x3a8e('0x16')](queues[_0x44b7c5['uniqueid']])&&!queues[_0x44b7c5[_0x3a8e('0x6')]]['queuecallerabandon']){queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x19')]=![];queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x2c')]=null;queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x1a')]=!![];queues[_0x44b7c5[_0x3a8e('0x6')]][_0x3a8e('0x28')]=utils[_0x3a8e('0x29')]();queues[_0x44b7c5[_0x3a8e('0x6')]]['queuecallerexitreason']=_0x3a8e('0x2d');utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')](_0x3a8e('0x2e'),_0x44b7c5['uniqueid'],queues[_0x44b7c5['uniqueid']][_0x3a8e('0x20')],_0x44b7c5['value'],queues[_0x44b7c5['uniqueid']][_0x3a8e('0x1d')]));}}}catch(_0x4a4c00){utils['error'](util[_0x3a8e('0x4')]('[%s][queues][varset]',_0x44b7c5[_0x3a8e('0x6')]),_0x4a4c00);}};exports[_0x3a8e('0x19')]=function(_0x2ae226){try{if(!_['isNil'](queues[_0x2ae226['uniqueid']])){utils[_0x3a8e('0x10')](util[_0x3a8e('0x4')](_0x3a8e('0x2f'),_0x2ae226[_0x3a8e('0x6')]),_0x2ae226);queues[_0x2ae226[_0x3a8e('0x6')]][_0x3a8e('0x1a')]=![];queues[_0x2ae226['uniqueid']]['queuecallerexitAt']=null;queues[_0x2ae226[_0x3a8e('0x6')]]['queuecallerabandon']=!![];queues[_0x2ae226[_0x3a8e('0x6')]][_0x3a8e('0x2c')]=utils['now']();queues[_0x2ae226[_0x3a8e('0x6')]][_0x3a8e('0x1d')]='ABANDONED';utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')](_0x3a8e('0x30'),_0x2ae226[_0x3a8e('0x6')],queues[_0x2ae226[_0x3a8e('0x6')]][_0x3a8e('0x20')],queues[_0x2ae226['uniqueid']]['queuecallerexitreason']));}}catch(_0x3bfbe1){utils['error'](util[_0x3a8e('0x4')](_0x3a8e('0x2f'),_0x2ae226[_0x3a8e('0x6')]),_0x3bfbe1);}};exports['queuecallerleave']=function(_0xc71e2d){try{if(!_[_0x3a8e('0x16')](queues[_0xc71e2d[_0x3a8e('0x6')]])){utils['debug'](util['format'](_0x3a8e('0x31'),_0xc71e2d[_0x3a8e('0x6')]),_0xc71e2d);utils['info'](util[_0x3a8e('0x4')](_0x3a8e('0x32'),_0xc71e2d[_0x3a8e('0x6')],queues[_0xc71e2d[_0x3a8e('0x6')]][_0x3a8e('0x20')],_0xc71e2d[_0x3a8e('0x33')],_0xc71e2d[_0x3a8e('0x34')]));queues[_0xc71e2d['uniqueid']]['queuecallerleave']=!![];queues[_0xc71e2d['uniqueid']][_0x3a8e('0x18')]=utils[_0x3a8e('0x29')]();queues[_0xc71e2d[_0x3a8e('0x6')]]['holdtime']=utils['diffTime'](queues[_0xc71e2d['uniqueid']][_0x3a8e('0x18')],queues[_0xc71e2d[_0x3a8e('0x6')]][_0x3a8e('0x35')]);queues[_0xc71e2d[_0x3a8e('0x6')]][_0x3a8e('0x12')]=_0xc71e2d[_0x3a8e('0x12')];queues[_0xc71e2d[_0x3a8e('0x6')]]['count']=_0xc71e2d['count'];queues[_0xc71e2d['uniqueid']][_0x3a8e('0x33')]=_0xc71e2d[_0x3a8e('0x33')];queues[_0xc71e2d['uniqueid']][_0x3a8e('0x34')]=_0xc71e2d[_0x3a8e('0x34')];}}catch(_0x412942){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')](_0x3a8e('0x31'),_0xc71e2d[_0x3a8e('0x6')]),_0x412942);}};exports['agentconnect']=function(_0x106aaa){try{if(!_[_0x3a8e('0x16')](queues[_0x106aaa[_0x3a8e('0x6')]])){utils[_0x3a8e('0x10')](util[_0x3a8e('0x4')](_0x3a8e('0x36'),_0x106aaa[_0x3a8e('0x6')]),_0x106aaa);utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x106aaa['uniqueid'],queues[_0x106aaa[_0x3a8e('0x6')]][_0x3a8e('0x20')],_0x106aaa[_0x3a8e('0x37')],_0x106aaa[_0x3a8e('0x38')]));queues[_0x106aaa['uniqueid']][_0x3a8e('0x19')]=![];queues[_0x106aaa[_0x3a8e('0x6')]]['queuecallerabandon']=![];queues[_0x106aaa[_0x3a8e('0x6')]][_0x3a8e('0x2c')]=null;queues[_0x106aaa[_0x3a8e('0x6')]]['queuecallerexit']=![];queues[_0x106aaa['uniqueid']][_0x3a8e('0x1d')]=null;queues[_0x106aaa[_0x3a8e('0x6')]][_0x3a8e('0x28')]=null;queues[_0x106aaa[_0x3a8e('0x6')]][_0x3a8e('0x39')]=!![];queues[_0x106aaa[_0x3a8e('0x6')]][_0x3a8e('0xa')]=_0x106aaa[_0x3a8e('0x38')];queues[_0x106aaa['uniqueid']][_0x3a8e('0x9')]=_0x106aaa[_0x3a8e('0x37')];}}catch(_0x246627){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')](_0x3a8e('0x36'),_0x106aaa[_0x3a8e('0x6')]),_0x246627);}};exports[_0x3a8e('0x3a')]=function(_0x24143e){try{if(!_[_0x3a8e('0x16')](queues[_0x24143e[_0x3a8e('0x6')]])){if(queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x18')]){utils[_0x3a8e('0x10')](util[_0x3a8e('0x4')](_0x3a8e('0x3b'),_0x24143e[_0x3a8e('0x6')]),_0x24143e);queues[_0x24143e[_0x3a8e('0x6')]]['queuecallerabandon']=![];queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x19')]=![];queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x2c')]=null;queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x1a')]=![];queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x28')]=null;queues[_0x24143e[_0x3a8e('0x6')]]['assigned']=!![];queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x9')]=_0x24143e[_0x3a8e('0x37')];queues[_0x24143e['uniqueid']]['queuecallercomplete']=!![];queues[_0x24143e[_0x3a8e('0x6')]]['queuecallercompleteAt']=utils['now']();if(_0x24143e[_0x3a8e('0x3c')]==_0x3a8e('0x3d')){if(!queues[_0x24143e['uniqueid']][_0x3a8e('0x3d')]){queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x1d')]=_0x3a8e('0x3e');}}else{queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x1d')]=_0x3a8e('0x3f')+_0x24143e[_0x3a8e('0x3c')][_0x3a8e('0x26')]();}utils['info'](util[_0x3a8e('0x4')](_0x3a8e('0x40'),_0x24143e['uniqueid'],queues[_0x24143e[_0x3a8e('0x6')]][_0x3a8e('0x20')],_0x24143e['membername'],queues[_0x24143e[_0x3a8e('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x24143e['uniqueid']]);}}}catch(_0x119631){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')](_0x3a8e('0x3b'),_0x24143e[_0x3a8e('0x6')]),_0x119631);}};exports['blindtransfer']=function(_0x3b7aa2){try{if(!_['isNil'](queues[_0x3b7aa2[_0x3a8e('0x41')]])){utils[_0x3a8e('0x10')](util[_0x3a8e('0x4')]('[%s][queues][blindtransfer]',_0x3b7aa2[_0x3a8e('0x6')]),_0x3b7aa2);queues[_0x3b7aa2[_0x3a8e('0x41')]][_0x3a8e('0x3d')]=!![];queues[_0x3b7aa2[_0x3a8e('0x41')]][_0x3a8e('0x42')]=_0x3a8e('0x43');queues[_0x3b7aa2[_0x3a8e('0x41')]][_0x3a8e('0x44')]=_0x3b7aa2[_0x3a8e('0x45')];queues[_0x3b7aa2['transfereeuniqueid']][_0x3a8e('0x46')]=_0x3b7aa2[_0x3a8e('0x41')];queues[_0x3b7aa2[_0x3a8e('0x41')]]['queuecallerexitreason']=_0x3a8e('0x47');utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3b7aa2[_0x3a8e('0x6')],queues[_0x3b7aa2[_0x3a8e('0x41')]][_0x3a8e('0x20')],_0x3b7aa2['transfereeuniqueid'],_0x3b7aa2['extension']));}}catch(_0x295c9c){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')](_0x3a8e('0x48'),_0x3b7aa2[_0x3a8e('0x6')]),_0x295c9c);}};exports[_0x3a8e('0x49')]=function(_0x1e13d4){try{utils[_0x3a8e('0x10')](util[_0x3a8e('0x4')](_0x3a8e('0x4a'),_0x1e13d4['origtransfereruniqueid']),_0x1e13d4);if(_0x1e13d4[_0x3a8e('0x4b')]==_0x1e13d4[_0x3a8e('0x4c')]){if(!_['isNil'](queues[_0x1e13d4[_0x3a8e('0x4d')]])){utils[_0x3a8e('0x3')](util['format'](_0x3a8e('0x4e'),_0x1e13d4[_0x3a8e('0x4b')],queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0x20')],_0x1e13d4[_0x3a8e('0x4f')]));queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0x3d')]=!![];queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0x42')]='ATTENDED';queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0x44')]=_0x1e13d4[_0x3a8e('0x4f')];queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0x46')]=_0x1e13d4[_0x3a8e('0x4b')];queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0x1d')]=_0x3a8e('0x50');}if(!_['isNil'](queues[_0x1e13d4[_0x3a8e('0x4c')]])){if(_0x1e13d4[_0x3a8e('0x51')]&&queues[_0x1e13d4[_0x3a8e('0x51')]]){queues[_0x1e13d4['transfereelinkedid']][_0x3a8e('0x52')]=0x1;queues[_0x1e13d4['transfereeuniqueid']]=_[_0x3a8e('0x53')](queues[_0x1e13d4[_0x3a8e('0x51')]]);queues[_0x1e13d4[_0x3a8e('0x41')]][_0x3a8e('0xf')]=_0x1e13d4['transfertargetuniqueid'];queues[_0x1e13d4['transfereeuniqueid']][_0x3a8e('0x52')]=0x2;queues[_0x1e13d4['transfereeuniqueid']][_0x3a8e('0x54')]=queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0x54')];queues[_0x1e13d4[_0x3a8e('0x41')]][_0x3a8e('0x55')]=queues[_0x1e13d4[_0x3a8e('0x4d')]]['calleridname'];queues[_0x1e13d4['transfereeuniqueid']][_0x3a8e('0x35')]=utils['now']();queues[_0x1e13d4[_0x3a8e('0x41')]][_0x3a8e('0x18')]=utils[_0x3a8e('0x29')]();queues[_0x1e13d4['transfereeuniqueid']][_0x3a8e('0x56')]=0x0;queues[_0x1e13d4[_0x3a8e('0x41')]][_0x3a8e('0x57')]=0x0;utils['info'](util[_0x3a8e('0x4')](_0x3a8e('0x58'),_0x1e13d4['origtransfereruniqueid'],queues[_0x1e13d4[_0x3a8e('0x41')]][_0x3a8e('0x20')],queues[_0x1e13d4[_0x3a8e('0x41')]][_0x3a8e('0x54')],queues[_0x1e13d4[_0x3a8e('0x41')]][_0x3a8e('0x55')]));}else{utils['info'](util[_0x3a8e('0x4')](_0x3a8e('0x59'),_0x1e13d4['origtransfereruniqueid'],queues[_0x1e13d4[_0x3a8e('0x4c')]][_0x3a8e('0x20')],_0x1e13d4[_0x3a8e('0x4d')]));queues[_0x1e13d4['origtransfererlinkedid']][_0x3a8e('0xf')]=_0x1e13d4[_0x3a8e('0x4d')];}}}else if(_0x1e13d4[_0x3a8e('0x5a')]==_0x1e13d4[_0x3a8e('0x4d')]){if(!_[_0x3a8e('0x16')](queues[_0x1e13d4['origtransfererlinkedid']])){utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1e13d4[_0x3a8e('0x4b')],queues[_0x1e13d4[_0x3a8e('0x4c')]]['name'],_0x1e13d4[_0x3a8e('0x5a')],_0x1e13d4[_0x3a8e('0x5b')]));queues[_0x1e13d4['origtransfererlinkedid']][_0x3a8e('0x3d')]=!![];queues[_0x1e13d4[_0x3a8e('0x4c')]][_0x3a8e('0x42')]=_0x3a8e('0x5c');queues[_0x1e13d4['origtransfererlinkedid']]['transferexten']=_0x1e13d4[_0x3a8e('0x5b')];queues[_0x1e13d4[_0x3a8e('0x4c')]][_0x3a8e('0x46')]=_0x1e13d4[_0x3a8e('0x5a')];queues[_0x1e13d4[_0x3a8e('0x4c')]][_0x3a8e('0x1d')]=_0x3a8e('0x50');}if(!_[_0x3a8e('0x16')](queues[_0x1e13d4['secondtransfererlinkedid']])){if(_0x1e13d4['transfertargetlinkedid']&&queues[_0x1e13d4['transfertargetlinkedid']]){queues[_0x1e13d4[_0x3a8e('0x5d')]][_0x3a8e('0x52')]=0x1;queues[_0x1e13d4[_0x3a8e('0x5e')]]=_[_0x3a8e('0x53')](queues[_0x1e13d4['transfertargetlinkedid']]);queues[_0x1e13d4[_0x3a8e('0x5e')]]['transfereduniqueid']=_0x1e13d4[_0x3a8e('0x5e')];queues[_0x1e13d4[_0x3a8e('0x5e')]][_0x3a8e('0x52')]=0x2;queues[_0x1e13d4['transfertargetuniqueid']]['calleridnum']=queues[_0x1e13d4[_0x3a8e('0x4c')]][_0x3a8e('0x54')];queues[_0x1e13d4[_0x3a8e('0x5e')]][_0x3a8e('0x55')]=queues[_0x1e13d4[_0x3a8e('0x4c')]][_0x3a8e('0x55')];queues[_0x1e13d4[_0x3a8e('0x5e')]][_0x3a8e('0x35')]=utils[_0x3a8e('0x29')]();queues[_0x1e13d4[_0x3a8e('0x5e')]]['queuecallerleaveAt']=utils[_0x3a8e('0x29')]();queues[_0x1e13d4[_0x3a8e('0x5e')]][_0x3a8e('0x56')]=0x0;queues[_0x1e13d4[_0x3a8e('0x5e')]][_0x3a8e('0x57')]=0x0;utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')](_0x3a8e('0x5f'),_0x1e13d4['origtransfereruniqueid'],queues[_0x1e13d4[_0x3a8e('0x5e')]]['name'],queues[_0x1e13d4[_0x3a8e('0x5e')]][_0x3a8e('0xf')],queues[_0x1e13d4['transfertargetuniqueid']][_0x3a8e('0x54')],queues[_0x1e13d4[_0x3a8e('0x5e')]][_0x3a8e('0x55')]));}else{utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')](_0x3a8e('0x59'),_0x1e13d4['origtransfereruniqueid'],queues[_0x1e13d4[_0x3a8e('0x4d')]]['name'],_0x1e13d4['origtransfererlinkedid']));queues[_0x1e13d4[_0x3a8e('0x4d')]][_0x3a8e('0xf')]=_0x1e13d4[_0x3a8e('0x4c')];}}}}catch(_0x31b620){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')](_0x3a8e('0x4a'),_0x1e13d4[_0x3a8e('0x4b')]),_0x31b620);}};exports[_0x3a8e('0x60')]=function(_0x16d542){try{if(!_[_0x3a8e('0x16')](queues[_0x16d542[_0x3a8e('0x6')]])){utils['debug'](util[_0x3a8e('0x4')](_0x3a8e('0x61'),_0x16d542['uniqueid']),_0x16d542);queues[_0x16d542['uniqueid']][_0x3a8e('0x62')]=utils[_0x3a8e('0x29')]();utils['info'](util['format'](_0x3a8e('0x63'),_0x16d542['uniqueid'],queues[_0x16d542[_0x3a8e('0x6')]][_0x3a8e('0x20')],queues[_0x16d542[_0x3a8e('0x6')]][_0x3a8e('0x62')]));}}catch(_0x5aff44){utils[_0x3a8e('0x13')](util[_0x3a8e('0x4')]('[%s][queues][musiconholdstart]',_0x16d542[_0x3a8e('0x6')]),_0x5aff44);}};exports[_0x3a8e('0x64')]=function(_0x78bbbe){try{if(!_['isNil'](queues[_0x78bbbe['uniqueid']])){if(!_[_0x3a8e('0x16')](queues[_0x78bbbe[_0x3a8e('0x6')]]['musiconholdstartAt'])){utils[_0x3a8e('0x10')](util[_0x3a8e('0x4')]('[%s][queues][musiconholdstop]',_0x78bbbe[_0x3a8e('0x6')]),_0x78bbbe);queues[_0x78bbbe[_0x3a8e('0x6')]]['mohtime']+=utils[_0x3a8e('0x65')](utils[_0x3a8e('0x29')](),queues[_0x78bbbe['uniqueid']][_0x3a8e('0x62')]);utils[_0x3a8e('0x3')](util[_0x3a8e('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x78bbbe[_0x3a8e('0x6')],queues[_0x78bbbe[_0x3a8e('0x6')]][_0x3a8e('0x20')],queues[_0x78bbbe[_0x3a8e('0x6')]][_0x3a8e('0x57')]));delete queues[_0x78bbbe[_0x3a8e('0x6')]]['musiconholdstartAt'];}}}catch(_0x4e5815){utils['error'](util['format'](_0x3a8e('0x66'),_0x78bbbe[_0x3a8e('0x6')]),_0x4e5815);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 55088c0..47a2017 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c29=['transferercalleridnum','transferercalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','replace','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]'];(function(_0x27aced,_0x2ea44e){var _0x368a78=function(_0x4275f0){while(--_0x4275f0){_0x27aced['push'](_0x27aced['shift']());}};_0x368a78(++_0x2ea44e);}(_0x9c29,0xd0));var _0x99c2=function(_0x3257b9,_0x4e89d3){_0x3257b9=_0x3257b9-0x0;var _0x950476=_0x9c29[_0x3257b9];return _0x950476;};'use strict';var _=require(_0x99c2('0x0'));var util=require(_0x99c2('0x1'));var utils=require(_0x99c2('0x2'));var transfers=require(_0x99c2('0x3'));var recordings={};function writeDB(_0x50f4fa){var _0x53a186;utils[_0x99c2('0x4')](util[_0x99c2('0x5')](_0x99c2('0x6'),_0x50f4fa['uniqueid']));if(transfers[_0x99c2('0x7')][_0x50f4fa[_0x99c2('0x8')]]){_0x53a186=_0x50f4fa[_0x99c2('0x8')];_0x50f4fa[_0x99c2('0x8')]=transfers[_0x99c2('0x7')][_0x50f4fa[_0x99c2('0x8')]][_0x99c2('0x9')];}if(_0x50f4fa[_0x99c2('0xa')]){utils[_0x99c2('0xb')](_0x50f4fa[_0x99c2('0xa')])[_0x99c2('0xc')](function(_0x440074){if(_0x440074){_0x50f4fa['membername']=_0x440074['name'];_0x50f4fa['UserId']=_0x440074['id'];}utils[_0x99c2('0xd')](_0x99c2('0xe'),_0x50f4fa);});}else{utils[_0x99c2('0xd')](_0x99c2('0xe'),_0x50f4fa);}if(_0x53a186)delete transfers[_0x99c2('0x7')][_0x53a186];}exports['newchannel']=function(_0x7db3ed){try{utils[_0x99c2('0xf')](util[_0x99c2('0x5')](_0x99c2('0x10'),_0x7db3ed[_0x99c2('0x8')]),_0x7db3ed);if(_0x7db3ed[_0x99c2('0x8')]==_0x7db3ed['linkedid']){utils['info'](util['format'](_0x99c2('0x11'),_0x7db3ed[_0x99c2('0x8')],_0x7db3ed[_0x99c2('0x12')],_0x7db3ed[_0x99c2('0x13')]));recordings[_0x7db3ed[_0x99c2('0x8')]]={'uniqueid':_0x7db3ed[_0x99c2('0x8')],'accountcode':_0x7db3ed[_0x99c2('0xa')],'exten':_0x7db3ed['exten'],'context':_0x7db3ed[_0x99c2('0x12')],'channel':_0x7db3ed['channel'],'monitors':[]};}}catch(_0x8a7c28){utils[_0x99c2('0x14')](util['format'](_0x99c2('0x10'),_0x7db3ed[_0x99c2('0x8')]),_0x8a7c28);}};exports[_0x99c2('0x15')]=function(_0x3679d9){try{utils[_0x99c2('0xf')](util[_0x99c2('0x5')](_0x99c2('0x16'),_0x3679d9[_0x99c2('0x8')]),_0x3679d9);if(!_['isNil'](recordings[_0x3679d9[_0x99c2('0x8')]])&&_0x3679d9['channelstate']==0x6){utils[_0x99c2('0x4')](util[_0x99c2('0x5')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3679d9[_0x99c2('0x8')],_0x3679d9[_0x99c2('0x12')],_0x3679d9['channel']));}else if(!_[_0x99c2('0x17')](recordings[_0x3679d9[_0x99c2('0x18')]])&&_0x3679d9[_0x99c2('0x19')]==0x6&&_0x3679d9['context']!=_0x99c2('0x1a')){utils[_0x99c2('0x4')](util[_0x99c2('0x5')](_0x99c2('0x1b'),_0x3679d9['uniqueid'],_0x3679d9[_0x99c2('0x18')],_0x3679d9['context'],_0x3679d9['channel']));recordings[_0x3679d9[_0x99c2('0x18')]][_0x99c2('0xa')]=_0x3679d9[_0x99c2('0xa')];}}catch(_0x5ea39e){utils[_0x99c2('0x14')](util[_0x99c2('0x5')]('[%s][recordings][newstate]',_0x3679d9['uniqueid']),_0x5ea39e);}};exports[_0x99c2('0x1c')]=function(_0x10c2b7){try{if(!_['isNil'](_0x10c2b7[_0x99c2('0x1d')])&&!_[_0x99c2('0x17')](_0x10c2b7[_0x99c2('0x1d')]['mixmonitor_filename'])){utils['debug'](util['format']('[%s][recordings][varset]',_0x10c2b7[_0x99c2('0x8')]),_0x10c2b7);utils[_0x99c2('0x4')](util['format'](_0x99c2('0x1e'),_0x10c2b7['uniqueid'],_0x10c2b7[_0x99c2('0x1d')],_0x10c2b7['value']));if(_[_0x99c2('0x1f')](_0x10c2b7['value'],_0x99c2('0x20'))){_0x10c2b7[_0x99c2('0x21')]=_0x10c2b7[_0x99c2('0x21')][_0x99c2('0x22')](_0x99c2('0x20'),'.WAV');}if(recordings[_0x10c2b7[_0x99c2('0x18')]]){var _0x5e13c4=_[_0x99c2('0x23')](recordings[_0x10c2b7[_0x99c2('0x18')]][_0x99c2('0x24')],{'value':_0x10c2b7[_0x99c2('0x21')]});if(_['isNil'](_0x5e13c4)){recordings[_0x10c2b7[_0x99c2('0x18')]][_0x99c2('0x24')]['push']({'value':_0x10c2b7['value']});}}}}catch(_0x56a92d){utils[_0x99c2('0x14')](util[_0x99c2('0x5')](_0x99c2('0x25'),_0x10c2b7[_0x99c2('0x8')]),_0x56a92d);}};exports[_0x99c2('0x26')]=function(_0xbd6f9c){try{if(!_[_0x99c2('0x17')](recordings[_0xbd6f9c[_0x99c2('0x8')]])){utils[_0x99c2('0xf')](util[_0x99c2('0x5')](_0x99c2('0x27'),_0xbd6f9c[_0x99c2('0x8')]),_0xbd6f9c);utils[_0x99c2('0x4')](util[_0x99c2('0x5')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xbd6f9c['uniqueid'],_0xbd6f9c[_0x99c2('0x28')],_0xbd6f9c[_0x99c2('0x29')],_0xbd6f9c[_0x99c2('0x2a')]));recordings[_0xbd6f9c['uniqueid']]['calleridnum']=_0xbd6f9c[_0x99c2('0x28')];recordings[_0xbd6f9c[_0x99c2('0x8')]][_0x99c2('0x29')]=_0xbd6f9c[_0x99c2('0x29')];recordings[_0xbd6f9c[_0x99c2('0x8')]]['connectedlinenum']=_0xbd6f9c[_0x99c2('0x2b')];recordings[_0xbd6f9c[_0x99c2('0x8')]]['connectedlinename']=_0xbd6f9c[_0x99c2('0x2c')];if(recordings[_0xbd6f9c[_0x99c2('0x8')]][_0x99c2('0x2d')]==_0x99c2('0x2e')&&recordings[_0xbd6f9c['uniqueid']][_0x99c2('0xa')]){recordings[_0xbd6f9c[_0x99c2('0x8')]][_0x99c2('0x2b')]=recordings[_0xbd6f9c['uniqueid']][_0x99c2('0xa')];recordings[_0xbd6f9c['uniqueid']]['connectedlinename']='';}recordings[_0xbd6f9c[_0x99c2('0x8')]][_0x99c2('0x24')][_0x99c2('0x2f')](function(_0x43a5bc){var _0x3ddd4d=_[_0x99c2('0x30')](recordings[_0xbd6f9c[_0x99c2('0x8')]]);_0x3ddd4d[_0x99c2('0x21')]=_0x43a5bc[_0x99c2('0x21')];writeDB(_0x3ddd4d);});delete recordings[_0xbd6f9c[_0x99c2('0x8')]];}}catch(_0x39f006){utils[_0x99c2('0x14')](util[_0x99c2('0x5')](_0x99c2('0x27'),_0xbd6f9c[_0x99c2('0x8')]),_0x39f006);}};exports['newexten']=function(_0x110ef2){try{if(!_[_0x99c2('0x17')](recordings[_0x110ef2['uniqueid']])){utils['debug'](util[_0x99c2('0x5')](_0x99c2('0x31'),_0x110ef2[_0x99c2('0x8')]),_0x110ef2);utils['info'](util['format'](_0x99c2('0x32'),_0x110ef2[_0x99c2('0x8')],_0x110ef2[_0x99c2('0x33')],_0x110ef2['appdata']));if(_0x110ef2['application']['toLowerCase']()==_0x99c2('0x34')&&_[_0x99c2('0x35')](_0x110ef2[_0x99c2('0x36')][_0x99c2('0x37')](),_0x99c2('0x38'))){var _0x18b1b8=_0x110ef2[_0x99c2('0x36')][_0x99c2('0x39')]('=');var _0x469709=_0x18b1b8[0x0][_0x99c2('0x3a')](_0x18b1b8[0x0][_0x99c2('0x3b')]('(')+0x1,_0x18b1b8[0x0]['lastIndexOf'](')'));var _0x14adf5=_0x18b1b8[0x1];recordings[_0x110ef2[_0x99c2('0x8')]][_0x469709]=_0x14adf5;}}}catch(_0x5808b8){utils[_0x99c2('0x14')](util[_0x99c2('0x5')](_0x99c2('0x31'),_0x110ef2[_0x99c2('0x8')]),_0x5808b8);}};exports['queuecallerjoin']=function(_0xf586a1){try{if(!_['isNil'](recordings[_0xf586a1[_0x99c2('0x8')]])){utils[_0x99c2('0xf')](util[_0x99c2('0x5')](_0x99c2('0x3c'),_0xf586a1[_0x99c2('0x8')]),_0xf586a1);utils['info'](util[_0x99c2('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0xf586a1[_0x99c2('0x8')],_0xf586a1['queue']));recordings[_0xf586a1['uniqueid']][_0x99c2('0x3d')]=_0xf586a1['queue'];}}catch(_0x231603){utils['error'](util[_0x99c2('0x5')](_0x99c2('0x3c'),_0xf586a1['uniqueid']),_0x231603);}};exports[_0x99c2('0x3e')]=function(_0x223ae8){try{utils['debug'](util['format'](_0x99c2('0x3f'),_0x223ae8[_0x99c2('0x8')]),_0x223ae8);utils[_0x99c2('0x4')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x223ae8[_0x99c2('0x8')],_0x223ae8[_0x99c2('0x40')],_0x223ae8[_0x99c2('0x41')],_0x223ae8['transfereecalleridnum'],_0x223ae8['transfereecalleridname']));if(recordings[_0x223ae8[_0x99c2('0x42')]]&&transfers[_0x99c2('0x7')][_0x223ae8[_0x99c2('0x42')]]){transfers[_0x99c2('0x7')][_0x223ae8['transfereruniqueid']][_0x99c2('0x43')]=!![];}}catch(_0x58c5f5){utils[_0x99c2('0x14')](util[_0x99c2('0x5')](_0x99c2('0x3f'),_0x223ae8[_0x99c2('0x8')]),_0x58c5f5);}}; \ No newline at end of file +var _0x49d8=['.WAV','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x49d8,0xbb));var _0x849d=function(_0x2e3d46,_0x4d0c41){_0x2e3d46=_0x2e3d46-0x0;var _0xa8e2e9=_0x49d8[_0x2e3d46];return _0xa8e2e9;};'use strict';var _=require('lodash');var util=require(_0x849d('0x0'));var utils=require(_0x849d('0x1'));var transfers=require(_0x849d('0x2'));var recordings={};function writeDB(_0x375458){var _0x5ca3d6;utils[_0x849d('0x3')](util[_0x849d('0x4')](_0x849d('0x5'),_0x375458[_0x849d('0x6')]));if(transfers[_0x849d('0x7')][_0x375458[_0x849d('0x6')]]){_0x5ca3d6=_0x375458[_0x849d('0x6')];_0x375458[_0x849d('0x6')]=transfers[_0x849d('0x7')][_0x375458[_0x849d('0x6')]][_0x849d('0x8')];}if(_0x375458[_0x849d('0x9')]){utils[_0x849d('0xa')](_0x375458[_0x849d('0x9')])[_0x849d('0xb')](function(_0x4aba52){if(_0x4aba52){_0x375458[_0x849d('0xc')]=_0x4aba52[_0x849d('0xd')];_0x375458[_0x849d('0xe')]=_0x4aba52['id'];}utils[_0x849d('0xf')](_0x849d('0x10'),_0x375458);});}else{utils['request'](_0x849d('0x10'),_0x375458);}if(_0x5ca3d6)delete transfers[_0x849d('0x7')][_0x5ca3d6];}exports['newchannel']=function(_0x5acbc7){try{utils['debug'](util[_0x849d('0x4')](_0x849d('0x11'),_0x5acbc7[_0x849d('0x6')]),_0x5acbc7);if(_0x5acbc7[_0x849d('0x6')]==_0x5acbc7['linkedid']){utils[_0x849d('0x3')](util[_0x849d('0x4')](_0x849d('0x12'),_0x5acbc7[_0x849d('0x6')],_0x5acbc7[_0x849d('0x13')],_0x5acbc7[_0x849d('0x14')]));recordings[_0x5acbc7[_0x849d('0x6')]]={'uniqueid':_0x5acbc7[_0x849d('0x6')],'accountcode':_0x5acbc7[_0x849d('0x9')],'exten':_0x5acbc7[_0x849d('0x14')],'context':_0x5acbc7[_0x849d('0x13')],'channel':_0x5acbc7[_0x849d('0x15')],'monitors':[]};}}catch(_0x2740a9){utils[_0x849d('0x16')](util['format']('[%s][recordings][newchannel]',_0x5acbc7[_0x849d('0x6')]),_0x2740a9);}};exports[_0x849d('0x17')]=function(_0x1f9415){try{utils[_0x849d('0x18')](util[_0x849d('0x4')]('[%s][recordings][newstate]',_0x1f9415['uniqueid']),_0x1f9415);if(!_[_0x849d('0x19')](recordings[_0x1f9415[_0x849d('0x6')]])&&_0x1f9415['channelstate']==0x6){utils[_0x849d('0x3')](util[_0x849d('0x4')](_0x849d('0x1a'),_0x1f9415[_0x849d('0x6')],_0x1f9415[_0x849d('0x13')],_0x1f9415[_0x849d('0x15')]));}else if(!_[_0x849d('0x19')](recordings[_0x1f9415[_0x849d('0x1b')]])&&_0x1f9415[_0x849d('0x1c')]==0x6&&_0x1f9415[_0x849d('0x13')]!=_0x849d('0x1d')){utils[_0x849d('0x3')](util[_0x849d('0x4')](_0x849d('0x1e'),_0x1f9415[_0x849d('0x6')],_0x1f9415['linkedid'],_0x1f9415[_0x849d('0x13')],_0x1f9415[_0x849d('0x15')]));recordings[_0x1f9415[_0x849d('0x1b')]]['accountcode']=_0x1f9415[_0x849d('0x9')];}}catch(_0x4af283){utils[_0x849d('0x16')](util['format'](_0x849d('0x1f'),_0x1f9415[_0x849d('0x6')]),_0x4af283);}};exports['varset']=function(_0x3acda3){try{if(!_[_0x849d('0x19')](_0x3acda3[_0x849d('0x20')])&&!_[_0x849d('0x19')](_0x3acda3['variable'][_0x849d('0x21')])){utils[_0x849d('0x18')](util['format']('[%s][recordings][varset]',_0x3acda3[_0x849d('0x6')]),_0x3acda3);utils[_0x849d('0x3')](util['format'](_0x849d('0x22'),_0x3acda3['uniqueid'],_0x3acda3[_0x849d('0x20')],_0x3acda3[_0x849d('0x23')]));if(_[_0x849d('0x24')](_0x3acda3[_0x849d('0x23')],_0x849d('0x25'))){_0x3acda3[_0x849d('0x23')]=_0x3acda3[_0x849d('0x23')]['replace']('.wav49',_0x849d('0x26'));}if(recordings[_0x3acda3['linkedid']]){var _0x154b70=_['find'](recordings[_0x3acda3[_0x849d('0x1b')]][_0x849d('0x27')],{'value':_0x3acda3[_0x849d('0x23')]});if(_[_0x849d('0x19')](_0x154b70)){recordings[_0x3acda3[_0x849d('0x1b')]][_0x849d('0x27')][_0x849d('0x28')]({'value':_0x3acda3[_0x849d('0x23')]});}}}}catch(_0x17a3b9){utils['error'](util[_0x849d('0x4')](_0x849d('0x29'),_0x3acda3[_0x849d('0x6')]),_0x17a3b9);}};exports[_0x849d('0x2a')]=function(_0x10778e){try{if(!_[_0x849d('0x19')](recordings[_0x10778e['uniqueid']])){utils['debug'](util[_0x849d('0x4')]('[%s][recordings][hangup]',_0x10778e[_0x849d('0x6')]),_0x10778e);utils['info'](util['format'](_0x849d('0x2b'),_0x10778e[_0x849d('0x6')],_0x10778e[_0x849d('0x2c')],_0x10778e[_0x849d('0x2d')],_0x10778e['cause-txt']));recordings[_0x10778e[_0x849d('0x6')]]['calleridnum']=_0x10778e[_0x849d('0x2c')];recordings[_0x10778e[_0x849d('0x6')]][_0x849d('0x2d')]=_0x10778e[_0x849d('0x2d')];recordings[_0x10778e[_0x849d('0x6')]][_0x849d('0x2e')]=_0x10778e['connectedlinenum'];recordings[_0x10778e[_0x849d('0x6')]][_0x849d('0x2f')]=_0x10778e['connectedlinename'];if(recordings[_0x10778e['uniqueid']]['type']==_0x849d('0x30')&&recordings[_0x10778e[_0x849d('0x6')]][_0x849d('0x9')]){recordings[_0x10778e[_0x849d('0x6')]]['connectedlinenum']=recordings[_0x10778e[_0x849d('0x6')]][_0x849d('0x9')];recordings[_0x10778e[_0x849d('0x6')]][_0x849d('0x2f')]='';}recordings[_0x10778e[_0x849d('0x6')]][_0x849d('0x27')][_0x849d('0x31')](function(_0x399ad1){var _0x20c4a4=_[_0x849d('0x32')](recordings[_0x10778e[_0x849d('0x6')]]);_0x20c4a4[_0x849d('0x23')]=_0x399ad1[_0x849d('0x23')];writeDB(_0x20c4a4);});delete recordings[_0x10778e['uniqueid']];}}catch(_0x435116){utils[_0x849d('0x16')](util[_0x849d('0x4')](_0x849d('0x33'),_0x10778e[_0x849d('0x6')]),_0x435116);}};exports[_0x849d('0x34')]=function(_0x4dfe90){try{if(!_[_0x849d('0x19')](recordings[_0x4dfe90['uniqueid']])){utils['debug'](util['format'](_0x849d('0x35'),_0x4dfe90['uniqueid']),_0x4dfe90);utils['info'](util[_0x849d('0x4')](_0x849d('0x36'),_0x4dfe90[_0x849d('0x6')],_0x4dfe90['application'],_0x4dfe90['appdata']));if(_0x4dfe90[_0x849d('0x37')][_0x849d('0x38')]()==_0x849d('0x39')&&_[_0x849d('0x3a')](_0x4dfe90[_0x849d('0x3b')][_0x849d('0x38')](),_0x849d('0x3c'))){var _0x17ce6b=_0x4dfe90[_0x849d('0x3b')][_0x849d('0x3d')]('=');var _0x16ba32=_0x17ce6b[0x0][_0x849d('0x3e')](_0x17ce6b[0x0][_0x849d('0x3f')]('(')+0x1,_0x17ce6b[0x0][_0x849d('0x3f')](')'));var _0x44305f=_0x17ce6b[0x1];recordings[_0x4dfe90[_0x849d('0x6')]][_0x16ba32]=_0x44305f;}}}catch(_0x3ad9db){utils[_0x849d('0x16')](util[_0x849d('0x4')]('[%s][recordings][newexten]',_0x4dfe90[_0x849d('0x6')]),_0x3ad9db);}};exports[_0x849d('0x40')]=function(_0x19d845){try{if(!_[_0x849d('0x19')](recordings[_0x19d845[_0x849d('0x6')]])){utils[_0x849d('0x18')](util['format'](_0x849d('0x41'),_0x19d845[_0x849d('0x6')]),_0x19d845);utils[_0x849d('0x3')](util[_0x849d('0x4')](_0x849d('0x42'),_0x19d845[_0x849d('0x6')],_0x19d845['queue']));recordings[_0x19d845[_0x849d('0x6')]][_0x849d('0x43')]=_0x19d845[_0x849d('0x43')];}}catch(_0x1cefff){utils[_0x849d('0x16')](util[_0x849d('0x4')](_0x849d('0x41'),_0x19d845[_0x849d('0x6')]),_0x1cefff);}};exports[_0x849d('0x44')]=function(_0x2a8af2){try{utils[_0x849d('0x18')](util[_0x849d('0x4')](_0x849d('0x45'),_0x2a8af2[_0x849d('0x6')]),_0x2a8af2);utils[_0x849d('0x3')](util[_0x849d('0x4')](_0x849d('0x46'),_0x2a8af2[_0x849d('0x6')],_0x2a8af2['transferercalleridnum'],_0x2a8af2[_0x849d('0x47')],_0x2a8af2['transfereecalleridnum'],_0x2a8af2[_0x849d('0x48')]));if(recordings[_0x2a8af2[_0x849d('0x49')]]&&transfers[_0x849d('0x7')][_0x2a8af2['transfereruniqueid']]){transfers[_0x849d('0x7')][_0x2a8af2[_0x849d('0x49')]][_0x849d('0x4a')]=!![];}}catch(_0x2d53b0){utils[_0x849d('0x16')](util[_0x849d('0x4')]('[%s][recordings][blindtransfer]',_0x2a8af2['uniqueid']),_0x2d53b0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 504798c..c84ccaa 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28af=['uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','blinds','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]'];(function(_0x4b5da6,_0x387f79){var _0x350414=function(_0x1fa5b2){while(--_0x1fa5b2){_0x4b5da6['push'](_0x4b5da6['shift']());}};_0x350414(++_0x387f79);}(_0x28af,0x1b8));var _0xf28a=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x28af[_0x2c96f6];return _0x6d4808;};'use strict';var _=require(_0xf28a('0x0'));var util=require(_0xf28a('0x1'));var utils=require(_0xf28a('0x2'));function writeDB(_0x3caac3){utils[_0xf28a('0x3')](util[_0xf28a('0x4')](_0xf28a('0x5'),_0x3caac3[_0xf28a('0x6')]===_0xf28a('0x7')?_0x3caac3['origtransfereruniqueid']:_0x3caac3['uniqueid'],_0x3caac3[_0xf28a('0x6')]));utils[_0xf28a('0x8')](_0xf28a('0x9'),_0x3caac3);}exports['blinds']={};exports['blindtransfer']=function(_0x5f55cf){try{utils['debug'](util[_0xf28a('0x4')](_0xf28a('0xa'),_0x5f55cf['uniqueid']),_0x5f55cf);utils[_0xf28a('0x3')](util[_0xf28a('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5f55cf[_0xf28a('0xb')],_0x5f55cf[_0xf28a('0xc')],_0x5f55cf[_0xf28a('0xd')],_0x5f55cf[_0xf28a('0xe')],_0x5f55cf[_0xf28a('0xf')]));_0x5f55cf[_0xf28a('0x6')]=_0xf28a('0x10');exports[_0xf28a('0x11')][_0x5f55cf['transfereruniqueid']]=_0x5f55cf;writeDB(_0x5f55cf);}catch(_0x31d612){utils[_0xf28a('0x12')](util[_0xf28a('0x4')](_0xf28a('0xa'),_0x5f55cf[_0xf28a('0xb')]),_0x31d612);}};exports[_0xf28a('0x13')]=function(_0x30e311){try{utils[_0xf28a('0x14')](util['format'](_0xf28a('0x15'),_0x30e311[_0xf28a('0x16')]),_0x30e311);utils[_0xf28a('0x3')](util[_0xf28a('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x30e311['origtransfereruniqueid'],_0x30e311[_0xf28a('0x17')],_0x30e311[_0xf28a('0x18')],_0x30e311[_0xf28a('0x19')],_0x30e311[_0xf28a('0x1a')]));_0x30e311=_[_0xf28a('0x1b')](_0x30e311,{'transfererchannel':_0x30e311['origtransfererchannel'],'transferercalleridnum':_0x30e311['origtransferercalleridnum'],'transferercalleridname':_0x30e311['origtransferercalleridname'],'transfererconnectedlinenum':_0x30e311[_0xf28a('0x1c')],'transfererconnectedlinename':_0x30e311[_0xf28a('0x1d')],'transfereraccountcode':_0x30e311[_0xf28a('0x1e')],'transferercontext':_0x30e311['secondtransferercontext'],'transfererexten':_0x30e311[_0xf28a('0x1f')],'transfererlinkedid':_0x30e311[_0xf28a('0x20')],'context':_0x30e311[_0xf28a('0x21')],'extension':_0x30e311[_0xf28a('0x22')],'type':_0xf28a('0x7')});if(_[_0xf28a('0x23')](_0x30e311[_0xf28a('0x24')])){_0x30e311=_[_0xf28a('0x1b')](_0x30e311,{'transfereechannel':_0x30e311[_0xf28a('0x25')],'transfereecalleridnum':_0x30e311[_0xf28a('0x19')],'transfereecalleridname':_0x30e311[_0xf28a('0x1a')],'transfereeconnectedlinenum':_0x30e311['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x30e311['transfertargetconnectedlinename'],'transfereeaccountcode':_0x30e311[_0xf28a('0x26')],'transfereecontext':_0x30e311[_0xf28a('0x27')],'transfereeexten':_0x30e311[_0xf28a('0x28')],'transfereelinkedid':_0x30e311['transfertargetlinkedid']});}writeDB(_0x30e311);}catch(_0x4fcdaa){utils[_0xf28a('0x12')](util['format'](_0xf28a('0x15'),_0x30e311['origtransfereruniqueid']),_0x4fcdaa);}}; \ No newline at end of file +var _0xf94c=['origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0xff8f7c,_0x5e3c62){var _0x1a6171=function(_0x380d5a){while(--_0x380d5a){_0xff8f7c['push'](_0xff8f7c['shift']());}};_0x1a6171(++_0x5e3c62);}(_0xf94c,0x18f));var _0xcf94=function(_0x2f1ea9,_0x3f0a34){_0x2f1ea9=_0x2f1ea9-0x0;var _0x16e58a=_0xf94c[_0x2f1ea9];return _0x16e58a;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');function writeDB(_0x521881){utils[_0xcf94('0x0')](util[_0xcf94('0x1')](_0xcf94('0x2'),_0x521881[_0xcf94('0x3')]==='attended'?_0x521881['origtransfereruniqueid']:_0x521881[_0xcf94('0x4')],_0x521881['type']));utils[_0xcf94('0x5')](_0xcf94('0x6'),_0x521881);}exports[_0xcf94('0x7')]={};exports[_0xcf94('0x8')]=function(_0x35b93f){try{utils[_0xcf94('0x9')](util[_0xcf94('0x1')](_0xcf94('0xa'),_0x35b93f['uniqueid']),_0x35b93f);utils[_0xcf94('0x0')](util[_0xcf94('0x1')](_0xcf94('0xb'),_0x35b93f[_0xcf94('0x4')],_0x35b93f[_0xcf94('0xc')],_0x35b93f['transferercalleridname'],_0x35b93f[_0xcf94('0xd')],_0x35b93f[_0xcf94('0xe')]));_0x35b93f[_0xcf94('0x3')]=_0xcf94('0xf');exports[_0xcf94('0x7')][_0x35b93f[_0xcf94('0x10')]]=_0x35b93f;writeDB(_0x35b93f);}catch(_0x1507a5){utils[_0xcf94('0x11')](util[_0xcf94('0x1')](_0xcf94('0xa'),_0x35b93f[_0xcf94('0x4')]),_0x1507a5);}};exports[_0xcf94('0x12')]=function(_0x1ccb8d){try{utils['debug'](util[_0xcf94('0x1')](_0xcf94('0x13'),_0x1ccb8d['origtransfereruniqueid']),_0x1ccb8d);utils[_0xcf94('0x0')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1ccb8d[_0xcf94('0x14')],_0x1ccb8d[_0xcf94('0x15')],_0x1ccb8d[_0xcf94('0x16')],_0x1ccb8d['transfertargetcalleridnum'],_0x1ccb8d[_0xcf94('0x17')]));_0x1ccb8d=_[_0xcf94('0x18')](_0x1ccb8d,{'transfererchannel':_0x1ccb8d['origtransfererchannel'],'transferercalleridnum':_0x1ccb8d['origtransferercalleridnum'],'transferercalleridname':_0x1ccb8d[_0xcf94('0x16')],'transfererconnectedlinenum':_0x1ccb8d[_0xcf94('0x19')],'transfererconnectedlinename':_0x1ccb8d[_0xcf94('0x1a')],'transfereraccountcode':_0x1ccb8d[_0xcf94('0x1b')],'transferercontext':_0x1ccb8d[_0xcf94('0x1c')],'transfererexten':_0x1ccb8d[_0xcf94('0x1d')],'transfererlinkedid':_0x1ccb8d['origtransfererlinkedid'],'context':_0x1ccb8d[_0xcf94('0x1e')],'extension':_0x1ccb8d[_0xcf94('0x1f')],'type':_0xcf94('0x20')});if(_[_0xcf94('0x21')](_0x1ccb8d[_0xcf94('0x22')])){_0x1ccb8d=_['assign'](_0x1ccb8d,{'transfereechannel':_0x1ccb8d['transfertargetchannel'],'transfereecalleridnum':_0x1ccb8d[_0xcf94('0x23')],'transfereecalleridname':_0x1ccb8d[_0xcf94('0x17')],'transfereeconnectedlinenum':_0x1ccb8d['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1ccb8d[_0xcf94('0x24')],'transfereeaccountcode':_0x1ccb8d[_0xcf94('0x25')],'transfereecontext':_0x1ccb8d[_0xcf94('0x26')],'transfereeexten':_0x1ccb8d['transfertargetexten'],'transfereelinkedid':_0x1ccb8d['transfertargetlinkedid']});}writeDB(_0x1ccb8d);}catch(_0x1063ab){utils[_0xcf94('0x11')](util[_0xcf94('0x1')](_0xcf94('0x13'),_0x1ccb8d['origtransfereruniqueid']),_0x1063ab);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1e7c79f..2f8f65d 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d44=['[utils][getUserByName]','getVoiceQueueByName','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','name','then','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s'];(function(_0x84dd59,_0x50a247){var _0x25f944=function(_0x26d5d6){while(--_0x26d5d6){_0x84dd59['push'](_0x84dd59['shift']());}};_0x25f944(++_0x50a247);}(_0x9d44,0x1af));var _0x49d4=function(_0x1707f0,_0x23f136){_0x1707f0=_0x1707f0-0x0;var _0xccacd1=_0x9d44[_0x1707f0];return _0xccacd1;};'use strict';var BPromise=require(_0x49d4('0x0'));var jayson=require(_0x49d4('0x1'));var moment=require(_0x49d4('0x2'));var util=require(_0x49d4('0x3'));var client=jayson[_0x49d4('0x4')][_0x49d4('0x5')]({'port':0x2329});var logger=require(_0x49d4('0x6'))(_0x49d4('0x7'));exports[_0x49d4('0x8')]=function(_0x686b51,_0x3827ca){logger[_0x49d4('0x8')](_0x686b51,_0x3827ca?util[_0x49d4('0x9')](_0x3827ca,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x29b0dc,_0x43907b){logger[_0x49d4('0xa')](_0x29b0dc,_0x43907b?util[_0x49d4('0x9')](_0x43907b,{'showHidden':![],'depth':null}):'');};exports[_0x49d4('0xb')]=function(_0x9b09de,_0x4a4712){logger['error'](_0x9b09de,_0x4a4712?util[_0x49d4('0x9')](_0x4a4712,{'showHidden':![],'depth':null}):'');};exports[_0x49d4('0xc')]=function(_0x394b2f,_0x3625f2){return client[_0x49d4('0xc')](_0x394b2f,{'body':_0x3625f2})['then'](function(_0x59a359){logger[_0x49d4('0xa')](_0x49d4('0xd'),_0x394b2f,_0x59a359?util[_0x49d4('0x9')](_0x59a359,{'showHidden':![],'depth':null}):'');})[_0x49d4('0xe')](function(_0x2bcae9){logger[_0x49d4('0xb')](_0x49d4('0xd'),_0x394b2f,_0x2bcae9?util[_0x49d4('0x9')](_0x2bcae9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3916b5){return client[_0x49d4('0xc')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x49d4('0xf'),'interface'],'where':_0x3916b5,'limit':0x1}})[_0x49d4('0x10')](function(_0x2d26f5){logger[_0x49d4('0xa')](_0x49d4('0x11'),JSON[_0x49d4('0x12')](_0x3916b5),_0x2d26f5?util[_0x49d4('0x9')](_0x2d26f5,{'showHidden':![],'depth':null}):'');return _0x2d26f5['result'][_0x49d4('0x13')]?_0x2d26f5[_0x49d4('0x14')][0x0]:null;});}exports[_0x49d4('0x15')]=function(_0x862c2f){return new BPromise(function(_0xa46295,_0x17d35e){if(_0x862c2f){return getUser({'internal':_0x862c2f})[_0x49d4('0x10')](function(_0x48c263){logger[_0x49d4('0x8')](_0x49d4('0x16'),_0x862c2f,_0x48c263?'found':'notfound');return _0xa46295(_0x48c263);})[_0x49d4('0xe')](function(_0x560228){logger['error'](_0x49d4('0x17'),_0x560228?util[_0x49d4('0x9')](_0x560228,{'showHidden':![],'depth':null}):'');return _0xa46295(null);});}return _0xa46295(null);});};exports['getUserByInterface']=function(_0x26f33c){return new BPromise(function(_0x52629a,_0x5cad6d){if(_0x26f33c){return getUser({'interface':_0x26f33c})[_0x49d4('0x10')](function(_0x3b55f0){logger[_0x49d4('0x8')](_0x49d4('0x18'),_0x26f33c,_0x3b55f0?_0x49d4('0x19'):_0x49d4('0x1a'));return _0x52629a(_0x3b55f0);})['catch'](function(_0xf8a618){logger[_0x49d4('0xb')]('[utils][getUserByInterface]',_0xf8a618?util[_0x49d4('0x9')](_0xf8a618,{'showHidden':![],'depth':null}):'');return _0x52629a(null);});}return _0x52629a(null);});};exports[_0x49d4('0x1b')]=function(_0x928238){return new BPromise(function(_0xb2bdf9,_0x4e9e15){if(_0x928238){return getUser({'name':_0x928238})[_0x49d4('0x10')](function(_0x3eb06a){logger['info'](_0x49d4('0x1c'),_0x928238,_0x3eb06a?_0x49d4('0x19'):_0x49d4('0x1a'));return _0xb2bdf9(_0x3eb06a);})[_0x49d4('0xe')](function(_0x5b3f1a){logger[_0x49d4('0xb')](_0x49d4('0x1d'),_0x5b3f1a?util[_0x49d4('0x9')](_0x5b3f1a,{'showHidden':![],'depth':null}):'');return _0xb2bdf9(null);});}return _0xb2bdf9(null);});};exports[_0x49d4('0x1e')]=function(_0x2ca2ee){return new BPromise(function(_0x2f70c1,_0x5cdc2e){if(_0x2ca2ee){return client[_0x49d4('0xc')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x49d4('0xf'),'type',_0x49d4('0x1f'),_0x49d4('0x20')],'where':{'name':_0x2ca2ee},'limit':0x1}})[_0x49d4('0x10')](function(_0x11a6e6){logger[_0x49d4('0xa')](_0x49d4('0x21'),_0x2ca2ee,_0x11a6e6?util['inspect'](_0x11a6e6,{'showHidden':![],'depth':null}):'');logger[_0x49d4('0x8')](_0x49d4('0x22'),_0x2ca2ee,_0x11a6e6?_0x49d4('0x19'):_0x49d4('0x1a'));return _0x2f70c1(_0x11a6e6['result'][_0x49d4('0x13')]?_0x11a6e6[_0x49d4('0x14')][0x0]:null);})[_0x49d4('0xe')](function(_0x1dc394){logger[_0x49d4('0xb')](_0x49d4('0x23'),_0x1dc394?util['inspect'](_0x1dc394,{'showHidden':![],'depth':null}):'');return _0x2f70c1(null);});}return _0x2f70c1(null);});};exports[_0x49d4('0x24')]=function(_0x5ab6ad,_0x9a6f37){return moment(_0x5ab6ad)['add'](_0x9a6f37,_0x49d4('0x25'))[_0x49d4('0x26')](_0x49d4('0x27'));};exports['subtractTime']=function(_0x3b63af,_0x13d579){return moment(_0x3b63af)[_0x49d4('0x28')](_0x13d579,_0x49d4('0x25'))[_0x49d4('0x26')](_0x49d4('0x27'));};exports[_0x49d4('0x29')]=function(_0x2d256d,_0x3c76a2){return moment(_0x2d256d)[_0x49d4('0x2a')](moment(_0x3c76a2),'seconds');};exports[_0x49d4('0x2b')]=function(_0x3f8a21,_0xac194a){return parseInt(_0x3f8a21,0xa)+parseInt(_0xac194a,0xa);};exports['now']=function(){return moment()[_0x49d4('0x26')](_0x49d4('0x27'));};exports['isAfter']=function(_0x43f917,_0x2bd2a5){if(_0x2bd2a5){return moment(_0x43f917)[_0x49d4('0x2c')](_0x2bd2a5);}return!![];};exports[_0x49d4('0x2d')]=function(_0x500ddb,_0x244cf4){if(_0x244cf4){return moment(_0x500ddb)[_0x49d4('0x2d')](_0x244cf4);}else if(_0x500ddb){return!![];}return![];}; \ No newline at end of file +var _0xee2f=['../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','GetVoiceQueue','name','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','http'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0xee2f,0x11c));var _0xfee2=function(_0x343e76,_0x5593cb){_0x343e76=_0x343e76-0x0;var _0x47537f=_0xee2f[_0x343e76];return _0x47537f;};'use strict';var BPromise=require(_0xfee2('0x0'));var jayson=require(_0xfee2('0x1'));var moment=require(_0xfee2('0x2'));var util=require('util');var client=jayson['client'][_0xfee2('0x3')]({'port':0x2329});var logger=require(_0xfee2('0x4'))(_0xfee2('0x5'));exports[_0xfee2('0x6')]=function(_0x132254,_0x605a2){logger[_0xfee2('0x6')](_0x132254,_0x605a2?util[_0xfee2('0x7')](_0x605a2,{'showHidden':![],'depth':null}):'');};exports[_0xfee2('0x8')]=function(_0x21b0e5,_0x2faf01){logger[_0xfee2('0x8')](_0x21b0e5,_0x2faf01?util['inspect'](_0x2faf01,{'showHidden':![],'depth':null}):'');};exports[_0xfee2('0x9')]=function(_0x5ac9cd,_0x15b42d){logger[_0xfee2('0x9')](_0x5ac9cd,_0x15b42d?util[_0xfee2('0x7')](_0x15b42d,{'showHidden':![],'depth':null}):'');};exports[_0xfee2('0xa')]=function(_0x48d2e5,_0x140d7a){return client[_0xfee2('0xa')](_0x48d2e5,{'body':_0x140d7a})['then'](function(_0x58e98c){logger[_0xfee2('0x8')](_0xfee2('0xb'),_0x48d2e5,_0x58e98c?util['inspect'](_0x58e98c,{'showHidden':![],'depth':null}):'');})[_0xfee2('0xc')](function(_0x161d34){logger[_0xfee2('0x9')]('[utils][request]\x20name:%s',_0x48d2e5,_0x161d34?util[_0xfee2('0x7')](_0x161d34,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4e6da4){return client[_0xfee2('0xa')](_0xfee2('0xd'),{'options':{'raw':!![],'attributes':['id',_0xfee2('0xe'),'name',_0xfee2('0xf')],'where':_0x4e6da4,'limit':0x1}})[_0xfee2('0x10')](function(_0x3cac29){logger[_0xfee2('0x8')](_0xfee2('0x11'),JSON[_0xfee2('0x12')](_0x4e6da4),_0x3cac29?util['inspect'](_0x3cac29,{'showHidden':![],'depth':null}):'');return _0x3cac29['result'][_0xfee2('0x13')]?_0x3cac29[_0xfee2('0x14')][0x0]:null;});}exports[_0xfee2('0x15')]=function(_0x2c39c4){return new BPromise(function(_0x167e45,_0x338bf8){if(_0x2c39c4){return getUser({'internal':_0x2c39c4})[_0xfee2('0x10')](function(_0x5f5bd3){logger[_0xfee2('0x6')](_0xfee2('0x16'),_0x2c39c4,_0x5f5bd3?_0xfee2('0x17'):'notfound');return _0x167e45(_0x5f5bd3);})['catch'](function(_0x4a119e){logger[_0xfee2('0x9')](_0xfee2('0x18'),_0x4a119e?util[_0xfee2('0x7')](_0x4a119e,{'showHidden':![],'depth':null}):'');return _0x167e45(null);});}return _0x167e45(null);});};exports[_0xfee2('0x19')]=function(_0x81b414){return new BPromise(function(_0x19cd2f,_0x57dd85){if(_0x81b414){return getUser({'interface':_0x81b414})['then'](function(_0x2529d6){logger[_0xfee2('0x6')](_0xfee2('0x1a'),_0x81b414,_0x2529d6?'found':_0xfee2('0x1b'));return _0x19cd2f(_0x2529d6);})[_0xfee2('0xc')](function(_0x4b8775){logger[_0xfee2('0x9')](_0xfee2('0x1c'),_0x4b8775?util[_0xfee2('0x7')](_0x4b8775,{'showHidden':![],'depth':null}):'');return _0x19cd2f(null);});}return _0x19cd2f(null);});};exports[_0xfee2('0x1d')]=function(_0x3b22e9){return new BPromise(function(_0x105f79,_0x4de0d6){if(_0x3b22e9){return getUser({'name':_0x3b22e9})[_0xfee2('0x10')](function(_0x3377cc){logger[_0xfee2('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x3b22e9,_0x3377cc?_0xfee2('0x17'):_0xfee2('0x1b'));return _0x105f79(_0x3377cc);})[_0xfee2('0xc')](function(_0x4a8c85){logger['error'](_0xfee2('0x1e'),_0x4a8c85?util[_0xfee2('0x7')](_0x4a8c85,{'showHidden':![],'depth':null}):'');return _0x105f79(null);});}return _0x105f79(null);});};exports['getVoiceQueueByName']=function(_0x4e0300){return new BPromise(function(_0x1d3538,_0x4d389d){if(_0x4e0300){return client['request'](_0xfee2('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xfee2('0x20'),_0xfee2('0x21'),'acw',_0xfee2('0x22')],'where':{'name':_0x4e0300},'limit':0x1}})[_0xfee2('0x10')](function(_0x29e522){logger[_0xfee2('0x8')](_0xfee2('0x23'),_0x4e0300,_0x29e522?util[_0xfee2('0x7')](_0x29e522,{'showHidden':![],'depth':null}):'');logger[_0xfee2('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4e0300,_0x29e522?_0xfee2('0x17'):_0xfee2('0x1b'));return _0x1d3538(_0x29e522[_0xfee2('0x14')][_0xfee2('0x13')]?_0x29e522[_0xfee2('0x14')][0x0]:null);})[_0xfee2('0xc')](function(_0x4a50fb){logger[_0xfee2('0x9')](_0xfee2('0x24'),_0x4a50fb?util[_0xfee2('0x7')](_0x4a50fb,{'showHidden':![],'depth':null}):'');return _0x1d3538(null);});}return _0x1d3538(null);});};exports[_0xfee2('0x25')]=function(_0x453643,_0x1af3b4){return moment(_0x453643)[_0xfee2('0x26')](_0x1af3b4,_0xfee2('0x27'))[_0xfee2('0x28')](_0xfee2('0x29'));};exports[_0xfee2('0x2a')]=function(_0x4ac492,_0x562ed7){return moment(_0x4ac492)['subtract'](_0x562ed7,_0xfee2('0x27'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xfee2('0x2b')]=function(_0x5c0ea4,_0x360152){return moment(_0x5c0ea4)[_0xfee2('0x2c')](moment(_0x360152),_0xfee2('0x27'));};exports[_0xfee2('0x2d')]=function(_0x10945d,_0x50d6e2){return parseInt(_0x10945d,0xa)+parseInt(_0x50d6e2,0xa);};exports['now']=function(){return moment()[_0xfee2('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xfee2('0x2e')]=function(_0x107502,_0x3ef757){if(_0x3ef757){return moment(_0x107502)[_0xfee2('0x2e')](_0x3ef757);}return!![];};exports[_0xfee2('0x2f')]=function(_0x475f2e,_0x5b93d9){if(_0x5b93d9){return moment(_0x475f2e)['isBefore'](_0x5b93d9);}else if(_0x475f2e){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 983c08a..43a9ccb 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e24=['user','no-user','data','timestamp','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','maskSensitiveData','join','role','name','ensureDir','then','client','catch','log'];(function(_0x59039f,_0x55bdfa){var _0xf1b677=function(_0x256d91){while(--_0x256d91){_0x59039f['push'](_0x59039f['shift']());}};_0xf1b677(++_0x55bdfa);}(_0x1e24,0x7c));var _0x41e2=function(_0x185f01,_0x3930e3){_0x185f01=_0x185f01-0x0;var _0x330844=_0x1e24[_0x185f01];return _0x330844;};var fs=require(_0x41e2('0x0'));var _=require(_0x41e2('0x1'));var ewinston=require(_0x41e2('0x2'));var path=require(_0x41e2('0x3'));var util=require(_0x41e2('0x4'));var fileLogger=require(_0x41e2('0x5'))[_0x41e2('0x6')];var safeTemplate=require(_0x41e2('0x7'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x41e2('0x8')];function ClientSideLogger(){function _0x5b08c8(_0x23ea22){var _0x25389e=path[_0x41e2('0x9')]('/var','log','xcally');var _0x2f9876=path[_0x41e2('0x9')]('client',_0x23ea22[_0x41e2('0xa')]+'-'+_0x23ea22[_0x41e2('0xb')]);return fs[_0x41e2('0xc')](path[_0x41e2('0x9')](_0x25389e,_0x2f9876))[_0x41e2('0xd')](function(){var _0x4bed5c=fileLogger(_0x41e2('0xe'),path[_0x41e2('0x9')](_0x25389e,_0x2f9876));return _0x4bed5c;})[_0x41e2('0xf')](function(_0xab1ec6){throw _0xab1ec6;});}this[_0x41e2('0x10')]=function(_0x46d70c,_0x106e2a,_0x5d387c,_0x3df0f1){return _0x5b08c8(_0x46d70c[_0x41e2('0x11')])[_0x41e2('0xd')](function(_0x3b99cf){var _0x1d3a2d=_0x3b99cf[_0x106e2a];return _0x1d3a2d;})[_0x41e2('0xd')](function(_0x17e254){var _0x190dd4=_0x46d70c[_0x41e2('0x11')]?_0x46d70c[_0x41e2('0x11')]['id']:_0x41e2('0x12');var _0x187203=_0x3df0f1[_0x41e2('0x13')];var _0x14b8ec=_0x3df0f1[_0x41e2('0x14')];var _0x415f95=new Date(Number(_0x14b8ec));return _0x17e254(_0x190dd4,_0x415f95,_0x5d387c,_0x187203);})['catch'](function(_0x376b26){fileLogger(_0x41e2('0xe'))['error'](_0x376b26);});};}function setupLoggers(_0x2864db){return new Promise(function(_0x4cb6a2){var _0x973080=new ClientSideLogger();var _0x1cd7c1=fileLogger(_0x41e2('0x15'));var _0x436af6=fileLogger(_0x41e2('0x16'));_0x2864db[_0x41e2('0x17')](_0x41e2('0x18'),_0x973080);_0x2864db['use'](ewinston[_0x41e2('0x19')]({'winstonInstance':_0x1cd7c1,'meta':![],'statusLevels':!![],'msg':function(_0x120c46,_0x248057){var _0x297caa=_0x41e2('0x1a');if(!_[_0x41e2('0x1b')](_0x120c46['body'])){_0x297caa+=_0x41e2('0x1c');var _0x37b776=_0x120c46[_0x41e2('0x1d')];maskSensitiveData(_0x37b776);}return safeTemplate(util[_0x41e2('0x1e')](_0x297caa,_0x120c46[_0x41e2('0x1f')],_0x120c46[_0x41e2('0x20')][_0x41e2('0x21')]?_0x120c46[_0x41e2('0x20')][_0x41e2('0x21')]:_0x120c46[_0x41e2('0x22')][_0x41e2('0x23')]||_0x120c46['ip'],_0x120c46[_0x41e2('0x24')],_0x248057[_0x41e2('0x25')],_0x248057['responseTime'],_0x120c46[_0x41e2('0x11')]?_0x120c46['user']['id']:null,_0x120c46[_0x41e2('0x11')]?_0x120c46[_0x41e2('0x11')][_0x41e2('0xb')]:null,_0x120c46[_0x41e2('0x11')]?_0x120c46[_0x41e2('0x11')][_0x41e2('0xa')]:null,_0x37b776?util[_0x41e2('0x26')](_0x37b776,![],null):''));}}));_0x2864db[_0x41e2('0x27')](ewinston[_0x41e2('0x19')]({'winstonInstance':_0x436af6,'meta':![],'statusLevels':!![],'msg':function(_0x4b8cae,_0x4d0533){var _0x3b95b4=_0x41e2('0x28');if(_0x4b8cae[_0x41e2('0x1d')]&&_0x4b8cae['body'][_0x41e2('0x29')]&&_0x4b8cae['body'][_0x41e2('0x2a')]){_0x3b95b4=_0x41e2('0x2b');}return util[_0x41e2('0x1e')](_0x3b95b4,_0x4b8cae['method'],_0x4b8cae[_0x41e2('0x20')]['x-forwarded-for']?_0x4b8cae[_0x41e2('0x20')][_0x41e2('0x21')]:_0x4b8cae[_0x41e2('0x22')][_0x41e2('0x23')]||_0x4b8cae['ip'],_0x4b8cae[_0x41e2('0x24')],_0x4d0533[_0x41e2('0x25')],_0x4d0533['responseTime'],_0x4b8cae[_0x41e2('0x11')]?_0x4b8cae[_0x41e2('0x11')]['id']:null,_0x4b8cae[_0x41e2('0x11')]?_0x4b8cae['user'][_0x41e2('0xb')]:null,_0x4b8cae[_0x41e2('0x11')]?_0x4b8cae[_0x41e2('0x11')][_0x41e2('0xa')]:null,_0x4b8cae[_0x41e2('0x1d')]&&_0x4b8cae[_0x41e2('0x1d')][_0x41e2('0x29')]?_0x4b8cae['body'][_0x41e2('0x29')]:_0x41e2('0x2c'),_0x4b8cae[_0x41e2('0x1d')]&&_0x4b8cae[_0x41e2('0x1d')][_0x41e2('0x2a')]?_0x4b8cae[_0x41e2('0x1d')]['agent_id']:'',_0x4b8cae[_0x41e2('0x1d')]&&_0x4b8cae[_0x41e2('0x1d')][_0x41e2('0x2d')]?_0x4b8cae[_0x41e2('0x1d')]['agent_name']:'');},'ignoreRoute':function(_0x453121){var _0x50b3c7=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x50b3c7['test'](_0x453121['url']);}}));return _0x4cb6a2();});}exports[_0x41e2('0x2e')]=setupLoggers; \ No newline at end of file +var _0x0e2f=['body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','url','setupLoggers','fs-extra','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','catch','user','then','no-user','timestamp','error','api','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty'];(function(_0xd09de,_0x57caf7){var _0x2c24c4=function(_0x2c3318){while(--_0x2c3318){_0xd09de['push'](_0xd09de['shift']());}};_0x2c24c4(++_0x57caf7);}(_0x0e2f,0xd9));var _0xf0e2=function(_0xde8438,_0x40776a){_0xde8438=_0xde8438-0x0;var _0x4c7e38=_0x0e2f[_0xde8438];return _0x4c7e38;};var fs=require(_0xf0e2('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0xf0e2('0x1'));var util=require(_0xf0e2('0x2'));var fileLogger=require(_0xf0e2('0x3'))[_0xf0e2('0x4')];var safeTemplate=require(_0xf0e2('0x5'))[_0xf0e2('0x6')];var maskSensitiveData=require(_0xf0e2('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0xa83e3(_0xd3d640){var _0x4aaddd=path[_0xf0e2('0x8')](_0xf0e2('0x9'),_0xf0e2('0xa'),_0xf0e2('0xb'));var _0x47a64c=path['join'](_0xf0e2('0xc'),_0xd3d640[_0xf0e2('0xd')]+'-'+_0xd3d640[_0xf0e2('0xe')]);return fs[_0xf0e2('0xf')](path[_0xf0e2('0x8')](_0x4aaddd,_0x47a64c))['then'](function(){var _0xeaf94b=fileLogger(_0xf0e2('0xc'),path['join'](_0x4aaddd,_0x47a64c));return _0xeaf94b;})[_0xf0e2('0x10')](function(_0x28870e){throw _0x28870e;});}this['log']=function(_0x187230,_0x438e1c,_0x28c2f5,_0x33abab){return _0xa83e3(_0x187230[_0xf0e2('0x11')])[_0xf0e2('0x12')](function(_0x32e13d){var _0x582691=_0x32e13d[_0x438e1c];return _0x582691;})[_0xf0e2('0x12')](function(_0x573c4b){var _0x29ad8e=_0x187230[_0xf0e2('0x11')]?_0x187230[_0xf0e2('0x11')]['id']:_0xf0e2('0x13');var _0x3fd10d=_0x33abab['data'];var _0x295c3b=_0x33abab[_0xf0e2('0x14')];var _0x5e4a2d=new Date(Number(_0x295c3b));return _0x573c4b(_0x29ad8e,_0x5e4a2d,_0x28c2f5,_0x3fd10d);})[_0xf0e2('0x10')](function(_0x3378c8){fileLogger(_0xf0e2('0xc'))[_0xf0e2('0x15')](_0x3378c8);});};}function setupLoggers(_0x4ce9f6){return new Promise(function(_0x4f5582){var _0x10dff4=new ClientSideLogger();var _0x2e989c=fileLogger(_0xf0e2('0x16'));var _0x14bde9=fileLogger(_0xf0e2('0x17'));_0x4ce9f6['set'](_0xf0e2('0x18'),_0x10dff4);_0x4ce9f6[_0xf0e2('0x19')](ewinston['logger']({'winstonInstance':_0x2e989c,'meta':![],'statusLevels':!![],'msg':function(_0x10d279,_0x42e543){var _0x1efb0b=_0xf0e2('0x1a');if(!_[_0xf0e2('0x1b')](_0x10d279[_0xf0e2('0x1c')])){_0x1efb0b+=_0xf0e2('0x1d');var _0x45e8d0=_0x10d279[_0xf0e2('0x1c')];maskSensitiveData(_0x45e8d0);}return safeTemplate(util[_0xf0e2('0x1e')](_0x1efb0b,_0x10d279[_0xf0e2('0x1f')],_0x10d279[_0xf0e2('0x20')][_0xf0e2('0x21')]?_0x10d279[_0xf0e2('0x20')][_0xf0e2('0x21')]:_0x10d279[_0xf0e2('0x22')][_0xf0e2('0x23')]||_0x10d279['ip'],_0x10d279['url'],_0x42e543[_0xf0e2('0x24')],_0x42e543[_0xf0e2('0x25')],_0x10d279[_0xf0e2('0x11')]?_0x10d279['user']['id']:null,_0x10d279[_0xf0e2('0x11')]?_0x10d279[_0xf0e2('0x11')][_0xf0e2('0xe')]:null,_0x10d279[_0xf0e2('0x11')]?_0x10d279[_0xf0e2('0x11')][_0xf0e2('0xd')]:null,_0x45e8d0?util[_0xf0e2('0x26')](_0x45e8d0,![],null):''));}}));_0x4ce9f6[_0xf0e2('0x19')](ewinston[_0xf0e2('0x27')]({'winstonInstance':_0x14bde9,'meta':![],'statusLevels':!![],'msg':function(_0x399561,_0x208ce8){var _0x3d31ed=_0xf0e2('0x28');if(_0x399561['body']&&_0x399561[_0xf0e2('0x1c')][_0xf0e2('0x29')]&&_0x399561[_0xf0e2('0x1c')][_0xf0e2('0x2a')]){_0x3d31ed=_0xf0e2('0x2b');}return util[_0xf0e2('0x1e')](_0x3d31ed,_0x399561[_0xf0e2('0x1f')],_0x399561[_0xf0e2('0x20')]['x-forwarded-for']?_0x399561[_0xf0e2('0x20')][_0xf0e2('0x21')]:_0x399561['connection'][_0xf0e2('0x23')]||_0x399561['ip'],_0x399561['url'],_0x208ce8['statusCode'],_0x208ce8[_0xf0e2('0x25')],_0x399561[_0xf0e2('0x11')]?_0x399561['user']['id']:null,_0x399561['user']?_0x399561[_0xf0e2('0x11')]['name']:null,_0x399561[_0xf0e2('0x11')]?_0x399561[_0xf0e2('0x11')][_0xf0e2('0xd')]:null,_0x399561[_0xf0e2('0x1c')]&&_0x399561[_0xf0e2('0x1c')]['device']?_0x399561[_0xf0e2('0x1c')][_0xf0e2('0x29')]:_0xf0e2('0x2c'),_0x399561[_0xf0e2('0x1c')]&&_0x399561[_0xf0e2('0x1c')]['agent_id']?_0x399561['body'][_0xf0e2('0x2a')]:'',_0x399561[_0xf0e2('0x1c')]&&_0x399561[_0xf0e2('0x1c')][_0xf0e2('0x2d')]?_0x399561[_0xf0e2('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x436f24){var _0x1a76e4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a76e4[_0xf0e2('0x2e')](_0x436f24[_0xf0e2('0x2f')]);}}));return _0x4f5582();});}exports[_0xf0e2('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index fe32885..1d13e55 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeac=['isMoment','padStart','length','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','weekdaysShort','locale','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','clone','hours','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','max','min','domCompare','includes','monthCompare','guess','test'];(function(_0x3ea3ae,_0x29dd29){var _0x2aa587=function(_0x1d6dca){while(--_0x1d6dca){_0x3ea3ae['push'](_0x3ea3ae['shift']());}};_0x2aa587(++_0x29dd29);}(_0xdeac,0xed));var _0xcdea=function(_0x46b69a,_0xbc7339){_0x46b69a=_0x46b69a-0x0;var _0x497482=_0xdeac[_0x46b69a];return _0x497482;};var _=require(_0xcdea('0x0'));var moment=require(_0xcdea('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x3e52e3){return _0x3e52e3[_0xcdea('0x2')];})[_0xcdea('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcdea('0x4');var EINVALID_DATE=_0xcdea('0x5');function throwIfDateNotValid(_0x3c5f8e){if(!_0x3c5f8e[_0xcdea('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x125475){var _0x19567a=_0x125475[_0xcdea('0x7')](':')[_0xcdea('0x8')](function(_0x24ca99){return parseInt(_0x24ca99,0xa);});var _0x5a83ee=_0x19567a[0x0];var _0x3c6764=_0x19567a[0x1];if(_0x5a83ee<0x0||_0x5a83ee>0x17||_0x3c6764<0x0||_0x3c6764>0x3b){throw new Error(EINVALID_DATE);}return[_0x5a83ee,_0x3c6764];}function circularDoWInterval(_0x21a9e3,_0x446cba){if(_0x21a9e3===_0x446cba){return[_0x21a9e3];}else{var _0x3f7a8c=moment['locale']();moment['locale']('en');var _0x415d34=moment[_0xcdea('0x9')]()[_0xcdea('0x8')](function(_0x53b3a9){return _0x53b3a9['toLowerCase']();});moment[_0xcdea('0xa')](_0x3f7a8c);var _0x22410b=_0x415d34[_0xcdea('0xb')](_0x21a9e3);var _0x29f574=_0x415d34[_0xcdea('0xb')](_0x446cba);if(_0x29f574>_0x22410b){return _0x415d34[_0xcdea('0xc')](_0x22410b,_0x29f574+0x1);}else{var _0x577c6b=_0x415d34[_0xcdea('0xc')](0x0,_0x29f574+0x1);var _0x53d52e=_0x415d34['slice'](_0x22410b);return _0x53d52e[_0xcdea('0xd')](_0x577c6b);}}}module[_0xcdea('0xe')][_0xcdea('0xf')]=circularDoWInterval;function circularMonthInterval(_0x23713a,_0x5be79d){if(_0x23713a===_0x5be79d){return[_0x23713a];}else{var _0x4c1d21=moment[_0xcdea('0xa')]();moment[_0xcdea('0xa')]('en');var _0x2ac5d3=moment[_0xcdea('0x10')]()[_0xcdea('0x8')](function(_0x4effe3){return _0x4effe3[_0xcdea('0x11')]();});moment[_0xcdea('0xa')](_0x4c1d21);var _0x18fa11=_0x2ac5d3[_0xcdea('0xb')](_0x23713a);var _0x3a6d6b=_0x2ac5d3[_0xcdea('0xb')](_0x5be79d);if(_0x3a6d6b>_0x18fa11){return _0x2ac5d3['slice'](_0x18fa11,_0x3a6d6b+0x1);}else{var _0x4905a1=_0x2ac5d3['slice'](0x0,_0x3a6d6b+0x1);var _0x595bc6=_0x2ac5d3[_0xcdea('0xc')](_0x18fa11);return _0x595bc6[_0xcdea('0xd')](_0x4905a1);}}}module[_0xcdea('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0xb190d4){var _0x2821b5=parseInt(_0xb190d4,0xa);if(_0x2821b5<0x1||_0x2821b5>0x1f){throw new Error(EINVALID_DATE);}return _0x2821b5;}function timeCompare(_0x1a2e86,_0xc8093c,_0x538045){var _0x3ed871=_0x1a2e86['clone']();var _0x21054d=extractTime(_0xc8093c);var _0x522979=_0x21054d[0x0];var _0x3740a4=_0x21054d[0x1];var _0x4492ed=_0x1a2e86[_0xcdea('0x12')]()['hours'](_0x522979)['minutes'](_0x3740a4);throwIfDateNotValid(_0x4492ed);var _0xdaa818=extractTime(_0x538045);var _0x5b3d19=_0xdaa818[0x0];var _0x4ab02a=_0xdaa818[0x1];var _0x5f2bab=_0x1a2e86[_0xcdea('0x12')]()[_0xcdea('0x13')](_0x5b3d19)['minutes'](_0x4ab02a);throwIfDateNotValid(_0x5f2bab);if(_0x5f2bab[_0xcdea('0x14')](_0x4492ed)){var _0x34d9e2=_0x3ed871[_0xcdea('0x12')]()[_0xcdea('0x15')](_0xcdea('0x16'));var _0x1f58a6=_0x3ed871[_0xcdea('0x12')]()[_0xcdea('0x17')]('day');return _0x3ed871[_0xcdea('0x18')](_0x4492ed,_0x1f58a6,undefined,'[]')||_0x3ed871[_0xcdea('0x18')](_0x34d9e2,_0x5f2bab,undefined,'[]');}else{return _0x3ed871['isBetween'](_0x4492ed,_0x5f2bab,undefined,'[]');}}module[_0xcdea('0xe')][_0xcdea('0x19')]=timeCompare;function dowCompare(_0x6a2eff,_0x32b105,_0x31898b){var _0x7972b2=_0x6a2eff['locale']('en')[_0xcdea('0x1a')](_0xcdea('0x1b'))['toLowerCase']();return circularDoWInterval(_0x32b105,_0x31898b)['includes'](_0x7972b2);}module['exports'][_0xcdea('0x1c')]=dowCompare;function domCompare(_0x7cf326,_0x37009a,_0x30b089){var _0x529928=_0x7cf326['date']();if(_0x37009a===_0x30b089){return _0x529928===_0x37009a;}else{var _0x243d60=_0x7cf326['daysInMonth']();var _0x4d3f36=_0x37009a<_0x30b089;let _0x2d69e6=![];var _0x87e4d4=0x0;var _0x196a38=0x0;if(_0x4d3f36){_0x87e4d4=Math[_0xcdea('0x1d')](0x1,_0x37009a);_0x196a38=Math['min'](_0x30b089,_0x243d60);_0x2d69e6=_0x529928>=_0x87e4d4&&_0x529928<=_0x196a38;}else{_0x87e4d4=Math[_0xcdea('0x1e')](_0x37009a,_0x243d60);_0x196a38=Math[_0xcdea('0x1d')](0x1,_0x30b089);_0x2d69e6=_0x529928>=_0x87e4d4||_0x529928<=_0x196a38;}return _0x2d69e6;}}module[_0xcdea('0xe')][_0xcdea('0x1f')]=domCompare;function monthCompare(_0x133033,_0x4fbaa4,_0x571814){var _0x36b03d=_0x133033[_0xcdea('0xa')]('en')[_0xcdea('0x1a')]('MMM')[_0xcdea('0x11')]();return circularMonthInterval(_0x4fbaa4,_0x571814)[_0xcdea('0x20')](_0x36b03d);}module[_0xcdea('0xe')][_0xcdea('0x21')]=monthCompare;function iftime(_0x3e16a4,_0x403322=moment['tz'][_0xcdea('0x22')](),_0x34f7f1=moment()){if(!validateRx[_0xcdea('0x23')](_0x3e16a4)){throw new Error(EINVALID_STRING);}else{var _0x2f1b08=(moment[_0xcdea('0x24')](_0x34f7f1)?_0x34f7f1['clone']():moment(_0x34f7f1))['tz'](_0x403322)['locale']('en');throwIfDateNotValid(_0x2f1b08);var _0x11ff99=_0x3e16a4['split'](',');var _0x358878=_0x11ff99[0x0];var _0x5ef0d1=_0x11ff99[0x1];var _0x39748b=_0x11ff99[0x2];var _0x1e8d19=_0x11ff99[0x3];let _0x364058=!![];if(_0x358878!=='*'){var _0x252d10=_0x358878[_0xcdea('0x7')]('-');var _0x426603=_[_0xcdea('0x25')](_0x252d10[0x0],0x5,'0');var _0x37cfb7=_0x252d10[_0xcdea('0x26')]===0x2?_[_0xcdea('0x25')](_0x252d10[0x1],0x5,'0'):_0x426603;_0x364058=timeCompare(_0x2f1b08,_0x426603,_0x37cfb7);}let _0x21e79c=!![];if(_0x5ef0d1!=='*'){var _0x33be0b=_0x5ef0d1[_0xcdea('0x7')]('-');var _0x1b5949=_0x33be0b[0x0];var _0x4e184e=_0x33be0b[_0xcdea('0x26')]===0x2?_0x33be0b[0x1]:_0x1b5949;_0x21e79c=dowCompare(_0x2f1b08,_0x1b5949,_0x4e184e);}let _0x45bf9a=!![];if(_0x39748b!=='*'){var _0x11064b=_0x39748b[_0xcdea('0x7')]('-');var _0x174cda=parseDom(_0x11064b[0x0]);var _0x2caf29=_0x11064b[_0xcdea('0x26')]===0x2?parseDom(_0x11064b[0x1]):_0x174cda;_0x45bf9a=domCompare(_0x2f1b08,_0x174cda,_0x2caf29);}let _0x35e076=!![];if(_0x1e8d19!=='*'){var _0x2d2051=_0x1e8d19[_0xcdea('0x7')]('-');var _0x4f7a0c=_0x2d2051[0x0];var _0xb4b5d2=_0x2d2051[_0xcdea('0x26')]===0x2?_0x2d2051[0x1]:_0x2d2051[0x0];_0x35e076=monthCompare(_0x2f1b08,_0x4f7a0c,_0xb4b5d2);}return _0x364058&&_0x21e79c&&_0x45bf9a&&_0x35e076;}}module[_0xcdea('0xe')]['iftime']=iftime; \ No newline at end of file +var _0x0763=['padStart','length','iftime','lodash','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','map','toLowerCase','slice','exports','monthsShort','indexOf','concat','clone','hours','minutes','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test'];(function(_0x3d35a2,_0x1240da){var _0x539ed2=function(_0xf2c2e9){while(--_0xf2c2e9){_0x3d35a2['push'](_0x3d35a2['shift']());}};_0x539ed2(++_0x1240da);}(_0x0763,0x17f));var _0x3076=function(_0x29733c,_0x2da30b){_0x29733c=_0x29733c-0x0;var _0x49e72f=_0x0763[_0x29733c];return _0x49e72f;};var _=require(_0x3076('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x2e40c0){return _0x2e40c0['source'];})[_0x3076('0x1')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3076('0x2');var EINVALID_DATE=_0x3076('0x3');function throwIfDateNotValid(_0x116684){if(!_0x116684[_0x3076('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x229d95){var _0x7a040b=_0x229d95[_0x3076('0x5')](':')['map'](function(_0x36e38f){return parseInt(_0x36e38f,0xa);});var _0x4c2da9=_0x7a040b[0x0];var _0x3216e6=_0x7a040b[0x1];if(_0x4c2da9<0x0||_0x4c2da9>0x17||_0x3216e6<0x0||_0x3216e6>0x3b){throw new Error(EINVALID_DATE);}return[_0x4c2da9,_0x3216e6];}function circularDoWInterval(_0x2b23b2,_0x109b42){if(_0x2b23b2===_0x109b42){return[_0x2b23b2];}else{var _0x1b5914=moment['locale']();moment[_0x3076('0x6')]('en');var _0x6dd1fd=moment[_0x3076('0x7')]()[_0x3076('0x8')](function(_0x405243){return _0x405243[_0x3076('0x9')]();});moment[_0x3076('0x6')](_0x1b5914);var _0x20c040=_0x6dd1fd['indexOf'](_0x2b23b2);var _0x427d4d=_0x6dd1fd['indexOf'](_0x109b42);if(_0x427d4d>_0x20c040){return _0x6dd1fd[_0x3076('0xa')](_0x20c040,_0x427d4d+0x1);}else{var _0x44c2f1=_0x6dd1fd[_0x3076('0xa')](0x0,_0x427d4d+0x1);var _0x4c7b55=_0x6dd1fd['slice'](_0x20c040);return _0x4c7b55['concat'](_0x44c2f1);}}}module[_0x3076('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x7f3780,_0x3d6305){if(_0x7f3780===_0x3d6305){return[_0x7f3780];}else{var _0x2e4ef2=moment['locale']();moment['locale']('en');var _0x51047b=moment[_0x3076('0xc')]()[_0x3076('0x8')](function(_0x57f0d3){return _0x57f0d3[_0x3076('0x9')]();});moment[_0x3076('0x6')](_0x2e4ef2);var _0x36aa36=_0x51047b[_0x3076('0xd')](_0x7f3780);var _0x427cc6=_0x51047b['indexOf'](_0x3d6305);if(_0x427cc6>_0x36aa36){return _0x51047b[_0x3076('0xa')](_0x36aa36,_0x427cc6+0x1);}else{var _0x32f484=_0x51047b[_0x3076('0xa')](0x0,_0x427cc6+0x1);var _0x2d11b8=_0x51047b[_0x3076('0xa')](_0x36aa36);return _0x2d11b8[_0x3076('0xe')](_0x32f484);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x3125b6){var _0x12d6bc=parseInt(_0x3125b6,0xa);if(_0x12d6bc<0x1||_0x12d6bc>0x1f){throw new Error(EINVALID_DATE);}return _0x12d6bc;}function timeCompare(_0x44b3c1,_0x5a7b54,_0x2b2ad3){var _0x3f917b=_0x44b3c1[_0x3076('0xf')]();var _0x592e01=extractTime(_0x5a7b54);var _0x242d49=_0x592e01[0x0];var _0x48bcc3=_0x592e01[0x1];var _0x197879=_0x44b3c1[_0x3076('0xf')]()[_0x3076('0x10')](_0x242d49)['minutes'](_0x48bcc3);throwIfDateNotValid(_0x197879);var _0x4953e9=extractTime(_0x2b2ad3);var _0x27b1a7=_0x4953e9[0x0];var _0x366d90=_0x4953e9[0x1];var _0x10ce26=_0x44b3c1['clone']()[_0x3076('0x10')](_0x27b1a7)[_0x3076('0x11')](_0x366d90);throwIfDateNotValid(_0x10ce26);if(_0x10ce26['isBefore'](_0x197879)){var _0x1fb937=_0x3f917b[_0x3076('0xf')]()[_0x3076('0x12')](_0x3076('0x13'));var _0x3f6747=_0x3f917b[_0x3076('0xf')]()['endOf'](_0x3076('0x13'));return _0x3f917b[_0x3076('0x14')](_0x197879,_0x3f6747,undefined,'[]')||_0x3f917b['isBetween'](_0x1fb937,_0x10ce26,undefined,'[]');}else{return _0x3f917b[_0x3076('0x14')](_0x197879,_0x10ce26,undefined,'[]');}}module[_0x3076('0xb')][_0x3076('0x15')]=timeCompare;function dowCompare(_0x3563cf,_0x56e32,_0x31e3f0){var _0x696988=_0x3563cf[_0x3076('0x6')]('en')[_0x3076('0x16')](_0x3076('0x17'))[_0x3076('0x9')]();return circularDoWInterval(_0x56e32,_0x31e3f0)[_0x3076('0x18')](_0x696988);}module[_0x3076('0xb')][_0x3076('0x19')]=dowCompare;function domCompare(_0xa61ed7,_0x39fbae,_0x1473b0){var _0x1dc92a=_0xa61ed7[_0x3076('0x1a')]();if(_0x39fbae===_0x1473b0){return _0x1dc92a===_0x39fbae;}else{var _0x106603=_0xa61ed7[_0x3076('0x1b')]();var _0x5527fd=_0x39fbae<_0x1473b0;let _0x1fd4df=![];var _0x46b813=0x0;var _0x489d22=0x0;if(_0x5527fd){_0x46b813=Math[_0x3076('0x1c')](0x1,_0x39fbae);_0x489d22=Math[_0x3076('0x1d')](_0x1473b0,_0x106603);_0x1fd4df=_0x1dc92a>=_0x46b813&&_0x1dc92a<=_0x489d22;}else{_0x46b813=Math[_0x3076('0x1d')](_0x39fbae,_0x106603);_0x489d22=Math[_0x3076('0x1c')](0x1,_0x1473b0);_0x1fd4df=_0x1dc92a>=_0x46b813||_0x1dc92a<=_0x489d22;}return _0x1fd4df;}}module[_0x3076('0xb')][_0x3076('0x1e')]=domCompare;function monthCompare(_0x2aeaf8,_0x30d097,_0x41abb9){var _0x49ddc9=_0x2aeaf8[_0x3076('0x6')]('en')['format'](_0x3076('0x1f'))[_0x3076('0x9')]();return circularMonthInterval(_0x30d097,_0x41abb9)[_0x3076('0x18')](_0x49ddc9);}module[_0x3076('0xb')][_0x3076('0x20')]=monthCompare;function iftime(_0x48469c,_0x302d91=moment['tz'][_0x3076('0x21')](),_0x599f52=moment()){if(!validateRx[_0x3076('0x22')](_0x48469c)){throw new Error(EINVALID_STRING);}else{var _0x5b1164=(moment['isMoment'](_0x599f52)?_0x599f52[_0x3076('0xf')]():moment(_0x599f52))['tz'](_0x302d91)[_0x3076('0x6')]('en');throwIfDateNotValid(_0x5b1164);var _0x3c8b83=_0x48469c[_0x3076('0x5')](',');var _0x45899a=_0x3c8b83[0x0];var _0x211703=_0x3c8b83[0x1];var _0x1dc2bf=_0x3c8b83[0x2];var _0x4e399e=_0x3c8b83[0x3];let _0x2ae169=!![];if(_0x45899a!=='*'){var _0x11d362=_0x45899a[_0x3076('0x5')]('-');var _0x23f797=_['padStart'](_0x11d362[0x0],0x5,'0');var _0x55b6bd=_0x11d362['length']===0x2?_[_0x3076('0x23')](_0x11d362[0x1],0x5,'0'):_0x23f797;_0x2ae169=timeCompare(_0x5b1164,_0x23f797,_0x55b6bd);}let _0x5261f9=!![];if(_0x211703!=='*'){var _0x45f3e1=_0x211703[_0x3076('0x5')]('-');var _0x234295=_0x45f3e1[0x0];var _0x485674=_0x45f3e1[_0x3076('0x24')]===0x2?_0x45f3e1[0x1]:_0x234295;_0x5261f9=dowCompare(_0x5b1164,_0x234295,_0x485674);}let _0xbe6b63=!![];if(_0x1dc2bf!=='*'){var _0x2d1647=_0x1dc2bf[_0x3076('0x5')]('-');var _0x5cfe8d=parseDom(_0x2d1647[0x0]);var _0xe11e45=_0x2d1647[_0x3076('0x24')]===0x2?parseDom(_0x2d1647[0x1]):_0x5cfe8d;_0xbe6b63=domCompare(_0x5b1164,_0x5cfe8d,_0xe11e45);}let _0x5142d8=!![];if(_0x4e399e!=='*'){var _0x504288=_0x4e399e['split']('-');var _0x23e37e=_0x504288[0x0];var _0xc4678d=_0x504288[_0x3076('0x24')]===0x2?_0x504288[0x1]:_0x504288[0x0];_0x5142d8=monthCompare(_0x5b1164,_0x23e37e,_0xc4678d);}return _0x2ae169&&_0x5261f9&&_0xbe6b63&&_0x5142d8;}}module['exports'][_0x3076('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 9bb7261..622dc7b 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x442a=['bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Console','File','%s-%s','error','transports','fileLogger','path','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','gray','bold\x20magenta'];(function(_0x5e3773,_0x4778c6){var _0x4868d4=function(_0x507f15){while(--_0x507f15){_0x5e3773['push'](_0x5e3773['shift']());}};_0x4868d4(++_0x4778c6);}(_0x442a,0xf7));var _0xa442=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x442a[_0x43d16c];return _0x208cce;};'use strict';var path=require(_0xa442('0x0'));var util=require('util');var moment=require('moment');var winston=require(_0xa442('0x1'));var config=require(_0xa442('0x2'));var debugLevel=config[_0xa442('0x3')]?config['debugLevel'][_0xa442('0x4')]():_0xa442('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xa442('0x6'),'error':_0xa442('0x7'),'warn':_0xa442('0x8'),'info':_0xa442('0x9'),'print':'bold\x20white','success':'bold\x20green','http':_0xa442('0xa'),'verbose':_0xa442('0xb'),'debug':_0xa442('0xc'),'silly':_0xa442('0xd')};winston[_0xa442('0xe')](XC_LOG_COLORS);function getLogFileName(_0x1ee408,_0x3ed886,_0x111bf4){var _0x548151=_0x1ee408||_0xa442('0xf');return path[_0xa442('0x10')](_0x548151,util[_0xa442('0x11')](_0xa442('0x12'),_0x3ed886,_0x111bf4));}function formatter(_0x49b868,_0x263705){_0x263705[_0xa442('0x13')]=_0x263705[_0xa442('0x13')][_0xa442('0x14')](/@@{/g,_0xa442('0x15'))['replace'](/}@@/g,_0xa442('0x16'))[_0xa442('0x14')](/@{/g,'{{')[_0xa442('0x14')](/}@/g,'}}');return util['format'](_0xa442('0x17'),moment()[_0xa442('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x263705[_0xa442('0x18')]['toUpperCase'](),_0x49b868,_0x263705[_0xa442('0x13')]);}function fileFormat(_0x3f69b0,_0x16aaa8){_0x16aaa8[_0xa442('0x13')]=_0x16aaa8[_0xa442('0x13')][_0xa442('0x14')](/@@{/g,_0xa442('0x15'))[_0xa442('0x14')](/}@@/g,_0xa442('0x16'))['replace'](/@{/g,'{{')[_0xa442('0x14')](/}@/g,'}}');var _0xd51743=_0x16aaa8[_0xa442('0x19')]&&Object[_0xa442('0x1a')](_0x16aaa8[_0xa442('0x19')])['length']?'\x0a\x09'+JSON[_0xa442('0x1b')](_0x16aaa8[_0xa442('0x19')]):'';return util[_0xa442('0x11')](_0xa442('0x1c'),moment()[_0xa442('0x11')](_0xa442('0x1d')),_0x16aaa8['level'][_0xa442('0x1e')](),_0x3f69b0,_0x16aaa8[_0xa442('0x13')],_0xd51743);}function consoleLogger(){var _0x52e8be=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xa442('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x3794d3){return formatter('',_0x3794d3);}})]});return _0x52e8be;}function fileLogger(_0x32eaad,_0x38859e){var _0x2ff244=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xa442('0x20'))]({'name':util[_0xa442('0x11')](_0xa442('0x21'),_0x32eaad,_0xa442('0x22')),'filename':getLogFileName(_0x38859e,_0x32eaad,_0xa442('0x22')),'level':_0xa442('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2395b6){return fileFormat(_0x32eaad,_0x2395b6);}}),new winston[(_0xa442('0x23'))]['File']({'name':util[_0xa442('0x11')](_0xa442('0x21'),_0x32eaad,debugLevel),'filename':getLogFileName(_0x38859e,_0x32eaad,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x489529){return fileFormat(_0x32eaad,_0x489529);}}),new winston[(_0xa442('0x23'))]['Console']({'level':'warn','json':![],'formatter':function(_0x59d4f7){return fileFormat(_0x32eaad,_0x59d4f7);}})]});return _0x2ff244;}exports['consoleLogger']=consoleLogger;exports[_0xa442('0x24')]=fileLogger; \ No newline at end of file +var _0x7315=['transports','Console','%s-%s','error','File','warn','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','{{{','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7315,0xd5));var _0x5731=function(_0x307046,_0x45e3a6){_0x307046=_0x307046-0x0;var _0x2183b2=_0x7315[_0x307046];return _0x2183b2;};'use strict';var path=require(_0x5731('0x0'));var util=require(_0x5731('0x1'));var moment=require(_0x5731('0x2'));var winston=require(_0x5731('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x5731('0x4')][_0x5731('0x5')]():_0x5731('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5731('0x7'),'error':_0x5731('0x8'),'warn':_0x5731('0x9'),'info':'white','print':_0x5731('0xa'),'success':_0x5731('0xb'),'http':_0x5731('0xc'),'verbose':_0x5731('0xd'),'debug':_0x5731('0xe'),'silly':_0x5731('0xf')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x189db9,_0x188571,_0x29c40e){var _0x193648=_0x189db9||_0x5731('0x10');return path[_0x5731('0x11')](_0x193648,util[_0x5731('0x12')](_0x5731('0x13'),_0x188571,_0x29c40e));}function formatter(_0x49bcbb,_0x3b9a85){_0x3b9a85[_0x5731('0x14')]=_0x3b9a85[_0x5731('0x14')]['replace'](/@@{/g,'{{{')[_0x5731('0x15')](/}@@/g,_0x5731('0x16'))['replace'](/@{/g,'{{')[_0x5731('0x15')](/}@/g,'}}');return util['format'](_0x5731('0x17'),moment()[_0x5731('0x12')](_0x5731('0x18')),_0x3b9a85[_0x5731('0x19')]['toUpperCase'](),_0x49bcbb,_0x3b9a85[_0x5731('0x14')]);}function fileFormat(_0x58695a,_0x568a6b){_0x568a6b[_0x5731('0x14')]=_0x568a6b['message'][_0x5731('0x15')](/@@{/g,_0x5731('0x1a'))[_0x5731('0x15')](/}@@/g,_0x5731('0x16'))[_0x5731('0x15')](/@{/g,'{{')[_0x5731('0x15')](/}@/g,'}}');var _0xe035c8=_0x568a6b[_0x5731('0x1b')]&&Object['keys'](_0x568a6b['meta'])[_0x5731('0x1c')]?'\x0a\x09'+JSON[_0x5731('0x1d')](_0x568a6b[_0x5731('0x1b')]):'';return util['format'](_0x5731('0x1e'),moment()[_0x5731('0x12')](_0x5731('0x18')),_0x568a6b[_0x5731('0x19')][_0x5731('0x1f')](),_0x58695a,_0x568a6b[_0x5731('0x14')],_0xe035c8);}function consoleLogger(){var _0x4f5a91=new winston[(_0x5731('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5731('0x21'))][(_0x5731('0x22'))]({'level':'warn','json':![],'formatter':function(_0xb1ad6){return formatter('',_0xb1ad6);}})]});return _0x4f5a91;}function fileLogger(_0x7cba85,_0x1dd259){var _0x5544b6=new winston[(_0x5731('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5731('0x21'))]['File']({'name':util['format'](_0x5731('0x23'),_0x7cba85,'error'),'filename':getLogFileName(_0x1dd259,_0x7cba85,'error'),'level':_0x5731('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x464c53){return fileFormat(_0x7cba85,_0x464c53);}}),new winston['transports'][(_0x5731('0x25'))]({'name':util[_0x5731('0x12')](_0x5731('0x23'),_0x7cba85,debugLevel),'filename':getLogFileName(_0x1dd259,_0x7cba85,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x24442f){return fileFormat(_0x7cba85,_0x24442f);}}),new winston[(_0x5731('0x21'))][(_0x5731('0x22'))]({'level':_0x5731('0x26'),'json':![],'formatter':function(_0x18f9c5){return fileFormat(_0x7cba85,_0x18f9c5);}})]});return _0x5544b6;}exports[_0x5731('0x27')]=consoleLogger;exports[_0x5731('0x28')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 4ac47db..cca76d4 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','code','accessKey','tenantId','accessToken'];(function(_0x3a068d,_0x47f761){var _0x528447=function(_0x207feb){while(--_0x207feb){_0x3a068d['push'](_0x3a068d['shift']());}};_0x528447(++_0x47f761);}(_0x14a0,0x8e));var _0x014a=function(_0xcca2a4,_0x5508eb){_0xcca2a4=_0xcca2a4-0x0;var _0x1c5771=_0x14a0[_0xcca2a4];return _0x1c5771;};var _=require('lodash');var sensitiveFields=[_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'phone','mobile',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'clientSecret','securityToken',_0x014a('0xa'),_0x014a('0xb'),_0x014a('0xc'),'token','channelSecret',_0x014a('0xd'),'accessTokenSecret','authToken','consumerKey','consumerSecret',_0x014a('0xe'),'calleridname',_0x014a('0xf'),_0x014a('0x10'),'vidaooApiKey',_0x014a('0x11'),_0x014a('0x12'),_0x014a('0x13'),_0x014a('0x14'),_0x014a('0x15'),_0x014a('0x16'),_0x014a('0x17'),_0x014a('0x18'),_0x014a('0x19'),_0x014a('0x1a'),_0x014a('0x1b'),_0x014a('0x1c'),'oldPassword'];function maskSensitiveData(_0x130d13){const _0x3cf92f=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x130d13)){for(const _0x3a836f in _0x130d13){if(_[_0x014a('0x1d')](_0x130d13[_0x3a836f])){for(let _0x59a4ea=0x0;_0x59a4ea<_0x130d13[_0x3a836f][_0x014a('0x1e')];_0x59a4ea++){maskSensitiveData(_0x130d13[_0x3a836f][_0x59a4ea]);}}else if(_[_0x014a('0x1f')](_0x130d13[_0x3a836f])){maskSensitiveData(_0x130d13[_0x3a836f]);}else if(_[_0x014a('0x20')](_0x130d13[_0x3a836f])){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](/{{{/g,_0x014a('0x22'))[_0x014a('0x21')](/}}}/g,_0x014a('0x23'))[_0x014a('0x21')](/{{/g,'@{')[_0x014a('0x21')](/}}/g,'}@');if(_[_0x014a('0x24')](sensitiveFields,_0x3a836f)){_0x130d13[_0x3a836f]=_0x130d13[_0x3a836f][_0x014a('0x21')](_0x3cf92f,'*');}}}}}module[_0x014a('0x25')][_0x014a('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1967,0x173));var _0x7196=function(_0x3fea1b,_0x429b76){_0x3fea1b=_0x3fea1b-0x0;var _0x58a271=_0x1967[_0x3fea1b];return _0x58a271;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 7b12d29..273a8ea 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abf=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x2308f8,_0xaeabda){var _0x27d583=function(_0xece7eb){while(--_0xece7eb){_0x2308f8['push'](_0x2308f8['shift']());}};_0x27d583(++_0xaeabda);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};var _=require(_0xf0ab('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4d04cc){return _0x4d04cc==='{{'?_0xf0ab('0x1'):_0xf0ab('0x2');}function safeTemplate(_0x528ef7){var _0x598001=_0x528ef7;if(typeof _0x528ef7===_0xf0ab('0x3')){_0x598001=_0x528ef7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf0ab('0x4')](_0x528ef7)){_0x598001=_0x528ef7[_0xf0ab('0x5')](function(_0x2efe43){return safeTemplate(_0x2efe43);});}else if(_[_0xf0ab('0x6')](_0x528ef7)){_0x598001=Object[_0xf0ab('0x7')](_0x528ef7)[_0xf0ab('0x8')](function(_0x233afe,_0x57ff3b){_0x233afe[_0x57ff3b]=safeTemplate(_0x528ef7[_0x57ff3b]);return _0x233afe;},{});}return _0x598001;}module[_0xf0ab('0x9')][_0xf0ab('0xa')]=safeTemplate; \ No newline at end of file +var _0xda2d=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','map','isPlainObject','keys','reduce'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xda2d,0x102));var _0xdda2=function(_0x1663e0,_0x1f7f57){_0x1663e0=_0x1663e0-0x0;var _0x35f8ac=_0xda2d[_0x1663e0];return _0x35f8ac;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x14e970){return _0x14e970==='{{'?_0xdda2('0x0'):_0xdda2('0x1');}function safeTemplate(_0x1f1fcc){var _0x329c5e=_0x1f1fcc;if(typeof _0x1f1fcc==='string'){_0x329c5e=_0x1f1fcc['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x1f1fcc)){_0x329c5e=_0x1f1fcc[_0xdda2('0x2')](function(_0x319129){return safeTemplate(_0x319129);});}else if(_[_0xdda2('0x3')](_0x1f1fcc)){_0x329c5e=Object[_0xdda2('0x4')](_0x1f1fcc)[_0xdda2('0x5')](function(_0xf38e58,_0x2f55dc){_0xf38e58[_0x2f55dc]=safeTemplate(_0x1f1fcc[_0x2f55dc]);return _0xf38e58;},{});}return _0x329c5e;}module[_0xdda2('0x6')][_0xdda2('0x7')]=safeTemplate; \ No newline at end of file -- 1.7.1